import{r as i,h as e}from"./p-e97fde0a.js";import{s as o}from"./p-53e7f7d7.js";import{u as t,r as l}from"./p-d7c7b076.js";import{f as n}from"./p-ff10bfbf.js";import{g as d}from"./p-1b470883.js";import"./p-03631502.js";import"./p-9dbc54d6.js";import"./p-d3366af3.js";import"./p-401e165e.js";import"./p-830ab1a3.js";import"./p-ec182234.js";import"./p-3f6362a4.js";import"./p-95325ec5.js";import"./p-4df6e0c5.js";import"./p-1f60f497.js";import"./p-be3a018c.js";import"./p-dd3464cd.js";const s=":host{display:block}:slotted(*~*){margin-top:20px}.line-items{display:grid;gap:var(--sc-form-row-spacing)}.line-item{display:grid;gap:var(--sc-spacing-small)}.line-item--has-swap{border:1px solid var(--sc-input-border-color);background:var(--sc-card-background-color, var(--sc-color-white));border-radius:var(--sc-border-radius-medium);gap:0;border-radius:var(--sc-input-border-radius-medium);overflow:hidden}.line-item--has-swap sc-product-line-item{padding:var(--sc-spacing-medium);border-bottom:solid var(--sc-input-border-width) var(--sc-input-border-color)}.line-item--has-swap sc-swap{padding:var(--sc-spacing-medium);background:var(--sc-card-background-color, var(--sc-color-gray-50))}sc-swap{font-size:var(--sc-font-size-small);line-height:var(--sc-line-height-dense);color:var(--sc-input-label-color)}.fee__description{opacity:0.75}";const r=s;const a=class{constructor(e){i(this,e);this.editable=undefined;this.removable=undefined}isEditable(i){var e;if(((e=i===null||i===void 0?void 0:i.price)===null||e===void 0?void 0:e.ad_hoc)||(i===null||i===void 0?void 0:i.bump_amount)||(i===null||i===void 0?void 0:i.locked)){return false}return this.editable}render(){var i,s,r,a,c;if(!!n()&&!((r=(s=(i=o===null||o===void 0?void 0:o.checkout)===null||i===void 0?void 0:i.line_items)===null||s===void 0?void 0:s.data)===null||r===void 0?void 0:r.length)){return e("sc-line-item",null,e("sc-skeleton",{style:{width:"50px",height:"50px","--border-radius":"0"},slot:"image"}),e("sc-skeleton",{slot:"title",style:{width:"120px",display:"inline-block"}}),e("sc-skeleton",{slot:"description",style:{width:"60px",display:"inline-block"}}),e("sc-skeleton",{style:{width:"120px",display:"inline-block"},slot:"price"}),e("sc-skeleton",{style:{width:"60px",display:"inline-block"},slot:"price-description"}))}const p=(((c=(a=o===null||o===void 0?void 0:o.checkout)===null||a===void 0?void 0:a.line_items)===null||c===void 0?void 0:c.data)||[]).sort(((i,e)=>{const o=(i===null||i===void 0?void 0:i.is_swappable)?1:0;const t=(e===null||e===void 0?void 0:e.is_swappable)?1:0;return t-o}));return e("div",{class:"line-items",part:"base",tabindex:"0"},p.map((i=>{var o,n,s,r,a,c,p,u;const v=d((o=i===null||i===void 0?void 0:i.price)===null||o===void 0?void 0:o.product,i===null||i===void 0?void 0:i.variant);return e("div",{class:`line-item ${(i===null||i===void 0?void 0:i.is_swappable)?"line-item--has-swap":""}`},e("sc-product-line-item",{key:i.id,image:i===null||i===void 0?void 0:i.image,name:(s=(n=i===null||i===void 0?void 0:i.price)===null||n===void 0?void 0:n.product)===null||s===void 0?void 0:s.name,price:(r=i===null||i===void 0?void 0:i.price)===null||r===void 0?void 0:r.name,variant:i===null||i===void 0?void 0:i.variant_display_options,fees:(a=i===null||i===void 0?void 0:i.fees)===null||a===void 0?void 0:a.data,amount:i.ad_hoc_display_amount?i.ad_hoc_display_amount:i.subtotal_display_amount,scratch:i.ad_hoc_display_amount?null:i===null||i===void 0?void 0:i.scratch_display_amount,trial:(c=i===null||i===void 0?void 0:i.price)===null||c===void 0?void 0:c.trial_text,interval:`${(p=i===null||i===void 0?void 0:i.price)===null||p===void 0?void 0:p.short_interval_text} ${(u=i===null||i===void 0?void 0:i.price)===null||u===void 0?void 0:u.short_interval_count_text}`,quantity:i.quantity,purchasableStatus:i===null||i===void 0?void 0:i.purchasable_status_display,note:i===null||i===void 0?void 0:i.display_note,...v?{max:v}:{},editable:this.isEditable(i),removable:!(i===null||i===void 0?void 0:i.locked)&&this.removable,onScUpdateQuantity:e=>t({id:i.id,data:{quantity:e.detail}}),onScRemove:()=>l(i===null||i===void 0?void 0:i.id),exportparts:"base:line-item, product-line-item, image:line-item__image, placeholder__image: line-item__placeholder-image, text:line-item__text, title:line-item__title, suffix:line-item__suffix, price:line-item__price, price__amount:line-item__price-amount, price__description:line-item__price-description, price__scratch:line-item__price-scratch, static-quantity:line-item__static-quantity, remove-icon__base:line-item__remove-icon, quantity:line-item__quantity, quantity__minus:line-item__quantity-minus, quantity__minus-icon:line-item__quantity-minus-icon, quantity__plus:line-item__quantity-plus, quantity__plus-icon:line-item__quantity-plus-icon, quantity__input:line-item__quantity-input, line-item__price-description:line-item__price-description"}),e("sc-swap",{lineItem:i}))})))}};a.style=r;export{a as sc_line_items};
//# sourceMappingURL=p-de670037.entry.js.map