@shopify/hydrogen-react 0.0.0-next-b381faf → 0.0.0-next-ae06e7c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
  2. package/dist/browser-dev/BaseButton.mjs.map +1 -1
  3. package/dist/browser-dev/BuyNowButton.mjs.map +1 -1
  4. package/dist/browser-dev/CartCheckoutButton.mjs.map +1 -1
  5. package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
  6. package/dist/browser-prod/BaseButton.mjs.map +1 -1
  7. package/dist/browser-prod/BuyNowButton.mjs.map +1 -1
  8. package/dist/browser-prod/CartCheckoutButton.mjs.map +1 -1
  9. package/dist/node-dev/AddToCartButton.js.map +1 -1
  10. package/dist/node-dev/AddToCartButton.mjs.map +1 -1
  11. package/dist/node-dev/BaseButton.js.map +1 -1
  12. package/dist/node-dev/BaseButton.mjs.map +1 -1
  13. package/dist/node-dev/BuyNowButton.js.map +1 -1
  14. package/dist/node-dev/BuyNowButton.mjs.map +1 -1
  15. package/dist/node-dev/CartCheckoutButton.js.map +1 -1
  16. package/dist/node-dev/CartCheckoutButton.mjs.map +1 -1
  17. package/dist/node-prod/AddToCartButton.js.map +1 -1
  18. package/dist/node-prod/AddToCartButton.mjs.map +1 -1
  19. package/dist/node-prod/BaseButton.js.map +1 -1
  20. package/dist/node-prod/BaseButton.mjs.map +1 -1
  21. package/dist/node-prod/BuyNowButton.js.map +1 -1
  22. package/dist/node-prod/BuyNowButton.mjs.map +1 -1
  23. package/dist/node-prod/CartCheckoutButton.js.map +1 -1
  24. package/dist/node-prod/CartCheckoutButton.mjs.map +1 -1
  25. package/dist/types/AddToCartButton.d.ts +4 -1
  26. package/dist/types/BaseButton.d.ts +2 -2
  27. package/dist/types/BuyNowButton.d.ts +3 -1
  28. package/dist/types/CartCheckoutButton.d.ts +3 -1
  29. package/dist/umd/hydrogen-react.dev.js +2 -2
  30. package/dist/umd/hydrogen-react.dev.js.map +1 -1
  31. package/dist/umd/hydrogen-react.prod.js +8 -8
  32. package/dist/umd/hydrogen-react.prod.js.map +1 -1
  33. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- (function(A,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(A=typeof globalThis<"u"?globalThis:A||self,s(A.hydrogenreact={},A.React))})(this,function(A,s){"use strict";function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Oe=At(s);/*! *****************************************************************************
1
+ (function(A,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(A=typeof globalThis<"u"?globalThis:A||self,s(A.hydrogenreact={},A.React))})(this,function(A,s){"use strict";function At(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const Q=At(s);/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -11,7 +11,7 @@
11
11
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
12
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
13
  PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */function Le(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),u=[];try{for(;(t===void 0||t-- >0)&&!(n=a.next()).done;)u.push(n.value)}catch(o){i={error:o}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return u}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Pe={type:"xstate.init"};function Ee(e){return e===void 0?[]:[].concat(e)}function Q(e){return{type:"xstate.assign",assignment:e}}function Ue(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function ce(e){return function(t){return e===t}}function ke(e){return typeof e=="string"?{type:e}:e}function Ne(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ce(e)}}function Ve(e,t,r){var n=t,i=!1;return[e.filter(function(a){if(a.type==="xstate.assign"){i=!0;var u=Object.assign({},n);return typeof a.assignment=="function"?u=a.assignment(n,r):Object.keys(a.assignment).forEach(function(o){u[o]=typeof a.assignment[o]=="function"?a.assignment[o](n,r):a.assignment[o]}),n=u,!1}return!0}),n,i]}function Me(e,t){t===void 0&&(t={});var r=Le(Ve(Ee(e.states[e.initial].entry).map(function(u){return Ue(u,t.actions)}),e.context,Pe),2),n=r[0],i=r[1],a={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:ce(e.initial)},transition:function(u,o){var h,y,l=typeof u=="string"?{value:u,context:e.context}:u,d=l.value,p=l.context,E=ke(o),g=e.states[d];if(g.on){var b=Ee(g.on[E.type]);try{for(var _=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,P=K&&O[K],me=0;if(P)return P.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&me>=O.length&&(O=void 0),{value:O&&O[me++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),L=_.next();!L.done;L=_.next()){var w=L.value;if(w===void 0)return Ne(d,p);var C=typeof w=="string"?{target:w}:w,c=C.target,f=C.actions,m=f===void 0?[]:f,T=C.cond,I=T===void 0?function(){return!0}:T,S=c===void 0,D=c??d,U=e.states[D];if(I(p,E)){var V=Le(Ve((S?Ee(m):[].concat(g.exit,m,U.entry).filter(function(O){return O})).map(function(O){return Ue(O,a._options.actions)}),p,E),3),$=V[0],j=V[1],ee=V[2],F=c??d;return{value:F,context:j,actions:$,changed:c!==d||$.length>0||ee,matches:ce(F)}}}}catch(O){h={error:O}}finally{try{L&&!L.done&&(y=_.return)&&y.call(_)}finally{if(h)throw h.error}}}return Ne(d,p)}};return a}var Re=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function bt(e){var t=e.initialState,r=Y.NotStarted,n=new Set,i={_machine:e,send:function(a){r===Y.Running&&(t=e.transition(t,a),Re(t,ke(a)),n.forEach(function(u){return u(t)}))},subscribe:function(a){return n.add(a),a(t),{unsubscribe:function(){return n.delete(a)}}},start:function(a){if(a){var u=typeof a=="object"?a:{context:e.config.context,value:a};t={value:u.value,actions:[],context:u.context,matches:ce(u.value)}}else t=e.initialState;return r=Y.Running,Re(t,Pe),i},stop:function(){return r=Y.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}var wt=s.useLayoutEffect,pe={},It={get exports(){return pe},set exports(e){pe=e}},_e={},le={},Dt={get exports(){return le},set exports(e){le=e}},Se={};/**
14
+ ***************************************************************************** */function Le(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),u=[];try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)u.push(n.value)}catch(a){i={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return u}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Pe={type:"xstate.init"};function pe(e){return e===void 0?[]:[].concat(e)}function J(e){return{type:"xstate.assign",assignment:e}}function Ue(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function le(e){return function(t){return e===t}}function ke(e){return typeof e=="string"?{type:e}:e}function Ne(e,t){return{value:e,context:t,actions:[],changed:!1,matches:le(e)}}function Ve(e,t,r){var n=t,i=!1;return[e.filter(function(o){if(o.type==="xstate.assign"){i=!0;var u=Object.assign({},n);return typeof o.assignment=="function"?u=o.assignment(n,r):Object.keys(o.assignment).forEach(function(a){u[a]=typeof o.assignment[a]=="function"?o.assignment[a](n,r):o.assignment[a]}),n=u,!1}return!0}),n,i]}function Re(e,t){t===void 0&&(t={});var r=Le(Ve(pe(e.states[e.initial].entry).map(function(u){return Ue(u,t.actions)}),e.context,Pe),2),n=r[0],i=r[1],o={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:le(e.initial)},transition:function(u,a){var h,y,l=typeof u=="string"?{value:u,context:e.context}:u,d=l.value,p=l.context,E=ke(a),g=e.states[d];if(g.on){var b=pe(g.on[E.type]);try{for(var _=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,P=K&&O[K],Ee=0;if(P)return P.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&Ee>=O.length&&(O=void 0),{value:O&&O[Ee++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),L=_.next();!L.done;L=_.next()){var w=L.value;if(w===void 0)return Ne(d,p);var C=typeof w=="string"?{target:w}:w,c=C.target,f=C.actions,m=f===void 0?[]:f,T=C.cond,I=T===void 0?function(){return!0}:T,S=c===void 0,D=c??d,U=e.states[D];if(I(p,E)){var V=Le(Ve((S?pe(m):[].concat(g.exit,m,U.entry).filter(function(O){return O})).map(function(O){return Ue(O,o._options.actions)}),p,E),3),$=V[0],j=V[1],te=V[2],F=c??d;return{value:F,context:j,actions:$,changed:c!==d||$.length>0||te,matches:le(F)}}}}catch(O){h={error:O}}finally{try{L&&!L.done&&(y=_.return)&&y.call(_)}finally{if(h)throw h.error}}}return Ne(d,p)}};return o}var Me=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function bt(e){var t=e.initialState,r=Y.NotStarted,n=new Set,i={_machine:e,send:function(o){r===Y.Running&&(t=e.transition(t,o),Me(t,ke(o)),n.forEach(function(u){return u(t)}))},subscribe:function(o){return n.add(o),o(t),{unsubscribe:function(){return n.delete(o)}}},start:function(o){if(o){var u=typeof o=="object"?o:{context:e.config.context,value:o};t={value:u.value,actions:[],context:u.context,matches:le(u.value)}}else t=e.initialState;return r=Y.Running,Me(t,Pe),i},stop:function(){return r=Y.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}var wt=s.useLayoutEffect,_e={},It={get exports(){return _e},set exports(e){_e=e}},Se={},de={},Dt={get exports(){return de},set exports(e){de=e}},ve={};/**
15
15
  * @license React
16
16
  * use-sync-external-store-shim.production.min.js
17
17
  *
@@ -19,7 +19,7 @@
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var $e;function Ot(){if($e)return Se;$e=1;var e=s;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,a=e.useLayoutEffect,u=e.useDebugValue;function o(d,p){var E=p(),g=n({inst:{value:E,getSnapshot:p}}),b=g[0].inst,_=g[1];return a(function(){b.value=E,b.getSnapshot=p,h(b)&&_({inst:b})},[d,E,p]),i(function(){return h(b)&&_({inst:b}),d(function(){h(b)&&_({inst:b})})},[d]),u(E),E}function h(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!r(d,E)}catch{return!0}}function y(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:o;return Se.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Se}var ve={};/**
22
+ */var $e;function Ot(){if($e)return ve;$e=1;var e=s;function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,i=e.useEffect,o=e.useLayoutEffect,u=e.useDebugValue;function a(d,p){var E=p(),g=n({inst:{value:E,getSnapshot:p}}),b=g[0].inst,_=g[1];return o(function(){b.value=E,b.getSnapshot=p,h(b)&&_({inst:b})},[d,E,p]),i(function(){return h(b)&&_({inst:b}),d(function(){h(b)&&_({inst:b})})},[d]),u(E),E}function h(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!r(d,E)}catch{return!0}}function y(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:a;return ve.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,ve}var Ce={};/**
23
23
  * @license React
24
24
  * use-sync-external-store-shim.development.js
25
25
  *
@@ -27,7 +27,7 @@
27
27
  *
28
28
  * This source code is licensed under the MIT license found in the
29
29
  * LICENSE file in the root directory of this source tree.
30
- */var xe;function Lt(){return xe||(xe=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(C){{for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];n("error",C,f)}}function n(C,c,f){{var m=t.ReactDebugCurrentFrame,T=m.getStackAddendum();T!==""&&(c+="%s",f=f.concat([T]));var I=f.map(function(S){return String(S)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[C],console,I)}}function i(C,c){return C===c&&(C!==0||1/C===1/c)||C!==C&&c!==c}var a=typeof Object.is=="function"?Object.is:i,u=e.useState,o=e.useEffect,h=e.useLayoutEffect,y=e.useDebugValue,l=!1,d=!1;function p(C,c,f){l||e.startTransition!==void 0&&(l=!0,r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=c();if(!d){var T=c();a(m,T)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=u({inst:{value:m,getSnapshot:c}}),S=I[0].inst,D=I[1];return h(function(){S.value=m,S.getSnapshot=c,E(S)&&D({inst:S})},[C,m,c]),o(function(){E(S)&&D({inst:S});var U=function(){E(S)&&D({inst:S})};return C(U)},[C]),y(m),m}function E(C){var c=C.getSnapshot,f=C.value;try{var m=c();return!a(f,m)}catch{return!0}}function g(C,c,f){return c()}var b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!b,L=_?g:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:L;ve.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),ve}var qe;function Fe(){return qe||(qe=1,function(e){process.env.NODE_ENV==="production"?e.exports=Ot():e.exports=Lt()}(Dt)),le}/**
30
+ */var xe;function Lt(){return xe||(xe=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function r(C){{for(var c=arguments.length,f=new Array(c>1?c-1:0),m=1;m<c;m++)f[m-1]=arguments[m];n("error",C,f)}}function n(C,c,f){{var m=t.ReactDebugCurrentFrame,T=m.getStackAddendum();T!==""&&(c+="%s",f=f.concat([T]));var I=f.map(function(S){return String(S)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[C],console,I)}}function i(C,c){return C===c&&(C!==0||1/C===1/c)||C!==C&&c!==c}var o=typeof Object.is=="function"?Object.is:i,u=e.useState,a=e.useEffect,h=e.useLayoutEffect,y=e.useDebugValue,l=!1,d=!1;function p(C,c,f){l||e.startTransition!==void 0&&(l=!0,r("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var m=c();if(!d){var T=c();o(m,T)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=u({inst:{value:m,getSnapshot:c}}),S=I[0].inst,D=I[1];return h(function(){S.value=m,S.getSnapshot=c,E(S)&&D({inst:S})},[C,m,c]),a(function(){E(S)&&D({inst:S});var U=function(){E(S)&&D({inst:S})};return C(U)},[C]),y(m),m}function E(C){var c=C.getSnapshot,f=C.value;try{var m=c();return!o(f,m)}catch{return!0}}function g(C,c,f){return c()}var b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!b,L=_?g:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:L;Ce.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ce}var qe;function Fe(){return qe||(qe=1,function(e){process.env.NODE_ENV==="production"?e.exports=Ot():e.exports=Lt()}(Dt)),de}/**
31
31
  * @license React
32
32
  * use-sync-external-store-shim/with-selector.production.min.js
33
33
  *
@@ -35,7 +35,7 @@
35
35
  *
36
36
  * This source code is licensed under the MIT license found in the
37
37
  * LICENSE file in the root directory of this source tree.
38
- */var Be;function Pt(){if(Be)return _e;Be=1;var e=s,t=Fe();function r(y,l){return y===l&&(y!==0||1/y===1/l)||y!==y&&l!==l}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,o=e.useMemo,h=e.useDebugValue;return _e.useSyncExternalStoreWithSelector=function(y,l,d,p,E){var g=a(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=o(function(){function L(m){if(!w){if(w=!0,C=m,m=p(m),E!==void 0&&b.hasValue){var T=b.value;if(E(T,m))return c=T}return c=m}if(T=c,n(C,m))return T;var I=p(m);return E!==void 0&&E(T,I)?T:(C=m,c=I)}var w=!1,C,c,f=d===void 0?null:d;return[function(){return L(l())},f===null?void 0:function(){return L(f())}]},[l,d,p,E]);var _=i(y,g[0],g[1]);return u(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},_e}var Ce={};/**
38
+ */var Be;function Pt(){if(Be)return Se;Be=1;var e=s,t=Fe();function r(y,l){return y===l&&(y!==0||1/y===1/l)||y!==y&&l!==l}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,o=e.useRef,u=e.useEffect,a=e.useMemo,h=e.useDebugValue;return Se.useSyncExternalStoreWithSelector=function(y,l,d,p,E){var g=o(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=a(function(){function L(m){if(!w){if(w=!0,C=m,m=p(m),E!==void 0&&b.hasValue){var T=b.value;if(E(T,m))return c=T}return c=m}if(T=c,n(C,m))return T;var I=p(m);return E!==void 0&&E(T,I)?T:(C=m,c=I)}var w=!1,C,c,f=d===void 0?null:d;return[function(){return L(l())},f===null?void 0:function(){return L(f())}]},[l,d,p,E]);var _=i(y,g[0],g[1]);return u(function(){b.hasValue=!0,b.value=_},[_]),h(_),_},Se}var Te={};/**
39
39
  * @license React
40
40
  * use-sync-external-store-shim/with-selector.development.js
41
41
  *
@@ -43,7 +43,7 @@
43
43
  *
44
44
  * This source code is licensed under the MIT license found in the
45
45
  * LICENSE file in the root directory of this source tree.
46
- */var He;function Ut(){return He||(He=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=Fe();function r(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,a=e.useRef,u=e.useEffect,o=e.useMemo,h=e.useDebugValue;function y(l,d,p,E,g){var b=a(null),_;b.current===null?(_={hasValue:!1,value:null},b.current=_):_=b.current;var L=o(function(){var f=!1,m,T,I=function(V){if(!f){f=!0,m=V;var $=E(V);if(g!==void 0&&_.hasValue){var j=_.value;if(g(j,$))return T=j,j}return T=$,$}var ee=m,F=T;if(n(ee,V))return F;var O=E(V);return g!==void 0&&g(F,O)?F:(m=V,T=O,O)},S=p===void 0?null:p,D=function(){return I(d())},U=S===null?void 0:function(){return I(S())};return[D,U]},[d,p,E,g]),w=L[0],C=L[1],c=i(l,w,C);return u(function(){_.hasValue=!0,_.value=c},[c]),h(c),c}Ce.useSyncExternalStoreWithSelector=y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ce}(function(e){process.env.NODE_ENV==="production"?e.exports=Pt():e.exports=Ut()})(It);function kt(e){var t=Oe.useRef();return t.current||(t.current={v:e()}),t.current.v}var Ge=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,a=[],u;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(o){u={error:o}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return a};function Nt(e){return e}var Vt=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Mt(e,t){var r=s.useRef();if(process.env.NODE_ENV!=="production"){var n=Ge(s.useState(e),1),i=n[0];e!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var a=Ge(kt(function(){var y=[],l=bt(Me(e.config,t||e._options)),d=l.send;return l.send=function(p){if(l.status===Y.NotStarted){y.push(p);return}d(p),r.current=l.state},[l,y]}),2),u=a[0],o=a[1];wt(function(){t&&(u._machine._options=t)});var h=$t(u);return s.useEffect(function(){return u.start(r.current),o.forEach(u.send),r.current=u.state,function(){u.stop()}},[]),h}var Rt=function(e,t){return t.changed===!1};function $t(e){var t=s.useCallback(function(){return Vt(e)},[e]),r=s.useCallback(function(i){var a=e.subscribe(i).unsubscribe;return a},[e]),n=pe.useSyncExternalStoreWithSelector(r,t,t,Nt,Rt);return[n,e.send,e]}function H(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const xt=e=>`
46
+ */var He;function Ut(){return He||(He=1,process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=s,t=Fe();function r(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var n=typeof Object.is=="function"?Object.is:r,i=t.useSyncExternalStore,o=e.useRef,u=e.useEffect,a=e.useMemo,h=e.useDebugValue;function y(l,d,p,E,g){var b=o(null),_;b.current===null?(_={hasValue:!1,value:null},b.current=_):_=b.current;var L=a(function(){var f=!1,m,T,I=function(V){if(!f){f=!0,m=V;var $=E(V);if(g!==void 0&&_.hasValue){var j=_.value;if(g(j,$))return T=j,j}return T=$,$}var te=m,F=T;if(n(te,V))return F;var O=E(V);return g!==void 0&&g(F,O)?F:(m=V,T=O,O)},S=p===void 0?null:p,D=function(){return I(d())},U=S===null?void 0:function(){return I(S())};return[D,U]},[d,p,E,g]),w=L[0],C=L[1],c=i(l,w,C);return u(function(){_.hasValue=!0,_.value=c},[c]),h(c),c}Te.useSyncExternalStoreWithSelector=y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Te}(function(e){process.env.NODE_ENV==="production"?e.exports=Pt():e.exports=Ut()})(It);function kt(e){var t=Q.useRef();return t.current||(t.current={v:e()}),t.current.v}var Ge=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],u;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(a){u={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(u)throw u.error}}return o};function Nt(e){return e}var Vt=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Rt(e,t){var r=s.useRef();if(process.env.NODE_ENV!=="production"){var n=Ge(s.useState(e),1),i=n[0];e!==i&&console.warn("Machine given to `useMachine` has changed between renders. This is not supported and might lead to unexpected results.\nPlease make sure that you pass the same Machine as argument each time.")}var o=Ge(kt(function(){var y=[],l=bt(Re(e.config,t||e._options)),d=l.send;return l.send=function(p){if(l.status===Y.NotStarted){y.push(p);return}d(p),r.current=l.state},[l,y]}),2),u=o[0],a=o[1];wt(function(){t&&(u._machine._options=t)});var h=$t(u);return s.useEffect(function(){return u.start(r.current),a.forEach(u.send),r.current=u.state,function(){u.stop()}},[]),h}var Mt=function(e,t){return t.changed===!1};function $t(e){var t=s.useCallback(function(){return Vt(e)},[e]),r=s.useCallback(function(i){var o=e.subscribe(i).unsubscribe;return o},[e]),n=_e.useSyncExternalStoreWithSelector(r,t,t,Nt,Mt);return[n,e.send,e]}function H(e){if(!e){const t=`flattenConnection(): needs a 'connection' to flatten, but received '${e}' instead.`;return console.error(t+" Returning an empty array"),[]}return"nodes"in e?e.nodes:"edges"in e&&Array.isArray(e.edges)?e.edges.map(t=>{if(!(t!=null&&t.node))throw new Error("flattenConnection(): Connection edges must contain nodes");return t.node}):[]}const xt=e=>`
47
47
  mutation CartLineAdd(
48
48
  $cartId: ID!
49
49
  $lines: [CartLineInput!]!
@@ -274,7 +274,7 @@
274
274
  width
275
275
  height
276
276
  }
277
- `,te="2023-01";function zt({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n,contentType:i}){return n!==te&&Kt(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${n}"; expected version "${te}"`),{getShopifyDomain(a){return(a==null?void 0:a.storeDomain)??e},getStorefrontApiUrl(a){const u=(a==null?void 0:a.storeDomain)??e;return`${u}${u.endsWith("/")?"":"/"}api/${(a==null?void 0:a.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(a){if(!t&&!(a!=null&&a.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((a==null?void 0:a.contentType)??i)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(a==null?void 0:a.privateStorefrontToken)??t??"",...a!=null&&a.buyerIp?{"Shopify-Storefront-Buyer-IP":a.buyerIp}:{}}},getPublicTokenHeaders(a){if(!r&&!(a!=null&&a.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const u=(a==null?void 0:a.contentType)??i??"json";return je(u,n,(a==null?void 0:a.publicStorefrontToken)??r??"")}}}function je(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const Ye=new Set,Kt=e=>{Ye.has(e)||(console.warn(e),Ye.add(e))},We=s.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:te,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function Qt({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==te&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${te}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=s.useMemo(()=>{function n(i){return(i==null?void 0:i.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(i){return je(i.contentType,t.storefrontApiVersion,i.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(i){const a=n({storeDomain:(i==null?void 0:i.storeDomain)??t.storeDomain});return`${a}${a.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(We.Provider,{value:r},e)}function de(){const e=s.useContext(We);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Te="shopifyCartId",Jt="Shopify-Storefront-Id",Xt="Shopify-Storefront-Y",er="Shopify-Storefront-S",W="_shopify_y",Z="_shopify_s";var tr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function rr(e){let t={},r,n,i=0,a=e.split(/;\s*/g),u,o;for(;i<a.length;i++)if(n=a[i],r=n.indexOf("="),~r){if(u=n.substring(0,r++).trim(),o=n.substring(r).trim(),o[0]==='"'&&(o=o.substring(1,o.length-1)),~o.indexOf("%"))try{o=decodeURIComponent(o)}catch{}tr.has(n=u.toLowerCase())?n==="expires"?t.expires=new Date(o):n==="max-age"?t.maxage=+o:t[n]=o:t[u]=o}else(u=n.trim().toLowerCase())&&(u==="httponly"||u==="secure")&&(t[u]=!0);return t}function nr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Ze="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function fe(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Ze.replace(/[x]/g,i=>{const a=r[n]%16,u=i==="x"?a:a&3|8;return n++,u.toString(16)}).toUpperCase()}catch{e=Ze.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${or()}-${e}`}function or(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function ye(e){const t=rr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function ar(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=de();return s.useCallback(({query:n,variables:i})=>{const a=t({contentType:"json"});e&&(a[Jt]=e);const u=ye(document.cookie);return a[Xt]=u[W],a[er]=u[Z],fetch(r(),{method:"POST",headers:a,body:JSON.stringify({query:n.toString(),variables:i})}).then(o=>o.json()).catch(o=>({data:void 0,errors:o.toString()}))},[t,e,r])}function ir({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=ar(),i=s.useCallback(E=>n({query:Wt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),a=s.useCallback(E=>n({query:qt(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),u=s.useCallback((E,g)=>n({query:xt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),o=s.useCallback((E,g)=>n({query:Bt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),h=s.useCallback((E,g)=>n({query:Ft(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),y=s.useCallback((E,g)=>n({query:Ht(t),variables:{cartId:E,note:g,numCartLines:e,country:r}}),[n,t,e,r]),l=s.useCallback((E,g)=>n({query:Gt(t),variables:{cartId:E,buyerIdentity:g,numCartLines:e,country:r}}),[t,r,n,e]),d=s.useCallback((E,g)=>n({query:jt(t),variables:{cartId:E,attributes:g,numCartLines:e,country:r}}),[t,r,n,e]),p=s.useCallback((E,g)=>n({query:Yt(t),variables:{cartId:E,discountCodes:g,numCartLines:e,country:r}}),[t,r,n,e]);return s.useMemo(()=>({cartFetch:i,cartCreate:a,cartLineAdd:u,cartLineUpdate:o,cartLineRemove:h,noteUpdate:y,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[i,a,u,o,h,y,l,d,p,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],Q({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[Q({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.cart},rawCartResult:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[Q({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:Q({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const re={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[Q({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>Ae(t.payload.cart)})]}},ze={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function ur(e){return Me({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&Ae(e)},states:{uninitialized:{on:re},cartCompleted:{on:re},initializationError:{on:re},idle:{on:{...re,...ze}},error:{on:{...re,...ze}},cartFetching:x("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:x("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:x("cartLineRemoveAction"),cartLineUpdating:x("cartLineUpdateAction"),cartLineAdding:x("cartLineAddAction"),noteUpdating:x("noteUpdateAction"),buyerIdentityUpdating:x("buyerIdentityUpdateAction"),cartAttributesUpdating:x("cartAttributesUpdateAction"),discountCodesUpdating:x("discountCodesUpdateAction")}})}function sr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:i,cartFragment:a,countryCode:u}){const{cartFetch:o,cartCreate:h,cartLineAdd:y,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ir({numCartLines:e,cartFragment:a,countryCode:u}),_=s.useMemo(()=>ur(i),[i]),[L,w,C]=Mt(_,{actions:{cartFetchAction:async(c,f)=>{var S;if(f.type!=="CART_FETCH")return;const{data:m,errors:T}=await o((S=f==null?void 0:f.payload)==null?void 0:S.cartId),I=q(f,m==null?void 0:m.cart,T);w(I)},cartCreateAction:async(c,f)=>{var S;if(f.type!=="CART_CREATE")return;const{data:m,errors:T}=await h(f==null?void 0:f.payload),I=q(f,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,T);w(I)},cartLineAddAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_ADD"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await y(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,T);w(I)},cartLineUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await l(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,T);w(I)},cartLineRemoveAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_REMOVE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await d(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,T);w(I)},noteUpdateAction:async(c,f)=>{var S,D;if(f.type!=="NOTE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await p(c.cart.id,f.payload.note),I=q(f,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,T);w(I)},buyerIdentityUpdateAction:async(c,f)=>{var S,D;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await E(c.cart.id,f.payload.buyerIdentity),I=q(f,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,T);w(I)},cartAttributesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await g(c.cart.id,f.payload.attributes),I=q(f,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,T);w(I)},discountCodesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await b(c.cart.id,f.payload.discountCodes),I=q(f,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,T);w(I)},...t&&{onCartActionEntry:(c,f)=>{cr(f)&&t(c,f)}},...r&&{onCartActionOptimisticUI:Q((c,f)=>r(c,f))},...n&&{onCartActionComplete:(c,f)=>{lr(f)&&n(c,f)}}}});return s.useMemo(()=>[L,w,C],[L,w,C])}function Ae(e){return{...e,lines:H(e==null?void 0:e.lines),note:e.note??void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:Ae(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function cr(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function lr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Ke=s.createContext(null);function ne(){const e=s.useContext(Ke);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function dr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:i,onLineUpdate:a,onNoteUpdate:u,onBuyerIdentityUpdate:o,onAttributesUpdate:h,onDiscountCodesUpdate:y,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:L,data:w,cartFragment:C=Zt,customerAccessToken:c,countryCode:f="US"}){var Et,pt,_t,St,vt,Ct,Tt;f&&(f=f.toUpperCase());const[m,T]=s.useState(f),[I,S]=s.useState(c),D=s.useRef(!1);(m!==f||I!==c)&&(T(f),S(c),D.current=!1);const[U,V]=sr({numCartLines:t,data:w,cartFragment:C,countryCode:f,onCartActionEntry(v,k){try{switch(k.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return i==null?void 0:i();case"CARTLINE_UPDATE":return a==null?void 0:a();case"NOTE_UPDATE":return u==null?void 0:u();case"BUYER_IDENTITY_UPDATE":return o==null?void 0:o();case"CART_ATTRIBUTES_UPDATE":return h==null?void 0:h();case"DISCOUNT_CODES_UPDATE":return y==null?void 0:y()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(v,k){var M,B,N,se;if(!v.cart)return{...v};switch(k.type){case"CARTLINE_REMOVE":return{...v,cart:{...v.cart,lines:(B=(M=v==null?void 0:v.cart)==null?void 0:M.lines)==null?void 0:B.filter(R=>(R==null?void 0:R.id)&&!k.payload.lines.includes(R==null?void 0:R.id))}};case"CARTLINE_UPDATE":return{...v,cart:{...v.cart,lines:(se=(N=v==null?void 0:v.cart)==null?void 0:N.lines)==null?void 0:se.map(R=>{const De=k.payload.lines.find(({id:ln})=>ln===(R==null?void 0:R.id));return De&&De.quantity?{...R,quantity:De.quantity}:R})}}}return{...v}},onCartActionComplete(v,k){const M=k.payload.cartActionEvent;try{switch(k.type){case"RESOLVE":switch(M.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return d==null?void 0:d();case"CARTLINE_REMOVE":return p==null?void 0:p();case"CARTLINE_UPDATE":return E==null?void 0:E();case"NOTE_UPDATE":return g==null?void 0:g();case"BUYER_IDENTITY_UPDATE":return hr(v,M)&&(D.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return _==null?void 0:_();case"DISCOUNT_CODES_UPDATE":return L==null?void 0:L()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),$=s.useRef(!1),j=U.matches("cartCompleted"),ee=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((_t=(pt=(Et=U==null?void 0:U.context)==null?void 0:Et.cart)==null?void 0:pt.buyerIdentity)==null?void 0:_t.countryCode)&&!U.context.errors,F=s.useRef(!1);s.useEffect(()=>{if(!$.current&&!F.current){if(!w&&be("localStorage")){F.current=!0;try{const v=window.localStorage.getItem(Te);v&&V({type:"CART_FETCH",payload:{cartId:v}})}catch(v){console.warn("error fetching cartId"),console.warn(v)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!ee||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:c}}})},[f,c,ee,D,V]);const O=s.useCallback(v=>{if(!$.current)return console.warn("Cart isn't ready yet");V(v)},[V]);s.useEffect(()=>{var v,k,M;if((k=(v=U==null?void 0:U.context)==null?void 0:v.cart)!=null&&k.id&&be("localStorage"))try{window.localStorage.setItem(Te,(M=U.context.cart)==null?void 0:M.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(vt=(St=U==null?void 0:U.context)==null?void 0:St.cart)==null?void 0:vt.id]),s.useEffect(()=>{if(j&&be("localStorage"))try{window.localStorage.removeItem(Te)}catch(v){console.warn("Failed to delete cartId from localStorage",v)}},[j]);const K=s.useCallback(v=>{var k,M;f&&!((k=v.buyerIdentity)!=null&&k.countryCode)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.countryCode=f),c&&!((M=v.buyerIdentity)!=null&&M.customerAccessToken)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:v})},[f,c,O]),P=yr(U),me=s.useMemo(()=>{var v,k,M,B;return{...((v=P==null?void 0:P.context)==null?void 0:v.cart)??{lines:[],attributes:[]},status:fr(P.value),error:(k=P==null?void 0:P.context)==null?void 0:k.errors,totalQuantity:((B=(M=P==null?void 0:P.context)==null?void 0:M.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var se,R;(R=(se=P==null?void 0:P.context)==null?void 0:se.cart)!=null&&R.id?O({type:"CARTLINE_ADD",payload:{lines:N}}):K({lines:N})},linesRemove(N){O({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){O({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){O({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){O({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){O({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:C}},[K,(Ct=P==null?void 0:P.context)==null?void 0:Ct.cart,(Tt=P==null?void 0:P.context)==null?void 0:Tt.errors,P.value,C,O]);return s.createElement(Ke.Provider,{value:me},e)}function fr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function yr(e){const[t,r]=s.useTransition(),[n,i]=s.useState(e),a=s.useRef(!1);t&&(a.current=!0);const u=s.useRef(!1);return!t&&a.current&&(u.current=!0),s.useEffect(()=>{r(()=>{u.current||i(e)})},[e]),u.current?e:n}function be(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function hr(e,t){var r,n;return t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode}const Qe=s.createContext(null);function gr({children:e,data:t,initialVariantId:r}){const n=s.useMemo(()=>H(t.variants??{}),[t.variants]);if(!Er(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const i=s.useMemo(()=>mr(n),[n]),[a,u]=s.useState(()=>et(r,n)),[o,h]=s.useState(()=>tt(a));s.useEffect(()=>{const _=et(r,n);u(_),h(tt(_))},[r,n]);const y=s.useCallback((_,L)=>{h(w=>{const C={...w,[_]:L};return u(Xe(n,C)),C})},[h,n]),l=s.useCallback((_,L)=>{const w=Xe(n,{...o,[_]:L});return(w==null?void 0:w.availableForSale)??!0},[o,n]),d=s.useMemo(()=>H(t.sellingPlanGroups??{}).map(_=>({..._,sellingPlans:H((_==null?void 0:_.sellingPlans)??{})})),[t.sellingPlanGroups]),[p,E]=s.useState(void 0),g=s.useMemo(()=>{var _,L;if(!(!a||!p)){if(!((_=a.sellingPlanAllocations)!=null&&_.nodes)&&!((L=a.sellingPlanAllocations)!=null&&L.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return H(a.sellingPlanAllocations).find(w=>{var C;return((C=w==null?void 0:w.sellingPlan)==null?void 0:C.id)===p.id})}},[a,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:i,selectedVariant:a,setSelectedVariant:u,selectedOptions:o,setSelectedOption:y,setSelectedOptions:h,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,i,t.sellingPlanGroups,t.variants,o,p,g,a,d,y,n]);return s.createElement(Qe.Provider,{value:b},e)}function Je(){const e=s.useContext(Qe);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Xe(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(i=>Object.entries(t).every(([a,u])=>{var o;return(o=i==null?void 0:i.selectedOptions)==null?void 0:o.some(h=>(h==null?void 0:h.name)===a&&(h==null?void 0:h.value)===u)}))}function mr(e){const t=e.reduce((r,n)=>{var i;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(i=n==null?void 0:n.selectedOptions)==null||i.forEach(a=>{r[(a==null?void 0:a.name)??""]=r[(a==null?void 0:a.name)??""]||new Set,r[(a==null?void 0:a.name)??""].add((a==null?void 0:a.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function et(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function tt(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function Er(e){return!(!e||!Array.isArray(e))}function we(e){const{as:t,onClick:r,defaultOnClick:n,children:i,buttonRef:a,...u}=e,o=s.useCallback(y=>{if(r){const l=r(y);if(typeof l=="boolean"&&l===!1||y!=null&&y.defaultPrevented)return}n==null||n(y)},[n,r]),h=t||"button";return s.createElement(h,{ref:a,onClick:o,...u},i)}function pr(e){const[t,r]=s.useState(!1),{variantId:n,quantity:i=1,attributes:a,sellingPlanId:u,onClick:o,children:h,accessibleAddingToCartLabel:y,...l}=e,{status:d,linesAdd:p}=ne(),{selectedVariant:E}=Je(),g=n??(E==null?void 0:E.id)??"",b=n===null||g===""||E===null||t||l.disabled;s.useEffect(()=>{t&&d==="idle"&&r(!1)},[d,t]);const _=s.useCallback(()=>{r(!0),p([{quantity:i,merchandiseId:g||"",attributes:a,sellingPlanId:u}])},[p,i,g,a,u]);return s.createElement(s.Fragment,null,s.createElement(we,{...l,disabled:b,onClick:o,defaultOnClick:_},h),y?s.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?y:null):null)}const Ie={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},he={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},rt={hydrogen:"hydrogen",headless:"headless"},nt={hydrogen:"6167201",headless:"12875497473"};function J(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function G(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([a-z0-9]+)/);if(!r||r.length===1)return t;const n=r[2]??null,i=r[1]??null;return{id:n,resource:i}}function z(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function _r(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Sr="trekkie_storefront_page_view/1.4",vr="myshopify.dev";function Cr(e){const t=e,{id:r,resource:n}=G(t.resourceId),i=n?n.toLowerCase():void 0;return[J(Sr,z({pageType:t.pageType,customerId:t.customerId,resourceType:i,resourceId:parseInt(r)},Tr(t)))]}function Tr(e){return{appClientId:e.shopifySalesChannel?nt[e.shopifySalesChannel]:nt.headless,isMerchantRequest:Ar(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:fe(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(G(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function Ar(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(vr)!==-1||t==="localhost"}const oe="custom_storefront_customer_tracking/1.0",br="page_rendered",wr="collection_page_rendered",Ir="product_page_rendered",Dr="product_added_to_cart",Or="search_submitted";function Lr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,i=[];switch(i.push(J(oe,z({event_name:br,...r},ae(t)))),n){case he.collection:i.push(J(oe,z({event_name:wr,...r,collection_name:t.collectionHandle},ae(t))));break;case he.product:i.push(J(oe,z({event_name:Ir,...r,products:ot(t.products),total_value:t.totalValue},ae(t))));break;case he.search:i.push(J(oe,z({event_name:Or,...r,search_string:t.searchString},ae(t))));break}return i}function Pr(e){const t=e,r=G(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[J(oe,z({event_name:Dr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:ot(t.products)},ae(t)))]}function ae(e){return{source:e.shopifySalesChannel||rt.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:fe(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(G(e.shopId).id),currency:e.currency}}function ot(e){return e?e.map(t=>{const r=z({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(G(t.productGid).id),variant_id:parseInt(G(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Ur(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let i=[];if(r===Ie.PAGE_VIEW){const a=n;i=i.concat(Cr(a),Lr(a))}else r===Ie.ADD_TO_CART&&(i=i.concat(Pr(n)));return i.length?kr(i,t):Promise.resolve()}const at="sendShopifyAnalytics request is unsuccessful";function kr(e,t){const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(a=>{a.status!==200&&console.error(at,`
277
+ `,re="2023-01";function zt({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n,contentType:i}){return n!==re&&Kt(`StorefrontClient: The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting. You may run into unexpected errors if these versions don't match. Received verion: "${n}"; expected version "${re}"`),{getShopifyDomain(o){return(o==null?void 0:o.storeDomain)??e},getStorefrontApiUrl(o){const u=(o==null?void 0:o.storeDomain)??e;return`${u}${u.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(o){if(!t&&!(o!=null&&o.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((o==null?void 0:o.contentType)??i)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(o==null?void 0:o.privateStorefrontToken)??t??"",...o!=null&&o.buyerIp?{"Shopify-Storefront-Buyer-IP":o.buyerIp}:{}}},getPublicTokenHeaders(o){if(!r&&!(o!=null&&o.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const u=(o==null?void 0:o.contentType)??i??"json";return je(u,n,(o==null?void 0:o.publicStorefrontToken)??r??"")}}}function je(e,t,r){return{"content-type":e==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":t,"X-Shopify-Storefront-Access-Token":r}}const Ye=new Set,Kt=e=>{Ye.has(e)||(console.warn(e),Ye.add(e))},We=s.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:re,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function Qt({children:e,...t}){if(!t.countryIsoCode||!t.languageIsoCode||!t.storeDomain||!t.storefrontToken||!t.storefrontApiVersion)throw new Error("Please provide the necessary props to '<ShopifyProvider/>'");t.storefrontApiVersion!==re&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${re}, but it looks like you're using version ${t.storefrontApiVersion}. There may be issues or bugs if you use a mismatched version of Hydrogen React and the Storefront API.`);const r=s.useMemo(()=>{function n(i){return(i==null?void 0:i.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(i){return je(i.contentType,t.storefrontApiVersion,i.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(i){const o=n({storeDomain:(i==null?void 0:i.storeDomain)??t.storeDomain});return`${o}${o.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(We.Provider,{value:r},e)}function fe(){const e=s.useContext(We);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ae="shopifyCartId",Jt="Shopify-Storefront-Id",Xt="Shopify-Storefront-Y",er="Shopify-Storefront-S",W="_shopify_y",Z="_shopify_s";var tr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function rr(e){let t={},r,n,i=0,o=e.split(/;\s*/g),u,a;for(;i<o.length;i++)if(n=o[i],r=n.indexOf("="),~r){if(u=n.substring(0,r++).trim(),a=n.substring(r).trim(),a[0]==='"'&&(a=a.substring(1,a.length-1)),~a.indexOf("%"))try{a=decodeURIComponent(a)}catch{}tr.has(n=u.toLowerCase())?n==="expires"?t.expires=new Date(a):n==="max-age"?t.maxage=+a:t[n]=a:t[u]=a}else(u=n.trim().toLowerCase())&&(u==="httponly"||u==="secure")&&(t[u]=!0);return t}function nr(e,t,r={}){let n=e+"="+encodeURIComponent(t);return r.expires&&(n+="; Expires="+new Date(r.expires).toUTCString()),r.maxage!=null&&r.maxage>=0&&(n+="; Max-Age="+(r.maxage|0)),r.domain&&(n+="; Domain="+r.domain),r.path&&(n+="; Path="+r.path),r.samesite&&(n+="; SameSite="+r.samesite),(r.secure||r.samesite==="None")&&(n+="; Secure"),r.httponly&&(n+="; HttpOnly"),n}const Ze="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function ye(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=Ze.replace(/[x]/g,i=>{const o=r[n]%16,u=i==="x"?o:o&3|8;return n++,u.toString(16)}).toUpperCase()}catch{e=Ze.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${ar()}-${e}`}function ar(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}const r=Math.abs(e+t).toString(16).toLowerCase();return r.padStart(8-r.length,"0")}function he(e){const t=rr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function or(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=fe();return s.useCallback(({query:n,variables:i})=>{const o=t({contentType:"json"});e&&(o[Jt]=e);const u=he(document.cookie);return o[Xt]=u[W],o[er]=u[Z],fetch(r(),{method:"POST",headers:o,body:JSON.stringify({query:n.toString(),variables:i})}).then(a=>a.json()).catch(a=>({data:void 0,errors:a.toString()}))},[t,e,r])}function ir({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=or(),i=s.useCallback(E=>n({query:Wt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),o=s.useCallback(E=>n({query:qt(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),u=s.useCallback((E,g)=>n({query:xt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),a=s.useCallback((E,g)=>n({query:Bt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),h=s.useCallback((E,g)=>n({query:Ft(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),y=s.useCallback((E,g)=>n({query:Ht(t),variables:{cartId:E,note:g,numCartLines:e,country:r}}),[n,t,e,r]),l=s.useCallback((E,g)=>n({query:Gt(t),variables:{cartId:E,buyerIdentity:g,numCartLines:e,country:r}}),[t,r,n,e]),d=s.useCallback((E,g)=>n({query:jt(t),variables:{cartId:E,attributes:g,numCartLines:e,country:r}}),[t,r,n,e]),p=s.useCallback((E,g)=>n({query:Yt(t),variables:{cartId:E,discountCodes:g,numCartLines:e,country:r}}),[t,r,n,e]);return s.useMemo(()=>({cartFetch:i,cartCreate:o,cartLineAdd:u,cartLineUpdate:a,cartLineRemove:h,noteUpdate:y,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[i,o,u,a,h,y,l,d,p,t])}function x(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],J({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[J({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.cart},rawCartResult:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[J({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var i;return(i=n==null?void 0:n.payload)==null?void 0:i.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:J({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ne={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[J({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>be(t.payload.cart)})]}},ze={CARTLINE_ADD:{target:"cartLineAdding"},CARTLINE_UPDATE:{target:"cartLineUpdating"},CARTLINE_REMOVE:{target:"cartLineRemoving"},NOTE_UPDATE:{target:"noteUpdating"},BUYER_IDENTITY_UPDATE:{target:"buyerIdentityUpdating"},CART_ATTRIBUTES_UPDATE:{target:"cartAttributesUpdating"},DISCOUNT_CODES_UPDATE:{target:"discountCodesUpdating"}};function ur(e){return Re({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&be(e)},states:{uninitialized:{on:ne},cartCompleted:{on:ne},initializationError:{on:ne},idle:{on:{...ne,...ze}},error:{on:{...ne,...ze}},cartFetching:x("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:x("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:x("cartLineRemoveAction"),cartLineUpdating:x("cartLineUpdateAction"),cartLineAdding:x("cartLineAddAction"),noteUpdating:x("noteUpdateAction"),buyerIdentityUpdating:x("buyerIdentityUpdateAction"),cartAttributesUpdating:x("cartAttributesUpdateAction"),discountCodesUpdating:x("discountCodesUpdateAction")}})}function sr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:i,cartFragment:o,countryCode:u}){const{cartFetch:a,cartCreate:h,cartLineAdd:y,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ir({numCartLines:e,cartFragment:o,countryCode:u}),_=s.useMemo(()=>ur(i),[i]),[L,w,C]=Rt(_,{actions:{cartFetchAction:async(c,f)=>{var S;if(f.type!=="CART_FETCH")return;const{data:m,errors:T}=await a((S=f==null?void 0:f.payload)==null?void 0:S.cartId),I=q(f,m==null?void 0:m.cart,T);w(I)},cartCreateAction:async(c,f)=>{var S;if(f.type!=="CART_CREATE")return;const{data:m,errors:T}=await h(f==null?void 0:f.payload),I=q(f,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,T);w(I)},cartLineAddAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_ADD"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await y(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,T);w(I)},cartLineUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await l(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,T);w(I)},cartLineRemoveAction:async(c,f)=>{var S,D;if(f.type!=="CARTLINE_REMOVE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await d(c.cart.id,f.payload.lines),I=q(f,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,T);w(I)},noteUpdateAction:async(c,f)=>{var S,D;if(f.type!=="NOTE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await p(c.cart.id,f.payload.note),I=q(f,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,T);w(I)},buyerIdentityUpdateAction:async(c,f)=>{var S,D;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await E(c.cart.id,f.payload.buyerIdentity),I=q(f,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,T);w(I)},cartAttributesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await g(c.cart.id,f.payload.attributes),I=q(f,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,T);w(I)},discountCodesUpdateAction:async(c,f)=>{var S,D;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:T}=await b(c.cart.id,f.payload.discountCodes),I=q(f,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,T);w(I)},...t&&{onCartActionEntry:(c,f)=>{cr(f)&&t(c,f)}},...r&&{onCartActionOptimisticUI:J((c,f)=>r(c,f))},...n&&{onCartActionComplete:(c,f)=>{lr(f)&&n(c,f)}}}});return s.useMemo(()=>[L,w,C],[L,w,C])}function be(e){return{...e,lines:H(e==null?void 0:e.lines),note:e.note??void 0}}function q(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:be(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function cr(e){return e.type==="CART_CREATE"||e.type==="CARTLINE_ADD"||e.type==="CARTLINE_UPDATE"||e.type==="CARTLINE_REMOVE"||e.type==="NOTE_UPDATE"||e.type==="BUYER_IDENTITY_UPDATE"||e.type==="CART_ATTRIBUTES_UPDATE"||e.type==="DISCOUNT_CODES_UPDATE"}function lr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Ke=s.createContext(null);function ae(){const e=s.useContext(Ke);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function dr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:i,onLineUpdate:o,onNoteUpdate:u,onBuyerIdentityUpdate:a,onAttributesUpdate:h,onDiscountCodesUpdate:y,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:L,data:w,cartFragment:C=Zt,customerAccessToken:c,countryCode:f="US"}){var Et,pt,_t,St,vt,Ct,Tt;f&&(f=f.toUpperCase());const[m,T]=s.useState(f),[I,S]=s.useState(c),D=s.useRef(!1);(m!==f||I!==c)&&(T(f),S(c),D.current=!1);const[U,V]=sr({numCartLines:t,data:w,cartFragment:C,countryCode:f,onCartActionEntry(v,k){try{switch(k.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return i==null?void 0:i();case"CARTLINE_UPDATE":return o==null?void 0:o();case"NOTE_UPDATE":return u==null?void 0:u();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return h==null?void 0:h();case"DISCOUNT_CODES_UPDATE":return y==null?void 0:y()}}catch(R){console.error("Cart entry action failed",R)}},onCartActionOptimisticUI(v,k){var R,B,N,ce;if(!v.cart)return{...v};switch(k.type){case"CARTLINE_REMOVE":return{...v,cart:{...v.cart,lines:(B=(R=v==null?void 0:v.cart)==null?void 0:R.lines)==null?void 0:B.filter(M=>(M==null?void 0:M.id)&&!k.payload.lines.includes(M==null?void 0:M.id))}};case"CARTLINE_UPDATE":return{...v,cart:{...v.cart,lines:(ce=(N=v==null?void 0:v.cart)==null?void 0:N.lines)==null?void 0:ce.map(M=>{const Oe=k.payload.lines.find(({id:ln})=>ln===(M==null?void 0:M.id));return Oe&&Oe.quantity?{...M,quantity:Oe.quantity}:M})}}}return{...v}},onCartActionComplete(v,k){const R=k.payload.cartActionEvent;try{switch(k.type){case"RESOLVE":switch(R.type){case"CART_CREATE":return l==null?void 0:l();case"CARTLINE_ADD":return d==null?void 0:d();case"CARTLINE_REMOVE":return p==null?void 0:p();case"CARTLINE_UPDATE":return E==null?void 0:E();case"NOTE_UPDATE":return g==null?void 0:g();case"BUYER_IDENTITY_UPDATE":return hr(v,R)&&(D.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return _==null?void 0:_();case"DISCOUNT_CODES_UPDATE":return L==null?void 0:L()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),$=s.useRef(!1),j=U.matches("cartCompleted"),te=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((_t=(pt=(Et=U==null?void 0:U.context)==null?void 0:Et.cart)==null?void 0:pt.buyerIdentity)==null?void 0:_t.countryCode)&&!U.context.errors,F=s.useRef(!1);s.useEffect(()=>{if(!$.current&&!F.current){if(!w&&we("localStorage")){F.current=!0;try{const v=window.localStorage.getItem(Ae);v&&V({type:"CART_FETCH",payload:{cartId:v}})}catch(v){console.warn("error fetching cartId"),console.warn(v)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!te||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:c}}})},[f,c,te,D,V]);const O=s.useCallback(v=>{if(!$.current)return console.warn("Cart isn't ready yet");V(v)},[V]);s.useEffect(()=>{var v,k,R;if((k=(v=U==null?void 0:U.context)==null?void 0:v.cart)!=null&&k.id&&we("localStorage"))try{window.localStorage.setItem(Ae,(R=U.context.cart)==null?void 0:R.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(vt=(St=U==null?void 0:U.context)==null?void 0:St.cart)==null?void 0:vt.id]),s.useEffect(()=>{if(j&&we("localStorage"))try{window.localStorage.removeItem(Ae)}catch(v){console.warn("Failed to delete cartId from localStorage",v)}},[j]);const K=s.useCallback(v=>{var k,R;f&&!((k=v.buyerIdentity)!=null&&k.countryCode)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.countryCode=f),c&&!((R=v.buyerIdentity)!=null&&R.customerAccessToken)&&(v.buyerIdentity==null&&(v.buyerIdentity={}),v.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:v})},[f,c,O]),P=yr(U),Ee=s.useMemo(()=>{var v,k,R,B;return{...((v=P==null?void 0:P.context)==null?void 0:v.cart)??{lines:[],attributes:[]},status:fr(P.value),error:(k=P==null?void 0:P.context)==null?void 0:k.errors,totalQuantity:((B=(R=P==null?void 0:P.context)==null?void 0:R.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var ce,M;(M=(ce=P==null?void 0:P.context)==null?void 0:ce.cart)!=null&&M.id?O({type:"CARTLINE_ADD",payload:{lines:N}}):K({lines:N})},linesRemove(N){O({type:"CARTLINE_REMOVE",payload:{lines:N}})},linesUpdate(N){O({type:"CARTLINE_UPDATE",payload:{lines:N}})},noteUpdate(N){O({type:"NOTE_UPDATE",payload:{note:N}})},buyerIdentityUpdate(N){O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:N}})},cartAttributesUpdate(N){O({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:N}})},discountCodesUpdate(N){O({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:N}})},cartFragment:C}},[K,(Ct=P==null?void 0:P.context)==null?void 0:Ct.cart,(Tt=P==null?void 0:P.context)==null?void 0:Tt.errors,P.value,C,O]);return s.createElement(Ke.Provider,{value:Ee},e)}function fr(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function yr(e){const[t,r]=s.useTransition(),[n,i]=s.useState(e),o=s.useRef(!1);t&&(o.current=!0);const u=s.useRef(!1);return!t&&o.current&&(u.current=!0),s.useEffect(()=>{r(()=>{u.current||i(e)})},[e]),u.current?e:n}function we(e){let t;try{t=window[e];const r="__storage_test__";return t.setItem(r,r),t.removeItem(r),!0}catch(r){return r instanceof DOMException&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function hr(e,t){var r,n;return t.payload.buyerIdentity.countryCode&&((n=(r=e.cart)==null?void 0:r.buyerIdentity)==null?void 0:n.countryCode)!==t.payload.buyerIdentity.countryCode}const Qe=s.createContext(null);function gr({children:e,data:t,initialVariantId:r}){const n=s.useMemo(()=>H(t.variants??{}),[t.variants]);if(!Er(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const i=s.useMemo(()=>mr(n),[n]),[o,u]=s.useState(()=>et(r,n)),[a,h]=s.useState(()=>tt(o));s.useEffect(()=>{const _=et(r,n);u(_),h(tt(_))},[r,n]);const y=s.useCallback((_,L)=>{h(w=>{const C={...w,[_]:L};return u(Xe(n,C)),C})},[h,n]),l=s.useCallback((_,L)=>{const w=Xe(n,{...a,[_]:L});return(w==null?void 0:w.availableForSale)??!0},[a,n]),d=s.useMemo(()=>H(t.sellingPlanGroups??{}).map(_=>({..._,sellingPlans:H((_==null?void 0:_.sellingPlans)??{})})),[t.sellingPlanGroups]),[p,E]=s.useState(void 0),g=s.useMemo(()=>{var _,L;if(!(!o||!p)){if(!((_=o.sellingPlanAllocations)!=null&&_.nodes)&&!((L=o.sellingPlanAllocations)!=null&&L.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return H(o.sellingPlanAllocations).find(w=>{var C;return((C=w==null?void 0:w.sellingPlan)==null?void 0:C.id)===p.id})}},[o,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:i,selectedVariant:o,setSelectedVariant:u,selectedOptions:a,setSelectedOption:y,setSelectedOptions:h,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,i,t.sellingPlanGroups,t.variants,a,p,g,o,d,y,n]);return s.createElement(Qe.Provider,{value:b},e)}function Je(){const e=s.useContext(Qe);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Xe(e,t){var r,n;if(!(!e.length||((n=(r=e==null?void 0:e[0])==null?void 0:r.selectedOptions)==null?void 0:n.length)!==Object.keys(t).length))return e==null?void 0:e.find(i=>Object.entries(t).every(([o,u])=>{var a;return(a=i==null?void 0:i.selectedOptions)==null?void 0:a.some(h=>(h==null?void 0:h.name)===o&&(h==null?void 0:h.value)===u)}))}function mr(e){const t=e.reduce((r,n)=>{var i;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(i=n==null?void 0:n.selectedOptions)==null||i.forEach(o=>{r[(o==null?void 0:o.name)??""]=r[(o==null?void 0:o.name)??""]||new Set,r[(o==null?void 0:o.name)??""].add((o==null?void 0:o.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function et(e,t){if(e){const r=t.find(n=>(n==null?void 0:n.id)===e);return r||console.warn("<ProductProvider/> received a 'initialVariantId' prop, but could not actually find a variant with that ID"),r}if(e===null)return null;if(e===void 0)return t.find(r=>r==null?void 0:r.availableForSale)||t[0]}function tt(e){return e!=null&&e.selectedOptions?e.selectedOptions.reduce((t,r)=>(t[(r==null?void 0:r.name)??""]=(r==null?void 0:r.value)??"",t),{}):{}}function Er(e){return!(!e||!Array.isArray(e))}function Ie(e){const{as:t,onClick:r,defaultOnClick:n,children:i,buttonRef:o,...u}=e,a=s.useCallback(y=>{if(r){const l=r(y);if(typeof l=="boolean"&&l===!1||y!=null&&y.defaultPrevented)return}n==null||n(y)},[n,r]),h=t||"button";return s.createElement(h,{ref:o,onClick:a,...u},i)}function pr(e){const[t,r]=s.useState(!1),{variantId:n,quantity:i=1,attributes:o,sellingPlanId:u,onClick:a,children:h,accessibleAddingToCartLabel:y,...l}=e,{status:d,linesAdd:p}=ae(),{selectedVariant:E}=Je(),g=n??(E==null?void 0:E.id)??"",b=n===null||g===""||E===null||t||l.disabled;s.useEffect(()=>{t&&d==="idle"&&r(!1)},[d,t]);const _=s.useCallback(()=>{r(!0),p([{quantity:i,merchandiseId:g||"",attributes:o,sellingPlanId:u}])},[p,i,g,o,u]);return Q.createElement(Q.Fragment,null,Q.createElement(Ie,{...l,disabled:b,onClick:a,defaultOnClick:_},h),y?Q.createElement("p",{style:{position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},role:"alert","aria-live":"assertive"},t?y:null):null)}const De={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},ge={article:"article",blog:"blog",captcha:"captcha",cart:"cart",collection:"collection",customersAccount:"customers/account",customersActivateAccount:"customers/activate_account",customersAddresses:"customers/addresses",customersLogin:"customers/login",customersOrder:"customers/order",customersRegister:"customers/register",customersResetPassword:"customers/reset_password",giftCard:"gift_card",home:"index",listCollections:"list-collections",forbidden:"403",notFound:"404",page:"page",password:"password",product:"product",policy:"policy",search:"search"},rt={hydrogen:"hydrogen",headless:"headless"},nt={hydrogen:"6167201",headless:"12875497473"};function X(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function G(e){const t={id:"",resource:null};if(typeof e!="string")return t;const r=e.match(/^gid:\/\/shopify\/(\w+)\/([a-z0-9]+)/);if(!r||r.length===1)return t;const n=r[2]??null,i=r[1]??null;return{id:n,resource:i}}function z(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function _r(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Sr="trekkie_storefront_page_view/1.4",vr="myshopify.dev";function Cr(e){const t=e,{id:r,resource:n}=G(t.resourceId),i=n?n.toLowerCase():void 0;return[X(Sr,z({pageType:t.pageType,customerId:t.customerId,resourceType:i,resourceId:parseInt(r)},Tr(t)))]}function Tr(e){return{appClientId:e.shopifySalesChannel?nt[e.shopifySalesChannel]:nt.headless,isMerchantRequest:Ar(e.url),hydrogenSubchannelId:e.storefrontId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:ye(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(G(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function Ar(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(vr)!==-1||t==="localhost"}const oe="custom_storefront_customer_tracking/1.0",br="page_rendered",wr="collection_page_rendered",Ir="product_page_rendered",Dr="product_added_to_cart",Or="search_submitted";function Lr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,i=[];switch(i.push(X(oe,z({event_name:br,...r},ie(t)))),n){case ge.collection:i.push(X(oe,z({event_name:wr,...r,collection_name:t.collectionHandle},ie(t))));break;case ge.product:i.push(X(oe,z({event_name:Ir,...r,products:at(t.products),total_value:t.totalValue},ie(t))));break;case ge.search:i.push(X(oe,z({event_name:Or,...r,search_string:t.searchString},ie(t))));break}return i}function Pr(e){const t=e,r=G(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[X(oe,z({event_name:Dr,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:at(t.products)},ie(t)))]}function ie(e){return{source:e.shopifySalesChannel||rt.headless,hydrogenSubchannelId:e.storefrontId||"0",is_persistent_cookie:e.hasUserConsent,ccpa_enforced:!1,gdpr_enforced:!1,unique_token:e.uniqueToken,event_time:Date.now(),event_id:ye(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(G(e.shopId).id),currency:e.currency}}function at(e){return e?e.map(t=>{const r=z({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(G(t.productGid).id),variant_id:parseInt(G(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:t.price,quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function Ur(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let i=[];if(r===De.PAGE_VIEW){const o=n;i=i.concat(Cr(o),Lr(o))}else r===De.ADD_TO_CART&&(i=i.concat(Pr(n)));return i.length?kr(i,t):Promise.resolve()}const ot="sendShopifyAnalytics request is unsuccessful";function kr(e,t){const r={events:e,metadata:{event_sent_at_ms:Date.now()}};try{return fetch(t?`https://${t}/.well-known/shopify/monorail/unstable/produce_batch`:"https://monorail-edge.shopifysvc.com/unstable/produce_batch",{method:"post",headers:{"content-type":"text/plain"},body:JSON.stringify(r)}).then(n=>{if(!n.ok)throw new Error("Response failed");return n.text()}).then(n=>{n&&JSON.parse(n).result.forEach(o=>{o.status!==200&&console.error(ot,`
278
278
 
279
- `,a.message)})}).catch(n=>{console.error(at,n)})}catch{return Promise.resolve()}}function Nr(){if(_r("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Rr(),r=ye(document.cookie);return{uniqueToken:r[W],visitToken:r[Z],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Vr(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function Mr(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function Rr(){try{let e="PerformanceNavigationTiming",t=Vr();return t||(t=Mr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function $r(e){const{cartCreate:t,checkoutUrl:r}=ne(),[n,i]=s.useState(!1),{quantity:a,variantId:u,onClick:o,attributes:h,children:y,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{i(!0),t({lines:[{quantity:a??1,merchandiseId:u,attributes:h}]})},[t,a,u,h]);return s.createElement(we,{disabled:n??l.disabled,...l,onClick:o,defaultOnClick:d},y)}function xr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:i}=ne(),{children:a,...u}=e;return s.useEffect(()=>{t&&i&&n==="idle"&&(window.location.href=i)},[t,n,i]),s.createElement(we,{...u,disabled:t||u.disabled,onClick:()=>r(!0)},a)}function it(e){const{countryIsoCode:t,languageIsoCode:r}=de(),n=`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const i=parseFloat(e.amount),a=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),u=X(n,a),o=X(n,{...a,currencyDisplay:"name"}),h=X(n,{...a,currencyDisplay:"narrowSymbol"}),y=X(n,{...a,minimumFractionDigits:0,maximumFractionDigits:0}),l=X(n),d=X(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>u().format(i),parts:()=>u().formatToParts(i),withoutTrailingZeros:()=>i%1===0?y().format(i):u().format(i),withoutTrailingZerosAndCurrency:()=>i%1===0?d().format(i):l().format(i),currencyName:()=>{var g;return((g=o().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=u().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=h().formatToParts(i).find(p))==null?void 0:g.value)??""},amount:()=>u().formatToParts(i).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,i,o,u,h,l,y,d]);return s.useMemo(()=>new Proxy(E,{get:(g,b)=>{var _;return(_=Reflect.get(g,b))==null?void 0:_.call(null)}}),[E])}function X(e,t){return s.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ie({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:i,measurementSeparator:a="/",...u}){if(!qr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const o=it(e),h=t??"div";let y=o.localizedString;return(r||n)&&(r&&!n?y=o.amount:!r&&n?y=o.withoutTrailingZeros:y=o.withoutTrailingZerosAndCurrency),s.createElement(h,{...u},y,i&&i.referenceUnit&&s.createElement(s.Fragment,null,a,i.referenceUnit))}function qr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Fr(e){const{cost:t}=ne(),{amountType:r="total",children:n,...i}=e;let a;return r=="total"?a=t==null?void 0:t.totalAmount:r=="subtotal"?a=t==null?void 0:t.subtotalAmount:r=="tax"?a=t==null?void 0:t.totalTaxAmount:r=="duty"&&(a=t==null?void 0:t.totalDutyAmount),a==null?null:s.createElement(ie,{...i,data:a},n)}function Br(e){var a,u;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const i=r==="regular"?(a=t.cost)==null?void 0:a.totalAmount:(u=t.cost)==null?void 0:u.compareAtAmountPerQuantity;return i==null?null:s.createElement(ie,{...n,data:i})}const ut=s.createContext(null);function Hr(){const e=s.useContext(ut);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Gr({children:e,line:t}){return s.createElement(ut.Provider,{value:t},e)}const jr={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function st(e){const{data:t,options:r,id:n=t.id,frameBorder:i="0",allow:a="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:u=!0,loading:o="lazy",...h}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let y=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const d of Object.keys(r))l.searchParams.set(d,r[d]);y=l.toString()}return s.createElement("iframe",{...h,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:i,allow:a,allowFullScreen:u,src:y,loading:o})}const Yr=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],Wr=["spin.dev"],Zr=[...Yr,...Wr],ue=[352,832,1200,1920,2560];function ct({src:e,width:t,height:r,crop:n,scale:i}){const a=new URL(e),u=i??1;if(t){let o;typeof t=="string"?o=(ue[0]*u).toString():o=(Number(t)*u).toString(),a.searchParams.append("width",o)}return r&&typeof r=="number"&&a.searchParams.append("height",(r*u).toString()),n&&a.searchParams.append("crop",n),a.toString()}function lt(e){const t=new URL(e.src);return!Zr.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:ct(e)}function zr({data:e,loaderOptions:t,elementProps:r}){let n=null;return e!=null&&e.width&&(e!=null&&e.height)&&(n=(e==null?void 0:e.width)/(e==null?void 0:e.height)),t!=null&&t.width||t!=null&&t.height?{width:(t==null?void 0:t.width)??(n&&typeof t.height=="number"?Math.round(n*t.height):null),height:(t==null?void 0:t.height)??(n&&typeof t.width=="number"?Math.round(n*t.width):null)}:r!=null&&r.width||r!=null&&r.height?{width:(r==null?void 0:r.width)??(n&&typeof r.height=="number"?Math.round(n*r.height):null),height:(r==null?void 0:r.height)??(n&&typeof r.width=="number"?Math.round(n*r.width):null)}:e!=null&&e.width||e!=null&&e.height?{width:(e==null?void 0:e.width)??null,height:(e==null?void 0:e.height)??null}:{width:null,height:null}}function dt({data:e,width:t,height:r,loading:n,loader:i=lt,loaderOptions:a,widths:u,decoding:o="async",...h}){if(!e.url){const g=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(g),null}const{width:y,height:l}=zr({data:e,loaderOptions:a,elementProps:{width:t,height:r}});let d=e.url;if(i&&(d=i({...a,src:e.url,width:y,height:l}),typeof d!="string"||!d))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const p=t&&y&&t<y?t:y,E=h.srcSet??Kr({...a,widths:u,src:e.url,width:p,height:l,loader:i});return Oe.createElement("img",{id:e.id??"",alt:e.altText??h.alt??"",loading:n??"lazy",...h,src:d,width:y??void 0,height:l??void 0,srcSet:E,decoding:o})}function Kr({src:e,width:t,crop:r,scale:n,widths:i,loader:a,height:u}){const o=i&&Array.isArray(i);if(o&&i.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let h=1;t&&u&&(h=Number(u)/Number(t));let y=o?i:ue;!o&&t&&t<ue[ue.length-1]&&(y=ue.filter(d=>d<=t));const l=a||ct;return y.map(d=>`${l({src:e,width:d,height:r?Number(d)*h:void 0,crop:r,scale:n})} ${d}w`).join(", ")}function ft(e){var y;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:i=!0,controls:a=!0,sourceProps:u={},...o}=e,h=lt({src:((y=t.previewImage)==null?void 0:y.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return s.createElement("video",{...o,id:n,playsInline:i,controls:a,poster:h},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return s.createElement("source",{...u,key:l.url,src:l.url,type:l.mimeType})}))}const yt={};function Qr(e,t){const r=yt[e];if(r)return r;const n=new Promise((i,a)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{i(!0)},u.onerror=()=>{a(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(u):document.body.appendChild(u)});return yt[e]=n,n}function ht(e,t){const[r,n]=s.useState("loading"),i=JSON.stringify(t);return s.useEffect(()=>{async function a(){try{n("loading"),await Qr(e,t),n("done")}catch{n("error")}}a()},[e,i,t]),r}function gt(e){var y,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:i,children:a,className:u,...o}=e,h=ht("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return s.useEffect(()=>{if(t)return o.onError&&t.addEventListener("error",o.onError),o.onLoad&&t.addEventListener("load",o.onLoad),o.onPreload&&t.addEventListener("preload",o.onPreload),o.onModelVisibility&&t.addEventListener("model-visibility",o.onModelVisibility),o.onProgress&&t.addEventListener("progress",o.onProgress),o.onArStatus&&t.addEventListener("ar-status",o.onArStatus),o.onArTracking&&t.addEventListener("ar-tracking",o.onArTracking),o.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",o.onQuickLookButtonTapped),o.onCameraChange&&t.addEventListener("camera-change",o.onCameraChange),o.onEnvironmentChange&&t.addEventListener("environment-change",o.onEnvironmentChange),o.onPlay&&t.addEventListener("play",o.onPlay),o.onPause&&t.addEventListener("ar-status",o.onPause),o.onSceneGraphReady&&t.addEventListener("scene-graph-ready",o.onSceneGraphReady),()=>{t!=null&&(o.onError&&t.removeEventListener("error",o.onError),o.onLoad&&t.removeEventListener("load",o.onLoad),o.onPreload&&t.removeEventListener("preload",o.onPreload),o.onModelVisibility&&t.removeEventListener("model-visibility",o.onModelVisibility),o.onProgress&&t.removeEventListener("progress",o.onProgress),o.onArStatus&&t.removeEventListener("ar-status",o.onArStatus),o.onArTracking&&t.removeEventListener("ar-tracking",o.onArTracking),o.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",o.onQuickLookButtonTapped),o.onCameraChange&&t.removeEventListener("camera-change",o.onCameraChange),o.onEnvironmentChange&&t.removeEventListener("environment-change",o.onEnvironmentChange),o.onPlay&&t.removeEventListener("play",o.onPlay),o.onPause&&t.removeEventListener("ar-status",o.onPause),o.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",o.onSceneGraphReady))}},[t,o.onArStatus,o.onArTracking,o.onCameraChange,o.onEnvironmentChange,o.onError,o.onLoad,o.onModelVisibility,o.onPause,o.onPlay,o.onPreload,o.onProgress,o.onQuickLookButtonTapped,o.onSceneGraphReady]),h!=="done"?null:(l=(y=i.sources)==null?void 0:y[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...o,className:u,id:o.id??i.id,src:i.sources[0].url,alt:i.alt??null,"camera-controls":o.cameraControls??!0,poster:(o.poster||((d=i.previewImage)==null?void 0:d.url))??null,autoplay:o.autoplay??!0,loading:o.loading,reveal:o.reveal,ar:o.ar,"ar-modes":o.arModes,"ar-scale":o.arScale,"ar-placement":o.arPlacement,"ios-src":o.iosSrc,"touch-action":o.touchAction,"disable-zoom":o.disableZoom,"orbit-sensitivity":o.orbitSensitivity,"auto-rotate":o.autoRotate,"auto-rotate-delay":o.autoRotateDelay,"rotation-per-second":o.rotationPerSecond,"interaction-policy":o.interactionPolicy,"interaction-prompt":o.interactionPrompt,"interaction-prompt-style":o.interactionPromptStyle,"interaction-prompt-threshold":o.interactionPromptThreshold,"camera-orbit":o.cameraOrbit,"camera-target":o.cameraTarget,"field-of-view":o.fieldOfView,"max-camera-orbit":o.maxCameraOrbit,"min-camera-orbit":o.minCameraOrbit,"max-field-of-view":o.maxFieldOfView,"min-field-of-view":o.minFieldOfView,bounds:o.bounds,"interpolation-decay":o.interpolationDecay??100,"skybox-image":o.skyboxImage,"environment-image":o.environmentImage,exposure:o.exposure,"shadow-intensity":o.shadowIntensity??0,"shadow-softness":o.shadowSoftness??0,"animation-name":o.animationName,"animation-crossfade-duration":o.animationCrossfadeDuration,"variant-name":o.variantName,orientation:o.orientation,scale:o.scale},a):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function Jr({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?s.createElement(dt,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return s.createElement(ft,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return s.createElement(st,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return s.createElement(gt,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function Xr(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=mt(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=mt((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:H(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function mt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function en(e){var y,l,d,p,E,g;const{priceType:t="regular",variantId:r,valueType:n="min",data:i,...a}=e;if(i==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let u,o;const h=r?H((i==null?void 0:i.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&h){if(((y=h.compareAtPriceV2)==null?void 0:y.amount)===((l=h.priceV2)==null?void 0:l.amount))return null;u=h.compareAtPriceV2}else n==="max"?u=(d=i==null?void 0:i.compareAtPriceRange)==null?void 0:d.maxVariantPrice:u=(p=i==null?void 0:i.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&h?(u=h.priceV2,n==="unit"&&(u=h.unitPrice,o=h.unitPriceMeasurement)):n==="max"?u=(E=i.priceRange)==null?void 0:E.maxVariantPrice:u=(g=i.priceRange)==null?void 0:g.minVariantPrice;return u?o?s.createElement(ie,{...a,data:u,measurement:o}):s.createElement(ie,{...a,data:u}):null}const tn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function rn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:i}=de(),a=ht(tn);let u=[];if(e&&r)throw new Error(an);if(e)u=e.reduce((h,y)=>{const l=G(y).id;return l&&h.push(l),h},[]);else if(r)u=r.reduce((h,y)=>{const l=G(y==null?void 0:y.id).id;return l&&h.push(`${l}:${(y==null?void 0:y.quantity)??1}`),h},[]);else throw new Error(on);if(u.length===0)throw new Error(nn);const o=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:o},a==="done"&&s.createElement("shop-pay-button",{"store-url":i,variants:u.join(",")}))}const nn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',on='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',an="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",un=60*60*24*360*1,sn=60*30;function cn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};s.useEffect(()=>{const n=ye(document.cookie);t?(ge(W,n[W]||fe(),un,r),ge(Z,n[Z]||fe(),sn,r)):(ge(W,"",0,r),ge(Z,"",0,r))})}function ge(e,t,r,n){document.cookie=nr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}A.AddToCartButton=pr,A.AnalyticsEventName=Ie,A.AnalyticsPageType=he,A.BuyNowButton=$r,A.CartCheckoutButton=xr,A.CartCost=Fr,A.CartLinePrice=Br,A.CartLineProvider=Gr,A.CartProvider=dr,A.ExternalVideo=st,A.Image=dt,A.MediaFile=Jr,A.ModelViewer=gt,A.Money=ie,A.ProductPrice=en,A.ProductProvider=gr,A.ShopPayButton=rn,A.ShopifyProvider=Qt,A.ShopifySalesChannel=rt,A.Video=ft,A.createStorefrontClient=zt,A.flattenConnection=H,A.getClientBrowserParameters=Nr,A.getShopifyCookies=ye,A.parseMetafield=Xr,A.sendShopifyAnalytics=Ur,A.storefrontApiCustomScalars=jr,A.useCart=ne,A.useCartLine=Hr,A.useMoney=it,A.useProduct=Je,A.useShop=de,A.useShopifyCookies=cn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
279
+ `,o.message)})}).catch(n=>{console.error(ot,n)})}catch{return Promise.resolve()}}function Nr(){if(_r("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Mr(),r=he(document.cookie);return{uniqueToken:r[W],visitToken:r[Z],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Vr(){try{const e=(performance==null?void 0:performance.getEntriesByType)&&(performance==null?void 0:performance.getEntriesByType("navigation"));if(e&&e[0]){const t=window.performance.getEntriesByType("navigation")[0].type;return t&&t.toString()}}catch{}}function Rr(){var e,t;try{if(PerformanceNavigation&&((e=performance==null?void 0:performance.navigation)==null?void 0:e.type)!==null&&((t=performance==null?void 0:performance.navigation)==null?void 0:t.type)!==void 0){const r=performance.navigation.type;switch(r){case PerformanceNavigation.TYPE_NAVIGATE:return"navigate";case PerformanceNavigation.TYPE_RELOAD:return"reload";case PerformanceNavigation.TYPE_BACK_FORWARD:return"back_forward";default:return`unknown: ${r}`}}}catch{}}function Mr(){try{let e="PerformanceNavigationTiming",t=Vr();return t||(t=Rr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function $r(e){const{cartCreate:t,checkoutUrl:r}=ae(),[n,i]=s.useState(!1),{quantity:o,variantId:u,onClick:a,attributes:h,children:y,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{i(!0),t({lines:[{quantity:o??1,merchandiseId:u,attributes:h}]})},[t,o,u,h]);return s.createElement(Ie,{disabled:n??l.disabled,...l,onClick:a,defaultOnClick:d},y)}function xr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:i}=ae(),{children:o,...u}=e;return s.useEffect(()=>{t&&i&&n==="idle"&&(window.location.href=i)},[t,n,i]),s.createElement(Ie,{...u,disabled:t||u.disabled,onClick:()=>r(!0)},o)}function it(e){const{countryIsoCode:t,languageIsoCode:r}=fe(),n=`${r}-${t}`;if(!n)throw new Error("useMoney(): Unable to get 'locale' from 'useShop()', which means that 'locale' was not passed to '<ShopifyProvider/>'. 'locale' is required for 'useMoney()' to work");const i=parseFloat(e.amount),o=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),u=ee(n,o),a=ee(n,{...o,currencyDisplay:"name"}),h=ee(n,{...o,currencyDisplay:"narrowSymbol"}),y=ee(n,{...o,minimumFractionDigits:0,maximumFractionDigits:0}),l=ee(n),d=ee(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>u().format(i),parts:()=>u().formatToParts(i),withoutTrailingZeros:()=>i%1===0?y().format(i):u().format(i),withoutTrailingZerosAndCurrency:()=>i%1===0?d().format(i):l().format(i),currencyName:()=>{var g;return((g=a().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=u().formatToParts(i).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=h().formatToParts(i).find(p))==null?void 0:g.value)??""},amount:()=>u().formatToParts(i).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,i,a,u,h,l,y,d]);return s.useMemo(()=>new Proxy(E,{get:(g,b)=>{var _;return(_=Reflect.get(g,b))==null?void 0:_.call(null)}}),[E])}function ee(e,t){return s.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ue({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:i,measurementSeparator:o="/",...u}){if(!qr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=it(e),h=t??"div";let y=a.localizedString;return(r||n)&&(r&&!n?y=a.amount:!r&&n?y=a.withoutTrailingZeros:y=a.withoutTrailingZerosAndCurrency),s.createElement(h,{...u},y,i&&i.referenceUnit&&s.createElement(s.Fragment,null,o,i.referenceUnit))}function qr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Fr(e){const{cost:t}=ae(),{amountType:r="total",children:n,...i}=e;let o;return r=="total"?o=t==null?void 0:t.totalAmount:r=="subtotal"?o=t==null?void 0:t.subtotalAmount:r=="tax"?o=t==null?void 0:t.totalTaxAmount:r=="duty"&&(o=t==null?void 0:t.totalDutyAmount),o==null?null:s.createElement(ue,{...i,data:o},n)}function Br(e){var o,u;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const i=r==="regular"?(o=t.cost)==null?void 0:o.totalAmount:(u=t.cost)==null?void 0:u.compareAtAmountPerQuantity;return i==null?null:s.createElement(ue,{...n,data:i})}const ut=s.createContext(null);function Hr(){const e=s.useContext(ut);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Gr({children:e,line:t}){return s.createElement(ut.Provider,{value:t},e)}const jr={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function st(e){const{data:t,options:r,id:n=t.id,frameBorder:i="0",allow:o="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:u=!0,loading:a="lazy",...h}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let y=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const d of Object.keys(r))l.searchParams.set(d,r[d]);y=l.toString()}return s.createElement("iframe",{...h,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:i,allow:o,allowFullScreen:u,src:y,loading:a})}const Yr=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],Wr=["spin.dev"],Zr=[...Yr,...Wr],se=[352,832,1200,1920,2560];function ct({src:e,width:t,height:r,crop:n,scale:i}){const o=new URL(e),u=i??1;if(t){let a;typeof t=="string"?a=(se[0]*u).toString():a=(Number(t)*u).toString(),o.searchParams.append("width",a)}return r&&typeof r=="number"&&o.searchParams.append("height",(r*u).toString()),n&&o.searchParams.append("crop",n),o.toString()}function lt(e){const t=new URL(e.src);return!Zr.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:ct(e)}function zr({data:e,loaderOptions:t,elementProps:r}){let n=null;return e!=null&&e.width&&(e!=null&&e.height)&&(n=(e==null?void 0:e.width)/(e==null?void 0:e.height)),t!=null&&t.width||t!=null&&t.height?{width:(t==null?void 0:t.width)??(n&&typeof t.height=="number"?Math.round(n*t.height):null),height:(t==null?void 0:t.height)??(n&&typeof t.width=="number"?Math.round(n*t.width):null)}:r!=null&&r.width||r!=null&&r.height?{width:(r==null?void 0:r.width)??(n&&typeof r.height=="number"?Math.round(n*r.height):null),height:(r==null?void 0:r.height)??(n&&typeof r.width=="number"?Math.round(n*r.width):null)}:e!=null&&e.width||e!=null&&e.height?{width:(e==null?void 0:e.width)??null,height:(e==null?void 0:e.height)??null}:{width:null,height:null}}function dt({data:e,width:t,height:r,loading:n,loader:i=lt,loaderOptions:o,widths:u,decoding:a="async",...h}){if(!e.url){const g=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(g),null}const{width:y,height:l}=zr({data:e,loaderOptions:o,elementProps:{width:t,height:r}});let d=e.url;if(i&&(d=i({...o,src:e.url,width:y,height:l}),typeof d!="string"||!d))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const p=t&&y&&t<y?t:y,E=h.srcSet??Kr({...o,widths:u,src:e.url,width:p,height:l,loader:i});return Q.createElement("img",{id:e.id??"",alt:e.altText??h.alt??"",loading:n??"lazy",...h,src:d,width:y??void 0,height:l??void 0,srcSet:E,decoding:a})}function Kr({src:e,width:t,crop:r,scale:n,widths:i,loader:o,height:u}){const a=i&&Array.isArray(i);if(a&&i.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let h=1;t&&u&&(h=Number(u)/Number(t));let y=a?i:se;!a&&t&&t<se[se.length-1]&&(y=se.filter(d=>d<=t));const l=o||ct;return y.map(d=>`${l({src:e,width:d,height:r?Number(d)*h:void 0,crop:r,scale:n})} ${d}w`).join(", ")}function ft(e){var y;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:i=!0,controls:o=!0,sourceProps:u={},...a}=e,h=lt({src:((y=t.previewImage)==null?void 0:y.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return s.createElement("video",{...a,id:n,playsInline:i,controls:o,poster:h},t.sources.map(l=>{if(!(l!=null&&l.url&&(l!=null&&l.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return s.createElement("source",{...u,key:l.url,src:l.url,type:l.mimeType})}))}const yt={};function Qr(e,t){const r=yt[e];if(r)return r;const n=new Promise((i,o)=>{const u=document.createElement("script");t!=null&&t.module?u.type="module":u.type="text/javascript",u.src=e,u.onload=()=>{i(!0)},u.onerror=()=>{o(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(u):document.body.appendChild(u)});return yt[e]=n,n}function ht(e,t){const[r,n]=s.useState("loading"),i=JSON.stringify(t);return s.useEffect(()=>{async function o(){try{n("loading"),await Qr(e,t),n("done")}catch{n("error")}}o()},[e,i,t]),r}function gt(e){var y,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:i,children:o,className:u,...a}=e,h=ht("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return s.useEffect(()=>{if(t)return a.onError&&t.addEventListener("error",a.onError),a.onLoad&&t.addEventListener("load",a.onLoad),a.onPreload&&t.addEventListener("preload",a.onPreload),a.onModelVisibility&&t.addEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.addEventListener("progress",a.onProgress),a.onArStatus&&t.addEventListener("ar-status",a.onArStatus),a.onArTracking&&t.addEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.addEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.addEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.addEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.addEventListener("play",a.onPlay),a.onPause&&t.addEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.addEventListener("scene-graph-ready",a.onSceneGraphReady),()=>{t!=null&&(a.onError&&t.removeEventListener("error",a.onError),a.onLoad&&t.removeEventListener("load",a.onLoad),a.onPreload&&t.removeEventListener("preload",a.onPreload),a.onModelVisibility&&t.removeEventListener("model-visibility",a.onModelVisibility),a.onProgress&&t.removeEventListener("progress",a.onProgress),a.onArStatus&&t.removeEventListener("ar-status",a.onArStatus),a.onArTracking&&t.removeEventListener("ar-tracking",a.onArTracking),a.onQuickLookButtonTapped&&t.removeEventListener("quick-look-button-tapped",a.onQuickLookButtonTapped),a.onCameraChange&&t.removeEventListener("camera-change",a.onCameraChange),a.onEnvironmentChange&&t.removeEventListener("environment-change",a.onEnvironmentChange),a.onPlay&&t.removeEventListener("play",a.onPlay),a.onPause&&t.removeEventListener("ar-status",a.onPause),a.onSceneGraphReady&&t.removeEventListener("scene-graph-ready",a.onSceneGraphReady))}},[t,a.onArStatus,a.onArTracking,a.onCameraChange,a.onEnvironmentChange,a.onError,a.onLoad,a.onModelVisibility,a.onPause,a.onPlay,a.onPreload,a.onProgress,a.onQuickLookButtonTapped,a.onSceneGraphReady]),h!=="done"?null:(l=(y=i.sources)==null?void 0:y[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...a,className:u,id:a.id??i.id,src:i.sources[0].url,alt:i.alt??null,"camera-controls":a.cameraControls??!0,poster:(a.poster||((d=i.previewImage)==null?void 0:d.url))??null,autoplay:a.autoplay??!0,loading:a.loading,reveal:a.reveal,ar:a.ar,"ar-modes":a.arModes,"ar-scale":a.arScale,"ar-placement":a.arPlacement,"ios-src":a.iosSrc,"touch-action":a.touchAction,"disable-zoom":a.disableZoom,"orbit-sensitivity":a.orbitSensitivity,"auto-rotate":a.autoRotate,"auto-rotate-delay":a.autoRotateDelay,"rotation-per-second":a.rotationPerSecond,"interaction-policy":a.interactionPolicy,"interaction-prompt":a.interactionPrompt,"interaction-prompt-style":a.interactionPromptStyle,"interaction-prompt-threshold":a.interactionPromptThreshold,"camera-orbit":a.cameraOrbit,"camera-target":a.cameraTarget,"field-of-view":a.fieldOfView,"max-camera-orbit":a.maxCameraOrbit,"min-camera-orbit":a.minCameraOrbit,"max-field-of-view":a.maxFieldOfView,"min-field-of-view":a.minFieldOfView,bounds:a.bounds,"interpolation-decay":a.interpolationDecay??100,"skybox-image":a.skyboxImage,"environment-image":a.environmentImage,exposure:a.exposure,"shadow-intensity":a.shadowIntensity??0,"shadow-softness":a.shadowSoftness??0,"animation-name":a.animationName,"animation-crossfade-duration":a.animationCrossfadeDuration,"variant-name":a.variantName,orientation:a.orientation,scale:a.scale},o):(console.error("<ModelViewer/> requires 'data.sources' prop to be an array, with an object that has a property 'url' on it. Rendering 'null'"),null)}function Jr({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?s.createElement(dt,{...r,...t==null?void 0:t.image,data:e.image}):(console.warn("<MediaFile/>: 'data.image' does not exist for __typename of 'MediaImage'; rendering 'null' by default."),null);case"Video":return s.createElement(ft,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return s.createElement(st,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return s.createElement(gt,{...r,...t==null?void 0:t.modelViewer,data:e});default:return console.error("<MediaFile /> requires the '__typename' property to exist on the 'data' prop in order to render the matching sub-component for this type of media. Rendering 'null' by default"),null}}function Xr(e){if(!e.type)return console.error("parseMetafield(): The 'type' field is required in order to parse the Metafield. Returning 'parsedValue' of 'null'"),{...e,parsedValue:null};switch(e.type){case"boolean":return{...e,parsedValue:e.value==="true"};case"collection_reference":case"file_reference":case"page_reference":case"product_reference":case"variant_reference":return{...e,parsedValue:e.reference};case"color":case"multi_line_text_field":case"single_line_text_field":case"url":return{...e,parsedValue:e.value};case"dimension":case"money":case"json":case"rating":case"volume":case"weight":case"list.color":case"list.dimension":case"list.number_integer":case"list.number_decimal":case"list.rating":case"list.single_line_text_field":case"list.url":case"list.volume":case"list.weight":{let t=null;try{t=mt(e.value??"")}catch{console.error("parseMetafield(): attempted to JSON.parse the 'metafield.value' property, but failed. Returning 'null' for 'parsedValue'"),t=null}return{...e,parsedValue:t}}case"date":case"date_time":return{...e,parsedValue:new Date(e.value??"")};case"list.date":case"list.date_time":{const t=mt((e==null?void 0:e.value)??"");return{...e,parsedValue:t.map(r=>new Date(r))}}case"number_decimal":case"number_integer":return{...e,parsedValue:Number(e.value)};case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:H(e.references??void 0)};default:{const t=`parseMetafield(): the 'metafield.type' you passed in is not supported. Your type: "${e.type}". If you believe this is an error, please open an issue on GitHub.`;return console.error(`${t} Returning 'parsedValue' of 'null'`),{...e,parsedValue:null}}}}function mt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function en(e){var y,l,d,p,E,g;const{priceType:t="regular",variantId:r,valueType:n="min",data:i,...o}=e;if(i==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let u,a;const h=r?H((i==null?void 0:i.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&h){if(((y=h.compareAtPriceV2)==null?void 0:y.amount)===((l=h.priceV2)==null?void 0:l.amount))return null;u=h.compareAtPriceV2}else n==="max"?u=(d=i==null?void 0:i.compareAtPriceRange)==null?void 0:d.maxVariantPrice:u=(p=i==null?void 0:i.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&h?(u=h.priceV2,n==="unit"&&(u=h.unitPrice,a=h.unitPriceMeasurement)):n==="max"?u=(E=i.priceRange)==null?void 0:E.maxVariantPrice:u=(g=i.priceRange)==null?void 0:g.minVariantPrice;return u?a?s.createElement(ue,{...o,data:u,measurement:a}):s.createElement(ue,{...o,data:u}):null}const tn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function rn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:i}=fe(),o=ht(tn);let u=[];if(e&&r)throw new Error(on);if(e)u=e.reduce((h,y)=>{const l=G(y).id;return l&&h.push(l),h},[]);else if(r)u=r.reduce((h,y)=>{const l=G(y==null?void 0:y.id).id;return l&&h.push(`${l}:${(y==null?void 0:y.quantity)??1}`),h},[]);else throw new Error(an);if(u.length===0)throw new Error(nn);const a=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:a},o==="done"&&s.createElement("shop-pay-button",{"store-url":i,variants:u.join(",")}))}const nn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',an='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',on="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",un=60*60*24*360*1,sn=60*30;function cn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};s.useEffect(()=>{const n=he(document.cookie);t?(me(W,n[W]||ye(),un,r),me(Z,n[Z]||ye(),sn,r)):(me(W,"",0,r),me(Z,"",0,r))})}function me(e,t,r,n){document.cookie=nr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}A.AddToCartButton=pr,A.AnalyticsEventName=De,A.AnalyticsPageType=ge,A.BuyNowButton=$r,A.CartCheckoutButton=xr,A.CartCost=Fr,A.CartLinePrice=Br,A.CartLineProvider=Gr,A.CartProvider=dr,A.ExternalVideo=st,A.Image=dt,A.MediaFile=Jr,A.ModelViewer=gt,A.Money=ue,A.ProductPrice=en,A.ProductProvider=gr,A.ShopPayButton=rn,A.ShopifyProvider=Qt,A.ShopifySalesChannel=rt,A.Video=ft,A.createStorefrontClient=zt,A.flattenConnection=H,A.getClientBrowserParameters=Nr,A.getShopifyCookies=he,A.parseMetafield=Xr,A.sendShopifyAnalytics=Ur,A.storefrontApiCustomScalars=jr,A.useCart=ae,A.useCartLine=Hr,A.useMoney=it,A.useProduct=Je,A.useShop=fe,A.useShopifyCookies=cn,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
280
280
  //# sourceMappingURL=hydrogen-react.prod.js.map