1import{u as e,S as R,e as I,T as L,i as q,l as Le,f as B,q as G,A as se,o as Ie}from"./esnext-vendor.7EcvH7tF.js";import{l as E,b1 as ee,k as C,bj as ke,P as ge,cn as Oe,L as Re,bx as ve,a0 as j,y as k,m as ne,b as Ae,n as F,o as V,ap as Be,B as x,bW as fe,j as He,a_ as Ne,a$ as ze,f as Ge,ac as qe,ay as je,ag as ae,az as Fe,I as oe,U as re}from"./hydrate.DbBIWEk-.js";import{b as Z,a as le,C as ce}from"./Choice.BnQD4sDK.js";import{C as Ve,u as Qe}from"./localization-index.DeoiIICN.js";import{Q as D,B as Ue,S as be,b3 as We,ek as $e}from"./utilities-previous.C42MP_Mw.js";import{I as Ye}from"./ImpressionEventCapture.CTaz86gY.js";import{E as K,M as Je,d as ye,u as Ze}from"./MerchandiseModal.22QlY5ZF.js";import{u as Q,a as Ke,i as Xe,c as en,m as nn}from"./shipping-methods-consolidated-included.DMw6JHFz.js";import{B as tn,u as _e,E as sn,S as X}from"./EstimatedDeliveryContent.B0OSfbru.js";import{B as an,D as de}from"./BuyWithPrimeOrderTrackingButton.CPnRWHNY.js";import{g as Se,a as Me}from"./shipping-methods-grouping.BpmbHANr.js";import{S as on}from"./ShippingMethodSelector.CKZRAwy6.js";import{S as rn}from"./ShippingMethodRateLabel.6_DjUqL6.js";import"./app.DklQzmA_.js";import"./shared-negotiation-input-redeemable.Bd3YWCwY.js";import"./shared-permissions.DaHnWepz.js";import"./hooks-useShopPayExternalAppContext.CJygX3OQ.js";import"./utilities-publishMessage.mSFRd__c.js";import"./Checkbox.D-f3QQ5T.js";import"./ShipmentLine.BW2f9jSW.js";import"./amazon-constants.BnCZXorl.js";import"./TextArea.sjuFKAGq.js";import"./crypto-constants.BBKCG06j.js";import"./PhoneField.DwUibqcs.js";import"./components-RedirectionNotice.module.Bd2sET81.js";import"./amazon-pay-useAmazonPayPaymentLine.B67X6gPb.js";import"./hooks-useSuppressShopPayModalOnLoad.TozpD3Nk.js";function pe({summary:n}){const{transitText:i,brandedPromise:t,shipmentCountText:s}=n;return!i&&!s?null:e(C,{direction:"inline",gap:"small-300",alignItems:"center",children:[i?e(E,{color:"subdued",children:i}):null,t?e(tn,{brandedPromise:t}):null,i&&s?e(E,{color:"subdued",accessibilityVisibility:"hidden",children:ee}):null,s?e(E,{color:"subdued",children:s}):null]})}function ln({selectedShippingMethod:n}){const{i18n:i}=D(),{deliveryExpectationLines:t}=_e(),{cost:s,costAfterDiscounts:o,hideDiscountedTotalOnShippingSelector:a}=n,r=ke({deliveryMethod:n,localDelivery:n.methodType==="LOCAL"?i.translate("shipping.local_delivery"):void 0}),l=t?.find(m=>m.deliveryStrategyHandle===n.handle);return e(R,{children:[e(C,{direction:"inline",gap:"small-400",children:[e(rn,{methodTitle:r}),s&&o?e(R,{children:[ee,e(X,{cost:s,costAfterDiscounts:o,inlineDiscount:!0,preDiscountCost:a})]}):null]}),e(sn,{deliveryMethod:n,deliveryExpectationLine:l,paragraphColor:"subdued"})]})}function ue({selectedShippingMethod:n,rollupOpen:i}){const{i18n:t}=D();return i?e(ge,{color:"subdued",children:t.translate("shipping.shipping_method_title")}):e(C,{children:e(ln,{selectedShippingMethod:n})})}function cn({shippingMethods:n,type:i,id:t,displayOnly:s=!1}){const[o]=Oe({type:i,id:t}),{includedMethods:a}=Q().value,r=a.size?n.map(d=>a.has(d)?Ke(d):d):n,l=s?r[0]:r.find(({handle:d})=>d===o);return l?e(Ve.Provider,{value:!0,children:e(Z,{presentation:"base",children:s?e(ue,{selectedShippingMethod:l}):e(C,{gap:"small-400",paddingBlockStart:"small-400",children:[e(ue,{selectedShippingMethod:l,rollupOpen:!0}),e(on,{type:i,methods:r,id:t,isInSplitCartModal:!0})]})})}):null}const H=2;function dn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=I(!1),o=I(!1),{i18n:a}=D(),r=n.length,{totalQuantity:l,firstFiveQuantity:d}=L(()=>n.reduce((g,f,c)=>{const h=f.quantity??0;return g.totalQuantity+=h,c<H&&(g.firstFiveQuantity+=h),g},{totalQuantity:0,firstFiveQuantity:0}),[n]),m=a.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l}),y=()=>{if(r>H){s.value=!0;return}o.value=!0};return e(k,{gridAutoFlow:"column",gridAutoColumns:"minmax(auto, max-content)",gridTemplateColumns:"minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-100",alignItems:"center",alignContent:"center",children:[e(q,{when:o,fallback:e(R,{
1children:[e(C,{direction:"inline",gap:"small-300",children:n.slice(0,H).map(g=>e(Je,{merchandiseItem:g},g.stableId))}),e(Re,{onClick:y,children:r>H?a.translate("shipping.split_shipping_merchandise_quantity_label_additional",{quantity:l-d}):a.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l})})]}),children:e(K,{merchandise:n})}),e(ve,{heading:e(R,{children:[e(ne,{level:1,children:m}),e(Ae,{blockSize:"small-500"}),e(ge,{color:"subdued",children:i&&t?a.translate("shipping.split_shipping_merchandise_shipment_number",{number:i,total:t}):a.translate("order_summary.subscriptions")})]}),open:s.value,onHide:()=>s.value=!1,accessibilityLabel:m,children:[e(j,{}),e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gridAutoRows:"minmax(0, 1fr)",gap:"small-100",padding:"base none none none",children:e(K,{merchandise:n})})]})]})}function pn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=F(),o=Le(n.length>1),a=B(()=>V(s.value.currentDetour)),r=B(()=>o.value&&a.value);return e(q,{when:r,fallback:e(K,{merchandise:n,thumbnailSize:a.value?"small":"base",merchandiseItemGap:a.value?"small-200":"base",thumbnailContentGap:a.value?"small-200":"base"}),children:e(dn,{merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t})})}function un({line:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t,disableBorders:s=!1,heading:o}){const{id:a,type:r,methods:l,targetMerchandiseLines:d}=n,m=Be(d??[]),{currentDetour:y}=F().value,g=V(y);return e(x,{"data-delivery-line-id":a,background:"base",colorLayer:"control",border:s?"none":"base",borderRadius:s?"none":"base",children:[o&&e(R,{children:[e(x,{padding:"base",children:e(ne,{level:3,children:o})}),e(j,{accessibilityRole:"presentation"})]}),e(x,{padding:"base",children:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content) minmax(0, 1fr)",gridAutoRows:"1fr",gap:"small-100",children:[e(pn,{merchandise:m,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}),e(cn,{shippingMethods:l,type:r,id:a,displayOnly:g})]})})]})}function N({lines:n,heading:i,customNode:t,isSingleCard:s=!1,getSequence:o,showExtendedHeading:a=!1,oneTimePurchaseTotalCount:r}){const{i18n:l}=D(),d=n.length,m=F(),y=ye(),{presentsConsolidatedShipping:g}=Q().value;if(!d)return null;const f=n.map((c,h)=>{const p=!!t,M=h+1!==n.length,P=s&&(p||M),b=o(c);return e(R,{children:[e(un,{line:c,disableBorders:s,heading:(()=>{if(V(m.value.currentDetour)||y.value)return;const v=a?i:void 0;if(g)return v;const S=l.translate("shipping.split_shipping_shipment_number",{number:b});return v?`${S} ${ee} ${v}`:S})(),oneTimePurchaseIndex:h+1,oneTimePurchaseTotalCount:r},c.id??Ue()),P&&e(j,{})]},c.id)});return t&&f.push(t),e(x,{colorLayer:"control",children:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content)",gridAutoRows:"minmax(auto, max-content)",gap:"small-200",children:s?e(C,{gap:"base",children:e(x,{overflow:"hidden",border:"base",borderRadius:"base",children:f})}):e(C,{gap:"large-200",children:f})})})}function he({shippingGroupLines:n,oneTimePurchaseTotalCount:i}){const{i18n:t,shop:{name:s}}=D(),{buyWithPrimeLines:o,shipsNowLines:a,shipsLaterLines:r}=L(()=>Se(n),[n]),l=L(()=>Me(n),[n]),d=L(()=>{let h=[...o,...a,...r];return l&&(h=[...h,...l.reduce((p,[,M])=>[...p,...M],[])]),h},[o,a,r,l]),m=G(h=>d.indexOf(h)+1,[d]),y=L(()=>o.length>0?t.translate("shipping.split_shipping_shipped_by_shop",{shop_name:s}):t.translate("shipping.pre_order_ships_now"),[o.length,t,s]),g=F(),f=B(()=>V(g.value.currentDetour)),c=r.length>0||(l?l?.length>0:!1);return e(C,{gap:"large-200",children:[o.length>0&&e(N,{lines:o,getSequence:m,heading:t.translate("split_shipping.shipped_by_amazon_prime"),oneTimePurchaseTotalCount:i,customNode:e(q,{when:f,children:e(x,{padding:"small-100 base",children:e(an,{})})}),isSingleCard:!0,showExtendedHeading:c}),a.length>0&&e(N,{lines:a,getSequence:m,heading:y,oneTimePurchaseTotalCount:i,showExtendedHeading:c}),r.length>0&&e(N,{lines:r,getSequence:m,heading:t.translate("shipping.pre_order_ships_later"),oneTimePurchaseTotalCount:i,showExtendedHeading:c}),l?.map(([h,p])=>p.length>0&&e(N,{lines:p,getSequence:m,heading:t.translate("shipping.pre_order_ships_date",{date:t.formatDate(new Date(h),{timeZone:"UTC",month:"long",day:"numeric",year:"numeric"})}),oneTimePurchaseTotalCount:i,showExtendedHeading:c},h))]})}const z="more-shipping-options-modal";function hn({deliveryLines:n,openAtDeliveryLineId:i,onOpen:t,onClose:s}){const{i18n:o}=D(),a=o.translate("shipping.shipping_method_title"),r=fe(),l=se(),d=Q(),{total:m,presentsConsolidatedShipping:y}=d.value,g=I(!1),f=I(""),c=B(()=>{const{total:v,presentsConsolidatedShipping:S}=d.value;return!S||!v?null:o.translate("order_summary.shipping_total_updated_label_with_price",{totalPrice:o.formatCurrency(v.amount,{currency:v.currencyCode,form:"name"})})}),h=se(null);Ie(()=>{if(!g.value){h.current=null,f.value="";return}const v=c.value;if(!v){f.value="";return}const S=h.current;h.current=v,S&&v!==S&&(f.value=v)});const p=z,M=G(()=>{if(!i)return;Array.from(document.getElementById(p)?.querySelectorAll("[data-delivery-line-id]")??[]).find(S=>S.dataset.deliveryLineId===i)?.scrollIntoView({block:"start",behavior:"instant"})},[i,p]),P=()=>{h.current=c.peek(),f.value="",g.value=!0,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalOpen"}),t?.()},b=async()=>{await l.current,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalSave"})},_=async()=>{g.value=!1,l.current=s(),await l.current,r("moreShippingOptions",{timestamp:new Date,subEvent:"modalClose"})},T=e(He,{variant:"primary",inlineSize:"fill",command:"--hide",commandFor:p,onClick:b,children:o.translate("payment.saved_credit_cards_modal.done")});return e(ve,{heading:a,onShow:P,onAfterShow:M,onHide:_,id:p,footer:y?e(x,{background:"base",children:[e(j,{}),e(x,{paddingBlock:"base",paddingInline:"large-200",children:e(C,{gap:"base",children:[m&&e(k,{gridTemplateColumns:"1fr auto",gap:"base",children:[e(E,{type:"strong",children:o.translate("order_summary.multiple_shipping_lines_label")}),e(E,{type:"strong",translate:!1,children:o.formatCurrency(m.amount,{currency:m.currencyCode})})]}),e(x,{accessibilityVisibility:"exclusive",accessibilityRole:"status",children:f.value}),T]})})]}):void 0,padding:y?"none":"base",children:y?e(x,{paddingBlockStart:"base",paddingBlockEnd:"large-200",paddingInline:"large-200",children:e(he,{shippingGroupLine
1s:n})}):e(C,{gap:"large-200",padding:"none none large-200 none",children:[e(he,{shippingGroupLines:n}),T]})})}function mn(n,i,t){const{shop:s,i18n:o}=D(),{deliveryMacros:a}=be(),r=Ne(),{deliveryExpectationLines:l}=_e(),d=new Map,m=a.value;if(!s.marketDrivenShippingEnabled||!m?.length)return d;const{shipsLaterLines:y}=Se(n),g=Me(n),f=!!(y.length||g?.length),c=m.map(p=>{const M=new Set(Object.values(p.deliveryMethodHandles)),b=n.map(_=>({line:_,method:_.methods.find(({handle:T})=>M.has(T))})).filter(Xe);return{macro:p,resolvedMethods:b.map(({method:_})=>_).filter(_=>!!_),count:en(b).length}}),h=t>0?t===1:(c.find(({macro:p})=>p.id===i)??c[0]).count===1;for(const{macro:p,resolvedMethods:M,count:P}of c){if(P>1&&p.id===i)continue;const b=ze({selectedMethods:M,deliveryExpectationLines:l??[],deliveryPromiseText:p.deliveryPromisePresentmentTitle?.short}),_=nn(M),T=_?r(_)??void 0:void 0,v=gn({shopPromiseSummary:b,isPreOrder:f,formattedTimeInTransit:T,fallbackText:p.deliveryPromisePresentmentTitle?.long}),S=h&&P>1?o.translate("shipping.split_shipping_multiple_shipment_quantity_label",{quantity:P}):void 0;d.set(p.id,{...v&&{transitText:v},...b?.brandedPromise&&{brandedPromise:b.brandedPromise},...S&&{shipmentCountText:S}})}return d}function gn({shopPromiseSummary:n,isPreOrder:i,formattedTimeInTransit:t,fallbackText:s}){if(n)return n.deliveryPromiseText;if(!i)return t??s}const me={border:"none",background:"transparent",backgroundSelected:"base"};function Fn({deliveryLines:n}){const{checkout:i,i18n:t}=D(),{negotiate:s}=Ge(),{deliveryMacros:o}=be(),a=I(!1),r=o.value,l=I(),d=I(),{selectedMacro:m,setSelectedMacro:y}=qe(),g=m?.id,f=fe(),c=Qe(),h=B(()=>We({checkout:i})),p=n.every(u=>u.methods.length===1),M=a.value&&!m,P=ye(),b=Q(),_=mn(n,g,b.value.groups.length),T=b.value.groups.length,v=T>0?T:n.length,S=h.value||P.value,U=n.length>=$e&&!c&&(S||v>1),te=d.value??U,W=G(()=>{d.value===void 0&&(d.value=U)},[d,U]),{customizationsBefore:Ce,customizationsAfter:Te}=Ze({targeted:!0,hasMultipleDeliveryGroups:!0}).value,xe=()=>(a.value=!0,s({include:["deliveryNext"],onComplete:()=>{a.value=!1}})),Pe=L(()=>g?[g]:[],[g]),we=G(async([u])=>{u&&(W(),await y(u),f("deliveryMacroInteraction",{timestamp:new Date,subEvent:"delivery_macros_input_change"}))},[f,W,y]),$=u=>{W(),l.value=u?n.find(w=>w.methods.includes(u))?.id:void 0},ie=L(()=>({groupType:je("ONE_TIME_PURCHASE"),includeDeliverySelectionGroups:!p}),[p]);if(!r?.length)return null;let Y;if(p){const[u]=r,w=_.get(u.id),O=w&&(w.transitText||w.shipmentCountText)?e(pe,{summary:w}):void 0;Y=T===1?e(Z,{...c?me:{},children:e(le,{variant:"block",name:"delivery-macros",values:[u.id],hideRadioControl:!0,children:e(ce,{value:u.id,secondaryContent:u.cost.amount!==0&&e(X,{cost:u.cost,costAfterDiscounts:u.costAfterDiscounts,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),details:O,children:u.title})})}):e(x,{background:"base",colorLayer:"control",border:"base",borderRadius:"base",padding:"none",children:e(de,{selectedDeliveryMethodHandles:Object.values(u.deliveryMethodHandles),deliveryLines:n,choiceListContext:!1,isSharedRate:u.isSharedRate,shipmentGroups:b.value.groups,includedMethods:b.value.includedMethods,shipmentCommandFor:z,onShipmentClick:$})})}else Y=e(Z,{...c?me:{},children:e(le,{variant:"block",name:"delivery-macros",values:Pe,onChange:we,blockFooter:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:e(Fe,{padding:c?"base none small-300 base":"base",borderRadius:"none none base base",onClick:$,commandFor:z,children:e(k,{justifyItems:c?"start":"center",justifyContent:c?"start":"center",alignItems:"center",alignContent:"center",children:e(C,{direction:"inline",gap:"small-100",children:[c&&e(oe,{type:"plus",tone:"accent"}),e(E,{type:c?"generic":"strong",tone:"accent",children:t.translate("shipping.split_shipping_more_shipping_options")})]})})})}),children:r.map(u=>{const{id:w,title:O,cost:J,costAfterDiscounts:Ee}=u,A=M?void 0:_.get(w),De=A?[O,A.transitText,A.shipmentCountText].filter(Boolean).join(", "):O;return e(ce,{value:w,selectedContent:e(de,{selectedDeliveryMethodHandles:Object.values(u.deliveryMethodHandles),deliveryLines:n,isSharedRate:u.isSharedRate,macroTitle:u.title,shipmentGroups:b.value.groups,shipmentCommandFor:z,onShipmentClick:$,includedMethods:b.value.includedMethods}),selectedContentPadding:"none",secondaryContent:M?e(ae,{inlineSize:"5ch"}):J.amount!==0&&e(X,{cost:J,costAfterDiscounts:Ee,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),accessibilityLabel:De,children:M?e(ae,{inlineSize:"12ch",children:O}):e(C,{children:[e(E,{children:O}),A?e(pe,{summary:A}):null]})},w)})})});return e(Ye,{impressionType:"delivery_macros",impressionFeatures:r.map(({id:u})=>u),children:e(C,{gap:"base",paddingBlockStart:!c&&!te?"small-100":"none",children:[te&&e(C,{direction:"inline",alignItems:"center",gap:"small-400",children:[e(
1oe,{type:"truck"}),e(E,{color:"subdued",children:S?t.translate("shipping.split_shipping_multiple_shipment_notice"):t.translate("shipping.split_shipping_shipment_count_notice_one_time_purchase",{count:v})})]}),e(q,{when:h,children:e(ne,{level:3,children:t.translate("shipping.shipping_method_first_shipment_group_title.other")})}),e(re,{customizations:Ce,options:ie}),Y,e(hn,{deliveryLines:n,openAtDeliveryLineId:l.value,onClose:xe}),e(re,{customizations:Te,options:ie})]})})}export{me as DELIVERY_MACRO_VAULTED_STYLE_OVERRIDES,Fn as default};
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.