@best-bundles/bundle-ui 0.0.4 → 0.0.5

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