@lime-bundles/widget 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1114 -162
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +1041 -90
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +399 -25
- package/dist/lime-bundle.global.js.map +1 -1
- package/docs/css-variables.md +3 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var LimeBundles=(()=>{var
|
|
1
|
+
"use strict";var LimeBundles=(()=>{var ye=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Rt=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var Ft=(e,t)=>{for(var r in t)ye(e,r,{get:t[r],enumerable:!0})},Vt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Rt(t))!Dt.call(e,n)&&n!==r&&ye(e,n,{get:()=>t[n],enumerable:!(i=It(t,n))||i.enumerable});return e};var Ot=e=>Vt(ye({},"__esModule",{value:!0}),e);var fn={};Ft(fn,{LimeBundleElement:()=>le,trackInputMode:()=>ve});var Ht=Object.defineProperty,We=(e,t)=>{for(var r in t)Ht(e,r,{get:t[r],enumerable:!0})},Re=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},Ut="2025-10";function ke(e){let t=e.apiVersion??Ut,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(i,n,a){let o={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(o["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let l=await fetch(r,{method:"POST",headers:o,body:JSON.stringify({query:i,variables:n}),signal:a?.signal});if(!l.ok)throw new Re([{message:`Storefront API error: ${l.status} ${l.statusText}`}]);let d=await l.json();if(d.errors?.length)throw new Re(d.errors);return d.data}}}var ze=`#graphql
|
|
2
2
|
query BundleMetaobject($id: ID!) {
|
|
3
3
|
metaobject(id: $id) {
|
|
4
4
|
id
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
unitPrice { amount currencyCode }
|
|
27
27
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
28
28
|
selectedOptions { name value }
|
|
29
|
+
image { url altText }
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
unitPrice { amount currencyCode }
|
|
52
53
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
53
54
|
selectedOptions { name value }
|
|
55
|
+
image { url altText }
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
}
|
|
@@ -78,6 +80,7 @@
|
|
|
78
80
|
unitPrice { amount currencyCode }
|
|
79
81
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
80
82
|
selectedOptions { name value }
|
|
83
|
+
image { url altText }
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
}
|
|
@@ -88,7 +91,7 @@
|
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
`,
|
|
94
|
+
`,je=`#graphql
|
|
92
95
|
query ShopCustomCss {
|
|
93
96
|
shop {
|
|
94
97
|
metafield(namespace: "$app", key: "custom_css") {
|
|
@@ -96,7 +99,7 @@
|
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
|
-
`,
|
|
102
|
+
`,Ke=`#graphql
|
|
100
103
|
query BundlesForProduct($handle: String!) {
|
|
101
104
|
product(handle: $handle) {
|
|
102
105
|
id
|
|
@@ -131,6 +134,7 @@
|
|
|
131
134
|
unitPrice { amount currencyCode }
|
|
132
135
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
133
136
|
selectedOptions { name value }
|
|
137
|
+
image { url altText }
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
}
|
|
@@ -156,6 +160,7 @@
|
|
|
156
160
|
unitPrice { amount currencyCode }
|
|
157
161
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
158
162
|
selectedOptions { name value }
|
|
163
|
+
image { url altText }
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
}
|
|
@@ -183,6 +188,7 @@
|
|
|
183
188
|
unitPrice { amount currencyCode }
|
|
184
189
|
unitPriceMeasurement { referenceValue referenceUnit }
|
|
185
190
|
selectedOptions { name value }
|
|
191
|
+
image { url altText }
|
|
186
192
|
}
|
|
187
193
|
}
|
|
188
194
|
}
|
|
@@ -197,42 +203,42 @@
|
|
|
197
203
|
}
|
|
198
204
|
}
|
|
199
205
|
}
|
|
200
|
-
`,
|
|
206
|
+
`,Ge=`#graphql
|
|
201
207
|
mutation CartCreate($input: CartInput!) {
|
|
202
208
|
cartCreate(input: $input) {
|
|
203
209
|
cart { id checkoutUrl }
|
|
204
210
|
userErrors { field message }
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
|
-
`,
|
|
213
|
+
`,Ye=`#graphql
|
|
208
214
|
mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
209
215
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
210
216
|
cart { id checkoutUrl }
|
|
211
217
|
userErrors { field message }
|
|
212
218
|
}
|
|
213
219
|
}
|
|
214
|
-
`,W=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},F={header:{textColor:"#FFFFFF",headerStyle:"gradient",gradientStart:"#C62828",gradientEnd:"#AD1457",saveBadgeBgColor:"#FFFFFF",saveBadgeTextColor:"#AD1457",saveBadgeBorderColor:"#FFFFFF",saveBadgeBorderWidth:0,saveBadgeBorderRadius:8,countdownBgColor:"#FFF0F3",countdownTextColor:"#C62828"},layout:{backgroundColor:"#FFFFFF",borderColor:"#E5E5E5",borderWidth:1,borderRadius:12},productList:{textColor:"#1A1A1A",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:8,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function rt(e){if(!e||typeof e!="object")return F;let t=e;return{...F,...t,defaultTier:it(t.defaultTier),header:{...F.header,...t.header??{}},layout:{...F.layout,...t.layout??{}},productList:{...F.productList,...t.productList??{}},pricing:{...F.pricing,...t.pricing??{}},cta:{...F.cta,...t.cta??{}},savingsBar:{...F.savingsBar,...t.savingsBar??{}},countdown:{...F.countdown,...t.countdown??{}},popularBadge:{...F.popularBadge,...t.popularBadge??{}}}}function it(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:F.defaultTier}function nt(e){return{primaryColor:e.cta.primaryColor,backgroundColor:e.layout.backgroundColor,textColor:e.productList.textColor,borderColor:e.layout.borderColor,borderWidth:e.layout.borderWidth,buttonTextColor:e.cta.buttonTextColor,ctaBorderWidth:e.cta.borderWidth,ctaBorderColor:e.cta.borderColor,ctaBorderRadius:e.cta.borderRadius,savingsBarBgColor:e.savingsBar.bgColor,savingsBarTextColor:e.savingsBar.textColor,savingsBarBorderWidth:e.savingsBar.borderWidth,savingsBarBorderColor:e.savingsBar.borderColor,savingsBarBorderRadius:e.savingsBar.borderRadius,borderRadius:e.layout.borderRadius,headerTextColor:e.header.textColor,saveBadgeBgColor:e.header.saveBadgeBgColor,saveBadgeTextColor:e.header.saveBadgeTextColor,saveBadgeBorderColor:e.header.saveBadgeBorderColor,saveBadgeBorderWidth:e.header.saveBadgeBorderWidth,saveBadgeBorderRadius:e.header.saveBadgeBorderRadius,countdownBgColor:e.header.countdownBgColor,countdownTextColor:e.header.countdownTextColor,headerStyle:e.header.headerStyle,headerGradientStart:e.header.gradientStart,headerGradientEnd:e.header.gradientEnd,showSaveBadge:e.pricing.showSaveBadge,imageBorderWidth:e.productList.imageBorderWidth,imageBorderColor:e.productList.imageBorderColor,imageBorderRadius:e.productList.imageBorderRadius,thumbnailRatio:e.productList.thumbnailRatio,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerThumbnailRatio:e.pickerThumbnailRatio,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var ot={primaryColor:"--lb-primary-color",backgroundColor:"--lb-bg",textColor:"--lb-text",imageBorderWidth:"--lb-image-border-width",imageBorderColor:"--lb-image-border-color",imageBorderRadius:"--lb-image-border-radius",variantBorderWidth:"--lb-variant-border-width",variantBorderColor:"--lb-variant-border-color",variantBorderRadius:"--lb-variant-radius",countBubbleBgColor:"--lb-qty-badge-bg",countBubbleTextColor:"--lb-qty-badge-color",borderColor:"--lb-border",borderWidth:"--lb-border-width",buttonTextColor:"--lb-btn-text",borderRadius:"--lb-radius",headerTextColor:"--lb-header-text",saveBadgeBgColor:"--lb-save-badge-bg",saveBadgeTextColor:"--lb-save-badge-text",saveBadgeBorderColor:"--lb-save-badge-border-color",saveBadgeBorderWidth:"--lb-save-badge-border-width",saveBadgeBorderRadius:"--lb-save-badge-radius",countdownBgColor:"--lb-countdown-bg",countdownTextColor:"--lb-countdown-text",ctaBorderWidth:"--lb-cta-border-width",ctaBorderColor:"--lb-cta-border-color",ctaBorderRadius:"--lb-cta-radius",savingsBarBgColor:"--lb-savings-bar-bg",savingsBarTextColor:"--lb-savings-bar-text",savingsBarBorderWidth:"--lb-savings-bar-border-width",savingsBarBorderColor:"--lb-savings-bar-border-color",savingsBarBorderRadius:"--lb-savings-bar-radius",tierBorderColor:"--lb-tier-border-color",tierBorderWidth:"--lb-tier-border-width",tierBorderRadius:"--lb-tier-radius",tierSelectedBorderColor:"--lb-tier-selected-border-color",tierSelectedBorderWidth:"--lb-tier-selected-border-width",popularBadgeBgColor:"--lb-popular-badge-bg",popularBadgeTextColor:"--lb-popular-badge-text",popularBadgeBorderWidth:"--lb-popular-badge-border-width",popularBadgeBorderColor:"--lb-popular-badge-border-color",popularBadgeBorderRadius:"--lb-popular-badge-radius",headerGradientStart:"--lb-header-start",headerGradientEnd:"--lb-header-end",pickerBgColor:"--lb-picker-bg",pickerTextColor:"--lb-picker-text",pickerBorderWidth:"--lb-picker-border-width",pickerBorderColor:"--lb-picker-border-color",pickerBorderRadius:"--lb-picker-radius",pickerSearchBorderWidth:"--lb-picker-search-border-width",pickerSearchBorderColor:"--lb-picker-search-border-color",pickerSearchBorderRadius:"--lb-picker-search-radius",pickerProductBorderWidth:"--lb-picker-product-border-width",pickerProductBorderColor:"--lb-picker-product-border-color",pickerProductBorderRadius:"--lb-picker-product-radius",pickerCountBubbleBgColor:"--lb-picker-qty-badge-bg",pickerCountBubbleTextColor:"--lb-picker-qty-badge-color",pickerAddBgColor:"--lb-picker-add-bg",pickerAddLabelColor:"--lb-picker-add-label",pickerAddBorderWidth:"--lb-picker-add-border-width",pickerAddBorderColor:"--lb-picker-add-border-color",pickerAddBorderRadius:"--lb-picker-add-radius",pickerVariantBorderWidth:"--lb-picker-variant-border-width",pickerVariantBorderColor:"--lb-picker-variant-border-color",pickerVariantBorderRadius:"--lb-picker-variant-radius"},at=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function we(e,t){let r=nt(t);for(let[a,o]of Object.entries(ot)){let l=r[a];if(l==null)continue;let d=at.has(a)?`${l}px`:String(l);e.style.setProperty(o,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let n=ue(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-thumbnail-img-height",n.imgHeight);let i=ue(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",i.imgHeight)}function ue(e){switch(e){case"tall":return{aspectRatio:"3 / 4",imgFit:"cover",imgHeight:"100%"};case"wide":return{aspectRatio:"4 / 3",imgFit:"cover",imgHeight:"100%"};case"original":return{aspectRatio:"auto",imgFit:"contain",imgHeight:"auto"};default:return{aspectRatio:"1 / 1",imgFit:"cover",imgHeight:"100%"}}}var lt=new Set(["fixed","mix_match","volume"]),dt=new Set(["active"]);function te(e,t){try{return st(e,t)}catch(r){if(r instanceof W)return null;throw r}}function st(e,t){let r=new Map(t.map(v=>[v.key,v])),n=r.get("title")?.value??"Bundle",i=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!i||!lt.has(i))throw new W(`Invalid or missing bundle_type: ${i??"null"}`,"invalid_type");let o=i;if(!a||!dt.has(a))throw new W(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,u=r.get("ends_at")?.value??null,c=new Date;if(d){let v=new Date(d);if(Number.isNaN(v.getTime()))throw new W(`Invalid starts_at: ${d}`,"invalid_type");if(v>c)throw new W(`Bundle not yet started: starts_at=${d}`,"not_started")}if(u){let v=new Date(u);if(Number.isNaN(v.getTime()))throw new W(`Invalid ends_at: ${u}`,"invalid_type");if(v<c)throw new W(`Bundle has expired: ends_at=${u}`,"expired")}let p=ct(r),g=ut(r),w=pt(r),b={id:e,title:n,description:r.get("description")?.value||null,status:l,products:p,discountConfig:g,widgetConfig:w,startsAt:d,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:bt(r),productQuantities:pe(r,"product_quantities"),variantQuantities:pe(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:ht(r)};switch(o){case"fixed":return{...b,bundleType:"fixed"};case"volume":return{...b,bundleType:"volume",volumeTiers:mt(r)};case"mix_match":return{...b,bundleType:"mix_match",minQuantity:be(r,"min_quantity",{min:1}),maxQuantity:be(r,"max_quantity",{min:1})}}}function ct(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let i of r.references.nodes)"variants"in i?t.push(i):"products"in i&&i.products?.nodes&&t.push(...i.products.nodes);let n=e.get("collection");if(n?.references?.nodes)for(let i of n.references.nodes)"products"in i&&i.products?.nodes&&t.push(...i.products.nodes);return t}function ut(e){return{discountType:e.get("discount_type")?.value??"percentage",discountValue:parseFloat(e.get("discount_value")?.value??"0"),allowStacking:e.get("allow_stacking")?.value==="true"}}function pt(e){return rt(Q(e,"widget_config"))}function bt(e){let t=Q(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let n of t)Array.isArray(n)?r.push(n.filter(i=>typeof i=="string")):r.push([]);return r}function pe(e,t){let r=Q(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let n={};for(let[i,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(n[i]=Math.floor(o))}return n}function ht(e){if(!e.get("ab_test_id")?.value)return null;let r={},n=e.get("ab_title")?.value;n&&(r.title=n);let i=e.get("ab_description")?.value;i&&(r.description=i);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let d=parseFloat(o);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=Q(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(_e)),Object.keys(r).length===0?null:r}function mt(e){let t=Q(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(_e):[]}function _e(e){let t=Number(e.minQuantity??0),r={minQuantity:Number.isFinite(t)&&t>=0?t:0};return typeof e.percentage=="number"&&Number.isFinite(e.percentage)&&(r.percentage=e.percentage),typeof e.amount=="number"&&Number.isFinite(e.amount)&&(r.amount=e.amount),r}function Q(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function be(e,t,r={}){let n=e.get(t)?.value;if(!n)return null;let i=parseInt(n,10);return isNaN(i)||r.min!==void 0&&i<r.min?null:i}function re(e,t,r){let n=e.variantQuantities[r];return n!==void 0?n:e.productQuantities[t]??1}function Be(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,n=t.description!==void 0?t.description:e.description,i=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:n,discountConfig:i,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:n,discountConfig:i};case"fixed":return{...e,title:r,description:n,discountConfig:i}}}async function ke(e,t){await Ae(e,{shopDomain:e.shopDomain,eventType:"bundle_impression",bundleGid:t.bundleGid,bundleType:t.bundleType,productId:t.productId,abTestId:t.abTestId,abVariant:t.abVariant,occurredAt:new Date().toISOString()})}async function Se(e,t){await Ae(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function Te(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(n=>{for(let i of n)i.isIntersecting&&(t(),r.unobserve(i.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function Ae(e,t){let r=`${e.appUrl}/api/analytics`,n=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:n}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,n)}catch{}}}var gt=!1;function ft(){if(gt)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var he="lb_session",vt=720*60*60,xt=720*60*60;function Ee(e){return`__Host-_lb_ab_${e}`}async function Pe(e,t,r,n){if(typeof document>"u")return null;let i=Ct(n);if(i&&i.testId===r)return{variant:i.variant,testId:r,persisted:!0};if(!ft())return{variant:"A",testId:r,persisted:!1};let a=wt(),o=_t(a,r);yt(n,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function Ct(e){if(typeof document>"u")return null;let r=`${Ee(e)}=`,i=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!i)return null;let a=i.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function yt(e,t,r){if(typeof document>"u")return;let n=Ee(e),i=`${r}|${t}|${Date.now()}`;document.cookie=`${n}=${i}; Path=/; Max-Age=${xt}; SameSite=Lax; Secure`}function wt(){if(typeof document>"u")return me();let t=document.cookie.split(";").map(n=>n.trim()).find(n=>n.startsWith(`${he}=`))?.split("=")[1];if(t)return t;let r=me();return document.cookie=`${he}=${r}; path=/; max-age=${vt}; SameSite=Lax; Secure`,r}function me(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function _t(e,t){let r=e+":"+t,n=2166136261;for(let i=0;i<r.length;i++)n^=r.charCodeAt(i),n=Math.imul(n,16777619);return(n>>>0)%2===0?"A":"B"}var ge=1e4,Bt=[[/@import/i,"@import rules"],[/@charset/i,"@charset declarations"],[/expression\s*\(/i,"CSS expressions"],[/-moz-binding/i,"-moz-binding"],[/-webkit-binding/i,"-webkit-binding"],[/behavior\s*:/i,"behavior property"]],kt=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function ie(e){if(e.length>ge)return{ok:!1,error:`CSS exceeds ${ge.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(i,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[i,a]of Bt)if(i.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,n;for(;(n=r.exec(t))!==null;){let i=n[1].trim();if((i.startsWith("'")||i.startsWith('"'))&&(i=i.slice(1)),(i.endsWith("'")||i.endsWith('"'))&&(i=i.slice(0,-1)),i=i.trim(),i&&!kt.test(i))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var St="lb-custom-css-";function Le(e,t){if(typeof document>"u"||!t)return!1;let r=ie(t);if(!r.ok||!r.css.trim())return!1;let n=St+Tt(e),i=document.getElementById(n);return i||(i=document.createElement("style"),i.id=n,i.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(i)),i.textContent!==r.css&&(i.textContent=r.css),!0}function Tt(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function At(e,t){let r=typeof e=="string"?parseFloat(e):e;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(r)}catch{return`${t} ${r.toFixed(2)}`}}var Et={CL:"cl",CM:"cm",FLOZ:"fl oz",FT:"ft",FT2:"ft\xB2",G:"g",GAL:"gal",IN:"in",ITEM:"each",KG:"kg",L:"l",LB:"lb",M:"m",M2:"m\xB2",M3:"m\xB3",MG:"mg",ML:"ml",MM:"mm",OZ:"oz",PT:"pt",QT:"qt",UNKNOWN:"",YD:"yd"};function U(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let n=parseFloat(e.amount);if(!Number.isFinite(n))return null;let i=Et[t.referenceUnit]??"";if(!i)return null;let a=e.currencyCode||r||"USD",o=At(n,a),l=t.referenceValue,d=l===1?i:`${l}${i}`;return`${o}/${d}`}function P(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function k(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function Me(e,t){return Math.max(0,e-Math.floor(e*t/100))}function ne(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:n,discountValue:i}=e.discountConfig,a=[],o=0,l=0;for(let p of e.products){let g=p.variants.nodes.find(x=>x.availableForSale)??p.variants.nodes[0];if(!g)continue;let w=P(g.price.amount),b=t[p.id]??1,v=w*b,B=g.compareAtPrice?P(g.compareAtPrice.amount):null;if(a.push({unitCents:w,qty:b,lineCents:v,compareCents:B}),o+=v,n==="percentage"){let x=Me(w,i);l+=x*b}else l+=v}n==="fixed_amount"&&(l=Math.max(0,o-Math.round(i*100)));let d=Math.max(0,o-l),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return r&&d>0&&(n==="percentage"&&i>0?c=`-${Math.round(i)}%`:n==="fixed_amount"&&i>0&&(c=`-${k(Math.round(i*100),u)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:c,currency:u}}function Y(e,t){if(t.discountType==="percentage"){let r=Math.floor(e*t.discountValue/100);return Math.max(0,e-r)}return Math.max(0,e-Math.round(t.discountValue*100))}var L=152;function N(e,t={}){if(!e)return"";try{let r=new URL(e);return t.width!==void 0&&r.searchParams.set("width",String(t.width)),t.height!==void 0&&r.searchParams.set("height",String(t.height)),t.crop&&r.searchParams.set("crop",t.crop),r.toString()}catch{return e}}function Re(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),n=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(n)}h ${o(i)}m ${o(a)}s`:`${o(n)}h ${o(i)}m ${o(a)}s`}function z(e){let t=Pt(e);if(t===null||t<=Date.now())return null;let r=t,n=document.createElement("div");n.className="lb-bundle-countdown",n.setAttribute("data-countdown","");let i=document.createElement("div");i.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",i.appendChild(a),n.appendChild(i);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),n.appendChild(o);let l=null;function d(){let c=r-Date.now();if(c<=0){n.style.display="none",u();return}o.textContent=Re(c)}function u(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:n,stop:u}}function Pt(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function j(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let n=document.createElement("span");return n.className="lb-cta-spinner",n.setAttribute("data-cta-spinner",""),n.setAttribute("aria-hidden","true"),n.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(n),t}function oe(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let n=document.createElement(e);t&&(n.className=t);for(let[i,a]of Object.entries(r))n.setAttribute(i,a);return n}var Lt=`
|
|
220
|
+
`,te=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},Y={header:{textColor:"#FFFFFF",headerStyle:"gradient",gradientStart:"#C62828",gradientEnd:"#AD1457",saveBadgeBgColor:"#FFFFFF",saveBadgeTextColor:"#AD1457",saveBadgeBorderColor:"#FFFFFF",saveBadgeBorderWidth:0,saveBadgeBorderRadius:8,countdownBgColor:"#FFF0F3",countdownTextColor:"#C62828"},layout:{backgroundColor:"#FFFFFF",borderColor:"#E5E5E5",borderWidth:1,borderRadius:12},productList:{textColor:"#1A1A1A",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:8,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function Nt(e){if(!e||typeof e!="object")return Y;let t=e;return{...Y,...t,defaultTier:qt(t.defaultTier),header:{...Y.header,...t.header??{}},layout:{...Y.layout,...t.layout??{}},productList:{...Y.productList,...t.productList??{}},pricing:{...Y.pricing,...t.pricing??{}},cta:{...Y.cta,...t.cta??{}},savingsBar:{...Y.savingsBar,...t.savingsBar??{}},countdown:{...Y.countdown,...t.countdown??{}},popularBadge:{...Y.popularBadge,...t.popularBadge??{}}}}function qt(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:Y.defaultTier}function $t(e){return{primaryColor:e.cta.primaryColor,backgroundColor:e.layout.backgroundColor,textColor:e.productList.textColor,borderColor:e.layout.borderColor,borderWidth:e.layout.borderWidth,buttonTextColor:e.cta.buttonTextColor,ctaBorderWidth:e.cta.borderWidth,ctaBorderColor:e.cta.borderColor,ctaBorderRadius:e.cta.borderRadius,savingsBarBgColor:e.savingsBar.bgColor,savingsBarTextColor:e.savingsBar.textColor,savingsBarBorderWidth:e.savingsBar.borderWidth,savingsBarBorderColor:e.savingsBar.borderColor,savingsBarBorderRadius:e.savingsBar.borderRadius,borderRadius:e.layout.borderRadius,headerTextColor:e.header.textColor,saveBadgeBgColor:e.header.saveBadgeBgColor,saveBadgeTextColor:e.header.saveBadgeTextColor,saveBadgeBorderColor:e.header.saveBadgeBorderColor,saveBadgeBorderWidth:e.header.saveBadgeBorderWidth,saveBadgeBorderRadius:e.header.saveBadgeBorderRadius,countdownBgColor:e.header.countdownBgColor,countdownTextColor:e.header.countdownTextColor,headerStyle:e.header.headerStyle,headerGradientStart:e.header.gradientStart,headerGradientEnd:e.header.gradientEnd,showSaveBadge:e.pricing.showSaveBadge,imageBorderWidth:e.productList.imageBorderWidth,imageBorderColor:e.productList.imageBorderColor,imageBorderRadius:e.productList.imageBorderRadius,thumbnailRatio:e.productList.thumbnailRatio,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerThumbnailRatio:e.pickerThumbnailRatio,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var Wt={primaryColor:"--lb-primary-color",backgroundColor:"--lb-bg",textColor:"--lb-text",imageBorderWidth:"--lb-image-border-width",imageBorderColor:"--lb-image-border-color",imageBorderRadius:"--lb-image-border-radius",variantBorderWidth:"--lb-variant-border-width",variantBorderColor:"--lb-variant-border-color",variantBorderRadius:"--lb-variant-radius",countBubbleBgColor:"--lb-qty-badge-bg",countBubbleTextColor:"--lb-qty-badge-color",borderColor:"--lb-border",borderWidth:"--lb-border-width",buttonTextColor:"--lb-btn-text",borderRadius:"--lb-radius",headerTextColor:"--lb-header-text",saveBadgeBgColor:"--lb-save-badge-bg",saveBadgeTextColor:"--lb-save-badge-text",saveBadgeBorderColor:"--lb-save-badge-border-color",saveBadgeBorderWidth:"--lb-save-badge-border-width",saveBadgeBorderRadius:"--lb-save-badge-radius",countdownBgColor:"--lb-countdown-bg",countdownTextColor:"--lb-countdown-text",ctaBorderWidth:"--lb-cta-border-width",ctaBorderColor:"--lb-cta-border-color",ctaBorderRadius:"--lb-cta-radius",savingsBarBgColor:"--lb-savings-bar-bg",savingsBarTextColor:"--lb-savings-bar-text",savingsBarBorderWidth:"--lb-savings-bar-border-width",savingsBarBorderColor:"--lb-savings-bar-border-color",savingsBarBorderRadius:"--lb-savings-bar-radius",tierBorderColor:"--lb-tier-border-color",tierBorderWidth:"--lb-tier-border-width",tierBorderRadius:"--lb-tier-radius",tierSelectedBorderColor:"--lb-tier-selected-border-color",tierSelectedBorderWidth:"--lb-tier-selected-border-width",popularBadgeBgColor:"--lb-popular-badge-bg",popularBadgeTextColor:"--lb-popular-badge-text",popularBadgeBorderWidth:"--lb-popular-badge-border-width",popularBadgeBorderColor:"--lb-popular-badge-border-color",popularBadgeBorderRadius:"--lb-popular-badge-radius",headerGradientStart:"--lb-header-start",headerGradientEnd:"--lb-header-end",pickerBgColor:"--lb-picker-bg",pickerTextColor:"--lb-picker-text",pickerBorderWidth:"--lb-picker-border-width",pickerBorderColor:"--lb-picker-border-color",pickerBorderRadius:"--lb-picker-radius",pickerSearchBorderWidth:"--lb-picker-search-border-width",pickerSearchBorderColor:"--lb-picker-search-border-color",pickerSearchBorderRadius:"--lb-picker-search-radius",pickerProductBorderWidth:"--lb-picker-product-border-width",pickerProductBorderColor:"--lb-picker-product-border-color",pickerProductBorderRadius:"--lb-picker-product-radius",pickerCountBubbleBgColor:"--lb-picker-qty-badge-bg",pickerCountBubbleTextColor:"--lb-picker-qty-badge-color",pickerAddBgColor:"--lb-picker-add-bg",pickerAddLabelColor:"--lb-picker-add-label",pickerAddBorderWidth:"--lb-picker-add-border-width",pickerAddBorderColor:"--lb-picker-add-border-color",pickerAddBorderRadius:"--lb-picker-add-radius",pickerVariantBorderWidth:"--lb-picker-variant-border-width",pickerVariantBorderColor:"--lb-picker-variant-border-color",pickerVariantBorderRadius:"--lb-picker-variant-radius"},zt=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function Qe(e,t){let r=$t(t);for(let[a,o]of Object.entries(Wt)){let l=r[a];if(l==null)continue;let d=zt.has(a)?`${l}px`:String(l);e.style.setProperty(o,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),e.style.setProperty("--lb-variant-chevron",De(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",De(t.pickerVariantBorderColor)),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let i=Fe(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-thumbnail-img-height",i.imgHeight);let n=Fe(t.pickerThumbnailRatio);e.style.setProperty("--lb-picker-thumbnail-aspect-ratio",n.aspectRatio),e.style.setProperty("--lb-picker-thumbnail-img-fit",n.imgFit),e.style.setProperty("--lb-picker-thumbnail-img-height",n.imgHeight)}function De(e){return`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='${e.replace(/#/g,"%23")}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")`}function Fe(e){switch(e){case"tall":return{aspectRatio:"3 / 4",imgFit:"cover",imgHeight:"100%"};case"wide":return{aspectRatio:"4 / 3",imgFit:"cover",imgHeight:"100%"};case"original":return{aspectRatio:"auto",imgFit:"contain",imgHeight:"auto"};default:return{aspectRatio:"1 / 1",imgFit:"cover",imgHeight:"100%"}}}var jt=new Set(["fixed","mix_match","volume"]),Kt=new Set(["active"]);function Be(e,t){try{return Gt(e,t)}catch(r){if(r instanceof te)return null;throw r}}function Gt(e,t){let r=new Map(t.map(E=>[E.key,E])),i=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!jt.has(n))throw new te(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let o=n;if(!a||!Kt.has(a))throw new te(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,p=r.get("ends_at")?.value??null,u=new Date;if(d){let E=new Date(d);if(Number.isNaN(E.getTime()))throw new te(`Invalid starts_at: ${d}`,"invalid_type");if(E>u)throw new te(`Bundle not yet started: starts_at=${d}`,"not_started")}if(p){let E=new Date(p);if(Number.isNaN(E.getTime()))throw new te(`Invalid ends_at: ${p}`,"invalid_type");if(E<u)throw new te(`Bundle has expired: ends_at=${p}`,"expired")}let c=Yt(r),x=Qt(r),v=Xt(r),h={id:e,title:i,description:r.get("description")?.value||null,status:l,products:c,discountConfig:x,widgetConfig:v,startsAt:d,endsAt:p,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:Jt(r),productQuantities:Ve(r,"product_quantities"),variantQuantities:Ve(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:Zt(r)};switch(o){case"fixed":return{...h,bundleType:"fixed"};case"volume":return{...h,bundleType:"volume",volumeTiers:er(r)};case"mix_match":return{...h,bundleType:"mix_match",minQuantity:Oe(r,"min_quantity",{min:1}),maxQuantity:Oe(r,"max_quantity",{min:1})}}}function Yt(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let n of i.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function Qt(e){return{discountType:e.get("discount_type")?.value??"percentage",discountValue:parseFloat(e.get("discount_value")?.value??"0"),allowStacking:e.get("allow_stacking")?.value==="true"}}function Xt(e){return Nt(ae(e,"widget_config"))}function Jt(e){let t=ae(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let i of t)Array.isArray(i)?r.push(i.filter(n=>typeof n=="string")):r.push([]);return r}function Ve(e,t){let r=ae(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let i={};for(let[n,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[n]=Math.floor(o))}return i}function Zt(e){if(!e.get("ab_test_id")?.value)return null;let r={},i=e.get("ab_title")?.value;i&&(r.title=i);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let d=parseFloat(o);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ae(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(Xe)),Object.keys(r).length===0?null:r}function er(e){let t=ae(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(Xe):[]}function Xe(e){let t=Number(e.minQuantity??0),r={minQuantity:Number.isFinite(t)&&t>=0?t:0};return typeof e.percentage=="number"&&Number.isFinite(e.percentage)&&(r.percentage=e.percentage),typeof e.amount=="number"&&Number.isFinite(e.amount)&&(r.amount=e.amount),r}function ae(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function Oe(e,t,r={}){let i=e.get(t)?.value;if(!i)return null;let n=parseInt(i,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function X(e,t,r){let i=e.variantQuantities[r];return i!==void 0?i:e.productQuantities[t]??1}function Je(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,i=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:i,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:i,discountConfig:n};case"fixed":return{...e,title:r,description:i,discountConfig:n}}}async function Ze(e,t){await rt(e,{shopDomain:e.shopDomain,eventType:"bundle_impression",bundleGid:t.bundleGid,bundleType:t.bundleType,productId:t.productId,abTestId:t.abTestId,abVariant:t.abVariant,occurredAt:new Date().toISOString()})}async function et(e,t){await rt(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function tt(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(i=>{for(let n of i)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function rt(e,t){let r=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,i)}catch{}}}var tr=!1;function rr(){if(tr)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var He="lb_session",nr=720*60*60,ir=720*60*60;function nt(e){return`__Host-_lb_ab_${e}`}async function it(e,t,r,i){if(typeof document>"u")return null;let n=or(i);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!rr())return{variant:"A",testId:r,persisted:!1};let a=lr(),o=dr(a,r);ar(i,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function or(e){if(typeof document>"u")return null;let r=`${nt(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function ar(e,t,r){if(typeof document>"u")return;let i=nt(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${i}=${n}; Path=/; Max-Age=${ir}; SameSite=Lax; Secure`}function lr(){if(typeof document>"u")return Ue();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${He}=`))?.split("=")[1];if(t)return t;let r=Ue();return document.cookie=`${He}=${r}; path=/; max-age=${nr}; SameSite=Lax; Secure`,r}function Ue(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function dr(e,t){let r=e+":"+t,i=2166136261;for(let n=0;n<r.length;n++)i^=r.charCodeAt(n),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var Ne=1e4,sr=[[/@import/i,"@import rules"],[/@charset/i,"@charset declarations"],[/expression\s*\(/i,"CSS expressions"],[/-moz-binding/i,"-moz-binding"],[/-webkit-binding/i,"-webkit-binding"],[/behavior\s*:/i,"behavior property"]],cr=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function Se(e){if(e.length>Ne)return{ok:!1,error:`CSS exceeds ${Ne.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of sr)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=r.exec(t))!==null;){let n=i[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!cr.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var ur="lb-custom-css-";function ot(e,t){if(typeof document>"u"||!t)return!1;let r=Se(t);if(!r.ok||!r.css.trim())return!1;let i=ur+pr(e),n=document.getElementById(i);return n||(n=document.createElement("style"),n.id=i,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function pr(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return(t>>>0).toString(16)}function br(e,t){let r=typeof e=="string"?parseFloat(e):e;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(r)}catch{return`${t} ${r.toFixed(2)}`}}var hr={CL:"cl",CM:"cm",FLOZ:"fl oz",FT:"ft",FT2:"ft\xB2",G:"g",GAL:"gal",IN:"in",ITEM:"each",KG:"kg",L:"l",LB:"lb",M:"m",M2:"m\xB2",M3:"m\xB3",MG:"mg",ML:"ml",MM:"mm",OZ:"oz",PT:"pt",QT:"qt",UNKNOWN:"",YD:"yd"};function Z(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let i=parseFloat(e.amount);if(!Number.isFinite(i))return null;let n=hr[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",o=br(i,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${o}/${d}`}function q(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function R(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function at(e,t){return Math.max(0,e-Math.floor(e*t/100))}function Ee(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:n}=e.discountConfig,a=[],o=0,l=0;for(let c of e.products){let x=c.variants.nodes.find(y=>y.availableForSale)??c.variants.nodes[0];if(!x)continue;let v=q(x.price.amount),h=t[c.id]??1,E=v*h,B=x.compareAtPrice?q(x.compareAtPrice.amount):null;if(a.push({unitCents:v,qty:h,lineCents:E,compareCents:B}),o+=E,i==="percentage"){let y=at(v,n);l+=y*h}else l+=E}i==="fixed_amount"&&(l=Math.max(0,o-Math.round(n*100)));let d=Math.max(0,o-l),p=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",u="";return r&&d>0&&(i==="percentage"&&n>0?u=`-${Math.round(n)}%`:i==="fixed_amount"&&n>0&&(u=`-${R(Math.round(n*100),p)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:u,currency:p}}function ce(e,t){if(t.discountType==="percentage"){let r=Math.floor(e*t.discountValue/100);return Math.max(0,e-r)}return Math.max(0,e-Math.round(t.discountValue*100))}var V=152;function ee(e,t={}){if(!e)return"";try{let r=new URL(e);return t.width!==void 0&&r.searchParams.set("width",String(t.width)),t.height!==void 0&&r.searchParams.set("height",String(t.height)),t.crop&&r.searchParams.set("crop",t.crop),r.toString()}catch{return e}}function lt(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),i=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(i)}h ${o(n)}m ${o(a)}s`:`${o(i)}h ${o(n)}m ${o(a)}s`}var Te={};We(Te,{computePosition:()=>gr,emptyTypeAheadState:()=>yr,handleKey:()=>xr,pushTypeAheadChar:()=>Cr});var mr=4;function gr({trigger:e,viewportHeight:t,desiredHeight:r,margin:i=mr}){let n=Math.max(0,t-e.bottom-i),a=Math.max(0,e.top-i),o=r<=n?"down":a>n?"up":"down",d=Math.min(r,o==="down"?n:a),p=o==="down"?e.bottom+i:e.top-i-d;return{placement:o,maxHeight:d,offsetTop:p,offsetLeft:e.left,width:e.width}}var Ce={type:"passthrough",preventDefault:!1};function _e(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function qe(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function fr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let i=(t+r)%e.length;if(!e[i].disabled)return i}return t}function vr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let i=(t-r+e.length)%e.length;if(!e[i].disabled)return i}return t}function $e(e){return e.length===1&&e!==" "&&/\S/.test(e)}function xr(e,t){if(e.ctrlKey||e.metaKey||e.altKey)return Ce;let{key:r}=e,{isOpen:i,activeIndex:n,selectedIndex:a,options:o}=t;if(!i)switch(r){case"Enter":case" ":case"ArrowDown":return{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:_e(o),preventDefault:!0};case"ArrowUp":return{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:qe(o),preventDefault:!0};default:return $e(r)?{type:"open",activeIndex:a>=0&&!o[a]?.disabled?a:_e(o),preventDefault:!0}:Ce}switch(r){case"ArrowDown":return{type:"move-active",activeIndex:fr(o,n),preventDefault:!0};case"ArrowUp":return{type:"move-active",activeIndex:vr(o,n),preventDefault:!0};case"Home":return{type:"move-active",activeIndex:_e(o),preventDefault:!0};case"End":return{type:"move-active",activeIndex:qe(o),preventDefault:!0};case"Enter":case" ":return n>=0&&!o[n]?.disabled?{type:"commit",index:n,preventDefault:!0}:{type:"passthrough",preventDefault:!0};case"Escape":return{type:"close",commit:!1,restoreFocus:!0,preventDefault:!0};case"Tab":return{type:"close",commit:!1,restoreFocus:!1,preventDefault:!1};default:return $e(r)?{type:"type-ahead",char:r,preventDefault:!1}:Ce}}var wr=500;function yr(){return{buffer:"",lastTime:0}}function Cr(e,t,r,i,n=wr){if(t.length!==1)return{newState:e,matchedIndex:null};let o=(r-e.lastTime>n?"":e.buffer)+t.toLowerCase(),l={buffer:o,lastTime:r};for(let d=0;d<i.length;d++){let p=i[d];if(!p.disabled&&p.label.toLowerCase().startsWith(o))return{newState:l,matchedIndex:d}}return{newState:l,matchedIndex:null}}var _r={};We(_r,{findVariantByOptions:()=>kr,isOptionValueAvailable:()=>Br,toPickerVariant:()=>Sr});function kr(e,t){if(e.length===0)return null;for(let r of e){if(r.optionValues.length!==t.length)continue;let i=!0;for(let n=0;n<r.optionValues.length;n++)if(r.optionValues[n]!==t[n]){i=!1;break}if(i)return r}return null}function Br(e,t,r,i){for(let n of e){if(!n.available||n.optionValues[t]!==r)continue;let a=!0;for(let o=0;o<n.optionValues.length;o++)if(o!==t&&n.optionValues[o]!==i[o]){a=!1;break}if(a)return!0}return!1}function Sr(e){return{id:e.id,optionValues:e.selectedOptions.map(t=>t.value),available:e.availableForSale}}var{computePosition:Er,emptyTypeAheadState:Tr,handleKey:Ar,pushTypeAheadChar:Pr}=Te,Lr=32,Mr=8,Ir=8,K=[];function pe(e){let t=e.composedPath();for(let r=K.length-1;r>=0;r--){let i=K[r];!t.includes(i.shell)&&!t.includes(i.listbox)&&i.close()}}function dt(){for(let e=K.length-1;e>=0;e--)K[e].close()}var be=!1;function Rr(){be||(document.addEventListener("pointerdown",pe,!0),window.addEventListener("scroll",pe,!0),window.addEventListener("resize",dt),be=!0)}function Dr(){!be||K.length>0||(document.removeEventListener("pointerdown",pe,!0),window.removeEventListener("scroll",pe,!0),window.removeEventListener("resize",dt),be=!1)}function ue(e){let t=[];for(let r=0;r<e.options.length;r++){let i=e.options[r];t.push({disabled:i.disabled,label:i.textContent||i.value})}return t}function Fr(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}var Vr=["lb-bundle-variant-select","lb-mix-match__variant-select"],Or=Vr.map(e=>`select.${e}:not(.lb-dropdown-state)`).join(", ");function Hr(e){let t=e;if(e.classList.contains("lb-dropdown-state"))return t.__lbDropdownInstance??null;let r=e.ownerDocument,i=e.getRootNode(),n=e.getAttribute("aria-label")??"",a=`lb-dd-${Math.random().toString(36).slice(2,9)}`;e.classList.add("lb-dropdown-state"),e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex","-1");let o=r.createElement("div");o.className="lb-dropdown",o.setAttribute("data-lb-dropdown","");let l=r.createElement("button");l.type="button",l.className="lb-dropdown-trigger",l.setAttribute("role","combobox"),l.setAttribute("aria-haspopup","listbox"),l.setAttribute("aria-expanded","false");let d=`${a}-listbox`;l.setAttribute("aria-controls",d),n&&l.setAttribute("aria-label",n);let p=r.createElement("span");p.className="lb-dropdown-trigger-value";let u=r.createElement("span");u.className="lb-dropdown-chevron",u.setAttribute("aria-hidden","true"),l.appendChild(p),l.appendChild(u);let c=r.createElement("ul");c.id=d,c.className="lb-dropdown-listbox",c.setAttribute("role","listbox"),n&&c.setAttribute("aria-label",n),c.hidden=!0,o.appendChild(l),e.parentNode?.insertBefore(o,e.nextSibling);let x=e.closest("[data-modal-overlay]");x?(x.appendChild(c),c.setAttribute("data-lb-dropdown-portal","")):o.appendChild(c);let v=!1,h=-1,E=Tr(),B=[],y;function S(){let g=ue(e),w=e.selectedIndex;for(p.textContent=w>=0&&g[w]?g[w].label:"";c.firstChild;)c.removeChild(c.firstChild);B=[];for(let _=0;_<g.length;_++){let D=r.createElement("li");D.id=`${a}-opt-${_}`,D.className="lb-dropdown-option",D.setAttribute("role","option"),D.setAttribute("aria-selected",_===w?"true":"false"),g[_].disabled&&D.setAttribute("aria-disabled","true"),D.setAttribute("data-value",e.options[_].value),D.setAttribute("data-index",String(_)),D.textContent=g[_].label,c.appendChild(D),B.push(D)}}function A(g){if(h>=0&&B[h]&&B[h].classList.remove("is-active"),h=g,g>=0&&B[g]){let w=B[g];w.classList.add("is-active"),l.setAttribute("aria-activedescendant",w.id);let _=w.offsetTop,D=_+w.offsetHeight,re=c.scrollTop,J=re+c.clientHeight;_<re?c.scrollTop=_:D>J&&(c.scrollTop=D-c.clientHeight)}else l.setAttribute("aria-activedescendant","")}function f(){let g=l.getBoundingClientRect();if(g.width===0)return!1;let _=Math.min(B.length||1,Ir)*Lr+Mr,D=Er({trigger:{top:g.top,bottom:g.bottom,left:g.left,width:g.width},viewportHeight:window.innerHeight,desiredHeight:_});return c.setAttribute("data-placement",D.placement),c.style.maxHeight=`${D.maxHeight}px`,c.hasAttribute("data-lb-dropdown-portal")&&(c.style.top=`${D.offsetTop}px`,c.style.left=`${D.offsetLeft}px`,c.style.width=`${D.width}px`),!0}function P(){if(v)return;for(let _=K.length-1;_>=0;_--)K[_]!==y&&K[_].close();v=!0,c.hidden=!1,l.setAttribute("aria-expanded","true"),f()||requestAnimationFrame(()=>f());let g=ue(e),w=e.selectedIndex;w>=0&&g[w]&&!g[w].disabled?A(w):A(Fr(g)),K.push(y),K.length===1&&Rr()}function C(g){if(!v)return;v=!1,c.hidden=!0,l.setAttribute("aria-expanded","false"),l.setAttribute("aria-activedescendant",""),h>=0&&B[h]&&B[h].classList.remove("is-active"),h=-1;let w=K.indexOf(y);w>=0&&K.splice(w,1),K.length===0&&Dr(),g&&l.focus()}function M(g){let w=e.options[g];if(!(!w||w.disabled)){if(e.value!==w.value){e.value=w.value;let _=new Event("change",{bubbles:!0});e.dispatchEvent(_)}S(),C(!0)}}function U(g){switch(g.type){case"open":P(),g.activeIndex>=0&&A(g.activeIndex);return;case"close":C(g.restoreFocus);return;case"move-active":A(g.activeIndex);return;case"commit":M(g.index);return;case"type-ahead":{let w=ue(e),_=Pr(E,g.char,Date.now(),w);E=_.newState,_.matchedIndex!==null&&(v||P(),A(_.matchedIndex));return}case"passthrough":return;default:{let w=g}}}function I(g){let w=ue(e),_=Ar({key:g.key,ctrlKey:g.ctrlKey,metaKey:g.metaKey,altKey:g.altKey,shiftKey:g.shiftKey},{isOpen:v,activeIndex:h,selectedIndex:e.selectedIndex,options:w});_.preventDefault&&g.preventDefault(),U(_)}function b(g){g.preventDefault(),v?C(!1):P()}function T(g){let w=g.target;for(;w&&w!==c;){if(w.classList?.contains("lb-dropdown-option")){let _=parseInt(w.getAttribute("data-index")??"",10);if(!Number.isNaN(_)){M(_);return}}w=w.parentElement}}function L(g){let w=g.target;for(;w&&w!==c;){if(w.classList?.contains("lb-dropdown-option")){if(w.getAttribute("aria-disabled")==="true")return;let _=parseInt(w.getAttribute("data-index")??"",10);!Number.isNaN(_)&&_!==h&&A(_);return}w=w.parentElement}}function m(){setTimeout(()=>{if(!v)return;let g=i.activeElement??r.activeElement;o.contains(g)||C(!1)},0)}function k(){S()}let $=new MutationObserver(()=>{S()});$.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","value","selected"]});let z=g=>g.preventDefault();l.addEventListener("click",b),l.addEventListener("keydown",I),o.addEventListener("focusout",m),c.addEventListener("mousedown",z),c.addEventListener("click",T),c.addEventListener("mousemove",L),e.addEventListener("change",k);function Q(){v&&C(!1),$.disconnect(),l.removeEventListener("click",b),l.removeEventListener("keydown",I),o.removeEventListener("focusout",m),c.removeEventListener("mousedown",z),c.removeEventListener("click",T),c.removeEventListener("mousemove",L),e.removeEventListener("change",k),o.parentNode&&o.parentNode.removeChild(o),c.parentNode&&c.parentNode.removeChild(c),e.classList.remove("lb-dropdown-state"),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),delete t.__lbDropdownInstance}return y={shell:o,listbox:c,select:e,close:()=>C(!1),destroy:Q},t.__lbDropdownInstance=y,S(),y}function he(e){let t=e.querySelectorAll(Or),r=[];return t.forEach(i=>{let n=Hr(i);n&&r.push(n)}),r}function me(e){e.querySelectorAll("select.lb-dropdown-state").forEach(r=>{let i=r.__lbDropdownInstance;i&&i.destroy()})}function ie(e){let t=Ur(e);if(t===null||t<=Date.now())return null;let r=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),i.appendChild(n);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let l=null;function d(){let u=r-Date.now();if(u<=0){i.style.display="none",p();return}o.textContent=lt(u)}function p(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:i,stop:p}}function Ur(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function oe(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let i=document.createElement("span");return i.className="lb-cta-spinner",i.setAttribute("data-cta-spinner",""),i.setAttribute("aria-hidden","true"),i.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(i),t}function Ae(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let i=document.createElement(e);t&&(i.className=t);for(let[n,a]of Object.entries(r))i.setAttribute(n,a);return i}var Nr=`
|
|
215
221
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
216
222
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
217
223
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
218
224
|
<circle cx="10" cy="12" r="2"></circle>
|
|
219
|
-
</svg>`;function
|
|
225
|
+
</svg>`;function st(e,t,r,i){let n=t.widgetConfig,a=(y,S)=>X(t,y,S),o=[],l=0;if(t.products.forEach((y,S)=>{let A=qr(t,y,S);A.qty!==0&&(A.isOos&&(l++,n.outOfStockBehavior==="hide")||o.push(A))}),o.length===0)return;let d=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",p=s("div","lb-fixed",{"data-discount-type":t.discountConfig.discountType,"data-discount-value":String(t.discountConfig.discountValue)}),u=$r(t,d);if(p.appendChild(u.el),n.countdown.showCountdown&&t.endsAt){let y=ie(t.endsAt);y&&(p.appendChild(y.el),i?.(y.stop))}let c=s("div","lb-fixed__products"),x=[];o.forEach(y=>{let S=zr(y,d,a,()=>{B()});x.push(S),c.appendChild(S.el)}),p.appendChild(c),p.appendChild(s("div","lb-bundle-divider"));let v=jr(t);p.appendChild(v.el);let h=n.savingsBar.visible?Kr():null;h&&p.appendChild(h.el);let E=Gr(t,l,()=>{let y=o.filter(S=>S.selected).map(S=>({merchandiseId:S.selected.id,quantity:S.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));y.length!==0&&r(y)});p.appendChild(E),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p),he(p),i?.(()=>me(p)),B();function B(){let y=o.reduce((f,P)=>{if(!P.selected)return f;let C=q(P.selected.price.amount);return f+C*P.qty},0),S=Yr(y,t.discountConfig,o),A=Math.max(0,y-S);v.update({totalCents:y,saleCents:S,savingsCents:A,currency:d}),h&&h.update({savingsCents:A,currency:d}),u.refresh(Wr(t,y,S,d))}}function qr(e,t,r){let i=e.selectedVariantIds?.[r]??null,n=i&&i.length>0?t.variants.nodes.filter(u=>i.includes(u.id)):t.variants.nodes,a=n.find(u=>u.availableForSale)??null,o=n,l=!a,d=a??n[0]??null,p=d?X(e,t.id,d.id):1;return{product:t,eligibleVariants:o,selected:d,qty:p,isOos:l}}function $r(e,t){let r=e.widgetConfig,i=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let d=s("p","lb-bundle-subtitle");d.textContent=e.description,n.appendChild(d)}i.appendChild(n);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});i.appendChild(o);let l=Ee(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?o.textContent=l.headerBadge:o.style.display="none",{el:i,refresh(d){if(!r.pricing.showSaveBadge){o.style.display="none";return}d?(o.textContent=d,o.style.display=""):o.style.display="none"}}}function Wr(e,t,r,i){if(!e.widgetConfig.pricing.showSaveBadge)return"";let n=t-r;if(n<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${R(Math.round(a.discountValue*100),i)}`:`-${R(n,i)}`}function zr(e,t,r,i){let n=s("div",e.isOos?"lb-bundle-product-row lb-bundle-product-row--oos":"lb-bundle-product-row",{"data-product-id":e.product.id.replace(/^.*\//,""),...e.isOos?{"aria-disabled":"true"}:{}}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""}),o=e.selected?.image??e.product.featuredImage??null,l=null;o?(l=document.createElement("img"),l.src=ee(o.url,{width:V,height:V,crop:"center"}),l.alt=o.altText??e.product.title,l.width=V,l.height=V,l.loading="lazy",a.appendChild(l)):a.insertAdjacentHTML("beforeend",Nr);let d=null;e.isOos||(d=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),d.textContent=String(e.qty),a.appendChild(d)),n.appendChild(a);let p=s("div","lb-bundle-product-info"),u=document.createElement("a");if(u.className="lb-bundle-product-name",u.href=`/products/${e.product.handle}`,u.textContent=e.product.title,p.appendChild(u),e.isOos){let c=s("span","lb-bundle-oos-label");c.textContent="Out of stock",p.appendChild(c)}else if(e.selected){let c=s("span","lb-bundle-product-prices"),x=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),v=s("span","lb-bundle-product-price",{"data-product-price":""});c.appendChild(x),c.appendChild(v),p.appendChild(c);let h=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});h.setAttribute("hidden",""),p.appendChild(h);let E=B=>{let y=q(B.price.amount);if(v.textContent=R(y,t),B.compareAtPrice){let f=q(B.compareAtPrice.amount);f>y?(x.textContent=R(f,t),x.removeAttribute("hidden")):x.setAttribute("hidden","")}else x.setAttribute("hidden","");let S=Z(B.unitPrice,B.unitPriceMeasurement,t);S?(h.textContent=S,h.removeAttribute("hidden")):h.setAttribute("hidden","");let A=B.image??e.product.featuredImage;l&&A&&(l.src=ee(A.url,{width:V,height:V,crop:"center"}),l.alt=A.altText??e.product.title)};if(E(e.selected),e.eligibleVariants.length>1){let B=e.eligibleVariants[0].selectedOptions.map(I=>I.name),y=e.product.id.replace(/^.*\//,""),S=[],A=I=>e.eligibleVariants.find(b=>b.selectedOptions.every((T,L)=>T.value===I[L])&&b.selectedOptions.length===I.length)??null,f=I=>{I.selectedOptions.forEach((b,T)=>{let L=S[T];L&&L.value!==b.value&&(L.value=b.value)})},P=(I,b,T)=>e.eligibleVariants.some(L=>!L.availableForSale||L.selectedOptions[I]?.value!==b?!1:L.selectedOptions.every((m,k)=>k===I||m.value===T[k])),C=I=>{S.forEach((b,T)=>{Array.from(b.options).forEach(L=>{L.disabled=!P(T,L.value,I)})})},M=()=>{let I=S.map(T=>T.value),b=A(I);if(!b){e.selected&&(f(e.selected),C(e.selected.selectedOptions.map(T=>T.value)));return}e.selected=b,e.qty=r(e.product.id,b.id),d&&(d.textContent=String(e.qty)),E(b),C(b.selectedOptions.map(T=>T.value)),i()},U=s("div","lb-bundle-variant-option-groups");B.forEach((I,b)=>{let T=s("div","lb-bundle-variant-option-group"),L=s("span","lb-bundle-variant-option-label");L.textContent=I,T.appendChild(L);let m=document.createElement("select");m.className="lb-bundle-variant-select",m.setAttribute("data-variant-option",""),m.setAttribute("data-option-position",String(b+1)),m.name=`lb-variant-${y}-${b+1}`,m.setAttribute("aria-label",I);let k=new Set;e.eligibleVariants.forEach($=>{let z=$.selectedOptions[b]?.value;if(!z||k.has(z))return;k.add(z);let Q=document.createElement("option");Q.value=z,Q.textContent=z,e.selected?.selectedOptions[b]?.value===z&&(Q.selected=!0),m.appendChild(Q)}),m.addEventListener("change",M),S.push(m),T.appendChild(m),U.appendChild(T)}),p.appendChild(U),e.selected&&C(e.selected.selectedOptions.map(I=>I.value))}else if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let B=s("span","lb-bundle-variant-badge");B.textContent=e.eligibleVariants[0].title,p.appendChild(B)}}return n.appendChild(p),{el:n,state:e}}function jr(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return i.appendChild(a),t.appendChild(i),{el:t,update({totalCents:o,saleCents:l,savingsCents:d,currency:p}){a.textContent=R(l,p),e.widgetConfig.pricing.showCompareAtPrice&&d>0?(n.textContent=R(o,p),n.style.display=""):n.style.display="none"}}}function Kr(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});return e.appendChild(r),{el:e,update({savingsCents:i,currency:n}){if(i<=0){e.style.display="none";return}e.style.display="",r.textContent=R(i,n)}}}function Gr(e,t,r){let i=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=oe(i);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function Yr(e,t,r){if(t.discountType==="percentage"){let i=0;for(let n of r){if(!n.selected)continue;let a=q(n.selected.price.amount),o=Math.floor(a*t.discountValue/100),l=Math.max(0,a-o);i+=l*n.qty}return i}return Math.max(0,e-Math.round(t.discountValue*100))}var ut=`
|
|
220
226
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
221
227
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
222
228
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
223
229
|
<circle cx="10" cy="12" r="2"></circle>
|
|
224
|
-
</svg>`,
|
|
230
|
+
</svg>`,Qr=`
|
|
225
231
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
226
232
|
<line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
227
233
|
<line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
228
|
-
</svg>`,
|
|
234
|
+
</svg>`,pt=`
|
|
229
235
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
230
236
|
<line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
231
237
|
<line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
232
|
-
</svg
|
|
238
|
+
</svg>`,Xr=`
|
|
233
239
|
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
234
240
|
<path d="M14.348 5.652a.5.5 0 0 0-.707 0L10 9.293 6.36 5.652a.5.5 0 1 0-.708.707L9.293 10l-3.641 3.641a.5.5 0 0 0 .708.707L10 10.707l3.641 3.641a.5.5 0 0 0 .707-.707L10.707 10l3.641-3.641a.5.5 0 0 0 0-.707z"/>
|
|
235
|
-
</svg>`;function Ue(e,t,r,n){let i=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=Kt(t,i.outOfStockBehavior);if(d.filter(m=>!m.isOos).length<o)return;let c=[],p=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),g=qt(t);if(p.appendChild(g),i.countdown.showCountdown&&t.endsAt){let m=z(t.endsAt);m&&(p.appendChild(m.el),n?.(m.stop))}let w=Wt(o);p.appendChild(w.el);let b=s("div","lb-mix-match__slots",{"data-selection-slots":""});p.appendChild(b),p.appendChild(s("div","lb-bundle-divider"));let v=jt(i.pricing.showCompareAtPrice);p.appendChild(v.el);let B=i.savingsBar.visible?Gt():null;B&&p.appendChild(B.el);let x=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),T=s("span","lb-mix-match__price-placeholder-text");T.textContent=`Select ${o} items to see price`,x.appendChild(T),p.appendChild(x);let E=Qt(t,d,a,{showSearch:i.showSearch,onAdd:(m,_)=>A(m,_),onRemove:(m,_)=>R(m,_),countFor:(m,_)=>c.filter(M=>M.productId===m&&M.variantId===_).length,isOverMax:()=>c.length>=l});p.appendChild(E.el);let h=j(`Select ${o} items to unlock`);h.disabled=!0,h.addEventListener("click",()=>{if(h.disabled)return;let m=c.map(_=>({merchandiseId:_.variantId,quantity:1,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(m)}),p.appendChild(h),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p);let S=d.find(m=>!m.isOos),C=S?.firstAvailableVariant??S?.variants[0];S&&C&&c.push({productId:S.product.id,productTitle:S.product.title,variantId:C.id,variantTitle:C.title,imageUrl:S.product.featuredImage?.url??null,priceCents:P(C.price.amount),compareCents:C.compareAtPrice?P(C.compareAtPrice.amount):null,unitPriceLabel:U(C.unitPrice,C.unitPriceMeasurement,a)}),f();function A(m,_){c.length>=l||(c.push({productId:m.id,productTitle:m.title,variantId:_.id,variantTitle:_.title,imageUrl:m.featuredImage?.url??null,priceCents:P(_.price.amount),compareCents:_.compareAtPrice?P(_.compareAtPrice.amount):null,unitPriceLabel:U(_.unitPrice,_.unitPriceMeasurement,a)}),f())}function R(m,_){let M=c.findIndex(D=>D.productId===m&&D.variantId===_);M!==-1&&(c.splice(M,1),f())}function G(m){m<0||m>=c.length||(c.splice(m,1),f())}function f(){V(),w.update(c.length),v.update(c,t,a),B&&B.update(c,t,a),x.style.display=c.length===0?"":"none",E.refreshCounts(),I()}function V(){b.innerHTML="";let m=Math.max(o,c.length);for(let _=0;_<m;_++){let M=c[_];M?b.appendChild(zt(M,_,a,()=>G(_))):b.appendChild(Nt(_,()=>E.open()))}}function I(){let m=c.length;m<o?(h.disabled=!0,oe(h,`Select ${o-m} more to unlock`)):(h.disabled=!1,oe(h,i.cta.ctaText||"Add to cart"))}}function qt(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),i=s("h3","lb-bundle-title");if(i.textContent=e.title,n.appendChild(i),r.appendChild(n),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,l=null;if(a==="percentage"&&o>0?l=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(l=`-${k(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let d=s("span","lb-bundle-header__badge");d.textContent=l,r.appendChild(d)}}return r}function Wt(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),n=s("span","lb-mix-match__progress-count",{"data-progress-count":""});n.textContent=`0 of ${e} selected`,r.appendChild(n);let i=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});i.textContent=`${e} more to go`,r.appendChild(i),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function l(d){let u=Math.min(100,d/e*100);n.textContent=`${d} of ${e} selected`,d>=e?i.textContent="Complete":i.textContent=`${e-d} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function Nt(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),n=s("div","lb-mix-match__empty-thumb");n.innerHTML=Ht,r.appendChild(n);let i=s("span","lb-mix-match__empty-text");return i.textContent="Choose an item",r.appendChild(i),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function zt(e,t,r,n){let i=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let p=document.createElement("img");p.src=N(e.imageUrl,{width:L,height:L,crop:"center"}),p.alt=e.productTitle,p.width=L,p.height=L,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Ve);i.appendChild(a);let o=s("div","lb-mix-match__filled-info"),l=s("span","lb-mix-match__filled-title");if(l.textContent=e.productTitle,o.appendChild(l),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,o.appendChild(p)}let d=s("span","lb-mix-match__filled-price");if(e.compareCents&&e.compareCents>e.priceCents){let p=s("span","lb-mix-match__filled-compare");p.textContent=k(e.compareCents,r),d.appendChild(p)}let u=document.createElement("span");if(u.textContent=k(e.priceCents,r),d.appendChild(u),o.appendChild(d),e.unitPriceLabel){let p=s("span","lb-bundle-product-unit-price");p.textContent=e.unitPriceLabel,o.appendChild(p)}i.appendChild(o);let c=document.createElement("button");return c.type="button",c.className="lb-mix-match__slot-remove",c.setAttribute("aria-label",`Remove ${e.productTitle}`),c.innerHTML=De,c.addEventListener("click",p=>{p.stopPropagation(),n()}),i.appendChild(c),i}function jt(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let n=s("span","lb-bundle-pricing__prices"),i=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&n.appendChild(i);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});n.appendChild(a),t.appendChild(n);function o(l,d,u){if(l.length===0){t.style.display="none";return}t.style.display="";let c=l.reduce((g,w)=>g+w.priceCents,0),p=Y(c,d.discountConfig);e&&c>p?(i.textContent=k(c,u),i.style.display=""):i.style.display="none",a.textContent=k(p,u)}return{el:t,update:o}}function Gt(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function n(i,a,o){if(i.length===0){e.style.display="none";return}let l=i.reduce((c,p)=>c+p.priceCents,0),d=Y(l,a.discountConfig),u=Math.max(0,l-d);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=k(u,o)}return{el:e,update:n}}function Qt(e,t,r,n){let i=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});i.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Fe(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Fe(e.id)}`});l.textContent="Pick an item",o.appendChild(l);let d=document.createElement("button");d.type="button",d.className="lb-mix-match__modal-close",d.setAttribute("data-modal-close",""),d.setAttribute("aria-label","Close"),d.innerHTML=De,d.addEventListener("click",A),o.appendChild(d),a.appendChild(o);let u=null,c=null;if(n.showSearch){let f=s("div","lb-mix-match__modal-search");u=document.createElement("input"),u.type="text",u.className="lb-mix-match__modal-search-input",u.setAttribute("data-modal-search",""),u.setAttribute("role","searchbox"),u.setAttribute("aria-label","Search products"),u.setAttribute("placeholder","Search products"),u.autocomplete="off",u.addEventListener("input",()=>T()),f.appendChild(u),c=document.createElement("button"),c.type="button",c.className="lb-mix-match__modal-search-clear",c.setAttribute("data-modal-search-clear",""),c.setAttribute("aria-label","Clear search"),c.style.display="none",c.innerHTML=$t,c.addEventListener("click",()=>{u&&(u.value="",T(),u.focus())}),f.appendChild(c),a.appendChild(f)}let p=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(p);let g=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});g.style.display="none";let w=document.createElement("p");w.textContent="No products match your search.",g.appendChild(w),a.appendChild(g);let b=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(b),i.appendChild(a);let v=!1,B=[];function x(){v||(v=!0,p.innerHTML="",t.forEach(f=>{let V=f.variants.filter(y=>y.availableForSale),I=V[0]??f.firstAvailableVariant??f.variants[0];if(!I)return;let m=I,_=s("div",f.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":f.product.id.replace(/^.*\//,"")}),M=s("div","lb-mix-match__modal-product-thumb");if(f.product.featuredImage){let y=document.createElement("img");y.src=N(f.product.featuredImage.url,{width:L,height:L,crop:"center"}),y.alt=f.product.featuredImage.altText??f.product.title,y.width=L,y.height=L,y.loading="lazy",M.appendChild(y)}else M.insertAdjacentHTML("beforeend",Ve);let D=s("span","lb-bundle-qty-badge");D.style.display="none",M.appendChild(D),_.appendChild(M);let O=s("div","lb-mix-match__modal-product-info"),le=s("p","lb-mix-match__modal-product-title");le.textContent=f.product.title,O.appendChild(le);let X=s("p","lb-mix-match__modal-product-price");X.textContent=k(P(m.price.amount),r),O.appendChild(X);let H=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),de=U(m.unitPrice,m.unitPriceMeasurement,r);de?H.textContent=de:H.hidden=!0,O.appendChild(H);let J={el:_,product:f.product,variant:I,updateCount:()=>{}};if(V.length>1){let y=document.createElement("select");y.className="lb-mix-match__variant-select",y.setAttribute("data-variant-select",""),y.name=`lb-variant-${f.product.id.replace(/^.*\//,"")}`,y.setAttribute("aria-label",`Select variant for ${f.product.title}`),V.forEach($=>{let q=document.createElement("option");q.value=$.id,q.textContent=$.title,$.id===I.id&&(q.selected=!0),y.appendChild(q)}),y.addEventListener("change",()=>{let $=V.find(Qe=>Qe.id===y.value);if(!$)return;m=$,J.variant=$,X.textContent=k(P(m.price.amount),r);let q=U(m.unitPrice,m.unitPriceMeasurement,r);q?(H.textContent=q,H.hidden=!1):(H.textContent="",H.hidden=!0),se()}),O.appendChild(y)}else if(V.length===1&&I.title!=="Default Title"){let y=s("span","lb-mix-match__filled-variant");y.textContent=I.title,O.appendChild(y)}if(f.isOos){let y=s("span","lb-mix-match__modal-sold-out-label");y.textContent="Sold out",O.appendChild(y)}_.appendChild(O);let se=()=>{let y=n.countFor(f.product.id,m.id);y>0?(D.textContent=String(y),D.style.display=""):D.style.display="none"};if(!f.isOos){let y=document.createElement("button");y.type="button",y.className="lb-mix-match__modal-add",y.textContent="Add",y.addEventListener("click",()=>{n.isOverMax()||n.onAdd(f.product,m)}),_.appendChild(y)}J.updateCount=f.isOos?()=>{}:se,B.push(J),p.appendChild(_)}),G())}function T(){if(!u)return;let f=u.value.trim().toLowerCase();c&&(c.style.display=f?"":"none");let V=0;B.forEach(I=>{let m=!f||I.product.title.toLowerCase().includes(f);I.el.style.display=m?"":"none",m&&V++}),g.style.display=V===0&&f?"":"none"}let E=null;function h(f){if(f.key==="Escape"){f.preventDefault(),A();return}f.key==="Tab"&&Yt(f,a)}let S=!1;function C(){S||n.isOverMax()||(S=!0,x(),E=i.getRootNode().activeElement,i.style.display="",i.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",h),i.addEventListener("click",R))}function A(){S&&(S=!1,i.classList.remove("lb-mix-match__modal-overlay--open"),i.style.display="none",document.removeEventListener("keydown",h),i.removeEventListener("click",R),E instanceof HTMLElement&&E.focus())}function R(f){f.target===i&&A()}function G(){B.forEach(f=>f.updateCount())}return{el:i,open:C,close:A,refreshCounts:G}}function Kt(e,t){let r=[],n=new Set;for(let i of e.products){if(n.has(i.id))continue;n.add(i.id);let a=i.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:i,variants:i.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function Yt(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let n=r[0],i=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===n?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),n.focus())}function Fe(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function qe(e,t,r,n){let i=t.widgetConfig,o=t.products[0]?.variants.nodes.find(h=>h.availableForSale);if(!o&&i.outOfStockBehavior==="hide")return;let l=o?P(o.price.amount):0,d=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((h,S)=>{let C;if(u==="fixed_amount"){let A=Math.round((h.amount??0)*100);C=Math.max(0,l-A)}else{let A=h.percentage??0,R=Math.floor(l*A/100);C=Math.max(0,l-R)}return{tier:h,index:S,qty:h.minQuantity,pricePerUnitCents:C,basePricePerUnitCents:l}}),p=er(c),g=i.defaultTier==="best_value"?p:0;typeof i.defaultTier=="number"&&(g=$e(i.defaultTier,0,c.length-1));let w=i.popularBadge.tierIndex!==void 0?$e(i.popularBadge.tierIndex,0,c.length-1):p,b=s("div","lb-volume");if(b.appendChild(Xt(t,c,g,d,u)),i.countdown.showCountdown&&t.endsAt){let h=z(t.endsAt);h&&(b.appendChild(h.el),n?.(h.stop))}let v=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(h=>{let S=Jt(h,h.index===g,d,i.popularBadge.visible&&h.index===w?i.popularBadge.text:null,i.pricing.showComparePrice,i.pricing.showPerUnitPrice);S.addEventListener("click",()=>E(h.index)),S.addEventListener("keydown",C=>{if(C.key==="Enter"||C.key===" "){C.preventDefault(),E(h.index);return}if(C.key==="ArrowDown"||C.key==="ArrowRight"||C.key==="ArrowUp"||C.key==="ArrowLeft"){C.preventDefault();let A=C.key==="ArrowDown"||C.key==="ArrowRight"?1:-1,R=(h.index+A+c.length)%c.length;E(R),v.children[R]?.focus()}}),v.appendChild(S)}),b.appendChild(v),b.appendChild(s("div","lb-bundle-divider"));let B=Oe(c,g,d,i.pricing.showItemCount,i.pricing.showCompareAtPrice);b.appendChild(B);let x=i.savingsBar.visible?He(c,g,d):null;x&&b.appendChild(x);let T=Zt(t,()=>{if(!o)return;let h=c[g];h&&r([{merchandiseId:o.id,quantity:h.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});b.appendChild(T),b.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),b.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(b);function E(h){if(h===g||h<0||h>=c.length)return;g=h,Array.from(v.children).forEach((A,R)=>{A.setAttribute("aria-checked",String(R===h)),A.tabIndex=R===h?0:-1});let S=Oe(c,h,d,i.pricing.showItemCount,i.pricing.showCompareAtPrice);if(B.replaceWith(S),B=S,x){let A=He(c,h,d);x.replaceWith(A),x=A}let C=b.querySelector("[data-header-badge]");if(C){let A=We(c[h],d,u);A?(C.textContent=A,C.style.display=""):C.style.display="none"}}}function Xt(e,t,r,n,i){let a=e.widgetConfig,o=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),o.appendChild(l),a.pricing.showSaveBadge){let u=We(t[r],n,i);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function Jt(e,t,r,n,i,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(l);let d=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,d.appendChild(u);let c=s("span","lb-volume__tier-price");if(i&&e.pricePerUnitCents<e.basePricePerUnitCents){let g=s("span","lb-volume__tier-compare");g.textContent=k(e.basePricePerUnitCents,r),c.appendChild(g)}if(a){let g=document.createElement("span");g.setAttribute("data-tier-price-each",""),g.textContent=k(e.pricePerUnitCents,r),c.appendChild(g);let w=s("span","lb-volume__tier-unit");w.textContent=" each",c.appendChild(w)}d.appendChild(c),o.appendChild(d);let p=s("span","lb-volume__tier-badge");return n?p.textContent=n:p.style.display="none",o.appendChild(p),o}function Oe(e,t,r,n,i){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",n&&a){let w=document.createElement("span");w.setAttribute("data-item-count",""),w.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(w)}u.appendChild(c);let p=s("span","lb-bundle-pricing__prices");if(i&&d>0){let w=s("span","lb-bundle-compare-price",{"data-compare-price":""});w.textContent=k(l,r),p.appendChild(w)}let g=s("span","lb-bundle-sale-price",{"data-total-price":""});return g.textContent=k(o,r),p.appendChild(g),u.appendChild(p),u}function He(e,t,r){let n=e[t],i=n?n.pricePerUnitCents*n.qty:0,a=n?n.basePricePerUnitCents*n.qty:0,o=Math.max(0,a-i),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let u=s("span","",{"data-savings-amount":""});return u.textContent=k(o,r),l.appendChild(u),l}function Zt(e,t){let n=e.products[0]?.variants.nodes.some(o=>o.availableForSale),i=n?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=j(i);return n||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function We(e,t,r){if(!e)return null;let{tier:n}=e;if(r==="fixed_amount"){let i=n.amount??0;return i>0?`-${k(Math.round(i*100),t)}`:null}if(r==="percentage"){let i=n.percentage??0;return i>0?`-${Math.round(i)}%`:null}return null}function er(e){let t=0,r=0;return e.forEach((n,i)=>{let a=n.basePricePerUnitCents-n.pricePerUnitCents;a>t&&(t=a,r=i)}),r}function $e(e,t,r){return Math.max(t,Math.min(r,e))}var ae=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
241
|
+
</svg>`;function bt(e,t,r,i){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=an(t,n.outOfStockBehavior);if(d.filter(m=>!m.isOos).length<o)return;let u=[],c=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),x=Jr(t);if(c.appendChild(x),n.countdown.showCountdown&&t.endsAt){let m=ie(t.endsAt);m&&(c.appendChild(m.el),i?.(m.stop))}let v=Zr(o);c.appendChild(v.el);let h=s("div","lb-mix-match__slots",{"data-selection-slots":""});c.appendChild(h),c.appendChild(s("div","lb-bundle-divider"));let E=rn(n.pricing.showCompareAtPrice);c.appendChild(E.el);let B=n.savingsBar.visible?nn():null;B&&c.appendChild(B.el);let y=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),S=s("span","lb-mix-match__price-placeholder-text");S.textContent=`Select ${o} items to see price`,y.appendChild(S),c.appendChild(y);let A=on(t,d,a,{showSearch:n.showSearch,onAdd:(m,k)=>M(m,k),onRemove:(m,k)=>U(m,k),isOverMax:()=>u.length>=l});c.appendChild(A.el);let f=oe(`Select ${o} items to unlock`);f.disabled=!0,f.addEventListener("click",()=>{if(f.disabled)return;let m=u.map(k=>({merchandiseId:k.variantId,quantity:k.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(m)}),c.appendChild(f),c.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),c.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(c),i?.(()=>me(c));let P=d.find(m=>!m.isOos),C=P?.firstAvailableVariant??P?.variants[0];P&&C&&u.push({productId:P.product.id,productTitle:P.product.title,variantId:C.id,variantTitle:C.title,imageUrl:C.image?.url??P.product.featuredImage?.url??null,priceCents:q(C.price.amount),compareCents:C.compareAtPrice?q(C.compareAtPrice.amount):null,unitPriceLabel:Z(C.unitPrice,C.unitPriceMeasurement,a),quantity:X(t,P.product.id,C.id)}),b();function M(m,k){u.length>=l||(u.push({productId:m.id,productTitle:m.title,variantId:k.id,variantTitle:k.title,imageUrl:k.image?.url??m.featuredImage?.url??null,priceCents:q(k.price.amount),compareCents:k.compareAtPrice?q(k.compareAtPrice.amount):null,unitPriceLabel:Z(k.unitPrice,k.unitPriceMeasurement,a),quantity:X(t,m.id,k.id)}),b())}function U(m,k){let $=u.findIndex(z=>z.productId===m&&z.variantId===k);$!==-1&&(u.splice($,1),b())}function I(m){m<0||m>=u.length||(u.splice(m,1),b())}function b(){T(),v.update(u.length),E.update(u,t,a),B&&B.update(u,t,a),y.style.display=u.length===0?"":"none",A.refreshCounts(),L()}function T(){h.innerHTML="";let m=Math.max(o,u.length);for(let k=0;k<m;k++){let $=u[k];$?h.appendChild(tn($,k,a,()=>I(k))):h.appendChild(en(k,()=>A.open()))}}function L(){let m=u.length;m<o?(f.disabled=!0,Ae(f,`Select ${o-m} more to unlock`)):(f.disabled=!1,Ae(f,n.cta.ctaText||"Add to cart"))}}function Jr(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,i.appendChild(n),r.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,l=null;if(a==="percentage"&&o>0?l=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(l=`-${R(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let d=s("span","lb-bundle-header__badge");d.textContent=l,r.appendChild(d)}}return r}function Zr(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,r.appendChild(i);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function l(d){let p=Math.min(100,d/e*100);i.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,o.style.width=`${p}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function en(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),i=s("div","lb-mix-match__empty-thumb");i.innerHTML=Qr,r.appendChild(i);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function tn(e,t,r,i){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let h=document.createElement("img");h.src=ee(e.imageUrl,{width:V,height:V,crop:"center"}),h.alt=e.productTitle,h.width=V,h.height=V,h.loading="lazy",a.appendChild(h)}else a.insertAdjacentHTML("beforeend",ut);let o=s("span","lb-bundle-qty-badge");o.textContent=String(e.quantity),a.appendChild(o),n.appendChild(a);let l=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,l.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let h=s("span","lb-mix-match__filled-variant");h.textContent=e.variantTitle,l.appendChild(h)}let p=e.priceCents*e.quantity,u=e.compareCents!==null?e.compareCents*e.quantity:null,c=s("span","lb-mix-match__filled-price");if(u!==null&&u>p){let h=s("span","lb-mix-match__filled-compare");h.textContent=R(u,r),c.appendChild(h)}let x=document.createElement("span");if(x.textContent=R(p,r),c.appendChild(x),l.appendChild(c),e.unitPriceLabel){let h=s("span","lb-bundle-product-unit-price");h.textContent=e.unitPriceLabel,l.appendChild(h)}n.appendChild(l);let v=document.createElement("button");return v.type="button",v.className="lb-mix-match__slot-remove",v.setAttribute("aria-label",`Remove ${e.productTitle}`),v.innerHTML=pt,v.addEventListener("click",h=>{h.stopPropagation(),i()}),n.appendChild(v),n}function rn(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(l,d,p){if(l.length===0){t.style.display="none";return}t.style.display="";let u=l.reduce((x,v)=>x+v.priceCents*v.quantity,0),c=ce(u,d.discountConfig);e&&u>c?(n.textContent=R(u,p),n.style.display=""):n.style.display="none",a.textContent=R(c,p)}return{el:t,update:o}}function nn(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function i(n,a,o){if(n.length===0){e.style.display="none";return}let l=n.reduce((u,c)=>u+c.priceCents*c.quantity,0),d=ce(l,a.discountConfig),p=Math.max(0,l-d);if(p<=0){e.style.display="none";return}e.style.display="",r.textContent=R(p,o)}return{el:e,update:i}}function on(e,t,r,i){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${ct(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${ct(e.id)}`});l.textContent="Pick an item",o.appendChild(l);let d=document.createElement("button");d.type="button",d.className="lb-mix-match__modal-close",d.setAttribute("data-modal-close",""),d.setAttribute("aria-label","Close"),d.innerHTML=pt,d.addEventListener("click",M),o.appendChild(d),a.appendChild(o);let p=null,u=null;if(i.showSearch){let b=s("div","lb-mix-match__modal-search");p=document.createElement("input"),p.type="text",p.className="lb-mix-match__modal-search-input",p.setAttribute("data-modal-search",""),p.setAttribute("role","searchbox"),p.setAttribute("aria-label","Search products"),p.setAttribute("placeholder","Search products"),p.autocomplete="off",p.addEventListener("input",()=>S()),b.appendChild(p),u=document.createElement("button"),u.type="button",u.className="lb-mix-match__modal-search-clear",u.setAttribute("data-modal-search-clear",""),u.setAttribute("aria-label","Clear search"),u.style.display="none",u.innerHTML=Xr,u.addEventListener("click",()=>{p&&(p.value="",S(),p.focus())}),b.appendChild(u),a.appendChild(b)}let c=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(c);let x=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});x.style.display="none";let v=document.createElement("p");v.textContent="No products match your search.",x.appendChild(v),a.appendChild(x);let h=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(h),n.appendChild(a);let E=!1,B=[];function y(){E||(E=!0,c.innerHTML="",t.forEach(b=>{let T=b.variants,L=b.variants.find(N=>N.availableForSale)??b.firstAvailableVariant??b.variants[0];if(!L)return;let m=L,k=s("div",b.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":b.product.id.replace(/^.*\//,"")}),$=s("div","lb-mix-match__modal-product-thumb"),Q=(b.variants.find(N=>N.availableForSale)??b.variants[0]??null)?.image??b.product.featuredImage??null,g=null;Q?(g=document.createElement("img"),g.src=ee(Q.url,{width:V,height:V,crop:"center"}),g.alt=Q.altText??b.product.title,g.width=V,g.height=V,g.loading="lazy",$.appendChild(g)):$.insertAdjacentHTML("beforeend",ut);let w=s("span","lb-bundle-qty-badge");w.textContent=String(X(e,b.product.id,m.id)),$.appendChild(w),k.appendChild($);let _=s("div","lb-mix-match__modal-product-info"),D=s("p","lb-mix-match__modal-product-title");D.textContent=b.product.title,_.appendChild(D);let re=s("p","lb-mix-match__modal-product-price");re.textContent=R(q(m.price.amount)*X(e,b.product.id,m.id),r),_.appendChild(re);let J=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),Le=Z(m.unitPrice,m.unitPriceMeasurement,r);Le?J.textContent=Le:J.hidden=!0,_.appendChild(J);let xe={el:k,product:b.product,variant:L,updateCount:()=>{}};if(T.length>1){let N=T[0].selectedOptions.map(O=>O.name),Et=b.product.id.replace(/^.*\//,""),de=[],Tt=O=>T.find(F=>F.selectedOptions.length===O.length&&F.selectedOptions.every((j,H)=>j.value===O[H]))??null,At=O=>{O.selectedOptions.forEach((F,j)=>{let H=de[j];H&&H.value!==F.value&&(H.value=F.value)})},Pt=(O,F,j)=>T.some(H=>!H.availableForSale||H.selectedOptions[O]?.value!==F?!1:H.selectedOptions.every((W,G)=>G===O||W.value===j[G])),we=O=>{de.forEach((F,j)=>{Array.from(F.options).forEach(H=>{H.disabled=!Pt(j,H.value,O)})})},Lt=()=>{let O=de.map(G=>G.value),F=Tt(O);if(!F){At(m),we(m.selectedOptions.map(G=>G.value));return}m=F,xe.variant=F;let j=X(e,b.product.id,m.id);re.textContent=R(q(m.price.amount)*j,r);let H=Z(m.unitPrice,m.unitPriceMeasurement,r);H?(J.textContent=H,J.hidden=!1):(J.textContent="",J.hidden=!0);let W=m.image??b.product.featuredImage;g&&W&&(g.src=ee(W.url,{width:V,height:V,crop:"center"}),g.alt=W.altText??b.product.title),we(F.selectedOptions.map(G=>G.value)),Me()},Ie=s("div","lb-bundle-variant-option-groups");N.forEach((O,F)=>{let j=s("div","lb-bundle-variant-option-group"),H=s("span","lb-bundle-variant-option-label");H.textContent=O,j.appendChild(H);let W=document.createElement("select");W.className="lb-mix-match__variant-select",W.setAttribute("data-variant-option",""),W.setAttribute("data-option-position",String(F+1)),W.name=`lb-variant-${Et}-${F+1}`,W.setAttribute("aria-label",O);let G=new Set;T.forEach(Mt=>{let ne=Mt.selectedOptions[F]?.value;if(!ne||G.has(ne))return;G.add(ne);let se=document.createElement("option");se.value=ne,se.textContent=ne,L.selectedOptions[F]?.value===ne&&(se.selected=!0),W.appendChild(se)}),W.addEventListener("change",Lt),de.push(W),j.appendChild(W),Ie.appendChild(j)}),_.appendChild(Ie),we(L.selectedOptions.map(O=>O.value))}else if(T.length===1&&L.title!=="Default Title"){let N=s("span","lb-mix-match__filled-variant");N.textContent=L.title,_.appendChild(N)}if(b.isOos){let N=s("span","lb-mix-match__modal-sold-out-label");N.textContent="Sold out",_.appendChild(N)}k.appendChild(_);let Me=()=>{w.textContent=String(X(e,b.product.id,m.id))};if(!b.isOos){let N=document.createElement("button");N.type="button",N.className="lb-mix-match__modal-add",N.textContent="Add",N.addEventListener("click",()=>{i.isOverMax()||(i.onAdd(b.product,m),M())}),k.appendChild(N)}xe.updateCount=b.isOos?()=>{}:Me,B.push(xe),c.appendChild(k)}),he(c),I())}function S(){if(!p)return;let b=p.value.trim().toLowerCase();u&&(u.style.display=b?"":"none");let T=0;B.forEach(L=>{let m=!b||L.product.title.toLowerCase().includes(b);L.el.style.display=m?"":"none",m&&T++}),x.style.display=T===0&&b?"":"none"}let A=null;function f(b){if(b.key==="Escape"){b.preventDefault(),M();return}b.key==="Tab"&&ln(b,a)}let P=!1;function C(){P||i.isOverMax()||(P=!0,y(),A=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",f),n.addEventListener("click",U))}function M(){P&&(P=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",f),n.removeEventListener("click",U),A instanceof HTMLElement&&A.focus())}function U(b){b.target===n&&M()}function I(){B.forEach(b=>b.updateCount())}return{el:n,open:C,close:M,refreshCounts:I}}function an(e,t){let r=[],i=new Set;for(let n of e.products){if(i.has(n.id))continue;i.add(n.id);let a=n.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function ln(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let i=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),i.focus())}function ct(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function ft(e,t,r,i){let n=t.widgetConfig,o=t.products[0]?.variants.nodes.find(f=>f.availableForSale);if(!o&&n.outOfStockBehavior==="hide")return;let l=o?q(o.price.amount):0,d=o?.price.currencyCode??"USD",p=t.discountConfig.discountType,u=t.volumeTiers.map((f,P)=>{let C;if(p==="fixed_amount"){let M=Math.round((f.amount??0)*100);C=Math.max(0,l-M)}else{let M=f.percentage??0,U=Math.floor(l*M/100);C=Math.max(0,l-U)}return{tier:f,index:P,qty:f.minQuantity,pricePerUnitCents:C,basePricePerUnitCents:l}}),c=un(u),x=n.defaultTier==="best_value"?c:0;typeof n.defaultTier=="number"&&(x=gt(n.defaultTier,0,u.length-1));let v=n.popularBadge.tierIndex!==void 0?gt(n.popularBadge.tierIndex,0,u.length-1):c,h=s("div","lb-volume");if(h.appendChild(dn(t,u,x,d,p)),n.countdown.showCountdown&&t.endsAt){let f=ie(t.endsAt);f&&(h.appendChild(f.el),i?.(f.stop))}let E=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});u.forEach(f=>{let P=sn(f,f.index===x,d,n.popularBadge.visible&&f.index===v?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);P.addEventListener("click",()=>A(f.index)),P.addEventListener("keydown",C=>{if(C.key==="Enter"||C.key===" "){C.preventDefault(),A(f.index);return}if(C.key==="ArrowDown"||C.key==="ArrowRight"||C.key==="ArrowUp"||C.key==="ArrowLeft"){C.preventDefault();let M=C.key==="ArrowDown"||C.key==="ArrowRight"?1:-1,U=(f.index+M+u.length)%u.length;A(U),E.children[U]?.focus()}}),E.appendChild(P)}),h.appendChild(E),h.appendChild(s("div","lb-bundle-divider"));let B=ht(u,x,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);h.appendChild(B);let y=n.savingsBar.visible?mt(u,x,d):null;y&&h.appendChild(y);let S=cn(t,()=>{if(!o)return;let f=u[x];f&&r([{merchandiseId:o.id,quantity:f.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});h.appendChild(S),h.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),h.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(h);function A(f){if(f===x||f<0||f>=u.length)return;x=f,Array.from(E.children).forEach((M,U)=>{M.setAttribute("aria-checked",String(U===f)),M.tabIndex=U===f?0:-1});let P=ht(u,f,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(B.replaceWith(P),B=P,y){let M=mt(u,f,d);y.replaceWith(M),y=M}let C=h.querySelector("[data-header-badge]");if(C){let M=vt(u[f],d,p);M?(C.textContent=M,C.style.display=""):C.style.display="none"}}}function dn(e,t,r,i,n){let a=e.widgetConfig,o=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),o.appendChild(l),a.pricing.showSaveBadge){let p=vt(t[r],i,n);if(p){let u=s("span","lb-bundle-header__badge",{"data-header-badge":""});u.textContent=p,o.appendChild(u)}}return o}function sn(e,t,r,i,n,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(l);let d=s("span","lb-volume__tier-grid"),p=s("span","lb-volume__tier-label");p.textContent=`Buy ${e.qty}`,d.appendChild(p);let u=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let x=s("span","lb-volume__tier-compare");x.textContent=R(e.basePricePerUnitCents,r),u.appendChild(x)}if(a){let x=document.createElement("span");x.setAttribute("data-tier-price-each",""),x.textContent=R(e.pricePerUnitCents,r),u.appendChild(x);let v=s("span","lb-volume__tier-unit");v.textContent=" each",u.appendChild(v)}d.appendChild(u),o.appendChild(d);let c=s("span","lb-volume__tier-badge");return i?c.textContent=i:c.style.display="none",o.appendChild(c),o}function ht(e,t,r,i,n){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),p=s("div","lb-bundle-pricing"),u=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(u.textContent="Total",i&&a){let v=document.createElement("span");v.setAttribute("data-item-count",""),v.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,u.appendChild(v)}p.appendChild(u);let c=s("span","lb-bundle-pricing__prices");if(n&&d>0){let v=s("span","lb-bundle-compare-price",{"data-compare-price":""});v.textContent=R(l,r),c.appendChild(v)}let x=s("span","lb-bundle-sale-price",{"data-total-price":""});return x.textContent=R(o,r),c.appendChild(x),p.appendChild(c),p}function mt(e,t,r){let i=e[t],n=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let p=s("span","",{"data-savings-amount":""});return p.textContent=R(o,r),l.appendChild(p),l}function cn(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),n=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=oe(n);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function vt(e,t,r){if(!e)return null;let{tier:i}=e;if(r==="fixed_amount"){let n=i.amount??0;return n>0?`-${R(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=i.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function un(e){let t=0,r=0;return e.forEach((i,n)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function gt(e,t,r){return Math.max(t,Math.min(r,e))}var pn=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),ge=new Set,fe=!1;function xt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of ge)r.classList.add(e),r.classList.remove(t)}function wt(e){pn.has(e.key)&&xt("using-keyboard")}function yt(){xt("using-mouse")}function bn(){fe||(fe=!0,document.addEventListener("keydown",wt,!0),document.addEventListener("pointerdown",yt,!0))}function hn(){fe&&(fe=!1,document.removeEventListener("keydown",wt,!0),document.removeEventListener("pointerdown",yt,!0))}function ve(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),ge.add(e),bn(),()=>{ge.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),ge.size===0&&hn()}}var Pe=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
236
242
|
|
|
237
243
|
.lb-bundle-widget.lb-bundle-widget,
|
|
238
244
|
.lb-bundle-widget.lb-bundle-widget * {
|
|
@@ -244,6 +250,11 @@
|
|
|
244
250
|
--lb-thumbnail-bg: #F0F0F0;
|
|
245
251
|
--lb-widget-pad: 20px;
|
|
246
252
|
--lb-progress-color: var(--lb-primary-color);
|
|
253
|
+
/* Cap on the per-bundle product/slot/tier list height \u2014 keeps long
|
|
254
|
+
bundles from pushing the CTA off-screen. The list scrolls
|
|
255
|
+
internally with the same custom 4px scrollbar as the variant
|
|
256
|
+
dropdown when content exceeds this. */
|
|
257
|
+
--lb-list-max-height: 360px;
|
|
247
258
|
|
|
248
259
|
font-family: inherit;
|
|
249
260
|
font-size: 16px;
|
|
@@ -515,6 +526,56 @@
|
|
|
515
526
|
margin-top: 8px;
|
|
516
527
|
}
|
|
517
528
|
|
|
529
|
+
/* Per-option variant pickers. Each option's label + select sit inside a
|
|
530
|
+
.lb-bundle-variant-option-group (flex column, 2px gap between label and
|
|
531
|
+
select); the groups stack inside a .lb-bundle-variant-option-groups
|
|
532
|
+
parent (flex column, 12px gap between groups). The parent owns the top
|
|
533
|
+
offset from the preceding unit-price line, so individual labels and
|
|
534
|
+
selects don't carry their own vertical margins. */
|
|
535
|
+
.lb-bundle-variant-option-groups {
|
|
536
|
+
display: flex;
|
|
537
|
+
flex-direction: column;
|
|
538
|
+
gap: 12px;
|
|
539
|
+
margin-top: 8px;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.lb-bundle-variant-option-group {
|
|
543
|
+
display: flex;
|
|
544
|
+
flex-direction: column;
|
|
545
|
+
gap: 2px;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.lb-bundle-variant-option-label {
|
|
549
|
+
display: block;
|
|
550
|
+
margin: 0;
|
|
551
|
+
font-size: 12px;
|
|
552
|
+
line-height: 16px;
|
|
553
|
+
font-weight: 600;
|
|
554
|
+
letter-spacing: 0.05em;
|
|
555
|
+
text-transform: uppercase;
|
|
556
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
.lb-mix-match__modal-product-info .lb-bundle-variant-option-groups {
|
|
560
|
+
margin-top: 4px;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/* Focus-ring suppression for mouse users. A small JS helper \u2014 see
|
|
564
|
+
packages/widget/src/utils/input-mode.ts and bundle-widget.js \u2014 toggles
|
|
565
|
+
.using-mouse / .using-keyboard on the widget root (or html in the Liquid
|
|
566
|
+
path) based on the customer's current input device. Default is mouse, so
|
|
567
|
+
click-to-focus doesn't leave a keyboard-style ring. The modal overlay
|
|
568
|
+
gets its own selector because the Liquid path reparents it to body,
|
|
569
|
+
outside the widget root. */
|
|
570
|
+
.using-mouse .lb-bundle-widget :focus,
|
|
571
|
+
.using-mouse .lb-bundle-widget :focus-visible,
|
|
572
|
+
.using-mouse .lb-mix-match__modal-overlay :focus,
|
|
573
|
+
.using-mouse .lb-mix-match__modal-overlay :focus-visible {
|
|
574
|
+
outline: none;
|
|
575
|
+
outline-offset: 0;
|
|
576
|
+
box-shadow: none;
|
|
577
|
+
}
|
|
578
|
+
|
|
518
579
|
.lb-bundle-quantity {
|
|
519
580
|
font-size: 12px;
|
|
520
581
|
line-height: 16px;
|
|
@@ -740,13 +801,29 @@
|
|
|
740
801
|
.lb-ab-pending {
|
|
741
802
|
visibility: hidden;
|
|
742
803
|
}
|
|
743
|
-
`,
|
|
804
|
+
`,Ct=`/* Lime Bundles \u2014 Fixed bundle styles */
|
|
744
805
|
|
|
745
806
|
.lb-fixed__products {
|
|
746
807
|
display: flex;
|
|
747
808
|
flex-direction: column;
|
|
748
809
|
gap: 0;
|
|
749
810
|
margin: 0;
|
|
811
|
+
max-height: var(--lb-list-max-height);
|
|
812
|
+
overflow-y: auto;
|
|
813
|
+
/* Custom scrollbar \u2014 text colour at 15% opacity (thumb) and 5% (track). */
|
|
814
|
+
scrollbar-width: thin;
|
|
815
|
+
scrollbar-color: color-mix(in srgb, var(--lb-text) 15%, transparent)
|
|
816
|
+
color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.lb-fixed__products::-webkit-scrollbar { width: 4px; }
|
|
820
|
+
.lb-fixed__products::-webkit-scrollbar-track {
|
|
821
|
+
background: color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
822
|
+
border-radius: 2px;
|
|
823
|
+
}
|
|
824
|
+
.lb-fixed__products::-webkit-scrollbar-thumb {
|
|
825
|
+
background: color-mix(in srgb, var(--lb-text) 15%, transparent);
|
|
826
|
+
border-radius: 2px;
|
|
750
827
|
}
|
|
751
828
|
|
|
752
829
|
/* Fixed bundles: product rows */
|
|
@@ -771,9 +848,10 @@
|
|
|
771
848
|
border: none;
|
|
772
849
|
}
|
|
773
850
|
|
|
774
|
-
/* Variant picker select \u2014 styled to match the variant badge aesthetic
|
|
851
|
+
/* Variant picker select \u2014 styled to match the variant badge aesthetic.
|
|
852
|
+
Sits inside .lb-bundle-variant-option-group so vertical spacing is owned
|
|
853
|
+
by the group/groups flex gap, not the select itself. */
|
|
775
854
|
.lb-bundle-variant-select {
|
|
776
|
-
margin-top: 8px;
|
|
777
855
|
display: inline-block;
|
|
778
856
|
border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
|
|
779
857
|
border-radius: var(--lb-variant-radius);
|
|
@@ -790,14 +868,37 @@
|
|
|
790
868
|
background-repeat: no-repeat;
|
|
791
869
|
background-position: right 8px center;
|
|
792
870
|
background-size: 12px;
|
|
793
|
-
|
|
871
|
+
width: 50%;
|
|
872
|
+
max-width: 50%;
|
|
794
873
|
}
|
|
795
874
|
|
|
796
875
|
.lb-bundle-variant-select:focus-visible {
|
|
797
876
|
outline: 2px solid var(--lb-primary-color);
|
|
798
877
|
outline-offset: 2px;
|
|
799
878
|
}
|
|
800
|
-
`,
|
|
879
|
+
`,_t=`/* Lime Bundles \u2014 Mix & Match styles */
|
|
880
|
+
|
|
881
|
+
/* === Slot list ============================================================
|
|
882
|
+
Caps the height of the slot stack so long bundles don't push the CTA off
|
|
883
|
+
the page. Internal scroll with the same custom 4px scrollbar as the
|
|
884
|
+
variant dropdown panel. */
|
|
885
|
+
.lb-mix-match__slots {
|
|
886
|
+
max-height: var(--lb-list-max-height);
|
|
887
|
+
overflow-y: auto;
|
|
888
|
+
scrollbar-width: thin;
|
|
889
|
+
scrollbar-color: color-mix(in srgb, var(--lb-text) 15%, transparent)
|
|
890
|
+
color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
.lb-mix-match__slots::-webkit-scrollbar { width: 4px; }
|
|
894
|
+
.lb-mix-match__slots::-webkit-scrollbar-track {
|
|
895
|
+
background: color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
896
|
+
border-radius: 2px;
|
|
897
|
+
}
|
|
898
|
+
.lb-mix-match__slots::-webkit-scrollbar-thumb {
|
|
899
|
+
background: color-mix(in srgb, var(--lb-text) 15%, transparent);
|
|
900
|
+
border-radius: 2px;
|
|
901
|
+
}
|
|
801
902
|
|
|
802
903
|
/* === Progress Bar === */
|
|
803
904
|
.lb-mix-match__progress {
|
|
@@ -1196,7 +1297,6 @@
|
|
|
1196
1297
|
|
|
1197
1298
|
.lb-mix-match__variant-select {
|
|
1198
1299
|
font-size: 12px;
|
|
1199
|
-
margin: 4px 0 0;
|
|
1200
1300
|
padding: 4px 24px 4px 8px;
|
|
1201
1301
|
border: var(--lb-picker-variant-border-width) solid var(--lb-picker-variant-border-color);
|
|
1202
1302
|
border-radius: var(--lb-picker-variant-radius);
|
|
@@ -1209,7 +1309,8 @@
|
|
|
1209
1309
|
font-family: inherit;
|
|
1210
1310
|
min-height: 32px;
|
|
1211
1311
|
cursor: pointer;
|
|
1212
|
-
|
|
1312
|
+
width: 50%;
|
|
1313
|
+
max-width: 50%;
|
|
1213
1314
|
appearance: none;
|
|
1214
1315
|
-webkit-appearance: none;
|
|
1215
1316
|
}
|
|
@@ -1293,6 +1394,11 @@
|
|
|
1293
1394
|
.lb-mix-match__modal-overlay--open .lb-mix-match__modal {
|
|
1294
1395
|
transform: translateY(0);
|
|
1295
1396
|
}
|
|
1397
|
+
|
|
1398
|
+
.lb-mix-match__variant-select {
|
|
1399
|
+
width: 80%;
|
|
1400
|
+
max-width: 80%;
|
|
1401
|
+
}
|
|
1296
1402
|
}
|
|
1297
1403
|
|
|
1298
1404
|
/* === Reduced Motion === */
|
|
@@ -1303,12 +1409,28 @@
|
|
|
1303
1409
|
transition: none;
|
|
1304
1410
|
}
|
|
1305
1411
|
}
|
|
1306
|
-
`,
|
|
1412
|
+
`,kt=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
|
|
1307
1413
|
|
|
1308
1414
|
.lb-volume__tiers {
|
|
1309
1415
|
display: flex;
|
|
1310
1416
|
flex-direction: column;
|
|
1311
1417
|
gap: 12px;
|
|
1418
|
+
max-height: var(--lb-list-max-height);
|
|
1419
|
+
overflow-y: auto;
|
|
1420
|
+
/* Custom scrollbar \u2014 text colour at 15% opacity (thumb) and 5% (track). */
|
|
1421
|
+
scrollbar-width: thin;
|
|
1422
|
+
scrollbar-color: color-mix(in srgb, var(--lb-text) 15%, transparent)
|
|
1423
|
+
color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
.lb-volume__tiers::-webkit-scrollbar { width: 4px; }
|
|
1427
|
+
.lb-volume__tiers::-webkit-scrollbar-track {
|
|
1428
|
+
background: color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
1429
|
+
border-radius: 2px;
|
|
1430
|
+
}
|
|
1431
|
+
.lb-volume__tiers::-webkit-scrollbar-thumb {
|
|
1432
|
+
background: color-mix(in srgb, var(--lb-text) 15%, transparent);
|
|
1433
|
+
border-radius: 2px;
|
|
1312
1434
|
}
|
|
1313
1435
|
|
|
1314
1436
|
.lb-volume__tier {
|
|
@@ -1413,7 +1535,259 @@
|
|
|
1413
1535
|
}
|
|
1414
1536
|
|
|
1415
1537
|
|
|
1416
|
-
`,
|
|
1538
|
+
`,Bt=`/**
|
|
1539
|
+
* Lime Bundles \u2014 Custom variant-picker dropdown styling.
|
|
1540
|
+
*
|
|
1541
|
+
* Reuses existing CSS variables: no new merchant-configurable surface.
|
|
1542
|
+
* --lb-variant-border-{width,color}, --lb-variant-radius, --lb-variant-chevron
|
|
1543
|
+
* --lb-bg, --lb-text, --lb-primary-color
|
|
1544
|
+
*
|
|
1545
|
+
* Mix-match modal context overrides via .lb-mix-match__modal scope to use
|
|
1546
|
+
* --lb-picker-variant-* and --lb-picker-bg.
|
|
1547
|
+
*/
|
|
1548
|
+
|
|
1549
|
+
/* Hide the native <select> while keeping it form-serializable and focusable
|
|
1550
|
+
programmatically. The .lb-dropdown-state marker is added by JS at bind
|
|
1551
|
+
time, so this rule matches every variant-select class (main widget,
|
|
1552
|
+
mix-match modal, future bundle types). aria-hidden + tabindex=-1
|
|
1553
|
+
(also set in JS) remove it from the accessibility tree. */
|
|
1554
|
+
.lb-dropdown-state {
|
|
1555
|
+
position: absolute !important;
|
|
1556
|
+
width: 1px !important;
|
|
1557
|
+
height: 1px !important;
|
|
1558
|
+
padding: 0 !important;
|
|
1559
|
+
margin: -1px !important;
|
|
1560
|
+
overflow: hidden !important;
|
|
1561
|
+
clip: rect(0 0 0 0) !important;
|
|
1562
|
+
white-space: nowrap !important;
|
|
1563
|
+
border: 0 !important;
|
|
1564
|
+
pointer-events: none !important;
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
/* Shell fills its parent column. */
|
|
1568
|
+
.lb-dropdown {
|
|
1569
|
+
position: relative;
|
|
1570
|
+
display: inline-block;
|
|
1571
|
+
width: 100%;
|
|
1572
|
+
max-width: 100%;
|
|
1573
|
+
font-family: inherit;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/* Trigger styled identically to the closed-state native select */
|
|
1577
|
+
.lb-dropdown-trigger {
|
|
1578
|
+
display: inline-flex;
|
|
1579
|
+
align-items: center;
|
|
1580
|
+
justify-content: space-between;
|
|
1581
|
+
gap: 8px;
|
|
1582
|
+
width: 100%;
|
|
1583
|
+
border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
|
|
1584
|
+
border-radius: var(--lb-variant-radius);
|
|
1585
|
+
padding: 8px 12px;
|
|
1586
|
+
font-size: 12px;
|
|
1587
|
+
line-height: 16px;
|
|
1588
|
+
color: var(--lb-text);
|
|
1589
|
+
background: var(--lb-bg);
|
|
1590
|
+
font-family: inherit;
|
|
1591
|
+
cursor: pointer;
|
|
1592
|
+
appearance: none;
|
|
1593
|
+
-webkit-appearance: none;
|
|
1594
|
+
text-align: start;
|
|
1595
|
+
transition: border-color 120ms ease;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
.lb-dropdown-trigger:focus-visible {
|
|
1599
|
+
outline: 2px solid var(--lb-primary-color);
|
|
1600
|
+
outline-offset: 2px;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
.lb-dropdown-trigger[aria-expanded="true"] {
|
|
1604
|
+
border-color: var(--lb-text);
|
|
1605
|
+
}
|
|
1606
|
+
|
|
1607
|
+
.lb-dropdown-trigger-value {
|
|
1608
|
+
flex: 1 1 auto;
|
|
1609
|
+
white-space: nowrap;
|
|
1610
|
+
overflow: hidden;
|
|
1611
|
+
text-overflow: ellipsis;
|
|
1612
|
+
text-align: start;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.lb-dropdown-chevron {
|
|
1616
|
+
flex: 0 0 auto;
|
|
1617
|
+
width: 12px;
|
|
1618
|
+
height: 12px;
|
|
1619
|
+
background: var(--lb-variant-chevron) center / contain no-repeat;
|
|
1620
|
+
transition: transform 120ms ease;
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1623
|
+
.lb-dropdown-trigger[aria-expanded="true"] .lb-dropdown-chevron {
|
|
1624
|
+
transform: rotate(180deg);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/* Popover panel \u2014 position: absolute against the .lb-dropdown shell
|
|
1628
|
+
(already position: relative). Top/left/width come from CSS so we
|
|
1629
|
+
never depend on JS having set inline coords by the time the panel
|
|
1630
|
+
becomes visible. JS only sets max-height. */
|
|
1631
|
+
.lb-dropdown-listbox {
|
|
1632
|
+
position: absolute;
|
|
1633
|
+
left: 0;
|
|
1634
|
+
/* Default to below-trigger placement so the panel doesn't overlap the
|
|
1635
|
+
trigger if data-placement is missing for any reason. The explicit
|
|
1636
|
+
[data-placement="down"|"up"] rules below override this. */
|
|
1637
|
+
top: calc(100% + 4px);
|
|
1638
|
+
width: 100%;
|
|
1639
|
+
z-index: 9999;
|
|
1640
|
+
margin: 0;
|
|
1641
|
+
padding: 4px 0;
|
|
1642
|
+
list-style: none;
|
|
1643
|
+
background: var(--lb-bg);
|
|
1644
|
+
color: var(--lb-text);
|
|
1645
|
+
border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
|
|
1646
|
+
border-radius: var(--lb-variant-radius);
|
|
1647
|
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
|
1648
|
+
overflow-y: auto;
|
|
1649
|
+
overflow-x: hidden;
|
|
1650
|
+
/* Custom scrollbar \u2014 text colour at 15% opacity (thumb) and 5% (track). */
|
|
1651
|
+
scrollbar-width: thin;
|
|
1652
|
+
scrollbar-color: color-mix(in srgb, var(--lb-text) 15%, transparent)
|
|
1653
|
+
color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
1654
|
+
animation: lb-dropdown-in-down 120ms ease-out;
|
|
1655
|
+
transform-origin: top center;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
.lb-dropdown-listbox[data-placement="down"] {
|
|
1659
|
+
top: calc(100% + 4px);
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
.lb-dropdown-listbox[data-placement="up"] {
|
|
1663
|
+
top: auto;
|
|
1664
|
+
bottom: calc(100% + 4px);
|
|
1665
|
+
animation-name: lb-dropdown-in-up;
|
|
1666
|
+
transform-origin: bottom center;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
/* When portaled out of the .lb-dropdown shell (mix-match modal context:
|
|
1670
|
+
.lb-mix-match__modal applies translateY which would otherwise trap
|
|
1671
|
+
position:fixed), switch to fixed and let JS set viewport coords. */
|
|
1672
|
+
.lb-dropdown-listbox[data-lb-dropdown-portal] {
|
|
1673
|
+
position: fixed;
|
|
1674
|
+
top: auto;
|
|
1675
|
+
left: auto;
|
|
1676
|
+
bottom: auto;
|
|
1677
|
+
width: auto;
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
/* Custom scrollbar \u2014 Webkit/Blink: exact 4px width */
|
|
1681
|
+
.lb-dropdown-listbox::-webkit-scrollbar {
|
|
1682
|
+
width: 4px;
|
|
1683
|
+
}
|
|
1684
|
+
.lb-dropdown-listbox::-webkit-scrollbar-track {
|
|
1685
|
+
background: color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
1686
|
+
border-radius: 2px;
|
|
1687
|
+
}
|
|
1688
|
+
.lb-dropdown-listbox::-webkit-scrollbar-thumb {
|
|
1689
|
+
background: color-mix(in srgb, var(--lb-text) 15%, transparent);
|
|
1690
|
+
border-radius: 2px;
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
/* Options */
|
|
1694
|
+
.lb-dropdown-option {
|
|
1695
|
+
padding: 8px 12px;
|
|
1696
|
+
font-size: 12px;
|
|
1697
|
+
line-height: 16px;
|
|
1698
|
+
cursor: pointer;
|
|
1699
|
+
white-space: nowrap;
|
|
1700
|
+
overflow: hidden;
|
|
1701
|
+
text-overflow: ellipsis;
|
|
1702
|
+
color: var(--lb-text);
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
.lb-dropdown-option[aria-selected="true"] {
|
|
1706
|
+
font-weight: 600;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
.lb-dropdown-option.is-active,
|
|
1710
|
+
.lb-dropdown-option:hover:not([aria-disabled="true"]) {
|
|
1711
|
+
background: color-mix(in srgb, var(--lb-text) 2%, transparent);
|
|
1712
|
+
}
|
|
1713
|
+
|
|
1714
|
+
.lb-dropdown-option[aria-disabled="true"] {
|
|
1715
|
+
opacity: 0.4;
|
|
1716
|
+
cursor: not-allowed;
|
|
1717
|
+
}
|
|
1718
|
+
|
|
1719
|
+
/* Animations */
|
|
1720
|
+
@keyframes lb-dropdown-in-down {
|
|
1721
|
+
from { opacity: 0; transform: translateY(-4px) scale(0.98); }
|
|
1722
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
@keyframes lb-dropdown-in-up {
|
|
1726
|
+
from { opacity: 0; transform: translateY(4px) scale(0.98); }
|
|
1727
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1731
|
+
.lb-dropdown-listbox { animation: none; }
|
|
1732
|
+
.lb-dropdown-chevron { transition: none; }
|
|
1733
|
+
.lb-dropdown-trigger { transition: none; }
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1736
|
+
/* Forced-colors mode (Windows high-contrast) */
|
|
1737
|
+
@media (forced-colors: active) {
|
|
1738
|
+
.lb-dropdown-trigger {
|
|
1739
|
+
border-color: ButtonBorder;
|
|
1740
|
+
color: ButtonText;
|
|
1741
|
+
background: ButtonFace;
|
|
1742
|
+
}
|
|
1743
|
+
.lb-dropdown-listbox {
|
|
1744
|
+
border-color: ButtonBorder;
|
|
1745
|
+
background: Canvas;
|
|
1746
|
+
color: CanvasText;
|
|
1747
|
+
}
|
|
1748
|
+
.lb-dropdown-option.is-active {
|
|
1749
|
+
background: Highlight;
|
|
1750
|
+
color: HighlightText;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/* Mix-match modal context \u2014 use picker-scoped variables.
|
|
1755
|
+
No CSS fallbacks: --lb-picker-* are always emitted by bundle-widget.liquid
|
|
1756
|
+
because WidgetConfig.parse() fully hydrates the merchant config.
|
|
1757
|
+
See docs/solutions/ui-bugs/widget-css-single-source-defaults.md. */
|
|
1758
|
+
.lb-mix-match__modal .lb-dropdown-trigger {
|
|
1759
|
+
border-color: var(--lb-picker-variant-border-color);
|
|
1760
|
+
border-width: var(--lb-picker-variant-border-width);
|
|
1761
|
+
border-radius: var(--lb-picker-variant-radius);
|
|
1762
|
+
background: var(--lb-picker-bg);
|
|
1763
|
+
color: var(--lb-picker-text);
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
.lb-mix-match__modal .lb-dropdown-chevron {
|
|
1767
|
+
background-image: var(--lb-picker-variant-chevron);
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
/* Listbox is portaled out of the transformed .lb-mix-match__modal up to
|
|
1771
|
+
its [data-modal-overlay] parent, so picker-scoped rules anchor on the
|
|
1772
|
+
overlay attribute, not the modal class. */
|
|
1773
|
+
[data-modal-overlay] > .lb-dropdown-listbox {
|
|
1774
|
+
border-color: var(--lb-picker-variant-border-color);
|
|
1775
|
+
border-width: var(--lb-picker-variant-border-width);
|
|
1776
|
+
border-radius: var(--lb-picker-variant-radius);
|
|
1777
|
+
background: var(--lb-picker-bg);
|
|
1778
|
+
color: var(--lb-picker-text);
|
|
1779
|
+
scrollbar-color: color-mix(in srgb, var(--lb-picker-text) 15%, transparent)
|
|
1780
|
+
color-mix(in srgb, var(--lb-picker-text) 2%, transparent);
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
[data-modal-overlay] > .lb-dropdown-listbox::-webkit-scrollbar-track {
|
|
1784
|
+
background: color-mix(in srgb, var(--lb-picker-text) 2%, transparent);
|
|
1785
|
+
border-radius: 2px;
|
|
1786
|
+
}
|
|
1787
|
+
[data-modal-overlay] > .lb-dropdown-listbox::-webkit-scrollbar-thumb {
|
|
1788
|
+
background: color-mix(in srgb, var(--lb-picker-text) 15%, transparent);
|
|
1789
|
+
}
|
|
1790
|
+
`,St=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
|
|
1417
1791
|
|
|
1418
1792
|
.lb-bundle-widget--loading {
|
|
1419
1793
|
display: block;
|
|
@@ -1509,10 +1883,10 @@
|
|
|
1509
1883
|
animation: none;
|
|
1510
1884
|
}
|
|
1511
1885
|
}
|
|
1512
|
-
`;var
|
|
1513
|
-
`),this.shadow.appendChild(t),this.shopCustomCss){let
|
|
1514
|
-
<style>${
|
|
1515
|
-
<style>${
|
|
1886
|
+
`;var mn=e=>`lb_cart_id:${e}`;function gn(e){if(e)return e.trim()||null;if(typeof document<"u"){let t=document.querySelector('meta[name="shopify:product-handle"]');if(t?.content)return t.content.trim()||null}if(typeof window<"u"){let t=window.location.pathname.match(/\/products\/([^/?#]+)/);if(t?.[1])return decodeURIComponent(t[1])}return null}var le=class extends HTMLElement{static observedAttributes=["shop-domain","storefront-token","bundle-gid","product-handle","app-url","analytics","locale"];shadow;bundles=[];abortController=null;impressionCleanups=[];renderCleanups=[];shopCustomCss=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.fetchBundle()}disconnectedCallback(){this.abortController?.abort(),this.teardownImpressions(),this.teardownRenderers()}teardownImpressions(){for(let t of this.impressionCleanups)t();this.impressionCleanups=[]}teardownRenderers(){for(let t of this.renderCleanups)t();this.renderCleanups=[]}attributeChangedCallback(t,r,i){r===i||!this.isConnected||(t==="bundle-gid"||t==="product-handle"||t==="shop-domain"||t==="storefront-token")&&this.shopDomain&&this.storefrontToken&&this.fetchBundle()}get shopDomain(){return this.getAttribute("shop-domain")??""}get storefrontToken(){return this.getAttribute("storefront-token")??""}get bundleGid(){return this.getAttribute("bundle-gid")??""}get productHandleAttr(){return this.getAttribute("product-handle")??""}get appUrl(){return this.getAttribute("app-url")??""}get analyticsEnabled(){return this.getAttribute("analytics")!=="false"}async fetchBundle(){if(!this.shopDomain||!this.storefrontToken){this.renderError("Missing required attributes: shop-domain, storefront-token");return}this.abortController?.abort();let t=new AbortController;this.abortController=t,this.renderLoading();let r=ke({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let i,n=!1;if(this.bundleGid)n=!0,i=this.fetchSingleBundle(r,t.signal);else{let l=gn(this.productHandleAttr);if(!l){this.teardownImpressions(),this.renderError("No bundle-gid or product-handle provided, and the current URL doesn't match /products/<handle>.");return}i=this.fetchProductBundles(r,t.signal,l)}let a=r.query(je,void 0,{signal:t.signal}).catch(()=>null);if(await i,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){ot(this.shopDomain,o.shop.metafield.value);let l=Se(o.shop.metafield.value);l.ok&&(this.shopCustomCss=l.css)}await this.applyABVariants(),this.renderBundles()}catch(i){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(i instanceof Error?i.message:"Failed to load bundle")}}async applyABVariants(){if(!this.appUrl||this.bundles.length===0)return;let t=await Promise.all(this.bundles.map(async r=>{if(!r.abTestId||!r.abVariantB)return r;try{if((await it(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return Je(r)}catch(i){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,i)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let i=await t.query(ze,{id:this.bundleGid},{signal:r});if(!i.metaobject){this.bundles=[];return}let n=Be(i.metaobject.id,i.metaobject.fields);this.bundles=n?[n]:[]}async fetchProductBundles(t,r,i){let n=await t.query(Ke,{handle:i},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],o=[];for(let l of a){let d=Be(l.id,l.fields);d&&o.push(d)}this.bundles=o}handleAddToCart=async(t,r)=>{let i=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(i);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=ke({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),i=window.localStorage,n=mn(this.shopDomain),a=i?.getItem(n)??null;try{let o=null;if(a){let d=(await r.query(Ye,{cartId:a,lines:t})).cartLinesAdd;d?.userErrors?.length?i?.removeItem(n):d?.cart&&(o=d.cart.checkoutUrl)}if(!o){let d=(await r.query(Ge,{input:{lines:t}})).cartCreate;d?.cart&&(i?.setItem(n,d.cart.id),o=d.cart.checkoutUrl)}o?window.location.assign(o):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(o){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:o instanceof Error?o.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=r.reduce((a,o)=>a+o.quantity,0),n=r.reduce((a,o)=>{let d=t.products.find(u=>u.variants.nodes.some(c=>c.id===o.merchandiseId))?.variants.nodes.find(u=>u.id===o.merchandiseId),p=d?parseFloat(d.price.amount):0;return a+p*o.quantity},0);et({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:i,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[Pe,Ct,_t,kt,Bt].join(`
|
|
1887
|
+
`),this.shadow.appendChild(t),this.shopCustomCss){let i=document.createElement("style");i.setAttribute("data-lime-bundles","shop-custom-css"),i.textContent=this.shopCustomCss,this.shadow.appendChild(i)}for(let i of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",i.title),n.setAttribute("data-bundle-type",i.bundleType),n.setAttribute("data-bundle-gid",i.id),Qe(n,i.widgetConfig),this.renderCleanups.push(ve(n));let a=l=>this.handleAddToCart(i,l),o=l=>this.renderCleanups.push(l);switch(i.bundleType){case"fixed":st(n,i,a,o);break;case"mix_match":bt(n,i,a,o);break;case"volume":ft(n,i,a,o);break}this.shadow.appendChild(n),this.setupImpressionFor(i,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(i=>i.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=tt(r,()=>{Ze({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(i)}renderLoading(){this.shadow.innerHTML=`
|
|
1888
|
+
<style>${Pe}</style>
|
|
1889
|
+
<style>${St}</style>
|
|
1516
1890
|
<div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
|
|
1517
1891
|
<div class="lb-skeleton lb-skeleton--title"></div>
|
|
1518
1892
|
<div class="lb-skeleton--products">
|
|
@@ -1546,5 +1920,5 @@
|
|
|
1546
1920
|
<div class="lb-skeleton lb-skeleton--cta"></div>
|
|
1547
1921
|
</div>
|
|
1548
1922
|
</div>
|
|
1549
|
-
`}renderError(t){this.shadow.innerHTML="",this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:t,code:"LOAD_ERROR"},bubbles:!0,composed:!0}))}};typeof customElements<"u"&&!customElements.get("lime-bundle")&&customElements.define("lime-bundle",
|
|
1923
|
+
`}renderError(t){this.shadow.innerHTML="",this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:t,code:"LOAD_ERROR"},bubbles:!0,composed:!0}))}};typeof customElements<"u"&&!customElements.get("lime-bundle")&&customElements.define("lime-bundle",le);return Ot(fn);})();
|
|
1550
1924
|
//# sourceMappingURL=lime-bundle.global.js.map
|