@shopify/cli 4.5.2 → 4.6.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 (363) hide show
  1. package/dist/analytics-6S5JVSRO.js +1 -0
  2. package/dist/analytics-E252SR3P.js +1 -0
  3. package/dist/assets/hydrogen/starter/package.json +1 -1
  4. package/dist/bootstrap.js +1 -1
  5. package/dist/{chokidar-VDIVGBZH.js → chokidar-5RWEYTNQ.js} +1 -1
  6. package/dist/{chunk-AATUQ2AY.js → chunk-2I62GKIH.js} +80 -80
  7. package/dist/{chunk-MC466GSO.js → chunk-2JFZ6GZC.js} +1 -1
  8. package/dist/{chunk-UQWFDL3F.js → chunk-2KD4LHRT.js} +1 -1
  9. package/dist/chunk-2MCH43SL.js +11 -0
  10. package/dist/{chunk-K4APB7O3.js → chunk-2SNT7U7B.js} +1 -1
  11. package/dist/{chunk-V6QZF5YS.js → chunk-2VIUGNYO.js} +1 -1
  12. package/dist/chunk-2Y6CYLKF.js +1 -0
  13. package/dist/{chunk-XHTICMA7.js → chunk-3EHRA4LA.js} +1 -1
  14. package/dist/{chunk-FSVSM57K.js → chunk-3EPQ6UOK.js} +6 -6
  15. package/dist/{chunk-7KWBVZPI.js → chunk-3NO6PWNL.js} +1 -1
  16. package/dist/chunk-3TFUSDHY.js +370 -0
  17. package/dist/{chunk-TH6CLNGO.js → chunk-46NA23I7.js} +1 -1
  18. package/dist/{chunk-YXNKDX56.js → chunk-47URTBZF.js} +1 -1
  19. package/dist/chunk-4FEBSLSU.js +1 -0
  20. package/dist/{chunk-OMXKQY2L.js → chunk-4HB4VZJQ.js} +1 -1
  21. package/dist/{chunk-ZUWEGJA7.js → chunk-4JARSKED.js} +1 -1
  22. package/dist/{chunk-NSADN5S2.js → chunk-4KZRP2JP.js} +141 -141
  23. package/dist/{chunk-TPGREOWO.js → chunk-4P7PWLUN.js} +1 -1
  24. package/dist/{chunk-UHMRDG6J.js → chunk-4YCMEC5R.js} +1 -1
  25. package/dist/{chunk-KIAMA3L2.js → chunk-53ZA2HD3.js} +1 -1
  26. package/dist/{chunk-2ACN7JIZ.js → chunk-57YF2UNT.js} +1 -1
  27. package/dist/{chunk-AAK3WGD7.js → chunk-5EFQILLF.js} +1 -1
  28. package/dist/chunk-5JPV3HPJ.js +1 -0
  29. package/dist/{chunk-2TJ6LOCC.js → chunk-5LJ5H4TD.js} +1 -1
  30. package/dist/{chunk-Z6VNPAY7.js → chunk-5Y2VD4I3.js} +1 -1
  31. package/dist/{chunk-N6IFIMC6.js → chunk-6BX62FFE.js} +1 -1
  32. package/dist/{chunk-RFOALCVH.js → chunk-6FJBCRVK.js} +1 -1
  33. package/dist/{chunk-KQTVJMV6.js → chunk-6Q5VRSRN.js} +1 -1
  34. package/dist/{chunk-GDHD3TGC.js → chunk-6QDOCBD4.js} +1 -1
  35. package/dist/{chunk-BUVP2UUA.js → chunk-6SXB44CE.js} +1 -1
  36. package/dist/chunk-6UTUJKKC.js +16 -0
  37. package/dist/{chunk-EEEKSYWV.js → chunk-6YCGMS7X.js} +15 -15
  38. package/dist/chunk-72GN655L.js +1 -0
  39. package/dist/chunk-7CPECP5P.js +1 -0
  40. package/dist/{chunk-SG5TRPJ7.js → chunk-7HAFBCL3.js} +1 -1
  41. package/dist/chunk-7XPFLQEM.js +1 -0
  42. package/dist/{chunk-HOAVZLEG.js → chunk-A3JE5LX3.js} +1 -1
  43. package/dist/{chunk-5VRU3BT5.js → chunk-AJ6VOBXU.js} +1 -1
  44. package/dist/{chunk-42RVM4EZ.js → chunk-B2WK53GH.js} +1 -1
  45. package/dist/chunk-B34VYVGV.js +1 -0
  46. package/dist/chunk-B6SY4BIK.js +2 -0
  47. package/dist/{chunk-7AYYQUJG.js → chunk-BBEHNPKK.js} +1 -1
  48. package/dist/{chunk-JADXT2DY.js → chunk-BCTMBKAU.js} +1 -1
  49. package/dist/chunk-BGUHH7AW.js +10 -0
  50. package/dist/chunk-BOAGJ6P5.js +1 -0
  51. package/dist/chunk-C256W7D2.js +26 -0
  52. package/dist/chunk-CTNBSUVU.js +83 -0
  53. package/dist/{chunk-34SINZ7L.js → chunk-CXWLHQKA.js} +1 -1
  54. package/dist/chunk-DHU767C3.js +1 -0
  55. package/dist/{chunk-CEBDKIVH.js → chunk-DKHMLETG.js} +1 -1
  56. package/dist/{chunk-L42FYXFW.js → chunk-DODCPRXT.js} +4 -4
  57. package/dist/{chunk-6VR22Z5R.js → chunk-E3RDAVJT.js} +3 -3
  58. package/dist/chunk-E3RQCWSC.js +6 -0
  59. package/dist/{chunk-HQE5B2CF.js → chunk-EBZ6MDEM.js} +1 -1
  60. package/dist/chunk-ELJ7SKMH.js +1 -0
  61. package/dist/{chunk-YNX4DT2O.js → chunk-EQTULRM7.js} +1 -1
  62. package/dist/{chunk-KFUOVO3X.js → chunk-ERCJPRN3.js} +1 -1
  63. package/dist/{chunk-5CV7GFWZ.js → chunk-ESZS7L6O.js} +1 -1
  64. package/dist/{chunk-R6A754UW.js → chunk-ET2O5DAS.js} +1 -1
  65. package/dist/chunk-EZ7EBYDT.js +684 -0
  66. package/dist/{chunk-WDSBR7KX.js → chunk-EZNJDFFK.js} +1 -1
  67. package/dist/chunk-F34LB7M4.js +20 -0
  68. package/dist/{chunk-VGSH33QU.js → chunk-FE24P4UQ.js} +1 -1
  69. package/dist/chunk-FFSDGRAN.js +1 -0
  70. package/dist/{chunk-35FS2NTM.js → chunk-FMTPUYSH.js} +1 -1
  71. package/dist/{chunk-ZAN7AZTX.js → chunk-FPWLEGKZ.js} +1 -1
  72. package/dist/{chunk-P6LVSNTT.js → chunk-FT4HLDK7.js} +1 -1
  73. package/dist/{chunk-BQARKSGG.js → chunk-G3YYMKWG.js} +1 -1
  74. package/dist/chunk-G7QW5OSQ.js +6 -0
  75. package/dist/{chunk-DIPTSBQM.js → chunk-GCDEDRY7.js} +1 -1
  76. package/dist/{chunk-3EJGRQTH.js → chunk-GEE5MXHT.js} +1 -1
  77. package/dist/{chunk-ANH2V6DJ.js → chunk-H4MYBJ6C.js} +1 -1
  78. package/dist/chunk-HDXBZLHH.js +8 -0
  79. package/dist/chunk-HSKB5OTM.js +1 -0
  80. package/dist/{chunk-I5X3IP6T.js → chunk-HT6MOPLW.js} +1 -1
  81. package/dist/chunk-HZXY7RWJ.js +19 -0
  82. package/dist/{chunk-XS7WK4YK.js → chunk-IDAWPBJM.js} +1 -1
  83. package/dist/{chunk-CX44CQFL.js → chunk-IDLDQ2JB.js} +1 -1
  84. package/dist/{chunk-HSVZU7MP.js → chunk-IKYZ5L3F.js} +1 -1
  85. package/dist/{chunk-LXOBFJZO.js → chunk-ILQXBASM.js} +1 -1
  86. package/dist/{chunk-P2SBE77Z.js → chunk-IYU72M55.js} +1 -1
  87. package/dist/{chunk-SZM6ANMN.js → chunk-J3IHP46B.js} +2 -2
  88. package/dist/{chunk-DELISRUH.js → chunk-J4KJQHNS.js} +1 -1
  89. package/dist/{chunk-PEYYIWP6.js → chunk-JHRZCUBE.js} +2 -2
  90. package/dist/chunk-JIBLEZ57.js +18 -0
  91. package/dist/{chunk-ML6SILEL.js → chunk-JIKIYMCT.js} +1 -1
  92. package/dist/{chunk-5GVE4ILZ.js → chunk-JJTGHARS.js} +1 -1
  93. package/dist/chunk-JJZNUFPD.js +44 -0
  94. package/dist/{chunk-5N7H4PJJ.js → chunk-JQP3ZCAG.js} +1 -1
  95. package/dist/{chunk-523SJVNT.js → chunk-JS3X6BDT.js} +1 -1
  96. package/dist/{chunk-XCGV3IJ5.js → chunk-K7IZMKBR.js} +1 -1
  97. package/dist/{chunk-7PVNAILK.js → chunk-KGZH4RFA.js} +1 -1
  98. package/dist/{chunk-OC5PD4ID.js → chunk-KO4FB4QU.js} +1 -1
  99. package/dist/chunk-KPRKIZ5M.js +3 -0
  100. package/dist/chunk-KUN74JD4.js +4 -0
  101. package/dist/chunk-KURWC4A5.js +16 -0
  102. package/dist/{chunk-XDV4PRFT.js → chunk-L3D2CASO.js} +1 -1
  103. package/dist/{chunk-4UJNCOE6.js → chunk-L7DZTIHJ.js} +1 -1
  104. package/dist/{chunk-UW6YEKST.js → chunk-LBDAYBIF.js} +1 -1
  105. package/dist/{chunk-ZG7BVVT2.js → chunk-LD6ZCTZ3.js} +1 -1
  106. package/dist/{chunk-UMB4BWCK.js → chunk-LH3RIIOB.js} +1 -1
  107. package/dist/{chunk-LSCDB36D.js → chunk-LWRDNTAD.js} +1 -1
  108. package/dist/{chunk-NYG2VQFQ.js → chunk-LWWBU7ET.js} +1 -1
  109. package/dist/chunk-M4BEPPA3.js +1 -0
  110. package/dist/chunk-M4YPMHIM.js +1 -0
  111. package/dist/{chunk-75DBVSVI.js → chunk-M5KKLAM6.js} +1 -1
  112. package/dist/{chunk-T35C6NC7.js → chunk-MBLHXPGK.js} +1 -1
  113. package/dist/{chunk-ODSMT2ZC.js → chunk-MDHJJVXA.js} +1 -1
  114. package/dist/{chunk-ICRQZAXP.js → chunk-MDXSLAIC.js} +1 -1
  115. package/dist/{chunk-SH6Q5CLM.js → chunk-NA2ERJIJ.js} +1 -1
  116. package/dist/chunk-NOKCVDYD.js +317 -0
  117. package/dist/chunk-O6XSWAP2.js +4 -0
  118. package/dist/{chunk-6AWRW3GS.js → chunk-OB62WVZ5.js} +1 -1
  119. package/dist/{chunk-RTINXD5Z.js → chunk-OT52JOML.js} +1 -1
  120. package/dist/chunk-OTT73YUA.js +5 -0
  121. package/dist/{chunk-AUAUAK6P.js → chunk-OUUOML3D.js} +1 -1
  122. package/dist/{chunk-6ZWMXMNM.js → chunk-P7XC5HS2.js} +1 -1
  123. package/dist/{chunk-JOKLZMTP.js → chunk-PALG4SNB.js} +1 -1
  124. package/dist/{chunk-OJZT3NA2.js → chunk-PB37BTPE.js} +1 -1
  125. package/dist/{chunk-KPNNGJAW.js → chunk-PWYRKTJ4.js} +1 -1
  126. package/dist/{chunk-WN5VTUWJ.js → chunk-PXSX63RF.js} +1 -1
  127. package/dist/{chunk-23LZNWB5.js → chunk-QDPDB5EP.js} +1 -1
  128. package/dist/{chunk-VJQJ5PTQ.js → chunk-QG7TELFC.js} +1 -1
  129. package/dist/{chunk-TM44Z7U7.js → chunk-QU5NL2QT.js} +1 -1
  130. package/dist/{chunk-3OCR7P3S.js → chunk-QV53BSQP.js} +1 -1
  131. package/dist/{chunk-P7OSUECN.js → chunk-QXXA2EQY.js} +1 -1
  132. package/dist/{chunk-XUAAQI5N.js → chunk-QZ5FMWZS.js} +1 -1
  133. package/dist/chunk-R26GJEH3.js +1 -0
  134. package/dist/{chunk-VCWESQBC.js → chunk-RTW4RZWH.js} +2 -2
  135. package/dist/{chunk-UVIGXZMV.js → chunk-SEV3S3WH.js} +1 -1
  136. package/dist/{chunk-NIVGP4LB.js → chunk-TAFOSPBW.js} +1 -1
  137. package/dist/{chunk-Q7DSLGTN.js → chunk-TAV2ENJY.js} +1 -1
  138. package/dist/{chunk-LVLDPYH5.js → chunk-TQNALMQH.js} +1 -1
  139. package/dist/chunk-TR4OWSEX.js +77 -0
  140. package/dist/{chunk-DZMXYETH.js → chunk-TUJNCWHZ.js} +1 -1
  141. package/dist/{chunk-TSEPNC3O.js → chunk-U564K7SX.js} +1 -1
  142. package/dist/chunk-UKQ7NE5V.js +1 -0
  143. package/dist/{chunk-TNUY66EE.js → chunk-UM3OHLCX.js} +1 -1
  144. package/dist/{chunk-QEVGRNUE.js → chunk-V65P572N.js} +3 -3
  145. package/dist/chunk-VFIVXK53.js +2 -0
  146. package/dist/chunk-VVFPW4ZQ.js +2 -0
  147. package/dist/{chunk-YKNMNGV7.js → chunk-VYITPC34.js} +1 -1
  148. package/dist/{chunk-7AY6HLQG.js → chunk-VZKR2YFM.js} +1 -1
  149. package/dist/{chunk-YWQPSMRZ.js → chunk-W2GMKXM7.js} +1 -1
  150. package/dist/{chunk-7TQ6HVHN.js → chunk-W4X3635B.js} +1 -1
  151. package/dist/chunk-W6ST525S.js +99 -0
  152. package/dist/{chunk-BVWQZKNK.js → chunk-WEEYQX3M.js} +1 -1
  153. package/dist/{chunk-KMQE7WFZ.js → chunk-WO7LKJCJ.js} +1 -1
  154. package/dist/{chunk-DI5ZPWNA.js → chunk-WPRAJ25Z.js} +1 -1
  155. package/dist/{chunk-ZT4PUH7L.js → chunk-WR2ZQGUR.js} +1 -1
  156. package/dist/{chunk-RLB5QHWG.js → chunk-WWX265PC.js} +1 -1
  157. package/dist/chunk-XERJY4IG.js +103 -0
  158. package/dist/{chunk-EOJNSPIH.js → chunk-XGCJWCC4.js} +1 -1
  159. package/dist/{chunk-LGFOE4XL.js → chunk-XGMPC7KK.js} +1 -1
  160. package/dist/chunk-XGRVAPLR.js +7 -0
  161. package/dist/{chunk-TC3JOEMA.js → chunk-Y2PC2BBJ.js} +60 -60
  162. package/dist/{chunk-XXLGM6OZ.js → chunk-Y4QC2YVE.js} +1 -1
  163. package/dist/chunk-YNJZ2VXV.js +5 -0
  164. package/dist/chunk-Z5DDPQ26.js +3 -0
  165. package/dist/{chunk-U3MSTPZP.js → chunk-ZK7VJZ6V.js} +1 -1
  166. package/dist/{chunk-4VJ5VBSR.js → chunk-ZLT4DPHN.js} +1 -1
  167. package/dist/{chunk-6K4DVV37.js → chunk-ZOBQKNGK.js} +1 -1
  168. package/dist/chunk-ZTE46E4Z.js +153 -0
  169. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  170. package/dist/cli/commands/app/build.js +1 -1
  171. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  172. package/dist/cli/commands/app/bulk/execute.js +1 -1
  173. package/dist/cli/commands/app/bulk/status.js +1 -1
  174. package/dist/cli/commands/app/config/link.js +1 -1
  175. package/dist/cli/commands/app/config/pull.js +1 -1
  176. package/dist/cli/commands/app/config/use.js +1 -1
  177. package/dist/cli/commands/app/config/validate.js +1 -1
  178. package/dist/cli/commands/app/demo/watcher.js +1 -1
  179. package/dist/cli/commands/app/deploy.js +1 -1
  180. package/dist/cli/commands/app/dev/clean.js +1 -1
  181. package/dist/cli/commands/app/dev.js +1 -1
  182. package/dist/cli/commands/app/env/pull.js +1 -1
  183. package/dist/cli/commands/app/env/show.js +1 -1
  184. package/dist/cli/commands/app/execute.js +1 -1
  185. package/dist/cli/commands/app/function/build.js +1 -1
  186. package/dist/cli/commands/app/function/info.js +1 -1
  187. package/dist/cli/commands/app/function/replay.js +1 -1
  188. package/dist/cli/commands/app/function/run.js +1 -1
  189. package/dist/cli/commands/app/function/schema.js +1 -1
  190. package/dist/cli/commands/app/function/typegen.js +1 -1
  191. package/dist/cli/commands/app/generate/extension.js +1 -1
  192. package/dist/cli/commands/app/graphiql.js +1 -1
  193. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  194. package/dist/cli/commands/app/import-extensions.js +1 -1
  195. package/dist/cli/commands/app/info.js +1 -1
  196. package/dist/cli/commands/app/init.js +1 -1
  197. package/dist/cli/commands/app/logs.js +1 -1
  198. package/dist/cli/commands/app/release.js +1 -1
  199. package/dist/cli/commands/app/versions/list.js +1 -1
  200. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  201. package/dist/cli/commands/auth/login.js +1 -1
  202. package/dist/cli/commands/auth/logout.js +1 -1
  203. package/dist/cli/commands/cache/clear.js +1 -1
  204. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  205. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  206. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  207. package/dist/cli/commands/debug/command-flags.js +1 -1
  208. package/dist/cli/commands/doc/fetch.js +1 -1
  209. package/dist/cli/commands/doc/search.js +1 -1
  210. package/dist/cli/commands/docs/generate.js +1 -1
  211. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  212. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  213. package/dist/cli/commands/help.js +1 -1
  214. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  215. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  216. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  217. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  218. package/dist/cli/commands/notifications/generate.js +1 -1
  219. package/dist/cli/commands/notifications/list.js +1 -1
  220. package/dist/cli/commands/organization/list.js +1 -1
  221. package/dist/cli/commands/search.js +1 -1
  222. package/dist/cli/commands/theme/check.js +1 -1
  223. package/dist/cli/commands/theme/console.js +1 -1
  224. package/dist/cli/commands/theme/delete.js +1 -1
  225. package/dist/cli/commands/theme/dev.js +1 -1
  226. package/dist/cli/commands/theme/duplicate.js +1 -1
  227. package/dist/cli/commands/theme/info.js +1 -1
  228. package/dist/cli/commands/theme/init.js +1 -1
  229. package/dist/cli/commands/theme/language-server.js +1 -1
  230. package/dist/cli/commands/theme/list.js +1 -1
  231. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  232. package/dist/cli/commands/theme/open.js +1 -1
  233. package/dist/cli/commands/theme/package.js +1 -1
  234. package/dist/cli/commands/theme/preview.js +1 -1
  235. package/dist/cli/commands/theme/profile.js +1 -1
  236. package/dist/cli/commands/theme/publish.js +1 -1
  237. package/dist/cli/commands/theme/pull.js +1 -1
  238. package/dist/cli/commands/theme/push.js +1 -1
  239. package/dist/cli/commands/theme/rename.js +1 -1
  240. package/dist/cli/commands/theme/share.js +1 -1
  241. package/dist/cli/commands/upgrade.js +1 -1
  242. package/dist/cli/commands/version.js +1 -1
  243. package/dist/cli/help.js +1 -1
  244. package/dist/command-registry.js +1 -1
  245. package/dist/conf-store-N5P2ZEAD.js +1 -0
  246. package/dist/custom-oclif-loader-4ZAXX5MR.js +1 -0
  247. package/dist/deprecations-4TY4DNME.js +1 -0
  248. package/dist/dist-6ZJS4I57.js +1 -0
  249. package/dist/dist-7W2KJOYN.js +1 -0
  250. package/dist/environments-TR5WW2MD.js +1 -0
  251. package/dist/error-VJQM4MFE.js +1 -0
  252. package/dist/error-handler-IYGE3Z72.js +1 -0
  253. package/dist/{fs-B4UJTUCD.js → fs-EOQL26C3.js} +1 -1
  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/{http-proxy-node16-X2WAMUT5.js → http-proxy-node16-A6AKKRQH.js} +1 -1
  265. package/dist/index.js +15 -15
  266. package/dist/is-global-RQCPBQA3.js +1 -0
  267. package/dist/{latest-version-32HXMWJ7.js → latest-version-LDWU5F7A.js} +7 -7
  268. package/dist/lib-2BR2WN7L.js +1 -0
  269. package/dist/lib-JKLF33A7.js +1 -0
  270. package/dist/{lib-NOROGV6N.js → lib-P3APEIHY.js} +1 -1
  271. package/dist/local-TW3HCZ2S.js +1 -0
  272. package/dist/local-storage-T6FKS53K.js +1 -0
  273. package/dist/{metadata-FREAI3KR.js → metadata-TYZDEER5.js} +1 -1
  274. package/dist/{morph-QZGREMO2.js → morph-ABSWZEVT.js} +4 -4
  275. package/dist/node-package-manager-6SWUZILX.js +1 -0
  276. package/dist/notifications-system-SMHMV2UW.js +1 -0
  277. package/dist/out-53ABAVL7.js +1 -0
  278. package/dist/{output-VUR2QZPW.js → output-JG5I2TEL.js} +1 -1
  279. package/dist/system-D4Z32GDS.js +1 -0
  280. package/dist/tsconfig.tsbuildinfo +1 -1
  281. package/dist/ui-6M3XZ6MR.js +1 -0
  282. package/dist/upgrade-EKAG4IV7.js +1 -0
  283. package/dist/version-6UBWZCNS.js +1 -0
  284. package/dist/version-XRU7TEAI.js +1 -0
  285. package/dist/{workerd-KPQTFQD4.js → workerd-LXBSJULF.js} +1 -1
  286. package/oclif.manifest.json +612 -2
  287. package/package.json +11 -11
  288. package/dist/analytics-M7ZU437S.js +0 -1
  289. package/dist/analytics-ZRM4FEOE.js +0 -1
  290. package/dist/assets/dev-console/extensions/dev-console/assets/apple-touch-icon-BXMqQaSW.png +0 -0
  291. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-16x16-B6uL8SrV.png +0 -0
  292. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-32x32-CGwlpz_y.png +0 -0
  293. package/dist/assets/dev-console/extensions/dev-console/assets/favicon-ByUl89Ab.ico +0 -0
  294. package/dist/assets/dev-console/extensions/dev-console/assets/index-Bm_GpKQW.js +0 -51
  295. package/dist/assets/dev-console/extensions/dev-console/assets/index-DISeE29z.css +0 -1
  296. package/dist/assets/dev-console/extensions/dev-console/assets/site-B9Ae890R.webmanifest +0 -19
  297. package/dist/assets/dev-console/index.html +0 -21
  298. package/dist/chunk-2O22LZKV.js +0 -44
  299. package/dist/chunk-3IFZECSI.js +0 -22
  300. package/dist/chunk-4MLEL3VK.js +0 -283
  301. package/dist/chunk-4P54DKG4.js +0 -3
  302. package/dist/chunk-4ROX2TCK.js +0 -1
  303. package/dist/chunk-5C7HDTHJ.js +0 -1
  304. package/dist/chunk-5VC4XXYH.js +0 -1
  305. package/dist/chunk-7RJPTSL6.js +0 -7
  306. package/dist/chunk-ADKFAPED.js +0 -21
  307. package/dist/chunk-B5MFFERE.js +0 -1
  308. package/dist/chunk-BLSWUNOK.js +0 -16
  309. package/dist/chunk-DN3BB4IO.js +0 -103
  310. package/dist/chunk-EAOT5CK5.js +0 -2
  311. package/dist/chunk-G6BFXMOV.js +0 -2
  312. package/dist/chunk-GMAZ2BQY.js +0 -26
  313. package/dist/chunk-HYF3VJYS.js +0 -3
  314. package/dist/chunk-IIFRDOYG.js +0 -1
  315. package/dist/chunk-KB6H5LQJ.js +0 -4
  316. package/dist/chunk-LKZ7ARYS.js +0 -18
  317. package/dist/chunk-MYQTAM77.js +0 -2
  318. package/dist/chunk-NGCPVRDM.js +0 -1
  319. package/dist/chunk-NJOO5XJV.js +0 -1
  320. package/dist/chunk-NNOSZ447.js +0 -1
  321. package/dist/chunk-NVA2354A.js +0 -5
  322. package/dist/chunk-NWH3TAHK.js +0 -1
  323. package/dist/chunk-OCBGHOH2.js +0 -19
  324. package/dist/chunk-P7U6BWKN.js +0 -1
  325. package/dist/chunk-QFXJNFMI.js +0 -1
  326. package/dist/chunk-R7QYSC6T.js +0 -567
  327. package/dist/chunk-RE652L3G.js +0 -1
  328. package/dist/chunk-SSDEWKDZ.js +0 -6
  329. package/dist/chunk-T6CC5WUU.js +0 -159
  330. package/dist/chunk-TB7HFPBB.js +0 -370
  331. package/dist/chunk-TIU7MMRT.js +0 -836
  332. package/dist/chunk-TTEY5PLR.js +0 -10
  333. package/dist/chunk-U4HLIXRH.js +0 -4
  334. package/dist/chunk-UAYIFFYJ.js +0 -11
  335. package/dist/chunk-UHIP5CFI.js +0 -1
  336. package/dist/chunk-UMFVRG33.js +0 -5
  337. package/dist/chunk-WTRKTFVE.js +0 -2
  338. package/dist/chunk-X3VG75LO.js +0 -1
  339. package/dist/chunk-XSUZPWYV.js +0 -5
  340. package/dist/chunk-Z33MWGCG.js +0 -1
  341. package/dist/chunk-ZIM2G3EP.js +0 -1
  342. package/dist/chunk-ZSYMRT3S.js +0 -4
  343. package/dist/conf-store-HOA62HKK.js +0 -1
  344. package/dist/custom-oclif-loader-3AICQCNU.js +0 -1
  345. package/dist/deprecations-2FTB7JEW.js +0 -1
  346. package/dist/dist-63JMGNUL.js +0 -1
  347. package/dist/dist-6TY6L7OW.js +0 -1
  348. package/dist/environments-XVYTKHRZ.js +0 -1
  349. package/dist/error-SDU6RPQQ.js +0 -1
  350. package/dist/error-handler-4YEBBCUH.js +0 -1
  351. package/dist/is-global-5LFZDDNH.js +0 -1
  352. package/dist/lib-QJDPPAWN.js +0 -1
  353. package/dist/lib-UCG2DNMS.js +0 -1
  354. package/dist/local-VTYGIJVD.js +0 -1
  355. package/dist/local-storage-A6NBLBB2.js +0 -1
  356. package/dist/node-package-manager-N5SUT2WN.js +0 -1
  357. package/dist/notifications-system-P3SUTD25.js +0 -1
  358. package/dist/out-CDCY25QC.js +0 -1
  359. package/dist/system-OXF2P5CT.js +0 -1
  360. package/dist/ui-N2C5FC3G.js +0 -1
  361. package/dist/upgrade-AJ36IT7H.js +0 -1
  362. package/dist/version-DSFP332V.js +0 -1
  363. package/dist/version-HUOO3XOE.js +0 -1
