PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/footcrew.com/wp-content/plugins/woocommerce/assets/client/blocks/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : /home/trave494/footcrew.com/wp-content/plugins/woocommerce/assets/client/blocks/checkout.js

(()=>{var e,t={7806:(e,t,o)=>{"use strict";o.r(t);var c=o(9196),r=o(3849),n=o.n(r),s=o(444);const a=(0,c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none"},(0,c.createElement)("path",{stroke:"currentColor",strokeWidth:"1.5",fill:"none",d:"M5 3.75h14c.69 0 1.25.56 1.25 1.25v14c0 .69-.56 1.25-1.25 1.25H5c-.69 0-1.25-.56-1.25-1.25V5c0-.69.56-1.25 1.25-1.25z"}),(0,c.createElement)("path",{fill:"currentColor",fillRule:"evenodd",d:"M6.4 10.75c0-.47.38-.85.85-.85h9.5c.47 0 .85.38.85.85v1.5c0 .47-.38.85-.85.85h-9.5a.85.85 0 01-.85-.85v-1.5zm1.2.35v.8h8.8v-.8H7.6zM12.4 15.25c0-.47.38-.85.85-.85h3.5c.47 0 .85.38.85.85v1.5c0 .47-.38.85-.85.85h-3.5a.85.85 0 01-.85-.85v-1.5zm1.2.35v.8h2.8v-.8h-2.8zM6.5 15.9a.6.6 0 01.6-.6h2.8a.6.6 0 010 1.2H7.1a.6.6 0 01-.6-.6zM6.5 7.9a.6.6 0 01.6-.6h9.8a.6.6 0 110 1.2H7.1a.6.6 0 01-.6-.6z",clipRule:"evenodd"}));var i=o(2911);const l=window.wp.blocks;var m=o(5736);const d=window.wp.blockEditor;var p=o(9307),u=o(4333);const h=(0,p.createContext)({hasContainerWidth:!1,containerClassName:"",isMobile:!1,isSmall:!1,isMedium:!1,isLarge:!1}),_=({children:e,className:t=""})=>{const[o,r]=(()=>{const[e,{width:t}]=(0,u.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]})(),s={hasContainerWidth:""!==r,containerClassName:r,isMobile:"is-mobile"===r,isSmall:"is-small"===r,isMedium:"is-medium"===r,isLarge:"is-large"===r};return(0,c.createElement)(h.Provider,{value:s},(0,c.createElement)("div",{className:n()(t,r)},o,e))};o(906);const g=({children:e,className:t})=>(0,c.createElement)(_,{className:n()("wc-block-components-sidebar-layout",t)},e),k=window.wp.data,E=(0,p.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>({})}),w=()=>(0,p.useContext)(E),b=({children:e,currentPostId:t=0,previewData:o={},currentView:r="",isPreview:n=!1})=>{const s=(0,k.useSelect)((e=>t||e("core/editor").getCurrentPostId()),[t]),a=(0,p.useCallback)((e=>o&&e in o?o[e]:{}),[o]),i={isEditor:!0,currentPostId:s,currentView:r,previewData:o,getPreviewData:a,isPreview:n};return(0,c.createElement)(E.Provider,{value:i},e)},y=window.wp.plugins,v=window.wc.wcSettings;var f,C,S,P,N,T,R,x,A,I,M=o(7708);const O=(0,v.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),B=O.pluginUrl+"assets/images/",D=(O.pluginUrl,O.buildPhase,null===(f=v.STORE_PAGES.shop)||void 0===f||f.permalink,null===(C=v.STORE_PAGES.checkout)||void 0===C?void 0:C.id),L=(null===(S=v.STORE_PAGES.checkout)||void 0===S||S.permalink,null===(P=v.STORE_PAGES.privacy)||void 0===P?void 0:P.permalink),F=(null===(N=v.STORE_PAGES.privacy)||void 0===N||N.title,null===(T=v.STORE_PAGES.terms)||void 0===T?void 0:T.permalink),Y=(null===(R=v.STORE_PAGES.terms)||void 0===R||R.title,null===(x=v.STORE_PAGES.cart)||void 0===x?void 0:x.id),U=null===(A=v.STORE_PAGES.cart)||void 0===A?void 0:A.permalink,V=(null!==(I=v.STORE_PAGES.myaccount)&&void 0!==I&&I.permalink?v.STORE_PAGES.myaccount.permalink:(0,v.getSetting)("wpLoginUrl","/wp-login.php"),(0,v.getSetting)("localPickupEnabled",!1)),j=(0,v.getSetting)("countries",{}),K=(0,v.getSetting)("countryData",{}),$=Object.fromEntries(Object.keys(K).filter((e=>!0===K[e].allowBilling)).map((e=>[e,j[e]||""]))),H=Object.fromEntries(Object.keys(K).filter((e=>!0===K[e].allowBilling)).map((e=>[e,K[e].states||[]]))),q=Object.fromEntries(Object.keys(K).filter((e=>!0===K[e].allowShipping)).map((e=>[e,j[e]||""]))),z=Object.fromEntries(Object.keys(K).filter((e=>!0===K[e].allowShipping)).map((e=>[e,K[e].states||[]]))),Z=Object.fromEntries(Object.keys(K).map((e=>[e,K[e].locale||[]]))),W={address:["first_name","last_name","company","address_1","address_2","city","postcode","country","state","phone"],contact:["email"],additional:[]},G=(0,v.getSetting)("addressFieldsLocations",W).address,X=((0,v.getSetting)("addressFieldsLocations",W).contact,(0,v.getSetting)("addressFieldsLocations",W).additional,({imageUrl:e=`${B}/block-error.svg`,header:t=(0,m.__)("Oops!","woocommerce"),text:o=(0,m.__)("There was an error loading the content.","woocommerce"),errorMessage:r,errorMessagePrefix:n=(0,m.__)("Error:","woocommerce"),button:s,showErrorBlock:a=!0})=>a?(0,c.createElement)("div",{className:"wc-block-error wc-block-components-error"},e&&(0,c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:e,alt:""}),(0,c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},t&&(0,c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},t),o&&(0,c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},o),r&&(0,c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},n?n+" ":"",r),s&&(0,c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},s))):null);o(8406);class J extends p.Component{constructor(...e){super(...e),(0,M.Z)(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:(0,c.createElement)(c.Fragment,null,(0,c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:o=!0,showErrorBlock:r=!0,text:n,errorMessagePrefix:s,renderError:a,button:i}=this.props,{errorMessage:l,hasError:m}=this.state;return m?"function"==typeof a?a({errorMessage:l}):(0,c.createElement)(X,{showErrorBlock:r,errorMessage:o?l:null,header:e,imageUrl:t,text:n,errorMessagePrefix:s,button:i}):this.props.children}}const Q=J,ee=window.wc.wcBlocksData;var te=o(7180),oe=o.n(te);let ce=function(e){return e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback",e}({});const re={},ne=(e=re,{type:t,eventType:o,id:c,callback:r,priority:n})=>{const s=e.hasOwnProperty(o)?new Map(e[o]):new Map;switch(t){case ce.ADD_EVENT_CALLBACK:return s.set(c,{priority:n,callback:r}),{...e,[o]:s};case ce.REMOVE_EVENT_CALLBACK:return s.delete(c),{...e,[o]:s}}},se=(e,t)=>(o,c=10)=>{const r=((e,t,o=10)=>({id:Math.floor(Math.random()*Date.now()).toString(),type:ce.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:o}))(e,o,c);return t(r),()=>{var o;t((o=e,{id:r.id,type:ce.REMOVE_EVENT_CALLBACK,eventType:o}))}},ae=(0,p.createContext)({onPaymentProcessing:()=>()=>()=>{},onPaymentSetup:()=>()=>()=>{}}),ie=({children:e})=>{const{isProcessing:t,isIdle:o,isCalculating:r,hasError:n}=(0,k.useSelect)((e=>{const t=e(ee.CHECKOUT_STORE_KEY);return{isProcessing:t.isProcessing(),isIdle:t.isIdle(),hasError:t.hasError(),isCalculating:t.isCalculating()}})),{isPaymentReady:s}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{isPaymentProcessing:t.isPaymentProcessing(),isPaymentReady:t.isPaymentReady()}})),{setValidationErrors:a}=(0,k.useDispatch)(ee.VALIDATION_STORE_KEY),[i,l]=(0,p.useReducer)(ne,{}),{onPaymentSetup:m}=(e=>(0,p.useMemo)((()=>({onPaymentSetup:se("payment_setup",e)})),[e]))(l),d=(0,p.useRef)(i);(0,p.useEffect)((()=>{d.current=i}),[i]);const{__internalSetPaymentProcessing:u,__internalSetPaymentIdle:h,__internalEmitPaymentProcessingEvent:_}=(0,k.useDispatch)(ee.PAYMENT_STORE_KEY);(0,p.useEffect)((()=>{!t||n||r||(u(),_(d.current,a))}),[t,n,r,u,_,a]),(0,p.useEffect)((()=>{o&&!s&&h()}),[o,s,h]),(0,p.useEffect)((()=>{n&&s&&h()}),[n,s,h]);const g={onPaymentProcessing:(0,p.useMemo)((()=>function(...e){return oe()("onPaymentProcessing",{alternative:"onPaymentSetup",plugin:"WooCommerce Blocks"}),m(...e)}),[m]),onPaymentSetup:m};return(0,c.createElement)(ae.Provider,{value:g},e)},le={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},me={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"},de={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:e=>e,shippingErrorTypes:le,onShippingRateSuccess:()=>()=>{},onShippingRateFail:()=>()=>{},onShippingRateSelectSuccess:()=>()=>{},onShippingRateSelectFail:()=>()=>{}},pe=(e,{type:t})=>Object.values(le).includes(t)?t:e,ue="shipping_rates_success",he="shipping_rates_fail",_e="shipping_rate_select_success",ge="shipping_rate_select_fail",ke=e=>({onSuccess:se(ue,e),onFail:se(he,e),onSelectSuccess:se(_e,e),onSelectFail:se(ge,e)});let Ee=function(e){return e.SUCCESS="success",e.FAIL="failure",e.ERROR="error",e}({}),we=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 be=async(e,t,o)=>{const c=((e,t)=>e[t]?Array.from(e[t].values()).sort(((e,t)=>e.priority-t.priority)):[])(e,t),r=[];for(const e of c)try{const t=await Promise.resolve(e.callback(o));"object"==typeof t&&r.push(t)}catch(e){console.error(e)}return!r.length||r};var ye=o(9262),ve=o.n(ye);const fe=window.wp.htmlEntities,Ce=e=>"string"==typeof e,Se=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,m.sprintf)(/* translators: %s Field label. */ /* translators: %s Field label. */
(0,m.__)("%s (optional)","woocommerce"),e.label)),e.priority&&("number"==typeof e.priority&&(t.index=e.priority),Ce(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},Pe=Object.entries(Z).map((([e,t])=>[e,Object.entries(t).map((([e,t])=>[e,Se(t)])).reduce(((e,[t,o])=>(e[t]=o,e)),{})])).reduce(((e,[t,o])=>(e[t]=o,e)),{}),Ne=(e,t,o="")=>{const c=o&&void 0!==Pe[o]?Pe[o]:{};return e.map((e=>({key:e,...v.defaultFields[e]||{},...c[e]||{},...t[e]||{}}))).sort(((e,t)=>e.index-t.index))},Te=window.wp.url,Re=(e,t)=>e in t,xe=e=>{const t=Ne(G,{},e.country),o=Object.assign({},e);return t.forEach((({key:t="",hidden:c=!1})=>{c&&Re(t,e)&&(o[t]="")})),o},Ae=e=>{if(0===Object.values(e).length)return null;const t="string"==typeof q[e.country]?(0,fe.decodeEntities)(q[e.country]):"",o="object"==typeof z[e.country]&&"string"==typeof z[e.country][e.state]?(0,fe.decodeEntities)(z[e.country][e.state]):e.state,c=[];c.push(e.postcode.toUpperCase()),c.push(e.city),c.push(o),c.push(t);return c.filter(Boolean).join(", ")||null},Ie=e=>!!e.country&&Ne(G,{},e.country).every((({key:t="",hidden:o=!1,required:c=!1})=>!(!o&&c)||Re(t,e)&&""!==e[t])),Me=window.CustomEvent||null,Oe=(e,t,o=!1,c=!1)=>{if("function"!=typeof jQuery)return()=>{};const r=()=>{((e,{bubbles:t=!1,cancelable:o=!1,element:c,detail:r={}})=>{if(!Me)return;c||(c=document.body);const n=new Me(e,{bubbles:t,cancelable:o,detail:r});c.dispatchEvent(n)})(t,{bubbles:o,cancelable:c})};return jQuery(document).on(e,r),()=>jQuery(document).off(e,r)},Be=e=>{const t=null==e?void 0:e.detail;t&&t.preserveCartData||(0,k.dispatch)(ee.CART_STORE_KEY).invalidateResolutionForStore()},De=e=>{(null!=e&&e.persisted||"back_forward"===(window.performance&&window.performance.getEntriesByType("navigation").length?window.performance.getEntriesByType("navigation")[0].type:""))&&(0,k.dispatch)(ee.CART_STORE_KEY).invalidateResolutionForStore()},Le=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},Fe={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},Ye={...Fe,email:""},Ue={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:ee.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},Ve=e=>Object.fromEntries(Object.entries(e).map((([e,t])=>[e,(0,fe.decodeEntities)(t)]))),je={cartCoupons:ee.EMPTY_CART_COUPONS,cartItems:ee.EMPTY_CART_ITEMS,cartFees:ee.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,crossSellsProducts:ee.EMPTY_CART_CROSS_SELLS,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:ee.EMPTY_CART_ITEM_ERRORS,cartTotals:Ue,cartIsLoading:!0,cartErrors:ee.EMPTY_CART_ERRORS,billingAddress:Ye,shippingAddress:Fe,shippingRates:ee.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentMethods:ee.EMPTY_PAYMENT_METHODS,paymentRequirements:ee.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},receiveCartContents:()=>{},extensions:ee.EMPTY_EXTENSIONS},Ke=(e={shouldSelect:!0})=>{const{isEditor:t,previewData:o}=w(),c=null==o?void 0:o.previewCart,{shouldSelect:r}=e,n=(0,p.useRef)();(0,p.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",Be),document.body.addEventListener("wc-blocks_removed_from_cart",Be),window.addEventListener("pageshow",De);const t=Oe("added_to_cart","wc-blocks_added_to_cart"),o=Oe("removed_from_cart","wc-blocks_removed_from_cart");window.wcBlocksStoreCartListeners.count=1,window.wcBlocksStoreCartListeners.remove=()=>{document.body.removeEventListener("wc-blocks_added_to_cart",Be),document.body.removeEventListener("wc-blocks_removed_from_cart",Be),window.removeEventListener("pageshow",De),t(),o()}})(),Le)),[]);const s=(0,k.useSelect)(((e,{dispatch:o})=>{if(!r)return je;if(t)return{cartCoupons:c.coupons,cartItems:c.items,crossSellsProducts:c.cross_sells,cartFees:c.fees,cartItemsCount:c.items_count,cartItemsWeight:c.items_weight,cartNeedsPayment:c.needs_payment,cartNeedsShipping:c.needs_shipping,cartItemErrors:ee.EMPTY_CART_ITEM_ERRORS,cartTotals:c.totals,cartIsLoading:!1,cartErrors:ee.EMPTY_CART_ERRORS,billingData:Ye,billingAddress:Ye,shippingAddress:Fe,extensions:ee.EMPTY_EXTENSIONS,shippingRates:c.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:c.has_calculated_shipping,paymentRequirements:c.paymentRequirements,receiveCart:"function"==typeof(null==c?void 0:c.receiveCart)?c.receiveCart:()=>{},receiveCartContents:"function"==typeof(null==c?void 0:c.receiveCartContents)?c.receiveCartContents:()=>{}};const n=e(ee.CART_STORE_KEY),s=n.getCartData(),a=n.getCartErrors(),i=n.getCartTotals(),l=!n.hasFinishedResolution("getCartData"),m=n.isCustomerDataUpdating(),{receiveCart:d,receiveCartContents:p}=o(ee.CART_STORE_KEY),u=Ve(s.billingAddress),h=s.needsShipping?Ve(s.shippingAddress):u,_=s.fees.length>0?s.fees.map((e=>Ve(e))):ee.EMPTY_CART_FEES,g=s.coupons.length>0?s.coupons.map((e=>({...e,label:e.code}))):ee.EMPTY_CART_COUPONS;return{cartCoupons:g,cartItems:s.items,crossSellsProducts:s.crossSells,cartFees:_,cartItemsCount:s.itemsCount,cartItemsWeight:s.itemsWeight,cartNeedsPayment:s.needsPayment,cartNeedsShipping:s.needsShipping,cartItemErrors:s.errors,cartTotals:i,cartIsLoading:l,cartErrors:a,billingData:xe(u),billingAddress:xe(u),shippingAddress:xe(h),extensions:s.extensions,shippingRates:s.shippingRates,isLoadingRates:m,cartHasCalculatedShipping:s.hasCalculatedShipping,paymentRequirements:s.paymentRequirements,receiveCart:d,receiveCartContents:p}}),[r]);return n.current&&ve()(n.current,s)||(n.current=s),n.current},$e=e=>null===e,He=e=>!$e(e)&&e instanceof Object&&e.constructor===Object;function qe(e,t){return He(e)&&t in e}const ze=e=>e.length,Ze=(0,v.getSetting)("collectableMethodIds",[]),We=e=>Ze.includes(e.method_id),Ge=e=>!!V&&(Array.isArray(e)?!!e.find((e=>Ze.includes(e))):Ze.includes(e)),Xe=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)||""]})));var Je=o(9127),Qe=o.n(Je);const et=[{destination:{address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},package_id:0,name:(0,m.__)("Shipping","woocommerce"),items:[{key:"33e75ff09dd601bbe69f351039152189",name:(0,m._x)("Beanie with Logo","example product in Cart Block","woocommerce"),quantity:2},{key:"6512bd43d9caa6e02c990b0a82652dca",name:(0,m._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,m.__)("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,m.__)("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,m.__)("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,m.__)("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}]}],tt=(0,v.getSetting)("displayCartPricesIncludingTax",!1),ot={coupons:[],shipping_rates:(0,v.getSetting)("shippingMethodsExist",!1)||(0,v.getSetting)("localPickupEnabled",!1)?et:[],items:[{key:"1",id:1,type:"simple",quantity:2,catalog_visibility:"visible",name:(0,m.__)("Beanie","woocommerce"),summary:(0,m.__)("Beanie","woocommerce"),short_description:(0,m.__)("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:B+"previews/beanie.jpg",thumbnail:B+"previews/beanie.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,m.__)("Color","woocommerce"),value:(0,m.__)("Yellow","woocommerce")},{attribute:(0,m.__)("Size","woocommerce"),value:(0,m.__)("Small","woocommerce")}],prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:tt?"12000":"10000",regular_price:tt?"12000":"10000",sale_price:tt?"12000":"10000",price_range:null,raw_prices:{precision:6,price:tt?"12000000":"10000000",regular_price:tt?"12000000":"10000000",sale_price:tt?"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,m.__)("Cap","woocommerce"),summary:(0,m.__)("Cap","woocommerce"),short_description:(0,m.__)("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:B+"previews/cap.jpg",thumbnail:B+"previews/cap.jpg",srcset:"",sizes:"",name:"",alt:""}],variation:[{attribute:(0,m.__)("Color","woocommerce"),value:(0,m.__)("Orange","woocommerce")}],prices:{currency_code:"USD",currency_symbol:"$",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"$",currency_suffix:"",price:tt?"2400":"2000",regular_price:tt?"2400":"2000",sale_price:tt?"2400":"2000",price_range:null,raw_prices:{precision:6,price:tt?"24000000":"20000000",regular_price:tt?"24000000":"20000000",sale_price:tt?"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,m.__)("Polo","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-polo",short_description:(0,m.__)("Polo","woocommerce"),description:(0,m.__)("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:tt?"24000":"20000",regular_price:tt?"24000":"20000",sale_price:tt?"12000":"10000",price_range:null},price_html:"",average_rating:"4.5",review_count:2,images:[{id:17,src:B+"previews/polo.jpg",thumbnail:B+"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,m.__)("Long Sleeve Tee","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-long-sleeve-tee",short_description:(0,m.__)("Long Sleeve Tee","woocommerce"),description:(0,m.__)("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:tt?"30000":"25000",regular_price:tt?"30000":"25000",sale_price:tt?"30000":"25000",price_range:null},price_html:"",average_rating:"4",review_count:2,images:[{id:17,src:B+"previews/long-sleeve-tee.jpg",thumbnail:B+"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,m.__)("Hoodie with Zipper","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-zipper",short_description:(0,m.__)("Hoodie with Zipper","woocommerce"),description:(0,m.__)("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:tt?"15000":"12500",regular_price:tt?"30000":"25000",sale_price:tt?"15000":"12500",price_range:null},price_html:"",average_rating:"1",review_count:2,images:[{id:17,src:B+"previews/hoodie-with-zipper.jpg",thumbnail:B+"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,m.__)("Hoodie with Logo","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-logo",short_description:(0,m.__)("Polo","woocommerce"),description:(0,m.__)("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:tt?"4500":"4250",regular_price:tt?"4500":"4250",sale_price:tt?"4500":"4250",price_range:null},price_html:"",average_rating:"5",review_count:2,images:[{id:17,src:B+"previews/hoodie-with-logo.jpg",thumbnail:B+"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,m.__)("Hoodie with Pocket","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-hoodie-with-pocket",short_description:(0,m.__)("Hoodie with Pocket","woocommerce"),description:(0,m.__)("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:tt?"3500":"3250",regular_price:tt?"4500":"4250",sale_price:tt?"3500":"3250",price_range:null},price_html:"",average_rating:"3.75",review_count:4,images:[{id:17,src:B+"previews/hoodie-with-pocket.jpg",thumbnail:B+"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,m.__)("T-Shirt","woocommerce"),parent:0,type:"simple",variation:"",permalink:"https://example.org",sku:"woo-t-shirt",short_description:(0,m.__)("T-Shirt","woocommerce"),description:(0,m.__)("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:tt?"1800":"1500",regular_price:tt?"1800":"1500",sale_price:tt?"1800":"1500",price_range:null},price_html:"",average_rating:"3",review_count:2,images:[{id:17,src:B+"previews/tshirt.jpg",thumbnail:B+"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,m.__)("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,v.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,m.__)("Sales tax","woocommerce"),rate:"20%",price:"820"}]},errors:[],payment_methods:["cod","bacs","cheque"],payment_requirements:["products"],extensions:{}},ct=window.wp.hooks,rt=()=>({dispatchStoreEvent:(0,p.useCallback)(((e,t={})=>{try{(0,ct.doAction)(`experimental__woocommerce_blocks-${e}`,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:(0,p.useCallback)(((e,t={})=>{try{(0,ct.doAction)(`experimental__woocommerce_blocks-checkout-${e}`,{...t,storeCart:(0,k.select)("wc/store/cart").getCartData()})}catch(e){console.error(e)}}),[])}),nt=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:c,isCollectable:r,isSelectingRate:n}=(0,k.useSelect)((e=>{const t=!!e("core/editor"),o=e(ee.CART_STORE_KEY),c=t?ot.shipping_rates:o.getShippingRates();return{shippingRates:c,needsShipping:t?ot.needs_shipping:o.getNeedsShipping(),hasCalculatedShipping:t?ot.has_calculated_shipping:o.getHasCalculatedShipping(),isLoadingRates:!t&&o.isCustomerDataUpdating(),isCollectable:c.every((({shipping_rates:e})=>e.find((({method_id:e})=>Ge(e))))),isSelectingRate:!t&&o.isShippingRateBeingSelected()}})),s=(0,p.useRef)({});(0,p.useEffect)((()=>{const t=Xe(e);He(t)&&!Qe()(s.current,t)&&(s.current=t)}),[e]);const{selectShippingRate:a}=(0,k.useDispatch)(ee.CART_STORE_KEY),i=Ge(Object.values(s.current).map((e=>e.split(":")[0]))),{dispatchCheckoutEvent:l}=rt(),m=(0,p.useCallback)(((e,t)=>{let o;void 0!==e&&(o=Ge(e.split(":")[0])?a(e,null):a(e,t),o.then((()=>{l("set-selected-shipping-rate",{shippingRateId:e})})).catch((e=>{(0,ee.processErrorResponse)(e)})))}),[a,l]);return{isSelectingRate:n,selectedRates:s.current,selectShippingRate:m,shippingRates:e,needsShipping:t,hasCalculatedShipping:o,isLoadingRates:c,isCollectable:r,hasSelectedLocalPickup:i}},{NONE:st,INVALID_ADDRESS:at,UNKNOWN:it}=le,lt=(0,p.createContext)(de),mt=()=>(0,p.useContext)(lt),dt=({children:e})=>{const{__internalIncrementCalculating:t,__internalDecrementCalculating:o}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),{shippingRates:r,isLoadingRates:n,cartErrors:s}=Ke(),{selectedRates:a,isSelectingRate:i}=nt(),[l,m]=(0,p.useReducer)(pe,st),[d,u]=(0,p.useReducer)(ne,{}),h=(0,p.useRef)(d),_=(0,p.useMemo)((()=>({onShippingRateSuccess:ke(u).onSuccess,onShippingRateFail:ke(u).onFail,onShippingRateSelectSuccess:ke(u).onSelectSuccess,onShippingRateSelectFail:ke(u).onSelectFail})),[u]);(0,p.useEffect)((()=>{h.current=d}),[d]),(0,p.useEffect)((()=>{n?t():o()}),[n,t,o]),(0,p.useEffect)((()=>{i?t():o()}),[t,o,i]),(0,p.useEffect)((()=>{s.length>0&&s.some((e=>!(!e.code||!Object.values(me).includes(e.code))))?m({type:at}):m({type:st})}),[s]);const g=(0,p.useMemo)((()=>({isPristine:l===st,isValid:l===st,hasInvalidAddress:l===at,hasError:l===it||l===at})),[l]);(0,p.useEffect)((()=>{n||0!==r.length&&!g.hasError||be(h.current,he,{hasInvalidAddress:g.hasInvalidAddress,hasError:g.hasError})}),[r,n,g.hasError,g.hasInvalidAddress]),(0,p.useEffect)((()=>{!n&&r.length>0&&!g.hasError&&be(h.current,ue,r)}),[r,n,g.hasError]),(0,p.useEffect)((()=>{i||(g.hasError?be(h.current,ge,{hasError:g.hasError,hasInvalidAddress:g.hasInvalidAddress}):be(h.current,_e,a.current))}),[a,i,g.hasError,g.hasInvalidAddress]);const E={shippingErrorStatus:g,dispatchErrorStatus:m,shippingErrorTypes:le,..._};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(lt.Provider,{value:E},e))};function pt(e,t){const o=(0,p.useRef)();return(0,p.useEffect)((()=>{o.current===e||t&&!t(e,o.current)||(o.current=e)}),[e,t]),o.current}const ut={},ht={},_t=()=>ut,gt=()=>ht,kt=(0,p.createContext)({onSubmit:()=>{},onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},onCheckoutSuccess:()=>()=>{},onCheckoutFail:()=>()=>{},onCheckoutValidation:()=>()=>{}}),Et=()=>(0,p.useContext)(kt),wt=({children:e,redirectUrl:t})=>{const o=_t(),r=gt(),{isEditor:n}=w(),{__internalUpdateAvailablePaymentMethods:s}=(0,k.useDispatch)(ee.PAYMENT_STORE_KEY);(0,p.useEffect)((()=>{(n||0!==Object.keys(o).length||0!==Object.keys(r).length)&&s()}),[n,o,r,s]);const{__internalSetRedirectUrl:a,__internalEmitValidateEvent:i,__internalEmitAfterProcessingEvents:l,__internalSetBeforeProcessing:m}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),{checkoutRedirectUrl:d,checkoutStatus:u,isCheckoutBeforeProcessing:h,isCheckoutAfterProcessing:_,checkoutHasError:g,checkoutOrderId:E,checkoutOrderNotes:b,checkoutCustomerId:y}=(0,k.useSelect)((e=>{const t=e(ee.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:v}=(0,k.useDispatch)(ee.VALIDATION_STORE_KEY),{dispatchCheckoutEvent:f}=rt(),{checkoutNotices:C,paymentNotices:S,expressPaymentNotices:P}=(0,k.useSelect)((e=>{const{getNotices:t}=e("core/notices");return{checkoutNotices:Object.values(we).filter((e=>e!==we.PAYMENTS&&e!==we.EXPRESS_PAYMENTS)).reduce(((e,o)=>[...e,...t(o)]),[]),paymentNotices:t(we.PAYMENTS),expressPaymentNotices:t(we.EXPRESS_PAYMENTS)}}),[]),[N,T]=(0,p.useReducer)(ne,{}),R=(0,p.useRef)(N),{onCheckoutValidation:x,onCheckoutSuccess:A,onCheckoutFail:I}=(e=>(0,p.useMemo)((()=>({onCheckoutSuccess:se("checkout_success",e),onCheckoutFail:se("checkout_fail",e),onCheckoutValidation:se("checkout_validation",e)})),[e]))(T);(0,p.useEffect)((()=>{R.current=N}),[N]);const M=(0,p.useMemo)((()=>function(...e){return oe()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidation",plugin:"WooCommerce Blocks"}),x(...e)}),[x]),O=(0,p.useMemo)((()=>function(...e){return oe()("onCheckoutValidationBeforeProcessing",{since:"9.7.0",alternative:"onCheckoutValidation",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),x(...e)}),[x]),B=(0,p.useMemo)((()=>function(...e){return oe()("onCheckoutAfterProcessingWithSuccess",{since:"9.7.0",alternative:"onCheckoutSuccess",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),A(...e)}),[A]),D=(0,p.useMemo)((()=>function(...e){return oe()("onCheckoutAfterProcessingWithError",{since:"9.7.0",alternative:"onCheckoutFail",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8381"}),I(...e)}),[I]);(0,p.useEffect)((()=>{h&&i({observers:R.current,setValidationErrors:v})}),[h,v,i]);const L=pt(u),F=pt(g);(0,p.useEffect)((()=>{u===L&&g===F||_&&l({observers:R.current,notices:{checkoutNotices:C,paymentNotices:S,expressPaymentNotices:P}})}),[u,g,d,E,y,b,_,h,L,F,C,P,S,i,l]);const Y={onSubmit:(0,p.useCallback)((()=>{f("submit"),m()}),[f,m]),onCheckoutBeforeProcessing:M,onCheckoutValidationBeforeProcessing:O,onCheckoutAfterProcessingWithSuccess:B,onCheckoutAfterProcessingWithError:D,onCheckoutSuccess:A,onCheckoutFail:I,onCheckoutValidation:x};return(0,c.createElement)(kt.Provider,{value:Y},e)},bt=window.wp.apiFetch;var yt=o.n(bt);(0,m.__)("Something went wrong. Please contact us to get assistance.","woocommerce");const vt=window.wc.wcBlocksRegistry,ft=(e,t,o)=>{const c=Object.keys(e).map((t=>({key:t,value:e[t]})),[]),r=`wc-${o}-new-payment-method`;return c.push({key:r,value:t}),c},Ct=e=>{if(!e)return;const{__internalSetCustomerId:t}=(0,k.dispatch)(ee.CHECKOUT_STORE_KEY);yt().setNonce&&"function"==typeof yt().setNonce&&yt().setNonce(e),null!=e&&e.get("User-ID")&&t(parseInt(e.get("User-ID")||"0",10))},St=()=>{const{onCheckoutValidation:e}=Et(),{hasError:t,redirectUrl:o,isProcessing:c,isBeforeProcessing:r,isComplete:n,orderNotes:s,shouldCreateAccount:a,extensionData:i,customerId:l}=(0,k.useSelect)((e=>{const t=e(ee.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:u}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),h=(0,k.useSelect)((e=>e(ee.VALIDATION_STORE_KEY).hasValidationErrors)),{shippingErrorStatus:_}=mt(),{billingAddress:g,shippingAddress:E}=(0,k.useSelect)((e=>e(ee.CART_STORE_KEY).getCustomerData())),{cartNeedsPayment:w,cartNeedsShipping:b,receiveCartContents:y}=Ke(),{activePaymentMethod:v,paymentMethodData:f,isExpressPaymentMethodActive:C,hasPaymentError:S,isPaymentReady:P,shouldSavePayment:N}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),hasPaymentError:t.hasPaymentError(),isPaymentReady:t.isPaymentReady(),shouldSavePayment:t.getShouldSavePaymentMethod()}}),[]),T=(0,vt.getPaymentMethods)(),R=(0,vt.getExpressPaymentMethods)(),x=(0,p.useRef)(g),A=(0,p.useRef)(E),I=(0,p.useRef)(o),[M,O]=(0,p.useState)(!1),B=(0,p.useMemo)((()=>{var e;const t={...R,...T};return null==t||null===(e=t[v])||void 0===e?void 0:e.paymentMethodId}),[v,R,T]),D=h()&&!C||S||_.hasError,L=!t&&!D&&(P||!w)&&c;(0,p.useEffect)((()=>{D===t||!c&&!r||C||d(D)}),[D,t,c,r,C,d]),(0,p.useEffect)((()=>{x.current=g,A.current=E,I.current=o}),[g,E,o]);const F=(0,p.useCallback)((()=>h()?void 0!==(0,k.select)(ee.VALIDATION_STORE_KEY).getValidationError("shipping-rates-error")&&{errorMessage:(0,m.__)("Sorry, this order requires a shipping option.","woocommerce")}:S?{errorMessage:(0,m.__)("There was a problem with your payment option.","woocommerce"),context:"wc/checkout/payments"}:!_.hasError||{errorMessage:(0,m.__)("There was a problem with your shipping option.","woocommerce"),context:"wc/checkout/shipping-methods"}),[h,S,_.hasError]);(0,p.useEffect)((()=>{let t;return C||(t=e(F,0)),()=>{C||"function"!=typeof t||t()}}),[e,F,C]),(0,p.useEffect)((()=>{I.current&&(window.location.href=I.current)}),[n]);const Y=(0,p.useCallback)((async()=>{if(M)return;O(!0),(()=>{const e=(0,k.select)("wc/store/store-notices").getRegisteredContainers(),{removeNotice:t}=(0,k.dispatch)("core/notices"),{getNotices:o}=(0,k.select)("core/notices");e.forEach((e=>{o(e).forEach((o=>{t(o.id,e)}))}))})();const e=w?{payment_method:B,payment_data:ft(f,N,v)}:{},t={shipping_address:b?xe(A.current):void 0,billing_address:xe(x.current),customer_note:s,create_account:a,...e,extensions:{...i}};yt()({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),Ct(e.headers),!e.ok)throw e;return e.json()})).then((e=>{u(e),O(!1)})).catch((e=>{Ct(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&&y(e.data.cart),(0,ee.processErrorResponse)(e),u(e)}))}catch{let e=(0,m.__)("Something went wrong when placing the order. Check your email for order updates before retrying.","woocommerce");0!==l&&(e=(0,m.__)("Something went wrong when placing the order. Check your account's order history or your email for order updates before retrying.","woocommerce")),(0,ee.processErrorResponse)({code:"unknown_error",message:e,data:null})}d(!0),O(!1)}))}),[M,w,B,f,N,v,s,a,i,b,y,d,u]);return(0,p.useEffect)((()=>{L&&!M&&Y()}),[Y,L,M]),null},Pt=({children:e,redirectUrl:t})=>(0,c.createElement)(wt,{redirectUrl:t},(0,c.createElement)(dt,null,(0,c.createElement)(ie,null,e,(0,c.createElement)(Q,{renderError:v.CURRENT_USER_IS_ADMIN?null:()=>null},(0,c.createElement)(y.PluginArea,{scope:"woocommerce-checkout"})),(0,c.createElement)(St,null)))),Nt={cc:[{method:{gateway:"credit-card",last4:"5678",brand:"Visa"},expires:"12/20",is_default:!1,tokenId:"1"}]},Tt=window.wp.components,Rt=window.wc.blocksCheckout;var xt=o(5062);const At=(0,p.forwardRef)((({children:e,className:t=""},o)=>(0,c.createElement)("div",{ref:o,className:n()("wc-block-components-main",t)},e))),It=(0,p.createContext)({showCompanyField:!1,showApartmentField:!1,showPhoneField:!1,requireCompanyField:!1,requirePhoneField:!1,showOrderNotes:!0,showPolicyLinks:!0,showReturnToCart:!0,cartPageId:0,showRateAfterTaxName:!1}),Mt=(0,p.createContext)({addressFieldControls:()=>null}),Ot=()=>(0,p.useContext)(It),Bt=()=>(0,p.useContext)(Mt),Dt=["core/paragraph","core/image","core/separator"],Lt=e=>{const t=(0,Rt.applyCheckoutFilter)({filterName:"additionalCartCheckoutInnerBlockTypes",defaultValue:[],extensions:(0,k.select)(ee.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,l.getBlockTypes)().filter((t=>((null==t?void 0:t.parent)||[]).includes(e))).map((({name:e})=>e)),...Dt,...t]))},Ft=({clientId:e,registeredBlocks:t,defaultTemplate:o=[]})=>{const c=(0,p.useRef)(t),r=(0,p.useRef)(o),n=(0,k.useRegistry)(),{isPreview:s}=w();(0,p.useEffect)((()=>{let t=!1;if(s)return;const{replaceInnerBlocks:o}=(0,k.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&&r.current.length>0&&!t){const c=(0,l.createBlocksFromInnerBlocksTemplate)(r.current);if(0!==c.length)return t=!0,void o(e,c)}const a=c.current.map((e=>(0,l.getBlockType)(e))),i=((e,t)=>{const o=t.filter((e=>e&&(({attributes:e})=>{var t,o,c;return Boolean((null===(t=e.lock)||void 0===t?void 0:t.remove)||(null===(o=e.lock)||void 0===o||null===(c=o.default)||void 0===c?void 0:c.remove))})(e))),c=[];return o.forEach((t=>{if(void 0===t)return;const o=e.find((e=>e.name===t.name));o||c.push(t)})),c})(s,a);if(0===i.length)return;let m=-1;const d=i.map((e=>{const t=r.current.findIndex((([t])=>t===e.name)),o=(0,l.createBlock)(e.name);return-1===m&&(m=(({defaultTemplatePosition:e,innerBlocks:t,currentDefaultTemplate:o})=>{switch(e){case-1:return t.length;case 0:return 0;default:const c=o.current[e-1],r=t.findIndex((({name:e})=>e===c[0]));return-1===r?e:r+1}})({defaultTemplatePosition:t,innerBlocks:s,currentDefaultTemplate:r})),o}));n.batch((()=>{n.dispatch("core/block-editor").insertBlocks(d,m,e)}))}),"core/block-editor")}),[e,s,n])};o(9768),(0,l.registerBlockType)("woocommerce/checkout-fields-block",{icon:{src:(0,c.createElement)(i.Z,{icon:xt.Z,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e,attributes:t})=>{const o=(0,d.useBlockProps)({className:n()("wc-block-checkout__main",null==t?void 0:t.className)}),r=Lt(Rt.innerBlockAreas.CHECKOUT_FIELDS),{addressFieldControls:s}=Bt(),a=[["woocommerce/checkout-express-payment-block",{},[]],["woocommerce/checkout-contact-information-block",{},[]],["woocommerce/checkout-shipping-method-block",{},[]],["woocommerce/checkout-pickup-options-block",{},[]],["woocommerce/checkout-shipping-address-block",{},[]],["woocommerce/checkout-billing-address-block",{},[]],["woocommerce/checkout-shipping-methods-block",{},[]],["woocommerce/checkout-payment-block",{},[]],["woocommerce/checkout-order-note-block",{},[]],["woocommerce/checkout-terms-block",{},[]],["woocommerce/checkout-actions-block",{},[]]].filter(Boolean);return Ft({clientId:e,registeredBlocks:r,defaultTemplate:a}),(0,c.createElement)(At,{...o},(0,c.createElement)(s,null),(0,c.createElement)("form",{className:"wc-block-components-form wc-block-checkout__form"},(0,c.createElement)(d.InnerBlocks,{allowedBlocks:r,templateLock:!1,template:a,renderAppender:d.InnerBlocks.ButtonBlockAppender})))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(d.InnerBlocks.Content,null))});const Yt=(0,p.forwardRef)((({children:e,className:t=""},o)=>(0,c.createElement)("div",{ref:o,className:n()("wc-block-components-sidebar",t)},e)));o(7450),(0,l.registerBlockType)("woocommerce/checkout-totals-block",{icon:{src:(0,c.createElement)(i.Z,{icon:xt.Z,className:"wc-block-editor-components-block-icon"})},edit:({clientId:e,attributes:t})=>{const o=(0,d.useBlockProps)({className:n()("wc-block-checkout__sidebar",null==t?void 0:t.className)}),r=Lt(Rt.innerBlockAreas.CHECKOUT_TOTALS),s=[["woocommerce/checkout-order-summary-block",{},[]]];return Ft({clientId:e,registeredBlocks:r,defaultTemplate:s}),(0,c.createElement)(Yt,{...o},(0,c.createElement)(d.InnerBlocks,{allowedBlocks:r,templateLock:!1,template:s,renderAppender:d.InnerBlocks.ButtonBlockAppender}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(d.InnerBlocks.Content,null))});var Ut=o(1873);const Vt=()=>{const{customerData:e,isInitialized:t}=(0,k.useSelect)((e=>{const t=e(ee.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}})),{setShippingAddress:o,setBillingAddress:c}=(0,k.useDispatch)(ee.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:c,setShippingAddress:o}},jt=()=>{const{needsShipping:e}=nt(),{useShippingAsBilling:t,prefersCollection:o}=(0,k.useSelect)((e=>({useShippingAsBilling:e(ee.CHECKOUT_STORE_KEY).getUseShippingAsBilling(),prefersCollection:e(ee.CHECKOUT_STORE_KEY).prefersCollection()}))),{__internalSetUseShippingAsBilling:c}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),{billingAddress:r,setBillingAddress:n,shippingAddress:s,setShippingAddress:a}=Vt(),i=(0,p.useCallback)((e=>{n({email:e})}),[n]),l=(0,v.getSetting)("forcedBillingAddress",!1);return{shippingAddress:s,billingAddress:r,setShippingAddress:a,setBillingAddress:n,setEmail:i,defaultFields:v.defaultFields,useShippingAsBilling:t,setUseShippingAsBilling:c,needsShipping:e,showShippingFields:!l&&e&&!o,showShippingMethods:e&&!o,showBillingFields:!e||!t||!!o,forcedBillingAddress:l,useBillingAsShipping:l||!!o}},Kt=window.wc.blocksComponents,$t=({children:e,stepHeadingContent:t})=>(0,c.createElement)("div",{className:"wc-block-components-checkout-step__heading"},(0,c.createElement)(Kt.Title,{"aria-hidden":"true",className:"wc-block-components-checkout-step__title",headingLevel:"2"},e),!!t&&(0,c.createElement)("span",{className:"wc-block-components-checkout-step__heading-content"},t)),Ht=({attributes:e,setAttributes:t,className:o="",children:r})=>{const{title:s="",description:a="",showStepNumber:i=!0}=e,l=(0,d.useBlockProps)({className:n()("wc-block-components-checkout-step",o,{"wc-block-components-checkout-step--with-step-number":i})});return(0,c.createElement)("div",{...l},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Form Step Options","woocommerce")},(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Show step number","woocommerce"),checked:i,onChange:()=>t({showStepNumber:!i})}))),(0,c.createElement)($t,null,(0,c.createElement)(d.PlainText,{className:"",value:s,onChange:e=>t({title:e}),style:{backgroundColor:"transparent"}})),(0,c.createElement)("div",{className:"wc-block-components-checkout-step__container"},(0,c.createElement)("p",{className:"wc-block-components-checkout-step__description"},(0,c.createElement)(d.PlainText,{className:a?"":"wc-block-components-checkout-step__description-placeholder",value:a,placeholder:(0,m.__)("Optional text for this form step.","woocommerce"),onChange:e=>t({description:e}),style:{backgroundColor:"transparent"}})),(0,c.createElement)("div",{className:"wc-block-components-checkout-step__content"},r)))};o(3820);const qt=({block:e})=>{const{"data-block":t}=(0,d.useBlockProps)(),o=Lt(e);return Ft({clientId:t,registeredBlocks:o}),(0,c.createElement)("div",{className:"wc-block-checkout__additional_fields"},(0,c.createElement)(d.InnerBlocks,{allowedBlocks:o}))},zt=()=>(0,c.createElement)(d.InnerBlocks.Content,null);var Zt=o(1638),Wt=o(5904),Gt=o(2600);const Xt=["BUTTON","FIELDSET","INPUT","OPTGROUP","OPTION","SELECT","TEXTAREA","A"],Jt=({children:e,style:t={},...o})=>{const r=(0,p.useRef)(null),n=()=>{r.current&&Wt.focus.focusable.find(r.current).forEach((e=>{Xt.includes(e.nodeName)&&e.setAttribute("tabindex","-1"),e.hasAttribute("contenteditable")&&e.setAttribute("contenteditable","false")}))},s=(0,Gt.y1)(n,0,{leading:!0});return(0,p.useLayoutEffect)((()=>{let e;return n(),r.current&&(e=new window.MutationObserver(s),e.observe(r.current,{childList:!0,attributes:!0,subtree:!0})),()=>{e&&e.disconnect(),s.cancel()}}),[s]),(0,c.createElement)("div",{ref:r,"aria-disabled":"true",style:{userSelect:"none",pointerEvents:"none",cursor:"normal",...t},...o},e)};var Qt=o(3133);o(2750);const eo=({id:e,className:t,label:o,onChange:r,options:s,value:a,required:i=!1,errorMessage:l=(0,m.__)("Please select a value.","woocommerce"),errorId:d,autoComplete:u="off"})=>{const h=(0,p.useRef)(null),_=(0,p.useId)(),g=e||"control-"+_,E=d||g,{setValidationErrors:w,clearValidationError:b}=(0,k.useDispatch)(ee.VALIDATION_STORE_KEY),y=(0,k.useSelect)((e=>e(ee.VALIDATION_STORE_KEY).getValidationError(E)));return(0,p.useEffect)((()=>(!i||a?b(E):w({[E]:{message:l,hidden:!0}}),()=>{b(E)})),[b,a,E,l,i,w]),(0,c.createElement)("div",{id:g,className:n()("wc-block-components-combobox",t,{"is-active":a,"has-error":(null==y?void 0:y.message)&&!(null!=y&&y.hidden)}),ref:h},(0,c.createElement)(Qt.Z,{className:"wc-block-components-combobox-control",label:o,onChange:r,onFilterValueChange:e=>{if(e.length){const t=He(h.current)?h.current.ownerDocument.activeElement:void 0;if(t&&He(h.current)&&h.current.contains(t))return;const o=e.toLocaleUpperCase(),c=s.find((e=>e.value.toLocaleUpperCase()===o));if(c)return void r(c.value);const n=s.find((e=>e.label.toLocaleUpperCase().startsWith(o)));n&&r(n.value)}},options:s,value:a||"",allowReset:!1,autoComplete:u,"aria-invalid":(null==y?void 0:y.message)&&!(null!=y&&y.hidden)}),(0,c.createElement)(Kt.ValidationInputError,{propertyName:E}))};o(7368);const to=({className:e,countries:t,id:o,label:r,onChange:s,value:a="",autoComplete:i="off",required:l=!1,errorId:d,errorMessage:u=(0,m.__)("Please select a country","woocommerce")})=>{const h=(0,p.useMemo)((()=>Object.entries(t).map((([e,t])=>({value:e,label:(0,fe.decodeEntities)(t)})))),[t]);return(0,c.createElement)("div",{className:n()(e,"wc-block-components-country-input")},(0,c.createElement)(eo,{id:o,label:r,onChange:s,options:h,value:a,errorId:d,errorMessage:u,required:l,autoComplete:i}))},oo=e=>(0,c.createElement)(to,{countries:$,...e}),co=e=>(0,c.createElement)(to,{countries:q,...e});o(6115);const ro=(e,t)=>{const o=t.find((t=>t.label.toLocaleUpperCase()===e.toLocaleUpperCase()||t.value.toLocaleUpperCase()===e.toLocaleUpperCase()));return o?o.value:""},no=({className:e,id:t,states:o,country:r,label:s,onChange:a,autoComplete:i="off",value:l="",required:d=!1,errorId:u=""})=>{const h=o[r],_=(0,p.useMemo)((()=>h?Object.keys(h).map((e=>({value:e,label:(0,fe.decodeEntities)(h[e])}))):[]),[h]),g=(0,p.useCallback)((e=>{const t=_.length>0?ro(e,_):e;t!==l&&a(t)}),[a,_,l]),k=(0,p.useRef)(l);return(0,p.useEffect)((()=>{k.current!==l&&(k.current=l)}),[l]),(0,p.useEffect)((()=>{if(_.length>0&&k.current){const e=ro(k.current,_);e!==k.current&&g(e)}}),[_,g]),_.length>0?(0,c.createElement)(eo,{className:n()(e,"wc-block-components-state-input"),id:t,label:s,onChange:g,options:_,value:l,errorMessage:(0,m.__)("Please select a state.","woocommerce"),errorId:u,required:d,autoComplete:i}):(0,c.createElement)(Kt.ValidatedTextInput,{className:e,id:t,label:s,onChange:g,autoComplete:i,value:l,required:d})},so=e=>(0,c.createElement)(no,{states:H,...e}),ao=e=>(0,c.createElement)(no,{states:z,...e});function io(e){const t=(0,p.useRef)(e);return Qe()(e,t.current)||(t.current=e),t.current}const lo=({id:e="",fields:t,fieldConfig:o={},onChange:r,addressType:s="shipping",values:a})=>{const i=(0,u.useInstanceId)(lo),l=io(t),d=io(o),h=io(a.country),_=(0,p.useMemo)((()=>{const e=Ne(l,d,h);return{fields:e,addressType:s,required:e.filter((e=>e.required)),hidden:e.filter((e=>e.hidden))}}),[l,d,h,s]),g=(0,p.useRef)({});return(0,p.useEffect)((()=>{const e={...a,...Object.fromEntries(_.hidden.map((e=>[e.key,""])))};Qe()(a,e)||r(e)}),[r,_,a]),(0,p.useEffect)((()=>{"shipping"===s&&(e=>{const t="shipping_country",o=(0,k.select)(ee.VALIDATION_STORE_KEY).getValidationError(t);!e.country&&(e.city||e.state||e.postcode)&&(o?(0,k.dispatch)(ee.VALIDATION_STORE_KEY).showValidationError(t):(0,k.dispatch)(ee.VALIDATION_STORE_KEY).setValidationErrors({[t]:{message:(0,m.__)("Please select your country","woocommerce"),hidden:!1}})),o&&e.country&&(0,k.dispatch)(ee.VALIDATION_STORE_KEY).clearValidationError(t)})(a)}),[a,s]),(0,p.useEffect)((()=>{var e,t;null===(e=g.current)||void 0===e||null===(t=e.postcode)||void 0===t||t.revalidate()}),[h]),e=e||`${i}`,(0,c.createElement)("div",{id:e,className:"wc-block-components-address-form"},_.fields.map((t=>{if(t.hidden)return null;if("checkbox"===t.type)return(0,c.createElement)(Kt.CheckboxControl,{className:`wc-block-components-address-form__${t.key}`,label:t.label,key:t.key,checked:Boolean(a[t.key]),onChange:e=>{r({...a,[t.key]:e})}});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?co:oo;return(0,c.createElement)(e,{key:t.key,...o,value:a.country,onChange:e=>{const t={...a,country:e,state:""};a.postcode&&!(0,Rt.isPostcode)({postcode:a.postcode,country:e})&&(t.postcode=""),r(t)}})}if("state"===t.key){const e="shipping"===s?ao:so;return(0,c.createElement)(e,{key:t.key,...o,country:a.country,value:a.state,onChange:e=>r({...a,state:e})})}return"select"===t.type?void 0===t.options?null:(0,c.createElement)(eo,{key:t.key,...o,className:n()("wc-block-components-select-input",`wc-block-components-select-input-${t.key}`),value:a[t.key],onChange:e=>{r({...a,[t.key]:e})},options:t.options}):(0,c.createElement)(Kt.ValidatedTextInput,{key:t.key,ref:e=>g.current[t.key]=e,...o,type:t.type,value:a[t.key],onChange:e=>r({...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,Rt.isPostcode)({postcode:e.value,country:o.country})&&(e.setCustomValidity((0,m.__)("Please enter a valid postcode","woocommerce")),1)))(e,t.key,a)})})))},mo=lo;o(2262);const po=({isEditing:e=!1,addressCard:t,addressForm:o})=>{const r=n()("wc-block-components-address-address-wrapper",{"is-editing":e});return(0,c.createElement)("div",{className:r},(0,c.createElement)("div",{className:"wc-block-components-address-card-wrapper"},t()),(0,c.createElement)("div",{className:"wc-block-components-address-form-wrapper"},o()))};o(3658);const uo=({address:e,onEdit:t,target:o,fieldConfig:r})=>(0,c.createElement)("div",{className:"wc-block-components-address-card"},(0,c.createElement)("address",null,(0,c.createElement)("span",{className:"wc-block-components-address-card__address-section"},e.first_name+" "+e.last_name),(0,c.createElement)("div",{className:"wc-block-components-address-card__address-section"},[e.address_1,!r.address_2.hidden&&e.address_2,e.city,e.state,e.postcode,$[e.country]?$[e.country]:e.country].filter((e=>!!e)).map(((e,t)=>(0,c.createElement)("span",{key:"address-"+t},e)))),e.phone&&!r.phone.hidden?(0,c.createElement)("div",{key:"address-phone",className:"wc-block-components-address-card__address-section"},e.phone):""),t&&(0,c.createElement)("a",{role:"button",href:"#"+o,className:"wc-block-components-address-card__edit","aria-label":(0,m.__)("Edit address","woocommerce"),onClick:e=>{t(),e.preventDefault()}},(0,m.__)("Edit","woocommerce"))),ho=({addressFieldsConfig:e,defaultEditing:t=!1})=>{const{shippingAddress:o,setShippingAddress:r,setBillingAddress:n,useShippingAsBilling:s}=jt(),{dispatchCheckoutEvent:a}=rt(),[i,l]=(0,p.useState)(t),{hasValidationErrors:m,invalidProps:d}=(0,k.useSelect)((e=>{const t=e(ee.VALIDATION_STORE_KEY);return{hasValidationErrors:t.hasValidationErrors(),invalidProps:Object.keys(o).filter((e=>void 0!==t.getValidationError("shipping_"+e))).filter(Boolean)}}));(0,p.useEffect)((()=>{d.length>0&&!1===i&&l(!0)}),[i,m,d.length]);const u=(0,p.useCallback)((e=>{r(e),s&&(n(e),a("set-billing-address")),a("set-shipping-address")}),[a,n,r,s]),h=(0,p.useCallback)((()=>(0,c.createElement)(uo,{address:o,target:"shipping",onEdit:()=>{l(!0)},fieldConfig:e})),[o,e]),_=(0,p.useCallback)((()=>(0,c.createElement)(mo,{id:"shipping",type:"shipping",onChange:u,values:o,fields:G,fieldConfig:e})),[e,u,o]);return(0,c.createElement)(po,{isEditing:i,addressCard:h,addressForm:_})},_o=({showCompanyField:e=!1,showApartmentField:t=!1,showPhoneField:o=!1,requireCompanyField:r=!1,requirePhoneField:n=!1})=>{const{setBillingAddress:s,shippingAddress:a,useShippingAsBilling:i,setUseShippingAsBilling:l}=jt(),{isEditor:d}=w(),u=()=>{const t={...a};o||delete t.phone,e&&delete t.company,s(t)};(0,Zt.qR)((()=>{i&&u()}));const h=(0,p.useMemo)((()=>({company:{hidden:!e,required:r},address_2:{hidden:!t},phone:{hidden:!o,required:n}})),[e,r,t,o,n]),_=d?Jt:p.Fragment,g=i?[we.SHIPPING_ADDRESS,we.BILLING_ADDRESS]:[we.SHIPPING_ADDRESS],E=!(!a.address_1||!a.first_name&&!a.last_name),{cartDataLoaded:b}=(0,k.useSelect)((e=>({cartDataLoaded:e(ee.CART_STORE_KEY).hasFinishedResolution("getCartData")}))),y=d||!E;return(0,c.createElement)(p.Fragment,null,(0,c.createElement)(Kt.StoreNoticesContainer,{context:g}),(0,c.createElement)(_,null,b?(0,c.createElement)(ho,{addressFieldsConfig:h,defaultEditing:y}):null),(0,c.createElement)(Kt.CheckboxControl,{className:"wc-block-checkout__use-address-for-billing",label:(0,m.__)("Use same address for billing","woocommerce"),checked:i,onChange:e=>{l(e),e&&u()}}))},go=({defaultTitle:e=(0,m.__)("Step","woocommerce"),defaultDescription:t=(0,m.__)("Step description text.","woocommerce"),defaultShowStepNumber:o=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:o}}),ko={...go({defaultTitle:(0,m.__)("Shipping address","woocommerce"),defaultDescription:(0,m.__)("Enter the address where you want your order delivered.","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}};(0,l.registerBlockType)("woocommerce/checkout-shipping-address-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Ut.Z,className:"wc-block-editor-components-block-icon"})},attributes:ko,edit:({attributes:e,setAttributes:t})=>{const{showCompanyField:o,showApartmentField:r,requireCompanyField:s,showPhoneField:a,requirePhoneField:i}=Ot(),{addressFieldControls:l}=Bt(),{showShippingFields:m}=jt();return m?(0,c.createElement)(Ht,{setAttributes:t,attributes:e,className:n()("wc-block-checkout__shipping-fields",null==e?void 0:e.className)},(0,c.createElement)(l,null),(0,c.createElement)(_o,{showCompanyField:o,showApartmentField:r,requireCompanyField:s,showPhoneField:a,requirePhoneField:i}),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.SHIPPING_ADDRESS})):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});var Eo=o(5676);o(8054);const wo=F?`<a href="${F}" target="_blank">${(0,m.__)("Terms and Conditions","woocommerce")}</a>`:(0,m.__)("Terms and Conditions","woocommerce"),bo=L?`<a href="${L}" target="_blank">${(0,m.__)("Privacy Policy","woocommerce")}</a>`:(0,m.__)("Privacy Policy","woocommerce"),yo=(0,m.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */ /* translators: %1$s terms page link, %2$s privacy page link. */
(0,m.__)("By proceeding with your purchase you agree to our %1$s and %2$s","woocommerce"),wo,bo),vo=(0,m.sprintf)(/* translators: %1$s terms page link, %2$s privacy page link. */ /* translators: %1$s terms page link, %2$s privacy page link. */
(0,m.__)("You must accept our %1$s and %2$s to continue with your purchase.","woocommerce"),wo,bo);o(2364),(0,l.registerBlockType)("woocommerce/checkout-terms-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Eo.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:{checkbox:e,text:t},setAttributes:o})=>{const r=(0,d.useBlockProps)(),n=t||(e?vo:yo);return(0,c.createElement)("div",{...r},(0,c.createElement)(d.InspectorControls,null,(!F||!L)&&(0,c.createElement)(Tt.Notice,{className:"wc-block-checkout__terms_notice",status:"warning",isDismissible:!1},(0,m.__)("Link to your store's Terms and Conditions and Privacy Policy pages by creating pages for them.","woocommerce"),(0,c.createElement)("br",null),!F&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("br",null),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=advanced`},(0,m.__)("Setup a Terms and Conditions page","woocommerce"))),!L&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("br",null),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}options-privacy.php`},(0,m.__)("Setup a Privacy Policy page","woocommerce")))),F&&L&&!(n.includes(F)&&n.includes(L))&&(0,c.createElement)(Tt.Notice,{className:"wc-block-checkout__terms_notice",status:"warning",isDismissible:!1,actions:yo!==t?[{label:(0,m.__)("Restore default text","woocommerce"),onClick:()=>o({text:""})}]:[]},(0,c.createElement)("p",null,(0,m.__)("Ensure you add links to your policy pages in this section.","woocommerce"))),(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Display options","woocommerce")},(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Require checkbox","woocommerce"),checked:e,onChange:()=>o({checkbox:!e})}))),(0,c.createElement)("div",{className:"wc-block-checkout__terms"},e?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Kt.CheckboxControl,{id:"terms-condition",checked:!1}),(0,c.createElement)(d.RichText,{value:n,onChange:e=>o({text:e})})):(0,c.createElement)(d.RichText,{tagName:"span",value:n,onChange:e=>o({text:e})})))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});var fo=o(6217);const Co=()=>{const{customerId:e,shouldCreateAccount:t}=(0,k.useSelect)((e=>{const t=e(ee.CHECKOUT_STORE_KEY);return{customerId:t.getCustomerId(),shouldCreateAccount:t.getShouldCreateAccount()}})),{__internalSetShouldCreateAccount:o}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),{billingAddress:r,setEmail:n}=jt(),{dispatchCheckoutEvent:s}=rt(),a=!e&&(0,v.getSetting)("checkoutAllowsGuest",!1)&&(0,v.getSetting)("checkoutAllowsSignup",!1)&&(0,c.createElement)(Kt.CheckboxControl,{className:"wc-block-checkout__create-account",label:(0,m.__)("Create an account?","woocommerce"),checked:t,onChange:e=>o(e)});return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Kt.StoreNoticesContainer,{context:we.CONTACT_INFORMATION}),(0,c.createElement)(Kt.ValidatedTextInput,{id:"email",type:"email",autoComplete:"email",errorId:"billing_email",label:(0,m.__)("Email address","woocommerce"),value:r.email,required:!0,onChange:e=>{n(e),s("set-email-address")},customValidation:e=>!!(0,Te.isEmail)(e.value)||(e.setCustomValidity((0,m.__)("Please enter a valid email address","woocommerce")),!1)}),a)},So={...go({defaultTitle:(0,m.__)("Contact information","woocommerce"),defaultDescription:(0,m.__)("We'll use this email to send you details and updates about your order.","woocommerce")}),className:{type:"string",default:""},lock:{type:"object",default:{remove:!0,move:!0}}};(0,l.registerBlockType)("woocommerce/checkout-contact-information-block",{icon:{src:(0,c.createElement)(i.Z,{icon:fo.Z,className:"wc-block-editor-components-block-icon"})},attributes:So,edit:({attributes:e,setAttributes:t})=>(0,c.createElement)(Ht,{attributes:e,setAttributes:t,className:n()("wc-block-checkout__contact-fields",null==e?void 0:e.className)},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Account creation and guest checkout","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Account creation and guest checkout settings can be managed in your store settings.","woocommerce")),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=account`},(0,m.__)("Manage account settings","woocommerce")))),(0,c.createElement)(Jt,null,(0,c.createElement)(Co,null)),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.CONTACT_INFORMATION})),save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});const Po=({addressFieldsConfig:e,defaultEditing:t=!1})=>{const{billingAddress:o,setShippingAddress:r,setBillingAddress:n,useBillingAsShipping:s}=jt(),{dispatchCheckoutEvent:a}=rt(),[i,l]=(0,p.useState)(t),{hasValidationErrors:m,invalidProps:d}=(0,k.useSelect)((e=>{const t=e(ee.VALIDATION_STORE_KEY);return{hasValidationErrors:t.hasValidationErrors(),invalidProps:Object.keys(o).filter((e=>"email"!==e&&void 0!==t.getValidationError("billing_"+e))).filter(Boolean)}}));(0,p.useEffect)((()=>{d.length>0&&!1===i&&l(!0)}),[i,m,d.length]);const u=(0,p.useCallback)((e=>{n(e),s&&(r(e),a("set-shipping-address")),a("set-billing-address")}),[a,n,r,s]),h=(0,p.useCallback)((()=>(0,c.createElement)(uo,{address:o,target:"billing",onEdit:()=>{l(!0)},fieldConfig:e})),[o,e]),_=(0,p.useCallback)((()=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)(mo,{id:"billing",type:"billing",onChange:u,values:o,fields:G,fieldConfig:e}))),[e,o,u]);return(0,c.createElement)(po,{isEditing:i,addressCard:h,addressForm:_})},No=({showCompanyField:e=!1,showApartmentField:t=!1,showPhoneField:o=!1,requireCompanyField:r=!1,requirePhoneField:n=!1})=>{const{shippingAddress:s,billingAddress:a,setShippingAddress:i,useBillingAsShipping:l}=jt(),{isEditor:m}=w();(0,Zt.qR)((()=>{if(l){const{email:t,...c}=a,r={...c};o||delete r.phone,e&&delete r.company,i(r)}}));const d=(0,p.useMemo)((()=>({company:{hidden:!e,required:r},address_2:{hidden:!t},phone:{hidden:!o,required:n}})),[e,r,t,o,n]),u=m?Jt:p.Fragment,h=l?[we.BILLING_ADDRESS,we.SHIPPING_ADDRESS]:[we.BILLING_ADDRESS],{cartDataLoaded:_}=(0,k.useSelect)((e=>({cartDataLoaded:e(ee.CART_STORE_KEY).hasFinishedResolution("getCartData")}))),g=!(!a.address_1||!a.first_name&&!a.last_name),{email:E,...b}=a,y=Qe()(b,s),v=m||!g||y;return(0,c.createElement)(p.Fragment,null,(0,c.createElement)(Kt.StoreNoticesContainer,{context:h}),(0,c.createElement)(u,null,_?(0,c.createElement)(Po,{addressFieldsConfig:d,defaultEditing:v}):null))},To=(0,m.__)("Billing address","woocommerce"),Ro=(0,m.__)("Enter the billing address that matches your payment method.","woocommerce"),xo=(0,m.__)("Billing and shipping address","woocommerce"),Ao=(0,m.__)("Enter the billing and shipping address that matches your payment method.","woocommerce"),Io={...go({defaultTitle:To,defaultDescription:Ro}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}};(0,l.registerBlockType)("woocommerce/checkout-billing-address-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Ut.Z,className:"wc-block-editor-components-block-icon"})},attributes:Io,edit:({attributes:e,setAttributes:t})=>{const{showCompanyField:o,showApartmentField:r,requireCompanyField:s,showPhoneField:a,requirePhoneField:i}=Ot(),{addressFieldControls:l}=Bt(),{showBillingFields:m,forcedBillingAddress:d,useBillingAsShipping:p}=jt();return m||p?(e.title=((e,t)=>t?e===To?xo:e:e===xo?To:e)(e.title,d),e.description=((e,t)=>t?e===Ro?Ao:e:e===Ao?Ro:e)(e.description,d),(0,c.createElement)(Ht,{setAttributes:t,attributes:e,className:n()("wc-block-checkout__billing-fields",null==e?void 0:e.className)},(0,c.createElement)(l,null),(0,c.createElement)(No,{showCompanyField:o,showApartmentField:r,requireCompanyField:s,showPhoneField:a,requirePhoneField:i}),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.BILLING_ADDRESS}))):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});var Mo=o(2069);const Oo=(0,m.__)("Place Order","woocommerce"),Bo={cartPageId:{type:"number",default:0},showReturnToCart:{type:"boolean",default:!0},className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}},placeOrderButtonLabel:{type:"string",default:Oo}},Do=(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}`)},Lo=({setPageId:e,pageId:t,labels:o})=>{const r=(0,k.useSelect)((e=>e("core").getEntityRecords("postType","page",{status:"publish",orderby:"title",order:"asc",per_page:100})),[])||null;return r?(0,c.createElement)(Tt.PanelBody,{title:o.title},(0,c.createElement)(Tt.SelectControl,{label:(0,m.__)("Link to","woocommerce"),value:t,options:[{label:o.default,value:0},...r.map((e=>({label:Do(e,r),value:parseInt(e.id,10)})))],onChange:t=>e(parseInt(t,10))})):null};var Fo=o(4054);o(7755);const Yo=({link:e})=>{const t=e||U;return t?(0,c.createElement)("a",{href:t,className:"wc-block-components-checkout-return-to-cart-button"},(0,c.createElement)(i.Z,{icon:Fo.Z}),(0,m.__)("Return to Cart","woocommerce")):null};var Uo=o(3871);o(1029),o(7440);const Vo=()=>(0,c.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"}),jo=({className:e,showSpinner:t=!1,children:o,variant:r="contained",...s})=>{const a=n()("wc-block-components-button","wp-element-button",e,r,{"wc-block-components-button--loading":t});return(0,c.createElement)(Uo.Z,{className:a,...s},t&&(0,c.createElement)(Vo,null),(0,c.createElement)("span",{className:"wc-block-components-button__text"},o))},Ko=({onChange:e,placeholder:t,value:o,...r})=>(0,c.createElement)(jo,{...r},(0,c.createElement)(d.RichText,{multiline:!1,allowedFormats:[],value:o,placeholder:t,onChange:e}));o(1165);const $o={icon:{src:(0,c.createElement)(i.Z,{icon:Mo.Z,className:"wc-block-editor-components-block-icon"})},attributes:Bo,save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()}),edit:({attributes:e,setAttributes:t})=>{const o=(0,d.useBlockProps)(),{cartPageId:r=0,showReturnToCart:s=!0,placeOrderButtonLabel:a}=e,{current:i}=(0,p.useRef)(r),l=(0,k.useSelect)((e=>i||e("core/editor").getCurrentPostId()),[i]);return(0,c.createElement)("div",{...o},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Account options","woocommerce")},(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)('Show a "Return to Cart" link',"woocommerce"),checked:s,onChange:()=>t({showReturnToCart:!s})})),s&&!(l===D&&0===i)&&(0,c.createElement)(Lo,{pageId:r,setPageId:e=>t({cartPageId:e}),labels:{title:(0,m.__)("Return to Cart button","woocommerce"),default:(0,m.__)("WooCommerce Cart Page","woocommerce")}})),(0,c.createElement)("div",{className:"wc-block-checkout__actions"},(0,c.createElement)("div",{className:"wc-block-checkout__actions_row"},(0,c.createElement)(Jt,null,s&&(0,c.createElement)(Yo,{link:(0,v.getSetting)("page-"+r,!1)})),(0,c.createElement)(Ko,{className:n()("wc-block-cart__submit-button","wc-block-components-checkout-place-order-button",{"wc-block-components-checkout-place-order-button--full-width":!s}),value:a,placeholder:Oo,onChange:e=>{t({placeOrderButtonLabel:e})}}))))}};(0,l.registerBlockType)("woocommerce/checkout-actions-block",$o);var Ho=o(7255);const qo=({disabled:e,onChange:t,placeholder:o,value:r})=>{const[n,s]=(0,p.useState)(!1),[a,i]=(0,p.useState)("");return(0,c.createElement)("div",{className:"wc-block-checkout__add-note"},(0,c.createElement)(Kt.CheckboxControl,{disabled:e,label:(0,m.__)("Add a note to your order","woocommerce"),checked:n,onChange:e=>{s(e),e?r!==a&&t(a):(t(""),i(r))}}),n&&(0,c.createElement)(Kt.Textarea,{disabled:e,onTextChange:t,placeholder:o,value:r}))},zo=({className:e})=>{const{needsShipping:t}=nt(),{isProcessing:o,orderNotes:r}=(0,k.useSelect)((e=>{const t=e(ee.CHECKOUT_STORE_KEY);return{isProcessing:t.isProcessing(),orderNotes:t.getOrderNotes()}})),{__internalSetOrderNotes:s}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY);return(0,c.createElement)(Kt.FormStep,{id:"order-notes",showStepNumber:!1,className:n()("wc-block-checkout__order-notes",e),disabled:o},(0,c.createElement)(qo,{disabled:o,onChange:s,placeholder:t?(0,m.__)("Notes about your order, e.g. special notes for delivery.","woocommerce"):(0,m.__)("Notes about your order.","woocommerce"),value:r}))};o(8659),o(56),(0,l.registerBlockType)("woocommerce/checkout-order-note-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Ho.Z,className:"wc-block-editor-components-block-icon"})},edit:()=>{const e=(0,d.useBlockProps)();return(0,c.createElement)("div",{...e},(0,c.createElement)(Jt,null,(0,c.createElement)(zo,null)))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const Zo=(0,c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24",fill:"none"},(0,c.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,c.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,c.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(991);const Wo=({children:e,className:t,screenReaderLabel:o,showSpinner:r=!1,isLoading:s=!0})=>(0,c.createElement)("div",{className:n()(t,{"wc-block-components-loading-mask":s})},s&&r&&(0,c.createElement)(Kt.Spinner,null),(0,c.createElement)("div",{className:n()({"wc-block-components-loading-mask__children":s}),"aria-hidden":s},e),s&&(0,c.createElement)("span",{className:"screen-reader-text"},o||(0,m.__)("Loading…","woocommerce")));o(1691);const Go=(0,u.withInstanceId)((({instanceId:e,isLoading:t=!1,onSubmit:o,displayCouponForm:r=!1})=>{const[s,a]=(0,p.useState)(""),[i,l]=(0,p.useState)(!r),d=`wc-block-components-totals-coupon__input-${e}`,u=n()("wc-block-components-totals-coupon__content",{"screen-reader-text":i}),{validationErrorId:h}=(0,k.useSelect)((e=>({validationErrorId:e(ee.VALIDATION_STORE_KEY).getValidationErrorId(d)})));return(0,c.createElement)("div",{className:"wc-block-components-totals-coupon"},i?(0,c.createElement)("a",{role:"button",href:"#wc-block-components-totals-coupon__form",className:"wc-block-components-totals-coupon-link","aria-label":(0,m.__)("Add a coupon","woocommerce"),onClick:e=>{e.preventDefault(),l(!1)}},(0,m.__)("Add a coupon","woocommerce")):(0,c.createElement)(Wo,{screenReaderLabel:(0,m.__)("Applying coupon…","woocommerce"),isLoading:t,showSpinner:!1},(0,c.createElement)("div",{className:u},(0,c.createElement)("form",{className:"wc-block-components-totals-coupon__form",id:"wc-block-components-totals-coupon__form"},(0,c.createElement)(Kt.ValidatedTextInput,{id:d,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:(0,m.__)("Enter code","woocommerce"),value:s,ariaDescribedBy:h,onChange:e=>{a(e)},focusOnMount:!0,validateOnMount:!1,showError:!1}),(0,c.createElement)(jo,{className:"wc-block-components-totals-coupon__button",disabled:t||!s,showSpinner:t,onClick:e=>{var t;e.preventDefault(),void 0!==o?null===(t=o(s))||void 0===t||t.then((e=>{e&&(a(""),l(!0))})):(a(""),l(!0))},type:"submit"},(0,m.__)("Apply","woocommerce"))),(0,c.createElement)(Kt.ValidationInputError,{propertyName:"coupon",elementId:d}))))}));o(4970);const Xo={context:"summary"},Jo=({cartCoupons:e=[],currency:t,isRemovingCoupon:o,removeCoupon:r,values:n})=>{const{total_discount:s,total_discount_tax:a}=n,i=parseInt(s,10);if(!i&&0===e.length)return null;const l=parseInt(a,10),d=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?i+l:i,p=(0,Rt.applyCheckoutFilter)({arg:Xo,filterName:"coupons",defaultValue:e});return(0,c.createElement)(Kt.TotalsItem,{className:"wc-block-components-totals-discount",currency:t,description:0!==p.length&&(0,c.createElement)(Wo,{screenReaderLabel:(0,m.__)("Removing coupon…","woocommerce"),isLoading:o,showSpinner:!1},(0,c.createElement)("ul",{className:"wc-block-components-totals-discount__coupon-list"},p.map((e=>(0,c.createElement)(Kt.RemovableChip,{key:"coupon-"+e.code,className:"wc-block-components-totals-discount__coupon-list-item",text:e.label,screenReaderText:(0,m.sprintf)(/* translators: %s Coupon code. */ /* translators: %s Coupon code. */
(0,m.__)("Coupon: %s","woocommerce"),e.label),disabled:o,onRemove:()=>{r(e.code)},radius:"large",ariaLabel:(0,m.sprintf)(/* translators: %s is a coupon code. */ /* translators: %s is a coupon code. */
(0,m.__)('Remove coupon "%s"',"woocommerce"),e.label)}))))),label:d?(0,m.__)("Discount","woocommerce"):(0,m.__)("Coupons","woocommerce"),value:d?-1*d:"-"})},Qo=window.wc.priceFormat;o(4554);const ec=({currency:e,values:t,className:o})=>{const r=(0,v.getSetting)("taxesEnabled",!0)&&(0,v.getSetting)("displayCartPricesIncludingTax",!1),{total_price:s,total_tax:a,tax_lines:i}=t,{receiveCart:l,...d}=Ke(),u=(0,Rt.applyCheckoutFilter)({filterName:"totalLabel",defaultValue:(0,m.__)("Total","woocommerce"),extensions:d.extensions,arg:{cart:d}}),h=parseInt(a,10),_=i&&i.length>0?(0,m.sprintf)(/* translators: %s is a list of tax rates */ /* translators: %s is a list of tax rates */
(0,m.__)("Including %s","woocommerce"),i.map((({name:t,price:o})=>`${(0,Qo.formatPrice)(o,e)} ${t}`)).join(", ")):(0,m.__)("Including <TaxAmount/> in taxes","woocommerce");return(0,c.createElement)(Kt.TotalsItem,{className:n()("wc-block-components-totals-footer-item",o),currency:e,label:u,value:parseInt(s,10),description:r&&0!==h&&(0,c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},(0,p.createInterpolateElement)(_,{TaxAmount:(0,c.createElement)(Kt.FormattedMonetaryAmount,{className:"wc-block-components-totals-footer-item-tax-value",currency:e,value:h})}))})},tc=({selectedShippingRates:e})=>(0,c.createElement)("div",{className:"wc-block-components-totals-item__description wc-block-components-totals-shipping__via"},(0,fe.decodeEntities)(e.filter(((t,o)=>e.indexOf(t)===o)).join(", ")));o(313);const oc=({address:e,onUpdate:t,onCancel:o,addressFields:r})=>{const[n,s]=(0,p.useState)(e),{showAllValidationErrors:a}=(0,k.useDispatch)(ee.VALIDATION_STORE_KEY),{hasValidationErrors:i,isCustomerDataUpdating:l}=(0,k.useSelect)((e=>({hasValidationErrors:e(ee.VALIDATION_STORE_KEY).hasValidationErrors,isCustomerDataUpdating:e(ee.CART_STORE_KEY).isCustomerDataUpdating()})));return(0,c.createElement)("form",{className:"wc-block-components-shipping-calculator-address"},(0,c.createElement)(mo,{fields:r,onChange:s,values:n}),(0,c.createElement)(jo,{className:"wc-block-components-shipping-calculator-address__button",disabled:l,onClick:c=>(c.preventDefault(),Qe()(n,e)?o():(a(),i()?void 0:t(n))),type:"submit"},(0,m.__)("Update","woocommerce")))},cc=({onUpdate:e=(()=>{}),onCancel:t=(()=>{}),addressFields:o=["country","state","city","postcode"]})=>{const{shippingAddress:r}=Vt(),n="wc/cart/shipping-calculator";return(0,c.createElement)("div",{className:"wc-block-components-shipping-calculator"},(0,c.createElement)(Kt.StoreNoticesContainer,{context:n}),(0,c.createElement)(oc,{address:r,addressFields:o,onCancel:t,onUpdate:t=>{(0,k.dispatch)(ee.CART_STORE_KEY).updateCustomerData({shipping_address:t},!1).then((()=>{(e=>{const{removeNotice:t}=(0,k.dispatch)("core/notices"),{getNotices:o}=(0,k.select)("core/notices");o(e).forEach((o=>{t(o.id,e)}))})(n),e(t)})).catch((e=>{(0,ee.processErrorResponse)(e,n)}))}}))},rc=({label:e=(0,m.__)("Calculate","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o})=>(0,c.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),nc=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o,isCheckout:r=!1})=>e?(0,c.createElement)(rc,{label:(0,m.__)("Add an address for shipping options","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o}):(0,c.createElement)("em",null,r?(0,m.__)("No shipping options available","woocommerce"):(0,m.__)("Calculated during checkout","woocommerce")),sc=()=>{const{pickupAddress:e}=(0,k.useSelect)((e=>{const t=e("wc/store/cart").getShippingRates().flatMap((e=>e.shipping_rates)).find((e=>e.selected&&We(e)));if(He(t)&&qe(t,"meta_data")){const e=t.meta_data.find((e=>"pickup_address"===e.key));if(He(e)&&qe(e,"value")&&e.value)return{pickupAddress:e.value}}return He(t),{pickupAddress:void 0}}));return void 0===e?null:(0,c.createElement)("span",{className:"wc-block-components-shipping-address"},(0,m.sprintf)(/* translators: %s: shipping method name, e.g. "Amazon Locker" */ /* translators: %s: shipping method name, e.g. "Amazon Locker" */
(0,m.__)("Collection from %s","woocommerce"),e)+" ")},ac=({formattedLocation:e})=>e?(0,c.createElement)("span",{className:"wc-block-components-shipping-address"},(0,m.sprintf)(/* translators: %s location. */ /* translators: %s location. */
(0,m.__)("Shipping to %s","woocommerce"),e)+" "):null,ic=({showCalculator:e,isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o,shippingAddress:r})=>{const{isEditor:n}=w(),s=(0,k.useSelect)((e=>e(ee.CHECKOUT_STORE_KEY).prefersCollection()));if(!Ae(r)&&!n)return null;const a=Ae(r);return(0,c.createElement)(c.Fragment,null,s?(0,c.createElement)(sc,null):(0,c.createElement)(ac,{formattedLocation:a}),e&&(0,c.createElement)(rc,{label:(0,m.__)("Change address","woocommerce"),isShippingCalculatorOpen:t,setIsShippingCalculatorOpen:o}))};var lc=o(9140),mc=(o(946),o(202)),dc=o(2720),pc=o(4824);const uc=e=>{switch(e){case"success":case"warning":case"info":case"default":return"polite";default:return"assertive"}},hc=e=>{switch(e){case"success":return mc.Z;case"warning":case"info":case"error":return dc.Z;default:return pc.Z}};var _c=o(5158);const gc=({className:e,status:t="default",children:o,spokenMessage:r=o,onRemove:s=(()=>{}),isDismissible:a=!0,politeness:l=uc(t),summary:d})=>(((e,t)=>{const o="string"==typeof e?e:(0,p.renderToString)(e);(0,p.useEffect)((()=>{o&&(0,_c.speak)(o,t)}),[o,t])})(r,l),(0,c.createElement)("div",{className:n()(e,"wc-block-components-notice-banner","is-"+t,{"is-dismissible":a})},(0,c.createElement)(i.Z,{icon:hc(t)}),(0,c.createElement)("div",{className:"wc-block-components-notice-banner__content"},d&&(0,c.createElement)("p",{className:"wc-block-components-notice-banner__summary"},d),o),!!a&&(0,c.createElement)(jo,{className:"wc-block-components-notice-banner__dismiss",icon:lc.Z,label:(0,m.__)("Dismiss this notice","woocommerce"),onClick:e=>{"function"==typeof(null==e?void 0:e.preventDefault)&&e.preventDefault&&e.preventDefault(),s()},showTooltip:!1})));var kc=o(3561),Ec=o.n(kc);const wc=["a","b","em","i","strong","p","br"],bc=["target","href","rel","name","download"],yc=(e,t)=>{const o=(null==t?void 0:t.tags)||wc,c=(null==t?void 0:t.attr)||bc;return Ec().sanitize(e,{ALLOWED_TAGS:o,ALLOWED_ATTR:c})},vc=e=>{const t=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:(0,fe.decodeEntities)(e.name),value:e.rate_id,description:(0,c.createElement)(c.Fragment,null,Number.isFinite(t)&&(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:(0,Qo.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,(0,fe.decodeEntities)(e.delivery_time))}},fc=({className:e="",noResultsMessage:t,onSelectRate:o,rates:r,renderOption:n=vc,selectedRate:s,disabled:a=!1})=>{const i=(null==s?void 0:s.rate_id)||"",l=pt(i),[m,d]=(0,p.useState)((()=>{var e;return i||(null===(e=r[0])||void 0===e?void 0:e.rate_id)}));if((0,p.useEffect)((()=>{i&&i!==l&&i!==m&&d(i)}),[i,m,l]),(0,p.useEffect)((()=>{m&&o(m)}),[o,m]),0===r.length)return t;if(r.length>1)return(0,c.createElement)(Kt.RadioControl,{className:e,onChange:e=>{d(e),o(e)},disabled:a,selected:m,options:r.map(n)});const{label:u,secondaryLabel:h,description:_,secondaryDescription:g}=n(r[0]);return(0,c.createElement)(Kt.RadioControlOptionLayout,{label:u,secondaryLabel:h,description:_,secondaryDescription:g})};o(7099);const Cc=({packageId:e,className:t="",noResultsMessage:o,renderOption:r,packageData:s,collapsible:a,showItems:i})=>{const{selectShippingRate:l,isSelectingRate:d}=nt(),u=document.querySelectorAll(".wc-block-components-shipping-rates-control__package").length>1,h=null!=i?i:u,_=null!=a?a:u,g=(0,c.createElement)(c.Fragment,null,(_||h)&&(0,c.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title",dangerouslySetInnerHTML:{__html:yc(s.name)}}),h&&(0,c.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(s.items).map((e=>{const t=(0,fe.decodeEntities)(e.name),o=e.quantity;return(0,c.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},(0,c.createElement)(Kt.Label,{label:o>1?`${t} × ${o}`:`${t}`,screenReaderLabel:(0,m.sprintf)(/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */ /* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
(0,m._n)("%1$s (%2$d unit)","%1$s (%2$d units)",o,"woocommerce"),t,o)}))})))),k=(0,p.useCallback)((t=>{l(t,e)}),[e,l]),E={className:t,noResultsMessage:o,rates:s.shipping_rates,onSelectRate:k,selectedRate:s.shipping_rates.find((e=>e.selected)),renderOption:r,disabled:d};return _?(0,c.createElement)(Kt.Panel,{className:n()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":d}),initialOpen:!1,title:g},(0,c.createElement)(fc,{...E})):(0,c.createElement)("div",{className:n()("wc-block-components-shipping-rates-control__package",t,{"wc-block-components-shipping-rates-control__package--disabled":d})},g,(0,c.createElement)(fc,{...E}))},Sc=({packages:e,showItems:t,collapsible:o,noResultsMessage:r,renderOption:n})=>e.length?(0,c.createElement)(c.Fragment,null,e.map((({package_id:e,...s})=>(0,c.createElement)(Cc,{key:e,packageId:e,packageData:s,collapsible:o,showItems:t,noResultsMessage:r,renderOption:n})))):null,Pc=({shippingRates:e,isLoadingRates:t,className:o,collapsible:r,showItems:n,noResultsMessage:s,renderOption:a,context:i})=>{(0,p.useEffect)((()=>{var o,c;t||(o=ze(e),c=(e=>e.reduce((function(e,t){return e+t.shipping_rates.length}),0))(e),1===o?(0,_c.speak)((0,m.sprintf)(/* translators: %d number of shipping options found. */ /* translators: %d number of shipping options found. */
(0,m._n)("%d shipping option was found.","%d shipping options were found.",c,"woocommerce"),c)):(0,_c.speak)((0,m.sprintf)(/* translators: %d number of shipping packages packages. */ /* translators: %d number of shipping packages packages. */
(0,m._n)("Shipping option searched for %d package.","Shipping options searched for %d packages.",o,"woocommerce"),o)+" "+(0,m.sprintf)(/* translators: %d number of shipping options available. */ /* translators: %d number of shipping options available. */
(0,m._n)("%d shipping option was found","%d shipping options were found",c,"woocommerce"),c)))}),[t,e]);const{extensions:l,receiveCart:d,...u}=Ke(),h={className:o,collapsible:r,showItems:n,noResultsMessage:s,renderOption:a,extensions:l,cart:u,components:{ShippingRatesControlPackage:Cc},context:i},{isEditor:_}=w(),{hasSelectedLocalPickup:g,selectedRates:k}=nt(),E=He(k)?Object.values(k):[],b=E.every((e=>e===E[0]));return(0,c.createElement)(Wo,{isLoading:t,screenReaderLabel:(0,m.__)("Loading shipping rates…","woocommerce"),showSpinner:!0},g&&"woocommerce/cart"===i&&e.length>1&&!b&&!_&&(0,c.createElement)(gc,{className:"wc-block-components-notice",isDismissible:!1,status:"warning"},(0,m.__)("Multiple shipments must have the same pickup location","woocommerce")),(0,c.createElement)(Rt.ExperimentalOrderShippingPackages.Slot,{...h}),(0,c.createElement)(Rt.ExperimentalOrderShippingPackages,null,(0,c.createElement)(Sc,{packages:e,noResultsMessage:s,renderOption:a})))},Nc=({hasRates:e,shippingRates:t,isLoadingRates:o,isAddressComplete:r})=>{const n=e?(0,m.__)("Shipping options","woocommerce"):(0,m.__)("Choose a shipping option","woocommerce");return(0,c.createElement)("fieldset",{className:"wc-block-components-totals-shipping__fieldset"},(0,c.createElement)("legend",{className:"screen-reader-text"},n),(0,c.createElement)(Pc,{className:"wc-block-components-totals-shipping__options",noResultsMessage:(0,c.createElement)(c.Fragment,null,r&&(0,c.createElement)(gc,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning"},(0,m.__)("There are no shipping options available. Please check your shipping address.","woocommerce"))),shippingRates:t,isLoadingRates:o,context:"woocommerce/cart"}))};o(6968);const Tc=({currency:e,values:t,showCalculator:o=!0,showRateSelector:r=!0,isCheckout:s=!1,className:a})=>{const[i,l]=(0,p.useState)(!1),{shippingAddress:d,cartHasCalculatedShipping:u,shippingRates:h,isLoadingRates:_}=Ke(),g=(e=>(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.total_shipping,10)+parseInt(e.total_shipping_tax,10):parseInt(e.total_shipping,10))(t),E=h.some((e=>e.shipping_rates.length))||g>0,w=o&&i,b=(0,k.useSelect)((e=>e(ee.CHECKOUT_STORE_KEY).prefersCollection())),y=h.flatMap((e=>e.shipping_rates.filter((e=>b&&We(e)&&e.selected||!b&&e.selected)).flatMap((e=>e.name)))),f=Ie(d),C=((e,t,o)=>!e||!t&&o.some((e=>!e.shipping_rates.some((e=>!Ge(e.method_id))))))(E,b,h);return(0,c.createElement)("div",{className:n()("wc-block-components-totals-shipping",a)},(0,c.createElement)(Kt.TotalsItem,{label:(0,m.__)("Shipping","woocommerce"),value:!C&&u?g:(!f||s)&&(0,c.createElement)(nc,{showCalculator:o,isCheckout:s,isShippingCalculatorOpen:i,setIsShippingCalculatorOpen:l}),description:!C&&u||f&&!s?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(tc,{selectedShippingRates:y}),(0,c.createElement)(ic,{shippingAddress:d,showCalculator:o,isShippingCalculatorOpen:i,setIsShippingCalculatorOpen:l})):null,currency:e}),w&&(0,c.createElement)(cc,{onUpdate:()=>{l(!1)},onCancel:()=>{l(!1)}}),r&&u&&!w&&(0,c.createElement)(Nc,{hasRates:E,shippingRates:h,isLoadingRates:_,isAddressComplete:f}))},Rc=()=>{const{extensions:e,receiveCart:t,...o}=Ke(),r={extensions:e,cart:o,context:"woocommerce/checkout"};return(0,c.createElement)(Rt.ExperimentalOrderMeta.Slot,{...r})};(0,l.registerBlockType)("woocommerce/checkout-order-summary-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},attributes:{className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},edit:({clientId:e})=>{const t=(0,d.useBlockProps)(),{cartTotals:o}=Ke(),r=(0,Qo.getCurrencyFromPriceResponse)(o),n=Lt(Rt.innerBlockAreas.CHECKOUT_ORDER_SUMMARY),s=[["woocommerce/checkout-order-summary-cart-items-block",{},[]],["woocommerce/checkout-order-summary-coupon-form-block",{},[]],["woocommerce/checkout-order-summary-subtotal-block",{},[]],["woocommerce/checkout-order-summary-fee-block",{},[]],["woocommerce/checkout-order-summary-discount-block",{},[]],["woocommerce/checkout-order-summary-shipping-block",{},[]],["woocommerce/checkout-order-summary-taxes-block",{},[]]];return Ft({clientId:e,registeredBlocks:n,defaultTemplate:s}),(0,c.createElement)("div",{...t},(0,c.createElement)(d.InnerBlocks,{allowedBlocks:n,template:s}),(0,c.createElement)("div",{className:"wc-block-components-totals-wrapper"},(0,c.createElement)(ec,{currency:r,values:o})),(0,c.createElement)(Rc,null))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(d.InnerBlocks.Content,null))});var xc=o(3326),Ac=o(5656);const Ic={warning:"#F0B849",error:"#CC1818",success:"#46B450",info:"#0073AA"},Mc=({status:e="warning",...t})=>(0,c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...t},(0,c.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:Ic[e],strokeWidth:"1.5"}),(0,c.createElement)("path",{d:"M13 7H11V13H13V7Z",fill:Ic[e]}),(0,c.createElement)("path",{d:"M13 15H11V17H13V15Z",fill:Ic[e]}));o(6950);const Oc=({href:e,title:t,description:o,warning:r})=>(0,c.createElement)("a",{href:e,className:"wc-block-editor-components-external-link-card",target:"_blank",rel:"noreferrer"},(0,c.createElement)("span",{className:"wc-block-editor-components-external-link-card__content"},(0,c.createElement)("strong",{className:"wc-block-editor-components-external-link-card__title"},t),o&&(0,c.createElement)("span",{className:"wc-block-editor-components-external-link-card__description",dangerouslySetInnerHTML:{__html:yc(o)}}),r?(0,c.createElement)("span",{className:"wc-block-editor-components-external-link-card__warning"},(0,c.createElement)(i.Z,{icon:(0,c.createElement)(Mc,{status:"error"})}),(0,c.createElement)("span",null,r)):null),(0,c.createElement)(Tt.VisuallyHidden,{as:"span"},/* translators: accessibility text */ /* translators: accessibility text */
(0,m.__)("(opens in a new tab)","woocommerce")),(0,c.createElement)(i.Z,{icon:Ac.Z,className:"wc-block-editor-components-external-link-card__icon"})),Bc=window.wp.autop,Dc=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),Lc=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,Fc=(e,t,o="&hellip;",c=!0)=>{const r=Dc(e),n=r.split(" ").splice(0,t).join(" ");return n===r?c?(0,Bc.autop)(r):r:c?(0,Bc.autop)(Lc(n,o)):Lc(n,o)},Yc=(e,t,o=!0,c="&hellip;",r=!0)=>{const n=Dc(e),s=n.slice(0,t);if(s===n)return r?(0,Bc.autop)(n):n;if(o)return(0,Bc.autop)(Lc(s,c));const a=s.match(/([\s]+)/g),i=a?a.length:0,l=n.slice(0,t+i);return r?(0,Bc.autop)(Lc(l,c)):Lc(l,c)};o(7277);const Uc=()=>(0,c.createElement)(gc,{isDismissible:!1,className:"wc-block-checkout__no-payment-methods-notice",status:"error"},(0,m.__)("There are no payment methods available. This may be an error on our side. Please contact us if you need any help placing your order.","woocommerce")),Vc=(0,c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)("g",{fill:"none",fillRule:"evenodd"},(0,c.createElement)("path",{d:"M0 0h24v24H0z"}),(0,c.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,c.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 jc=o(214),Kc=o(1231);o(3169);const $c={bank:jc.Z,bill:Kc.Z,card:xc.Z,checkPayment:Vc},Hc=({icon:e="",text:t=""})=>{const o=!!e,r=(0,p.useCallback)((e=>o&&Ce(e)&&qe($c,e)),[o]),s=n()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return(0,c.createElement)("span",{className:s},r(e)?(0,c.createElement)(i.Z,{icon:$c[e]}):e,t)},qc=e=>`wc-block-components-payment-method-icon wc-block-components-payment-method-icon--${e}`,zc=({id:e,src:t=null,alt:o=""})=>t?(0,c.createElement)("img",{className:qc(e),src:t,alt:o}):null,Zc=[{id:"alipay",alt:"Alipay",src:B+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:B+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:B+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:B+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:B+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:B+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:B+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:B+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:B+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:B+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:B+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:B+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:B+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:B+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:B+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:B+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:B+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:B+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:B+"payment-methods/wechat.svg"}];o(6391);const Wc=({icons:e=[],align:t="center",className:o})=>{const r=(e=>{const t={};return e.forEach((e=>{let o={};"string"==typeof e&&(o={id:e,alt:e,src:null}),"object"==typeof e&&(o={id:e.id||"",alt:e.alt||"",src:e.src||null}),o.id&&Ce(o.id)&&!t[o.id]&&(t[o.id]=o)})),Object.values(t)})(e);if(0===r.length)return null;const s=n()("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,c.createElement)("div",{className:s},r.map((e=>{const t={...e,...(o=e.id,Zc.find((e=>e.id===o))||{})};var o;return(0,c.createElement)(zc,{key:"payment-method-icon-"+e.id,...t})})))},Gc=(e="")=>{const{cartCoupons:t,cartIsLoading:o}=Ke(),{createErrorNotice:c}=(0,k.useDispatch)("core/notices"),{createNotice:r}=(0,k.useDispatch)("core/notices"),{setValidationErrors:n}=(0,k.useDispatch)(ee.VALIDATION_STORE_KEY),{isApplyingCoupon:s,isRemovingCoupon:a}=(0,k.useSelect)((e=>{const t=e(ee.CART_STORE_KEY);return{isApplyingCoupon:t.isApplyingCoupon(),isRemovingCoupon:t.isRemovingCoupon()}}),[c,r]),{applyCoupon:i,removeCoupon:l}=(0,k.useDispatch)(ee.CART_STORE_KEY);return{appliedCoupons:t,isLoading:o,applyCoupon:t=>i(t).then((()=>((0,Rt.applyCheckoutFilter)({filterName:"showApplyCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&r("info",(0,m.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */
(0,m.__)('Coupon code "%s" has been applied to your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((e=>(n({coupon:{message:(0,fe.decodeEntities)(e.message),hidden:!1}}),Promise.resolve(!1)))),removeCoupon:t=>l(t).then((()=>((0,Rt.applyCheckoutFilter)({filterName:"showRemoveCouponNotice",defaultValue:!0,arg:{couponCode:t,context:e}})&&r("info",(0,m.sprintf)(/* translators: %s coupon code. */ /* translators: %s coupon code. */
(0,m.__)('Coupon code "%s" has been removed from your cart.',"woocommerce"),t),{id:"coupon-form",type:"snackbar",context:e}),Promise.resolve(!0)))).catch((t=>(c(t.message,{id:"coupon-form",context:e}),Promise.resolve(!1)))),isApplyingCoupon:s,isRemovingCoupon:a}},Xc=(e,t)=>{const o=[],c=(t,o)=>{const c=o+"_tax",r=qe(e,o)&&Ce(e[o])?parseInt(e[o],10):0;return{key:o,label:t,value:r,valueWithTax:r+(qe(e,c)&&Ce(e[c])?parseInt(e[c],10):0)}};return o.push(c((0,m.__)("Subtotal:","woocommerce"),"total_items")),o.push(c((0,m.__)("Fees:","woocommerce"),"total_fees")),o.push(c((0,m.__)("Discount:","woocommerce"),"total_discount")),o.push({key:"total_tax",label:(0,m.__)("Taxes:","woocommerce"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&o.push(c((0,m.__)("Shipping:","woocommerce"),"total_shipping")),o},Jc=()=>{const{onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutAfterProcessingWithSuccess:o,onCheckoutAfterProcessingWithError:c,onSubmit:r,onCheckoutSuccess:n,onCheckoutFail:s,onCheckoutValidation:a}=Et(),{isCalculating:i,isComplete:l,isIdle:d,isProcessing:u,customerId:h}=(0,k.useSelect)((e=>{const t=e(ee.CHECKOUT_STORE_KEY);return{isComplete:t.isComplete(),isIdle:t.isIdle(),isProcessing:t.isProcessing(),customerId:t.getCustomerId(),isCalculating:t.isCalculating()}})),{paymentStatus:_,activePaymentMethod:g,shouldSavePayment:E}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{paymentStatus:{get isPristine(){return oe()("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 oe()("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 oe()("hasFailed",{since:"9.6.0",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-blocks/pull/8110"}),t.hasPaymentError()},get isSuccessful(){return oe()("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,k.useDispatch)(ee.PAYMENT_STORE_KEY),{onPaymentProcessing:b,onPaymentSetup:y}=(0,p.useContext)(ae),{shippingErrorStatus:f,shippingErrorTypes:C,onShippingRateSuccess:S,onShippingRateFail:P,onShippingRateSelectSuccess:N,onShippingRateSelectFail:T}=mt(),{shippingRates:R,isLoadingRates:x,selectedRates:A,isSelectingRate:I,selectShippingRate:M,needsShipping:O}=nt(),{billingAddress:B,shippingAddress:D}=(0,k.useSelect)((e=>e(ee.CART_STORE_KEY).getCustomerData())),{setShippingAddress:L}=(0,k.useDispatch)(ee.CART_STORE_KEY),{cartItems:F,cartFees:Y,cartTotals:U,extensions:V}=Ke(),{appliedCoupons:j}=Gc(),K=(0,p.useRef)(Xc(U,O)),$=(0,p.useRef)({label:(0,m.__)("Total","woocommerce"),value:parseInt(U.total_price,10)});(0,p.useEffect)((()=>{K.current=Xc(U,O),$.current={label:(0,m.__)("Total","woocommerce"),value:parseInt(U.total_price,10)}}),[U,O]);const H=(0,p.useCallback)(((e="")=>{oe()("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:g,billing:{appliedCoupons:j,billingAddress:B,billingData:B,cartTotal:$.current,cartTotalItems:K.current,currency:(0,Qo.getCurrencyFromPriceResponse)(U),customerId:h,displayPricesIncludingTax:(0,v.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:F,cartFees:Y,extensions:V},checkoutStatus:{isCalculating:i,isComplete:l,isIdle:d,isProcessing:u},components:{LoadingMask:Wo,PaymentMethodIcons:Wc,PaymentMethodLabel:Hc,ValidationInputError:Kt.ValidationInputError},emitResponse:{noticeContexts:we,responseTypes:Ee},eventRegistration:{onCheckoutAfterProcessingWithError:c,onCheckoutAfterProcessingWithSuccess:o,onCheckoutBeforeProcessing:e,onCheckoutValidationBeforeProcessing:t,onCheckoutSuccess:n,onCheckoutFail:s,onCheckoutValidation:a,onPaymentProcessing:b,onPaymentSetup:y,onShippingRateFail:P,onShippingRateSelectFail:T,onShippingRateSelectSuccess:N,onShippingRateSuccess:S},onSubmit:r,paymentStatus:_,setExpressPaymentError:H,shippingData:{isSelectingRate:I,needsShipping:O,selectedRates:A,setSelectedRates:M,setShippingAddress:L,shippingAddress:D,shippingRates:R,shippingRatesLoading:x},shippingStatus:{shippingErrorStatus:f,shippingErrorTypes:C},shouldSavePayment:E}};class Qc extends p.Component{constructor(...e){super(...e),(0,M.Z)(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:o}=this.props;if(e){let e=(0,m.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woocommerce");(o||v.CURRENT_USER_IS_ADMIN)&&(e=t||(0,m.__)("There was an error with this payment method. Please verify it's configured correctly.","woocommerce"));const r=[{id:"0",content:e,isDismissible:!1,status:"error"}];return(0,c.createElement)(Kt.StoreNoticesContainer,{additionalNotices:r,context:we.PAYMENTS})}return this.props.children}}const er=Qc,tr=({children:e,showSaveOption:t})=>{const{isEditor:o}=w(),{shouldSavePaymentMethod:r,customerId:n}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY),o=e(ee.CHECKOUT_STORE_KEY);return{shouldSavePaymentMethod:t.getShouldSavePaymentMethod(),customerId:o.getCustomerId()}})),{__internalSetShouldSavePaymentMethod:s}=(0,k.useDispatch)(ee.PAYMENT_STORE_KEY);return(0,c.createElement)(er,{isEditor:o},e,n>0&&t&&(0,c.createElement)(Kt.CheckboxControl,{className:"wc-block-components-payment-methods__save-card-info",label:(0,m.__)("Save payment information to my account for future purchases.","woocommerce"),checked:r,onChange:()=>s(!r)}))},or="wc/store/payment",cr=()=>{const{activeSavedToken:e,activePaymentMethod:t,isExpressPaymentMethodActive:o,savedPaymentMethods:r,availablePaymentMethods:s}=(0,k.useSelect)((e=>{const t=e(or);return{activeSavedToken:t.getActiveSavedToken(),activePaymentMethod:t.getActivePaymentMethod(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive(),savedPaymentMethods:t.getSavedPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}})),{__internalSetActivePaymentMethod:a}=(0,k.useDispatch)(or),i=(0,vt.getPaymentMethods)(),{...l}=Jc(),{removeNotice:m}=(0,k.useDispatch)("core/notices"),{dispatchCheckoutEvent:d}=rt(),{isEditor:u}=w(),h=Object.keys(s).map((e=>{const{edit:t,content:o,label:r,supports:n}=i[e],s=u?t:o;return{value:e,label:"string"==typeof r?r:(0,p.cloneElement)(r,{components:l.components}),name:`wc-saved-payment-method-token-${e}`,content:(0,c.createElement)(tr,{showSaveOption:n.showSaveOption},(0,p.cloneElement)(s,{__internalSetActivePaymentMethod:a,...l}))}})),_=(0,p.useCallback)((e=>{a(e),m("wc-payment-error",we.PAYMENTS),d("set-active-payment-method",{value:e})}),[d,m,a]),g=0===Object.keys(r).length&&1===Object.keys(i).length,E=n()({"disable-radio-control":g});return o?null:(0,c.createElement)(Kt.RadioControlAccordion,{id:"wc-payment-method-options",className:E,selected:e?null:t,onChange:_,options:h})},rr="wc/store/cart",nr=((0,m.__)("Unable to get cart data from the API.","woocommerce"),[]),sr=[],ar={},ir={};Object.keys(v.defaultFields).forEach((e=>{ir[e]=""})),delete ir.email;const lr={};Object.keys(v.defaultFields).forEach((e=>{lr[e]=""}));const mr={cartItemsPendingQuantity:[],cartItemsPendingDelete:[],cartData:{coupons:[],shippingRates:[],shippingAddress:ir,billingAddress:lr,items:[],itemsCount:0,itemsWeight:0,crossSells:[],needsShipping:!0,needsPayment:!1,hasCalculatedShipping:!0,fees:[],totals:{currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:".",currency_thousand_separator:",",currency_prefix:"",currency_suffix:"",total_items:"0",total_items_tax:"0",total_fees:"0",total_fees_tax:"0",total_discount:"0",total_discount_tax:"0",total_shipping:"0",total_shipping_tax:"0",total_price:"0",total_tax:"0",tax_lines:[]},errors:nr,paymentMethods:[],paymentRequirements:[],extensions:ar},metaData:{updatingCustomerData:!1,updatingSelectedRate:!1,applyingCoupon:"",removingCoupon:"",isCartDataStale:!1},errors:sr},dr=({method:e,expires:t})=>(0,m.sprintf)(/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card, %3$s is referring to the expiry date.  */ /* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card, %3$s is referring to the expiry date.  */
(0,m.__)("%1$s ending in %2$s (expires %3$s)","woocommerce"),e.brand,e.last4,t),pr=({method:e})=>e.brand&&e.last4?(0,m.sprintf)(/* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card. */ /* translators: %1$s is referring to the payment method brand, %2$s is referring to the last 4 digits of the payment card. */
(0,m.__)("%1$s ending in %2$s","woocommerce"),e.brand,e.last4):(0,m.sprintf)(/* translators: %s is the name of the payment method gateway. */ /* translators: %s is the name of the payment method gateway. */
(0,m.__)("Saved token for %s","woocommerce"),e.gateway),ur=()=>{var e;const{activeSavedToken:t,activePaymentMethod:o,savedPaymentMethods:r}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{activeSavedToken:t.getActiveSavedToken(),activePaymentMethod:t.getActivePaymentMethod(),savedPaymentMethods:t.getSavedPaymentMethods()}})),{__internalSetActivePaymentMethod:n}=(0,k.useDispatch)(ee.PAYMENT_STORE_KEY),s=(()=>{let e;if((0,k.select)("core/editor")){const t={cartCoupons:ot.coupons,cartItems:ot.items,crossSellsProducts:ot.cross_sells,cartFees:ot.fees,cartItemsCount:ot.items_count,cartItemsWeight:ot.items_weight,cartNeedsPayment:ot.needs_payment,cartNeedsShipping:ot.needs_shipping,cartItemErrors:nr,cartTotals:ot.totals,cartIsLoading:!1,cartErrors:sr,billingData:mr.cartData.billingAddress,billingAddress:mr.cartData.billingAddress,shippingAddress:mr.cartData.shippingAddress,extensions:ar,shippingRates:ot.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:ot.has_calculated_shipping,paymentRequirements:ot.payment_requirements,receiveCart:()=>{}};e={cart:t,cartTotals:t.cartTotals,cartNeedsShipping:t.cartNeedsShipping,billingData:t.billingAddress,billingAddress:t.billingAddress,shippingAddress:t.shippingAddress,selectedShippingMethods:Xe(t.shippingRates),paymentMethods:ot.payment_methods,paymentRequirements:t.paymentRequirements}}else{const t=(0,k.select)(rr),o=t.getCartData(),c=t.getCartErrors(),r=t.getCartTotals(),n=!t.hasFinishedResolution("getCartData"),s=t.isCustomerDataUpdating(),a=Xe(o.shippingRates);e={cart:{cartCoupons:o.coupons,cartItems:o.items,crossSellsProducts:o.crossSells,cartFees:o.fees,cartItemsCount:o.itemsCount,cartItemsWeight:o.itemsWeight,cartNeedsPayment:o.needsPayment,cartNeedsShipping:o.needsShipping,cartItemErrors:o.errors,cartTotals:r,cartIsLoading:n,cartErrors:c,billingData:xe(o.billingAddress),billingAddress:xe(o.billingAddress),shippingAddress:xe(o.shippingAddress),extensions:o.extensions,shippingRates:o.shippingRates,isLoadingRates:s,cartHasCalculatedShipping:o.hasCalculatedShipping,paymentRequirements:o.paymentRequirements,receiveCart:(0,k.dispatch)(rr).receiveCart},cartTotals:o.totals,cartNeedsShipping:o.needsShipping,billingData:o.billingAddress,billingAddress:o.billingAddress,shippingAddress:o.shippingAddress,selectedShippingMethods:a,paymentMethods:o.paymentMethods,paymentRequirements:o.paymentRequirements}}return e})(),a=(0,vt.getPaymentMethods)(),i=Jc(),{removeNotice:l}=(0,k.useDispatch)("core/notices"),{dispatchCheckoutEvent:m}=rt(),d=(0,p.useMemo)((()=>{const e=Object.keys(r),t=new Set(e.flatMap((e=>r[e].map((e=>e.method.gateway))))),o=Array.from(t).filter((e=>{var t;return null===(t=a[e])||void 0===t?void 0:t.canMakePayment(s)}));return e.flatMap((e=>r[e].map((t=>{if(!o.includes(t.method.gateway))return;const c="cc"===e||"echeck"===e,r=t.method.gateway;return{name:`wc-saved-payment-method-token-${r}`,label:c?dr(t):pr(t),value:t.tokenId.toString(),onChange:e=>{n(r,{token:e,payment_method:r,[`wc-${r}-payment-token`]:e.toString(),isSavedToken:!0}),l("wc-payment-error",we.PAYMENTS),m("set-active-payment-method",{paymentMethodSlug:r})}}})))).filter((e=>void 0!==e))}),[r,a,n,l,m,s]),u=t&&a[o]&&void 0!==(null===(e=a[o])||void 0===e?void 0:e.savedTokenComponent)&&!$e(a[o].savedTokenComponent)?(0,p.cloneElement)(a[o].savedTokenComponent,{token:t,...i}):null;return d.length>0?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Kt.RadioControl,{id:"wc-payment-method-saved-tokens",selected:t,options:d,onChange:()=>{}}),u):null};o(7586);const hr=()=>{const{paymentMethodsInitialized:e,availablePaymentMethods:t,savedPaymentMethods:o}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),availablePaymentMethods:t.getAvailablePaymentMethods(),savedPaymentMethods:t.getSavedPaymentMethods()}}));return e&&0===Object.keys(t).length?(0,c.createElement)(Uc,null):(0,c.createElement)(c.Fragment,null,(0,c.createElement)(ur,null),Object.keys(o).length>0&&(0,c.createElement)(Kt.Label,{label:(0,m.__)("Use another payment method.","woocommerce"),screenReaderLabel:(0,m.__)("Other available payment methods","woocommerce"),wrapperElement:"p",wrapperProps:{className:["wc-block-components-checkout-step__description wc-block-components-checkout-step__description-payments-aligned"]}}),(0,c.createElement)(cr,null))},_r=()=>(0,c.createElement)(hr,null),gr={...go({defaultTitle:(0,m.__)("Payment options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}};(0,l.registerBlockType)("woocommerce/checkout-payment-block",{icon:{src:(0,c.createElement)(i.Z,{icon:xc.Z,className:"wc-block-editor-components-block-icon"})},attributes:gr,edit:({attributes:e,setAttributes:t})=>{const o=(0,v.getSetting)("globalPaymentMethods"),{incompatiblePaymentMethods:r}=(0,k.useSelect)((e=>{const{getIncompatiblePaymentMethods:t}=e(ee.PAYMENT_STORE_KEY);return{incompatiblePaymentMethods:t()}}),[]),s=(0,m.__)("Incompatible with block-based checkout","woocommerce"),a=O.wordCountType;return(0,c.createElement)(Ht,{attributes:e,setAttributes:t,className:n()("wc-block-checkout__payment-method",null==e?void 0:e.className)},(0,c.createElement)(d.InspectorControls,null,o.length>0&&(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Methods","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("You currently have the following payment integrations active.","woocommerce")),o.map((e=>{const t=!!r[e.id];let o;return o="words"===a?Fc(e.description,30,void 0,!1):Yc(e.description,30,"characters_including_spaces"===a,void 0,!1),(0,c.createElement)(Oc,{key:e.id,href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=checkout&section=${e.id}`,title:e.title,description:o,...t?{warning:s}:{}})})),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=checkout`},(0,m.__)("Manage payment methods","woocommerce")))),(0,c.createElement)(Jt,null,(0,c.createElement)(_r,null)),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.PAYMENT_METHODS}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});const kr=(0,c.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"currentColor",viewBox:"0 0 24 24"},(0,c.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,c.createElement)("path",{fill:"#1E1E1E",d:"M10 3h4v3h-4z"}),(0,c.createElement)("rect",{width:"1.5",height:"5",x:"11.25",y:"8",fill:"#1E1E1E",rx:".75"}),(0,c.createElement)("path",{fill:"#1E1E1E",d:"m15.7 4.816 1.66 1.078-1.114 1.718-1.661-1.078z"})),Er=()=>((e=!1)=>{const{paymentMethodsInitialized:t,expressPaymentMethodsInitialized:o,availablePaymentMethods:c,availableExpressPaymentMethods:r}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{paymentMethodsInitialized:t.paymentMethodsInitialized(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),availablePaymentMethods:t.getAvailablePaymentMethods()}})),n=Object.values(c).map((({name:e})=>e)),s=Object.values(r).map((({name:e})=>e)),a=(0,vt.getPaymentMethods)(),i=(0,vt.getExpressPaymentMethods)(),l=Object.keys(a).reduce(((e,t)=>(n.includes(t)&&(e[t]=a[t]),e)),{}),m=Object.keys(i).reduce(((e,t)=>(s.includes(t)&&(e[t]=i[t]),e)),{}),d=io(l),p=io(m);return{paymentMethods:e?p:d,isInitialized:e?o:t}})(!0),wr=()=>{const{isEditor:e}=w(),{activePaymentMethod:t,paymentMethodData:o}=(0,k.useSelect)((e=>{const t=e(or);return{activePaymentMethod:t.getActivePaymentMethod(),paymentMethodData:t.getPaymentMethodData()}})),{__internalSetActivePaymentMethod:r,__internalSetExpressPaymentStarted:n,__internalSetPaymentIdle:s,__internalSetPaymentError:a,__internalSetPaymentMethodData:i,__internalSetExpressPaymentError:l}=(0,k.useDispatch)(or),{paymentMethods:d}=Er(),u=Jc(),h=(0,p.useRef)(t),_=(0,p.useRef)(o),g=(0,p.useCallback)((e=>()=>{h.current=t,_.current=o,n(),r(e)}),[t,o,r,n]),E=(0,p.useCallback)((()=>{s(),r(h.current,_.current)}),[r,s]),b=(0,p.useCallback)((e=>{a(),i(e),l(e),r(h.current,_.current)}),[r,a,i,l]),y=(0,p.useCallback)(((e="")=>{oe()("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?b(e):l("")}),[l,b]),v=Object.entries(d),f=v.length>0?v.map((([t,o])=>{const r=e?o.edit:o.content;return(0,p.isValidElement)(r)?(0,c.createElement)("li",{key:t,id:`express-payment-method-${t}`},(0,p.cloneElement)(r,{...u,onClick:g(t),onClose:E,onError:b,setExpressPaymentError:y})):null})):(0,c.createElement)("li",{key:"noneRegistered"},(0,m.__)("No registered Payment Methods","woocommerce"));return(0,c.createElement)(er,{isEditor:e},(0,c.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},f))};o(9660);const br=()=>{const{isCalculating:e,isProcessing:t,isAfterProcessing:o,isBeforeProcessing:r,isComplete:n,hasError:s}=(0,k.useSelect)((e=>{const t=e(ee.CHECKOUT_STORE_KEY);return{isCalculating:t.isCalculating(),isProcessing:t.isProcessing(),isAfterProcessing:t.isAfterProcessing(),isBeforeProcessing:t.isBeforeProcessing(),isComplete:t.isComplete(),hasError:t.hasError()}})),{availableExpressPaymentMethods:a,expressPaymentMethodsInitialized:i,isExpressPaymentMethodActive:l}=(0,k.useSelect)((e=>{const t=e(ee.PAYMENT_STORE_KEY);return{availableExpressPaymentMethods:t.getAvailableExpressPaymentMethods(),expressPaymentMethodsInitialized:t.expressPaymentMethodsInitialized(),isExpressPaymentMethodActive:t.isExpressPaymentMethodActive()}})),{isEditor:d}=w();if(!i||i&&0===Object.keys(a).length)return d||v.CURRENT_USER_IS_ADMIN?(0,c.createElement)(Kt.StoreNoticesContainer,{context:we.EXPRESS_PAYMENTS}):null;const p=t||o||r||n&&!s;return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Wo,{isLoading:e||p||l},(0,c.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--checkout"},(0,c.createElement)("div",{className:"wc-block-components-express-payment__title-container"},(0,c.createElement)(Kt.Title,{className:"wc-block-components-express-payment__title",headingLevel:"2"},(0,m.__)("Express Checkout","woocommerce"))),(0,c.createElement)("div",{className:"wc-block-components-express-payment__content"},(0,c.createElement)(Kt.StoreNoticesContainer,{context:we.EXPRESS_PAYMENTS}),(0,c.createElement)(wr,null)))),(0,c.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--checkout"},(0,m.__)("Or continue below","woocommerce")))},yr=({className:e})=>{const{cartNeedsPayment:t}=Ke();return t?(0,c.createElement)("div",{className:e},(0,c.createElement)(br,null)):null};o(2455),(0,l.registerBlockType)("woocommerce/checkout-express-payment-block",{icon:{src:(0,c.createElement)(i.Z,{style:{fill:"none"},icon:kr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{paymentMethods:t,isInitialized:o}=Er(),r=Object.keys(t).length>0,s=(0,d.useBlockProps)({className:n()({"wp-block-woocommerce-checkout-express-payment-block--has-express-payment-methods":r},null==e?void 0:e.className),attributes:e});return o&&r?(0,c.createElement)("div",{...s},(0,c.createElement)(yr,null)):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});var vr=o(31),fr=o(1998);const Cr=({minRate:e,maxRate:t,multiple:o=!1})=>{if(void 0===e||void 0===t)return null;const r=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10),n=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(t.price,10)+parseInt(t.taxes,10):parseInt(t.price,10),s=0===r?(0,c.createElement)("em",null,(0,m.__)("free","woocommerce")):(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:(0,Qo.getCurrencyFromPriceResponse)(e),value:r});return(0,c.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},r!==n||o?(0,p.createInterpolateElement)(0===r&&0===n?"<price />":(0,m.__)("from <price />","woocommerce"),{price:s}):s)};function Sr(e){return e?{min:e.reduce(((e,t)=>Ge(t.method_id)?e:void 0===e||parseInt(t.price,10)<parseInt(e.price,10)?t:e),void 0),max:e.reduce(((e,t)=>Ge(t.method_id)?e:void 0===e||parseInt(t.price,10)>parseInt(e.price,10)?t:e),void 0)}:{min:void 0,max:void 0}}function Pr(e){return e?{min:e.reduce(((e,t)=>Ge(t.method_id)&&(void 0===e||t.price<e.price)?t:e),void 0),max:e.reduce(((e,t)=>Ge(t.method_id)&&(void 0===e||t.price>e.price)?t:e),void 0)}:{min:void 0,max:void 0}}o(6523);const Nr=(0,m.__)("Local Pickup","woocommerce"),Tr=(0,m.__)("Shipping","woocommerce"),Rr=({checked:e,rate:t,showPrice:o,showIcon:r,toggleText:s,setAttributes:a})=>(0,c.createElement)(Tt.__experimentalRadio,{value:"pickup",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===e})},!0===r&&(0,c.createElement)(i.Z,{icon:fr.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,c.createElement)(d.RichText,{value:s,placeholder:Nr,tagName:"span",className:"wc-block-checkout__shipping-method-option-title",onChange:e=>a({localPickupText:e}),__unstableDisableFormats:!0,preserveWhiteSpace:!0}),!0===o&&(0,c.createElement)(Cr,{minRate:t.min,maxRate:t.max})),xr=({checked:e,rate:t,showPrice:o,showIcon:r,toggleText:s,setAttributes:a})=>{const l=void 0===t.min?(0,c.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},(0,m.__)("calculated with an address","woocommerce")):(0,c.createElement)(Cr,{minRate:t.min,maxRate:t.max});return(0,c.createElement)(Tt.__experimentalRadio,{value:"shipping",className:n()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===e})},!0===r&&(0,c.createElement)(i.Z,{icon:vr.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,c.createElement)(d.RichText,{value:s,placeholder:Tr,tagName:"span",className:"wc-block-checkout__shipping-method-option-title",onChange:e=>a({shippingText:e}),__unstableDisableFormats:!0,preserveWhiteSpace:!0}),!0===o&&l)},Ar={...go({defaultTitle:(0,m.__)("Shipping method","woocommerce"),defaultDescription:(0,m.__)("Select how you would like to receive your order.","woocommerce")}),className:{type:"string",default:""},showIcon:{type:"boolean",default:!0},showPrice:{type:"boolean",default:!0},localPickupText:{type:"string",default:Nr},shippingText:{type:"string",default:Tr},lock:{type:"object",default:{move:!0,remove:!0}}};(0,l.registerBlockType)("woocommerce/checkout-shipping-method-block",{icon:{src:(0,c.createElement)(i.Z,{icon:vr.Z,className:"wc-block-editor-components-block-icon"})},attributes:Ar,edit:({attributes:e,setAttributes:t})=>{var o,r;const{setPrefersCollection:s}=(0,k.useDispatch)(ee.CHECKOUT_STORE_KEY),{prefersCollection:a}=(0,k.useSelect)((e=>({prefersCollection:e(ee.CHECKOUT_STORE_KEY).prefersCollection()}))),{showPrice:i,showIcon:l,className:p,localPickupText:u,shippingText:h}=e,{shippingRates:_,needsShipping:g,hasCalculatedShipping:E,isCollectable:w}=nt();return g&&E&&_&&w&&V?(0,c.createElement)(Ht,{attributes:e,setAttributes:t,className:n()("wc-block-checkout__shipping-method",p)},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Appearance","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Choose how this block is displayed to your customers.","woocommerce")),(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Show icon","woocommerce"),checked:l,onChange:()=>t({showIcon:!l})}),(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Show costs","woocommerce"),checked:i,onChange:()=>t({showPrice:!i})})),(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Shipping Methods","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Methods can be made managed in your store settings.","woocommerce")),(0,c.createElement)(Oc,{key:"shipping_methods",href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`,title:(0,m.__)("Shipping","woocommerce"),description:(0,m.__)("Manage your shipping zones, methods, and rates.","woocommerce")}),(0,c.createElement)(Oc,{key:"pickup_location",href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping&section=pickup_location`,title:(0,m.__)("Local Pickup","woocommerce"),description:(0,m.__)("Allow customers to choose a local pickup location during checkout.","woocommerce")}))),(0,c.createElement)(Tt.__experimentalRadioGroup,{id:"shipping-method",className:"wc-block-checkout__shipping-method-container",label:"options",onChange:e=>{s("pickup"===e)},checked:a?"pickup":"shipping"},(0,c.createElement)(xr,{checked:a?"pickup":"shipping",rate:Sr(null===(o=_[0])||void 0===o?void 0:o.shipping_rates),showPrice:i,showIcon:l,setAttributes:t,toggleText:h}),(0,c.createElement)(Rr,{checked:a?"pickup":"shipping",rate:Pr(null===(r=_[0])||void 0===r?void 0:r.shipping_rates),showPrice:i,showIcon:l,setAttributes:t,toggleText:u})),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.SHIPPING_METHOD})):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))}),o(1665);const Ir=()=>(0,c.createElement)(Tt.Placeholder,{icon:(0,c.createElement)(i.Z,{icon:vr.Z}),label:(0,m.__)("Shipping options","woocommerce"),className:"wc-block-checkout__no-shipping-placeholder"},(0,c.createElement)("span",{className:"wc-block-checkout__no-shipping-placeholder-description"},(0,m.__)("Your store does not have any Shipping Options configured. Once you have added your Shipping Options they will appear here.","woocommerce")),(0,c.createElement)(Tt.Button,{variant:"secondary",href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`,target:"_blank",rel:"noopener noreferrer"},(0,m.__)("Configure Shipping Options","woocommerce"))),Mr=e=>{const t=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:(0,fe.decodeEntities)(e.name),value:e.rate_id,description:(0,fe.decodeEntities)(e.description),secondaryLabel:(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:(0,Qo.getCurrencyFromPriceResponse)(e),value:t}),secondaryDescription:(0,fe.decodeEntities)(e.delivery_time)}},Or=({noShippingPlaceholder:e=null})=>{const{isEditor:t}=w(),{shippingRates:o,needsShipping:r,isLoadingRates:n,hasCalculatedShipping:s,isCollectable:a}=nt(),{shippingAddress:i}=Vt(),l=a?o.map((e=>({...e,shipping_rates:e.shipping_rates.filter((e=>!Ge(e.method_id)))}))):o;if(!r)return null;const d=ze(o);if(!s&&!d)return(0,c.createElement)("p",null,(0,m.__)("Shipping options will be displayed here after entering your full shipping address.","woocommerce"));const p=Ie(i);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Kt.StoreNoticesContainer,{context:we.SHIPPING_METHODS}),t&&!d?e:(0,c.createElement)(Pc,{noResultsMessage:(0,c.createElement)(c.Fragment,null,p?(0,c.createElement)(gc,{isDismissible:!1,className:"wc-block-components-shipping-rates-control__no-results-notice",status:"warning"},(0,m.__)("There are no shipping options available. Please check your shipping address.","woocommerce")):(0,m.__)("Add a shipping address to view shipping options.","woocommerce")),renderOption:Mr,collapsible:!1,shippingRates:l,isLoadingRates:n,context:"woocommerce/checkout"}))};o(8425);const Br={...go({defaultTitle:(0,m.__)("Shipping options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}};o(2104),(0,l.registerBlockType)("woocommerce/checkout-shipping-methods-block",{icon:{src:(0,c.createElement)(i.Z,{icon:vr.Z,className:"wc-block-editor-components-block-icon"})},attributes:Br,edit:({attributes:e,setAttributes:t})=>{const o=(0,v.getSetting)("globalShippingMethods"),r=(0,v.getSetting)("activeShippingZones"),{showShippingMethods:s}=jt();return s?(0,c.createElement)(Ht,{attributes:e,setAttributes:t,className:n()("wc-block-checkout__shipping-option",null==e?void 0:e.className)},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Shipping Calculations","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Options that control shipping can be managed in your store settings.","woocommerce")),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping&section=options`},(0,m.__)("Manage shipping options","woocommerce"))," "),o.length>0&&(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Methods","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("The following shipping integrations are active on your store.","woocommerce")),o.map((e=>(0,c.createElement)(Oc,{key:e.id,href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping&section=${e.id}`,title:e.title,description:e.description}))),(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping`},(0,m.__)("Manage shipping methods","woocommerce"))),r.length&&(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Shipping Zones","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Shipping Zones can be made managed in your store settings.","woocommerce")),r.map((e=>(0,c.createElement)(Oc,{key:e.id,href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=shipping&zone_id=${e.id}`,title:e.title,description:e.description}))))),(0,c.createElement)(Jt,null,(0,c.createElement)(Or,{noShippingPlaceholder:(0,c.createElement)(Ir,null)})),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.SHIPPING_METHODS})):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});const Dr=({title:e,setSelectedOption:t,selectedOption:o,pickupLocations:r,onSelectRate:n,renderPickupLocation:s,packageCount:a})=>{const i=document.querySelectorAll(".wc-block-components-local-pickup-select .wc-block-components-radio-control").length>1;return(0,c.createElement)("div",{className:"wc-block-components-local-pickup-select"},!(!i||!e)&&(0,c.createElement)("div",null,e),(0,c.createElement)(Kt.RadioControl,{onChange:e=>{t(e),n(e)},selected:o,options:r.map((e=>s(e,a)))}))},Lr=(e,t)=>{const o=(0,v.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):e.price,r=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_location"===e.key));return t?t.value:""}return""})(e),n=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_address"===e.key));return t?t.value:""}return""})(e),s=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_details"===e.key));return t?t.value:""}return""})(e);let a=(0,c.createElement)("em",null,(0,m.__)("free","woocommerce"));return parseInt(o,10)>0&&(a=1===t?(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:(0,Qo.getCurrencyFromPriceResponse)(e),value:o}):(0,p.createInterpolateElement)(/* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */ /* translators: <price/> is the price of the package, <packageCount/> is the number of packages. These must appear in the translated string. */
(0,m._n)("<price/> x <packageCount/> package","<price/> x <packageCount/> packages",t,"woocommerce"),{price:(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:(0,Qo.getCurrencyFromPriceResponse)(e),value:o}),packageCount:(0,c.createElement)(c.Fragment,null,t)})),{value:e.rate_id,label:r?(0,fe.decodeEntities)(r):(0,fe.decodeEntities)(e.name),secondaryLabel:a,description:(0,fe.decodeEntities)(s),secondaryDescription:n?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(i.Z,{icon:Ut.Z,className:"wc-block-editor-components-block-icon"}),(0,fe.decodeEntities)(n)):void 0}},Fr=()=>{var e;const{shippingRates:t,selectShippingRate:o}=nt(),r=((null===(e=t[0])||void 0===e?void 0:e.shipping_rates)||[]).filter(We),[n,s]=(0,p.useState)((()=>{var e;return(null===(e=r.find((e=>e.selected)))||void 0===e?void 0:e.rate_id)||""})),a=(0,p.useCallback)((e=>{o(e)}),[o]),{extensions:i,receiveCart:l,...m}=Ke(),d={extensions:i,cart:m,components:{ShippingRatesControlPackage:Cc,LocalPickupSelect:Dr},renderPickupLocation:Lr};(0,p.useEffect)((()=>{!n&&r[0]&&(s(r[0].rate_id),a(r[0].rate_id))}),[a,r,n]);const u=ze(t);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Rt.ExperimentalOrderLocalPickupPackages.Slot,{...d}),(0,c.createElement)(Rt.ExperimentalOrderLocalPickupPackages,null,(0,c.createElement)(Dr,{title:t[0].name,setSelectedOption:s,onSelectRate:a,selectedOption:n,renderPickupLocation:Lr,pickupLocations:r,packageCount:u})))},Yr={...go({defaultTitle:(0,m.__)("Pickup options","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}};o(7734),(0,l.registerBlockType)("woocommerce/checkout-pickup-options-block",{icon:{src:(0,c.createElement)(i.Z,{icon:fr.Z,className:"wc-block-editor-components-block-icon"})},attributes:Yr,edit:({attributes:e,setAttributes:t})=>{const{prefersCollection:o}=(0,k.useSelect)((e=>({prefersCollection:e(ee.CHECKOUT_STORE_KEY).prefersCollection()}))),{className:r}=e;return o&&V?(0,c.createElement)(Ht,{attributes:e,setAttributes:t,className:n()("wc-block-checkout__shipping-method",r)},(0,c.createElement)(Fr,null),(0,c.createElement)(qt,{block:Rt.innerBlockAreas.PICKUP_LOCATION})):null},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()},(0,c.createElement)(zt,null))});const Ur=({className:e=""})=>{const{cartTotals:t}=Ke(),o=(0,Qo.getCurrencyFromPriceResponse)(t);return(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(Kt.Subtotal,{currency:o,values:t}))};(0,l.registerBlockType)("woocommerce/checkout-order-summary-subtotal-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(Ur,{className:t}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const Vr=({className:e=""})=>{const{cartFees:t,cartTotals:o}=Ke(),r=(0,Qo.getCurrencyFromPriceResponse)(o);return(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(Kt.TotalsFees,{currency:r,cartFees:t}))};(0,l.registerBlockType)("woocommerce/checkout-order-summary-fee-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(Vr,{className:t}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const jr=()=>{const{extensions:e,receiveCart:t,...o}=Ke(),r={extensions:e,cart:o,context:"woocommerce/checkout"};return(0,c.createElement)(Rt.ExperimentalDiscountsMeta.Slot,{...r})},Kr=({className:e=""})=>{const{cartTotals:t,cartCoupons:o}=Ke(),{removeCoupon:r,isRemovingCoupon:n}=Gc("wc/checkout"),s=(0,Qo.getCurrencyFromPriceResponse)(t);return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(Jo,{cartCoupons:o,currency:s,isRemovingCoupon:n,removeCoupon:r,values:t})),(0,c.createElement)(jr,null))};(0,l.registerBlockType)("woocommerce/checkout-order-summary-discount-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(Kr,{className:t}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const $r=({className:e=""})=>{const{cartTotals:t,cartNeedsShipping:o}=Ke();if(!o)return null;const r=(0,Qo.getCurrencyFromPriceResponse)(t);return(0,c.createElement)(Rt.TotalsWrapper,{className:e},(0,c.createElement)(Tc,{showCalculator:!1,showRateSelector:!1,values:t,currency:r,isCheckout:!0}))};(0,l.registerBlockType)("woocommerce/checkout-order-summary-shipping-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(Jt,null,(0,c.createElement)($r,{className:t})))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});var Hr=o(6855);const qr=({className:e=""})=>{const t=(0,v.getSetting)("couponsEnabled",!0),{applyCoupon:o,isApplyingCoupon:r}=Gc("wc/checkout");return t?(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(Go,{onSubmit:o,isLoading:r})):null};(0,l.registerBlockType)("woocommerce/checkout-order-summary-coupon-form-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Hr.Z,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(Jt,null,(0,c.createElement)(qr,{className:t})))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const zr=({className:e,showRateAfterTaxName:t})=>{const{cartTotals:o}=Ke();if((0,v.getSetting)("displayCartPricesIncludingTax",!1)||parseInt(o.total_tax,10)<=0)return null;const r=(0,Qo.getCurrencyFromPriceResponse)(o);return(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(Kt.TotalsTaxes,{showRateAfterTaxName:t,currency:r,values:o}))},Zr={showRateAfterTaxName:{type:"boolean",default:(0,v.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{remove:!0,move:!1}}};(0,l.registerBlockType)("woocommerce/checkout-order-summary-taxes-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Zo,className:"wc-block-editor-components-block-icon"})},attributes:Zr,edit:({attributes:e,setAttributes:t})=>{const{className:o,showRateAfterTaxName:r}=e,n=(0,d.useBlockProps)(),s=(0,v.getSetting)("taxesEnabled"),a=(0,v.getSetting)("displayItemizedTaxes",!1),i=(0,v.getSetting)("displayCartPricesIncludingTax",!1);return(0,c.createElement)("div",{...n},(0,c.createElement)(d.InspectorControls,null,s&&a&&!i&&(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Taxes","woocommerce")},(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Show rate after tax name","woocommerce"),help:(0,m.__)("Show the percentage rate alongside each tax line in the summary.","woocommerce"),checked:r,onChange:()=>t({showRateAfterTaxName:!r})}))),(0,c.createElement)(zr,{className:o,showRateAfterTaxName:r}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})});const Wr=(0,c.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,c.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),(0,c.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"}));o(6645);const Gr=({currency:e,maxPrice:t,minPrice:o,priceClassName:r,priceStyle:s={}})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,m.sprintf)(/* translators: %1$s min price, %2$s max price */ /* translators: %1$s min price, %2$s max price */
(0,m.__)("Price between %1$s and %2$s","woocommerce"),(0,Qo.formatPrice)(o),(0,Qo.formatPrice)(t))),(0,c.createElement)("span",{"aria-hidden":!0},(0,c.createElement)(Kt.FormattedMonetaryAmount,{className:n()("wc-block-components-product-price__value",r),currency:e,value:o,style:s})," — ",(0,c.createElement)(Kt.FormattedMonetaryAmount,{className:n()("wc-block-components-product-price__value",r),currency:e,value:t,style:s}))),Xr=({currency:e,regularPriceClassName:t,regularPriceStyle:o,regularPrice:r,priceClassName:s,priceStyle:a,price:i})=>(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"screen-reader-text"},(0,m.__)("Previous price:","woocommerce")),(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("del",{className:n()("wc-block-components-product-price__regular",t),style:o},e),value:r}),(0,c.createElement)("span",{className:"screen-reader-text"},(0,m.__)("Discounted price:","woocommerce")),(0,c.createElement)(Kt.FormattedMonetaryAmount,{currency:e,renderText:e=>(0,c.createElement)("ins",{className:n()("wc-block-components-product-price__value","is-discounted",s),style:a},e),value:i})),Jr=({align:e,className:t,currency:o,format:r="<price/>",maxPrice:s,minPrice:a,price:i,priceClassName:l,priceStyle:m,regularPrice:d,regularPriceClassName:u,regularPriceStyle:h,style:_})=>{const g=n()(t,"price","wc-block-components-product-price",{[`wc-block-components-product-price--align-${e}`]:e});r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const k=d&&i&&i<d;let E=(0,c.createElement)("span",{className:n()("wc-block-components-product-price__value",l)});return k?E=(0,c.createElement)(Xr,{currency:o,price:i,priceClassName:l,priceStyle:m,regularPrice:d,regularPriceClassName:u,regularPriceStyle:h}):void 0!==a&&void 0!==s?E=(0,c.createElement)(Gr,{currency:o,maxPrice:s,minPrice:a,priceClassName:l,priceStyle:m}):i&&(E=(0,c.createElement)(Kt.FormattedMonetaryAmount,{className:n()("wc-block-components-product-price__value",l),currency:o,value:i,style:m})),(0,c.createElement)("span",{className:g,style:_},(0,p.createInterpolateElement)(r,{price:E}))};o(333);const Qr=({className:e="",disabled:t=!1,name:o,permalink:r="",target:s,rel:a,style:i,onClick:l,...m})=>{const d=n()("wc-block-components-product-name",e);if(t){const e=m;return(0,c.createElement)("span",{className:d,...e,dangerouslySetInnerHTML:{__html:(0,fe.decodeEntities)(o)}})}return(0,c.createElement)("a",{className:d,href:r,target:s,...m,dangerouslySetInnerHTML:{__html:(0,fe.decodeEntities)(o)},style:i})};var en=o(1064);o(2930);const tn=({children:e,className:t})=>(0,c.createElement)("div",{className:n()("wc-block-components-product-badge",t)},e),on=()=>(0,c.createElement)(tn,{className:"wc-block-components-product-backorder-badge"},(0,m.__)("Available on backorder","woocommerce")),cn=({image:e={},fallbackAlt:t=""})=>{const o=e.thumbnail?{src:e.thumbnail,alt:(0,fe.decodeEntities)(e.alt)||t||"Product Image"}:{src:v.PLACEHOLDER_IMG_SRC,alt:""};return(0,c.createElement)("img",{...o,alt:o.alt})},rn=({lowStockRemaining:e})=>e?(0,c.createElement)(tn,{className:"wc-block-components-product-low-stock-badge"},(0,m.sprintf)(/* translators: %d stock amount (number of items in stock for product) */ /* translators: %d stock amount (number of items in stock for product) */
(0,m.__)("%d left in stock","woocommerce"),e)):null;var nn=o(7427);o(3804);const sn=({details:e=[]})=>Array.isArray(e)?0===(e=e.filter((e=>!e.hidden))).length?null:(0,c.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,nn.o)(t)}`:"");return(0,c.createElement)("li",{key:t+(e.display||e.value),className:o},t&&(0,c.createElement)(c.Fragment,null,(0,c.createElement)("span",{className:"wc-block-components-product-details__name"},(0,fe.decodeEntities)(t),":")," "),(0,c.createElement)("span",{className:"wc-block-components-product-details__value"},(0,fe.decodeEntities)(e.display||e.value)))}))):null,an=window.wp.wordcount,ln=({source:e,maxLength:t=15,countType:o="words",className:r="",style:n={}})=>{const s=(0,p.useMemo)((()=>((e,t=15,o="words")=>{const c=(0,Bc.autop)(e);if((0,an.count)(c,o)<=t)return c;const r=(e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)})(c);return(0,an.count)(r,o)<=t?r:"words"===o?Fc(r,t):Yc(r,t,"characters_including_spaces"===o)})(e,t,o)),[e,t,o]);return(0,c.createElement)(p.RawHTML,{style:n,className:r},s)},mn=({className:e,shortDescription:t="",fullDescription:o=""})=>{const r=t||o;return r?(0,c.createElement)(ln,{className:e,source:r,maxLength:15,countType:O.wordCountType||"words"}):null};o(6021);const dn=({shortDescription:e="",fullDescription:t="",itemData:o=[],variation:r=[]})=>(0,c.createElement)("div",{className:"wc-block-components-product-metadata"},(0,c.createElement)(mn,{className:"wc-block-components-product-metadata__description",shortDescription:e,fullDescription:t}),(0,c.createElement)(sn,{details:o}),(0,c.createElement)(sn,{details:r.map((({attribute:e="",value:t})=>({key:e,value:t})))})),pn=e=>(0,Rt.mustContain)(e,"<price/>"),un=({cartItem:e})=>{const{images:t,low_stock_remaining:o,show_backorder_badge:r,name:s,permalink:a,prices:i,quantity:l,short_description:d,description:u,item_data:h,variation:_,totals:g,extensions:k}=e,{receiveCart:E,...w}=Ke(),b=(0,p.useMemo)((()=>({context:"summary",cartItem:e,cart:w})),[e,w]),y=(0,Qo.getCurrencyFromPriceResponse)(i),f=(0,Rt.applyCheckoutFilter)({filterName:"itemName",defaultValue:s,extensions:k,arg:b}),C=(0,en.Z)({amount:parseInt(i.raw_prices.regular_price,10),precision:Ce(i.raw_prices.precision)?parseInt(i.raw_prices.precision,10):i.raw_prices.precision}).convertPrecision(y.minorUnit).getAmount(),S=(0,en.Z)({amount:parseInt(i.raw_prices.price,10),precision:Ce(i.raw_prices.precision)?parseInt(i.raw_prices.precision,10):i.raw_prices.precision}).convertPrecision(y.minorUnit).getAmount(),P=(0,Qo.getCurrencyFromPriceResponse)(g);let N=parseInt(g.line_subtotal,10);(0,v.getSetting)("displayCartPricesIncludingTax",!1)&&(N+=parseInt(g.line_subtotal_tax,10));const T=(0,en.Z)({amount:N,precision:P.minorUnit}).getAmount(),R=(0,Rt.applyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:k,arg:b,validation:pn}),x=(0,Rt.applyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:k,arg:b,validation:pn}),A=(0,Rt.applyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:k,arg:b});return(0,c.createElement)("div",{className:n()("wc-block-components-order-summary-item",A)},(0,c.createElement)("div",{className:"wc-block-components-order-summary-item__image"},(0,c.createElement)("div",{className:"wc-block-components-order-summary-item__quantity"},(0,c.createElement)(Kt.Label,{label:l.toString(),screenReaderLabel:(0,m.sprintf)(/* translators: %d number of products of the same type in the cart */ /* translators: %d number of products of the same type in the cart */
(0,m._n)("%d item","%d items",l,"woocommerce"),l)})),(0,c.createElement)(cn,{image:t.length?t[0]:{},fallbackAlt:f})),(0,c.createElement)("div",{className:"wc-block-components-order-summary-item__description"},(0,c.createElement)(Qr,{disabled:!0,name:f,permalink:a}),(0,c.createElement)(Jr,{currency:y,price:S,regularPrice:C,className:"wc-block-components-order-summary-item__individual-prices",priceClassName:"wc-block-components-order-summary-item__individual-price",regularPriceClassName:"wc-block-components-order-summary-item__regular-individual-price",format:R}),r?(0,c.createElement)(on,null):!!o&&(0,c.createElement)(rn,{lowStockRemaining:o}),(0,c.createElement)(dn,{shortDescription:d,fullDescription:u,itemData:h,variation:_})),(0,c.createElement)("span",{className:"screen-reader-text"},(0,m.sprintf)(/* translators: %1$d is the number of items, %2$s is the item name and %3$s is the total price including the currency symbol. */ /* translators: %1$d is the number of items, %2$s is the item name and %3$s is the total price including the currency symbol. */
(0,m._n)("Total price for %1$d %2$s item: %3$s","Total price for %1$d %2$s items: %3$s",l,"woocommerce"),l,f,(0,Qo.formatPrice)(T,P))),(0,c.createElement)("div",{className:"wc-block-components-order-summary-item__total-price","aria-hidden":"true"},(0,c.createElement)(Jr,{currency:P,format:x,price:T})))};o(3086);const hn=({cartItems:e=[]})=>{const{isLarge:t,hasContainerWidth:o}=(0,p.useContext)(h);return o?(0,c.createElement)(Kt.Panel,{className:"wc-block-components-order-summary",initialOpen:t,hasBorder:!1,title:(0,c.createElement)("span",{className:"wc-block-components-order-summary__button-text"},(0,m.__)("Order summary","woocommerce"))},(0,c.createElement)("div",{className:"wc-block-components-order-summary__content"},e.map((e=>(0,c.createElement)(un,{key:e.key,cartItem:e}))))):null},gn=({className:e})=>{const{cartItems:t}=Ke();return(0,c.createElement)(Kt.TotalsWrapper,{className:e},(0,c.createElement)(hn,{cartItems:t}))};(0,l.registerBlockType)("woocommerce/checkout-order-summary-cart-items-block",{icon:{src:(0,c.createElement)(i.Z,{icon:Wr,className:"wc-block-editor-components-block-icon"})},edit:({attributes:e})=>{const{className:t}=e,o=(0,d.useBlockProps)();return(0,c.createElement)("div",{...o},(0,c.createElement)(gn,{className:t}))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save()})}),o(7867);var kn=o(9630);const En=(e,t=!0)=>{t?window.document.body.classList.add(e):window.document.body.classList.remove(e)},wn=({attributes:e,setAttributes:t})=>{const{hasDarkControls:o}=e;return(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Style","woocommerce")},(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Dark mode inputs","woocommerce"),help:(0,m.__)("Inputs styled specifically for use on dark background colors.","woocommerce"),checked:o,onChange:()=>t({hasDarkControls:!o})})))};o(4413);const bn=(e,t)=>{const[o,c]=(0,p.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,p.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,c]},yn=[],vn=({block:e})=>{const[t,o]=(e=>{const[t,o]=bn("wc-blocks_dismissed_sidebar_compatibility_notices",yn),[c,r]=(0,p.useState)(!1),n=t.includes(e);return(0,p.useEffect)((()=>{r(!n)}),[n]),[c,()=>{const c=new Set(t);c.add(e),o([...c])}]})(e),r=(0,p.createInterpolateElement)((0,m.__)("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,c.createElement)(Tt.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/#section-3"})});return(0,c.createElement)(Tt.Notice,{onRemove:o,className:n()(["wc-blocks-sidebar-compatibility-notice",{"is-hidden":!t}])},r)};function fn(){const e=(0,m.__)("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,c.createElement)(Tt.Notice,{className:"wc-blocks-no-payment-methods-notice",status:"warning",spokenMessage:e,isDismissible:!1},(0,c.createElement)("div",{className:"wc-blocks-no-payment-methods-notice__content"},e," ",(0,c.createElement)(Tt.ExternalLink,{href:`${v.ADMIN_URL}admin.php?page=wc-settings&tab=checkout`},(0,m.__)("Configure Payment Methods","woocommerce"))))}o(9245);const Cn=window.wp.editor,Sn=window.wp.coreData;function Pn({block:e}){const t="checkout"===e?D:Y,o="checkout"===e?"woocommerce_checkout_page_id":"woocommerce_cart_page_id",{saveEntityRecord:r}=(0,k.useDispatch)(Sn.store),{editPost:n,savePost:s}=(0,k.useDispatch)(Cn.store),{slug:a,postPublished:i,currentPostId:l}=(0,k.useSelect)((o=>{var c;const{getEntityRecord:r}=o(Sn.store),{isCurrentPostPublished:n,getCurrentPostId:s}=o(Cn.store);return{slug:(null===(c=r("postType","page",t))||void 0===c?void 0:c.slug)||e,postPublished:n(),currentPostId:s()}}),[]),[d,u]=(0,p.useState)("pristine"),h=(0,p.useCallback)((()=>{u("updating"),Promise.resolve().then((()=>yt()({path:`/wc/v3/settings/advanced/${o}`,method:"GET"}))).catch((e=>{"rest_setting_setting_invalid"===e.code&&u("error")})).then((()=>{if(!i)return n({status:"publish"}),s()})).then((()=>yt()({path:`/wc/v3/settings/advanced/${o}`,method:"POST",data:{value:l.toString()}}))).then((()=>{if(0!==t)return r("postType","page",{id:t,slug:`${a}-2`})})).then((()=>n({slug:a}))).then((()=>s())).then((()=>u("updated")))}),[i,n,s,o,l,t,r,a]);let _;return _="checkout"===e?(0,p.createInterpolateElement)((0,m.__)("If you would like to use this block as your default checkout, <a>update your page settings</a>.","woocommerce"),{a:(0,c.createElement)("a",{href:"#",onClick:h},(0,m.__)("update your page settings","woocommerce"))}):(0,p.createInterpolateElement)((0,m.__)("If you would like to use this block as your default cart, <a>update your page settings</a>.","woocommerce"),{a:(0,c.createElement)("a",{href:"#",onClick:h},(0,m.__)("update your page settings","woocommerce"))}),"string"==typeof pagenow&&"site-editor"===pagenow||l===t||"dismissed"===d?null:(0,c.createElement)(Tt.Notice,{className:"wc-default-page-notice",status:"updated"===d?"success":"info",onRemove:()=>u("dismissed"),spokenMessage:"updated"===d?(0,m.__)("Page settings updated","woocommerce"):_},"updated"===d?(0,m.__)("Page settings updated","woocommerce"):(0,c.createElement)(c.Fragment,null,(0,c.createElement)("p",null,_)))}o(4828);var Nn=o(7642);const Tn=[],Rn=window.wp.notices;var xn=o(5146);const An=!1,In=o.n(xn)()("wc-admin:tracks");function Mn(e,t){return In("recordevent %s %o","wcadmin_"+e,t,{_tqk:window._tkq,shouldRecord:!(An||!window._tkq||!window.wcTracks||!window.wcTracks.isEnabled)}),!(!window.wcTracks||"function"!=typeof window.wcTracks.recordEvent)&&(An?(window.wcTracks.validateEvent(e,t),!1):void window.wcTracks.recordEvent(e,t))}const On=({blocks:e,findCondition:t})=>{for(const o of e){if(t(o))return o;if(o.innerBlocks){const e=On({blocks:o.innerBlocks,findCondition:t});if(e)return e}}},Bn=({blockType:e="woocommerce/cart"})=>"woocommerce/cart"===e?(0,c.createElement)("p",null,(0,m.__)("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,c.createElement)(c.Fragment,null,(0,c.createElement)("p",null,(0,m.__)("If you continue, the checkout block will be replaced with the classic experience powered by shortcodes. This means that you may lose:","woocommerce")),(0,c.createElement)("ul",{className:"cross-list"},(0,c.createElement)("li",null,(0,m.__)("Customizations and updates to the block","woocommerce")),(0,c.createElement)("li",null,(0,m.__)("Additional local pickup options created for the new checkout","woocommerce"))));function Dn({block:e,clientId:t}){const{createInfoNotice:o}=(0,k.useDispatch)(Rn.store),{replaceBlock:r,selectBlock:n}=(0,k.useDispatch)(d.store),[s,a]=(0,p.useState)(!1),i=()=>a(!1),{undo:u}=(0,k.useDispatch)(Sn.store),h="woocommerce/cart"===e?(0,m.__)("Switch to classic cart","woocommerce"):(0,m.__)("Switch to classic checkout","woocommerce"),_="woocommerce/cart"===e?(0,m.__)("Switched to classic cart.","woocommerce"):(0,m.__)("Switched to classic checkout.","woocommerce"),{getBlocks:g}=(0,k.useSelect)((e=>({getBlocks:e(d.store).getBlocks})),[]),E=()=>{u(),Mn("switch_to_classic_shortcode_undo",{shortcode:"woocommerce/checkout"===e?"checkout":"cart"})};return(0,c.createElement)(c.Fragment,null,(0,c.createElement)(Tt.Button,{variant:"secondary",onClick:()=>{Mn("switch_to_classic_shortcode_click",{shortcode:"woocommerce/checkout"===e?"checkout":"cart"}),a(!0)}},h),s&&(0,c.createElement)(Tt.Modal,{size:"medium",title:h,onRequestClose:i,className:"wc-blocks-switch-to-classic-shortcode-modal-content"},(0,c.createElement)(Bn,{blockType:e}),(0,c.createElement)(Tt.TabbableContainer,{className:"wc-blocks-switch-to-classic-shortcode-modal-actions"},(0,c.createElement)(Tt.Button,{variant:"primary",isDestructive:!0,onClick:()=>{r(t,(0,l.createBlock)("woocommerce/classic-shortcode",{shortcode:"woocommerce/checkout"===e?"checkout":"cart"})),Mn("switch_to_classic_shortcode_confirm",{shortcode:"woocommerce/checkout"===e?"checkout":"cart"}),(()=>{const e=On({blocks:g(),findCondition:e=>"woocommerce/classic-shortcode"===e.name});e&&n(e.clientId)})(),o(_,{actions:[{label:(0,m.__)("Undo","woocommerce"),onClick:E}],type:"snackbar"}),i()}},(0,m.__)("Switch","woocommerce"))," ",(0,c.createElement)(Tt.Button,{variant:"secondary",onClick:()=>{Mn("switch_to_classic_shortcode_cancel",{shortcode:"woocommerce/checkout"===e?"checkout":"cart"}),i()}},(0,m.__)("Cancel","woocommerce")))))}function Ln({toggleDismissedStatus:e,block:t,clientId:o}){const[r,n,s,a]=(e=>{const[t,o,c]=(()=>{const e={};(0,v.getSetting)("incompatibleExtensions")&&(0,v.getSetting)("incompatibleExtensions").forEach((t=>{e[t.id]=t.title}));const t=Object.keys(e),o=t.length;return[e,t,o]})(),[r,n,s]=(()=>{const{incompatiblePaymentMethods:e}=(0,k.useSelect)((e=>{const{getIncompatiblePaymentMethods:t}=e(or);return{incompatiblePaymentMethods:t()}}),[]),t=Object.keys(e);return[e,t,t.length]})(),a={...t,...r},i=[...o,...n],l=c+s,[m,d]=bn("wc-blocks_dismissed_incompatible_extensions_notices",Tn),[u,h]=(0,p.useState)(!1),_=m.some((t=>{return Object.keys(t).includes(e)&&(o=t[e],c=i,o.length===c.length&&new Set([...o,...c]).size===o.length);var o,c})),g=0===l||_;return(0,p.useEffect)((()=>{h(!g),g||_||d((t=>t.reduce(((t,o)=>(Object.keys(o).includes(e)||t.push(o),t)),[])))}),[g,_,d,e]),[u,()=>{const t=new Set(m);t.add({[e]:i}),d([...t])},(E=a,Object.fromEntries(Object.entries(E).sort((([,e],[,t])=>e.localeCompare(t))))),l];var E})(t);if((0,p.useEffect)((()=>{e(!r)}),[r,e]),!r)return null;const l=(0,c.createElement)(c.Fragment,null,a>1?(0,p.createInterpolateElement)((0,m.__)("Some active extensions do not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),{a:(0,c.createElement)(Tt.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/"})}):(0,p.createInterpolateElement)((0,m.sprintf)(
// translators: %s is the name of the extension.
// translators: %s is the name of the extension.
(0,m.__)("<strong>%s</strong> does not yet support this block. This may impact the shopper experience. <a>Learn more</a>","woocommerce"),Object.values(s)[0]),{strong:(0,c.createElement)("strong",null),a:(0,c.createElement)(Tt.ExternalLink,{href:"https://woocommerce.com/document/cart-checkout-blocks-support-status/"})})),d=Object.entries(s),u=d.length-2;return(0,c.createElement)(Tt.Notice,{className:"wc-blocks-incompatible-extensions-notice",status:"warning",onRemove:n,spokenMessage:l},(0,c.createElement)("div",{className:"wc-blocks-incompatible-extensions-notice__content"},(0,c.createElement)(i.Z,{className:"wc-blocks-incompatible-extensions-notice__warning-icon",icon:(0,c.createElement)(Mc,null)}),(0,c.createElement)("div",null,(0,c.createElement)("p",null,l),a>1&&(0,c.createElement)("ul",null,d.slice(0,2).map((([e,t])=>(0,c.createElement)("li",{key:e,className:"wc-blocks-incompatible-extensions-notice__element"},t)))),d.length>2&&(0,c.createElement)("details",null,(0,c.createElement)("summary",null,(0,c.createElement)("span",null,(0,m.sprintf)(
// translators: %s is the number of incompatible extensions.
// translators: %s is the number of incompatible extensions.
(0,m._n)("%s more incompatibility","%s more incompatibilites",u,"woocommerce"),u)),(0,c.createElement)(i.Z,{icon:Nn.Z})),(0,c.createElement)("ul",null,d.slice(2).map((([e,t])=>(0,c.createElement)("li",{key:e,className:"wc-blocks-incompatible-extensions-notice__element"},t))))),(0,c.createElement)(Dn,{block:t,clientId:o}))))}o(8861),o(9781);var Fn=o(6554);o(1612);const Yn=({text:e,title:t=(0,m.__)("Feedback?","woocommerce"),url:o})=>{const[r,n]=(0,p.useState)(!1);return(0,p.useEffect)((()=>{n(!0)}),[]),(0,c.createElement)(c.Fragment,null,r&&(0,c.createElement)("div",{className:"wc-block-feedback-prompt"},(0,c.createElement)(i.Z,{icon:Fn.Z}),(0,c.createElement)("h2",{className:"wc-block-feedback-prompt__title"},t),(0,c.createElement)("p",{className:"wc-block-feedback-prompt__text"},e),(0,c.createElement)("a",{href:o,className:"wc-block-feedback-prompt__link",rel:"noreferrer noopener",target:"_blank"},(0,m.__)("Give us your feedback.","woocommerce"),(0,c.createElement)(i.Z,{icon:Ac.Z,size:16}))))},Un=()=>(0,c.createElement)(Yn,{text:(0,m.__)("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"}),Vn=(0,u.createHigherOrderComponent)((e=>t=>{const{clientId:o,name:r,isSelected:n}=t,[s,a]=(0,p.useState)(!0),{isCart:i,isCheckout:l,isPaymentMethodsBlock:m,hasPaymentMethods:u,parentId:h}=(0,k.useSelect)((e=>{const{getBlockParentsByBlockName:t,getBlockName:c}=e(d.store),r=t(o,["woocommerce/cart","woocommerce/checkout"]).reduce(((e,t)=>(e[c(t)]=t,e)),{}),n=c(o),s=Object.keys(r).includes("woocommerce/cart"),a=Object.keys(r).includes("woocommerce/checkout"),i="woocommerce/cart"===n||s,l=i?"woocommerce/cart":"woocommerce/checkout";return{isCart:i,isCheckout:"woocommerce/checkout"===n||a,parentId:n===l?o:r[l],isPaymentMethodsBlock:"woocommerce/checkout-payment-block"===n,hasPaymentMethods:e(ee.PAYMENT_STORE_KEY).paymentMethodsInitialized()&&Object.keys(e(ee.PAYMENT_STORE_KEY).getAvailablePaymentMethods()).length>0}}));return r.startsWith("woocommerce/")&&n&&(i||l)?(0,c.createElement)(c.Fragment,null,(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Ln,{toggleDismissedStatus:e=>{a(e)},block:i?"woocommerce/cart":"woocommerce/checkout",clientId:h}),(0,c.createElement)(Pn,{block:l?"checkout":"cart"}),s?(0,c.createElement)(vn,{block:l?"checkout":"cart"}):null,m&&!u&&(0,c.createElement)(fn,null),(0,c.createElement)(Un,null)),(0,c.createElement)(e,{key:"edit",...t})):(0,c.createElement)(e,{key:"edit",...t})}),"withSidebarNotices");(0,ct.hasFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice")||(0,ct.addFilter)("editor.BlockEdit","woocommerce/add/sidebar-compatibility-notice",Vn,11),(0,ct.hasFilter)("blocks.registerBlockType","core/lock/addAttribute")||(0,k.subscribe)((()=>{var e,t,o,c;const r=(0,k.select)(d.store);if(!r)return;const n=r.getSelectedBlock();n&&(En("wc-lock-selected-block--remove",!(null==n||null===(e=n.attributes)||void 0===e||null===(t=e.lock)||void 0===t||!t.remove)),En("wc-lock-selected-block--move",!(null==n||null===(o=n.attributes)||void 0===o||null===(c=o.lock)||void 0===c||!c.move)))}));const jn=["woocommerce/checkout-fields-block","woocommerce/checkout-totals-block"],Kn={hasDarkControls:{type:"boolean",default:(0,v.getSetting)("hasDarkEditorStyleSupport",!1)},showRateAfterTaxName:{type:"boolean",default:(0,v.getSetting)("displayCartPricesIncludingTax",!1)}},$n={showOrderNotes:{type:"boolean",default:!0},showPolicyLinks:{type:"boolean",default:!0},showReturnToCart:{type:"boolean",default:!0},cartPageId:{type:"number",default:0}},Hn=JSON.parse('{"name":"woocommerce/checkout","version":"1.0.0","title":"Checkout","description":"Display a checkout form so your customers can submit orders.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"align":["wide"],"html":false,"multiple":false},"example":{"attributes":{"isPreview":true},"viewportWidth":800},"attributes":{"isPreview":{"type":"boolean","default":false,"save":false},"showCompanyField":{"type":"boolean","default":false},"requireCompanyField":{"type":"boolean","default":false},"showApartmentField":{"type":"boolean","default":true},"showPhoneField":{"type":"boolean","default":true},"requirePhoneField":{"type":"boolean","default":false},"align":{"type":"string","default":"wide"}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}'),qn={icon:{src:(0,c.createElement)(i.Z,{icon:a,className:"wc-block-editor-components-block-icon"})},attributes:{...Hn.attributes,...Kn,...$n},edit:({clientId:e,attributes:t,setAttributes:o})=>{const{showCompanyField:r,requireCompanyField:s,showApartmentField:a,showPhoneField:i,requirePhoneField:u,showOrderNotes:h,showPolicyLinks:_,showReturnToCart:E,showRateAfterTaxName:w,cartPageId:y,isPreview:v=!1}=t,f=(0,p.useRef)((0,Te.getQueryArg)(window.location.href,"focus"));(0,p.useEffect)((()=>{"checkout"!==f.current||(0,k.select)("core/block-editor").hasSelectedBlock()||((0,k.dispatch)("core/block-editor").selectBlock(e),(0,k.dispatch)("core/interface").enableComplementaryArea("core/edit-site","edit-site/block-inspector"))}),[e]);const C=e=>{const c={};c[e]=!t[e],o(c)},S=((e={})=>{const t=(0,p.useRef)(),o=(0,d.useBlockProps)({ref:t,...e});return(({ref:e})=>{const t=(0,ct.hasFilter)("blocks.registerBlockType","core/lock/addAttribute"),o=e.current;(0,p.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!==kn.BACKSPACE&&t!==kn.DELETE)return;if((0,Wt.isTextField)(o))return;const c=o;if(void 0===c.dataset.block)return;const r=(e=>{var t,o,c,r,n;if(!e)return!1;const{getBlock:s}=(0,k.select)(d.store),a=s(e);if("boolean"==typeof(null==a||null===(t=a.attributes)||void 0===t||null===(o=t.lock)||void 0===o?void 0:o.remove))return a.attributes.lock.remove;const i=(0,l.getBlockType)(a.name);var m,p,u;return"boolean"==typeof(null==i||null===(c=i.attributes)||void 0===c||null===(r=c.lock)||void 0===r||null===(n=r.default)||void 0===n?void 0:n.remove)&&(null==i||null===(m=i.attributes)||void 0===m||null===(p=m.lock)||void 0===p||null===(u=p.default)||void 0===u?void 0:u.remove)})(c.dataset.block);r&&(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation())}}),[o,t])})({ref:t}),o})();return(0,c.createElement)("div",{...S},(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(wn,{attributes:t,setAttributes:o})),(0,c.createElement)(b,{isPreview:v,previewData:{previewCart:ot,previewSavedPaymentMethods:Nt}},(0,c.createElement)(Rt.SlotFillProvider,null,(0,c.createElement)(Pt,null,(0,c.createElement)(g,{className:n()("wc-block-checkout",{"has-dark-controls":t.hasDarkControls})},(0,c.createElement)(Mt.Provider,{value:{addressFieldControls:()=>(0,c.createElement)(d.InspectorControls,null,(0,c.createElement)(Tt.PanelBody,{title:(0,m.__)("Address Fields","woocommerce")},(0,c.createElement)("p",{className:"wc-block-checkout__controls-text"},(0,m.__)("Show or hide fields in the checkout address forms.","woocommerce")),(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Company","woocommerce"),checked:r,onChange:()=>C("showCompanyField")}),r&&(0,c.createElement)(Tt.CheckboxControl,{label:(0,m.__)("Require company name?","woocommerce"),checked:s,onChange:()=>C("requireCompanyField"),className:"components-base-control--nested"}),(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Apartment, suite, etc.","woocommerce"),checked:a,onChange:()=>C("showApartmentField")}),(0,c.createElement)(Tt.ToggleControl,{label:(0,m.__)("Phone","woocommerce"),checked:i,onChange:()=>C("showPhoneField")}),i&&(0,c.createElement)(Tt.CheckboxControl,{label:(0,m.__)("Require phone number?","woocommerce"),checked:u,onChange:()=>C("requirePhoneField"),className:"components-base-control--nested"})))}},(0,c.createElement)(It.Provider,{value:{showCompanyField:r,requireCompanyField:s,showApartmentField:a,showPhoneField:i,requirePhoneField:u,showOrderNotes:h,showPolicyLinks:_,showReturnToCart:E,cartPageId:y,showRateAfterTaxName:w}},(0,c.createElement)(d.InnerBlocks,{allowedBlocks:jn,template:[["woocommerce/checkout-fields-block",{},[]],["woocommerce/checkout-totals-block",{},[]]],templateLock:"insert"}))))))))},save:()=>(0,c.createElement)("div",{...d.useBlockProps.save({className:"wc-block-checkout is-loading"})},(0,c.createElement)(d.InnerBlocks.Content,null)),transforms:{to:[{type:"block",blocks:["woocommerce/classic-shortcode"],transform:e=>(0,l.createBlock)("woocommerce/classic-shortcode",{shortcode:"checkout",align:e.align},[])}]},deprecated:[{attributes:{...Hn.attributes,...Kn,...$n},save:({attributes:e})=>(0,c.createElement)("div",{className:n()("is-loading",e.className)}),migrate:e=>{const{showOrderNotes:t,showPolicyLinks:o,showReturnToCart:c,cartPageId:r}=e;return[e,[(0,l.createBlock)("woocommerce/checkout-fields-block",{},[(0,l.createBlock)("woocommerce/checkout-express-payment-block",{},[]),(0,l.createBlock)("woocommerce/checkout-contact-information-block",{},[]),(0,l.createBlock)("woocommerce/checkout-shipping-address-block",{},[]),(0,l.createBlock)("woocommerce/checkout-billing-address-block",{},[]),(0,l.createBlock)("woocommerce/checkout-shipping-methods-block",{},[]),(0,l.createBlock)("woocommerce/checkout-payment-block",{},[]),!!t&&(0,l.createBlock)("woocommerce/checkout-order-note-block",{},[]),!!o&&(0,l.createBlock)("woocommerce/checkout-terms-block",{},[]),(0,l.createBlock)("woocommerce/checkout-actions-block",{showReturnToCart:c,cartPageId:r},[])].filter(Boolean)),(0,l.createBlock)("woocommerce/checkout-totals-block",{})]]},isEligible:(e,t)=>!t.some((e=>"woocommerce/checkout-fields-block"===e.name))}]};(0,l.registerBlockType)(Hn,qn)},8406:()=>{},1029:()=>{},3086:()=>{},6391:()=>{},3169:()=>{},2930:()=>{},3804:()=>{},6021:()=>{},7755:()=>{},313:()=>{},7099:()=>{},1691:()=>{},4970:()=>{},4554:()=>{},6968:()=>{},2750:()=>{},7368:()=>{},991:()=>{},946:()=>{},333:()=>{},6645:()=>{},906:()=>{},6115:()=>{},9660:()=>{},7277:()=>{},7586:()=>{},3658:()=>{},2262:()=>{},3820:()=>{},1165:()=>{},2455:()=>{},9768:()=>{},8659:()=>{},56:()=>{},7734:()=>{},6523:()=>{},8425:()=>{},1665:()=>{},2104:()=>{},8054:()=>{},2364:()=>{},7450:()=>{},7867:()=>{},4828:()=>{},6950:()=>{},1612:()=>{},9781:()=>{},9245:()=>{},4413:()=>{},8861:()=>{},7440:()=>{},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 c(e){var r=o[e];if(void 0!==r)return r.exports;var n=o[e]={exports:{}};return t[e].call(n.exports,n,n.exports,c),n.exports}c.m=t,e=[],c.O=(t,o,r,n)=>{if(!o){var s=1/0;for(m=0;m<e.length;m++){for(var[o,r,n]=e[m],a=!0,i=0;i<o.length;i++)(!1&n||s>=n)&&Object.keys(c.O).every((e=>c.O[e](o[i])))?o.splice(i--,1):(a=!1,n<s&&(s=n));if(a){e.splice(m--,1);var l=r();void 0!==l&&(t=l)}}return t}n=n||0;for(var m=e.length;m>0&&e[m-1][2]>n;m--)e[m]=e[m-1];e[m]=[o,r,n]},c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var o in t)c.o(t,o)&&!c.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.j=4231,(()=>{var e={4231:0};c.O.j=t=>0===e[t];var t=(t,o)=>{var r,n,[s,a,i]=o,l=0;if(s.some((t=>0!==e[t]))){for(r in a)c.o(a,r)&&(c.m[r]=a[r]);if(i)var m=i(c)}for(t&&t(o);l<s.length;l++)n=s[l],c.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return c.O(m)},o=self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var r=c.O(void 0,[2869],(()=>c(7806)));r=c.O(r),((this.wc=this.wc||{}).blocks=this.wc.blocks||{}).checkout=r})();