@epic-web/workshop-app 5.23.0 → 5.24.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 (147) hide show
  1. package/bin/epicshop.js +203 -37
  2. package/build/client/assets/{_basePickBy-B3Ji82Lk.js → _basePickBy-lB0X5x6U.js} +2 -2
  3. package/build/client/assets/{_basePickBy-B3Ji82Lk.js.map → _basePickBy-lB0X5x6U.js.map} +1 -1
  4. package/build/client/assets/{_baseUniq-BoGoqSUm.js → _baseUniq-BOjGYEEK.js} +2 -2
  5. package/build/client/assets/{_baseUniq-BoGoqSUm.js.map → _baseUniq-BOjGYEEK.js.map} +1 -1
  6. package/build/client/assets/{_exerciseNumber-DtILU6SM.js → _exerciseNumber-Dqi7TgL9.js} +2 -2
  7. package/build/client/assets/{_exerciseNumber-DtILU6SM.js.map → _exerciseNumber-Dqi7TgL9.js.map} +1 -1
  8. package/build/client/assets/{_exerciseNumber_.finished-CEK9anWX.js → _exerciseNumber_.finished-C5m6M0gM.js} +2 -2
  9. package/build/client/assets/{_exerciseNumber_.finished-CEK9anWX.js.map → _exerciseNumber_.finished-C5m6M0gM.js.map} +1 -1
  10. package/build/client/assets/{_layout-D1r_62oj.js → _layout-B_NrRv0S.js} +2 -2
  11. package/build/client/assets/{_layout-D1r_62oj.js.map → _layout-B_NrRv0S.js.map} +1 -1
  12. package/build/client/assets/{_layout-DzlTTMQ0.js → _layout-QRe2q83m.js} +2 -2
  13. package/build/client/assets/{_layout-DzlTTMQ0.js.map → _layout-QRe2q83m.js.map} +1 -1
  14. package/build/client/assets/{app-CQvK51s0.js → app-BYSDu0vh.js} +2 -2
  15. package/build/client/assets/{app-CQvK51s0.js.map → app-BYSDu0vh.js.map} +1 -1
  16. package/build/client/assets/{arc-rF8TbXNV.js → arc-DmQZ2TPB.js} +2 -2
  17. package/build/client/assets/{arc-rF8TbXNV.js.map → arc-DmQZ2TPB.js.map} +1 -1
  18. package/build/client/assets/{architectureDiagram-IEHRJDOE-D7gCCmY9.js → architectureDiagram-IEHRJDOE-BqPvrjLh.js} +2 -2
  19. package/build/client/assets/{architectureDiagram-IEHRJDOE-D7gCCmY9.js.map → architectureDiagram-IEHRJDOE-BqPvrjLh.js.map} +1 -1
  20. package/build/client/assets/{blockDiagram-JOT3LUYC-yGQOzhkw.js → blockDiagram-JOT3LUYC-D8OFd78i.js} +2 -2
  21. package/build/client/assets/{blockDiagram-JOT3LUYC-yGQOzhkw.js.map → blockDiagram-JOT3LUYC-D8OFd78i.js.map} +1 -1
  22. package/build/client/assets/{c4Diagram-VJAJSXHY-CTFjYF37.js → c4Diagram-VJAJSXHY-DjROjsr_.js} +2 -2
  23. package/build/client/assets/{c4Diagram-VJAJSXHY-CTFjYF37.js.map → c4Diagram-VJAJSXHY-DjROjsr_.js.map} +1 -1
  24. package/build/client/assets/channel-DnqeaSfB.js +2 -0
  25. package/build/client/assets/{channel-5s71-OE9.js.map → channel-DnqeaSfB.js.map} +1 -1
  26. package/build/client/assets/{chunk-4BMEZGHF-BIe0IUDz.js → chunk-4BMEZGHF-CNL-bCj2.js} +2 -2
  27. package/build/client/assets/{chunk-4BMEZGHF-BIe0IUDz.js.map → chunk-4BMEZGHF-CNL-bCj2.js.map} +1 -1
  28. package/build/client/assets/{chunk-A2AXSNBT-B-nCbUBj.js → chunk-A2AXSNBT-PeSyIKDm.js} +2 -2
  29. package/build/client/assets/{chunk-A2AXSNBT-B-nCbUBj.js.map → chunk-A2AXSNBT-PeSyIKDm.js.map} +1 -1
  30. package/build/client/assets/{chunk-AEK57VVT-B-cCHPs2.js → chunk-AEK57VVT-B1JqGB_s.js} +2 -2
  31. package/build/client/assets/{chunk-AEK57VVT-B-cCHPs2.js.map → chunk-AEK57VVT-B1JqGB_s.js.map} +1 -1
  32. package/build/client/assets/{chunk-D6G4REZN-EQ3R8OZx.js → chunk-D6G4REZN-C1e0nCkL.js} +2 -2
  33. package/build/client/assets/{chunk-D6G4REZN-EQ3R8OZx.js.map → chunk-D6G4REZN-C1e0nCkL.js.map} +1 -1
  34. package/build/client/assets/{chunk-RZ5BOZE2-h6svq8Xk.js → chunk-RZ5BOZE2-D5pIwNeA.js} +2 -2
  35. package/build/client/assets/{chunk-RZ5BOZE2-h6svq8Xk.js.map → chunk-RZ5BOZE2-D5pIwNeA.js.map} +1 -1
  36. package/build/client/assets/{chunk-XZIHB7SX-74-HFRcU.js → chunk-XZIHB7SX-FbrNggxP.js} +2 -2
  37. package/build/client/assets/{chunk-XZIHB7SX-74-HFRcU.js.map → chunk-XZIHB7SX-FbrNggxP.js.map} +1 -1
  38. package/build/client/assets/classDiagram-GIVACNV2-cXWx-aYi.js +2 -0
  39. package/build/client/assets/{classDiagram-GIVACNV2-CWogZCzR.js.map → classDiagram-GIVACNV2-cXWx-aYi.js.map} +1 -1
  40. package/build/client/assets/classDiagram-v2-COTLJTTW-cXWx-aYi.js +2 -0
  41. package/build/client/assets/{classDiagram-v2-COTLJTTW-CWogZCzR.js.map → classDiagram-v2-COTLJTTW-cXWx-aYi.js.map} +1 -1
  42. package/build/client/assets/clone-Bj8ANPCv.js +2 -0
  43. package/build/client/assets/{clone-nHZ14b_E.js.map → clone-Bj8ANPCv.js.map} +1 -1
  44. package/build/client/assets/{dagre-OKDRZEBW-Bq-HgVN8.js → dagre-OKDRZEBW-DT9ZQRxf.js} +2 -2
  45. package/build/client/assets/{dagre-OKDRZEBW-Bq-HgVN8.js.map → dagre-OKDRZEBW-DT9ZQRxf.js.map} +1 -1
  46. package/build/client/assets/{diagram-SSKATNLV-Cls675Lh.js → diagram-SSKATNLV-CcKCni9R.js} +2 -2
  47. package/build/client/assets/{diagram-SSKATNLV-Cls675Lh.js.map → diagram-SSKATNLV-CcKCni9R.js.map} +1 -1
  48. package/build/client/assets/{diagram-VNBRO52H-CJDqBhLa.js → diagram-VNBRO52H-DWoRAiqO.js} +2 -2
  49. package/build/client/assets/{diagram-VNBRO52H-CJDqBhLa.js.map → diagram-VNBRO52H-DWoRAiqO.js.map} +1 -1
  50. package/build/client/assets/{diff-8N5KyD7o.js → diff-BKR4usVv.js} +2 -2
  51. package/build/client/assets/{diff-8N5KyD7o.js.map → diff-BKR4usVv.js.map} +1 -1
  52. package/build/client/assets/{diff-Bu4t2NGL.js → diff-D5_VwPLF.js} +2 -2
  53. package/build/client/assets/{diff-Bu4t2NGL.js.map → diff-D5_VwPLF.js.map} +1 -1
  54. package/build/client/assets/{epic-video-DN9DRRHf.js → epic-video-CmlkW6Rw.js} +2 -2
  55. package/build/client/assets/{epic-video-DN9DRRHf.js.map → epic-video-CmlkW6Rw.js.map} +1 -1
  56. package/build/client/assets/{erDiagram-Q7BY3M3F-DdKn4jVQ.js → erDiagram-Q7BY3M3F-DXkEmvKk.js} +2 -2
  57. package/build/client/assets/{erDiagram-Q7BY3M3F-DdKn4jVQ.js.map → erDiagram-Q7BY3M3F-DXkEmvKk.js.map} +1 -1
  58. package/build/client/assets/{finished-B3G1RUDO.js → finished-MrsevkkK.js} +2 -2
  59. package/build/client/assets/{finished-B3G1RUDO.js.map → finished-MrsevkkK.js.map} +1 -1
  60. package/build/client/assets/{flowDiagram-4HSFHLVR-5Mg796nh.js → flowDiagram-4HSFHLVR-DCodZaNW.js} +2 -2
  61. package/build/client/assets/{flowDiagram-4HSFHLVR-5Mg796nh.js.map → flowDiagram-4HSFHLVR-DCodZaNW.js.map} +1 -1
  62. package/build/client/assets/{ganttDiagram-APWFNJXF-YO2fxWzG.js → ganttDiagram-APWFNJXF-TfB6wYvN.js} +2 -2
  63. package/build/client/assets/{ganttDiagram-APWFNJXF-YO2fxWzG.js.map → ganttDiagram-APWFNJXF-TfB6wYvN.js.map} +1 -1
  64. package/build/client/assets/{gitGraphDiagram-7IBYFJ6S-DQCZvhP_.js → gitGraphDiagram-7IBYFJ6S-D2NQnQv2.js} +2 -2
  65. package/build/client/assets/{gitGraphDiagram-7IBYFJ6S-DQCZvhP_.js.map → gitGraphDiagram-7IBYFJ6S-D2NQnQv2.js.map} +1 -1
  66. package/build/client/assets/{graph-BFAO9Sgp.js → graph-eJUngNSH.js} +2 -2
  67. package/build/client/assets/{graph-BFAO9Sgp.js.map → graph-eJUngNSH.js.map} +1 -1
  68. package/build/client/assets/{index-BfCSiT_X.js → index-9euhNa27.js} +2 -2
  69. package/build/client/assets/{index-BfCSiT_X.js.map → index-9euhNa27.js.map} +1 -1
  70. package/build/client/assets/index-DLC5u33j.js +36 -0
  71. package/build/client/assets/index-DLC5u33j.js.map +1 -0
  72. package/build/client/assets/{index-Dkt2MSig.js → index-DPHVg8Eh.js} +2 -2
  73. package/build/client/assets/{index-Dkt2MSig.js.map → index-DPHVg8Eh.js.map} +1 -1
  74. package/build/client/assets/infoDiagram-PH2N3AL5-D-nEozcT.js +3 -0
  75. package/build/client/assets/{infoDiagram-PH2N3AL5-x87RxSs8.js.map → infoDiagram-PH2N3AL5-D-nEozcT.js.map} +1 -1
  76. package/build/client/assets/{journeyDiagram-U35MCT3I-D5yGbOLJ.js → journeyDiagram-U35MCT3I-Dc8g8jIX.js} +2 -2
  77. package/build/client/assets/{journeyDiagram-U35MCT3I-D5yGbOLJ.js.map → journeyDiagram-U35MCT3I-Dc8g8jIX.js.map} +1 -1
  78. package/build/client/assets/{kanban-definition-NDS4AKOZ-BM6KyRww.js → kanban-definition-NDS4AKOZ-BwwcaZU2.js} +2 -2
  79. package/build/client/assets/{kanban-definition-NDS4AKOZ-BM6KyRww.js.map → kanban-definition-NDS4AKOZ-BwwcaZU2.js.map} +1 -1
  80. package/build/client/assets/{layout-qCiM2Jgn.js → layout-BAeq0-Is.js} +2 -2
  81. package/build/client/assets/{layout-qCiM2Jgn.js.map → layout-BAeq0-Is.js.map} +1 -1
  82. package/build/client/assets/{linear-B3zp51yW.js → linear-LWRPSVMz.js} +2 -2
  83. package/build/client/assets/{linear-B3zp51yW.js.map → linear-LWRPSVMz.js.map} +1 -1
  84. package/build/client/assets/{loading-BPTYJOXN.js → loading-b1FV2pQh.js} +2 -2
  85. package/build/client/assets/{loading-BPTYJOXN.js.map → loading-b1FV2pQh.js.map} +1 -1
  86. package/build/client/assets/{login-CfyUfm-m.js → login-Ci7cdiuj.js} +2 -2
  87. package/build/client/assets/{login-CfyUfm-m.js.map → login-Ci7cdiuj.js.map} +1 -1
  88. package/build/client/assets/{manifest-fe4b7228.js → manifest-c68964f2.js} +1 -1
  89. package/build/client/assets/{mdx-Dfsh6Vjk.js → mdx-C7imFHZE.js} +3 -3
  90. package/build/client/assets/{mdx-Dfsh6Vjk.js.map → mdx-C7imFHZE.js.map} +1 -1
  91. package/build/client/assets/{mermaid.core-ZaxoMXOj.js → mermaid.core-q9C-HfFu.js} +5 -5
  92. package/build/client/assets/{mermaid.core-ZaxoMXOj.js.map → mermaid.core-q9C-HfFu.js.map} +1 -1
  93. package/build/client/assets/{mindmap-definition-ALO5MXBD-CF3siXp6.js → mindmap-definition-ALO5MXBD-BhzLy0Zl.js} +2 -2
  94. package/build/client/assets/{mindmap-definition-ALO5MXBD-CF3siXp6.js.map → mindmap-definition-ALO5MXBD-BhzLy0Zl.js.map} +1 -1
  95. package/build/client/assets/{onboarding-5LC4kIVW.js → onboarding-c9ZuxLsm.js} +2 -2
  96. package/build/client/assets/{onboarding-5LC4kIVW.js.map → onboarding-c9ZuxLsm.js.map} +1 -1
  97. package/build/client/assets/{online-IWqRB9zP.js → online-DZKJk3C2.js} +2 -2
  98. package/build/client/assets/{online-IWqRB9zP.js.map → online-DZKJk3C2.js.map} +1 -1
  99. package/build/client/assets/{pieDiagram-IB7DONF6-B-gWQIHI.js → pieDiagram-IB7DONF6-CaTGj8RH.js} +2 -2
  100. package/build/client/assets/{pieDiagram-IB7DONF6-B-gWQIHI.js.map → pieDiagram-IB7DONF6-CaTGj8RH.js.map} +1 -1
  101. package/build/client/assets/{presence-BAL3jDku.js → presence-C9bUSihT.js} +2 -2
  102. package/build/client/assets/{presence-BAL3jDku.js.map → presence-C9bUSihT.js.map} +1 -1
  103. package/build/client/assets/{preview-D4amucCL.js → preview-CqZGJtsE.js} +2 -2
  104. package/build/client/assets/{preview-D4amucCL.js.map → preview-CqZGJtsE.js.map} +1 -1
  105. package/build/client/assets/{product-Cyum2biy.js → product-DJOWNuL-.js} +2 -2
  106. package/build/client/assets/{product-Cyum2biy.js.map → product-DJOWNuL-.js.map} +1 -1
  107. package/build/client/assets/{quadrantDiagram-7GDLP6J5-BQzo7p61.js → quadrantDiagram-7GDLP6J5-B4Od6z6p.js} +2 -2
  108. package/build/client/assets/{quadrantDiagram-7GDLP6J5-BQzo7p61.js.map → quadrantDiagram-7GDLP6J5-B4Od6z6p.js.map} +1 -1
  109. package/build/client/assets/{radar-MK3ICKWK-CM-Iz9PA.js → radar-MK3ICKWK-CENXhI0E.js} +2 -2
  110. package/build/client/assets/{radar-MK3ICKWK-CM-Iz9PA.js.map → radar-MK3ICKWK-CENXhI0E.js.map} +1 -1
  111. package/build/client/assets/{requirementDiagram-KVF5MWMF-DzaHc66R.js → requirementDiagram-KVF5MWMF-_w0WuUxy.js} +2 -2
  112. package/build/client/assets/{requirementDiagram-KVF5MWMF-DzaHc66R.js.map → requirementDiagram-KVF5MWMF-_w0WuUxy.js.map} +1 -1
  113. package/build/client/assets/{revalidation-ws-ho-umDqd.js → revalidation-ws-B0skixgr.js} +2 -2
  114. package/build/client/assets/{revalidation-ws-ho-umDqd.js.map → revalidation-ws-B0skixgr.js.map} +1 -1
  115. package/build/client/assets/root-JfOw9N7j.js +11 -0
  116. package/build/client/assets/root-JfOw9N7j.js.map +1 -0
  117. package/build/client/assets/{sankeyDiagram-QLVOVGJD-DfAVeZCk.js → sankeyDiagram-QLVOVGJD-Bt8556P1.js} +2 -2
  118. package/build/client/assets/{sankeyDiagram-QLVOVGJD-DfAVeZCk.js.map → sankeyDiagram-QLVOVGJD-Bt8556P1.js.map} +1 -1
  119. package/build/client/assets/{sequenceDiagram-X6HHIX6F-CljZRLoS.js → sequenceDiagram-X6HHIX6F-y2-oW3Ob.js} +2 -2
  120. package/build/client/assets/{sequenceDiagram-X6HHIX6F-CljZRLoS.js.map → sequenceDiagram-X6HHIX6F-y2-oW3Ob.js.map} +1 -1
  121. package/build/client/assets/{stateDiagram-DGXRK772-BzVfGv3W.js → stateDiagram-DGXRK772-B3BuD15b.js} +2 -2
  122. package/build/client/assets/{stateDiagram-DGXRK772-BzVfGv3W.js.map → stateDiagram-DGXRK772-B3BuD15b.js.map} +1 -1
  123. package/build/client/assets/{stateDiagram-v2-YXO3MK2T-8oX001yq.js → stateDiagram-v2-YXO3MK2T-BzFxWpqR.js} +2 -2
  124. package/build/client/assets/{stateDiagram-v2-YXO3MK2T-8oX001yq.js.map → stateDiagram-v2-YXO3MK2T-BzFxWpqR.js.map} +1 -1
  125. package/build/client/assets/{test-C14D-N72.js → test-DdUNKtkF.js} +2 -2
  126. package/build/client/assets/{test-C14D-N72.js.map → test-DdUNKtkF.js.map} +1 -1
  127. package/build/client/assets/{tests-6__AtHpI.js → tests-B1ak2CDI.js} +2 -2
  128. package/build/client/assets/{tests-6__AtHpI.js.map → tests-B1ak2CDI.js.map} +1 -1
  129. package/build/client/assets/{timeline-definition-BDJGKUSR-2TO9MtLY.js → timeline-definition-BDJGKUSR-DUa2yfAV.js} +2 -2
  130. package/build/client/assets/{timeline-definition-BDJGKUSR-2TO9MtLY.js.map → timeline-definition-BDJGKUSR-DUa2yfAV.js.map} +1 -1
  131. package/build/client/assets/{xychartDiagram-VJFVF3MP-Dh4nsbBT.js → xychartDiagram-VJFVF3MP-JztjcODi.js} +2 -2
  132. package/build/client/assets/{xychartDiagram-VJFVF3MP-Dh4nsbBT.js.map → xychartDiagram-VJFVF3MP-JztjcODi.js.map} +1 -1
  133. package/build/server/index.js +138 -163
  134. package/build/server/index.js.map +1 -1
  135. package/dist/server/index.js +82 -80
  136. package/package.json +3 -3
  137. package/build/client/assets/channel-5s71-OE9.js +0 -2
  138. package/build/client/assets/classDiagram-GIVACNV2-CWogZCzR.js +0 -2
  139. package/build/client/assets/classDiagram-v2-COTLJTTW-CWogZCzR.js +0 -2
  140. package/build/client/assets/clone-nHZ14b_E.js +0 -2
  141. package/build/client/assets/index-CEP3Xxa0.js +0 -36
  142. package/build/client/assets/index-CEP3Xxa0.js.map +0 -1
  143. package/build/client/assets/infoDiagram-PH2N3AL5-x87RxSs8.js +0 -3
  144. package/build/client/assets/root-tJmOmO9T.js +0 -11
  145. package/build/client/assets/root-tJmOmO9T.js.map +0 -1
  146. package/build/client/assets/update-repo-l0sNRNKZ.js +0 -2
  147. package/build/client/assets/update-repo-l0sNRNKZ.js.map +0 -1
