@occluze/tether 0.9.6 → 0.9.8

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.
Files changed (58) hide show
  1. package/README.md +1 -1
  2. package/dist/esm/astro.js +1 -1
  3. package/dist/esm/chunks/account-QFGF5FKX.js +1 -0
  4. package/dist/esm/chunks/{account-pages-32IFOHYU.js → account-pages-LMGIPFB7.js} +1 -1
  5. package/dist/esm/chunks/{analytics-OIQ4TFGM.js → analytics-YSTR6H2W.js} +1 -1
  6. package/dist/esm/chunks/{chunk-KW7UPDXI.js → chunk-4BZ4X2Z6.js} +1 -1
  7. package/dist/esm/chunks/{chunk-HZYW2TS3.js → chunk-ADA2ZGPO.js} +1 -1
  8. package/dist/esm/chunks/chunk-B7SC7UOJ.js +1 -0
  9. package/dist/esm/chunks/{chunk-DQJRQBJG.js → chunk-BGUUUMJO.js} +1 -1
  10. package/dist/esm/chunks/{chunk-JJVUNGJZ.js → chunk-GOGPMJ2U.js} +1 -1
  11. package/dist/esm/chunks/{chunk-33IQL4XN.js → chunk-HGNFQHEU.js} +1 -1
  12. package/dist/esm/chunks/{chunk-AMCCY6T4.js → chunk-I54NQEVK.js} +1 -1
  13. package/dist/esm/chunks/{chunk-UDJ62MPR.js → chunk-IBOX3YGQ.js} +1 -1
  14. package/dist/esm/chunks/chunk-KF76466X.js +1 -0
  15. package/dist/esm/chunks/chunk-KH7NEM4B.js +1 -0
  16. package/dist/esm/chunks/{chunk-TES2AUFT.js → chunk-PHTINCRN.js} +1 -1
  17. package/dist/esm/chunks/chunk-QUBBZNJ7.js +1 -0
  18. package/dist/esm/chunks/chunk-R3UWDQL5.js +1 -0
  19. package/dist/esm/chunks/{chunk-U5BYAOTP.js → chunk-SA5G3AUJ.js} +1 -1
  20. package/dist/esm/chunks/{chunk-TUVLYVMF.js → chunk-UJH5ZECZ.js} +1 -1
  21. package/dist/esm/chunks/chunk-XQCBGVU2.js +1 -0
  22. package/dist/esm/chunks/{diagnose-QTIUBMXT.js → diagnose-IOC3BCP5.js} +1 -1
  23. package/dist/esm/chunks/{extras-56DC6CHI.js → extras-5E72QFSJ.js} +1 -1
  24. package/dist/esm/chunks/{lists-SE5VBQ4K.js → lists-35SUHUOX.js} +1 -1
  25. package/dist/esm/chunks/markets-ui-B3ILTPN7.js +1 -0
  26. package/dist/esm/chunks/{search-ZAB5GJOK.js → search-QN457Q2G.js} +1 -1
  27. package/dist/esm/index.js +1 -1
  28. package/dist/esm/server.js +2 -2
  29. package/dist/tether.account.js +24 -11
  30. package/dist/tether.account.min.js +1 -1
  31. package/dist/tether.js +166 -153
  32. package/dist/tether.lists.js +13 -11
  33. package/dist/tether.lists.min.js +1 -1
  34. package/dist/tether.markets.js +12 -0
  35. package/dist/tether.markets.min.js +1 -1
  36. package/dist/tether.min.js +1 -1
  37. package/dist/tether.min.js.map +4 -4
  38. package/dist/types/server/src/shared/serial.d.ts +8 -0
  39. package/dist/types/src/account/server-client.d.ts +3 -1
  40. package/dist/types/src/cart/checkout.d.ts +2 -1
  41. package/dist/types/src/cart/drawer.d.ts +5 -1
  42. package/dist/types/src/cart/mutations.d.ts +13 -13
  43. package/dist/types/src/cart/store.d.ts +8 -4
  44. package/dist/types/src/cart.d.ts +5 -4
  45. package/dist/types/src/config.d.ts +8 -0
  46. package/dist/types/src/fragments.d.ts +0 -2
  47. package/dist/types/src/part-use.d.ts +3 -0
  48. package/dist/types/src/shopify-fields.d.ts +8 -0
  49. package/dist/types/src/version.d.ts +1 -1
  50. package/package.json +5 -2
  51. package/dist/esm/chunks/account-GZLRHV5Z.js +0 -1
  52. package/dist/esm/chunks/chunk-COXH5OXQ.js +0 -1
  53. package/dist/esm/chunks/chunk-ESYKAFMU.js +0 -1
  54. package/dist/esm/chunks/chunk-HO6SNO3A.js +0 -1
  55. package/dist/esm/chunks/chunk-LZINCBME.js +0 -1
  56. package/dist/esm/chunks/chunk-NOTL72DB.js +0 -1
  57. package/dist/esm/chunks/chunk-UU2VVXU2.js +0 -1
  58. package/dist/esm/chunks/markets-ui-GQOUGLUL.js +0 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Running async work one task at a time, in call order: the browser's cart changes, and the Worker's sync engine and
