@occluze/tether 0.9.7 → 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.
- package/README.md +1 -1
- package/dist/esm/astro.js +1 -1
- package/dist/esm/chunks/account-QFGF5FKX.js +1 -0
- package/dist/esm/chunks/{account-pages-LKNIXA6Q.js → account-pages-LMGIPFB7.js} +1 -1
- package/dist/esm/chunks/{analytics-TEU7HS7C.js → analytics-YSTR6H2W.js} +1 -1
- package/dist/esm/chunks/{chunk-YZC4KFT3.js → chunk-4BZ4X2Z6.js} +1 -1
- package/dist/esm/chunks/{chunk-47OLTPHV.js → chunk-ADA2ZGPO.js} +1 -1
- package/dist/esm/chunks/{chunk-BRI56DD5.js → chunk-B7SC7UOJ.js} +1 -1
- package/dist/esm/chunks/{chunk-SVJWBCRY.js → chunk-BGUUUMJO.js} +1 -1
- package/dist/esm/chunks/{chunk-KJLA4CVH.js → chunk-GOGPMJ2U.js} +1 -1
- package/dist/esm/chunks/{chunk-JJRRVUDP.js → chunk-HGNFQHEU.js} +1 -1
- package/dist/esm/chunks/{chunk-HRRJ7KUG.js → chunk-I54NQEVK.js} +1 -1
- package/dist/esm/chunks/{chunk-QPSIX4DK.js → chunk-IBOX3YGQ.js} +1 -1
- package/dist/esm/chunks/chunk-KF76466X.js +1 -0
- package/dist/esm/chunks/chunk-KH7NEM4B.js +1 -0
- package/dist/esm/chunks/{chunk-74HC6MR2.js → chunk-PHTINCRN.js} +1 -1
- package/dist/esm/chunks/chunk-QUBBZNJ7.js +1 -0
- package/dist/esm/chunks/chunk-R3UWDQL5.js +1 -0
- package/dist/esm/chunks/{chunk-Y5LISDPZ.js → chunk-SA5G3AUJ.js} +1 -1
- package/dist/esm/chunks/{chunk-O6Z6O5NW.js → chunk-UJH5ZECZ.js} +1 -1
- package/dist/esm/chunks/chunk-XQCBGVU2.js +1 -0
- package/dist/esm/chunks/{diagnose-YNVDJDSH.js → diagnose-IOC3BCP5.js} +1 -1
- package/dist/esm/chunks/{extras-BUH3OWBN.js → extras-5E72QFSJ.js} +1 -1
- package/dist/esm/chunks/{lists-6KQIGAO6.js → lists-35SUHUOX.js} +1 -1
- package/dist/esm/chunks/markets-ui-B3ILTPN7.js +1 -0
- package/dist/esm/chunks/{search-NPGWPFMA.js → search-QN457Q2G.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/server.js +2 -2
- package/dist/tether.account.js +12 -11
- package/dist/tether.account.min.js +1 -1
- package/dist/tether.js +119 -113
- package/dist/tether.lists.js +13 -11
- package/dist/tether.lists.min.js +1 -1
- package/dist/tether.markets.js +12 -0
- package/dist/tether.markets.min.js +1 -1
- package/dist/tether.min.js +1 -1
- package/dist/tether.min.js.map +4 -4
- package/dist/types/server/src/shared/serial.d.ts +2 -6
- package/dist/types/src/cart/checkout.d.ts +2 -1
- package/dist/types/src/cart/drawer.d.ts +5 -1
- package/dist/types/src/cart/mutations.d.ts +13 -13
- package/dist/types/src/cart/store.d.ts +4 -0
- package/dist/types/src/cart.d.ts +7 -2
- package/dist/types/src/config.d.ts +3 -1
- package/dist/types/src/fragments.d.ts +0 -2
- package/dist/types/src/part-use.d.ts +3 -0
- package/dist/types/src/shopify-fields.d.ts +8 -0
- package/dist/types/src/version.d.ts +1 -1
- package/package.json +5 -2
- package/dist/esm/chunks/account-53WAVEJF.js +0 -1
- package/dist/esm/chunks/chunk-EIPYBAVZ.js +0 -1
- package/dist/esm/chunks/chunk-FYGRVUVB.js +0 -1
- package/dist/esm/chunks/chunk-IG23NTJK.js +0 -1
- package/dist/esm/chunks/chunk-NXDME6AM.js +0 -1
- package/dist/esm/chunks/chunk-X2HBGPFB.js +0 -1
- package/dist/esm/chunks/markets-ui-YAEXVFRK.js +0 -1
|
@@ -2,11 +2,7 @@
|
|
|
2
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
3
|
* request throttle.
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<T>(task: () => Promise<T>): Promise<T>;
|
|
8
|
-
/** True while no task is waiting or running. */
|
|
9
|
-
idle: () => boolean;
|
|
10
|
-
}
|
|
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>;
|
|
11
7
|
/** A queue whose tasks never overlap. */
|
|
12
8
|
export declare function createSerialQueue(): SerialQueue;
|
|
@@ -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
|
-
/**
|
|
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
|
-
/**
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
*
|
|
53
|
-
*
|
|
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
|
-
|
|
55
|
+
create: boolean;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Runs a mutation on the saved cart, or creates a cart
|
|
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
|
|
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
|
-
* `
|
|
62
|
+
* `create` (the saved cart is forgotten first).
|
|
63
63
|
*/
|
|
64
|
-
export declare function mutateCart({ name,
|
|
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. */
|
|
@@ -177,6 +177,10 @@ export declare function showLastKnownCount(): void;
|
|
|
177
177
|
export declare function setWarnings(notes: readonly CartWarning[]): void;
|
|
178
178
|
/** The one queue every cart change runs through; checkout waits for the changes in it. */
|
|
179
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.
|
package/dist/types/src/cart.d.ts
CHANGED
|
@@ -12,9 +12,14 @@ type DiscountCodes = string[] | string | ((current: string[]) => string[]);
|
|
|
12
12
|
* replaced are skipped.
|
|
13
13
|
*/
|
|
14
14
|
declare function changeQuantity(lineId: string, delta: number): Promise<ShopifyCart | null>;
|
|
15
|
+
/**
|
|
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.
|
|
19
|
+
*/
|
|
20
|
+
declare function reload(): Promise<ShopifyCart | null>;
|
|
15
21
|
export declare const Cart: {
|
|
16
|
-
|
|
17
|
-
init: () => Promise<ShopifyCart | null>;
|
|
22
|
+
init: typeof reload;
|
|
18
23
|
/** The saved cart's id. */
|
|
19
24
|
id: typeof savedCartId;
|
|
20
25
|
readonly status: CartStatus;
|
|
@@ -196,7 +196,9 @@ export declare function warn(...args: unknown[]): void;
|
|
|
196
196
|
export declare function reportError(error: unknown, context: string): void;
|
|
197
197
|
/**
|
|
198
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.
|
|
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.
|
|
200
202
|
*/
|
|
201
203
|
export declare function callHook(name: string, hook: () => unknown): void;
|
|
202
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.
|
|
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.
|
|
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":
|
|
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 H,g as X,h as B,i as O,m as k,n as J}from"./chunk-74HC6MR2.js";import{a as x,c as W}from"./chunk-Y5LISDPZ.js";import{f as V,g as G,h}from"./chunk-NXDME6AM.js";import"./chunk-SVJWBCRY.js";import{a as K}from"./chunk-EIPYBAVZ.js";import"./chunk-HRRJ7KUG.js";import"./chunk-IG23NTJK.js";import{D as F,E as j,G as A,I as L,R as M,a as g,g as $,n as c,o as m,q as d,u as w,x as q,z as _}from"./chunk-BRI56DD5.js";import{D as N,F as l,H as D,d as T,g as v,r as U,x as i}from"./chunk-X2HBGPFB.js";var R=null,P=null;function z(){let e=i.account?.server;if(!e)throw new g("Customer accounts need the Worker: set account.server",{code:"NOT_CONFIGURED"});return new URL(e,window.location.href).href.replace(/\/$/,"")}function Q(e){e?V(x(),"1"):G(x())}async function le(e){let r;try{r=await e.json()}catch(t){if(t instanceof SyntaxError)return{};throw t}return T(r)?r:{}}async function me(e,r){try{return await $(i.requestTimeout,async t=>{let n=await fetch(e,{...r,signal:t});return{response:n,data:await le(n)}})}catch(t){throw new g(`Network error: ${D(t)}`,{code:"NETWORK"})}}async function f(e,{method:r="GET",body:t}={}){let n={method:r,credentials:"include"};r==="POST"&&(n.headers={"Content-Type":"application/json","X-Tether-Account":"1"}),t&&(n.body=JSON.stringify(t));let{response:s,data:o}=await me(`${z()}${e}`,n);if(s.status===401)return{kind:"logged-out"};if(!s.ok){let u=v(o.error)??String(s.status),p=B(o.userErrors);throw new g(`Customer accounts: ${u}`,{status:s.status,...p.length>0&&{userErrors:p},...o.code==="INVALID"&&{code:"INVALID"}})}return{kind:"answer",data:o}}async function ge(){let e=await f("/me");return e.kind==="answer"&&e.data.loggedIn===!0?{loggedIn:!0,customer:H(e.data.customer)}:{loggedIn:!1}}async function y(){let e=P??(P=ge()),r;try{r=await e}catch(t){throw P===e&&(P=null),t}return P!==e?y():(R=r,Q(r.loggedIn),r)}var Y=()=>R?.loggedIn===!0;function I(){R=null,P=null}function Z(e){let r=i.account?.navigate;r?r(e):window.location.assign(e)}var fe=e=>e||i.account?.locale||(i.locale||"").split("-")[0]||"";function ee({returnTo:e,locale:r}){let t=new URL(`${z()}/login`);t.searchParams.set("returnTo",e);let n=fe(r);n&&t.searchParams.set("locale",n),i.country&&t.searchParams.set("country",i.country.toUpperCase()),Z(t.toString())}async function re(){let e=h.id();if(!(await y()).loggedIn||!e)return null;let r=await f("/cart",{method:"POST",body:{cartId:e}});return r.kind==="logged-out"?null:v(r.data.checkoutUrl)}async function te(e){let r=await f("/logout",{method:"POST",body:{returnTo:e,cartId:h.id()}});I(),Q(!1),w("account-logout",{});let t=r.kind==="answer"?v(r.data.logoutUrl):null;return t?(Z(t),"redirected"):"stayed"}var C=10,b=50,ne=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=b,pe=e=>M(e,"limit",{min:1,max:b,fallback:C}),we=e=>e.replace(/\?.*$/,"").replace(/^.*\//,"");function he(e){let r=i.account?.orderUrl;if(r)return r.replaceAll("{id}",encodeURIComponent(we(e.id)));let t=e.statusPageUrl;return t!==null&&U(t)?t:null}var Pe=e=>({name:e.name??"",date:j(e.processedAt),total:F(e.totalPrice),status:e.financialStatus?.toLowerCase(),fulfillment:e.fulfillmentStatus?.toLowerCase(),items:e.lineItems.nodes.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", ")});function ye(e,r){let t=r.lineItems.nodes,n=he(r),s=Pe(r);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=t.find(de=>de.image)?.image;S&&q(o,S.url,S.altText||t[0]?.title||"");return}let p=k(s,u);p!==void 0&&A(o,p)}),d(e,c("order-lines")).forEach(o=>{J(o,t,null)}),m(e,"order-bind")==="url"&&n&&e.setAttribute("href",n)}async function oe(e,r){let t=d(e,c("orders")),n=t[0];if(!n)return;O(e,"show",{"orders-loading":!0,"orders-empty":!1});let s=pe(n),o;try{o=await r(s)}catch(u){l(u,"orders"),o=null}O(e,"show",{"orders-loading":!1,"orders-empty":o?.length===0}),t.forEach(u=>{_(u,o??[],ye)})}var ve=["order","addresses","subscriptions","profile-form","address-form"],Ae=Y;function ke({returnTo:e=window.location.href,locale:r}={}){return new Promise(t=>{ee({returnTo:e,locale:r}),t()})}async function ae(){let e=await y();return e.loggedIn?e.customer:null}async function be({first:e=C}={}){if(!ne(e))throw new g(`Customer accounts: orders() takes first from 1 to ${String(b)}`,{code:"INVALID"});let r=await f(`/orders?${new URLSearchParams({first:String(e)}).toString()}`);return r.kind==="logged-out"?[]:X(r.data.orders)}async function Se({returnTo:e=i.account?.logoutUrl||`${window.location.origin}/`}={}){await te(e)==="stayed"&&await E(document)}async function Le(){try{return(await y()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(e){return{kind:"unknown",error:e}}}var se=e=>ve.some(r=>d(e,c(r)).length>0);function xe(e){d(e,c("account-link")).forEach(r=>{r.setAttribute("href",Oe(m(r,"account-link")))})}function Oe(e){let r=i.account,t=`https://${i.domain}/account`;return e==="payment"?r?.paymentUrl||r?.subscriptionsUrl||t:e==="subscriptions"&&r?.subscriptionsUrl||t}async function E(e=document){let r=await Le();r.kind==="unknown"&&l(r.error,"account");let t=r.kind==="logged-in";if(d(e,c("show")).forEach(n=>{let s=m(n,"show");s==="logged-in"&&L(n,t),s==="logged-out"&&L(n,!t)}),xe(e),r.kind==="unknown"&&se(e)){(await a()).showUnavailable(e);return}t&&(await ue(e),await Promise.all([oe(e,n=>be({first:n})),se(e)?a().then(n=>n.renderPages(e)):null]))}async function ue(e){let r=d(e,c("account-bind"));if(!r.length)return;let t;try{t=await ae()}catch(s){l(s,"account");return}if(!t)return;let n={"first-name":t.firstName,"last-name":t.lastName,name:t.displayName,email:t.emailAddress?.emailAddress,address:t.defaultAddress?.formatted.join(", ")};r.forEach(s=>{let o=k(n,m(s,"account-bind")??"");o!=null&&A(s,o)})}var ie=null;function a(){return ie??(ie=K("account-pages").then(e=>(e.setup({serverFetch:f,customer:ae,bindCustomer:ue,reset:I}),e))),ie}var tr=e=>a().then(r=>r.order(e)),nr=e=>a().then(r=>r.updateProfile(e)),or=()=>a().then(e=>e.addresses()),sr=(e,r)=>a().then(t=>t.saveAddress(e,r)),ir=e=>a().then(r=>r.deleteAddress(e)),cr=()=>a().then(e=>e.subscriptions()),ar=(e,r)=>a().then(t=>t.subscriptionAction(e,r)),ur=(e,r)=>a().then(t=>t.requestReturn(e,r));function Re(e){let r=e.target;r instanceof window.Element&&(r.closest(c("account-login"))?(e.preventDefault(),ke().catch(t=>{l(t,"login")})):r.closest(c("account-logout"))&&(e.preventDefault(),Se().catch(t=>{l(t,"logout")})))}function Ie(){let e=new URL(window.location.href),r=e.searchParams.get("account");if(W(r))switch(e.searchParams.delete("account"),window.history.replaceState(window.history.state,"",e),r){case"in":w("account-login",{});break;case"expired":case"error":w("account-error",{error:r});break}}var ce=!1;async function dr(e=document){if(ce){await E(e);return}ce=!0,document.addEventListener("click",Re),Ie(),h.setCheckoutResolver(re),await E(e),N("account",Ae()?"logged in":"logged out")}export{or as addresses,ae as customer,ir as deleteAddress,Ae as isLoggedIn,ke as login,Se as logout,dr as mountAccount,tr as order,be as orders,E as render,ur as requestReturn,sr as saveAddress,ar as subscriptionAction,cr as subscriptions,nr as updateProfile};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={diagnose:()=>import("./diagnose-YNVDJDSH.js"),markets:()=>import("./markets-ui-YAEXVFRK.js"),search:()=>import("./search-NPGWPFMA.js"),lists:()=>import("./lists-6KQIGAO6.js"),extras:()=>import("./extras-BUH3OWBN.js"),account:()=>import("./account-53WAVEJF.js"),"account-pages":()=>import("./account-pages-LKNIXA6Q.js"),analytics:()=>import("./analytics-TEU7HS7C.js")},a=t=>e[t](),o=void 0;export{a,o as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as n}from"./chunk-EIPYBAVZ.js";import{g as r}from"./chunk-47OLTPHV.js";import{n as e}from"./chunk-BRI56DD5.js";import{F as i}from"./chunk-X2HBGPFB.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-BRI56DD5.js";import{d as m,e as s,n as g,x as p}from"./chunk-X2HBGPFB.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
|
-
import{a as Et,d as _,e as xt}from"./chunk-SVJWBCRY.js";import{c as Tt}from"./chunk-HRRJ7KUG.js";import{b as nt,d as R}from"./chunk-IG23NTJK.js";import{A as At,B as K,D as v,E as Pt,F as kt,G as g,H as k,I as O,M as It,T as N,a as y,c as Q,d as V,i as j,l as St,m as A,n as s,o as f,p as wt,q as d,u as C,w as vt,x as P,y as Lt,z as M}from"./chunk-BRI56DD5.js";import{D as bt,F as w,G as D,r as Ct,x as c}from"./chunk-X2HBGPFB.js";var ce={id:"string",quantity:"number",attributes:["object"],cost:{totalAmount:R,subtotalAmount:R,amountPerQuantity:R},merchandise:{id:"string",selectedOptions:["object"],product:"object"}},rt={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,it=!1,ot=!1,B=null,Mt=null,pe=t=>t!==null&&"focus"in t,Ot=t=>d(t,de).filter(e=>e.offsetParent!==null||e===document.activeElement),I=()=>d(document,s("cart-drawer")),G=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=I();return t.length?t.some(G):it}function ge(t){Mt??(Mt=new MutationObserver(()=>{let e=S();if(e===ot)return;let n=I();e?Rt(n.filter(G)):Ut(n,$t(n))})),Mt.observe(t,{attributes:!0,attributeFilter:["class"]})}function X(){d(document,s("cart-open")).forEach(t=>{t.setAttribute("aria-expanded",String(S()))}),I().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=G(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){ot=!0,X();let[e]=t;c.cartFocus&&e&&(B=pe(document.activeElement)?document.activeElement:null,setTimeout(()=>{he(e)},me)),D("onCartOpen",()=>c.onCartOpen?.(t)),C("cart-toggled",{open:!0})}function Ut(t,e){ot=!1,X(),e&&B?.isConnected&&B.focus({preventScroll:!0}),B=null,D("onCartClose",()=>c.onCartClose?.(t)),C("cart-toggled",{open:!1})}function Y(){if(S())return;let t=I(),e=t.filter(n=>!fe(n));t.length&&!e.length||(it=!t.length,e.forEach(n=>{n.classList.add(c.cartDrawerOpenClass)}),Rt(e))}function at(){if(!S())return;it=!1;let t=I(),e=$t(t);t.forEach(n=>{n.classList.remove(c.cartDrawerOpenClass)}),Ut(t,e)}function qt(){S()?at():Y()}function ye(t){if(t.key!=="Tab"||!c.cartFocus||!S())return;let e=I().find(G);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$/,Se=["","true","all","*"],ut=t=>t.tagName==="SELECT",st=(t,e)=>t.$(`select${e}`).filter(ut);function we(t,e){let n=e.images.nodes,r=[...t.children].map(o=>o.tagName==="IMG"?o:o.querySelector("img"));!Lt(t)&&r.length===n.length&&r.every((o,a)=>vt(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=>Pt(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":kt(t,n.descriptionHtml);break;case"featured-image":P(t,n.featuredImage?.url,n.featuredImage?.altText||n.title);break;case"url":case"link":{let i=K(n.handle,n.id);i&&t.setAttribute("href",i),e==="url"&&!t.firstElementChild&&!t.textContent.trim()&&g(t,n.title);break}case"images":we(t,n);break;case"tags":Ae(t,n);break;default:ke(t,e,n)}}function ke(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 Ie(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 Ee(t){let{product:e}=t;st(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)))}),st(t,s("variant-select")).forEach(n=>{n.replaceChildren(...e.variants.nodes.map(r=>new Option(r.title,r.id)))}),st(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=Se.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 rn(t){t.$(s("bind")).forEach(e=>{Pe(e,f(e,"bind")??"",t.product)}),Ie(t),Ee(t),xe(t)}var Qt="Default Title",lt=(t,e)=>e.get(t.id)?.quantity??t.quantity,Nt=t=>t.split("/").pop()??t;function Te(t){let e=t.merchandise,n=K(e.product.handle,e.product.id);if(!n)return null;let r=new URLSearchParams;r.set("variant",Nt(e.id));let i=t.sellingPlanAllocation?.sellingPlan.id;return i&&r.set("selling_plan",Nt(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===Qt?"":t.merchandise.title,options:t=>t.merchandise.selectedOptions.filter(e=>e.value!==Qt).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)=>lt(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(", ")},Wt="attribute:";function Me(t,e,n){if(Object.hasOwn(Ht,e))return Ht[e]?.(t,n);if(!e.startsWith(Wt))return;let r=e.slice(Wt.length);return t.attributes.find(i=>i.key===r)?.value??""}function Oe(t,e,n){let r=xt(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=>{k(u,i?.message??"")});let a=new Map([["subscription",r],["one-time",!r],["on-sale",Et(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&&k(o,u)}),$e(t,e,n),d(t,s("line-plan")).filter(ut).forEach(o=>{Tt(r.product.handle).then(a=>{Oe(o,e,a)}).catch(a=>{w(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 Ft(t){let{cart:e}=t,n=r=>e?v(e.cost[r]):"";X(),d(document,s("cart-count")).forEach(r=>{k(r,e?.totalQuantity??0)}),d(document,s("cart-subtotal")).forEach(r=>{k(r,n("subtotalAmount"))}),d(document,s("cart-total")).forEach(r=>{k(r,n("totalAmount"))}),d(document,s("cart-checkout-charge")).forEach(r=>{k(r,n("checkoutChargeAmount"))}),Ue(e,t),d(document,s("cart-warning")).forEach(r=>{k(r,[...new Set(t.warnings.map(i=>i.message))].join(" "))}),qe(e),d(document,s("cart-lines")).forEach(r=>{At(r,e?.lines.nodes??[],i=>i.id,(i,o)=>{Re(i,o,t)},{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),e&&It("cart")}function Vt(t){d(document,s("cart-count")).forEach(e=>{/^\s*0?\s*$/.test(e.textContent)&&(e.textContent=String(t))})}function ct(t,e="localStorage"){try{return window[e].getItem(t)}catch{return null}}function dt(t,e,n="localStorage"){try{window[n].setItem(t,e)}catch{}}function jt(t,e="localStorage"){try{window[e].removeItem(t)}catch{}}var Kt=/^gid:\/\/shopify\/Cart\/[\w-]+(\?key=[\w-]+)?$/;function Bt(){let t=Promise.resolve(),e=0,n=()=>{e--};return Object.assign(i=>{e++;let o=t.then(i);return t=o.then(n,n),o},{idle:()=>!e})}var h={kind:"unknown"},U=[],$=new Map,z=()=>h;function m(){switch(h.kind){case"ready":case"error":return h.cart;case"unknown":case"empty":return null}}var Gt=()=>U,mt=t=>t?{kind:"ready",cart:t}:{kind:"empty"},Xt=()=>`${c.storageKey}:seen`;function E(){let t=ct(c.storageKey);return t?Kt.test(t)?t:(x(),null):null}function x(){jt(c.storageKey)}function pt(t){h=mt(t),t&&dt(c.storageKey,t.id)}function H(){Ft({cart:m(),warnings:U,pending:$,failed:h.kind==="error"})}function W(t){H(),C("cart-updated",{cart:m(),reason:t})}function b(t,e){return pt(t),dt(Xt(),`${Date.now()}|${t?.totalQuantity??0}`),W(e),t}function F(t){h=t.kind==="loaded"?mt(t.cart):{kind:"error",error:t.error,cart:null},W("load")}function De(){let t=ct(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&&Vt(t)}function zt(t){let e=n=>D("warningText",()=>c.warningText?.(n),()=>null);U=t.filter((n,r)=>t.findIndex(i=>i.message===n.message)===r).map(n=>({...n,message:e(n)||n.message})),U.length&&C("cart-warning",{warnings:U})}var q=Bt();function Jt(t){return q(t).then(e=>(h.kind==="error"&&(h=mt(h.cart),H()),e),e=>{throw h={kind:"error",error:e,cart:m()},H(),C("cart-error",{error:e}),e})}var ft=t=>lt(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 Ne=/does not exist|not found|invalid id/i,_e=t=>V({[t]:Q({cart:Q(rt)})});function J(t){return t instanceof y?t.userErrors?.some(e=>e.field?.[0]==="cartId")?!0:(t.errors??[]).some(e=>Ne.test(e.message)):!1}function ee(t){if(!(t instanceof y))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=_.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new y("add(): variantId is required");let o=parseInt(String(r.quantity??1),10),a={merchandiseId:i,quantity:Math.max(1,o||1)},u=_.sellingPlan(r.sellingPlanId||r.sellingPlan);u&&(a.sellingPlanId=u);let l=N(r.attributes);return l.length&&(a.attributes=l),a}function He(t,e,n){return r=>`mutation Tether_${t}(${e}){${t}(${n}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${nt(r)}`}async function re(t,e,n,r){let i=await j(He(t,e,n),r,_e(t),{operation:"mutation"}),o=St(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=E();if(!o)return i?te(i):null;try{return await re(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`,{...r,cartId:o})}catch(a){if(!J(a)||(x(),!i))throw a;return bt("cart expired, creating a new one"),te(i)}}async function gt(t){return(await j(n=>`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${nt(n)}`,{id:t},V({cart:Q(rt)}))).cart}async function ie(t){return(await j("query TetherCheckout($id:ID!){cart(id:$id){checkoutUrl}}",{id:t},V({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?_.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=N(n.attributes));let i=n.merchandiseId||n.variantId;return i&&(r.merchandiseId=_.variant(i)),r}var ht=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?ht([{id:t,quantity:e}]):Z([t]);var yt=null;function ue(t){yt=t}var We=t=>ie(t).then(e=>({kind:"url",url:e}),e=>({kind:"failed",error:e}));async function Fe(){if(!yt)return null;try{let t=await yt();return t&&`${t}${t.includes("?")?"&":"?"}logged_in=true`}catch(t){return w(t,"account checkout"),null}}async function Ve(t){let e=We(t),n=await Fe();if(n)return n;let r=await e;if(r.kind==="failed")throw r.error;if(!r.url)throw new y("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:E()}async function le(t=c.checkoutTarget){if(q.idle()&&!se())return null;let e=t==="_blank"?window.open("","_blank"):null;e&&je(e);try{await q(()=>Promise.resolve());let n=se(),r=n&&await Ve(n);if(!r)return e?.close(),null;if(!Ct(r))throw new y("The checkout URL is not https: not opened");return C("checkout",{url:r,cart:m()}),e&&!e.closed?e.location.href=r:window.location.href=r,r}catch(n){return e?.close(),w(n,"checkout failed"),null}}var et=()=>m()?.lines.nodes??[];async function Ke(){let t=E();if(t)try{let e=await gt(t);e||x(),b(e,"load")}catch(e){w(e,"cart reload after a failed change")}}function L(t){return Jt(()=>t().catch(async e=>{throw ee(e)&&await Ke(),e}))}function Be(t,e){let n=et().find(u=>u.id===t);if(!n)return Promise.resolve(m());let r=Math.max(0,ft(n)+e),i={quantity:r};$.set(t,i),W("pending");let o=()=>$.get(t)===i;return L(async()=>{if(!o())return m();if(et().find(p=>p.id===t)?.quantity===r)return m();let l=await ae(t,r);return o()?b(l,r>0?"update":"remove"):(pt(l),l)}).finally(()=>{o()&&($.delete(t),W("settled"))})}function Ge(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 Xe(t){let e=new Map((m()?.attributes??[]).map(n=>[n.key,n.value]));return N(t).forEach(n=>e.set(n.key,n.value)),[...e].filter(([,n])=>n!=="").map(([n,r])=>({key:n,value:r}))}async function Ye(){let t=E();if(!t)return F({kind:"loaded",cart:null}),null;Yt();try{let e=await gt(t);e||x(),F({kind:"loaded",cart:e})}catch(e){w(e,"cart load failed"),J(e)&&x(),F({kind:"failed",error:e})}return m()}var tt={init:()=>q(Ye),id:E,get status(){return z()},get state(){return m()},get lines(){return[...et()]},get count(){return m()?.totalQuantity??0},get loaded(){return z().kind!=="unknown"},get lastError(){let t=z();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(),F({kind:"loaded",cart:null})},render:H,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 y("Shopify answered the add without a cart");return b(i,"add"),C("added",{cart:i,lines:r}),c.openCartOnAdd&&Y(),i})},updateLine(t,e){let n=typeof e=="number"?e:e.quantity;if(n!==void 0&&n<=0)return tt.removeLine(t);let r=oe(t,e);return L(async()=>b(await ht([r]),"update"))},changeQuantity:Be,quantityOf:ft,removeLine(t){let e=Array.isArray(t)?t:[t];return L(async()=>b(await Z(e),"remove"))},clear(){return L(async()=>{let t=et().map(e=>e.id);return t.length?b(await Z(t),"remove"):m()})},setNote(t){let e={note:t??""};return L(async()=>b(await T({name:"cartNoteUpdate",args:"$note: String!",inner:"note: $note",variables:e,createInput:e}),"note"))},setAttributes(t){return L(async()=>{let e={attributes:Xe(t)},n=await T({name:"cartAttributesUpdate",args:"$attributes: [AttributeInput!]!",inner:"attributes: $attributes",variables:e,createInput:e});return b(n,"attributes")})},setDiscountCodes(t){return L(async()=>{let e={discountCodes:Ge(t)},n=await T({name:"cartDiscountCodesUpdate",args:"$discountCodes: [String!]!",inner:"discountCodes: $discountCodes",variables:e,createInput:e});return b(n,"discount")})},async applyDiscount(t){let e=t.trim();if(!e)throw new y("No discount code",{code:"INVALID_DISCOUNT"});let n=await tt.setDiscountCodes(o=>[...new Set([...o,e])]),r=e.toLowerCase();if((n?.discountCodes??[]).find(o=>o.code.toLowerCase()===r)?.applicable)return n;try{await tt.removeDiscount(e)}catch(o){w(o,"removing a discount code Shopify refused")}throw new y(`Discount code not valid: ${e}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let e=t.trim().toLowerCase();return tt.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||!J(r))throw r;return null});return b(n,"buyer-identity")})},checkout:le,drawers:I,isOpen:S,open:Y,close:at,toggle:qt};export{ye as a,ut as b,st as c,rn as d,ct as e,dt as f,jt as g,tt as h};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var A=Object.defineProperty;var B=(n,e,t)=>e in n?A(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Qn=(n,e)=>{for(var t in e)A(n,t,{get:e[t],enumerable:!0})};var vn=(n,e,t)=>B(n,typeof e!="symbol"?e+"":e,t);var W=/^(\d{4})-(01|04|07|10)$/;function T(n){let e=W.exec(typeof n=="string"?n:"");return e?{year:Number(e[1]),month:Number(e[2])}:null}var R=n=>T(n)!==null,q=(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 q(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,Xn=n=>en(n)??0,_=(n,e)=>J(n).map(t=>e(t)),Jn=(n,e)=>({nodes:_(X(n,"nodes"),e)}),ne=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 ie={domain:["PUBLIC_SHOPIFY_DOMAIN","PUBLIC_SHOPIFY_STORE_DOMAIN","SHOPIFY_DOMAIN"],token:["PUBLIC_SHOPIFY_STOREFRONT_TOKEN","PUBLIC_SHOPIFY_STOREFRONT_ACCESS_TOKEN","SHOPIFY_STOREFRONT_TOKEN"]};function se(n){if(typeof n!="string")return!1;try{return new URL(n).protocol==="https:"}catch{return!1}}function ae(n){return/^shp[a-z]{2}_/.test(n.trim())}function ue(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 ce(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 le(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_.-]+)$/,x=(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 x(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:x(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",xn={country:k,language:k,locale:k},bn={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,xn,()=>{});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 b=(n,e)=>m("markets",n,bn,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,v={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,v),G.set(n,e)),e}var we=new Proxy(a,v),_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:b(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 xe=n=>b(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 Se=()=>!!(a.domain&&a.token);function Ae(...n){a.debug&&console.log(`[${a.prefix}]`,...n)}function c(...n){console.warn(`[${a.prefix}]`,...n)}function Zn(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 Ee(n,e,t){try{return e()}catch(o){return Zn(o,n),t?.()}}function Ne(n){return n instanceof Error?n.message:String(n)}export{Qn as a,vn as b,Wn as c,C as d,X as e,J as f,nn as g,en as h,Xn as i,_ as j,Jn as k,ne as l,L as m,On as n,h as o,w as p,ie as q,se as r,ae as s,ue as t,ce as u,le as v,u as w,a as x,we as y,zn as z,xe as A,be as B,Se as C,Ae as D,c as E,Zn as F,Ee as G,Ne as H};
|
|
@@ -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-KJLA4CVH.js";import{a as I}from"./chunk-FYGRVUVB.js";import{d as F,e as x}from"./chunk-O6Z6O5NW.js";import"./chunk-JJRRVUDP.js";import{h as u}from"./chunk-NXDME6AM.js";import"./chunk-YZC4KFT3.js";import"./chunk-SVJWBCRY.js";import"./chunk-EIPYBAVZ.js";import"./chunk-47OLTPHV.js";import{e as w}from"./chunk-HRRJ7KUG.js";import"./chunk-IG23NTJK.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-BRI56DD5.js";import{F as y,o as f,p as g,x as a}from"./chunk-X2HBGPFB.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};
|