@@ -139,6 +139,85 @@ ${lanUrl ? `${chalk.bold("On Your Network:")} ${chalk.cyan(lanUrl)}` : ""}
139
139
  ${chalk.bold("Press Ctrl+C to stop")}
140
140
  `.trim()
141
141
  );
142
+ if (process.env.EPICSHOP_DEPLOYED !== "true" && process.env.EPICSHOP_ENABLE_WATCHER === "true") {
143
+ const watches = /* @__PURE__ */ new Map();
144
+ const wss = new WebSocketServer({ noServer: true });
145
+ server.on("upgrade", (request, socket, head) => {
146
+ const url = new URL(request.url ?? "/", "ws://localhost:0000");
147
+ if (url.pathname === "/__ws") {
148
+ const origin = request.headers.origin;
149
+ const isValidOrigin = origin && (origin === `http://localhost:${portToUse}` || origin === `http://127.0.0.1:${portToUse}` || lanUrl && origin === lanUrl);
150
+ if (!isValidOrigin) {
151
+ socket.write("HTTP/1.1 403 Forbidden\r\n\r\n");
152
+ socket.destroy();
153
+ return;
154
+ }
155
+ wss.handleUpgrade(request, socket, head, (ws) => {
156
+ const watchPaths = url.searchParams.getAll("watch");
157
+ if (watchPaths.length === 0) {
158
+ socket.destroy();
159
+ return;
160
+ }
161
+ const key = watchPaths.join("&&");
162
+ let watcher = watches.get(key);
163
+ if (!watcher) {
164
+ const chok = chokidar.watch(watchPaths, {
165
+ cwd: getWorkshopRoot(),
166
+ ignoreInitial: true,
167
+ ignored: [
168
+ `/.git/`,
169
+ `/node_modules/`,
170
+ `/build/`,
171
+ `/server-build/`,
172
+ `/playwright-report/`,
173
+ `/dist/`,
174
+ `/.cache/`
175
+ ]
176
+ });
177
+ watcher = { clients: /* @__PURE__ */ new Set(), chok };
178
+ watches.set(key, watcher);
179
+ let timer = null;
180
+ let fileChanges = /* @__PURE__ */ new Set();
181
+ watcher.chok.on("all", (event, filePath) => {
182
+ fileChanges.add(path.join(getWorkshopRoot(), filePath));
183
+ if (timer) return;
184
+ timer = setTimeout(async () => {
185
+ for (const client of watcher?.clients ?? []) {
186
+ client.send(
187
+ JSON.stringify({
188
+ type: "epicshop:file-change",
189
+ data: { event, filePaths: Array.from(fileChanges) }
190
+ })
191
+ );
192
+ }
193
+ setModifiedTimesForAppDirs(...Array.from(fileChanges));
194
+ fileChanges = /* @__PURE__ */ new Set();
195
+ timer = null;
196
+ }, 50);
197
+ });
198
+ }
199
+ watcher.clients.add(ws);
200
+ ws.on("close", () => {
201
+ watcher?.clients.delete(ws);
202
+ if (watcher?.clients.size === 0) {
203
+ watches.delete(key);
204
+ void watcher.chok.close();
205
+ }
206
+ });
207
+ });
208
+ } else {
209
+ socket.destroy();
210
+ }
211
+ });
212
+ closeWithGrace(async () => {
213
+ await Promise.all([
214
+ ...Array.from(watches.values()).map((watcher) => watcher.chok.close()),
215
+ new Promise((resolve, reject) => {
216
+ wss.close((e) => e ? reject(e) : resolve("ok"));
217
+ })
218
+ ]);
219
+ });
220
+ }
142
221
  const hasUpdates = await hasUpdatesPromise;
143
222
  if (hasUpdates.updatesAvailable) {
144
223
  const updateCommand = chalk.blue.bold.bgWhite(" npx update-epic-workshop ");
@@ -149,7 +228,9 @@ ${chalk.bold("Press Ctrl+C to stop")}
149
228
  "updates available"
150
229
  )} for this workshop repository. \u{1F389}
151
230
 
152
- To get the updates, stop the server and run the following command:
231
+ To get the updates, ${chalk.green.bold.bgWhite(
232
+ `press the "u" key`
233
+ )} or stop the server and run the following command:
153
234
 
