@best-bundles/bundle-ui 0.0.23 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,56 +1,56 @@
1
1
  (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('._button_18rtl_1{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-family:var(--bb-font-family, inherit);border:1px solid var(--bb-button-border, rgba(0, 0, 0, .12));background:var(--bb-button-bg, #111827);color:var(--bb-button-text, #ffffff);font:inherit;line-height:1;padding:10px 14px;border-radius:var(--bb-button-radius, 10px);cursor:pointer;transition:transform .12s ease,background .12s ease,border-color .12s ease,opacity .12s ease}._button_18rtl_1:hover{background:var(--bb-button-bg-hover, #0b1220)}._button_18rtl_1:active{transform:translateY(1px)}._button_18rtl_1:disabled{opacity:.6;cursor:not-allowed}._button_18rtl_1:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._backdrop_227w4_1{position:fixed;top:0;right:0;bottom:0;left:0;z-index:var(--bb-backdrop-z-index, 9999);display:flex;justify-content:flex-end;background:var(--bb-backdrop-bg, rgba(0, 0, 0, .5));-webkit-backdrop-filter:blur(var(--bb-backdrop-blur, 2px));backdrop-filter:blur(var(--bb-backdrop-blur, 2px));padding:var(--bb-backdrop-padding, 12px);opacity:0;transition:opacity var(--bb-drawer-transition-duration, .22s) ease}._celebrationOverlay_227w4_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_227w4_23{font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.03em;font-size:18px;line-height:1;padding:12px 16px;border-radius:999px;color:var(--bb-celebration-text, #0b1b44);background:linear-gradient(180deg,var(--bb-celebration-bg-top, #ffffff),var(--bb-celebration-bg-bottom, #bae6fd));border:2px solid var(--bb-celebration-border, rgba(37, 99, 235, .28));box-shadow:0 18px 55px #0006,0 10px 28px #2563eb33,inset 0 1px #ffffffbf;transform-origin:50% 60%;will-change:transform,opacity,filter;animation:_bbCelebrationPop_227w4_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_227w4_1{0%{opacity:0;transform:translateY(10px) scale(.6);filter:blur(1px) saturate(1.1)}12%{opacity:1;transform:translateY(0) scale(1.12);filter:blur(0px) saturate(1.1)}22%{opacity:1;transform:translateY(0) scale(1)}80%{opacity:1;transform:translateY(0) scale(1)}to{opacity:0;transform:translateY(-10px) scale(.98)}}._backdropOpen_227w4_74{opacity:1}._backdropClosed_227w4_78{opacity:0}._panel_227w4_82{width:440px;max-width:100%;height:100%;background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);font-family:var(--bb-font-family-body, "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);border-radius:var(--bb-panel-radius, 16px);box-shadow:0 20px 60px #00000059;display:grid;grid-template-rows:auto 1fr auto;overflow:hidden;outline:none;position:relative;top:unset;right:unset;bottom:unset;left:unset}._panelOpen_227w4_102{animation:_bbSlideInFromRight_227w4_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_227w4_106{animation:_bbSlideOutToRight_227w4_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_227w4_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_227w4_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_227w4_1{transition:none}._celebrationChip_227w4_23,._panelOpen_227w4_102,._panelClosed_227w4_106{animation:none}}._header_227w4_145{display:grid;grid-template-columns:36px 1fr 36px;align-items:center;column-gap:12px;padding:var(--bb-header-padding, 16px 16px 12px 16px);border-bottom:1px solid var(--bb-border-color, rgba(17, 24, 39, .08))}._headerCenter_227w4_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_227w4_162{font-size:24px;margin:0;line-height:1.2;font-family:var(--bb-font-family-title, "Bebas Neue", "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif);letter-spacing:.02em;color:var(--bb-title-color, var(--bb-text-color, #111827))}._searchIconButton_227w4_171{width:36px;height:36px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);cursor:pointer;display:inline-flex;align-items:center;justify-content:center}._searchIconButton_227w4_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_227w4_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_227w4_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_227w4_197{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;pointer-events:none;opacity:0;transform:translateY(-2px);transition:opacity .18s ease,transform .22s ease}._headerSearchOpen_227w4_209 ._headerTitleWrap_227w4_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_227w4_209 ._headerSearchWrap_227w4_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_227w4_221{width:min(320px,100%);height:36px;display:flex;align-items:center;gap:8px;background:var(--bb-surface-bg, #ffffff);border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));border-radius:10px;padding:0 8px}._searchInput_227w4_233{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_227w4_233::-webkit-search-cancel-button,._searchInput_227w4_233::-webkit-search-decoration,._searchInput_227w4_233::-webkit-search-results-button,._searchInput_227w4_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_227w4_254{border:none;background:transparent;color:var(--bb-text-color, #111827);font:inherit;font-size:13px;font-weight:700;cursor:pointer;padding:6px;border-radius:10px;line-height:1}._searchClearButton_227w4_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_227w4_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_227w4_276{border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);color:var(--bb-text-color, #111827);width:36px;height:36px;border-radius:10px;cursor:pointer;flex:0 0 auto}._closeButton_227w4_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_227w4_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_227w4_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_227w4_193,._headerSearchWrap_227w4_197{transition:none}}._body_227w4_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_227w4_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_227w4_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_227w4_324{margin-top:4px}._variantList_227w4_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_227w4_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_227w4_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_227w4_351{height:100%;align-self:stretch;border-radius:12px;border:none;background:var(--bb-cta-bg, #91aae5);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:800;padding:0 16px;cursor:pointer;white-space:nowrap}._addToBundleButton_227w4_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_227w4_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_227w4_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_227w4_379{width:60px;height:60px;border-radius:12px;overflow:hidden;border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));flex:0 0 auto}._variantThumbImg_227w4_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_227w4_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_227w4_406{min-width:0}._variantName_227w4_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_227w4_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_227w4_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_227w4_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_227w4_427{font-size:13px;font-weight:800}._qtyControls_227w4_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_227w4_451{width:34px;height:34px;border-radius:10px;border:1px solid var(--bb-border-strong-color, rgba(17, 24, 39, .12));background:var(--bb-surface-bg, #ffffff);cursor:pointer;line-height:1;font-size:16px}._qtyButton_227w4_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_227w4_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_227w4_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_227w4_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_227w4_483{padding:var(--bb-footer-padding, 12px 16px 16px 16px);border-top:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);position:relative}._poweredBy_227w4_490{font-size:10px;color:var(rgba(17, 24, 39, .6));text-align:center;margin-top:10px}._poweredBy_227w4_490 a{color:inherit;text-decoration:none}._boxSummaryWindow_227w4_502{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_227w4_502::-webkit-scrollbar{display:none}._boxSummaryRow_227w4_519{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_227w4_527{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_227w4_535{width:100%;aspect-ratio:1 / 1;border-radius:12px;position:relative;display:flex;align-items:center;justify-content:center;-webkit-user-select:none;user-select:none;box-sizing:border-box}._boxItemClickable_227w4_547{cursor:pointer}._boxItemClickable_227w4_547:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_227w4_556{font-size:11px;line-height:1.15;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}._boxItemPlaceholder_227w4_567{border:1px dashed var(--bb-border-strong-color, rgba(17, 24, 39, .18));background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .02));color:var(--bb-muted-color, rgba(17, 24, 39, .6))}._boxItemFilled_227w4_573{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_227w4_579{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:var(--bb-tier-bg, rgba(37, 99, 235, .08));color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_227w4_587{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_227w4_595{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_227w4_602{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_227w4_609{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:var(--bb-surface-subtle-bg, rgba(17, 24, 39, .04));color:var(--bb-text-color, #111827);font-weight:800}._ctaButtonGroup_227w4_620{display:flex;gap:8px;width:100%;transition:gap .3s cubic-bezier(.4,0,.2,1)}._ctaButtonGroupAnimating_227w4_627{gap:0}._cta_227w4_620{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer}._ctaSecondary_227w4_643{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer}._ctaDualLeft_227w4_655{width:100%;border:2px solid var(--bb-cta-bg, #2563eb);background:transparent;color:var(--bb-cta-bg, #2563eb);font:inherit;font-weight:700;padding:10px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),background .3s cubic-bezier(.4,0,.2,1),color .3s cubic-bezier(.4,0,.2,1),border-right-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualLeftAnimating_227w4_673{border-top-right-radius:0;border-bottom-right-radius:0;border-right-width:0;background:var(--bb-cta-bg, #2563eb);opacity:.6;color:var(--bb-cta-text, #ffffff)}._ctaDualLeftAnimating_227w4_673>span{opacity:0}._ctaDualRight_227w4_686{width:100%;border:1px solid var(--bb-cta-border, rgba(0, 0, 0, .12));background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff);font:inherit;font-weight:700;padding:12px 14px;border-radius:12px;cursor:pointer;transition:border-radius .3s cubic-bezier(.4,0,.2,1),border-left-width .3s cubic-bezier(.4,0,.2,1),opacity .3s cubic-bezier(.4,0,.2,1)}._ctaDualRightAnimating_227w4_702{border-top-left-radius:0;border-bottom-left-radius:0;border-left-width:0;opacity:.6}._ctaDualRightAnimating_227w4_702>span{opacity:0}._ctaTotals_227w4_713{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_227w4_721{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800;background:linear-gradient(180deg,#2563eb24,#2563eb0f);border:1px solid rgba(37,99,235,.3);color:#1d4ed8f2;white-space:nowrap}._ctaTotalsWrap_227w4_735{overflow:hidden;max-height:0;opacity:0;transform:translateY(4px);margin-bottom:0;transition:max-height .22s ease,opacity .16s ease,transform .22s ease,margin-bottom .22s ease}._ctaTotalsWrapVisible_227w4_748{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_227w4_755{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_227w4_762{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_227w4_735{transition:none}}._cta_227w4_620:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_227w4_620:disabled{opacity:.6;cursor:not-allowed}._cta_227w4_620:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaSecondary_227w4_643:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaSecondary_227w4_643:disabled{opacity:.6;cursor:not-allowed}._ctaSecondary_227w4_643:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualLeft_227w4_655:hover{background:var(--bb-cta-bg, #2563eb);color:var(--bb-cta-text, #ffffff)}._ctaDualLeft_227w4_655:disabled{opacity:.6;cursor:not-allowed}._ctaDualLeft_227w4_655:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._ctaDualRight_227w4_686:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._ctaDualRight_227w4_686:disabled{opacity:.6;cursor:not-allowed}._ctaDualRight_227w4_686:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_227w4_831{margin-top:8px;font-size:12px;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));text-align:center}@media(max-width:767px){._backdrop_227w4_1{padding:0;justify-content:stretch}._panel_227w4_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
- import { jsx as h, jsxs as M, Fragment as _e } from "react/jsx-runtime";
3
- import Lt, { useState as N, useRef as z, useEffect as E, useCallback as ut, useMemo as B, createContext as ge, useContext as ve, forwardRef as fe, createElement as Qt } from "react";
4
- const Rt = {
2
+ import { jsx as f, jsxs as P, Fragment as yt } from "react/jsx-runtime";
3
+ import Le, { useState as k, useRef as V, useEffect as q, useCallback as ce, useMemo as T, createContext as gt, useContext as vt, forwardRef as ft, createElement as Qe } from "react";
4
+ const Fe = {
5
5
  bundleId: "_bundle_id",
6
6
  bundleConfig: "_bundle_config",
7
7
  bundleSource: "_bundle_source",
8
8
  bundleTitle: "_bundle_title"
9
9
  };
10
- async function xe(i) {
11
- const t = new URL("/api/public/bundle-config", i.apiBaseUrl);
12
- t.searchParams.set("shop", i.shop);
13
- const o = await (await fetch(t, {
10
+ async function xt(o) {
11
+ const e = new URL("/api/public/bundle-config", o.apiBaseUrl);
12
+ e.searchParams.set("shop", o.shop);
13
+ const i = await (await fetch(e, {
14
14
  method: "GET",
15
- signal: i.signal,
15
+ signal: o.signal,
16
16
  headers: { "Content-Type": "application/json" }
17
17
  })).json().catch(() => null);
18
- return !o || typeof o != "object" ? { ok: !1, error: "Invalid response." } : o;
18
+ return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
19
19
  }
20
- const ae = "bb_anonymous_user_id";
21
- function Ft() {
20
+ const at = "bb_anonymous_user_id";
21
+ function De() {
22
22
  if (typeof window > "u" || typeof localStorage > "u")
23
23
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
24
24
  try {
25
- const i = localStorage.getItem(ae);
26
- if (i && typeof i == "string" && i.length > 0)
27
- return i;
28
- let t;
25
+ const o = localStorage.getItem(at);
26
+ if (o && typeof o == "string" && o.length > 0)
27
+ return o;
28
+ let e;
29
29
  try {
30
- const e = globalThis.crypto;
31
- if (e != null && e.randomUUID)
32
- t = e.randomUUID();
30
+ const t = globalThis.crypto;
31
+ if (t != null && t.randomUUID)
32
+ e = t.randomUUID();
33
33
  else
34
34
  throw new Error("crypto.randomUUID not available");
35
35
  } catch {
36
- t = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
36
+ e = `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
37
37
  }
38
- return localStorage.setItem(ae, t), t;
38
+ return localStorage.setItem(at, e), e;
39
39
  } catch {
40
40
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
41
41
  }
42
42
  }
43
- async function Dt(i, t, e) {
43
+ async function xe(o, e, t) {
44
44
  if (!(typeof window > "u"))
45
45
  try {
46
- const o = new URL(i, window.location.origin);
47
- o.searchParams.set("shop", t);
48
- const r = await fetch(o, {
46
+ const i = new URL(o, window.location.origin);
47
+ i.searchParams.set("shop", e);
48
+ const r = await fetch(i, {
49
49
  method: "POST",
50
50
  headers: {
51
51
  "Content-Type": "application/json"
52
52
  },
53
- body: JSON.stringify(e),
53
+ body: JSON.stringify(t),
54
54
  // Don't wait for response - fire and forget
55
55
  keepalive: !0
56
56
  });
@@ -58,11 +58,11 @@ async function Dt(i, t, e) {
58
58
  `[Bundle Analytics] Event tracking failed with status ${r.status}:`,
59
59
  await r.text().catch(() => "Unable to read response")
60
60
  );
61
- } catch (o) {
62
- console.warn("[Bundle Analytics] Failed to track event:", o);
61
+ } catch (i) {
62
+ console.warn("[Bundle Analytics] Failed to track event:", i);
63
63
  }
64
64
  }
65
- const me = ge(null), Ce = {
65
+ const mt = gt(null), Ct = {
66
66
  primaryColor: "--bb-cta-bg",
67
67
  primaryHoverColor: "--bb-cta-bg-hover",
68
68
  primaryTextColor: "--bb-cta-text",
@@ -83,490 +83,501 @@ const me = ge(null), Ce = {
83
83
  celebrationBgBottom: "--bb-celebration-bg-bottom",
84
84
  celebrationBorderColor: "--bb-celebration-border"
85
85
  };
86
- function se(i) {
87
- if (!i) return;
88
- const t = document.documentElement;
89
- Object.entries(Ce).forEach(([e, o]) => {
90
- const r = i[e];
91
- r && t.style.setProperty(o, r);
86
+ function st(o) {
87
+ if (!o) return;
88
+ const e = document.documentElement;
89
+ Object.entries(Ct).forEach(([t, i]) => {
90
+ const r = o[t];
91
+ r && e.style.setProperty(i, r);
92
92
  });
93
93
  }
94
- function ce(i) {
95
- if (typeof window > "u") return i;
96
- const t = window.__BUNDLE_PREVIEW_STYLES__;
97
- return t && typeof t == "object" ? t : i;
94
+ function ct(o) {
95
+ if (typeof window > "u") return o;
96
+ const e = window.__BUNDLE_PREVIEW_STYLES__;
97
+ return e && typeof e == "object" ? e : o;
98
98
  }
99
- function Ie() {
99
+ function It() {
100
100
  try {
101
- const i = globalThis.crypto;
102
- if (i != null && i.randomUUID) return i.randomUUID();
101
+ const o = globalThis.crypto;
102
+ if (o != null && o.randomUUID) return o.randomUUID();
103
103
  } catch {
104
104
  }
105
105
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
106
106
  }
107
- function le(i) {
108
- return Number.isFinite(i) ? Math.max(0, Math.floor(i)) : 0;
107
+ function lt(o) {
108
+ return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
109
109
  }
110
- function lr(i) {
110
+ function lr(o) {
111
111
  const {
112
- apiBaseUrl: t,
113
- shop: e,
114
- cartAdapter: o,
112
+ apiBaseUrl: e,
113
+ shop: t,
114
+ cartAdapter: i,
115
115
  configHandle: r = "default",
116
116
  initialData: n,
117
117
  configFetcher: l,
118
118
  analyticsEndpoint: s,
119
119
  children: p
120
- } = i, v = s ?? `${t}/api/public/bundle-analytics`, [O, P] = N(!1), [C, Z] = N(!n), [L, Y] = N(!1), [q, T] = N(null), [R, j] = N((n == null ? void 0 : n.currencyCode) ?? null), [y, ht] = N((n == null ? void 0 : n.config) ?? null), [it, _t] = N(
120
+ } = o, v = s ?? `${e}/api/public/bundle-analytics`, [A, R] = k(!1), [C, te] = k(!n), [U, X] = k(!1), [z, N] = k(null), [F, Q] = k((n == null ? void 0 : n.currencyCode) ?? null), [_, ue] = k((n == null ? void 0 : n.config) ?? null), [ie, we] = k(
121
121
  (n == null ? void 0 : n.eligibleVariants) ?? []
122
- ), [ft, kt] = N(
122
+ ), [de, ke] = k(
123
123
  () => ({ selections: {}, order: [] })
124
- ), Mt = z(null);
125
- E(() => {
126
- var $;
124
+ ), Me = V(null);
125
+ q(() => {
126
+ var W;
127
127
  if (n) return;
128
- ($ = Mt.current) == null || $.abort();
129
- const f = new AbortController();
130
- Mt.current = f;
131
- const x = l ?? xe;
132
- return Z(!0), T(null), x({ apiBaseUrl: t, shop: e, signal: f.signal }).then((_) => {
133
- if (!_.ok) {
134
- T(_.error || "Failed to load bundle config."), ht(null), _t([]), j(null);
128
+ (W = Me.current) == null || W.abort();
129
+ const h = new AbortController();
130
+ Me.current = h;
131
+ const x = l ?? xt;
132
+ return te(!0), N(null), x({ apiBaseUrl: e, shop: t, signal: h.signal }).then((y) => {
133
+ if (!y.ok) {
134
+ N(y.error || "Failed to load bundle config."), ue(null), we([]), Q(null);
135
135
  return;
136
136
  }
137
- j(_.currencyCode ?? null), ht(_.config), _t(_.eligibleVariants ?? []);
138
- }).catch((_) => {
139
- const H = _ instanceof Error ? _.message : "Failed to load bundle config.";
140
- T(H), ht(null), _t([]), j(null);
141
- }).finally(() => Z(!1)), () => f.abort();
142
- }, [t, e, n, l]), E(() => {
143
- const f = ce(y == null ? void 0 : y.styleSettings);
144
- f && se(f);
145
- }, [y == null ? void 0 : y.styleSettings]), E(() => {
137
+ Q(y.currencyCode ?? null), ue(y.config), we(y.eligibleVariants ?? []);
138
+ }).catch((y) => {
139
+ const J = y instanceof Error ? y.message : "Failed to load bundle config.";
140
+ N(J), ue(null), we([]), Q(null);
141
+ }).finally(() => te(!1)), () => h.abort();
142
+ }, [e, t, n, l]), q(() => {
143
+ const h = ct(_ == null ? void 0 : _.styleSettings);
144
+ h && st(h);
145
+ }, [_ == null ? void 0 : _.styleSettings]), q(() => {
146
146
  if (typeof window > "u") return;
147
- const f = () => {
148
- const x = ce(void 0);
149
- x && se(x);
147
+ const h = () => {
148
+ const x = ct(void 0);
149
+ x && st(x);
150
150
  };
151
- return window.addEventListener("bundle-preview-styles-updated", f), () => window.removeEventListener("bundle-preview-styles-updated", f);
151
+ return window.addEventListener("bundle-preview-styles-updated", h), () => window.removeEventListener("bundle-preview-styles-updated", h);
152
152
  }, []);
153
- const Ot = ut(() => {
154
- if (P(!0), v)
153
+ const Oe = ce(() => {
154
+ if (R(!0), v)
155
155
  try {
156
- const f = Ft();
157
- Dt(v, e, {
156
+ const h = De();
157
+ xe(v, t, {
158
158
  eventType: "DRAWER_OPENED",
159
- shop: e,
160
- anonymousUserId: f,
161
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
159
+ shop: t,
160
+ anonymousUserId: h,
161
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
162
+ mixpanelEvent: "bundle_opened"
162
163
  }).catch((x) => {
163
164
  console.warn("[Bundle Analytics] Failed to track drawer opened:", x);
164
165
  });
165
- } catch (f) {
166
- console.warn("[Bundle Analytics] Error in open() callback:", f);
166
+ } catch (h) {
167
+ console.warn("[Bundle Analytics] Error in open() callback:", h);
167
168
  }
168
- }, [v, e]), mt = ut(() => P(!1), []), Pt = ut(() => {
169
- P((f) => {
170
- if (!f && v)
169
+ }, [v, t]), he = ce(() => R(!1), []), Pe = ce(() => {
170
+ R((h) => {
171
+ if (!h && v)
171
172
  try {
172
- const x = Ft();
173
- Dt(v, e, {
173
+ const x = De();
174
+ xe(v, t, {
174
175
  eventType: "DRAWER_OPENED",
175
- shop: e,
176
+ shop: t,
176
177
  anonymousUserId: x,
177
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
178
- }).catch(($) => {
179
- console.warn("[Bundle Analytics] Failed to track drawer opened:", $);
178
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
179
+ mixpanelEvent: "bundle_opened"
180
+ }).catch((W) => {
181
+ console.warn("[Bundle Analytics] Failed to track drawer opened:", W);
180
182
  });
181
183
  } catch (x) {
182
184
  console.warn("[Bundle Analytics] Error in toggle() callback:", x);
183
185
  }
184
- return !f;
186
+ return !h;
185
187
  });
186
- }, [v, e]), At = B(() => {
187
- const f = Number((y == null ? void 0 : y.maxBundleSize) ?? NaN), x = Number.isFinite(f) ? Math.floor(f) : 100;
188
+ }, [v, t]), Ae = T(() => {
189
+ const h = Number((_ == null ? void 0 : _.maxBundleSize) ?? NaN), x = Number.isFinite(h) ? Math.floor(h) : 100;
188
190
  return Math.max(2, Math.min(100, x));
189
- }, [y == null ? void 0 : y.maxBundleSize]), pt = B(() => new Set(it.map((f) => f.id)), [it]), J = ut((f, x) => {
190
- if (!pt.has(f))
191
+ }, [_ == null ? void 0 : _.maxBundleSize]), fe = T(() => new Set(ie.map((h) => h.id)), [ie]), $ = T(() => {
192
+ const h = (_ == null ? void 0 : _.rules) ?? [], x = h.length ? Math.min(...h.map((W) => W.minBundleSize)) : 2;
193
+ return Number.isFinite(x) && x > 0 ? x : 2;
194
+ }, [_]), Ce = ce((h, x) => {
195
+ if (!fe.has(h))
191
196
  return;
192
- const $ = le(x);
193
- kt((_) => {
194
- const H = _.selections[f] ?? 0, U = $ - H, It = Object.values(_.selections).reduce((Q, V) => Q + (V || 0), 0), k = U > 0 ? Math.min(U, Math.max(0, At - It)) : U, F = H + k;
197
+ const W = lt(x);
198
+ ke((y) => {
199
+ const J = y.selections[h] ?? 0, j = W - J, ye = Object.values(y.selections).reduce((L, O) => L + (O || 0), 0), M = j > 0 ? Math.min(j, Math.max(0, Ae - ye)) : j, E = J + M;
195
200
  let D;
196
- if (F <= 0) {
197
- const { [f]: Q, ...V } = _.selections;
198
- D = V;
199
- } else H === F ? D = _.selections : D = { ..._.selections, [f]: F };
200
- let ct = _.order;
201
- if (k > 0)
202
- ct = [..._.order, ...Array.from({ length: k }, () => f)];
203
- else if (k < 0) {
204
- let Q = -k;
205
- const V = [];
206
- for (let nt = _.order.length - 1; nt >= 0; nt--) {
207
- const wt = _.order[nt];
208
- if (wt === f && Q > 0) {
209
- Q--;
201
+ if (E <= 0) {
202
+ const { [h]: L, ...O } = y.selections;
203
+ D = O;
204
+ } else J === E ? D = y.selections : D = { ...y.selections, [h]: E };
205
+ let ae = y.order;
206
+ if (M > 0)
207
+ ae = [...y.order, ...Array.from({ length: M }, () => h)];
208
+ else if (M < 0) {
209
+ let L = -M;
210
+ const O = [];
211
+ for (let S = y.order.length - 1; S >= 0; S--) {
212
+ const m = y.order[S];
213
+ if (m === h && L > 0) {
214
+ L--;
210
215
  continue;
211
216
  }
212
- V.push(wt);
217
+ O.push(m);
213
218
  }
214
- V.reverse(), ct = V;
219
+ O.reverse(), ae = O;
215
220
  }
216
- if (D === _.selections && ct === _.order) return _;
221
+ if (D === y.selections && ae === y.order) return y;
222
+ const ge = ye, pe = Object.values(D).reduce((L, O) => L + (O || 0), 0);
217
223
  if (v)
218
224
  try {
219
- const Q = Ft();
220
- Dt(v, e, {
225
+ const L = De(), O = {
221
226
  eventType: "VARIANT_SELECTION_CHANGED",
222
- shop: e,
223
- anonymousUserId: Q,
224
- before: { ..._.selections },
227
+ shop: t,
228
+ anonymousUserId: L,
229
+ before: { ...y.selections },
225
230
  after: { ...D },
226
231
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
232
+ };
233
+ xe(v, t, O), ge === 0 && pe >= 1 && xe(v, t, {
234
+ ...O,
235
+ mixpanelEvent: "bundle_started"
236
+ }), ge < $ && pe >= $ && xe(v, t, {
237
+ ...O,
238
+ mixpanelEvent: "bundle_completed"
227
239
  });
228
240
  } catch {
229
241
  }
230
- return { selections: D, order: ct };
242
+ return { selections: D, order: ae };
231
243
  });
232
- }, [At, pt, v, e]), bt = ut(() => kt({ selections: {}, order: [] }), []), K = ft.selections, xt = ft.order, at = B(() => Object.values(K).reduce((f, x) => f + (x || 0), 0), [K]), tt = B(() => {
233
- const f = (y == null ? void 0 : y.rules) ?? [], x = f.length ? Math.min(...f.map(($) => $.minBundleSize)) : 2;
234
- return Number.isFinite(x) && x > 0 ? x : 2;
235
- }, [y]), gt = B(() => !(C || L || q || !(y != null && y.isActive) || at < tt), [at, y == null ? void 0 : y.isActive, q, C, tt, L]), st = ut(async (f) => {
236
- var wt, A;
237
- if (!gt || !y) return;
238
- const x = Ie(), $ = (y.title ?? "").trim().slice(0, 255), _ = Object.entries(K).map(([m, rt]) => ({ merchandiseId: m, quantity: le(rt) })).filter((m) => m.quantity > 0).filter((m) => pt.has(m.merchandiseId)).map((m) => ({
244
+ }, [Ae, $, fe, v, t]), me = ce(() => ke({ selections: {}, order: [] }), []), Z = de.selections, Re = de.order, H = T(() => Object.values(Z).reduce((h, x) => h + (x || 0), 0), [Z]), _e = T(() => !(C || U || z || !(_ != null && _.isActive) || H < $), [H, _ == null ? void 0 : _.isActive, z, C, $, U]), oe = ce(async (h) => {
245
+ var O, S;
246
+ if (!_e || !_) return;
247
+ const x = It(), W = (_.title ?? "").trim().slice(0, 255), y = Object.entries(Z).map(([m, Y]) => ({ merchandiseId: m, quantity: lt(Y) })).filter((m) => m.quantity > 0).filter((m) => fe.has(m.merchandiseId)).map((m) => ({
239
248
  merchandiseId: m.merchandiseId,
240
249
  quantity: m.quantity,
241
250
  attributes: [
242
- { key: Rt.bundleId, value: x },
243
- { key: Rt.bundleConfig, value: r },
244
- { key: Rt.bundleSource, value: "bundle_builder" },
245
- ...$ ? [{ key: Rt.bundleTitle, value: $ }] : []
251
+ { key: Fe.bundleId, value: x },
252
+ { key: Fe.bundleConfig, value: r },
253
+ { key: Fe.bundleSource, value: "bundle_builder" },
254
+ ...W ? [{ key: Fe.bundleTitle, value: W }] : []
246
255
  ]
247
256
  }));
248
- if (!_.length) return;
249
- const H = new Map(it.map((m) => [m.id, m]));
250
- let U = 0;
251
- for (const [m, rt] of Object.entries(K)) {
252
- const lt = rt ?? 0;
253
- if (lt <= 0) continue;
254
- const St = H.get(m), vt = Number(St == null ? void 0 : St.price);
255
- Number.isFinite(vt) && (U += vt * lt);
257
+ if (!y.length) return;
258
+ const J = new Map(ie.map((m) => [m.id, m]));
259
+ let j = 0;
260
+ for (const [m, Y] of Object.entries(Z)) {
261
+ const se = Y ?? 0;
262
+ if (se <= 0) continue;
263
+ const Se = J.get(m), ve = Number(Se == null ? void 0 : Se.price);
264
+ Number.isFinite(ve) && (j += ve * se);
256
265
  }
257
- U = Math.round(U * 100) / 100;
258
- const It = [...y.rules ?? []].sort((m, rt) => m.minBundleSize - rt.minBundleSize);
259
- let k = null;
260
- for (const m of It)
261
- at >= m.minBundleSize && (k = m);
262
- const F = k ? (() => {
263
- const m = Number.parseFloat(k.discountPercent);
266
+ j = Math.round(j * 100) / 100;
267
+ const ye = [..._.rules ?? []].sort((m, Y) => m.minBundleSize - Y.minBundleSize);
268
+ let M = null;
269
+ for (const m of ye)
270
+ H >= m.minBundleSize && (M = m);
271
+ const E = M ? (() => {
272
+ const m = Number.parseFloat(M.discountPercent);
264
273
  return Number.isFinite(m) && m > 0 ? m : null;
265
- })() : null, D = F ? Math.round(U * (1 - F / 100) * 100) / 100 : U, ct = U - D, Q = _.map((m) => m.merchandiseId), V = (k == null ? void 0 : k.handle) ?? "", nt = ((wt = k == null ? void 0 : k.label) == null ? void 0 : wt.trim()) || "";
266
- Y(!0);
274
+ })() : null, D = E ? Math.round(j * (1 - E / 100) * 100) / 100 : j, ae = j - D, ge = y.map((m) => m.merchandiseId), pe = (M == null ? void 0 : M.handle) ?? "", L = ((O = M == null ? void 0 : M.label) == null ? void 0 : O.trim()) || "";
275
+ X(!0);
267
276
  try {
268
- if (f != null && f.checkout ? await o.linesAddForCheckout(_) : await o.linesAdd(_), v)
277
+ if (h != null && h.checkout ? await i.linesAddForCheckout(y) : await i.linesAdd(y), v)
269
278
  try {
270
- const m = Ft();
271
- Dt(v, e, {
279
+ const m = De(), Y = !!(h != null && h.checkout);
280
+ xe(v, t, {
272
281
  eventType: "BUNDLE_ADDED_TO_BASKET",
273
- shop: e,
282
+ shop: t,
274
283
  anonymousUserId: m,
275
284
  bundleId: x,
276
- productVariantIds: Q,
277
- grossPrice: U,
285
+ productVariantIds: ge,
286
+ grossPrice: j,
278
287
  discountedPrice: D,
279
- currency: R ?? void 0,
280
- discountThresholdIdentifier: V,
281
- discountLabel: nt,
282
- discountPercentage: F,
283
- discountedAmount: ct,
284
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
288
+ currency: F ?? void 0,
289
+ discountThresholdIdentifier: pe,
290
+ discountLabel: L,
291
+ discountPercentage: E,
292
+ discountedAmount: ae,
293
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
294
+ checkout: Y,
295
+ mixpanelEvent: Y ? "checkout_started_with_bundle" : "bundle_added_to_cart"
285
296
  });
286
297
  } catch {
287
298
  }
288
- bt(), mt(), (A = f == null ? void 0 : f.onComplete) == null || A.call(f);
299
+ me(), he(), (S = h == null ? void 0 : h.onComplete) == null || S.call(h);
289
300
  } finally {
290
- Y(!1);
301
+ X(!1);
291
302
  }
292
303
  }, [
293
- gt,
294
- o,
295
- bt,
296
- mt,
297
- y,
304
+ _e,
305
+ i,
306
+ me,
307
+ he,
308
+ _,
298
309
  r,
299
- R,
300
- K,
301
- pt,
302
- it,
303
- at,
310
+ F,
311
+ Z,
312
+ fe,
313
+ ie,
314
+ H,
304
315
  v,
305
- e
306
- ]), Ct = ut(async () => {
307
- await st(
316
+ t
317
+ ]), Ie = ce(async () => {
318
+ await oe(
308
319
  {
309
320
  onComplete: () => {
310
- var f;
311
- (f = o.openCartUI) == null || f.call(o);
321
+ var h;
322
+ (h = i.openCartUI) == null || h.call(i);
312
323
  }
313
324
  }
314
325
  );
315
- }, [st, o]), et = ut(async () => {
316
- await st(
326
+ }, [oe, i]), ne = ce(async () => {
327
+ await oe(
317
328
  {
318
329
  checkout: !0,
319
330
  onComplete: () => {
320
- var f;
321
- (f = o.navigateToCheckout) == null || f.call(o);
331
+ var h;
332
+ (h = i.navigateToCheckout) == null || h.call(i);
322
333
  }
323
334
  }
324
335
  );
325
- }, [st, o]), qt = B(
336
+ }, [oe, i]), qe = T(
326
337
  () => ({
327
- isOpen: O,
328
- open: Ot,
329
- close: mt,
330
- toggle: Pt,
338
+ isOpen: A,
339
+ open: Oe,
340
+ close: he,
341
+ toggle: Pe,
331
342
  loading: C,
332
- submitting: L,
333
- error: q,
334
- currencyCode: R,
335
- config: y,
336
- eligibleVariants: it,
337
- selections: K,
338
- selectionOrder: xt,
339
- setQuantity: J,
340
- clearSelections: bt,
341
- bundleSize: at,
342
- minRequired: tt,
343
- canSubmit: gt,
344
- submit: Ct,
345
- submitAndCheckout: et
343
+ submitting: U,
344
+ error: z,
345
+ currencyCode: F,
346
+ config: _,
347
+ eligibleVariants: ie,
348
+ selections: Z,
349
+ selectionOrder: Re,
350
+ setQuantity: Ce,
351
+ clearSelections: me,
352
+ bundleSize: H,
353
+ minRequired: $,
354
+ canSubmit: _e,
355
+ submit: Ie,
356
+ submitAndCheckout: ne
346
357
  }),
347
358
  [
348
- O,
349
- Ot,
350
- mt,
351
- Pt,
359
+ A,
360
+ Oe,
361
+ he,
362
+ Pe,
352
363
  C,
353
- L,
354
- q,
355
- R,
356
- y,
357
- it,
358
- K,
359
- xt,
360
- J,
361
- bt,
362
- at,
363
- tt,
364
- gt,
365
- Ct,
366
- et
364
+ U,
365
+ z,
366
+ F,
367
+ _,
368
+ ie,
369
+ Z,
370
+ Re,
371
+ Ce,
372
+ me,
373
+ H,
374
+ $,
375
+ _e,
376
+ Ie,
377
+ ne
367
378
  ]
368
379
  );
369
- return /* @__PURE__ */ h(me.Provider, { value: qt, children: p });
380
+ return /* @__PURE__ */ f(mt.Provider, { value: qe, children: p });
370
381
  }
371
- function Yt() {
372
- const i = ve(me);
373
- if (!i)
382
+ function Ye() {
383
+ const o = vt(mt);
384
+ if (!o)
374
385
  throw new Error("useBundleBuilder must be used within <BundleProvider />");
375
- return i;
386
+ return o;
376
387
  }
377
388
  function ur() {
378
- const { isOpen: i, open: t, close: e, toggle: o } = Yt();
379
- return { isOpen: i, open: t, close: e, toggle: o };
389
+ const { isOpen: o, open: e, close: t, toggle: i } = Ye();
390
+ return { isOpen: o, open: e, close: t, toggle: i };
380
391
  }
381
- const Se = "_button_18rtl_1", Be = {
382
- button: Se
392
+ const St = "_button_18rtl_1", Bt = {
393
+ button: St
383
394
  };
384
- function dr(i) {
385
- const { toggle: t } = Yt();
386
- return /* @__PURE__ */ h(
395
+ function dr(o) {
396
+ const { toggle: e } = Ye();
397
+ return /* @__PURE__ */ f(
387
398
  "button",
388
399
  {
389
400
  type: "button",
390
- onClick: t,
391
- className: [Be.button, i.className].filter(Boolean).join(" "),
392
- children: i.children ?? "Build a bundle"
401
+ onClick: e,
402
+ className: [Bt.button, o.className].filter(Boolean).join(" "),
403
+ children: o.children ?? "Build a bundle"
393
404
  }
394
405
  );
395
406
  }
396
- var jt, ue;
397
- function Te() {
398
- if (ue) return jt;
399
- ue = 1;
400
- var i = {
401
- linear: function(t, e, o, r) {
402
- var n = o - e;
403
- return n * t / r + e;
407
+ var je, ut;
408
+ function Tt() {
409
+ if (ut) return je;
410
+ ut = 1;
411
+ var o = {
412
+ linear: function(e, t, i, r) {
413
+ var n = i - t;
414
+ return n * e / r + t;
404
415
  },
405
- easeInQuad: function(t, e, o, r) {
406
- var n = o - e;
407
- return n * (t /= r) * t + e;
416
+ easeInQuad: function(e, t, i, r) {
417
+ var n = i - t;
418
+ return n * (e /= r) * e + t;
408
419
  },
409
- easeOutQuad: function(t, e, o, r) {
410
- var n = o - e;
411
- return -n * (t /= r) * (t - 2) + e;
420
+ easeOutQuad: function(e, t, i, r) {
421
+ var n = i - t;
422
+ return -n * (e /= r) * (e - 2) + t;
412
423
  },
413
- easeInOutQuad: function(t, e, o, r) {
414
- var n = o - e;
415
- return (t /= r / 2) < 1 ? n / 2 * t * t + e : -n / 2 * (--t * (t - 2) - 1) + e;
424
+ easeInOutQuad: function(e, t, i, r) {
425
+ var n = i - t;
426
+ return (e /= r / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t;
416
427
  },
417
- easeInCubic: function(t, e, o, r) {
418
- var n = o - e;
419
- return n * (t /= r) * t * t + e;
428
+ easeInCubic: function(e, t, i, r) {
429
+ var n = i - t;
430
+ return n * (e /= r) * e * e + t;
420
431
  },
421
- easeOutCubic: function(t, e, o, r) {
422
- var n = o - e;
423
- return n * ((t = t / r - 1) * t * t + 1) + e;
432
+ easeOutCubic: function(e, t, i, r) {
433
+ var n = i - t;
434
+ return n * ((e = e / r - 1) * e * e + 1) + t;
424
435
  },
425
- easeInOutCubic: function(t, e, o, r) {
426
- var n = o - e;
427
- return (t /= r / 2) < 1 ? n / 2 * t * t * t + e : n / 2 * ((t -= 2) * t * t + 2) + e;
436
+ easeInOutCubic: function(e, t, i, r) {
437
+ var n = i - t;
438
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t;
428
439
  },
429
- easeInQuart: function(t, e, o, r) {
430
- var n = o - e;
431
- return n * (t /= r) * t * t * t + e;
440
+ easeInQuart: function(e, t, i, r) {
441
+ var n = i - t;
442
+ return n * (e /= r) * e * e * e + t;
432
443
  },
433
- easeOutQuart: function(t, e, o, r) {
434
- var n = o - e;
435
- return -n * ((t = t / r - 1) * t * t * t - 1) + e;
444
+ easeOutQuart: function(e, t, i, r) {
445
+ var n = i - t;
446
+ return -n * ((e = e / r - 1) * e * e * e - 1) + t;
436
447
  },
437
- easeInOutQuart: function(t, e, o, r) {
438
- var n = o - e;
439
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t + e : -n / 2 * ((t -= 2) * t * t * t - 2) + e;
448
+ easeInOutQuart: function(e, t, i, r) {
449
+ var n = i - t;
450
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t;
440
451
  },
441
- easeInQuint: function(t, e, o, r) {
442
- var n = o - e;
443
- return n * (t /= r) * t * t * t * t + e;
452
+ easeInQuint: function(e, t, i, r) {
453
+ var n = i - t;
454
+ return n * (e /= r) * e * e * e * e + t;
444
455
  },
445
- easeOutQuint: function(t, e, o, r) {
446
- var n = o - e;
447
- return n * ((t = t / r - 1) * t * t * t * t + 1) + e;
456
+ easeOutQuint: function(e, t, i, r) {
457
+ var n = i - t;
458
+ return n * ((e = e / r - 1) * e * e * e * e + 1) + t;
448
459
  },
449
- easeInOutQuint: function(t, e, o, r) {
450
- var n = o - e;
451
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t * t + e : n / 2 * ((t -= 2) * t * t * t * t + 2) + e;
460
+ easeInOutQuint: function(e, t, i, r) {
461
+ var n = i - t;
462
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t;
452
463
  },
453
- easeInSine: function(t, e, o, r) {
454
- var n = o - e;
455
- return -n * Math.cos(t / r * (Math.PI / 2)) + n + e;
464
+ easeInSine: function(e, t, i, r) {
465
+ var n = i - t;
466
+ return -n * Math.cos(e / r * (Math.PI / 2)) + n + t;
456
467
  },
457
- easeOutSine: function(t, e, o, r) {
458
- var n = o - e;
459
- return n * Math.sin(t / r * (Math.PI / 2)) + e;
468
+ easeOutSine: function(e, t, i, r) {
469
+ var n = i - t;
470
+ return n * Math.sin(e / r * (Math.PI / 2)) + t;
460
471
  },
461
- easeInOutSine: function(t, e, o, r) {
462
- var n = o - e;
463
- return -n / 2 * (Math.cos(Math.PI * t / r) - 1) + e;
472
+ easeInOutSine: function(e, t, i, r) {
473
+ var n = i - t;
474
+ return -n / 2 * (Math.cos(Math.PI * e / r) - 1) + t;
464
475
  },
465
- easeInExpo: function(t, e, o, r) {
466
- var n = o - e;
467
- return t == 0 ? e : n * Math.pow(2, 10 * (t / r - 1)) + e;
476
+ easeInExpo: function(e, t, i, r) {
477
+ var n = i - t;
478
+ return e == 0 ? t : n * Math.pow(2, 10 * (e / r - 1)) + t;
468
479
  },
469
- easeOutExpo: function(t, e, o, r) {
470
- var n = o - e;
471
- return t == r ? e + n : n * (-Math.pow(2, -10 * t / r) + 1) + e;
480
+ easeOutExpo: function(e, t, i, r) {
481
+ var n = i - t;
482
+ return e == r ? t + n : n * (-Math.pow(2, -10 * e / r) + 1) + t;
472
483
  },
473
- easeInOutExpo: function(t, e, o, r) {
474
- var n = o - e;
475
- return t === 0 ? e : t === r ? e + n : (t /= r / 2) < 1 ? n / 2 * Math.pow(2, 10 * (t - 1)) + e : n / 2 * (-Math.pow(2, -10 * --t) + 2) + e;
484
+ easeInOutExpo: function(e, t, i, r) {
485
+ var n = i - t;
486
+ return e === 0 ? t : e === r ? t + n : (e /= r / 2) < 1 ? n / 2 * Math.pow(2, 10 * (e - 1)) + t : n / 2 * (-Math.pow(2, -10 * --e) + 2) + t;
476
487
  },
477
- easeInCirc: function(t, e, o, r) {
478
- var n = o - e;
479
- return -n * (Math.sqrt(1 - (t /= r) * t) - 1) + e;
488
+ easeInCirc: function(e, t, i, r) {
489
+ var n = i - t;
490
+ return -n * (Math.sqrt(1 - (e /= r) * e) - 1) + t;
480
491
  },
481
- easeOutCirc: function(t, e, o, r) {
482
- var n = o - e;
483
- return n * Math.sqrt(1 - (t = t / r - 1) * t) + e;
492
+ easeOutCirc: function(e, t, i, r) {
493
+ var n = i - t;
494
+ return n * Math.sqrt(1 - (e = e / r - 1) * e) + t;
484
495
  },
485
- easeInOutCirc: function(t, e, o, r) {
486
- var n = o - e;
487
- return (t /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + e : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e;
496
+ easeInOutCirc: function(e, t, i, r) {
497
+ var n = i - t;
498
+ return (e /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
488
499
  },
489
- easeInElastic: function(t, e, o, r) {
490
- var n = o - e, l, s, p;
491
- return p = 1.70158, s = 0, l = n, t === 0 ? e : (t /= r) === 1 ? e + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - p) * (2 * Math.PI) / s)) + e);
500
+ easeInElastic: function(e, t, i, r) {
501
+ var n = i - t, l, s, p;
502
+ return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s)) + t);
492
503
  },
493
- easeOutElastic: function(t, e, o, r) {
494
- var n = o - e, l, s, p;
495
- return p = 1.70158, s = 0, l = n, t === 0 ? e : (t /= r) === 1 ? e + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * t) * Math.sin((t * r - p) * (2 * Math.PI) / s) + n + e);
504
+ easeOutElastic: function(e, t, i, r) {
505
+ var n = i - t, l, s, p;
506
+ return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (s || (s = r * 0.3), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * e) * Math.sin((e * r - p) * (2 * Math.PI) / s) + n + t);
496
507
  },
497
- easeInOutElastic: function(t, e, o, r) {
498
- var n = o - e, l, s, p;
499
- return p = 1.70158, s = 0, l = n, t === 0 ? e : (t /= r / 2) === 2 ? e + n : (s || (s = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), t < 1 ? -0.5 * (l * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - p) * (2 * Math.PI) / s)) + e : l * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * r - p) * (2 * Math.PI) / s) * 0.5 + n + e);
508
+ easeInOutElastic: function(e, t, i, r) {
509
+ var n = i - t, l, s, p;
510
+ return p = 1.70158, s = 0, l = n, e === 0 ? t : (e /= r / 2) === 2 ? t + n : (s || (s = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, p = s / 4) : p = s / (2 * Math.PI) * Math.asin(n / l), e < 1 ? -0.5 * (l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s)) + t : l * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - p) * (2 * Math.PI) / s) * 0.5 + n + t);
500
511
  },
501
- easeInBack: function(t, e, o, r, n) {
502
- var l = o - e;
503
- return n === void 0 && (n = 1.70158), l * (t /= r) * t * ((n + 1) * t - n) + e;
512
+ easeInBack: function(e, t, i, r, n) {
513
+ var l = i - t;
514
+ return n === void 0 && (n = 1.70158), l * (e /= r) * e * ((n + 1) * e - n) + t;
504
515
  },
505
- easeOutBack: function(t, e, o, r, n) {
506
- var l = o - e;
507
- return n === void 0 && (n = 1.70158), l * ((t = t / r - 1) * t * ((n + 1) * t + n) + 1) + e;
516
+ easeOutBack: function(e, t, i, r, n) {
517
+ var l = i - t;
518
+ return n === void 0 && (n = 1.70158), l * ((e = e / r - 1) * e * ((n + 1) * e + n) + 1) + t;
508
519
  },
509
- easeInOutBack: function(t, e, o, r, n) {
510
- var l = o - e;
511
- return n === void 0 && (n = 1.70158), (t /= r / 2) < 1 ? l / 2 * (t * t * (((n *= 1.525) + 1) * t - n)) + e : l / 2 * ((t -= 2) * t * (((n *= 1.525) + 1) * t + n) + 2) + e;
520
+ easeInOutBack: function(e, t, i, r, n) {
521
+ var l = i - t;
522
+ return n === void 0 && (n = 1.70158), (e /= r / 2) < 1 ? l / 2 * (e * e * (((n *= 1.525) + 1) * e - n)) + t : l / 2 * ((e -= 2) * e * (((n *= 1.525) + 1) * e + n) + 2) + t;
512
523
  },
513
- easeInBounce: function(t, e, o, r) {
514
- var n = o - e, l;
515
- return l = i.easeOutBounce(r - t, 0, n, r), n - l + e;
524
+ easeInBounce: function(e, t, i, r) {
525
+ var n = i - t, l;
526
+ return l = o.easeOutBounce(r - e, 0, n, r), n - l + t;
516
527
  },
517
- easeOutBounce: function(t, e, o, r) {
518
- var n = o - e;
519
- return (t /= r) < 1 / 2.75 ? n * (7.5625 * t * t) + e : t < 2 / 2.75 ? n * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + e : t < 2.5 / 2.75 ? n * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + e : n * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + e;
528
+ easeOutBounce: function(e, t, i, r) {
529
+ var n = i - t;
530
+ return (e /= r) < 1 / 2.75 ? n * (7.5625 * e * e) + t : e < 2 / 2.75 ? n * (7.5625 * (e -= 1.5 / 2.75) * e + 0.75) + t : e < 2.5 / 2.75 ? n * (7.5625 * (e -= 2.25 / 2.75) * e + 0.9375) + t : n * (7.5625 * (e -= 2.625 / 2.75) * e + 0.984375) + t;
520
531
  },
521
- easeInOutBounce: function(t, e, o, r) {
522
- var n = o - e, l;
523
- return t < r / 2 ? (l = i.easeInBounce(t * 2, 0, n, r), l * 0.5 + e) : (l = i.easeOutBounce(t * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + e);
532
+ easeInOutBounce: function(e, t, i, r) {
533
+ var n = i - t, l;
534
+ return e < r / 2 ? (l = o.easeInBounce(e * 2, 0, n, r), l * 0.5 + t) : (l = o.easeOutBounce(e * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + t);
524
535
  }
525
536
  };
526
- return jt = i, jt;
537
+ return je = o, je;
527
538
  }
528
- var Ne = Te();
529
- function ke(i) {
530
- return i * Math.PI / 180;
539
+ var Nt = Tt();
540
+ function kt(o) {
541
+ return o * Math.PI / 180;
531
542
  }
532
- function W(i, t) {
533
- return i + Math.random() * (t - i);
543
+ function G(o, e) {
544
+ return o + Math.random() * (e - o);
534
545
  }
535
- function Me(i, t) {
536
- return Math.floor(i + Math.random() * (t - i + 1));
546
+ function Mt(o, e) {
547
+ return Math.floor(o + Math.random() * (e - o + 1));
537
548
  }
538
- var Nt;
539
- (function(i) {
540
- i[i.Circle = 0] = "Circle", i[i.Square = 1] = "Square", i[i.Strip = 2] = "Strip";
541
- })(Nt || (Nt = {}));
542
- var dt;
543
- (function(i) {
544
- i[i.Positive = 1] = "Positive", i[i.Negative = -1] = "Negative";
545
- })(dt || (dt = {}));
546
- const Oe = 1e3 / 60;
547
- class Pe {
548
- constructor(t, e, o, r) {
549
- this.getOptions = e;
549
+ var Ne;
550
+ (function(o) {
551
+ o[o.Circle = 0] = "Circle", o[o.Square = 1] = "Square", o[o.Strip = 2] = "Strip";
552
+ })(Ne || (Ne = {}));
553
+ var le;
554
+ (function(o) {
555
+ o[o.Positive = 1] = "Positive", o[o.Negative = -1] = "Negative";
556
+ })(le || (le = {}));
557
+ const Ot = 1e3 / 60;
558
+ class Pt {
559
+ constructor(e, t, i, r) {
560
+ this.getOptions = t;
550
561
  const { colors: n, initialVelocityX: l, initialVelocityY: s } = this.getOptions();
551
- this.context = t, this.x = o, this.y = r, this.w = W(5, 20), this.h = W(5, 20), this.radius = W(5, 10), this.vx = typeof l == "number" ? W(-l, l) : W(l.min, l.max), this.vy = typeof s == "number" ? W(-s, 0) : W(s.min, s.max), this.shape = Me(0, 2), this.angle = ke(W(0, 360)), this.angularSpin = W(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = W(0, 1), this.rotationDirection = W(0, 1) ? dt.Positive : dt.Negative;
562
+ this.context = e, this.x = i, this.y = r, this.w = G(5, 20), this.h = G(5, 20), this.radius = G(5, 10), this.vx = typeof l == "number" ? G(-l, l) : G(l.min, l.max), this.vy = typeof s == "number" ? G(-s, 0) : G(s.min, s.max), this.shape = Mt(0, 2), this.angle = kt(G(0, 360)), this.angularSpin = G(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = G(0, 1), this.rotationDirection = G(0, 1) ? le.Positive : le.Negative;
552
563
  }
553
- update(t) {
554
- const { gravity: e, wind: o, friction: r, opacity: n, drawShape: l } = this.getOptions(), s = t / Oe;
555
- this.x += this.vx * s, this.y += this.vy * s, this.vy += e * s, this.vx += o * s, this.vx *= r ** s, this.vy *= r ** s, this.rotateY >= 1 && this.rotationDirection === dt.Positive ? this.rotationDirection = dt.Negative : this.rotateY <= -1 && this.rotationDirection === dt.Negative && (this.rotationDirection = dt.Positive);
564
+ update(e) {
565
+ const { gravity: t, wind: i, friction: r, opacity: n, drawShape: l } = this.getOptions(), s = e / Ot;
566
+ this.x += this.vx * s, this.y += this.vy * s, this.vy += t * s, this.vx += i * s, this.vx *= r ** s, this.vy *= r ** s, this.rotateY >= 1 && this.rotationDirection === le.Positive ? this.rotationDirection = le.Negative : this.rotateY <= -1 && this.rotationDirection === le.Negative && (this.rotationDirection = le.Positive);
556
567
  const p = 0.1 * this.rotationDirection * s;
557
568
  if (this.rotateY += p, this.angle += this.angularSpin, this.context.save(), this.context.translate(this.x, this.y), this.context.rotate(this.angle), this.context.scale(1, this.rotateY), this.context.rotate(this.angle), this.context.beginPath(), this.context.fillStyle = this.color, this.context.strokeStyle = this.color, this.context.globalAlpha = n, this.context.lineCap = "round", this.context.lineWidth = 2, l && typeof l == "function")
558
569
  l.call(this, this.context);
559
570
  else
560
571
  switch (this.shape) {
561
- case Nt.Circle: {
572
+ case Ne.Circle: {
562
573
  this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
563
574
  break;
564
575
  }
565
- case Nt.Square: {
576
+ case Ne.Square: {
566
577
  this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
567
578
  break;
568
579
  }
569
- case Nt.Strip: {
580
+ case Ne.Strip: {
570
581
  this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
571
582
  break;
572
583
  }
@@ -574,39 +585,39 @@ class Pe {
574
585
  this.context.closePath(), this.context.restore();
575
586
  }
576
587
  }
577
- class Ae {
578
- constructor(t, e) {
588
+ class At {
589
+ constructor(e, t) {
579
590
  this.x = 0, this.y = 0, this.w = 0, this.h = 0, this.lastNumberOfPieces = 0, this.tweenProgress = 0, this.tweenFrom = 0, this.particles = [], this.particlesGenerated = 0, this.removeParticleAt = (r) => {
580
591
  this.particles.splice(r, 1);
581
592
  }, this.getParticle = () => {
582
- const r = W(this.x, this.w + this.x), n = W(this.y, this.h + this.y);
583
- return new Pe(this.context, this.getOptions, r, n);
593
+ const r = G(this.x, this.w + this.x), n = G(this.y, this.h + this.y);
594
+ return new Pt(this.context, this.getOptions, r, n);
584
595
  }, this.animate = (r) => {
585
- const { canvas: n, context: l, particlesGenerated: s, lastNumberOfPieces: p } = this, { run: v, recycle: O, numberOfPieces: P, debug: C, tweenFunction: Z, tweenDuration: L } = this.getOptions();
596
+ const { canvas: n, context: l, particlesGenerated: s, lastNumberOfPieces: p } = this, { run: v, recycle: A, numberOfPieces: R, debug: C, tweenFunction: te, tweenDuration: U } = this.getOptions();
586
597
  if (!v)
587
598
  return !1;
588
- const Y = this.particles.length, q = O ? Y : s;
589
- if (q < P) {
590
- p !== P && (this.tweenProgress = 0, this.tweenFrom = q, this.lastNumberOfPieces = P), this.tweenProgress = Math.min(L, Math.max(0, this.tweenProgress + r));
591
- const T = Z(this.tweenProgress, this.tweenFrom, P, L), R = Math.round(T - q);
592
- for (let j = 0; j < R; j++)
599
+ const X = this.particles.length, z = A ? X : s;
600
+ if (z < R) {
601
+ p !== R && (this.tweenProgress = 0, this.tweenFrom = z, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(U, Math.max(0, this.tweenProgress + r));
602
+ const N = te(this.tweenProgress, this.tweenFrom, R, U), F = Math.round(N - z);
603
+ for (let Q = 0; Q < F; Q++)
593
604
  this.particles.push(this.getParticle());
594
- this.particlesGenerated += R;
605
+ this.particlesGenerated += F;
595
606
  }
596
- C && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${Y}`, n.width - 10, n.height - 20));
597
- for (let T = this.particles.length - 1; T >= 0; T--) {
598
- const R = this.particles[T];
599
- R.update(r), (R.y > n.height || R.y < -100 || R.x > n.width + 100 || R.x < -100) && (O && q <= P ? this.particles[T] = this.getParticle() : this.removeParticleAt(T));
607
+ C && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${X}`, n.width - 10, n.height - 20));
608
+ for (let N = this.particles.length - 1; N >= 0; N--) {
609
+ const F = this.particles[N];
610
+ F.update(r), (F.y > n.height || F.y < -100 || F.x > n.width + 100 || F.x < -100) && (A && z <= R ? this.particles[N] = this.getParticle() : this.removeParticleAt(N));
600
611
  }
601
- return Y > 0 || q < P;
602
- }, this.canvas = t;
603
- const o = this.canvas.getContext("2d");
604
- if (!o)
612
+ return X > 0 || z < R;
613
+ }, this.canvas = e;
614
+ const i = this.canvas.getContext("2d");
615
+ if (!i)
605
616
  throw new Error("Could not get canvas context");
606
- this.context = o, this.getOptions = e;
617
+ this.context = i, this.getOptions = t;
607
618
  }
608
619
  }
609
- const Kt = {
620
+ const Ke = {
610
621
  width: typeof window < "u" ? window.innerWidth : 300,
611
622
  height: typeof window < "u" ? window.innerHeight : 200,
612
623
  numberOfPieces: 200,
@@ -636,13 +647,13 @@ const Kt = {
636
647
  ],
637
648
  opacity: 1,
638
649
  debug: !1,
639
- tweenFunction: Ne.easeInOutQuad,
650
+ tweenFunction: Nt.easeInOutQuad,
640
651
  tweenDuration: 5e3,
641
652
  recycle: !0,
642
653
  run: !0
643
654
  };
644
- class Re {
645
- constructor(t, e) {
655
+ class Rt {
656
+ constructor(e, t) {
646
657
  this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
647
658
  const n = {
648
659
  confettiSource: {
@@ -654,55 +665,55 @@ class Re {
654
665
  };
655
666
  this._options = {
656
667
  ...n,
657
- ...Kt,
668
+ ...Ke,
658
669
  ...r
659
670
  }, Object.assign(this, r.confettiSource);
660
671
  }, this.update = (r = 0) => {
661
- const { options: { run: n, onConfettiComplete: l, frameRate: s }, canvas: p, context: v } = this, O = Math.min(r - this.lastFrameTime, 50);
662
- if (s && O < 1e3 / s) {
672
+ const { options: { run: n, onConfettiComplete: l, frameRate: s }, canvas: p, context: v } = this, A = Math.min(r - this.lastFrameTime, 50);
673
+ if (s && A < 1e3 / s) {
663
674
  this.rafId = requestAnimationFrame(this.update);
664
675
  return;
665
676
  }
666
- this.lastFrameTime = r - (s ? O % s : 0), n && (v.fillStyle = "white", v.clearRect(0, 0, p.width, p.height)), this.generator.animate(O) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
677
+ this.lastFrameTime = r - (s ? A % s : 0), n && (v.fillStyle = "white", v.clearRect(0, 0, p.width, p.height)), this.generator.animate(A) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
667
678
  }, this.reset = () => {
668
679
  this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
669
680
  }, this.stop = () => {
670
681
  this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
671
- }, this.canvas = t;
672
- const o = this.canvas.getContext("2d");
673
- if (!o)
682
+ }, this.canvas = e;
683
+ const i = this.canvas.getContext("2d");
684
+ if (!i)
674
685
  throw new Error("Could not get canvas context");
675
- this.context = o, this.generator = new Ae(this.canvas, () => this.options), this.options = e, this.update();
686
+ this.context = i, this.generator = new At(this.canvas, () => this.options), this.options = t, this.update();
676
687
  }
677
688
  get options() {
678
689
  return this._options;
679
690
  }
680
- set options(t) {
691
+ set options(e) {
681
692
  var r, n;
682
- const e = (r = this._options) == null ? void 0 : r.run, o = (n = this._options) == null ? void 0 : n.recycle;
683
- this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && o === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
693
+ const t = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
694
+ this.setOptionsWithDefaults(e), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof e.recycle == "boolean" && e.recycle && i === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof e.run == "boolean" && e.run && t === !1 && this.update();
684
695
  }
685
696
  }
686
- const Fe = Lt.createRef();
687
- class Ht extends Lt.Component {
688
- constructor(t) {
689
- super(t), this.canvas = Lt.createRef(), this.canvas = t.canvasRef || Fe;
697
+ const Ft = Le.createRef();
698
+ class He extends Le.Component {
699
+ constructor(e) {
700
+ super(e), this.canvas = Le.createRef(), this.canvas = e.canvasRef || Ft;
690
701
  }
691
702
  componentDidMount() {
692
703
  if (this.canvas.current) {
693
- const t = Vt(this.props)[0];
694
- this.confetti = new Re(this.canvas.current, t);
704
+ const e = Ve(this.props)[0];
705
+ this.confetti = new Rt(this.canvas.current, e);
695
706
  }
696
707
  }
697
708
  componentDidUpdate() {
698
- const t = Vt(this.props)[0];
699
- this.confetti && (this.confetti.options = t);
709
+ const e = Ve(this.props)[0];
710
+ this.confetti && (this.confetti.options = e);
700
711
  }
701
712
  componentWillUnmount() {
702
713
  this.confetti && this.confetti.stop(), this.confetti = void 0;
703
714
  }
704
715
  render() {
705
- const [t, e] = Vt(this.props), o = {
716
+ const [e, t] = Ve(this.props), i = {
706
717
  zIndex: 2,
707
718
  position: "absolute",
708
719
  pointerEvents: "none",
@@ -710,45 +721,45 @@ class Ht extends Lt.Component {
710
721
  left: 0,
711
722
  bottom: 0,
712
723
  right: 0,
713
- ...e.style
724
+ ...t.style
714
725
  };
715
- return h("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: o });
726
+ return f("canvas", { width: e.width, height: e.height, ref: this.canvas, ...t, style: i });
716
727
  }
717
728
  }
718
- Ht.defaultProps = {
719
- ...Kt
729
+ He.defaultProps = {
730
+ ...Ke
720
731
  };
721
- Ht.displayName = "ReactConfetti";
722
- function Vt(i) {
723
- const t = {}, e = {}, o = {}, r = [
724
- ...Object.keys(Kt),
732
+ He.displayName = "ReactConfetti";
733
+ function Ve(o) {
734
+ const e = {}, t = {}, i = {}, r = [
735
+ ...Object.keys(Ke),
725
736
  "confettiSource",
726
737
  "drawShape",
727
738
  "onConfettiComplete",
728
739
  "frameRate"
729
740
  ], n = ["canvasRef"];
730
- for (const l in i) {
731
- const s = i[l];
732
- r.includes(l) ? t[l] = s : n.includes(l) ? n[l] = s : o[l] = s;
741
+ for (const l in o) {
742
+ const s = o[l];
743
+ r.includes(l) ? e[l] = s : n.includes(l) ? n[l] = s : i[l] = s;
733
744
  }
734
- return [t, o, e];
745
+ return [e, i, t];
735
746
  }
736
- const De = Lt.forwardRef((i, t) => h(Ht, { canvasRef: t, ...i }));
747
+ const Dt = Le.forwardRef((o, e) => f(He, { canvasRef: e, ...o }));
737
748
  /**
738
749
  * @license lucide-react v0.515.0 - ISC
739
750
  *
740
751
  * This source code is licensed under the ISC license.
741
752
  * See the LICENSE file in the root directory of this source tree.
742
753
  */
743
- const Ee = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Le = (i) => i.replace(
754
+ const Et = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Lt = (o) => o.replace(
744
755
  /^([A-Z])|[\s-_]+(\w)/g,
745
- (t, e, o) => o ? o.toUpperCase() : e.toLowerCase()
746
- ), de = (i) => {
747
- const t = Le(i);
748
- return t.charAt(0).toUpperCase() + t.slice(1);
749
- }, pe = (...i) => i.filter((t, e, o) => !!t && t.trim() !== "" && o.indexOf(t) === e).join(" ").trim(), qe = (i) => {
750
- for (const t in i)
751
- if (t.startsWith("aria-") || t === "role" || t === "title")
756
+ (e, t, i) => i ? i.toUpperCase() : t.toLowerCase()
757
+ ), dt = (o) => {
758
+ const e = Lt(o);
759
+ return e.charAt(0).toUpperCase() + e.slice(1);
760
+ }, pt = (...o) => o.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim(), qt = (o) => {
761
+ for (const e in o)
762
+ if (e.startsWith("aria-") || e === "role" || e === "title")
752
763
  return !0;
753
764
  };
754
765
  /**
@@ -757,7 +768,7 @@ const Ee = (i) => i.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), Le = (
757
768
  * This source code is licensed under the ISC license.
758
769
  * See the LICENSE file in the root directory of this source tree.
759
770
  */
760
- var $e = {
771
+ var $t = {
761
772
  xmlns: "http://www.w3.org/2000/svg",
762
773
  width: 24,
763
774
  height: 24,
@@ -774,31 +785,31 @@ var $e = {
774
785
  * This source code is licensed under the ISC license.
775
786
  * See the LICENSE file in the root directory of this source tree.
776
787
  */
777
- const Ue = fe(
788
+ const Ut = ft(
778
789
  ({
779
- color: i = "currentColor",
780
- size: t = 24,
781
- strokeWidth: e = 2,
782
- absoluteStrokeWidth: o,
790
+ color: o = "currentColor",
791
+ size: e = 24,
792
+ strokeWidth: t = 2,
793
+ absoluteStrokeWidth: i,
783
794
  className: r = "",
784
795
  children: n,
785
796
  iconNode: l,
786
797
  ...s
787
- }, p) => Qt(
798
+ }, p) => Qe(
788
799
  "svg",
789
800
  {
790
801
  ref: p,
791
- ...$e,
792
- width: t,
793
- height: t,
794
- stroke: i,
795
- strokeWidth: o ? Number(e) * 24 / Number(t) : e,
796
- className: pe("lucide", r),
797
- ...!n && !qe(s) && { "aria-hidden": "true" },
802
+ ...$t,
803
+ width: e,
804
+ height: e,
805
+ stroke: o,
806
+ strokeWidth: i ? Number(t) * 24 / Number(e) : t,
807
+ className: pt("lucide", r),
808
+ ...!n && !qt(s) && { "aria-hidden": "true" },
798
809
  ...s
799
810
  },
800
811
  [
801
- ...l.map(([v, O]) => Qt(v, O)),
812
+ ...l.map(([v, A]) => Qe(v, A)),
802
813
  ...Array.isArray(n) ? n : [n]
803
814
  ]
804
815
  )
@@ -809,20 +820,20 @@ const Ue = fe(
809
820
  * This source code is licensed under the ISC license.
810
821
  * See the LICENSE file in the root directory of this source tree.
811
822
  */
812
- const ze = (i, t) => {
813
- const e = fe(
814
- ({ className: o, ...r }, n) => Qt(Ue, {
823
+ const zt = (o, e) => {
824
+ const t = ft(
825
+ ({ className: i, ...r }, n) => Qe(Ut, {
815
826
  ref: n,
816
- iconNode: t,
817
- className: pe(
818
- `lucide-${Ee(de(i))}`,
819
- `lucide-${i}`,
820
- o
827
+ iconNode: e,
828
+ className: pt(
829
+ `lucide-${Et(dt(o))}`,
830
+ `lucide-${o}`,
831
+ i
821
832
  ),
822
833
  ...r
823
834
  })
824
835
  );
825
- return e.displayName = de(i), e;
836
+ return t.displayName = dt(o), t;
826
837
  };
827
838
  /**
828
839
  * @license lucide-react v0.515.0 - ISC
@@ -830,21 +841,21 @@ const ze = (i, t) => {
830
841
  * This source code is licensed under the ISC license.
831
842
  * See the LICENSE file in the root directory of this source tree.
832
843
  */
833
- const We = [
844
+ const Wt = [
834
845
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
835
846
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
836
- ], je = ze("search", We), Ve = "_backdrop_227w4_1", Ge = "_celebrationOverlay_227w4_14", Qe = "_celebrationChip_227w4_23", Ye = "_backdropOpen_227w4_74", Ke = "_backdropClosed_227w4_78", He = "_panel_227w4_82", Xe = "_panelOpen_227w4_102", Ze = "_panelClosed_227w4_106", Je = "_header_227w4_145", tn = "_headerCenter_227w4_154", en = "_title_227w4_162", nn = "_searchIconButton_227w4_171", rn = "_headerTitleWrap_227w4_193", on = "_headerSearchWrap_227w4_197", an = "_headerSearchOpen_227w4_209", sn = "_searchBar_227w4_221", cn = "_searchInput_227w4_233", ln = "_searchClearButton_227w4_254", un = "_closeButton_227w4_276", dn = "_body_227w4_309", hn = "_muted_227w4_314", fn = "_error_227w4_319", mn = "_variants_227w4_324", pn = "_variantList_227w4_328", bn = "_variantRow_227w4_336", wn = "_variantLeft_227w4_344", yn = "_addToBundleButton_227w4_351", _n = "_variantThumb_227w4_379", gn = "_variantThumbImg_227w4_389", vn = "_variantThumbFallback_227w4_396", xn = "_variantInfo_227w4_406", Cn = "_variantName_227w4_410", In = "_variantMeta_227w4_419", Sn = "_variantPriceRow_227w4_427", Bn = "_variantCompareAt_227w4_434", Tn = "_variantPrice_227w4_427", Nn = "_qtyControls_227w4_445", kn = "_qtyButton_227w4_451", Mn = "_qtyValue_227w4_476", On = "_footer_227w4_483", Pn = "_poweredBy_227w4_490", An = "_boxSummaryWindow_227w4_502", Rn = "_boxSummaryRow_227w4_519", Fn = "_boxSlot_227w4_527", Dn = "_boxItem_227w4_535", En = "_boxItemClickable_227w4_547", Ln = "_boxThresholdLabel_227w4_556", qn = "_boxItemPlaceholder_227w4_567", $n = "_boxItemFilled_227w4_573", Un = "_boxItemThreshold_227w4_579", zn = "_boxItemDiscountText_227w4_587", Wn = "_boxItemPlus_227w4_595", jn = "_boxItemImage_227w4_602", Vn = "_boxItemFallback_227w4_609", Gn = "_ctaButtonGroup_227w4_620", Qn = "_ctaButtonGroupAnimating_227w4_627", Yn = "_cta_227w4_620", Kn = "_ctaDualLeft_227w4_655", Hn = "_ctaDualLeftAnimating_227w4_673", Xn = "_ctaDualRight_227w4_686", Zn = "_ctaDualRightAnimating_227w4_702", Jn = "_ctaTotals_227w4_713", tr = "_ctaDiscountBadge_227w4_721", er = "_ctaTotalsWrap_227w4_735", nr = "_ctaTotalsWrapVisible_227w4_748", rr = "_ctaTotalsStrike_227w4_755", or = "_ctaTotalsPrice_227w4_762", u = {
837
- backdrop: Ve,
838
- celebrationOverlay: Ge,
839
- celebrationChip: Qe,
840
- backdropOpen: Ye,
841
- backdropClosed: Ke,
842
- panel: He,
843
- panelOpen: Xe,
844
- panelClosed: Ze,
845
- header: Je,
846
- headerCenter: tn,
847
- title: en,
847
+ ], jt = zt("search", Wt), Vt = "_backdrop_227w4_1", Gt = "_celebrationOverlay_227w4_14", Qt = "_celebrationChip_227w4_23", Yt = "_backdropOpen_227w4_74", Kt = "_backdropClosed_227w4_78", Ht = "_panel_227w4_82", Xt = "_panelOpen_227w4_102", Zt = "_panelClosed_227w4_106", Jt = "_header_227w4_145", en = "_headerCenter_227w4_154", tn = "_title_227w4_162", nn = "_searchIconButton_227w4_171", rn = "_headerTitleWrap_227w4_193", on = "_headerSearchWrap_227w4_197", an = "_headerSearchOpen_227w4_209", sn = "_searchBar_227w4_221", cn = "_searchInput_227w4_233", ln = "_searchClearButton_227w4_254", un = "_closeButton_227w4_276", dn = "_body_227w4_309", hn = "_muted_227w4_314", fn = "_error_227w4_319", mn = "_variants_227w4_324", pn = "_variantList_227w4_328", bn = "_variantRow_227w4_336", wn = "_variantLeft_227w4_344", _n = "_addToBundleButton_227w4_351", yn = "_variantThumb_227w4_379", gn = "_variantThumbImg_227w4_389", vn = "_variantThumbFallback_227w4_396", xn = "_variantInfo_227w4_406", Cn = "_variantName_227w4_410", In = "_variantMeta_227w4_419", Sn = "_variantPriceRow_227w4_427", Bn = "_variantCompareAt_227w4_434", Tn = "_variantPrice_227w4_427", Nn = "_qtyControls_227w4_445", kn = "_qtyButton_227w4_451", Mn = "_qtyValue_227w4_476", On = "_footer_227w4_483", Pn = "_poweredBy_227w4_490", An = "_boxSummaryWindow_227w4_502", Rn = "_boxSummaryRow_227w4_519", Fn = "_boxSlot_227w4_527", Dn = "_boxItem_227w4_535", En = "_boxItemClickable_227w4_547", Ln = "_boxThresholdLabel_227w4_556", qn = "_boxItemPlaceholder_227w4_567", $n = "_boxItemFilled_227w4_573", Un = "_boxItemThreshold_227w4_579", zn = "_boxItemDiscountText_227w4_587", Wn = "_boxItemPlus_227w4_595", jn = "_boxItemImage_227w4_602", Vn = "_boxItemFallback_227w4_609", Gn = "_ctaButtonGroup_227w4_620", Qn = "_ctaButtonGroupAnimating_227w4_627", Yn = "_cta_227w4_620", Kn = "_ctaDualLeft_227w4_655", Hn = "_ctaDualLeftAnimating_227w4_673", Xn = "_ctaDualRight_227w4_686", Zn = "_ctaDualRightAnimating_227w4_702", Jn = "_ctaTotals_227w4_713", er = "_ctaDiscountBadge_227w4_721", tr = "_ctaTotalsWrap_227w4_735", nr = "_ctaTotalsWrapVisible_227w4_748", rr = "_ctaTotalsStrike_227w4_755", ir = "_ctaTotalsPrice_227w4_762", u = {
848
+ backdrop: Vt,
849
+ celebrationOverlay: Gt,
850
+ celebrationChip: Qt,
851
+ backdropOpen: Yt,
852
+ backdropClosed: Kt,
853
+ panel: Ht,
854
+ panelOpen: Xt,
855
+ panelClosed: Zt,
856
+ header: Jt,
857
+ headerCenter: en,
858
+ title: tn,
848
859
  searchIconButton: nn,
849
860
  headerTitleWrap: rn,
850
861
  headerSearchWrap: on,
@@ -860,8 +871,8 @@ const We = [
860
871
  variantList: pn,
861
872
  variantRow: bn,
862
873
  variantLeft: wn,
863
- addToBundleButton: yn,
864
- variantThumb: _n,
874
+ addToBundleButton: _n,
875
+ variantThumb: yn,
865
876
  variantThumbImg: gn,
866
877
  variantThumbFallback: vn,
867
878
  variantInfo: xn,
@@ -896,61 +907,61 @@ const We = [
896
907
  ctaDualRight: Xn,
897
908
  ctaDualRightAnimating: Zn,
898
909
  ctaTotals: Jn,
899
- ctaDiscountBadge: tr,
900
- ctaTotalsWrap: er,
910
+ ctaDiscountBadge: er,
911
+ ctaTotalsWrap: tr,
901
912
  ctaTotalsWrapVisible: nr,
902
913
  ctaTotalsStrike: rr,
903
- ctaTotalsPrice: or
914
+ ctaTotalsPrice: ir
904
915
  };
905
- function hr(i) {
906
- var oe, ie;
916
+ function hr(o) {
917
+ var it, ot;
907
918
  const {
908
- isOpen: t,
909
- close: e,
910
- loading: o,
919
+ isOpen: e,
920
+ close: t,
921
+ loading: i,
911
922
  submitting: r,
912
923
  error: n,
913
924
  currencyCode: l,
914
925
  config: s,
915
926
  eligibleVariants: p,
916
927
  selections: v,
917
- selectionOrder: O,
918
- setQuantity: P,
928
+ selectionOrder: A,
929
+ setQuantity: R,
919
930
  bundleSize: C,
920
- minRequired: Z,
921
- canSubmit: L,
922
- submit: Y,
923
- submitAndCheckout: q
924
- } = Yt(), [T, R] = N(!1), [j, y] = N(""), ht = z(null), it = z(null), _t = z(null), [ft, kt] = N(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Mt, Ot] = N(0), [mt, Pt] = N(null), [At, pt] = N(!1), J = z(null), bt = z(C), K = 7e3, [xt, at] = N(0), [tt, gt] = N(null), [st, Ct] = N(!1), et = z(null), qt = 2800, f = [
931
+ minRequired: te,
932
+ canSubmit: U,
933
+ submit: X,
934
+ submitAndCheckout: z
935
+ } = Ye(), [N, F] = k(!1), [Q, _] = k(""), ue = V(null), ie = V(null), we = V(null), [de, ke] = k(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [Me, Oe] = k(0), [he, Pe] = k(null), [Ae, fe] = k(!1), $ = V(null), Ce = V(C), me = 7e3, [Z, Re] = k(0), [H, _e] = k(null), [oe, Ie] = k(!1), ne = V(null), qe = 2800, h = [
925
936
  "#2563eb",
926
937
  "#3b82f6",
927
938
  "#60a5fa",
928
939
  "#93c5fd",
929
940
  "#bae6fd",
930
941
  "#e0f2fe"
931
- ], x = B(() => {
942
+ ], x = T(() => {
932
943
  var c;
933
944
  const a = (c = s == null ? void 0 : s.styleSettings) == null ? void 0 : c.confettiColors;
934
945
  return Array.isArray(a) && a.length >= 6 ? a.slice(0, 6).map(
935
- (d, b) => typeof d == "string" && d.trim() ? d : f[b]
936
- ) : [...f];
937
- }, [(oe = s == null ? void 0 : s.styleSettings) == null ? void 0 : oe.confettiColors]), $ = (a) => {
946
+ (d, b) => typeof d == "string" && d.trim() ? d : h[b]
947
+ ) : [...h];
948
+ }, [(it = s == null ? void 0 : s.styleSettings) == null ? void 0 : it.confettiColors]), W = (a) => {
938
949
  const c = Number.parseFloat(a);
939
950
  return Number.isFinite(c) ? String(Math.round(c)) : a;
940
- }, _ = (a) => {
951
+ }, y = (a) => {
941
952
  const c = (a ?? []).filter((d) => {
942
953
  var I, g;
943
954
  const b = (I = d == null ? void 0 : d.name) == null ? void 0 : I.trim(), w = (g = d == null ? void 0 : d.value) == null ? void 0 : g.trim();
944
955
  return !(!b || !w || b.toLowerCase() === "title");
945
956
  });
946
957
  return c.length ? c.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
947
- }, H = (a) => {
958
+ }, J = (a) => {
948
959
  var c;
949
960
  return ((c = a.product) == null ? void 0 : c.title) ?? a.displayName ?? a.title;
950
- }, U = (a) => {
951
- const c = H(a), d = _(a.selectedOptions);
961
+ }, j = (a) => {
962
+ const c = J(a), d = y(a.selectedOptions);
952
963
  return [c, d].filter(Boolean).join(" — ");
953
- }, [It, k] = N(t), F = z(null), D = (a) => {
964
+ }, [ye, M] = k(e), E = V(null), D = (a) => {
954
965
  const c = Number(a);
955
966
  if (!Number.isFinite(c)) return a;
956
967
  if (l)
@@ -959,37 +970,37 @@ function hr(i) {
959
970
  } catch {
960
971
  }
961
972
  return `$${c.toFixed(2)}`;
962
- }, ct = ((ie = s == null ? void 0 : s.title) == null ? void 0 : ie.trim()) || "Build your bundle", Q = B(() => {
973
+ }, ae = ((ot = s == null ? void 0 : s.title) == null ? void 0 : ot.trim()) || "Build your bundle", ge = T(() => {
963
974
  const a = Number((s == null ? void 0 : s.maxBundleSize) ?? NaN), c = Number.isFinite(a) ? Math.floor(a) : 100;
964
975
  return Math.max(2, Math.min(100, c));
965
- }, [s == null ? void 0 : s.maxBundleSize]), V = C >= Q, nt = B(() => [...p].sort((a, c) => a.displayName.localeCompare(c.displayName)), [p]), wt = B(() => {
966
- const a = j.trim().toLowerCase();
967
- if (!a) return nt;
976
+ }, [s == null ? void 0 : s.maxBundleSize]), pe = C >= ge, L = T(() => [...p].sort((a, c) => a.displayName.localeCompare(c.displayName)), [p]), O = T(() => {
977
+ const a = Q.trim().toLowerCase();
978
+ if (!a) return L;
968
979
  const c = a.split(/\s+/).filter(Boolean), d = (b) => {
969
980
  var g;
970
981
  const w = [];
971
982
  w.push(b.displayName), (g = b.product) != null && g.title && w.push(b.product.title);
972
- for (const S of b.selectedOptions ?? [])
973
- w.push(S.name), w.push(S.value);
983
+ for (const B of b.selectedOptions ?? [])
984
+ w.push(B.name), w.push(B.value);
974
985
  const I = w.join(" ").toLowerCase();
975
- return c.every((S) => I.includes(S));
986
+ return c.every((B) => I.includes(B));
976
987
  };
977
- return nt.filter(d);
978
- }, [j, nt]), A = B(() => [...(s == null ? void 0 : s.rules) ?? []].sort((a, c) => a.minBundleSize - c.minBundleSize), [s == null ? void 0 : s.rules]), m = B(() => Math.max(0, Z - C), [C, Z]), rt = B(() => {
988
+ return L.filter(d);
989
+ }, [Q, L]), S = T(() => [...(s == null ? void 0 : s.rules) ?? []].sort((a, c) => a.minBundleSize - c.minBundleSize), [s == null ? void 0 : s.rules]), m = T(() => Math.max(0, te - C), [C, te]), Y = T(() => {
979
990
  let a = null;
980
- for (const c of A)
991
+ for (const c of S)
981
992
  C >= c.minBundleSize && (a = c);
982
993
  return a;
983
- }, [C, A]), lt = B(() => {
984
- if (!rt) return null;
985
- const a = Number.parseFloat(rt.discountPercent);
994
+ }, [C, S]), se = T(() => {
995
+ if (!Y) return null;
996
+ const a = Number.parseFloat(Y.discountPercent);
986
997
  return !Number.isFinite(a) || a <= 0 ? null : a;
987
- }, [rt]), St = B(() => {
988
- const a = A[0];
998
+ }, [Y]), Se = T(() => {
999
+ const a = S[0];
989
1000
  if (!a) return null;
990
1001
  const c = Number.parseFloat(a.discountPercent);
991
1002
  return !Number.isFinite(c) || c <= 0 ? null : c;
992
- }, [A]), vt = lt ?? St, Bt = B(() => {
1003
+ }, [S]), ve = se ?? Se, Be = T(() => {
993
1004
  const a = new Map(p.map((d) => [d.id, d]));
994
1005
  let c = 0;
995
1006
  for (const [d, b] of Object.entries(v)) {
@@ -999,17 +1010,17 @@ function hr(i) {
999
1010
  Number.isFinite(g) && (c += g * w);
1000
1011
  }
1001
1012
  return Math.round(c * 100) / 100;
1002
- }, [p, v]), be = B(() => {
1003
- if (!lt) return Bt;
1004
- const a = Bt * (1 - lt / 100);
1013
+ }, [p, v]), bt = T(() => {
1014
+ if (!se) return Be;
1015
+ const a = Be * (1 - se / 100);
1005
1016
  return Math.round(a * 100) / 100;
1006
- }, [lt, Bt]), Xt = B(() => A.length ? Math.max(...A.map((a) => a.minBundleSize)) : 0, [A]), $t = B(() => {
1017
+ }, [se, Be]), Xe = T(() => S.length ? Math.max(...S.map((a) => a.minBundleSize)) : 0, [S]), $e = T(() => {
1007
1018
  const a = new Map(p.map((c) => [c.id, c]));
1008
- return O.map((c) => a.get(c)).filter((c) => !!c);
1009
- }, [p, O]), we = B(() => {
1019
+ return A.map((c) => a.get(c)).filter((c) => !!c);
1020
+ }, [p, A]), wt = T(() => {
1010
1021
  var c;
1011
1022
  const a = /* @__PURE__ */ new Map();
1012
- for (const d of A) {
1023
+ for (const d of S) {
1013
1024
  const b = Math.max(0, d.minBundleSize - 1);
1014
1025
  a.set(b, {
1015
1026
  discountPercent: d.discountPercent,
@@ -1018,114 +1029,114 @@ function hr(i) {
1018
1029
  });
1019
1030
  }
1020
1031
  return a;
1021
- }, [A]), ye = B(() => Math.max(Xt || Z, $t.length), [$t.length, Xt, Z]), [Ut, Zt] = N(!0), Jt = z(m);
1022
- E(() => {
1032
+ }, [S]), _t = T(() => Math.max(Xe || te, $e.length), [$e.length, Xe, te]), [Ue, Ze] = k(!0), Je = V(m);
1033
+ q(() => {
1023
1034
  if (((s == null ? void 0 : s.ctaButtonMode) || "add_to_cart") === "add_to_cart_checkout") {
1024
- const c = Jt.current > 0;
1025
- Zt(!(c && m === 0));
1035
+ const c = Je.current > 0;
1036
+ Ze(!(c && m === 0));
1026
1037
  }
1027
- Jt.current = m;
1038
+ Je.current = m;
1028
1039
  }, [m, s == null ? void 0 : s.ctaButtonMode]);
1029
- const zt = z(null), te = z(null), ee = z(null), ne = z(C), re = (a) => {
1030
- const c = te.current;
1040
+ const ze = V(null), et = V(null), tt = V(null), nt = V(C), rt = (a) => {
1041
+ const c = et.current;
1031
1042
  if (!c) return;
1032
1043
  const d = c.querySelector(`[data-variant-row="${a}"]`);
1033
1044
  if (!d) return;
1034
1045
  const b = c.getBoundingClientRect(), w = d.getBoundingClientRect(), I = 8;
1035
1046
  if (w.top >= b.top + I && w.bottom <= b.bottom - I) return;
1036
- const S = Math.max(0, c.scrollHeight - c.clientHeight), G = w.top - b.top + w.height / 2, X = c.scrollTop + G - c.clientHeight / 2, ot = Math.min(S, Math.max(0, X));
1037
- c.scrollTo({ top: ot, behavior: "smooth" });
1047
+ const B = Math.max(0, c.scrollHeight - c.clientHeight), K = w.top - b.top + w.height / 2, ee = c.scrollTop + K - c.clientHeight / 2, re = Math.min(B, Math.max(0, ee));
1048
+ c.scrollTo({ top: re, behavior: "smooth" });
1038
1049
  };
1039
- return E(() => {
1040
- if (!t) return;
1050
+ return q(() => {
1051
+ if (!e) return;
1041
1052
  const a = (c) => {
1042
- c.key === "Escape" && e();
1053
+ c.key === "Escape" && t();
1043
1054
  };
1044
1055
  return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
1045
- }, [e, t]), E(() => {
1056
+ }, [t, e]), q(() => {
1046
1057
  if (typeof window > "u") return;
1047
- const a = () => kt({ width: window.innerWidth, height: window.innerHeight });
1058
+ const a = () => ke({ width: window.innerWidth, height: window.innerHeight });
1048
1059
  return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
1049
- }, []), E(() => {
1050
- if (F.current != null && (window.clearTimeout(F.current), F.current = null), t) {
1051
- k(!0);
1060
+ }, []), q(() => {
1061
+ if (E.current != null && (window.clearTimeout(E.current), E.current = null), e) {
1062
+ M(!0);
1052
1063
  return;
1053
1064
  }
1054
- F.current = window.setTimeout(() => {
1055
- k(!1), F.current = null;
1065
+ E.current = window.setTimeout(() => {
1066
+ M(!1), E.current = null;
1056
1067
  }, 220);
1057
- }, [t]), E(() => () => {
1058
- F.current != null && window.clearTimeout(F.current);
1059
- }, []), E(() => () => {
1060
- J.current != null && window.clearTimeout(J.current);
1061
- }, []), E(() => () => {
1062
- et.current != null && window.clearTimeout(et.current);
1063
- }, []), E(() => {
1064
- if (!t || !T) return;
1068
+ }, [e]), q(() => () => {
1069
+ E.current != null && window.clearTimeout(E.current);
1070
+ }, []), q(() => () => {
1071
+ $.current != null && window.clearTimeout($.current);
1072
+ }, []), q(() => () => {
1073
+ ne.current != null && window.clearTimeout(ne.current);
1074
+ }, []), q(() => {
1075
+ if (!e || !N) return;
1065
1076
  const a = requestAnimationFrame(() => {
1066
1077
  var c;
1067
- return (c = ht.current) == null ? void 0 : c.focus();
1078
+ return (c = ue.current) == null ? void 0 : c.focus();
1068
1079
  });
1069
1080
  return () => cancelAnimationFrame(a);
1070
- }, [t, T]), E(() => {
1071
- const a = ne.current;
1072
- if (ne.current = C, C <= a) return;
1073
- const c = ee.current;
1081
+ }, [e, N]), q(() => {
1082
+ const a = nt.current;
1083
+ if (nt.current = C, C <= a) return;
1084
+ const c = tt.current;
1074
1085
  if (!c) return;
1075
- const d = A.some((g) => g.minBundleSize === C), b = A.find((g) => g.minBundleSize > C), w = b && d ? b.minBundleSize - 1 : b ? null : C - 1;
1086
+ const d = S.some((g) => g.minBundleSize === C), b = S.find((g) => g.minBundleSize > C), w = b && d ? b.minBundleSize - 1 : b ? null : C - 1;
1076
1087
  if (w == null || w < 0) return;
1077
1088
  const I = requestAnimationFrame(() => {
1078
1089
  const g = c.querySelector(`[data-box-slot="${w}"]`);
1079
1090
  if (!g) return;
1080
- const S = c.getBoundingClientRect(), X = g.getBoundingClientRect().right - S.right;
1081
- if (X <= 1) return;
1082
- const ot = Math.max(0, c.scrollWidth - c.clientWidth), yt = Math.min(ot, Math.max(0, c.scrollLeft + X));
1083
- c.scrollTo({ left: yt, behavior: "smooth" });
1091
+ const B = c.getBoundingClientRect(), ee = g.getBoundingClientRect().right - B.right;
1092
+ if (ee <= 1) return;
1093
+ const re = Math.max(0, c.scrollWidth - c.clientWidth), be = Math.min(re, Math.max(0, c.scrollLeft + ee));
1094
+ c.scrollTo({ left: be, behavior: "smooth" });
1084
1095
  });
1085
1096
  return () => cancelAnimationFrame(I);
1086
- }, [C, A]), E(() => {
1087
- if (!t) return;
1088
- const a = bt.current;
1089
- if (bt.current = C, C <= a) return;
1090
- const c = A.find((d) => d.minBundleSize === C);
1091
- c && (gt(`You received a ${$(c.discountPercent)}% discount!`), at((d) => d + 1), Ct(!0), et.current != null && window.clearTimeout(et.current), et.current = window.setTimeout(() => {
1092
- Ct(!1), et.current = null;
1093
- }, qt));
1094
- }, [C, t, A]), E(() => {
1095
- if (!t || !st || !tt) return;
1097
+ }, [C, S]), q(() => {
1098
+ if (!e) return;
1099
+ const a = Ce.current;
1100
+ if (Ce.current = C, C <= a) return;
1101
+ const c = S.find((d) => d.minBundleSize === C);
1102
+ c && (_e(`You received a ${W(c.discountPercent)}% discount!`), Re((d) => d + 1), Ie(!0), ne.current != null && window.clearTimeout(ne.current), ne.current = window.setTimeout(() => {
1103
+ Ie(!1), ne.current = null;
1104
+ }, qe));
1105
+ }, [C, e, S]), q(() => {
1106
+ if (!e || !oe || !H) return;
1096
1107
  const a = requestAnimationFrame(() => {
1097
- var S;
1098
- const c = _t.current, d = c == null ? void 0 : c.getBoundingClientRect(), b = (S = zt.current) == null ? void 0 : S.getBoundingClientRect(), w = d ? d.left + d.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, I = d ? d.top + d.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, g = {
1108
+ var B;
1109
+ const c = we.current, d = c == null ? void 0 : c.getBoundingClientRect(), b = (B = ze.current) == null ? void 0 : B.getBoundingClientRect(), w = d ? d.left + d.width / 2 : b ? b.left + b.width / 2 : window.innerWidth / 2, I = d ? d.top + d.height / 2 : b ? b.top + b.height / 2 : window.innerHeight / 2, g = {
1099
1110
  x: w - 2,
1100
1111
  y: I - 2,
1101
1112
  w: 4,
1102
1113
  h: 4
1103
1114
  };
1104
- Pt(g), Ot((G) => G + 1), pt(!0), J.current != null && window.clearTimeout(J.current), J.current = window.setTimeout(() => {
1105
- pt(!1), J.current = null;
1106
- }, K);
1115
+ Pe(g), Oe((K) => K + 1), fe(!0), $.current != null && window.clearTimeout($.current), $.current = window.setTimeout(() => {
1116
+ fe(!1), $.current = null;
1117
+ }, me);
1107
1118
  });
1108
1119
  return () => cancelAnimationFrame(a);
1109
- }, [xt, tt, K, st, t]), E(() => {
1120
+ }, [Z, H, me, oe, e]), q(() => {
1110
1121
  var a;
1111
- t && ((a = zt.current) == null || a.focus());
1112
- }, [t]), It ? /* @__PURE__ */ M(
1122
+ e && ((a = ze.current) == null || a.focus());
1123
+ }, [e]), ye ? /* @__PURE__ */ P(
1113
1124
  "div",
1114
1125
  {
1115
1126
  role: "dialog",
1116
1127
  "aria-modal": "true",
1117
1128
  "aria-label": "Bundle builder",
1118
- className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, i.className].filter(Boolean).join(" "),
1129
+ className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
1119
1130
  onMouseDown: (a) => {
1120
- a.target === a.currentTarget && e();
1131
+ a.target === a.currentTarget && t();
1121
1132
  },
1122
1133
  children: [
1123
- At && mt && ft.width > 0 && ft.height > 0 ? /* @__PURE__ */ h(
1124
- De,
1134
+ Ae && he && de.width > 0 && de.height > 0 ? /* @__PURE__ */ f(
1135
+ Dt,
1125
1136
  {
1126
- width: ft.width,
1127
- height: ft.height,
1128
- confettiSource: mt,
1137
+ width: de.width,
1138
+ height: de.height,
1139
+ confettiSource: he,
1129
1140
  colors: x,
1130
1141
  recycle: !1,
1131
1142
  numberOfPieces: 70,
@@ -1135,42 +1146,42 @@ function hr(i) {
1135
1146
  initialVelocityX: { min: -6, max: 6 },
1136
1147
  style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
1137
1148
  },
1138
- Mt
1149
+ Me
1139
1150
  ) : null,
1140
- /* @__PURE__ */ M("aside", { ref: zt, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
1141
- st && tt ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: _t, className: u.celebrationChip, children: tt }, xt) }) : null,
1142
- /* @__PURE__ */ M("header", { className: [u.header, T ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
1143
- /* @__PURE__ */ h(
1151
+ /* @__PURE__ */ P("aside", { ref: ze, className: [u.panel, e ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
1152
+ oe && H ? /* @__PURE__ */ f("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ f("div", { ref: we, className: u.celebrationChip, children: H }, Z) }) : null,
1153
+ /* @__PURE__ */ P("header", { className: [u.header, N ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
1154
+ /* @__PURE__ */ f(
1144
1155
  "button",
1145
1156
  {
1146
1157
  type: "button",
1147
1158
  className: u.searchIconButton,
1148
- "aria-label": T ? "Search (expanded)" : "Search",
1149
- "aria-expanded": T,
1159
+ "aria-label": N ? "Search (expanded)" : "Search",
1160
+ "aria-expanded": N,
1150
1161
  onClick: () => {
1151
- R(!0);
1162
+ F(!0);
1152
1163
  },
1153
- children: /* @__PURE__ */ h(je, { size: 18, "aria-hidden": "true" })
1164
+ children: /* @__PURE__ */ f(jt, { size: 18, "aria-hidden": "true" })
1154
1165
  }
1155
1166
  ),
1156
- /* @__PURE__ */ M("div", { className: u.headerCenter, children: [
1157
- /* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": T, children: /* @__PURE__ */ h("h2", { className: u.title, children: ct }) }),
1158
- /* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !T, children: /* @__PURE__ */ M("div", { className: u.searchBar, children: [
1159
- /* @__PURE__ */ h(
1167
+ /* @__PURE__ */ P("div", { className: u.headerCenter, children: [
1168
+ /* @__PURE__ */ f("div", { className: u.headerTitleWrap, "aria-hidden": N, children: /* @__PURE__ */ f("h2", { className: u.title, children: ae }) }),
1169
+ /* @__PURE__ */ f("div", { className: u.headerSearchWrap, "aria-hidden": !N, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
1170
+ /* @__PURE__ */ f(
1160
1171
  "input",
1161
1172
  {
1162
- ref: ht,
1173
+ ref: ue,
1163
1174
  className: u.searchInput,
1164
1175
  type: "search",
1165
- value: j,
1176
+ value: Q,
1166
1177
  placeholder: "Search",
1167
- onChange: (a) => y(a.target.value),
1178
+ onChange: (a) => _(a.target.value),
1168
1179
  onBlur: () => {
1169
- j.trim() === "" && R(!1);
1180
+ Q.trim() === "" && F(!1);
1170
1181
  }
1171
1182
  }
1172
1183
  ),
1173
- j.trim() ? /* @__PURE__ */ h(
1184
+ Q.trim() ? /* @__PURE__ */ f(
1174
1185
  "button",
1175
1186
  {
1176
1187
  type: "button",
@@ -1180,7 +1191,7 @@ function hr(i) {
1180
1191
  },
1181
1192
  onClick: () => {
1182
1193
  var a;
1183
- y(""), (a = ht.current) == null || a.focus();
1194
+ _(""), (a = ue.current) == null || a.focus();
1184
1195
  },
1185
1196
  "aria-label": "Clear search",
1186
1197
  children: "Clear"
@@ -1188,18 +1199,18 @@ function hr(i) {
1188
1199
  ) : null
1189
1200
  ] }) })
1190
1201
  ] }),
1191
- /* @__PURE__ */ h("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
1202
+ /* @__PURE__ */ f("button", { type: "button", onClick: t, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
1192
1203
  ] }),
1193
- /* @__PURE__ */ M("div", { className: u.body, ref: te, children: [
1194
- o ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
1195
- n ? /* @__PURE__ */ h("p", { className: u.error, children: n }) : null,
1196
- !o && s && !s.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
1197
- /* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children: wt.map((a) => {
1198
- var X, ot, yt, Tt;
1199
- const c = v[a.id] ?? 0, d = H(a), b = _(a.selectedOptions), w = U(a), I = vt, g = Number(a.price), S = I != null && Number.isFinite(I) && I > 0 && Number.isFinite(g), G = S ? Math.round(g * (1 - I / 100) * 100) / 100 : null;
1200
- return /* @__PURE__ */ M("li", { className: u.variantRow, "data-variant-row": a.id, children: [
1201
- /* @__PURE__ */ M("div", { className: u.variantLeft, children: [
1202
- /* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (X = a.image) != null && X.url ? /* @__PURE__ */ h(
1204
+ /* @__PURE__ */ P("div", { className: u.body, ref: et, children: [
1205
+ i ? /* @__PURE__ */ f("p", { className: u.muted, children: "Loading…" }) : null,
1206
+ n ? /* @__PURE__ */ f("p", { className: u.error, children: n }) : null,
1207
+ !i && s && !s.isActive ? /* @__PURE__ */ f("p", { className: u.error, children: "Bundles are not active." }) : null,
1208
+ /* @__PURE__ */ f("div", { className: u.variants, children: /* @__PURE__ */ f("ul", { className: u.variantList, children: O.map((a) => {
1209
+ var ee, re, be, Te;
1210
+ const c = v[a.id] ?? 0, d = J(a), b = y(a.selectedOptions), w = j(a), I = ve, g = Number(a.price), B = I != null && Number.isFinite(I) && I > 0 && Number.isFinite(g), K = B ? Math.round(g * (1 - I / 100) * 100) / 100 : null;
1211
+ return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": a.id, children: [
1212
+ /* @__PURE__ */ P("div", { className: u.variantLeft, children: [
1213
+ /* @__PURE__ */ f("div", { className: u.variantThumb, "aria-hidden": "true", children: (ee = a.image) != null && ee.url ? /* @__PURE__ */ f(
1203
1214
  "img",
1204
1215
  {
1205
1216
  className: u.variantThumbImg,
@@ -1207,47 +1218,47 @@ function hr(i) {
1207
1218
  alt: a.image.altText ?? w,
1208
1219
  loading: "lazy"
1209
1220
  }
1210
- ) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((Tt = (yt = (ot = a.product) == null ? void 0 : ot.title) == null ? void 0 : yt.slice(0, 1)) == null ? void 0 : Tt.toUpperCase()) ?? "•" }) }),
1211
- /* @__PURE__ */ M("div", { className: u.variantInfo, children: [
1212
- /* @__PURE__ */ h("div", { className: u.variantName, children: d }),
1213
- b ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: b }) : null,
1214
- /* @__PURE__ */ M("div", { className: u.variantPriceRow, children: [
1215
- S ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: D(Number.isFinite(g) ? g.toFixed(2) : a.price) }) : null,
1216
- /* @__PURE__ */ h("span", { className: u.variantPrice, children: D(
1217
- G != null ? G.toFixed(2) : Number.isFinite(g) ? g.toFixed(2) : a.price
1221
+ ) : /* @__PURE__ */ f("div", { className: u.variantThumbFallback, children: ((Te = (be = (re = a.product) == null ? void 0 : re.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) }),
1222
+ /* @__PURE__ */ P("div", { className: u.variantInfo, children: [
1223
+ /* @__PURE__ */ f("div", { className: u.variantName, children: d }),
1224
+ b ? /* @__PURE__ */ f("div", { className: u.variantMeta, children: b }) : null,
1225
+ /* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
1226
+ B ? /* @__PURE__ */ f("span", { className: u.variantCompareAt, children: D(Number.isFinite(g) ? g.toFixed(2) : a.price) }) : null,
1227
+ /* @__PURE__ */ f("span", { className: u.variantPrice, children: D(
1228
+ K != null ? K.toFixed(2) : Number.isFinite(g) ? g.toFixed(2) : a.price
1218
1229
  ) })
1219
1230
  ] })
1220
1231
  ] })
1221
1232
  ] }),
1222
- c <= 0 ? /* @__PURE__ */ h(
1233
+ c <= 0 ? /* @__PURE__ */ f(
1223
1234
  "button",
1224
1235
  {
1225
1236
  type: "button",
1226
- onClick: () => P(a.id, 1),
1227
- disabled: r || V,
1237
+ onClick: () => R(a.id, 1),
1238
+ disabled: r || pe,
1228
1239
  className: u.addToBundleButton,
1229
1240
  "aria-label": `Add ${w} to bundle`,
1230
1241
  children: "Add"
1231
1242
  }
1232
- ) : /* @__PURE__ */ M("div", { className: u.qtyControls, children: [
1233
- /* @__PURE__ */ h(
1243
+ ) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
1244
+ /* @__PURE__ */ f(
1234
1245
  "button",
1235
1246
  {
1236
1247
  type: "button",
1237
- onClick: () => P(a.id, c - 1),
1248
+ onClick: () => R(a.id, c - 1),
1238
1249
  disabled: r || c <= 0,
1239
1250
  className: u.qtyButton,
1240
1251
  "aria-label": `Decrease ${w}`,
1241
1252
  children: "−"
1242
1253
  }
1243
1254
  ),
1244
- /* @__PURE__ */ h("span", { className: u.qtyValue, "aria-label": `Quantity ${c}`, children: c }),
1245
- /* @__PURE__ */ h(
1255
+ /* @__PURE__ */ f("span", { className: u.qtyValue, "aria-label": `Quantity ${c}`, children: c }),
1256
+ /* @__PURE__ */ f(
1246
1257
  "button",
1247
1258
  {
1248
1259
  type: "button",
1249
- onClick: () => P(a.id, c + 1),
1250
- disabled: r || V,
1260
+ onClick: () => R(a.id, c + 1),
1261
+ disabled: r || pe,
1251
1262
  className: u.qtyButton,
1252
1263
  "aria-label": `Increase ${w}`,
1253
1264
  children: "+"
@@ -1257,12 +1268,12 @@ function hr(i) {
1257
1268
  ] }, a.id);
1258
1269
  }) }) })
1259
1270
  ] }),
1260
- /* @__PURE__ */ M("footer", { className: u.footer, ref: it, children: [
1261
- /* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: ee, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: ye }).map((a, c) => {
1262
- var X, ot, yt, Tt;
1263
- const d = $t[c], b = we.get(c), w = !!d, I = !!b, g = I && !w, S = b ? `${b.discountPercent}% off` : null, G = w ? d.displayName : `Slot ${c + 1}`;
1264
- return /* @__PURE__ */ M("div", { "data-box-slot": c, className: u.boxSlot, children: [
1265
- /* @__PURE__ */ h(
1271
+ /* @__PURE__ */ P("footer", { className: u.footer, ref: ie, children: [
1272
+ /* @__PURE__ */ f("div", { className: u.boxSummaryWindow, ref: tt, children: /* @__PURE__ */ f("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: _t }).map((a, c) => {
1273
+ var ee, re, be, Te;
1274
+ const d = $e[c], b = wt.get(c), w = !!d, I = !!b, g = I && !w, B = b ? `${b.discountPercent}% off` : null, K = w ? d.displayName : `Slot ${c + 1}`;
1275
+ return /* @__PURE__ */ P("div", { "data-box-slot": c, className: u.boxSlot, children: [
1276
+ /* @__PURE__ */ f(
1266
1277
  "div",
1267
1278
  {
1268
1279
  className: [
@@ -1273,13 +1284,13 @@ function hr(i) {
1273
1284
  ].filter(Boolean).join(" "),
1274
1285
  role: w ? "button" : void 0,
1275
1286
  tabIndex: w ? 0 : void 0,
1276
- onClick: w ? () => re(d.id) : void 0,
1277
- onKeyDown: w ? (Wt) => {
1278
- (Wt.key === "Enter" || Wt.key === " ") && (Wt.preventDefault(), re(d.id));
1287
+ onClick: w ? () => rt(d.id) : void 0,
1288
+ onKeyDown: w ? (We) => {
1289
+ (We.key === "Enter" || We.key === " ") && (We.preventDefault(), rt(d.id));
1279
1290
  } : void 0,
1280
- "aria-label": g && S ? `${G}. Unlocks ${S}.` : G,
1281
- title: g && S ? `${G} • Unlocks ${S}` : G,
1282
- children: w ? (X = d.image) != null && X.url ? /* @__PURE__ */ h(
1291
+ "aria-label": g && B ? `${K}. Unlocks ${B}.` : K,
1292
+ title: g && B ? `${K} • Unlocks ${B}` : K,
1293
+ children: w ? (ee = d.image) != null && ee.url ? /* @__PURE__ */ f(
1283
1294
  "img",
1284
1295
  {
1285
1296
  className: u.boxItemImage,
@@ -1287,58 +1298,58 @@ function hr(i) {
1287
1298
  alt: d.image.altText ?? d.displayName,
1288
1299
  loading: "lazy"
1289
1300
  }
1290
- ) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Tt = (yt = (ot = d.product) == null ? void 0 : ot.title) == null ? void 0 : yt.slice(0, 1)) == null ? void 0 : Tt.toUpperCase()) ?? "•" }) : g && S ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: S }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1301
+ ) : /* @__PURE__ */ f("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((Te = (be = (re = d.product) == null ? void 0 : re.title) == null ? void 0 : be.slice(0, 1)) == null ? void 0 : Te.toUpperCase()) ?? "•" }) : g && B ? /* @__PURE__ */ f("div", { className: u.boxItemDiscountText, children: B }) : /* @__PURE__ */ f("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1291
1302
  }
1292
1303
  ),
1293
- I ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: b.label }) : null
1304
+ I ? /* @__PURE__ */ f("div", { className: u.boxThresholdLabel, children: b.label }) : null
1294
1305
  ] }, c);
1295
1306
  }) }) }),
1296
- /* @__PURE__ */ h(
1307
+ /* @__PURE__ */ f(
1297
1308
  "div",
1298
1309
  {
1299
1310
  className: [u.ctaTotalsWrap, m <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1300
1311
  "aria-hidden": m > 0,
1301
- children: /* @__PURE__ */ M("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1302
- vt ? /* @__PURE__ */ M("span", { className: u.ctaDiscountBadge, children: [
1303
- vt,
1312
+ children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1313
+ ve ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
1314
+ ve,
1304
1315
  "% Discount"
1305
- ] }) : /* @__PURE__ */ h("span", {}),
1306
- /* @__PURE__ */ h("span", { children: lt ? /* @__PURE__ */ M(_e, { children: [
1307
- /* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: D(Bt.toFixed(2)) }),
1316
+ ] }) : /* @__PURE__ */ f("span", {}),
1317
+ /* @__PURE__ */ f("span", { children: se ? /* @__PURE__ */ P(yt, { children: [
1318
+ /* @__PURE__ */ f("span", { className: u.ctaTotalsStrike, children: D(Be.toFixed(2)) }),
1308
1319
  " ",
1309
- /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: D(be.toFixed(2)) })
1310
- ] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: D(Bt.toFixed(2)) }) })
1320
+ /* @__PURE__ */ f("span", { className: u.ctaTotalsPrice, children: D(bt.toFixed(2)) })
1321
+ ] }) : /* @__PURE__ */ f("span", { className: u.ctaTotalsPrice, children: D(Be.toFixed(2)) }) })
1311
1322
  ] })
1312
1323
  }
1313
1324
  ),
1314
1325
  (() => {
1315
1326
  const a = (s == null ? void 0 : s.ctaButtonMode) || "add_to_cart";
1316
- return a === "add_to_cart_checkout" ? m > 0 ? /* @__PURE__ */ h("button", { type: "button", onClick: Y, disabled: !L, className: u.cta, children: r ? "Adding…" : `Add ${m} more product${m === 1 ? "" : "s"}` }) : /* @__PURE__ */ M("div", { className: `${u.ctaButtonGroup} ${Ut ? u.ctaButtonGroupAnimating : ""}`, children: [
1317
- /* @__PURE__ */ h(
1327
+ return a === "add_to_cart_checkout" ? m > 0 ? /* @__PURE__ */ f("button", { type: "button", onClick: X, disabled: !U, className: u.cta, children: r ? "Adding…" : `Add ${m} more product${m === 1 ? "" : "s"}` }) : /* @__PURE__ */ P("div", { className: `${u.ctaButtonGroup} ${Ue ? u.ctaButtonGroupAnimating : ""}`, children: [
1328
+ /* @__PURE__ */ f(
1318
1329
  "button",
1319
1330
  {
1320
1331
  type: "button",
1321
- onClick: Y,
1322
- disabled: !L,
1323
- className: `${u.ctaDualLeft} ${Ut ? u.ctaDualLeftAnimating : ""}`,
1324
- children: /* @__PURE__ */ h("span", { children: r ? "Adding…" : "Add to Basket" })
1332
+ onClick: X,
1333
+ disabled: !U,
1334
+ className: `${u.ctaDualLeft} ${Ue ? u.ctaDualLeftAnimating : ""}`,
1335
+ children: /* @__PURE__ */ f("span", { children: r ? "Adding…" : "Add to Basket" })
1325
1336
  }
1326
1337
  ),
1327
- /* @__PURE__ */ h(
1338
+ /* @__PURE__ */ f(
1328
1339
  "button",
1329
1340
  {
1330
1341
  type: "button",
1331
- onClick: q,
1332
- disabled: !L,
1333
- className: `${u.ctaDualRight} ${Ut ? u.ctaDualRightAnimating : ""}`,
1334
- children: /* @__PURE__ */ h("span", { children: r ? "Processing…" : "Checkout" })
1342
+ onClick: z,
1343
+ disabled: !U,
1344
+ className: `${u.ctaDualRight} ${Ue ? u.ctaDualRightAnimating : ""}`,
1345
+ children: /* @__PURE__ */ f("span", { children: r ? "Processing…" : "Checkout" })
1335
1346
  }
1336
1347
  )
1337
- ] }) : a === "checkout" ? /* @__PURE__ */ h("button", { type: "button", onClick: q, disabled: !L, className: u.cta, children: r ? "Processing…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ h("button", { type: "button", onClick: Y, disabled: !L, className: u.cta, children: r ? "Adding…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Add to Basket" });
1348
+ ] }) : a === "checkout" ? /* @__PURE__ */ f("button", { type: "button", onClick: z, disabled: !U, className: u.cta, children: r ? "Processing…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Checkout" }) : /* @__PURE__ */ f("button", { type: "button", onClick: X, disabled: !U, className: u.cta, children: r ? "Adding…" : m > 0 ? `Add ${m} more product${m === 1 ? "" : "s"}` : "Add to Basket" });
1338
1349
  })(),
1339
- /* @__PURE__ */ M("div", { className: u.poweredBy, children: [
1350
+ /* @__PURE__ */ P("div", { className: u.poweredBy, children: [
1340
1351
  "powered by ",
1341
- /* @__PURE__ */ h("a", { href: "https://apps.shopify.com/best-bundles", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
1352
+ /* @__PURE__ */ f("a", { href: "https://apps.shopify.com/best-bundles", target: "_blank", rel: "noopener noreferrer", children: " BestBundles" })
1342
1353
  ] })
1343
1354
  ] })
1344
1355
  ] })
@@ -1346,30 +1357,30 @@ function hr(i) {
1346
1357
  }
1347
1358
  ) : null;
1348
1359
  }
1349
- function Gt(i) {
1350
- if (i != null && i.length)
1351
- return i.reduce((t, e) => (e != null && e.key && (t[e.key] = e.value ?? ""), t), {});
1360
+ function Ge(o) {
1361
+ if (o != null && o.length)
1362
+ return o.reduce((e, t) => (t != null && t.key && (e[t.key] = t.value ?? ""), e), {});
1352
1363
  }
1353
- function he(i) {
1354
- const t = /\/(\d+)$/.exec(i);
1355
- return t ? t[1] : i;
1364
+ function ht(o) {
1365
+ const e = /\/(\d+)$/.exec(o);
1366
+ return e ? e[1] : o;
1356
1367
  }
1357
- function ir() {
1358
- var i;
1359
- return ((i = window == null ? void 0 : window.routes) == null ? void 0 : i.cart_url) || "/cart";
1368
+ function or() {
1369
+ var o;
1370
+ return ((o = window == null ? void 0 : window.routes) == null ? void 0 : o.cart_url) || "/cart";
1360
1371
  }
1361
1372
  async function ar() {
1362
1373
  try {
1363
- const i = ir(), t = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), e = await fetch(`${i}?sections=${t}`, { method: "GET" });
1364
- if (!e.ok) return;
1365
- const o = await e.json().catch(() => null);
1366
- if (!o) return;
1374
+ const o = or(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${o}?sections=${e}`, { method: "GET" });
1375
+ if (!t.ok) return;
1376
+ const i = await t.json().catch(() => null);
1377
+ if (!i) return;
1367
1378
  const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
1368
1379
  for (const s of r) {
1369
- const p = o[s];
1380
+ const p = i[s];
1370
1381
  if (!p) continue;
1371
- const v = new DOMParser().parseFromString(p, "text/html"), O = v.getElementById(s) || v.querySelector(s), P = document.getElementById(s) || document.querySelector(s);
1372
- P && O && P.replaceWith(O);
1382
+ const v = new DOMParser().parseFromString(p, "text/html"), A = v.getElementById(s) || v.querySelector(s), R = document.getElementById(s) || document.querySelector(s);
1383
+ R && A && R.replaceWith(A);
1373
1384
  }
1374
1385
  const n = document.querySelector("cart-drawer");
1375
1386
  if (n && typeof n.open == "function") {
@@ -1382,50 +1393,50 @@ async function ar() {
1382
1393
  } catch {
1383
1394
  }
1384
1395
  }
1385
- async function Et(i, t) {
1386
- const e = await fetch(i, {
1396
+ async function Ee(o, e) {
1397
+ const t = await fetch(o, {
1387
1398
  method: "POST",
1388
1399
  headers: {
1389
1400
  Accept: "application/json",
1390
1401
  "Content-Type": "application/json"
1391
1402
  },
1392
- body: JSON.stringify(t)
1403
+ body: JSON.stringify(e)
1393
1404
  });
1394
- if (!e.ok) {
1395
- const o = await e.text().catch(() => "");
1396
- throw new Error(o || `Cart request failed: ${e.status}`);
1405
+ if (!t.ok) {
1406
+ const i = await t.text().catch(() => "");
1407
+ throw new Error(i || `Cart request failed: ${t.status}`);
1397
1408
  }
1398
- return e.json().catch(() => null);
1409
+ return t.json().catch(() => null);
1399
1410
  }
1400
1411
  function fr() {
1401
1412
  return {
1402
- async linesAdd(i) {
1403
- const t = i.map((e) => ({
1404
- id: he(e.merchandiseId),
1405
- quantity: e.quantity,
1406
- properties: Gt(e.attributes)
1413
+ async linesAdd(o) {
1414
+ const e = o.map((t) => ({
1415
+ id: ht(t.merchandiseId),
1416
+ quantity: t.quantity,
1417
+ properties: Ge(t.attributes)
1407
1418
  }));
1408
- await Et("/cart/add.js", { items: t });
1419
+ await Ee("/cart/add.js", { items: e });
1409
1420
  },
1410
- async linesAddForCheckout(i) {
1411
- const t = i.map((e) => ({
1412
- id: he(e.merchandiseId),
1413
- quantity: e.quantity,
1414
- properties: Gt(e.attributes)
1421
+ async linesAddForCheckout(o) {
1422
+ const e = o.map((t) => ({
1423
+ id: ht(t.merchandiseId),
1424
+ quantity: t.quantity,
1425
+ properties: Ge(t.attributes)
1415
1426
  }));
1416
- await Et("/cart/add.js", { items: t });
1427
+ await Ee("/cart/add.js", { items: e });
1417
1428
  },
1418
- async linesUpdate(i) {
1419
- for (const t of i)
1420
- await Et("/cart/change.js", {
1421
- id: t.id,
1422
- quantity: t.quantity,
1423
- properties: Gt(t.attributes)
1429
+ async linesUpdate(o) {
1430
+ for (const e of o)
1431
+ await Ee("/cart/change.js", {
1432
+ id: e.id,
1433
+ quantity: e.quantity,
1434
+ properties: Ge(e.attributes)
1424
1435
  });
1425
1436
  },
1426
- async linesRemove(i) {
1427
- for (const t of i)
1428
- await Et("/cart/change.js", { id: t, quantity: 0 });
1437
+ async linesRemove(o) {
1438
+ for (const e of o)
1439
+ await Ee("/cart/change.js", { id: e, quantity: 0 });
1429
1440
  },
1430
1441
  openCartUI() {
1431
1442
  window.setTimeout(() => {
@@ -1440,10 +1451,10 @@ function fr() {
1440
1451
  export {
1441
1452
  hr as BundleBuilderDrawer,
1442
1453
  dr as BundleButton,
1443
- Rt as BundleLineAttributeKeys,
1454
+ Fe as BundleLineAttributeKeys,
1444
1455
  lr as BundleProvider,
1445
1456
  fr as createLiquidCartAdapter,
1446
- Yt as useBundleBuilder,
1457
+ Ye as useBundleBuilder,
1447
1458
  ur as useBundleBuilderDrawer
1448
1459
  };
1449
1460
  //# sourceMappingURL=index.js.map