@best-bundles/bundle-ui 0.0.4 → 0.0.6

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,360 +1,363 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.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_1ctfr_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}._backdropOpen_1ctfr_14{opacity:1}._backdropClosed_1ctfr_18{opacity:0}._panel_1ctfr_22{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_1ctfr_42{animation:_bbSlideInFromRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_1ctfr_46{animation:_bbSlideOutToRight_1ctfr_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_1ctfr_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_1ctfr_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_1ctfr_1{transition:none}._panelOpen_1ctfr_42,._panelClosed_1ctfr_46{animation:none}}._header_1ctfr_81{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_1ctfr_90{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_1ctfr_98{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_1ctfr_107{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_1ctfr_107:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_1ctfr_107:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_1ctfr_129{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_1ctfr_133{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_1ctfr_145 ._headerTitleWrap_1ctfr_129{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_1ctfr_145 ._headerSearchWrap_1ctfr_133{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_1ctfr_157{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_1ctfr_169{width:100%;border:none;outline:none;background:transparent;font:inherit;font-size:14px;min-width:0;height:100%;line-height:36px;padding:0}._searchInput_1ctfr_169::-webkit-search-cancel-button,._searchInput_1ctfr_169::-webkit-search-decoration,._searchInput_1ctfr_169::-webkit-search-results-button,._searchInput_1ctfr_169::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_1ctfr_190{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_1ctfr_190:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_1ctfr_190:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_1ctfr_212{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_1ctfr_212:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_1ctfr_212:disabled{opacity:.6;cursor:not-allowed}._closeButton_1ctfr_212:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_1ctfr_129,._headerSearchWrap_1ctfr_133{transition:none}}._body_1ctfr_245{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_1ctfr_250{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_1ctfr_255{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_1ctfr_260{margin-top:4px}._variantList_1ctfr_264{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_1ctfr_272{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_1ctfr_280{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_1ctfr_287{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_1ctfr_287:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_1ctfr_287:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_1ctfr_287:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_1ctfr_315{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_1ctfr_325{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_1ctfr_332{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_1ctfr_342{min-width:0}._variantName_1ctfr_346{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_1ctfr_355{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_1ctfr_363{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_1ctfr_370{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_1ctfr_363{font-size:13px;font-weight:800}._qtyControls_1ctfr_381{display:inline-flex;align-items:center;gap:6px}._qtyButton_1ctfr_387{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_1ctfr_387:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_1ctfr_387:disabled{opacity:.6;cursor:not-allowed}._qtyButton_1ctfr_387:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_1ctfr_412{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_1ctfr_419{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}._boxSummaryWindow_1ctfr_426{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_1ctfr_426::-webkit-scrollbar{display:none}._boxSummaryRow_1ctfr_443{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_1ctfr_451{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_1ctfr_459{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_1ctfr_471{cursor:pointer}._boxItemClickable_1ctfr_471:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_1ctfr_480{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_1ctfr_491{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_1ctfr_497{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_1ctfr_503{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:linear-gradient(180deg,#2563eb1a,#2563eb08);color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_1ctfr_511{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_1ctfr_519{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_1ctfr_526{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_1ctfr_533{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}._cta_1ctfr_544{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}._ctaTotals_1ctfr_556{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_1ctfr_564{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_1ctfr_578{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_1ctfr_591{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_1ctfr_598{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_1ctfr_605{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_1ctfr_578{transition:none}}._cta_1ctfr_544:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_1ctfr_544:disabled{opacity:.6;cursor:not-allowed}._cta_1ctfr_544:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_1ctfr_630{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_1ctfr_1{padding:0;justify-content:stretch}._panel_1ctfr_22{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(r)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- import { jsx as d, jsxs as P, Fragment as Qt } from "react/jsx-runtime";
3
- import wt, { useState as O, useRef as V, useEffect as z, useCallback as st, useMemo as T, createContext as Yt, useContext as Gt, forwardRef as Et, createElement as Tt } from "react";
4
- const gt = {
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_jv9mc_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_jv9mc_14{position:absolute;top:0;right:0;bottom:0;left:0;display:grid;place-items:center;pointer-events:none;z-index:50}._celebrationChip_jv9mc_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_jv9mc_1 2.8s cubic-bezier(.16,1,.3,1) forwards;filter:saturate(1.05)}@keyframes _bbCelebrationPop_jv9mc_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_jv9mc_74{opacity:1}._backdropClosed_jv9mc_78{opacity:0}._panel_jv9mc_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_jv9mc_102{animation:_bbSlideInFromRight_jv9mc_1 var(--bb-drawer-transition-duration, .22s) ease forwards}._panelClosed_jv9mc_106{animation:_bbSlideOutToRight_jv9mc_1 var(--bb-drawer-transition-duration, .22s) ease forwards}@keyframes _bbSlideInFromRight_jv9mc_1{0%{transform:translate(110%)}to{transform:translate(0)}}@keyframes _bbSlideOutToRight_jv9mc_1{0%{transform:translate(0)}to{transform:translate(110%)}}@media(prefers-reduced-motion:reduce){._backdrop_jv9mc_1{transition:none}._celebrationChip_jv9mc_23,._panelOpen_jv9mc_102,._panelClosed_jv9mc_106{animation:none}}._header_jv9mc_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_jv9mc_154{position:relative;min-width:0;display:flex;justify-content:center;align-items:center}._title_jv9mc_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_jv9mc_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_jv9mc_171:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchIconButton_jv9mc_171:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._headerTitleWrap_jv9mc_193{transition:opacity .18s ease,transform .22s ease}._headerSearchWrap_jv9mc_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_jv9mc_209 ._headerTitleWrap_jv9mc_193{opacity:0;transform:translateY(2px);pointer-events:none}._headerSearchOpen_jv9mc_209 ._headerSearchWrap_jv9mc_197{opacity:1;transform:translateY(0);pointer-events:auto}._searchBar_jv9mc_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_jv9mc_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_jv9mc_233::-webkit-search-cancel-button,._searchInput_jv9mc_233::-webkit-search-decoration,._searchInput_jv9mc_233::-webkit-search-results-button,._searchInput_jv9mc_233::-webkit-search-results-decoration{-webkit-appearance:none;-moz-appearance:none;appearance:none}._searchClearButton_jv9mc_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_jv9mc_254:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._searchClearButton_jv9mc_254:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._closeButton_jv9mc_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_jv9mc_276:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._closeButton_jv9mc_276:disabled{opacity:.6;cursor:not-allowed}._closeButton_jv9mc_276:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}@media(prefers-reduced-motion:reduce){._headerTitleWrap_jv9mc_193,._headerSearchWrap_jv9mc_197{transition:none}}._body_jv9mc_309{padding:var(--bb-body-padding, 8px 16px);overflow:auto}._muted_jv9mc_314{color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65));margin:0 0 12px}._error_jv9mc_319{color:var(--bb-error-color, #b91c1c);margin:0 0 12px}._variants_jv9mc_324{margin-top:4px}._variantList_jv9mc_328{list-style:none;padding:0;margin:0;display:grid;gap:10px}._variantRow_jv9mc_336{display:grid;grid-template-columns:1fr auto;gap:0px;align-items:stretch;padding:5px}._variantLeft_jv9mc_344{min-width:0;display:flex;gap:12px;align-items:center}._addToBundleButton_jv9mc_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_jv9mc_351:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._addToBundleButton_jv9mc_351:disabled{opacity:.6;cursor:not-allowed}._addToBundleButton_jv9mc_351:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._variantThumb_jv9mc_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_jv9mc_389{width:100%;height:100%;object-fit:cover;display:block}._variantThumbFallback_jv9mc_396{width:100%;height:100%;display:flex;align-items:center;justify-content:center;font-weight:800;color:var(--bb-text-color, #111827)}._variantInfo_jv9mc_406{min-width:0}._variantName_jv9mc_410{font-size:14px;font-weight:600;margin-bottom:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantMeta_jv9mc_419{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._variantPriceRow_jv9mc_427{display:flex;align-items:baseline;gap:8px;margin-top:4px}._variantCompareAt_jv9mc_434{font-size:12px;color:var(--bb-muted-color, rgba(17, 24, 39, .6));text-decoration:line-through}._variantPrice_jv9mc_427{font-size:13px;font-weight:800}._qtyControls_jv9mc_445{display:inline-flex;align-items:center;gap:6px}._qtyButton_jv9mc_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_jv9mc_451:hover{background:var(--bb-control-bg-hover, rgba(17, 24, 39, .04))}._qtyButton_jv9mc_451:disabled{opacity:.6;cursor:not-allowed}._qtyButton_jv9mc_451:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._qtyValue_jv9mc_476{min-width:18px;text-align:center;font-variant-numeric:tabular-nums;font-weight:700}._footer_jv9mc_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}._boxSummaryWindow_jv9mc_490{margin-bottom:6px;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:none;-ms-overflow-style:none}._boxSummaryWindow_jv9mc_490::-webkit-scrollbar{display:none}._boxSummaryRow_jv9mc_507{--bb-box-gap: 10px;display:flex;align-items:flex-start;gap:var(--bb-box-gap);width:100%}._boxSlot_jv9mc_515{flex:0 0 calc((100% - (4 * var(--bb-box-gap))) / 5);display:flex;flex-direction:column;align-items:stretch;gap:6px}._boxItem_jv9mc_523{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_jv9mc_535{cursor:pointer}._boxItemClickable_jv9mc_535:focus-visible{outline:2px solid var(--bb-focus-ring, #2563eb);outline-offset:2px}._boxThresholdLabel_jv9mc_544{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_jv9mc_555{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_jv9mc_561{border:1px solid var(--bb-border-color, rgba(17, 24, 39, .08));background:var(--bb-surface-bg, #ffffff);overflow:hidden}._boxItemThreshold_jv9mc_567{border-style:solid;border-width:2px;border-color:var(--bb-tier-border, rgba(37, 99, 235, .55));background:linear-gradient(180deg,#2563eb1a,#2563eb08);color:var(--bb-tier-text, rgba(29, 78, 216, .95))}._boxItemDiscountText_jv9mc_575{font-size:12px;font-weight:800;text-align:center;line-height:1.1;padding:6px}._boxItemPlus_jv9mc_583{font-size:22px;font-weight:700;opacity:.5;line-height:1}._boxItemImage_jv9mc_590{width:100%;height:100%;object-fit:cover;display:block}._boxItemFallback_jv9mc_597{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}._cta_jv9mc_608{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}._ctaTotals_jv9mc_620{display:flex;justify-content:space-between;align-items:baseline;gap:10px;font-variant-numeric:tabular-nums}._ctaDiscountBadge_jv9mc_628{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_jv9mc_642{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_jv9mc_655{max-height:40px;opacity:1;transform:translateY(0);margin-bottom:8px}._ctaTotalsStrike_jv9mc_662{opacity:.85;text-decoration:line-through;font-weight:700;color:var(--bb-muted-strong-color, rgba(17, 24, 39, .65))}._ctaTotalsPrice_jv9mc_669{font-weight:900;color:var(--bb-text-color, #111827)}@media(prefers-reduced-motion:reduce){._ctaTotalsWrap_jv9mc_642{transition:none}}._cta_jv9mc_608:hover{background:var(--bb-cta-bg-hover, #1d4ed8)}._cta_jv9mc_608:disabled{opacity:.6;cursor:not-allowed}._cta_jv9mc_608:focus-visible{outline:2px solid var(--bb-cta-focus-ring, var(--bb-text-color, #111827));outline-offset:2px}._helperText_jv9mc_694{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_jv9mc_1{padding:0;justify-content:stretch}._panel_jv9mc_82{width:100%;height:100%;border-radius:0}}')),document.head.appendChild(e)}}catch(r){console.error("vite-plugin-css-injected-by-js",r)}})();
2
+ import { jsx as h, jsxs as P, Fragment as ot } from "react/jsx-runtime";
3
+ import Se, { useState as B, useRef as L, useEffect as z, useCallback as ce, useMemo as I, createContext as st, useContext as ct, forwardRef as Je, createElement as De } from "react";
4
+ const Ne = {
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 Ht(o) {
11
- const t = new URL("/api/public/bundle-config", o.apiBaseUrl);
12
- t.searchParams.set("shop", o.shop);
13
- const i = await (await fetch(t, {
10
+ async function lt(a) {
11
+ const e = new URL("/api/public/bundle-config", a.apiBaseUrl);
12
+ e.searchParams.set("shop", a.shop);
13
+ const i = await (await fetch(e, {
14
14
  method: "GET",
15
- signal: o.signal,
15
+ signal: a.signal,
16
16
  headers: { "Content-Type": "application/json" }
17
17
  })).json().catch(() => null);
18
18
  return !i || typeof i != "object" ? { ok: !1, error: "Invalid response." } : i;
19
19
  }
20
- const Vt = Yt(null);
21
- function Kt() {
20
+ const Ze = st(null);
21
+ function ut() {
22
22
  try {
23
- const o = globalThis.crypto;
24
- if (o != null && o.randomUUID) return o.randomUUID();
23
+ const a = globalThis.crypto;
24
+ if (a != null && a.randomUUID) return a.randomUUID();
25
25
  } catch {
26
26
  }
27
27
  return `bb_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
28
28
  }
29
- function Dt(o) {
30
- return Number.isFinite(o) ? Math.max(0, Math.floor(o)) : 0;
29
+ function Ge(a) {
30
+ return Number.isFinite(a) ? Math.max(0, Math.floor(a)) : 0;
31
31
  }
32
- function Cn(o) {
32
+ function $n(a) {
33
33
  const {
34
- apiBaseUrl: t,
35
- shop: e,
34
+ apiBaseUrl: e,
35
+ shop: t,
36
36
  cartAdapter: i,
37
37
  configHandle: r = "default",
38
38
  initialData: n,
39
- configFetcher: c,
40
- children: l
41
- } = o, [m, k] = O(!1), [N, R] = O(!n), [w, $] = O(!1), [j, U] = O(null), [S, F] = O((n == null ? void 0 : n.currencyCode) ?? null), [b, Q] = O((n == null ? void 0 : n.config) ?? null), [rt, it] = O(
39
+ configFetcher: l,
40
+ children: c
41
+ } = a, [m, N] = B(!1), [C, T] = B(!n), [y, $] = B(!1), [V, U] = B(null), [M, O] = B((n == null ? void 0 : n.currencyCode) ?? null), [f, Q] = B((n == null ? void 0 : n.config) ?? null), [ae, le] = B(
42
42
  (n == null ? void 0 : n.eligibleVariants) ?? []
43
- ), [K, ft] = O(
43
+ ), [ue, J] = B(
44
44
  () => ({ selections: {}, order: [] })
45
- ), mt = V(null);
45
+ ), ge = L(null);
46
46
  z(() => {
47
- var C;
47
+ var j;
48
48
  if (n) return;
49
- (C = mt.current) == null || C.abort();
50
- const y = new AbortController();
51
- mt.current = y;
52
- const x = c ?? Ht;
53
- return R(!0), U(null), x({ apiBaseUrl: t, shop: e, signal: y.signal }).then((g) => {
54
- if (!g.ok) {
55
- U(g.error || "Failed to load bundle config."), Q(null), it([]), F(null);
49
+ (j = ge.current) == null || j.abort();
50
+ const w = new AbortController();
51
+ ge.current = w;
52
+ const S = l ?? lt;
53
+ return T(!0), U(null), S({ apiBaseUrl: e, shop: t, signal: w.signal }).then((_) => {
54
+ if (!_.ok) {
55
+ U(_.error || "Failed to load bundle config."), Q(null), le([]), O(null);
56
56
  return;
57
57
  }
58
- F(g.currencyCode ?? null), Q(g.config), it(g.eligibleVariants ?? []);
59
- }).catch((g) => {
60
- const M = g instanceof Error ? g.message : "Failed to load bundle config.";
61
- U(M), Q(null), it([]), F(null);
62
- }).finally(() => R(!1)), () => y.abort();
63
- }, [t, e, n, c]);
64
- const pt = st(() => k(!0), []), X = st(() => k(!1), []), bt = st(() => k((y) => !y), []), _t = st((y, x) => {
65
- const C = Dt(x);
66
- ft((g) => {
67
- const M = g.selections[y] ?? 0, G = C - M;
68
- let I;
69
- if (C <= 0) {
70
- const { [y]: et, ...D } = g.selections;
71
- I = D;
72
- } else M === C ? I = g.selections : I = { ...g.selections, [y]: C };
73
- let L = g.order;
74
- if (G > 0)
75
- L = [...g.order, ...Array.from({ length: G }, () => y)];
76
- else if (G < 0) {
77
- let et = -G;
78
- const D = [];
79
- for (let lt = g.order.length - 1; lt >= 0; lt--) {
80
- const ot = g.order[lt];
81
- if (ot === y && et > 0) {
82
- et--;
58
+ O(_.currencyCode ?? null), Q(_.config), le(_.eligibleVariants ?? []);
59
+ }).catch((_) => {
60
+ const F = _ instanceof Error ? _.message : "Failed to load bundle config.";
61
+ U(F), Q(null), le([]), O(null);
62
+ }).finally(() => T(!1)), () => w.abort();
63
+ }, [e, t, n, l]);
64
+ const xe = ce(() => N(!0), []), oe = ce(() => N(!1), []), de = ce(() => N((w) => !w), []), Ce = I(() => {
65
+ const w = Number((f == null ? void 0 : f.maxBundleSize) ?? NaN), S = Number.isFinite(w) ? Math.floor(w) : 100;
66
+ return Math.max(2, Math.min(100, S));
67
+ }, [f == null ? void 0 : f.maxBundleSize]), Ie = ce((w, S) => {
68
+ const j = Ge(S);
69
+ J((_) => {
70
+ const F = _.selections[w] ?? 0, K = j - F, Be = Object.values(_.selections).reduce((W, Y) => W + (Y || 0), 0), re = K > 0 ? Math.min(K, Math.max(0, Ce - Be)) : K, me = F + re;
71
+ let H;
72
+ if (me <= 0) {
73
+ const { [w]: W, ...Y } = _.selections;
74
+ H = Y;
75
+ } else F === me ? H = _.selections : H = { ..._.selections, [w]: me };
76
+ let A = _.order;
77
+ if (re > 0)
78
+ A = [..._.order, ...Array.from({ length: re }, () => w)];
79
+ else if (re < 0) {
80
+ let W = -re;
81
+ const Y = [];
82
+ for (let fe = _.order.length - 1; fe >= 0; fe--) {
83
+ const pe = _.order[fe];
84
+ if (pe === w && W > 0) {
85
+ W--;
83
86
  continue;
84
87
  }
85
- D.push(ot);
88
+ Y.push(pe);
86
89
  }
87
- D.reverse(), L = D;
90
+ Y.reverse(), A = Y;
88
91
  }
89
- return I === g.selections && L === g.order ? g : { selections: I, order: L };
92
+ return H === _.selections && A === _.order ? _ : { selections: H, order: A };
90
93
  });
91
- }, []), Z = st(() => ft({ selections: {}, order: [] }), []), A = K.selections, ct = K.order, at = T(() => Object.values(A).reduce((y, x) => y + (x || 0), 0), [A]), J = T(() => {
92
- const y = (b == null ? void 0 : b.rules) ?? [], x = y.length ? Math.min(...y.map((C) => C.minBundleSize)) : 2;
93
- return Number.isFinite(x) && x > 0 ? x : 2;
94
- }, [b]), tt = T(() => !(N || w || j || !(b != null && b.isActive) || at < J), [at, b == null ? void 0 : b.isActive, j, N, J, w]), vt = st(async () => {
95
- var g;
96
- if (!tt || !b) return;
97
- const y = Kt(), x = (b.title ?? "").trim().slice(0, 255), C = Object.entries(A).map(([M, G]) => ({ merchandiseId: M, quantity: Dt(G) })).filter((M) => M.quantity > 0).map((M) => ({
98
- merchandiseId: M.merchandiseId,
99
- quantity: M.quantity,
94
+ }, [Ce]), Z = ce(() => J({ selections: {}, order: [] }), []), R = ue.selections, he = ue.order, ee = I(() => Object.values(R).reduce((w, S) => w + (S || 0), 0), [R]), te = I(() => {
95
+ const w = (f == null ? void 0 : f.rules) ?? [], S = w.length ? Math.min(...w.map((j) => j.minBundleSize)) : 2;
96
+ return Number.isFinite(S) && S > 0 ? S : 2;
97
+ }, [f]), se = I(() => !(C || y || V || !(f != null && f.isActive) || ee < te), [ee, f == null ? void 0 : f.isActive, V, C, te, y]), ne = ce(async () => {
98
+ var _;
99
+ if (!se || !f) return;
100
+ const w = ut(), S = (f.title ?? "").trim().slice(0, 255), j = Object.entries(R).map(([F, K]) => ({ merchandiseId: F, quantity: Ge(K) })).filter((F) => F.quantity > 0).map((F) => ({
101
+ merchandiseId: F.merchandiseId,
102
+ quantity: F.quantity,
100
103
  attributes: [
101
- { key: gt.bundleId, value: y },
102
- { key: gt.bundleConfig, value: r },
103
- { key: gt.bundleSource, value: "bundle_builder" },
104
- ...x ? [{ key: gt.bundleTitle, value: x }] : []
104
+ { key: Ne.bundleId, value: w },
105
+ { key: Ne.bundleConfig, value: r },
106
+ { key: Ne.bundleSource, value: "bundle_builder" },
107
+ ...S ? [{ key: Ne.bundleTitle, value: S }] : []
105
108
  ]
106
109
  }));
107
- if (C.length) {
110
+ if (j.length) {
108
111
  $(!0);
109
112
  try {
110
- await i.linesAdd(C), Z(), X(), (g = i.openCartUI) == null || g.call(i);
113
+ await i.linesAdd(j), Z(), oe(), (_ = i.openCartUI) == null || _.call(i);
111
114
  } finally {
112
115
  $(!1);
113
116
  }
114
117
  }
115
- }, [tt, i, Z, X, b, r, A]), yt = T(
118
+ }, [se, i, Z, oe, f, r, R]), Te = I(
116
119
  () => ({
117
120
  isOpen: m,
118
- open: pt,
119
- close: X,
120
- toggle: bt,
121
- loading: N,
122
- submitting: w,
123
- error: j,
124
- currencyCode: S,
125
- config: b,
126
- eligibleVariants: rt,
127
- selections: A,
128
- selectionOrder: ct,
129
- setQuantity: _t,
121
+ open: xe,
122
+ close: oe,
123
+ toggle: de,
124
+ loading: C,
125
+ submitting: y,
126
+ error: V,
127
+ currencyCode: M,
128
+ config: f,
129
+ eligibleVariants: ae,
130
+ selections: R,
131
+ selectionOrder: he,
132
+ setQuantity: Ie,
130
133
  clearSelections: Z,
131
- bundleSize: at,
132
- minRequired: J,
133
- canSubmit: tt,
134
- submit: vt
134
+ bundleSize: ee,
135
+ minRequired: te,
136
+ canSubmit: se,
137
+ submit: ne
135
138
  }),
136
139
  [
137
140
  m,
138
- pt,
139
- X,
140
- bt,
141
- N,
142
- w,
143
- j,
144
- S,
145
- b,
146
- rt,
147
- A,
148
- ct,
149
- _t,
141
+ xe,
142
+ oe,
143
+ de,
144
+ C,
145
+ y,
146
+ V,
147
+ M,
148
+ f,
149
+ ae,
150
+ R,
151
+ he,
152
+ Ie,
150
153
  Z,
151
- at,
152
- J,
153
- tt,
154
- vt
154
+ ee,
155
+ te,
156
+ se,
157
+ ne
155
158
  ]
156
159
  );
157
- return /* @__PURE__ */ d(Vt.Provider, { value: yt, children: l });
160
+ return /* @__PURE__ */ h(Ze.Provider, { value: Te, children: c });
158
161
  }
159
- function Nt() {
160
- const o = Gt(Vt);
161
- if (!o)
162
+ function Le() {
163
+ const a = ct(Ze);
164
+ if (!a)
162
165
  throw new Error("useBundleBuilder must be used within <BundleProvider />");
163
- return o;
166
+ return a;
164
167
  }
165
- function Bn() {
166
- const { isOpen: o, open: t, close: e, toggle: i } = Nt();
167
- return { isOpen: o, open: t, close: e, toggle: i };
168
+ function Vn() {
169
+ const { isOpen: a, open: e, close: t, toggle: i } = Le();
170
+ return { isOpen: a, open: e, close: t, toggle: i };
168
171
  }
169
- const Xt = "_button_18rtl_1", Zt = {
170
- button: Xt
172
+ const dt = "_button_18rtl_1", ht = {
173
+ button: dt
171
174
  };
172
- function Tn(o) {
173
- const { toggle: t } = Nt();
174
- return /* @__PURE__ */ d(
175
+ function Un(a) {
176
+ const { toggle: e } = Le();
177
+ return /* @__PURE__ */ h(
175
178
  "button",
176
179
  {
177
180
  type: "button",
178
- onClick: t,
179
- className: [Zt.button, o.className].filter(Boolean).join(" "),
180
- children: o.children ?? "Build a bundle"
181
+ onClick: e,
182
+ className: [ht.button, a.className].filter(Boolean).join(" "),
183
+ children: a.children ?? "Build a bundle"
181
184
  }
182
185
  );
183
186
  }
184
- var Ct, Lt;
185
- function Jt() {
186
- if (Lt) return Ct;
187
- Lt = 1;
188
- var o = {
189
- linear: function(t, e, i, r) {
190
- var n = i - e;
191
- return n * t / r + e;
187
+ var Re, Ke;
188
+ function mt() {
189
+ if (Ke) return Re;
190
+ Ke = 1;
191
+ var a = {
192
+ linear: function(e, t, i, r) {
193
+ var n = i - t;
194
+ return n * e / r + t;
192
195
  },
193
- easeInQuad: function(t, e, i, r) {
194
- var n = i - e;
195
- return n * (t /= r) * t + e;
196
+ easeInQuad: function(e, t, i, r) {
197
+ var n = i - t;
198
+ return n * (e /= r) * e + t;
196
199
  },
197
- easeOutQuad: function(t, e, i, r) {
198
- var n = i - e;
199
- return -n * (t /= r) * (t - 2) + e;
200
+ easeOutQuad: function(e, t, i, r) {
201
+ var n = i - t;
202
+ return -n * (e /= r) * (e - 2) + t;
200
203
  },
201
- easeInOutQuad: function(t, e, i, r) {
202
- var n = i - e;
203
- return (t /= r / 2) < 1 ? n / 2 * t * t + e : -n / 2 * (--t * (t - 2) - 1) + e;
204
+ easeInOutQuad: function(e, t, i, r) {
205
+ var n = i - t;
206
+ return (e /= r / 2) < 1 ? n / 2 * e * e + t : -n / 2 * (--e * (e - 2) - 1) + t;
204
207
  },
205
- easeInCubic: function(t, e, i, r) {
206
- var n = i - e;
207
- return n * (t /= r) * t * t + e;
208
+ easeInCubic: function(e, t, i, r) {
209
+ var n = i - t;
210
+ return n * (e /= r) * e * e + t;
208
211
  },
209
- easeOutCubic: function(t, e, i, r) {
210
- var n = i - e;
211
- return n * ((t = t / r - 1) * t * t + 1) + e;
212
+ easeOutCubic: function(e, t, i, r) {
213
+ var n = i - t;
214
+ return n * ((e = e / r - 1) * e * e + 1) + t;
212
215
  },
213
- easeInOutCubic: function(t, e, i, r) {
214
- var n = i - e;
215
- return (t /= r / 2) < 1 ? n / 2 * t * t * t + e : n / 2 * ((t -= 2) * t * t + 2) + e;
216
+ easeInOutCubic: function(e, t, i, r) {
217
+ var n = i - t;
218
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e + t : n / 2 * ((e -= 2) * e * e + 2) + t;
216
219
  },
217
- easeInQuart: function(t, e, i, r) {
218
- var n = i - e;
219
- return n * (t /= r) * t * t * t + e;
220
+ easeInQuart: function(e, t, i, r) {
221
+ var n = i - t;
222
+ return n * (e /= r) * e * e * e + t;
220
223
  },
221
- easeOutQuart: function(t, e, i, r) {
222
- var n = i - e;
223
- return -n * ((t = t / r - 1) * t * t * t - 1) + e;
224
+ easeOutQuart: function(e, t, i, r) {
225
+ var n = i - t;
226
+ return -n * ((e = e / r - 1) * e * e * e - 1) + t;
224
227
  },
225
- easeInOutQuart: function(t, e, i, r) {
226
- var n = i - e;
227
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t + e : -n / 2 * ((t -= 2) * t * t * t - 2) + e;
228
+ easeInOutQuart: function(e, t, i, r) {
229
+ var n = i - t;
230
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e * e + t : -n / 2 * ((e -= 2) * e * e * e - 2) + t;
228
231
  },
229
- easeInQuint: function(t, e, i, r) {
230
- var n = i - e;
231
- return n * (t /= r) * t * t * t * t + e;
232
+ easeInQuint: function(e, t, i, r) {
233
+ var n = i - t;
234
+ return n * (e /= r) * e * e * e * e + t;
232
235
  },
233
- easeOutQuint: function(t, e, i, r) {
234
- var n = i - e;
235
- return n * ((t = t / r - 1) * t * t * t * t + 1) + e;
236
+ easeOutQuint: function(e, t, i, r) {
237
+ var n = i - t;
238
+ return n * ((e = e / r - 1) * e * e * e * e + 1) + t;
236
239
  },
237
- easeInOutQuint: function(t, e, i, r) {
238
- var n = i - e;
239
- return (t /= r / 2) < 1 ? n / 2 * t * t * t * t * t + e : n / 2 * ((t -= 2) * t * t * t * t + 2) + e;
240
+ easeInOutQuint: function(e, t, i, r) {
241
+ var n = i - t;
242
+ return (e /= r / 2) < 1 ? n / 2 * e * e * e * e * e + t : n / 2 * ((e -= 2) * e * e * e * e + 2) + t;
240
243
  },
241
- easeInSine: function(t, e, i, r) {
242
- var n = i - e;
243
- return -n * Math.cos(t / r * (Math.PI / 2)) + n + e;
244
+ easeInSine: function(e, t, i, r) {
245
+ var n = i - t;
246
+ return -n * Math.cos(e / r * (Math.PI / 2)) + n + t;
244
247
  },
245
- easeOutSine: function(t, e, i, r) {
246
- var n = i - e;
247
- return n * Math.sin(t / r * (Math.PI / 2)) + e;
248
+ easeOutSine: function(e, t, i, r) {
249
+ var n = i - t;
250
+ return n * Math.sin(e / r * (Math.PI / 2)) + t;
248
251
  },
249
- easeInOutSine: function(t, e, i, r) {
250
- var n = i - e;
251
- return -n / 2 * (Math.cos(Math.PI * t / r) - 1) + e;
252
+ easeInOutSine: function(e, t, i, r) {
253
+ var n = i - t;
254
+ return -n / 2 * (Math.cos(Math.PI * e / r) - 1) + t;
252
255
  },
253
- easeInExpo: function(t, e, i, r) {
254
- var n = i - e;
255
- return t == 0 ? e : n * Math.pow(2, 10 * (t / r - 1)) + e;
256
+ easeInExpo: function(e, t, i, r) {
257
+ var n = i - t;
258
+ return e == 0 ? t : n * Math.pow(2, 10 * (e / r - 1)) + t;
256
259
  },
257
- easeOutExpo: function(t, e, i, r) {
258
- var n = i - e;
259
- return t == r ? e + n : n * (-Math.pow(2, -10 * t / r) + 1) + e;
260
+ easeOutExpo: function(e, t, i, r) {
261
+ var n = i - t;
262
+ return e == r ? t + n : n * (-Math.pow(2, -10 * e / r) + 1) + t;
260
263
  },
261
- easeInOutExpo: function(t, e, i, r) {
262
- var n = i - e;
263
- 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;
264
+ easeInOutExpo: function(e, t, i, r) {
265
+ var n = i - t;
266
+ 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;
264
267
  },
265
- easeInCirc: function(t, e, i, r) {
266
- var n = i - e;
267
- return -n * (Math.sqrt(1 - (t /= r) * t) - 1) + e;
268
+ easeInCirc: function(e, t, i, r) {
269
+ var n = i - t;
270
+ return -n * (Math.sqrt(1 - (e /= r) * e) - 1) + t;
268
271
  },
269
- easeOutCirc: function(t, e, i, r) {
270
- var n = i - e;
271
- return n * Math.sqrt(1 - (t = t / r - 1) * t) + e;
272
+ easeOutCirc: function(e, t, i, r) {
273
+ var n = i - t;
274
+ return n * Math.sqrt(1 - (e = e / r - 1) * e) + t;
272
275
  },
273
- easeInOutCirc: function(t, e, i, r) {
274
- var n = i - e;
275
- return (t /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - t * t) - 1) + e : n / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + e;
276
+ easeInOutCirc: function(e, t, i, r) {
277
+ var n = i - t;
278
+ return (e /= r / 2) < 1 ? -n / 2 * (Math.sqrt(1 - e * e) - 1) + t : n / 2 * (Math.sqrt(1 - (e -= 2) * e) + 1) + t;
276
279
  },
277
- easeInElastic: function(t, e, i, r) {
278
- var n = i - e, c, l, m;
279
- return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), -(c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e);
280
+ easeInElastic: function(e, t, i, r) {
281
+ var n = i - t, l, c, m;
282
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), -(l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c)) + t);
280
283
  },
281
- easeOutElastic: function(t, e, i, r) {
282
- var n = i - e, c, l, m;
283
- return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r) === 1 ? e + n : (l || (l = r * 0.3), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), c * Math.pow(2, -10 * t) * Math.sin((t * r - m) * (2 * Math.PI) / l) + n + e);
284
+ easeOutElastic: function(e, t, i, r) {
285
+ var n = i - t, l, c, m;
286
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r) === 1 ? t + n : (c || (c = r * 0.3), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), l * Math.pow(2, -10 * e) * Math.sin((e * r - m) * (2 * Math.PI) / c) + n + t);
284
287
  },
285
- easeInOutElastic: function(t, e, i, r) {
286
- var n = i - e, c, l, m;
287
- return m = 1.70158, l = 0, c = n, t === 0 ? e : (t /= r / 2) === 2 ? e + n : (l || (l = r * (0.3 * 1.5)), c < Math.abs(n) ? (c = n, m = l / 4) : m = l / (2 * Math.PI) * Math.asin(n / c), t < 1 ? -0.5 * (c * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l)) + e : c * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * r - m) * (2 * Math.PI) / l) * 0.5 + n + e);
288
+ easeInOutElastic: function(e, t, i, r) {
289
+ var n = i - t, l, c, m;
290
+ return m = 1.70158, c = 0, l = n, e === 0 ? t : (e /= r / 2) === 2 ? t + n : (c || (c = r * (0.3 * 1.5)), l < Math.abs(n) ? (l = n, m = c / 4) : m = c / (2 * Math.PI) * Math.asin(n / l), e < 1 ? -0.5 * (l * Math.pow(2, 10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c)) + t : l * Math.pow(2, -10 * (e -= 1)) * Math.sin((e * r - m) * (2 * Math.PI) / c) * 0.5 + n + t);
288
291
  },
289
- easeInBack: function(t, e, i, r, n) {
290
- var c = i - e;
291
- return n === void 0 && (n = 1.70158), c * (t /= r) * t * ((n + 1) * t - n) + e;
292
+ easeInBack: function(e, t, i, r, n) {
293
+ var l = i - t;
294
+ return n === void 0 && (n = 1.70158), l * (e /= r) * e * ((n + 1) * e - n) + t;
292
295
  },
293
- easeOutBack: function(t, e, i, r, n) {
294
- var c = i - e;
295
- return n === void 0 && (n = 1.70158), c * ((t = t / r - 1) * t * ((n + 1) * t + n) + 1) + e;
296
+ easeOutBack: function(e, t, i, r, n) {
297
+ var l = i - t;
298
+ return n === void 0 && (n = 1.70158), l * ((e = e / r - 1) * e * ((n + 1) * e + n) + 1) + t;
296
299
  },
297
- easeInOutBack: function(t, e, i, r, n) {
298
- var c = i - e;
299
- return n === void 0 && (n = 1.70158), (t /= r / 2) < 1 ? c / 2 * (t * t * (((n *= 1.525) + 1) * t - n)) + e : c / 2 * ((t -= 2) * t * (((n *= 1.525) + 1) * t + n) + 2) + e;
300
+ easeInOutBack: function(e, t, i, r, n) {
301
+ var l = i - t;
302
+ 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;
300
303
  },
301
- easeInBounce: function(t, e, i, r) {
302
- var n = i - e, c;
303
- return c = o.easeOutBounce(r - t, 0, n, r), n - c + e;
304
+ easeInBounce: function(e, t, i, r) {
305
+ var n = i - t, l;
306
+ return l = a.easeOutBounce(r - e, 0, n, r), n - l + t;
304
307
  },
305
- easeOutBounce: function(t, e, i, r) {
306
- var n = i - e;
307
- 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;
308
+ easeOutBounce: function(e, t, i, r) {
309
+ var n = i - t;
310
+ 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;
308
311
  },
309
- easeInOutBounce: function(t, e, i, r) {
310
- var n = i - e, c;
311
- return t < r / 2 ? (c = o.easeInBounce(t * 2, 0, n, r), c * 0.5 + e) : (c = o.easeOutBounce(t * 2 - r, 0, n, r), c * 0.5 + n * 0.5 + e);
312
+ easeInOutBounce: function(e, t, i, r) {
313
+ var n = i - t, l;
314
+ return e < r / 2 ? (l = a.easeInBounce(e * 2, 0, n, r), l * 0.5 + t) : (l = a.easeOutBounce(e * 2 - r, 0, n, r), l * 0.5 + n * 0.5 + t);
312
315
  }
313
316
  };
314
- return Ct = o, Ct;
317
+ return Re = a, Re;
315
318
  }
316
- var te = Jt();
317
- function ee(o) {
318
- return o * Math.PI / 180;
319
+ var ft = mt();
320
+ function pt(a) {
321
+ return a * Math.PI / 180;
319
322
  }
320
- function q(o, t) {
321
- return o + Math.random() * (t - o);
323
+ function q(a, e) {
324
+ return a + Math.random() * (e - a);
322
325
  }
323
- function ne(o, t) {
324
- return Math.floor(o + Math.random() * (t - o + 1));
326
+ function vt(a, e) {
327
+ return Math.floor(a + Math.random() * (e - a + 1));
325
328
  }
326
- var dt;
327
- (function(o) {
328
- o[o.Circle = 0] = "Circle", o[o.Square = 1] = "Square", o[o.Strip = 2] = "Strip";
329
- })(dt || (dt = {}));
330
- var H;
331
- (function(o) {
332
- o[o.Positive = 1] = "Positive", o[o.Negative = -1] = "Negative";
333
- })(H || (H = {}));
334
- const re = 1e3 / 60;
335
- class ie {
336
- constructor(t, e, i, r) {
337
- this.getOptions = e;
338
- const { colors: n, initialVelocityX: c, initialVelocityY: l } = this.getOptions();
339
- this.context = t, this.x = i, this.y = r, this.w = q(5, 20), this.h = q(5, 20), this.radius = q(5, 10), this.vx = typeof c == "number" ? q(-c, c) : q(c.min, c.max), this.vy = typeof l == "number" ? q(-l, 0) : q(l.min, l.max), this.shape = ne(0, 2), this.angle = ee(q(0, 360)), this.angularSpin = q(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = q(0, 1), this.rotationDirection = q(0, 1) ? H.Positive : H.Negative;
329
+ var ye;
330
+ (function(a) {
331
+ a[a.Circle = 0] = "Circle", a[a.Square = 1] = "Square", a[a.Strip = 2] = "Strip";
332
+ })(ye || (ye = {}));
333
+ var X;
334
+ (function(a) {
335
+ a[a.Positive = 1] = "Positive", a[a.Negative = -1] = "Negative";
336
+ })(X || (X = {}));
337
+ const bt = 1e3 / 60;
338
+ class _t {
339
+ constructor(e, t, i, r) {
340
+ this.getOptions = t;
341
+ const { colors: n, initialVelocityX: l, initialVelocityY: c } = this.getOptions();
342
+ this.context = e, this.x = i, this.y = r, this.w = q(5, 20), this.h = q(5, 20), this.radius = q(5, 10), this.vx = typeof l == "number" ? q(-l, l) : q(l.min, l.max), this.vy = typeof c == "number" ? q(-c, 0) : q(c.min, c.max), this.shape = vt(0, 2), this.angle = pt(q(0, 360)), this.angularSpin = q(-0.2, 0.2), this.color = n[Math.floor(Math.random() * n.length)], this.rotateY = q(0, 1), this.rotationDirection = q(0, 1) ? X.Positive : X.Negative;
340
343
  }
341
- update(t) {
342
- const { gravity: e, wind: i, friction: r, opacity: n, drawShape: c } = this.getOptions(), l = t / re;
343
- this.x += this.vx * l, this.y += this.vy * l, this.vy += e * l, this.vx += i * l, this.vx *= r ** l, this.vy *= r ** l, this.rotateY >= 1 && this.rotationDirection === H.Positive ? this.rotationDirection = H.Negative : this.rotateY <= -1 && this.rotationDirection === H.Negative && (this.rotationDirection = H.Positive);
344
- const m = 0.1 * this.rotationDirection * l;
345
- if (this.rotateY += m, 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, c && typeof c == "function")
346
- c.call(this, this.context);
344
+ update(e) {
345
+ const { gravity: t, wind: i, friction: r, opacity: n, drawShape: l } = this.getOptions(), c = e / bt;
346
+ this.x += this.vx * c, this.y += this.vy * c, this.vy += t * c, this.vx += i * c, this.vx *= r ** c, this.vy *= r ** c, this.rotateY >= 1 && this.rotationDirection === X.Positive ? this.rotationDirection = X.Negative : this.rotateY <= -1 && this.rotationDirection === X.Negative && (this.rotationDirection = X.Positive);
347
+ const m = 0.1 * this.rotationDirection * c;
348
+ if (this.rotateY += m, 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")
349
+ l.call(this, this.context);
347
350
  else
348
351
  switch (this.shape) {
349
- case dt.Circle: {
352
+ case ye.Circle: {
350
353
  this.context.beginPath(), this.context.arc(0, 0, this.radius, 0, 2 * Math.PI), this.context.fill();
351
354
  break;
352
355
  }
353
- case dt.Square: {
356
+ case ye.Square: {
354
357
  this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
355
358
  break;
356
359
  }
357
- case dt.Strip: {
360
+ case ye.Strip: {
358
361
  this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
359
362
  break;
360
363
  }
@@ -362,39 +365,39 @@ class ie {
362
365
  this.context.closePath(), this.context.restore();
363
366
  }
364
367
  }
365
- class ae {
366
- constructor(t, e) {
368
+ class wt {
369
+ constructor(e, t) {
367
370
  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) => {
368
371
  this.particles.splice(r, 1);
369
372
  }, this.getParticle = () => {
370
373
  const r = q(this.x, this.w + this.x), n = q(this.y, this.h + this.y);
371
- return new ie(this.context, this.getOptions, r, n);
374
+ return new _t(this.context, this.getOptions, r, n);
372
375
  }, this.animate = (r) => {
373
- const { canvas: n, context: c, particlesGenerated: l, lastNumberOfPieces: m } = this, { run: k, recycle: N, numberOfPieces: R, debug: w, tweenFunction: $, tweenDuration: j } = this.getOptions();
374
- if (!k)
376
+ const { canvas: n, context: l, particlesGenerated: c, lastNumberOfPieces: m } = this, { run: N, recycle: C, numberOfPieces: T, debug: y, tweenFunction: $, tweenDuration: V } = this.getOptions();
377
+ if (!N)
375
378
  return !1;
376
- const U = this.particles.length, S = N ? U : l;
377
- if (S < R) {
378
- m !== R && (this.tweenProgress = 0, this.tweenFrom = S, this.lastNumberOfPieces = R), this.tweenProgress = Math.min(j, Math.max(0, this.tweenProgress + r));
379
- const F = $(this.tweenProgress, this.tweenFrom, R, j), b = Math.round(F - S);
380
- for (let Q = 0; Q < b; Q++)
379
+ const U = this.particles.length, M = C ? U : c;
380
+ if (M < T) {
381
+ m !== T && (this.tweenProgress = 0, this.tweenFrom = M, this.lastNumberOfPieces = T), this.tweenProgress = Math.min(V, Math.max(0, this.tweenProgress + r));
382
+ const O = $(this.tweenProgress, this.tweenFrom, T, V), f = Math.round(O - M);
383
+ for (let Q = 0; Q < f; Q++)
381
384
  this.particles.push(this.getParticle());
382
- this.particlesGenerated += b;
385
+ this.particlesGenerated += f;
383
386
  }
384
- w && (c.font = "12px sans-serif", c.fillStyle = "#333", c.textAlign = "right", c.fillText(`Particles: ${U}`, n.width - 10, n.height - 20));
385
- for (let F = this.particles.length - 1; F >= 0; F--) {
386
- const b = this.particles[F];
387
- b.update(r), (b.y > n.height || b.y < -100 || b.x > n.width + 100 || b.x < -100) && (N && S <= R ? this.particles[F] = this.getParticle() : this.removeParticleAt(F));
387
+ y && (l.font = "12px sans-serif", l.fillStyle = "#333", l.textAlign = "right", l.fillText(`Particles: ${U}`, n.width - 10, n.height - 20));
388
+ for (let O = this.particles.length - 1; O >= 0; O--) {
389
+ const f = this.particles[O];
390
+ f.update(r), (f.y > n.height || f.y < -100 || f.x > n.width + 100 || f.x < -100) && (C && M <= T ? this.particles[O] = this.getParticle() : this.removeParticleAt(O));
388
391
  }
389
- return U > 0 || S < R;
390
- }, this.canvas = t;
392
+ return U > 0 || M < T;
393
+ }, this.canvas = e;
391
394
  const i = this.canvas.getContext("2d");
392
395
  if (!i)
393
396
  throw new Error("Could not get canvas context");
394
- this.context = i, this.getOptions = e;
397
+ this.context = i, this.getOptions = t;
395
398
  }
396
399
  }
397
- const St = {
400
+ const ze = {
398
401
  width: typeof window < "u" ? window.innerWidth : 300,
399
402
  height: typeof window < "u" ? window.innerHeight : 200,
400
403
  numberOfPieces: 200,
@@ -424,13 +427,13 @@ const St = {
424
427
  ],
425
428
  opacity: 1,
426
429
  debug: !1,
427
- tweenFunction: te.easeInOutQuad,
430
+ tweenFunction: ft.easeInOutQuad,
428
431
  tweenDuration: 5e3,
429
432
  recycle: !0,
430
433
  run: !0
431
434
  };
432
- class oe {
433
- constructor(t, e) {
435
+ class yt {
436
+ constructor(e, t) {
434
437
  this.lastFrameTime = 0, this.setOptionsWithDefaults = (r) => {
435
438
  const n = {
436
439
  confettiSource: {
@@ -442,55 +445,55 @@ class oe {
442
445
  };
443
446
  this._options = {
444
447
  ...n,
445
- ...St,
448
+ ...ze,
446
449
  ...r
447
450
  }, Object.assign(this, r.confettiSource);
448
451
  }, this.update = (r = 0) => {
449
- const { options: { run: n, onConfettiComplete: c, frameRate: l }, canvas: m, context: k } = this, N = Math.min(r - this.lastFrameTime, 50);
450
- if (l && N < 1e3 / l) {
452
+ const { options: { run: n, onConfettiComplete: l, frameRate: c }, canvas: m, context: N } = this, C = Math.min(r - this.lastFrameTime, 50);
453
+ if (c && C < 1e3 / c) {
451
454
  this.rafId = requestAnimationFrame(this.update);
452
455
  return;
453
456
  }
454
- this.lastFrameTime = r - (l ? N % l : 0), n && (k.fillStyle = "white", k.clearRect(0, 0, m.width, m.height)), this.generator.animate(N) ? this.rafId = requestAnimationFrame(this.update) : (c && typeof c == "function" && this.generator.particlesGenerated > 0 && c.call(this, this), this._options.run = !1);
457
+ this.lastFrameTime = r - (c ? C % c : 0), n && (N.fillStyle = "white", N.clearRect(0, 0, m.width, m.height)), this.generator.animate(C) ? this.rafId = requestAnimationFrame(this.update) : (l && typeof l == "function" && this.generator.particlesGenerated > 0 && l.call(this, this), this._options.run = !1);
455
458
  }, this.reset = () => {
456
459
  this.generator && this.generator.particlesGenerated > 0 && (this.generator.particlesGenerated = 0, this.generator.particles = [], this.generator.lastNumberOfPieces = 0);
457
460
  }, this.stop = () => {
458
461
  this.options = { run: !1 }, this.rafId && (cancelAnimationFrame(this.rafId), this.rafId = void 0);
459
- }, this.canvas = t;
462
+ }, this.canvas = e;
460
463
  const i = this.canvas.getContext("2d");
461
464
  if (!i)
462
465
  throw new Error("Could not get canvas context");
463
- this.context = i, this.generator = new ae(this.canvas, () => this.options), this.options = e, this.update();
466
+ this.context = i, this.generator = new wt(this.canvas, () => this.options), this.options = t, this.update();
464
467
  }
465
468
  get options() {
466
469
  return this._options;
467
470
  }
468
- set options(t) {
471
+ set options(e) {
469
472
  var r, n;
470
- const e = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
471
- this.setOptionsWithDefaults(t), this.generator && (Object.assign(this.generator, this.options.confettiSource), typeof t.recycle == "boolean" && t.recycle && i === !1 && (this.generator.lastNumberOfPieces = this.generator.particles.length)), typeof t.run == "boolean" && t.run && e === !1 && this.update();
473
+ const t = (r = this._options) == null ? void 0 : r.run, i = (n = this._options) == null ? void 0 : n.recycle;
474
+ 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();
472
475
  }
473
476
  }
474
- const se = wt.createRef();
475
- class Pt extends wt.Component {
476
- constructor(t) {
477
- super(t), this.canvas = wt.createRef(), this.canvas = t.canvasRef || se;
477
+ const gt = Se.createRef();
478
+ class We extends Se.Component {
479
+ constructor(e) {
480
+ super(e), this.canvas = Se.createRef(), this.canvas = e.canvasRef || gt;
478
481
  }
479
482
  componentDidMount() {
480
483
  if (this.canvas.current) {
481
- const t = Bt(this.props)[0];
482
- this.confetti = new oe(this.canvas.current, t);
484
+ const e = qe(this.props)[0];
485
+ this.confetti = new yt(this.canvas.current, e);
483
486
  }
484
487
  }
485
488
  componentDidUpdate() {
486
- const t = Bt(this.props)[0];
487
- this.confetti && (this.confetti.options = t);
489
+ const e = qe(this.props)[0];
490
+ this.confetti && (this.confetti.options = e);
488
491
  }
489
492
  componentWillUnmount() {
490
493
  this.confetti && this.confetti.stop(), this.confetti = void 0;
491
494
  }
492
495
  render() {
493
- const [t, e] = Bt(this.props), i = {
496
+ const [e, t] = qe(this.props), i = {
494
497
  zIndex: 2,
495
498
  position: "absolute",
496
499
  pointerEvents: "none",
@@ -498,45 +501,45 @@ class Pt extends wt.Component {
498
501
  left: 0,
499
502
  bottom: 0,
500
503
  right: 0,
501
- ...e.style
504
+ ...t.style
502
505
  };
503
- return d("canvas", { width: t.width, height: t.height, ref: this.canvas, ...e, style: i });
506
+ return h("canvas", { width: e.width, height: e.height, ref: this.canvas, ...t, style: i });
504
507
  }
505
508
  }
506
- Pt.defaultProps = {
507
- ...St
509
+ We.defaultProps = {
510
+ ...ze
508
511
  };
509
- Pt.displayName = "ReactConfetti";
510
- function Bt(o) {
511
- const t = {}, e = {}, i = {}, r = [
512
- ...Object.keys(St),
512
+ We.displayName = "ReactConfetti";
513
+ function qe(a) {
514
+ const e = {}, t = {}, i = {}, r = [
515
+ ...Object.keys(ze),
513
516
  "confettiSource",
514
517
  "drawShape",
515
518
  "onConfettiComplete",
516
519
  "frameRate"
517
520
  ], n = ["canvasRef"];
518
- for (const c in o) {
519
- const l = o[c];
520
- r.includes(c) ? t[c] = l : n.includes(c) ? n[c] = l : i[c] = l;
521
+ for (const l in a) {
522
+ const c = a[l];
523
+ r.includes(l) ? e[l] = c : n.includes(l) ? n[l] = c : i[l] = c;
521
524
  }
522
- return [t, i, e];
525
+ return [e, i, t];
523
526
  }
524
- const ce = wt.forwardRef((o, t) => d(Pt, { canvasRef: t, ...o }));
527
+ const xt = Se.forwardRef((a, e) => h(We, { canvasRef: e, ...a }));
525
528
  /**
526
529
  * @license lucide-react v0.515.0 - ISC
527
530
  *
528
531
  * This source code is licensed under the ISC license.
529
532
  * See the LICENSE file in the root directory of this source tree.
530
533
  */
531
- const le = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ue = (o) => o.replace(
534
+ const Ct = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), It = (a) => a.replace(
532
535
  /^([A-Z])|[\s-_]+(\w)/g,
533
- (t, e, i) => i ? i.toUpperCase() : e.toLowerCase()
534
- ), Wt = (o) => {
535
- const t = ue(o);
536
- return t.charAt(0).toUpperCase() + t.slice(1);
537
- }, zt = (...o) => o.filter((t, e, i) => !!t && t.trim() !== "" && i.indexOf(t) === e).join(" ").trim(), he = (o) => {
538
- for (const t in o)
539
- if (t.startsWith("aria-") || t === "role" || t === "title")
536
+ (e, t, i) => i ? i.toUpperCase() : t.toLowerCase()
537
+ ), He = (a) => {
538
+ const e = It(a);
539
+ return e.charAt(0).toUpperCase() + e.slice(1);
540
+ }, et = (...a) => a.filter((e, t, i) => !!e && e.trim() !== "" && i.indexOf(e) === t).join(" ").trim(), Bt = (a) => {
541
+ for (const e in a)
542
+ if (e.startsWith("aria-") || e === "role" || e === "title")
540
543
  return !0;
541
544
  };
542
545
  /**
@@ -545,7 +548,7 @@ const le = (o) => o.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ue = (
545
548
  * This source code is licensed under the ISC license.
546
549
  * See the LICENSE file in the root directory of this source tree.
547
550
  */
548
- var de = {
551
+ var Nt = {
549
552
  xmlns: "http://www.w3.org/2000/svg",
550
553
  width: 24,
551
554
  height: 24,
@@ -562,31 +565,31 @@ var de = {
562
565
  * This source code is licensed under the ISC license.
563
566
  * See the LICENSE file in the root directory of this source tree.
564
567
  */
565
- const fe = Et(
568
+ const St = Je(
566
569
  ({
567
- color: o = "currentColor",
568
- size: t = 24,
569
- strokeWidth: e = 2,
570
+ color: a = "currentColor",
571
+ size: e = 24,
572
+ strokeWidth: t = 2,
570
573
  absoluteStrokeWidth: i,
571
574
  className: r = "",
572
575
  children: n,
573
- iconNode: c,
574
- ...l
575
- }, m) => Tt(
576
+ iconNode: l,
577
+ ...c
578
+ }, m) => De(
576
579
  "svg",
577
580
  {
578
581
  ref: m,
579
- ...de,
580
- width: t,
581
- height: t,
582
- stroke: o,
583
- strokeWidth: i ? Number(e) * 24 / Number(t) : e,
584
- className: zt("lucide", r),
585
- ...!n && !he(l) && { "aria-hidden": "true" },
586
- ...l
582
+ ...Nt,
583
+ width: e,
584
+ height: e,
585
+ stroke: a,
586
+ strokeWidth: i ? Number(t) * 24 / Number(e) : t,
587
+ className: et("lucide", r),
588
+ ...!n && !Bt(c) && { "aria-hidden": "true" },
589
+ ...c
587
590
  },
588
591
  [
589
- ...c.map(([k, N]) => Tt(k, N)),
592
+ ...l.map(([N, C]) => De(N, C)),
590
593
  ...Array.isArray(n) ? n : [n]
591
594
  ]
592
595
  )
@@ -597,20 +600,20 @@ const fe = Et(
597
600
  * This source code is licensed under the ISC license.
598
601
  * See the LICENSE file in the root directory of this source tree.
599
602
  */
600
- const me = (o, t) => {
601
- const e = Et(
602
- ({ className: i, ...r }, n) => Tt(fe, {
603
+ const Tt = (a, e) => {
604
+ const t = Je(
605
+ ({ className: i, ...r }, n) => De(St, {
603
606
  ref: n,
604
- iconNode: t,
605
- className: zt(
606
- `lucide-${le(Wt(o))}`,
607
- `lucide-${o}`,
607
+ iconNode: e,
608
+ className: et(
609
+ `lucide-${Ct(He(a))}`,
610
+ `lucide-${a}`,
608
611
  i
609
612
  ),
610
613
  ...r
611
614
  })
612
615
  );
613
- return e.displayName = Wt(o), e;
616
+ return t.displayName = He(a), t;
614
617
  };
615
618
  /**
616
619
  * @license lucide-react v0.515.0 - ISC
@@ -618,255 +621,273 @@ const me = (o, t) => {
618
621
  * This source code is licensed under the ISC license.
619
622
  * See the LICENSE file in the root directory of this source tree.
620
623
  */
621
- const pe = [
624
+ const Mt = [
622
625
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
623
626
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
624
- ], be = me("search", pe), _e = "_backdrop_1ctfr_1", ve = "_backdropOpen_1ctfr_14", ge = "_backdropClosed_1ctfr_18", we = "_panel_1ctfr_22", ye = "_panelOpen_1ctfr_42", xe = "_panelClosed_1ctfr_46", Ie = "_header_1ctfr_81", Ce = "_headerCenter_1ctfr_90", Be = "_title_1ctfr_98", Te = "_searchIconButton_1ctfr_107", Ne = "_headerTitleWrap_1ctfr_129", Se = "_headerSearchWrap_1ctfr_133", Pe = "_headerSearchOpen_1ctfr_145", Me = "_searchBar_1ctfr_157", Oe = "_searchInput_1ctfr_169", ke = "_searchClearButton_1ctfr_190", Fe = "_closeButton_1ctfr_212", Re = "_body_1ctfr_245", Ae = "_muted_1ctfr_250", qe = "_error_1ctfr_255", De = "_variants_1ctfr_260", Le = "_variantList_1ctfr_264", We = "_variantRow_1ctfr_272", Ee = "_variantLeft_1ctfr_280", Ve = "_addToBundleButton_1ctfr_287", ze = "_variantThumb_1ctfr_315", $e = "_variantThumbImg_1ctfr_325", je = "_variantThumbFallback_1ctfr_332", Ue = "_variantInfo_1ctfr_342", Qe = "_variantName_1ctfr_346", Ye = "_variantMeta_1ctfr_355", Ge = "_variantPriceRow_1ctfr_363", He = "_variantCompareAt_1ctfr_370", Ke = "_variantPrice_1ctfr_363", Xe = "_qtyControls_1ctfr_381", Ze = "_qtyButton_1ctfr_387", Je = "_qtyValue_1ctfr_412", tn = "_footer_1ctfr_419", en = "_boxSummaryWindow_1ctfr_426", nn = "_boxSummaryRow_1ctfr_443", rn = "_boxSlot_1ctfr_451", an = "_boxItem_1ctfr_459", on = "_boxItemClickable_1ctfr_471", sn = "_boxThresholdLabel_1ctfr_480", cn = "_boxItemPlaceholder_1ctfr_491", ln = "_boxItemFilled_1ctfr_497", un = "_boxItemThreshold_1ctfr_503", hn = "_boxItemDiscountText_1ctfr_511", dn = "_boxItemPlus_1ctfr_519", fn = "_boxItemImage_1ctfr_526", mn = "_boxItemFallback_1ctfr_533", pn = "_cta_1ctfr_544", bn = "_ctaTotals_1ctfr_556", _n = "_ctaDiscountBadge_1ctfr_564", vn = "_ctaTotalsWrap_1ctfr_578", gn = "_ctaTotalsWrapVisible_1ctfr_591", wn = "_ctaTotalsStrike_1ctfr_598", yn = "_ctaTotalsPrice_1ctfr_605", u = {
625
- backdrop: _e,
626
- backdropOpen: ve,
627
- backdropClosed: ge,
628
- panel: we,
629
- panelOpen: ye,
630
- panelClosed: xe,
631
- header: Ie,
632
- headerCenter: Ce,
633
- title: Be,
634
- searchIconButton: Te,
635
- headerTitleWrap: Ne,
636
- headerSearchWrap: Se,
637
- headerSearchOpen: Pe,
638
- searchBar: Me,
639
- searchInput: Oe,
640
- searchClearButton: ke,
641
- closeButton: Fe,
642
- body: Re,
643
- muted: Ae,
644
- error: qe,
645
- variants: De,
646
- variantList: Le,
647
- variantRow: We,
648
- variantLeft: Ee,
649
- addToBundleButton: Ve,
650
- variantThumb: ze,
651
- variantThumbImg: $e,
652
- variantThumbFallback: je,
653
- variantInfo: Ue,
654
- variantName: Qe,
655
- variantMeta: Ye,
656
- variantPriceRow: Ge,
657
- variantCompareAt: He,
658
- variantPrice: Ke,
659
- qtyControls: Xe,
660
- qtyButton: Ze,
661
- qtyValue: Je,
662
- footer: tn,
663
- boxSummaryWindow: en,
664
- boxSummaryRow: nn,
665
- boxSlot: rn,
666
- boxItem: an,
667
- boxItemClickable: on,
668
- boxThresholdLabel: sn,
669
- boxItemPlaceholder: cn,
670
- boxItemFilled: ln,
671
- boxItemThreshold: un,
672
- boxItemDiscountText: hn,
673
- boxItemPlus: dn,
674
- boxItemImage: fn,
675
- boxItemFallback: mn,
676
- cta: pn,
677
- ctaTotals: bn,
678
- ctaDiscountBadge: _n,
679
- ctaTotalsWrap: vn,
680
- ctaTotalsWrapVisible: gn,
681
- ctaTotalsStrike: wn,
682
- ctaTotalsPrice: yn
627
+ ], jt = Tt("search", Mt), Pt = "_backdrop_jv9mc_1", Ot = "_celebrationOverlay_jv9mc_14", Ft = "_celebrationChip_jv9mc_23", kt = "_backdropOpen_jv9mc_74", Rt = "_backdropClosed_jv9mc_78", qt = "_panel_jv9mc_82", At = "_panelOpen_jv9mc_102", Dt = "_panelClosed_jv9mc_106", Lt = "_header_jv9mc_145", zt = "_headerCenter_jv9mc_154", Wt = "_title_jv9mc_162", Et = "_searchIconButton_jv9mc_171", $t = "_headerTitleWrap_jv9mc_193", Vt = "_headerSearchWrap_jv9mc_197", Ut = "_headerSearchOpen_jv9mc_209", Qt = "_searchBar_jv9mc_221", Yt = "_searchInput_jv9mc_233", Gt = "_searchClearButton_jv9mc_254", Kt = "_closeButton_jv9mc_276", Ht = "_body_jv9mc_309", Xt = "_muted_jv9mc_314", Jt = "_error_jv9mc_319", Zt = "_variants_jv9mc_324", en = "_variantList_jv9mc_328", tn = "_variantRow_jv9mc_336", nn = "_variantLeft_jv9mc_344", rn = "_addToBundleButton_jv9mc_351", an = "_variantThumb_jv9mc_379", on = "_variantThumbImg_jv9mc_389", sn = "_variantThumbFallback_jv9mc_396", cn = "_variantInfo_jv9mc_406", ln = "_variantName_jv9mc_410", un = "_variantMeta_jv9mc_419", dn = "_variantPriceRow_jv9mc_427", hn = "_variantCompareAt_jv9mc_434", mn = "_variantPrice_jv9mc_427", fn = "_qtyControls_jv9mc_445", pn = "_qtyButton_jv9mc_451", vn = "_qtyValue_jv9mc_476", bn = "_footer_jv9mc_483", _n = "_boxSummaryWindow_jv9mc_490", wn = "_boxSummaryRow_jv9mc_507", yn = "_boxSlot_jv9mc_515", gn = "_boxItem_jv9mc_523", xn = "_boxItemClickable_jv9mc_535", Cn = "_boxThresholdLabel_jv9mc_544", In = "_boxItemPlaceholder_jv9mc_555", Bn = "_boxItemFilled_jv9mc_561", Nn = "_boxItemThreshold_jv9mc_567", Sn = "_boxItemDiscountText_jv9mc_575", Tn = "_boxItemPlus_jv9mc_583", Mn = "_boxItemImage_jv9mc_590", jn = "_boxItemFallback_jv9mc_597", Pn = "_cta_jv9mc_608", On = "_ctaTotals_jv9mc_620", Fn = "_ctaDiscountBadge_jv9mc_628", kn = "_ctaTotalsWrap_jv9mc_642", Rn = "_ctaTotalsWrapVisible_jv9mc_655", qn = "_ctaTotalsStrike_jv9mc_662", An = "_ctaTotalsPrice_jv9mc_669", u = {
628
+ backdrop: Pt,
629
+ celebrationOverlay: Ot,
630
+ celebrationChip: Ft,
631
+ backdropOpen: kt,
632
+ backdropClosed: Rt,
633
+ panel: qt,
634
+ panelOpen: At,
635
+ panelClosed: Dt,
636
+ header: Lt,
637
+ headerCenter: zt,
638
+ title: Wt,
639
+ searchIconButton: Et,
640
+ headerTitleWrap: $t,
641
+ headerSearchWrap: Vt,
642
+ headerSearchOpen: Ut,
643
+ searchBar: Qt,
644
+ searchInput: Yt,
645
+ searchClearButton: Gt,
646
+ closeButton: Kt,
647
+ body: Ht,
648
+ muted: Xt,
649
+ error: Jt,
650
+ variants: Zt,
651
+ variantList: en,
652
+ variantRow: tn,
653
+ variantLeft: nn,
654
+ addToBundleButton: rn,
655
+ variantThumb: an,
656
+ variantThumbImg: on,
657
+ variantThumbFallback: sn,
658
+ variantInfo: cn,
659
+ variantName: ln,
660
+ variantMeta: un,
661
+ variantPriceRow: dn,
662
+ variantCompareAt: hn,
663
+ variantPrice: mn,
664
+ qtyControls: fn,
665
+ qtyButton: pn,
666
+ qtyValue: vn,
667
+ footer: bn,
668
+ boxSummaryWindow: _n,
669
+ boxSummaryRow: wn,
670
+ boxSlot: yn,
671
+ boxItem: gn,
672
+ boxItemClickable: xn,
673
+ boxThresholdLabel: Cn,
674
+ boxItemPlaceholder: In,
675
+ boxItemFilled: Bn,
676
+ boxItemThreshold: Nn,
677
+ boxItemDiscountText: Sn,
678
+ boxItemPlus: Tn,
679
+ boxItemImage: Mn,
680
+ boxItemFallback: jn,
681
+ cta: Pn,
682
+ ctaTotals: On,
683
+ ctaDiscountBadge: Fn,
684
+ ctaTotalsWrap: kn,
685
+ ctaTotalsWrapVisible: Rn,
686
+ ctaTotalsStrike: qn,
687
+ ctaTotalsPrice: An
683
688
  };
684
- function Nn(o) {
685
- var qt;
689
+ function Qn(a) {
690
+ var Ye;
686
691
  const {
687
- isOpen: t,
688
- close: e,
692
+ isOpen: e,
693
+ close: t,
689
694
  loading: i,
690
695
  submitting: r,
691
696
  error: n,
692
- currencyCode: c,
693
- config: l,
697
+ currencyCode: l,
698
+ config: c,
694
699
  eligibleVariants: m,
695
- selections: k,
696
- selectionOrder: N,
697
- setQuantity: R,
698
- bundleSize: w,
700
+ selections: N,
701
+ selectionOrder: C,
702
+ setQuantity: T,
703
+ bundleSize: y,
699
704
  minRequired: $,
700
- canSubmit: j,
705
+ canSubmit: V,
701
706
  submit: U
702
- } = Nt(), [S, F] = O(!1), [b, Q] = O(""), rt = V(null), it = V(null), [K, ft] = O(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [mt, pt] = O(0), [X, bt] = O(null), [_t, Z] = O(!1), A = V(null), ct = V(w), at = 7e3, J = (a) => {
703
- const s = (a ?? []).filter((h) => {
704
- var v, _;
705
- const p = (v = h == null ? void 0 : h.name) == null ? void 0 : v.trim(), f = (_ = h == null ? void 0 : h.value) == null ? void 0 : _.trim();
706
- return !(!p || !f || p.toLowerCase() === "title");
707
+ } = Le(), [M, O] = B(!1), [f, Q] = B(""), ae = L(null), le = L(null), ue = L(null), [J, ge] = B(() => typeof window > "u" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }), [xe, oe] = B(0), [de, Ce] = B(null), [Ie, Z] = B(!1), R = L(null), he = L(y), ee = 7e3, [te, se] = B(0), [ne, Te] = B(null), [w, S] = B(!1), j = L(null), _ = 2800, F = (o) => {
708
+ const s = Number.parseFloat(o);
709
+ return Number.isFinite(s) ? String(Math.round(s)) : o;
710
+ }, K = (o) => {
711
+ const s = (o ?? []).filter((d) => {
712
+ var g, b;
713
+ const v = (g = d == null ? void 0 : d.name) == null ? void 0 : g.trim(), p = (b = d == null ? void 0 : d.value) == null ? void 0 : b.trim();
714
+ return !(!v || !p || v.toLowerCase() === "title");
707
715
  });
708
- return s.length ? s.map((h) => `${h.name}: ${h.value}`).join(" · ") : null;
709
- }, tt = (a) => {
716
+ return s.length ? s.map((d) => `${d.name}: ${d.value}`).join(" · ") : null;
717
+ }, Be = (o) => {
710
718
  var s;
711
- return ((s = a.product) == null ? void 0 : s.title) ?? a.displayName ?? a.title;
712
- }, vt = (a) => {
713
- const s = tt(a), h = J(a.selectedOptions);
714
- return [s, h].filter(Boolean).join(" — ");
715
- }, [yt, y] = O(t), x = V(null), C = (a) => {
716
- const s = Number(a);
717
- if (!Number.isFinite(s)) return a;
718
- if (c)
719
+ return ((s = o.product) == null ? void 0 : s.title) ?? o.displayName ?? o.title;
720
+ }, re = (o) => {
721
+ const s = Be(o), d = K(o.selectedOptions);
722
+ return [s, d].filter(Boolean).join(" — ");
723
+ }, [me, H] = B(e), A = L(null), W = (o) => {
724
+ const s = Number(o);
725
+ if (!Number.isFinite(s)) return o;
726
+ if (l)
719
727
  try {
720
- return new Intl.NumberFormat(void 0, { style: "currency", currency: c }).format(s);
728
+ return new Intl.NumberFormat(void 0, { style: "currency", currency: l }).format(s);
721
729
  } catch {
722
730
  }
723
731
  return `$${s.toFixed(2)}`;
724
- }, g = ((qt = l == null ? void 0 : l.title) == null ? void 0 : qt.trim()) || "Build your bundle", M = T(() => [...m].sort((a, s) => a.displayName.localeCompare(s.displayName)), [m]), G = T(() => {
725
- const a = b.trim().toLowerCase();
726
- if (!a) return M;
727
- const s = a.split(/\s+/).filter(Boolean), h = (p) => {
728
- var _;
729
- const f = [];
730
- f.push(p.displayName), (_ = p.product) != null && _.title && f.push(p.product.title);
731
- for (const B of p.selectedOptions ?? [])
732
- f.push(B.name), f.push(B.value);
733
- const v = f.join(" ").toLowerCase();
734
- return s.every((B) => v.includes(B));
732
+ }, Y = ((Ye = c == null ? void 0 : c.title) == null ? void 0 : Ye.trim()) || "Build your bundle", fe = I(() => {
733
+ const o = Number((c == null ? void 0 : c.maxBundleSize) ?? NaN), s = Number.isFinite(o) ? Math.floor(o) : 100;
734
+ return Math.max(2, Math.min(100, s));
735
+ }, [c == null ? void 0 : c.maxBundleSize]), pe = y >= fe, Me = I(() => [...m].sort((o, s) => o.displayName.localeCompare(s.displayName)), [m]), tt = I(() => {
736
+ const o = f.trim().toLowerCase();
737
+ if (!o) return Me;
738
+ const s = o.split(/\s+/).filter(Boolean), d = (v) => {
739
+ var b;
740
+ const p = [];
741
+ p.push(v.displayName), (b = v.product) != null && b.title && p.push(v.product.title);
742
+ for (const x of v.selectedOptions ?? [])
743
+ p.push(x.name), p.push(x.value);
744
+ const g = p.join(" ").toLowerCase();
745
+ return s.every((x) => g.includes(x));
735
746
  };
736
- return M.filter(h);
737
- }, [b, M]), I = T(() => [...(l == null ? void 0 : l.rules) ?? []].sort((a, s) => a.minBundleSize - s.minBundleSize), [l == null ? void 0 : l.rules]), L = T(() => Math.max(0, $ - w), [w, $]), et = T(() => {
738
- let a = null;
739
- for (const s of I)
740
- w >= s.minBundleSize && (a = s);
741
- return a;
742
- }, [w, I]), D = T(() => {
743
- if (!et) return null;
744
- const a = Number.parseFloat(et.discountPercent);
745
- return !Number.isFinite(a) || a <= 0 ? null : a;
746
- }, [et]), lt = T(() => {
747
- const a = I[0];
748
- if (!a) return null;
749
- const s = Number.parseFloat(a.discountPercent);
747
+ return Me.filter(d);
748
+ }, [f, Me]), k = I(() => [...(c == null ? void 0 : c.rules) ?? []].sort((o, s) => o.minBundleSize - s.minBundleSize), [c == null ? void 0 : c.rules]), ve = I(() => Math.max(0, $ - y), [y, $]), je = I(() => {
749
+ let o = null;
750
+ for (const s of k)
751
+ y >= s.minBundleSize && (o = s);
752
+ return o;
753
+ }, [y, k]), be = I(() => {
754
+ if (!je) return null;
755
+ const o = Number.parseFloat(je.discountPercent);
756
+ return !Number.isFinite(o) || o <= 0 ? null : o;
757
+ }, [je]), nt = I(() => {
758
+ const o = k[0];
759
+ if (!o) return null;
760
+ const s = Number.parseFloat(o.discountPercent);
750
761
  return !Number.isFinite(s) || s <= 0 ? null : s;
751
- }, [I]), ot = D ?? lt, ut = T(() => {
752
- const a = new Map(m.map((h) => [h.id, h]));
762
+ }, [k]), Pe = be ?? nt, _e = I(() => {
763
+ const o = new Map(m.map((d) => [d.id, d]));
753
764
  let s = 0;
754
- for (const [h, p] of Object.entries(k)) {
755
- const f = p ?? 0;
756
- if (f <= 0) continue;
757
- const v = a.get(h), _ = Number(v == null ? void 0 : v.price);
758
- Number.isFinite(_) && (s += _ * f);
765
+ for (const [d, v] of Object.entries(N)) {
766
+ const p = v ?? 0;
767
+ if (p <= 0) continue;
768
+ const g = o.get(d), b = Number(g == null ? void 0 : g.price);
769
+ Number.isFinite(b) && (s += b * p);
759
770
  }
760
771
  return Math.round(s * 100) / 100;
761
- }, [m, k]), $t = T(() => {
762
- if (!D) return ut;
763
- const a = ut * (1 - D / 100);
764
- return Math.round(a * 100) / 100;
765
- }, [D, ut]), Mt = T(() => I.length ? Math.max(...I.map((a) => a.minBundleSize)) : 0, [I]), xt = T(() => {
766
- const a = new Map(m.map((s) => [s.id, s]));
767
- return N.map((s) => a.get(s)).filter((s) => !!s);
768
- }, [m, N]), jt = T(() => {
772
+ }, [m, N]), rt = I(() => {
773
+ if (!be) return _e;
774
+ const o = _e * (1 - be / 100);
775
+ return Math.round(o * 100) / 100;
776
+ }, [be, _e]), Ee = I(() => k.length ? Math.max(...k.map((o) => o.minBundleSize)) : 0, [k]), Oe = I(() => {
777
+ const o = new Map(m.map((s) => [s.id, s]));
778
+ return C.map((s) => o.get(s)).filter((s) => !!s);
779
+ }, [m, C]), it = I(() => {
769
780
  var s;
770
- const a = /* @__PURE__ */ new Map();
771
- for (const h of I) {
772
- const p = Math.max(0, h.minBundleSize - 1);
773
- a.set(p, {
774
- discountPercent: h.discountPercent,
775
- minBundleSize: h.minBundleSize,
776
- label: ((s = h.label) == null ? void 0 : s.trim()) || `Buy ${h.minBundleSize}+`
781
+ const o = /* @__PURE__ */ new Map();
782
+ for (const d of k) {
783
+ const v = Math.max(0, d.minBundleSize - 1);
784
+ o.set(v, {
785
+ discountPercent: d.discountPercent,
786
+ minBundleSize: d.minBundleSize,
787
+ label: ((s = d.label) == null ? void 0 : s.trim()) || `Buy ${d.minBundleSize}+`
777
788
  });
778
789
  }
779
- return a;
780
- }, [I]), Ut = T(() => Math.max(Mt || $, xt.length), [xt.length, Mt, $]), Ot = V(null), kt = V(null), Ft = V(null), Rt = V(w), At = (a) => {
781
- const s = kt.current;
790
+ return o;
791
+ }, [k]), at = I(() => Math.max(Ee || $, Oe.length), [Oe.length, Ee, $]), Fe = L(null), $e = L(null), Ve = L(null), Ue = L(y), Qe = (o) => {
792
+ const s = $e.current;
782
793
  if (!s) return;
783
- const h = s.querySelector(`[data-variant-row="${a}"]`);
784
- if (!h) return;
785
- const p = s.getBoundingClientRect(), f = h.getBoundingClientRect(), v = 8;
786
- if (f.top >= p.top + v && f.bottom <= p.bottom - v) return;
787
- const B = Math.max(0, s.scrollHeight - s.clientHeight), W = f.top - p.top + f.height / 2, E = s.scrollTop + W - s.clientHeight / 2, Y = Math.min(B, Math.max(0, E));
788
- s.scrollTo({ top: Y, behavior: "smooth" });
794
+ const d = s.querySelector(`[data-variant-row="${o}"]`);
795
+ if (!d) return;
796
+ const v = s.getBoundingClientRect(), p = d.getBoundingClientRect(), g = 8;
797
+ if (p.top >= v.top + g && p.bottom <= v.bottom - g) return;
798
+ const x = Math.max(0, s.scrollHeight - s.clientHeight), D = p.top - v.top + p.height / 2, E = s.scrollTop + D - s.clientHeight / 2, G = Math.min(x, Math.max(0, E));
799
+ s.scrollTo({ top: G, behavior: "smooth" });
789
800
  };
790
801
  return z(() => {
791
- if (!t) return;
792
- const a = (s) => {
793
- s.key === "Escape" && e();
802
+ if (!e) return;
803
+ const o = (s) => {
804
+ s.key === "Escape" && t();
794
805
  };
795
- return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
796
- }, [e, t]), z(() => {
806
+ return window.addEventListener("keydown", o), () => window.removeEventListener("keydown", o);
807
+ }, [t, e]), z(() => {
797
808
  if (typeof window > "u") return;
798
- const a = () => ft({ width: window.innerWidth, height: window.innerHeight });
799
- return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
809
+ const o = () => ge({ width: window.innerWidth, height: window.innerHeight });
810
+ return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
800
811
  }, []), z(() => {
801
- if (x.current != null && (window.clearTimeout(x.current), x.current = null), t) {
802
- y(!0);
812
+ if (A.current != null && (window.clearTimeout(A.current), A.current = null), e) {
813
+ H(!0);
803
814
  return;
804
815
  }
805
- x.current = window.setTimeout(() => {
806
- y(!1), x.current = null;
816
+ A.current = window.setTimeout(() => {
817
+ H(!1), A.current = null;
807
818
  }, 220);
808
- }, [t]), z(() => () => {
809
- x.current != null && window.clearTimeout(x.current);
810
- }, []), z(() => () => {
819
+ }, [e]), z(() => () => {
811
820
  A.current != null && window.clearTimeout(A.current);
821
+ }, []), z(() => () => {
822
+ R.current != null && window.clearTimeout(R.current);
823
+ }, []), z(() => () => {
824
+ j.current != null && window.clearTimeout(j.current);
812
825
  }, []), z(() => {
813
- if (!t || !S) return;
814
- const a = requestAnimationFrame(() => {
826
+ if (!e || !M) return;
827
+ const o = requestAnimationFrame(() => {
815
828
  var s;
816
- return (s = rt.current) == null ? void 0 : s.focus();
829
+ return (s = ae.current) == null ? void 0 : s.focus();
817
830
  });
818
- return () => cancelAnimationFrame(a);
819
- }, [t, S]), z(() => {
820
- const a = Rt.current;
821
- if (Rt.current = w, w <= a) return;
822
- const s = Ft.current;
831
+ return () => cancelAnimationFrame(o);
832
+ }, [e, M]), z(() => {
833
+ const o = Ue.current;
834
+ if (Ue.current = y, y <= o) return;
835
+ const s = Ve.current;
823
836
  if (!s) return;
824
- const h = I.some((_) => _.minBundleSize === w), p = I.find((_) => _.minBundleSize > w), f = p && h ? p.minBundleSize - 1 : p ? null : w - 1;
825
- if (f == null || f < 0) return;
826
- const v = requestAnimationFrame(() => {
827
- const _ = s.querySelector(`[data-box-slot="${f}"]`);
828
- if (!_) return;
829
- const B = s.getBoundingClientRect(), E = _.getBoundingClientRect().right - B.right;
837
+ const d = k.some((b) => b.minBundleSize === y), v = k.find((b) => b.minBundleSize > y), p = v && d ? v.minBundleSize - 1 : v ? null : y - 1;
838
+ if (p == null || p < 0) return;
839
+ const g = requestAnimationFrame(() => {
840
+ const b = s.querySelector(`[data-box-slot="${p}"]`);
841
+ if (!b) return;
842
+ const x = s.getBoundingClientRect(), E = b.getBoundingClientRect().right - x.right;
830
843
  if (E <= 1) return;
831
- const Y = Math.max(0, s.scrollWidth - s.clientWidth), nt = Math.min(Y, Math.max(0, s.scrollLeft + E));
832
- s.scrollTo({ left: nt, behavior: "smooth" });
844
+ const G = Math.max(0, s.scrollWidth - s.clientWidth), ie = Math.min(G, Math.max(0, s.scrollLeft + E));
845
+ s.scrollTo({ left: ie, behavior: "smooth" });
833
846
  });
834
- return () => cancelAnimationFrame(v);
835
- }, [w, I]), z(() => {
836
- if (!t) return;
837
- const a = ct.current;
838
- if (ct.current = w, w <= a || !I.some((v) => v.minBundleSize === w)) return;
839
- const h = it.current;
840
- if (!h) return;
841
- const p = h.getBoundingClientRect(), f = {
842
- x: p.left + p.width / 2 - 2,
843
- y: p.top + 4,
844
- w: 4,
845
- h: 4
846
- };
847
- bt(f), pt((v) => v + 1), Z(!0), A.current != null && window.clearTimeout(A.current), A.current = window.setTimeout(() => {
848
- Z(!1), A.current = null;
849
- }, at);
850
- }, [w, t, I]), z(() => {
851
- var a;
852
- t && ((a = Ot.current) == null || a.focus());
853
- }, [t]), yt ? /* @__PURE__ */ P(
847
+ return () => cancelAnimationFrame(g);
848
+ }, [y, k]), z(() => {
849
+ if (!e) return;
850
+ const o = he.current;
851
+ if (he.current = y, y <= o) return;
852
+ const s = k.find((d) => d.minBundleSize === y);
853
+ s && (Te(`You received a ${F(s.discountPercent)}% discount!`), se((d) => d + 1), S(!0), j.current != null && window.clearTimeout(j.current), j.current = window.setTimeout(() => {
854
+ S(!1), j.current = null;
855
+ }, _));
856
+ }, [y, e, k]), z(() => {
857
+ if (!e || !w || !ne) return;
858
+ const o = requestAnimationFrame(() => {
859
+ var x;
860
+ const s = ue.current, d = s == null ? void 0 : s.getBoundingClientRect(), v = (x = Fe.current) == null ? void 0 : x.getBoundingClientRect(), p = d ? d.left + d.width / 2 : v ? v.left + v.width / 2 : window.innerWidth / 2, g = d ? d.top + d.height / 2 : v ? v.top + v.height / 2 : window.innerHeight / 2, b = {
861
+ x: p - 2,
862
+ y: g - 2,
863
+ w: 4,
864
+ h: 4
865
+ };
866
+ Ce(b), oe((D) => D + 1), Z(!0), R.current != null && window.clearTimeout(R.current), R.current = window.setTimeout(() => {
867
+ Z(!1), R.current = null;
868
+ }, ee);
869
+ });
870
+ return () => cancelAnimationFrame(o);
871
+ }, [te, ne, ee, w, e]), z(() => {
872
+ var o;
873
+ e && ((o = Fe.current) == null || o.focus());
874
+ }, [e]), me ? /* @__PURE__ */ P(
854
875
  "div",
855
876
  {
856
877
  role: "dialog",
857
878
  "aria-modal": "true",
858
879
  "aria-label": "Bundle builder",
859
- className: [u.backdrop, t ? u.backdropOpen : u.backdropClosed, o.className].filter(Boolean).join(" "),
860
- onMouseDown: (a) => {
861
- a.target === a.currentTarget && e();
880
+ className: [u.backdrop, e ? u.backdropOpen : u.backdropClosed, a.className].filter(Boolean).join(" "),
881
+ onMouseDown: (o) => {
882
+ o.target === o.currentTarget && t();
862
883
  },
863
884
  children: [
864
- _t && X && K.width > 0 && K.height > 0 ? /* @__PURE__ */ d(
865
- ce,
885
+ Ie && de && J.width > 0 && J.height > 0 ? /* @__PURE__ */ h(
886
+ xt,
866
887
  {
867
- width: K.width,
868
- height: K.height,
869
- confettiSource: X,
888
+ width: J.width,
889
+ height: J.height,
890
+ confettiSource: de,
870
891
  colors: [
871
892
  "#2563eb",
872
893
  // blue-600
@@ -887,53 +908,54 @@ function Nn(o) {
887
908
  gravity: 0.45,
888
909
  initialVelocityY: { min: -10, max: -30 },
889
910
  initialVelocityX: { min: -6, max: 6 },
890
- style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483647 }
911
+ style: { position: "fixed", inset: 0, pointerEvents: "none", zIndex: 2147483646 }
891
912
  },
892
- mt
913
+ xe
893
914
  ) : null,
894
- /* @__PURE__ */ P("aside", { ref: Ot, className: [u.panel, t ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
895
- /* @__PURE__ */ P("header", { className: [u.header, S ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
896
- /* @__PURE__ */ d(
915
+ /* @__PURE__ */ P("aside", { ref: Fe, className: [u.panel, e ? u.panelOpen : u.panelClosed].filter(Boolean).join(" "), tabIndex: -1, children: [
916
+ w && ne ? /* @__PURE__ */ h("div", { className: u.celebrationOverlay, "aria-hidden": "true", children: /* @__PURE__ */ h("div", { ref: ue, className: u.celebrationChip, children: ne }, te) }) : null,
917
+ /* @__PURE__ */ P("header", { className: [u.header, M ? u.headerSearchOpen : null].filter(Boolean).join(" "), children: [
918
+ /* @__PURE__ */ h(
897
919
  "button",
898
920
  {
899
921
  type: "button",
900
922
  className: u.searchIconButton,
901
- "aria-label": S ? "Search (expanded)" : "Search",
902
- "aria-expanded": S,
923
+ "aria-label": M ? "Search (expanded)" : "Search",
924
+ "aria-expanded": M,
903
925
  onClick: () => {
904
- F(!0);
926
+ O(!0);
905
927
  },
906
- children: /* @__PURE__ */ d(be, { size: 18, "aria-hidden": "true" })
928
+ children: /* @__PURE__ */ h(jt, { size: 18, "aria-hidden": "true" })
907
929
  }
908
930
  ),
909
931
  /* @__PURE__ */ P("div", { className: u.headerCenter, children: [
910
- /* @__PURE__ */ d("div", { className: u.headerTitleWrap, "aria-hidden": S, children: /* @__PURE__ */ d("h2", { className: u.title, children: g }) }),
911
- /* @__PURE__ */ d("div", { className: u.headerSearchWrap, "aria-hidden": !S, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
912
- /* @__PURE__ */ d(
932
+ /* @__PURE__ */ h("div", { className: u.headerTitleWrap, "aria-hidden": M, children: /* @__PURE__ */ h("h2", { className: u.title, children: Y }) }),
933
+ /* @__PURE__ */ h("div", { className: u.headerSearchWrap, "aria-hidden": !M, children: /* @__PURE__ */ P("div", { className: u.searchBar, children: [
934
+ /* @__PURE__ */ h(
913
935
  "input",
914
936
  {
915
- ref: rt,
937
+ ref: ae,
916
938
  className: u.searchInput,
917
939
  type: "search",
918
- value: b,
940
+ value: f,
919
941
  placeholder: "Search",
920
- onChange: (a) => Q(a.target.value),
942
+ onChange: (o) => Q(o.target.value),
921
943
  onBlur: () => {
922
- b.trim() === "" && F(!1);
944
+ f.trim() === "" && O(!1);
923
945
  }
924
946
  }
925
947
  ),
926
- b.trim() ? /* @__PURE__ */ d(
948
+ f.trim() ? /* @__PURE__ */ h(
927
949
  "button",
928
950
  {
929
951
  type: "button",
930
952
  className: u.searchClearButton,
931
- onMouseDown: (a) => {
932
- a.preventDefault();
953
+ onMouseDown: (o) => {
954
+ o.preventDefault();
933
955
  },
934
956
  onClick: () => {
935
- var a;
936
- Q(""), (a = rt.current) == null || a.focus();
957
+ var o;
958
+ Q(""), (o = ae.current) == null || o.focus();
937
959
  },
938
960
  "aria-label": "Clear search",
939
961
  children: "Clear"
@@ -941,143 +963,223 @@ function Nn(o) {
941
963
  ) : null
942
964
  ] }) })
943
965
  ] }),
944
- /* @__PURE__ */ d("button", { type: "button", onClick: e, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
966
+ /* @__PURE__ */ h("button", { type: "button", onClick: t, disabled: r, className: u.closeButton, "aria-label": "Close", children: "×" })
945
967
  ] }),
946
- /* @__PURE__ */ P("div", { className: u.body, ref: kt, children: [
947
- i ? /* @__PURE__ */ d("p", { className: u.muted, children: "Loading…" }) : null,
948
- n ? /* @__PURE__ */ d("p", { className: u.error, children: n }) : null,
949
- !i && l && !l.isActive ? /* @__PURE__ */ d("p", { className: u.error, children: "Bundles are not active." }) : null,
950
- /* @__PURE__ */ d("div", { className: u.variants, children: /* @__PURE__ */ d("ul", { className: u.variantList, children: G.map((a) => {
951
- var E, Y, nt, ht;
952
- const s = k[a.id] ?? 0, h = tt(a), p = J(a.selectedOptions), f = vt(a), v = ot, _ = Number(a.price), B = v != null && Number.isFinite(v) && v > 0 && Number.isFinite(_), W = B ? Math.round(_ * (1 - v / 100) * 100) / 100 : null;
953
- return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": a.id, children: [
968
+ /* @__PURE__ */ P("div", { className: u.body, ref: $e, children: [
969
+ i ? /* @__PURE__ */ h("p", { className: u.muted, children: "Loading…" }) : null,
970
+ n ? /* @__PURE__ */ h("p", { className: u.error, children: n }) : null,
971
+ !i && c && !c.isActive ? /* @__PURE__ */ h("p", { className: u.error, children: "Bundles are not active." }) : null,
972
+ /* @__PURE__ */ h("div", { className: u.variants, children: /* @__PURE__ */ h("ul", { className: u.variantList, children: tt.map((o) => {
973
+ var E, G, ie, we;
974
+ const s = N[o.id] ?? 0, d = Be(o), v = K(o.selectedOptions), p = re(o), g = Pe, b = Number(o.price), x = g != null && Number.isFinite(g) && g > 0 && Number.isFinite(b), D = x ? Math.round(b * (1 - g / 100) * 100) / 100 : null;
975
+ return /* @__PURE__ */ P("li", { className: u.variantRow, "data-variant-row": o.id, children: [
954
976
  /* @__PURE__ */ P("div", { className: u.variantLeft, children: [
955
- /* @__PURE__ */ d("div", { className: u.variantThumb, "aria-hidden": "true", children: (E = a.image) != null && E.url ? /* @__PURE__ */ d(
977
+ /* @__PURE__ */ h("div", { className: u.variantThumb, "aria-hidden": "true", children: (E = o.image) != null && E.url ? /* @__PURE__ */ h(
956
978
  "img",
957
979
  {
958
980
  className: u.variantThumbImg,
959
- src: a.image.url,
960
- alt: a.image.altText ?? f,
981
+ src: o.image.url,
982
+ alt: o.image.altText ?? p,
961
983
  loading: "lazy"
962
984
  }
963
- ) : /* @__PURE__ */ d("div", { className: u.variantThumbFallback, children: ((ht = (nt = (Y = a.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) }),
985
+ ) : /* @__PURE__ */ h("div", { className: u.variantThumbFallback, children: ((we = (ie = (G = o.product) == null ? void 0 : G.title) == null ? void 0 : ie.slice(0, 1)) == null ? void 0 : we.toUpperCase()) ?? "•" }) }),
964
986
  /* @__PURE__ */ P("div", { className: u.variantInfo, children: [
965
- /* @__PURE__ */ d("div", { className: u.variantName, children: h }),
966
- p ? /* @__PURE__ */ d("div", { className: u.variantMeta, children: p }) : null,
987
+ /* @__PURE__ */ h("div", { className: u.variantName, children: d }),
988
+ v ? /* @__PURE__ */ h("div", { className: u.variantMeta, children: v }) : null,
967
989
  /* @__PURE__ */ P("div", { className: u.variantPriceRow, children: [
968
- B ? /* @__PURE__ */ d("span", { className: u.variantCompareAt, children: C(Number.isFinite(_) ? _.toFixed(2) : a.price) }) : null,
969
- /* @__PURE__ */ d("span", { className: u.variantPrice, children: C(
970
- W != null ? W.toFixed(2) : Number.isFinite(_) ? _.toFixed(2) : a.price
990
+ x ? /* @__PURE__ */ h("span", { className: u.variantCompareAt, children: W(Number.isFinite(b) ? b.toFixed(2) : o.price) }) : null,
991
+ /* @__PURE__ */ h("span", { className: u.variantPrice, children: W(
992
+ D != null ? D.toFixed(2) : Number.isFinite(b) ? b.toFixed(2) : o.price
971
993
  ) })
972
994
  ] })
973
995
  ] })
974
996
  ] }),
975
- s <= 0 ? /* @__PURE__ */ d(
997
+ s <= 0 ? /* @__PURE__ */ h(
976
998
  "button",
977
999
  {
978
1000
  type: "button",
979
- onClick: () => R(a.id, 1),
980
- disabled: r,
1001
+ onClick: () => T(o.id, 1),
1002
+ disabled: r || pe,
981
1003
  className: u.addToBundleButton,
982
- "aria-label": `Add ${f} to bundle`,
1004
+ "aria-label": `Add ${p} to bundle`,
983
1005
  children: "Add"
984
1006
  }
985
1007
  ) : /* @__PURE__ */ P("div", { className: u.qtyControls, children: [
986
- /* @__PURE__ */ d(
1008
+ /* @__PURE__ */ h(
987
1009
  "button",
988
1010
  {
989
1011
  type: "button",
990
- onClick: () => R(a.id, s - 1),
1012
+ onClick: () => T(o.id, s - 1),
991
1013
  disabled: r || s <= 0,
992
1014
  className: u.qtyButton,
993
- "aria-label": `Decrease ${f}`,
1015
+ "aria-label": `Decrease ${p}`,
994
1016
  children: "−"
995
1017
  }
996
1018
  ),
997
- /* @__PURE__ */ d("span", { className: u.qtyValue, "aria-label": `Quantity ${s}`, children: s }),
998
- /* @__PURE__ */ d(
1019
+ /* @__PURE__ */ h("span", { className: u.qtyValue, "aria-label": `Quantity ${s}`, children: s }),
1020
+ /* @__PURE__ */ h(
999
1021
  "button",
1000
1022
  {
1001
1023
  type: "button",
1002
- onClick: () => R(a.id, s + 1),
1003
- disabled: r,
1024
+ onClick: () => T(o.id, s + 1),
1025
+ disabled: r || pe,
1004
1026
  className: u.qtyButton,
1005
- "aria-label": `Increase ${f}`,
1027
+ "aria-label": `Increase ${p}`,
1006
1028
  children: "+"
1007
1029
  }
1008
1030
  )
1009
1031
  ] })
1010
- ] }, a.id);
1032
+ ] }, o.id);
1011
1033
  }) }) })
1012
1034
  ] }),
1013
- /* @__PURE__ */ P("footer", { className: u.footer, ref: it, children: [
1014
- /* @__PURE__ */ d("div", { className: u.boxSummaryWindow, ref: Ft, children: /* @__PURE__ */ d("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: Ut }).map((a, s) => {
1015
- var E, Y, nt, ht;
1016
- const h = xt[s], p = jt.get(s), f = !!h, v = !!p, _ = v && !f, B = p ? `${p.discountPercent}% off` : null, W = f ? h.displayName : `Slot ${s + 1}`;
1035
+ /* @__PURE__ */ P("footer", { className: u.footer, ref: le, children: [
1036
+ /* @__PURE__ */ h("div", { className: u.boxSummaryWindow, ref: Ve, children: /* @__PURE__ */ h("div", { className: u.boxSummaryRow, "aria-label": "Bundle box summary", children: Array.from({ length: at }).map((o, s) => {
1037
+ var E, G, ie, we;
1038
+ const d = Oe[s], v = it.get(s), p = !!d, g = !!v, b = g && !p, x = v ? `${v.discountPercent}% off` : null, D = p ? d.displayName : `Slot ${s + 1}`;
1017
1039
  return /* @__PURE__ */ P("div", { "data-box-slot": s, className: u.boxSlot, children: [
1018
- /* @__PURE__ */ d(
1040
+ /* @__PURE__ */ h(
1019
1041
  "div",
1020
1042
  {
1021
1043
  className: [
1022
1044
  u.boxItem,
1023
- f ? u.boxItemFilled : u.boxItemPlaceholder,
1024
- v ? u.boxItemThreshold : null,
1025
- f ? u.boxItemClickable : null
1045
+ p ? u.boxItemFilled : u.boxItemPlaceholder,
1046
+ g ? u.boxItemThreshold : null,
1047
+ p ? u.boxItemClickable : null
1026
1048
  ].filter(Boolean).join(" "),
1027
- role: f ? "button" : void 0,
1028
- tabIndex: f ? 0 : void 0,
1029
- onClick: f ? () => At(h.id) : void 0,
1030
- onKeyDown: f ? (It) => {
1031
- (It.key === "Enter" || It.key === " ") && (It.preventDefault(), At(h.id));
1049
+ role: p ? "button" : void 0,
1050
+ tabIndex: p ? 0 : void 0,
1051
+ onClick: p ? () => Qe(d.id) : void 0,
1052
+ onKeyDown: p ? (ke) => {
1053
+ (ke.key === "Enter" || ke.key === " ") && (ke.preventDefault(), Qe(d.id));
1032
1054
  } : void 0,
1033
- "aria-label": _ && B ? `${W}. Unlocks ${B}.` : W,
1034
- title: _ && B ? `${W} • Unlocks ${B}` : W,
1035
- children: f ? (E = h.image) != null && E.url ? /* @__PURE__ */ d(
1055
+ "aria-label": b && x ? `${D}. Unlocks ${x}.` : D,
1056
+ title: b && x ? `${D} • Unlocks ${x}` : D,
1057
+ children: p ? (E = d.image) != null && E.url ? /* @__PURE__ */ h(
1036
1058
  "img",
1037
1059
  {
1038
1060
  className: u.boxItemImage,
1039
- src: h.image.url,
1040
- alt: h.image.altText ?? h.displayName,
1061
+ src: d.image.url,
1062
+ alt: d.image.altText ?? d.displayName,
1041
1063
  loading: "lazy"
1042
1064
  }
1043
- ) : /* @__PURE__ */ d("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((ht = (nt = (Y = h.product) == null ? void 0 : Y.title) == null ? void 0 : nt.slice(0, 1)) == null ? void 0 : ht.toUpperCase()) ?? "•" }) : _ && B ? /* @__PURE__ */ d("div", { className: u.boxItemDiscountText, children: B }) : /* @__PURE__ */ d("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1065
+ ) : /* @__PURE__ */ h("div", { className: u.boxItemFallback, "aria-hidden": "true", children: ((we = (ie = (G = d.product) == null ? void 0 : G.title) == null ? void 0 : ie.slice(0, 1)) == null ? void 0 : we.toUpperCase()) ?? "•" }) : b && x ? /* @__PURE__ */ h("div", { className: u.boxItemDiscountText, children: x }) : /* @__PURE__ */ h("div", { className: u.boxItemPlus, "aria-hidden": "true", children: "+" })
1044
1066
  }
1045
1067
  ),
1046
- v ? /* @__PURE__ */ d("div", { className: u.boxThresholdLabel, children: p.label }) : null
1068
+ g ? /* @__PURE__ */ h("div", { className: u.boxThresholdLabel, children: v.label }) : null
1047
1069
  ] }, s);
1048
1070
  }) }) }),
1049
- /* @__PURE__ */ d(
1071
+ /* @__PURE__ */ h(
1050
1072
  "div",
1051
1073
  {
1052
- className: [u.ctaTotalsWrap, L <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1053
- "aria-hidden": L > 0,
1074
+ className: [u.ctaTotalsWrap, ve <= 0 ? u.ctaTotalsWrapVisible : null].filter(Boolean).join(" "),
1075
+ "aria-hidden": ve > 0,
1054
1076
  children: /* @__PURE__ */ P("div", { className: u.ctaTotals, "aria-label": "Totals", children: [
1055
- ot ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
1056
- D ? "Unlocked " : "",
1057
- ot,
1058
- "% off"
1059
- ] }) : /* @__PURE__ */ d("span", {}),
1060
- /* @__PURE__ */ d("span", { children: D ? /* @__PURE__ */ P(Qt, { children: [
1061
- /* @__PURE__ */ d("span", { className: u.ctaTotalsStrike, children: C(ut.toFixed(2)) }),
1077
+ Pe ? /* @__PURE__ */ P("span", { className: u.ctaDiscountBadge, children: [
1078
+ Pe,
1079
+ "% Discount"
1080
+ ] }) : /* @__PURE__ */ h("span", {}),
1081
+ /* @__PURE__ */ h("span", { children: be ? /* @__PURE__ */ P(ot, { children: [
1082
+ /* @__PURE__ */ h("span", { className: u.ctaTotalsStrike, children: W(_e.toFixed(2)) }),
1062
1083
  " ",
1063
- /* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C($t.toFixed(2)) })
1064
- ] }) : /* @__PURE__ */ d("span", { className: u.ctaTotalsPrice, children: C(ut.toFixed(2)) }) })
1084
+ /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: W(rt.toFixed(2)) })
1085
+ ] }) : /* @__PURE__ */ h("span", { className: u.ctaTotalsPrice, children: W(_e.toFixed(2)) }) })
1065
1086
  ] })
1066
1087
  }
1067
1088
  ),
1068
- /* @__PURE__ */ d("button", { type: "button", onClick: U, disabled: !j, className: u.cta, children: r ? "Adding…" : L > 0 ? `Add ${L} more product${L === 1 ? "" : "s"}` : "Add to Basket" })
1089
+ /* @__PURE__ */ h("button", { type: "button", onClick: U, disabled: !V, className: u.cta, children: r ? "Adding…" : ve > 0 ? `Add ${ve} more product${ve === 1 ? "" : "s"}` : "Add to Basket" })
1069
1090
  ] })
1070
1091
  ] })
1071
1092
  ]
1072
1093
  }
1073
1094
  ) : null;
1074
1095
  }
1096
+ function Xe(a) {
1097
+ if (a != null && a.length)
1098
+ return a.reduce((e, t) => (t != null && t.key && (e[t.key] = t.value ?? ""), e), {});
1099
+ }
1100
+ function Dn(a) {
1101
+ const e = /\/(\d+)$/.exec(a);
1102
+ return e ? e[1] : a;
1103
+ }
1104
+ function Ln() {
1105
+ var a;
1106
+ return ((a = window == null ? void 0 : window.routes) == null ? void 0 : a.cart_url) || "/cart";
1107
+ }
1108
+ async function zn() {
1109
+ try {
1110
+ const a = Ln(), e = encodeURIComponent("cart-drawer,cart-icon-bubble,cart-live-region-text"), t = await fetch(`${a}?sections=${e}`, { method: "GET" });
1111
+ if (!t.ok) return;
1112
+ const i = await t.json().catch(() => null);
1113
+ if (!i) return;
1114
+ const r = ["cart-drawer", "cart-icon-bubble", "cart-live-region-text"];
1115
+ for (const c of r) {
1116
+ const m = i[c];
1117
+ if (!m) continue;
1118
+ const N = new DOMParser().parseFromString(m, "text/html"), C = N.getElementById(c) || N.querySelector(c), T = document.getElementById(c) || document.querySelector(c);
1119
+ T && C && T.replaceWith(C);
1120
+ }
1121
+ const n = document.querySelector("cart-drawer");
1122
+ if (n && typeof n.open == "function") {
1123
+ n.open();
1124
+ return;
1125
+ }
1126
+ document.body.classList.add("overflow-hidden");
1127
+ const l = document.querySelector("cart-drawer") || document.querySelector("cart-notification");
1128
+ l && (l.classList.contains("is-empty") && l.classList.remove("is-empty"), l.classList.add("active"));
1129
+ } catch {
1130
+ }
1131
+ }
1132
+ async function Ae(a, e) {
1133
+ const t = await fetch(a, {
1134
+ method: "POST",
1135
+ headers: {
1136
+ Accept: "application/json",
1137
+ "Content-Type": "application/json"
1138
+ },
1139
+ body: JSON.stringify(e)
1140
+ });
1141
+ if (!t.ok) {
1142
+ const i = await t.text().catch(() => "");
1143
+ throw new Error(i || `Cart request failed: ${t.status}`);
1144
+ }
1145
+ return t.json().catch(() => null);
1146
+ }
1147
+ function Yn() {
1148
+ return {
1149
+ async linesAdd(a) {
1150
+ const e = a.map((t) => ({
1151
+ id: Dn(t.merchandiseId),
1152
+ quantity: t.quantity,
1153
+ properties: Xe(t.attributes)
1154
+ }));
1155
+ await Ae("/cart/add.js", { items: e });
1156
+ },
1157
+ async linesUpdate(a) {
1158
+ for (const e of a)
1159
+ await Ae("/cart/change.js", {
1160
+ id: e.id,
1161
+ quantity: e.quantity,
1162
+ properties: Xe(e.attributes)
1163
+ });
1164
+ },
1165
+ async linesRemove(a) {
1166
+ for (const e of a)
1167
+ await Ae("/cart/change.js", { id: e, quantity: 0 });
1168
+ },
1169
+ openCartUI() {
1170
+ window.setTimeout(() => {
1171
+ zn();
1172
+ }, 0);
1173
+ }
1174
+ };
1175
+ }
1075
1176
  export {
1076
- Nn as BundleBuilderDrawer,
1077
- Tn as BundleButton,
1078
- gt as BundleLineAttributeKeys,
1079
- Cn as BundleProvider,
1080
- Nt as useBundleBuilder,
1081
- Bn as useBundleBuilderDrawer
1177
+ Qn as BundleBuilderDrawer,
1178
+ Un as BundleButton,
1179
+ Ne as BundleLineAttributeKeys,
1180
+ $n as BundleProvider,
1181
+ Yn as createLiquidCartAdapter,
1182
+ Le as useBundleBuilder,
1183
+ Vn as useBundleBuilderDrawer
1082
1184
  };
1083
1185
  //# sourceMappingURL=index.js.map