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