3
+ * request throttle.
4
+ */
5
+ /** Starts `task` once every task queued before it has settled. A failure rejects its own caller only. */
6
+ export type SerialQueue = <T>(task: () => Promise<T>) => Promise<T>;
7
+ /** A queue whose tasks never overlap. */
8
+ export declare function createSerialQueue(): SerialQueue;
@@ -26,7 +26,9 @@ export interface ServerRequest {
26
26
  */
27
27
  export declare function serverFetch(path: string, { method, body }?: ServerRequest): Promise<ServerAnswer>;
28
28
  /**
29
- * Who is logged in, asked once and then kept; the "may be logged in" hint follows the answer.
29
+ * Who is logged in, asked once (callers at the same time share the request) and then kept; the "may be logged in"
30
+ * hint follows the answer. An answer to a request sent before a logout or a change of the customer's data can be
31
+ * from before it: it is dropped, and the Worker asked again.
30
32
  *
31
33
  * @throws {TetherError} When the Worker can't be reached or fails: that says nothing about the login.
32
34
  */
@@ -8,7 +8,8 @@ type CheckoutResolver = () => Promise<string | null>;
8
8
  export declare function setCheckoutResolver(resolver: CheckoutResolver | null): void;
9
9
  /**
10
10
  * Goes to Shopify's checkout, with the cart as the changes already queued leave it. With `_blank` the tab opens inside
11
- * the click (Safari blocks `window.open` after an await) and gets its URL once there is one.
11
+ * the click (Safari blocks `window.open` after an await) and gets its URL once there is one, so a queued change that
12
+ * empties the cart closes the tab again.
12
13
  *
13
14
  * @returns The checkout URL, `null` with nothing to check out or after a reported failure.
14
15
  */
@@ -1,6 +1,10 @@
1
1
  /** Every cart drawer on the page. */
2
2
  export declare const drawers: () => HTMLElement[];
3
- /** True while a drawer, or the drawer-less cart, is open. */
3
+ /**
4
+ * True while a drawer, or the drawer-less cart, is open. The page watcher asks after every change to the page, so the
5
+ * elements with the open class come first, from the browser's live class index: only a drawer-less open cart has the
6
+ * drawers looked up.
7
+ */
4
8
  export declare function isOpen(): boolean;
5
9
  /**
6
10
  * `aria-expanded` on the open buttons, and dialog semantics on the drawers unless their markup has its own. Each
@@ -39,29 +39,29 @@ export declare function isUnclearFailure(error: unknown): boolean;
39
39
  * @throws {TetherError} `ERROR` without a variant id.
40
40
  */
41
41
  export declare function toLineInput(input: string | number | LineSpec | null | undefined, quantity?: number, options?: Omit<LineSpec, 'variantId' | 'quantity'>): CartLineInput;
42
- /** A mutation on the saved cart. */
42
+ /** A mutation on the saved cart, with one variable besides `$cartId`. */
43
43
  interface CartMutation {
44
44
  /** The mutation, e.g. `cartLinesAdd`. */
45
45
  name: string;
46
- /** Its variable definitions besides `$cartId`. */
47
- args: string;
48
- /** Its arguments besides `cartId`. */
49
- inner: string;
50
- variables: Record<string, unknown>;
46
+ /** The variable, named like the mutation's argument and like the `CartInput` field `create` sets. */
47
+ variable: string;
48
+ /** The variable's GraphQL type. */
49
+ type: string;
50
+ value: unknown;
51
51
  /**
52
- * The `CartInput` of a new cart that does what the mutation asks, when there is no cart (or Shopify no longer has
53
- * it); `null` leaves the visitor without a cart instead.
52
+ * Whether, when there is no cart (or Shopify no longer has it), a new cart is made with the value, which does what
53
+ * the mutation asks; without it the visitor is left without a cart.
54
54
  */
55
- createInput: Record<string, unknown> | null;
55
+ create: boolean;
56
56
  }
57
57
  /**
58
- * Runs a mutation on the saved cart, or creates a cart from `createInput` when there is none to change.
58
+ * Runs a mutation on the saved cart, or creates a cart with its value (`create`) when there is none to change.
59
59
  *
60
- * @returns The changed cart; `null` without a cart and without a `createInput`.
60
+ * @returns The changed cart; `null` without a cart and without `create`.
61
61
  * @throws {TetherError} For a failed request or Shopify's user errors; also when the cart is gone and there is no
62
- * `createInput` (the saved cart is forgotten first).
62
+ * `create` (the saved cart is forgotten first).
63
63
  */
64
- export declare function mutateCart({ name, args, inner, variables, createInput, }: CartMutation): Promise<ShopifyCart | null>;
64
+ export declare function mutateCart({ name, variable, type, value, create }: CartMutation): Promise<ShopifyCart | null>;
65
65
  /** @returns The cart, `null` when Shopify doesn't have it (expired or checked out). */
66
66
  export declare function fetchCart(id: string): Promise<ShopifyCart | null>;
67
67
  /** @returns The cart's current checkout URL, `null` when Shopify doesn't have the cart. */
@@ -171,12 +171,16 @@ export declare function settleLoad(outcome: {
171
171
  }): void;
172
172
  /** Until the saved cart has loaded, the counts show the count it had on the last page instead of the page's 0. */
173
173
  export declare function showLastKnownCount(): void;
174
- /** Sets Shopify's notes on the last change: each message once, in the site's words (`warningText`). */
174
+ /**
175
+ * Sets Shopify's notes on the last change: each message once, in the site's words (`warningText`), else in Shopify's.
176
+ */
175
177
  export declare function setWarnings(notes: readonly CartWarning[]): void;
176
- /** @returns A runner that starts each task once the one before has settled, whether it succeeded or failed. */
177
- export declare function serial(): <T>(task: () => Promise<T>) => Promise<T>;
178
178
  /** The one queue every cart change runs through; checkout waits for the changes in it. */
179
- export declare const runInOrder: <T>(task: () => Promise<T>) => Promise<T>;
179
+ export declare const runInOrder: import("../../server/src/shared/serial.js").SerialQueue;
180
+ /** Queues a task that can leave the cart with lines when it has none (`mayFill`). */
181
+ export declare function queueFilling<T>(queue: () => Promise<T>): Promise<T>;
182
+ /** @returns True while a queued add or load can still give an empty cart, or none, lines. */
183
+ export declare const mayFill: () => boolean;
180
184
  /**
181
185
  * Runs a cart change after the ones before it, so quick clicks never race. A failure sets the `error` status (shown by
182
186
  * `tether-show="cart-error"` until the next change succeeds), emits `tether:cart-error` and rejects.
@@ -13,12 +13,13 @@ type DiscountCodes = string[] | string | ((current: string[]) => string[]);
13
13
  */
14
14
  declare function changeQuantity(lineId: string, delta: number): Promise<ShopifyCart | null>;
15
15
  /**
16
- * Loads the saved cart. A cart Shopify no longer has is forgotten; one it can't be asked about (the network, the
17
- * token) is kept, because it is probably fine.
16
+ * Loads the saved cart in the queue, so a change Shopify answers meanwhile isn't replaced by an older answer. Calls
17
+ * before the load starts and before another change is queued (another tab writing the cart's keys in a burst) share
18
+ * it.
18
19
  */
19
- declare function init(): Promise<ShopifyCart | null>;
20
+ declare function reload(): Promise<ShopifyCart | null>;
20
21
  export declare const Cart: {
21
- init: typeof init;
22
+ init: typeof reload;
22
23
  /** The saved cart's id. */
23
24
  id: typeof savedCartId;
24
25
  readonly status: CartStatus;
@@ -194,3 +194,11 @@ export declare function warn(...args: unknown[]): void;
194
194
  * @param context What failed, e.g. `product coffee-box`.
195
195
  */
196
196
  export declare function reportError(error: unknown, context: string): void;
197
+ /**
198
+ * Calls one of the site's hooks. A bug in it is reported under `name`, and `fallback` answers instead, so the site's
199
+ * code never fails the render, or the cart change Shopify already applied, that called it. A thrown `Error` is reported
200
+ * once per page load for each message (a `formatMoney` runs for every price on every render). Anything else thrown is
201
+ * reported each time: it has no message, and turning it into text can throw too.
202
+ */
203
+ export declare function callHook(name: string, hook: () => unknown): void;
204
+ export declare function callHook<T>(name: string, hook: () => T, fallback: () => T): T;
@@ -153,6 +153,4 @@ export declare function productFragment(o?: ProductFragmentConfig, access?: Stor
153
153
  * @returns `fragment TetherCart on Cart`.
154
154
  */
155
155
  export declare function cartFragment(access?: StoreAccess): string;
156
- /** The collection fields Tether renders, for inside a `collection { }` selection. */
157
- export declare function collectionFields(): string;
158
156
  export {};
@@ -0,0 +1,3 @@
1
+ import type { PartName, Parts } from './lazy.js';
2
+ /** Runs `use` once the part `name` has loaded; a failure to load it, or of `use`, is reported under `name`. */
3
+ export declare function withPart<Name extends PartName>(name: Name, use: (part: Parts[Name]) => unknown): void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Selections the core's product queries share with the lists part and the sync's catalog. They import nothing, so the
3
+ * lists part bundles its own copy of `collectionFields` instead of the core shipping it for that part alone.
4
+ */
5
+ /** The image fields Tether renders, for inside an `Image` selection. */
6
+ export declare const IMAGE_FIELDS = "url altText width height";
7
+ /** The collection fields Tether renders, for inside a `collection { }` selection. */
8
+ export declare function collectionFields(): string;
@@ -1 +1 @@
1
- export declare const VERSION = "0.9.6";
1
+ export declare const VERSION = "0.9.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@occluze/tether",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "Free, open-source alternative to Smootify and Storesynk (Shopyflow): Shopify products, cart and subscriptions in Webflow with HTML attributes. Optional Shopify to Webflow CMS sync.",
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -133,7 +133,10 @@
133
133
  }
134
134
  },
135
135
  {
136
- "files": "CHANGELOG.md",
136
+ "files": [
137
+ "CHANGELOG.md",
138
+ ".changes/*.md"
139
+ ],
137
140
  "options": {
138
141
  "proseWrap": "always",
139
142
  "printWidth": 100
@@ -1 +0,0 @@
1
- import{f as G,g as H,h as W,i as O,m as v,n as X}from"./chunk-TES2AUFT.js";import{a as L,c as V}from"./chunk-U5BYAOTP.js";import{f as j,g as M,h as P}from"./chunk-COXH5OXQ.js";import"./chunk-DQJRQBJG.js";import{a as B}from"./chunk-UU2VVXU2.js";import"./chunk-AMCCY6T4.js";import"./chunk-NOTL72DB.js";import{D as q,E as _,G as A,I as x,R as F,a as f,g as N,n as c,o as m,q as d,u as h,x as D,z as $}from"./chunk-HO6SNO3A.js";import{D as T,F as l,G as U,d as I,g as y,r as E,x as i}from"./chunk-ESYKAFMU.js";var g=null;function J(){let e=i.account?.server;if(!e)throw new f("Customer accounts need the Worker: set account.server",{code:"NOT_CONFIGURED"});return new URL(e,window.location.href).href.replace(/\/$/,"")}function K(e){e?j(L(),"1"):M(L())}async function de(e){let t;try{t=await e.json()}catch(r){if(r instanceof SyntaxError)return{};throw r}return I(t)?t:{}}async function le(e,t){try{return await N(i.requestTimeout,async r=>{let n=await fetch(e,{...t,signal:r});return{response:n,data:await de(n)}})}catch(r){throw new f(`Network error: ${U(r)}`,{code:"NETWORK"})}}async function p(e,{method:t="GET",body:r}={}){let n={method:t,credentials:"include"};t==="POST"&&(n.headers={"Content-Type":"application/json","X-Tether-Account":"1"}),r&&(n.body=JSON.stringify(r));let{response:s,data:o}=await le(`${J()}${e}`,n);if(s.status===401)return{kind:"logged-out"};if(!s.ok){let u=y(o.error)??String(s.status),w=W(o.userErrors);throw new f(`Customer accounts: ${u}`,{status:s.status,...w.length>0&&{userErrors:w},...o.code==="INVALID"&&{code:"INVALID"}})}return{kind:"answer",data:o}}async function k(){if(!g){let e=await p("/me");g=e.kind==="answer"&&e.data.loggedIn===!0?{loggedIn:!0,customer:G(e.data.customer)}:{loggedIn:!1}}return K(g.loggedIn),g}var z=()=>g?.loggedIn===!0;function Q(){g=null}function Y(e){let t=i.account?.navigate;t?t(e):window.location.assign(e)}var me=e=>e||i.account?.locale||(i.locale||"").split("-")[0]||"";function Z({returnTo:e,locale:t}){let r=new URL(`${J()}/login`);r.searchParams.set("returnTo",e);let n=me(t);n&&r.searchParams.set("locale",n),i.country&&r.searchParams.set("country",i.country.toUpperCase()),Y(r.toString())}async function ee(){let e=P.id();if(!(await k()).loggedIn||!e)return null;let t=await p("/cart",{method:"POST",body:{cartId:e}});return t.kind==="logged-out"?null:y(t.data.checkoutUrl)}async function te(e){let t=await p("/logout",{method:"POST",body:{returnTo:e,cartId:P.id()}});g=null,K(!1),h("account-logout",{});let r=t.kind==="answer"?y(t.data.logoutUrl):null;return r?(Y(r),"redirected"):"stayed"}var R=10,b=50,re=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=b,ge=e=>F(e,"limit",{min:1,max:b,fallback:R}),fe=e=>e.replace(/\?.*$/,"").replace(/^.*\//,"");function pe(e){let t=i.account?.orderUrl;if(t)return t.replaceAll("{id}",encodeURIComponent(fe(e.id)));let r=e.statusPageUrl;return r!==null&&E(r)?r:null}var we=e=>({name:e.name??"",date:_(e.processedAt),total:q(e.totalPrice),status:e.financialStatus?.toLowerCase(),fulfillment:e.fulfillmentStatus?.toLowerCase(),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title??""}`).join(", ")});function he(e,t){let r=t.lineItems.nodes,n=pe(t),s=we(t);d(e,c("order-bind")).forEach(o=>{let u=m(o,"order-bind")??"";if(u==="url"){n&&o.setAttribute("href",n);return}if(u==="image"){let S=r.find(ue=>ue.image)?.image;S&&D(o,S.url,S.altText||r[0]?.title||"");return}let w=v(s,u);w!==void 0&&A(o,w)}),d(e,c("order-lines")).forEach(o=>{X(o,r,null)}),m(e,"order-bind")==="url"&&n&&e.setAttribute("href",n)}async function ne(e,t){let r=d(e,c("orders")),n=r[0];if(!n)return;O(e,"show",{"orders-loading":!0,"orders-empty":!1});let s=ge(n),o;try{o=await t(s)}catch(u){l(u,"orders"),o=null}O(e,"show",{"orders-loading":!1,"orders-empty":o?.length===0}),r.forEach(u=>{$(u,o??[],he)})}var Pe=["order","addresses","subscriptions","profile-form","address-form"],ye=z;function Ae({returnTo:e=window.location.href,locale:t}={}){return new Promise(r=>{Z({returnTo:e,locale:t}),r()})}async function ce(){let e=await k();return e.loggedIn?e.customer:null}async function ve({first:e=R}={}){if(!re(e))throw new f(`Customer accounts: orders() takes first from 1 to ${String(b)}`,{code:"INVALID"});let t=await p(`/orders?${new URLSearchParams({first:String(e)}).toString()}`);return t.kind==="logged-out"?[]:H(t.data.orders)}async function ke({returnTo:e=i.account?.logoutUrl||`${window.location.origin}/`}={}){await te(e)==="stayed"&&await C(document)}async function be(){try{return(await k()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(e){return{kind:"unknown",error:e}}}var oe=e=>Pe.some(t=>d(e,c(t)).length>0);function Se(e){d(e,c("account-link")).forEach(t=>{t.setAttribute("href",xe(m(t,"account-link")))})}function xe(e){let t=i.account,r=`https://${i.domain}/account`;return e==="payment"?t?.paymentUrl||t?.subscriptionsUrl||r:e==="subscriptions"&&t?.subscriptionsUrl||r}async function C(e=document){let t=await be();t.kind==="unknown"&&l(t.error,"account");let r=t.kind==="logged-in";if(d(e,c("show")).forEach(n=>{let s=m(n,"show");s==="logged-in"&&x(n,r),s==="logged-out"&&x(n,!r)}),Se(e),t.kind==="unknown"&&oe(e)){(await a()).showUnavailable(e);return}r&&(await ae(e),await Promise.all([ne(e,n=>ve({first:n})),oe(e)?a().then(n=>n.renderPages(e)):null]))}async function ae(e){let t=d(e,c("account-bind"));if(!t.length)return;let r;try{r=await ce()}catch(s){l(s,"account");return}if(!r)return;let n={"first-name":r.firstName,"last-name":r.lastName,name:r.displayName,email:r.emailAddress?.emailAddress,address:r.defaultAddress?.formatted.join(", ")};t.forEach(s=>{let o=v(n,m(s,"account-bind")??"");o!=null&&A(s,o)})}var se=null;function a(){return se??(se=B("account-pages").then(e=>(e.setup({serverFetch:p,customer:ce,bindCustomer:ae,reset:Q}),e))),se}var et=e=>a().then(t=>t.order(e)),tt=e=>a().then(t=>t.updateProfile(e)),rt=()=>a().then(e=>e.addresses()),nt=(e,t)=>a().then(r=>r.saveAddress(e,t)),ot=e=>a().then(t=>t.deleteAddress(e)),st=()=>a().then(e=>e.subscriptions()),it=(e,t)=>a().then(r=>r.subscriptionAction(e,t)),ct=(e,t)=>a().then(r=>r.requestReturn(e,t));function Le(e){let t=e.target;t instanceof window.Element&&(t.closest(c("account-login"))?(e.preventDefault(),Ae().catch(r=>{l(r,"login")})):t.closest(c("account-logout"))&&(e.preventDefault(),ke().catch(r=>{l(r,"logout")})))}function Oe(){let e=new URL(window.location.href),t=e.searchParams.get("account");if(V(t))switch(e.searchParams.delete("account"),window.history.replaceState(window.history.state,"",e),t){case"in":h("account-login",{});break;case"expired":case"error":h("account-error",{error:t});break}}var ie=!1;async function at(e=document){if(ie){await C(e);return}ie=!0,document.addEventListener("click",Le),Oe(),P.setCheckoutResolver(ee),await C(e),T("account",ye()?"logged in":"logged out")}export{rt as addresses,ce as customer,ot as deleteAddress,ye as isLoggedIn,Ae as login,ke as logout,at as mountAccount,et as order,ve as orders,C as render,ct as requestReturn,nt as saveAddress,it as subscriptionAction,st as subscriptions,tt as updateProfile};
@@ -1 +0,0 @@
1
- import{a as kt,d as N,e as It}from"./chunk-DQJRQBJG.js";import{c as xt}from"./chunk-AMCCY6T4.js";import{b as tt,d as R}from"./chunk-NOTL72DB.js";import{A as Lt,B as W,D as v,E as At,F as Pt,G as g,H as E,I as O,M as Et,T as D,a as C,c as q,d as F,i as V,l as bt,m as A,n as s,o as f,p as wt,q as d,u as b,w as St,x as P,y as vt,z as M}from"./chunk-HO6SNO3A.js";import{D as Ct,F as y,r as yt,x as c}from"./chunk-ESYKAFMU.js";var ce={id:"string",quantity:"number",attributes:["object"],cost:{totalAmount:R,subtotalAmount:R,amountPerQuantity:R},merchandise:{id:"string",selectedOptions:["object"],product:"object"}},et={id:"string",checkoutUrl:"string",totalQuantity:"number",attributes:["object"],discountCodes:["object"],cost:{totalAmount:R,subtotalAmount:R},lines:{nodes:[ce]}};var de='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',me=60,nt=!1,rt=!1,K=null,Tt=null;function Mt(t,e,n){try{t?.(e)}catch(r){y(r,n)}}var pe=t=>t!==null&&"focus"in t,Ot=t=>d(t,de).filter(e=>e.offsetParent!==null||e===document.activeElement),k=()=>d(document,s("cart-drawer")),j=t=>t.classList.contains(c.cartDrawerOpenClass),$t=t=>t.some(e=>e.contains(document.activeElement)),fe=t=>f(t,"cart-drawer")==="manual";function S(){let t=k();return t.length?t.some(j):nt}function ge(t){Tt??(Tt=new MutationObserver(()=>{let e=S();if(e===rt)return;let n=k();e?Rt(n.filter(j)):Ut(n,$t(n))})),Tt.observe(t,{attributes:!0,attributeFilter:["class"]})}function B(){d(document,s("cart-open")).forEach(t=>{t.setAttribute("aria-expanded",String(S()))}),k().forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","dialog"),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-label",f(t,"cart-label")||"Cart");let e=j(t);t.setAttribute("aria-modal",String(e)),t.setAttribute("aria-hidden",String(!e)),t.inert=!e,ge(t)})}function he(t){let e=Ot(t)[0]??t;e===t&&!t.hasAttribute("tabindex")&&(t.tabIndex=-1),e.focus({preventScroll:!0})}function Rt(t){rt=!0,B();let[e]=t;c.cartFocus&&e&&(K=pe(document.activeElement)?document.activeElement:null,setTimeout(()=>{he(e)},me)),Mt(c.onCartOpen,t,"onCartOpen"),b("cart-toggled",{open:!0})}function Ut(t,e){rt=!1,B(),e&&K?.isConnected&&K.focus({preventScroll:!0}),K=null,Mt(c.onCartClose,t,"onCartClose"),b("cart-toggled",{open:!1})}function G(){if(S())return;let t=k(),e=t.filter(n=>!fe(n));t.length&&!e.length||(nt=!0,e.forEach(n=>{n.classList.add(c.cartDrawerOpenClass)}),Rt(e))}function it(){if(!S())return;nt=!1;let t=k(),e=$t(t);t.forEach(n=>{n.classList.remove(c.cartDrawerOpenClass)}),Ut(t,e)}function qt(){S()?it():G()}function ye(t){if(t.key!=="Tab"||!c.cartFocus||!S())return;let e=k().find(j);if(!e)return;let n=Ot(e),r=n[0],i=n.at(-1);if(!r||!i)return;let o=document.activeElement,a=t.shiftKey?o===r:o===i;e.contains(o)&&!a||(t.preventDefault(),(t.shiftKey?i:r).focus())}var Ce=/^image:(\d+)$/,Dt="metafield:",be=/^(rich_text|multi_line_text)_field$/,we=["","true","all","*"],at=t=>t.tagName==="SELECT",ot=(t,e)=>t.$(`select${e}`).filter(at);function Se(t,e){let n=e.images.nodes,r=[...t.children].map(o=>o.tagName==="IMG"?o:o.querySelector("img"));!vt(t)&&r.length===n.length&&r.every((o,a)=>St(o?.getAttribute("src"),n[a]?.url))||M(t,n,(o,a)=>{let u=o.matches(`img,${s("bind","image")}`)?o:d(o,"img")[0]??o;P(u,a.url,a.altText||e.title)})}function ve(t,e,n){let r=n.indexOf("."),i=n.slice(0,r),o=n.slice(r+1),a=(e.metafields??[]).find(l=>l?.namespace===i&&l.key===o);if(!a){g(t,"");return}let u=a.reference?.image;if(u){P(t,u.url,u.altText);return}be.test(a.type)&&(t.style.whiteSpace="pre-line"),g(t,a.value)}var Le=new Map(Object.entries({title:t=>t.title,"description-text":t=>t.description,vendor:t=>t.vendor,type:t=>t.productType,handle:t=>t.handle,"published-at":t=>At(t.publishedAt),"min-price":t=>v(t.priceRange.minVariantPrice),"max-price":t=>v(t.priceRange.maxVariantPrice)}));function Ae(t,e){let n=(t.getAttribute("exclude")??"").split(",").map(i=>i.trim()).filter(Boolean),r=e.tags.filter(i=>!n.includes(i));M(t,r,(i,o)=>{g(i,o)})}function Pe(t,e,n){let r=Le.get(e);if(r){g(t,r(n));return}switch(e){case"description":Pt(t,n.descriptionHtml);break;case"featured-image":P(t,n.featuredImage?.url,n.featuredImage?.altText||n.title);break;case"url":case"link":{let i=W(n.handle,n.id);i&&t.setAttribute("href",i),e==="url"&&!t.firstElementChild&&!t.textContent.trim()&&g(t,n.title);break}case"images":Se(t,n);break;case"tags":Ae(t,n);break;default:Ee(t,e,n)}}function Ee(t,e,n){let r=Ce.exec(e);if(r){let i=n.images.nodes[Number(r[1])-1]??n.featuredImage;P(t,i?.url,i?.altText||n.title)}else e.startsWith(Dt)&&ve(t,n,e.slice(Dt.length))}function ke(t){let{product:e}=t;t.$(s("option-list")).forEach(n=>{let r=t.optName(f(n,"option-list")),i=e.options.find(o=>o.name===r);if(!i||i.optionValues.length<=1&&wt(n,"hide-single")){O(n,!1);return}M(n,i.optionValues,(o,a)=>{o.setAttribute(A("option-value"),a.name);let u=d(o,s("bind","option-value"))[0];u?g(u,a.name):o.firstElementChild||g(o,a.name);let l=d(o,s("bind","swatch"))[0],{swatch:p}=a;!l||!p||(p.color&&(l.style.backgroundColor=p.color),p.image?.previewImage&&P(l,p.image.previewImage.url,a.name))})})}function Ie(t){let{product:e}=t;ot(t,s("option")).forEach(n=>{let r=e.options.find(i=>i.name===t.optName(f(n,"option")));if(!r){O(n,!1);return}n.replaceChildren(...r.optionValues.map(i=>new Option(i.name,i.name)))}),ot(t,s("variant-select")).forEach(n=>{n.replaceChildren(...e.variants.nodes.map(r=>new Option(r.title,r.id)))}),ot(t,s("plan")).forEach(n=>{let r=t.plans.map(a=>new Option(a.name,a.id)),i=!e.requiresSellingPlan&&f(n,"plan")!=="subscription-only",o=n.getAttribute(A("one-time-label"))||"One-time purchase";n.replaceChildren(...i?[new Option(o,"")]:[],...r)})}function xe(t){t.$(s("plan-list")).forEach(e=>{let n=(f(e,"plan-list")??"").trim(),r=we.includes(n.toLowerCase())?null:n,i=t.plans.filter(o=>!r||o.group.name===r);M(e,i,(o,a)=>{o.setAttribute(A("plan-value"),a.id),!o.firstElementChild&&!o.querySelector(s("plan-bind"))&&g(o,a.name)})})}function on(t){t.$(s("bind")).forEach(e=>{Pe(e,f(e,"bind")??"",t.product)}),ke(t),Ie(t),xe(t)}var Nt="Default Title",st=(t,e)=>e.get(t.id)?.quantity??t.quantity,Qt=t=>t.split("/").pop()??t;function Te(t){let e=t.merchandise,n=W(e.product.handle,e.product.id);if(!n)return null;let r=new URLSearchParams;r.set("variant",Qt(e.id));let i=t.sellingPlanAllocation?.sellingPlan.id;return i&&r.set("selling_plan",Qt(i)),`${n}${n.includes("?")?"&":"?"}${r.toString()}`}var _t=t=>t.merchandise.product.title,Ht={title:_t,"product-title":_t,"variant-title":t=>t.merchandise.title===Nt?"":t.merchandise.title,options:t=>t.merchandise.selectedOptions.filter(e=>e.value!==Nt).map(e=>`${e.name}: ${e.value}`).join(", "),vendor:t=>t.merchandise.product.vendor,sku:t=>t.merchandise.sku??"",price:t=>v(t.cost.amountPerQuantity),"compare-at-price":t=>v(t.cost.compareAtAmountPerQuantity??t.merchandise.compareAtPrice),"line-total":t=>v(t.cost.totalAmount),"line-subtotal":t=>v(t.cost.subtotalAmount),quantity:(t,e)=>st(t,e.pending),plan:t=>t.sellingPlanAllocation?.sellingPlan.name??"","plan-description":t=>t.sellingPlanAllocation?.sellingPlan.description??"",components:t=>(t.lineComponents??[]).map(e=>`${e.quantity} \xD7 ${e.merchandise.product.title}`).join(", ")},Ft="attribute:";function Me(t,e,n){if(Object.hasOwn(Ht,e))return Ht[e]?.(t,n);if(!e.startsWith(Ft))return;let r=e.slice(Ft.length);return t.attributes.find(i=>i.key===r)?.value??""}function Oe(t,e,n){let r=It(n),i=!n.requiresSellingPlan&&f(t,"line-plan")!=="subscription-only",o={value:"",label:t.getAttribute(A("one-time-label"))||"One-time purchase"},a=[...i?[o]:[],...r.map(l=>({value:l.id,label:l.name}))],u=a.map(l=>l.value).join("|");t.dataset.tetherSig!==u&&(t.replaceChildren(...a.map(l=>{let p=document.createElement("option");return p.value=l.value,p.textContent=l.label,p})),t.dataset.tetherSig=u),t.value=e.sellingPlanAllocation?.sellingPlan.id??"",O(t,r.length>0)}function $e(t,e,n){let r=!!e.sellingPlanAllocation;t.classList.toggle("is-subscription",r);let i=n.warnings.find(u=>u.target===e.id);t.classList.toggle("is-warning",!!i);let o=n.pending.has(e.id);t.classList.toggle("is-busy",o),o?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),d(t,s("line","warning")).forEach(u=>{E(u,i?.message??"")});let a=new Map([["subscription",r],["one-time",!r],["on-sale",kt(e.cost.compareAtAmountPerQuantity?.amount,e.cost.amountPerQuantity.amount)],["has-components",(e.lineComponents??[]).length>0],["warning",!!i]]);d(t,s("line-show")).forEach(u=>{let l=f(u,"line-show"),p=l===null?void 0:a.get(l);p!==void 0&&O(u,p)})}function Re(t,e,n){let r=e.merchandise;t.setAttribute(A("line-id"),e.id),d(t,s("line")).forEach(o=>{let a=f(o,"line")??"";if(a==="image"){P(o,r.image?.url??r.product.featuredImage?.url,r.product.title);return}if(a==="url"){let l=Te(e);l&&o.setAttribute("href",l);return}let u=Me(e,a,n);u!==void 0&&E(o,u)}),$e(t,e,n),d(t,s("line-plan")).filter(at).forEach(o=>{xt(r.product.handle).then(a=>{Oe(o,e,a)}).catch(a=>{y(a,"line plan options")})})}function Ue(t,e){let n=t?.totalQuantity??0,r=(t?.lines.nodes??[]).some(o=>o.sellingPlanAllocation),i=new Map([["cart-empty",n===0],["cart-filled",n>0],["cart-has-subscription",r],["cart-no-subscription",!r],["cart-has-discount",(t?.discountCodes??[]).some(o=>o.applicable)],["cart-error",e.failed],["cart-warning",e.warnings.length>0]]);d(document,s("show")).forEach(o=>{let a=f(o,"show"),u=a===null?void 0:i.get(a);u===void 0||o.closest(s("product"))||O(o,u)}),d(document,s("checkout")).forEach(o=>{o.classList.toggle("is-disabled",!n),o.setAttribute("aria-disabled",String(!n))})}function qe(t){d(document,`textarea${s("cart-note")},input${s("cart-note")}`).forEach(e=>{document.activeElement!==e&&g(e,t?.note??"")}),d(document,s("cart-discounts")).forEach(e=>{M(e,t?.discountCodes??[],(n,r)=>{n.setAttribute(A("discount-code"),r.code);let i=n.querySelector(s("discount","code"))??(n.firstElementChild?null:n);i&&g(i,r.code),n.classList.toggle("is-inapplicable",!r.applicable)})})}function Vt(t){let{cart:e}=t,n=r=>e?v(e.cost[r]):"";B(),d(document,s("cart-count")).forEach(r=>{E(r,e?.totalQuantity??0)}),d(document,s("cart-subtotal")).forEach(r=>{E(r,n("subtotalAmount"))}),d(document,s("cart-total")).forEach(r=>{E(r,n("totalAmount"))}),d(document,s("cart-checkout-charge")).forEach(r=>{E(r,n("checkoutChargeAmount"))}),Ue(e,t),d(document,s("cart-warning")).forEach(r=>{E(r,[...new Set(t.warnings.map(i=>i.message))].join(" "))}),qe(e),d(document,s("cart-lines")).forEach(r=>{Lt(r,e?.lines.nodes??[],i=>i.id,(i,o)=>{Re(i,o,t)},{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),e&&Et("cart")}function Wt(t){d(document,s("cart-count")).forEach(e=>{/^\s*0?\s*$/.test(e.textContent)&&(e.textContent=String(t))})}function ut(t,e="localStorage"){try{return window[e].getItem(t)}catch{return null}}function lt(t,e,n="localStorage"){try{window[n].setItem(t,e)}catch{}}function Kt(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var jt=/^gid:\/\/shopify\/Cart\/[\w-]+(\?key=[\w-]+)?$/;var h={kind:"unknown"},U=[],$=new Map,X=()=>h;function m(){switch(h.kind){case"ready":case"error":return h.cart;case"unknown":case"empty":return null}}var Gt=()=>U,ct=t=>t?{kind:"ready",cart:t}:{kind:"empty"},Xt=()=>`${c.storageKey}:seen`;function I(){let t=ut(c.storageKey);return t?jt.test(t)?t:(x(),null):null}function x(){Kt(c.storageKey)}function dt(t){h=ct(t),t&&lt(c.storageKey,t.id)}function Q(){Vt({cart:m(),warnings:U,pending:$,failed:h.kind==="error"})}function _(t){Q(),b("cart-updated",{cart:m(),reason:t})}function w(t,e){return dt(t),lt(Xt(),`${Date.now()}|${t?.totalQuantity??0}`),_(e),t}function H(t){h=t.kind==="loaded"?ct(t.cart):{kind:"error",error:t.error,cart:null},_("load")}function De(){let t=ut(Xt())?.split("|")[1]??"",e=Number(t);return/^\d+$/.test(t)&&Number.isSafeInteger(e)?e:null}function Yt(){if(h.kind!=="unknown")return;let t=De();t!==null&&Wt(t)}function zt(t){U=t.filter((e,n)=>t.findIndex(r=>r.message===e.message)===n).map(e=>({...e,message:c.warningText?.(e)||e.message})),U.length&&b("cart-warning",{warnings:U})}var Bt=()=>{};function Ne(){let t=Promise.resolve();return e=>{let n=t.then(e);return t=n.then(Bt,Bt),n}}var mt=Ne();function Jt(t){return mt(t).then(e=>(h.kind==="error"&&(h=ct(h.cart),Q()),e),e=>{throw h={kind:"error",error:e,cart:m()},Q(),b("cart-error",{error:e}),e})}var pt=t=>st(t,$),Qe=()=>({open:S(),count:m()?.totalQuantity??0,loaded:h.kind!=="unknown",warnings:[...U]});function Zt(t){let e=["cart-updated","cart-toggled"].map(r=>`${c.prefix}:${r}`),n=()=>{t(m(),Qe())};return e.forEach(r=>{document.addEventListener(r,n)}),n(),()=>{e.forEach(r=>{document.removeEventListener(r,n)})}}var _e=/does not exist|not found|invalid id/i,He=t=>F({[t]:q({cart:q(et)})});function Y(t){return t instanceof C?t.userErrors?.some(e=>e.field?.[0]==="cartId")?!0:(t.errors??[]).some(e=>_e.test(e.message)):!1}function ee(t){if(!(t instanceof C))return!1;let{code:e,status:n=0}=t;return e==="NETWORK"||e==="INVALID_RESPONSE"||e==="SERVER_ERROR"||n>=500}function ne(t,e=1,n={}){let r=typeof t=="object"&&t!==null?t:{...n,quantity:e,...t==null?{}:{variantId:t}},i=N.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new C("add(): variantId is required");let o=parseInt(String(r.quantity??1),10),a={merchandiseId:i,quantity:Math.max(1,o||1)},u=N.sellingPlan(r.sellingPlanId||r.sellingPlan);u&&(a.sellingPlanId=u);let l=D(r.attributes);return l.length&&(a.attributes=l),a}function Fe(t,e,n){return r=>`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${tt(r)}`}async function re(t,e,n,r){let i=await V(Fe(t,e,n),r,He(t),{operation:"mutation"}),o=bt(i[t],t);return zt(o.warnings??[]),o.cart}function te(t){let e=c.country?{buyerIdentity:{countryCode:c.country},...t}:t;return re("cartCreate","$input: CartInput!","input: $input",{input:e})}async function T({name:t,args:e,inner:n,variables:r,createInput:i}){let o=I();if(!o)return i?te(i):null;try{return await re(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`,{...r,cartId:o})}catch(a){if(!Y(a)||(x(),!i))throw a;return Ct("cart expired, creating a new one"),te(i)}}async function ft(t){return(await V(n=>`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${tt(n)}`,{id:t},F({cart:q(et)}))).cart}async function ie(t){return(await V("query TetherCheckout($id:ID!){cart(id:$id){checkoutUrl}}",{id:t},F({cart:q({checkoutUrl:"string"})}))).cart?.checkoutUrl??null}function oe(t,e){let n=typeof e=="number"?{quantity:e}:e,r={id:t};n.quantity!==void 0&&(r.quantity=n.quantity),"sellingPlanId"in n&&(r.sellingPlanId=n.sellingPlanId?N.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=D(n.attributes));let i=n.merchandiseId||n.variantId;return i&&(r.merchandiseId=N.variant(i)),r}var gt=t=>T({name:"cartLinesUpdate",args:"$lines: [CartLineUpdateInput!]!",inner:"lines: $lines",variables:{lines:t},createInput:null}),z=t=>T({name:"cartLinesRemove",args:"$lineIds: [ID!]!",inner:"lineIds: $lineIds",variables:{lineIds:t},createInput:null}),ae=(t,e)=>e>0?gt([{id:t,quantity:e}]):z([t]);var ht=null;function ue(t){ht=t}var Ve=t=>ie(t).then(e=>({kind:"url",url:e}),e=>({kind:"failed",error:e}));async function We(){if(!ht)return null;try{let t=await ht();return t&&`${t}${t.includes("?")?"&":"?"}logged_in=true`}catch(t){return y(t,"account checkout"),null}}async function Ke(t){let e=Ve(t),n=await We();if(n)return n;let r=await e;if(r.kind==="failed")throw r.error;if(!r.url)throw new C("No checkoutUrl (cart empty or expired)");return r.url}function je(t){try{t.opener=null}catch{}}function se(){let t=m();return t&&!t.totalQuantity?null:I()}async function le(t=c.checkoutTarget){if(!se())return null;let e=t==="_blank"?window.open("","_blank"):null;e&&je(e);try{await mt(()=>Promise.resolve());let n=se(),r=n&&await Ke(n);if(!r)return e?.close(),null;if(!yt(r))throw new C("The checkout URL is not https: not opened");return b("checkout",{url:r,cart:m()}),e&&!e.closed?e.location.href=r:window.location.href=r,r}catch(n){return e?.close(),y(n,"checkout failed"),null}}var Z=()=>m()?.lines.nodes??[];async function Be(){let t=I();if(t)try{let e=await ft(t);e||x(),w(e,"load")}catch(e){y(e,"cart reload after a failed change")}}function L(t){return Jt(()=>t().catch(async e=>{throw ee(e)&&await Be(),e}))}function Ge(t,e){let n=Z().find(u=>u.id===t);if(!n)return Promise.resolve(m());let r=Math.max(0,pt(n)+e),i={quantity:r};$.set(t,i),_("pending");let o=()=>$.get(t)===i;return L(async()=>{if(!o())return m();if(Z().find(p=>p.id===t)?.quantity===r)return m();let l=await ae(t,r);return o()?w(l,r>0?"update":"remove"):(dt(l),l)}).finally(()=>{o()&&($.delete(t),_("settled"))})}function Xe(t){let e=(m()?.discountCodes??[]).map(r=>r.code),n=typeof t=="function"?t(e):t;return(Array.isArray(n)?n:[n]).map(r=>r.trim()).filter(Boolean)}function Ye(t){let e=new Map((m()?.attributes??[]).map(n=>[n.key,n.value]));return D(t).forEach(n=>e.set(n.key,n.value)),[...e].filter(([,n])=>n!=="").map(([n,r])=>({key:n,value:r}))}async function ze(){let t=I();if(!t)return H({kind:"loaded",cart:null}),null;Yt();try{let e=await ft(t);e||x(),H({kind:"loaded",cart:e})}catch(e){y(e,"cart load failed"),Y(e)&&x(),H({kind:"failed",error:e})}return m()}var J={init:ze,id:I,get status(){return X()},get state(){return m()},get lines(){return[...Z()]},get count(){return m()?.totalQuantity??0},get loaded(){return X().kind!=="unknown"},get lastError(){let t=X();return t.kind!=="error"?null:t.error instanceof Error?t.error:new Error(String(t.error))},get warnings(){return[...Gt()]},get pendingQty(){return $},setCheckoutResolver:ue,forgetSaved(){x(),H({kind:"loaded",cart:null})},render:Q,subscribe:Zt,add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(i=>ne(i,e,n));return L(async()=>{let i=await T({name:"cartLinesAdd",args:"$lines: [CartLineInput!]!",inner:"lines: $lines",variables:{lines:r},createInput:{lines:r}});if(!i)throw new C("Shopify answered the add without a cart");return w(i,"add"),b("added",{cart:i,lines:r}),c.openCartOnAdd&&G(),i})},updateLine(t,e){let n=typeof e=="number"?e:e.quantity;if(n!==void 0&&n<=0)return J.removeLine(t);let r=oe(t,e);return L(async()=>w(await gt([r]),"update"))},changeQuantity:Ge,quantityOf:pt,removeLine(t){let e=Array.isArray(t)?t:[t];return L(async()=>w(await z(e),"remove"))},clear(){return L(async()=>{let t=Z().map(e=>e.id);return t.length?w(await z(t),"remove"):m()})},setNote(t){let e={note:t??""};return L(async()=>w(await T({name:"cartNoteUpdate",args:"$note: String!",inner:"note: $note",variables:e,createInput:e}),"note"))},setAttributes(t){return L(async()=>{let e={attributes:Ye(t)},n=await T({name:"cartAttributesUpdate",args:"$attributes: [AttributeInput!]!",inner:"attributes: $attributes",variables:e,createInput:e});return w(n,"attributes")})},setDiscountCodes(t){return L(async()=>{let e={discountCodes:Xe(t)},n=await T({name:"cartDiscountCodesUpdate",args:"$discountCodes: [String!]!",inner:"discountCodes: $discountCodes",variables:e,createInput:e});return w(n,"discount")})},async applyDiscount(t){let e=t.trim();if(!e)throw new C("No discount code",{code:"INVALID_DISCOUNT"});let n=await J.setDiscountCodes(o=>[...new Set([...o,e])]),r=e.toLowerCase();if((n?.discountCodes??[]).find(o=>o.code.toLowerCase()===r)?.applicable)return n;try{await J.removeDiscount(e)}catch(o){y(o,"removing a discount code Shopify refused")}throw new C(`Discount code not valid: ${e}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=t.trim().toLowerCase();return J.setDiscountCodes(n=>n.filter(r=>r.toLowerCase()!==e))},setBuyerIdentity(t,{create:e=!0}={}){return L(async()=>{let n=await T({name:"cartBuyerIdentityUpdate",args:"$buyerIdentity: CartBuyerIdentityInput!",inner:"buyerIdentity: $buyerIdentity",variables:{buyerIdentity:t},createInput:e?{buyerIdentity:t}:null}).catch(r=>{if(e||!Y(r))throw r;return null});return w(n,"buyer-identity")})},checkout:le,drawers:k,isOpen:S,open:G,close:it,toggle:qt};export{ye as a,at as b,ot as c,on as d,ut as e,lt as f,Kt as g,J as h};
@@ -1 +0,0 @@
1
- var A=Object.defineProperty;var W=(n,e,t)=>e in n?A(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Zn=(n,e)=>{for(var t in e)A(n,t,{get:e[t],enumerable:!0})};var Qn=(n,e,t)=>W(n,typeof e!="symbol"?e+"":e,t);var q=/^(\d{4})-(01|04|07|10)$/;function T(n){let e=q.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var R=n=>T(n)!==null,v=(n,e)=>`${n}-${String(e).padStart(2,"0")}`;function E(n,e=1){let t=T(n);if(!t)throw new Error(`not a quarterly Shopify API version: ${n}`);let o=t.year*4+(t.month-1)/3+e;return v(Math.floor(o/4),o%4*3+1)}function Wn(n,e=new Date){if(n==="unstable")return{version:n,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let t=T(n);if(!t)return{version:n,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let o=new Date(Date.UTC(t.year,t.month-1,1)),r=new Date(Date.UTC(t.year,t.month-1+12,1)),i=(r.getTime()-e.getTime())/2630016e3,d=o<=e,l=`supported until about ${r.toISOString().slice(0,7)}`;return d?i<=0?l="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see docs/reference.md)":i<3&&(l=`${l}: plan the upgrade to ${E(n)} or later (see docs/reference.md)`):l="not released yet (release candidate at best)",{version:n,ok:d&&i>0,monthsLeft:Math.round(i),next:E(n),note:l}}function C(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function X(n,e){return C(n)?n[e]:void 0}function J(n){return Array.isArray(n)?n:[]}function nn(n){return typeof n=="string"&&n!==""?n:null}var en=n=>typeof n=="number"&&Number.isFinite(n)?n:null,vn=n=>en(n)??0,_=(n,e)=>J(n).map(t=>e(t)),Xn=(n,e)=>({nodes:_(X(n,"nodes"),e)}),Jn=n=>_(n,nn).filter(e=>e!==null);var tn=/^[A-Z]{2}$/,on=new Set(["XX","T1"]),rn=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),sn=/^[A-Z]{2,3}$/;function h(n){let e=(typeof n=="string"?n:"").trim().toUpperCase();return!tn.test(e)||on.has(e)?null:e}function w(n){let e=(typeof n=="string"?n:"").trim().replace("-","_").toUpperCase();if(rn.has(e))return e;let t=e.split("_")[0]??"";return sn.test(t)?t:null}var re={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function ie(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function se(n){return/^shp[a-z]{2}_/.test(n.trim())}function ae(n,e){if(!n)return"";let t=parseFloat(n.amount);if(Number.isNaN(t))return"";try{return new Intl.NumberFormat(e||void 0,{style:"currency",currency:n.currencyCode}).format(t)}catch{return`${n.currencyCode} ${t.toFixed(2)}`}}function ue(n,e,t){if(!/\{(handle|id)\}/.test(n))return e?`${n.replace(/\/$/,"")}/${encodeURIComponent(e)}`:null;let o=t?t.split("/").at(-1)??"":"";return n.includes("{handle}")&&!e||n.includes("{id}")&&!o?null:n.replace(/\{handle\}/g,encodeURIComponent(e??"")).replace(/\{id\}/g,encodeURIComponent(o))}function ce(n){let e=String(n??"").trim();return e?e.startsWith("gid://")?e:/^\d+$/.test(e)?`gid://shopify/Product/${e}`:/\/products\/([^/?#]+)/.exec(e)?.[1]??e:null}var N="2026-07";var an=/^[A-Za-z0-9_.-]+$/,un=/^(\$app(:[A-Za-z0-9_-]+)?|[A-Za-z0-9_.-]+)$/,b=(n,e)=>un.test(n)&&an.test(e);function P(n){let e=n.indexOf(".");if(e<=0)return null;let t=n.slice(0,e),o=n.slice(e+1);return b(t,o)?{namespace:t,key:o}:null}var cn=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,ln=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,fn=/^[A-Za-z_$][\w$]*$/,M="https://site.invalid",dn=new Set(["localhost","127.0.0.1","[::1]"]),L=["saved","server","webflow"],pn=["no-banner","default-banner","custom-banner"],y=n=>typeof n=="string"&&n!=="",gn=n=>typeof n=="function";function U(n,e){if(typeof n!="string"||!n)return"";let t=n.replace(/^https?:\/\//,"").replace(/\/.*$/,"");return Cn(t)?t:(e("domain",n),"")}function F(n){if(!y(n))return!1;try{let e=new URL(n,`${M}/`);return e.origin===M?!0:e.protocol==="https:"||e.protocol==="http:"&&dn.has(e.hostname)}catch{return!1}}function $(n,e){return n==null||n===""?null:typeof n=="string"&&(F(n)||yn(n))?n:(e("partsUrl",n),null)}function yn(n){if(typeof location>"u")return!1;try{return new URL(n).origin===location.origin}catch{return!1}}function mn(n){if(typeof n!="string")return null;try{let e=new URL(n);return e.protocol==="https:"&&e.href===new URL(e.origin).href?e.origin:null}catch{return null}}function V(n,e){if(!Array.isArray(n))return e("embedOrigins",n),[];let t=[],o=n;for(let r of o){let i=mn(r);i?t.push(i):e("embedOrigin",r)}return t}function On(n){if(typeof n=="string")return P(n);if(typeof n!="object"||n===null)return null;let e=Reflect.get(n,"namespace"),t=Reflect.get(n,"key");return typeof e!="string"||typeof t!="string"?null:b(e,t)?{namespace:e,key:t}:null}function D(n,e){if(!Array.isArray(n))return e("metafields",n),[];let t=[],o=n;for(let r of o){let i=On(r);i?t.push(typeof r=="string"?r:i):e("metafield",r)}return t}var p=n=>e=>n(e)?e:void 0,Cn=n=>y(n)&&cn.test(n),kn=n=>y(n)&&ln.test(n),Tn=n=>typeof n=="boolean"||y(n)&&fn.test(n),g=p(F),k=p(y),I=p(n=>typeof n=="boolean"),H=p(gn);function m(n,e,t,o){if(e==null)return null;if(!C(e))return o(n,e),null;let r={};for(let i in t){let d=e[i];if(d===void 0)continue;let l=t[i](d);l===void 0?o(`${n}.${i}`,d):r[i]=l}return r}var hn={server:g,orderUrl:g,subscriptionsUrl:g,paymentUrl:g,logoutUrl:g,locale:k,navigate:H},wn="customer accounts need the Worker since 0.7.0: set account.server",bn={country:k,language:k,locale:k},xn={detect:n=>{if(typeof n=="boolean")return n;let e=Array.isArray(n)?n:[n];return typeof n=="string"||Array.isArray(n)?L.filter(t=>e.includes(t)):void 0},locales:n=>{if(!C(n))return;let e={};for(let[t,o]of Object.entries(n)){let r=m(`markets.locales.${t}`,o,bn,()=>{});r&&(e[t]=r)}return e},cookie:p(kn),remember:I,strict:I},Sn={consent:n=>pn.find(e=>e===n),proxy:n=>n!==void 0&&!!n},An={dataLayer:p(Tn),shopify:n=>typeof n=="boolean"?n:m("analytics.shopify",n,Sn,()=>{})??void 0,onEvent:H};function K(n,e,t){let o=m("account",n,hn,e);if(o===null)return null;let{server:r}=o;return r===void 0?(t(wn),null):{...o,server:r}}var x=(n,e)=>m("markets",n,xn,e),Y=(n,e)=>m("analytics",n,An,e);var u={domain:"",token:"",apiVersion:N,country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],embedOrigins:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,requestTimeout:15e3,revalidate:!0,storageKey:"",cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",variantUrl:!1,maxAge:60,lowStock:5,searchDelay:150,autoMount:!0,observe:!1,astro:!0,partsUrl:null,analytics:null,account:null,warningText:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},a={...u};function S(n){return c(`Tether.config is read-only (${String(n)}): pass options to Tether.init() instead`),!1}var G=new WeakMap,B={get:(n,e)=>j(Reflect.get(n,e)),getOwnPropertyDescriptor(n,e){let t=Reflect.getOwnPropertyDescriptor(n,e);return t&&(t.value=j(t.value)),t},set:(n,e)=>S(e),deleteProperty:(n,e)=>S(e),defineProperty:(n,e)=>S(e)};function j(n){return typeof n=="object"&&n!==null?Rn(n):n}function Rn(n){let e=G.get(n);return e||(e=new Proxy(n,B),G.set(n,e)),e}var he=new Proxy(a,B),_n=/^[a-z][a-z0-9-]*$/,Nn=["revalidate","openCartOnAdd","cartFocus","variantUrl","autoMount","observe","astro","debug"],Pn=["token","productPath","collectionPath"],Mn=["imagesFirst","variantsFirst","sellingPlanGroupsFirst","sellingPlansFirst","collectionFirst","retries","requestTimeout","maxAge","lowStock","searchDelay"],In=["warningText","formatMoney","onLayoutChange","onCartOpen","onCartClose","onLineEnter","onLineLeave","onValueChange","onError"];function f(n,e,t){return e!==void 0&&c(`invalid ${n} ${JSON.stringify(e)}: using ${JSON.stringify(t)}`),t}function s(n,e){c(`invalid ${n} ${JSON.stringify(e)}: ignored`)}function Ln(n){for(let e of Object.keys(n))Object.hasOwn(u,e)||c(`unknown option ${JSON.stringify(e)}: ignored`)}function Un(n,e,t){typeof t=="function"?n[e]=t:t!=null&&s(e,t)}var z=2147483647,Fn=10,O={min:1,max:250},$n={imagesFirst:O,variantsFirst:O,sellingPlanGroupsFirst:O,sellingPlansFirst:O,collectionFirst:O,requestTimeout:{max:z},searchDelay:{max:z},retries:{max:Fn}};function Vn(n,e){let{min:t=0,max:o}=$n[n]??{};return typeof e!="number"||!Number.isInteger(e)||e<t?f(n,e,u[n]):o===void 0||e<=o?e:(c(`${n} ${String(e)} is more than its maximum: using ${String(o)}`),o)}function Dn(n,e){return typeof e=="boolean"?e:f(n,e,u[n])}function Hn(n,e){return typeof e=="string"?e:f(n,e,u[n])}var Kn=/^\S+$/;function Yn(n,e){return typeof e=="string"&&Kn.test(e)?e:f(n,e,u[n])}function Gn(n){if(!(n==null||n==="")){try{if(typeof n=="string"&&Intl.getCanonicalLocales(n).length)return n}catch{}s("locale",n)}}function Z(n,e,t){return t.find(o=>o===e)??f(n,e,t[0])}function jn(n){return n==="unstable"?(c('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),n):R(n)?n:f("apiVersion",n,u.apiVersion)}function Q(n,e,t){if(e==null||e==="")return;let o=t(e);if(o!==null)return o;s(n,e)}function zn(n){Ln(n);let e=U(n.domain,s),t=typeof n.prefix=="string"&&_n.test(n.prefix)?n.prefix:f("prefix",n.prefix,u.prefix),o={...u,domain:e,apiVersion:jn(n.apiVersion),country:Q("country",n.country,h),locale:Gn(n.locale),partsUrl:$(n.partsUrl,s),language:Q("language",n.language,w),markets:x(n.markets,s),analytics:Y(n.analytics,s),account:K(n.account,s,c),prefix:t,storageKey:typeof n.storageKey=="string"&&n.storageKey?n.storageKey:`${t}:cart:${e}`,metafields:D(n.metafields??[],s),embedOrigins:V(n.embedOrigins??[],s),checkoutTarget:Z("checkoutTarget",n.checkoutTarget,["_self","_blank"]),defaultPurchase:Z("defaultPurchase",n.defaultPurchase,["one-time","subscription"]),cartDrawerOpenClass:Yn("cartDrawerOpenClass",n.cartDrawerOpenClass)};for(let r of Mn)o[r]=Vn(r,n[r]);for(let r of Nn)o[r]=Dn(r,n[r]);for(let r of Pn)o[r]=Hn(r,n[r]);for(let r of In)Un(o,r,n[r]);return o}var we=n=>x(n,s);function be(n={}){let e=zn(n);for(let t of Object.keys(a))t in e||Reflect.deleteProperty(a,t);return Object.assign(a,e)}var xe=()=>!!(a.domain&&a.token);function Se(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function c(...n){console.warn(`[${a.prefix}]`,...n)}function Ae(n,e){if(c(e,n instanceof Error&&n.message?n.message:n),!!a.onError)try{a.onError(n,e)}catch(t){c("onError threw",t)}}function _e(n){return n instanceof Error?n.message:String(n)}export{Zn as a,Qn as b,Wn as c,C as d,X as e,J as f,nn as g,en as h,vn as i,_ as j,Xn as k,Jn as l,L as m,On as n,h as o,w as p,re as q,ie as r,se as s,ae as t,ue as u,ce as v,u as w,a as x,he as y,zn as z,we as A,be as B,xe as C,Se as D,c as E,Ae as F,_e as G};
@@ -1 +0,0 @@
1
- import{D as I,E as b,F as w,G as K,b as T,d as E,e as v,o as q,p as B,t as Q,u as W,x as c}from"./chunk-ESYKAFMU.js";var g=class extends Error{constructor(r,{status:n,errors:o,userErrors:i,code:s}={}){super(r);T(this,"name","TetherError");T(this,"code");T(this,"status");T(this,"errors");T(this,"userErrors");this.code=s??(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=o,this.userErrors=i}};function k(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?E(t):typeof t===e:At(e)?Array.isArray(t)&&t.every(r=>k(r,e[0])):E(t)&&Object.entries(e).every(([r,n])=>n===void 0||k(t[r],n))}var At=t=>Array.isArray(t),Qe=t=>e=>e===null||k(e,t),We=t=>e=>k(e,t);function xt(t=c){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var Z=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,vt=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function kt(t){return/\bmutation\b/.test(t.replace(Z,""))?"mutation":"query"}function tt(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let o=`@inContext(${n.join(", ")})`,i=t.replace(Z,p=>" ".repeat(p.length)),s=i.indexOf("{");if(i.slice(0,s).includes("@inContext"))return t;if(i.trimStart().startsWith("{"))return`query ${o} ${t.slice(s)}`;let a=vt.exec(i);if(!a)return t;let l=a[0].length;return`${t.slice(0,l).trimEnd()} ${o} ${t.slice(l).trimStart()}`}function Ke(t,e=c){let r=q(e.country)??void 0,n=B(e.language)??void 0;return tt(t,{country:r,language:n})}var M=300,Rt=500,Ot=3e4,z=430,Nt=1e3,_="quantityAvailable",Y=new Set,Ct=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function Lt(t,e,r,{context:n,operation:o}){let i=typeof e=="string"?e:e(r),s=n?tt(i,t):i;return t.maxAge<=0||o==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*Nt))}`}var It=t=>new Promise(e=>setTimeout(e,t));function U(t,e){if(t===401||t===403){let r=e.token.startsWith("shpat_")?", not an Admin API token (shpat_\u2026)":"";return`Shopify rejected the Storefront token for ${e.domain} (${t}): use the public Storefront API token (Headless channel)${r}`}return t===404?`Store or API version not found (404): check domain ${e.domain} and apiVersion ${e.apiVersion}`:`HTTP ${t} from ${e.domain}`}function Pt(t){let e=v(t,"message"),r=v(v(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function _t(t){if(!E(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(Pt)}:null}function P(t,e){return t.ok?new g(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new g(U(t.status,e),{status:t.status})}function J(t,e,r,n){let o=e.map(s=>s.message).filter(Boolean).join(" | "),i=o||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!o?U(t.status,r):o),new g(i,{status:t.status,errors:e,code:n})}function X(t,e){if(e==="any")return{kind:"retry",backoffMs:M};throw new g(`Network error: ${K(t)}`,{code:"NETWORK"})}function Mt(t,e,r,n,o,i,s){if(r.includes(_)&&n.some(d=>d.message.includes(_)))return{kind:"inventory-refused",error:J(t,n,e)};let a=n.map(d=>d.extensions?.code);if(i!=="none"&&a.includes("THROTTLED"))return{kind:"retry",backoffMs:Rt};let l=a.includes("INTERNAL_SERVER_ERROR");if(i==="any"&&l)return{kind:"retry",backoffMs:M};let p=t.ok&&(l||s==="mutation"&&o==null);throw J(t,n,e,p?"SERVER_ERROR":void 0)}async function Ut(t,e){if(!t)return e(null);let r=new AbortController,n=setTimeout(()=>{r.abort(new DOMException("signal timed out","TimeoutError"))},t);try{return await e(r.signal)}finally{clearTimeout(n)}}async function Ht(t,e,r,n,o,i,s){let a;try{a=await(t.fetch??fetch)(xt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r}),signal:s})}catch(f){return X(f,o)}if(a.status===z)throw new g("Shopify security rejection (430)",{status:z});if(o!=="none"&&a.status===429||o==="any"&&a.status>=500)return{kind:"retry",backoffMs:M};let l;try{l=await a.json()}catch(f){if(f instanceof SyntaxError)throw P(a,t);return X(f,o)}let p=_t(l);if(!p)throw P(a,t);let{data:d,errors:h=[]}=p;if(h.length)return Mt(a,t,e,h,d,o,i);if(!a.ok)throw new g(U(a.status,t),{status:a.status});if(!n(d))throw P(a,t);return{kind:"data",data:d}}async function et(t,e,r,n,{context:o=!0,operation:i="query"}={}){if(!t.domain||!t.token)throw new g("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=Ct(t),a=i==="mutation"?"not-run":"any",l=0;for(;;){let p={inventory:!Y.has(s)},d=Lt(t,e,p,{context:o,operation:i}),h=l<t.retries?a:"none",f=await Ut(t.requestTimeout,S=>Ht(t,d,r,n,h,i,S));switch(f.kind){case"data":return f.data;case"inventory-refused":if(typeof e=="string"||!p.inventory)throw f.error;I(`the token can't read inventory: ${_} is left out from now on`),Y.add(s);break;case"retry":await It(Math.min(f.backoffMs*2**l,Ot)),l+=1,I("retry",l);break}}}function ze(t,e,r,n){return et(c,t,e,r,n)}var $t=t=>typeof t=="object"&&t!==null;function Dt(t,e,r={},n){return et(t,e,r,$t,{...n,operation:kt(e)})}function Ye(t,e,r){return Dt(c,t,e,r)}function Je(t,e){if(!t)throw new g(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new g(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var m=t=>`${c.prefix}-${t}`,Ft=(t,e)=>e===void 0?`[${m(t)}]`:`[${m(t)}="${e}"]`,R=(t,e)=>t.getAttribute(m(e)),Vt=(t,e)=>t.hasAttribute(m(e));function rt(t,e){return t?[...t.querySelectorAll(e)]:[]}var Gt=(t,e,r)=>rt(t,e).filter(n=>n.closest(r)===t),jt=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],nt=new WeakMap;function ot(t,e){let r=new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0});return nt.set(r,t),r}function qt(t,e){return nt.get(t)===e}function H(t,e,r=document){r.dispatchEvent(ot(t,e))}function st(t,{width:e,height:r,crop:n}={}){if(!t)return t;let o;try{o=new URL(t)}catch(i){if(i instanceof TypeError)return t;throw i}return e&&o.searchParams.set("width",String(e)),r&&o.searchParams.set("height",String(r)),n&&o.searchParams.set("crop",n),o.toString()}function $(t,e){return t.getAttribute(e)??t.getAttribute(m(e))??t.getAttribute(`data-${e}`)}function at(t,e){if(!t||!e)return t;let r=$(e,"max-width"),n=$(e,"max-height");return st(t,{width:r,height:n,crop:r||n?$(e,"crop"):null})}var it=t=>t.replace(/\?.*$/,"");function ut(t,e){return!t||!e?!1:it(t)===it(e)}function Bt(t){return/^\s*[a-z][a-z0-9+.-]*:/i.test(t)&&!/^\s*(https?:|data:image\/)/i.test(t)?"none":`url("${t.replace(/["\\\n\r\f]/g,n=>`\\${n.charCodeAt(0).toString(16)} `)}")`}function Qt(t,e,r){if(!e)return;let n=at(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Bt(n);return}if(ut(t.getAttribute("src"),n)){r!=null&&!t.getAttribute("alt")&&t.setAttribute("alt",r);return}t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",n),r!=null&&t.setAttribute("alt",r),t.getAttribute("loading")||t.setAttribute("loading","lazy")}var D=new WeakMap,Wt=t=>!!D.get(t),F=t=>t.cloneNode(!0);function ct(t){let e=D.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?F(r):null;return D.set(t,n),t.replaceChildren(),n}function Kt(t,e,r){let n=ct(t);if(!n){e.length&&b("repeater without a template child",t);return}t.replaceChildren(),e.forEach((o,i)=>{let s=F(n);r(s,o,i),t.appendChild(s)})}function zt(t,e){let r=()=>{t.remove()};if(!e){r();return}try{e(t,r)}catch(n){w(n,"repeater onLeave"),r()}}function Yt(t,e,r,n){e.forEach((o,i)=>{if(!r.has(o))return;let s=e[i-1];if(s?.parentNode===t?s.after(o):t.prepend(o),!!n)try{n(o)}catch(a){w(a,"repeater onEnter")}})}function Jt(t,e,r,n,{onEnter:o,onLeave:i}={}){let s=ct(t);if(!s){b("repeater without a template child",t);return}let a=`data-${c.prefix}-key`,l=`data-${c.prefix}-leaving`,p=()=>[...t.children].filter(u=>u.hasAttribute(a)&&!u.hasAttribute(l)),d=new Map(p().map(u=>[u.getAttribute(a),u])),h=[],f=new Set;e.forEach((u,x)=>{let L=String(r(u,x)),y=d.get(L);y?d.delete(L):(y=F(s),y.setAttribute(a,L),f.add(y)),n(y,u,x,f.has(y)),h.push(y)});let S=h.filter(u=>!f.has(u)),j=p().filter(u=>S.includes(u));if(!(j.length===S.length&&j.every((u,x)=>u===S[x]))){d.forEach(u=>{u.remove()}),h.forEach(u=>t.appendChild(u));return}Yt(t,h,f,o),d.forEach(u=>{u.setAttribute(l,""),u.removeAttribute(a),u.style.pointerEvents="none",u.inert=!0,zt(u,i)})}var Xt="http://www.w3.org/1999/xhtml",Zt=new Set(["h1","h2","h3","h4","h5","h6","p","span","div","br","hr","blockquote","code","pre","strong","em","b","i","u","s","small","sub","sup","ul","ol","li","dl","dt","dd","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","a","img","picture","source","video","figure","figcaption","iframe"]),te=new Set(["script","style","template","noscript","textarea","select","title"]),ee=new Set(["style","title","lang","dir","role","align","width","height"]),re=new Map([["a",new Set(["href","target","rel","hreflang"])],["img",new Set(["src","srcset","sizes","alt","loading","decoding"])],["source",new Set(["src","srcset","sizes","type","media"])],["video",new Set(["src","poster","controls","autoplay","muted","loop","playsinline","preload"])],["iframe",new Set(["src","allow","allowfullscreen","frameborder","loading"])],["blockquote",new Set(["cite"])],["ol",new Set(["start","type","reversed"])],["li",new Set(["value"])],["table",new Set(["border","cellpadding","cellspacing","summary"])],["col",new Set(["span"])],["colgroup",new Set(["span"])],["th",new Set(["colspan","rowspan","headers","scope","valign"])],["td",new Set(["colspan","rowspan","headers","valign"])]]),ne=new Set(["href","src","poster","cite"]),oe=/^(javascript|vbscript|data):/i,ie=/^data:image\/(png|gif|jpeg|webp|avif);/i,se=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),ae=["inset","transform","translate","rotate","scale","offset"],ue=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,ce=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,lt=40,le=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:lt}]]),dt=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,de=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ft=/(?:var|calc|min|max|clamp|env|attr)\(/i,fe=/url\(|expression\(|@import/i,pe=/[\u0000- ]/g,ge="allow-scripts allow-same-origin allow-popups allow-presentation",me=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),he="strict-origin-when-cross-origin",ye=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function Ee(t,e){return ee.has(e)||e.startsWith("aria-")||(re.get(t)?.has(e)??!1)}function Te(t,e,r){let n=r.replace(pe,"");return oe.test(n)?t==="img"&&e==="src"&&ie.test(n):!0}function pt(t,e){try{return new URL(t,e)}catch{return null}}function be(t,e,r){let n=t.baseURI,o=pt(n)?.origin??"null";return{origin:o==="null"?null:o,baseUrl:n,styleParser:e,embedOrigins:new Set([...ye,...r])}}function we(t,e){let r=pt(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function Se(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>me.has(r)))].join("; ")}function Ae(t,e){if(se.has(t)||ae.some(n=>t.startsWith(n))||ue.test(e))return!0;let r=le.get(t);return r?ft.test(e)||xe(e,r):t.startsWith("margin")&&e.includes("-")}function xe(t,e){return[...t.matchAll(dt)].some(([r="",n=""])=>{let o=parseFloat(r);if(o>=0)return!1;let i=e[n.toLowerCase()];return i===void 0||-o>i})}function ve(t,e){return ce.test(t.replace(/^-webkit-/,""))?ft.test(e)?!0:[...e.replace(de,"").matchAll(dt)].some(([r="",n=""])=>{let o=Math.abs(parseFloat(r));return o!==0&&(n.toLowerCase()!=="px"||o>lt)}):!1}function ke(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(i,s)=>r.item(s));for(let i of n){let s=r.getPropertyValue(i);(Ae(i,s)||ve(i,s)||fe.test(s))&&r.removeProperty(i)}let o=r.cssText;return e.removeAttribute("style"),o}function Re(t,e){let r=t.localName;for(let i of[...t.attributes]){let s=i.name.toLowerCase(),a=ne.has(s);Ee(r,s)&&(!a||Te(r,s,i.value))||t.removeAttribute(i.name)}let n=t.getAttribute("style");if(n===null)return;let o=ke(n,e.styleParser);o===""?t.removeAttribute("style"):t.setAttribute("style",o)}var Oe=new Set(["","_self","_parent","_top"]);function Ne(t){if(t.localName==="iframe"){let n=Se(t.getAttribute("allow")??"");n===""?t.removeAttribute("allow"):t.setAttribute("allow",n),t.setAttribute("sandbox",ge),t.setAttribute("referrerpolicy",he);return}if(t.localName!=="a")return;let e=t.getAttribute("target");if(e===null||Oe.has(e.toLowerCase()))return;let r=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));r.add("noopener"),r.add("noreferrer"),t.setAttribute("rel",[...r].join(" "))}function Ce(t,e){let r=t.localName,n=t.namespaceURI===Xt;if(n&&te.has(r)){t.remove();return}if(!n||!Zt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!we(t.getAttribute("src")??"",e)){t.remove();return}Re(t,e),Ne(t)}function gt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let o=be(e,n,r);for(let i of[...n.content.querySelectorAll("*")])Ce(i,o);return n.content}var mt="data-tether-seen",G="data-tether-shown",N="data-tether-prev-display",Le=120;function fr(t,e){return W(c.productPath||"/product",t,e)}function bt(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function pr(t,e=c.locale){return t?bt(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function gr(t){return t?c.formatMoney?c.formatMoney(t,c.locale):Q(t,c.locale):""}function mr(t){return t?bt(()=>new Date(t).toLocaleDateString(c.locale||void 0),""):""}function hr(t,e){t.replaceChildren(gt(e,t.ownerDocument,c.embedOrigins))}var wt=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",A=t=>t.tagName==="INPUT";function Ie(t,e){let r=e==null?"":String(e);wt(t)?t.value=r:t.textContent=r}var ht=t=>wt(t)?t.value:t.textContent;function yr(t,e){let r=ht(t);if(Ie(t,e),r!==ht(t)&&t.hasAttribute(mt)&&c.onValueChange)try{c.onValueChange(t,r)}catch(n){w(n,"onValueChange")}t.setAttribute(mt,"1")}function Pe(t){if(t.hasAttribute(G))return;t.setAttribute(G,""),t.removeAttribute("hidden");let e=t.getAttribute(N);e!==null?(t.style.display=e,t.removeAttribute(N)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(m("display"))||"block")}function Er(t,e){if(e){Pe(t);return}t.removeAttribute(G),!t.hasAttribute(N)&&t.style.display!=="none"&&t.setAttribute(N,t.style.display),t.style.display="none"}var C='input[type="radio"],input[type="checkbox"]',_e=["radio","checkbox","switch","menuitemradio","menuitemcheckbox"],Me=["button","submit","reset"];function St(t){let e=t.getAttribute("role");return e==="button"?"aria-pressed":e&&_e.includes(e)?"aria-checked":e==="option"||e==="tab"?"aria-selected":e?null:A(t)?Me.includes(t.type)?"aria-pressed":null:t.querySelector(C)?null:"aria-pressed"}function Tr(t,e){t.classList.toggle("is-selected",e);let r=St(t);r==="aria-pressed"&&t.tagName!=="BUTTON"&&!A(t)&&(t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0")),r&&t.setAttribute(r,String(e)),A(t)&&t.matches(C)&&(t.checked=e);let n=t.querySelector(C);n&&A(n)&&(n.checked=e)}var O="tether-unavailable";function Ue(t,e){if(e&&!document.getElementById(O)){let n=document.createElement("span");n.id=O,n.hidden=!0,n.textContent="Unavailable",document.body.append(n)}let r=(t.getAttribute("aria-describedby")??"").split(" ").filter(n=>n&&n!==O);e&&r.push(O),r.length?t.setAttribute("aria-describedby",r.join(" ")):t.removeAttribute("aria-describedby")}function br(t,e,r){t.classList.toggle("is-unavailable",e);let o=St(t)!==null||A(t)?t:t.querySelector(C);o&&(r==="picks-closest"?Ue(o,e):o.setAttribute("aria-disabled",String(e)))}var yt,He=t=>Reflect.get(window,t);function $e(){let t=He("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function De(t){clearTimeout(yt),yt=setTimeout(()=>{try{c.onLayoutChange?c.onLayoutChange(t):$e()}catch(e){w(e,"layout-changed")}H("layout-changed",{reason:t})},Le)}function wr(t,e){let r=[...t.querySelectorAll("img")].filter(i=>!i.complete),n=r.length,o=()=>{n-=1,n===0&&De(`${e}:images`)};r.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function Sr(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve(void 0):(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>{t.removeAttribute("aria-busy")}))}function Ar(t,e){let r=t?R(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return b(`invalid JSON in ${m(e)}`,t),null}}var Fe=/^-?\d+$/,Et=new WeakMap;function Tt(t,e,r){let n=Et.get(t)??new Set;Et.set(t,n),!n.has(e)&&(n.add(e),b(`${m(e)} ${r}`,t))}function xr(t,e,{min:r,max:n,fallback:o}){let i=R(t,e)?.trim();if(!i)return o;let s=Fe.test(i)?Number(i):Number.NaN;return Number.isNaN(s)||s<r?(Tt(t,e,`${JSON.stringify(i)} is not a whole number from ${String(r)}: using ${String(o)}`),o):n===void 0||s<=n?s:(Tt(t,e,`${i} is more than its maximum: using ${String(n)}`),n)}function V(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function vr(t){return Array.isArray(t)?t.filter(E).map(r=>({key:V(r.key),value:V(r.value)})):E(t)?Object.entries(t).map(([e,r])=>({key:e,value:V(r)})):[]}function kr(t){return t?Array.isArray(t)?t.map(e=>({key:String(e.key),value:String(e.value??"")})):Object.entries(t).map(([e,r])=>({key:e,value:String(r??"")})):[]}export{g as a,k as b,Qe as c,We as d,xt as e,Ke as f,Ut as g,et as h,ze as i,Dt as j,Ye as k,Je as l,m,Ft as n,R as o,Vt as p,rt as q,Gt as r,jt as s,qt as t,H as u,st as v,ut as w,Qt as x,Wt as y,Kt as z,Jt as A,fr as B,pr as C,gr as D,mr as E,hr as F,Ie as G,yr as H,Er as I,Tr as J,br as K,He as L,De as M,wr as N,Sr as O,Ar as P,Fe as Q,xr as R,vr as S,kr as T};
@@ -1 +0,0 @@
1
- import{a as n}from"./chunk-UU2VVXU2.js";import{g as r}from"./chunk-HZYW2TS3.js";import{n as e}from"./chunk-HO6SNO3A.js";import{F as i}from"./chunk-ESYKAFMU.js";var d=()=>`${e("collection")},${e("products")},${e("recommendations")}`;function a(t){return r(t,"loading"),{root:t,load:()=>n("lists").then(o=>o.loadList(t)).catch(o=>{r(t,"error",o),i(o,"lists")})}}export{d as a,a as b};
@@ -1 +0,0 @@
1
- import{b as c,c as u,d as o}from"./chunk-HO6SNO3A.js";import{d as m,e as s,n as g,x as p}from"./chunk-ESYKAFMU.js";var e="amount currencyCode",P={inventory:!0},f=t=>t.inventory?"quantityAvailable":"",n="url altText width height";function A(t){let i=[];for(let l of t){let r=g(l);r&&i.push(r)}return i.length?`metafields(identifiers:[${i.map(({namespace:l,key:r})=>`{namespace: ${JSON.stringify(l)}, key: ${JSON.stringify(r)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${n}}}}}`:""}var h=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${e}}}... on SellingPlanFixedPriceAdjustment{price{${e}}}}}`,$=` sellingPlan{id}checkoutChargeAmount{${e}}remainingBalanceChargeAmount{${e}}priceAdjustments{price{${e}}compareAtPrice{${e}}perDeliveryPrice{${e}}unitPrice{${e}}}`;function b(t=p,i=P){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${n}}images(first:${t.imagesFirst}){nodes{${n}}}options{name optionValues{name swatch{color image{previewImage{${n}}}}}}priceRange{minVariantPrice{${e}}maxVariantPrice{${e}}}compareAtPriceRange{minVariantPrice{${e}}maxVariantPrice{${e}}}${A(t.metafields)} sellingPlanGroups(first:${t.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${t.sellingPlansFirst}){nodes{${h}}}}}variants(first:${t.variantsFirst}){nodes{id title availableForSale currentlyNotInStock ${f(i)} sku barcode selectedOptions{name value}image{${n}}price{${e}}compareAtPrice{${e}}unitPrice{${e}}sellingPlanAllocations(first:${t.sellingPlansFirst}){nodes{${$}}}}}}`}function x(t=P){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${e}}totalAmount{${e}}checkoutChargeAmount{${e}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${e}}subtotalAmount{${e}}amountPerQuantity{${e}}compareAtAmountPerQuantity{${e}}}discountAllocations{discountedAmount{${e}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${e}}priceAdjustments{price{${e}}compareAtPrice{${e}}perDeliveryPrice{${e}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping ${f(t)} image{${n}}price{${e}}compareAtPrice{${e}}selectedOptions{name value}product{id title handle vendor featuredImage{${n}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function F(){return` id handle title description descriptionHtml image{${n}}seo{title description}`}var d={amount:"string",currencyCode:"string"},a={id:"string",handle:"string",title:"string",options:["object"],images:{nodes:["object"]},priceRange:{minVariantPrice:d,maxVariantPrice:d},variants:{nodes:[{id:"string",price:d,selectedOptions:["object"]}]}},y={nodes:[a],pageInfo:{hasNextPage:"boolean"}},O=t=>s(t,"id")!==""&&s(t,"handle")!==""&&c(t,a),V=t=>m(t)&&(t.id===void 0||c(t,a)),k=o({collection:u({handle:"string",products:y})}),N=o({products:y}),_=o({productRecommendations:u([a])});export{b as a,x as b,F as c,d,a as e,O as f,V as g,k as h,N as i,_ as j};
@@ -1 +0,0 @@
1
- var e={diagnose:()=>import("./diagnose-QTIUBMXT.js"),markets:()=>import("./markets-ui-GQOUGLUL.js"),search:()=>import("./search-ZAB5GJOK.js"),lists:()=>import("./lists-SE5VBQ4K.js"),extras:()=>import("./extras-56DC6CHI.js"),account:()=>import("./account-GZLRHV5Z.js"),"account-pages":()=>import("./account-pages-32IFOHYU.js"),analytics:()=>import("./analytics-OIQ4TFGM.js")},a=t=>e[t](),o=void 0;export{a,o as b};
@@ -1 +0,0 @@
1
- import{a as E,c as P,d as k,e as T,f as p,g as A}from"./chunk-JJVUNGJZ.js";import{a as I}from"./chunk-LZINCBME.js";import{d as F,e as x}from"./chunk-TUVLYVMF.js";import"./chunk-33IQL4XN.js";import{h as u}from"./chunk-COXH5OXQ.js";import"./chunk-KW7UPDXI.js";import"./chunk-DQJRQBJG.js";import"./chunk-UU2VVXU2.js";import"./chunk-HZYW2TS3.js";import{e as w}from"./chunk-AMCCY6T4.js";import"./chunk-NOTL72DB.js";import{a as L,d as h,i as b,m as s,n as C,o as v,u as z}from"./chunk-HO6SNO3A.js";import{F as y,o as f,p as g,x as a}from"./chunk-ESYKAFMU.js";var _="{name} ({currency})",j="name",d=null;function B(){d=null}var D="query TetherLocalization{localization{country{isoCode name currency{isoCode symbol}}language{isoCode name}availableCountries{isoCode name currency{isoCode symbol}availableLanguages{isoCode name}}}}",O={isoCode:"string",name:"string",currency:"object"},H=h({localization:{country:O,availableCountries:[O]}});function R(){return d??(d=b(D,{},H).then(e=>e.localization,e=>{throw d=null,e})),d}function U(e,n){switch(n){case"name":return e.name;case"code":return e.isoCode;case"currency":return e.currency.isoCode;case"symbol":return e.currency.symbol;default:return""}}var Y=(e,n)=>e.replace(/\{(name|code|currency|symbol)\}/g,(o,i)=>U(n,i));function q(e,n,o){let i=e.getAttribute(s("country-label"))||_,r=(e.getAttribute(s("countries"))||"").toUpperCase().split(/[\s,]+/).filter(Boolean),c=r.length?r.map(t=>n.find(l=>l.isoCode===t)).filter(t=>t!==void 0):n;e.replaceChildren(...c.map(t=>new Option(Y(i,t),t.isoCode))),e.value=o,e.value!==o&&(e.selectedIndex=-1),e.disabled=c.length<2&&!e.hasAttribute(s("always-enabled"))}function $(e,n,o){let i=(a.country||o.country.isoCode).toUpperCase(),r=[...o.availableCountries].sort((t,l)=>t.name.localeCompare(l.name,a.locale||void 0)),c=r.find(t=>t.isoCode===i)??o.country;e.forEach(t=>{q(t,r,i)}),n.forEach(t=>{t.textContent=U(c,v(t,"country-bind")||j)})}function S(e=document){let n=p(e,`select${C("country-select")}`),o=p(e,C("country-bind"));return!n.length&&!o.length?Promise.resolve():R().then(i=>{$(n,o,i)}).catch(i=>{y(i,"country select")})}var Q=e=>Object.values(a.markets?.locales??{}).find(n=>f(n.country)===e);function V(e,n){return e!==void 0?g(e):n?n.language?g(n.language):void 0:a.language}function Z(e){w();let n=[];return u.id()&&n.push(u.setBuyerIdentity({countryCode:e},{create:!1}).catch(o=>{y(o,"cart country")})),T(),k.forEach(o=>n.push(o.load())),P.forEach(o=>{o.closest(I())||(E.delete(o),A(o))}),n}async function re(e,{language:n,locale:o,remember:i=!0}={}){let r=f(e);if(!r)throw new L(`Not a country code: ${e}`,{code:"INVALID_COUNTRY"});let c=Q(r),t=o||c?.locale,l=t||a.locale,m=V(n,c),M=r!==a.country||m!==a.language||l!==a.locale;if(a.country=r,a.language=m||void 0,a.locale=l,i&&x({country:r,language:m,locale:t}),!M)return S(),u.state;n!==void 0&&B();let N=Z(r);return S(),z("country-changed",{country:r,language:a.language}),await Promise.all(N),u.state}export{F as detectMarket,R as getLocalization,S as renderCountrySelects,re as setCountry};