154
235
  ${updateCommand}
155
236
 
@@ -158,85 +239,6 @@ To view a diff, check:
158
239
  );
159
240
  }
160
241
  });
161
- if (process.env.EPICSHOP_DEPLOYED !== "true" && process.env.EPICSHOP_ENABLE_WATCHER === "true") {
162
- const watches = /* @__PURE__ */ new Map();
163
- const wss = new WebSocketServer({ noServer: true });
164
- server.on("upgrade", (request, socket, head) => {
165
- const url = new URL(request.url ?? "/", "ws://localhost:0000");
166
- if (url.pathname === "/__ws") {
167
- const origin = request.headers.origin;
168
- const isValidOrigin = origin && (origin === `http://localhost:${portToUse}` || origin === `http://127.0.0.1:${portToUse}` || lanUrl && origin === lanUrl);
169
- if (!isValidOrigin) {
170
- socket.write("HTTP/1.1 403 Forbidden\r\n\r\n");
171
- socket.destroy();
172
- return;
173
- }
174
- wss.handleUpgrade(request, socket, head, (ws) => {
175
- const watchPaths = url.searchParams.getAll("watch");
176
- if (watchPaths.length === 0) {
177
- socket.destroy();
178
- return;
179
- }
180
- const key = watchPaths.join("&&");
181
- let watcher = watches.get(key);
182
- if (!watcher) {
183
- const chok = chokidar.watch(watchPaths, {
184
- cwd: getWorkshopRoot(),
185
- ignoreInitial: true,
186
- ignored: [
187
- `/.git/`,
188
- `/node_modules/`,
189
- `/build/`,
190
- `/server-build/`,
191
- `/playwright-report/`,
192
- `/dist/`,
193
- `/.cache/`
194
- ]
195
- });
196
- watcher = { clients: /* @__PURE__ */ new Set(), chok };
197
- watches.set(key, watcher);
198
- let timer = null;
199
- let fileChanges = /* @__PURE__ */ new Set();
200
- watcher.chok.on("all", (event, filePath) => {
201
- fileChanges.add(path.join(getWorkshopRoot(), filePath));
202
- if (timer) return;
203
- timer = setTimeout(async () => {
204
- for (const client of watcher?.clients ?? []) {
205
- client.send(
206
- JSON.stringify({
207
- type: "epicshop:file-change",
208
- data: { event, filePaths: Array.from(fileChanges) }
209
- })
210
- );
211
- }
212
- setModifiedTimesForAppDirs(...Array.from(fileChanges));
213
- fileChanges = /* @__PURE__ */ new Set();
214
- timer = null;
215
- }, 50);
216
- });
217
- }
218
- watcher.clients.add(ws);
219
- ws.on("close", () => {
220
- watcher?.clients.delete(ws);
221
- if (watcher?.clients.size === 0) {
222
- watches.delete(key);
223
- void watcher.chok.close();
224
- }
225
- });
226
- });
227
- } else {
228
- socket.destroy();
229
- }
230
- });
231
- closeWithGrace(async () => {
232
- await Promise.all([
233
- ...Array.from(watches.values()).map((watcher) => watcher.chok.close()),
234
- new Promise((resolve, reject) => {
235
- wss.close((e) => e ? reject(e) : resolve("ok"));
236
- })
237
- ]);
238
- });
239
- }
240
242
  closeWithGrace(() => {
241
243
  return new Promise((resolve, reject) => {
242
244
  server.close((e) => e ? reject(e) : resolve());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epic-web/workshop-app",
3
- "version": "5.23.0",
3
+ "version": "5.24.0",
4
4
  "sideEffects": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -44,8 +44,8 @@
44
44
  "@epic-web/invariant": "^1.0.0",
45
45
  "@epic-web/remember": "^1.1.0",
46
46
  "@epic-web/restore-scroll": "^1.1.1",
47
- "@epic-web/workshop-presence": "5.23.0",
48
- "@epic-web/workshop-utils": "5.23.0",
47
+ "@epic-web/workshop-presence": "5.24.0",
48
+ "@epic-web/workshop-utils": "5.24.0",
49
49
  "@mdx-js/mdx": "^3.0.1",
50
50
  "@mux/mux-player-react": "^3.0.0",
51
51
  "@nasa-gcn/remix-seo": "^2.0.1",
@@ -1,2 +0,0 @@
1
- import{U as a,C as n}from"./mermaid.core-ZaxoMXOj.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
2
- //# sourceMappingURL=channel-5s71-OE9.js.map
@@ -1,2 +0,0 @@
1
- import{s as t,c as a,a as i,C as s}from"./chunk-A2AXSNBT-B-nCbUBj.js";import{_ as o}from"./mermaid.core-ZaxoMXOj.js";import"./chunk-RZ5BOZE2-h6svq8Xk.js";import"./mdx-Dfsh6Vjk.js";import"./index-Dsusf_Av.js";import"./misc-2sBiisF5.js";import"./components-5arJTWsS.js";import"./epic-video-DN9DRRHf.js";import"./index-CEP3Xxa0.js";import"./tooltip-Bzd6O8vq.js";import"./pe-BShc2dvc.js";import"./online-IWqRB9zP.js";import"./loading-BPTYJOXN.js";import"./user-DNSnhqGn.js";import"./workshop-config-DchzGYJM.js";import"./progress-bar-DgnkQxQw.js";var A={parser:i,get db(){return new s},renderer:a,styles:t,init:o(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{A as diagram};
2
- //# sourceMappingURL=classDiagram-GIVACNV2-CWogZCzR.js.map
@@ -1,2 +0,0 @@
1
- import{s as t,c as a,a as i,C as s}from"./chunk-A2AXSNBT-B-nCbUBj.js";import{_ as o}from"./mermaid.core-ZaxoMXOj.js";import"./chunk-RZ5BOZE2-h6svq8Xk.js";import"./mdx-Dfsh6Vjk.js";import"./index-Dsusf_Av.js";import"./misc-2sBiisF5.js";import"./components-5arJTWsS.js";import"./epic-video-DN9DRRHf.js";import"./index-CEP3Xxa0.js";import"./tooltip-Bzd6O8vq.js";import"./pe-BShc2dvc.js";import"./online-IWqRB9zP.js";import"./loading-BPTYJOXN.js";import"./user-DNSnhqGn.js";import"./workshop-config-DchzGYJM.js";import"./progress-bar-DgnkQxQw.js";var A={parser:i,get db(){return new s},renderer:a,styles:t,init:o(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{A as diagram};
2
- //# sourceMappingURL=classDiagram-v2-COTLJTTW-CWogZCzR.js.map
@@ -1,2 +0,0 @@
1
- import{b as r}from"./_baseUniq-BoGoqSUm.js";var e=4;function a(o){return r(o,e)}export{a as c};
2
- //# sourceMappingURL=clone-nHZ14b_E.js.map
@@ -1,36 +0,0 @@
1
- import{r as U,d as rr,j as M}from"./index-Dsusf_Av.js";import{I as Ge}from"./misc-2sBiisF5.js";import{S as nr}from"./tooltip-Bzd6O8vq.js";import{b as ar,c as ir,a as sr}from"./components-5arJTWsS.js";import{u as or}from"./pe-BShc2dvc.js";function yt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function N(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?yt(Object(r),!0).forEach(function(n){ur(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):yt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function ur(t,e,r){return e=cr(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function dr(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cr(t){var e=dr(t,"string");return typeof e=="symbol"?e:String(e)}function lr(t,e){var r=new FormData(t,e);if(e&&e.type==="submit"&&e.name!==""){var n=r.getAll(e.name);n.includes(e.value)||r.append(e.name,e.value)}return r}function L(t){return t?t.split(/\.|(\[\d*\])/).reduce((e,r)=>{if(typeof r<"u"&&r!==""&&r!=="__proto__"&&r!=="constructor"&&r!=="prototype")if(r.startsWith("[")&&r.endsWith("]")){var n=r.slice(1,-1);e.push(Number(n))}else e.push(r);return e},[]):[]}function G(t){return t.reduce((e,r)=>typeof r=="number"?"".concat(e,"[").concat(Number.isNaN(r)?"":r,"]"):e===""||r===""?[e,r].join(""):[e,r].join("."),"")}function de(t,e){return typeof e<"u"?G([...L(t),e]):t??""}function Oe(t,e){var r=L(t),n=L(e);return r.length>=n.length&&n.every((a,i)=>r[i]===a)}function fr(t,e){var r=typeof t=="string"?L(t):t,n=L(e);return n.length>=r.length&&r.every((a,i)=>n[i]===a)?n.slice(r.length):null}function X(t,e,r){for(var n=L(e),a=n.length,i=a-1,s=-1,o=t;o!=null&&++s<a;){var u=n[s],d=n[s+1],m=s!=i?Object.prototype.hasOwnProperty.call(o,u)&&o[u]!==null?o[u]:typeof d=="number"?[]:{}:r(o[u]);o[u]=m,o=o[u]}}function be(t,e){var r=t;for(var n of L(e)){if(typeof r>"u"||r==null)break;if(!Object.prototype.hasOwnProperty.call(r,n))return;if(Q(r)&&typeof n=="string")r=r[n];else if(Array.isArray(r)&&typeof n=="number")r=r[n];else return}return r}function Q(t){return!!t&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function hr(t){return typeof File>"u"?!1:t instanceof File}function ke(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(Q(t)){var r=Object.keys(t).sort().reduce((n,a)=>{var i=ke(t[a],e);return typeof i<"u"&&(n[a]=i),n},{});return Object.keys(r).length===0?void 0:r}if(Array.isArray(t))return t.length===0?void 0:t.map(n=>ke(n,e));if(!(typeof t=="string"&&t===""||t===null||hr(t)&&(!e||t.size===0)))return t}function ft(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={},a=(e=r.resolve)!==null&&e!==void 0?e:o=>o;function i(o,u){var d=ke(a(o));if(typeof d<"u"&&(n[u]=d),Array.isArray(o))for(var m=0;m<o.length;m++)i(o[m],"".concat(u,"[").concat(m,"]"));else if(Q(o))for(var[w,P]of Object.entries(o))i(P,u?"".concat(u,".").concat(w):w)}if(t){var s;i(t,(s=r.prefix)!==null&&s!==void 0?s:"")}return n}function Je(t,e){if(!t)throw new Error(e)}function ee(){return(Date.now()*Math.random()).toString(36)}function Ie(t){return JSON.parse(JSON.stringify(t))}function Rt(t){return t.tagName==="INPUT"}function $t(t){return t.tagName==="SELECT"}function mr(t){return t.tagName==="TEXTAREA"}function Ae(t){if(t instanceof Element){if(Rt(t))return t.type!=="submit"&&t.type!=="button"&&t.type!=="reset";if($t(t)||mr(t))return!0}return!1}function pr(t){var e,r,n=t.target,a=t.submitter;return(e=(r=a==null?void 0:a.getAttribute("formaction"))!==null&&r!==void 0?r:n.getAttribute("action"))!==null&&e!==void 0?e:"".concat(location.pathname).concat(location.search)}function vr(t){var e,r=t.target,n=t.submitter,a=(e=n==null?void 0:n.getAttribute("formenctype"))!==null&&e!==void 0?e:r.enctype;return a==="multipart/form-data"?a:"application/x-www-form-urlencoded"}function yr(t){var e,r,n=t.target,a=t.submitter,i=(e=(r=a==null?void 0:a.getAttribute("formmethod"))!==null&&r!==void 0?r:n.getAttribute("method"))===null||e===void 0?void 0:e.toUpperCase();switch(i){case"POST":case"PUT":case"PATCH":case"DELETE":return i}return"GET"}function gr(t,e){if(Je(!!t,"Failed to submit the form. The element provided is null or undefined."),typeof t.requestSubmit=="function")t.requestSubmit(e);else{var r=new SubmitEvent("submit",{bubbles:!0,cancelable:!0,submitter:e});t.dispatchEvent(r)}}function Xe(t){var e=new DataTransfer;if(Array.isArray(t))for(var r of t)e.items.add(r);else e.items.add(t);return e.files}function gt(t){if(typeof t>"u")return[null,null];if(t===null)return[[],Xe([])];if(typeof t=="string")return[[t],null];if(Array.isArray(t)){if(t.every(e=>typeof e=="string"))return[Array.from(t),null];if(t.every(e=>e instanceof File))return[null,Xe(t)]}return t instanceof FileList?[null,t]:t instanceof File?[null,Xe([t])]:[null,null]}function _t(t,e){var r,[n,a]=gt(e.value),[i]=gt(e.defaultValue);if(Rt(t))switch(t.type){case"file":{t.files=a;return}case"checkbox":case"radio":{if(n){var s=n.includes(t.value);(t.type==="checkbox"?s!==t.checked:s)&&t.click(),t.checked=s}i&&(t.defaultChecked=i.includes(t.value));return}}else if($t(t)){var o=n&&n.length===0;for(var u of t.options){if(n){var d=n.indexOf(u.value),m=d>-1;u.selected!==m&&(u.selected=m),m&&n.splice(d,1)}if(i){var w=i.indexOf(u.value),P=w>-1;u.defaultSelected!==P&&(u.defaultSelected=P),P&&i.splice(w,1)}}var V=new Set([...n??[],...i??[]]);for(var E of V)t.options.add(new Option(E,E,i==null?void 0:i.includes(E),n==null?void 0:n.includes(E)));o&&(t.selectedIndex=-1);return}var R=(r=n==null?void 0:n[0])!==null&&r!==void 0?r:"";if(t.value!==R){var{set:se}=Object.getOwnPropertyDescriptor(t,"value")||{},Se=Object.getPrototypeOf(t),{set:Ne}=Object.getOwnPropertyDescriptor(Se,"value")||{};if(Ne&&se!==Ne)Ne.call(t,R);else if(se)se.call(t,R);else throw new Error("The given element does not have a value setter")}if(i){var he;t.defaultValue=(he=i[0])!==null&&he!==void 0?he:""}}var je="__intent__",Qe="__state__";function Dt(t){var e=t.get(je),r=t.get(Qe);Je((typeof e=="string"||e===null)&&(typeof r=="string"||r===null),'The input name "'.concat(je,'" and "').concat(Qe,'" are reserved by Conform. Please use another name for your input.'));var n={payload:{},fields:new Set,intent:kr(e)};r&&(n.state=JSON.parse(r));var a=function(u){if(i===je||i===Qe)return 1;n.fields.add(i),X(n.payload,i,d=>d?Array.isArray(d)?d.concat(u):[d,u]:u)};for(var[i,s]of t.entries())a(s);return n}function _r(t,e){var r=Dt(t),n=r.intent;if(n)switch(n.type){case"update":{var a=de(n.payload.name,n.payload.index),i=n.payload.value;typeof n.payload.value<"u"&&(a?X(r.payload,a,()=>i):r.payload=i);break}case"reset":{var s=de(n.payload.name,n.payload.index);s?X(r.payload,s,()=>{}):r.payload={};break}case"insert":case"remove":case"reorder":{Mt(r.payload,n);break}}var o=e.resolve(r.payload,n),u=d=>br(N(N({},r),{},{value:d.value,error:d.error}));return o instanceof Promise?o.then(u):u(o)}function br(t){return t.intent||!t.value||t.error?{status:t.intent?void 0:"error",payload:t.payload,error:typeof t.error<"u"?t.error:{},reply(e){return bt(t,e)}}:{status:"success",payload:t.payload,value:t.value,reply(e){return bt(t,e)}}}function bt(t){var e,r,n,a,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if("resetForm"in i&&i.resetForm||((e=t.intent)===null||e===void 0?void 0:e.type)==="reset"&&((r=t.intent.payload.name)!==null&&r!==void 0?r:"")==="")return{initialValue:null};if("hideFields"in i&&i.hideFields)for(var s of i.hideFields){var o=be(t.payload,s);typeof o<"u"&&X(t.payload,s,()=>{})}var u="formErrors"in i||"fieldErrors"in i?ke(N({"":(n=i.formErrors)!==null&&n!==void 0?n:null},i.fieldErrors)):null,d=t.error||u?N(N({},t.error),u):void 0,m=(a=ke(t.payload,typeof document<"u"))!==null&&a!==void 0?a:{};return{status:t.intent?void 0:d?"error":"success",intent:t.intent?t.intent:void 0,initialValue:m,error:d,state:t.state,fields:Array.from(t.fields)}}function kr(t){if(!t)return null;var e=JSON.parse(t);if(typeof e.type!="string"||typeof e.payload>"u")throw new Error("Unknown form control intent");return e}function xr(t){switch(t.type){case"insert":return JSON.stringify({type:t.type,payload:N(N({},t.payload),{},{defaultValue:Pe(t.payload.defaultValue)})});case"update":return JSON.stringify({type:t.type,payload:N(N({},t.payload),{},{value:Pe(t.payload.value)})});default:return JSON.stringify(t)}}function rt(t,e){var r;switch(Je(Array.isArray(t),"Failed to update list. The value is not an array."),e.type){case"insert":t.splice((r=e.payload.index)!==null&&r!==void 0?r:t.length,0,e.payload.defaultValue);break;case"remove":t.splice(e.payload.index,1);break;case"reorder":t.splice(e.payload.to,0,...t.splice(e.payload.from,1));break;default:throw new Error("Unknown list intent received")}}function Mt(t,e){X(t,e.payload.name,r=>{var n=r??[];return rt(n,e),n})}var nt=Symbol.for("root");function Le(t,e,r){var n=Object.keys(t).sort((u,d)=>d.localeCompare(u)),a={},i=function(){var d=t[s];Oe(s,e)&&s!==e&&(X(a,s,m=>typeof m>"u"?d:(m[nt]=d,m)),delete t[s])};for(var s of n)i();var o=r(be(a,e));Object.assign(t,ft(o,{resolve(u){if(Q(u)||Array.isArray(u)){var d;return(d=u[nt])!==null&&d!==void 0?d:null}return u},prefix:e}))}function kt(t,e,r){Le(t,e.payload.name,n=>{var a=n??[];switch(e.type){case"insert":rt(a,{type:e.type,payload:N(N({},e.payload),{},{defaultValue:r==null?void 0:r(e.payload.defaultValue)})});break;default:rt(a,e);break}return a})}function Pe(t){return Q(t)?Object.entries(t).reduce((e,r)=>{var[n,a]=r;return e[n]=Pe(a),e},{}):Array.isArray(t)?t.map(Pe):t instanceof Date?t.toISOString():typeof t=="boolean"?t?"on":void 0:typeof t=="number"||typeof t=="bigint"?t.toString():t??void 0}function xt(t,e){var r,n,a,i,s,o=e?void 0:t.lastResult,u=t.defaultValue?Pe(t.defaultValue):{},d=(r=o==null?void 0:o.initialValue)!==null&&r!==void 0?r:u,m={formId:t.formId,pendingIntents:e?[{type:"reset",payload:{}}]:[],isValueUpdated:!1,submissionStatus:o==null?void 0:o.status,defaultValue:u,initialValue:d,value:d,constraint:(n=t.constraint)!==null&&n!==void 0?n:{},validated:(a=o==null||(i=o.state)===null||i===void 0?void 0:i.validated)!==null&&a!==void 0?a:{},key:e?N({"":ee()},Ze(u)):Ze(u),error:(s=o==null?void 0:o.error)!==null&&s!==void 0?s:{}};return Lt(m,o==null?void 0:o.intent,o==null?void 0:o.fields),m}function Ze(t,e){return Object.entries(ft(t,{prefix:e})).reduce((r,n)=>{var[a,i]=n;if(Array.isArray(i))for(var s=0;s<i.length;s++)r[de(a,s)]=ee();return r},{})}function wt(t,e){for(var r of Object.keys(t.error).concat(e??[]))t.validated[r]=!0}function Lt(t,e,r,n){var a;if(!e){wt(t,r);return}switch(e.type){case"validate":{e.payload.name?t.validated[e.payload.name]=!0:wt(t,r);break}case"update":{var{validated:i,value:s}=e.payload,o=de(e.payload.name,e.payload.index);typeof s<"u"&&Ot(t,o??"",s),typeof i<"u"&&(o?Le(t.validated,o,()=>{}):t.validated={},i?((Q(s)||Array.isArray(s))&&Object.assign(t.validated,ft(s,{resolve(){return!0},prefix:o})),t.validated[o??""]=!0):o&&delete t.validated[o]);break}case"reset":{var u=de(e.payload.name,e.payload.index),d=be(t.defaultValue,u);Ot(t,u,d),u?(Le(t.validated,u,()=>{}),delete t.validated[u]):t.validated={};break}case"insert":case"remove":case"reorder":{n&&(t.initialValue=Ie(t.initialValue),t.key=Ie(t.key),kt(t.key,e,w=>!Array.isArray(w)&&!Q(w)?ee():Object.assign(Ze(w),{[nt]:ee()})),Mt(t.initialValue,e)),kt(t.validated,e),t.validated[e.payload.name]=!0;break}}var m=(a=r==null?void 0:r.filter(w=>t.validated[w]))!==null&&a!==void 0?a:[];t.error=Object.entries(t.error).reduce((w,P)=>{var[V,E]=P;return(t.validated[V]||m.some(R=>Oe(V,R)))&&(w[V]=E),w},{})}function Ot(t,e,r){if(e===""){t.initialValue=r,t.value=r,t.key=N(N({},Ze(r)),{},{"":ee()});return}t.initialValue=Ie(t.initialValue),t.value=Ie(t.value),t.key=Ie(t.key),X(t.initialValue,e,()=>r),X(t.value,e,()=>r),(Q(r)||Array.isArray(r))&&(Le(t.key,e,()=>{}),Object.assign(t.key,Ze(r,e))),t.key[e]=ee()}function Me(t){var e={};return new Proxy(e,{get(r,n,a){var i;if(typeof n=="string")return(i=e[n])!==null&&i!==void 0?i:e[n]=t(n,a)}})}function et(t){var e=ke(t);return Me((r,n)=>{if(r==="")return e;var a=L(r),i=G(a.slice(0,-1)),s=G(a.slice(-1)),o=n[i];return be(o,s)})}function wr(t){return Me((e,r)=>{var n,a=t[e];if(!a){for(var i=L(e),s=i.length-1;s>=0;s--){var o=i[s];if(typeof o=="number"&&!Number.isNaN(o)){i[s]=Number.NaN;break}}var u=G(i);e!==u&&(a=r[u])}return(n=a)!==null&&n!==void 0?n:{}})}function Or(t){return Me((e,r)=>{var n=t[e],a=L(e);if(a.length===0)return n;var i=r[G(a.slice(0,-1))];return typeof i>"u"?n:"".concat(i,"/").concat(n??a.at(-1))})}function Sr(t){return Me(e=>{var r=Object.keys(t);if(e==="")return r.length===0;for(var n of r)if(Oe(n,e)&&typeof t[n]<"u")return!1;return!0})}function Nr(t,e,r){return Me(n=>JSON.stringify(t[n])!==JSON.stringify(e[n],(a,i)=>n===""&&a===""&&i?Object.entries(i).reduce((s,o)=>{var[u,d]=o;return r(u)?Object.assign(s??{},{[u]:d}):s},void 0):i))}function ve(t,e,r,n){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:(V,E)=>JSON.stringify(V)!==JSON.stringify(E);if(n&&t!==e){var i,s,o=(i=n.prefix)!==null&&i!==void 0?i:[],u=(s=n.name)!==null&&s!==void 0?s:[],d=o.length===0?u:Array.from(new Set([...Object.keys(t),...Object.keys(e)])),m=function(E){if(o.length===0||u.includes(E)||o.some(se=>Oe(E,se))){var R;if((R=r[E])!==null&&R!==void 0||(r[E]=a(t[E],e[E])),r[E])return{v:!0}}},w;for(var P of d)if(w=m(P),w)return w.v}return!1}function Tr(t){var e=[],r=t,n=new Set,a=xt(t),i=o(a);function s(){return document.forms.namedItem(r.formId)}function o(l){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l,h=arguments.length>2?arguments[2]:void 0,k=!h||p.defaultValue!==l.defaultValue?et(l.defaultValue):h.defaultValue,I=l.initialValue===l.defaultValue?k:!h||p.initialValue!==l.initialValue?et(l.initialValue):h.initialValue,T=l.value===l.initialValue?I:!h||p.value!==l.value?et(l.value):h.value;return{submissionStatus:l.submissionStatus,pendingIntents:l.pendingIntents,defaultValue:k,initialValue:I,value:T,error:!h||p.error!==l.error?l.error:h.error,validated:l.validated,constraint:!h||p.constraint!==l.constraint?wr(l.constraint):h.constraint,key:!h||p.key!==l.key?Or(l.key):h.key,valid:!h||p.error!==l.error?Sr(l.error):h.valid,dirty:!h||p.defaultValue!==l.defaultValue||p.value!==l.value?Nr(k,T,j=>{var A,D;return(A=(D=r.shouldDirtyConsider)===null||D===void 0?void 0:D.call(r,j))!==null&&A!==void 0?A:!0}):h.dirty}}function u(l){var p=a,h=i,k=o(l,p,h);a=l,i=k;var I={value:{},error:{},initialValue:{},key:{},valid:{},dirty:{}};for(var T of e){var j,A=(j=T.getSubject)===null||j===void 0?void 0:j.call(T);(!A||A.formId&&p.formId!==l.formId||A.status&&h.submissionStatus!==k.submissionStatus||A.pendingIntents&&p.pendingIntents!==l.pendingIntents||ve(h.error,k.error,I.error,A.error)||ve(h.initialValue,k.initialValue,I.initialValue,A.initialValue)||ve(h.key,k.key,I.key,A.key,(D,B)=>D!==B)||ve(h.valid,k.valid,I.valid,A.valid,d)||ve(h.dirty,k.dirty,I.dirty,A.dirty,d)||ve(h.value,k.value,I.value,A.value))&&T.callback()}}function d(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return l!==p}function m(){return JSON.stringify({validated:a.validated})}function w(l){var p=l.target,h=l.submitter;Je(p===s(),"The submit event is dispatched by form#".concat(p.id," instead of form#").concat(r.formId));var k=lr(p,h),I={formData:k,action:pr(l),encType:vr(l),method:yr(l)};if(typeof(r==null?void 0:r.onValidate)>"u")return I;var T=r.onValidate({form:p,formData:k,submitter:h});if(T.status==="success"||T.error!==null){var j=T.reply();he(N(N({},j),{},{status:j.status!=="success"?j.status:void 0}))}return N(N({},I),{},{submission:T})}function P(l){var p=s(),h=l.target;return!p||!Ae(h)||h.form!==p||!h.form.isConnected||h.name===""?null:h}function V(l,p){var{shouldValidate:h="onSubmit",shouldRevalidate:k=h}=r,I=a.validated[l.name];return I?k===p&&(p==="onInput"||a.isValueUpdated):h===p}function E(l){var p=new FormData(l),h=Dt(p);u(N(N({},a),{},{isValueUpdated:!0,value:h.payload}))}function R(l){var p=P(l);!p||!p.form||(l.defaultPrevented||!V(p,"onInput")?E(p.form):Ye({type:"validate",payload:{name:p.name}}))}function se(l){var p=P(l);!p||l.defaultPrevented||!V(p,"onBlur")||Ye({type:"validate",payload:{name:p.name}})}function Se(){n.clear(),u(xt(r,!0))}function Ne(l){var p=s();l.type!=="reset"||l.target!==p||l.defaultPrevented||Se()}function he(l){var p,h,k=s();if(!l.initialValue){Se();return}var I=Object.entries((p=l.error)!==null&&p!==void 0?p:{}).reduce((D,B)=>{var[oe,Te]=B,pe=Te===null?a.error[oe]:Te;return pe&&(D[oe]=pe),D},{}),T=l.intent?a.pendingIntents.filter(D=>!n.has(D)).concat(l.intent):a.pendingIntents,j=N(N({},a),{},{pendingIntents:T,isValueUpdated:!1,submissionStatus:l.status,value:l.initialValue,validated:N(N({},a.validated),(h=l.state)===null||h===void 0?void 0:h.validated),error:I});if(Lt(j,l.intent,l.fields,!0),u(j),k&&l.status==="error"){for(var A of k.elements)if(Ae(A)&&a.error[A.name]){A.focus();break}}}function Gt(l){var p=r.formId,h=r.lastResult;Object.assign(r,l),r.formId!==p?Se():l.lastResult&&l.lastResult!==h&&he(l.lastResult)}function Xt(l,p){var h={callback:l,getSubject:p};return e.push(h),()=>{e=e.filter(k=>k!==h)}}function Qt(){return i}function Ye(l){var p=s(),h=document.createElement("button"),k=vt(l);h.name=k.name,h.value=k.value,h.hidden=!0,h.formNoValidate=!0,p==null||p.appendChild(h),gr(p,h),p==null||p.removeChild(h)}function vt(l){return{name:je,value:xr(l),form:r.formId,formNoValidate:!0}}function me(l){var p=function(){var k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Ye({type:l,payload:k})};return Object.assign(p,{getButtonProps(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return vt({type:l,payload:h})}})}function er(){var l=new MutationObserver(p=>{var h=s();if(h)for(var k of p){var I=k.type==="childList"?[...k.addedNodes,...k.removedNodes]:[k.target];for(var T of I){var j=Ae(T)?T:T instanceof HTMLElement?T.querySelector("input,select,textarea"):null;if((j==null?void 0:j.form)===h){E(h);return}}}});return l.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["form","name"]}),()=>{l.disconnect()}}function tr(l){var p=s();if(p)for(var h of l){switch(h.type){case"update":{var k=de(h.payload.name,h.payload.index),I=L(k);for(var T of p.elements)if(Ae(T)){var j=fr(I,T.name);if(j){var A=be(h.payload.value,G(j));_t(T,{value:typeof A=="string"||Array.isArray(A)&&A.every(pe=>typeof pe=="string")?A:null}),T.dataset.conform=ee()}}break}case"reset":{var D=de(h.payload.name,h.payload.index);for(var B of p.elements)if(Ae(B)&&B.name&&Oe(B.name,D)){var oe=be(a.defaultValue,B.name),Te=typeof oe=="string"||Array.isArray(oe)&&oe.every(pe=>typeof pe=="string")?oe:null;_t(B,{defaultValue:Te,value:Te}),B.dataset.conform=ee()}break}}n.add(h)}}return{getFormId(){return a.formId},submit:w,onReset:Ne,onInput:R,onBlur:se,onUpdate:Gt,validate:me("validate"),reset:me("reset"),update:me("update"),insert:me("insert"),remove:me("remove"),reorder:me("reorder"),runSideEffect:tr,subscribe:Xt,getState:Qt,getSerializedState:m,observe:er}}function St(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?St(Object(r),!0).forEach(function(n){Ar(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ar(t,e,r){return e=jr(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cr(t,e){if(t==null)return{};var r={},n=Object.keys(t),a,i;for(i=0;i<n.length;i++)a=n[i],!(e.indexOf(a)>=0)&&(r[a]=t[a]);return r}function Er(t,e){if(t==null)return{};var r=Cr(t,e),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a<i.length;a++)n=i[a],!(e.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Ir(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function jr(t){var e=Ir(t,"string");return typeof e=="symbol"?e:String(e)}var Pr=Symbol("wrapped");function Zr(t,e){var r=U.useCallback(n=>t.subscribe(n,()=>e==null?void 0:e.current),[t,e]);return U.useSyncExternalStore(r,t.getState,t.getState)}function Vr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=U.useRef(t);return e.current=t,e}function _e(t,e,r,n){if(e==="status"||e==="formId"||e==="pendingIntents")t.current[e]=!0;else if(typeof r<"u"&&typeof n<"u"){var a,i;t.current[e]=q(q({},t.current[e]),{},{[r]:((a=(i=t.current[e])===null||i===void 0?void 0:i[r])!==null&&a!==void 0?a:[]).concat(n)})}}function Ft(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",a=n?"".concat(t.getFormId(),"-").concat(n):t.getFormId(),i=t.getState();return new Proxy({id:a,name:n,errorId:"".concat(a,"-error"),descriptionId:"".concat(a,"-description"),get defaultValue(){var s=this.initialValue;if(typeof s=="string")return s;if(Array.isArray(s))return s[0]},get defaultOptions(){var s=this.initialValue;if(typeof s=="string")return[s];if(Array.isArray(s)&&s.every(o=>typeof o=="string"))return s},get defaultChecked(){if(this.initialValue==="on")return!0},get initialValue(){return i.initialValue[n]},get value(){return i.value[n]},get errors(){return i.error[n]},get key(){return i.key[n]},get valid(){return i.valid[n]},get dirty(){return i.dirty[n]},get allErrors(){if(n==="")return i.error;var s={};for(var[o,u]of Object.entries(i.error))Oe(o,n)&&(s[o]=u);return s},get getFieldset(){return()=>new Proxy({},{get(s,o,u){return typeof o=="string"?zt(t,e,r,n,o):Reflect.get(s,o,u)}})}},{get(s,o,u){if(i===r)switch(o){case"id":case"errorId":case"descriptionId":_e(e,"formId");break;case"key":case"initialValue":case"value":case"valid":case"dirty":_e(e,o,"name",n);break;case"errors":case"allErrors":_e(e,"error",o==="errors"?"name":"prefix",n);break}return Reflect.get(s,o,u)}})}function zt(t,e,r){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"",a=arguments.length>4?arguments[4]:void 0,i=typeof a>"u"?n:G([...L(n),a]);return new Proxy({},{get(s,o,u){var d,m=Ft(t,e,r,i),w=t.getState();switch(o){case"formId":return w===r&&_e(e,"formId"),t.getFormId();case"required":case"minLength":case"maxLength":case"min":case"max":case"pattern":case"step":case"multiple":return(d=w.constraint[i])===null||d===void 0?void 0:d[o];case"getFieldList":return()=>{var P,V=(P=w.initialValue[i])!==null&&P!==void 0?P:[];if(w===r&&_e(e,"initialValue","name",i),!Array.isArray(V))throw new Error("The initial value at the given name is not a list");return Array(V.length).fill(0).map((E,R)=>zt(t,e,r,i,R))}}return Reflect.get(m,o,u)}})}function Rr(t,e,r,n){return new Proxy({},{get(a,i,s){var o=Ft(t,e,r),u=t.getState();switch(i){case"context":return{[Pr]:t};case"status":return u===r&&_e(e,"status"),u.submissionStatus;case"validate":case"update":case"reset":case"insert":case"remove":case"reorder":return t[i];case"onSubmit":return t.submit;case"noValidate":return n}return Reflect.get(o,i,s)}})}function $r(t){var{onSubmit:e}=t,r=Tr(t);return q(q({},r),{},{submit(n){var a=n.nativeEvent,i=r.submit(a);if(!i.submission||i.submission.status==="success"||i.submission.error===null){if(!i.formData.has(je)){var s;(s=e)===null||s===void 0||s(n,i)}}else n.preventDefault()},onUpdate(n){e=n.onSubmit,r.onUpdate(n)}})}var Dr=["id"],at=typeof document>"u"?U.useEffect:U.useLayoutEffect;function Mr(t){var e=U.useId();return t??e}function Lr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,[e,r]=U.useState(t);return at(()=>{e||r(!0)},[e]),e}function Fr(t){var{id:e}=t,r=Er(t,Dr),n=Mr(e),[a]=U.useState(()=>$r(q(q({},r),{},{formId:n})));at(()=>{var d=a.observe();return document.addEventListener("input",a.onInput),document.addEventListener("focusout",a.onBlur),document.addEventListener("reset",a.onReset),()=>{d(),document.removeEventListener("input",a.onInput),document.removeEventListener("focusout",a.onBlur),document.removeEventListener("reset",a.onReset)}},[a]),at(()=>{a.onUpdate(q(q({},r),{},{formId:n}))});var i=Vr({pendingIntents:!0}),s=Zr(a,i),o=Lr(t.defaultNoValidate),u=Rr(a,i,s,o);return U.useEffect(()=>{a.runSideEffect(s.pendingIntents)},[a,s.pendingIntents]),[u,u.getFieldset()]}function Ut(t){for(var e in t)t[e]===void 0&&delete t[e];return t}function zr(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e.ariaAttributes<"u"&&!e.ariaAttributes)return{};var r=e.ariaInvalid==="allErrors"?!t.valid:typeof t.errors<"u",n=e.ariaDescribedBy;return Ut({"aria-invalid":r||void 0,"aria-describedby":r?"".concat(t.errorId," ").concat(n??"").trim():n})}function Ur(t,e){return Ut(q({id:t.id,onSubmit:t.onSubmit,noValidate:t.noValidate},zr(t,e)))}function Nt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function S(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nt(Object(r),!0).forEach(function(n){Br(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nt(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Br(t,e,r){return e=Hr(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wr(t,e){if(typeof t!="object"||t===null)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Hr(t){var e=Wr(t,"string");return typeof e=="symbol"?e:String(e)}var O;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function r(a){throw new Error}t.assertNever=r,t.arrayToEnum=a=>{const i={};for(const s of a)i[s]=s;return i},t.getValidEnumValues=a=>{const i=t.objectKeys(a).filter(o=>typeof a[a[o]]!="number"),s={};for(const o of i)s[o]=a[o];return t.objectValues(s)},t.objectValues=a=>t.objectKeys(a).map(function(i){return a[i]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const i=[];for(const s in a)Object.prototype.hasOwnProperty.call(a,s)&&i.push(s);return i},t.find=(a,i)=>{for(const s of a)if(i(s))return s},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function n(a,i=" | "){return a.map(s=>typeof s=="string"?`'${s}'`:s).join(i)}t.joinValues=n,t.jsonStringifyReplacer=(a,i)=>typeof i=="bigint"?i.toString():i})(O||(O={}));var Tt;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Tt||(Tt={}));const v=O.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y=t=>{switch(typeof t){case"undefined":return v.undefined;case"string":return v.string;case"number":return Number.isNaN(t)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(t)?v.array:t===null?v.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?v.promise:typeof Map<"u"&&t instanceof Map?v.map:typeof Set<"u"&&t instanceof Set?v.set:typeof Date<"u"&&t instanceof Date?v.date:v.object;default:return v.unknown}},c=O.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class K extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(i){return i.message},n={_errors:[]},a=i=>{for(const s of i.issues)if(s.code==="invalid_union")s.unionErrors.map(a);else if(s.code==="invalid_return_type")a(s.returnTypeError);else if(s.code==="invalid_arguments")a(s.argumentsError);else if(s.path.length===0)n._errors.push(r(s));else{let o=n,u=0;for(;u<s.path.length;){const d=s.path[u];u===s.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(s))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return a(this),n}static assert(e){if(!(e instanceof K))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,O.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(e(a))):n.push(e(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}K.create=t=>new K(t);const it=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===v.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,O.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${O.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${O.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${O.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:O.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,O.assertNever(t)}return{message:r}};let qr=it;function Jr(){return qr}const Kr=t=>{const{data:e,path:r,errorMaps:n,issueData:a}=t,i=[...r,...a.path||[]],s={...a,path:i};if(a.message!==void 0)return{...a,path:i,message:a.message};let o="";const u=n.filter(d=>!!d).slice().reverse();for(const d of u)o=d(s,{data:e,defaultError:o}).message;return{...a,path:i,message:o}};function f(t,e){const r=Jr(),n=Kr({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===it?void 0:it].filter(a=>!!a)});t.common.issues.push(n)}class ${constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const a of r){if(a.status==="aborted")return g;a.status==="dirty"&&e.dirty(),n.push(a.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const a of r){const i=await a.key,s=await a.value;n.push({key:i,value:s})}return $.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const a of r){const{key:i,value:s}=a;if(i.status==="aborted"||s.status==="aborted")return g;i.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof s.value<"u"||a.alwaysSet)&&(n[i.value]=s.value)}return{status:e.value,value:n}}}const g=Object.freeze({status:"aborted"}),Ee=t=>({status:"dirty",value:t}),F=t=>({status:"valid",value:t}),At=t=>t.status==="aborted",Ct=t=>t.status==="dirty",xe=t=>t.status==="valid",Fe=t=>typeof Promise<"u"&&t instanceof Promise;var y;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class te{constructor(e,r,n,a){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=a}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Et=(t,e)=>{if(xe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new K(t.common.issues);return this._error=r,this._error}}};function b(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:a}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(s,o)=>{const{message:u}=t;return s.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??n??o.defaultError}:s.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:a}}class x{get description(){return this._def.description}_getType(e){return Y(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $,ctx:{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Fe(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:(r==null?void 0:r.async)??!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Et(n,a)}"~validate"(e){var n,a;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:r});return xe(i)?{value:i.value}:{issues:r.common.issues}}catch(i){(a=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&a.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(i=>xe(i)?{value:i.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},a=this._parse({data:e,path:n.path,parent:n}),i=await(Fe(a)?a:Promise.resolve(a));return Et(n,i)}refine(e,r){const n=a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r;return this._refinement((a,i)=>{const s=e(a),o=()=>i.addIssue({code:c.custom,...n(a)});return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(o(),!1)):s?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,a)=>e(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(e){return new ae({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return W.create(this,this._def)}nullable(){return ie.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return z.create(this)}promise(){return We.create(this,this._def)}or(e){return Ve.create([this,e],this._def)}and(e){return Re.create(this,e,this._def)}transform(e){return new ae({...b(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new He({...b(this._def),innerType:this,defaultValue:r,typeName:_.ZodDefault})}brand(){return new mt({typeName:_.ZodBranded,type:this,...b(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new De({...b(this._def),innerType:this,catchValue:r,typeName:_.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ke.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Yr=/^c[^\s-]{8,}$/i,Gr=/^[0-9a-z]+$/,Xr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Qr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,en=/^[a-z0-9_-]{21}$/i,tn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,rn=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,nn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,an="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let tt;const sn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,on=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,un=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,dn=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ln=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Bt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",fn=new RegExp(`^${Bt}$`);function Wt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function hn(t){return new RegExp(`^${Wt(t)}$`)}function mn(t){let e=`${Bt}T${Wt(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function pn(t,e){return!!((e==="v4"||!e)&&sn.test(t)||(e==="v6"||!e)&&un.test(t))}function vn(t,e){if(!tn.test(t))return!1;try{const[r]=t.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return!(typeof a!="object"||a===null||"typ"in a&&(a==null?void 0:a.typ)!=="JWT"||!a.alg||e&&a.alg!==e)}catch{return!1}}function yn(t,e){return!!((e==="v4"||!e)&&on.test(t)||(e==="v6"||!e)&&dn.test(t))}class J extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==v.string){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:v.string,received:i.parsedType}),g}const n=new $;let a;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const s=e.data.length>i.value,o=e.data.length<i.value;(s||o)&&(a=this._getOrReturnCtx(e,a),s?f(a,{code:c.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):o&&f(a,{code:c.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")nn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"email",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")tt||(tt=new RegExp(an,"u")),tt.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"emoji",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Qr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"uuid",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")en.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"nanoid",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Yr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Gr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cuid2",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Xr.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ulid",code:c.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{a=this._getOrReturnCtx(e,a),f(a,{validation:"url",code:c.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"regex",code:c.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?mn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?fn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?hn(i).test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:c.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?rn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"duration",code:c.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?pn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"ip",code:c.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?vn(e.data,i.alg)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"jwt",code:c.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?yn(e.data,i.version)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"cidr",code:c.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?cn.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64",code:c.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?ln.test(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{validation:"base64url",code:c.invalid_string,message:i.message}),n.dirty()):O.assertNever(i);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(a=>e.test(a),{validation:r,code:c.invalid_string,...y.errToObj(n)})}_addCheck(e){return new J({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...y.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r==null?void 0:r.position,...y.errToObj(r==null?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...y.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...y.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...y.errToObj(r)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new J({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new J({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new J({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}J.create=t=>new J({checks:[],typeName:_.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...b(t)});function gn(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,a=r>n?r:n,i=Number.parseInt(t.toFixed(a).replace(".","")),s=Number.parseInt(e.toFixed(a).replace(".",""));return i%s/10**a}class ce extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==v.number){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:v.number,received:i.parsedType}),g}let n;const a=new $;for(const i of this._def.checks)i.kind==="int"?O.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty()):i.kind==="multipleOf"?gn(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.not_finite,message:i.message}),a.dirty()):O.assertNever(i);return{status:a.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,y.toString(r))}gt(e,r){return this.setLimit("min",e,!1,y.toString(r))}lte(e,r){return this.setLimit("max",e,!0,y.toString(r))}lt(e,r){return this.setLimit("max",e,!1,y.toString(r))}setLimit(e,r,n,a){return new ce({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(e){return new ce({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&O.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}ce.create=t=>new ce({checks:[],typeName:_.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...b(t)});class le extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==v.bigint)return this._getInvalidInput(e);let n;const a=new $;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):O.assertNever(i);return{status:a.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return f(r,{code:c.invalid_type,expected:v.bigint,received:r.parsedType}),g}gte(e,r){return this.setLimit("min",e,!0,y.toString(r))}gt(e,r){return this.setLimit("min",e,!1,y.toString(r))}lte(e,r){return this.setLimit("max",e,!0,y.toString(r))}lt(e,r){return this.setLimit("max",e,!1,y.toString(r))}setLimit(e,r,n,a){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:y.toString(a)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}le.create=t=>new le({checks:[],typeName:_.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...b(t)});class ze extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==v.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.boolean,received:n.parsedType}),g}return F(e.data)}}ze.create=t=>new ze({typeName:_.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...b(t)});class we extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==v.date){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_type,expected:v.date,received:i.parsedType}),g}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return f(i,{code:c.invalid_date}),g}const n=new $;let a;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(a=this._getOrReturnCtx(e,a),f(a,{code:c.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):O.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new we({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}we.create=t=>new we({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:_.ZodDate,...b(t)});class It extends x{_parse(e){if(this._getType(e)!==v.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.symbol,received:n.parsedType}),g}return F(e.data)}}It.create=t=>new It({typeName:_.ZodSymbol,...b(t)});class st extends x{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.undefined,received:n.parsedType}),g}return F(e.data)}}st.create=t=>new st({typeName:_.ZodUndefined,...b(t)});class ot extends x{_parse(e){if(this._getType(e)!==v.null){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.null,received:n.parsedType}),g}return F(e.data)}}ot.create=t=>new ot({typeName:_.ZodNull,...b(t)});class ut extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}}ut.create=t=>new ut({typeName:_.ZodAny,...b(t)});class dt extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}}dt.create=t=>new dt({typeName:_.ZodUnknown,...b(t)});class re extends x{_parse(e){const r=this._getOrReturnCtx(e);return f(r,{code:c.invalid_type,expected:v.never,received:r.parsedType}),g}}re.create=t=>new re({typeName:_.ZodNever,...b(t)});class jt extends x{_parse(e){if(this._getType(e)!==v.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.void,received:n.parsedType}),g}return F(e.data)}}jt.create=t=>new jt({typeName:_.ZodVoid,...b(t)});class z extends x{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),a=this._def;if(r.parsedType!==v.array)return f(r,{code:c.invalid_type,expected:v.array,received:r.parsedType}),g;if(a.exactLength!==null){const s=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(s||o)&&(f(r,{code:s?c.too_big:c.too_small,minimum:o?a.exactLength.value:void 0,maximum:s?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(f(r,{code:c.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(f(r,{code:c.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((s,o)=>a.type._parseAsync(new te(r,s,r.path,o)))).then(s=>$.mergeArray(n,s));const i=[...r.data].map((s,o)=>a.type._parseSync(new te(r,s,r.path,o)));return $.mergeArray(n,i)}get element(){return this._def.type}min(e,r){return new z({...this._def,minLength:{value:e,message:y.toString(r)}})}max(e,r){return new z({...this._def,maxLength:{value:e,message:y.toString(r)}})}length(e,r){return new z({...this._def,exactLength:{value:e,message:y.toString(r)}})}nonempty(e){return this.min(1,e)}}z.create=(t,e)=>new z({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...b(e)});function ge(t){if(t instanceof C){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=W.create(ge(n))}return new C({...t._def,shape:()=>e})}else return t instanceof z?new z({...t._def,type:ge(t.element)}):t instanceof W?W.create(ge(t.unwrap())):t instanceof ie?ie.create(ge(t.unwrap())):t instanceof ne?ne.create(t.items.map(e=>ge(e))):t}class C extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=O.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==v.object){const d=this._getOrReturnCtx(e);return f(d,{code:c.invalid_type,expected:v.object,received:d.parsedType}),g}const{status:n,ctx:a}=this._processInputParams(e),{shape:i,keys:s}=this._getCached(),o=[];if(!(this._def.catchall instanceof re&&this._def.unknownKeys==="strip"))for(const d in a.data)s.includes(d)||o.push(d);const u=[];for(const d of s){const m=i[d],w=a.data[d];u.push({key:{status:"valid",value:d},value:m._parse(new te(a,w,a.path,d)),alwaysSet:d in a.data})}if(this._def.catchall instanceof re){const d=this._def.unknownKeys;if(d==="passthrough")for(const m of o)u.push({key:{status:"valid",value:m},value:{status:"valid",value:a.data[m]}});else if(d==="strict")o.length>0&&(f(a,{code:c.unrecognized_keys,keys:o}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const m of o){const w=a.data[m];u.push({key:{status:"valid",value:m},value:d._parse(new te(a,w,a.path,m)),alwaysSet:m in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const d=[];for(const m of u){const w=await m.key,P=await m.value;d.push({key:w,value:P,alwaysSet:m.alwaysSet})}return d}).then(d=>$.mergeObjectSync(n,d)):$.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new C({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var i,s;const a=((s=(i=this._def).errorMap)==null?void 0:s.call(i,r,n).message)??n.defaultError;return r.code==="unrecognized_keys"?{message:y.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new C({...this._def,unknownKeys:"strip"})}passthrough(){return new C({...this._def,unknownKeys:"passthrough"})}extend(e){return new C({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new C({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new C({...this._def,catchall:e})}pick(e){const r={};for(const n of O.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new C({...this._def,shape:()=>r})}omit(e){const r={};for(const n of O.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new C({...this._def,shape:()=>r})}deepPartial(){return ge(this)}partial(e){const r={};for(const n of O.objectKeys(this.shape)){const a=this.shape[n];e&&!e[n]?r[n]=a:r[n]=a.optional()}return new C({...this._def,shape:()=>r})}required(e){const r={};for(const n of O.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof W;)i=i._def.innerType;r[n]=i}return new C({...this._def,shape:()=>r})}keyof(){return Ht(O.objectKeys(this.shape))}}C.create=(t,e)=>new C({shape:()=>t,unknownKeys:"strip",catchall:re.create(),typeName:_.ZodObject,...b(e)});C.strictCreate=(t,e)=>new C({shape:()=>t,unknownKeys:"strict",catchall:re.create(),typeName:_.ZodObject,...b(e)});C.lazycreate=(t,e)=>new C({shape:t,unknownKeys:"strip",catchall:re.create(),typeName:_.ZodObject,...b(e)});class Ve extends x{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function a(i){for(const o of i)if(o.result.status==="valid")return o.result;for(const o of i)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(o=>new K(o.ctx.common.issues));return f(r,{code:c.invalid_union,unionErrors:s}),g}if(r.common.async)return Promise.all(n.map(async i=>{const s={...r,common:{...r.common,issues:[]},parent:null};return{result:await i._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(a);{let i;const s=[];for(const u of n){const d={...r,common:{...r.common,issues:[]},parent:null},m=u._parseSync({data:r.data,path:r.path,parent:d});if(m.status==="valid")return m;m.status==="dirty"&&!i&&(i={result:m,ctx:d}),d.common.issues.length&&s.push(d.common.issues)}if(i)return r.common.issues.push(...i.ctx.common.issues),i.result;const o=s.map(u=>new K(u));return f(r,{code:c.invalid_union,unionErrors:o}),g}}get options(){return this._def.options}}Ve.create=(t,e)=>new Ve({options:t,typeName:_.ZodUnion,...b(e)});const H=t=>t instanceof Ue?H(t.schema):t instanceof ae?H(t.innerType()):t instanceof Be?[t.value]:t instanceof fe?t.options:t instanceof lt?O.objectValues(t.enum):t instanceof He?H(t._def.innerType):t instanceof st?[void 0]:t instanceof ot?[null]:t instanceof W?[void 0,...H(t.unwrap())]:t instanceof ie?[null,...H(t.unwrap())]:t instanceof mt||t instanceof qe?H(t.unwrap()):t instanceof De?H(t._def.innerType):[];class ht extends x{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.object)return f(r,{code:c.invalid_type,expected:v.object,received:r.parsedType}),g;const n=this.discriminator,a=r.data[n],i=this.optionsMap.get(a);return i?r.common.async?i._parseAsync({data:r.data,path:r.path,parent:r}):i._parseSync({data:r.data,path:r.path,parent:r}):(f(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),g)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){const a=new Map;for(const i of r){const s=H(i.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of s){if(a.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);a.set(o,i)}}return new ht({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:a,...b(n)})}}function ct(t,e){const r=Y(t),n=Y(e);if(t===e)return{valid:!0,data:t};if(r===v.object&&n===v.object){const a=O.objectKeys(e),i=O.objectKeys(t).filter(o=>a.indexOf(o)!==-1),s={...t,...e};for(const o of i){const u=ct(t[o],e[o]);if(!u.valid)return{valid:!1};s[o]=u.data}return{valid:!0,data:s}}else if(r===v.array&&n===v.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let i=0;i<t.length;i++){const s=t[i],o=e[i],u=ct(s,o);if(!u.valid)return{valid:!1};a.push(u.data)}return{valid:!0,data:a}}else return r===v.date&&n===v.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Re extends x{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=(i,s)=>{if(At(i)||At(s))return g;const o=ct(i.value,s.value);return o.valid?((Ct(i)||Ct(s))&&r.dirty(),{status:r.value,value:o.data}):(f(n,{code:c.invalid_intersection_types}),g)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,s])=>a(i,s)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}Re.create=(t,e,r)=>new Re({left:t,right:e,typeName:_.ZodIntersection,...b(r)});class ne extends x{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.array)return f(n,{code:c.invalid_type,expected:v.array,received:n.parsedType}),g;if(n.data.length<this._def.items.length)return f(n,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),g;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const i=[...n.data].map((s,o)=>{const u=this._def.items[o]||this._def.rest;return u?u._parse(new te(n,s,n.path,o)):null}).filter(s=>!!s);return n.common.async?Promise.all(i).then(s=>$.mergeArray(r,s)):$.mergeArray(r,i)}get items(){return this._def.items}rest(e){return new ne({...this._def,rest:e})}}ne.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ne({items:t,typeName:_.ZodTuple,rest:null,...b(e)})};class Pt extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.map)return f(n,{code:c.invalid_type,expected:v.map,received:n.parsedType}),g;const a=this._def.keyType,i=this._def.valueType,s=[...n.data.entries()].map(([o,u],d)=>({key:a._parse(new te(n,o,n.path,[d,"key"])),value:i._parse(new te(n,u,n.path,[d,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const u of s){const d=await u.key,m=await u.value;if(d.status==="aborted"||m.status==="aborted")return g;(d.status==="dirty"||m.status==="dirty")&&r.dirty(),o.set(d.value,m.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const u of s){const d=u.key,m=u.value;if(d.status==="aborted"||m.status==="aborted")return g;(d.status==="dirty"||m.status==="dirty")&&r.dirty(),o.set(d.value,m.value)}return{status:r.value,value:o}}}}Pt.create=(t,e,r)=>new Pt({valueType:e,keyType:t,typeName:_.ZodMap,...b(r)});class $e extends x{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==v.set)return f(n,{code:c.invalid_type,expected:v.set,received:n.parsedType}),g;const a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(f(n,{code:c.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(f(n,{code:c.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const i=this._def.valueType;function s(u){const d=new Set;for(const m of u){if(m.status==="aborted")return g;m.status==="dirty"&&r.dirty(),d.add(m.value)}return{status:r.value,value:d}}const o=[...n.data.values()].map((u,d)=>i._parse(new te(n,u,n.path,d)));return n.common.async?Promise.all(o).then(u=>s(u)):s(o)}min(e,r){return new $e({...this._def,minSize:{value:e,message:y.toString(r)}})}max(e,r){return new $e({...this._def,maxSize:{value:e,message:y.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}$e.create=(t,e)=>new $e({valueType:t,minSize:null,maxSize:null,typeName:_.ZodSet,...b(e)});class Ue extends x{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ue.create=(t,e)=>new Ue({getter:t,typeName:_.ZodLazy,...b(e)});class Be extends x{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return f(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),g}return{status:"valid",value:e.data}}get value(){return this._def.value}}Be.create=(t,e)=>new Be({value:t,typeName:_.ZodLiteral,...b(e)});function Ht(t,e){return new fe({values:t,typeName:_.ZodEnum,...b(e)})}class fe extends x{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return f(r,{expected:O.joinValues(n),received:r.parsedType,code:c.invalid_type}),g}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return f(r,{received:r.data,code:c.invalid_enum_value,options:n}),g}return F(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return fe.create(e,{...this._def,...r})}exclude(e,r=this._def){return fe.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}fe.create=Ht;class lt extends x{_parse(e){const r=O.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==v.string&&n.parsedType!==v.number){const a=O.objectValues(r);return f(n,{expected:O.joinValues(a),received:n.parsedType,code:c.invalid_type}),g}if(this._cache||(this._cache=new Set(O.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=O.objectValues(r);return f(n,{received:n.data,code:c.invalid_enum_value,options:a}),g}return F(e.data)}get enum(){return this._def.values}}lt.create=(t,e)=>new lt({values:t,typeName:_.ZodNativeEnum,...b(e)});class We extends x{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==v.promise&&r.common.async===!1)return f(r,{code:c.invalid_type,expected:v.promise,received:r.parsedType}),g;const n=r.parsedType===v.promise?r.data:Promise.resolve(r.data);return F(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}}We.create=(t,e)=>new We({type:t,typeName:_.ZodPromise,...b(e)});class ae extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),a=this._def.effect||null,i={addIssue:s=>{f(n,s),s.fatal?r.abort():r.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),a.type==="preprocess"){const s=a.transform(n.data,i);if(n.common.async)return Promise.resolve(s).then(async o=>{if(r.value==="aborted")return g;const u=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return u.status==="aborted"?g:u.status==="dirty"||r.value==="dirty"?Ee(u.value):u});{if(r.value==="aborted")return g;const o=this._def.schema._parseSync({data:s,path:n.path,parent:n});return o.status==="aborted"?g:o.status==="dirty"||r.value==="dirty"?Ee(o.value):o}}if(a.type==="refinement"){const s=o=>{const u=a.refinement(o,i);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),s(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?g:(o.status==="dirty"&&r.dirty(),s(o.value).then(()=>({status:r.value,value:o.value}))))}if(a.type==="transform")if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!xe(s))return g;const o=a.transform(s.value,i);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>xe(s)?Promise.resolve(a.transform(s.value,i)).then(o=>({status:r.value,value:o})):g);O.assertNever(a)}}ae.create=(t,e,r)=>new ae({schema:t,typeName:_.ZodEffects,effect:e,...b(r)});ae.createWithPreprocess=(t,e,r)=>new ae({schema:e,effect:{type:"preprocess",transform:t},typeName:_.ZodEffects,...b(r)});class W extends x{_parse(e){return this._getType(e)===v.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}W.create=(t,e)=>new W({innerType:t,typeName:_.ZodOptional,...b(e)});class ie extends x{_parse(e){return this._getType(e)===v.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ie.create=(t,e)=>new ie({innerType:t,typeName:_.ZodNullable,...b(e)});class He extends x{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===v.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}He.create=(t,e)=>new He({innerType:t,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...b(e)});class De extends x{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},a=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Fe(a)?a.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new K(n.common.issues)},input:n.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new K(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}De.create=(t,e)=>new De({innerType:t,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...b(e)});class Zt extends x{_parse(e){if(this._getType(e)!==v.nan){const n=this._getOrReturnCtx(e);return f(n,{code:c.invalid_type,expected:v.nan,received:n.parsedType}),g}return{status:"valid",value:e.data}}}Zt.create=t=>new Zt({typeName:_.ZodNaN,...b(t)});class mt extends x{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ke extends x{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?g:i.status==="dirty"?(r.dirty(),Ee(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?g:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(e,r){return new Ke({in:e,out:r,typeName:_.ZodPipeline})}}class qe extends x{_parse(e){const r=this._def.innerType._parse(e),n=a=>(xe(a)&&(a.value=Object.freeze(a.value)),a);return Fe(r)?r.then(a=>n(a)):n(r)}unwrap(){return this._def.innerType}}qe.create=(t,e)=>new qe({innerType:t,typeName:_.ZodReadonly,...b(e)});var _;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_||(_={}));const Hn=J.create,qn=ce.create;le.create;const Jn=ze.create;we.create;const ye=ut.create,Kn=dt.create;re.create;const Yn=z.create,_n=C.create,Gn=Ve.create,Xn=Re.create,Qn=ne.create,bn=Ue.create,ea=Be.create,kn=fe.create;We.create;W.create;ie.create;const ta={string:t=>J.create({...t,coerce:!0}),number:t=>ce.create({...t,coerce:!0}),boolean:t=>ze.create({...t,coerce:!0}),bigint:t=>le.create({...t,coerce:!0}),date:t=>we.create({...t,coerce:!0})};function Ce(t){if(typeof t!="string")return t;if(t!=="")return t}function xn(t){if(!(typeof File<"u"&&t instanceof File&&t.name===""&&t.size===0))return t}function wn(t){return typeof t!="string"||t.trim()===""?t:Number(t)}function On(t){return typeof t!="string"?t:t==="on"?!0:t}function Sn(t){if(typeof t!="string")return t;var e=new Date(t);return isNaN(e.getTime())?t:e}function Nn(t){if(typeof t!="string"||t.trim()==="")return t;try{return BigInt(t)}catch{return t}}function Tn(t){return typeof File>"u"?!1:t._def.effect.type==="refinement"&&t.innerType()._def.typeName==="ZodAny"&&t.safeParse(new File([],"")).success&&!t.safeParse("").success}function ue(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:n=>n;return n=>r(e(t(n)))}function An(t,e){var r=t._def;if(r.typeName==="ZodString"||r.typeName==="ZodEnum"||r.typeName==="ZodNativeEnum")return e.string;if(r.typeName==="ZodLiteral"){var n=t.value;return typeof n=="number"?e.number:typeof n=="boolean"?e.boolean:typeof n=="bigint"?e.bigint:e.string}else{if(r.typeName==="ZodEffects"&&Tn(t))return e.file;if(r.typeName==="ZodNumber")return e.number;if(r.typeName==="ZodBoolean")return e.boolean;if(r.typeName==="ZodDate")return e.date;if(r.typeName==="ZodBigInt")return e.bigint}return null}function Z(t,e){var r=e.cache.get(t);if(r)return r;var n=t,a=t._def,i=e.coerce(t);if(i)n=ye().transform(i).pipe(t);else if(a.typeName==="ZodArray")n=ye().transform(u=>Array.isArray(u)?u:typeof u>"u"||typeof e.stripEmptyValue(u)>"u"?[]:[u]).pipe(new z(S(S({},a),{},{type:Z(a.type,e)})));else if(a.typeName==="ZodObject")n=ye().transform(u=>typeof u>"u"?{}:u).pipe(new C(S(S({},a),{},{shape:()=>Object.fromEntries(Object.entries(a.shape()).map(u=>{var[d,m]=u;return[d,Z(m,e)]}))})));else if(a.typeName==="ZodEffects")n=new ae(S(S({},a),{},{schema:Z(a.schema,e)}));else if(a.typeName==="ZodOptional")n=ye().transform(e.stripEmptyValue).pipe(new W(S(S({},a),{},{innerType:Z(a.innerType,e)})));else if(a.typeName==="ZodDefault"){var s=a.defaultValue();n=ye().transform(e.stripEmptyValue).pipe(Z(a.innerType,e).optional()).transform(u=>u??s)}else if(a.typeName==="ZodCatch")n=new De(S(S({},a),{},{innerType:Z(a.innerType,e)}));else if(a.typeName==="ZodIntersection")n=new Re(S(S({},a),{},{left:Z(a.left,e),right:Z(a.right,e)}));else if(a.typeName==="ZodUnion")n=new Ve(S(S({},a),{},{options:a.options.map(u=>Z(u,e))}));else if(a.typeName==="ZodDiscriminatedUnion")n=ye().transform(u=>typeof u>"u"?{}:u).pipe(new ht(S(S({},a),{},{options:a.options.map(u=>Z(u,e)),optionsMap:new Map(Array.from(a.optionsMap.entries()).map(u=>{var[d,m]=u;return[d,Z(m,e)]}))})));else if(a.typeName==="ZodBranded")n=new mt(S(S({},a),{},{type:Z(a.type,e)}));else if(a.typeName==="ZodTuple")n=new ne(S(S({},a),{},{items:a.items.map(u=>Z(u,e))}));else if(a.typeName==="ZodNullable")n=new ie(S(S({},a),{},{innerType:Z(a.innerType,e)}));else if(a.typeName==="ZodPipeline")n=new Ke(S(S({},a),{},{in:Z(a.in,e),out:Z(a.out,e)}));else if(a.typeName==="ZodLazy"){var o=a.getter();n=bn(()=>Z(o,e))}return t!==n&&e.cache.set(t,n),n}function Cn(t,e){var r=(a,i)=>i||(s=>s),n={string:ue(Ce,r()),file:ue(xn,r()),number:ue(Ce,r(),r("number",wn)),boolean:ue(Ce,r(),r("boolean",On)),date:ue(Ce,r(),r("date",Sn)),bigint:ue(Ce,r(),r("bigint",Nn))};return Z(t,{cache:new Map,stripEmptyValue:ue(n.string,n.file),coerce:a=>{var i,s=(i=void 0)!==null&&i!==void 0?i:null;return s===null&&(s=An(a,n)),s}})}function En(t,e){var r={};for(var n of t.errors){var a=G(n.path);switch(n.message){case Vt.VALIDATION_UNDEFINED:return null;case Vt.VALIDATION_SKIPPED:r[a]=null;break;default:{var i=r[a];i!==null&&(i?r[a]=i.concat(n):r[a]=[n]);break}}}return Object.entries(r).reduce((s,o)=>{var[u,d]=o;return s[u]=d?e(d):null,s},{})}function In(t,e){return _r(t,{resolve(r,n){var a=e.errorMap,i=typeof e.schema=="function"?e.schema(n):e.schema,s=e.disableAutoCoercion?i:Cn(i),o=u=>{var d;return{value:u.success?u.data:void 0,error:u.success?void 0:En(u.error,(d=e.formatError)!==null&&d!==void 0?d:m=>m.map(w=>w.message))}};return e.async?s.safeParseAsync(r,{errorMap:a}).then(u=>o(u)):o(s.safeParse(r,{errorMap:a}))}})}var Vt={VALIDATION_SKIPPED:"__skipped__",VALIDATION_UNDEFINED:"__undefined__"};function jn(t){function e(a,i){var u;const s=t[i];if(!s)throw new Error(`Unknown client hint: ${typeof i=="string"?i:"Unknown"}`);const o=(u=a.split(";").map(d=>d.trim()).find(d=>d.startsWith(s.cookieName+"=")))==null?void 0:u.split("=")[1];return o?decodeURIComponent(o):null}function r(a){const i=typeof document<"u"?document.cookie:typeof a<"u"?a.headers.get("Cookie")??"":"";return Object.entries(t).reduce((s,[o,u])=>{const d=o;return"transform"in u?s[d]=u.transform(e(i,d)??u.fallback):s[d]=e(i,d)??u.fallback,s},{})}function n(){return`
2
- // This block of code allows us to check if the client hints have changed and
3
- // force a reload of the page with updated hints if they have so you don't get
4
- // a flash of incorrect content.
5
- function checkClientHints() {
6
- if (!navigator.cookieEnabled) return;
7
-
8
- // set a short-lived cookie to make sure we can set cookies
9
- document.cookie = "canSetCookies=1; Max-Age=60; SameSite=Lax; path=/";
10
- const canSetCookies = document.cookie.includes("canSetCookies=1");
11
- document.cookie = "canSetCookies=; Max-Age=-1; path=/";
12
- if (!canSetCookies) return;
13
-
14
- const cookies = document.cookie.split(';').map(c => c.trim()).reduce((acc, cur) => {
15
- const [key, value] = cur.split('=');
16
- acc[key] = value;
17
- return acc;
18
- }, {});
19
-
20
- let cookieChanged = false;
21
- const hints = [
22
- ${Object.values(t).map(a=>{const i=JSON.stringify(a.cookieName);return`{ name: ${i}, actual: String(${a.getValueCode}), value: cookies[${i}] != null ? cookies[${i}] : encodeURIComponent("${a.fallback}") }`}).join(`,
23
- `)}
24
- ];
25
- for (const hint of hints) {
26
- document.cookie = encodeURIComponent(hint.name) + '=' + encodeURIComponent(hint.actual) + '; Max-Age=31536000; path=/';
27
- if (decodeURIComponent(hint.value) !== hint.actual) {
28
- cookieChanged = true;
29
- }
30
- }
31
- if (cookieChanged) window.location.reload();
32
- }
33
-
34
- checkClientHints();
35
- `}return{getHints:r,getClientHintCheckScript:n}}const qt={cookieName:"CH-prefers-color-scheme",getValueCode:"window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'",fallback:"light",transform(t){return t==="dark"?"dark":"light"}};function Pn(t,e=qt.cookieName){const r=window.matchMedia("(prefers-color-scheme: dark)");function n(){const a=r.matches?"dark":"light";document.cookie=`${e}=${a}; Max-Age=31536000; Path=/`,t(a)}return r.addEventListener("change",n),function(){r.removeEventListener("change",n)}}const Jt={cookieName:"CH-reduced-motion",getValueCode:"window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'reduce' : 'no-preference'",fallback:"no-preference",transform(t){return t==="reduce"?"reduce":"no-preference"}};function Zn(t,e=Jt.cookieName){const r=window.matchMedia("(prefers-reduced-motion: reduce)");function n(){const a=r.matches?"reduce":"no-preference";document.cookie=`${e}=${a}; Max-Age=31536000; Path=/`,t(a)}return r.addEventListener("change",n),function(){r.removeEventListener("change",n)}}const Vn={cookieName:"CH-time-zone",getValueCode:"Intl.DateTimeFormat().resolvedOptions().timeZone",fallback:"UTC"};function pt(){return ar("root").requestInfo}const Kt="EpicShop_CH-prefers-color-scheme",Yt="EpicShop_CH-reduced-motion",Rn=jn({theme:{...qt,cookieName:Kt},timeZone:{...Vn,cookieName:"EpicShop_CH-time-zone"},reducedMotion:{...Jt,cookieName:Yt}});function $n(){return pt().hints}function ra(){const{revalidate:t}=rr();return U.useEffect(()=>Pn(()=>t(),Kt),[t]),U.useEffect(()=>Zn(()=>t(),Yt),[t]),M.jsx("script",{dangerouslySetInnerHTML:{__html:Rn.getClientHintCheckScript()}})}function Dn({id:t,errors:e}){const r=e==null?void 0:e.filter(Boolean);return r!=null&&r.length?M.jsx("ul",{id:t,className:"space-y-1",children:r.map(n=>M.jsx("li",{className:"text-foreground-destructive text-[10px]",children:n},n))}):null}const Mn="/theme",Ln=_n({theme:kn(["system","light","dark"])});function na(){const t=pt(),e=or(),r=sr(),[n]=Fr({lastResult:r.data,onValidate({formData:o}){return In(o,{schema:Ln})}}),a=t.session.theme??"system",i=a==="system"?"light":a==="light"?"dark":"system",s={light:M.jsx(Ge,{size:"md",name:"Sun",title:"Light mode"}),dark:M.jsx(Ge,{size:"md",name:"Moon",title:"Dark mode"}),system:M.jsx(Ge,{size:"md",name:"Laptop",title:"System mode"})};return M.jsxs(r.Form,{method:"POST",action:Mn,...Ur(n),children:[M.jsxs("div",{className:"flex gap-2",children:[e,M.jsx("input",{type:"hidden",name:"theme",value:i}),M.jsx(nr,{content:`Change theme from ${a} mode`,children:M.jsx("button",{type:"submit",name:"intent",value:"update-theme",className:"flex h-8 w-8 cursor-pointer items-center justify-center",children:s[a]})})]}),M.jsx(Dn,{errors:n.errors,id:n.errorId})]})}function aa(){var i;const t=$n(),e=pt(),n=ir().find(s=>{var o;return((o=s.formData)==null?void 0:o.get("intent"))==="update-theme"}),a=(i=n==null?void 0:n.formData)==null?void 0:i.get("theme");return a==="system"?t.theme:a==="light"||a==="dark"?a:e.session.theme??t.theme}export{ra as C,na as T,pt as a,Yn as b,$n as c,Gn as d,Kn as e,Jn as f,ta as g,Xn as i,ea as l,qn as n,_n as o,Hn as s,Qn as t,aa as u};
36
- //# sourceMappingURL=index-CEP3Xxa0.js.map