(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[3819],{6432:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>H});var c=a(1609),n=a(8509),o=a(2796),r=a(6087),s=a(7723),l=a(851),i=a(5703),d=a(3566),u=a(1616),m=a(3603),p=a(4656);a(6007);const g=(0,u.withProductDataContext)((e=>{const{className:t,align:a}=e,n=(0,d.p)(e),{parentClassName:r}=(0,o.useInnerBlockLayoutContext)(),{product:i}=(0,o.useProductDataContext)();if(!(i.id&&i.on_sale||e.isDescendentOfSingleProductTemplate))return null;const u="string"==typeof a?`wc-block-components-product-sale-badge--align-${a}`:"";return(0,c.createElement)("div",{className:(0,l.A)("wc-block-components-product-sale-badge",t,u,{[`${r}__product-onsale`]:r},n.className),style:n.style},(0,c.createElement)(p.Label,{label:(0,s.__)("Sale","woocommerce"),screenReaderLabel:(0,s.__)("Product on sale","woocommerce")}))}));a(5183);let _=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const w=e=>(0,c.createElement)("img",{...e,src:i.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),b=({image:e,loaded:t,showFullSize:a,fallbackAlt:n,width:o,scale:s,height:l,aspectRatio:i})=>{const{thumbnail:d,src:u,srcset:m,sizes:p,alt:g}=e||{},_={alt:g||n,hidden:!t,src:d,...a&&{src:u,srcSet:m,sizes:p}},b={height:l,width:o,objectFit:s,aspectRatio:i};return(0,c.createElement)(r.Fragment,null,_.src&&(0,c.createElement)("img",{style:b,"data-testid":"product-image",..._}),!e&&(0,c.createElement)(w,{style:b}))},k=e=>{const{className:t,imageSizing:a=_.SINGLE,showProductLink:n=!0,showSaleBadge:i,saleBadgeAlign:u="right",height:p,width:k,scale:N,aspectRatio:h,...v}=e,E=(0,d.p)(e),{parentClassName:y}=(0,o.useInnerBlockLayoutContext)(),{product:C,isLoading:f}=(0,o.useProductDataContext)(),{dispatchStoreEvent:P}=(0,m.y)();if(!C.id)return(0,c.createElement)("div",{className:(0,l.A)(t,"wc-block-components-product-image",{[`${y}__product-image`]:y},E.className),style:E.style},(0,c.createElement)(w,null));const L=!!C.images.length,A=L?C.images[0]:null,x=n?"a":r.Fragment,S=(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"),C.name),$={href:C.permalink,...!L&&{"aria-label":S},onClick:()=>{P("product-view-link",{product:C})}};return delete v.style,(0,c.createElement)("div",{className:(0,l.A)(t,"wc-block-components-product-image",{[`${y}__product-image`]:y},E.className),style:E.style},(0,c.createElement)(x,{...n&&$},!!i&&(0,c.createElement)(g,{align:u,...v}),(0,c.createElement)(b,{fallbackAlt:C.name,image:A,loaded:!f,showFullSize:a!==_.THUMBNAIL,width:k,height:p,scale:N,aspectRatio:h})))};(0,u.withProductDataContext)(k);var N=a(7102);a(7128);const h=({children:e,headingLevel:t,elementType:a=`h${t}`,...n})=>(0,c.createElement)(a,{...n},e),v=e=>{const{className:t,headingLevel:a=2,showProductLink:n=!0,linkTarget:r,align:s}=e,i=(0,d.p)(e),{parentClassName:u}=(0,o.useInnerBlockLayoutContext)(),{product:p}=(0,o.useProductDataContext)(),{dispatchStoreEvent:g}=(0,m.y)();return p.id?(0,c.createElement)(h,{headingLevel:a,className:(0,l.A)(t,i.className,"wc-block-components-product-title",{[`${u}__product-title`]:u,[`wc-block-components-product-title--align-${s}`]:s}),style:i.style},(0,c.createElement)(N.A,{disabled:!n,name:p.name,permalink:p.permalink,target:r,onClick:()=>{g("product-view-link",{product:p})}})):(0,c.createElement)(h,{headingLevel:a,className:(0,l.A)(t,i.className,"wc-block-components-product-title",{[`${u}__product-title`]:u,[`wc-block-components-product-title--align-${s}`]:s}),style:i.style})};(0,u.withProductDataContext)(v);var E=a(3993);a(7195);const y=e=>({width:e/5*100+"%"}),C=({parentClassName:e})=>{const t=y(0);return(0,c.createElement)("div",{className:(0,l.A)("wc-block-components-product-rating-stars__norating-container",`${e}-product-rating-stars__norating-container`)},(0,c.createElement)("div",{className:"wc-block-components-product-rating-stars__norating",role:"img"},(0,c.createElement)("span",{style:t})),(0,c.createElement)("span",null,(0,s.__)("No Reviews","woocommerce")))},f=e=>{const{rating:t,reviews:a,parentClassName:n}=e,o=y(t),r=(0,s.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */
(0,s.__)("Rated %f out of 5","woocommerce"),t),i={__html:(0,s.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */ /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
(0,s._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",a,"woocommerce"),(0,s.sprintf)('<strong class="rating">%f</strong>',t),(0,s.sprintf)('<span class="rating">%d</span>',a))};return(0,c.createElement)("div",{className:(0,l.A)("wc-block-components-product-rating-stars__stars",`${n}__product-rating-stars__stars`),role:"img","aria-label":r},(0,c.createElement)("span",{style:o,dangerouslySetInnerHTML:i}))},P=e=>{const{textAlign:t,shouldDisplayMockedReviewsWhenProductHasNoReviews:a}=e,n=(0,d.p)(e),{parentClassName:r}=(0,o.useInnerBlockLayoutContext)(),{product:s}=(0,o.useProductDataContext)(),i=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(s),u=(e=>{const t=(0,E.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(s),m=(0,l.A)(n.className,"wc-block-components-product-rating-stars",{[`${r}__product-rating`]:r,[`has-text-align-${t}`]:t}),p=a?(0,c.createElement)(C,{parentClassName:r}):null,g=u?(0,c.createElement)(f,{rating:i,reviews:u,parentClassName:r}):p;return(0,c.createElement)("div",{className:m,style:n.style},(0,c.createElement)("div",{className:"wc-block-components-product-rating-stars__container"},g))};(0,u.withProductDataContext)(P);var L=a(6042),A=a(910);const x=e=>{var t,a;const{className:n,textAlign:r,isDescendentOfSingleProductTemplate:s}=e,i=(0,d.p)(e),{parentName:u,parentClassName:m}=(0,o.useInnerBlockLayoutContext)(),{product:p}=(0,o.useProductDataContext)(),g="woocommerce/all-products"===u,_=(0,l.A)("wc-block-components-product-price",n,i.className,{[`${m}__product-price`]:m});if(!p.id&&!s){const e=(0,c.createElement)(L.A,{align:r,className:_});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},e):e}const w=p.prices,b=s?(0,A.getCurrencyFromPriceResponse)():(0,A.getCurrencyFromPriceResponse)(w),k="5000",N=w.price!==w.regular_price,h=(0,l.A)({[`${m}__product-price__value`]:m,[`${m}__product-price__value--on-sale`]:N}),v=(0,c.createElement)(L.A,{align:r,className:_,style:i.style,regularPriceStyle:i.style,priceStyle:i.style,priceClassName:h,currency:b,price:s?k:w.price,minPrice:null==w||null===(t=w.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==w||null===(a=w.price_range)||void 0===a?void 0:a.max_amount,regularPrice:s?k:w.regular_price,regularPriceClassName:(0,l.A)({[`${m}__product-price__regular`]:m})});return g?(0,c.createElement)("div",{className:"wp-block-woocommerce-product-price"},v):v};var S=a(4436),$=a(8537),D=a(812);a(1546);const R=({product:e,className:t,style:a})=>{const{id:n,permalink:o,add_to_cart:r,has_options:d,is_purchasable:u,is_in_stock:p}=e,{dispatchStoreEvent:g}=(0,m.y)(),{cartQuantity:_,addingToCart:w,addToCart:b}=(0,S.R)(n),k=Number.isFinite(_)&&_>0,N=!d&&u&&p,h=(0,$.decodeEntities)((null==r?void 0:r.description)||""),v=k?(0,s.sprintf)(/* translators: %s number of products in cart. */ /* translators: %s number of products in cart. */
(0,s._n)("%d in cart","%d in cart",_,"woocommerce"),_):(0,$.decodeEntities)((null==r?void 0:r.text)||(0,s.__)("Add to cart","woocommerce")),E=N?"button":"a",y={};return N?y.onClick=async()=>{await b(),g("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=(0,i.getSetting)("productsSettings");t&&(window.location.href=D.Vo)}:(y.href=o,y.rel="nofollow",y.onClick=()=>{g("product-view-link",{product:e})}),(0,c.createElement)(E,{...y,"aria-label":h,disabled:w,className:(0,l.A)(t,"wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{loading:w,added:k}),style:a},v)},I=({className:e,style:t})=>(0,c.createElement)("button",{className:(0,l.A)("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",e),style:t,disabled:!0}),B=e=>{const{className:t,textAlign:a}=e,n=(0,d.p)(e),{parentClassName:r}=(0,o.useInnerBlockLayoutContext)(),{product:s}=(0,o.useProductDataContext)();return(0,c.createElement)("div",{className:(0,l.A)(t,"wp-block-button","wc-block-components-product-button",{[`${r}__product-add-to-cart`]:r,[`align-${a}`]:a})},s.id?(0,c.createElement)(R,{product:s,style:n.style,className:n.className}):(0,c.createElement)(I,{style:n.style,className:n.className}))},F=((0,u.withProductDataContext)(B),({product:e})=>(0,c.createElement)("div",{className:"cross-sells-product"},(0,c.createElement)(o.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product"},(0,c.createElement)(o.ProductDataContextProvider,{isLoading:!1,product:e},(0,c.createElement)("div",null,(0,c.createElement)(k,{className:"",showSaleBadge:!0,productId:e.id,showProductLink:!0,saleBadgeAlign:"left",imageSizing:_.SINGLE,isDescendentOfQueryLoop:!1,scale:"cover",aspectRatio:"1:1"}),(0,c.createElement)(v,{align:"",headingLevel:3,showProductLink:!0}),(0,c.createElement)(P,{isDescendentOfQueryLoop:!1,isDescendentOfSingleProductBlock:!1,productId:e.id,postId:0,shouldDisplayMockedReviewsWhenProductHasNoReviews:!1}),(0,c.createElement)(x,null)),(0,c.createElement)(B,null))))),T=({products:e,columns:t})=>{const a=e.map(((e,a)=>a>=t?null:(0,c.createElement)(F,{isLoading:!1,product:e,key:e.id})));return(0,c.createElement)("div",null,a)};var z=a(7292);const H=({className:e,columns:t})=>{const{crossSellsProducts:a}=(0,n.V)();return void 0===t&&(t=z.attributes.columns.default),(0,c.createElement)(T,{className:e,columns:t,products:a})}},1546:()=>{},5183:()=>{},7195:()=>{},6007:()=>{},7128:()=>{}}]);