@lime-bundles/widget 2.3.0 → 2.4.1

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.
@@ -1,4 +1,4 @@
1
- "use strict";var LimeBundles=(()=>{var Y=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var qe=Object.getOwnPropertyNames;var ze=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var r in t)Y(e,r,{get:t[r],enumerable:!0})},Ge=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of qe(t))!ze.call(e,n)&&n!==r&&Y(e,n,{get:()=>t[n],enumerable:!(i=We(t,n))||i.enumerable});return e};var Qe=e=>Ge(Y({},"__esModule",{value:!0}),e);var Yt={};je(Yt,{LimeBundleElement:()=>G});var ae=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},Ke="2025-10";function X(e){let t=e.apiVersion??Ke,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(i,n,a){let o={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(o["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let d=await fetch(r,{method:"POST",headers:o,body:JSON.stringify({query:i,variables:n}),signal:a?.signal});if(!d.ok)throw new ae([{message:`Storefront API error: ${d.status} ${d.statusText}`}]);let l=await d.json();if(l.errors?.length)throw new ae(l.errors);return l.data}}}var pe=`#graphql
1
+ "use strict";var LimeBundles=(()=>{var ue=Object.defineProperty;var gt=Object.getOwnPropertyDescriptor;var ft=Object.getOwnPropertyNames;var vt=Object.prototype.hasOwnProperty;var xt=(e,t)=>{for(var r in t)ue(e,r,{get:t[r],enumerable:!0})},Ct=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ft(t))!vt.call(e,n)&&n!==r&&ue(e,n,{get:()=>t[n],enumerable:!(i=gt(t,n))||i.enumerable});return e};var yt=e=>Ct(ue({},"__esModule",{value:!0}),e);var Tr={};xt(Tr,{LimeBundleElement:()=>te,trackInputMode:()=>le});var we=class extends Error{constructor(e){super(e.map(t=>t.message).join("; ")),this.errors=e,this.name="StorefrontApiError"}},wt="2025-10";function pe(e){let t=e.apiVersion??wt,r=`https://${e.shopDomain}/api/${t}/graphql.json`;return{async query(i,n,a){let o={"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":e.accessToken};e.buyerIp&&(o["Shopify-Storefront-Buyer-IP"]=e.buyerIp);let l=await fetch(r,{method:"POST",headers:o,body:JSON.stringify({query:i,variables:n}),signal:a?.signal});if(!l.ok)throw new we([{message:`Storefront API error: ${l.status} ${l.statusText}`}]);let d=await l.json();if(d.errors?.length)throw new we(d.errors);return d.data}}}var Pe=`#graphql
2
2
  query BundleMetaobject($id: ID!) {
3
3
  metaobject(id: $id) {
4
4
  id
@@ -88,7 +88,7 @@
88
88
  }
89
89
  }
90
90
  }
91
- `,be=`#graphql
91
+ `,Le=`#graphql
92
92
  query ShopCustomCss {
93
93
  shop {
94
94
  metafield(namespace: "$app", key: "custom_css") {
@@ -96,7 +96,7 @@
96
96
  }
97
97
  }
98
98
  }
99
- `,he=`#graphql
99
+ `,Me=`#graphql
100
100
  query BundlesForProduct($handle: String!) {
101
101
  product(handle: $handle) {
102
102
  id
@@ -197,42 +197,42 @@
197
197
  }
198
198
  }
199
199
  }
200
- `,me=`#graphql
200
+ `,Re=`#graphql
201
201
  mutation CartCreate($input: CartInput!) {
202
202
  cartCreate(input: $input) {
203
203
  cart { id checkoutUrl }
204
204
  userErrors { field message }
205
205
  }
206
206
  }
207
- `,ge=`#graphql
207
+ `,Ie=`#graphql
208
208
  mutation CartLinesAdd($cartId: ID!, $lines: [CartLineInput!]!) {
209
209
  cartLinesAdd(cartId: $cartId, lines: $lines) {
210
210
  cart { id checkoutUrl }
211
211
  userErrors { field message }
212
212
  }
213
213
  }
214
- `,V=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},D={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,variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function Ye(e){if(!e||typeof e!="object")return D;let t=e;return{...D,...t,defaultTier:Xe(t.defaultTier),header:{...D.header,...t.header??{}},layout:{...D.layout,...t.layout??{}},productList:{...D.productList,...t.productList??{}},pricing:{...D.pricing,...t.pricing??{}},cta:{...D.cta,...t.cta??{}},savingsBar:{...D.savingsBar,...t.savingsBar??{}},countdown:{...D.countdown,...t.countdown??{}},popularBadge:{...D.popularBadge,...t.popularBadge??{}}}}function Xe(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:D.defaultTier}function Je(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,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var Ze={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"},et=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function fe(e,t){let r=Je(t);for(let[i,n]of Object.entries(Ze)){let a=r[i];if(a==null)continue;let o=et.has(i)?`${a}px`:String(a);e.style.setProperty(n,o)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`)}var tt=new Set(["fixed","mix_match","volume"]),rt=new Set(["active"]);function J(e,t){try{return nt(e,t)}catch(r){if(r instanceof V)return null;throw r}}function nt(e,t){let r=new Map(t.map(f=>[f.key,f])),i=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!tt.has(n))throw new V(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let o=n;if(!a||!rt.has(a))throw new V(`Bundle is not active: status=${a??"null"}`,"inactive");let d=a,l=r.get("starts_at")?.value??null,u=r.get("ends_at")?.value??null,c=new Date;if(l){let f=new Date(l);if(Number.isNaN(f.getTime()))throw new V(`Invalid starts_at: ${l}`,"invalid_type");if(f>c)throw new V(`Bundle not yet started: starts_at=${l}`,"not_started")}if(u){let f=new Date(u);if(Number.isNaN(f.getTime()))throw new V(`Invalid ends_at: ${u}`,"invalid_type");if(f<c)throw new V(`Bundle has expired: ends_at=${u}`,"expired")}let p=it(r),m=ot(r),C=at(r),b={id:e,title:i,description:r.get("description")?.value||null,status:d,products:p,discountConfig:m,widgetConfig:C,startsAt:l,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:lt(r),productQuantities:le(r,"product_quantities"),variantQuantities:le(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:dt(r)};switch(o){case"fixed":return{...b,bundleType:"fixed"};case"volume":return{...b,bundleType:"volume",volumeTiers:st(r)};case"mix_match":return{...b,bundleType:"mix_match",minQuantity:de(r,"min_quantity",{min:1}),maxQuantity:de(r,"max_quantity",{min:1})}}}function it(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let n of i.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function ot(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 at(e){return Ye(z(e,"widget_config"))}function lt(e){let t=z(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let i of t)Array.isArray(i)?r.push(i.filter(n=>typeof n=="string")):r.push([]);return r}function le(e,t){let r=z(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let i={};for(let[n,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[n]=Math.floor(o))}return i}function dt(e){if(!e.get("ab_test_id")?.value)return null;let r={},i=e.get("ab_title")?.value;i&&(r.title=i);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let l=parseFloat(o);Number.isFinite(l)&&(r.discountConfig={discountType:a,discountValue:l,allowStacking:e.get("allow_stacking")?.value==="true"})}let d=z(e,"ab_volume_tiers");return Array.isArray(d)&&(r.volumeTiers=d.filter(l=>typeof l=="object"&&l!==null).map(ve)),Object.keys(r).length===0?null:r}function st(e){let t=z(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(ve):[]}function ve(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 z(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function de(e,t,r={}){let i=e.get(t)?.value;if(!i)return null;let n=parseInt(i,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function Z(e,t,r){let i=e.variantQuantities[r];return i!==void 0?i:e.productQuantities[t]??1}function xe(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,i=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:i,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:i,discountConfig:n};case"fixed":return{...e,title:r,description:i,discountConfig:n}}}async function Ce(e,t){await _e(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 ye(e,t){await _e(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function we(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(i=>{for(let n of i)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function _e(e,t){let r=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,i)}catch{}}}var ct=!1;function ut(){if(ct)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var se="lb_session",pt=720*60*60,bt=720*60*60;function Be(e){return`__Host-_lb_ab_${e}`}async function ke(e,t,r,i){if(typeof document>"u")return null;let n=ht(i);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!ut())return{variant:"A",testId:r,persisted:!1};let a=gt(),o=ft(a,r);mt(i,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function ht(e){if(typeof document>"u")return null;let r=`${Be(e)}=`,n=document.cookie.split(";").map(l=>l.trim()).find(l=>l.startsWith(r));if(!n)return null;let a=n.substring(r.length),[o,d]=a.split("|");return o!=="A"&&o!=="B"||!d?null:{testId:d,variant:o}}function mt(e,t,r){if(typeof document>"u")return;let i=Be(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${i}=${n}; Path=/; Max-Age=${bt}; SameSite=Lax; Secure`}function gt(){if(typeof document>"u")return ce();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${se}=`))?.split("=")[1];if(t)return t;let r=ce();return document.cookie=`${se}=${r}; path=/; max-age=${pt}; SameSite=Lax; Secure`,r}function ce(){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 ft(e,t){let r=e+":"+t,i=2166136261;for(let n=0;n<r.length;n++)i^=r.charCodeAt(n),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var ue=1e4,vt=[[/@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"]],xt=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function ee(e){if(e.length>ue)return{ok:!1,error:`CSS exceeds ${ue.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of vt)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=r.exec(t))!==null;){let n=i[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!xt.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var Ct="lb-custom-css-";function Se(e,t){if(typeof document>"u"||!t)return!1;let r=ee(t);if(!r.ok||!r.css.trim())return!1;let i=Ct+yt(e),n=document.getElementById(i);return n||(n=document.createElement("style"),n.id=i,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function yt(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 wt(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 _t={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 j(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let i=parseFloat(e.amount);if(!Number.isFinite(i))return null;let n=_t[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",o=wt(i,a),d=t.referenceValue,l=d===1?n:`${d}${n}`;return`${o}/${l}`}function P(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function B(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function Te(e,t){return Math.max(0,e-Math.floor(e*t/100))}function te(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:n}=e.discountConfig,a=[],o=0,d=0;for(let p of e.products){let m=p.variants.nodes.find(x=>x.availableForSale)??p.variants.nodes[0];if(!m)continue;let C=P(m.price.amount),b=t[p.id]??1,f=C*b,w=m.compareAtPrice?P(m.compareAtPrice.amount):null;if(a.push({unitCents:C,qty:b,lineCents:f,compareCents:w}),o+=f,i==="percentage"){let x=Te(C,n);d+=x*b}else d+=f}i==="fixed_amount"&&(d=Math.max(0,o-Math.round(n*100)));let l=Math.max(0,o-d),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return r&&l>0&&(i==="percentage"&&n>0?c=`-${Math.round(n)}%`:i==="fixed_amount"&&n>0&&(c=`-${B(Math.round(n*100),u)}`)),{rows:a,totalCents:o,saleCents:d,savingsCents:l,headerBadge:c,currency:u}}function K(e,t){if(t.discountType==="percentage"){let r=Math.floor(e*t.discountValue/100);return Math.max(0,e-r)}return Math.max(0,e-Math.round(t.discountValue*100))}var L=152;function O(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 Ae(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),i=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,o=d=>String(d).padStart(2,"0");return r>0?`${r}d ${o(i)}h ${o(n)}m ${o(a)}s`:`${o(i)}h ${o(n)}m ${o(a)}s`}function H(e){let t=Bt(e);if(t===null||t<=Date.now())return null;let r=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),i.appendChild(n);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let d=null;function l(){let c=r-Date.now();if(c<=0){i.style.display="none",u();return}o.textContent=Ae(c)}function u(){d!==null&&(clearInterval(d),d=null)}return l(),d=setInterval(l,1e3),{el:i,stop:u}}function Bt(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function $(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let i=document.createElement("span");return i.className="lb-cta-spinner",i.setAttribute("data-cta-spinner",""),i.setAttribute("aria-hidden","true"),i.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(i),t}function re(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let i=document.createElement(e);t&&(i.className=t);for(let[n,a]of Object.entries(r))i.setAttribute(n,a);return i}var kt=`
214
+ `,G=class extends Error{constructor(e,t){super(e),this.reason=t,this.name="BundleParseError"}},$={header:{textColor:"#FFFFFF",headerStyle:"gradient",gradientStart:"#C62828",gradientEnd:"#AD1457",saveBadgeBgColor:"#FFFFFF",saveBadgeTextColor:"#AD1457",saveBadgeBorderColor:"#FFFFFF",saveBadgeBorderWidth:0,saveBadgeBorderRadius:8,countdownBgColor:"#FFF0F3",countdownTextColor:"#C62828"},layout:{backgroundColor:"#FFFFFF",borderColor:"#E5E5E5",borderWidth:1,borderRadius:12},productList:{textColor:"#1A1A1A",imageBorderWidth:0,imageBorderColor:"#E5E5E5",imageBorderRadius:8,thumbnailRatio:"square",variantBorderWidth:1,variantBorderColor:"#E5E5E5",variantBorderRadius:8,showPrice:!0,showCompareAtPrice:!0,showCountBubble:!0,countBubbleBgColor:"#1A1A1A",countBubbleTextColor:"#FFFFFF"},pricing:{showSaveBadge:!0,showComparePrice:!0,showPerUnitPrice:!0,showItemCount:!0,showCompareAtPrice:!0},cta:{ctaText:"Add to cart",primaryColor:"#1A1A1A",buttonTextColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},savingsBar:{visible:!0,bgColor:"#EDFBF1",textColor:"#2DB554",borderWidth:0,borderColor:"#2DB554",borderRadius:8},countdown:{showCountdown:!0},popularBadge:{visible:!0,text:"Most Popular",bgColor:"#1A1A1A",textColor:"#FFFFFF",borderWidth:0,borderColor:"#1A1A1A",borderRadius:12},outOfStockBehavior:"show_greyed_out",showSearch:!0,pickerBgColor:"#FFFFFF",pickerTextColor:"#1A1A1A",pickerBorderWidth:0,pickerBorderColor:"#E5E5E5",pickerBorderRadius:16,pickerSearchBorderWidth:1,pickerSearchBorderColor:"#E5E5E5",pickerSearchBorderRadius:8,pickerProductBorderWidth:0,pickerProductBorderColor:"#E5E5E5",pickerProductBorderRadius:8,pickerThumbnailRatio:"square",pickerShowCountBubble:!0,pickerCountBubbleBgColor:"#1A1A1A",pickerCountBubbleTextColor:"#FFFFFF",pickerAddBgColor:"#1A1A1A",pickerAddLabelColor:"#FFFFFF",pickerAddBorderWidth:0,pickerAddBorderColor:"#1A1A1A",pickerAddBorderRadius:8,pickerVariantBorderWidth:1,pickerVariantBorderColor:"#1A1A1A",pickerVariantBorderRadius:8,tierBorderColor:"#E5E5E5",tierBorderWidth:1,tierBorderRadius:12,tierSelectedBorderColor:"#1A1A1A",tierSelectedBorderWidth:2,defaultTier:"first"};function _t(e){if(!e||typeof e!="object")return $;let t=e;return{...$,...t,defaultTier:kt(t.defaultTier),header:{...$.header,...t.header??{}},layout:{...$.layout,...t.layout??{}},productList:{...$.productList,...t.productList??{}},pricing:{...$.pricing,...t.pricing??{}},cta:{...$.cta,...t.cta??{}},savingsBar:{...$.savingsBar,...t.savingsBar??{}},countdown:{...$.countdown,...t.countdown??{}},popularBadge:{...$.popularBadge,...t.popularBadge??{}}}}function kt(e){return e==="first"||e==="best_value"||typeof e=="number"&&Number.isInteger(e)&&e>=0?e:$.defaultTier}function Bt(e){return{primaryColor:e.cta.primaryColor,backgroundColor:e.layout.backgroundColor,textColor:e.productList.textColor,borderColor:e.layout.borderColor,borderWidth:e.layout.borderWidth,buttonTextColor:e.cta.buttonTextColor,ctaBorderWidth:e.cta.borderWidth,ctaBorderColor:e.cta.borderColor,ctaBorderRadius:e.cta.borderRadius,savingsBarBgColor:e.savingsBar.bgColor,savingsBarTextColor:e.savingsBar.textColor,savingsBarBorderWidth:e.savingsBar.borderWidth,savingsBarBorderColor:e.savingsBar.borderColor,savingsBarBorderRadius:e.savingsBar.borderRadius,borderRadius:e.layout.borderRadius,headerTextColor:e.header.textColor,saveBadgeBgColor:e.header.saveBadgeBgColor,saveBadgeTextColor:e.header.saveBadgeTextColor,saveBadgeBorderColor:e.header.saveBadgeBorderColor,saveBadgeBorderWidth:e.header.saveBadgeBorderWidth,saveBadgeBorderRadius:e.header.saveBadgeBorderRadius,countdownBgColor:e.header.countdownBgColor,countdownTextColor:e.header.countdownTextColor,headerStyle:e.header.headerStyle,headerGradientStart:e.header.gradientStart,headerGradientEnd:e.header.gradientEnd,showSaveBadge:e.pricing.showSaveBadge,imageBorderWidth:e.productList.imageBorderWidth,imageBorderColor:e.productList.imageBorderColor,imageBorderRadius:e.productList.imageBorderRadius,thumbnailRatio:e.productList.thumbnailRatio,variantBorderWidth:e.productList.variantBorderWidth,variantBorderColor:e.productList.variantBorderColor,variantBorderRadius:e.productList.variantBorderRadius,countBubbleBgColor:e.productList.countBubbleBgColor,countBubbleTextColor:e.productList.countBubbleTextColor,showProductPrice:e.productList.showPrice,showProductCompareAtPrice:e.productList.showCompareAtPrice,showCountBubble:e.productList.showCountBubble,showCountdown:e.countdown.showCountdown,ctaText:e.cta.ctaText,outOfStockBehavior:e.outOfStockBehavior,showComparePrice:e.pricing.showComparePrice,showPerUnitPrice:e.pricing.showPerUnitPrice,showItemCount:e.pricing.showItemCount,showCompareAtPrice:e.pricing.showCompareAtPrice,showMostPopular:e.popularBadge.visible,popularBadgeText:e.popularBadge.text,popularBadgeBgColor:e.popularBadge.bgColor,popularBadgeTextColor:e.popularBadge.textColor,popularBadgeBorderWidth:e.popularBadge.borderWidth,popularBadgeBorderColor:e.popularBadge.borderColor,popularBadgeBorderRadius:e.popularBadge.borderRadius,showSearch:e.showSearch,pickerBgColor:e.pickerBgColor,pickerTextColor:e.pickerTextColor,pickerBorderWidth:e.pickerBorderWidth,pickerBorderColor:e.pickerBorderColor,pickerBorderRadius:e.pickerBorderRadius,pickerSearchBorderWidth:e.pickerSearchBorderWidth,pickerSearchBorderColor:e.pickerSearchBorderColor,pickerSearchBorderRadius:e.pickerSearchBorderRadius,pickerProductBorderWidth:e.pickerProductBorderWidth,pickerProductBorderColor:e.pickerProductBorderColor,pickerProductBorderRadius:e.pickerProductBorderRadius,pickerThumbnailRatio:e.pickerThumbnailRatio,pickerShowCountBubble:e.pickerShowCountBubble,pickerCountBubbleBgColor:e.pickerCountBubbleBgColor,pickerCountBubbleTextColor:e.pickerCountBubbleTextColor,pickerAddBgColor:e.pickerAddBgColor,pickerAddLabelColor:e.pickerAddLabelColor,pickerAddBorderWidth:e.pickerAddBorderWidth,pickerAddBorderColor:e.pickerAddBorderColor,pickerAddBorderRadius:e.pickerAddBorderRadius,pickerVariantBorderWidth:e.pickerVariantBorderWidth,pickerVariantBorderColor:e.pickerVariantBorderColor,pickerVariantBorderRadius:e.pickerVariantBorderRadius,tierBorderColor:e.tierBorderColor,tierBorderWidth:e.tierBorderWidth,tierBorderRadius:e.tierBorderRadius,tierSelectedBorderColor:e.tierSelectedBorderColor,tierSelectedBorderWidth:e.tierSelectedBorderWidth,defaultTier:e.defaultTier,...e.popularBadge.tierIndex!==void 0&&{mostPopularTierIndex:e.popularBadge.tierIndex}}}var St={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"},Tt=new Set(["borderRadius","borderWidth","saveBadgeBorderWidth","saveBadgeBorderRadius","tierBorderWidth","tierBorderRadius","tierSelectedBorderWidth","savingsBarBorderWidth","savingsBarBorderRadius","ctaBorderWidth","ctaBorderRadius","popularBadgeBorderWidth","popularBadgeBorderRadius","imageBorderWidth","imageBorderRadius","variantBorderWidth","variantBorderRadius","pickerBorderWidth","pickerBorderRadius","pickerSearchBorderWidth","pickerSearchBorderRadius","pickerProductBorderWidth","pickerProductBorderRadius","pickerAddBorderWidth","pickerAddBorderRadius","pickerVariantBorderWidth","pickerVariantBorderRadius"]);function Fe(e,t){let r=Bt(t);for(let[a,o]of Object.entries(St)){let l=r[a];if(l==null)continue;let d=Tt.has(a)?`${l}px`:String(l);e.style.setProperty(o,d)}e.style.setProperty("--lb-product-price-display",t.productList.showPrice?"block":"none"),e.style.setProperty("--lb-product-compare-display",t.productList.showCompareAtPrice?"inline":"none"),e.style.setProperty("--lb-qty-badge-display",t.productList.showCountBubble?"flex":"none"),e.style.setProperty("--lb-picker-qty-badge-display",t.pickerShowCountBubble?"flex":"none"),e.style.setProperty("--lb-variant-chevron",_e(t.productList.variantBorderColor)),e.style.setProperty("--lb-picker-variant-chevron",_e(t.pickerVariantBorderColor)),t.header.headerStyle==="solid"?e.style.setProperty("--lb-header-bg",t.header.gradientStart):e.style.setProperty("--lb-header-bg",`linear-gradient(135deg, ${t.header.gradientStart}, ${t.header.gradientEnd})`);let i=ke(t.productList.thumbnailRatio);e.style.setProperty("--lb-thumbnail-aspect-ratio",i.aspectRatio),e.style.setProperty("--lb-thumbnail-img-fit",i.imgFit),e.style.setProperty("--lb-thumbnail-img-height",i.imgHeight);let n=ke(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 _e(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 ke(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 Et=new Set(["fixed","mix_match","volume"]),At=new Set(["active"]);function be(e,t){try{return Pt(e,t)}catch(r){if(r instanceof G)return null;throw r}}function Pt(e,t){let r=new Map(t.map(_=>[_.key,_])),i=r.get("title")?.value??"Bundle",n=r.get("bundle_type")?.value,a=r.get("status")?.value;if(!n||!Et.has(n))throw new G(`Invalid or missing bundle_type: ${n??"null"}`,"invalid_type");let o=n;if(!a||!At.has(a))throw new G(`Bundle is not active: status=${a??"null"}`,"inactive");let l=a,d=r.get("starts_at")?.value??null,u=r.get("ends_at")?.value??null,c=new Date;if(d){let _=new Date(d);if(Number.isNaN(_.getTime()))throw new G(`Invalid starts_at: ${d}`,"invalid_type");if(_>c)throw new G(`Bundle not yet started: starts_at=${d}`,"not_started")}if(u){let _=new Date(u);if(Number.isNaN(_.getTime()))throw new G(`Invalid ends_at: ${u}`,"invalid_type");if(_<c)throw new G(`Bundle has expired: ends_at=${u}`,"expired")}let h=Lt(r),f=Mt(r),x=Rt(r),p={id:e,title:i,description:r.get("description")?.value||null,status:l,products:h,discountConfig:f,widgetConfig:x,startsAt:d,endsAt:u,discountLabel:r.get("discount_label")?.value??null,selectedVariantIds:It(r),productQuantities:Be(r,"product_quantities"),variantQuantities:Be(r,"variant_quantities"),abTestId:r.get("ab_test_id")?.value??null,abVariantB:Ft(r)};switch(o){case"fixed":return{...p,bundleType:"fixed"};case"volume":return{...p,bundleType:"volume",volumeTiers:Vt(r)};case"mix_match":return{...p,bundleType:"mix_match",minQuantity:Se(r,"min_quantity",{min:1}),maxQuantity:Se(r,"max_quantity",{min:1})}}}function Lt(e){let t=[],r=e.get("products");if(r?.reference&&"variants"in r.reference&&t.push(r.reference),r?.references?.nodes)for(let n of r.references.nodes)"variants"in n?t.push(n):"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);let i=e.get("collection");if(i?.references?.nodes)for(let n of i.references.nodes)"products"in n&&n.products?.nodes&&t.push(...n.products.nodes);return t}function Mt(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 Rt(e){return _t(ee(e,"widget_config"))}function It(e){let t=ee(e,"selected_variant_ids");if(!Array.isArray(t))return null;let r=[];for(let i of t)Array.isArray(i)?r.push(i.filter(n=>typeof n=="string")):r.push([]);return r}function Be(e,t){let r=ee(e,t);if(!r||typeof r!="object"||Array.isArray(r))return{};let i={};for(let[n,a]of Object.entries(r)){let o=typeof a=="number"?a:Number(a);Number.isFinite(o)&&o>=0&&o<=99&&(i[n]=Math.floor(o))}return i}function Ft(e){if(!e.get("ab_test_id")?.value)return null;let r={},i=e.get("ab_title")?.value;i&&(r.title=i);let n=e.get("ab_description")?.value;n&&(r.description=n);let a=e.get("ab_discount_type")?.value,o=e.get("ab_discount_value")?.value;if(a&&(a==="percentage"||a==="fixed_amount")&&o){let d=parseFloat(o);Number.isFinite(d)&&(r.discountConfig={discountType:a,discountValue:d,allowStacking:e.get("allow_stacking")?.value==="true"})}let l=ee(e,"ab_volume_tiers");return Array.isArray(l)&&(r.volumeTiers=l.filter(d=>typeof d=="object"&&d!==null).map(Ve)),Object.keys(r).length===0?null:r}function Vt(e){let t=ee(e,"volume_tiers");return Array.isArray(t)?t.filter(r=>typeof r=="object"&&r!==null).map(Ve):[]}function Ve(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 ee(e,t){let r=e.get(t)?.value;if(!r)return null;try{return JSON.parse(r)}catch{return null}}function Se(e,t,r={}){let i=e.get(t)?.value;if(!i)return null;let n=parseInt(i,10);return isNaN(n)||r.min!==void 0&&n<r.min?null:n}function N(e,t,r){let i=e.variantQuantities[r];return i!==void 0?i:e.productQuantities[t]??1}function De(e){let t=e.abVariantB;if(!t)return e;let r=t.title??e.title,i=t.description!==void 0?t.description:e.description,n=t.discountConfig??e.discountConfig;switch(e.bundleType){case"volume":return{...e,title:r,description:i,discountConfig:n,volumeTiers:t.volumeTiers??e.volumeTiers};case"mix_match":return{...e,title:r,description:i,discountConfig:n};case"fixed":return{...e,title:r,description:i,discountConfig:n}}}async function Ue(e,t){await qe(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 Oe(e,t){await qe(e,{shopDomain:e.shopDomain,eventType:"bundle_add_to_cart",...t,occurredAt:new Date().toISOString()})}function He(e,t){if(typeof IntersectionObserver>"u")return t(),()=>{};let r=new IntersectionObserver(i=>{for(let n of i)n.isIntersecting&&(t(),r.unobserve(n.target))},{threshold:.5});return r.observe(e),()=>r.disconnect()}async function qe(e,t){let r=`${e.appUrl}/api/analytics`,i=JSON.stringify(t);try{(await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i})).ok||(await new Promise(a=>setTimeout(a,2e3)),await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:i}))}catch{try{typeof navigator<"u"&&navigator.sendBeacon&&navigator.sendBeacon(r,i)}catch{}}}var Dt=!1;function Ut(){if(Dt)return!0;if(typeof window>"u")return!1;let e=window.Shopify;try{return e?.customerPrivacy?.analyticsProcessingAllowed?.()===!0}catch{return!1}}var Te="lb_session",Ot=720*60*60,Ht=720*60*60;function $e(e){return`__Host-_lb_ab_${e}`}async function Ne(e,t,r,i){if(typeof document>"u")return null;let n=qt(i);if(n&&n.testId===r)return{variant:n.variant,testId:r,persisted:!0};if(!Ut())return{variant:"A",testId:r,persisted:!1};let a=Nt(),o=Wt(a,r);$t(i,r,o);try{fetch(`${e}/api/ab-assign`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({shopDomain:t,testId:r,sessionId:a,variant:o})}).catch(()=>{})}catch{}return{variant:o,testId:r,persisted:!0}}function qt(e){if(typeof document>"u")return null;let r=`${$e(e)}=`,n=document.cookie.split(";").map(d=>d.trim()).find(d=>d.startsWith(r));if(!n)return null;let a=n.substring(r.length),[o,l]=a.split("|");return o!=="A"&&o!=="B"||!l?null:{testId:l,variant:o}}function $t(e,t,r){if(typeof document>"u")return;let i=$e(e),n=`${r}|${t}|${Date.now()}`;document.cookie=`${i}=${n}; Path=/; Max-Age=${Ht}; SameSite=Lax; Secure`}function Nt(){if(typeof document>"u")return Ee();let t=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(`${Te}=`))?.split("=")[1];if(t)return t;let r=Ee();return document.cookie=`${Te}=${r}; path=/; max-age=${Ot}; SameSite=Lax; Secure`,r}function Ee(){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 Wt(e,t){let r=e+":"+t,i=2166136261;for(let n=0;n<r.length;n++)i^=r.charCodeAt(n),i=Math.imul(i,16777619);return(i>>>0)%2===0?"A":"B"}var Ae=1e4,zt=[[/@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"]],jt=/^(https:|\/[^/]|\.\/|\.\.\/|#)/;function he(e){if(e.length>Ae)return{ok:!1,error:`CSS exceeds ${Ae.toLocaleString("en-US")} character limit`};let t=e.replace(/\/\*[\s\S]*?\*\//g,"");try{t=t.replace(/\\([0-9a-fA-F]{1,6})[ \t\n\f]?/g,(n,a)=>{let o=parseInt(a,16);return o<0||o>1114111?"\uFFFD":String.fromCodePoint(o)}),t=t.replace(/\\\r?\n/g,""),t=t.replace(/\\([^\n\r\f0-9a-fA-F])/g,"$1")}catch{return{ok:!1,error:"CSS contains invalid unicode escape sequences"}}t=t.replace(/</g,"").replace(/>/g,"");for(let[n,a]of zt)if(n.test(t))return{ok:!1,error:`CSS contains blocked pattern: ${a}`};let r=/url\s*\(\s*([\s\S]*?)\s*\)/gi,i;for(;(i=r.exec(t))!==null;){let n=i[1].trim();if((n.startsWith("'")||n.startsWith('"'))&&(n=n.slice(1)),(n.endsWith("'")||n.endsWith('"'))&&(n=n.slice(0,-1)),n=n.trim(),n&&!jt.test(n))return{ok:!1,error:"CSS url() values must use https:// or relative paths"}}return{ok:!0,css:t}}var Gt="lb-custom-css-";function We(e,t){if(typeof document>"u"||!t)return!1;let r=he(t);if(!r.ok||!r.css.trim())return!1;let i=Gt+Kt(e),n=document.getElementById(i);return n||(n=document.createElement("style"),n.id=i,n.setAttribute("data-lime-bundles","custom-css"),document.head.appendChild(n)),n.textContent!==r.css&&(n.textContent=r.css),!0}function Kt(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 Qt(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 Yt={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 W(e,t,r){if(!e||!t||t.referenceUnit==="UNKNOWN")return null;let i=parseFloat(e.amount);if(!Number.isFinite(i))return null;let n=Yt[t.referenceUnit]??"";if(!n)return null;let a=e.currencyCode||r||"USD",o=Qt(i,a),l=t.referenceValue,d=l===1?n:`${l}${n}`;return`${o}/${d}`}function U(e){if(e==null)return 0;let t=typeof e=="string"?parseFloat(e):e;return Number.isFinite(t)?Math.round(t*100):0}function S(e,t){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:t}).format(e/100)}catch{return`${t} ${(e/100).toFixed(2)}`}}function ze(e,t){return Math.max(0,e-Math.floor(e*t/100))}function me(e,t=e.productQuantities,r=e.widgetConfig.pricing.showSaveBadge){let{discountType:i,discountValue:n}=e.discountConfig,a=[],o=0,l=0;for(let h of e.products){let f=h.variants.nodes.find(C=>C.availableForSale)??h.variants.nodes[0];if(!f)continue;let x=U(f.price.amount),p=t[h.id]??1,_=x*p,T=f.compareAtPrice?U(f.compareAtPrice.amount):null;if(a.push({unitCents:x,qty:p,lineCents:_,compareCents:T}),o+=_,i==="percentage"){let C=ze(x,n);l+=C*p}else l+=_}i==="fixed_amount"&&(l=Math.max(0,o-Math.round(n*100)));let d=Math.max(0,o-l),u=e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",c="";return r&&d>0&&(i==="percentage"&&n>0?c=`-${Math.round(n)}%`:i==="fixed_amount"&&n>0&&(c=`-${S(Math.round(n*100),u)}`)),{rows:a,totalCents:o,saleCents:l,savingsCents:d,headerBadge:c,currency:u}}function ie(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 H=152;function Y(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 je(e){if(!Number.isFinite(e)||e<=0)return"";let t=Math.floor(e/1e3),r=Math.floor(t/86400),i=Math.floor(t%86400/3600),n=Math.floor(t%3600/60),a=t%60,o=l=>String(l).padStart(2,"0");return r>0?`${r}d ${o(i)}h ${o(n)}m ${o(a)}s`:`${o(i)}h ${o(n)}m ${o(a)}s`}function X(e){let t=Xt(e);if(t===null||t<=Date.now())return null;let r=t,i=document.createElement("div");i.className="lb-bundle-countdown",i.setAttribute("data-countdown","");let n=document.createElement("div");n.className="lb-bundle-countdown__label";let a=document.createElement("span");a.textContent="Ends in",n.appendChild(a),i.appendChild(n);let o=document.createElement("span");o.className="lb-bundle-countdown__timer",o.setAttribute("data-countdown-timer",""),i.appendChild(o);let l=null;function d(){let c=r-Date.now();if(c<=0){i.style.display="none",u();return}o.textContent=je(c)}function u(){l!==null&&(clearInterval(l),l=null)}return d(),l=setInterval(d,1e3),{el:i,stop:u}}function Xt(e){let t=Date.parse(e);return Number.isFinite(t)?t:null}function J(e){let t=document.createElement("button");t.type="button",t.className="lb-bundle-cta",t.setAttribute("data-add-bundle","");let r=document.createElement("span");r.className="lb-cta-label",r.setAttribute("data-cta-label",""),r.textContent=e,t.appendChild(r);let i=document.createElement("span");return i.className="lb-cta-spinner",i.setAttribute("data-cta-spinner",""),i.setAttribute("aria-hidden","true"),i.innerHTML='<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round"><path d="M12 2a10 10 0 0 1 10 10" /></svg>',t.appendChild(i),t}function ge(e,t){let r=e.querySelector("[data-cta-label]");r&&(r.textContent=t)}function s(e,t,r={}){let i=document.createElement(e);t&&(i.className=t);for(let[n,a]of Object.entries(r))i.setAttribute(n,a);return i}var Jt=`
215
215
  <svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
216
216
  <rect x="4" y="4" width="20" height="20" rx="3"></rect>
217
217
  <line x1="4" y1="20" x2="24" y2="20"></line>
218
218
  <circle cx="10" cy="12" r="2"></circle>
219
- </svg>`;function Ee(e,t,r,i){let n=t.widgetConfig,a=(x,S)=>Z(t,x,S),o=[],d=0;if(t.products.forEach((x,S)=>{let E=St(t,x,S);E.qty!==0&&(E.isOos&&(d++,n.outOfStockBehavior==="hide")||o.push(E))}),o.length===0)return;let l=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",u=s("div","lb-fixed",{"data-discount-type":t.discountConfig.discountType,"data-discount-value":String(t.discountConfig.discountValue)}),c=Tt(t,l);if(u.appendChild(c.el),n.countdown.showCountdown&&t.endsAt){let x=H(t.endsAt);x&&(u.appendChild(x.el),i?.(x.stop))}let p=s("div","lb-fixed__products"),m=[];o.forEach(x=>{let S=Et(x,l,a,()=>{w()});m.push(S),p.appendChild(S.el)}),u.appendChild(p),u.appendChild(s("div","lb-bundle-divider"));let C=Pt(t);u.appendChild(C.el);let b=n.savingsBar.visible?Lt():null;b&&u.appendChild(b.el);let f=Mt(t,d,()=>{let x=o.filter(S=>S.selected).map(S=>({merchandiseId:S.selected.id,quantity:S.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));x.length!==0&&r(x)});u.appendChild(f),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),w();function w(){let x=o.reduce((h,k)=>{if(!k.selected)return h;let y=P(k.selected.price.amount);return h+y*k.qty},0),S=Rt(x,t.discountConfig,o),E=Math.max(0,x-S);C.update({totalCents:x,saleCents:S,savingsCents:E,currency:l}),b&&b.update({savingsCents:E,currency:l}),c.refresh(At(t,x,S,l))}}function St(e,t,r){let i=e.selectedVariantIds?.[r]??null,n=t.variants.nodes.filter(u=>u.availableForSale),a=i&&i.length>0?n.filter(u=>i.includes(u.id)):n,o=a.length===0,d=a[0]??null,l=d?Z(e,t.id,d.id):1;return{product:t,eligibleVariants:a,selected:d,qty:l,isOos:o}}function Tt(e,t){let r=e.widgetConfig,i=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let l=s("p","lb-bundle-subtitle");l.textContent=e.description,n.appendChild(l)}i.appendChild(n);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});i.appendChild(o);let d=te(e,e.productQuantities,r.pricing.showSaveBadge);return d.headerBadge?o.textContent=d.headerBadge:o.style.display="none",{el:i,refresh(l){if(!r.pricing.showSaveBadge){o.style.display="none";return}l?(o.textContent=l,o.style.display=""):o.style.display="none"}}}function At(e,t,r,i){if(!e.widgetConfig.pricing.showSaveBadge)return"";let n=t-r;if(n<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${B(Math.round(a.discountValue*100),i)}`:`-${B(n,i)}`}function Et(e,t,r,i){let n=s("div",e.isOos?"lb-bundle-product-row lb-bundle-product-row--oos":"lb-bundle-product-row",{"data-product-id":e.product.id.replace(/^.*\//,""),...e.isOos?{"aria-disabled":"true"}:{}}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.product.featuredImage){let u=document.createElement("img");u.src=O(e.product.featuredImage.url,{width:L,height:L,crop:"center"}),u.alt=e.product.featuredImage.altText??e.product.title,u.width=L,u.height=L,u.loading="lazy",a.appendChild(u)}else a.insertAdjacentHTML("beforeend",kt);let o=null;e.isOos||(o=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),o.textContent=String(e.qty),a.appendChild(o)),n.appendChild(a);let d=s("div","lb-bundle-product-info"),l=document.createElement("a");if(l.className="lb-bundle-product-name",l.href=`/products/${e.product.handle}`,l.textContent=e.product.title,d.appendChild(l),e.isOos){let u=s("span","lb-bundle-oos-label");u.textContent="Out of stock",d.appendChild(u)}else if(e.selected){let u=s("span","lb-bundle-product-prices"),c=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),p=s("span","lb-bundle-product-price",{"data-product-price":""});u.appendChild(c),u.appendChild(p),d.appendChild(u);let m=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});m.setAttribute("hidden",""),d.appendChild(m);let C=b=>{let f=P(b.price.amount);if(p.textContent=B(f,t),b.compareAtPrice){let x=P(b.compareAtPrice.amount);x>f?(c.textContent=B(x,t),c.removeAttribute("hidden")):c.setAttribute("hidden","")}else c.setAttribute("hidden","");let w=j(b.unitPrice,b.unitPriceMeasurement,t);w?(m.textContent=w,m.removeAttribute("hidden")):m.setAttribute("hidden","")};if(C(e.selected),e.eligibleVariants.length>1){let b=document.createElement("select");b.className="lb-bundle-variant-select",b.setAttribute("data-variant-select",""),b.setAttribute("aria-label",`Select variant for ${e.product.title}`),e.eligibleVariants.forEach(f=>{let w=document.createElement("option");w.value=f.id,w.textContent=f.title,f.id===e.selected?.id&&(w.selected=!0),b.appendChild(w)}),b.addEventListener("change",()=>{let f=e.eligibleVariants.find(w=>w.id===b.value);f&&(e.selected=f,e.qty=r(e.product.id,f.id),o&&(o.textContent=String(e.qty)),C(f),i())}),d.appendChild(b)}else if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let b=s("span","lb-bundle-variant-badge");b.textContent=e.eligibleVariants[0].title,d.appendChild(b)}}return n.appendChild(d),{el:n,state:e}}function Pt(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return i.appendChild(a),t.appendChild(i),{el:t,update({totalCents:o,saleCents:d,savingsCents:l,currency:u}){a.textContent=B(d,u),e.widgetConfig.pricing.showCompareAtPrice&&l>0?(n.textContent=B(o,u),n.style.display=""):n.style.display="none"}}}function Lt(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});return e.appendChild(r),{el:e,update({savingsCents:i,currency:n}){if(i<=0){e.style.display="none";return}e.style.display="",r.textContent=B(i,n)}}}function Mt(e,t,r){let i=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=$(i);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function Rt(e,t,r){if(t.discountType==="percentage"){let i=0;for(let n of r){if(!n.selected)continue;let a=P(n.selected.price.amount),o=Math.floor(a*t.discountValue/100),d=Math.max(0,a-o);i+=d*n.qty}return i}return Math.max(0,e-Math.round(t.discountValue*100))}var Le=`
219
+ </svg>`;function Ge(e,t,r,i){let n=t.widgetConfig,a=(C,E)=>N(t,C,E),o=[],l=0;if(t.products.forEach((C,E)=>{let M=Zt(t,C,E);M.qty!==0&&(M.isOos&&(l++,n.outOfStockBehavior==="hide")||o.push(M))}),o.length===0)return;let d=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",u=s("div","lb-fixed",{"data-discount-type":t.discountConfig.discountType,"data-discount-value":String(t.discountConfig.discountValue)}),c=er(t,d);if(u.appendChild(c.el),n.countdown.showCountdown&&t.endsAt){let C=X(t.endsAt);C&&(u.appendChild(C.el),i?.(C.stop))}let h=s("div","lb-fixed__products"),f=[];o.forEach(C=>{let E=rr(C,d,a,()=>{T()});f.push(E),h.appendChild(E.el)}),u.appendChild(h),u.appendChild(s("div","lb-bundle-divider"));let x=nr(t);u.appendChild(x.el);let p=n.savingsBar.visible?ir():null;p&&u.appendChild(p.el);let _=or(t,l,()=>{let C=o.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}]}));C.length!==0&&r(C)});u.appendChild(_),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),T();function T(){let C=o.reduce((m,B)=>{if(!B.selected)return m;let w=U(B.selected.price.amount);return m+w*B.qty},0),E=ar(C,t.discountConfig,o),M=Math.max(0,C-E);x.update({totalCents:C,saleCents:E,savingsCents:M,currency:d}),p&&p.update({savingsCents:M,currency:d}),c.refresh(tr(t,C,E,d))}}function Zt(e,t,r){let i=e.selectedVariantIds?.[r]??null,n=i&&i.length>0?t.variants.nodes.filter(c=>i.includes(c.id)):t.variants.nodes,a=n.find(c=>c.availableForSale)??null,o=n,l=!a,d=a??n[0]??null,u=d?N(e,t.id,d.id):1;return{product:t,eligibleVariants:o,selected:d,qty:u,isOos:l}}function er(e,t){let r=e.widgetConfig,i=s("div","lb-bundle-header"),n=s("div","lb-bundle-header__content"),a=s("h3","lb-bundle-title");if(a.textContent=e.title,n.appendChild(a),e.description){let d=s("p","lb-bundle-subtitle");d.textContent=e.description,n.appendChild(d)}i.appendChild(n);let o=s("span","lb-bundle-header__badge",{"data-header-badge":""});i.appendChild(o);let l=me(e,e.productQuantities,r.pricing.showSaveBadge);return l.headerBadge?o.textContent=l.headerBadge:o.style.display="none",{el:i,refresh(d){if(!r.pricing.showSaveBadge){o.style.display="none";return}d?(o.textContent=d,o.style.display=""):o.style.display="none"}}}function tr(e,t,r,i){if(!e.widgetConfig.pricing.showSaveBadge)return"";let n=t-r;if(n<=0)return"";let a=e.discountConfig;return a.discountType==="percentage"&&a.discountValue>0?`-${Math.round(a.discountValue)}%`:a.discountType==="fixed_amount"&&a.discountValue>0?`-${S(Math.round(a.discountValue*100),i)}`:`-${S(n,i)}`}function rr(e,t,r,i){let n=s("div",e.isOos?"lb-bundle-product-row lb-bundle-product-row--oos":"lb-bundle-product-row",{"data-product-id":e.product.id.replace(/^.*\//,""),...e.isOos?{"aria-disabled":"true"}:{}}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.product.featuredImage){let u=document.createElement("img");u.src=Y(e.product.featuredImage.url,{width:H,height:H,crop:"center"}),u.alt=e.product.featuredImage.altText??e.product.title,u.width=H,u.height=H,u.loading="lazy",a.appendChild(u)}else a.insertAdjacentHTML("beforeend",Jt);let o=null;e.isOos||(o=s("span","lb-bundle-qty-badge",{"data-qty-badge":""}),o.textContent=String(e.qty),a.appendChild(o)),n.appendChild(a);let l=s("div","lb-bundle-product-info"),d=document.createElement("a");if(d.className="lb-bundle-product-name",d.href=`/products/${e.product.handle}`,d.textContent=e.product.title,l.appendChild(d),e.isOos){let u=s("span","lb-bundle-oos-label");u.textContent="Out of stock",l.appendChild(u)}else if(e.selected){let u=s("span","lb-bundle-product-prices"),c=s("span","lb-bundle-product-compare-price",{"data-product-compare-price":""}),h=s("span","lb-bundle-product-price",{"data-product-price":""});u.appendChild(c),u.appendChild(h),l.appendChild(u);let f=s("span","lb-bundle-product-unit-price",{"data-product-unit-price":""});f.setAttribute("hidden",""),l.appendChild(f);let x=p=>{let _=U(p.price.amount);if(h.textContent=S(_,t),p.compareAtPrice){let C=U(p.compareAtPrice.amount);C>_?(c.textContent=S(C,t),c.removeAttribute("hidden")):c.setAttribute("hidden","")}else c.setAttribute("hidden","");let T=W(p.unitPrice,p.unitPriceMeasurement,t);T?(f.textContent=T,f.removeAttribute("hidden")):f.setAttribute("hidden","")};if(x(e.selected),e.eligibleVariants.length>1){let p=e.eligibleVariants[0].selectedOptions.map(v=>v.name),_=e.product.id.replace(/^.*\//,""),T=[],C=v=>e.eligibleVariants.find(k=>k.selectedOptions.every((A,b)=>A.value===v[b])&&k.selectedOptions.length===v.length)??null,E=v=>{v.selectedOptions.forEach((k,A)=>{let b=T[A];b&&b.value!==k.value&&(b.value=k.value)})},M=(v,k,A)=>e.eligibleVariants.some(b=>!b.availableForSale||b.selectedOptions[v]?.value!==k?!1:b.selectedOptions.every((P,I)=>I===v||P.value===A[I])),m=v=>{T.forEach((k,A)=>{Array.from(k.options).forEach(b=>{b.disabled=!M(A,b.value,v)})})},B=()=>{let v=T.map(A=>A.value),k=C(v);if(!k){e.selected&&(E(e.selected),m(e.selected.selectedOptions.map(A=>A.value)));return}e.selected=k,e.qty=r(e.product.id,k.id),o&&(o.textContent=String(e.qty)),x(k),m(k.selectedOptions.map(A=>A.value)),i()},w=s("div","lb-bundle-variant-option-groups");p.forEach((v,k)=>{let A=s("div","lb-bundle-variant-option-group"),b=s("span","lb-bundle-variant-option-label");b.textContent=v,A.appendChild(b);let P=document.createElement("select");P.className="lb-bundle-variant-select",P.setAttribute("data-variant-option",""),P.setAttribute("data-option-position",String(k+1)),P.name=`lb-variant-${_}-${k+1}`,P.setAttribute("aria-label",v);let I=new Set;e.eligibleVariants.forEach(g=>{let y=g.selectedOptions[k]?.value;if(!y||I.has(y))return;I.add(y);let O=document.createElement("option");O.value=y,O.textContent=y,e.selected?.selectedOptions[k]?.value===y&&(O.selected=!0),P.appendChild(O)}),P.addEventListener("change",B),T.push(P),A.appendChild(P),w.appendChild(A)}),l.appendChild(w),e.selected&&m(e.selected.selectedOptions.map(v=>v.value))}else if(e.eligibleVariants.length===1&&e.product.variants.nodes.length>1){let p=s("span","lb-bundle-variant-badge");p.textContent=e.eligibleVariants[0].title,l.appendChild(p)}}return n.appendChild(l),{el:n,state:e}}function nr(e){let t=s("div","lb-bundle-pricing"),r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});n.style.display="none",i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});return i.appendChild(a),t.appendChild(i),{el:t,update({totalCents:o,saleCents:l,savingsCents:d,currency:u}){a.textContent=S(l,u),e.widgetConfig.pricing.showCompareAtPrice&&d>0?(n.textContent=S(o,u),n.style.display=""):n.style.display="none"}}}function ir(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""}),t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});return e.appendChild(r),{el:e,update({savingsCents:i,currency:n}){if(i<=0){e.style.display="none";return}e.style.display="",r.textContent=S(i,n)}}}function or(e,t,r){let i=t>0?`${t} item${t===1?"":"s"} out of stock`:e.widgetConfig.cta.ctaText||"Add to cart",n=J(i);return t>0?n.disabled=!0:n.addEventListener("click",()=>{n.disabled||r()}),n}function ar(e,t,r){if(t.discountType==="percentage"){let i=0;for(let n of r){if(!n.selected)continue;let a=U(n.selected.price.amount),o=Math.floor(a*t.discountValue/100),l=Math.max(0,a-o);i+=l*n.qty}return i}return Math.max(0,e-Math.round(t.discountValue*100))}var Qe=`
220
220
  <svg class="lb-bundle-placeholder-icon" viewBox="0 0 28 28" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">
221
221
  <rect x="4" y="4" width="20" height="20" rx="3"></rect>
222
222
  <line x1="4" y1="20" x2="24" y2="20"></line>
223
223
  <circle cx="10" cy="12" r="2"></circle>
224
- </svg>`,Me=`
224
+ </svg>`,lr=`
225
225
  <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
226
226
  <line x1="9" y1="3" x2="9" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
227
227
  <line x1="3" y1="9" x2="15" y2="9" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
228
- </svg>`,ne=`
228
+ </svg>`,Ye=`
229
229
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
230
230
  <line x1="5" y1="5" x2="15" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
231
231
  <line x1="15" y1="5" x2="5" y2="15" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
232
- </svg>`,It=`
232
+ </svg>`,dr=`
233
233
  <svg width="16" height="16" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
234
234
  <path d="M14.348 5.652a.5.5 0 0 0-.707 0L10 9.293 6.36 5.652a.5.5 0 1 0-.708.707L9.293 10l-3.641 3.641a.5.5 0 0 0 .708.707L10 10.707l3.641 3.641a.5.5 0 0 0 .707-.707L10.707 10l3.641-3.641a.5.5 0 0 0 0-.707z"/>
235
- </svg>`;function Re(e,t,r,i){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,d=t.maxQuantity??o,l=Nt(t,n.outOfStockBehavior);if(l.filter(v=>!v.isOos).length<o)return;let c=[],p=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(d)}),m=Ft(t);if(p.appendChild(m),n.countdown.showCountdown&&t.endsAt){let v=H(t.endsAt);v&&(p.appendChild(v.el),i?.(v.stop))}let C=Dt(o);p.appendChild(C.el);let b=s("div","lb-mix-match__slots",{"data-selection-slots":""});p.appendChild(b),p.appendChild(s("div","lb-bundle-divider"));let f=Ot(n.pricing.showCompareAtPrice);p.appendChild(f.el);let w=n.savingsBar.visible?Ht():null;w&&p.appendChild(w.el);let x=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),S=s("span","lb-mix-match__price-placeholder-text");S.textContent=`Select ${o} items to see price`,x.appendChild(S),p.appendChild(x);let E=$t(t,l,a,{showSearch:n.showSearch,onAdd:(v,_)=>T(v,_),onRemove:(v,_)=>R(v,_),countFor:(v,_)=>c.filter(F=>F.productId===v&&F.variantId===_).length,isOverMax:()=>c.length>=d});p.appendChild(E.el);let h=$(`Select ${o} items to unlock`);h.disabled=!0,h.addEventListener("click",()=>{if(h.disabled)return;let v=c.map(_=>({merchandiseId:_.variantId,quantity:1,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(v)}),p.appendChild(h),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p);let k=l.find(v=>!v.isOos),y=k?.firstAvailableVariant??k?.variants[0];k&&y&&c.push({productId:k.product.id,productTitle:k.product.title,variantId:y.id,variantTitle:y.title,imageUrl:k.product.featuredImage?.url??null,priceCents:P(y.price.amount),compareCents:y.compareAtPrice?P(y.compareAtPrice.amount):null}),g();function T(v,_){c.length>=d||(c.push({productId:v.id,productTitle:v.title,variantId:_.id,variantTitle:_.title,imageUrl:v.featuredImage?.url??null,priceCents:P(_.price.amount),compareCents:_.compareAtPrice?P(_.compareAtPrice.amount):null}),g())}function R(v,_){let F=c.findIndex(W=>W.productId===v&&W.variantId===_);F!==-1&&(c.splice(F,1),g())}function N(v){v<0||v>=c.length||(c.splice(v,1),g())}function g(){M(),C.update(c.length),f.update(c,t,a),w&&w.update(c,t,a),x.style.display=c.length===0?"":"none",E.refreshCounts(),I()}function M(){b.innerHTML="";let v=Math.max(o,c.length);for(let _=0;_<v;_++){let F=c[_];F?b.appendChild(Vt(F,_,a,()=>N(_))):b.appendChild(Ut(_,()=>E.open()))}}function I(){let v=c.length;v<o?(h.disabled=!0,re(h,`Select ${o-v} more to unlock`)):(h.disabled=!1,re(h,n.cta.ctaText||"Add to cart"))}}function Ft(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,i.appendChild(n),r.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,d=null;if(a==="percentage"&&o>0?d=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(d=`-${B(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),d){let l=s("span","lb-bundle-header__badge");l.textContent=d,r.appendChild(l)}}return r}function Dt(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,r.appendChild(i);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function d(l){let u=Math.min(100,l/e*100);i.textContent=`${l} of ${e} selected`,l>=e?n.textContent="Complete":n.textContent=`${e-l} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(l,e)))}return{el:t,update:d}}function Ut(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),i=s("div","lb-mix-match__empty-thumb");i.innerHTML=Me,r.appendChild(i);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function Vt(e,t,r,i){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let p=document.createElement("img");p.src=O(e.imageUrl,{width:L,height:L,crop:"center"}),p.alt=e.productTitle,p.width=L,p.height=L,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Le);n.appendChild(a);let o=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,o.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,o.appendChild(p)}let l=s("span","lb-mix-match__filled-price");if(e.compareCents&&e.compareCents>e.priceCents){let p=s("span","lb-mix-match__filled-compare");p.textContent=B(e.compareCents,r),l.appendChild(p)}let u=document.createElement("span");u.textContent=B(e.priceCents,r),l.appendChild(u),o.appendChild(l),n.appendChild(o);let c=document.createElement("button");return c.type="button",c.className="lb-mix-match__slot-remove",c.setAttribute("aria-label",`Remove ${e.productTitle}`),c.innerHTML=ne,c.addEventListener("click",p=>{p.stopPropagation(),i()}),n.appendChild(c),n}function Ot(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(d,l,u){if(d.length===0){t.style.display="none";return}t.style.display="";let c=d.reduce((m,C)=>m+C.priceCents,0),p=K(c,l.discountConfig);e&&c>p?(n.textContent=B(c,u),n.style.display=""):n.style.display="none",a.textContent=B(p,u)}return{el:t,update:o}}function Ht(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function i(n,a,o){if(n.length===0){e.style.display="none";return}let d=n.reduce((c,p)=>c+p.priceCents,0),l=K(d,a.discountConfig),u=Math.max(0,d-l);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=B(u,o)}return{el:e,update:i}}function $t(e,t,r,i){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Pe(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),d=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Pe(e.id)}`});d.textContent="Pick an item",o.appendChild(d);let l=document.createElement("button");l.type="button",l.className="lb-mix-match__modal-close",l.setAttribute("data-modal-close",""),l.setAttribute("aria-label","Close"),l.innerHTML=ne,l.addEventListener("click",T),o.appendChild(l),a.appendChild(o);let u=null,c=null;if(i.showSearch){let g=s("div","lb-mix-match__modal-search");u=document.createElement("input"),u.type="text",u.className="lb-mix-match__modal-search-input",u.setAttribute("data-modal-search",""),u.setAttribute("role","searchbox"),u.setAttribute("aria-label","Search products"),u.setAttribute("placeholder","Search products"),u.autocomplete="off",u.addEventListener("input",()=>S()),g.appendChild(u),c=document.createElement("button"),c.type="button",c.className="lb-mix-match__modal-search-clear",c.setAttribute("data-modal-search-clear",""),c.setAttribute("aria-label","Clear search"),c.style.display="none",c.innerHTML=It,c.addEventListener("click",()=>{u&&(u.value="",S(),u.focus())}),g.appendChild(c),a.appendChild(g)}let p=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(p);let m=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});m.style.display="none";let C=document.createElement("p");C.textContent="No products match your search.",m.appendChild(C),a.appendChild(m);let b=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(b),n.appendChild(a);let f=!1,w=[];function x(){f||(f=!0,p.innerHTML="",t.forEach(g=>{let M=g.firstAvailableVariant??g.variants[0];if(!M)return;let I=s("div",g.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":g.product.id.replace(/^.*\//,"")}),v=s("div","lb-mix-match__modal-product-thumb");if(g.product.featuredImage){let A=document.createElement("img");A.src=O(g.product.featuredImage.url,{width:L,height:L,crop:"center"}),A.alt=g.product.featuredImage.altText??g.product.title,A.width=L,A.height=L,A.loading="lazy",v.appendChild(A)}else v.insertAdjacentHTML("beforeend",Le);I.appendChild(v);let _=s("div","lb-mix-match__modal-product-info"),F=s("span","lb-mix-match__modal-product-title");F.textContent=g.product.title,_.appendChild(F);let W=s("span","lb-mix-match__modal-product-price");W.textContent=B(P(M.price.amount),r),_.appendChild(W);let oe=j(M.unitPrice,M.unitPriceMeasurement,r);if(oe){let A=s("span","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price");A.textContent=oe,_.appendChild(A)}if(g.isOos){let A=s("span","lb-mix-match__modal-sold-out-label");A.textContent="Sold out",_.appendChild(A)}if(I.appendChild(_),g.isOos)w.push({el:I,product:g.product,variant:M,updateCount:()=>{}});else{let A=document.createElement("button");A.type="button",A.className="lb-mix-match__modal-add",A.setAttribute("aria-label",`Add ${g.product.title}`),A.innerHTML=Me;let q=s("span","lb-bundle-qty-badge");q.style.display="none",A.appendChild(q),A.addEventListener("click",()=>{i.isOverMax()||i.onAdd(g.product,M)}),I.appendChild(A);let U=document.createElement("button");U.type="button",U.className="lb-mix-match__slot-remove",U.setAttribute("aria-label",`Remove one ${g.product.title}`),U.style.display="none",U.innerHTML=ne,U.addEventListener("click",Q=>{Q.stopPropagation(),i.onRemove(g.product.id,M.id)}),I.appendChild(U),w.push({el:I,product:g.product,variant:M,updateCount:()=>{let Q=i.countFor(g.product.id,M.id);Q>0?(q.textContent=String(Q),q.style.display="",U.style.display=""):(q.style.display="none",U.style.display="none")}})}p.appendChild(I)}),N())}function S(){if(!u)return;let g=u.value.trim().toLowerCase();c&&(c.style.display=g?"":"none");let M=0;w.forEach(I=>{let v=!g||I.product.title.toLowerCase().includes(g);I.el.style.display=v?"":"none",v&&M++}),m.style.display=M===0&&g?"":"none"}let E=null;function h(g){if(g.key==="Escape"){g.preventDefault(),T();return}g.key==="Tab"&&Wt(g,a)}let k=!1;function y(){k||i.isOverMax()||(k=!0,x(),E=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",h),n.addEventListener("click",R))}function T(){k&&(k=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",h),n.removeEventListener("click",R),E instanceof HTMLElement&&E.focus())}function R(g){g.target===n&&T()}function N(){w.forEach(g=>g.updateCount())}return{el:n,open:y,close:T,refreshCounts:N}}function Nt(e,t){let r=[],i=new Set;for(let n of e.products){if(i.has(n.id))continue;i.add(n.id);let a=n.variants.nodes.filter(d=>d.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function Wt(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let i=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),i.focus())}function Pe(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function Ue(e,t,r,i){let n=t.widgetConfig,o=t.products[0]?.variants.nodes.find(h=>h.availableForSale);if(!o&&n.outOfStockBehavior==="hide")return;let d=o?P(o.price.amount):0,l=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((h,k)=>{let y;if(u==="fixed_amount"){let T=Math.round((h.amount??0)*100);y=Math.max(0,d-T)}else{let T=h.percentage??0,R=Math.floor(d*T/100);y=Math.max(0,d-R)}return{tier:h,index:k,qty:h.minQuantity,pricePerUnitCents:y,basePricePerUnitCents:d}}),p=Gt(c),m=n.defaultTier==="best_value"?p:0;typeof n.defaultTier=="number"&&(m=De(n.defaultTier,0,c.length-1));let C=n.popularBadge.tierIndex!==void 0?De(n.popularBadge.tierIndex,0,c.length-1):p,b=s("div","lb-volume");if(b.appendChild(qt(t,c,m,l,u)),n.countdown.showCountdown&&t.endsAt){let h=H(t.endsAt);h&&(b.appendChild(h.el),i?.(h.stop))}let f=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(h=>{let k=zt(h,h.index===m,l,n.popularBadge.visible&&h.index===C?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);k.addEventListener("click",()=>E(h.index)),k.addEventListener("keydown",y=>{if(y.key==="Enter"||y.key===" "){y.preventDefault(),E(h.index);return}if(y.key==="ArrowDown"||y.key==="ArrowRight"||y.key==="ArrowUp"||y.key==="ArrowLeft"){y.preventDefault();let T=y.key==="ArrowDown"||y.key==="ArrowRight"?1:-1,R=(h.index+T+c.length)%c.length;E(R),f.children[R]?.focus()}}),f.appendChild(k)}),b.appendChild(f),b.appendChild(s("div","lb-bundle-divider"));let w=Ie(c,m,l,n.pricing.showItemCount,n.pricing.showCompareAtPrice);b.appendChild(w);let x=n.savingsBar.visible?Fe(c,m,l):null;x&&b.appendChild(x);let S=jt(t,()=>{if(!o)return;let h=c[m];h&&r([{merchandiseId:o.id,quantity:h.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});b.appendChild(S),b.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),b.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(b);function E(h){if(h===m||h<0||h>=c.length)return;m=h,Array.from(f.children).forEach((T,R)=>{T.setAttribute("aria-checked",String(R===h)),T.tabIndex=R===h?0:-1});let k=Ie(c,h,l,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(w.replaceWith(k),w=k,x){let T=Fe(c,h,l);x.replaceWith(T),x=T}let y=b.querySelector("[data-header-badge]");if(y){let T=Ve(c[h],l,u);T?(y.textContent=T,y.style.display=""):y.style.display="none"}}}function qt(e,t,r,i,n){let a=e.widgetConfig,o=s("div","lb-bundle-header"),d=s("div","lb-bundle-header__content"),l=s("h3","lb-bundle-title");if(l.textContent=e.title,d.appendChild(l),o.appendChild(d),a.pricing.showSaveBadge){let u=Ve(t[r],i,n);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function zt(e,t,r,i,n,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),d=s("span","lb-volume__radio");d.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(d);let l=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,l.appendChild(u);let c=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let m=s("span","lb-volume__tier-compare");m.textContent=B(e.basePricePerUnitCents,r),c.appendChild(m)}if(a){let m=document.createElement("span");m.setAttribute("data-tier-price-each",""),m.textContent=B(e.pricePerUnitCents,r),c.appendChild(m);let C=s("span","lb-volume__tier-unit");C.textContent=" each",c.appendChild(C)}l.appendChild(c),o.appendChild(l);let p=s("span","lb-volume__tier-badge");return i?p.textContent=i:p.style.display="none",o.appendChild(p),o}function Ie(e,t,r,i,n){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,d=a?a.basePricePerUnitCents*a.qty:0,l=Math.max(0,d-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",i&&a){let C=document.createElement("span");C.setAttribute("data-item-count",""),C.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(C)}u.appendChild(c);let p=s("span","lb-bundle-pricing__prices");if(n&&l>0){let C=s("span","lb-bundle-compare-price",{"data-compare-price":""});C.textContent=B(d,r),p.appendChild(C)}let m=s("span","lb-bundle-sale-price",{"data-total-price":""});return m.textContent=B(o,r),p.appendChild(m),u.appendChild(p),u}function Fe(e,t,r){let i=e[t],n=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-n),d=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(d.style.display="none");let l=document.createElement("span");l.textContent="You save",d.appendChild(l);let u=s("span","",{"data-savings-amount":""});return u.textContent=B(o,r),d.appendChild(u),d}function jt(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),n=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=$(n);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function Ve(e,t,r){if(!e)return null;let{tier:i}=e;if(r==="fixed_amount"){let n=i.amount??0;return n>0?`-${B(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=i.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function Gt(e){let t=0,r=0;return e.forEach((i,n)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function De(e,t,r){return Math.max(t,Math.min(r,e))}var ie=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
235
+ </svg>`;function Xe(e,t,r,i){let n=t.widgetConfig,a=t.products[0]?.priceRange.minVariantPrice.currencyCode??"USD",o=t.minQuantity??1,l=t.maxQuantity??o,d=gr(t,n.outOfStockBehavior);if(d.filter(g=>!g.isOos).length<o)return;let c=[],h=s("div","lb-mix-match",{"data-required-quantity":String(o),"data-max-quantity":String(l)}),f=sr(t);if(h.appendChild(f),n.countdown.showCountdown&&t.endsAt){let g=X(t.endsAt);g&&(h.appendChild(g.el),i?.(g.stop))}let x=cr(o);h.appendChild(x.el);let p=s("div","lb-mix-match__slots",{"data-selection-slots":""});h.appendChild(p),h.appendChild(s("div","lb-bundle-divider"));let _=br(n.pricing.showCompareAtPrice);h.appendChild(_.el);let T=n.savingsBar.visible?hr():null;T&&h.appendChild(T.el);let C=s("div","lb-mix-match__price-placeholder",{"data-price-placeholder":""}),E=s("span","lb-mix-match__price-placeholder-text");E.textContent=`Select ${o} items to see price`,C.appendChild(E),h.appendChild(C);let M=mr(t,d,a,{showSearch:n.showSearch,onAdd:(g,y)=>v(g,y),onRemove:(g,y)=>k(g,y),isOverMax:()=>c.length>=l});h.appendChild(M.el);let m=J(`Select ${o} items to unlock`);m.disabled=!0,m.addEventListener("click",()=>{if(m.disabled)return;let g=c.map(y=>({merchandiseId:y.variantId,quantity:y.quantity,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}));r(g)}),h.appendChild(m),h.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),h.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(h);let B=d.find(g=>!g.isOos),w=B?.firstAvailableVariant??B?.variants[0];B&&w&&c.push({productId:B.product.id,productTitle:B.product.title,variantId:w.id,variantTitle:w.title,imageUrl:B.product.featuredImage?.url??null,priceCents:U(w.price.amount),compareCents:w.compareAtPrice?U(w.compareAtPrice.amount):null,unitPriceLabel:W(w.unitPrice,w.unitPriceMeasurement,a),quantity:N(t,B.product.id,w.id)}),b();function v(g,y){c.length>=l||(c.push({productId:g.id,productTitle:g.title,variantId:y.id,variantTitle:y.title,imageUrl:g.featuredImage?.url??null,priceCents:U(y.price.amount),compareCents:y.compareAtPrice?U(y.compareAtPrice.amount):null,unitPriceLabel:W(y.unitPrice,y.unitPriceMeasurement,a),quantity:N(t,g.id,y.id)}),b())}function k(g,y){let O=c.findIndex(K=>K.productId===g&&K.variantId===y);O!==-1&&(c.splice(O,1),b())}function A(g){g<0||g>=c.length||(c.splice(g,1),b())}function b(){P(),x.update(c.length),_.update(c,t,a),T&&T.update(c,t,a),C.style.display=c.length===0?"":"none",M.refreshCounts(),I()}function P(){p.innerHTML="";let g=Math.max(o,c.length);for(let y=0;y<g;y++){let O=c[y];O?p.appendChild(pr(O,y,a,()=>A(y))):p.appendChild(ur(y,()=>M.open()))}}function I(){let g=c.length;g<o?(m.disabled=!0,ge(m,`Select ${o-g} more to unlock`)):(m.disabled=!1,ge(m,n.cta.ctaText||"Add to cart"))}}function sr(e){let t=e.widgetConfig,r=s("div","lb-bundle-header"),i=s("div","lb-bundle-header__content"),n=s("h3","lb-bundle-title");if(n.textContent=e.title,i.appendChild(n),r.appendChild(i),t.pricing.showSaveBadge){let{discountType:a,discountValue:o}=e.discountConfig,l=null;if(a==="percentage"&&o>0?l=`-${Math.round(o)}%`:a==="fixed_amount"&&o>0&&(l=`-${S(Math.round(o*100),e.products[0]?.priceRange.minVariantPrice.currencyCode??"USD")}`),l){let d=s("span","lb-bundle-header__badge");d.textContent=l,r.appendChild(d)}}return r}function cr(e){let t=s("div","lb-mix-match__progress"),r=s("div","lb-mix-match__progress-labels"),i=s("span","lb-mix-match__progress-count",{"data-progress-count":""});i.textContent=`0 of ${e} selected`,r.appendChild(i);let n=s("span","lb-mix-match__progress-remaining",{"data-progress-remaining":""});n.textContent=`${e} more to go`,r.appendChild(n),t.appendChild(r);let a=s("div","lb-mix-match__progress-track",{role:"progressbar","aria-valuenow":"0","aria-valuemin":"0","aria-valuemax":String(e)}),o=s("div","lb-mix-match__progress-fill",{"data-progress-fill":""});o.style.width="0%",a.appendChild(o),t.appendChild(a);function l(d){let u=Math.min(100,d/e*100);i.textContent=`${d} of ${e} selected`,d>=e?n.textContent="Complete":n.textContent=`${e-d} more to go`,o.style.width=`${u}%`,a.setAttribute("aria-valuenow",String(Math.min(d,e)))}return{el:t,update:l}}function ur(e,t){let r=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--empty",{"data-slot":String(e+1),tabindex:"0",role:"button","aria-label":"Add a product to the bundle"}),i=s("div","lb-mix-match__empty-thumb");i.innerHTML=lr,r.appendChild(i);let n=s("span","lb-mix-match__empty-text");return n.textContent="Choose an item",r.appendChild(n),r.addEventListener("click",t),r.addEventListener("keydown",a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),t())}),r}function pr(e,t,r,i){let n=s("div","lb-bundle-product-row lb-mix-match__slot lb-mix-match__slot--filled",{"data-slot":String(t+1)}),a=s("div","lb-bundle-thumbnail",{"data-thumbnail":""});if(e.imageUrl){let p=document.createElement("img");p.src=Y(e.imageUrl,{width:H,height:H,crop:"center"}),p.alt=e.productTitle,p.width=H,p.height=H,p.loading="lazy",a.appendChild(p)}else a.insertAdjacentHTML("beforeend",Qe);let o=s("span","lb-bundle-qty-badge");o.textContent=String(e.quantity),a.appendChild(o),n.appendChild(a);let l=s("div","lb-mix-match__filled-info"),d=s("span","lb-mix-match__filled-title");if(d.textContent=e.productTitle,l.appendChild(d),e.variantTitle&&e.variantTitle!=="Default Title"){let p=s("span","lb-mix-match__filled-variant");p.textContent=e.variantTitle,l.appendChild(p)}let u=e.priceCents*e.quantity,c=e.compareCents!==null?e.compareCents*e.quantity:null,h=s("span","lb-mix-match__filled-price");if(c!==null&&c>u){let p=s("span","lb-mix-match__filled-compare");p.textContent=S(c,r),h.appendChild(p)}let f=document.createElement("span");if(f.textContent=S(u,r),h.appendChild(f),l.appendChild(h),e.unitPriceLabel){let p=s("span","lb-bundle-product-unit-price");p.textContent=e.unitPriceLabel,l.appendChild(p)}n.appendChild(l);let x=document.createElement("button");return x.type="button",x.className="lb-mix-match__slot-remove",x.setAttribute("aria-label",`Remove ${e.productTitle}`),x.innerHTML=Ye,x.addEventListener("click",p=>{p.stopPropagation(),i()}),n.appendChild(x),n}function br(e){let t=s("div","lb-bundle-pricing",{"data-pricing-section":""});t.style.display="none";let r=s("span","lb-bundle-pricing__label");r.textContent="Bundle price",t.appendChild(r);let i=s("span","lb-bundle-pricing__prices"),n=s("span","lb-bundle-compare-price",{"data-compare-price":""});e&&i.appendChild(n);let a=s("span","lb-bundle-sale-price",{"data-sale-price":""});i.appendChild(a),t.appendChild(i);function o(l,d,u){if(l.length===0){t.style.display="none";return}t.style.display="";let c=l.reduce((f,x)=>f+x.priceCents*x.quantity,0),h=ie(c,d.discountConfig);e&&c>h?(n.textContent=S(c,u),n.style.display=""):n.style.display="none",a.textContent=S(h,u)}return{el:t,update:o}}function hr(){let e=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});e.style.display="none";let t=document.createElement("span");t.textContent="You save",e.appendChild(t);let r=s("span","",{"data-savings-amount":""});e.appendChild(r);function i(n,a,o){if(n.length===0){e.style.display="none";return}let l=n.reduce((c,h)=>c+h.priceCents*h.quantity,0),d=ie(l,a.discountConfig),u=Math.max(0,l-d);if(u<=0){e.style.display="none";return}e.style.display="",r.textContent=S(u,o)}return{el:e,update:i}}function mr(e,t,r,i){let n=s("div","lb-mix-match__modal-overlay",{"data-modal-overlay":"","data-bundle-gid":e.id});n.style.display="none";let a=s("div","lb-mix-match__modal",{role:"dialog","aria-modal":"true","aria-labelledby":`lb-modal-title-${Ke(e.id)}`,tabindex:"-1"}),o=s("div","lb-mix-match__modal-header"),l=s("h4","lb-mix-match__modal-title",{id:`lb-modal-title-${Ke(e.id)}`});l.textContent="Pick an item",o.appendChild(l);let d=document.createElement("button");d.type="button",d.className="lb-mix-match__modal-close",d.setAttribute("data-modal-close",""),d.setAttribute("aria-label","Close"),d.innerHTML=Ye,d.addEventListener("click",v),o.appendChild(d),a.appendChild(o);let u=null,c=null;if(i.showSearch){let b=s("div","lb-mix-match__modal-search");u=document.createElement("input"),u.type="text",u.className="lb-mix-match__modal-search-input",u.setAttribute("data-modal-search",""),u.setAttribute("role","searchbox"),u.setAttribute("aria-label","Search products"),u.setAttribute("placeholder","Search products"),u.autocomplete="off",u.addEventListener("input",()=>E()),b.appendChild(u),c=document.createElement("button"),c.type="button",c.className="lb-mix-match__modal-search-clear",c.setAttribute("data-modal-search-clear",""),c.setAttribute("aria-label","Clear search"),c.style.display="none",c.innerHTML=dr,c.addEventListener("click",()=>{u&&(u.value="",E(),u.focus())}),b.appendChild(c),a.appendChild(b)}let h=s("div","lb-mix-match__modal-list",{"data-modal-list":""});a.appendChild(h);let f=s("div","lb-mix-match__modal-empty",{"data-modal-empty":""});f.style.display="none";let x=document.createElement("p");x.textContent="No products match your search.",f.appendChild(x),a.appendChild(f);let p=s("span","lb-visually-hidden",{"data-modal-live":"","aria-live":"polite"});a.appendChild(p),n.appendChild(a);let _=!1,T=[];function C(){_||(_=!0,h.innerHTML="",t.forEach(b=>{let P=b.variants,I=b.variants.find(L=>L.availableForSale)??b.firstAvailableVariant??b.variants[0];if(!I)return;let g=I,y=s("div",b.isOos?"lb-mix-match__modal-product lb-mix-match__modal-product--sold-out":"lb-mix-match__modal-product",{"data-product-id":b.product.id.replace(/^.*\//,"")}),O=s("div","lb-mix-match__modal-product-thumb");if(b.product.featuredImage){let L=document.createElement("img");L.src=Y(b.product.featuredImage.url,{width:H,height:H,crop:"center"}),L.alt=b.product.featuredImage.altText??b.product.title,L.width=H,L.height=H,L.loading="lazy",O.appendChild(L)}else O.insertAdjacentHTML("beforeend",Qe);let K=s("span","lb-bundle-qty-badge");K.textContent=String(N(e,b.product.id,g.id)),O.appendChild(K),y.appendChild(O);let z=s("div","lb-mix-match__modal-product-info"),ve=s("p","lb-mix-match__modal-product-title");ve.textContent=b.product.title,z.appendChild(ve);let de=s("p","lb-mix-match__modal-product-price");de.textContent=S(U(g.price.amount)*N(e,b.product.id,g.id),r),z.appendChild(de);let j=s("p","lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"),xe=W(g.unitPrice,g.unitPriceMeasurement,r);xe?j.textContent=xe:j.hidden=!0,z.appendChild(j);let se={el:y,product:b.product,variant:I,updateCount:()=>{}};if(P.length>1){let L=P[0].selectedOptions.map(F=>F.name),ct=b.product.id.replace(/^.*\//,""),re=[],ut=F=>P.find(R=>R.selectedOptions.length===F.length&&R.selectedOptions.every((q,V)=>q.value===F[V]))??null,pt=F=>{F.selectedOptions.forEach((R,q)=>{let V=re[q];V&&V.value!==R.value&&(V.value=R.value)})},bt=(F,R,q)=>P.some(V=>!V.availableForSale||V.selectedOptions[F]?.value!==R?!1:V.selectedOptions.every((D,Z)=>Z===F||D.value===q[Z])),ce=F=>{re.forEach((R,q)=>{Array.from(R.options).forEach(V=>{V.disabled=!bt(q,V.value,F)})})},ht=()=>{let F=re.map(D=>D.value),R=ut(F);if(!R){pt(g),ce(g.selectedOptions.map(D=>D.value));return}g=R,se.variant=R;let q=N(e,b.product.id,g.id);de.textContent=S(U(g.price.amount)*q,r);let V=W(g.unitPrice,g.unitPriceMeasurement,r);V?(j.textContent=V,j.hidden=!1):(j.textContent="",j.hidden=!0),ce(R.selectedOptions.map(D=>D.value)),Ce()},ye=s("div","lb-bundle-variant-option-groups");L.forEach((F,R)=>{let q=s("div","lb-bundle-variant-option-group"),V=s("span","lb-bundle-variant-option-label");V.textContent=F,q.appendChild(V);let D=document.createElement("select");D.className="lb-mix-match__variant-select",D.setAttribute("data-variant-option",""),D.setAttribute("data-option-position",String(R+1)),D.name=`lb-variant-${ct}-${R+1}`,D.setAttribute("aria-label",F);let Z=new Set;P.forEach(mt=>{let Q=mt.selectedOptions[R]?.value;if(!Q||Z.has(Q))return;Z.add(Q);let ne=document.createElement("option");ne.value=Q,ne.textContent=Q,I.selectedOptions[R]?.value===Q&&(ne.selected=!0),D.appendChild(ne)}),D.addEventListener("change",ht),re.push(D),q.appendChild(D),ye.appendChild(q)}),z.appendChild(ye),ce(I.selectedOptions.map(F=>F.value))}else if(P.length===1&&I.title!=="Default Title"){let L=s("span","lb-mix-match__filled-variant");L.textContent=I.title,z.appendChild(L)}if(b.isOos){let L=s("span","lb-mix-match__modal-sold-out-label");L.textContent="Sold out",z.appendChild(L)}y.appendChild(z);let Ce=()=>{K.textContent=String(N(e,b.product.id,g.id))};if(!b.isOos){let L=document.createElement("button");L.type="button",L.className="lb-mix-match__modal-add",L.textContent="Add",L.addEventListener("click",()=>{i.isOverMax()||(i.onAdd(b.product,g),v())}),y.appendChild(L)}se.updateCount=b.isOos?()=>{}:Ce,T.push(se),h.appendChild(y)}),A())}function E(){if(!u)return;let b=u.value.trim().toLowerCase();c&&(c.style.display=b?"":"none");let P=0;T.forEach(I=>{let g=!b||I.product.title.toLowerCase().includes(b);I.el.style.display=g?"":"none",g&&P++}),f.style.display=P===0&&b?"":"none"}let M=null;function m(b){if(b.key==="Escape"){b.preventDefault(),v();return}b.key==="Tab"&&fr(b,a)}let B=!1;function w(){B||i.isOverMax()||(B=!0,C(),M=n.getRootNode().activeElement,n.style.display="",n.classList.add("lb-mix-match__modal-overlay--open"),a.focus(),document.addEventListener("keydown",m),n.addEventListener("click",k))}function v(){B&&(B=!1,n.classList.remove("lb-mix-match__modal-overlay--open"),n.style.display="none",document.removeEventListener("keydown",m),n.removeEventListener("click",k),M instanceof HTMLElement&&M.focus())}function k(b){b.target===n&&v()}function A(){T.forEach(b=>b.updateCount())}return{el:n,open:w,close:v,refreshCounts:A}}function gr(e,t){let r=[],i=new Set;for(let n of e.products){if(i.has(n.id))continue;i.add(n.id);let a=n.variants.nodes.filter(l=>l.availableForSale),o=a.length===0;o&&t==="hide"||r.push({product:n,variants:n.variants.nodes,firstAvailableVariant:a[0]??null,isOos:o})}return r}function fr(e,t){let r=t.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(r.length===0)return;let i=r[0],n=r[r.length-1],a=t.getRootNode().activeElement;e.shiftKey&&a===i?(e.preventDefault(),n.focus()):!e.shiftKey&&a===n&&(e.preventDefault(),i.focus())}function Ke(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-")}function tt(e,t,r,i){let n=t.widgetConfig,o=t.products[0]?.variants.nodes.find(m=>m.availableForSale);if(!o&&n.outOfStockBehavior==="hide")return;let l=o?U(o.price.amount):0,d=o?.price.currencyCode??"USD",u=t.discountConfig.discountType,c=t.volumeTiers.map((m,B)=>{let w;if(u==="fixed_amount"){let v=Math.round((m.amount??0)*100);w=Math.max(0,l-v)}else{let v=m.percentage??0,k=Math.floor(l*v/100);w=Math.max(0,l-k)}return{tier:m,index:B,qty:m.minQuantity,pricePerUnitCents:w,basePricePerUnitCents:l}}),h=yr(c),f=n.defaultTier==="best_value"?h:0;typeof n.defaultTier=="number"&&(f=et(n.defaultTier,0,c.length-1));let x=n.popularBadge.tierIndex!==void 0?et(n.popularBadge.tierIndex,0,c.length-1):h,p=s("div","lb-volume");if(p.appendChild(vr(t,c,f,d,u)),n.countdown.showCountdown&&t.endsAt){let m=X(t.endsAt);m&&(p.appendChild(m.el),i?.(m.stop))}let _=s("div","lb-volume__tiers",{role:"radiogroup","aria-label":"Quantity tiers","data-tier-group":""});c.forEach(m=>{let B=xr(m,m.index===f,d,n.popularBadge.visible&&m.index===x?n.popularBadge.text:null,n.pricing.showComparePrice,n.pricing.showPerUnitPrice);B.addEventListener("click",()=>M(m.index)),B.addEventListener("keydown",w=>{if(w.key==="Enter"||w.key===" "){w.preventDefault(),M(m.index);return}if(w.key==="ArrowDown"||w.key==="ArrowRight"||w.key==="ArrowUp"||w.key==="ArrowLeft"){w.preventDefault();let v=w.key==="ArrowDown"||w.key==="ArrowRight"?1:-1,k=(m.index+v+c.length)%c.length;M(k),_.children[k]?.focus()}}),_.appendChild(B)}),p.appendChild(_),p.appendChild(s("div","lb-bundle-divider"));let T=Je(c,f,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);p.appendChild(T);let C=n.savingsBar.visible?Ze(c,f,d):null;C&&p.appendChild(C);let E=Cr(t,()=>{if(!o)return;let m=c[f];m&&r([{merchandiseId:o.id,quantity:m.qty,attributes:[{key:"_lime_bundle_gid",value:t.id},{key:"_lime_bundle_type",value:t.bundleType}]}])});p.appendChild(E),p.appendChild(s("p","lb-bundle-error",{"data-error":"","aria-live":"polite"})),p.appendChild(s("span","lb-visually-hidden",{"data-status":"","aria-live":"polite"})),e.appendChild(p);function M(m){if(m===f||m<0||m>=c.length)return;f=m,Array.from(_.children).forEach((v,k)=>{v.setAttribute("aria-checked",String(k===m)),v.tabIndex=k===m?0:-1});let B=Je(c,m,d,n.pricing.showItemCount,n.pricing.showCompareAtPrice);if(T.replaceWith(B),T=B,C){let v=Ze(c,m,d);C.replaceWith(v),C=v}let w=p.querySelector("[data-header-badge]");if(w){let v=rt(c[m],d,u);v?(w.textContent=v,w.style.display=""):w.style.display="none"}}}function vr(e,t,r,i,n){let a=e.widgetConfig,o=s("div","lb-bundle-header"),l=s("div","lb-bundle-header__content"),d=s("h3","lb-bundle-title");if(d.textContent=e.title,l.appendChild(d),o.appendChild(l),a.pricing.showSaveBadge){let u=rt(t[r],i,n);if(u){let c=s("span","lb-bundle-header__badge",{"data-header-badge":""});c.textContent=u,o.appendChild(c)}}return o}function xr(e,t,r,i,n,a){let o=s("div","lb-volume__tier",{role:"radio","aria-checked":String(t),tabindex:t?"0":"-1","data-tier-index":String(e.index),"data-tier-qty":String(e.qty)}),l=s("span","lb-volume__radio");l.appendChild(s("span","lb-volume__radio-dot")),o.appendChild(l);let d=s("span","lb-volume__tier-grid"),u=s("span","lb-volume__tier-label");u.textContent=`Buy ${e.qty}`,d.appendChild(u);let c=s("span","lb-volume__tier-price");if(n&&e.pricePerUnitCents<e.basePricePerUnitCents){let f=s("span","lb-volume__tier-compare");f.textContent=S(e.basePricePerUnitCents,r),c.appendChild(f)}if(a){let f=document.createElement("span");f.setAttribute("data-tier-price-each",""),f.textContent=S(e.pricePerUnitCents,r),c.appendChild(f);let x=s("span","lb-volume__tier-unit");x.textContent=" each",c.appendChild(x)}d.appendChild(c),o.appendChild(d);let h=s("span","lb-volume__tier-badge");return i?h.textContent=i:h.style.display="none",o.appendChild(h),o}function Je(e,t,r,i,n){let a=e[t],o=a?a.pricePerUnitCents*a.qty:0,l=a?a.basePricePerUnitCents*a.qty:0,d=Math.max(0,l-o),u=s("div","lb-bundle-pricing"),c=s("span","lb-bundle-pricing__label",{"data-total-label":""});if(c.textContent="Total",i&&a){let x=document.createElement("span");x.setAttribute("data-item-count",""),x.textContent=` (${a.qty} item${a.qty===1?"":"s"})`,c.appendChild(x)}u.appendChild(c);let h=s("span","lb-bundle-pricing__prices");if(n&&d>0){let x=s("span","lb-bundle-compare-price",{"data-compare-price":""});x.textContent=S(l,r),h.appendChild(x)}let f=s("span","lb-bundle-sale-price",{"data-total-price":""});return f.textContent=S(o,r),h.appendChild(f),u.appendChild(h),u}function Ze(e,t,r){let i=e[t],n=i?i.pricePerUnitCents*i.qty:0,a=i?i.basePricePerUnitCents*i.qty:0,o=Math.max(0,a-n),l=s("div","lb-bundle-savings-bar",{"data-savings-bar":""});o<=0&&(l.style.display="none");let d=document.createElement("span");d.textContent="You save",l.appendChild(d);let u=s("span","",{"data-savings-amount":""});return u.textContent=S(o,r),l.appendChild(u),l}function Cr(e,t){let i=e.products[0]?.variants.nodes.some(o=>o.availableForSale),n=i?e.widgetConfig.cta.ctaText||"Add to cart":"Sold out",a=J(n);return i||(a.disabled=!0),a.addEventListener("click",()=>{a.disabled||t()}),a}function rt(e,t,r){if(!e)return null;let{tier:i}=e;if(r==="fixed_amount"){let n=i.amount??0;return n>0?`-${S(Math.round(n*100),t)}`:null}if(r==="percentage"){let n=i.percentage??0;return n>0?`-${Math.round(n)}%`:null}return null}function yr(e){let t=0,r=0;return e.forEach((i,n)=>{let a=i.basePricePerUnitCents-i.pricePerUnitCents;a>t&&(t=a,r=n)}),r}function et(e,t,r){return Math.max(t,Math.min(r,e))}var wr=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Enter"," ","Escape"]),oe=new Set,ae=!1;function nt(e){let t=e==="using-mouse"?"using-keyboard":"using-mouse";for(let r of oe)r.classList.add(e),r.classList.remove(t)}function it(e){wr.has(e.key)&&nt("using-keyboard")}function ot(){nt("using-mouse")}function _r(){ae||(ae=!0,document.addEventListener("keydown",it,!0),document.addEventListener("pointerdown",ot,!0))}function kr(){ae&&(ae=!1,document.removeEventListener("keydown",it,!0),document.removeEventListener("pointerdown",ot,!0))}function le(e){return e.classList.add("using-mouse"),e.classList.remove("using-keyboard"),oe.add(e),_r(),()=>{oe.delete(e),e.classList.remove("using-mouse"),e.classList.remove("using-keyboard"),oe.size===0&&kr()}}var fe=`/* Lime Bundles \u2014 shared base styles for all bundle widget types */
236
236
 
237
237
  .lb-bundle-widget.lb-bundle-widget,
238
238
  .lb-bundle-widget.lb-bundle-widget * {
@@ -402,15 +402,18 @@
402
402
  /* Product rows */
403
403
  .lb-bundle-product-row {
404
404
  display: flex;
405
- gap: 12px;
405
+ gap: 20px;
406
406
  padding: 12px 0;
407
407
  }
408
408
 
409
409
  .lb-bundle-thumbnail {
410
410
  position: relative;
411
411
  width: 48px;
412
- height: 48px;
413
412
  min-width: 48px;
413
+ /* Aspect-ratio comes from the merchant \`thumbnailRatio\` enum via Liquid;
414
+ "original" sets it to \`auto\` so the box sizes to the image's intrinsic
415
+ ratio. Default keeps the historical 1:1 behaviour. */
416
+ aspect-ratio: var(--lb-thumbnail-aspect-ratio, 1 / 1);
414
417
  background: var(--lb-thumbnail-bg);
415
418
  border-radius: 8px;
416
419
  overflow: hidden;
@@ -421,8 +424,10 @@
421
424
 
422
425
  .lb-bundle-thumbnail img {
423
426
  width: 100%;
424
- height: 100%;
425
- object-fit: cover;
427
+ /* Height + fit come from the same merchant enum; "original" sets them to
428
+ \`auto\` / \`contain\` so the image renders uncropped at intrinsic ratio. */
429
+ height: var(--lb-thumbnail-img-height, 100%);
430
+ object-fit: var(--lb-thumbnail-img-fit, cover);
426
431
  }
427
432
 
428
433
  .lb-bundle-thumbnail svg {
@@ -453,7 +458,7 @@
453
458
  .lb-bundle-product-price {
454
459
  /* --lb-product-price-display fallback is the "on" branch; Liquid sets 'none' when merchant disables. */
455
460
  display: var(--lb-product-price-display, block);
456
- font-size: 12px;
461
+ font-size: 14px;
457
462
  font-weight: 400;
458
463
  line-height: 20px;
459
464
  color: var(--lb-text);
@@ -470,7 +475,7 @@
470
475
  .lb-bundle-product-compare-price {
471
476
  /* --lb-product-compare-display fallback is the "on" branch; Liquid sets 'none' when merchant disables. */
472
477
  display: var(--lb-product-compare-display, inline);
473
- font-size: 12px;
478
+ font-size: 14px;
474
479
  font-weight: 400;
475
480
  line-height: 20px;
476
481
  color: color-mix(in srgb, var(--lb-text) 60%, transparent);
@@ -489,7 +494,7 @@
489
494
  secondary text beneath the price row so it doesn't compete visually. */
490
495
  .lb-bundle-product-unit-price {
491
496
  display: block;
492
- font-size: 11px;
497
+ font-size: 12px;
493
498
  line-height: 16px;
494
499
  color: color-mix(in srgb, var(--lb-text) 60%, transparent);
495
500
  margin-top: 2px;
@@ -510,6 +515,56 @@
510
515
  margin-top: 8px;
511
516
  }
512
517
 
518
+ /* Per-option variant pickers. Each option's label + select sit inside a
519
+ .lb-bundle-variant-option-group (flex column, 2px gap between label and
520
+ select); the groups stack inside a .lb-bundle-variant-option-groups
521
+ parent (flex column, 12px gap between groups). The parent owns the top
522
+ offset from the preceding unit-price line, so individual labels and
523
+ selects don't carry their own vertical margins. */
524
+ .lb-bundle-variant-option-groups {
525
+ display: flex;
526
+ flex-direction: column;
527
+ gap: 12px;
528
+ margin-top: 8px;
529
+ }
530
+
531
+ .lb-bundle-variant-option-group {
532
+ display: flex;
533
+ flex-direction: column;
534
+ gap: 2px;
535
+ }
536
+
537
+ .lb-bundle-variant-option-label {
538
+ display: block;
539
+ margin: 0;
540
+ font-size: 12px;
541
+ line-height: 16px;
542
+ font-weight: 600;
543
+ letter-spacing: 0.05em;
544
+ text-transform: uppercase;
545
+ color: color-mix(in srgb, var(--lb-text) 60%, transparent);
546
+ }
547
+
548
+ .lb-mix-match__modal-product-info .lb-bundle-variant-option-groups {
549
+ margin-top: 4px;
550
+ }
551
+
552
+ /* Focus-ring suppression for mouse users. A small JS helper \u2014 see
553
+ packages/widget/src/utils/input-mode.ts and bundle-widget.js \u2014 toggles
554
+ .using-mouse / .using-keyboard on the widget root (or html in the Liquid
555
+ path) based on the customer's current input device. Default is mouse, so
556
+ click-to-focus doesn't leave a keyboard-style ring. The modal overlay
557
+ gets its own selector because the Liquid path reparents it to body,
558
+ outside the widget root. */
559
+ .using-mouse .lb-bundle-widget :focus,
560
+ .using-mouse .lb-bundle-widget :focus-visible,
561
+ .using-mouse .lb-mix-match__modal-overlay :focus,
562
+ .using-mouse .lb-mix-match__modal-overlay :focus-visible {
563
+ outline: none;
564
+ outline-offset: 0;
565
+ box-shadow: none;
566
+ }
567
+
513
568
  .lb-bundle-quantity {
514
569
  font-size: 12px;
515
570
  line-height: 16px;
@@ -612,7 +667,7 @@
612
667
  grid-template-rows: 1fr;
613
668
  grid-template-columns: 1fr;
614
669
  width: 100%;
615
- padding: 16px;
670
+ padding: 12px 16px;
616
671
  border: var(--lb-cta-border-width) solid var(--lb-cta-border-color);
617
672
  border-radius: var(--lb-cta-radius);
618
673
  font-size: 16px;
@@ -735,7 +790,7 @@
735
790
  .lb-ab-pending {
736
791
  visibility: hidden;
737
792
  }
738
- `,Oe=`/* Lime Bundles \u2014 Fixed bundle styles */
793
+ `,at=`/* Lime Bundles \u2014 Fixed bundle styles */
739
794
 
740
795
  .lb-fixed__products {
741
796
  display: flex;
@@ -746,14 +801,14 @@
746
801
 
747
802
  /* Fixed bundles: product rows */
748
803
  .lb-fixed .lb-bundle-product-row {
749
- gap: 16px;
804
+ gap: 20px;
750
805
  align-items: center;
751
806
  }
752
807
 
753
- /* Fixed bundles: larger thumbnails */
808
+ /* Fixed bundles: larger thumbnails. Height comes from --lb-thumbnail-aspect-ratio
809
+ (set on .lb-bundle-widget via Liquid / applyWidgetConfigVars). */
754
810
  .lb-fixed .lb-bundle-thumbnail {
755
811
  width: 60px;
756
- height: 60px;
757
812
  min-width: 60px;
758
813
  border-radius: var(--lb-image-border-radius);
759
814
  border: var(--lb-image-border-width) solid var(--lb-image-border-color);
@@ -766,9 +821,10 @@
766
821
  border: none;
767
822
  }
768
823
 
769
- /* Variant picker select \u2014 styled to match the variant badge aesthetic */
824
+ /* Variant picker select \u2014 styled to match the variant badge aesthetic.
825
+ Sits inside .lb-bundle-variant-option-group so vertical spacing is owned
826
+ by the group/groups flex gap, not the select itself. */
770
827
  .lb-bundle-variant-select {
771
- margin-top: 8px;
772
828
  display: inline-block;
773
829
  border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
774
830
  border-radius: var(--lb-variant-radius);
@@ -785,14 +841,15 @@
785
841
  background-repeat: no-repeat;
786
842
  background-position: right 8px center;
787
843
  background-size: 12px;
788
- max-width: 100%;
844
+ width: 50%;
845
+ max-width: 50%;
789
846
  }
790
847
 
791
848
  .lb-bundle-variant-select:focus-visible {
792
849
  outline: 2px solid var(--lb-primary-color);
793
850
  outline-offset: 2px;
794
851
  }
795
- `,He=`/* Lime Bundles \u2014 Mix & Match styles */
852
+ `,lt=`/* Lime Bundles \u2014 Mix & Match styles */
796
853
 
797
854
  /* === Progress Bar === */
798
855
  .lb-mix-match__progress {
@@ -853,7 +910,10 @@
853
910
  width: 60px;
854
911
  height: 60px;
855
912
  min-width: 60px;
856
- border: var(--lb-image-border-width) dashed color-mix(in srgb, var(--lb-text) 20%, transparent);
913
+ /* 2px border is intentionally independent of --lb-image-border-width \u2014
914
+ empty slots always need a visible dashed outline as an affordance,
915
+ regardless of how the merchant has styled populated thumbnails. */
916
+ border: 2px dashed color-mix(in srgb, var(--lb-text) 35%, transparent);
857
917
  border-radius: var(--lb-image-border-radius);
858
918
  box-sizing: border-box;
859
919
  display: flex;
@@ -873,9 +933,10 @@
873
933
  cursor: default;
874
934
  }
875
935
 
936
+ /* Mix-match thumbnails. Height comes from --lb-thumbnail-aspect-ratio
937
+ (set on .lb-bundle-widget via Liquid / applyWidgetConfigVars). */
876
938
  .lb-mix-match .lb-bundle-thumbnail {
877
939
  width: 60px;
878
- height: 60px;
879
940
  min-width: 60px;
880
941
  border-radius: var(--lb-image-border-radius);
881
942
  border: var(--lb-image-border-width) solid var(--lb-image-border-color);
@@ -1110,7 +1171,7 @@
1110
1171
  .lb-mix-match__modal-product {
1111
1172
  display: flex;
1112
1173
  align-items: center;
1113
- gap: 12px;
1174
+ gap: 20px;
1114
1175
  padding: 12px 0;
1115
1176
  border-bottom: 1px solid color-mix(in srgb, var(--lb-picker-text) 7%, transparent);
1116
1177
  }
@@ -1122,8 +1183,11 @@
1122
1183
  .lb-mix-match__modal-product-thumb {
1123
1184
  position: relative;
1124
1185
  width: 48px;
1125
- height: 48px;
1126
1186
  min-width: 48px;
1187
+ /* Modal picker thumbs follow the merchant's pickerThumbnailRatio \u2014
1188
+ independent from the main widget's thumbnailRatio so a merchant can
1189
+ e.g. show tall picker thumbs with square main thumbs. */
1190
+ aspect-ratio: var(--lb-picker-thumbnail-aspect-ratio, 1 / 1);
1127
1191
  border-radius: var(--lb-picker-product-radius);
1128
1192
  border: var(--lb-picker-product-border-width) solid var(--lb-picker-product-border-color);
1129
1193
  box-sizing: border-box;
@@ -1144,8 +1208,10 @@
1144
1208
 
1145
1209
  .lb-mix-match__modal-product-thumb img {
1146
1210
  width: 100%;
1147
- height: 100%;
1148
- object-fit: cover;
1211
+ /* Height + fit come from pickerThumbnailRatio \u2014 "original" sets both
1212
+ to auto/contain so the image renders uncropped at intrinsic ratio. */
1213
+ height: var(--lb-picker-thumbnail-img-height, 100%);
1214
+ object-fit: var(--lb-picker-thumbnail-img-fit, cover);
1149
1215
  border-radius: max(0px, calc(var(--lb-picker-product-radius) - var(--lb-picker-product-border-width)));
1150
1216
  }
1151
1217
 
@@ -1182,7 +1248,6 @@
1182
1248
 
1183
1249
  .lb-mix-match__variant-select {
1184
1250
  font-size: 12px;
1185
- margin: 4px 0 0;
1186
1251
  padding: 4px 24px 4px 8px;
1187
1252
  border: var(--lb-picker-variant-border-width) solid var(--lb-picker-variant-border-color);
1188
1253
  border-radius: var(--lb-picker-variant-radius);
@@ -1195,7 +1260,8 @@
1195
1260
  font-family: inherit;
1196
1261
  min-height: 32px;
1197
1262
  cursor: pointer;
1198
- max-width: 120px;
1263
+ width: 50%;
1264
+ max-width: 50%;
1199
1265
  appearance: none;
1200
1266
  -webkit-appearance: none;
1201
1267
  }
@@ -1279,6 +1345,11 @@
1279
1345
  .lb-mix-match__modal-overlay--open .lb-mix-match__modal {
1280
1346
  transform: translateY(0);
1281
1347
  }
1348
+
1349
+ .lb-mix-match__variant-select {
1350
+ width: 80%;
1351
+ max-width: 80%;
1352
+ }
1282
1353
  }
1283
1354
 
1284
1355
  /* === Reduced Motion === */
@@ -1289,7 +1360,7 @@
1289
1360
  transition: none;
1290
1361
  }
1291
1362
  }
1292
- `,$e=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
1363
+ `,dt=`/* Lime Bundles \u2014 Volume / Quantity Breaks styles */
1293
1364
 
1294
1365
  .lb-volume__tiers {
1295
1366
  display: flex;
@@ -1379,7 +1450,7 @@
1379
1450
 
1380
1451
  .lb-volume__tier-price {
1381
1452
  grid-column: 1 / -1;
1382
- font-size: 12px;
1453
+ font-size: 14px;
1383
1454
  font-weight: 500;
1384
1455
  color: var(--lb-text);
1385
1456
  }
@@ -1391,7 +1462,7 @@
1391
1462
 
1392
1463
  /* Compare-at (strikethrough) price */
1393
1464
  .lb-volume__tier-compare {
1394
- font-size: 12px;
1465
+ font-size: 14px;
1395
1466
  line-height: 16px;
1396
1467
  color: color-mix(in srgb, var(--lb-text) 60%, transparent);
1397
1468
  text-decoration: line-through;
@@ -1399,7 +1470,7 @@
1399
1470
  }
1400
1471
 
1401
1472
 
1402
- `,Ne=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
1473
+ `,st=`/* Lime Bundles \u2014 web-component loading skeleton (not mirrored to theme assets) */
1403
1474
 
1404
1475
  .lb-bundle-widget--loading {
1405
1476
  display: block;
@@ -1495,10 +1566,10 @@
1495
1566
  animation: none;
1496
1567
  }
1497
1568
  }
1498
- `;var Qt=e=>`lb_cart_id:${e}`;function Kt(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 G=class extends HTMLElement{static observedAttributes=["shop-domain","storefront-token","bundle-gid","product-handle","app-url","analytics","locale"];shadow;bundles=[];abortController=null;impressionCleanups=[];renderCleanups=[];shopCustomCss=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.fetchBundle()}disconnectedCallback(){this.abortController?.abort(),this.teardownImpressions(),this.teardownRenderers()}teardownImpressions(){for(let t of this.impressionCleanups)t();this.impressionCleanups=[]}teardownRenderers(){for(let t of this.renderCleanups)t();this.renderCleanups=[]}attributeChangedCallback(t,r,i){r===i||!this.isConnected||(t==="bundle-gid"||t==="product-handle"||t==="shop-domain"||t==="storefront-token")&&this.shopDomain&&this.storefrontToken&&this.fetchBundle()}get shopDomain(){return this.getAttribute("shop-domain")??""}get storefrontToken(){return this.getAttribute("storefront-token")??""}get bundleGid(){return this.getAttribute("bundle-gid")??""}get productHandleAttr(){return this.getAttribute("product-handle")??""}get appUrl(){return this.getAttribute("app-url")??""}get analyticsEnabled(){return this.getAttribute("analytics")!=="false"}async fetchBundle(){if(!this.shopDomain||!this.storefrontToken){this.renderError("Missing required attributes: shop-domain, storefront-token");return}this.abortController?.abort();let t=new AbortController;this.abortController=t,this.renderLoading();let r=X({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let i,n=!1;if(this.bundleGid)n=!0,i=this.fetchSingleBundle(r,t.signal);else{let d=Kt(this.productHandleAttr);if(!d){this.teardownImpressions(),this.renderError("No bundle-gid or product-handle provided, and the current URL doesn't match /products/<handle>.");return}i=this.fetchProductBundles(r,t.signal,d)}let a=r.query(be,void 0,{signal:t.signal}).catch(()=>null);if(await i,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){Se(this.shopDomain,o.shop.metafield.value);let d=ee(o.shop.metafield.value);d.ok&&(this.shopCustomCss=d.css)}await this.applyABVariants(),this.renderBundles()}catch(i){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(i instanceof Error?i.message:"Failed to load bundle")}}async applyABVariants(){if(!this.appUrl||this.bundles.length===0)return;let t=await Promise.all(this.bundles.map(async r=>{if(!r.abTestId||!r.abVariantB)return r;try{if((await ke(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return xe(r)}catch(i){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,i)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let i=await t.query(pe,{id:this.bundleGid},{signal:r});if(!i.metaobject){this.bundles=[];return}let n=J(i.metaobject.id,i.metaobject.fields);this.bundles=n?[n]:[]}async fetchProductBundles(t,r,i){let n=await t.query(he,{handle:i},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],o=[];for(let d of a){let l=J(d.id,d.fields);l&&o.push(l)}this.bundles=o}handleAddToCart=async(t,r)=>{let i=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(i);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=X({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),i=window.localStorage,n=Qt(this.shopDomain),a=i?.getItem(n)??null;try{let o=null;if(a){let l=(await r.query(ge,{cartId:a,lines:t})).cartLinesAdd;l?.userErrors?.length?i?.removeItem(n):l?.cart&&(o=l.cart.checkoutUrl)}if(!o){let l=(await r.query(me,{input:{lines:t}})).cartCreate;l?.cart&&(i?.setItem(n,l.cart.id),o=l.cart.checkoutUrl)}o?window.location.assign(o):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(o){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:o instanceof Error?o.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=r.reduce((a,o)=>a+o.quantity,0),n=r.reduce((a,o)=>{let l=t.products.find(c=>c.variants.nodes.some(p=>p.id===o.merchandiseId))?.variants.nodes.find(c=>c.id===o.merchandiseId),u=l?parseFloat(l.price.amount):0;return a+u*o.quantity},0);ye({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:i,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[ie,Oe,He,$e].join(`
1499
- `),this.shadow.appendChild(t),this.shopCustomCss){let i=document.createElement("style");i.setAttribute("data-lime-bundles","shop-custom-css"),i.textContent=this.shopCustomCss,this.shadow.appendChild(i)}for(let i of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",i.title),n.setAttribute("data-bundle-type",i.bundleType),n.setAttribute("data-bundle-gid",i.id),fe(n,i.widgetConfig);let a=d=>this.handleAddToCart(i,d),o=d=>this.renderCleanups.push(d);switch(i.bundleType){case"fixed":Ee(n,i,a,o);break;case"mix_match":Re(n,i,a,o);break;case"volume":Ue(n,i,a,o);break}this.shadow.appendChild(n),this.setupImpressionFor(i,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(i=>i.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=we(r,()=>{Ce({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(i)}renderLoading(){this.shadow.innerHTML=`
1500
- <style>${ie}</style>
1501
- <style>${Ne}</style>
1569
+ `;var Br=e=>`lb_cart_id:${e}`;function Sr(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 te=class extends HTMLElement{static observedAttributes=["shop-domain","storefront-token","bundle-gid","product-handle","app-url","analytics","locale"];shadow;bundles=[];abortController=null;impressionCleanups=[];renderCleanups=[];shopCustomCss=null;constructor(){super(),this.shadow=this.attachShadow({mode:"open"})}connectedCallback(){this.fetchBundle()}disconnectedCallback(){this.abortController?.abort(),this.teardownImpressions(),this.teardownRenderers()}teardownImpressions(){for(let t of this.impressionCleanups)t();this.impressionCleanups=[]}teardownRenderers(){for(let t of this.renderCleanups)t();this.renderCleanups=[]}attributeChangedCallback(t,r,i){r===i||!this.isConnected||(t==="bundle-gid"||t==="product-handle"||t==="shop-domain"||t==="storefront-token")&&this.shopDomain&&this.storefrontToken&&this.fetchBundle()}get shopDomain(){return this.getAttribute("shop-domain")??""}get storefrontToken(){return this.getAttribute("storefront-token")??""}get bundleGid(){return this.getAttribute("bundle-gid")??""}get productHandleAttr(){return this.getAttribute("product-handle")??""}get appUrl(){return this.getAttribute("app-url")??""}get analyticsEnabled(){return this.getAttribute("analytics")!=="false"}async fetchBundle(){if(!this.shopDomain||!this.storefrontToken){this.renderError("Missing required attributes: shop-domain, storefront-token");return}this.abortController?.abort();let t=new AbortController;this.abortController=t,this.renderLoading();let r=pe({shopDomain:this.shopDomain,accessToken:this.storefrontToken});try{let i,n=!1;if(this.bundleGid)n=!0,i=this.fetchSingleBundle(r,t.signal);else{let l=Sr(this.productHandleAttr);if(!l){this.teardownImpressions(),this.renderError("No bundle-gid or product-handle provided, and the current URL doesn't match /products/<handle>.");return}i=this.fetchProductBundles(r,t.signal,l)}let a=r.query(Le,void 0,{signal:t.signal}).catch(()=>null);if(await i,t.signal.aborted)return;if(n&&this.bundles.length===0){this.teardownImpressions(),this.renderError("Bundle not found");return}let o=await a;if(o?.shop?.metafield?.value){We(this.shopDomain,o.shop.metafield.value);let l=he(o.shop.metafield.value);l.ok&&(this.shopCustomCss=l.css)}await this.applyABVariants(),this.renderBundles()}catch(i){if(t.signal.aborted)return;this.bundles=[],this.teardownImpressions(),this.renderError(i instanceof Error?i.message:"Failed to load bundle")}}async applyABVariants(){if(!this.appUrl||this.bundles.length===0)return;let t=await Promise.all(this.bundles.map(async r=>{if(!r.abTestId||!r.abVariantB)return r;try{if((await Ne(this.appUrl,this.shopDomain,r.abTestId,r.id))?.variant==="B")return De(r)}catch(i){console.warn(`[lime-bundle] A/B assignment failed for bundle ${r.id}; falling back to Variant A.`,i)}return r}));this.bundles=t}async fetchSingleBundle(t,r){let i=await t.query(Pe,{id:this.bundleGid},{signal:r});if(!i.metaobject){this.bundles=[];return}let n=be(i.metaobject.id,i.metaobject.fields);this.bundles=n?[n]:[]}async fetchProductBundles(t,r,i){let n=await t.query(Me,{handle:i},{signal:r});if(!n.product){this.bundles=[];return}let a=n.product.metafield?.references?.nodes??[],o=[];for(let l of a){let d=be(l.id,l.fields);d&&o.push(d)}this.bundles=o}handleAddToCart=async(t,r)=>{let i=new CustomEvent("lime-bundle:add-to-cart",{detail:{lines:r},bubbles:!0,composed:!0,cancelable:!0}),n=this.dispatchEvent(i);this.reportAddToCartEvent(t,r),n&&await this.defaultAddToCart(r)};async defaultAddToCart(t){if(typeof window>"u")return;let r=pe({shopDomain:this.shopDomain,accessToken:this.storefrontToken}),i=window.localStorage,n=Br(this.shopDomain),a=i?.getItem(n)??null;try{let o=null;if(a){let d=(await r.query(Ie,{cartId:a,lines:t})).cartLinesAdd;d?.userErrors?.length?i?.removeItem(n):d?.cart&&(o=d.cart.checkoutUrl)}if(!o){let d=(await r.query(Re,{input:{lines:t}})).cartCreate;d?.cart&&(i?.setItem(n,d.cart.id),o=d.cart.checkoutUrl)}o?window.location.assign(o):this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:"Cart creation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}catch(o){this.dispatchEvent(new CustomEvent("lime-bundle:error",{detail:{message:o instanceof Error?o.message:"Cart mutation failed",code:"CART_ERROR"},bubbles:!0,composed:!0}))}}reportAddToCartEvent(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=r.reduce((a,o)=>a+o.quantity,0),n=r.reduce((a,o)=>{let d=t.products.find(c=>c.variants.nodes.some(h=>h.id===o.merchandiseId))?.variants.nodes.find(c=>c.id===o.merchandiseId),u=d?parseFloat(d.price.amount):0;return a+u*o.quantity},0);Oe({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType,productId:t.products[0]?.id??"",quantity:i,totalPrice:Math.round(n*100)/100})}renderBundles(){this.teardownImpressions(),this.teardownRenderers(),this.shadow.innerHTML="";let t=document.createElement("style");if(t.textContent=[fe,at,lt,dt].join(`
1570
+ `),this.shadow.appendChild(t),this.shopCustomCss){let i=document.createElement("style");i.setAttribute("data-lime-bundles","shop-custom-css"),i.textContent=this.shopCustomCss,this.shadow.appendChild(i)}for(let i of this.bundles){let n=document.createElement("div");n.className="lb-bundle-widget",n.setAttribute("role","region"),n.setAttribute("aria-label",i.title),n.setAttribute("data-bundle-type",i.bundleType),n.setAttribute("data-bundle-gid",i.id),Fe(n,i.widgetConfig),this.renderCleanups.push(le(n));let a=l=>this.handleAddToCart(i,l),o=l=>this.renderCleanups.push(l);switch(i.bundleType){case"fixed":Ge(n,i,a,o);break;case"mix_match":Xe(n,i,a,o);break;case"volume":tt(n,i,a,o);break}this.shadow.appendChild(n),this.setupImpressionFor(i,n)}let r=this.bundles[0];this.dispatchEvent(new CustomEvent("lime-bundle:loaded",{detail:{bundleCount:this.bundles.length,bundleTypes:this.bundles.map(i=>i.bundleType),bundleType:r?.bundleType,title:r?.title},bubbles:!0,composed:!0}))}setupImpressionFor(t,r){if(!this.analyticsEnabled||!this.appUrl)return;let i=He(r,()=>{Ue({shopDomain:this.shopDomain,appUrl:this.appUrl},{bundleGid:t.id,bundleType:t.bundleType})});this.impressionCleanups.push(i)}renderLoading(){this.shadow.innerHTML=`
1571
+ <style>${fe}</style>
1572
+ <style>${st}</style>
1502
1573
  <div class="lb-bundle-widget lb-bundle-widget--loading" aria-busy="true" aria-label="Loading bundle">
1503
1574
  <div class="lb-skeleton lb-skeleton--title"></div>
1504
1575
  <div class="lb-skeleton--products">
@@ -1532,5 +1603,5 @@
1532
1603
  <div class="lb-skeleton lb-skeleton--cta"></div>
1533
1604
  </div>
1534
1605
  </div>
1535
- `}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",G);return Qe(Yt);})();
1606
+ `}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",te);return yt(Tr);})();
1536
1607
  //# sourceMappingURL=lime-bundle.global.js.map