@@ -1,3 +0,0 @@
1
- import{a as ce}from"./chunk-LXOBFJZO.js";import{G as L,O as $,va as te,xa as N,ya as re,z as y}from"./chunk-TIU7MMRT.js";import{b as x}from"./chunk-QEVGRNUE.js";import{a as me,b as ue}from"./chunk-UAYIFFYJ.js";import{a as ee}from"./chunk-5C7HDTHJ.js";import{A as ie,a as Z,t as se,w as U,x as I}from"./chunk-EEEKSYWV.js";import{d as oe,e as ne}from"./chunk-7AY6HLQG.js";import{d as F,g as ae}from"./chunk-IIFRDOYG.js";import{Fa as X,Fb as R,Hb as h,Pb as A,Ua as _}from"./chunk-TB7HFPBB.js";import{d as Q,f as k,i as V,q as P}from"./chunk-773TIA5M.js";import{r as xe}from"./chunk-T6CC5WUU.js";import{e as ve,g as f}from"./chunk-VKWPEFWQ.js";f();var T=ve(xe(),1);var q={path:T.Flags.string({description:"The path where you want to run the command. Defaults to the current working directory.",env:"SHOPIFY_FLAG_PATH",parse:async t=>{let e=k(t);return _(e)?X(e)?e:(I({headline:"The path must be a directory, not a file.",body:[`The provided path is not a directory: ${e}`,`Did you mean: ${V(e)}`]}),process.exit(1)):(I({headline:"A path was explicitly provided but doesn't exist.",body:[`Please check the path and try again: ${e}`]}),process.exit(1))},default:async()=>P(),noCacheDefault:!0}),password:T.Flags.string({description:"Password generated from the Theme Access app or an Admin API token.",env:"SHOPIFY_CLI_THEME_TOKEN"}),store:T.Flags.string({char:"s",description:"Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).",env:"SHOPIFY_FLAG_STORE",parse:async t=>y(t)}),environment:T.Flags.string({char:"e",description:"The environment to apply to the current command.",env:"SHOPIFY_FLAG_ENVIRONMENT",multiple:!0})},de="Wrap the value in double quotes if you're using wildcards.",Ne=t=>({only:T.Flags.string({char:"o",multiple:!0,description:`${t.charAt(0).toUpperCase()+t.slice(1)} only the specified files (Multiple flags allowed). ${de}`,env:"SHOPIFY_FLAG_ONLY"}),ignore:T.Flags.string({char:"x",multiple:!0,description:`Skip ${t}ing the specified files (Multiple flags allowed). ${de}`,env:"SHOPIFY_FLAG_IGNORE"})});f();f();import{AsyncLocalStorage as Te}from"node:async_hooks";var pe=new Te,O,j,D,M;function l(){return O??(O=new x({projectName:"shopify-cli-theme-conf"})),O}function B(){return j??(j=new x({projectName:"shopify-cli-development-theme-config"})),j}function G(){return D??(D=new x({projectName:"shopify-cli-repl-theme-config"})),D}function H(){return M??(M=new x({projectName:"shopify-cli-theme-store-password"})),M}function z(t=l()){return pe.getStore()?.store??t.get("themeStore")}function fe(t,e=l()){e.set("themeStore",t)}function Me(t=l()){return A(h`Getting development theme...`),B().get(v(t))}function Be(t,e=l()){A(h`Setting development theme...`),B().set(v(e),t)}function Ge(t=l()){A(h`Removing development theme...`),B().delete(v(t))}function He(t=l()){return A(h`Getting REPL theme...`),G().get(v(t))}function ze(t,e=l()){A(h`Setting REPL theme to ${t}...`),G().set(v(e),t)}function Ye(t=l()){A(h`Removing REPL theme...`),G().delete(v(t))}function Je(t=l()){let e=v(t);return A(h`Getting storefront password for shop ${e}...`),H().get(e)}function We(t,e=l()){let o=v(e);A(h`Setting storefront password for shop ${o}...`),H().set(o,t)}function Ke(t=l()){let e=v(t);A(h`Removing storefront password for ${e}...`),H().delete(e)}function v(t=l()){let e=z(t);if(!e)throw new ae("Theme store is not set. This indicates an unexpected issue with the CLI. Please report this to the Shopify CLI team.",["It may be possible to recover by running",{command:"shopify theme list --store <store>"},"(setting the store flag to the store you wish to use) and then running the command again."]);return e}async function he(t,e){return pe.run({store:t},e)}function le(t){let e=t.store??z();if(!e)throw te(new F("A store is required",`Specify the store passing ${h`${R.genericShellCommand(`--${q.store.name}=example.myshopify.com`)}`.value} or set the ${h`${R.genericShellCommand(q.store.env)}`.value} environment variable.`));return fe(e),e}f();f();var Se="shopify.theme.toml",st=new Intl.DateTimeFormat(void 0,{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),it=["**/.git","**/.vscode","**/.hg","**/.bzr","**/.svn","**/_darcs","**/CVS","**/*.sublime-(project|workspace)","**/.DS_Store","**/.sass-cache","**/Thumbs.db","**/desktop.ini","**/config.yml","**/node_modules/",".prettierrc.json","**/{blocks,layout,snippets}/**/*.liquid.tmp.*","**/{config,locales}/**/*.json.tmp.*","**/{sections,templates}/**/*.{liquid,json}.tmp.*"],at=50;f();f();var Y="7e9cb568cfd431c538f36d1ad3f2b4f6";var Ie="shopify-cli-store",St=240*1e3,J;function C(){return J??(J=new x({projectName:Ie})),J}function E(t){return`${Y}::${_e(t)}`}function _e(t){return t.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function d(t){return typeof t=="string"}function Fe(t){if(!t||typeof t!="object")return;let e=t;if(typeof e.id=="number")return{id:e.id,...d(e.email)?{email:e.email}:{},...d(e.firstName)?{firstName:e.firstName}:{},...d(e.lastName)?{lastName:e.lastName}:{},...typeof e.accountOwner=="boolean"?{accountOwner:e.accountOwner}:{}}}function Ee(t){if(!t||typeof t!="object")return;let e=t;if(!(!d(e.shopId)||!d(e.name)||!d(e.createdAt)))return{shopId:e.shopId,name:e.name,createdAt:e.createdAt,...d(e.placeholderAccountUuid)?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...d(e.country)?{country:e.country}:{},...d(e.accessUrl)?{accessUrl:e.accessUrl}:{}}}function be(t){if(!t||typeof t!="object")return;let e=t;if(!d(e.store)||!d(e.clientId)||!d(e.userId)||!d(e.accessToken)||!Array.isArray(e.scopes)||!e.scopes.every(d)||!d(e.acquiredAt))return;let o=Fe(e.associatedUser),r=e.kind==="preview"?"preview":"standard",n=r==="preview"?Ee(e.preview):void 0;if(!(r==="preview"&&!n))return{store:e.store,clientId:e.clientId,userId:e.userId,accessToken:e.accessToken,scopes:e.scopes,acquiredAt:e.acquiredAt,...d(e.refreshToken)?{refreshToken:e.refreshToken}:{},...d(e.expiresAt)?{expiresAt:e.expiresAt}:{},...d(e.refreshTokenExpiresAt)?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function ge(t,e,o){if(!e||typeof e!="object")return;let{sessionsByUserId:r,currentUserId:n}=e;if(!(r!==void 0||n!==void 0))return;let i=E(t);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(i);return}let a=Object.fromEntries(Object.entries(r).flatMap(([m,c])=>{let p=be(c);return p?[[m,p]]:[]}));if(Object.keys(a).length!==Object.keys(r).length)if(a[n])o.set(i,{currentUserId:n,sessionsByUserId:a});else{o.delete(i);return}return{currentUserId:n,sessionsByUserId:a}}function W(t,e){return ge(t,e.get(E(t)),e)}function ke(t){return t.config?.store??{}}function ye(t=C()){let e=[],o=`${Y}::`;for(let[r,n]of Object.entries(ke(t))){if(!r.startsWith(o))continue;let s=ge(r.slice(o.length),n,t),i=s?.sessionsByUserId[s.currentUserId];i&&e.push(i)}return e}function we(t,e=C()){let o=y(t),r=W(o,e);if(!r)return;let n=r.sessionsByUserId[r.currentUserId];if(!n){e.delete(E(o));return}return n}function gt(t,e=C()){let o=E(t.store),r=W(t.store,e),n={currentUserId:t.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[t.userId]:t}};e.set(o,n)}function yt(t,e,o){let r=y(t),n=typeof e=="string"?e:void 0,s=(typeof e=="string"?o:e)??C(),i=E(r);if(!n){s.delete(i);return}let a=W(r,s);if(!a)return;let{[n]:m,...c}=a.sessionsByUserId,p=Object.keys(c);if(p.length===0){s.delete(i);return}s.set(i,{currentUserId:a.currentUserId===n?p[0]:a.currentUserId,sessionsByUserId:c})}var K=class extends ue{environmentsFilename(){return Se}async command(e,o,r=!1,n,s){}async run(e){let o=this.constructor,r=o.multiEnvironmentsFlags,{args:n,flags:s}=await this.parse(o),i="password"in o.flags,a=(Array.isArray(s.environment)?s.environment:[s.environment]).filter(Boolean),m=r!==null&&r.some(u=>Array.isArray(u)?u.includes("store"):u==="store");if(a.length<=1){if(a[0]&&!s.store&&m)throw new F("Please provide a valid environment.");let u=i?await this.createSession(s):void 0,w=this.constructor.name.toLowerCase();if(N(`theme-command:${w}:single-env:authenticated`),s.path&&!_(s.path))throw new F(`Path does not exist: ${s.path}`);try{await this.command(s,u,!1,n)}finally{await this.logAnalyticsData(u)}return}if(r===null){U({body:"This command does not support multiple environments."});return}let{flags:c}=await this.parse(me(o),this.argv);if("path"in c){this.errorOnGlobalPath();return}let p=await this.loadEnvironments(a,s,c),S=await this.validateEnvironments(p,r,i);"force"in o.flags&&!s.force&&!await this.showConfirmation(this.constructor.name,r,S)||await this.runConcurrent(S.valid)}storeAuthScopes(){return[]}async loadEnvironments(e,o,r){let n=new Map;for(let s of e){let i=await ce(s,"shopify.theme.toml",{from:o.path,silent:!0});i?.store&&typeof i.store=="string"&&(i.store=y(i.store)),i?.path&&typeof i.path=="string"&&(i.path=k(i.path)),n.set(s,{flags:{...o,...i,...r,environment:[s]},validationFlags:{...i,...r}})}return n}async validateEnvironments(e,o,r){let n=[],s=[],i=r?this.storeAuthSessionsForTheme(Array.from(e.values()).map(({validationFlags:m})=>m)):new Map,a=Array.from(e.entries()).map(([m,{flags:c,validationFlags:p}])=>({environmentName:m,flags:c,validationFlags:p,storeAuthSession:this.storeAuthSessionFromCache(p,i)}));for(let{environmentName:m,flags:c,validationFlags:p,storeAuthSession:S}of a){let g=this.validConfig(p,o,m,S);if(g!==!0){let u=g.join(", ");s.push({environment:m,reason:`Missing flags: ${u}`});continue}n.push({environment:m,flags:c,requiresAuth:r,storeAuthSession:S})}return{valid:n,invalid:s}}async showConfirmation(e,o,r){let i={message:[`Run ${e.toLowerCase()} in the following environments?`],confirmationMessage:"Yes, proceed",cancellationMessage:"Cancel"},a=[...r.valid.map(({environment:m,flags:c})=>{let p=o.map(S=>{let g=Array.isArray(S)?S.find(u=>c[u]):S;if(g==="password")return"password";if(g==="path"&&typeof c.path=="string"){let u=c.path.split(/[/\\]/);if(u.length===1)return`path: ${c.path}`;let w=u[0]===""?`/${u[1]}`:u[0],b=u.at(-1);return`path: ${w}/.../${b}`}return g&&`${g}: ${c[g]}`}).join(", ");return[m,{subdued:p||"No flags required"}]}),...r.invalid.map(({environment:m,reason:c})=>[m,{error:`Skipping | ${c}`}])];return i.infoTable={Environment:a},r.invalid.length>0&&(i.confirmationMessage="Proceed anyway (will skip invalid environments)"),ie(i)}async runConcurrent(e){let o=new Z,r=e.map(i=>i.flags.store),n=new Set(r),s=r.length===n.size?[e]:this.createSequentialGroups(e);for(let i of s)await se({processes:i.map(({environment:a,flags:m,requiresAuth:c,storeAuthSession:p})=>({prefix:a,action:async(S,g,u)=>{try{let w=m.store;await he(w,async()=>{let b=c?await this.createSession(m,p):void 0,Ae=this.constructor.name.toLowerCase();N(`theme-command:${Ae}:multi-env:authenticated`);try{await this.command(m,b,!0,{},{stdout:S,stderr:g})}finally{await this.logAnalyticsData(b)}})}catch(w){w instanceof Error&&(w.message=`Environment ${a} failed:
2
-
3
- ${w.message}`,I({body:[w.message]}))}}})),abortSignal:o.signal,showTimestamps:!0,renderOptions:{stdout:process.stderr}})}createSequentialGroups(e){let o=[];return e.forEach(r=>{let n=o.find(s=>!s.some(i=>i.flags.store===r.flags.store));n?n.push(r):o.push([r])}),o}async createSession(e,o){let r=le({store:e.store}),n=e.password;return n?await $(r,n):o??await this.storeAuthSessionForTheme({store:r})??await $(r,n)}async storeAuthSessionForTheme(e){let o=typeof e.store=="string"?e.store:void 0,r=e.password;if(!o||r)return;let n=y(o),s=we(n);if(s)return this.adminSessionFromStoreAuthSession(s,n)}storeAuthSessionsForTheme(e){let o=new Set(e.filter(({store:r,password:n})=>typeof r=="string"&&!n).map(({store:r})=>y(r)));return o.size===0?new Map:new Map(ye().map(r=>{let n=y(r.store);if(!o.has(n))return;let s=this.adminSessionFromStoreAuthSession(r,n);return s?[n,s]:void 0}).filter(r=>r!==void 0))}storeAuthSessionFromCache(e,o){let r=typeof e.store=="string"?e.store:void 0,n=e.password;if(!(!r||n))return o.get(y(r))}adminSessionFromStoreAuthSession(e,o){if(this.hasRequiredStoreAuthScopes(e.scopes))return L(e.userId),{token:e.accessToken,storeFqdn:o}}expandImpliedStoreAuthScopes(e){let o=new Set(e);for(let r of e){let n=r.match(/^(unauthenticated_)?write_(.*)$/);n&&o.add(`${n[1]??""}read_${n[2]}`)}return o}hasRequiredStoreAuthScopes(e){if(e.length===0)return!0;let o=this.expandImpliedStoreAuthScopes(e);return this.storeAuthScopes().every(r=>o.has(r))}validConfig(e,o,r,n){let s=o.filter(i=>Array.isArray(i)?!i.some(a=>this.hasRequiredFlag(e,a,n)):!this.hasRequiredFlag(e,i,n)).map(i=>Array.isArray(i)?i.join(" or "):i);return s.length>0?(U({body:[`Missing required flags in environment configuration${r?` for ${r}`:""}:`,{list:{items:s}}]}),s):!0}hasRequiredFlag(e,o,r){return o==="password"&&r?!0:!!e[o]}errorOnGlobalPath(){let e=Q(P(),"shopify.theme.toml"),o=_(e);I({body:["Can't use `--path` flag with multiple environments.",...o?["Configure each environment's theme path in your shopify.theme.toml file instead."]:["Run this command from the directory containing shopify.theme.toml.","No shopify.theme.toml found in current directory."]]})}async logAnalyticsData(e){if(!e)return;let o=re();await oe(()=>({store_fqdn_hash:ee(e.storeFqdn),store_domain:e.storeFqdn,cmd_theme_timings:JSON.stringify(o.timings),cmd_theme_errors:JSON.stringify(o.errors),cmd_theme_retries:JSON.stringify(o.retries),cmd_theme_events:JSON.stringify(o.events)})),await ne(()=>({store_fqdn:e.storeFqdn}))}};export{Y as a,ye as b,we as c,gt as d,yt as e,z as f,Me as g,Be as h,Ge as i,He as j,ze as k,Ye as l,Je as m,We as n,Ke as o,q as p,Ne as q,le as r,st as s,it as t,at as u,K as v};
@@ -1 +0,0 @@
1
- import{f as o}from"./chunk-R7QYSC6T.js";import{b as r}from"./chunk-UAYIFFYJ.js";import{g as n}from"./chunk-VKWPEFWQ.js";n();var e=class extends r{environmentsFilename(){return o.appEnvironments}};export{e as a};
@@ -1 +0,0 @@
1
- import{g as r}from"./chunk-VKWPEFWQ.js";r();import t from"crypto";function o(e){return t.createHash("sha1").update(e).digest("hex")}function c(e){return t.createHash("md5").update(e).digest("hex")}function d(){return t.randomUUID()}function p(e){return t.createHash("sha1").update(Buffer.from("6ba7b810-9dad-11d1-80b4-00c04fd430c8".replace(/-/g,""),"hex")).update(e).digest().toString("hex").replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/,"$1-$2-$3-$4-$5")}export{o as a,c as b,d as c,p as d};
@@ -1 +0,0 @@
1
- import{a as s}from"./chunk-DZMXYETH.js";import{g as r,h,i as n}from"./chunk-4P54DKG4.js";import{d as m}from"./chunk-IIFRDOYG.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var c=t=>`Development theme #${t} could not be found. Please create a new development theme.`,i="No development theme ID has been set. Please create a development theme first.",p=class extends s{constructor(e){super(e),this.context="Development",this.themeId=r()}async find(){let e=await this.fetch();if(!e)throw new m(this.themeId?c(this.themeId):i);return e}setTheme(e){h(e)}removeTheme(){n()}};export{p as a};
@@ -1,7 +0,0 @@
1
- import{C as s,u as e,v as o,w as n,x as i,y as t}from"./chunk-EEEKSYWV.js";import{d,g as l}from"./chunk-IIFRDOYG.js";import{g as r}from"./chunk-VKWPEFWQ.js";r();async function u(){e({headline:"CLI update available.",body:["Run",{command:"npm run shopify upgrade"},{char:"."}]}),e({headline:["To connect this project to your shopify store cd into:",{filePath:"/my-store/hydrogen.config.js"},{char:"."}],body:["You can also try the following steps:",{list:{items:[["Run",{command:"shopify project connect"}],["Run",{command:"hydrogen start"}]]}}]}),e({headline:"About your app.",customSections:[{body:{tabularData:[["Configuration file",{filePath:"shopify.app.scalable-transaction-app.toml"}],["App name",{userInput:"scalable-transaction-app"}],["Access scopes","read_products,write_products"]],firstColumnSubdued:!0}}]}),e({headline:[{userInput:"my-app"},"initialized and ready to build."],nextSteps:[["Run",{command:"cd verification-app"}],["To preview your project, run",{command:"npm app dev"}],["To add extensions, run",{command:"npm generate extension"}]],reference:[["Run",{command:"npm shopify help"}],{link:{label:"Dev docs",url:"https://shopify.dev"}}],customSections:[{title:"Custom section",body:{list:{items:[{link:{label:"Item 1",url:"https://shopify.com"}},"Item 2",{link:{url:"https://community.shopify.com/"}}]}}},{title:"Custom section 2",body:{list:{items:["Item 1","Item 2","Item 3"]}}}]}),o({headline:"CLI updated.",body:"You are now running version 3.47."}),o({headline:"Deployment successful.",body:"Your extensions have been uploaded to your Shopify Partners Dashboard.",nextSteps:[{link:{label:"See your deployment and set it live",url:"https://partners.shopify.com/1797046/apps/4523695/deployments"}}]}),n({headline:"You have reached your limit of checkout extensions for this app.",body:"You can free up space for a new one by deleting an existing one."}),n({headline:"Required access scope update.",body:"The deadline for re-selecting your app scopes is May 1, 2022.",reference:[{link:{label:"Dev docs",url:"https://shopify.dev/app/scopes"}}]});let a=new l("Something went wrong.");a.stack=`
2
- Error: Unexpected error
3
- at Module._compile (internal/modules/cjs/loader.js:1137:30)
4
- at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
5
- at Module.load (internal/modules/cjs/loader.js:985:32)
6
- at Function.Module._load (internal/modules/cjs/loader.js:878:14)
7
- `,t(a);let c=[["Have you",{link:{label:"created a Shopify Partners organization",url:"https://partners.shopify.com/signup"}},{char:"?"}],"Have you confirmed your accounts from the emails you received?",["Need to connect to a different App or organization? Run the command again with",{command:"--reset"}]];t(new d("No Organization found",void 0,c)),i({headline:"Version couldn't be released.",body:"This version needs to be submitted for review and approved by Shopify before it can be released."}),s({rows:[{id:"1",name:"John Doe",email:"jon@doe.com"},{id:"2",name:"Jane Doe",email:"jane@doe.com"},{id:"3",name:"John Smith",email:"jon@smith.com"}],columns:{id:{header:"ID",color:"red"},name:{header:"Name",color:"dim"},email:{}}})}export{u as a};
@@ -1,21 +0,0 @@
1
- import{a as qr}from"./chunk-P2SBE77Z.js";import{a as Mt}from"./chunk-UOHNRH6E.js";import{a as Ir}from"./chunk-UVIGXZMV.js";import{a as Lr}from"./chunk-2TJ6LOCC.js";import{a as Mr}from"./chunk-XDV4PRFT.js";import{a as kr}from"./chunk-DIPTSBQM.js";import{a as Dr}from"./chunk-7AYYQUJG.js";import{b as Fr}from"./chunk-BQARKSGG.js";import{a as Or}from"./chunk-WDSBR7KX.js";import{a as Nr}from"./chunk-OJZT3NA2.js";import{a as Pr}from"./chunk-HOAVZLEG.js";import{a as Er}from"./chunk-GMAZ2BQY.js";import{a as br}from"./chunk-ZUWEGJA7.js";import{a as Sr}from"./chunk-KPNNGJAW.js";import{a as Ur}from"./chunk-UMB4BWCK.js";import{a as Rr}from"./chunk-MC466GSO.js";import{a as Tr,b as Ar,c as _r,d as Cr}from"./chunk-6ZWMXMNM.js";import{a as $r}from"./chunk-5GVE4ILZ.js";import{g as xr}from"./chunk-DN3BB4IO.js";import{a as Lo,b as ko}from"./chunk-QFXJNFMI.js";import{a as gr}from"./chunk-OCBGHOH2.js";import{a as vr}from"./chunk-P7OSUECN.js";import{a as gt}from"./chunk-KQTVJMV6.js";import{a as yr}from"./chunk-DZMXYETH.js";import{c as ht,m as wt}from"./chunk-HSVZU7MP.js";import{b as wr,g as je,j as ft}from"./chunk-I5X3IP6T.js";import{c as Yo}from"./chunk-KB6H5LQJ.js";import{a as fr,b as hr,c as Ye,d as Co,e as Pt,f as Io,g as Do}from"./chunk-YWQPSMRZ.js";import{a as O,b as mt}from"./chunk-KFUOVO3X.js";import{a as cr,b as lr,d as Ee,f as pr,m as Ge,n as ee,s as W,u as ur,v as dr,w as mr}from"./chunk-Q7BOSHWX.js";import{c as Wr}from"./chunk-DI5ZPWNA.js";import{a as ir}from"./chunk-PEYYIWP6.js";import{a as bo,b as vt,c as te,d as So}from"./chunk-VCWESQBC.js";import{a as $o,f as Mo,g as Fo,h as xt,i as Oo,j as No,k as qo,l as Wo,m as Ho,n as Bo,o as Go,p as jo,q as Ko,v as zo,x as Vo,z as Et}from"./chunk-XCGV3IJ5.js";import{a as Uo,b as Ro,c as To,d as Ao,e as _o}from"./chunk-ICRQZAXP.js";import{a as Br}from"./chunk-AAK3WGD7.js";import{a as Eo}from"./chunk-RE652L3G.js";import{a as xo}from"./chunk-UHIP5CFI.js";import{a as Hr}from"./chunk-VJQJ5PTQ.js";import{a as Qe}from"./chunk-SH6Q5CLM.js";import{Aa as Ve,F as no,Fa as Po,H as so,J as fe,R as ao,U as uo,V as mo,Z as fo,aa as ho,fa as go,g as Gr,i as Kr,ia as wo,j as zr,ja as yo,k as J,ka as vo,l as Vr,n as Yr,o as Qr,r as yt,s as Jr,u as Xr,v as Zr,w as eo,x as to,y as ro,z as oo,za as ze}from"./chunk-4MLEL3VK.js";import{O as io,P as co,Z as lo,ca as po,e as Ke,j as be,p as jr}from"./chunk-R7QYSC6T.js";import{c as sr}from"./chunk-5VRU3BT5.js";import{a as H}from"./chunk-7PVNAILK.js";import{$ as Yt,N as Vt,Z as de,a as Wt,c as Ht,h as Bt,l as Gt,n as jt,q as Kt,t as zt,ta as Qt,u as ke,z as De}from"./chunk-TIU7MMRT.js";import{b as ar,d as Be}from"./chunk-NGCPVRDM.js";import{a as lt,c as qt}from"./chunk-5C7HDTHJ.js";import{D as Ne,H as Zt,J as Z,O as qe,P as xe,Q as dt,R as tr,T as rr,a as Nt,i as pt,j as $e,k as M,l as F,m as Me,n as ut,o as Xt,p as Fe,u as Oe,w as ne}from"./chunk-EEEKSYWV.js";import{a as Zn}from"./chunk-7UNQOKZW.js";import{d as Jt}from"./chunk-7AY6HLQG.js";import{d as _,g as me,l as er}from"./chunk-IIFRDOYG.js";import{$a as ve,Ea as Dt,Fb as U,Gb as nr,Hb as R,Mb as Q,Na as Ie,Pb as y,Q as ct,Qb as k,Ta as X,Wa as Le,cb as $t,eb as Pe,fb as L,gb as S,jb as le,kb as pe,ma as I,mb as Ft,nb as Ot,tb as ue,ua as _e,wa as Ce}from"./chunk-TB7HFPBB.js";import{d as or,f as We,j as He}from"./chunk-SZM6ANMN.js";import{a as Re}from"./chunk-NNOSZ447.js";import{d as T,f as it,g as Te,i as ce,j as Lt,k as Ae,o as kt,p as ye}from"./chunk-773TIA5M.js";import{r as Xn}from"./chunk-T6CC5WUU.js";import{e as oe,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var es=300*1e3,ts='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function Qo(t,e,r=Date.now()){for(;await rs(t,e,r););}async function rs(t,e,r){let o=await je(t,e);if(!o||os(o,r))throw new _(ts);return await xe(3),o.processing}function os(t,e){return t.processing&&Date.now()-e>=es}var ns="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",ss="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",bt=3,Je=class extends yr{constructor(e,r={devPreview:!1}){super(e),this.context="App Ext. Host",this.themeId=Tr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??(e=this.devPreview?await this.createHostTheme():await this.create()),e}setTheme(e){Ar(this.adminSession.storeFqdn,e)}removeTheme(){_r(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:wr,name:this.generateThemeName(this.context),src:ns};for(let o=0;o<bt;o++){y(`Attempt ${o}/${bt}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await ft(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await Qo(n.id,this.adminSession),n;throw new Error}catch{y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${bt} retries. Creating theme using fallback theme zip`);let r=await ft({...e,src:ss},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new me(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var as={"theme:init":Ur,"theme:check":gr,"theme:console":vr,"theme:delete":Pr,"theme:dev":Er,"theme:duplicate":br,"theme:info":Sr,"theme:language-server":Rr,"theme:list":Cr,"theme:metafields:pull":$r,"theme:open":Ir,"theme:package":Lr,"theme:profile":kr,"theme:publish":Dr,"theme:preview":Mr,"theme:pull":Fr,"theme:push":Or,"theme:rename":Nr,"theme:share":qr},oi=as;async function Jo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(v=>v.isThemeExtension);if(n.length===0)return;let a=n[0].directory,i=t.themeExtensionPort??9293,[l,u]=await Promise.all([Vt(t.storeFqdn),ls(e)]),c=l.storeFqdn,[m,h]=await Promise.all([wt(l),ht(l)]),g=h?await gt(void 0,c,m):void 0,d=await cs(l,t.theme),f=d.id.toString();return Oe({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:u}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/admin/themes/${f}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:is,options:{theme:d,adminSession:l,storefrontPassword:g,crawlerSignatureHeaders:m,themeExtensionDirectory:a,themeExtensionPort:i}}}var is=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await xr(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function cs(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await je(parseInt(e,10),t);else{let o=new Je(t,{devPreview:!0});await Ne([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new _("Could not find or create a host theme for theme app extensions");return r}async function ls(t){return t.developerPlatformClient?.clientName===lo.AppManagement?`https://${await ke()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await zt()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function ps(t){let e=T(t.directory,"locales");return Le([T(e,"*.json")])}async function Xo(t,e){let r=await ps(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),us(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function us(t,e,r,o,n){let s;try{s=await I(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw k(i,n.stderr),new er.ExtendableError(i)}}p();function Xe(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}async function he(t,e,r,o){return F({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Xo(t,r),l=await Vr(t),u=t.outputRelativePath?ce(n):n,c=await ds(t,s,u,o),m=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(m=t.configuration.metafields),{assets:{main:Se(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await Ie(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:Xe(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:a??null,metafields:m,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function ds(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),Se(s)){let a=await ms(r);return Promise.all(s.map(async i=>{let{target:l,resource:u}=i,c={...i,surface:Ve(l),root:{url:`${e}/${l}`},resource:u||{url:""}},m=a?.[l];if(!m)return c;let g=await ys(m,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...c,...g}}))}return s}async function ms(t){try{let e=T(t,"manifest.json"),r=await I(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function fs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,l=e[s];if(typeof l=="string"){let g=await Ze(s,i,typeof a=="string"?a:l,r,o,n,typeof a=="string"?l:void 0);return{assets:{[g.name]:g}}}let c=e.build_manifest?.assets?.[s];if(c?.filepath){let m=await Ze(s,i,c.filepath,r,o,n,c.module);return{assets:{[m.name]:m}}}return{}}async function hs({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await Ie(T(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function gs({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let u=i.schema,c=s[l]?.schema,m=typeof c=="string"?c:u,h=typeof c=="string"?u:void 0;return{...i,schema:await Ze("schema",`${t}/intents/${l}/schema`,m,r,o,n,h)}}))}:{}}async function ws({target:t,url:e,extension:r,resolver:o},n,s){let a=await Ze(n,`${t}/${n}`,s,e,r,o);return{assets:{[a.name]:a}}}async function ys(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return vs(o,n)?gs(e,n):Ps(o,n)?ws(e,o,n):xs(o,n)?hs(e,o,n):fs(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Se(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Ze(t,e,r,o,n,s,a){let i=`${e}${Ae(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await Ie(T(n.directory,a??r))??0}}function vs(t,e){return t==="intents"&&Array.isArray(e)}function Ps(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function xs(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as Es}from"events";var Ue;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(Ue||(Ue={}));async function Zo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Ye(t.storeFqdn,t.apiKey),mobileUrl:Io(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>he(n,e,t,r&&St(r,n.devUUID))))}}function St(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var et=class extends Es{constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=de(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(Se(n.extensionPoints)&&Se(o.extensionPoints)){let s=n.extensionPoints.reduce((l,u)=>({...l,[u.target]:u}),{});o.extensionPoints=de(o.extensionPoints,n.extensionPoints,l=>l.map(u=>{let c=s[u.target];return c?de(u,c,(m,h)=>h):u}));let{extensionPoints:a,...i}=n;return de(o,i)}return de(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){y(R`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await he(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},St(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await he(e,r,this.options,St(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(Ue.Update,e)}};p();p();var se;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(se||(se={}));function en(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,bs(t,e)))}}function bs(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(R`Sending connected payload: ${U.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",As(t,e))}}function Ss(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?U.json(o).output():String(o)).join(" ");return R`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Us={debug:t=>U.gray(t),warn:t=>U.yellow(t),error:t=>U.errorText(t)};function Rs({type:t,message:e}){let r=Ss(e);switch(t){case"debug":case"warn":case"error":return R`${Us[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Ts(t,e){F({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(Rs(t))})}function As(t,e){return r=>{let o=JSON.parse(r.toString()),{event:n,data:s}=o;if(y(R`Received websocket message with event type ${n} and data:
2
- ${U.json(s)}
3
- `,e.stdout),n===se.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===se.Dispatch){let a=_s(o,e);rn(t,a,e)}else n===se.Log&&Ts(s,e)}}function tn(t,e){return r=>{let o={event:se.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(R`Sending websocket update event to the websocket clients:
4
- ${U.json(o)}
5
- `,e.stdout),rn(t,o,e)}}function rn(t,e,r){y(R`Sending websocket with event type ${e.event} and data:
6
- ${U.json(e.data)}
7
- `,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function _s(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var Cs=10;function on(t){let e=new Mt.default({noServer:!0,clientTracking:!0}),r=Is(e);return t.httpServer.on("upgrade",en(e,t)),t.payloadStore.on(Ue.Update,tn(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Is(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},Cs*1e3)}p();p();p();function nn(t,e){let{url:r}=Xe(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",tt(t,e)),o.toString()}}function sn(t,e,r){let o=Ve(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",tt(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":n=Ls(e,r,t);break;default:return}return n.toString()}function Ls(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function tt(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function B(t,e){lr(t,cr(e))}p();var Ut=class extends me{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function an(t){let e=await ks(t),r=await I(e);return ir(r,t.data)}async function ks(t){let e=await Ds(),r=[];t.extensionSurface&&r.push(T(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(T(e,`${t.template}.html.liquid`));let o=await Le(r);if(o.length===0)throw new Ut(t);return o[0]}async function Ds(){return await ve("templates/ui-extensions/html",{type:"directory",cwd:ye(import.meta.url)})}var cn=W(t=>{ee(t,"Access-Control-Allow-Origin","*"),ee(t,"Access-Control-Allow-Methods","GET, OPTIONS"),ee(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),ln=W(t=>{ee(t,"Cache-Control","no-cache")}),pn=W(async t=>Ge(t,"/extensions/dev-console",307));async function Rt(t,e){let{filePath:r}=e;if(!await X(r))return B(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Dt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await X(r)))return B(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await I(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=Ae(r),a=n[s]||"text/plain";return ee(t,"Content-Type",a),o}function un({getExtensions:t,payloadStore:e}){return W(async r=>{let{extensionId:o,assetPath:n=""}=Ee(r),s=t().find(c=>c.devUUID===o);if(!s)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n)??n,l=it(Yr(s.outputPath)),u=it(T(l,i));return kt(l,u)?Rt(r,{filePath:u}):B(r,{statusCode:404,statusMessage:"Not Found"})})}function Tt({payloadStore:t}){return W(e=>(ee(e,"content-type","application/json"),t.getRawPayload()))}var dn=W(async t=>{let e=await ve(T("assets","dev-console"),{type:"directory",cwd:ye(import.meta.url)});return e?Rt(t,{filePath:e}):B(t,{statusCode:404,statusMessage:"Could not find root directory for dev console"})}),mn=W(async t=>{let{assetPath:e=""}=Ee(t),r=await ve(T("assets","dev-console","extensions","dev-console","assets"),{type:"directory",cwd:ye(import.meta.url)});return r?Rt(t,{filePath:T(r,e)}):B(t,{statusCode:404,statusMessage:"Could not find root directory for dev console asset"})});function fn({devOptions:t}){return W(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function At({devOptions:t,getExtensions:e}){return W(async r=>{let{extensionId:o}=Ee(r),n=e().find(i=>i.devUUID===o);if(!n)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(pr(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return an({data:{url:tt(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=nn(n,t);return Ge(r,i,307)}}let a=t.appWatcher.buildOutputPath;return ee(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ge(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await he(n,a,t)}})}function hn({devOptions:t,getExtensions:e}){return W(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ee(r),s=e().find(i=>i.devUUID===o);if(!s)return B(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return B(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=sn(n,s,t);return a?Ge(r,a,307):B(r,{statusCode:404,statusMessage:`Redirect url can't be constructed for extension with id ${o} and extension target "${n}"`})})}import{createServer as $s}from"http";function gn(t){let e=ur(),r=dr();e.use(fn(t)),e.use(cn),e.use(ln),r.use("/extensions/dev-console",dn),r.use("/extensions/dev-console/assets/**:assetPath",mn),r.use("/extensions/:extensionId",At(t)),r.use("/extensions/:extensionId/",At(t)),r.use("/extensions/:extensionId/:extensionPointTarget",hn(t)),r.use("/extensions/:extensionId/assets/**:assetPath",un(t)),r.use("/extensions",Tt(t)),r.use("/extensions/",Tt(t)),r.use("/",pn),e.use(r);let o=$s(mr(e));return o.listen(t.devOptions.port,"localhost"),o}async function wn(t){let e={...t,websocketURL:ge(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Zo(e,r,o),s=new et(n,e,o),a=e.extensions.filter(m=>m.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let l=gn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let u=on({...e,httpServer:l,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:m,app:h,extensionEvents:g})=>{m&&(a=h.allExtensions.filter(d=>d.isPreviewable));for(let d of g){if(!d.extension.isPreviewable)continue;let f=d.buildResult?.status==="ok"?"success":"error",v=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case te.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl){let E=await ze(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case te.Updated:await s.updateExtension(d.extension,e,r,{status:f,error:v});break;case te.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),u.close(),l.close()})}function ge(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Ms="3",Fs=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:l,proxyUrl:u,appName:c,appDotEnvFile:m,appId:h,grantedScopes:g,allExtensions:d,appDirectory:f,appWatcher:v})=>{await wn({appName:c,appDotEnvFile:m,appDirectory:f,id:h,extensions:d,stdout:e,stderr:t,signal:r,url:u,port:i,storeFqdn:De(n),storeId:s,apiKey:o,grantedScopes:g,checkoutCartUrl:l,subscriptionProductUrl:a,manifestVersion:Ms,appWatcher:v})};async function yn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await ze(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Fs,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();p();async function vn(t){let e={},r=await Qr(t);return await Promise.all(r.map(async o=>{let n=Te(t.directory,o),a=ce(n)==="assets"?"binary":"utf8",i=await I(o,{encoding:a});e[n]=Buffer.from(i,a).toString("base64")})),{theme_extension:{files:e}}}async function Pn({extension:t,developerPlatformClient:e,apiKey:r,registrationId:o,stdout:n,stderr:s,appConfiguration:a,bundlePath:i}){let l,u=t.getOutputPathForDirectory(i);if(t.features.includes("esbuild")){let v=await I(u);if(!v)return;l=Buffer.from(v).toString("base64")}let c;t.isThemeExtension?c=await vn(t):c=await t.deployConfig({apiKey:r,appConfiguration:a})??{};let m={...c,serialized_script:l};if(t.isFunctionExtension){let v=await I(t.outputPath,{encoding:"base64"});m.uploaded_files={"dist/index.wasm":v}}let h={apiKey:r,config:JSON.stringify(m),handle:t.handle,context:t.contextValue,registrationId:o},g,d=[];try{g=await e.updateExtension(h)}catch(v){if(d=[{message:"Unknown error"}],v&&typeof v=="object"){let E=v;E.errors?.length?d=E.errors:E.message&&(d=[{message:E.message}])}else typeof v=="string"&&(d=[{message:v}])}let f=g?.extensionUpdateDraft?.userErrors;if(f?.length&&d.push(...f),d.length>0){let v=d.map(E=>E.message).join(", ");s.write(`${t.draftMessages.errorMessage}: ${v}`)}else{let v=t.draftMessages.successMessage;v&&Q(v,n)}}var Os=async({stderr:t,stdout:e},{developerPlatformClient:r,apiKey:o,remoteExtensionIds:n,localApp:s,appWatcher:a})=>{await Gr(s);let i=s.draftableExtensions.map(u=>u.handle),l=async u=>{let m=u.extensionEvents.filter(h=>h.type===te.Updated).filter(h=>h.buildResult?.status==="ok").filter(h=>i.includes(h.extension.handle)).map(async h=>{let g=h.extension,d=n[g.localIdentifier];if(!d)throw new _(`Extension ${g.localIdentifier} not found on remote app.`);await F({outputPrefix:g.outputPrefix},async()=>{await Pn({extension:g,developerPlatformClient:r,apiKey:o,registrationId:d,stdout:e,stderr:t,appConfiguration:s.configuration,bundlePath:a.buildOutputPath})})});await Promise.all(m)};a.onEvent(l).onStart(l)};async function xn({localApp:t,apiKey:e,developerPlatformClient:r,remoteApp:o,...n}){let s=t.draftableExtensions;if(s.length===0)return;let a=ho({app:t}),{extensionIds:i,extensions:l}=await fo({app:t,remoteApp:o,appId:e,appName:o.title,force:!0,release:!0,developerPlatformClient:r,envIdentifiers:a,includeDraftExtensions:!0});return t.updateExtensionUUIDS(l),{type:"draftable-extension",prefix:"extensions",function:Os,options:{localApp:t,apiKey:e,developerPlatformClient:r,...n,extensions:s,remoteExtensionIds:i}}}p();p();function ae(t){let e=t.find(o=>fe(o,J.Frontend)),r=t.find(o=>fe(o,J.Backend));return{frontendConfig:e,backendConfig:r}}p();async function En(t){let r={topic:"app/uninstalled",api_version:(await co(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:ko.LOCALHOST,shared_secret:t.sharedSecret},o=await io(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await xe(3);let n=await Ns(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Ns(t,e){let r=0;for(;r<3;){try{return await Lo(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Gt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await xe(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var qs=async({stdout:t},e)=>{await En({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function bn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=ae(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:qs,options:{deliveryPort:a?r:o,webhooksPath:l,organizationId:n,...s}}}p();async function Sn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ws}}var Ws=async({stdout:t,abortSignal:e},r)=>{let o=Do({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=hr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",async()=>{n.close()})};p();async function Rn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=ae(t),l=i?.configuration.hmr_server?await O():void 0,u=void 0,c=t.map(async m=>{let h=await Hs({web:m,frontendPort:r,backendPort:o}),g=l&&m.configuration.roles.includes(J.Frontend)?{port:l,httpPaths:m.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:m.configuration.name??["web",...m.configuration.roles].join("-"),function:Bs,options:{port:h,portFromConfig:m.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:m.directory,devCommand:m.configuration.commands.dev,preDevCommand:m.configuration.commands.predev,scopes:a,shopCustomDomain:u,hmrServerOptions:g,roles:m.configuration.roles}}});return Promise.all(c)}async function Hs({web:t,frontendPort:e,backendPort:r}){return fe(t,J.Frontend)?e:fe(t,J.Backend)?r:O()}async function Bs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:l,directory:u,devCommand:c,preDevCommand:m,scopes:h,shopCustomDomain:g,hmrServerOptions:d}){let f=d?.port,v={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:h,NODE_ENV:"development",...g&&{SHOP_CUSTOM_DOMAIN:g},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:u,port:o,env:v,stdout:t,stderr:e};m&&(t.write(`Running pre-dev command: "${m}"`),await Un({...E,command:m,showOutput:or()})),await Un({...E,command:c,showOutput:!0})}async function Un({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let l=t.split("&&").map(u=>u.trim())??[];for(let u of l){let[c,...m]=u.split(" ");c?.length!==0&&await qe(c,m,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var rt=class{constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(R`${U.yellow(e)}`.value)}async success(e){await this.log(R`${U.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=U.errorText("\u274C Error"),n=U.errorText(`\u2514 ${e}`);await this.log(R`${o}`.value,r),await this.log(R`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e){if(!e)return;let r=e.extensionEvents??[],n=(await Promise.all(r.map(async a=>a.type===te.Deleted?[]:(await a.extension.getDevSessionUpdateMessages())?.map(l=>({message:l,prefix:a.extension.handle}))??[]))).flat(),s=n.map((a,i)=>{let l=R`${U.gray(i===n.length-1?"\u2514 ":"\u2502 ")}${a.message}`.value;return this.log(l,a.prefix)});await Promise.all(s)}async logMultipleErrors(e){let r=U.errorText("\u274C Error");await this.log(R`${r}`.value,"app-preview");let o=e.map(n=>{let s=U.errorText(`\u2514 ${n.error}`);return this.log(R`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await F({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(e)})}};p();var ot=class{constructor(e){this.processBatch=e,this.queue=[],this.processingPromise=void 0}enqueue(e){this.queue.push(e),this.processingPromise??(this.processingPromise=this.startProcessing())}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var nt=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}constructor(e,r){this.failedEvents=[],this.currentSessionState=null,this.statusManager=e.devSessionStatusManager,this.logger=new rt(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new ot(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=bo(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${vt(n)}ms - Total: ${vt(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new _(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR"),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){e.status==="updated"?(await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r),await this.setUpdatedStatusMessage()):e.status==="created"?(this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r),this.statusManager.setMessage("READY")):e.status==="aborted"?await this.logger.debug("\u274C Dev preview update aborted (new change detected or error during update)"):(e.status==="remote-error"||e.status==="unknown-error")&&(await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR"):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR"))),!this.statusManager.status.isReady&&!We()&&setImmediate(()=>{throw new _("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.allExtensions.filter(a=>a.isPreviewable).length>0,n=He()&&r?this.options.appLocalProxyURL:this.options.appPreviewURL,s=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:n,appEmbedded:e.app.configuration.embedded,hasExtensions:s})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=ge(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new Error("Unauthorized");if(r instanceof Bt)throw r.response.status===401||r.response.status===403?new _("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new _("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await Uo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await $t(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=T(ce(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...Ro];r&&n.push("manifest.json"),await To(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await Ao(s,o),s}async getSignedURLWithRetry(){return _o(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.devSession;if(n&&this.currentSessionState){let s=ge(this.options.url),a=this.currentSessionState?.userId;if(n.websocketUrl!==s||n.user?.id!==a){let i=n.user?.email;await this.logger.error(`Another developer ${i?`(${i}) `:""}has taken ownership of this dev preview.`);let l=`Another user${i?` (${i})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,u=["You can restart by running",{command:"shopify app dev"},"again."];throw new _(l,u)}this.currentSessionState={websocketUrl:n.websocketUrl,userId:n.user?.id??null,userEmail:n.user?.email??null}}return o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await Promise.all(n.map(a=>{let i=a.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${a.message}`:a.message;return this.logger.warning(i)})),o.length?{status:"remote-error",error:o}:{status:"created"}}};async function Tn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:Gs,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var Gs=async({stdout:t},e)=>{await nt.start(e,t)};p();p();p();var An=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=qt().substring(0,6),i=`${js(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,l=Vo({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),u=T(n,i);try{return await Ce(n),await _e(u,l),{fullOutputPath:u,identifier:s}}catch(c){throw r.write(`Error while writing log to file: ${c}
8
- `),c}};function js(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${l}Z`}var st=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:u=0})=>{if(!i?.aborted)try{let c=e,m=Fo,h=u,g=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:f}=g;if(f===200){h=0;let{app_logs:E}=g;for(let A of E){let P=JSON.parse(A.payload);await F({outputPrefix:A.source,stripAnsi:!1},async()=>{A.log_type===qo?(Ks(A,P,t),P=new $o(Mo(P))):A.log_type.startsWith(Wo)?zs(A,P,t):t.write(JSON.stringify(P));let D=await An({appLog:A,appLogPayload:P,stdout:t,storeName:s,logsDir:l});t.write(R`${U.gray("\u2514 ")}${U.link("Open log file",`file://${D.fullOutputPath}`,`Log: ${D.fullOutputPath}`)} ${U.gray(`(${D.identifier})`)}\n`.value)})}}else{let E={errors:d.map(P=>({message:P,status:f}))},A=await zo({response:E,onThrottle:P=>{k("Request throttled while polling app logs.",t),k(`Retrying in ${P/1e3} seconds.`,t)},onUnknownError:P=>{k("Error while polling app logs.",t),k(`Retrying in ${P/1e3} seconds.`,t)},onResubscribe:()=>n()});if(A.resubscribeResult==="failed"){if(h+=1,h>=Oo){k("App log streaming session has expired. Please restart your dev session.",t);return}}else A.resubscribeResult==="succeeded"&&(h=0);A.nextJwtToken&&(c=A.nextJwtToken),m=A.retryIntervalMs}let{cursor:v}=g;setTimeout(()=>{st({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:v??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:h}).catch(E=>{y(`Unexpected error during polling: ${E}}
9
- `)})},m)}catch(c){k("Error while polling app logs.",t),k(`Retrying in ${xt/1e3} seconds.`,t),y(`${c}}
10
- `),setTimeout(()=>{st({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l}).catch(m=>{y(`Unexpected error during polling: ${m}}
11
- `)})},xt)}};function Ks(t,e,r){let o=(e.fuel_consumed/No).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
12
- `).filter(Boolean).map(s=>R`${U.gray("\u2502 ")}${s}`.value).join(`
13
- `))}function zs(t,e,r){t.log_type===Ho?r.write("Function network access response retrieved from cache."):t.log_type===Bo?e.reason===jo?r.write("Function network access request executing in background because there is no cached response."):e.reason===Ko&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===Go&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function Vs(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function _n({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:Ys,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var Ys=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:l})=>{async function u(c){let m=await Et(o,n,a,t),h=l.getLogsDir();await Ce(h),await st({stdout:t,appLogsFetchInput:{jwtToken:m},resubscribeCallback:()=>Et(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:c,logsDir:h})}try{let c=!1,m,h=async g=>{let d=Vs(g.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,m=new AbortController;try{await u(m.signal)}catch(f){y(`Failed to start function logs: ${f}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,m?.abort(),m=void 0)};i.onStart(h).onEvent(h)}catch{}};p();async function Cn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Qs}}var Qs=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as Js}from"events";var Xs={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},at=class extends Js{constructor(e){super(),this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0},e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Yt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e){this.updateStatus({statusMessage:Xs[e]})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as In from"http";import*as Ln from"https";function kn(t){return"errors"in t&&Array.isArray(t.errors)}async function Dn(t,e,r,o){let s=(await import("./http-proxy-node16-X2WAMUT5.js")).default.createProxyServer(),a=ea(t,s,o),i=r?Ln.createServer(r,a):In.createServer(a);return i.on("upgrade",Zs(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Zs(t,e,r){return function(o,n,s){let a=$n(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let u=(kn(i)?i.errors[i.errors.length-1]:void 0)??i;k(`Error forwarding websocket request: ${u.message}`,r),k(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function ea(t,e,r){return function(o,n){let s=$n(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{F({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(kn(a)?a.errors[a.errors.length-1]:void 0)??a;k(`Error forwarding web request: ${l.message}`,r),k(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(R`
14
- Reverse HTTP proxy error - Invalid path: ${o.url??""}
15
- These are the allowed paths:
16
- ${U.json(JSON.stringify(t))}
17
- `),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function $n(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}async function Mn({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:l,graphiqlKey:u}){let c=o.apiKey,m=o.apiSecretKeys[0]?.secret??"",h=Wt(),g=!Re(h[Ke.disableGraphiQLExplorer]),d=await so(t),f=new So(d,i.proxyUrl),v=d.allExtensions.some(Y=>Y.isPreviewable),E=`${i.proxyUrl}/extensions/dev-console`,A=He(),P;if(A)P=Ye(n,c);else{let Y=await ke();P=Co(n,c,Y)}let z=A&&v?E:P,j=fr(u,m,n),q=g?`http://localhost:${l}/graphiql?key=${encodeURIComponent(j)}`:void 0,V=d.configuration.embedded,w=d.nonConfigExtensions.length>0,$=new at({isReady:!1,previewURL:z,graphiqlURL:q,appEmbedded:V,hasExtensions:w}),N=[...await Rn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:c,apiSecret:m,scopes:Kr(d.configuration)}),g?await Sn({appName:o.title,appUrl:P,port:l,apiKey:c,apiSecret:m,key:j,storeFqdn:n}):void 0,await yn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:c,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:f}),r.supportsDevSessions?await Tn({app:d,apiKey:c,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:f,appPreviewURL:P,appLocalProxyURL:E,devSessionStatusManager:$}):await xn({localApp:d,remoteApp:o,apiKey:c,developerPlatformClient:r,proxyUrl:i.proxyUrl,appWatcher:f}),await Jo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort}),bn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:m,remoteAppUpdated:e}),await _n({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:c},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:f}),await Cn({appWatcher:f})].filter(ta);return{processes:await ra(N,i.proxyPort,i.reverseProxyCert),previewUrl:z,graphiqlUrl:q,devSessionStatusManager:$}}var ta=t=>t!==void 0&&t!==!1;async function ra(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(J.Frontend)){let l=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${l}`;let u=a.options.hmrServerOptions;u&&(i.websocket=`http://localhost:${u.port}`,u.httpPaths.forEach(c=>i[c]=`http://localhost:${u.port}`)),a.options.port=l}else if(a.type==="previewable-extension"){let l=await O();i[a.options.pathPrefix]=`http://localhost:${l}`,a.options.port=l}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:oa,options:{port:e,rules:s,localhostCert:r}}),n}var oa=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await Dn(o,t,n,e);Q(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();p();var b=oe(Pe(),1);var na=(t,e)=>Math.max(...t.map(r=>r.prefix.length),...e.map(r=>r.handle.length)),Fn=({abortController:t,processes:e,previewUrl:r,graphiqlUrl:o="",graphiqlPort:n,app:s,pollingTime:a=5e3,developerPreview:i,isEditionWeek:l})=>{let{canEnablePreviewMode:u,developmentStorePreviewEnabled:c}=s,{isRawModeSupported:m}=le(),h=(0,b.useRef)(),g=`http://localhost:${n}/graphiql`,[d,f]=(0,b.useState)(void 0),[v,E]=(0,b.useState)(!0),[A,P]=(0,b.useState)(void 0),{isAborted:D}=Fe(t.signal,async w=>{w?f("Shutting down dev because of an error ..."):(f("Shutting down dev ..."),Qe()),clearInterval(h.current),await i.disable()}),z=(0,b.useMemo)(()=>e.map(w=>({...w,action:async($,N,K)=>{try{return await w.action($,N,K)}catch(Y){t.abort(Y)}}})),[e,t]);(0,b.useEffect)(()=>{let w=async()=>{try{let N=await i.fetchMode();E(N??!1),P("")}catch{P("Failed to fetch the latest status of the development store preview, trying again in 5 seconds.")}},$=async()=>{try{await i.enable(),P("")}catch{P("Failed to turn on development store preview automatically.\nTry turning it on manually by pressing `d`."),E(!!c)}};if(u){$();let N=()=>setInterval(()=>w(),a);h.current=N()}return()=>{clearInterval(h.current)}},[u]),pe((w,$)=>{$e(w,$,()=>t.abort()),(async()=>{try{if(P(""),w==="p"&&r)await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Z(r);else if(w==="g"&&o)await H.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),await Z(g);else if(w==="q")t.abort();else if(w==="e"&&l)await Z("https://shopify.link/yQmk");else if(w==="d"&&u){await H.addPublicMetadata(()=>({cmd_dev_dev_preview_toggle_used:!0}));let K=!v;E(K);try{if(!await i.update(K))throw new Error(`Failed to turn ${K?"on":"off"} development store preview.`)}catch{E(v),P(`Failed to turn ${K?"on":"off"} development store preview.`)}}}catch{P("Failed to handle your input.")}})()},{isActive:!!m});let j=new Date,q=j.getMonth()>3?"Summer":"Winter",V=j.getFullYear();return b.default.createElement(b.default.Fragment,null,b.default.createElement(Me,{processes:z,prefixColumnSize:na(z,s.extensions),abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!1}),D?null:b.default.createElement(L,{marginY:1,paddingTop:1,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},m?b.default.createElement(L,{flexDirection:"column"},l?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"e")," ",M.lineVertical," check out ",q," Edition",` ${V}`,", live NOW with 100+ product announcements!"):null,u?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"d")," ",M.lineVertical," toggle development store preview: ",v?b.default.createElement(S,{color:"green"},"\u2714 on"):b.default.createElement(S,{color:"red"},"\u2716 off")):null,o?b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"g")," ",M.lineVertical," open GraphiQL (Admin API) in your browser"):null,b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"p")," ",M.lineVertical," preview in your browser"),b.default.createElement(S,null,M.pointerSmall," Press ",b.default.createElement(S,{bold:!0},"q")," ",M.lineVertical," quit")):null,b.default.createElement(L,{marginTop:m?1:0,flexDirection:"column"},d?b.default.createElement(S,null,d):b.default.createElement(b.default.Fragment,null,b.default.createElement(S,null,"Preview URL: ",b.default.createElement(ue,{url:r})),o?b.default.createElement(S,null,"GraphiQL URL: ",b.default.createElement(ue,{url:g})):null)),A?b.default.createElement(S,{color:"red"},A):null))};p();p();var we=oe(Pe(),1);var On=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function Nn(){let[t,e]=(0,we.useState)(0);return(0,we.useEffect)(()=>{let r=setInterval(()=>{e(o=>(o+1)%On.length)},70);return()=>clearInterval(r)},[]),we.default.createElement(S,null,On[t])}p();var C=oe(Pe(),1);var qn=.9,Wn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=Ft(),{isRawModeSupported:o}=le(),[n,s]=(0,C.useState)(e),[a,i]=(0,C.useState)(Math.floor(r.columns*qn)),[l,u]=(0,C.useState)(!0),c=(0,C.useRef)(null);if(!n)throw new Error("No tabs provided");pe((d,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let P=Object.entries(t).filter(([V,w])=>w.content),D=P.findIndex(([V])=>V===n);if(D===-1)return;let z=f?.leftArrow?-1:1,j=(D+z+P.length)%P.length,q=P[j];q&&s(q[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let A=t[n];if(A?.shortcuts){let P=A.shortcuts.find(D=>D.key===d);P&&(!P.condition||P.condition())&&await P.action()}})()},{isActive:!!o}),(0,C.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*qn)),!c.current)return;let f=Ot(c.current);u(f.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let m=Object.entries(t).map(([d,f])=>({...f,inputKey:d,header:` (${d}) ${f.label} `})),h=m.filter(d=>!d.action),g=m.filter(d=>d.action);return C.default.createElement(C.default.Fragment,null,C.default.createElement(L,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},C.default.createElement(L,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},C.default.createElement(S,{wrap:"truncate-end"},"\u2502",h.map(d=>C.default.createElement(C.default.Fragment,{key:d.inputKey},C.default.createElement(S,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&C.default.createElement(L,{flexGrow:1,justifyContent:"flex-end"},g.map((d,f)=>C.default.createElement(S,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,f<g.length-1&&" \u2502 ")))),C.default.createElement(L,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var x=oe(Pe(),1);var Hn=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:l,onAbort:u})=>{let{isRawModeSupported:c}=le(),[m,h]=(0,x.useState)(void 0),[g,d]=(0,x.useState)(void 0),[f,v]=(0,x.useState)(r.status),[E,A]=(0,x.useState)(!1),{isAborted:P}=Fe(t.signal,async w=>{w&&d(typeof w=="string"?w:w.message),r.status.isReady?A(!0):(h("Shutting down dev ..."),await u()),Qe()}),D=(0,x.useMemo)(()=>e.map(w=>({...w,action:async($,N,K)=>{try{return await w.action($,N,K)}catch(Y){t.abort(Y)}}})),[e,t]);(0,x.useEffect)(()=>(r.on("dev-session-update",v),()=>{r.off("dev-session-update",v)}),[]),pe((w,$)=>{$e(w,$,()=>t.abort())},{isActive:!!c});let z=w=>{switch(w){case"loading":return x.default.createElement(Nn,null);case"success":return"\u2705";case"error":return"\u274C"}},j=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Z(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:Pt(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Z(Pt(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await H.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Z(f.graphiqlURL)}}],q=j.filter(w=>w.condition?.()??!0),V={d:{label:"Dev status",shortcuts:j,content:x.default.createElement(x.default.Fragment,null,f.statusMessage&&x.default.createElement(S,null,z(f.statusMessage.type)," ",f.statusMessage.message),c&&q.length>0&&x.default.createElement(L,{marginTop:1,flexDirection:"column"},q.map(w=>x.default.createElement(S,{key:w.key},M.pointerSmall," ",x.default.createElement(S,{bold:!0},"(",w.key,")")," ",dt()&&w.url?x.default.createElement(ue,{url:w.url,label:w.shortcutLabel}):w.shortcutLabel))),x.default.createElement(L,{marginTop:c?1:0,flexDirection:"column"},m?x.default.createElement(S,null,m):x.default.createElement(x.default.Fragment,null,f.isReady&&!(c&&dt())&&x.default.createElement(x.default.Fragment,null,q.filter(w=>w.url).map(w=>x.default.createElement(S,{key:w.key},w.linkLabel," URL: ",x.default.createElement(ue,{url:w.url})))))))},a:{label:"App info",content:x.default.createElement(L,{flexDirection:"column"},x.default.createElement(ut,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,w])=>w)}))},s:{label:"Store info",content:x.default.createElement(L,{flexDirection:"column"},x.default.createElement(ut,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,w])=>w)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return x.default.createElement(x.default.Fragment,null,x.default.createElement(Me,{processes:D,prefixColumnSize:jr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&x.default.createElement(L,{marginTop:1,flexDirection:"column"},x.default.createElement(Xt,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),P?null:x.default.createElement(L,{paddingTop:1,flexDirection:"column",flexGrow:1},c?x.default.createElement(Wn,{tabs:V,initialActiveTab:"d"}):x.default.createElement(L,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},V.d?.content)),g?x.default.createElement(L,{marginTop:1,flexDirection:"column"},x.default.createElement(S,{color:"red"},g)):null)};var _t=oe(Pe(),1);async function Bn({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,graphiqlPort:s,developerPreview:a,shopFqdn:i,devSessionStatusManager:l,appURL:u,appName:c,organizationName:m,configPath:h,localURL:g}){if(!tr())await sa({processes:t,previewUrl:e,graphiqlUrl:n,app:r,abortController:o,developerPreview:a,shopFqdn:i});else return r.developerPlatformClient.supportsDevSessions?pt(_t.default.createElement(Hn,{processes:t,abortController:o,devSessionStatusManager:l,shopFqdn:i,appURL:u,appName:c,organizationName:m,configPath:h,localURL:g,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:i})}}),{exitOnCtrlC:!1}):pt(_t.default.createElement(Fn,{processes:t,abortController:o,previewUrl:e,app:r,graphiqlUrl:n,graphiqlPort:s,developerPreview:a,isEditionWeek:aa(),shopFqdn:i}),{exitOnCtrlC:!1})}async function sa({processes:t,previewUrl:e,graphiqlUrl:r,app:{canEnablePreviewMode:o},abortController:n,developerPreview:s}){return o&&(await s.enable(),n?.signal.addEventListener("abort",async()=>{await s.disable()})),process.stdout.write(`
18
- Preview URL: ${e}
19
- `),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
20
- `),Promise.all(t.map(async a=>{await a.action(process.stdout,process.stderr,n.signal)}))}function aa(){if(Re(process.env.IS_EDITION_WEEK))return!0;if(We())return!1;let t=new Date("2024-01-31T17:00:00.000Z"),e=new Date("2024-02-07T17:00:00.000Z"),r=new Date;return r>=t&&r<=e}p();function Gn(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ne({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=ct(e.map(n=>n.for)).join(" "),o=ct(e.map(n=>({command:n.flagToRemedy})));ne({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}p();async function jn(t,e){return e?e.includes("localhost")?"localhost":(await Kt(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Kn=oe(Zn(),1);var ie="v1.4.4",zn="FiloSottile/mkcert",Ct=U.genericShellCommand("mkcert");async function ia(t,e,r,o){let n=e[Ke.mkcertBinaryPath];if(n)return n;let a=T(t,r==="win32"?"mkcert.exe":"mkcert");if(await X(a))return a;let i=await(0,Kn.default)("mkcert",{nothrow:!0});return i?(y(R`Found ${Ct} at ${U.path(i)}`),i):(await ca(a,r,o),a)}async function ca(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${ie}-darwin-arm64`:`mkcert-${ie}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${ie}-linux-arm64`:`mkcert-${ie}-linux-amd64`;break;case"win32":o=`mkcert-${ie}-windows-amd64.exe`;break;default:throw new me(`Unsupported platform: ${e}`)}await Wr(zn,ie,o,t),y(R`${Ct} saved to ${U.path(t)}`)}async function la(t){let e=T(t,"mkcert-LICENSE");if(await X(e))return;let r=`https://raw.githubusercontent.com/${zn}/refs/tags/${ie}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await jt(r),!n.ok)return o}catch{return o}let s=await n.text();await _e(e,s)}async function Vn({appDirectory:t,env:e=process.env,platform:r=process.platform,arch:o=process.arch}){let n=T(".shopify","localhost-key.pem"),s=T(".shopify","localhost.pem"),a=T(t,n),i=T(t,s);if(await X(a)&&await X(i))return{keyContent:await I(a),certContent:await I(i),certPath:s};if(!await ao())throw new _(`Localhost certificate and key are required at ${s} and ${n}`);let u="",c;return await Ne([{title:"Finding or downloading mkcert binary",task:async()=>{let h=T(t,".shopify");u=await ia(h,e,r,o),c=await la(h),y(R`${Ct} found at: ${U.path(u)}`)}}]),c&&Oe(c),Q(R`Generating self-signed certificate for localhost. You may be prompted for your password.`),await qe(u,["-install","-key-file",a,"-cert-file",i,"localhost"]),Q(R`${U.successIcon()} Certificate generated at ${s}\n`),await rr()&&(ne({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),Q("\u{1F449} Press any key to continue"),await Zt(),Q("")),{keyContent:await I(a),certContent:await I(i),certPath:Te(t,i)}}async function Qn(t){let e=await pa(t);await ua(e);let{processes:r,graphiqlUrl:o,previewUrl:n,devSessionStatusManager:s}=await Mn(e);await fa(e),await wa({processes:r,previewUrl:n,graphiqlUrl:o,config:e,devSessionStatusManager:s})}async function pa(t){let{app:e,remoteApp:r,developerPlatformClient:o,store:n,specifications:s,tunnel:a}=t,i;if(a.mode==="auto"){let E=await O();i=await oo(t.commandConfig,E,"cloudflare")}let l=await uo(r,o,s,r.flags);r.configuration=l,go({app:e,remoteApp:r,selectedStore:n,cachedInfo:yt(t.directory),organization:t.organization,tunnelMode:a.mode}),e.configuration.build?.dev_store_url&&(e.configuration.build={...e.configuration.build,dev_store_url:n.shopDomain},await(await sr.read(e.configPath)).patch({build:{dev_store_url:n.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Br(t.project);let u=t.graphiqlPort??await O(be.graphiql),c=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??be.graphiql,actual:u}];a.mode==="use-localhost"&&c.push({for:"localhost",flagToRemedy:"--localhost-port",requested:a.requestedPort,actual:a.actualPort}),Gn(c);let{webs:m,...h}=await ga(e.directory,e.webs,u,a,i,r.configuration);e.webs=m;let g=e.configuration.build?.automatically_update_urls_on_dev,d=yt(t.directory)?.previousAppId,f=r.apiKey,v=await ha(m,t.update,h,e,g,r,f,o);return{storeFqdn:n.shopDomain,storeId:n.shopId,remoteApp:r,remoteAppUpdated:r.apiKey!==d,localApp:e,developerPlatformClient:o,commandOptions:t,network:h,partnerUrlsUpdated:v,graphiqlPort:u,graphiqlKey:t.graphiqlKey}}async function ua(t){await da(t),await ma(t)}async function da({localApp:t,remoteApp:e,developerPlatformClient:r,commandOptions:o}){if(r.supportsDevSessions)return;let n=t.configuration.access_scopes,s=e.configuration?.access_scopes,a=u=>u&&u.split(",").map(c=>c.trim()).sort().join(","),i=a(n?.scopes),l=a(s?.scopes);if(!n?.use_legacy_install_flow&&i!==l){let u=[["Run",{command:nr(o.project.packageManager,"shopify app deploy")},"to push your scopes to the Partner Dashboard"]];ne({headline:["The scopes in your TOML don't match the scopes in your Partner Dashboard"],body:[`Scopes in ${Lt(t.configPath)}:`,Yn(zr(t.configuration)),`
21
- `,"Scopes in Partner Dashboard:",Yn(s?.scopes?.split(",")??[])],nextSteps:u})}}async function ma(t){let{developerPlatformClient:e,remoteApp:r}=t;if(!e.supportsDevSessions)return;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||mo()}async function fa(t){Jr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await va({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await Qt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function ha(t,e,r,o,n,s,a,i){let{backendConfig:l,frontendConfig:u}=ae(t),c=!1;if((u??l)&&e){let m=Zr(r.proxyUrl,t.map(({configuration:h})=>h.auth_callback_path).find(h=>h),o.configuration.app_proxy);c=await ro({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:m,developerPlatformClient:i}),c&&(i.supportsDevSessions?o.setDevApplicationURLs(m):await eo(m,a,i,o))}return c}async function ga(t,e,r,o,n,s){let{backendConfig:a,frontendConfig:i}=ae(e);await Pa(e,r);let l=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:u,frontendPort:c,usingLocalhost:m},h,g]=await Promise.all([Xr(l),Ht()??a?.configuration.port??O(),to(s)]),d=m?`${u}:${c}`:u,f=i?.configuration.port;i&&(f??(f=i===a?h:await O()),i.configuration.port=f),f=f??await O();let v;if(o.mode==="use-localhost"){let{keyContent:E,certContent:A,certPath:P}=await Vn({appDirectory:t});v={key:E,cert:A,certPath:P,port:o.actualPort}}return{proxyUrl:d,proxyPort:c,frontendPort:f,backendPort:h,currentUrls:g,webs:e,reverseProxyCert:v}}async function wa({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n}){let s=new Nt,a=t.map(c=>({prefix:c.prefix,action:async(h,g,d)=>{let f=c.function;return f({stdout:h,stderr:g,abortSignal:d},c.options)}})),i=o.remoteApp.apiKey,l=o.developerPlatformClient,u={canEnablePreviewMode:l.supportsDevSessions?!1:await Yo({localApp:o.localApp,developerPlatformClient:l,apiKey:i,organizationId:o.remoteApp.organizationId}),developmentStorePreviewEnabled:o.remoteApp.developmentStorePreviewEnabled,apiKey:i,id:o.remoteApp.id,developerPlatformClient:l,extensions:o.localApp.allExtensions};return Bn({processes:a,previewUrl:e,graphiqlUrl:r,graphiqlPort:o.graphiqlPort,app:u,abortController:s,developerPreview:ya(i,l),shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl})}function ya(t,e){return e.supportsDevSessions?{fetchMode:()=>Promise.resolve(!1),enable:()=>Promise.resolve(!1),disable:()=>Promise.resolve(),update:()=>Promise.resolve(!1)}:{fetchMode:async()=>!!await po(t,e),enable:async()=>wo({apiKey:t,developerPlatformClient:e}),disable:async()=>yo({apiKey:t,developerPlatformClient:e}),update:async r=>vo({apiKey:t,developerPlatformClient:e,enabled:r})}}async function va(t){let e=await jn(t.devOptions.commandConfig,t.tunnelUrl);await H.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?lt(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:lt(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await H.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}function Yn(t){return{list:{items:t.length===0?["No scopes"]:t}}}async function Pa(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new _(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await mt(n))throw new _(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await mt(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new _(s,a)}})()])}p();async function Jn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??be.localhost,n=await O(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new _(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var G=oe(Xn(),1);var It,re=class extends xo{static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(It),r=await Jn({useLocalhost:e["use-localhost"],tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Jt(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await no(e.path);let o=await Po({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config}),n=await Eo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset}),s={...o,store:n,directory:e.path,update:!e["no-update"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],tunnel:r};return await Qn(s),{app:o.app}}};It=re;re.summary="Run the app.";re.descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";re.description=It.descriptionWithoutMarkdown();re.flags={...ar,...Hr,store:G.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async t=>De(t)}),"skip-dependencies-installation":G.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":G.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"subscription-product-url":G.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":G.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":G.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":G.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",default:!1,exclusive:["tunnel-url"]}),"localhost-port":Be({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:G.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Be({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),notify:G.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Be({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":G.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};var tm=re;export{oi as a,tm as b};
@@ -1 +0,0 @@
1
- import{g as I}from"./chunk-VKWPEFWQ.js";I();var o="4.5.2";export{o as a};
@@ -1,16 +0,0 @@
1
- import{b as C}from"./chunk-QEVGRNUE.js";import{b as f}from"./chunk-UAYIFFYJ.js";import{A as S,u as i,y as x}from"./chunk-EEEKSYWV.js";import{d as v}from"./chunk-IIFRDOYG.js";import{Pb as I}from"./chunk-TB7HFPBB.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();a();a();var m={on:"Autocorrect on. The system will automatically run commands even when you mistype them.",off:"Autocorrect off. You'll need to confirm corrections for mistyped commands."};a();function p(o=W()){return!!o.get("autocorrectEnabled")}function y(o,n=W()){n.set("autocorrectEnabled",o)}function W(){return b??(b=new C({projectName:"did-you-mean"})),b}var b;var A,s=class extends f{async run(){y(!0),i({body:m.on})}};A=s;s.summary="Enable autocorrect. Off by default.";s.descriptionWithMarkdown=`Enable autocorrect. Off by default.
2
-
3
- When autocorrection is enabled, Shopify CLI automatically runs a corrected version of your command if a correction is available.
4
-
5
- When autocorrection is disabled, you need to confirm that you want to run corrections for mistyped commands.
6
- `;s.description=A.descriptionWithoutMarkdown();var E=s;a();var k,u=class extends f{async run(){y(!1),i({body:m.off})}};k=u;u.summary="Disable autocorrect. Off by default.";u.descriptionWithMarkdown=`Disable autocorrect. Off by default.
7
-
8
- When autocorrection is enabled, Shopify CLI automatically runs a corrected version of your command if a correction is available.
9
-
10
- When autocorrection is disabled, you need to confirm that you want to run corrections for mistyped commands.
11
- `;u.description=k.descriptionWithoutMarkdown();var D=u;a();var M,d=class extends f{async run(){p()?i({body:m.on}):i({body:m.off})}};M=d;d.summary="Check whether autocorrect is enabled or disabled. On by default.";d.descriptionWithMarkdown=`Check whether autocorrect is enabled or disabled. On by default.
12
-
13
- When autocorrection is enabled, Shopify CLI automatically runs a corrected version of your command if a correction is available.
14
-
15
- When autocorrection is disabled, you need to confirm that you want to run corrections for mistyped commands.
16
- `;d.description=M.descriptionWithoutMarkdown();var N=d;a();var g=O(2),ao=O(3);function O(o){if(typeof o!="number"||Number.isNaN(o)||o<1||o===Number.POSITIVE_INFINITY)throw new Error("`"+o+"` is not a valid argument for `n-gram`");return n;function n(t){let c=[];if(t==null)return c;let e=typeof t.slice=="function"?t:String(t),r=e.length-o+1;if(r<1)return c;for(;r--;)c[r]=e.slice(r,r+o);return c}}function h(o){return o.replace(/:/g," ")}function F(o,n){let t={};o.forEach(e=>{t[e]=t[e]?t[e]+1:1});let c=[];for(let e of n)e in t&&t[e]>0&&(c.push(e),t[e]=t[e]-1);return c.length}function L(o){if(o.id.length<2)return;let n=new Set(o.config.commands.filter(r=>r.hidden).map(r=>r.id)),t=Array.from(new Set([...o.config.commandIDs,...o.config.commands.flatMap(r=>r.aliases)].filter(r=>!n.has(r)))),c=g(o.id),e=t.map(r=>{let l=g(r);return{score:F(l,c),cmd:r}}).filter(({score:r})=>r>=2).sort((r,l)=>{let w=l.score-r.score;return w!==0?w:r.cmd.length-l.cmd.length});if(I(`'Did you mean' options: ${JSON.stringify(e)}`),e.length>0){let{cmd:r}=e[0];return r}}async function Y(o,n){return p()?(i({body:["Autocorrecting",{command:h(n)},"to",{command:h(o)},{char:"."}]}),!0):S({message:["Command",{command:n},"not found. Did you mean",{command:h(o)},{char:"?"}]})}var bo={"config:autocorrect:off":D,"config:autocorrect:status":N,"config:autocorrect:on":E},go=async function(o){let n=L(o),t=h(o.id);if(o.argv&&(o.argv.includes("-f")||o.argv.includes("--force"))||!n){x(new v(`Command '${t}' not found.`));return}await Y(n,t)&&await this.config.runCommand(n,o.argv)};export{L as a,Y as b,bo as c,go as d};
@@ -1,103 +0,0 @@
1
- import{a as U,b as xt}from"./chunk-KRZABRYT.js";import{a as mt,b as ht,f as _e,g as ae,h as A,i as ce,k as yt,n as Et}from"./chunk-HSVZU7MP.js";import{a as M,l as ft,m as gt}from"./chunk-I5X3IP6T.js";import{s as ie,t as W}from"./chunk-4P54DKG4.js";import{a as O,b as N,e as st,g as nt,i as rt,j as ot,k as it,n as at,p as ct,q as lt,r as oe,s as $,u as dt,w as pt}from"./chunk-Q7BOSHWX.js";import{aa as ut}from"./chunk-L42FYXFW.js";import{va as L,xa as H}from"./chunk-TIU7MMRT.js";import{b as Qe}from"./chunk-5C7HDTHJ.js";import{P as tt,u as Ke,w as _,x as te,y as et}from"./chunk-EEEKSYWV.js";import{d as se}from"./chunk-IIFRDOYG.js";import{Fb as q,Hb as ne,Mb as re,O as Ve,Pb as F,Qb as D,Ta as v,Wa as C,_ as $e,bb as ke,ma as k,ua as be,wa as Xe,ya as Ze}from"./chunk-TB7HFPBB.js";import{d as E,g as V,j as Ge,k as j}from"./chunk-773TIA5M.js";import{e as Ye,g as h}from"./chunk-VKWPEFWQ.js";h();h();h();var ns=".shopifyignore",wt=/templates\/\*(\.(json|liquid))?$/,Tt=new Set;function Le(e,t={}){let s=t.ignoreFromFile??[],n=t.ignore??[],r=t.only??[],[o=[],i=[]]=Ie(s),[a=[],u=[]]=Ie(n),[m=[],c=[]]=Ie(r),l=e.filter(B(o,".shopifyignore"));return l=l.filter(B(a,"--ignore")),l=l.filter(B(m,"--only",!0)),i.length>0&&(l=l.concat(e.filter(B(i,".shopifyignore",!0)))),u.length>0&&(l=l.concat(e.filter(B(u,"--ignore",!0)))),c.length>0&&(l=l.filter(B(c,"--only"))),Ve(l,f=>f.key)}function B(e,t,s=!1){return({key:n})=>{if(e.length===0)return!0;let r=e.some(i=>rs(n,i)||as(i)&&is(n,cs(i)));return(s?!r:r)?(F(`Ignoring theme file ${n} via ${t}...`),!1):!0}}async function Rt(e){let t=E(e,ns);return await v(t)?(await k(t,{encoding:"utf8"})).split(/(\r\n|\r|\n)/).map(r=>r.trim()).filter(r=>r&&!r.startsWith("#")):[]}function Ie(e){let t=e.filter(n=>n.startsWith("!")).map(n=>n.slice(1));return[e.filter(n=>!n.startsWith("!")),t]}function rs(e,t){let s={matchBase:!0,noglobstar:!0};return ke(e,t,s)?!0:(!t.includes("*")&&t.endsWith("/")&&!Tt.has(t)&&(Tt.add(t),_({headline:"Directory pattern may be misleading.",body:`For more reliable matching, consider using "${t}*" or "${t}*.<file_extension>" instead.`})),os(t)?ke(e,t.replace(wt,"templates/**/*$1"),s):!1)}function os(e){return wt.test(e)}function is(e,t){return t.test(e)}function as(e){return e.startsWith("/")&&e.endsWith("/")}function cs(e){return new RegExp(e.slice(1,-1))}h();import St from"fs/promises";var le=class{constructor(t){this.notifyPath=t,this.isValidUrl=this.validateUrl(t),this.notifyPath===""&&D("Notification skipped: notifyPath is an empty string")}async notify(t){if(this.notifyPath!=="")try{F(`Notifying filechange listener at ${this.notifyPath}...`),this.isValidUrl?await this.notifyUrl(t):await this.notifyFile(t)}catch(s){L(s);let n=`Failed to notify filechange listener at ${this.notifyPath}`;s instanceof Error&&(n=n.concat(`: ${s.message}`)),D(n)}}async notifyUrl(t){let s=await fetch(this.notifyPath,{method:"POST",body:JSON.stringify({files:[t]}),headers:{"Content-Type":"application/json"}});if(!s.ok)throw new Error(s.statusText)}async notifyFile(t){await St.writeFile(this.notifyPath,t),await St.utimes(this.notifyPath,new Date,new Date)}validateUrl(t){try{let s=new URL(t);return s.protocol==="http:"||s.protocol==="https:"}catch{return!1}}};h();h();h();import ls from"node:events";var Ft=["assets/**/*.*","locales/**/*.json","blocks/**/*.liquid","snippets/**/*.liquid"];function vt(e){let t=new Map,s=new Set,n=new ls,r=(c,l)=>{n.emit(c,l)},o=async c=>{let l=await pe(e,c),p=de(c,l),f=typeof l=="string"?l:"",x=Buffer.isBuffer(l)?l.toString("base64"):"";return t.set(c,M({key:c,checksum:p,value:f,attachment:x})),l},i=C(Ft,{cwd:e,deep:3,ignore:W}).then(c=>Promise.all(c.map(o))),a=(c,l)=>{let p=V(e,l),f=o(p).then(()=>{let x=t.get(p);return s.add(x.key),x.value??x.attachment??""});tt(5).then(()=>{s.delete(p)}).catch(()=>{}),r(c,{fileKey:p,onContent:x=>{f.then(P=>{P&&x(P)}).catch(()=>{})},onSync:x=>{}})},u=c=>{let l=V(e,c);s.delete(l),t.delete(l),r("unlink",{fileKey:l,onSync:p=>p()})},m=new Set(Ft.map(c=>E(e,c.split("/").shift()??"")));return{root:e,files:t,unsyncedFileKeys:s,ready:async()=>i.then(()=>{}),delete:async c=>{t.delete(c)},write:async c=>{t.set(c.key,c)},read:o,addEventListener:(c,l)=>{n.on(c,l)},startWatcher:async()=>{let{default:c}=await import("./chokidar-VDIVGBZH.js");c.watch([...m],{ignored:W,persistent:!process.env.SHOPIFY_UNIT_TEST,ignoreInitial:!0}).on("add",a.bind(null,"add")).on("change",a.bind(null,"change")).on("unlink",u.bind(null))}}}h();h();var ds="https://unpkg.com/@shopify/polaris@13.9.2/build/esm/styles.css";function Pt(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function $t(e){return(0,String.raw)`<!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>${e.title}</title>
5
- <link rel="stylesheet" href="${ds}" />
6
- </head>
7
- <body>
8
- <div style="display: flex; justify-content: center; padding-top: 2rem;">
9
- <div style="width: 80%;">
10
- <div class="Polaris-Banner Polaris-Banner--withinPage" tabindex="0" role="alert" aria-live="polite">
11
- <div class="Polaris-Box" style="--pc-box-width:100%">
12
- <div
13
- class="Polaris-BlockStack"
14
- style="--pc-block-stack-align:space-between;--pc-block-stack-order:column"
15
- >
16
- <div
17
- class="Polaris-Box"
18
- style="--pc-box-color: var(--p-color-text-critical-on-bg-fill); --pc-box-background: var(--p-color-bg-fill-critical); --pc-box-padding-block-start-xs: var(--p-space-300); --pc-box-padding-block-end-xs: var(--p-space-300); --pc-box-padding-inline-start-xs: var(--p-space-300); --pc-box-padding-inline-end-xs: var(--p-space-300); --pc-box-border-start-start-radius: var(--p-border-radius-300); --pc-box-border-start-end-radius: var(--p-border-radius-300);"
19
- >
20
- <div
21
- class="Polaris-InlineStack"
22
- style="--pc-inline-stack-align:space-between;--pc-inline-stack-block-align:center;--pc-inline-stack-wrap:nowrap;--pc-inline-stack-gap-xs:var(--p-space-200);--pc-inline-stack-flex-direction-xs:row"
23
- >
24
- <div
25
- class="Polaris-InlineStack"
26
- style="--pc-inline-stack-wrap:nowrap;--pc-inline-stack-gap-xs:var(--p-space-100);--pc-inline-stack-flex-direction-xs:row"
27
- >
28
- <span class="Polaris-Banner--textCriticalOnBgFill">
29
- <span class="Polaris-Icon">
30
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
31
- <path d="M10 6a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5a.75.75 0 0 1 .75-.75Z" />
32
- <path d="M11 13a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z" />
33
- <path
34
- fill-rule="evenodd"
35
- d="M17 10a7 7 0 1 1-14 0 7 7 0 0 1 14 0Zm-1.5 0a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0Z"
36
- />
37
- </svg>
38
- </span>
39
- </span>
40
- <h2 class="Polaris-Text--root Polaris-Text--headingSm Polaris-Text--break">
41
- ${e.header}
42
- </h2>
43
- </div>
44
- </div>
45
- </div>
46
- <div
47
- class="Polaris-Box"
48
- style="--pc-box-padding-block-start-xs:var(--p-space-300);--pc-box-padding-block-end-xs:var(--p-space-300);--pc-box-padding-block-end-md:var(--p-space-400);--pc-box-padding-inline-start-xs:var(--p-space-300);--pc-box-padding-inline-start-md:var(--p-space-400);--pc-box-padding-inline-end-xs:var(--p-space-300);--pc-box-padding-inline-end-md:var(--p-space-400)"
49
- >
50
- <div
51
- class="Polaris-BlockStack"
52
- style="--pc-block-stack-order:column;--pc-block-stack-gap-xs:var(--p-space-300)"
53
- >
54
- ${e.errors.map(s=>`
55
- <div>
56
- <span class="Polaris-Text--root Polaris-Text--headingSm">${Pt(s.message)}</span>
57
- <ul class="Polaris-List">
58
- <li class="Polaris-List__Item">${Pt(s.code)}</li>
59
- </ul>
60
- </div>`).join("")}
61
- </div>
62
- </div>
63
- </div>
64
- </div>
65
- </div>
66
- </div>
67
- </div>
68
- </body>
69
- </html>`}h();h();var ps=/<head(\s[^>]*)?>/i,je="https://cdn.shopify.com/storefront",us=`${je}/standard-events.js`,ms=`${je}/standard-events.dev.js`,bt=`${je}/standard-events-inspector.js`,kt="shopify-cli-standard-events-inspector",hs=new RegExp(`<script\\b[^>]*(?:\\bid=["']${qe(kt)}["']|\\bsrc=["']${qe(bt)}["'])[^>]*>`,"i"),fs=new RegExp(qe(us),"g");function ue(e){return hs.test(e)?e:e.replace(ps,t=>`${t}<script id="${kt}" src="${bt}" defer></script>`)}function _t(e){return e.replace(fs,ms)}function qe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}h();var It=80;function X(e,t,s){if(!gs(e)||s.type==="theme-extension")return;let n=e.path.length>It?`${e.path.substring(0,It)}...`:e.path,o=t.headers.get("server-timing")?.match(/cfRequestDuration;dur=([\d.]+)/)?.[1],i=o?`${Math.round(Number(o))}ms`:"",a=ys(t.status),u=e.method.padStart(6);re(ne`• ${ie.format(new Date)} Request ${q.raw("\xBB")} ${u} ${a(String(t.status))} ${n} ${q.gray(i)}`)}function gs(e){let t=[z,J,"/checkouts","/payments"],s=[".js",".css",".json",".map"];if(t.some(o=>e.path.startsWith(o)))return!1;let[n]=e.path.split("?"),r=j(n);return!s.includes(r)}function ys(e){return e<300?q.green:e<400?q.yellow:q.errorText}var J="/cdn/",z="/ext/cdn/",Ce="/api/collect",Es=/^\/cart\//,Lt=/^\/checkouts\/(?!internal\/)/,xs=/^\/account(\/login\/multipass(\/[^/]+)?|\/logout)?\/?$/,Ts=new RegExp(`^${J}`),ws=new RegExp(`^${z}`),Rs=/^\/api\/(unstable|\d{4}-\d{2})\/graphql\.json/,Ss=["/.well-known","/shopify/monorail","/mini-profiler-resources","/web-pixels-manager","/web-pixels@","/wpm","/services/",Ce,"/cdn-cgi/challenge-platform"],qt="_shopify_essential",Fs=new RegExp(`${qt}=([^;]*)(;|$)`);function jt(e,t){return $(async s=>{if(Ss.some(n=>s.path.startsWith(n)))return null;if(vs(s)){let n=s.path.split("?")[0]??"";return He(s,t).then(async r=>{if(X(s,r,t),r.ok){let o=n.split("/").at(-1)??"";if(t.localThemeFileSystem.files.has(`assets/${o}.liquid`)){let i=Z(await r.text(),t);return new Response(i,r)}}return r}).catch(async r=>{let{status:o,statusText:i,...a}=A(r,`Failed to proxy request to ${n}`);return o>=500&&!n.endsWith(".js.map")&&_(a),new Response(r.message,{status:o,statusText:i})})}})}function vs(e){if(e.method!=="GET"||e.path.match(Es)||e.path.match(Lt)||e.path.match(xs)||e.path.match(Ts)||e.path.match(ws))return!0;let[t]=e.path.split("?"),s=j(t),n=e.headers.get("accept")??"*/*";return s===".html"||n.includes("text/html")?!1:!!s||n!=="*/*"}function me(e){return e.session.storeFqdn.replace(/\\/g,"\\\\").replace(/\./g,"\\.")}function Ps(e){return Rs.test(e.path)}function Z(e,t){let s=e,n=`(data-shs-beacon-endpoint=["'])https://${me(t)}${Ce}`,r=new RegExp(n,"g");s=s.replace(r,`$1${Ce}`);let o=new RegExp(`(https?:)?//${me(t)}${J}`,"g");s=s.replace(o,J);let i=/(?:https?:)?\/\/cdn\.shopify\.com\/(.*?\/(assets\/[^?#"'`>\s]+))/g,a=c=>c.startsWith("assets/"),u=new Set([...t.localThemeFileSystem.files.keys()].filter(a)),m=new Set([...t.localThemeExtensionFileSystem.files.keys()].filter(a));return s=s.replace(i,(c,l,p)=>{let f=p&&u.has(p),x=p&&m.has(p)&&l.startsWith("extensions/");return U(p).startsWith("image/")?c:x?`${z}${l}`:f?`${J}${l}`:c}),t.options.standardEventsDevBundle&&(s=_t(s)),s}function $s(e,t){let s=`http://${t.options.host}:${t.options.port}`,n=new RegExp(`data-base-url=["']((?:https?:)?//${me(t)})[^"']*?["']`,"g");return e.replace(n,(r,o)=>r.replace(o,s))}function bs(e,t){let s=new RegExp(`Domain=${me(t)};\\s*`,"gi");return e.map(n=>n.replace(s,""))}async function Q(e,t,s){let n=At(e,t);if(n.status>=300&&n.status<400)return n;t.headers.get("content-type")?.includes("application/json")||n.headers.set("content-type","text/html; charset=utf-8");let i=await n.text();return i=Z(i,e),i=$s(i,e),e.options.standardEventsInspector&&(i=ue(i)),s&&(i=s(i)??i),new Response(i,n)}var Ct=["connection","keep-alive","proxy-authenticate","proxy-authorization","te","trailer","transfer-encoding","upgrade","expect","content-security-policy","host"];function At(e,t){let s=new Response(t.body,t);s.headers.delete("content-length"),s.headers.delete("content-encoding");for(let i of Ct)s.headers.delete(i);s.headers.delete("access-control-allow-origin"),s.headers.delete("access-control-allow-credentials"),s.headers.delete("access-control-allow-methods"),s.headers.delete("access-control-allow-headers"),s.headers.delete("access-control-expose-headers"),s.headers.delete("access-control-max-age");let n=s.headers.get("Link");n&&s.headers.set("Link",Z(n,e));let r=s.headers.get("Location");if(r){let i=new URL(r,"https://shopify.dev");Lt.test(i.pathname)||(i.searchParams.delete("_fd"),i.searchParams.delete("pb"),s.headers.set("Location",i.href.replace(i.origin,"")))}let o=s.headers.getSetCookie();if(o?.length){s.headers.set("Set-Cookie",bs(o,e).join(","));let i=o.join(",").match(Fs)?.[1];i&&(e.session.sessionCookies[qt]=i)}return s}function Ae(e){let t=st(e);for(let n of Ct)delete t[n];delete t["upgrade-insecure-requests"];let s=nt(e);return s&&(t["X-Forwarded-For"]=s),t}function He(e,t){let s=e.path.replace(new RegExp(z,"g"),"/"),n=e.path.startsWith(z)?"cdn.shopify.com":t.session.storeFqdn,r=new URL(s,`https://${n}`);if(r.hostname!==n)return Promise.reject(new Error(`Request failed: Hostname mismatch. Expected host: ${n}. Resulting URL hostname: ${r.hostname}`));let o=rt(e),i=Ae(e);return Ps(e)||(/\/assets\/[^/]+\.(css|js)$/.test(r.pathname)&&/\?\d+$/.test(r.search)&&(r.search=`?v=${Date.now()}`),r.searchParams.set("_fd","0"),r.searchParams.set("pb","0"),i=ht({...i,...mt(),...n===t.session.storeFqdn?t.session.crawlerSignatureHeaders:{},referer:r.origin,Cookie:yt(t.session,{headers:i}),...t.type==="theme"?{Authorization:`Bearer ${t.session.storefrontToken}`}:{}})),fetch(r,{method:e.method,body:o,duplex:o?"half":void 0,redirect:"manual",headers:i}).then(a=>At(t,a)).catch(a=>{throw ae(L(a),r)})}var De=0,ks=5;function Dt(e,t){return $(s=>{let[n="/",r=""]=s.path.split("?");return Is(s)&&(t.lastRequestedPath=s.path),t.options.errorOverlay!=="silent"&&t.localThemeFileSystem.uploadErrors.size>0?Ht(t,{status:500,statusText:"Internal Server Error"},{title:"Failed to Upload Theme Files",header:"Upload Errors",errors:Array.from(t.localThemeFileSystem.uploadErrors.entries()).map(([i,a])=>({message:i,code:a.join(`
70
- `)}))}):ce(t.session,{method:s.method,path:n,query:[...new URLSearchParams(r)],themeId:String(e.id),sectionId:"",headers:Ae(s),replaceExtensionTemplates:fe(t),replaceTemplates:Oe(t,n,ot(s,"localization")?.toLowerCase())}).then(async i=>{if(i.status>=400&&i.status<500&&!_s(s)){let a=await Ls(s,t,i);if(a)return X(s,a,t),a}return X(s,i,t),Q(t,i,a=>(qs(i,a,String(e.id)),De=0,Ne(a,t)))}).catch(async i=>{if(i instanceof he&&(F(`Theme ID mismatch: expected ${i.getExpectedThemeId()} but got ${i.getActualThemeId()}; refreshing session...`),H("theme-service:error-page:theme-id-mismatch"),t.session.refresh)){De++,De>ks&&(et(new se(i.getMessage())),process.exit(1)),await t.session.refresh();let f=new URLSearchParams(r),x=new URLSearchParams([...f].filter(([ve])=>!ve.startsWith("__sfr"))),P=n+(x.toString()?`?${x}`:"");return new Response(null,{status:302,headers:{Location:P}})}let{status:a,statusText:u,cause:m,...c}=A(i,"Failed to render storefront"),[l,...p]=c.headline.split(`
71
- `);return te(c),Ht(t,{status:a,statusText:u},{title:l,header:l,errors:[{message:[...p,m.message].join("<br>"),code:m.stack?.replace(`${m.message}
72
- `,"")??""}]})})})}function Ht(e,t,s){let n=Ne($t(s),e);return e.options.standardEventsInspector&&(n=ue(n)),H("theme-service:error-page:rendered"),new Response(n,{...t,headers:t.headers??{"Content-Type":"text/html; charset=utf-8"}})}function _s(e){let t=new URLSearchParams(e.path.split("?")[1]);return["section_id","sections","app_block_id"].some(s=>t.has(s))}function Is(e){return e.headers.get("sec-fetch-mode")==="navigate"}async function Ls(e,t,s){F(`Render failed for ${e.path} with ${s.status} (x-request-id: ${s.headers.get("x-request-id")}), trying proxy...`);let n=await He(e,t).catch(r=>new Response(null,A(r)));if(n.status<400)return F(`Proxy status: ${n.status}. Returning proxy response.`),t.options.standardEventsInspector&&(n.headers.get("content-type")??"").includes("text/html")?Q(t,n):n;F(`Proxy status: ${n.status}. Returning render error.`)}function qs(e,t,s){let n=t.match(/Shopify\.theme\s*=\s*{[^}]+?"id":\s*"?(\d+)"?(}|,)/)?.[1];if(n&&n!==s)throw new he(s,n,e)}var he=class extends Error{constructor(t,s,n){super([`Theme ID mismatch: expected ${t} but got ${s}.`,`Request ID: ${n.headers.get("x-request-id")}`,`URL: ${n.url}`,"This is likely related to an issue in upstream Shopify APIs.","Please try again in a few minutes and report this issue:","https://community.shopify.dev/c/shopify-cli-libraries/14"].join(`
73
- `)),this.response=n,this.expectedThemeId=t,this.actualThemeId=s}getMessage(){return this.message}getResponse(){return this.response}getExpectedThemeId(){return this.expectedThemeId}getActualThemeId(){return this.actualThemeId}};h();h();function ge(e,t){let s=new RegExp(`{%-?\\s*${t}\\s*-?%}`),n=new RegExp(`{%-?\\s*end${t}\\s*-?%}`),r=s.exec(e);if(!r)return;let o=r.index+r[0].length;n.lastIndex=o;let i=n.exec(e);if(!i)return;let a=i.index;return e.slice(o,a)}h();function ye(e){let{pathname:t,search:s,searchParams:n}=new URL(e.path,"http://e.c");return{pathname:t,search:s,searchParams:n}}var js={stylesheet:new Map,javascript:new Map};function Ot(e,t){return $(async s=>{if(s.method!=="GET")return;if(Ds(s,t))return Os(s,t);let{file:n,fileKey:r,isUnsynced:o}=Hs(s,t);if(!r)return;let i=U(r);if(i.startsWith("image/")&&s.path.includes("&")&&!o)return;if(at(s,"X-Local-Asset","true"),!n){o&&N(s,O({statusCode:404,statusMessage:"Not found"}));return}let a=n.value?Buffer.from(Z(n.value,t)):Buffer.from(n.attachment??"","base64");return oe(s,{getContents:()=>a,getMeta:()=>({type:i,size:a.length,mtime:n.stats?.mtime})})})}var Cs=/^(?:\/cdn\/(?!extensions\/).*?)?\/assets\/([^?]+)/,As=/^(?:\/(?:ext\/)?cdn\/extensions\/.*?)?\/assets\/([^?]+)/;function Hs(e,t){let s=(n,r)=>{let o=e.path.match(n)?.[1];if(o){let i=E("assets",o),a=r.files.get(i),u=r.unsyncedFileKeys.has(i);if(a||u)return{file:a,isUnsynced:u,fileKey:i}}};return s(Cs,t.localThemeFileSystem)??s(As,t.localThemeExtensionFileSystem)??{isUnsynced:!1,fileKey:void 0,file:void 0}}function Ds(e,t){return t.type==="theme"&&e.path.includes("/compiled_assets")}function Os(e,t){switch(ye(e).pathname.split("/").at(-1)){case"styles.css":return Ns(t,e);case"block-scripts.js":return We(t,e,"block");case"snippet-scripts.js":return We(t,e,"snippet");case"scripts.js":return We(t,e,"section");case void 0:break;default:break}}function Ns(e,t){let s=Ee(e,"section"),n=Ee(e,"block"),r=Ee(e,"snippet"),o=[`/*** GENERATED LOCALLY ***/
74
- `];for(let[,a]of[...s,...n,...r]){let u=Nt(a,"stylesheet");u&&o.push(u)}let i=o.join(`
75
- `);return oe(t,{getContents:()=>i,getMeta:()=>({type:"text/css",size:Buffer.byteLength(i),mtime:new Date})})}function We(e,t,s){let n=Ee(e,s),r=`${s}s`,o=[`
76
- /*** GENERATED LOCALLY ***/
77
-
78
- (function () {
79
- var __${r}__ = {};
80
-
81
- (function () {
82
- var element = document.getElementById("${r}-script");
83
- var attribute = element ? element.getAttribute("data-${r}") : "";
84
- var ${r} = attribute.split(",").filter(Boolean);
85
-
86
- for (var i = 0; i < ${r}.length; i++) {
87
- __${r}__[${r}[i]] = true;
88
- }
89
- })();`];for(let[a,u]of n){let m=a.split("/").pop()?.replace(".liquid",""),c=Nt(u,"javascript")??"";m&&c&&o.push(`
90
- (function () {
91
- if (!__${r}__["${m}"] && !Shopify.designMode) return;
92
- try {
93
- ${c}
94
- } catch (e) {
95
- console.error(e);
96
- }
97
- })();`)}o.push("})();");let i=o.join(`
98
- `);return oe(t,{getContents:()=>i,getMeta:()=>({type:"text/javascript",size:Buffer.byteLength(i),mtime:new Date})})}function Ee(e,t){return[...e.localThemeFileSystem.files.entries()].filter(([s])=>s.endsWith(".liquid")&&s.startsWith(`${t}s/`)).sort(([s],[n])=>s.localeCompare(n))}function Nt(e,t){let s=js[t],n=s.get(e.key);if(n?.checksum===e.checksum)return n.content;if(s.delete(e.key),!e.value)return;let r=[`/* ${e.key} */`],o=ge(e.value??"",t)?.trimEnd();if(o&&r.push(o),r.length>1){let i=r.join(`
99
- `);return s.set(e.key,{checksum:e.checksum,content:i}),i}}h();import*as Wt from"node:os";function Ws(e,t){let s=new Set,n=`:${t}`,r=e.toLowerCase().trim();if(s.add(`${r}${n}`),["localhost","127.0.0.1","::1","0.0.0.0"].includes(r)&&(s.add(`localhost${n}`),s.add(`127.0.0.1${n}`),s.add(`[::1]${n}`)),r==="0.0.0.0"||r==="::")for(let i of Object.values(Wt.networkInterfaces()))for(let a of i??[]){let u=a.address.toLowerCase().split("%")[0],c=a.family==="IPv6"?`[${u}]`:u;s.add(`${c}${n}`)}return s}function Ms(e){if(e)return e.toLowerCase().replace(/\.(?=:\d|$)/,"")}function Mt(e,t){let s=Ws(e,t);return $(n=>{let r=n.node.req.headers.host,o=Ms(r);if(!o||!s.has(o))return N(n,O({statusCode:400,statusMessage:"Bad Request",message:"Invalid Host header"}))})}h();function Ut(){return Bt()}function qr(){return Bt()}function Bt(){return{root:"",files:new Map,unsyncedFileKeys:new Set,uploadErrors:new Map,ready:()=>Promise.resolve(),delete:async e=>{},read:async e=>"",write:async e=>{},stat:async e=>({mtime:new Date,size:1}),addEventListener:()=>{},startWatcher:async()=>{}}}import{createServer as Us}from"node:http";async function zr(e,t){let s=await Js(e,t);return await zs(e,s),Bs(e,s)}function Bs(e,t){let s=dt();s.use(Mt(t.options.host,t.options.port)),s.use(Jt(e,t)),s.use(Ot(e,t)),s.use(jt(e,t)),s.use(Dt(e,t));let n=Us(pt(s));return{dispatch:s.handler.bind(s),start:async()=>new Promise(r=>n.listen({port:t.options.port,host:t.options.host},()=>r({close:async()=>{await Promise.all([new Promise(o=>{n.closeAllConnections(),n.close(o)})])}})))}}async function Js(e,t){let{adminSession:s,storefrontPassword:n,themeExtensionPort:r,themeExtensionDirectory:o,crawlerSignatureHeaders:i}=t,a="127.0.0.1",u=r??9293,m=Ut(),c=vt(o);return await c.ready(),{session:await Et(e.id.toString(),s,void 0,n,i),localThemeFileSystem:m,localThemeExtensionFileSystem:c,directory:o,type:"theme-extension",lastRequestedPath:"",options:{themeEditorSync:!1,noDelete:!1,ignore:[],only:[],host:a,port:u,liveReload:"hot-reload",standardEventsDevBundle:!1,standardEventsInspector:!1,open:!1,errorOverlay:"default"}}}async function zs(e,t){let s=t.localThemeExtensionFileSystem,n=({fileKey:r,onContent:o,onSync:i})=>{o(()=>{xe(e,t,i,{type:"update",key:r,payload:{isThemeExtension:!0}})})};return s.addEventListener("add",n),s.addEventListener("change",n),s.ready().then(async()=>s.startWatcher())}function fe(e){let t={},s=e.localThemeExtensionFileSystem;for(let n of s.unsyncedFileKeys){let r=s.files.get(n),o=r?.value??r?.attachment;o&&(t[n]=o)}return t}var Re=Ye(ut(),1);import Ys from"node:events";var Me=new Map,K=new Map;function zt(e,t){let s=(0,Re.parseJSON)(t,null,!0);if(!s)return;let n=s?.sections;n&&!e.startsWith("locales/")?K.set(e,Object.entries(n||{}).map(([r,{type:o}])=>[o,r])):K.delete(e)}function Ue(e){return!e.startsWith("assets/")&&[".liquid",".json"].includes(j(e))}function Oe(e,t,s){let n={},r=/^templates\/.+\.json$/,o=t?`${E("templates",t.replace(/^\//,"").replace(/\.html$/,"")||"index")}.json`:"",i=!!t&&e.localThemeFileSystem.files.has(o),a=/^locales\/.+\.json$/,u=!!s&&(e.localThemeFileSystem.files.has(`locales/${s}.json`)||e.localThemeFileSystem.files.has(`locales/${s}.default.json`));for(let m of e.localThemeFileSystem.unsyncedFileKeys)if(Ue(m)){if(i&&r.test(m)){if(m!==o)continue}else if(a.test(m)){if(u){if(!m.startsWith(`locales/${s}.`))continue}else if(!m.includes(".default."))continue}n[m]=e.localThemeFileSystem.files.get(m)?.value??""}return n}function co(e,t){let s=({fileKey:r,onContent:o,onSync:i})=>{let a=j(r);o(u=>{!Qs(r)&&Ue(r)&&a===".json"&&zt(r,u),xe(e,t,i,{type:"update",key:r,payload:Xs(r,t)})})},n=({fileKey:r,onSync:o})=>{K.delete(r),xe(e,t,o,{type:"delete",key:r})};return t.localThemeFileSystem.addEventListener("add",s),t.localThemeFileSystem.addEventListener("change",s),t.localThemeFileSystem.addEventListener("unlink",n),t.localThemeFileSystem.ready().then(async()=>{let r=[...t.localThemeFileSystem.files];return Promise.allSettled(r.map(async([o,i])=>{if(o.endsWith(".json")){let a=i.value??await t.localThemeFileSystem.read(o);a&&typeof a=="string"&&zt(o,a)}else o.endsWith(".liquid")&&Xt(i)}))})}var Gs="1",Gt=new Ys;function we(e){Gt.emit("hot-reload",{...e,version:Gs})}function Jt(e,t){return $(s=>{let n=s.headers.get("accept")==="text/event-stream",r=ye(s).searchParams;if(n){let o=lt(s);return Gt.on("hot-reload",i=>{o.push(JSON.stringify(i)).catch(a=>{_({headline:"Failed to send HotReload event.",body:a.stack})})}),we({type:"open",pid:String(process.pid),themeId:String(e.id)}),o.send().then(()=>o.flush())}if(r.has("hr-log")){let o=(0,Re.parseJSON)(r.get("hr-log")??"",null);return o&&(o.headline=`[HotReload] ${o.headline}`,o.type==="error"?te(o):o.type==="warn"?_(o):o.type==="info"?Ke(o):_({headline:`Unknown HotReload log type: ${o.type}`})),null}if(s.path===Vt)return k(Se()).then(o=>it(s,o,"application/javascript")).catch(o=>N(s,O({cause:o})));if(r.has("section_id")||r.has("app_block_id")){let o=r.get("section_key")??"",i=r.get("section_id")??"",a=r.get("app_block_id")??"",u=s.path.split("?")[0]??"",m=new URLSearchParams(r);if(m.delete("section_key"),m.delete("section_id"),m.delete("app_block_id"),m.delete("_fd"),m.delete("pb"),i===""&&a==="")return;let c={};if(i){let l=t.localThemeFileSystem.unsyncedFileKeys;if(l.has(o)){let p=t.localThemeFileSystem.files.get(o)?.value;if(!p)return"";c[o]=p}for(let p of l)if(p.endsWith(".json")){for(let[f,x]of K.get(p)??[])if(i.endsWith(`__${x}`)){let P=t.localThemeFileSystem.files.get(p)?.value;P&&(c[p]=P);continue}}}return ce(t.session,{method:s.method,path:u??"/",query:[...m.entries()],themeId:String(e.id),sectionId:i,appBlockId:a,replaceTemplates:c,headers:ct(s),replaceExtensionTemplates:fe(t)}).then(async l=>{if(!l.ok)throw H("theme-service:hot-reload:section:render-failed"),ae(l);return Q(t,l)}).catch(async l=>{let{status:p,statusText:f,...x}=A(L(l),"Failed to render section on Hot Reload");return H("theme-service:hot-reload:section:render-error"),a||_(x),new Response(null,{status:p,statusText:f})})}})}var ee=(e,t)=>we({themeId:String(e),type:"full",key:t});function xe(e,t,s,n){let r=()=>ee(e.id,n.key);if(t.options.liveReload==="off")return;if(t.options.liveReload==="full-page"){s(r);return}let o=String(e.id);we({sync:"local",themeId:o,...n}),s(()=>we({sync:"remote",themeId:o,...n}),r)}function Vs(e,t){let s=new Set;if(e.endsWith(".json")){let n=t.localThemeFileSystem.files.get(e)?.value;if(n){let r=(0,Re.parseJSON)(n,null,!0)?.sections;for(let o of Object.keys(r??{}))s.add(o)}}else{let n=e.match(/^sections\/(.+)\.liquid$/)?.[1];if(n)for(let[r,o]of K)for(let[i,a]of o)i===n&&s.add(a)}return[...s]}function Xs(e,t){let[s]=e.split("/"),n=t.localThemeFileSystem.files.get(e);return{sectionNames:s==="sections"?Vs(e,t):[],replaceTemplates:Ue(e)?Oe(t):{},updatedFileParts:n&&Xt(n)}}var Te="hot-reload-client",Zs="/cdn/shopifycloud/theme-hot-reload/theme-hot-reload.js",Yt=new RegExp(`<script id="${Te}"[^>]*>[^<]*</script>`),Vt="/@shopify/theme-hot-reload";function Ne(e,t){return t.options.liveReload==="off"?e.replace(Yt,""):process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD?e.replace(Yt,"").replace(/<\/head>/,`<script id="${Te}" src="${Vt}" defer></script></head>`):e.includes(`<script id="${Te}"`)?e:e.replace(/<\/head>/,`<script id="${Te}" src="${Zs}" defer></script></head>`)}function Qs(e){return e.startsWith("assets/")}function Xt(e){if(!(["sections/","snippets/","blocks/"].some(c=>e.key.startsWith(c))&&e.key.endsWith(".liquid")))return;let n={stylesheetTag:!1,javascriptTag:!1,schemaTag:!1,liquid:!1},r={checksum:e.checksum,liquid:"",stylesheetTag:"",javascriptTag:"",schemaTag:""},o=Me.get(e.key);if(o?.checksum===e.checksum||(Me.delete(e.key),!e.value))return n;let i=["stylesheet","javascript","schema"],a=c=>c?.replace(/\s+/g," ").trim(),u=e.value,m=(c,l)=>{u=u.replace(l,"");let p=a(l),f=`${c}Tag`;n[f]=!o||p!==o[f],r[f]=p};for(let c of i){let l=ge(e.value??"",c);l&&m(c,l)}return u=a(u.replace(/<!--[\s\S]*?-->/g,"").replace(/{%\s*comment\s*%}[\s\S]*?{%\s*endcomment\s*%}/g,"").replace(/{%\s*doc\s*%}[\s\S]*?{%\s*enddoc\s*%}/g,"")),r.liquid=u,n.liquid=!o||u!==o.liquid,Me.set(e.key,r),n}h();var Zt=Ye(ut(),1);function Ks(e){return(e.startsWith("templates/")||e.startsWith("sections/"))&&e.endsWith(".json")}async function Qt(e,t,s){if(Ks(s)){let n=E(e,"listings",t,s);if(await v(n))return n}}async function Kt(e,t){let s=E(e,"config","settings_data.json"),n=await k(s,{encoding:"utf8"}),r=(0,Zt.parseJSON)(n,null,!0);return r?(r.current=$e(t),JSON.stringify(r,null,2)):n}async function go(e,t){let s=E(e,"listings"),n=E(s,t);if(await v(n))return;let o=[];await v(s)&&(o=await C("*",{cwd:s,onlyDirectories:!0,deep:1}));let i=o.length>0?`Available presets: ${o.map(a=>`"${$e(a)}"`).join(", ")}`:'No presets found under "listings/"';throw new se(`Listing preset "${t}" was not found. ${i}.`,`Add the preset to config/settings_data.json and its corresponding "listings/${t}" folder, or remove the --listing flag to use the default theme settings.`)}import en from"node:events";import{fileURLToPath as tn}from"node:url";var sn=250,es=["assets/**/*.*","config/**/*.json","layout/**/*.liquid","locales/**/*.json","sections/**/*.{liquid,json}","blocks/**/*.liquid","snippets/**/*.liquid","templates/**/*.{liquid,json}","templates/customers/**/*.{liquid,json}"],b={layoutLiquidRegex:/^layout\/.+\.liquid$/,sectionLiquidRegex:/^sections\/.+\.liquid$/,blockLiquidRegex:/^blocks\/.+\.liquid$/,configSchemaRegex:/^config\/settings_schema\.json$/,configDataRegex:/^config\/settings_data\.json$/,sectionJsonRegex:/^sections\/.+\.json$/,templateJsonRegex:/^templates\/.+\.json$/,jsonRegex:/^(?!config\/).*\.json$/,contextualizedJsonRegex:/\.context\.[^.]+\.json$/i,staticAssetRegex:/^assets\/(?!.*\.liquid$)/};function Co(e,t){let s=new Map,n=new Map,r=new Set,o={ignoreFromFile:[],ignore:t?.filters?.ignore??[],only:t?.filters?.only??[]},i=new en,a=(d,g)=>{i.emit(d,g)},u=t?.notify?new le(t.notify):void 0,m=async d=>{let g=t?.listing?await rn(e,d,t.listing):await pe(e,d),y=de(d,g);return s.set(d,M({key:d,checksum:y,value:typeof g=="string"?g:"",attachment:Buffer.isBuffer(g)?g.toString("base64"):""})),g},c=C(es,{cwd:e,deep:3,ignore:W}).then(d=>Promise.all([Rt(e),...d.map(m)])).then(([d])=>{Array.isArray(d)&&o.ignoreFromFile.push(...d)}),l=d=>V(e,d),p=d=>Le([{key:d}],o).length===0;function f(d,g,y,T){if(process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD&&T===Se()){ee(g,T);return}let R=l(T);if(t?.listing&&R.startsWith(`listings/${t.listing}/`)){let w=R.replace(`listings/${t.listing}/`,"");if(w.startsWith("templates/")||w.startsWith("sections/"))R=w;else return}x(R).then(()=>{switch(d){case"add":case"change":return P(d,g,y,R);case"unlink":return ve(g,y,R,n)}}).catch(w=>{D(`Error handling file event for ${R}: ${w}`)})}function x(d){return u?.notify(d)??Promise.resolve()}let P=(d,g,y,T)=>{if(p(T))return;let R=s.get(T)?.checksum,w=m(T).then(async()=>{let S=s.get(T);if(S)return S.checksum!==R&&r.add(T),{value:S.value||void 0,attachment:S.attachment}}),I=w.then(S=>{if(S)return nn(r,n,T,g,y)(S)}).catch(_e(T,"upload"));a(d,{fileKey:T,onContent:S=>{w.then(Y=>{r.has(T)&&S(Y?.value??Y?.attachment??"")}).catch(()=>{})},onSync:(S,Y)=>{I.then(G=>{G?S():Y?.()}).catch(()=>{})}})},ve=(d,g,y,T)=>{if(p(y))return;T.delete(y),s.delete(y),r.add(y);let R=t?.noDelete?Promise.resolve():ft(Number(d),[y],g).then(async w=>{if(!w[0]?.success)throw new Error(`Failed to delete file "${y}" from remote theme.`);return r.delete(y),ts("delete",y),!0}).catch(w=>(_e(y,"delete")(w),!1));a("unlink",{fileKey:y,onSync:w=>{R.then(I=>{I&&w()}).catch(()=>{})}})},Pe=new Set(es.map(d=>E(e,d.split("/").shift()??"")));return t?.listing&&Pe.add(E(e,"listings",t.listing)),process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD&&Pe.add(Se()),{root:e,files:s,unsyncedFileKeys:r,uploadErrors:n,ready:()=>c,delete:async d=>{s.delete(d),await on(e,d)},write:async d=>{let g=(d.key.startsWith("templates/")||d.key.startsWith("sections/"))&&d.key.endsWith(".json");if(t?.listing&&g){let y=E("listings",t.listing,d.key),T=E(e,y),R=await v(T);s.set(d.key,M({key:d.key,checksum:d.checksum,value:d.value??"",attachment:d.attachment??""})),R?await Be(e,{...d,key:y}):await Be(e,d);return}s.set(d.key,M({key:d.key,checksum:d.checksum,value:d.value??"",attachment:d.attachment??""})),await Be(e,d)},read:m,applyIgnoreFilters:d=>Le(d,o),addEventListener:(d,g)=>{i.on(d,g)},startWatcher:async(d,g)=>{let{default:y}=await import("./chokidar-VDIVGBZH.js"),T=y.watch([...Pe],{ignored:W,persistent:!process.env.SHOPIFY_UNIT_TEST,ignoreInitial:!0}),R=new Map,w=(I,S)=>{let G=`${l(S)}:${I}`,ze=R.get(G);ze&&clearTimeout(ze);let ss=setTimeout(()=>{R.delete(G),f(I,d,g,S)},sn);R.set(G,ss)};T.on("add",w.bind(null,"add")).on("change",w.bind(null,"change")).on("unlink",w.bind(null,"unlink")).on("error",I=>{D(`File watcher error: ${I}`),L("theme-service:file-watcher:error")})}}}function nn(e,t,s,n,r){return async o=>{if(!e.has(s))return!1;let[i]=await gt(Number(n),[{key:s,...o}],r);if(!i?.success){let a=i?.errors?.asset??["Response was not successful."];throw t.set(s,a),ee(n,s),new Error(a.join(`
100
- `))}return t.delete(s)&&ee(n,s),e.delete(s),ts("update",s),!0}}async function Be(e,{key:t,attachment:s,value:n}){let r=E(e,t);if(await an(r),s){let o=Buffer.from(s,"base64");await be(r,o,{encoding:"base64"})}else await be(r,n??"")}async function pe(e,t){let s=Fe(t)?{encoding:"utf8"}:{},n=E(e,t);if(!await v(n)){F(`File ${n} can't be read because it doesn't exist...`);return}return k(n,s)}async function rn(e,t,s){if(t==="config/settings_data.json")return Kt(e,s);let n=await Qt(e,s,t);if(n){let r=Fe(t)?{encoding:"utf8"}:{};return k(n,r)}return pe(e,t)}async function on(e,t){let s=E(e,t);if(!await v(s)){F(`File ${s} can't be removed because it doesn't exist...`);return}await Ze(s)}function Ao(e){let t=[],s=[],n=[],r=[],o=[],i=[],a=[],u=[],m=[],c=[],l=[];return e.forEach(p=>{let f=p.key;f.endsWith(".liquid")?b.sectionLiquidRegex.test(f)?t.push(p):b.blockLiquidRegex.test(f)?c.push(p):b.layoutLiquidRegex.test(f)?l.push(p):s.push(p):b.configSchemaRegex.test(f)?a.push(p):b.configDataRegex.test(f)?u.push(p):b.jsonRegex.test(f)?b.contextualizedJsonRegex.test(f)?i.push(p):b.sectionJsonRegex.test(f)?n.push(p):b.templateJsonRegex.test(f)?r.push(p):o.push(p):b.staticAssetRegex.test(f)&&m.push(p)}),{sectionLiquidFiles:t,otherLiquidFiles:s,sectionJsonFiles:n,templateJsonFiles:r,contextualizedJsonFiles:i,otherJsonFiles:o,configSchemaFile:a,configDataFile:u,staticAssetFiles:m,blockLiquidFiles:c,layoutFiles:l}}function Fe(e){return xt({liquid:"application/liquid",sass:"text/x-sass",scss:"text/x-scss"}),["application/javascript","application/json","application/liquid","text/css","text/x-sass","text/x-scss","image/svg+xml"].includes(U(e))}async function Ho(e){let t=new Set(await C("*",{cwd:e,deep:1,onlyDirectories:!0}));return["config","layout","templates"].every(n=>t.has(n))}async function an(e){let t=cn(e);await v(t)||await Xe(t)}function cn(e){let t=Ge(e),s=e.lastIndexOf(t);return e.substring(0,s)}function ts(e,t){re(ne`• ${ie.format(new Date)} Synced ${q.raw("\xBB")} ${e} ${t}`)}function Se(){let e=process.env.SHOPIFY_CLI_LOCAL_HOT_RELOAD;return!e||e==="true"?E(tn(import.meta.url.split("/cli/")[0]??""),"theme-hot-reload/dist/theme-hot-reload.js"):e}function de(e,t){return t?Buffer.isBuffer(t)?Je(t):un(e)?ln(t):dn(e,t):""}function ln(e){let t=e;return t=t.replace(/\r\n/g,`
101
- `),t=t.replace(/\/\*[\s\S]*?\*\//,""),t=pn(t),Je(t)}function dn(e,t){let s=t;return Fe(e)&&(s=s.replace(/\r\n/g,`
102
- `)),Je(s)}function pn(e){let t=!1,s=!1,n="";for(let r of e)r==='"'&&!s&&(t=!t),!(!t&&(r===" "||r===`
103
- `))&&(n+=r,s=r==="\\"&&!s);return n}function Je(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);return Qe(t)}function Mo(e){let t=new Set(e.filter(({key:s})=>s.startsWith("assets/")&&s.endsWith(".liquid")).map(({key:s})=>s));return e.filter(({key:s})=>s.startsWith("assets/")?!t.has(`${s}.liquid`):!0)}function un(e){return e.endsWith("/settings_data.json")}export{Mo as a,jt as b,Dt as c,Ot as d,Mt as e,qr as f,zr as g,co as h,Jt as i,ee as j,go as k,Co as l,Ao as m,Ho as n};
@@ -1,2 +0,0 @@
1
- import{$ as z,la as j,ma as J,na as k,oa as W,pa as A,qa as q,ra as N,sa as B,ta as L,ua as K,va as R,wa as Q,xa as O,ya as Y}from"./chunk-4MLEL3VK.js";import{f as v,i as X,p as c}from"./chunk-R7QYSC6T.js";import{c as G}from"./chunk-5VRU3BT5.js";import{v as U,z as w}from"./chunk-EEEKSYWV.js";import{d as E,f as $}from"./chunk-IIFRDOYG.js";import{$ as b,Hb as H,Ta as P,Y as a,qa as I,wa as D,ya as V}from"./chunk-TB7HFPBB.js";import{d as C,j as F}from"./chunk-773TIA5M.js";import{g as s}from"./chunk-VKWPEFWQ.js";s();s();function Z(e){switch(e){case d.Offsite:return k;case d.CreditCard:return R;case d.CustomCreditCard:return L;case d.CustomOnsite:return N;case d.Redeemable:return A;case d.CardPresent:return O}}var d;(function(e){e.Offsite="payments_app",e.CreditCard="payments_app_credit_card",e.CustomCreditCard="payments_app_custom_credit_card",e.CustomOnsite="payments_app_custom_onsite",e.Redeemable="payments_app_redeemable",e.CardPresent="payments_app_card_present"})(d||(d={}));function ee(e,t){let i=e.activeVersion?.context??e.draftVersion?.context??Z(e.type);switch(i){case k:return x(e,t,W);case R:return x(e,t,Q);case L:return x(e,t,K);case N:return x(e,t,B);case A:return x(e,t,q);case O:return x(e,t,Y);default:throw new Error(`Unsupported extension: ${i}`)}}function x(e,t,i){let o=(e.activeVersion??e.draftVersion)?.config;if(!o)throw new Error("No config found for extension");let r=JSON.parse(o),l=i(r,t);l&&delete l.api_version;let p=e.activeVersion?.context??e.draftVersion?.context??Z(e.type);return{api_version:r.api_version,extensions:[{name:e.title,type:"payments_extension",handle:a(e.title.substring(0,c)),...l,targeting:[{target:`${p}`}]}]}}s();s();var fe=new Map(J.map(e=>[e[1],e[0]])),ue=(e,t)=>{let i=fe.get(e.uiType);if(!i)throw new E(`Field type ${e.uiType} is not supported`);let n={key:e.name,description:e.description??void 0,type:i};return t==="flow_action_definition"&&(n.name=e.label,n.required=e.required),n},me=(e,t)=>{let o={type:t==="flow_action_definition"?`${e.name.replace("_id","")}_reference`:`${e.uiType}_reference`};return t==="flow_action_definition"&&(o.required=e.required),e.uiType==="marketing-activity-id"&&(o.marketingActivityCreateUrl=e.marketingActivityCreateUrl,o.marketingActivityDeleteUrl=e.marketingActivityDeleteUrl),o},te=(e,t)=>t?t.map(n=>n.uiType==="commerce-object-id"||n.uiType==="marketing-activity-id"||j.includes(n.uiType)?me(n,e):ue(n,e)):[];function ie(e){let t=e.activeVersion?.config??e.draftVersion?.config;if(!t)throw new Error("No config found for extension");let i=e.type==="flow_action_definition"?"https://url.com/api/execute":void 0,n;if(e.type==="flow_trigger_discovery_webhook"){let o=JSON.parse(t);n={extensions:[{type:"flow_trigger_lifecycle_callback",name:e.title,handle:a(e.title.substring(0,c)),url:o.url}]}}else{let o=JSON.parse(t),r=te(e.type,o.fields??[]);n={extensions:[{type:e.type.replace("_definition",""),name:o.title,handle:a(e.title.substring(0,c)),description:o.description,runtime_url:o.url??i,config_page_url:o.custom_configuration_page_url,config_page_preview_url:o.custom_configuration_page_preview_url,validation_url:o.validation_url}],settings:(r?.length??0)>0?{fields:r}:void 0}}return n}s();s();var ne=e=>{let t=e.split("#");if(t.length!==2||t.some(l=>l===""||l===void 0))throw new Error("Invalid context");let i="admin",n=ge(t[0]??""),o=de(t[1]??""),r="link";return o==="selection"?[i,`${n}-index`,`${o}-action`,r].join("."):[i,`${n}-${o}`,"action",r].join(".")},de=e=>{switch(e.toLocaleLowerCase()){case"show":return"details";case"index":return"index";case"action":return"selection";case"fulfilled_card":return"fulfilled-card";default:throw new Error(`Invalid context location: ${e}`)}},ge=e=>e.toLocaleLowerCase()==="variants"?"product-variant":b(e.toLocaleLowerCase().replace(new RegExp("(s)$"),""));function oe(e,t,i){let n=e.activeVersion?.config??e.draftVersion?.config;if(!n)throw new Error("No config found for extension");let o=e.activeVersion?.context??e.draftVersion?.context;if(!o)throw new Error("No context found for link extension");let r=JSON.parse(n);if(i.embedded)try{let p=new URL(r.url),f=p.pathname.startsWith("/")?p.pathname.substring(1):p.pathname,u=new URL(`app://${f}`);u.search=p.search,u.hash=p.hash,r.url=u.toString()}catch{}return{extensions:[{type:"admin_link",name:r.text,handle:a(e.title.substring(0,c)),targeting:[{url:r.url,target:ne(o)}]}]}}s();var _e={facebook:"social",instagram:"social",google:"search",pinterest:"social",bing:"search",email:"email",snapchat:"social",sms:"sms",verizon_media:"display",ebay:"marketplace",tiktok:"social",flow:"email"},ye={facebook:"facebook.com",instagram:"instagram.com",google:"google.com",pinterest:"pinterest.com",bing:"bing.com",snapchat:"snapchat.com",verizon_media:null,email:null,sms:null,ebay:"ebay.com",tiktok:"tiktok.com",flow:null};function Ce(e){let t=new URL(e);return t.pathname+t.search+t.hash}function re(e){let t=e.activeVersion?.config??e.draftVersion?.config;if(!t)throw new Error("No config found for extension");let i=JSON.parse(t);return{extensions:[{type:"marketing_activity",name:e.title,handle:a(e.title.substring(0,c)),title:i.title,description:i.description,api_path:Ce(i.app_api_url),tactic:i.tactic,marketing_channel:_e[i.platform]??"",referring_domain:ye[i.platform]??"",is_automation:i.is_automation,use_external_editor:i.use_external_editor,preview_data:i.preview_data,fields:i.fields.map(({id:o,...r})=>r)}]}}s();function se(e){let t=e.activeVersion?.config??e.draftVersion?.config;if(!t)throw new Error("No config found for extension");let i=JSON.parse(t);return{extensions:[{type:"subscription_link_extension",name:e.title,handle:a(e.title.substring(0,c)),pattern:i.pattern}]}}var S=[{label:"Payments Extensions",value:"payments",extensionTypes:["payments_app","payments_app_credit_card","payments_app_custom_credit_card","payments_app_custom_onsite","payments_app_redeemable","payments_extension"],buildExtensionConfig:ee},{label:"Flow Extensions",value:"flow",extensionTypes:["flow_action_definition","flow_trigger_definition","flow_trigger_discovery_webhook"],buildExtensionConfig:ie},{label:"Marketing Activity Extensions",value:"marketing activity",extensionTypes:["marketing_activity_extension"],buildExtensionConfig:re},{label:"Subscription Link Extensions",value:"subscription link",extensionTypes:["subscription_link","subscription_link_extension"],buildExtensionConfig:se},{label:"Admin Link extensions",value:"link extension",extensionTypes:["app_link","bulk_action"],buildExtensionConfig:oe}];function ae(e){return S.filter(t=>t.extensionTypes.some(i=>e.some(n=>n.type.toLowerCase()===i.toLowerCase())))}async function ut(e){if(e.length===1&&e[0])return e[0];let t=e.map(o=>({label:o.label,value:o.value})),i=await w({message:"Extension type to migrate",choices:t}),n=e.find(o=>o.value===i);if(n===void 0)throw new E("Invalid migration choice");return n}s();var kt=S.flatMap(e=>e.extensionTypes),g;(function(e){e.Write="write",e.Skip="skip",e.Cancel="cancel"})(g||(g={}));async function Ee({name:e,app:t}){let i=b(e),n=C(t.directory,X.extensions.directoryName,i);if(await P(n)){let o=[{label:"Overwrite local TOML with remote configuration",value:g.Write},{label:"Keep local TOML",value:g.Skip},{label:"Cancel",value:g.Cancel}],r=await w({message:`Directory "${i}" already exists. What would you like to do?`,choices:o});if(r===g.Cancel)throw new $;return{directory:n,action:r}}return await D(n),await I(C(n,v.lockFile)),{directory:n,action:g.Write}}async function xe(e){let{app:t,remoteApp:i,developerPlatformClient:n,extensionTypes:o,extensions:r,buildExtensionConfig:l,all:p}=e,f=r.filter(m=>o.includes(m.type.toLowerCase()));if(f=we(t,f),f.length===0)throw new E("No extensions to migrate");if(!p){let m=f.map(y=>({label:y.title,value:y.uuid}));f.length>1&&m.push({label:"All",value:"All"});let _=await w({message:"Extensions to migrate",choices:m});_!=="All"&&(f=[f.find(y=>y?.uuid===_)])}let u={},h=f.map(async m=>{let{directory:_,action:y}=await Ee({app:t,name:m.title}),ce=a(m.title.substring(0,c));if(u[ce]=m.uuid,y===g.Write){let M=l(m,r,t.configuration),le=C(_,"shopify.extension.toml");await new G(le,M).replace(M);let pe=C(_,v.lockFile);await V(pe)}return{extension:m,directory:C("extensions",F(_))}}),T=await Promise.all(h);be(T),await z({app:t,identifiers:{extensions:u,app:i.apiKey},command:"import-extensions",developerPlatformClient:n})}function we(e,t){let i=e.dotenv?.variables??{},n=e.allExtensions.map(o=>i[o.idEnvironmentVariableName]);return t.filter(o=>!n.includes(o.uuid))}async function At(e){let t=ae(e.extensions);await Promise.all(t.map(async i=>xe({...e,extensionTypes:i.extensionTypes,buildExtensionConfig:i.buildExtensionConfig,all:!0})))}function be(e){U({headline:["Imported the following extensions from the dashboard:"],body:e.map(t=>H`• "${t.extension.title}" at: ${t.directory}`.value).join(`
2
- `)})}s();async function Rt({developerPlatformClient:e,apiKey:t,organizationId:i,extensionTypes:n,onlyDashboardManaged:o=!1}){let r=await e.appExtensionRegistrations({id:t,apiKey:t,organizationId:i}),{dashboardManagedExtensionRegistrations:l,extensionRegistrations:p}=r.app;return(o?l:p.concat(l)).filter(u=>{let h=n.includes(u.type.toLowerCase()),T=u.activeVersion&&u.activeVersion.config,m=u.draftVersion&&u.draftVersion.config;return h&&(T??m)})}export{ae as a,ut as b,kt as c,xe as d,we as e,At as f,Rt as g};
@@ -1,2 +0,0 @@
1
- import{a as b}from"./chunk-J3JPJCWP.js";import{a as fe}from"./chunk-EOJNSPIH.js";import{b as re,c as oe,d as se,e as ne,f as ie,h as ae,i as le,k as ce,l as me,n as de}from"./chunk-DN3BB4IO.js";import{c as ee,e as te}from"./chunk-N6IFIMC6.js";import{a as X}from"./chunk-KQTVJMV6.js";import{c as Q,e as v,m as Z,n as x}from"./chunk-HSVZU7MP.js";import{k as P,l as V,n as y}from"./chunk-I5X3IP6T.js";import{s as C,u as k}from"./chunk-4P54DKG4.js";import{a as B,b as N}from"./chunk-KFUOVO3X.js";import{o as K,s as J,t as z,u as Y,w as j}from"./chunk-Q7BOSHWX.js";import{ta as $,xa as L}from"./chunk-TIU7MMRT.js";import{a as O}from"./chunk-5C7HDTHJ.js";import{J as U,s as W,u as I,v as M,w as R,y as q,z as G}from"./chunk-EEEKSYWV.js";import{d as _,e as H}from"./chunk-7AY6HLQG.js";import{d as g}from"./chunk-IIFRDOYG.js";import{Fb as w,Hb as E,Mb as T,Pb as u}from"./chunk-TB7HFPBB.js";import{u as p}from"./chunk-A4SBXDZB.js";import{g as d}from"./chunk-VKWPEFWQ.js";d();d();d();d();var he={workPromise:Promise.resolve()};async function ue(e,t,o,r,s){if(o.length===0)return he;u("Initiating theme asset reconciliation process");let{filesOnlyPresentLocally:a,filesOnlyPresentOnRemote:i,filesWithConflictingChecksums:l}=Ce(o,r),n=a.length===0&&i.length===0&&l.length===0;if(L(`theme-service:theme-reconciliation:manual:${n}`),n)return u("Local and remote checksums match - no need to reconcile theme assets"),he;let c=await Se({filesOnlyPresentLocally:a,filesOnlyPresentOnRemote:i,filesWithConflictingChecksums:l},s);return{workPromise:Ae(e,t,r,c)}}function Ce(e,t){let o=new Set,r=[],s=[];for(let i of e){o.add(i.key);let l=t.files.get(i.key);l?i.checksum!==l.checksum&&s.push(i):r.push(i)}let a=Array.from(t.files.values()).filter(i=>!o.has(i.key));return{filesOnlyPresentOnRemote:A(r,t),filesOnlyPresentLocally:A(a,t),filesWithConflictingChecksums:A(s,t)}}function A(e,t){return t.applyIgnoreFilters(e).filter(r=>r.key.endsWith(".json"))}async function S(e,t,o){if(e.length===0)return;I({body:{list:{title:t,items:e.map(s=>s.key)}}}),await G({message:"Reconciliation Strategy",choices:[{label:o.remote.label,value:D},{label:o.local.label,value:pe}]})===D?o.remote.callback(e):o.local.callback(e)}async function Ae(e,t,o,r){let{localFilesToDelete:s,filesToDownload:a,remoteFilesToDelete:i}=r,l=s.map(m=>o.delete(m.key)),n=b(a,k,async m=>{let f=await P(e.id,m.map(h=>h.key),t);return Promise.all(f.map(h=>{if(h)return o.write(h)}))}),c=V(e.id,i.map(m=>m.key),t);await Promise.all([...l,...n,c])}async function Se(e,t){let{filesOnlyPresentLocally:o,filesOnlyPresentOnRemote:r,filesWithConflictingChecksums:s}=e,a=[],i=[],l=[];return t.noDelete||await S(o,"The files listed below are only present locally. What would you like to do?",{remote:{label:"Delete files from the local directory",callback:n=>{a.push(...n)}},local:{label:"Upload local files to the remote theme",callback:()=>{}}}),await S(r,"The files listed below are only present on the remote theme. What would you like to do?",{remote:{label:"Download remote files to the local directory",callback:n=>{i.push(...n)}},local:{label:"Delete files from the remote theme",callback:n=>{l.push(...n)}}}),await S(s,"The files listed below differ between the local and remote versions. What would you like to do?",{remote:{label:"Keep the remote version",callback:n=>{i.push(...n)}},local:{label:"Keep the local version",callback:()=>{}}}),{localFilesToDelete:a,filesToDownload:i,remoteFilesToDelete:l}}d();var De=3e3,F=class extends Error{};function we(e,t,o,r,s,a){u("Listening for changes in the theme editor");let i=5,l=0,n="",c=o,m=async()=>{await new Promise(f=>setTimeout(f,De)),c=await Fe(e,t,c,r,s).then(f=>(l=0,n="",f)).catch(f=>{if(l++,f.message!==n&&(n=f.message,v("Error while polling for changes.",f)),l>=i){let h=new g("Too many polling errors...","Please check the errors above and ensure you have a stable internet connection.");q(h),a(h)}return c})};setTimeout(async()=>{for(;;)await m()})}async function Fe(e,t,o,r,s){let a=new Set(r.unsyncedFileKeys),i=ye(o,r,a),l=await y(e.id,t).then(m=>ye(m,r,a)),n=$e(i,l),c=Oe(l,i);return await He(r,n),await Le(e,t,r,n),await _e(r,c,s),l}function Oe(e,t){let o=new Map(e.map(s=>[s.key,s]));return t.filter(s=>o.get(s.key)===void 0)}function $e(e,t){let o=new Map(e.map(s=>[s.key,s]));return t.filter(s=>{let a=o.get(s.key);if(!a||a.checksum!==s.checksum)return!0})}async function Le(e,t,o,r){let s=r.filter(i=>o.files.get(i.key)?.checksum!==i.checksum),a=b(s,k,async i=>P(e.id,i.map(l=>l.key),t).then(l=>Promise.all(l.map(async n=>{n&&(await o.write(n),T(E`• ${C.format(new Date)} Synced ${w.raw("\xBB")} ${w.gray(`download ${n.key} from remote theme`)}`))}))));await Promise.all(a)}async function _e(e,t,o){if(!o.noDelete)return Promise.all(t.map(r=>{if(e.files.get(r.key))return e.delete(r.key).then(()=>{T(E`• ${C.format(new Date)} Synced ${w.raw("\xBB")} ${w.gray(`remove ${r.key} from local theme`)}`)})}))}async function He(e,t){let o=new Map(e.files);await Promise.all(t.map(r=>e.read(r.key)));for(let r of t){let s=o.get(r.key)?.checksum,a=e.files.get(r.key)?.checksum;if(s!==a)throw new F(`Detected changes to the file '${r.key}' on both local and remote sources. Aborting...`)}}function ye(e,t,o){return t.applyIgnoreFilters(e).filter(s=>s.key.endsWith(".json")).filter(s=>!o.has(s.key))}var pe="local",D="remote";async function ge(e,t,o,r,s,a){u("Initiating theme asset reconciliation process"),await r.ready();let{workPromise:i}=await ue(e,t,o,r,s);return{updatedRemoteChecksumsPromise:i.then(async()=>{let n=await y(e.id,t);return we(e,t,n,r,s,a),n}),workPromise:i}}d();function ke(){if(Promise.withResolvers)return Promise.withResolvers();let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}import{createServer as We}from"node:http";function Pe(e,t){let{promise:o,resolve:r,reject:s}=ke(),a=ae(e,t),i=Ie(e,t,s),l=Promise.all([a,i.workPromise]).then(()=>t.localThemeFileSystem.startWatcher(e.id.toString(),t.session)),n=qe(e,t,l);return{workPromise:l,serverStart:n.start,dispatchEvent:n.dispatch,renderDevSetupProgress:i.renderProgress,backgroundJobPromise:o,resolveBackgroundJob:r}}function Ie(e,t,o){let r=n=>(v("Failed to perform the initial theme synchronization.",n),o(n),new Promise(()=>{})),a=y(e.id,t.session).then(n=>Me(e,t,n,o)),i=a.then(async({updatedRemoteChecksumsPromise:n})=>{let c=await n;return fe(e,t.session,c,t.localThemeFileSystem,{nodelete:t.options.noDelete,deferPartialWork:!0,backgroundWorkCatch:r})});return{workPromise:i.then(n=>n.workPromise).catch(r),renderProgress:async()=>{if(t.options.themeEditorSync){let{workPromise:c}=await a;await te([{title:"Performing file synchronization. This may take a while...",task:async()=>{await c}}])}let{renderThemeSyncProgress:n}=await i;await n()}}}function Me(e,t,o,r){return t.options.themeEditorSync?ge(e,t.session,o,t.localThemeFileSystem,{noDelete:t.options.noDelete,ignore:t.options.ignore,only:t.options.only},r):Promise.resolve({updatedRemoteChecksumsPromise:Promise.resolve(o),workPromise:Promise.resolve()})}function qe(e,t,o){let r=Y(),s=[`http://${t.options.host}:${t.options.port}`,`https://${t.session.storeFqdn}`,"https://online-store-web.shopifyapps.com"];r.use(ne(t.options.host,t.options.port)),r.use(z(async()=>(await o,J(i=>{i.node.req.headers.origin&&K(i,{origin:n=>s.includes(n),credentials:!0,methods:["GET","POST","HEAD","OPTIONS"],preflight:{statusCode:204}})})))),t.options.liveReload!=="off"&&r.use(le(e,t)),r.use(se(e,t)),r.use(re(e,t)),r.use(oe(e,t));let a=We(j(r));return{dispatch:r.handler.bind(r),start:async()=>new Promise(i=>a.listen({port:t.options.port,host:t.options.host},()=>i({close:async()=>{await Promise.all([new Promise(l=>{a.closeAllConnections(),a.close(l)})])}})))}}import Ge from"readline";var Ue="127.0.0.1",Ke=9292,ve=!1;async function xt(e){if(!await de(e.directory)&&!await ee(e.force))return;e.password?.startsWith("shpat_")&&R({headline:"Admin API token missing features:",body:["Directly using an Admin API token will result in some missing features.","We recommend generating a password from the Theme Access app.","Alternatively, you can authenticate normally by not passing the --password flag.",`
2
- `,{list:{title:"Known limitations:",items:["Hot module reloading","Password protected storefronts"]}}],link:{label:"Theme Access app",url:"https://shopify.dev/docs/storefronts/themes/tools/theme-access"}}),e.listing&&await ce(e.directory,e.listing);let[t,o]=await Promise.all([Z(e.adminSession),Q(e.adminSession)]),r=o?await X(e.storePassword,e.adminSession.storeFqdn,t):void 0,s=ie(),a=me(e.directory,{filters:e,listing:e.listing,noDelete:e.noDelete,notify:e.notify}),i=e.host??Ue,l;if(e.port){if(!await N(e.port))throw new g(`Port ${e.port} is not available. Try a different port or remove the --port flag to use an available port.`);l=e.port}else l=await B(Ke);let n={local:`http://${i}:${l}`,giftCard:`http://${i}:${l}/gift_cards/[store_id]/preview`,themeEditor:`https://${e.store}/admin/themes/${e.theme.id}/editor?hr=${l}`,preview:`https://${e.store}/?preview_theme_id=${e.theme.id}`},m={session:await x(e.theme.id.toString(),e.adminSession,e.password,r,t),localThemeFileSystem:a,localThemeExtensionFileSystem:s,directory:e.directory,type:"theme",lastRequestedPath:"",options:{themeEditorSync:e["theme-editor-sync"],host:i,port:l,open:e.open,liveReload:e["live-reload"],standardEventsDevBundle:!0,standardEventsInspector:e["standard-events-inspector"],noDelete:e.noDelete,ignore:e.ignore,only:e.only,errorOverlay:e["error-overlay"]}},{serverStart:f,renderDevSetupProgress:h,backgroundJobPromise:Re,resolveBackgroundJob:Ee}=Pe(e.theme,m);Ge.emitKeypressEvents(process.stdin);let Te=ze(n,m,Ee);process.stdin.on("keypress",Te),await Promise.all([Re,h().then(f).then(()=>{process.stdin.isTTY&&process.stdin.setRawMode(!0),je(n),e.open&&be(n.local,"development server")})]),await Je(e.commandConfig,e.adminSession),process.exit(0)}async function Je(e,t){if(!ve){ve=!0;try{await _(()=>({store_fqdn_hash:O(t.storeFqdn)})),await H(()=>({store_fqdn:t.storeFqdn})),await $({config:e,exitMode:"ok"})}catch{}}}function ze(e,t,o){let r=W(be,100,{leading:!0,trailing:!1});return(s,a)=>{if(a.ctrl&&a.name==="c"){o();return}switch(a.name){case void 0:break;case"t":r(e.local,"localhost");break;case"p":r(e.preview,"theme preview");break;case"e":r(t.lastRequestedPath==="/"?e.themeEditor:`${e.themeEditor}&previewPath=${encodeURIComponent(t.lastRequestedPath)}`,"theme editor");break;case"g":r(e.giftCard,"gift card preview");break;default:break}}}function be(e,t){U(e).catch(Ye(t))}function Ye(e){return t=>{R({headline:`Failed to open ${e}.`,body:t.stack??t.message})}}function je(e){M({body:[{list:{title:p.bold("Preview your theme ")+p.cyan("(t)"),items:[{link:{url:e.local}}]}}],nextSteps:[[{link:{label:`Share your theme preview ${p.cyan("(p)")}`,url:e.preview}},{subdued:e.preview}],[{link:{label:`Customize your theme at the theme editor ${p.cyan("(e)")}`,url:e.themeEditor}}],[{link:{label:`Preview your gift cards ${p.cyan("(g)")}`,url:e.giftCard}}]]})}export{xt as a,be as b};