1import{u as e,S as n,q as i,e as o,k as t,h as a,T as s,g as r,W as l}from"./2c1ab0fe.D_oO1jU7.js";import{b as d,P as c,L as p,cg as u,be as h,ch as m,bS as v,h as g,ci as _,p as y,cj as f,ck as E,cl as I,cm as C,$ as P,cn as S,bh as T,c as L,y as O,B as b,S as D,co as N,U as M,cp as k,cq as R}from"./164ad2e3.DgUUtBtV.js";import{b as A}from"./efa0389a.-R9eik6_.js";import{F as x}from"./3ca8ef7e.DT3qvctx.js";import{C as z}from"./a422df8c.CGT3eUwi.js";import{S as H}from"./31cc568e.CsDC1k63.js";import{u as j,S as B,E as U,d as w}from"./347b440c.oWH9qB5Z.js";import{O as F,co as q,bh as V,bi as $,cp as G,bj as W,Q as Y,cq as Q,G as K,_ as X}from"./4c290a1e.D9lE9kmU.js";import{P as J}from"./47b970b2.Bspt4mBz.js";function Z(){const{i18n:i,checkout:o}=F();return o.configuration.layout.isOnePage.value?null:e(n,{children:[e(d,{blockSize:"small-400"}),e(c,{children:i.translate("shipping.shipping_line_delivery_instructions")})]})}function ee({displayAddInstructionsButton:n,onPress:i}){const{i18n:o,checkout:t}=F();return t.configuration.layout.isOnePage.value?n?e(p,{onClick:i,children:o.translate("shipping.add_delivery_instructions")}):null:e(c,{children:o.translate("shipping.shipping_line_delivery_phone")})}const ne=new Set(["DELIVERY_OPTIONS_PHONE_NUMBER_REQUIRED","DELIVERY_OPTIONS_PHONE_NUMBER_DOES_NOT_MATCH_EXPECTED_PATTERN"]),ie=new Set(["DELIVERY_OPTIONS_INSTRUCTIONS_INVALID"]),oe=(e,n)=>{if("error"===e.type)for(const i of e.violations)if("UnprocessableTermViolation"===i.__typename&&n.has(i.code))return i.localizedMessage??i.nonLocalizedMessage},te={OnTop:"sqcDF",LoadingOption:"z2IIo",LoadingOptionBorderNone:"qi1py",LoadingOptionBorderFull:"pcf8k"},ae={textSize:"small",freeTextLetterCase:"uppercase"},se={};function re({id:p,type:M="ONE_TIME_PURCHASE",methods:k,loadingAdditionalShippingRates:re=!1,isInSplitCartModal:pe=!1}){const ue=v(),{i18n:he,checkout:me}=F(),ve="base",{negotiate:ge}=g(),{geolocation:_e}=_(),[ye,fe]=t(_e.country.code),{shippingAddress:Ee}=Y(),Ie=Q(),{deliveryExpectationLines:Ce,deliveryExpectationLinesLoading:Pe,status:Se}=j(),Te=y("Checkout::ShippingMethodDetails::RenderAfter"),Le=y("Checkout::ShippingMethodDetails::RenderExpanded"),[Oe]=f(M,p),be=E(),[De,Ne]=I({type:M,id:p,deliveryMethodType:be.value?"SHIPPING":void 0}),Me=o(),{setInverseGroupDeliveryMethodHandle:ke,getInverseGroupDeliveryMethodHandle:Re}=C(k,M),Ae=k.find((e=>e.handle===De)),{validated:xe,value:ze,error:He}=function(e,n="ONE_TIME_PURCHASE",t){const a=q(),s=u(n,t),{i18n:r,checkout:{wallets:l}}=F();h(i((e=>{const n=oe(e,ne);n&&(a.value=n)}),[a]));const d=o(void 0),c=l.activeSession.value?d:a;return V(s,c,(n=>{if(l.activeSession.value)return;const i=G(n);return e&&e.phoneRequired?i?void 0:r.translate("field_errors.shipping_line_phone_invalid"):void 0}),$.InvalidDeliveryMethodPhoneNumber),{value:s,error:a,validated:W(s,a,void 0)}}(Ae,M,p),{validated:je,value:Be,error:Ue}=function(e="ONE_TIME_PURCHASE",n){const o=q(),t=m(e,n);return h(i((e=>{const n=oe(e,ie);n&&(o.value=n)}),[o])),{value:t,error:o,validated:W(t,o,void 0)}}(M,p),we=me.configuration.layout.isOnePage.value,[Fe,qe]=t(!we||void 0!==je?.value);let Ve=k;Oe.includes("PICKUP_POINT")&&(Ve=Ve.filter((e=>"PickupPointLocation"===e.pickupLocation?.type&&"PickupPointLocation"===Ae?.pickupLocation?.type&&e.pickupLocation?.handle===Ae?.pickupLocation?.handle)));const $e=Ve.map((e=>Boolean(e?.deliveryPredictionEligible)));a((()=>{const{phone:e}=Ee.fields,n=e.value;!xe.value&&n&&xe.onChange(n)}),[]),a((()=>{const{countryCode:e}=Ee.fields,n=e.value;n&&fe(n)}),[Ee]);const Ge=s((()=>({state:{phone:ze,instructions:Be},errors:{phone:He,instructions:Ue}})),[ze,He,Be,Ue]),We=i((()=>{xe.clearError(),je.clearError()}),[xe,je]),{optionList:{border:Ye="full"}}=P(),Qe=i((([e=""])=>{if(We(),Ne(e),Ie.value&&null==p){const n=Re(e);ke(n)}pe?Me.value=e:(ge({include:["deliveryNext"]}),ue("shippingMethodSelected",{timestamp:new Date}))}),[Me,We,Ne,Ie,p,pe,ge,Re,ke,ue]);a((()=>{if(!pe)return void(Me.value=void 0);const e=Me.value;e&&e!==De&&k.some((n=>n.handle===e))&&Ne(e)}),[pe,k,De,Ne,Me]);const Ke=(n,i,o)=>{const t=i||o,a=Le.length>0&&!pe;return t?e(ce,{children:[e(x,{children:[i&&e(b,{children:[e(J,{label:he.translate("shipping.shipping_line_delivery_phone_label"),countryCode:ye,prefillCountryCode:!0,...xe}),e(d,{blockSize:"small-400"}),e(ee,{displayAddInstructionsButton:o&&!Fe,onPress:()=>qe(!0)})]}),o&&Fe&&e(b,{children:[e(R,{autoFocus:!0,maxLength:255,label:he.translate("shipping.optional_shipping_line_delivery_instructions_label"),rows:1,...je}),e(Z,{})]})]}),a&&e(le,{customizations:Le,isInModal:!1,handle:n})]}):a?e(le,{customizations:Le,handle:n,isInModal:!1,render:n=>e(ce,{children:n})}):null},Xe=p?`_${K(p)}`:"",Je="ONE_TIME_PURCHASE"===M?`shipping_methods${Xe}`:`${M.toLowerCase()}_shipping_methods${Xe}`,Ze=Te.length>0,en=1===Ve.length,nn=s((()=>De?[De]:[]),[De]),on=pe?ae:se;return e(N,{...Ge,children:e("div",{className:te.OnTop,children:e(z,{name:Je,title:he.translate("general.choose_shipping_method"),titleHidden:!0,values:nn,onChange:Qe,hideRadioControl:en,children:[Ve.map(((i,o)=>{const t=$e[o]||i.brandedPromise?.handle===X.BuyWithPrime,{showEstimatedDeliveryLabel:a}=S(i,Boolean(t),Ce,Pe,Se),{acceptsInstructions:s,cost:r,costAfterDiscounts:l,description:d,estimatedTimeInTransit:p,handle:u,hideDiscountedTotalOnShippingSelector:h,included:m,pickupLocation:v,phoneRequired:g}=i,_=Ce?.find((e=>e.deliveryStrategyHandle===u)),y=T({deliveryMethod:i,localDelivery:"LOCAL"===i.methodType?he.translate("shipping.local_delivery"):void 0});return e(A,{value:u,renderSelectedContentWhenCollapsed:!0,selectedContent:Ke(u,g,s)??void 0,details:e(n,{children:[t&&e(U,{deliveryMethod:i,deliveryExpectationLine:_,paragraphColor:ve}),!t&&a&&e(w,{timeInTransit:p,minDeliveryDateTime:i?.minDeliveryDateTime,maxDeliveryDateTime:i?.maxDeliveryDateTime,title:i?.deliveryPromisePresentmentTitle?.short,paragraphColor:ve}),d&&!t&&e(c,{color:ve,children:e("bdi",{children:d})}),"PickupInStoreLocation"===v?.type&&e(de,{pickupLocation:v})]}),secondaryContent:e(B,{cost:r,costAfterDiscounts:l,included:m,styleOverrides:on,preDiscountCost:h}),tertiaryContent:Ze&&e(le,{customizations:Te,handle:u,isInModal:pe,render:n=>e(L,{padding:"small-100 none none none",gap:"small-100",children:n})}),children:e(H,{methodTitle:y})},u)})),re?e("div",{className:r([te.LoadingOption,te[l("LoadingOptionBorder",Ye)]]),children:e(O,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",alignItems:"center",alignContent:"center",children:[e(b,{children:e(D,{})}),e(c,{color:"subdued",type:"small",children:he.translate("shipping.loading_progressive_rates")}
1)]})}):null]})})})}function le({customizations:n,handle:i,isInModal:o,render:t}){const a=s((()=>({handle:i,isInModal:o})),[i,o]);return e(M,{customizations:n,options:a,render:t})}function de({pickupLocation:i}){const o=k(i.address,{hiddenFields:["firstName","lastName","phone","company","countryCode","postalCode"]});return e(n,{children:[e(c,{type:"small",children:o}),e(c,{type:"small",children:i.instructions})]})}function ce({children:n}){return e(L,{gap:"large-200",children:n})}export{re as S};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.