@shopify/hydrogen-react 0.0.0-next-ea3959b → 0.0.0-next-dada720

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