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