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