(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[232,442],{7957:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>x});var o=s(1616),a=s(6087),n=s(7723),i=s(4921),l=s(5703),c=s(2796),r=s(3754),d=s(8981),u=s(8537),g=s(3993),p=s(4927);s(1189);let m=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});var h=s(790);const y=e=>{const{aspectRatio:t,height:s,width:o,scale:a}=e;return{height:s,width:o,objectFit:a,aspectRatio:t}},f=e=>{const{showFullSize:t,...s}=e,o=t?(0,l.getSetting)("placeholderImgSrcFullSize",l.PLACEHOLDER_IMG_SRC):l.PLACEHOLDER_IMG_SRC;return(0,h.jsx)("img",{...s,src:o,alt:"",width:void 0,height:void 0})},b=({image:e,loaded:t,showFullSize:s,fallbackAlt:o,width:a,scale:n,height:i,aspectRatio:l})=>{const{thumbnail:c,src:r,srcset:d,sizes:u,alt:g}=e||{},p={alt:g||o,hidden:!t,src:s?r:c,...s&&{srcSet:d,sizes:u}},m=y({height:i,width:a,scale:n,aspectRatio:l});return e?(0,h.jsx)("img",{style:m,"data-testid":"product-image",...p}):(0,h.jsx)(f,{showFullSize:s,style:m})},S=e=>{const{product:t}=e;return!(0,g.isEmpty)(t)&&(void 0===(s=e.showSaleBadge)||s);var s},w=(0,o.withProductDataContext)(e=>{const{aspectRatio:t,children:s,className:o,height:l,imageId:w,imageSizing:k=m.SINGLE,scale:x,showProductLink:N=!0,style:v,width:j,isAdmin:C,product:R,isResolving:A,...F}=e,L=(0,r.p)(e),{parentClassName:_}=(0,c.useInnerBlockLayoutContext)(),{product:z,isLoading:P}=(0,c.useProductDataContext)({isAdmin:C,product:R,isResolving:A}),{dispatchStoreEvent:B}=(0,d.y)(),D=k!==m.THUMBNAIL,E=(0,g.objectHasProp)(v,"dimensions")&&(0,g.objectHasProp)(v.dimensions,"aspectRatio")&&(0,g.isString)(v.dimensions.aspectRatio)?v.dimensions.aspectRatio:t,I=`wc-block-components-product-image--aspect-ratio-${E?E.replace("/","-"):"auto"}`;if(!z?.id){const e=y({height:l,width:j,scale:x,aspectRatio:E});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:(0,i.A)(o,"wc-block-components-product-image",I,{[`${_}__product-image`]:_},L.className),style:L.style,children:(0,h.jsx)(f,{showFullSize:D,style:e})}),s]})}const O=((e,t)=>e.images.length?t&&e.images.find(e=>e.id===t)||e.images[0]:null)(z,w);O&&(O.alt=O.alt||(0,u.decodeEntities)(z.name));const $=N?"a":a.Fragment,H=z?.name?
// translators: %s is the product name.
// translators: %s is the product name.
(0,n.sprintf)((0,n.__)("Link to %s","woocommerce"),z.name):"",T={href:N?z?.permalink:void 0,...N&&{"aria-label":H,onClick:()=>{B("product-view-link",{product:z})}}};return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)("div",{className:(0,i.A)(o,"wc-block-components-product-image",I,{[`${_}__product-image`]:_},L.className),style:L.style,children:[S(e)&&(0,h.jsx)(p.default,{align:e.saleBadgeAlign||"right",...F}),(0,h.jsx)($,{...!C&&N&&T,children:(0,h.jsx)(b,{fallbackAlt:(0,u.decodeEntities)(z.name),image:O,loaded:!P,showFullSize:D,width:j,height:l,scale:x,aspectRatio:E})})]}),s]})}),k=JSON.parse('{"uK":{"showProductLink":{"type":"boolean","default":true},"showSaleBadge":{"type":"boolean","default":true},"saleBadgeAlign":{"type":"string","default":"right"},"imageSizing":{"type":"string","default":"single"},"productId":{"type":"number","default":0},"isDescendentOfQueryLoop":{"type":"boolean","default":false},"isDescendentOfSingleProductBlock":{"type":"boolean","default":false},"width":{"type":"string"},"height":{"type":"string"},"scale":{"type":"string","default":"cover"},"aspectRatio":{"type":"string"}}}'),x=(0,o.withFilteredAttributes)(k.uK)(w)},4927:(e,t,s)=>{"use strict";s.r(t),s.d(t,{Block:()=>d,default:()=>u});var o=s(7723),a=s(4921),n=s(4656),i=s(2796),l=s(3754),c=s(1616),r=(s(4313),s(790));const d=e=>{const{className:t,align:s,isDescendentOfSingleProductTemplate:c}=e,d=(0,l.p)(e),{parentClassName:u}=(0,i.useInnerBlockLayoutContext)(),{product:g}=(0,i.useProductDataContext)();if(!(g.id&&g.on_sale||c))return null;const p="string"==typeof s?`wc-block-components-product-sale-badge--align-${s}`:"";return(0,r.jsx)("div",{className:(0,a.A)("wc-block-components-product-sale-badge",t,p,{[`${u}__product-onsale`]:u},d.className),style:d.style,children:(0,r.jsx)(n.Label,{label:(0,o.__)("Sale","woocommerce"),screenReaderLabel:(0,o.__)("Product on sale","woocommerce")})})},u=(0,c.withProductDataContext)(d)},3754:(e,t,s)=>{"use strict";s.d(t,{p:()=>r});var o=s(4921),a=s(3993),n=s(7356),i=s(9786);function l(e={}){const t={};return(0,i.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function c(e,t){return e&&t?`has-${(0,n.c)(t)}-${e}`:""}const r=e=>{const t=(e=>{const t=(0,a.isObject)(e)?e:{style:{}};let s=t.style;return(0,a.isString)(s)&&(s=JSON.parse(s)||{}),(0,a.isObject)(s)||(s={}),{...t,style:s}})(e),s=function(e){const{backgroundColor:t,textColor:s,gradient:n,style:i}=e,r=c("background-color",t),d=c("color",s),u=function(e){if(e)return`has-${e}-gradient-background`}(n),g=u||i?.color?.gradient;return{className:(0,o.A)(d,u,{[r]:!g&&!!r,"has-text-color":s||i?.color?.text,"has-background":t||i?.color?.background||n||i?.color?.gradient,"has-link-color":(0,a.isObject)(i?.elements?.link)?i?.elements?.link?.color:void 0}),style:l({color:i?.color||{}})}}(t),n=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:s}=e,a=t?c("border-color",t):"";return(0,o.A)({"has-border-color":!!t||!!s?.border?.color,[a]:!!a})}(e),style:l({border:t})}}(t),i=function(e){return{className:void 0,style:l({spacing:e.style?.spacing||{}})}}(t),r=(e=>{const t=(0,a.isObject)(e.style.typography)?e.style.typography:{},s=(0,a.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:s,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)(r.className,s.className,n.className,i.className),style:{...r.style,...s.style,...n.style,...i.style}}}},1189:()=>{},4313:()=>{}}]);