import{b as O,i as g,aF as R,aG as C,aH as x,a as n,U as p,aI as z,S as F,aJ as G,aK as I,G as U,aB as K,aL as W,d as Z}from"./app.ZXowmuNl.js";import{S as E}from"./SubscriptionGroupLine.DSbDKpsN.js";function j(){const{control:{background:e="base"}}=O();return{background:e,colorLayer:e==="base"?"control":void 0}}function q({deliveryLines:e,choiceListContext:o=!0,selectedDeliveryMethodHandles:_}){const t=g(),y=R(),b=new Set(_),L=e.length,{buyWithPrimeLines:S,shipsNowLines:f,shipsLaterLines:c}=C(e),a=x(e),l=c.length||a?.length,w=l?"small100":"base",D=(s,i)=>{if(l)switch(s){case"ShipsNow":return t("shipping.pre_order_ships_now","Ships now");case"ShipsLater":return t("shipping.pre_order_ships_later","Ships later");case"ShipsByDate":return i?t("shipping.pre_order_ships_date",{date:i},"Ships %{date}"):void 0}},d=({type:s,lines:i,dateString:r,skipDivider:v,choiceListContext:k})=>{if(!i.length)return null;const B=r?y(new Date(r),{timeZone:"UTC",month:"long",day:"numeric",year:"numeric"}):void 0,u=D(s,B);return n(U,{children:[n(p,{padding:[w,"base","base","base"],spacing:"small300",children:[u&&n(z,{level:4,children:u}),n(p,{spacing:F.default("small100").when({viewportInlineSize:{min:"small"}},"small200"),children:i.map((m,M)=>{const{targetMerchandiseLines:A,methods:T,id:N}=m,h=T.find(({handle:P})=>b.has(P)),H=e.indexOf(m)+1;return h?n(E,{deliveryMethod:h,deliveryMethodHandle:h.handle,merchandiseLines:G(A??[]),modalHeader:t("shipping.split_shipping_merchandise_shipment_number",{number:H,total:L},"Shipment %{number} of %{total}"),shouldRightAlignPrice:!0,choiceListContext:k,isNotFirstLine:M>0},N):null})})]}),!v&&n(I,{direction:"inline",size:"base"})]})};return n(p,{spacing:"none",children:[d({type:"ShipsNow",lines:[...S,...f],skipDivider:!l,choiceListContext:o}),d({type:"ShipsLater",lines:c,skipDivider:!a?.length,choiceListContext:o}),a?.map(([s,i],r)=>d({type:"ShipsByDate",lines:i,dateString:s,skipDivider:r===a.length-1,choiceListContext:o}))]})}function Q(){const e=g();return n(Z,{children:n(K,{href:W,accessibilityLabel:e("shop_pay_remember_me.new_window_disclaimer","(opens a new window)"),children:e("thank_you.branded_promise.buy_with_prime.order_tracking_link_text","Manage on Amazon")})})}export{Q as B,q as D,j as u};