@occluze/tether 0.7.0 → 0.7.1

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 (132) hide show
  1. package/README.md +21 -21
  2. package/dist/esm/chunks/{account-UIPWJQ3Y.js → account-CXMA5RPZ.js} +1 -1
  3. package/dist/esm/chunks/{account-pages-6ROA6Y4V.js → account-pages-IZO7FEOZ.js} +1 -1
  4. package/dist/esm/chunks/{analytics-2V632IRV.js → analytics-PG5FPRDN.js} +1 -1
  5. package/dist/esm/chunks/{chunk-4GCXM764.js → chunk-4HD4J5JC.js} +1 -1
  6. package/dist/esm/chunks/{chunk-BFTZR4OB.js → chunk-6TFMLT4A.js} +2 -2
  7. package/dist/esm/chunks/{chunk-T44MUL4Y.js → chunk-BBVUVPMO.js} +1 -1
  8. package/dist/esm/chunks/chunk-EW5SYO6L.js +1 -0
  9. package/dist/esm/chunks/chunk-HJY2JSNB.js +1 -0
  10. package/dist/esm/chunks/chunk-MQYB6BH4.js +1 -0
  11. package/dist/esm/chunks/{chunk-5Z5O3767.js → chunk-N3V45JPS.js} +1 -1
  12. package/dist/esm/chunks/{chunk-YLUULATY.js → chunk-RPMBCAGS.js} +1 -1
  13. package/dist/esm/chunks/{chunk-MPDWM2NN.js → chunk-VFNHIGCS.js} +1 -1
  14. package/dist/esm/chunks/{chunk-6OZJCAGZ.js → chunk-WT7RGGJU.js} +1 -1
  15. package/dist/esm/chunks/chunk-YN6LEBEN.js +1 -0
  16. package/dist/esm/chunks/chunk-Z6HS3H7K.js +1 -0
  17. package/dist/esm/chunks/{diagnose-3FEKRIEK.js → diagnose-XCEBQKBO.js} +1 -1
  18. package/dist/esm/chunks/extras-4HU3VSBQ.js +1 -0
  19. package/dist/esm/chunks/{markets-ui-FD6NI2OG.js → markets-ui-M4IQ62CT.js} +1 -1
  20. package/dist/esm/chunks/search-A5DS2IOS.js +1 -0
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/server.js +2 -2
  23. package/dist/tether.account-pages.js +13 -3
  24. package/dist/tether.account-pages.min.js +1 -1
  25. package/dist/tether.account.js +13 -3
  26. package/dist/tether.account.min.js +1 -1
  27. package/dist/tether.analytics.js +18 -3
  28. package/dist/tether.analytics.min.js +1 -1
  29. package/dist/tether.diagnose.js +18 -3
  30. package/dist/tether.diagnose.min.js +2 -2
  31. package/dist/tether.extras.js +19 -6
  32. package/dist/tether.extras.min.js +1 -1
  33. package/dist/tether.js +162 -112
  34. package/dist/tether.markets.js +18 -3
  35. package/dist/tether.markets.min.js +1 -1
  36. package/dist/tether.min.js +3 -3
  37. package/dist/tether.min.js.map +4 -4
  38. package/dist/tether.search.js +18 -3
  39. package/dist/tether.search.min.js +1 -1
  40. package/dist/types/server/src/shared/cart-id.d.ts +2 -0
  41. package/dist/types/src/cart/mutations.d.ts +6 -0
  42. package/dist/types/src/cart/store.d.ts +5 -2
  43. package/dist/types/src/cart.d.ts +2 -2
  44. package/dist/types/src/client.d.ts +53 -19
  45. package/dist/types/src/config.d.ts +6 -1
  46. package/dist/types/src/index.d.ts +2 -2
  47. package/dist/types/src/product-shape.d.ts +3 -1
  48. package/package.json +1 -2
  49. package/dist/esm/chunks/chunk-56FCLJJD.js +0 -1
  50. package/dist/esm/chunks/chunk-A5SYCVQM.js +0 -1
  51. package/dist/esm/chunks/chunk-BA4LQJJQ.js +0 -1
  52. package/dist/esm/chunks/chunk-C5JYQCWH.js +0 -1
  53. package/dist/esm/chunks/extras-6POFBNOP.js +0 -1
  54. package/dist/esm/chunks/search-UJ73YBQ5.js +0 -1
  55. package/src/account/addresses-view.ts +0 -58
  56. package/src/account/answers.ts +0 -79
  57. package/src/account/markup.ts +0 -36
  58. package/src/account/operations.ts +0 -145
  59. package/src/account/order-lines.ts +0 -75
  60. package/src/account/order-list.ts +0 -107
  61. package/src/account/order-page.ts +0 -137
  62. package/src/account/page-answers.ts +0 -317
  63. package/src/account/page-events.ts +0 -253
  64. package/src/account/server-client.ts +0 -183
  65. package/src/account/subscriptions-view.ts +0 -115
  66. package/src/account-api.ts +0 -98
  67. package/src/account-marks.ts +0 -35
  68. package/src/account-pages.ts +0 -81
  69. package/src/account.ts +0 -284
  70. package/src/amounts.ts +0 -64
  71. package/src/analytics-shopify.ts +0 -246
  72. package/src/analytics.ts +0 -315
  73. package/src/api-version.ts +0 -79
  74. package/src/astro.ts +0 -272
  75. package/src/cart/cart-shape.ts +0 -25
  76. package/src/cart/checkout.ts +0 -101
  77. package/src/cart/drawer.ts +0 -125
  78. package/src/cart/mutations.ts +0 -237
  79. package/src/cart/render.ts +0 -266
  80. package/src/cart/store.ts +0 -279
  81. package/src/cart.ts +0 -345
  82. package/src/client.ts +0 -391
  83. package/src/collection.ts +0 -175
  84. package/src/config-sections.ts +0 -284
  85. package/src/config.ts +0 -480
  86. package/src/controls/cart-controls.ts +0 -123
  87. package/src/controls/discount.ts +0 -75
  88. package/src/controls/extras.ts +0 -54
  89. package/src/controls/navigation.ts +0 -77
  90. package/src/diagnose-markup.ts +0 -298
  91. package/src/diagnose.ts +0 -294
  92. package/src/dom.ts +0 -268
  93. package/src/extras.ts +0 -136
  94. package/src/fragments.ts +0 -261
  95. package/src/globals.d.ts +0 -15
  96. package/src/images.ts +0 -91
  97. package/src/index.ts +0 -415
  98. package/src/initial.ts +0 -101
  99. package/src/lazy-iife.ts +0 -197
  100. package/src/lazy.ts +0 -42
  101. package/src/loader.ts +0 -363
  102. package/src/market-codes.ts +0 -6
  103. package/src/markets-ui.ts +0 -227
  104. package/src/markets.ts +0 -246
  105. package/src/markup.ts +0 -127
  106. package/src/mounting.ts +0 -264
  107. package/src/page-market.ts +0 -110
  108. package/src/part-integrity.ts +0 -7
  109. package/src/parts/account-pages.ts +0 -7
  110. package/src/parts/account.ts +0 -7
  111. package/src/parts/analytics.ts +0 -7
  112. package/src/parts/diagnose.ts +0 -7
  113. package/src/parts/extras.ts +0 -7
  114. package/src/parts/markets.ts +0 -7
  115. package/src/parts/search.ts +0 -7
  116. package/src/presets/barba.ts +0 -194
  117. package/src/product-events.ts +0 -115
  118. package/src/product-render.ts +0 -218
  119. package/src/product-shape.ts +0 -49
  120. package/src/product-state.ts +0 -318
  121. package/src/product.ts +0 -308
  122. package/src/repeaters.ts +0 -161
  123. package/src/search.ts +0 -305
  124. package/src/selling-plans.ts +0 -145
  125. package/src/server.ts +0 -211
  126. package/src/shopify-values.ts +0 -91
  127. package/src/status.ts +0 -106
  128. package/src/storage.ts +0 -34
  129. package/src/store-html.ts +0 -359
  130. package/src/storefront/catalog.ts +0 -196
  131. package/src/storefront/json-ld.ts +0 -144
  132. package/src/variant-render.ts +0 -139
