@lime-bundles/widget 3.2.2 → 3.3.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/README.md +19 -0
- package/dist/index.cjs +54 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +57 -7
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +21 -21
- package/dist/lime-bundle.global.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var LimeBundles=(()=>{var Me=Object.defineProperty;var
|
|
1
|
+
"use strict";var LimeBundles=(()=>{var Me=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Gt=Object.prototype.hasOwnProperty;var Yt=(e,t)=>{for(var r in t)Me(e,r,{get:t[r],enumerable:!0})},Xt=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Kt(t))!Gt.call(e,n)&&n!==r&&Me(e,n,{get:()=>t[n],enumerable:!(o=Qt(t,n))||o.enumerable});return e};var Jt=e=>Xt(Me({},"__esModule",{value:!0}),e);var Un={};Yt(Un,{LimeBundleElement:()=>fe,trackInputMode:()=>Le});var Zt=Object.defineProperty,ot=(e,t)=>{for(var r in t)Zt(e,r,{get:t[r],enumerable:!0})},Ge=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},er="2025-10";async function tr(e){if(e)return typeof e=="function"?await e():e}function it(e){return!!(e.country||e.language||e.buyer)}function De(e){let t=e.apiVersion??er,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(o,n,a){let i={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(i["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let l=await tr(e.buyer),s={...n??{}};e.country&&(s.country=e.country),e.language&&(s.language=e.language),l&&(s.buyer=l);let d=await fetch(r,{method:"POST",headers:i,body:JSON.stringify({query:o,variables:s}),signal:a?.signal});if(!d.ok)throw new Ge([{message:`Storefront API error: ${d.status} ${d.statusText}`}]);let p=await d.json();if(p.errors?.length)throw new Ge(p.errors);return p.data}}}function at(e){return e.replace(/query\s+(\w+)\s*(?:\(([^)]*)\))?\s*\{/,(t,r,o)=>{let n=(o||"").trim(),a="$country: CountryCode, $language: LanguageCode, $buyer: BuyerInput",i=n?`${n}, ${a}`:a;return`query ${r}(${i}) @inContext(country: $country, language: $language, buyer: $buyer) {`})}var lt=`#graphql
|
|
2
2
|
query BundleMetaobject($id: ID!) {
|
|
3
3
|
metaobject(id: $id) {
|
|
4
4
|
id
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
`,
|
|
100
|
+
`,st=`#graphql
|
|
101
101
|
query ShopCustomCss {
|
|
102
102
|
shop {
|
|
103
103
|
metafield(namespace: "$app", key: "custom_css") {
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
`,
|
|
108
|
+
`,dt=`#graphql
|
|
109
109
|
query BundlesForProduct($handle: String!) {
|
|
110
110
|
product(handle: $handle) {
|
|
111
111
|
id
|
|
@@ -215,31 +215,31 @@
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
`,
|
|
218
|
+
`,ct=`#graphql
|
|
219
219
|
mutation CartCreate($input: CartInput!) {
|
|
220
220
|
cartCreate(input: $input) {
|
|
221
221
|
cart { id checkoutUrl }
|
|
222
222
|
userErrors { field message }
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
`,
|
|
225
|
+
`,ut=`#graphql
|
|
226
226
|
mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
|
|
227
227
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
228
228
|
cart { id checkoutUrl }
|
|
229
229
|
userErrors { field message }
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
`,ct={min:1,max:99},ae=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},J={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",showLowStockBadge:!0,lowStockThreshold:10,lowStockBgColor:"#FEF3C7",lowStockTextColor:"#92400E",showSearch:!0,mixMatchShowQuantitySelector:!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,pickerQtyStepperBorderWidth:1,pickerQtyStepperBorderColor:"#1A1A1A",pickerQtyStepperBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function Zt(e){if(!e||typeof e!="object")return J;let t=e;return{...J,...t,defaultTier:er(t.defaultTier),header:{...J.header,...t.header??{}},layout:{...J.layout,...t.layout??{}},productList:{...J.productList,...t.productList??{}},pricing:{...J.pricing,...t.pricing??{}},cta:{...J.cta,...t.cta??{}},savingsBar:{...J.savingsBar,...t.savingsBar??{}},countdown:{...J.countdown,...t.countdown??{}},popularBadge:{...J.popularBadge,...t.popularBadge??{}}}}function er(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:J.defaultTier}function tr(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,showLowStockBadge:e.showLowStockBadge,lowStockThreshold:e.lowStockThreshold,lowStockBgColor:e.lowStockBgColor,lowStockTextColor:e.lowStockTextColor,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,pickerQtyStepperBorderWidth:e.pickerQtyStepperBorderWidth,pickerQtyStepperBorderColor:e.pickerQtyStepperBorderColor,pickerQtyStepperBorderRadius:e.pickerQtyStepperBorderRadius,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 rr={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",pickerQtyStepperBorderWidth:"--lb-picker-qty-stepper-border-width",pickerQtyStepperBorderColor:"--lb-picker-qty-stepper-border-color",pickerQtyStepperBorderRadius:"--lb-picker-qty-stepper-radius"},nr=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","pickerQtyStepperBorderWidth","pickerQtyStepperBorderRadius"]);function ut(e,t){let r=tr(t);for(let[a,i]of Object.entries(rr)){let l=r[a];if(l==null)continue;let d=nr.has(a)?`${l}px`:String(l);e.style.setProperty(i,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",Ye(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",Ye(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 o=Xe(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",o.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",o.imgFit),e.style.setProperty("--lb-thumbnail-img-height",o.imgHeight);let n=Xe(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 Ye(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 Xe(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 or=new Set(["fixed","mix_match","volume"]),ir=new Set(["active"]);function Fe(e,t){try{return ar(e,t)}catch(r){if(r instanceof ae)return null;throw r}}function ar(e,t){let r=new Map(t.map(k=>[k.key,k])),o=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!or.has(n))throw new ae(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let i=n;if(!a||!ir.has(a))throw new ae(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,c=r.get("ends_at")?.value??null,p=new Date;if(d){let k=new Date(d);if(Number.isNaN(k.getTime()))throw new ae(`Invalid starts_at: ${d}`,"invalid_type");if(k>p)throw new ae(`Bundle not yet started: starts_at=${d}`,"not_started")}if(c){let k=new Date(c);if(Number.isNaN(k.getTime()))throw new ae(`Invalid ends_at: ${c}`,"invalid_type");if(k<p)throw new ae(`Bundle has expired: ends_at=${c}`,"expired")}let u=lr(r),C=dr(r),m=sr(r),g={id:e,title:o,description:r.get("description")?.value||null,status:l,products:u,discountConfig:C,widgetConfig:m,startsAt:d,endsAt:c,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:cr(r),productQuantities:Je(r,"product_quantities"),variantQuantities:Je(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:pr(r)};switch(i){case"fixed":return{...g,bundleType:"fixed"};case"volume":return{...g,bundleType:"volume",volumeTiers:br(r)};case"mix_match":return{...g,bundleType:"mix_match",minQuantity:hr(r,"min_quantity",{min:1}),maxQuantity:null,productRules:ur(r)}}}function lr(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 o=e.get("collection");if(o?.references?.nodes)for(let n of o.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function dr(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 sr(e){return Zt(ce(e,"widget_config"))}function cr(e){let t=ce(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let o of t)Array.isArray(o)?r.push(o.filter(n=>typeof n=="string")):r.push([]);return r}function Je(e,t){let r=ce(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let o={};for(let[n,a]of Object.entries(r)){let i=typeof a=="number"?a:Number(a);Number.isFinite(i)&&i>=0&&i<=99&&(o[n]=Math.floor(i))}return o}function ur(e){let t=ce(e,"product_rules");if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object"||Array.isArray(n))continue;let{min:a,max:i}=n,l=typeof a=="number"?a:Number(a),d=typeof i=="number"?i:Number(i);if(!Number.isFinite(l)||!Number.isFinite(d))continue;let c=Math.max(1,Math.min(99,Math.floor(l))),p=Math.max(c,Math.min(99,Math.floor(d)));r[o]={min:c,max:p}}return r}function pr(e){if(!e.get("ab_test_id")?.value)return null;let r={},o=e.get("ab_title")?.value;o&&(r.title=o);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,i=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&i){let d=parseFloat(i);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ce(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(pt)),Object.keys(r).length===0?null:r}function br(e){let t=ce(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(pt):[]}function pt(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 ce(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function hr(e,t,r={}){let o=e.get(t)?.value;if(!o)return null;let n=parseInt(o,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function ye(e,t,r){let o=e.variantQuantities[r];return o!==void 0?o:e.productQuantities[t]??1}function bt(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,o=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:o,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:o,discountConfig:n};case"fixed":return{...e,title:r,description:o,discountConfig:n}}}async function ht(e,t){await ft(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 mt(e,t){await ft(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function gt(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(o=>{for(let n of o)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function ft(e,t){let r=`${e.appUrl}/api/analytics`,o=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,o)}catch{}}}var mr=!1;function gr(){return typeof document<"u"}function fr(){if(!gr())return!1;if(mr)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var Ze="lb_session",vr=720*60*60,xr=720*60*60;function vt(e){return`__Host-_lb_ab_${e}`}async function xt(e,t){if(typeof document>"u")return null;let r=wr(t);if(r&&r.testId===e)return{variant:r.variant,testId:e,persisted:!0};if(!fr())return{variant:"A",testId:e,persisted:!1};let o=Cr(),n=kr(o,e);return yr(t,e,n),{variant:n,testId:e,persisted:!0}}function wr(e){if(typeof document>"u")return null;let r=`${vt(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[i,l]=a.split("|");return i!=="A"&&i!=="B"||!l?null:{testId:l,variant:i}}function yr(e,t,r){if(typeof document>"u")return;let o=vt(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${o}=${n}; Path=/; Max-Age=${xr}; SameSite=Lax; Secure`}function Cr(){if(typeof document>"u")return et();let t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Ze}=`))?.split("=")[1];if(t)return t;let r=et();return document.cookie=`${Ze}=${r}; path=/; max-age=${vr}; SameSite=Lax; Secure`,r}function et(){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 kr(e,t){let r=e+":"+t,o=2166136261;for(let n=0;n<r.length;n++)o^=r.charCodeAt(n),o=Math.imul(o,16777619);return(o>>>0)%2===0?"A":"B"}var tt=1e4,_r=[[/@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"]],Br=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function Ve(e){if(e.length>tt)return{ok:!1,error:`CSS exceeds ${tt.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 i=parseInt(a,16);return i<0||i>1114111?"\uFFFD":String.fromCodePoint(i)}),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 _r)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,o;for(;(o=r.exec(t))!==null;){let n=o[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!Br.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var Sr="lb-custom-css-";function wt(e,t){if(typeof document>"u"||!t)return!1;let r=Ve(t);if(!r.ok||!r.css.trim())return!1;let o=Sr+Ar(e),n=document.getElementById(o);return n||(n=document.createElement("style"),n.id=o,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function Ar(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 Er(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 Tr={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 le(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let o=parseFloat(e.amount);if(!Number.isFinite(o))return null;let n=Tr[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",i=Er(o,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${i}/${d}`}function j(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function D(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function yt(e,t){return Math.max(0,e-Math.floor(e*t/100))}function qe(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:o,discountValue:n}=e.discountConfig,a=[],i=0,l=0;for(let u of e.products){let C=u.variants.nodes.find(x=>x.availableForSale)??u.variants.nodes[0];if(!C)continue;let m=j(C.price.amount),g=t[u.id]??1,k=m*g,T=C.compareAtPrice?j(C.compareAtPrice.amount):null;if(a.push({unitCents:m,qty:g,lineCents:k,compareCents:T}),i+=k,o==="percentage"){let x=yt(m,n);l+=x*g}else l+=k}o==="fixed_amount"&&(l=Math.max(0,i-Math.round(n*100)));let d=Math.max(0,i-l),c=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",p="";return r&&d>0&&(o==="percentage"&&n>0?p=`-${Math.round(n)}%`:o==="fixed_amount"&&n>0&&(p=`-${D(Math.round(n*100),c)}`)),{rows:a,totalCents:i,saleCents:l,savingsCents:d,headerBadge:p,currency:c}}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 U=152;function re(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 Ct(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),o=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,i=l=>String(l).padStart(2,"0");return r>0?`${r}d ${i(o)}h ${i(n)}m ${i(a)}s`:`${i(o)}h ${i(n)}m ${i(a)}s`}var Oe={};ot(Oe,{computePosition:()=>Pr,emptyTypeAheadState:()=>Fr,handleKey:()=>Rr,pushTypeAheadChar:()=>Vr});var Lr=4;function Pr({trigger:e,viewportHeight:t,desiredHeight:r,margin:o=Lr,clip:n}){let a=n?Math.min(t,n.bottom):t,i=n?Math.max(0,n.top):0,l=Math.max(0,a-e.bottom-o),d=Math.max(0,e.top-i-o),c=r<=l?"down":d>l?"up":"down",u=Math.min(r,c==="down"?l:d),C=c==="down"?e.bottom+o:e.top-o-u;return{placement:c,maxHeight:u,offsetTop:C,offsetLeft:e.left,width:e.width}}var Ie={type:"passthrough",preventDefault:!1};function Re(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function rt(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function Mr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t+r)%e.length;if(!e[o].disabled)return o}return t}function Ir(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t-r+e.length)%e.length;if(!e[o].disabled)return o}return t}function nt(e){return e.length===1&&e!==" "&&/\S/.test(e)}function Rr(e,t){if(e.ctrlKey||e.metaKey||e.altKey)return Ie;let{key:r}=e,{isOpen:o,activeIndex:n,selectedIndex:a,options:i}=t;if(!o)switch(r){case"Enter":case" ":case"ArrowDown":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Re(i),preventDefault:!0};case"ArrowUp":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:rt(i),preventDefault:!0};default:return nt(r)?{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Re(i),preventDefault:!0}:Ie}switch(r){case"ArrowDown":return{type:"move-active",activeIndex:Mr(i,n),preventDefault:!0};case"ArrowUp":return{type:"move-active",activeIndex:Ir(i,n),preventDefault:!0};case"Home":return{type:"move-active",activeIndex:Re(i),preventDefault:!0};case"End":return{type:"move-active",activeIndex:rt(i),preventDefault:!0};case"Enter":case" ":return n>=0&&!i[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 nt(r)?{type:"type-ahead",char:r,preventDefault:!1}:Ie}}var Dr=500;function Fr(){return{buffer:"",lastTime:0}}function Vr(e,t,r,o,n=Dr){if(t.length!==1)return{newState:e,matchedIndex:null};let i=(r-e.lastTime>n?"":e.buffer)+t.toLowerCase(),l={buffer:i,lastTime:r};for(let d=0;d<o.length;d++){let c=o[d];if(!c.disabled&&c.label.toLowerCase().startsWith(i))return{newState:l,matchedIndex:d}}return{newState:l,matchedIndex:null}}var qr={};ot(qr,{findVariantByOptions:()=>Or,isOptionValueAvailable:()=>Nr,toPickerVariant:()=>Hr});function Or(e,t){if(e.length===0)return null;for(let r of e){if(r.optionValues.length!==t.length)continue;let o=!0;for(let n=0;n<r.optionValues.length;n++)if(r.optionValues[n]!==t[n]){o=!1;break}if(o)return r}return null}function Nr(e,t,r,o){for(let n of e){if(!n.available||n.optionValues[t]!==r)continue;let a=!0;for(let i=0;i<n.optionValues.length;i++)if(i!==t&&n.optionValues[i]!==o[i]){a=!1;break}if(a)return!0}return!1}function Hr(e){return{id:e.id,optionValues:e.selectedOptions.map(t=>t.value),available:e.availableForSale}}function Z(e,t){return e.availableForSale?e.currentlyNotInStock||e.quantityAvailable==null?!0:e.quantityAvailable>=t:!1}function ue(e,t,r,o){return!o||e.quantityAvailable==null||e.quantityAvailable<t?!1:e.quantityAvailable<=r}function Ne(e,t,r){if(!e.availableForSale)return 0;if(e.currentlyNotInStock)return Math.max(0,t-r);let o=e.quantityAvailable==null?Number.POSITIVE_INFINITY:e.quantityAvailable;return Math.max(0,Math.min(t,o)-r)}var{computePosition:Ur,emptyTypeAheadState:$r,handleKey:Wr,pushTypeAheadChar:zr}=Oe,jr=32,Qr=8,Kr=8,K=[];function _e(e){let t=e.composedPath();for(let r=K.length-1;r>=0;r--){let o=K[r];!t.includes(o.shell)&&!t.includes(o.listbox)&&o.close()}}function kt(){for(let e=K.length-1;e>=0;e--)K[e].close()}var Be=!1;function Gr(){Be||(document.addEventListener("pointerdown",_e,!0),window.addEventListener("scroll",_e,!0),window.addEventListener("resize",kt),Be=!0)}function Yr(){!Be||K.length>0||(document.removeEventListener("pointerdown",_e,!0),window.removeEventListener("scroll",_e,!0),window.removeEventListener("resize",kt),Be=!1)}function ke(e){let t=[];for(let r=0;r<e.options.length;r++){let o=e.options[r];t.push({disabled:o.disabled,label:o.textContent||o.value})}return t}function Xr(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function Jr(e){let t=e.ownerDocument?.defaultView;if(!t)return null;let r=e.parentElement;for(;r&&r!==e.ownerDocument.body;){let n=t.getComputedStyle(r).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return r;r=r.parentElement}return null}var Zr=["lb-bundle-variant-select","lb-mix-match__variant-select"],en=Zr.map(e=>`select.${e}:not(.lb-dropdown-state)`).join(", ");function tn(e){let t=e;if(e.classList.contains("lb-dropdown-state"))return t.__lbDropdownInstance??null;let r=e.ownerDocument,o=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 i=r.createElement("div");i.className="lb-dropdown",i.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 c=r.createElement("span");c.className="lb-dropdown-trigger-value";let p=r.createElement("span");p.className="lb-dropdown-chevron",p.setAttribute("aria-hidden","true"),l.appendChild(c),l.appendChild(p);let u=r.createElement("ul");u.id=d,u.className="lb-dropdown-listbox",u.setAttribute("role","listbox"),n&&u.setAttribute("aria-label",n),u.hidden=!0,i.appendChild(l),e.parentNode?.insertBefore(i,e.nextSibling);let C=e.closest("[data-modal-overlay]");C?(C.appendChild(u),u.setAttribute("data-lb-dropdown-portal","")):i.appendChild(u);let m=!1,g=-1,k=$r(),T=[],x;function A(){l.disabled=e.disabled;let v=ke(e),b=e.selectedIndex;for(c.textContent=b>=0&&v[b]?v[b].label:"";u.firstChild;)u.removeChild(u.firstChild);T=[];for(let y=0;y<v.length;y++){let R=r.createElement("li");R.id=`${a}-opt-${y}`,R.className="lb-dropdown-option",R.setAttribute("role","option"),R.setAttribute("aria-selected",y===b?"true":"false"),v[y].disabled&&R.setAttribute("aria-disabled","true"),R.setAttribute("data-value",e.options[y].value),R.setAttribute("data-index",String(y)),R.textContent=v[y].label,u.appendChild(R),T.push(R)}}function _(v){if(g>=0&&T[g]&&T[g].classList.remove("is-active"),g=v,v>=0&&T[v]){let b=T[v];b.classList.add("is-active"),l.setAttribute("aria-activedescendant",b.id);let y=b.offsetTop,R=y+b.offsetHeight,ne=u.scrollTop,Y=ne+u.clientHeight;y<ne?u.scrollTop=y:R>Y&&(u.scrollTop=R-u.clientHeight)}else l.setAttribute("aria-activedescendant","")}function q(){let v=l.getBoundingClientRect();if(v.width===0)return!1;let y=Math.min(T.length||1,Kr)*jr+Qr,R=Jr(l),ne=R?(()=>{let ee=R.getBoundingClientRect();return{top:ee.top,bottom:ee.bottom}})():void 0,Y=Ur({trigger:{top:v.top,bottom:v.bottom,left:v.left,width:v.width},viewportHeight:window.innerHeight,desiredHeight:y,clip:ne});return u.setAttribute("data-placement",Y.placement),u.style.maxHeight=`${Y.maxHeight}px`,u.hasAttribute("data-lb-dropdown-portal")&&(u.style.top=`${Y.offsetTop}px`,u.style.left=`${Y.offsetLeft}px`,u.style.width=`${Y.width}px`),!0}function h(){if(m)return;for(let y=K.length-1;y>=0;y--)K[y]!==x&&K[y].close();m=!0,u.hidden=!1,l.setAttribute("aria-expanded","true"),q()||requestAnimationFrame(()=>q());let v=ke(e),b=e.selectedIndex;b>=0&&v[b]&&!v[b].disabled?_(b):_(Xr(v)),K.push(x),K.length===1&&Gr()}function M(v){if(!m)return;m=!1,u.hidden=!0,l.setAttribute("aria-expanded","false"),l.setAttribute("aria-activedescendant",""),g>=0&&T[g]&&T[g].classList.remove("is-active"),g=-1;let b=K.indexOf(x);b>=0&&K.splice(b,1),K.length===0&&Yr(),v&&l.focus()}function L(v){let b=e.options[v];if(!(!b||b.disabled)){if(e.value!==b.value){e.value=b.value;let y=new Event("change",{bubbles:!0});e.dispatchEvent(y)}A(),M(!0)}}function w(v){switch(v.type){case"open":h(),v.activeIndex>=0&&_(v.activeIndex);return;case"close":M(v.restoreFocus);return;case"move-active":_(v.activeIndex);return;case"commit":L(v.index);return;case"type-ahead":{let b=ke(e),y=zr(k,v.char,Date.now(),b);k=y.newState,y.matchedIndex!==null&&(m||h(),_(y.matchedIndex));return}case"passthrough":return;default:{let b=v}}}function B(v){let b=ke(e),y=Wr({key:v.key,ctrlKey:v.ctrlKey,metaKey:v.metaKey,altKey:v.altKey,shiftKey:v.shiftKey},{isOpen:m,activeIndex:g,selectedIndex:e.selectedIndex,options:b});y.preventDefault&&v.preventDefault(),w(y)}function f(v){v.preventDefault(),m?M(!1):h()}function F(v){let b=v.target;for(;b&&b!==u;){if(b.classList?.contains("lb-dropdown-option")){let y=parseInt(b.getAttribute("data-index")??"",10);if(!Number.isNaN(y)){L(y);return}}b=b.parentElement}}function P(v){let b=v.target;for(;b&&b!==u;){if(b.classList?.contains("lb-dropdown-option")){if(b.getAttribute("aria-disabled")==="true")return;let y=parseInt(b.getAttribute("data-index")??"",10);!Number.isNaN(y)&&y!==g&&_(y);return}b=b.parentElement}}function E(){setTimeout(()=>{if(!m)return;let v=o.activeElement??r.activeElement;i.contains(v)||M(!1)},0)}function S(){A()}let I=new MutationObserver(()=>{A()});I.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","value","selected"]});let O=v=>v.preventDefault();l.addEventListener("click",f),l.addEventListener("keydown",B),i.addEventListener("focusout",E),u.addEventListener("mousedown",O),u.addEventListener("click",F),u.addEventListener("mousemove",P),e.addEventListener("change",S);function te(){m&&M(!1),I.disconnect(),l.removeEventListener("click",f),l.removeEventListener("keydown",B),i.removeEventListener("focusout",E),u.removeEventListener("mousedown",O),u.removeEventListener("click",F),u.removeEventListener("mousemove",P),e.removeEventListener("change",S),i.parentNode&&i.parentNode.removeChild(i),u.parentNode&&u.parentNode.removeChild(u),e.classList.remove("lb-dropdown-state"),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),delete t.__lbDropdownInstance}return x={shell:i,listbox:u,select:e,close:()=>M(!1),destroy:te},t.__lbDropdownInstance=x,A(),x}function Se(e){let t=e.querySelectorAll(en),r=[];return t.forEach(o=>{let n=tn(o);n&&r.push(n)}),r}function Ae(e){e.querySelectorAll("select.lb-dropdown-state").forEach(r=>{let o=r.__lbDropdownInstance;o&&o.destroy()})}function pe(e){let t=rn(e);if(t===null||t<=Date.now())return null;let r=t,o=document.createElement("div");o.className="lb-bundle-countdown",o.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),o.appendChild(n);let i=document.createElement("span");i.className="lb-bundle-countdown__timer",i.setAttribute("data-countdown-timer",""),o.appendChild(i);let l=null;function d(){let p=r-Date.now();if(p<=0){o.style.display="none",c();return}i.textContent=Ct(p)}function c(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:o,stop:c}}function rn(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function be(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 o=document.createElement("span");return o.className="lb-cta-spinner",o.setAttribute("data-cta-spinner",""),o.setAttribute("aria-hidden","true"),o.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(o),t}function He(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let o=document.createElement(e);t&&(o.className=t);for(let[n,a]of Object.entries(r))o.setAttribute(n,a);return o}var nn=`
|
|
232
|
+
`;var pt={min:1,max:99},ae=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},J={header:{textColor:"#555555",headerStyle:"solid",gradientStart:"#C1E67A",gradientEnd:"#B2D572",saveBadgeBgColor:"#C1E67A",saveBadgeTextColor:"#555555",saveBadgeBorderColor:"#555555",saveBadgeBorderWidth:2,saveBadgeBorderRadius:4,countdownBgColor:"#B2D57247",countdownTextColor:"#555555"},layout:{backgroundColor:"#FCFCFC",borderColor:"#E5E5E5",borderWidth:1,borderRadius:8},productList:{textColor:"#555555",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:4,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:4,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#E9F1D9",countBubbleTextColor:"#555555"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#C1E67A",buttonTextColor:"#555555",borderWidth:0,borderColor:"#C1E67A",borderRadius:4},savingsBar:{visible:!0,bgColor:"#B2D57247",textColor:"#555555",borderWidth:0,borderColor:"#B2D57247",borderRadius:4},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showLowStockBadge:!0,lowStockThreshold:10,lowStockBgColor:"#FEF3C7",lowStockTextColor:"#92400E",showSearch:!0,mixMatchShowQuantitySelector:!0,pickerBgColor:"#FCFCFC",pickerTextColor:"#555555",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:8,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#E9F1D9",pickerCountBubbleTextColor:"#555555",pickerAddBgColor:"#C1E67A",pickerAddLabelColor:"#555555",pickerAddBorderWidth:0,pickerAddBorderColor:"#C1E67A",pickerAddBorderRadius:4,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#555555",pickerVariantBorderRadius:4,pickerQtyStepperBorderWidth:1,pickerQtyStepperBorderColor:"#555555",pickerQtyStepperBorderRadius:4,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function rr(e){if(!e||typeof e!="object")return J;let t=e;return{...J,...t,defaultTier:nr(t.defaultTier),header:{...J.header,...t.header??{}},layout:{...J.layout,...t.layout??{}},productList:{...J.productList,...t.productList??{}},pricing:{...J.pricing,...t.pricing??{}},cta:{...J.cta,...t.cta??{}},savingsBar:{...J.savingsBar,...t.savingsBar??{}},countdown:{...J.countdown,...t.countdown??{}},popularBadge:{...J.popularBadge,...t.popularBadge??{}}}}function nr(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:J.defaultTier}function or(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,showLowStockBadge:e.showLowStockBadge,lowStockThreshold:e.lowStockThreshold,lowStockBgColor:e.lowStockBgColor,lowStockTextColor:e.lowStockTextColor,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,pickerQtyStepperBorderWidth:e.pickerQtyStepperBorderWidth,pickerQtyStepperBorderColor:e.pickerQtyStepperBorderColor,pickerQtyStepperBorderRadius:e.pickerQtyStepperBorderRadius,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 ir={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",pickerQtyStepperBorderWidth:"--lb-picker-qty-stepper-border-width",pickerQtyStepperBorderColor:"--lb-picker-qty-stepper-border-color",pickerQtyStepperBorderRadius:"--lb-picker-qty-stepper-radius"},ar=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","pickerQtyStepperBorderWidth","pickerQtyStepperBorderRadius"]);function bt(e,t){let r=or(t);for(let[a,i]of Object.entries(ir)){let l=r[a];if(l==null)continue;let s=ar.has(a)?`${l}px`:String(l);e.style.setProperty(i,s)}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",Ye(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",Ye(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 o=Xe(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",o.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",o.imgFit),e.style.setProperty("--lb-thumbnail-img-height",o.imgHeight);let n=Xe(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 Ye(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 Xe(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 lr=new Set(["fixed","mix_match","volume"]),sr=new Set(["active"]);function Ve(e,t){try{return dr(e,t)}catch(r){if(r instanceof ae)return null;throw r}}function dr(e,t){let r=new Map(t.map(k=>[k.key,k])),o=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!lr.has(n))throw new ae(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let i=n;if(!a||!sr.has(a))throw new ae(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,s=r.get("starts_at")?.value??null,d=r.get("ends_at")?.value??null,p=new Date;if(s){let k=new Date(s);if(Number.isNaN(k.getTime()))throw new ae(`Invalid starts_at: ${s}`,"invalid_type");if(k>p)throw new ae(`Bundle not yet started: starts_at=${s}`,"not_started")}if(d){let k=new Date(d);if(Number.isNaN(k.getTime()))throw new ae(`Invalid ends_at: ${d}`,"invalid_type");if(k<p)throw new ae(`Bundle has expired: ends_at=${d}`,"expired")}let u=cr(r),C=ur(r),m=pr(r),g={id:e,title:o,description:r.get("description")?.value||null,status:l,products:u,discountConfig:C,widgetConfig:m,startsAt:s,endsAt:d,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:br(r),productQuantities:Je(r,"product_quantities"),variantQuantities:Je(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:fr(r),marketVisibility:mr(r),marketIds:gr(r)};switch(i){case"fixed":return{...g,bundleType:"fixed"};case"volume":return{...g,bundleType:"volume",volumeTiers:vr(r)};case"mix_match":return{...g,bundleType:"mix_match",minQuantity:xr(r,"min_quantity",{min:1}),maxQuantity:null,productRules:hr(r)}}}function cr(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 o=e.get("collection");if(o?.references?.nodes)for(let n of o.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function ur(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 pr(e){return rr(ce(e,"widget_config"))}function br(e){let t=ce(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let o of t)Array.isArray(o)?r.push(o.filter(n=>typeof n=="string")):r.push([]);return r}function Je(e,t){let r=ce(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let o={};for(let[n,a]of Object.entries(r)){let i=typeof a=="number"?a:Number(a);Number.isFinite(i)&&i>=0&&i<=99&&(o[n]=Math.floor(i))}return o}function hr(e){let t=ce(e,"product_rules");if(!t||typeof t!="object"||Array.isArray(t))return{};let r={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object"||Array.isArray(n))continue;let{min:a,max:i}=n,l=typeof a=="number"?a:Number(a),s=typeof i=="number"?i:Number(i);if(!Number.isFinite(l)||!Number.isFinite(s))continue;let d=Math.max(1,Math.min(99,Math.floor(l))),p=Math.max(d,Math.min(99,Math.floor(s)));r[o]={min:d,max:p}}return r}function mr(e){return e.get("market_visibility")?.value==="specific"?"specific":"all"}function gr(e){let t=e.get("markets")?.value;if(!t)return[];try{let r=JSON.parse(t);return Array.isArray(r)?r.filter(o=>typeof o=="string"):[]}catch{return[]}}function fr(e){if(!e.get("ab_test_id")?.value)return null;let r={},o=e.get("ab_title")?.value;o&&(r.title=o);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,i=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&i){let s=parseFloat(i);Number.isFinite(s)&&(r.discountConfig={discountType:a,discountValue:s,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ce(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(s=>typeof s=="object"&&s!==null).map(ht)),Object.keys(r).length===0?null:r}function vr(e){let t=ce(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(ht):[]}function ht(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 ce(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function xr(e,t,r={}){let o=e.get(t)?.value;if(!o)return null;let n=parseInt(o,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function we(e,t,r){let o=e.variantQuantities[r];return o!==void 0?o:e.productQuantities[t]??1}function mt(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,o=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:o,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:o,discountConfig:n};case"fixed":return{...e,title:r,description:o,discountConfig:n}}}async function gt(e,t){await xt(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 ft(e,t){await xt(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function vt(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(o=>{for(let n of o)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function xt(e,t){let r=`${e.appUrl}/api/analytics`,o=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:o}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,o)}catch{}}}var yr=!1;function wr(){return typeof document<"u"}function Cr(){if(!wr())return!1;if(yr)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var Ze="lb_session",kr=720*60*60,_r=720*60*60;function yt(e){return`__Host-_lb_ab_${e}`}async function wt(e,t){if(typeof document>"u")return null;let r=Br(t);if(r&&r.testId===e)return{variant:r.variant,testId:e,persisted:!0};if(!Cr())return{variant:"A",testId:e,persisted:!1};let o=Er(),n=Tr(o,e);return Sr(t,e,n),{variant:n,testId:e,persisted:!0}}function Br(e){if(typeof document>"u")return null;let r=`${yt(e)}=`,n=document.cookie.split(";").map(s=>s.trim()).find(s=>s.startsWith(r));if(!n)return null;let a=n.substring(r.length),[i,l]=a.split("|");return i!=="A"&&i!=="B"||!l?null:{testId:l,variant:i}}function Sr(e,t,r){if(typeof document>"u")return;let o=yt(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${o}=${n}; Path=/; Max-Age=${_r}; SameSite=Lax; Secure`}function Er(){if(typeof document>"u")return et();let t=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${Ze}=`))?.split("=")[1];if(t)return t;let r=et();return document.cookie=`${Ze}=${r}; path=/; max-age=${kr}; SameSite=Lax; Secure`,r}function et(){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 Tr(e,t){let r=e+":"+t,o=2166136261;for(let n=0;n<r.length;n++)o^=r.charCodeAt(n),o=Math.imul(o,16777619);return(o>>>0)%2===0?"A":"B"}var tt=1e4,Ar=[[/@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"]],Lr=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function qe(e){if(e.length>tt)return{ok:!1,error:`CSS exceeds ${tt.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 i=parseInt(a,16);return i<0||i>1114111?"\uFFFD":String.fromCodePoint(i)}),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 Ar)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,o;for(;(o=r.exec(t))!==null;){let n=o[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!Lr.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var Pr="lb-custom-css-";function Ct(e,t){if(typeof document>"u"||!t)return!1;let r=qe(t);if(!r.ok||!r.css.trim())return!1;let o=Pr+Mr(e),n=document.getElementById(o);return n||(n=document.createElement("style"),n.id=o,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function Mr(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 Ir(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 Rr={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 le(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let o=parseFloat(e.amount);if(!Number.isFinite(o))return null;let n=Rr[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",i=Ir(o,a),l=t.referenceValue,s=l===1?n:`${l}${n}`;return`${i}/${s}`}function j(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function D(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function kt(e,t){return Math.max(0,e-Math.floor(e*t/100))}function Oe(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:o,discountValue:n}=e.discountConfig,a=[],i=0,l=0;for(let u of e.products){let C=u.variants.nodes.find(x=>x.availableForSale)??u.variants.nodes[0];if(!C)continue;let m=j(C.price.amount),g=t[u.id]??1,k=m*g,A=C.compareAtPrice?j(C.compareAtPrice.amount):null;if(a.push({unitCents:m,qty:g,lineCents:k,compareCents:A}),i+=k,o==="percentage"){let x=kt(m,n);l+=x*g}else l+=k}o==="fixed_amount"&&(l=Math.max(0,i-Math.round(n*100)));let s=Math.max(0,i-l),d=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",p="";return r&&s>0&&(o==="percentage"&&n>0?p=`-${Math.round(n)}%`:o==="fixed_amount"&&n>0&&(p=`-${D(Math.round(n*100),d)}`)),{rows:a,totalCents:i,saleCents:l,savingsCents:s,headerBadge:p,currency:d}}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 U=152;function re(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 _t(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),o=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,i=l=>String(l).padStart(2,"0");return r>0?`${r}d ${i(o)}h ${i(n)}m ${i(a)}s`:`${i(o)}h ${i(n)}m ${i(a)}s`}var Fe={};ot(Fe,{computePosition:()=>Vr,emptyTypeAheadState:()=>Hr,handleKey:()=>Fr,pushTypeAheadChar:()=>Ur});var Dr=4;function Vr({trigger:e,viewportHeight:t,desiredHeight:r,margin:o=Dr,clip:n}){let a=n?Math.min(t,n.bottom):t,i=n?Math.max(0,n.top):0,l=Math.max(0,a-e.bottom-o),s=Math.max(0,e.top-i-o),d=r<=l?"down":s>l?"up":"down",u=Math.min(r,d==="down"?l:s),C=d==="down"?e.bottom+o:e.top-o-u;return{placement:d,maxHeight:u,offsetTop:C,offsetLeft:e.left,width:e.width}}var Ie={type:"passthrough",preventDefault:!1};function Re(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function rt(e){for(let t=e.length-1;t>=0;t--)if(!e[t].disabled)return t;return-1}function qr(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t+r)%e.length;if(!e[o].disabled)return o}return t}function Or(e,t){if(e.length===0)return-1;for(let r=1;r<=e.length;r++){let o=(t-r+e.length)%e.length;if(!e[o].disabled)return o}return t}function nt(e){return e.length===1&&e!==" "&&/\S/.test(e)}function Fr(e,t){if(e.ctrlKey||e.metaKey||e.altKey)return Ie;let{key:r}=e,{isOpen:o,activeIndex:n,selectedIndex:a,options:i}=t;if(!o)switch(r){case"Enter":case" ":case"ArrowDown":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Re(i),preventDefault:!0};case"ArrowUp":return{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:rt(i),preventDefault:!0};default:return nt(r)?{type:"open",activeIndex:a>=0&&!i[a]?.disabled?a:Re(i),preventDefault:!0}:Ie}switch(r){case"ArrowDown":return{type:"move-active",activeIndex:qr(i,n),preventDefault:!0};case"ArrowUp":return{type:"move-active",activeIndex:Or(i,n),preventDefault:!0};case"Home":return{type:"move-active",activeIndex:Re(i),preventDefault:!0};case"End":return{type:"move-active",activeIndex:rt(i),preventDefault:!0};case"Enter":case" ":return n>=0&&!i[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 nt(r)?{type:"type-ahead",char:r,preventDefault:!1}:Ie}}var Nr=500;function Hr(){return{buffer:"",lastTime:0}}function Ur(e,t,r,o,n=Nr){if(t.length!==1)return{newState:e,matchedIndex:null};let i=(r-e.lastTime>n?"":e.buffer)+t.toLowerCase(),l={buffer:i,lastTime:r};for(let s=0;s<o.length;s++){let d=o[s];if(!d.disabled&&d.label.toLowerCase().startsWith(i))return{newState:l,matchedIndex:s}}return{newState:l,matchedIndex:null}}var $r={};ot($r,{findVariantByOptions:()=>Wr,isOptionValueAvailable:()=>zr,toPickerVariant:()=>jr});function Wr(e,t){if(e.length===0)return null;for(let r of e){if(r.optionValues.length!==t.length)continue;let o=!0;for(let n=0;n<r.optionValues.length;n++)if(r.optionValues[n]!==t[n]){o=!1;break}if(o)return r}return null}function zr(e,t,r,o){for(let n of e){if(!n.available||n.optionValues[t]!==r)continue;let a=!0;for(let i=0;i<n.optionValues.length;i++)if(i!==t&&n.optionValues[i]!==o[i]){a=!1;break}if(a)return!0}return!1}function jr(e){return{id:e.id,optionValues:e.selectedOptions.map(t=>t.value),available:e.availableForSale}}function Z(e,t){return e.availableForSale?e.currentlyNotInStock||e.quantityAvailable==null?!0:e.quantityAvailable>=t:!1}function ue(e,t,r,o){return!o||e.quantityAvailable==null||e.quantityAvailable<t?!1:e.quantityAvailable<=r}function Ne(e,t,r){if(!e.availableForSale)return 0;if(e.currentlyNotInStock)return Math.max(0,t-r);let o=e.quantityAvailable==null?Number.POSITIVE_INFINITY:e.quantityAvailable;return Math.max(0,Math.min(t,o)-r)}var{computePosition:Qr,emptyTypeAheadState:Kr,handleKey:Gr,pushTypeAheadChar:Yr}=Fe,Xr=32,Jr=8,Zr=8,K=[];function _e(e){let t=e.composedPath();for(let r=K.length-1;r>=0;r--){let o=K[r];!t.includes(o.shell)&&!t.includes(o.listbox)&&o.close()}}function Bt(){for(let e=K.length-1;e>=0;e--)K[e].close()}var Be=!1;function en(){Be||(document.addEventListener("pointerdown",_e,!0),window.addEventListener("scroll",_e,!0),window.addEventListener("resize",Bt),Be=!0)}function tn(){!Be||K.length>0||(document.removeEventListener("pointerdown",_e,!0),window.removeEventListener("scroll",_e,!0),window.removeEventListener("resize",Bt),Be=!1)}function ke(e){let t=[];for(let r=0;r<e.options.length;r++){let o=e.options[r];t.push({disabled:o.disabled,label:o.textContent||o.value})}return t}function rn(e){for(let t=0;t<e.length;t++)if(!e[t].disabled)return t;return-1}function nn(e){let t=e.ownerDocument?.defaultView;if(!t)return null;let r=e.parentElement;for(;r&&r!==e.ownerDocument.body;){let n=t.getComputedStyle(r).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return r;r=r.parentElement}return null}var on=["lb-bundle-variant-select","lb-mix-match__variant-select"],an=on.map(e=>`select.${e}:not(.lb-dropdown-state)`).join(", ");function ln(e){let t=e;if(e.classList.contains("lb-dropdown-state"))return t.__lbDropdownInstance??null;let r=e.ownerDocument,o=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 i=r.createElement("div");i.className="lb-dropdown",i.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 s=`${a}-listbox`;l.setAttribute("aria-controls",s),n&&l.setAttribute("aria-label",n);let d=r.createElement("span");d.className="lb-dropdown-trigger-value";let p=r.createElement("span");p.className="lb-dropdown-chevron",p.setAttribute("aria-hidden","true"),l.appendChild(d),l.appendChild(p);let u=r.createElement("ul");u.id=s,u.className="lb-dropdown-listbox",u.setAttribute("role","listbox"),n&&u.setAttribute("aria-label",n),u.hidden=!0,i.appendChild(l),e.parentNode?.insertBefore(i,e.nextSibling);let C=e.closest("[data-modal-overlay]");C?(C.appendChild(u),u.setAttribute("data-lb-dropdown-portal","")):i.appendChild(u);let m=!1,g=-1,k=Kr(),A=[],x;function E(){l.disabled=e.disabled;let v=ke(e),b=e.selectedIndex;for(d.textContent=b>=0&&v[b]?v[b].label:"";u.firstChild;)u.removeChild(u.firstChild);A=[];for(let w=0;w<v.length;w++){let R=r.createElement("li");R.id=`${a}-opt-${w}`,R.className="lb-dropdown-option",R.setAttribute("role","option"),R.setAttribute("aria-selected",w===b?"true":"false"),v[w].disabled&&R.setAttribute("aria-disabled","true"),R.setAttribute("data-value",e.options[w].value),R.setAttribute("data-index",String(w)),R.textContent=v[w].label,u.appendChild(R),A.push(R)}}function _(v){if(g>=0&&A[g]&&A[g].classList.remove("is-active"),g=v,v>=0&&A[v]){let b=A[v];b.classList.add("is-active"),l.setAttribute("aria-activedescendant",b.id);let w=b.offsetTop,R=w+b.offsetHeight,ne=u.scrollTop,Y=ne+u.clientHeight;w<ne?u.scrollTop=w:R>Y&&(u.scrollTop=R-u.clientHeight)}else l.setAttribute("aria-activedescendant","")}function O(){let v=l.getBoundingClientRect();if(v.width===0)return!1;let w=Math.min(A.length||1,Zr)*Xr+Jr,R=nn(l),ne=R?(()=>{let ee=R.getBoundingClientRect();return{top:ee.top,bottom:ee.bottom}})():void 0,Y=Qr({trigger:{top:v.top,bottom:v.bottom,left:v.left,width:v.width},viewportHeight:window.innerHeight,desiredHeight:w,clip:ne});return u.setAttribute("data-placement",Y.placement),u.style.maxHeight=`${Y.maxHeight}px`,u.hasAttribute("data-lb-dropdown-portal")&&(u.style.top=`${Y.offsetTop}px`,u.style.left=`${Y.offsetLeft}px`,u.style.width=`${Y.width}px`),!0}function h(){if(m)return;for(let w=K.length-1;w>=0;w--)K[w]!==x&&K[w].close();m=!0,u.hidden=!1,l.setAttribute("aria-expanded","true"),O()||requestAnimationFrame(()=>O());let v=ke(e),b=e.selectedIndex;b>=0&&v[b]&&!v[b].disabled?_(b):_(rn(v)),K.push(x),K.length===1&&en()}function M(v){if(!m)return;m=!1,u.hidden=!0,l.setAttribute("aria-expanded","false"),l.setAttribute("aria-activedescendant",""),g>=0&&A[g]&&A[g].classList.remove("is-active"),g=-1;let b=K.indexOf(x);b>=0&&K.splice(b,1),K.length===0&&tn(),v&&l.focus()}function L(v){let b=e.options[v];if(!(!b||b.disabled)){if(e.value!==b.value){e.value=b.value;let w=new Event("change",{bubbles:!0});e.dispatchEvent(w)}E(),M(!0)}}function y(v){switch(v.type){case"open":h(),v.activeIndex>=0&&_(v.activeIndex);return;case"close":M(v.restoreFocus);return;case"move-active":_(v.activeIndex);return;case"commit":L(v.index);return;case"type-ahead":{let b=ke(e),w=Yr(k,v.char,Date.now(),b);k=w.newState,w.matchedIndex!==null&&(m||h(),_(w.matchedIndex));return}case"passthrough":return;default:{let b=v}}}function B(v){let b=ke(e),w=Gr({key:v.key,ctrlKey:v.ctrlKey,metaKey:v.metaKey,altKey:v.altKey,shiftKey:v.shiftKey},{isOpen:m,activeIndex:g,selectedIndex:e.selectedIndex,options:b});w.preventDefault&&v.preventDefault(),y(w)}function f(v){v.preventDefault(),m?M(!1):h()}function V(v){let b=v.target;for(;b&&b!==u;){if(b.classList?.contains("lb-dropdown-option")){let w=parseInt(b.getAttribute("data-index")??"",10);if(!Number.isNaN(w)){L(w);return}}b=b.parentElement}}function P(v){let b=v.target;for(;b&&b!==u;){if(b.classList?.contains("lb-dropdown-option")){if(b.getAttribute("aria-disabled")==="true")return;let w=parseInt(b.getAttribute("data-index")??"",10);!Number.isNaN(w)&&w!==g&&_(w);return}b=b.parentElement}}function T(){setTimeout(()=>{if(!m)return;let v=o.activeElement??r.activeElement;i.contains(v)||M(!1)},0)}function S(){E()}let I=new MutationObserver(()=>{E()});I.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["disabled","value","selected"]});let F=v=>v.preventDefault();l.addEventListener("click",f),l.addEventListener("keydown",B),i.addEventListener("focusout",T),u.addEventListener("mousedown",F),u.addEventListener("click",V),u.addEventListener("mousemove",P),e.addEventListener("change",S);function te(){m&&M(!1),I.disconnect(),l.removeEventListener("click",f),l.removeEventListener("keydown",B),i.removeEventListener("focusout",T),u.removeEventListener("mousedown",F),u.removeEventListener("click",V),u.removeEventListener("mousemove",P),e.removeEventListener("change",S),i.parentNode&&i.parentNode.removeChild(i),u.parentNode&&u.parentNode.removeChild(u),e.classList.remove("lb-dropdown-state"),e.removeAttribute("aria-hidden"),e.removeAttribute("tabindex"),delete t.__lbDropdownInstance}return x={shell:i,listbox:u,select:e,close:()=>M(!1),destroy:te},t.__lbDropdownInstance=x,E(),x}function Se(e){let t=e.querySelectorAll(an),r=[];return t.forEach(o=>{let n=ln(o);n&&r.push(n)}),r}function Ee(e){e.querySelectorAll("select.lb-dropdown-state").forEach(r=>{let o=r.__lbDropdownInstance;o&&o.destroy()})}function pe(e){let t=sn(e);if(t===null||t<=Date.now())return null;let r=t,o=document.createElement("div");o.className="lb-bundle-countdown",o.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),o.appendChild(n);let i=document.createElement("span");i.className="lb-bundle-countdown__timer",i.setAttribute("data-countdown-timer",""),o.appendChild(i);let l=null;function s(){let p=r-Date.now();if(p<=0){o.style.display="none",d();return}i.textContent=_t(p)}function d(){l!==null&&(clearInterval(l),l=null)}return s(),l=setInterval(s,1e3),{el:o,stop:d}}function sn(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function be(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 o=document.createElement("span");return o.className="lb-cta-spinner",o.setAttribute("data-cta-spinner",""),o.setAttribute("aria-hidden","true"),o.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(o),t}function He(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function c(e,t,r={}){let o=document.createElement(e);t&&(o.className=t);for(let[n,a]of Object.entries(r))o.setAttribute(n,a);return o}var dn=`
|
|
233
233
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
234
234
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
235
235
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
236
236
|
<circle cx="10" cy="12" r="2"></circle>
|
|
237
|
-
</svg>`;function
|
|
237
|
+
</svg>`;function St(e,t,r,o){let n=t.widgetConfig,a=(x,E)=>we(t,x,E),i=[],l=0;if(t.products.forEach((x,E)=>{let _=cn(t,x,E);_.qty!==0&&(_.isOos&&(l++,n.outOfStockBehavior==="hide")||i.push(_))}),i.length===0)return;let s=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",d=c("div","lb-fixed",{"data-discount-type":t.discountConfig.discountType,"data-discount-value":String(t.discountConfig.discountValue)}),p=un(t,s);if(d.appendChild(p.el),n.countdown.showCountdown&&t.endsAt){let x=pe(t.endsAt);x&&(d.appendChild(x.el),o?.(x.stop))}let u=c("div","lb-fixed__products"),C=[];i.forEach(x=>{let E=bn(x,s,a,{enabled:n.showLowStockBadge,threshold:n.lowStockThreshold},()=>{A()});C.push(E),u.appendChild(E.el)}),d.appendChild(u),d.appendChild(c("div","lb-bundle-divider"));let m=hn(t);d.appendChild(m.el);let g=n.savingsBar.visible?mn():null;g&&d.appendChild(g.el);let k=gn(t,l,()=>{let x=i.filter(E=>E.selected).map(E=>({merchandiseId:E.selected.id,quantity:E.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));x.length!==0&&r(x)});d.appendChild(k),d.appendChild(c("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),d.appendChild(c("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(d),Se(d),o?.(()=>Ee(d)),A();function A(){let x=i.reduce((O,h)=>{if(!h.selected)return O;let M=j(h.selected.price.amount);return O+M*h.qty},0),E=fn(x,t.discountConfig,i),_=Math.max(0,x-E);m.update({totalCents:x,saleCents:E,savingsCents:_,currency:s}),g&&g.update({savingsCents:_,currency:s}),p.refresh(pn(t,x,E,s))}}function cn(e,t,r){let o=e.selectedVariantIds?.[r]??null,n=o&&o.length>0?t.variants.nodes.filter(p=>o.includes(p.id)):t.variants.nodes,a=n.find(p=>Z(p,we(e,t.id,p.id)))??null,i=n,l=!a,s=a??n[0]??null,d=s?we(e,t.id,s.id):1;return{product:t,eligibleVariants:i,selected:s,qty:d,isOos:l}}function un(e,t){let r=e.widgetConfig,o=c("div","lb-bundle-header"),n=c("div","lb-bundle-header__content"),a=c("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let s=c("p","lb-bundle-subtitle");s.textContent=e.description,n.appendChild(s)}o.appendChild(n);let i=c("span","lb-bundle-header__badge",{"data-header-badge":""});o.appendChild(i);let l=Oe(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?i.textContent=l.headerBadge:i.style.display="none",{el:o,refresh(s){if(!r.pricing.showSaveBadge){i.style.display="none";return}s?(i.textContent=s,i.style.display=""):i.style.display="none"}}}function pn(e,t,r,o){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?`-${D(Math.round(a.discountValue*100),o)}`:`-${D(n,o)}`}function bn(e,t,r,o,n){let a=c("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"}:{}}),i=c("div","lb-bundle-thumbnail",{"data-thumbnail":""}),l=e.selected?.image??e.product.featuredImage??null,s=null;l?(s=document.createElement("img"),s.src=re(l.url,{width:U,height:U,crop:"center"}),s.alt=l.altText??e.product.title,s.width=U,s.height=U,s.loading="lazy",i.appendChild(s)):i.insertAdjacentHTML("beforeend",dn);let d=null;e.isOos||(d=c("span","lb-bundle-qty-badge",{"data-qty-badge":""}),d.textContent=String(e.qty),i.appendChild(d)),a.appendChild(i);let p=c("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=c("span","lb-bundle-oos-label");C.textContent="Out of stock",p.appendChild(C)}else if(e.selected){if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let _=c("span","lb-bundle-variant-badge");_.textContent=e.eligibleVariants[0].title,p.appendChild(_)}let m=c("span","lb-bundle-product-prices"),g=c("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),k=c("span","lb-bundle-product-price",{"data-product-price":""});m.appendChild(g),m.appendChild(k),p.appendChild(m);let A=c("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});A.setAttribute("hidden",""),p.appendChild(A);let x=c("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});x.setAttribute("hidden",""),p.appendChild(x);let E=_=>{let O=j(_.price.amount);if(k.textContent=D(O,t),_.compareAtPrice){let y=j(_.compareAtPrice.amount);y>O?(g.textContent=D(y,t),g.removeAttribute("hidden")):g.setAttribute("hidden","")}else g.setAttribute("hidden","");let h=le(_.unitPrice,_.unitPriceMeasurement,t);h?(A.textContent=h,A.removeAttribute("hidden")):A.setAttribute("hidden","");let M=_.image??e.product.featuredImage;s&&M&&(s.src=re(M.url,{width:U,height:U,crop:"center"}),s.alt=M.altText??e.product.title);let L=r(e.product.id,_.id);ue(_,L,o.threshold,o.enabled)?(x.textContent=`Only ${_.quantityAvailable} left`,x.removeAttribute("hidden")):x.setAttribute("hidden","")};if(E(e.selected),e.eligibleVariants.length>1){let _=e.eligibleVariants[0].selectedOptions.map(P=>P.name),O=e.product.id.replace(/^.*\//,""),h=[],M=P=>e.eligibleVariants.find(T=>T.selectedOptions.every((S,I)=>S.value===P[I])&&T.selectedOptions.length===P.length)??null,L=P=>{P.selectedOptions.forEach((T,S)=>{let I=h[S];I&&I.value!==T.value&&(I.value=T.value)})},y=(P,T,S)=>e.eligibleVariants.some(I=>!Z(I,r(e.product.id,I.id))||I.selectedOptions[P]?.value!==T?!1:I.selectedOptions.every((F,te)=>te===P||F.value===S[te])),B=P=>{h.forEach((T,S)=>{Array.from(T.options).forEach(I=>{I.disabled=!y(S,I.value,P)})})},f=()=>{let P=h.map(S=>S.value),T=M(P);if(!T){e.selected&&(L(e.selected),B(e.selected.selectedOptions.map(S=>S.value)));return}e.selected=T,e.qty=r(e.product.id,T.id),d&&(d.textContent=String(e.qty)),E(T),B(T.selectedOptions.map(S=>S.value)),n()},V=c("div","lb-bundle-variant-option-groups");_.forEach((P,T)=>{let S=c("div","lb-bundle-variant-option-group"),I=c("span","lb-bundle-variant-option-label");I.textContent=P,S.appendChild(I);let F=document.createElement("select");F.className="lb-bundle-variant-select",F.setAttribute("data-variant-option",""),F.setAttribute("data-option-position",String(T+1)),F.name=`lb-variant-${O}-${T+1}`,F.setAttribute("aria-label",P);let te=new Set;e.eligibleVariants.forEach(v=>{let b=v.selectedOptions[T]?.value;if(!b||te.has(b))return;te.add(b);let w=document.createElement("option");w.value=b,w.textContent=b,e.selected?.selectedOptions[T]?.value===b&&(w.selected=!0),F.appendChild(w)}),F.addEventListener("change",f),h.push(F),S.appendChild(F),V.appendChild(S)}),p.appendChild(V),e.selected&&B(e.selected.selectedOptions.map(P=>P.value))}}return a.appendChild(p),{el:a,state:e}}function hn(e){let t=c("div","lb-bundle-pricing"),r=c("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let o=c("span","lb-bundle-pricing__prices"),n=c("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",o.appendChild(n);let a=c("span","lb-bundle-sale-price",{"data-sale-price":""});return o.appendChild(a),t.appendChild(o),{el:t,update({totalCents:i,saleCents:l,savingsCents:s,currency:d}){a.textContent=D(l,d),e.widgetConfig.pricing.showCompareAtPrice&&s>0?(n.textContent=D(i,d),n.style.display=""):n.style.display="none"}}}function mn(){let e=c("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=c("span","",{"data-savings-amount":""});return e.appendChild(r),{el:e,update({savingsCents:o,currency:n}){if(o<=0){e.style.display="none";return}e.style.display="",r.textContent=D(o,n)}}}function gn(e,t,r){let o=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=be(o);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function fn(e,t,r){if(t.discountType==="percentage"){let o=0;for(let n of r){if(!n.selected)continue;let a=j(n.selected.price.amount),i=Math.floor(a*t.discountValue/100),l=Math.max(0,a-i);o+=l*n.qty}return o}return Math.max(0,e-Math.round(t.discountValue*100))}var Tt=`
|
|
238
238
|
<svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
|
|
239
239
|
<rect x="4" y="4" width="20" height="20" rx="3"></rect>
|
|
240
240
|
<line x1="4" y1="20" x2="24" y2="20"></line>
|
|
241
241
|
<circle cx="10" cy="12" r="2"></circle>
|
|
242
|
-
</svg>`,
|
|
242
|
+
</svg>`,vn=`
|
|
243
243
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
244
244
|
<line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
245
245
|
<line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
@@ -247,17 +247,17 @@
|
|
|
247
247
|
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
248
248
|
<line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
249
249
|
<line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
250
|
-
</svg>`,
|
|
250
|
+
</svg>`,xn=`
|
|
251
251
|
<svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
252
252
|
<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"/>
|
|
253
|
-
</svg>`,
|
|
253
|
+
</svg>`,yn=`
|
|
254
254
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
255
255
|
<line x1="3" y1="7" x2="11" y2="7" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
256
|
-
</svg>`,
|
|
256
|
+
</svg>`,wn=`
|
|
257
257
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
|
258
258
|
<line x1="7" y1="3" x2="7" y2="11" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
259
259
|
<line x1="3" y1="7" x2="11" y2="7" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
260
|
-
</svg>`;function $e(e,t){return e.productRules[t]??ct}function Ue(e,t,r){let o=0;for(let n of e)n.productId===t&&n.variantId===r&&(o+=n.quantity);return o}function Et(e,t,r,o){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",i=t.minQuantity??1,l=n.mixMatchShowQuantitySelector!==!1,d=Sn(t,n.outOfStockBehavior);if(d.filter(w=>!w.isOos).length<i)return;let p=[],u=s("div","lb-mix-match",{"data-required-quantity":String(i)}),C=vn(t);if(u.appendChild(C),n.countdown.showCountdown&&t.endsAt){let w=pe(t.endsAt);w&&(u.appendChild(w.el),o?.(w.stop))}let m=xn(i);u.appendChild(m.el);let g=s("div","lb-mix-match__slots",{"data-selection-slots":""});u.appendChild(g),u.appendChild(s("div","lb-bundle-divider"));let k=Cn(n.pricing.showCompareAtPrice);u.appendChild(k.el);let T=n.savingsBar.visible?kn():null;T&&u.appendChild(T.el);let x=be(`Select ${i} items to unlock`);x.disabled=!0,x.addEventListener("click",()=>{x.disabled||r(fn(p,t))});let A=_n(t,d,a,{showSearch:n.showSearch,showQtySelector:l,selections:p,onAdd:(w,B,f)=>_(w,B,f),isComplete:()=>p.length>=i,getFocusAfterAdd:()=>g.querySelector(".lb-mix-match__slot--empty")??x});u.appendChild(A.el),u.appendChild(x),u.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),u.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(u),o?.(()=>Ae(u)),h();function _(w,B,f){if(p.length>=i)return;let F=$e(t,w.id),P=Ne(B,F.max,Ue(p,w.id,B.id));if(P<F.min)return;let E=Math.max(F.min,Math.min(f,P));p.push({productId:w.id,productTitle:w.title,variantId:B.id,variantTitle:B.title,imageUrl:B.image?.url??w.featuredImage?.url??null,priceCents:j(B.price.amount),compareCents:B.compareAtPrice?j(B.compareAtPrice.amount):null,unitPriceLabel:le(B.unitPrice,B.unitPriceMeasurement,a),quantity:E}),h()}function q(w){w<0||w>=p.length||(p.splice(w,1),h())}function h(){M(),m.update(p.length),k.update(p,t,a),T&&T.update(p,t,a),A.refreshCounts(),L()}function M(){g.innerHTML="";let w=Math.max(i,p.length);for(let B=0;B<w;B++){let f=p[B];f?g.appendChild(yn(f,B,a,()=>q(B))):g.appendChild(wn(B,()=>A.open()))}}function L(){let w=p.length;w<i?(x.disabled=!0,He(x,`Select ${i-w} more to unlock`)):(x.disabled=!1,He(x,n.cta.ctaText||"Add to cart"))}}function fn(e,t){let r=new Map;for(let o of e){let n=`${o.productId}::${o.variantId}`,a=r.get(n);a?a.quantity+=o.quantity:r.set(n,{variantId:o.variantId,quantity:o.quantity})}return Array.from(r.values()).map(o=>({merchandiseId:o.variantId,quantity:o.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}))}function vn(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),o=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,o.appendChild(n),r.appendChild(o),t.pricing.showSaveBadge){let{discountType:a,discountValue:i}=e.discountConfig,l=null;if(a==="percentage"&&i>0?l=`-${Math.round(i)}%`:a==="fixed_amount"&&i>0&&(l=`-${D(Math.round(i*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 xn(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),o=s("span","lb-mix-match__progress-count",{"data-progress-count":"","aria-live":"polite"});o.textContent=`0 of ${e} selected`,r.appendChild(o);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":"","aria-live":"polite"});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)}),i=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});i.style.width="0%",a.appendChild(i),t.appendChild(a);function l(d){let c=Math.min(100,d/e*100);o.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,i.style.width=`${c}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function wn(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"}),o=s("div","lb-mix-match__empty-thumb");o.innerHTML=bn,r.appendChild(o);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 yn(e,t,r,o){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 g=document.createElement("img");g.src=re(e.imageUrl,{width:U,height:U,crop:"center"}),g.alt=e.productTitle,g.width=U,g.height=U,g.loading="lazy",a.appendChild(g)}else a.insertAdjacentHTML("beforeend",St);let i=s("span","lb-bundle-qty-badge");i.textContent=`\xD7${e.quantity}`,a.appendChild(i),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 g=s("span","lb-mix-match__filled-variant");g.textContent=e.variantTitle,l.appendChild(g)}let c=e.priceCents*e.quantity,p=e.compareCents!==null?e.compareCents*e.quantity:null,u=s("span","lb-mix-match__filled-price");if(p!==null&&p>c){let g=s("span","lb-mix-match__filled-compare");g.textContent=D(p,r),u.appendChild(g)}let C=document.createElement("span");if(C.textContent=D(c,r),u.appendChild(C),l.appendChild(u),e.unitPriceLabel){let g=s("span","lb-bundle-product-unit-price");g.textContent=e.unitPriceLabel,l.appendChild(g)}n.appendChild(l);let m=document.createElement("button");return m.type="button",m.className="lb-mix-match__slot-remove",m.setAttribute("aria-label",`Remove ${e.productTitle}`),m.innerHTML=At,m.addEventListener("click",g=>{g.stopPropagation(),o()}),n.appendChild(m),n}function Cn(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 o=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&o.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});o.appendChild(a),t.appendChild(o);function i(l,d,c){if(l.length===0){t.style.display="none";return}t.style.display="";let p=l.reduce((C,m)=>C+m.priceCents*m.quantity,0),u=Ce(p,d.discountConfig);e&&p>u?(n.textContent=D(p,c),n.style.display=""):n.style.display="none",a.textContent=D(u,c)}return{el:t,update:i}}function kn(){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 o(n,a,i){if(n.length===0){e.style.display="none";return}let l=n.reduce((p,u)=>p+u.priceCents*u.quantity,0),d=Ce(l,a.discountConfig),c=Math.max(0,l-d);if(c<=0){e.style.display="none";return}e.style.display="",r.textContent=D(c,i)}return{el:e,update:o}}function _n(e,t,r,o){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-${Bt(e.id)}`,tabindex:"-1"}),i=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Bt(e.id)}`});l.textContent="Pick an item",i.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=At,d.addEventListener("click",L),i.appendChild(d),a.appendChild(i);let c=null,p=null;if(o.showSearch){let f=s("div","lb-mix-match__modal-search");c=document.createElement("input"),c.type="text",c.className="lb-mix-match__modal-search-input",c.setAttribute("data-modal-search",""),c.setAttribute("role","searchbox"),c.setAttribute("aria-label","Search products"),c.setAttribute("placeholder","Search products"),c.autocomplete="off",c.addEventListener("input",()=>A()),f.appendChild(c),p=document.createElement("button"),p.type="button",p.className="lb-mix-match__modal-search-clear",p.setAttribute("data-modal-search-clear",""),p.setAttribute("aria-label","Clear search"),p.style.display="none",p.innerHTML=hn,p.addEventListener("click",()=>{c&&(c.value="",A(),c.focus())}),f.appendChild(p),a.appendChild(f)}let u=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(u);let C=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});C.style.display="none";let m=document.createElement("p");m.textContent="No products match your search.",C.appendChild(m),a.appendChild(C);let g=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(g),n.appendChild(a);let k=!1,T=[];function x(){k||(k=!0,u.innerHTML="",t.forEach(f=>{let F=$e(e,f.product.id),P=f.variants,E=f.variants.find(V=>Z(V,F.min))??f.firstAvailableVariant??f.variants[0];if(!E)return;let S=E,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(/^.*\//,"")}),O=s("div","lb-mix-match__modal-product-thumb"),v=(f.variants.find(V=>Z(V,F.min))??f.variants[0]??null)?.image??f.product.featuredImage??null,b=null;v?(b=document.createElement("img"),b.src=re(v.url,{width:U,height:U,crop:"center"}),b.alt=v.altText??f.product.title,b.width=U,b.height=U,b.loading="lazy",O.appendChild(b)):O.insertAdjacentHTML("beforeend",St);let y=s("span","lb-bundle-qty-badge");y.hidden=!0,O.appendChild(y),I.appendChild(O);let R=s("div","lb-mix-match__modal-product-info"),ne=s("p","lb-mix-match__modal-product-title");ne.textContent=f.product.title,R.appendChild(ne);let Y=s("p","lb-mix-match__modal-product-price");Y.textContent=D(j(S.price.amount),r),R.appendChild(Y);let ee=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),ze=le(S.unitPrice,S.unitPriceMeasurement,r);ze?ee.textContent=ze:ee.hidden=!0,R.appendChild(ee);let he=s("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});he.hidden=!0,R.appendChild(he);let je=V=>{ue(V,F.min,e.widgetConfig.lowStockThreshold,e.widgetConfig.showLowStockBadge)?(he.textContent=`Only ${V.quantityAvailable} left`,he.hidden=!1):he.hidden=!0};je(S);let Qe=()=>{let V=Ue(o.selections,f.product.id,S.id),X=Ne(S,F.max,V),oe=Math.max(F.min,X);return{min:F.min,max:oe,cap:X}},G=null,ve=null;!f.isOos&&o.showQtySelector&&(ve=s("div","lb-bundle-variant-option-group lb-mix-match__qty-stepper-group"),G=Bn({initial:F.min,getBounds:()=>{let{min:V,max:X}=Qe();return{min:V,max:X}}}),ve.appendChild(G.el));let me={el:I,product:f.product,variant:E,refreshFromSelections:()=>{}},de=[];if(P.length>1){let V=P[0].selectedOptions.map($=>$.name),X=f.product.id.replace(/^.*\//,""),oe=$=>P.find(N=>N.selectedOptions.length===$.length&&N.selectedOptions.every((Q,H)=>Q.value===$[H]))??null,xe=$=>{$.selectedOptions.forEach((N,Q)=>{let H=de[Q];H&&H.value!==N.value&&(H.value=N.value)})},ie=($,N,Q)=>P.some(H=>!Z(H,F.min)||H.selectedOptions[$]?.value!==N?!1:H.selectedOptions.every((z,ge)=>ge===$||z.value===Q[ge])),Pe=$=>{de.forEach((N,Q)=>{Array.from(N.options).forEach(H=>{H.disabled=!ie(Q,H.value,$)})})},$t=()=>{let $=de.map(z=>z.value),N=oe($);if(!N){xe(S),Pe(S.selectedOptions.map(z=>z.value));return}S=N,me.variant=N,Y.textContent=D(j(S.price.amount),r);let Q=le(S.unitPrice,S.unitPriceMeasurement,r);Q?(ee.textContent=Q,ee.hidden=!1):(ee.textContent="",ee.hidden=!0);let H=S.image??f.product.featuredImage;b&&H&&(b.src=re(H.url,{width:U,height:U,crop:"center"}),b.alt=H.altText??f.product.title),Pe(N.selectedOptions.map(z=>z.value)),je(S),me.refreshFromSelections()},Ke=s("div","lb-bundle-variant-option-groups");V.forEach(($,N)=>{let Q=s("div","lb-bundle-variant-option-group"),H=s("span","lb-bundle-variant-option-label");H.textContent=$,Q.appendChild(H);let z=document.createElement("select");z.className="lb-mix-match__variant-select",z.setAttribute("data-variant-option",""),z.setAttribute("data-option-position",String(N+1)),z.name=`lb-variant-${X}-${N+1}`,z.setAttribute("aria-label",$);let ge=new Set;P.forEach(Wt=>{let se=Wt.selectedOptions[N]?.value;if(!se||ge.has(se))return;ge.add(se);let we=document.createElement("option");we.value=se,we.textContent=se,E.selectedOptions[N]?.value===se&&(we.selected=!0),z.appendChild(we)}),z.addEventListener("change",$t),de.push(z),Q.appendChild(z),Ke.appendChild(Q)}),R.appendChild(Ke),Pe(E.selectedOptions.map($=>$.value))}else if(P.length===1&&E.title!=="Default Title"){let V=s("span","lb-mix-match__filled-variant");V.textContent=E.title,R.appendChild(V)}if(f.isOos){let V=s("span","lb-mix-match__modal-sold-out-label");V.textContent="Sold out",R.appendChild(V)}I.appendChild(R);let W=null,Ut=()=>{if(!W){de.forEach(ie=>{ie.disabled=!0}),G&&G.setExternallyDisabled(!0);return}let{cap:V}=Qe(),X=Ue(o.selections,f.product.id,S.id);X>0?(y.textContent=String(X),y.hidden=!1):y.hidden=!0,o.selections.some(ie=>ie.productId===f.product.id)?(W.disabled=!0,W.textContent="Added",W.setAttribute("aria-label",`Added ${f.product.title}`),I.classList.add("lb-mix-match__modal-product--in-bundle")):(W.textContent="Add",W.setAttribute("aria-label",`Add ${f.product.title}`),I.classList.remove("lb-mix-match__modal-product--in-bundle"),W.disabled=o.isComplete()||V<F.min);let xe=W.disabled;de.forEach(ie=>{ie.disabled=xe}),G&&G.setExternallyDisabled(xe)};if(!f.isOos){let V=s("div","lb-mix-match__modal-product-actions");ve&&V.appendChild(ve),W=document.createElement("button"),W.type="button",W.className="lb-mix-match__modal-add",W.textContent="Add",W.setAttribute("aria-label",`Add ${f.product.title}`),W.addEventListener("click",()=>{if(!W||W.disabled||o.isComplete())return;let X=G?G.value():F.min;o.onAdd(f.product,S,X),G&&G.reset(F.min);let oe=o.getFocusAfterAdd();oe&&(_=oe),L()}),V.appendChild(W),R.appendChild(V)}me.refreshFromSelections=()=>{G&&G.refresh(),Ut()},me.refreshFromSelections(),T.push(me),u.appendChild(I)}),Se(u),B())}function A(){if(!c)return;let f=c.value.trim().toLowerCase();p&&(p.style.display=f?"":"none");let F=0;T.forEach(P=>{let E=!f||P.product.title.toLowerCase().includes(f);P.el.style.display=E?"":"none",E&&F++}),C.style.display=F===0&&f?"":"none"}let _=null;function q(f){if(f.key==="Escape"){f.preventDefault(),L();return}f.key==="Tab"&&An(f,a)}let h=!1;function M(){h||o.isComplete()||(h=!0,x(),_=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",q),n.addEventListener("click",w))}function L(){h&&(h=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",q),n.removeEventListener("click",w),_ instanceof HTMLElement&&_.focus())}function w(f){f.target===n&&L()}function B(){T.forEach(f=>f.refreshFromSelections())}return{el:n,open:M,close:L,refreshCounts:B}}function Bn(e){let t=s("div","lb-mix-match__qty-stepper",{role:"group","aria-label":"Quantity"}),r=document.createElement("button");r.type="button",r.className="lb-mix-match__qty-stepper-button lb-mix-match__qty-stepper-button--minus",r.setAttribute("aria-label","Decrease quantity"),r.innerHTML=mn,t.appendChild(r);let o=s("span","lb-mix-match__qty-stepper-value",{"aria-live":"polite"});t.appendChild(o);let n=document.createElement("button");n.type="button",n.className="lb-mix-match__qty-stepper-button lb-mix-match__qty-stepper-button--plus",n.setAttribute("aria-label","Increase quantity"),n.innerHTML=gn,t.appendChild(n);let a=l(e.initial,e.getBounds()),i=!1;function l(c,p){return Math.max(p.min,Math.min(p.max,c))}function d(){let c=e.getBounds();a=l(a,c),o.textContent=String(a),r.disabled=i||a<=c.min,n.disabled=i||a>=c.max}return r.addEventListener("click",()=>{let c=e.getBounds();a=l(a-1,c),d()}),n.addEventListener("click",()=>{let c=e.getBounds();a=l(a+1,c),d()}),d(),{el:t,value:()=>a,reset(c){a=l(c,e.getBounds()),d()},refresh:d,setExternallyDisabled(c){i=c,d()}}}function Sn(e,t){let r=[],o=new Set;for(let n of e.products){if(o.has(n.id))continue;o.add(n.id);let a=$e(e,n.id),i=n.variants.nodes.filter(d=>Z(d,a.min)),l=i.length===0;l&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:i[0]??null,isOos:l})}return r}function An(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let o=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===o?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),o.focus())}function Bt(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Mt(e,t,r,o){let n=t.widgetConfig,a=t.products[0],i=t.volumeTiers[0]?.minQuantity??1,l=a?.variants.nodes.find(h=>Z(h,i));if(!l&&n.outOfStockBehavior==="hide")return;let d=l?j(l.price.amount):0,c=l?.price.currencyCode??"USD",p=t.discountConfig.discountType,u=t.volumeTiers.map((h,M)=>{let L;if(p==="fixed_amount"){let w=Math.round((h.amount??0)*100);L=Math.max(0,d-w)}else{let w=h.percentage??0,B=Math.floor(d*w/100);L=Math.max(0,d-B)}return{tier:h,index:M,qty:h.minQuantity,pricePerUnitCents:L,basePricePerUnitCents:d}}),C=Pn(u),m=n.defaultTier==="best_value"?C:0;typeof n.defaultTier=="number"&&(m=Pt(n.defaultTier,0,u.length-1));let g=n.popularBadge.tierIndex!==void 0?Pt(n.popularBadge.tierIndex,0,u.length-1):C,k=s("div","lb-volume");if(k.appendChild(En(t,u,m,c,p)),n.countdown.showCountdown&&t.endsAt){let h=pe(t.endsAt);h&&(k.appendChild(h.el),o?.(h.stop))}let T=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});u.forEach(h=>{let M=Tn(h,h.index===m,c,n.popularBadge.visible&&h.index===g?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);M.addEventListener("click",()=>q(h.index)),M.addEventListener("keydown",L=>{if(L.key==="Enter"||L.key===" "){L.preventDefault(),q(h.index);return}if(L.key==="ArrowDown"||L.key==="ArrowRight"||L.key==="ArrowUp"||L.key==="ArrowLeft"){L.preventDefault();let w=L.key==="ArrowDown"||L.key==="ArrowRight"?1:-1,B=(h.index+w+u.length)%u.length;q(B),T.children[B]?.focus()}}),T.appendChild(M)}),k.appendChild(T),k.appendChild(s("div","lb-bundle-divider"));let x=Tt(u,m,c,n.pricing.showItemCount,n.pricing.showCompareAtPrice);k.appendChild(x);let A=n.savingsBar.visible?Lt(u,m,c):null;A&&k.appendChild(A);let _=Ln(t,()=>{if(!l)return;let h=u[m];h&&r([{merchandiseId:l.id,quantity:h.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});if(l&&ue(l,i,n.lowStockThreshold,n.showLowStockBadge)){let h=s("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});h.textContent=`Only ${l.quantityAvailable} left`,k.appendChild(h)}k.appendChild(_),k.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),k.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(k);function q(h){if(h===m||h<0||h>=u.length)return;m=h,Array.from(T.children).forEach((w,B)=>{w.setAttribute("aria-checked",String(B===h)),w.tabIndex=B===h?0:-1});let M=Tt(u,h,c,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(x.replaceWith(M),x=M,A){let w=Lt(u,h,c);A.replaceWith(w),A=w}let L=k.querySelector("[data-header-badge]");if(L){let w=It(u[h],c,p);w?(L.textContent=w,L.style.display=""):L.style.display="none"}}}function En(e,t,r,o,n){let a=e.widgetConfig,i=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),i.appendChild(l),a.pricing.showSaveBadge){let c=It(t[r],o,n);if(c){let p=s("span","lb-bundle-header__badge",{"data-header-badge":""});p.textContent=c,i.appendChild(p)}}return i}function Tn(e,t,r,o,n,a){let i=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")),i.appendChild(l);let d=s("span","lb-volume__tier-grid"),c=s("span","lb-volume__tier-label");c.textContent=`Buy ${e.qty}`,d.appendChild(c);let p=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let C=s("span","lb-volume__tier-compare");C.textContent=D(e.basePricePerUnitCents,r),p.appendChild(C)}if(a){let C=document.createElement("span");C.setAttribute("data-tier-price-each",""),C.textContent=D(e.pricePerUnitCents,r),p.appendChild(C);let m=s("span","lb-volume__tier-unit");m.textContent=" each",p.appendChild(m)}d.appendChild(p),i.appendChild(d);let u=s("span","lb-volume__tier-badge");return o?u.textContent=o:u.style.display="none",i.appendChild(u),i}function Tt(e,t,r,o,n){let a=e[t],i=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-i),c=s("div","lb-bundle-pricing"),p=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(p.textContent="Total",o&&a){let m=document.createElement("span");m.setAttribute("data-item-count",""),m.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,p.appendChild(m)}c.appendChild(p);let u=s("span","lb-bundle-pricing__prices");if(n&&d>0){let m=s("span","lb-bundle-compare-price",{"data-compare-price":""});m.textContent=D(l,r),u.appendChild(m)}let C=s("span","lb-bundle-sale-price",{"data-total-price":""});return C.textContent=D(i,r),u.appendChild(C),c.appendChild(u),c}function Lt(e,t,r){let o=e[t],n=o?o.pricePerUnitCents*o.qty:0,a=o?o.basePricePerUnitCents*o.qty:0,i=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});i<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let c=s("span","",{"data-savings-amount":""});return c.textContent=D(i,r),l.appendChild(c),l}function Ln(e,t){let r=e.products[0],o=e.volumeTiers[0]?.minQuantity??1,n=r?.variants.nodes.some(l=>Z(l,o)),a=n?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",i=be(a);return n||(i.disabled=!0),i.addEventListener("click",()=>{i.disabled||t()}),i}function It(e,t,r){if(!e)return null;let{tier:o}=e;if(r==="fixed_amount"){let n=o.amount??0;return n>0?`-${D(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=o.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function Pn(e){let t=0,r=0;return e.forEach((o,n)=>{let a=o.basePricePerUnitCents-o.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function Pt(e,t,r){return Math.max(t,Math.min(r,e))}var Mn=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),Ee=new Set,Te=!1;function Rt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of Ee)r.classList.add(e),r.classList.remove(t)}function Dt(e){Mn.has(e.key)&&Rt("using-keyboard")}function Ft(){Rt("using-mouse")}function In(){Te||(Te=!0,document.addEventListener("keydown",Dt,!0),document.addEventListener("pointerdown",Ft,!0))}function Rn(){Te&&(Te=!1,document.removeEventListener("keydown",Dt,!0),document.removeEventListener("pointerdown",Ft,!0))}function Le(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),Ee.add(e),In(),()=>{Ee.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),Ee.size===0&&Rn()}}var We=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
260
|
+
</svg>`;function $e(e,t){return e.productRules[t]??pt}function Ue(e,t,r){let o=0;for(let n of e)n.productId===t&&n.variantId===r&&(o+=n.quantity);return o}function Lt(e,t,r,o){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",i=t.minQuantity??1,l=n.mixMatchShowQuantitySelector!==!1,s=Pn(t,n.outOfStockBehavior);if(s.filter(y=>!y.isOos).length<i)return;let p=[],u=c("div","lb-mix-match",{"data-required-quantity":String(i)}),C=kn(t);if(u.appendChild(C),n.countdown.showCountdown&&t.endsAt){let y=pe(t.endsAt);y&&(u.appendChild(y.el),o?.(y.stop))}let m=_n(i);u.appendChild(m.el);let g=c("div","lb-mix-match__slots",{"data-selection-slots":""});u.appendChild(g),u.appendChild(c("div","lb-bundle-divider"));let k=En(n.pricing.showCompareAtPrice);u.appendChild(k.el);let A=n.savingsBar.visible?Tn():null;A&&u.appendChild(A.el);let x=be(`Select ${i} items to unlock`);x.disabled=!0,x.addEventListener("click",()=>{x.disabled||r(Cn(p,t))});let E=An(t,s,a,{showSearch:n.showSearch,showQtySelector:l,selections:p,onAdd:(y,B,f)=>_(y,B,f),isComplete:()=>p.length>=i,getFocusAfterAdd:()=>g.querySelector(".lb-mix-match__slot--empty")??x});u.appendChild(E.el),u.appendChild(x),u.appendChild(c("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),u.appendChild(c("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(u),o?.(()=>Ee(u)),h();function _(y,B,f){if(p.length>=i)return;let V=$e(t,y.id),P=Ne(B,V.max,Ue(p,y.id,B.id));if(P<V.min)return;let T=Math.max(V.min,Math.min(f,P));p.push({productId:y.id,productTitle:y.title,variantId:B.id,variantTitle:B.title,imageUrl:B.image?.url??y.featuredImage?.url??null,priceCents:j(B.price.amount),compareCents:B.compareAtPrice?j(B.compareAtPrice.amount):null,unitPriceLabel:le(B.unitPrice,B.unitPriceMeasurement,a),quantity:T}),h()}function O(y){y<0||y>=p.length||(p.splice(y,1),h())}function h(){M(),m.update(p.length),k.update(p,t,a),A&&A.update(p,t,a),E.refreshCounts(),L()}function M(){g.innerHTML="";let y=Math.max(i,p.length);for(let B=0;B<y;B++){let f=p[B];f?g.appendChild(Sn(f,B,a,()=>O(B))):g.appendChild(Bn(B,()=>E.open()))}}function L(){let y=p.length;y<i?(x.disabled=!0,He(x,`Select ${i-y} more to unlock`)):(x.disabled=!1,He(x,n.cta.ctaText||"Add to cart"))}}function Cn(e,t){let r=new Map;for(let o of e){let n=`${o.productId}::${o.variantId}`,a=r.get(n);a?a.quantity+=o.quantity:r.set(n,{variantId:o.variantId,quantity:o.quantity})}return Array.from(r.values()).map(o=>({merchandiseId:o.variantId,quantity:o.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}))}function kn(e){let t=e.widgetConfig,r=c("div","lb-bundle-header"),o=c("div","lb-bundle-header__content"),n=c("h3","lb-bundle-title");if(n.textContent=e.title,o.appendChild(n),r.appendChild(o),t.pricing.showSaveBadge){let{discountType:a,discountValue:i}=e.discountConfig,l=null;if(a==="percentage"&&i>0?l=`-${Math.round(i)}%`:a==="fixed_amount"&&i>0&&(l=`-${D(Math.round(i*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let s=c("span","lb-bundle-header__badge");s.textContent=l,r.appendChild(s)}}return r}function _n(e){let t=c("div","lb-mix-match__progress"),r=c("div","lb-mix-match__progress-labels"),o=c("span","lb-mix-match__progress-count",{"data-progress-count":"","aria-live":"polite"});o.textContent=`0 of ${e} selected`,r.appendChild(o);let n=c("span","lb-mix-match__progress-remaining",{"data-progress-remaining":"","aria-live":"polite"});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=c("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),i=c("div","lb-mix-match__progress-fill",{"data-progress-fill":""});i.style.width="0%",a.appendChild(i),t.appendChild(a);function l(s){let d=Math.min(100,s/e*100);o.textContent=`${s} of ${e} selected`,s>=e?n.textContent="Complete":n.textContent=`${e-s} more to go`,i.style.width=`${d}%`,a.setAttribute("aria-valuenow",String(Math.min(s,e)))}return{el:t,update:l}}function Bn(e,t){let r=c("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"}),o=c("div","lb-mix-match__empty-thumb");o.innerHTML=vn,r.appendChild(o);let n=c("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 Sn(e,t,r,o){let n=c("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=c("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let g=document.createElement("img");g.src=re(e.imageUrl,{width:U,height:U,crop:"center"}),g.alt=e.productTitle,g.width=U,g.height=U,g.loading="lazy",a.appendChild(g)}else a.insertAdjacentHTML("beforeend",Tt);let i=c("span","lb-bundle-qty-badge");i.textContent=`\xD7${e.quantity}`,a.appendChild(i),n.appendChild(a);let l=c("div","lb-mix-match__filled-info"),s=c("span","lb-mix-match__filled-title");if(s.textContent=e.productTitle,l.appendChild(s),e.variantTitle&&e.variantTitle!=="Default Title"){let g=c("span","lb-mix-match__filled-variant");g.textContent=e.variantTitle,l.appendChild(g)}let d=e.priceCents*e.quantity,p=e.compareCents!==null?e.compareCents*e.quantity:null,u=c("span","lb-mix-match__filled-price");if(p!==null&&p>d){let g=c("span","lb-mix-match__filled-compare");g.textContent=D(p,r),u.appendChild(g)}let C=document.createElement("span");if(C.textContent=D(d,r),u.appendChild(C),l.appendChild(u),e.unitPriceLabel){let g=c("span","lb-bundle-product-unit-price");g.textContent=e.unitPriceLabel,l.appendChild(g)}n.appendChild(l);let m=document.createElement("button");return m.type="button",m.className="lb-mix-match__slot-remove",m.setAttribute("aria-label",`Remove ${e.productTitle}`),m.innerHTML=At,m.addEventListener("click",g=>{g.stopPropagation(),o()}),n.appendChild(m),n}function En(e){let t=c("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=c("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let o=c("span","lb-bundle-pricing__prices"),n=c("span","lb-bundle-compare-price",{"data-compare-price":""});e&&o.appendChild(n);let a=c("span","lb-bundle-sale-price",{"data-sale-price":""});o.appendChild(a),t.appendChild(o);function i(l,s,d){if(l.length===0){t.style.display="none";return}t.style.display="";let p=l.reduce((C,m)=>C+m.priceCents*m.quantity,0),u=Ce(p,s.discountConfig);e&&p>u?(n.textContent=D(p,d),n.style.display=""):n.style.display="none",a.textContent=D(u,d)}return{el:t,update:i}}function Tn(){let e=c("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=c("span","",{"data-savings-amount":""});e.appendChild(r);function o(n,a,i){if(n.length===0){e.style.display="none";return}let l=n.reduce((p,u)=>p+u.priceCents*u.quantity,0),s=Ce(l,a.discountConfig),d=Math.max(0,l-s);if(d<=0){e.style.display="none";return}e.style.display="",r.textContent=D(d,i)}return{el:e,update:o}}function An(e,t,r,o){let n=c("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=c("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Et(e.id)}`,tabindex:"-1"}),i=c("div","lb-mix-match__modal-header"),l=c("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Et(e.id)}`});l.textContent="Pick an item",i.appendChild(l);let s=document.createElement("button");s.type="button",s.className="lb-mix-match__modal-close",s.setAttribute("data-modal-close",""),s.setAttribute("aria-label","Close"),s.innerHTML=At,s.addEventListener("click",L),i.appendChild(s),a.appendChild(i);let d=null,p=null;if(o.showSearch){let f=c("div","lb-mix-match__modal-search");d=document.createElement("input"),d.type="text",d.className="lb-mix-match__modal-search-input",d.setAttribute("data-modal-search",""),d.setAttribute("role","searchbox"),d.setAttribute("aria-label","Search products"),d.setAttribute("placeholder","Search products"),d.autocomplete="off",d.addEventListener("input",()=>E()),f.appendChild(d),p=document.createElement("button"),p.type="button",p.className="lb-mix-match__modal-search-clear",p.setAttribute("data-modal-search-clear",""),p.setAttribute("aria-label","Clear search"),p.style.display="none",p.innerHTML=xn,p.addEventListener("click",()=>{d&&(d.value="",E(),d.focus())}),f.appendChild(p),a.appendChild(f)}let u=c("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(u);let C=c("div","lb-mix-match__modal-empty",{"data-modal-empty":""});C.style.display="none";let m=document.createElement("p");m.textContent="No products match your search.",C.appendChild(m),a.appendChild(C);let g=c("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(g),n.appendChild(a);let k=!1,A=[];function x(){k||(k=!0,u.innerHTML="",t.forEach(f=>{let V=$e(e,f.product.id),P=f.variants,T=f.variants.find(q=>Z(q,V.min))??f.firstAvailableVariant??f.variants[0];if(!T)return;let S=T,I=c("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(/^.*\//,"")}),F=c("div","lb-mix-match__modal-product-thumb"),v=(f.variants.find(q=>Z(q,V.min))??f.variants[0]??null)?.image??f.product.featuredImage??null,b=null;v?(b=document.createElement("img"),b.src=re(v.url,{width:U,height:U,crop:"center"}),b.alt=v.altText??f.product.title,b.width=U,b.height=U,b.loading="lazy",F.appendChild(b)):F.insertAdjacentHTML("beforeend",Tt);let w=c("span","lb-bundle-qty-badge");w.hidden=!0,F.appendChild(w),I.appendChild(F);let R=c("div","lb-mix-match__modal-product-info"),ne=c("p","lb-mix-match__modal-product-title");ne.textContent=f.product.title,R.appendChild(ne);let Y=c("p","lb-mix-match__modal-product-price");Y.textContent=D(j(S.price.amount),r),R.appendChild(Y);let ee=c("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),ze=le(S.unitPrice,S.unitPriceMeasurement,r);ze?ee.textContent=ze:ee.hidden=!0,R.appendChild(ee);let he=c("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});he.hidden=!0,R.appendChild(he);let je=q=>{ue(q,V.min,e.widgetConfig.lowStockThreshold,e.widgetConfig.showLowStockBadge)?(he.textContent=`Only ${q.quantityAvailable} left`,he.hidden=!1):he.hidden=!0};je(S);let Qe=()=>{let q=Ue(o.selections,f.product.id,S.id),X=Ne(S,V.max,q),oe=Math.max(V.min,X);return{min:V.min,max:oe,cap:X}},G=null,ve=null;!f.isOos&&o.showQtySelector&&(ve=c("div","lb-bundle-variant-option-group lb-mix-match__qty-stepper-group"),G=Ln({initial:V.min,getBounds:()=>{let{min:q,max:X}=Qe();return{min:q,max:X}}}),ve.appendChild(G.el));let me={el:I,product:f.product,variant:T,refreshFromSelections:()=>{}},se=[];if(P.length>1){let q=P[0].selectedOptions.map($=>$.name),X=f.product.id.replace(/^.*\//,""),oe=$=>P.find(N=>N.selectedOptions.length===$.length&&N.selectedOptions.every((Q,H)=>Q.value===$[H]))??null,xe=$=>{$.selectedOptions.forEach((N,Q)=>{let H=se[Q];H&&H.value!==N.value&&(H.value=N.value)})},ie=($,N,Q)=>P.some(H=>!Z(H,V.min)||H.selectedOptions[$]?.value!==N?!1:H.selectedOptions.every((z,ge)=>ge===$||z.value===Q[ge])),Pe=$=>{se.forEach((N,Q)=>{Array.from(N.options).forEach(H=>{H.disabled=!ie(Q,H.value,$)})})},zt=()=>{let $=se.map(z=>z.value),N=oe($);if(!N){xe(S),Pe(S.selectedOptions.map(z=>z.value));return}S=N,me.variant=N,Y.textContent=D(j(S.price.amount),r);let Q=le(S.unitPrice,S.unitPriceMeasurement,r);Q?(ee.textContent=Q,ee.hidden=!1):(ee.textContent="",ee.hidden=!0);let H=S.image??f.product.featuredImage;b&&H&&(b.src=re(H.url,{width:U,height:U,crop:"center"}),b.alt=H.altText??f.product.title),Pe(N.selectedOptions.map(z=>z.value)),je(S),me.refreshFromSelections()},Ke=c("div","lb-bundle-variant-option-groups");q.forEach(($,N)=>{let Q=c("div","lb-bundle-variant-option-group"),H=c("span","lb-bundle-variant-option-label");H.textContent=$,Q.appendChild(H);let z=document.createElement("select");z.className="lb-mix-match__variant-select",z.setAttribute("data-variant-option",""),z.setAttribute("data-option-position",String(N+1)),z.name=`lb-variant-${X}-${N+1}`,z.setAttribute("aria-label",$);let ge=new Set;P.forEach(jt=>{let de=jt.selectedOptions[N]?.value;if(!de||ge.has(de))return;ge.add(de);let ye=document.createElement("option");ye.value=de,ye.textContent=de,T.selectedOptions[N]?.value===de&&(ye.selected=!0),z.appendChild(ye)}),z.addEventListener("change",zt),se.push(z),Q.appendChild(z),Ke.appendChild(Q)}),R.appendChild(Ke),Pe(T.selectedOptions.map($=>$.value))}else if(P.length===1&&T.title!=="Default Title"){let q=c("span","lb-mix-match__filled-variant");q.textContent=T.title,R.appendChild(q)}if(f.isOos){let q=c("span","lb-mix-match__modal-sold-out-label");q.textContent="Sold out",R.appendChild(q)}I.appendChild(R);let W=null,Wt=()=>{if(!W){se.forEach(ie=>{ie.disabled=!0}),G&&G.setExternallyDisabled(!0);return}let{cap:q}=Qe(),X=Ue(o.selections,f.product.id,S.id);X>0?(w.textContent=String(X),w.hidden=!1):w.hidden=!0,o.selections.some(ie=>ie.productId===f.product.id)?(W.disabled=!0,W.textContent="Added",W.setAttribute("aria-label",`Added ${f.product.title}`),I.classList.add("lb-mix-match__modal-product--in-bundle")):(W.textContent="Add",W.setAttribute("aria-label",`Add ${f.product.title}`),I.classList.remove("lb-mix-match__modal-product--in-bundle"),W.disabled=o.isComplete()||q<V.min);let xe=W.disabled;se.forEach(ie=>{ie.disabled=xe}),G&&G.setExternallyDisabled(xe)};if(!f.isOos){let q=c("div","lb-mix-match__modal-product-actions");ve&&q.appendChild(ve),W=document.createElement("button"),W.type="button",W.className="lb-mix-match__modal-add",W.textContent="Add",W.setAttribute("aria-label",`Add ${f.product.title}`),W.addEventListener("click",()=>{if(!W||W.disabled||o.isComplete())return;let X=G?G.value():V.min;o.onAdd(f.product,S,X),G&&G.reset(V.min);let oe=o.getFocusAfterAdd();oe&&(_=oe),L()}),q.appendChild(W),R.appendChild(q)}me.refreshFromSelections=()=>{G&&G.refresh(),Wt()},me.refreshFromSelections(),A.push(me),u.appendChild(I)}),Se(u),B())}function E(){if(!d)return;let f=d.value.trim().toLowerCase();p&&(p.style.display=f?"":"none");let V=0;A.forEach(P=>{let T=!f||P.product.title.toLowerCase().includes(f);P.el.style.display=T?"":"none",T&&V++}),C.style.display=V===0&&f?"":"none"}let _=null;function O(f){if(f.key==="Escape"){f.preventDefault(),L();return}f.key==="Tab"&&Mn(f,a)}let h=!1;function M(){h||o.isComplete()||(h=!0,x(),_=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",O),n.addEventListener("click",y))}function L(){h&&(h=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",O),n.removeEventListener("click",y),_ instanceof HTMLElement&&_.focus())}function y(f){f.target===n&&L()}function B(){A.forEach(f=>f.refreshFromSelections())}return{el:n,open:M,close:L,refreshCounts:B}}function Ln(e){let t=c("div","lb-mix-match__qty-stepper",{role:"group","aria-label":"Quantity"}),r=document.createElement("button");r.type="button",r.className="lb-mix-match__qty-stepper-button lb-mix-match__qty-stepper-button--minus",r.setAttribute("aria-label","Decrease quantity"),r.innerHTML=yn,t.appendChild(r);let o=c("span","lb-mix-match__qty-stepper-value",{"aria-live":"polite"});t.appendChild(o);let n=document.createElement("button");n.type="button",n.className="lb-mix-match__qty-stepper-button lb-mix-match__qty-stepper-button--plus",n.setAttribute("aria-label","Increase quantity"),n.innerHTML=wn,t.appendChild(n);let a=l(e.initial,e.getBounds()),i=!1;function l(d,p){return Math.max(p.min,Math.min(p.max,d))}function s(){let d=e.getBounds();a=l(a,d),o.textContent=String(a),r.disabled=i||a<=d.min,n.disabled=i||a>=d.max}return r.addEventListener("click",()=>{let d=e.getBounds();a=l(a-1,d),s()}),n.addEventListener("click",()=>{let d=e.getBounds();a=l(a+1,d),s()}),s(),{el:t,value:()=>a,reset(d){a=l(d,e.getBounds()),s()},refresh:s,setExternallyDisabled(d){i=d,s()}}}function Pn(e,t){let r=[],o=new Set;for(let n of e.products){if(o.has(n.id))continue;o.add(n.id);let a=$e(e,n.id),i=n.variants.nodes.filter(s=>Z(s,a.min)),l=i.length===0;l&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:i[0]??null,isOos:l})}return r}function Mn(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let o=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===o?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),o.focus())}function Et(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Rt(e,t,r,o){let n=t.widgetConfig,a=t.products[0],i=t.volumeTiers[0]?.minQuantity??1,l=a?.variants.nodes.find(h=>Z(h,i));if(!l&&n.outOfStockBehavior==="hide")return;let s=l?j(l.price.amount):0,d=l?.price.currencyCode??"USD",p=t.discountConfig.discountType,u=t.volumeTiers.map((h,M)=>{let L;if(p==="fixed_amount"){let y=Math.round((h.amount??0)*100);L=Math.max(0,s-y)}else{let y=h.percentage??0,B=Math.floor(s*y/100);L=Math.max(0,s-B)}return{tier:h,index:M,qty:h.minQuantity,pricePerUnitCents:L,basePricePerUnitCents:s}}),C=Vn(u),m=n.defaultTier==="best_value"?C:0;typeof n.defaultTier=="number"&&(m=It(n.defaultTier,0,u.length-1));let g=n.popularBadge.tierIndex!==void 0?It(n.popularBadge.tierIndex,0,u.length-1):C,k=c("div","lb-volume");if(k.appendChild(In(t,u,m,d,p)),n.countdown.showCountdown&&t.endsAt){let h=pe(t.endsAt);h&&(k.appendChild(h.el),o?.(h.stop))}let A=c("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});u.forEach(h=>{let M=Rn(h,h.index===m,d,n.popularBadge.visible&&h.index===g?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);M.addEventListener("click",()=>O(h.index)),M.addEventListener("keydown",L=>{if(L.key==="Enter"||L.key===" "){L.preventDefault(),O(h.index);return}if(L.key==="ArrowDown"||L.key==="ArrowRight"||L.key==="ArrowUp"||L.key==="ArrowLeft"){L.preventDefault();let y=L.key==="ArrowDown"||L.key==="ArrowRight"?1:-1,B=(h.index+y+u.length)%u.length;O(B),A.children[B]?.focus()}}),A.appendChild(M)}),k.appendChild(A),k.appendChild(c("div","lb-bundle-divider"));let x=Pt(u,m,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);k.appendChild(x);let E=n.savingsBar.visible?Mt(u,m,d):null;E&&k.appendChild(E);let _=Dn(t,()=>{if(!l)return;let h=u[m];h&&r([{merchandiseId:l.id,quantity:h.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});if(l&&ue(l,i,n.lowStockThreshold,n.showLowStockBadge)){let h=c("span","lb-bundle-low-stock-badge",{"data-low-stock-badge":""});h.textContent=`Only ${l.quantityAvailable} left`,k.appendChild(h)}k.appendChild(_),k.appendChild(c("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),k.appendChild(c("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(k);function O(h){if(h===m||h<0||h>=u.length)return;m=h,Array.from(A.children).forEach((y,B)=>{y.setAttribute("aria-checked",String(B===h)),y.tabIndex=B===h?0:-1});let M=Pt(u,h,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(x.replaceWith(M),x=M,E){let y=Mt(u,h,d);E.replaceWith(y),E=y}let L=k.querySelector("[data-header-badge]");if(L){let y=Dt(u[h],d,p);y?(L.textContent=y,L.style.display=""):L.style.display="none"}}}function In(e,t,r,o,n){let a=e.widgetConfig,i=c("div","lb-bundle-header"),l=c("div","lb-bundle-header__content"),s=c("h3","lb-bundle-title");if(s.textContent=e.title,l.appendChild(s),i.appendChild(l),a.pricing.showSaveBadge){let d=Dt(t[r],o,n);if(d){let p=c("span","lb-bundle-header__badge",{"data-header-badge":""});p.textContent=d,i.appendChild(p)}}return i}function Rn(e,t,r,o,n,a){let i=c("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=c("span","lb-volume__radio");l.appendChild(c("span","lb-volume__radio-dot")),i.appendChild(l);let s=c("span","lb-volume__tier-grid"),d=c("span","lb-volume__tier-label");d.textContent=`Buy ${e.qty}`,s.appendChild(d);let p=c("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let C=c("span","lb-volume__tier-compare");C.textContent=D(e.basePricePerUnitCents,r),p.appendChild(C)}if(a){let C=document.createElement("span");C.setAttribute("data-tier-price-each",""),C.textContent=D(e.pricePerUnitCents,r),p.appendChild(C);let m=c("span","lb-volume__tier-unit");m.textContent=" each",p.appendChild(m)}s.appendChild(p),i.appendChild(s);let u=c("span","lb-volume__tier-badge");return o?u.textContent=o:u.style.display="none",i.appendChild(u),i}function Pt(e,t,r,o,n){let a=e[t],i=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,s=Math.max(0,l-i),d=c("div","lb-bundle-pricing"),p=c("span","lb-bundle-pricing__label",{"data-total-label":""});if(p.textContent="Total",o&&a){let m=document.createElement("span");m.setAttribute("data-item-count",""),m.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,p.appendChild(m)}d.appendChild(p);let u=c("span","lb-bundle-pricing__prices");if(n&&s>0){let m=c("span","lb-bundle-compare-price",{"data-compare-price":""});m.textContent=D(l,r),u.appendChild(m)}let C=c("span","lb-bundle-sale-price",{"data-total-price":""});return C.textContent=D(i,r),u.appendChild(C),d.appendChild(u),d}function Mt(e,t,r){let o=e[t],n=o?o.pricePerUnitCents*o.qty:0,a=o?o.basePricePerUnitCents*o.qty:0,i=Math.max(0,a-n),l=c("div","lb-bundle-savings-bar",{"data-savings-bar":""});i<=0&&(l.style.display="none");let s=document.createElement("span");s.textContent="You save",l.appendChild(s);let d=c("span","",{"data-savings-amount":""});return d.textContent=D(i,r),l.appendChild(d),l}function Dn(e,t){let r=e.products[0],o=e.volumeTiers[0]?.minQuantity??1,n=r?.variants.nodes.some(l=>Z(l,o)),a=n?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",i=be(a);return n||(i.disabled=!0),i.addEventListener("click",()=>{i.disabled||t()}),i}function Dt(e,t,r){if(!e)return null;let{tier:o}=e;if(r==="fixed_amount"){let n=o.amount??0;return n>0?`-${D(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=o.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function Vn(e){let t=0,r=0;return e.forEach((o,n)=>{let a=o.basePricePerUnitCents-o.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function It(e,t,r){return Math.max(t,Math.min(r,e))}var qn=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),Te=new Set,Ae=!1;function Vt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of Te)r.classList.add(e),r.classList.remove(t)}function qt(e){qn.has(e.key)&&Vt("using-keyboard")}function Ot(){Vt("using-mouse")}function On(){Ae||(Ae=!0,document.addEventListener("keydown",qt,!0),document.addEventListener("pointerdown",Ot,!0))}function Fn(){Ae&&(Ae=!1,document.removeEventListener("keydown",qt,!0),document.removeEventListener("pointerdown",Ot,!0))}function Le(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),Te.add(e),On(),()=>{Te.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),Te.size===0&&Fn()}}var We=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
|
|
261
261
|
|
|
262
262
|
.lb-bundle-widget.lb-bundle-widget,
|
|
263
263
|
.lb-bundle-widget.lb-bundle-widget * {
|
|
@@ -865,7 +865,7 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
865
865
|
.lb-ab-pending {
|
|
866
866
|
visibility: hidden;
|
|
867
867
|
}
|
|
868
|
-
`,
|
|
868
|
+
`,Ft=`/* Lime Bundles \u2014 Fixed bundle styles */
|
|
869
869
|
|
|
870
870
|
.lb-fixed__products {
|
|
871
871
|
display: flex;
|
|
@@ -941,7 +941,7 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
941
941
|
outline-offset: 2px;
|
|
942
942
|
box-shadow: none;
|
|
943
943
|
}
|
|
944
|
-
`,
|
|
944
|
+
`,Nt=`/* Lime Bundles \u2014 Mix & Match styles */
|
|
945
945
|
|
|
946
946
|
/* === Slot list ============================================================
|
|
947
947
|
Caps the height of the slot stack so long bundles don't push the CTA off
|
|
@@ -1573,7 +1573,7 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
1573
1573
|
transition: none;
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
|
-
`,
|
|
1576
|
+
`,Ht=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
|
|
1577
1577
|
|
|
1578
1578
|
.lb-volume__tiers {
|
|
1579
1579
|
display: flex;
|
|
@@ -1713,7 +1713,7 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
|
|
1715
1715
|
|
|
1716
|
-
`,
|
|
1716
|
+
`,Ut=`/**
|
|
1717
1717
|
* Lime Bundles \u2014 Custom variant-picker dropdown styling.
|
|
1718
1718
|
*
|
|
1719
1719
|
* Reuses existing CSS variables: no new merchant-configurable surface.
|
|
@@ -1966,7 +1966,7 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
1966
1966
|
[data-modal-overlay] > .lb-dropdown-listbox::-webkit-scrollbar-thumb {
|
|
1967
1967
|
background: color-mix(in srgb, var(--lb-picker-text) 15%, transparent);
|
|
1968
1968
|
}
|
|
1969
|
-
|
|
1969
|
+
`,$t=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
|
|
1970
1970
|
|
|
1971
1971
|
.lb-bundle-widget--loading {
|
|
1972
1972
|
display: block;
|
|
@@ -2062,10 +2062,10 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
2062
2062
|
animation: none;
|
|
2063
2063
|
}
|
|
2064
2064
|
}
|
|
2065
|
-
`;var
|
|
2066
|
-
`),this.shadow.appendChild(t),this.shopCustomCss){let o=document.createElement("style");o.setAttribute("data-lime-bundles","shop-custom-css"),o.textContent=this.shopCustomCss,this.shadow.appendChild(o)}for(let o of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",o.title),n.setAttribute("data-bundle-type",o.bundleType),n.setAttribute("data-bundle-gid",o.id),
|
|
2065
|
+
`;var Nn=e=>`lb_cart_id:${e}`;function Hn(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 fe=class extends HTMLElement{static observedAttributes=["shop-domain","storefront-token","bundle-gid","product-handle","app-url","analytics","locale","country","language","market-id"];buyer=void 0;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,o){r===o||!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"}get country(){return this.getAttribute("country")??void 0}get language(){return this.getAttribute("language")??void 0}get marketId(){return this.getAttribute("market-id")??void 0}wrapQueryForContext(t){return it({shopDomain:this.shopDomain,accessToken:this.storefrontToken,country:this.country,language:this.language,buyer:this.buyer})?at(t):t}isMarketHidden(t){return t.marketVisibility!=="specific"?!1:this.marketId?!t.marketIds.includes(this.marketId):!0}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=De({shopDomain:this.shopDomain,accessToken:this.storefrontToken,country:this.country,language:this.language,buyer:this.buyer});try{let o,n=!1;if(this.bundleGid)n=!0,o=this.fetchSingleBundle(r,t.signal);else{let l=Hn(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}o=this.fetchProductBundles(r,t.signal,l)}let a=r.query(st,void 0,{signal:t.signal}).catch(()=>null);if(await o,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let i=await a;if(i?.shop?.metafield?.value){Ct(this.shopDomain,i.shop.metafield.value);let l=qe(i.shop.metafield.value);l.ok&&(this.shopCustomCss=l.css)}await this.applyABVariants(),this.renderBundles()}catch(o){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(o instanceof Error?o.message:"Failed to load bundle")}}async applyABVariants(){if(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 wt(r.abTestId,r.id))?.variant==="B")return mt(r)}catch(o){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,o)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let o=await t.query(this.wrapQueryForContext(lt),{id:this.bundleGid},{signal:r});if(!o.metaobject){this.bundles=[];return}let n=Ve(o.metaobject.id,o.metaobject.fields);this.bundles=n&&!this.isMarketHidden(n)?[n]:[]}async fetchProductBundles(t,r,o){let n=await t.query(this.wrapQueryForContext(dt),{handle:o},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],i=[];for(let l of a){let s=Ve(l.id,l.fields);s&&!this.isMarketHidden(s)&&i.push(s)}this.bundles=i}handleAddToCart=async(t,r)=>{let o=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(o);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=De({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),o=window.localStorage,n=Nn(this.shopDomain),a=o?.getItem(n)??null;try{let i=null;if(a){let s=(await r.query(ut,{cartId:a,lines:t})).cartLinesAdd;s?.userErrors?.length?o?.removeItem(n):s?.cart&&(i=s.cart.checkoutUrl)}if(!i){let s=(await r.query(ct,{input:{lines:t}})).cartCreate;s?.cart&&(o?.setItem(n,s.cart.id),i=s.cart.checkoutUrl)}i?window.location.assign(i):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(i){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:i instanceof Error?i.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let o=r.reduce((a,i)=>a+i.quantity,0),n=r.reduce((a,i)=>{let s=t.products.find(p=>p.variants.nodes.some(u=>u.id===i.merchandiseId))?.variants.nodes.find(p=>p.id===i.merchandiseId),d=s?parseFloat(s.price.amount):0;return a+d*i.quantity},0);ft({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:o,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[We,Ft,Nt,Ht,Ut].join(`
|
|
2066
|
+
`),this.shadow.appendChild(t),this.shopCustomCss){let o=document.createElement("style");o.setAttribute("data-lime-bundles","shop-custom-css"),o.textContent=this.shopCustomCss,this.shadow.appendChild(o)}for(let o of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",o.title),n.setAttribute("data-bundle-type",o.bundleType),n.setAttribute("data-bundle-gid",o.id),bt(n,o.widgetConfig),this.renderCleanups.push(Le(n));let a=l=>this.handleAddToCart(o,l),i=l=>this.renderCleanups.push(l);switch(o.bundleType){case"fixed":St(n,o,a,i);break;case"mix_match":Lt(n,o,a,i);break;case"volume":Rt(n,o,a,i);break}this.shadow.appendChild(n),this.setupImpressionFor(o,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(o=>o.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let o=vt(r,()=>{gt({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(o)}renderLoading(){this.shadow.innerHTML=`
|
|
2067
2067
|
<style>${We}</style>
|
|
2068
|
-
<style>${
|
|
2068
|
+
<style>${$t}</style>
|
|
2069
2069
|
<div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
|
|
2070
2070
|
<div class="lb-skeleton lb-skeleton--title"></div>
|
|
2071
2071
|
<div class="lb-skeleton--products">
|
|
@@ -2099,5 +2099,5 @@ a.lb-bundle-product-name:focus-visible {
|
|
|
2099
2099
|
<div class="lb-skeleton lb-skeleton--cta"></div>
|
|
2100
2100
|
</div>
|
|
2101
2101
|
</div>
|
|
2102
|
-
`}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",fe);return
|
|
2102
|
+
`}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",fe);return Jt(Un);})();
|
|
2103
2103
|
//# sourceMappingURL=lime-bundle.global.js.map
|