31 lines
No EOL
145 KiB
JavaScript
31 lines
No EOL
145 KiB
JavaScript
(()=>{var e,t={9932:(e,t,o)=>{"use strict";o.r(t);var r=o(9196),c=o(5736),n=o(4184),s=o.n(n);const a=window.wp.blockEditor;var l=o(444);const i=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)("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"}));var u=o(1984);const d=window.wp.blocks;var p=o(4942),m=o(9307);const g=window.wc.wcSettings;var _,h,b,k,w,E,y,v,f,C;const S=(0,g.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),N=S.pluginUrl+"images/",P=(S.pluginUrl,S.buildPhase),x=null===(_=g.STORE_PAGES.shop)||void 0===_?void 0:_.permalink,R=null===(h=g.STORE_PAGES.checkout)||void 0===h?void 0:h.id,T=(null===(b=g.STORE_PAGES.checkout)||void 0===b||b.permalink,null===(k=g.STORE_PAGES.privacy)||void 0===k||k.permalink,null===(w=g.STORE_PAGES.privacy)||void 0===w||w.title,null===(E=g.STORE_PAGES.terms)||void 0===E||E.permalink,null===(y=g.STORE_PAGES.terms)||void 0===y||y.title,null===(v=g.STORE_PAGES.cart)||void 0===v?void 0:v.id),I=null===(f=g.STORE_PAGES.cart)||void 0===f?void 0:f.permalink,A=(null!==(C=g.STORE_PAGES.myaccount)&&void 0!==C&&C.permalink?g.STORE_PAGES.myaccount.permalink:(0,g.getSetting)("wpLoginUrl","/wp-login.php"),(0,g.getSetting)("localPickupEnabled",!1)),B=(0,g.getSetting)("countries",{}),M=(0,g.getSetting)("countryData",{}),O=Object.fromEntries(Object.keys(M).filter((e=>!0===M[e].allowBilling)).map((e=>[e,B[e]||""]))),D=Object.fromEntries(Object.keys(M).filter((e=>!0===M[e].allowBilling)).map((e=>[e,M[e].states||[]]))),L=Object.fromEntries(Object.keys(M).filter((e=>!0===M[e].allowShipping)).map((e=>[e,B[e]||""]))),F=Object.fromEntries(Object.keys(M).filter((e=>!0===M[e].allowShipping)).map((e=>[e,M[e].states||[]]))),V=Object.fromEntries(Object.keys(M).map((e=>[e,M[e].locale||[]]))),Y=()=>P>1,U=({imageUrl:e=`${N}/block-error.svg`,header:t=(0,c.__)("Oops!","woocommerce"),text:o=(0,c.__)("There was an error loading the content.","woocommerce"),errorMessage:n,errorMessagePrefix:s=(0,c.__)("Error:","woocommerce"),button:a,showErrorBlock:l=!0})=>l?(0,r.createElement)("div",{className:"wc-block-error wc-block-components-error"},e&&(0,r.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:e,alt:""}),(0,r.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},t&&(0,r.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},t),o&&(0,r.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},o),n&&(0,r.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",n),a&&(0,r.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},a))):null;o(4578);class $ extends m.Component{constructor(...e){super(...e),(0,p.Z)(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:(0,r.createElement)(r.Fragment,null,(0,r.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:o=!0,showErrorBlock:c=!0,text:n,errorMessagePrefix:s,renderError:a,button:l}=this.props,{errorMessage:i,hasError:u}=this.state;return u?"function"==typeof a?a({errorMessage:i}):(0,r.createElement)(U,{showErrorBlock:c,errorMessage:o?i:null,header:e,imageUrl:t,text:n,errorMessagePrefix:s,button:l}):this.props.children}}const j=$,z=window.wp.data,K=(0,m.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),H=()=>(0,m.useContext)(K),q=({children:e,currentPostId:t=0,previewData:o={},currentView:c="",isPreview:n=!1})=>{const s=(0,z.useSelect)((e=>t||e("core/editor").getCurrentPostId()),[t]),a=(0,m.useCallback)((e=>o&&e in o?o[e]:{}),[o]),l={isEditor:!0,currentPostId:s,currentView:c,previewData:o,getPreviewData:a,isPreview:n};return(0,r.createElement)(K.Provider,{value:l},e)},Z=window.wp.plugins,W=window.wc.wcBlocksData;var G=o(7180),Q=o.n(G);let X=function(e){return e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback",e}({});const J={},ee=(e=J,{type:t,eventType:o,id:r,callback:c,priority:n})=>{const s=e.hasOwnProperty(o)?new Map(e[o]):new Map;switch(t){case X.ADD_EVENT_CALLBACK:return s.set(r,{priority:n,callback:c}),{...e,[o]:s};case X.REMOVE_EVENT_CALLBACK:return s.delete(r),{...e,[o]:s}}},te=(e,t)=>(o,r=10)=>{const c=((e,t,o=10)=>({id:Math.floor(Math.random()*Date.now()).toString(),type:X.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:o}))(e,o,r);return t(c),()=>{var o;t((o=e,{id:c.id,type:X.REMOVE_EVENT_CALLBACK,eventType:o}))}},oe=(0,m.createContext)({onPaymentProcessing:()=>()=>()=>{},onPaymentSetup:()=>()=>()=>{}}),re=({children:e})=>{const{isProcessing:t,isIdle:o,isCalculating:c,hasError:n}=(0,z.useSelect)((e=>{const t=e(W.CHECKOUT_STORE_KEY);return{isProcessing:t.isProcessing(),isIdle:t.isIdle(),hasError:t.hasError(),isCalculating:t.isCalculating()}})),{isPaymentReady:s}=(0,z.useSelect)((e=>{const t=e(W.PAYMENT_STORE_KEY);return{isPaymentProcessing:t.isPaymentProcessing(),isPaymentReady:t.isPaymentReady()}})),{setValidationErrors:a}=(0,z.useDispatch)(W.VALIDATION_STORE_KEY),[l,i]=(0,m.useReducer)(ee,{}),{onPaymentSetup:u}=(e=>(0,m.useMemo)((()=>({onPaymentSetup:te("payment_setup",e)})),[e]))(i),d=(0,m.useRef)(l);(0,m.useEffect)((()=>{d.current=l}),[l]);const{__internalSetPaymentProcessing:p,__internalSetPaymentIdle:g,__internalEmitPaymentProcessingEvent:_}=(0,z.useDispatch)(W.PAYMENT_STORE_KEY);(0,m.useEffect)((()=>{!t||n||c||(p(),_(d.current,a))}),[t,n,c,p,_,a]),(0,m.useEffect)((()=>{o&&!s&&g()}),[o,s,g]),(0,m.useEffect)((()=>{n&&s&&g()}),[n,s,g]);const h={onPaymentProcessing:(0,m.useMemo)((()=>function(...e){return Q()("onPaymentProcessing",{alternative:"onPaymentSetup",plugin:"WooCommerce Blocks"}),u(...e)}),[u]),onPaymentSetup:u};return(0,r.createElement)(oe.Provider,{value:h},e)},ce={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},ne={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"},se={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:e=>e,shippingErrorTypes:ce,onShippingRateSuccess:()=>()=>{},onShippingRateFail:()=>()=>{},onShippingRateSelectSuccess:()=>()=>{},onShippingRateSelectFail:()=>()=>{}},ae=(e,{type:t})=>Object.values(ce).includes(t)?t:e,le="shipping_rates_success",ie="shipping_rates_fail",ue="shipping_rate_select_success",de="shipping_rate_select_fail",pe=e=>({onSuccess:te(le,e),onFail:te(ie,e),onSelectSuccess:te(ue,e),onSelectFail:te(de,e)});let me=function(e){return e.SUCCESS="success",e.FAIL="failure",e.ERROR="error",e}({}),ge=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}({});const _e=async(e,t,o)=>{const r=((e,t)=>e[t]?Array.from(e[t].values()).sort(((e,t)=>e.priority-t.priority)):[])(e,t),c=[];for(const e of r)try{const t=await Promise.resolve(e.callback(o));"object"==typeof t&&c.push(t)}catch(e){console.error(e)}return!c.length||c};var he=o(2991),be=o.n(he);const ke=window.wp.htmlEntities,we=e=>"number"==typeof e,Ee=e=>"string"==typeof e,ye=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,c.sprintf)(/* translators: %s Field label. */
|
||
(0,c.__)("%s (optional)","woocommerce"),e.label)),e.priority&&(we(e.priority)&&(t.index=e.priority),Ee(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},ve=Object.entries(V).map((([e,t])=>[e,Object.entries(t).map((([e,t])=>[e,ye(t)])).reduce(((e,[t,o])=>(e[t]=o,e)),{})])).reduce(((e,[t,o])=>(e[t]=o,e)),{}),fe=(e,t,o="")=>{const r=o&&void 0!==ve[o]?ve[o]:{};return e.map((e=>({key:e,...g.defaultAddressFields[e]||{},...r[e]||{},...t[e]||{}}))).sort(((e,t)=>e.index-t.index))},Ce=window.wp.url,Se=e=>{const t=Object.keys(g.defaultAddressFields),o=fe(t,{},e.country),r=Object.assign({},e);return o.forEach((({key:t="",hidden:o=!1})=>{o&&((e,t)=>e in t)(t,e)&&(r[t]="")})),r},Ne=e=>{if(0===Object.values(e).length)return null;const t="string"==typeof L[e.country]?(0,ke.decodeEntities)(L[e.country]):"",o="object"==typeof F[e.country]&&"string"==typeof F[e.country][e.state]?(0,ke.decodeEntities)(F[e.country][e.state]):e.state,r=[];r.push(e.postcode.toUpperCase()),r.push(e.city),r.push(o),r.push(t);return r.filter(Boolean).join(", ")||null},Pe=window.CustomEvent||null,xe=(e,t,o=!1,r=!1)=>{if("function"!=typeof jQuery)return()=>{};const c=()=>{((e,{bubbles:t=!1,cancelable:o=!1,element:r,detail:c={}})=>{if(!Pe)return;r||(r=document.body);const n=new Pe(e,{bubbles:t,cancelable:o,detail:c});r.dispatchEvent(n)})(t,{bubbles:o,cancelable:r})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)},Re=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||(0,z.dispatch)(W.CART_STORE_KEY).invalidateResolutionForStore()},Te=e=>{(null!=e&&e.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&(0,z.dispatch)(W.CART_STORE_KEY).invalidateResolutionForStore()},Ie=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},Ae={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},Be={...Ae,email:""},Me={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:W.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},Oe=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(0,ke.decodeEntities)(t)]))),De={cartCoupons:W.EMPTY_CART_COUPONS,cartItems:W.EMPTY_CART_ITEMS,cartFees:W.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:W.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:W.EMPTY_CART_ITEM_ERRORS,cartTotals:Me,cartIsLoading:!0,cartErrors:W.EMPTY_CART_ERRORS,billingAddress:Be,shippingAddress:Ae,shippingRates:W.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentMethods:W.EMPTY_PAYMENT_METHODS,paymentRequirements:W.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:W.EMPTY_EXTENSIONS},Le=(e={shouldSelect:!0})=>{const{isEditor:t,previewData:o}=H(),r=null==o?void 0:o.previewCart,{shouldSelect:c}=e,n=(0,m.useRef)();(0,m.useEffect)((()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),(null===(e=window.wcBlocksStoreCartListeners)||void 0===e?void 0:e.count)>0)return void window.wcBlocksStoreCartListeners.count++;var e;document.body.addEventListener("wc-blocks_added_to_cart",Re),document.body.addEventListener("wc-blocks_removed_from_cart",Re),window.addEventListener("pageshow",Te);const t=xe("added_to_cart","wc-blocks_added_to_cart"),o=xe("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",Re),document.body.removeEventListener("wc-blocks_removed_from_cart",Re),window.removeEventListener("pageshow",Te),t(),o()}})(),Ie)),[]);const s=(0,z.useSelect)(((e,{dispatch:o})=>{if(!c)return De;if(t)return{cartCoupons:r.coupons,cartItems:r.items,crossSellsProducts:r.cross_sells,cartFees:r.fees,cartItemsCount:r.items_count,cartItemsWeight:r.items_weight,cartNeedsPayment:r.needs_payment,cartNeedsShipping:r.needs_shipping,cartItemErrors:W.EMPTY_CART_ITEM_ERRORS,cartTotals:r.totals,cartIsLoading:!1,cartErrors:W.EMPTY_CART_ERRORS,billingData:Be,billingAddress:Be,shippingAddress:Ae,extensions:W.EMPTY_EXTENSIONS,shippingRates:r.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:r.has_calculated_shipping,paymentRequirements:r.paymentRequirements,receiveCart:"function"==typeof(null==r?void 0:r.receiveCart)?r.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==r?void 0:r.receiveCartContents)?r.receiveCartContents:()=>{}};const n=e(W.CART_STORE_KEY),s=n.getCartData(),a=n.getCartErrors(),l=n.getCartTotals(),i=!n.hasFinishedResolution("getCartData"),u=n.isCustomerDataUpdating(),{receiveCart:d,receiveCartContents:p}=o(W.CART_STORE_KEY),m=Oe(s.billingAddress),g=s.needsShipping?Oe(s.shippingAddress):m,_=s.fees.length>0?s.fees.map((e=>Oe(e))):W.EMPTY_CART_FEES,h=s.coupons.length>0?s.coupons.map((e=>({...e,label:e.code}))):W.EMPTY_CART_COUPONS;return{cartCoupons:h,cartItems:s.items,crossSellsProducts:s.crossSells,cartFees:_,cartItemsCount:s.itemsCount,cartItemsWeight:s.itemsWeight,cartNeedsPayment:s.needsPayment,cartNeedsShipping:s.needsShipping,cartItemErrors:s.errors,cartTotals:l,cartIsLoading:i,cartErrors:a,billingData:Se(m),billingAddress:Se(m),shippingAddress:Se(g),extensions:s.extensions,shippingRates:s.shippingRates,isLoadingRates:u,cartHasCalculatedShipping:s.hasCalculatedShipping,paymentRequirements:s.paymentRequirements,receiveCart:d,receiveCartContents:p}}),[c]);return n.current&&be()(n.current,s)||(n.current=s),n.current},Fe=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function Ve(e,t){return Fe(e)&&t in e}const Ye=(0,g.getSetting)("collectableMethodIds",[]),Ue=e=>Ye.includes(e.method_id),$e=e=>!!A&&(Array.isArray(e)?!!e.find((e=>Ye.includes(e))):Ye.includes(e));var je=o(9127),ze=o.n(je);const Ke=[{destination:{address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},package_id:0,name:(0,c.__)("Shipping","woocommerce"),items:[{key:"33e75ff09dd601bbe69f351039152189",name:(0,c._x)("Beanie with Logo","example product in Cart Block","woocommerce"),quantity:2},{key:"6512bd43d9caa6e02c990b0a82652dca",name:(0,c._x)("Beanie","example product in Cart Block","woocommerce"),quantity:1}],shipping_rates:[{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",name:(0,c.__)("Flat rate shipping","woocommerce"),description:"",delivery_time:"",price:"500",taxes:"0",rate_id:"flat_rate:0",instance_id:0,meta_data:[],method_id:"flat_rate",selected:!0},{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",name:(0,c.__)("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:!1},{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",name:(0,c.__)("Local pickup","woocommerce"),description:"",delivery_time:"",price:"0",taxes:"0",rate_id:"pickup_location:1",instance_id:1,meta_data:[{key:"pickup_location",value:"New York"},{key:"pickup_address",value:"123 Easy Street, New York, 12345"}],method_id:"pickup_location",selected:!1},{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",name:(0,c.__)("Local pickup","woocommerce"),description:"",delivery_time:"",price:"0",taxes:"0",rate_id:"pickup_location:2",instance_id:1,meta_data:[{key:"pickup_location",value:"Los Angeles"},{key:"pickup_address",value:"123 Easy Street, Los Angeles, California, 90210"}],method_id:"pickup_location",selected:!1}]}],He=(0,g.getSetting)("displayCartPricesIncludingTax",!1),qe={coupons:[],shipping_rates:(0,g.getSetting)("shippingMethodsExist",!1)||(0,g.getSetting)("localPickupEnabled",!1)?Ke:[],items:[{key:"1",id:1,type:"simple",quantity:2,catalog_visibility:"visible",name:(0,c.__)("Beanie","woocommerce"),summary:(0,c.__)("Beanie","woocommerce"),short_description:(0,c.__)("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:N+"previews/beanie.jpg",thumbnail:N+"previews/beanie.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,c.__)("Color","woocommerce"),value:(0,c.__)("Yellow","woocommerce")},{attribute:(0,c.__)("Size","woocommerce"),value:(0,c.__)("Small","woocommerce")}],prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"12000":"10000",regular_price:He?"12000":"10000",sale_price:He?"12000":"10000",price_range:null,raw_prices:{precision:6,price:He?"12000000":"10000000",regular_price:He?"12000000":"10000000",sale_price:He?"12000000":"10000000"}},totals:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",line_subtotal:"2000",line_subtotal_tax:"400",line_total:"2000",line_total_tax:"400"},extensions:{},item_data:[]},{key:"2",id:2,type:"simple",quantity:1,catalog_visibility:"visible",name:(0,c.__)("Cap","woocommerce"),summary:(0,c.__)("Cap","woocommerce"),short_description:(0,c.__)("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:N+"previews/cap.jpg",thumbnail:N+"previews/cap.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,c.__)("Color","woocommerce"),value:(0,c.__)("Orange","woocommerce")}],prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"2400":"2000",regular_price:He?"2400":"2000",sale_price:He?"2400":"2000",price_range:null,raw_prices:{precision:6,price:He?"24000000":"20000000",regular_price:He?"24000000":"20000000",sale_price:He?"24000000":"20000000"}},totals:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",line_subtotal:"2000",line_subtotal_tax:"400",line_total:"2000",line_total_tax:"400"},extensions:{},item_data:[]}],cross_sells:[{id:1,name:(0,c.__)("Polo","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-polo",short_description:(0,c.__)("Polo","woocommerce"),description:(0,c.__)("Polo","woocommerce"),on_sale:!1,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"24000":"20000",regular_price:He?"24000":"20000",sale_price:He?"12000":"10000",price_range:null},price_html:"",average_rating:"4.5",review_count:2,images:[{id:17,src:N+"previews/polo.jpg",thumbnail:N+"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,c.__)("Long Sleeve Tee","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-long-sleeve-tee",short_description:(0,c.__)("Long Sleeve Tee","woocommerce"),description:(0,c.__)("Long Sleeve Tee","woocommerce"),on_sale:!1,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"30000":"25000",regular_price:He?"30000":"25000",sale_price:He?"30000":"25000",price_range:null},price_html:"",average_rating:"4",review_count:2,images:[{id:17,src:N+"previews/long-sleeve-tee.jpg",thumbnail:N+"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,c.__)("Hoodie with Zipper","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-zipper",short_description:(0,c.__)("Hoodie with Zipper","woocommerce"),description:(0,c.__)("Hoodie with Zipper","woocommerce"),on_sale:!0,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"15000":"12500",regular_price:He?"30000":"25000",sale_price:He?"15000":"12500",price_range:null},price_html:"",average_rating:"1",review_count:2,images:[{id:17,src:N+"previews/hoodie-with-zipper.jpg",thumbnail:N+"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,c.__)("Hoodie with Logo","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-logo",short_description:(0,c.__)("Polo","woocommerce"),description:(0,c.__)("Polo","woocommerce"),on_sale:!1,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"4500":"4250",regular_price:He?"4500":"4250",sale_price:He?"4500":"4250",price_range:null},price_html:"",average_rating:"5",review_count:2,images:[{id:17,src:N+"previews/hoodie-with-logo.jpg",thumbnail:N+"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,c.__)("Hoodie with Pocket","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-pocket",short_description:(0,c.__)("Hoodie with Pocket","woocommerce"),description:(0,c.__)("Hoodie with Pocket","woocommerce"),on_sale:!0,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"3500":"3250",regular_price:He?"4500":"4250",sale_price:He?"3500":"3250",price_range:null},price_html:"",average_rating:"3.75",review_count:4,images:[{id:17,src:N+"previews/hoodie-with-pocket.jpg",thumbnail:N+"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,c.__)("T-Shirt","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-t-shirt",short_description:(0,c.__)("T-Shirt","woocommerce"),description:(0,c.__)("T-Shirt","woocommerce"),on_sale:!1,prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:He?"1800":"1500",regular_price:He?"1800":"1500",sale_price:He?"1800":"1500",price_range:null},price_html:"",average_rating:"3",review_count:2,images:[{id:17,src:N+"previews/tshirt.jpg",thumbnail:N+"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,c.__)("Fee","woocommerce"),totals:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",total:"100",total_tax:"20"}}],items_count:3,items_weight:0,needs_payment:!0,needs_shipping:(0,g.getSetting)("shippingEnabled",!0),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:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",total_items:"4000",total_items_tax:"800",total_fees:"100",total_fees_tax:"20",total_discount:"0",total_discount_tax:"0",total_shipping:"0",total_shipping_tax:"0",total_tax:"820",total_price:"4920",tax_lines:[{name:(0,c.__)("Sales tax","woocommerce"),rate:"20%",price:"820"}]},errors:[],payment_methods:["cod","bacs","cheque"],payment_requirements:["products"],extensions:{}},Ze=window.wp.hooks,We=()=>({dispatchStoreEvent:(0,m.useCallback)(((e,t={})=>{try{(0,Ze.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:(0,m.useCallback)(((e,t={})=>{try{(0,Ze.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,z.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}}),[])}),Ge=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:r,isCollectable:c,isSelectingRate:n}=(0,z.useSelect)((e=>{const t=!!e("core/editor"),o=e(W.CART_STORE_KEY),r=t?qe.shipping_rates:o.getShippingRates();return{shippingRates:r,needsShipping:t?qe.needs_shipping:o.getNeedsShipping(),hasCalculatedShipping:t?qe.has_calculated_shipping:o.getHasCalculatedShipping(),isLoadingRates:!t&&o.isCustomerDataUpdating(),isCollectable:r.every((({shipping_rates:e})=>e.find((({method_id:e})=>$e(e))))),isSelectingRate:!t&&o.isShippingRateBeingSelected()}})),s=(0,m.useRef)({});(0,m.useEffect)((()=>{const t=(e=>Object.fromEntries(e.map((({package_id:e,shipping_rates:t})=>{var o;return[e,(null===(o=t.find((e=>e.selected)))||void 0===o?void 0:o.rate_id)||""]}))))(e);Fe(t)&&!ze()(s.current,t)&&(s.current=t)}),[e]);const{selectShippingRate:a}=(0,z.useDispatch)(W.CART_STORE_KEY),l=$e(Object.values(s.current).map((e=>e.split(":")[0]))),{dispatchCheckoutEvent:i}=We(),u=(0,m.useCallback)(((e,t)=>{let o;void 0!==e&&(o=$e(e.split(":")[0])?a(e,null):a(e,t),o.then((()=>{i("set-selected-shipping-rate",{shippingRateId:e})})).catch((e=>{(0,W.processErrorResponse)(e)})))}),[a,i]);return{isSelectingRate:n,selectedRates:s.current,selectShippingRate:u,shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:r,isCollectable:c,hasSelectedLocalPickup:l}},{NONE:Qe,INVALID_ADDRESS:Xe,UNKNOWN:Je}=ce,et=(0,m.createContext)(se),tt=()=>(0,m.useContext)(et),ot=({children:e})=>{const{__internalIncrementCalculating:t,__internalDecrementCalculating:o}=(0,z.useDispatch)(W.CHECKOUT_STORE_KEY),{shippingRates:c,isLoadingRates:n,cartErrors:s}=Le(),{selectedRates:a,isSelectingRate:l}=Ge(),[i,u]=(0,m.useReducer)(ae,Qe),[d,p]=(0,m.useReducer)(ee,{}),g=(0,m.useRef)(d),_=(0,m.useMemo)((()=>({onShippingRateSuccess:pe(p).onSuccess,onShippingRateFail:pe(p).onFail,onShippingRateSelectSuccess:pe(p).onSelectSuccess,onShippingRateSelectFail:pe(p).onSelectFail})),[p]);(0,m.useEffect)((()=>{g.current=d}),[d]),(0,m.useEffect)((()=>{n?t():o()}),[n,t,o]),(0,m.useEffect)((()=>{l?t():o()}),[t,o,l]),(0,m.useEffect)((()=>{s.length>0&&s.some((e=>!(!e.code||!Object.values(ne).includes(e.code))))?u({type:Xe}):u({type:Qe})}),[s]);const h=(0,m.useMemo)((()=>({isPristine:i===Qe,isValid:i===Qe,hasInvalidAddress:i===Xe,hasError:i===Je||i===Xe})),[i]);(0,m.useEffect)((()=>{n||0!==c.length&&!h.hasError||_e(g.current,ie,{hasInvalidAddress:h.hasInvalidAddress,hasError:h.hasError})}),[c,n,h.hasError,h.hasInvalidAddress]),(0,m.useEffect)((()=>{!n&&c.length>0&&!h.hasError&&_e(g.current,le,c)}),[c,n,h.hasError]),(0,m.useEffect)((()=>{l||(h.hasError?_e(g.current,de,{hasError:h.hasError,hasInvalidAddress:h.hasInvalidAddress}):_e(g.current,ue,a.current))}),[a,l,h.hasError,h.hasInvalidAddress]);const b={shippingErrorStatus:h,dispatchErrorStatus:u,shippingErrorTypes:ce,..._};return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(et.Provider,{value:b},e))};function rt(e,t){const o=(0,m.useRef)();return(0,m.useEffect)((()=>{o.current===e||t&&!t(e,o.current)||(o.current=e)}),[e,t]),o.current}const ct={},nt={},st=()=>ct,at=()=>nt,lt=(0,m.createContext)({onSubmit:()=>{},onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},onCheckoutSuccess:()=>()=>{},onCheckoutFail:()=>()=>{},onCheckoutValidation:()=>()=>{}}),it=()=>(0,m.useContext)(lt),ut=({children:e,redirectUrl:t})=>{const o=st(),c=at(),{isEditor:n}=H(),{__internalUpdateAvailablePaymentMethods:s}=(0,z.useDispatch)(W.PAYMENT_STORE_KEY);(0,m.useEffect)((()=>{(n||0!==Object.keys(o).length||0!==Object.keys(c).length)&&s()}),[n,o,c,s]);const{__internalSetRedirectUrl:a,__internalEmitValidateEvent:l,__internalEmitAfterProcessingEvents:i,__internalSetBeforeProcessing:u}=(0,z.useDispatch)(W.CHECKOUT_STORE_KEY),{checkoutRedirectUrl:d,checkoutStatus:p,isCheckoutBeforeProcessing:g,isCheckoutAfterProcessing:_,checkoutHasError:h,checkoutOrderId:b,checkoutOrderNotes:k,checkoutCustomerId:w}=(0,z.useSelect)((e=>{const t=e(W.CHECKOUT_STORE_KEY);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!==d&&a(t);const{setValidationErrors:E}=(0,z.useDispatch)(W.VALIDATION_STORE_KEY),{dispatchCheckoutEvent:y}=We(),{checkoutNotices:v,paymentNotices:f,expressPaymentNotices:C}=(0,z.useSelect)((e=>{const{getNotices:t}=e("core/notices");return{checkoutNotices:Object.values(ge).filter((e=>e!==ge.PAYMENTS&&e!==ge.EXPRESS_PAYMENTS)).reduce(((e,o)=>[...e,...t(o)]),[]),paymentNotices:t(ge.PAYMENTS),expressPaymentNotices:t(ge.EXPRESS_PAYMENTS)}}),[]),[S,N]=(0,m.useReducer)(ee,{}),P=(0,m.useRef)(S),{onCheckoutValidation:x,onCheckoutSuccess:R,onCheckoutFail:T}=(e=>(0,m.useMemo)((()=>({onCheckoutSuccess:te("checkout_success",e),onCheckoutFail:te("checkout_fail",e),onCheckoutValidation:te("checkout_validation",e)})),[e]))(N);(0,m.useEffect)((()=>{P.current=S}),[S]);const I=(0,m.useMemo)((()=>function(...e){return Q()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidation",plugin:"WooCommerce Blocks"}),x(...e)}),[x]),A=(0,m.useMemo)((()=>function(...e){return Q()("onCheckoutValidationBeforeProcessing",{since:"9.7.0",alternative:"onCheckoutValidation",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),x(...e)}),[x]),B=(0,m.useMemo)((()=>function(...e){return Q()("onCheckoutAfterProcessingWithSuccess",{since:"9.7.0",alternative:"onCheckoutSuccess",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),R(...e)}),[R]),M=(0,m.useMemo)((()=>function(...e){return Q()("onCheckoutAfterProcessingWithError",{since:"9.7.0",alternative:"onCheckoutFail",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),T(...e)}),[T]);(0,m.useEffect)((()=>{g&&l({observers:P.current,setValidationErrors:E})}),[g,E,l]);const O=rt(p),D=rt(h);(0,m.useEffect)((()=>{p===O&&h===D||_&&i({observers:P.current,notices:{checkoutNotices:v,paymentNotices:f,expressPaymentNotices:C}})}),[p,h,d,b,w,k,_,g,O,D,v,C,f,l,i]);const L={onSubmit:(0,m.useCallback)((()=>{y("submit"),u()}),[y,u]),onCheckoutBeforeProcessing:I,onCheckoutValidationBeforeProcessing:A,onCheckoutAfterProcessingWithSuccess:B,onCheckoutAfterProcessingWithError:M,onCheckoutSuccess:R,onCheckoutFail:T,onCheckoutValidation:x};return(0,r.createElement)(lt.Provider,{value:L},e)},dt=window.wp.apiFetch;var pt=o.n(dt);(0,c.__)("Something went wrong. Please contact us to get assistance.","woocommerce");const mt=window.wc.wcBlocksRegistry,gt=(e,t,o)=>{const r=Object.keys(e).map((t=>({key:t,value:e[t]})),[]),c=`wc-${o}-new-payment-method`;return r.push({key:c,value:t}),r},_t=e=>{if(!e)return;const{__internalSetCustomerId:t}=(0,z.dispatch)(W.CHECKOUT_STORE_KEY);pt().setNonce&&"function"==typeof pt().setNonce&&pt().setNonce(e),null!=e&&e.get("User-ID")&&t(parseInt(e.get("User-ID")||"0",10))},ht=()=>{const{onCheckoutValidation:e}=it(),{hasError:t,redirectUrl:o,isProcessing:r,isBeforeProcessing:n,isComplete:s,orderNotes:a,shouldCreateAccount:l,extensionData:i,customerId:u}=(0,z.useSelect)((e=>{const t=e(W.CHECKOUT_STORE_KEY);return{hasError:t.hasError(),redirectUrl:t.getRedirectUrl(),isProcessing:t.isProcessing(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),orderNotes:t.getOrderNotes(),shouldCreateAccount:t.getShouldCreateAccount(),extensionData:t.getExtensionData(),customerId:t.getCustomerId()}})),{__internalSetHasError:d,__internalProcessCheckoutResponse:p}=(0,z.useDispatch)(W.CHECKOUT_STORE_KEY),g=(0,z.useSelect)((e=>e(W.VALIDATION_STORE_KEY).hasValidationErrors)),{shippingErrorStatus:_}=tt(),{billingAddress:h,shippingAddress:b}=(0,z.useSelect)((e=>e(W.CART_STORE_KEY).getCustomerData())),{cartNeedsPayment:k,cartNeedsShipping:w,receiveCartContents:E}=Le(),{activePaymentMethod:y,paymentMethodData:v,isExpressPaymentMethodActive:f,hasPaymentError:C,isPaymentReady:S,shouldSavePayment:N}=(0,z.useSelect)((e=>{const t=e(W.PAYMENT_STORE_KEY);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),hasPaymentError:t.hasPaymentError(),isPaymentReady:t.isPaymentReady(),shouldSavePayment:t.getShouldSavePaymentMethod()}}),[]),P=(0,mt.getPaymentMethods)(),x=(0,mt.getExpressPaymentMethods)(),R=(0,m.useRef)(h),T=(0,m.useRef)(b),I=(0,m.useRef)(o),[A,B]=(0,m.useState)(!1),M=(0,m.useMemo)((()=>{var e;const t={...x,...P};return null==t||null===(e=t[y])||void 0===e?void 0:e.paymentMethodId}),[y,x,P]),O=g()&&!f||C||_.hasError,D=!t&&!O&&(S||!k)&&r;(0,m.useEffect)((()=>{O===t||!r&&!n||f||d(O)}),[O,t,r,n,f,d]),(0,m.useEffect)((()=>{R.current=h,T.current=b,I.current=o}),[h,b,o]);const L=(0,m.useCallback)((()=>g()?void 0!==(0,z.select)(W.VALIDATION_STORE_KEY).getValidationError("shipping-rates-error")&&{errorMessage:(0,c.__)("Sorry, this order requires a shipping option.","woocommerce")}:C?{errorMessage:(0,c.__)("There was a problem with your payment option.","woocommerce"),context:"wc/checkout/payments"}:!_.hasError||{errorMessage:(0,c.__)("There was a problem with your shipping option.","woocommerce"),context:"wc/checkout/shipping-methods"}),[g,C,_.hasError]);(0,m.useEffect)((()=>{let t;return f||(t=e(L,0)),()=>{f||"function"!=typeof t||t()}}),[e,L,f]),(0,m.useEffect)((()=>{I.current&&(window.location.href=I.current)}),[s]);const F=(0,m.useCallback)((async()=>{if(A)return;B(!0),(()=>{const e=(0,z.select)("wc/store/store-notices").getRegisteredContainers(),{removeNotice:t}=(0,z.dispatch)("core/notices"),{getNotices:o}=(0,z.select)("core/notices");e.forEach((e=>{o(e).forEach((o=>{t(o.id,e)}))}))})();const e=k?{payment_method:M,payment_data:gt(v,N,y)}:{},t={shipping_address:w?Se(T.current):void 0,billing_address:Se(R.current),customer_note:a,create_account:l,...e,extensions:{...i}};pt()({path:"/wc/store/v1/checkout",method:"POST",data:t,cache:"no-store",parse:!1}).then((e=>{if(function(e){if("object"!=typeof e||null===e||!("body"in e)||!("headers"in e))throw new Error("Response not valid")}(e),_t(e.headers),!e.ok)throw e;return e.json()})).then((e=>{p(e),B(!1)})).catch((e=>{_t(null==e?void 0:e.headers);try{e.json().then((e=>e)).then((e=>{var t;null!==(t=e.data)&&void 0!==t&&t.cart&&E(e.data.cart),(0,W.processErrorResponse)(e),p(e)}))}catch{let e=(0,c.__)("Something went wrong when placing the order. Check your email for order updates before retrying.","woocommerce");0!==u&&(e=(0,c.__)("Something went wrong when placing the order. Check your account's order history or your email for order updates before retrying.","woocommerce")),(0,W.processErrorResponse)({code:"unknown_error",message:e,data:null})}d(!0),B(!1)}))}),[A,k,M,v,N,y,a,l,i,w,E,d,p]);return(0,m.useEffect)((()=>{D&&!A&&F()}),[F,D,A]),null},bt=({children:e,redirectUrl:t})=>(0,r.createElement)(ut,{redirectUrl:t},(0,r.createElement)(ot,null,(0,r.createElement)(re,null,e,(0,r.createElement)(j,{renderError:g.CURRENT_USER_IS_ADMIN?null:()=>null},(0,r.createElement)(Z.PluginArea,{scope:"woocommerce-checkout"})),(0,r.createElement)(ht,null)))),kt=({children:e,redirectUrl:t})=>(0,r.createElement)(bt,{redirectUrl:t},e),wt=window.wc.blocksCheckout,Et=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("g",{fill:"none",fillRule:"evenodd"},(0,r.createElement)("path",{d:"M0 0h24v24H0z"}),(0,r.createElement)("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 yt=o(4333);const vt=(0,m.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),ft=({children:e,className:t=""})=>{const[o,c]=(()=>{const[e,{width:t}]=(0,yt.useResizeObserver)();let o="";return t>700?o="is-large":t>520?o="is-medium":t>400?o="is-small":t&&(o="is-mobile"),[e,o]})(),n={hasContainerWidth:""!==c,containerClassName:c,isMobile:"is-mobile"===c,isSmall:"is-small"===c,isMedium:"is-medium"===c,isLarge:"is-large"===c};return(0,r.createElement)(vt.Provider,{value:n},(0,r.createElement)("div",{className:s()(t,c)},o,e))};o(6430);const Ct=({children:e,className:t})=>(0,r.createElement)(ft,{className:s()("wc-block-components-sidebar-layout",t)},e),St=["core/paragraph","core/image","core/separator"],Nt=e=>{const t=(0,wt.applyCheckoutFilter)({filterName:"additionalCartCheckoutInnerBlockTypes",defaultValue:[],extensions:(0,z.select)(W.CART_STORE_KEY).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,d.getBlockTypes)().filter((t=>((null==t?void 0:t.parent)||[]).includes(e))).map((({name:e})=>e)),...St,...t]))},Pt=({clientId:e,registeredBlocks:t,defaultTemplate:o=[]})=>{const r=(0,m.useRef)(t),c=(0,m.useRef)(o),n=(0,z.useRegistry)(),{isPreview:s}=H();(0,m.useEffect)((()=>{let t=!1;if(s)return;const{replaceInnerBlocks:o}=(0,z.dispatch)("core/block-editor");return n.subscribe((()=>{if(!n.select("core/block-editor").getBlock(e))return;const s=n.select("core/block-editor").getBlocks(e);if(0===s.length&&c.current.length>0&&!t){const r=(0,d.createBlocksFromInnerBlocksTemplate)(c.current);if(0!==r.length)return t=!0,void o(e,r)}const a=r.current.map((e=>(0,d.getBlockType)(e))),l=((e,t)=>{const o=t.filter((e=>e&&(({attributes:e})=>{var t,o,r;return Boolean((null===(t=e.lock)||void 0===t?void 0:t.remove)||(null===(o=e.lock)||void 0===o||null===(r=o.default)||void 0===r?void 0:r.remove))})(e))),r=[];return o.forEach((t=>{if(void 0===t)return;const o=e.find((e=>e.name===t.name));o||r.push(t)})),r})(s,a);if(0===l.length)return;let i=-1;const u=l.map((e=>{const t=c.current.findIndex((([t])=>t===e.name)),o=(0,d.createBlock)(e.name);return-1===i&&(i=(({defaultTemplatePosition:e,innerBlocks:t,currentDefaultTemplate:o})=>{switch(e){case-1:return t.length;case 0:return 0;default:const r=o.current[e-1],c=t.findIndex((({name:e})=>e===r[0]));return-1===c?e:c+1}})({defaultTemplatePosition:t,innerBlocks:s,currentDefaultTemplate:c})),o}));n.batch((()=>{n.dispatch("core/block-editor").insertBlocks(u,i,e)}))}),"core/block-editor")}),[e,s,n])};o(7463);const xt=(0,m.createContext)({hasDarkControls:!1});(0,d.registerBlockType)("woocommerce/filled-cart-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Et,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,a.useBlockProps)(),{currentView:o}=H(),{hasDarkControls:c}=(0,m.useContext)(xt),n=Nt(wt.innerBlockAreas.FILLED_CART),l=[["woocommerce/cart-items-block",{},[]],["woocommerce/cart-totals-block",{},[]]];return Pt({clientId:e,registeredBlocks:n,defaultTemplate:l}),(0,r.createElement)("div",{...t,hidden:"woocommerce/filled-cart-block"!==o},(0,r.createElement)(Ct,{className:s()("wc-block-cart",{"has-dark-controls":c})},(0,r.createElement)(a.InnerBlocks,{allowedBlocks:n,template:l,templateLock:"insert"})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});var Rt=o(5921);const Tt=(0,m.forwardRef)((({children:e,className:t=""},o)=>(0,r.createElement)("div",{ref:o,className:s()("wc-block-components-main",t)},e)));(0,d.registerBlockType)("woocommerce/cart-items-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Rt.Z,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,a.useBlockProps)({className:"wc-block-cart__main"}),o=Nt(wt.innerBlockAreas.CART_ITEMS),c=[["woocommerce/cart-line-items-block",{},[]],["woocommerce/cart-cross-sells-block",{},[]]];return Pt({clientId:e,registeredBlocks:o,defaultTemplate:c}),(0,r.createElement)(Tt,{...t},(0,r.createElement)(a.InnerBlocks,{allowedBlocks:o,template:c,templateLock:!1,renderAppender:a.InnerBlocks.ButtonBlockAppender}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});var It=o(5904),At=o(4697);const Bt=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"],Mt=({children:e,style:t={},...o})=>{const c=(0,m.useRef)(null),n=()=>{c.current&&It.focus.focusable.find(c.current).forEach((e=>{Bt.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")}))},s=(0,At.y1)(n,0,{leading:!0});return(0,m.useLayoutEffect)((()=>{let e;return n(),c.current&&(e=new window.MutationObserver(s),e.observe(c.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),s.cancel()}}),[s]),(0,r.createElement)("div",{ref:c,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...o},e)};var Ot=o(5158),Dt=o(9630);o(4667);const Lt=({className:e,quantity:t=1,minimum:o=1,maximum:n,onChange:a=(()=>{}),step:l=1,itemName:i="",disabled:u})=>{const d=s()("wc-block-components-quantity-selector",e),p=(0,m.useRef)(null),g=(0,m.useRef)(null),_=(0,m.useRef)(null),h=void 0!==n,b=!u&&t-l>=o,k=!u&&(!h||t+l<=n),w=(0,m.useCallback)((e=>{let t=e;h&&(t=Math.min(t,Math.floor(n/l)*l)),t=Math.max(t,Math.ceil(o/l)*l),t=Math.floor(t/l)*l,t!==e&&a(t)}),[h,n,o,a,l]),E=(0,At.y1)(w,300);(0,m.useLayoutEffect)((()=>{w(t)}),[t,w]);const y=(0,m.useCallback)((e=>{const o=void 0!==typeof e.key?"ArrowDown"===e.key:e.keyCode===Dt.DOWN,r=void 0!==typeof e.key?"ArrowUp"===e.key:e.keyCode===Dt.UP;o&&b&&(e.preventDefault(),a(t-l)),r&&k&&(e.preventDefault(),a(t+l))}),[t,a,k,b,l]);return(0,r.createElement)("div",{className:d},(0,r.createElement)("input",{ref:p,className:"wc-block-components-quantity-selector__input",disabled:u,type:"number",step:l,min:o,max:n,value:t,onKeyDown:y,onChange:e=>{let o=parseInt(e.target.value,10);o=isNaN(o)?t:o,o!==t&&(a(o),E(o))},"aria-label":(0,c.sprintf)(/* translators: %s refers to the item name in the cart. */
|
||
(0,c.__)("Quantity of %s in your cart.","woocommerce"),i)}),(0,r.createElement)("button",{ref:g,"aria-label":(0,c.sprintf)(/* translators: %s refers to the item name in the cart. */
|
||
(0,c.__)("Reduce quantity of %s","woocommerce"),i),className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--minus",disabled:!b,onClick:()=>{const e=t-l;a(e),(0,Ot.speak)((0,c.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */
|
||
(0,c.__)("Quantity reduced to %s.","woocommerce"),e)),w(e)}},"-"),(0,r.createElement)("button",{ref:_,"aria-label":(0,c.sprintf)(/* translators: %s refers to the item's name in the cart. */
|
||
(0,c.__)("Increase quantity of %s","woocommerce"),i),disabled:!k,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=t+l;a(e),(0,Ot.speak)((0,c.sprintf)(/* translators: %s refers to the item's new quantity in the cart. */
|
||
(0,c.__)("Quantity increased to %s.","woocommerce"),e)),w(e)}},"+"))},Ft=window.wc.blocksComponents,Vt=window.wc.priceFormat;o(5138);const Yt=({currency:e,maxPrice:t,minPrice:o,priceClassName:n,priceStyle:a={}})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"screen-reader-text"},(0,c.sprintf)(/* translators: %1$s min price, %2$s max price */
|
||
(0,c.__)("Price between %1$s and %2$s","woocommerce"),(0,Vt.formatPrice)(o),(0,Vt.formatPrice)(t))),(0,r.createElement)("span",{"aria-hidden":!0},(0,r.createElement)(Ft.FormattedMonetaryAmount,{className:s()("wc-block-components-product-price__value",n),currency:e,value:o,style:a})," — ",(0,r.createElement)(Ft.FormattedMonetaryAmount,{className:s()("wc-block-components-product-price__value",n),currency:e,value:t,style:a}))),Ut=({currency:e,regularPriceClassName:t,regularPriceStyle:o,regularPrice:n,priceClassName:a,priceStyle:l,price:i})=>(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"screen-reader-text"},(0,c.__)("Previous price:","woocommerce")),(0,r.createElement)(Ft.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,r.createElement)("del",{className:s()("wc-block-components-product-price__regular",t),style:o},e),value:n}),(0,r.createElement)("span",{className:"screen-reader-text"},(0,c.__)("Discounted price:","woocommerce")),(0,r.createElement)(Ft.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",a),style:l},e),value:i})),$t=({align:e,className:t,currency:o,format:c="<price/>",maxPrice:n,minPrice:a,price:l,priceClassName:i,priceStyle:u,regularPrice:d,regularPriceClassName:p,regularPriceStyle:g,style:_})=>{const h=s()(t,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});c.includes("<price/>")||(c="<price/>",console.error("Price formats need to include the `<price/>` tag."));const b=d&&l&&l<d;let k=(0,r.createElement)("span",{className:s()("wc-block-components-product-price__value",i)});return b?k=(0,r.createElement)(Ut,{currency:o,price:l,priceClassName:i,priceStyle:u,regularPrice:d,regularPriceClassName:p,regularPriceStyle:g}):void 0!==a&&void 0!==n?k=(0,r.createElement)(Yt,{currency:o,maxPrice:n,minPrice:a,priceClassName:i,priceStyle:u}):l&&(k=(0,r.createElement)(Ft.FormattedMonetaryAmount,{className:s()("wc-block-components-product-price__value",i),currency:o,value:l,style:u})),(0,r.createElement)("span",{className:h,style:_},(0,m.createInterpolateElement)(c,{price:k}))};o(5641);const jt=({className:e="",disabled:t=!1,name:o,permalink:c="",target:n,rel:a,style:l,onClick:i,...u})=>{const d=s()("wc-block-components-product-name",e);if(t){const e=u;return(0,r.createElement)("span",{className:d,...e,dangerouslySetInnerHTML:{__html:(0,ke.decodeEntities)(o)}})}return(0,r.createElement)("a",{className:d,href:c,target:n,...u,dangerouslySetInnerHTML:{__html:(0,ke.decodeEntities)(o)},style:l})};var zt=o(8508);o(6315);const Kt=({children:e,className:t})=>(0,r.createElement)("div",{className:s()("wc-block-components-product-badge",t)},e),Ht=()=>(0,r.createElement)(Kt,{className:"wc-block-components-product-backorder-badge"},(0,c.__)("Available on backorder","woocommerce")),qt=({image:e={},fallbackAlt:t=""})=>{const o=e.thumbnail?{src:e.thumbnail,alt:(0,ke.decodeEntities)(e.alt)||t||"Product Image"}:{src:g.PLACEHOLDER_IMG_SRC,alt:""};return(0,r.createElement)("img",{...o,alt:o.alt})},Zt=({lowStockRemaining:e})=>e?(0,r.createElement)(Kt,{className:"wc-block-components-product-low-stock-badge"},(0,c.sprintf)(/* translators: %d stock amount (number of items in stock for product) */
|
||
(0,c.__)("%d left in stock","woocommerce"),e)):null;var Wt=o(9784);o(7984);const Gt=({details:e=[]})=>Array.isArray(e)?0===(e=e.filter((e=>!e.hidden))).length?null:(0,r.createElement)("ul",{className:"wc-block-components-product-details"},e.map((e=>{const t=(null==e?void 0:e.key)||e.name||"",o=(null==e?void 0:e.className)||(t?`wc-block-components-product-details__${(0,Wt.o)(t)}`:"");return(0,r.createElement)("li",{key:t+(e.display||e.value),className:o},t&&(0,r.createElement)(r.Fragment,null,(0,r.createElement)("span",{className:"wc-block-components-product-details__name"},(0,ke.decodeEntities)(t),":")," "),(0,r.createElement)("span",{className:"wc-block-components-product-details__value"},(0,ke.decodeEntities)(e.display||e.value)))}))):null,Qt=window.wp.autop,Xt=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),Jt=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,eo=window.wp.wordcount,to=({source:e,maxLength:t=15,countType:o="words",className:c="",style:n={}})=>{const s=(0,m.useMemo)((()=>((e,t=15,o="words")=>{const r=(0,Qt.autop)(e);if((0,eo.count)(r,o)<=t)return r;const c=(e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)})(r);return(0,eo.count)(c,o)<=t?c:"words"===o?((e,t,o="…",r=!0)=>{const c=Xt(e),n=c.split(" ").splice(0,t).join(" ");return n===c?r?(0,Qt.autop)(c):c:r?(0,Qt.autop)(Jt(n,o)):Jt(n,o)})(c,t):((e,t,o=!0,r="…",c=!0)=>{const n=Xt(e),s=n.slice(0,t);if(s===n)return c?(0,Qt.autop)(n):n;if(o)return(0,Qt.autop)(Jt(s,r));const a=s.match(/([\s]+)/g),l=a?a.length:0,i=n.slice(0,t+l);return c?(0,Qt.autop)(Jt(i,r)):Jt(i,r)})(c,t,"characters_including_spaces"===o)})(e,t,o)),[e,t,o]);return(0,r.createElement)(m.RawHTML,{style:n,className:c},s)},oo=({className:e,shortDescription:t="",fullDescription:o=""})=>{const c=t||o;return c?(0,r.createElement)(to,{className:e,source:c,maxLength:15,countType:S.wordCountType||"words"}):null};o(9889);const ro=({shortDescription:e="",fullDescription:t="",itemData:o=[],variation:c=[]})=>(0,r.createElement)("div",{className:"wc-block-components-product-metadata"},(0,r.createElement)(oo,{className:"wc-block-components-product-metadata__description",shortDescription:e,fullDescription:t}),(0,r.createElement)(Gt,{details:o}),(0,r.createElement)(Gt,{details:c.map((({attribute:e="",value:t})=>({key:e,value:t})))})),co=({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 n=(0,c.sprintf)(/* translators: %s will be replaced by the discount amount */
|
||
(0,c.__)("Save %s","woocommerce"),o);return(0,r.createElement)(Kt,{className:"wc-block-components-sale-badge"},(0,m.createInterpolateElement)(n,{price:(0,r.createElement)(Ft.FormattedMonetaryAmount,{currency:e,value:t})}))},no=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),so=e=>(0,wt.mustContain)(e,"<price/>"),ao=(0,m.forwardRef)((({lineItem:e,onRemove:t=(()=>{}),tabIndex:o},n)=>{const{name:a="",catalog_visibility:l="visible",short_description:i="",description:u="",low_stock_remaining:d=null,show_backorder_badge:p=!1,quantity_limits:_={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:h=!1,permalink:b="",images:k=[],variation:w=[],item_data:E=[],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:v={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:C,setItemQuantity:S,removeItem:N,isPendingDelete:P}=(e=>{const t={key:"",quantity:1};(e=>Fe(e)&&Ve(e,"key")&&Ve(e,"quantity")&&Ee(e.key)&&we(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:o="",quantity:r=1}=t,{cartErrors:c}=Le(),{__internalIncrementCalculating:n,__internalDecrementCalculating:s}=(0,z.useDispatch)(W.CHECKOUT_STORE_KEY),[a,l]=(0,m.useState)(r),[i]=(0,At.Nr)(a,400),u=rt(i),{removeItemFromCart:d,changeCartItemQuantity:p}=(0,z.useDispatch)(W.CART_STORE_KEY);(0,m.useEffect)((()=>l(r)),[r]);const g=(0,z.useSelect)((e=>{if(!o)return{quantity:!1,delete:!1};const t=e(W.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(o),delete:t.isItemPendingDelete(o)}}),[o]),_=(0,m.useCallback)((()=>o?d(o).catch((e=>{(0,W.processErrorResponse)(e)})):Promise.resolve(!1)),[o,d]);return(0,m.useEffect)((()=>{o&&we(u)&&Number.isFinite(u)&&u!==i&&p(o,i).catch((e=>{(0,W.processErrorResponse)(e)}))}),[o,p,i,u]),(0,m.useEffect)((()=>(g.delete?n():s(),()=>{g.delete&&s()})),[s,n,g.delete]),(0,m.useEffect)((()=>(g.quantity||i!==a?n():s(),()=>{(g.quantity||i!==a)&&s()})),[n,s,g.quantity,i,a]),{isPendingDelete:g.delete,quantity:a,setItemQuantity:l,removeItem:_,cartItemQuantityErrors:c}})(e),{dispatchStoreEvent:x}=We(),{receiveCart:R,...T}=Le(),I=(0,m.useMemo)((()=>({context:"cart",cartItem:e,cart:T})),[e,T]),A=(0,Vt.getCurrencyFromPriceResponse)(y),B=(0,wt.applyCheckoutFilter)({filterName:"itemName",defaultValue:a,extensions:f,arg:I}),M=(0,zt.Z)({amount:parseInt(y.raw_prices.regular_price,10),precision:y.raw_prices.precision}),O=(0,zt.Z)({amount:parseInt(y.raw_prices.price,10),precision:y.raw_prices.precision}),D=M.subtract(O),L=D.multiply(C),F=(0,Vt.getCurrencyFromPriceResponse)(v);let V=parseInt(v.line_subtotal,10);(0,g.getSetting)("displayCartPricesIncludingTax",!1)&&(V+=parseInt(v.line_subtotal_tax,10));const Y=(0,zt.Z)({amount:V,precision:F.minorUnit}),U=k.length?k[0]:{},$="hidden"===l||"search"===l,j=(0,wt.applyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:f,arg:I}),K=(0,wt.applyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:f,arg:I,validation:so}),H=(0,wt.applyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:f,arg:I,validation:so}),q=(0,wt.applyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:f,arg:I,validation:so}),Z=(0,wt.applyCheckoutFilter)({filterName:"showRemoveItemLink",defaultValue:!0,extensions:f,arg:I});return(0,r.createElement)("tr",{className:s()("wc-block-cart-items__row",j,{"is-disabled":P}),ref:n,tabIndex:o},(0,r.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Ve(U,"alt")||!U.alt},$?(0,r.createElement)(qt,{image:U,fallbackAlt:B}):(0,r.createElement)("a",{href:b,tabIndex:-1},(0,r.createElement)(qt,{image:U,fallbackAlt:B}))),(0,r.createElement)("td",{className:"wc-block-cart-item__product"},(0,r.createElement)("div",{className:"wc-block-cart-item__wrap"},(0,r.createElement)(jt,{disabled:P||$,name:B,permalink:b}),p?(0,r.createElement)(Ht,null):!!d&&(0,r.createElement)(Zt,{lowStockRemaining:d}),(0,r.createElement)("div",{className:"wc-block-cart-item__prices"},(0,r.createElement)($t,{currency:A,regularPrice:no(M,A),price:no(O,A),format:H})),(0,r.createElement)(co,{currency:A,saleAmount:no(D,A),format:q}),(0,r.createElement)(ro,{shortDescription:i,fullDescription:u,itemData:E,variation:w}),(0,r.createElement)("div",{className:"wc-block-cart-item__quantity"},!h&&!!_.editable&&(0,r.createElement)(Lt,{disabled:P,quantity:C,minimum:_.minimum,maximum:_.maximum,step:_.multiple_of,onChange:t=>{S(t),x("cart-set-item-quantity",{product:e,quantity:t})},itemName:B}),Z&&(0,r.createElement)("button",{className:"wc-block-cart-item__remove-link","aria-label":(0,c.sprintf)(/* translators: %s refers to the item's name in the cart. */
|
||
(0,c.__)("Remove %s from cart","woocommerce"),B),onClick:()=>{t(),N(),x("cart-remove-item",{product:e,quantity:C}),(0,Ot.speak)((0,c.sprintf)(/* translators: %s refers to the item name in the cart. */
|
||
(0,c.__)("%s has been removed from your cart.","woocommerce"),B))},disabled:P},(0,c.__)("Remove item","woocommerce"))))),(0,r.createElement)("td",{className:"wc-block-cart-item__total"},(0,r.createElement)("div",{className:"wc-block-cart-item__total-price-and-sale-badge-wrapper"},(0,r.createElement)($t,{currency:F,format:K,price:Y.getAmount()}),C>1&&(0,r.createElement)(co,{currency:A,saleAmount:no(L,A),format:q}))))}));o(6294);const lo=[...Array(3)].map(((_x,e)=>(0,r.createElement)(ao,{lineItem:{},key:e}))),io=e=>{const t={};return e.forEach((({key:e})=>{t[e]=(0,m.createRef)()})),t},uo=({lineItems:e=[],isLoading:t=!1,className:o})=>{const n=(0,m.useRef)(null),a=(0,m.useRef)(io(e));(0,m.useEffect)((()=>{a.current=io(e)}),[e]);const l=e=>()=>{null!=a&&a.current&&e&&a.current[e].current instanceof HTMLElement?a.current[e].current.focus():n.current instanceof HTMLElement&&n.current.focus()},i=t?lo:e.map(((t,o)=>{const c=e.length>o+1?e[o+1].key:null;return(0,r.createElement)(ao,{key:t.key,lineItem:t,onRemove:l(c),ref:a.current[t.key],tabIndex:-1})}));return(0,r.createElement)("table",{className:s()("wc-block-cart-items",o),ref:n,tabIndex:-1},(0,r.createElement)("thead",null,(0,r.createElement)("tr",{className:"wc-block-cart-items__header"},(0,r.createElement)("th",{className:"wc-block-cart-items__header-image"},(0,r.createElement)("span",null,(0,c.__)("Product","woocommerce"))),(0,r.createElement)("th",{className:"wc-block-cart-items__header-product"},(0,r.createElement)("span",null,(0,c.__)("Details","woocommerce"))),(0,r.createElement)("th",{className:"wc-block-cart-items__header-total"},(0,r.createElement)("span",null,(0,c.__)("Total","woocommerce"))))),(0,r.createElement)("tbody",null,i))},po=({className:e})=>{const{cartItems:t,cartIsLoading:o}=Le();return(0,r.createElement)(uo,{className:e,lineItems:t,isLoading:o})};(0,d.registerBlockType)("woocommerce/cart-line-items-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Rt.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(Mt,null,(0,r.createElement)(po,{className:t})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})}),(0,d.registerBlockType)("woocommerce/cart-cross-sells-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Rt.Z,className:"wc-block-editor-components-block-icon"})},edit:()=>{const e=(0,a.useBlockProps)({className:"wc-block-cart__cross-sells"}),t=[["core/heading",{content:(0,c.__)("You may be interested in…","woocommerce"),level:2,fontSize:"large"},[]],["woocommerce/cart-cross-sells-products-block",{},[]]];return(0,r.createElement)("div",{...e},(0,r.createElement)(a.InnerBlocks,{template:t,templateLock:!1}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});const mo=window.wp.components,go=window.wc.wcBlocksSharedContext,_o=window.wp.styleEngine;function ho(e={}){const t={};return(0,_o.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function bo(e,t){return e&&t?`has-${(0,Wt.o)(t)}-${e}`:""}const ko=e=>{const t=(e=>{const t=Fe(e)?e:{style:{}};let o=t.style;return Ee(o)&&(o=JSON.parse(o)||{}),Fe(o)||(o={}),{...t,style:o}})(e),o=function(e){var t,o,r,c,n,a,l;const{backgroundColor:i,textColor:u,gradient:d,style:p}=e,m=bo("background-color",i),g=bo("color",u),_=function(e){if(e)return`has-${e}-gradient-background`}(d),h=_||(null==p||null===(t=p.color)||void 0===t?void 0:t.gradient);return{className:s()(g,_,{[m]:!h&&!!m,"has-text-color":u||(null==p||null===(o=p.color)||void 0===o?void 0:o.text),"has-background":i||(null==p||null===(r=p.color)||void 0===r?void 0:r.background)||d||(null==p||null===(c=p.color)||void 0===c?void 0:c.gradient),"has-link-color":Fe(null==p||null===(n=p.elements)||void 0===n?void 0:n.link)?null==p||null===(a=p.elements)||void 0===a||null===(l=a.link)||void 0===l?void 0:l.color:void 0}),style:ho({color:(null==p?void 0:p.color)||{}})}}(t),r=function(e){var t;const o=(null===(t=e.style)||void 0===t?void 0:t.border)||{},r=function(e){var t;const{borderColor:o,style:r}=e,c=o?bo("border-color",o):"";return s()({"has-border-color":!!o||!(null==r||null===(t=r.border)||void 0===t||!t.color),[c]:!!c})}(e);return{className:r,style:ho({border:o})}}(t),c=function(e){var t;return{className:void 0,style:ho({spacing:(null===(t=e.style)||void 0===t?void 0:t.spacing)||{}})}}(t),n=(e=>{const t=Fe(e.style.typography)?e.style.typography:{},o=Ee(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:s()(n.className,o.className,r.className,c.className),style:{...n.style,...o.style,...r.style,...c.style}}},wo=window.wc.wcBlocksSharedHocs;o(1314);const Eo=e=>{const{className:t,align:o}=e,n=ko(e),{parentClassName:a}=(0,go.useInnerBlockLayoutContext)(),{product:l}=(0,go.useProductDataContext)();if(!(l.id&&l.on_sale||e.isDescendentOfSingleProductTemplate))return null;const i="string"==typeof o?`wc-block-components-product-sale-badge--align-${o}`:"";return(0,r.createElement)("div",{className:s()("wc-block-components-product-sale-badge",t,i,{[`${a}__product-onsale`]:a},n.className),style:n.style},(0,r.createElement)(Ft.Label,{label:(0,c.__)("Sale","woocommerce"),screenReaderLabel:(0,c.__)("Product on sale","woocommerce")}))},yo=(0,wo.withProductDataContext)(Eo);o(8854);let vo=function(e){return e.SINGLE="single",e.THUMBNAIL="thumbnail",e}({});const fo=e=>(0,r.createElement)("img",{...e,src:g.PLACEHOLDER_IMG_SRC,alt:"",width:void 0,height:void 0}),Co=({image:e,loaded:t,showFullSize:o,fallbackAlt:c,width:n,scale:s,height:a,aspectRatio:l})=>{const{thumbnail:i,src:u,srcset:d,sizes:p,alt:g}=e||{},_={alt:g||c,hidden:!t,src:i,...o&&{src:u,srcSet:d,sizes:p}},h={height:a,width:n,objectFit:s,aspectRatio:l};return(0,r.createElement)(m.Fragment,null,_.src&&(0,r.createElement)("img",{style:h,"data-testid":"product-image",..._}),!e&&(0,r.createElement)(fo,{style:h}))},So=e=>{const{className:t,imageSizing:o=vo.SINGLE,showProductLink:n=!0,showSaleBadge:a,saleBadgeAlign:l="right",height:i,width:u,scale:d,aspectRatio:p,...g}=e,_=ko(e),{parentClassName:h}=(0,go.useInnerBlockLayoutContext)(),{product:b,isLoading:k}=(0,go.useProductDataContext)(),{dispatchStoreEvent:w}=We();if(!b.id)return(0,r.createElement)("div",{className:s()(t,"wc-block-components-product-image",{[`${h}__product-image`]:h},_.className),style:_.style},(0,r.createElement)(fo,null));const E=!!b.images.length,y=E?b.images[0]:null,v=n?"a":m.Fragment,f=(0,c.sprintf)(/* translators: %s is referring to the product name */
|
||
(0,c.__)("Link to %s","woocommerce"),b.name),C={href:b.permalink,...!E&&{"aria-label":f},onClick:()=>{w("product-view-link",{product:b})}};return(0,r.createElement)("div",{className:s()(t,"wc-block-components-product-image",{[`${h}__product-image`]:h},_.className),style:_.style},(0,r.createElement)(v,{...n&&C},!!a&&(0,r.createElement)(yo,{align:l,...g}),(0,r.createElement)(Co,{fallbackAlt:b.name,image:y,loaded:!k,showFullSize:o!==vo.THUMBNAIL,width:u,height:i,scale:d,aspectRatio:p})))};(0,wo.withProductDataContext)(So),o(5160);const No=({children:e,headingLevel:t,elementType:o=`h${t}`,...c})=>(0,r.createElement)(o,{...c},e),Po=e=>{const{className:t,headingLevel:o=2,showProductLink:c=!0,linkTarget:n,align:a}=e,l=ko(e),{parentClassName:i}=(0,go.useInnerBlockLayoutContext)(),{product:u}=(0,go.useProductDataContext)(),{dispatchStoreEvent:d}=We();return u.id?(0,r.createElement)(No,{headingLevel:o,className:s()(t,l.className,"wc-block-components-product-title",{[`${i}__product-title`]:i,[`wc-block-components-product-title--align-${a}`]:a&&Y()}),style:Y()?l.style:{}},(0,r.createElement)(jt,{disabled:!c,name:u.name,permalink:u.permalink,target:n,onClick:()=>{d("product-view-link",{product:u})}})):(0,r.createElement)(No,{headingLevel:o,className:s()(t,l.className,"wc-block-components-product-title",{[`${i}__product-title`]:i,[`wc-block-components-product-title--align-${a}`]:a&&Y()}),style:Y()?l.style:{}})};(0,wo.withProductDataContext)(Po),o(402);const xo=e=>({width:e/5*100+"%"}),Ro=({parentClassName:e})=>{const t=xo(0);return(0,r.createElement)("div",{className:s()("wc-block-components-product-rating__norating-container",`${e}-product-rating__norating-container`)},(0,r.createElement)("div",{className:"wc-block-components-product-rating__norating",role:"img"},(0,r.createElement)("span",{style:t})),(0,r.createElement)("span",null,(0,c.__)("No Reviews","woocommerce")))},To=e=>{const{rating:t,reviews:o,parentClassName:n}=e,a=xo(t),l=(0,c.sprintf)(/* translators: %f is referring to the average rating value */
|
||
(0,c.__)("Rated %f out of 5","woocommerce"),t),i={__html:(0,c.sprintf)(/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
|
||
(0,c._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",o,"woocommerce"),(0,c.sprintf)('<strong class="rating">%f</strong>',t),(0,c.sprintf)('<span class="rating">%d</span>',o))};return(0,r.createElement)("div",{className:s()("wc-block-components-product-rating__stars",`${n}__product-rating__stars`),role:"img","aria-label":l},(0,r.createElement)("span",{style:a,dangerouslySetInnerHTML:i}))},Io=e=>{const{reviews:t}=e,o=(0,c.sprintf)(/* translators: %s is referring to the total of reviews for a product */
|
||
(0,c._n)("(%s customer review)","(%s customer reviews)",t,"woocommerce"),t);return(0,r.createElement)("span",{className:"wc-block-components-product-rating__reviews_count"},o)},Ao=e=>{const{textAlign:t,isDescendentOfSingleProductBlock:o,shouldDisplayMockedReviewsWhenProductHasNoReviews:c}=e,n=ko(e),{parentClassName:a}=(0,go.useInnerBlockLayoutContext)(),{product:l}=(0,go.useProductDataContext)(),i=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(l),u=(e=>{const t=we(e.review_count)?e.review_count:parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(l),d=s()(n.className,"wc-block-components-product-rating",{[`${a}__product-rating`]:a,[`has-text-align-${t}`]:t}),p=c?(0,r.createElement)(Ro,{parentClassName:a}):null,m=u?(0,r.createElement)(To,{rating:i,reviews:u,parentClassName:a}):p;if(u||c)return(0,r.createElement)("div",{className:d,style:n.style},(0,r.createElement)("div",{className:"wc-block-components-product-rating__container"},m,u&&o?(0,r.createElement)(Io,{reviews:u}):null))},Bo=((0,wo.withProductDataContext)(Ao),e=>{var t,o;const{className:c,textAlign:n,isDescendentOfSingleProductTemplate:a}=e,l=ko(e),{parentName:i,parentClassName:u}=(0,go.useInnerBlockLayoutContext)(),{product:d}=(0,go.useProductDataContext)(),p="woocommerce/all-products"===i,m=s()("wc-block-components-product-price",c,l.className,{[`${u}__product-price`]:u});if(!d.id&&!a){const e=(0,r.createElement)($t,{align:n,className:m});return p?(0,r.createElement)("div",{className:"wp-block-woocommerce-product-price"},e):e}const g=d.prices,_=a?(0,Vt.getCurrencyFromPriceResponse)():(0,Vt.getCurrencyFromPriceResponse)(g),h="5000",b=g.price!==g.regular_price,k=s()({[`${u}__product-price__value`]:u,[`${u}__product-price__value--on-sale`]:b}),w=(0,r.createElement)($t,{align:n,className:m,style:l.style,regularPriceStyle:l.style,priceStyle:l.style,priceClassName:k,currency:_,price:a?h:g.price,minPrice:null==g||null===(t=g.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==g||null===(o=g.price_range)||void 0===o?void 0:o.max_amount,regularPrice:a?h:g.regular_price,regularPriceClassName:s()({[`${u}__product-price__regular`]:u})});return p?(0,r.createElement)("div",{className:"wp-block-woocommerce-product-price"},w):w}),Mo=(e,t)=>{const o=e.find((({id:e})=>e===t));return o?o.quantity:0};o(1464);const Oo=({product:e,className:t,style:o})=>{const{id:n,permalink:a,add_to_cart:l,has_options:i,is_purchasable:u,is_in_stock:d}=e,{dispatchStoreEvent:p}=We(),{cartQuantity:_,addingToCart:h,addToCart:b}=(e=>{const{addItemToCart:t}=(0,z.useDispatch)(W.CART_STORE_KEY),{cartItems:o,cartIsLoading:r}=Le(),{createErrorNotice:c,removeNotice:n}=(0,z.useDispatch)("core/notices"),[s,a]=(0,m.useState)(!1),l=(0,m.useRef)(Mo(o,e));return(0,m.useEffect)((()=>{const t=Mo(o,e);t!==l.current&&(l.current=t)}),[o,e]),{cartQuantity:Number.isFinite(l.current)?l.current:0,addingToCart:s,cartIsLoading:r,addToCart:(o=1)=>(a(!0),t(e,o).then((()=>{n("add-to-cart")})).catch((e=>{c((0,ke.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})})).finally((()=>{a(!1)})))}})(n),k=Number.isFinite(_)&&_>0,w=!i&&u&&d,E=(0,ke.decodeEntities)((null==l?void 0:l.description)||""),y=k?(0,c.sprintf)(/* translators: %s number of products in cart. */
|
||
(0,c._n)("%d in cart","%d in cart",_,"woocommerce"),_):(0,ke.decodeEntities)((null==l?void 0:l.text)||(0,c.__)("Add to cart","woocommerce")),v=w?"button":"a",f={};return w?f.onClick=async()=>{await b(),p("cart-add-item",{product:e});const{cartRedirectAfterAdd:t}=(0,g.getSetting)("productsSettings");t&&(window.location.href=I)}:(f.href=a,f.rel="nofollow",f.onClick=()=>{p("product-view-link",{product:e})}),(0,r.createElement)(v,{...f,"aria-label":E,disabled:h,className:s()(t,"wp-block-button__link","wp-element-button","add_to_cart_button","wc-block-components-product-button__button",{loading:h,added:k}),style:o},y)},Do=({className:e,style:t})=>(0,r.createElement)("button",{className:s()("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}),Lo=e=>{const{className:t,textAlign:o}=e,c=ko(e),{parentClassName:n}=(0,go.useInnerBlockLayoutContext)(),{product:a}=(0,go.useProductDataContext)();return(0,r.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[`${n}__product-add-to-cart`]:n,[`align-${o}`]:o})},a.id?(0,r.createElement)(Oo,{product:a,style:c.style,className:c.className}):(0,r.createElement)(Do,{style:c.style,className:c.className}))},Fo=((0,wo.withProductDataContext)(Lo),({product:e})=>(0,r.createElement)("div",{className:"cross-sells-product"},(0,r.createElement)(go.InnerBlockLayoutContextProvider,{parentName:"woocommerce/cart-cross-sells-block",parentClassName:"wp-block-cart-cross-sells-product"},(0,r.createElement)(go.ProductDataContextProvider,{isLoading:!1,product:e},(0,r.createElement)("div",null,(0,r.createElement)(So,{className:"",showSaleBadge:!1,productId:e.id,showProductLink:!1,saleBadgeAlign:"left",imageSizing:vo.SINGLE,isDescendentOfQueryLoop:!1}),(0,r.createElement)(Po,{align:"",headingLevel:3,showProductLink:!0}),(0,r.createElement)(Ao,null),(0,r.createElement)(Eo,{productId:e.id,align:"left"}),(0,r.createElement)(Bo,null)),(0,r.createElement)(Lo,null))))),Vo=({products:e,columns:t})=>{const o=e.map(((e,o)=>o>=t?null:(0,r.createElement)(Fo,{isLoading:!1,product:e,key:e.id})));return(0,r.createElement)("div",null,o)},Yo={Z:3},Uo=({className:e,columns:t})=>{const{crossSellsProducts:o}=Le();return void 0===t&&(t=Yo.Z),(0,r.createElement)(Vo,{className:e,columns:t,products:o})};o(7995),o(8584),(0,d.registerBlockType)("woocommerce/cart-cross-sells-products-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Rt.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{className:o,columns:n}=e,s=(0,a.useBlockProps)();return(0,r.createElement)("div",{...s},(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(mo.PanelBody,{title:(0,c.__)("Settings","woocommerce")},(0,r.createElement)(mo.RangeControl,{label:(0,c.__)("Cross-Sells products to show","woocommerce"),value:n,onChange:e=>t({columns:e}),min:(0,g.getSetting)("minColumns",1),max:(0,g.getSetting)("maxColumns",6)}))),(0,r.createElement)(Mt,null,(0,r.createElement)(Uo,{columns:n,className:o})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const $o=(0,m.forwardRef)((({children:e,className:t=""},o)=>(0,r.createElement)("div",{ref:o,className:s()("wc-block-components-sidebar",t)},e)));function jo(e){const t=(0,m.useRef)(e);return ze()(e,t.current)||(t.current=e),t.current}o(8438),(0,d.registerBlockType)("woocommerce/cart-totals-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Rt.Z,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,a.useBlockProps)({className:"wc-block-cart__sidebar"}),o=Nt(wt.innerBlockAreas.CART_TOTALS),c=[["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:c}),(0,r.createElement)($o,{...t},(0,r.createElement)(a.InnerBlocks,{allowedBlocks:o,template:c,templateLock:!1,renderAppender:a.InnerBlocks.ButtonBlockAppender}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});const zo=(e=!1)=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o,availablePaymentMethods:r,availableExpressPaymentMethods:c}=(0,z.useSelect)((e=>{const t=e(W.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}})),n=Object.values(r).map((({name:e})=>e)),s=Object.values(c).map((({name:e})=>e)),a=(0,mt.getPaymentMethods)(),l=(0,mt.getExpressPaymentMethods)(),i=Object.keys(a).reduce(((e,t)=>(n.includes(t)&&(e[t]=a[t]),e)),{}),u=Object.keys(l).reduce(((e,t)=>(s.includes(t)&&(e[t]=l[t]),e)),{}),d=jo(i),p=jo(u);return{paymentMethods:e?p:d,isInitialized:e?o:t}},Ko=()=>zo(!0);o(6575);const Ho=({children:e,className:t,screenReaderLabel:o,showSpinner:n=!1,isLoading:a=!0})=>(0,r.createElement)("div",{className:s()(t,{"wc-block-components-loading-mask":a})},a&&n&&(0,r.createElement)(Ft.Spinner,null),(0,r.createElement)("div",{className:s()({"wc-block-components-loading-mask__children":a}),"aria-hidden":a},e),a&&(0,r.createElement)("span",{className:"screen-reader-text"},o||(0,c.__)("Loading…","woocommerce"))),qo=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("g",{fill:"none",fillRule:"evenodd"},(0,r.createElement)("path",{d:"M0 0h24v24H0z"}),(0,r.createElement)("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,r.createElement)("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 Zo=o(9109),Wo=o(5032),Go=o(8214);o(4948);const Qo={bank:Zo.Z,bill:Wo.Z,card:Go.Z,checkPayment:qo},Xo=({icon:e="",text:t=""})=>{const o=!!e,c=(0,m.useCallback)((e=>o&&Ee(e)&&Ve(Qo,e)),[o]),n=s()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return(0,r.createElement)("span",{className:n},c(e)?(0,r.createElement)(u.Z,{icon:Qo[e]}):e,t)},Jo=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,er=({id:e,src:t=null,alt:o=""})=>t?(0,r.createElement)("img",{className:Jo(e),src:t,alt:o}):null,tr=[{id:"alipay",alt:"Alipay",src:N+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:N+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:N+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:N+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:N+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:N+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:N+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:N+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:N+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:N+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:N+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:N+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:N+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:N+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:N+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:N+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:N+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:N+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:N+"payment-methods/wechat.svg"}];o(9086);const or=({icons:e=[],align:t="center",className:o})=>{const c=(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&&Ee(o.id)&&!t[o.id]&&(t[o.id]=o)})),Object.values(t)})(e);if(0===c.length)return null;const n=s()("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,r.createElement)("div",{className:n},c.map((e=>{const t={...e,...(o=e.id,tr.find((e=>e.id===o))||{})};var o;return(0,r.createElement)(er,{key:"payment-method-icon-"+e.id,...t})})))},rr=(e="")=>{const{cartCoupons:t,cartIsLoading:o}=Le(),{createErrorNotice:r}=(0,z.useDispatch)("core/notices"),{createNotice:n}=(0,z.useDispatch)("core/notices"),{setValidationErrors:s}=(0,z.useDispatch)(W.VALIDATION_STORE_KEY),{isApplyingCoupon:a,isRemovingCoupon:l}=(0,z.useSelect)((e=>{const t=e(W.CART_STORE_KEY);return{isApplyingCoupon:t.isApplyingCoupon(),isRemovingCoupon:t.isRemovingCoupon()}}),[r,n]),{applyCoupon:i,removeCoupon:u}=(0,z.useDispatch)(W.CART_STORE_KEY);return{appliedCoupons:t,isLoading:o,applyCoupon:t=>i(t).then((()=>((0,wt.applyCheckoutFilter)({filterName:"showApplyCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&n("info",(0,c.sprintf)(/* translators: %s coupon code. */
|
||
(0,c.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((e=>(s({coupon:{message:(0,ke.decodeEntities)(e.message),hidden:!1}}),Promise.resolve(!1)))),removeCoupon:t=>u(t).then((()=>((0,wt.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&n("info",(0,c.sprintf)(/* translators: %s coupon code. */
|
||
(0,c.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((t=>(r(t.message,{id:"coupon-form",context:e}),Promise.resolve(!1)))),isApplyingCoupon:a,isRemovingCoupon:l}},cr=(e,t)=>{const o=[],r=(t,o)=>{const r=o+"_tax",c=Ve(e,o)&&Ee(e[o])?parseInt(e[o],10):0;return{key:o,label:t,value:c,valueWithTax:c+(Ve(e,r)&&Ee(e[r])?parseInt(e[r],10):0)}};return o.push(r((0,c.__)("Subtotal:","woocommerce"),"total_items")),o.push(r((0,c.__)("Fees:","woocommerce"),"total_fees")),o.push(r((0,c.__)("Discount:","woocommerce"),"total_discount")),o.push({key:"total_tax",label:(0,c.__)("Taxes:","woocommerce"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&o.push(r((0,c.__)("Shipping:","woocommerce"),"total_shipping")),o},nr=({isEditor:e,children:t})=>{const[o]=(0,m.useState)(""),[n]=(0,m.useState)(!1);if(n){let t=(0,c.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woocommerce");(e||g.CURRENT_USER_IS_ADMIN)&&(t=o||(0,c.__)("There was an error with this payment method. Please verify it's configured correctly.","woocommerce"));const n=[{id:"0",content:t,isDismissible:!1,status:"error"}];return(0,r.createElement)(Ft.StoreNoticesContainer,{additionalNotices:n,context:ge.PAYMENTS})}return(0,r.createElement)(r.Fragment,null,t)},sr="wc/store/payment",ar=()=>{const{isEditor:e}=H(),{activePaymentMethod:t,paymentMethodData:o}=(0,z.useSelect)((e=>{const t=e(sr);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}})),{__internalSetActivePaymentMethod:n,__internalSetExpressPaymentStarted:s,__internalSetPaymentIdle:a,__internalSetPaymentError:l,__internalSetPaymentMethodData:i,__internalSetExpressPaymentError:u}=(0,z.useDispatch)(sr),{paymentMethods:d}=Ko(),p=(()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:o,onCheckoutAfterProcessingWithError:r,onSubmit:n,onCheckoutSuccess:s,onCheckoutFail:a,onCheckoutValidation:l}=it(),{isCalculating:i,isComplete:u,isIdle:d,isProcessing:p,customerId:_}=(0,z.useSelect)((e=>{const t=e(W.CHECKOUT_STORE_KEY);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}})),{paymentStatus:h,activePaymentMethod:b,shouldSavePayment:k}=(0,z.useSelect)((e=>{const t=e(W.PAYMENT_STORE_KEY);return{paymentStatus:{get isPristine(){return Q()("isPristine",{since:"9.6.0",alternative:"isIdle",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.isPaymentIdle()},isIdle:t.isPaymentIdle(),isStarted:t.isExpressPaymentStarted(),isProcessing:t.isPaymentProcessing(),get isFinished(){return Q()("isFinished",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.hasPaymentError()||t.isPaymentReady()},hasError:t.hasPaymentError(),get hasFailed(){return Q()("hasFailed",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.hasPaymentError()},get isSuccessful(){return Q()("isSuccessful",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.isPaymentReady()},isReady:t.isPaymentReady(),isDoingExpressPayment:t.isExpressPaymentMethodActive()},activePaymentMethod:t.getActivePaymentMethod(),shouldSavePayment:t.getShouldSavePaymentMethod()}})),{__internalSetExpressPaymentError:w}=(0,z.useDispatch)(W.PAYMENT_STORE_KEY),{onPaymentProcessing:E,onPaymentSetup:y}=(0,m.useContext)(oe),{shippingErrorStatus:v,shippingErrorTypes:f,onShippingRateSuccess:C,onShippingRateFail:S,onShippingRateSelectSuccess:N,onShippingRateSelectFail:P}=tt(),{shippingRates:x,isLoadingRates:R,selectedRates:T,isSelectingRate:I,selectShippingRate:A,needsShipping:B}=Ge(),{billingAddress:M,shippingAddress:O}=(0,z.useSelect)((e=>e(W.CART_STORE_KEY).getCustomerData())),{setShippingAddress:D}=(0,z.useDispatch)(W.CART_STORE_KEY),{cartItems:L,cartFees:F,cartTotals:V,extensions:Y}=Le(),{appliedCoupons:U}=rr(),$=(0,m.useRef)(cr(V,B)),j=(0,m.useRef)({label:(0,c.__)("Total","woocommerce"),value:parseInt(V.total_price,10)});(0,m.useEffect)((()=>{$.current=cr(V,B),j.current={label:(0,c.__)("Total","woocommerce"),value:parseInt(V.total_price,10)}}),[V,B]);const K=(0,m.useCallback)(((e="")=>{Q()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),w(e)}),[w]);return{activePaymentMethod:b,billing:{appliedCoupons:U,billingAddress:M,billingData:M,cartTotal:j.current,cartTotalItems:$.current,currency:(0,Vt.getCurrencyFromPriceResponse)(V),customerId:_,displayPricesIncludingTax:(0,g.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:L,cartFees:F,extensions:Y},checkoutStatus:{isCalculating:i,isComplete:u,isIdle:d,isProcessing:p},components:{LoadingMask:Ho,PaymentMethodIcons:or,PaymentMethodLabel:Xo,ValidationInputError:Ft.ValidationInputError},emitResponse:{noticeContexts:ge,responseTypes:me},eventRegistration:{onCheckoutAfterProcessingWithError:r,onCheckoutAfterProcessingWithSuccess:o,onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutSuccess:s,onCheckoutFail:a,onCheckoutValidation:l,onPaymentProcessing:E,onPaymentSetup:y,onShippingRateFail:S,onShippingRateSelectFail:P,onShippingRateSelectSuccess:N,onShippingRateSuccess:C},onSubmit:n,paymentStatus:h,setExpressPaymentError:K,shippingData:{isSelectingRate:I,needsShipping:B,selectedRates:T,setSelectedRates:A,setShippingAddress:D,shippingAddress:O,shippingRates:x,shippingRatesLoading:R},shippingStatus:{shippingErrorStatus:v,shippingErrorTypes:f},shouldSavePayment:k}})(),_=(0,m.useRef)(t),h=(0,m.useRef)(o),b=(0,m.useCallback)((e=>()=>{_.current=t,h.current=o,s(),n(e)}),[t,o,n,s]),k=(0,m.useCallback)((()=>{a(),n(_.current,h.current)}),[n,a]),w=(0,m.useCallback)((e=>{l(),i(e),u(e),n(_.current,h.current)}),[n,l,i,u]),E=(0,m.useCallback)(((e="")=>{Q()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?w(e):u("")}),[u,w]),y=Object.entries(d),v=y.length>0?y.map((([t,o])=>{const c=e?o.edit:o.content;return(0,m.isValidElement)(c)?(0,r.createElement)("li",{key:t,id:`express-payment-method-${t}`},(0,m.cloneElement)(c,{...p,onClick:b(t),onClose:k,onError:w,setExpressPaymentError:E})):null})):(0,r.createElement)("li",{key:"noneRegistered"},(0,c.__)("No registered Payment Methods","woocommerce"));return(0,r.createElement)(nr,{isEditor:e},(0,r.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},v))};o(6620);const lr=()=>{const{paymentMethods:e,isInitialized:t}=Ko(),{isCalculating:o,isProcessing:n,isAfterProcessing:s,isBeforeProcessing:a,isComplete:l,hasError:i}=(0,z.useSelect)((e=>{const t=e(W.CHECKOUT_STORE_KEY);return{isCalculating:t.isCalculating(),isProcessing:t.isProcessing(),isAfterProcessing:t.isAfterProcessing(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),hasError:t.hasError()}})),u=(0,z.useSelect)((e=>e(W.PAYMENT_STORE_KEY).isExpressPaymentMethodActive()));if(!t||t&&0===Object.keys(e).length)return null;const d=n||s||a||l&&!i;return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Ho,{isLoading:o||d||u},(0,r.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},(0,r.createElement)("div",{className:"wc-block-components-express-payment__content"},(0,r.createElement)(Ft.StoreNoticesContainer,{context:ge.EXPRESS_PAYMENTS}),(0,r.createElement)(ar,null)))),(0,r.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},(0,c.__)("Or","woocommerce")))},ir=({className:e})=>{const{cartNeedsPayment:t}=Le();return t?(0,r.createElement)("div",{className:s()("wc-block-cart__payment-options",e)},(0,r.createElement)(lr,null)):null};o(4235);const ur=(0,r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},(0,r.createElement)("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,r.createElement)("path",{fill:"#1E1E1E",d:"M10 3h4v3h-4z"}),(0,r.createElement)("rect",{width:"1.5",height:"5",x:"11.25",y:"8",fill:"#1E1E1E",rx:".75"}),(0,r.createElement)("path",{fill:"#1E1E1E",d:"m15.7 4.816 1.66 1.078-1.114 1.718-1.661-1.078z"}));(0,d.registerBlockType)("woocommerce/cart-express-payment-block",{icon:{src:(0,r.createElement)(u.Z,{style:{fill:"none"},icon:ur,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{paymentMethods:t,isInitialized:o}=Ko(),c=Object.keys(t).length>0,n=(0,a.useBlockProps)({className:s()({"wp-block-woocommerce-cart-express-payment-block--has-express-payment-methods":c})}),{className:l}=e;return o&&c?(0,r.createElement)("div",{...n},(0,r.createElement)(ir,{className:l})):null},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});var dr=o(9845);const pr=(0,c.__)("Proceed to Checkout","woocommerce"),mr={checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}},buttonLabel:{type:"string",default:pr}};var gr=o(9884);o(5482),o(129);const _r=()=>(0,r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"}),hr=({className:e,showSpinner:t=!1,children:o,variant:c="contained",...n})=>{const a=s()("wc-block-components-button","wp-element-button",e,c,{"wc-block-components-button--loading":t});return(0,r.createElement)(gr.Z,{className:a,...n},t&&(0,r.createElement)(_r,null),(0,r.createElement)("span",{className:"wc-block-components-button__text"},o))},br=({onChange:e,placeholder:t,value:o,...c})=>(0,r.createElement)(hr,{...c},(0,r.createElement)(a.RichText,{multiline:!1,allowedFormats:[],value:o,placeholder:t,onChange:e})),kr=(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}`)},wr=({setPageId:e,pageId:t,labels:o})=>{const n=(0,z.useSelect)((e=>e("core").getEntityRecords("postType","page",{status:"publish",orderby:"title",order:"asc",per_page:100})),[])||null;return n?(0,r.createElement)(mo.PanelBody,{title:o.title},(0,r.createElement)(mo.SelectControl,{label:(0,c.__)("Link to","woocommerce"),value:t,options:[{label:o.default,value:0},...n.map((e=>({label:kr(e,n),value:parseInt(e.id,10)})))],onChange:t=>e(parseInt(t,10))})):null};o(8526),(0,d.registerBlockType)("woocommerce/proceed-to-checkout-block",{icon:{src:(0,r.createElement)(u.Z,{icon:dr.Z,className:"wc-block-editor-components-block-icon"})},attributes:mr,edit:({attributes:e,setAttributes:t})=>{const o=(0,a.useBlockProps)(),{checkoutPageId:n=0,buttonLabel:s}=e,{current:l}=(0,m.useRef)(n),i=(0,z.useSelect)((e=>l||e("core/editor").getCurrentPostId()),[l]);return(0,r.createElement)("div",{...o},(0,r.createElement)(a.InspectorControls,null,!(i===T&&0===l)&&(0,r.createElement)(wr,{pageId:n,setPageId:e=>t({checkoutPageId:e}),labels:{title:(0,c.__)("Proceed to Checkout button","woocommerce"),default:(0,c.__)("WooCommerce Checkout Page","woocommerce")}})),(0,r.createElement)(br,{className:"wc-block-cart__submit-button",value:s,placeholder:pr,onChange:e=>{t({buttonLabel:e})}}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const Er=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("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,r.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"})),yr=x?["core/paragraph",{align:"center",content:(0,c.sprintf)(/* translators: %s is the link to the store product directory. */
|
||
(0,c.__)('<a href="%s">Browse store</a>',"woocommerce"),x),dropCap:!1}]:null,vr=[["core/heading",{textAlign:"center",content:(0,c.__)("Your cart is currently empty!","woocommerce"),level:2,className:"with-empty-cart-icon wc-block-cart__empty-cart__title"}],yr,["core/separator",{className:"is-style-dots"}],["core/heading",{textAlign:"center",content:(0,c.__)("New in store","woocommerce"),level:2}],["woocommerce/product-new",{columns:4,rows:1}]].filter(Boolean);o(4974),(0,d.registerBlockType)("woocommerce/empty-cart-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Er,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,a.useBlockProps)(),{currentView:o}=H(),c=Nt(wt.innerBlockAreas.EMPTY_CART);return Pt({clientId:e,registeredBlocks:c,defaultTemplate:vr}),(0,r.createElement)("div",{...t,hidden:"woocommerce/empty-cart-block"!==o},(0,r.createElement)(a.InnerBlocks,{template:vr,templateLock:!1,renderAppender:a.InnerBlocks.ButtonBlockAppender}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});const fr=e=>Object.values(e).reduce(((e,t)=>(null!==t.icons&&(e=e.concat(t.icons)),e)),[]),Cr=({className:e})=>{const{paymentMethods:t}=zo(!1);return(0,r.createElement)(or,{className:e,icons:fr(t)})};(0,d.registerBlockType)("woocommerce/cart-accepted-payment-methods-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Go.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(Cr,{className:t}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const Sr=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none"},(0,r.createElement)("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,r.createElement)("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,r.createElement)("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(5454);const Nr=(0,yt.withInstanceId)((({instanceId:e,isLoading:t=!1,onSubmit:o,displayCouponForm:n=!1})=>{const[a,l]=(0,m.useState)(""),[i,u]=(0,m.useState)(!n),d=`wc-block-components-totals-coupon__input-${e}`,p=s()("wc-block-components-totals-coupon__content",{"screen-reader-text":i}),{validationErrorId:g}=(0,z.useSelect)((e=>({validationErrorId:e(W.VALIDATION_STORE_KEY).getValidationErrorId(d)})));return(0,r.createElement)("div",{className:"wc-block-components-totals-coupon"},i?(0,r.createElement)("a",{role:"button",href:"#wc-block-components-totals-coupon__form",className:"wc-block-components-totals-coupon-link","aria-label":(0,c.__)("Add a coupon","woocommerce"),onClick:e=>{e.preventDefault(),u(!1)}},(0,c.__)("Add a coupon","woocommerce")):(0,r.createElement)(Ho,{screenReaderLabel:(0,c.__)("Applying coupon…","woocommerce"),isLoading:t,showSpinner:!1},(0,r.createElement)("div",{className:p},(0,r.createElement)("form",{className:"wc-block-components-totals-coupon__form",id:"wc-block-components-totals-coupon__form"},(0,r.createElement)(Ft.ValidatedTextInput,{id:d,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:(0,c.__)("Enter code","woocommerce"),value:a,ariaDescribedBy:g,onChange:e=>{l(e)},focusOnMount:!0,validateOnMount:!1,showError:!1}),(0,r.createElement)(hr,{className:"wc-block-components-totals-coupon__button",disabled:t||!a,showSpinner:t,onClick:e=>{var t;e.preventDefault(),void 0!==o?null===(t=o(a))||void 0===t||t.then((e=>{e&&(l(""),u(!0))})):(l(""),u(!0))},type:"submit"},(0,c.__)("Apply","woocommerce"))),(0,r.createElement)(Ft.ValidationInputError,{propertyName:"coupon",elementId:d}))))}));o(5154);const Pr={context:"summary"},xr=({cartCoupons:e=[],currency:t,isRemovingCoupon:o,removeCoupon:n,values:s})=>{const{total_discount:a,total_discount_tax:l}=s,i=parseInt(a,10);if(!i&&0===e.length)return null;const u=parseInt(l,10),d=(0,g.getSetting)("displayCartPricesIncludingTax",!1)?i+u:i,p=(0,wt.applyCheckoutFilter)({arg:Pr,filterName:"coupons",defaultValue:e});return(0,r.createElement)(Ft.TotalsItem,{className:"wc-block-components-totals-discount",currency:t,description:0!==p.length&&(0,r.createElement)(Ho,{screenReaderLabel:(0,c.__)("Removing coupon…","woocommerce"),isLoading:o,showSpinner:!1},(0,r.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},p.map((e=>(0,r.createElement)(Ft.RemovableChip,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:(0,c.sprintf)(/* translators: %s Coupon code. */
|
||
(0,c.__)("Coupon: %s","woocommerce"),e.label),disabled:o,onRemove:()=>{n(e.code)},radius:"large",ariaLabel:(0,c.sprintf)(/* translators: %s is a coupon code. */
|
||
(0,c.__)('Remove coupon "%s"',"woocommerce"),e.label)}))))),label:d?(0,c.__)("Discount","woocommerce"):(0,c.__)("Coupons","woocommerce"),value:d?-1*d:"-"})};o(6305);const Rr=({currency:e,values:t,className:o})=>{const n=(0,g.getSetting)("taxesEnabled",!0)&&(0,g.getSetting)("displayCartPricesIncludingTax",!1),{total_price:a,total_tax:l,tax_lines:i}=t,{receiveCart:u,...d}=Le(),p=(0,wt.applyCheckoutFilter)({filterName:"totalLabel",defaultValue:(0,c.__)("Total","woocommerce"),extensions:d.extensions,arg:{cart:d}}),_=parseInt(l,10),h=i&&i.length>0?(0,c.sprintf)(/* translators: %s is a list of tax rates */
|
||
(0,c.__)("Including %s","woocommerce"),i.map((({name:t,price:o})=>`${(0,Vt.formatPrice)(o,e)} ${t}`)).join(", ")):(0,c.__)("Including <TaxAmount/> in taxes","woocommerce");return(0,r.createElement)(Ft.TotalsItem,{className:s()("wc-block-components-totals-footer-item",o),currency:e,label:p,value:parseInt(a,10),description:n&&0!==_&&(0,r.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},(0,m.createInterpolateElement)(h,{TaxAmount:(0,r.createElement)(Ft.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:_})}))})},Tr=({selectedShippingRates:e})=>(0,r.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},(0,ke.decodeEntities)(e.filter(((t,o)=>e.indexOf(t)===o)).join(", ")));o(7866);var Ir=o(5287);o(5821);const Ar=(0,yt.withInstanceId)((({id:e,className:t,label:o,onChange:n,options:a,value:l,required:i=!1,errorMessage:u=(0,c.__)("Please select a value.","woocommerce"),errorId:d,instanceId:p="0",autoComplete:g="off"})=>{const _=(0,m.useRef)(null),h=e||"control-"+p,b=d||h,{setValidationErrors:k,clearValidationError:w}=(0,z.useDispatch)(W.VALIDATION_STORE_KEY),E=(0,z.useSelect)((e=>e(W.VALIDATION_STORE_KEY).getValidationError(b)));return(0,m.useEffect)((()=>(!i||l?w(b):k({[b]:{message:u,hidden:!0}}),()=>{w(b)})),[w,l,b,u,i,k]),(0,r.createElement)("div",{id:h,className:s()("wc-block-components-combobox",t,{"is-active":l,"has-error":(null==E?void 0:E.message)&&!(null!=E&&E.hidden)}),ref:_},(0,r.createElement)(Ir.Z,{className:"wc-block-components-combobox-control",label:o,onChange:n,onFilterValueChange:e=>{if(e.length){const t=Fe(_.current)?_.current.ownerDocument.activeElement:void 0;if(t&&Fe(_.current)&&_.current.contains(t))return;const o=e.toLocaleUpperCase(),r=a.find((e=>e.value.toLocaleUpperCase()===o));if(r)return void n(r.value);const c=a.find((e=>e.label.toLocaleUpperCase().startsWith(o)));c&&n(c.value)}},options:a,value:l||"",allowReset:!1,autoComplete:g,"aria-invalid":(null==E?void 0:E.message)&&!(null!=E&&E.hidden)}),(0,r.createElement)(Ft.ValidationInputError,{propertyName:b}))}));o(7775);const Br=({className:e,countries:t,id:o,label:n,onChange:a,value:l="",autoComplete:i="off",required:u=!1,errorId:d,errorMessage:p=(0,c.__)("Please select a country","woocommerce")})=>{const g=(0,m.useMemo)((()=>Object.entries(t).map((([e,t])=>({value:e,label:(0,ke.decodeEntities)(t)})))),[t]);return(0,r.createElement)("div",{className:s()(e,"wc-block-components-country-input")},(0,r.createElement)(Ar,{id:o,label:n,onChange:a,options:g,value:l,errorId:d,errorMessage:p,required:u,autoComplete:i}))},Mr=e=>(0,r.createElement)(Br,{countries:O,...e}),Or=e=>(0,r.createElement)(Br,{countries:L,...e});o(8410);const Dr=(e,t)=>{const o=t.find((t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return o?o.value:""},Lr=({className:e,id:t,states:o,country:n,label:a,onChange:l,autoComplete:i="off",value:u="",required:d=!1,errorId:p=""})=>{const g=o[n],_=(0,m.useMemo)((()=>g?Object.keys(g).map((e=>({value:e,label:(0,ke.decodeEntities)(g[e])}))):[]),[g]),h=(0,m.useCallback)((e=>{const t=_.length>0?Dr(e,_):e;t!==u&&l(t)}),[l,_,u]),b=(0,m.useRef)(u);return(0,m.useEffect)((()=>{b.current!==u&&(b.current=u)}),[u]),(0,m.useEffect)((()=>{if(_.length>0&&b.current){const e=Dr(b.current,_);e!==b.current&&h(e)}}),[_,h]),_.length>0?(0,r.createElement)(Ar,{className:s()(e,"wc-block-components-state-input"),id:t,label:a,onChange:h,options:_,value:u,errorMessage:(0,c.__)("Please select a state.","woocommerce"),errorId:p,required:d,autoComplete:i}):(0,r.createElement)(Ft.ValidatedTextInput,{className:e,id:t,label:a,onChange:h,autoComplete:i,value:u,required:d})},Fr=e=>(0,r.createElement)(Lr,{states:D,...e}),Vr=e=>(0,r.createElement)(Lr,{states:F,...e}),Yr=Object.keys(g.defaultAddressFields),Ur=({id:e="",fields:t=Yr,fieldConfig:o={},onChange:n,type:s="shipping",values:a})=>{const l=(0,yt.useInstanceId)(Ur),i=jo(t),u=jo(o),d=jo(a.country),p=(0,m.useMemo)((()=>{const e=fe(i,u,d);return{fields:e,type:s,required:e.filter((e=>e.required)),hidden:e.filter((e=>e.hidden))}}),[i,u,d,s]),g=(0,m.useRef)({});return(0,m.useEffect)((()=>{const e={...a,...Object.fromEntries(p.hidden.map((e=>[e.key,""])))};ze()(a,e)||n(e)}),[n,p,a]),(0,m.useEffect)((()=>{"shipping"===s&&(e=>{const t="shipping_country",o=(0,z.select)(W.VALIDATION_STORE_KEY).getValidationError(t);!e.country&&(e.city||e.state||e.postcode)&&(o?(0,z.dispatch)(W.VALIDATION_STORE_KEY).showValidationError(t):(0,z.dispatch)(W.VALIDATION_STORE_KEY).setValidationErrors({[t]:{message:(0,c.__)("Please select your country","woocommerce"),hidden:!1}})),o&&e.country&&(0,z.dispatch)(W.VALIDATION_STORE_KEY).clearValidationError(t)})(a)}),[a,s]),(0,m.useEffect)((()=>{var e,t;null===(e=g.current)||void 0===e||null===(t=e.postcode)||void 0===t||t.revalidate()}),[d]),e=e||`${l}`,(0,r.createElement)("div",{id:e,className:"wc-block-components-address-form"},p.fields.map((t=>{if(t.hidden)return null;const o={id:`${e}-${t.key}`,errorId:`${s}_${t.key}`,label:t.required?t.label:t.optionalLabel,autoCapitalize:t.autocapitalize,autoComplete:t.autocomplete,errorMessage:t.errorMessage,required:t.required,className:`wc-block-components-address-form__${t.key}`};if("country"===t.key){const e="shipping"===s?Or:Mr;return(0,r.createElement)(e,{key:t.key,...o,value:a.country,onChange:e=>{const t={...a,country:e,state:""};a.postcode&&!(0,wt.isPostcode)({postcode:a.postcode,country:e})&&(t.postcode=""),n(t)}})}if("state"===t.key){const e="shipping"===s?Vr:Fr;return(0,r.createElement)(e,{key:t.key,...o,country:a.country,value:a.state,onChange:e=>n({...a,state:e})})}return(0,r.createElement)(Ft.ValidatedTextInput,{key:t.key,ref:e=>g.current[t.key]=e,...o,type:t.type,value:a[t.key],onChange:e=>n({...a,[t.key]:e}),customFormatter:e=>"postcode"===t.key?e.trimStart().toUpperCase():e,customValidation:e=>((e,t,o)=>!((e.required||e.value)&&"postcode"===t&&o.country&&!(0,wt.isPostcode)({postcode:e.value,country:o.country})&&(e.setCustomValidity((0,c.__)("Please enter a valid postcode","woocommerce")),1)))(e,t.key,a)})})))},$r=Ur,jr=({address:e,onUpdate:t,onCancel:o,addressFields:n})=>{const[s,a]=(0,m.useState)(e),{showAllValidationErrors:l}=(0,z.useDispatch)(W.VALIDATION_STORE_KEY),{hasValidationErrors:i,isCustomerDataUpdating:u}=(0,z.useSelect)((e=>({hasValidationErrors:e(W.VALIDATION_STORE_KEY).hasValidationErrors,isCustomerDataUpdating:e(W.CART_STORE_KEY).isCustomerDataUpdating()})));return(0,r.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},(0,r.createElement)($r,{fields:n,onChange:a,values:s}),(0,r.createElement)(hr,{className:"wc-block-components-shipping-calculator-address__button",disabled:u,onClick:r=>(r.preventDefault(),ze()(s,e)?o():(l(),i()?void 0:t(s))),type:"submit"},(0,c.__)("Update","woocommerce")))},zr=({onUpdate:e=(()=>{}),onCancel:t=(()=>{}),addressFields:o=["country","state","city","postcode"]})=>{const{shippingAddress:c}=(()=>{const{customerData:e,isInitialized:t}=(0,z.useSelect)((e=>{const t=e(W.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}})),{setShippingAddress:o,setBillingAddress:r}=(0,z.useDispatch)(W.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:r,setShippingAddress:o}})(),n="wc/cart/shipping-calculator";return(0,r.createElement)("div",{className:"wc-block-components-shipping-calculator"},(0,r.createElement)(Ft.StoreNoticesContainer,{context:n}),(0,r.createElement)(jr,{address:c,addressFields:o,onCancel:t,onUpdate:t=>{(0,z.dispatch)(W.CART_STORE_KEY).updateCustomerData({shipping_address:t},!1).then((()=>{(e=>{const{removeNotice:t}=(0,z.dispatch)("core/notices"),{getNotices:o}=(0,z.select)("core/notices");o(e).forEach((o=>{t(o.id,e)}))})(n),e(t)})).catch((e=>{(0,W.processErrorResponse)(e,n)}))}}))},Kr=({label:e=(0,c.__)("Calculate","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o})=>(0,r.createElement)("a",{role:"button",href:"#wc-block-components-shipping-calculator-address__link",className:"wc-block-components-totals-shipping__change-address__link",id:"wc-block-components-totals-shipping__change-address__link",onClick:e=>{e.preventDefault(),o(!t)},"aria-label":e,"aria-expanded":t},e),Hr=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o,isCheckout:n=!1})=>e?(0,r.createElement)(Kr,{label:(0,c.__)("Add an address for shipping options","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o}):(0,r.createElement)("em",null,n?(0,c.__)("No shipping options available","woocommerce"):(0,c.__)("Calculated during checkout","woocommerce")),qr=()=>{const{pickupAddress:e}=(0,z.useSelect)((e=>{const t=e("wc/store/cart").getShippingRates().flatMap((e=>e.shipping_rates)).find((e=>e.selected&&Ue(e)));if(Fe(t)&&Ve(t,"meta_data")){const e=t.meta_data.find((e=>"pickup_address"===e.key));if(Fe(e)&&Ve(e,"value")&&e.value)return{pickupAddress:e.value}}return Fe(t),{pickupAddress:void 0}}));return void 0===e?null:(0,r.createElement)("span",{className:"wc-block-components-shipping-address"},(0,c.sprintf)(/* translators: %s: shipping method name, e.g. "Amazon Locker" */
|
||
(0,c.__)("Collection from %s","woocommerce"),e)+" ")},Zr=({formattedLocation:e})=>e?(0,r.createElement)("span",{className:"wc-block-components-shipping-address"},(0,c.sprintf)(/* translators: %s location. */
|
||
(0,c.__)("Shipping to %s","woocommerce"),e)+" "):null,Wr=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o,shippingAddress:n})=>{const{isEditor:s}=H(),a=(0,z.useSelect)((e=>e(W.CHECKOUT_STORE_KEY).prefersCollection()));if(!Ne(n)&&!s)return null;const l=Ne(n);return(0,r.createElement)(r.Fragment,null,a?(0,r.createElement)(qr,null):(0,r.createElement)(Zr,{formattedLocation:l}),e&&(0,r.createElement)(Kr,{label:(0,c.__)("Change address","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o}))};var Gr=o(5202),Qr=(o(1365),o(8184)),Xr=o(5430),Jr=o(5045);const ec=e=>{switch(e){case"success":case"warning":case"info":case"default":return"polite";default:return"assertive"}},tc=e=>{switch(e){case"success":return Qr.Z;case"warning":case"info":case"error":return Xr.Z;default:return Jr.Z}},oc=({className:e,status:t="default",children:o,spokenMessage:n=o,onRemove:a=(()=>{}),isDismissible:l=!0,politeness:i=ec(t),summary:d})=>(((e,t)=>{const o="string"==typeof e?e:(0,m.renderToString)(e);(0,m.useEffect)((()=>{o&&(0,Ot.speak)(o,t)}),[o,t])})(n,i),(0,r.createElement)("div",{className:s()(e,"wc-block-components-notice-banner","is-"+t,{"is-dismissible":l})},(0,r.createElement)(u.Z,{icon:tc(t)}),(0,r.createElement)("div",{className:"wc-block-components-notice-banner__content"},d&&(0,r.createElement)("p",{className:"wc-block-components-notice-banner__summary"},d),o),!!l&&(0,r.createElement)(hr,{className:"wc-block-components-notice-banner__dismiss",icon:Gr.Z,label:(0,c.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault&&e.preventDefault(),a()},showTooltip:!1})));var rc=o(7856),cc=o.n(rc);const nc=["a","b","em","i","strong","p","br"],sc=["target","href","rel","name","download"],ac=(e,t)=>{const o=(null==t?void 0:t.tags)||nc,r=(null==t?void 0:t.attr)||sc;return cc().sanitize(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:r})},lc=e=>{const t=(0,g.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:(0,ke.decodeEntities)(e.name),value:e.rate_id,description:(0,r.createElement)(r.Fragment,null,Number.isFinite(t)&&(0,r.createElement)(Ft.FormattedMonetaryAmount,{currency:(0,Vt.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,(0,ke.decodeEntities)(e.delivery_time))}},ic=({className:e="",noResultsMessage:t,onSelectRate:o,rates:c,renderOption:n=lc,selectedRate:s,disabled:a=!1})=>{const l=(null==s?void 0:s.rate_id)||"",i=rt(l),[u,d]=(0,m.useState)((()=>{var e;return l||(null===(e=c[0])||void 0===e?void 0:e.rate_id)}));if((0,m.useEffect)((()=>{l&&l!==i&&l!==u&&d(l)}),[l,u,i]),(0,m.useEffect)((()=>{u&&o(u)}),[o,u]),0===c.length)return t;if(c.length>1)return(0,r.createElement)(Ft.RadioControl,{className:e,onChange:e=>{d(e),o(e)},disabled:a,selected:u,options:c.map(n)});const{label:p,secondaryLabel:g,description:_,secondaryDescription:h}=n(c[0]);return(0,r.createElement)(Ft.RadioControlOptionLayout,{label:p,secondaryLabel:g,description:_,secondaryDescription:h})};o(6125);const uc=({packageId:e,className:t="",noResultsMessage:o,renderOption:n,packageData:a,collapsible:l,showItems:i})=>{const{selectShippingRate:u,isSelectingRate:d}=Ge(),p=document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length>1,g=null!=i?i:p,_=null!=l?l:p,h=(0,r.createElement)(r.Fragment,null,(_||g)&&(0,r.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:ac(a.name)}}),g&&(0,r.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(a.items).map((e=>{const t=(0,ke.decodeEntities)(e.name),o=e.quantity;return(0,r.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},(0,r.createElement)(Ft.Label,{label:o>1?`${t} × ${o}`:`${t}`,screenReaderLabel:(0,c.sprintf)(/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
||
(0,c._n)("%1$s (%2$d unit)","%1$s (%2$d units)",o,"woocommerce"),t,o)}))})))),b=(0,m.useCallback)((t=>{u(t,e)}),[e,u]),k={className:t,noResultsMessage:o,rates:a.shipping_rates,onSelectRate:b,selectedRate:a.shipping_rates.find((e=>e.selected)),renderOption:n,disabled:d};return _?(0,r.createElement)(Ft.Panel,{className:s()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":d}),initialOpen:!1,title:h},(0,r.createElement)(ic,{...k})):(0,r.createElement)("div",{className:s()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":d})},h,(0,r.createElement)(ic,{...k}))},dc=({packages:e,showItems:t,collapsible:o,noResultsMessage:c,renderOption:n})=>e.length?(0,r.createElement)(r.Fragment,null,e.map((({package_id:e,...s})=>(0,r.createElement)(uc,{key:e,packageId:e,packageData:s,collapsible:o,showItems:t,noResultsMessage:c,renderOption:n})))):null,pc=({shippingRates:e,isLoadingRates:t,className:o,collapsible:n,showItems:s,noResultsMessage:a,renderOption:l,context:i})=>{(0,m.useEffect)((()=>{var o,r;t||(o=(e=>e.length)(e),r=(e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0))(e),1===o?(0,Ot.speak)((0,c.sprintf)(/* translators: %d number of shipping options found. */
|
||
(0,c._n)("%d shipping option was found.","%d shipping options were found.",r,"woocommerce"),r)):(0,Ot.speak)((0,c.sprintf)(/* translators: %d number of shipping packages packages. */
|
||
(0,c._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",o,"woocommerce"),o)+" "+(0,c.sprintf)(/* translators: %d number of shipping options available. */
|
||
(0,c._n)("%d shipping option was found","%d shipping options were found",r,"woocommerce"),r)))}),[t,e]);const{extensions:u,receiveCart:d,...p}=Le(),g={className:o,collapsible:n,showItems:s,noResultsMessage:a,renderOption:l,extensions:u,cart:p,components:{ShippingRatesControlPackage:uc},context:i},{isEditor:_}=H(),{hasSelectedLocalPickup:h,selectedRates:b}=Ge(),k=Fe(b)?Object.values(b):[],w=k.every((e=>e===k[0]));return(0,r.createElement)(Ho,{isLoading:t,screenReaderLabel:(0,c.__)("Loading shipping rates…","woocommerce"),showSpinner:!0},h&&"woocommerce/cart"===i&&e.length>1&&!w&&!_&&(0,r.createElement)(oc,{className:"wc-block-components-notice",isDismissible:!1,status:"warning"},(0,c.__)("Multiple shipments must have the same pickup location","woocommerce")),(0,r.createElement)(wt.ExperimentalOrderShippingPackages.Slot,{...g}),(0,r.createElement)(wt.ExperimentalOrderShippingPackages,null,(0,r.createElement)(dc,{packages:e,noResultsMessage:a,renderOption:l})))},mc=({hasRates:e,shippingRates:t,isLoadingRates:o,isAddressComplete:n})=>{const s=e?(0,c.__)("Shipping options","woocommerce"):(0,c.__)("Choose a shipping option","woocommerce");return(0,r.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},(0,r.createElement)("legend",{className:"screen-reader-text"},s),(0,r.createElement)(pc,{className:"wc-block-components-totals-shipping__options",noResultsMessage:(0,r.createElement)(r.Fragment,null,n&&(0,r.createElement)(oc,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning"},(0,c.__)("There are no shipping options available. Please check your shipping address.","woocommerce"))),shippingRates:t,isLoadingRates:o,context:"woocommerce/cart"}))};o(5092);const gc=({currency:e,values:t,showCalculator:o=!0,showRateSelector:n=!0,isCheckout:a=!1,className:l})=>{const[i,u]=(0,m.useState)(!1),{shippingAddress:d,cartHasCalculatedShipping:p,shippingRates:_,isLoadingRates:h}=Le(),b=(e=>(0,g.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.total_shipping,10)+parseInt(e.total_shipping_tax,10):parseInt(e.total_shipping,10))(t),k=_.some((e=>e.shipping_rates.length))||b>0,w=o&&i,E=(0,z.useSelect)((e=>e(W.CHECKOUT_STORE_KEY).prefersCollection())),y=_.flatMap((e=>e.shipping_rates.filter((e=>E&&Ue(e)&&e.selected||!E&&e.selected)).flatMap((e=>e.name)))),v=(e=>!!e.city&&!!e.country)(d),f=((e,t,o)=>!e||!t&&o.some((e=>!e.shipping_rates.some((e=>!$e(e.method_id))))))(k,E,_);return(0,r.createElement)("div",{className:s()("wc-block-components-totals-shipping",l)},(0,r.createElement)(Ft.TotalsItem,{label:(0,c.__)("Shipping","woocommerce"),value:!f&&p?b:(!v||a)&&(0,r.createElement)(Hr,{showCalculator:o,isCheckout:a,isShippingCalculatorOpen:i,setIsShippingCalculatorOpen:u}),description:!f&&p||v&&!a?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Tr,{selectedShippingRates:y}),(0,r.createElement)(Wr,{shippingAddress:d,showCalculator:o,isShippingCalculatorOpen:i,setIsShippingCalculatorOpen:u})):null,currency:e}),w&&(0,r.createElement)(zr,{onUpdate:()=>{u(!1)},onCancel:()=>{u(!1)}}),n&&p&&!w&&(0,r.createElement)(mc,{hasRates:k,shippingRates:_,isLoadingRates:h,isAddressComplete:v}))},_c=()=>{const{extensions:e,receiveCart:t,...o}=Le(),c={extensions:e,cart:o,context:"woocommerce/cart"};return(0,r.createElement)(wt.ExperimentalOrderMeta.Slot,{...c})};(0,d.registerBlockType)("woocommerce/cart-order-summary-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e})=>{const t=(0,a.useBlockProps)(),{cartTotals:o}=Le(),n=(0,Vt.getCurrencyFromPriceResponse)(o),s=Nt(wt.innerBlockAreas.CART_ORDER_SUMMARY),l=[["woocommerce/cart-order-summary-heading-block",{content:(0,c.__)("Cart totals","woocommerce")},[]],["woocommerce/cart-order-summary-coupon-form-block",{},[]],["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:s,defaultTemplate:l}),(0,r.createElement)("div",{...t},(0,r.createElement)(a.InnerBlocks,{allowedBlocks:s,template:l}),(0,r.createElement)("div",{className:"wc-block-components-totals-wrapper"},(0,r.createElement)(Rr,{currency:n,values:o})),(0,r.createElement)(_c,null))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()},(0,r.createElement)(a.InnerBlocks.Content,null))});const hc=({className:e=""})=>{const{cartTotals:t}=Le(),o=(0,Vt.getCurrencyFromPriceResponse)(t);return(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(Ft.Subtotal,{currency:o,values:t}))};(0,d.registerBlockType)("woocommerce/cart-order-summary-subtotal-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(hc,{className:t}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const bc=({className:e})=>{const{cartFees:t,cartTotals:o}=Le(),c=(0,Vt.getCurrencyFromPriceResponse)(o);return(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(Ft.TotalsFees,{currency:c,cartFees:t}))};(0,d.registerBlockType)("woocommerce/cart-order-summary-fee-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(bc,{className:t}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const kc=()=>{const{extensions:e,receiveCart:t,...o}=Le(),c={extensions:e,cart:o,context:"woocommerce/cart"};return(0,r.createElement)(wt.ExperimentalDiscountsMeta.Slot,{...c})},wc=({className:e})=>{const{cartTotals:t,cartCoupons:o}=Le(),{removeCoupon:c,isRemovingCoupon:n}=rr("wc/cart"),s=(0,Vt.getCurrencyFromPriceResponse)(t);return(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(xr,{cartCoupons:o,currency:s,isRemovingCoupon:n,removeCoupon:c,values:t})),(0,r.createElement)(kc,null))};(0,d.registerBlockType)("woocommerce/cart-order-summary-discount-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(wc,{className:t}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const Ec=({className:e})=>{const{cartTotals:t,cartNeedsShipping:o}=Le();if(!o)return null;const c=(0,Vt.getCurrencyFromPriceResponse)(t);return(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(gc,{showCalculator:(0,g.getSetting)("isShippingCalculatorEnabled",!0),showRateSelector:!0,values:t,currency:c}))};(0,d.registerBlockType)("woocommerce/cart-order-summary-shipping-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,g.getSetting)("shippingEnabled",!0),n=(0,a.useBlockProps)();return(0,r.createElement)("div",{...n},(0,r.createElement)(a.InspectorControls,null,!!o&&(0,r.createElement)(mo.PanelBody,{title:(0,c.__)("Shipping Calculations","woocommerce")},(0,r.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,c.__)("Options that control shipping can be managed in your store settings.","woocommerce")),(0,r.createElement)(mo.ExternalLink,{href:`${g.ADMIN_URL}admin.php?page=wc-settings&tab=shipping§ion=options`},(0,c.__)("Manage shipping options","woocommerce"))," ")),(0,r.createElement)(Mt,null,(0,r.createElement)(Ec,{className:t})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});var yc=o(7625);const vc=({className:e})=>{const t=(0,g.getSetting)("couponsEnabled",!0),{applyCoupon:o,isApplyingCoupon:c}=rr("wc/cart");return t?(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(Nr,{onSubmit:o,isLoading:c})):null};(0,d.registerBlockType)("woocommerce/cart-order-summary-coupon-form-block",{icon:{src:(0,r.createElement)(u.Z,{icon:yc.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,a.useBlockProps)();return(0,r.createElement)("div",{...o},(0,r.createElement)(Mt,null,(0,r.createElement)(vc,{className:t})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})});const fc=({className:e,showRateAfterTaxName:t})=>{const{cartTotals:o}=Le();if((0,g.getSetting)("displayCartPricesIncludingTax",!1)||parseInt(o.total_tax,10)<=0)return null;const c=(0,Vt.getCurrencyFromPriceResponse)(o);return(0,r.createElement)(Ft.TotalsWrapper,{className:e},(0,r.createElement)(Ft.TotalsTaxes,{showRateAfterTaxName:t,currency:c,values:o}))},Cc={showRateAfterTaxName:{type:"boolean",default:(0,g.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{remove:!0,move:!1}}};(0,d.registerBlockType)("woocommerce/cart-order-summary-taxes-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},attributes:Cc,edit:({attributes:e,setAttributes:t})=>{const{className:o,showRateAfterTaxName:n}=e,s=(0,a.useBlockProps)(),l=(0,g.getSetting)("taxesEnabled"),i=(0,g.getSetting)("displayItemizedTaxes",!1),u=(0,g.getSetting)("displayCartPricesIncludingTax",!1);return(0,r.createElement)("div",{...s},(0,r.createElement)(a.InspectorControls,null,l&&i&&!u&&(0,r.createElement)(mo.PanelBody,{title:(0,c.__)("Taxes","woocommerce")},(0,r.createElement)(mo.ToggleControl,{label:(0,c.__)("Show rate after tax name","woocommerce"),help:(0,c.__)("Show the percentage rate alongside each tax line in the summary.","woocommerce"),checked:n,onChange:()=>t({showRateAfterTaxName:!n})}))),(0,r.createElement)(fc,{className:o,showRateAfterTaxName:n}))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})}),o(3867),(0,d.registerBlockType)("woocommerce/cart-order-summary-heading-block",{icon:{src:(0,r.createElement)(u.Z,{icon:Sr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e,setAttributes:t})=>{const{content:o="",className:c=""}=e,n=(0,a.useBlockProps)();return(0,r.createElement)("div",{...n},(0,r.createElement)("span",{className:s()(c,"wc-block-cart__totals-title")},(0,r.createElement)(a.PlainText,{className:"",value:o,onChange:e=>t({content:e}),style:{backgroundColor:"transparent"}})))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save()})}),o(8811);const Sc=(e,t=!0)=>{t?window.document.body.classList.add(e):window.document.body.classList.remove(e)},Nc=({attributes:e,setAttributes:t})=>{const{hasDarkControls:o}=e;return(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(mo.PanelBody,{title:(0,c.__)("Style","woocommerce")},(0,r.createElement)(mo.ToggleControl,{label:(0,c.__)("Dark mode inputs","woocommerce"),help:(0,c.__)("Inputs styled specifically for use on dark background colors.","woocommerce"),checked:o,onChange:()=>t({hasDarkControls:!o})})))};o(2);const Pc=(e,t)=>{const[o,r]=(0,m.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,m.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,r]},xc=[],Rc=({block:e})=>{const[t,o]=(e=>{const[t,o]=Pc("wc-blocks_dismissed_sidebar_compatibility_notices",xc),[r,c]=(0,m.useState)(!1),n=t.includes(e);return(0,m.useEffect)((()=>{c(!n)}),[n]),[r,()=>{const r=new Set(t);r.add(e),o([...r])}]})(e),n=(0,m.createInterpolateElement)((0,c.__)("The Cart & Checkout Blocks are built to optimize for faster checkout. To make sure this feature is right for your store, <a>review the list of compatible extensions</a>.","woocommerce"),{a:(0,r.createElement)(mo.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/#section-3"})});return(0,r.createElement)(mo.Notice,{onRemove:o,className:s()(["wc-blocks-sidebar-compatibility-notice",{"is-hidden":!t}])},n)};function Tc(){const e=(0,c.__)("Your store does not have any payment methods that support the Checkout block. Once you have configured a compatible payment method it will be displayed here.","woocommerce");return(0,r.createElement)(mo.Notice,{className:"wc-blocks-no-payment-methods-notice",status:"warning",spokenMessage:e,isDismissible:!1},(0,r.createElement)("div",{className:"wc-blocks-no-payment-methods-notice__content"},e," ",(0,r.createElement)(mo.ExternalLink,{href:`${g.ADMIN_URL}admin.php?page=wc-settings&tab=checkout`},(0,c.__)("Configure Payment Methods","woocommerce"))))}o(9446);const Ic=window.wp.editor,Ac=window.wp.coreData;function Bc({block:e}){const t="checkout"===e?R:T,o="checkout"===e?"woocommerce_checkout_page_id":"woocommerce_cart_page_id",n="checkout"===e?(0,c.__)("If you would like to use this block as your default checkout, update your page settings","woocommerce"):(0,c.__)("If you would like to use this block as your default cart, update your page settings","woocommerce"),{saveEntityRecord:s}=(0,z.useDispatch)(Ac.store),{editPost:a,savePost:l}=(0,z.useDispatch)(Ic.store),{slug:i,isLoadingPage:u,postPublished:d,currentPostId:p}=(0,z.useSelect)((o=>{var r;const{getEntityRecord:c,isResolving:n}=o(Ac.store),{isCurrentPostPublished:s,getCurrentPostId:a}=o(Ic.store);return{slug:(null===(r=c("postType","page",t))||void 0===r?void 0:r.slug)||e,isLoadingPage:n("getEntityRecord",["postType","page",t]),postPublished:s(),currentPostId:a()}}),[]),[g,_]=(0,m.useState)("pristine"),h=(0,m.useCallback)((()=>{_("updating"),Promise.resolve().then((()=>pt()({path:`/wc/v3/settings/advanced/${o}`,method:"GET"}))).catch((e=>{"rest_setting_setting_invalid"===e.code&&_("error")})).then((()=>{if(!d)return a({status:"publish"}),l()})).then((()=>pt()({path:`/wc/v3/settings/advanced/${o}`,method:"POST",data:{value:p.toString()}}))).then((()=>{if(0!==t)return s("postType","page",{id:t,slug:`${i}-2`})})).then((()=>a({slug:i}))).then((()=>l())).then((()=>_("updated")))}),[d,a,l,o,p,t,s,i]);return"string"==typeof pagenow&&"site-editor"===pagenow||p===t||"dismissed"===g?null:(0,r.createElement)(mo.Notice,{className:"wc-default-page-notice",status:"updated"===g?"success":"warning",onRemove:()=>_("dismissed"),spokenMessage:"updated"===g?(0,c.__)("Page settings updated","woocommerce"):n},"updated"===g?(0,c.__)("Page settings updated","woocommerce"):(0,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,n),(0,r.createElement)(mo.Button,{onClick:h,variant:"secondary",isBusy:"updating"===g,disabled:u,isSmall:!0},(0,c.__)("Update your page settings","woocommerce"))))}o(27);const Mc={warning:"#F0B849",error:"#CC1818",success:"#46B450",info:"#0073AA"},Oc=({status:e="warning",...t})=>(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},(0,r.createElement)("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:Mc[e],strokeWidth:"1.5"}),(0,r.createElement)("path",{d:"M13 7H11V13H13V7Z",fill:Mc[e]}),(0,r.createElement)("path",{d:"M13 15H11V17H13V15Z",fill:Mc[e]})),Dc=window.wp.notices;var Lc=o(2102);const Fc=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=Fc({blocks:o.innerBlocks,findCondition:t});if(e)return e}}},Vc=[],Yc=({blockType:e="woocommerce/cart"})=>"woocommerce/cart"===e?(0,r.createElement)("p",null,(0,c.__)("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,r.createElement)(r.Fragment,null,(0,r.createElement)("p",null,(0,c.__)("If you continue, the checkout block will be replaced with the classic experience powered by shortcodes. This means that you may lose:","woocommerce")),(0,r.createElement)("ul",{className:"cross-list"},(0,r.createElement)("li",null,(0,c.__)("Customizations and updates to the block","woocommerce")),(0,r.createElement)("li",null,(0,c.__)("Additional local pickup options created for the new checkout","woocommerce"))));function Uc({toggleDismissedStatus:e,block:t,clientId:o}){const[n,s,l,i]=(e=>{const[t,o,r]=(()=>{const e={};(0,g.getSetting)("incompatibleExtensions")&&(0,g.getSetting)("incompatibleExtensions").forEach((t=>{e[t.id]=t.title}));const t=Object.keys(e),o=t.length;return[e,t,o]})(),[c,n,s]=(()=>{const{incompatiblePaymentMethods:e}=(0,z.useSelect)((e=>{const{getIncompatiblePaymentMethods:t}=e(sr);return{incompatiblePaymentMethods:t()}}),[]),t=Object.keys(e);return[e,t,t.length]})(),a={...t,...c},l=[...o,...n],i=r+s,[u,d]=Pc("wc-blocks_dismissed_incompatible_extensions_notices",Vc),[p,_]=(0,m.useState)(!1),h=u.some((t=>{return Object.keys(t).includes(e)&&(o=t[e],r=l,o.length===r.length&&new Set([...o,...r]).size===o.length);var o,r})),b=0===i||h;return(0,m.useEffect)((()=>{_(!b),b||h||d((t=>t.reduce(((t,o)=>(Object.keys(o).includes(e)||t.push(o),t)),[])))}),[b,h,d,e]),[p,()=>{const t=new Set(u);t.add({[e]:l}),d([...t])},(k=a,Object.fromEntries(Object.entries(k).sort((([,e],[,t])=>e.localeCompare(t))))),i];var k})(t),[p,_]=(0,m.useState)(!1),h=()=>_(!1),{createInfoNotice:b}=(0,z.useDispatch)(Dc.store),{replaceBlock:k,selectBlock:w}=(0,z.useDispatch)(a.store),{undo:E}=(0,z.useDispatch)(Ac.store),{getBlocks:y}=(0,z.useSelect)((e=>({getBlocks:e(a.store).getBlocks})),[]);if((0,m.useEffect)((()=>{e(!n)}),[n,e]),!n)return null;const v="woocommerce/cart"===t?(0,c.__)("Switch to classic cart","woocommerce"):(0,c.__)("Switch to classic checkout","woocommerce"),f="woocommerce/cart"===t?(0,c.__)("Switched to classic cart.","woocommerce"):(0,c.__)("Switched to classic checkout.","woocommerce"),C=(0,r.createElement)(r.Fragment,null,i>1?(0,m.createInterpolateElement)((0,c.__)("Some active extensions do not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),{a:(0,r.createElement)(mo.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/"})}):(0,m.createInterpolateElement)((0,c.sprintf)(
|
||
// translators: %s is the name of the extension.
|
||
(0,c.__)("<strong>%s</strong> does not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),Object.values(l)[0]),{strong:(0,r.createElement)("strong",null),a:(0,r.createElement)(mo.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/"})}));return(0,r.createElement)(mo.Notice,{className:"wc-blocks-incompatible-extensions-notice",status:"warning",onRemove:s,spokenMessage:C},(0,r.createElement)("div",{className:"wc-blocks-incompatible-extensions-notice__content"},(0,r.createElement)(u.Z,{className:"wc-blocks-incompatible-extensions-notice__warning-icon",icon:(0,r.createElement)(Oc,null)}),(0,r.createElement)("div",null,(0,r.createElement)("p",null,C),i>1&&(0,r.createElement)("ul",null,Object.entries(l).map((([e,t])=>(0,r.createElement)("li",{key:e,className:"wc-blocks-incompatible-extensions-notice__element"},t)))),(0,r.createElement)(mo.Button,{variant:"secondary",onClick:()=>{(0,Lc.Ny)("switch_to_classic_shortcode_click",{shortcode:"woocommerce/checkout"===t?"checkout":"cart"}),_(!0)}},v),p&&(0,r.createElement)(mo.Modal,{size:"medium",title:v,onRequestClose:h,className:"wc-blocks-incompatible-extensions-notice-modal-content"},(0,r.createElement)(Yc,{blockType:t}),(0,r.createElement)(mo.TabbableContainer,{className:"wc-blocks-incompatible-extensions-notice-modal-actions"},(0,r.createElement)(mo.Button,{variant:"primary",isDestructive:!0,onClick:()=>{k(o,(0,d.createBlock)("woocommerce/classic-shortcode",{shortcode:"woocommerce/checkout"===t?"checkout":"cart"})),(0,Lc.Ny)("switch_to_classic_shortcode_confirm",{shortcode:"woocommerce/checkout"===t?"checkout":"cart"}),(()=>{const e=Fc({blocks:y(),findCondition:e=>"woocommerce/classic-shortcode"===e.name});e&&w(e.clientId)})(),b(f,{actions:[{label:(0,c.__)("Undo","woocommerce"),onClick:()=>{E(),(0,Lc.Ny)("switch_to_classic_shortcode_undo",{shortcode:"woocommerce/checkout"===t?"checkout":"cart"})}}],type:"snackbar"}),h()}},(0,c.__)("Switch","woocommerce"))," ",(0,r.createElement)(mo.Button,{variant:"secondary",onClick:()=>{(0,Lc.Ny)("switch_to_classic_shortcode_cancel",{shortcode:"woocommerce/checkout"===t?"checkout":"cart"}),h()}},(0,c.__)("Cancel","woocommerce")))))))}o(1128);var $c=o(7286),jc=o(6755);o(4662);const zc=({text:e,title:t=(0,c.__)("Feedback?","woocommerce"),url:o})=>{const[n,s]=(0,m.useState)(!1);return(0,m.useEffect)((()=>{s(!0)}),[]),(0,r.createElement)(r.Fragment,null,n&&(0,r.createElement)("div",{className:"wc-block-feedback-prompt"},(0,r.createElement)(u.Z,{icon:$c.Z}),(0,r.createElement)("h2",{className:"wc-block-feedback-prompt__title"},t),(0,r.createElement)("p",{className:"wc-block-feedback-prompt__text"},e),(0,r.createElement)("a",{href:o,className:"wc-block-feedback-prompt__link",rel:"noreferrer noopener",target:"_blank"},(0,c.__)("Give us your feedback.","woocommerce"),(0,r.createElement)(u.Z,{icon:jc.Z,size:16}))))},Kc=()=>(0,r.createElement)(zc,{text:(0,c.__)("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"}),Hc=(0,yt.createHigherOrderComponent)((e=>t=>{const{clientId:o,name:c,isSelected:n}=t,[s,l]=(0,m.useState)(!0),{isCart:i,isCheckout:u,isPaymentMethodsBlock:d,hasPaymentMethods:p,parentId:g}=(0,z.useSelect)((e=>{const{getBlockParentsByBlockName:t,getBlockName:r}=e(a.store),c=t(o,["woocommerce/cart","woocommerce/checkout"]).reduce(((e,t)=>(e[r(t)]=t,e)),{}),n=r(o),s=Object.keys(c).includes("woocommerce/cart"),l=Object.keys(c).includes("woocommerce/checkout"),i="woocommerce/cart"===n||s,u=i?"woocommerce/cart":"woocommerce/checkout";return{isCart:i,isCheckout:"woocommerce/checkout"===n||l,parentId:n===u?o:c[u],isPaymentMethodsBlock:"woocommerce/checkout-payment-block"===n,hasPaymentMethods:e(W.PAYMENT_STORE_KEY).paymentMethodsInitialized()&&Object.keys(e(W.PAYMENT_STORE_KEY).getAvailablePaymentMethods()).length>0}}));return c.startsWith("woocommerce/")&&n&&(i||u)?(0,r.createElement)(r.Fragment,null,(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(Uc,{toggleDismissedStatus:e=>{l(e)},block:i?"woocommerce/cart":"woocommerce/checkout",clientId:g}),(0,r.createElement)(Bc,{block:u?"checkout":"cart"}),s?(0,r.createElement)(Rc,{block:u?"checkout":"cart"}):null,d&&!p&&(0,r.createElement)(Tc,null),(0,r.createElement)(Kc,null)),(0,r.createElement)(e,{key:"edit",...t})):(0,r.createElement)(e,{key:"edit",...t})}),"withSidebarNotices");(0,Ze.hasFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice")||(0,Ze.addFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice",Hc,11);const qc=(0,r.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,r.createElement)("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"})),Zc=(e,t,o=!0)=>{const{updateBlockAttributes:r,selectBlock:c}=(0,z.dispatch)("core/block-editor");var n,s;r(e,{currentView:t}),o&&c((null===(n=(0,z.select)("core/block-editor").getBlock(e))||void 0===n||null===(s=n.innerBlocks.find((e=>e.name===t)))||void 0===s?void 0:s.clientId)||e)},Wc={views:[],currentView:"",viewClientId:""},Gc=(e,t=10,o=0)=>{const r=o+1;if(r>t)return Wc;const{getBlockAttributes:c,getBlockRootClientId:n}=(0,z.select)("core/block-editor"),s=n(e);if(null===s||""===s)return Wc;const a=c(s);return a?void 0!==a.editorViews?{views:a.editorViews,currentView:a.currentView||a.editorViews[0].view,viewClientId:s}:Gc(s,t,r):Wc},Qc=({currentView:e,views:t,clientId:o})=>{const{getBlockName:n,getSelectedBlockClientId:s,getBlockParentsByBlockName:l}=(0,z.useSelect)((e=>{const t=e("core/block-editor");return{getBlockName:t.getBlockName,getSelectedBlockClientId:t.getSelectedBlockClientId,getBlockParentsByBlockName:t.getBlockParentsByBlockName}}),[]),i=s(),d=((e,t)=>t.find((t=>t.view===e)))(e,t)||t[0],p=d.label;return(0,m.useLayoutEffect)((()=>{const r=i?n(i):null;if(!r||e===r)return;const c=t.map((e=>e.view));if(c.includes(r))return void Zc(o,r);const s=l(i,c),a=1===s.length?n(s[0]):null;a&&e!==a&&Zc(o,a,!1)}),[o,e,n,l,i,t]),(0,r.createElement)(a.BlockControls,null,(0,r.createElement)(mo.ToolbarGroup,null,(0,r.createElement)(mo.ToolbarDropdownMenu,{label:(0,c.__)("Switch view","woocommerce"),text:p,icon:(0,r.createElement)(u.Z,{icon:qc,style:{marginRight:"8px"}}),controls:t.map((t=>({...t,title:(0,r.createElement)("span",{style:{marginLeft:"8px"}},t.label),isActive:t.view===e,onClick:()=>{Zc(o,t.view)}})))})))};(0,Ze.hasFilter)("editor.BlockEdit","woocommerce/with-view-switcher")||(0,Ze.addFilter)("editor.BlockEdit","woocommerce/with-view-switcher",(e=>t=>{const{clientId:o}=t,{views:c,currentView:n,viewClientId:s}=(0,z.useSelect)((e=>{const t=e("core/block-editor").getBlockAttributes(o);return null!=t&&t.editorViews?{views:t.editorViews,currentView:t.currentView,viewClientId:o}:Gc(o)}));return 0===c.length?(0,r.createElement)(e,{...t}):(0,r.createElement)(r.Fragment,null,(0,r.createElement)(Qc,{currentView:n,views:c,clientId:s}),(0,r.createElement)(e,{...t}))}),11),(0,Ze.hasFilter)("blocks.registerBlockType","core/lock/addAttribute")||(0,z.subscribe)((()=>{var e,t,o,r;const c=(0,z.select)(a.store);if(!c)return;const n=c.getSelectedBlock();n&&(Sc("wc-lock-selected-block--remove",!(null==n||null===(e=n.attributes)||void 0===e||null===(t=e.lock)||void 0===t||!t.remove)),Sc("wc-lock-selected-block--move",!(null==n||null===(o=n.attributes)||void 0===o||null===(r=o.lock)||void 0===r||!r.move)))}));const Xc=["woocommerce/filled-cart-block","woocommerce/empty-cart-block"];o(6375);const Jc={isPreview:{type:"boolean",default:!1},currentView:{type:"string",default:"woocommerce/filled-cart-block",source:"readonly"},editorViews:{type:"object",default:[{view:"woocommerce/filled-cart-block",label:(0,c.__)("Filled Cart","woocommerce"),icon:(0,r.createElement)(u.Z,{icon:Et})},{view:"woocommerce/empty-cart-block",label:(0,c.__)("Empty Cart","woocommerce"),icon:(0,r.createElement)(u.Z,{icon:Er})}]},hasDarkControls:{type:"boolean",default:(0,g.getSetting)("hasDarkEditorStyleSupport",!1)},isShippingCalculatorEnabled:{type:"boolean",default:(0,g.getSetting)("isShippingCalculatorEnabled",!0)},checkoutPageId:{type:"number",default:0},showRateAfterTaxName:{type:"boolean",default:!0},align:{type:"string",default:"wide"}},en={title:(0,c.__)("Cart","woocommerce"),icon:{src:(0,r.createElement)(u.Z,{icon:i,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[(0,c.__)("WooCommerce","woocommerce")],description:(0,c.__)("Shopping cart.","woocommerce"),supports:{align:["wide"],html:!1,multiple:!1},example:{attributes:{isPreview:!0},viewportWidth:800},attributes:Jc,edit:({clientId:e,className:t,attributes:o,setAttributes:n})=>{const{hasDarkControls:l,currentView:i,isPreview:u=!1}=o,p=((e={})=>{const t=(0,m.useRef)(),o=(0,a.useBlockProps)({ref:t,...e});return(({ref:e})=>{const t=(0,Ze.hasFilter)("blocks.registerBlockType","core/lock/addAttribute"),o=e.current;(0,m.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!==Dt.BACKSPACE&&t!==Dt.DELETE)return;if((0,It.isTextField)(o))return;const r=o;if(void 0===r.dataset.block)return;const c=(e=>{var t,o,r,c,n;if(!e)return!1;const{getBlock:s}=(0,z.select)(a.store),l=s(e);if("boolean"==typeof(null==l||null===(t=l.attributes)||void 0===t||null===(o=t.lock)||void 0===o?void 0:o.remove))return l.attributes.lock.remove;const i=(0,d.getBlockType)(l.name);var u,p,m;return"boolean"==typeof(null==i||null===(r=i.attributes)||void 0===r||null===(c=r.lock)||void 0===c||null===(n=c.default)||void 0===n?void 0:n.remove)&&(null==i||null===(u=i.attributes)||void 0===u||null===(p=u.lock)||void 0===p||null===(m=p.default)||void 0===m?void 0:m.remove)})(r.dataset.block);c&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}}),[o,t])})({ref:t}),o})({className:s()(t,"wp-block-woocommerce-cart",{"is-editor-preview":u})}),g=(0,m.useRef)((0,Ce.getQueryArg)(window.location.href,"focus"));return(0,m.useEffect)((()=>{"cart"!==g.current||(0,z.select)("core/block-editor").hasSelectedBlock()||((0,z.dispatch)("core/block-editor").selectBlock(e),(0,z.dispatch)("core/interface").enableComplementaryArea("core/edit-site","edit-site/block-inspector"))}),[e]),(0,r.createElement)("div",{...p},(0,r.createElement)(a.InspectorControls,null,(0,r.createElement)(Nc,{attributes:o,setAttributes:n})),(0,r.createElement)(j,{header:(0,c.__)("Cart Block Error","woocommerce"),text:(0,c.__)("There was an error whilst rendering the cart block. If this problem continues, try re-creating the block.","woocommerce"),showErrorMessage:!0,errorMessagePrefix:(0,c.__)("Error message:","woocommerce")},(0,r.createElement)(q,{previewData:{previewCart:qe},currentView:i,isPreview:u},(0,r.createElement)(xt.Provider,{value:{hasDarkControls:l}},(0,r.createElement)(wt.SlotFillProvider,null,(0,r.createElement)(kt,null,(0,r.createElement)(a.InnerBlocks,{allowedBlocks:Xc,template:[["woocommerce/filled-cart-block",{},[]],["woocommerce/empty-cart-block",{},[]]],templateLock:"insert"})))))))},save:()=>(0,r.createElement)("div",{...a.useBlockProps.save({className:"is-loading"})},(0,r.createElement)(a.InnerBlocks.Content,null)),transforms:{to:[{type:"block",blocks:["woocommerce/classic-shortcode"],transform:e=>(0,d.createBlock)("woocommerce/classic-shortcode",{shortcode:"cart",align:e.align},[])}]},deprecated:[{attributes:Jc,save:({attributes:e})=>(0,r.createElement)("div",{className:s()("is-loading",e.className)},(0,r.createElement)(a.InnerBlocks.Content,null)),migrate:(e,t)=>{const{checkoutPageId:o,align:r}=e;return[e,[(0,d.createBlock)("woocommerce/filled-cart-block",{align:r},[(0,d.createBlock)("woocommerce/cart-items-block"),(0,d.createBlock)("woocommerce/cart-totals-block",{},[(0,d.createBlock)("woocommerce/cart-order-summary-block",{}),(0,d.createBlock)("woocommerce/cart-express-payment-block"),(0,d.createBlock)("woocommerce/proceed-to-checkout-block",{checkoutPageId:o}),(0,d.createBlock)("woocommerce/cart-accepted-payment-methods-block")])]),(0,d.createBlock)("woocommerce/empty-cart-block",{align:r},t)]]},isEligible:(e,t)=>!t.find((e=>"woocommerce/filled-cart-block"===e.name))}]};(0,d.registerBlockType)("woocommerce/cart",en)},1464:()=>{},8854:()=>{},402:()=>{},1314:()=>{},5160:()=>{},4578:()=>{},5482:()=>{},6294:()=>{},9086:()=>{},4948:()=>{},6315:()=>{},7984:()=>{},9889:()=>{},7866:()=>{},6125:()=>{},5454:()=>{},5154:()=>{},6305:()=>{},5092:()=>{},5821:()=>{},7775:()=>{},6575:()=>{},1365:()=>{},5641:()=>{},5138:()=>{},4667:()=>{},6430:()=>{},8410:()=>{},6620:()=>{},8811:()=>{},7995:()=>{},8584:()=>{},4235:()=>{},3867:()=>{},8438:()=>{},4974:()=>{},7463:()=>{},8526:()=>{},6375:()=>{},27:()=>{},4662:()=>{},1128:()=>{},9446:()=>{},2:()=>{},129:()=>{},9196:e=>{"use strict";e.exports=window.React},2819:e=>{"use strict";e.exports=window.lodash},5158:e=>{"use strict";e.exports=window.wp.a11y},4333:e=>{"use strict";e.exports=window.wp.compose},7180:e=>{"use strict";e.exports=window.wp.deprecated},5904:e=>{"use strict";e.exports=window.wp.dom},9307:e=>{"use strict";e.exports=window.wp.element},5736:e=>{"use strict";e.exports=window.wp.i18n},9127:e=>{"use strict";e.exports=window.wp.isShallowEqual},9630:e=>{"use strict";e.exports=window.wp.keycodes},444:e=>{"use strict";e.exports=window.wp.primitives},2560:e=>{"use strict";e.exports=window.wp.warning}},o={};function r(e){var c=o[e];if(void 0!==c)return c.exports;var n=o[e]={exports:{}};return t[e].call(n.exports,n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,o,c,n)=>{if(!o){var s=1/0;for(u=0;u<e.length;u++){for(var[o,c,n]=e[u],a=!0,l=0;l<o.length;l++)(!1&n||s>=n)&&Object.keys(r.O).every((e=>r.O[e](o[l])))?o.splice(l--,1):(a=!1,n<s&&(s=n));if(a){e.splice(u--,1);var i=c();void 0!==i&&(t=i)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[o,c,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.j=511,(()=>{var e={511:0};r.O.j=t=>0===e[t];var t=(t,o)=>{var c,n,[s,a,l]=o,i=0;if(s.some((t=>0!==e[t]))){for(c in a)r.o(a,c)&&(r.m[c]=a[c]);if(l)var u=l(r)}for(t&&t(o);i<s.length;i++)n=s[i],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(u)},o=self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var c=r.O(void 0,[2869],(()=>r(9932)));c=r.O(c),((this.wc=this.wc||{}).blocks=this.wc.blocks||{}).cart=c})(); |