@occluze/tether 0.3.6 → 0.4.0

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.
@@ -1,134 +1,5 @@
1
- (()=>{var Te=Object.defineProperty;var Le=(t,e)=>{for(var n in e)Te(t,n,{get:e[n],enumerable:!0})};var Zt={domain:"",token:"",apiVersion:"2026-07",country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,storageKey:null,cartDrawerOpenClass:"is-open",openCartOnAdd:!0,checkoutTarget:"_self",defaultPurchase:"one-time",autoMount:!0,observe:!1,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},c={...Zt};function te(t={}){return Object.keys(c).forEach(e=>delete c[e]),Object.assign(c,Zt,t),c.domain&&(c.domain=String(c.domain).replace(/^https?:\/\//,"").replace(/\/.*$/,"")),c.storageKey||(c.storageKey=`${c.prefix}:cart:${c.domain}`),c.apiVersion==="unstable"&&M('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),c}var it=()=>!!(c.domain&&c.token);function D(...t){c.debug&&console.log(`[${c.prefix}]`,...t)}function M(...t){console.warn(`[${c.prefix}]`,...t)}function k(t,e){if(M(e,t&&t.message?t.message:t),typeof c.onError=="function")try{c.onError(t,e)}catch{}}var L=class extends Error{constructor(e,{status:n,errors:r,userErrors:o,code:i}={}){super(e),this.name="TetherError",this.code=i||(n?`HTTP_${n}`:"ERROR"),this.status=n,this.errors=r,this.userErrors=o}};function Lt(){return`https://${c.domain}/api/${c.apiVersion}/graphql.json`}function qt(t,e=c){let n=[];return e.country&&n.push(`country: ${String(e.country).toUpperCase()}`),e.language&&n.push(`language: ${String(e.language).toUpperCase().replace("-","_")}`),!n.length||/@inContext/.test(t)?t:t.replace(/^(\s*(?:query|mutation)\s+\w+\s*(?:\([^)]*\))?)/,`$1 @inContext(${n.join(", ")})`)}var Tt=t=>new Promise(e=>setTimeout(e,t));async function O(t,e={},{context:n=!0}={}){var i;if(!c.domain||!c.token)throw new L("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let r=JSON.stringify({query:n?qt(t):t,variables:e}),o=0;for(;;){let s;try{s=await fetch(Lt(),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c.token},body:r})}catch(d){if(o++<c.retries){await Tt(300*2**o);continue}throw new L(`Network error: ${d.message}`,{code:"NETWORK"})}if(s.status===430)throw new L("Shopify security rejection (430)",{status:430});if((s.status===429||s.status>=500)&&o++<c.retries){D("retry",s.status,o),await Tt(300*2**o);continue}let l;try{l=await s.json()}catch{throw new L(`Invalid response (${s.status})`,{status:s.status})}if((i=l.errors)!=null&&i.length){if(l.errors.some(h=>/quantityAvailable/.test(h.message||""))&&/\bquantityAvailable\b/.test(r))return D("no inventory permission, retrying without quantityAvailable"),O(t.replace(/\bquantityAvailable\b/g,""),e,{context:n});if(l.errors.some(h=>{var C;return((C=h.extensions)==null?void 0:C.code)==="THROTTLED"})&&o++<c.retries){await Tt(500*2**o);continue}throw new L(l.errors.map(h=>h.message).join(" | "),{status:s.status,errors:l.errors})}if(!s.ok)throw new L(`HTTP ${s.status}`,{status:s.status});return l.data}}function Nt(t,e){if(!t)throw new L(`${e}: empty response`);let n=t.userErrors||[];if(n.length)throw new L(n.map(r=>r.message).join(" | "),{userErrors:n});return t}var E="amount currencyCode",G="url altText width height";function qe(){return(c.metafields||[]).map(t=>{if(typeof t=="string"){let e=t.indexOf(".");return{namespace:t.slice(0,e),key:t.slice(e+1)}}return t}).filter(t=>t.namespace&&t.key)}function Ne(){let t=qe();return t.length?`metafields(identifiers: [${t.map(n=>`{namespace: ${JSON.stringify(n.namespace)}, key: ${JSON.stringify(n.key)}}`).join(", ")}]) {
2
- namespace key type value
3
- reference { ... on MediaImage { image { ${G} } } }
4
- }`:""}var Oe=`
5
- id name description recurringDeliveries
6
- options { name value }
7
- priceAdjustments {
8
- orderCount
9
- adjustmentValue {
10
- __typename
11
- ... on SellingPlanPercentagePriceAdjustment { adjustmentPercentage }
12
- ... on SellingPlanFixedAmountPriceAdjustment { adjustmentAmount { ${E} } }
13
- ... on SellingPlanFixedPriceAdjustment { price { ${E} } }
14
- }
15
- }`,_e=`
16
- sellingPlan { id }
17
- checkoutChargeAmount { ${E} }
18
- remainingBalanceChargeAmount { ${E} }
19
- priceAdjustments {
20
- price { ${E} }
21
- compareAtPrice { ${E} }
22
- perDeliveryPrice { ${E} }
23
- unitPrice { ${E} }
24
- }`;function pt(){return`
25
- fragment TetherProduct on Product {
26
- id handle title description descriptionHtml productType vendor tags
27
- availableForSale publishedAt onlineStoreUrl requiresSellingPlan
28
- seo { title description }
29
- featuredImage { ${G} }
30
- images(first: ${c.imagesFirst}) { nodes { ${G} } }
31
- options { name optionValues { name swatch { color image { previewImage { ${G} } } } } }
32
- priceRange { minVariantPrice { ${E} } maxVariantPrice { ${E} } }
33
- compareAtPriceRange { minVariantPrice { ${E} } maxVariantPrice { ${E} } }
34
- ${Ne()}
35
- sellingPlanGroups(first: ${c.sellingPlanGroupsFirst}) {
36
- nodes {
37
- name appName
38
- options { name values }
39
- sellingPlans(first: ${c.sellingPlansFirst}) { nodes { ${Oe} } }
40
- }
41
- }
42
- variants(first: ${c.variantsFirst}) {
43
- nodes {
44
- id title availableForSale currentlyNotInStock quantityAvailable sku barcode
45
- selectedOptions { name value }
46
- image { ${G} }
47
- price { ${E} }
48
- compareAtPrice { ${E} }
49
- unitPrice { ${E} }
50
- sellingPlanAllocations(first: ${c.sellingPlansFirst}) { nodes { ${_e} } }
51
- }
52
- }
53
- }`}function Ot(){return`
54
- fragment TetherCart on Cart {
55
- id checkoutUrl totalQuantity note createdAt updatedAt
56
- attributes { key value }
57
- buyerIdentity { countryCode email }
58
- discountCodes { code applicable }
59
- cost {
60
- subtotalAmount { ${E} }
61
- totalAmount { ${E} }
62
- checkoutChargeAmount { ${E} }
63
- }
64
- lines(first: 100) {
65
- nodes {
66
- id quantity
67
- attributes { key value }
68
- cost {
69
- totalAmount { ${E} }
70
- subtotalAmount { ${E} }
71
- amountPerQuantity { ${E} }
72
- compareAtAmountPerQuantity { ${E} }
73
- }
74
- discountAllocations { discountedAmount { ${E} } }
75
- sellingPlanAllocation {
76
- sellingPlan { id name description recurringDeliveries options { name value } }
77
- checkoutChargeAmount { ${E} }
78
- priceAdjustments { price { ${E} } compareAtPrice { ${E} } perDeliveryPrice { ${E} } }
79
- }
80
- merchandise {
81
- ... on ProductVariant {
82
- id title sku availableForSale requiresShipping
83
- image { ${G} }
84
- price { ${E} }
85
- compareAtPrice { ${E} }
86
- selectedOptions { name value }
87
- product { id title handle vendor featuredImage { ${G} } }
88
- }
89
- }
90
- ... on ComponentizableCartLine {
91
- lineComponents {
92
- id quantity
93
- merchandise { ... on ProductVariant { id title product { title handle } } }
94
- }
95
- }
96
- }
97
- }
98
- }`}function ee(){return`
1
+ (()=>{var Ve=Object.defineProperty;var _=(e,t)=>{for(var r in t)Ve(e,r,{get:t[r],enumerable:!0})};var Et={};_(Et,{DEFAULTS:()=>Rt,cfg:()=>c,configure:()=>Kt,isConfigured:()=>At,log:()=>L,reportError:()=>x,warn:()=>O});var Rt={domain:"",token:"",apiVersion:"2026-07",country:void 0,language:void 0,locale:void 0,markets:null,prefix:"tether",productPath:"/product",collectionPath:"/collection",metafields:[],imagesFirst:25,variantsFirst:100,sellingPlanGroupsFirst:10,sellingPlansFirst:25,collectionFirst:24,retries:2,storageKey:null,cartDrawerOpenClass:"is-open",openCartOnAdd:!0,cartFocus:!0,checkoutTarget:"_self",defaultPurchase:"one-time",autoMount:!0,observe:!1,partsUrl:null,formatMoney:null,onLayoutChange:null,onCartOpen:null,onCartClose:null,onLineEnter:null,onLineLeave:null,onValueChange:null,onError:null,debug:!1},c={...Rt};function Kt(e={}){return Object.keys(c).forEach(t=>delete c[t]),Object.assign(c,Rt,e),c.domain&&(c.domain=String(c.domain).replace(/^https?:\/\//,"").replace(/\/.*$/,"")),c.storageKey||(c.storageKey=`${c.prefix}:cart:${c.domain}`),c.apiVersion==="unstable"&&O('apiVersion "unstable" changes without notice. Pin a dated version (e.g. 2026-07).'),c}var At=()=>!!(c.domain&&c.token);function L(...e){c.debug&&console.log(`[${c.prefix}]`,...e)}function O(...e){console.warn(`[${c.prefix}]`,...e)}function x(e,t){if(O(t,e&&e.message?e.message:e),typeof c.onError=="function")try{c.onError(e,t)}catch{}}var Ht={};_(Ht,{TetherError:()=>I,endpoint:()=>$e,gql:()=>T,unwrap:()=>St,withContext:()=>Ct});var I=class extends Error{constructor(t,{status:r,errors:n,userErrors:i,code:s}={}){super(t),this.name="TetherError",this.code=s||(r?`HTTP_${r}`:"ERROR"),this.status=r,this.errors=n,this.userErrors=i}};function $e(){return`https://${c.domain}/api/${c.apiVersion}/graphql.json`}function Ct(e,t=c){let r=[];return t.country&&r.push(`country: ${String(t.country).toUpperCase()}`),t.language&&r.push(`language: ${String(t.language).toUpperCase().replace("-","_")}`),!r.length||/@inContext/.test(e)?e:e.replace(/^(\s*(?:query|mutation)\s+\w+\s*(?:\([^)]*\))?)/,`$1 @inContext(${r.join(", ")})`)}var Bt=e=>new Promise(t=>setTimeout(t,e));async function T(e,t={},{context:r=!0}={}){if(!c.domain||!c.token)throw new I("Tether is not configured: domain and token are required",{code:"NOT_CONFIGURED"});let n=JSON.stringify({query:r?Ct(e):e,variables:t}),i=0;for(;;){let s;try{s=await fetch($e(),{method:"POST",headers:{"Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c.token},body:n})}catch(f){if(i++<c.retries){await Bt(300*2**i);continue}throw new I(`Network error: ${f.message}`,{code:"NETWORK"})}if(s.status===430)throw new I("Shopify security rejection (430)",{status:430});if((s.status===429||s.status>=500)&&i++<c.retries){L("retry",s.status,i),await Bt(300*2**i);continue}let l;try{l=await s.json()}catch{throw new I(`Invalid response (${s.status})`,{status:s.status})}if(l.errors?.length){if(l.errors.some(p=>/quantityAvailable/.test(p.message||""))&&/\bquantityAvailable\b/.test(n))return L("no inventory permission, retrying without quantityAvailable"),T(e.replace(/\bquantityAvailable\b/g,""),t,{context:r});if(l.errors.some(p=>p.extensions?.code==="THROTTLED")&&i++<c.retries){await Bt(500*2**i);continue}throw new I(l.errors.map(p=>p.message).join(" | "),{status:s.status,errors:l.errors})}if(!s.ok)throw new I(`HTTP ${s.status}`,{status:s.status});return l.data}}function St(e,t){if(!e)throw new I(`${t}: empty response`);let r=e.userErrors||[];if(r.length)throw new I(r.map(n=>n.message).join(" | "),{userErrors:r});return e}var ce={};_(ce,{Cart:()=>P,focusables:()=>Ft,toLineInput:()=>Te});var Qt={};_(Qt,{ALLOCATION_FIELDS:()=>xe,SELLING_PLAN_FIELDS:()=>Pe,cartFragment:()=>It,collectionFields:()=>Gt,metafieldIdentifiers:()=>we,productFragment:()=>ot});var v="amount currencyCode",W="url altText width height";function we(){return(c.metafields||[]).map(e=>{if(typeof e=="string"){let t=e.indexOf(".");return{namespace:e.slice(0,t),key:e.slice(t+1)}}return e}).filter(e=>e.namespace&&e.key)}function Re(){let e=we();return e.length?`metafields(identifiers:[${e.map(r=>`{namespace: ${JSON.stringify(r.namespace)}, key: ${JSON.stringify(r.key)}}`).join(", ")}]){namespace key type value reference{... on MediaImage{image{${W}}}}}`:""}var Pe=` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${v}}}... on SellingPlanFixedPriceAdjustment{price{${v}}}}}`,xe=` sellingPlan{id}checkoutChargeAmount{${v}}remainingBalanceChargeAmount{${v}}priceAdjustments{price{${v}}compareAtPrice{${v}}perDeliveryPrice{${v}}unitPrice{${v}}}`;function ot(){return` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${W}}images(first:${c.imagesFirst}){nodes{${W}}}options{name optionValues{name swatch{color image{previewImage{${W}}}}}}priceRange{minVariantPrice{${v}}maxVariantPrice{${v}}}compareAtPriceRange{minVariantPrice{${v}}maxVariantPrice{${v}}}${Re()} sellingPlanGroups(first:${c.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${c.sellingPlansFirst}){nodes{${Pe}}}}}variants(first:${c.variantsFirst}){nodes{id title availableForSale currentlyNotInStock quantityAvailable sku barcode selectedOptions{name value}image{${W}}price{${v}}compareAtPrice{${v}}unitPrice{${v}}sellingPlanAllocations(first:${c.sellingPlansFirst}){nodes{${xe}}}}}}`}function It(){return` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${v}}totalAmount{${v}}checkoutChargeAmount{${v}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${v}}subtotalAmount{${v}}amountPerQuantity{${v}}compareAtAmountPerQuantity{${v}}}discountAllocations{discountedAmount{${v}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${v}}priceAdjustments{price{${v}}compareAtPrice{${v}}perDeliveryPrice{${v}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping image{${W}}price{${v}}compareAtPrice{${v}}selectedOptions{name value}product{id title handle vendor featuredImage{${W}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`}function Gt(){return`
99
2
  id handle title description descriptionHtml
100
- image { ${G} }
101
- seo { title description }`}var W=new Map,ne=[],_t=new Map,Dt=!1,st=0,Ft=t=>typeof t=="string"&&t.startsWith("gid://");function Ut(t){let e=String(t!=null?t:"").trim();if(!e)return null;if(Ft(e))return e;if(/^\d+$/.test(e))return`gid://shopify/Product/${e}`;let n=e.match(/\/products\/([^/?#]+)/);return n?n[1]:e}function tt(t){if(!t)return;let e=Promise.resolve(t);W.set(t.handle,e),W.set(t.id,e)}function B(t){let e=Ut(t);if(!e)return Promise.reject(new L("empty product key",{code:"NOT_FOUND"}));if(W.has(e))return W.get(e);let n=new Promise((r,o)=>{_t.set(e,{resolve:r,reject:o}),ne.push(e),Dt||(Dt=!0,setTimeout(De,0))});return W.set(e,n),n}async function De(){Dt=!1;let t=st,e=ne.splice(0);if(!e.length)return;let n=e.filter(Ft),r=e.filter(d=>!Ft(d)),o=[],i=[],s={};n.length&&(o.push("$ids: [ID!]!"),s.ids=n,i.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),r.forEach((d,f)=>{o.push(`$h${f}: String!`),s[`h${f}`]=d,i.push(`h${f}: product(handle: $h${f}) { ...TetherProduct }`)});let a=`query TetherProducts(${o.join(", ")}) {
102
- ${i.join(`
103
- `)}
104
- }
105
- ${pt()}`;D("fetch products",e);let l=(d,f)=>{let h=_t.get(d);_t.delete(d),h&&f(h)};try{let d=await O(a,s),f=new Map;(d.byId||[]).forEach(h=>{h&&f.set(h.id,h)}),r.forEach((h,C)=>{d[`h${C}`]&&f.set(h,d[`h${C}`])}),e.forEach(h=>l(h,C=>{f.has(h)?(t===st&&tt(f.get(h)),C.resolve(f.get(h))):(t===st&&W.delete(h),C.reject(new L(`Product not found: ${h}`,{code:"NOT_FOUND"})))}))}catch(d){e.forEach(f=>l(f,h=>{t===st&&W.delete(f),h.reject(d)}))}}function Vt(){W.clear(),st++}async function ht({collection:t,query:e,first:n=c.collectionFirst,after:r=null,sortKey:o,reverse:i=!1,filters:s}={}){let a=pt();if(t){let d=await O(`query TetherCollection($handle: String!, $first: Int!, $after: String, $sortKey: ProductCollectionSortKeys, $reverse: Boolean, $filters: [ProductFilter!]) {
106
- collection(handle: $handle) {
107
- ${ee()}
108
- products(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse, filters: $filters) {
109
- nodes { ...TetherProduct }
110
- pageInfo { hasNextPage endCursor }
111
- }
112
- }
113
- }
114
- ${a}`,{handle:t,first:n,after:r,sortKey:o||void 0,reverse:i,filters:s||void 0});if(!d.collection)throw new L(`Collection not found: ${t}`,{code:"NOT_FOUND"});let{products:f,...h}=d.collection;return f.nodes.forEach(tt),{collection:h,products:f.nodes,pageInfo:f.pageInfo}}let l=await O(`query TetherSearch($first: Int!, $after: String, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {
115
- products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {
116
- nodes { ...TetherProduct }
117
- pageInfo { hasNextPage endCursor }
118
- }
119
- }
120
- ${a}`,{first:n,after:r,query:e||void 0,sortKey:o||void 0,reverse:i});return l.products.nodes.forEach(tt),{collection:null,products:l.products.nodes,pageInfo:l.products.pageInfo}}async function ft(t,e="RELATED"){let r=(await O(`query TetherRecs($id: ID!, $intent: ProductRecommendationIntent) {
121
- productRecommendations(productId: $id, intent: $intent) { ...TetherProduct }
122
- }
123
- ${pt()}`,{id:t,intent:e})).productRecommendations||[];return r.forEach(tt),r}var jt={};Le(jt,{GID:()=>R,allPlans:()=>F,allocationFor:()=>U,findPlan:()=>ct,hasPlans:()=>Fe,planAdjustment:()=>Rt,planCheckoutCharge:()=>Mt,planPrice:()=>at,planSavings:()=>gt,plansForVariant:()=>Ue,toGid:()=>mt});var R={product:t=>mt(t,"Product"),variant:t=>mt(t,"ProductVariant"),sellingPlan:t=>mt(t,"SellingPlan")};function mt(t,e){let n=String(t!=null?t:"").trim();return n?n.startsWith("gid://")?n:/^\d+$/.test(n)?`gid://shopify/${e}/${n}`:n:null}function F(t){var n;return(((n=t==null?void 0:t.sellingPlanGroups)==null?void 0:n.nodes)||[]).flatMap(r=>{var o;return(((o=r.sellingPlans)==null?void 0:o.nodes)||[]).map(i=>({...i,group:r}))})}function Fe(t){return F(t).length>0}function U(t,e){var n;return!t||!e?null:(((n=t.sellingPlanAllocations)==null?void 0:n.nodes)||[]).find(r=>{var o;return((o=r.sellingPlan)==null?void 0:o.id)===e})||null}function Ue(t,e){return F(t).filter(n=>U(e,n.id))}function at(t,e){var o;let n=U(t,e),r=(o=n==null?void 0:n.priceAdjustments)==null?void 0:o[0];return(r==null?void 0:r.perDeliveryPrice)||(r==null?void 0:r.price)||(t==null?void 0:t.price)||null}function Mt(t,e){var r,o;let n=U(t,e);return(n==null?void 0:n.checkoutChargeAmount)||((o=(r=n==null?void 0:n.priceAdjustments)==null?void 0:r[0])==null?void 0:o.price)||(t==null?void 0:t.price)||null}function gt(t,e){var o,i;let n=parseFloat((o=t==null?void 0:t.price)==null?void 0:o.amount),r=parseFloat((i=at(t,e))==null?void 0:i.amount);return!Number.isFinite(n)||!Number.isFinite(r)||n<=0||r>=n?{amount:null,percentage:0}:{amount:{amount:(n-r).toFixed(2),currencyCode:t.price.currencyCode},percentage:Math.round((1-r/n)*100)}}function Rt(t){var n,r;let e=(r=(n=t==null?void 0:t.priceAdjustments)==null?void 0:n[0])==null?void 0:r.adjustmentValue;if(!e)return null;switch(e.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:e.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:e.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:e.price};default:return null}}function ct(t,e){if(!e)return null;let n=F(t),r=R.sellingPlan(e),o=String(e).trim().toLowerCase();return n.find(i=>i.id===r)||n.find(i=>i.name.toLowerCase()===o)||n.find(i=>(i.options||[]).some(s=>String(s.value).toLowerCase()===o))||null}var y=t=>`${c.prefix}-${t}`,u=(t,e)=>e===void 0?`[${y(t)}]`:`[${y(t)}="${e}"]`,m=(t,e)=>t.getAttribute(y(e)),J=(t,e)=>t.hasAttribute(y(e)),Ve=()=>`data-${c.prefix}-key`;function bt(t,e){let n=c.productPath||"/product";if(!/\{(handle|id)\}/.test(n))return`${n.replace(/\/$/,"")}/${t}`;let r=e?String(e).split("/").pop():"";return n.replace(/\{handle\}/g,encodeURIComponent(t||"")).replace(/\{id\}/g,encodeURIComponent(r))}var w=(t,e)=>t?[...t.querySelectorAll(e)]:[],X=(t,e,n)=>w(t,e).filter(r=>r.closest(n)===t);function S(t,e,n=document){n.dispatchEvent(new CustomEvent(`${c.prefix}:${t}`,{detail:e,bubbles:!0}))}function I(t){if(!t)return"";if(typeof c.formatMoney=="function")return c.formatMoney(t,c.locale);let e=parseFloat(t.amount);if(Number.isNaN(e))return"";try{return new Intl.NumberFormat(c.locale||void 0,{style:"currency",currency:t.currencyCode}).format(e)}catch{return`${t.currencyCode} ${e.toFixed(2)}`}}function ie(t){if(!t)return"";try{return new Date(t).toLocaleDateString(c.locale||void 0)}catch{return""}}function Me(t,e){if(!t||!e)return t;let n=e.getAttribute("max-width"),r=e.getAttribute("max-height"),o=e.getAttribute("crop");if(!n&&!r)return t;try{let i=new URL(t);return n&&i.searchParams.set("width",n),r&&i.searchParams.set("height",r),o&&i.searchParams.set("crop",o),i.toString()}catch{return t}}function V(t,e,n){if(!e)return;let r=Me(e,t);t.tagName==="IMG"?(t.removeAttribute("srcset"),t.removeAttribute("sizes"),t.setAttribute("src",r),n!=null&&t.setAttribute("alt",n),t.getAttribute("loading")||t.setAttribute("loading","lazy")):t.style.backgroundImage=`url("${r}")`}function g(t,e){let n=e==null?"":String(e);t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value=n:t.textContent=n}var re=t=>t.tagName==="INPUT"||t.tagName==="TEXTAREA"?t.value:t.textContent;function et(t,e){let n=re(t);g(t,e);let r=re(t);if(n!==r&&t.dataset.tetherSeen&&typeof c.onValueChange=="function")try{c.onValueChange(t,n)}catch{}t.dataset.tetherSeen="1"}function j(t,e){let n="tetherPrevDisplay";e?t.dataset[n]!==void 0?(t.style.display=t.dataset[n],delete t.dataset[n]):t.style.display==="none"&&(t.style.display=""):(t.dataset[n]===void 0&&(t.dataset[n]=t.style.display||""),t.style.display="none")}function vt(t,e){var r;t.classList.toggle("is-selected",e),t.setAttribute("aria-pressed",e?"true":"false"),t.tagName==="INPUT"&&(t.type==="radio"||t.type==="checkbox")&&(t.checked=e);let n=(r=t.querySelector)==null?void 0:r.call(t,'input[type="radio"],input[type="checkbox"]');n&&(n.checked=e)}var yt=new WeakMap,se=t=>!!yt.get(t);function ae(t){var e,n;if(!yt.has(t)){let r=(n=(e=t.firstElementChild)==null?void 0:e.cloneNode(!0))!=null?n:null;yt.set(t,r),t.innerHTML=""}return yt.get(t)}function K(t,e,n){let r=ae(t);if(!r){M("repeater without a template child",t);return}t.innerHTML="",e.forEach((o,i)=>{let s=r.cloneNode(!0);n(s,o,i),t.appendChild(s)})}function ce(t,e,n,r,{onEnter:o,onLeave:i}={}){let s=ae(t);if(!s){M("repeater without a template child",t);return}let a=Ve(),l=`data-${c.prefix}-leaving`,d=()=>[...t.children].filter(b=>b.hasAttribute(a)&&!b.hasAttribute(l)),f=new Map(d().map(b=>[b.getAttribute(a),b])),h=[],C=new Set;e.forEach((b,p)=>{let P=String(n(b,p)),v=f.get(P);v?f.delete(P):(v=s.cloneNode(!0),v.setAttribute(a,P),C.add(v)),r(v,b,p,C.has(v)),h.push(v)});let $=h.filter(b=>!C.has(b)),q=d().filter(b=>$.includes(b));if(!(q.length===$.length&&q.every((b,p)=>b===$[p]))){f.forEach(b=>b.remove()),h.forEach(b=>t.appendChild(b));return}h.forEach((b,p)=>{if(!C.has(b))return;let P=h[p-1];if(P&&P.parentNode===t?P.after(b):t.prepend(b),o)try{o(b)}catch{}}),f.forEach(b=>{b.setAttribute(l,""),b.removeAttribute(a),b.style.pointerEvents="none",b.inert=!0;let p=()=>b.remove();if(i)try{i(b,p)}catch{p()}else p()})}var oe=null;function z(t){clearTimeout(oe),oe=setTimeout(()=>{var e;typeof c.onLayoutChange=="function"?c.onLayoutChange(t):(e=window.ScrollTrigger)!=null&&e.refresh&&window.ScrollTrigger.refresh(),S("layout-changed",{reason:t})},120)}function ue(t,e){let n=w(t,"img").filter(i=>!i.complete);if(!n.length)return;let r=n.length,o=()=>{--r===0&&z(`${e}:images`)};n.forEach(i=>{i.addEventListener("load",o,{once:!0}),i.addEventListener("error",o,{once:!0})})}function H(t,e){return t.getAttribute("aria-busy")==="true"?Promise.resolve():(t.setAttribute("aria-busy","true"),Promise.resolve().then(e).finally(()=>t.removeAttribute("aria-busy")))}function $t(t,e){let n=t&&m(t,e);if(!n)return null;try{return JSON.parse(n)}catch{return M(`invalid JSON in ${y(e)}`,t),null}}function Q(t){return t?Array.isArray(t)?t.map(e=>{var n;return{key:String(e.key),value:String((n=e.value)!=null?n:"")}}):Object.entries(t).map(([e,n])=>({key:e,value:String(n!=null?n:"")})):[]}function Re(t,e=1,n={}){var l;let r=typeof t=="object"&&t!==null?t:{variantId:t,quantity:e,...n},o=R.variant(r.merchandiseId||r.variantId||r.id);if(!o)throw new L("add(): variantId is required");let i={merchandiseId:o,quantity:Math.max(1,parseInt((l=r.quantity)!=null?l:1,10)||1)},s=r.sellingPlanId||r.sellingPlan;s&&(i.sellingPlanId=R.sellingPlan(s));let a=Q(r.attributes);return a.length&&(i.attributes=a),i}function le(t,e,n){return`mutation Tether_${t}(${e}) {
124
- ${t}(${n}) { cart { ...TetherCart } userErrors { field message } }
125
- }
126
- ${Ot()}`}var Bt=t=>/does not exist|not found|invalid id/i.test((t==null?void 0:t.message)||""),A={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(c.storageKey)}catch{return null}},_setId(t){try{t?localStorage.setItem(c.storageKey,t):localStorage.removeItem(c.storageKey)}catch{}},get lines(){var t,e;return((e=(t=this.state)==null?void 0:t.lines)==null?void 0:e.nodes)||[]},get count(){var t;return((t=this.state)==null?void 0:t.totalQuantity)||0},lastError:null,_queue(t){let e=this._chain.then(t,t).then(n=>(this.lastError&&(this.lastError=null,this.render()),n),n=>{throw this.lastError=n,this.render(),S("cart-error",{error:n}),n});return this._chain=e.catch(()=>{}),e},_commit(t,e){return this.state=t,t!=null&&t.id&&this._setId(t.id),this.render(),S("cart-updated",{cart:t,reason:e}),t},async init(){let t=this.id();if(!t)return this.state=null,this.render(),null;try{let e=await O(`query TetherCart($id: ID!) { cart(id: $id) { ...TetherCart } }
127
- ${Ot()}`,{id:t});e.cart?this.state=e.cart:(this._setId(null),this.state=null)}catch(e){k(e,"cart load failed"),this.lastError=e,Bt(e)&&this._setId(null),this.state=null}return this.render(),this.state},async _create(t={}){let e=c.country?{countryCode:String(c.country).toUpperCase()}:void 0,n=await O(le("cartCreate","$input: CartInput!","input: $input"),{input:{buyerIdentity:e,...t}});return Nt(n.cartCreate,"cartCreate").cart},async _mutate(t,e,n,r,o){let i=this.id();if(!i)return o?this._create(o):null;try{let s=await O(le(t,`$cartId: ID!, ${e}`,`cartId: $cartId, ${n}`),{...r,cartId:i});return Nt(s[t],t).cart}catch(s){if(o&&Bt(s))return D("cart expired, creating a new one"),this._setId(null),this._create(o);throw s}},add(t,e=1,n={}){let r=(Array.isArray(t)?t:[t]).map(o=>Re(o,e,n));return this._queue(async()=>{let o=await this._mutate("cartLinesAdd","$lines: [CartLineInput!]!","lines: $lines",{lines:r},{lines:r});return this._commit(o,"add"),S("added",{cart:o,lines:r}),c.openCartOnAdd&&this.open(),o})},updateLine(t,e){let n=typeof e=="number"?{quantity:e}:{...e};if(n.quantity!==void 0&&n.quantity<=0)return this.removeLine(t);let r={id:t};return n.quantity!==void 0&&(r.quantity=n.quantity),"sellingPlanId"in n&&(r.sellingPlanId=n.sellingPlanId?R.sellingPlan(n.sellingPlanId):null),n.attributes&&(r.attributes=Q(n.attributes)),(n.merchandiseId||n.variantId)&&(r.merchandiseId=R.variant(n.merchandiseId||n.variantId)),this._queue(async()=>this._commit(await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[r]}),"update"))},removeLine(t){let e=Array.isArray(t)?t:[t];return this._queue(async()=>this._commit(await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:e}),"remove"))},clear(){let t=this.lines.map(e=>e.id);return t.length?this.removeLine(t):Promise.resolve(this.state)},setNote(t){return this._queue(async()=>this._commit(await this._mutate("cartNoteUpdate","$note: String!","note: $note",{note:t!=null?t:""},{note:t!=null?t:""}),"note"))},setAttributes(t){var r;let e=new Map((((r=this.state)==null?void 0:r.attributes)||[]).map(o=>[o.key,o.value]));Q(t).forEach(o=>e.set(o.key,o.value));let n=[...e].filter(([,o])=>o!=="").map(([o,i])=>({key:o,value:i}));return this._queue(async()=>this._commit(await this._mutate("cartAttributesUpdate","$attributes: [AttributeInput!]!","attributes: $attributes",{attributes:n},{attributes:n}),"attributes"))},setDiscountCodes(t){let e=(Array.isArray(t)?t:[t]).map(n=>String(n).trim()).filter(Boolean);return this._queue(async()=>this._commit(await this._mutate("cartDiscountCodesUpdate","$discountCodes: [String!]!","discountCodes: $discountCodes",{discountCodes:e},{discountCodes:e}),"discount"))},applyDiscount(t){var n;let e=(((n=this.state)==null?void 0:n.discountCodes)||[]).map(r=>r.code);return this.setDiscountCodes([...new Set([...e,t])])},removeDiscount(t){var e;return this.setDiscountCodes((((e=this.state)==null?void 0:e.discountCodes)||[]).map(n=>n.code).filter(n=>n!==t))},setBuyerIdentity(t,{create:e=!0}={}){return this._queue(async()=>{let n=await this._mutate("cartBuyerIdentityUpdate","$buyerIdentity: CartBuyerIdentityInput!","buyerIdentity: $buyerIdentity",{buyerIdentity:t},e?{buyerIdentity:t}:null).catch(r=>{if(e||!Bt(r))throw r;return this._setId(null),null});return this._commit(n,"buyer-identity")})},async checkout(t=c.checkoutTarget){var r;let e=this.id();if(!e)return null;let n=t==="_blank"?window.open("","_blank"):null;if(n)try{n.opener=null}catch{}try{let i=(r=(await O("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:e})).cart)==null?void 0:r.checkoutUrl;if(!i)throw new L("No checkoutUrl (cart empty or expired)");return S("checkout",{url:i,cart:this.state}),n&&!n.closed?n.location.href=i:window.location.href=i,i}catch(o){return n&&n.close(),k(o,"checkout failed"),null}},drawers(){return w(document,u("cart-drawer"))},isOpen(){return this.drawers().some(t=>t.classList.contains(c.cartDrawerOpenClass))},open(){if(this.isOpen())return;let t=this.drawers().filter(e=>m(e,"cart-drawer")!=="manual");t.forEach(e=>{e.classList.add(c.cartDrawerOpenClass),e.setAttribute("aria-hidden","false")}),typeof c.onCartOpen=="function"&&c.onCartOpen(t),S("cart-toggled",{open:!0})},close(){if(!this.isOpen())return;let t=this.drawers();t.forEach(e=>{e.classList.remove(c.cartDrawerOpenClass),e.setAttribute("aria-hidden","true")}),typeof c.onCartClose=="function"&&c.onCartClose(t),S("cart-toggled",{open:!1})},toggle(){this.isOpen()?this.close():this.open()},render(){let t=this.state,e=t?t.totalQuantity:0,n=i=>{var s;return t?I((s=t.cost)==null?void 0:s[i]):""};w(document,u("cart-count")).forEach(i=>et(i,e)),w(document,u("cart-subtotal")).forEach(i=>et(i,n("subtotalAmount"))),w(document,u("cart-total")).forEach(i=>et(i,n("totalAmount"))),w(document,u("cart-checkout-charge")).forEach(i=>et(i,n("checkoutChargeAmount")));let r=this.lines.some(i=>i.sellingPlanAllocation),o={"cart-empty":e===0,"cart-filled":e>0,"cart-has-subscription":r,"cart-no-subscription":!r,"cart-has-discount":((t==null?void 0:t.discountCodes)||[]).some(i=>i.applicable),"cart-error":!!this.lastError};w(document,u("show")).forEach(i=>{let s=m(i,"show");s in o&&!i.closest(u("product"))&&j(i,o[s])}),w(document,`textarea${u("cart-note")},input${u("cart-note")}`).forEach(i=>{document.activeElement!==i&&(i.value=(t==null?void 0:t.note)||"")}),w(document,u("cart-discounts")).forEach(i=>{K(i,(t==null?void 0:t.discountCodes)||[],(s,a)=>{s.setAttribute(y("discount-code"),a.code);let l=s.querySelector(u("discount","code"))||(s.firstElementChild?null:s);l&&g(l,a.code),s.classList.toggle("is-inapplicable",!a.applicable)})}),w(document,u("cart-lines")).forEach(i=>{ce(i,this.lines,s=>s.id,(s,a)=>Be(s,a),{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),t&&z("cart")}};function je(t,e){var o,i,s,a,l,d,f,h,C;let n=t.merchandise||{},r=(o=t.sellingPlanAllocation)==null?void 0:o.sellingPlan;switch(e){case"title":return(i=n.product)==null?void 0:i.title;case"product-title":return(s=n.product)==null?void 0:s.title;case"variant-title":return n.title==="Default Title"?"":n.title;case"options":return(n.selectedOptions||[]).filter($=>$.value!=="Default Title").map($=>`${$.name}: ${$.value}`).join(", ");case"vendor":return(a=n.product)==null?void 0:a.vendor;case"sku":return n.sku;case"price":return I(((l=t.cost)==null?void 0:l.amountPerQuantity)||n.price);case"compare-at-price":return I(((d=t.cost)==null?void 0:d.compareAtAmountPerQuantity)||n.compareAtPrice);case"line-total":return I((f=t.cost)==null?void 0:f.totalAmount);case"line-subtotal":return I((h=t.cost)==null?void 0:h.subtotalAmount);case"quantity":return t.quantity;case"plan":return(r==null?void 0:r.name)||"";case"plan-description":return(r==null?void 0:r.description)||"";case"components":return(t.lineComponents||[]).map($=>{var q,T;return`${$.quantity} \xD7 ${((T=(q=$.merchandise)==null?void 0:q.product)==null?void 0:T.title)||""}`}).join(", ");default:if(e.startsWith("attribute:")){let $=e.slice(10);return((C=(t.attributes||[]).find(q=>q.key===$))==null?void 0:C.value)||""}return}}function Be(t,e){var i,s,a,l;let n=e.merchandise||{},r=!!e.sellingPlanAllocation;t.setAttribute(y("line-id"),e.id),t.classList.toggle("is-subscription",r),w(t,u("line")).forEach(d=>{var C,$,q,T,b,p;let f=m(d,"line");if(f==="image")return V(d,((C=n.image)==null?void 0:C.url)||((q=($=n.product)==null?void 0:$.featuredImage)==null?void 0:q.url),(T=n.product)==null?void 0:T.title);if(f==="url")return d.setAttribute("href",bt((b=n.product)==null?void 0:b.handle,(p=n.product)==null?void 0:p.id));let h=je(e,f);h!==void 0&&et(d,h)});let o={subscription:r,"one-time":!r,"on-sale":parseFloat((s=(i=e.cost)==null?void 0:i.compareAtAmountPerQuantity)==null?void 0:s.amount)>parseFloat((l=(a=e.cost)==null?void 0:a.amountPerQuantity)==null?void 0:l.amount),"has-components":(e.lineComponents||[]).length>0};w(t,u("line-show")).forEach(d=>{let f=m(d,"line-show");f in o&&j(d,o[f])}),w(t,`select${u("line-plan")}`).forEach(d=>{var h;let f=(h=n.product)==null?void 0:h.handle;f&&B(f).then(C=>{var p,P;let $=F(C),T=[...!C.requiresSellingPlan&&m(d,"line-plan")!=="subscription-only"?[{value:"",label:d.getAttribute(y("one-time-label"))||"One-time purchase"}]:[],...$.map(v=>({value:v.id,label:v.name}))],b=T.map(v=>v.value).join("|");d.dataset.tetherSig!==b&&(d.innerHTML="",T.forEach(v=>{let N=document.createElement("option");N.value=v.value,N.textContent=v.label,d.appendChild(N)}),d.dataset.tetherSig=b),d.value=((P=(p=e.sellingPlanAllocation)==null?void 0:p.sellingPlan)==null?void 0:P.id)||"",j(d,$.length>0)}).catch(C=>k(C,"line plan options"))})}function nt(t,e=window.location){let n=(m(t,"product")||"").trim();if(!n.toLowerCase().startsWith("url:"))return{key:n||null,fromUrl:!1,raw:n};let r=n.slice(4).trim(),o=null;if(r.toLowerCase()==="path"){let i=e.pathname.split("/").filter(Boolean);o=i.length?Ke(i[i.length-1]):null}else o=new URLSearchParams(e.search).get(r||"handle");return o=o&&o.trim()?o.trim():null,{key:o,fromUrl:!0,raw:n}}function Ke(t){try{return decodeURIComponent(t)}catch{return t}}var Kt=["loading","ready","error","not-found"],wt=t=>(t==null?void 0:t.code)==="NOT_FOUND",ut=()=>["product","collection","products","recommendations"].map(t=>u(t)).join(","),de=(t,e)=>{var n;return t===e||((n=t.parentElement)==null?void 0:n.closest(ut()))===e};function Y(t,e,n){let r=e==="not-found";t.setAttribute(y("state"),r?"error":e),e==="error"||r?t.setAttribute(y("error"),r?"not-found":(n==null?void 0:n.code)||"error"):t.removeAttribute(y("error")),X(t,u("show"),ut()).forEach(o=>{let i=m(o,"show");if(!Kt.includes(i))return;let s=i===e;j(o,s),s&&typeof getComputedStyle=="function"&&getComputedStyle(o).display==="none"&&(o.style.display=o.getAttribute(y("display"))||"block")}),(e==="error"||r)&&X(t,u("add-to-cart"),ut()).forEach(o=>{o.classList.add("is-disabled"),"disabled"in o&&(o.disabled=!0)})}var rt=new WeakMap,pe=()=>u("product");function He(t,e){let n=e.indexOf("."),r=e.slice(0,n),o=e.slice(n+1);return(t.metafields||[]).find(s=>s&&s.namespace===r&&s.key===o)||null}var Pt=class{constructor(e,n){var r;this.root=e,this.product=n,this.selected={},this.variant=null,this.quantity=Math.max(0,parseInt((r=m(e,"quantity"))!=null?r:"1",10)||(J(e,"quantity")?0:1)),this.plans=F(n),this.purchase="one-time",this.planId=null,rt.set(e,this),e.setAttribute(y("state"),"ready"),e.removeAttribute(y("error")),this.initSelection(),this.initPurchase(),this.renderProduct(),this.bind(),this.renderVariant(),ue(e,"product"),z("product"),S("product-ready",{product:n,scope:this},e)}update(e){var o,i;let n=(o=this.variant)==null?void 0:o.id;this.product=e,this.plans=F(e),this.planId&&!this.plans.some(s=>s.id===this.planId)&&(this.planId=((i=this.plans[0])==null?void 0:i.id)||null),!this.plans.length&&this.purchase==="subscription"&&(this.purchase="one-time");let r=e.variants.nodes.find(s=>s.id===n);r&&(this.selected={},r.selectedOptions.forEach(s=>{this.selected[s.name]=s.value})),this.root.setAttribute(y("state"),"ready"),this.root.removeAttribute(y("error")),this.renderProduct(),this.renderVariant(),z("product"),S("product-updated",{product:e,scope:this},this.root)}$(e){let n=X(this.root,e,pe());return this.root.matches(e)?[this.root,...n]:n}initSelection(){let e=this.product.variants.nodes,n=e.find(o=>o.availableForSale)||e[0];n&&n.selectedOptions.forEach(o=>{this.selected[o.name]=o.value});let r=new URLSearchParams(window.location.search).get("variant")||m(this.root,"variant");if(r){let o=R.variant(r),i=e.find(s=>s.id===o);i&&(this.selected={},i.selectedOptions.forEach(s=>{this.selected[s.name]=s.value}))}}initPurchase(){if(!this.plans.length)return;let e=new URLSearchParams(window.location.search),n=ct(this.product,e.get("selling_plan")),r=ct(this.product,m(this.root,"default-plan"));this.planId=(n||r||this.plans[0]).id;let o=n?"subscription":m(this.root,"default-purchase")||c.defaultPurchase;this.purchase=this.product.requiresSellingPlan||o==="subscription"?"subscription":"one-time"}findVariant(){return this.product.variants.nodes.find(e=>e.selectedOptions.every(n=>this.selected[n.name]===n.value))||null}isValueAvailable(e,n){return this.product.variants.nodes.some(r=>r.availableForSale&&r.selectedOptions.every(o=>o.name===e?o.value===n:this.selected[o.name]===o.value))}get plan(){return this.plans.find(e=>e.id===this.planId)||null}get subscriptionAvailable(){return!!(this.variant&&this.plans.some(e=>U(this.variant,e.id)))}get isSubscription(){return this.purchase==="subscription"&&!!U(this.variant,this.planId)}getLine(){if(!this.variant)return null;let e={merchandiseId:this.variant.id,quantity:this.quantity};this.isSubscription&&(e.sellingPlanId=this.planId);let n=this.collectAttributes();return n.length&&(e.attributes=n),e}collectAttributes(){let e=Q($t(this.root,"line-attributes")),n=this.$(u("line-attribute")).map(r=>{let o=m(r,"line-attribute"),i;return r.type==="checkbox"?i=r.checked?r.value&&r.value!=="on"?r.value:"Yes":"":r.type==="radio"?i=r.checked?r.value:null:i=r.value,i==null||i===""?null:{key:o,value:String(i)}}).filter(Boolean);return[...e,...n]}select(e,n){this.selected[e]!==n&&(this.selected[e]=n,this.renderVariant())}selectVariant(e){let n=this.product.variants.nodes.find(r=>r.id===R.variant(e));n&&(this.selected={},n.selectedOptions.forEach(r=>{this.selected[r.name]=r.value}),this.renderVariant())}setPurchase(e){let n=e==="subscription"?"subscription":"one-time";n==="one-time"&&this.product.requiresSellingPlan||this.purchase!==n&&(this.purchase=n,this.renderVariant())}selectPlan(e){let n=ct(this.product,e);n&&(this.planId=n.id,this.purchase="subscription",this.renderVariant())}setQuantity(e){let n=J(this.root,"quantity")?0:1;this.quantity=Math.max(n,parseInt(e,10)||0),this.$(u("qty")).forEach(r=>g(r,this.quantity)),this.renderVariant()}async addToCart(){var r;if(!((r=this.variant)!=null&&r.availableForSale))return null;let e=this.getLine();if(!e||e.quantity<1)return null;let n=await A.add(e);return S("product-added",{product:this.product,variant:this.variant,line:e},this.root),n}bind(){let e=n=>n&&n.closest(pe())===this.root;this.root.addEventListener("click",n=>{let r=n.target;if(!(r!=null&&r.closest))return;let o=r.closest(u("option-value"));if(e(o)&&o.closest(u("option-list"))){n.preventDefault(),this.select(m(o.closest(u("option-list")),"option-list"),m(o,"option-value"));return}let i=r.closest(u("plan-value"));if(e(i)){n.preventDefault(),this.selectPlan(m(i,"plan-value"));return}let s=r.closest(`${u("purchase")}:not(select)`);if(e(s)){s.tagName!=="INPUT"&&n.preventDefault(),this.setPurchase(m(s,"purchase"));return}let a=r.closest(u("qty-plus"));if(e(a)){n.preventDefault(),this.setQuantity(this.quantity+1);return}let l=r.closest(u("qty-minus"));if(e(l)){n.preventDefault(),this.setQuantity(this.quantity-1);return}let d=r.closest(u("add-to-cart"));e(d)&&(n.preventDefault(),this.onAddClick(d))}),this.root.addEventListener("change",n=>{let r=n.target;e(r)&&(r.matches(`select${u("option")}`)?this.select(m(r,"option"),r.value):r.matches(`select${u("variant-select")}`)?this.selectVariant(r.value):r.matches(`select${u("plan")}`)?r.value?this.selectPlan(r.value):this.setPurchase("one-time"):r.matches(`select${u("purchase")}`)?this.setPurchase(r.value):r.matches(u("qty"))&&this.setQuantity(r.value))})}onAddClick(e){let n=e.querySelector(u("add-label"))||e,r=m(e,"adding-text"),o=i=>g(n,i);n.dataset.tetherLabel===void 0&&(n.dataset.tetherLabel=n.tagName==="INPUT"?n.value:n.textContent),H(e,async()=>{r&&o(r);try{await this.addToCart()}catch(i){k(i,"add to cart failed"),S("error",{error:i,context:"add-to-cart"},this.root)}finally{r&&o(n.dataset.tetherLabel)}}).then(()=>{this.renderVariant()})}renderProduct(){let e=this.product;this.$(u("bind")).forEach(n=>{var o,i,s;let r=m(n,"bind");switch(r){case"title":return g(n,e.title);case"description":n.innerHTML=e.descriptionHtml||"";return;case"description-text":return g(n,e.description);case"vendor":return g(n,e.vendor);case"type":return g(n,e.productType);case"handle":return g(n,e.handle);case"published-at":return g(n,ie(e.publishedAt));case"min-price":return g(n,I(e.priceRange.minVariantPrice));case"max-price":return g(n,I(e.priceRange.maxVariantPrice));case"featured-image":return V(n,(o=e.featuredImage)==null?void 0:o.url,((i=e.featuredImage)==null?void 0:i.altText)||e.title);case"url":case"link":n.setAttribute("href",bt(e.handle,e.id)),r==="url"&&!n.firstElementChild&&!n.textContent.trim()&&g(n,e.title);return;case"images":return K(n,e.images.nodes,(a,l)=>{let d=a.matches(`img,${u("bind","image")}`)?a:a.querySelector("img")||a;V(d,l.url,l.altText||e.title)});case"tags":{let a=(n.getAttribute("exclude")||"").split(",").map(l=>l.trim()).filter(Boolean);return K(n,e.tags.filter(l=>!a.includes(l)),(l,d)=>g(l,d))}default:if(r&&/^image:\d+$/.test(r)){let a=e.images.nodes[parseInt(r.slice(6),10)-1]||e.featuredImage;return V(n,a==null?void 0:a.url,(a==null?void 0:a.altText)||e.title)}if(r&&r.startsWith("metafield:")){let a=He(e,r.slice(10));if(!a)return g(n,"");if((s=a.reference)!=null&&s.image)return V(n,a.reference.image.url,a.reference.image.altText);if(a.type==="rich_text_field"||a.type==="multi_line_text_field"){n.textContent=a.value,n.style.whiteSpace="pre-line";return}return g(n,a.value)}return}}),this.$(u("option-list")).forEach(n=>{let r=m(n,"option-list"),o=e.options.find(i=>i.name===r);return!o||o.optionValues.length<=1&&J(n,"hide-single")?j(n,!1):K(n,o.optionValues,(i,s)=>{var d,f,h;i.setAttribute(y("option-value"),s.name);let a=i.querySelector(u("bind","option-value"));a?g(a,s.name):i.firstElementChild||g(i,s.name);let l=i.querySelector(u("bind","swatch"));l&&((d=s.swatch)!=null&&d.color)&&(l.style.backgroundColor=s.swatch.color),l&&((h=(f=s.swatch)==null?void 0:f.image)!=null&&h.previewImage)&&V(l,s.swatch.image.previewImage.url,s.name)})}),this.$(`select${u("option")}`).forEach(n=>{let r=e.options.find(o=>o.name===m(n,"option"));if(!r)return j(n,!1);n.innerHTML="",r.optionValues.forEach(o=>n.appendChild(new Option(o.name,o.name)))}),this.$(`select${u("variant-select")}`).forEach(n=>{n.innerHTML="",e.variants.nodes.forEach(r=>n.appendChild(new Option(r.title,r.id)))}),this.$(u("plan-list")).forEach(n=>{let r=(m(n,"plan-list")||"").trim(),o=["","true","all","*"].includes(r.toLowerCase())?null:r,i=this.plans.filter(s=>!o||s.group.name===o);K(n,i,(s,a)=>{s.setAttribute(y("plan-value"),a.id),!s.firstElementChild&&!s.querySelector(u("plan-bind"))&&g(s,a.name)})}),this.$(`select${u("plan")}`).forEach(n=>{n.innerHTML="",!e.requiresSellingPlan&&m(n,"plan")!=="subscription-only"&&n.appendChild(new Option(n.getAttribute(y("one-time-label"))||"One-time purchase","")),this.plans.forEach(r=>n.appendChild(new Option(r.name,r.id)))})}renderVariant(){var q,T,b;let e=this.product,n=this.findVariant();if(n||([n]=e.variants.nodes,n&&(this.selected={},n.selectedOptions.forEach(p=>{this.selected[p.name]=p.value}))),this.variant=n,!n)return;if(this.plans.length&&!U(n,this.planId)){let p=this.plans.find(P=>U(n,P.id));p&&(this.planId=p.id)}let r=this.isSubscription,o=n.price,i=this.planId?at(n,this.planId):null,s=r?i:o,a=r&&((b=(T=(q=U(n,this.planId))==null?void 0:q.priceAdjustments)==null?void 0:T[0])==null?void 0:b.compareAtPrice)||n.compareAtPrice,l=a&&parseFloat(a.amount)>parseFloat(s.amount),d=l?Math.round((1-parseFloat(s.amount)/parseFloat(a.amount))*100):0,f=this.planId?gt(n,this.planId):{amount:null,percentage:0},h=this.plan,C={amount:(parseFloat(s.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:s.currencyCode};this.$(u("bind")).forEach(p=>{var P,v,N,x,_;switch(m(p,"bind")){case"price":return g(p,I(s));case"total-price":return g(p,I(C));case"one-time-price":return g(p,I(o));case"subscription-price":return g(p,I(i));case"subscription-savings":return g(p,f.percentage?`${f.percentage}%`:"");case"subscription-savings-amount":return g(p,I(f.amount));case"checkout-charge":return g(p,I(r?Mt(n,this.planId):s));case"plan-name":return g(p,(h==null?void 0:h.name)||"");case"plan-description":return g(p,(h==null?void 0:h.description)||"");case"plan-group":return g(p,((P=h==null?void 0:h.group)==null?void 0:P.name)||"");case"compare-at-price":return g(p,l?I(a):"");case"unit-price":return g(p,I(n.unitPrice));case"discount-percentage":return g(p,`${d}%`);case"discount-amount":return g(p,l?I({amount:String(parseFloat(a.amount)-parseFloat(s.amount)),currencyCode:s.currencyCode}):"");case"variant-title":return g(p,n.title);case"variant-id":return g(p,n.id);case"sku":return g(p,n.sku);case"barcode":return g(p,n.barcode);case"stock":return g(p,(v=n.quantityAvailable)!=null?v:"");case"quantity":return g(p,this.quantity);case"variant-image":return V(p,((N=n.image)==null?void 0:N.url)||((x=e.featuredImage)==null?void 0:x.url),((_=n.image)==null?void 0:_.altText)||e.title);default:return}}),this.$(u("option-selected")).forEach(p=>g(p,this.selected[m(p,"option-selected")]||"")),this.$(u("option-list")).forEach(p=>{let P=m(p,"option-list");w(p,u("option-value")).forEach(v=>{let N=m(v,"option-value");vt(v,this.selected[P]===N);let x=!this.isValueAvailable(P,N);v.classList.toggle("is-unavailable",x),v.setAttribute("data-unavailable",x?"true":"false")})}),this.$(`select${u("option")}`).forEach(p=>{p.value=this.selected[m(p,"option")]||""}),this.$(`select${u("variant-select")}`).forEach(p=>{p.value=n.id}),this.$(u("purchase")).forEach(p=>{if(p.tagName==="SELECT"){p.value=this.purchase;return}let P=m(p,"purchase");vt(p,P===this.purchase);let v=P==="subscription"?!this.subscriptionAvailable:e.requiresSellingPlan;p.classList.toggle("is-unavailable",v)}),this.$(u("plan-value")).forEach(p=>{let P=m(p,"plan-value"),v=this.plans.find(x=>x.id===P),N=!!U(n,P);vt(p,r&&P===this.planId),p.classList.toggle("is-unavailable",!N),w(p,u("plan-bind")).forEach(x=>{let _=Rt(v),It=gt(n,P);switch(m(x,"plan-bind")){case"name":return g(x,v==null?void 0:v.name);case"description":return g(x,(v==null?void 0:v.description)||"");case"price":return g(x,I(at(n,P)));case"savings":return g(x,It.percentage?`${It.percentage}%`:"");case"savings-amount":return g(x,I(It.amount));case"adjustment":return _?g(x,_.type==="percentage"?`${_.value}%`:I(_.value)):g(x,"");default:return}})}),this.$(`select${u("plan")}`).forEach(p=>{p.value=r?this.planId:""});let $={"in-stock":n.availableForSale,"out-of-stock":!n.availableForSale,backorder:n.availableForSale&&n.currentlyNotInStock,"on-sale":!!l,"not-on-sale":!l,"has-variants":e.variants.nodes.length>1,"single-variant":e.variants.nodes.length===1,"low-stock":n.quantityAvailable!=null&&n.quantityAvailable>0&&n.quantityAvailable<=5,"subscription-available":this.subscriptionAvailable,"subscription-unavailable":!this.subscriptionAvailable,"subscription-only":!!e.requiresSellingPlan,"one-time-available":!e.requiresSellingPlan,"subscription-selected":r,"one-time-selected":!r,"has-savings":r?f.percentage>0:!!l,loading:!1,ready:!0,error:!1,"not-found":!1};this.$(u("show")).forEach(p=>{let P=m(p,"show");P in $&&(Kt.includes(P)&&!de(p,this.root)||j(p,$[P]))}),this.root.classList.toggle("is-subscription",r),this.root.setAttribute(y("purchase-mode"),r?"subscription":"one-time"),this.$(u("add-to-cart")).forEach(p=>{let P=!n.availableForSale;p.classList.toggle("is-disabled",P),"disabled"in p&&(p.disabled=P);let v=m(p,"soldout-text"),N=m(p,"subscribe-text");if(v||N){let x=p.querySelector(u("add-label"))||p;x.dataset.tetherLabel===void 0&&(x.dataset.tetherLabel=x.tagName==="INPUT"?x.value:x.textContent);let _=x.dataset.tetherLabel;r&&N&&(_=N),P&&v&&(_=v),p.getAttribute("aria-busy")!=="true"&&g(x,_)}}),S("variant-changed",{product:e,variant:n,selected:{...this.selected},purchase:this.purchase,sellingPlanId:r?this.planId:null},this.root)}};var ot=()=>`${u("collection")},${u("products")},${u("recommendations")}`,Ct=class{constructor(e){this.root=e,this.products=[],this.pageInfo=null,this.collection=null,Y(e,"loading"),e.addEventListener("click",n=>{var o,i;let r=(i=(o=n.target).closest)==null?void 0:i.call(o,u("load-more"));r&&r.closest(ot())===e&&(n.preventDefault(),H(r,()=>this.load(!0)))})}$(e){return X(this.root,e,ot())}options(){let e=this.root,n={first:parseInt(m(e,"limit")||"",10)||void 0,sortKey:m(e,"sort")||void 0,reverse:m(e,"reverse")==="true"};return J(e,"collection")?n.collection=m(e,"collection"):n.query=m(e,"products")||"",n}async load(e=!1){var o;let n=this.loadToken=(this.loadToken||0)+1,r=()=>n!==this.loadToken;try{if(J(this.root,"recommendations")){let i=m(this.root,"recommendations"),s=await B(i),a=await ft(s.id,m(this.root,"intent")||"RELATED");if(r())return;let l=parseInt(m(this.root,"limit")||"",10);this.products=l?a.slice(0,l):a}else{let i=await ht({...this.options(),after:e?(o=this.pageInfo)==null?void 0:o.endCursor:null});if(r())return;this.collection=i.collection,this.pageInfo=i.pageInfo,this.products=e?[...this.products,...i.products]:i.products}this.render(),Y(this.root,"ready"),S("list-ready",{products:this.products,collection:this.collection},this.root)}catch(i){if(r())return;e||Y(this.root,wt(i)?"not-found":"error",i),k(i,"list load failed"),S("error",{error:i,context:"list"},this.root)}}render(){let e=this.collection;this.$(u("collection-bind")).forEach(r=>{var o,i;switch(m(r,"collection-bind")){case"title":return g(r,(e==null?void 0:e.title)||"");case"description":r.innerHTML=(e==null?void 0:e.descriptionHtml)||"";return;case"image":return V(r,(o=e==null?void 0:e.image)==null?void 0:o.url,((i=e==null?void 0:e.image)==null?void 0:i.altText)||(e==null?void 0:e.title));case"count":return g(r,this.products.length);default:return}}),this.$(u("list")).forEach(r=>{K(r,this.products,(o,i)=>{o.setAttribute(y("product"),i.handle),o.removeAttribute(y("state"))}),S("list-rendered",{container:r},this.root)});let n=this.products.length===0;this.$(u("show")).forEach(r=>{let o=m(r,"show");o==="list-empty"&&(r.style.display=n?"":"none"),o==="list-filled"&&(r.style.display=n?"none":"")}),this.$(u("load-more")).forEach(r=>{var o;r.style.display=(o=this.pageInfo)!=null&&o.hasNextPage?"":"none"}),z("list")}};var fe=t=>{let e=/^(\d{4})-(01|04|07|10)$/.exec(String(t||""));return e?{y:+e[1],m:+e[2]}:null},Ge=(t,e)=>`${t}-${String(e).padStart(2,"0")}`;function he(t,e=1){let n=fe(t);if(!n)throw new Error(`not a quarterly Shopify API version: ${t}`);let r=n.y*4+(n.m-1)/3+e;return Ge(Math.floor(r/4),r%4*3+1)}function me(t,e=new Date){if(t==="unstable")return{version:t,ok:!1,note:'"unstable" changes without notice: pin a dated version such as 2026-07'};let n=fe(t);if(!n)return{version:t,ok:!1,note:"not a quarterly version (YYYY-01, -04, -07 or -10)"};let r=new Date(Date.UTC(n.y,n.m-1,1)),o=new Date(Date.UTC(n.y+1,n.m-1,1)),i=(o-e)/(30.44*24*3600*1e3),s=`supported until about ${o.toISOString().slice(0,7)}`;return r>e?s="not released yet (release candidate at best)":i<=0?s="no longer supported: Shopify falls back to the oldest supported version. Upgrade (see README)":i<3&&(s=`${s}: plan the upgrade to ${he(t)} or later (see README)`),{version:t,ok:r<=e&&i>0,monthsLeft:Math.round(i),next:he(t),note:s}}var We=/^[A-Z]{2}$/,ze=new Set(["PT_BR","PT_PT","ZH_CN","ZH_TW"]),ge=()=>`${c.prefix}:market:${c.domain}`,Qe=()=>({document:typeof document!="undefined"?document:null,location:typeof window!="undefined"?window.location:null,storage:(()=>{try{return window.localStorage}catch{return null}})(),global:typeof window!="undefined"?window:{}});function Wt(t){let e=String(t||"").trim().toUpperCase();return We.test(e)&&e!=="XX"&&e!=="T1"?e:null}function zt(t){let e=String(t||"").trim().replace("-","_").toUpperCase();if(!e)return null;if(ze.has(e))return e;let n=e.split("_")[0];return/^[A-Z]{2,3}$/.test(n)?n:null}function Ye(t,e){if(!t||!e)return null;let n=String(t.cookie||"").split(";").map(r=>r.trim()).find(r=>r.startsWith(`${e}=`));return n?decodeURIComponent(n.slice(e.length+1)):null}var Ht=(t,e)=>{if(!t||!e)return null;let n=String(e).toLowerCase(),r=Object.keys(t).find(o=>o.toLowerCase()===n);return r?t[r]:null},Gt={saved(t,e){if(t.remember===!1||!e.storage)return null;try{return JSON.parse(e.storage.getItem(ge())||"null")}catch{return null}},server(t,e){let n=i=>{var s,a,l;return(l=(a=(s=e.document)==null?void 0:s.querySelector)==null?void 0:a.call(s,`meta[name="${i}"]`))==null?void 0:l.getAttribute("content")},r=e.global.TETHER_COUNTRY||n("tether-country")||Ye(e.document,t.cookie||"tether_country"),o=e.global.TETHER_LANGUAGE||n("tether-language");return{country:r,language:o}},webflow(t,e){var a,l,d;let n=(((a=e.location)==null?void 0:a.pathname)||"/").split("/").filter(Boolean)[0],r=Ht(t.locales,n);if(r)return r;let o=(d=(l=e.document)==null?void 0:l.documentElement)==null?void 0:d.getAttribute("lang");if(!o)return null;let i=Ht(t.locales,o)||Ht(t.locales,o.split("-")[0]);if(i)return{locale:o,...i};if(t.locales&&t.strict)return null;let s=o.split("-")[1];return{language:o,country:s&&s.length===2?s:null,locale:o}}};function dt(t=c.markets,e=Qe()){let n=t||{};if(n.detect===!1)return{};let r=n.detect?n.detect===!0?["saved","server","webflow"]:[].concat(n.detect):["saved"];t=n;let o={sources:{}};return r.forEach(i=>{var l;let s=(l=Gt[i])==null?void 0:l.call(Gt,t,e);if(!s)return;let a={country:Wt(s.country),language:zt(s.language),locale:s.locale||null};Object.entries(a).forEach(([d,f])=>{f&&!o[d]&&(o[d]=f,o.sources[d]=i)})}),o}function ye(t){var e;if(((e=c.markets)==null?void 0:e.remember)!==!1)try{localStorage.setItem(ge(),JSON.stringify({country:t.country,language:t.language||void 0}))}catch{}}var lt=null;function be(){lt=null}function Qt(){return lt||(lt=O(`query TetherLocalization {
128
- localization {
129
- country { isoCode name currency { isoCode symbol } }
130
- language { isoCode name }
131
- availableCountries { isoCode name currency { isoCode symbol } availableLanguages { isoCode name } }
132
- }
133
- }`).then(t=>t.localization).catch(t=>{throw lt=null,t})),lt}var Je=t=>t?`${String(t).slice(0,4)}\u2026${String(t).slice(-4)} (${String(t).length} chars)`:"(missing)";function Xe(t){let e=t.id?`#${t.id}`:"",n=t.className&&typeof t.className=="string"?`.${t.className.trim().split(/\s+/).slice(0,2).join(".")}`:"";return`<${t.tagName.toLowerCase()}${e}${n}>`}function Ze(t=document){let e=[],n=(a,l,d)=>e.push({level:a,message:l,element:d?Xe(d):void 0,el:d}),r=a=>!!a.closest(u("product")),o=`${u("collection")},${u("products")},${u("recommendations")}`;w(t,u("product")).forEach(a=>{if(a.closest(o)&&a.closest(u("list")))return;let{key:l,fromUrl:d,raw:f}=nt(a);f?d&&!l&&n("warn",`${y("product")}="${f}" but this URL has no value for it (e.g. ?handle=my-product).`,a):n("error",`${y("product")} has no value. Bind it to the Shopify handle (CMS field), or use "url:handle".`,a)}),["bind","option-list","option","variant-select","add-to-cart","purchase","plan-list","plan","qty","line-attribute"].forEach(a=>{w(t,u(a)).forEach(l=>{r(l)||a==="line-attribute"&&l.closest(u("group"))||n("warn",`${y(a)} outside any ${y("product")}: it does nothing here.`,l)})}),w(t,u("group-add")).forEach(a=>{a.closest(u("group"))||n("warn",`${y("group-add")} outside a ${y("group")}.`,a)}),[...w(t,u("option-list")),...w(t,u("plan-list")),...w(t,u("cart-lines")),...w(t,u("list"))].forEach(a=>{!a.firstElementChild&&!se(a)&&n("warn","Repeater without a template child: put one example element inside it.",a)}),w(t,o).forEach(a=>{w(a,u("list")).length||n("error",`List without a ${y("list")} child: products have nowhere to render.`,a)});let s=new Set(["in-stock","out-of-stock","backorder","low-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","list-empty","list-filled"]);return w(t,u("show")).forEach(a=>{let l=m(a,"show");s.has(l)||n("warn",`Unknown ${y("show")}="${l}".`,a)}),w(t,u("bind")).forEach(a=>{let l=m(a,"bind")||"";if(!l.startsWith("metafield:"))return;let d=l.slice(10);(c.metafields||[]).some(h=>(typeof h=="string"?h:`${h.namespace}.${h.key}`)===d)||n("error",`${y("bind")}="${l}" but "${d}" is not in config.metafields, so it stays empty.`,a)}),w(t,u("cart-open")).length&&!w(t,u("cart-drawer")).length&&n("warn",`${y("cart-open")} exists but there is no ${y("cart-drawer")} on this page.`),w(t,u("cart-drawer")).length>1&&n("warn",`More than one ${y("cart-drawer")}.`),w(t,`[${y("state")}="error"]`).forEach(a=>{a.matches(ut())&&n("error",`Scope failed to load (${m(a,"error")||"error"}).`,a)}),e}async function ve({root:t=document,silent:e=!1,version:n,now:r=new Date}={}){var i,s,a,l,d,f,h;let o={version:n,config:{domain:c.domain||"(missing)",token:Je(c.token),apiVersion:c.apiVersion,endpoint:c.domain?Lt():null,country:c.country,language:c.language,locale:c.locale,markets:c.markets||null,prefix:c.prefix,productPath:c.productPath,metafields:c.metafields,autoMount:c.autoMount,observe:c.observe,onError:typeof c.onError=="function"},apiVersion:me(c.apiVersion,r),market:(i=c.markets)!=null&&i.detect?dt(c.markets):null,reachable:!1,shop:null,latencyMs:null,products:[],sellingPlans:[],problems:[]};if(!it())o.problems.push({level:"error",message:"TETHER_CONFIG needs domain and token."});else{let C=Date.now();try{let $=await O("query TetherDiagnose { shop { name primaryDomain { url } paymentSettings { currencyCode } } }",{},{context:!1});o.reachable=!0,o.shop={name:(s=$.shop)==null?void 0:s.name,url:(l=(a=$.shop)==null?void 0:a.primaryDomain)==null?void 0:l.url,currency:(f=(d=$.shop)==null?void 0:d.paymentSettings)==null?void 0:f.currencyCode}}catch($){let q=$.status===401||$.status===403?"Token rejected: use the public Storefront token from the Headless channel, not an Admin token.":$.status===404?"Store or API version not found: check domain (x.myshopify.com) and apiVersion.":"";o.problems.push({level:"error",message:`Storefront API not reachable: ${$.message}${q?`. ${q}`:""}`})}if(o.latencyMs=Date.now()-C,o.reachable){let $=[...new Set(w(t,u("product")).map(T=>nt(T).key).filter(Boolean))].slice(0,20);(await Promise.allSettled($.map(T=>B(T)))).forEach((T,b)=>{var p,P;if(T.status==="fulfilled"){let v=T.value,N=F(v);o.products.push({key:$[b],handle:v.handle,title:v.title,plans:N.length,requiresSellingPlan:v.requiresSellingPlan}),N.forEach(x=>{var _;return o.sellingPlans.push({product:v.handle,group:(_=x.group)==null?void 0:_.name,plan:x.name,id:x.id})})}else o.products.push({key:$[b],error:(p=T.reason)==null?void 0:p.message}),o.problems.push({level:"error",message:`Product "${$[b]}": ${(P=T.reason)==null?void 0:P.message}. Is it published to the Headless channel?`})})}}return(!o.apiVersion.ok||((h=o.apiVersion.monthsLeft)!=null?h:99)<3)&&o.problems.push({level:o.apiVersion.ok?"warn":"error",message:`apiVersion ${c.apiVersion}: ${o.apiVersion.note}`}),typeof document!="undefined"&&o.problems.push(...Ze(t)),e||tn(o),o}function tn(t){var r,o,i;let e=console,n=t.problems.filter(s=>s.level==="error").length;(r=e.group)==null||r.call(e,`[${c.prefix}] diagnose: ${n?`${n} error(s)`:"no errors"}, ${t.problems.length-n} warning(s)`),e.log("version",t.version,"| API",t.apiVersion.version,`(${t.apiVersion.note})`),e.log("config",t.config),t.market&&e.log("market detected",t.market,"(in use:",t.config.country,t.config.language,")"),e.log(t.reachable?`Storefront API reachable: ${(o=t.shop)==null?void 0:o.name} (${t.latencyMs} ms)`:"Storefront API NOT reachable"),t.products.length&&(e.table||e.log)(t.products),t.sellingPlans.length?(e.table||e.log)(t.sellingPlans):t.reachable&&e.log("No selling plans on the products of this page."),t.problems.forEach(s=>(s.level==="error"?e.error:e.warn)(s.message,s.el||"")),(i=e.groupEnd)==null||i.call(e)}var $e="0.3.6",Et=new WeakSet,we=new WeakSet,xt=new Set,At=new Set,Pe=new WeakMap;function xe(){xt.forEach(t=>{t.isConnected||xt.delete(t)}),At.forEach(t=>{t.root.isConnected||At.delete(t)})}var Z=null,Yt=null;function St(t,e){var n;return[...(n=t.matches)!=null&&n.call(t,e)?[t]:[],...w(t,e)]}function kt(t=document){if(!it())return 0;let e=0;return xe(),St(t,ot()).forEach(n=>{if(we.has(n))return;we.add(n),e++;let r=new Ct(n);At.add(r),n.addEventListener(`${c.prefix}:list-rendered`,o=>kt(o.detail.container)),r.load()}),St(t,u("product")).forEach(n=>{Ae(n)&&e++}),Jt(t),w(t,u("account-link")).forEach(n=>{n.setAttribute("href",`https://${c.domain}/account`)}),A.render(),D(`mounted ${e} scope(s)`,t),e}function Ae(t){if(Et.has(t))return!1;let{key:e,fromUrl:n,raw:r}=nt(t);if(!e)return n?(Et.add(t),Y(t,"not-found"),S("product-not-found",{key:null,source:r},t)):t.closest(ot())||M(`[${y("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,t),!1;Et.add(t),xt.add(t);let o={};Pe.set(t,o);let i=()=>Pe.get(t)===o;return rt.get(t)?t.setAttribute(y("state"),"updating"):Y(t,"loading"),B(e).then(s=>{if(!i())return;let a=rt.get(t);a?a.update(s):new Pt(t,s),en(t,s)}).catch(s=>{if(!i())return;let a=wt(s);Y(t,a?"not-found":"error",s),a?(S("product-not-found",{key:e,source:r},t),n?D(`product not found: ${e}`):k(s,`product ${e}`)):(k(s,`product ${e}`),S("error",{error:s,context:"product",key:e},t))}),!0}function Jt(t=document){let e=St(t,`select${u("country-select")}`),n=St(t,u("country-bind"));return!e.length&&!n.length?Promise.resolve():Qt().then(r=>{var l;let o=(c.country||((l=r.country)==null?void 0:l.isoCode)||"").toUpperCase(),i=[...r.availableCountries||[]].sort((d,f)=>d.name.localeCompare(f.name,c.locale||void 0)),s=i.find(d=>d.isoCode===o)||r.country,a=(d,f)=>{var h,C;return d.replace(/\{name\}/g,f.name).replace(/\{code\}/g,f.isoCode).replace(/\{currency\}/g,((h=f.currency)==null?void 0:h.isoCode)||"").replace(/\{symbol\}/g,((C=f.currency)==null?void 0:C.symbol)||"")};e.forEach(d=>{let f=d.getAttribute(y("country-label"))||"{name} ({currency})";d.innerHTML="",i.forEach(h=>d.appendChild(new Option(a(f,h),h.isoCode))),d.value=o,d.value!==o&&(d.selectedIndex=-1),d.disabled=i.length<2&&!d.hasAttribute(y("always-enabled"))}),n.forEach(d=>{var C,$;let f=m(d,"country-bind")||"name",h={name:s==null?void 0:s.name,code:s==null?void 0:s.isoCode,currency:(C=s==null?void 0:s.currency)==null?void 0:C.isoCode,symbol:($=s==null?void 0:s.currency)==null?void 0:$.symbol}[f];d.textContent=h||""})}).catch(r=>k(r,"country select"))}async function Se(t,{language:e,remember:n=!0}={}){let r=Wt(t);if(!r)throw new L(`Not a country code: ${t}`,{code:"INVALID_COUNTRY"});let o=e===void 0?c.language:zt(e),i=r!==String(c.country||"").toUpperCase()||o!==c.language;if(c.country=r,c.language=o||void 0,n&&ye({country:r,language:o}),!i)return Jt(),A.state;Vt();let s=[];return e!==void 0&&be(),A.id()&&s.push(A.setBuyerIdentity({countryCode:r},{create:!1}).catch(a=>k(a,"cart country"))),xe(),At.forEach(a=>s.push(a.load())),xt.forEach(a=>{a.closest(ot())||(Et.delete(a),Ae(a))}),Jt(),S("country-changed",{country:r,language:c.language}),await Promise.all(s),A.state}function en(t,e){let n=m(t,"page-title");!n||typeof document=="undefined"||(document.title=n.replace(/\{title\}/g,e.title).replace(/\{vendor\}/g,e.vendor||"").replace(/\{type\}/g,e.productType||""))}function nn(){A.close()}function rn(t){var n;let e=(n=t==null?void 0:t.closest)==null?void 0:n.call(t,u("product"));return e&&rt.get(e)||null}var Ce=!1;function on(){Ce||(Ce=!0,document.addEventListener("click",t=>{var a;let e=t.target;if(!(e!=null&&e.closest))return;if(e.closest(u("cart-open"))){t.preventDefault(),A.toggle();return}if(e.closest(u("cart-close"))){t.preventDefault(),A.close();return}let n=e.closest(u("cart-clear"));if(n){t.preventDefault(),H(n,()=>A.clear().catch(l=>k(l,"cart clear")));return}let r=e.closest(u("checkout"));if(r){t.preventDefault(),H(r,()=>A.checkout());return}let o=e.closest(Ee());if(o&&o.closest(u("cart-lines"))){let l=o.getAttribute(`data-${c.prefix}-key`),d=A.lines.find(h=>h.id===l),f=h=>{t.preventDefault(),h().catch(C=>k(C,"cart line"))};if(e.closest(u("line-remove")))return f(()=>A.removeLine(l));if(d&&e.closest(u("line-plus")))return f(()=>A.updateLine(l,d.quantity+1));if(d&&e.closest(u("line-minus")))return f(()=>A.updateLine(l,d.quantity-1))}let i=e.closest(u("discount-remove"));if(i){t.preventDefault();let l=(a=i.closest(u("discount-code")))==null?void 0:a.getAttribute(y("discount-code"));l&&A.removeDiscount(l).catch(d=>k(d,"discount"));return}let s=e.closest(u("group-add"));s&&(t.preventDefault(),H(s,()=>ke(s)))}),document.addEventListener("change",t=>{let e=t.target;if(!(e!=null&&e.closest))return;let n=e.closest(Ee()),r=n==null?void 0:n.getAttribute(`data-${c.prefix}-key`);r&&e.matches(`input${u("line","quantity")}`)?A.updateLine(r,parseInt(e.value,10)||0).catch(o=>k(o,"cart line")):r&&e.matches(`select${u("line-plan")}`)?A.updateLine(r,{sellingPlanId:e.value||null}).catch(o=>k(o,"cart line plan")):e.matches(`select${u("country-select")}`)?e.value&&Se(e.value).catch(o=>k(o,"country")):e.matches(u("cart-note"))&&A.setNote(e.value).catch(o=>k(o,"cart note"))}),document.addEventListener("submit",t=>{var o,i;let e=(i=(o=t.target).closest)==null?void 0:i.call(o,u("discount-form"));if(!e)return;t.preventDefault();let n=e.querySelector(u("discount-input"))||e.querySelector("input"),r=n==null?void 0:n.value.trim();r&&H(e,async()=>{var s;try{let a=await A.applyDiscount(r),l=(s=((a==null?void 0:a.discountCodes)||[]).find(d=>d.code.toLowerCase()===r.toLowerCase()))==null?void 0:s.applicable;e.classList.toggle("is-invalid",!l),S(l?"discount-applied":"discount-invalid",{code:r},e),l&&n&&(n.value="")}catch(a){e.classList.add("is-invalid"),k(a,"discount")}})}),document.addEventListener("keydown",t=>{t.key==="Escape"&&A.isOpen()&&A.close()}))}function Ee(){return`[data-${c.prefix}-key]`}async function ke(t){let e=t.closest(u("group"));if(!e)return null;let n=m(e,"group"),r=Q($t(e,"line-attributes")),o=n?[{key:"_group",value:n},...r]:r,i=w(e,u("product")).map(s=>rt.get(s)).filter(s=>{var a;return s&&((a=s.variant)==null?void 0:a.availableForSale)&&s.quantity>0}).map(s=>{let a=s.getLine();return a.attributes=[...a.attributes||[],...o],a});if(!i.length)return M("group-add: nothing selected"),null;try{let s=await A.add(i);return S("group-added",{group:n,lines:i},e),s}catch(s){return k(s,"group add"),null}}function Ie(t={}){var n;if(Z&&!Object.keys(t).length)return Z;if(te({...window.TETHER_CONFIG||{},...t}),!it())return M("TETHER_CONFIG is missing domain or token. Tether is idle."),Z=Promise.resolve(null),Z;let e=dt(c.markets);return e.country&&(c.country=e.country),e.language&&(c.language=e.language),e.locale&&!t.locale&&!((n=window.TETHER_CONFIG)!=null&&n.locale)&&(c.locale=e.locale),e.sources&&Object.keys(e.sources).length&&D("market",e),on(),c.observe&&sn(),Z=A.init().then(async r=>{var i;let o=c.country?String(c.country).toUpperCase():null;if(r&&o&&((i=r.buyerIdentity)!=null&&i.countryCode)&&r.buyerIdentity.countryCode!==o)try{r=await A.setBuyerIdentity({countryCode:o},{create:!1})}catch(s){k(s,"cart country")}return S("ready",{cart:r}),Xt}),Z}function sn(){if(Yt||typeof MutationObserver=="undefined")return;let t=null,e=new Set;Yt=new MutationObserver(n=>{n.forEach(r=>r.addedNodes.forEach(o=>{o.nodeType===1&&e.add(o)})),clearTimeout(t),t=setTimeout(()=>{e.forEach(r=>{r.isConnected&&kt(r)}),e.clear()},50)}),Yt.observe(document.body,{childList:!0,subtree:!0})}var Xt={VERSION:$e,init:Ie,mount:kt,unmount:nn,get config(){return c},get ready(){return Z||Promise.resolve(null)},query:O,withContext:qt,cart:A,getProduct:B,getProducts:ht,getRecommendations:ft,getScope:rn,addGroup:ke,primeProduct:tt,normalizeProductKey:Ut,clearProductCache:Vt,formatMoney:I,plans:jt,TetherError:L,resolveProductKey:nt,setCountry:Se,detectMarket:t=>dt(t||c.markets),getLocalization:Qt,diagnose:t=>ve({...t,version:$e}),on(t,e){let n=r=>e(r.detail,r);return document.addEventListener(`${c.prefix}:${t}`,n),()=>document.removeEventListener(`${c.prefix}:${t}`,n)}},cr=Xt;if(typeof window!="undefined"&&typeof document!="undefined"&&(window.Tether=Xt,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1)){let e=()=>Ie().then(()=>kt(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e,{once:!0}):e()}})();
3
+ image { ${W} }
4
+ seo { title description }`}var Xt={};_(Xt,{clearProductCache:()=>Yt,getProduct:()=>V,getProducts:()=>ct,getRecommendations:()=>lt,normalizeProductKey:()=>kt,primeProduct:()=>Z});var J=new Map,Ae=[],Wt=new Map,Jt=!1,at=0,zt=e=>typeof e=="string"&&e.startsWith("gid://");function kt(e){let t=String(e??"").trim();if(!t)return null;if(zt(t))return t;if(/^\d+$/.test(t))return`gid://shopify/Product/${t}`;let r=t.match(/\/products\/([^/?#]+)/);return r?r[1]:t}function Z(e){if(!e)return;let t=Promise.resolve(e);J.set(e.handle,t),J.set(e.id,t)}function V(e){let t=kt(e);if(!t)return Promise.reject(new I("empty product key",{code:"NOT_FOUND"}));if(J.has(t))return J.get(t);let r=new Promise((n,i)=>{Wt.set(t,{resolve:n,reject:i}),Ae.push(t),Jt||(Jt=!0,setTimeout(Ke,0))});return J.set(t,r),r}async function Ke(){Jt=!1;let e=at,t=Ae.splice(0);if(!t.length)return;let r=t.filter(zt),n=t.filter(b=>!zt(b)),i=[],s=[],o={};r.length&&(i.push("$ids: [ID!]!"),o.ids=r,s.push("byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }")),n.forEach((b,p)=>{i.push(`$h${p}: String!`),o[`h${p}`]=b,s.push(`h${p}: product(handle: $h${p}) { ...TetherProduct }`)});let l=`query TetherProducts(${i.join(",")}){${s.join(" ")}}${ot()}`;L("fetch products",t);let f=(b,p)=>{let m=Wt.get(b);Wt.delete(b),m&&p(m)};try{let b=await T(l,o),p=new Map;(b.byId||[]).forEach(m=>{m&&p.set(m.id,m)}),n.forEach((m,C)=>{b[`h${C}`]&&p.set(m,b[`h${C}`])}),t.forEach(m=>f(m,C=>{p.has(m)?(e===at&&Z(p.get(m)),C.resolve(p.get(m))):(e===at&&J.delete(m),C.reject(new I(`Product not found: ${m}`,{code:"NOT_FOUND"})))}))}catch(b){t.forEach(p=>f(p,m=>{e===at&&J.delete(p),m.reject(b)}))}}function Yt(){J.clear(),at++}async function ct({collection:e,query:t,first:r=c.collectionFirst,after:n=null,sortKey:i,reverse:s=!1,filters:o}={}){let l=ot();if(e){let b=await T(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${Gt()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}${l}`,{handle:e,first:r,after:n,sortKey:i||void 0,reverse:s,filters:o||void 0});if(!b.collection)throw new I(`Collection not found: ${e}`,{code:"NOT_FOUND"});let{products:p,...m}=b.collection;return p.nodes.forEach(Z),{collection:m,products:p.nodes,pageInfo:p.pageInfo}}let f=await T(`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}}}${l}`,{first:r,after:n,query:t||void 0,sortKey:i||void 0,reverse:s});return f.products.nodes.forEach(Z),{collection:null,products:f.products.nodes,pageInfo:f.products.pageInfo}}async function lt(e,t="RELATED"){let n=(await T(`query TetherRecs($id:ID!,$intent:ProductRecommendationIntent){productRecommendations(productId:$id,intent:$intent){...TetherProduct}}${ot()}`,{id:e,intent:t})).productRecommendations||[];return n.forEach(Z),n}var pt={};_(pt,{GID:()=>j,allPlans:()=>R,allocationFor:()=>N,findPlan:()=>dt,hasPlans:()=>Be,planAdjustment:()=>te,planCheckoutCharge:()=>Zt,planPrice:()=>ut,planSavings:()=>Lt,plansForVariant:()=>He,toGid:()=>Tt});var j={product:e=>Tt(e,"Product"),variant:e=>Tt(e,"ProductVariant"),sellingPlan:e=>Tt(e,"SellingPlan")};function Tt(e,t){let r=String(e??"").trim();return r?r.startsWith("gid://")?r:/^\d+$/.test(r)?`gid://shopify/${t}/${r}`:r:null}function R(e){return(e?.sellingPlanGroups?.nodes||[]).flatMap(r=>(r.sellingPlans?.nodes||[]).map(n=>({...n,group:r})))}function Be(e){return R(e).length>0}function N(e,t){return!e||!t?null:(e.sellingPlanAllocations?.nodes||[]).find(r=>r.sellingPlan?.id===t)||null}function He(e,t){return R(e).filter(r=>N(t,r.id))}function ut(e,t){let n=N(e,t)?.priceAdjustments?.[0];return n?.perDeliveryPrice||n?.price||e?.price||null}function Zt(e,t){let r=N(e,t);return r?.checkoutChargeAmount||r?.priceAdjustments?.[0]?.price||e?.price||null}function Lt(e,t){let r=parseFloat(e?.price?.amount),n=parseFloat(ut(e,t)?.amount);return!Number.isFinite(r)||!Number.isFinite(n)||r<=0||n>=r?{amount:null,percentage:0}:{amount:{amount:(r-n).toFixed(2),currencyCode:e.price.currencyCode},percentage:Math.round((1-n/r)*100)}}function te(e){let t=e?.priceAdjustments?.[0]?.adjustmentValue;if(!t)return null;switch(t.__typename){case"SellingPlanPercentagePriceAdjustment":return{type:"percentage",value:t.adjustmentPercentage};case"SellingPlanFixedAmountPriceAdjustment":return{type:"amount",value:t.adjustmentAmount};case"SellingPlanFixedPriceAdjustment":return{type:"price",value:t.price};default:return null}}function dt(e,t){if(!t)return null;let r=R(e),n=j.sellingPlan(t),i=String(t).trim().toLowerCase();return r.find(s=>s.id===n)||r.find(s=>s.name.toLowerCase()===i)||r.find(s=>(s.options||[]).some(o=>String(o.value).toLowerCase()===i))||null}var se={};_(se,{attr:()=>h,busy:()=>M,cdnUrl:()=>Se,dataKey:()=>Ce,emit:()=>w,formatDate:()=>re,formatMoney:()=>q,get:()=>d,has:()=>z,hasTemplate:()=>Ge,notifyLayoutChanged:()=>K,parseJSONAttr:()=>mt,productUrl:()=>ft,qsa:()=>$,readText:()=>ee,repeat:()=>U,repeatKeyed:()=>ne,scoped:()=>Y,sel:()=>a,setImage:()=>F,setSelected:()=>ht,setText:()=>A,setTextTracked:()=>tt,show:()=>D,toAttributes:()=>B,watchImages:()=>ie});var h=e=>`${c.prefix}-${e}`,a=(e,t)=>t===void 0?`[${h(e)}]`:`[${h(e)}="${t}"]`,d=(e,t)=>e.getAttribute(h(t)),z=(e,t)=>e.hasAttribute(h(t)),Ce=()=>`data-${c.prefix}-key`;function ft(e,t){let r=c.productPath||"/product";if(!/\{(handle|id)\}/.test(r))return`${r.replace(/\/$/,"")}/${e}`;let n=t?String(t).split("/").pop():"";return r.replace(/\{handle\}/g,encodeURIComponent(e||"")).replace(/\{id\}/g,encodeURIComponent(n))}var $=(e,t)=>e?[...e.querySelectorAll(t)]:[],Y=(e,t,r)=>$(e,t).filter(n=>n.closest(r)===e);function w(e,t,r=document){r.dispatchEvent(new CustomEvent(`${c.prefix}:${e}`,{detail:t,bubbles:!0}))}function q(e){if(!e)return"";if(typeof c.formatMoney=="function")return c.formatMoney(e,c.locale);let t=parseFloat(e.amount);if(Number.isNaN(t))return"";try{return new Intl.NumberFormat(c.locale||void 0,{style:"currency",currency:e.currencyCode}).format(t)}catch{return`${e.currencyCode} ${t.toFixed(2)}`}}function re(e){if(!e)return"";try{return new Date(e).toLocaleDateString(c.locale||void 0)}catch{return""}}function Se(e,t){if(!e||!t)return e;let r=t.getAttribute("max-width"),n=t.getAttribute("max-height"),i=t.getAttribute("crop");if(!r&&!n)return e;try{let s=new URL(e);return r&&s.searchParams.set("width",r),n&&s.searchParams.set("height",n),i&&s.searchParams.set("crop",i),s.toString()}catch{return e}}function F(e,t,r){if(!t)return;let n=Se(t,e);e.tagName==="IMG"?(e.removeAttribute("srcset"),e.removeAttribute("sizes"),e.setAttribute("src",n),r!=null&&e.setAttribute("alt",r),e.getAttribute("loading")||e.setAttribute("loading","lazy")):e.style.backgroundImage=`url("${n}")`}function A(e,t){let r=t==null?"":String(t);e.tagName==="INPUT"||e.tagName==="TEXTAREA"?e.value=r:e.textContent=r}var ee=e=>e.tagName==="INPUT"||e.tagName==="TEXTAREA"?e.value:e.textContent;function tt(e,t){let r=ee(e);A(e,t);let n=ee(e);if(r!==n&&e.dataset.tetherSeen&&typeof c.onValueChange=="function")try{c.onValueChange(e,r)}catch{}e.dataset.tetherSeen="1"}function D(e,t){let r="tetherPrevDisplay";t?e.dataset[r]!==void 0?(e.style.display=e.dataset[r],delete e.dataset[r]):e.style.display==="none"&&(e.style.display=""):(e.dataset[r]===void 0&&(e.dataset[r]=e.style.display||""),e.style.display="none")}function ht(e,t){e.classList.toggle("is-selected",t),e.setAttribute("aria-pressed",t?"true":"false"),e.tagName==="INPUT"&&(e.type==="radio"||e.type==="checkbox")&&(e.checked=t);let r=e.querySelector?.('input[type="radio"],input[type="checkbox"]');r&&(r.checked=t)}var qt=new WeakMap,Ge=e=>!!qt.get(e);function Ie(e){if(!qt.has(e)){let t=e.firstElementChild?.cloneNode(!0)??null;qt.set(e,t),e.innerHTML=""}return qt.get(e)}function U(e,t,r){let n=Ie(e);if(!n){O("repeater without a template child",e);return}e.innerHTML="",t.forEach((i,s)=>{let o=n.cloneNode(!0);r(o,i,s),e.appendChild(o)})}function ne(e,t,r,n,{onEnter:i,onLeave:s}={}){let o=Ie(e);if(!o){O("repeater without a template child",e);return}let l=Ce(),f=`data-${c.prefix}-leaving`,b=()=>[...e.children].filter(y=>y.hasAttribute(l)&&!y.hasAttribute(f)),p=new Map(b().map(y=>[y.getAttribute(l),y])),m=[],C=new Set;t.forEach((y,u)=>{let g=String(r(y,u)),E=p.get(g);E?p.delete(g):(E=o.cloneNode(!0),E.setAttribute(l,g),C.add(E)),n(E,y,u,C.has(E)),m.push(E)});let S=m.filter(y=>!C.has(y)),st=b().filter(y=>S.includes(y));if(!(st.length===S.length&&st.every((y,u)=>y===S[u]))){p.forEach(y=>y.remove()),m.forEach(y=>e.appendChild(y));return}m.forEach((y,u)=>{if(!C.has(y))return;let g=m[u-1];if(g&&g.parentNode===e?g.after(y):e.prepend(y),i)try{i(y)}catch{}}),p.forEach(y=>{y.setAttribute(f,""),y.removeAttribute(l),y.style.pointerEvents="none",y.inert=!0;let u=()=>y.remove();if(s)try{s(y,u)}catch{u()}else u()})}var Ee=null;function K(e){clearTimeout(Ee),Ee=setTimeout(()=>{typeof c.onLayoutChange=="function"?c.onLayoutChange(e):window.ScrollTrigger?.refresh&&window.ScrollTrigger.refresh(),w("layout-changed",{reason:e})},120)}function ie(e,t){let r=$(e,"img").filter(s=>!s.complete);if(!r.length)return;let n=r.length,i=()=>{--n===0&&K(`${t}:images`)};r.forEach(s=>{s.addEventListener("load",i,{once:!0}),s.addEventListener("error",i,{once:!0})})}function M(e,t){return e.getAttribute("aria-busy")==="true"?Promise.resolve():(e.setAttribute("aria-busy","true"),Promise.resolve().then(t).finally(()=>e.removeAttribute("aria-busy")))}function mt(e,t){let r=e&&d(e,t);if(!r)return null;try{return JSON.parse(r)}catch{return O(`invalid JSON in ${h(t)}`,e),null}}function B(e){return e?Array.isArray(e)?e.map(t=>({key:String(t.key),value:String(t.value??"")})):Object.entries(e).map(([t,r])=>({key:t,value:String(r??"")})):[]}function Te(e,t=1,r={}){let n=typeof e=="object"&&e!==null?e:{variantId:e,quantity:t,...r},i=j.variant(n.merchandiseId||n.variantId||n.id);if(!i)throw new I("add(): variantId is required");let s={merchandiseId:i,quantity:Math.max(1,parseInt(n.quantity??1,10)||1)},o=n.sellingPlanId||n.sellingPlan;o&&(s.sellingPlanId=j.sellingPlan(o));let l=B(n.attributes);return l.length&&(s.attributes=l),s}function ke(e,t,r){return`mutation Tether_${e}(${t}){${e}(${r}){cart{...TetherCart}userErrors{field message}}}${It()}`}var Qe='a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])',Ot=null,Ft=e=>$(e,Qe).filter(t=>t.offsetParent!==null||t===document.activeElement);function oe(e){$(document,a("cart-open")).forEach(t=>t.setAttribute("aria-expanded",String(e))),$(document,a("cart-drawer")).forEach(t=>{t.hasAttribute("role")||t.setAttribute("role","dialog"),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-label",d(t,"cart-label")||"Cart"),t.setAttribute("aria-modal",String(e)),t.classList.contains(c.cartDrawerOpenClass)||t.setAttribute("aria-hidden","true")})}var ae=e=>/does not exist|not found|invalid id/i.test(e?.message||""),P={state:null,_chain:Promise.resolve(),id(){try{return localStorage.getItem(c.storageKey)}catch{return null}},_setId(e){try{e?localStorage.setItem(c.storageKey,e):localStorage.removeItem(c.storageKey)}catch{}},get lines(){return this.state?.lines?.nodes||[]},get count(){return this.state?.totalQuantity||0},lastError:null,_queue(e){let t=this._chain.then(e,e).then(r=>(this.lastError&&(this.lastError=null,this.render()),r),r=>{throw this.lastError=r,this.render(),w("cart-error",{error:r}),r});return this._chain=t.catch(()=>{}),t},_commit(e,t){return this.state=e,e?.id&&this._setId(e.id),this.render(),w("cart-updated",{cart:e,reason:t}),e},async init(){let e=this.id();if(!e)return this.state=null,this.render(),null;try{let t=await T(`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${It()}`,{id:e});t.cart?this.state=t.cart:(this._setId(null),this.state=null)}catch(t){x(t,"cart load failed"),this.lastError=t,ae(t)&&this._setId(null),this.state=null}return this.render(),this.state},async _create(e={}){let t=c.country?{countryCode:String(c.country).toUpperCase()}:void 0,r=await T(ke("cartCreate","$input: CartInput!","input: $input"),{input:{buyerIdentity:t,...e}});return St(r.cartCreate,"cartCreate").cart},async _mutate(e,t,r,n,i){let s=this.id();if(!s)return i?this._create(i):null;try{let o=await T(ke(e,`$cartId: ID!, ${t}`,`cartId: $cartId, ${r}`),{...n,cartId:s});return St(o[e],e).cart}catch(o){if(i&&ae(o))return L("cart expired, creating a new one"),this._setId(null),this._create(i);throw o}},add(e,t=1,r={}){let n=(Array.isArray(e)?e:[e]).map(i=>Te(i,t,r));return this._queue(async()=>{let i=await this._mutate("cartLinesAdd","$lines: [CartLineInput!]!","lines: $lines",{lines:n},{lines:n});return this._commit(i,"add"),w("added",{cart:i,lines:n}),c.openCartOnAdd&&this.open(),i})},updateLine(e,t){let r=typeof t=="number"?{quantity:t}:{...t};if(r.quantity!==void 0&&r.quantity<=0)return this.removeLine(e);let n={id:e};return r.quantity!==void 0&&(n.quantity=r.quantity),"sellingPlanId"in r&&(n.sellingPlanId=r.sellingPlanId?j.sellingPlan(r.sellingPlanId):null),r.attributes&&(n.attributes=B(r.attributes)),(r.merchandiseId||r.variantId)&&(n.merchandiseId=j.variant(r.merchandiseId||r.variantId)),this._queue(async()=>this._commit(await this._mutate("cartLinesUpdate","$lines: [CartLineUpdateInput!]!","lines: $lines",{lines:[n]}),"update"))},removeLine(e){let t=Array.isArray(e)?e:[e];return this._queue(async()=>this._commit(await this._mutate("cartLinesRemove","$lineIds: [ID!]!","lineIds: $lineIds",{lineIds:t}),"remove"))},clear(){let e=this.lines.map(t=>t.id);return e.length?this.removeLine(e):Promise.resolve(this.state)},setNote(e){return this._queue(async()=>this._commit(await this._mutate("cartNoteUpdate","$note: String!","note: $note",{note:e??""},{note:e??""}),"note"))},setAttributes(e){let t=new Map((this.state?.attributes||[]).map(n=>[n.key,n.value]));B(e).forEach(n=>t.set(n.key,n.value));let r=[...t].filter(([,n])=>n!=="").map(([n,i])=>({key:n,value:i}));return this._queue(async()=>this._commit(await this._mutate("cartAttributesUpdate","$attributes: [AttributeInput!]!","attributes: $attributes",{attributes:r},{attributes:r}),"attributes"))},setDiscountCodes(e){let t=(Array.isArray(e)?e:[e]).map(r=>String(r).trim()).filter(Boolean);return this._queue(async()=>this._commit(await this._mutate("cartDiscountCodesUpdate","$discountCodes: [String!]!","discountCodes: $discountCodes",{discountCodes:t},{discountCodes:t}),"discount"))},applyDiscount(e){let t=(this.state?.discountCodes||[]).map(r=>r.code);return this.setDiscountCodes([...new Set([...t,e])])},removeDiscount(e){return this.setDiscountCodes((this.state?.discountCodes||[]).map(t=>t.code).filter(t=>t!==e))},setBuyerIdentity(e,{create:t=!0}={}){return this._queue(async()=>{let r=await this._mutate("cartBuyerIdentityUpdate","$buyerIdentity: CartBuyerIdentityInput!","buyerIdentity: $buyerIdentity",{buyerIdentity:e},t?{buyerIdentity:e}:null).catch(n=>{if(t||!ae(n))throw n;return this._setId(null),null});return this._commit(r,"buyer-identity")})},async checkout(e=c.checkoutTarget){let t=this.id();if(!t)return null;let r=e==="_blank"?window.open("","_blank"):null;if(r)try{r.opener=null}catch{}try{let i=(await T("query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }",{id:t})).cart?.checkoutUrl;if(!i)throw new I("No checkoutUrl (cart empty or expired)");return w("checkout",{url:i,cart:this.state}),r&&!r.closed?r.location.href=i:window.location.href=i,i}catch(n){return r&&r.close(),x(n,"checkout failed"),null}},drawers(){return $(document,a("cart-drawer"))},isOpen(){return this.drawers().some(e=>e.classList.contains(c.cartDrawerOpenClass))},open(){if(this.isOpen())return;let e=this.drawers().filter(t=>d(t,"cart-drawer")!=="manual");e.forEach(t=>{t.classList.add(c.cartDrawerOpenClass),t.setAttribute("aria-hidden","false")}),oe(!0),c.cartFocus!==!1&&e[0]&&(Ot=document.activeElement,setTimeout(()=>{let t=Ft(e[0])[0]||e[0];t===e[0]&&!e[0].hasAttribute("tabindex")&&(e[0].tabIndex=-1),t.focus?.({preventScroll:!0})},60)),typeof c.onCartOpen=="function"&&c.onCartOpen(e),w("cart-toggled",{open:!0})},close(){if(!this.isOpen())return;let e=this.drawers(),t=e.some(r=>r.contains(document.activeElement));e.forEach(r=>{r.classList.remove(c.cartDrawerOpenClass),r.setAttribute("aria-hidden","true")}),oe(!1),t&&Ot?.isConnected&&Ot.focus({preventScroll:!0}),Ot=null,typeof c.onCartClose=="function"&&c.onCartClose(e),w("cart-toggled",{open:!1})},toggle(){this.isOpen()?this.close():this.open()},render(){let e=this.state,t=e?e.totalQuantity:0,r=s=>e?q(e.cost?.[s]):"";oe(this.isOpen()),$(document,a("cart-count")).forEach(s=>tt(s,t)),$(document,a("cart-subtotal")).forEach(s=>tt(s,r("subtotalAmount"))),$(document,a("cart-total")).forEach(s=>tt(s,r("totalAmount"))),$(document,a("cart-checkout-charge")).forEach(s=>tt(s,r("checkoutChargeAmount")));let n=this.lines.some(s=>s.sellingPlanAllocation),i={"cart-empty":t===0,"cart-filled":t>0,"cart-has-subscription":n,"cart-no-subscription":!n,"cart-has-discount":(e?.discountCodes||[]).some(s=>s.applicable),"cart-error":!!this.lastError};$(document,a("show")).forEach(s=>{let o=d(s,"show");o in i&&!s.closest(a("product"))&&D(s,i[o])}),$(document,`textarea${a("cart-note")},input${a("cart-note")}`).forEach(s=>{document.activeElement!==s&&(s.value=e?.note||"")}),$(document,a("cart-discounts")).forEach(s=>{U(s,e?.discountCodes||[],(o,l)=>{o.setAttribute(h("discount-code"),l.code);let f=o.querySelector(a("discount","code"))||(o.firstElementChild?null:o);f&&A(f,l.code),o.classList.toggle("is-inapplicable",!l.applicable)})}),$(document,a("cart-lines")).forEach(s=>{ne(s,this.lines,o=>o.id,(o,l)=>Je(o,l),{onEnter:c.onLineEnter,onLeave:c.onLineLeave})}),e&&K("cart")}};function We(e,t){let r=e.merchandise||{},n=e.sellingPlanAllocation?.sellingPlan;switch(t){case"title":return r.product?.title;case"product-title":return r.product?.title;case"variant-title":return r.title==="Default Title"?"":r.title;case"options":return(r.selectedOptions||[]).filter(i=>i.value!=="Default Title").map(i=>`${i.name}: ${i.value}`).join(", ");case"vendor":return r.product?.vendor;case"sku":return r.sku;case"price":return q(e.cost?.amountPerQuantity||r.price);case"compare-at-price":return q(e.cost?.compareAtAmountPerQuantity||r.compareAtPrice);case"line-total":return q(e.cost?.totalAmount);case"line-subtotal":return q(e.cost?.subtotalAmount);case"quantity":return e.quantity;case"plan":return n?.name||"";case"plan-description":return n?.description||"";case"components":return(e.lineComponents||[]).map(i=>`${i.quantity} \xD7 ${i.merchandise?.product?.title||""}`).join(", ");default:if(t.startsWith("attribute:")){let i=t.slice(10);return(e.attributes||[]).find(s=>s.key===i)?.value||""}return}}function Je(e,t){let r=t.merchandise||{},n=!!t.sellingPlanAllocation;e.setAttribute(h("line-id"),t.id),e.classList.toggle("is-subscription",n),$(e,a("line")).forEach(s=>{let o=d(s,"line");if(o==="image")return F(s,r.image?.url||r.product?.featuredImage?.url,r.product?.title);if(o==="url")return s.setAttribute("href",ft(r.product?.handle,r.product?.id));let l=We(t,o);l!==void 0&&tt(s,l)});let i={subscription:n,"one-time":!n,"on-sale":parseFloat(t.cost?.compareAtAmountPerQuantity?.amount)>parseFloat(t.cost?.amountPerQuantity?.amount),"has-components":(t.lineComponents||[]).length>0};$(e,a("line-show")).forEach(s=>{let o=d(s,"line-show");o in i&&D(s,i[o])}),$(e,`select${a("line-plan")}`).forEach(s=>{let o=r.product?.handle;o&&V(o).then(l=>{let f=R(l),p=[...!l.requiresSellingPlan&&d(s,"line-plan")!=="subscription-only"?[{value:"",label:s.getAttribute(h("one-time-label"))||"One-time purchase"}]:[],...f.map(C=>({value:C.id,label:C.name}))],m=p.map(C=>C.value).join("|");s.dataset.tetherSig!==m&&(s.innerHTML="",p.forEach(C=>{let S=document.createElement("option");S.value=C.value,S.textContent=C.label,s.appendChild(S)}),s.dataset.tetherSig=m),s.value=t.sellingPlanAllocation?.sellingPlan?.id||"",D(s,f.length>0)}).catch(l=>x(l,"line plan options"))})}var de={};_(de,{ProductScope:()=>bt,scopes:()=>X});var ue={};_(ue,{STATUS_KEYS:()=>Nt,boundary:()=>_t,isNotFound:()=>yt,ownedBy:()=>le,resolveProductKey:()=>gt,setScopeStatus:()=>H});function gt(e,t=window.location){let r=(d(e,"product")||"").trim();if(!r.toLowerCase().startsWith("url:"))return{key:r||null,fromUrl:!1,raw:r};let n=r.slice(4).trim(),i=null;if(n.toLowerCase()==="path"){let s=t.pathname.split("/").filter(Boolean);i=s.length?ze(s[s.length-1]):null}else i=new URLSearchParams(t.search).get(n||"handle");return i=i&&i.trim()?i.trim():null,{key:i,fromUrl:!0,raw:r}}function ze(e){try{return decodeURIComponent(e)}catch{return e}}var Nt=["loading","ready","error","not-found"],yt=e=>e?.code==="NOT_FOUND",_t=()=>["product","collection","products","recommendations"].map(e=>a(e)).join(","),le=(e,t)=>e===t||e.parentElement?.closest(_t())===t;function H(e,t,r){let n=t==="not-found";e.setAttribute(h("state"),n?"error":t),t==="error"||n?e.setAttribute(h("error"),n?"not-found":r?.code||"error"):e.removeAttribute(h("error")),Y(e,a("show"),_t()).forEach(i=>{let s=d(i,"show");if(!Nt.includes(s))return;let o=s===t;D(i,o),o&&typeof getComputedStyle=="function"&&getComputedStyle(i).display==="none"&&(i.style.display=i.getAttribute(h("display"))||"block")}),(t==="error"||n)&&Y(e,a("add-to-cart"),_t()).forEach(i=>{i.classList.add("is-disabled"),i.setAttribute("aria-disabled","true"),"disabled"in i&&(i.disabled=!0)})}var X=new WeakMap,Le=()=>a("product");function Ye(e,t){let r=t.indexOf("."),n=t.slice(0,r),i=t.slice(r+1);return(e.metafields||[]).find(o=>o&&o.namespace===n&&o.key===i)||null}var bt=class{constructor(t,r){this.root=t,this.product=r,this.selected={},this.variant=null,this.quantity=Math.max(0,parseInt(d(t,"quantity")??"1",10)||(z(t,"quantity")?0:1)),this.plans=R(r),this.purchase="one-time",this.planId=null,X.set(t,this),t.setAttribute(h("state"),"ready"),t.removeAttribute(h("error")),this.initSelection(),this.initPurchase(),this.renderProduct(),this.bind(),this.renderVariant(),ie(t,"product"),K("product"),w("product-ready",{product:r,scope:this},t)}update(t){let r=this.variant?.id;this.product=t,this.plans=R(t),this.planId&&!this.plans.some(i=>i.id===this.planId)&&(this.planId=this.plans[0]?.id||null),!this.plans.length&&this.purchase==="subscription"&&(this.purchase="one-time");let n=t.variants.nodes.find(i=>i.id===r);n&&(this.selected={},n.selectedOptions.forEach(i=>{this.selected[i.name]=i.value})),this.root.setAttribute(h("state"),"ready"),this.root.removeAttribute(h("error")),this.renderProduct(),this.renderVariant(),K("product"),w("product-updated",{product:t,scope:this},this.root)}$(t){let r=Y(this.root,t,Le());return this.root.matches(t)?[this.root,...r]:r}initSelection(){let t=this.product.variants.nodes,r=t.find(i=>i.availableForSale)||t[0];r&&r.selectedOptions.forEach(i=>{this.selected[i.name]=i.value});let n=new URLSearchParams(window.location.search).get("variant")||d(this.root,"variant");if(n){let i=j.variant(n),s=t.find(o=>o.id===i);s&&(this.selected={},s.selectedOptions.forEach(o=>{this.selected[o.name]=o.value}))}}initPurchase(){if(!this.plans.length)return;let t=new URLSearchParams(window.location.search),r=dt(this.product,t.get("selling_plan")),n=dt(this.product,d(this.root,"default-plan"));this.planId=(r||n||this.plans[0]).id;let i=r?"subscription":d(this.root,"default-purchase")||c.defaultPurchase;this.purchase=this.product.requiresSellingPlan||i==="subscription"?"subscription":"one-time"}findVariant(){return this.product.variants.nodes.find(t=>t.selectedOptions.every(r=>this.selected[r.name]===r.value))||null}isValueAvailable(t,r){return this.product.variants.nodes.some(n=>n.availableForSale&&n.selectedOptions.every(i=>i.name===t?i.value===r:this.selected[i.name]===i.value))}get plan(){return this.plans.find(t=>t.id===this.planId)||null}get subscriptionAvailable(){return!!(this.variant&&this.plans.some(t=>N(this.variant,t.id)))}get isSubscription(){return this.purchase==="subscription"&&!!N(this.variant,this.planId)}getLine(){if(!this.variant)return null;let t={merchandiseId:this.variant.id,quantity:this.quantity};this.isSubscription&&(t.sellingPlanId=this.planId);let r=this.collectAttributes();return r.length&&(t.attributes=r),t}collectAttributes(){let t=B(mt(this.root,"line-attributes")),r=this.$(a("line-attribute")).map(n=>{let i=d(n,"line-attribute"),s;return n.type==="checkbox"?s=n.checked?n.value&&n.value!=="on"?n.value:"Yes":"":n.type==="radio"?s=n.checked?n.value:null:s=n.value,s==null||s===""?null:{key:i,value:String(s)}}).filter(Boolean);return[...t,...r]}select(t,r){this.selected[t]!==r&&(this.selected[t]=r,this.renderVariant())}selectVariant(t){let r=this.product.variants.nodes.find(n=>n.id===j.variant(t));r&&(this.selected={},r.selectedOptions.forEach(n=>{this.selected[n.name]=n.value}),this.renderVariant())}setPurchase(t){let r=t==="subscription"?"subscription":"one-time";r==="one-time"&&this.product.requiresSellingPlan||this.purchase!==r&&(this.purchase=r,this.renderVariant())}selectPlan(t){let r=dt(this.product,t);r&&(this.planId=r.id,this.purchase="subscription",this.renderVariant())}setQuantity(t){let r=z(this.root,"quantity")?0:1;this.quantity=Math.max(r,parseInt(t,10)||0),this.$(a("qty")).forEach(n=>A(n,this.quantity)),this.renderVariant()}async addToCart(){if(!this.variant?.availableForSale)return null;let t=this.getLine();if(!t||t.quantity<1)return null;let r=await P.add(t);return w("product-added",{product:this.product,variant:this.variant,line:t},this.root),r}bind(){let t=r=>r&&r.closest(Le())===this.root;this.root.addEventListener("click",r=>{let n=r.target;if(!n?.closest)return;let i=n.closest(a("option-value"));if(t(i)&&i.closest(a("option-list"))){r.preventDefault(),this.select(d(i.closest(a("option-list")),"option-list"),d(i,"option-value"));return}let s=n.closest(a("plan-value"));if(t(s)){r.preventDefault(),this.selectPlan(d(s,"plan-value"));return}let o=n.closest(`${a("purchase")}:not(select)`);if(t(o)){o.tagName!=="INPUT"&&r.preventDefault(),this.setPurchase(d(o,"purchase"));return}let l=n.closest(a("qty-plus"));if(t(l)){r.preventDefault(),this.setQuantity(this.quantity+1);return}let f=n.closest(a("qty-minus"));if(t(f)){r.preventDefault(),this.setQuantity(this.quantity-1);return}let b=n.closest(a("add-to-cart"));t(b)&&(r.preventDefault(),this.onAddClick(b))}),this.root.addEventListener("change",r=>{let n=r.target;t(n)&&(n.matches(`select${a("option")}`)?this.select(d(n,"option"),n.value):n.matches(`select${a("variant-select")}`)?this.selectVariant(n.value):n.matches(`select${a("plan")}`)?n.value?this.selectPlan(n.value):this.setPurchase("one-time"):n.matches(`select${a("purchase")}`)?this.setPurchase(n.value):n.matches(a("qty"))&&this.setQuantity(n.value))})}onAddClick(t){let r=t.querySelector(a("add-label"))||t,n=d(t,"adding-text"),i=s=>A(r,s);r.dataset.tetherLabel===void 0&&(r.dataset.tetherLabel=r.tagName==="INPUT"?r.value:r.textContent),M(t,async()=>{n&&i(n);try{await this.addToCart()}catch(s){x(s,"add to cart failed"),w("error",{error:s,context:"add-to-cart"},this.root)}finally{n&&i(r.dataset.tetherLabel)}}).then(()=>{this.renderVariant()})}renderProduct(){let t=this.product;this.$(a("bind")).forEach(r=>{let n=d(r,"bind")||"",i={title:t.title,"description-text":t.description,vendor:t.vendor,type:t.productType,handle:t.handle}[n];if(i!==void 0)return A(r,i);switch(n){case"description":r.innerHTML=t.descriptionHtml||"";return;case"published-at":return A(r,re(t.publishedAt));case"min-price":return A(r,q(t.priceRange.minVariantPrice));case"max-price":return A(r,q(t.priceRange.maxVariantPrice));case"featured-image":return F(r,t.featuredImage?.url,t.featuredImage?.altText||t.title);case"url":case"link":r.setAttribute("href",ft(t.handle,t.id)),n==="url"&&!r.firstElementChild&&!r.textContent.trim()&&A(r,t.title);return;case"images":return U(r,t.images.nodes,(s,o)=>{let l=s.matches(`img,${a("bind","image")}`)?s:s.querySelector("img")||s;F(l,o.url,o.altText||t.title)});case"tags":{let s=(r.getAttribute("exclude")||"").split(",").map(o=>o.trim()).filter(Boolean);return U(r,t.tags.filter(o=>!s.includes(o)),(o,l)=>A(o,l))}default:if(/^image:\d+$/.test(n)){let s=t.images.nodes[n.slice(6)-1]||t.featuredImage;return F(r,s?.url,s?.altText||t.title)}if(n.startsWith("metafield:")){let s=Ye(t,n.slice(10));return s?s.reference?.image?F(r,s.reference.image.url,s.reference.image.altText):(/^(rich_text|multi_line_text)_field$/.test(s.type)&&(r.style.whiteSpace="pre-line"),A(r,s.value)):A(r,"")}return}}),this.$(a("option-list")).forEach(r=>{let n=d(r,"option-list"),i=t.options.find(s=>s.name===n);return!i||i.optionValues.length<=1&&z(r,"hide-single")?D(r,!1):U(r,i.optionValues,(s,o)=>{s.setAttribute(h("option-value"),o.name);let l=s.querySelector(a("bind","option-value"));l?A(l,o.name):s.firstElementChild||A(s,o.name);let f=s.querySelector(a("bind","swatch"));f&&o.swatch?.color&&(f.style.backgroundColor=o.swatch.color),f&&o.swatch?.image?.previewImage&&F(f,o.swatch.image.previewImage.url,o.name)})}),this.$(`select${a("option")}`).forEach(r=>{let n=t.options.find(i=>i.name===d(r,"option"));if(!n)return D(r,!1);r.innerHTML="",n.optionValues.forEach(i=>r.appendChild(new Option(i.name,i.name)))}),this.$(`select${a("variant-select")}`).forEach(r=>{r.innerHTML="",t.variants.nodes.forEach(n=>r.appendChild(new Option(n.title,n.id)))}),this.$(a("plan-list")).forEach(r=>{let n=(d(r,"plan-list")||"").trim(),i=["","true","all","*"].includes(n.toLowerCase())?null:n,s=this.plans.filter(o=>!i||o.group.name===i);U(r,s,(o,l)=>{o.setAttribute(h("plan-value"),l.id),!o.firstElementChild&&!o.querySelector(a("plan-bind"))&&A(o,l.name)})}),this.$(`select${a("plan")}`).forEach(r=>{r.innerHTML="",!t.requiresSellingPlan&&d(r,"plan")!=="subscription-only"&&r.appendChild(new Option(r.getAttribute(h("one-time-label"))||"One-time purchase","")),this.plans.forEach(n=>r.appendChild(new Option(n.name,n.id)))})}renderVariant(){let t=this.product,r=this.findVariant();if(r||([r]=t.variants.nodes,r&&(this.selected={},r.selectedOptions.forEach(u=>{this.selected[u.name]=u.value}))),this.variant=r,!r)return;if(this.plans.length&&!N(r,this.planId)){let u=this.plans.find(g=>N(r,g.id));u&&(this.planId=u.id)}let n=this.isSubscription,i=r.price,s=this.planId?ut(r,this.planId):null,o=n?s:i,l=n&&N(r,this.planId)?.priceAdjustments?.[0]?.compareAtPrice||r.compareAtPrice,f=l&&parseFloat(l.amount)>parseFloat(o.amount),b=f?Math.round((1-parseFloat(o.amount)/parseFloat(l.amount))*100):0,p=this.planId?Lt(r,this.planId):{amount:null,percentage:0},m=this.plan,C={amount:(parseFloat(o.amount)*Math.max(1,this.quantity)).toFixed(2),currencyCode:o.currencyCode},S=q,st=u=>u?`${u}%`:"",Vt={price:()=>S(o),"total-price":()=>S(C),"one-time-price":()=>S(i),"subscription-price":()=>S(s),"subscription-savings":()=>st(p.percentage),"subscription-savings-amount":()=>S(p.amount),"checkout-charge":()=>S(n?Zt(r,this.planId):o),"plan-name":()=>m?.name,"plan-description":()=>m?.description,"plan-group":()=>m?.group?.name,"compare-at-price":()=>f?S(l):"","unit-price":()=>S(r.unitPrice),"discount-percentage":()=>`${b}%`,"discount-amount":()=>f?S({amount:String(parseFloat(l.amount)-parseFloat(o.amount)),currencyCode:o.currencyCode}):"","variant-title":()=>r.title,"variant-id":()=>r.id,sku:()=>r.sku,barcode:()=>r.barcode,stock:()=>r.quantityAvailable,quantity:()=>this.quantity};this.$(a("bind")).forEach(u=>{let g=d(u,"bind");g==="variant-image"?F(u,r.image?.url||t.featuredImage?.url,r.image?.altText||t.title):Vt[g]&&A(u,Vt[g]())}),this.$(a("option-selected")).forEach(u=>A(u,this.selected[d(u,"option-selected")]||"")),this.$(a("option-list")).forEach(u=>{let g=d(u,"option-list");$(u,a("option-value")).forEach(E=>{let G=d(E,"option-value");ht(E,this.selected[g]===G);let k=!this.isValueAvailable(g,G);E.classList.toggle("is-unavailable",k),E.setAttribute("data-unavailable",k?"true":"false")})}),this.$(`select${a("option")}`).forEach(u=>{u.value=this.selected[d(u,"option")]||""}),this.$(`select${a("variant-select")}`).forEach(u=>{u.value=r.id}),this.$(a("purchase")).forEach(u=>{if(u.tagName==="SELECT"){u.value=this.purchase;return}let g=d(u,"purchase");ht(u,g===this.purchase);let E=g==="subscription"?!this.subscriptionAvailable:t.requiresSellingPlan;u.classList.toggle("is-unavailable",E)}),this.$(a("plan-value")).forEach(u=>{let g=d(u,"plan-value"),E=this.plans.find(k=>k.id===g),G=!!N(r,g);ht(u,n&&g===this.planId),u.classList.toggle("is-unavailable",!G),$(u,a("plan-bind")).forEach(k=>{let Q=te(E),be=Lt(r,g),Me=d(k,"plan-bind"),ve={name:()=>E?.name,description:()=>E?.description,price:()=>S(ut(r,g)),savings:()=>st(be.percentage),"savings-amount":()=>S(be.amount),adjustment:()=>Q?Q.type==="percentage"?`${Q.value}%`:S(Q.value):""}[Me];ve&&A(k,ve())})}),this.$(`select${a("plan")}`).forEach(u=>{u.value=n?this.planId:""});let y={"in-stock":r.availableForSale,"out-of-stock":!r.availableForSale,backorder:r.availableForSale&&r.currentlyNotInStock,"on-sale":!!f,"not-on-sale":!f,"has-variants":t.variants.nodes.length>1,"single-variant":t.variants.nodes.length===1,"low-stock":r.quantityAvailable!=null&&r.quantityAvailable>0&&r.quantityAvailable<=5,"subscription-available":this.subscriptionAvailable,"subscription-unavailable":!this.subscriptionAvailable,"subscription-only":!!t.requiresSellingPlan,"one-time-available":!t.requiresSellingPlan,"subscription-selected":n,"one-time-selected":!n,"has-savings":n?p.percentage>0:!!f,loading:!1,ready:!0,error:!1,"not-found":!1};this.$(a("show")).forEach(u=>{let g=d(u,"show");g in y&&(Nt.includes(g)&&!le(u,this.root)||D(u,y[g]))}),this.root.classList.toggle("is-subscription",n),this.root.setAttribute(h("purchase-mode"),n?"subscription":"one-time"),this.$(a("add-to-cart")).forEach(u=>{let g=!r.availableForSale;u.classList.toggle("is-disabled",g),u.setAttribute("aria-disabled",String(g)),"disabled"in u&&(u.disabled=g);let E=d(u,"soldout-text"),G=d(u,"subscribe-text");if(E||G){let k=u.querySelector(a("add-label"))||u;k.dataset.tetherLabel===void 0&&(k.dataset.tetherLabel=k.tagName==="INPUT"?k.value:k.textContent);let Q=k.dataset.tetherLabel;n&&G&&(Q=G),g&&E&&(Q=E),u.getAttribute("aria-busy")!=="true"&&A(k,Q)}}),w("variant-changed",{product:t,variant:r,selected:{...this.selected},purchase:this.purchase,sellingPlanId:n?this.planId:null},this.root)}};var pe={};_(pe,{ListScope:()=>vt,listSelector:()=>et});var et=()=>`${a("collection")},${a("products")},${a("recommendations")}`,vt=class{constructor(t){this.root=t,this.products=[],this.pageInfo=null,this.collection=null,H(t,"loading"),t.addEventListener("click",r=>{let n=r.target.closest?.(a("load-more"));n&&n.closest(et())===t&&(r.preventDefault(),M(n,()=>this.load(!0)))})}$(t){return Y(this.root,t,et())}options(){let t=this.root,r={first:parseInt(d(t,"limit")||"",10)||void 0,sortKey:d(t,"sort")||void 0,reverse:d(t,"reverse")==="true"};return z(t,"collection")?r.collection=d(t,"collection"):r.query=d(t,"products")||"",r}async load(t=!1){let r=this.loadToken=(this.loadToken||0)+1,n=()=>r!==this.loadToken;try{if(z(this.root,"recommendations")){let i=d(this.root,"recommendations"),s=await V(i),o=await lt(s.id,d(this.root,"intent")||"RELATED");if(n())return;let l=parseInt(d(this.root,"limit")||"",10);this.products=l?o.slice(0,l):o}else{let i=await ct({...this.options(),after:t?this.pageInfo?.endCursor:null});if(n())return;this.collection=i.collection,this.pageInfo=i.pageInfo,this.products=t?[...this.products,...i.products]:i.products}this.render(),H(this.root,"ready"),w("list-ready",{products:this.products,collection:this.collection},this.root)}catch(i){if(n())return;t||H(this.root,yt(i)?"not-found":"error",i),x(i,"list load failed"),w("error",{error:i,context:"list"},this.root)}}render(){let t=this.collection;this.$(a("collection-bind")).forEach(n=>{switch(d(n,"collection-bind")){case"title":return A(n,t?.title||"");case"description":n.innerHTML=t?.descriptionHtml||"";return;case"image":return F(n,t?.image?.url,t?.image?.altText||t?.title);case"count":return A(n,this.products.length);default:return}}),this.$(a("list")).forEach(n=>{U(n,this.products,(i,s)=>{i.setAttribute(h("product"),s.handle),i.removeAttribute(h("state"))}),w("list-rendered",{container:n},this.root)});let r=this.products.length===0;this.$(a("show")).forEach(n=>{let i=d(n,"show");i==="list-empty"&&(n.style.display=r?"":"none"),i==="list-filled"&&(n.style.display=r?"none":"")}),this.$(a("load-more")).forEach(n=>{n.style.display=this.pageInfo?.hasNextPage?"":"none"}),K("list")}};var he={};_(he,{liveLists:()=>it,liveProducts:()=>wt,mountProduct:()=>Ut,mountedLists:()=>Dt,mountedProducts:()=>$t,pruneLive:()=>jt,retryFailed:()=>fe,within:()=>Pt});var $t=new WeakSet,Dt=new WeakSet,wt=new Set,it=new Set,qe=new WeakMap;function jt(){wt.forEach(e=>{e.isConnected||wt.delete(e)}),it.forEach(e=>{e.root.isConnected||it.delete(e)})}function Pt(e,t){return[...e.matches?.(t)?[e]:[],...$(e,t)]}function Ut(e){if($t.has(e))return!1;let{key:t,fromUrl:r,raw:n}=gt(e);if(!t)return r?($t.add(e),H(e,"not-found"),w("product-not-found",{key:null,source:n},e)):e.closest(et())||O(`[${h("product")}] without a value. Bind it to the Shopify handle field, or use "url:handle".`,e),!1;$t.add(e),wt.add(e);let i={};qe.set(e,i);let s=()=>qe.get(e)===i;return X.get(e)?e.setAttribute(h("state"),"updating"):H(e,"loading"),V(t).then(o=>{if(!s())return;let l=X.get(e);l?l.update(o):new bt(e,o),Xe(e,o)}).catch(o=>{if(!s())return;let l=yt(o);H(e,l?"not-found":"error",o),l?(w("product-not-found",{key:t,source:n},e),r?L(`product not found: ${t}`):x(o,`product ${t}`)):(x(o,`product ${t}`),w("error",{error:o,context:"product",key:t},e))}),!0}function Xe(e,t){let r=d(e,"page-title");!r||typeof document>"u"||(document.title=r.replace(/\{title\}/g,t.title).replace(/\{vendor\}/g,t.vendor||"").replace(/\{type\}/g,t.productType||""))}function fe(){jt(),wt.forEach(e=>{e.getAttribute(h("state"))!=="error"||e.getAttribute(h("error"))==="not-found"||($t.delete(e),Ut(e))})}var{cfg:Ze}=Et,Oe={"config.js":Et,"client.js":Ht,"dom.js":se,"fragments.js":Qt,"loader.js":Xt,"selling-plans.js":pt,"status.js":ue,"cart.js":ce,"product.js":de,"collection.js":pe,"mounting.js":he},me=typeof document<"u"&&document.currentScript?.src||"",xt={};function rt(e){if(xt[e])return xt[e];let t=Ze.partsUrl||me.replace(/[^/]*$/,""),r=/\.min\.js(\?|$)/.test(me)||!me?".min":"",n=`${t.replace(/\/?$/,"/")}tether.${e}${r}.js`;return xt[e]=new Promise((i,s)=>{let o=document.createElement("script");o.src=n,o.async=!0,o.onload=()=>window.Tether?.__parts?.[e]?i(window.Tether.__parts[e]):s(new Error(`${n} did not register`)),o.onerror=()=>{delete xt[e],s(new Error(`Could not load ${n}. Host it next to the Tether script, or set partsUrl.`))},document.head.appendChild(o)}),xt[e]}var Fe="0.4.0",nt=null,ge=null;function Mt(e=document){if(!At())return 0;let t=0;return jt(),Pt(e,et()).forEach(r=>{if(Dt.has(r))return;Dt.add(r),t++;let n=new vt(r);it.add(n),r.addEventListener(`${c.prefix}:list-rendered`,i=>Mt(i.detail.container)),n.load()}),Pt(e,a("product")).forEach(r=>{Ut(r)&&t++}),Pt(e,`${a("country-select")},${a("country-bind")}`).length&&rt("markets").then(r=>r.renderCountrySelects(e)).catch(r=>x(r,"markets")),$(e,a("account-link")).forEach(r=>{r.setAttribute("href",`https://${c.domain}/account`)}),P.render(),L(`mounted ${t} scope(s)`,e),t}function tr(){P.close()}function er(e){let t=e?.closest?.(a("product"));return t&&X.get(t)||null}var _e=!1;function rr(){_e||(_e=!0,document.addEventListener("click",e=>{let t=e.target;if(!t?.closest)return;if(t.closest(a("cart-open"))){e.preventDefault(),P.toggle();return}if(t.closest(a("cart-close"))){e.preventDefault(),P.close();return}let r=t.closest(a("cart-clear"));if(r){e.preventDefault(),M(r,()=>P.clear().catch(l=>x(l,"cart clear")));return}let n=t.closest(a("checkout"));if(n){e.preventDefault(),M(n,()=>P.checkout());return}let i=t.closest(Ne());if(i&&i.closest(a("cart-lines"))){let l=i.getAttribute(`data-${c.prefix}-key`),f=P.lines.find(p=>p.id===l),b=p=>{e.preventDefault(),p().catch(m=>x(m,"cart line"))};if(t.closest(a("line-remove")))return b(()=>P.removeLine(l));if(f&&t.closest(a("line-plus")))return b(()=>P.updateLine(l,f.quantity+1));if(f&&t.closest(a("line-minus")))return b(()=>P.updateLine(l,f.quantity-1))}let s=t.closest(a("discount-remove"));if(s){e.preventDefault();let l=s.closest(a("discount-code"))?.getAttribute(h("discount-code"));l&&P.removeDiscount(l).catch(f=>x(f,"discount"));return}let o=t.closest(a("group-add"));o&&(e.preventDefault(),M(o,()=>De(o)))}),document.addEventListener("change",e=>{let t=e.target;if(!t?.closest)return;let n=t.closest(Ne())?.getAttribute(`data-${c.prefix}-key`);n&&t.matches(`input${a("line","quantity")}`)?P.updateLine(n,parseInt(t.value,10)||0).catch(i=>x(i,"cart line")):n&&t.matches(`select${a("line-plan")}`)?P.updateLine(n,{sellingPlanId:t.value||null}).catch(i=>x(i,"cart line plan")):t.matches(`select${a("country-select")}`)?t.value&&Ue(t.value).catch(i=>x(i,"country")):t.matches(a("cart-note"))&&P.setNote(t.value).catch(i=>x(i,"cart note"))}),document.addEventListener("submit",e=>{let t=e.target.closest?.(a("discount-form"));if(!t)return;e.preventDefault();let r=t.querySelector(a("discount-input"))||t.querySelector("input"),n=r?.value.trim();n&&M(t,async()=>{try{let s=((await P.applyDiscount(n))?.discountCodes||[]).find(o=>o.code.toLowerCase()===n.toLowerCase())?.applicable;t.classList.toggle("is-invalid",!s),w(s?"discount-applied":"discount-invalid",{code:n},t),s&&r&&(r.value="")}catch(i){t.classList.add("is-invalid"),x(i,"discount")}})}),window.addEventListener("online",()=>{fe(),it.forEach(e=>{e.root.getAttribute(h("state"))==="error"&&e.load()})}),document.addEventListener("keydown",e=>{if(!P.isOpen())return;if(e.key==="Escape"){P.close();return}if(e.key!=="Tab"||c.cartFocus===!1)return;let t=P.drawers().find(s=>s.classList.contains(c.cartDrawerOpenClass)),r=t?Ft(t):[];if(!r.length)return;let n=r[0],i=r[r.length-1];(!t.contains(document.activeElement)||e.shiftKey&&document.activeElement===n||!e.shiftKey&&document.activeElement===i)&&(e.preventDefault(),(e.shiftKey?i:n).focus())}))}function Ne(){return`[data-${c.prefix}-key]`}async function De(e){let t=e.closest(a("group"));if(!t)return null;let r=d(t,"group"),n=B(mt(t,"line-attributes")),i=r?[{key:"_group",value:r},...n]:n,s=$(t,a("product")).map(o=>X.get(o)).filter(o=>o&&o.variant?.availableForSale&&o.quantity>0).map(o=>{let l=o.getLine();return l.attributes=[...l.attributes||[],...i],l});if(!s.length)return O("group-add: nothing selected"),null;try{let o=await P.add(s);return w("group-added",{group:r,lines:s},t),o}catch(o){return x(o,"group add"),null}}function je(e={}){return nt&&!Object.keys(e).length?nt:(Kt({...window.TETHER_CONFIG||{},...e}),At()?(rr(),c.observe&&ir(),nt=nr(e).then(()=>P.init()).then(async t=>{let r=c.country?String(c.country).toUpperCase():null;if(t&&r&&t.buyerIdentity?.countryCode&&t.buyerIdentity.countryCode!==r)try{t=await P.setBuyerIdentity({countryCode:r},{create:!1})}catch(n){x(n,"cart country")}return w("ready",{cart:t}),ye}),nt):(O("TETHER_CONFIG is missing domain or token. Tether is idle."),nt=Promise.resolve(null),nt))}async function nr(e){let t=c.markets||{};if(t.detect===!1)return;let r=null;if(t.detect)try{r=(await rt("markets")).detectMarket(t)}catch(n){x(n,"markets");return}else if(t.remember!==!1){try{r=JSON.parse(localStorage.getItem(`${c.prefix}:market:${c.domain}`)||"null")}catch{}r&&!/^[A-Z]{2}$/.test(r.country||"")&&(r=null)}r&&(r.country&&(c.country=r.country),r.language&&(c.language=r.language),r.locale&&!e.locale&&!window.TETHER_CONFIG?.locale&&(c.locale=r.locale),L("market",r))}function Ue(e,t){return rt("markets").then(r=>r.setCountry(e,t))}function ir(){if(ge||typeof MutationObserver>"u")return;let e=null,t=new Set;ge=new MutationObserver(r=>{r.forEach(n=>n.addedNodes.forEach(i=>{i.nodeType===1&&t.add(i)})),clearTimeout(e),e=setTimeout(()=>{t.forEach(n=>{n.isConnected&&Mt(n)}),t.clear()},50)}),ge.observe(document.body,{childList:!0,subtree:!0})}var ye={VERSION:Fe,init:je,mount:Mt,unmount:tr,get config(){return c},get ready(){return nt||Promise.resolve(null)},query:T,withContext:Ct,cart:P,getProduct:V,getProducts:ct,getRecommendations:lt,getScope:er,addGroup:De,primeProduct:Z,normalizeProductKey:kt,clearProductCache:Yt,formatMoney:q,plans:pt,TetherError:I,resolveProductKey:gt,setCountry:Ue,detectMarket:e=>rt("markets").then(t=>t.detectMarket(e||c.markets)),getLocalization:()=>rt("markets").then(e=>e.getLocalization()),diagnose:e=>rt("diagnose").then(t=>t.diagnose({...e,version:Fe})),__core:Oe,__parts:{},on(e,t){let r=n=>t(n.detail,n);return document.addEventListener(`${c.prefix}:${e}`,r),()=>document.removeEventListener(`${c.prefix}:${e}`,r)}},Gr=ye;if(typeof window<"u"&&typeof document<"u"&&(window.Tether=ye,window.TETHER_CONFIG&&window.TETHER_CONFIG.autoMount!==!1)){let t=()=>je().then(()=>Mt(document));document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}})();
134
5
  //# sourceMappingURL=tether.min.js.map