@shopify/hydrogen-react 0.0.0-next-9f025d3 → 0.0.0-next-35b1986

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v.hydrogenreact={},v.React))})(this,function(v,s){"use strict";function bt(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=bt(s);/*! *****************************************************************************
1
+ (function(E,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],u):(E=typeof globalThis<"u"?globalThis:E||self,u(E.hydrogenreact={},E.React))})(this,function(E,u){"use strict";function Ct(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 W=Ct(u);/*! *****************************************************************************
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,o,u=r.call(e),i=[];try{for(;(t===void 0||t-- >0)&&!(n=u.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=u.return)&&r.call(u)}finally{if(o)throw o.error}}return i}var Y;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(Y||(Y={}));var Ue={type:"xstate.init"};function _e(e){return e===void 0?[]:[].concat(e)}function J(e){return{type:"xstate.assign",assignment:e}}function ke(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 Ne(e){return typeof e=="string"?{type:e}:e}function Ve(e,t){return{value:e,context:t,actions:[],changed:!1,matches:le(e)}}function Me(e,t,r){var n=t,o=!1;return[e.filter(function(u){if(u.type==="xstate.assign"){o=!0;var i=Object.assign({},n);return typeof u.assignment=="function"?i=u.assignment(n,r):Object.keys(u.assignment).forEach(function(a){i[a]=typeof u.assignment[a]=="function"?u.assignment[a](n,r):u.assignment[a]}),n=i,!1}return!0}),n,o]}function Re(e,t){t===void 0&&(t={});var r=Le(Me(_e(e.states[e.initial].entry).map(function(i){return ke(i,t.actions)}),e.context,Ue),2),n=r[0],o=r[1],u={config:e,_options:t,initialState:{value:e.initial,actions:n,context:o,matches:le(e.initial)},transition:function(i,a){var y,f,l=typeof i=="string"?{value:i,context:e.context}:i,d=l.value,p=l.context,E=Ne(a),g=e.states[d];if(g.on){var b=_e(g.on[E.type]);try{for(var _=function(O){var K=typeof Symbol=="function"&&Symbol.iterator,L=K&&O[K],pe=0;if(L)return L.call(O);if(O&&typeof O.length=="number")return{next:function(){return O&&pe>=O.length&&(O=void 0),{value:O&&O[pe++],done:!O}}};throw new TypeError(K?"Object is not iterable.":"Symbol.iterator is not defined.")}(b),P=_.next();!P.done;P=_.next()){var w=P.value;if(w===void 0)return Ve(d,p);var T=typeof w=="string"?{target:w}:w,c=T.target,h=T.actions,m=h===void 0?[]:h,A=T.cond,I=A===void 0?function(){return!0}:A,S=c===void 0,D=c??d,U=e.states[D];if(I(p,E)){var V=Le(Me((S?_e(m):[].concat(g.exit,m,U.entry).filter(function(O){return O})).map(function(O){return ke(O,u._options.actions)}),p,E),3),$=V[0],G=V[1],re=V[2],F=c??d;return{value:F,context:G,actions:$,changed:c!==d||$.length>0||re,matches:le(F)}}}}catch(O){y={error:O}}finally{try{P&&!P.done&&(f=_.return)&&f.call(_)}finally{if(y)throw y.error}}}return Ve(d,p)}};return u}var $e=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function wt(e){var t=e.initialState,r=Y.NotStarted,n=new Set,o={_machine:e,send:function(u){r===Y.Running&&(t=e.transition(t,u),$e(t,Ne(u)),n.forEach(function(i){return i(t)}))},subscribe:function(u){return n.add(u),u(t),{unsubscribe:function(){return n.delete(u)}}},start:function(u){if(u){var i=typeof u=="object"?u:{context:e.config.context,value:u};t={value:i.value,actions:[],context:i.context,matches:le(i.value)}}else t=e.initialState;return r=Y.Running,$e(t,Ue),o},stop:function(){return r=Y.Stopped,n.clear(),o},get state(){return t},get status(){return r}};return o}var It=s.useLayoutEffect,Se={},Dt={get exports(){return Se},set exports(e){Se=e}},ve={},de={},Ot={get exports(){return de},set exports(e){de=e}},Ce={};/**
14
+ ***************************************************************************** */function ke(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,o,s=r.call(e),i=[];try{for(;(t===void 0||t-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(a){o={error:a}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(o)throw o.error}}return i}var j;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(j||(j={}));var Ue={type:"xstate.init"};function Se(e){return e===void 0?[]:[].concat(e)}function z(e){return{type:"xstate.assign",assignment:e}}function Ne(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 $e(e){return typeof e=="string"?{type:e}:e}function Ve(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ce(e)}}function Le(e,t,r){var n=t,o=!1;return[e.filter(function(s){if(s.type==="xstate.assign"){o=!0;var i=Object.assign({},n);return typeof s.assignment=="function"?i=s.assignment(n,r):Object.keys(s.assignment).forEach(function(a){i[a]=typeof s.assignment[a]=="function"?s.assignment[a](n,r):s.assignment[a]}),n=i,!1}return!0}),n,o]}function Me(e,t){t===void 0&&(t={});var r=ke(Le(Se(e.states[e.initial].entry).map(function(i){return Ne(i,t.actions)}),e.context,Ue),2),n=r[0],o=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:o,matches:ce(e.initial)},transition:function(i,a){var c,l,d=typeof i=="string"?{value:i,context:e.context}:i,g=d.value,S=d.context,m=$e(a),y=e.states[g];if(y.on){var P=Se(y.on[m.type]);try{for(var T=function(b){var Q=typeof Symbol=="function"&&Symbol.iterator,w=Q&&b[Q],Ce=0;if(w)return w.call(b);if(b&&typeof b.length=="number")return{next:function(){return b&&Ce>=b.length&&(b=void 0),{value:b&&b[Ce++],done:!b}}};throw new TypeError(Q?"Object is not iterable.":"Symbol.iterator is not defined.")}(P),k=T.next();!k.done;k=T.next()){var _=k.value;if(_===void 0)return Ve(g,S);var V=typeof _=="string"?{target:_}:_,h=V.target,f=V.actions,C=f===void 0?[]:f,I=V.cond,D=I===void 0?function(){return!0}:I,A=h===void 0,v=h??g,U=e.states[v];if(D(S,m)){var O=ke(Le((A?Se(C):[].concat(y.exit,C,U.entry).filter(function(b){return b})).map(function(b){return Ne(b,s._options.actions)}),S,m),3),Z=O[0],Ee=O[1],pe=O[2],se=h??g;return{value:se,context:Ee,actions:Z,changed:h!==g||Z.length>0||pe,matches:ce(se)}}}}catch(b){c={error:b}}finally{try{k&&!k.done&&(l=T.return)&&l.call(T)}finally{if(c)throw c.error}}}return Ve(g,S)}};return s}var Oe=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function St(e){var t=e.initialState,r=j.NotStarted,n=new Set,o={_machine:e,send:function(s){r===j.Running&&(t=e.transition(t,s),Oe(t,$e(s)),n.forEach(function(i){return i(t)}))},subscribe:function(s){return n.add(s),s(t),{unsubscribe:function(){return n.delete(s)}}},start:function(s){if(s){var i=typeof s=="object"?s:{context:e.config.context,value:s};t={value:i.value,actions:[],context:i.context,matches:ce(i.value)}}else t=e.initialState;return r=j.Running,Oe(t,Ue),o},stop:function(){return r=j.Stopped,n.clear(),o},get state(){return t},get status(){return r}};return o}var Tt=u.useLayoutEffect,Te={},_t={get exports(){return Te},set exports(e){Te=e}},Re={},_e={},At={get exports(){return _e},set exports(e){_e=e}},xe={};/**
15
15
  * @license React
16
16
  * use-sync-external-store-shim.production.min.js
17
17
  *
@@ -19,15 +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 xe;function Pt(){if(xe)return Ce;xe=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,o=e.useEffect,u=e.useLayoutEffect,i=e.useDebugValue;function a(d,p){var E=p(),g=n({inst:{value:E,getSnapshot:p}}),b=g[0].inst,_=g[1];return u(function(){b.value=E,b.getSnapshot=p,y(b)&&_({inst:b})},[d,E,p]),o(function(){return y(b)&&_({inst:b}),d(function(){y(b)&&_({inst:b})})},[d]),i(E),E}function y(d){var p=d.getSnapshot;d=d.value;try{var E=p();return!r(d,E)}catch{return!0}}function f(d,p){return p()}var l=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:a;return Ce.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:l,Ce}var Te={};/**
23
- * @license React
24
- * use-sync-external-store-shim.development.js
25
- *
26
- * Copyright (c) Facebook, Inc. and its affiliates.
27
- *
28
- * This source code is licensed under the MIT license found in the
29
- * LICENSE file in the root directory of this source tree.
30
- */var qe;function Lt(){return qe||(qe=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(T){{for(var c=arguments.length,h=new Array(c>1?c-1:0),m=1;m<c;m++)h[m-1]=arguments[m];n("error",T,h)}}function n(T,c,h){{var m=t.ReactDebugCurrentFrame,A=m.getStackAddendum();A!==""&&(c+="%s",h=h.concat([A]));var I=h.map(function(S){return String(S)});I.unshift("Warning: "+c),Function.prototype.apply.call(console[T],console,I)}}function o(T,c){return T===c&&(T!==0||1/T===1/c)||T!==T&&c!==c}var u=typeof Object.is=="function"?Object.is:o,i=e.useState,a=e.useEffect,y=e.useLayoutEffect,f=e.useDebugValue,l=!1,d=!1;function p(T,c,h){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 A=c();u(m,A)||(r("The result of getSnapshot should be cached to avoid an infinite loop"),d=!0)}var I=i({inst:{value:m,getSnapshot:c}}),S=I[0].inst,D=I[1];return y(function(){S.value=m,S.getSnapshot=c,E(S)&&D({inst:S})},[T,m,c]),a(function(){E(S)&&D({inst:S});var U=function(){E(S)&&D({inst:S})};return T(U)},[T]),f(m),m}function E(T){var c=T.getSnapshot,h=T.value;try{var m=c();return!u(h,m)}catch{return!0}}function g(T,c,h){return c()}var b=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",_=!b,P=_?g:p,w=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:P;Te.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Te}var Fe;function Be(){return Fe||(Fe=1,function(e){process.env.NODE_ENV==="production"?e.exports=Pt():e.exports=Lt()}(Ot)),de}/**
22
+ */var J=u;function vt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var bt=typeof Object.is=="function"?Object.is:vt,wt=J.useState,It=J.useEffect,Dt=J.useLayoutEffect,Pt=J.useDebugValue;function kt(e,t){var r=t(),n=wt({inst:{value:r,getSnapshot:t}}),o=n[0].inst,s=n[1];return Dt(function(){o.value=r,o.getSnapshot=t,Ae(o)&&s({inst:o})},[e,r,t]),It(function(){return Ae(o)&&s({inst:o}),e(function(){Ae(o)&&s({inst:o})})},[e]),Pt(r),r}function Ae(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!bt(e,r)}catch{return!0}}function Ut(e,t){return t()}var Nt=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Ut:kt;xe.useSyncExternalStore=J.useSyncExternalStore!==void 0?J.useSyncExternalStore:Nt,function(e){e.exports=xe}(At);/**
31
23
  * @license React
32
24
  * use-sync-external-store-shim/with-selector.production.min.js
33
25
  *
@@ -35,15 +27,7 @@
35
27
  *
36
28
  * This source code is licensed under the MIT license found in the
37
29
  * LICENSE file in the root directory of this source tree.
38
- */var He;function Ut(){if(He)return ve;He=1;var e=s,t=Be();function r(f,l){return f===l&&(f!==0||1/f===1/l)||f!==f&&l!==l}var n=typeof Object.is=="function"?Object.is:r,o=t.useSyncExternalStore,u=e.useRef,i=e.useEffect,a=e.useMemo,y=e.useDebugValue;return ve.useSyncExternalStoreWithSelector=function(f,l,d,p,E){var g=u(null);if(g.current===null){var b={hasValue:!1,value:null};g.current=b}else b=g.current;g=a(function(){function P(m){if(!w){if(w=!0,T=m,m=p(m),E!==void 0&&b.hasValue){var A=b.value;if(E(A,m))return c=A}return c=m}if(A=c,n(T,m))return A;var I=p(m);return E!==void 0&&E(A,I)?A:(T=m,c=I)}var w=!1,T,c,h=d===void 0?null:d;return[function(){return P(l())},h===null?void 0:function(){return P(h())}]},[l,d,p,E]);var _=o(f,g[0],g[1]);return i(function(){b.hasValue=!0,b.value=_},[_]),y(_),_},ve}var Ae={};/**
39
- * @license React
40
- * use-sync-external-store-shim/with-selector.development.js
41
- *
42
- * Copyright (c) Facebook, Inc. and its affiliates.
43
- *
44
- * This source code is licensed under the MIT license found in the
45
- * LICENSE file in the root directory of this source tree.
46
- */var je;function kt(){return je||(je=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=Be();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,o=t.useSyncExternalStore,u=e.useRef,i=e.useEffect,a=e.useMemo,y=e.useDebugValue;function f(l,d,p,E,g){var b=u(null),_;b.current===null?(_={hasValue:!1,value:null},b.current=_):_=b.current;var P=a(function(){var h=!1,m,A,I=function(V){if(!h){h=!0,m=V;var $=E(V);if(g!==void 0&&_.hasValue){var G=_.value;if(g(G,$))return A=G,G}return A=$,$}var re=m,F=A;if(n(re,V))return F;var O=E(V);return g!==void 0&&g(F,O)?F:(m=V,A=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=P[0],T=P[1],c=o(l,w,T);return i(function(){_.hasValue=!0,_.value=c},[c]),y(c),c}Ae.useSyncExternalStoreWithSelector=f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()),Ae}(function(e){process.env.NODE_ENV==="production"?e.exports=Ut():e.exports=kt()})(Dt);function Nt(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),o,u=[],i;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)u.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return u};function Vt(e){return e}var Mt=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),o=n[0];e!==o&&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 u=Ge(Nt(function(){var f=[],l=wt(Re(e.config,t||e._options)),d=l.send;return l.send=function(p){if(l.status===Y.NotStarted){f.push(p);return}d(p),r.current=l.state},[l,f]}),2),i=u[0],a=u[1];It(function(){t&&(i._machine._options=t)});var y=xt(i);return s.useEffect(function(){return i.start(r.current),a.forEach(i.send),r.current=i.state,function(){i.stop()}},[]),y}var $t=function(e,t){return t.changed===!1};function xt(e){var t=s.useCallback(function(){return Mt(e)},[e]),r=s.useCallback(function(o){var u=e.subscribe(o).unsubscribe;return u},[e]),n=Se.useSyncExternalStoreWithSelector(r,t,t,Vt,$t);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 qt=e=>`
30
+ */var le=u,$t=_e;function Vt(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Lt=typeof Object.is=="function"?Object.is:Vt,Mt=$t.useSyncExternalStore,Ot=le.useRef,Rt=le.useEffect,xt=le.useMemo,qt=le.useDebugValue;Re.useSyncExternalStoreWithSelector=function(e,t,r,n,o){var s=Ot(null);if(s.current===null){var i={hasValue:!1,value:null};s.current=i}else i=s.current;s=xt(function(){function c(m){if(!l){if(l=!0,d=m,m=n(m),o!==void 0&&i.hasValue){var y=i.value;if(o(y,m))return g=y}return g=m}if(y=g,Lt(d,m))return y;var P=n(m);return o!==void 0&&o(y,P)?y:(d=m,g=P)}var l=!1,d,g,S=r===void 0?null:r;return[function(){return c(t())},S===null?void 0:function(){return c(S())}]},[t,r,n,o]);var a=Mt(e,s[0],s[1]);return Rt(function(){i.hasValue=!0,i.value=a},[a]),qt(a),a},function(e){e.exports=Re}(_t);function Ft(e){var t=W.useRef();return t.current||(t.current={v:e()}),t.current.v}var Bt=globalThis&&globalThis.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],i;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(i)throw i.error}}return s};function jt(e){return e}var Ht=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function Yt(e,t){var r=u.useRef(),n=Bt(Ft(function(){var a=[],c=St(Me(e.config,t||e._options)),l=c.send;return c.send=function(d){if(c.status===j.NotStarted){a.push(d);return}l(d),r.current=c.state},[c,a]}),2),o=n[0],s=n[1];Tt(function(){t&&(o._machine._options=t)});var i=Zt(o);return u.useEffect(function(){return o.start(r.current),s.forEach(o.send),r.current=o.state,function(){o.stop()}},[]),i}var Gt=function(e,t){return t.changed===!1};function Zt(e){var t=u.useCallback(function(){return Ht(e)},[e]),r=u.useCallback(function(o){var s=e.subscribe(o).unsubscribe;return s},[e]),n=Te.useSyncExternalStoreWithSelector(r,t,t,jt,Gt);return[n,e.send,e]}function F(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 Qt=e=>`
47
31
  mutation CartLineAdd(
48
32
  $cartId: ID!
49
33
  $lines: [CartLineInput!]!
@@ -58,7 +42,7 @@
58
42
  }
59
43
 
60
44
  ${e}
61
- `,Ft=e=>`
45
+ `,Wt=e=>`
62
46
  mutation CartCreate(
63
47
  $input: CartInput!
64
48
  $numCartLines: Int = 250
@@ -72,7 +56,7 @@
72
56
  }
73
57
 
74
58
  ${e}
75
- `,Bt=e=>`
59
+ `,zt=e=>`
76
60
  mutation CartLineRemove(
77
61
  $cartId: ID!
78
62
  $lines: [ID!]!
@@ -87,7 +71,7 @@
87
71
  }
88
72
 
89
73
  ${e}
90
- `,Ht=e=>`
74
+ `,Jt=e=>`
91
75
  mutation CartLineUpdate(
92
76
  $cartId: ID!
93
77
  $lines: [CartLineUpdateInput!]!
@@ -102,7 +86,7 @@
102
86
  }
103
87
 
104
88
  ${e}
105
- `,jt=e=>`
89
+ `,Kt=e=>`
106
90
  mutation CartNoteUpdate(
107
91
  $cartId: ID!
108
92
  $note: String
@@ -117,7 +101,7 @@
117
101
  }
118
102
 
119
103
  ${e}
120
- `,Gt=e=>`
104
+ `,Xt=e=>`
121
105
  mutation CartBuyerIdentityUpdate(
122
106
  $cartId: ID!
123
107
  $buyerIdentity: CartBuyerIdentityInput!
@@ -132,7 +116,7 @@
132
116
  }
133
117
 
134
118
  ${e}
135
- `,Yt=e=>`
119
+ `,er=e=>`
136
120
  mutation CartAttributesUpdate(
137
121
  $attributes: [AttributeInput!]!
138
122
  $cartId: ID!
@@ -147,7 +131,7 @@
147
131
  }
148
132
 
149
133
  ${e}
150
- `,Wt=e=>`
134
+ `,tr=e=>`
151
135
  mutation CartDiscountCodesUpdate(
152
136
  $cartId: ID!
153
137
  $discountCodes: [String!]
@@ -162,7 +146,7 @@
162
146
  }
163
147
 
164
148
  ${e}
165
- `,Zt=e=>`
149
+ `,rr=e=>`
166
150
  query CartQuery(
167
151
  $id: ID!
168
152
  $numCartLines: Int = 250
@@ -174,7 +158,7 @@
174
158
  }
175
159
 
176
160
  ${e}
177
- `,zt=`
161
+ `,nr=`
178
162
  fragment CartFragment on Cart {
179
163
  id
180
164
  checkoutUrl
@@ -274,7 +258,7 @@
274
258
  width
275
259
  height
276
260
  }
277
- `,ne="2023-01";function Kt(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o,contentType:u}=e;return o!==ne&&Qt(`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: "${o}"; expected version "${ne}"`),{getShopifyDomain(i){return(i==null?void 0:i.storeDomain)??t},getStorefrontApiUrl(i){const a=(i==null?void 0:i.storeDomain)??t;return`${a}${a.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(i){if(!r&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((i==null?void 0:i.contentType)??u)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(i==null?void 0:i.privateStorefrontToken)??r??"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){if(!n&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const a=(i==null?void 0:i.contentType)??u??"json";return Ye(a,o,(i==null?void 0:i.publicStorefrontToken)??n??"")}}}function Ye(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 We=new Set,Qt=e=>{We.has(e)||(console.warn(e),We.add(e))},Ze=s.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ne,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function Jt({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!==ne&&console.warn(`<ShopifyProvider/>: This version of Hydrogen React is built for Shopify's Storefront API version ${ne}, 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(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return Ye(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const u=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${u}${u.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return s.createElement(Ze.Provider,{value:r},e)}function fe(){const e=s.useContext(Ze);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const be="shopifyCartId",Xt="Shopify-Storefront-Id",er="Shopify-Storefront-Y",tr="Shopify-Storefront-S",W="_shopify_y",Z="_shopify_s";var rr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function nr(e){let t={},r,n,o=0,u=e.split(/;\s*/g),i,a;for(;o<u.length;o++)if(n=u[o],r=n.indexOf("="),~r){if(i=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{}rr.has(n=i.toLowerCase())?n==="expires"?t.expires=new Date(a):n==="max-age"?t.maxage=+a:t[n]=a:t[i]=a}else(i=n.trim().toLowerCase())&&(i==="httponly"||i==="secure")&&(t[i]=!0);return t}function or(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,o=>{const u=r[n]%16,i=o==="x"?u:u&3|8;return n++,i.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=nr(e);return{[W]:t[W]||"",[Z]:t[Z]||""}}function ir(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=fe();return s.useCallback(({query:n,variables:o})=>{const u=t({contentType:"json"});e&&(u[Xt]=e);const i=he(document.cookie);return u[er]=i[W],u[tr]=i[Z],fetch(r(),{method:"POST",headers:u,body:JSON.stringify({query:n.toString(),variables:o})}).then(a=>a.json()).catch(a=>({data:void 0,errors:a==null?void 0:a.toString()}))},[t,e,r])}function ur({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=ir(),o=s.useCallback(E=>n({query:Zt(t),variables:{id:E,numCartLines:e,country:r}}),[n,t,e,r]),u=s.useCallback(E=>n({query:Ft(t),variables:{input:E,numCartLines:e,country:r}}),[t,r,n,e]),i=s.useCallback((E,g)=>n({query:qt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),a=s.useCallback((E,g)=>n({query:Ht(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),y=s.useCallback((E,g)=>n({query:Bt(t),variables:{cartId:E,lines:g,numCartLines:e,country:r}}),[t,r,n,e]),f=s.useCallback((E,g)=>n({query:jt(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:Yt(t),variables:{cartId:E,attributes:g,numCartLines:e,country:r}}),[t,r,n,e]),p=s.useCallback((E,g)=>n({query:Wt(t),variables:{cartId:E,discountCodes:g,numCartLines:e,country:r}}),[t,r,n,e]);return s.useMemo(()=>({cartFetch:o,cartCreate:u,cartLineAdd:i,cartLineUpdate:a,cartLineRemove:y,noteUpdate:f,buyerIdentityUpdate:l,cartAttributesUpdate:d,discountCodesUpdate:p,cartFragment:t}),[o,u,i,a,y,f,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 o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.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 o;return(o=n==null?void 0:n.payload)==null?void 0:o.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 oe={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[J({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>we(t.payload.cart)})]}},Ke={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 sr(e){return Re({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&we(e)},states:{uninitialized:{on:oe},cartCompleted:{on:oe},initializationError:{on:oe},idle:{on:{...oe,...Ke}},error:{on:{...oe,...Ke}},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 cr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:u,countryCode:i}){const{cartFetch:a,cartCreate:y,cartLineAdd:f,cartLineUpdate:l,cartLineRemove:d,noteUpdate:p,buyerIdentityUpdate:E,cartAttributesUpdate:g,discountCodesUpdate:b}=ur({numCartLines:e,cartFragment:u,countryCode:i}),_=s.useMemo(()=>sr(o),[o]),[P,w,T]=Rt(_,{actions:{cartFetchAction:async(c,h)=>{var S;if(h.type!=="CART_FETCH")return;const{data:m,errors:A}=await a((S=h==null?void 0:h.payload)==null?void 0:S.cartId),I=q(h,m==null?void 0:m.cart,A);w(I)},cartCreateAction:async(c,h)=>{var S;if(h.type!=="CART_CREATE")return;const{data:m,errors:A}=await y(h==null?void 0:h.payload),I=q(h,(S=m==null?void 0:m.cartCreate)==null?void 0:S.cart,A);w(I)},cartLineAddAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_ADD"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await f(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesAdd)==null?void 0:D.cart,A);w(I)},cartLineUpdateAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await l(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesUpdate)==null?void 0:D.cart,A);w(I)},cartLineRemoveAction:async(c,h)=>{var S,D;if(h.type!=="CARTLINE_REMOVE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await d(c.cart.id,h.payload.lines),I=q(h,(D=m==null?void 0:m.cartLinesRemove)==null?void 0:D.cart,A);w(I)},noteUpdateAction:async(c,h)=>{var S,D;if(h.type!=="NOTE_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await p(c.cart.id,h.payload.note),I=q(h,(D=m==null?void 0:m.cartNoteUpdate)==null?void 0:D.cart,A);w(I)},buyerIdentityUpdateAction:async(c,h)=>{var S,D;if(h.type!=="BUYER_IDENTITY_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await E(c.cart.id,h.payload.buyerIdentity),I=q(h,(D=m==null?void 0:m.cartBuyerIdentityUpdate)==null?void 0:D.cart,A);w(I)},cartAttributesUpdateAction:async(c,h)=>{var S,D;if(h.type!=="CART_ATTRIBUTES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await g(c.cart.id,h.payload.attributes),I=q(h,(D=m==null?void 0:m.cartAttributesUpdate)==null?void 0:D.cart,A);w(I)},discountCodesUpdateAction:async(c,h)=>{var S,D;if(h.type!=="DISCOUNT_CODES_UPDATE"||!((S=c==null?void 0:c.cart)!=null&&S.id))return;const{data:m,errors:A}=await b(c.cart.id,h.payload.discountCodes),I=q(h,(D=m==null?void 0:m.cartDiscountCodesUpdate)==null?void 0:D.cart,A);w(I)},...t&&{onCartActionEntry:(c,h)=>{lr(h)&&t(c,h)}},...r&&{onCartActionOptimisticUI:J((c,h)=>r(c,h))},...n&&{onCartActionComplete:(c,h)=>{dr(h)&&n(c,h)}}}});return s.useMemo(()=>[P,w,T],[P,w,T])}function we(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:we(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function lr(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 dr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Qe=s.createContext(null);function X(){const e=s.useContext(Qe);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function fr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:u,onNoteUpdate:i,onBuyerIdentityUpdate:a,onAttributesUpdate:y,onDiscountCodesUpdate:f,onCreateComplete:l,onLineAddComplete:d,onLineRemoveComplete:p,onLineUpdateComplete:E,onNoteUpdateComplete:g,onBuyerIdentityUpdateComplete:b,onAttributesUpdateComplete:_,onDiscountCodesUpdateComplete:P,data:w,cartFragment:T=zt,customerAccessToken:c,countryCode:h="US"}){var pt,_t,St,vt,Ct,Tt,At;h&&(h=h.toUpperCase());const[m,A]=s.useState(h),[I,S]=s.useState(c),D=s.useRef(!1);(m!==h||I!==c)&&(A(h),S(c),D.current=!1);const[U,V]=cr({numCartLines:t,data:w,cartFragment:T,countryCode:h,onCartActionEntry(C,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 o==null?void 0:o();case"CARTLINE_UPDATE":return u==null?void 0:u();case"NOTE_UPDATE":return i==null?void 0:i();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return y==null?void 0:y();case"DISCOUNT_CODES_UPDATE":return f==null?void 0:f()}}catch(M){console.error("Cart entry action failed",M)}},onCartActionOptimisticUI(C,k){var M,B,N,ce;if(!C.cart)return{...C};switch(k.type){case"CARTLINE_REMOVE":return{...C,cart:{...C.cart,lines:(B=(M=C==null?void 0:C.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{...C,cart:{...C.cart,lines:(ce=(N=C==null?void 0:C.cart)==null?void 0:N.lines)==null?void 0:ce.map(R=>{const Pe=k.payload.lines.find(({id:fn})=>fn===(R==null?void 0:R.id));return Pe&&Pe.quantity?{...R,quantity:Pe.quantity}:R})}}}return{...C}},onCartActionComplete(C,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 gr(C,M)&&(D.current=!0),b==null?void 0:b();case"CART_ATTRIBUTES_UPDATE":return _==null?void 0:_();case"DISCOUNT_CODES_UPDATE":return P==null?void 0:P()}}}catch(B){console.error("onCartActionComplete failed",B)}}}),$=s.useRef(!1),G=U.matches("cartCompleted"),re=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&h!==((St=(_t=(pt=U==null?void 0:U.context)==null?void 0:pt.cart)==null?void 0:_t.buyerIdentity)==null?void 0:St.countryCode)&&!U.context.errors,F=s.useRef(!1);s.useEffect(()=>{if(!$.current&&!F.current){if(!w&&Ie("localStorage")){F.current=!0;try{const C=window.localStorage.getItem(be);C&&V({type:"CART_FETCH",payload:{cartId:C}})}catch(C){console.warn("error fetching cartId"),console.warn(C)}}$.current=!0}},[w,$,V]),s.useEffect(()=>{!re||D.current||V({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:h,customerAccessToken:c}}})},[h,c,re,D,V]);const O=s.useCallback(C=>{if(!$.current)return console.warn("Cart isn't ready yet");V(C)},[V]);s.useEffect(()=>{var C,k,M;if((k=(C=U==null?void 0:U.context)==null?void 0:C.cart)!=null&&k.id&&Ie("localStorage"))try{window.localStorage.setItem(be,(M=U.context.cart)==null?void 0:M.id)}catch(B){console.warn("Failed to save cartId to localStorage",B)}},[(Ct=(vt=U==null?void 0:U.context)==null?void 0:vt.cart)==null?void 0:Ct.id]),s.useEffect(()=>{if(G&&Ie("localStorage"))try{window.localStorage.removeItem(be)}catch(C){console.warn("Failed to delete cartId from localStorage",C)}},[G]);const K=s.useCallback(C=>{var k,M;h&&!((k=C.buyerIdentity)!=null&&k.countryCode)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.countryCode=h),c&&!((M=C.buyerIdentity)!=null&&M.customerAccessToken)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.customerAccessToken=c),O({type:"CART_CREATE",payload:C})},[h,c,O]),L=hr(U),pe=s.useMemo(()=>{var C,k,M,B;return{...((C=L==null?void 0:L.context)==null?void 0:C.cart)??{lines:[],attributes:[]},status:yr(L.value),error:(k=L==null?void 0:L.context)==null?void 0:k.errors,totalQuantity:((B=(M=L==null?void 0:L.context)==null?void 0:M.cart)==null?void 0:B.totalQuantity)??0,cartCreate:K,linesAdd(N){var ce,R;(R=(ce=L==null?void 0:L.context)==null?void 0:ce.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:T}},[K,(Tt=L==null?void 0:L.context)==null?void 0:Tt.cart,(At=L==null?void 0:L.context)==null?void 0:At.errors,L.value,T,O]);return s.createElement(Qe.Provider,{value:pe},e)}function yr(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 hr(e){const[t,r]=s.useTransition(),[n,o]=s.useState(e),u=s.useRef(!1);t&&(u.current=!0);const i=s.useRef(!1);return!t&&u.current&&(i.current=!0),s.useEffect(()=>{r(()=>{i.current||o(e)})},[e]),i.current?e:n}function Ie(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 gr(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 Je=s.createContext(null);function mr({children:e,data:t,initialVariantId:r}){const n=s.useMemo(()=>H(t.variants??{}),[t.variants]);if(!pr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=s.useMemo(()=>Er(n),[n]),[u,i]=s.useState(()=>tt(r,n)),[a,y]=s.useState(()=>rt(u));s.useEffect(()=>{const _=tt(r,n);i(_),y(rt(_))},[r,n]);const f=s.useCallback((_,P)=>{y(w=>{const T={...w,[_]:P};return i(et(n,T)),T})},[y,n]),l=s.useCallback((_,P)=>{const w=et(n,{...a,[_]:P});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 _,P;if(!(!u||!p)){if(!((_=u.sellingPlanAllocations)!=null&&_.nodes)&&!((P=u.sellingPlanAllocations)!=null&&P.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return H(u.sellingPlanAllocations).find(w=>{var T;return((T=w==null?void 0:w.sellingPlan)==null?void 0:T.id)===p.id})}},[u,p]),b=s.useMemo(()=>({variants:n,variantsConnection:t.variants,options:o,selectedVariant:u,setSelectedVariant:i,selectedOptions:a,setSelectedOption:f,setSelectedOptions:y,isOptionInStock:l,selectedSellingPlan:p,setSelectedSellingPlan:E,selectedSellingPlanAllocation:g,sellingPlanGroups:d,sellingPlanGroupsConnection:t.sellingPlanGroups}),[l,o,t.sellingPlanGroups,t.variants,a,p,g,u,d,f,n]);return s.createElement(Je.Provider,{value:b},e)}function Xe(){const e=s.useContext(Je);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function et(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(o=>Object.entries(t).every(([u,i])=>{var a;return(a=o==null?void 0:o.selectedOptions)==null?void 0:a.some(y=>(y==null?void 0:y.name)===u&&(y==null?void 0:y.value)===i)}))}function Er(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(u=>{r[(u==null?void 0:u.name)??""]=r[(u==null?void 0:u.name)??""]||new Set,r[(u==null?void 0:u.name)??""].add((u==null?void 0:u.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function tt(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 rt(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 pr(e){return!(!e||!Array.isArray(e))}function ge(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:u,...i}=e,a=s.useCallback(f=>{if(r){const l=r(f);if(typeof l=="boolean"&&l===!1||f!=null&&f.defaultPrevented)return}n==null||n(f)},[n,r]),y=t||"button";return s.createElement(y,{ref:u,onClick:a,...i},o)}function _r(e){const[t,r]=s.useState(!1),{variantId:n,quantity:o=1,attributes:u,sellingPlanId:i,onClick:a,children:y,accessibleAddingToCartLabel:f,...l}=e,{status:d,linesAdd:p}=X(),{selectedVariant:E}=Xe(),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:o,merchandiseId:g||"",attributes:u,sellingPlanId:i}])},[p,o,g,u,i]);return Q.createElement(Q.Fragment,null,Q.createElement(ge,{...l,disabled:b,onClick:a,defaultOnClick:_},y),f?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?f:null):null)}const De={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART"},me={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"},nt={hydrogen:"hydrogen",headless:"headless"},ot={hydrogen:"6167201",headless:"12875497473"};function ee(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function j(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,o=r[1]??null;return{id:n,resource:o}}function z(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Sr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const vr="trekkie_storefront_page_view/1.4",Cr="myshopify.dev";function Tr(e){const t=e,{id:r,resource:n}=j(t.resourceId),o=n?n.toLowerCase():void 0;return[ee(vr,z({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},Ar(t)))]}function Ar(e){return{appClientId:e.shopifySalesChannel?ot[e.shopifySalesChannel]:ot.headless,isMerchantRequest:br(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(j(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function br(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(Cr)!==-1||t==="localhost"}const ae="custom_storefront_customer_tracking/1.0",wr="page_rendered",Ir="collection_page_rendered",Dr="product_page_rendered",Or="product_added_to_cart",Pr="search_submitted";function Lr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(ee(ae,z({event_name:wr,...r},ie(t)))),n){case me.collection:o.push(ee(ae,z({event_name:Ir,...r,collection_name:t.collectionHandle},ie(t))));break;case me.product:o.push(ee(ae,z({event_name:Dr,...r,products:at(t.products),total_value:t.totalValue},ie(t))));break;case me.search:o.push(ee(ae,z({event_name:Pr,...r,search_string:t.searchString},ie(t))));break}return o}function Ur(e){const t=e,r=j(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[ee(ae,z({event_name:Or,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:at(t.products)},ie(t)))]}function ie(e){return{source:e.shopifySalesChannel||nt.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(j(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(j(t.productGid).id),variant_id:parseInt(j(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 kr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===De.PAGE_VIEW){const u=n;o=o.concat(Tr(u),Lr(u))}else r===De.ADD_TO_CART&&(o=o.concat(Ur(n)));return o.length?Nr(o,t):Promise.resolve()}const it="sendShopifyAnalytics request is unsuccessful";function Nr(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(u=>{u.status!==200&&console.error(it,`
261
+ `,te="2023-01";function or(e){const{storeDomain:t,privateStorefrontToken:r,publicStorefrontToken:n,storefrontApiVersion:o,contentType:s}=e;return o!==te&&ar(`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: "${o}"; expected version "${te}"`),{getShopifyDomain(i){return(i==null?void 0:i.storeDomain)??t},getStorefrontApiUrl(i){const a=(i==null?void 0:i.storeDomain)??t;return`${a}${a.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??o}/graphql.json`},getPrivateTokenHeaders(i){if(!r&&!(i!=null&&i.privateStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'privateStorefrontToken' while using 'getPrivateTokenHeaders()'");return{"content-type":((i==null?void 0:i.contentType)??s)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":o,"Shopify-Storefront-Private-Token":(i==null?void 0:i.privateStorefrontToken)??r??"",...i!=null&&i.buyerIp?{"Shopify-Storefront-Buyer-IP":i.buyerIp}:{}}},getPublicTokenHeaders(i){if(!n&&!(i!=null&&i.publicStorefrontToken))throw new Error("StorefrontClient: You did not pass in a 'publicStorefrontToken' while using 'getPublicTokenHeaders()'");const a=(i==null?void 0:i.contentType)??s??"json";return qe(a,o,(i==null?void 0:i.publicStorefrontToken)??n??"")}}}function qe(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 Fe=new Set,ar=e=>{Fe.has(e)||(console.warn(e),Fe.add(e))},Be=u.createContext({storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:te,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}});function ir({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=u.useMemo(()=>{function n(o){return(o==null?void 0:o.storeDomain)??t.storeDomain}return{...t,getPublicTokenHeaders(o){return qe(o.contentType,t.storefrontApiVersion,o.storefrontToken??t.storefrontToken)},getShopifyDomain:n,getStorefrontApiUrl(o){const s=n({storeDomain:(o==null?void 0:o.storeDomain)??t.storeDomain});return`${s}${s.endsWith("/")?"":"/"}api/${(o==null?void 0:o.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return u.createElement(Be.Provider,{value:r},e)}function de(){const e=u.useContext(Be);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const ve="shopifyCartId",sr="Shopify-Storefront-Id",ur="Shopify-Storefront-Y",cr="Shopify-Storefront-S",H="_shopify_y",Y="_shopify_s";var lr=new Set(["domain","path","max-age","expires","samesite","secure","httponly"]);function dr(e){let t={},r,n,o=0,s=e.split(/;\s*/g),i,a;for(;o<s.length;o++)if(n=s[o],r=n.indexOf("="),~r){if(i=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{}lr.has(n=i.toLowerCase())?n==="expires"?t.expires=new Date(a):n==="max-age"?t.maxage=+a:t[n]=a:t[i]=a}else(i=n.trim().toLowerCase())&&(i==="httponly"||i==="secure")&&(t[i]=!0);return t}function fr(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 je="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function fe(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=je.replace(/[x]/g,o=>{const s=r[n]%16,i=o==="x"?s:s&3|8;return n++,i.toString(16)}).toUpperCase()}catch{e=je.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${yr()}-${e}`}function yr(){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=dr(e);return{[H]:t[H]||"",[Y]:t[Y]||""}}function hr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r}=de();return u.useCallback(({query:n,variables:o})=>{const s=t({contentType:"json"});e&&(s[sr]=e);const i=ye(document.cookie);return s[ur]=i[H],s[cr]=i[Y],fetch(r(),{method:"POST",headers:s,body:JSON.stringify({query:n.toString(),variables:o})}).then(a=>a.json()).catch(a=>({data:void 0,errors:a==null?void 0:a.toString()}))},[t,e,r])}function gr({numCartLines:e,cartFragment:t,countryCode:r="US"}){const n=hr(),o=u.useCallback(m=>n({query:rr(t),variables:{id:m,numCartLines:e,country:r}}),[n,t,e,r]),s=u.useCallback(m=>n({query:Wt(t),variables:{input:m,numCartLines:e,country:r}}),[t,r,n,e]),i=u.useCallback((m,y)=>n({query:Qt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),a=u.useCallback((m,y)=>n({query:Jt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),c=u.useCallback((m,y)=>n({query:zt(t),variables:{cartId:m,lines:y,numCartLines:e,country:r}}),[t,r,n,e]),l=u.useCallback((m,y)=>n({query:Kt(t),variables:{cartId:m,note:y,numCartLines:e,country:r}}),[n,t,e,r]),d=u.useCallback((m,y)=>n({query:Xt(t),variables:{cartId:m,buyerIdentity:y,numCartLines:e,country:r}}),[t,r,n,e]),g=u.useCallback((m,y)=>n({query:er(t),variables:{cartId:m,attributes:y,numCartLines:e,country:r}}),[t,r,n,e]),S=u.useCallback((m,y)=>n({query:tr(t),variables:{cartId:m,discountCodes:y,numCartLines:e,country:r}}),[t,r,n,e]);return u.useMemo(()=>({cartFetch:o,cartCreate:s,cartLineAdd:i,cartLineUpdate:a,cartLineRemove:c,noteUpdate:l,buyerIdentityUpdate:d,cartAttributesUpdate:g,discountCodesUpdate:S,cartFragment:t}),[o,s,i,a,c,l,d,g,S,t])}function R(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],z({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[z({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.cart},rawCartResult:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[z({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var o;return(o=n==null?void 0:n.payload)==null?void 0:o.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:z({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:[z({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>be(t.payload.cart)})]}},He={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 mr(e){return Me({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&be(e)},states:{uninitialized:{on:re},cartCompleted:{on:re},initializationError:{on:re},idle:{on:{...re,...He}},error:{on:{...re,...He}},cartFetching:R("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:R("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:R("cartLineRemoveAction"),cartLineUpdating:R("cartLineUpdateAction"),cartLineAdding:R("cartLineAddAction"),noteUpdating:R("noteUpdateAction"),buyerIdentityUpdating:R("buyerIdentityUpdateAction"),cartAttributesUpdating:R("cartAttributesUpdateAction"),discountCodesUpdating:R("discountCodesUpdateAction")}})}function Er({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:o,cartFragment:s,countryCode:i}){const{cartFetch:a,cartCreate:c,cartLineAdd:l,cartLineUpdate:d,cartLineRemove:g,noteUpdate:S,buyerIdentityUpdate:m,cartAttributesUpdate:y,discountCodesUpdate:P}=gr({numCartLines:e,cartFragment:s,countryCode:i}),T=u.useMemo(()=>mr(o),[o]),[k,_,V]=Yt(T,{actions:{cartFetchAction:async(h,f)=>{var A;if(f.type!=="CART_FETCH")return;const{data:C,errors:I}=await a((A=f==null?void 0:f.payload)==null?void 0:A.cartId),D=x(f,C==null?void 0:C.cart,I);_(D)},cartCreateAction:async(h,f)=>{var A;if(f.type!=="CART_CREATE")return;const{data:C,errors:I}=await c(f==null?void 0:f.payload),D=x(f,(A=C==null?void 0:C.cartCreate)==null?void 0:A.cart,I);_(D)},cartLineAddAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_ADD"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await l(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesAdd)==null?void 0:v.cart,I);_(D)},cartLineUpdateAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await d(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesUpdate)==null?void 0:v.cart,I);_(D)},cartLineRemoveAction:async(h,f)=>{var A,v;if(f.type!=="CARTLINE_REMOVE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await g(h.cart.id,f.payload.lines),D=x(f,(v=C==null?void 0:C.cartLinesRemove)==null?void 0:v.cart,I);_(D)},noteUpdateAction:async(h,f)=>{var A,v;if(f.type!=="NOTE_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await S(h.cart.id,f.payload.note),D=x(f,(v=C==null?void 0:C.cartNoteUpdate)==null?void 0:v.cart,I);_(D)},buyerIdentityUpdateAction:async(h,f)=>{var A,v;if(f.type!=="BUYER_IDENTITY_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await m(h.cart.id,f.payload.buyerIdentity),D=x(f,(v=C==null?void 0:C.cartBuyerIdentityUpdate)==null?void 0:v.cart,I);_(D)},cartAttributesUpdateAction:async(h,f)=>{var A,v;if(f.type!=="CART_ATTRIBUTES_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await y(h.cart.id,f.payload.attributes),D=x(f,(v=C==null?void 0:C.cartAttributesUpdate)==null?void 0:v.cart,I);_(D)},discountCodesUpdateAction:async(h,f)=>{var A,v;if(f.type!=="DISCOUNT_CODES_UPDATE"||!((A=h==null?void 0:h.cart)!=null&&A.id))return;const{data:C,errors:I}=await P(h.cart.id,f.payload.discountCodes),D=x(f,(v=C==null?void 0:C.cartDiscountCodesUpdate)==null?void 0:v.cart,I);_(D)},...t&&{onCartActionEntry:(h,f)=>{pr(f)&&t(h,f)}},...r&&{onCartActionOptimisticUI:z((h,f)=>r(h,f))},...n&&{onCartActionComplete:(h,f)=>{Cr(f)&&n(h,f)}}}});return u.useMemo(()=>[k,_,V],[k,_,V])}function be(e){return{...e,lines:F(e==null?void 0:e.lines),note:e.note??void 0}}function x(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 pr(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 Cr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const Ye=u.createContext(null);function K(){const e=u.useContext(Ye);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Sr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:o,onLineUpdate:s,onNoteUpdate:i,onBuyerIdentityUpdate:a,onAttributesUpdate:c,onDiscountCodesUpdate:l,onCreateComplete:d,onLineAddComplete:g,onLineRemoveComplete:S,onLineUpdateComplete:m,onNoteUpdateComplete:y,onBuyerIdentityUpdateComplete:P,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:k,data:_,cartFragment:V=nr,customerAccessToken:h,countryCode:f="US"}){var ft,yt,ht,gt,mt,Et,pt;f&&(f=f.toUpperCase());const[C,I]=u.useState(f),[D,A]=u.useState(h),v=u.useRef(!1);(C!==f||D!==h)&&(I(f),A(h),v.current=!1);const[U,O]=Er({numCartLines:t,data:_,cartFragment:V,countryCode:f,onCartActionEntry(p,N){try{switch(N.type){case"CART_CREATE":return r==null?void 0:r();case"CARTLINE_ADD":return n==null?void 0:n();case"CARTLINE_REMOVE":return o==null?void 0:o();case"CARTLINE_UPDATE":return s==null?void 0:s();case"NOTE_UPDATE":return i==null?void 0:i();case"BUYER_IDENTITY_UPDATE":return a==null?void 0:a();case"CART_ATTRIBUTES_UPDATE":return c==null?void 0:c();case"DISCOUNT_CODES_UPDATE":return l==null?void 0:l()}}catch(L){console.error("Cart entry action failed",L)}},onCartActionOptimisticUI(p,N){var L,q,$,ue;if(!p.cart)return{...p};switch(N.type){case"CARTLINE_REMOVE":return{...p,cart:{...p.cart,lines:(q=(L=p==null?void 0:p.cart)==null?void 0:L.lines)==null?void 0:q.filter(M=>(M==null?void 0:M.id)&&!N.payload.lines.includes(M==null?void 0:M.id))}};case"CARTLINE_UPDATE":return{...p,cart:{...p.cart,lines:(ue=($=p==null?void 0:p.cart)==null?void 0:$.lines)==null?void 0:ue.map(M=>{const Pe=N.payload.lines.find(({id:Sn})=>Sn===(M==null?void 0:M.id));return Pe&&Pe.quantity?{...M,quantity:Pe.quantity}:M})}}}return{...p}},onCartActionComplete(p,N){const L=N.payload.cartActionEvent;try{switch(N.type){case"RESOLVE":switch(L.type){case"CART_CREATE":return d==null?void 0:d();case"CARTLINE_ADD":return g==null?void 0:g();case"CARTLINE_REMOVE":return S==null?void 0:S();case"CARTLINE_UPDATE":return m==null?void 0:m();case"NOTE_UPDATE":return y==null?void 0:y();case"BUYER_IDENTITY_UPDATE":return Ar(p,L)&&(v.current=!0),P==null?void 0:P();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return k==null?void 0:k()}}}catch(q){console.error("onCartActionComplete failed",q)}}}),Z=u.useRef(!1),Ee=U.matches("cartCompleted"),pe=(U.value==="idle"||U.value==="error"||U.value==="cartCompleted")&&f!==((ht=(yt=(ft=U==null?void 0:U.context)==null?void 0:ft.cart)==null?void 0:yt.buyerIdentity)==null?void 0:ht.countryCode)&&!U.context.errors,se=u.useRef(!1);u.useEffect(()=>{if(!Z.current&&!se.current){if(!_&&we("localStorage")){se.current=!0;try{const p=window.localStorage.getItem(ve);p&&O({type:"CART_FETCH",payload:{cartId:p}})}catch(p){console.warn("error fetching cartId"),console.warn(p)}}Z.current=!0}},[_,Z,O]),u.useEffect(()=>{!pe||v.current||O({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:f,customerAccessToken:h}}})},[f,h,pe,v,O]);const b=u.useCallback(p=>{if(!Z.current)return console.warn("Cart isn't ready yet");O(p)},[O]);u.useEffect(()=>{var p,N,L;if((N=(p=U==null?void 0:U.context)==null?void 0:p.cart)!=null&&N.id&&we("localStorage"))try{window.localStorage.setItem(ve,(L=U.context.cart)==null?void 0:L.id)}catch(q){console.warn("Failed to save cartId to localStorage",q)}},[(mt=(gt=U==null?void 0:U.context)==null?void 0:gt.cart)==null?void 0:mt.id]),u.useEffect(()=>{if(Ee&&we("localStorage"))try{window.localStorage.removeItem(ve)}catch(p){console.warn("Failed to delete cartId from localStorage",p)}},[Ee]);const Q=u.useCallback(p=>{var N,L;f&&!((N=p.buyerIdentity)!=null&&N.countryCode)&&(p.buyerIdentity==null&&(p.buyerIdentity={}),p.buyerIdentity.countryCode=f),h&&!((L=p.buyerIdentity)!=null&&L.customerAccessToken)&&(p.buyerIdentity==null&&(p.buyerIdentity={}),p.buyerIdentity.customerAccessToken=h),b({type:"CART_CREATE",payload:p})},[f,h,b]),w=_r(U),Ce=u.useMemo(()=>{var p,N,L,q;return{...((p=w==null?void 0:w.context)==null?void 0:p.cart)??{lines:[],attributes:[]},status:Tr(w.value),error:(N=w==null?void 0:w.context)==null?void 0:N.errors,totalQuantity:((q=(L=w==null?void 0:w.context)==null?void 0:L.cart)==null?void 0:q.totalQuantity)??0,cartCreate:Q,linesAdd($){var ue,M;(M=(ue=w==null?void 0:w.context)==null?void 0:ue.cart)!=null&&M.id?b({type:"CARTLINE_ADD",payload:{lines:$}}):Q({lines:$})},linesRemove($){b({type:"CARTLINE_REMOVE",payload:{lines:$}})},linesUpdate($){b({type:"CARTLINE_UPDATE",payload:{lines:$}})},noteUpdate($){b({type:"NOTE_UPDATE",payload:{note:$}})},buyerIdentityUpdate($){b({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:$}})},cartAttributesUpdate($){b({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:$}})},discountCodesUpdate($){b({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:$}})},cartFragment:V}},[Q,(Et=w==null?void 0:w.context)==null?void 0:Et.cart,(pt=w==null?void 0:w.context)==null?void 0:pt.errors,w.value,V,b]);return u.createElement(Ye.Provider,{value:Ce},e)}function Tr(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 _r(e){const[t,r]=u.useTransition(),[n,o]=u.useState(e),s=u.useRef(!1);t&&(s.current=!0);const i=u.useRef(!1);return!t&&s.current&&(i.current=!0),u.useEffect(()=>{r(()=>{i.current||o(e)})},[e]),i.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 Ar(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 Ge=u.createContext(null);function vr({children:e,data:t,initialVariantId:r}){const n=u.useMemo(()=>F(t.variants??{}),[t.variants]);if(!wr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const o=u.useMemo(()=>br(n),[n]),[s,i]=u.useState(()=>We(r,n)),[a,c]=u.useState(()=>ze(s));u.useEffect(()=>{const T=We(r,n);i(T),c(ze(T))},[r,n]);const l=u.useCallback((T,k)=>{c(_=>{const V={..._,[T]:k};return i(Qe(n,V)),V})},[c,n]),d=u.useCallback((T,k)=>{const _=Qe(n,{...a,[T]:k});return(_==null?void 0:_.availableForSale)??!0},[a,n]),g=u.useMemo(()=>F(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:F((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[S,m]=u.useState(void 0),y=u.useMemo(()=>{var T,k;if(!(!s||!S)){if(!((T=s.sellingPlanAllocations)!=null&&T.nodes)&&!((k=s.sellingPlanAllocations)!=null&&k.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return F(s.sellingPlanAllocations).find(_=>{var V;return((V=_==null?void 0:_.sellingPlan)==null?void 0:V.id)===S.id})}},[s,S]),P=u.useMemo(()=>({variants:n,variantsConnection:t.variants,options:o,selectedVariant:s,setSelectedVariant:i,selectedOptions:a,setSelectedOption:l,setSelectedOptions:c,isOptionInStock:d,selectedSellingPlan:S,setSelectedSellingPlan:m,selectedSellingPlanAllocation:y,sellingPlanGroups:g,sellingPlanGroupsConnection:t.sellingPlanGroups}),[d,o,t.sellingPlanGroups,t.variants,a,S,y,s,g,l,n]);return u.createElement(Ge.Provider,{value:P},e)}function Ze(){const e=u.useContext(Ge);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Qe(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(o=>Object.entries(t).every(([s,i])=>{var a;return(a=o==null?void 0:o.selectedOptions)==null?void 0:a.some(c=>(c==null?void 0:c.name)===s&&(c==null?void 0:c.value)===i)}))}function br(e){const t=e.reduce((r,n)=>{var o;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(o=n==null?void 0:n.selectedOptions)==null||o.forEach(s=>{r[(s==null?void 0:s.name)??""]=r[(s==null?void 0:s.name)??""]||new Set,r[(s==null?void 0:s.name)??""].add((s==null?void 0:s.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function We(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 ze(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 wr(e){return!(!e||!Array.isArray(e))}function he(e){const{as:t,onClick:r,defaultOnClick:n,children:o,buttonRef:s,...i}=e,a=u.useCallback(l=>{if(r){const d=r(l);if(typeof d=="boolean"&&d===!1||l!=null&&l.defaultPrevented)return}n==null||n(l)},[n,r]),c=t||"button";return u.createElement(c,{ref:s,onClick:a,...i},o)}function Ir(e){const[t,r]=u.useState(!1),{variantId:n,quantity:o=1,attributes:s,sellingPlanId:i,onClick:a,children:c,accessibleAddingToCartLabel:l,...d}=e,{status:g,linesAdd:S}=K(),{selectedVariant:m}=Ze(),y=n??(m==null?void 0:m.id)??"",P=n===null||y===""||m===null||t||d.disabled;u.useEffect(()=>{t&&g==="idle"&&r(!1)},[g,t]);const T=u.useCallback(()=>{r(!0),S([{quantity:o,merchandiseId:y||"",attributes:s,sellingPlanId:i}])},[S,o,y,s,i]);return W.createElement(W.Fragment,null,W.createElement(he,{...d,disabled:P,onClick:a,defaultOnClick:T},c),l?W.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?l:null):null)}const Ie={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"},Je={hydrogen:"hydrogen",headless:"headless"},Ke={hydrogen:"6167201",headless:"12875497473"};function X(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function B(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,o=r[1]??null;return{id:n,resource:o}}function G(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Dr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const Pr="trekkie_storefront_page_view/1.4",kr="myshopify.dev";function Ur(e){const t=e,{id:r,resource:n}=B(t.resourceId),o=n?n.toLowerCase():void 0;return[X(Pr,G({pageType:t.pageType,customerId:t.customerId,resourceType:o,resourceId:parseInt(r)},Nr(t)))]}function Nr(e){return{appClientId:e.shopifySalesChannel?Ke[e.shopifySalesChannel]:Ke.headless,isMerchantRequest:$r(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(B(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function $r(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(kr)!==-1||t==="localhost"}const ne="custom_storefront_customer_tracking/1.0",Vr="page_rendered",Lr="collection_page_rendered",Mr="product_page_rendered",Or="product_added_to_cart",Rr="search_submitted";function xr(e){const t=e,r={canonical_url:t.canonicalUrl||t.url,customer_id:t.customerId},n=t.pageType,o=[];switch(o.push(X(ne,G({event_name:Vr,...r},oe(t)))),n){case ge.collection:o.push(X(ne,G({event_name:Lr,...r,collection_name:t.collectionHandle},oe(t))));break;case ge.product:o.push(X(ne,G({event_name:Mr,...r,products:Xe(t.products),total_value:t.totalValue},oe(t))));break;case ge.search:o.push(X(ne,G({event_name:Rr,...r,search_string:t.searchString},oe(t))));break}return o}function qr(e){const t=e,r=B(t.cartId),n=r!=null&&r.id?`${r.id}`:null;return[X(ne,G({event_name:Or,customerId:t.customerId,cart_token:n,total_value:t.totalValue,products:Xe(t.products)},oe(t)))]}function oe(e){return{source:e.shopifySalesChannel||Je.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(B(e.shopId).id),currency:e.currency}}function Xe(e){return e?e.map(t=>{const r=G({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(B(t.productGid).id),variant_id:parseInt(B(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 Fr(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let o=[];if(r===Ie.PAGE_VIEW){const s=n;o=o.concat(Ur(s),xr(s))}else r===Ie.ADD_TO_CART&&(o=o.concat(qr(n)));return o.length?Br(o,t):Promise.resolve()}const et="sendShopifyAnalytics request is unsuccessful";function Br(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(s=>{s.status!==200&&console.error(et,`
278
262
 
279
- `,u.message)})}).catch(n=>{console.error(it,n)})}catch{return Promise.resolve()}}function Vr(){if(Sr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=$r(),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 Mr(){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 $r(){try{let e="PerformanceNavigationTiming",t=Mr();return t||(t=Rr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function xr(e){const{cartCreate:t,checkoutUrl:r}=X(),[n,o]=s.useState(!1),{quantity:u,variantId:i,onClick:a,attributes:y,children:f,...l}=e;s.useEffect(()=>{r&&(window.location.href=r)},[r]);const d=s.useCallback(()=>{o(!0),t({lines:[{quantity:u??1,merchandiseId:i,attributes:y}]})},[t,u,i,y]);return s.createElement(ge,{disabled:n??l.disabled,...l,onClick:a,defaultOnClick:d},f)}function qr(e){const[t,r]=s.useState(!1),{status:n,checkoutUrl:o}=X(),{children:u,...i}=e;return s.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),s.createElement(ge,{...i,disabled:t||i.disabled,onClick:()=>r(!0)},u)}function ut(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 o=parseFloat(e.amount),u=s.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),i=te(n,u),a=te(n,{...u,currencyDisplay:"name"}),y=te(n,{...u,currencyDisplay:"narrowSymbol"}),f=te(n,{...u,minimumFractionDigits:0,maximumFractionDigits:0}),l=te(n),d=te(n,{minimumFractionDigits:0,maximumFractionDigits:0}),p=g=>g.type==="currency",E=s.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(o),parts:()=>i().formatToParts(o),withoutTrailingZeros:()=>o%1===0?f().format(o):i().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?d().format(o):l().format(o),currencyName:()=>{var g;return((g=a().formatToParts(o).find(p))==null?void 0:g.value)??e.currencyCode},currencySymbol:()=>{var g;return((g=i().formatToParts(o).find(p))==null?void 0:g.value)??e.currencyCode},currencyNarrowSymbol:()=>{var g;return((g=y().formatToParts(o).find(p))==null?void 0:g.value)??""},amount:()=>i().formatToParts(o).filter(g=>["decimal","fraction","group","integer","literal"].includes(g.type)).map(g=>g.value).join("")}),[e,o,a,i,y,l,f,d]);return s.useMemo(()=>new Proxy(E,{get:(g,b)=>{var _;return(_=Reflect.get(g,b))==null?void 0:_.call(null)}}),[E])}function te(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:o,measurementSeparator:u="/",...i}){if(!Fr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=ut(e),y=t??"div";let f=a.localizedString;return(r||n)&&(r&&!n?f=a.amount:!r&&n?f=a.withoutTrailingZeros:f=a.withoutTrailingZerosAndCurrency),s.createElement(y,{...i},f,o&&o.referenceUnit&&s.createElement(s.Fragment,null,u,o.referenceUnit))}function Fr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function Br(e){const{cost:t}=X(),{amountType:r="total",children:n,...o}=e;let u;return r=="total"?u=t==null?void 0:t.totalAmount:r=="subtotal"?u=t==null?void 0:t.subtotalAmount:r=="tax"?u=t==null?void 0:t.totalTaxAmount:r=="duty"&&(u=t==null?void 0:t.totalDutyAmount),u==null?null:s.createElement(ue,{...o,data:u},n)}function Hr(e){var u,i;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const o=r==="regular"?(u=t.cost)==null?void 0:u.totalAmount:(i=t.cost)==null?void 0:i.compareAtAmountPerQuantity;return o==null?null:s.createElement(ue,{...n,data:o})}const st=s.createContext(null);function Oe(){const e=s.useContext(st);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function jr({children:e,line:t}){return s.createElement(st.Provider,{value:t},e)}function Gr(e){const t=Oe(),{as:r,...n}=e,o=r||"span";return s.createElement(o,{...n},t.quantity)}function Yr(e){const{status:t,linesRemove:r,linesUpdate:n}=X(),o=Oe(),{children:u,adjust:i,onClick:a,...y}=e,f=s.useCallback(()=>{if(i==="remove"){r([(o==null?void 0:o.id)??""]);return}const l=i==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(l<=0){r([(o==null?void 0:o.id)??""]);return}const d={id:(o==null?void 0:o.id)??"",quantity:l,attributes:(o==null?void 0:o.attributes)??[]};n([d])},[i,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return s.createElement(ge,{onClick:a,defaultOnClick:f,disabled:typeof y.disabled<"u"?y.disabled:t!=="idle",...y},u)}const Wr={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function ct(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:u="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:i=!0,loading:a="lazy",...y}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let f=t.embedUrl;if(r){const l=new URL(t.embedUrl);for(const d of Object.keys(r))l.searchParams.set(d,r[d]);f=l.toString()}return s.createElement("iframe",{...y,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:u,allowFullScreen:i,src:f,loading:a})}const Zr=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],zr=["spin.dev"],Kr=[...Zr,...zr],se=[352,832,1200,1920,2560];function lt({src:e,width:t,height:r,crop:n,scale:o}){const u=new URL(e),i=o??1;if(t){let a;typeof t=="string"?a=(se[0]*i).toString():a=(Number(t)*i).toString(),u.searchParams.append("width",a)}return r&&typeof r=="number"&&u.searchParams.append("height",(r*i).toString()),n&&u.searchParams.append("crop",n),u.toString()}function dt(e){const t=new URL(e.src);return!Kr.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:lt(e)}function Qr({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 ft({data:e,width:t,height:r,loading:n,loader:o=dt,loaderOptions:u,widths:i,decoding:a="async",...y}){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:f,height:l}=Qr({data:e,loaderOptions:u,elementProps:{width:t,height:r}});let d=e.url;if(o&&(d=o({...u,src:e.url,width:f,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&&f&&t<f?t:f,E=y.srcSet??Jr({...u,widths:i,src:e.url,width:p,height:l,loader:o});return Q.createElement("img",{id:e.id??"",alt:e.altText??y.alt??"",loading:n??"lazy",...y,src:d,width:f??void 0,height:l??void 0,srcSet:E,decoding:a})}function Jr({src:e,width:t,crop:r,scale:n,widths:o,loader:u,height:i}){const a=o&&Array.isArray(o);if(a&&o.some(d=>isNaN(d)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let y=1;t&&i&&(y=Number(i)/Number(t));let f=a?o:se;!a&&t&&t<se[se.length-1]&&(f=se.filter(d=>d<=t));const l=u||lt;return f.map(d=>`${l({src:e,width:d,height:r?Number(d)*y:void 0,crop:r,scale:n})} ${d??""}w`).join(", ")}function yt(e){var f;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:u=!0,sourceProps:i={},...a}=e,y=dt({src:((f=t.previewImage)==null?void 0:f.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return s.createElement("video",{...a,id:n,playsInline:o,controls:u,poster:y},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",{...i,key:l.url,src:l.url,type:l.mimeType})}))}const ht={};function Xr(e,t){const r=ht[e];if(r)return r;const n=new Promise((o,u)=>{const i=document.createElement("script");t!=null&&t.module?i.type="module":i.type="text/javascript",i.src=e,i.onload=()=>{o(!0)},i.onerror=()=>{u(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(i):document.body.appendChild(i)});return ht[e]=n,n}function gt(e,t){const[r,n]=s.useState("loading"),o=JSON.stringify(t);return s.useEffect(()=>{async function u(){try{n("loading"),await Xr(e,t),n("done")}catch{n("error")}}u().catch(()=>{n("error")})},[e,o,t]),r}function mt(e){var f,l,d;const[t,r]=s.useState(void 0),n=s.useCallback(p=>{r(p)},[]),{data:o,children:u,className:i,...a}=e,y=gt("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]),y!=="done"?null:(l=(f=o.sources)==null?void 0:f[0])!=null&&l.url?s.createElement("model-viewer",{ref:n,...a,className:i,id:a.id??o.id,src:o.sources[0].url,alt:o.alt??null,"camera-controls":a.cameraControls??!0,poster:(a.poster||((d=o.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},u):(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 en({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?s.createElement(ft,{...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(yt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return s.createElement(ct,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return s.createElement(mt,{...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 tn(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=Et(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=Et((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 Et(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function rn(e){var f,l,d,p,E,g;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...u}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let i,a;const y=r?H((o==null?void 0:o.variants)??{}).find(b=>(b==null?void 0:b.id)===r)??null:null;if(t==="compareAt")if(r&&y){if(((f=y.compareAtPriceV2)==null?void 0:f.amount)===((l=y.priceV2)==null?void 0:l.amount))return null;i=y.compareAtPriceV2}else n==="max"?i=(d=o==null?void 0:o.compareAtPriceRange)==null?void 0:d.maxVariantPrice:i=(p=o==null?void 0:o.compareAtPriceRange)==null?void 0:p.minVariantPrice;else r&&y?(i=y.priceV2,n==="unit"&&(i=y.unitPrice,a=y.unitPriceMeasurement)):n==="max"?i=(E=o.priceRange)==null?void 0:E.maxVariantPrice:i=(g=o.priceRange)==null?void 0:g.minVariantPrice;return i?a?s.createElement(ue,{...u,data:i,measurement:a}):s.createElement(ue,{...u,data:i}):null}const nn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function on({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:o}=fe(),u=gt(nn);let i=[];if(e&&r)throw new Error(sn);if(e)i=e.reduce((y,f)=>{const l=j(f).id;return l&&y.push(l),y},[]);else if(r)i=r.reduce((y,f)=>{const l=j(f==null?void 0:f.id).id;return l&&y.push(`${l}:${(f==null?void 0:f.quantity)??1}`),y},[]);else throw new Error(un);if(i.length===0)throw new Error(an);const a=n?{"--shop-pay-button-width":n}:void 0;return s.createElement("div",{className:t,style:a},u==="done"&&s.createElement("shop-pay-button",{"store-url":o,variants:i.join(",")}))}const an='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',un='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',sn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",cn=60*60*24*360*1,ln=60*30;function dn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};s.useEffect(()=>{const n=he(document.cookie);t?(Ee(W,n[W]||ye(),cn,r),Ee(Z,n[Z]||ye(),ln,r)):(Ee(W,"",0,r),Ee(Z,"",0,r))})}function Ee(e,t,r,n){document.cookie=or(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}v.AddToCartButton=_r,v.AnalyticsEventName=De,v.AnalyticsPageType=me,v.BuyNowButton=xr,v.CartCheckoutButton=qr,v.CartCost=Br,v.CartLinePrice=Hr,v.CartLineProvider=jr,v.CartLineQuantity=Gr,v.CartLineQuantityAdjustButton=Yr,v.CartProvider=fr,v.ExternalVideo=ct,v.Image=ft,v.MediaFile=en,v.ModelViewer=mt,v.Money=ue,v.ProductPrice=rn,v.ProductProvider=mr,v.ShopPayButton=on,v.ShopifyProvider=Jt,v.ShopifySalesChannel=nt,v.Video=yt,v.createStorefrontClient=Kt,v.flattenConnection=H,v.getClientBrowserParameters=Vr,v.getShopifyCookies=he,v.parseMetafield=tn,v.sendShopifyAnalytics=kr,v.storefrontApiCustomScalars=Wr,v.useCart=X,v.useCartLine=Oe,v.useMoney=ut,v.useProduct=Xe,v.useShop=fe,v.useShopifyCookies=dn,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
263
+ `,s.message)})}).catch(n=>{console.error(et,n)})}catch{return Promise.resolve()}}function jr(){if(Dr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=Gr(),r=ye(document.cookie);return{uniqueToken:r[H],visitToken:r[Y],url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function Hr(){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 Yr(){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 Gr(){try{let e="PerformanceNavigationTiming",t=Hr();return t||(t=Yr(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function Zr(e){const{cartCreate:t,checkoutUrl:r}=K(),[n,o]=u.useState(!1),{quantity:s,variantId:i,onClick:a,attributes:c,children:l,...d}=e;u.useEffect(()=>{r&&(window.location.href=r)},[r]);const g=u.useCallback(()=>{o(!0),t({lines:[{quantity:s??1,merchandiseId:i,attributes:c}]})},[t,s,i,c]);return u.createElement(he,{disabled:n??d.disabled,...d,onClick:a,defaultOnClick:g},l)}function Qr(e){const[t,r]=u.useState(!1),{status:n,checkoutUrl:o}=K(),{children:s,...i}=e;return u.useEffect(()=>{t&&o&&n==="idle"&&(window.location.href=o)},[t,n,o]),u.createElement(he,{...i,disabled:t||i.disabled,onClick:()=>r(!0)},s)}function tt(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 o=parseFloat(e.amount),s=u.useMemo(()=>({style:"currency",currency:e.currencyCode}),[e.currencyCode]),i=ee(n,s),a=ee(n,{...s,currencyDisplay:"name"}),c=ee(n,{...s,currencyDisplay:"narrowSymbol"}),l=ee(n,{...s,minimumFractionDigits:0,maximumFractionDigits:0}),d=ee(n),g=ee(n,{minimumFractionDigits:0,maximumFractionDigits:0}),S=y=>y.type==="currency",m=u.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>i().format(o),parts:()=>i().formatToParts(o),withoutTrailingZeros:()=>o%1===0?l().format(o):i().format(o),withoutTrailingZerosAndCurrency:()=>o%1===0?g().format(o):d().format(o),currencyName:()=>{var y;return((y=a().formatToParts(o).find(S))==null?void 0:y.value)??e.currencyCode},currencySymbol:()=>{var y;return((y=i().formatToParts(o).find(S))==null?void 0:y.value)??e.currencyCode},currencyNarrowSymbol:()=>{var y;return((y=c().formatToParts(o).find(S))==null?void 0:y.value)??""},amount:()=>i().formatToParts(o).filter(y=>["decimal","fraction","group","integer","literal"].includes(y.type)).map(y=>y.value).join("")}),[e,o,a,i,c,d,l,g]);return u.useMemo(()=>new Proxy(m,{get:(y,P)=>{var T;return(T=Reflect.get(y,P))==null?void 0:T.call(null)}}),[m])}function ee(e,t){return u.useMemo(()=>{let r;return()=>r??(r=new Intl.NumberFormat(e,t))},[e,t])}function ae({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:o,measurementSeparator:s="/",...i}){if(!Wr(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const a=tt(e),c=t??"div";let l=a.localizedString;return(r||n)&&(r&&!n?l=a.amount:!r&&n?l=a.withoutTrailingZeros:l=a.withoutTrailingZerosAndCurrency),u.createElement(c,{...i},l,o&&o.referenceUnit&&u.createElement(u.Fragment,null,s,o.referenceUnit))}function Wr(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function zr(e){const{cost:t}=K(),{amountType:r="total",children:n,...o}=e;let s;return r=="total"?s=t==null?void 0:t.totalAmount:r=="subtotal"?s=t==null?void 0:t.subtotalAmount:r=="tax"?s=t==null?void 0:t.totalTaxAmount:r=="duty"&&(s=t==null?void 0:t.totalDutyAmount),s==null?null:u.createElement(ae,{...o,data:s},n)}function Jr(e){var s,i;const{data:t,priceType:r="regular",...n}=e;if(t==null)throw new Error("<CartLinePrice/> requires a cart line as the 'data' prop");const o=r==="regular"?(s=t.cost)==null?void 0:s.totalAmount:(i=t.cost)==null?void 0:i.compareAtAmountPerQuantity;return o==null?null:u.createElement(ae,{...n,data:o})}const rt=u.createContext(null);function De(){const e=u.useContext(rt);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function Kr({children:e,line:t}){return u.createElement(rt.Provider,{value:t},e)}function Xr(e){const t=De(),{as:r,...n}=e,o=r||"span";return u.createElement(o,{...n},t.quantity)}function en(e){const{status:t,linesRemove:r,linesUpdate:n}=K(),o=De(),{children:s,adjust:i,onClick:a,...c}=e,l=u.useCallback(()=>{if(i==="remove"){r([(o==null?void 0:o.id)??""]);return}const d=i==="decrease"?((o==null?void 0:o.quantity)??0)-1:((o==null?void 0:o.quantity)??0)+1;if(d<=0){r([(o==null?void 0:o.id)??""]);return}const g={id:(o==null?void 0:o.id)??"",quantity:d,attributes:(o==null?void 0:o.attributes)??[]};n([g])},[i,o==null?void 0:o.attributes,o==null?void 0:o.id,o==null?void 0:o.quantity,r,n]);return u.createElement(he,{onClick:a,defaultOnClick:l,disabled:typeof c.disabled<"u"?c.disabled:t!=="idle",...c},s)}const tn={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"};function nt(e){const{data:t,options:r,id:n=t.id,frameBorder:o="0",allow:s="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:i=!0,loading:a="lazy",...c}=e;if(!t.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let l=t.embedUrl;if(r){const d=new URL(t.embedUrl);for(const g of Object.keys(r))d.searchParams.set(g,r[g]);l=d.toString()}return u.createElement("iframe",{...c,id:n??t.embedUrl,title:t.alt??t.id??"external video",frameBorder:o,allow:s,allowFullScreen:i,src:l,loading:a})}const rn=["cdn.shopify.com","cdn.shopifycdn.net","shopify-assets.shopifycdn.com","shopify-assets.shopifycdn.net"],nn=["spin.dev"],on=[...rn,...nn],ie=[352,832,1200,1920,2560];function ot({src:e,width:t,height:r,crop:n,scale:o}){const s=new URL(e),i=o??1;if(t){let a;typeof t=="string"?a=(ie[0]*i).toString():a=(Number(t)*i).toString(),s.searchParams.append("width",a)}return r&&typeof r=="number"&&s.searchParams.append("height",(r*i).toString()),n&&s.searchParams.append("crop",n),s.toString()}function at(e){const t=new URL(e.src);return!on.some(n=>t.hostname.endsWith(n))||!e.width&&!e.height&&!e.crop&&!e.scale?e.src:ot(e)}function an({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 it({data:e,width:t,height:r,loading:n,loader:o=at,loaderOptions:s,widths:i,decoding:a="async",...c}){if(!e.url){const y=`<Image/>: the 'data' prop requires the 'url' property. Image: ${e.id??"no ID provided"}`;return console.error(y),null}const{width:l,height:d}=an({data:e,loaderOptions:s,elementProps:{width:t,height:r}});let g=e.url;if(o&&(g=o({...s,src:e.url,width:l,height:d}),typeof g!="string"||!g))throw new Error(`<Image/>: 'loader' did not return a valid string. Image: ${e.id??e.url}`);const S=t&&l&&t<l?t:l,m=c.srcSet??sn({...s,widths:i,src:e.url,width:S,height:d,loader:o});return W.createElement("img",{id:e.id??"",alt:e.altText??c.alt??"",loading:n??"lazy",...c,src:g,width:l??void 0,height:d??void 0,srcSet:m,decoding:a})}function sn({src:e,width:t,crop:r,scale:n,widths:o,loader:s,height:i}){const a=o&&Array.isArray(o);if(a&&o.some(g=>isNaN(g)))throw new Error(`<Image/>: the 'widths' must be an array of numbers. Image: ${e}`);let c=1;t&&i&&(c=Number(i)/Number(t));let l=a?o:ie;!a&&t&&t<ie[ie.length-1]&&(l=ie.filter(g=>g<=t));const d=s||ot;return l.map(g=>`${d({src:e,width:g,height:r?Number(g)*c:void 0,crop:r,scale:n})} ${g??""}w`).join(", ")}function st(e){var l;const{data:t,previewImageOptions:r,id:n=t.id,playsInline:o=!0,controls:s=!0,sourceProps:i={},...a}=e,c=at({src:((l=t.previewImage)==null?void 0:l.url)??"",...r});if(!t.sources)throw new Error("<Video/> requires a 'data.sources' array");return u.createElement("video",{...a,id:n,playsInline:o,controls:s,poster:c},t.sources.map(d=>{if(!(d!=null&&d.url&&(d!=null&&d.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return u.createElement("source",{...i,key:d.url,src:d.url,type:d.mimeType})}))}const ut={};function un(e,t){const r=ut[e];if(r)return r;const n=new Promise((o,s)=>{const i=document.createElement("script");t!=null&&t.module?i.type="module":i.type="text/javascript",i.src=e,i.onload=()=>{o(!0)},i.onerror=()=>{s(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(i):document.body.appendChild(i)});return ut[e]=n,n}function ct(e,t){const[r,n]=u.useState("loading"),o=JSON.stringify(t);return u.useEffect(()=>{async function s(){try{n("loading"),await un(e,t),n("done")}catch{n("error")}}s().catch(()=>{n("error")})},[e,o,t]),r}function lt(e){var l,d,g;const[t,r]=u.useState(void 0),n=u.useCallback(S=>{r(S)},[]),{data:o,children:s,className:i,...a}=e,c=ct("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return u.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]),c!=="done"?null:(d=(l=o.sources)==null?void 0:l[0])!=null&&d.url?u.createElement("model-viewer",{ref:n,...a,className:i,id:a.id??o.id,src:o.sources[0].url,alt:o.alt??null,"camera-controls":a.cameraControls??!0,poster:(a.poster||((g=o.previewImage)==null?void 0:g.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},s):(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 cn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?u.createElement(it,{...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 u.createElement(st,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return u.createElement(nt,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return u.createElement(lt,{...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 ln(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=dt(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=dt((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:F(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 dt(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function dn(e){var l,d,g,S,m,y;const{priceType:t="regular",variantId:r,valueType:n="min",data:o,...s}=e;if(o==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let i,a;const c=r?F((o==null?void 0:o.variants)??{}).find(P=>(P==null?void 0:P.id)===r)??null:null;if(t==="compareAt")if(r&&c){if(((l=c.compareAtPriceV2)==null?void 0:l.amount)===((d=c.priceV2)==null?void 0:d.amount))return null;i=c.compareAtPriceV2}else n==="max"?i=(g=o==null?void 0:o.compareAtPriceRange)==null?void 0:g.maxVariantPrice:i=(S=o==null?void 0:o.compareAtPriceRange)==null?void 0:S.minVariantPrice;else r&&c?(i=c.priceV2,n==="unit"&&(i=c.unitPrice,a=c.unitPriceMeasurement)):n==="max"?i=(m=o.priceRange)==null?void 0:m.maxVariantPrice:i=(y=o.priceRange)==null?void 0:y.minVariantPrice;return i?a?u.createElement(ae,{...s,data:i,measurement:a}):u.createElement(ae,{...s,data:i}):null}const fn="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function yn({variantIds:e,className:t,variantIdsAndQuantities:r,width:n}){const{storeDomain:o}=de(),s=ct(fn);let i=[];if(e&&r)throw new Error(mn);if(e)i=e.reduce((c,l)=>{const d=B(l).id;return d&&c.push(d),c},[]);else if(r)i=r.reduce((c,l)=>{const d=B(l==null?void 0:l.id).id;return d&&c.push(`${d}:${(l==null?void 0:l.quantity)??1}`),c},[]);else throw new Error(gn);if(i.length===0)throw new Error(hn);const a=n?{"--shop-pay-button-width":n}:void 0;return u.createElement("div",{className:t,style:a},s==="done"&&u.createElement("shop-pay-button",{"store-url":o,variants:i.join(",")}))}const hn='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',gn='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',mn="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",En=60*60*24*360*1,pn=60*30;function Cn(e){const{hasUserConsent:t=!1,domain:r=""}=e||{};u.useEffect(()=>{const n=ye(document.cookie);t?(me(H,n[H]||fe(),En,r),me(Y,n[Y]||fe(),pn,r)):(me(H,"",0,r),me(Y,"",0,r))})}function me(e,t,r,n){document.cookie=fr(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}E.AddToCartButton=Ir,E.AnalyticsEventName=Ie,E.AnalyticsPageType=ge,E.BuyNowButton=Zr,E.CartCheckoutButton=Qr,E.CartCost=zr,E.CartLinePrice=Jr,E.CartLineProvider=Kr,E.CartLineQuantity=Xr,E.CartLineQuantityAdjustButton=en,E.CartProvider=Sr,E.ExternalVideo=nt,E.Image=it,E.MediaFile=cn,E.ModelViewer=lt,E.Money=ae,E.ProductPrice=dn,E.ProductProvider=vr,E.ShopPayButton=yn,E.ShopifyProvider=ir,E.ShopifySalesChannel=Je,E.Video=st,E.createStorefrontClient=or,E.flattenConnection=F,E.getClientBrowserParameters=jr,E.getShopifyCookies=ye,E.parseMetafield=ln,E.sendShopifyAnalytics=Fr,E.storefrontApiCustomScalars=tn,E.useCart=K,E.useCartLine=De,E.useMoney=tt,E.useProduct=Ze,E.useShop=de,E.useShopifyCookies=Cn,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
280
264
  //# sourceMappingURL=hydrogen-react.prod.js.map