@shopify/hydrogen 2024.4.2 → 2024.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/development/index.cjs +295 -148
- package/dist/development/index.cjs.map +1 -1
- package/dist/development/index.js +293 -147
- package/dist/development/index.js.map +1 -1
- package/dist/production/index.cjs +86 -85
- package/dist/production/index.cjs.map +1 -1
- package/dist/production/index.d.cts +38 -13
- package/dist/production/index.d.ts +38 -13
- package/dist/production/index.js +38 -38
- package/dist/production/index.js.map +1 -1
- package/dist/vite/plugin.js +18 -15
- package/dist/vite/request-events.js +4 -3
- package/dist/vite/virtual-routes/routes/index.jsx +0 -10
- package/package.json +8 -6
- package/dist/vite/virtual-routes/components/IconDiscord.jsx +0 -21
|
@@ -4,23 +4,22 @@ var hydrogenReact = require('@shopify/hydrogen-react');
|
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var react$1 = require('@remix-run/react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
7
|
+
var cookie = require('worktop/cookie');
|
|
8
|
+
var ka = require('content-security-policy-builder');
|
|
9
9
|
|
|
10
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
var Ur__default = /*#__PURE__*/_interopDefault(Ur);
|
|
12
|
+
var ka__default = /*#__PURE__*/_interopDefault(ka);
|
|
14
13
|
|
|
15
|
-
var
|
|
14
|
+
var Jr=Object.defineProperty;var Yr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Xr=(e,t)=>{for(var r in t)Jr(e,r,{get:t[r],enumerable:!0});};var or={};Xr(or,{default:()=>tr,logSeoTags:()=>rr});function tr({headTags:e}){return rr(e),null}function rr(e){console.log(" "),console.log("%cSEO Meta Tags",`${To}`),console.log(" "),e.forEach(t=>{if(t.tag==="script"){if(console.log("%c\u2022 JSON LD ",lt),t.children)try{console.table(JSON.parse(t.children),["name","content"]);}catch{console.log(t.children);}}else {if(console.log(`%c\u2022 ${t.tag} `,lt),t.children)if(typeof t.children=="string")console.log(`\u21B3 ${t.children}`);else try{Object.entries(JSON.parse(t.children)).map(([r,o])=>console.log(`\u21B3 ${o}`));}catch{console.log(t.children);}if(t.props.property==="og:image:url"){let r=t.props.content;vo(r).then(o=>{let a=`font-size: 400px; padding: 10px; background: white url(${o}) no-repeat center; background-size: contain;`;console.log("%c\u2022 Share image preview",lt),console.log("%c ",a),console.log(`\u21B3 ${r}`);}).catch(o=>{console.error(o);});}Object.entries(t.props).map(([r,o])=>{console.log(`\u21B3 ${r} \u2192 ${o}`);});}console.log(" ");});}async function vo(e){let o=await(await(await fetch(e)).blob()).arrayBuffer();return `data:image/png;base64,${Io(o)}`}function Io(e){let t="",r=new Uint8Array(e),o=r.byteLength;for(let a=0;a<o;a++)t+=String.fromCharCode(r[a]);return btoa(t)}var lt,To,ar=Yr(()=>{lt="text-transform: uppercase;",To="text-transform: uppercase; font-weight: bold; text-transform: uppercase;font-weight: bold";});function _t(e){let t=Array.isArray(e)?e:[e],r="";for(let o of t)o!=null&&(typeof o=="object"?r+=JSON.stringify(o):r+=o.toString());return encodeURIComponent(r)}var Ee="public",Zr="private",Ge="no-store",Ut={maxAge:"max-age",staleWhileRevalidate:"stale-while-revalidate",sMaxAge:"s-maxage",staleIfError:"stale-if-error"};function fe(e){let t=[];return Object.keys(e).forEach(r=>{r==="mode"?t.push(e[r]):Ut[r]&&t.push(`${Ut[r]}=${e[r]}`);}),t.join(", ")}function We(){return {mode:Ge}}function je(e){if(e?.mode&&e?.mode!==Ee&&e?.mode!==Zr)throw Error("'mode' must be either 'public' or 'private'")}function oe(e){return je(e),{mode:Ee,maxAge:1,staleWhileRevalidate:9,...e}}function Ke(e){return je(e),{mode:Ee,maxAge:3600,staleWhileRevalidate:82800,...e}}function ae(e){return je(e),{mode:Ee,maxAge:1,staleWhileRevalidate:86399,...e}}function ze(e){return e}function K(e){return String(e).includes("__proto__")?JSON.parse(e,eo):JSON.parse(e)}function eo(e,t){if(e!=="__proto__")return t}function xe(e,t){return e&&t?{...e,...t}:e||ae()}function Je(e){return fe(xe(e))}async function to(e,t){if(!e)return;let r=await e.match(t);if(!r){return}return r}async function ro(e,t,r,o){if(!e)return;let a=xe(o),n=Je(xe(a,{maxAge:(a.maxAge||0)+(a.staleWhileRevalidate||0)})),i=Je(xe(a));r.headers.set("cache-control",n),r.headers.set("real-cache-control",i),r.headers.set("cache-put-date",new Date().toUTCString()),await e.put(t,r);}async function oo(e,t){e&&await e.delete(t);}function ao(e,t){let r=e.headers.get("real-cache-control"),o=0;if(r){let n=r.match(/max-age=(\d*)/);n&&n.length>1&&(o=parseFloat(n[1]));}return [(new Date().valueOf()-new Date(t).valueOf())/1e3,o]}function no(e,t){let r=t.headers.get("cache-put-date");if(!r)return !1;let[o,a]=ao(t,r),n=o>a;return n}var De={get:to,set:ro,delete:oo,generateDefaultCacheControlHeader:Je,isStale:no};function me(e){return `https://shopify.dev/?${e}`}function io(e){return e||ae()}async function Nt(e,t){if(!e)return;let r=me(t),o=new Request(r),a=await De.get(e,o);if(!a)return;let n=await a.text();try{return [K(n),a]}catch{return [n,a]}}async function Mt(e,t,r,o){if(!e)return;let a=me(t),n=new Request(a),i=new Response(JSON.stringify(r));await De.set(e,n,i,io(o));}function Vt(e,t){return De.isStale(new Request(me(e)),t)}function Ft(e,t){return [e,{status:t.status,statusText:t.statusText,headers:Array.from(t.headers.entries())}]}function $t([e,t]){return [e,new Response(e,t)]}var qt=(e,t)=>!e?.errors&&t.status<400,Ye=new Set;async function Xe(e,t,{strategy:r=oe(),cacheInstance:o,shouldCacheResult:a=()=>!0,waitUntil:n,debugInfo:i}){let c=_t([...typeof e=="string"?[e]:e]),y=f=>{({displayName:f.displayName,url:f.response?.url,responseInit:{status:f.response?.status||0,statusText:f.response?.statusText||"",headers:Array.from(f.response?.headers.entries()||[])}});},l=void 0;if(!o||!r||r.mode===Ge){let f=await t({addDebugData:y});return f}let d=f=>Mt(o,c,{value:f,debugInfo:void 0},r),g=await Nt(o,c);if(g&&typeof g[0]!="string"){let[{value:f,debugInfo:I},v]=g;let N=Vt(c,v)?"STALE":"HIT";if(!Ye.has(c)&&N==="STALE"){Ye.add(c);let F=Promise.resolve().then(async()=>{let te=Date.now();try{let L=await t({addDebugData:y});a(L)&&(await d(L),l?.({result:L,cacheStatus:"PUT",overrideStartTime:te}));}catch(L){L.message&&(L.message="SWR in sub-request failed: "+L.message),console.error(L);}finally{Ye.delete(c);}});n?.(F);}return f}let h=await t({addDebugData:y});if(a(h)){let f=Promise.resolve().then(async()=>{await d(h);});n?.(f);}return h}async function Ht(e,t,{cacheInstance:r,cache:o,cacheKey:a=[e,t],shouldCacheResponse:n=()=>!0,waitUntil:i,returnType:u="json",debugInfo:c}={}){return !o&&(!t.method||t.method==="GET")&&(o=oe()),Xe(a,async()=>{let s=await fetch(e,t),p;try{p=await s[u]();}catch{try{p=await s.text();}catch{return Ft("",s)}}return Ft(p,s)},{cacheInstance:r,waitUntil:i,strategy:o??null,debugInfo:c,shouldCacheResult:s=>n(...$t(s))}).then($t)}var ge="2024.4.4";var Ze="Custom-Storefront-Request-Group-ID",et="X-Shopify-Storefront-Access-Token",tt="X-SDK-Variant",rt="X-SDK-Variant-Source",ot="X-SDK-Version",Oe="2024-04",ne=`Shopify Hydrogen ${ge}`,Qt="30243aa5-17c1-465a-8493-944bcc4e88aa",E="customerAccount",ie="buyer";function Bt(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`weak-${Math.random().toString(16).substring(2)}`}var Gt=new Set,jt=e=>{Gt.has(e)||(console.warn(e),Gt.add(e));},Wt=new Set,at=e=>{Wt.has(e)||(console.error(new Error(e)),Wt.add(e));};function se(e){return e.replace(/\s*#.*$/gm,"").replace(/\s+/gm," ").trim()}var so=/(^|}\s)query[\s({]/im,co=/(^|}\s)mutation[\s({]/im;function ke(e,t){if(!so.test(e))throw new Error(`[h2:error:${t}] Can only execute queries`)}function Le(e,t){if(!co.test(e))throw new Error(`[h2:error:${t}] Can only execute mutations`)}var z=class extends Error{locations;path;extensions;constructor(t,r={}){let a=(r.clientOperation?`[h2:error:${r.clientOperation}] `:"")+t+(r.requestId?` - Request ID: ${r.requestId}`:"");super(a),this.name="GraphQLError",this.extensions=r.extensions,this.locations=r.locations,this.path=r.path,this.stack=r.stack||void 0;try{this.cause=JSON.stringify({...typeof r.cause=="object"?r.cause:{},requestId:r.requestId});}catch{r.cause&&(this.cause=r.cause);}}get[Symbol.toStringTag](){return this.name}toString(){let t=`${this.name}: ${this.message}`;if(this.path)try{t+=` | path: ${JSON.stringify(this.path)}`;}catch{}if(this.extensions)try{t+=` | extensions: ${JSON.stringify(this.extensions)}`;}catch{}return t+=`
|
|
16
15
|
`,this.stack&&(t+=`${this.stack.slice(this.stack.indexOf(`
|
|
17
16
|
`)+1)}
|
|
18
|
-
`),t}toJSON(){return {name:"Error",message:""}}};function
|
|
17
|
+
`),t}toJSON(){return {name:"Error",message:""}}};function he({url:e,response:t,errors:r,type:o,query:a,queryVariables:n,ErrorConstructor:i=Error,client:u="storefront"}){let c=(typeof r=="string"?r:r?.map?.(p=>p.message).join(`
|
|
19
18
|
`))||`URL: ${e}
|
|
20
|
-
API response error: ${t.status}`,
|
|
19
|
+
API response error: ${t.status}`,s=new z(c,{query:a,queryVariables:n,cause:{errors:r},clientOperation:`${u}.${o}`,requestId:t.headers.get("x-request-id")});throw new i(s.message,{cause:s.cause})}function ce(e,t={}){let r=new Error,o=(a,n="Error")=>{let i=(r.stack??"").split(`
|
|
21
20
|
`).slice(3+(t.stackOffset??0)).join(`
|
|
22
|
-
`).replace(/ at loader(\d+) \(/,(
|
|
23
|
-
`+
|
|
21
|
+
`).replace(/ at loader(\d+) \(/,(u,c)=>u.replace(c,""));return `${n}: ${a}
|
|
22
|
+
`+i};return e.then(a=>{if(a?.errors&&Array.isArray(a.errors)){let n=typeof t.logErrors=="function"?t.logErrors:()=>t.logErrors??!1;a.errors.forEach(i=>{i&&(i.stack=o(i.message,i.name),n(i)&&console.error(i));});}return a}).catch(a=>{throw a&&(a.stack=o(a.message,a.name)),a})}var q=void 0;var mo={language:"EN",country:"US"};function ci(e){let {storefrontHeaders:t,cache:r,waitUntil:o,i18n:a,storefrontId:n,logErrors:i=!0,...u}=e,{getPublicTokenHeaders:s,getPrivateTokenHeaders:p,getStorefrontApiUrl:y,getShopifyDomain:m}=hydrogenReact.createStorefrontClient(u),d=(u.privateStorefrontToken?p:s)({contentType:"json",buyerIp:t?.buyerIp||""});if(d[Ze]=t?.requestGroupId||Bt(),n&&(d[hydrogenReact.SHOPIFY_STOREFRONT_ID_HEADER]=n),(d["user-agent"]=`Hydrogen ${ge}`),t&&t.cookie){let f=hydrogenReact.getShopifyCookies(t.cookie??"");f[hydrogenReact.SHOPIFY_Y]&&(d[hydrogenReact.SHOPIFY_STOREFRONT_Y_HEADER]=f[hydrogenReact.SHOPIFY_Y]),f[hydrogenReact.SHOPIFY_S]&&(d[hydrogenReact.SHOPIFY_STOREFRONT_S_HEADER]=f[hydrogenReact.SHOPIFY_S]);}let g=JSON.stringify({"content-type":d["content-type"],"user-agent":d["user-agent"],[tt]:d[tt],[rt]:d[rt],[ot]:d[ot],[et]:d[et]});async function h({query:f,mutation:I,variables:v,cache:N,headers:F=[],storefrontApiVersion:te,displayName:L,stackInfo:be}){let C=F instanceof Headers?Object.fromEntries(F.entries()):Array.isArray(F)?Object.fromEntries(F):F,S=f??I,A={...v};a&&(!v?.country&&/\$country/.test(S)&&(A.country=a.country),!v?.language&&/\$language/.test(S)&&(A.language=a.language));let T=y({storefrontApiVersion:te}),M=JSON.stringify({query:S,variables:A}),V={method:"POST",headers:{...d,...C},body:M},D=[T,V.method,g,V.body],[O,k]=await Ht(T,V,{cacheInstance:I?void 0:r,cache:N||ae(),cacheKey:D,shouldCacheResponse:qt,waitUntil:o,debugInfo:{requestId:V.headers[Ze],displayName:L,url:T,stackInfo:be,graphql:M,purpose:t?.purpose}}),b={url:T,response:k,type:I?"mutation":"query",query:S,queryVariables:A,errors:void 0};if(!k.ok){let $;try{$=K(O);}catch{$=[{message:O}];}he({...b,errors:$});}let{data:U,errors:le}=O,re=le?.map(({message:$,...ye})=>new z($,{...ye,clientOperation:`storefront.${b.type}`,requestId:k.headers.get("x-request-id"),queryVariables:A,query:S}));return P(U,re)}return {storefront:{query(f,I){f=se(f),ke(f,"storefront.query");let v=Jt?.(f);return ce(h({...I,query:f,stackInfo:q?.(v)}),{stackOffset:v,logErrors:i})},mutate(f,I){f=se(f),Le(f,"storefront.mutate");let v=Jt?.(f);return ce(h({...I,mutation:f,stackInfo:q?.(v)}),{stackOffset:v,logErrors:i})},cache:r,CacheNone:We,CacheLong:Ke,CacheShort:oe,CacheCustom:ze,generateCacheControlHeader:fe,getPublicTokenHeaders:s,getPrivateTokenHeaders:p,getShopifyDomain:m,getApiUrl:y,i18n:a??mo}}}var Jt=void 0;function P(e,t){return {...e,...t&&{errors:t}}}function _e(e,t){let r=e.headers?.get?.(t)??e.headers?.[t];return typeof r=="string"?r:null}function J(e){return {requestId:e?_e(e,"request-id"):void 0,purpose:e?_e(e,"purpose"):void 0}}function fi({cache:e,waitUntil:t,request:r}){return function(a,n,i){return Xe(a,i,{strategy:n,cacheInstance:e,waitUntil:t,debugInfo:{...J(r),stackInfo:q?.()}})}}var nt=class{#e;constructor(){this.#e=new Map;}add(t){throw new Error("Method not implemented. Use `put` instead.")}addAll(t){throw new Error("Method not implemented. Use `put` instead.")}matchAll(t,r){throw new Error("Method not implemented. Use `match` instead.")}async put(t,r){if(t.method!=="GET")throw new TypeError("Cannot cache response to non-GET request.");if(r.status===206)throw new TypeError("Cannot cache response to a range request (206 Partial Content).");if(r.headers.get("vary")?.includes("*"))throw new TypeError("Cannot cache response with 'Vary: *' header.");this.#e.set(t.url,{body:new Uint8Array(await r.arrayBuffer()),status:r.status,headers:[...r.headers],timestamp:Date.now()});}async match(t){if(t.method!=="GET")return;let r=this.#e.get(t.url);if(!r)return;let{body:o,timestamp:a,...n}=r,i=new Headers(n.headers),u=i.get("cache-control")||i.get("real-cache-control")||"",c=parseInt(u.match(/max-age=(\d+)/)?.[1]||"0",10),s=parseInt(u.match(/stale-while-revalidate=(\d+)/)?.[1]||"0",10),p=(Date.now()-a)/1e3;if(p>c+s){this.#e.delete(t.url);return}let m=p>c;return i.set("cache",m?"STALE":"HIT"),i.set("date",new Date(a).toUTCString()),new Response(o,{status:n.status??200,headers:i})}async delete(t){return this.#e.has(t.url)?(this.#e.delete(t.url),!0):!1}keys(t){let r=[];for(let o of this.#e.keys())(!t||t.url===o)&&r.push(new Request(o));return Promise.resolve(r)}};function Ue(e){if(!e)return;let{pathname:t,search:r}=new URL(e),o=t+r,a=new URLSearchParams(r),n=a.get("return_to")||a.get("redirect");if(n){if(Xt(e,n))return n;console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${n}`);}}function Xt(e,t){try{return new URL(e).origin===new URL(t,e).origin}catch{return !1}}function it({requestUrl:e,defaultUrl:t,redirectUrl:r}){let o=e,a=Yt(e,t),n=r?Yt(e,r):a;return Xt(e,n.toString())?n.toString():(console.warn(`Cross-domain redirects are not supported. Tried to redirect from ${o} to ${n}. Default url ${a} is used instead.`),a.toString())}function Yt(e,t){return go(t)?new URL(t):new URL(t,new URL(e).origin)}function go(e){try{return new URL(e),!0}catch{return !1}}async function ho(e){let{storefront:t,request:r,noAdminRedirect:o,matchQueryParams:a,response:n=new Response("Not Found",{status:404})}=e,i=new URL(r.url),{pathname:u,searchParams:c}=i,s=c.has("_data");c.delete("redirect"),c.delete("return_to"),c.delete("_data");let p=(a?i.toString().replace(i.origin,""):u).toLowerCase();if(i.pathname==="/admin"&&!o)return ct(`${t.getShopifyDomain()}/admin`,s,c,a);try{let{urlRedirects:y}=await t.query(Co,{variables:{query:"path:"+p.replace(/\/+$/,"")}}),m=y?.edges?.[0]?.node?.target;if(m)return ct(m,s,c,a);let l=Ue(r.url);if(l)return ct(l,s,c,a)}catch(y){console.error(`Failed to fetch redirects from Storefront API for route ${p}`,y);}return n}var st="https://example.com";function ct(e,t,r,o){let a=new URL(e,st);if(!o)for(let[n,i]of r)a.searchParams.append(n,i);return t?new Response(null,{status:200,headers:{"X-Remix-Redirect":a.toString().replace(st,""),"X-Remix-Status":"301"}}):new Response(null,{status:301,headers:{location:a.toString().replace(st,"")}})}var Co=`#graphql
|
|
24
23
|
query redirects($query: String) {
|
|
25
24
|
urlRedirects(first: 1, query: $query) {
|
|
26
25
|
edges {
|
|
@@ -30,12 +29,12 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
`;var
|
|
32
|
+
`;var So=async function({request:t,context:r}){let o=r.storefront,a=r.customerAccount,n=new URL(t.url);if(!o)throw new Error("GraphiQL: Hydrogen's storefront client must be injected in the loader context.");let i={};if(o){let s="X-Shopify-Storefront-Access-Token";i.storefront={name:"Storefront API",authHeader:s,accessToken:o.getPublicTokenHeaders()[s],apiUrl:o.getApiUrl(),icon:"SF"};}if(a){let s=await(await fetch(n.origin+"/graphiql/customer-account.schema.json")).json(),p=await a.getAccessToken();s&&(i["customer-account"]={name:"Customer Account API",value:s,authHeader:"Authorization",accessToken:p,apiUrl:a.getApiUrl(),icon:"CA"});}let u="https://avatars.githubusercontent.com/u/12972006?s=48&v=4",c=String.raw;return new Response(c`
|
|
34
33
|
<!DOCTYPE html>
|
|
35
34
|
<html lang="en">
|
|
36
35
|
<head>
|
|
37
36
|
<title>GraphiQL</title>
|
|
38
|
-
<link rel="icon" type="image/x-icon" href="${
|
|
37
|
+
<link rel="icon" type="image/x-icon" href="${u}" />
|
|
39
38
|
<style>
|
|
40
39
|
body {
|
|
41
40
|
height: 100%;
|
|
@@ -125,7 +124,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
125
124
|
variables = JSON.stringify(JSON.parse(variables), null, 2);
|
|
126
125
|
}
|
|
127
126
|
|
|
128
|
-
const schemas = ${JSON.stringify(
|
|
127
|
+
const schemas = ${JSON.stringify(i)};
|
|
129
128
|
let lastActiveTabIndex = -1;
|
|
130
129
|
let lastTabAmount = -1;
|
|
131
130
|
|
|
@@ -296,24 +295,24 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
296
295
|
</script>
|
|
297
296
|
</body>
|
|
298
297
|
</html>
|
|
299
|
-
`,{status:200,headers:{"content-type":"text/html"}})};var yo={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},fo=/[&><\u2028\u2029]/g;function jt(e){return e.replace(fo,t=>yo[t])}var B="Error in SEO input: ",H={title:{validate:e=>{if(typeof e!="string")throw new Error(B.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(B.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(B.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(B.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(B.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(B.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(B.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(B.concat("`handle` should start with `@`"));return e}}};function Kt(e){let t=[];for(let r of Object.keys(e))switch(r){case"title":{let o=Q(H.title,e.title),a=it(e?.titleTemplate,o);if(!a)break;t.push(x("title",{title:a}),x("meta",{property:"og:title",content:a}),x("meta",{name:"twitter:title",content:a}));break}case"description":{let o=Q(H.description,e.description);if(!o)break;t.push(x("meta",{name:"description",content:o}),x("meta",{property:"og:description",content:o}),x("meta",{name:"twitter:description",content:o}));break}case"url":{let o=Q(H.url,e.url);if(!o)break;let s=o.split("?")[0].replace(/\/$/,"");t.push(x("link",{rel:"canonical",href:s}),x("meta",{property:"og:url",content:s}));break}case"handle":{let o=Q(H.handle,e.handle);if(!o)break;t.push(x("meta",{name:"twitter:site",content:o}),x("meta",{name:"twitter:creator",content:o}));break}case"media":{let o,a=G(e.media);for(let s of a)if(typeof s=="string"&&t.push(x("meta",{name:"og:image",content:s})),s&&typeof s=="object"){let n=s.type||"image",i=s?{url:s?.url,secure_url:s?.url,type:ct(s.url),width:s?.width,height:s?.height,alt:s?.altText}:{};for(let u of Object.keys(i))i[u]&&(o=i[u],t.push(x("meta",{property:`og:${n}:${u}`,content:o},i.url)));}break}case"jsonLd":{let o=G(e.jsonLd),a=0;for(let s of o){if(typeof s!="object")continue;let n=x("script",{type:"application/ld+json",children:JSON.stringify(s,(i,u)=>typeof u=="string"?jt(u):u)},`json-ld-${s?.["@type"]||s?.name||a++}`);t.push(n);}break}case"alternates":{let o=G(e.alternates);for(let a of o){if(!a)continue;let{language:s,url:n,default:i}=a,u=s?`${s}${i?"-default":""}`:void 0;t.push(x("link",{rel:"alternate",hrefLang:u,href:n}));}break}case"robots":{if(!e.robots)break;let{maxImagePreview:o,maxSnippet:a,maxVideoPreview:s,noArchive:n,noFollow:i,noImageIndex:u,noIndex:c,noSnippet:l,noTranslate:y,unavailableAfter:m}=e.robots,p=[n&&"noarchive",u&&"noimageindex",l&&"nosnippet",y&&"notranslate",o&&`max-image-preview:${o}`,a&&`max-snippet:${a}`,s&&`max-video-preview:${s}`,m&&`unavailable_after:${m}`],d=(c?"noindex":"index")+","+(i?"nofollow":"follow");for(let g of p)g&&(d+=`,${g}`);t.push(x("meta",{name:"robots",content:d}));break}}return t.flat().sort((r,o)=>r.key.localeCompare(o.key))}function x(e,t,r){let o={tag:e,props:{},key:""};return e==="title"?(o.children=t.title,o.key=st(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=st(o,r),delete t.children,o.props=t,o):(o.props=t,Object.keys(o.props).forEach(a=>!o.props[a]&&delete o.props[a]),o.key=st(o,r),o)}function st(e,t){let{tag:r,props:o}=e;if(r==="title")return "0-title";if(r==="meta"){let a=o.content===t&&typeof o.property=="string"&&!o.property.endsWith("secure_url")&&"0";return [r,...[t,a],o.property||o.name].filter(n=>n).join("-")}return r==="link"?[r,o.rel,o.hrefLang||o.media].filter(s=>s).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${o.type}`}function it(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function ct(e){switch(e&&e.split(".").pop()){case"svg":return "image/svg+xml";case"png":return "image/png";case"gif":return "image/gif";case"swf":return "application/x-shockwave-flash";case"mp3":return "audio/mpeg";case"jpg":case"jpeg":default:return "image/jpeg"}}function G(e){return Array.isArray(e)?e:[e]}function Q(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}var vo=react.lazy(()=>Promise.resolve().then(()=>(Xt(),Yt)));function Ro({debug:e}){let t=react$1.useMatches(),r=react$1.useLocation();console.warn("[h2:warn:Seo] The `<Seo/>` component is deprecated. Use `getSeoMeta` instead.\nSee: https://shopify.dev/docs/api/hydrogen/2024-01/utilities/getseometa");let o=react.useMemo(()=>t.flatMap(n=>{let{handle:i,...u}=n,c={...u,...r},l=i?.seo,y=u?.data?.seo;return !l&&!y?[]:l?Le(l,c):[y]}).reduce((n,i)=>{Object.keys(i).forEach(c=>!i[c]&&delete i[c]);let{jsonLd:u}=i;return u?n?.jsonLd?Array.isArray(u)?{...n,...i,jsonLd:[...n.jsonLd,...u]}:{...n,...i,jsonLd:[...n.jsonLd,u]}:{...n,...i,jsonLd:[u]}:{...n,...i}},{}),[t,r]),{html:a,loggerMarkup:s}=react.useMemo(()=>{let n=Kt(o),i=n.map(c=>c.tag==="script"?react.createElement(c.tag,{...c.props,key:c.key,dangerouslySetInnerHTML:{__html:c.children}}):react.createElement(c.tag,{...c.props,key:c.key},c.children)),u=react.createElement(react.Suspense,{fallback:null},react.createElement(vo,{headTags:n}));return {html:i,loggerMarkup:u}},[o]);return react.createElement(react.Fragment,null,a,e&&s)}function Le(e,...t){if(e instanceof Function)return Le(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((o,a)=>[...o,Le(a)],[]),r):e instanceof Object?(Object.entries(e).forEach(([a,s])=>{r[a]=Le(s,...t);}),r):e}function wo(...e){let t=[],r=e.reduce((o,a)=>{if(!a)return o;Object.keys(a).forEach(n=>!a[n]&&delete a[n]);let{jsonLd:s}=a;return s?o?.jsonLd?{...o,...a,jsonLd:G(o.jsonLd).concat(s)}:{...o,...a,jsonLd:[s]}:{...o,...a}},{})||{};for(let o of Object.keys(r))switch(o){case"title":{let a=Q(H.title,r.title),s=it(r?.titleTemplate,a);if(!s)break;t.push({title:s},{property:"og:title",content:s},{property:"twitter:title",content:s});break}case"description":{let a=Q(H.description,r.description);if(!a)break;t.push({name:"description",content:a},{property:"og:description",content:a},{property:"twitter:description",content:a});break}case"url":{let a=Q(H.url,r.url);if(!a)break;let n=a.split("?")[0].replace(/\/$/,"");t.push({tagName:"link",rel:"canonical",href:n},{property:"og:url",content:n});break}case"handle":{let a=Q(H.handle,r.handle);if(!a)break;t.push({property:"twitter:site",content:a},{property:"twitter:creator",content:a});break}case"media":{let a,s=G(r.media);for(let n of s)if(typeof n=="string"&&t.push({property:"og:image",content:n}),n&&typeof n=="object"){let i=n.type||"image",u=n?{url:n?.url,secure_url:n?.url,type:ct(n.url),width:n?.width,height:n?.height,alt:n?.altText}:{};for(let c of Object.keys(u))u[c]&&(a=u[c],t.push({property:`og:${i}:${c}`,content:a}));}break}case"jsonLd":{let a=G(r.jsonLd);for(let n of a)typeof n!="object"||Object.keys(n).length===0||t.push({"script:ld+json":n});break}case"alternates":{let a=G(r.alternates);for(let s of a){if(!s)continue;let{language:n,url:i,default:u}=s,c=n?`${n}${u?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:c,href:i});}break}case"robots":{if(!r.robots)break;let{maxImagePreview:a,maxSnippet:s,maxVideoPreview:n,noArchive:i,noFollow:u,noImageIndex:c,noIndex:l,noSnippet:y,noTranslate:m,unavailableAfter:p}=r.robots,d=[i&&"noarchive",c&&"noimageindex",y&&"nosnippet",m&&"notranslate",a&&`max-image-preview:${a}`,s&&`max-snippet:${s}`,n&&`max-video-preview:${n}`,p&&`unavailable_after:${p}`],g=(l?"noindex":"index")+","+(u?"nofollow":"follow");for(let S of d)S&&(g+=`,${S}`);t.push({name:"robots",content:g});break}}return t}function Do({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null)}){let o=react$1.useNavigation().state==="loading",{endCursor:a,hasNextPage:s,hasPreviousPage:n,nextPageUrl:i,nodes:u,previousPageUrl:c,startCursor:l}=Oo(e),y=react.useMemo(()=>({pageInfo:{endCursor:a,hasPreviousPage:n,hasNextPage:s,startCursor:l},nodes:u}),[a,s,n,l,u]),m=react.useMemo(()=>react.forwardRef(function(g,S){return s?react.createElement(react$1.Link,{preventScrollReset:!0,...g,to:i,state:y,replace:!0,ref:S}):null}),[s,i,y]),p=react.useMemo(()=>react.forwardRef(function(g,S){return n?react.createElement(react$1.Link,{preventScrollReset:!0,...g,to:c,state:y,replace:!0,ref:S}):null}),[n,c,y]);return t({state:y,hasNextPage:s,hasPreviousPage:n,isLoading:o,nextPageUrl:i,nodes:u,previousPageUrl:c,NextLink:m,PreviousLink:p})}function Ne(e){let t=new URLSearchParams(e);return t.delete("cursor"),t.delete("direction"),t.toString()}function Ce(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function Oo(e){e.pageInfo||Ce("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Ce("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Ce("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Ce("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Ce("pageInfo.hasPreviousPage");let t=react$1.useNavigate(),{state:r,search:o,pathname:a}=react$1.useLocation(),i=new URLSearchParams(o).get("direction")==="previous",u=react.useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!r||!r?.nodes?hydrogenReact.flattenConnection(e):i?[...hydrogenReact.flattenConnection(e),...r.nodes]:[...r.nodes,...hydrogenReact.flattenConnection(e)],[r,e]),c=react.useMemo(()=>{let p=globalThis?.window?.__hydrogenHydrated,d=!p||r?.pageInfo?.startCursor===void 0?e.pageInfo.startCursor:r.pageInfo.startCursor,g=!p||r?.pageInfo?.endCursor===void 0?e.pageInfo.endCursor:r.pageInfo.endCursor,S=!p||r?.pageInfo?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:r.pageInfo.hasPreviousPage,f=!p||r?.pageInfo?.hasNextPage===void 0?e.pageInfo.hasNextPage:r.pageInfo.hasNextPage;return r?.nodes&&(i?(d=e.pageInfo.startCursor,S=e.pageInfo.hasPreviousPage):(g=e.pageInfo.endCursor,f=e.pageInfo.hasNextPage)),{startCursor:d,endCursor:g,hasPreviousPage:S,hasNextPage:f}},[i,r,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),l=react.useRef({params:Ne(o),pathname:a});react.useEffect(()=>{window.__hydrogenHydrated=!0;},[]),react.useEffect(()=>{(Ne(o)!==l.current.params||a!==l.current.pathname)&&(l.current={pathname:a,params:Ne(o)},t(`${a}?${Ne(o)}`,{replace:!0,preventScrollReset:!0,state:{nodes:void 0,pageInfo:void 0}}));},[a,o]);let y=react.useMemo(()=>{let p=new URLSearchParams(o);return p.set("direction","previous"),c.startCursor&&p.set("cursor",c.startCursor),`?${p.toString()}`},[o,c.startCursor]),m=react.useMemo(()=>{let p=new URLSearchParams(o);return p.set("direction","next"),c.endCursor&&p.set("cursor",c.endCursor),`?${p.toString()}`},[o,c.endCursor]);return {...c,previousPageUrl:y,nextPageUrl:m,nodes:u}}function Uo(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r}=t,o=new URLSearchParams(new URL(e.url).search),a=o.get("cursor")??void 0;return (o.get("direction")==="previous"?"previous":"next")==="previous"?{last:r,startCursor:a??null}:{first:r,endCursor:a??null}}var k=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function Pe(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function _o({session:e,customerAccountId:t,customerAccountUrl:r,httpsOrigin:o,debugInfo:a,exchangeForStorefrontCustomerAccessToken:s}){let n=new URLSearchParams,u=e.get(E)?.refreshToken;if(!u)throw new k("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");n.append("grant_type","refresh_token"),n.append("refresh_token",u),n.append("client_id",t);let c={"content-type":"application/x-www-form-urlencoded","User-Agent":ae,Origin:o};new Date().getTime();let y=`${r}/auth/oauth/token`,m=await fetch(y,{method:"POST",headers:c,body:n});if(!m.ok){let R=await m.text();throw new Response(R,{status:m.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:p,expires_in:d,id_token:g,refresh_token:S}=await m.json(),f=await lt(p,t,r,o);e.set(E,{accessToken:f,expiresAt:new Date(new Date().getTime()+(d-120)*1e3).getTime()+"",refreshToken:S,idToken:g}),await s();}function ce(e){e.unset(E),e.unset(ne);}async function ar({locks:e,expiresAt:t,session:r,customerAccountId:o,customerAccountUrl:a,httpsOrigin:s,debugInfo:n,exchangeForStorefrontCustomerAccessToken:i}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=_o({session:r,customerAccountId:o,customerAccountUrl:a,httpsOrigin:s,debugInfo:n,exchangeForStorefrontCustomerAccessToken:i})),await e.refresh,delete e.refresh;}catch(u){throw ce(r),u&&u.status!==401?u:new k("Unauthorized","Login before querying the Customer Account API.",{"Set-Cookie":await r.commit()})}}function nr(){let e=ko();return ir(e)}async function sr(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Lo(t);return ir(r)}function ko(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function ir(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Lo(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function cr(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function lt(e,t,r,o,a){let s=t;if(!e)throw new k("Unauthorized","oAuth access token was not provided during token exchange.");let n=new URLSearchParams;n.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),n.append("client_id",s),n.append("audience",$t),n.append("subject_token",e),n.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),n.append("scopes","https://api.customers.com/auth/customer.graphql");let i={"content-type":"application/x-www-form-urlencoded","User-Agent":ae,Origin:o};new Date().getTime();let c=`${r}/auth/oauth/token`,l=await fetch(c,{method:"POST",headers:i,body:n});let y=await l.json();if(y.error)throw new k(y.error_description);return y.access_token}function ur(e){return No(e).payload.nonce}function No(e){let[t,r,o]=e.split("."),a=JSON.parse(atob(t)),s=JSON.parse(atob(r));return {header:a,payload:s,signature:o}}function Me(){return Vo(Mo())}function Mo(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Vo(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}var pr="/account/login",Fo="/account/authorize",lr="/account";function $o(e){if(!e.url)return pr;let{pathname:t}=new URL(e.url),r=pr+`?${new URLSearchParams({return_to:t}).toString()}`;return Pe(r)}function qo({session:e,customerAccountId:t,customerAccountUrl:r,customerApiVersion:o=De,request:a,waitUntil:s,authUrl:n,customAuthStatusHandler:i,logErrors:u=!0,unstableB2b:c=!1}){if(o!==De&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${De}.`),!a?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let l=i||(()=>$o(a)),y=new URL(a.url),m=y.protocol==="http:"?y.origin.replace("http","https"):y.origin,p=ot({requestUrl:m,defaultUrl:Fo,redirectUrl:n}),d=`${r}/account/customer/api/${o}/graphql`,g={};async function S({query:h,type:C,variables:A={}}){let T=await v();if(!T)throw l();new Date().getTime();let D=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":ae,Origin:m,Authorization:T},body:JSON.stringify({query:h,variables:A})});let O=await D.text(),U={url:d,response:D,type:C,query:h,queryVariables:A,errors:void 0,client:"customer"};if(!D.ok){if(D.status===401){ce(e);let L=l();throw L instanceof Response&&L.headers.set("Set-Cookie",await e.commit()),L}let b;try{b=j(O);}catch{b=[{message:O}];}ge({...U,errors:b});}try{let b=j(O),{errors:L}=b,le=L?.map(({message:te,...$})=>new K(te,{...$,clientOperation:`customerAccount.${U.type}`,requestId:D.headers.get("x-request-id"),queryVariables:A,query:h}));return {...b,...L&&{errors:le}}}catch{ge({...U,errors:[{message:O}]});}}async function f(){if(!r||!t)return !1;let h=e.get(E),C=h?.accessToken,A=h?.expiresAt;if(!C||!A)return !1;let T=q?.();try{await ar({locks:g,expiresAt:A,session:e,customerAccountId:t,customerAccountUrl:r,httpsOrigin:m,debugInfo:{waitUntil:s,stackInfo:T,...J(a)},exchangeForStorefrontCustomerAccessToken:Ie});}catch{return !1}return !0}async function R(){if(!await f())throw l()}async function v(){if(await f())return e.get(E)?.accessToken}async function N(h,C){return Ae(r,t),h=se(h),Ue(h,"customer.mutate"),ie(S({query:h,type:"mutation",...C}),{logErrors:u})}async function F(h,C){return Ae(r,t),h=se(h),Oe(h,"customer.query"),ie(S({query:h,type:"query",...C}),{logErrors:u})}function ee(h){e.set(ne,{...e.get(ne),...h});}async function _(){if(await f())return e.get(ne)}async function Ie(){if(!c)return;let h=`#graphql
|
|
298
|
+
`,{status:200,headers:{"content-type":"text/html"}})};var Po={"&":"\\u0026",">":"\\u003e","<":"\\u003c","\u2028":"\\u2028","\u2029":"\\u2029"},Ao=/[&><\u2028\u2029]/g;function Zt(e){return e.replace(Ao,t=>Po[t])}var G="Error in SEO input: ",H={title:{validate:e=>{if(typeof e!="string")throw new Error(G.concat("`title` should be a string"));if(typeof e=="string"&&e.length>120)throw new Error(G.concat("`title` should not be longer than 120 characters"));return e}},description:{validate:e=>{if(typeof e!="string")throw new Error(G.concat("`description` should be a string"));if(typeof e=="string"&&e.length>155)throw new Error(G.concat("`description` should not be longer than 155 characters"));return e}},url:{validate:e=>{if(typeof e!="string")throw new Error(G.concat("`url` should be a string"));if(typeof e=="string"&&!e.startsWith("http"))throw new Error(G.concat("`url` should be a valid URL"));return e}},handle:{validate:e=>{if(typeof e!="string")throw new Error(G.concat("`handle` should be a string"));if(typeof e=="string"&&!e.startsWith("@"))throw new Error(G.concat("`handle` should start with `@`"));return e}}};function er(e){let t=[];for(let r of Object.keys(e))switch(r){case"title":{let o=Q(H.title,e.title),a=pt(e?.titleTemplate,o);if(!a)break;t.push(x("title",{title:a}),x("meta",{property:"og:title",content:a}),x("meta",{name:"twitter:title",content:a}));break}case"description":{let o=Q(H.description,e.description);if(!o)break;t.push(x("meta",{name:"description",content:o}),x("meta",{property:"og:description",content:o}),x("meta",{name:"twitter:description",content:o}));break}case"url":{let o=Q(H.url,e.url);if(!o)break;let n=o.split("?")[0].replace(/\/$/,"");t.push(x("link",{rel:"canonical",href:n}),x("meta",{property:"og:url",content:n}));break}case"handle":{let o=Q(H.handle,e.handle);if(!o)break;t.push(x("meta",{name:"twitter:site",content:o}),x("meta",{name:"twitter:creator",content:o}));break}case"media":{let o,a=W(e.media);for(let n of a)if(typeof n=="string"&&t.push(x("meta",{name:"og:image",content:n})),n&&typeof n=="object"){let i=n.type||"image",u=n?{url:n?.url,secure_url:n?.url,type:dt(n.url),width:n?.width,height:n?.height,alt:n?.altText}:{};for(let c of Object.keys(u))u[c]&&(o=u[c],t.push(x("meta",{property:`og:${i}:${c}`,content:o},u.url)));}break}case"jsonLd":{let o=W(e.jsonLd),a=0;for(let n of o){if(typeof n!="object")continue;let i=x("script",{type:"application/ld+json",children:JSON.stringify(n,(u,c)=>typeof c=="string"?Zt(c):c)},`json-ld-${n?.["@type"]||n?.name||a++}`);t.push(i);}break}case"alternates":{let o=W(e.alternates);for(let a of o){if(!a)continue;let{language:n,url:i,default:u}=a,c=n?`${n}${u?"-default":""}`:void 0;t.push(x("link",{rel:"alternate",hrefLang:c,href:i}));}break}case"robots":{if(!e.robots)break;let{maxImagePreview:o,maxSnippet:a,maxVideoPreview:n,noArchive:i,noFollow:u,noImageIndex:c,noIndex:s,noSnippet:p,noTranslate:y,unavailableAfter:m}=e.robots,l=[i&&"noarchive",c&&"noimageindex",p&&"nosnippet",y&&"notranslate",o&&`max-image-preview:${o}`,a&&`max-snippet:${a}`,n&&`max-video-preview:${n}`,m&&`unavailable_after:${m}`],d=(s?"noindex":"index")+","+(u?"nofollow":"follow");for(let g of l)g&&(d+=`,${g}`);t.push(x("meta",{name:"robots",content:d}));break}}return t.flat().sort((r,o)=>r.key.localeCompare(o.key))}function x(e,t,r){let o={tag:e,props:{},key:""};return e==="title"?(o.children=t.title,o.key=ut(o),o):e==="script"?(o.children=typeof t.children=="string"?t.children:"",o.key=ut(o,r),delete t.children,o.props=t,o):(o.props=t,Object.keys(o.props).forEach(a=>!o.props[a]&&delete o.props[a]),o.key=ut(o,r),o)}function ut(e,t){let{tag:r,props:o}=e;if(r==="title")return "0-title";if(r==="meta"){let a=o.content===t&&typeof o.property=="string"&&!o.property.endsWith("secure_url")&&"0";return [r,...[t,a],o.property||o.name].filter(i=>i).join("-")}return r==="link"?[r,o.rel,o.hrefLang||o.media].filter(n=>n).join("-").replace(/\s+/g,"-"):r==="script"?`${r}-${t}`:`${r}-${o.type}`}function pt(e,t){if(t)return e?typeof e=="function"?e(t):e.replace("%s",t??""):t}function dt(e){switch(e&&e.split(".").pop()){case"svg":return "image/svg+xml";case"png":return "image/png";case"gif":return "image/gif";case"swf":return "application/x-shockwave-flash";case"mp3":return "audio/mpeg";case"jpg":case"jpeg":default:return "image/jpeg"}}function W(e){return Array.isArray(e)?e:[e]}function Q(e,t){try{return e.validate(t)}catch(r){return console.warn(r.message),t}}var Do=react.lazy(()=>Promise.resolve().then(()=>(ar(),or)));function Oo({debug:e}){let t=react$1.useMatches(),r=react$1.useLocation();console.warn("[h2:warn:Seo] The `<Seo/>` component is deprecated. Use `getSeoMeta` instead.\nSee: https://shopify.dev/docs/api/hydrogen/2024-01/utilities/getseometa");let o=react.useMemo(()=>t.flatMap(i=>{let{handle:u,...c}=i,s={...c,...r},p=u?.seo,y=c?.data?.seo;return !p&&!y?[]:p?Ne(p,s):[y]}).reduce((i,u)=>{Object.keys(u).forEach(s=>!u[s]&&delete u[s]);let{jsonLd:c}=u;return c?i?.jsonLd?Array.isArray(c)?{...i,...u,jsonLd:[...i.jsonLd,...c]}:{...i,...u,jsonLd:[...i.jsonLd,c]}:{...i,...u,jsonLd:[c]}:{...i,...u}},{}),[t,r]),{html:a,loggerMarkup:n}=react.useMemo(()=>{let i=er(o),u=i.map(s=>s.tag==="script"?react.createElement(s.tag,{...s.props,key:s.key,dangerouslySetInnerHTML:{__html:s.children}}):react.createElement(s.tag,{...s.props,key:s.key},s.children)),c=react.createElement(react.Suspense,{fallback:null},react.createElement(Do,{headTags:i}));return {html:u,loggerMarkup:c}},[o]);return react.createElement(react.Fragment,null,a,e&&n)}function Ne(e,...t){if(e instanceof Function)return Ne(e(...t),...t);let r={};return Array.isArray(e)?(r=e.reduce((o,a)=>[...o,Ne(a)],[]),r):e instanceof Object?(Object.entries(e).forEach(([a,n])=>{r[a]=Ne(n,...t);}),r):e}function ko(...e){let t=[],r=e.reduce((o,a)=>{if(!a)return o;Object.keys(a).forEach(i=>!a[i]&&delete a[i]);let{jsonLd:n}=a;return n?o?.jsonLd?{...o,...a,jsonLd:W(o.jsonLd).concat(n)}:{...o,...a,jsonLd:[n]}:{...o,...a}},{})||{};for(let o of Object.keys(r))switch(o){case"title":{let a=Q(H.title,r.title),n=pt(r?.titleTemplate,a);if(!n)break;t.push({title:n},{property:"og:title",content:n},{property:"twitter:title",content:n});break}case"description":{let a=Q(H.description,r.description);if(!a)break;t.push({name:"description",content:a},{property:"og:description",content:a},{property:"twitter:description",content:a});break}case"url":{let a=Q(H.url,r.url);if(!a)break;let i=a.split("?")[0].replace(/\/$/,"");t.push({tagName:"link",rel:"canonical",href:i},{property:"og:url",content:i});break}case"handle":{let a=Q(H.handle,r.handle);if(!a)break;t.push({property:"twitter:site",content:a},{property:"twitter:creator",content:a});break}case"media":{let a,n=W(r.media);for(let i of n)if(typeof i=="string"&&t.push({property:"og:image",content:i}),i&&typeof i=="object"){let u=i.type||"image",c=i?{url:i?.url,secure_url:i?.url,type:dt(i.url),width:i?.width,height:i?.height,alt:i?.altText}:{};for(let s of Object.keys(c))c[s]&&(a=c[s],t.push({property:`og:${u}:${s}`,content:a}));}break}case"jsonLd":{let a=W(r.jsonLd);for(let i of a)typeof i!="object"||Object.keys(i).length===0||t.push({"script:ld+json":i});break}case"alternates":{let a=W(r.alternates);for(let n of a){if(!n)continue;let{language:i,url:u,default:c}=n,s=i?`${i}${c?"-default":""}`:void 0;t.push({tagName:"link",rel:"alternate",hrefLang:s,href:u});}break}case"robots":{if(!r.robots)break;let{maxImagePreview:a,maxSnippet:n,maxVideoPreview:i,noArchive:u,noFollow:c,noImageIndex:s,noIndex:p,noSnippet:y,noTranslate:m,unavailableAfter:l}=r.robots,d=[u&&"noarchive",s&&"noimageindex",y&&"nosnippet",m&&"notranslate",a&&`max-image-preview:${a}`,n&&`max-snippet:${n}`,i&&`max-video-preview:${i}`,l&&`unavailable_after:${l}`],g=(p?"noindex":"index")+","+(c?"nofollow":"follow");for(let h of d)h&&(g+=`,${h}`);t.push({name:"robots",content:g});break}}return t}function Mo({connection:e,children:t=()=>(console.warn("<Pagination> requires children to work properly"),null)}){let o=react$1.useNavigation().state==="loading",{endCursor:a,hasNextPage:n,hasPreviousPage:i,nextPageUrl:u,nodes:c,previousPageUrl:s,startCursor:p}=Vo(e),y=react.useMemo(()=>({pageInfo:{endCursor:a,hasPreviousPage:i,hasNextPage:n,startCursor:p},nodes:c}),[a,n,i,p,c]),m=react.useMemo(()=>react.forwardRef(function(g,h){return n?react.createElement(react$1.Link,{preventScrollReset:!0,...g,to:u,state:y,replace:!0,ref:h}):null}),[n,u,y]),l=react.useMemo(()=>react.forwardRef(function(g,h){return i?react.createElement(react$1.Link,{preventScrollReset:!0,...g,to:s,state:y,replace:!0,ref:h}):null}),[i,s,y]);return t({state:y,hasNextPage:n,hasPreviousPage:i,isLoading:o,nextPageUrl:u,nodes:c,previousPageUrl:s,NextLink:m,PreviousLink:l})}function Me(e){let t=new URLSearchParams(e);return t.delete("cursor"),t.delete("direction"),t.toString()}function Se(e){throw new Error(`The Pagination component requires ${"`"+e+"`"} to be a part of your query. See the guide on how to setup your query to include ${"`"+e+"`"}: https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#setup-the-paginated-query`)}function Vo(e){e.pageInfo||Se("pageInfo"),typeof e.pageInfo.startCursor>"u"&&Se("pageInfo.startCursor"),typeof e.pageInfo.endCursor>"u"&&Se("pageInfo.endCursor"),typeof e.pageInfo.hasNextPage>"u"&&Se("pageInfo.hasNextPage"),typeof e.pageInfo.hasPreviousPage>"u"&&Se("pageInfo.hasPreviousPage");let t=react$1.useNavigate(),{state:r,search:o,pathname:a}=react$1.useLocation(),u=new URLSearchParams(o).get("direction")==="previous",c=react.useMemo(()=>!globalThis?.window?.__hydrogenHydrated||!r||!r?.nodes?hydrogenReact.flattenConnection(e):u?[...hydrogenReact.flattenConnection(e),...r.nodes]:[...r.nodes,...hydrogenReact.flattenConnection(e)],[r,e]),s=react.useMemo(()=>{let l=globalThis?.window?.__hydrogenHydrated,d=!l||r?.pageInfo?.startCursor===void 0?e.pageInfo.startCursor:r.pageInfo.startCursor,g=!l||r?.pageInfo?.endCursor===void 0?e.pageInfo.endCursor:r.pageInfo.endCursor,h=!l||r?.pageInfo?.hasPreviousPage===void 0?e.pageInfo.hasPreviousPage:r.pageInfo.hasPreviousPage,f=!l||r?.pageInfo?.hasNextPage===void 0?e.pageInfo.hasNextPage:r.pageInfo.hasNextPage;return r?.nodes&&(u?(d=e.pageInfo.startCursor,h=e.pageInfo.hasPreviousPage):(g=e.pageInfo.endCursor,f=e.pageInfo.hasNextPage)),{startCursor:d,endCursor:g,hasPreviousPage:h,hasNextPage:f}},[u,r,e.pageInfo.hasNextPage,e.pageInfo.hasPreviousPage,e.pageInfo.startCursor,e.pageInfo.endCursor]),p=react.useRef({params:Me(o),pathname:a});react.useEffect(()=>{window.__hydrogenHydrated=!0;},[]),react.useEffect(()=>{(Me(o)!==p.current.params||a!==p.current.pathname)&&(p.current={pathname:a,params:Me(o)},t(`${a}?${Me(o)}`,{replace:!0,preventScrollReset:!0,state:{nodes:void 0,pageInfo:void 0}}));},[a,o]);let y=react.useMemo(()=>{let l=new URLSearchParams(o);return l.set("direction","previous"),s.startCursor&&l.set("cursor",s.startCursor),`?${l.toString()}`},[o,s.startCursor]),m=react.useMemo(()=>{let l=new URLSearchParams(o);return l.set("direction","next"),s.endCursor&&l.set("cursor",s.endCursor),`?${l.toString()}`},[o,s.endCursor]);return {...s,previousPageUrl:y,nextPageUrl:m,nodes:c}}function Fo(e,t={pageBy:20}){if(typeof e?.url>"u")throw new Error("getPaginationVariables must be called with the Request object passed to your loader function");let{pageBy:r}=t,o=new URLSearchParams(new URL(e.url).search),a=o.get("cursor")??void 0;return (o.get("direction")==="previous"?"previous":"next")==="previous"?{last:r,startCursor:a??null}:{first:r,endCursor:a??null}}var _=class extends Response{constructor(t,r,o){super(`Bad request: ${t}`,{status:400,headers:o});}};function Ae(e,t={}){let r=t.headers?new Headers(t.headers):new Headers({});return r.set("location",e),new Response(null,{status:t.status||302,headers:r})}async function $o({session:e,customerAccountId:t,customerAccountUrl:r,httpsOrigin:o,debugInfo:a,exchangeForStorefrontCustomerAccessToken:n}){let i=new URLSearchParams,u=e.get(E),c=u?.refreshToken,s=u?.idToken;if(!c)throw new _("Unauthorized","No refreshToken found in the session. Make sure your session is configured correctly and passed to `createCustomerAccountClient`.");i.append("grant_type","refresh_token"),i.append("refresh_token",c),i.append("client_id",t);let p={"content-type":"application/x-www-form-urlencoded","User-Agent":ne,Origin:o};new Date().getTime();let m=`${r}/auth/oauth/token`,l=await fetch(m,{method:"POST",headers:p,body:i});if(!l.ok){let I=await l.text();throw new Response(I,{status:l.status,headers:{"Content-Type":"text/html; charset=utf-8"}})}let{access_token:d,expires_in:g,refresh_token:h}=await l.json(),f=await ft(d,t,r,o);e.set(E,{accessToken:f,expiresAt:new Date(new Date().getTime()+(g-120)*1e3).getTime()+"",refreshToken:h,idToken:s}),await n();}function ue(e){e.unset(E),e.unset(ie);}async function pr({locks:e,expiresAt:t,session:r,customerAccountId:o,customerAccountUrl:a,httpsOrigin:n,debugInfo:i,exchangeForStorefrontCustomerAccessToken:u}){if(parseInt(t,10)-1e3<new Date().getTime())try{e.refresh||(e.refresh=$o({session:r,customerAccountId:o,customerAccountUrl:a,httpsOrigin:n,debugInfo:i,exchangeForStorefrontCustomerAccessToken:u})),await e.refresh,delete e.refresh;}catch(c){throw ue(r),c&&c.status!==401?c:new _("Unauthorized","Login before querying the Customer Account API.",{"Set-Cookie":await r.commit()})}}function dr(){let e=qo();return yr(e)}async function lr(e){let t=await crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(e)),r=Ho(t);return yr(r)}function qo(){let e=new Uint8Array(32);return crypto.getRandomValues(e),String.fromCharCode.apply(null,Array.from(e))}function yr(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ho(e){let t=new Uint8Array(e),r=Array.from(t);return String.fromCharCode(...r)}function fr(){let e=Date.now().toString(),t=Math.random().toString(36).substring(2);return e+t}async function ft(e,t,r,o,a){let n=t;if(!e)throw new _("Unauthorized","oAuth access token was not provided during token exchange.");let i=new URLSearchParams;i.append("grant_type","urn:ietf:params:oauth:grant-type:token-exchange"),i.append("client_id",n),i.append("audience",Qt),i.append("subject_token",e),i.append("subject_token_type","urn:ietf:params:oauth:token-type:access_token"),i.append("scopes","https://api.customers.com/auth/customer.graphql");let u={"content-type":"application/x-www-form-urlencoded","User-Agent":ne,Origin:o};new Date().getTime();let s=`${r}/auth/oauth/token`,p=await fetch(s,{method:"POST",headers:u,body:i});let y=await p.json();if(y.error)throw new _(y.error_description);return y.access_token}function mr(e){return Qo(e).payload.nonce}function Qo(e){let[t,r,o]=e.split("."),a=JSON.parse(atob(t)),n=JSON.parse(atob(r));return {header:a,payload:n,signature:o}}function Ve(){return Go(Bo())}function Bo(){try{return crypto.getRandomValues(new Uint8Array(16))}catch{return new Uint8Array(16).map(()=>Math.random()*255|0)}}function Go(e){return Array.from(e,function(t){return ("0"+(t&255).toString(16)).slice(-2)}).join("")}var gr="/account/login",Wo="/account/authorize",hr="/account";function jo(e){if(!e.url)return gr;let{pathname:t}=new URL(e.url),r=gr+`?${new URLSearchParams({return_to:t}).toString()}`;return Ae(r)}function Ko({session:e,customerAccountId:t,customerAccountUrl:r,customerApiVersion:o=Oe,request:a,waitUntil:n,authUrl:i,customAuthStatusHandler:u,logErrors:c=!0,unstableB2b:s=!1}){if(o!==Oe&&console.warn(`[h2:warn:createCustomerAccountClient] You are using Customer Account API version ${o} when this version of Hydrogen was built for ${Oe}.`),!a?.url)throw new Error("[h2:error:createCustomerAccountClient] The request object does not contain a URL.");let p=u||(()=>jo(a)),y=new URL(a.url),m=y.protocol==="http:"?y.origin.replace("http","https"):y.origin,l=it({requestUrl:m,defaultUrl:Wo,redirectUrl:i}),d=`${r}/account/customer/api/${o}/graphql`,g={};async function h({query:C,type:S,variables:A={}}){let T=await v();if(!T)throw p();new Date().getTime();let D=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","User-Agent":ne,Origin:m,Authorization:T},body:JSON.stringify({query:C,variables:A})});let O=await D.text(),k={url:d,response:D,type:S,query:C,queryVariables:A,errors:void 0,client:"customer"};if(!D.ok){if(D.status===401){ue(e);let U=p();throw U instanceof Response&&U.headers.set("Set-Cookie",await e.commit()),U}let b;try{b=K(O);}catch{b=[{message:O}];}he({...k,errors:b});}try{let b=K(O),{errors:U}=b,le=U?.map(({message:re,...$})=>new z(re,{...$,clientOperation:`customerAccount.${k.type}`,requestId:D.headers.get("x-request-id"),queryVariables:A,query:C}));return {...b,...U&&{errors:le}}}catch{he({...k,errors:[{message:O}]});}}async function f(){if(!r||!t)return !1;let C=e.get(E),S=C?.accessToken,A=C?.expiresAt;if(!S||!A)return !1;let T=q?.();try{await pr({locks:g,expiresAt:A,session:e,customerAccountId:t,customerAccountUrl:r,httpsOrigin:m,debugInfo:{waitUntil:n,stackInfo:T,...J(a)},exchangeForStorefrontCustomerAccessToken:be});}catch{return !1}return !0}async function I(){if(!await f())throw p()}async function v(){if(await f())return e.get(E)?.accessToken}async function N(C,S){return Te(r,t),C=se(C),Le(C,"customer.mutate"),ce(h({query:C,type:"mutation",...S}),{logErrors:c})}async function F(C,S){return Te(r,t),C=se(C),ke(C,"customer.query"),ce(h({query:C,type:"query",...S}),{logErrors:c})}function te(C){e.set(ie,{...e.get(ie),...C});}async function L(){if(await f())return e.get(ie)}async function be(){if(!s)return;let C=`#graphql
|
|
300
299
|
mutation storefrontCustomerAccessTokenCreate {
|
|
301
300
|
storefrontCustomerAccessTokenCreate {
|
|
302
301
|
customerAccessToken
|
|
303
302
|
}
|
|
304
303
|
}
|
|
305
|
-
`,{data:
|
|
304
|
+
`,{data:S}=await N(C),A=S?.storefrontCustomerAccessTokenCreate?.customerAccessToken;A&&te({customerAccessToken:A});}return {login:async C=>{Te(r,t);let S=new URL(`${r}/auth/oauth/authorize`),A=fr(),T=Ve();if(S.searchParams.set("client_id",t),S.searchParams.set("scope","openid email"),S.searchParams.append("response_type","code"),S.searchParams.append("redirect_uri",l),S.searchParams.set("scope","openid email https://api.customers.com/auth/customer.graphql"),S.searchParams.append("state",A),S.searchParams.append("nonce",T),C?.uiLocales){let[D,O]=C.uiLocales.split("-"),k=D.toLowerCase();O&&(k+=`-${O.toUpperCase()}`),S.searchParams.append("ui_locales",k);}let M=dr(),V=await lr(M);return e.set(E,{...e.get(E),codeVerifier:M,state:A,nonce:T,redirectPath:Ue(a.url)||_e(a,"Referer")||hr}),S.searchParams.append("code_challenge",V),S.searchParams.append("code_challenge_method","S256"),Ae(S.toString(),{headers:{"Set-Cookie":await e.commit()}})},logout:async C=>{Te(r,t);let S=e.get(E)?.idToken,A=it({requestUrl:m,defaultUrl:m,redirectUrl:C?.postLogoutRedirectUri}),T=S?new URL(`${r}/auth/logout?${new URLSearchParams([["id_token_hint",S],["post_logout_redirect_uri",A]]).toString()}`).toString():A;return ue(e),Ae(T,{headers:{"Set-Cookie":await e.commit()}})},isLoggedIn:f,handleAuthStatus:I,getAccessToken:v,getApiUrl:()=>d,mutate:N,query:F,authorize:async()=>{Te(r,t);let C=y.searchParams.get("code"),S=y.searchParams.get("state");if(!C||!S)throw ue(e),new _("Unauthorized","No code or state parameter found in the redirect URL.",{"Set-Cookie":await e.commit()});if(e.get(E)?.state!==S)throw ue(e),new _("Unauthorized","The session state does not match the state parameter. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.",{"Set-Cookie":await e.commit()});let A=t,T=new URLSearchParams;T.append("grant_type","authorization_code"),T.append("client_id",A),T.append("redirect_uri",l),T.append("code",C);let M=e.get(E)?.codeVerifier;if(!M)throw new _("Unauthorized","No code verifier found in the session. Make sure that the session is configured correctly and passed to `createCustomerAccountClient`.");T.append("code_verifier",M);let V={"content-type":"application/x-www-form-urlencoded","User-Agent":ne,Origin:m},D=q?.();new Date().getTime();let k=`${r}/auth/oauth/token`,b=await fetch(k,{method:"POST",headers:V,body:T});if(!b.ok)throw new Response(await b.text(),{status:b.status,headers:{"Content-Type":"text/html; charset=utf-8"}});let{access_token:U,expires_in:le,id_token:re,refresh_token:$}=await b.json(),ye=e.get(E)?.nonce,Lt=await mr(re);if(ye!==Lt)throw new _("Unauthorized",`Returned nonce does not match: ${ye} !== ${Lt}`);let Kr=await ft(U,t,r,m,{waitUntil:n,stackInfo:D,...J(a)}),zr=e.get(E)?.redirectPath;return e.set(E,{accessToken:Kr,expiresAt:new Date(new Date().getTime()+(le-120)*1e3).getTime()+"",refreshToken:$,idToken:re}),await be(),Ae(zr||hr,{headers:{"Set-Cookie":await e.commit()}})},UNSTABLE_setBuyer:te,UNSTABLE_getBuyer:L}}function Te(e,t){try{if(!e||!t)throw Error();new URL(e);}catch{console.error(new Error("[h2:error:customerAccount] You do not have the valid credential to use Customer Account API.\nRun `h2 env pull` to link your store credentials."));let r="Internal Server Error";throw new Response(r,{status:500})}}var zo="https://raw.githubusercontent.com/Shopify/hydrogen/main/docs/changelog.json";async function Jo({request:e,changelogUrl:t}){new URL(e.url).searchParams;return fetch(t||zo)}var Cr="cartFormInput";function B({children:e,action:t,inputs:r,route:o,fetcherKey:a}){let n=react$1.useFetcher({key:a});return jsxRuntime.jsxs(n.Form,{action:o||"",method:"post",children:[(t||r)&&jsxRuntime.jsx("input",{type:"hidden",name:Cr,value:JSON.stringify({action:t,inputs:r})}),typeof e=="function"?e(n):e]})}B.INPUT_NAME=Cr;B.ACTIONS={AttributesUpdateInput:"AttributesUpdateInput",BuyerIdentityUpdate:"BuyerIdentityUpdate",Create:"Create",DiscountCodesUpdate:"DiscountCodesUpdate",LinesAdd:"LinesAdd",LinesRemove:"LinesRemove",LinesUpdate:"LinesUpdate",NoteUpdate:"NoteUpdate",SelectedDeliveryOptionsUpdate:"SelectedDeliveryOptionsUpdate",MetafieldsSet:"MetafieldsSet",MetafieldDelete:"MetafieldDelete"};function Xo(e){let t={};for(let i of e.entries()){let u=i[0],c=e.getAll(u);t[u]=c.length>1?c:i[1];}let{cartFormInput:r,...o}=t,{action:a,inputs:n}=r?JSON.parse(String(r)):{};return {action:a,inputs:{...n,...o}}}B.getFormInput=Xo;var R=`#graphql
|
|
306
305
|
fragment CartApiError on CartUserError {
|
|
307
306
|
message
|
|
308
307
|
field
|
|
309
308
|
code
|
|
310
309
|
}
|
|
311
|
-
`,
|
|
310
|
+
`,w=`#graphql
|
|
312
311
|
fragment CartApiMutation on Cart {
|
|
313
312
|
id
|
|
314
313
|
totalQuantity
|
|
315
314
|
}
|
|
316
|
-
`;function
|
|
315
|
+
`;function mt(e){return async(t,r)=>{let o=e.customerAccount?await e.customerAccount.UNSTABLE_getBuyer():void 0,{cartId:a,...n}=r||{},{buyerIdentity:i,...u}=t,{cartCreate:c,errors:s}=await e.storefront.mutate(ta(e.cartFragment),{variables:{input:{...u,buyerIdentity:{...o,...i}},...n}});return P(c,s)}}var ta=(e=w)=>`#graphql
|
|
317
316
|
mutation cartCreate(
|
|
318
317
|
$input: CartInput!
|
|
319
318
|
$country: CountryCode = ZZ
|
|
@@ -330,8 +329,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
330
329
|
}
|
|
331
330
|
}
|
|
332
331
|
${e}
|
|
333
|
-
${
|
|
334
|
-
`;function
|
|
332
|
+
${R}
|
|
333
|
+
`;function gt({storefront:e,customerAccount:t,getCartId:r,cartFragment:o}){return async a=>{let n=r();if(!n)return null;let[i,{cart:u,errors:c}]=await Promise.all([t?t.isLoggedIn():!1,e.query(oa(o),{variables:{cartId:n,...a},cache:e.CacheNone()})]);return P(ra(i,u),c)}}function ra(e,t){if(e&&t&&t.checkoutUrl){let r=new URL(t.checkoutUrl);r.searchParams.set("logged_in","true"),t.checkoutUrl=r.toString();}return t}var oa=(e=aa)=>`#graphql
|
|
335
334
|
query CartQuery(
|
|
336
335
|
$cartId: ID!
|
|
337
336
|
$numCartLines: Int = 100
|
|
@@ -344,7 +343,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
344
343
|
}
|
|
345
344
|
|
|
346
345
|
${e}
|
|
347
|
-
`,
|
|
346
|
+
`,aa=`#graphql
|
|
348
347
|
fragment CartApiQuery on Cart {
|
|
349
348
|
updatedAt
|
|
350
349
|
id
|
|
@@ -452,7 +451,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
452
451
|
width
|
|
453
452
|
height
|
|
454
453
|
}
|
|
455
|
-
`;function
|
|
454
|
+
`;function ht(e){return async(t,r)=>{let{cartLinesAdd:o,errors:a}=await e.storefront.mutate(na(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return P(o,a)}}var na=(e=w)=>`#graphql
|
|
456
455
|
mutation cartLinesAdd(
|
|
457
456
|
$cartId: ID!
|
|
458
457
|
$lines: [CartLineInput!]!
|
|
@@ -470,8 +469,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
470
469
|
}
|
|
471
470
|
|
|
472
471
|
${e}
|
|
473
|
-
${
|
|
474
|
-
`;function
|
|
472
|
+
${R}
|
|
473
|
+
`;var Sr="__h_pending_";function Pr(e){return Sr+e}function Fe(e){return e.startsWith(Sr)}function $e(e,t){if(t.some(r=>Fe(typeof r=="string"?r:r.id)))throw new Error(`Tried to perform an action on an optimistic line. Make sure to disable your "${e}" CartForm action when the line is optimistic.`)}function Ct(e){return async(t,r)=>{$e("updateLines",t);let{cartLinesUpdate:o,errors:a}=await e.storefront.mutate(ia(e.cartFragment),{variables:{cartId:e.getCartId(),lines:t,...r}});return P(o,a)}}var ia=(e=w)=>`#graphql
|
|
475
474
|
mutation cartLinesUpdate(
|
|
476
475
|
$cartId: ID!
|
|
477
476
|
$lines: [CartLineUpdateInput!]!
|
|
@@ -489,8 +488,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
489
488
|
}
|
|
490
489
|
|
|
491
490
|
${e}
|
|
492
|
-
${
|
|
493
|
-
`;function
|
|
491
|
+
${R}
|
|
492
|
+
`;function St(e){return async(t,r)=>{$e("removeLines",t);let{cartLinesRemove:o,errors:a}=await e.storefront.mutate(sa(e.cartFragment),{variables:{cartId:e.getCartId(),lineIds:t,...r}});return P(o,a)}}var sa=(e=w)=>`#graphql
|
|
494
493
|
mutation cartLinesRemove(
|
|
495
494
|
$cartId: ID!
|
|
496
495
|
$lineIds: [ID!]!
|
|
@@ -508,8 +507,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
508
507
|
}
|
|
509
508
|
|
|
510
509
|
${e}
|
|
511
|
-
${
|
|
512
|
-
`;function
|
|
510
|
+
${R}
|
|
511
|
+
`;function Pt(e){return async(t,r)=>{let o=t.filter((i,u,c)=>c.indexOf(i)===u),{cartDiscountCodesUpdate:a,errors:n}=await e.storefront.mutate(ca(e.cartFragment),{variables:{cartId:e.getCartId(),discountCodes:o,...r}});return P(a,n)}}var ca=(e=w)=>`#graphql
|
|
513
512
|
mutation cartDiscountCodesUpdate(
|
|
514
513
|
$cartId: ID!
|
|
515
514
|
$discountCodes: [String!]
|
|
@@ -526,8 +525,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
526
525
|
}
|
|
527
526
|
}
|
|
528
527
|
${e}
|
|
529
|
-
${
|
|
530
|
-
`;function
|
|
528
|
+
${R}
|
|
529
|
+
`;function At(e){return async(t,r)=>{t.companyLocationId&&e.customerAccount&&e.customerAccount.UNSTABLE_setBuyer({companyLocationId:t.companyLocationId});let o=e.customerAccount?await e.customerAccount.UNSTABLE_getBuyer():void 0,{cartBuyerIdentityUpdate:a,errors:n}=await e.storefront.mutate(ua(e.cartFragment),{variables:{cartId:e.getCartId(),buyerIdentity:{...o,...t},...r}});return P(a,n)}}var ua=(e=w)=>`#graphql
|
|
531
530
|
mutation cartBuyerIdentityUpdate(
|
|
532
531
|
$cartId: ID!
|
|
533
532
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
@@ -544,8 +543,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
544
543
|
}
|
|
545
544
|
}
|
|
546
545
|
${e}
|
|
547
|
-
${
|
|
548
|
-
`;function
|
|
546
|
+
${R}
|
|
547
|
+
`;function Tt(e){return async(t,r)=>{let{cartNoteUpdate:o,errors:a}=await e.storefront.mutate(pa(e.cartFragment),{variables:{cartId:e.getCartId(),note:t,...r}});return P(o,a)}}var pa=(e=w)=>`#graphql
|
|
549
548
|
mutation cartNoteUpdate(
|
|
550
549
|
$cartId: ID!
|
|
551
550
|
$note: String!
|
|
@@ -562,8 +561,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
562
561
|
}
|
|
563
562
|
}
|
|
564
563
|
${e}
|
|
565
|
-
${
|
|
566
|
-
`;function
|
|
564
|
+
${R}
|
|
565
|
+
`;function vt(e){return async(t,r)=>{let{cartSelectedDeliveryOptionsUpdate:o,errors:a}=await e.storefront.mutate(da(e.cartFragment),{variables:{cartId:e.getCartId(),selectedDeliveryOptions:t,...r}});return P(o,a)}}var da=(e=w)=>`#graphql
|
|
567
566
|
mutation cartSelectedDeliveryOptionsUpdate(
|
|
568
567
|
$cartId: ID!
|
|
569
568
|
$selectedDeliveryOptions: [CartSelectedDeliveryOptionInput!]!
|
|
@@ -580,8 +579,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
580
579
|
}
|
|
581
580
|
}
|
|
582
581
|
${e}
|
|
583
|
-
${
|
|
584
|
-
`;function
|
|
582
|
+
${R}
|
|
583
|
+
`;function It(e){return async(t,r)=>{let{cartAttributesUpdate:o,errors:a}=await e.storefront.mutate(la(e.cartFragment),{variables:{cartId:r?.cartId||e.getCartId(),attributes:t}});return P(o,a)}}var la=(e=w)=>`#graphql
|
|
585
584
|
mutation cartAttributesUpdate(
|
|
586
585
|
$cartId: ID!
|
|
587
586
|
$attributes: [AttributeInput!]!
|
|
@@ -596,8 +595,8 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
596
595
|
}
|
|
597
596
|
}
|
|
598
597
|
${e}
|
|
599
|
-
${
|
|
600
|
-
`;function
|
|
598
|
+
${R}
|
|
599
|
+
`;function Rt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),a=t.map(u=>({...u,ownerId:o})),{cartMetafieldsSet:n,errors:i}=await e.storefront.mutate(ya(),{variables:{metafields:a}});return P({cart:{id:o},...n},i)}}var ya=()=>`#graphql
|
|
601
600
|
mutation cartMetafieldsSet(
|
|
602
601
|
$metafields: [CartMetafieldsSetInput!]!
|
|
603
602
|
$language: LanguageCode
|
|
@@ -612,7 +611,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
612
611
|
}
|
|
613
612
|
}
|
|
614
613
|
}
|
|
615
|
-
`;function
|
|
614
|
+
`;function wt(e){return async(t,r)=>{let o=r?.cartId||e.getCartId(),{cartMetafieldDelete:a,errors:n}=await e.storefront.mutate(fa(),{variables:{input:{ownerId:o,key:t}}});return P({cart:{id:o},...a},n)}}var fa=()=>`#graphql
|
|
616
615
|
mutation cartMetafieldDelete(
|
|
617
616
|
$input: CartMetafieldDeleteInput!
|
|
618
617
|
) {
|
|
@@ -624,7 +623,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
624
623
|
}
|
|
625
624
|
}
|
|
626
625
|
}
|
|
627
|
-
`;var ca=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function yr(e){let t={},r,o,a=0,s=e.split(/;\s*/g),n,i;for(;a<s.length;a++)if(o=s[a],r=o.indexOf("="),~r){if(n=o.substring(0,r++).trim(),i=o.substring(r).trim(),i[0]==='"'&&(i=i.substring(1,i.length-1)),~i.indexOf("%"))try{i=decodeURIComponent(i);}catch{}ca.has(o=n.toLowerCase())?o==="expires"?t.expires=new Date(i):o==="max-age"?t.maxage=+i:t[o]=i:t[n]=i;}else (n=o.trim().toLowerCase())&&(n==="httponly"||n==="secure")&&(t[n]=!0);return t}function fr(e,t,r={}){let o=e+"="+encodeURIComponent(t);return r.expires&&(o+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(o+="; Max-Age="+(r.maxage|0)),r.domain&&(o+="; Domain="+r.domain),r.path&&(o+="; Path="+r.path),r.samesite&&(o+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(o+="; Secure"),r.httponly&&(o+="; HttpOnly"),o}var ua=e=>{let t=yr(e.get("Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var pa=e=>t=>{let r=new Headers;return r.append("Set-Cookie",fr("cart",t.split("/").pop()||"",{path:"/",...e})),r};function la(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:a,cartQueryFragment:s,cartMutateFragment:n}=e,i=t(),u=()=>i||t(),c={storefront:o,getCartId:u,cartFragment:n,customerAccount:a},l=dt(c),y=async function(...p){let d=await l(...p);return i=d?.cart?.id,d},m={get:yt({storefront:o,customerAccount:a,getCartId:u,cartFragment:s}),getCartId:u,setCartId:r,create:y,addLines:async(p,d)=>i||d?.cartId?await ft(c)(p,d):await y({lines:p},d),updateLines:mt(c),removeLines:gt(c),updateDiscountCodes:async(p,d)=>i||d?.cartId?await ht(c)(p,d):await y({discountCodes:p},d),updateBuyerIdentity:async(p,d)=>i||d?.cartId?await Ct(c)(p,d):await y({buyerIdentity:p},d),updateNote:async(p,d)=>i||d?.cartId?await St(c)(p,d):await y({note:p},d),updateSelectedDeliveryOption:Pt(c),updateAttributes:async(p,d)=>i||d?.cartId?await At(c)(p,d):await y({attributes:p},d),setMetafields:async(p,d)=>i||d?.cartId?await Tt(c)(p,d):await y({metafields:p},d),deleteMetafield:vt(c)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function ga({handle:e,options:t=[],variants:r=[],productPath:o="products",children:a}){let s=r instanceof Array?r:hydrogenReact.flattenConnection(r),{searchParams:n,path:i,alreadyOnProductPage:u}=Ca(e,o),c=t.filter(l=>l?.values?.length===1);return react.createElement(react.Fragment,null,...react.useMemo(()=>t.filter(l=>l?.values?.length>1).map(l=>{let y,m=[];for(let p of l.values){let d=new URLSearchParams(u?n:void 0);d.set(l.name,p),c.forEach(v=>{d.set(v.name,v.values[0]);});let g=s.find(v=>v?.selectedOptions?.every(N=>d.get(N?.name)===N?.value)),S=n.get(l.name),f=S?S===p:!1;f&&(y=p);let R="?"+d.toString();m.push({value:p,isAvailable:g?g.availableForSale:!0,to:i+R,search:R,isActive:f});}return a({option:{name:l.name,value:y,values:m}})}),[t,s,a]))}var ha=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((o,a)=>{r.push({name:a,value:o});}),r};function Ca(e,t){let{pathname:r,search:o}=react$1.useLocation();return react.useMemo(()=>{let a=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(r),s=a&&a.length>0;t=t.startsWith("/")?t.substring(1):t;let n=s?`${a[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(o),alreadyOnProductPage:n===r,path:n}},[r,o,e,t])}var gr=react.createContext(void 0),va=gr.Provider,Rt=()=>react.useContext(gr);function Ra(e){let t=Me(),r=wa(t,e);return {nonce:t,header:r,NonceProvider:({children:a})=>react.createElement(va,{value:t},a)}}function wa(e,t){let{shop:r,...o}=t??{},a=`'nonce-${e}'`,s=["'self'","'unsafe-inline'","https://cdn.shopify.com"],n=["'self'","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&n.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&n.push(`https://${r.storeDomain}`);let u={baseUri:["'self'"],defaultSrc:["'self'",a,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:s,connectSrc:n},c=Object.assign({},u,o);for(let l in u){let y=o[l];l&&y&&(c[l]=Ia(y,u[l]));}return c.scriptSrc instanceof Array&&!c.scriptSrc.includes(a)?c.scriptSrc.push(a):c.defaultSrc instanceof Array&&!c.defaultSrc.includes(a)&&c.defaultSrc.push(a),Ta__default.default({directives:c})}function Ia(e,t){let r=typeof t=="string"?[t]:t,o=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(s=>s==="'none'")?o:[...o,...r]:r}var Ea=react.forwardRef((e,t)=>{let r=Rt();return jsxRuntime.jsx("script",{suppressHydrationWarning:!0,...e,nonce:r,ref:t})});function Oa(e){let t=react$1.useFetchers(),r={};for(let{formData:o}of t)if(o?.get("optimistic-identifier")===e)try{if(o.has("optimistic-data")){let a=JSON.parse(String(o.get("optimistic-data")));Object.assign(r,a);}}catch{}return r}function Ua({id:e,data:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function Na(e){return jsxRuntime.jsx(hydrogenReact.ShopPayButton,{channel:"hydrogen",...e})}function ue(e){let{type:t,data:r={},customData:o}=e,a=react$1.useLocation(),{publish:s,cart:n,prevCart:i,shop:u}=Y(),c=a.pathname+a.search;return react.useEffect(()=>{if(!u)return;let l={...r,customData:o,url:window.location.href,cart:n,prevCart:i,shop:u};s(t,l);},[s,c,n,i,u]),null}function Cr(e){return jsxRuntime.jsx(ue,{...e,type:"page_viewed"})}function Sr(e){return jsxRuntime.jsx(ue,{...e,type:"product_viewed"})}function Pr(e){return jsxRuntime.jsx(ue,{...e,type:"collection_viewed"})}function Ar(e){return jsxRuntime.jsx(ue,{...e,type:"cart_viewed"})}function Tr(e){return jsxRuntime.jsx(ue,{...e,type:"search_viewed"})}function vr(e){return jsxRuntime.jsx(ue,{...e})}var X={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var Ha="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.1/consent-tracking-api.js",Qa="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function wr(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} consent configuration.`);}function wt(e){let{withPrivacyBanner:t=!0,onVisitorConsentCollected:r,onReady:o,...a}=e,s=react.useRef(!1),n=hydrogenReact.useLoadScript(t?Qa:Ha,{attributes:{id:"customer-privacy-api"}});a.checkoutDomain||wr("checkoutDomain"),a.storefrontAccessToken||wr("storefrontAccessToken"),react.useEffect(()=>{let i=u=>{r&&r(u.detail);};return document.addEventListener("visitorConsentCollected",i),()=>{document.removeEventListener("visitorConsentCollected",i);}},[r]),react.useEffect(()=>{if(!(n!=="done"||s.current)){if(s.current=!0,t&&window?.privacyBanner&&window?.privacyBanner?.loadBanner({checkoutRootDomain:a.checkoutDomain,storefrontAccessToken:a.storefrontAccessToken}),window.Shopify?.customerPrivacy){let i=window.Shopify.customerPrivacy.setTrackingConsent;window.Shopify.customerPrivacy.setTrackingConsent=(u,c)=>{i({...u,headlessStorefront:!0,checkoutRootDomain:a.checkoutDomain,storefrontAccessToken:a.storefrontAccessToken},c);};}o&&!t&&o();}},[n,t,a]);}function It(){try{return window.Shopify&&window.Shopify.customerPrivacy?window.Shopify?.customerPrivacy:null}catch{return null}}function ja(){let e=It();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function Ir({consent:e,onReady:t}){let{subscribe:r,register:o,canTrack:a}=Y(),{ready:s}=o("Internal_Shopify_Analytics"),{ready:n}=o("Internal_Shopify_CustomerPrivacy"),i=()=>{n(),t();};return wt({...e,onVisitorConsentCollected:i,onReady:()=>{e.withPrivacyBanner||i();}}),hydrogenReact.useShopifyCookies({hasUserConsent:a()}),react.useEffect(()=>{r(X.PAGE_VIEWED,Ja),r(X.PRODUCT_VIEWED,za),r(X.COLLECTION_VIEWED,Ya),r(X.SEARCH_VIEWED,Xa),r(X.PRODUCT_ADD_TO_CART,Za),s();},[r,s]),null}function Fe(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Re(e){let t=ja(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){Fe("shopId");return}if(!e?.shop?.acceptedLanguage){Fe("acceptedLanguage");return}if(!e?.shop?.currency){Fe("currency");return}if(!e?.shop?.hydrogenSubchannelId){Fe("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",...e.shop,hasUserConsent:r,...hydrogenReact.getClientBrowserParameters(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function Ka(e,t){if(t===null)return;let r=Re(e);return r?{...r,cartId:t.id}:void 0}var W={};function Ja(e){let t=Re(e);t&&(hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...W}}),W={});}function za(e){let t=Re(e);if(t&&br({eventName:tn,productField:"products",variantField:"product.<displayed_variant>",fromSource:"product_viewed products array",products:e.products})){let r=bt(e.products);W={pageType:hydrogenReact.AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...W,products:bt(e.products)},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function Ya(e){let t=Re(e);t&&(W={pageType:hydrogenReact.AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...W,collectionHandle:e.collection.handle},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function Xa(e){let t=Re(e);t&&(W={pageType:hydrogenReact.AnalyticsPageType.search},t={...t,...W,searchString:e.searchTerm},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.SEARCH_VIEW,payload:t}));}function Za(e){let{cart:t,currentLine:r}=e,o=Ka(e,t);!o||!r?.id||en({matchedLine:r,eventPayload:o});}function en({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};br({eventName:rn,productField:"merchandise.product",variantField:"merchandise",fromSource:"cart query",products:[r]})&&hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.ADD_TO_CART,payload:{...t,products:bt([r])}});}var tn="Product viewed",rn="Add to cart";function Z(e,t,r){console.error(`[h2:error:ShopifyAnalytics] ${e}: ${t} is required from the ${r}.`);}function br({eventName:e,productField:t,variantField:r,products:o,fromSource:a}){return !o||o.length===0?(Z(e,`${t}`,a),!1):(o.forEach(s=>{if(!s.id)return Z(e,`${t}.id`,a),!1;if(!s.title)return Z(e,`${t}.title`,a),!1;if(!s.price)return Z(e,`${r}.price.amount`,a),!1;if(!s.vendor)return Z(e,`${t}.vendor`,a),!1;if(!s.variantId)return Z(e,`${r}.id`,a),!1;if(!s.variantTitle)return Z(e,`${r}.title`,a),!1}),!0)}function bt(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function Dr(e){console.error(`[h2:error:CartAnalytics] Unable to set up cart analytics events: ${e} is missing.`);}function Or({cart:e,setCarts:t}){let{publish:r,shop:o,customData:a,canTrack:s,cart:n,prevCart:i}=Y(),u=react.useRef(null);return react.useEffect(()=>{if(e)return Promise.resolve(e).then(c=>{if(c&&c.lines){if(!c.id){Dr("cart.id");return}if(!c.updatedAt){Dr("cart.updatedAt");return}}t(({cart:l,prevCart:y})=>c?.updatedAt!==l?.updatedAt?{cart:c,prevCart:l}:{cart:l,prevCart:y});}),()=>{}},[t,e]),react.useEffect(()=>{if(!n||!n?.updatedAt||n?.updatedAt===i?.updatedAt)return;let c;try{c=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{c=null;}if(n.id===c?.id&&n.updatedAt===c?.updatedAt)return;let l={eventTimestamp:Date.now(),cart:n,prevCart:i,shop:o,customData:a};if(n.updatedAt===u.current)return;u.current=n.updatedAt,r("cart_updated",l),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:n.id,updatedAt:n.updatedAt}));let y=i?.lines?hydrogenReact.flattenConnection(i?.lines):[],m=n.lines?hydrogenReact.flattenConnection(n.lines):[];y?.forEach(p=>{let d=m.filter(g=>p.id===g.id);if(d?.length===1){let g=d[0];p.quantity<g.quantity?r("product_added_to_cart",{...l,prevLine:p,currentLine:g}):p.quantity>g.quantity&&r("product_removed_from_cart",{...l,prevLine:p,currentLine:g});}else r("product_removed_from_cart",{...l,prevLine:p});}),m?.forEach(p=>{let d=y.filter(g=>p.id===g.id);(!d||d.length===0)&&r("product_added_to_cart",{...l,currentLine:p});});},[n,i,r,o,a,s]),null}var pn={canTrack:()=>!1,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}})},Vr=react.createContext(pn),qe=new Map,we={};function Fr(){return Object.values(we).every(Boolean)}function _r(e,t){qe.has(e)||qe.set(e,new Map),qe.get(e)?.set(t.toString(),t);}var He=new Map;function kr(e,t){if(!Fr()){He.set(e,t);return}$r(e,t);}function $r(e,t){(qe.get(e)??new Map).forEach((r,o)=>{try{r(t);}catch(a){typeof a=="object"&&a instanceof Error?console.error("Analytics publish error",a.message,o,a.stack):console.error("Analytics publish error",a,o);}});}function Lr(e){return we.hasOwnProperty(e)||(we[e]=!1),{ready:()=>{we[e]=!0,Fr()&&He.size>0&&(He.forEach((t,r)=>{$r(r,t);}),He.clear());}}}function Nr(){try{return window.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch{}return !1}function Mr(e){return `[h2:error:Analytics.Provider] - ${e} is required`}function ln({canTrack:e,cart:t,children:r,consent:o,customData:a={},shop:s=null,disableThrowOnError:n=!1}){if(!o.checkoutDomain){let S=Mr("consent.checkoutDomain");n?console.error(S):Ur__default.default(!1,S);}if(!o.storefrontAccessToken){let S=Mr("consent.storefrontAccessToken");n?console.error(S):Ur__default.default(!1,S);}let i=react.useRef(!1),{shop:u}=dn(s),[c,l]=react.useState(!!e),[y,m]=react.useState({cart:null,prevCart:null}),[p,d]=react.useState(e?()=>e:()=>Nr),g=react.useMemo(()=>({canTrack:p,...y,customData:a,publish:p()?kr:()=>{},shop:u,subscribe:_r,register:Lr}),[c,p(),p,JSON.stringify(p),y,y.cart?.updatedAt,y.prevCart,kr,_r,a,u,Lr,JSON.stringify(we)]);return jsxRuntime.jsxs(Vr.Provider,{value:g,children:[r,!!u&&jsxRuntime.jsx(Cr,{}),!!u&&!!t&&jsxRuntime.jsx(Or,{cart:t,setCarts:m}),!!u&&jsxRuntime.jsx(Ir,{consent:o,onReady:()=>{i.current=!0,l(!0),d(()=>Nr);}})]})}function Y(){let e=react.useContext(Vr);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function dn(e){let[t,r]=react.useState(null);return react.useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function yn({storefront:e,publicStorefrontId:t="0"}){return e.query(fn,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var fn=`#graphql
|
|
626
|
+
`;var ga=e=>{let t=cookie.parse(e.get("Cookie")||"");return ()=>t.cart?`gid://shopify/Cart/${t.cart}`:void 0};var Ca=e=>t=>{let r=new Headers;return r.append("Set-Cookie",cookie.stringify("cart",t.split("/").pop()||"",{path:"/",...e})),r};function Sa(e){let{getCartId:t,setCartId:r,storefront:o,customerAccount:a,cartQueryFragment:n,cartMutateFragment:i}=e,u=t(),c=()=>u||t(),s={storefront:o,getCartId:c,cartFragment:i,customerAccount:a},p=mt(s),y=async function(...l){let d=await p(...l);return u=d?.cart?.id,d},m={get:gt({storefront:o,customerAccount:a,getCartId:c,cartFragment:n}),getCartId:c,setCartId:r,create:y,addLines:async(l,d)=>{let g=l.map(h=>({attributes:h.attributes,quantity:h.quantity,merchandiseId:h.merchandiseId,sellingPlanId:h.sellingPlanId}));return u||d?.cartId?await ht(s)(g,d):await y({lines:g},d)},updateLines:Ct(s),removeLines:St(s),updateDiscountCodes:async(l,d)=>u||d?.cartId?await Pt(s)(l,d):await y({discountCodes:l},d),updateBuyerIdentity:async(l,d)=>u||d?.cartId?await At(s)(l,d):await y({buyerIdentity:l},d),updateNote:async(l,d)=>u||d?.cartId?await Tt(s)(l,d):await y({note:l},d),updateSelectedDeliveryOption:vt(s),updateAttributes:async(l,d)=>u||d?.cartId?await It(s)(l,d):await y({attributes:l},d),setMetafields:async(l,d)=>u||d?.cartId?await Rt(s)(l,d):await y({metafields:l},d),deleteMetafield:wt(s)};return "customMethods"in e?{...m,...e.customMethods??{}}:m}function Aa(e){let t=react$1.useFetchers();if(!t||!t.length)return e;let r=e?.lines?structuredClone(e):{lines:{nodes:[]}},o=r.lines.nodes,a=!1;for(let{formData:n}of t){if(!n)continue;let i=B.getFormInput(n);if(i.action===B.ACTIONS.LinesAdd)for(let u of i.inputs.lines){if(!u.selectedVariant){console.error("[h2:error:useOptimisticCart] No selected variant was passed in the cart action. Make sure to pass the selected variant if you want to use an optimistic cart");continue}let c=o.find(s=>s.merchandise.id===u.selectedVariant?.id);a=!0,c?(c.quantity=(c.quantity||1)+(u.quantity||1),c.isOptimistic=!0):o.unshift({id:Pr(u.selectedVariant.id),merchandise:u.selectedVariant,isOptimistic:!0,quantity:u.quantity||1});}else if(i.action===B.ACTIONS.LinesRemove)for(let u of i.inputs.lineIds){let c=o.findIndex(s=>s.id===u);if(c!==-1){if(Fe(o[c].id)){console.error("[h2:error:useOptimisticCart] Tried to remove an optimistic line that has not been added to the cart yet");continue}o.splice(c,1),a=!0;}else console.warn(`[h2:warn:useOptimisticCart] Tried to remove line '${u}' but it doesn't exist in the cart`);}else if(i.action===B.ACTIONS.LinesUpdate)for(let u of i.inputs.lines){let c=o.findIndex(s=>u.id===s.id);if(c>-1){if(Fe(o[c].id)){console.error("[h2:error:useOptimisticCart] Tried to update an optimistic line that has not been added to the cart yet");continue}o[c].quantity=u.quantity,o[c].quantity===0&&o.splice(c,1),a=!0;}else console.warn(`[h2:warn:useOptimisticCart] Tried to update line '${u.id}' but it doesn't exist in the cart`);}}return a&&(r.isOptimistic=a),r}function wa({handle:e,options:t=[],variants:r=[],productPath:o="products",children:a}){let n=r instanceof Array?r:hydrogenReact.flattenConnection(r),{searchParams:i,path:u,alreadyOnProductPage:c}=Ea(e,o),s=t.filter(p=>p?.values?.length===1);return react.createElement(react.Fragment,null,...react.useMemo(()=>t.filter(p=>p?.values?.length>1).map(p=>{let y,m=[];for(let l of p.values){let d=new URLSearchParams(c?i:void 0);d.set(p.name,l),s.forEach(v=>{d.set(v.name,v.values[0]);});let g=n.find(v=>v?.selectedOptions?.every(N=>d.get(N?.name)===N?.value)),h=i.get(p.name),f=h?h===l:!1;f&&(y=l);let I="?"+d.toString();m.push({value:l,isAvailable:g?g.availableForSale:!0,to:u+I,search:I,isActive:f,variant:g});}return a({option:{name:p.name,value:y,values:m}})}),[t,n,a]))}var ba=e=>{if(typeof e?.url>"u")throw new TypeError(`Expected a Request instance, got ${typeof e}`);let t=new URL(e.url).searchParams,r=[];return t.forEach((o,a)=>{r.push({name:a,value:o});}),r};function Ea(e,t){let{pathname:r,search:o}=react$1.useLocation();return react.useMemo(()=>{let a=/(\/[a-zA-Z]{2}-[a-zA-Z]{2}\/)/g.exec(r),n=a&&a.length>0;t=t.startsWith("/")?t.substring(1):t;let i=n?`${a[0]}${t}/${e}`:`/${t}/${e}`;return {searchParams:new URLSearchParams(o),alreadyOnProductPage:i===r,path:i}},[r,o,e,t])}var Tr=react.createContext(void 0),La=Tr.Provider,bt=()=>react.useContext(Tr);function _a(e){let t=Ve(),r=Ua(t,e);return {nonce:t,header:r,NonceProvider:({children:a})=>react.createElement(La,{value:t},a)}}function Ua(e,t){let{shop:r,...o}=t??{},a=`'nonce-${e}'`,n=["'self'","'unsafe-inline'","https://cdn.shopify.com"],i=["'self'","https://monorail-edge.shopifysvc.com"];r&&r.checkoutDomain&&i.push(`https://${r.checkoutDomain}`),r&&r.storeDomain&&i.push(`https://${r.storeDomain}`);let c={baseUri:["'self'"],defaultSrc:["'self'",a,"https://cdn.shopify.com","https://shopify.com"],frameAncestors:["'none'"],styleSrc:n,connectSrc:i},s=Object.assign({},c,o);for(let p in c){let y=o[p];p&&y&&(s[p]=Na(y,c[p]));}return s.scriptSrc instanceof Array&&!s.scriptSrc.includes(a)?s.scriptSrc.push(a):s.defaultSrc instanceof Array&&!s.defaultSrc.includes(a)&&s.defaultSrc.push(a),ka__default.default({directives:s})}function Na(e,t){let r=typeof t=="string"?[t]:t,o=Array.isArray(e)?e:[String(e)];return Array.isArray(r)?r.every(n=>n==="'none'")?o:[...o,...r]:r}var Va=react.forwardRef((e,t)=>{let r=bt();return jsxRuntime.jsx("script",{suppressHydrationWarning:!0,...e,nonce:r,ref:t})});function qa(e){let t=react$1.useFetchers(),r={};for(let{formData:o}of t)if(o?.get("optimistic-identifier")===e)try{if(o.has("optimistic-data")){let a=JSON.parse(String(o.get("optimistic-data")));Object.assign(r,a);}}catch{}return r}function Ha({id:e,data:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-identifier",value:e}),jsxRuntime.jsx("input",{type:"hidden",name:"optimistic-data",value:JSON.stringify(t)})]})}function Wa(e){return jsxRuntime.jsx(hydrogenReact.ShopPayButton,{channel:"hydrogen",...e})}function pe(e){let{type:t,data:r={},customData:o}=e,a=react$1.useLocation(),{publish:n,cart:i,prevCart:u,shop:c,customData:s}=X(),p=a.pathname+a.search,y={...r,customData:{...s,...o},cart:i,prevCart:u,shop:c};return react.useEffect(()=>{c?.shopId&&(y={...y,url:window.location.href},n(t,y));},[n,p,c?.shopId]),null}function Ir(e){return jsxRuntime.jsx(pe,{...e,type:"page_viewed"})}function Rr(e){return jsxRuntime.jsx(pe,{...e,type:"product_viewed"})}function wr(e){return jsxRuntime.jsx(pe,{...e,type:"collection_viewed"})}function br(e){return jsxRuntime.jsx(pe,{...e,type:"cart_viewed"})}function Er(e){return jsxRuntime.jsx(pe,{...e,type:"search_viewed"})}function xr(e){return jsxRuntime.jsx(pe,{...e})}var Z={PAGE_VIEWED:"page_viewed",PRODUCT_VIEWED:"product_viewed",COLLECTION_VIEWED:"collection_viewed",CART_VIEWED:"cart_viewed",SEARCH_VIEWED:"search_viewed",CART_UPDATED:"cart_updated",PRODUCT_ADD_TO_CART:"product_added_to_cart",PRODUCT_REMOVED_FROM_CART:"product_removed_from_cart",CUSTOM_EVENT:"custom_"};var Xa="https://cdn.shopify.com/shopifycloud/consent-tracking-api/v0.1/consent-tracking-api.js",Za="https://cdn.shopify.com/shopifycloud/privacy-banner/storefront-banner.js";function Or(e){console.error(`[h2:error:useCustomerPrivacy] Unable to setup Customer Privacy API: Missing consent.${e} configuration.`);}function Et(e){let{withPrivacyBanner:t=!0,onVisitorConsentCollected:r,onReady:o,...a}=e,n=react.useRef(!1),i=hydrogenReact.useLoadScript(t?Za:Xa,{attributes:{id:"customer-privacy-api"}});react.useEffect(()=>{let u=c=>{r&&r(c.detail);};return document.addEventListener("visitorConsentCollected",u),()=>{document.removeEventListener("visitorConsentCollected",u);}},[r]),react.useEffect(()=>{if(i!=="done"||n.current||(n.current=!0,a.checkoutDomain||Or("checkoutDomain"),a.storefrontAccessToken||Or("storefrontAccessToken"),(a.storefrontAccessToken.startsWith("shpat_")||a.storefrontAccessToken.length!==32)&&console.error("[h2:error:useCustomerPrivacy] It looks like you passed a private access token, make sure to use the public token"),t&&window?.privacyBanner&&window?.privacyBanner?.loadBanner({checkoutRootDomain:a.checkoutDomain,storefrontAccessToken:a.storefrontAccessToken}),!window.Shopify?.customerPrivacy))return;let u=window.Shopify.customerPrivacy.setTrackingConsent;function c(s,p){u({...s,headlessStorefront:!0,checkoutRootDomain:a.checkoutDomain,storefrontAccessToken:a.storefrontAccessToken},p);}window.Shopify.customerPrivacy.setTrackingConsent=c,o&&o();},[i,t,a]);}function xt(){try{return window.Shopify&&window.Shopify.customerPrivacy?window.Shopify?.customerPrivacy:null}catch{return null}}function on(){let e=xt();if(!e)throw new Error("Shopify Customer Privacy API not available. Must be used within a useEffect. Make sure to load the Shopify Customer Privacy API with useCustomerPrivacy() or <AnalyticsProvider>.");return e}function Lr({consent:e,onReady:t,domain:r}){let{subscribe:o,register:a,canTrack:n}=X(),[i,u]=react.useState(!1),[c,s]=react.useState(!1),{ready:p}=a("Internal_Shopify_Analytics"),{ready:y}=a("Internal_Shopify_CustomerPrivacy"),m=()=>{i&&c&&t();},l=()=>{s(!0),y(),m();},{checkoutDomain:d,storefrontAccessToken:g,withPrivacyBanner:h}=e;return Et({checkoutDomain:d||"mock.shop",storefrontAccessToken:g||"abcdefghijklmnopqrstuvwxyz123456",withPrivacyBanner:h,onVisitorConsentCollected:l,onReady:()=>{setTimeout(l,3e3);}}),hydrogenReact.useShopifyCookies({hasUserConsent:n(),domain:r}),react.useEffect(()=>{o(Z.PAGE_VIEWED,nn),o(Z.PRODUCT_VIEWED,sn),o(Z.COLLECTION_VIEWED,cn),o(Z.SEARCH_VIEWED,un),o(Z.PRODUCT_ADD_TO_CART,pn),p(),u(!0),m();},[o,p]),null}function qe(e){console.error(`[h2:error:ShopifyAnalytics] Unable to send Shopify analytics: Missing shop.${e} configuration.`);}function Re(e){let t=on(),r=t.analyticsProcessingAllowed();if(!e?.shop?.shopId){qe("shopId");return}if(!e?.shop?.acceptedLanguage){qe("acceptedLanguage");return}if(!e?.shop?.currency){qe("currency");return}if(!e?.shop?.hydrogenSubchannelId){qe("hydrogenSubchannelId");return}return {shopifySalesChannel:"hydrogen",...e.shop,hasUserConsent:r,...hydrogenReact.getClientBrowserParameters(),ccpaEnforced:!t.saleOfDataAllowed(),gdprEnforced:!(t.marketingAllowed()&&t.analyticsProcessingAllowed())}}function an(e,t){if(t===null)return;let r=Re(e);return r?{...r,cartId:t.id}:void 0}var j={};function nn(e){let t=Re(e);t&&(hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PAGE_VIEW_2,payload:{...t,...j}}),j={});}function sn(e){let t=Re(e);if(t&&_r({eventName:ln,productField:"products",variantField:"product.<displayed_variant>",fromSource:"product_viewed products array",products:e.products})){let r=Dt(e.products);j={pageType:hydrogenReact.AnalyticsPageType.product,resourceId:r[0].productGid},t={...t,...j,products:Dt(e.products)},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.PRODUCT_VIEW,payload:t});}}function cn(e){let t=Re(e);t&&(j={pageType:hydrogenReact.AnalyticsPageType.collection,resourceId:e.collection.id},t={...t,...j,collectionHandle:e.collection.handle},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.COLLECTION_VIEW,payload:t}));}function un(e){let t=Re(e);t&&(j={pageType:hydrogenReact.AnalyticsPageType.search},t={...t,...j,searchString:e.searchTerm},hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.SEARCH_VIEW,payload:t}));}function pn(e){let{cart:t,currentLine:r}=e,o=an(e,t);!o||!r?.id||dn({matchedLine:r,eventPayload:o});}function dn({matchedLine:e,eventPayload:t}){let r={id:e.merchandise.product.id,variantId:e.id,title:e.merchandise.product.title,variantTitle:e.merchandise.title,vendor:e.merchandise.product.vendor,price:e.merchandise.price.amount,quantity:e.quantity,productType:e.merchandise.product.productType,sku:e.merchandise.sku};_r({eventName:yn,productField:"merchandise.product",variantField:"merchandise",fromSource:"cart query",products:[r]})&&hydrogenReact.sendShopifyAnalytics({eventName:hydrogenReact.AnalyticsEventName.ADD_TO_CART,payload:{...t,products:Dt([r])}});}var ln="Product viewed",yn="Add to cart";function ee(e,t,r){console.error(`[h2:error:ShopifyAnalytics] ${e}: ${t} is required from the ${r}.`);}function _r({eventName:e,productField:t,variantField:r,products:o,fromSource:a}){return !o||o.length===0?(ee(e,`${t}`,a),!1):(o.forEach(n=>{if(!n.id)return ee(e,`${t}.id`,a),!1;if(!n.title)return ee(e,`${t}.title`,a),!1;if(!n.price)return ee(e,`${r}.price.amount`,a),!1;if(!n.vendor)return ee(e,`${t}.vendor`,a),!1;if(!n.variantId)return ee(e,`${r}.id`,a),!1;if(!n.variantTitle)return ee(e,`${r}.title`,a),!1}),!0)}function Dt(e){return e.map(t=>{let r={productGid:t.id,variantGid:t.variantId,name:t.title,variantName:t.variantTitle,brand:t.vendor,price:t.price,quantity:t.quantity||1,category:t.productType};return t.sku&&(r.sku=t.sku),t.productType&&(r.category=t.productType),r})}function Mr(e){console.error(`[h2:error:CartAnalytics] Unable to set up cart analytics events: ${e} is missing.`);}function Vr({cart:e,setCarts:t}){let{publish:r,shop:o,customData:a,canTrack:n,cart:i,prevCart:u}=X(),c=react.useRef(null);return react.useEffect(()=>{if(e)return Promise.resolve(e).then(s=>{if(s&&s.lines){if(!s.id){Mr("cart.id");return}if(!s.updatedAt){Mr("cart.updatedAt");return}}t(({cart:p,prevCart:y})=>s?.updatedAt!==p?.updatedAt?{cart:s,prevCart:p}:{cart:p,prevCart:y});}),()=>{}},[t,e]),react.useEffect(()=>{if(!i||!i?.updatedAt||i?.updatedAt===u?.updatedAt)return;let s;try{s=JSON.parse(localStorage.getItem("cartLastUpdatedAt")||"");}catch{s=null;}if(i.id===s?.id&&i.updatedAt===s?.updatedAt)return;let p={eventTimestamp:Date.now(),cart:i,prevCart:u,shop:o,customData:a};if(i.updatedAt===c.current)return;c.current=i.updatedAt,r("cart_updated",p),localStorage.setItem("cartLastUpdatedAt",JSON.stringify({id:i.id,updatedAt:i.updatedAt}));let y=u?.lines?hydrogenReact.flattenConnection(u?.lines):[],m=i.lines?hydrogenReact.flattenConnection(i.lines):[];y?.forEach(l=>{let d=m.filter(g=>l.id===g.id);if(d?.length===1){let g=d[0];l.quantity<g.quantity?r("product_added_to_cart",{...p,prevLine:l,currentLine:g}):l.quantity>g.quantity&&r("product_removed_from_cart",{...p,prevLine:l,currentLine:g});}else r("product_removed_from_cart",{...p,prevLine:l});}),m?.forEach(l=>{let d=y.filter(g=>l.id===g.id);(!d||d.length===0)&&r("product_added_to_cart",{...p,currentLine:l});});},[i,u,r,o,a,n]),null}var Pn={canTrack:()=>!1,cart:null,customData:{},prevCart:null,publish:()=>{},shop:null,subscribe:()=>{},register:()=>({ready:()=>{}})},Br=react.createContext(Pn),Qe=new Map,we={};function Gr(){return Object.values(we).every(Boolean)}function Fr(e,t){Qe.has(e)||Qe.set(e,new Map),Qe.get(e)?.set(t.toString(),t);}var Be=new Map;function $r(e,t){if(!Gr()){Be.set(e,t);return}Wr(e,t);}function Wr(e,t){(Qe.get(e)??new Map).forEach((r,o)=>{try{r(t);}catch(a){typeof a=="object"&&a instanceof Error?console.error("Analytics publish error",a.message,o,a.stack):console.error("Analytics publish error",a,o);}});}function qr(e){return we.hasOwnProperty(e)||(we[e]=!1),{ready:()=>{we[e]=!0,Gr()&&Be.size>0&&(Be.forEach((t,r)=>{Wr(r,t);}),Be.clear());}}}function Hr(){try{return window.Shopify.customerPrivacy.analyticsProcessingAllowed()}catch{}return !1}function Qr(e,t){return `[h2:error:Analytics.Provider] - ${e} is required. Make sure ${t} is defined in your environment variables. See https://h2o.fyi/analytics/consent to learn how to setup environment variables in the Shopify admin.`}function An({canTrack:e,cart:t,children:r,consent:o,customData:a={},shop:n=null,disableThrowOnError:i=!1,cookieDomain:u}){let c=react.useRef(!1),{shop:s}=Tn(n),[p,y]=react.useState(!!e),[m,l]=react.useState({cart:null,prevCart:null}),[d,g]=react.useState(e?()=>e:()=>Hr);if(s)if(/\/68817551382$/.test(s.shopId))jt("[h2:error:Analytics.Provider] - Mock shop is used. Analytics will not work properly.");else {if(!o.checkoutDomain){let f=Qr("consent.checkoutDomain","PUBLIC_CHECKOUT_DOMAIN");at(f);}if(!o.storefrontAccessToken){let f=Qr("consent.storefrontAccessToken","PUBLIC_STOREFRONT_API_TOKEN");at(f);}}let h=react.useMemo(()=>({canTrack:d,...m,customData:a,publish:d()?$r:()=>{},shop:s,subscribe:Fr,register:qr}),[p,d(),d,JSON.stringify(d),m,m.cart?.updatedAt,m.prevCart,$r,Fr,a,s,qr,JSON.stringify(we)]);return jsxRuntime.jsxs(Br.Provider,{value:h,children:[r,!!s&&jsxRuntime.jsx(Ir,{}),!!s&&!!t&&jsxRuntime.jsx(Vr,{cart:t,setCarts:l}),!!s&&o.checkoutDomain&&jsxRuntime.jsx(Lr,{consent:o,onReady:()=>{c.current=!0,y(!0),g(()=>Hr);},domain:u})]})}function X(){let e=react.useContext(Br);if(!e)throw new Error("[h2:error:useAnalytics] 'useAnalytics()' must be a descendent of <AnalyticsProvider/>");return e}function Tn(e){let[t,r]=react.useState(null);return react.useEffect(()=>(Promise.resolve(e).then(r),()=>{}),[r,e]),{shop:t}}async function vn({storefront:e,publicStorefrontId:t="0"}){return e.query(In,{cache:e.CacheLong()}).then(({shop:r,localization:o})=>({shopId:r.id,acceptedLanguage:o.language.isoCode,currency:o.country.currency.isoCode,hydrogenSubchannelId:t}))}var In=`#graphql
|
|
628
627
|
query ShopData(
|
|
629
628
|
$country: CountryCode
|
|
630
629
|
$language: LanguageCode
|
|
@@ -643,7 +642,7 @@ API response error: ${t.status}`,c=new K(u,{query:a,queryVariables:s,cause:{erro
|
|
|
643
642
|
}
|
|
644
643
|
}
|
|
645
644
|
}
|
|
646
|
-
`,
|
|
645
|
+
`,Rn={CartView:br,CollectionView:wr,CustomView:xr,ProductView:Rr,Provider:An,SearchView:Er};var xn=function(e){return jsxRuntime.jsx(hydrogenReact.RichText,{...e,components:{link:({node:t})=>jsxRuntime.jsx(react$1.Link,{to:t.url,title:t.title,target:t.target,prefetch:"intent",children:t.children}),...e.components}})};//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartCreate
|
|
647
646
|
//! @see https://shopify.dev/docs/api/storefront/latest/queries/cart
|
|
648
647
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesAdd
|
|
649
648
|
//! @see: https://shopify.dev/docs/api/storefront/latest/mutations/cartLinesUpdate
|
|
@@ -739,52 +738,54 @@ Object.defineProperty(exports, 'useShopifyCookies', {
|
|
|
739
738
|
enumerable: true,
|
|
740
739
|
get: function () { return hydrogenReact.useShopifyCookies; }
|
|
741
740
|
});
|
|
742
|
-
exports.
|
|
743
|
-
exports.
|
|
744
|
-
exports.
|
|
745
|
-
exports.
|
|
746
|
-
exports.
|
|
747
|
-
exports.
|
|
748
|
-
exports.
|
|
749
|
-
exports.
|
|
750
|
-
exports.
|
|
751
|
-
exports.
|
|
752
|
-
exports.
|
|
753
|
-
exports.
|
|
754
|
-
exports.
|
|
755
|
-
exports.
|
|
756
|
-
exports.
|
|
757
|
-
exports.
|
|
758
|
-
exports.
|
|
759
|
-
exports.
|
|
760
|
-
exports.
|
|
761
|
-
exports.
|
|
762
|
-
exports.
|
|
763
|
-
exports.
|
|
764
|
-
exports.
|
|
765
|
-
exports.
|
|
766
|
-
exports.
|
|
767
|
-
exports.
|
|
768
|
-
exports.
|
|
769
|
-
exports.
|
|
770
|
-
exports.
|
|
771
|
-
exports.
|
|
772
|
-
exports.
|
|
773
|
-
exports.
|
|
774
|
-
exports.
|
|
775
|
-
exports.
|
|
741
|
+
exports.Analytics = Rn;
|
|
742
|
+
exports.AnalyticsEvent = Z;
|
|
743
|
+
exports.CacheCustom = ze;
|
|
744
|
+
exports.CacheLong = Ke;
|
|
745
|
+
exports.CacheNone = We;
|
|
746
|
+
exports.CacheShort = oe;
|
|
747
|
+
exports.CartForm = B;
|
|
748
|
+
exports.InMemoryCache = nt;
|
|
749
|
+
exports.OptimisticInput = Ha;
|
|
750
|
+
exports.Pagination = Mo;
|
|
751
|
+
exports.RichText = xn;
|
|
752
|
+
exports.Script = Va;
|
|
753
|
+
exports.Seo = Oo;
|
|
754
|
+
exports.ShopPayButton = Wa;
|
|
755
|
+
exports.VariantSelector = wa;
|
|
756
|
+
exports.cartAttributesUpdateDefault = It;
|
|
757
|
+
exports.cartBuyerIdentityUpdateDefault = At;
|
|
758
|
+
exports.cartCreateDefault = mt;
|
|
759
|
+
exports.cartDiscountCodesUpdateDefault = Pt;
|
|
760
|
+
exports.cartGetDefault = gt;
|
|
761
|
+
exports.cartGetIdDefault = ga;
|
|
762
|
+
exports.cartLinesAddDefault = ht;
|
|
763
|
+
exports.cartLinesRemoveDefault = St;
|
|
764
|
+
exports.cartLinesUpdateDefault = Ct;
|
|
765
|
+
exports.cartMetafieldDeleteDefault = wt;
|
|
766
|
+
exports.cartMetafieldsSetDefault = Rt;
|
|
767
|
+
exports.cartNoteUpdateDefault = Tt;
|
|
768
|
+
exports.cartSelectedDeliveryOptionsUpdateDefault = vt;
|
|
769
|
+
exports.cartSetIdDefault = Ca;
|
|
770
|
+
exports.changelogHandler = Jo;
|
|
771
|
+
exports.createCartHandler = Sa;
|
|
772
|
+
exports.createContentSecurityPolicy = _a;
|
|
773
|
+
exports.createCustomerAccountClient = Ko;
|
|
774
|
+
exports.createStorefrontClient = ci;
|
|
775
|
+
exports.createWithCache = fi;
|
|
776
776
|
exports.formatAPIResult = P;
|
|
777
|
-
exports.generateCacheControlHeader =
|
|
778
|
-
exports.getCustomerPrivacy =
|
|
779
|
-
exports.getPaginationVariables =
|
|
780
|
-
exports.getSelectedProductOptions =
|
|
781
|
-
exports.getSeoMeta =
|
|
782
|
-
exports.getShopAnalytics =
|
|
783
|
-
exports.graphiqlLoader =
|
|
784
|
-
exports.storefrontRedirect =
|
|
785
|
-
exports.
|
|
786
|
-
exports.useCustomerPrivacy =
|
|
787
|
-
exports.useNonce =
|
|
788
|
-
exports.
|
|
777
|
+
exports.generateCacheControlHeader = fe;
|
|
778
|
+
exports.getCustomerPrivacy = xt;
|
|
779
|
+
exports.getPaginationVariables = Fo;
|
|
780
|
+
exports.getSelectedProductOptions = ba;
|
|
781
|
+
exports.getSeoMeta = ko;
|
|
782
|
+
exports.getShopAnalytics = vn;
|
|
783
|
+
exports.graphiqlLoader = So;
|
|
784
|
+
exports.storefrontRedirect = ho;
|
|
785
|
+
exports.useAnalytics = X;
|
|
786
|
+
exports.useCustomerPrivacy = Et;
|
|
787
|
+
exports.useNonce = bt;
|
|
788
|
+
exports.useOptimisticCart = Aa;
|
|
789
|
+
exports.useOptimisticData = qa;
|
|
789
790
|
//# sourceMappingURL=out.js.map
|
|
790
791
|
//# sourceMappingURL=index.cjs.map
|