← Back
Editing: cart.js
(()=>{var e,t,o,s={75829:(e,t,o)=>{"use strict";o.r(t),o.d(t,{settings:()=>vc});var s=o(4921);const r=window.wp.blockEditor,c=window.wp.blocks;var n=o(27723),a=o(86087);const i=window.wc.wcSettings,l=window.wc.wcTypes,d=(0,i.getSetting)("wcBlocksConfig",{pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),m=d.pluginUrl+"assets/images/",u=(d.pluginUrl,i.STORE_PAGES.shop?.permalink),p=i.STORE_PAGES.checkout?.id,h=(i.STORE_PAGES.checkout,i.STORE_PAGES.privacy,i.STORE_PAGES.privacy,i.STORE_PAGES.terms,i.STORE_PAGES.terms,i.STORE_PAGES.cart?.id),g=i.STORE_PAGES.cart?.permalink,_=(i.STORE_PAGES.myaccount?.permalink?i.STORE_PAGES.myaccount.permalink:(0,i.getSetting)("wpLoginUrl","/wp-login.php"),(0,i.getSetting)("localPickupEnabled",!1)),w=((0,i.getSetting)("shippingMethodsExist",!1),(0,i.getSetting)("shippingEnabled",!0)),b=(0,i.getSettingWithCoercion)("countries",{},l.isObject),k=(0,i.getSetting)("countryData",{}),y={...Object.fromEntries(Object.keys(k).filter(e=>!0===k[e].allowBilling).map(e=>{const t=b[e];return[e,(0,l.isString)(t)?t:""]})),...Object.fromEntries(Object.keys(k).filter(e=>!0===k[e].allowShipping).map(e=>{const t=b[e];return[e,(0,l.isString)(t)?t:""]}))},x=(Object.fromEntries(Object.keys(y).map(e=>[e,k[e].states||{}])),Object.fromEntries(Object.keys(y).map(e=>[e,k[e].locale||{}]))),f={address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],order:[]},v=(0,i.getSetting)("addressFieldsLocations",f).address;(0,i.getSetting)("addressFieldsLocations",f).contact,(0,i.getSetting)("addressFieldsLocations",f).order,(0,i.getSetting)("additionalOrderFields",{}),(0,i.getSetting)("additionalContactFields",{}),(0,i.getSetting)("additionalAddressFields",{});var S=o(10790);const j=({imageUrl:e=`${m}/block-error.svg`,header:t=(0,n.__)("Oops!","woocommerce"),text:o=(0,n.__)("There was an error loading the content.","woocommerce"),errorMessage:s,errorMessagePrefix:r=(0,n.__)("Error:","woocommerce"),button:c,showErrorBlock:a=!0})=>a?(0,S.jsxs)("div",{className:"wc-block-error wc-block-components-error",children:[e&&(0,S.jsx)("img",{className:"wc-block-error__image wc-block-components-error__image",src:e,alt:""}),(0,S.jsxs)("div",{className:"wc-block-error__content wc-block-components-error__content",children:[t&&(0,S.jsx)("p",{className:"wc-block-error__header wc-block-components-error__header",children:t}),o&&(0,S.jsx)("p",{className:"wc-block-error__text wc-block-components-error__text",children:o}),s&&(0,S.jsxs)("p",{className:"wc-block-error__message wc-block-components-error__message",children:[r?r+" ":"",s]}),c&&(0,S.jsx)("p",{className:"wc-block-error__button wc-block-components-error__button",children:c})]})]}):null;o(45893);class C extends a.Component{state={errorMessage:"",hasError:!1};static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("strong",{children:e.status}),": ",e.statusText]}),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:o=!0,showErrorBlock:s=!0,text:r,errorMessagePrefix:c,renderError:n,button:a}=this.props,{errorMessage:i,hasError:l}=this.state;return l?"function"==typeof n?n({errorMessage:i}):(0,S.jsx)(j,{showErrorBlock:s,errorMessage:o?i:null,header:e,imageUrl:t,text:r,errorMessagePrefix:c,button:a}):this.props.children}}const E=C,P=window.wp.data,N=()=>(0,P.useSelect)(e=>{const{getSettings:t}=e(r.store);return Boolean(t()?.isPreviewMode??!1)},[]),A=(0,a.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),R=()=>(0,a.useContext)(A),I=({children:e,currentPostId:t=0,previewData:o={},currentView:s=""})=>{const r=N(),c=(0,P.useSelect)(e=>t||e("core/editor").getCurrentPostId(),[t]),n=(0,a.useCallback)((e,t={})=>o&&e in o?o[e]:t,[o]),i={isEditor:!0,currentPostId:c,currentView:s,previewData:o,getPreviewData:n,isPreview:r};return(0,S.jsx)(A.Provider,{value:i,children:e})},T=window.wp.plugins,B=window.wc.wcBlocksData;var M=o(64040),L=o.n(M);let O=function(e){return e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback",e}({});const D={},F=(e=D,{type:t,eventType:o,id:s,callback:r,priority:c})=>{const n=e.hasOwnProperty(o)?new Map(e[o]):new Map;switch(t){case O.ADD_EVENT_CALLBACK:return n.set(s,{priority:c,callback:r}),{...e,[o]:n};case O.REMOVE_EVENT_CALLBACK:return n.delete(s),{...e,[o]:n}}},V=(e,t)=>(o,s=10)=>{const r=((e,t,o=10)=>({id:Math.floor(Math.random()*Date.now()).toString(),type:O.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:o}))(e,o,s);return t(r),()=>{var o;t((o=e,{id:r.id,type:O.REMOVE_EVENT_CALLBACK,eventType:o}))}},z=(0,a.createContext)({onPaymentProcessing:()=>()=>()=>{},onPaymentSetup:()=>()=>()=>{}}),H=({children:e})=>{const{isProcessing:t,isIdle:o,isCalculating:s,hasError:r}=(0,P.useSelect)(e=>{const t=e(B.checkoutStore);return{isProcessing:t.isProcessing(),isIdle:t.isIdle(),hasError:t.hasError(),isCalculating:t.isCalculating()}}),{isPaymentReady:c}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{isPaymentProcessing:t.isPaymentProcessing(),isPaymentReady:t.isPaymentReady()}}),{setValidationErrors:n}=(0,P.useDispatch)(B.validationStore),[i,l]=(0,a.useReducer)(F,{}),{onPaymentSetup:d}=(e=>(0,a.useMemo)(()=>({onPaymentSetup:V("payment_setup",e)}),[e]))(l),m=(0,a.useRef)(i);(0,a.useEffect)(()=>{m.current=i},[i]);const{__internalSetPaymentProcessing:u,__internalSetPaymentIdle:p,__internalEmitPaymentProcessingEvent:h}=(0,P.useDispatch)(B.paymentStore);(0,a.useEffect)(()=>{!t||r||s||(u(),h(m.current,n))},[t,r,s,u,h,n]),(0,a.useEffect)(()=>{o&&!c&&p()},[o,c,p]),(0,a.useEffect)(()=>{r&&c&&p()},[r,c,p]);const g={onPaymentProcessing:(0,a.useMemo)(()=>function(...e){return L()("onPaymentProcessing",{alternative:"onPaymentSetup"}),d(...e)},[d]),onPaymentSetup:d};return(0,S.jsx)(z.Provider,{value:g,children:e})},$={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},U={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},q={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:e=>e,shippingErrorTypes:$,onShippingRateSuccess:()=>()=>{},onShippingRateFail:()=>()=>{},onShippingRateSelectSuccess:()=>()=>{},onShippingRateSelectFail:()=>()=>{}},W=(e,{type:t})=>Object.values($).includes(t)?t:e,Y="shipping_rates_success",G="shipping_rates_fail",J="shipping_rate_select_success",Q="shipping_rate_select_fail",K=e=>({onSuccess:V(Y,e),onFail:V(G,e),onSelectSuccess:V(J,e),onSelectFail:V(Q,e)});let X=function(e){return e.CART="wc/cart",e.CHECKOUT="wc/checkout",e.PAYMENTS="wc/checkout/payments",e.EXPRESS_PAYMENTS="wc/checkout/express-payments",e.CONTACT_INFORMATION="wc/checkout/contact-information",e.SHIPPING_ADDRESS="wc/checkout/shipping-address",e.BILLING_ADDRESS="wc/checkout/billing-address",e.SHIPPING_METHODS="wc/checkout/shipping-methods",e.CHECKOUT_ACTIONS="wc/checkout/checkout-actions",e.ORDER_INFORMATION="wc/checkout/order-information",e}({});const Z=async(e,t,o)=>{const s=((e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[])(e,t),r=[];for(const e of s)try{const t=await Promise.resolve(e.callback(o));"object"==typeof t&&r.push(t)}catch(e){console.error(e)}return!r.length||r};var ee=o(11824),te=o.n(ee);const oe=window.wp.htmlEntities,se=Object.entries(x).reduce((e,[t,o])=>(e[t]=Object.entries(o).reduce((e,[t,o])=>(e[t]=(e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=(0,n.sprintf)(/* translators: %s Field label. */ /* translators: %s Field label. */ (0,n.__)("%s (optional)","woocommerce"),e.label)),void 0!==e.optionalLabel&&(t.optionalLabel=e.optionalLabel),e.index&&((0,l.isNumber)(e.index)&&(t.index=e.index),(0,l.isString)(e.index)&&(t.index=parseInt(e.index,10))),e.hidden&&(t.required=!1),t})(o),e),{}),e),{}),re=e=>{const t=((e,t,o="")=>{const s=o&&void 0!==se[o]?se[o]:{};return e.map(e=>({key:e,...t&&e in t?t[e]:{},...s&&e in s?s[e]:{}})).sort((e,t)=>e.index-t.index)})(v,i.defaultFields,e.country),o=Object.assign({},e);return t.forEach(({key:t,hidden:s})=>{!0===s&&((e,t)=>e in t)(t,e)&&(o[t]="")}),o},ce=window.CustomEvent||null,ne=(e,t,o=!1,s=!1)=>{if("function"!=typeof jQuery)return()=>{};const r=()=>{((e,{bubbles:t=!1,cancelable:o=!1,element:s,detail:r={}})=>{if(!ce)return;s||(s=document.body);const c=new ce(e,{bubbles:t,cancelable:o,detail:r});s.dispatchEvent(c)})(t,{bubbles:o,cancelable:s})};return jQuery(document).on(e,r),()=>jQuery(document).off(e,r)},ae=e=>{const t=e?.detail;t&&t.preserveCartData||(0,P.dispatch)(B.cartStore).invalidateResolutionForStore()},ie=e=>{(e?.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&(0,P.dispatch)(B.cartStore).invalidateResolutionForStore()},le=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},de={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},me={...de,email:""},ue={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:B.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},pe=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(0,oe.decodeEntities)(t)])),he=(e,t)=>{const o=re(pe(e));return te()(t.current,o)||(t.current=o),t.current},ge={billingAddress:me,billingData:me,cartCoupons:B.EMPTY_CART_COUPONS,cartErrors:B.EMPTY_CART_ERRORS,cartFees:B.EMPTY_CART_FEES,cartHasCalculatedShipping:!1,cartIsLoading:!0,cartItemErrors:B.EMPTY_CART_ITEM_ERRORS,cartItems:B.EMPTY_CART_ITEMS,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartTotals:ue,crossSellsProducts:B.EMPTY_CART_CROSS_SELLS,extensions:B.EMPTY_EXTENSIONS,hasPendingItemsOperations:!1,isLoadingRates:!1,paymentMethods:B.EMPTY_PAYMENT_METHODS,paymentRequirements:B.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},shippingAddress:de,shippingRates:B.EMPTY_SHIPPING_RATES},_e=(e={shouldSelect:!0})=>{const{shouldSelect:t}=e,o=(0,a.useRef)(),s=(0,a.useRef)(me),r=(0,a.useRef)(de);(0,a.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),window.wcBlocksStoreCartListeners?.count>0)return void window.wcBlocksStoreCartListeners.count++;document.body.addEventListener("wc-blocks_added_to_cart",ae),document.body.addEventListener("wc-blocks_removed_from_cart",ae),window.addEventListener("pageshow",ie);const e=ne("added_to_cart","wc-blocks_added_to_cart"),t=ne("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",ae),document.body.removeEventListener("wc-blocks_removed_from_cart",ae),window.removeEventListener("pageshow",ie),e(),t()}})(),le),[]);const{receiveCart:c,receiveCartContents:n}=(0,P.useDispatch)(B.cartStore),{cartData:i,cartErrors:l,cartTotals:d,cartIsLoading:m,isLoadingRates:u,hasPendingItemsOperations:p}=(0,P.useSelect)(e=>{const t=e(B.cartStore),o=!t.hasFinishedResolution("getCartData",[]);return{cartData:t.getCartData(),cartErrors:t.getCartErrors(),cartTotals:t.getCartTotals(),cartIsLoading:o,isLoadingRates:t.isAddressFieldsForShippingRatesUpdating(),hasPendingItemsOperations:t.hasPendingItemsOperations()}},[]);if(!t)return ge;const h=he(i.billingAddress,s),g=i.needsShipping?he(i.shippingAddress,r):h,_={billingAddress:h,billingData:h,cartCoupons:(k=i.coupons,k.length>0?k.map(e=>({...e,label:(0,oe.decodeEntities)(e.code)})):B.EMPTY_CART_COUPONS),cartErrors:l,cartFees:(b=i.fees,b.length>0?b.map(e=>pe(e)):B.EMPTY_CART_FEES),cartHasCalculatedShipping:i.hasCalculatedShipping,cartIsLoading:m,cartItemErrors:i.errors,cartItems:i.items,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartTotals:d,crossSellsProducts:i.crossSells,extensions:i.extensions,hasPendingItemsOperations:p,isLoadingRates:u,paymentMethods:i.paymentMethods,paymentRequirements:i.paymentRequirements,receiveCart:c,receiveCartContents:n,shippingAddress:g,shippingRates:(w=i.shippingRates,w.length>0?w.map(e=>({...e,shipping_rates:e.shipping_rates.length>0?e.shipping_rates.map(e=>pe(e)):[]})):[])};var w,b,k;return o.current&&te()(o.current,_)||(o.current=_),o.current},we=(0,i.getSetting)("collectableMethodIds",[]),be=e=>!!_&&(Array.isArray(e)?!!e.find(e=>we.includes(e)):we.includes(e)),ke=e=>!!(e=>e.some(e=>!!e.shipping_rates.length))(e)&&e.some(e=>e.shipping_rates.some(e=>e.selected)),ye=e=>Array.from(new Set(e.flatMap(e=>e.shipping_rates.filter(e=>e.selected).map(e=>e.name))));var xe=o(20923),fe=o.n(xe);const ve=window.wp.hooks,Se=()=>({dispatchStoreEvent:(0,a.useCallback)((e,t={})=>{try{(0,ve.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}},[]),dispatchCheckoutEvent:(0,a.useCallback)((e,t={})=>{try{(0,ve.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,P.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}},[])}),je=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:s,isShippingRatesStale:r,isCollectable:c,isSelectingRate:n}=(0,P.useSelect)(e=>{const t=e(B.cartStore),o=t.getShippingRates();return{shippingRates:o,needsShipping:t.getNeedsShipping(),hasCalculatedShipping:t.getHasCalculatedShipping(),isLoadingRates:t.isAddressFieldsForShippingRatesUpdating(),isShippingRatesStale:t.isShippingRatesStale(),isCollectable:o.every(({shipping_rates:e})=>e.find(({method_id:e})=>be(e))),isSelectingRate:t.isShippingRateBeingSelected()}},[]),i=(0,a.useRef)({});(0,a.useEffect)(()=>{const t=(e=>Object.fromEntries(e.map(({package_id:e,shipping_rates:t})=>[e,t.find(e=>e.selected)?.rate_id||""])))(e);(0,l.isObject)(t)&&!fe()(i.current,t)&&(i.current=t)},[e]);const{selectShippingRate:d}=(0,P.useDispatch)(B.cartStore),m=be(Object.values(i.current).map(e=>e.split(":")[0])),{dispatchCheckoutEvent:u}=Se(),p=(0,a.useCallback)((e,t)=>{let o;void 0!==e&&(o=be(e.split(":")[0])?d(e,null):d(e,t),o.then(()=>{u("set-selected-shipping-rate",{shippingRateId:e})}).catch(e=>{(0,B.processErrorResponse)(e)}))},[d,u]);return{isSelectingRate:n,selectedRates:i.current,selectShippingRate:p,shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:s,isShippingRatesStale:r,isCollectable:c,hasSelectedLocalPickup:m}},{NONE:Ce,INVALID_ADDRESS:Ee,UNKNOWN:Pe}=$,Ne=(0,a.createContext)(q),Ae=()=>(0,a.useContext)(Ne),Re=({children:e})=>{const{__internalStartCalculation:t,__internalFinishCalculation:o}=(0,P.useDispatch)(B.checkoutStore),{shippingRates:s,isLoadingRates:r,cartErrors:c}=_e(),{selectedRates:n,isSelectingRate:i}=je(),[l,d]=(0,a.useReducer)(W,Ce),[m,u]=(0,a.useReducer)(F,{}),p=(0,a.useRef)(m),h=(0,a.useMemo)(()=>({onShippingRateSuccess:K(u).onSuccess,onShippingRateFail:K(u).onFail,onShippingRateSelectSuccess:K(u).onSelectSuccess,onShippingRateSelectFail:K(u).onSelectFail}),[u]);(0,a.useEffect)(()=>{p.current=m},[m]),(0,a.useEffect)(()=>{r?t():o()},[r,t,o]),(0,a.useEffect)(()=>{i?t():o()},[t,o,i]),(0,a.useEffect)(()=>{c.length>0&&c.some(e=>!(!e.code||!Object.values(U).includes(e.code)))?d({type:Ee}):d({type:Ce})},[c]);const g=(0,a.useMemo)(()=>({isPristine:l===Ce,isValid:l===Ce,hasInvalidAddress:l===Ee,hasError:l===Pe||l===Ee}),[l]);(0,a.useEffect)(()=>{r||0!==s.length&&!g.hasError||Z(p.current,G,{hasInvalidAddress:g.hasInvalidAddress,hasError:g.hasError})},[s,r,g.hasError,g.hasInvalidAddress]),(0,a.useEffect)(()=>{!r&&s.length>0&&!g.hasError&&Z(p.current,Y,s)},[s,r,g.hasError]),(0,a.useEffect)(()=>{i||(g.hasError?Z(p.current,Q,{hasError:g.hasError,hasInvalidAddress:g.hasInvalidAddress}):Z(p.current,J,n.current))},[n,i,g.hasError,g.hasInvalidAddress]);const _={shippingErrorStatus:g,dispatchErrorStatus:d,shippingErrorTypes:$,...h};return(0,S.jsx)(S.Fragment,{children:(0,S.jsx)(Ne.Provider,{value:_,children:e})})};function Ie(e,t){const o=(0,a.useRef)();return(0,a.useEffect)(()=>{o.current===e||t&&!t(e,o.current)||(o.current=e)},[e,t]),o.current}const Te=window.wp.notices,Be=window.wc.blocksCheckoutEvents,Me=window.wc.wcBlocksRegistry,Le=(0,a.createContext)({onSubmit:()=>{},onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},onCheckoutSuccess:()=>()=>{},onCheckoutFail:()=>()=>{},onCheckoutValidation:()=>()=>{}}),Oe=({children:e,redirectUrl:t})=>{const o=(0,Me.getPaymentMethods)(),s=(0,Me.getExpressPaymentMethods)(),r=(0,Me.getExpressPaymentMethods)(),{isEditor:c}=R(),n=(0,P.useRegistry)(),{__internalUpdateAvailablePaymentMethods:i,__internalSetRegisteredExpressPaymentMethods:l}=(0,P.useDispatch)(B.paymentStore);(0,a.useEffect)(()=>{l((e=>{const t={};return Object.keys(e).forEach(o=>{const s=e[o];t[o]={name:s.name,title:s.title,description:s.description,gatewayId:s.gatewayId,supportsStyle:s.supports?.style||[]}}),t})(r))},[l,r]),(0,a.useEffect)(()=>{const e=Object.keys(o).length>0||Object.keys(s).length>0,t=n.select(B.cartStore).hasFinishedResolution("getCartData");(c||e&&t)&&i()},[c,o,s,n,i]);const{__internalSetRedirectUrl:d,__internalEmitValidateEvent:m,__internalEmitAfterProcessingEvents:u,__internalSetBeforeProcessing:p}=(0,P.useDispatch)(B.checkoutStore),{checkoutRedirectUrl:h,checkoutStatus:g,isCheckoutBeforeProcessing:_,isCheckoutAfterProcessing:w,checkoutHasError:b,checkoutOrderId:k,checkoutOrderNotes:y,checkoutCustomerId:x}=(0,P.useSelect)(e=>{const t=e(B.checkoutStore);return{checkoutRedirectUrl:t.getRedirectUrl(),checkoutStatus:t.getCheckoutStatus(),isCheckoutBeforeProcessing:t.isBeforeProcessing(),isCheckoutAfterProcessing:t.isAfterProcessing(),checkoutHasError:t.hasError(),checkoutOrderId:t.getOrderId(),checkoutOrderNotes:t.getOrderNotes(),checkoutCustomerId:t.getCustomerId()}});t&&t!==h&&d(t);const{setValidationErrors:f}=(0,P.useDispatch)(B.validationStore),{dispatchCheckoutEvent:v}=Se(),j=Object.values(X).filter(e=>e!==X.PAYMENTS&&e!==X.EXPRESS_PAYMENTS),C=(0,P.useSelect)(e=>{const{getNotices:t}=e(Te.store);return j.reduce((e,o)=>[...e,...t(o)],[])},[j]),{paymentNotices:E,expressPaymentNotices:N}=(0,P.useSelect)(e=>{const{getNotices:t}=e(Te.store);return{paymentNotices:t(X.PAYMENTS),expressPaymentNotices:t(X.EXPRESS_PAYMENTS)}},[]),[A]=(0,a.useReducer)(F,{}),I=(0,a.useRef)(A),{onCheckoutValidation:T,onCheckoutSuccess:M,onCheckoutFail:O}=Be.checkoutEvents;(0,a.useEffect)(()=>{I.current=A},[A]);const D=(0,a.useMemo)(()=>function(...e){return L()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidation"}),T(...e)},[T]),V=(0,a.useMemo)(()=>function(...e){return L()("onCheckoutValidationBeforeProcessing",{since:"7.6.0",alternative:"onCheckoutValidation",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),T(...e)},[T]),z=(0,a.useMemo)(()=>function(...e){return L()("onCheckoutAfterProcessingWithSuccess",{since:"7.6.0",alternative:"onCheckoutSuccess",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),M(...e)},[M]),H=(0,a.useMemo)(()=>function(...e){return L()("onCheckoutAfterProcessingWithError",{since:"7.6.0",alternative:"onCheckoutFail",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),O(...e)},[O]);(0,a.useEffect)(()=>{_&&m({setValidationErrors:f})},[_,f,m]);const $=Ie(g),U=Ie(b);(0,a.useEffect)(()=>{g===$&&b===U||w&&u({notices:{checkoutNotices:C,paymentNotices:E,expressPaymentNotices:N}})},[g,b,h,k,x,y,w,_,$,U,C,N,E,m,u]);const q={onSubmit:(0,a.useCallback)(()=>{v("submit"),p()},[v,p]),onCheckoutBeforeProcessing:D,onCheckoutValidationBeforeProcessing:V,onCheckoutAfterProcessingWithSuccess:z,onCheckoutAfterProcessingWithError:H,onCheckoutSuccess:M,onCheckoutFail:O,onCheckoutValidation:T};return(0,S.jsx)(Le.Provider,{value:q,children:e})},De=window.wp.apiFetch;var Fe=o.n(De);(0,n.__)("Something went wrong. Please contact us to get assistance.","woocommerce");const Ve=(e,t,o)=>{const s=Object.keys(e).map(t=>({key:t,value:e[t]}),[]),r=`wc-${o}-new-payment-method`;return s.push({key:r,value:t}),s},ze=e=>{if(!e)return;const{__internalSetCustomerId:t}=(0,P.dispatch)(B.checkoutStore);Fe().setNonce&&"function"==typeof Fe().setNonce&&Fe().setNonce(e),Fe().setCartHash&&"function"==typeof Fe().setCartHash&&Fe().setCartHash(e),e?.get("User-ID")&&t(parseInt(e.get("User-ID")||"0",10))};function He(e){const t=(0,a.useRef)(e);return fe()(e,t.current)||(t.current=e),t.current}const $e=()=>{const{onCheckoutValidation:e}=Be.checkoutEvents,{additionalFields:t,customerId:o,customerPassword:s,extensionData:r,hasError:c,isBeforeProcessing:d,isComplete:m,isProcessing:u,orderNotes:p,redirectUrl:h,shouldCreateAccount:g}=(0,P.useSelect)(e=>{const t=e(B.checkoutStore);return{additionalFields:t.getAdditionalFields(),customerId:t.getCustomerId(),customerPassword:t.getCustomerPassword(),extensionData:t.getExtensionData(),hasError:t.hasError(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),isProcessing:t.isProcessing(),orderNotes:t.getOrderNotes(),redirectUrl:t.getRedirectUrl(),shouldCreateAccount:t.getShouldCreateAccount()}},[]),{__internalSetHasError:_,__internalProcessCheckoutResponse:w}=(0,P.useDispatch)(B.checkoutStore),b=(0,P.useSelect)(e=>e(B.validationStore).hasValidationErrors,[]),{shippingErrorStatus:k}=Ae(),{shippingAddress:y,billingAddress:x,useBillingAsShipping:f}=(()=>{const{isEditor:e,getPreviewData:t}=R(),{needsShipping:o}=je(),{useShippingAsBilling:s,prefersCollection:r,editingBillingAddress:c,editingShippingAddress:n}=(0,P.useSelect)(e=>({useShippingAsBilling:e(B.checkoutStore).getUseShippingAsBilling(),prefersCollection:e(B.checkoutStore).prefersCollection(),editingBillingAddress:e(B.checkoutStore).getEditingBillingAddress(),editingShippingAddress:e(B.checkoutStore).getEditingShippingAddress()})),{__internalSetUseShippingAsBilling:l,setEditingBillingAddress:d,setEditingShippingAddress:m}=(0,P.useDispatch)(B.checkoutStore),{billingAddress:u,setBillingAddress:p,shippingAddress:h,setShippingAddress:g}=(()=>{const{customerData:e,isInitialized:t}=(0,P.useSelect)(e=>{const t=e(B.cartStore);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}}),{setShippingAddress:o,setBillingAddress:s}=(0,P.useDispatch)(B.cartStore);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:s,setShippingAddress:o}})(),_=He(u),w=He(h),b=(0,a.useMemo)(()=>re(_),[_]),k=(0,a.useMemo)(()=>re(w),[w]),y=(0,a.useCallback)(e=>{p({email:e})},[p]),x=(0,i.getSetting)("forcedBillingAddress",!1);return{shippingAddress:k,billingAddress:b,setShippingAddress:g,setBillingAddress:p,setEmail:y,defaultFields:e?t("defaultFields",i.defaultFields):i.defaultFields,useShippingAsBilling:s,setUseShippingAsBilling:l,editingBillingAddress:c,editingShippingAddress:n,setEditingBillingAddress:d,setEditingShippingAddress:m,needsShipping:o,showShippingFields:!x&&o&&!r,showShippingMethods:o&&!r,showBillingFields:!o||!s||!!r,forcedBillingAddress:x,useBillingAsShipping:x||!!r}})(),{cartNeedsPayment:v,cartNeedsShipping:S,cartTotals:j,receiveCartContents:C}=_e(),{activePaymentMethod:E,paymentMethodData:N,isExpressPaymentMethodActive:A,hasPaymentError:I,isPaymentReady:T,shouldSavePayment:M}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),hasPaymentError:t.hasPaymentError(),isPaymentReady:t.isPaymentReady(),shouldSavePayment:t.getShouldSavePaymentMethod()}},[]),L=(0,Me.getPaymentMethods)(),O=(0,Me.getExpressPaymentMethods)(),D=(0,a.useRef)(x),F=(0,a.useRef)(y),V=(0,a.useRef)(h),[z,H]=(0,a.useState)(!1),$=(0,a.useMemo)(()=>{const e={...O,...L};return e?.[E]?.paymentMethodId},[E,O,L]),U=b()&&!A||I||k.hasError,q=!c&&!U&&(T||!v)&&u;(0,a.useEffect)(()=>{U===c||!u&&!d||A||_(U)},[U,c,u,d,A,_]),(0,a.useEffect)(()=>{D.current=x,F.current=y,V.current=h},[x,y,h]);const W=(0,a.useCallback)(()=>b()?void 0!==(0,P.select)(B.validationStore).getValidationError("shipping-rates-error")&&{type:l.responseTypes.ERROR,errorMessage:(0,n.__)("Sorry, this order requires a shipping option.","woocommerce")}:I?{type:l.responseTypes.ERROR,errorMessage:(0,n.__)("There was a problem with your payment option.","woocommerce"),context:"wc/checkout/payments"}:!k.hasError||{type:l.responseTypes.ERROR,errorMessage:(0,n.__)("There was a problem with your shipping option.","woocommerce"),context:"wc/checkout/shipping-methods"},[b,I,k.hasError]);(0,a.useEffect)(()=>{let t;return A||(t=e(W,0)),()=>{A||"function"!=typeof t||t()}},[e,W,A]),(0,a.useEffect)(()=>{window.localStorage.removeItem("WOOCOMMERCE_CHECKOUT_IS_CUSTOMER_DATA_DIRTY"),V.current&&(window.location.href=V.current)},[m]);const Y=(0,a.useCallback)(async()=>{if(z)return;H(!0),(()=>{const e=(0,P.select)("wc/store/store-notices").getRegisteredContainers(),{removeNotice:t}=(0,P.dispatch)(Te.store),{getNotices:o}=(0,P.select)(Te.store);e.forEach(e=>{o(e).forEach(o=>{t(o.id,e)})})})();const e=v?{payment_method:$,payment_data:Ve(N,M,E)}:{},c=D.current,a=f?c:F.current,i={additional_fields:t,billing_address:c,create_account:g,customer_note:p,customer_password:s,extensions:{...r},shipping_address:S?a:void 0,...!A&&j&&""!==j.total_price?{expected_total:j.total_price}:{},...e};(0,B.clearCheckoutPutRequests)(),Fe()({path:"/wc/store/v1/checkout",method:"POST",data:i,cache:"no-store",parse:!1}).then(e=>{if((0,l.assertResponseIsValid)(e),ze(e.headers),!e.ok)throw e;return e.json()}).then(e=>{w(e),H(!1)}).catch(e=>{ze(e?.headers);try{e.json().then(e=>e).then(e=>{e.data?.cart&&C(e.data.cart),(0,B.processErrorResponse)(e),w(e)})}catch{let e=(0,n.__)("Something went wrong when placing the order. Check your email for order updates before retrying.","woocommerce");0!==o&&(e=(0,n.__)("Something went wrong when placing the order. Check your account's order history or your email for order updates before retrying.","woocommerce")),(0,B.processErrorResponse)({code:"unknown_error",message:e,data:null})}_(!0),H(!1)})},[z,v,j,A,$,N,M,E,p,g,o,s,r,t,S,C,_,w,f]);return(0,a.useEffect)(()=>{q&&!z&&Y()},[Y,q,z]),null},Ue=({children:e,redirectUrl:t})=>(0,S.jsx)(Oe,{redirectUrl:t,children:(0,S.jsx)(Re,{children:(0,S.jsxs)(H,{children:[e,(0,S.jsx)(E,{renderError:i.CURRENT_USER_IS_ADMIN?null:()=>null,children:(0,S.jsx)(T.PluginArea,{scope:"woocommerce-checkout"})}),(0,S.jsx)($e,{})]})})}),qe=({children:e,redirectUrl:t})=>(0,S.jsx)(Ue,{redirectUrl:t,children:e}),We={currency_code:i.SITE_CURRENCY.code,currency_symbol:i.SITE_CURRENCY.symbol,currency_minor_unit:i.SITE_CURRENCY.minorUnit,currency_decimal_separator:i.SITE_CURRENCY.decimalSeparator,currency_thousand_separator:i.SITE_CURRENCY.thousandSeparator,currency_prefix:i.SITE_CURRENCY.prefix,currency_suffix:i.SITE_CURRENCY.suffix},Ye=(e,t=2)=>{const o=i.SITE_CURRENCY.minorUnit;if(o===t||!e)return e;const s=Math.pow(10,o);return(Math.round(parseInt(e,10)/Math.pow(10,t))*s).toString()},Ge=(0,i.getSetting)("localPickupEnabled",!1),Je=(0,i.getSetting)("localPickupText",(0,n.__)("Local pickup","woocommerce")),Qe=(0,i.getSetting)("localPickupCost",""),Ke=Ge?(0,i.getSetting)("localPickupLocations",[]):[],Xe=Ke?Object.values(Ke).map((e,t)=>({...We,name:`${Je} (${e.name})`,description:"",delivery_time:"",price:Ye(Qe,0)||"0",taxes:"0",rate_id:`pickup_location:${t+1}`,instance_id:t+1,meta_data:[{key:"pickup_location",value:e.name},{key:"pickup_address",value:e.formatted_address},{key:"pickup_details",value:e.details}],method_id:"pickup_location",selected:!1})):[],Ze=[{destination:{address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},package_id:0,name:(0,n.__)("Shipping","woocommerce"),items:[{key:"33e75ff09dd601bbe69f351039152189",name:(0,n._x)("Beanie with Logo","example product in Cart Block","woocommerce"),quantity:2},{key:"6512bd43d9caa6e02c990b0a82652dca",name:(0,n._x)("Beanie","example product in Cart Block","woocommerce"),quantity:1}],shipping_rates:[{...We,name:(0,n.__)("Flat rate shipping","woocommerce"),description:"",delivery_time:"",price:Ye("500"),taxes:"0",rate_id:"flat_rate:0",instance_id:0,meta_data:[],method_id:"flat_rate",selected:!1},{...We,name:(0,n.__)("Free shipping","woocommerce"),description:"",delivery_time:"",price:"0",taxes:"0",rate_id:"free_shipping:1",instance_id:0,meta_data:[],method_id:"flat_rate",selected:!0},...Xe]}],et=(0,i.getSetting)("displayCartPricesIncludingTax",!1),tt={coupons:[],shipping_rates:(0,i.getSetting)("shippingMethodsExist",!1)||(0,i.getSetting)("localPickupEnabled",!1)?Ze:[],items:[{key:"1",parent_item_key:null,id:1,type:"simple",quantity:2,catalog_visibility:"visible",name:(0,n.__)("Beanie","woocommerce"),summary:(0,n.__)("Beanie","woocommerce"),short_description:(0,n.__)("Warm hat for winter","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",sku:"woo-beanie",permalink:"https://example.org",low_stock_remaining:2,backorders_allowed:!1,show_backorder_badge:!1,sold_individually:!1,quantity_limits:{minimum:1,maximum:99,multiple_of:1,editable:!0},images:[{id:10,src:m+"previews/beanie.jpg",thumbnail:m+"previews/beanie.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,n.__)("Color","woocommerce"),value:(0,n.__)("Yellow","woocommerce")},{attribute:(0,n.__)("Size","woocommerce"),value:(0,n.__)("Small","woocommerce")}],prices:{...We,price:Ye(et?"12000":"10000"),regular_price:Ye(et?"120":"100"),sale_price:Ye(et?"12000":"10000"),price_range:null,raw_prices:{precision:6,price:et?"12000000":"10000000",regular_price:et?"12000000":"10000000",sale_price:et?"12000000":"10000000"}},totals:{...We,line_subtotal:Ye("2000"),line_subtotal_tax:Ye("400"),line_total:Ye("2000"),line_total_tax:Ye("400")},extensions:{},item_data:[]},{key:"2",parent_item_key:null,id:2,type:"simple",quantity:1,catalog_visibility:"visible",name:(0,n.__)("Cap","woocommerce"),summary:(0,n.__)("Cap","woocommerce"),short_description:(0,n.__)("Lightweight baseball cap","woocommerce"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",sku:"woo-cap",low_stock_remaining:null,permalink:"https://example.org",backorders_allowed:!1,show_backorder_badge:!1,sold_individually:!1,quantity_limits:{minimum:1,maximum:99,multiple_of:1,editable:!0},images:[{id:11,src:m+"previews/cap.jpg",thumbnail:m+"previews/cap.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,n.__)("Color","woocommerce"),value:(0,n.__)("Orange","woocommerce")}],prices:{...We,price:Ye(et?"2400":"2000"),regular_price:Ye(et?"2400":"2000"),sale_price:Ye(et?"2400":"2000"),price_range:null,raw_prices:{precision:6,price:et?"24000000":"20000000",regular_price:et?"24000000":"20000000",sale_price:et?"24000000":"20000000"}},totals:{...We,line_subtotal:Ye("2000"),line_subtotal_tax:Ye("400"),line_total:Ye("2000"),line_total_tax:Ye("400")},extensions:{},item_data:[]}],cross_sells:[{id:1,name:(0,n.__)("Polo","woocommerce"),slug:"polo",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-polo",short_description:(0,n.__)("Polo","woocommerce"),description:(0,n.__)("Polo","woocommerce"),on_sale:!1,prices:{...We,price:Ye(et?"24000":"20000"),regular_price:Ye(et?"24000":"20000"),sale_price:Ye(et?"12000":"10000"),price_range:null},price_html:"",average_rating:"4.5",review_count:2,images:[{id:17,src:m+"previews/polo.jpg",thumbnail:m+"previews/polo.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:2,name:(0,n.__)("Long Sleeve Tee","woocommerce"),slug:"long-sleeve-tee",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-long-sleeve-tee",short_description:(0,n.__)("Long Sleeve Tee","woocommerce"),description:(0,n.__)("Long Sleeve Tee","woocommerce"),on_sale:!1,prices:{...We,price:Ye(et?"30000":"25000"),regular_price:Ye(et?"30000":"25000"),sale_price:Ye(et?"30000":"25000"),price_range:null},price_html:"",average_rating:"4",review_count:2,images:[{id:17,src:m+"previews/long-sleeve-tee.jpg",thumbnail:m+"previews/long-sleeve-tee.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:3,name:(0,n.__)("Hoodie with Zipper","woocommerce"),slug:"hoodie-with-zipper",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-zipper",short_description:(0,n.__)("Hoodie with Zipper","woocommerce"),description:(0,n.__)("Hoodie with Zipper","woocommerce"),on_sale:!0,prices:{...We,price:Ye(et?"15000":"12500"),regular_price:Ye(et?"30000":"25000"),sale_price:Ye(et?"15000":"12500"),price_range:null},price_html:"",average_rating:"1",review_count:2,images:[{id:17,src:m+"previews/hoodie-with-zipper.jpg",thumbnail:m+"previews/hoodie-with-zipper.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:4,name:(0,n.__)("Hoodie with Logo","woocommerce"),slug:"hoodie-with-logo",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-logo",short_description:(0,n.__)("Polo","woocommerce"),description:(0,n.__)("Polo","woocommerce"),on_sale:!1,prices:{...We,price:Ye(et?"4500":"4250"),regular_price:Ye(et?"4500":"4250"),sale_price:Ye(et?"4500":"4250"),price_range:null},price_html:"",average_rating:"5",review_count:2,images:[{id:17,src:m+"previews/hoodie-with-logo.jpg",thumbnail:m+"previews/hoodie-with-logo.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:5,name:(0,n.__)("Hoodie with Pocket","woocommerce"),slug:"hoodie-with-pocket",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-pocket",short_description:(0,n.__)("Hoodie with Pocket","woocommerce"),description:(0,n.__)("Hoodie with Pocket","woocommerce"),on_sale:!0,prices:{...We,price:Ye(et?"3500":"3250"),regular_price:Ye(et?"4500":"4250"),sale_price:Ye(et?"3500":"3250"),price_range:null},price_html:"",average_rating:"3.75",review_count:4,images:[{id:17,src:m+"previews/hoodie-with-pocket.jpg",thumbnail:m+"previews/hoodie-with-pocket.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}},{id:6,name:(0,n.__)("T-Shirt","woocommerce"),slug:"t-shirt",parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-t-shirt",short_description:(0,n.__)("T-Shirt","woocommerce"),description:(0,n.__)("T-Shirt","woocommerce"),on_sale:!1,prices:{...We,price:Ye(et?"1800":"1500"),regular_price:Ye(et?"1800":"1500"),sale_price:Ye(et?"1800":"1500"),price_range:null},price_html:"",average_rating:"3",review_count:2,images:[{id:17,src:m+"previews/tshirt.jpg",thumbnail:m+"previews/tshirt.jpg",srcset:"",sizes:"",name:"",alt:""}],categories:[],tags:[],attributes:[],variations:[],has_options:!1,is_purchasable:!0,is_in_stock:!0,is_on_backorder:!1,low_stock_remaining:null,sold_individually:!1,add_to_cart:{text:"",description:"",url:"",minimum:1,maximum:99,multiple_of:1}}],fees:[{id:"fee",name:(0,n.__)("Fee","woocommerce"),totals:{...We,total:Ye("100"),total_tax:Ye("20")}}],items_count:3,items_weight:0,needs_payment:!0,needs_shipping:w,has_calculated_shipping:!0,shipping_address:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},billing_address:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},totals:{...We,total_items:Ye("4000"),total_items_tax:Ye("800"),total_fees:Ye("100"),total_fees_tax:Ye("20"),total_discount:"0",total_discount_tax:"0",total_shipping:"0",total_shipping_tax:"0",total_tax:Ye("820"),total_price:Ye("4920"),tax_lines:[{name:(0,n.__)("Sales tax","woocommerce"),rate:"20%",price:Ye("820")}]},errors:[],payment_methods:["cod","bacs","cheque"],payment_requirements:["products"],extensions:{}},ot=window.wc.blocksCheckout,st=window.wp.url;var rt=o(5573);const ct=(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,S.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,S.jsx)("path",{d:"M0 0h24v24H0z"}),(0,S.jsx)("path",{fill:"currentColor",fillRule:"nonzero",d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49A.996.996 0 0 0 20.01 4H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45ZM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2Zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2Z"})]})," "]});var nt=o(11789),at=o(29491);const it=(0,a.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),lt=({children:e,className:t=""})=>{const[o,r]=(()=>{const[e,{width:t}]=(0,at.useResizeObserver)();let o="";return t>920?o="is-large":t>520?o="is-medium":t>400?o="is-small":t&&(o="is-mobile"),[e,o]})(),c={hasContainerWidth:""!==r,containerClassName:r,isMobile:"is-mobile"===r,isSmall:"is-small"===r,isMedium:"is-medium"===r,isLarge:"is-large"===r};return(0,S.jsx)(it.Provider,{value:c,children:(0,S.jsxs)("div",{className:(0,s.A)(t,r),children:[o,e]})})};o(99163);const dt=({children:e,className:t})=>(0,S.jsx)(lt,{className:(0,s.A)("wc-block-components-sidebar-layout",t),children:e}),mt=["core/paragraph","core/image","core/separator"],ut=e=>{const t=(0,ot.applyCheckoutFilter)({filterName:"additionalCartCheckoutInnerBlockTypes",defaultValue:[],extensions:(0,P.select)(B.cartStore).getCartData().extensions,arg:{block:e},validation:e=>{if(Array.isArray(e)&&e.every(e=>"string"==typeof e))return!0;throw new Error("allowedBlockTypes filters must return an array of strings.")}});return Array.from(new Set([...(0,c.getBlockTypes)().filter(t=>(t?.parent||[]).includes(e)).map(({name:e})=>e),...mt,...t]))},pt=({clientId:e,registeredBlocks:t,defaultTemplate:o=[]})=>{const s=(0,a.useRef)(t),r=(0,a.useRef)(o),n=(0,P.useRegistry)(),{isPreview:i}=R();(0,a.useEffect)(()=>{let t=!1;if(i)return;const{replaceInnerBlocks:o}=(0,P.dispatch)("core/block-editor");return n.subscribe(()=>{if(!n.select("core/block-editor").getBlock(e))return;const a=n.select("core/block-editor").getBlocks(e);if(0===a.length&&r.current.length>0&&!t){const s=(0,c.createBlocksFromInnerBlocksTemplate)(r.current);if(0!==s.length)return t=!0,void o(e,s)}const i=s.current.map(e=>(0,c.getBlockType)(e)),l=((e,t)=>{const o=t.filter(e=>e&&(({attributes:e})=>Boolean(e.lock?.remove||e.lock?.default?.remove))(e)),s=[];return o.forEach(t=>{if(void 0===t)return;const o=e.find(e=>e.name===t.name);o||s.push(t)}),s})(a,i);if(0===l.length)return;let d=-1;const m=l.map(e=>{const t=r.current.findIndex(([t])=>t===e.name),o=(0,c.createBlock)(e.name);return-1===d&&(d=(({defaultTemplatePosition:e,innerBlocks:t,currentDefaultTemplate:o})=>{switch(e){case-1:return t.length;case 0:return 0;default:const s=o.current[e-1],r=t.findIndex(({name:e})=>e===s[0]);return-1===r?e:r+1}})({defaultTemplatePosition:t,innerBlocks:a,currentDefaultTemplate:r})),o});n.batch(()=>{n.dispatch("core/block-editor").insertBlocks(m,d,e)})},"core/block-editor")},[e,i,n])};o(30398);const ht=(0,a.createContext)({hasDarkControls:!1}),gt=JSON.parse('{"name":"woocommerce/filled-cart-block","title":"Filled Cart","description":"Contains blocks that are displayed when the cart contains products.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(gt,{icon:{src:(0,S.jsx)(nt.A,{icon:ct,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)(),{currentView:o}=R(),{hasDarkControls:c}=(0,a.useContext)(ht),n=ut(ot.innerBlockAreas.FILLED_CART),i=[["woocommerce/cart-items-block",{},[]],["woocommerce/cart-totals-block",{},[]]];return pt({clientId:e,registeredBlocks:n,defaultTemplate:i}),(0,S.jsx)("div",{...t,hidden:"woocommerce/filled-cart-block"!==o,children:(0,S.jsx)(dt,{className:(0,s.A)("wc-block-cart",{"has-dark-controls":c}),children:(0,S.jsx)(r.InnerBlocks,{allowedBlocks:n,template:i,templateLock:"insert"})})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})})});var _t=o(19437);const wt=(0,a.forwardRef)(({children:e,className:t=""},o)=>(0,S.jsx)("div",{ref:o,className:(0,s.A)("wc-block-components-main",t),children:e}));var bt=o(56050);const kt=JSON.parse('{"name":"woocommerce/product-collection"}');let yt=function(e){return e.GRID="flex",e.STACK="list",e.CAROUSEL="carousel",e}({}),xt=function(e){return e.FILL="fill",e.FIXED="fixed",e}({}),ft=function(e){return e.PRODUCT_CATALOG="woocommerce/product-collection/product-catalog",e.BEST_SELLERS="woocommerce/product-collection/best-sellers",e.FEATURED="woocommerce/product-collection/featured",e.NEW_ARRIVALS="woocommerce/product-collection/new-arrivals",e.ON_SALE="woocommerce/product-collection/on-sale",e.TOP_RATED="woocommerce/product-collection/top-rated",e.HAND_PICKED="woocommerce/product-collection/hand-picked",e.RELATED="woocommerce/product-collection/related",e.UPSELLS="woocommerce/product-collection/upsells",e.CROSS_SELLS="woocommerce/product-collection/cross-sells",e.BY_CATEGORY="woocommerce/product-collection/by-category",e.BY_TAG="woocommerce/product-collection/by-tag",e.BY_BRAND="woocommerce/product-collection/by-brand",e.CART_CONTENTS="woocommerce/product-collection/cart-contents",e}({}),vt=function(e){return e.ATTRIBUTES="attributes",e.CREATED="created",e.FEATURED="featured",e.HAND_PICKED="hand-picked",e.INHERIT="inherit",e.KEYWORD="keyword",e.ON_SALE="on-sale",e.ORDER="order",e.DEFAULT_ORDER="default-order",e.STOCK_STATUS="stock-status",e.TAXONOMY="taxonomy",e.PRICE_RANGE="price-range",e.FILTERABLE="filterable",e.PRODUCTS_PER_PAGE="products-per-page",e.MAX_PAGES_TO_SHOW="max-pages-to-show",e.OFFSET="offset",e.RELATED_BY="related-by",e}({});const St=`${kt.name}/product-title`,jt=(0,i.getSetting)("stockStatusOptions",[]),Ct={perPage:9,pages:0,offset:0,postType:"product",order:"asc",orderBy:"title",search:"",exclude:[],inherit:!1,taxQuery:{},isProductCollectionBlock:!0,featured:!1,woocommerceOnSale:!1,woocommerceStockStatus:(0,i.getSetting)("hideOutOfStockItems",!1)?Object.keys(function(e,t){const{[t]:o,...s}=e;return s}(jt,"outofstock")):Object.keys(jt),woocommerceAttributes:[],woocommerceHandPickedProducts:[],timeFrame:void 0,priceRange:void 0,filterable:!1,relatedBy:{categories:!0,tags:!0}},Et={query:Ct,tagName:"div",displayLayout:{type:yt.GRID,columns:3,shrinkColumns:!0},dimensions:{widthType:xt.FILL},queryContextIncludes:["collection"],forcePageReload:!1},Pt=["woocommerce/product-template",{},[["woocommerce/product-image",{showSaleBadge:!1,style:{dimensions:{aspectRatio:"1/1"}}},[["woocommerce/product-sale-badge",{align:"right"}]]],["core/post-title",{textAlign:"center",level:2,fontSize:"medium",style:{spacing:{margin:{bottom:"0.75rem",top:"0"}},typography:{lineHeight:"1.4"}},isLink:!0,__woocommerceNamespace:St}],["woocommerce/product-price",{textAlign:"center",fontSize:"small"}],["woocommerce/product-button",{textAlign:"center",fontSize:"small"}]]],Nt={name:ft.CROSS_SELLS,title:(0,n.__)("Cross-Sells","woocommerce"),icon:(0,S.jsx)(nt.A,{icon:bt.A}),description:(0,n.__)("By suggesting complementary products in the cart using cross-sells, you can significantly increase the average order value.","woocommerce"),keywords:["boost","promotion"],scope:["inserter","block"],usesReference:["product","cart","order"],attributes:{...Et,displayLayout:{type:"flex",columns:4,shrinkColumns:!0},query:{...Ct,perPage:8,pages:1},hideControls:[vt.FILTERABLE]},innerBlocks:[["core/heading",{textAlign:"left",level:2,content:(0,n.__)("You may be interested in…","woocommerce"),style:{spacing:{margin:{bottom:"1rem"}}}}],Pt]},At=JSON.parse('{"name":"woocommerce/cart-items-block","title":"Cart Items","description":"Column containing cart items.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(At,{icon:{src:(0,S.jsx)(nt.A,{icon:_t.A,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)({className:"wc-block-cart__main"}),o=ut(ot.innerBlockAreas.CART_ITEMS);o.push("woocommerce/product-collection");const s=[["woocommerce/cart-line-items-block",{},[]],["woocommerce/product-collection",{...Nt.attributes,displayLayout:{...Nt.attributes.displayLayout,columns:3},query:{...Nt.attributes.query,perPage:3},collection:"woocommerce/product-collection/cross-sells"},Nt.innerBlocks]];return pt({clientId:e,registeredBlocks:o,defaultTemplate:s}),(0,S.jsx)(wt,{...t,children:(0,S.jsx)(r.InnerBlocks,{allowedBlocks:o,template:s,templateLock:!1,renderAppender:r.InnerBlocks.ButtonBlockAppender})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})})});var Rt=o(28107),It=o(64347);const Tt=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"],Bt=({children:e,style:t={},...o})=>{const s=(0,a.useRef)(null),r=()=>{s.current&&Rt.focus.focusable.find(s.current).forEach(e=>{Tt.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")})},c=(0,It.YQ)(r,0,{leading:!0});return(0,a.useLayoutEffect)(()=>{let e;return r(),s.current&&(e=new window.MutationObserver(c),e.observe(s.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),c.cancel()}},[c]),(0,S.jsx)("div",{ref:s,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...o,children:e})};o(42405);const Mt=({tag:e="div",width:t="100%",height:o="8px",maxWidth:r="",className:c="",borderRadius:n="",isStatic:a=!1,ariaMessage:i})=>(0,S.jsx)(e,{className:(0,s.A)("wc-block-components-skeleton__element",{"wc-block-components-skeleton__element--static":a},c),...i?{"aria-live":"polite","aria-label":i}:{"aria-hidden":"true"},style:{width:t,height:o,borderRadius:n,maxWidth:r}});o(60359),o(77826),o(22336);const Lt=({rows:e=2})=>(0,S.jsx)(S.Fragment,{children:Array.from({length:e}).map((e,t)=>(0,S.jsxs)("tr",{className:"wc-block-cart-items__row","aria-label":(0,n.__)("Loading products in cart…","woocommerce"),children:[(0,S.jsx)("td",{className:"wc-block-cart-item__image",children:(0,S.jsx)(Mt,{height:"0"})}),(0,S.jsx)("td",{className:"wc-block-cart-item__product",children:(0,S.jsxs)("div",{className:"wc-block-cart-item__wrap",children:[(0,S.jsx)(Mt,{width:"90%",maxWidth:"173px",height:".875em"}),(0,S.jsx)(Mt,{width:"50%",maxWidth:"85px",height:".875em"})]})}),(0,S.jsx)("td",{className:"wc-block-cart-item__total",children:(0,S.jsx)(Mt,{height:".875em",maxWidth:"45px"})})]},t))}),Ot=({children:e,isLoading:t,skeleton:o})=>{const s=(0,at.useReducedMotion)(),[r,c]=(0,a.useState)(t),[n,i]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(s)return void c(t);let e;if(t)c(!0),i(Date.now());else if(n){const t=Date.now()-n,o=Math.max(0,2e3-t);e=setTimeout(()=>{c(!1),i(null)},o)}return()=>{e&&clearTimeout(e)}},[t,n,s]),(0,S.jsx)(S.Fragment,{children:r?o:e})};var Dt=o(20195),Ft=o(48558);o(79959);const Vt=({className:e,quantity:t=1,minimum:o=1,maximum:r,onChange:c=()=>{},step:i=1,itemName:l="",disabled:d,editable:m=!0})=>{const u=(0,s.A)("wc-block-components-quantity-selector",e),p=(0,a.useRef)(null),h=(0,a.useRef)(null),g=(0,a.useRef)(null),_=void 0!==r,w=!d&&t-i>=o,b=!d&&(!_||t+i<=r),[k,y]=(0,a.useState)(t),x=(0,a.useRef)(t),f=(0,a.useRef)("input"),v=(0,a.useCallback)(e=>{let t=e;_&&(t=Math.min(t,Math.floor(r/i)*i)),t=Math.max(t,Math.ceil(o/i)*i),t=Math.round(t/i)*i;const s=i.toString().split(".")[1]?.length||0;return t=Math.round(t*Math.pow(10,s))/Math.pow(10,s),t},[_,r,o,i]),j=(0,It.YQ)(e=>{c(e)},600),C=(0,a.useCallback)(e=>{if(isNaN(e))return void y(t);j.cancel();const o=v(e);y(o),x.current=o,o!==t&&c(o)},[v,t,j,c]);(0,a.useLayoutEffect)(()=>{t!==x.current?"increase"===f.current&&t<x.current||"decrease"===f.current&&t>x.current||(y(t),x.current=t,f.current="input"):f.current="input"},[t,v]);const E=(0,a.useCallback)(e=>{const t="ArrowDown"===e.key||e.keyCode===Ft.DOWN,o="ArrowUp"===e.key||e.keyCode===Ft.UP,s="Enter"===e.key||e.keyCode===Ft.ENTER;t&&(e.preventDefault(),h.current?.click()),o&&(e.preventDefault(),g.current?.click()),s&&(e.preventDefault(),p.current?.blur())},[]),P=(0,a.useCallback)(e=>{const o=e.target.value,s=Number(o);if(y(s),isNaN(s))return void j.cancel();const r=v(s);x.current=r,r===s&&r!==t?j(r):j.cancel()},[j,v,t]),N=(0,a.useCallback)(()=>{C(k)},[k,C]),A=(0,a.useCallback)(e=>e.toString(),[]);return(0,S.jsxs)("div",{className:u,children:[m&&(0,S.jsx)("button",{ref:h,"aria-label":(0,n.sprintf)(/* translators: %s refers to the item name in the cart. */ /* translators: %s refers to the item name in the cart. */ (0,n.__)("Reduce quantity of %s","woocommerce"),l),className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus",disabled:!w,onClick:()=>{const e=k-i;C(e),f.current="decrease",(0,Dt.speak)((0,n.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */ /* translators: %s refers to the item's new quantity in the cart. */ (0,n.__)("Quantity reduced to %s.","woocommerce"),e))},children:"−"}),(0,S.jsx)("input",{ref:p,className:"wc-block-components-quantity-selector__input",disabled:d,readOnly:!m,type:"number",step:i,min:o,max:r,value:A(k),onKeyDown:E,onBlur:N,onChange:P,"aria-label":(0,n.sprintf)(/* translators: %s refers to the item name in the cart. */ /* translators: %s refers to the item name in the cart. */ (0,n.__)("Quantity of %s in your cart.","woocommerce"),l)}),m&&(0,S.jsx)("button",{ref:g,"aria-label":(0,n.sprintf)(/* translators: %s refers to the item's name in the cart. */ /* translators: %s refers to the item's name in the cart. */ (0,n.__)("Increase quantity of %s","woocommerce"),l),disabled:!b,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=k+i;C(e),f.current="increase",(0,Dt.speak)((0,n.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */ /* translators: %s refers to the item's new quantity in the cart. */ (0,n.__)("Quantity increased to %s.","woocommerce"),e))},children:"+"})]})},zt=window.wc.blocksComponents,Ht=window.wc.priceFormat;o(8501);const $t=({currency:e,maxPrice:t,minPrice:o,priceClassName:r,priceStyle:c={}})=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{className:"screen-reader-text",children:(0,n.sprintf)(/* translators: %1$s min price, %2$s max price */ /* translators: %1$s min price, %2$s max price */ (0,n.__)("Price between %1$s and %2$s","woocommerce"),(0,Ht.formatPrice)(o),(0,Ht.formatPrice)(t))}),(0,S.jsxs)("span",{"aria-hidden":!0,children:[(0,S.jsx)(zt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",r),currency:e,value:o,style:c})," — ",(0,S.jsx)(zt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",r),currency:e,value:t,style:c})]})]}),Ut=({currency:e,regularPriceClassName:t,regularPriceStyle:o,regularPrice:r,priceClassName:c,priceStyle:a,price:i})=>(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{className:"screen-reader-text",children:(0,n.__)("Previous price:","woocommerce")}),(0,S.jsx)("del",{className:(0,s.A)("wc-block-components-product-price__regular",t),style:o,translate:"no",children:(0,S.jsx)(zt.FormattedMonetaryAmount,{currency:e,value:r})}),(0,S.jsx)("span",{className:"screen-reader-text",children:(0,n.__)("Discounted price:","woocommerce")}),(0,S.jsx)("ins",{className:(0,s.A)("wc-block-components-product-price__value","is-discounted",c),style:a,translate:"no",children:(0,S.jsx)(zt.FormattedMonetaryAmount,{currency:e,value:i})})]}),qt=({align:e,className:t,currency:o,format:r="<price/>",maxPrice:c,minPrice:n,price:i,priceClassName:l,priceStyle:d,regularPrice:m,regularPriceClassName:u,regularPriceStyle:p,style:h})=>{const g=(0,s.A)(t,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=void 0!==m&&void 0!==i&&i<m;let w=(0,S.jsx)("span",{className:(0,s.A)("wc-block-components-product-price__value",l)});return _?w=(0,S.jsx)(Ut,{currency:o,price:i,priceClassName:l,priceStyle:d,regularPrice:m,regularPriceClassName:u,regularPriceStyle:p}):void 0!==n&&void 0!==c?w=(0,S.jsx)($t,{currency:o,maxPrice:c,minPrice:n,priceClassName:l,priceStyle:d}):(i||0===i)&&(w=(0,S.jsx)(zt.FormattedMonetaryAmount,{className:(0,s.A)("wc-block-components-product-price__value",l),currency:o,value:i,style:d})),(0,S.jsx)("span",{className:g,style:h,children:(0,a.createInterpolateElement)(r,{price:w})})};o(40959);const Wt=({className:e="",disabled:t=!1,name:o,permalink:r="",target:c,rel:n,style:a,onClick:i,disabledTagName:l="span",...d})=>{const m=(0,s.A)("wc-block-components-product-name",e),u=l;if(t){const e=d;return(0,S.jsx)(u,{className:m,...e,dangerouslySetInnerHTML:{__html:o}})}return(0,S.jsx)("a",{className:m,href:r,target:c,...d,dangerouslySetInnerHTML:{__html:o},style:a})};var Yt=o(60693),Gt=o(95754),Jt=o(5341),Qt=o(12892);o(37605);const Kt=({children:e,className:t})=>(0,S.jsx)("div",{className:(0,s.A)("wc-block-components-product-badge",t),children:e}),Xt=()=>(0,S.jsx)(Kt,{className:"wc-block-components-product-backorder-badge",children:(0,n.__)("Available on backorder","woocommerce")}),Zt=({image:e={},fallbackAlt:t="",width:o,height:s})=>{const r=e.alt||t;let c;e.thumbnail_srcset&&(c=o?`${o}px`:"100px");const n=e.thumbnail?{src:e.thumbnail,alt:r?(0,oe.decodeEntities)(r):"Product Image",srcSet:e.thumbnail_srcset||void 0,sizes:c}:{src:i.PLACEHOLDER_IMG_SRC,alt:"",srcSet:void 0,sizes:void 0};return(0,S.jsx)("img",{src:n.src,alt:n.alt,srcSet:n.srcSet,sizes:n.sizes,width:o,height:s})};var eo=o(67356);const to=window.wc.sanitize;o(3692);const oo=["a","b","em","i","strong","br","abbr","span"],so=["target","href","rel","name","download","class","title"],ro=({details:e=[]})=>{if(!Array.isArray(e))return null;const t=e.filter(e=>!e.hidden);return 0===t.length?null:(0,S.jsx)("div",{className:"wc-block-components-product-details",children:t.map((e,o)=>{const s=e?.key||e.name||"",r=document.createElement("div");r.innerHTML=s;const c=r.textContent||r.innerText||"",n=e?.className||(c?`wc-block-components-product-details__${(0,eo.c)(c)}`:""),a=o===t.length-1;return(0,S.jsxs)("span",{className:n,children:[s&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{className:"wc-block-components-product-details__name",dangerouslySetInnerHTML:{__html:(0,to.sanitizeHTML)(s,{tags:oo,attr:so})+":"}})," "]}),(0,S.jsx)("span",{className:"wc-block-components-product-details__value",dangerouslySetInnerHTML:{__html:(0,to.sanitizeHTML)(e.display||e.value,{tags:oo,attr:so})}}),!a&&(0,S.jsx)("span",{"aria-hidden":"true",children:" / "})]},s+(e.display||e.value))})})},co=window.wp.autop,no=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),ao=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,io=window.wp.wordcount,lo=["a","b","em","i","strong","p","br","ul","ol","li","h1","h2","h3","h4","h5","h6","pre","blockquote","img"],mo=["target","href","rel","name","download","src","class","alt","style"],uo=({source:e,maxLength:t=15,countType:o="words",className:s="",style:r={}})=>{const c=(0,a.useMemo)(()=>((e,t=15,o="words")=>{const s=(0,co.autop)(e);if((0,io.count)(s,o)<=t)return s;const r=(e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)})(s);return(0,io.count)(r,o)<=t?r:"words"===o?((e,t,o="…",s=!0)=>{const r=no(e),c=r.split(" ").splice(0,t).join(" ");return c===r?s?(0,co.autop)(r):r:s?(0,co.autop)(ao(c,o)):ao(c,o)})(r,t):((e,t,o=!0,s="…",r=!0)=>{const c=no(e),n=c.slice(0,t);if(n===c)return r?(0,co.autop)(c):c;if(o)return(0,co.autop)(ao(n,s));const a=n.match(/([\s]+)/g),i=a?a.length:0,l=c.slice(0,t+i);return r?(0,co.autop)(ao(l,s)):ao(l,s)})(r,t,"characters_including_spaces"===o)})(e,t,o),[e,t,o]);return(0,S.jsx)(a.RawHTML,{style:r,className:s,children:(0,to.sanitizeHTML)(c,{tags:lo,attr:mo})})},po=({className:e,shortDescription:t="",fullDescription:o=""})=>{const s=t||o;return s?(0,S.jsx)(uo,{className:e,source:s,maxLength:15,countType:d.wordCountType||"words"}):null};o(8879);const ho=({shortDescription:e="",fullDescription:t="",itemData:o=[],variation:s=[]})=>(0,S.jsxs)("div",{className:"wc-block-components-product-metadata",children:[(0,S.jsx)(po,{className:"wc-block-components-product-metadata__description",shortDescription:e,fullDescription:t}),(0,S.jsx)(ro,{details:o}),(0,S.jsx)(ro,{details:s.map(({attribute:e="",value:t})=>({key:e,value:t}))})]}),go=({currency:e,saleAmount:t,format:o="<price/>"})=>{if(!t||t<=0)return null;o.includes("<price/>")||(o="<price/>",console.error("Price formats need to include the `<price/>` tag."));const s=(0,n.sprintf)(/* translators: %s will be replaced by the discount amount */ /* translators: %s will be replaced by the discount amount */ (0,n.__)("Save %s","woocommerce"),o);return(0,S.jsx)(Kt,{className:"wc-block-components-sale-badge",children:(0,a.createInterpolateElement)(s,{price:(0,S.jsx)(zt.FormattedMonetaryAmount,{currency:e,value:t})})})},_o=(e,t)=>(0,Jt.i)((0,Jt.n)(e,t.minorUnit)).amount,wo=(0,a.forwardRef)(({lineItem:e,onRemove:t=()=>{},tabIndex:o},r)=>{const{name:c="",catalog_visibility:d="visible",short_description:m="",description:u="",show_backorder_badge:p=!1,quantity_limits:h={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:g=!1,permalink:_="",images:w=[],variation:b=[],item_data:k=[],prices:y={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:x={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:f}=e,{quantity:v,setItemQuantity:j,removeItem:C,isPendingDelete:E}=(e=>{const t={key:"",quantity:1};(e=>(0,l.isObject)(e)&&(0,l.objectHasProp)(e,"key")&&(0,l.objectHasProp)(e,"quantity")&&(0,l.isString)(e.key)&&(0,l.isNumber)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:o="",quantity:s=1}=t,{cartErrors:r}=_e(),{__internalStartCalculation:c,__internalFinishCalculation:n}=(0,P.useDispatch)(B.checkoutStore),[i,d]=(0,a.useState)(s),[m]=(0,It.d7)(i,400),u=Ie(m),{removeItemFromCart:p,changeCartItemQuantity:h}=(0,P.useDispatch)(B.cartStore),g=(0,P.useSelect)(e=>{if(!o)return{quantity:!1,delete:!1};const t=e(B.cartStore);return{quantity:t.isItemPendingQuantity(o),delete:t.isItemPendingDelete(o)}},[o]);(0,a.useEffect)(()=>{const e=i!==m,t=g.quantity;e||t||m!==u&&m!==s||d(s)},[s,i,m,u,g.quantity]);const _=(0,a.useCallback)(()=>o?p(o).catch(e=>{(0,B.processErrorResponse)(e)}):Promise.resolve(!1),[o,p]);return(0,a.useEffect)(()=>{o&&(0,l.isNumber)(u)&&Number.isFinite(u)&&u!==m&&h(o,m).catch(e=>{(0,B.processErrorResponse)(e)})},[o,h,m,u]),(0,a.useEffect)(()=>(g.delete?c():n(),()=>{g.delete&&n()}),[n,c,g.delete]),(0,a.useEffect)(()=>(g.quantity||m!==i?c():n(),()=>{(g.quantity||m!==i)&&n()}),[c,n,g.quantity,m,i]),{isPendingDelete:g.delete,quantity:i,setItemQuantity:d,removeItem:_,cartItemQuantityErrors:r}})(e),{saveForLater:N,isSaving:A}=(()=>{const[e,t]=(0,a.useState)(!1),{saveForLater:o}=(0,P.useDispatch)(B.cartStore),s=(0,a.useCallback)(async s=>{if(!s||e)return!1;t(!0);try{return await o(s),!0}catch(e){const t=e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message?e.message:(0,n.__)("There was a problem saving this item for later.","woocommerce");return(0,P.dispatch)(Te.store).createNotice("error",t,{context:"wc/cart",isDismissible:!0}),!1}finally{t(!1)}},[e,o]);return{isSaving:e,saveForLater:s}})(),{dispatchStoreEvent:R}=Se(),I=!!(0,i.getSetting)("currentUserId",0),T=(0,i.getSettingWithCoercion)("experimentalCartSaveForLater",!1,l.isBoolean),M=(0,i.getSettingWithCoercion)("cartPageHasSavedForLater",!1,l.isBoolean),L=I&&T&&M,{receiveCart:O,...D}=_e(),F=(0,a.useMemo)(()=>({context:"cart",cartItem:e,cart:D}),[e,D]),V=(0,Ht.getCurrencyFromPriceResponse)(y),z=(0,ot.applyCheckoutFilter)({filterName:"itemName",defaultValue:c,extensions:f,arg:F}),H=(0,oe.decodeEntities)(z),$=(0,Gt.uE)({amount:parseInt(y.raw_prices.regular_price,10),currency:Qt.B3,scale:y.raw_prices.precision}),U=(0,Gt.uE)({amount:parseInt(y.raw_prices.price,10),currency:Qt.B3,scale:y.raw_prices.precision}),q=function(e,t){const o="string"==typeof e.raw_prices.precision?parseInt(e.raw_prices.precision,10):e.raw_prices.precision,s=(0,Gt.uE)({amount:parseInt(e.raw_prices.regular_price,10),currency:Qt.B3,scale:o}),r=(0,Gt.uE)({amount:parseInt(e.raw_prices.price,10),currency:Qt.B3,scale:o});return(0,Jt.i)((0,Jt.n)((0,Jt.o)(s,r),t)).amount}(y,V.minorUnit),W=(0,Ht.getCurrencyFromPriceResponse)(x);let Y=parseInt(x.line_subtotal,10);(0,i.getSetting)("displayCartPricesIncludingTax",!1)&&(Y+=parseInt(x.line_subtotal_tax,10));const G=(0,Gt.uE)({amount:Y,currency:Qt.B3,scale:W.minorUnit}),J=w.length?w[0]:{},Q="hidden"===d||"search"===d,K=(0,ot.applyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:f,arg:F}),X=(0,ot.applyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:f,arg:F,validation:ot.productPriceValidation}),Z=(0,ot.applyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:f,arg:F,validation:ot.productPriceValidation}),ee=(0,ot.applyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:f,arg:F,validation:ot.productPriceValidation}),te=(0,ot.applyCheckoutFilter)({filterName:"showRemoveItemLink",defaultValue:!0,extensions:f,arg:F});return(0,S.jsxs)("tr",{role:"row","data-cart-item-key":e.key,className:(0,s.A)("wc-block-cart-items__row",K,{"is-disabled":E}),ref:r,tabIndex:o,children:[(0,S.jsx)("td",{className:"wc-block-cart-item__image","aria-hidden":"true",children:Q?(0,S.jsx)(Zt,{image:J,fallbackAlt:z,width:80,height:80}):(0,S.jsx)("a",{href:_,tabIndex:-1,children:(0,S.jsx)(Zt,{image:J,fallbackAlt:z,width:80,height:80})})}),(0,S.jsx)("td",{role:"rowheader","aria-label":H,className:"wc-block-cart-item__product",children:(0,S.jsxs)("div",{className:"wc-block-cart-item__wrap",children:[(0,S.jsx)(Wt,{disabled:E||Q,name:z,permalink:_}),p&&(0,S.jsx)(Xt,{}),(0,S.jsx)("div",{className:"wc-block-cart-item__prices",children:(0,S.jsx)(qt,{currency:V,regularPrice:_o($,V),price:_o(U,V),format:Z})}),(0,S.jsx)(ho,{shortDescription:m,fullDescription:u,itemData:k,variation:b}),(0,S.jsxs)("div",{className:"wc-block-cart-item__quantity",children:[!g&&(0,S.jsx)(Vt,{disabled:E,editable:h.editable,quantity:v,minimum:h.minimum,maximum:h.maximum,step:h.multiple_of,onChange:t=>{j(t),R("cart-set-item-quantity",{product:e,quantity:t})},itemName:H}),te&&(0,S.jsx)("button",{className:"wc-block-cart-item__remove-link","aria-label":(0,n.sprintf)(/* translators: %s refers to the item's name in the cart. */ /* translators: %s refers to the item's name in the cart. */ (0,n.__)("Remove %s from cart","woocommerce"),H),onClick:()=>{t(),C(),R("cart-remove-item",{product:e,quantity:v}),(0,Dt.speak)((0,n.sprintf)(/* translators: %s refers to the item name in the cart. */ /* translators: %s refers to the item name in the cart. */ (0,n.__)("%s has been removed from your cart.","woocommerce"),H))},disabled:E,children:(0,S.jsx)(nt.A,{icon:Yt.A,size:24})})]}),L&&(0,S.jsx)("div",{className:"wc-block-cart-item__save-for-later",children:(0,S.jsx)("button",{type:"button",className:"wc-block-cart-item__save-for-later-link",onClick:async()=>{await N(e.key)&&(await C(),R("cart-remove-item",{product:e,quantity:v}),(0,Dt.speak)((0,n.sprintf)(/* translators: %s refers to the item name. */ /* translators: %s refers to the item name. */ (0,n.__)("%s has been saved for later and removed from your cart.","woocommerce"),H)))},disabled:E||A,children:A?(0,n.__)("Saving…","woocommerce"):(0,n.__)("Save for later","woocommerce")})})]})}),(0,S.jsx)("td",{className:"wc-block-cart-item__total",children:(0,S.jsxs)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper",children:[(0,S.jsx)(qt,{currency:W,format:X,price:(0,Jt.i)(G).amount}),(0,S.jsx)(go,{currency:V,saleAmount:q*v,format:ee})]})})]})}),bo=wo,ko=e=>{const t={};return e.forEach(({key:e})=>{t[e]=(0,a.createRef)()}),t},yo=({lineItems:e=[],isLoading:t=!1,className:o})=>{const r=(0,a.useRef)(null),c=(0,a.useRef)(ko(e));(0,a.useEffect)(()=>{c.current=ko(e)},[e]);const i=e=>()=>{requestAnimationFrame(()=>{c?.current&&e&&c.current[e].current instanceof HTMLElement?c.current[e].current.focus():r.current instanceof HTMLElement&&r.current.focus()})},l=(0,S.jsx)(Ot,{isLoading:t,skeleton:(0,S.jsx)(Lt,{}),children:(0,S.jsx)(S.Fragment,{children:e.map((t,o)=>{const s=e.length>o+1?e[o+1].key:null;return(0,S.jsx)(bo,{lineItem:t,onRemove:i(s),ref:c.current[t.key],tabIndex:-1},t.key)})})});return(0,S.jsxs)("table",{className:(0,s.A)("wc-block-cart-items",o),ref:r,tabIndex:-1,children:[(0,S.jsx)("caption",{className:"screen-reader-text",children:(0,S.jsx)("h2",{children:(0,n.__)("Products in cart","woocommerce")})}),(0,S.jsx)("thead",{children:(0,S.jsxs)("tr",{className:"wc-block-cart-items__header",children:[(0,S.jsx)("th",{scope:"col","aria-hidden":"true",className:"wc-block-cart-items__header-image",children:(0,S.jsx)("span",{children:(0,n.__)("Product","woocommerce")})}),(0,S.jsx)("th",{scope:"col",className:"wc-block-cart-items__header-product",children:(0,S.jsx)("span",{className:"screen-reader-text",children:(0,n.__)("Details","woocommerce")})}),(0,S.jsx)("th",{scope:"col",className:"wc-block-cart-items__header-total",children:(0,S.jsx)("span",{children:(0,n.__)("Total","woocommerce")})})]})}),(0,S.jsx)("tbody",{children:l})]})},xo=({className:e})=>{const{cartItems:t,cartIsLoading:o}=_e();return(0,S.jsx)(yo,{className:e,lineItems:t,isLoading:o})},fo=JSON.parse('{"name":"woocommerce/cart-line-items-block","title":"Cart Line Items","description":"Block containing current line items in Cart.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-items-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(fo,{icon:{src:(0,S.jsx)(nt.A,{icon:_t.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(Bt,{children:(0,S.jsx)(xo,{className:t})})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const vo=JSON.parse('{"name":"woocommerce/cart-cross-sells-block","title":"Cart Cross-Sells","description":"Shows the Cross-Sells block.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false},"parent":["woocommerce/cart-items-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(vo,{icon:{src:(0,S.jsx)(nt.A,{icon:_t.A,className:"wc-block-editor-components-block-icon"})},edit:()=>{const e=(0,r.useBlockProps)({className:"wc-block-cart__cross-sells"}),t=[["core/heading",{content:(0,n.__)("You may be interested in…","woocommerce"),level:2,fontSize:"large"},[]],["woocommerce/cart-cross-sells-products-block",{},[]]];return(0,S.jsx)("div",{...e,children:(0,S.jsx)(r.InnerBlocks,{template:t,templateLock:!1})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})}),transforms:{to:[{type:"block",blocks:["woocommerce/product-collection"],transform:()=>(0,c.createBlock)("woocommerce/product-collection",{...Nt.attributes,displayLayout:{...Nt.attributes.displayLayout,columns:3},query:{...Nt.attributes.query,perPage:3},collection:"woocommerce/product-collection/cross-sells"},(0,c.createBlocksFromInnerBlocksTemplate)(Nt.innerBlocks))}]}});const So=window.wp.components,jo=window.wc.wcBlocksSharedContext,Co=window.wp.styleEngine;function Eo(e={}){const t={};return(0,Co.getCSSRules)(e,{selector:""}).forEach(e=>{t[e.key]=e.value}),t}function Po(e,t){return e&&t?`has-${(0,eo.c)(t)}-${e}`:""}const No=e=>{const t=(e=>{const t=(0,l.isObject)(e)?e:{style:{}};let o=t.style;return(0,l.isString)(o)&&(o=JSON.parse(o)||{}),(0,l.isObject)(o)||(o={}),{...t,style:o}})(e),o=function(e){const{backgroundColor:t,textColor:o,gradient:r,style:c}=e,n=Po("background-color",t),a=Po("color",o),i=function(e){if(e)return`has-${e}-gradient-background`}(r),d=i||c?.color?.gradient;return{className:(0,s.A)(a,i,{[n]:!d&&!!n,"has-text-color":o||c?.color?.text,"has-background":t||c?.color?.background||r||c?.color?.gradient,"has-link-color":(0,l.isObject)(c?.elements?.link)?c?.elements?.link?.color:void 0}),style:Eo({color:c?.color||{}})}}(t),r=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:o}=e,r=t?Po("border-color",t):"";return(0,s.A)({"has-border-color":!!t||!!o?.border?.color,[r]:!!r})}(e),style:Eo({border:t})}}(t),c=function(e){return{className:void 0,style:Eo({spacing:e.style?.spacing||{}})}}(t),n=(e=>{const t=(0,l.isObject)(e.style.typography)?e.style.typography:{},o=(0,l.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:o,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,s.A)(n.className,o.className,r.className,c.className),style:{...n.style,...o.style,...r.style,...c.style}}},Ao=window.wc.wcBlocksSharedHocs;o(94324);const Ro=(0,Ao.withProductDataContext)(e=>{const{className:t,align:o,isDescendentOfSingleProductTemplate:r}=e,c=No(e),{parentClassName:a}=(0,jo.useInnerBlockLayoutContext)(),{product:i}=(0,jo.useProductDataContext)();if(!(i.id&&i.on_sale||r))return null;const l="amount"===e.badgeContent||"percentage"===e.badgeContent;let d=e.saleText||(0,n.__)("Sale","woocommerce");if(l&&"grouped"!==i.type){const t="prices"in i?i.prices:void 0,o=(e=>{const t=Number(e?.regular_price),o=t-Number(e?.price);return t>0&&o>0?{amount:o,percentage:Math.round(o/t*100)}:null})(t);if(o){if("percentage"===e.badgeContent&&0===o.percentage)return null;const s="percentage"===e.badgeContent?(0,n.sprintf)(/* translators: %s: discount percentage. %% is the percent sign. */ /* translators: %s: discount percentage. %% is the percent sign. */ (0,n.__)("%s%%","woocommerce"),o.percentage):(0,Ht.formatPrice)(o.amount,(0,Ht.getCurrencyFromPriceResponse)(t));d="variable"===i.type?(0,n.sprintf)(/* translators: %s: approximate discount for a variable product in the editor. */ /* translators: %s: approximate discount for a variable product in the editor. */ (0,n.__)("Up to %s","woocommerce"),s):`${e.prefix??""}${s}${e.suffix??""}`}}const m="string"==typeof o?`wc-block-components-product-sale-badge--align-${o}`:"";return(0,S.jsx)("div",{className:(0,s.A)("wc-block-components-product-sale-badge",t,m,{[`${a}__product-onsale`]:a},c.className),style:c.style,children:(0,S.jsx)(zt.Label,{label:d,screenReaderLabel:(0,n.sprintf)(/* translators: %s: sale badge text. */ /* translators: %s: sale badge text. */ (0,n.__)("Product on sale: %s","woocommerce"),d)})})});o(66222);let Io=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e.CROPPED="cropped",e}({});const To=e=>{const{aspectRatio:t,height:o,width:s,scale:r}=e;return{height:o,width:s,objectFit:r,aspectRatio:t}},Bo=({padding:e,paddingTop:t,paddingRight:o,paddingBottom:s,paddingLeft:r})=>{const c={};return void 0!==e&&(c.padding=e),void 0!==t&&(c.paddingTop=t),void 0!==o&&(c.paddingRight=o),void 0!==s&&(c.paddingBottom=s),void 0!==r&&(c.paddingLeft=r),c},Mo=e=>{const t=(0,i.getSetting)("placeholderImgSrcFullSize",i.PLACEHOLDER_IMG_SRC);return(0,S.jsx)("img",{...e,src:t,alt:"",width:void 0,height:void 0})},Lo=({image:e,loaded:t,fallbackAlt:o,width:s,scale:r,height:c,aspectRatio:n})=>{const{src:a,srcset:i,sizes:l,alt:d}=e||{},m={alt:d||o,hidden:!t,src:a,srcSet:i,sizes:l},u=To({height:c,width:s,scale:r,aspectRatio:n});return e?(0,S.jsx)("img",{style:u,"data-testid":"product-image",...m}):(0,S.jsx)(Mo,{style:u})},Oo=e=>{const{product:t}=e;return!(0,l.isEmpty)(t)&&(void 0===(o=e.showSaleBadge)||o);var o},Do=e=>{const{aspectRatio:t,children:o,className:r,height:c,imageId:l,imageSizing:d,scale:m,showProductLink:u=!0,style:p,width:h,isAdmin:g,product:_,isResolving:w,...b}=e,k=No(e),{padding:y,paddingTop:x,paddingRight:f,paddingBottom:v,paddingLeft:j,...C}=k.style,E=(0,a.isValidElement)(o)?(0,a.cloneElement)(o,{style:{...o.props.style,...Bo({padding:y,paddingTop:x,paddingRight:f,paddingBottom:v,paddingLeft:j})}}):o,{parentClassName:P}=(0,jo.useInnerBlockLayoutContext)(),{product:N,isLoading:A}=(0,jo.useProductDataContext)({isAdmin:g,product:_,isResolving:w}),{dispatchStoreEvent:R}=Se(),I=((e,t,o,s)=>e&&e.dimensions&&e.dimensions.aspectRatio&&"string"==typeof e.dimensions.aspectRatio?e.dimensions.aspectRatio:t&&"string"==typeof t?t:!s||s!==Io.THUMBNAIL&&s!==Io.CROPPED?void 0:o??void 0)(p,t,(0,i.getSetting)("thumbnailAspectRatio",null),d),T=`wc-block-components-product-image--aspect-ratio-${I?I.replace("/","-"):"auto"}`;if(!N?.id){const e=To({height:c,width:h,scale:m,aspectRatio:I});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:(0,s.A)(r,"wc-block-components-product-image",T,{[`${P}__product-image`]:P},k.className),style:C,children:(0,S.jsx)(Mo,{style:e})}),E]})}const B=((e,t)=>e.images.length?t&&e.images.find(e=>e.id===t)||e.images[0]:null)(N,l);B&&(B.alt=B.alt||(0,oe.decodeEntities)(N.name));const M=u?"a":a.Fragment,L=N?.name? // translators: %s is the product name. // translators: %s is the product name. (0,n.sprintf)((0,n.__)("Link to %s","woocommerce"),N.name):"",O={href:u?N?.permalink:void 0,...u&&{"aria-label":L,onClick:()=>{R("product-view-link",{product:N})}}};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)("div",{className:(0,s.A)(r,"wc-block-components-product-image",T,{[`${P}__product-image`]:P},k.className),style:C,children:[Oo(e)&&(0,S.jsx)(Ro,{align:e.saleBadgeAlign||"right",...b}),(0,S.jsx)(M,{...!g&&u&&O,children:(0,S.jsx)(Lo,{fallbackAlt:(0,oe.decodeEntities)(N.name),image:B,loaded:!A,width:h,height:c,scale:m,aspectRatio:I})})]}),E]})};(0,Ao.withProductDataContext)(Do),o(16833);const Fo=({children:e,headingLevel:t,elementType:o=`h${t}`,...s})=>(0,S.jsx)(o,{...s,children:e}),Vo=e=>{const{className:t,headingLevel:o=2,showProductLink:r=!0,linkTarget:c,align:n}=e,a=No(e),{parentClassName:i}=(0,jo.useInnerBlockLayoutContext)(),{product:l}=(0,jo.useProductDataContext)(),{dispatchStoreEvent:d}=Se();return l.id?(0,S.jsx)(Fo,{headingLevel:o,className:(0,s.A)(t,a.className,"wc-block-components-product-title",{[`${i}__product-title`]:i,[`wc-block-components-product-title--align-${n}`]:n}),style:a.style,children:(0,S.jsx)(Wt,{disabled:!r,name:l.name,permalink:l.permalink,target:c,onClick:()=>{d("product-view-link",{product:l})}})}):(0,S.jsx)(Fo,{headingLevel:o,className:(0,s.A)(t,a.className,"wc-block-components-product-title",{[`${i}__product-title`]:i,[`wc-block-components-product-title--align-${n}`]:n}),style:a.style})},zo=((0,Ao.withProductDataContext)(Vo),e=>({width:e/5*100+"%"})),Ho=({className:e,parentClassName:t})=>{const o=zo(0);return(0,S.jsxs)("div",{className:(0,s.A)(`${e}__norating-container`,`${t}-product-rating__norating-container`),children:[(0,S.jsx)("div",{className:`${e}__norating`,role:"img",children:(0,S.jsx)("span",{style:o})}),(0,S.jsx)("span",{children:(0,n.__)("No Reviews","woocommerce")})]})},$o=e=>{const{className:t,rating:o,reviews:r,parentClassName:c}=e,a=zo(o),i=(0,n.sprintf)(/* translators: %f is referring to the average rating value */ /* translators: %f is referring to the average rating value */ (0,n.__)("Rated %f out of 5","woocommerce"),o),l={__html:(0,n.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,n._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",r,"woocommerce"),(0,n.sprintf)('<strong class="rating">%f</strong>',o),(0,n.sprintf)('<span class="rating">%d</span>',r))};return(0,S.jsx)("div",{className:(0,s.A)(`${t}__stars`,`${c}__product-rating__stars`),role:"img","aria-label":i,children:(0,S.jsx)("span",{style:a,dangerouslySetInnerHTML:l})})},Uo=e=>{const{className:t,reviews:o}=e,s=(0,n.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,n._n)("(%s customer review)","(%s customer reviews)",o,"woocommerce"),o);return(0,S.jsx)("span",{className:`${t}__reviews_count`,children:s})},qo=e=>{const{className:t="wc-block-components-product-rating",showReviewCount:o,showMockedReviews:r,parentClassName:c="",rating:n,reviews:a,styleProps:i,textAlign:l}=e,d=(0,s.A)(i.className,t,{[`${c}__product-rating`]:c,[`has-text-align-${l}`]:l}),m=r&&(0,S.jsx)(Ho,{className:t,parentClassName:c}),u=a?(0,S.jsx)($o,{className:t,rating:n,reviews:a,parentClassName:c}):m,p=a&&o;return(0,S.jsx)("div",{className:d,style:i.style,children:(0,S.jsxs)("div",{className:`${t}__container`,children:[u,p?(0,S.jsx)(Uo,{className:t,reviews:a}):null]})})};o(51248);const Wo=e=>{const{textAlign:t="",shouldDisplayMockedReviewsWhenProductHasNoReviews:o}=e,s=No(e),{parentClassName:r}=(0,jo.useInnerBlockLayoutContext)(),{product:c}=(0,jo.useProductDataContext)(),n=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(c),a=(e=>{if("review_count"in e){const t=(0,l.isNumber)(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0}if("rating_count"in e){const t=(0,l.isNumber)(e.rating_count)?e.rating_count:parseInt(e.rating_count,10);return Number.isFinite(t)&&t>0?t:0}return 0})(c);return(0,S.jsx)(qo,{className:"wc-block-components-product-rating-stars",showMockedReviews:o,styleProps:s,parentClassName:r,reviews:a,rating:n,textAlign:t})},Yo=((0,Ao.withProductDataContext)(Wo),(e,t,o="0")=>{const s=10**t.minorUnit;return Math.round(Number.parseFloat(e??o)*s).toString()}),Go=e=>{const{className:t,textAlign:o,isDescendentOfSingleProductTemplate:r,isAdmin:c,product:n,isExperimentalWcRestApiV4Enabled:a}=e,{parentName:l,parentClassName:d}=(0,jo.useInnerBlockLayoutContext)(),{product:m}=(0,jo.useProductDataContext)(a?{isAdmin:c,product:n}:void 0),u="woocommerce/all-products"===l,p="woocommerce/add-to-cart-with-options-grouped-product-item"===l,h=No(e),{margin:g,marginTop:_,marginRight:w,marginBottom:b,marginLeft:k,...y}=h.style,x={margin:g,marginTop:_,marginRight:w,marginBottom:b,marginLeft:k},f=r&&!p||!m,v=(0,s.A)("wp-block-woocommerce-product-price",t),j=(0,s.A)(h.className,{[`${d}__product-price`]:d});if(!m?.id&&!r){const e=(0,S.jsx)(qt,{align:o,className:j,style:y});return u?(0,S.jsx)("div",{className:v,style:c?void 0:x,children:e}):e}let C=m?.prices??{};const E=f?(0,Ht.getCurrencyFromPriceResponse)():(0,Ht.getCurrencyFromPriceResponse)(C);a&&(C={price:Yo(m?.price,E),...m?.sale_price?{sale_price:Yo(m?.sale_price,E)}:{},...m?.regular_price?{regular_price:Yo(m?.regular_price,E)}:{},currency_minor_unit:i.SITE_CURRENCY.minorUnit,price_range:m?.max_price&&m?.min_price?{min_amount:Yo(m.min_price,E),max_amount:Yo(m.max_price,E)}:null});const P="5000",N=C.price!==C.regular_price,A=(0,s.A)({[`${d}__product-price__value`]:d,[`${d}__product-price__value--on-sale`]:N}),R=(0,S.jsx)(qt,{align:o,className:j,style:y,priceClassName:A,currency:E,price:f?P:C.price,minPrice:C?.price_range?.min_amount,maxPrice:C?.price_range?.max_amount,regularPrice:f?P:C.regular_price,regularPriceClassName:(0,s.A)({[`${d}__product-price__regular`]:d})});return u?(0,S.jsx)("div",{className:v,style:c?void 0:x,children:R}):R},Jo=(e,t)=>{const o=e.find(({id:e})=>e===t);return o?o.quantity:0};o(53337);const Qo="woocommerce/product-type-template-state",Ko="SWITCH_PRODUCT_TYPE",Xo="SET_PRODUCT_TYPES",Zo="REGISTER_LISTENER",es="UNREGISTER_LISTENER",ts=(0,i.getSetting)("productTypes",{}),os=Object.keys(ts).map(e=>({slug:e,label:ts[e]})),ss={productTypes:{list:os,current:os[0]?.slug},listeners:[]},rs={switchProductType:e=>({type:Ko,current:e}),setProductTypes:e=>({type:Xo,productTypes:e}),registerListener:e=>({type:Zo,listener:e}),unregisterListener:e=>({type:es,listener:e})},cs=(0,P.createReduxStore)(Qo,{reducer:(e=ss,t)=>{switch(t.type){case Xo:return{...e,productTypes:{...e.productTypes,list:t.productTypes||[]}};case Ko:return{...e,productTypes:{...e.productTypes,current:t.current}};case Zo:return{...e,listeners:[...e.listeners,t.listener||""]};case es:return{...e,listeners:e.listeners.filter(e=>e!==t.listener)};default:return e}},actions:rs,selectors:{getProductTypes:e=>e.productTypes.list,getCurrentProductType:e=>e.productTypes.list.find(t=>t.slug===e.productTypes.current),getRegisteredListeners:e=>e.listeners}});(0,P.select)(Qo)||(0,P.register)(cs);const ns=({product:e,isDescendantOfAddToCartWithOptions:t,collection:o})=>{const r="woocommerce/product-collection/cart-contents"===o,c="external"===e.type,a=c?e.button_text:e.add_to_cart?.single_text;let i;return i=r?(0,n.__)("Finish checkout","woocommerce"):t?a:e.add_to_cart?.text,(0,S.jsx)("button",{disabled:!1,className:(0,s.A)("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button"),style:{},children:c?e.button_text:i||(0,n.__)("Add to cart","woocommerce")})},as=({product:e,isDescendantOfAddToCartWithOptions:t,className:o,style:r,collection:c,noticeContext:l})=>{const{id:d,permalink:m,add_to_cart:u,has_options:p,is_purchasable:h,is_in_stock:_}=e,{dispatchStoreEvent:w}=Se(),{cartQuantity:b,addingToCart:k,addToCart:y}=((e,t="wc/all-products")=>{const{addItemToCart:o}=(0,P.useDispatch)(B.cartStore),{cartItems:s,cartIsLoading:r}=_e(),{createErrorNotice:c,removeNotice:n}=(0,P.useDispatch)("core/notices"),[i,l]=(0,a.useState)(!1),d=(0,a.useRef)(Jo(s,e));return(0,a.useEffect)(()=>{const t=Jo(s,e);t!==d.current&&(d.current=t)},[s,e]),{cartQuantity:Number.isFinite(d.current)?d.current:0,addingToCart:i,cartIsLoading:r,addToCart:(s=1)=>(l(!0),o(e,s).then(()=>{n("add-to-cart",t)}).catch(e=>{c((0,oe.decodeEntities)(e.message),{id:"add-to-cart",context:t,isDismissible:!0})}).finally(()=>{l(!1)}))}})(d,l),x=Number.isFinite(b)&&b>0,f="woocommerce/product-collection/cart-contents"===c,v=!p&&h&&_,j=(0,oe.decodeEntities)(u?.description||""),C=f?(0,n.__)("Finish checkout","woocommerce"):(({cartQuantity:e,productCartDetails:t,isDescendantOfAddToCartWithOptions:o})=>Number.isFinite(e)&&e>0?(0,n.sprintf)(/* translators: %s number of products in cart. */ /* translators: %s number of products in cart. */ (0,n._n)("%d in cart","%d in cart",e,"woocommerce"),e):o&&t?.single_text?t?.single_text:t?.text||(0,n.__)("Add to cart","woocommerce"))({cartQuantity:b,productCartDetails:u,isDescendantOfAddToCartWithOptions:t}),E=v&&!f?"button":"a",N={};return f?(N.href=g,N.rel="nofollow",N.onClick=()=>{w("cart-view-link",{product:e})}):v?N.onClick=async()=>{await y(),w("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=(0,i.getSetting)("productsSettings");t&&(window.location.href=g)}:(N.href=m,N.onClick=()=>{w("product-view-link",{product:e})}),(0,S.jsx)(E,{...N,"aria-label":j,disabled:k,className:(0,s.A)(o,"wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{loading:k,added:x}),style:r,children:C})},is=({className:e,style:t})=>(0,S.jsx)("button",{className:(0,s.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,children:(0,n.__)("Add to cart","woocommerce")}),ls=({className:e,style:t,blockClientId:o,collection:r})=>{const{current:c,registerListener:i,unregisterListener:l}=function(){const{productTypes:e,current:t,registeredListeners:o}=(0,P.useSelect)(e=>{const{getProductTypes:t,getCurrentProductType:o,getRegisteredListeners:s}=e(cs);return{productTypes:t(),current:o(),registeredListeners:s()}},[]),{switchProductType:s,registerListener:r,unregisterListener:c}=(0,P.useDispatch)(cs);return{productTypes:e,current:t,set:s,registeredListeners:o,registerListener:r,unregisterListener:c}}();let d;return(0,a.useEffect)(()=>{if(o)return i(o),()=>{l(o)}},[o,i,l]),d="woocommerce/product-collection/cart-contents"===r?(0,n.__)("Finish checkout","woocommerce"):"external"===c?.slug?(0,n.__)("Buy product","woocommerce"):(0,n.__)("Add to cart","woocommerce"),(0,S.jsx)("button",{className:(0,s.A)("wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",e),style:t,disabled:!0,children:d})},ds=e=>{const{className:t,textAlign:o,blockClientId:r,collection:c}=e,n=No(e),{margin:a,marginTop:l,marginRight:d,marginBottom:m,marginLeft:u,...p}=n.style,h={margin:a,marginTop:l,marginRight:d,marginBottom:m,marginLeft:u},{parentClassName:g}=(0,jo.useInnerBlockLayoutContext)(),{product:_,isLoading:w}=(0,jo.useProductDataContext)({product:e.product,isAdmin:e.isAdmin}),b=_?.id&&e.isAdmin&&(0,i.getSetting)("experimentalWcRestApiV4",!1);return(0,S.jsx)("div",{className:(0,s.A)(t,"wp-block-button","wc-block-components-product-button",{[`${g}__product-add-to-cart`]:g,[`align-${o}`]:o}),style:e.isAdmin?void 0:h,children:w?(0,S.jsx)(is,{className:n.className,style:p}):(0,S.jsxs)(S.Fragment,{children:[b&&(0,S.jsx)(ns,{product:_,isDescendantOfAddToCartWithOptions:e["woocommerce/isDescendantOfAddToCartWithOptions"],collection:c}),!b&&(_&&_?.id?(0,S.jsx)(as,{product:_,style:p,className:n.className,isAdmin:e.isAdmin,isDescendantOfAddToCartWithOptions:e["woocommerce/isDescendantOfAddToCartWithOptions"],productEntity:e.product,collection:c,noticeContext:e.noticeContext}):(0,S.jsx)(ls,{style:p,className:n.className,isLoading:w??!1,blockClientId:r,collection:c}))]})})},ms=((0,Ao.withProductDataContext)(ds),({product:e})=>(0,S.jsx)("div",{className:"cross-sells-product",children:(0,S.jsx)(jo.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product",children:(0,S.jsxs)(jo.ProductDataContextProvider,{isLoading:!1,product:e,children:[(0,S.jsxs)("div",{children:[(0,S.jsx)(Do,{className:"",showSaleBadge:!0,productId:e.id,showProductLink:!0,saleBadgeAlign:"left",imageSizing:Io.SINGLE,scale:"cover",aspectRatio:"1:1"}),(0,S.jsx)(Vo,{align:"",headingLevel:3,showProductLink:!0}),(0,S.jsx)(Wo,{productId:e.id,postId:0,shouldDisplayMockedReviewsWhenProductHasNoReviews:!1}),(0,S.jsx)(Go,{})]}),(0,S.jsx)(ds,{noticeContext:X.CART})]})})})),us=({products:e,columns:t})=>{const o=e.map((e,o)=>o>=t?null:(0,S.jsx)(ms,{isLoading:!1,product:e},e.id));return(0,S.jsx)("div",{children:o})},ps=JSON.parse('{"name":"woocommerce/cart-cross-sells-products-block","title":"Cart Cross-Sells Products","description":"Shows the Cross-Sells products.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false,"email":true},"attributes":{"columns":{"type":"number","default":3},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-cross-sells-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}'),hs=({className:e,columns:t})=>{const{crossSellsProducts:o}=_e();return void 0===t&&(t=ps.attributes.columns.default),(0,S.jsx)(us,{className:e,columns:t,products:o})};o(70535),o(74747),(0,c.registerBlockType)(ps,{icon:{src:(0,S.jsx)(nt.A,{icon:_t.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{className:o,columns:s}=e,c=(0,r.useBlockProps)();return(0,S.jsxs)("div",{...c,children:[(0,S.jsx)(r.InspectorControls,{children:(0,S.jsx)(So.PanelBody,{title:(0,n.__)("Settings","woocommerce"),children:(0,S.jsx)(So.RangeControl,{__next40pxDefaultSize:!0,__nextHasNoMarginBottom:!0,label:(0,n.__)("Cross-Sells products to show","woocommerce"),value:s,onChange:e=>t({columns:e}),min:(0,i.getSetting)("minColumns",1),max:(0,i.getSetting)("maxColumns",6)})})}),(0,S.jsx)(Bt,{children:(0,S.jsx)(hs,{columns:s,className:o})})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const gs=(0,a.forwardRef)(({children:e,className:t=""},o)=>(0,S.jsx)("div",{ref:o,className:(0,s.A)("wc-block-components-sidebar",t),children:e}));o(65675);const _s=JSON.parse('{"name":"woocommerce/cart-totals-block","title":"Cart Totals","description":"Column containing the cart totals.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"checkbox":{"type":"boolean","default":false},"text":{"type":"string","required":false},"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(_s,{icon:{src:(0,S.jsx)(nt.A,{icon:_t.A,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)({className:"wc-block-cart__sidebar"}),o=ut(ot.innerBlockAreas.CART_TOTALS),s=[["woocommerce/cart-order-summary-block",{},[]],["woocommerce/cart-express-payment-block",{},[]],["woocommerce/proceed-to-checkout-block",{},[]],["woocommerce/cart-accepted-payment-methods-block",{},[]]];return pt({clientId:e,registeredBlocks:o,defaultTemplate:s}),(0,S.jsx)(gs,{...t,children:(0,S.jsx)(r.InnerBlocks,{allowedBlocks:o,template:s,templateLock:!1,renderAppender:r.InnerBlocks.ButtonBlockAppender})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})})});const ws=(e=!1)=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o,availablePaymentMethods:s,availableExpressPaymentMethods:r}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}}),c=Object.values(s).map(({name:e})=>e),n=Object.values(r).map(({name:e})=>e),a=(0,Me.getPaymentMethods)(),i=(0,Me.getExpressPaymentMethods)(),l=Object.keys(a).reduce((e,t)=>(c.includes(t)&&(e[t]=a[t]),e),{}),d=Object.keys(i).reduce((e,t)=>(n.includes(t)&&(e[t]=i[t]),e),{}),m=He(l),u=He(d);return{paymentMethods:e?u:m,isInitialized:e?o:t}},bs=()=>ws(!0);var ks=o(96900);const ys={warning:"#F0B849",error:"#CC1818",success:"#46B450",info:"#0073AA"},xs=({status:e="warning",...t})=>(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t,children:[(0,S.jsx)("path",{d:"M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z",stroke:ys[e],strokeWidth:"1.5"}),(0,S.jsx)("path",{d:"M13 7H11V13H13V7Z",fill:ys[e]}),(0,S.jsx)("path",{d:"M13 15H11V17H13V15Z",fill:ys[e]})]});o(84459);const fs=({href:e,title:t,description:o,warning:s})=>(0,S.jsxs)("a",{href:e,className:"wc-block-editor-components-external-link-card",target:"_blank",rel:"noreferrer",children:[(0,S.jsxs)("span",{className:"wc-block-editor-components-external-link-card__content",children:[(0,S.jsx)("strong",{className:"wc-block-editor-components-external-link-card__title",children:t}),o&&(0,S.jsx)("span",{className:"wc-block-editor-components-external-link-card__description",dangerouslySetInnerHTML:{__html:(0,to.sanitizeHTML)(o)}}),s?(0,S.jsxs)("span",{className:"wc-block-editor-components-external-link-card__warning",children:[(0,S.jsx)(nt.A,{icon:(0,S.jsx)(xs,{status:"error"})}),(0,S.jsx)("span",{children:s})]}):null]}),(0,S.jsx)(So.VisuallyHidden,{as:"span",children:/* translators: accessibility text */ /* translators: accessibility text */ (0,n.__)("(opens in a new tab)","woocommerce")}),(0,S.jsx)(nt.A,{icon:ks.A,className:"wc-block-editor-components-external-link-card__icon"})]}),vs=["height","borderRadius"],Ss=e=>{const t=(0,P.select)(B.paymentStore).getAvailableExpressPaymentMethods();return Object.values(t).reduce((t,o)=>t||o?.supportsStyle.some(t=>e.includes(t)),!1)},js=({attributes:e,setAttributes:t})=>{const{buttonHeight:o,buttonBorderRadius:s}=e;return(0,S.jsxs)(S.Fragment,{children:[Ss(["height"])&&(0,S.jsx)(So.RadioControl,{label:(0,n.__)("Button height","woocommerce"),selected:o,options:[{label:(0,n.__)("Small (40px)","woocommerce"),value:"40"},{label:(0,n.__)("Medium (48px)","woocommerce"),value:"48"},{label:(0,n.__)("Large (55px)","woocommerce"),value:"55"}],onChange:e=>t({buttonHeight:e})}),Ss(["borderRadius"])&&(0,S.jsx)("div",{className:"border-radius-control-container",children:(0,S.jsx)(r.HeightControl,{label:(0,n.__)("Button border radius","woocommerce"),value:s,onChange:e=>{const o=e.replace("px","");t({buttonBorderRadius:o})}})})]})},Cs=({attributes:e,setAttributes:t})=>e.showButtonStyles?(0,S.jsx)(js,{attributes:e,setAttributes:t}):null,Es=()=>{const e=(0,P.select)(B.paymentStore).getAvailableExpressPaymentMethods();return Object.entries(e).length<1?(0,S.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,n.__)("You currently have no express payment integrations active.","woocommerce")}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,n.__)("You currently have the following express payment integrations active.","woocommerce")}),Object.values(e).map(e=>(0,S.jsx)(fs,{href:`${i.ADMIN_URL}admin.php?page=wc-settings&tab=checkout§ion=${encodeURIComponent(e.gatewayId)}`,title:e.title,description:e.description},e.name))]})},Ps=(0,S.jsxs)(S.Fragment,{children:[(0,n.__)("Apply uniform styles","woocommerce")," ",(0,S.jsx)("span",{className:"express-payment-styles-beta-badge",children:"Beta"})]}),Ns=({attributes:e,setAttributes:t})=>(0,S.jsxs)(r.InspectorControls,{children:[Ss(vs)&&(0,S.jsxs)(So.PanelBody,{title:(0,n.__)("Button Settings","woocommerce"),className:"express-payment-button-settings",children:[(0,S.jsx)(So.ToggleControl,{__nextHasNoMarginBottom:!0,label:Ps,checked:e.showButtonStyles,onChange:()=>t({showButtonStyles:!e.showButtonStyles}),help:(0,n.__)("Sets a consistent style for express payment buttons.","woocommerce")}),(0,S.jsxs)(So.Notice,{status:"warning",isDismissible:!1,className:"wc-block-checkout__notice express-payment-styles-notice",children:[(0,S.jsxs)("strong",{children:[(0,n.__)("Note","woocommerce"),":"]})," ",(0,n.__)("Some payment methods might not yet support all style controls","woocommerce")]}),(0,S.jsx)(Cs,{attributes:e,setAttributes:t})]}),(0,S.jsx)(So.PanelBody,{title:(0,n.__)("Express Payment Methods","woocommerce"),children:(0,S.jsx)(Es,{})})]}),As=(0,S.jsx)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,S.jsxs)("g",{fill:"none",fillRule:"evenodd",children:[(0,S.jsx)("path",{d:"M0 0h24v24H0z"}),(0,S.jsx)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),(0,S.jsx)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"})]})});var Rs=o(13197),Is=o(1951),Ts=o(98041);o(29287);const Bs={bank:Rs.A,bill:Is.A,card:Ts.A,checkPayment:As},Ms=({icon:e="",text:t=""})=>{const o=!!e,r=(0,a.useCallback)(e=>o&&(0,l.isString)(e)&&(0,l.objectHasProp)(Bs,e),[o]),c=(0,s.A)("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return(0,S.jsxs)("span",{className:c,children:[r(e)?(0,S.jsx)(nt.A,{icon:Bs[e]}):e,t]})},Ls=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,Os=({id:e,src:t=null,alt:o=""})=>t?(0,S.jsx)("img",{className:Ls(e),src:t,alt:o}):null,Ds=[{id:"alipay",alt:"Alipay",src:m+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:m+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:m+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:m+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:m+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:m+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:m+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:m+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:m+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:m+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:m+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:m+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:m+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:m+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:m+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:m+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:m+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:m+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:m+"payment-methods/wechat.svg"}];o(86983);const Fs=({icons:e=[],align:t="center",className:o})=>{const r=(e=>{const t={};return e.forEach(e=>{let o={};"string"==typeof e&&(o={id:e,alt:e,src:null}),"object"==typeof e&&(o={id:e.id||"",alt:e.alt||"",src:e.src||null}),o.id&&(0,l.isString)(o.id)&&!t[o.id]&&(t[o.id]=o)}),Object.values(t)})(e);if(0===r.length)return null;const c=(0,s.A)("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===t,"wc-block-components-payment-method-icons--align-right":"right"===t},o);return(0,S.jsx)("div",{className:c,children:r.map(e=>{const t={...e,...(o=e.id,Ds.find(e=>e.id===o)||{})};var o;return(0,S.jsx)(Os,{...t},"payment-method-icon-"+e.id)})})};o(99961);const Vs=({children:e,className:t,screenReaderLabel:o,showSpinner:r=!1,isLoading:c=!0})=>(0,S.jsxs)("div",{className:(0,s.A)(t,{"wc-block-components-loading-mask":c}),children:[c&&r&&(0,S.jsx)(zt.Spinner,{}),(0,S.jsx)("div",{className:(0,s.A)({"wc-block-components-loading-mask__children":c}),"aria-hidden":c,children:e}),c&&(0,S.jsx)("span",{className:"screen-reader-text",children:o||(0,n.__)("Loading…","woocommerce")})]}),zs=(e="")=>{const{cartCoupons:t,cartIsLoading:o}=_e(),{applyCoupon:s,removeCoupon:r}=(0,P.useDispatch)(B.cartStore),{isApplyingCoupon:c,isRemovingCoupon:i,orderId:l}=(0,P.useSelect)(e=>({isApplyingCoupon:e(B.cartStore).isApplyingCoupon(),isRemovingCoupon:e(B.cartStore).isRemovingCoupon(),orderId:e(B.checkoutStore).getOrderId()}),[]),d=(0,a.useCallback)(e=>l&&l>0&&e?.data?.details?.checkout?e.data.details.checkout:e?.data?.details?.cart?e.data.details.cart:e.message,[l]);return{appliedCoupons:t,isLoading:o,applyCoupon:(0,a.useCallback)(t=>s(t).then(()=>((0,ot.applyCheckoutFilter)({filterName:"showApplyCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&(0,P.dispatch)("core/notices").createNotice("info",(0,n.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */ (0,n.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0))).catch(e=>{const t=d(e);return(0,P.dispatch)(B.validationStore).setValidationErrors({coupon:{message:(0,oe.decodeEntities)(t),hidden:!1}}),Promise.resolve(!1)}),[s,d,e]),removeCoupon:(0,a.useCallback)(t=>r(t).then(()=>((0,ot.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&(0,P.dispatch)("core/notices").createNotice("info",(0,n.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */ (0,n.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),(0,oe.decodeEntities)(t)),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0))).catch(t=>((0,P.dispatch)("core/notices").createErrorNotice(t.message,{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!1))),[r,e]),isApplyingCoupon:c,isRemovingCoupon:i}},Hs=(e,t)=>{const o=[],s=(t,o)=>{const s=o+"_tax",r=(0,l.objectHasProp)(e,o)&&(0,l.isString)(e[o])?parseInt(e[o],10):0;return{key:o,label:t,value:r,valueWithTax:r+((0,l.objectHasProp)(e,s)&&(0,l.isString)(e[s])?parseInt(e[s],10):0)}};return o.push(s((0,n.__)("Subtotal:","woocommerce"),"total_items")),o.push(s((0,n.__)("Fees:","woocommerce"),"total_fees")),o.push(s((0,n.__)("Discount:","woocommerce"),"total_discount")),o.push({key:"total_tax",label:(0,n.__)("Taxes:","woocommerce"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&o.push(s((0,n.__)("Shipping:","woocommerce"),"total_shipping")),o};class $s extends a.Component{state={errorMessage:"",hasError:!1};static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:o}=this.props;if(e){let e=(0,n.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woocommerce");(o||i.CURRENT_USER_IS_ADMIN)&&(e=t||(0,n.__)("There was an error with this payment method. Please verify it's configured correctly.","woocommerce"));const s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return(0,S.jsx)(zt.StoreNoticesContainer,{additionalNotices:s,context:X.PAYMENTS})}return this.props.children}}const Us=$s,qs=(0,a.createContext)({showButtonStyles:!1,buttonHeight:"48",buttonBorderRadius:"4"}),Ws=()=>{const{isEditor:e}=R(),{showButtonStyles:t,buttonHeight:o,buttonBorderRadius:r}=(0,a.useContext)(qs),c=t?{height:o,borderRadius:r}:void 0,{activePaymentMethod:d,paymentMethodData:m}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}}),{__internalSetActivePaymentMethod:u,__internalSetExpressPaymentStarted:p,__internalSetPaymentIdle:h,__internalSetPaymentError:g,__internalSetPaymentMethodData:_,__internalSetExpressPaymentError:w}=(0,P.useDispatch)(B.paymentStore),{paymentMethods:b}=bs(),k=(()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:o,onCheckoutAfterProcessingWithError:s,onSubmit:r}=(0,a.useContext)(Le),{onCheckoutValidation:c,onCheckoutSuccess:d,onCheckoutFail:m}=Be.checkoutEvents,{isCalculating:u,isComplete:p,isIdle:h,isProcessing:g,customerId:_}=(0,P.useSelect)(e=>{const t=e(B.checkoutStore);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}},[]),{paymentIsIdle:w,paymentIsStarted:b,paymentIsProcessing:k,paymentHasError:y,paymentIsReady:x,paymentIsDoingExpressPayment:f,activePaymentMethod:v,shouldSavePayment:S}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{paymentIsIdle:t.isPaymentIdle(),paymentIsStarted:t.isExpressPaymentStarted(),paymentIsProcessing:t.isPaymentProcessing(),paymentHasError:t.hasPaymentError(),paymentIsReady:t.isPaymentReady(),paymentIsDoingExpressPayment:t.isExpressPaymentMethodActive(),activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}},[]),j={isIdle:w,isStarted:b,isProcessing:k,hasError:y,isReady:x,isDoingExpressPayment:f,get isPristine(){return L()("isPristine",{since:"7.5.0",alternative:"isIdle",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),w},get isFinished(){return L()("isFinished",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),y||x},get hasFailed(){return L()("hasFailed",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),y},get isSuccessful(){return L()("isSuccessful",{since:"7.5.0",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),x}},{__internalSetExpressPaymentError:C}=(0,P.useDispatch)(B.paymentStore),{onPaymentProcessing:E,onPaymentSetup:N}=(0,a.useContext)(z),{shippingErrorStatus:A,shippingErrorTypes:R,onShippingRateSuccess:I,onShippingRateFail:T,onShippingRateSelectSuccess:M,onShippingRateSelectFail:O}=Ae(),{shippingRates:D,isLoadingRates:F,selectedRates:V,isSelectingRate:H,selectShippingRate:$,needsShipping:U}=je(),{billingAddress:q,shippingAddress:W}=(0,P.useSelect)(e=>e(B.cartStore).getCustomerData(),[]),{setShippingAddress:Y}=(0,P.useDispatch)(B.cartStore),{cartItems:G,cartFees:J,cartTotals:Q,extensions:K}=_e(),{appliedCoupons:Z}=zs(),ee=(0,a.useRef)(Hs(Q,U)),te=(0,a.useRef)({label:(0,n.__)("Total","woocommerce"),value:parseInt(Q.total_price,10)});(0,a.useEffect)(()=>{ee.current=Hs(Q,U),te.current={label:(0,n.__)("Total","woocommerce"),value:parseInt(Q.total_price,10)}},[Q,U]);const oe=(0,a.useCallback)((e="")=>{L()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),C(e)},[C]);return{activePaymentMethod:v,billing:{appliedCoupons:Z,billingAddress:q,billingData:q,cartTotal:te.current,cartTotalItems:ee.current,currency:(0,Ht.getCurrencyFromPriceResponse)(Q),customerId:_,displayPricesIncludingTax:(0,i.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:G,cartFees:J,extensions:K},checkoutStatus:{isCalculating:u,isComplete:p,isIdle:h,isProcessing:g},components:{LoadingMask:Vs,PaymentMethodIcons:Fs,PaymentMethodLabel:Ms,Skeleton:Mt,ValidationInputError:zt.ValidationInputError},emitResponse:{noticeContexts:X,responseTypes:l.responseTypes},eventRegistration:{onCheckoutAfterProcessingWithError:s,onCheckoutAfterProcessingWithSuccess:o,onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutSuccess:d,onCheckoutFail:m,onCheckoutValidation:c,onPaymentProcessing:E,onPaymentSetup:N,onShippingRateFail:T,onShippingRateSelectFail:O,onShippingRateSelectSuccess:M,onShippingRateSuccess:I},onSubmit:r,paymentStatus:j,setExpressPaymentError:oe,shippingData:{isSelectingRate:H,needsShipping:U,selectedRates:V,setSelectedRates:$,setShippingAddress:Y,shippingAddress:W,shippingRates:D,shippingRatesLoading:F},shippingStatus:{shippingErrorStatus:A,shippingErrorTypes:R},shouldSavePayment:S}})(),y=(0,a.useRef)(d),x=(0,a.useRef)(m),f=Object.entries(b),{expressPaymentWrapperRef:v,focusedExpressPaymentMethod:j}=(e=>{const t=(0,a.useRef)(null),o=(0,a.useRef)(null),[s,r]=(0,a.useState)(null),c=(0,a.useCallback)(()=>{o.current&&(clearInterval(o.current),o.current=null)},[]),n=(0,a.useCallback)(()=>{const e=t.current,o=e?.ownerDocument.activeElement;if(!(e&&o instanceof Element))return{focusedPaymentMethod:null,isExpressPaymentIframe:!1};const s=o.closest('[id^="express-payment-method-"]'),r=o instanceof HTMLIFrameElement&&e.contains(o);return s&&e.contains(s)?{focusedPaymentMethod:s.id.replace("express-payment-method-",""),isExpressPaymentIframe:r}:{focusedPaymentMethod:null,isExpressPaymentIframe:!1}},[]),i=(0,a.useCallback)(()=>{const{focusedPaymentMethod:e,isExpressPaymentIframe:t}=n();r(e),t?o.current||(o.current=setInterval(()=>{const{focusedPaymentMethod:e,isExpressPaymentIframe:t}=n();r(e),t||c()},100)):c()},[n,c]);return(0,a.useEffect)(()=>{if(!e)return r(null),void c();const o=t.current;if(!o)return;const s=o.ownerDocument,n=s.defaultView,a=()=>{setTimeout(i,0)};return s.addEventListener("focusin",i),s.addEventListener("focusout",a),n?.addEventListener("blur",i),n?.addEventListener("focus",a),()=>{c(),s.removeEventListener("focusin",i),s.removeEventListener("focusout",a),n?.removeEventListener("blur",i),n?.removeEventListener("focus",a)}},[e,c,i]),{expressPaymentWrapperRef:t,focusedExpressPaymentMethod:s}})(!e&&f.length>0),C=(0,a.useCallback)(e=>()=>{y.current=d,x.current=m,p(),u(e)},[d,m,u,p]),E=(0,a.useCallback)(()=>{h(),u(y.current,x.current)},[u,h]),N=(0,a.useCallback)(e=>{g(),_(e),w(e),u(y.current,x.current)},[u,g,_,w]),A=(0,a.useCallback)((e="")=>{L()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?N(e):w("")},[w,N]),I=f.length>1?"ul":"div",T=f.length>1?"li":"div",M=f.length>0?f.map(([t,o])=>{const r=e?o.edit:o.content;return(0,a.isValidElement)(r)?(0,S.jsx)(T,{id:`express-payment-method-${t}`,className:(0,s.A)({"wc-block-components-express-payment__event-button--focused":j===t}),children:(0,a.cloneElement)(r,{...k,onClick:C(t),onClose:E,onError:N,setExpressPaymentError:A,buttonAttributes:c})},t):null}):(0,S.jsx)("div",{children:(0,n.__)("No registered Payment Methods","woocommerce")},"noneRegistered");return(0,S.jsx)(Us,{isEditor:e,children:(0,S.jsx)(I,{className:"wc-block-components-express-payment__event-buttons",ref:v,children:M})})};o(42831);const Ys=()=>{const{availableExpressPaymentMethods:e={},expressPaymentMethodsInitialized:t,isExpressPaymentMethodActive:o,registeredExpressPaymentMethods:r={}}=(0,P.useSelect)(e=>{const t=e(B.paymentStore);return{availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),registeredExpressPaymentMethods:t.getRegisteredExpressPaymentMethods()}},[]),{hasPendingItemsOperations:c}=_e(),{hasRegisteredExpressPaymentMethods:a,hasRegisteredNotInitializedExpressPaymentMethods:i,hasNoValidRegisteredExpressPaymentMethods:l,availableExpressPaymentsCount:d}=(({availableExpressPaymentMethods:e={},expressPaymentMethodsInitialized:t=!1,registeredExpressPaymentMethods:o={}})=>{const s=Object.keys(o||{}),r=Object.keys(e||{}),c=s.length,n=r.length,a=c>0;return{hasRegisteredExpressPaymentMethods:a,hasRegisteredNotInitializedExpressPaymentMethods:!t&&a,hasNoValidRegisteredExpressPaymentMethods:t&&a&&!n,availableExpressPaymentsCount:n||2}})({availableExpressPaymentMethods:e,expressPaymentMethodsInitialized:t,registeredExpressPaymentMethods:r}),m=!o&&(c||i);if(!a||l)return null;const u=d>1?"ul":"div",p=d>1?"li":"div";return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("div",{className:(0,s.A)("wc-block-components-express-payment","wc-block-components-express-payment--cart",{"wc-block-components-express-payment--disabled":o}),"aria-disabled":o,"aria-live":"polite",...o&&{"aria-busy":!0,"aria-label":(0,n.__)("Processing express checkout","woocommerce")},children:(0,S.jsxs)("div",{className:"wc-block-components-express-payment__content",children:[(0,S.jsx)(zt.StoreNoticesContainer,{context:X.EXPRESS_PAYMENTS}),m?(0,S.jsx)(u,{className:"wc-block-components-express-payment__event-buttons",children:Array.from({length:d}).map((e,t)=>(0,S.jsx)(p,{children:(0,S.jsx)(Mt,{height:"48px",ariaMessage:(0,n.__)("Loading express payment method…","woocommerce")})},t))}):(0,S.jsx)(Ws,{})]})}),(0,S.jsx)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart",children:(0,n.__)("Or","woocommerce")})]})},Gs=({className:e})=>{const{cartNeedsPayment:t}=_e();return t?(0,S.jsx)("div",{className:(0,s.A)("wc-block-cart__payment-options",e),children:(0,S.jsx)(Ys,{})}):null};o(17467);const Js=(0,S.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24",children:[(0,S.jsx)("path",{stroke:"#1E1E1E",strokeLinejoin:"round",strokeWidth:"1.5",d:"M18.25 12a6.25 6.25 0 1 1-12.5 0 6.25 6.25 0 0 1 12.5 0Z"}),(0,S.jsx)("path",{fill:"#1E1E1E",d:"M10 3h4v3h-4z"}),(0,S.jsx)("rect",{width:"1.5",height:"5",x:"11.25",y:"8",fill:"#1E1E1E",rx:".75"}),(0,S.jsx)("path",{fill:"#1E1E1E",d:"m15.7 4.816 1.66 1.078-1.114 1.718-1.661-1.078z"})]}),Qs=JSON.parse('{"name":"woocommerce/cart-express-payment-block","title":"Express Checkout","description":"Allow customers to breeze through with quick payment options.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"showButtonStyles":{"type":"boolean","default":false},"buttonHeight":{"type":"string","default":"48"},"buttonBorderRadius":{"type":"string","default":"4"},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Qs,{icon:{src:(0,S.jsx)(nt.A,{style:{fill:"none"},icon:Js,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{paymentMethods:o,isInitialized:c}=bs(),n=Object.keys(o).length>0,a=(0,r.useBlockProps)({className:(0,s.A)({"wp-block-woocommerce-cart-express-payment-block--has-express-payment-methods":n})}),{className:i,showButtonStyles:l,buttonHeight:d,buttonBorderRadius:m}=e;return c&&n?(0,S.jsxs)("div",{...a,children:[(0,S.jsx)(Ns,{attributes:e,setAttributes:t}),(0,S.jsx)(qs.Provider,{value:{showButtonStyles:l,buttonHeight:d,buttonBorderRadius:m},children:(0,S.jsx)(Gs,{className:i})})]}):null},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});var Ks=o(11003);const Xs=(0,n.__)("Proceed to Checkout","woocommerce"),Zs={checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}},buttonLabel:{type:"string",default:Xs}};var er=o(16874);o(46882);const tr=(0,a.forwardRef)((e,t)=>{const{className:o,children:r,variant:c="contained",removeTextWrap:n=!1,...a}=e,i=(0,s.A)("wc-block-components-button","wp-element-button",o,c);if("href"in e)return(0,S.jsx)(er.$,{render:(0,S.jsx)("a",{ref:t,href:e.href,children:(0,S.jsx)("div",{className:"wc-block-components-button__text",children:r})}),className:i,...a});const l=n?e.children:(0,S.jsx)("div",{className:"wc-block-components-button__text",children:e.children});return(0,S.jsx)(er.$,{ref:t,className:i,...a,children:l})}),or=({onChange:e,placeholder:t,value:o,children:s,...c})=>(0,S.jsxs)(tr,{...c,children:[(0,S.jsx)(r.RichText,{multiline:!1,allowedFormats:[],value:o,placeholder:t,onChange:e}),s]}),sr=(e,t)=>{if(!e.title.raw)return e.slug;const o=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(o?"":` - ${e.slug}`)},rr=({setPageId:e,pageId:t,labels:o})=>{const s=(0,P.useSelect)(e=>e("core").getEntityRecords("postType","page",{status:"publish",orderby:"title",order:"asc",per_page:100}),[])||null;return s?(0,S.jsx)(So.__experimentalToolsPanel,{label:o.title,resetAll:()=>e(0),children:(0,S.jsx)(So.__experimentalToolsPanelItem,{label:(0,n.__)("Link to","woocommerce"),hasValue:()=>"number"==typeof t&&0!==t,onDeselect:()=>e(0),isShownByDefault:!0,children:(0,S.jsx)(So.SelectControl,{label:(0,n.__)("Link to","woocommerce"),value:t,options:[{label:o.default,value:0},...s.map(e=>({label:sr(e,s),value:parseInt(e.id,10)}))],onChange:t=>e(parseInt(t,10))})})}):null};o(2766);const cr=JSON.parse('{"name":"woocommerce/proceed-to-checkout-block","title":"Proceed to Checkout","description":"Allow customers proceed to Checkout.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(cr,{icon:{src:(0,S.jsx)(nt.A,{icon:Ks.A,className:"wc-block-editor-components-block-icon"})},attributes:Zs,edit:({attributes:e,setAttributes:t})=>{const o=(0,r.useBlockProps)(),{checkoutPageId:s=0,buttonLabel:c}=e,{current:i}=(0,a.useRef)(s),l=(0,P.useSelect)(e=>i||e("core/editor").getCurrentPostId(),[i]);return(0,S.jsxs)("div",{...o,children:[(0,S.jsx)(r.InspectorControls,{children:!(l===h&&0===i)&&(0,S.jsx)(rr,{pageId:s,setPageId:e=>t({checkoutPageId:e}),labels:{title:(0,n.__)("Proceed to Checkout button","woocommerce"),default:(0,n.__)("WooCommerce Checkout Page","woocommerce")}})}),(0,S.jsx)(or,{className:"wc-block-cart__submit-button",value:c,placeholder:Xs,onChange:e=>{t({buttonLabel:e})}})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const nr=(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,S.jsx)("path",{d:"M22.7 22.7l-20-20L2 2l-.7-.7L0 2.5 4.4 7l2.2 4.7L5.2 14A2 2 0 007 17h7.5l1.3 1.4a2 2 0 102.8 2.8l2.9 2.8 1.2-1.3zM7.4 15a.2.2 0 01-.2-.3l.9-1.7h2.4l2 2h-5zm8.2-2a2 2 0 001.7-1l3.6-6.5.1-.5c0-.6-.4-1-1-1H6.5l9 9zM7 18a2 2 0 100 4 2 2 0 000-4z"}),(0,S.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"})]}),ar=u?["core/buttons",{layout:{type:"flex",justifyContent:"center"}},[["core/button",{text:(0,n.__)("Return to shop","woocommerce"),url:u}]]]:null,ir={textAlign:"center",style:{typography:{textAlign:"center"}}},lr=[["core/heading",{...ir,content:(0,n.__)("Your cart is empty","woocommerce"),level:2,className:"wc-block-cart__empty-cart__title"}],ar,["core/spacer",{height:"40px"}],["core/heading",{...ir,content:(0,n.__)("New in store","woocommerce"),level:2}],["woocommerce/product-new",{columns:4,rows:1}]].filter(Boolean);o(69685);const dr=JSON.parse('{"name":"woocommerce/empty-cart-block","title":"Empty Cart","description":"Contains blocks that are displayed when the cart is empty.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(dr,{icon:{src:(0,S.jsx)(nt.A,{icon:nr,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)(),{currentView:o}=R(),s=ut(ot.innerBlockAreas.EMPTY_CART);return pt({clientId:e,registeredBlocks:s,defaultTemplate:lr}),(0,S.jsx)("div",{...t,hidden:"woocommerce/empty-cart-block"!==o,children:(0,S.jsx)(r.InnerBlocks,{template:lr,templateLock:!1,renderAppender:r.InnerBlocks.ButtonBlockAppender})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})})});const mr=e=>Object.values(e).reduce((e,t)=>(null!==t.icons&&(e=e.concat(t.icons)),e),[]),ur=({className:e})=>{const{paymentMethods:t}=ws(!1);return(0,S.jsx)(Fs,{className:e,icons:mr(t)})},pr=JSON.parse('{"name":"woocommerce/cart-accepted-payment-methods-block","title":"Accepted Payment Methods","description":"Display accepted payment methods.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":true},"parent":["woocommerce/cart-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(pr,{icon:{src:(0,S.jsx)(nt.A,{icon:Ts.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(ur,{className:t})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const hr=(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none",children:[(0,S.jsx)("path",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",d:"M6 3.75h12c.69 0 1.25.56 1.25 1.25v14c0 .69-.56 1.25-1.25 1.25H6c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25z"}),(0,S.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.9 7.5A1.1 1.1 0 018 6.4h8a1.1 1.1 0 011.1 1.1v2a1.1 1.1 0 01-1.1 1.1H8a1.1 1.1 0 01-1.1-1.1v-2zm1.2.1v1.8h7.8V7.6H8.1z",clipRule:"evenodd"}),(0,S.jsx)("path",{fill:"currentColor",d:"M8.5 12h1v1h-1v-1zM8.5 14h1v1h-1v-1zM8.5 16h1v1h-1v-1zM11.5 12h1v1h-1v-1zM11.5 14h1v1h-1v-1zM11.5 16h1v1h-1v-1zM14.5 12h1v1h-1v-1zM14.5 14h1v1h-1v-1zM14.5 16h1v1h-1v-1z"})]});o(81962);const gr=({instanceId:e,isLoading:t=!1,onSubmit:o,displayCouponForm:r=!1})=>{const[c,i]=(0,a.useState)(""),[l,d]=(0,a.useState)(r),m=`wc-block-components-totals-coupon__input-${e}`,{validationErrorId:u}=(0,P.useSelect)(t=>({validationErrorId:t(B.validationStore).getValidationErrorId(e)}),[e]),p=(0,a.useRef)(null);return(0,S.jsx)(zt.Panel,{className:"wc-block-components-totals-coupon",initialOpen:l,hasBorder:!1,headingLevel:2,title:(0,n.__)("Add coupons","woocommerce"),state:[l,d],children:(0,S.jsx)(Vs,{screenReaderLabel:(0,n.__)("Applying coupon…","woocommerce"),isLoading:t,showSpinner:!1,children:(0,S.jsxs)("div",{className:"wc-block-components-totals-coupon__content",children:[(0,S.jsxs)("form",{className:"wc-block-components-totals-coupon__form",id:"wc-block-components-totals-coupon__form",children:[(0,S.jsx)(zt.ValidatedTextInput,{id:m,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:(0,n.__)("Enter code","woocommerce"),value:c,ariaDescribedBy:u||"",onChange:e=>{i(e)},focusOnMount:!0,validateOnMount:!1,showError:!1,ref:p}),(0,S.jsxs)(tr,{className:(0,s.A)("wc-block-components-totals-coupon__button",{"wc-block-components-totals-coupon__button--loading":t}),disabled:t||!c,onClick:e=>{e.preventDefault(),void 0!==o?o(c)?.then(e=>{e?(i(""),d(!1)):p.current?.focus&&p.current.focus()}):(i(""),d(!0))},type:"submit",children:[t&&(0,S.jsx)(zt.Spinner,{}),(0,n.__)("Apply","woocommerce")]})]}),(0,S.jsx)(zt.ValidationInputError,{propertyName:"coupon",elementId:e})]})})})};o(90619);const _r={context:"summary"},wr=({cartCoupons:e=[],currency:t,isRemovingCoupon:o,removeCoupon:s,values:r,isLoading:c})=>{const{total_discount:a,total_discount_tax:l}=r,d=parseInt(a,10),m=(0,ot.applyCheckoutFilter)({arg:_r,filterName:"coupons",defaultValue:e});if(!d&&0===m.length)return null;const u=parseInt(l,10),p=(0,i.getSetting)("displayCartPricesIncludingTax",!1)?d+u:d;return(0,S.jsx)(zt.TotalsItem,{className:"wc-block-components-totals-discount",currency:t,description:0!==m.length&&(0,S.jsx)(Vs,{screenReaderLabel:(0,n.__)("Removing coupon…","woocommerce"),isLoading:o,showSpinner:!1,children:(0,S.jsx)("ul",{className:"wc-block-components-totals-discount__coupon-list",children:m.map(e=>(0,S.jsx)(zt.RemovableChip,{className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:(0,n.sprintf)(/* translators: %s Coupon code. */ /* translators: %s Coupon code. */ (0,n.__)("Coupon: %s","woocommerce"),e.label),disabled:o,onRemove:()=>{s(e.code)},radius:"large",ariaLabel:(0,n.sprintf)(/* translators: %s is a coupon code. */ /* translators: %s is a coupon code. */ (0,n.__)('Remove coupon "%s"',"woocommerce"),e.label)},"coupon-"+e.code))})}),label:p?(0,n.__)("Discount","woocommerce"):(0,n.__)("Coupons","woocommerce"),value:p?-1*p:"-",showSkeleton:c})},br=()=>{const{cartIsLoading:e,isLoadingRates:t,hasPendingItemsOperations:o}=_e(),{isApplyingCoupon:s,isRemovingCoupon:r}=zs(),c=(0,P.useSelect)(e=>e(B.checkoutStore).isCalculating(),[]);return{isLoading:e||t||s||r||c||o}};o(48413);const kr=({currency:e,values:t,className:o,isEstimate:r=!1})=>{const c=(0,i.getSetting)("taxesEnabled",!0)&&(0,i.getSetting)("displayCartPricesIncludingTax",!1),{total_price:l,total_tax:d,tax_lines:m}=t,{receiveCart:u,...p}=_e(),{isLoading:h}=br(),g=(0,ot.applyCheckoutFilter)({filterName:"totalLabel",defaultValue:r?(0,n.__)("Estimated total","woocommerce"):(0,n.__)("Total","woocommerce"),extensions:p.extensions,arg:{cart:p}}),_=(0,ot.applyCheckoutFilter)({filterName:"totalValue",defaultValue:"<price/>",extensions:p.extensions,arg:{cart:p},validation:ot.productPriceValidation}),w=(0,S.jsx)(zt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:parseInt(l,10)}),b=(0,a.createInterpolateElement)(_,{price:w}),k=parseInt(d,10),y=(0,S.jsx)(S.Fragment,{children:m?.map(({name:t,price:o,rate:s},r)=>(0,S.jsxs)(a.Fragment,{children:[r>0&&", ",(0,S.jsx)(zt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:o}),` ${t}`]},`${t}-${s}`))}),x=m&&m.length>0?(0,n.sprintf)(/* translators: %s is a list of tax rates */ /* translators: %s is a list of tax rates */ (0,n.__)("Including %s","woocommerce"),"<TaxLines/>"):(0,n.__)("Including <TaxAmount/> in taxes","woocommerce"),f=ke(p.shippingRates),v=p.cartNeedsShipping,j=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("span",{children:(0,n.__)("Including","woocommerce")}),(0,S.jsx)(Mt,{height:"1em",width:"45px",tag:"span",ariaMessage:(0,n.__)("Loading price… ","woocommerce")})]});return(0,S.jsx)(zt.TotalsItem,{className:(0,s.A)("wc-block-components-totals-footer-item",o),currency:e,label:g,value:b,description:(0,S.jsxs)(S.Fragment,{children:[c&&0!==k&&(0,S.jsx)("p",{className:"wc-block-components-totals-footer-item-tax",children:(0,S.jsx)(Ot,{isLoading:h,skeleton:j,children:(0,S.jsx)(S.Fragment,{children:(0,a.createInterpolateElement)(x,{TaxAmount:(0,S.jsx)(zt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:k}),TaxLines:y})})})}),r&&!f&&v&&(0,S.jsx)("p",{className:"wc-block-components-totals-footer-item-shipping",children:(0,n.__)("Shipping will be calculated at checkout","woocommerce")})]}),showSkeleton:h})},yr=()=>{const{shippingRates:e}=_e(),t=ye(e);return t?(0,S.jsx)("div",{className:"wc-block-components-totals-shipping__via",children:(0,oe.decodeEntities)(t.filter((e,o)=>t.indexOf(e)===o).join(", "))}):null},xr=e=>{const t=(e=>(0,i.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.total_shipping,10)+parseInt(e.total_shipping_tax,10):parseInt(e.total_shipping,10))(e);return 0===t?(0,S.jsx)("strong",{children:(0,n.__)("Free","woocommerce")}):t};o(36562);const fr=({label:e=(0,n.__)("Shipping","woocommerce"),placeholder:t=null,collaterals:o=null,shippingRates:s})=>{const{cartTotals:r,shippingRates:c}=_e(),{isLoading:a}=br(),i=s??c,l=ke(i),d=ye(i),m=i.flatMap(e=>e.shipping_rates.map(e=>e.name).filter(Boolean));let u=[];d.length>0?u=d:1===m.length&&(u=m);const p=d.length>1||m.length>1,h=0===u.length||p?e:u[0];return(0,S.jsx)("div",{className:"wc-block-components-totals-shipping",children:(0,S.jsx)(zt.TotalsItem,{label:h,value:l?xr(r):t,description:(0,S.jsxs)(S.Fragment,{children:[p&&(0,S.jsx)(yr,{}),o&&(0,S.jsx)("div",{className:"wc-block-components-totals-shipping__collaterals",children:o})]}),currency:(0,Ht.getCurrencyFromPriceResponse)(r),showSkeleton:a})})},vr=()=>{const{extensions:e,receiveCart:t,...o}=_e(),s={extensions:e,cart:o,context:"woocommerce/cart"};return(0,S.jsx)(ot.ExperimentalOrderMeta.Slot,{...s})},Sr=JSON.parse('{"name":"woocommerce/cart-order-summary-block","title":"Order Summary","description":"Show customers a summary of their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}'),jr=[{attributes:Sr.attributes,save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})}),supports:Sr.supports,migrate:({attributes:e})=>[e,[(0,c.createBlock)("woocommerce/cart-order-summary-heading-block",{content:(0,n.__)("Cart totals","woocommerce")},[]),(0,c.createBlock)("woocommerce/cart-order-summary-coupon-form-block",{},[]),(0,c.createBlock)("woocommerce/cart-order-summary-totals-block",{},[(0,c.createBlock)("woocommerce/cart-order-summary-subtotal-block",{},[]),(0,c.createBlock)("woocommerce/cart-order-summary-fee-block",{},[]),(0,c.createBlock)("woocommerce/cart-order-summary-discount-block",{},[]),(0,c.createBlock)("woocommerce/cart-order-summary-shipping-block",{},[]),(0,c.createBlock)("woocommerce/cart-order-summary-taxes-block",{},[])])]],isEligible:(e,t)=>!t.some(e=>"woocommerce/cart-order-summary-totals-block"===e.name)}],Cr=jr;(0,c.registerBlockType)(Sr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)(),{cartTotals:o}=_e(),s=(0,Ht.getCurrencyFromPriceResponse)(o),c=ut(ot.innerBlockAreas.CART_ORDER_SUMMARY),a=[["woocommerce/cart-order-summary-heading-block",{content:(0,n.__)("Cart totals","woocommerce")},[]],["woocommerce/cart-order-summary-coupon-form-block",{},[]],["woocommerce/cart-order-summary-totals-block",{},[]]];return pt({clientId:e,registeredBlocks:c,defaultTemplate:a}),(0,S.jsxs)("div",{...t,children:[(0,S.jsx)(r.InnerBlocks,{allowedBlocks:c,template:a}),(0,S.jsx)("div",{className:"wc-block-components-totals-wrapper",children:(0,S.jsx)(kr,{currency:s,values:o,isEstimate:!0})}),(0,S.jsx)(vr,{})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})}),deprecated:Cr});const Er=({className:e=""})=>{const{cartTotals:t}=_e(),{isLoading:o}=br();if(!parseFloat(t.total_fees)&&!parseFloat(t.total_discount)&&!parseFloat(t.total_shipping))return null;const s=(0,Ht.getCurrencyFromPriceResponse)(t);return(0,S.jsx)(zt.TotalsWrapper,{className:e,children:(0,S.jsx)(zt.Subtotal,{currency:s,values:t,showSkeleton:o})})},Pr=JSON.parse('{"name":"woocommerce/cart-order-summary-subtotal-block","title":"Subtotal","description":"Shows the cart subtotal row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Pr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(Er,{className:t})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})}),o(42115);const Nr=JSON.parse('{"name":"woocommerce/cart-order-summary-totals-block","title":"Totals","description":"Shows the subtotal, fees, discounts, shipping and taxes.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Nr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,r.useBlockProps)(),o=ut(ot.innerBlockAreas.CART_ORDER_SUMMARY_TOTALS),s=[["woocommerce/cart-order-summary-subtotal-block",{},[]],["woocommerce/cart-order-summary-fee-block",{},[]],["woocommerce/cart-order-summary-discount-block",{},[]],["woocommerce/cart-order-summary-shipping-block",{},[]],["woocommerce/cart-order-summary-taxes-block",{},[]]];return pt({clientId:e,registeredBlocks:o,defaultTemplate:s}),(0,S.jsx)("div",{...t,children:(0,S.jsx)(r.InnerBlocks,{allowedBlocks:o,template:s})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save(),children:(0,S.jsx)(r.InnerBlocks.Content,{})})});const Ar=({className:e})=>{const{cartFees:t,cartTotals:o}=_e();if(!t.length)return null;const s=(0,Ht.getCurrencyFromPriceResponse)(o);return(0,S.jsx)(zt.TotalsWrapper,{className:e,children:(0,S.jsx)(zt.TotalsFees,{currency:s,cartFees:t})})},Rr=JSON.parse('{"name":"woocommerce/cart-order-summary-fee-block","title":"Fees","description":"Shows the cart fee row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Rr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(Ar,{className:t})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const Ir=()=>{const{extensions:e,receiveCart:t,...o}=_e(),s={extensions:e,cart:o,context:"woocommerce/cart"};return(0,S.jsx)(ot.ExperimentalDiscountsMeta.Slot,{...s})},Tr=({className:e})=>{const{cartTotals:t,cartCoupons:o}=_e(),{removeCoupon:s,isRemovingCoupon:r}=zs("wc/cart"),{isLoading:c}=br();if(!o.length)return(0,S.jsx)(Ir,{});const n=(0,Ht.getCurrencyFromPriceResponse)(t);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(zt.TotalsWrapper,{className:e,children:(0,S.jsx)(wr,{cartCoupons:o,currency:n,isRemovingCoupon:r,removeCoupon:s,values:t,isLoading:c})}),(0,S.jsx)(Ir,{})]})},Br=JSON.parse('{"name":"woocommerce/cart-order-summary-discount-block","title":"Discount","description":"Shows the cart discount row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Br,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(Tr,{className:t})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const Mr=({className:e})=>{const{cartNeedsShipping:t,shippingRates:o}=_e();return t&&ke(o)?(0,S.jsx)(ot.TotalsWrapper,{className:e,children:(0,S.jsx)(fr,{label:(0,n.__)("Shipping","woocommerce"),placeholder:(0,S.jsx)("span",{className:"wc-block-components-shipping-placeholder__value",children:(0,n.__)("Calculated at checkout","woocommerce")})})}):null},Lr=JSON.parse('{"name":"woocommerce/cart-order-summary-shipping-block","title":"Shipping","description":"Shows the cart shipping row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Lr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsxs)("div",{...o,children:[(0,S.jsx)(r.InspectorControls,{children:!!w&&(0,S.jsxs)(So.PanelBody,{title:(0,n.__)("Shipping Calculations","woocommerce"),children:[(0,S.jsx)("p",{className:"wc-block-checkout__controls-text",children:(0,n.__)("Options that control shipping can be managed in your store settings.","woocommerce")}),(0,S.jsx)(So.ExternalLink,{href:`${i.ADMIN_URL}admin.php?page=wc-settings&tab=shipping§ion=options`,children:(0,n.__)("Manage shipping options","woocommerce")})," "]})}),(0,S.jsx)(Bt,{children:(0,S.jsx)(Mr,{className:t})})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});var Or=o(49407);const Dr=JSON.parse('{"name":"woocommerce/cart-order-summary-coupon-form-block","title":"Coupon Form","description":"Shows the apply coupon form.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}'),Fr=({className:e})=>{const t=(0,i.getSetting)("couponsEnabled",!0),{applyCoupon:o,isApplyingCoupon:s}=zs("wc/cart");return t?(0,S.jsx)(zt.TotalsWrapper,{className:e,children:(0,S.jsx)(gr,{onSubmit:o,isLoading:s,instanceId:"coupon"})}):null};(0,c.registerBlockType)(Dr,{icon:{src:(0,S.jsx)(nt.A,{icon:Or.A,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,r.useBlockProps)();return(0,S.jsx)("div",{...o,children:(0,S.jsx)(Bt,{children:(0,S.jsx)(Fr,{className:t})})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})});const Vr=({className:e,showRateAfterTaxName:t})=>{const{cartTotals:o}=_e(),{isLoading:s}=br();if((0,i.getSetting)("displayCartPricesIncludingTax",!1)||parseInt(o.total_tax,10)<=0)return null;const r=(0,Ht.getCurrencyFromPriceResponse)(o);return(0,S.jsx)(zt.TotalsWrapper,{className:e,children:(0,S.jsx)(zt.TotalsTaxes,{showRateAfterTaxName:t,currency:r,values:o,showSkeleton:s})})},zr={showRateAfterTaxName:{type:"boolean",default:(0,i.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{remove:!0,move:!1}}},Hr=JSON.parse('{"name":"woocommerce/cart-order-summary-taxes-block","title":"Taxes","description":"Shows the cart taxes row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-order-summary-totals-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)(Hr,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},attributes:zr,edit:({attributes:e,setAttributes:t})=>{const{className:o,showRateAfterTaxName:s}=e,c=(0,r.useBlockProps)(),a=(0,i.getSetting)("taxesEnabled"),l=(0,i.getSetting)("displayItemizedTaxes",!1),d=(0,i.getSetting)("displayCartPricesIncludingTax",!1);return(0,S.jsxs)("div",{...c,children:[(0,S.jsx)(r.InspectorControls,{children:a&&l&&!d&&(0,S.jsx)(So.PanelBody,{title:(0,n.__)("Taxes","woocommerce"),children:(0,S.jsx)(So.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Show rate after tax name","woocommerce"),help:(0,n.__)("Show the percentage rate alongside each tax line in the summary.","woocommerce"),checked:s,onChange:()=>t({showRateAfterTaxName:!s})})})}),(0,S.jsx)(Vr,{className:o,showRateAfterTaxName:s})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})}),o(43580);const $r=JSON.parse('{"name":"woocommerce/cart-order-summary-heading-block","title":"Heading","description":"Shows the heading row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"content":{"type":"string","default":"Cart totals"},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woocommerce","$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3}');(0,c.registerBlockType)($r,{icon:{src:(0,S.jsx)(nt.A,{icon:hr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{content:o="",className:c=""}=e,n=(0,r.useBlockProps)();return(0,S.jsx)("div",{...n,children:(0,S.jsx)("h2",{className:(0,s.A)(c,"wc-block-cart__totals-title"),children:(0,S.jsx)(r.PlainText,{className:"",value:o,onChange:e=>t({content:e}),style:{backgroundColor:"transparent"}})})})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save()})}),o(9184);const Ur=(e,t=!0)=>{t?window.document.body.classList.add(e):window.document.body.classList.remove(e)},qr=({attributes:e,setAttributes:t})=>{const{hasDarkControls:o,showFormStepNumbers:s}=e;return(0,S.jsx)(r.InspectorControls,{children:(0,S.jsxs)(So.PanelBody,{title:(0,n.__)("Style","woocommerce"),children:[(0,S.jsx)(So.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Show form step numbers","woocommerce"),checked:s,onChange:()=>t({showFormStepNumbers:!s})}),(0,S.jsx)(So.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,n.__)("Dark mode inputs","woocommerce"),help:(0,n.__)("Inputs styled specifically for use on dark background colors.","woocommerce"),checked:o,onChange:()=>t({hasDarkControls:!o})})]})})},Wr=window.wp.coreData,Yr="core/editor";function Gr({block:e}){const t="checkout"===e?p:h,o="checkout"===e?"woocommerce_checkout_page_id":"woocommerce_cart_page_id",{saveEntityRecord:s}=(0,P.useDispatch)(Wr.store),{editPost:r,savePost:c}=(0,P.useDispatch)(Yr),{slug:i,postPublished:l,currentPostId:d}=(0,P.useSelect)(o=>{const{getEntityRecord:s}=o(Wr.store),r=o(Yr);return{slug:s("postType","page",t)?.slug||e,postPublished:r?.isCurrentPostPublished?.()??!1,currentPostId:r?.getCurrentPostId?.()??0}},[t,e]),[m,u]=(0,a.useState)("pristine"),g=(0,a.useCallback)(()=>{u("updating"),Promise.resolve().then(()=>Fe()({path:`/wc/v3/settings/advanced/${o}`,method:"GET"})).catch(e=>{"rest_setting_setting_invalid"===e.code&&u("error")}).then(()=>{if(!l)return r({status:"publish"}),c()}).then(()=>Fe()({path:`/wc/v3/settings/advanced/${o}`,method:"POST",data:{value:d.toString()}})).then(()=>{if(0!==t)return s("postType","page",{id:t,slug:`${i}-2`})}).then(()=>r({slug:i})).then(()=>c()).then(()=>u("updated"))},[l,r,c,o,d,t,s,i]);let _;return _="checkout"===e?(0,a.createInterpolateElement)((0,n.__)("If you would like to use this block as your default checkout, <a>update your page settings</a>.","woocommerce"),{a:(0,S.jsx)("a",{href:"#",onClick:g,children:(0,n.__)("update your page settings","woocommerce")})}):(0,a.createInterpolateElement)((0,n.__)("If you would like to use this block as your default cart, <a>update your page settings</a>.","woocommerce"),{a:(0,S.jsx)("a",{href:"#",onClick:g,children:(0,n.__)("update your page settings","woocommerce")})}),"string"==typeof pagenow&&"site-editor"===pagenow||d===t||"dismissed"===m?null:(0,S.jsx)(So.Notice,{className:"wc-default-page-notice",status:"updated"===m?"success":"info",onRemove:()=>u("dismissed"),spokenMessage:"updated"===m?(0,n.__)("Page settings updated","woocommerce"):_,children:"updated"===m?(0,n.__)("Page settings updated","woocommerce"):(0,S.jsx)(S.Fragment,{children:(0,S.jsx)("p",{children:_})})})}o(13650);var Jr=o(10149);const Qr="wc-blocks_dismissed_incompatible_extensions_notices",Kr=(e,t)=>e.every(e=>t.includes(e)),Xr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Zr=e=>Xr(e),ec=()=>(()=>{if(i.IS_MULTISITE)return[];try{const e=window.localStorage.getItem(Qr);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}return console.error(`Value for key '${Qr}' could not be carried over from localStorage because it can't be read as a list of dismissals.`),[]})().filter(Zr),tc=e=>{const[t,o,s,r]=(()=>{const e=(0,i.getSetting)("incompatibleExtensions",void 0),t=Array.isArray(e),o={};t&&e.forEach(e=>{o[e.id]=e.title});const s=Object.keys(o),r=s.length;return[o,s,r,t]})(),[c,n,l]=(()=>{const{incompatiblePaymentMethods:e}=(0,P.useSelect)(e=>{const{getIncompatiblePaymentMethods:t}=e(B.paymentStore);return{incompatiblePaymentMethods:t()}},[]),t=Object.keys(e);return[e,t,t.length]})(),d=(0,P.useSelect)(e=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o}=e(B.paymentStore);return t()&&o()},[]),m={...t,...c},u=[...o,...n],p=s+l,h=`${Qr}__${i.CURRENT_SITE_ID}`,g=(0,a.useMemo)(()=>((e,t)=>{try{return null===window.localStorage.getItem(e)?t():[]}catch{return[]}})(h,ec),[h]),[_,w]=((e,t)=>{const[o,s]=(0,a.useState)(()=>{const o=window.localStorage.getItem(e);if(o)try{return JSON.parse(o)}catch{console.error(`Value for key '${e}' could not be retrieved from localStorage because it can't be parsed.`)}return t});return(0,a.useEffect)(()=>{try{window.localStorage.setItem(e,JSON.stringify(o))}catch{console.error(`Value for key '${e}' could not be saved in localStorage because it can't be converted into a string.`)}},[e,o]),[o,s]})(h,g),[b,k]=(0,a.useState)(!1),y=(Array.isArray(_)?_:[]).reduce((t,o)=>(t.push(...((e,t)=>{if(!Xr(e))return[];const o=e[t];return Array.isArray(o)?o.filter(e=>"string"==typeof e):[]})(o,e)),t),[]),x=Kr(u,y),f=0===p||x,v=t=>w(o=>[...(Array.isArray(o)?o:[]).filter(t=>!((e,t)=>Xr(e)&&t in e)(t,e)),{[e]:t}]),S=d&&r&&!Kr(y,u)?y.filter(e=>u.includes(e)):null;var j;return(0,a.useEffect)(()=>{null!==S&&v(S)}),(0,a.useEffect)(()=>{k(!f)},[f]),[b,()=>{v(u)},(j=m,Object.fromEntries(Object.entries(j).sort(([,e],[,t])=>e.localeCompare(t)))),p]};var oc=o(51512),sc=o.n(oc);sc()("wc-admin:tracks:stats");const rc=sc()("wc-admin:tracks");function cc(e,t){if(rc("recordevent %s %o","wcadmin_"+e,t,{_tqk:window._tkq,shouldRecord:!!window._tkq&&!!window.wcTracks&&!!window.wcTracks.isEnabled}),!window.wcTracks||"function"!=typeof window.wcTracks.recordEvent)return!1;window.wcTracks.recordEvent(e,t)}const nc=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=nc({blocks:o.innerBlocks,findCondition:t});if(e)return e}}},ac=({blockType:e="woocommerce/cart"})=>"woocommerce/cart"===e?(0,S.jsx)("p",{children:(0,n.__)("If you continue, the cart block will be replaced with the classic experience powered by shortcodes. This means that you may lose customizations that you made to the cart block.","woocommerce")}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("p",{children:(0,n.__)("If you continue, the checkout block will be replaced with the classic experience powered by shortcodes. This means that you may lose:","woocommerce")}),(0,S.jsxs)("ul",{className:"cross-list",children:[(0,S.jsx)("li",{children:(0,n.__)("Customizations and updates to the block","woocommerce")}),(0,S.jsx)("li",{children:(0,n.__)("Additional local pickup options created for the new checkout","woocommerce")})]})]});function ic({block:e,clientId:t,type:o}){const{createInfoNotice:s}=(0,P.useDispatch)(Te.store),{replaceBlock:i,selectBlock:l}=(0,P.useDispatch)(r.store),[d,m]=(0,a.useState)(!1),u=()=>m(!1),{undo:p}=(0,P.useDispatch)(Wr.store),[,,h,g]=tc(e),_="woocommerce/cart"===e,w=_?(0,n.__)("Switch to classic cart","woocommerce"):(0,n.__)("Switch to classic checkout","woocommerce"),b=_?(0,n.__)("Switched to classic cart.","woocommerce"):(0,n.__)("Switched to classic checkout.","woocommerce"),k=_?"cart":"checkout",y={shortcode:k,notice:"incompatible"===o?"incompatible_notice":"generic_notice",incompatible_extensions_count:g,incompatible_extensions_names:JSON.stringify(h)},{getBlocks:x}=(0,P.useSelect)(e=>({getBlocks:e(r.store).getBlocks}),[]),f=()=>{p(),cc("switch_to_classic_shortcode_undo",y)};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(So.Button,{variant:"secondary",onClick:()=>{cc("switch_to_classic_shortcode_click",y),m(!0)},children:w}),d&&(0,S.jsxs)(So.Modal,{size:"medium",title:w,onRequestClose:u,className:"wc-blocks-switch-to-classic-shortcode-modal-content",children:[(0,S.jsx)(ac,{blockType:e}),(0,S.jsxs)(So.TabbableContainer,{className:"wc-blocks-switch-to-classic-shortcode-modal-actions",children:[(0,S.jsx)(So.Button,{variant:"primary",isDestructive:!0,onClick:()=>{i(t,(0,c.createBlock)("woocommerce/classic-shortcode",{shortcode:k})),cc("switch_to_classic_shortcode_confirm",y),(()=>{const e=nc({blocks:x(),findCondition:e=>"woocommerce/classic-shortcode"===e.name});e&&l(e.clientId)})(),s(b,{actions:[{label:(0,n.__)("Undo","woocommerce"),onClick:f}],type:"snackbar"}),u()},children:(0,n.__)("Switch","woocommerce")})," ",(0,S.jsx)(So.Button,{variant:"secondary",onClick:()=>{cc("switch_to_classic_shortcode_cancel",y),u()},children:(0,n.__)("Cancel","woocommerce")})]})]})]})}function lc({block:e,clientId:t}){const[o,s,r,c]=tc(e);if(!o)return null;const i=(0,S.jsx)(S.Fragment,{children:c>1?(0,a.createInterpolateElement)((0,n.__)("Some active extensions do not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),{a:(0,S.jsx)(So.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/#incompatible-extensions/"})}):(0,a.createInterpolateElement)((0,n.sprintf)( // translators: %s is the name of the extension. // translators: %s is the name of the extension. (0,n.__)("<strong>%s</strong> does not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),Object.values(r)[0]),{strong:(0,S.jsx)("strong",{}),a:(0,S.jsx)(So.ExternalLink,{href:"https://woocommerce.com/document/woocommerce-store-editing/customizing-cart-and-checkout/#incompatible-extensions/"})})}),l=Object.entries(r),d=l.length-2;return(0,S.jsx)(So.Notice,{className:"wc-blocks-incompatible-extensions-notice",status:"warning",onRemove:s,spokenMessage:i,children:(0,S.jsxs)("div",{className:"wc-blocks-incompatible-extensions-notice__content",children:[(0,S.jsx)(nt.A,{className:"wc-blocks-incompatible-extensions-notice__warning-icon",icon:(0,S.jsx)(xs,{})}),(0,S.jsxs)("div",{children:[(0,S.jsx)("p",{children:i}),c>1&&(0,S.jsx)("ul",{children:l.slice(0,2).map(([e,t])=>(0,S.jsx)("li",{className:"wc-blocks-incompatible-extensions-notice__element",children:t},e))}),l.length>2&&(0,S.jsxs)("details",{children:[(0,S.jsxs)("summary",{children:[(0,S.jsx)("span",{children:(0,n.sprintf)( // translators: %s is the number of incompatible extensions. // translators: %s is the number of incompatible extensions. (0,n._n)("%s more incompatibility","%s more incompatibilities",d,"woocommerce"),d)}),(0,S.jsx)(nt.A,{icon:Jr.A})]}),(0,S.jsx)("ul",{children:l.slice(2).map(([e,t])=>(0,S.jsx)("li",{className:"wc-blocks-incompatible-extensions-notice__element",children:t},e))})]}),(0,S.jsx)(ic,{block:e,clientId:t,type:"incompatible"})]})]})})}o(54490),o(96342);var dc=o(67078);o(34268);const mc=({text:e,title:t=(0,n.__)("Feedback?","woocommerce"),url:o})=>{const[s,r]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{r(!0)},[]),(0,S.jsx)(S.Fragment,{children:s&&(0,S.jsxs)("div",{className:"wc-block-feedback-prompt",children:[(0,S.jsx)(nt.A,{icon:dc.A}),(0,S.jsx)("h2",{className:"wc-block-feedback-prompt__title",children:t}),(0,S.jsx)("p",{className:"wc-block-feedback-prompt__text",children:e}),(0,S.jsxs)("a",{href:o,className:"wc-block-feedback-prompt__link",rel:"noreferrer noopener",target:"_blank",children:[(0,n.__)("Give us your feedback.","woocommerce"),(0,S.jsx)(nt.A,{icon:ks.A,size:16})]})]})})},uc=()=>(0,S.jsx)(mc,{text:(0,n.__)("We are currently working on improving our cart and checkout blocks to provide merchants with the tools and customization options they need.","woocommerce"),url:"https://github.com/woocommerce/woocommerce/discussions/new?category=checkout-flow&labels=type%3A+product%20feedback"}),pc=({clientId:e})=>{const{isCart:t,isCheckout:o,parentId:s}=(0,P.useSelect)(t=>{const{getBlockParentsByBlockName:o,getBlockName:s}=t(r.store),c=o(e,["woocommerce/cart","woocommerce/checkout"]).reduce((e,t)=>(e[s(t)]=t,e),{}),n=s(e),a=Object.keys(c).includes("woocommerce/cart"),i=Object.keys(c).includes("woocommerce/checkout"),l="woocommerce/cart"===n||a,d=l?"woocommerce/cart":"woocommerce/checkout";return{isCart:l,isCheckout:"woocommerce/checkout"===n||i,parentId:n===d?e:c[d]}},[e]);return(t||o)&&(0,S.jsxs)(r.InspectorControls,{children:[(0,S.jsx)(lc,{block:t?"woocommerce/cart":"woocommerce/checkout",clientId:s}),(0,S.jsx)(Gr,{block:o?"checkout":"cart"}),(0,S.jsx)(uc,{})]})},hc=(0,at.createHigherOrderComponent)(e=>t=>{const{clientId:o,name:s,isSelected:r}=t;return(0,S.jsxs)(S.Fragment,{children:[s.startsWith("woocommerce/")&&r&&(0,S.jsx)(pc,{clientId:o}),(0,S.jsx)(e,{...t},"edit")]})},"withSidebarNotices");(0,ve.hasFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice")||(0,ve.addFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice",hc,11);const gc=(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,S.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,S.jsx)("path",{d:"M12 6a9.77 9.77 0 0 1 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5A9.77 9.77 0 0 1 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5a2.5 2.5 0 0 1 0 5 2.5 2.5 0 0 1 0-5m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"})]}),_c=(e,t,o=!0)=>{const{updateBlockAttributes:s,selectBlock:r,__unstableMarkNextChangeAsNotPersistent:c}=(0,P.dispatch)("core/block-editor");c(),s(e,{currentView:t}),o&&r((0,P.select)("core/block-editor").getBlock(e)?.innerBlocks.find(e=>e.name===t)?.clientId||e)},wc={views:[],currentView:"",viewClientId:""},bc=(e,t=10,o=0)=>{const s=o+1;if(s>t)return wc;const{getBlockAttributes:r,getBlockRootClientId:c}=(0,P.select)("core/block-editor"),n=c(e);if(null===n||""===n)return wc;const a=r(n);return a?void 0!==a.editorViews?{views:a.editorViews,currentView:a.currentView||a.editorViews[0].view,viewClientId:n}:bc(n,t,s):wc},kc=({currentView:e,views:t,clientId:o})=>{const{getBlockName:s,getSelectedBlockClientId:c,getBlockParentsByBlockName:i}=(0,P.useSelect)(e=>{const t=e("core/block-editor");return{getBlockName:t.getBlockName,getSelectedBlockClientId:t.getSelectedBlockClientId,getBlockParentsByBlockName:t.getBlockParentsByBlockName}},[]),l=c(),d=((e,t)=>t.find(t=>t.view===e))(e,t)||t[0],m=d.label;return(0,a.useLayoutEffect)(()=>{const r=l?s(l):null;if(!r||e===r)return;const c=t.map(e=>e.view);if(c.includes(r))return void _c(o,r);const n=i(l,c),a=1===n.length?s(n[0]):null;a&&e!==a&&_c(o,a,!1)},[o,e,s,i,l,t]),(0,S.jsx)(r.BlockControls,{children:(0,S.jsx)(So.ToolbarGroup,{children:(0,S.jsx)(So.ToolbarDropdownMenu,{label:(0,n.__)("Switch view","woocommerce"),text:m,icon:(0,S.jsx)(nt.A,{icon:gc,style:{marginRight:"8px"}}),controls:t.map(t=>({...t,title:(0,S.jsx)("span",{style:{marginLeft:"8px"},children:t.label}),isActive:t.view===e,onClick:()=>{_c(o,t.view)}}))})})})};(0,ve.hasFilter)("editor.BlockEdit","woocommerce/with-view-switcher")||(0,ve.addFilter)("editor.BlockEdit","woocommerce/with-view-switcher",e=>t=>{const{clientId:o}=t,{views:s,currentView:r,viewClientId:c}=(0,P.useSelect)(e=>{const t=e("core/block-editor").getBlockAttributes(o);return t?.editorViews?{views:t.editorViews,currentView:t.currentView,viewClientId:o}:bc(o)});return 0===s.length?(0,S.jsx)(e,{...t}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(kc,{currentView:r,views:s,clientId:c}),(0,S.jsx)(e,{...t})]})},11),(0,ve.hasFilter)("blocks.registerBlockType","core/lock/addAttribute")||(0,P.subscribe)(()=>{const e=(0,P.select)(r.store);if(!e)return;const t=e.getSelectedBlock();t&&(Ur("wc-lock-selected-block--remove",!!t?.attributes?.lock?.remove),Ur("wc-lock-selected-block--move",!!t?.attributes?.lock?.move))});const yc=["woocommerce/filled-cart-block","woocommerce/empty-cart-block"],xc={currentView:{type:"string",default:"woocommerce/filled-cart-block",source:"readonly"},editorViews:{type:"object",default:[{view:"woocommerce/filled-cart-block",label:(0,n.__)("Filled Cart","woocommerce"),icon:(0,S.jsx)(nt.A,{icon:ct})},{view:"woocommerce/empty-cart-block",label:(0,n.__)("Empty Cart","woocommerce"),icon:(0,S.jsx)(nt.A,{icon:nr})}]},hasDarkControls:{type:"boolean",default:(0,i.getSetting)("hasDarkEditorStyleSupport",!1)},checkoutPageId:{type:"number",default:0},showRateAfterTaxName:{type:"boolean",default:!0},align:{type:"string",default:"wide"}},fc=(0,S.jsxs)(rt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,S.jsx)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,S.jsx)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"})]}),vc={title:(0,n.__)("Cart","woocommerce"),apiVersion:3,icon:{src:(0,S.jsx)(nt.A,{icon:fc,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,n.__)("WooCommerce","woocommerce")],description:(0,n.__)("Shopping cart.","woocommerce"),supports:{align:["wide"],html:!1,multiple:!1},example:{viewportWidth:800},attributes:xc,edit:({clientId:e,className:t,attributes:o,setAttributes:i})=>{const{hasDarkControls:l,currentView:d}=o,m=N(),u=((e={})=>{const t=(0,a.useRef)(),o=(0,r.useBlockProps)({ref:t,...e});return(({ref:e})=>{const t=(0,ve.hasFilter)("blocks.registerBlockType","core/lock/addAttribute"),o=e.current;(0,a.useEffect)(()=>{if(o&&!t)return o.addEventListener("keydown",e,{capture:!0,passive:!1}),()=>{o.removeEventListener("keydown",e,{capture:!0})};function e(e){const{keyCode:t,target:o}=e;if(!(o instanceof HTMLElement))return;if(t!==Ft.BACKSPACE&&t!==Ft.DELETE)return;if((0,Rt.isTextField)(o))return;const s=o;if(void 0===s.dataset.block)return;const n=(e=>{if(!e)return!1;const{getBlock:t}=(0,P.select)(r.store),o=t(e);if("boolean"==typeof o?.attributes?.lock?.remove)return o.attributes.lock.remove;const s=(0,c.getBlockType)(o.name);return"boolean"==typeof s?.attributes?.lock?.default?.remove&&s?.attributes?.lock?.default?.remove})(s.dataset.block);n&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}},[o,t])})({ref:t}),o})({className:(0,s.A)(t,"wp-block-woocommerce-cart",{"is-editor-preview":m})}),p=(0,a.useRef)((0,st.getQueryArg)(window.location.href,"focus"));return(0,a.useEffect)(()=>{"cart"!==p.current||(0,P.select)("core/block-editor").hasSelectedBlock()||((0,P.dispatch)("core/block-editor").selectBlock(e),(0,P.dispatch)("core/interface").enableComplementaryArea("core/edit-site","edit-site/block-inspector"))},[e]),(0,S.jsxs)("div",{...u,children:[(0,S.jsx)(r.InspectorControls,{children:(0,S.jsx)(qr,{attributes:o,setAttributes:i})}),(0,S.jsx)(E,{header:(0,n.__)("Cart Block Error","woocommerce"),text:(0,n.__)("There was an error whilst rendering the cart block. If this problem continues, try re-creating the block.","woocommerce"),showErrorMessage:!0,errorMessagePrefix:(0,n.__)("Error message:","woocommerce"),children:(0,S.jsx)(I,{previewData:{previewCart:tt},currentView:d,children:(0,S.jsx)(ht.Provider,{value:{hasDarkControls:l},children:(0,S.jsx)(ot.SlotFillProvider,{children:(0,S.jsx)(qe,{children:(0,S.jsx)(r.InnerBlocks,{allowedBlocks:yc,template:[["woocommerce/filled-cart-block",{},[]],["woocommerce/empty-cart-block",{},[]]],templateLock:"insert"})})})})})})]})},save:()=>(0,S.jsx)("div",{...r.useBlockProps.save({className:"is-loading"}),children:(0,S.jsx)(r.InnerBlocks.Content,{})}),transforms:{to:[{type:"block",blocks:["woocommerce/classic-shortcode"],transform:e=>(0,c.createBlock)("woocommerce/classic-shortcode",{shortcode:"cart",align:e.align},[])}]},deprecated:[{attributes:xc,save:({attributes:e})=>(0,S.jsx)("div",{className:(0,s.A)("is-loading",e.className),children:(0,S.jsx)(r.InnerBlocks.Content,{})}),migrate:(e,t)=>{const{checkoutPageId:o,align:s}=e;return[e,[(0,c.createBlock)("woocommerce/filled-cart-block",{align:s},[(0,c.createBlock)("woocommerce/cart-items-block"),(0,c.createBlock)("woocommerce/cart-totals-block",{},[(0,c.createBlock)("woocommerce/cart-order-summary-block",{}),(0,c.createBlock)("woocommerce/cart-express-payment-block"),(0,c.createBlock)("woocommerce/proceed-to-checkout-block",{checkoutPageId:o}),(0,c.createBlock)("woocommerce/cart-accepted-payment-methods-block")])]),(0,c.createBlock)("woocommerce/empty-cart-block",{align:s},t)]]},isEligible:(e,t)=>!t.find(e=>"woocommerce/filled-cart-block"===e.name)}]};(0,c.registerBlockType)("woocommerce/cart",vc)},45893:()=>{},46882:()=>{},60359:()=>{},86983:()=>{},29287:()=>{},37605:()=>{},3692:()=>{},8879:()=>{},81962:()=>{},90619:()=>{},48413:()=>{},36562:()=>{},99961:()=>{},40959:()=>{},8501:()=>{},79959:()=>{},99163:()=>{},22336:()=>{},42405:()=>{},42831:()=>{},9184:()=>{},70535:()=>{},74747:()=>{},17467:()=>{},43580:()=>{},42115:()=>{},65675:()=>{},69685:()=>{},30398:()=>{},2766:()=>{},77826:()=>{},53337:()=>{},66222:()=>{},51248:()=>{},94324:()=>{},16833:()=>{},13650:()=>{},84459:()=>{},34268:()=>{},96342:()=>{},54490:()=>{},51609:e=>{"use strict";e.exports=window.React},10790:e=>{"use strict";e.exports=window.ReactJSXRuntime},20195:e=>{"use strict";e.exports=window.wp.a11y},29491:e=>{"use strict";e.exports=window.wp.compose},64040:e=>{"use strict";e.exports=window.wp.deprecated},28107:e=>{"use strict";e.exports=window.wp.dom},86087:e=>{"use strict";e.exports=window.wp.element},27723:e=>{"use strict";e.exports=window.wp.i18n},20923:e=>{"use strict";e.exports=window.wp.isShallowEqual},48558:e=>{"use strict";e.exports=window.wp.keycodes},5573:e=>{"use strict";e.exports=window.wp.primitives}},r={};function c(e){var t=r[e];if(void 0!==t)return t.exports;var o=r[e]={exports:{}};return s[e](o,o.exports,c),o.exports}c.m=s,e=[],c.O=(t,o,s,r)=>{if(!o){var n=1/0;for(d=0;d<e.length;d++){for(var[o,s,r]=e[d],a=!0,i=0;i<o.length;i++)(!1&r||n>=r)&&Object.keys(c.O).every(e=>c.O[e](o[i]))?o.splice(i--,1):(a=!1,r<n&&(n=r));if(a){e.splice(d--,1);var l=s();void 0!==l&&(t=l)}}return t}r=r||0;for(var d=e.length;d>0&&e[d-1][2]>r;d--)e[d]=e[d-1];e[d]=[o,s,r]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,s){if(1&s&&(e=this(e)),8&s)return e;if("object"==typeof e&&e){if(4&s&&e.__esModule)return e;if(16&s&&"function"==typeof e.then)return e}var r=Object.create(null);c.r(r);var n={};t=t||[null,o({}),o([]),o(o)];for(var a=2&s&&e;"object"==typeof a&&!~t.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach(t=>n[t]=()=>e[t]);return n.default=()=>e,c.d(r,n),r},c.d=(e,t)=>{for(var o in t)c.o(t,o)&&!c.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.j=7949,(()=>{var e={7949:0};c.O.j=t=>0===e[t];var t=(t,o)=>{var s,r,[n,a,i]=o,l=0;if(n.some(t=>0!==e[t])){for(s in a)c.o(a,s)&&(c.m[s]=a[s]);if(i)var d=i(c)}for(t&&t(o);l<n.length;l++)r=n[l],c.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return c.O(d)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var n=c.O(void 0,[94],()=>c(75829));n=c.O(n),((this.wc=this.wc||{}).blocks=this.wc.blocks||{}).cart=n})();
Save File
Cancel