1import{u as e,S as I,e as B,T as L,i as q,l as Ee,f as G,q as z,A as Le}from"./esnext-vendor.BBoIVOQW.js";import{l as D,aJ as ee,k as f,bb as Ie,P as me,cb as ke,L as Oe,bi as ge,Z as F,G as k,n as ne,b as Re,o as j,p as V,aB as Be,B as T,bw as ve,j as Ae,aI as He,f as Ne,ac as Ge,aw as ze,ah as se,ax as qe,I as oe,U as ae}from"./hydrate.Tsur0pib.js";import{b as Z,a as re,C as le}from"./Choice.18syyoW7.js";import{C as Fe,u as je}from"./localization-index.P2wbDjPJ.js";import{T as E,D as Ve,W as be,b3 as Ue,e3 as Qe}from"./addresses-is-address-empty.ZJ1ThpFy.js";import{I as We}from"./ImpressionEventCapture.IVS9ZWTI.js";import{E as K,M as $e,d as ye,u as Je}from"./MerchandiseModal.BB8GJAb2.js";import{u as U,a as Ye,i as Ze,c as Ke,m as Xe}from"./shipping-methods-consolidated-included.Bra92G5_.js";import{B as en,u as fe,E as nn,S as X}from"./EstimatedDeliveryContent.B6SO5ZZV.js";import{B as tn,D as ce}from"./BuyWithPrimeOrderTrackingButton.eYS_aJ4L.js";import{a as _e,b as Se}from"./shipping-methods-grouping.S_i1LuzE.js";import{S as sn}from"./ShippingMethodSelector.DQZ35n22.js";import{S as on}from"./ShippingMethodRateLabel.Doe-JTYM.js";import{g as an}from"./negotiated-findSelectedDeliveryMethod.DhxHslog.js";import"./app.CUBUOQtX.js";import"./shared-permissions.DW7FOCqf.js";import"./hooks-useShopPayExternalAppContext.YLtTu3k6.js";import"./shop-pay-installments-types._vopm3yK.js";import"./Checkbox.dqdh-9I_.js";import"./ShipmentLine.CO3uukoG.js";import"./amazon-constants.BYv714i3.js";import"./amazon-pay-useAmazonPayPaymentLine.CMgi35Fb.js";import"./TextArea.An2gFfWj.js";import"./IncentiveBadge.DttARc72.js";import"./PhoneField.D8EvZ0Pm.js";import"./hooks-useSuppressShopPayModalOnLoad.CwH45iIp.js";function de({summary:n}){const{transitText:i,brandedPromise:t,shipmentCountText:s}=n;return!i&&!s?null:e(f,{direction:"inline",gap:"small-300",alignItems:"center",children:[i?e(D,{color:"subdued",children:i}):null,t?e(en,{brandedPromise:t}):null,i&&s?e(D,{color:"subdued",accessibilityVisibility:"hidden",children:ee}):null,s?e(D,{color:"subdued",children:s}):null]})}function rn({selectedShippingMethod:n}){const{i18n:i}=E(),{deliveryExpectationLines:t}=fe(),{cost:s,costAfterDiscounts:r,hideDiscountedTotalOnShippingSelector:o}=n,a=Ie({deliveryMethod:n,localDelivery:n.methodType==="LOCAL"?i.translate("shipping.local_delivery"):void 0}),l=t?.find(h=>h.deliveryStrategyHandle===n.handle);return e(I,{children:[e(f,{direction:"inline",gap:"small-400",children:[e(
1on,{methodTitle:a}),s&&r?e(I,{children:[ee,e(X,{cost:s,costAfterDiscounts:r,inlineDiscount:!0,preDiscountCost:o})]}):null]}),e(nn,{deliveryMethod:n,deliveryExpectationLine:l,paragraphColor:"subdued"})]})}function pe({selectedShippingMethod:n,rollupOpen:i}){const{i18n:t}=E();return i?e(me,{color:"subdued",children:t.translate("shipping.shipping_method_title")}):e(f,{children:e(rn,{selectedShippingMethod:n})})}function ln({shippingMethods:n,type:i,id:t,displayOnly:s=!1}){const[r]=ke({type:i,id:t}),{includedMethods:o}=U().value,a=o.size?n.map(c=>o.has(c)?Ye(c):c):n,l=s?a[0]:a.find(({handle:c})=>c===r);return l?e(Fe.Provider,{value:!0,children:e(Z,{presentation:"base",children:s?e(pe,{selectedShippingMethod:l}):e(f,{gap:"small-400",paddingBlockStart:"small-400",children:[e(pe,{selectedShippingMethod:l,rollupOpen:!0}),e(sn,{type:i,methods:a,id:t,isInSplitCartModal:!0})]})})}):null}const A=2;function cn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=B(!1),r=B(!1),{i18n:o}=E(),a=n.length,{totalQuantity:l,firstFiveQuantity:c}=L(()=>n.reduce((m,y,d)=>{const g=y.quantity??0;return m.totalQuantity+=g,d<A&&(m.firstFiveQuantity+=g),m},{totalQuantity:0,firstFiveQuantity:0}),[n]),h=o.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l}),v=()=>{if(a>A){s.value=!0;return}r.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:r,fallback:e(I,{children:[e(f,{direction:"inline",gap:"small-300",children:n.slice(0,A).map(m=>e($e,{merchandiseItem:m},m.stableId))}),e(Oe,{onClick:v,children:a>A?o.translate("shipping.split_shipping_merchandise_quantity_label_additional",{quantity:l-c}):o.translate("shipping.split_shipping_merchandise_quantity_label_standard",{quantity:l})})]}),children:e(K,{merchandise:n})}),e(ge,{heading:e(I,{children:[e(ne,{level:1,children:h}),e(Re,{blockSize:"small-500"}),e(me,{color:"subdued",children:i&&t?o.translate("shipping.split_shipping_merchandise_shipment_number",{number:i,total:t}):o.translate("order_summary.subscriptions")})]}),open:s.value,onHide:()=>s.value=!1,accessibilityLabel:h,children:[e(F,{}),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 dn({merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}){const s=j(),r=Ee(n.length>1),o=G(()=>V(s.value.currentDetour)),a=G(()=>r.value&&o.value);return e(q,{when:a,fallback:e(K,{merchandise:n,thumbnailSize:o.value?"small":"base",merchandiseItemGap:o.value?"small-200":"base",thumbnailContentGap:o.value?"small-200":"base"}),children:e(cn,{merchandise:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t})})}function pn({line:n,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t,disableBorders:s=!1,heading:r}){const{id:o,type:a,methods:l,targetMerchandiseLines:c}=n,h=Be(c??[]),{currentDetour:v}=j().value,m=V(v);return e(T,{"data-delivery-line-id":o,background:"base",colorLayer:"control",border:s?"none":"base",borderRadius:s?"none":"base",children:[r&&e(I,{children:[e(T,{padding:"base",children:e(ne,{level:3,children:r})}),e(F,{accessibilityRole:"presentation"})]}),e(T,{padding:"base",children:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content) minmax(0, 1fr)",gridAutoRows:"1fr",gap:"small-100",children:[e(dn,{merchandise:h,oneTimePurchaseIndex:i,oneTimePurchaseTotalCount:t}),e(ln,{shippingMethods:l,type:a,id:o,displayOnly:m})]})})]})}function H({lines:n,heading:i,customNode:t,isSingleCard:s=!1,getSequence:r,showExtendedHeading:o=!1,oneTimePurchaseTotalCount:a}){const{i18n:l}=E(),c=n.length,h=j(),v=ye(),{presentsConsolidatedShipping:m}=U().value;if(!c)return null;const y=n.map((d,g)=>{const u=!!t,_=g+1!==n.length,C=s&&(u||_),b=r(d);return e(I,{children:[e(pn,{line:d,disableBorders:s,heading:(()=>{if(V(h.value.currentDetour)||v.value)return;const x=o?i:void 0;if(m)return x;const w=l.translate("shipping.split_shipping_shipment_number",{number:b});return x?`${w} ${ee} ${x}`:w}
1)(),oneTimePurchaseIndex:g+1,oneTimePurchaseTotalCount:a},d.id??Ve()),C&&e(F,{})]},d.id)});return t&&y.push(t),e(T,{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(f,{gap:"base",children:e(T,{overflow:"hidden",border:"base",borderRadius:"base",children:y})}):e(f,{gap:"large-200",children:y})})})}function ue({shippingGroupLines:n,oneTimePurchaseTotalCount:i}){const{i18n:t,shop:{name:s}}=E(),{buyWithPrimeLines:r,shipsNowLines:o,shipsLaterLines:a}=L(()=>_e(n),[n]),l=L(()=>Se(n),[n]),c=L(()=>{let g=[...r,...o,...a];return l&&(g=[...g,...l.reduce((u,[,_])=>[...u,..._],[])]),g},[r,o,a,l]),h=z(g=>c.indexOf(g)+1,[c]),v=L(()=>r.length>0?t.translate("shipping.split_shipping_shipped_by_shop",{shop_name:s}):t.translate("shipping.pre_order_ships_now"),[r.length,t,s]),m=j(),y=G(()=>V(m.value.currentDetour)),d=a.length>0||(l?l?.length>0:!1);return e(f,{gap:"large-200",children:[r.length>0&&e(H,{lines:r,getSequence:h,heading:t.translate("split_shipping.shipped_by_amazon_prime"),oneTimePurchaseTotalCount:i,customNode:e(q,{when:y,children:e(T,{padding:"small-100 base",children:e(tn,{})})}),isSingleCard:!0,showExtendedHeading:d}),o.length>0&&e(H,{lines:o,getSequence:h,heading:v,oneTimePurchaseTotalCount:i,showExtendedHeading:d}),a.length>0&&e(H,{lines:a,getSequence:h,heading:t.translate("shipping.pre_order_ships_later"),oneTimePurchaseTotalCount:i,showExtendedHeading:d}),l?.map(([g,u])=>u.length>0&&e(H,{lines:u,getSequence:h,heading:t.translate("shipping.pre_order_ships_date",{date:t.formatDate(new Date(g),{timeZone:"UTC",month:"long",day:"numeric",year:"numeric"})}),oneTimePurchaseTotalCount:i,showExtendedHeading:d},g))]})}const un="Lv7iC",hn={Body:un},N="more-shipping-options-modal";function mn({deliveryLines:n,openAtDeliveryLineId:i,onOpen:t,onClose:s}){const{i18n:r}=E(),o=r.translate("shipping.shipping_method_title"),a=ve(),l=Le(),{total:c,presentsConsolidatedShipping:h}=U().value,v=N,m=z(()=>{if(!i)return;Array.from(document.getElementById(v)?.querySelectorAll("[data-delivery-line-id]")??[]).find(C=>C.dataset.deliveryLineId===i)?.scrollIntoView({block:"start",behavior:"instant"})},[i,v]),y=()=>{a("moreShippingOptions",{timestamp:new Date,subEvent:"modalOpen"}),t?.()},d=async()=>{await l.current,a("moreShippingOptions",{timestamp:new Date,subEvent:"modalSave"})},g=async()=>{l.current=s(),await l.current,a("moreShippingOptions",{timestamp:new Date,subEvent:"modalClose"})},u=e(Ae,{variant:"primary",inlineSize:"fill",command:"--hide",commandFor:v,onClick:d,children:r.translate("payment.saved_credit_cards_modal.done")});return e(ge,{heading:o,onShow:y,onAfterShow:m,onHide:g,id:v,padding:h?"none":"base",children:h?e(I,{children:[e(T,{className:hn.Body,paddingBlockStart:"base",paddingBlockEnd:"large-200",paddingInline:"large-200",children:e(ue,{shippingGroupLines:n})}),e(T,{position:"sticky",insetBlock:"auto 0",background:"base",children:[e(F,{}),e(T,{paddingBlock:"base",paddingInline:"large-200",children:e(f,{gap:"base",children:[c&&e(k,{gridTemplateColumns:"1fr auto",gap:"base",children:[e(D,{type:"strong",children:r.translate("order_summary.multiple_shipping_lines_label")}),e(D,{type:"strong",translate:!1,children:r.formatCurrency(c.amount,{currency:c.currencyCode})})]}),u]})})]})]}):e(f,{gap:"large-200",padding:"none none large-200 none",children:[e(ue,{shippingGroupLines:n}),u]})})}function gn(n,i,t){const{shop:s,i18n:r}=E(),{deliveryMacros:o}=be(),a=He(),{deliveryExpectationLines:l}=fe(),c=new Map,h=o.value;if(!s.marketDrivenShippingEnabled||!h?.length)return c;const{shipsLaterLines:v}=_e(n),m=Se(n),y=!!(v.length||m?.length),d=h.map(u=>{const _=new Set(Object.values(u.deliveryMethodHandles)),b=n.map(S=>({line:S,method:S.methods.find(({handle:P})=>_.has(P))})).filter(Ze);return{macro:u,resolvedMethods:b.map(({method:S})=>S).filter(S=>!!S),count:Ke(b).length}}),g=t>0?t===1:(d.find(({macro:u})=>u.id===i)??d[0]).count===1;for(const{macro:u,resolvedMethods:_,count:C}of d){if(C>1&&u.id===i)continue;
1const b=an({selectedMethods:_,deliveryExpectationLines:l??[],deliveryPromiseText:u.deliveryPromisePresentmentTitle?.short}),S=Xe(_),P=S?a(S)??void 0:void 0,x=vn({shopPromiseSummary:b,isPreOrder:y,formattedTimeInTransit:P,fallbackText:u.deliveryPromisePresentmentTitle?.long}),w=g&&C>1?r.translate("shipping.split_shipping_multiple_shipment_quantity_label",{quantity:C}):void 0;c.set(u.id,{...x&&{transitText:x},...b?.brandedPromise&&{brandedPromise:b.brandedPromise},...w&&{shipmentCountText:w}})}return c}function vn({shopPromiseSummary:n,isPreOrder:i,formattedTimeInTransit:t,fallbackText:s}){if(n)return n.deliveryPromiseText;if(!i)return t??s}const he={border:"none",background:"transparent",backgroundSelected:"base"};function jn({deliveryLines:n}){const{checkout:i,i18n:t}=E(),{negotiate:s}=Ne(),{deliveryMacros:r}=be(),o=B(!1),a=r.value,l=B(),c=B(),{selectedMacro:h,setSelectedMacro:v}=Ge(),m=h?.id,y=ve(),d=je(),g=G(()=>Ue({checkout:i})),u=n.every(p=>p.methods.length===1),_=o.value&&!h,C=ye(),b=U(),S=gn(n,m,b.value.groups.length),P=b.value.groups.length,x=P>0?P:n.length,w=g.value||C.value,Q=n.length>=Qe&&!d&&(w||x>1),te=c.value??Q,W=z(()=>{c.value===void 0&&(c.value=Q)},[c,Q]),{customizationsBefore:Ce,customizationsAfter:Me}=Je({targeted:!0,hasMultipleDeliveryGroups:!0}).value,Te=()=>(o.value=!0,s({include:["deliveryNext"],onComplete:()=>{o.value=!1}})),xe=L(()=>m?[m]:[],[m]),Pe=z(async([p])=>{p&&(W(),await v(p),y("deliveryMacroInteraction",{timestamp:new Date,subEvent:"delivery_macros_input_change"}))},[y,W,v]),$=p=>{W(),l.value=p?n.find(M=>M.methods.includes(p))?.id:void 0},ie=L(()=>({groupType:ze("ONE_TIME_PURCHASE"),includeDeliverySelectionGroups:!u}),[u]);if(!a?.length)return null;let J;if(u){const[p]=a,M=S.get(p.id),O=M&&(M.transitText||M.shipmentCountText)?e(de,{summary:M}):void 0;J=P===1?e(Z,{...d?he:{},children:e(re,{variant:"block",name:"delivery-macros",values:[p.id],hideRadioControl:!0,children:e(le,{value:p.id,secondaryContent:p.cost.amount!==0&&e(X,{cost:p.cost,costAfterDiscounts:p.costAfterDiscounts,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),details:O,children:p.title})})}):e(T,{background:"base",colorLayer:"control",border:"base",borderRadius:"base",padding:"none",children:e(ce,{selectedDeliveryMethodHandles:Object.values(p.deliveryMethodHandles),deliveryLines:n,choiceListContext:!1,isSharedRate:p.isSharedRate,shipmentGroups:b.value.groups,includedMethods:b.value.includedMethods,shipmentCommandFor:N,onShipmentClick:$})})}else J=e(Z,{...d?he:{},children:e(re,{variant:"block",name:"delivery-macros",values:xe,onChange:Pe,blockFooter:e(k,{gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:e(qe,{padding:d?"base none small-300 base":"base",borderRadius:"none none base base",onClick:$,commandFor:N,children:e(k,{justifyItems:d?"start":"center",justifyContent:d?"start":"center",alignItems:"center",alignContent:"center",children:e(f,{direction:"inline",gap:"small-100",children:[d&&e(oe,{type:"plus",tone:"accent"}),e(D,{type:d?"generic":"strong",tone:"accent",children:t.translate("shipping.split_shipping_more_shipping_options")})]})})})}),children:a.map(p=>{const{id:M,title:O,cost:Y,costAfterDiscounts:we}=p,R=_?void 0:S.get(M),De=R?[O,R.transitText,R.shipmentCountText].filter(Boolean).join(", "):O;return e(le,{value:M,selectedContent:e(ce,{selectedDeliveryMethodHandles:Object.values(p.deliveryMethodHandles),deliveryLines:n,isSharedRate:p.isSharedRate,macroTitle:p.title,shipmentGroups:b.value.groups,shipmentCommandFor:N,onShipmentClick:$,includedMethods:b.value.includedMethods}),selectedContentPadding:"none",secondaryContent:_?e(se,{inlineSize:"5ch"}):Y.amount!==0&&e(X,{cost:Y,costAfterDiscounts:we,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}}),accessibilityLabel:De,children:_?e(se,{inlineSize:"12ch",children:O}):e(f,{children:[e(D,{children:O}),R?e(de,{summary:R}):null]})},M)})})});return e(We,{impressionType:"delivery_macros",impressionFeatures:a.map(({id:p})=>p),children:e(f,{gap:"base",paddingBlockStart:!d&&!te?"small-100":"none",children:[te&&e(f,{direction:"inline",alignItems:"center",gap:"small-400",children:[e(
1oe,{type:"truck"}),e(D,{color:"subdued",children:w?t.translate("shipping.split_shipping_multiple_shipment_notice"):t.translate("shipping.split_shipping_shipment_count_notice_one_time_purchase",{count:x})})]}),e(q,{when:g,children:e(ne,{level:3,children:t.translate("shipping.shipping_method_first_shipment_group_title.other")})}),e(ae,{customizations:Ce,options:ie}),J,e(mn,{deliveryLines:n,openAtDeliveryLineId:l.value,onClose:Te}),e(ae,{customizations:Me,options:ie})]})})}export{he as DELIVERY_MACRO_VAULTED_STYLE_OVERRIDES,jn 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.