package/README.md CHANGED
@@ -27,13 +27,13 @@ MIT licensed · 29 KB gzipped · no dependencies · TypeScript types · [full re
27
27
 
28
28
  ## Three ways to install
29
29
 
30
- | | Pick it when | How |
31
- |---|---|---|
32
- | **Script tag** (jsDelivr) | a static site or Webflow, no build step, no login needed | `<script src="https://cdn.jsdelivr.net/gh/ravi-klaassens/tether@0.7/dist/tether.min.js" defer></script>` ([steps below](#2-add-the-script-to-webflow)) |
33
- | **npm** | Astro, Vite or another bundler or framework | `npm install @occluze/tether` ([Astro guide](docs/astro.md), [other frameworks](docs/frameworks.md)) |
34
- | **With the Worker** | you also want the CMS sync, rebuilds when products change, or customer accounts | either of the above, plus your own free Cloudflare Worker ([Worker](server/README.md), [accounts](docs/accounts.md)) |
30
+ | | Pick it when | How |
31
+ | ------------------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
32
+ | **Script tag** (jsDelivr) | a static site or Webflow, no build step, no login needed | `<script src="https://cdn.jsdelivr.net/gh/ravi-klaassens/tether@0.7/dist/tether.min.js" defer></script>` ([steps below](#2-add-the-script-to-webflow)) |
33
+ | **npm** | Astro, Vite or another bundler or framework | `npm install @occluze/tether` ([Astro guide](docs/astro.md), [other frameworks](docs/frameworks.md)) |
34
+ | **With the Worker** | you also want the CMS sync, rebuilds when products change, or customer accounts | either of the above, plus your own free Cloudflare Worker ([Worker](server/README.md), [accounts](docs/accounts.md)) |
35
35
 
36
- The script tag pinned to one release: `…/tether@v0.7.0/dist/tether.min.js`. Its optional parts
36
+ The script tag pinned to one release: `…/tether@v0.7.1/dist/tether.min.js`. Its optional parts
37
37
  (search, accounts, markets, analytics) load from the same folder when a page uses them, each checked
38
38
  against a hash built into the core. To host them yourself, put the same release's files in one folder
39
39
  and set `partsUrl`. Customer accounts need the Worker
@@ -64,7 +64,7 @@ Site settings → Custom code → **Head**:
64
64
  <script src="https://cdn.jsdelivr.net/gh/ravi-klaassens/tether@0.7/dist/tether.min.js" defer></script>
65
65
  ```
66
66
 
67
- **Versions:** `@0.7` gets every 0.7.x fix automatically (recommended), `@v0.7.0` pins one release
67
+ **Versions:** `@0.7` gets every 0.7.x fix automatically (recommended), `@v0.7.1` pins one release
68
68
  (add its [`integrity`](docs/reference.md#config) hash to pin exactly what runs), `@latest` always takes the newest. Hosting the file yourself? Put the optional parts next to it (`tether.markets.min.js`,
69
69
  `tether.search.min.js`, `tether.account.min.js`, `tether.account-pages.min.js`, `tether.analytics.min.js`, `tether.extras.min.js`,
70
70
  `tether.diagnose.min.js`): each loads only when a page uses it.
@@ -73,20 +73,20 @@ Site settings → Custom code → **Head**:
73
73
 
74
74
  Element → Settings → Custom attributes. The ones you'll use most:
75
75
 
76
- | Attribute | Value | Does |
77
- |---|---|---|
78
- | `tether-product` | the Shopify handle (bind it to a CMS field) | Wraps everything for one product |
79
- | `tether-bind` | `title`, `price`, `compare-at-price`, `description`, `featured-image`, `images`, `link` | Fills text, images and links |
80
- | `tether-option-list` | an option name, e.g. `Size` | Size/colour buttons (first child is the template) |
81
- | `tether-add-to-cart` | | Add-to-cart button |
82
- | `tether-purchase` | `one-time` / `subscription` | Subscribe-or-buy-once toggle |
83
- | `tether-plan-list` | `all` | The delivery frequencies (first child is the template) |
84
- | `tether-show` | `in-stock`, `out-of-stock`, `on-sale`, `subscription-selected`, `error`, `not-found` | Shows an element only then |
85
- | `tether-cart-drawer` | | The cart panel (gets the class `is-open`) |
86
- | `tether-cart-open` / `tether-cart-close` | | Buttons that open/close it |
87
- | `tether-cart-count`, `tether-cart-subtotal` | | Cart numbers |
88
- | `tether-cart-lines` | | The cart lines (first child is the template, with `tether-line="title"` etc.) |
89
- | `tether-checkout` | | Goes to Shopify checkout |
76
+ | Attribute | Value | Does |
77
+ | ------------------------------------------- | --------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
78
+ | `tether-product` | the Shopify handle (bind it to a CMS field) | Wraps everything for one product |
79
+ | `tether-bind` | `title`, `price`, `compare-at-price`, `description`, `featured-image`, `images`, `link` | Fills text, images and links |
80
+ | `tether-option-list` | an option name, e.g. `Size` | Size/colour buttons (first child is the template) |
81
+ | `tether-add-to-cart` | | Add-to-cart button |
82
+ | `tether-purchase` | `one-time` / `subscription` | Subscribe-or-buy-once toggle |
83
+ | `tether-plan-list` | `all` | The delivery frequencies (first child is the template) |
84
+ | `tether-show` | `in-stock`, `out-of-stock`, `on-sale`, `subscription-selected`, `error`, `not-found` | Shows an element only then |
85
+ | `tether-cart-drawer` | | The cart panel (gets the class `is-open`) |
86
+ | `tether-cart-open` / `tether-cart-close` | | Buttons that open/close it |
87
+ | `tether-cart-count`, `tether-cart-subtotal` | | Cart numbers |
88
+ | `tether-cart-lines` | | The cart lines (first child is the template, with `tether-line="title"` etc.) |
89
+ | `tether-checkout` | | Goes to Shopify checkout |
90
90
 
91
91
  Everything else (bundles, collections, discount codes, metafields, swatches, recommendations…)
92
92
  is in the [attribute reference](docs/reference.md#attribute-reference).
@@ -1 +1 @@
1
- import{f as j,g as V,h as G,i as R,m as v,n as H}from"./chunk-5Z5O3767.js";import{a as O,c as M}from"./chunk-6OZJCAGZ.js";import{a as W}from"./chunk-C5JYQCWH.js";import{c as q,d as F,e as P}from"./chunk-A5SYCVQM.js";import"./chunk-BFTZR4OB.js";import{C as $,D as _,F as A,H as L,a as f,m as c,n as l,p as d,t as h,w as N,y as D}from"./chunk-BA4LQJJQ.js";import{A as T,C as U,d as I,g as y,r as i,x as E,z as m}from"./chunk-E5YO6274.js";var g=null;function X(){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 B(e){e?q(O(),"1"):F(O())}async function ae(e,t){try{return await fetch(e,t)}catch(r){throw new f(`Network error: ${T(r)}`,{code:"NETWORK"})}}async function ue(e){let t;try{t=await e.json()}catch{return{}}return I(t)?t:{}}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 s=await ae(`${X()}${e}`,n);if(s.status===401)return{kind:"logged-out"};let o=await ue(s);if(!s.ok){let u=y(o.error)??String(s.status),w=G(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:j(e.data.customer)}:{loggedIn:!1}}return B(g.loggedIn),g}var J=()=>g?.loggedIn===!0;function K(){g=null}function z(e){let t=i.account?.navigate;t?t(e):window.location.assign(e)}var de=e=>e||i.account?.locale||(i.locale||"").split("-")[0]||"";function Q({returnTo:e,locale:t}){let r=new URL(`${X()}/login`);r.searchParams.set("returnTo",e);let n=de(t);n&&r.searchParams.set("locale",n),i.country&&r.searchParams.set("country",i.country.toUpperCase()),z(r.toString())}async function Y(){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 Z(e){let t=await p("/logout",{method:"POST",body:{returnTo:e,cartId:P.id()}});g=null,B(!1),h("account-logout",{});let r=t.kind==="answer"?y(t.data.logoutUrl):null;return r?(z(r),"redirected"):"stayed"}var b=10,S=50,ee=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=S;function le(e){let t=Number.parseInt(e||String(b),10)||b;return Math.min(Math.max(t,1),S)}var me=e=>e.replace(/\?.*$/,"").replace(/^.*\//,"");function ge(e){let t=i.account?.orderUrl;if(t)return t.replaceAll("{id}",encodeURIComponent(me(e.id)));let r=e.statusPageUrl;return r!==null&&U(r)?r:null}var fe=e=>({name:e.name??"",date:_(e.processedAt),total:$(e.totalPrice),status:e.financialStatus?.toLowerCase(),fulfillment:e.fulfillmentStatus?.toLowerCase(),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title??""}`).join(", ")});function pe(e,t){let r=t.lineItems.nodes,n=ge(t),s=fe(t);d(e,c("order-bind")).forEach(o=>{let u=l(o,"order-bind")??"";if(u==="url"){n&&o.setAttribute("href",n);return}if(u==="image"){let x=r.find(ce=>ce.image)?.image;x&&N(o,x.url,x.altText||r[0]?.title||"");return}let w=v(s,u);w!==void 0&&A(o,w)}),d(e,c("order-lines")).forEach(o=>{H(o,r,null)}),l(e,"order-bind")==="url"&&n&&e.setAttribute("href",n)}async function te(e,t){let r=d(e,c("orders")),n=r[0];if(!n)return;R(e,"show",{"orders-loading":!0,"orders-empty":!1});let s=le(l(n,"limit")),o;try{o=await t(s)}catch(u){m(u,"orders"),o=null}R(e,"show",{"orders-loading":!1,"orders-empty":o?.length===0}),r.forEach(u=>{D(u,o??[],pe)})}var we=["order","addresses","subscriptions","profile-form","address-form"],he=J;function Pe({returnTo:e=window.location.href,locale:t}={}){return new Promise(r=>{Q({returnTo:e,locale:t}),r()})}async function se(){let e=await k();return e.loggedIn?e.customer:null}async function ye({first:e=b}={}){if(!ee(e))throw new f(`Customer accounts: orders() takes first from 1 to ${String(S)}`,{code:"INVALID"});let t=await p(`/orders?${new URLSearchParams({first:String(e)}).toString()}`);return t.kind==="logged-out"?[]:V(t.data.orders)}async function Ae({returnTo:e=i.account?.logoutUrl||`${window.location.origin}/`}={}){await Z(e)==="stayed"&&await C(document)}async function ve(){try{return(await k()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(e){return{kind:"unknown",error:e}}}var re=e=>we.some(t=>d(e,c(t)).length>0);function ke(e){d(e,c("account-link")).forEach(t=>{t.setAttribute("href",be(l(t,"account-link")))})}function be(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 ve();t.kind==="unknown"&&m(t.error,"account");let r=t.kind==="logged-in";if(d(e,c("show")).forEach(n=>{let s=l(n,"show");s==="logged-in"&&L(n,r),s==="logged-out"&&L(n,!r)}),ke(e),t.kind==="unknown"&&re(e)){(await a()).showUnavailable(e);return}r&&(await ie(e),await Promise.all([te(e,n=>ye({first:n})),re(e)?a().then(n=>n.renderPages(e)):null]))}async function ie(e){let t=d(e,c("account-bind"));if(!t.length)return;let r;try{r=await se()}catch(s){m(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,l(s,"account-bind")??"");o!=null&&A(s,o)})}var ne=null;function a(){return ne??(ne=W("account-pages").then(e=>(e.setup({serverFetch:p,customer:se,bindCustomer:ie,reset:K}),e))),ne}var Ye=e=>a().then(t=>t.order(e)),Ze=e=>a().then(t=>t.updateProfile(e)),et=()=>a().then(e=>e.addresses()),tt=(e,t)=>a().then(r=>r.saveAddress(e,t)),rt=e=>a().then(t=>t.deleteAddress(e)),nt=()=>a().then(e=>e.subscriptions()),ot=(e,t)=>a().then(r=>r.subscriptionAction(e,t)),st=(e,t)=>a().then(r=>r.requestReturn(e,t));function Se(e){let t=e.target;t instanceof window.Element&&(t.closest(c("account-login"))?(e.preventDefault(),Pe().catch(r=>{m(r,"login")})):t.closest(c("account-logout"))&&(e.preventDefault(),Ae().catch(r=>{m(r,"logout")})))}function xe(){let e=new URL(window.location.href),t=e.searchParams.get("account");if(M(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 oe=!1;async function it(e=document){if(oe){await C(e);return}oe=!0,document.addEventListener("click",Se),xe(),P.setCheckoutResolver(Y),await C(e),E("account",he()?"logged in":"logged out")}export{et as addresses,se as customer,rt as deleteAddress,he as isLoggedIn,Pe as login,Ae as logout,it as mountAccount,Ye as order,ye as orders,C as render,st as requestReturn,tt as saveAddress,ot as subscriptionAction,nt as subscriptions,Ze as updateProfile};
1
+ import{f as j,g as V,h as G,i as R,m as v,n as H}from"./chunk-N3V45JPS.js";import{a as O,c as M}from"./chunk-WT7RGGJU.js";import{a as W}from"./chunk-Z6HS3H7K.js";import{c as q,d as F,e as P}from"./chunk-HJY2JSNB.js";import"./chunk-6TFMLT4A.js";import{D as $,E as _,G as A,I as L,a as f,n as c,o as l,q as d,u as h,x as N,z as D}from"./chunk-MQYB6BH4.js";import{A as T,C as U,d as I,g as y,r as i,x as E,z as m}from"./chunk-E5YO6274.js";var g=null;function X(){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 B(e){e?q(O(),"1"):F(O())}async function ae(e,t){try{return await fetch(e,t)}catch(r){throw new f(`Network error: ${T(r)}`,{code:"NETWORK"})}}async function ue(e){let t;try{t=await e.json()}catch{return{}}return I(t)?t:{}}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 s=await ae(`${X()}${e}`,n);if(s.status===401)return{kind:"logged-out"};let o=await ue(s);if(!s.ok){let u=y(o.error)??String(s.status),w=G(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:j(e.data.customer)}:{loggedIn:!1}}return B(g.loggedIn),g}var J=()=>g?.loggedIn===!0;function K(){g=null}function z(e){let t=i.account?.navigate;t?t(e):window.location.assign(e)}var de=e=>e||i.account?.locale||(i.locale||"").split("-")[0]||"";function Q({returnTo:e,locale:t}){let r=new URL(`${X()}/login`);r.searchParams.set("returnTo",e);let n=de(t);n&&r.searchParams.set("locale",n),i.country&&r.searchParams.set("country",i.country.toUpperCase()),z(r.toString())}async function Y(){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 Z(e){let t=await p("/logout",{method:"POST",body:{returnTo:e,cartId:P.id()}});g=null,B(!1),h("account-logout",{});let r=t.kind==="answer"?y(t.data.logoutUrl):null;return r?(z(r),"redirected"):"stayed"}var b=10,S=50,ee=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=S;function le(e){let t=Number.parseInt(e||String(b),10)||b;return Math.min(Math.max(t,1),S)}var me=e=>e.replace(/\?.*$/,"").replace(/^.*\//,"");function ge(e){let t=i.account?.orderUrl;if(t)return t.replaceAll("{id}",encodeURIComponent(me(e.id)));let r=e.statusPageUrl;return r!==null&&U(r)?r:null}var fe=e=>({name:e.name??"",date:_(e.processedAt),total:$(e.totalPrice),status:e.financialStatus?.toLowerCase(),fulfillment:e.fulfillmentStatus?.toLowerCase(),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title??""}`).join(", ")});function pe(e,t){let r=t.lineItems.nodes,n=ge(t),s=fe(t);d(e,c("order-bind")).forEach(o=>{let u=l(o,"order-bind")??"";if(u==="url"){n&&o.setAttribute("href",n);return}if(u==="image"){let x=r.find(ce=>ce.image)?.image;x&&N(o,x.url,x.altText||r[0]?.title||"");return}let w=v(s,u);w!==void 0&&A(o,w)}),d(e,c("order-lines")).forEach(o=>{H(o,r,null)}),l(e,"order-bind")==="url"&&n&&e.setAttribute("href",n)}async function te(e,t){let r=d(e,c("orders")),n=r[0];if(!n)return;R(e,"show",{"orders-loading":!0,"orders-empty":!1});let s=le(l(n,"limit")),o;try{o=await t(s)}catch(u){m(u,"orders"),o=null}R(e,"show",{"orders-loading":!1,"orders-empty":o?.length===0}),r.forEach(u=>{D(u,o??[],pe)})}var we=["order","addresses","subscriptions","profile-form","address-form"],he=J;function Pe({returnTo:e=window.location.href,locale:t}={}){return new Promise(r=>{Q({returnTo:e,locale:t}),r()})}async function se(){let e=await k();return e.loggedIn?e.customer:null}async function ye({first:e=b}={}){if(!ee(e))throw new f(`Customer accounts: orders() takes first from 1 to ${String(S)}`,{code:"INVALID"});let t=await p(`/orders?${new URLSearchParams({first:String(e)}).toString()}`);return t.kind==="logged-out"?[]:V(t.data.orders)}async function Ae({returnTo:e=i.account?.logoutUrl||`${window.location.origin}/`}={}){await Z(e)==="stayed"&&await C(document)}async function ve(){try{return(await k()).loggedIn?{kind:"logged-in"}:{kind:"logged-out"}}catch(e){return{kind:"unknown",error:e}}}var re=e=>we.some(t=>d(e,c(t)).length>0);function ke(e){d(e,c("account-link")).forEach(t=>{t.setAttribute("href",be(l(t,"account-link")))})}function be(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 ve();t.kind==="unknown"&&m(t.error,"account");let r=t.kind==="logged-in";if(d(e,c("show")).forEach(n=>{let s=l(n,"show");s==="logged-in"&&L(n,r),s==="logged-out"&&L(n,!r)}),ke(e),t.kind==="unknown"&&re(e)){(await a()).showUnavailable(e);return}r&&(await ie(e),await Promise.all([te(e,n=>ye({first:n})),re(e)?a().then(n=>n.renderPages(e)):null]))}async function ie(e){let t=d(e,c("account-bind"));if(!t.length)return;let r;try{r=await se()}catch(s){m(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,l(s,"account-bind")??"");o!=null&&A(s,o)})}var ne=null;function a(){return ne??(ne=W("account-pages").then(e=>(e.setup({serverFetch:p,customer:se,bindCustomer:ie,reset:K}),e))),ne}var Ye=e=>a().then(t=>t.order(e)),Ze=e=>a().then(t=>t.updateProfile(e)),et=()=>a().then(e=>e.addresses()),tt=(e,t)=>a().then(r=>r.saveAddress(e,t)),rt=e=>a().then(t=>t.deleteAddress(e)),nt=()=>a().then(e=>e.subscriptions()),ot=(e,t)=>a().then(r=>r.subscriptionAction(e,t)),st=(e,t)=>a().then(r=>r.requestReturn(e,t));function Se(e){let t=e.target;t instanceof window.Element&&(t.closest(c("account-login"))?(e.preventDefault(),Pe().catch(r=>{m(r,"login")})):t.closest(c("account-logout"))&&(e.preventDefault(),Ae().catch(r=>{m(r,"logout")})))}function xe(){let e=new URL(window.location.href),t=e.searchParams.get("account");if(M(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 oe=!1;async function it(e=document){if(oe){await C(e);return}oe=!0,document.addEventListener("click",Se),xe(),P.setCheckoutResolver(Y),await C(e),E("account",he()?"logged in":"logged out")}export{et as addresses,se as customer,rt as deleteAddress,he as isLoggedIn,Pe as login,Ae as logout,it as mountAccount,Ye as order,ye as orders,C as render,st as requestReturn,tt as saveAddress,ot as subscriptionAction,nt as subscriptions,Ze as updateProfile};
@@ -1 +1 @@
1
- import{a as O,b as ie,c as oe,d as ae,e as S,i as m,j as L,k as E,l as k,m as h,n as de}from"./chunk-5Z5O3767.js";import{C as y,D as C,F as g,H as se,a as H,l as f,m as a,n as p,p as l,t as ne,w as re,y as P}from"./chunk-BA4LQJJQ.js";import{C as G,d as A,e as i,g as d,h as z,i as M,j as q,k as w,l as te,z as x}from"./chunk-E5YO6274.js";var ue={order:{name:"order",method:"GET",path:"/order",fields:{id:!0}},addresses:{name:"addresses",method:"GET",path:"/addresses",fields:{}},subscriptions:{name:"subscriptions",method:"GET",path:"/subscriptions",fields:{}},profile:{name:"profile",method:"POST",path:"/profile",fields:{firstName:!0,lastName:!0}},saveAddress:{name:"saveAddress",method:"POST",path:"/address",fields:{id:!0,address:!0,isDefault:!0}},deleteAddress:{name:"deleteAddress",method:"POST",path:"/address/delete",fields:{id:!0}},subscription:{name:"subscription",method:"POST",path:"/subscription",fields:{id:!0,action:!0}},requestReturn:{name:"requestReturn",method:"POST",path:"/return",fields:{orderId:!0,lines:!0}}},it=new Map(Object.values(ue).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=ue[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let u of Object.keys(n.fields)){let c=r[u];(typeof c=="string"||typeof c=="number")&&s.set(u,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function me(e){let t=n=>d(i(e,n));return{id:t("id"),firstName:t("firstName"),lastName:t("lastName"),company:t("company"),address1:t("address1"),address2:t("address2"),city:t("city"),province:t("province"),zoneCode:t("zoneCode"),zip:t("zip"),country:t("country"),countryCode:t("countryCode"),phoneNumber:t("phoneNumber"),formatted:te(i(e,"formatted"))}}var ce=e=>A(e)?me(e):null,j=e=>({...me(e),id:S(i(e,"id"),"address id")}),pe=e=>q(e,t=>({...j(t),isDefault:i(t,"isDefault")===!0})),Le=e=>({...oe(e),id:S(i(e,"id"),"line item id"),name:d(i(e,"name")),sku:d(i(e,"sku")),price:O(i(e,"price")),totalPrice:O(i(e,"totalPrice")),suggestedReturnReasonDefinitions:w(i(e,"suggestedReturnReasonDefinitions"),t=>({id:S(i(t,"id"),"return reason id"),name:d(i(t,"name")),handle:d(i(t,"handle"))}))}),Ie=e=>({id:d(i(e,"id")),status:d(i(e,"status")),createdAt:d(i(e,"createdAt")),estimatedDeliveryAt:d(i(e,"estimatedDeliveryAt")),latestShipmentStatus:d(i(e,"latestShipmentStatus")),trackingInformation:q(i(e,"trackingInformation"),t=>({company:d(i(t,"company")),number:d(i(t,"number")),url:d(i(t,"url"))}))});function Re(e){let t=d(i(i(e,"lineItem"),"id"));return{quantity:M(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function Ne(e){return A(e)?{returnableLineItems:w(e.returnableLineItems,Re)}:null}function fe(e){if(!A(e))return null;let t=s=>d(e[s]),n=s=>O(e[s]),r=e.requiresShipping;return{id:S(e.id,"order id"),name:t("name"),number:z(e.number),processedAt:t("processedAt"),cancelledAt:t("cancelledAt"),financialStatus:t("financialStatus"),fulfillmentStatus:t("fulfillmentStatus"),statusPageUrl:t("statusPageUrl"),requiresShipping:typeof r=="boolean"?r:null,totalPrice:n("totalPrice"),subtotal:n("subtotal"),totalShipping:n("totalShipping"),totalTax:n("totalTax"),shippingAddress:ce(e.shippingAddress),billingAddress:ce(e.billingAddress),lineItems:w(e.lineItems,Le),fulfillments:w(e.fulfillments,Ie),returnInformation:Ne(e.returnInformation),returns:w(e.returns,_)}}var ke=e=>({id:d(i(e,"id")),name:d(i(e,"name")),title:d(i(e,"title")),variantTitle:d(i(e,"variantTitle")),quantity:M(i(e,"quantity")),sku:d(i(e,"sku")),currentPrice:O(i(e,"currentPrice")),lineDiscountedPrice:O(i(e,"lineDiscountedPrice")),image:ie(i(e,"image"))}),ge=e=>({cycleIndex:z(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:d(i(e,"billingAttemptExpectedDate"))});function De(e){if(!A(e))return null;let t=e.intervalCount;return{interval:d(e.interval),intervalCount:A(t)?{count:M(t.count)}:null}}var ve=e=>({id:S(i(e,"id"),"subscription id"),status:d(i(e,"status")),nextBillingDate:d(i(e,"nextBillingDate")),currencyCode:d(i(e,"currencyCode")),deliveryPrice:O(i(e,"deliveryPrice")),deliveryPolicy:De(i(e,"deliveryPolicy")),lines:w(i(e,"lines"),ke),upcomingBillingCycles:w(i(e,"upcomingBillingCycles"),ge)}),be=e=>q(e,ve);function ye(e){let{contract:t,billingCycle:n}=e;if(A(t))return{contract:{id:d(t.id),status:d(t.status)}};if(A(n)){let{cycleIndex:r,skipped:s}=ge(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ae("changed subscription")}function _(e){return{id:S(i(e,"id"),"return id"),status:d(i(e,"status"))}}var he=e=>S(e,"deleted address id"),Ae=e=>({firstName:d(i(e,"firstName")),lastName:d(i(e,"lastName"))});var V=null;function Me(e){V=e}function I(){if(!V)throw new Error("account-pages: loaded without the account part");return V}async function T(e,t){let{serverFetch:n}=I(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new H("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function D(e){I().reset(),ne("account-updated",{what:e})}async function K(e){let t=await T("order",{id:e});return fe(t.order)}async function Q({firstName:e,lastName:t}={}){let n=await T("profile",{firstName:e,lastName:t});return D("profile"),Ae(n.customer)}async function W(){let e=await T("addresses",{});return pe(e.addresses)}async function F(e,{id:t,isDefault:n}={}){let r=await T("saveAddress",{id:t,address:e,isDefault:n});return D("addresses"),j(r.address)}async function X(e){let t=await T("deleteAddress",{id:e});return D("addresses"),he(t.deleted)}async function Y(){let e=await T("subscriptions",{});return be(e.subscriptions)}async function Z(e,t){let n=await T("subscription",{id:e,action:t});return D("subscriptions"),ye(n)}async function J(e,t){let n=await T("requestReturn",{orderId:e,lines:t});return D("orders"),_(n.return)}function qe(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function v(e,t){e.setAttribute(f("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var He=e=>({name:e.name??"",date:C(e.processedAt),total:y(e.totalPrice),subtotal:y(e.subtotal),shipping:y(e.totalShipping),tax:y(e.totalTax),status:E(e.financialStatus),fulfillment:E(e.fulfillmentStatus),"shipping-address":k(e.shippingAddress),"billing-address":k(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:C(e.cancelledAt)});function Fe(e,t){let n=t.trackingInformation[0],r={status:E(t.latestShipmentStatus||t.status),date:C(t.createdAt),eta:C(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};L(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,b=c!==null&&G(c);b&&s.setAttribute("href",c),se(s,b);return}let u=h(r,o);u!==void 0&&g(s,u)})}function Be(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(u=>[u.lineItem?.id??"",u.quantity])),r=t.fulfillments.nodes,s=He(t);l(e,a("order-bind")).forEach(u=>{let c=p(u,"order-bind")??"";if(c==="url"){let $=t.statusPageUrl;$!==null&&G($)&&u.setAttribute("href",$);return}let b=h(s,c);b!==void 0&&g(u,b)}),l(e,a("order-lines")).forEach(u=>{de(u,t.lineItems.nodes,n)}),l(e,a("order-fulfillments")).forEach(u=>{P(u,r,Fe)});let o=e.dataset.tetherReturned==="1";m(e,"order-show",{loading:!1,ready:!0,error:!1,"not-found":!1,cancelled:!!t.cancelledAt,shipped:r.length>0,returnable:[...n.values()].some(u=>u>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(f("order-state"),"ready")}async function B(e){let t=qe(e);if(!t){e.setAttribute(f("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}v(e,"loading");let n;try{n=await K(t)}catch(r){x(r,"order"),v(e,"error");return}if(!n){v(e,"not-found");return}e.dataset.tetherOrderId=n.id,Be(e,n)}var we=[],xe=e=>we.find(t=>t.id===e),Ue=e=>({formatted:k(e),name:[e.firstName,e.lastName].filter(Boolean).join(" "),company:e.company||"",address1:e.address1||"",address2:e.address2||"",city:e.city||"",zip:e.zip||"",province:e.province||"",country:e.country||"",phone:e.phoneNumber||""});function $e(e,t){e.dataset.tetherAddress=t.id;let n=Ue(t);L(e,"address-bind").forEach(r=>{let s=h(n,p(r,"address-bind")??"");s!==void 0&&g(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function R(e){let t=l(e,a("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await W()}catch(r){x(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}we=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{P(r,n,$e)})}function ze(e){let t=e.upcomingBillingCycles.nodes[0],n=e.status,r=n==="ACTIVE";return{active:r,paused:n==="PAUSED",cancelled:n==="CANCELLED",expired:n==="EXPIRED",failed:n==="FAILED",skipped:!!t?.skipped,"can-pause":r,"can-resume":n==="PAUSED"||n==="FAILED","can-skip":r&&t!==void 0&&!t.skipped,"can-unskip":r&&!!t?.skipped,"can-cancel":r||n==="PAUSED"||n==="FAILED"}}function Ge(e){let t=E(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function je(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:E(e.status),next:C(e.nextBillingDate),interval:Ge(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:y(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:y(e.deliveryPrice)}}function _e(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:y(t.currentPrice)};L(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&re(r,t.image.url,t.image.altText||t.title||"");return}let o=h(n,s);o!==void 0&&g(r,o)})}function Ve(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(f("subscription-status"),E(t.status));let n=je(t);l(e,a("subscription-bind")).forEach(s=>{let o=h(n,p(s,"subscription-bind")??"");o!==void 0&&g(s,o)}),l(e,a("subscription-lines")).forEach(s=>{P(s,t.lines.nodes,_e)});let r=ze(t);m(e,"subscription-show",r),l(e,a("subscription-action")).forEach(s=>{let o=h(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function U(e){let t=l(e,a("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Y()}catch(r){x(r,"subscriptions"),m(e,"show",{"subscriptions-loading":!1,"subscriptions-error":!0});return}m(e,"show",{"subscriptions-loading":!1,"subscriptions-empty":n.length===0,"subscriptions-error":!1}),t.forEach(r=>{P(r,n,Ve)})}var Ke=["pause","resume","skip","unskip","cancel"],Qe=e=>Ke.some(t=>t===e),Ee=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,Te=e=>e instanceof window.HTMLFormElement;function Se(e){let t={};for(let n of e.elements)Ee(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function We(e){let n=(e instanceof H?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function N(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(f("form-state"),"pending");let n=l(e,a("form-error"));n.forEach(r=>{g(r,"")});try{return await t(),e.setAttribute(f("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(f("form-state"),"error"),n.forEach(s=>{g(s,We(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ee=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Pe=e=>{e.reset(),delete e.dataset.tetherAddressId};function Xe(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(a("profile-form")))e.preventDefault(),N(t,async()=>{await Q(Se(t)),await I().bindCustomer(document)});else if(t.matches(a("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;N(t,async()=>{await F(Se(t),{id:n,isDefault:s}),Pe(t),await R(document)})}}}function Ye(e){let t=xe(e),n=document.querySelector(a("address-form"));if(!t||!n||!Te(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Ee(s)){if(s.name==="isDefault")s instanceof window.HTMLInputElement&&(s.checked=t.isDefault);else if(s.name&&Object.hasOwn(r,s.name)){let o=r[s.name];s.value=typeof o=="string"?o:""}}n.scrollIntoView({block:"nearest"})}function Ze(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(a("address-new"))){let o=document.querySelector(a("address-form"));return o&&Te(o)&&Pe(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(a("address-delete"));if(s){if(e.preventDefault(),!ee(s))return!0;N(n,async()=>{await X(r),await R(document)})}else if(t.closest(a("address-default")))e.preventDefault(),N(n,async()=>{await F(null,{id:r,isDefault:!0}),await R(document)});else if(t.closest(a("address-edit")))e.preventDefault(),Ye(r);else return!1;return!0}function Je(e){let t=e.closest("[data-tether-subscription]"),n=p(e,"subscription-action"),r="disabled"in e&&e.disabled===!0||e.classList.contains("is-disabled");if(!(t instanceof window.HTMLElement)||!Qe(n)||r||!ee(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(f("subscription-state"),"pending"),N(t,async()=>{await Z(s,n),await U(document)}).then(o=>{let u=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(f("subscription-state"),u)})})}function et(e){let t=e.querySelector(a("return-quantity")),n=e.querySelector(a("return-reason")),r=e.querySelector(a("return-note")),s=b=>b&&"value"in b&&typeof b.value=="string"?b.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},u=s(n);u&&(o.reasonId=u);let c=s(r);return c&&(o.note=c),o}function tt(e){let t=e.closest(a("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(et).filter(s=>s.quantity>0);!r.length||!ee(e)||N(t,async()=>{await J(n,r),t.dataset.tetherReturned="1",await B(t)})}function nt(e){let t=e.target;if(!(t instanceof window.Element)||Ze(e,t))return;let n=t.closest(a("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),Je(n);return}let r=t.closest(a("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),tt(r))}function Ce(){document.addEventListener("submit",Xe,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(a("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",nt)}var rt=["firstName","lastName"];async function st(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await I().customer()}catch(r){x(r,"account");return}if(!t)return;let n=e.elements;rt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Oe=!1;async function Qt(e=document){Oe||(Oe=!0,Ce()),await Promise.all([...l(e,a("order")).map(t=>B(t)),...l(e,a("profile-form")).map(t=>st(t)),R(e),U(e)])}function Wt(e){l(e,a("order")).forEach(t=>{v(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}export{W as addresses,X as deleteAddress,K as order,Qt as renderPages,J as requestReturn,F as saveAddress,Me as setup,Wt as showUnavailable,Z as subscriptionAction,Y as subscriptions,Q as updateProfile};
1
+ import{a as O,b as ie,c as oe,d as ae,e as S,i as m,j as L,k as E,l as k,m as h,n as de}from"./chunk-N3V45JPS.js";import{D as y,E as C,G as g,I as se,a as H,m as f,n as a,o as p,q as l,u as ne,x as re,z as P}from"./chunk-MQYB6BH4.js";import{C as G,d as A,e as i,g as d,h as z,i as M,j as q,k as w,l as te,z as x}from"./chunk-E5YO6274.js";var ue={order:{name:"order",method:"GET",path:"/order",fields:{id:!0}},addresses:{name:"addresses",method:"GET",path:"/addresses",fields:{}},subscriptions:{name:"subscriptions",method:"GET",path:"/subscriptions",fields:{}},profile:{name:"profile",method:"POST",path:"/profile",fields:{firstName:!0,lastName:!0}},saveAddress:{name:"saveAddress",method:"POST",path:"/address",fields:{id:!0,address:!0,isDefault:!0}},deleteAddress:{name:"deleteAddress",method:"POST",path:"/address/delete",fields:{id:!0}},subscription:{name:"subscription",method:"POST",path:"/subscription",fields:{id:!0,action:!0}},requestReturn:{name:"requestReturn",method:"POST",path:"/return",fields:{orderId:!0,lines:!0}}},it=new Map(Object.values(ue).map(e=>[`${e.method} ${e.path}`,{...e,fields:Object.keys(e.fields)}]));function le(e,t){let n=ue[e];if(n.method==="POST")return{method:"POST",path:n.path};let r=t,s=new URLSearchParams;for(let u of Object.keys(n.fields)){let c=r[u];(typeof c=="string"||typeof c=="number")&&s.set(u,String(c))}let o=s.toString();return{method:"GET",path:o?`${n.path}?${o}`:n.path}}function me(e){let t=n=>d(i(e,n));return{id:t("id"),firstName:t("firstName"),lastName:t("lastName"),company:t("company"),address1:t("address1"),address2:t("address2"),city:t("city"),province:t("province"),zoneCode:t("zoneCode"),zip:t("zip"),country:t("country"),countryCode:t("countryCode"),phoneNumber:t("phoneNumber"),formatted:te(i(e,"formatted"))}}var ce=e=>A(e)?me(e):null,j=e=>({...me(e),id:S(i(e,"id"),"address id")}),pe=e=>q(e,t=>({...j(t),isDefault:i(t,"isDefault")===!0})),Le=e=>({...oe(e),id:S(i(e,"id"),"line item id"),name:d(i(e,"name")),sku:d(i(e,"sku")),price:O(i(e,"price")),totalPrice:O(i(e,"totalPrice")),suggestedReturnReasonDefinitions:w(i(e,"suggestedReturnReasonDefinitions"),t=>({id:S(i(t,"id"),"return reason id"),name:d(i(t,"name")),handle:d(i(t,"handle"))}))}),Ie=e=>({id:d(i(e,"id")),status:d(i(e,"status")),createdAt:d(i(e,"createdAt")),estimatedDeliveryAt:d(i(e,"estimatedDeliveryAt")),latestShipmentStatus:d(i(e,"latestShipmentStatus")),trackingInformation:q(i(e,"trackingInformation"),t=>({company:d(i(t,"company")),number:d(i(t,"number")),url:d(i(t,"url"))}))});function Re(e){let t=d(i(i(e,"lineItem"),"id"));return{quantity:M(i(e,"quantity")),lineItem:t===null?null:{id:t}}}function Ne(e){return A(e)?{returnableLineItems:w(e.returnableLineItems,Re)}:null}function fe(e){if(!A(e))return null;let t=s=>d(e[s]),n=s=>O(e[s]),r=e.requiresShipping;return{id:S(e.id,"order id"),name:t("name"),number:z(e.number),processedAt:t("processedAt"),cancelledAt:t("cancelledAt"),financialStatus:t("financialStatus"),fulfillmentStatus:t("fulfillmentStatus"),statusPageUrl:t("statusPageUrl"),requiresShipping:typeof r=="boolean"?r:null,totalPrice:n("totalPrice"),subtotal:n("subtotal"),totalShipping:n("totalShipping"),totalTax:n("totalTax"),shippingAddress:ce(e.shippingAddress),billingAddress:ce(e.billingAddress),lineItems:w(e.lineItems,Le),fulfillments:w(e.fulfillments,Ie),returnInformation:Ne(e.returnInformation),returns:w(e.returns,_)}}var ke=e=>({id:d(i(e,"id")),name:d(i(e,"name")),title:d(i(e,"title")),variantTitle:d(i(e,"variantTitle")),quantity:M(i(e,"quantity")),sku:d(i(e,"sku")),currentPrice:O(i(e,"currentPrice")),lineDiscountedPrice:O(i(e,"lineDiscountedPrice")),image:ie(i(e,"image"))}),ge=e=>({cycleIndex:z(i(e,"cycleIndex")),skipped:i(e,"skipped")===!0,billingAttemptExpectedDate:d(i(e,"billingAttemptExpectedDate"))});function De(e){if(!A(e))return null;let t=e.intervalCount;return{interval:d(e.interval),intervalCount:A(t)?{count:M(t.count)}:null}}var ve=e=>({id:S(i(e,"id"),"subscription id"),status:d(i(e,"status")),nextBillingDate:d(i(e,"nextBillingDate")),currencyCode:d(i(e,"currencyCode")),deliveryPrice:O(i(e,"deliveryPrice")),deliveryPolicy:De(i(e,"deliveryPolicy")),lines:w(i(e,"lines"),ke),upcomingBillingCycles:w(i(e,"upcomingBillingCycles"),ge)}),be=e=>q(e,ve);function ye(e){let{contract:t,billingCycle:n}=e;if(A(t))return{contract:{id:d(t.id),status:d(t.status)}};if(A(n)){let{cycleIndex:r,skipped:s}=ge(n);return{billingCycle:{cycleIndex:r,skipped:s}}}throw ae("changed subscription")}function _(e){return{id:S(i(e,"id"),"return id"),status:d(i(e,"status"))}}var he=e=>S(e,"deleted address id"),Ae=e=>({firstName:d(i(e,"firstName")),lastName:d(i(e,"lastName"))});var V=null;function Me(e){V=e}function I(){if(!V)throw new Error("account-pages: loaded without the account part");return V}async function T(e,t){let{serverFetch:n}=I(),{method:r,path:s}=le(e,t),o=await n(s,r==="POST"?{method:r,body:t}:{});if(o.kind==="logged-out")throw new H("Not logged in",{code:"NOT_LOGGED_IN",status:401});return o.data}function D(e){I().reset(),ne("account-updated",{what:e})}async function K(e){let t=await T("order",{id:e});return fe(t.order)}async function Q({firstName:e,lastName:t}={}){let n=await T("profile",{firstName:e,lastName:t});return D("profile"),Ae(n.customer)}async function W(){let e=await T("addresses",{});return pe(e.addresses)}async function F(e,{id:t,isDefault:n}={}){let r=await T("saveAddress",{id:t,address:e,isDefault:n});return D("addresses"),j(r.address)}async function X(e){let t=await T("deleteAddress",{id:e});return D("addresses"),he(t.deleted)}async function Y(){let e=await T("subscriptions",{});return be(e.subscriptions)}async function Z(e,t){let n=await T("subscription",{id:e,action:t});return D("subscriptions"),ye(n)}async function J(e,t){let n=await T("requestReturn",{orderId:e,lines:t});return D("orders"),_(n.return)}function qe(e){let t=p(e,"order")||"";return t.startsWith("url:")?new URL(window.location.href).searchParams.get(t.slice(4)||"id"):t}function v(e,t){e.setAttribute(f("order-state"),t),m(e,"order-show",{loading:t==="loading",ready:!1,"not-found":t==="not-found",error:t==="error"})}var He=e=>({name:e.name??"",date:C(e.processedAt),total:y(e.totalPrice),subtotal:y(e.subtotal),shipping:y(e.totalShipping),tax:y(e.totalTax),status:E(e.financialStatus),fulfillment:E(e.fulfillmentStatus),"shipping-address":k(e.shippingAddress),"billing-address":k(e.billingAddress),items:e.lineItems.nodes.map(t=>`${String(t.quantity)}\xD7 ${t.title||t.name||""}`).join(", "),cancelled:C(e.cancelledAt)});function Fe(e,t){let n=t.trackingInformation[0],r={status:E(t.latestShipmentStatus||t.status),date:C(t.createdAt),eta:C(t.estimatedDeliveryAt),company:n?.company||"",number:n?.number||""};L(e,"fulfillment-bind").forEach(s=>{let o=p(s,"fulfillment-bind")??"";if(o==="url"){let c=n?.url??null,b=c!==null&&G(c);b&&s.setAttribute("href",c),se(s,b);return}let u=h(r,o);u!==void 0&&g(s,u)})}function Be(e,t){let n=new Map((t.returnInformation?.returnableLineItems.nodes??[]).map(u=>[u.lineItem?.id??"",u.quantity])),r=t.fulfillments.nodes,s=He(t);l(e,a("order-bind")).forEach(u=>{let c=p(u,"order-bind")??"";if(c==="url"){let $=t.statusPageUrl;$!==null&&G($)&&u.setAttribute("href",$);return}let b=h(s,c);b!==void 0&&g(u,b)}),l(e,a("order-lines")).forEach(u=>{de(u,t.lineItems.nodes,n)}),l(e,a("order-fulfillments")).forEach(u=>{P(u,r,Fe)});let o=e.dataset.tetherReturned==="1";m(e,"order-show",{loading:!1,ready:!0,error:!1,"not-found":!1,cancelled:!!t.cancelledAt,shipped:r.length>0,returnable:[...n.values()].some(u=>u>0),"has-returns":!o&&t.returns.nodes.length>0,"return-requested":o}),e.setAttribute(f("order-state"),"ready")}async function B(e){let t=qe(e);if(!t){e.setAttribute(f("order-state"),"not-found"),m(e,"order-show",{"not-found":!0});return}v(e,"loading");let n;try{n=await K(t)}catch(r){x(r,"order"),v(e,"error");return}if(!n){v(e,"not-found");return}e.dataset.tetherOrderId=n.id,Be(e,n)}var we=[],xe=e=>we.find(t=>t.id===e),Ue=e=>({formatted:k(e),name:[e.firstName,e.lastName].filter(Boolean).join(" "),company:e.company||"",address1:e.address1||"",address2:e.address2||"",city:e.city||"",zip:e.zip||"",province:e.province||"",country:e.country||"",phone:e.phoneNumber||""});function $e(e,t){e.dataset.tetherAddress=t.id;let n=Ue(t);L(e,"address-bind").forEach(r=>{let s=h(n,p(r,"address-bind")??"");s!==void 0&&g(r,s)}),m(e,"address-show",{default:t.isDefault,"not-default":!t.isDefault})}async function R(e){let t=l(e,a("addresses"));if(!t.length)return;m(e,"show",{"addresses-loading":!0,"addresses-empty":!1});let n;try{n=await W()}catch(r){x(r,"addresses"),m(e,"show",{"addresses-loading":!1,"addresses-error":!0});return}we=n,m(e,"show",{"addresses-loading":!1,"addresses-empty":n.length===0,"addresses-error":!1}),t.forEach(r=>{P(r,n,$e)})}function ze(e){let t=e.upcomingBillingCycles.nodes[0],n=e.status,r=n==="ACTIVE";return{active:r,paused:n==="PAUSED",cancelled:n==="CANCELLED",expired:n==="EXPIRED",failed:n==="FAILED",skipped:!!t?.skipped,"can-pause":r,"can-resume":n==="PAUSED"||n==="FAILED","can-skip":r&&t!==void 0&&!t.skipped,"can-unskip":r&&!!t?.skipped,"can-cancel":r||n==="PAUSED"||n==="FAILED"}}function Ge(e){let t=E(e.deliveryPolicy?.interval);if(!t)return"";let n=e.deliveryPolicy?.intervalCount?.count??1;return n<=1?t:`${String(n)} ${t}s`}function je(e){let t=e.lines.nodes,n=t.reduce((r,s)=>r+Number.parseFloat(s.lineDiscountedPrice?.amount??"0"),0);return{status:E(e.status),next:C(e.nextBillingDate),interval:Ge(e),products:t.map(r=>`${String(r.quantity)}\xD7 ${r.title??""}`).join(", "),total:y(t.length&&e.currencyCode?{amount:String(n),currencyCode:e.currencyCode}:null),delivery:y(e.deliveryPrice)}}function _e(e,t){let n={title:t.title??"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:y(t.currentPrice)};L(e,"subscription-line").forEach(r=>{let s=p(r,"subscription-line")??"";if(s==="image"){t.image&&re(r,t.image.url,t.image.altText||t.title||"");return}let o=h(n,s);o!==void 0&&g(r,o)})}function Ve(e,t){e.dataset.tetherSubscription=t.id,e.setAttribute(f("subscription-status"),E(t.status));let n=je(t);l(e,a("subscription-bind")).forEach(s=>{let o=h(n,p(s,"subscription-bind")??"");o!==void 0&&g(s,o)}),l(e,a("subscription-lines")).forEach(s=>{P(s,t.lines.nodes,_e)});let r=ze(t);m(e,"subscription-show",r),l(e,a("subscription-action")).forEach(s=>{let o=h(r,`can-${p(s,"subscription-action")??""}`)===!0;"disabled"in s&&(s.disabled=!o),s.classList.toggle("is-disabled",!o)})}async function U(e){let t=l(e,a("subscriptions"));if(!t.length)return;m(e,"show",{"subscriptions-loading":!0,"subscriptions-empty":!1});let n;try{n=await Y()}catch(r){x(r,"subscriptions"),m(e,"show",{"subscriptions-loading":!1,"subscriptions-error":!0});return}m(e,"show",{"subscriptions-loading":!1,"subscriptions-empty":n.length===0,"subscriptions-error":!1}),t.forEach(r=>{P(r,n,Ve)})}var Ke=["pause","resume","skip","unskip","cancel"],Qe=e=>Ke.some(t=>t===e),Ee=e=>e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement,Te=e=>e instanceof window.HTMLFormElement;function Se(e){let t={};for(let n of e.elements)Ee(n)&&(!n.name||n.type==="submit"||n.type==="button"||n.type==="checkbox"||(t[n.name]=n.value));return t}function We(e){let n=(e instanceof H?e.userErrors??[]:[]).map(s=>s.message).join(" ");return n||(e instanceof Error&&e.message?e.message:"Something went wrong").replace(/^Customer accounts: /,"")}async function N(e,t){if(e.getAttribute("aria-busy")==="true")return"busy";e.classList.add("is-busy"),e.setAttribute("aria-busy","true"),e.setAttribute(f("form-state"),"pending");let n=l(e,a("form-error"));n.forEach(r=>{g(r,"")});try{return await t(),e.setAttribute(f("form-state"),"saved"),"saved"}catch(r){return e.setAttribute(f("form-state"),"error"),n.forEach(s=>{g(s,We(r))}),"error"}finally{e.classList.remove("is-busy"),e.removeAttribute("aria-busy")}}var ee=e=>{let t=p(e,"confirm");return!t||window.confirm(t)},Pe=e=>{e.reset(),delete e.dataset.tetherAddressId};function Xe(e){let t=e.target;if(t instanceof window.HTMLFormElement){if(t.matches(a("profile-form")))e.preventDefault(),N(t,async()=>{await Q(Se(t)),await I().bindCustomer(document)});else if(t.matches(a("address-form"))){e.preventDefault();let n=t.dataset.tetherAddressId,r=t.elements.namedItem("isDefault"),s=r instanceof window.HTMLInputElement&&r.checked;N(t,async()=>{await F(Se(t),{id:n,isDefault:s}),Pe(t),await R(document)})}}}function Ye(e){let t=xe(e),n=document.querySelector(a("address-form"));if(!t||!n||!Te(n))return;n.dataset.tetherAddressId=t.id;let r={...t};for(let s of n.elements)if(Ee(s)){if(s.name==="isDefault")s instanceof window.HTMLInputElement&&(s.checked=t.isDefault);else if(s.name&&Object.hasOwn(r,s.name)){let o=r[s.name];s.value=typeof o=="string"?o:""}}n.scrollIntoView({block:"nearest"})}function Ze(e,t){let n=t.closest("[data-tether-address]"),r=n instanceof window.HTMLElement?n.dataset.tetherAddress:void 0;if(t.closest(a("address-new"))){let o=document.querySelector(a("address-form"));return o&&Te(o)&&Pe(o),!0}if(!(n instanceof window.HTMLElement)||!r)return!1;let s=t.closest(a("address-delete"));if(s){if(e.preventDefault(),!ee(s))return!0;N(n,async()=>{await X(r),await R(document)})}else if(t.closest(a("address-default")))e.preventDefault(),N(n,async()=>{await F(null,{id:r,isDefault:!0}),await R(document)});else if(t.closest(a("address-edit")))e.preventDefault(),Ye(r);else return!1;return!0}function Je(e){let t=e.closest("[data-tether-subscription]"),n=p(e,"subscription-action"),r="disabled"in e&&e.disabled===!0||e.classList.contains("is-disabled");if(!(t instanceof window.HTMLElement)||!Qe(n)||r||!ee(e))return;let s=t.dataset.tetherSubscription??"";t.setAttribute(f("subscription-state"),"pending"),N(t,async()=>{await Z(s,n),await U(document)}).then(o=>{let u=o==="error"?"error":"done";l(document,"[data-tether-subscription]").filter(c=>c===t||c.dataset.tetherSubscription===s).forEach(c=>{c.setAttribute(f("subscription-state"),u)})})}function et(e){let t=e.querySelector(a("return-quantity")),n=e.querySelector(a("return-reason")),r=e.querySelector(a("return-note")),s=b=>b&&"value"in b&&typeof b.value=="string"?b.value:"",o={lineItemId:e.dataset.tetherLine??"",quantity:Number.parseInt(s(t)||"0",10)},u=s(n);u&&(o.reasonId=u);let c=s(r);return c&&(o.note=c),o}function tt(e){let t=e.closest(a("order"));if(!(t instanceof window.HTMLElement))return;let n=t.dataset.tetherOrderId;if(!n)return;let r=l(t,"[data-tether-line]").map(et).filter(s=>s.quantity>0);!r.length||!ee(e)||N(t,async()=>{await J(n,r),t.dataset.tetherReturned="1",await B(t)})}function nt(e){let t=e.target;if(!(t instanceof window.Element)||Ze(e,t))return;let n=t.closest(a("subscription-action"));if(n instanceof window.HTMLElement){e.preventDefault(),Je(n);return}let r=t.closest(a("order-return"));r instanceof window.HTMLElement&&(e.preventDefault(),tt(r))}function Ce(){document.addEventListener("submit",Xe,!0),document.addEventListener("input",e=>{let t=e.target;t instanceof window.HTMLElement&&t.closest(a("profile-form"))&&(t.dataset.tetherTouched="1")}),document.addEventListener("click",nt)}var rt=["firstName","lastName"];async function st(e){if(!(e instanceof window.HTMLFormElement))return;let t;try{t=await I().customer()}catch(r){x(r,"account");return}if(!t)return;let n=e.elements;rt.forEach(r=>{let s=n.namedItem(r);(s instanceof window.HTMLInputElement||s instanceof window.HTMLTextAreaElement)&&!s.dataset.tetherTouched&&(s.value=t[r]??"")})}var Oe=!1;async function Qt(e=document){Oe||(Oe=!0,Ce()),await Promise.all([...l(e,a("order")).map(t=>B(t)),...l(e,a("profile-form")).map(t=>st(t)),R(e),U(e)])}function Wt(e){l(e,a("order")).forEach(t=>{v(t,"error")}),m(e,"show",{"addresses-loading":!1,"addresses-error":!0,"subscriptions-loading":!1,"subscriptions-error":!0})}export{W as addresses,X as deleteAddress,K as order,Qt as renderPages,J as requestReturn,F as saveAddress,Me as setup,Wt as showUnavailable,Z as subscriptionAction,Y as subscriptions,Q as updateProfile};
@@ -1 +1 @@
1
- import{a as A}from"./chunk-56FCLJJD.js";import"./chunk-T44MUL4Y.js";import"./chunk-MPDWM2NN.js";import{e as h}from"./chunk-A5SYCVQM.js";import"./chunk-BFTZR4OB.js";import{d as k,h as E,m as p,r as _,s as w}from"./chunk-BA4LQJJQ.js";import{r as a,x as T,z as l}from"./chunk-E5YO6274.js";var F=500,S={"default-banner":"https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",other:"https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js"},O="https://cdn.shopify.com/storefront/analytics/shopify.js",x=()=>window,m=()=>x().Shopify;function L(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function I(){try{let t=m()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function j(t){let e=`hydrogen:${t}`;return{getTrackingValues:()=>{let n=I()?m()?.customerPrivacy?.__internal:void 0;return{uniqueToken:n?.uniqueToken?.({generateFallback:!0,tag:e})??"",visitToken:n?.visitToken?.({generateFallback:!0,tag:e})??""}}}}var $=t=>(e,n)=>{let i=t.subscribers.get(e)??new Set;return t.subscribers.set(e,i),i.add(n),()=>t.subscribers.get(e)?.delete(n)};function U(t){let e=[],n=[],i={shop:{shopId:t,channel:"headless"},consent:{mode:L().consent||"no-banner"}},o=()=>{if(I())for(let r of e)for(;r.next<n.length;r.next+=1){let s=n[r.next];s&&G(r,s)}},c={getConfig:()=>i,publish(r,s={}){if(n.push({event:r,payload:{shop:i.shop,url:window.location.href,...s}}),n.length>F){n.shift();for(let d of e)d.next=Math.max(0,d.next-1)}o()},addDestination(r){let s={name:r.name,next:0,subscribers:new Map,context:j(r.name)};return Promise.resolve(r.setup?.({subscribe:$(s),getConfig:c.getConfig})).then(()=>{e.push(s),o()}).catch(d=>{l(d,`analytics ${r.name}`)}),()=>{let d=e.indexOf(s);d>=0&&e.splice(d,1)}}};return document.addEventListener("consentTrackingApiLoaded",o),document.addEventListener("visitorConsentCollected",o),c}function G(t,{event:e,payload:n}){t.subscribers.get(e)?.forEach(i=>{try{i(n,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function P(t){let e=document.createElement("script");e.src=t,e.async=!0,document.head.appendChild(e)}async function R(t){let e=m();if(e?.analytics)return e.analytics;let n=await E("query TetherShopId { shop { id } }",{},k({shop:{id:"string"}}),{context:!1}),i=m()??{};x().Shopify=i,i.country=a.country??"US";let[o="en"]=(a.locale||"en").split("-");i.locale=o.toLowerCase(),i.shop=a.domain,i.routes={root:"/",match:()=>({pageTemplateName:t()?"product":"page"}),...i.routes};let{proxy:c,consent:r}=L();i.customerPrivacy={...i.customerPrivacy,config:c?{isHeadless:!0,asyncConsent:!0,asyncVisitorState:!0,consentDomain:window.location.host}:{isHeadless:!0,storefrontAccessToken:a.token,checkoutRootDomain:a.domain}};let s=U(n.shop.id);return i.analytics=s,P(r==="default-banner"?S["default-banner"]:S.other),P(O),T("shopify analytics ready",n.shop.id),s}var W="Default Title",V=100,H=200,Y=t=>t?parseFloat(t.amount):0,N=t=>(t??"").split("/").pop()??"";function C(t,e,n=1,i){let o={item_id:e?.sku||N(e?.id)||N(t.id),item_name:t.title,item_variant:e?.title===W?void 0:e?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:Y(e?.price??t.priceRange?.minVariantPrice),quantity:n};return i!=null&&(o.index=i),o}var g=(t,e=t.quantity)=>C(t.merchandise.product,t.merchandise,e);function f(t){let e=t.reduce((n,i)=>n+i.price*(i.quantity||1),0);return Math.round(e*V)/V}var X=(t,e,n=1)=>({id:t.id,title:t.title,price:e.price,vendor:t.vendor||"",variantId:e.id,variantTitle:e.title,quantity:n,sku:e.sku||void 0,productType:t.productType||void 0}),D=t=>({id:t.id,quantity:t.quantity,merchandise:{id:t.merchandise.id,title:t.merchandise.title,price:t.merchandise.price,sku:t.merchandise.sku,product:{id:t.merchandise.product.id,title:t.merchandise.product.title,vendor:t.merchandise.product.vendor||"",handle:t.merchandise.product.handle}}});function Z(){let{dataLayer:t}=a.analytics??{},e=typeof t=="string"?t:"dataLayer",n=Reflect.get(window,e);if(Array.isArray(n))return n;let i=[];return Reflect.set(window,e,i),i}function z(t,e){let n=Z();if(!e){n.push({event:t});return}n.push({ecommerce:null}),n.push({event:t,ecommerce:e})}var y=null,v=null,q=null,b=new WeakSet;function u(t,e,n,i){a.analytics?.dataLayer&&z(t,e),y&&n&&y.publish(n,i);try{a.analytics?.onEvent?.(t,e)}catch(o){l(o,"analytics onEvent")}}function M(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:A.get(t)??null}function J({product:t,scope:e}){if(b.has(e.root)||M()!==e)return;b.add(e.root);let n=e.variant??t.variants.nodes[0],i=[C(t,n)],o=n?[X(t,n)]:[];u("view_item",{currency:n?.price.currencyCode,value:f(i),items:i},"product_viewed",{products:o})}function K({products:t,collection:e}){let n=t.slice(0,H).map((o,c)=>C(o,o.variants.nodes[0],1,c)),i={item_list_id:e?.handle||"products",item_list_name:e?.title||"Products"};if(!e){u("view_item_list",{...i,items:n});return}u("view_item_list",{...i,items:n},"collection_viewed",{collection:{id:e.id,handle:e.handle}})}function Q(t,e,n){let i=t?.cost.totalAmount.currencyCode;e.forEach((o,c)=>{let r=n.get(c),s=o.quantity-(r?.quantity??0);if(s<=0)return;let d=[g(o,s)];u("add_to_cart",{currency:i,value:f(d),items:d},"product_added_to_cart",{cart:t,prevCart:q,currentLine:D(o),prevLine:r?D(r):void 0})}),n.forEach((o,c)=>{let r=o.quantity-(e.get(c)?.quantity??0);if(r<=0)return;let s=[g(o,r)];u("remove_from_cart",{currency:i,value:f(s),items:s})})}function tt({cart:t,reason:e}){let n=new Map((t?.lines.nodes??[]).map(i=>[i.merchandise.id,i]));v&&e!=="load"&&e!=="pending"&&Q(t,n,v),v=n,q=t}function et(){let t=h.lines.map(e=>g(e));u("view_cart",{currency:h.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function nt({cart:t}){if(!t)return;let e=t.lines.nodes.map(i=>g(i)),n=t.discountCodes.filter(i=>i.applicable).map(i=>i.code);u("begin_checkout",{currency:t.cost.totalAmount.currencyCode,value:f(e),coupon:n.join(",")||void 0,items:e})}var it={"product-ready":J,"list-ready":K,"cart-updated":tt,"cart-toggled":({open:t})=>{t&&et()},checkout:nt,search:({term:t})=>{t&&u("search",{search_term:t},"search_viewed",{searchTerm:t})}};function ot(t,e){it[e](t.detail)}function B(t){if(t.type==="astro:page-load"){b=new WeakSet,y?.publish("page_viewed",{});return}_.forEach(e=>{w(t,e)&&ot(t,e)})}async function ft(t){a.analytics?.shopify&&(y=await R(()=>M()!=null).catch(e=>(l(e,"shopify analytics"),null))),y?.publish("page_viewed",{}),t.splice(0).forEach(B),t.push=(...e)=>(e.forEach(B),t.length)}export{ft as startAnalytics};
1
+ import{a as A}from"./chunk-YN6LEBEN.js";import"./chunk-BBVUVPMO.js";import"./chunk-VFNHIGCS.js";import{e as h}from"./chunk-HJY2JSNB.js";import"./chunk-6TFMLT4A.js";import{d as k,i as E,n as p,s as _,t as w}from"./chunk-MQYB6BH4.js";import{r as a,x as T,z as l}from"./chunk-E5YO6274.js";var F=500,S={"default-banner":"https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js",other:"https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.2/consent-tracking-api.js"},O="https://cdn.shopify.com/storefront/analytics/shopify.js",x=()=>window,m=()=>x().Shopify;function L(){let t=a.analytics?.shopify;return typeof t=="object"?t:{}}function I(){try{let t=m()?.customerPrivacy;return t?.consentStatus==="loaded"&&t.currentVisitorConsent?.()?.analytics!=="no"&&!!t.analyticsProcessingAllowed?.()}catch{return!1}}function j(t){let e=`hydrogen:${t}`;return{getTrackingValues:()=>{let n=I()?m()?.customerPrivacy?.__internal:void 0;return{uniqueToken:n?.uniqueToken?.({generateFallback:!0,tag:e})??"",visitToken:n?.visitToken?.({generateFallback:!0,tag:e})??""}}}}var $=t=>(e,n)=>{let i=t.subscribers.get(e)??new Set;return t.subscribers.set(e,i),i.add(n),()=>t.subscribers.get(e)?.delete(n)};function U(t){let e=[],n=[],i={shop:{shopId:t,channel:"headless"},consent:{mode:L().consent||"no-banner"}},o=()=>{if(I())for(let r of e)for(;r.next<n.length;r.next+=1){let s=n[r.next];s&&G(r,s)}},c={getConfig:()=>i,publish(r,s={}){if(n.push({event:r,payload:{shop:i.shop,url:window.location.href,...s}}),n.length>F){n.shift();for(let d of e)d.next=Math.max(0,d.next-1)}o()},addDestination(r){let s={name:r.name,next:0,subscribers:new Map,context:j(r.name)};return Promise.resolve(r.setup?.({subscribe:$(s),getConfig:c.getConfig})).then(()=>{e.push(s),o()}).catch(d=>{l(d,`analytics ${r.name}`)}),()=>{let d=e.indexOf(s);d>=0&&e.splice(d,1)}}};return document.addEventListener("consentTrackingApiLoaded",o),document.addEventListener("visitorConsentCollected",o),c}function G(t,{event:e,payload:n}){t.subscribers.get(e)?.forEach(i=>{try{i(n,t.context)}catch(o){l(o,`analytics ${t.name}`)}})}function P(t){let e=document.createElement("script");e.src=t,e.async=!0,document.head.appendChild(e)}async function R(t){let e=m();if(e?.analytics)return e.analytics;let n=await E("query TetherShopId { shop { id } }",{},k({shop:{id:"string"}}),{context:!1}),i=m()??{};x().Shopify=i,i.country=a.country??"US";let[o="en"]=(a.locale||"en").split("-");i.locale=o.toLowerCase(),i.shop=a.domain,i.routes={root:"/",match:()=>({pageTemplateName:t()?"product":"page"}),...i.routes};let{proxy:c,consent:r}=L();i.customerPrivacy={...i.customerPrivacy,config:c?{isHeadless:!0,asyncConsent:!0,asyncVisitorState:!0,consentDomain:window.location.host}:{isHeadless:!0,storefrontAccessToken:a.token,checkoutRootDomain:a.domain}};let s=U(n.shop.id);return i.analytics=s,P(r==="default-banner"?S["default-banner"]:S.other),P(O),T("shopify analytics ready",n.shop.id),s}var W="Default Title",V=100,H=200,Y=t=>t?parseFloat(t.amount):0,N=t=>(t??"").split("/").pop()??"";function C(t,e,n=1,i){let o={item_id:e?.sku||N(e?.id)||N(t.id),item_name:t.title,item_variant:e?.title===W?void 0:e?.title,item_brand:t.vendor||void 0,item_category:t.productType||void 0,price:Y(e?.price??t.priceRange?.minVariantPrice),quantity:n};return i!=null&&(o.index=i),o}var g=(t,e=t.quantity)=>C(t.merchandise.product,t.merchandise,e);function f(t){let e=t.reduce((n,i)=>n+i.price*(i.quantity||1),0);return Math.round(e*V)/V}var X=(t,e,n=1)=>({id:t.id,title:t.title,price:e.price,vendor:t.vendor||"",variantId:e.id,variantTitle:e.title,quantity:n,sku:e.sku||void 0,productType:t.productType||void 0}),D=t=>({id:t.id,quantity:t.quantity,merchandise:{id:t.merchandise.id,title:t.merchandise.title,price:t.merchandise.price,sku:t.merchandise.sku,product:{id:t.merchandise.product.id,title:t.merchandise.product.title,vendor:t.merchandise.product.vendor||"",handle:t.merchandise.product.handle}}});function Z(){let{dataLayer:t}=a.analytics??{},e=typeof t=="string"?t:"dataLayer",n=Reflect.get(window,e);if(Array.isArray(n))return n;let i=[];return Reflect.set(window,e,i),i}function z(t,e){let n=Z();if(!e){n.push({event:t});return}n.push({ecommerce:null}),n.push({event:t,ecommerce:e})}var y=null,v=null,q=null,b=new WeakSet;function u(t,e,n,i){a.analytics?.dataLayer&&z(t,e),y&&n&&y.publish(n,i);try{a.analytics?.onEvent?.(t,e)}catch(o){l(o,"analytics onEvent")}}function M(){let t=document.querySelector(p("product"));return!t||t.closest(`${p("collection")},${p("products")},${p("recommendations")}`)?null:A.get(t)??null}function J({product:t,scope:e}){if(b.has(e.root)||M()!==e)return;b.add(e.root);let n=e.variant??t.variants.nodes[0],i=[C(t,n)],o=n?[X(t,n)]:[];u("view_item",{currency:n?.price.currencyCode,value:f(i),items:i},"product_viewed",{products:o})}function K({products:t,collection:e}){let n=t.slice(0,H).map((o,c)=>C(o,o.variants.nodes[0],1,c)),i={item_list_id:e?.handle||"products",item_list_name:e?.title||"Products"};if(!e){u("view_item_list",{...i,items:n});return}u("view_item_list",{...i,items:n},"collection_viewed",{collection:{id:e.id,handle:e.handle}})}function Q(t,e,n){let i=t?.cost.totalAmount.currencyCode;e.forEach((o,c)=>{let r=n.get(c),s=o.quantity-(r?.quantity??0);if(s<=0)return;let d=[g(o,s)];u("add_to_cart",{currency:i,value:f(d),items:d},"product_added_to_cart",{cart:t,prevCart:q,currentLine:D(o),prevLine:r?D(r):void 0})}),n.forEach((o,c)=>{let r=o.quantity-(e.get(c)?.quantity??0);if(r<=0)return;let s=[g(o,r)];u("remove_from_cart",{currency:i,value:f(s),items:s})})}function tt({cart:t,reason:e}){let n=new Map((t?.lines.nodes??[]).map(i=>[i.merchandise.id,i]));v&&e!=="load"&&e!=="pending"&&Q(t,n,v),v=n,q=t}function et(){let t=h.lines.map(e=>g(e));u("view_cart",{currency:h.state?.cost.totalAmount.currencyCode,value:f(t),items:t})}function nt({cart:t}){if(!t)return;let e=t.lines.nodes.map(i=>g(i)),n=t.discountCodes.filter(i=>i.applicable).map(i=>i.code);u("begin_checkout",{currency:t.cost.totalAmount.currencyCode,value:f(e),coupon:n.join(",")||void 0,items:e})}var it={"product-ready":J,"list-ready":K,"cart-updated":tt,"cart-toggled":({open:t})=>{t&&et()},checkout:nt,search:({term:t})=>{t&&u("search",{search_term:t},"search_viewed",{searchTerm:t})}};function ot(t,e){it[e](t.detail)}function B(t){if(t.type==="astro:page-load"){b=new WeakSet,y?.publish("page_viewed",{});return}_.forEach(e=>{w(t,e)&&ot(t,e)})}async function ft(t){a.analytics?.shopify&&(y=await R(()=>M()!=null).catch(e=>(l(e,"shopify analytics"),null))),y?.publish("page_viewed",{}),t.splice(0).forEach(B),t.push=(...e)=>(e.forEach(B),t.length)}export{ft as startAnalytics};
@@ -1 +1 @@
1
- import{a as k,b as z,c as B}from"./chunk-56FCLJJD.js";import{a as g,c as y,f as l}from"./chunk-MPDWM2NN.js";import{D as _,E as J,r as D,v as U,x as W,y as Q,z as Y}from"./chunk-BFTZR4OB.js";import{E as K,F as C,H as w,K as F,M as q,a as H,l as u,m as c,n as s,o as P,p as N,q as A,t as d,w as O,y as I}from"./chunk-BA4LQJJQ.js";import{b as m,d as M,o as b,p as $,r as p,x as v,y as x,z as h}from"./chunk-E5YO6274.js";var j="url:",T=()=>`${c("collection")},${c("products")},${c("recommendations")}`,et=t=>t instanceof window.Element,G=t=>parseInt(t??"",10)||void 0,ot=t=>t==="COMPLEMENTARY"?"COMPLEMENTARY":"RELATED",V=class{constructor(e){m(this,"root");m(this,"products",[]);m(this,"pageInfo",null);m(this,"collection",null);m(this,"loadToken",0);this.root=e,l(e,"loading"),e.addEventListener("click",o=>{if(!et(o.target))return;let n=o.target.closest(c("load-more"));n?.closest(T())===e&&(o.preventDefault(),q(n,()=>this.load(!0)))})}$(e){return A(this.root,e,T())}options(){let{root:e}=this,o={reverse:s(e,"reverse")==="true"},n=G(s(e,"limit"));n&&(o.first=n);let r=s(e,"sort");if(r&&(o.sortKey=r),P(e,"collection"))return o.collection=s(e,"collection")??"",o;let i=s(e,"products")??"";return o.query=i.startsWith(j)?new URL(window.location.href).searchParams.get(i.slice(j.length))||"":i,o}async loadRecommendations(){let{key:e}=g(this.root,window.location,"recommendations"),o=this.root.closest(c("product"));if(!e&&o&&({key:e}=g(o)),!e)throw new H("No product for recommendations",{code:"NOT_FOUND"});return J(e,ot(s(this.root,"intent")))}async load(e=!1){this.loadToken+=1;let o=this.loadToken,n=()=>o!==this.loadToken;try{if(P(this.root,"recommendations")){let r=await this.loadRecommendations();if(n())return;let i=G(s(this.root,"limit"));this.products=i?r.slice(0,i):r}else{let r=await _({...this.options(),after:e?this.pageInfo?.endCursor??null:null});if(n())return;this.collection=r.collection,this.pageInfo=r.pageInfo,this.products=e?[...this.products,...r.products]:r.products}this.render(),l(this.root,"ready"),d("list-ready",{products:this.products,collection:this.collection},this.root)}catch(r){if(n())return;e||l(this.root,y(r)?"not-found":"error",r),y(r)&&P(this.root,"recommendations")||h(r,"list load failed"),d("error",{error:r,context:"list"},this.root)}}render(){let{collection:e}=this;this.$(c("collection-bind")).forEach(n=>{switch(s(n,"collection-bind")??""){case"title":C(n,e?.title??"");break;case"description":K(n,e?.descriptionHtml);break;case"image":O(n,e?.image?.url,e?.image?.altText||e?.title);break;case"count":C(n,this.products.length);break}}),this.$(c("list")).forEach(n=>{I(n,this.products,(r,i)=>{r.setAttribute(u("product"),i.handle),r.removeAttribute(u("state"))}),d("list-rendered",{container:n},this.root)});let o=this.products.length===0;this.$(c("show")).forEach(n=>{let r=s(n,"show");r==="list-empty"&&w(n,o),r==="list-filled"&&w(n,!o)}),this.$(c("load-more")).forEach(n=>{w(n,!!this.pageInfo?.hasNextPage)}),F("list")}};var rt='script[type="application/json"][data-tether-hydrate]',L=new WeakSet,Ht=new WeakSet,E=new Set,X=new Set,Z=new WeakMap;function nt(){E.forEach(t=>{t.isConnected||E.delete(t)}),X.forEach(t=>{t.root.isConnected||X.delete(t)})}function it(t,e){return[...t.matches?.(e)?[t]:[],...N(t,e)]}function st(t,e){let o=s(t,"page-title");!o||typeof document>"u"||(document.title=o.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function ct(t,{fromUrl:e,raw:o}){e?(L.add(t),l(t,"not-found"),d("product-not-found",{key:null,source:o},t)):t.closest(T())||x(`[${u("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t)}function at(t,e,{fromUrl:o,raw:n},r){let i=y(r);if(l(t,i?"not-found":"error",r),!i){h(r,`product ${e}`),d("error",{error:r,context:"product",key:e},t);return}d("product-not-found",{key:e,source:n},t),o?v(`product not found: ${e}`):h(r,`product ${e}`)}function ut(t){if(L.has(t))return!1;let{key:e,...o}=g(t);if(!e)return ct(t,o),!1;L.add(t),E.add(t);let n={};Z.set(t,n);let r=()=>Z.get(t)===n;return k.get(t)?t.setAttribute(u("state"),"updating"):l(t,"loading"),mt(U(e)).then(f=>{if(!r())return;let R=k.get(t);R?R.update(f):new B(t,f),st(t,f),p.revalidate&&Q(e)&&dt(e)}).catch(f=>{r()&&at(t,e,o,f)}),!0}function Nt(){nt(),E.forEach(t=>{t.getAttribute(u("state"))!=="error"||t.getAttribute(u("error"))==="not-found"||(L.delete(t),ut(t))})}var S=new Set;function dt(t){S.size||setTimeout(ft,0),S.add(t)}function lt(t,e){E.forEach(o=>{let n=k.get(o);if(!n||!o.isConnected)return;let r=g(o).key;r!==t&&r!==e.handle&&r!==e.id||JSON.stringify(n.product)!==JSON.stringify(e)&&n.update(e)})}function ft(){let t=[...S];S=new Set,t.forEach(e=>{Y(e).then(o=>{lt(e,o)}).catch(o=>{h(o,`refresh ${e}`)})})}var a=null,mt=t=>(a?.add(t),t);function pt(){if(!a)return;let t=[...a];Promise.allSettled(t).then(()=>{if(!(!a||t.some(e=>!a?.has(e)))){if(t.length!==a.size){pt();return}a=null,document.documentElement.classList.remove(`${p.prefix}-market-pending`)}})}function ht(t){if(!M(t))return{country:void 0,language:void 0,products:[]};let{products:e}=t,o=Array.isArray(e)?e:[];return{country:b(t.country)??void 0,language:$(t.language)??void 0,products:o.filter(D)}}var tt=new WeakSet;function At(t=document){it(t,rt).forEach(e=>{if(tt.has(e))return;tt.add(e);let o;try{o=JSON.parse(e.textContent)}catch(f){x("bad data-tether-hydrate",f);return}let{country:n,language:r,products:i}=ht(o);if(z(i),n===p.country&&r===p.language){W(i);return}v("hydration skipped: other market"),a||(a=new Set,document.documentElement.classList.add(`${p.prefix}-market-pending`))})}export{T as a,V as b,L as c,Ht as d,E as e,X as f,nt as g,it as h,ut as i,Nt as j,mt as k,pt as l,At as m};
1
+ import{a as k,b as z,c as B}from"./chunk-YN6LEBEN.js";import{a as g,c as y,f as l}from"./chunk-VFNHIGCS.js";import{D as _,E as J,r as D,v as U,x as W,y as Q,z as Y}from"./chunk-6TFMLT4A.js";import{F as K,G as C,I as w,L as F,N as q,a as H,m as u,n as c,o as s,p as P,q as N,r as A,u as d,x as O,z as I}from"./chunk-MQYB6BH4.js";import{b as m,d as M,o as b,p as $,r as p,x as v,y as x,z as h}from"./chunk-E5YO6274.js";var j="url:",T=()=>`${c("collection")},${c("products")},${c("recommendations")}`,et=t=>t instanceof window.Element,G=t=>parseInt(t??"",10)||void 0,ot=t=>t==="COMPLEMENTARY"?"COMPLEMENTARY":"RELATED",V=class{constructor(e){m(this,"root");m(this,"products",[]);m(this,"pageInfo",null);m(this,"collection",null);m(this,"loadToken",0);this.root=e,l(e,"loading"),e.addEventListener("click",o=>{if(!et(o.target))return;let n=o.target.closest(c("load-more"));n?.closest(T())===e&&(o.preventDefault(),q(n,()=>this.load(!0)))})}$(e){return A(this.root,e,T())}options(){let{root:e}=this,o={reverse:s(e,"reverse")==="true"},n=G(s(e,"limit"));n&&(o.first=n);let r=s(e,"sort");if(r&&(o.sortKey=r),P(e,"collection"))return o.collection=s(e,"collection")??"",o;let i=s(e,"products")??"";return o.query=i.startsWith(j)?new URL(window.location.href).searchParams.get(i.slice(j.length))||"":i,o}async loadRecommendations(){let{key:e}=g(this.root,window.location,"recommendations"),o=this.root.closest(c("product"));if(!e&&o&&({key:e}=g(o)),!e)throw new H("No product for recommendations",{code:"NOT_FOUND"});return J(e,ot(s(this.root,"intent")))}async load(e=!1){this.loadToken+=1;let o=this.loadToken,n=()=>o!==this.loadToken;try{if(P(this.root,"recommendations")){let r=await this.loadRecommendations();if(n())return;let i=G(s(this.root,"limit"));this.products=i?r.slice(0,i):r}else{let r=await _({...this.options(),after:e?this.pageInfo?.endCursor??null:null});if(n())return;this.collection=r.collection,this.pageInfo=r.pageInfo,this.products=e?[...this.products,...r.products]:r.products}this.render(),l(this.root,"ready"),d("list-ready",{products:this.products,collection:this.collection},this.root)}catch(r){if(n())return;e||l(this.root,y(r)?"not-found":"error",r),y(r)&&P(this.root,"recommendations")||h(r,"list load failed"),d("error",{error:r,context:"list"},this.root)}}render(){let{collection:e}=this;this.$(c("collection-bind")).forEach(n=>{switch(s(n,"collection-bind")??""){case"title":C(n,e?.title??"");break;case"description":K(n,e?.descriptionHtml);break;case"image":O(n,e?.image?.url,e?.image?.altText||e?.title);break;case"count":C(n,this.products.length);break}}),this.$(c("list")).forEach(n=>{I(n,this.products,(r,i)=>{r.setAttribute(u("product"),i.handle),r.removeAttribute(u("state"))}),d("list-rendered",{container:n},this.root)});let o=this.products.length===0;this.$(c("show")).forEach(n=>{let r=s(n,"show");r==="list-empty"&&w(n,o),r==="list-filled"&&w(n,!o)}),this.$(c("load-more")).forEach(n=>{w(n,!!this.pageInfo?.hasNextPage)}),F("list")}};var rt='script[type="application/json"][data-tether-hydrate]',L=new WeakSet,Ht=new WeakSet,E=new Set,X=new Set,Z=new WeakMap;function nt(){E.forEach(t=>{t.isConnected||E.delete(t)}),X.forEach(t=>{t.root.isConnected||X.delete(t)})}function it(t,e){return[...t.matches?.(e)?[t]:[],...N(t,e)]}function st(t,e){let o=s(t,"page-title");!o||typeof document>"u"||(document.title=o.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function ct(t,{fromUrl:e,raw:o}){e?(L.add(t),l(t,"not-found"),d("product-not-found",{key:null,source:o},t)):t.closest(T())||x(`[${u("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t)}function at(t,e,{fromUrl:o,raw:n},r){let i=y(r);if(l(t,i?"not-found":"error",r),!i){h(r,`product ${e}`),d("error",{error:r,context:"product",key:e},t);return}d("product-not-found",{key:e,source:n},t),o?v(`product not found: ${e}`):h(r,`product ${e}`)}function ut(t){if(L.has(t))return!1;let{key:e,...o}=g(t);if(!e)return ct(t,o),!1;L.add(t),E.add(t);let n={};Z.set(t,n);let r=()=>Z.get(t)===n;return k.get(t)?t.setAttribute(u("state"),"updating"):l(t,"loading"),mt(U(e)).then(f=>{if(!r())return;let R=k.get(t);R?R.update(f):new B(t,f),st(t,f),p.revalidate&&Q(e)&&dt(e)}).catch(f=>{r()&&at(t,e,o,f)}),!0}function Nt(){nt(),E.forEach(t=>{t.getAttribute(u("state"))!=="error"||t.getAttribute(u("error"))==="not-found"||(L.delete(t),ut(t))})}var S=new Set;function dt(t){S.size||setTimeout(ft,0),S.add(t)}function lt(t,e){E.forEach(o=>{let n=k.get(o);if(!n||!o.isConnected)return;let r=g(o).key;r!==t&&r!==e.handle&&r!==e.id||JSON.stringify(n.product)!==JSON.stringify(e)&&n.update(e)})}function ft(){let t=[...S];S=new Set,t.forEach(e=>{Y(e).then(o=>{lt(e,o)}).catch(o=>{h(o,`refresh ${e}`)})})}var a=null,mt=t=>(a?.add(t),t);function pt(){if(!a)return;let t=[...a];Promise.allSettled(t).then(()=>{if(!(!a||t.some(e=>!a?.has(e)))){if(t.length!==a.size){pt();return}a=null,document.documentElement.classList.remove(`${p.prefix}-market-pending`)}})}function ht(t){if(!M(t))return{country:void 0,language:void 0,products:[]};let{products:e}=t,o=Array.isArray(e)?e:[];return{country:b(t.country)??void 0,language:$(t.language)??void 0,products:o.filter(D)}}var tt=new WeakSet;function At(t=document){it(t,rt).forEach(e=>{if(tt.has(e))return;tt.add(e);let o;try{o=JSON.parse(e.textContent)}catch(f){x("bad data-tether-hydrate",f);return}let{country:n,language:r,products:i}=ht(o);if(z(i),n===p.country&&r===p.language){W(i);return}v("hydration skipped: other market"),a||(a=new Set,document.documentElement.classList.add(`${p.prefix}-market-pending`))})}export{T as a,V as b,L as c,Ht as d,E as e,X as f,nt as g,it as h,ut as i,Nt as j,mt as k,pt as l,At as m};
@@ -1,4 +1,4 @@
1
- import{a as b,b as h,c as y,d as v,h as $}from"./chunk-BA4LQJJQ.js";import{G as k,a as te,d as x,e as T,n as _,r as P,x as V}from"./chunk-E5YO6274.js";var de={};te(de,{GID:()=>Q,allPlans:()=>I,allocationFor:()=>M,findPlan:()=>ue,hasPlans:()=>oe,planAdjustment:()=>ce,planCheckoutCharge:()=>se,planPrice:()=>B,planSavings:()=>ae,plansForVariant:()=>le,toGid:()=>C});var re=/^(-?)(\d+)(?:\.(\d+))?$/;function G(e,n){let t=re.exec(e.trim());if(!t)return null;let[,r="",o="0",l=""]=t,u=BigInt(`${o}${l.padEnd(n,"0")}`);return r==="-"?-u:u}var L=e=>e.split(".")[1]?.length??0;function Fe(e,n){if(e==null||n==null)return!1;let t=Math.max(L(e.trim()),L(n.trim())),r=G(e,t),o=G(n,t);return r===null||o===null?!1:r>o}var q=2,U=new Map;function W(e){let n=U.get(e);if(n!==void 0)return n;let t=q;try{t=new Intl.NumberFormat("en",{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??q}catch{}return U.set(e,t),t}function N(e){return Math.round(parseFloat(e.amount)*10**W(e.currencyCode))}function K(e,n){let t=W(n);return{amount:(e/10**t).toFixed(t),currencyCode:n}}var ie=100;function C(e,n){let t=typeof e=="string"||typeof e=="number"?String(e).trim():"";return t?t.startsWith("gid://")?t:/^\d+$/.test(t)?`gid://shopify/${n}/${t}`:t:null}var Q={product:e=>C(e,"Product"),variant:e=>C(e,"ProductVariant"),sellingPlan:e=>C(e,"SellingPlan")};function I(e){return(e?.sellingPlanGroups?.nodes??[]).flatMap(t=>t.sellingPlans.nodes.map(r=>({...r,group:t})))}function oe(e){return I(e).length>0}function M(e,n){return!e||!n?null:(e.sellingPlanAllocations?.nodes??[]).find(r=>r.sellingPlan.id===n)??null}function le(e,n){return I(e).filter(t=>M(n,t.id))}function B(e,n){let t=M(e,n)?.priceAdjustments[0];return t?.perDeliveryPrice??t?.price??e?.price??null}function se(e,n){let t=M(e,n);return t?.checkoutChargeAmount??t?.priceAdjustments[0]?.price??e?.price??null}function ae(e,n){let t=B(e,n);if(!e||!t)return{amount:null,percentage:0};let r=parseFloat(e.price.amount),o=parseFloat(t.amount);if(!Number.isFinite(r)||!Number.isFinite(o)||r<=0||o>=r)return{amount:null,percentage:0};let l=N(e.price)-N(t);return{amount:K(l,e.price.currencyCode),percentage:Math.round((1-o/r)*ie)}}function ce(e){let n=e?.priceAdjustments[0]?.adjustmentValue;if(!n)return null;switch(n.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:n.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:n.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:n.price};default:return null}}function ue(e,n){if(!n)return null;let t=I(e),r=Q.sellingPlan(n),o=n.trim().toLowerCase();return t.find(l=>l.id===r)??t.find(l=>l.name.toLowerCase()===o)??t.find(l=>l.options.some(u=>u.value.toLowerCase()===o))??null}var i="amount currencyCode",H={inventory:!0},Y=e=>e.inventory?"quantityAvailable":"",g="url altText width height";function pe(e){let n=[];for(let r of e){let o=_(r);o&&n.push(o)}return n.length?`metafields(identifiers:[${n.map(({namespace:r,key:o})=>`{namespace: ${JSON.stringify(r)}, key: ${JSON.stringify(o)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${g}}}}}`:""}var ge=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${i}}}... on SellingPlanFixedPriceAdjustment{price{${i}}}}}`,me=` sellingPlan{id}checkoutChargeAmount{${i}}remainingBalanceChargeAmount{${i}}priceAdjustments{price{${i}}compareAtPrice{${i}}perDeliveryPrice{${i}}unitPrice{${i}}}`;function z(e=P,n=H){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${g}}images(first:${e.imagesFirst}){nodes{${g}}}options{name optionValues{name swatch{color image{previewImage{${g}}}}}}priceRange{minVariantPrice{${i}}maxVariantPrice{${i}}}compareAtPriceRange{minVariantPrice{${i}}maxVariantPrice{${i}}}${pe(e.metafields)} sellingPlanGroups(first:${e.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${e.sellingPlansFirst}){nodes{${ge}}}}}variants(first:${e.variantsFirst}){nodes{id title availableForSale currentlyNotInStock ${Y(n)} sku barcode selectedOptions{name value}image{${g}}price{${i}}compareAtPrice{${i}}unitPrice{${i}}sellingPlanAllocations(first:${e.sellingPlansFirst}){nodes{${me}}}}}}`}function De(e=H){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${i}}totalAmount{${i}}checkoutChargeAmount{${i}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${i}}subtotalAmount{${i}}amountPerQuantity{${i}}compareAtAmountPerQuantity{${i}}}discountAllocations{discountedAmount{${i}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${i}}priceAdjustments{price{${i}}compareAtPrice{${i}}perDeliveryPrice{${i}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping ${Y(e)} image{${g}}price{${i}}compareAtPrice{${i}}selectedOptions{name value}product{id title handle vendor featuredImage{${g}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function J(){return`
1
+ import{a as b,b as h,c as y,d as v,i as $}from"./chunk-MQYB6BH4.js";import{G as k,a as te,d as x,e as T,n as _,r as P,x as V}from"./chunk-E5YO6274.js";var de={};te(de,{GID:()=>Q,allPlans:()=>I,allocationFor:()=>M,findPlan:()=>ue,hasPlans:()=>oe,planAdjustment:()=>ce,planCheckoutCharge:()=>se,planPrice:()=>B,planSavings:()=>ae,plansForVariant:()=>le,toGid:()=>C});var re=/^(-?)(\d+)(?:\.(\d+))?$/;function G(e,n){let t=re.exec(e.trim());if(!t)return null;let[,r="",o="0",l=""]=t,u=BigInt(`${o}${l.padEnd(n,"0")}`);return r==="-"?-u:u}var L=e=>e.split(".")[1]?.length??0;function Fe(e,n){if(e==null||n==null)return!1;let t=Math.max(L(e.trim()),L(n.trim())),r=G(e,t),o=G(n,t);return r===null||o===null?!1:r>o}var q=2,U=new Map;function W(e){let n=U.get(e);if(n!==void 0)return n;let t=q;try{t=new Intl.NumberFormat("en",{style:"currency",currency:e}).resolvedOptions().maximumFractionDigits??q}catch{}return U.set(e,t),t}function O(e){return Math.round(parseFloat(e.amount)*10**W(e.currencyCode))}function K(e,n){let t=W(n);return{amount:(e/10**t).toFixed(t),currencyCode:n}}var ie=100;function C(e,n){let t=typeof e=="string"||typeof e=="number"?String(e).trim():"";return t?t.startsWith("gid://")?t:/^\d+$/.test(t)?`gid://shopify/${n}/${t}`:t:null}var Q={product:e=>C(e,"Product"),variant:e=>C(e,"ProductVariant"),sellingPlan:e=>C(e,"SellingPlan")};function I(e){return(e?.sellingPlanGroups?.nodes??[]).flatMap(t=>t.sellingPlans.nodes.map(r=>({...r,group:t})))}function oe(e){return I(e).length>0}function M(e,n){return!e||!n?null:(e.sellingPlanAllocations?.nodes??[]).find(r=>r.sellingPlan.id===n)??null}function le(e,n){return I(e).filter(t=>M(n,t.id))}function B(e,n){let t=M(e,n)?.priceAdjustments[0];return t?.perDeliveryPrice??t?.price??e?.price??null}function se(e,n){let t=M(e,n);return t?.checkoutChargeAmount??t?.priceAdjustments[0]?.price??e?.price??null}function ae(e,n){let t=B(e,n);if(!e||!t)return{amount:null,percentage:0};let r=parseFloat(e.price.amount),o=parseFloat(t.amount);if(!Number.isFinite(r)||!Number.isFinite(o)||r<=0||o>=r)return{amount:null,percentage:0};let l=O(e.price)-O(t);return{amount:K(l,e.price.currencyCode),percentage:Math.round((1-o/r)*ie)}}function ce(e){let n=e?.priceAdjustments[0]?.adjustmentValue;if(!n)return null;switch(n.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:n.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:n.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:n.price};default:return null}}function ue(e,n){if(!n)return null;let t=I(e),r=Q.sellingPlan(n),o=n.trim().toLowerCase();return t.find(l=>l.id===r)??t.find(l=>l.name.toLowerCase()===o)??t.find(l=>l.options.some(u=>u.value.toLowerCase()===o))??null}var i="amount currencyCode",H={inventory:!0},Y=e=>e.inventory?"quantityAvailable":"",g="url altText width height";function pe(e){let n=[];for(let r of e){let o=_(r);o&&n.push(o)}return n.length?`metafields(identifiers:[${n.map(({namespace:r,key:o})=>`{namespace: ${JSON.stringify(r)}, key: ${JSON.stringify(o)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${g}}}}}`:""}var ge=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${i}}}... on SellingPlanFixedPriceAdjustment{price{${i}}}}}`,me=` sellingPlan{id}checkoutChargeAmount{${i}}remainingBalanceChargeAmount{${i}}priceAdjustments{price{${i}}compareAtPrice{${i}}perDeliveryPrice{${i}}unitPrice{${i}}}`;function z(e=P,n=H){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${g}}images(first:${e.imagesFirst}){nodes{${g}}}options{name optionValues{name swatch{color image{previewImage{${g}}}}}}priceRange{minVariantPrice{${i}}maxVariantPrice{${i}}}compareAtPriceRange{minVariantPrice{${i}}maxVariantPrice{${i}}}${pe(e.metafields)} sellingPlanGroups(first:${e.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${e.sellingPlansFirst}){nodes{${ge}}}}}variants(first:${e.variantsFirst}){nodes{id title availableForSale currentlyNotInStock ${Y(n)} sku barcode selectedOptions{name value}image{${g}}price{${i}}compareAtPrice{${i}}unitPrice{${i}}sellingPlanAllocations(first:${e.sellingPlansFirst}){nodes{${me}}}}}}`}function Ne(e=H){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${i}}totalAmount{${i}}checkoutChargeAmount{${i}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${i}}subtotalAmount{${i}}amountPerQuantity{${i}}compareAtAmountPerQuantity{${i}}}discountAllocations{discountedAmount{${i}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${i}}priceAdjustments{price{${i}}compareAtPrice{${i}}perDeliveryPrice{${i}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping ${Y(e)} image{${g}}price{${i}}compareAtPrice{${i}}selectedOptions{name value}product{id title handle vendor featuredImage{${g}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function J(){return`
2
2
  id handle title description descriptionHtml
3
3
  image { ${g} }
4
- seo { title description }`}var D={amount:"string",currencyCode:"string"},f={id:"string",handle:"string",title:"string",options:["object"],images:{nodes:["object"]},priceRange:{minVariantPrice:D,maxVariantPrice:D},variants:{nodes:[{id:"string",price:D,selectedOptions:["object"]}]}},O={nodes:[f],pageInfo:{hasNextPage:"boolean"}},_e=e=>T(e,"id")!==""&&T(e,"handle")!==""&&h(e,f),X=e=>x(e)&&(e.id===void 0||h(e,f));var fe=1e4,Pe=6e4,c=new Map,E=new Map,m=new Set,F=new Map,ne=[],R=!1,A=0,Z=e=>e.startsWith("gid://"),j=k;function S(e){if(!e)return;let n=Promise.resolve(e);c.set(e.handle,n),c.set(e.id,n)}function he(e){let n=j(e);if(!n)return Promise.reject(new b("empty product key",{code:"NOT_FOUND"}));let t=c.get(n);if(t)return t;let r=new Promise((o,l)=>{E.set(n,{resolve:o,reject:l}),ne.push(n),R||(R=!0,setTimeout(()=>void Se(),0))});return c.set(n,r),r}var w=e=>n=>`${e}${z(P,n)}`;function ye(e){let n=e.filter(Z),t=e.filter(p=>!Z(p)),r=[],o=[],l={};return n.length&&(r.push("$ids: [ID!]!"),l.ids=n,o.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),t.forEach((p,s)=>{r.push(`$h${s}: String!`),l[`h${s}`]=p,o.push(`h${s}: product(handle: $h${s}) { ...TetherProduct }`)}),{query:w(`query TetherProducts(${r.join(",")}){${o.join(" ")}}`),variables:l,handles:t}}function ee(e,n){let t=E.get(e);E.delete(e),t&&n(t)}function $e(e,n){if(n!==A)return;let t=c.get(e);setTimeout(()=>{c.get(e)===t&&c.delete(e)},fe)}function Ae(e){if(!x(e))return!1;let{byId:n=[],...t}=e;return h(n,[y(X)])&&Object.values(t).every(y(f))}async function Se(){R=!1;let e=A,n=ne.splice(0);if(!n.length)return;let{query:t,variables:r,handles:o}=ye(n);V("fetch products",n);let l;try{l=await $(t,r,Ae)}catch(s){n.forEach(d=>{ee(d,a=>{e===A&&c.delete(d),a.reject(s)})});return}let u=new Map;for(let s of l.byId??[])s?.id&&u.set(s.id,s);o.forEach((s,d)=>{let a=l[`h${d}`];a&&u.set(s,a)});let p=Date.now();n.forEach(s=>{ee(s,d=>{let a=u.get(s);if(!a){$e(s,e),d.reject(new b(`Product not found: ${s}`,{code:"NOT_FOUND"}));return}e===A&&(S(a),F.set(a.handle,p),F.set(a.id,p)),d.resolve(a)})})}function Ke(){c.clear(),A+=1,m.clear(),F.clear()}function Qe(e){for(let n of e??[])!n.id||!n.handle||Date.now()-(F.get(n.handle)??0)<Pe&&c.has(n.handle)||(S(n),m.add(n.handle),m.add(n.id))}function Be(e){let n=j(e);return!n||!m.has(n)?!1:(m.delete(n),c.get(n)?.then(t=>{m.delete(t.handle),m.delete(t.id)},xe),!0)}function xe(){}function He(e){let n=j(e);return n&&c.delete(n),he(e)}var be=v({collection:y({handle:"string",products:O})}),ve=v({products:O}),Ce=v({productRecommendations:y([f])}),Ie=`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${J()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,Me="query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}";async function Ye({collection:e,query:n,first:t=P.collectionFirst,after:r=null,sortKey:o,reverse:l=!1,filters:u}={}){if(e){let s=await $(w(Ie),{handle:e,first:t,after:r,sortKey:o||void 0,reverse:l,filters:u??void 0},be);if(!s.collection)throw new b(`Collection not found: ${e}`,{code:"NOT_FOUND"});let{products:d,...a}=s.collection;return d.nodes.forEach(S),{collection:a,products:d.nodes,pageInfo:d.pageInfo}}let p=await $(w(Me),{first:t,after:r,query:n||void 0,sortKey:o||void 0,reverse:l},ve);return p.products.nodes.forEach(S),{collection:null,products:p.products.nodes,pageInfo:p.products.pageInfo}}async function ze(e,n="RELATED"){let t=j(typeof e=="object"?e?.id:e),r=t?.startsWith("gid://")??!1,l=(await $(w(`query TetherRecs(${r?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${r?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`),r?{id:t,intent:n}:{handle:t,intent:n},Ce)).productRecommendations??[];return l.forEach(S),l}export{z as a,De as b,J as c,Fe as d,N as e,K as f,Q as g,I as h,M as i,B as j,se as k,ae as l,ce as m,ue as n,de as o,D as p,f as q,_e as r,X as s,j as t,S as u,he as v,Ke as w,Qe as x,Be as y,He as z,be as A,ve as B,Ce as C,Ye as D,ze as E};
4
+ seo { title description }`}var N={amount:"string",currencyCode:"string"},f={id:"string",handle:"string",title:"string",options:["object"],images:{nodes:["object"]},priceRange:{minVariantPrice:N,maxVariantPrice:N},variants:{nodes:[{id:"string",price:N,selectedOptions:["object"]}]}},D={nodes:[f],pageInfo:{hasNextPage:"boolean"}},_e=e=>T(e,"id")!==""&&T(e,"handle")!==""&&h(e,f),X=e=>x(e)&&(e.id===void 0||h(e,f));var fe=1e4,Pe=6e4,c=new Map,E=new Map,m=new Set,F=new Map,ne=[],R=!1,A=0,Z=e=>e.startsWith("gid://"),j=k;function S(e){if(!e)return;let n=Promise.resolve(e);c.set(e.handle,n),c.set(e.id,n)}function he(e){let n=j(e);if(!n)return Promise.reject(new b("empty product key",{code:"NOT_FOUND"}));let t=c.get(n);if(t)return t;let r=new Promise((o,l)=>{E.set(n,{resolve:o,reject:l}),ne.push(n),R||(R=!0,setTimeout(()=>void Se(),0))});return c.set(n,r),r}var w=e=>n=>`${e}${z(P,n)}`;function ye(e){let n=e.filter(Z),t=e.filter(p=>!Z(p)),r=[],o=[],l={};return n.length&&(r.push("$ids: [ID!]!"),l.ids=n,o.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),t.forEach((p,s)=>{r.push(`$h${s}: String!`),l[`h${s}`]=p,o.push(`h${s}: product(handle: $h${s}) { ...TetherProduct }`)}),{query:w(`query TetherProducts(${r.join(",")}){${o.join(" ")}}`),variables:l,handles:t}}function ee(e,n){let t=E.get(e);E.delete(e),t&&n(t)}function $e(e,n){if(n!==A)return;let t=c.get(e);setTimeout(()=>{c.get(e)===t&&c.delete(e)},fe)}function Ae(e){if(!x(e))return!1;let{byId:n=[],...t}=e;return h(n,[y(X)])&&Object.values(t).every(y(f))}async function Se(){R=!1;let e=A,n=ne.splice(0);if(!n.length)return;let{query:t,variables:r,handles:o}=ye(n);V("fetch products",n);let l;try{l=await $(t,r,Ae)}catch(s){n.forEach(d=>{ee(d,a=>{e===A&&c.delete(d),a.reject(s)})});return}let u=new Map;for(let s of l.byId??[])s?.id&&u.set(s.id,s);o.forEach((s,d)=>{let a=l[`h${d}`];a&&u.set(s,a)});let p=Date.now();n.forEach(s=>{ee(s,d=>{let a=u.get(s);if(!a){$e(s,e),d.reject(new b(`Product not found: ${s}`,{code:"NOT_FOUND"}));return}e===A&&(S(a),F.set(a.handle,p),F.set(a.id,p)),d.resolve(a)})})}function Ke(){c.clear(),A+=1,m.clear(),F.clear()}function Qe(e){for(let n of e??[])!n.id||!n.handle||Date.now()-(F.get(n.handle)??0)<Pe&&c.has(n.handle)||(S(n),m.add(n.handle),m.add(n.id))}function Be(e){let n=j(e);return!n||!m.has(n)?!1:(m.delete(n),c.get(n)?.then(t=>{m.delete(t.handle),m.delete(t.id)},xe),!0)}function xe(){}function He(e){let n=j(e);return n&&c.delete(n),he(e)}var be=v({collection:y({handle:"string",products:D})}),ve=v({products:D}),Ce=v({productRecommendations:y([f])}),Ie=`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${J()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}`,Me="query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}";async function Ye({collection:e,query:n,first:t=P.collectionFirst,after:r=null,sortKey:o,reverse:l=!1,filters:u}={}){if(e){let s=await $(w(Ie),{handle:e,first:t,after:r,sortKey:o||void 0,reverse:l,filters:u??void 0},be);if(!s.collection)throw new b(`Collection not found: ${e}`,{code:"NOT_FOUND"});let{products:d,...a}=s.collection;return d.nodes.forEach(S),{collection:a,products:d.nodes,pageInfo:d.pageInfo}}let p=await $(w(Me),{first:t,after:r,query:n||void 0,sortKey:o||void 0,reverse:l},ve);return p.products.nodes.forEach(S),{collection:null,products:p.products.nodes,pageInfo:p.products.pageInfo}}async function ze(e,n="RELATED"){let t=j(typeof e=="object"?e?.id:e),r=t?.startsWith("gid://")??!1,l=(await $(w(`query TetherRecs(${r?"$id: ID!":"$handle: String!"},$intent:ProductRecommendationIntent){productRecommendations(${r?"productId: $id":"productHandle: $handle"},intent:$intent){...TetherProduct}}`),r?{id:t,intent:n}:{handle:t,intent:n},Ce)).productRecommendations??[];return l.forEach(S),l}export{z as a,Ne as b,J as c,Fe as d,O as e,K as f,Q as g,I as h,M as i,B as j,se as k,ae as l,ce as m,ue as n,de as o,N as p,f as q,_e as r,X as s,j as t,S as u,he as v,Ke as w,Qe as x,Be as y,He as z,be as A,ve as B,Ce as C,Ye as D,ze as E};
@@ -1 +1 @@
1
- import{e as P,f,g as x,h as v,i as d,j as g,k as A,l as y,m as I,n as h}from"./chunk-BFTZR4OB.js";var M=100,V=(n,e)=>f(P(n)*e,n.currencyCode),S=n=>Object.fromEntries(n.selectedOptions.map(e=>[e.name,e.value]));function w(n,e){return n.variants.nodes.find(o=>o.selectedOptions.every(r=>e[r.name]===r.value))??null}function T(n,e,o,r){return n.variants.nodes.some(t=>t.availableForSale&&t.selectedOptions.every(i=>i.name===o?i.value===r:e[i.name]===i.value))}var k=n=>n.kind==="subscription"?n.planId:n.offeredPlanId;function F(n,e){return n.kind==="subscription"&&d(e,n.planId)?n:{kind:"one-time"}}function C(n,e,o,r){let t=v(n),i=t.find(s=>s.id===r)??t[0];if(!i)return{kind:"one-time",offeredPlanId:null};let a=d(e,i.id)?i:t.find(s=>d(e,s.id))??i;return n.requiresSellingPlan||o==="subscription"?{kind:"subscription",planId:a.id}:{kind:"one-time",offeredPlanId:a.id}}function B(n,{variant:e,sellingPlan:o,defaultPlan:r,defaultPurchase:t}){let i=n.variants.nodes,a=x.variant(e),s=i.find(l=>l.id===a)??i.find(l=>l.availableForSale)??i[0]??null,c=h(n,o),p=c??h(n,r),m=c||t==="subscription"?"subscription":"one-time";return{selected:s?S(s):{},purchase:C(n,s,m,p?.id??null)}}function j(n,e,o,r,t){let i=n.quantityAvailable,a=i!=null&&i>0&&i<=e,s=r.compareAtPrice!==null,c=r.line.kind==="subscription";return{"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":s,"not-on-sale":!s,"has-variants":o>1,"single-variant":o===1,"low-stock":a,"plenty-in-stock":n.availableForSale&&!a,"subscription-available":r.subscriptionAvailable,"subscription-unavailable":!r.subscriptionAvailable,"subscription-only":t,"one-time-available":!t,"subscription-selected":c,"one-time-selected":!c,"has-savings":c?r.savings.percentage>0:s}}function R(n,e,o){let r=w(n,e.selected),t=r??n.variants.nodes[0];if(!t)return null;let i=C(n,t,e.purchase.kind,k(e.purchase)),a=k(i),s=v(n),c=F(i,t),p=c.kind==="subscription"?d(t,c.planId):null,m=p?g(t,a)??t.price:t.price,l=p?.priceAdjustments[0]?.compareAtPrice??t.compareAtPrice,b={line:c,subscriptionAvailable:s.some(u=>d(t,u.id)),compareAtPrice:l&&parseFloat(l.amount)>parseFloat(m.amount)?l:null,savings:y(t,a)};return{...b,variant:t,selected:r?e.selected:S(t),purchase:i,plan:s.find(u=>u.id===a)??null,quantity:e.quantity,price:m,show:j(t,o,n.variants.nodes.length,b,n.requiresSellingPlan)}}function G(n,e){let{variant:o,plan:r,price:t,compareAtPrice:i,quantity:a}=n,s=k(n.purchase),c=u=>V(u,Math.max(1,a)),b={price:()=>e.money(t),"total-price":()=>e.money(c(t)),"one-time-price":()=>e.money(o.price),"subscription-price":()=>e.money(s?g(o,s):null),"subscription-savings":()=>e.percent(n.savings.percentage),"subscription-savings-amount":()=>e.money(n.savings.amount),"checkout-charge":()=>{let u=n.line.kind==="subscription"?A(o,s)??t:t;return e.money(c(u))},"plan-name":()=>r?.name,"plan-description":()=>r?.description,"plan-group":()=>r?.group.name,"compare-at-price":()=>e.money(i),"unit-price":()=>e.money(o.unitPrice),"discount-percentage":()=>i?`${Math.round((1-parseFloat(t.amount)/parseFloat(i.amount))*M)}%`:"0%","discount-amount":()=>i?e.money(f(P(i)-P(t),t.currencyCode)):"","variant-title":()=>o.title,"variant-id":()=>o.id,sku:()=>o.sku,barcode:()=>o.barcode,stock:()=>o.quantityAvailable,quantity:()=>a};return new Map(Object.entries(b))}function E(n,e,o,r){let i={name:()=>o?.name,option:()=>(o?.options??[]).map(a=>a.value).join(", "),description:()=>o?.description,price:()=>r.money(g(n,e)),savings:()=>r.percent(y(n,e).percentage),"savings-amount":()=>r.money(y(n,e).amount),adjustment:()=>{let a=I(o);return a?a.type==="percentage"?`${a.value}%`:r.money(a.value):""}};return new Map(Object.entries(i))}export{S as a,T as b,k as c,F as d,C as e,B as f,R as g,G as h,E as i};
1
+ import{e as P,f,g as x,h as v,i as d,j as g,k as A,l as y,m as I,n as h}from"./chunk-6TFMLT4A.js";var M=100,V=(n,e)=>f(P(n)*e,n.currencyCode),S=n=>Object.fromEntries(n.selectedOptions.map(e=>[e.name,e.value]));function w(n,e){return n.variants.nodes.find(o=>o.selectedOptions.every(r=>e[r.name]===r.value))??null}function T(n,e,o,r){return n.variants.nodes.some(t=>t.availableForSale&&t.selectedOptions.every(i=>i.name===o?i.value===r:e[i.name]===i.value))}var k=n=>n.kind==="subscription"?n.planId:n.offeredPlanId;function F(n,e){return n.kind==="subscription"&&d(e,n.planId)?n:{kind:"one-time"}}function C(n,e,o,r){let t=v(n),i=t.find(s=>s.id===r)??t[0];if(!i)return{kind:"one-time",offeredPlanId:null};let a=d(e,i.id)?i:t.find(s=>d(e,s.id))??i;return n.requiresSellingPlan||o==="subscription"?{kind:"subscription",planId:a.id}:{kind:"one-time",offeredPlanId:a.id}}function B(n,{variant:e,sellingPlan:o,defaultPlan:r,defaultPurchase:t}){let i=n.variants.nodes,a=x.variant(e),s=i.find(l=>l.id===a)??i.find(l=>l.availableForSale)??i[0]??null,c=h(n,o),p=c??h(n,r),m=c||t==="subscription"?"subscription":"one-time";return{selected:s?S(s):{},purchase:C(n,s,m,p?.id??null)}}function j(n,e,o,r,t){let i=n.quantityAvailable,a=i!=null&&i>0&&i<=e,s=r.compareAtPrice!==null,c=r.line.kind==="subscription";return{"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":s,"not-on-sale":!s,"has-variants":o>1,"single-variant":o===1,"low-stock":a,"plenty-in-stock":n.availableForSale&&!a,"subscription-available":r.subscriptionAvailable,"subscription-unavailable":!r.subscriptionAvailable,"subscription-only":t,"one-time-available":!t,"subscription-selected":c,"one-time-selected":!c,"has-savings":c?r.savings.percentage>0:s}}function R(n,e,o){let r=w(n,e.selected),t=r??n.variants.nodes[0];if(!t)return null;let i=C(n,t,e.purchase.kind,k(e.purchase)),a=k(i),s=v(n),c=F(i,t),p=c.kind==="subscription"?d(t,c.planId):null,m=p?g(t,a)??t.price:t.price,l=p?.priceAdjustments[0]?.compareAtPrice??t.compareAtPrice,b={line:c,subscriptionAvailable:s.some(u=>d(t,u.id)),compareAtPrice:l&&parseFloat(l.amount)>parseFloat(m.amount)?l:null,savings:y(t,a)};return{...b,variant:t,selected:r?e.selected:S(t),purchase:i,plan:s.find(u=>u.id===a)??null,quantity:e.quantity,price:m,show:j(t,o,n.variants.nodes.length,b,n.requiresSellingPlan)}}function G(n,e){let{variant:o,plan:r,price:t,compareAtPrice:i,quantity:a}=n,s=k(n.purchase),c=u=>V(u,Math.max(1,a)),b={price:()=>e.money(t),"total-price":()=>e.money(c(t)),"one-time-price":()=>e.money(o.price),"subscription-price":()=>e.money(s?g(o,s):null),"subscription-savings":()=>e.percent(n.savings.percentage),"subscription-savings-amount":()=>e.money(n.savings.amount),"checkout-charge":()=>{let u=n.line.kind==="subscription"?A(o,s)??t:t;return e.money(c(u))},"plan-name":()=>r?.name,"plan-description":()=>r?.description,"plan-group":()=>r?.group.name,"compare-at-price":()=>e.money(i),"unit-price":()=>e.money(o.unitPrice),"discount-percentage":()=>i?`${Math.round((1-parseFloat(t.amount)/parseFloat(i.amount))*M)}%`:"0%","discount-amount":()=>i?e.money(f(P(i)-P(t),t.currencyCode)):"","variant-title":()=>o.title,"variant-id":()=>o.id,sku:()=>o.sku,barcode:()=>o.barcode,stock:()=>o.quantityAvailable,quantity:()=>a};return new Map(Object.entries(b))}function E(n,e,o,r){let i={name:()=>o?.name,option:()=>(o?.options??[]).map(a=>a.value).join(", "),description:()=>o?.description,price:()=>r.money(g(n,e)),savings:()=>r.percent(y(n,e).percentage),"savings-amount":()=>r.money(y(n,e).amount),adjustment:()=>{let a=I(o);return a?a.type==="percentage"?`${a.value}%`:r.money(a.value):""}};return new Map(Object.entries(i))}export{S as a,T as b,k as c,F as d,C as e,B as f,R as g,G as h,E as i};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-RPMBCAGS.js";import{a as o}from"./chunk-Z6HS3H7K.js";import{o as u,p as i,r as n,x as c,z as g}from"./chunk-E5YO6274.js";var f={country:void 0,language:void 0,locale:void 0},l=!1;function d(){let t=e=>document.querySelector(`meta[name="${n.prefix}-page-${e}"]`)?.getAttribute("content")||void 0,r=u(t("country"));return r?{country:r,language:i(t("language"))??void 0,locale:t("locale")}:null}async function m(){let t=n.markets??{};if(t.detect===!1)return null;if(!t.detect)return t.remember===!1?null:a();try{return(await o("markets")).detectMarket(t)}catch(r){return g(r,"markets"),null}}async function C(t){f={country:n.country,language:n.language,locale:n.locale};let r=d();if(l=r!==null,r){n.country=r.country,n.language=r.language,r.locale&&(n.locale=r.locale);return}let e=await m();e&&(e.country&&(n.country=e.country),e.language&&(n.language=e.language),e.locale&&!t.locale&&(n.locale=e.locale),c("market",e))}var s=(t,r)=>(t??"").toUpperCase()===(r??"").toUpperCase();function P(){let t=d(),r=t===null&&l;l=t!==null;let e=t??(r?a()??f:null);return!e?.country||s(e.country,n.country)&&s(e.language,n.language)?null:{country:e.country,language:e.language,locale:e.locale}}function S(t,r){return o("markets").then(e=>e.setCountry(t,r))}export{C as a,P as b,S as c};
@@ -0,0 +1 @@
1
+ import{b as Y,d as Ct,g as q,h as bt,p as E,v as wt}from"./chunk-6TFMLT4A.js";import{A as gt,B as yt,D as x,G,H as S,I as N,L as ht,Q as M,a as g,c as $,d as R,i as F,l as dt,m as W,n as s,o as w,q as l,u as m,x as pt,z as mt}from"./chunk-MQYB6BH4.js";import{C as ft,r as a,x as lt,z as C}from"./chunk-E5YO6274.js";var Gt={id:"string",quantity:"number",attributes:["object"],cost:{totalAmount:E,subtotalAmount:E,amountPerQuantity:E},merchandise:{id:"string",selectedOptions:["object"],product:"object"}},X={id:"string",checkoutUrl:"string",totalQuantity:"number",attributes:["object"],discountCodes:["object"],cost:{totalAmount:E,subtotalAmount:E},lines:{nodes:[Gt]}};var Yt='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Xt=60,z=!1,_=null,zt=t=>t!==null&&"focus"in t,St=t=>l(t,Yt).filter(n=>n.offsetParent!==null||n===document.activeElement),P=()=>l(document,s("cart-drawer")),J=t=>t.classList.contains(a.cartDrawerOpenClass);function y(){let t=P();return t.length?t.some(J):z}function K(t){l(document,s("cart-open")).forEach(n=>{n.setAttribute("aria-expanded",String(t))}),P().forEach(n=>{n.hasAttribute("role")||n.setAttribute("role","dialog"),!n.hasAttribute("aria-label")&&!n.hasAttribute("aria-labelledby")&&n.setAttribute("aria-label",w(n,"cart-label")||"Cart"),n.setAttribute("aria-modal",String(t)),!J(n)&&(n.setAttribute("aria-hidden","true"),a.cartFocus&&(n.inert=!0))})}function Jt(t){let n=St(t)[0]??t;n===t&&!t.hasAttribute("tabindex")&&(t.tabIndex=-1),n.focus({preventScroll:!0})}function V(){if(y())return;z=!0;let t=P().filter(e=>w(e,"cart-drawer")!=="manual");t.forEach(e=>{e.inert=!1,e.classList.add(a.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),K(!0);let[n]=t;a.cartFocus&&n&&(_=zt(document.activeElement)?document.activeElement:null,setTimeout(()=>{Jt(n)},Xt)),a.onCartOpen?.(t),m("cart-toggled",{open:!0})}function Z(){if(!y())return;z=!1;let t=P(),n=t.some(e=>e.contains(document.activeElement));t.forEach(e=>{e.classList.remove(a.cartDrawerOpenClass),e.setAttribute("aria-hidden","true"),a.cartFocus&&(e.inert=!0)}),K(!1),n&&_?.isConnected&&_.focus({preventScroll:!0}),_=null,a.onCartClose?.(t),m("cart-toggled",{open:!1})}function vt(){y()?Z():V()}function Zt(t){if(t.key!=="Tab"||!a.cartFocus||!y())return;let n=P().find(J);if(!n)return;let e=St(n),r=e[0],i=e.at(-1);if(!r||!i)return;let o=document.activeElement,u=t.shiftKey?o===r:o===i;n.contains(o)&&!u||(t.preventDefault(),(t.shiftKey?i:r).focus())}var At="Default Title",tt=(t,n)=>n.get(t.id)?.quantity??t.quantity,kt=t=>t.split("/").pop()??t;function tn(t){let n=t.merchandise,e=yt(n.product.handle,n.product.id);if(!e)return null;let r=new URLSearchParams;r.set("variant",kt(n.id));let i=t.sellingPlanAllocation?.sellingPlan.id;return i&&r.set("selling_plan",kt(i)),`${e}${e.includes("?")?"&":"?"}${r.toString()}`}var Lt=t=>t.merchandise.product.title,Pt={title:Lt,"product-title":Lt,"variant-title":t=>t.merchandise.title===At?"":t.merchandise.title,options:t=>t.merchandise.selectedOptions.filter(n=>n.value!==At).map(n=>`${n.name}: ${n.value}`).join(", "),vendor:t=>t.merchandise.product.vendor,sku:t=>t.merchandise.sku??"",price:t=>x(t.cost.amountPerQuantity),"compare-at-price":t=>x(t.cost.compareAtAmountPerQuantity??t.merchandise.compareAtPrice),"line-total":t=>x(t.cost.totalAmount),"line-subtotal":t=>x(t.cost.subtotalAmount),quantity:(t,n)=>tt(t,n.pending),plan:t=>t.sellingPlanAllocation?.sellingPlan.name??"","plan-description":t=>t.sellingPlanAllocation?.sellingPlan.description??"",components:t=>(t.lineComponents??[]).map(n=>`${n.quantity} \xD7 ${n.merchandise.product.title}`).join(", ")},It="attribute:";function nn(t,n,e){if(Object.hasOwn(Pt,n))return Pt[n]?.(t,e);if(!n.startsWith(It))return;let r=n.slice(It.length);return t.attributes.find(i=>i.key===r)?.value??""}function en(t,n,e){let r=bt(e),i=!e.requiresSellingPlan&&w(t,"line-plan")!=="subscription-only",o={value:"",label:t.getAttribute(W("one-time-label"))||"One-time purchase"},u=[...i?[o]:[],...r.map(f=>({value:f.id,label:f.name}))],c=u.map(f=>f.value).join("|");t.dataset.tetherSig!==c&&(t.replaceChildren(...u.map(f=>{let b=document.createElement("option");return b.value=f.value,b.textContent=f.label,b})),t.dataset.tetherSig=c),t.value=n.sellingPlanAllocation?.sellingPlan.id??"",N(t,r.length>0)}function rn(t,n,e){let r=!!n.sellingPlanAllocation;t.classList.toggle("is-subscription",r);let i=e.warnings.find(c=>c.target===n.id);t.classList.toggle("is-warning",!!i);let o=e.pending.has(n.id);t.classList.toggle("is-busy",o),o?t.setAttribute("aria-busy","true"):t.removeAttribute("aria-busy"),l(t,s("line","warning")).forEach(c=>{S(c,i?.message??"")});let u=new Map([["subscription",r],["one-time",!r],["on-sale",Ct(n.cost.compareAtAmountPerQuantity?.amount,n.cost.amountPerQuantity.amount)],["has-components",(n.lineComponents??[]).length>0],["warning",!!i]]);l(t,s("line-show")).forEach(c=>{let f=w(c,"line-show"),b=f===null?void 0:u.get(f);b!==void 0&&N(c,b)})}function on(t,n,e){let r=n.merchandise;t.setAttribute(W("line-id"),n.id),l(t,s("line")).forEach(i=>{let o=w(i,"line")??"";if(o==="image"){pt(i,r.image?.url??r.product.featuredImage?.url,r.product.title);return}if(o==="url"){let c=tn(n);c&&i.setAttribute("href",c);return}let u=nn(n,o,e);u!==void 0&&S(i,u)}),rn(t,n,e),l(t,`select${s("line-plan")}`).forEach(i=>{wt(r.product.handle).then(o=>{en(i,n,o)}).catch(o=>{C(o,"line plan options")})})}function an(t,n){let e=t?.totalQuantity??0,r=(t?.lines.nodes??[]).some(o=>o.sellingPlanAllocation),i=new Map([["cart-empty",e===0],["cart-filled",e>0],["cart-has-subscription",r],["cart-no-subscription",!r],["cart-has-discount",(t?.discountCodes??[]).some(o=>o.applicable)],["cart-error",n.failed],["cart-warning",n.warnings.length>0]]);l(document,s("show")).forEach(o=>{let u=w(o,"show"),c=u===null?void 0:i.get(u);c===void 0||o.closest(s("product"))||N(o,c)}),l(document,s("checkout")).forEach(o=>{o.classList.toggle("is-disabled",!e),o.setAttribute("aria-disabled",String(!e))})}function sn(t){l(document,`textarea${s("cart-note")},input${s("cart-note")}`).forEach(n=>{document.activeElement!==n&&G(n,t?.note??"")}),l(document,s("cart-discounts")).forEach(n=>{mt(n,t?.discountCodes??[],(e,r)=>{e.setAttribute(W("discount-code"),r.code);let i=e.querySelector(s("discount","code"))??(e.firstElementChild?null:e);i&&G(i,r.code),e.classList.toggle("is-inapplicable",!r.applicable)})})}function xt(t){let{cart:n}=t,e=r=>n?x(n.cost[r]):"";K(y()),l(document,s("cart-count")).forEach(r=>{S(r,n?.totalQuantity??0)}),l(document,s("cart-subtotal")).forEach(r=>{S(r,e("subtotalAmount"))}),l(document,s("cart-total")).forEach(r=>{S(r,e("totalAmount"))}),l(document,s("cart-checkout-charge")).forEach(r=>{S(r,e("checkoutChargeAmount"))}),an(n,t),l(document,s("cart-warning")).forEach(r=>{S(r,[...new Set(t.warnings.map(i=>i.message))].join(" "))}),sn(n),l(document,s("cart-lines")).forEach(r=>{gt(r,n?.lines.nodes??[],i=>i.id,(i,o)=>{on(i,o,t)},{onEnter:a.onLineEnter,onLeave:a.onLineLeave})}),n&&ht("cart")}function Et(t){l(document,s("cart-count")).forEach(n=>{/^\s*0?\s*$/.test(n.textContent)&&(n.textContent=String(t))})}function nt(t,n="localStorage"){try{return window[n].getItem(t)}catch{return null}}function et(t,n,e="localStorage"){try{window[e].setItem(t,n)}catch{}}function Tt(t,n="localStorage"){try{window[n].removeItem(t)}catch{}}var $t=/^gid:\/\/shopify\/Cart\/[\w-]+(\?key=[\w-]+)?$/;var p={kind:"unknown"},T=[],I=new Map,j=()=>p;function d(){switch(p.kind){case"ready":case"error":return p.cart;case"unknown":case"empty":return null}}var qt=()=>T,rt=t=>t?{kind:"ready",cart:t}:{kind:"empty"},Ot=()=>`${a.storageKey}:seen`;function v(){let t=nt(a.storageKey);return t?$t.test(t)?t:(A(),null):null}function A(){Tt(a.storageKey)}function it(t){p=rt(t),t&&et(a.storageKey,t.id)}function O(){xt({cart:d(),warnings:T,pending:I,failed:p.kind==="error"})}function U(t){O(),m("cart-updated",{cart:d(),reason:t})}function h(t,n){return it(t),et(Ot(),`${Date.now()}|${t?.totalQuantity??0}`),U(n),t}function D(t){p=t.kind==="loaded"?rt(t.cart):{kind:"error",error:t.error,cart:null},U("load")}function un(){let t=nt(Ot())?.split("|")[1]??"",n=Number(t);return/^\d+$/.test(t)&&Number.isSafeInteger(n)?n:null}function Ut(){if(p.kind!=="unknown")return;let t=un();t!==null&&Et(t)}function Dt(t){T=t.filter((n,e)=>t.findIndex(r=>r.message===n.message)===e).map(n=>({...n,message:a.warningText?.(n)||n.message})),T.length&&m("cart-warning",{warnings:T})}var Mt=()=>{};function cn(){let t=Promise.resolve();return n=>{let e=t.then(n);return t=e.then(Mt,Mt),e}}var ln=cn();function Qt(t){return ln(t).then(n=>(p.kind==="error"&&(p=rt(p.cart),O()),n),n=>{throw p={kind:"error",error:n,cart:d()},O(),m("cart-error",{error:n}),n})}var ot=t=>tt(t,I),dn=()=>({open:y(),count:d()?.totalQuantity??0,loaded:p.kind!=="unknown",warnings:[...T]});function Rt(t){let n=["cart-updated","cart-toggled"].map(r=>`${a.prefix}:${r}`),e=()=>{t(d(),dn())};return n.forEach(r=>{document.addEventListener(r,e)}),e(),()=>{n.forEach(r=>{document.removeEventListener(r,e)})}}var fn=/does not exist|not found|invalid id/i,pn=t=>R({[t]:$({cart:$(X)})});function H(t){return t instanceof g?t.userErrors?.some(n=>n.field?.[0]==="cartId")?!0:(t.errors??[]).some(n=>fn.test(n.message)):!1}function Wt(t){return t instanceof g&&(t.code==="NETWORK"||t.code==="INVALID_RESPONSE"||(t.status??0)>=500)}function Nt(t,n=1,e={}){let r=typeof t=="object"&&t!==null?t:{...e,quantity:n,...t==null?{}:{variantId:t}},i=q.variant(r.merchandiseId||r.variantId||r.id);if(!i)throw new g("add(): variantId is required");let o=parseInt(String(r.quantity??1),10),u={merchandiseId:i,quantity:Math.max(1,o||1)},c=q.sellingPlan(r.sellingPlanId||r.sellingPlan);c&&(u.sellingPlanId=c);let f=M(r.attributes);return f.length&&(u.attributes=f),u}function mn(t,n,e){return r=>`mutation Tether_${t}(${n}){${t}(${e}){cart{...TetherCart}userErrors{field message}warnings{code message target}}}${Y(r)}`}async function _t(t,n,e,r){let i=await F(mn(t,n,e),r,pn(t),{operation:"mutation"}),o=dt(i[t],t);return Dt(o.warnings??[]),o.cart}function Ft(t){let n=a.country?{buyerIdentity:{countryCode:a.country},...t}:t;return _t("cartCreate","$input: CartInput!","input: $input",{input:n})}async function k({name:t,args:n,inner:e,variables:r,createInput:i}){let o=v();if(!o)return i?Ft(i):null;try{return await _t(t,`$cartId: ID!, ${n}`,`cartId: $cartId, ${e}`,{...r,cartId:o})}catch(u){if(!H(u)||(A(),!i))throw u;return lt("cart expired, creating a new one"),Ft(i)}}async function at(t){return(await F(e=>`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${Y(e)}`,{id:t},R({cart:$(X)}))).cart}async function Kt(t){return(await F("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:t},R({cart:$({checkoutUrl:"string"})}))).cart?.checkoutUrl??null}function Vt(t,n){let e=typeof n=="number"?{quantity:n}:n,r={id:t};e.quantity!==void 0&&(r.quantity=e.quantity),"sellingPlanId"in e&&(r.sellingPlanId=e.sellingPlanId?q.sellingPlan(e.sellingPlanId):null),e.attributes&&(r.attributes=M(e.attributes));let i=e.merchandiseId||e.variantId;return i&&(r.merchandiseId=q.variant(i)),r}var st=t=>k({name:"cartLinesUpdate",args:"$lines: [CartLineUpdateInput!]!",inner:"lines: $lines",variables:{lines:t},createInput:null}),ut=t=>k({name:"cartLinesRemove",args:"$lineIds: [ID!]!",inner:"lineIds: $lineIds",variables:{lineIds:t},createInput:null}),jt=(t,n)=>n>0?st([{id:t,quantity:n}]):ut([t]);var ct=null;function Ht(t){ct=t}var gn=t=>Kt(t).then(n=>({kind:"url",url:n}),n=>({kind:"failed",error:n}));async function yn(){if(!ct)return null;try{let t=await ct();return t&&`${t}${t.includes("?")?"&":"?"}logged_in=true`}catch(t){return C(t,"account checkout"),null}}async function hn(t){let n=gn(t),e=await yn();if(e)return e;let r=await n;if(r.kind==="failed")throw r.error;if(!r.url)throw new g("No checkoutUrl (cart empty or expired)");return r.url}function Cn(t){try{t.opener=null}catch{}}async function Bt(t=a.checkoutTarget){let n=v(),e=d();if(!n||e&&!e.totalQuantity)return null;let r=t==="_blank"?window.open("","_blank"):null;r&&Cn(r);try{let i=await hn(n);if(!ft(i))throw new g("The checkout URL is not https: not opened");return m("checkout",{url:i,cart:d()}),r&&!r.closed?r.location.href=i:window.location.href=i,i}catch(i){return r?.close(),C(i,"checkout failed"),null}}var B=()=>d()?.lines.nodes??[];async function bn(){let t=v();if(t)try{let n=await at(t);n||A(),h(n,"load")}catch(n){C(n,"cart reload after a failed change")}}function L(t){return Qt(()=>t().catch(async n=>{throw Wt(n)&&await bn(),n}))}function wn(t,n){let e=B().find(c=>c.id===t);if(!e)return Promise.resolve(d());let r=Math.max(0,ot(e)+n),i={quantity:r};I.set(t,i),U("pending");let o=()=>I.get(t)===i;return L(async()=>{if(!o())return d();if(B().find(b=>b.id===t)?.quantity===r)return d();let f=await jt(t,r);return o()?h(f,r>0?"update":"remove"):(it(f),f)}).finally(()=>{o()&&(I.delete(t),U("settled"))})}function Sn(t){let n=(d()?.discountCodes??[]).map(r=>r.code),e=typeof t=="function"?t(n):t;return(Array.isArray(e)?e:[e]).map(r=>r.trim()).filter(Boolean)}function vn(t){let n=new Map((d()?.attributes??[]).map(e=>[e.key,e.value]));return M(t).forEach(e=>n.set(e.key,e.value)),[...n].filter(([,e])=>e!=="").map(([e,r])=>({key:e,value:r}))}async function An(){let t=v();if(!t)return D({kind:"loaded",cart:null}),null;Ut();try{let n=await at(t);n||A(),D({kind:"loaded",cart:n})}catch(n){C(n,"cart load failed"),H(n)&&A(),D({kind:"failed",error:n})}return d()}var Q={init:An,id:v,get status(){return j()},get state(){return d()},get lines(){return[...B()]},get count(){return d()?.totalQuantity??0},get loaded(){return j().kind!=="unknown"},get lastError(){let t=j();return t.kind!=="error"?null:t.error instanceof Error?t.error:new Error(String(t.error))},get warnings(){return[...qt()]},get pendingQty(){return I},setCheckoutResolver:Ht,forgetSaved(){A(),D({kind:"loaded",cart:null})},render:O,subscribe:Rt,add(t,n=1,e={}){let r=(Array.isArray(t)?t:[t]).map(i=>Nt(i,n,e));return L(async()=>{let i=await k({name:"cartLinesAdd",args:"$lines: [CartLineInput!]!",inner:"lines: $lines",variables:{lines:r},createInput:{lines:r}});if(!i)throw new g("Shopify answered the add without a cart");return h(i,"add"),m("added",{cart:i,lines:r}),a.openCartOnAdd&&V(),i})},updateLine(t,n){let e=typeof n=="number"?n:n.quantity;if(e!==void 0&&e<=0)return Q.removeLine(t);let r=Vt(t,n);return L(async()=>h(await st([r]),"update"))},changeQuantity:wn,quantityOf:ot,removeLine(t){let n=Array.isArray(t)?t:[t];return L(async()=>h(await ut(n),"remove"))},clear(){let t=B().map(n=>n.id);return t.length?Q.removeLine(t):Promise.resolve(d())},setNote(t){let n={note:t??""};return L(async()=>h(await k({name:"cartNoteUpdate",args:"$note: String!",inner:"note: $note",variables:n,createInput:n}),"note"))},setAttributes(t){return L(async()=>{let n={attributes:vn(t)},e=await k({name:"cartAttributesUpdate",args:"$attributes: [AttributeInput!]!",inner:"attributes: $attributes",variables:n,createInput:n});return h(e,"attributes")})},setDiscountCodes(t){return L(async()=>{let n={discountCodes:Sn(t)},e=await k({name:"cartDiscountCodesUpdate",args:"$discountCodes: [String!]!",inner:"discountCodes: $discountCodes",variables:n,createInput:n});return h(e,"discount")})},async applyDiscount(t){let n=await Q.setDiscountCodes(i=>[...new Set([...i,t])]),e=t.toLowerCase();if((n?.discountCodes??[]).find(i=>i.code.toLowerCase()===e)?.applicable)return n;try{await Q.removeDiscount(t)}catch(i){C(i,"removing a discount code Shopify refused")}throw new g(`Discount code not valid: ${t}`,{code:"INVALID_DISCOUNT"})},removeDiscount(t){let n=t.toLowerCase();return Q.setDiscountCodes(e=>e.filter(r=>r.toLowerCase()!==n))},setBuyerIdentity(t,{create:n=!0}={}){return L(async()=>{let e=await k({name:"cartBuyerIdentityUpdate",args:"$buyerIdentity: CartBuyerIdentityInput!",inner:"buyerIdentity: $buyerIdentity",variables:{buyerIdentity:t},createInput:n?{buyerIdentity:t}:null}).catch(r=>{if(n||!H(r))throw r;return null});return h(e,"buyer-identity")})},checkout:Bt,drawers:P,isOpen:y,open:V,close:Z,toggle:vt};export{Zt as a,nt as b,et as c,Tt as d,Q as e};
@@ -0,0 +1 @@
1
+ import{A as G,E as j,F as W,b as T,d as y,e as x,o as F,p as V,r as u,x as O,y as b,z as E}from"./chunk-E5YO6274.js";var p=class extends Error{constructor(r,{status:n,errors:i,userErrors:o,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=i,this.userErrors=o}};function A(t,e){return typeof e=="function"?e(t):typeof e=="string"?e==="object"?y(t):typeof t===e:yt(e)?Array.isArray(t)&&t.every(r=>A(r,e[0])):y(t)&&Object.entries(e).every(([r,n])=>n===void 0||A(t[r],n))}var yt=t=>Array.isArray(t),Pe=t=>e=>e===null||A(e,t),Me=t=>e=>A(e,t);function Tt(t=u){return`https://${t.domain}/api/${t.apiVersion}/graphql.json`}var z=/"(?:\\.|[^"\\\n])*"|#[^\n]*/g,Et=/^\s*(?:query|mutation)(?:\s+\w+)?\s*(?:\([^)]*\))?/;function bt(t){return/\bmutation\b/.test(t.replace(z,""))?"mutation":"query"}function Y(t,{country:e,language:r}){let n=[];if(e&&n.push(`country: ${e}`),r&&n.push(`language: ${r}`),!n.length)return t;let i=`@inContext(${n.join(", ")})`,o=t.replace(z,f=>" ".repeat(f.length)),s=o.indexOf("{");if(o.slice(0,s).includes("@inContext"))return t;if(o.trimStart().startsWith("{"))return`query ${i} ${t.slice(s)}`;let c=Et.exec(o);if(!c)return t;let d=c[0].length;return`${t.slice(0,d).trimEnd()} ${i} ${t.slice(d).trimStart()}`}function _e(t,e=u){let r=F(e.country)??void 0,n=V(e.language)??void 0;return Y(t,{country:r,language:n})}var J=300,wt=500,q=430,St=1e3,N="quantityAvailable",Q=new Set,xt=t=>`${t.domain} ${t.apiVersion} ${t.token}`;function At(t,e,r,{context:n,operation:i}){let o=typeof e=="string"?e:e(r),s=n?Y(o,t):o;return t.maxAge<=0||i==="mutation"?s:`${s} #${Math.floor(Date.now()/(t.maxAge*St))}`}var vt=t=>new Promise(e=>setTimeout(e,t));function R(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 kt(t){let e=x(t,"message"),r=x(x(t,"extensions"),"code"),n=typeof e=="string"?e:"";return typeof r=="string"?{message:n,extensions:{code:r}}:{message:n}}function Lt(t){if(!y(t))return null;let{data:e,errors:r}=t;return r==null?{data:e}:Array.isArray(r)?{data:e,errors:r.map(kt)}:null}function C(t,e){return t.ok?new p(`Invalid response (${t.status})`,{code:"INVALID_RESPONSE",status:t.status}):new p(R(t.status,e),{status:t.status})}function B(t,e,r){let n=e.map(o=>o.message).filter(Boolean).join(" | "),i=n||"Storefront API error";return t.ok||(i=t.status===401||t.status===403||!n?R(t.status,r):n),new p(i,{status:t.status,errors:e})}function K(t,e){if(e==="any")return{kind:"retry",backoffMs:J};throw new p(`Network error: ${G(t)}`,{code:"NETWORK"})}async function Ot(t,e,r,n,i){let o;try{o=await(t.fetch??fetch)(Tt(t),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":t.token},body:JSON.stringify({query:e,variables:r})})}catch(l){return K(l,i)}if(o.status===q)throw new p("Shopify security rejection (430)",{status:q});if(i!=="none"&&o.status===429||i==="any"&&o.status>=500)return{kind:"retry",backoffMs:J};let s;try{s=await o.json()}catch(l){if(l instanceof SyntaxError)throw C(o,t);return K(l,i)}let c=Lt(s);if(!c)throw C(o,t);let{data:d,errors:f=[]}=c;if(f.length){if(e.includes(N)&&f.some(l=>l.message.includes(N)))return{kind:"inventory-refused",error:B(o,f,t)};if(i!=="none"&&f.some(l=>l.extensions?.code==="THROTTLED"))return{kind:"retry",backoffMs:wt};throw B(o,f,t)}if(!o.ok)throw new p(R(o.status,t),{status:o.status});if(!n(d))throw C(o,t);return{kind:"data",data:d}}async function Ct(t,e,r,n,{context:i=!0,operation:o="query"}={}){if(!t.domain||!t.token)throw new p("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let s=xt(t),c=o==="mutation"?"not-run":"any",d=0;for(;;){let f=At(t,e,{inventory:!Q.has(s)},{context:i,operation:o}),l=d<t.retries?c:"none",m=await Ot(t,f,r,n,l);switch(m.kind){case"data":return m.data;case"inventory-refused":if(typeof e=="string")throw m.error;O(`the token can't read inventory: ${N} is left out from now on`),Q.add(s);break;case"retry":d+=1,O("retry",d),await vt(m.backoffMs*2**d);break}}}function Nt(t,e,r,n){return Ct(u,t,e,r,n)}var Rt=t=>typeof t=="object"&&t!==null;function He(t,e={},r){let n=bt(typeof t=="string"?t:t({inventory:!0}));return Nt(t,e,Rt,{...r,operation:n})}function Ue(t,e){if(!t)throw new p(`${e}: empty response`);let r=t.userErrors??[];if(r.length)throw new p(r.map(n=>n.message).join(" | "),{userErrors:r});return t}var g=t=>`${u.prefix}-${t}`,It=(t,e)=>e===void 0?`[${g(t)}]`:`[${g(t)}="${e}"]`,I=(t,e)=>t.getAttribute(g(e)),Pt=(t,e)=>t.hasAttribute(g(e));function X(t,e){return t?[...t.querySelectorAll(e)]:[]}var Mt=(t,e,r)=>X(t,e).filter(n=>n.closest(r)===t),_t=["product-ready","list-ready","cart-updated","cart-toggled","checkout","search"],Z=new WeakMap;function tt(t,e){let r=new CustomEvent(`${u.prefix}:${t}`,{detail:e,bubbles:!0});return Z.set(r,t),r}function Ht(t,e){return Z.get(t)===e}function P(t,e,r=document){r.dispatchEvent(tt(t,e))}function rt(t,{width:e,height:r,crop:n}={}){if(!t)return t;let i;try{i=new URL(t)}catch(o){if(o instanceof TypeError)return t;throw o}return e&&i.searchParams.set("width",String(e)),r&&i.searchParams.set("height",String(r)),n&&i.searchParams.set("crop",n),i.toString()}function M(t,e){return t.getAttribute(e)??t.getAttribute(g(e))??t.getAttribute(`data-${e}`)}function nt(t,e){if(!t||!e)return t;let r=M(e,"max-width"),n=M(e,"max-height");return rt(t,{width:r,height:n,crop:r||n?M(e,"crop"):null})}var et=t=>t.replace(/\?.*$/,"");function ot(t,e){return!t||!e?!1:et(t)===et(e)}function Ut(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 $t(t,e,r){if(!e)return;let n=nt(e,t);if(t.tagName!=="IMG"){t.style.backgroundImage=Ut(n);return}if(ot(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 _=new WeakMap,Dt=t=>!!_.get(t),H=t=>t.cloneNode(!0);function it(t){let e=_.get(t);if(e!==void 0)return e;let r=t.firstElementChild,n=r?H(r):null;return _.set(t,n),t.replaceChildren(),n}function Ft(t,e,r){let n=it(t);if(!n){e.length&&b("repeater without a template child",t);return}t.replaceChildren(),e.forEach((i,o)=>{let s=H(n);r(s,i,o),t.appendChild(s)})}function Vt(t,e){let r=()=>{t.remove()};if(!e){r();return}try{e(t,r)}catch(n){E(n,"repeater onLeave"),r()}}function Gt(t,e,r,n){e.forEach((i,o)=>{if(!r.has(i))return;let s=e[o-1];if(s?.parentNode===t?s.after(i):t.prepend(i),!!n)try{n(i)}catch(c){E(c,"repeater onEnter")}})}function jt(t,e,r,n,{onEnter:i,onLeave:o}={}){let s=it(t);if(!s){b("repeater without a template child",t);return}let c=`data-${u.prefix}-key`,d=`data-${u.prefix}-leaving`,f=()=>[...t.children].filter(a=>a.hasAttribute(c)&&!a.hasAttribute(d)),l=new Map(f().map(a=>[a.getAttribute(c),a])),m=[],w=new Set;e.forEach((a,S)=>{let L=String(r(a,S)),h=l.get(L);h?l.delete(L):(h=H(s),h.setAttribute(c,L),w.add(h)),n(h,a,S,w.has(h)),m.push(h)});let k=m.filter(a=>!w.has(a)),D=f().filter(a=>k.includes(a));if(!(D.length===k.length&&D.every((a,S)=>a===k[S]))){l.forEach(a=>{a.remove()}),m.forEach(a=>t.appendChild(a));return}Gt(t,m,w,i),l.forEach(a=>{a.setAttribute(d,""),a.removeAttribute(c),a.style.pointerEvents="none",a.inert=!0,Vt(a,o)})}var Wt="http://www.w3.org/1999/xhtml",qt=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"]),Qt=new Set(["script","style","template","noscript","textarea","select","title"]),Bt=new Set(["style","title","lang","dir","role","align","width","height"]),Kt=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"])]]),zt=new Set(["href","src","poster","cite"]),Yt=/^(javascript|vbscript|data):/i,Jt=/^data:image\/(png|gif|jpeg|webp|avif);/i,Xt=new Set(["position","top","right","bottom","left","z-index","-webkit-box-reflect"]),Zt=["inset","transform","translate","rotate","scale","offset"],te=/\d(?:[sld]?v|cq)(?:w|h|i|b|min|max)\b/i,ee=/^(?:outline|box-shadow|text-shadow|filter|text-decoration|text-underline-offset|text-stroke)|^(?:border-image|mask-border|mask-box-image)(?:-outset)?$/,st=40,re=new Map([["letter-spacing",{px:4,em:.25}],["word-spacing",{px:4,em:.25}],["text-indent",{px:st}]]),at=/(?<![\w#.-])[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?(%|[a-z]+)?/gi,ne=/(?<![\w-])(?!drop-shadow\(|blur\()[\w-]+\([^()]*\)/g,ut=/(?:var|calc|min|max|clamp|env|attr)\(/i,oe=/url\(|expression\(|@import/i,ie=/[\u0000- ]/g,se="allow-scripts allow-same-origin allow-popups allow-presentation",ae=new Set(["autoplay","encrypted-media","picture-in-picture","fullscreen","clipboard-write","accelerometer","gyroscope","web-share"]),ue="strict-origin-when-cross-origin",ce=["https://www.youtube.com","https://www.youtube-nocookie.com","https://player.vimeo.com","https://www.loom.com","https://fast.wistia.net"];function le(t,e){return Bt.has(e)||e.startsWith("aria-")||(Kt.get(t)?.has(e)??!1)}function de(t,e,r){let n=r.replace(ie,"");return Yt.test(n)?t==="img"&&e==="src"&&Jt.test(n):!0}function ct(t,e){try{return new URL(t,e)}catch{return null}}function fe(t,e,r){let n=t.baseURI,i=ct(n)?.origin??"null";return{origin:i==="null"?null:i,baseUrl:n,styleParser:e,embedOrigins:new Set([...ce,...r])}}function pe(t,e){let r=ct(t.trim(),e.baseUrl);return r!==null&&r.origin!==e.origin&&e.embedOrigins.has(r.origin)}function ge(t){let e=t.split(";").map(r=>r.trim().split(/\s+/)[0]?.toLowerCase()??"");return[...new Set(e.filter(r=>ae.has(r)))].join("; ")}function me(t,e){if(Xt.has(t)||Zt.some(n=>t.startsWith(n))||te.test(e))return!0;let r=re.get(t);return r?ut.test(e)||he(e,r):t.startsWith("margin")&&e.includes("-")}function he(t,e){return[...t.matchAll(at)].some(([r="",n=""])=>{let i=parseFloat(r);if(i>=0)return!1;let o=e[n.toLowerCase()];return o===void 0||-i>o})}function ye(t,e){return ee.test(t.replace(/^-webkit-/,""))?ut.test(e)?!0:[...e.replace(ne,"").matchAll(at)].some(([r="",n=""])=>{let i=Math.abs(parseFloat(r));return i!==0&&(n.toLowerCase()!=="px"||i>st)}):!1}function Te(t,e){let r=e.style;r.cssText=t;let n=Array.from({length:r.length},(o,s)=>r.item(s));for(let o of n){let s=r.getPropertyValue(o);(me(o,s)||ye(o,s)||oe.test(s))&&r.removeProperty(o)}let i=r.cssText;return e.removeAttribute("style"),i}function Ee(t,e){let r=t.localName;for(let o of[...t.attributes]){let s=o.name.toLowerCase(),c=zt.has(s);le(r,s)&&(!c||de(r,s,o.value))||t.removeAttribute(o.name)}let n=t.getAttribute("style");if(n===null)return;let i=Te(n,e.styleParser);i===""?t.removeAttribute("style"):t.setAttribute("style",i)}function be(t){if(t.localName==="iframe"){let r=ge(t.getAttribute("allow")??"");r===""?t.removeAttribute("allow"):t.setAttribute("allow",r),t.setAttribute("sandbox",se),t.setAttribute("referrerpolicy",ue);return}if(t.localName!=="a"||t.getAttribute("target")?.toLowerCase()!=="_blank")return;let e=new Set((t.getAttribute("rel")??"").split(/\s+/).filter(Boolean));e.add("noopener"),e.add("noreferrer"),t.setAttribute("rel",[...e].join(" "))}function we(t,e){let r=t.localName,n=t.namespaceURI===Wt;if(n&&Qt.has(r)){t.remove();return}if(!n||!qt.has(r)){t.replaceWith(...t.childNodes);return}if(r==="iframe"&&!pe(t.getAttribute("src")??"",e)){t.remove();return}Ee(t,e),be(t)}function lt(t,e=globalThis.document,r=[]){let n=e.createElement("template");n.innerHTML=t??"";let i=fe(e,n,r);for(let o of[...n.content.querySelectorAll("*")])we(o,i);return n.content}var dt="data-tether-seen",$="data-tether-shown",v="data-tether-prev-display",Se=120;function Xe(t,e){return W(u.productPath||"/product",t,e)}function mt(t,e){try{return t()}catch(r){if(r instanceof RangeError)return e;throw r}}function Ze(t,e=u.locale){return t?mt(()=>new Intl.NumberFormat(e||void 0,{style:"percent",maximumFractionDigits:0}).format(t/100),`${t}%`):""}function tr(t){return t?u.formatMoney?u.formatMoney(t,u.locale):j(t,u.locale):""}function er(t){return t?mt(()=>new Date(t).toLocaleDateString(u.locale||void 0),""):""}function rr(t,e){t.replaceChildren(lt(e,t.ownerDocument,u.embedOrigins))}var ht=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA",ft=t=>t.tagName==="INPUT";function xe(t,e){let r=e==null?"":String(e);ht(t)?t.value=r:t.textContent=r}var pt=t=>ht(t)?t.value:t.textContent;function nr(t,e){let r=pt(t);if(xe(t,e),r!==pt(t)&&t.hasAttribute(dt)&&u.onValueChange)try{u.onValueChange(t,r)}catch(n){E(n,"onValueChange")}t.setAttribute(dt,"1")}function Ae(t){if(t.hasAttribute($))return;t.setAttribute($,""),t.removeAttribute("hidden");let e=t.getAttribute(v);e!==null?(t.style.display=e,t.removeAttribute(v)):t.style.display==="none"&&(t.style.display=""),typeof getComputedStyle=="function"&&getComputedStyle(t).display==="none"&&(t.style.display=t.getAttribute(g("display"))||"block")}function or(t,e){if(e){Ae(t);return}t.removeAttribute($),!t.hasAttribute(v)&&t.style.display!=="none"&&t.setAttribute(v,t.style.display),t.style.display="none"}function ir(t,e){t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),ft(t)&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let r=t.querySelector('input[type="radio"],input[type="checkbox"]');r&&ft(r)&&(r.checked=e)}var gt,ve=t=>Reflect.get(window,t);function ke(){let t=ve("ScrollTrigger");if(typeof t!="function")return;let e=Reflect.get(t,"refresh");typeof e=="function"&&Reflect.apply(e,t,[])}function Le(t){clearTimeout(gt),gt=setTimeout(()=>{try{u.onLayoutChange?u.onLayoutChange(t):ke()}catch(e){E(e,"layout-changed")}P("layout-changed",{reason:t})},Se)}function sr(t,e){let r=[...t.querySelectorAll("img")].filter(o=>!o.complete),n=r.length,i=()=>{n-=1,n===0&&Le(`${e}:images`)};r.forEach(o=>{o.addEventListener("load",i,{once:!0}),o.addEventListener("error",i,{once:!0})})}function ar(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 ur(t,e){let r=t?I(t,e):null;if(!r)return null;try{return JSON.parse(r)}catch{return b(`invalid JSON in ${g(e)}`,t),null}}function U(t){return t==null?"":typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function cr(t){return Array.isArray(t)?t.filter(y).map(r=>({key:U(r.key),value:U(r.value)})):y(t)?Object.entries(t).map(([e,r])=>({key:e,value:U(r)})):[]}function lr(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{p as a,A as b,Pe as c,Me as d,Tt as e,bt as f,_e as g,Ct as h,Nt as i,Rt as j,He as k,Ue as l,g as m,It as n,I as o,Pt as p,X as q,Mt as r,_t as s,Ht as t,P as u,rt as v,ot as w,$t as x,Dt as y,Ft as z,jt as A,Xe as B,Ze as C,tr as D,er as E,rr as F,xe as G,nr as H,or as I,ir as J,ve as K,Le as L,sr as M,ar as N,ur as O,cr as P,lr as Q};
@@ -1 +1 @@
1
- import{C as g,F as E,H as N,a as L,m as l,n as u,p as d,w as k,y as w}from"./chunk-BA4LQJJQ.js";import{d as x,e as o,f as y,g as i,i as A,j as h,k as T,l as f}from"./chunk-E5YO6274.js";function q(t){let e=i(o(t,"amount")),n=i(o(t,"currencyCode"));return e===null||n===null?null:{amount:e,currencyCode:n}}function S(t){let e=i(o(t,"url"));return e===null?null:{url:e,altText:i(o(t,"altText"))}}var U=t=>({title:i(o(t,"title")),variantTitle:i(o(t,"variantTitle")),quantity:A(o(t,"quantity")),image:S(o(t,"image"))}),H=(t,e)=>({id:e,name:i(o(t,"name")),processedAt:i(o(t,"processedAt")),financialStatus:i(o(t,"financialStatus")),fulfillmentStatus:i(o(t,"fulfillmentStatus")),statusPageUrl:i(o(t,"statusPageUrl")),totalPrice:q(o(t,"totalPrice")),lineItems:T(o(t,"lineItems"),U)});function R(t){let e=[];for(let n of y(t)){let r=i(o(n,"id"));if(r===null)return{kind:"missing-id"};e.push(H(n,r))}return{kind:"read",orders:e}}var I=t=>new L(`Customer accounts: the answer has no ${t}`);function G(t,e){let n=i(t);if(!n)throw I(e);return n}function J(t){let e=x(t)?t:{},n=i(e.id),r=i(e.email),s=e.address;return{...n===null?{}:{id:n},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:r===null?null:{emailAddress:r},defaultAddress:Array.isArray(s)?{formatted:f(s)}:null}}function K(t){let e=R(t);if(e.kind==="missing-id")throw I("order id");return e.orders}function D(t){let e=i(o(t,"message"));if(e===null)return null;let n=o(t,"field");return{message:e,field:Array.isArray(n)?f(n):null,code:i(o(t,"code"))}}var Q=t=>h(t,D).filter(e=>e!==null);function P(t,e,n){d(t,l(e)).forEach(r=>{let s=u(r,e)??"";Object.hasOwn(n,s)&&N(r,n[s]===!0)})}var b=(t,e)=>d(t,l(e)).concat(t.matches(l(e))?[t]:[]),Y=t=>t?t.toLowerCase().replace(/_/g," "):"",v=t=>(t?.formatted??[]).join(", "),M=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var j=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:g(t.price),total:g(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),F=t=>t.tagName==="INPUT";function V(t,e,n){P(t,"order-line-show",{returnable:n>0}),d(t,l("return-quantity")).forEach(r=>{F(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),d(t,`select${l("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==e.id&&(r.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function rt(t,e,n){w(t,e,(r,s)=>{let a=s.id,c=n&&a?n.get(a)??0:null;a&&(r.dataset.tetherLine=a);let C=j(s,c);b(r,"order-line").forEach(m=>{let p=u(m,"order-line")??"";if(p==="image"){s.image&&k(m,s.image.url,s.image.altText||s.title||"");return}let O=M(C,p);O!==void 0&&E(m,O)}),a&&c!==null&&V(r,{...s,id:a},c)})}export{q as a,S as b,U as c,I as d,G as e,J as f,K as g,Q as h,P as i,b as j,Y as k,v as l,M as m,rt as n};
1
+ import{D as g,G as E,I as N,a as L,n as l,o as u,q as d,x as k,z as w}from"./chunk-MQYB6BH4.js";import{d as x,e as o,f as y,g as i,i as A,j as h,k as T,l as f}from"./chunk-E5YO6274.js";function q(t){let e=i(o(t,"amount")),n=i(o(t,"currencyCode"));return e===null||n===null?null:{amount:e,currencyCode:n}}function S(t){let e=i(o(t,"url"));return e===null?null:{url:e,altText:i(o(t,"altText"))}}var U=t=>({title:i(o(t,"title")),variantTitle:i(o(t,"variantTitle")),quantity:A(o(t,"quantity")),image:S(o(t,"image"))}),H=(t,e)=>({id:e,name:i(o(t,"name")),processedAt:i(o(t,"processedAt")),financialStatus:i(o(t,"financialStatus")),fulfillmentStatus:i(o(t,"fulfillmentStatus")),statusPageUrl:i(o(t,"statusPageUrl")),totalPrice:q(o(t,"totalPrice")),lineItems:T(o(t,"lineItems"),U)});function R(t){let e=[];for(let n of y(t)){let r=i(o(n,"id"));if(r===null)return{kind:"missing-id"};e.push(H(n,r))}return{kind:"read",orders:e}}var I=t=>new L(`Customer accounts: the answer has no ${t}`);function G(t,e){let n=i(t);if(!n)throw I(e);return n}function J(t){let e=x(t)?t:{},n=i(e.id),r=i(e.email),s=e.address;return{...n===null?{}:{id:n},firstName:i(e.firstName),lastName:i(e.lastName),displayName:i(e.displayName),emailAddress:r===null?null:{emailAddress:r},defaultAddress:Array.isArray(s)?{formatted:f(s)}:null}}function K(t){let e=R(t);if(e.kind==="missing-id")throw I("order id");return e.orders}function D(t){let e=i(o(t,"message"));if(e===null)return null;let n=o(t,"field");return{message:e,field:Array.isArray(n)?f(n):null,code:i(o(t,"code"))}}var Q=t=>h(t,D).filter(e=>e!==null);function P(t,e,n){d(t,l(e)).forEach(r=>{let s=u(r,e)??"";Object.hasOwn(n,s)&&N(r,n[s]===!0)})}var b=(t,e)=>d(t,l(e)).concat(t.matches(l(e))?[t]:[]),Y=t=>t?t.toLowerCase().replace(/_/g," "):"",v=t=>(t?.formatted??[]).join(", "),M=(t,e)=>Object.hasOwn(t,e)?t[e]:void 0;var j=(t,e)=>({title:t.title||t.name||"","variant-title":t.variantTitle||"",quantity:String(t.quantity),price:g(t.price),total:g(t.totalPrice),sku:t.sku||"",returnable:e===null?void 0:String(e)}),F=t=>t.tagName==="INPUT";function V(t,e,n){P(t,"order-line-show",{returnable:n>0}),d(t,l("return-quantity")).forEach(r=>{F(r)&&(r.max=String(n),r.min="0",r.value||(r.value="0"),r.disabled=n<1)}),d(t,`select${l("return-reason")}`).forEach(r=>{r.dataset.tetherFilled!==e.id&&(r.dataset.tetherFilled=e.id,(e.suggestedReturnReasonDefinitions?.nodes??[]).forEach(s=>{r.appendChild(new Option(s.name??"",s.id))}))})}function rt(t,e,n){w(t,e,(r,s)=>{let a=s.id,c=n&&a?n.get(a)??0:null;a&&(r.dataset.tetherLine=a);let C=j(s,c);b(r,"order-line").forEach(m=>{let p=u(m,"order-line")??"";if(p==="image"){s.image&&k(m,s.image.url,s.image.altText||s.title||"");return}let O=M(C,p);O!==void 0&&E(m,O)}),a&&c!==null&&V(r,{...s,id:a},c)})}export{q as a,S as b,U as c,I as d,G as e,J as f,K as g,Q as h,P as i,b as j,Y as k,v as l,M as m,rt as n};
@@ -1 +1 @@
1
- import{b as m,c as p}from"./chunk-A5SYCVQM.js";import{m as k,o as i,p as g,r as u,u as y}from"./chunk-E5YO6274.js";var w="tether_country",C=()=>`${u.prefix}:market:${u.domain}`,M={getItem:e=>m(e)};function S(){let e=typeof window<"u";return{document:typeof document<"u"?document:null,location:e?window.location:null,storage:M,global:e?window:{}}}function b(e){try{return JSON.parse(e)}catch(n){if(n instanceof SyntaxError)return null;throw n}}function E(e){if(typeof e!="object"||e===null)return null;let n=i(Reflect.get(e,"country"));if(!n)return null;let t=Reflect.get(e,"locale");return{country:n,language:g(Reflect.get(e,"language"))??void 0,locale:typeof t=="string"&&t?t:void 0}}function L(e=M){let n=e.getItem(C());return n?E(b(n)):null}function h(e,n){if(!e||!n)return null;let t=e.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${n}=`));return t?decodeURIComponent(t.slice(n.length+1)):null}function s(e,n){if(!e||!n)return null;let t=n.toLowerCase(),r=Object.keys(e).find(o=>o.toLowerCase()===t);return r?e[r]??null:null}function x(e,n){let t=a=>n.document?.querySelector(`meta[name="${a}"]`)?.getAttribute("content"),r=Reflect.get(n.global,"TETHER_COUNTRY"),o=Reflect.get(n.global,"TETHER_LANGUAGE"),l=t("tether-country")||h(n.document,e.cookie||w);return{country:r||l,language:o||t("tether-language")}}function R(e,n){let t=(n.location?.pathname??"/").split("/").find(c=>c!==""),r=s(e.locales,t);if(r)return r;let o=n.document?.documentElement.getAttribute("lang");if(!o)return null;let l=s(e.locales,o)??s(e.locales,o.split("-")[0]);if(l)return{locale:o,...l};if(e.locales&&e.strict)return null;let a=o.split("-")[1];return{language:o,country:a?.length===2?a:null,locale:o}}function N(e,n,t){switch(e){case"saved":return n.remember===!1?null:L(t.storage);case"server":return x(n,t);case"webflow":return R(n,t)}}function v(e){return e?e===!0?k:e:["saved"]}function I(e=u.markets,n=S()){let t=(e===u.markets?e:y(e))??{};if(t.detect===!1)return{};let r={},o={sources:r};for(let l of v(t.detect)){let a=N(l,t,n);if(!a)continue;let c=i(a.country),d=g(a.language),f=typeof a.locale=="string"&&a.locale?a.locale:null;c&&!o.country&&(o.country=c,r.country=l),d&&!o.language&&(o.language=d,r.language=l),f&&!o.locale&&(o.locale=f,r.locale=l)}return o}function T(e){if(u.markets?.remember===!1)return;let n={country:e.country,language:e.language||void 0,locale:e.locale||void 0};p(C(),JSON.stringify(n))}export{L as a,I as b,T as c};
1
+ import{b as m,c as p}from"./chunk-HJY2JSNB.js";import{m as k,o as i,p as g,r as u,u as y}from"./chunk-E5YO6274.js";var w="tether_country",C=()=>`${u.prefix}:market:${u.domain}`,M={getItem:e=>m(e)};function S(){let e=typeof window<"u";return{document:typeof document<"u"?document:null,location:e?window.location:null,storage:M,global:e?window:{}}}function b(e){try{return JSON.parse(e)}catch(n){if(n instanceof SyntaxError)return null;throw n}}function E(e){if(typeof e!="object"||e===null)return null;let n=i(Reflect.get(e,"country"));if(!n)return null;let t=Reflect.get(e,"locale");return{country:n,language:g(Reflect.get(e,"language"))??void 0,locale:typeof t=="string"&&t?t:void 0}}function L(e=M){let n=e.getItem(C());return n?E(b(n)):null}function h(e,n){if(!e||!n)return null;let t=e.cookie.split(";").map(r=>r.trim()).find(r=>r.startsWith(`${n}=`));return t?decodeURIComponent(t.slice(n.length+1)):null}function s(e,n){if(!e||!n)return null;let t=n.toLowerCase(),r=Object.keys(e).find(o=>o.toLowerCase()===t);return r?e[r]??null:null}function x(e,n){let t=a=>n.document?.querySelector(`meta[name="${a}"]`)?.getAttribute("content"),r=Reflect.get(n.global,"TETHER_COUNTRY"),o=Reflect.get(n.global,"TETHER_LANGUAGE"),l=t("tether-country")||h(n.document,e.cookie||w);return{country:r||l,language:o||t("tether-language")}}function R(e,n){let t=(n.location?.pathname??"/").split("/").find(c=>c!==""),r=s(e.locales,t);if(r)return r;let o=n.document?.documentElement.getAttribute("lang");if(!o)return null;let l=s(e.locales,o)??s(e.locales,o.split("-")[0]);if(l)return{locale:o,...l};if(e.locales&&e.strict)return null;let a=o.split("-")[1];return{language:o,country:a?.length===2?a:null,locale:o}}function N(e,n,t){switch(e){case"saved":return n.remember===!1?null:L(t.storage);case"server":return x(n,t);case"webflow":return R(n,t)}}function v(e){return e?e===!0?k:e:["saved"]}function I(e=u.markets,n=S()){let t=(e===u.markets?e:y(e))??{};if(t.detect===!1)return{};let r={},o={sources:r};for(let l of v(t.detect)){let a=N(l,t,n);if(!a)continue;let c=i(a.country),d=g(a.language),f=typeof a.locale=="string"&&a.locale?a.locale:null;c&&!o.country&&(o.country=c,r.country=l),d&&!o.language&&(o.language=d,r.language=l),f&&!o.locale&&(o.locale=f,r.locale=l)}return o}function T(e){if(u.markets?.remember===!1)return;let n={country:e.country,language:e.language||void 0,locale:e.locale||void 0};p(C(),JSON.stringify(n))}export{L as a,I as b,T as c};
@@ -1 +1 @@
1
- import{H as p,l as c,m as i,n as d,q as u}from"./chunk-BA4LQJJQ.js";var m="url:";function h(e){try{return decodeURIComponent(e)}catch(t){if(t instanceof URIError)return e;throw t}}function b(e,t=window.location,a="product"){let n=(d(e,a)??"").trim();if(!n.toLowerCase().startsWith(m))return{key:n||null,fromUrl:!1,raw:n};let r=n.slice(m.length).trim(),o;if(r.toLowerCase()==="path"){let s=t.pathname.split("/").filter(Boolean),f=s[s.length-1];o=f===void 0?null:h(f)}else o=new URLSearchParams(t.search).get(r||"handle");return{key:o?.trim()||null,fromUrl:!0,raw:n}}var w=["loading","ready","error","not-found"],y=e=>w.some(t=>t===e),S=e=>typeof e=="object"&&e!==null&&"code"in e?e.code:void 0,E=e=>S(e)==="NOT_FOUND",l=()=>["product","collection","products","recommendations"].map(e=>i(e)).join(","),U=(e,t)=>e===t||e.parentElement?.closest(l())===t;function g(e){let t=S(e);return typeof t=="string"&&t?t:"error"}function x(e,t,a){let n=t==="not-found",r=t==="error"||n;e.setAttribute(c("state"),n?"error":t),r?e.setAttribute(c("error"),n?"not-found":g(a)):e.removeAttribute(c("error")),u(e,i("show"),l()).forEach(o=>{let s=d(o,"show");y(s)&&p(o,s===t)}),r&&u(e,i("add-to-cart"),l()).forEach(o=>{o.classList.add("is-disabled"),o.setAttribute("aria-disabled","true"),"disabled"in o&&(o.disabled=!0)})}export{b as a,w as b,E as c,l as d,U as e,x as f};
1
+ import{I as p,m as c,n as i,o as d,r as u}from"./chunk-MQYB6BH4.js";var m="url:";function h(e){try{return decodeURIComponent(e)}catch(t){if(t instanceof URIError)return e;throw t}}function b(e,t=window.location,a="product"){let n=(d(e,a)??"").trim();if(!n.toLowerCase().startsWith(m))return{key:n||null,fromUrl:!1,raw:n};let r=n.slice(m.length).trim(),o;if(r.toLowerCase()==="path"){let s=t.pathname.split("/").filter(Boolean),f=s[s.length-1];o=f===void 0?null:h(f)}else o=new URLSearchParams(t.search).get(r||"handle");return{key:o?.trim()||null,fromUrl:!0,raw:n}}var w=["loading","ready","error","not-found"],y=e=>w.some(t=>t===e),S=e=>typeof e=="object"&&e!==null&&"code"in e?e.code:void 0,E=e=>S(e)==="NOT_FOUND",l=()=>["product","collection","products","recommendations"].map(e=>i(e)).join(","),U=(e,t)=>e===t||e.parentElement?.closest(l())===t;function g(e){let t=S(e);return typeof t=="string"&&t?t:"error"}function x(e,t,a){let n=t==="not-found",r=t==="error"||n;e.setAttribute(c("state"),n?"error":t),r?e.setAttribute(c("error"),n?"not-found":g(a)):e.removeAttribute(c("error")),u(e,i("show"),l()).forEach(o=>{let s=d(o,"show");y(s)&&p(o,s===t)}),r&&u(e,i("add-to-cart"),l()).forEach(o=>{o.classList.add("is-disabled"),o.setAttribute("aria-disabled","true"),"disabled"in o&&(o.disabled=!0)})}export{b as a,w as b,E as c,l as d,U as e,x as f};
@@ -1 +1 @@
1
- import{d as e}from"./chunk-A5SYCVQM.js";import{r as o}from"./chunk-E5YO6274.js";var c=()=>`${o.prefix}:account-hint:${o.domain}`;function i(r){e(r,"sessionStorage"),e(r,"localStorage")}function m(){i(`${o.prefix}:account:${o.domain}`),i(`${o.prefix}:account-login:${o.domain}`)}var s=r=>r==="in"||r==="expired"||r==="error";export{c as a,m as b,s as c};
1
+ import{d as e}from"./chunk-HJY2JSNB.js";import{r as o}from"./chunk-E5YO6274.js";var c=()=>`${o.prefix}:account-hint:${o.domain}`;function i(r){e(r,"sessionStorage"),e(r,"localStorage")}function m(){i(`${o.prefix}:account:${o.domain}`),i(`${o.prefix}:account-login:${o.domain}`)}var s=r=>r==="in"||r==="expired"||r==="error";export{c as a,m as b,s as c};
@@ -0,0 +1 @@
1
+ import{a as M,b as z,c as H,d as C,e as Z,f as tt,g as et,h as nt,i as it}from"./chunk-BBVUVPMO.js";import{b as $,e as rt}from"./chunk-VFNHIGCS.js";import{e as Y}from"./chunk-HJY2JSNB.js";import{g as J,h as N,i as S,n as K}from"./chunk-6TFMLT4A.js";import{B as D,C as B,D as L,E as U,F as G,G as d,I as x,J as I,L as V,M as j,N as Q,O as W,P as X,m as p,n as o,o as l,p as T,q as f,r as R,u as v,w as _,x as g,y as F,z as y}from"./chunk-MQYB6BH4.js";import{b as h,r as A,z as w}from"./chunk-E5YO6274.js";var ft=/^image:(\d+)$/,at="metafield:",gt=/^(rich_text|multi_line_text)_field$/,vt=["","true","all","*"],q=t=>t.tagName==="SELECT",b=(t,e)=>t.$(`select${e}`).filter(q);function bt(t,e){let n=e.images.nodes,i=[...t.children].map(a=>a.tagName==="IMG"?a:a.querySelector("img"));!F(t)&&i.length===n.length&&i.every((a,s)=>_(a?.getAttribute("src"),n[s]?.url))||y(t,n,(a,s)=>{let c=a.matches(`img,${o("bind","image")}`)?a:f(a,"img")[0]??a;g(c,s.url,s.altText||e.title)})}function Et(t,e,n){let i=n.indexOf("."),r=n.slice(0,i),a=n.slice(i+1),s=(e.metafields??[]).find(u=>u?.namespace===r&&u.key===a);if(!s){d(t,"");return}let c=s.reference?.image;if(c){g(t,c.url,c.altText);return}gt.test(s.type)&&(t.style.whiteSpace="pre-line"),d(t,s.value)}var Pt=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=>U(t.publishedAt),"min-price":t=>L(t.priceRange.minVariantPrice),"max-price":t=>L(t.priceRange.maxVariantPrice)}));function Tt(t,e){let n=(t.getAttribute("exclude")??"").split(",").map(r=>r.trim()).filter(Boolean),i=e.tags.filter(r=>!n.includes(r));y(t,i,(r,a)=>{d(r,a)})}function yt(t,e,n){let i=Pt.get(e);if(i){d(t,i(n));return}switch(e){case"description":G(t,n.descriptionHtml);break;case"featured-image":g(t,n.featuredImage?.url,n.featuredImage?.altText||n.title);break;case"url":case"link":{let r=D(n.handle,n.id);r&&t.setAttribute("href",r),e==="url"&&!t.firstElementChild&&!t.textContent.trim()&&d(t,n.title);break}case"images":bt(t,n);break;case"tags":Tt(t,n);break;default:Lt(t,e,n)}}function Lt(t,e,n){let i=ft.exec(e);if(i){let r=n.images.nodes[Number(i[1])-1]??n.featuredImage;g(t,r?.url,r?.altText||n.title)}else e.startsWith(at)&&Et(t,n,e.slice(at.length))}function xt(t){let{product:e}=t;t.$(o("option-list")).forEach(n=>{let i=t.optName(l(n,"option-list")),r=e.options.find(a=>a.name===i);if(!r||r.optionValues.length<=1&&T(n,"hide-single")){x(n,!1);return}y(n,r.optionValues,(a,s)=>{a.setAttribute(p("option-value"),s.name);let c=f(a,o("bind","option-value"))[0];c?d(c,s.name):a.firstElementChild||d(a,s.name);let u=f(a,o("bind","swatch"))[0],{swatch:m}=s;!u||!m||(m.color&&(u.style.backgroundColor=m.color),m.image?.previewImage&&g(u,m.image.previewImage.url,s.name))})})}function It(t){let{product:e}=t;b(t,o("option")).forEach(n=>{let i=e.options.find(r=>r.name===t.optName(l(n,"option")));if(!i){x(n,!1);return}n.replaceChildren(...i.optionValues.map(r=>new Option(r.name,r.name)))}),b(t,o("variant-select")).forEach(n=>{n.replaceChildren(...e.variants.nodes.map(i=>new Option(i.title,i.id)))}),b(t,o("plan")).forEach(n=>{let i=t.plans.map(s=>new Option(s.name,s.id)),r=!e.requiresSellingPlan&&l(n,"plan")!=="subscription-only",a=n.getAttribute(p("one-time-label"))||"One-time purchase";n.replaceChildren(...r?[new Option(a,"")]:[],...i)})}function St(t){t.$(o("plan-list")).forEach(e=>{let n=(l(e,"plan-list")??"").trim(),i=vt.includes(n.toLowerCase())?null:n,r=t.plans.filter(a=>!i||a.group.name===i);y(e,r,(a,s)=>{a.setAttribute(p("plan-value"),s.id),!a.firstElementChild&&!a.querySelector(o("plan-bind"))&&d(a,s.name)})})}function st(t){t.$(o("bind")).forEach(e=>{yt(e,l(e,"bind")??"",t.product)}),xt(t),It(t),St(t)}var ot={money:L,percent:B},Mt=t=>t.tagName==="INPUT";function O(t){let e=f(t,o("add-label"))[0]??t,n=e.dataset.tetherLabel??(Mt(e)?e.value:e.textContent);return e.dataset.tetherLabel=n,{label:e,original:n}}function kt(t,e){let{product:n}=t,i=r=>e.selected[t.optName(r)]??"";t.$(o("option-selected")).forEach(r=>{d(r,i(l(r,"option-selected")))}),t.$(o("option-list")).forEach(r=>{let a=t.optName(l(r,"option-list"));f(r,o("option-value")).forEach(s=>{let c=l(s,"option-value")??"";I(s,e.selected[a]===c);let u=!z(n,e.selected,a,c);s.classList.toggle("is-unavailable",u),s.setAttribute("data-unavailable",u?"true":"false")})}),b(t,o("option")).forEach(r=>{r.value=i(l(r,"option"))}),b(t,o("variant-select")).forEach(r=>{r.value=e.variant.id})}function At(t,e){let{variant:n,purchase:i,line:r}=e;t.$(o("purchase")).forEach(a=>{if(q(a)){a.value=i.kind;return}let s=l(a,"purchase");I(a,s===i.kind);let c=s==="subscription"?!e.subscriptionAvailable:t.product.requiresSellingPlan;a.classList.toggle("is-unavailable",c)}),t.$(o("plan-value")).forEach(a=>{let s=l(a,"plan-value")??"";I(a,r.kind==="subscription"&&s===r.planId),a.classList.toggle("is-unavailable",!S(n,s));let c=t.plans.find(m=>m.id===s),u=it(n,s,c,ot);f(a,o("plan-bind")).forEach(m=>{let E=u.get(l(m,"plan-bind")??"");E&&d(m,E())})}),b(t,o("plan")).forEach(a=>{a.value=r.kind==="subscription"?r.planId:""})}function wt(t,e){let n=new Map(Object.entries(e.show));$.forEach(i=>n.set(i,i==="ready")),t.$(o("show")).forEach(i=>{let r=l(i,"show")??"",a=n.get(r);a!==void 0&&($.some(s=>s===r)&&!rt(i,t.root)||x(i,a))})}function Vt(t,e){let n=!e.variant.availableForSale;t.$(o("add-to-cart")).forEach(i=>{i.classList.toggle("is-disabled",n),i.setAttribute("aria-disabled",String(n)),"disabled"in i&&(i.disabled=n);let r=l(i,"soldout-text"),a=l(i,"subscribe-text");if(!r&&!a)return;let{label:s,original:c}=O(i),u=c;e.line.kind==="subscription"&&a&&(u=a),n&&r&&(u=r),i.getAttribute("aria-busy")!=="true"&&d(s,u)})}function lt(t,e){let{variant:n}=e,{product:i}=t,r=nt(e,ot);t.$(o("bind")).forEach(a=>{let s=l(a,"bind")??"";if(s==="variant-image"){g(a,n.image?.url||i.featuredImage?.url,n.image?.altText||i.title);return}let c=r.get(s);c&&d(a,c())}),kt(t,e),At(t,e),wt(t,e),t.root.classList.toggle("is-subscription",e.line.kind==="subscription"),t.root.setAttribute(p("purchase-mode"),e.line.kind),Vt(t,e)}var ut=()=>o("product"),Nt=t=>t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA",ct=t=>t instanceof window.Element;function P(t,e,n){let i=e.closest(n);return i?.closest(ut())===t.root?i:null}function Ht(t,e){let{label:n,original:i}=O(e),r=l(e,"adding-text");Q(e,async()=>{r&&d(n,r);try{await t.addToCart()}catch(a){w(a,"add to cart failed"),v("error",{error:a,context:"add-to-cart"},t.root)}finally{r&&d(n,i)}}).then(()=>{t.renderVariant()}).catch(a=>{w(a,"add to cart render")})}function Ct(t,e,n){let i=P(t,n,o("option-value")),r=i?.closest(o("option-list"));if(i&&r){e.preventDefault(),t.select(t.optName(l(r,"option-list")),l(i,"option-value")??"");return}let a=P(t,n,o("plan-value"));if(a){e.preventDefault(),t.selectPlan(l(a,"plan-value"));return}let s=P(t,n,`${o("purchase")}:not(select)`);if(s){s.tagName!=="INPUT"&&e.preventDefault(),t.setPurchase(dt(l(s,"purchase")));return}let c=P(t,n,o("qty-plus")),u=c?null:P(t,n,o("qty-minus"));if(c||u){e.preventDefault(),t.setQuantity(t.quantity+(c?1:-1));return}let m=P(t,n,o("add-to-cart"));m&&(e.preventDefault(),Ht(t,m))}var dt=t=>t==="subscription"?"subscription":"one-time";function $t(t,e){let n=Nt(e)?e.value:"";e.matches(`select${o("option")}`)?t.select(t.optName(l(e,"option")),n):e.matches(`select${o("variant-select")}`)?t.selectVariant(n):e.matches(`select${o("plan")}`)?n?t.selectPlan(n):t.setPurchase("one-time"):e.matches(`select${o("purchase")}`)?t.setPurchase(dt(n)):e.matches(o("qty"))&&t.setQuantity(n)}function mt(t){t.root.addEventListener("click",e=>{ct(e.target)&&Ct(t,e,e.target)}),t.root.addEventListener("change",e=>{let{target:n}=e;ct(n)&&n.closest(ut())===t.root&&$t(t,n)})}var qt=new WeakMap,Ot=()=>o("product"),k=new Map;function Rt(t){t.forEach(e=>{k.has(e.handle)||k.set(e.handle,e.options.map(n=>n.name))})}var pt=t=>t.tagName==="INPUT",_t=t=>t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA";function Ft(t){return pt(t)&&t.type==="checkbox"?t.checked?t.value&&t.value!=="on"?t.value:"Yes":null:pt(t)&&t.type==="radio"?t.checked?t.value:null:_t(t)&&t.value||null}var ht=class{constructor(e,n){h(this,"root");h(this,"product");h(this,"plans");h(this,"selected");h(this,"purchase");h(this,"variant");h(this,"quantity");this.root=e,this.product=n,this.plans=N(n);let i=new URLSearchParams(window.location.search),r=tt(n,{variant:i.get("variant")||l(e,"variant"),sellingPlan:i.get("selling_plan"),defaultPlan:l(e,"default-plan"),defaultPurchase:l(e,"default-purchase")||A.defaultPurchase});this.selected=r.selected,this.purchase=r.purchase,this.variant=null,this.quantity=T(e,"quantity")?Math.max(0,parseInt(l(e,"quantity")??"",10)||0):1,qt.set(e,this),e.setAttribute(p("state"),"ready"),e.removeAttribute(p("error")),this.renderProduct(),mt(this),this.renderVariant(),j(e,"product"),V("product"),v("product-ready",{product:n,scope:this},e)}update(e){let n=this.variant?.id;this.product=e,this.plans=N(e);let i=e.variants.nodes.find(r=>r.id===n);i&&(this.selected=M(i)),this.root.setAttribute(p("state"),"ready"),this.root.removeAttribute(p("error")),this.renderProduct(),this.renderVariant(),V("product"),v("product-updated",{product:e,scope:this},this.root)}$(e){let n=R(this.root,e,Ot());return this.root.matches(e)?[this.root,...n]:n}optName(e){if(!e)return"";let{options:n}=this.product;if(n.some(r=>r.name===e))return e;let i=(k.get(this.product.handle)??[]).indexOf(e);return n[i]?.name??e}get plan(){let e=H(this.purchase);return this.plans.find(n=>n.id===e)??null}get subscriptionAvailable(){return this.plans.some(e=>S(this.variant,e.id))}get isSubscription(){return C(this.purchase,this.variant).kind==="subscription"}getLine(){if(!this.variant)return null;let e={merchandiseId:this.variant.id,quantity:this.quantity},n=C(this.purchase,this.variant);n.kind==="subscription"&&(e.sellingPlanId=n.planId);let i=this.collectAttributes();return i.length&&(e.attributes=i),e}collectAttributes(){let e=X(W(this.root,"line-attributes")),n=this.$(o("line-attribute")).flatMap(i=>{let r=Ft(i);return r===null?[]:[{key:l(i,"line-attribute")??"",value:r}]});return[...e,...n]}select(e,n){if(this.selected[e]===n)return;let i=this.product.variants.nodes.filter(s=>s.selectedOptions.some(c=>c.name===e&&c.value===n)),[r]=i;if(!r)return;let a={...this.selected,[e]:n};if(!i.some(s=>s.selectedOptions.every(c=>a[c.name]===c.value))){let s=u=>u.selectedOptions.filter(E=>E.name!==e&&this.selected[E.name]===E.value).length*2+(u.availableForSale?1:0),c=i.reduce((u,m)=>s(m)>s(u)?m:u,r);Object.assign(a,M(c))}this.selected=a,this.renderVariant()}selectVariant(e){let n=this.product.variants.nodes.find(i=>i.id===J.variant(e));n&&(this.selected=M(n),this.renderVariant())}setPurchase(e){let n=Z(this.product,this.variant,e,H(this.purchase));n.kind!==this.purchase.kind&&(this.purchase=n,this.renderVariant())}selectPlan(e){let n=K(this.product,e);n&&(this.purchase={kind:"subscription",planId:n.id},this.renderVariant())}setQuantity(e){let n=T(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(String(e),10)||0),this.$(o("qty")).forEach(i=>{d(i,this.quantity)}),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let e=this.getLine();if(!e||e.quantity<1)return null;let n=await Y.add(e);return v("product-added",{product:this.product,variant:this.variant,line:e},this.root),n}renderProduct(){let{product:e}=this;k.has(e.handle)||this.$(`${o("option-list")},select${o("option")}`).map(i=>l(i,"option-list")||l(i,"option")).some(i=>e.options.some(r=>r.name===i))&&Rt([e]),st(this)}renderVariant(){let e=et(this.product,{selected:this.selected,purchase:this.purchase,quantity:this.quantity},A.lowStock);if(!e){this.variant=null;return}this.variant=e.variant,this.selected=e.selected,this.purchase=e.purchase,lt(this,e),v("variant-changed",{product:this.product,variant:e.variant,selected:{...e.selected},purchase:e.purchase.kind,sellingPlanId:e.line.kind==="subscription"?e.line.planId:null},this.root)}};export{qt as a,Rt as b,ht as c};
@@ -0,0 +1 @@
1
+ var e={diagnose:()=>import("./diagnose-XCEBQKBO.js"),markets:()=>import("./markets-ui-M4IQ62CT.js"),search:()=>import("./search-A5DS2IOS.js"),extras:()=>import("./extras-4HU3VSBQ.js"),account:()=>import("./account-CXMA5RPZ.js"),"account-pages":()=>import("./account-pages-IZO7FEOZ.js"),analytics:()=>import("./analytics-PG5FPRDN.js")},a=t=>e[t](),r=void 0;export{a,r as b};
@@ -1,4 +1,4 @@
1
- import{a as h,d as A}from"./chunk-MPDWM2NN.js";import{a as M}from"./chunk-C5JYQCWH.js";import{h as E,v as D}from"./chunk-BFTZR4OB.js";import{d as P,e as $,h as v,l as p,m as l,n as m,p as d,x as S}from"./chunk-BA4LQJJQ.js";import{c as k,r as a,w}from"./chunk-E5YO6274.js";var R=new Set(["in-stock","out-of-stock","backorder","low-stock","plenty-in-stock","on-sale","not-on-sale","has-variants","single-variant","subscription-available","subscription-unavailable","subscription-only","one-time-available","subscription-selected","one-time-selected","has-savings","loading","ready","error","not-found","cart-empty","cart-filled","cart-has-subscription","cart-no-subscription","cart-has-discount","cart-error","cart-warning","list-empty","list-filled","search-empty","search-results","logged-in","logged-out","orders-empty","orders-loading","addresses-loading","addresses-empty","addresses-error","subscriptions-loading","subscriptions-empty","subscriptions-error"]),N=new Set(["title","description","description-text","vendor","type","handle","published-at","price","total-price","compare-at-price","unit-price","min-price","max-price","discount-percentage","discount-amount","variant-title","variant-id","sku","barcode","stock","quantity","featured-image","variant-image","images","tags","link","url","one-time-price","subscription-price","subscription-savings","subscription-savings-amount","checkout-charge","plan-name","plan-description","plan-group","option-value","swatch","image"]),x=new Set(`account account-bind account-link account-login account-logout add-label add-to-cart adding-text
1
+ import{a as h,d as A}from"./chunk-VFNHIGCS.js";import{a as M}from"./chunk-Z6HS3H7K.js";import{h as E,v as D}from"./chunk-6TFMLT4A.js";import{d as P,e as $,i as v,m as p,n as l,o as m,q as d,y as S}from"./chunk-MQYB6BH4.js";import{c as k,r as a,w}from"./chunk-E5YO6274.js";var R=new Set(["in-stock","out-of-stock","backorder","low-stock","plenty-in-stock","on-sale","not-on-sale","has-variants","single-variant","subscription-available","subscription-unavailable","subscription-only","one-time-available","subscription-selected","one-time-selected","has-savings","loading","ready","error","not-found","cart-empty","cart-filled","cart-has-subscription","cart-no-subscription","cart-has-discount","cart-error","cart-warning","list-empty","list-filled","search-empty","search-results","logged-in","logged-out","orders-empty","orders-loading","addresses-loading","addresses-empty","addresses-error","subscriptions-loading","subscriptions-empty","subscriptions-error"]),N=new Set(["title","description","description-text","vendor","type","handle","published-at","price","total-price","compare-at-price","unit-price","min-price","max-price","discount-percentage","discount-amount","variant-title","variant-id","sku","barcode","stock","quantity","featured-image","variant-image","images","tags","link","url","one-time-price","subscription-price","subscription-savings","subscription-savings-amount","checkout-charge","plan-name","plan-description","plan-group","option-value","swatch","image"]),x=new Set(`account account-bind account-link account-login account-logout add-label add-to-cart adding-text
2
2
  always-enabled bind cart-checkout-charge cart-clear cart-close cart-count cart-discounts cart-drawer cart-label cart-lines
3
3
  cart-note cart-open cart-subtotal cart-total cart-warning checkout code collection collection-bind countries country
4
4
  country-bind country-label country-select default-plan default-purchase discount discount-code discount-form discount-input