import{Jt as e,Pt as t,Wt as n,yt as i}from"./630ba094.L_X-5TXi.js";import{$b as r,AO as a,JT as o,Lc as s,Qf as l,Vc as d,Xg as c,_p as m,cE as u,ip as h,jO as p,kb as f,rE as g,xO as b}from"./6ec9a0fa.rdcQt2v8.js";import{a as v,n as y,r as x}from"./f3089cd3.9kJkcqkU.js";import{t as P}from"./a541bc81.Cbl-i0FD.js";var I={showShipmentBreakdown:!1};function S(e){return!(!e||"not_required"===e.status)&&e.methods.some(({methodType:e})=>"LOCAL"===e)}function T(e){return"SHIPPING"!==e?.methodType&&"PICKUP_POINT"!==e?.methodType?[]:e.priceBreakdown??[]}function w(){const{checkout:{negotiator:e,journey:n}}=b(),i=e.current.fields.deliveryNext;return t(()=>{const e=i.value;if(!e||"filled"!==e.status)return I;const t=e.splitShippingToggle;if(!t)return I;const a=o(e).filter(e=>g(e)&&!(f(n.currentDetour.value)&&"SUBSCRIPTION"===e.type)),s=a[0];if(S(s))return I;const l=u(s),d=T(l),c=d[0]?.flatRateGroupId;return!r(e)&&c&&d.every(({flatRateGroupId:e})=>e===c)||1===a.length?!l||d.length<=1?I:{showShipmentBreakdown:t,selectedDeliveryMethod:l}:I})}function C(){const{checkout:{negotiator:e}}=b(),n=e.current.fields.deliveryNext;return t(()=>{const e=n.value;return!(!e||"filled"!==e.status)&&!!e.splitShippingToggle&&e.lines.filter(e=>!S(e)).map(u).filter(e=>void 0!==e).some(e=>T(e).length>1)})}function L({deliveryExpectationLine:t,deliveryMethod:i,children:r}){const{observability:a}=b(),o=e(!1);return n(()=>{if(o.current)return;const e=i.brandedPromise?.handle??t?.brandedPromise?.handle??"unbranded";o.current=!0,a.counter({name:"PostPurchase_page_delivery_prediction_rendered",value:1,attributes:{handle:e}})},[t?.brandedPromise?.handle,i.brandedPromise?.handle,a]),r}function z({deliveryMethod:e,subtitle:t,isInModal:n=!1,choiceListContext:r=!0,useBaseFontSize:o,allowDeliveryPromisePresentation:s}){const{deliveryExpectationLines:l,deliveryExpectationLinesLoading:d}=x(),c=l?.find(t=>t.deliveryStrategyHandle===e.handle),m=n||o?void 0:"small",u=e.deliveryPredictionEligible&&"shop_promise"===c?.brandedPromise?.handle,h=e.deliveryPredictionEligible&&d;return!(s??!t)||t&&!u&&!h?t?i(a,{size:m,color:"subdued",children:t}):null:i(L,{deliveryExpectationLine:c,deliveryMethod:e,children:i(y,{deliveryMethod:e,deliveryExpectationLine:c,placeholderTitle:t,size:m,choiceListContext:r&&!n,paragraphColor:"subdued"})})}function k({merchandiseItem:{title:e}}){return i(a,{children:e})}function M({merchandiseItem:{subtitle:e}}){return e?i(a,{size:"small",color:"subdued",children:e}):null}function A({merchandiseItem:e,thumbnailSize:t,thumbnailContentGap:n}){return i(p,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:n,children:[i(P,{merchandiseItem:e,size:t}),i(c,{blockAlignment:"center",children:[i(k,{merchandiseItem:e}),i(M,{merchandiseItem:e})]})]})}function E({merchandise:e,thumbnailSize:t="small",merchandiseItemGap:n="small-200",merchandiseItemPadding:r="none",thumbnailContentGap:a="small-200"}){return i(p,{gridAutoRows:"minmax(auto, max-content)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(auto, max-content)",gap:n,padding:r,children:e.map(e=>i(A,{merchandiseItem:e,thumbnailSize:t,thumbnailContentGap:a},e.stableId))})}function G({id:e,merchandiseLines:t=[],deliveryMethod:n,modalHeader:r,subtitle:o,allowDeliveryPromisePresentation:u,choiceListContext:f=!0,showPrice:g,open:b}){const y=n.included?i(s,{strong:!f}):i(v,{cost:n.cost,costAfterDiscounts:n.costAfterDiscounts,styleOverrides:{shouldBold:!f,freeTextLetterCase:"uppercase",costSpacing:"none"}});return i(l,{heading:r,id:e,open:b,children:[i(E,{merchandise:t,thumbnailSize:"base",merchandiseItemGap:"base",merchandiseItemPadding:"small-100 none none none"}),i(m,{blockSize:"large-200"}),i(h,{}),i(m,{blockSize:"base"}),i(p,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",children:[i(c,{blockAlignment:"start",children:[i(a,{children:d({deliveryMethod:n})}),i(z,{subtitle:o,allowDeliveryPromisePresentation:u,deliveryMethod:n,choiceListContext:f,isInModal:!0})]}),g?y:null]}),i(m,{blockSize:"large-200"})]})}export{T as a,L as i,E as n,C as o,z as r,w as s,G as t};