(self.webpackChunkwebpackWcBlocksFrontendJsonp=self.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[232,442],{8415:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>b});var o=l(1616),n=l(1609),a=l(6087),s=l(7723),r=l(851),c=l(5703),i=l(2796),d=l(3249),u=l(7103),m=l(6809);l(5183);let g=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const p=e=>(0,n.createElement)("img",{...e,src:c.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),y=({image:e,loaded:t,showFullSize:l,fallbackAlt:o,width:s,scale:r,height:c,aspectRatio:i})=>{const{thumbnail:d,src:u,srcset:m,sizes:g,alt:y}=e||{},h={alt:y||o,hidden:!t,src:d,...l&&{src:u,srcSet:m,sizes:g}},f={height:c,width:s,objectFit:r,aspectRatio:i};return(0,n.createElement)(a.Fragment,null,h.src&&(0,n.createElement)("img",{style:f,"data-testid":"product-image",...h}),!e&&(0,n.createElement)(p,{style:f}))},h=(0,o.withProductDataContext)((e=>{const{className:t,imageSizing:l=g.SINGLE,showProductLink:o=!0,showSaleBadge:c,saleBadgeAlign:h="right",height:f,width:b,scale:v,aspectRatio:k,...w}=e,S=(0,d.p)(e),{parentClassName:N}=(0,i.useInnerBlockLayoutContext)(),{product:E,isLoading:C}=(0,i.useProductDataContext)(),{dispatchStoreEvent:L}=(0,u.y)();if(!E.id)return(0,n.createElement)("div",{className:(0,r.A)(t,"wc-block-components-product-image",{[`${N}__product-image`]:N},S.className),style:S.style},(0,n.createElement)(p,null));const _=!!E.images.length,A=_?E.images[0]:null,x=o?"a":a.Fragment,B=(0,s.sprintf)(/* translators: %s is referring to the product name */ /* translators: %s is referring to the product name */
(0,s.__)("Link to %s","woocommerce"),E.name),F={href:E.permalink,...!_&&{"aria-label":B},onClick:()=>{L("product-view-link",{product:E})}};return delete w.style,(0,n.createElement)("div",{className:(0,r.A)(t,"wc-block-components-product-image",{[`${N}__product-image`]:N},S.className),style:S.style},(0,n.createElement)(x,{...o&&F},!!c&&(0,n.createElement)(m.default,{align:h,...w}),(0,n.createElement)(y,{fallbackAlt:E.name,image:A,loaded:!C,showFullSize:l!==g.THUMBNAIL,width:b,height:f,scale:v,aspectRatio:k})))})),f={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:g.SINGLE},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1},isDescendentOfSingleProductBlock:{type:"boolean",default:!1},width:{type:"string"},height:{type:"string"},scale:{type:"string",default:"cover"},aspectRatio:{type:"string"}},b=(0,o.withFilteredAttributes)(f)(h)},6809:(e,t,l)=>{"use strict";l.r(t),l.d(t,{Block:()=>d,default:()=>u});var o=l(1609),n=l(7723),a=l(851),s=l(4656),r=l(2796),c=l(3249),i=l(1616);l(6007);const d=e=>{const{className:t,align:l}=e,i=(0,c.p)(e),{parentClassName:d}=(0,r.useInnerBlockLayoutContext)(),{product:u}=(0,r.useProductDataContext)();if(!(u.id&&u.on_sale||e.isDescendentOfSingleProductTemplate))return null;const m="string"==typeof l?`wc-block-components-product-sale-badge--align-${l}`:"";return(0,o.createElement)("div",{className:(0,a.A)("wc-block-components-product-sale-badge",t,m,{[`${d}__product-onsale`]:d},i.className),style:i.style},(0,o.createElement)(s.Label,{label:(0,n.__)("Sale","woocommerce"),screenReaderLabel:(0,n.__)("Product on sale","woocommerce")}))},u=(0,i.withProductDataContext)(d)},3249:(e,t,l)=>{"use strict";l.d(t,{p:()=>i});var o=l(851),n=l(3993),a=l(1194),s=l(9786);function r(e={}){const t={};return(0,s.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function c(e,t){return e&&t?`has-${(0,a.c)(t)}-${e}`:""}const i=e=>{const t=(e=>{const t=(0,n.isObject)(e)?e:{style:{}};let l=t.style;return(0,n.isString)(l)&&(l=JSON.parse(l)||{}),(0,n.isObject)(l)||(l={}),{...t,style:l}})(e),l=function(e){var t,l,a,s,i,d,u;const{backgroundColor:m,textColor:g,gradient:p,style:y}=e,h=c("background-color",m),f=c("color",g),b=function(e){if(e)return`has-${e}-gradient-background`}(p),v=b||(null==y||null===(t=y.color)||void 0===t?void 0:t.gradient);return{className:(0,o.A)(f,b,{[h]:!v&&!!h,"has-text-color":g||(null==y||null===(l=y.color)||void 0===l?void 0:l.text),"has-background":m||(null==y||null===(a=y.color)||void 0===a?void 0:a.background)||p||(null==y||null===(s=y.color)||void 0===s?void 0:s.gradient),"has-link-color":(0,n.isObject)(null==y||null===(i=y.elements)||void 0===i?void 0:i.link)?null==y||null===(d=y.elements)||void 0===d||null===(u=d.link)||void 0===u?void 0:u.color:void 0}),style:r({color:(null==y?void 0:y.color)||{}})}}(t),a=function(e){var t;const l=(null===(t=e.style)||void 0===t?void 0:t.border)||{};return{className:function(e){var t;const{borderColor:l,style:n}=e,a=l?c("border-color",l):"";return(0,o.A)({"has-border-color":!!l||!(null==n||null===(t=n.border)||void 0===t||!t.color),[a]:!!a})}(e),style:r({border:l})}}(t),s=function(e){var t;return{className:void 0,style:r({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}(t),i=(e=>{const t=(0,n.isObject)(e.style.typography)?e.style.typography:{},l=(0,n.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:l,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,o.A)(i.className,l.className,a.className,s.className),style:{...i.style,...l.style,...a.style,...s.style}}}},5183:()=>{},6007:()=>{}}]);