"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),p=c(9292),u=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,u.__)("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,u._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=()=>{var e;const{shippingRates:t,selectShippingRate:c}=(0,m.m)(),r=((null===(e=t[0])||void 0===e?void 0:e.shipping_rates)||[]).filter(b.J_),[a,o]=(0,d.useState)((()=>{var e;return(null===(e=r.find((e=>e.selected)))||void 0===e?void 0:e.rate_id)||""})),i=(0,d.useCallback)((e=>{c(e)}),[c]),{extensions:l,receiveCart:s,...p}=(0,k.V)(),u={extensions:l,cart:p,components:{ShippingRatesControlPackage:S.A,LocalPickupSelect:v.G},renderPickupLocation:w};(0,d.useEffect)((()=>{!a&&r[0]&&(o(r[0].rate_id),i(r[0].rate_id))}),[i,r,a]);const _=(0,b.T4)(t);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:t[0].name,setSelectedOption:o,onSelectRate:i,selectedOption:a,renderPickupLocation:w,pickupLocations:r,packageCount:_})))},F={...(0,c(9017).A)({defaultTitle:(0,u.__)("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:u,prefersCollection:d}=(0,i.useSelect)((e=>{const t=e(l.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:t.isProcessing(),prefersCollection:t.prefersCollection()}})),{showFormStepNumbers:m}=(0,p.Oy)();return d&&s.F7?(0,n.createElement)(o.FormStep,{id:"pickup-options",disabled:u,className:(0,r.A)("wc-block-checkout__pickup-options",a),title:e,description:t,showStepNumber:m},(0,n.createElement)(P,null),c):null}))}}]);