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