@shopify/cli 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/dist/analytics-CX22YIUZ.js +1 -0
  2. package/dist/analytics-UBWQIQYF.js +1 -0
  3. package/dist/angular-UTTM4Y4S.js +4 -0
  4. package/dist/bootstrap.js +1 -1
  5. package/dist/{chunk-76R52ODR.js → chunk-23AMFHXC.js} +1 -1
  6. package/dist/{chunk-Q33IBIVJ.js → chunk-2EJCY4CE.js} +1 -1
  7. package/dist/{chunk-SXTMSGUE.js → chunk-2KH2S7PI.js} +1 -1
  8. package/dist/chunk-2N4O33VM.js +6 -0
  9. package/dist/{chunk-6RE2SNCU.js → chunk-2VLMN5QZ.js} +1 -1
  10. package/dist/chunk-2WNODIWJ.js +1 -0
  11. package/dist/chunk-2YXKZWYW.js +1 -0
  12. package/dist/{chunk-KZOBF55B.js → chunk-3BRUCKZ2.js} +1 -1
  13. package/dist/{chunk-URZPVSJZ.js → chunk-3V63X7WZ.js} +66 -66
  14. package/dist/chunk-3YWUSKWF.js +159 -0
  15. package/dist/chunk-42RMKTCJ.js +8 -0
  16. package/dist/{chunk-OBEWZXOQ.js → chunk-4EXYYBQ6.js} +1 -1
  17. package/dist/chunk-4KRT35A2.js +1 -0
  18. package/dist/chunk-4V4DQ6W7.js +836 -0
  19. package/dist/chunk-4Z2WYNTE.js +1 -0
  20. package/dist/chunk-57N2DFIF.js +1 -0
  21. package/dist/chunk-5TIJLYZU.js +3 -0
  22. package/dist/{chunk-MCVRONUY.js → chunk-6AJZKIZ3.js} +1 -1
  23. package/dist/{chunk-XULPJ6UG.js → chunk-6HZTMQD6.js} +1 -1
  24. package/dist/chunk-6LK6ZP3Q.js +1 -0
  25. package/dist/chunk-6SXOUZ7V.js +1 -0
  26. package/dist/chunk-6TEXPRI2.js +2 -0
  27. package/dist/{chunk-VICYNG2W.js → chunk-6TORWTD7.js} +1 -1
  28. package/dist/{chunk-WSDN25F5.js → chunk-6YAXFS6V.js} +1 -1
  29. package/dist/chunk-6YHJ554P.js +6 -0
  30. package/dist/chunk-6ZIOYXEF.js +3 -0
  31. package/dist/chunk-7BFDUVOG.js +1 -0
  32. package/dist/chunk-7DVOSOEP.js +11 -0
  33. package/dist/chunk-7JESXDF2.js +14 -0
  34. package/dist/chunk-7KJ5TBWG.js +5 -0
  35. package/dist/{chunk-7MUKLZOL.js → chunk-A3VYI4LO.js} +2 -2
  36. package/dist/{chunk-MHWV5RQV.js → chunk-A5SQCM63.js} +2 -2
  37. package/dist/chunk-A6X2IVGT.js +4 -0
  38. package/dist/{chunk-4DCQNGUV.js → chunk-AP3RFOPL.js} +10 -10
  39. package/dist/{chunk-XXVEHDVO.js → chunk-ATPFTRCC.js} +1 -1
  40. package/dist/chunk-AWQ5AR2K.js +5 -0
  41. package/dist/chunk-BECEP46I.js +16 -0
  42. package/dist/{chunk-M56NDIMD.js → chunk-BHWEA4V2.js} +1 -1
  43. package/dist/chunk-BPVZ7E63.js +1 -0
  44. package/dist/chunk-C2FFA4O4.js +1 -0
  45. package/dist/chunk-C3LZPAAH.js +3 -0
  46. package/dist/chunk-C6ABJCRG.js +1 -0
  47. package/dist/chunk-CCEA5CUX.js +1 -0
  48. package/dist/chunk-CE6FKJFS.js +1 -0
  49. package/dist/chunk-CW7WJZKR.js +28 -0
  50. package/dist/chunk-D3DDLLNF.js +2 -0
  51. package/dist/chunk-D656BV5Z.js +25 -0
  52. package/dist/chunk-DCBYHVKW.js +1 -0
  53. package/dist/{chunk-AGNMOFJS.js → chunk-DCK2FX6J.js} +1 -1
  54. package/dist/chunk-DERA4K6A.js +32 -0
  55. package/dist/chunk-DNLOSMHL.js +3 -0
  56. package/dist/chunk-E2YBU6D3.js +294 -0
  57. package/dist/{chunk-M2ZHFKPN.js → chunk-F47MFBKM.js} +1 -1
  58. package/dist/chunk-F6T3UBBL.js +1 -0
  59. package/dist/{chunk-BS3BKORT.js → chunk-FBVBO5YQ.js} +1 -1
  60. package/dist/chunk-FD5S2O6M.js +7 -0
  61. package/dist/chunk-FFYYJKF7.js +1 -0
  62. package/dist/{chunk-KHTV6PBV.js → chunk-FGVC22EY.js} +1 -1
  63. package/dist/{chunk-QA23HIH4.js → chunk-FP2NOZSD.js} +1 -1
  64. package/dist/chunk-FQDRVPCY.js +2 -0
  65. package/dist/{chunk-T542UQBY.js → chunk-FSTCEWXX.js} +1 -1
  66. package/dist/chunk-FTN7Y6HD.js +7 -0
  67. package/dist/{chunk-QBSKKQBN.js → chunk-GVITHCQJ.js} +1 -1
  68. package/dist/chunk-H4W4DFKK.js +1 -0
  69. package/dist/{chunk-UYXEA3Y6.js → chunk-HD5TYIDZ.js} +1 -1
  70. package/dist/chunk-HHXHOQQP.js +3 -0
  71. package/dist/chunk-HJSYHK4S.js +8 -0
  72. package/dist/chunk-HLMFVORT.js +1 -0
  73. package/dist/chunk-HSYRYSX4.js +3 -0
  74. package/dist/chunk-I3LX25MB.js +1 -0
  75. package/dist/chunk-INFBVFMU.js +4 -0
  76. package/dist/chunk-IOQQUHST.js +18 -0
  77. package/dist/chunk-IVGWFPMA.js +19 -0
  78. package/dist/chunk-IWCPQD7X.js +1382 -0
  79. package/dist/chunk-IWE4RUI7.js +1 -0
  80. package/dist/chunk-IXUVSFW2.js +1 -0
  81. package/dist/{chunk-Q4T2T2QE.js → chunk-J6VTZEE2.js} +1 -1
  82. package/dist/{chunk-6ITDI2SD.js → chunk-K3PGC6DC.js} +1 -1
  83. package/dist/{chunk-2AJ5FI2K.js → chunk-K77WAKOB.js} +1 -1
  84. package/dist/{chunk-7NH7CHVI.js → chunk-K7K6GNF6.js} +1 -1
  85. package/dist/chunk-KFCGMT67.js +1 -0
  86. package/dist/chunk-KLA7AWG6.js +7 -0
  87. package/dist/{chunk-UJXUSRQK.js → chunk-KQU6HOJ3.js} +1 -1
  88. package/dist/{chunk-KHSYW7I4.js → chunk-KU5OPV7U.js} +1 -1
  89. package/dist/chunk-L2VSSINY.js +1 -0
  90. package/dist/chunk-LCCMXY6N.js +1 -0
  91. package/dist/{chunk-ZSBA6VIC.js → chunk-LITB5QQX.js} +1 -1
  92. package/dist/chunk-LKS47US7.js +8 -0
  93. package/dist/{chunk-E3EMHAJB.js → chunk-LQMSF3F7.js} +1 -1
  94. package/dist/chunk-LTWXTDDR.js +5 -0
  95. package/dist/{chunk-5WVAHE5E.js → chunk-M2TJICTB.js} +1 -1
  96. package/dist/chunk-M4LOKANA.js +1 -0
  97. package/dist/chunk-M4V2OQAX.js +1 -0
  98. package/dist/chunk-MA52QGHP.js +1 -0
  99. package/dist/chunk-MFLBTJO7.js +1 -0
  100. package/dist/{chunk-6G6TMKXF.js → chunk-MGL4YM3S.js} +21 -21
  101. package/dist/{chunk-4IC626OL.js → chunk-MIO2CV3Q.js} +1 -1
  102. package/dist/{chunk-NMBBTTIH.js → chunk-MKE434RB.js} +1 -1
  103. package/dist/chunk-MZJRNFAU.js +1 -0
  104. package/dist/{chunk-JXW374CL.js → chunk-N3YWHJMB.js} +11 -11
  105. package/dist/{chunk-EKXY5COY.js → chunk-N5ROZKPZ.js} +1 -1
  106. package/dist/chunk-NBYS6YQ2.js +5 -0
  107. package/dist/chunk-NEZEHBT2.js +1 -0
  108. package/dist/chunk-NO5KVFTV.js +22 -0
  109. package/dist/{chunk-6CYMJ76C.js → chunk-NP4UFPAX.js} +1 -1
  110. package/dist/chunk-NPM3MFB3.js +7 -0
  111. package/dist/{chunk-M2D7USAX.js → chunk-NXL6LDJU.js} +1 -1
  112. package/dist/chunk-OA4P6AKS.js +1 -0
  113. package/dist/chunk-OKNBZSGN.js +2 -0
  114. package/dist/chunk-OKOYLEA7.js +278 -0
  115. package/dist/chunk-OLOBQ42K.js +1 -0
  116. package/dist/chunk-OYP7DKPU.js +1 -0
  117. package/dist/{chunk-7UYZQN4V.js → chunk-PBTXPBI6.js} +2 -2
  118. package/dist/chunk-PLQFX5ZP.js +9 -0
  119. package/dist/{chunk-MWY3A7O3.js → chunk-PS25FEBF.js} +1 -1
  120. package/dist/{chunk-OLZHWPZP.js → chunk-PSQFZAF3.js} +1 -1
  121. package/dist/chunk-PUTZFF2Z.js +613 -0
  122. package/dist/chunk-QLQGHMVU.js +15 -0
  123. package/dist/{chunk-FQWB2F75.js → chunk-QTGMS62F.js} +1 -1
  124. package/dist/chunk-R6JNXEB3.js +1 -0
  125. package/dist/chunk-RAH5NW3R.js +1 -0
  126. package/dist/{chunk-KR6QDE7D.js → chunk-RGNAWKD7.js} +1 -1
  127. package/dist/chunk-RL5BWZ7D.js +15 -0
  128. package/dist/{chunk-67MH4AXG.js → chunk-RVMB5LC2.js} +1 -1
  129. package/dist/chunk-SSM346XI.js +5 -0
  130. package/dist/chunk-T5MK7ZSF.js +1 -0
  131. package/dist/{chunk-C7BTJ32Z.js → chunk-TGACBJIY.js} +1 -1
  132. package/dist/{chunk-UJVH7FZS.js → chunk-TLSAQ6FG.js} +1 -1
  133. package/dist/chunk-TNQXTZAX.js +32 -0
  134. package/dist/{chunk-ZGK3LGCH.js → chunk-TQGTEVSR.js} +1 -1
  135. package/dist/chunk-TXUTT6UA.js +17 -0
  136. package/dist/chunk-U3ZG675O.js +5 -0
  137. package/dist/chunk-UARVYVLN.js +3 -0
  138. package/dist/chunk-UBKVCI7A.js +3 -0
  139. package/dist/{chunk-2GK56X53.js → chunk-UCLSPAVX.js} +1 -1
  140. package/dist/chunk-UOQ75BL3.js +1 -0
  141. package/dist/{chunk-ULFWK45W.js → chunk-UOQQNAHX.js} +2 -2
  142. package/dist/chunk-UURFVUAH.js +11 -0
  143. package/dist/chunk-VA5IUGZV.js +2 -0
  144. package/dist/{chunk-XOTA6JTZ.js → chunk-VEDZUOVI.js} +3 -3
  145. package/dist/chunk-VICNWPLQ.js +567 -0
  146. package/dist/chunk-VPL2NDH6.js +370 -0
  147. package/dist/chunk-VT77EFRL.js +10 -0
  148. package/dist/{chunk-TYZXGSHO.js → chunk-VYXVYOIJ.js} +1 -1
  149. package/dist/chunk-WCWNI3ZV.js +283 -0
  150. package/dist/chunk-WNGV4JQS.js +4 -0
  151. package/dist/{chunk-L2MGAEV3.js → chunk-WUK5NQSX.js} +2 -2
  152. package/dist/chunk-X2TC7S57.js +103 -0
  153. package/dist/chunk-X4CV6TRE.js +1 -0
  154. package/dist/chunk-XDAOLCPN.js +4 -0
  155. package/dist/chunk-XFKCDWXB.js +5 -0
  156. package/dist/chunk-XP6IRAZN.js +1 -0
  157. package/dist/{chunk-KN3WTTHZ.js → chunk-XX343DDG.js} +1 -1
  158. package/dist/{chunk-DRFGABEB.js → chunk-XXE7667M.js} +1 -1
  159. package/dist/chunk-YGMVL6NZ.js +6 -0
  160. package/dist/chunk-YJB7P2HC.js +1 -0
  161. package/dist/{chunk-P6XE4MH5.js → chunk-YS6VOQ7I.js} +1 -1
  162. package/dist/chunk-ZZYFG22L.js +26 -0
  163. package/dist/cli/commands/app/app-logs/sources.js +1 -2
  164. package/dist/cli/commands/app/build.js +1 -1
  165. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  166. package/dist/cli/commands/app/bulk/execute.js +1 -9
  167. package/dist/cli/commands/app/bulk/status.js +1 -5
  168. package/dist/cli/commands/app/config/link.js +1 -4
  169. package/dist/cli/commands/app/config/pull.js +1 -1
  170. package/dist/cli/commands/app/config/use.js +1 -1
  171. package/dist/cli/commands/app/config/validate.js +1 -3
  172. package/dist/cli/commands/app/demo/watcher.js +1 -1
  173. package/dist/cli/commands/app/deploy.js +1 -22
  174. package/dist/cli/commands/app/dev/clean.js +1 -5
  175. package/dist/cli/commands/app/dev.js +1 -320
  176. package/dist/cli/commands/app/env/pull.js +1 -11
  177. package/dist/cli/commands/app/env/show.js +1 -1
  178. package/dist/cli/commands/app/execute.js +1 -1
  179. package/dist/cli/commands/app/function/build.js +1 -1
  180. package/dist/cli/commands/app/function/info.js +1 -16
  181. package/dist/cli/commands/app/function/replay.js +1 -5
  182. package/dist/cli/commands/app/function/run.js +1 -1
  183. package/dist/cli/commands/app/function/schema.js +1 -1
  184. package/dist/cli/commands/app/function/typegen.js +1 -1
  185. package/dist/cli/commands/app/generate/extension.js +1 -5
  186. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -4
  187. package/dist/cli/commands/app/import-extensions.js +1 -1
  188. package/dist/cli/commands/app/info.js +1 -11
  189. package/dist/cli/commands/app/init.js +1 -10
  190. package/dist/cli/commands/app/logs.js +1 -2
  191. package/dist/cli/commands/app/release.js +1 -4
  192. package/dist/cli/commands/app/versions/list.js +1 -1
  193. package/dist/cli/commands/app/webhook/trigger.js +1 -25
  194. package/dist/cli/commands/auth/login.js +1 -1
  195. package/dist/cli/commands/auth/logout.js +1 -1
  196. package/dist/cli/commands/cache/clear.js +1 -1
  197. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  198. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  199. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  200. package/dist/cli/commands/debug/command-flags.js +1 -1
  201. package/dist/cli/commands/docs/generate.js +1 -1
  202. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  203. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  204. package/dist/cli/commands/help.js +1 -1
  205. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  206. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  207. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  208. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  209. package/dist/cli/commands/notifications/generate.js +1 -1
  210. package/dist/cli/commands/notifications/list.js +1 -1
  211. package/dist/cli/commands/organization/list.js +1 -1
  212. package/dist/cli/commands/search.js +1 -1
  213. package/dist/cli/commands/theme/check.js +1 -1
  214. package/dist/cli/commands/theme/console.js +1 -15
  215. package/dist/cli/commands/theme/delete.js +1 -7
  216. package/dist/cli/commands/theme/dev.js +1 -26
  217. package/dist/cli/commands/theme/duplicate.js +1 -32
  218. package/dist/cli/commands/theme/info.js +1 -1
  219. package/dist/cli/commands/theme/init.js +1 -8
  220. package/dist/cli/commands/theme/language-server.js +1 -1
  221. package/dist/cli/commands/theme/list.js +1 -1
  222. package/dist/cli/commands/theme/metafields/pull.js +1 -3
  223. package/dist/cli/commands/theme/open.js +1 -8
  224. package/dist/cli/commands/theme/package.js +1 -7
  225. package/dist/cli/commands/theme/preview.js +1 -1
  226. package/dist/cli/commands/theme/profile.js +1 -3
  227. package/dist/cli/commands/theme/publish.js +1 -7
  228. package/dist/cli/commands/theme/pull.js +1 -3
  229. package/dist/cli/commands/theme/push.js +1 -28
  230. package/dist/cli/commands/theme/rename.js +1 -6
  231. package/dist/cli/commands/theme/share.js +1 -3
  232. package/dist/cli/commands/upgrade.js +1 -1
  233. package/dist/cli/commands/version.js +1 -1
  234. package/dist/command-registry.js +1 -1
  235. package/dist/conf-store-6QNH5BID.js +1 -0
  236. package/dist/configs/all.yml +3 -0
  237. package/dist/configs/recommended.yml +3 -0
  238. package/dist/{custom-oclif-loader-DVFFWCBV.js → custom-oclif-loader-TSPWW5YF.js} +1 -1
  239. package/dist/data/filters.json +60 -0
  240. package/dist/data/latest.json +1 -1
  241. package/dist/data/setting.json +29 -9
  242. package/dist/data/shopify_system_translations.json +71 -19
  243. package/dist/data/tags.json +3 -3
  244. package/dist/deprecations-F6JWVV2W.js +1 -0
  245. package/dist/{devtools-OLOT2NY4.js → devtools-HCKYP7DQ.js} +1 -1
  246. package/dist/{devtools-UFRKBFGI.js → devtools-VEZNCV6W.js} +1 -1
  247. package/dist/dist-4BD6KOLR.js +1 -0
  248. package/dist/dist-AUABCVPI.js +1 -0
  249. package/dist/environments-RGLI75HN.js +1 -0
  250. package/dist/error-OZALZZ3U.js +1 -0
  251. package/dist/error-handler-V7LSEXHM.js +1 -0
  252. package/dist/{estree-KI7NUW53.js → estree-BYYJYS3A.js} +1 -1
  253. package/dist/fs-YMUQ6JLE.js +1 -0
  254. package/dist/hooks/app-init.js +1 -1
  255. package/dist/hooks/did-you-mean.js +1 -1
  256. package/dist/hooks/hydrogen-init.js +1 -1
  257. package/dist/hooks/plugin-plugins.js +1 -1
  258. package/dist/hooks/postrun.js +1 -1
  259. package/dist/hooks/prerun.js +1 -1
  260. package/dist/hooks/public-metadata.js +1 -1
  261. package/dist/hooks/sensitive-metadata.js +1 -1
  262. package/dist/hooks/tunnel-provider.js +1 -1
  263. package/dist/hooks/tunnel-start.js +1 -1
  264. package/dist/html-HETICZ2F.js +25 -0
  265. package/dist/index.js +9 -1182
  266. package/dist/is-global-BLIZ57HQ.js +1 -0
  267. package/dist/is-wsl-TN2CXYI7.js +1 -0
  268. package/dist/{latest-version-EFWBOTWM.js → latest-version-6OAYLOBL.js} +1 -1
  269. package/dist/{lib-QB6I6CTC.js → lib-AK5EOIKR.js} +1 -1
  270. package/dist/{lib-C3VO2BQW.js → lib-LVUMLZ4H.js} +1 -1
  271. package/dist/lib-ME6554NA.js +1 -0
  272. package/dist/{local-MTKXSZ3I.js → local-GPDAXHE6.js} +1 -1
  273. package/dist/local-storage-P66KJG6I.js +1 -0
  274. package/dist/{markdown-PLKL4IZK.js → markdown-5TVCXM53.js} +1 -1
  275. package/dist/{metadata-NOVBMKLM.js → metadata-TRH25EHU.js} +1 -1
  276. package/dist/{morph-EMYAITFM.js → morph-I35VYPBH.js} +4 -4
  277. package/dist/node-package-manager-GO4ZRTKQ.js +1 -0
  278. package/dist/notifications-system-HM6JZ6WJ.js +1 -0
  279. package/dist/{npa-ICFSA3NL.js → npa-VNALV7XY.js} +1 -1
  280. package/dist/output-7IYOMPSA.js +1 -0
  281. package/dist/{postcss-3FJQPJI2.js → postcss-IIK6CGAW.js} +1 -1
  282. package/dist/{prettier-NVRHEAFO.js → prettier-ZSBNNQTK.js} +1 -1
  283. package/dist/system-X5C4EQQH.js +1 -0
  284. package/dist/tsconfig.tsbuildinfo +1 -1
  285. package/dist/ui-H62CMRLG.js +1 -0
  286. package/dist/upgrade-EEOPH464.js +1 -0
  287. package/dist/version-76NBQR4K.js +1 -0
  288. package/dist/version-IGSEISUA.js +1 -0
  289. package/dist/workerd-ST6XJKUN.js +18 -0
  290. package/oclif.manifest.json +142 -7
  291. package/package.json +14 -11
  292. package/dist/analytics-5TEIW43T.js +0 -1
  293. package/dist/analytics-GG7CYCGL.js +0 -1
  294. package/dist/angular-VRDO2DBE.js +0 -4
  295. package/dist/chunk-3D4JXJPS.js +0 -2
  296. package/dist/chunk-3NBK56IK.js +0 -1
  297. package/dist/chunk-54CAKCYR.js +0 -144
  298. package/dist/chunk-5UHQVR2Z.js +0 -1
  299. package/dist/chunk-6HBRBQAN.js +0 -6
  300. package/dist/chunk-6SF3ZETE.js +0 -1
  301. package/dist/chunk-6WL4GA2M.js +0 -15
  302. package/dist/chunk-7ESSIN27.js +0 -567
  303. package/dist/chunk-7QIOUDCX.js +0 -8
  304. package/dist/chunk-7ZT57XT7.js +0 -2
  305. package/dist/chunk-AKML26N3.js +0 -7
  306. package/dist/chunk-C2IK2HY3.js +0 -4
  307. package/dist/chunk-CBXSPL4W.js +0 -1
  308. package/dist/chunk-CEIQFLCN.js +0 -1
  309. package/dist/chunk-CERXUPGC.js +0 -14
  310. package/dist/chunk-DCPBRWVC.js +0 -1
  311. package/dist/chunk-DN2IE3VY.js +0 -1
  312. package/dist/chunk-EQU4MUQJ.js +0 -1
  313. package/dist/chunk-F2QU6WWX.js +0 -1
  314. package/dist/chunk-FFQ5EWII.js +0 -294
  315. package/dist/chunk-FKMC5OFF.js +0 -1
  316. package/dist/chunk-FUOIGXI4.js +0 -1
  317. package/dist/chunk-FYFNUDOC.js +0 -19
  318. package/dist/chunk-G4BPGWJC.js +0 -1
  319. package/dist/chunk-GVQIPEZT.js +0 -1
  320. package/dist/chunk-GZS44BUW.js +0 -102
  321. package/dist/chunk-HIBX234C.js +0 -6
  322. package/dist/chunk-HRUGYZZ4.js +0 -2
  323. package/dist/chunk-HUIJMGVJ.js +0 -586
  324. package/dist/chunk-IX5ICOBV.js +0 -7
  325. package/dist/chunk-IZ3C5J7G.js +0 -5
  326. package/dist/chunk-JAO53IH2.js +0 -1
  327. package/dist/chunk-JCL2RRU6.js +0 -1
  328. package/dist/chunk-JQJBBXMX.js +0 -17
  329. package/dist/chunk-K2WUCOQJ.js +0 -32
  330. package/dist/chunk-K6CTUBFC.js +0 -12
  331. package/dist/chunk-KKTW6ZCA.js +0 -5
  332. package/dist/chunk-LDGAHMS7.js +0 -159
  333. package/dist/chunk-M3RYUB22.js +0 -1
  334. package/dist/chunk-MWGBTOO3.js +0 -1
  335. package/dist/chunk-N5PQPIBF.js +0 -374
  336. package/dist/chunk-NF2ABOOU.js +0 -1
  337. package/dist/chunk-NPEVESCV.js +0 -3
  338. package/dist/chunk-OTY24J2W.js +0 -1
  339. package/dist/chunk-OY3PNHPZ.js +0 -103
  340. package/dist/chunk-PAP22IQO.js +0 -264
  341. package/dist/chunk-PYVAWAUO.js +0 -5
  342. package/dist/chunk-S6EJHWJL.js +0 -1
  343. package/dist/chunk-SIMFNECG.js +0 -1
  344. package/dist/chunk-TQ6HYDVC.js +0 -1
  345. package/dist/chunk-UHJYPEY2.js +0 -1
  346. package/dist/chunk-UXVZ2P63.js +0 -1411
  347. package/dist/chunk-WFXRSKRK.js +0 -1
  348. package/dist/chunk-XITQULK4.js +0 -3
  349. package/dist/chunk-XONFGLJQ.js +0 -847
  350. package/dist/chunk-XR6GMMEU.js +0 -1
  351. package/dist/chunk-Y7JGYGV7.js +0 -1
  352. package/dist/chunk-YTNDFQJT.js +0 -3
  353. package/dist/chunk-ZBRRJDGW.js +0 -1
  354. package/dist/chunk-ZTMSBSYD.js +0 -1
  355. package/dist/conf-store-BMZFATRQ.js +0 -1
  356. package/dist/deprecations-7LHRXPXU.js +0 -1
  357. package/dist/dist-LDXPBYSZ.js +0 -1
  358. package/dist/dist-V63ILV6L.js +0 -1
  359. package/dist/environments-5X7S2O5U.js +0 -1
  360. package/dist/error-ZRLNNGIQ.js +0 -1
  361. package/dist/error-handler-PRZFHPRG.js +0 -1
  362. package/dist/fs-H7V6IRSH.js +0 -1
  363. package/dist/html-VSSXOZOQ.js +0 -25
  364. package/dist/is-global-IOWPCT2U.js +0 -1
  365. package/dist/is-wsl-FVUIXDOK.js +0 -1
  366. package/dist/lib-5L7UKDEK.js +0 -1
  367. package/dist/local-storage-CYEL4MXF.js +0 -1
  368. package/dist/node-package-manager-N5CVNHA3.js +0 -1
  369. package/dist/notifications-system-YX2GPLDW.js +0 -1
  370. package/dist/output-Q46DT46U.js +0 -1
  371. package/dist/system-E6Q3OBX3.js +0 -1
  372. package/dist/ui-WRS2IDPP.js +0 -1
  373. package/dist/upgrade-TKUN2M5P.js +0 -1
  374. package/dist/version-5W5RVAPA.js +0 -1
  375. package/dist/version-BQJ3FPXD.js +0 -1
  376. package/dist/workerd-GOK6GWEX.js +0 -18
  377. /package/dist/{acorn-LOOAJL3S.js → acorn-QBS5IYTX.js} +0 -0
  378. /package/dist/{babel-URCL33XX.js → babel-JS32NLHY.js} +0 -0
  379. /package/dist/{flow-MLHT7MTJ.js → flow-M3Q2HPQT.js} +0 -0
  380. /package/dist/{glimmer-HAJ4HQCW.js → glimmer-3DEJJGOJ.js} +0 -0
  381. /package/dist/{graphql-F7IHGXDT.js → graphql-A4HHE3MB.js} +0 -0
  382. /package/dist/{meriyah-AYZQ3BGY.js → meriyah-23OZNYWC.js} +0 -0
  383. /package/dist/{typescript-ODJ335NU.js → typescript-YKZ232QT.js} +0 -0
  384. /package/dist/{yaml-BIHS2GQW.js → yaml-SJKIH3VD.js} +0 -0
