(globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[]).push([[2388],{5213:(e,r,c)=>{"use strict";c.r(r),c.d(r,{Block:()=>m,convertAdminPriceToStoreApiFormat:()=>u,default:()=>d});var t=c(4921),s=c(8765),o=c(910),a=c(415),n=c(2721),i=c(1616),l=c(5703),p=c(790);const u=(e,r,c="0")=>{const t=10**r.minorUnit;return Math.round(Number.parseFloat(null!=e?e:c)*t).toString()},m=e=>{var r;const{className:c,textAlign:i,isDescendentOfSingleProductTemplate:m,isAdmin:d,product:y,isExperimentalWcRestApiV4Enabled:g}=e,{parentName:_,parentClassName:x}=(0,a.useInnerBlockLayoutContext)(),{product:N}=(0,a.useProductDataContext)(g?{isAdmin:d,product:y}:void 0),f="woocommerce/all-products"===_,b="woocommerce/add-to-cart-with-options-grouped-product-item"===_,h=(0,n.p)(e);let v={className:"",style:{}};f&&(v=h);const P=m&&!b||!N,k=(0,t.A)("wc-block-components-product-price",c,v.className,{[`${x}__product-price`]:x});if(!N?.id&&!m){const e=(0,p.jsx)(s.A,{align:i,className:k});return f?(0,p.jsx)("div",{className:"wp-block-woocommerce-product-price",children:e}):e}let S=null!==(r=N?.prices)&&void 0!==r?r:{};const A=P?(0,o.getCurrencyFromPriceResponse)():(0,o.getCurrencyFromPriceResponse)(S);g&&(S={price:u(N?.price,A),...N?.sale_price?{sale_price:u(N?.sale_price,A)}:{},...N?.regular_price?{regular_price:u(N?.regular_price,A)}:{},currency_minor_unit:l.SITE_CURRENCY.minorUnit,price_range:N?.max_price&&N?.min_price?{min_amount:u(N.min_price,A),max_amount:u(N.max_price,A)}:null});const j="5000",w=S.price!==S.regular_price,C=(0,t.A)({[`${x}__product-price__value`]:x,[`${x}__product-price__value--on-sale`]:w}),F=(0,p.jsx)(s.A,{align:i,className:k,style:v.style,regularPriceStyle:v.style,priceStyle:v.style,priceClassName:C,currency:A,price:P?j:S.price,minPrice:S?.price_range?.min_amount,maxPrice:S?.price_range?.max_amount,regularPrice:P?j:S.regular_price,regularPriceClassName:(0,t.A)({[`${x}__product-price__regular`]:x})});return f?(0,p.jsx)("div",{className:"wp-block-woocommerce-product-price",children:F}):F},d=e=>e.isDescendentOfSingleProductTemplate?(0,p.jsx)(m,{...e}):(0,i.withProductDataContext)(m)(e)},8765:(e,r,c)=>{"use strict";c.d(r,{A:()=>u});var t=c(7723),s=c(4656),o=c(4921),a=c(910),n=c(6087),i=(c(8501),c(790));const l=({currency:e,maxPrice:r,minPrice:c,priceClassName:n,priceStyle:l={}})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"screen-reader-text",children:(0,t.sprintf)(/* translators: %1$s min price, %2$s max price */ /* translators: %1$s min price, %2$s max price */
(0,t.__)("Price between %1$s and %2$s","woocommerce"),(0,a.formatPrice)(c),(0,a.formatPrice)(r))}),(0,i.jsxs)("span",{"aria-hidden":!0,children:[(0,i.jsx)(s.FormattedMonetaryAmount,{className:(0,o.A)("wc-block-components-product-price__value",n),currency:e,value:c,style:l})," — ",(0,i.jsx)(s.FormattedMonetaryAmount,{className:(0,o.A)("wc-block-components-product-price__value",n),currency:e,value:r,style:l})]})]}),p=({currency:e,regularPriceClassName:r,regularPriceStyle:c,regularPrice:a,priceClassName:n,priceStyle:l,price:p})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:"screen-reader-text",children:(0,t.__)("Previous price:","woocommerce")}),(0,i.jsx)(s.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,i.jsx)("del",{className:(0,o.A)("wc-block-components-product-price__regular",r),style:c,children:e}),value:a}),(0,i.jsx)("span",{className:"screen-reader-text",children:(0,t.__)("Discounted price:","woocommerce")}),(0,i.jsx)(s.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,i.jsx)("ins",{className:(0,o.A)("wc-block-components-product-price__value","is-discounted",n),style:l,children:e}),value:p})]}),u=({align:e,className:r,currency:c,format:t="<price/>",maxPrice:a,minPrice:u,price:m,priceClassName:d,priceStyle:y,regularPrice:g,regularPriceClassName:_,regularPriceStyle:x,style:N})=>{const f=(0,o.A)(r,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});t.includes("<price/>")||(t="<price/>",console.error("Price formats need to include the `<price/>` tag."));const b=void 0!==g&&void 0!==m&&m<g;let h=(0,i.jsx)("span",{className:(0,o.A)("wc-block-components-product-price__value",d)});return b?h=(0,i.jsx)(p,{currency:c,price:m,priceClassName:d,priceStyle:y,regularPrice:g,regularPriceClassName:_,regularPriceStyle:x}):void 0!==u&&void 0!==a?h=(0,i.jsx)(l,{currency:c,maxPrice:a,minPrice:u,priceClassName:d,priceStyle:y}):(m||0===m)&&(h=(0,i.jsx)(s.FormattedMonetaryAmount,{className:(0,o.A)("wc-block-components-product-price__value",d),currency:c,value:m,style:y})),(0,i.jsx)("span",{className:f,style:N,children:(0,n.createInterpolateElement)(t,{price:h})})}},2721:(e,r,c)=>{"use strict";c.d(r,{p:()=>n});var t=c(4921),s=c(3993),o=c(1605),a=c(3099);const n=e=>{const r=(e=>{const r=(0,s.isObject)(e)?e:{style:{}};let c=r.style;return(0,s.isString)(c)&&(c=JSON.parse(c)||{}),(0,s.isObject)(c)||(c={}),{...r,style:c}})(e),c=(0,a.BK)(r),n=(0,a.aR)(r),i=(0,a.fo)(r),l=(0,o.x)(r);return{className:(0,t.A)(l.className,c.className,n.className,i.className),style:{...l.style,...c.style,...n.style,...i.style}}}},1605:(e,r,c)=>{"use strict";c.d(r,{x:()=>s});var t=c(3993);const s=e=>{const r=(0,t.isObject)(e.style.typography)?e.style.typography:{},c=(0,t.isString)(r.fontFamily)?r.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:c,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:r.fontSize,fontStyle:r.fontStyle,fontWeight:r.fontWeight,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,textDecoration:r.textDecoration,textTransform:r.textTransform}}}},3099:(e,r,c)=>{"use strict";c.d(r,{BK:()=>l,aR:()=>p,fo:()=>u});var t=c(4921),s=c(7356),o=c(9786),a=c(3993);function n(e={}){const r={};return(0,o.getCSSRules)(e,{selector:""}).forEach((e=>{r[e.key]=e.value})),r}function i(e,r){return e&&r?`has-${(0,s.c)(r)}-${e}`:""}function l(e){const{backgroundColor:r,textColor:c,gradient:s,style:o}=e,l=i("background-color",r),p=i("color",c),u=function(e){if(e)return`has-${e}-gradient-background`}(s),m=u||o?.color?.gradient;return{className:(0,t.A)(p,u,{[l]:!m&&!!l,"has-text-color":c||o?.color?.text,"has-background":r||o?.color?.background||s||o?.color?.gradient,"has-link-color":(0,a.isObject)(o?.elements?.link)?o?.elements?.link?.color:void 0}),style:n({color:o?.color||{}})}}function p(e){const r=e.style?.border||{};return{className:function(e){const{borderColor:r,style:c}=e,s=r?i("border-color",r):"";return(0,t.A)({"has-border-color":!!r||!!c?.border?.color,[s]:!!s})}(e),style:n({border:r})}}function u(e){return{className:void 0,style:n({spacing:e.style?.spacing||{}})}}},8501:()=>{}}]);