var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}var window = _____WB$wombat$assign$function_____("window");
var self = _____WB$wombat$assign$function_____("self");
var document = _____WB$wombat$assign$function_____("document");
var location = _____WB$wombat$assign$function_____("location");
var top = _____WB$wombat$assign$function_____("top");
var parent = _____WB$wombat$assign$function_____("parent");
var frames = _____WB$wombat$assign$function_____("frames");
var opener = _____WB$wombat$assign$function_____("opener");
import{i as _,aJ as N,c as U,a as e,bf as v,d,qo as I,J as P,U as m,I as D,D as G,E as h,X as H,bg as L,o_ as w,bh as E,bi as T,aS as g,G as z,H as j,aK as F,eV as A,N as J,aO as f,a2 as V,qp as W,qq as $}from"./app.ZXowmuNl.js";import{S as K,M as Q}from"./StackedMerchandisePreview.aoM-w7_c.js";import{S as B,M as X}from"./MerchandiseModal.BPtcnyj2.js";function R({merchandiseLines:n=[],deliveryMethodHandle:s,deliveryMethod:i,subtitle:t,modalHeader:S,shouldRightAlignPrice:l,choiceListContext:a=!0,isNotFirstLine:u,shippingMethodDetailsAfterExtensions:p=[],shippingMethodDetailsExpandedExtensions:c=[]}){const r=_(),{cost:b,costAfterDiscounts:M}=i,o=N(n),x=o.length,[k]=o,q=e(g,{extensions:c,options:{handle:s,isInModal:!1}}),{inlineSize:O}=U("small"),y=e(X,{modalHeader:S,merchandiseLines:n,deliveryMethod:i,shouldRightAlignPrice:l,choiceListContext:a,subtitle:t});return e(z,{children:[e(Y,{isNotFirstLine:u,hasExtensions:p.length>0||c.length>0,marginInlineStart:O}),e(v,{columns:["auto","fill"],spacing:"base",children:[e(d,{blockAlignment:"start",children:e(I.Provider,{value:!0,children:e(P,{overlay:y,children:e(I.Provider,{value:!1,children:x>1?e(K,{merchandiseItem:k,merchandiseLinesLength:x}):e(Q,{merchandiseItem:k,hideBadge:!0})})})})}),e(d,{blockAlignment:"center",children:e(m,{spacing:"small300",children:[e(P,{overlay:y,children:e(d,{blockAlignment:"center",children:e(v,{columns:["fill","auto"],spacing:"small400",children:[e(m,{spacing:"none",children:[e(v,{columns:"auto",spacing:"small400",blockAlignment:"center",children:[e(D,{spacing:"small500",blockAlignment:"center",children:[e(G,{appearance:"accent",type:"truck",size:"small"}),e(h,{size:"small",tone:"accent",children:r("order_summary.discount_discovery.merchandise_quantity_label",{count:H(n)},{one:"%{count} item",other:"%{count} items"})})]}),e(h,{size:"small",children:L}),e(d,{maxInlineSize:"fill",overflow:"hidden",children:e(h,{size:"small",children:e(w,{children:E({deliveryMethod:i})})})})]}),e(B,{subtitle:t,deliveryMethod:i,choiceListContext:a})]}),l?e(T,{cost:b,costAfterDiscounts:M,styleOverrides:{textSize:"small",shouldBold:!a,freeTextLetterCase:"uppercase",costSpacing:"none"}}):null]})})}),e(g,{extensions:p,options:{handle:s,isInModal:!1}})]})})]}),c.length>0&&q]})}function Y({isNotFirstLine:n,hasExtensions:s,marginInlineStart:i}){if(!n)return null;const t=e("div",{style:{marginInlineStart:`calc(${i}px + var(--x-spacing-base))`},children:e(F,{})});return s?t:e(j,{below:"small",children:t})}function Z({deliveryMethod:n,subtitle:s}){const{cost:i,costAfterDiscounts:t}=n;return e(m,{spacing:"none",children:[e(D,{spacing:"small400",children:[e(d,{maxInlineSize:"fill",overflow:"hidden",children:e(h,{children:e(w,{children:E({deliveryMethod:n})})})}),e(h,{children:L}),e(T,{cost:i,costAfterDiscounts:t,styleOverrides:{freeTextLetterCase:"uppercase",costSpacing:"none"}})]}),e(B,{subtitle:s,deliveryMethod:n,useBaseFontSize:!0})]})}function ee(n){const s=A(),{showShipmentBreakdown:i}=J();return s?i?e(Z,{...n}):e(R,{...n}):e(ne,{...n})}function ne(n){const s=f("Checkout::ShippingMethodDetails::RenderAfter"),i=f("Checkout::ShippingMethodDetails::RenderExpanded");return e(R,{...n,shippingMethodDetailsAfterExtensions:s,shippingMethodDetailsExpandedExtensions:i})}class C extends Error{name="SubscriptionLineMissingDeliveryMethodError"}function ie({subscriptionLine:n,subscriptionLinesLength:s,index:i}){const t=V(),S=A(),l=_(),a=f("Checkout::ShippingMethodDetails::RenderAfter"),u=f("Checkout::ShippingMethodDetails::RenderExpanded"),{methods:p,targetMerchandiseLines:c}=n,r=p[0],b=W({priceBreakdown:r?.priceBreakdown?.[0],discountedShippingPrice:r?.costAfterDiscounts});if(!r)return t.notify(new C("We are unable to render a subscription delivery component because we have no subscription delivery methods")),null;const M=s===1,{handle:o}=r;return M?e(m,{spacing:"small200",children:[e($,{deliveryMethod:r}),!S&&e(z,{children:[a&&e(g,{extensions:a,options:{handle:o,isInModal:!1}}),u&&e(g,{extensions:u,options:{handle:o,isInModal:!1}})]})]}):e(ee,{merchandiseLines:c,deliveryMethod:r,modalHeader:l("shipping.shipping_method_recurring_shipments_group_title",{count:1},{one:"Recurring shipment",other:"Recurring shipments"}),subtitle:b,deliveryMethodHandle:o,isNotFirstLine:i>0,accessibilityLabel:l("split_shipping.a11y_recurring_shipment_line",{number:i+1,total:s},"Review recurring shipment %{number} of %{total}")})}const ae=Object.freeze(Object.defineProperty({__proto__:null,SubscriptionLineMissingDeliveryMethodError:C,default:ie},Symbol.toStringTag,{value:"Module"}));export{ee as S,ae as a};