@@ -0,0 +1,278 @@
1
+ import{b as Ia}from"./chunk-PSQFZAF3.js";import{$ as ga,A as ia,Aa as Ca,B as C,Ba as Oa,C as X,Ca as Ta,D as aa,E as Ne,F as Wr,G as vt,H as Nt,I as Ve,Ia as $o,J as sa,Ja as Da,K as lt,Ka as sn,L as qe,La as _t,M as ca,Ma as Bt,N as Yr,Na as lr,O as De,Oa as cn,P as Do,Pa as Vt,Q as la,Qa as ln,R as Lt,Ra as $a,S as Mt,Sa as Ra,T as ua,Ta as ja,U as zr,Ua as un,V as fa,Va as Fa,W as da,Wa as Aa,X as ma,Xa as Na,Y as pa,Z as ha,_ as wt,a as Te,aa as oe,b as ir,ba as Ht,c as Qi,ca as ya,d as Je,da as va,e as Be,ea as Kr,f as yt,fa as Jr,g as Xi,ga as wa,h as Zi,ha as Ie,i as ea,ia as ba,j as xo,ja as _a,k as At,ka as Io,l as ar,la as Sa,m as ct,ma as Ea,n as ta,na as ka,o as Vr,oa as Qr,p as Po,pa as Xr,q as sr,qa as Zr,r as Co,ra as xa,s as ra,sa as en,t as na,ta as tn,u as Oo,ua as Pa,v as oa,va as rn,w as To,wa as nn,x as qr,xa as bt,y as Gr,ya as Ut,z as cr,za as on}from"./chunk-N3YWHJMB.js";import{a as Vi}from"./chunk-3VZEETAV.js";import{a as La}from"./chunk-LQMSF3F7.js";import{b as qi,c as Gi,d as Br,g as Wi,i as Yi,j as zi,k as Ki}from"./chunk-VYXVYOIJ.js";import{a as Ru,b as Ji,d as ju}from"./chunk-FGVC22EY.js";import{a as fn}from"./chunk-WDC3KIZT.js";import{a as an,b as Ro,c as jo}from"./chunk-42RMKTCJ.js";import{c as Bi}from"./chunk-QSTEVZFQ.js";import{Aa as Tu,Ba as Du,Da as Iu,Ea as Ni,Fa as Li,Ga as $u,fa as Oe,m as Di,n as _e,za as Ou}from"./chunk-4V4DQ6W7.js";import{B as Ai,l as $i,m as He,p as Ft,s as Ri,u as ji,x as Fi}from"./chunk-WUK5NQSX.js";import{b as L}from"./chunk-VEDZUOVI.js";import{b as Ti}from"./chunk-JUVAGMIH.js";import{A as Ke,D as he,O as Mi,a as Mr,u as ee,v as z,w as ne,y as ot,z as it}from"./chunk-MGL4YM3S.js";import{d as T,g as Hr}from"./chunk-BHWEA4V2.js";import{a as Fu}from"./chunk-HZA6IAA4.js";import{b as Cu}from"./chunk-QYR5VPQA.js";import{$ as xi,Bb as Ii,Ca as So,Ea as Nr,Fb as Ue,Ga as Ci,Ha as Oi,Hb as ae,Jb as at,Ka as Eo,Mb as V,Nb as Hi,Oa as ko,Ob as st,Pb as Ui,Qb as Z,Rb as Se,Ta as re,V as Fr,Wa as or,ma as ke,na as Pi,pa as Ar,qa as _o,qb as Lr,ua as le,wa as nr,ya as Me}from"./chunk-VPL2NDH6.js";import{u as J}from"./chunk-7JESXDF2.js";import{s as Ur}from"./chunk-UARVYVLN.js";import{d as R,f as A,g as be,i as bo,j as jt,k as Ei,q as ki}from"./chunk-IU2ZQ6TE.js";import{a as te,c as we,e as fe,g as p}from"./chunk-VPRTJUIN.js";var is=we((os,Ho)=>{p();(function(e){if(typeof os=="object"&&typeof Ho<"u")Ho.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t=this,t.bugsnag=e()}})(function(){var e,t,r,n=(function(){function o(l,s,f,y){y===void 0&&(y=new Date),this.type=f,this.message=l,this.metadata=s,this.timestamp=y}var c=o.prototype;return c.toJSON=function(){return{type:this.type,name:this.message,timestamp:this.timestamp,metaData:this.metadata}},o})(),i=n,a=["navigation","request","process","log","user","state","error","manual"],u=function(o,c,l){for(var s=l,f=0,y=o.length;f<y;f++)s=c(s,o[f],f,o);return s},d=function(o,c){return u(o,function(l,s,f,y){return c(s,f,y)?l.concat(s):l},[])},m=function(o,c){return u(o,function(l,s,f,y){return l===!0||s===c},!1)},h=function(o){return Object.prototype.toString.call(o)==="[object Array]"},g=!{toString:null}.propertyIsEnumerable("toString"),w=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],v=function(o){var c=[],l;for(l in o)Object.prototype.hasOwnProperty.call(o,l)&&c.push(l);if(!g)return c;for(var s=0,f=w.length;s<f;s++)Object.prototype.hasOwnProperty.call(o,w[s])&&c.push(w[s]);return c},S=function(o,c){return o===void 0&&(o=1),c===void 0&&(c=1/0),function(l){return typeof l=="number"&&parseInt(""+l,10)===l&&l>=o&&l<=c}},E=function(o){return typeof o=="function"||h(o)&&d(o,function(c){return typeof c=="function"}).length===o.length},x=function(o){return typeof o=="string"&&!!o.length},O={},k=function(){return{unhandledExceptions:!0,unhandledRejections:!0}};O.schema={apiKey:{defaultValue:function(){return null},message:"is required",validate:x},appVersion:{defaultValue:function(){},message:"should be a string",validate:function(o){return o===void 0||x(o)}},appType:{defaultValue:function(){},message:"should be a string",validate:function(o){return o===void 0||x(o)}},autoDetectErrors:{defaultValue:function(){return!0},message:"should be true|false",validate:function(o){return o===!0||o===!1}},enabledErrorTypes:{defaultValue:function(){return k()},message:"should be an object containing the flags { unhandledExceptions:true|false, unhandledRejections:true|false }",allowPartialObject:!0,validate:function(o){if(typeof o!="object"||!o)return!1;var c=v(o),l=v(k());return!(d(c,function(s){return m(l,s)}).length<c.length||d(v(o),function(s){return typeof o[s]!="boolean"}).length>0)}},onError:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:E},onSession:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:E},onBreadcrumb:{defaultValue:function(){return[]},message:"should be a function or array of functions",validate:E},endpoints:{defaultValue:function(o){return typeof o>"u"?{notify:"https://notify.bugsnag.com",sessions:"https://sessions.bugsnag.com"}:{notify:null,sessions:null}},message:"should be an object containing endpoint URLs { notify, sessions }",validate:function(o){return o&&typeof o=="object"&&x(o.notify)&&x(o.sessions)&&d(v(o),function(c){return!m(["notify","sessions"],c)}).length===0}},autoTrackSessions:{defaultValue:function(o){return!0},message:"should be true|false",validate:function(o){return o===!0||o===!1}},enabledReleaseStages:{defaultValue:function(){return null},message:"should be an array of strings",validate:function(o){return o===null||h(o)&&d(o,function(c){return typeof c=="string"}).length===o.length}},releaseStage:{defaultValue:function(){return"production"},message:"should be a string",validate:function(o){return typeof o=="string"&&o.length}},maxBreadcrumbs:{defaultValue:function(){return 25},message:"should be a number \u2264100",validate:function(o){return S(0,100)(o)}},enabledBreadcrumbTypes:{defaultValue:function(){return a},message:"should be null or a list of available breadcrumb types ("+a.join(",")+")",validate:function(o){return o===null||h(o)&&u(o,function(c,l){return c===!1?c:m(a,l)},!0)}},context:{defaultValue:function(){},message:"should be a string",validate:function(o){return o===void 0||typeof o=="string"}},user:{defaultValue:function(){return{}},message:"should be an object with { id, email, name } properties",validate:function(o){return o===null||o&&u(v(o),function(c,l){return c&&m(["id","email","name"],l)},!0)}},metadata:{defaultValue:function(){return{}},message:"should be an object",validate:function(o){return typeof o=="object"&&o!==null}},logger:{defaultValue:function(){},message:"should be null or an object with methods { debug, info, warn, error }",validate:function(o){return!o||o&&u(["debug","info","warn","error"],function(c,l){return c&&typeof o[l]=="function"},!0)}},redactedKeys:{defaultValue:function(){return["password"]},message:"should be an array of strings|regexes",validate:function(o){return h(o)&&o.length===d(o,function(c){return typeof c=="string"||c&&typeof c.test=="function"}).length}},plugins:{defaultValue:function(){return[]},message:"should be an array of plugin objects",validate:function(o){return h(o)&&o.length===d(o,function(c){return c&&typeof c=="object"&&typeof c.load=="function"}).length}},featureFlags:{defaultValue:function(){return[]},message:'should be an array of objects that have a "name" property',validate:function(o){return h(o)&&o.length===d(o,function(c){return c&&typeof c=="object"&&typeof c.name=="string"}).length}},reportUnhandledPromiseRejectionsAsHandled:{defaultValue:function(){return!1},message:"should be true|false",validate:function(o){return o===!0||o===!1}},sendPayloadChecksums:{defaultValue:function(){return!1},message:"should be true|false",validate:function(o){return o===!0||o===!1}}};var P=Ou(),b=function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)Object.prototype.hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},D=function(o,c){return u(o,function(l,s,f,y){return l.concat(c(s,f,y))},[])},j=function(o,c,l,s){var f=s&&s.redactedKeys?s.redactedKeys:[],y=s&&s.redactedPaths?s.redactedPaths:[];return JSON.stringify(Pt(o,f,y),c,l)},B=20,N=25e3,W=8,H="...";function F(o){return o instanceof Error||/^\[object (Error|(Dom)?Exception)\]$/.test(Object.prototype.toString.call(o))}function G(o){return"[Throws: "+(o?o.message:"?")+"]"}function K(o,c){for(var l=0,s=o.length;l<s;l++)if(o[l]===c)return!0;return!1}function q(o,c){for(var l=0,s=o.length;l<s;l++)if(c.indexOf(o[l])===0)return!0;return!1}function se(o,c){for(var l=0,s=o.length;l<s;l++)if(typeof o[l]=="string"&&o[l].toLowerCase()===c.toLowerCase()||o[l]&&typeof o[l].test=="function"&&o[l].test(c))return!0;return!1}function Re(o){return Object.prototype.toString.call(o)==="[object Array]"}function We(o,c){try{return o[c]}catch(l){return G(l)}}function Pt(o,c,l){var s=[],f=0;function y(_,I){function $(){return I.length>W&&f>N}if(f++,I.length>B||$())return H;if(_===null||typeof _!="object")return _;if(K(s,_))return"[Circular]";if(s.push(_),typeof _.toJSON=="function")try{f--;var U=y(_.toJSON(),I);return s.pop(),U}catch(Rt){return G(Rt)}var Y=F(_);if(Y){f--;var ue=y({name:_.name,message:_.message},I);return s.pop(),ue}if(Re(_)){for(var pe=[],nt=0,Ae=_.length;nt<Ae;nt++){if($()){pe.push(H);break}pe.push(y(_[nt],I.concat("[]")))}return s.pop(),pe}var $t={};try{for(var ze in _)if(Object.prototype.hasOwnProperty.call(_,ze)){if(q(l,I.join("."))&&se(c,ze)){$t[ze]="[REDACTED]";continue}if($()){$t[ze]=H;break}$t[ze]=y(We(_,ze),I.concat(ze))}}catch{}return s.pop(),$t}return y(o,[])}function Ze(o,c,l,s){if(typeof l=="string"){s===void 0?s=null:s!==null&&typeof s!="string"&&(s=j(s));var f=c[l];if(typeof f=="number"){o[f]={name:l,variant:s};return}o.push({name:l,variant:s}),c[l]=o.length-1}}function ht(o,c,l){if(h(c)){for(var s=0;s<c.length;++s){var f=c[s];f===null||typeof f!="object"||Ze(o,l,f.name,f.variant)}return o}}function ie(o){return D(d(o,Boolean),function(c){var l=c.name,s=c.variant,f={featureFlag:l};return typeof s=="string"&&(f.variant=s),f})}function ge(o,c,l){var s=c[l];typeof s=="number"&&(o[s]=null,delete c[l])}var je={add:Ze,clear:ge,merge:ht,toEventApi:ie},et=function(o){return!!o&&(!!o.stack||!!o.stacktrace||!!o["opera#sourceloc"])&&typeof(o.stack||o.stacktrace||o["opera#sourceloc"])=="string"&&o.stack!==o.name+": "+o.message},Ye=Tu(),no=function(o,c,l,s){var f;if(c){var y;if(l===null)return kr(o,c);typeof l=="object"&&(y=l),typeof l=="string"&&(y=(f={},f[l]=s,f)),y&&(c==="__proto__"||c==="constructor"||c==="prototype"||(o[c]||(o[c]={}),o[c]=b({},o[c],y)))}},Er=function(o,c,l){if(typeof c=="string"){if(!l)return o[c];if(o[c])return o[c][l]}},kr=function(o,c,l){if(typeof c=="string"){if(!l){delete o[c];return}c==="__proto__"||c==="constructor"||c==="prototype"||o[c]&&delete o[c][l]}},Pe={add:no,get:Er,clear:kr};function Ct(){return Ct=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)({}).hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},Ct.apply(null,arguments)}var Xt=Du(),Le=(function(){function o(l,s,f,y,_){f===void 0&&(f=[]),y===void 0&&(y=M()),this.apiKey=void 0,this.context=void 0,this.groupingHash=void 0,this.originalError=_,this._handledState=y,this.severity=this._handledState.severity,this.unhandled=this._handledState.unhandled,this.app={},this.device={},this.request={},this.response={},this.breadcrumbs=[],this.threads=[],this._metadata={},this._features=[],this._featuresIndex={},this._user={},this._session=void 0,this._correlation=void 0,this._groupingDiscriminator=void 0,this.errors=[Ce(l,s,o.__type,f)]}var c=o.prototype;return c.addMetadata=function(s,f,y){return Pe.add(this._metadata,s,f,y)},c.setTraceCorrelation=function(s,f){typeof s=="string"&&(this._correlation=Ct({traceId:s},typeof f=="string"?{spanId:f}:{}))},c.getGroupingDiscriminator=function(){return this._groupingDiscriminator},c.setGroupingDiscriminator=function(s){var f=this._groupingDiscriminator;return(typeof s=="string"||s===null||s===void 0)&&(this._groupingDiscriminator=s),f},c.getMetadata=function(s,f){return Pe.get(this._metadata,s,f)},c.clearMetadata=function(s,f){return Pe.clear(this._metadata,s,f)},c.addFeatureFlag=function(s,f){f===void 0&&(f=null),je.add(this._features,this._featuresIndex,s,f)},c.addFeatureFlags=function(s){je.merge(this._features,s,this._featuresIndex)},c.getFeatureFlags=function(){return je.toEventApi(this._features)},c.clearFeatureFlag=function(s){je.clear(this._features,this._featuresIndex,s)},c.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},c.getUser=function(){return this._user},c.setUser=function(s,f,y){this._user={id:s,email:f,name:y}},c.toJSON=function(){return{payloadVersion:"4",exceptions:D(this.errors,function(s){return b({},s,{message:s.errorMessage})}),severity:this.severity,unhandled:this._handledState.unhandled,severityReason:this._handledState.severityReason,app:this.app,device:this.device,request:this.request,response:this.response,breadcrumbs:this.breadcrumbs,context:this.context,groupingHash:this.groupingHash,groupingDiscriminator:this._groupingDiscriminator,metaData:this._metadata,user:this._user,session:this._session,featureFlags:this.getFeatureFlags(),correlation:this._correlation}},o})(),xr=function(o){var c={file:o.fileName,method:oo(o.functionName),lineNumber:o.lineNumber,columnNumber:o.columnNumber,code:void 0,inProject:void 0};return c.lineNumber>-1&&!c.file&&!c.method&&(c.file="global code"),c},oo=function(o){return/^global code$/i.test(o)?"global code":o},M=function(){return{unhandled:!1,severity:"warning",severityReason:{type:"handledException"}}},ce=function(o){return typeof o=="string"?o:""};function Ce(o,c,l,s){return{errorClass:ce(o),errorMessage:ce(c),type:l,stacktrace:u(s,function(f,y){var _=xr(y);try{return JSON.stringify(_)==="{}"?f:f.concat(_)}catch{return f}},[])}}function tt(o){return o.cause?[o].concat(tt(o.cause)):[o]}Le.getStacktrace=function(o,c,l){if(et(o))return P.parse(o).slice(c);try{return d(Xt.backtrace(),function(s){return(s.functionName||"").indexOf("StackGenerator$$")===-1}).slice(1+l)}catch{return[]}},Le.create=function(o,c,l,s,f,y){f===void 0&&(f=0);var _=Tt(o,c,s,y),I=_[0],$=_[1],U;try{var Y=Le.getStacktrace(I,$>0?1+$+f:0,1+f);U=new Le(I.name,I.message,Y,l,o)}catch{U=new Le(I.name,I.message,[],l,o)}if(I.name==="InvalidError"&&U.addMetadata(""+s,"non-error parameter",Ot(o)),I.cause){var ue,pe=tt(I).slice(1),nt=D(pe,function(Ae){var $t=Ye(Ae)&&et(Ae)?P.parse(Ae):[],ze=Tt(Ae,!0,"error cause"),Rt=ze[0];return Rt.name==="InvalidError"&&U.addMetadata("error cause",Ot(Ae)),Ce(Rt.name,Rt.message,Le.__type,$t)});(ue=U.errors).push.apply(ue,nt)}return U};var Ot=function(o){return o===null?"null":o===void 0?"undefined":o},Tt=function(o,c,l,s){var f,y=0,_=function(I){var $=l==="error cause"?"was":"received";s&&s.warn(l+" "+$+' a non-error: "'+I+'"');var U=new Error(l+" "+$+' a non-error. See "'+l+'" tab for more detail.');return U.name="InvalidError",U};if(!c)Ye(o)?f=o:(f=_(typeof o),y+=2);else switch(typeof o){case"string":case"number":case"boolean":f=new Error(String(o)),y+=1;break;case"function":f=_("function"),y+=2;break;case"object":o!==null&&Ye(o)?f=o:o!==null&&io(o)?(f=new Error(o.message||o.errorMessage),f.name=o.name||o.errorClass,y+=1):(f=_(o===null?"null":"unsupported object"),y+=2);break;default:f=_("nothing"),y+=2}if(!et(f))try{throw f}catch(I){et(I)&&(f=I,y=1)}return[f,y]};Le.__type="browserjs";var io=function(o){return(typeof o.name=="string"||typeof o.errorClass=="string")&&(typeof o.message=="string"||typeof o.errorMessage=="string")},Dt=Le,ai=function(o,c,l){var s=0,f=function(){if(s>=o.length)return l(null,!0);c(o[s],function(y,_){if(y)return l(y);if(_===!1)return l(null,!1);s++,f()})};f()},Pr=function(o,c,l,s){var f=function(y,_){if(typeof y!="function")return _(null);try{if(y.length!==2){var I=y(c);return I&&typeof I.then=="function"?I.then(function($){return setTimeout(function(){return _(null,$)})},function($){setTimeout(function(){return l($),_(null,!0)})}):_(null,I)}y(c,function($,U){if($)return l($),_(null);_(null,U)})}catch($){l($),_(null)}};ai(o,f,s)},Zt=function(o,c,l,s){for(var f=!1,y=o.slice();!f&&y.length;)try{f=y.pop()(c)===!1}catch(_){s.error("Error occurred in "+l+" callback, continuing anyway\u2026"),s.error(_)}return f},Cr=function(c,l){var s="000000000"+c;return s.substr(s.length-l)},fl=te("os");function dl(){try{return fl.hostname()}catch{return process.env._CLUSTER_NETWORK_NAME_||process.env.COMPUTERNAME||"hostname"}}var si=2,ml=Cr(process.pid.toString(36),si),ci=dl(),pl=ci.length,hl=Cr(ci.split("").reduce(function(o,c){return+o+c.charCodeAt(0)},+pl+36).toString(36),si),li=function(){return ml+hl},gl=function(c){return typeof c=="string"&&/^c[a-z0-9]{20,32}$/.test(c)},er=0,ao=4,Or=36,ui=Math.pow(Or,ao);function fi(){return Cr((Math.random()*ui<<0).toString(Or),ao)}function yl(){return er=er<ui?er:0,er++,er-1}function so(){var o="c",c=new Date().getTime().toString(Or),l=Cr(yl().toString(Or),ao),s=li(),f=fi()+fi();return o+c+l+s+f}so.fingerprint=li,so.isCuid=gl;var vl=so,wl=(function(){function o(){this.id=vl(),this.startedAt=new Date,this._handled=0,this._unhandled=0,this._user={},this.app={},this.device={}}var c=o.prototype;return c.getUser=function(){return this._user},c.setUser=function(s,f,y){this._user={id:s,email:f,name:y}},c.toJSON=function(){return{id:this.id,startedAt:this.startedAt,events:{handled:this._handled,unhandled:this._unhandled}}},c._track=function(s){this[s._handledState.unhandled?"_unhandled":"_handled"]+=1},o})(),co=wl,bl=je.add,_l=je.clear,lo=je.merge,Sl="00000",El="https://notify.bugsnag.smartbear.com",kl="https://sessions.bugsnag.smartbear.com",rt=function(){},xl=(function(){function o(l,s,f,y){var _=this;s===void 0&&(s=O.schema),f===void 0&&(f=[]),this._notifier=y,this._config={},this._schema=s,this._delivery={sendSession:rt,sendEvent:rt},this._logger={debug:rt,info:rt,warn:rt,error:rt},this._plugins={},this._breadcrumbs=[],this._session=null,this._metadata={},this._featuresIndex={},this._features=[],this._context=void 0,this._user={},this._groupingDiscriminator=void 0,this._cbs={e:[],s:[],sp:[],b:[]},this.Client=o,this.Event=Dt,this.Breadcrumb=i,this.Session=co,this._config=this._configure(l,f),D(f.concat(this._config.plugins),function(U){U&&_._loadPlugin(U)}),this._depth=1;var I=this,$=this.notify;this.notify=function(){return $.apply(I,arguments)}}var c=o.prototype;return c.addMetadata=function(s,f,y){return Pe.add(this._metadata,s,f,y)},c.getMetadata=function(s,f){return Pe.get(this._metadata,s,f)},c.clearMetadata=function(s,f){return Pe.clear(this._metadata,s,f)},c.addFeatureFlag=function(s,f){f===void 0&&(f=null),bl(this._features,this._featuresIndex,s,f)},c.addFeatureFlags=function(s){lo(this._features,s,this._featuresIndex)},c.clearFeatureFlag=function(s){_l(this._features,this._featuresIndex,s)},c.clearFeatureFlags=function(){this._features=[],this._featuresIndex={}},c.getContext=function(){return this._context},c.setContext=function(s){this._context=s},c.getGroupingDiscriminator=function(){return this._groupingDiscriminator},c.setGroupingDiscriminator=function(s){var f=this._groupingDiscriminator;return(typeof s=="string"||s===null||s===void 0)&&(this._groupingDiscriminator=s),f},c._configure=function(s,f){var y=u(f,function(U,Y){return Y&&Y.configSchema?b({},U,Y.configSchema):U},this._schema);s.endpoints||(s.sendPayloadChecksums="sendPayloadChecksums"in s?s.sendPayloadChecksums:!0);var _=u(v(y),function(U,Y){var ue=y[Y].defaultValue(s[Y]);if(s[Y]!==void 0){var pe=y[Y].validate(s[Y]);pe?y[Y].allowPartialObject?U.config[Y]=b(ue,s[Y]):U.config[Y]=s[Y]:(U.errors[Y]=y[Y].message,U.config[Y]=ue)}else U.config[Y]=ue;return U},{errors:{},config:{}}),I=_.errors,$=_.config;if(y.apiKey){if(!$.apiKey)throw new Error("No Bugsnag API Key set");/^[0-9a-f]{32}$/i.test($.apiKey)||(I.apiKey="should be a string of 32 hexadecimal characters"),s.endpoints===void 0&&$.apiKey.indexOf(Sl)===0&&($.endpoints={notify:El,sessions:kl})}return this._metadata=b({},$.metadata),lo(this._features,$.featureFlags,this._featuresIndex),this._user=b({},$.user),this._context=$.context,$.logger&&(this._logger=$.logger),$.onError&&(this._cbs.e=this._cbs.e.concat($.onError)),$.onBreadcrumb&&(this._cbs.b=this._cbs.b.concat($.onBreadcrumb)),$.onSession&&(this._cbs.s=this._cbs.s.concat($.onSession)),v(I).length&&this._logger.warn(Pl(I,s)),$},c.getUser=function(){return this._user},c.setUser=function(s,f,y){this._user={id:s,email:f,name:y}},c._loadPlugin=function(s){var f=s.load(this);s.name&&(this._plugins["~"+s.name+"~"]=f)},c.getPlugin=function(s){return this._plugins["~"+s+"~"]},c._setDelivery=function(s){this._delivery=s(this)},c.startSession=function(){var s=new co;s.app.releaseStage=this._config.releaseStage,s.app.version=this._config.appVersion,s.app.type=this._config.appType,s._user=b({},this._user);var f=Zt(this._cbs.s,s,"onSession",this._logger);return f?(this._logger.debug("Session not started due to onSession callback"),this):this._sessionDelegate.startSession(this,s)},c.addOnError=function(s,f){f===void 0&&(f=!1),this._cbs.e[f?"unshift":"push"](s)},c.removeOnError=function(s){this._cbs.e=d(this._cbs.e,function(f){return f!==s})},c._addOnSessionPayload=function(s){this._cbs.sp.push(s)},c.addOnSession=function(s){this._cbs.s.push(s)},c.removeOnSession=function(s){this._cbs.s=d(this._cbs.s,function(f){return f!==s})},c.addOnBreadcrumb=function(s,f){f===void 0&&(f=!1),this._cbs.b[f?"unshift":"push"](s)},c.removeOnBreadcrumb=function(s){this._cbs.b=d(this._cbs.b,function(f){return f!==s})},c.pauseSession=function(){return this._sessionDelegate.pauseSession(this)},c.resumeSession=function(){return this._sessionDelegate.resumeSession(this)},c.leaveBreadcrumb=function(s,f,y){if(s=typeof s=="string"?s:"",y=typeof y=="string"&&m(a,y)?y:"manual",f=typeof f=="object"&&f!==null?f:{},!!s){var _=new i(s,f,y),I=Zt(this._cbs.b,_,"onBreadcrumb",this._logger);if(I){this._logger.debug("Breadcrumb not attached due to onBreadcrumb callback");return}this._breadcrumbs.push(_),this._breadcrumbs.length>this._config.maxBreadcrumbs&&(this._breadcrumbs=this._breadcrumbs.slice(this._breadcrumbs.length-this._config.maxBreadcrumbs))}},c._isBreadcrumbTypeEnabled=function(s){var f=this._config.enabledBreadcrumbTypes;return f===null||m(f,s)},c.notify=function(s,f,y){y===void 0&&(y=rt);var _=Dt.create(s,!0,void 0,"notify()",this._depth+1,this._logger);this._notify(_,f,y)},c._notify=function(s,f,y){var _=this;if(y===void 0&&(y=rt),s.app=b({},s.app,{releaseStage:this._config.releaseStage,version:this._config.appVersion,type:this._config.appType}),s.context=s.context||this._context,s._metadata=b({},s._metadata,this._metadata),s._user=b({},s._user,this._user),s.breadcrumbs=this._breadcrumbs.slice(),s.setGroupingDiscriminator(this._groupingDiscriminator),lo(s._features,this._features,s._featuresIndex),this._config.enabledReleaseStages!==null&&!m(this._config.enabledReleaseStages,this._config.releaseStage))return this._logger.warn("Event not sent due to releaseStage/enabledReleaseStages configuration"),y(null,s);var I=s.severity,$=function(Y){_._logger.error("Error occurred in onError callback, continuing anyway\u2026"),_._logger.error(Y)},U=[].concat(this._cbs.e).concat(f);Pr(U,s,$,function(Y,ue){if(Y&&$(Y),!ue)return _._logger.debug("Event not sent due to onError callback"),y(null,s);_._isBreadcrumbTypeEnabled("error")&&o.prototype.leaveBreadcrumb.call(_,s.errors[0].errorClass,{errorClass:s.errors[0].errorClass,errorMessage:s.errors[0].errorMessage,severity:s.severity},"error"),I!==s.severity&&(s._handledState.severityReason={type:"userCallbackSetSeverity"}),s.unhandled!==s._handledState.unhandled&&(s._handledState.severityReason.unhandledOverridden=!0,s._handledState.unhandled=s.unhandled),_._session&&(_._session._track(s),s._session=_._session),_._delivery.sendEvent({apiKey:s.apiKey||_._config.apiKey,notifier:_._notifier,events:[s]},function(pe){return y(pe,s)})})},o})(),Pl=function(o,c){var l=new Error(`Invalid configuration
2
+ `+D(v(o),function(s){return" - "+s+" "+o[s]+", got "+Cl(c[s])}).join(`
3
+
4
+ `));return l},Cl=function(o){switch(typeof o){case"string":case"number":case"object":return JSON.stringify(o);default:return String(o)}},Tr=xl,Dr={},di=["events.[].metaData","events.[].breadcrumbs.[].metaData","events.[].request","events.[].response"];Dr.event=function(o,c){var l=j(o,null,null,{redactedPaths:di,redactedKeys:c});return l.length>1e6&&(o.events[0]._metadata={notifier:`WARNING!
5
+ Serialized payload was `+l.length/1e6+`MB (limit = 1MB)
6
+ metadata was removed`},l=j(o,null,null,{redactedPaths:di,redactedKeys:c})),l},Dr.session=function(o,c){var l=j(o,null,null);return l};var Ol=te("http"),Tl=te("https"),Dl=te("url"),Il=Dl.parse,mi=function(o,c){var l=o.url,s=o.headers,f=o.body,y=o.agent,_=!1,I=function(pe){_||(_=!0,c(pe))},$=Il(l),U=$.protocol==="https:",Y=U?Tl:Ol,ue=Y.request({method:"POST",hostname:$.hostname,port:$.port,path:$.path,headers:s,agent:y});ue.on("error",I),ue.on("response",function(pe){$l(pe,function(nt,Ae){if(nt)return I(nt);if(pe.statusCode<200||pe.statusCode>=300)return I(new Error("Bad statusCode from API: "+pe.statusCode+`
7
+ `+Ae));c(null,Ae)})}),ue.write(f),ue.end()},$l=function(o,c){var l="";o.on("error",c),o.setEncoding("utf8"),o.on("data",function(s){l+=s}),o.on("end",function(){return c(null,l)})},Rl=function(o){return{sendEvent:function(c,l){l===void 0&&(l=function(){});var s=Dr.event(c,o._config.redactedKeys),f=function(_){_&&o._logger.error(`Event failed to send\u2026
8
+ `+(_&&_.stack?_.stack:_),_),s.length>1e6&&o._logger.warn("Event oversized ("+(s.length/1e6).toFixed(2)+" MB)"),l(_)};if(o._config.endpoints.notify===null){var y=new Error("Event not sent due to incomplete endpoint configuration");return f(y)}try{mi({url:o._config.endpoints.notify,headers:{"Content-Type":"application/json","Bugsnag-Api-Key":c.apiKey||o._config.apiKey,"Bugsnag-Payload-Version":"4","Bugsnag-Sent-At":new Date().toISOString()},body:s,agent:o._config.agent},function(_,I){return f(_)})}catch(_){f(_)}},sendSession:function(c,l){l===void 0&&(l=function(){});var s=function(y){y&&o._logger.error(`Session failed to send\u2026
9
+ `+(y&&y.stack?y.stack:y),y),l(y)};if(o._config.endpoints.session===null){var f=new Error("Session not sent due to incomplete endpoint configuration");return s(f)}try{mi({url:o._config.endpoints.sessions,headers:{"Content-Type":"application/json","Bugsnag-Api-Key":o._config.apiKey,"Bugsnag-Payload-Version":"1","Bugsnag-Sent-At":new Date().toISOString()},body:Dr.session(c,o._config.redactedKeys),agent:o._config.agent},function(y){return s(y)})}catch(y){s(y)}}}};function tr(){return tr=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)({}).hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},tr.apply(null,arguments)}var uo=O.schema,jl=te("os"),Fl=te("util"),Al=Fl.inspect,Nl={appType:tr({},uo.appType,{defaultValue:function(){return"node"}}),projectRoot:{defaultValue:function(){return process.cwd()},validate:function(o){return o===null||x(o)},message:"should be string"},hostname:{defaultValue:function(){return jl.hostname()},message:"should be a string",validate:function(o){return o===null||x(o)}},logger:tr({},uo.logger,{defaultValue:function(){return Ll()}}),releaseStage:tr({},uo.releaseStage,{defaultValue:function(){return process.env.NODE_ENV||"production"}}),agent:{defaultValue:function(){},message:"should be an HTTP(s) agent",validate:function(o){return o===void 0||Ml(o)}},onUncaughtException:{defaultValue:function(){return function(o,c,l){l.error("Uncaught exception"+hi(c)+`, the process will now terminate\u2026
10
+ `+pi(o)),process.exit(1)}},message:"should be a function",validate:function(o){return typeof o=="function"}},onUnhandledRejection:{defaultValue:function(){return function(o,c,l){l.error("Unhandled rejection"+hi(c)+`\u2026
11
+ `+pi(o))}},message:"should be a function",validate:function(o){return typeof o=="function"}}},pi=function(o){return o&&o.stack?o.stack:Al(o)},Ll=function(){return["debug","info","warn","error"].reduce(function(o,c){var l=console[c]||console.log;return o[c]=l.bind(console,"[bugsnag]"),o},{})},hi=function(o){return o.request&&Object.keys(o.request).length?" at "+o.request.httpMethod+" "+(o.request.path||o.request.url):""},Ml=function(o){return typeof o=="object"&&o!==null||typeof o=="boolean"},gi=new Date,Hl=function(){gi=new Date},Ul={name:"appDuration",load:function(o){return o.addOnError(function(c){var l=new Date;c.app.duration=l-gi},!0),{reset:Hl}}},fo={};fo.load=function(o){var c=/^(local-)?dev(elopment)?$/.test(o._config.releaseStage);c||!o._isBreadcrumbTypeEnabled("log")||D(yi,function(l){var s=console[l];console[l]=function(){for(var f=arguments.length,y=new Array(f),_=0;_<f;_++)y[_]=arguments[_];o.leaveBreadcrumb("Console output",u(y,function(I,$,U){var Y="[Unknown value]";try{Y=String($)}catch{}if(Y==="[object Object]")try{Y=JSON.stringify($)}catch{}return I["["+U+"]"]=Y,I},{severity:l.indexOf("group")===0?"log":l}),"log"),s.apply(console,y)},console[l]._restore=function(){console[l]=s}})},process.env.NODE_ENV!=="production"&&(fo.destroy=function(){return yi.forEach(function(o){typeof console[o]._restore=="function"&&console[o]._restore()})});var yi=d(["log","debug","info","warn","error"],function(o){return typeof console<"u"&&typeof console[o]=="function"}),mo={},vi=[];mo=function(o){var c=new o.Client({},{},[],o._notifier);return c._config=o._config,c._breadcrumbs=o._breadcrumbs.slice(),c._metadata=b({},o._metadata),c._features=[].concat(o._features),c._featuresIndex=b({},o._featuresIndex),c._user=b({},o._user),c._context=o._context,c._cbs={e:o._cbs.e.slice(),s:o._cbs.s.slice(),sp:o._cbs.sp.slice(),b:o._cbs.b.slice()},c._logger=o._logger,c._delivery=o._delivery,c._sessionDelegate=o._sessionDelegate,vi.forEach(function(l){l(c)}),c},mo.registerCallback=function(o){vi.push(o)};var It={};It.getStack=function(){return new Error().stack.split(`
12
+ `).slice(3).join(`
13
+ `)},It.maybeUseFallbackStack=function(o,c){var l=o.stack.split(`
14
+ `);return(l.length===1||l.length===2&&/at Error \(native\)/.test(l[1]))&&(o.stack=l[0]+`
15
+ `+c),o};var Ir={},Bl=It.getStack;Ir={name:"contextualize",load:function(o){var c=function(l,s){var f=Bl(),y=mo(o);return y.fallbackStack=f,y.addOnError(s),o._clientContext.run(y,l)};return c}},Ir.default=Ir;var $r={},Vl=It.getStack,ql=It.maybeUseFallbackStack;$r={name:"intercept",load:function(o){var c=function(l,s){l===void 0&&(l=function(){}),typeof s!="function"&&(s=l,l=function(){});var f=Vl();return function(y){if(y){y.stack&&ql(y,f);var _=o.Event.create(y,!0,{severity:"warning",unhandled:!1,severityReason:{type:"callbackErrorIntercept"}},"intercept()",1);o._notify(_,l);return}for(var I=arguments.length,$=new Array(I>1?I-1:0),U=1;U<I;U++)$[U-1]=arguments[U];s.apply(void 0,$)}};return c}},$r.default=$r;function Rr(){return Rr=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)({}).hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},Rr.apply(null,arguments)}var rr=te("os"),Gl={load:function(o){var c={osName:rr.platform()+" ("+rr.arch()+")",osVersion:rr.release(),totalMemory:rr.totalmem(),hostname:o._config.hostname,runtimeVersions:{node:process.versions.node}};o._addOnSessionPayload(function(l){l.device=Rr({},l.device,c)}),o.addOnError(function(l){l.device=Rr({},l.device,c,{freeMemory:rr.freemem(),time:new Date})},!0)}},wi=te("path"),Wl=wi.join,Yl=wi.resolve,bi=function(o){return Wl(Yl(o),"/")},zl={load:function(o){return o.addOnError(function(c){if(o._config.projectRoot){var l=bi(o._config.projectRoot),s=c.errors.reduce(function(f,y){return f.concat(y.stacktrace)},[]);s.map(function(f){f.inProject=typeof f.file=="string"&&f.file.indexOf(l)===0&&!/\/node_modules\//.test(f.file)})}})}};function po(){return po=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)({}).hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},po.apply(null,arguments)}function Kl(o,c){o.prototype=Object.create(c.prototype),o.prototype.constructor=o,ho(o,c)}function ho(o,c){return ho=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,s){return l.__proto__=s,l},ho(o,c)}var _i=3,Si=200,Jl=te("fs"),Ql=Jl.createReadStream,Xl=te("stream"),Zl=Xl.Writable,eu=Li(),tu=$u(),ru=te("path"),nu={load:function(o){if(o._config.sendCode){var c=function(l,s){return new Promise(function(f,y){try{if(!l.lineNumber||!l.file)return f(l);var _=ru.resolve(o._config.projectRoot,l.file),I=_+"@"+l.lineNumber;if(I in s)return l.code=s[I],f(l);ou(_,l.lineNumber,function($,U){return $||(l.code=s[I]=U),f(l)})}catch{return f(l)}})};o.addOnError(function(l){return new Promise(function(s,f){var y=Object.create(null),_=l.errors.reduce(function(I,$){return I.concat($.stacktrace)},[]);au(_.map(function(I){return function(){return c(I,y)}})).then(s).catch(f)})})}},configSchema:{sendCode:{defaultValue:function(){return!0},validate:function(o){return o===!0||o===!1},message:"should be true or false"}}},ou=function(o,c,l){var s=c-_i,f=c+_i,y=Ql(o,{encoding:"utf8"}),_=new tu.LineStream({keepEmptyLines:!0}),I=new iu({start:s,end:f});I.on("done",function(){return y.destroy()}),eu(y,_,I,function($){if($&&$.message!=="premature close")return l($);l(null,I.getCode())})},iu=(function(o){function c(s){var f;return f=o.call(this,po({},s,{decodeStrings:!1}))||this,f._start=s.start,f._end=s.end,f._n=0,f._code={},f}Kl(c,o);var l=c.prototype;return l._write=function(f,y,_){return this._n++,this._n<this._start?_(null):this._n<=this._end?(this._code[String(this._n)]=f.length<=Si?f:f.substr(0,Si),_(null)):(this.emit("done"),_(null))},l.getCode=function(){return this._code},c})(Zl),au=function(o){return new Promise(function(c,l){var s=[];o.reduce(function(f,y){return f.then(function(_){return s.push(_),y()})},Promise.resolve()).then(function(f){s.push(f)}).then(function(){c(s.slice(1))})})},su=It.maybeUseFallbackStack,go,cu={load:function(o){o._config.autoDetectErrors&&o._config.enabledErrorTypes.unhandledExceptions&&(go=function(c){var l=o._clientContext&&o._clientContext.getStore(),s=l||o;c.stack&&s.fallbackStack&&su(c,s.fallbackStack);var f=s.Event.create(c,!1,{severity:"error",unhandled:!0,severityReason:{type:"unhandledException"}},"uncaughtException handler",1);return new Promise(function(y){s._notify(f,function(){},function(_,I){_&&s._logger.error("Failed to send event to Bugsnag"),s._config.onUncaughtException(c,I,s._logger),y()})})},process.prependListener("uncaughtException",go))},destroy:function(){process.removeListener("uncaughtException",go)}},jr,lu={load:function(o){!o._config.autoDetectErrors||!o._config.enabledErrorTypes.unhandledRejections||(jr=function(c){var l=o._clientContext&&o._clientContext.getStore(),s=l||o,f=!o._config.reportUnhandledPromiseRejectionsAsHandled,y=s.Event.create(c,!1,{severity:"error",unhandled:f,severityReason:{type:"unhandledPromiseRejection"}},"unhandledRejection handler",1);return new Promise(function(_){s._notify(y,function(){},function(I,$){I&&s._logger.error("Failed to send event to Bugsnag"),s._config.onUnhandledRejection(c,$,s._logger),_()})})},process.prependListener?process.prependListener("unhandledRejection",jr):process.on("unhandledRejection",jr))},destroy:function(){process.removeListener("unhandledRejection",jr)}},uu=yo;function yo(o){o=o||{},this.ms=o.min||100,this.max=o.max||1e4,this.factor=o.factor||2,this.jitter=o.jitter>0&&o.jitter<=1?o.jitter:0,this.attempts=0}yo.prototype.duration=function(){var o=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var c=Math.random(),l=Math.floor(c*this.jitter*o);o=(Math.floor(c*10)&1)==0?o-l:o+l}return Math.min(o,this.max)|0},yo.prototype.reset=function(){this.attempts=0};function fu(o,c){o.prototype=Object.create(c.prototype),o.prototype.constructor=o,vo(o,c)}function vo(o,c){return vo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(l,s){return l.__proto__=s,l},vo(o,c)}var du=10*1e3,mu=te("events").EventEmitter,pu=(function(o){function c(s){var f;return f=o.call(this)||this,f._sessions=new Map,f._interval=null,f._intervalLength=s||du,f._summarize=f._summarize.bind(f),f}fu(c,o);var l=c.prototype;return l.start=function(){this._interval||(this._interval=setInterval(this._summarize,this._intervalLength).unref())},l.stop=function(){clearInterval(this._interval),this._interval=null},l.track=function(f){var y=hu(f.startedAt),_=this._sessions.get(y);return this._sessions.set(y,typeof _>"u"?1:_+1),f},l._summarize=function(){var f=this,y=[];this._sessions.forEach(function(_,I){y.push({startedAt:I,sessionsStarted:_}),f._sessions.delete(I)}),y.length&&this.emit("summary",y)},c})(mu),hu=function(o){var c=new Date(o);return c.setSeconds(0),c.setMilliseconds(0),c.toISOString()},gu={load:function(o){var c=null;o._sessionDelegate={startSession:function(l,s){return c||(c=new pu(l._config.sessionSummaryInterval),c.on("summary",yu(l)),c.start()),l._session=s,l._pausedSession=null,c.track(l._session),l},pauseSession:function(l){l._pausedSession=l._session,l._session=null},resumeSession:function(l){return l._session?l:l._pausedSession?(l._session=l._pausedSession,l._pausedSession=null,l):l.startSession()}}},configSchema:{sessionSummaryInterval:{defaultValue:function(){},validate:function(o){return o===void 0||S()(o)},message:"should be a positive integer"}}},yu=function(o){return function(c){if(o._config.enabledReleaseStages!==null&&!o._config.enabledReleaseStages.includes(o._config.releaseStage)){o._logger.warn("Session not sent due to releaseStage/enabledReleaseStages configuration");return}if(!c.length)return;var l=new uu({min:1e3,max:1e4}),s=10;y(f);function f(_){if(!_){var I=c.reduce(function($,U){return $+U.sessionsStarted},0);return o._logger.debug(I+" session(s) reported")}if(l.attempts===10){o._logger.error("Session delivery failed, max retries exceeded",_);return}o._logger.debug("Session delivery failed, retry #"+(l.attempts+1)+"/"+s,_),setTimeout(function(){return y(f)},l.duration())}function y(_){var I={notifier:o._notifier,device:{},app:{releaseStage:o._config.releaseStage,version:o._config.appVersion,type:o._config.appType},sessionCounts:c},$=Zt(o._cbs.sp,I,"onSessionPayload",o._logger);if($)return o._logger.debug("Session not sent due to onSessionPayload callback"),_(null);o._delivery.sendSession(I,_)}}},vu={load:function(o){o.addOnError(function(c){var l=c.errors.reduce(function(s,f){return s.concat(f.stacktrace)},[]);l.forEach(function(s){typeof s.file=="string"&&(s.file=s.file.replace(/\\/g,"/"))})})}},wu={load:function(o){return o.addOnError(function(c){if(o._config.projectRoot){var l=bi(o._config.projectRoot),s=c.errors.reduce(function(f,y){return f.concat(y.stacktrace)},[]);s.map(function(f){typeof f.file=="string"&&f.file.indexOf(l)===0&&(f.file=f.file.replace(l,""))})}})}},gt={};function wo(){return wo=Object.assign?Object.assign.bind():function(o){for(var c=1;c<arguments.length;c++){var l=arguments[c];for(var s in l)({}).hasOwnProperty.call(l,s)&&(o[s]=l[s])}return o},wo.apply(null,arguments)}var bu="Bugsnag Node",_u="8.8.0",Su="https://github.com/bugsnag/bugsnag-js",Eu=te("async_hooks"),ku=Eu.AsyncLocalStorage;Dt.__type="nodejs";var xu=wo({},O.schema,Nl),Pu=[Ul,nu,zl,wu,gu,Gl,cu,lu,$r,Ir,vu,fo],Fe={_client:null,createClient:function(o){typeof o=="string"&&(o={apiKey:o}),o||(o={});var c=new Tr(o,xu,Pu,{name:bu,version:_u,url:Su});return Object.keys(Tr.prototype).forEach(function(l){var s=c[l];c[l]=function(){var f=c._clientContext&&typeof c._clientContext.getStore=="function"?c._clientContext.getStore():null,y=f||c,_=f?f[l]:s;y._depth+=1;var I=_.apply(y,arguments);return y._depth-=1,I}}),c._clientContext=new ku,c._setDelivery(Rl),c._logger.debug("Loaded!"),c},start:function(o){return Fe._client?(Fe._client._logger.warn("Bugsnag.start() was called more than once. Ignoring."),Fe._client):(Fe._client=Fe.createClient(o),Fe._client)},isStarted:function(){return Fe._client!=null}};return Object.keys(Tr.prototype).forEach(function(o){/^_/.test(o)||(Fe[o]=function(){var c=Fe._client,l=c&&c._clientContext&&c._clientContext.getStore();if(l&&(c=l),!c)return console.error("Bugsnag."+o+"() was called before Bugsnag.start()");c._depth+=1;var s=c[o].apply(c,arguments);return c._depth-=1,s})}),gt=Fe,gt.Client=Tr,gt.Event=Dt,gt.Session=co,gt.Breadcrumb=i,gt.default=Fe,gt})});var oc=we((g_,nc)=>{p();nc.exports=md;function md(e){var t=e._readableState;return t?t.objectMode||typeof e._duplexState=="number"?e.read():e.read(pd(t)):null}function pd(e){if(e.buffer.length){var t=e.bufferIndex||0;if(e.buffer.head)return e.buffer.head.data.length;if(e.buffer.length-t>0&&e.buffer[t])return e.buffer[t].length}return e.length}});var zo=we((v_,cc)=>{p();var Mn=Ji(),ic=Ni(),hd=Bi(),gd=oc(),ac=Buffer.from&&Buffer.from!==Uint8Array.from?Buffer.from([0]):new Buffer([0]),Yo=function(e,t){e._corked?e.once("uncork",t):t()},yd=function(e,t){e._autoDestroy&&e.destroy(t)},sc=function(e,t){return function(r){r?yd(e,r.message==="premature close"?null:r):t&&!e._ended&&e.end()}},vd=function(e,t){if(!e||e._writableState&&e._writableState.finished)return t();if(e._writableState)return e.end(t);e.end(),t()},wd=function(e){return new Mn.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},de=function(e,t,r){if(!(this instanceof de))return new de(e,t,r);Mn.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||r.autoDestroy!==!1,this._forwardDestroy=!r||r.destroy!==!1,this._forwardEnd=!r||r.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};hd(de,Mn.Duplex);de.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new de(e,t,r)};de.prototype.cork=function(){++this._corked===1&&this.emit("cork")};de.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")};de.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed){e&&e.destroy&&e.destroy();return}if(e===null||e===!1){this.end();return}var t=this,r=ic(e,{writable:!0,readable:!1},sc(this,this._forwardEnd)),n=function(){var a=t._ondrain;t._ondrain=null,a&&a()},i=function(){t._writable.removeListener("drain",n),r()};this._unwrite&&process.nextTick(n),this._writable=e,this._writable.on("drain",n),this._unwrite=i,this.uncork()};de.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed){e&&e.destroy&&e.destroy();return}if(e===null||e===!1){this.push(null),this.resume();return}var t=this,r=ic(e,{writable:!1,readable:!0},sc(this)),n=function(){t._forward()},i=function(){t.push(null)},a=function(){t._readable2.removeListener("readable",n),t._readable2.removeListener("end",i),r()};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:wd(e),this._readable2.on("readable",n),this._readable2.on("end",i),this._unread=a,this._forward()};de.prototype._read=function(){this._drained=!0,this._forward()};de.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var e;this._drained&&(e=gd(this._readable2))!==null;)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}};de.prototype.destroy=function(e){if(!this.destroyed){this.destroyed=!0;var t=this;process.nextTick(function(){t._destroy(e)})}};de.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")};de.prototype._write=function(e,t,r){if(this.destroyed)return r();if(this._corked)return Yo(this,this._write.bind(this,e,t,r));if(e===ac)return this._finish(r);if(!this._writable)return r();this._writable.write(e)===!1?this._ondrain=r:r()};de.prototype._finish=function(e){var t=this;this.emit("preend"),Yo(this,function(){vd(t._forwardEnd&&t._writable,function(){t._writableState.prefinished===!1&&(t._writableState.prefinished=!0),t.emit("prefinish"),Yo(t,e)})})};de.prototype.end=function(e,t,r){return typeof e=="function"?this.end(null,null,e):typeof t=="function"?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this.write(ac),Mn.Writable.prototype.end.call(this,r))};cc.exports=de});var uc=we((b_,lc)=>{p();lc.exports=_d;var bd=Object.prototype.hasOwnProperty;function _d(){for(var e={},t=0;t<arguments.length;t++){var r=arguments[t];for(var n in r)bd.call(r,n)&&(e[n]=r[n])}return e}});var Jo=we((S_,Hn)=>{p();var fc=Ji().Transform,dc=te("util").inherits,mc=uc();function Jt(e){fc.call(this,e),this._destroyed=!1}dc(Jt,fc);Jt.prototype.destroy=function(e){if(!this._destroyed){this._destroyed=!0;var t=this;process.nextTick(function(){e&&t.emit("error",e),t.emit("close")})}};function Sd(e,t,r){r(null,e)}function Ko(e){return function(t,r,n){return typeof t=="function"&&(n=r,r=t,t={}),typeof r!="function"&&(r=Sd),typeof n!="function"&&(n=null),e(t,r,n)}}Hn.exports=Ko(function(e,t,r){var n=new Jt(e);return n._transform=t,r&&(n._flush=r),n});Hn.exports.ctor=Ko(function(e,t,r){function n(i){if(!(this instanceof n))return new n(i);this.options=mc(e,i),Jt.call(this,this.options)}return dc(n,Jt),n.prototype._transform=t,r&&(n.prototype._flush=r),n});Hn.exports.obj=Ko(function(e,t,r){var n=new Jt(mc({objectMode:!0,highWaterMark:16},e));return n._transform=t,r&&(n._flush=r),n})});var gc=we((k_,hc)=>{p();var Ed=zo(),kd=Jo(),xd=Cu(),Pd=function(e){return!Buffer.isBuffer(e)&&typeof e!="string"},pc=function(e,t){if(typeof e=="number"&&(e={maxBuffer:e}),typeof e=="function")return pc(null,e);e||(e={});var r=typeof e.maxBuffer=="number"?e.maxBuffer:65535,n=e.strict,i=e.newline!==!1,a=[],u=0,d=Ed.obj(),m=kd.obj({highWaterMark:1},function(w,v,S){if(Pd(w))return g(w,null,S);if(Buffer.isBuffer(w)||(w=xd(w)),i){var E=Array.prototype.indexOf.call(w,10);if(E>0&&w[E-1]===13&&E--,E>-1)return a.push(w.slice(0,E)),g(Buffer.concat(a),w.slice(E),S)}if(a.push(w),u+=w.length,u<r)return S();if(n)return S(new Error("No newline found"));g(Buffer.concat(a),null,S)}),h=function(){if(n)return d.destroy(new Error("No newline found"));d.cork(),g(Buffer.concat(a),null,function(w){if(w)return d.destroy(w);d.uncork()})},g=function(w,v,S){d.removeListener("preend",h),t(w,function(E,x){if(E)return S(E);d.setWritable(x),d.setReadable(x),w&&x.write(w),v&&x.write(v),v=a=m=null,S()})};return d.on("preend",h),d.setWritable(m),d};hc.exports=pc});var wc=we((P_,vc)=>{p();var Cd=Iu(),Od=Ni(),Qo=te("fs"),br=function(){},Td=/^v?\.0/.test(process.version),Un=function(e){return typeof e=="function"},Dd=function(e){return!Td||!Qo?!1:(e instanceof(Qo.ReadStream||br)||e instanceof(Qo.WriteStream||br))&&Un(e.close)},Id=function(e){return e.setHeader&&Un(e.abort)},$d=function(e,t,r,n){n=Cd(n);var i=!1;e.on("close",function(){i=!0}),Od(e,{readable:t,writable:r},function(u){if(u)return n(u);i=!0,n()});var a=!1;return function(u){if(!i&&!a){if(a=!0,Dd(e))return e.close(br);if(Id(e))return e.abort();if(Un(e.destroy))return e.destroy();n(u||new Error("stream was destroyed"))}}},yc=function(e){e()},Rd=function(e,t){return e.pipe(t)},jd=function(){var e=Array.prototype.slice.call(arguments),t=Un(e[e.length-1]||br)&&e.pop()||br;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var r,n=e.map(function(i,a){var u=a<e.length-1,d=a>0;return $d(i,u,d,function(m){r||(r=m),m&&n.forEach(yc),!u&&(n.forEach(yc),t(r))})});e.reduce(Rd)};vc.exports=jd});var Sc=we((O_,Bn)=>{p();var Fd=wc(),Ad=Bi(),bc=zo(),_c=function(e){return e.length?Array.isArray(e[0])?e[0]:Array.prototype.slice.call(e):[]},Xo=function(e){var t=function(){var r=_c(arguments);if(!(this instanceof t))return new t(r);bc.call(this,null,null,e),r.length&&this.setPipeline(r)};return Ad(t,bc),t.prototype.setPipeline=function(){var r=_c(arguments),n=this,i=!1,a=r[0],u=r[r.length-1];u=u.readable?u:null,a=a.writable?a:null;var d=function(){r[0].emit("error",new Error("stream was destroyed"))};if(this.on("close",d),this.on("prefinish",function(){i||n.cork()}),Fd(r,function(m){if(n.removeListener("close",d),m)return n.destroy(m.message==="premature close"?null:m);i=!0,n._autoDestroy===!1&&(n._autoDestroy=!0),n.uncork()}),this.destroyed)return d();this.setWritable(a),this.setReadable(u)},t};Bn.exports=Xo({autoDestroy:!1,destroy:!1});Bn.exports.obj=Xo({autoDestroy:!1,destroy:!1,objectMode:!0,highWaterMark:16});Bn.exports.ctor=Xo});var kc=we((D_,Ec)=>{"use strict";p();Ec.exports=function(e){return!e||e.length<3?!1:e[0]===31&&e[1]===139&&e[2]===8}});var Pc=we(($_,xc)=>{"use strict";p();xc.exports=function(e){return!e||e.length<2?!1:e[0]===120&&(e[1]===1||e[1]===156||e[1]===218)}});var Dc=we((j_,Tc)=>{p();var Cc=te("zlib"),Nd=gc(),Ld=Jo(),Oc=Sc(),Md=kc(),Hd=Pc(),Ud=function(e){return Md(e)?1:Hd(e)?2:0},Zo=function(e){return e===void 0&&(e=3),Nd({newline:!1,maxBuffer:10},function(t,r){if(e<0)return r(new Error("Maximum recursion reached"));switch(Ud(t)){case 1:r(null,Oc(Cc.createGunzip(),Zo(e-1)));break;case 2:r(null,Oc(Cc.createInflate(),Zo(e-1)));break;default:r(null,Ld())}})};Tc.exports=Zo});var Nc=we((A_,Ac)=>{"use strict";p();var $e=te("fs"),kt=te("path"),Bd=$e.lchown?"lchown":"chown",Vd=$e.lchownSync?"lchownSync":"chownSync",$c=$e.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),Ic=(e,t,r)=>{try{return $e[Vd](e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},qd=(e,t,r)=>{try{return $e.chownSync(e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},Gd=$c?(e,t,r,n)=>i=>{!i||i.code!=="EISDIR"?n(i):$e.chown(e,t,r,n)}:(e,t,r,n)=>n,ei=$c?(e,t,r)=>{try{return Ic(e,t,r)}catch(n){if(n.code!=="EISDIR")throw n;qd(e,t,r)}}:(e,t,r)=>Ic(e,t,r),Wd=process.version,Rc=(e,t,r)=>$e.readdir(e,t,r),Yd=(e,t)=>$e.readdirSync(e,t);/^v4\./.test(Wd)&&(Rc=(e,t,r)=>$e.readdir(e,r));var Vn=(e,t,r,n)=>{$e[Bd](e,t,r,Gd(e,t,r,i=>{n(i&&i.code!=="ENOENT"?i:null)}))},jc=(e,t,r,n,i)=>{if(typeof t=="string")return $e.lstat(kt.resolve(e,t),(a,u)=>{if(a)return i(a.code!=="ENOENT"?a:null);u.name=t,jc(e,u,r,n,i)});if(t.isDirectory())ti(kt.resolve(e,t.name),r,n,a=>{if(a)return i(a);let u=kt.resolve(e,t.name);Vn(u,r,n,i)});else{let a=kt.resolve(e,t.name);Vn(a,r,n,i)}},ti=(e,t,r,n)=>{Rc(e,{withFileTypes:!0},(i,a)=>{if(i){if(i.code==="ENOENT")return n();if(i.code!=="ENOTDIR"&&i.code!=="ENOTSUP")return n(i)}if(i||!a.length)return Vn(e,t,r,n);let u=a.length,d=null,m=h=>{if(!d){if(h)return n(d=h);if(--u===0)return Vn(e,t,r,n)}};a.forEach(h=>jc(e,h,t,r,m))})},zd=(e,t,r,n)=>{if(typeof t=="string")try{let i=$e.lstatSync(kt.resolve(e,t));i.name=t,t=i}catch(i){if(i.code==="ENOENT")return;throw i}t.isDirectory()&&Fc(kt.resolve(e,t.name),r,n),ei(kt.resolve(e,t.name),r,n)},Fc=(e,t,r)=>{let n;try{n=Yd(e,{withFileTypes:!0})}catch(i){if(i.code==="ENOENT")return;if(i.code==="ENOTDIR"||i.code==="ENOTSUP")return ei(e,t,r);throw i}return n&&n.length&&n.forEach(i=>zd(e,i,t,r)),ei(e,t,r)};Ac.exports=ti;ti.sync=Fc});var Uc=we((L_,Hc)=>{p();var qn=te("path"),Lc=te("fs"),Mc=parseInt("0777",8);Hc.exports=Qt.mkdirp=Qt.mkdirP=Qt;function Qt(e,t,r,n){typeof t=="function"?(r=t,t={}):(!t||typeof t!="object")&&(t={mode:t});var i=t.mode,a=t.fs||Lc;i===void 0&&(i=Mc&~process.umask()),n||(n=null);var u=r||function(){};e=qn.resolve(e),a.mkdir(e,i,function(d){if(!d)return n=n||e,u(null,n);d.code==="ENOENT"?Qt(qn.dirname(e),t,function(m,h){m?u(m,h):Qt(e,t,u,h)}):a.stat(e,function(m,h){m||!h.isDirectory()?u(d,n):u(null,n)})})}Qt.sync=function e(t,r,n){(!r||typeof r!="object")&&(r={mode:r});var i=r.mode,a=r.fs||Lc;i===void 0&&(i=Mc&~process.umask()),n||(n=null),t=qn.resolve(t);try{a.mkdirSync(t,i),n=n||t}catch(d){switch(d.code){case"ENOENT":n=e(qn.dirname(t),r,n),e(t,r,n);break;default:var u;try{u=a.statSync(t)}catch{throw d}if(!u.isDirectory())throw d;break}}return n}});var Jc=we(oi=>{p();var Kd=Nc(),qc=ju(),Gc=Li(),Jd=Uc(),Wc=te("fs"),me=te("path"),Qd=te("os"),_r=Qd.platform()==="win32",Sr=function(){},ni=function(e){return e},ri=_r?function(e){return e.replace(/\\/g,"/").replace(/[:?<>|]/g,"_")}:ni,Xd=function(e,t,r,n,i,a){var u=i||["."];return function(m){if(!u.length)return m();var h=u.shift(),g=me.join(r,h);t.call(e,g,function(w,v){if(w)return m(w);if(!v.isDirectory())return m(null,h,v);e.readdir(g,function(S,E){if(S)return m(S);a&&E.sort();for(var x=0;x<E.length;x++)n(me.join(r,h,E[x]))||u.push(me.join(h,E[x]));m(null,h,v)})})}},Yc=function(e,t){return function(r){r.name=r.name.split("/").slice(t).join("/");var n=r.linkname;return n&&(r.type==="link"||me.isAbsolute(n))&&(r.linkname=n.split("/").slice(t).join("/")),e(r)}};oi.pack=function(e,t){e||(e="."),t||(t={});var r=t.fs||Wc,n=t.ignore||t.filter||Sr,i=t.map||Sr,a=t.mapStream||ni,u=Xd(r,t.dereference?r.stat:r.lstat,e,n,t.entries,t.sort),d=t.strict!==!1,m=typeof t.umask=="number"?~t.umask:~zc(),h=typeof t.dmode=="number"?t.dmode:0,g=typeof t.fmode=="number"?t.fmode:0,w=t.pack||qc.pack(),v=t.finish||Sr;t.strip&&(i=Yc(i,t.strip)),t.readable&&(h|=parseInt(555,8),g|=parseInt(444,8)),t.writable&&(h|=parseInt(333,8),g|=parseInt(222,8));var S=function(O,k){r.readlink(me.join(e,O),function(P,b){if(P)return w.destroy(P);k.linkname=ri(b),w.entry(k,x)})},E=function(O,k,P){if(O)return w.destroy(O);if(!k)return t.finalize!==!1&&w.finalize(),v(w);if(P.isSocket())return x();var b={name:ri(k),mode:(P.mode|(P.isDirectory()?h:g))&m,mtime:P.mtime,size:P.size,type:"file",uid:P.uid,gid:P.gid};if(P.isDirectory())return b.size=0,b.type="directory",b=i(b)||b,w.entry(b,x);if(P.isSymbolicLink())return b.size=0,b.type="symlink",b=i(b)||b,S(k,b);if(b=i(b)||b,!P.isFile())return d?w.destroy(new Error("unsupported type for "+k)):x();var D=w.entry(b,x);if(D){var j=a(r.createReadStream(me.join(e,k),{start:0,end:b.size>0?b.size-1:b.size}),b);j.on("error",function(B){D.destroy(B)}),Gc(j,D)}},x=function(O){if(O)return w.destroy(O);u(E)};return x(),w};var Zd=function(e){return e.length?e[e.length-1]:null},em=function(){return process.getuid?process.getuid():-1},zc=function(){return process.umask?process.umask():0};oi.extract=function(e,t){e||(e="."),t||(t={});var r=t.fs||Wc,n=t.ignore||t.filter||Sr,i=t.map||Sr,a=t.mapStream||ni,u=t.chown!==!1&&!_r&&em()===0,d=t.extract||qc.extract(),m=[],h=new Date,g=typeof t.umask=="number"?~t.umask:~zc(),w=typeof t.dmode=="number"?t.dmode:0,v=typeof t.fmode=="number"?t.fmode:0,S=t.strict!==!1;t.strip&&(i=Yc(i,t.strip)),t.readable&&(w|=parseInt(555,8),v|=parseInt(444,8)),t.writable&&(w|=parseInt(333,8),v|=parseInt(222,8));var E=function(k,P){for(var b;(b=Zd(m))&&k.slice(0,b[0].length)!==b[0];)m.pop();if(!b)return P();r.utimes(b[0],h,b[1],P)},x=function(k,P,b){if(t.utimes===!1)return b();if(P.type==="directory")return r.utimes(k,h,P.mtime,b);if(P.type==="symlink")return E(k,b);r.utimes(k,h,P.mtime,function(D){if(D)return b(D);E(k,b)})},O=function(k,P,b){var D=P.type==="symlink",j=D?r.lchmod:r.chmod,B=D?r.lchown:r.chown;if(!j)return b();var N=(P.mode|(P.type==="directory"?w:v))&g;B&&u?B.call(r,k,P.uid,P.gid,W):W(null);function W(H){if(H)return b(H);if(!j)return b();j.call(r,k,N,b)}};return d.on("entry",function(k,P,b){k=i(k)||k,k.name=ri(k.name);var D=me.join(e,me.join("/",k.name));if(n(D,k))return P.resume(),b();var j=function(F){if(F)return b(F);x(D,k,function(G){if(G)return b(G);if(_r)return b();O(D,k,b)})},B=function(){if(_r)return b();r.unlink(D,function(){var F=me.resolve(me.dirname(D),k.linkname);if(!Vc(F,e))return b(new Error(D+" is not a valid symlink"));r.symlink(k.linkname,D,j)})},N=function(){if(_r)return b();r.unlink(D,function(){var F=me.join(e,me.join("/",k.linkname));r.realpath(F,function(G,K){if(G||!Vc(K,e))return b(new Error(D+" is not a valid hardlink"));r.link(K,D,function(q){if(q&&q.code==="EPERM"&&t.hardlinkAsFilesFallback)return P=r.createReadStream(F),W();j(q)})})})},W=function(){var F=r.createWriteStream(D),G=a(P,k);F.on("error",function(K){G.destroy(K)}),Gc(G,F,function(K){if(K)return b(K);F.on("close",j)})};if(k.type==="directory")return m.push([D,k.mtime]),Bc(D,{fs:r,own:u,uid:k.uid,gid:k.gid},j);var H=me.dirname(D);Kc(r,H,me.join(e,"."),function(F,G){if(F)return b(F);if(!G)return b(new Error(H+" is not a valid path"));Bc(H,{fs:r,own:u,uid:k.uid,gid:k.gid},function(K){if(K)return b(K);switch(k.type){case"file":return W();case"link":return N();case"symlink":return B()}if(S)return b(new Error("unsupported type for "+D+" ("+k.type+")"));P.resume(),b()})})}),t.finish&&d.on("finish",t.finish),d};function Kc(e,t,r,n){if(t===r)return n(null,!0);e.lstat(t,function(i,a){if(i&&i.code!=="ENOENT")return n(i);if(i||a.isDirectory())return Kc(e,me.join(t,".."),r,n);n(null,!1)})}function Bc(e,t,r){Jd(e,{fs:t.fs},function(n,i){!n&&i&&t.own?Kd(i,t.uid,t.gid,r):r(n)})}function Vc(e,t){return t=me.resolve(t),t===e||e.startsWith(t+me.sep)}});p();p();var yn=fe(Te(),1);p();p();var dn=[{name:"npm",lockfile:"package-lock.json",alternativeLockfiles:["npm-shrinkwrap.json"],installCommand:"npm ci"},{name:"yarn",lockfile:"yarn.lock",installCommand:"yarn install --frozen-lockfile"},{name:"pnpm",lockfile:"pnpm-lock.yaml",installCommand:"pnpm install --frozen-lockfile"},{name:"bun",lockfile:"bun.lockb",alternativeLockfiles:["bun.lock"],installCommand:"bun install --frozen-lockfile"}];function Au(e){let t="No lockfile found",r="If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying. To avoid versioning issues, generate a new lockfile and commit it to your repository.",n=[["Generate a lockfile. Run",{command:"npm|yarn|pnpm install"}],"Commit the new file to your repository"];if(e)throw new T(t,r,n);ne({headline:t,body:r,nextSteps:n})}function Nu(e,t){let r=e.map(({packageManager:u,foundLockfile:d})=>`${d} (created by ${u.name})`),n="Multiple lockfiles found",i=[`Your project contains more than one lockfile. This can cause version conflicts when installing and deploying your app. The following lockfiles were detected:
16
+ `,{list:{items:r}}],a=["Delete any unneeded lockfiles","Commit the change to your repository"];if(t)throw new T(n,i,a);ne({headline:n,body:i,nextSteps:a})}function Lu(e){let t="Lockfile ignored by Git",r="Your project\u2019s lockfile isn\u2019t being tracked by Git. If you don\u2019t commit a lockfile, then your app might install the wrong package versions when deploying.",n=[`In your project\u2019s .gitignore file, delete any references to ${e}`,"Commit the change to your repository"];ne({headline:t,body:r,nextSteps:n})}async function Ma(e,t=!1){if(Je&&!process.env.SHOPIFY_UNIT_TEST)return;let r=[];for(let a of dn){let u=[a.lockfile,...a.alternativeLockfiles||[]];for(let d of u)if(await re(A(e,d))){r.push({packageManager:a,foundLockfile:d});break}}if(r.length===0)return Au(t);if(r.length>1)return Nu(r,t);let n=r[0].foundLockfile;(await qi(e,[n]).catch(()=>[])).length>0&&Lu(n)}p();var Mu=["^cdn/","^_t/"];function mn(e){let t=new Set;return Object.values(e.routes).filter(r=>Mu.some(n=>new RegExp(n).test(r.path??""))).forEach(r=>{r.path&&t.add(r.path)}),[...t]}var Hu=["","cart","products/:productHandle","collections","collections/:collectionHandle","sitemap.xml","robots.txt","pages/:pageHandle","policies/:policyHandle","search","account","account/login","account/orders/:orderId","account/authorize"];function pn(e,t=Hu){let r=Object.values(e.routes),n=new Set(t);for(let i of t)for(let a of r)if(!i&&!a.path)n.delete(i);else if(i&&a.path){let u={path:a.path,parentId:a.parentId};for(;u.parentId&&u.parentId!=="root";){let h=r.find(g=>g.id===u.parentId);if(!h)break;u.path=h.path==null?u.path:`${h.path}/${u.path}`,u.parentId=h.parentId}let d=":?[^\\/\\?]+\\?",m=`^(${d}\\/)?`+i.replaceAll(".","\\.").replace(/\//g,`\\/(${d}\\/)?`).replace(/:[^/)?]+/g,"(:[^\\/]+|\\*)")+`(\\/${d})?$`;new RegExp(m).test(u.path)&&n.delete(i)}return[...n]}var ut=100;function Ha(e){e.length?ne({headline:"Standard Shopify routes missing",body:`Your Hydrogen project is missing ${e.length} standard Shopify route${e.length>1?"s":""}.
17
+ Including these routes improves compatibility with Shopify\u2019s platform:
18
+
19
+ `+e.slice(0,ut-(e.length<=ut?0:1)).map(t=>`\u2022 /${t}`).join(`
20
+ `)+(e.length>ut?`
21
+ \u2022 ...and ${e.length-ut+1} more`:"")}):z({headline:"All standard Shopify routes present"})}function hn(e){e.length&&ne({headline:"Reserved routes present",body:`Your Hydrogen project is using ${e.length} reserved route${e.length>1?"s":""}.
22
+ These routes are reserved by Shopify and may cause issues with your storefront:
23
+
24
+ `+e.slice(0,ut-(e.length<=ut?0:1)).map(t=>`\u2022 /${t}`).join(`
25
+ `)+(e.length>ut?`
26
+ \u2022 ...and ${e.length-ut+1} more`:"")})}p();p();var ft="metafile.server.json",Qe="server-bundle-analyzer.html";async function Ua(){return ke(await yt("bundle","analyzer.html"))}function Ba(e,t){return e.replace("globalThis.METAFILE = '';",`globalThis.METAFILE = '${Buffer.from(t,"utf-8").toString("base64")}';`)}async function Va(e){try{return` \u2502
27
+ `+(await(await import("esbuild")).analyzeMetafile(await ke(R(e,ft)),{color:!0})).split(`
28
+ `).filter(n=>!n.match(/(.*)(node_modules\/|server-assets-manifest:|server-entry-module:)(react-dom|@remix-run|@shopify\/hydrogen|react-router|react-router-dom)\/(.*)/g)).slice(2,12).join(`
29
+ `).replace(/dist\/worker\/_assets\/.*$/ms,`
30
+ `).replace(/\n/g,`
31
+ `).replace(/(\.\.\/)+node_modules\//g,n=>J.dim(n))}catch(t){console.warn("Could not generate bundle analysis summary:",t.message)}}function Ga(e){let t;return{name:"hydrogen:bundle-analyzer",configResolved(r){t=r},async generateBundle(r,n){if(!t.build.ssr)return;let{root:i}=t,a=Object.values(n).find(E=>E.type==="chunk");if(!a||a.type!=="chunk"||!a.facadeModuleId||!r.dir)return;let u=await Ua().catch(()=>null);if(!u){console.warn("Bundle analyzer template not found");return}let d=new Set(Object.keys(a.modules)),m=[];for(let E of d){if(Fo(E)||Ao(E))continue;let x=this.getModuleInfo(E);if(x?.id){m.push(x);for(let O of[...x.importedIds,...x.dynamicallyImportedIds])!Fo(O)&&!Ao(O)&&d.add(O)}}let h=new Map,g=new Map,w=await Promise.all(m.map(async E=>{let x=be(i,E.id),O=a.modules[E.id],k=O?.originalLength??E.code?.length??0,P=O?.renderedLength??0;if(e?.minify&&O?.code){let W=await e.minify(O.code,E.id).catch(()=>null);W&&(P=W.length)}g.set(x,P);let b=W=>this.resolve(W,E.id),D=!E.code||/(^\s*export\s+[\w\{]|^\s*import\s+[\w\{'"]|\bimport\()|\bcreateRequire\(/ms.test(E.code)||!/((^|\b)exports\b|\brequire\()/.test(E.code),j=qa(E.importedIds,"import-statement",i,b,E.code),B=qa(E.dynamicallyImportedIds,"dynamic-import",i,b,E.code),N=(await Promise.all([...j,...B])).reduce((W,{importedId:H,...F})=>(Fo(H)?D=!1:Ao(H)||W.push(F),W),[]);h.set(x,{bytes:k,format:D?"esm":"cjs",imports:N})})).then(()=>null).catch(E=>E);if(w){console.warn("Bundle analyzer failed to analyze the bundle:",w);return}let v=Object.fromEntries(h.entries()),S={inputs:v,outputs:{[be(i,R(r.dir,a.fileName))]:{imports:a.imports,exports:a.exports,entryPoint:be(i,a.facadeModuleId),bytes:a.code.length??0,inputs:Object.entries(v).reduce((E,[x,O])=>(E[x]={bytesInOutput:g.get(x)??O.bytes??0},E),{})}}};n[ft]={type:"asset",fileName:ft,needsCodeReference:!1,source:JSON.stringify(S,null,2),names:[ft],originalFileNames:[ft],name:ft,originalFileName:ft},n[Qe]={type:"asset",fileName:Qe,needsCodeReference:!1,source:Ba(u,JSON.stringify(S)),names:[Qe],originalFileNames:[Qe],name:Qe,originalFileName:Qe}}}}function Fo(e){return/(commonjsHelpers\.js$|\?commonjs\-)/.test(e)}function Ao(e){return e.endsWith("?transform-only")}async function Uu(e,t,r){let n=t.matchAll(/import\s[^'"]*?['"]([^'"]+)['"]/g)??[];for(let[,i]of n)if(i&&(await r(i))?.id===e)return i;return e}function qa(e,t,r,n,i){return e.map(async a=>({importedId:a,path:be(r,a),kind:t,original:i?await Uu(a,i,n):a}))}p();import{spawn as Bu}from"node:child_process";import{fileURLToPath as Ya}from"node:url";var Vu=process.argv[1],qu=Ya(import.meta.url),Gu=Vu===qu;Gu&&ur({rootDirectory:process.argv[2],appDirectory:process.argv[3],configFilePath:process.argv[4],watch:!0});function za(e,t){if(e.includes("AbortError: ")){let u=e.split("AbortError: ")[1]??"",d=u.split(`
32
+ `)[0],m=u.match(/tryMessage: '(.*)',$/m)?.[1];if(d)return{message:d,details:m}}let[r="",...n]=e.replaceAll("[FAILED]","").replace(/\s{2,}/g,`
33
+ `).replace(/\n,\n/,`
34
+ `).trim().split(`
35
+ `),i="[Codegen] "+r,a=n.join(`
36
+ `);if(t){let u=t.replaceAll("\\","/")+"/";a=a.replaceAll(u,"")}return{message:i,details:a}}function gn({rootDirectory:e,appDirectory:t,configFilePath:r}){let n,i,a=process.argv.findIndex(d=>d==="hydrogen");a>=1?(n=process.argv[0],i=[...process.argv.slice(1,a+1),"codegen","--watch","--path",e],r&&i.push("--codegen-config-path",r)):(n="node",i=[Ya(import.meta.url),e,t??A("app"),r??""]);let u=Bu(n,i,{stdio:["inherit","ignore","pipe"]});return u.stderr.on("data",d=>{let m=typeof d=="string"?d:d?.toString?.("utf8")??"";if(!m)return;let{message:h,details:g}=za(m,e);/`punycode`/.test(h)||/\.body\[\d\]/.test(h)||/console\.time(End)?\(\)/.test(h)||/─ (warning|info|success) ───/.test(h)||(ee({body:""}),ne({headline:h,body:g}))}),u.on("close",d=>{d&&d>0&&ne({headline:"Codegen process exited with code "+d,body:"There should be more logs above."})}),u}async function ur(e){return await Wu(e),Yu(e).catch(t=>{if(t instanceof T)throw t;let{message:r,details:n}=za(t.message,e.rootDirectory);throw new T(r,n)})}async function Wu(e){let{execSync:t,exec:r}=await import("child_process");try{t("npx react-router --version",{cwd:e.rootDirectory,stdio:"ignore"})}catch{ee({body:"React Router not found, skipping typegen"});return}e.watch?r("npx react-router typegen --watch",{cwd:e.rootDirectory}):t("npx react-router typegen",{cwd:e.rootDirectory,stdio:"inherit"})}async function Yu({watch:e,configFilePath:t,forceSfapiVersion:r,...n}){let{generate:i,loadCodegenConfig:a,CodegenContext:u}=await vt("@graphql-codegen/cli",n.rootDirectory).catch(()=>{throw new T("Could not load GraphQL Codegen CLI.","Please make sure you have `@graphql-codegen/cli` installed as a dev dependency.")}),{config:d}=await a({configFilePath:t??n.rootDirectory})||await zu(n,r);await Ku(d,n);let m=new u({config:{...d,watch:e,silent:!e,cwd:n.rootDirectory},filepath:"not-used-but-must-be-set"});return m.cwd=n.rootDirectory,await i(m,!0),Object.entries(d.generates).reduce((h,[g,w])=>("documents"in w&&(h[g]=(Array.isArray(w.documents)?w.documents:[w.documents]).filter(v=>typeof v=="string")),h),{})}async function zu({rootDirectory:e,appDirectory:t=A(e,"app")},r){let{getSchema:n,preset:i,pluckConfig:a}=await vt("@shopify/hydrogen-codegen",e).catch(()=>{throw new T("Could not load Hydrogen Codegen.","Please make sure you have `@shopify/hydrogen-codegen` installed as a dev dependency.")}),{loadConfig:u}=await vt("graphql-config",e).catch(()=>{throw new T("Could not load GraphQL Config.","Please make sure you have `graphql-config` installed as a dev dependency.")}),d=await u({rootDir:e,throwOnEmpty:!1,throwOnMissing:!1,legacy:!1}).catch(()=>{}),m=n("storefront"),h=Wa(m,d),g=n("customer-account",{throwIfMissing:!1}),w=g?Wa(g,d):void 0,v="*!(*.d).{ts,tsx,js,jsx}",S=be(e,t),E=O=>{let k=jt(m),P=g&&jt(g);return!!(O.endsWith(k)||P&&O.endsWith(P))},x=Object.values(d?.projects??{}).filter(O=>O.hasExtension("codegen")&&(typeof O.schema!="string"||!E(O.schema)));return{filepath:"virtual:codegen",config:{overwrite:!0,pluckConfig:a,generates:{...No(h)??{"storefrontapi.generated.d.ts":{preset:i,schema:m,documents:h?.documents??[v,R(S,"**",v)],...!!r&&{presetConfig:{importTypes:!1},schema:{[`https://hydrogen-preview.myshopify.com/api/${r.split(":")[0]}/graphql.json`]:{headers:{"content-type":"application/json","X-Shopify-Storefront-Access-Token":r.split(":")[1]??"3b580e70970c4528da70c98e097c2fa0"}}},config:{defaultScalarType:"string",scalars:{JSON:"unknown"}}}}},...No(w)??(w?.documents?{"customer-accountapi.generated.d.ts":{preset:i,schema:g,documents:w.documents}}:{}),...x.reduce((O,k)=>({...O,...No(k)}),{})}}}}function No(e){if(e?.extensions?.codegen?.generates)return Object.entries(e.extensions.codegen.generates).reduce((t,[r,n])=>(t[r]={...e,...Array.isArray(n)?n[0]:n},t),{})}function Wa(e,t){if(!t)return;let r=jt(e);return Object.values(t.projects||{}).find(n=>typeof n.schema=="string"&&n.schema.endsWith(r))}async function Ku(e,{rootDirectory:t}){let r=Symbol.for("name"),n=Object.values(e.generates).filter(i=>{let a=(Array.isArray(i)?i[0]:i)?.preset;if(typeof a=="object"&&r in a)return a[r]==="hydrogen"||a[r]==="@shopify/graphql-codegen"});for(let i of n){let a=Array.isArray(i)?i[0]:i;if(a){let u=await At(t);a.hooks={beforeOneFileWrite:(d,m)=>ar(m,u,d),...a.hooks}}}}p();function fr(){let{env:e}=process;return e.CI==="false"?!1:!!(e.CI||e.CI_NAME||e.BUILD_NUMBER||e.TF_BUILD)}p();function dr(){let e={state:"pending"};return e.promise=new Promise((t,r)=>{e.resolve=n=>(e.state==="pending"&&(e.state="resolved"),t(n)),e.reject=n=>(e.state==="pending"&&(e.state="rejected"),r(n))}),e}p();function dt(e){let t,r=process.exit;process.exit=async n=>{t??=e();let i=setTimeout(()=>r(n),5e3);return await t,clearTimeout(i),r(n)}}var vn=class e extends L{static descriptionWithMarkdown="Builds a Hydrogen storefront for production. The client and app worker files are compiled to a `/dist` folder in your Hydrogen project directory.";static description="Builds a Hydrogen storefront for production.";static flags={...C.path,...C.entry,...C.sourcemap,...C.lockfileCheck,...C.disableRouteWarning,...C.codegen,watch:yn.Flags.boolean({description:"Watches for changes and rebuilds the project writing output to disk.",env:"SHOPIFY_HYDROGEN_FLAG_WATCH"}),"bundle-stats":yn.Flags.boolean({description:"Show a bundle size summary after building. Defaults to true, use `--no-bundle-stats` to disable.",allowNo:!0}),"force-client-sourcemap":yn.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd(),n={...X(t),useCodegen:t.codegen,directory:r};if(!await Yr(r))throw new T(qe);let a=await St(n);n.watch?a?.close&&dt(async()=>{await a?.close()}):process.exit(0)}},Ju=5;async function St({entry:e,directory:t,useCodegen:r=!1,codegenConfigPath:n,sourcemap:i=!0,forceClientSourcemap:a,disableRouteWarning:u=!1,lockfileCheck:d=!0,assetPath:m,bundleStats:h=!fr(),watch:g=!1,onServerBuildStart:w,onServerBuildFinish:v}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),m=m??process.env.HYDROGEN_ASSET_BASE_URL??"/";let S=t??process.cwd();d&&await Ma(S,fr());let[E,{userViteConfig:x,remixConfig:O,clientOutDir:k,serverOutDir:P,serverOutFile:b}]=await Promise.all([Wr(S),De(S,e)]),D=E.createLogger(g?"warn":void 0);process.env.SHOPIFY_UNIT_TEST&&(D.info=q=>at("info",q),D.warn=q=>at("warn",q),D.error=q=>at("error",q));let j=x.build?.minify??!0,B={root:S,mode:process.env.NODE_ENV,base:m,customLogger:D},N,W=await E.build({...B,build:{emptyOutDir:!0,copyPublicDir:!0,sourcemap:a??(process.env.NODE_ENV!=="production"&&i),watch:g?{}:null},server:{watch:g?{}:null},plugins:[{name:"hydrogen:cli:client",buildStart(){N?.resolve(),N=dr()},buildEnd(q){q&&N.reject(q)},writeBundle(){N.resolve()},closeWatcher(){this.error(new Error("Process exited before client build finished."))}}]});console.log("");let H,F=await E.build({...B,build:{sourcemap:i,ssr:e??!0,emptyOutDir:!1,copyPublicDir:!1,minify:j,watch:g?{buildDelay:100}:null},server:{watch:g?{}:null},plugins:[{name:"hydrogen:cli:server",async buildStart(){await N.promise,H?.resolve(),H=dr(),await w?.()},async writeBundle(){H?.state!=="rejected"&&await v?.(),H.resolve()},closeWatcher(){this.error(new Error("Process exited before server build finished."))}},...h?[Ga({minify:j?(q,se)=>E.transformWithEsbuild(q,se,{minify:!0,minifyWhitespace:!0,minifySyntax:!0,minifyIdentifiers:!0,sourcemap:!1,treeShaking:!1,legalComments:"none",target:"esnext"}).then(Re=>Re.code):void 0})]:[]]});g||await Promise.all([Me(R(k,".vite")),Me(R(P,".vite")),Me(R(P,"assets"))]);let G={rootDirectory:S,appDirectory:O.appDirectory,configFilePath:n},K=r?g?gn(G):await ur(G).then(()=>{}):void 0;if(!g&&process.env.NODE_ENV!=="development"){if(h){let se="file://"+R(P,Qe);V(ae`${await Va(P)||`
37
+ `}\n │\n └─── ${Ue.link("Complete analysis: "+se,se)}\n\n`)}await Ci(b)/(1024*1024)>=Ju&&Z(`\u{1F6A8} Smaller worker bundles are faster to deploy and run.${j?"":"\n Minify your bundle by adding `build.minify: true` to vite.config.js."}
38
+ Learn more about optimizing your worker bundle file: https://h2o.fyi/debugging/bundle-size
39
+ `)}if(!g&&!u){let q=pn(O);if(q.length){let se=await He(S),Re=se==="npm"?"npx":se;Z(`Heads up: Shopify stores have a number of standard routes that aren\u2019t set up yet.
40
+ Some functionality and backlinks might not work as expected until these are created or redirects are set up.
41
+ This build is missing ${q.length} route${q.length>1?"s":""}. For more details, run \`${Re} shopify hydrogen check routes\`.
42
+ `)}}return!g&&!u&&hn(mn(O)),{async close(){K?.removeAllListeners("close"),K?.kill("SIGINT");let q=[];"close"in W&&q.push(W.close()),"close"in F&&q.push(F.close()),await Promise.allSettled(q),(N?.state==="pending"||H?.state==="pending")&&(N?.promise.catch(()=>{}),N?.reject(),H?.promise.catch(()=>{}),H?.reject(),await new Promise(se=>setTimeout(se,500)))}}}p();var Ka=fe(Te(),1),wn=class e extends L{static descriptionWithMarkdown="Checks whether your Hydrogen app includes a set of standard Shopify routes.";static description="Returns diagnostic information about a Hydrogen storefront.";static flags={...C.path};static args={resource:Ka.Args.string({name:"resource",description:"The resource to check. Currently only 'routes' is supported.",required:!0,options:["routes"]})};async run(){let{flags:t,args:r}=await this.parse(e),n=t.path?A(t.path):process.cwd();if(r.resource==="routes")await Qu({directory:n});else throw new Error("Invalid command argument.")}};async function Qu({directory:e}){let t=await lt(e);Ha(pn(t)),hn(mn(t))}p();var bn=fe(Te(),1);var _n=class e extends L{static descriptionWithMarkdown="Automatically generates GraphQL types for your project\u2019s Storefront API queries.";static description="Generate types for the Storefront API queries found in your project.";static flags={...C.path,"codegen-config-path":bn.Flags.string({description:"Specify a path to a codegen configuration file. Defaults to `<root>/codegen.ts` if it exists.",required:!1}),"force-sfapi-version":bn.Flags.string({description:"Force generating Storefront API types for a specific version instead of using the one provided in Hydrogen. A token can also be provided with this format: `<version>:<token>`.",hidden:!0}),watch:bn.Flags.boolean({description:"Watch the project for changes to update types on file save.",required:!1,default:!1})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd();await Xu({...X(t),directory:r})}};async function Xu({directory:e,codegenConfigPath:t,forceSfapiVersion:r,watch:n}){let{root:i}=Ve(e),a=await lt(i);console.log("");let u=await ur({...a,configFilePath:t,forceSfapiVersion:r,watch:n});n||z({headline:"Generated types for GraphQL:",body:{list:{items:Object.entries(u).map(([d,m])=>d+`
43
+ `+m.map(h=>J.dim(`- ${h}`)).join(`
44
+ `))}}})}p();var Xa=fe(Te(),1);p();import{Session as Zu}from"node:inspector";async function Ja(e){let{createMiniOxygen:t}=await vt("@shopify/mini-oxygen/node",e).catch($o),r=t({script:"export default {}",modules:!0,log:()=>{}});return{async run(n,i){let[a]=await Promise.all([ke(n),r.ready()]),u=await ef();await r.reload({script:a});let d=await u();return tf(d,n+".map",i)},async close(){await r.dispose()}}}function ef(){let e=new Zu;return e.connect(),new Promise(t=>{e.post("Profiler.enable",()=>{e.post("Profiler.start",()=>{t(()=>new Promise((r,n)=>{e.post("Profiler.stop",(i,{profile:a})=>{if(e.disconnect(),i)return n(i);r(a)})}))})})})}async function tf(e,t,r){let{SourceMapConsumer:n}=await import("./source-map-3K6Y2OMO.js"),i=JSON.parse(await ke(t)),a=await new n(i,"file://"+t),u=new Set,d=0,m=e.endTime-e.startTime,h=e.samples?.length?m/e.samples.length:0;for(let g of e.nodes)(g.callFrame.url==="<script>"||u.has(g.id))&&(u.add(g.id),g.children?.forEach(w=>u.add(w))),u.has(g.id)?(rf(g,a),g.callFrame.url==="<script>"&&!g.callFrame.functionName&&!g.callFrame.lineNumber&&!g.callFrame.columnNumber&&(g.callFrame.url=r??"",g.callFrame.functionName="(top-level app code)"),d+=Math.round((g.hitCount??0)*h*1e3)/1e3):nf(g);return a.destroy(),{profile:e,totalTimeMs:m/1e3,totalScriptTimeMs:d/1e3}}function rf(e,t){let r=t.originalPositionFor({line:e.callFrame.lineNumber+1,column:e.callFrame.columnNumber+1});e.callFrame.url=r.source||e.callFrame.url,e.callFrame.functionName=r.name||e.callFrame.functionName,e.callFrame.lineNumber=r.line?r.line-1:e.callFrame.lineNumber,e.callFrame.columnNumber=r.column??e.callFrame.columnNumber}function nf(e){Object.assign(e,{children:[],callFrame:{functionName:"(profiler)",scriptId:"0",url:"",lineNumber:-1,columnNumber:-1}})}var Qa="startup.cpuprofile",Sn=class e extends L{static descriptionWithMarkdown="Builds the app and runs the resulting code to profile the server startup time, watching for changes. This command can be used to [debug slow app startup times](https://shopify.dev/docs/custom-storefronts/hydrogen/debugging/cpu-startup) that cause failed deployments in Oxygen.\n\n The profiling results are written to a `.cpuprofile` file that can be viewed with certain tools such as [Flame Chart Visualizer for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-js-profile-flame).";static description="Builds and profiles the server startup time the app.";static flags={...C.path,...C.entry,output:Xa.Flags.string({description:`Specify a path to generate the profile file. Defaults to "${Qa}".`,default:Qa,required:!1})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd(),{close:n}=await of({...X(t),directory:r,output:A(r,t.output)});dt(async()=>{await n()})}};async function of({directory:e,entry:t,output:r}){process.env.NODE_ENV||(process.env.NODE_ENV="production"),Ht({workerReload:!1});let{buildPath:n,buildPathWorkerFile:i}=Ve(e);V(`\u23F3\uFE0F Starting profiler for CPU startup... Profile will be written to:
45
+ `+J.dim(r));let a=0,u,d=await Ja(e),m={onServerBuildStart(){a>0&&process.stdout.write(Lr.eraseLines(4)),V(`
46
+ #${++a} Building and profiling...`)},async onServerBuildFinish(){let{profile:v,totalScriptTimeMs:S}=await d.run(i,u);process.stdout.write(Lr.eraseLines(2)),V(`#${a} Total time: ${S.toLocaleString()} ms
47
+ ${J.dim(r)}`),await le(r,JSON.stringify(v,null,2)),V(`
48
+ Waiting for changes...`)}};if(await Nt(e))throw new T(qe);let g=await De(e).catch(()=>null);i=g?.serverOutFile??R(n,"server","index.js"),u=g?.remixConfig.serverEntryPoint??"";let w=await St({entry:t,directory:e,watch:!0,sourcemap:!0,disableRouteWarning:!0,lockfileCheck:!1,bundleStats:!1,...m,onServerBuildStart(){return a===0&&process.stdout.write(Lr.eraseLines(1)),m.onServerBuildStart()}});return{async close(){await Promise.allSettled([w.close(),d.close()])}}}p();var Ee=fe(Te(),1);p();p();import Za from"fs";import es,{dirname as af}from"path";import{fileURLToPath as sf}from"url";var En={assetsDirDefault:"dist/client/",buildCommandDefault:"npm build",verificationDurationDefault:180,maxUploadAttempts:3,maxResumabeUploadAttempts:9,workerDirDefault:"dist/worker/"};function Ge(e){if(cf(e)){if(e.statusCode===401)throw new T("You are not authorized to perform this action. Please check your deployment token.");if(e.statusCode===429)throw new T("You've made too many requests. Please try again later")}if(e instanceof T&&e.message.includes("503"))throw new T("The server is currently unavailable. Please try again later.")}var xe=(e=>(e.OxygenNamespaceHandle="X-Oxygen-Namespace-Handle",e))(xe||{});function cf(e){return typeof e=="object"&&e!==null&&"statusCode"in e}function mr(e){let t;if(e)t=es.join(e,"package.json");else{let n=sf(import.meta.url),i=af(n);t=es.join(i,"../../package.json")}if(!Za.existsSync(t))return{};let r=Za.readFileSync(t,"utf8");return JSON.parse(r)}function Lo(e){process.stderr.write(`${e}
49
+ `)}var qt=375;function Mo(e){try{let t=Buffer.from(e,"base64").toString("utf-8"),r=JSON.parse(t);return ns(r)}catch{throw new Error("Error processing deployment token. Please check your token and try again.")}}function ts(e){if(!e)return;let t=Number(e);if(isNaN(t))throw new T("Invalid duration format. Please specify the duration in hours (e.g., '10').");if(t>12||t<1)throw new T("Invalid duration length. Please specify the duration (in hours) between 1 to 12 hours.");return t}async function rs({config:e,performedBuild:t=!1}){let{rootPath:r,workerDir:n,assetsDir:i,skipBuild:a,workerOnly:u}=e,d={root:r};(a||t)&&(d.worker=R(r,n),u||(d.assets=R(r,i)));for(let h of Object.keys(d))await lf(d[h],h);if(!/^https:\/\/(?:[\w-]+\.)*[\w-]+|^https:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/.test(e.deploymentUrl))throw new Error(`Invalid deployment service URL: ${e.deploymentUrl}`)}async function lf(e,t){if(!await re(e))throw t==="assets"&&Z('Use the "workerOnly" flag to perform a worker-only deployment.',Lo),new Error(`Path not found: ${e}`)}function ns(e){return typeof e=="object"?Object.keys(e).reduce((t,r)=>{let n=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace("-","").replace("_",""));if(e[r]===void 0)throw new Error(`Invalid token: ${r} is undefined`);return t[n]=ns(e[r]),t},{}):e}p();var kn=fe(is(),1);var as;function uf(e){if(e)return;if(kn.default._client)return kn.default;let r={apiKey:"21fd37fe87ead4b9c5a8eed90752b455",autoDetectErrors:!0,appVersion:mr().version,endpoints:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com"},logger:null};return kn.default.start(r)}function ss(e){as=uf(e)}function Gt(){return as}function cs(e,t){if(!t)return e;let r=n=>n.replace(new RegExp(t,"g"),"***");if(e instanceof Error){let n=Object.create(Object.getPrototypeOf(e));return Object.assign(n,e,{message:r(e.message),stack:e.stack?r(e.stack):void 0}),n}return r(e)}p();var ye=(e=>(e.BuildTime="build_time",e.NumFilesRequested="num_files_requested",e.NumFilesUploaded="num_files_uploaded",e.TotalSizeUploaded="total_size_uploaded",e.TotalSizeRequested="total_size_requested",e.TotalTime="total_time",e.UploadTime="upload_time",e.DeploymentCompletedTime="deployment_completed_time",e.DeploymentRoutableTime="deployment_routable_time",e))(ye||{}),xn=class{metrics={};metricPrefix="oxygen.cli";defaultTags;exportUrl;constructor(t){let{version:r}=mr(),{version:n}=mr(`${t.rootPath}/node_modules/@shopify/hydrogen`);this.defaultTags={ci_provider:t.ciProvider,cli_version:`oxygen-cli@${r||"unknown"}`,hydrogen_version:n||"unknown"},this.exportUrl="https://metrics.myshopify.dev"}add(t,r,n={}){let i={value:r,tags:n};this.metrics[t]?this.metrics[t].push(i):this.metrics[t]=[i]}formatTags(t){return Object.entries(t).map(([r,n])=>`${r}:${n}`)}async export(){let t=Object.entries(this.metrics).map(([r,n])=>{let i=`${this.metricPrefix}.${r}`;return n.map(({value:a,tags:u})=>({name:i,type:"gauge",value:a,tags:this.formatTags({...u,...this.defaultTags})}))}).flat();try{await _e(this.exportUrl,{method:"POST",body:JSON.stringify({events:t})})}catch(r){let n=Gt();n&&(r instanceof Error||typeof r=="string")&&n.notify(r)}}};p();p();var ls=`
50
+ mutation BuildInitiate($environment: EnvironmentSelectorInput, $labels: [String!]) {
51
+ buildInitiate(environment: $environment, labels: $labels) {
52
+ build {
53
+ id
54
+ assetPath
55
+ }
56
+ userErrors {
57
+ message
58
+ }
59
+ }
60
+ }
61
+ `;async function us(e){let{config:t,logger:r,environment:n,labels:i=[]}=e,a={environment:n,labels:i};try{let u=await Oe({query:ls,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:a,addedHeaders:{[xe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(u.buildInitiate.userErrors.length>=1)throw new T(`Failed to create build. ${u.buildInitiate.userErrors[0]?.message}`);return st(`Build initiated successfully with id ${u.buildInitiate.build.id}.`,r),u.buildInitiate}catch(u){throw Ge(u),u}}p();p();var fs=`
62
+ mutation BuildCancel($buildId: ID!, $reason: String!) {
63
+ buildCancel(id: $buildId, reason: $reason) {
64
+ build {
65
+ id
66
+ }
67
+ userErrors {
68
+ message
69
+ }
70
+ }
71
+ }
72
+ `;async function ds(e){let{config:t,buildId:r,reason:n,logger:i}=e,a={buildId:r,reason:n};try{let u=await Oe({query:fs,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,addedHeaders:{[xe.OxygenNamespaceHandle]:t.deploymentToken.namespace},variables:a});if(u.buildCancel.userErrors.length>=1)throw new T(`Failed to cancel build: ${u.buildCancel.userErrors[0]?.message}`);return V(`Build with id ${r} cancelled.`,i),u.buildCancel}catch(u){throw Ge(u),u}}p();p();var Pn=(e=>(e.Worker="WORKER",e.Asset="ASSET",e))(Pn||{}),Wt=class extends Error{},Et=class extends Error{};async function ps(e,t){let r=R(e.rootPath,e.workerDir),n=await or(`${r}/**`),i=ms({files:n,basePath:r,type:Pn.Worker,filter:df});if(!e.workerOnly){let u=R(e.rootPath,e.assetsDir),d=await or(`${u}/**`);i=[...i,...ms({files:d,basePath:u,type:Pn.Asset,filter:mf})]}t?.add(ye.NumFilesRequested,i.length);let a=i.reduce((u,d)=>u+d.fileSize,0)/1024;return t?.add(ye.TotalSizeRequested,a),i}function ff(e){let t=Pi(e);return Ti(t)}function ms(e){let{files:t,basePath:r,type:n,filter:i}=e,a=[];return t.forEach(u=>{let d=be(r,u);i&&!i(d)||a.push({filePath:d,fileSize:Oi(u),mimeType:Vi(u),fileType:n,fileHash:ff(u)})}),a}function df(e){let t=["oxygen.json"],r=[".js.map",".mjs.map",".map",".js",".mjs"],i=`^(${["index"].join("|")})(${r.join("|")})$`;return new RegExp(i).test(e.toLowerCase())||t.includes(e)}function mf(e){let r=`(${[".map"].join("|")})$`;return!new RegExp(r).test(e.toLowerCase())}p();p();var hs=`
73
+ mutation DeploymentInitiate($buildId: ID, $environment: EnvironmentSelectorInput, $labels: [String!], $files: [FileInput!]!) {
74
+ deploymentInitiate(buildId: $buildId, environment: $environment, labels: $labels, files: $files) {
75
+ deployment {
76
+ id
77
+ }
78
+ deploymentTargets {
79
+ filePath
80
+ fileSize
81
+ uploadUrl
82
+ fileType
83
+ parameters {
84
+ name
85
+ value
86
+ }
87
+ }
88
+ deploymentConfiguration {
89
+ timeoutInSeconds
90
+ }
91
+ userErrors {
92
+ message
93
+ }
94
+ }
95
+ }
96
+ `;async function gs(e){let{config:t,input:r,logger:n}=e,i={buildId:r.buildId,environment:r.environment,files:r.manifest,labels:r.labels};try{let a=await Oe({query:hs,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:i,addedHeaders:{[xe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(a.deploymentInitiate.userErrors.length>=1)throw new T(`Failed to create deployment. ${a.deploymentInitiate.userErrors[0]?.message}`);return st(`Deployment initiated, ${a.deploymentInitiate.deploymentTargets.length} files to upload.`,n),a.deploymentInitiate}catch(a){throw Ge(a),a}}p();p();var ys=`
97
+ mutation DeploymentComplete($deploymentId: ID!, $generateAuthBypassToken: Boolean, $authBypassTokenDuration: Int, $environmentVariables: [EnvironmentVariableInput!]) {
98
+ deploymentComplete(id: $deploymentId, generateAuthBypassToken: $generateAuthBypassToken, authBypassTokenDuration: $authBypassTokenDuration, environmentVariables: $environmentVariables) {
99
+ deployment {
100
+ id
101
+ url
102
+ }
103
+ authBypassToken
104
+ userErrors {
105
+ message
106
+ }
107
+ }
108
+ }
109
+ `;async function vs(e,t){let r={deploymentId:t,generateAuthBypassToken:e.generateAuthBypassToken};if(e.generateAuthBypassToken)r.authBypassTokenDuration=ts(e.authBypassTokenDuration);else if(e.authBypassTokenDuration)throw new T("authBypassTokenDuration is set but generateAuthBypassToken is not enabled");e.overriddenEnvironmentVariables&&(r.environmentVariables=e.overriddenEnvironmentVariables);try{let n=await Oe({query:ys,api:"Oxygen",url:`${e.deploymentUrl}/api/v2/admin/graphql`,token:e.deploymentToken.accessToken,variables:r,addedHeaders:{[xe.OxygenNamespaceHandle]:e.deploymentToken.namespace}});if(n.deploymentComplete.userErrors.length>=1)throw new T(`Failed to complete deployment: ${n.deploymentComplete.userErrors[0]?.message}`);return n.deploymentComplete}catch(n){throw Ge(n),n}}p();async function ws(e){let{config:t,url:r,logger:n,hooks:i}=e;i?.onVerificationStart?.(),V("Verifying worker deployment is routable...",n);let a=0,u=0,d=!1,m=Date.now(),h=async()=>{if(a<10?u=500:a%5===0&&(u+=5e3),(Date.now()-m)/1e3+u/1e3>t.verificationMaxDuration){let v=new Wt("Unable to verify that the worker is accessible.");throw d||(d=!0,i?.onVerificationError?.(v)),v}a++,await new Promise(v=>setTimeout(v,u)),await g()},g=async()=>{try{if((await _e(`${r}/.oxygen/deployment`,{method:"HEAD"})).status===200)return V("Deployment verification check passed",n),i?.onVerificationComplete?.(),Promise.resolve();await h()}catch{await h()}};await g()}p();p();var bs=`
110
+ mutation DeploymentCancel($deploymentId: ID!, $reason: String!) {
111
+ deploymentCancel(id: $deploymentId, reason: $reason) {
112
+ deployment {
113
+ id
114
+ }
115
+ userErrors {
116
+ message
117
+ }
118
+ }
119
+ }
120
+ `;async function _s(e){let{config:t,deploymentId:r,reason:n,logger:i}=e,a={deploymentId:r,reason:n};try{let u=await Oe({query:bs,api:"Oxygen",url:`${t.deploymentUrl}/api/v2/admin/graphql`,token:t.deploymentToken.accessToken,variables:a,addedHeaders:{[xe.OxygenNamespaceHandle]:t.deploymentToken.namespace}});if(u.deploymentCancel.userErrors.length>=1)throw new T(u.deploymentCancel.userErrors[0]?.message||"");return V(`Deployment with id ${r} cancelled.`,i),u.deploymentCancel}catch(u){throw Ge(u),u}}p();import{Agent as pf}from"https";var Ss=fe(Ru(),1);async function Es(e){let{config:t,logger:r,targets:n,hooks:i}=e;V(`Uploading ${n.length} files...`,r);let a=n.reduce((m,h)=>m+h.fileSize,0)/1024;e.metricsExporter?.add(ye.TotalSizeUploaded,a),e.metricsExporter?.add(ye.NumFilesUploaded,n.length);let u=new pf({keepAlive:!0});i?.onUploadFilesStart?.();let d=performance.now();return(0,Ss.mapLimit)(n,6,async m=>{await hf(t,m,u)}).then(()=>{let m=performance.now();i?.onUploadFilesComplete?.(),e.metricsExporter?.add(ye.UploadTime,m-d),st("Files uploaded successfully",r)}).catch(m=>{throw i?.onUploadFilesError?.(m),m}).finally(()=>{u.destroy()})}async function hf(e,t,r){let n=t.fileType==="WORKER"?R(e.rootPath,e.workerDir):R(e.rootPath,e.assetsDir);if(t.parameters!==null&&t.parameters.length>0){let i=Di();t.parameters.forEach(a=>{i.append(a.name,a.value)}),i.append("file",Eo(R(n,t.filePath))),await ks(i,t,r)}else{let i=await gf(t,r);await xs(R(n,t.filePath),i,r)}}async function ks(e,t,r,n=0){try{let a=new AbortController,u=setTimeout(()=>{a.abort()},12e4),d=await _e(t.uploadUrl,{method:"POST",body:e,signal:a.signal,headers:{Connection:"keep-alive"},agent:r});if(clearTimeout(u),!d.ok)throw new Error(`${d.status}`)}catch(i){if(Ps(i,"ENOENT"))throw new Error(`File not found: ${t.filePath}`);if(n<Number(En.maxUploadAttempts))await ks(e,t,r,n+1);else throw i instanceof Error&&i.name==="AbortError"?new Error(`Request timeout whilst uploading ${t.filePath}`):new Error(`Failed to upload file ${t.filePath}`)}}async function gf(e,t){return _e(e.uploadUrl,{method:"POST",headers:{"x-goog-resumable":"start","X-Goog-Content-Length-Range":`0,${e.fileSize}`,"User-Agent":"oxygen-cli"},agent:t}).then(r=>({sessionUri:r.headers.get("x-guploader-uploadid"),location:r.headers.get("location"),target:e})).catch(r=>{throw new Error(`Failed to initiate resumable upload for file ${e.filePath} (status code ${r.statusCode})`)})}async function xs(e,t,r,n=0,i=0){await yf(t.location,e,n,r).catch(async a=>{if(Ps(a,"ENOENT"))throw new Error(`File not found: ${t.target.filePath}`);if(a&&i>=Number(En.maxResumabeUploadAttempts))throw new Error(`Failed to upload file ${t.target.filePath} after ${En.maxResumabeUploadAttempts} attempts`);let u=await vf(t.location,t.target.fileSize,r);if(!u.complete){let d=u.lastReceivedByte,m=i+1;await xs(e,t,r,d,m)}})}async function yf(e,t,r,n){let i=Eo(t,{start:r});return _e(e,{method:"PUT",body:i,agent:n}).then(a=>a.status)}async function vf(e,t,r){let n=i=>{if(!i||i.split("-").length!==2)return 0;let a=i.split("-");return parseInt(a[1],10)};return _e(e,{method:"PUT",headers:{"Content-Length":"0","Content-Range":`bytes */${t}`},agent:r}).then(i=>({complete:i.status===200,lastReceivedByte:n(i.headers.get("range"))})).catch(i=>(console.error(i),{complete:!1,lastReceivedByte:0}))}function Ps(e,t){return e instanceof Error&&"code"in e&&e.code===t}p();p();var Cs=`
121
+ query DeploymentVerificationDetails($deploymentId: ID!) {
122
+ deploymentVerificationDetails(id: $deploymentId) {
123
+ url
124
+ status
125
+ error
126
+ startupTime
127
+ }
128
+ }
129
+ `,pr=(e=>(e.Pending="PENDING",e.Deployed="DEPLOYED",e.Failed="FAILED",e.Cancelled="CANCELLED",e))(pr||{});async function Os(e,t){let{config:r,logger:n,timeoutInSeconds:i,hooks:a}=e,u={deploymentId:t};a?.onDeploymentCompletedVerificationStart?.(),V("Verifying deployment completed...",n);let d=Date.now(),m=async()=>{if((Date.now()-d)/1e3+3e3/1e3>i)throw a?.onDeploymentCompletedVerificationError?.(),new Error(`Deployment not completed after ${i} seconds.`);return await new Promise(v=>setTimeout(v,3e3)),h()},h=async()=>{let w=(await Oe({query:Cs,api:"Oxygen",url:`${r.deploymentUrl}/api/v2/admin/graphql`,token:r.deploymentToken.accessToken,variables:u,addedHeaders:{[xe.OxygenNamespaceHandle]:r.deploymentToken.namespace}})).deploymentVerificationDetails;if(w==null)throw a?.onDeploymentCompletedVerificationError?.(),new Et("Deployment not found");if(w.status===pr.Deployed)return st("Deployment to Oxygen completed successfully",n),a?.onDeploymentCompleted?.(),w;if(w.status===pr.Failed||w.status===pr.Cancelled)throw a?.onDeploymentFailed?.(w),new Et(w.error?`Deployment ${w.status.toLocaleLowerCase()}, error: ${w.error}${w.startupTime&&w.error.includes("exceeded CPU time limit")?` (Startup time: ${w.startupTime}ms exceeded CPU time limit)`:""}`:`Deployment ${w.status.toLocaleLowerCase()}`);return m()};return h()}p();import{spawn as wf}from"child_process";import{PassThrough as bf}from"stream";async function Ts(e){let{config:t,assetPath:r,hooks:n}=e,i=Gt();if(n?.buildFunction){let u=performance.now();return n.buildFunction(r).then(()=>{e.metricsExporter?.add(ye.BuildTime,performance.now()-u)}).catch(d=>{throw new Error(`Build function failed with error: ${d}`)})}let a=r?{HYDROGEN_ASSET_BASE_URL:r}:{};try{await new Promise((u,d)=>{let m="",h=new bf;h.on("data",v=>{m+=v,process.stderr.write(v)});let g=performance.now(),w=wf(t.buildCommand,[],{stdio:["inherit","pipe","pipe"],env:{...process.env,...a},cwd:t.rootPath,shell:!0});w.stderr?.pipe(h),w.stdout?.pipe(h),w.on("close",v=>{if(v===0&&e.metricsExporter?.add(ye.BuildTime,performance.now()-g),i?.addMetadata("buildCommand",{command:t.buildCommand,stderr:m,code:v}),v!==0){d(v);return}u(v)})})}catch(u){throw new Error(`Build failed with error code: ${u}`)}}p();async function Ds(e,t){let r=Ur(),n=r.metadata??{};try{let i=await _f(e.rootPath);n.actor||(n.actor=i.author_name),n.commitDate||(n.commitDate=i.date),n.commitMessage||(n.commitMessage=i.message),i.branch&&(n.branch=i.branch),i.hash&&(n.commitSha=i.hash)}catch{Z("Could not retrieve Git history, commit message will be unavailable.",t)}return{name:r.isCI?r.name:"none",...n,actor:e.metadata.user??n.actor,commitMessage:Sf(e.metadata.description??n.commitMessage),commitSha:e.metadata.version??n.commitSha,hydrogenVersion:e.metadata.hydrogenVersion,url:e.metadata.url??n.url}}async function _f(e){let t=await Br(e),r=(/HEAD -> ([^,]*)/.exec(t.refs)||[])[1],n=process.env.GITHUB_HEAD_REF;if(!n)return{...t,branch:r};let i=/Merge ([\w\d]+) into [\w\d]+/.exec(t.message);return{...t,branch:n,hash:i?i[1]:t.hash}}function Sf(e){if(!e)return;let t=e.split(/\r?\n/)[0]?.trim()||"",r=JSON.stringify(t),n=!1;for(;r.length>qt;){let i=t.lastIndexOf(" ",qt-3);t=`${t.substring(0,i>-1?i:qt-3)}`.trimEnd(),n=!0,r=JSON.stringify(t)}return n?`${t}...`:t}function Is(e,t){if(e.defaultEnvironment)return;let r=e.environmentTag||t.branch;return r?{tag:r}:void 0}function $s(e){let t=[],r=(i,a)=>{let u=JSON.stringify(a);if(u.length>qt)throw new Error(`Provided ${i} metadata exceeds maximum length (max ${qt} characters).`);let d=`${i}=${u}`;t.push(d)};if(e.name!=="none"&&t.push(`ci-platform=${JSON.stringify(e.name)}`),e.name!=="unknown"){let i={attempt:"attempt",run:"runId"};for(let[a,u]of Object.entries(i)){let d=a;e[d]&&t.push(`${e.name}-${u}=${JSON.stringify(e[d])}`)}}let n={actor:"user",branch:"branch",commitDate:"commit-date",commitMessage:"description",commitSha:"version",hydrogenVersion:"hydrogen-version",url:"url"};for(let[i,a]of Object.entries(n)){let u=i;e[u]&&r(a,e[u])}return t}async function Rs(e){let t=performance.now();ss(!e.config.bugsnag);let r=Gt();r?.addMetadata("config",{...e.config,deploymentToken:{...e.config.deploymentToken,accessToken:"***"},rootPath:"***"});let{config:n,hooks:i}=e,a=e.logger??Lo,u={},d,m,h;try{let g=await Ds(n,a),w=$s(g),v=Is(n,g);if(r?.addMetadata("metadata",{environment:v,labels:w,metadata:g}),h=new xn({ciProvider:g.name||"unknown",rootPath:n.rootPath}),!n.workerOnly&&!n.skipBuild){let b=await us({config:n,environment:v,labels:w,logger:a});u.id=b.build.id,u.assetPath=b.build.assetPath}n.skipBuild||(await Ts({config:n,assetPath:u.assetPath,hooks:i,metricsExporter:h}),await rs({config:n,performedBuild:!0})),d=!0;let S=await ps(n,h);r?.addMetadata("manifest",S);let E=u.id?{buildId:u.id,manifest:S}:{environment:v,manifest:S,labels:w};m=await gs({config:n,input:E,logger:a}),await Es({config:n,targets:m.deploymentTargets,hooks:i,logger:a,metricsExporter:h});let x=performance.now(),O=await vs(n,m.deployment.id);h.add(ye.TotalTime,performance.now()-t),await Os({config:n,hooks:i,logger:a,timeoutInSeconds:m.deploymentConfiguration.timeoutInSeconds},m.deployment.id),h.add(ye.DeploymentCompletedTime,performance.now()-x),n.skipVerification||(await ws({config:n,url:O.deployment.url,logger:a,hooks:i}),h.add(ye.DeploymentRoutableTime,performance.now()-x));let k={url:O.deployment.url},P=`
130
+ The deployment can be reached at the ${k.url} preview URL`;return O.authBypassToken&&(k.authBypassToken=O.authBypassToken,P+=`. The auth bypass token for the deployment is ${k.authBypassToken}`),Hi(P,a),k}catch(g){return n.bugsnag&&r&&(g instanceof Error||typeof g=="string")&&r.notify(cs(g,n.rootPath)),g instanceof Error?(g instanceof Wt||g instanceof Et?Z(g.message,a):u.id&&!d?(Z(`Build failed with: ${g.message}, cancelling build.`,a),await ds({config:n,buildId:u.id,reason:g.message,logger:a}).catch(w=>{w instanceof Error&&Z(`Failed to cancel build: ${w.message}`,a)})):m?.deployment.id&&(Z(`Deployment failed with: ${g.message}, cancelling deployment.`,a),await _s({config:n,deploymentId:m.deployment.id,reason:g.message,logger:a}).catch(w=>{w instanceof Error&&Z(`Failed to cancel deployment: ${w.message}`,a)})),Promise.reject(g)):(console.error("Unknown error",g),Promise.reject(new Error("Unknown error")))}finally{h?.export()}}import{createRequire as kf}from"node:module";p();p();p();function js(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts/new`}function Fs(e){let{storeFqdn:t}=e;return`https://${t}/admin/custom_storefronts`}function Yt({session:e,storefront:t,cliCommand:r}){ot({name:"NoStorefrontError",type:0,message:ae`${Ue.errorText("Couldn\u2019t find Hydrogen storefront.")}`.value,skipOclifErrorHandling:!0,tryMessage:ae`Couldn’t find ${t.title} (ID: ${Mt(t.id)}) on ${e.storeFqdn}. Check that the storefront exists and run ${Ue.genericShellCommand(`${r} link`)} to link this project to it.\n\n${Ue.link("Hydrogen Storefronts Admin",Fs(e))}`.value})}function As({noStorefronts:e=!1}){ee({headline:e?"You don't have a Hydrogen storefront to link to":"You haven't linked your project to a storefront yet",body:["Link your local environment to a Hydrogen storefront. Enable automatic environment variable injection and access to",{command:"env list"},",",{command:"env pull"},",",{command:"env push"},", and",{command:"deploy"},"commands. Use",{command:"unlink"},"to disconnect from the storefront."]})}p();var Ef=`#graphql
131
+ query GetDeploymentToken($id: ID!) {
132
+ hydrogenStorefront(id: $id) {
133
+ oxygenDeploymentToken
134
+ environments {
135
+ name
136
+ handle
137
+ branch
138
+ type
139
+ }
140
+ }
141
+ }
142
+ `;async function Ns(e,t){let{hydrogenStorefront:r}=await Lt(Ef,e,{id:t});return{storefront:r}}p();async function mt({root:e,session:t,config:r,cliCommand:n}){let i=await ua(t),a=r.storefront?.id?i.find(({id:u})=>u===r.storefront.id):void 0;return a||(As({noStorefronts:!i.length}),await Oa(e,t,r,{force:!0,cliCommand:n,storefronts:i}))}async function Ls({root:e}){let[{session:t,config:r},n]=await Promise.all([Ie(e),oe()]),i=await mt({root:e,session:t,config:r,cliCommand:n});if(!i)return;r.storefront=i;let{storefront:a}=await Ns(t,r.storefront.id);if(!a){Yt({session:t,storefront:r.storefront,cliCommand:n});return}if(!a.oxygenDeploymentToken){Z("Could not retrieve a deployment token.");return}return a}var Ms="h2_deploy_log.json",xf=(e,t="info")=>{(t==="error"||t==="warn")&&Z(e)},Cn=class e extends L{static descriptionWithMarkdown="Builds and deploys your Hydrogen storefront to Oxygen. Requires an Oxygen deployment token to be set with the `--token` flag or an environment variable (`SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN`). If the storefront is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) then the Oxygen deployment token for the linked storefront will be used automatically.";static description="Builds and deploys a Hydrogen storefront to Oxygen.";static flags={...C.entry,...C.env,...C.envBranch,...Ne(C.envFile,{"env-file":{description:"Path to an environment file to override existing environment variables for the deployment.",default:void 0}}),preview:Ee.Flags.boolean({description:"Deploys to the Preview environment.",required:!1,default:!1}),force:Ee.Flags.boolean({char:"f",description:"Forces a deployment to proceed if there are uncommited changes in its Git repository.",default:!1,env:"SHOPIFY_HYDROGEN_FLAG_FORCE",required:!1}),"no-verify":Ee.Flags.boolean({description:"Skip the routability verification step after deployment.",default:!1,required:!1}),"auth-bypass-token":Ee.Flags.boolean({description:"Generate an authentication bypass token, which can be used to perform end-to-end tests against the deployment.",required:!1,default:!1,env:"AUTH_BYPASS_TOKEN"}),"auth-bypass-token-duration":Ee.Flags.string({description:"Specify the duration (in hours) up to 12 hours for the authentication bypass token. Defaults to `2`",required:!1,env:"AUTH_BYPASS_TOKEN_DURATION",dependsOn:["auth-bypass-token"]}),"build-command":Ee.Flags.string({description:"Specify a build command to run before deploying. If not specified, `shopify hydrogen build` will be used.",required:!1}),...C.lockfileCheck,...C.path,...C.shop,"json-output":Ee.Flags.boolean({allowNo:!0,description:"Create a JSON file containing the deployment details in CI environments. Defaults to true, use `--no-json-output` to disable.",required:!1,default:!0}),token:Ee.Flags.string({char:"t",description:"Oxygen deployment token. Defaults to the linked storefront's token if available.",env:"SHOPIFY_HYDROGEN_DEPLOYMENT_TOKEN",required:!1}),"metadata-description":Ee.Flags.string({description:"Description of the changes in the deployment. Defaults to the commit message of the latest commit if there are no uncommited changes.",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_DESCRIPTION"}),"metadata-url":Ee.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_URL",hidden:!0}),"metadata-user":Ee.Flags.string({description:"User that initiated the deployment. Will be saved and displayed in the Shopify admin",required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_USER"}),"metadata-version":Ee.Flags.string({required:!1,env:"SHOPIFY_HYDROGEN_FLAG_METADATA_VERSION",hidden:!0}),"force-client-sourcemap":Ee.Flags.boolean({description:"Client sourcemapping is avoided by default because it makes backend code visible in the browser. Use this flag to force enabling it.",env:"SHOPIFY_HYDROGEN_FLAG_FORCE_CLIENT_SOURCEMAP"})};async run(){let{flags:t}=await this.parse(e),r=this.flagsToOxygenDeploymentOptions(t);await Pf(r),process.exit(0)}flagsToOxygenDeploymentOptions(t){return{...X(t),defaultEnvironment:t.preview,environmentFile:t["env-file"],path:t.path?A(t.path):process.cwd()}}};function Hs(e){return new T(e||"The deployment failed due to an unexpected error.","Retrying the deployment may succeed.",[["If the issue persists, please check the",{link:{label:"Shopify status page",url:"https://status.shopify.com/"}},"for any known issues."]])}async function Pf(e){let{authBypassTokenDuration:t,authBypassToken:r,buildCommand:n,defaultEnvironment:i,env:a,envBranch:u,environmentFile:d,force:m,forceClientSourcemap:h=!1,noVerify:g,lockfileCheck:w,jsonOutput:v,path:S,shop:E,metadataUrl:x,metadataUser:O,metadataVersion:k,entry:P}=e,{metadataDescription:b}=e,D=!0;try{await zi(S)}catch(M){if(M instanceof Yi&&(D=!1),!m&&!D){let ce="Uncommitted changes detected",Ce,tt=[["Commit your changes before deploying or use the",{command:"--force"},"flag to deploy with uncommitted changes."]];try{Ce=(await ir("git status -s",{cwd:S})).stdout}catch{}throw Ce&&(ce+=`:
143
+
144
+ ${Ce.trimEnd()}`,dn.forEach(({name:Ot,lockfile:Tt,alternativeLockfiles:io,installCommand:Dt})=>{let Pr=[Tt,...io||[]].find(Zt=>Ce.includes(Zt));Pr&&tt.push([`If you are using ${Ot}, try running`,{command:Dt},`to avoid changes to ${Pr}.`])})),new T(ce,null,tt)}}let j=Ur().isCI,B=e.token,N,W,H,F,G;try{G=await Br(S),N=(/HEAD -> ([^,]*)/.exec(G.refs)||[])[1],W=G.hash}catch{Z("Could not retrieve Git history."),N=void 0}!b&&!D&&(ne({headline:"No deployment description provided",body:["Deploying uncommited changes, but no description has been provided. Use the ",{command:"--metadata-description"},"flag to provide a description. If no description is provided, the description defaults to ",{userInput:"<sha> with additional changes"}," using the SHA of the last commit."]}),b=`${W} with additional changes`);let K;if(d){let{variables:M}=await an(d);K=Object.entries(M).map(([ce,Ce])=>({isSecret:!0,key:ce,value:Ce}))}let q=null,se=!1;if(j&&a)throw new T("Can't specify an environment handle in CI","Environments are automatically picked up by the current Git branch.");if(j&&u&&(q=u),!j){if(H=await Ls({root:S,flagShop:E}),!H)return;B=B||H.oxygenDeploymentToken,a?(q=Bt(H.environments||[],a).branch,q===null&&(se=!0)):u&&(q=lr(H.environments||[],u).branch)}if(!B){let M=j?["No deployment token provided. Use the ",{command:"--token"}," flag to provide a token."]:"Could not obtain an Oxygen deployment token, please try again or contact Shopify support.";throw new T(M)}if(!j&&!i&&!a&&!u&&H?.environments)if(H.environments.length>1){let ce=sn(H.environments).map(({name:Ce,branch:tt,handle:Ot,type:Tt})=>({label:_t(Ce,Ot,tt),value:Tt==="PREVIEW"?"shopify-preview-environment.":tt}));F=await it({message:"Select an environment to deploy to",choices:ce,defaultValue:N})}else V(`Using current checked out branch ${N} as environment tag`);let Re="https://oxygen.shopifyapps.com";process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL&&(Re=process.env.UNSAFE_SHOPIFY_HYDROGEN_DEPLOYMENT_URL,Z("Using a custom deployment service. Don't do this in production!"));let We=N;F==="shopify-preview-environment."&&(We=void 0,F=void 0,se=!0);let Pt="dist/client",Ze="dist/worker",ht=await Nt(S);if(!ht){let M=await De(S,P).catch(()=>null);M?(Pt=be(S,M.clientOutDir),Ze=be(S,M.serverOutDir)):Ze="dist/server"}let ie=await Cf({appPath:S}),ge={assetsDir:Pt,bugsnag:!0,deploymentUrl:Re,defaultEnvironment:i||se,deploymentToken:Mo(B),environmentTag:q||F||We,generateAuthBypassToken:r,authBypassTokenDuration:t,verificationMaxDuration:180,metadata:{...b?{description:b}:{},...x?{url:x}:{},...O?{user:O}:{},...k?{version:k}:{},...ie?{hydrogenVersion:ie}:{}},skipVerification:g,rootPath:S,skipBuild:!1,workerOnly:!1,workerDir:Ze,overriddenEnvironmentVariables:K};if(!j&&!ge.defaultEnvironment&&(q||F)){let M=lr(H.environments,ge.environmentTag),ce=`Creating a deployment against ${_t(M.name,M.handle,M.branch)}`;if(!await Ke({confirmationMessage:"Yes, confirm deploy",cancellationMessage:"No, cancel deploy",message:ae`${ce}
145
+
146
+ Continue?`.value}))return}let je,et=new Promise(M=>{je=M}),Ye,no=new Promise(M=>{Ye=M}),Er,kr=new Promise(M=>{Er=M}),Pe=null,Ct,Xt,Le=new Promise((M,ce)=>{Ct=M,Xt=ce}),xr={onDeploymentCompleted:()=>Er(),onVerificationComplete:()=>Ye(),onDeploymentCompletedVerificationError(){Pe=new T("Unable to verify the deployment was completed successfully","Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onDeploymentFailed:M=>{Pe=Hs(M.error||M.status)},onUploadFilesStart:()=>oo(),onUploadFilesComplete:()=>je(),onVerificationError:M=>{Pe=new T(M.message,"Please verify the deployment status in the Shopify Admin and retry deploying if necessary.")},onUploadFilesError:M=>{Pe=new T(M.message,"Check your connection and try again. If the problem persists, try again later or contact support.")}};n?(h&&(console.log(""),ee({headline:"The `--force-client-sourcemap` flag is not supported with a custom build command",body:"Client sourcemaps will not be generated."})),ge.buildCommand=n):xr.buildFunction=async M=>{if(V(ae`${J.whiteBright("Building project...")}`.value),ht)throw new T(qe);await St({directory:S,assetPath:M,lockfileCheck:w,sourcemap:!0,forceClientSourcemap:h,useCodegen:!1,entry:P})};let oo=async()=>{V(ae`${J.whiteBright(`Deploying to Oxygen..
147
+ `)}`.value),await he([{title:"Uploading files",task:async()=>await et},{title:"Verifying deployment has been completed",task:async()=>await kr},{title:"Verifying deployment is routable",task:async()=>await no,skip:()=>g}])};return await Rs({config:ge,hooks:xr,logger:xf}).then(async M=>{if(!M){Xt(Hs());return}let ce=[];j?v&&ce.push(["View the deployment information in",{subdued:Ms}]):(ce.push(["Open",{link:{url:M.url}},"in your browser to view your deployment."]),M?.authBypassToken&&ce.push(["Use the",{subdued:M.authBypassToken},"token to perform end-to-end tests against the deployment."])),z({body:["Successfully deployed to Oxygen"],nextSteps:ce}),j&&v&&await le(Ms,JSON.stringify(M)),Ct()}).catch(M=>{Xt(Pe||M)}),Le}async function Cf({appPath:e}){let{root:t}=Ve(e),r=kf(import.meta.url),{version:n}=r(r.resolve("@shopify/hydrogen/package.json",{paths:[t]}));return n}p();var vr=fe(Te(),1);p();var ve=fe(Fu(),1);import{createRequire as Of}from"node:module";var Bo=fe(Te(),1);var Us=".hydrogen",On=class e extends L{static descriptionWithMarkdown="Upgrade Hydrogen project dependencies, preview features, fixes and breaking changes. The command also generates an instruction file for each upgrade.";static description="Upgrade Remix and Hydrogen npm dependencies.";static flags={...C.path,version:Bo.Flags.string({description:"A target hydrogen version to update to",required:!1,char:"v"}),force:Bo.Flags.boolean({description:"Ignore warnings and force the upgrade to the target version",env:"SHOPIFY_HYDROGEN_FLAG_FORCE",char:"f"})};async run(){let{flags:t}=await this.parse(e);await Tf({...X(t),appPath:t.path?A(t.path):process.cwd()})}},hr=null;async function Tf({appPath:e,version:t,force:r}){if(t==="next"){let S=process.env.SHOPIFY_UNIT_TEST==="1",E=fr();if(!await Df()&&!S&&!E)throw new T("--version=next is only available when running from the Hydrogen monorepo","This feature is designed for internal development and testing of unreleased versions")}r||(await $f(e),await Rf(e));let{currentVersion:n,currentDependencies:i}=await qs({appPath:e});if(t==="next"){let S=i["@shopify/hydrogen"]==="next",E=i["@shopify/mini-oxygen"]==="next";if(S||E)throw new T("Project already uses next versions",'Cannot upgrade to --version=next when @shopify/hydrogen or @shopify/mini-oxygen are already using "next" versions')}if(ve.default.prerelease(n))throw new T("The upgrade command cannot be run over a prerelease Hydrogen version");let u=await Gs(),{availableUpgrades:d}=Ys({releases:u.releases,currentVersion:n,currentDependencies:i});if(!d?.length){z({headline:`You are on the latest Hydrogen version: ${Q(n)}`});return}let m=!1,h,g;do h=await Ff({currentVersion:n,targetVersion:t,availableUpgrades:d,currentDependencies:i}),g=Af({availableUpgrades:d,currentVersion:n,currentDependencies:i,selectedRelease:h}),m=await Nf({cumulativeRelease:g,selectedRelease:h,targetVersion:t});while(!m);let w=Wf({appPath:e,cumulativeRelease:g,currentVersion:n,selectedRelease:h});await Mf({appPath:e,selectedRelease:h,currentDependencies:i,targetVersion:t}),await Gf({appPath:e,selectedRelease:h,targetVersion:t});let v=await w;await qf({appPath:e,currentVersion:n,instrunctionsFilePath:v,selectedRelease:h})}async function Df(){try{let e=process.cwd(),t=[e,R(e,"../"),R(e,"../../")];for(let r of t)try{let n=R(r,"templates/skeleton"),i=R(r,"packages/cli"),a=await Nr(n),u=await Nr(i);if(a&&u)return!0}catch{continue}return!1}catch{return!1}}function If(e){let t={...e.dependencies},r={...e.devDependencies};return t["@shopify/hydrogen"]&&(t["@shopify/hydrogen"]="next"),r["@shopify/mini-oxygen"]&&(r["@shopify/mini-oxygen"]="next"),{...e,title:`${e.title} (next versions)`,dependencies:t,devDependencies:r}}function $f(e){return Wi(e).catch(()=>{throw new T("The upgrade command can only be run on a git repository","Please run the command inside a git repository or run 'git init' to create one")})}async function Rf(e){if(!await Ki(e))throw new T("The upgrade command can only be run on a clean git branch","Please commit your changes or re-run the command on a clean branch")}async function qs({appPath:e}){let{root:t}=Ve(e),r=R(t,"package.json"),n;try{n=JSON.parse(await ke(r))}catch{throw new T("Could not find a valid package.json","Please make sure you are running the command in a npm project")}let i={...n?.dependencies,...n?.devDependencies},a=i["@shopify/hydrogen"];if(!a)throw new T("Could not find a valid Hydrogen version in package.json","Please make sure you are running the command in a Hydrogen project");return{currentVersion:a,currentDependencies:i}}async function Gs(){if(hr)return hr;if(process.env.FORCE_CHANGELOG_SOURCE==="local"||Je&&Be&&process.env.FORCE_CHANGELOG_SOURCE!=="remote"){let e=Of(import.meta.url),t=Je&&Be?R(bo(Be),"docs","changelog.json"):R(process.cwd(),"docs","changelog.json");try{let r=e(t);return hr=r,r}catch(r){if(console.warn(`Failed to load local changelog from ${t}:`,r.message),process.env.FORCE_CHANGELOG_SOURCE==="local")throw new T("Failed to load local changelog",`Could not read changelog from ${t}`)}}try{let e=await _e("https://hydrogen.shopify.dev/changelog.json");if(!e.ok)throw new Error("Failed to fetch changelog.json");let t=await e.json();if("releases"in t&&"url"in t)return hr=t,hr}catch{}throw new T("Failed to fetch Hydrogen changelog","Ensure you have internet connection and try again")}function Ws({release:e,currentDependencies:t}){return Object.entries({...e.dependencies,...e.devDependencies}).some(([r,n])=>{if(r==="@shopify/cli")return!1;let i=t?.[r];return i?ve.default.gt(Q(n),Q(i)):!1})}function jf({currentDependencies:e,currentPinnedVersion:t,release:r}){return ve.default.gt(r.version,t)?!0:Q(r.version)===t?Ws({release:r,currentDependencies:e}):!1}function Ys({releases:e,currentVersion:t,currentDependencies:r}){let n=Q(t),i="",a=e.filter(d=>jf({release:d,currentPinnedVersion:n,currentDependencies:r})&&i!==d.version?(i=d.version,!0):!1),u=a.reduce((d,m)=>(d[m.version]||(d[m.version]=m),d),{});return{availableUpgrades:a,uniqueAvailableUpgrades:u}}async function Ff({targetVersion:e,availableUpgrades:t,currentVersion:r,currentDependencies:n}){return(e?e==="next"?If(t[0]):t.find(a=>Q(a.version)===Q(e)):void 0)??Vf(r,t)}function Af({availableUpgrades:e,selectedRelease:t,currentVersion:r,currentDependencies:n}){let i=Q(r);return e?.length?t.dependencies?.["@shopify/hydrogen"]==="next"?{features:t.features||[],fixes:t.fixes||[]}:e.filter(u=>ve.default.gt(u.version,i)&&ve.default.lte(u.version,t.version)?!0:!(Q(u.version)===i)||!n?!1:Ws({release:u,currentDependencies:n})).reduce((u,d)=>(u.features=[...u.features,...d.features],u.fixes=[...u.fixes,...d.fixes],u),{features:[],fixes:[]}):{features:[],fixes:[]}}function Nf({cumulativeRelease:e,selectedRelease:t,targetVersion:r}){let{features:n,fixes:i}=e;return(n.length||i.length)&&ee({headline:"Included in this upgrade:",customSections:[n.length&&{title:"Features",body:[{list:{items:n.map(a=>a.title)}}]},i.length&&{title:"Fixes",body:[{list:{items:i.map(a=>a.title)}}]}].filter(Boolean)}),r==="next"?!0:Ke({message:`Are you sure you want to upgrade to ${t.version}?`,cancellationMessage:"No, choose another version",defaultValue:!0})}function Tn([e]){return!!e.includes("@remix-run")}function Vo([e]){return!!e.includes("react-router")}function Bs(e,t,r){return r==="next"&&(e==="@shopify/hydrogen"||e==="@shopify/mini-oxygen")?"next":Q(t)}function Vs({currentDependencies:e,dependency:[t,r],selectedRelease:n,targetVersion:i}){let a=e[t];return Tn([t,r])||Vo([t,r])||a==="next"&&!(i==="next")?!1:n.dependenciesMeta?.[t]?!n.dependenciesMeta?.[t]?.required?!1:!!(!a||i==="next"&&(t==="@shopify/hydrogen"||t==="@shopify/mini-oxygen")||ve.default.lt(Q(a),Q(r))):!0}function Lf({selectedRelease:e,currentDependencies:t,targetVersion:r}){let n=[];for(let m of Object.entries(e.dependencies))Vs({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:r})&&n.push(`${m[0]}@${Bs(m[0],m[1],r)}`);for(let m of Object.entries(e.devDependencies))Vs({currentDependencies:t,dependency:m,selectedRelease:e,targetVersion:r})&&n.push(`${m[0]}@${Bs(m[0],m[1],r)}`);let i=Object.entries(t).find(Tn),a=Object.entries(e.dependencies).find(Tn);i&&a&&ve.default.lt(Q(i[1]),Q(a[1]))&&n.push(...Uf({currentDependencies:t,selectedRemix:a}));let u=Object.entries(t).find(Vo),d=Object.entries(e.dependencies).find(Vo);return d&&(!u||ve.default.lt(Q(u[1]),Q(d[1])))&&n.push(...Bf({currentDependencies:t,selectedReactRouter:d})),n}async function Mf({appPath:e,selectedRelease:t,currentDependencies:r,targetVersion:n}){let i=[],a=[...t.removeDependencies||[],...t.removeDevDependencies||[]].filter(d=>d in r);a.length>0&&i.push({title:"Removing deprecated dependencies",task:async()=>{await Hf({directory:e,packageManager:await He(e),args:a})}});let u=Lf({selectedRelease:t,currentDependencies:r,targetVersion:n});u.length>0&&i.push({title:"Upgrading dependencies",task:async()=>{await Ft({directory:e,packageManager:await He(e),args:u})}}),i.length>0&&await he(i,{})}async function Hf({directory:e,packageManager:t,args:r}){if(r.length===0)return;await Mi(t==="unknown"?"npm":t,[t==="npm"?"uninstall":t==="yarn"||t==="pnpm"||t==="bun"?"remove":"uninstall",...r],{cwd:e})}function Uf({currentDependencies:e,selectedRemix:t}){let r=[];for(let[n,i]of Object.entries(e))Tn([n,i])&&r.push(`${n}@${Q(t[1])}`);return r}function Bf({currentDependencies:e,selectedReactRouter:t}){let r=[],n=Q(t[1]),i=["react-router","react-router-dom","@react-router/dev","@react-router/fs-routes"];for(let a of i)r.push(`${a}@${n}`);return r}function Q(e){if(e==="next")return"next";if(e.match(/^[\^~]?0\.0\.0-next-([a-f0-9]+)-(\d+)$/))return e.replace(/^[\^~]?/,"");let r=ve.default.minVersion(e);if(!r)throw new T(`Invalid version: ${e}`);return r.version}async function Vf(e,t){if(!t?.length)throw new T("No upgrade options available");let r=t.map((n,i)=>{let{version:a,title:u}=n,d=i===0?"(latest)":ve.default.patch(a)===0?"(major)":Q(e)===Q(a)?"(outdated)":"";return`${ve.default.major(a)}${ve.default.minor(a)}`,{label:`${a} ${d} - ${Ia(u,54)}`,value:n}});return it({message:`Available Hydrogen versions (current: ${e})`,choices:r,defaultValue:r[0]?.value})}async function qf({appPath:e,currentVersion:t,selectedRelease:r,instrunctionsFilePath:n}){let i=[...Object.entries(r.dependencies||{}).map(([S,E])=>`${S}@${E}`),...Object.entries(r.devDependencies||{}).map(([S,E])=>`${S}@${E}`)],a=[];if(typeof n=="string"){let S=`Upgrade instructions created at:
148
+ file://${n}`;a.push(S)}let u=`https://hydrogen.shopify.dev/releases/${r.version}`;a.push(`Release notes:
149
+ ${u}`);let d=Q(t),m=Q(r.version),h=d===m,g=`${d} \u2192 ${m}`,w=h?`You've upgraded Hydrogen ${m} dependencies`:`You've upgraded from ${g}`,v=await He(e);return z({headline:w,customSections:[{title:"Updated dependencies",body:[{list:{items:i}}]},{title:"What\u2019s next?",body:[{list:{items:a}}]},{title:"Undo these upgrades?",body:[{list:{items:[`Run \`git restore . && git clean -df && ${v} i\``]}}]}].filter(Boolean)})}async function Gf({appPath:e,selectedRelease:t,targetVersion:r}){let i=(await Ri(R(e,"package.json")))["@shopify/hydrogen"];if(!i)throw new T("Hydrogen version not found in package.json");let a=Q(i);a.match(/^0\.0\.0-next-[a-f0-9]+-\d+$/);let u=t.dependencies?.["@shopify/hydrogen"]==="next";if(!(r==="next"&&u)&&a!==t.version)throw new T(`Failed to upgrade to Hydrogen version ${t.version}`,`You are still on version ${a}`)}function Uo(e){let{steps:t}=e,r=`### ${e.title} [#${e.id}](${e.pr})
150
+ `,n=t?.map((i,a)=>{let u=e.pr?`[#${e.id}](${e.pr})
151
+ `:"",m=t.length>1?`#### Step: ${a+1}. ${i.title} ${u}
152
+ `:`#### ${i.title.trim()}
153
+ `,h=i.info?`> ${i.info}
154
+ `:"",g=i.code?`${Buffer.from(i.code,"base64")}
155
+ `:"",w=e.docs?`[docs](${e.docs})
156
+ `:"";return`${m}${h}${w}${u}${g}`}).join(`
157
+ `);return`${r}
158
+ ${n}`}async function Wf({appPath:e,cumulativeRelease:t,currentVersion:r,selectedRelease:n}){let i="",{featuresMd:a,breakingChangesMd:u}=t.features.filter(E=>E.steps).reduce((E,x)=>(x.breaking?E.breakingChangesMd.push(Uo(x)):E.featuresMd.push(Uo(x)),E),{featuresMd:[],breakingChangesMd:[]}),d=t.fixes.filter(E=>E.steps).map(Uo);if(!a.length&&!d.length&&!u.length){ee({headline:"No upgrade instructions generated",body:"There are no additional upgrade instructions for this version."});return}let m=Q(r),h=Q(n.version);i=`upgrade-${m}-to-${h}.md`;let g=R(e,Us),v=`${`# Hydrogen upgrade guide: ${m} to ${h}`}
159
+
160
+ ----
161
+ `;u.length&&(v+=`
162
+ ## Breaking changes
163
+
164
+ ${u.join(`
165
+ `)}
166
+ ----
167
+ `),a.length&&(v+=`
168
+ ## Features
169
+
170
+ ${a.join(`
171
+ `)}
172
+ ----
173
+ `),d.length&&(v+=`
174
+ ${a.length?`----
175
+
176
+ `:""}## Fixes
177
+
178
+ ${d.join(`
179
+ `)}`);let S=R(g,i);try{await Nr(g)}catch{await nr(g)}if(!await re(S))await _o(S);else{if(await Ke({message:`A previous upgrade instructions file already exists for this version.
180
+ Do you want to overwrite it?`,defaultValue:!1}))await Me(`${S}.old`);else return;await _o(S)}return await le(S,v),`${Us}/${i}`}async function zs({targetPath:e}){try{let t=e?A(e):process.cwd(),{currentVersion:r,currentDependencies:n}=await qs({appPath:t});if(r.startsWith("workspace:")){ee({headline:"Using monorepo @shopify/hydrogen dependency",body:"This project uses the workspace protocol for @shopify/hydrogen, so upgrade notices are skipped during local monorepo development."});return}if(ve.default.prerelease(r)||/^[a-z]+$/i.test(r))return;let a=await Gs(),{availableUpgrades:u,uniqueAvailableUpgrades:d}=Ys({releases:a.releases,currentVersion:r,currentDependencies:n});if(u.length===0||!u[0]?.version)return;let m=Q(u[0].version),h=Q(r),g=h===m,w=g?a.releases.findIndex(O=>Q(O.version)!==h):a.releases.findIndex(O=>Q(O.version)===h),v;if(w===-1){let O=a.releases.findIndex(k=>ve.default.lte(Q(k.version),h));v=O===-1?a.releases:a.releases.slice(0,O)}else v=a.releases.slice(0,w);let S=Object.values([...v].reverse().reduce((O,k)=>(O[k.version]??=`${k.version} - ${k.title}`,O),{})).reverse().slice(0,5),E=Object.keys(d).length>1?`There are ${Object.keys(d).length} new @shopify/hydrogen versions available.`:"There's a new @shopify/hydrogen version available.",x=await oe();ee({headline:E,body:[`Current: ${r} | Latest: ${m}`+(g?" with updated dependencies":"")],customSections:[...S.length>0?[{title:`The next ${S.length} version(s) include`,body:[{list:{items:[...S,u.length>5?"...more":""].flat().filter(Boolean)}}].filter(Boolean)}]:[],{title:"Next steps",body:[{list:{items:[`Run \`${x} upgrade\` or \`${x} upgrade --version ${v[0]?.version??"<version>"}\``,"Read release notes at https://hydrogen.shopify.dev/releases"]}}]}]})}catch(t){let r=t;ne({headline:r.message,body:r.tryMessage??void 0})}}p();p();import Yf from"node:net";import zf from"node:os";var $n=class extends Error{constructor(t){super(`${t} is locked`)}},zt={old:new Set,young:new Set},Kf=1e3*15,Dn=1024,In=65535,gr,Jf=()=>{let e=zf.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},Ks=e=>new Promise((t,r)=>{let n=Yf.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),Js=async(e,t)=>{if(e.host||e.port===0)return Ks(e);for(let r of t)try{await Ks({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},Qf=function*(e){e&&(yield*e),yield 0};async function qo(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let i=e.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of i){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}gr===void 0&&(gr=setTimeout(()=>{gr=void 0,zt.old=zt.young,zt.young=new Set},Kf),gr.unref&&gr.unref());let n=Jf();for(let i of Qf(t))try{if(r.has(i))continue;let a=await Js({...e,port:i},n);for(;zt.old.has(a)||zt.young.has(a);){if(i!==0)throw new $n(i);a=await Js({...e,port:i},n)}return zt.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof $n))throw a}throw new Error("No available ports found")}function Qs(e,t){if(!Number.isInteger(e)||!Number.isInteger(t))throw new TypeError("`from` and `to` must be integer numbers");if(e<Dn||e>In)throw new RangeError(`'from' must be between ${Dn} and ${In}`);if(t<Dn||t>In)throw new RangeError(`'to' must be between ${Dn} and ${In}`);if(e>t)throw new RangeError("`to` must be greater than or equal to `from`");return function*(n,i){for(let a=n;a<=i;a++)yield a}(e,t)}function yr(e,t=100){return qo({port:Qs(e,e+t)})}p();var Go=new Set,Wo;function Xs({disableDepsOptimizer:e,showSuccessBanner:t,configFile:r,formatOptionsPromise:n}){return async function({optimizableDependency:a,stack:u}){let d=u.split(`
181
+ `)[0]??u,m=u.split(`
182
+ `).filter(g=>!g.includes("virtual:remix")).join(`
183
+ `),h="MiniOxygen encountered an error while running your app's entry point";if(a)if(e||!r){let g=new Hr(`${h}:
184
+
185
+ ${J.dim(d)}`,`Try adding '${J.yellow(a)}' to your Vite config in ssr.optimizeDeps.include`);g.stack=m,ot(g)}else Go.has(a)||(Go.add(a),setTimeout(()=>Go.delete(a),2e3),Zf(a,r,await n,m).then(()=>{setTimeout(()=>{V(`
186
+ Added '${J.yellow(a)}' to your Vite config in ssr.optimizeDeps.include
187
+ `)},200),clearTimeout(Wo),Wo=setTimeout(t,2e3)}).catch(g=>{clearTimeout(Wo),ot(g)}));else{let g=new Hr(h+`:
188
+
189
+ `+J.dim(d));g.stack=m,ot(g)}}}var Xf={rule:{pattern:"[$$$]",inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"include",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"optimizeDeps",stopBy:"end"},inside:{kind:"pair",stopBy:"end",has:{field:"key",regex:"ssr",stopBy:"end"}}}}}};async function Zf(e,t,r,n){let i=Ei(t).replace(/^\.m?/,""),a=await Vr(i);await ct(t,r,u=>{let m=a.parse(u).root().find(Xf);if(!m)throw new T(`The dependency '${J.yellow(e)}' needs to be optimized by Vite, but couldn't be added to the Vite config.`,`Add the following code manually to your Vite config:
190
+
191
+ `+J.yellow(`ssr: {optimizeDeps: {include: ['${e}']}}`));if(!!m.find({rule:{kind:"string_fragment",regex:`^${e}$`}})){let w=new Hr(`A dependency related to '${J.yellow(e)}' might need to be optimized by Vite but couldn't be configured automatically:
192
+
193
+ ${J.dim(n.split(`
194
+ `)[0])}`,"If your app doesn't load, check the following stack trace and try fixing the problem by adding the imported dependency to the `ssr.optimizeDeps.include` array in your Vite config file.");throw w.stack=n,w}let{start:g}=m.range();return u.slice(0,g.index+1)+`'${e}',`+u.slice(g.index+1)})}var Rn=class e extends L{static descriptionWithMarkdown=`Runs a Hydrogen storefront in a local runtime that emulates an Oxygen worker for development.
195
+
196
+ If your project is [linked](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-link) to a Hydrogen storefront, then its environment variables will be loaded with the runtime.`;static description="Runs Hydrogen storefront in an Oxygen worker for development.";static flags={...C.path,...C.entry,...Ne(C.port,{port:{default:void 0,required:!1}}),...C.codegen,"disable-virtual-routes":vr.Flags.boolean({description:"Disable rendering fallback routes when a route file doesn't exist.",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_VIRTUAL_ROUTES",default:!1}),...C.debug,...C.inspectorPort,...C.env,...C.envBranch,...C.envFile,"disable-version-check":vr.Flags.boolean({description:"Skip the version check when running `hydrogen dev`",default:!1,required:!1}),...C.customerAccountPush,...C.verbose,host:vr.Flags.boolean({description:"Expose the server to the local network",default:!1,required:!1}),"disable-deps-optimizer":vr.Flags.boolean({description:"Disable adding dependencies to Vite's `ssr.optimizeDeps.include` automatically",env:"SHOPIFY_HYDROGEN_FLAG_DISABLE_DEPS_OPTIMIZER",default:!1})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd(),n={...X(t),customerAccountPush:t["customer-account-push"],path:r,cliConfig:this.config};if(!await Yr(r))throw new T(qe);let{close:a}=await ed(n);dt(async()=>{await a()})}};async function ed({entry:e,port:t,path:r,host:n,codegen:i=!1,codegenConfigPath:a,disableVirtualRoutes:u,disableDepsOptimizer:d=!1,envBranch:m,env:h,debug:g=!1,disableVersionCheck:w=!1,inspectorPort:v,customerAccountPush:S=!1,envFile:E,cliConfig:x,verbose:O}){process.env.NODE_ENV||(process.env.NODE_ENV="development"),O&&Kr(),Jr()||Ht();let k=r??process.cwd(),P=oe(k),b=ja(k,S,E),D=b.then(({fetchRemote:ie,localVariables:ge})=>ln({root:k,envBranch:m,envHandle:h,fetchRemote:ie,localVariables:ge,envFile:E}));g&&!v&&(v=await yr(ia));let j=await Wr(k);Be&&await Me(R(k,"node_modules/.vite"));let B=Promise.resolve().then(()=>At(k)),N=await j.createServer({root:k,clearScreen:!1,cacheDir:process.env.SHOPIFY_UNIT_TEST?R(k,".vite"):void 0,customLogger:process.env.SHOPIFY_UNIT_TEST?Object.assign(j.createLogger(),{info:ie=>at("info",ie),warn:ie=>at("warn",ie),error:ie=>at("error",ie)}):void 0,server:{port:t??cr,host:n?!0:void 0,fs:Be?{allow:[k,Be]}:void 0},plugins:[{name:"hydrogen:cli",configResolved(ie){Do(ie)?.api?.registerPluginOptions({disableVirtualRoutes:u}),la(ie)?.api?.registerPluginOptions({debug:g,entry:e,envPromise:D.then(({allVariables:ge})=>ge),inspectorPort:v,logRequestLine:Da,entryPointErrorHandler:Xs({disableDepsOptimizer:d,configFile:ie.configFile,formatOptionsPromise:B,showSuccessBanner:()=>Zs({disableVirtualRoutes:u,debug:g,inspectorPort:v,finalHost:We,storefrontTitle:ht})})})},configureServer:ie=>{S&&ie.middlewares.use((ge,je,et)=>{let Ye=ge.headers.host;Ye?.includes(un.ORIGINAL)&&(ge.headers.host=Ye.replace(un.ORIGINAL,un.REBRANDED)),et()})}}]}),W=Do(N.config);if(!W)throw await N.close(),new T("Hydrogen plugin not found.","Add `hydrogen()` plugin to your Vite config.");W.api?.getPluginOptions?.();let H=(await De(k)).remixConfig,F,G=i?()=>{F?.kill(0),F=gn({rootDirectory:k,configFilePath:a,appDirectory:H?.appDirectory})}:void 0;G?.(),Be&&td(N,Be,G);let K=t??N.config.server.port??cr,[q,se]=await Promise.all([b.then(({customerAccountPush:ie,storefrontId:ge})=>ie?Fa(k,x,K,ge):void 0),P,N.listen(K)]),Re=new URL(N.resolvedUrls.local[0]??N.resolvedUrls.network[0]),We=q?.host||Re.toString()||Re.origin;va({rootDirectory:k,host:We,cliCommand:se});let{logInjectedVariables:Pt,allVariables:Ze}=await D;Pt(),console.log(""),N.printUrls(),N.bindCLIShortcuts({print:!0}),console.log(`
197
+ `);let ht=(await b).storefrontTitle;return Zs({disableVirtualRoutes:u,debug:g,inspectorPort:v,finalHost:We,storefrontTitle:ht}),w||zs({targetPath:k}),S&&$a(Ze)&&Ra(se),{getUrl:()=>We,async close(){F?.removeAllListeners("close"),F?.kill("SIGINT"),await Promise.allSettled([N.close(),q?.cleanup?.()]),N.watcher.close()}}}function Zs({disableVirtualRoutes:e,debug:t,inspectorPort:r,finalHost:n,storefrontTitle:i}){let a=[];e||a.push({body:Na(n)}),t&&r&&a.push({body:{warn:Aa(r)}}),z({body:[`View ${i?J.cyan(i):"Hydrogen"} app:`,{link:{url:n}}],customSections:a})}function td(e,t,r){e.httpServer?.once("listening",()=>{e.watcher.add(t+"hydrogen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/plugin.js"),e.watcher.add(t+"mini-oxygen/dist/vite/worker-entry.js"),e.watcher.add(t+"hydrogen-codegen/dist/esm/index.js");let n;e.watcher.on("change",async i=>{i.includes(t)&&(i.includes("/packages/hydrogen-codegen/")?r&&(r(),ee({headline:"The Hydrogen Codegen source has been modified.",body:"The codegen process has been restarted."})):(await e.restart(!0),clearTimeout(n),n=setTimeout(()=>{console.log(""),ee({headline:"The H2O Vite plugins have been modified.",body:"The Vite server has been restarted to reflect the changes."})},100)))})})}p();var jn=class e extends L{static descriptionWithMarkdown="Lists all environments available on the linked Hydrogen storefront.";static description="List the environments on your linked Hydrogen storefront.";static flags={...C.path};async run(){let{flags:t}=await this.parse(e);await rd(t)}};async function rd({path:e=process.cwd()}){let[{session:t,config:r},n]=await Promise.all([Ie(e),oe()]),i=await mt({root:e,session:t,config:r,cliCommand:n});if(!i)return;r.storefront=i;let a=await Vt(t,r.storefront.id);if(!a){Yt({session:t,storefront:r.storefront,cliCommand:n});return}let u=a.environments.findIndex(m=>m.type==="PREVIEW"),d=a.environments.splice(u,1);a.environments.push(d[0]),V(nd({environments:a.environments,storefrontTitle:r.storefront.title}).toString()),a.environments.forEach(({name:m,handle:h,branch:g,type:w,url:v})=>{Se();let S=w==="PRODUCTION"?a.productionUrl:v;V(ae`${_t(m,h,g)}`.value),S&&V(ae` ${S}`.value)}),Se()}var nd=({environments:e,storefrontTitle:t})=>Fr(e,r=>`Showing ${r.length} environments for the Hydrogen storefront ${t}`,r=>`Showing 1 environment for the Hydrogen storefront ${t}`,()=>`There are no environments for the Hydrogen storefront ${t}`);p();function od(e){return/[{}@#\s"'\\$`|;&<>()!?*\[\]]/.test(e)||/[\x00-\x1F\x7F]/.test(e)}function id(e){return od(e)?`"${e.replaceAll("\\","\\\\").replaceAll('"','\\"').replaceAll(`
198
+ `,"\\n").replaceAll("\r","\\r").replaceAll(" ","\\t")}"`:e}var Fn=class e extends L{static descriptionWithMarkdown="Pulls environment variables from the linked Hydrogen storefront and writes them to an `.env` file.";static description="Populate your .env with variables from your Hydrogen storefront.";static flags={...C.env,...C.envBranch,...C.envFile,...C.path,...C.force};async run(){let{flags:t}=await this.parse(e);await ad({...X(t)})}};async function ad({env:e,envBranch:t,path:r=process.cwd(),envFile:n,force:i}){let[{session:a,config:u},d]=await Promise.all([Ie(r),oe()]),m=await mt({root:r,session:a,config:u,cliCommand:d});if(!m)return;if(u.storefront=m,e||t){let x=(await Vt(a,u.storefront.id))?.environments||[];e?Bt(x,e):t&&(e=lr(x,t).handle)}let h=await cn(a,u.storefront.id,e);if(!h){Yt({session:a,storefront:u.storefront,cliCommand:d});return}if(!h.environmentVariables.length){V("No environment variables found.");return}let g=h.environmentVariables;if(!g.length)return;let w=J.whiteBright(n),v=A(r,n),S={};if(g.forEach(({isSecret:x,key:O,value:k})=>{S[O]=x?'""':id(k)}),await re(v)&&!i){let x=await ke(v),O=Ro(x,S);if(x===O){ee({body:`No changes to your ${w} file`});return}let k=fn(x,O);if(!await Ke({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:ae`We'll make the following changes to your ${w} file:
199
+
200
+ ${Ue.linesDiff(k)}
201
+ Continue?`.value}))return;await le(v,O)}else{let x=Ro(null,S);await le(v,x)}g.some(({isSecret:x})=>x)&&ne({body:`${u.storefront.title} contains environment variables marked as secret, so their values weren\u2019t pulled.`}),z({body:["Changes have been made to your",{filePath:w},"file"]})}p();p();var sd=`#graphql
202
+ mutation PushVariables(
203
+ $storefrontId: ID!,
204
+ $environmentId: ID!,
205
+ $environmentVariablesInput: [HydrogenStorefrontEnvironmentVariableInput!]!,
206
+ ) {
207
+ hydrogenStorefrontEnvironmentVariableBulkReplace(
208
+ storefrontId: $storefrontId,
209
+ environmentId: $environmentId,
210
+ environmentVariablesInput: $environmentVariablesInput,
211
+ ) {
212
+ userErrors {
213
+ code
214
+ message
215
+ }
216
+ }
217
+ }
218
+ `;async function ec(e,t,r,n){let{hydrogenStorefrontEnvironmentVariableBulkReplace:i}=await Lt(sd,e,{storefrontId:t,environmentId:r,environmentVariablesInput:n}),{userErrors:a}=i;return{userErrors:a}}var An=class e extends L{static description="Push environment variables from the local .env file to your linked Hydrogen storefront.";static flags={...C.env,...C.envFile,...C.path};async run(){let{flags:t}=await this.parse(e);await cd({...X(t)})}};async function cd({env:e,envFile:t,path:r=process.cwd()}){let n,i=A(r,t),{variables:a}=await an(i),[{session:u,config:d},m]=await Promise.all([Ie(r),oe()]),h=await mt({root:r,session:u,config:d,cliCommand:m});if(!h)return;d.storefront=h;let{environments:g}=await Vt(u,d.storefront.id)??{};if(!g)throw new T("Failed to fetch environments");let w=sn(g);if(w.length===0)throw new T("No environments found");if(e)n=Bt(w,e);else{let P=[...w.map(({id:D,name:j,branch:B,handle:N})=>({label:_t(j,N,B),value:D}))],b=await it({message:"Select an environment to overwrite its environment variables:",choices:P});n=w.find(({id:D})=>D===b)}let{environmentVariables:v=[]}=await cn(u,d.storefront.id,n.handle)??{},E=v.filter(({isSecret:P,readOnly:b})=>!P&&!b).sort((P,b)=>P.key.localeCompare(b.key)).map(({key:P,value:b})=>jo(P,b)).join(`
219
+ `)+`
220
+ `,x=Object.keys(a).sort((P,b)=>P.localeCompare(b)).reduce((P,b)=>{let{isSecret:D,readOnly:j}=v.find(B=>B.key===b)??{};return D||j?P:[...P,jo(b,a[b])]},[]).join(`
221
+ `)+`
222
+ `;if(!n.name)throw new T("Missing environment name");let O=v.reduce((P,{isSecret:b,readOnly:D,key:j})=>{if(!b&&!D)return P;let B=a[j],N=v.find(W=>W.key===j);return B===N?.value?P:[...P,j]},[]);if(O.length&&Z(`Variables that are read only or contain secret values cannot be pushed from the CLI: ${O.join(", ")}.
223
+ `),x===E){ee({body:"No changes to your environment variables."});return}else{let P=fn(E,x);if(!await Ke({confirmationMessage:"Yes, confirm changes",cancellationMessage:"No, make changes later",message:ae`We'll make the following changes to your environment variables for ${n.name}:
224
+
225
+ ${Ue.linesDiff(P)}
226
+ Continue?`.value}))return}if(!n.id)throw new T("Missing environment ID");let{userErrors:k}=await ec(u,d.storefront.id,n.id,Object.entries(a).map(([P,b])=>({key:P,value:b})));if(k.length)throw new T("Failed to upload and save environment variables.",k[0]?.message);z({body:`Environment variables push to ${n.name??"Preview"} was successful.`})}p();p();var Kt=fe(Te(),1);var Xe=class e extends L{static descriptionWithMarkdown="Generates a set of default routes from the starter template.";static description="Generates a standard Shopify route.";static flags={adapter:Kt.Flags.string({description:"Remix adapter used in the route. The default is `@shopify/remix-oxygen`.",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),typescript:Kt.Flags.boolean({description:"Generate TypeScript files",env:"SHOPIFY_HYDROGEN_FLAG_TYPESCRIPT"}),"locale-param":Kt.Flags.string({description:"The param name in Remix routes for the i18n locale, if any. Example: `locale` becomes ($locale).",env:"SHOPIFY_HYDROGEN_FLAG_ADAPTER"}),...C.force,...C.path};static hidden;static args={routeName:Kt.Args.string({name:"routeName",description:`The route to generate. One of ${Io.join()}.`,required:!0,options:Io,env:"SHOPIFY_HYDROGEN_ARG_ROUTE"})};async run(){let{flags:t,args:{routeName:r}}=await this.parse(e),n=t.path?A(t.path):process.cwd();await ld({...t,directory:n,routeName:r,localePrefix:t["locale-param"]})}};async function ld(e){let{routes:t}=await Sa({...e,v1RouteConvention:_a()}),r=3+t.reduce((i,a)=>Math.max(i,a.destinationRoute.length),0),n=t.filter(({operation:i})=>i!=="skipped").length;z({headline:`${n} of ${t.length} route${t.length>1?"s":""} generated`,body:{list:{items:t.map(({operation:i,destinationRoute:a})=>a.padEnd(r)+J.dim(`[${i}]`))}}})}var Nn=class extends L{static description="Shortcut for `hydrogen generate`. See `hydrogen generate --help` for more information.";static strict=!1;static hidden=!0;async run(){let[t,...r]=this.argv;if(t==="r"||t==="route")return new Xe(r,this.config).run();throw new Error(`Invalid command argument "${t}".`)}};p();var Ln=class e extends L{static description="Generates all supported standard shopify routes.";static hidden;static flags=Xe.flags;async run(){let{flags:t}=await this.parse(e);await Xe.run(["all",...Object.entries(t).map(([r,n])=>n===!0?`--${r}`:`--${r}=${n}`)])}};p();var pt=fe(Te(),1);p();import{fileURLToPath as ud}from"node:url";var wr={cli:"@shopify/cli",cliHydrogen:"@shopify/cli-hydrogen",createApp:"@shopify/create-hydrogen"};async function tc(){if(Je&&!process.env.SHOPIFY_UNIT_TEST)return;let{content:e}=await Ai(ud(import.meta.url)).catch(()=>({content:void 0})),t=e?.name,r=e?.version;if(!t||!r||!Object.values(wr).some(a=>a===t)||r.includes("next")||r.includes("experimental")||r.includes("snapshot"))return;let n=await ji(t,r);if(!n)return;let i=[{link:{label:"Hydrogen releases",url:"https://github.com/Shopify/hydrogen/releases"}}];return t===wr.cli&&i.push({link:{label:"Global CLI reference",url:"https://shopify.dev/docs/api/shopify-cli/"}}),a=>{a??=$i(),(a==="unknown"||!a)&&(a=Ii()),a==="unknown"&&(a="npm");let u=t===wr.cli?`Please install the latest Shopify CLI version with \`${a==="yarn"?`yarn global add ${wr.cli}`:`${a} install -g ${wr.cli}`}\` and try again.`:`Please use the latest version with \`${a} create @shopify/hydrogen@latest\``;return ee({headline:"Upgrade available",body:`Version ${n} of ${t} is now available.
227
+ You are currently running v${r}.
228
+
229
+ `+u,reference:i}),{currentVersion:r,newVersion:n}}}p();p();import{cp as fd}from"node:fs/promises";async function rc(e,t){let r=e.mockShop?"mock":await it({message:"Connect to Shopify",choices:[{label:"Use sample data from mock.shop (You can connect a Shopify account later)",value:"mock"},{label:"Link your Shopify account",value:"link"}],defaultValue:"mock",abortSignal:t.signal}),n=r==="link"?await xa(t):void 0,i=await en({...e,storefrontInfo:n,controller:t});if(!i)return;r==="mock"&&(i.storefrontTitle="Mock.shop");let a=on(t,i),u=n&&!n.id&&pa(n.session,n.title).then(async({storefront:F,jobId:G})=>(G&&await ha(n.session,G),F)).catch(a),d=await Zi(),m=fd(d,i.directory,{force:!0,recursive:!0,filter:F=>!/^(app(\/|$)|dist(\/|$)|node_modules(\/|$)|server\.ts$|\.shopify(\/|$))/i.test(be(d,F))}).then(()=>Xr({rootDirectory:i.directory,appDirectory:R(i.directory,"app"),typescript:!0})).catch(a),h={create:"Creating storefront",setup:`Setting up ${e.quickstart?"Quickstart ":""}project`,install:"Installing dependencies. This could take a few minutes"},g=[{title:h.create,task:async()=>{await u}},{title:h.setup,task:async()=>{await m}}],w=await oe(),v=`# The variables added in this file are only available locally in MiniOxygen.
230
+ # Run \`${w} link\` to also inject environment variables from your storefront,
231
+ # or \`${w} env pull\` to populate this file.`;m=m.then(()=>{let F=[ct(R(i.directory,"package.json"),!1,K=>(K=dd(K),K.replace(/"name": "[^"]+"/,`"name": "${xi(n?.title??i.name)}"`)))],G;return n?(F.push(fa(i.directory,n),le(R(i.directory,".env"),v)),n.id?G={id:n.id,title:n.title}:u&&F.push(u.then(K=>{G=K}))):r==="mock"&&F.push(le(R(i.directory,".env"),v+`
232
+ `+[["SESSION_SECRET","foobar"]].map(([K,q])=>`${K}="${q}"`).join(`
233
+ `)+`
234
+ `)),Promise.all(F).then(()=>{if(G)return da(i.directory,G)}).catch(a)});let{language:S,transpileProject:E}=await tn(i.directory,t,e.language);m=m.then(()=>E().catch(a)).then(()=>e.git?nn(i.directory):void 0);let{setupCss:x,cssStrategy:O}=await Pa(i.directory,t,e.styling);O&&(m=m.then(()=>x().catch(a)).then(()=>e.git?bt(i.directory,"Setup "+sr[O]):void 0));let{packageManager:k,shouldInstallDeps:P,installDeps:b}=await rn(i.directory,t,e.packageManager,e.installDeps),D={language:S,packageManager:k,cssStrategy:O,depsInstalled:!1,cliCommand:await oe("",k)};if(P){let F=m.then(async()=>{try{if(await b(),D.depsInstalled=!0,S==="ts")try{await ir("npx react-router typegen",{cwd:i.directory})}catch{Z("Failed to generate React Router types. You may need to run `npx react-router typegen` manually.")}}catch(G){D.depsError=G}});g.push({title:h.install,task:async()=>{await F}})}let{createShortcut:j,showShortcutBanner:B}=await Zr(t,D.cliCommand,e.shortcut);j&&(m=m.then(async()=>{await j()&&(D.cliCommand=wt)}),B()),e.quickstart?console.log(`
235
+ `):z({headline:[{userInput:n?.title??i.name},"is ready to build."]});let{i18nStrategy:N,setupI18n:W}=await ka(t,D.cliCommand,e.i18n),{setupRoutes:H}=Qr(t);return D.i18n=N,m=m.then(async()=>{await W({rootDirectory:i.directory,contextCreate:S==="ts"?"app/lib/context.ts":"app/lib/context.js"}).then(()=>e.git?bt(i.directory,`Setup markets support using ${N}`):void 0).catch(F=>{D.i18nError=F}),await H(i.directory,S,{i18nStrategy:N,overwriteFileDeps:!1}).then(async F=>{if(D.routes=F,S==="ts"&&D.depsInstalled)try{await ir("npx react-router typegen",{cwd:i.directory})}catch{Z("Failed to generate React Router types after route generation. You may need to run `npx react-router typegen` manually.")}if(e.git&&F)return bt(i.directory,"Generate routes for core functionality")}).catch(F=>{D.routesError=F})}),await he(g),e.git&&await bt(i.directory,"Lockfile"),await Ut(i,D),{...i,...D}}function dd(e){let t=e.match(/^\s+"@shopify\/hydrogen":\s+"[^"]+",\n/m)?.[0];if(t&&/"0\.0\.0-\w+-/.test(t)){let r=t.replace("hydrogen","cli-hydrogen");e=e.replace(t,r+t)}return e}p();import{readdir as rl}from"node:fs/promises";p();var Qc=fe(Dc(),1),Xc=fe(Jc(),1);import xt from"node:path";import{pipeline as tm}from"stream/promises";var rm="https://api.github.com/repos/shopify/hydrogen/releases/latest",Zc=e=>e===403?"If you are using a VPN, WARP, or similar service, consider disabling it momentarily.":void 0;async function nm(e){let t=await _e(rm,{signal:e});if(!t.ok||t.status>=400)throw new T(`Failed to fetch the latest release information. Status ${t.status} ${t.statusText.replace(/\.$/,"")}.`,Zc(t.status));let r=await t.json();return{version:r.name.split("/").pop()??r.name,url:r.tarball_url}}async function om(e,t,r){let n=await _e(e,{signal:r});if(!n.ok||n.status>=400)throw new T(`Failed to download the latest release files. Status ${n.status} ${n.statusText}}`,Zc(n.status));await tm(n.body,(0,Qc.default)(),(0,Xc.extract)(t,{strip:1,filter:i=>(i=i.replace(t,""),!i.startsWith(xt.normalize("/templates/"))&&!i.startsWith(xt.normalize("/examples/")))}))}async function el({signal:e}={}){if(Je&&process.env.FORCE_TEMPLATES_SOURCE!=="remote"){let t=xt.dirname(ea());return{version:"local",templatesDir:t,examplesDir:xt.resolve(t,"..","examples")}}try{let{version:t,url:r}=await nm(e),n=await yt("internal-templates");await re(n)||await nr(n);let i=xt.join(n,t);return await re(i)||await om(r,i,e),{version:t,templatesDir:xt.join(i,"templates"),examplesDir:xt.join(i,"examples")}}catch(t){let r=t;throw new T(`Could not download Hydrogen templates from GitHub.
236
+ Please check your internet connection and the following error:
237
+
238
+ `+r.message,r.tryMessage)}}async function tl(e,t){let r=La(e);if(r.isErr())throw new T(r.error.message);let n=await yt("external-templates");await re(n)||await nr(n);let i=r.value,a=R(n,i.full.replace(/^https?:\/\//,"").replace(/[^\w]+/,"_"));return await re(a)&&await So(a,{force:!0}),await Gi({repoUrl:i.full,destination:a,shallow:!0}),await So(R(a,".git"),{force:!0}),{templateDir:a}}var nl="shopify/hydrogen-demo-store";async function ol(e,t){let r=e.template==="demo-store"?nl:e.template,n=await en({...e,controller:t});if(!n)return;let i=on(t,n),a=r.includes("/")?im(r,t.signal).catch(i):am(r,t.signal).catch(i),u=await a;if(t.signal.aborted)return;let d=Promise.resolve().then(async()=>{if(t.signal.aborted)return;let{sourcePath:O}=u;await Ar(O,n.directory)}).catch(i),m=await re(R(u.sourcePath,"tsconfig.json")),{language:h,transpileProject:g}=m?await tn(n.directory,t,e.language):{language:"js",transpileProject:()=>Promise.resolve()};d=d.then(()=>g().catch(i)).then(()=>e.git?nn(n.directory):void 0);let{packageManager:w,shouldInstallDeps:v,installDeps:S}=await rn(n.directory,t,e.packageManager,e.installDeps),E={language:h,packageManager:w,depsInstalled:!1,cliCommand:await oe("",w)},x=[{title:"Downloading template",task:async()=>{await a}},{title:"Setting up project",task:async()=>{await d}}];if(v&&x.push({title:"Installing dependencies. This could take a few minutes",task:async()=>{try{await S(),E.depsInstalled=!0}catch(O){E.depsError=O}}}),!t.signal.aborted)return await he(x),e.git&&await bt(n.directory,"Lockfile"),await Ut(n,E),ee({headline:`Your project will display inventory from ${e.template.endsWith(nl)?"the Hydrogen Demo Store":"Mock.shop"}.`,body:`To connect this project to your Shopify store\u2019s inventory, update \`${n.name}/.env\` with your store ID and Storefront API key.`}),{...n,...E}}async function im(e,t){let{templateDir:r}=await tl(e,t);return{sourcePath:r}}async function am(e,t){let{templatesDir:r,examplesDir:n}=await el({signal:t}),i=R(r,"skeleton"),a=R(r,e),u=R(n,e);if(await re(a))return{skeletonPath:i,sourcePath:a};if(await re(u))return{skeletonPath:i,sourcePath:u};let d=(await Promise.all([rl(n),rl(r)]).catch(()=>[])).flat().filter(m=>m!=="skeleton"&&!m.endsWith(".md")).concat("demo-store").sort();throw new T(`Unknown value in \`--template\` flag "${e}".
239
+ Skip the flag or provide the name of a template or example in the Hydrogen repository or a URL to a git repository.`,d.length===0?"":{list:{title:"Available templates:",items:d}})}async function il(e){let t=new Mr;try{let r=e.template;return r?await ol({...e,template:r},t):await rc(e,t)}catch(r){throw t.abort(),r}}var sm={f:"force"},Gn=class e extends L{static descriptionWithMarkdown="Creates a new Hydrogen storefront.";static description="Creates a new Hydrogen storefront.";static flags={...C.force,path:pt.Flags.string({description:"The path to the directory of the new Hydrogen storefront.",env:"SHOPIFY_HYDROGEN_FLAG_PATH"}),language:pt.Flags.string({description:"Sets the template language to use. One of `js` or `ts`.",choices:Object.keys(Ea),env:"SHOPIFY_HYDROGEN_FLAG_LANGUAGE"}),template:pt.Flags.string({description:"Scaffolds project based on an existing template or example from the Hydrogen repository.",env:"SHOPIFY_HYDROGEN_FLAG_TEMPLATE"}),...C.installDeps,"mock-shop":pt.Flags.boolean({description:"Use mock.shop as the data source for the storefront.",env:"SHOPIFY_HYDROGEN_FLAG_MOCK_DATA"}),...C.styling,...C.markets,...C.shortcut,git:pt.Flags.boolean({description:"Init Git and create initial commits.",env:"SHOPIFY_HYDROGEN_FLAG_GIT",default:!0,allowNo:!0}),quickstart:pt.Flags.boolean({description:"Scaffolds a new Hydrogen project with a set of sensible defaults. Equivalent to `shopify hydrogen init --path hydrogen-quickstart --mock-shop --language js --shortcut --markets none`",env:"SHOPIFY_HYDROGEN_FLAG_QUICKSTART",default:!1}),"package-manager":pt.Flags.string({env:"SHOPIFY_HYDROGEN_FLAG_PACKAGE_MANAGER",hidden:!0,options:["npm","yarn","pnpm","unknown"]})};async run(){let{flags:t}=await this.parse(e);await cm(X(t))}};async function cm({markets:e,...t}=aa(process.argv,sm)){if(Qi(),!t.i18n&&e&&(t.i18n=e),t.i18n&&!To.includes(t.i18n))throw new T(`Invalid URL structure strategy: ${t.i18n}. Must be one of ${To.join(", ")}`);if(t.styling&&!Po.includes(t.styling))throw new T(`Invalid styling strategy: ${t.styling}. Must be one of ${Po.join(", ")}`);t.git??=!0,t.quickstart&&(t.i18n??="none",t.installDeps??=!0,t.language??="js",t.mockShop??=!0,t.path??="./hydrogen-quickstart",t.shortcut??=!0,t.styling??="none");let r=await tc();return r&&r(t.packageManager),il(t)}p();p();var lm=`#graphql
240
+ query ListStorefronts {
241
+ hydrogenStorefronts {
242
+ id
243
+ title
244
+ productionUrl
245
+ currentProductionDeployment {
246
+ id
247
+ createdAt
248
+ commitMessage
249
+ }
250
+ }
251
+ }
252
+ `;async function al(e){let{hydrogenStorefronts:t}=await Lt(lm,e);return t.map(r=>({...r,parsedId:Mt(r.id)}))}var Wn=class e extends L{static descriptionWithMarkdown="Lists all remote Hydrogen storefronts available to link to your local development environment.";static description="Returns a list of Hydrogen storefronts available on a given shop.";static flags={...C.path};async run(){let{flags:t}=await this.parse(e);await um(t)}};async function um({path:e=process.cwd()}){let{session:t}=await Ie(e),r=await al(t);r.length>0?(Se(),V(mm({storefronts:r,shop:t.storeFqdn}).toString()),r.forEach(({currentProductionDeployment:n,id:i,productionUrl:a,title:u})=>{Se(),V(ae`${J.whiteBright(u)} ${J.dim(`(id: ${Mt(i)})`)}`.value),a&&V(ae` ${J.whiteBright(a)}`.value),n&&V(ae` ${J.dim(dm(n))}`.value)})):ee({headline:"Hydrogen storefronts",body:"There are no Hydrogen storefronts on your Shop.",nextSteps:[`Ensure you are logged in to the correct shop (currently: ${t.storeFqdn})`,`Create a new Hydrogen storefront: Run \`${await oe(e)} link\` or visit ${js(t)}`]})}var fm=new Intl.DateTimeFormat("default",{year:"numeric",month:"numeric",day:"numeric"});function dm(e){let t="";if(!e)return t;if(t+=fm.format(new Date(e.createdAt)),e.commitMessage){let r=e.commitMessage.split(/\n/)[0];t+=`, ${r}`}return t}var mm=({storefronts:e,shop:t})=>Fr(e,r=>`Showing ${r.length} Hydrogen storefronts for the store ${t}`,r=>`Showing 1 Hydrogen storefront for the store ${t}`);p();var Yn=class e extends L{static descriptionWithMarkdown="Logs in to the specified shop and saves the shop domain to the project.";static description="Login to your Shopify account.";static flags={...C.path,...C.shop};async run(){let{flags:t}=await this.parse(e);await pm(t)}};async function pm({path:e=process.cwd(),shop:t}){Se(),ya(!0);let{config:r}=await Ie(e,t??!0);ba(r)}p();var zn=class e extends L{static descriptionWithMarkdown="Log out from the current shop.";static description="Logout of your local session.";static flags={...C.path};async run(){let{flags:t}=await this.parse(e);await hm(t)}};async function hm({path:e=process.cwd()}){Se(),await wa(e),z({body:"You are logged out from Shopify."})}p();var ii=fe(Te(),1);p();async function sl(e){let{startWorkerdServer:t}=await import("./workerd-ST6XJKUN.js");return t(e)}var Kn=class e extends L{static descriptionWithMarkdown="Runs a server in your local development environment that serves your Hydrogen app's production build. Requires running the [build](https://shopify.dev/docs/api/shopify-cli/hydrogen/hydrogen-build) command first.";static description="Runs a Hydrogen storefront in an Oxygen worker for production.";static flags={...C.path,...C.port,...C.env,...C.envBranch,...C.envFile,...C.inspectorPort,...C.debug,...C.verbose,build:ii.Flags.boolean({description:"Builds the app before starting the preview server."}),watch:ii.Flags.boolean({description:"Watches for changes and rebuilds the project.",dependsOn:["build"]}),...Ne(C.entry,{entry:{dependsOn:["build"]}}),...Ne(C.codegen,{codegen:{dependsOn:["build"]}})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd(),{close:n}=await gm({...X(t),directory:r});dt(async()=>{await n()})}};async function gm({port:e,directory:t,env:r,envBranch:n,inspectorPort:i,debug:a,verbose:u,build:d=!1,watch:m=!1,codegen:h=!1,codegenConfigPath:g,entry:w,envFile:v}){process.env.NODE_ENV||(process.env.NODE_ENV=m?"development":"production"),u&&Kr(),Jr()||Ht();let{root:S,buildPath:E,buildPathWorkerFile:x,buildPathClient:O}=Ve(t),k=await Nt(S);if(k)throw new T(qe);let P,b=dr(),j=d?await St({...{directory:S,entry:w,disableRouteWarning:!1,lockfileCheck:!1,sourcemap:!0,bundleStats:!1,useCodegen:h,codegenConfigPath:g},watch:m,async onServerBuildFinish(){b.state==="pending"?b.resolve():V("\u{1F3D7}\uFE0F Project rebuilt. Reloading server..."),await P?.reload()}}):b.resolve();k||(x=(await De(S).catch(()=>null))?.serverOutFile??R(E,"server","index.js"));let{shop:B,storefront:N}=await zr(S),W=!!B&&!!N?.id,{allVariables:H,logInjectedVariables:F}=await ln({root:S,fetchRemote:W,envBranch:n,envHandle:r,envFile:v});e||(e=await yr(cr));let G=await yr(e+100);return await b.promise,F(),P=await sl({root:S,appPort:e,assetsPort:G,env:H,buildPathClient:O,buildPathWorkerFile:x,inspectorPort:i,debug:a,watch:m}),P.showBanner({mode:"preview",headlinePrefix:m?"Watching for changes. ":""}),{async close(){await Promise.allSettled([P.close(),j?.close()])}}}p();var Jn=class e extends L{static description="Scaffold routes and core functionality.";static flags={...C.path,...C.force,...C.markets,...C.shortcut,...Ne(C.installDeps,{"install-deps":{default:!0}})};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd();await ym({...X(t),directory:r})}};async function ym(e){let t=new Mr,{rootDirectory:r,appDirectory:n}=await lt(e.directory),i=jt(r),a=oe(),u=Promise.resolve(),d=[{title:"Setting up project",task:async()=>{await u}}],m=e.markets?e.markets:await Gr({abortSignal:t.signal,extraChoices:{none:"Set up later"}}),h=m==="none"?void 0:m,{setupRoutes:g}=Qr(t),w,v=await Xi(".."),[S,E]=await Promise.all([re(R(r,"tsconfig.json")),or("*.d.ts",{cwd:v})]);u=u.then(()=>Promise.all([...E.map(P=>Ar(R(v,P),A(r,P))),Xr({rootDirectory:r,appDirectory:n,typescript:S})])).then(async()=>{w=await g(r,S?"ts":"js",{i18nStrategy:h,overwriteFileDeps:!0})}),h&&(u=u.then(()=>qr(h,{rootDirectory:r})));let x=await Promise.resolve(a),{createShortcut:O,showShortcutBanner:k}=await Zr(t,x,e.shortcut);!h&&!O||(O&&(u=u.then(async()=>{await O()&&(x=wt)}),k()),await he(d),await Ut({location:i,name:i,directory:r},{cliCommand:x,depsInstalled:!0,packageManager:"npm",i18n:h,routes:w}))}p();var cl=fe(Te(),1);var Qn=class e extends L{static descriptionWithMarkdown="Adds support for certain CSS strategies to your project.";static description="Setup CSS strategies for your project.";static flags={...C.path,...C.force,...Ne(C.installDeps,{"install-deps":{default:!0}})};static args={strategy:cl.Args.string({name:"strategy",description:`The CSS strategy to setup. One of ${xo.join()}`,options:xo})};async run(){let{flags:t,args:r}=await this.parse(e),n=t.path?A(t.path):process.cwd();await vm({...X(t),strategy:r.strategy,directory:n})}};async function vm({strategy:e,directory:t,force:r=!1,installDeps:n=!0}){let i=await De(t).catch(()=>null);if(!i)throw new T("No Vite config found. This command is only supported in Vite projects.");let{remixConfig:a}=i,u=e||await na();if(u==="css-modules"||u==="postcss"){z({headline:`Vite works out of the box with ${sr[u]}.`,body:`See the Vite documentation for more information:
253
+ ${Co[u]}`});return}let d=await ra(u,a,r);if(!d)return;let{workPromise:m,generatedAssets:h,needsInstallDeps:g}=d,w=[{title:"Updating files",task:async()=>{await m}}],v=!1;if(n&&g){let S=He(a.rootDirectory);w.push({title:"Installing new dependencies",task:async()=>{let E=await S;v=E==="npm"||E==="unknown",await Ft({directory:a.rootDirectory,packageManager:E,args:[]})}})}await he(w),z({headline:`${sr[u]} setup complete.`,body:(h.length>0?`You can now modify CSS configuration in the following files:
254
+ `+h.map(S=>` - ${S}`).join(`
255
+ `)+`
256
+ `:"")+`
257
+ For more information, visit ${Co[u]}`}),g&&v&&u==="tailwind"&&ne({body:[`Due to a bug in NPM, you might need to reinstall dependencies again.
258
+ Run`,{command:"npm install"}]})}p();var ll=fe(Te(),1);var Xn=class e extends L{static descriptionWithMarkdown="Adds support for multiple [markets](https://shopify.dev/docs/custom-storefronts/hydrogen/markets) to your project by using the URL structure.";static description="Setup support for multiple markets in your project.";static flags={...C.path};static args={strategy:ll.Args.string({name:"strategy",description:`The URL structure strategy to setup multiple markets. One of ${Oo.join()}`,options:Oo})};async run(){let{flags:t,args:r}=await this.parse(e),n=t.path?A(t.path):process.cwd();await wm({...X(t),strategy:r.strategy,directory:n})}};async function wm({strategy:e,directory:t}){let r=lt(t),n=e||await Gr(),i=await r;await he([{title:"Updating files",task:async()=>{await qr(n,i)}}]),z({headline:`Makerts support setup complete with strategy ${oa[n].toLocaleLowerCase()}.`,body:`You can now modify the supported locales in ${i.serverEntryPoint??"your server entry file."}
259
+ `})}p();var Zn=class e extends L{static description="EXPERIMENTAL: Upgrades the project to use Vite.";static flags={...C.path};async run(){let{flags:t}=await this.parse(e),r=t.path?A(t.path):process.cwd();await _m({...X(t),directory:r})}},bm=`export default {
260
+ plugins: {
261
+ tailwindcss: {},
262
+ autoprefixer: {},
263
+ },
264
+ };
265
+ `;async function _m({directory:e}){if(Se(),await ca(e))throw new T("This project already has a Vite config file.");let[t,r,n]=await Promise.all([sa(e),Fi(R(e,"package.json")),At(e)]),i=t.server||"server.js",a=i.endsWith(".ts"),u=a?"tsx":"jsx",d=await yt("vite"),m=!!t.tailwind,h=A(e,"postcss.config.js"),g=()=>{},w=Promise.all([Me(A(e,"remix.config.js")).catch(g),ko(A(e,"remix.env.d.ts"),A(e,"env.d.ts")).then(()=>ct(A(e,"env.d.ts"),!1,v=>v.replace('types="@remix-run/dev"','types="vite/client"'))).catch(g),ko(A(e,".eslintrc.js"),A(e,".eslintrc.cjs")).catch(g),ke(A(e,"postcss.config.js")).then(async v=>{let S=v.includes("tailwindcss"),x=v.includes("module.exports")||v.includes("exports.")||v.includes("require(")?h.replace(".js",".cjs"):h;return!S&&m&&(v=await ar(v.replace(/(plugins:\s+{)/,`$1
266
+ tailwindcss: {},`),n,x)),le(x,v)}).catch(async()=>{if(m&&!await re(h)&&!await re(h.replace(".js",".cjs")))return le(h,bm)}).catch(g),ta(d,e,{onResult(v){return v.dependencies&&delete v.dependencies["@remix-run/css-bundle"],v.devDependencies&&v.devDependencies["@vanilla-extract/css"]&&(v.devDependencies["@vanilla-extract/vite-plugin"]="^4.0.0",v.devDependencies=Object.keys(v.devDependencies).sort().reduce((S,E)=>(S[E]=v.devDependencies?.[E],S),{})),v}}),ke(A(d,"vite.config.js")).then(async v=>{r.devDependencies?.["@vanilla-extract/css"]&&(v=v.replace(/\n\n/g,`
267
+ import {vanillaExtractPlugin} from '@vanilla-extract/vite-plugin';
268
+
269
+ `).replace(/^(\s+)\],/m,`$1 vanillaExtractPlugin(),
270
+ $1],`));let{future:E,appDirectory:x,ignoredRouteFiles:O,routes:k}=t;for(let b of["v3_fetcherPersist","v3_throwAbortReason","v3_relativeSplatPath"])E?.[b]||(v=v.replace(`${b}: true`,`${b}: false`));x&&x!=="app"&&(v=v.replace(/^(\s+)(future:)/m,`$1appDirectory: '${x}',
271
+ $1$2`)),O&&(v=v.replace(/^(\s+)(future:)/m,`$1ignoredRouteFiles: ${JSON.stringify(O)},
272
+ $1$2`)),k&&(v=v.replace(/^(\s+)(future:)/m,`$1routes: ${k.toString()},
273
+ $1$2`));let P=A(e,"vite.config."+u.slice(0,2));return v=await ar(v,n,P),le(P,v)}),ct(A(e,i),!1,v=>(a?`// @ts-ignore
274
+ `:"")+v.replace("@remix-run/dev/server-build","virtual:remix/server-build")),Vr(u).then(async v=>{let S=A(e,t.appDirectory??"app"),E=R(S,"root."+u);await new Promise(async(x,O)=>{await v.findInFiles({paths:[E,R(S,"routes")],matcher:{rule:{kind:"string_fragment",regex:"\\.css$",inside:{kind:"import_statement",stopBy:"end"}}}},async(P,b)=>{P&&O(P);let D={};b.forEach(j=>{if(j.text().endsWith(".module.css"))return;let B=j.getRoot().filename(),N=j.getRoot().root().text(),W=j.range().end.index,H=D[B]||{content:N,positions:[]};H.positions.push(W),D[B]=H}),await Promise.all(Object.entries(D).flatMap(([j,{content:B,positions:N}])=>{N.reverse();for(let W of N)B=B.slice(0,W)+"?url"+B.slice(W);return le(j,B)})),x(null)})===0&&x(null)}),await ct(E,n,x=>{let O=v.parse(x).root(),k="LiveReload",P={kind:"identifier",regex:k},b=O.find({rule:{kind:"import_specifier",regex:k,inside:{kind:"import_statement",stopBy:"end"}}}),D=O.findAll({rule:{any:[{kind:"jsx_self_closing_element",has:P},{kind:"jsx_element",has:{kind:"jsx_opening_element",has:P}}]}});for(let j of[...D.reverse(),b]){if(!j)continue;let{start:B,end:N}=j.range();x=x.slice(0,B.index)+x.slice(N.index)}return x.replace(/,\s*,/g,",").replace(/import\s+{\s+cssBundleHref\s+}\s+from\s+['"]@remix-run\/css-bundle['"];?\n/,"").replace(/\.\.\.\(\s*cssBundleHref[^)]+\),?/,"")})})]);await he([{title:"Updating files",task:async()=>{await w}},{title:"Installing new dependencies",task:async()=>{await Ft({directory:e,packageManager:await He(e),args:[]})}}]),z({headline:"Your Vite project is ready!",body:`We've modified your project to use Vite.
275
+ Please use Git to review the changes.`,nextSteps:[t.mdx?"Setup MDX support in Vite: https://remix.run/docs/en/main/future/vite#add-mdx-plugin":"","See more information about Vite in Remix at https://remix.run/docs/en/main/future/vite"].filter(Boolean)})}p();var eo=class extends L{static descriptionWithMarkdown="Creates a global h2 shortcut for Shopify CLI using shell aliases.\n\n The following shells are supported:\n\n - Bash (using `~/.bashrc`)\n - ZSH (using `~/.zshrc`)\n - Fish (using `~/.config/fish/functions`)\n - PowerShell (added to `$PROFILE`)\n\n After the alias is created, you can call Shopify CLI from anywhere in your project using `h2 <command>`.";static description=`Creates a global \`${wt}\` shortcut for the Hydrogen CLI`;async run(){await Sm()}};async function Sm(){let e=await ga();e.length>0?z({headline:`Shortcut ready for the following shells: ${e.join(", ")}.
276
+ Restart your terminal session and run \`${wt}\` from your local project.`}):ot({name:"error",type:0,message:"No supported shell found.",skipOclifErrorHandling:!0,tryMessage:"Please create a shortcut manually."})}p();var to=class e extends L{static descriptionWithMarkdown="Unlinks your local development environment from a remote Hydrogen storefront.";static description="Unlink a local project from a Hydrogen storefront.";static flags={...C.path};async run(){let{flags:t}=await this.parse(e);await Em(t)}};async function Em({path:e}){let t=e??process.cwd(),{storefront:r}=await zr(t);if(!r){Z("This project isn't linked to a Hydrogen storefront.");return}let n=r.title;await ma(t),z({body:["You are no longer linked to",{bold:n}]})}p();import{createRequire as km}from"node:module";import{spawnSync as xm}from"node:child_process";var Pm=async function(e){if(!e.id?.startsWith("hydrogen:")||e.id==="hydrogen:init")return;let t=ki(),r=/^--path($|=)/,n=e.argv.findIndex(i=>r.test(i));if(n!==-1){let i=e.argv[n]?.split("=")[1]??e.argv[n+1];i&&!i.startsWith("--")&&(t=A(t,i))}if(Om(t)||(Se(),ne({headline:"Looks like you're trying to run a Hydrogen command outside of a Hydrogen project.",body:["Run",{command:"shopify hydrogen init"},"to create a new Hydrogen project or use the",{command:"--path"},`flag to specify an existing Hydrogen project.
277
+
278
+ `,{subdued:t}],reference:["Getting started: https://shopify.dev/docs/storefronts/headless/hydrogen","CLI commands: https://shopify.dev/docs/api/shopify-cli/hydrogen"]}),process.exit(1)),Cm(e.id,e.argv)&&!process.execArgv.includes(ro)&&!(process.env.NODE_OPTIONS??"").includes(ro)){Ui(`Restarting CLI process with ${ro} flag.`);let[i,...a]=process.argv;a.unshift(ro);let u=xm(i,a,{stdio:"inherit"});process.exit(u.status??1)}},ro="--experimental-vm-modules";function Cm(e="",t=[]){return e==="hydrogen:debug:cpu"}function Om(e){try{let t=km(import.meta.url),{dependencies:r,scripts:n}=t(R(e,"package.json"));return!!r?.["@shopify/hydrogen"]||!!n?.dev?.includes("--diff")}catch{return!1}}var ul=Pm;var ux={"hydrogen:dev":Rn,"hydrogen:build":vn,"hydrogen:check":wn,"hydrogen:codegen":_n,"hydrogen:deploy":Cn,"hydrogen:g":Nn,"hydrogen:init":Gn,"hydrogen:link":Ca,"hydrogen:list":Wn,"hydrogen:login":Yn,"hydrogen:logout":zn,"hydrogen:preview":Kn,"hydrogen:setup":Jn,"hydrogen:shortcut":eo,"hydrogen:unlink":to,"hydrogen:upgrade":On,"hydrogen:customer-account-push":Ta,"hydrogen:debug:cpu":Sn,"hydrogen:env:list":jn,"hydrogen:env:pull":Fn,"hydrogen:env:push":An,"hydrogen:generate:route":Xe,"hydrogen:generate:routes":Ln,"hydrogen:setup:css":Qn,"hydrogen:setup:markets":Xn,"hydrogen:setup:vite":Zn},fx={init:ul};export{ux as a,fx as b};