"use strict";(self.webpackChunkwebpackWcBlocksJsonp=self.webpackChunkwebpackWcBlocksJsonp||[]).push([[7413],{15987:(e,i,t)=>{t.r(i),t.d(i,{default:()=>I});var o=t(99196),c=t(80612),s=t.n(c),n=t(80721),p=t(40711),a=t(9818),r=t(94801),l=t(93251),h=t(68752),d=t(65736),g=t(7125),m=t(46023),u=t(71704),k=t(28268),_=t(45962),w=t(69307),E=t(27865),b=t(74617),C=t(33426),T=t(21921),v=t(14684);t(96483);const S={hidden:!0,message:(0,d.__)("Shipping options are not available","woocommerce")},x=({checked:e,rate:i,showPrice:t,showIcon:c,toggleText:n,multiple:p})=>(0,o.createElement)(g.Z,{value:"pickup",className:s()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"pickup"===e})},!0===c&&(0,o.createElement)(u.Z,{icon:k.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},n),!0===t&&(0,o.createElement)(C.S,{multiple:p,minRate:i.min,maxRate:i.max})),R=({checked:e,rate:i,showPrice:t,showIcon:c,toggleText:n,shippingCostRequiresAddress:p=!1})=>{const l=(0,a.useSelect)((e=>e(r.CART_STORE_KEY).getShippingRates().some((({shipping_rates:e})=>!e.every(E.J3))))),h=p&&(()=>{const e=(0,a.select)("wc/store/validation"),i=e.getValidationError("shipping_state"),t=e.getValidationError("shipping_address_1"),o=e.getValidationError("shipping_country"),c=e.getValidationError("shipping_postcode");return[e.getValidationError("shipping_city"),i,t,o,c].some((e=>void 0!==e))})()&&!l,m=void 0!==i.min&&void 0!==i.max,{setValidationErrors:k,clearValidationError:b}=(0,a.useDispatch)(r.VALIDATION_STORE_KEY);(0,w.useEffect)((()=>{"shipping"!==e||m?b("shipping-rates-error"):k({"shipping-rates-error":S})}),[e,b,m,k]);const T=void 0===i.min||h?(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-price"},(0,d.__)("calculated with an address","woocommerce")):(0,o.createElement)(C.S,{minRate:i.min,maxRate:i.max});return(0,o.createElement)(g.Z,{value:"shipping",className:s()("wc-block-checkout__shipping-method-option",{"wc-block-checkout__shipping-method-option--selected":"shipping"===e})},!0===c&&(0,o.createElement)(u.Z,{icon:_.Z,size:28,className:"wc-block-checkout__shipping-method-option-icon"}),(0,o.createElement)("span",{className:"wc-block-checkout__shipping-method-option-title"},n),!0===t&&T)},P=({checked:e,onChange:i,showPrice:t,showIcon:c,localPickupText:s,shippingText:n})=>{var p,a;const{shippingRates:r}=(0,l.V)(),h=(0,b.getSetting)("shippingCostRequiresAddress",!1);return(0,o.createElement)(m.Z,{id:"shipping-method",className:"wc-block-checkout__shipping-method-container",label:"options",onChange:i,checked:e},(0,o.createElement)(R,{checked:e,rate:(0,T.i)(null===(p=r[0])||void 0===p?void 0:p.shipping_rates),showPrice:t,showIcon:c,shippingCostRequiresAddress:h,toggleText:n||v.Z}),(0,o.createElement)(x,{checked:e,rate:(0,T.B)(null===(a=r[0])||void 0===a?void 0:a.shipping_rates),multiple:r.length>1,showPrice:t,showIcon:c,toggleText:s||v.$}))};var N=t(43609);const I=(0,n.withFilteredAttributes)(N.Z)((({title:e,description:i,showStepNumber:t,children:c,className:n,showPrice:d,showIcon:g,shippingText:m,localPickupText:u})=>{const{checkoutIsProcessing:k,prefersCollection:_}=(0,a.useSelect)((e=>{const i=e(r.CHECKOUT_STORE_KEY);return{checkoutIsProcessing:i.isProcessing(),prefersCollection:i.prefersCollection()}})),{setPrefersCollection:w}=(0,a.useDispatch)(r.CHECKOUT_STORE_KEY),{shippingRates:E,needsShipping:b,hasCalculatedShipping:C,isCollectable:T}=(0,l.V)();return b&&C&&E&&T&&h.oC?(0,o.createElement)(p.FormStep,{id:"shipping-method",disabled:k,className:s()("wc-block-checkout__shipping-method",n),title:e,description:i,showStepNumber:t},(0,o.createElement)(P,{checked:_?"pickup":"shipping",onChange:e=>{w("pickup"===e)},showPrice:d,showIcon:g,localPickupText:u,shippingText:m}),c):null}))}}]);