"use strict";(self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp=self.webpackChunkwebpackWcBlocksCartCheckoutFrontendJsonp||[]).push([[3024],{9017:(e,t,c)=>{c.d(t,{A:()=>r});var n=c(7723);const r=({defaultTitle:e=(0,n.__)("Step","woocommerce"),defaultDescription:t=(0,n.__)("Step description text.","woocommerce"),defaultShowStepNumber:c=!0})=>({title:{type:"string",default:e},description:{type:"string",default:t},showStepNumber:{type:"boolean",default:c}})},179:(e,t,c)=>{c.r(t),c.d(t,{default:()=>x});var n=c(1609),r=c(851),a=c(1616),o=c(4656),i=c(7143),l=c(7594),s=c(812),u=c(9292),p=c(7723),d=c(6087),m=c(4958),k=c(8509),_=c(910),f=c(8537),g=c(5703),E=c(7104),C=c(601),b=c(8531),h=c(1e3),v=c(8842),y=c(2365),S=c(4452);const w=(e,t)=>{const c=(0,g.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),a=(e=>{if(null!=e&&e.meta_data){const t=e.meta_data.find((e=>"pickup_address"===e.key));return t?t.value:""}return""})(e),i=(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 l=(0,n.createElement)("em",null,(0,p.__)("free","woocommerce"));return parseInt(c,10)>0&&(l=1===t?(0,n.createElement)(o.FormattedMonetaryAmount,{currency:(0,_.getCurrencyFromPriceResponse)(e),value:c}):(0,d.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,p._n)("<price/> x <packageCount/> package","<price/> x <packageCount/> packages",t,"woocommerce"),{price:(0,n.createElement)(o.FormattedMonetaryAmount,{currency:(0,_.getCurrencyFromPriceResponse)(e),value:c}),packageCount:(0,n.createElement)(n.Fragment,null,t)})),{value:e.rate_id,label:r?(0,f.decodeEntities)(r):(0,f.decodeEntities)(e.name),secondaryLabel:l,description:a?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(E.A,{icon:C.A,className:"wc-block-editor-components-block-icon"}),(0,f.decodeEntities)(a)):void 0,secondaryDescription:(0,n.createElement)(y.A,{maxLines:2},(0,f.decodeEntities)(i))}},P=()=>{const{shippingRates:e,selectShippingRate:t}=(0,m.m)(),c=(0,d.useMemo)((()=>{var t;return((null===(t=e[0])||void 0===t?void 0:t.shipping_rates)||[]).filter(b.J_)}),[e]),[r,a]=(0,d.useState)((()=>{var e;return(null===(e=c.find((e=>e.selected)))||void 0===e?void 0:e.rate_id)||""})),o=(0,d.useCallback)((e=>{t(e)}),[t]),{extensions:i,receiveCart:l,...s}=(0,k.V)(),u={extensions:i,cart:s,components:{ShippingRatesControlPackage:S.A,LocalPickupSelect:v.G},renderPickupLocation:w};(0,d.useEffect)((()=>{!r&&c[0]&&r!==c[0].rate_id&&(a(c[0].rate_id),o(c[0].rate_id))}),[c,r]);const p=(0,b.T4)(e);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(h.ExperimentalOrderLocalPickupPackages.Slot,{...u}),(0,n.createElement)(h.ExperimentalOrderLocalPickupPackages,null,(0,n.createElement)(v.G,{title:e[0].name,setSelectedOption:a,onSelectRate:o,selectedOption:r,renderPickupLocation:w,pickupLocations:c,packageCount:p})))},F={...(0,c(9017).A)({defaultTitle:(0,p.__)("Pickup locations","woocommerce"),defaultDescription:""}),className:{type:"string",default:""},lock:{type:"object",default:{move:!0,remove:!0}}},x=(0,a.withFilteredAttributes)(F)((({title:e,description:t,children:c,className:a})=>{const{checkoutIsProcessing:p,prefersCollection:d}=(0,i.useSelect)((e=>{const t=e(l.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}})),{showFormStepNumbers:m}=(0,u.Oy)();return d&&s.F7?(0,n.createElement)(o.FormStep,{id:"pickup-options",disabled:p,className:(0,r.A)("wc-block-checkout__pickup-options",a),title:e,description:t,showStepNumber:m},(0,n.createElement)(P,null),c):null}))}}]);