@shopify/hydrogen-react 2025.7.2 → 2026.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/customer-account.schema.json +1 -1
- package/dist/browser-dev/AddToCartButton.mjs +3 -1
- package/dist/browser-dev/AddToCartButton.mjs.map +1 -1
- package/dist/browser-dev/CartLineProvider.mjs.map +1 -1
- package/dist/browser-dev/CartProvider.mjs.map +1 -1
- package/dist/browser-dev/Image.mjs.map +1 -1
- package/dist/browser-dev/ModelViewer.mjs.map +1 -1
- package/dist/browser-dev/Money.mjs.map +1 -1
- package/dist/browser-dev/Video.mjs.map +1 -1
- package/dist/browser-dev/cart-queries.mjs +64 -10
- package/dist/browser-dev/cart-queries.mjs.map +1 -1
- package/dist/browser-dev/codegen.helpers.mjs.map +1 -1
- package/dist/browser-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-dev/parse-metafield.mjs +2 -0
- package/dist/browser-dev/parse-metafield.mjs.map +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs +1 -1
- package/dist/browser-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-dev/storefront-client.mjs +0 -1
- package/dist/browser-dev/storefront-client.mjs.map +1 -1
- package/dist/browser-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-dev/useCartActions.mjs.map +1 -1
- package/dist/browser-dev/useMoney.mjs.map +1 -1
- package/dist/browser-prod/AddToCartButton.mjs +3 -1
- package/dist/browser-prod/AddToCartButton.mjs.map +1 -1
- package/dist/browser-prod/CartLineProvider.mjs.map +1 -1
- package/dist/browser-prod/CartProvider.mjs.map +1 -1
- package/dist/browser-prod/Image.mjs.map +1 -1
- package/dist/browser-prod/ModelViewer.mjs.map +1 -1
- package/dist/browser-prod/Money.mjs.map +1 -1
- package/dist/browser-prod/Video.mjs.map +1 -1
- package/dist/browser-prod/cart-queries.mjs +64 -10
- package/dist/browser-prod/cart-queries.mjs.map +1 -1
- package/dist/browser-prod/codegen.helpers.mjs.map +1 -1
- package/dist/browser-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/browser-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/browser-prod/parse-metafield.mjs +2 -0
- package/dist/browser-prod/parse-metafield.mjs.map +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs +1 -1
- package/dist/browser-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/browser-prod/storefront-client.mjs +0 -1
- package/dist/browser-prod/storefront-client.mjs.map +1 -1
- package/dist/browser-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/browser-prod/useCartActions.mjs.map +1 -1
- package/dist/browser-prod/useMoney.mjs.map +1 -1
- package/dist/node-dev/AddToCartButton.js +3 -1
- package/dist/node-dev/AddToCartButton.js.map +1 -1
- package/dist/node-dev/AddToCartButton.mjs +3 -1
- package/dist/node-dev/AddToCartButton.mjs.map +1 -1
- package/dist/node-dev/CartLineProvider.js.map +1 -1
- package/dist/node-dev/CartLineProvider.mjs.map +1 -1
- package/dist/node-dev/CartProvider.js.map +1 -1
- package/dist/node-dev/CartProvider.mjs.map +1 -1
- package/dist/node-dev/Image.js.map +1 -1
- package/dist/node-dev/Image.mjs.map +1 -1
- package/dist/node-dev/ModelViewer.js.map +1 -1
- package/dist/node-dev/ModelViewer.mjs.map +1 -1
- package/dist/node-dev/Money.js.map +1 -1
- package/dist/node-dev/Money.mjs.map +1 -1
- package/dist/node-dev/Video.js.map +1 -1
- package/dist/node-dev/Video.mjs.map +1 -1
- package/dist/node-dev/cart-queries.js +64 -10
- package/dist/node-dev/cart-queries.js.map +1 -1
- package/dist/node-dev/cart-queries.mjs +64 -10
- package/dist/node-dev/cart-queries.mjs.map +1 -1
- package/dist/node-dev/codegen.helpers.js.map +1 -1
- package/dist/node-dev/codegen.helpers.mjs.map +1 -1
- package/dist/node-dev/optionValueDecoder.js.map +1 -1
- package/dist/node-dev/optionValueDecoder.mjs.map +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-dev/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-dev/parse-metafield.js +2 -0
- package/dist/node-dev/parse-metafield.js.map +1 -1
- package/dist/node-dev/parse-metafield.mjs +2 -0
- package/dist/node-dev/parse-metafield.mjs.map +1 -1
- package/dist/node-dev/storefront-api-constants.js +1 -1
- package/dist/node-dev/storefront-api-constants.js.map +1 -1
- package/dist/node-dev/storefront-api-constants.mjs +1 -1
- package/dist/node-dev/storefront-api-constants.mjs.map +1 -1
- package/dist/node-dev/storefront-client.js +0 -1
- package/dist/node-dev/storefront-client.js.map +1 -1
- package/dist/node-dev/storefront-client.mjs +0 -1
- package/dist/node-dev/storefront-client.mjs.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-dev/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-dev/useCartActions.js.map +1 -1
- package/dist/node-dev/useCartActions.mjs.map +1 -1
- package/dist/node-dev/useMoney.js.map +1 -1
- package/dist/node-dev/useMoney.mjs.map +1 -1
- package/dist/node-prod/AddToCartButton.js +3 -1
- package/dist/node-prod/AddToCartButton.js.map +1 -1
- package/dist/node-prod/AddToCartButton.mjs +3 -1
- package/dist/node-prod/AddToCartButton.mjs.map +1 -1
- package/dist/node-prod/CartLineProvider.js.map +1 -1
- package/dist/node-prod/CartLineProvider.mjs.map +1 -1
- package/dist/node-prod/CartProvider.js.map +1 -1
- package/dist/node-prod/CartProvider.mjs.map +1 -1
- package/dist/node-prod/Image.js.map +1 -1
- package/dist/node-prod/Image.mjs.map +1 -1
- package/dist/node-prod/ModelViewer.js.map +1 -1
- package/dist/node-prod/ModelViewer.mjs.map +1 -1
- package/dist/node-prod/Money.js.map +1 -1
- package/dist/node-prod/Money.mjs.map +1 -1
- package/dist/node-prod/Video.js.map +1 -1
- package/dist/node-prod/Video.mjs.map +1 -1
- package/dist/node-prod/cart-queries.js +64 -10
- package/dist/node-prod/cart-queries.js.map +1 -1
- package/dist/node-prod/cart-queries.mjs +64 -10
- package/dist/node-prod/cart-queries.mjs.map +1 -1
- package/dist/node-prod/codegen.helpers.js.map +1 -1
- package/dist/node-prod/codegen.helpers.mjs.map +1 -1
- package/dist/node-prod/optionValueDecoder.js.map +1 -1
- package/dist/node-prod/optionValueDecoder.mjs.map +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.js +1 -1
- package/dist/node-prod/packages/hydrogen-react/package.json.mjs +1 -1
- package/dist/node-prod/parse-metafield.js +2 -0
- package/dist/node-prod/parse-metafield.js.map +1 -1
- package/dist/node-prod/parse-metafield.mjs +2 -0
- package/dist/node-prod/parse-metafield.mjs.map +1 -1
- package/dist/node-prod/storefront-api-constants.js +1 -1
- package/dist/node-prod/storefront-api-constants.js.map +1 -1
- package/dist/node-prod/storefront-api-constants.mjs +1 -1
- package/dist/node-prod/storefront-api-constants.mjs.map +1 -1
- package/dist/node-prod/storefront-client.js +0 -1
- package/dist/node-prod/storefront-client.js.map +1 -1
- package/dist/node-prod/storefront-client.mjs +0 -1
- package/dist/node-prod/storefront-client.mjs.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.js.map +1 -1
- package/dist/node-prod/useCartAPIStateMachine.mjs.map +1 -1
- package/dist/node-prod/useCartActions.js.map +1 -1
- package/dist/node-prod/useCartActions.mjs.map +1 -1
- package/dist/node-prod/useMoney.js.map +1 -1
- package/dist/node-prod/useMoney.mjs.map +1 -1
- package/dist/types/AddToCartButton.d.ts +3 -0
- package/dist/types/CartLineProvider.d.ts +1 -1
- package/dist/types/CartProvider.d.ts +2 -2
- package/dist/types/Image.d.ts +1 -1
- package/dist/types/ModelViewer.d.ts +1 -1
- package/dist/types/Money.d.ts +5 -5
- package/dist/types/Video.d.ts +1 -1
- package/dist/types/codegen.helpers.d.ts +2 -2
- package/dist/types/customer-account-api-types.d.ts +669 -20
- package/dist/types/optionValueDecoder.d.ts +2 -2
- package/dist/types/parse-metafield.d.ts +14 -2
- package/dist/types/storefront-api-constants.d.ts +1 -1
- package/dist/types/storefront-api-types.d.ts +165 -7
- package/dist/types/useCartAPIStateMachine.d.ts +2 -2
- package/dist/types/useCartActions.d.ts +2 -2
- package/dist/types/useMoney.d.ts +4 -4
- package/dist/umd/hydrogen-react.dev.js +71 -14
- package/dist/umd/hydrogen-react.dev.js.map +1 -1
- package/dist/umd/hydrogen-react.prod.js +78 -24
- package/dist/umd/hydrogen-react.prod.js.map +1 -1
- package/package.json +1 -1
- package/storefront.schema.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(S,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],l):(S=typeof globalThis<"u"?globalThis:S||self,l(S.hydrogenreact={},S.React))})(this,(function(S,l){"use strict";function sr(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 U=sr(l);/*! *****************************************************************************
|
|
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
|
|
14
|
+
***************************************************************************** */function Je(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,a,i=r.call(e),o=[];try{for(;(t===void 0||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(s){a={error:s}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(a)throw a.error}}return o}var z;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(z||(z={}));var Xe={type:"xstate.init"};function Pe(e){return e===void 0?[]:[].concat(e)}function re(e){return{type:"xstate.assign",assignment:e}}function ze(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 Se(e){return function(t){return e===t}}function et(e){return typeof e=="string"?{type:e}:e}function tt(e,t){return{value:e,context:t,actions:[],changed:!1,matches:Se(e)}}function rt(e,t,r){var n=t,a=!1;return[e.filter((function(i){if(i.type==="xstate.assign"){a=!0;var o=Object.assign({},n);return typeof i.assignment=="function"?o=i.assignment(n,r):Object.keys(i.assignment).forEach((function(s){o[s]=typeof i.assignment[s]=="function"?i.assignment[s](n,r):i.assignment[s]})),n=o,!1}return!0})),n,a]}function nt(e,t){t===void 0&&(t={});var r=Je(rt(Pe(e.states[e.initial].entry).map((function(o){return ze(o,t.actions)})),e.context,Xe),2),n=r[0],a=r[1],i={config:e,_options:t,initialState:{value:e.initial,actions:n,context:a,matches:Se(e.initial)},transition:function(o,s){var u,d,y=typeof o=="string"?{value:o,context:e.context}:o,f=y.value,h=y.context,g=et(s),c=e.states[f];if(c.on){var _=Pe(c.on[g.type]);try{for(var C=(function(k){var se=typeof Symbol=="function"&&Symbol.iterator,pe=se&&k[se],Ee=0;if(pe)return pe.call(k);if(k&&typeof k.length=="number")return{next:function(){return k&&Ee>=k.length&&(k=void 0),{value:k&&k[Ee++],done:!k}}};throw new TypeError(se?"Object is not iterable.":"Symbol.iterator is not defined.")})(_),v=C.next();!v.done;v=C.next()){var A=v.value;if(A===void 0)return tt(f,h);var w=typeof A=="string"?{target:A}:A,I=w.target,p=w.actions,m=p===void 0?[]:p,E=w.cond,P=E===void 0?function(){return!0}:E,R=I===void 0,b=I??f,O=e.states[b];if(P(h,g)){var q=Je(rt((R?Pe(m):[].concat(c.exit,m,O.entry).filter((function(k){return k}))).map((function(k){return ze(k,i._options.actions)})),h,g),3),V=q[0],H=q[1],X=q[2],me=I??f;return{value:me,context:H,actions:V,changed:I!==f||V.length>0||X,matches:Se(me)}}}}catch(k){u={error:k}}finally{try{v&&!v.done&&(d=C.return)&&d.call(C)}finally{if(u)throw u.error}}}return tt(f,h)}};return i}var at=function(e,t){return e.actions.forEach((function(r){var n=r.exec;return n&&n(e.context,t)}))};function cr(e){var t=e.initialState,r=z.NotStarted,n=new Set,a={_machine:e,send:function(i){r===z.Running&&(t=e.transition(t,i),at(t,et(i)),n.forEach((function(o){return o(t)})))},subscribe:function(i){return n.add(i),i(t),{unsubscribe:function(){return n.delete(i)}}},start:function(i){if(i){var o=typeof i=="object"?i:{context:e.config.context,value:i};t={value:o.value,actions:[],context:o.context,matches:Se(o.value)}}else t=e.initialState;return r=z.Running,at(t,Xe),a},stop:function(){return r=z.Stopped,n.clear(),a},get state(){return t},get status(){return r}};return a}var ur=l.useLayoutEffect,Oe={exports:{}},Re={},Ve={exports:{}},De={};/**
|
|
15
15
|
* @license React
|
|
16
16
|
* use-sync-external-store-shim.production.js
|
|
17
17
|
*
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* This source code is licensed under the MIT license found in the
|
|
21
21
|
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var
|
|
22
|
+
*/var it;function lr(){if(it)return De;it=1;var e=l;function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function s(f,h){var g=h(),c=n({inst:{value:g,getSnapshot:h}}),_=c[0].inst,C=c[1];return i(function(){_.value=g,_.getSnapshot=h,u(_)&&C({inst:_})},[f,g,h]),a(function(){return u(_)&&C({inst:_}),f(function(){u(_)&&C({inst:_})})},[f]),o(g),g}function u(f){var h=f.getSnapshot;f=f.value;try{var g=h();return!r(f,g)}catch{return!0}}function d(f,h){return h()}var y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:s;return De.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:y,De}var ot;function dr(){return ot||(ot=1,Ve.exports=lr()),Ve.exports}/**
|
|
23
23
|
* @license React
|
|
24
24
|
* use-sync-external-store-shim/with-selector.production.js
|
|
25
25
|
*
|
|
@@ -27,14 +27,20 @@
|
|
|
27
27
|
*
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*/var
|
|
30
|
+
*/var st;function fr(){if(st)return Re;st=1;var e=l,t=dr();function r(d,y){return d===y&&(d!==0||1/d===1/y)||d!==d&&y!==y}var n=typeof Object.is=="function"?Object.is:r,a=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,s=e.useMemo,u=e.useDebugValue;return Re.useSyncExternalStoreWithSelector=function(d,y,f,h,g){var c=i(null);if(c.current===null){var _={hasValue:!1,value:null};c.current=_}else _=c.current;c=s(function(){function v(m){if(!A){if(A=!0,w=m,m=h(m),g!==void 0&&_.hasValue){var E=_.value;if(g(E,m))return I=E}return I=m}if(E=I,n(w,m))return E;var P=h(m);return g!==void 0&&g(E,P)?(w=m,E):(w=m,I=P)}var A=!1,w,I,p=f===void 0?null:f;return[function(){return v(y())},p===null?void 0:function(){return v(p())}]},[y,f,h,g]);var C=a(d,c[0],c[1]);return o(function(){_.hasValue=!0,_.value=C},[C]),u(C),C},Re}var ct;function hr(){return ct||(ct=1,Oe.exports=fr()),Oe.exports}var yr=hr();function gr(e){var t=U.useRef();return t.current||(t.current={v:e()}),t.current.v}var mr=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,i=[],o;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)i.push(a.value)}catch(s){o={error:s}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i};function pr(e){return e}var Er=function(e){var t;return e.subscribe(function(r){t=r}).unsubscribe(),t};function _r(e,t){var r=l.useRef(),n=mr(gr(function(){var s=[],u=cr(nt(e.config,t||e._options)),d=u.send;return u.send=function(y){if(u.status===z.NotStarted){s.push(y);return}d(y),r.current=u.state},[u,s]}),2),a=n[0],i=n[1];ur(function(){t&&(a._machine._options=t)});var o=Cr(a);return l.useEffect(function(){return a.start(r.current),i.forEach(a.send),r.current=a.state,function(){a.stop()}},[]),o}var Sr=function(e,t){return t.changed===!1};function Cr(e){var t=l.useCallback(function(){return Er(e)},[e]),r=l.useCallback(function(a){var i=e.subscribe(a).unsubscribe;return i},[e]),n=yr.useSyncExternalStoreWithSelector(r,t,t,pr,Sr);return[n,e.send,e]}function Q(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 Tr=e=>`
|
|
31
31
|
mutation CartLineAdd(
|
|
32
32
|
$cartId: ID!
|
|
33
33
|
$lines: [CartLineInput!]!
|
|
34
34
|
$numCartLines: Int = 250
|
|
35
35
|
$country: CountryCode = ZZ
|
|
36
36
|
$language: LanguageCode
|
|
37
|
-
|
|
37
|
+
$visitorConsent: VisitorConsent
|
|
38
|
+
)
|
|
39
|
+
@inContext(
|
|
40
|
+
country: $country
|
|
41
|
+
language: $language
|
|
42
|
+
visitorConsent: $visitorConsent
|
|
43
|
+
) {
|
|
38
44
|
cartLinesAdd(cartId: $cartId, lines: $lines) {
|
|
39
45
|
cart {
|
|
40
46
|
...CartFragment
|
|
@@ -49,7 +55,13 @@
|
|
|
49
55
|
$numCartLines: Int = 250
|
|
50
56
|
$country: CountryCode = ZZ
|
|
51
57
|
$language: LanguageCode
|
|
52
|
-
|
|
58
|
+
$visitorConsent: VisitorConsent
|
|
59
|
+
)
|
|
60
|
+
@inContext(
|
|
61
|
+
country: $country
|
|
62
|
+
language: $language
|
|
63
|
+
visitorConsent: $visitorConsent
|
|
64
|
+
) {
|
|
53
65
|
cartCreate(input: $input) {
|
|
54
66
|
cart {
|
|
55
67
|
...CartFragment
|
|
@@ -58,14 +70,20 @@
|
|
|
58
70
|
}
|
|
59
71
|
|
|
60
72
|
${e}
|
|
61
|
-
`,
|
|
73
|
+
`,vr=e=>`
|
|
62
74
|
mutation CartLineRemove(
|
|
63
75
|
$cartId: ID!
|
|
64
76
|
$lines: [ID!]!
|
|
65
77
|
$numCartLines: Int = 250
|
|
66
78
|
$country: CountryCode = ZZ
|
|
67
79
|
$language: LanguageCode
|
|
68
|
-
|
|
80
|
+
$visitorConsent: VisitorConsent
|
|
81
|
+
)
|
|
82
|
+
@inContext(
|
|
83
|
+
country: $country
|
|
84
|
+
language: $language
|
|
85
|
+
visitorConsent: $visitorConsent
|
|
86
|
+
) {
|
|
69
87
|
cartLinesRemove(cartId: $cartId, lineIds: $lines) {
|
|
70
88
|
cart {
|
|
71
89
|
...CartFragment
|
|
@@ -74,14 +92,20 @@
|
|
|
74
92
|
}
|
|
75
93
|
|
|
76
94
|
${e}
|
|
77
|
-
`,
|
|
95
|
+
`,wr=e=>`
|
|
78
96
|
mutation CartLineUpdate(
|
|
79
97
|
$cartId: ID!
|
|
80
98
|
$lines: [CartLineUpdateInput!]!
|
|
81
99
|
$numCartLines: Int = 250
|
|
82
100
|
$country: CountryCode = ZZ
|
|
83
101
|
$language: LanguageCode
|
|
84
|
-
|
|
102
|
+
$visitorConsent: VisitorConsent
|
|
103
|
+
)
|
|
104
|
+
@inContext(
|
|
105
|
+
country: $country
|
|
106
|
+
language: $language
|
|
107
|
+
visitorConsent: $visitorConsent
|
|
108
|
+
) {
|
|
85
109
|
cartLinesUpdate(cartId: $cartId, lines: $lines) {
|
|
86
110
|
cart {
|
|
87
111
|
...CartFragment
|
|
@@ -90,14 +114,20 @@
|
|
|
90
114
|
}
|
|
91
115
|
|
|
92
116
|
${e}
|
|
93
|
-
`,
|
|
117
|
+
`,Ar=e=>`
|
|
94
118
|
mutation CartNoteUpdate(
|
|
95
119
|
$cartId: ID!
|
|
96
120
|
$note: String!
|
|
97
121
|
$numCartLines: Int = 250
|
|
98
122
|
$country: CountryCode = ZZ
|
|
99
123
|
$language: LanguageCode
|
|
100
|
-
|
|
124
|
+
$visitorConsent: VisitorConsent
|
|
125
|
+
)
|
|
126
|
+
@inContext(
|
|
127
|
+
country: $country
|
|
128
|
+
language: $language
|
|
129
|
+
visitorConsent: $visitorConsent
|
|
130
|
+
) {
|
|
101
131
|
cartNoteUpdate(cartId: $cartId, note: $note) {
|
|
102
132
|
cart {
|
|
103
133
|
...CartFragment
|
|
@@ -106,14 +136,20 @@
|
|
|
106
136
|
}
|
|
107
137
|
|
|
108
138
|
${e}
|
|
109
|
-
`,
|
|
139
|
+
`,Ir=e=>`
|
|
110
140
|
mutation CartBuyerIdentityUpdate(
|
|
111
141
|
$cartId: ID!
|
|
112
142
|
$buyerIdentity: CartBuyerIdentityInput!
|
|
113
143
|
$numCartLines: Int = 250
|
|
114
144
|
$country: CountryCode = ZZ
|
|
115
145
|
$language: LanguageCode
|
|
116
|
-
|
|
146
|
+
$visitorConsent: VisitorConsent
|
|
147
|
+
)
|
|
148
|
+
@inContext(
|
|
149
|
+
country: $country
|
|
150
|
+
language: $language
|
|
151
|
+
visitorConsent: $visitorConsent
|
|
152
|
+
) {
|
|
117
153
|
cartBuyerIdentityUpdate(cartId: $cartId, buyerIdentity: $buyerIdentity) {
|
|
118
154
|
cart {
|
|
119
155
|
...CartFragment
|
|
@@ -129,7 +165,13 @@
|
|
|
129
165
|
$numCartLines: Int = 250
|
|
130
166
|
$country: CountryCode = ZZ
|
|
131
167
|
$language: LanguageCode
|
|
132
|
-
|
|
168
|
+
$visitorConsent: VisitorConsent
|
|
169
|
+
)
|
|
170
|
+
@inContext(
|
|
171
|
+
country: $country
|
|
172
|
+
language: $language
|
|
173
|
+
visitorConsent: $visitorConsent
|
|
174
|
+
) {
|
|
133
175
|
cartAttributesUpdate(attributes: $attributes, cartId: $cartId) {
|
|
134
176
|
cart {
|
|
135
177
|
...CartFragment
|
|
@@ -141,11 +183,17 @@
|
|
|
141
183
|
`,Or=e=>`
|
|
142
184
|
mutation CartDiscountCodesUpdate(
|
|
143
185
|
$cartId: ID!
|
|
144
|
-
$discountCodes: [String!]
|
|
186
|
+
$discountCodes: [String!]!
|
|
145
187
|
$numCartLines: Int = 250
|
|
146
188
|
$country: CountryCode = ZZ
|
|
147
189
|
$language: LanguageCode
|
|
148
|
-
|
|
190
|
+
$visitorConsent: VisitorConsent
|
|
191
|
+
)
|
|
192
|
+
@inContext(
|
|
193
|
+
country: $country
|
|
194
|
+
language: $language
|
|
195
|
+
visitorConsent: $visitorConsent
|
|
196
|
+
) {
|
|
149
197
|
cartDiscountCodesUpdate(cartId: $cartId, discountCodes: $discountCodes) {
|
|
150
198
|
cart {
|
|
151
199
|
...CartFragment
|
|
@@ -160,14 +208,20 @@
|
|
|
160
208
|
$numCartLines: Int = 250
|
|
161
209
|
$country: CountryCode = ZZ
|
|
162
210
|
$language: LanguageCode
|
|
163
|
-
|
|
211
|
+
$visitorConsent: VisitorConsent
|
|
212
|
+
)
|
|
213
|
+
@inContext(
|
|
214
|
+
country: $country
|
|
215
|
+
language: $language
|
|
216
|
+
visitorConsent: $visitorConsent
|
|
217
|
+
) {
|
|
164
218
|
cart(id: $id) {
|
|
165
219
|
...CartFragment
|
|
166
220
|
}
|
|
167
221
|
}
|
|
168
222
|
|
|
169
223
|
${e}
|
|
170
|
-
`,
|
|
224
|
+
`,Vr=`
|
|
171
225
|
fragment CartFragment on Cart {
|
|
172
226
|
id
|
|
173
227
|
checkoutUrl
|
|
@@ -268,16 +322,16 @@
|
|
|
268
322
|
width
|
|
269
323
|
height
|
|
270
324
|
}
|
|
271
|
-
`,ne="
|
|
272
|
-
You may run into unexpected errors if these versions don't match. Received version: "${n}"; expected version "${ne}"`);const i=o=>{const s=(o==null?void 0:o.storeDomain)??e;return s.includes("://")?s:`https://${s}`};return{getShopifyDomain:i,getStorefrontApiUrl(o){const s=i(o),u=s+(s.endsWith("/")?"api":"/api");return Ve(s)?u:`${u}/${(o==null?void 0:o.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(o){if(!t&&!(o!=null&&o.privateStorefrontToken)&&!Ve(e))throw new Error(Ue+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":((o==null?void 0:o.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(o==null?void 0:o.privateStorefrontToken)??t??"",...o!=null&&o.buyerIp?{"Shopify-Storefront-Buyer-IP":o.buyerIp}:{}}},getPublicTokenHeaders(o){if(!r&&!(o!=null&&o.publicStorefrontToken)&&!Ve(e))throw new Error(Ue+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");const s=(o==null?void 0:o.contentType)??a??"json";return lt(s,n,(o==null?void 0:o.publicStorefrontToken)??r??"")}}}function lt(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 dt=new Set,Ue="[h2:error:createStorefrontClient] ",Ur=(e,t="warn")=>{dt.has(e)||(console[t](`[h2:${t}:createStorefrontClient] `+e),dt.add(e))},ft={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ne,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},ht=l.createContext(ft);function Nr(){var e,t,r;if(typeof window>"u")return!1;try{const n=(t=(e=window.performance)==null?void 0:e.getEntriesByType)==null?void 0:t.call(e,"navigation")[0];return!!((r=n==null?void 0:n.serverTiming)!=null&&r.some(a=>a.name==="_sfapi_proxy"))}catch{return!1}}function Mr({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=l.useMemo(()=>{const n=t.sameDomainForStorefrontApi??Nr();function a(i){const o=(i==null?void 0:i.storeDomain)??t.storeDomain;return o.includes("://")?o:`https://${o}`}return{...t,sameDomainForStorefrontApi:n,getPublicTokenHeaders(i){return lt(i.contentType,t.storefrontApiVersion,i.storefrontToken??t.storefrontToken)},getShopifyDomain:a,getStorefrontApiUrl(i){const o=n&&typeof window<"u"?window.location.origin:a({storeDomain:(i==null?void 0:i.storeDomain)??t.storeDomain});return`${o}${o.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return React.createElement(ht.Provider,{value:r},e)}function ce(){const e=l.useContext(ht);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ne="shopifyCartId",yt="Shopify-Storefront-Id",gt="Shopify-Storefront-Y",mt="Shopify-Storefront-S",Te="_shopify_y",Ce="_shopify_s",Me="X-Shopify-VisitToken",Fe="X-Shopify-UniqueToken",Le={current:null};function ee(){var t,r,n;let e;if(typeof window<"u"&&typeof window.performance<"u")try{const a=/^https?:\/\/([^/]+)(\/api\/(?:unstable|2\d{3}-\d{2})\/graphql\.json(?=$|\?))?/,i=performance.getEntriesByType("resource");let o;for(let s=i.length-1;s>=0;s--){const u=i[s];if(u.initiatorType!=="fetch")continue;const d=window.location.host,y=u.name.match(a);if(!y)continue;const[,f,h]=y;if(f===d||h&&(f==null?void 0:f.endsWith(`.${d}`))){const c=pt(u);if(c){o=c;break}}}if(o&&(e=o),e?Le.current=e:Le.current&&(e=Le.current),!e){const s=performance.getEntriesByType("navigation")[0];e=pt(s,!1)}}catch{}if(!e){const a=typeof arguments[0]=="string"?arguments[0]:typeof document<"u"?document.cookie:"";e={uniqueToken:((t=a.match(/\b_shopify_y=([^;]+)/))==null?void 0:t[1])||"",visitToken:((r=a.match(/\b_shopify_s=([^;]+)/))==null?void 0:r[1])||"",consent:((n=a.match(/\b_tracking_consent=([^;]+)/))==null?void 0:n[1])||""}}return e}function pt(e,t=!0){let r="",n="",a="";const i=e.serverTiming;if(i&&i.length>=3)for(let o=i.length-1;o>=0;o--){const{name:s,description:u}=i[o];if(!(!s||!u)&&(s==="_y"?r=u:s==="_s"?n=u:s==="_cmp"&&(a=u),r&&n&&a))break}return r&&n&&(!t||a)?{uniqueToken:r,visitToken:n,consent:a}:void 0}function Fr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r,sameDomainForStorefrontApi:n}=ce();return l.useCallback(({query:a,variables:i})=>{const o=t({contentType:"json"});if(e&&(o[yt]=e),!n){const{uniqueToken:s,visitToken:u}=ee();s&&(o[gt]=s,o[Fe]=s),u&&(o[mt]=u,o[Me]=u)}return fetch(r(),{method:"POST",headers:o,body:JSON.stringify({query:a.toString(),variables:i})}).then(s=>s.json()).catch(s=>({data:void 0,errors:s==null?void 0:s.toString()}))},[t,e,r,n])}function Lr({numCartLines:e,cartFragment:t,countryCode:r="US",languageCode:n="EN"}){const a=Fr(),i=l.useCallback(c=>a({query:Rr(t),variables:{id:c,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),o=l.useCallback(c=>a({query:br(t),variables:{input:c,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),s=l.useCallback((c,S)=>a({query:Cr(t),variables:{cartId:c,lines:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),u=l.useCallback((c,S)=>a({query:Ar(t),variables:{cartId:c,lines:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),d=l.useCallback((c,S)=>a({query:wr(t),variables:{cartId:c,lines:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),y=l.useCallback((c,S)=>a({query:Ir(t),variables:{cartId:c,note:S,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),f=l.useCallback((c,S)=>a({query:vr(t),variables:{cartId:c,buyerIdentity:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),h=l.useCallback((c,S)=>a({query:Pr(t),variables:{cartId:c,attributes:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),g=l.useCallback((c,S)=>a({query:Or(t),variables:{cartId:c,discountCodes:S,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]);return l.useMemo(()=>({cartFetch:i,cartCreate:o,cartLineAdd:s,cartLineUpdate:u,cartLineRemove:d,noteUpdate:y,buyerIdentityUpdate:f,cartAttributesUpdate:h,discountCodesUpdate:g,cartFragment:t}),[i,o,s,u,d,y,f,h,g,t])}function Y(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],re({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.cart},rawCartResult:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:re({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ue={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[re({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>xe(t.payload.cart)})]}},Et={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 xr(e){return at({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&xe(e)},states:{uninitialized:{on:ue},cartCompleted:{on:ue},initializationError:{on:ue},idle:{on:{...ue,...Et}},error:{on:{...ue,...Et}},cartFetching:Y("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:Y("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:Y("cartLineRemoveAction"),cartLineUpdating:Y("cartLineUpdateAction"),cartLineAdding:Y("cartLineAddAction"),noteUpdating:Y("noteUpdateAction"),buyerIdentityUpdating:Y("buyerIdentityUpdateAction"),cartAttributesUpdating:Y("cartAttributesUpdateAction"),discountCodesUpdating:Y("discountCodesUpdateAction")}})}function jr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:a,cartFragment:i,countryCode:o,languageCode:s}){const{cartFetch:u,cartCreate:d,cartLineAdd:y,cartLineUpdate:f,cartLineRemove:h,noteUpdate:g,buyerIdentityUpdate:c,cartAttributesUpdate:S,discountCodesUpdate:T}=Lr({numCartLines:e,cartFragment:i,countryCode:o,languageCode:s}),A=l.useMemo(()=>xr(a),[a]),[I,w,v]=_r(A,{actions:{cartFetchAction:async(p,m)=>{var b;if(m.type!=="CART_FETCH")return;const{data:E,errors:P}=await u((b=m==null?void 0:m.payload)==null?void 0:b.cartId),R=W(m,E==null?void 0:E.cart,P);w(R)},cartCreateAction:async(p,m)=>{var b;if(m.type!=="CART_CREATE")return;const{data:E,errors:P}=await d(m==null?void 0:m.payload),R=W(m,(b=E==null?void 0:E.cartCreate)==null?void 0:b.cart,P);w(R)},cartLineAddAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_ADD"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await y(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesAdd)==null?void 0:O.cart,P);w(R)},cartLineUpdateAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await f(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesUpdate)==null?void 0:O.cart,P);w(R)},cartLineRemoveAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_REMOVE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await h(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesRemove)==null?void 0:O.cart,P);w(R)},noteUpdateAction:async(p,m)=>{var b,O;if(m.type!=="NOTE_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await g(p.cart.id,m.payload.note),R=W(m,(O=E==null?void 0:E.cartNoteUpdate)==null?void 0:O.cart,P);w(R)},buyerIdentityUpdateAction:async(p,m)=>{var b,O;if(m.type!=="BUYER_IDENTITY_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await c(p.cart.id,m.payload.buyerIdentity),R=W(m,(O=E==null?void 0:E.cartBuyerIdentityUpdate)==null?void 0:O.cart,P);w(R)},cartAttributesUpdateAction:async(p,m)=>{var b,O;if(m.type!=="CART_ATTRIBUTES_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await S(p.cart.id,m.payload.attributes),R=W(m,(O=E==null?void 0:E.cartAttributesUpdate)==null?void 0:O.cart,P);w(R)},discountCodesUpdateAction:async(p,m)=>{var b,O;if(m.type!=="DISCOUNT_CODES_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await T(p.cart.id,m.payload.discountCodes),R=W(m,(O=E==null?void 0:E.cartDiscountCodesUpdate)==null?void 0:O.cart,P);w(R)},...t&&{onCartActionEntry:(p,m)=>{qr(m)&&t(p,m)}},...r&&{onCartActionOptimisticUI:re((p,m)=>r(p,m))},...n&&{onCartActionComplete:(p,m)=>{Hr(m)&&n(p,m)}}}});return l.useMemo(()=>[I,w,v],[I,w,v])}function xe(e){return{...e,lines:Q(e==null?void 0:e.lines),note:e.note??void 0}}function W(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:xe(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function qr(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 Hr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const _t=l.createContext(null);function ae(){const e=l.useContext(_t);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function $r({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:a,onLineUpdate:i,onNoteUpdate:o,onBuyerIdentityUpdate:s,onAttributesUpdate:u,onDiscountCodesUpdate:d,onCreateComplete:y,onLineAddComplete:f,onLineRemoveComplete:h,onLineUpdateComplete:g,onNoteUpdateComplete:c,onBuyerIdentityUpdateComplete:S,onAttributesUpdateComplete:T,onDiscountCodesUpdateComplete:A,data:I,cartFragment:w=Dr,customerAccessToken:v,countryCode:p,languageCode:m}){var er,tr,rr,nr,ar,ir,or;const E=ce();if(!E)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");p=(p??E.countryIsoCode??"US").toUpperCase(),m=(m??E.languageIsoCode??"EN").toUpperCase(),p&&(p=p.toUpperCase());const[P,R]=l.useState(p),[b,O]=l.useState(v),H=l.useRef(!1);(P!==p||b!==v)&&(R(p),O(v),H.current=!1);const[D,$]=jr({numCartLines:t,data:I,cartFragment:w,countryCode:p,languageCode:m,onCartActionEntry(C,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 a==null?void 0:a();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return o==null?void 0:o();case"BUYER_IDENTITY_UPDATE":return s==null?void 0:s();case"CART_ATTRIBUTES_UPDATE":return u==null?void 0:u();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(F){console.error("Cart entry action failed",F)}},onCartActionOptimisticUI(C,N){var F,K,M,_e;if(!C.cart)return{...C};switch(N.type){case"CARTLINE_REMOVE":return{...C,cart:{...C.cart,lines:(K=(F=C==null?void 0:C.cart)==null?void 0:F.lines)==null?void 0:K.filter(L=>(L==null?void 0:L.id)&&!N.payload.lines.includes(L==null?void 0:L.id))}};case"CARTLINE_UPDATE":return{...C,cart:{...C.cart,lines:(_e=(M=C==null?void 0:C.cart)==null?void 0:M.lines)==null?void 0:_e.map(L=>{const Je=N.payload.lines.find(({id:ya})=>ya===(L==null?void 0:L.id));return Je&&Je.quantity?{...L,quantity:Je.quantity}:L})}}}return{...C}},onCartActionComplete(C,N){const F=N.payload.cartActionEvent;try{switch(N.type){case"RESOLVE":switch(F.type){case"CART_CREATE":return y==null?void 0:y();case"CARTLINE_ADD":return f==null?void 0:f();case"CARTLINE_REMOVE":return h==null?void 0:h();case"CARTLINE_UPDATE":return g==null?void 0:g();case"NOTE_UPDATE":return c==null?void 0:c();case"BUYER_IDENTITY_UPDATE":return Wr(C,F)&&(H.current=!0),S==null?void 0:S();case"CART_ATTRIBUTES_UPDATE":return T==null?void 0:T();case"DISCOUNT_CODES_UPDATE":return A==null?void 0:A()}}}catch(K){console.error("onCartActionComplete failed",K)}}}),X=l.useRef(!1),[me,V]=l.useState(!1),se=D.matches("cartCompleted"),pe=(D.value==="idle"||D.value==="error"||D.value==="cartCompleted")&&p!==((rr=(tr=(er=D==null?void 0:D.context)==null?void 0:er.cart)==null?void 0:tr.buyerIdentity)==null?void 0:rr.countryCode)&&!D.context.errors,Ee=l.useRef(!1);l.useEffect(()=>{if(!X.current&&!Ee.current){if(!I&&je("localStorage")){Ee.current=!0;try{const C=window.localStorage.getItem(Ne);C&&$({type:"CART_FETCH",payload:{cartId:C}})}catch(C){console.warn("error fetching cartId"),console.warn(C)}}X.current=!0,V(!0)}},[I,X,$]),l.useEffect(()=>{!pe||H.current||$({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:p,customerAccessToken:v}}})},[p,v,pe,H,$]);const B=l.useCallback(C=>{if(!X.current)return console.warn("Cart isn't ready yet");$(C)},[$]);l.useEffect(()=>{var C,N,F;if((N=(C=D==null?void 0:D.context)==null?void 0:C.cart)!=null&&N.id&&je("localStorage"))try{window.localStorage.setItem(Ne,(F=D.context.cart)==null?void 0:F.id)}catch(K){console.warn("Failed to save cartId to localStorage",K)}},[(ar=(nr=D==null?void 0:D.context)==null?void 0:nr.cart)==null?void 0:ar.id]),l.useEffect(()=>{if(se&&je("localStorage"))try{window.localStorage.removeItem(Ne)}catch(C){console.warn("Failed to delete cartId from localStorage",C)}},[se]);const Qe=l.useCallback(C=>{var N,F;p&&!((N=C.buyerIdentity)!=null&&N.countryCode)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.countryCode=p),v&&!((F=C.buyerIdentity)!=null&&F.customerAccessToken)&&(C.buyerIdentity==null&&(C.buyerIdentity={}),C.buyerIdentity.customerAccessToken=v),B({type:"CART_CREATE",payload:C})},[p,v,B]),k=Yr(D),ha=l.useMemo(()=>{var C,N,F,K;return{...((C=k==null?void 0:k.context)==null?void 0:C.cart)??{lines:[],attributes:[]},status:Br(k.value),error:(N=k==null?void 0:k.context)==null?void 0:N.errors,totalQuantity:((K=(F=k==null?void 0:k.context)==null?void 0:F.cart)==null?void 0:K.totalQuantity)??0,cartCreate:Qe,cartReady:me,linesAdd(M){var _e,L;(L=(_e=k==null?void 0:k.context)==null?void 0:_e.cart)!=null&&L.id?B({type:"CARTLINE_ADD",payload:{lines:M}}):Qe({lines:M})},linesRemove(M){B({type:"CARTLINE_REMOVE",payload:{lines:M}})},linesUpdate(M){B({type:"CARTLINE_UPDATE",payload:{lines:M}})},noteUpdate(M){B({type:"NOTE_UPDATE",payload:{note:M}})},buyerIdentityUpdate(M){B({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:M}})},cartAttributesUpdate(M){B({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:M}})},discountCodesUpdate(M){B({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:M}})},cartFragment:w}},[Qe,me,(ir=k==null?void 0:k.context)==null?void 0:ir.cart,(or=k==null?void 0:k.context)==null?void 0:or.errors,k.value,w,B]);return React.createElement(_t.Provider,{value:ha},e)}function Br(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Yr(e){const[t,r]=l.useTransition(),[n,a]=l.useState(e),i=l.useRef(!1);t&&(i.current=!0);const o=l.useRef(!1);return!t&&i.current&&(o.current=!0),l.useEffect(()=>{r(()=>{o.current||a(e)})},[e]),o.current?e:n}function je(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 Wr(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 St=l.createContext(null);function Gr({children:e,data:t,initialVariantId:r}){const n=l.useMemo(()=>Q(t.variants??{}),[t.variants]);if(!Kr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const a=l.useMemo(()=>Zr(n),[n]),[i,o]=l.useState(()=>bt(r,n)),[s,u]=l.useState(()=>wt(i));l.useEffect(()=>{const T=bt(r,n);o(T),u(wt(T))},[r,n]);const d=l.useCallback((T,A)=>{u(I=>{const w={...I,[T]:A};return o(Ct(n,w)),w})},[u,n]),y=l.useCallback((T,A)=>{const I=Ct(n,{...s,[T]:A});return(I==null?void 0:I.availableForSale)??!0},[s,n]),f=l.useMemo(()=>Q(t.sellingPlanGroups??{}).map(T=>({...T,sellingPlans:Q((T==null?void 0:T.sellingPlans)??{})})),[t.sellingPlanGroups]),[h,g]=l.useState(void 0),c=l.useMemo(()=>{var T,A;if(!(!i||!h)){if(!((T=i.sellingPlanAllocations)!=null&&T.nodes)&&!((A=i.sellingPlanAllocations)!=null&&A.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return Q(i.sellingPlanAllocations).find(I=>{var w;return((w=I==null?void 0:I.sellingPlan)==null?void 0:w.id)===h.id})}},[i,h]),S=l.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:a,selectedVariant:i,setSelectedVariant:o,selectedOptions:s,setSelectedOption:d,setSelectedOptions:u,isOptionInStock:y,selectedSellingPlan:h,setSelectedSellingPlan:g,selectedSellingPlanAllocation:c,sellingPlanGroups:f,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,y,a,s,h,c,i,f,d,n]);return React.createElement(St.Provider,{value:S},e)}function Tt(){const e=l.useContext(St);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Ct(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(a=>Object.entries(t).every(([i,o])=>{var s;return(s=a==null?void 0:a.selectedOptions)==null?void 0:s.some(u=>(u==null?void 0:u.name)===i&&(u==null?void 0:u.value)===o)}))}function Zr(e){const t=e.reduce((r,n)=>{var a;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(a=n==null?void 0:n.selectedOptions)==null||a.forEach(i=>{r[(i==null?void 0:i.name)??""]=r[(i==null?void 0:i.name)??""]||new Set,r[(i==null?void 0:i.name)??""].add((i==null?void 0:i.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function bt(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 wt(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 Kr(e){return!(!e||!Array.isArray(e))}function be(e){const{as:t,onClick:r,defaultOnClick:n,children:a,buttonRef:i,...o}=e,s=l.useCallback(d=>{if(r){const y=r(d);if(typeof y=="boolean"&&y===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),u=t||"button";return React.createElement(u,{ref:i,onClick:s,...o},a)}function Qr(e){const[t,r]=l.useState(!1),{variantId:n,quantity:a=1,attributes:i,sellingPlanId:o,onClick:s,children:u,accessibleAddingToCartLabel:d,...y}=e,{status:f,linesAdd:h}=ae(),{selectedVariant:g}=Tt(),c=n??(g==null?void 0:g.id)??"",S=n===null||c===""||g===null||t||y.disabled;l.useEffect(()=>{t&&f==="idle"&&r(!1)},[f,t]);const T=l.useCallback(()=>{r(!0),h([{quantity:a,merchandiseId:c||"",attributes:i,sellingPlanId:o}])},[h,a,c,i,o]);return U.createElement(U.Fragment,null,U.createElement(be,{...y,disabled:S,onClick:s,defaultOnClick:T},u),d?U.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?d:null):null)}const te={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},we={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"},At={hydrogen:"hydrogen",headless:"headless"},It={hydrogen:"6167201",headless:"12875497473"};function q(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function x(e){const t={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if(typeof e!="string")return t;try{const{search:r,searchParams:n,pathname:a,hash:i}=new URL(e),o=a.split("/"),s=o[o.length-1],u=o[o.length-2];return!s||!u?t:{id:`${s}${r}${i}`||"",resource:u??null,resourceId:s||null,search:r,searchParams:n,hash:i}}catch{return t}}function j(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Jr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const vt="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function Ae(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=vt.replace(/[x]/g,a=>{const i=r[n]%16,o=a==="x"?i:i&3|8;return n++,o.toString(16)}).toUpperCase()}catch{e=vt.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Xr()}-${e}`}function Xr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}function zr(e){const t=ee(e);return{[Te]:t.uniqueToken,[Ce]:t.visitToken}}const en="trekkie_storefront_page_view/1.4",tn="myshopify.dev";function Pt(e){const t=e,{id:r,resource:n}=x(t.resourceId),a=n?n.toLowerCase():void 0;return[q(en,j({pageType:t.pageType,customerId:parseInt(x(t.customerId).id||"0"),resourceType:a,resourceId:parseInt(r)},rn(t)))]}function rn(e){return{appClientId:e.shopifySalesChannel?It[e.shopifySalesChannel]:It.headless,isMerchantRequest:nn(e.url),hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:Ae(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt(x(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function nn(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(tn)!==-1||t==="localhost"}const an="2025.7.2",G="custom_storefront_customer_tracking/1.2",Ot="page_rendered",Rt="collection_page_rendered",Dt="product_page_rendered",on="product_added_to_cart",kt="search_submitted";function le(e){return{canonical_url:e.canonicalUrl||e.url,customer_id:parseInt(x(e.customerId).id||"0")}}function sn(e){const t=e,r=le(t),n=t.pageType,a=[];switch(a.push(q(G,j({event_name:Ot,...r},Z(t)))),n){case we.collection:a.push(q(G,j({event_name:Rt,...r,collection_name:t.collectionHandle,collection_id:parseInt(x(t.collectionId).id)},Z(t))));break;case we.product:a.push(q(G,j({event_name:Dt,...r,products:qe(t.products),total_value:t.totalValue},Z(t))));break;case we.search:a.push(q(G,j({event_name:kt,...r,search_string:t.searchString},Z(t))));break}return a}function cn(e){const t=e,r=le(t);return[q(G,j({event_name:Ot,...r},Z(t)))]}function un(e){const t=e,r=le(t);return[q(G,j({event_name:Rt,...r,collection_name:t.collectionHandle,collection_id:parseInt(x(t.collectionId).id)},Z(t)))]}function ln(e){const t=e,r=le(t);return[q(G,j({event_name:Dt,...r,products:qe(t.products),total_value:t.totalValue},Z(t)))]}function dn(e){const t=e,r=le(t);return[q(G,j({event_name:kt,...r,search_string:t.searchString},Z(t)))]}function fn(e){const t=e,r=x(t.cartId);return[q(G,j({event_name:on,customerId:t.customerId,cart_token:r!=null&&r.id?`${r.id}`:null,total_value:t.totalValue,products:qe(t.products),customer_id:parseInt(x(t.customerId).id||"0")},Z(t)))]}function Z(e){const t=e;return{source:e.shopifySalesChannel||At.headless,asset_version_id:e.assetVersionId||an,hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",is_persistent_cookie:e.hasUserConsent,deprecated_visit_token:e.visitToken,unique_token:e.uniqueToken,event_time:Date.now(),event_id:Ae(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt(x(e.shopId).id),currency:e.currency,ccpa_enforced:t.ccpaEnforced||!1,gdpr_enforced:t.gdprEnforced||!1,gdpr_enforced_as_string:t.gdprEnforced?"true":"false",analytics_allowed:e.analyticsAllowed||!1,marketing_allowed:e.marketingAllowed||!1,sale_of_data_allowed:e.saleOfDataAllowed||!1}}function qe(e){return e?e.map(t=>{const r=j({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt(x(t.productGid).id),variant_id:parseInt(x(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function hn(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let a=[];const i=n;return r===te.PAGE_VIEW?a=a.concat(Pt(i),sn(i)):r===te.ADD_TO_CART?a=a.concat(fn(n)):r===te.PAGE_VIEW_2?a=a.concat(Pt(i),cn(i)):r===te.COLLECTION_VIEW?a=a.concat(un(i)):r===te.PRODUCT_VIEW?a=a.concat(ln(i)):r===te.SEARCH_VIEW&&(a=a.concat(dn(i))),a.length?gn(a,t):Promise.resolve()}function yn(){return typeof window>"u"||!window.navigator?!1:/Chrome-Lighthouse/.test(window.navigator.userAgent)}const Vt="sendShopifyAnalytics request is unsuccessful";function gn(e,t){if(yn())return Promise.resolve();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(i=>{i.status!==200&&console.error(Vt,`
|
|
325
|
+
`,ne="2026-01",Dr="mock.shop",ut=e=>e.includes(Dr);function kr({storeDomain:e,privateStorefrontToken:t,publicStorefrontToken:r,storefrontApiVersion:n=ne,contentType:a}){if(!e)throw new Error(ke+"`storeDomain` is required when creating a new Storefront client in production.");n!==ne&&Ur(`The Storefront API version that you're using is different than the version this build of Hydrogen React is targeting.
|
|
326
|
+
You may run into unexpected errors if these versions don't match. Received version: "${n}"; expected version "${ne}"`);const i=o=>{const s=(o==null?void 0:o.storeDomain)??e;return s.includes("://")?s:`https://${s}`};return{getShopifyDomain:i,getStorefrontApiUrl(o){const s=i(o);return`${s+(s.endsWith("/")?"api":"/api")}/${(o==null?void 0:o.storefrontApiVersion)??n}/graphql.json`},getPrivateTokenHeaders(o){if(!t&&!(o!=null&&o.privateStorefrontToken)&&!ut(e))throw new Error(ke+"You did not pass in a `privateStorefrontToken` while using `createStorefrontClient()` or `getPrivateTokenHeaders()`");return{"content-type":((o==null?void 0:o.contentType)??a)==="graphql"?"application/graphql":"application/json","X-SDK-Variant":"hydrogen-react","X-SDK-Variant-Source":"react","X-SDK-Version":n,"Shopify-Storefront-Private-Token":(o==null?void 0:o.privateStorefrontToken)??t??"",...o!=null&&o.buyerIp?{"Shopify-Storefront-Buyer-IP":o.buyerIp}:{}}},getPublicTokenHeaders(o){if(!r&&!(o!=null&&o.publicStorefrontToken)&&!ut(e))throw new Error(ke+"You did not pass in a `publicStorefrontToken` while using `createStorefrontClient()` or `getPublicTokenHeaders()`");const s=(o==null?void 0:o.contentType)??a??"json";return lt(s,n,(o==null?void 0:o.publicStorefrontToken)??r??"")}}}function lt(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 dt=new Set,ke="[h2:error:createStorefrontClient] ",Ur=(e,t="warn")=>{dt.has(e)||(console[t](`[h2:${t}:createStorefrontClient] `+e),dt.add(e))},ft={storeDomain:"test",storefrontToken:"abc123",storefrontApiVersion:ne,countryIsoCode:"US",languageIsoCode:"EN",getStorefrontApiUrl(){return""},getPublicTokenHeaders(){return{}},getShopifyDomain(){return""}},ht=l.createContext(ft);function Nr(){var e,t,r;if(typeof window>"u")return!1;try{const n=(t=(e=window.performance)==null?void 0:e.getEntriesByType)==null?void 0:t.call(e,"navigation")[0];return!!((r=n==null?void 0:n.serverTiming)!=null&&r.some(a=>a.name==="_sfapi_proxy"))}catch{return!1}}function Mr({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=l.useMemo(()=>{const n=t.sameDomainForStorefrontApi??Nr();function a(i){const o=(i==null?void 0:i.storeDomain)??t.storeDomain;return o.includes("://")?o:`https://${o}`}return{...t,sameDomainForStorefrontApi:n,getPublicTokenHeaders(i){return lt(i.contentType,t.storefrontApiVersion,i.storefrontToken??t.storefrontToken)},getShopifyDomain:a,getStorefrontApiUrl(i){const o=n&&typeof window<"u"?window.location.origin:a({storeDomain:(i==null?void 0:i.storeDomain)??t.storeDomain});return`${o}${o.endsWith("/")?"":"/"}api/${(i==null?void 0:i.storefrontApiVersion)??t.storefrontApiVersion}/graphql.json`}}},[t]);return React.createElement(ht.Provider,{value:r},e)}function ce(){const e=l.useContext(ht);if(!e)throw new Error("'useShop()' must be a descendent of <ShopifyProvider/>");return e}const Ue="shopifyCartId",yt="Shopify-Storefront-Id",gt="Shopify-Storefront-Y",mt="Shopify-Storefront-S",Ce="_shopify_y",Te="_shopify_s",Ne="X-Shopify-VisitToken",Me="X-Shopify-UniqueToken",Fe={current:null};function ee(){var t,r,n;let e;if(typeof window<"u"&&typeof window.performance<"u")try{const a=/^https?:\/\/([^/]+)(\/api\/(?:unstable|2\d{3}-\d{2})\/graphql\.json(?=$|\?))?/,i=performance.getEntriesByType("resource");let o;for(let s=i.length-1;s>=0;s--){const u=i[s];if(u.initiatorType!=="fetch")continue;const d=window.location.host,y=u.name.match(a);if(!y)continue;const[,f,h]=y;if(f===d||h&&(f==null?void 0:f.endsWith(`.${d}`))){const c=pt(u);if(c){o=c;break}}}if(o&&(e=o),e?Fe.current=e:Fe.current&&(e=Fe.current),!e){const s=performance.getEntriesByType("navigation")[0];e=pt(s,!1)}}catch{}if(!e){const a=typeof arguments[0]=="string"?arguments[0]:typeof document<"u"?document.cookie:"";e={uniqueToken:((t=a.match(/\b_shopify_y=([^;]+)/))==null?void 0:t[1])||"",visitToken:((r=a.match(/\b_shopify_s=([^;]+)/))==null?void 0:r[1])||"",consent:((n=a.match(/\b_tracking_consent=([^;]+)/))==null?void 0:n[1])||""}}return e}function pt(e,t=!0){let r="",n="",a="";const i=e.serverTiming;if(i&&i.length>=3)for(let o=i.length-1;o>=0;o--){const{name:s,description:u}=i[o];if(!(!s||!u)&&(s==="_y"?r=u:s==="_s"?n=u:s==="_cmp"&&(a=u),r&&n&&a))break}return r&&n&&(!t||a)?{uniqueToken:r,visitToken:n,consent:a}:void 0}function Fr(){const{storefrontId:e,getPublicTokenHeaders:t,getStorefrontApiUrl:r,sameDomainForStorefrontApi:n}=ce();return l.useCallback(({query:a,variables:i})=>{const o=t({contentType:"json"});if(e&&(o[yt]=e),!n){const{uniqueToken:s,visitToken:u}=ee();s&&(o[gt]=s,o[Me]=s),u&&(o[mt]=u,o[Ne]=u)}return fetch(r(),{method:"POST",headers:o,body:JSON.stringify({query:a.toString(),variables:i})}).then(s=>s.json()).catch(s=>({data:void 0,errors:s==null?void 0:s.toString()}))},[t,e,r,n])}function Lr({numCartLines:e,cartFragment:t,countryCode:r="US",languageCode:n="EN"}){const a=Fr(),i=l.useCallback(c=>a({query:Rr(t),variables:{id:c,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),o=l.useCallback(c=>a({query:br(t),variables:{input:c,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),s=l.useCallback((c,_)=>a({query:Tr(t),variables:{cartId:c,lines:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),u=l.useCallback((c,_)=>a({query:wr(t),variables:{cartId:c,lines:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),d=l.useCallback((c,_)=>a({query:vr(t),variables:{cartId:c,lines:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),y=l.useCallback((c,_)=>a({query:Ar(t),variables:{cartId:c,note:_,numCartLines:e,country:r,language:n}}),[a,t,e,r,n]),f=l.useCallback((c,_)=>a({query:Ir(t),variables:{cartId:c,buyerIdentity:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),h=l.useCallback((c,_)=>a({query:Pr(t),variables:{cartId:c,attributes:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]),g=l.useCallback((c,_)=>a({query:Or(t),variables:{cartId:c,discountCodes:_,numCartLines:e,country:r,language:n}}),[t,r,a,e,n]);return l.useMemo(()=>({cartFetch:i,cartCreate:o,cartLineAdd:s,cartLineUpdate:u,cartLineRemove:d,noteUpdate:y,buyerIdentityUpdate:f,cartAttributesUpdate:h,discountCodesUpdate:g,cartFragment:t}),[i,o,s,u,d,y,f,h,g,t])}function Y(e,t){return{entry:[...(t==null?void 0:t.entryActions)||[],re({lastValidCart:r=>r==null?void 0:r.cart}),"onCartActionEntry","onCartActionOptimisticUI",e],on:{RESOLVE:{target:(t==null?void 0:t.resolveTarget)||"idle",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.cart},rawCartResult:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.rawCartResult},errors:r=>{}})]},ERROR:{target:(t==null?void 0:t.errorTarget)||"error",actions:[re({prevCart:r=>r==null?void 0:r.lastValidCart,cart:r=>r==null?void 0:r.lastValidCart,errors:(r,n)=>{var a;return(a=n==null?void 0:n.payload)==null?void 0:a.errors}})]},CART_COMPLETED:{target:"cartCompleted",actions:re({prevCart:r=>{},cart:r=>{},lastValidCart:r=>{},rawCartResult:r=>{},errors:r=>{}})}},exit:["onCartActionComplete",...(t==null?void 0:t.exitActions)||[]]}}const ue={CART_FETCH:{target:"cartFetching"},CART_CREATE:{target:"cartCreating"},CART_SET:{target:"idle",actions:[re({rawCartResult:(e,t)=>t.payload.cart,cart:(e,t)=>Le(t.payload.cart)})]}},Et={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 $r(e){return nt({id:"Cart",initial:e?"idle":"uninitialized",context:{cart:e&&Le(e)},states:{uninitialized:{on:ue},cartCompleted:{on:ue},initializationError:{on:ue},idle:{on:{...ue,...Et}},error:{on:{...ue,...Et}},cartFetching:Y("cartFetchAction",{errorTarget:"initializationError"}),cartCreating:Y("cartCreateAction",{errorTarget:"initializationError"}),cartLineRemoving:Y("cartLineRemoveAction"),cartLineUpdating:Y("cartLineUpdateAction"),cartLineAdding:Y("cartLineAddAction"),noteUpdating:Y("noteUpdateAction"),buyerIdentityUpdating:Y("buyerIdentityUpdateAction"),cartAttributesUpdating:Y("cartAttributesUpdateAction"),discountCodesUpdating:Y("discountCodesUpdateAction")}})}function xr({numCartLines:e,onCartActionEntry:t,onCartActionOptimisticUI:r,onCartActionComplete:n,data:a,cartFragment:i,countryCode:o,languageCode:s}){const{cartFetch:u,cartCreate:d,cartLineAdd:y,cartLineUpdate:f,cartLineRemove:h,noteUpdate:g,buyerIdentityUpdate:c,cartAttributesUpdate:_,discountCodesUpdate:C}=Lr({numCartLines:e,cartFragment:i,countryCode:o,languageCode:s}),v=l.useMemo(()=>$r(a),[a]),[A,w,I]=_r(v,{actions:{cartFetchAction:async(p,m)=>{var b;if(m.type!=="CART_FETCH")return;const{data:E,errors:P}=await u((b=m==null?void 0:m.payload)==null?void 0:b.cartId),R=W(m,E==null?void 0:E.cart,P);w(R)},cartCreateAction:async(p,m)=>{var b;if(m.type!=="CART_CREATE")return;const{data:E,errors:P}=await d(m==null?void 0:m.payload),R=W(m,(b=E==null?void 0:E.cartCreate)==null?void 0:b.cart,P);w(R)},cartLineAddAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_ADD"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await y(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesAdd)==null?void 0:O.cart,P);w(R)},cartLineUpdateAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await f(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesUpdate)==null?void 0:O.cart,P);w(R)},cartLineRemoveAction:async(p,m)=>{var b,O;if(m.type!=="CARTLINE_REMOVE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await h(p.cart.id,m.payload.lines),R=W(m,(O=E==null?void 0:E.cartLinesRemove)==null?void 0:O.cart,P);w(R)},noteUpdateAction:async(p,m)=>{var b,O;if(m.type!=="NOTE_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await g(p.cart.id,m.payload.note),R=W(m,(O=E==null?void 0:E.cartNoteUpdate)==null?void 0:O.cart,P);w(R)},buyerIdentityUpdateAction:async(p,m)=>{var b,O;if(m.type!=="BUYER_IDENTITY_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await c(p.cart.id,m.payload.buyerIdentity),R=W(m,(O=E==null?void 0:E.cartBuyerIdentityUpdate)==null?void 0:O.cart,P);w(R)},cartAttributesUpdateAction:async(p,m)=>{var b,O;if(m.type!=="CART_ATTRIBUTES_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await _(p.cart.id,m.payload.attributes),R=W(m,(O=E==null?void 0:E.cartAttributesUpdate)==null?void 0:O.cart,P);w(R)},discountCodesUpdateAction:async(p,m)=>{var b,O;if(m.type!=="DISCOUNT_CODES_UPDATE"||!((b=p==null?void 0:p.cart)!=null&&b.id))return;const{data:E,errors:P}=await C(p.cart.id,m.payload.discountCodes),R=W(m,(O=E==null?void 0:E.cartDiscountCodesUpdate)==null?void 0:O.cart,P);w(R)},...t&&{onCartActionEntry:(p,m)=>{jr(m)&&t(p,m)}},...r&&{onCartActionOptimisticUI:re((p,m)=>r(p,m))},...n&&{onCartActionComplete:(p,m)=>{qr(m)&&n(p,m)}}}});return l.useMemo(()=>[A,w,I],[A,w,I])}function Le(e){return{...e,lines:Q(e==null?void 0:e.lines),note:e.note??void 0}}function W(e,t,r){return r?{type:"ERROR",payload:{errors:r,cartActionEvent:e}}:t?{type:"RESOLVE",payload:{cart:Le(t),rawCartResult:t,cartActionEvent:e}}:{type:"CART_COMPLETED",payload:{cartActionEvent:e}}}function jr(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 qr(e){return e.type==="RESOLVE"||e.type==="ERROR"||e.type==="CART_COMPLETED"}const _t=l.createContext(null);function ae(){const e=l.useContext(_t);if(!e)throw new Error("Expected a Cart Context, but no Cart Context was found");return e}function Hr({children:e,numCartLines:t,onCreate:r,onLineAdd:n,onLineRemove:a,onLineUpdate:i,onNoteUpdate:o,onBuyerIdentityUpdate:s,onAttributesUpdate:u,onDiscountCodesUpdate:d,onCreateComplete:y,onLineAddComplete:f,onLineRemoveComplete:h,onLineUpdateComplete:g,onNoteUpdateComplete:c,onBuyerIdentityUpdateComplete:_,onAttributesUpdateComplete:C,onDiscountCodesUpdateComplete:v,data:A,cartFragment:w=Vr,customerAccessToken:I,countryCode:p,languageCode:m}){var er,tr,rr,nr,ar,ir,or;const E=ce();if(!E)throw new Error("<CartProvider> needs to be a descendant of <ShopifyProvider>");p=(p??E.countryIsoCode??"US").toUpperCase(),m=(m??E.languageIsoCode??"EN").toUpperCase(),p&&(p=p.toUpperCase());const[P,R]=l.useState(p),[b,O]=l.useState(I),q=l.useRef(!1);(P!==p||b!==I)&&(R(p),O(I),q.current=!1);const[V,H]=xr({numCartLines:t,data:A,cartFragment:w,countryCode:p,languageCode:m,onCartActionEntry(T,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 a==null?void 0:a();case"CARTLINE_UPDATE":return i==null?void 0:i();case"NOTE_UPDATE":return o==null?void 0:o();case"BUYER_IDENTITY_UPDATE":return s==null?void 0:s();case"CART_ATTRIBUTES_UPDATE":return u==null?void 0:u();case"DISCOUNT_CODES_UPDATE":return d==null?void 0:d()}}catch(F){console.error("Cart entry action failed",F)}},onCartActionOptimisticUI(T,N){var F,K,M,_e;if(!T.cart)return{...T};switch(N.type){case"CARTLINE_REMOVE":return{...T,cart:{...T.cart,lines:(K=(F=T==null?void 0:T.cart)==null?void 0:F.lines)==null?void 0:K.filter(L=>(L==null?void 0:L.id)&&!N.payload.lines.includes(L==null?void 0:L.id))}};case"CARTLINE_UPDATE":return{...T,cart:{...T.cart,lines:(_e=(M=T==null?void 0:T.cart)==null?void 0:M.lines)==null?void 0:_e.map(L=>{const Qe=N.payload.lines.find(({id:ya})=>ya===(L==null?void 0:L.id));return Qe&&Qe.quantity?{...L,quantity:Qe.quantity}:L})}}}return{...T}},onCartActionComplete(T,N){const F=N.payload.cartActionEvent;try{switch(N.type){case"RESOLVE":switch(F.type){case"CART_CREATE":return y==null?void 0:y();case"CARTLINE_ADD":return f==null?void 0:f();case"CARTLINE_REMOVE":return h==null?void 0:h();case"CARTLINE_UPDATE":return g==null?void 0:g();case"NOTE_UPDATE":return c==null?void 0:c();case"BUYER_IDENTITY_UPDATE":return Wr(T,F)&&(q.current=!0),_==null?void 0:_();case"CART_ATTRIBUTES_UPDATE":return C==null?void 0:C();case"DISCOUNT_CODES_UPDATE":return v==null?void 0:v()}}}catch(K){console.error("onCartActionComplete failed",K)}}}),X=l.useRef(!1),[me,k]=l.useState(!1),se=V.matches("cartCompleted"),pe=(V.value==="idle"||V.value==="error"||V.value==="cartCompleted")&&p!==((rr=(tr=(er=V==null?void 0:V.context)==null?void 0:er.cart)==null?void 0:tr.buyerIdentity)==null?void 0:rr.countryCode)&&!V.context.errors,Ee=l.useRef(!1);l.useEffect(()=>{if(!X.current&&!Ee.current){if(!A&&$e("localStorage")){Ee.current=!0;try{const T=window.localStorage.getItem(Ue);T&&H({type:"CART_FETCH",payload:{cartId:T}})}catch(T){console.warn("error fetching cartId"),console.warn(T)}}X.current=!0,k(!0)}},[A,X,H]),l.useEffect(()=>{!pe||q.current||H({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:{countryCode:p,customerAccessToken:I}}})},[p,I,pe,q,H]);const B=l.useCallback(T=>{if(!X.current)return console.warn("Cart isn't ready yet");H(T)},[H]);l.useEffect(()=>{var T,N,F;if((N=(T=V==null?void 0:V.context)==null?void 0:T.cart)!=null&&N.id&&$e("localStorage"))try{window.localStorage.setItem(Ue,(F=V.context.cart)==null?void 0:F.id)}catch(K){console.warn("Failed to save cartId to localStorage",K)}},[(ar=(nr=V==null?void 0:V.context)==null?void 0:nr.cart)==null?void 0:ar.id]),l.useEffect(()=>{if(se&&$e("localStorage"))try{window.localStorage.removeItem(Ue)}catch(T){console.warn("Failed to delete cartId from localStorage",T)}},[se]);const Ke=l.useCallback(T=>{var N,F;p&&!((N=T.buyerIdentity)!=null&&N.countryCode)&&(T.buyerIdentity==null&&(T.buyerIdentity={}),T.buyerIdentity.countryCode=p),I&&!((F=T.buyerIdentity)!=null&&F.customerAccessToken)&&(T.buyerIdentity==null&&(T.buyerIdentity={}),T.buyerIdentity.customerAccessToken=I),B({type:"CART_CREATE",payload:T})},[p,I,B]),D=Yr(V),ha=l.useMemo(()=>{var T,N,F,K;return{...((T=D==null?void 0:D.context)==null?void 0:T.cart)??{lines:[],attributes:[]},status:Br(D.value),error:(N=D==null?void 0:D.context)==null?void 0:N.errors,totalQuantity:((K=(F=D==null?void 0:D.context)==null?void 0:F.cart)==null?void 0:K.totalQuantity)??0,cartCreate:Ke,cartReady:me,linesAdd(M){var _e,L;(L=(_e=D==null?void 0:D.context)==null?void 0:_e.cart)!=null&&L.id?B({type:"CARTLINE_ADD",payload:{lines:M}}):Ke({lines:M})},linesRemove(M){B({type:"CARTLINE_REMOVE",payload:{lines:M}})},linesUpdate(M){B({type:"CARTLINE_UPDATE",payload:{lines:M}})},noteUpdate(M){B({type:"NOTE_UPDATE",payload:{note:M}})},buyerIdentityUpdate(M){B({type:"BUYER_IDENTITY_UPDATE",payload:{buyerIdentity:M}})},cartAttributesUpdate(M){B({type:"CART_ATTRIBUTES_UPDATE",payload:{attributes:M}})},discountCodesUpdate(M){B({type:"DISCOUNT_CODES_UPDATE",payload:{discountCodes:M}})},cartFragment:w}},[Ke,me,(ir=D==null?void 0:D.context)==null?void 0:ir.cart,(or=D==null?void 0:D.context)==null?void 0:or.errors,D.value,w,B]);return React.createElement(_t.Provider,{value:ha},e)}function Br(e){switch(e){case"uninitialized":case"initializationError":return"uninitialized";case"idle":case"cartCompleted":case"error":return"idle";case"cartFetching":return"fetching";case"cartCreating":return"creating";case"cartLineAdding":case"cartLineRemoving":case"cartLineUpdating":case"noteUpdating":case"buyerIdentityUpdating":case"cartAttributesUpdating":case"discountCodesUpdating":return"updating"}}function Yr(e){const[t,r]=l.useTransition(),[n,a]=l.useState(e),i=l.useRef(!1);t&&(i.current=!0);const o=l.useRef(!1);return!t&&i.current&&(o.current=!0),l.useEffect(()=>{r(()=>{o.current||a(e)})},[e]),o.current?e:n}function $e(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 Wr(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 St=l.createContext(null);function Gr({children:e,data:t,initialVariantId:r}){const n=l.useMemo(()=>Q(t.variants??{}),[t.variants]);if(!Kr(n))throw new Error("<ProductProvider/> requires 'product.variants.nodes' or 'product.variants.edges'");const a=l.useMemo(()=>Zr(n),[n]),[i,o]=l.useState(()=>bt(r,n)),[s,u]=l.useState(()=>vt(i));l.useEffect(()=>{const C=bt(r,n);o(C),u(vt(C))},[r,n]);const d=l.useCallback((C,v)=>{u(A=>{const w={...A,[C]:v};return o(Tt(n,w)),w})},[u,n]),y=l.useCallback((C,v)=>{const A=Tt(n,{...s,[C]:v});return(A==null?void 0:A.availableForSale)??!0},[s,n]),f=l.useMemo(()=>Q(t.sellingPlanGroups??{}).map(C=>({...C,sellingPlans:Q((C==null?void 0:C.sellingPlans)??{})})),[t.sellingPlanGroups]),[h,g]=l.useState(void 0),c=l.useMemo(()=>{var C,v;if(!(!i||!h)){if(!((C=i.sellingPlanAllocations)!=null&&C.nodes)&&!((v=i.sellingPlanAllocations)!=null&&v.edges))throw new Error("<ProductProvider/>: You must include 'sellingPlanAllocations.nodes' or 'sellingPlanAllocations.edges' in your variants in order to calculate selectedSellingPlanAllocation");return Q(i.sellingPlanAllocations).find(A=>{var w;return((w=A==null?void 0:A.sellingPlan)==null?void 0:w.id)===h.id})}},[i,h]),_=l.useMemo(()=>({product:t,variants:n,variantsConnection:t.variants,options:a,selectedVariant:i,setSelectedVariant:o,selectedOptions:s,setSelectedOption:d,setSelectedOptions:u,isOptionInStock:y,selectedSellingPlan:h,setSelectedSellingPlan:g,selectedSellingPlanAllocation:c,sellingPlanGroups:f,sellingPlanGroupsConnection:t.sellingPlanGroups}),[t,y,a,s,h,c,i,f,d,n]);return React.createElement(St.Provider,{value:_},e)}function Ct(){const e=l.useContext(St);if(!e)throw new Error("'useProduct' must be a child of <ProductProvider />");return e}function Tt(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(a=>Object.entries(t).every(([i,o])=>{var s;return(s=a==null?void 0:a.selectedOptions)==null?void 0:s.some(u=>(u==null?void 0:u.name)===i&&(u==null?void 0:u.value)===o)}))}function Zr(e){const t=e.reduce((r,n)=>{var a;if(!n.selectedOptions)throw new Error("'getOptions' requires 'variant.selectedOptions'");return(a=n==null?void 0:n.selectedOptions)==null||a.forEach(i=>{r[(i==null?void 0:i.name)??""]=r[(i==null?void 0:i.name)??""]||new Set,r[(i==null?void 0:i.name)??""].add((i==null?void 0:i.value)??"")}),r},{});return Object.keys(t).map(r=>({name:r,values:Array.from(t[r])}))}function bt(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 vt(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 Kr(e){return!(!e||!Array.isArray(e))}function be(e){const{as:t,onClick:r,defaultOnClick:n,children:a,buttonRef:i,...o}=e,s=l.useCallback(d=>{if(r){const y=r(d);if(typeof y=="boolean"&&y===!1||d!=null&&d.defaultPrevented)return}n==null||n(d)},[n,r]),u=t||"button";return React.createElement(u,{ref:i,onClick:s,...o},a)}function Qr(e){const[t,r]=l.useState(!1),{variantId:n,quantity:a=1,attributes:i,sellingPlanId:o,onClick:s,children:u,accessibleAddingToCartLabel:d,parent:y,...f}=e,{status:h,linesAdd:g}=ae(),{selectedVariant:c}=Ct(),_=n??(c==null?void 0:c.id)??"",C=n===null||_===""||c===null||t||f.disabled;l.useEffect(()=>{t&&h==="idle"&&r(!1)},[h,t]);const v=l.useCallback(()=>{r(!0),g([{quantity:a,merchandiseId:_||"",attributes:i,parent:y,sellingPlanId:o}])},[g,a,_,i,o,y]);return U.createElement(U.Fragment,null,U.createElement(be,{...f,disabled:C,onClick:s,defaultOnClick:v},u),d?U.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?d:null):null)}const te={PAGE_VIEW:"PAGE_VIEW",ADD_TO_CART:"ADD_TO_CART",PAGE_VIEW_2:"PAGE_VIEW_2",COLLECTION_VIEW:"COLLECTION_VIEW",PRODUCT_VIEW:"PRODUCT_VIEW",SEARCH_VIEW:"SEARCH_VIEW"},ve={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"},wt={hydrogen:"hydrogen",headless:"headless"},At={hydrogen:"6167201",headless:"12875497473"};function j(e,t){return{schema_id:e,payload:t,metadata:{event_created_at_ms:Date.now()}}}function $(e){const t={id:"",resource:null,resourceId:null,search:"",searchParams:new URLSearchParams,hash:""};if(typeof e!="string")return t;try{const{search:r,searchParams:n,pathname:a,hash:i}=new URL(e),o=a.split("/"),s=o[o.length-1],u=o[o.length-2];return!s||!u?t:{id:`${s}${r}${i}`||"",resource:u??null,resourceId:s||null,search:r,searchParams:n,hash:i}}catch{return t}}function x(e,t){return typeof e!="object"?{}:(Object.entries(e).forEach(([r,n])=>{n&&(t[r]=n)}),t)}function Jr(e){return typeof document>"u"?(console.error(`${e} should only be used within the useEffect callback or event handlers`),!0):!1}const It="xxxx-4xxx-xxxx-xxxxxxxxxxxx";function we(){let e="";try{const t=window.crypto,r=new Uint16Array(31);t.getRandomValues(r);let n=0;e=It.replace(/[x]/g,a=>{const i=r[n]%16,o=a==="x"?i:i&3|8;return n++,o.toString(16)}).toUpperCase()}catch{e=It.replace(/[x]/g,r=>{const n=Math.random()*16|0;return(r==="x"?n:n&3|8).toString(16)}).toUpperCase()}return`${Xr()}-${e}`}function Xr(){let e=0,t=0;e=new Date().getTime()>>>0;try{t=performance.now()>>>0}catch{t=0}return Math.abs(e+t).toString(16).toLowerCase().padStart(8,"0")}function zr(e){const t=ee(e);return{[Ce]:t.uniqueToken,[Te]:t.visitToken}}const en="trekkie_storefront_page_view/1.4",tn="myshopify.dev";function Pt(e){const t=e,{id:r,resource:n}=$(t.resourceId),a=n?n.toLowerCase():void 0;return[j(en,x({pageType:t.pageType,customerId:parseInt($(t.customerId).id||"0"),resourceType:a,resourceId:parseInt(r)},rn(t)))]}function rn(e){return{appClientId:e.shopifySalesChannel?At[e.shopifySalesChannel]:At.headless,isMerchantRequest:nn(e.url),hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",isPersistentCookie:e.hasUserConsent,uniqToken:e.uniqueToken,visitToken:e.visitToken,microSessionId:we(),microSessionCount:1,url:e.url,path:e.path,search:e.search,referrer:e.referrer,title:e.title,shopId:parseInt($(e.shopId).id),currency:e.currency,contentLanguage:e.acceptedLanguage||"en"}}function nn(e){if(typeof e!="string")return!1;const t=new URL(e).hostname;return t.indexOf(tn)!==-1||t==="localhost"}const an="2026.1.0",G="custom_storefront_customer_tracking/1.2",Ot="page_rendered",Rt="collection_page_rendered",Vt="product_page_rendered",on="product_added_to_cart",Dt="search_submitted";function le(e){return{canonical_url:e.canonicalUrl||e.url,customer_id:parseInt($(e.customerId).id||"0")}}function sn(e){const t=e,r=le(t),n=t.pageType,a=[];switch(a.push(j(G,x({event_name:Ot,...r},Z(t)))),n){case ve.collection:a.push(j(G,x({event_name:Rt,...r,collection_name:t.collectionHandle,collection_id:parseInt($(t.collectionId).id)},Z(t))));break;case ve.product:a.push(j(G,x({event_name:Vt,...r,products:xe(t.products),total_value:t.totalValue},Z(t))));break;case ve.search:a.push(j(G,x({event_name:Dt,...r,search_string:t.searchString},Z(t))));break}return a}function cn(e){const t=e,r=le(t);return[j(G,x({event_name:Ot,...r},Z(t)))]}function un(e){const t=e,r=le(t);return[j(G,x({event_name:Rt,...r,collection_name:t.collectionHandle,collection_id:parseInt($(t.collectionId).id)},Z(t)))]}function ln(e){const t=e,r=le(t);return[j(G,x({event_name:Vt,...r,products:xe(t.products),total_value:t.totalValue},Z(t)))]}function dn(e){const t=e,r=le(t);return[j(G,x({event_name:Dt,...r,search_string:t.searchString},Z(t)))]}function fn(e){const t=e,r=$(t.cartId);return[j(G,x({event_name:on,customerId:t.customerId,cart_token:r!=null&&r.id?`${r.id}`:null,total_value:t.totalValue,products:xe(t.products),customer_id:parseInt($(t.customerId).id||"0")},Z(t)))]}function Z(e){const t=e;return{source:e.shopifySalesChannel||wt.headless,asset_version_id:e.assetVersionId||an,hydrogenSubchannelId:e.storefrontId||e.hydrogenSubchannelId||"0",is_persistent_cookie:e.hasUserConsent,deprecated_visit_token:e.visitToken,unique_token:e.uniqueToken,event_time:Date.now(),event_id:we(),event_source_url:e.url,referrer:e.referrer,user_agent:e.userAgent,navigation_type:e.navigationType,navigation_api:e.navigationApi,shop_id:parseInt($(e.shopId).id),currency:e.currency,ccpa_enforced:t.ccpaEnforced||!1,gdpr_enforced:t.gdprEnforced||!1,gdpr_enforced_as_string:t.gdprEnforced?"true":"false",analytics_allowed:e.analyticsAllowed||!1,marketing_allowed:e.marketingAllowed||!1,sale_of_data_allowed:e.saleOfDataAllowed||!1}}function xe(e){return e?e.map(t=>{const r=x({variant_gid:t.variantGid,category:t.category,sku:t.sku,product_id:parseInt($(t.productGid).id),variant_id:parseInt($(t.variantGid).id)},{product_gid:t.productGid,name:t.name,variant:t.variantName||"",brand:t.brand,price:parseFloat(t.price),quantity:Number(t.quantity||0)});return JSON.stringify(r)}):[]}function hn(e,t){const{eventName:r,payload:n}=e;if(!n.hasUserConsent)return Promise.resolve();let a=[];const i=n;return r===te.PAGE_VIEW?a=a.concat(Pt(i),sn(i)):r===te.ADD_TO_CART?a=a.concat(fn(n)):r===te.PAGE_VIEW_2?a=a.concat(Pt(i),cn(i)):r===te.COLLECTION_VIEW?a=a.concat(un(i)):r===te.PRODUCT_VIEW?a=a.concat(ln(i)):r===te.SEARCH_VIEW&&(a=a.concat(dn(i))),a.length?gn(a,t):Promise.resolve()}function yn(){return typeof window>"u"||!window.navigator?!1:/Chrome-Lighthouse/.test(window.navigator.userAgent)}const kt="sendShopifyAnalytics request is unsuccessful";function gn(e,t){if(yn())return Promise.resolve();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(i=>{i.status!==200&&console.error(kt,`
|
|
273
327
|
|
|
274
|
-
`,i.message)})}).catch(n=>{console.error(Vt,n)})}catch{return Promise.resolve()}}function mn(){if(Jr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=_n(),r=ee();return{uniqueToken:r.uniqueToken,visitToken:r.visitToken,url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function pn(){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 En(){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 _n(){try{let e="PerformanceNavigationTiming",t=pn();return t||(t=En(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function Sn(e){const{cartCreate:t,checkoutUrl:r}=ae(),[n,a]=l.useState(!1),{quantity:i,variantId:o,sellingPlanId:s,onClick:u,attributes:d,children:y,...f}=e;l.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const h=l.useCallback(()=>{a(!0),t({lines:[{quantity:i??1,merchandiseId:o,attributes:d,sellingPlanId:s}]})},[t,i,o,d,s]);return React.createElement(be,{disabled:n??f.disabled,...f,onClick:u,defaultOnClick:h},y)}function Tn(e){const[t,r]=l.useState(!1),{status:n,checkoutUrl:a}=ae(),{children:i,...o}=e;return l.useEffect(()=>{t&&a&&n==="idle"&&(window.location.href=a)},[t,n,a]),React.createElement(be,{...o,disabled:t||o.disabled,onClick:()=>r(!0)},i)}function Ut(e){const{countryIsoCode:t,languageIsoCode:r}=ce(),n=r.includes("_")?r.replace("_","-"):`${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 a=parseFloat(e.amount);let i=!0;try{new Intl.NumberFormat(n,{style:"currency",currency:e.currencyCode})}catch(c){c instanceof RangeError&&c.message.includes("currency")&&(i=!1)}const{defaultFormatter:o,nameFormatter:s,narrowSymbolFormatter:u,withoutTrailingZerosFormatter:d,withoutCurrencyFormatter:y,withoutTrailingZerosOrCurrencyFormatter:f}=l.useMemo(()=>{const c=i?{style:"currency",currency:e.currencyCode}:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2};return{defaultFormatter:ie(n,c),nameFormatter:ie(n,{...c,currencyDisplay:"name"}),narrowSymbolFormatter:ie(n,{...c,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:ie(n,{...c,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:ie(n,{minimumFractionDigits:2,maximumFractionDigits:2}),withoutTrailingZerosOrCurrencyFormatter:ie(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n,i]),h=c=>c.type==="currency",g=l.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>{const c=o().format(a);return i?c:`${c} ${e.currencyCode}`},parts:()=>{const c=o().formatToParts(a);return i||c.push({type:"literal",value:" "},{type:"currency",value:e.currencyCode}),c},withoutTrailingZeros:()=>{const c=a%1===0?d().format(a):o().format(a);return i?c:`${c} ${e.currencyCode}`},withoutTrailingZerosAndCurrency:()=>a%1===0?f().format(a):y().format(a),currencyName:()=>{var c;return((c=s().formatToParts(a).find(h))==null?void 0:c.value)??e.currencyCode},currencySymbol:()=>{var c;return((c=o().formatToParts(a).find(h))==null?void 0:c.value)??e.currencyCode},currencyNarrowSymbol:()=>{var c;return((c=u().formatToParts(a).find(h))==null?void 0:c.value)??""},amount:()=>o().formatToParts(a).filter(c=>["decimal","fraction","group","integer","literal"].includes(c.type)).map(c=>c.value).join("")}),[e,a,i,s,o,u,y,d,f]);return l.useMemo(()=>new Proxy(g,{get:(c,S)=>{var T;return(T=Reflect.get(c,S))==null?void 0:T.call(null)}}),[g])}const Nt=new Map;function ie(e,t){const r=JSON.stringify([e,t]);return function(){let n=Nt.get(r);if(!n){try{n=new Intl.NumberFormat(e,t)}catch(a){if(a instanceof RangeError&&a.message.includes("currency")){const i={...t};delete i.currency,delete i.currencyDisplay,delete i.currencySign,n=new Intl.NumberFormat(e,i)}else throw a}Nt.set(r,n)}return n}}function Ie({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:a,measurementSeparator:i="/",...o}){if(!Cn(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const s=Ut(e),u=t??"div";let d=s.localizedString;return(r||n)&&(r&&!n?d=s.amount:!r&&n?d=s.withoutTrailingZeros:d=s.withoutTrailingZerosAndCurrency),React.createElement(u,{...o},d,a&&a.referenceUnit&&React.createElement(React.Fragment,null,i,a.referenceUnit))}function Cn(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function bn(e){const{cost:t}=ae(),{amountType:r="total",children:n,...a}=e;let i;return r=="total"?i=t==null?void 0:t.totalAmount:r=="subtotal"?i=t==null?void 0:t.subtotalAmount:r=="tax"?i=t==null?void 0:t.totalTaxAmount:r=="duty"&&(i=t==null?void 0:t.totalDutyAmount),i==null?null:React.createElement(Ie,{...a,data:i},n)}const Mt=l.createContext(null);function He(){const e=l.useContext(Mt);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function wn({children:e,line:t}){return React.createElement(Mt.Provider,{value:t},e)}function An(e){const t=He(),{as:r,...n}=e,a=r||"span";return React.createElement(a,{...n},t.quantity)}function In(e){const{status:t,linesRemove:r,linesUpdate:n}=ae(),a=He(),{children:i,adjust:o,onClick:s,...u}=e,d=l.useCallback(()=>{if(o==="remove"){r([(a==null?void 0:a.id)??""]);return}const f=o==="decrease"?((a==null?void 0:a.quantity)??0)-1:((a==null?void 0:a.quantity)??0)+1;if(f<=0){r([(a==null?void 0:a.id)??""]);return}const h={id:(a==null?void 0:a.id)??"",quantity:f,attributes:(a==null?void 0:a.attributes)??[]};n([h])},[o,a==null?void 0:a.attributes,a==null?void 0:a.id,a==null?void 0:a.quantity,r,n]),y=u.disabled;return React.createElement(be,{...u,onClick:s,defaultOnClick:d,disabled:typeof y<"u"?y:t!=="idle"},i)}const vn={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"},Pn={DateTime:"string",Decimal:"string",HTML:"string",ISO8601DateTime:"string",URL:"string",UnsignedInt64:"string"},Ft=l.forwardRef((e,t)=>{const{data:r,options:n,id:a=r.id,frameBorder:i="0",allow:o="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:u="lazy",...d}=e;if(!r.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let y=r.embedUrl;if(n){const f=new URL(r.embedUrl);for(const[h,g]of Object.entries(n))typeof g>"u"||f.searchParams.set(h,g.toString());y=f.toString()}return React.createElement("iframe",{...d,id:a??r.embedUrl,title:r.alt??r.id??"external video",frameBorder:i,allow:o,allowFullScreen:s,src:y,loading:u,ref:t})}),$e=",",oe={OPTION:":",END_OF_PREFIX:",",SEQUENCE_GAP:" ",RANGE:"-"},Be=(()=>{const e=new Map;return function(t,r){var n;if(t.length===0)return!1;if(!e.has(r)){const a=new Set;for(const i of Lt(r)){a.add(i.join($e));for(let o=0;o<i.length;o++)a.add(i.slice(0,o+1).join($e))}e.set(r,a)}return!!((n=e.get(r))!=null&&n.has(t.join($e)))}})();function Lt(e){if(!e)return[];if(e.startsWith("v1_"))return Rn(On(e));throw new Error("Unsupported option value encoding")}const On=e=>e.replace(/^v1_/,"");function Rn(e){const t=/[ :,-]/g;let r=0,n;const a=[],i=[];let o=0,s=null;for(;n=t.exec(e);){const d=n[0],y=Number.parseInt(e.slice(r,n.index))||0;if(s!==null){for(;s<y;s++)i[o]=s,a.push([...i]);s=null}i[o]=y,d===oe.RANGE?s=y:d===oe.OPTION?o++:((d===oe.SEQUENCE_GAP||d===oe.END_OF_PREFIX&&e[n.index-1]!==oe.END_OF_PREFIX)&&a.push([...i]),d===oe.END_OF_PREFIX&&(i.pop(),o--)),r=t.lastIndex}const u=e.match(/\d+$/g);if(u){const d=parseInt(u[0]);if(s!=null)for(;s<=d;s++)i[o]=s,a.push([...i]);else a.push([d])}return a}function Dn(e){return Object.assign({},...e.map(t=>({[t.name]:Object.assign({},...t!=null&&t.optionValues?t.optionValues.map((r,n)=>({[r.name]:n})):[])})))}function de(e){return Object.assign({},...e.map(t=>({[t.name]:t.value})))}function Ye(e){return JSON.stringify(de(e))}function xt(e){return Array.isArray(e)?JSON.stringify(Object.assign({},...e.map(t=>({[t.name]:t.value})))):JSON.stringify(e)}function kn(e,t){return Object.keys(e).map(n=>t[n]?t[n][e[n]]:null).filter(n=>n!==null)}function Vn(e){return Object.assign({},...e.map(t=>({[xt(t.selectedOptions||[])]:t})))}const jt=["options","selectedOrFirstAvailableVariant","adjacentVariants"],Un=["handle","encodedVariantExistence","encodedVariantAvailability"];function J(e){return console.error(`[h2:error:getProductOptions] product.${e} is missing. Make sure you query for this field from the Storefront API.`),!1}function qt(e,t=!1){var a;let r=!0;const n=Object.keys(e);if((t?[...jt,...Un]:jt).forEach(i=>{n.includes(i)||(r=J(i))}),e.options){const i=e==null?void 0:e.options[0];if(t&&!(i!=null&&i.name)&&(r=J("options.name")),(a=e==null?void 0:e.options[0])!=null&&a.optionValues){let o=e.options[0].optionValues[0];t&&!(o!=null&&o.name)&&(r=J("options.optionValues.name")),o=e.options[0].optionValues.filter(s=>!!(s!=null&&s.firstSelectableVariant))[0],o!=null&&o.firstSelectableVariant&&(r=We(o.firstSelectableVariant,"options.optionValues.firstSelectableVariant",r,t))}else r=J("options.optionValues")}return e.selectedOrFirstAvailableVariant&&(r=We(e.selectedOrFirstAvailableVariant,"selectedOrFirstAvailableVariant",r,t)),e.adjacentVariants&&e.adjacentVariants[0]&&(r=We(e.adjacentVariants[0],"adjacentVariants",r,t)),r?e:{}}function We(e,t,r,n){var i;let a=r;if(n&&!((i=e.product)!=null&&i.handle)&&(a=J(`${t}.product.handle`)),e.selectedOptions){const o=e.selectedOptions[0];o!=null&&o.name||(a=J(`${t}.selectedOptions.name`)),o!=null&&o.value||(a=J(`${t}.selectedOptions.value`))}else a=J(`${t}.selectedOptions`);return a}function Nn(e){const t=qt(e);if(!t.options)return[];const r={};t.options.map(a=>{var i;(i=a.optionValues)==null||i.map(o=>{if(o.firstSelectableVariant){const s=Ye(o.firstSelectableVariant.selectedOptions);r[s]=o.firstSelectableVariant}})}),t.adjacentVariants.map(a=>{const i=Ye(a.selectedOptions);r[i]=a});const n=t.selectedOrFirstAvailableVariant;if(n){const a=Ye(n.selectedOptions);r[a]=n}return Object.values(r)}function Mn(e){const t=qt(e,!0);if(!t.options)return[];const{options:r,selectedOrFirstAvailableVariant:n,adjacentVariants:a,encodedVariantExistence:i,encodedVariantAvailability:o,handle:s}=t,u=n==null?void 0:n.selectedOptions.map(c=>c.name),d=r.filter(c=>u&&u.indexOf(c.name)>=0),y=Dn(r),f=Vn(n?[n,...a]:a),h=de(n?n.selectedOptions:[]);return d.map((c,S)=>({...c,optionValues:c.optionValues.map(T=>{var O;const A={...h};A[c.name]=T.name;const I=xt(A||[]),v=kn(A||[],y).slice(0,S+1),p=Be(v,i||""),m=Be(v,o||""),E=f[I]||T.firstSelectableVariant;let P={};E&&(P=de(E.selectedOptions||[]));const R=new URLSearchParams(P),b=((O=E==null?void 0:E.product)==null?void 0:O.handle)||s;return{...T,variant:E,handle:b,variantUriQuery:R.toString(),selected:h[c.name]===T.name,exists:p,available:m,isDifferentProduct:b!==s}})}))}const Fn=`#graphql
|
|
328
|
+
`,i.message)})}).catch(n=>{console.error(kt,n)})}catch{return Promise.resolve()}}function mn(){if(Jr("getClientBrowserParameters"))return{uniqueToken:"",visitToken:"",url:"",path:"",search:"",referrer:"",title:"",userAgent:"",navigationType:"",navigationApi:""};const[e,t]=_n(),r=ee();return{uniqueToken:r.uniqueToken,visitToken:r.visitToken,url:location.href,path:location.pathname,search:location.search,referrer:document.referrer,title:document.title,userAgent:navigator.userAgent,navigationType:e,navigationApi:t}}function pn(){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 En(){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 _n(){try{let e="PerformanceNavigationTiming",t=pn();return t||(t=En(),e="performance.navigation"),t?[t,e]:["unknown","unknown"]}catch{}return["error","error"]}function Sn(e){const{cartCreate:t,checkoutUrl:r}=ae(),[n,a]=l.useState(!1),{quantity:i,variantId:o,sellingPlanId:s,onClick:u,attributes:d,children:y,...f}=e;l.useEffect(()=>{n&&r&&(window.location.href=r)},[n,r]);const h=l.useCallback(()=>{a(!0),t({lines:[{quantity:i??1,merchandiseId:o,attributes:d,sellingPlanId:s}]})},[t,i,o,d,s]);return React.createElement(be,{disabled:n??f.disabled,...f,onClick:u,defaultOnClick:h},y)}function Cn(e){const[t,r]=l.useState(!1),{status:n,checkoutUrl:a}=ae(),{children:i,...o}=e;return l.useEffect(()=>{t&&a&&n==="idle"&&(window.location.href=a)},[t,n,a]),React.createElement(be,{...o,disabled:t||o.disabled,onClick:()=>r(!0)},i)}function Ut(e){const{countryIsoCode:t,languageIsoCode:r}=ce(),n=r.includes("_")?r.replace("_","-"):`${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 a=parseFloat(e.amount);let i=!0;try{new Intl.NumberFormat(n,{style:"currency",currency:e.currencyCode})}catch(c){c instanceof RangeError&&c.message.includes("currency")&&(i=!1)}const{defaultFormatter:o,nameFormatter:s,narrowSymbolFormatter:u,withoutTrailingZerosFormatter:d,withoutCurrencyFormatter:y,withoutTrailingZerosOrCurrencyFormatter:f}=l.useMemo(()=>{const c=i?{style:"currency",currency:e.currencyCode}:{style:"decimal",minimumFractionDigits:2,maximumFractionDigits:2};return{defaultFormatter:ie(n,c),nameFormatter:ie(n,{...c,currencyDisplay:"name"}),narrowSymbolFormatter:ie(n,{...c,currencyDisplay:"narrowSymbol"}),withoutTrailingZerosFormatter:ie(n,{...c,minimumFractionDigits:0,maximumFractionDigits:0}),withoutCurrencyFormatter:ie(n,{minimumFractionDigits:2,maximumFractionDigits:2}),withoutTrailingZerosOrCurrencyFormatter:ie(n,{minimumFractionDigits:0,maximumFractionDigits:0})}},[e.currencyCode,n,i]),h=c=>c.type==="currency",g=l.useMemo(()=>({original:()=>e,currencyCode:()=>e.currencyCode,localizedString:()=>{const c=o().format(a);return i?c:`${c} ${e.currencyCode}`},parts:()=>{const c=o().formatToParts(a);return i||c.push({type:"literal",value:" "},{type:"currency",value:e.currencyCode}),c},withoutTrailingZeros:()=>{const c=a%1===0?d().format(a):o().format(a);return i?c:`${c} ${e.currencyCode}`},withoutTrailingZerosAndCurrency:()=>a%1===0?f().format(a):y().format(a),currencyName:()=>{var c;return((c=s().formatToParts(a).find(h))==null?void 0:c.value)??e.currencyCode},currencySymbol:()=>{var c;return((c=o().formatToParts(a).find(h))==null?void 0:c.value)??e.currencyCode},currencyNarrowSymbol:()=>{var c;return((c=u().formatToParts(a).find(h))==null?void 0:c.value)??""},amount:()=>o().formatToParts(a).filter(c=>["decimal","fraction","group","integer","literal"].includes(c.type)).map(c=>c.value).join("")}),[e,a,i,s,o,u,y,d,f]);return l.useMemo(()=>new Proxy(g,{get:(c,_)=>{var C;return(C=Reflect.get(c,_))==null?void 0:C.call(null)}}),[g])}const Nt=new Map;function ie(e,t){const r=JSON.stringify([e,t]);return function(){let n=Nt.get(r);if(!n){try{n=new Intl.NumberFormat(e,t)}catch(a){if(a instanceof RangeError&&a.message.includes("currency")){const i={...t};delete i.currency,delete i.currencyDisplay,delete i.currencySign,n=new Intl.NumberFormat(e,i)}else throw a}Nt.set(r,n)}return n}}function Ae({data:e,as:t,withoutCurrency:r,withoutTrailingZeros:n,measurement:a,measurementSeparator:i="/",...o}){if(!Tn(e))throw new Error("<Money/> needs a valid 'data' prop that has 'amount' and 'currencyCode'");const s=Ut(e),u=t??"div";let d=s.localizedString;return(r||n)&&(r&&!n?d=s.amount:!r&&n?d=s.withoutTrailingZeros:d=s.withoutTrailingZerosAndCurrency),React.createElement(u,{...o},d,a&&a.referenceUnit&&React.createElement(React.Fragment,null,i,a.referenceUnit))}function Tn(e){return typeof e.amount=="string"&&!!e.amount&&typeof e.currencyCode=="string"&&!!e.currencyCode}function bn(e){const{cost:t}=ae(),{amountType:r="total",children:n,...a}=e;let i;return r=="total"?i=t==null?void 0:t.totalAmount:r=="subtotal"?i=t==null?void 0:t.subtotalAmount:r=="tax"?i=t==null?void 0:t.totalTaxAmount:r=="duty"&&(i=t==null?void 0:t.totalDutyAmount),i==null?null:React.createElement(Ae,{...a,data:i},n)}const Mt=l.createContext(null);function je(){const e=l.useContext(Mt);if(e==null)throw new Error("Expected a cart line context but none was found");return e}function vn({children:e,line:t}){return React.createElement(Mt.Provider,{value:t},e)}function wn(e){const t=je(),{as:r,...n}=e,a=r||"span";return React.createElement(a,{...n},t.quantity)}function An(e){const{status:t,linesRemove:r,linesUpdate:n}=ae(),a=je(),{children:i,adjust:o,onClick:s,...u}=e,d=l.useCallback(()=>{if(o==="remove"){r([(a==null?void 0:a.id)??""]);return}const f=o==="decrease"?((a==null?void 0:a.quantity)??0)-1:((a==null?void 0:a.quantity)??0)+1;if(f<=0){r([(a==null?void 0:a.id)??""]);return}const h={id:(a==null?void 0:a.id)??"",quantity:f,attributes:(a==null?void 0:a.attributes)??[]};n([h])},[o,a==null?void 0:a.attributes,a==null?void 0:a.id,a==null?void 0:a.quantity,r,n]),y=u.disabled;return React.createElement(be,{...u,onClick:s,defaultOnClick:d,disabled:typeof y<"u"?y:t!=="idle"},i)}const In={DateTime:"string",Decimal:"string",HTML:"string",URL:"string",Color:"string",UnsignedInt64:"string"},Pn={DateTime:"string",Decimal:"string",HTML:"string",ISO8601DateTime:"string",URL:"string",UnsignedInt64:"string"},Ft=l.forwardRef((e,t)=>{const{data:r,options:n,id:a=r.id,frameBorder:i="0",allow:o="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:s=!0,loading:u="lazy",...d}=e;if(!r.embedUrl)throw new Error("<ExternalVideo/> requires the 'embedUrl' property");let y=r.embedUrl;if(n){const f=new URL(r.embedUrl);for(const[h,g]of Object.entries(n))typeof g>"u"||f.searchParams.set(h,g.toString());y=f.toString()}return React.createElement("iframe",{...d,id:a??r.embedUrl,title:r.alt??r.id??"external video",frameBorder:i,allow:o,allowFullScreen:s,src:y,loading:u,ref:t})}),qe=",",oe={OPTION:":",END_OF_PREFIX:",",SEQUENCE_GAP:" ",RANGE:"-"},He=(()=>{const e=new Map;return function(t,r){var n;if(t.length===0)return!1;if(!e.has(r)){const a=new Set;for(const i of Lt(r)){a.add(i.join(qe));for(let o=0;o<i.length;o++)a.add(i.slice(0,o+1).join(qe))}e.set(r,a)}return!!((n=e.get(r))!=null&&n.has(t.join(qe)))}})();function Lt(e){if(!e)return[];if(e.startsWith("v1_"))return Rn(On(e));throw new Error("Unsupported option value encoding")}const On=e=>e.replace(/^v1_/,"");function Rn(e){const t=/[ :,-]/g;let r=0,n;const a=[],i=[];let o=0,s=null;for(;n=t.exec(e);){const d=n[0],y=Number.parseInt(e.slice(r,n.index))||0;if(s!==null){for(;s<y;s++)i[o]=s,a.push([...i]);s=null}i[o]=y,d===oe.RANGE?s=y:d===oe.OPTION?o++:((d===oe.SEQUENCE_GAP||d===oe.END_OF_PREFIX&&e[n.index-1]!==oe.END_OF_PREFIX)&&a.push([...i]),d===oe.END_OF_PREFIX&&(i.pop(),o--)),r=t.lastIndex}const u=e.match(/\d+$/g);if(u){const d=parseInt(u[0]);if(s!=null)for(;s<=d;s++)i[o]=s,a.push([...i]);else a.push([d])}return a}function Vn(e){return Object.assign({},...e.map(t=>({[t.name]:Object.assign({},...t!=null&&t.optionValues?t.optionValues.map((r,n)=>({[r.name]:n})):[])})))}function de(e){return Object.assign({},...e.map(t=>({[t.name]:t.value})))}function Be(e){return JSON.stringify(de(e))}function $t(e){return Array.isArray(e)?JSON.stringify(Object.assign({},...e.map(t=>({[t.name]:t.value})))):JSON.stringify(e)}function Dn(e,t){return Object.keys(e).map(n=>t[n]?t[n][e[n]]:null).filter(n=>n!==null)}function kn(e){return Object.assign({},...e.map(t=>({[$t(t.selectedOptions||[])]:t})))}const xt=["options","selectedOrFirstAvailableVariant","adjacentVariants"],Un=["handle","encodedVariantExistence","encodedVariantAvailability"];function J(e){return console.error(`[h2:error:getProductOptions] product.${e} is missing. Make sure you query for this field from the Storefront API.`),!1}function jt(e,t=!1){var a;let r=!0;const n=Object.keys(e);if((t?[...xt,...Un]:xt).forEach(i=>{n.includes(i)||(r=J(i))}),e.options){const i=e==null?void 0:e.options[0];if(t&&!(i!=null&&i.name)&&(r=J("options.name")),(a=e==null?void 0:e.options[0])!=null&&a.optionValues){let o=e.options[0].optionValues[0];t&&!(o!=null&&o.name)&&(r=J("options.optionValues.name")),o=e.options[0].optionValues.filter(s=>!!(s!=null&&s.firstSelectableVariant))[0],o!=null&&o.firstSelectableVariant&&(r=Ye(o.firstSelectableVariant,"options.optionValues.firstSelectableVariant",r,t))}else r=J("options.optionValues")}return e.selectedOrFirstAvailableVariant&&(r=Ye(e.selectedOrFirstAvailableVariant,"selectedOrFirstAvailableVariant",r,t)),e.adjacentVariants&&e.adjacentVariants[0]&&(r=Ye(e.adjacentVariants[0],"adjacentVariants",r,t)),r?e:{}}function Ye(e,t,r,n){var i;let a=r;if(n&&!((i=e.product)!=null&&i.handle)&&(a=J(`${t}.product.handle`)),e.selectedOptions){const o=e.selectedOptions[0];o!=null&&o.name||(a=J(`${t}.selectedOptions.name`)),o!=null&&o.value||(a=J(`${t}.selectedOptions.value`))}else a=J(`${t}.selectedOptions`);return a}function Nn(e){const t=jt(e);if(!t.options)return[];const r={};t.options.map(a=>{var i;(i=a.optionValues)==null||i.map(o=>{if(o.firstSelectableVariant){const s=Be(o.firstSelectableVariant.selectedOptions);r[s]=o.firstSelectableVariant}})}),t.adjacentVariants.map(a=>{const i=Be(a.selectedOptions);r[i]=a});const n=t.selectedOrFirstAvailableVariant;if(n){const a=Be(n.selectedOptions);r[a]=n}return Object.values(r)}function Mn(e){const t=jt(e,!0);if(!t.options)return[];const{options:r,selectedOrFirstAvailableVariant:n,adjacentVariants:a,encodedVariantExistence:i,encodedVariantAvailability:o,handle:s}=t,u=n==null?void 0:n.selectedOptions.map(c=>c.name),d=r.filter(c=>u&&u.indexOf(c.name)>=0),y=Vn(r),f=kn(n?[n,...a]:a),h=de(n?n.selectedOptions:[]);return d.map((c,_)=>({...c,optionValues:c.optionValues.map(C=>{var O;const v={...h};v[c.name]=C.name;const A=$t(v||[]),I=Dn(v||[],y).slice(0,_+1),p=He(I,i||""),m=He(I,o||""),E=f[A]||C.firstSelectableVariant;let P={};E&&(P=de(E.selectedOptions||[]));const R=new URLSearchParams(P),b=((O=E==null?void 0:E.product)==null?void 0:O.handle)||s;return{...C,variant:E,handle:b,variantUriQuery:R.toString(),selected:h[c.name]===C.name,exists:p,available:m,isDifferentProduct:b!==s}})}))}const Fn=`#graphql
|
|
275
329
|
fragment Image on Image {
|
|
276
330
|
altText
|
|
277
331
|
url
|
|
278
332
|
width
|
|
279
333
|
height
|
|
280
334
|
}
|
|
281
|
-
`,Ht=U.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:a="async",height:i="auto",loader:o=fe,loading:s="lazy",sizes:u,src:d,srcSetOptions:y={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:f="100%",...h},g)=>{const c=U.useMemo(()=>{const m=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,E=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:m,height:E,unitsMatch:!!Bt(m,E)}},[n]),S=U.useMemo(()=>{const E=he((f||"100%").toString()),P=`${E.number}${E.unit}`,R=i==null,b=R?null:he(i.toString()),O=b?`${b.number}${b.unit}`:"",H=R?"auto":O,D=d||(n==null?void 0:n.url),$=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",X=t||(c.unitsMatch?[ye(c.width),ye(c.height)].join("/"):void 0);return{width:P,height:H,src:D,alt:$,aspectRatio:X}},[f,i,d,n,e,t,c,h==null?void 0:h.key]),{intervals:T,startingWidth:A,incrementSize:I,placeholderWidth:w}=y,v=U.useMemo(()=>jn(f,T,A,I),[f,T,A,I]);return Yt(S.width)?U.createElement(Ln,{aspectRatio:t,crop:r,decoding:a,height:i,imageWidths:v,loader:o,loading:s,normalizedProps:S,passthroughProps:h,ref:g,width:f,data:n}):U.createElement(xn,{aspectRatio:t,crop:r,decoding:a,imageWidths:v,loader:o,loading:s,normalizedProps:S,passthroughProps:h,placeholderWidth:w,ref:g,sizes:u,data:n})}),Ln=U.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:a,loader:i=fe,loading:o,normalizedProps:s,passthroughProps:u,width:d,data:y},f)=>{const h=U.useMemo(()=>{const g=ye(d),c=ye(n),S=e||(Bt(s.width,s.height)?[g,c].join("/"):s.aspectRatio?s.aspectRatio:void 0),T=a===void 0?void 0:Gt(a,S,t,{width:(y==null?void 0:y.width)??void 0,height:(y==null?void 0:y.height)??void 0}),A=c||(S&&g?g*(Ge(S)??1):void 0),I=Wt(s.src,T,i),w=i({src:s.src,width:g,height:A,crop:s.height==="auto"?void 0:t});return{width:g,aspectRatio:S,height:A,srcSet:I,src:w}},[e,t,y,n,a,i,s,d]);return U.createElement("img",{ref:f,alt:s.alt,decoding:r,height:h.height,loading:o,src:h.src,srcSet:h.srcSet,width:h.width,style:{aspectRatio:h.aspectRatio,...u.style},...u})}),xn=U.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=fe,loading:a,normalizedProps:i,passthroughProps:o,placeholderWidth:s,sizes:u,data:d},y)=>{const f=U.useMemo(()=>{const h=r===void 0?void 0:Gt(r,i.aspectRatio,e,{width:(d==null?void 0:d.width)??void 0,height:(d==null?void 0:d.height)??void 0}),g=i.aspectRatio&&s?s*(Ge(i.aspectRatio)??1):void 0,c=Wt(i.src,h,n),S=n({src:i.src,width:s,height:g,crop:e});return{placeholderHeight:g,srcSet:c,src:S}},[e,d,r,n,i,s]);return U.createElement("img",{ref:y,alt:i.alt,decoding:t,height:f.placeholderHeight,loading:a,sizes:u,src:f.src,srcSet:f.srcSet,width:s,...o,style:{width:i.width,aspectRatio:i.aspectRatio,...o.style}})}),$t="https://placeholder.shopify.com";function fe({src:e,width:t,height:r,crop:n}){if(!e)return"";const a=new URL(e,$t);return t&&a.searchParams.append("width",Math.round(t).toString()),r&&a.searchParams.append("height",Math.round(r).toString()),n&&a.searchParams.append("crop",n),a.href.replace($t,"")}function Bt(e="100%",t="auto"){return he(e.toString()).unit===he(t.toString()).unit}function he(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function ye(e){if(e===void 0)return;const{unit:t,number:r}=he(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function Yt(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function Wt(e,t,r=fe){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,a)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${a+1}x`:`${n.width??0}w`}`).join(", "):""}function jn(e="100%",t,r,n){const a=Array.from({length:t},(o,s)=>s*n+r),i=Array.from({length:3},(o,s)=>(s+1)*(ye(e)??0));return Yt(e)?i:a}function Ge(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Gt(e,t,r="center",n){if(e)return e.map(a=>({width:a,height:t?a*(Ge(t)??1):void 0,crop:r})).filter(({width:a,height:i})=>!(n!=null&&n.width&&a>n.width||n!=null&&n.height&&i&&i>n.height))}const Zt={};function qn(e,t){const r=Zt[e];if(r)return r;const n=new Promise((a,i)=>{const o=document.createElement("script");t!=null&&t.module?o.type="module":o.type="text/javascript",o.src=e,o.onload=()=>{a(!0)},o.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(o):document.body.appendChild(o);const s=t==null?void 0:t.attributes;s&&Object.keys(s).forEach(u=>{o.setAttribute(u,s[u])})});return Zt[e]=n,n}function Ze(e,t){const[r,n]=l.useState("loading");return l.useEffect(()=>{qn(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}const Kt=l.forwardRef((e,t)=>{var y;const{data:r,previewImageOptions:n,id:a=r.id,playsInline:i=!0,controls:o=!0,sourceProps:s={},...u}=e,d=fe({src:((y=r.previewImage)==null?void 0:y.url)??"",...n});if(!r.sources)throw new Error("<Video/> requires a 'data.sources' array");return React.createElement("video",{...u,id:a,playsInline:i,controls:o,poster:d,ref:t},r.sources.map(f=>{if(!(f!=null&&f.url&&(f!=null&&f.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return React.createElement("source",{...s,key:f.url,src:f.url,type:f.mimeType})}))});function Qt(e){var d,y,f;const[t,r]=l.useState(void 0),n=l.useCallback(h=>{r(h)},[]),{data:a,children:i,className:o,...s}=e,u=Ze("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return l.useEffect(()=>{const h={error:s.onError,load:s.onLoad,preload:s.onPreload,"model-visibility":s.onModelVisibility,progress:s.onProgress,"ar-status":s.onArStatus,"ar-tracking":s.onArTracking,"quick-look-button-tapped":s.onQuickLookButtonTapped,"camera-change":s.onCameraChange,"environment-change":s.onEnvironmentChange,play:s.onPlay,pause:s.onPause,"scene-graph-ready":s.onSceneGraphReady};if(t)return Object.entries(h).forEach(([g,c])=>{c&&t.addEventListener(g,c)}),()=>{t!=null&&Object.entries(h).forEach(([g,c])=>{c&&t.removeEventListener(g,c)})}},[t,s.onArStatus,s.onArTracking,s.onCameraChange,s.onEnvironmentChange,s.onError,s.onLoad,s.onModelVisibility,s.onPause,s.onPlay,s.onPreload,s.onProgress,s.onQuickLookButtonTapped,s.onSceneGraphReady]),u!=="done"?null:(y=(d=a.sources)==null?void 0:d[0])!=null&&y.url?React.createElement("model-viewer",{ref:n,...s,class:o,id:s.id??a.id,src:a.sources[0].url,alt:a.alt??null,"camera-controls":s.cameraControls??!0,poster:(s.poster||((f=a.previewImage)==null?void 0:f.url))??null,autoplay:s.autoplay??!0,loading:s.loading,reveal:s.reveal,ar:s.ar,"ar-modes":s.arModes,"ar-scale":s.arScale,"ar-placement":s.arPlacement,"ios-src":s.iosSrc,"touch-action":s.touchAction,"disable-zoom":s.disableZoom,"orbit-sensitivity":s.orbitSensitivity,"auto-rotate":s.autoRotate,"auto-rotate-delay":s.autoRotateDelay,"rotation-per-second":s.rotationPerSecond,"interaction-policy":s.interactionPolicy,"interaction-prompt":s.interactionPrompt,"interaction-prompt-style":s.interactionPromptStyle,"interaction-prompt-threshold":s.interactionPromptThreshold,"camera-orbit":s.cameraOrbit,"camera-target":s.cameraTarget,"field-of-view":s.fieldOfView,"max-camera-orbit":s.maxCameraOrbit,"min-camera-orbit":s.minCameraOrbit,"max-field-of-view":s.maxFieldOfView,"min-field-of-view":s.minFieldOfView,bounds:s.bounds,"interpolation-decay":s.interpolationDecay??100,"skybox-image":s.skyboxImage,"environment-image":s.environmentImage,exposure:s.exposure,"shadow-intensity":s.shadowIntensity??0,"shadow-softness":s.shadowSoftness??0,"animation-name":s.animationName,"animation-crossfade-duration":s.animationCrossfadeDuration,"variant-name":s.variantName,orientation:s.orientation,scale:s.scale},i):(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 Hn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?React.createElement(Ht,{...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 React.createElement(Kt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return React.createElement(Ft,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return React.createElement(Qt,{...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 $n(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"money":{let t=null;try{const r=Ke(e.value??"");if(r&&typeof r=="object"&&"currency_code"in r){const n=r;t={amount:n.amount,currencyCode:n.currency_code}}else r&&typeof r=="object"&&"currencyCode"in r,t=r}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"dimension":case"json":case"rating":case"volume":case"weight":case"rich_text_field":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=Ke(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=Ke((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:Q(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 Ke(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function Bn(e){var y,f,h,g,c,S;const{priceType:t="regular",variantId:r,valueType:n="min",data:a,...i}=e;if(a==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let o,s;const u=r?Q((a==null?void 0:a.variants)??{}).find(T=>(T==null?void 0:T.id)===r)??null:null,d=n==="max"?"maxVariantPrice":"minVariantPrice";if(t==="compareAt"){r&&u?o=u.compareAtPrice:o=(y=a==null?void 0:a.compareAtPriceRange)==null?void 0:y[d];let T;r&&u?T=parseFloat(((f=u.price)==null?void 0:f.amount)??"0"):T=parseFloat(((g=(h=a==null?void 0:a.priceRange)==null?void 0:h[d])==null?void 0:g.amount)??"0");const A=parseFloat((o==null?void 0:o.amount)??"0");if(T>=A)return null}else r&&u?(o=u.price,n==="unit"&&(o=u.unitPrice,s=u.unitPriceMeasurement)):n==="max"?o=(c=a.priceRange)==null?void 0:c.maxVariantPrice:o=(S=a.priceRange)==null?void 0:S.minVariantPrice;return o?s?React.createElement(Ie,{...i,data:o,measurement:s}):React.createElement(Ie,{...i,data:o}):null}const Yn={root:Wn,heading:Gn,paragraph:Zn,text:Kn,link:Qn,list:Jn,"list-item":Xn};function Wn({node:e}){return React.createElement("div",null,e.children)}function Gn({node:e}){return l.createElement(`h${e.level??"1"}`,null,e.children)}function Zn({node:e}){return React.createElement("p",null,e.children)}function Kn({node:e}){return e.bold&&e.italic?React.createElement("em",null,React.createElement("strong",null,e.value)):e.bold?React.createElement("strong",null,e.value):e.italic?React.createElement("em",null,e.value):e.value}function Qn({node:e}){return React.createElement("a",{href:e.url,title:e.title,target:e.target},e.children)}function Jn({node:e}){const t=e.listType==="unordered"?"ul":"ol";return React.createElement(t,null,e.children)}function Xn({node:e}){return React.createElement("li",null,e.children)}function zn({as:e,data:t,plain:r,components:n,...a}){try{const i=e??"div",o=l.useMemo(()=>JSON.parse(t),[t]);return React.createElement(i,{...a},r?ge(o):Jt(n,o))}catch(i){throw new Error("[h2:error:RichText] Parsing error. Make sure to pass a JSON string of rich text metafield",{cause:i})}}function Jt(e={},t,r=0){let n;"children"in t&&(n=t.children.map((i,o)=>Jt(e,i,o)));const a=e[t.type==="list-item"?"listItem":t.type]??Yn[t.type];switch(t.type){case"root":return l.createElement(a,{key:r,node:{type:"root",children:n}});case"heading":return l.createElement(a,{key:r,node:{type:"heading",level:t.level,children:n}});case"paragraph":return l.createElement(a,{key:r,node:{type:"paragraph",children:n}});case"text":{const i=(t.value??"").split(`
|
|
282
|
-
`).flatMap((o,s)=>{const u=`${r}-${o}-${s}`,d=l.createElement(a,{key:u,node:{type:"text",italic:t.italic,bold:t.bold,value:o}});return s===0?d:[l.createElement("br",{key:`${u}-br`}),d]});return i.length>1?l.createElement(l.Fragment,{key:r},i):i[0]}case"link":return l.createElement(a,{key:r,node:{type:"link",url:t.url,title:t.title,target:t.target,children:n}});case"list":return l.createElement(a,{key:r,node:{type:"list",listType:t.listType,children:n}});case"list-item":return l.createElement(a,{key:r,node:{type:"list-item",children:n}})}}function ge(e,t=[]){switch(e.type){case"root":e.children.forEach(r=>ge(r,t));break;case"heading":case"paragraph":e.children.forEach(r=>ge(r,t)),t.push(" ");break;case"text":t.push(e.value||"");break;case"link":e.children.forEach(r=>ge(r,t));break;case"list":e.children.forEach(r=>{r.children&&r.children.forEach(n=>ge(n,t)),t.push(" ")});break;default:throw new Error(`Unknown node encountered ${e.type}`)}return t.join("").trim()}const ea="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function ta(e){return e==="headless"||e==="hydrogen"}function ra({channel:e,variantIds:t,className:r,variantIdsAndQuantities:n,width:a,storeDomain:i}){const o=ce(),s=i||(o==null?void 0:o.storeDomain),u=
|
|
335
|
+
`,qt=U.forwardRef(({alt:e,aspectRatio:t,crop:r="center",data:n,decoding:a="async",height:i="auto",loader:o=fe,loading:s="lazy",sizes:u,src:d,srcSetOptions:y={intervals:15,startingWidth:200,incrementSize:200,placeholderWidth:100},width:f="100%",...h},g)=>{const c=U.useMemo(()=>{const m=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.width:void 0,E=n!=null&&n.width&&(n!=null&&n.height)?n==null?void 0:n.height:void 0;return{width:m,height:E,unitsMatch:!!Bt(m,E)}},[n]),_=U.useMemo(()=>{const E=he((f||"100%").toString()),P=`${E.number}${E.unit}`,R=i==null,b=R?null:he(i.toString()),O=b?`${b.number}${b.unit}`:"",q=R?"auto":O,V=d||(n==null?void 0:n.url),H=n!=null&&n.altText&&!e?n==null?void 0:n.altText:e||"",X=t||(c.unitsMatch?[ye(c.width),ye(c.height)].join("/"):void 0);return{width:P,height:q,src:V,alt:H,aspectRatio:X}},[f,i,d,n,e,t,c,h==null?void 0:h.key]),{intervals:C,startingWidth:v,incrementSize:A,placeholderWidth:w}=y,I=U.useMemo(()=>xn(f,C,v,A),[f,C,v,A]);return Yt(_.width)?U.createElement(Ln,{aspectRatio:t,crop:r,decoding:a,height:i,imageWidths:I,loader:o,loading:s,normalizedProps:_,passthroughProps:h,ref:g,width:f,data:n}):U.createElement($n,{aspectRatio:t,crop:r,decoding:a,imageWidths:I,loader:o,loading:s,normalizedProps:_,passthroughProps:h,placeholderWidth:w,ref:g,sizes:u,data:n})}),Ln=U.forwardRef(({aspectRatio:e,crop:t,decoding:r,height:n,imageWidths:a,loader:i=fe,loading:o,normalizedProps:s,passthroughProps:u,width:d,data:y},f)=>{const h=U.useMemo(()=>{const g=ye(d),c=ye(n),_=e||(Bt(s.width,s.height)?[g,c].join("/"):s.aspectRatio?s.aspectRatio:void 0),C=a===void 0?void 0:Gt(a,_,t,{width:(y==null?void 0:y.width)??void 0,height:(y==null?void 0:y.height)??void 0}),v=c||(_&&g?g*(We(_)??1):void 0),A=Wt(s.src,C,i),w=i({src:s.src,width:g,height:v,crop:s.height==="auto"?void 0:t});return{width:g,aspectRatio:_,height:v,srcSet:A,src:w}},[e,t,y,n,a,i,s,d]);return U.createElement("img",{ref:f,alt:s.alt,decoding:r,height:h.height,loading:o,src:h.src,srcSet:h.srcSet,width:h.width,style:{aspectRatio:h.aspectRatio,...u.style},...u})}),$n=U.forwardRef(({crop:e,decoding:t,imageWidths:r,loader:n=fe,loading:a,normalizedProps:i,passthroughProps:o,placeholderWidth:s,sizes:u,data:d},y)=>{const f=U.useMemo(()=>{const h=r===void 0?void 0:Gt(r,i.aspectRatio,e,{width:(d==null?void 0:d.width)??void 0,height:(d==null?void 0:d.height)??void 0}),g=i.aspectRatio&&s?s*(We(i.aspectRatio)??1):void 0,c=Wt(i.src,h,n),_=n({src:i.src,width:s,height:g,crop:e});return{placeholderHeight:g,srcSet:c,src:_}},[e,d,r,n,i,s]);return U.createElement("img",{ref:y,alt:i.alt,decoding:t,height:f.placeholderHeight,loading:a,sizes:u,src:f.src,srcSet:f.srcSet,width:s,...o,style:{width:i.width,aspectRatio:i.aspectRatio,...o.style}})}),Ht="https://placeholder.shopify.com";function fe({src:e,width:t,height:r,crop:n}){if(!e)return"";const a=new URL(e,Ht);return t&&a.searchParams.append("width",Math.round(t).toString()),r&&a.searchParams.append("height",Math.round(r).toString()),n&&a.searchParams.append("crop",n),a.href.replace(Ht,"")}function Bt(e="100%",t="auto"){return he(e.toString()).unit===he(t.toString()).unit}function he(e){const t=e.replace(/[0-9.]/g,""),r=parseFloat(e.replace(t,""));return{unit:t===""?r===void 0?"auto":"px":t,number:r}}function ye(e){if(e===void 0)return;const{unit:t,number:r}=he(e.toString());switch(t){case"em":return r*16;case"rem":return r*16;case"px":return r;case"":return r;default:return}}function Yt(e){return typeof e=="number"||/\d(px|em|rem)$/.test(e)}function Wt(e,t,r=fe){return e?(t==null?void 0:t.length)===0||!t?e:t.map((n,a)=>`${r({src:e,width:n.width,height:n.height,crop:n.crop})} ${t.length===3?`${a+1}x`:`${n.width??0}w`}`).join(", "):""}function xn(e="100%",t,r,n){const a=Array.from({length:t},(o,s)=>s*n+r),i=Array.from({length:3},(o,s)=>(s+1)*(ye(e)??0));return Yt(e)?i:a}function We(e){if(!e)return;const[t,r]=e.split("/");return 1/(Number(t)/Number(r))}function Gt(e,t,r="center",n){if(e)return e.map(a=>({width:a,height:t?a*(We(t)??1):void 0,crop:r})).filter(({width:a,height:i})=>!(n!=null&&n.width&&a>n.width||n!=null&&n.height&&i&&i>n.height))}const Zt={};function jn(e,t){const r=Zt[e];if(r)return r;const n=new Promise((a,i)=>{const o=document.createElement("script");t!=null&&t.module?o.type="module":o.type="text/javascript",o.src=e,o.onload=()=>{a(!0)},o.onerror=()=>{i(!1)},(t==null?void 0:t.in)==="head"?document.head.appendChild(o):document.body.appendChild(o);const s=t==null?void 0:t.attributes;s&&Object.keys(s).forEach(u=>{o.setAttribute(u,s[u])})});return Zt[e]=n,n}function Ge(e,t){const[r,n]=l.useState("loading");return l.useEffect(()=>{jn(e,t).then(()=>n("done")).catch(()=>n("error"))},[e]),r}const Kt=l.forwardRef((e,t)=>{var y;const{data:r,previewImageOptions:n,id:a=r.id,playsInline:i=!0,controls:o=!0,sourceProps:s={},...u}=e,d=fe({src:((y=r.previewImage)==null?void 0:y.url)??"",...n});if(!r.sources)throw new Error("<Video/> requires a 'data.sources' array");return React.createElement("video",{...u,id:a,playsInline:i,controls:o,poster:d,ref:t},r.sources.map(f=>{if(!(f!=null&&f.url&&(f!=null&&f.mimeType)))throw new Error("<Video/> needs 'source.url' and 'source.mimeType'");return React.createElement("source",{...s,key:f.url,src:f.url,type:f.mimeType})}))});function Qt(e){var d,y,f;const[t,r]=l.useState(void 0),n=l.useCallback(h=>{r(h)},[]),{data:a,children:i,className:o,...s}=e,u=Ge("https://unpkg.com/@google/model-viewer@v1.12.1/dist/model-viewer.min.js",{module:!0});return l.useEffect(()=>{const h={error:s.onError,load:s.onLoad,preload:s.onPreload,"model-visibility":s.onModelVisibility,progress:s.onProgress,"ar-status":s.onArStatus,"ar-tracking":s.onArTracking,"quick-look-button-tapped":s.onQuickLookButtonTapped,"camera-change":s.onCameraChange,"environment-change":s.onEnvironmentChange,play:s.onPlay,pause:s.onPause,"scene-graph-ready":s.onSceneGraphReady};if(t)return Object.entries(h).forEach(([g,c])=>{c&&t.addEventListener(g,c)}),()=>{t!=null&&Object.entries(h).forEach(([g,c])=>{c&&t.removeEventListener(g,c)})}},[t,s.onArStatus,s.onArTracking,s.onCameraChange,s.onEnvironmentChange,s.onError,s.onLoad,s.onModelVisibility,s.onPause,s.onPlay,s.onPreload,s.onProgress,s.onQuickLookButtonTapped,s.onSceneGraphReady]),u!=="done"?null:(y=(d=a.sources)==null?void 0:d[0])!=null&&y.url?React.createElement("model-viewer",{ref:n,...s,class:o,id:s.id??a.id,src:a.sources[0].url,alt:a.alt??null,"camera-controls":s.cameraControls??!0,poster:(s.poster||((f=a.previewImage)==null?void 0:f.url))??null,autoplay:s.autoplay??!0,loading:s.loading,reveal:s.reveal,ar:s.ar,"ar-modes":s.arModes,"ar-scale":s.arScale,"ar-placement":s.arPlacement,"ios-src":s.iosSrc,"touch-action":s.touchAction,"disable-zoom":s.disableZoom,"orbit-sensitivity":s.orbitSensitivity,"auto-rotate":s.autoRotate,"auto-rotate-delay":s.autoRotateDelay,"rotation-per-second":s.rotationPerSecond,"interaction-policy":s.interactionPolicy,"interaction-prompt":s.interactionPrompt,"interaction-prompt-style":s.interactionPromptStyle,"interaction-prompt-threshold":s.interactionPromptThreshold,"camera-orbit":s.cameraOrbit,"camera-target":s.cameraTarget,"field-of-view":s.fieldOfView,"max-camera-orbit":s.maxCameraOrbit,"min-camera-orbit":s.minCameraOrbit,"max-field-of-view":s.maxFieldOfView,"min-field-of-view":s.minFieldOfView,bounds:s.bounds,"interpolation-decay":s.interpolationDecay??100,"skybox-image":s.skyboxImage,"environment-image":s.environmentImage,exposure:s.exposure,"shadow-intensity":s.shadowIntensity??0,"shadow-softness":s.shadowSoftness??0,"animation-name":s.animationName,"animation-crossfade-duration":s.animationCrossfadeDuration,"variant-name":s.variantName,orientation:s.orientation,scale:s.scale},i):(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 qn({data:e,mediaOptions:t,...r}){switch(e.__typename){case"MediaImage":return e.image?React.createElement(qt,{...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 React.createElement(Kt,{...r,...t==null?void 0:t.video,data:e});case"ExternalVideo":return React.createElement(Ft,{...r,...t==null?void 0:t.externalVideo,data:e});case"Model3d":return React.createElement(Qt,{...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 Hn(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"article_reference":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"money":{let t=null;try{const r=Ze(e.value??"");if(r&&typeof r=="object"&&"currency_code"in r){const n=r;t={amount:n.amount,currencyCode:n.currency_code}}else r&&typeof r=="object"&&"currencyCode"in r,t=r}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"dimension":case"json":case"rating":case"volume":case"weight":case"rich_text_field":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=Ze(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=Ze((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.article_reference":case"list.collection_reference":case"list.file_reference":case"list.page_reference":case"list.product_reference":case"list.variant_reference":return{...e,parsedValue:Q(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 Ze(e){return String(e).includes("__proto__")?JSON.parse(e,(t,r)=>{if(t!=="__proto__")return r}):JSON.parse(e)}function Bn(e){var y,f,h,g,c,_;const{priceType:t="regular",variantId:r,valueType:n="min",data:a,...i}=e;if(a==null)throw new Error("<ProductPrice/> requires a product as the 'data' prop");let o,s;const u=r?Q((a==null?void 0:a.variants)??{}).find(C=>(C==null?void 0:C.id)===r)??null:null,d=n==="max"?"maxVariantPrice":"minVariantPrice";if(t==="compareAt"){r&&u?o=u.compareAtPrice:o=(y=a==null?void 0:a.compareAtPriceRange)==null?void 0:y[d];let C;r&&u?C=parseFloat(((f=u.price)==null?void 0:f.amount)??"0"):C=parseFloat(((g=(h=a==null?void 0:a.priceRange)==null?void 0:h[d])==null?void 0:g.amount)??"0");const v=parseFloat((o==null?void 0:o.amount)??"0");if(C>=v)return null}else r&&u?(o=u.price,n==="unit"&&(o=u.unitPrice,s=u.unitPriceMeasurement)):n==="max"?o=(c=a.priceRange)==null?void 0:c.maxVariantPrice:o=(_=a.priceRange)==null?void 0:_.minVariantPrice;return o?s?React.createElement(Ae,{...i,data:o,measurement:s}):React.createElement(Ae,{...i,data:o}):null}const Yn={root:Wn,heading:Gn,paragraph:Zn,text:Kn,link:Qn,list:Jn,"list-item":Xn};function Wn({node:e}){return React.createElement("div",null,e.children)}function Gn({node:e}){return l.createElement(`h${e.level??"1"}`,null,e.children)}function Zn({node:e}){return React.createElement("p",null,e.children)}function Kn({node:e}){return e.bold&&e.italic?React.createElement("em",null,React.createElement("strong",null,e.value)):e.bold?React.createElement("strong",null,e.value):e.italic?React.createElement("em",null,e.value):e.value}function Qn({node:e}){return React.createElement("a",{href:e.url,title:e.title,target:e.target},e.children)}function Jn({node:e}){const t=e.listType==="unordered"?"ul":"ol";return React.createElement(t,null,e.children)}function Xn({node:e}){return React.createElement("li",null,e.children)}function zn({as:e,data:t,plain:r,components:n,...a}){try{const i=e??"div",o=l.useMemo(()=>JSON.parse(t),[t]);return React.createElement(i,{...a},r?ge(o):Jt(n,o))}catch(i){throw new Error("[h2:error:RichText] Parsing error. Make sure to pass a JSON string of rich text metafield",{cause:i})}}function Jt(e={},t,r=0){let n;"children"in t&&(n=t.children.map((i,o)=>Jt(e,i,o)));const a=e[t.type==="list-item"?"listItem":t.type]??Yn[t.type];switch(t.type){case"root":return l.createElement(a,{key:r,node:{type:"root",children:n}});case"heading":return l.createElement(a,{key:r,node:{type:"heading",level:t.level,children:n}});case"paragraph":return l.createElement(a,{key:r,node:{type:"paragraph",children:n}});case"text":{const i=(t.value??"").split(`
|
|
336
|
+
`).flatMap((o,s)=>{const u=`${r}-${o}-${s}`,d=l.createElement(a,{key:u,node:{type:"text",italic:t.italic,bold:t.bold,value:o}});return s===0?d:[l.createElement("br",{key:`${u}-br`}),d]});return i.length>1?l.createElement(l.Fragment,{key:r},i):i[0]}case"link":return l.createElement(a,{key:r,node:{type:"link",url:t.url,title:t.title,target:t.target,children:n}});case"list":return l.createElement(a,{key:r,node:{type:"list",listType:t.listType,children:n}});case"list-item":return l.createElement(a,{key:r,node:{type:"list-item",children:n}})}}function ge(e,t=[]){switch(e.type){case"root":e.children.forEach(r=>ge(r,t));break;case"heading":case"paragraph":e.children.forEach(r=>ge(r,t)),t.push(" ");break;case"text":t.push(e.value||"");break;case"link":e.children.forEach(r=>ge(r,t));break;case"list":e.children.forEach(r=>{r.children&&r.children.forEach(n=>ge(n,t)),t.push(" ")});break;default:throw new Error(`Unknown node encountered ${e.type}`)}return t.join("").trim()}const ea="https://cdn.shopify.com/shopifycloud/shop-js/v1.0/client.js";function ta(e){return e==="headless"||e==="hydrogen"}function ra({channel:e,variantIds:t,className:r,variantIdsAndQuantities:n,width:a,storeDomain:i}){const o=ce(),s=i||(o==null?void 0:o.storeDomain),u=Ge(ea);let d=[],y;if(!s||s===ft.storeDomain)throw new Error(na);if(t&&n)throw new Error(ia);if(!t&&!n)throw new Error(Xt);if(e)if(ta(e))y=e;else throw new Error(oa);if(t)d=t.reduce((h,g)=>{const c=$(g).id;return c&&h.push(c),h},[]);else if(n)d=n.reduce((h,g)=>{const c=$(g==null?void 0:g.id).id;return c&&h.push(`${c}:${(g==null?void 0:g.quantity)??1}`),h},[]);else throw new Error(Xt);if(d.length===0)throw new Error(aa);const f=a?{"--shop-pay-button-width":a}:void 0;return React.createElement("div",{className:r,style:f},u==="done"&&React.createElement("shop-pay-button",{...y?{channel:y}:{},"store-url":s,variants:d.join(",")}))}const na='You must pass a "storeDomain" prop to the "ShopPayButton" component, or wrap it in a "ShopifyProvider" component.',aa='You must pass in "variantIds" in the form of ["gid://shopify/ProductVariant/1"]',Xt='You must pass in either "variantIds" or "variantIdsAndQuantities" to ShopPayButton',ia="You must provide either a variantIds or variantIdsAndQuantities prop, but not both in the ShopPayButton component",oa='Invalid channel attribution value. Must be either "headless" or "hydrogen"';function sa(e){return l.useEffect(()=>{const t=new URLSearchParams(de(e||[])),r=new URLSearchParams(window.location.search),n=new URLSearchParams({...Object.fromEntries(r),...Object.fromEntries(t)});n.size>0&&window.history.replaceState({},"",`${window.location.pathname}?${n.toString()}`)},[JSON.stringify(e)]),null}function ca(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 ua=3600*24*360*1,la=1800;function da(e){const{hasUserConsent:t,domain:r="",checkoutDomain:n="",storefrontAccessToken:a,fetchTrackingValues:i,ignoreDeprecatedCookies:o=!1}=e||{},s=fa({storefrontAccessToken:a,fetchTrackingValues:i,checkoutDomain:n});return l.useEffect(()=>{if(o||!s)return;let u=r||window.location.host;if(n){const y=n.split(".").reverse(),f=u.split(".").reverse(),h=[];y.forEach((g,c)=>{g===f[c]&&h.push(g)}),u=h.reverse().join(".")}/^localhost/.test(u)&&(u="");const d=u?/^\./.test(u)?u:`.${u}`:"";if(t){const y=ee();if((y.uniqueToken||y.visitToken||"").startsWith("00000000-"))return;Ie(Ce,y.uniqueToken||we(),ua,d),Ie(Te,y.visitToken||we(),la,d)}else Ie(Ce,"",0,d),Ie(Te,"",0,d)},[s,t,r,n,o]),s}function Ie(e,t,r,n){document.cookie=ca(e,t,{maxage:r,domain:n,samesite:"Lax",path:"/"})}async function zt(e,t=""){const{uniqueToken:r,visitToken:n}=ee(),a=await fetch(`${t.replace(/\/+$/,"")}/api/unstable/graphql.json`,{method:"POST",headers:{"Content-Type":"application/json",...e&&{"X-Shopify-Storefront-Access-Token":e},...n||r?{[Ne]:n,[Me]:r}:void 0},body:JSON.stringify({query:"query ensureCookies { consentManagement { cookies(visitorConsent:{}) { cookieDomain } } }"})});if(!a.ok)throw new Error(`Failed to fetch consent from browser: ${a.status} ${a.statusText}`);await a.json(),ee()}function fa({checkoutDomain:e,storefrontAccessToken:t,fetchTrackingValues:r=!1}){const[n,a]=l.useState(!r),i=l.useRef(!1);return l.useEffect(()=>{if(!r){a(!0);return}i.current||(i.current=!0,zt(t).catch(o=>e?zt(t,e):Promise.reject(o)).catch(o=>{console.warn("[h2:warn:useShopifyCookies] Failed to fetch tracking values from browser: "+(o instanceof Error?o.message:String(o)))}).finally(()=>{a(!0)}))},[e,r,t]),n}S.AddToCartButton=Qr,S.AnalyticsEventName=te,S.AnalyticsPageType=ve,S.BuyNowButton=Sn,S.CartCheckoutButton=Cn,S.CartCost=bn,S.CartLineProvider=vn,S.CartLineQuantity=wn,S.CartLineQuantityAdjustButton=An,S.CartProvider=Hr,S.ExternalVideo=Ft,S.IMAGE_FRAGMENT=Fn,S.Image=qt,S.MediaFile=qn,S.ModelViewer=Qt,S.Money=Ae,S.ProductPrice=Bn,S.ProductProvider=Gr,S.RichText=zn,S.SHOPIFY_S=Te,S.SHOPIFY_STOREFRONT_ID_HEADER=yt,S.SHOPIFY_STOREFRONT_S_HEADER=mt,S.SHOPIFY_STOREFRONT_Y_HEADER=gt,S.SHOPIFY_UNIQUE_TOKEN_HEADER=Me,S.SHOPIFY_VISIT_TOKEN_HEADER=Ne,S.SHOPIFY_Y=Ce,S.ShopPayButton=ra,S.ShopifyProvider=Mr,S.ShopifySalesChannel=wt,S.Video=Kt,S.createStorefrontClient=kr,S.customerAccountApiCustomScalars=Pn,S.decodeEncodedVariant=Lt,S.flattenConnection=Q,S.getAdjacentAndFirstAvailableVariants=Nn,S.getClientBrowserParameters=mn,S.getProductOptions=Mn,S.getShopifyCookies=zr,S.getTrackingValues=ee,S.isOptionValueCombinationInEncodedVariant=He,S.mapSelectedProductOptionToObject=de,S.parseGid=$,S.parseMetafield=Hn,S.sendShopifyAnalytics=hn,S.storefrontApiCustomScalars=In,S.useCart=ae,S.useCartLine=je,S.useLoadScript=Ge,S.useMoney=Ut,S.useProduct=Ct,S.useSelectedOptionInUrlParam=sa,S.useShop=ce,S.useShopifyCookies=da,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})}));
|
|
283
337
|
//# sourceMappingURL=hydrogen-react.prod.js.map
|