@aussieljk/forkbook 0.0.0-stage → 0.0.1-2

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 (598) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +77 -2
  3. package/assets/addon-vitest/templates/vitest.config.4.template.ts +36 -0
  4. package/assets/browser/favicon-wrapper.svg +46 -0
  5. package/assets/browser/favicon.svg +1 -0
  6. package/assets/browser/nunito-sans-bold-italic.woff2 +0 -0
  7. package/assets/browser/nunito-sans-bold.woff2 +0 -0
  8. package/assets/browser/nunito-sans-italic.woff2 +0 -0
  9. package/assets/browser/nunito-sans-regular.woff2 +0 -0
  10. package/assets/builder-vite/iframe.html +99 -0
  11. package/assets/create/rendererAssets/.eslintrc.json +16 -0
  12. package/assets/create/rendererAssets/common/Configure.mdx +388 -0
  13. package/assets/create/rendererAssets/common/assets/accessibility.png +0 -0
  14. package/assets/create/rendererAssets/common/assets/accessibility.svg +1 -0
  15. package/assets/create/rendererAssets/common/assets/addon-library.png +0 -0
  16. package/assets/create/rendererAssets/common/assets/assets.png +0 -0
  17. package/assets/create/rendererAssets/common/assets/avif-test-image.avif +0 -0
  18. package/assets/create/rendererAssets/common/assets/context.png +0 -0
  19. package/assets/create/rendererAssets/common/assets/discord.svg +1 -0
  20. package/assets/create/rendererAssets/common/assets/docs.png +0 -0
  21. package/assets/create/rendererAssets/common/assets/figma-plugin.png +0 -0
  22. package/assets/create/rendererAssets/common/assets/github.svg +1 -0
  23. package/assets/create/rendererAssets/common/assets/share.png +0 -0
  24. package/assets/create/rendererAssets/common/assets/styling.png +0 -0
  25. package/assets/create/rendererAssets/common/assets/testing.png +0 -0
  26. package/assets/create/rendererAssets/common/assets/theming.png +0 -0
  27. package/assets/create/rendererAssets/common/assets/tutorials.svg +1 -0
  28. package/assets/create/rendererAssets/common/assets/youtube.svg +1 -0
  29. package/assets/create/rendererAssets/common/button.css +30 -0
  30. package/assets/create/rendererAssets/common/header.css +32 -0
  31. package/assets/create/rendererAssets/common/page.css +68 -0
  32. package/assets/create/templates/react-native/index.expo.js +20 -0
  33. package/assets/create/templates/react-native/index.js +25 -0
  34. package/assets/docs/addon-backgrounds.gif +0 -0
  35. package/assets/docs/addon-controls-args-annotated.png +0 -0
  36. package/assets/docs/addon-controls-args-background-color.png +0 -0
  37. package/assets/docs/addon-controls-args-background-string.png +0 -0
  38. package/assets/docs/addon-controls-args-docs.png +0 -0
  39. package/assets/docs/addon-controls-args-logging.png +0 -0
  40. package/assets/docs/addon-controls-args-no-annotation.png +0 -0
  41. package/assets/docs/addon-controls-args-reflow-slider.png +0 -0
  42. package/assets/docs/addon-controls-args-reflow.png +0 -0
  43. package/assets/docs/addon-controls-args-template.png +0 -0
  44. package/assets/docs/addon-controls-expanded.png +0 -0
  45. package/assets/docs/addon-controls-hero.gif +0 -0
  46. package/assets/docs/addon-controls-install.png +0 -0
  47. package/assets/docs/hero.gif +0 -0
  48. package/assets/docs/highlight.png +0 -0
  49. package/assets/docs/message-reference.png +0 -0
  50. package/assets/docs/viewport.png +0 -0
  51. package/assets/react-native/metro-env.d.ts +69 -0
  52. package/assets/server/addon.tsconfig.json +6 -0
  53. package/assets/server/base-preview-body.html +116 -0
  54. package/assets/server/base-preview-head.html +494 -0
  55. package/assets/server/openBrowser.applescript +94 -0
  56. package/assets/server/template.ejs +87 -0
  57. package/dist/.build-stamp +0 -0
  58. package/dist/_browser-chunks/Color-PCLE2J36.js +1025 -0
  59. package/dist/_browser-chunks/DocsRenderer-JXND3PVQ.js +10 -0
  60. package/dist/_browser-chunks/WithTooltip-XSQFTBMB.js +1619 -0
  61. package/dist/_browser-chunks/chunk-2JDQ35OA.js +247 -0
  62. package/dist/_browser-chunks/chunk-2JT76G3E.js +104 -0
  63. package/dist/_browser-chunks/chunk-2MEPHP35.js +17 -0
  64. package/dist/_browser-chunks/chunk-2SCZVUKW.js +24 -0
  65. package/dist/_browser-chunks/chunk-46Z7NGAS.js +41 -0
  66. package/dist/_browser-chunks/chunk-4ATQOMJB.js +30 -0
  67. package/dist/_browser-chunks/chunk-52CW7FF7.js +49 -0
  68. package/dist/_browser-chunks/chunk-5I7E4GMO.js +62 -0
  69. package/dist/_browser-chunks/chunk-5P4QA6MY.js +20 -0
  70. package/dist/_browser-chunks/chunk-5WMXI5GW.js +816 -0
  71. package/dist/_browser-chunks/chunk-66OCZ54D.js +2604 -0
  72. package/dist/_browser-chunks/chunk-6SXYJQST.js +253 -0
  73. package/dist/_browser-chunks/chunk-AYRF6EJB.js +36 -0
  74. package/dist/_browser-chunks/chunk-B4AUNNU4.js +156 -0
  75. package/dist/_browser-chunks/chunk-BCP2FFXF.js +369 -0
  76. package/dist/_browser-chunks/chunk-C3D4HEFY.js +3396 -0
  77. package/dist/_browser-chunks/chunk-CFAOWGL7.js +43 -0
  78. package/dist/_browser-chunks/chunk-CFWWCCZV.js +223 -0
  79. package/dist/_browser-chunks/chunk-CNED6RYH.js +18 -0
  80. package/dist/_browser-chunks/chunk-DRQKCCAG.js +136 -0
  81. package/dist/_browser-chunks/chunk-ECQ75MKQ.js +0 -0
  82. package/dist/_browser-chunks/chunk-EIYAKDGP.js +302 -0
  83. package/dist/_browser-chunks/chunk-ENKK74N4.js +12 -0
  84. package/dist/_browser-chunks/chunk-FENFYI4X.js +698 -0
  85. package/dist/_browser-chunks/chunk-FJGWSWL5.js +155 -0
  86. package/dist/_browser-chunks/chunk-FVSEPWWX.js +2810 -0
  87. package/dist/_browser-chunks/chunk-GNZY6LOW.js +10116 -0
  88. package/dist/_browser-chunks/chunk-IE4ULIOQ.js +14 -0
  89. package/dist/_browser-chunks/chunk-IMSF75WX.js +42 -0
  90. package/dist/_browser-chunks/chunk-IWQGIXJS.js +14 -0
  91. package/dist/_browser-chunks/chunk-JMC7AIKT.js +108 -0
  92. package/dist/_browser-chunks/chunk-JPUOQJUI.js +8 -0
  93. package/dist/_browser-chunks/chunk-JSBKXXXF.js +218 -0
  94. package/dist/_browser-chunks/chunk-JWSKPMPC.js +73 -0
  95. package/dist/_browser-chunks/chunk-JYVGARBG.js +2943 -0
  96. package/dist/_browser-chunks/chunk-KBK7GKBN.js +35 -0
  97. package/dist/_browser-chunks/chunk-KQ7CRO2B.js +108 -0
  98. package/dist/_browser-chunks/chunk-LAWXTSXK.js +18 -0
  99. package/dist/_browser-chunks/chunk-LE2LTDW3.js +14 -0
  100. package/dist/_browser-chunks/chunk-LEVSOOLQ.js +48 -0
  101. package/dist/_browser-chunks/chunk-LV5PIKV4.js +93 -0
  102. package/dist/_browser-chunks/chunk-MDOL7KML.js +56 -0
  103. package/dist/_browser-chunks/chunk-MFMDGWP6.js +34 -0
  104. package/dist/_browser-chunks/chunk-MLBOOZL4.js +67 -0
  105. package/dist/_browser-chunks/chunk-NQUD4B7H.js +91 -0
  106. package/dist/_browser-chunks/chunk-NULBREPZ.js +43 -0
  107. package/dist/_browser-chunks/chunk-NZMVUW5T.js +7 -0
  108. package/dist/_browser-chunks/chunk-OD6IBQCC.js +117 -0
  109. package/dist/_browser-chunks/chunk-ODVJ3XZJ.js +157 -0
  110. package/dist/_browser-chunks/chunk-OQWFVDIN.js +386 -0
  111. package/dist/_browser-chunks/chunk-OVH3USFB.js +20 -0
  112. package/dist/_browser-chunks/chunk-OZZPSYQR.js +14 -0
  113. package/dist/_browser-chunks/chunk-P6PK47TQ.js +1970 -0
  114. package/dist/_browser-chunks/chunk-PFRNG3UC.js +22 -0
  115. package/dist/_browser-chunks/chunk-PJSMZ27A.js +13 -0
  116. package/dist/_browser-chunks/chunk-QC4HFS6K.js +41 -0
  117. package/dist/_browser-chunks/chunk-QDXFODK4.js +274 -0
  118. package/dist/_browser-chunks/chunk-RBCHTR7C.js +28 -0
  119. package/dist/_browser-chunks/chunk-RMYQ3QN3.js +294 -0
  120. package/dist/_browser-chunks/chunk-RNTIV5CE.js +411 -0
  121. package/dist/_browser-chunks/chunk-RSPAQWVJ.js +80 -0
  122. package/dist/_browser-chunks/chunk-S6TK43XQ.js +836 -0
  123. package/dist/_browser-chunks/chunk-SC67XZST.js +18 -0
  124. package/dist/_browser-chunks/chunk-SFVA4SBT.js +683 -0
  125. package/dist/_browser-chunks/chunk-SZYFOQMT.js +25 -0
  126. package/dist/_browser-chunks/chunk-TBJCJXK4.js +18 -0
  127. package/dist/_browser-chunks/chunk-UMDO3KB7.js +205 -0
  128. package/dist/_browser-chunks/chunk-V2G23FV7.js +11 -0
  129. package/dist/_browser-chunks/chunk-V5M7Q4HT.js +88 -0
  130. package/dist/_browser-chunks/chunk-W5M6NPS3.js +198 -0
  131. package/dist/_browser-chunks/chunk-W7NE2JXW.js +84 -0
  132. package/dist/_browser-chunks/chunk-WGVAAM43.js +1110 -0
  133. package/dist/_browser-chunks/chunk-WHQRNHXD.js +8 -0
  134. package/dist/_browser-chunks/chunk-WOSOWBCA.js +12 -0
  135. package/dist/_browser-chunks/chunk-WZ7KR7SH.js +85 -0
  136. package/dist/_browser-chunks/chunk-YEKO6BHJ.js +20 -0
  137. package/dist/_browser-chunks/chunk-YI2IBIQS.js +7 -0
  138. package/dist/_browser-chunks/chunk-YTIT5NA5.js +1966 -0
  139. package/dist/_browser-chunks/chunk-ZEHRUHTA.js +6 -0
  140. package/dist/_browser-chunks/chunk-ZTQ5MEJ5.js +203 -0
  141. package/dist/_browser-chunks/matchers-YLBYSYAF.js +1263 -0
  142. package/dist/_browser-chunks/react-dom-client-4OHE3QDV.js +9 -0
  143. package/dist/_node-chunks/attached-runtime-I2G4WLJI.js +282 -0
  144. package/dist/_node-chunks/builder-manager-VVHYQXCH.js +1661 -0
  145. package/dist/_node-chunks/chunk-2BUPBPFB.js +82 -0
  146. package/dist/_node-chunks/chunk-2DSIDINN.js +884 -0
  147. package/dist/_node-chunks/chunk-2RU7BKEW.js +23 -0
  148. package/dist/_node-chunks/chunk-34EO2PUT.js +26 -0
  149. package/dist/_node-chunks/chunk-3BKIBF5S.js +3008 -0
  150. package/dist/_node-chunks/chunk-3SDUYDXH.js +98 -0
  151. package/dist/_node-chunks/chunk-3T4ZSNPH.js +662 -0
  152. package/dist/_node-chunks/chunk-3W7F2B7P.js +79 -0
  153. package/dist/_node-chunks/chunk-3Y6AAY5H.js +80 -0
  154. package/dist/_node-chunks/chunk-42UWAGPW.js +1193 -0
  155. package/dist/_node-chunks/chunk-4FEANXWU.js +1986 -0
  156. package/dist/_node-chunks/chunk-5DQFEZEA.js +40 -0
  157. package/dist/_node-chunks/chunk-6KEHV53S.js +1218 -0
  158. package/dist/_node-chunks/chunk-6LMWA44H.js +3837 -0
  159. package/dist/_node-chunks/chunk-6YKBRP72.js +20 -0
  160. package/dist/_node-chunks/chunk-7GUDZVRQ.js +110 -0
  161. package/dist/_node-chunks/chunk-B5J7Q7J4.js +21 -0
  162. package/dist/_node-chunks/chunk-BS2WMZMR.js +90 -0
  163. package/dist/_node-chunks/chunk-BSKFCWQD.js +47 -0
  164. package/dist/_node-chunks/chunk-BXVYT7SB.js +36 -0
  165. package/dist/_node-chunks/chunk-CCOTJ4FC.js +688 -0
  166. package/dist/_node-chunks/chunk-CQKMLL5J.js +33 -0
  167. package/dist/_node-chunks/chunk-CXRU72ET.js +63 -0
  168. package/dist/_node-chunks/chunk-DC7DKR5K.js +20 -0
  169. package/dist/_node-chunks/chunk-DHJFTB4K.js +25 -0
  170. package/dist/_node-chunks/chunk-DUR55DJJ.js +1094 -0
  171. package/dist/_node-chunks/chunk-E6YESGLX.js +7032 -0
  172. package/dist/_node-chunks/chunk-EHUNOMDD.js +52345 -0
  173. package/dist/_node-chunks/chunk-ET7PWEO7.js +298 -0
  174. package/dist/_node-chunks/chunk-EWOX7HPJ.js +20 -0
  175. package/dist/_node-chunks/chunk-F3ZFKBHY.js +844 -0
  176. package/dist/_node-chunks/chunk-FK7KGTV7.js +26 -0
  177. package/dist/_node-chunks/chunk-FPZB5OI7.js +35 -0
  178. package/dist/_node-chunks/chunk-FW2HQUBQ.js +25 -0
  179. package/dist/_node-chunks/chunk-FY6UXW6G.js +11 -0
  180. package/dist/_node-chunks/chunk-GEFQN7K3.js +499 -0
  181. package/dist/_node-chunks/chunk-GRBLDJCR.js +989 -0
  182. package/dist/_node-chunks/chunk-H32DYT6P.js +87 -0
  183. package/dist/_node-chunks/chunk-H4PPVMP5.js +23 -0
  184. package/dist/_node-chunks/chunk-HMP2G23X.js +25 -0
  185. package/dist/_node-chunks/chunk-ICPBH3E7.js +59 -0
  186. package/dist/_node-chunks/chunk-IDEL2J23.js +23 -0
  187. package/dist/_node-chunks/chunk-IK4FGZLR.js +223 -0
  188. package/dist/_node-chunks/chunk-JDXXX6LB.js +68 -0
  189. package/dist/_node-chunks/chunk-JGGFYIG5.js +5468 -0
  190. package/dist/_node-chunks/chunk-JPAZLYJ3.js +29 -0
  191. package/dist/_node-chunks/chunk-JZOO7GGC.js +48 -0
  192. package/dist/_node-chunks/chunk-KISMCCP5.js +4744 -0
  193. package/dist/_node-chunks/chunk-LCK4ZQKG.js +115 -0
  194. package/dist/_node-chunks/chunk-LO56I6E2.js +132 -0
  195. package/dist/_node-chunks/chunk-LXBD4UL4.js +104 -0
  196. package/dist/_node-chunks/chunk-MA24JW6C.js +7162 -0
  197. package/dist/_node-chunks/chunk-MK2KYAI6.js +5414 -0
  198. package/dist/_node-chunks/chunk-NDWKJ4CL.js +2102 -0
  199. package/dist/_node-chunks/chunk-NIBT7XDZ.js +168 -0
  200. package/dist/_node-chunks/chunk-NPO45IMH.js +33 -0
  201. package/dist/_node-chunks/chunk-OISX4AGQ.js +414 -0
  202. package/dist/_node-chunks/chunk-OUW6R7C3.js +26 -0
  203. package/dist/_node-chunks/chunk-OWNFOGTA.js +194 -0
  204. package/dist/_node-chunks/chunk-Q7QNUM5H.js +49 -0
  205. package/dist/_node-chunks/chunk-QEQLR22M.js +1877 -0
  206. package/dist/_node-chunks/chunk-RRN2V55B.js +45 -0
  207. package/dist/_node-chunks/chunk-RWFIFGO5.js +144 -0
  208. package/dist/_node-chunks/chunk-RXNJDRGO.js +209 -0
  209. package/dist/_node-chunks/chunk-RZMQ7S3L.js +92 -0
  210. package/dist/_node-chunks/chunk-SIEXZVCR.js +51 -0
  211. package/dist/_node-chunks/chunk-SLWQNBGO.js +2034 -0
  212. package/dist/_node-chunks/chunk-SVTBJ7Q3.js +35 -0
  213. package/dist/_node-chunks/chunk-SWO5CDYU.js +32 -0
  214. package/dist/_node-chunks/chunk-TD5PLLQG.js +121 -0
  215. package/dist/_node-chunks/chunk-TEQGGSP7.js +33 -0
  216. package/dist/_node-chunks/chunk-TFCEV2XX.js +155 -0
  217. package/dist/_node-chunks/chunk-TFEWM4E3.js +1073 -0
  218. package/dist/_node-chunks/chunk-TINO74G5.js +21 -0
  219. package/dist/_node-chunks/chunk-TNJIXE37.js +40 -0
  220. package/dist/_node-chunks/chunk-TWI4GVH7.js +19 -0
  221. package/dist/_node-chunks/chunk-U5W53R2J.js +1011 -0
  222. package/dist/_node-chunks/chunk-UBOGWBEA.js +148 -0
  223. package/dist/_node-chunks/chunk-UMUBKI6E.js +3787 -0
  224. package/dist/_node-chunks/chunk-UVINFLGY.js +56 -0
  225. package/dist/_node-chunks/chunk-V2DY426G.js +1133 -0
  226. package/dist/_node-chunks/chunk-VLOXOXXE.js +45 -0
  227. package/dist/_node-chunks/chunk-W4OMYLSP.js +1297 -0
  228. package/dist/_node-chunks/chunk-WAXVSN3O.js +18 -0
  229. package/dist/_node-chunks/chunk-WCULS5TP.js +3767 -0
  230. package/dist/_node-chunks/chunk-WNZ2UMFM.js +153 -0
  231. package/dist/_node-chunks/chunk-WZJF2OUH.js +74 -0
  232. package/dist/_node-chunks/chunk-XGIUVY52.js +611 -0
  233. package/dist/_node-chunks/chunk-XHL2LVBM.js +415 -0
  234. package/dist/_node-chunks/chunk-XI6B6P47.js +59 -0
  235. package/dist/_node-chunks/chunk-XLP2ZKXV.js +60 -0
  236. package/dist/_node-chunks/chunk-YCMRA6RX.js +95 -0
  237. package/dist/_node-chunks/chunk-YZFWBA5L.js +2700 -0
  238. package/dist/_node-chunks/chunk-ZMAMXQKP.js +4731 -0
  239. package/dist/_node-chunks/chunk-ZWBCQ4MJ.js +110 -0
  240. package/dist/_node-chunks/dist-VTSTZKUB.js +16 -0
  241. package/dist/_node-chunks/globby-OEMHPBFY.js +2884 -0
  242. package/dist/_node-chunks/jiti-NFX6UU74.js +3848 -0
  243. package/dist/_node-chunks/lib-MDVARD7W.js +366 -0
  244. package/dist/_node-chunks/local-runtime-NTKIN2QT.js +78 -0
  245. package/dist/_node-chunks/mdx-plugin-MWISDWDQ.js +5680 -0
  246. package/dist/_node-chunks/monorepo-LIRFMQXE.js +121 -0
  247. package/dist/_node-chunks/monorepo-optimized-tests-relaxed-limits-no-story-deletion-CPDW4XTW.js +121 -0
  248. package/dist/_node-chunks/optimized-tests-HDOLR3EY.js +22 -0
  249. package/dist/_node-chunks/pattern-copy-play-EKHIUAU2.js +807 -0
  250. package/dist/_node-chunks/postinstallAddon-GYGMWDL6.js +20 -0
  251. package/dist/_node-chunks/rehype-external-links-BUN3HUCO.js +121 -0
  252. package/dist/_node-chunks/rehype-slug-PLADX223.js +52 -0
  253. package/dist/_node-chunks/relaxed-limits-GBHW6KIQ.js +117 -0
  254. package/dist/_node-chunks/run-KDTIZNSY.js +103 -0
  255. package/dist/_node-chunks/run-NL66VTNR.js +4532 -0
  256. package/dist/_node-chunks/session-id-KIIVOQLR.js +23 -0
  257. package/dist/_node-chunks/setup-MGC7BQO6.js +278 -0
  258. package/dist/_node-chunks/vitest.config.4.template-JH2THZFG.js +54 -0
  259. package/dist/actions/decorator.d.ts +7 -0
  260. package/dist/actions/decorator.js +43 -0
  261. package/dist/actions/index.d.ts +67 -0
  262. package/dist/actions/index.js +28 -0
  263. package/dist/addon-a11y/index.d.ts +52 -0
  264. package/dist/addon-a11y/index.js +16 -0
  265. package/dist/addon-a11y/manager.js +1429 -0
  266. package/dist/addon-a11y/preset.js +18 -0
  267. package/dist/addon-a11y/preview.d.ts +17 -0
  268. package/dist/addon-a11y/preview.js +15 -0
  269. package/dist/addon-docs/blocks.d.ts +1061 -0
  270. package/dist/addon-docs/blocks.js +2461 -0
  271. package/dist/addon-docs/index.d.ts +236 -0
  272. package/dist/addon-docs/index.js +16 -0
  273. package/dist/addon-docs/manager.js +90 -0
  274. package/dist/addon-docs/mdx-react-shim.d.ts +1 -0
  275. package/dist/addon-docs/mdx-react-shim.js +2 -0
  276. package/dist/addon-docs/preset.js +378 -0
  277. package/dist/addon-docs/preview.d.ts +4 -0
  278. package/dist/addon-docs/preview.js +7 -0
  279. package/dist/addon-links/index.d.ts +22 -0
  280. package/dist/addon-links/index.js +20 -0
  281. package/dist/addon-links/manager.js +14 -0
  282. package/dist/addon-links/preview.d.ts +6 -0
  283. package/dist/addon-links/preview.js +9 -0
  284. package/dist/addon-links/react/index.d.ts +25 -0
  285. package/dist/addon-links/react/index.js +52 -0
  286. package/dist/addon-mcp/preset.js +1345 -0
  287. package/dist/addon-mcp/preview.js +29 -0
  288. package/dist/addon-mcp/tools/preview-stories/preview-stories-app-script.js +1153 -0
  289. package/dist/addon-ondevice-actions/index.d.ts +4 -0
  290. package/dist/addon-ondevice-actions/index.js +7 -0
  291. package/dist/addon-ondevice-actions/register.js +7 -0
  292. package/dist/addon-ondevice-controls/index.d.ts +6 -0
  293. package/dist/addon-ondevice-controls/index.js +14 -0
  294. package/dist/addon-ondevice-controls/register.js +10 -0
  295. package/dist/addon-pseudo-states/index.d.ts +35 -0
  296. package/dist/addon-pseudo-states/index.js +15 -0
  297. package/dist/addon-pseudo-states/manager.js +53 -0
  298. package/dist/addon-pseudo-states/preview.d.ts +9 -0
  299. package/dist/addon-pseudo-states/preview.js +10 -0
  300. package/dist/addon-themes/index.d.ts +80 -0
  301. package/dist/addon-themes/index.js +104 -0
  302. package/dist/addon-themes/manager.js +97 -0
  303. package/dist/addon-themes/postinstall.js +33 -0
  304. package/dist/addon-themes/preview.d.ts +6 -0
  305. package/dist/addon-themes/preview.js +8 -0
  306. package/dist/addon-vitest/constants.d.ts +132 -0
  307. package/dist/addon-vitest/constants.js +66 -0
  308. package/dist/addon-vitest/index.d.ts +4 -0
  309. package/dist/addon-vitest/index.js +8 -0
  310. package/dist/addon-vitest/manager.js +665 -0
  311. package/dist/addon-vitest/node/coverage-reporter.js +1284 -0
  312. package/dist/addon-vitest/node/vitest.js +674 -0
  313. package/dist/addon-vitest/postinstall.js +24 -0
  314. package/dist/addon-vitest/preset.js +943 -0
  315. package/dist/addon-vitest/vitest-plugin/global-setup.js +162 -0
  316. package/dist/addon-vitest/vitest-plugin/index.d.ts +56 -0
  317. package/dist/addon-vitest/vitest-plugin/index.js +463 -0
  318. package/dist/addon-vitest/vitest-plugin/setup-file-with-project-annotations.js +9 -0
  319. package/dist/addon-vitest/vitest-plugin/setup-file.browser.4.js +20 -0
  320. package/dist/addon-vitest/vitest-plugin/setup-file.js +50 -0
  321. package/dist/addon-vitest/vitest-plugin/test-utils.js +128 -0
  322. package/dist/babel/index.d.ts +2301 -0
  323. package/dist/babel/index.js +61 -0
  324. package/dist/backgrounds/index.d.ts +6 -0
  325. package/dist/backgrounds/index.js +15 -0
  326. package/dist/bin/core.js +1705 -0
  327. package/dist/bin/dispatcher.js +43 -0
  328. package/dist/bin/loader.js +115 -0
  329. package/dist/builder-vite/index.d.ts +50 -0
  330. package/dist/builder-vite/index.js +245 -0
  331. package/dist/builder-vite/preset.js +27 -0
  332. package/dist/channels/index.d.ts +2 -0
  333. package/dist/channels/index.js +352 -0
  334. package/dist/chunk-B2t1tGRh.d.ts +284 -0
  335. package/dist/chunk-BCoJQE-f.d.ts +602 -0
  336. package/dist/chunk-BGkgZp-H.d.ts +214 -0
  337. package/dist/chunk-BTVrWliM.d.ts +115 -0
  338. package/dist/chunk-BXLImeLy.d.ts +197 -0
  339. package/dist/chunk-BfBzpgct.d.ts +916 -0
  340. package/dist/chunk-Bpi2tz-6.d.ts +511 -0
  341. package/dist/chunk-BxWufQms.d.ts +142 -0
  342. package/dist/chunk-C-bavsOH.d.ts +34 -0
  343. package/dist/chunk-C2p5r3Vt.d.ts +13001 -0
  344. package/dist/chunk-C6PAgHLT.d.ts +12 -0
  345. package/dist/chunk-CMeX4WRe.d.ts +179 -0
  346. package/dist/chunk-Ct9xd6IM.d.ts +65 -0
  347. package/dist/chunk-CwQKNaYL.d.ts +15 -0
  348. package/dist/chunk-D7DwV41f.d.ts +3622 -0
  349. package/dist/chunk-DEVFdzxR.d.ts +253 -0
  350. package/dist/chunk-DaVb55-_.d.ts +124 -0
  351. package/dist/chunk-DgRNfmj_.d.ts +40 -0
  352. package/dist/chunk-DoIGKY33.d.ts +666 -0
  353. package/dist/chunk-Dr3R0DXk.d.ts +40 -0
  354. package/dist/chunk-DtHByo32.d.ts +55 -0
  355. package/dist/chunk-Dw1z1Pki.d.ts +933 -0
  356. package/dist/chunk-DzuY9DXg.d.ts +79 -0
  357. package/dist/chunk-FjDVzZTj.d.ts +62 -0
  358. package/dist/chunk-Kt1tW-D1.d.ts +59 -0
  359. package/dist/chunk-XP8oHzpE.d.ts +6 -0
  360. package/dist/chunk-gCX81nOr.d.ts +61 -0
  361. package/dist/chunk-pcFXCimE.d.ts +741 -0
  362. package/dist/cli/index.d.ts +1174 -0
  363. package/dist/cli/index.js +5613 -0
  364. package/dist/cli/skills/content/index.d.ts +72 -0
  365. package/dist/cli/skills/content/index.js +335 -0
  366. package/dist/cli/tools/sdk/child-host.d.ts +61 -0
  367. package/dist/cli/tools/sdk/child-host.js +131 -0
  368. package/dist/cli/tools/sdk/index.d.ts +137 -0
  369. package/dist/cli/tools/sdk/index.js +44 -0
  370. package/dist/cli-commands/bin/index.js +25 -0
  371. package/dist/client-logger/index.d.ts +31 -0
  372. package/dist/client-logger/index.js +63 -0
  373. package/dist/common/index.d.ts +1103 -0
  374. package/dist/common/index.js +364 -0
  375. package/dist/components/index.d.ts +1924 -0
  376. package/dist/components/index.js +13759 -0
  377. package/dist/core-events/index.d.ts +155 -0
  378. package/dist/core-events/index.js +136 -0
  379. package/dist/core-server/index.d.ts +2200 -0
  380. package/dist/core-server/index.js +4165 -0
  381. package/dist/core-server/presets/common-manager.css +170 -0
  382. package/dist/core-server/presets/common-manager.js +4168 -0
  383. package/dist/core-server/presets/common-override-preset.js +81 -0
  384. package/dist/core-server/presets/common-preset.js +2187 -0
  385. package/dist/create/bin/index.js +23 -0
  386. package/dist/create/index.js +25 -0
  387. package/dist/csf/csf-utils.d.ts +2 -0
  388. package/dist/csf/csf-utils.js +19 -0
  389. package/dist/csf/index.d.ts +7 -0
  390. package/dist/csf/index.js +2142 -0
  391. package/dist/csf-tools/index.d.ts +1157 -0
  392. package/dist/csf-tools/index.js +736 -0
  393. package/dist/docs-tools/index.d.ts +197 -0
  394. package/dist/docs-tools/index.js +61 -0
  395. package/dist/highlight/index.d.ts +10 -0
  396. package/dist/highlight/index.js +15 -0
  397. package/dist/instrumenter/index.d.ts +113 -0
  398. package/dist/instrumenter/index.js +2595 -0
  399. package/dist/manager/_manager-chunks/globals-runtime-8HkdnU2F.js +6144 -0
  400. package/dist/manager/_manager-chunks/globals-runtime-BIKBO23x.js +3389 -0
  401. package/dist/manager/_manager-chunks/globals-runtime-BdGkqNEt.js +45 -0
  402. package/dist/manager/_manager-chunks/globals-runtime-BmphMP6z.js +1190 -0
  403. package/dist/manager/_manager-chunks/globals-runtime-BvM-NY2g.js +13307 -0
  404. package/dist/manager/_manager-chunks/globals-runtime-C02fvgcd.js +9243 -0
  405. package/dist/manager/_manager-chunks/globals-runtime-DkAPXCvc.js +9766 -0
  406. package/dist/manager/_manager-chunks/globals-runtime-DpNYC-qi.js +5564 -0
  407. package/dist/manager/_manager-chunks/globals-runtime-DtcOnYHR.js +5357 -0
  408. package/dist/manager/_manager-chunks/globals-runtime-DwFqpqya.js +722 -0
  409. package/dist/manager/_manager-chunks/globals-runtime-FC201B7s.js +6837 -0
  410. package/dist/manager/_manager-chunks/globals-runtime-Rp_zjGnh.js +121 -0
  411. package/dist/manager/_manager-chunks/globals-runtime-ZHrQFa3-.js +10463 -0
  412. package/dist/manager/_manager-chunks/globals-runtime-eLPTIfX-.js +7759 -0
  413. package/dist/manager/_manager-chunks/globals-runtime-qKvCZHFY.js +4468 -0
  414. package/dist/manager/_manager-chunks/globals-runtime-sGpNlIJ1.js +5102 -0
  415. package/dist/manager/_manager-chunks/runtime-B1L9TH89.js +452 -0
  416. package/dist/manager/_manager-chunks/runtime-BK0zF7FN.js +22 -0
  417. package/dist/manager/_manager-chunks/runtime-BhkT2CXl.js +1408 -0
  418. package/dist/manager/_manager-chunks/runtime-Bly6WJLN.js +998 -0
  419. package/dist/manager/_manager-chunks/runtime-D0UOWx0U.js +979 -0
  420. package/dist/manager/_manager-chunks/runtime-D94Vq3oR.js +4014 -0
  421. package/dist/manager/_manager-chunks/runtime-DMig8mT7.js +77 -0
  422. package/dist/manager/_manager-chunks/runtime-EITvVbkG.js +46 -0
  423. package/dist/manager/_manager-chunks/runtime-cp5pazY2.js +8936 -0
  424. package/dist/manager/_manager-chunks/runtime-eDVAYF7N.js +6860 -0
  425. package/dist/manager/_manager-chunks/runtime-i-PDAHLR.js +2493 -0
  426. package/dist/manager/globals-runtime.js +2 -0
  427. package/dist/manager/globals.d.ts +23 -0
  428. package/dist/manager/globals.js +26 -0
  429. package/dist/manager/manager-stores.d.ts +2 -0
  430. package/dist/manager/manager-stores.js +19 -0
  431. package/dist/manager/runtime.js +2 -0
  432. package/dist/manager-api/index.d.ts +2 -0
  433. package/dist/manager-api/index.js +3257 -0
  434. package/dist/manager-errors.d.ts +89 -0
  435. package/dist/manager-errors.js +20 -0
  436. package/dist/mcp/index.d.ts +270 -0
  437. package/dist/mcp/index.js +305 -0
  438. package/dist/mocking-utils/index.d.ts +689 -0
  439. package/dist/mocking-utils/index.js +521 -0
  440. package/dist/mocking-utils/mocker-runtime.js +1254 -0
  441. package/dist/nextjs-vite/config/preview.js +3 -0
  442. package/dist/nextjs-vite/export-mocks/cache/index.d.ts +25 -0
  443. package/dist/nextjs-vite/export-mocks/cache/index.js +29 -0
  444. package/dist/nextjs-vite/export-mocks/headers/index.d.ts +37 -0
  445. package/dist/nextjs-vite/export-mocks/headers/index.js +54 -0
  446. package/dist/nextjs-vite/export-mocks/link/index.d.ts +9 -0
  447. package/dist/nextjs-vite/export-mocks/link/index.js +59 -0
  448. package/dist/nextjs-vite/export-mocks/navigation/index.d.ts +28 -0
  449. package/dist/nextjs-vite/export-mocks/navigation/index.js +58 -0
  450. package/dist/nextjs-vite/export-mocks/router/index.d.ts +34 -0
  451. package/dist/nextjs-vite/export-mocks/router/index.js +63 -0
  452. package/dist/nextjs-vite/index.d.ts +92 -0
  453. package/dist/nextjs-vite/index.js +58 -0
  454. package/dist/nextjs-vite/node/index.d.ts +6 -0
  455. package/dist/nextjs-vite/node/index.js +20 -0
  456. package/dist/nextjs-vite/preset.js +648 -0
  457. package/dist/nextjs-vite/preview.d.ts +20 -0
  458. package/dist/nextjs-vite/preview.js +11 -0
  459. package/dist/nextjs-vite/vite-plugin/index.d.ts +6 -0
  460. package/dist/nextjs-vite/vite-plugin/index.js +19 -0
  461. package/dist/nextjs-vite-plugin/index.d.ts +28 -0
  462. package/dist/nextjs-vite-plugin/index.js +923 -0
  463. package/dist/nextjs-vite-plugin/mocks/storybook.global.js +29 -0
  464. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-context.js +8 -0
  465. package/dist/nextjs-vite-plugin/plugins/next-image/alias/image-default-loader.js +23 -0
  466. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-image.js +28 -0
  467. package/dist/nextjs-vite-plugin/plugins/next-image/alias/next-legacy-image.js +17 -0
  468. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/cache/index.js +29 -0
  469. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/dynamic/index.js +40 -0
  470. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/headers/index.js +55 -0
  471. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/link/index.js +63 -0
  472. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/navigation/index.js +71 -0
  473. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/router/index.js +74 -0
  474. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/rsc/server-only.js +7 -0
  475. package/dist/nextjs-vite-plugin/plugins/next-mocks/alias/safe-stable-stringify/index.js +13 -0
  476. package/dist/nextjs-vite-plugin/plugins/next-mocks/compatibility/draft-mode.compat.js +7 -0
  477. package/dist/node-logger/index.d.ts +495 -0
  478. package/dist/node-logger/index.js +42 -0
  479. package/dist/oxc-parser/index.d.ts +99 -0
  480. package/dist/oxc-parser/index.js +275 -0
  481. package/dist/oxc-parser/worker.js +37 -0
  482. package/dist/preview/_chunks/runtime-BIzIdDbb.js +10263 -0
  483. package/dist/preview/_chunks/runtime-BTPtVY1p.js +1102 -0
  484. package/dist/preview/_chunks/runtime-BZSnICCg.js +8484 -0
  485. package/dist/preview/_chunks/runtime-BdGkqNEt.js +45 -0
  486. package/dist/preview/_chunks/runtime-BwSxqk3t.js +63 -0
  487. package/dist/preview/_chunks/runtime-CqHxptiK.js +6143 -0
  488. package/dist/preview/_chunks/runtime-CsV4HZPV.js +5064 -0
  489. package/dist/preview/_chunks/runtime-CxZK_Ln3.js +284 -0
  490. package/dist/preview/_chunks/runtime-DZToXfvO.js +9767 -0
  491. package/dist/preview/_chunks/runtime-DrTjJkPY.js +3872 -0
  492. package/dist/preview/_chunks/runtime-DuHdxMFA.js +387 -0
  493. package/dist/preview/_chunks/runtime-iXdo8CR8.js +3635 -0
  494. package/dist/preview/_chunks/runtime-q3wt0e_N.js +6838 -0
  495. package/dist/preview/globals.d.ts +16 -0
  496. package/dist/preview/globals.js +20 -0
  497. package/dist/preview/runtime.js +6 -0
  498. package/dist/preview-api/index.d.ts +4 -0
  499. package/dist/preview-api/index.js +147 -0
  500. package/dist/preview-errors.d.ts +186 -0
  501. package/dist/preview-errors.js +56 -0
  502. package/dist/react/docgen/docgen-worker.js +38 -0
  503. package/dist/react/entry-preview-argtypes.js +9 -0
  504. package/dist/react/entry-preview-docs.js +12 -0
  505. package/dist/react/entry-preview-rsc.js +11 -0
  506. package/dist/react/entry-preview.js +21 -0
  507. package/dist/react/index.d.ts +119 -0
  508. package/dist/react/index.js +26 -0
  509. package/dist/react/preset.js +301 -0
  510. package/dist/react/preview.d.ts +2 -0
  511. package/dist/react/preview.js +11 -0
  512. package/dist/react-native/bin/get-stories.js +34 -0
  513. package/dist/react-native/index.d.ts +160 -0
  514. package/dist/react-native/index.js +1547 -0
  515. package/dist/react-native/metro/node.d.ts +83 -0
  516. package/dist/react-native/metro/node.js +21 -0
  517. package/dist/react-native/metro/withStorybook.d.ts +2269 -0
  518. package/dist/react-native/metro/withStorybook.js +138 -0
  519. package/dist/react-native/preview.d.ts +6 -0
  520. package/dist/react-native/preview.js +20 -0
  521. package/dist/react-native/scripts/generate.d.ts +22 -0
  522. package/dist/react-native/scripts/generate.js +18 -0
  523. package/dist/react-native/stub.js +20 -0
  524. package/dist/react-native-theming/index.d.ts +175 -0
  525. package/dist/react-native-theming/index.js +2591 -0
  526. package/dist/react-native-ui/index.d.ts +130 -0
  527. package/dist/react-native-ui/index.js +1448 -0
  528. package/dist/react-native-ui-common/index.d.ts +230 -0
  529. package/dist/react-native-ui-common/index.js +514 -0
  530. package/dist/react-vite/index.d.ts +4 -0
  531. package/dist/react-vite/index.js +8 -0
  532. package/dist/react-vite/node/index.d.ts +6 -0
  533. package/dist/react-vite/node/index.js +20 -0
  534. package/dist/react-vite/preset.d.ts +6 -0
  535. package/dist/react-vite/preset.js +21 -0
  536. package/dist/router/index.d.ts +141 -0
  537. package/dist/router/index.js +1217 -0
  538. package/dist/server-errors.d.ts +2 -0
  539. package/dist/server-errors.js +149 -0
  540. package/dist/shared/open-service/index.d.ts +3 -0
  541. package/dist/shared/open-service/index.js +115 -0
  542. package/dist/shared/open-service/services/docgen/worker/docgen-worker.js +75 -0
  543. package/dist/shared/open-service/toolsets/docs/public.d.ts +1296 -0
  544. package/dist/shared/open-service/toolsets/docs/public.js +991 -0
  545. package/dist/telemetry/index.d.ts +314 -0
  546. package/dist/telemetry/index.js +103 -0
  547. package/dist/test/index.d.ts +158 -0
  548. package/dist/test/index.js +19421 -0
  549. package/dist/theming/create.d.ts +15 -0
  550. package/dist/theming/create.js +11 -0
  551. package/dist/theming/index.d.ts +54 -0
  552. package/dist/theming/index.js +511 -0
  553. package/dist/types/index.d.ts +2 -0
  554. package/dist/types/index.js +48 -0
  555. package/dist/viewport/index.d.ts +275 -0
  556. package/dist/viewport/index.js +21 -0
  557. package/package.json +1054 -4
  558. package/template/nextjs-vite/cli/.eslintrc.json +6 -0
  559. package/template/nextjs-vite/cli/js/Button.jsx +42 -0
  560. package/template/nextjs-vite/cli/js/Button.stories.js +49 -0
  561. package/template/nextjs-vite/cli/js/Configure.mdx +470 -0
  562. package/template/nextjs-vite/cli/js/Header.jsx +58 -0
  563. package/template/nextjs-vite/cli/js/Header.stories.js +30 -0
  564. package/template/nextjs-vite/cli/js/Page.jsx +68 -0
  565. package/template/nextjs-vite/cli/js/Page.stories.js +28 -0
  566. package/template/nextjs-vite/cli/ts/Button.stories.ts +54 -0
  567. package/template/nextjs-vite/cli/ts/Button.tsx +39 -0
  568. package/template/nextjs-vite/cli/ts/Configure.mdx +446 -0
  569. package/template/nextjs-vite/cli/ts/Header.stories.ts +34 -0
  570. package/template/nextjs-vite/cli/ts/Header.tsx +54 -0
  571. package/template/nextjs-vite/cli/ts/Page.stories.ts +33 -0
  572. package/template/nextjs-vite/cli/ts/Page.tsx +73 -0
  573. package/template/react/cli/.eslintrc.json +5 -0
  574. package/template/react/cli/js/Button.jsx +39 -0
  575. package/template/react/cli/js/Button.stories.js +49 -0
  576. package/template/react/cli/js/Header.jsx +56 -0
  577. package/template/react/cli/js/Header.stories.js +29 -0
  578. package/template/react/cli/js/Page.jsx +69 -0
  579. package/template/react/cli/js/Page.stories.js +28 -0
  580. package/template/react/cli/ts/Button.stories.ts +54 -0
  581. package/template/react/cli/ts/Button.tsx +37 -0
  582. package/template/react/cli/ts/Header.stories.ts +34 -0
  583. package/template/react/cli/ts/Header.tsx +56 -0
  584. package/template/react/cli/ts/Page.stories.ts +33 -0
  585. package/template/react/cli/ts/Page.tsx +73 -0
  586. package/template/react-vite/cli/.eslintrc.json +5 -0
  587. package/template/react-vite/cli/js/Button.jsx +39 -0
  588. package/template/react-vite/cli/js/Button.stories.js +49 -0
  589. package/template/react-vite/cli/js/Header.jsx +56 -0
  590. package/template/react-vite/cli/js/Header.stories.js +29 -0
  591. package/template/react-vite/cli/js/Page.jsx +69 -0
  592. package/template/react-vite/cli/js/Page.stories.js +28 -0
  593. package/template/react-vite/cli/ts/Button.stories.ts +54 -0
  594. package/template/react-vite/cli/ts/Button.tsx +37 -0
  595. package/template/react-vite/cli/ts/Header.stories.ts +34 -0
  596. package/template/react-vite/cli/ts/Header.tsx +56 -0
  597. package/template/react-vite/cli/ts/Page.stories.ts +33 -0
  598. package/template/react-vite/cli/ts/Page.tsx +73 -0
@@ -0,0 +1,3008 @@
1
+ import CJS_COMPAT_NODE_URL_ro17f80mg6k from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ro17f80mg6k from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ro17f80mg6k from "node:module";
4
+
5
+ var __filename = CJS_COMPAT_NODE_URL_ro17f80mg6k.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ro17f80mg6k.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ro17f80mg6k.createRequire(import.meta.url);
8
+
9
+ // ------------------------------------------------------------
10
+ // end of CJS compatibility banner, injected by Forkbook's esbuild configuration
11
+ // ------------------------------------------------------------
12
+ import {
13
+ invariant
14
+ } from "./chunk-RZMQ7S3L.js";
15
+ import {
16
+ __export
17
+ } from "./chunk-CXRU72ET.js";
18
+
19
+ // src/cli/globalSettings.ts
20
+ import fs from "node:fs/promises";
21
+ import { homedir } from "node:os";
22
+ import { dirname, join } from "node:path";
23
+ import { dedent } from "ts-dedent";
24
+
25
+ // ../../node_modules/zod/v3/external.js
26
+ var external_exports = {};
27
+ __export(external_exports, {
28
+ BRAND: () => BRAND,
29
+ DIRTY: () => DIRTY,
30
+ EMPTY_PATH: () => EMPTY_PATH,
31
+ INVALID: () => INVALID,
32
+ NEVER: () => NEVER,
33
+ OK: () => OK,
34
+ ParseStatus: () => ParseStatus,
35
+ Schema: () => ZodType,
36
+ ZodAny: () => ZodAny,
37
+ ZodArray: () => ZodArray,
38
+ ZodBigInt: () => ZodBigInt,
39
+ ZodBoolean: () => ZodBoolean,
40
+ ZodBranded: () => ZodBranded,
41
+ ZodCatch: () => ZodCatch,
42
+ ZodDate: () => ZodDate,
43
+ ZodDefault: () => ZodDefault,
44
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
45
+ ZodEffects: () => ZodEffects,
46
+ ZodEnum: () => ZodEnum,
47
+ ZodError: () => ZodError,
48
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
49
+ ZodFunction: () => ZodFunction,
50
+ ZodIntersection: () => ZodIntersection,
51
+ ZodIssueCode: () => ZodIssueCode,
52
+ ZodLazy: () => ZodLazy,
53
+ ZodLiteral: () => ZodLiteral,
54
+ ZodMap: () => ZodMap,
55
+ ZodNaN: () => ZodNaN,
56
+ ZodNativeEnum: () => ZodNativeEnum,
57
+ ZodNever: () => ZodNever,
58
+ ZodNull: () => ZodNull,
59
+ ZodNullable: () => ZodNullable,
60
+ ZodNumber: () => ZodNumber,
61
+ ZodObject: () => ZodObject,
62
+ ZodOptional: () => ZodOptional,
63
+ ZodParsedType: () => ZodParsedType,
64
+ ZodPipeline: () => ZodPipeline,
65
+ ZodPromise: () => ZodPromise,
66
+ ZodReadonly: () => ZodReadonly,
67
+ ZodRecord: () => ZodRecord,
68
+ ZodSchema: () => ZodType,
69
+ ZodSet: () => ZodSet,
70
+ ZodString: () => ZodString,
71
+ ZodSymbol: () => ZodSymbol,
72
+ ZodTransformer: () => ZodEffects,
73
+ ZodTuple: () => ZodTuple,
74
+ ZodType: () => ZodType,
75
+ ZodUndefined: () => ZodUndefined,
76
+ ZodUnion: () => ZodUnion,
77
+ ZodUnknown: () => ZodUnknown,
78
+ ZodVoid: () => ZodVoid,
79
+ addIssueToContext: () => addIssueToContext,
80
+ any: () => anyType,
81
+ array: () => arrayType,
82
+ bigint: () => bigIntType,
83
+ boolean: () => booleanType,
84
+ coerce: () => coerce,
85
+ custom: () => custom,
86
+ date: () => dateType,
87
+ datetimeRegex: () => datetimeRegex,
88
+ defaultErrorMap: () => en_default,
89
+ discriminatedUnion: () => discriminatedUnionType,
90
+ effect: () => effectsType,
91
+ enum: () => enumType,
92
+ function: () => functionType,
93
+ getErrorMap: () => getErrorMap,
94
+ getParsedType: () => getParsedType,
95
+ instanceof: () => instanceOfType,
96
+ intersection: () => intersectionType,
97
+ isAborted: () => isAborted,
98
+ isAsync: () => isAsync,
99
+ isDirty: () => isDirty,
100
+ isValid: () => isValid,
101
+ late: () => late,
102
+ lazy: () => lazyType,
103
+ literal: () => literalType,
104
+ makeIssue: () => makeIssue,
105
+ map: () => mapType,
106
+ nan: () => nanType,
107
+ nativeEnum: () => nativeEnumType,
108
+ never: () => neverType,
109
+ null: () => nullType,
110
+ nullable: () => nullableType,
111
+ number: () => numberType,
112
+ object: () => objectType,
113
+ objectUtil: () => objectUtil,
114
+ oboolean: () => oboolean,
115
+ onumber: () => onumber,
116
+ optional: () => optionalType,
117
+ ostring: () => ostring,
118
+ pipeline: () => pipelineType,
119
+ preprocess: () => preprocessType,
120
+ promise: () => promiseType,
121
+ quotelessJson: () => quotelessJson,
122
+ record: () => recordType,
123
+ set: () => setType,
124
+ setErrorMap: () => setErrorMap,
125
+ strictObject: () => strictObjectType,
126
+ string: () => stringType,
127
+ symbol: () => symbolType,
128
+ transformer: () => effectsType,
129
+ tuple: () => tupleType,
130
+ undefined: () => undefinedType,
131
+ union: () => unionType,
132
+ unknown: () => unknownType,
133
+ util: () => util,
134
+ void: () => voidType
135
+ });
136
+
137
+ // ../../node_modules/zod/v3/helpers/util.js
138
+ var util;
139
+ (function(util2) {
140
+ util2.assertEqual = (_) => {
141
+ };
142
+ function assertIs(_arg) {
143
+ }
144
+ util2.assertIs = assertIs;
145
+ function assertNever(_x) {
146
+ throw new Error();
147
+ }
148
+ util2.assertNever = assertNever, util2.arrayToEnum = (items) => {
149
+ let obj = {};
150
+ for (let item of items)
151
+ obj[item] = item;
152
+ return obj;
153
+ }, util2.getValidEnumValues = (obj) => {
154
+ let validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] != "number"), filtered = {};
155
+ for (let k of validKeys)
156
+ filtered[k] = obj[k];
157
+ return util2.objectValues(filtered);
158
+ }, util2.objectValues = (obj) => util2.objectKeys(obj).map(function(e) {
159
+ return obj[e];
160
+ }), util2.objectKeys = typeof Object.keys == "function" ? (obj) => Object.keys(obj) : (object) => {
161
+ let keys = [];
162
+ for (let key in object)
163
+ Object.prototype.hasOwnProperty.call(object, key) && keys.push(key);
164
+ return keys;
165
+ }, util2.find = (arr, checker) => {
166
+ for (let item of arr)
167
+ if (checker(item))
168
+ return item;
169
+ }, util2.isInteger = typeof Number.isInteger == "function" ? (val) => Number.isInteger(val) : (val) => typeof val == "number" && Number.isFinite(val) && Math.floor(val) === val;
170
+ function joinValues(array, separator = " | ") {
171
+ return array.map((val) => typeof val == "string" ? `'${val}'` : val).join(separator);
172
+ }
173
+ util2.joinValues = joinValues, util2.jsonStringifyReplacer = (_, value) => typeof value == "bigint" ? value.toString() : value;
174
+ })(util || (util = {}));
175
+ var objectUtil;
176
+ (function(objectUtil2) {
177
+ objectUtil2.mergeShapes = (first, second) => ({
178
+ ...first,
179
+ ...second
180
+ // second overwrites first
181
+ });
182
+ })(objectUtil || (objectUtil = {}));
183
+ var ZodParsedType = util.arrayToEnum([
184
+ "string",
185
+ "nan",
186
+ "number",
187
+ "integer",
188
+ "float",
189
+ "boolean",
190
+ "date",
191
+ "bigint",
192
+ "symbol",
193
+ "function",
194
+ "undefined",
195
+ "null",
196
+ "array",
197
+ "object",
198
+ "unknown",
199
+ "promise",
200
+ "void",
201
+ "never",
202
+ "map",
203
+ "set"
204
+ ]), getParsedType = (data) => {
205
+ switch (typeof data) {
206
+ case "undefined":
207
+ return ZodParsedType.undefined;
208
+ case "string":
209
+ return ZodParsedType.string;
210
+ case "number":
211
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
212
+ case "boolean":
213
+ return ZodParsedType.boolean;
214
+ case "function":
215
+ return ZodParsedType.function;
216
+ case "bigint":
217
+ return ZodParsedType.bigint;
218
+ case "symbol":
219
+ return ZodParsedType.symbol;
220
+ case "object":
221
+ return Array.isArray(data) ? ZodParsedType.array : data === null ? ZodParsedType.null : data.then && typeof data.then == "function" && data.catch && typeof data.catch == "function" ? ZodParsedType.promise : typeof Map < "u" && data instanceof Map ? ZodParsedType.map : typeof Set < "u" && data instanceof Set ? ZodParsedType.set : typeof Date < "u" && data instanceof Date ? ZodParsedType.date : ZodParsedType.object;
222
+ default:
223
+ return ZodParsedType.unknown;
224
+ }
225
+ };
226
+
227
+ // ../../node_modules/zod/v3/ZodError.js
228
+ var ZodIssueCode = util.arrayToEnum([
229
+ "invalid_type",
230
+ "invalid_literal",
231
+ "custom",
232
+ "invalid_union",
233
+ "invalid_union_discriminator",
234
+ "invalid_enum_value",
235
+ "unrecognized_keys",
236
+ "invalid_arguments",
237
+ "invalid_return_type",
238
+ "invalid_date",
239
+ "invalid_string",
240
+ "too_small",
241
+ "too_big",
242
+ "invalid_intersection_types",
243
+ "not_multiple_of",
244
+ "not_finite"
245
+ ]), quotelessJson = (obj) => JSON.stringify(obj, null, 2).replace(/"([^"]+)":/g, "$1:"), ZodError = class _ZodError extends Error {
246
+ get errors() {
247
+ return this.issues;
248
+ }
249
+ constructor(issues) {
250
+ super(), this.issues = [], this.addIssue = (sub) => {
251
+ this.issues = [...this.issues, sub];
252
+ }, this.addIssues = (subs = []) => {
253
+ this.issues = [...this.issues, ...subs];
254
+ };
255
+ let actualProto = new.target.prototype;
256
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, actualProto) : this.__proto__ = actualProto, this.name = "ZodError", this.issues = issues;
257
+ }
258
+ format(_mapper) {
259
+ let mapper = _mapper || function(issue) {
260
+ return issue.message;
261
+ }, fieldErrors = { _errors: [] }, processError = (error) => {
262
+ for (let issue of error.issues)
263
+ if (issue.code === "invalid_union")
264
+ issue.unionErrors.map(processError);
265
+ else if (issue.code === "invalid_return_type")
266
+ processError(issue.returnTypeError);
267
+ else if (issue.code === "invalid_arguments")
268
+ processError(issue.argumentsError);
269
+ else if (issue.path.length === 0)
270
+ fieldErrors._errors.push(mapper(issue));
271
+ else {
272
+ let curr = fieldErrors, i = 0;
273
+ for (; i < issue.path.length; ) {
274
+ let el = issue.path[i];
275
+ i === issue.path.length - 1 ? (curr[el] = curr[el] || { _errors: [] }, curr[el]._errors.push(mapper(issue))) : curr[el] = curr[el] || { _errors: [] }, curr = curr[el], i++;
276
+ }
277
+ }
278
+ };
279
+ return processError(this), fieldErrors;
280
+ }
281
+ static assert(value) {
282
+ if (!(value instanceof _ZodError))
283
+ throw new Error(`Not a ZodError: ${value}`);
284
+ }
285
+ toString() {
286
+ return this.message;
287
+ }
288
+ get message() {
289
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
290
+ }
291
+ get isEmpty() {
292
+ return this.issues.length === 0;
293
+ }
294
+ flatten(mapper = (issue) => issue.message) {
295
+ let fieldErrors = {}, formErrors = [];
296
+ for (let sub of this.issues)
297
+ if (sub.path.length > 0) {
298
+ let firstEl = sub.path[0];
299
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [], fieldErrors[firstEl].push(mapper(sub));
300
+ } else
301
+ formErrors.push(mapper(sub));
302
+ return { formErrors, fieldErrors };
303
+ }
304
+ get formErrors() {
305
+ return this.flatten();
306
+ }
307
+ };
308
+ ZodError.create = (issues) => new ZodError(issues);
309
+
310
+ // ../../node_modules/zod/v3/locales/en.js
311
+ var errorMap = (issue, _ctx) => {
312
+ let message;
313
+ switch (issue.code) {
314
+ case ZodIssueCode.invalid_type:
315
+ issue.received === ZodParsedType.undefined ? message = "Required" : message = `Expected ${issue.expected}, received ${issue.received}`;
316
+ break;
317
+ case ZodIssueCode.invalid_literal:
318
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
319
+ break;
320
+ case ZodIssueCode.unrecognized_keys:
321
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
322
+ break;
323
+ case ZodIssueCode.invalid_union:
324
+ message = "Invalid input";
325
+ break;
326
+ case ZodIssueCode.invalid_union_discriminator:
327
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
328
+ break;
329
+ case ZodIssueCode.invalid_enum_value:
330
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
331
+ break;
332
+ case ZodIssueCode.invalid_arguments:
333
+ message = "Invalid function arguments";
334
+ break;
335
+ case ZodIssueCode.invalid_return_type:
336
+ message = "Invalid function return type";
337
+ break;
338
+ case ZodIssueCode.invalid_date:
339
+ message = "Invalid date";
340
+ break;
341
+ case ZodIssueCode.invalid_string:
342
+ typeof issue.validation == "object" ? "includes" in issue.validation ? (message = `Invalid input: must include "${issue.validation.includes}"`, typeof issue.validation.position == "number" && (message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`)) : "startsWith" in issue.validation ? message = `Invalid input: must start with "${issue.validation.startsWith}"` : "endsWith" in issue.validation ? message = `Invalid input: must end with "${issue.validation.endsWith}"` : util.assertNever(issue.validation) : issue.validation !== "regex" ? message = `Invalid ${issue.validation}` : message = "Invalid";
343
+ break;
344
+ case ZodIssueCode.too_small:
345
+ issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "more than"} ${issue.minimum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at least" : "over"} ${issue.minimum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "bigint" ? message = `Number must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${issue.minimum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly equal to " : issue.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(issue.minimum))}` : message = "Invalid input";
346
+ break;
347
+ case ZodIssueCode.too_big:
348
+ issue.type === "array" ? message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "less than"} ${issue.maximum} element(s)` : issue.type === "string" ? message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? "at most" : "under"} ${issue.maximum} character(s)` : issue.type === "number" ? message = `Number must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "bigint" ? message = `BigInt must be ${issue.exact ? "exactly" : issue.inclusive ? "less than or equal to" : "less than"} ${issue.maximum}` : issue.type === "date" ? message = `Date must be ${issue.exact ? "exactly" : issue.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(issue.maximum))}` : message = "Invalid input";
349
+ break;
350
+ case ZodIssueCode.custom:
351
+ message = "Invalid input";
352
+ break;
353
+ case ZodIssueCode.invalid_intersection_types:
354
+ message = "Intersection results could not be merged";
355
+ break;
356
+ case ZodIssueCode.not_multiple_of:
357
+ message = `Number must be a multiple of ${issue.multipleOf}`;
358
+ break;
359
+ case ZodIssueCode.not_finite:
360
+ message = "Number must be finite";
361
+ break;
362
+ default:
363
+ message = _ctx.defaultError, util.assertNever(issue);
364
+ }
365
+ return { message };
366
+ }, en_default = errorMap;
367
+
368
+ // ../../node_modules/zod/v3/errors.js
369
+ var overrideErrorMap = en_default;
370
+ function setErrorMap(map) {
371
+ overrideErrorMap = map;
372
+ }
373
+ function getErrorMap() {
374
+ return overrideErrorMap;
375
+ }
376
+
377
+ // ../../node_modules/zod/v3/helpers/parseUtil.js
378
+ var makeIssue = (params) => {
379
+ let { data, path, errorMaps, issueData } = params, fullPath = [...path, ...issueData.path || []], fullIssue = {
380
+ ...issueData,
381
+ path: fullPath
382
+ };
383
+ if (issueData.message !== void 0)
384
+ return {
385
+ ...issueData,
386
+ path: fullPath,
387
+ message: issueData.message
388
+ };
389
+ let errorMessage = "", maps = errorMaps.filter((m) => !!m).slice().reverse();
390
+ for (let map of maps)
391
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
392
+ return {
393
+ ...issueData,
394
+ path: fullPath,
395
+ message: errorMessage
396
+ };
397
+ }, EMPTY_PATH = [];
398
+ function addIssueToContext(ctx, issueData) {
399
+ let overrideMap = getErrorMap(), issue = makeIssue({
400
+ issueData,
401
+ data: ctx.data,
402
+ path: ctx.path,
403
+ errorMaps: [
404
+ ctx.common.contextualErrorMap,
405
+ // contextual error map is first priority
406
+ ctx.schemaErrorMap,
407
+ // then schema-bound map if available
408
+ overrideMap,
409
+ // then global override map
410
+ overrideMap === en_default ? void 0 : en_default
411
+ // then global default map
412
+ ].filter((x) => !!x)
413
+ });
414
+ ctx.common.issues.push(issue);
415
+ }
416
+ var ParseStatus = class _ParseStatus {
417
+ constructor() {
418
+ this.value = "valid";
419
+ }
420
+ dirty() {
421
+ this.value === "valid" && (this.value = "dirty");
422
+ }
423
+ abort() {
424
+ this.value !== "aborted" && (this.value = "aborted");
425
+ }
426
+ static mergeArray(status, results) {
427
+ let arrayValue = [];
428
+ for (let s of results) {
429
+ if (s.status === "aborted")
430
+ return INVALID;
431
+ s.status === "dirty" && status.dirty(), arrayValue.push(s.value);
432
+ }
433
+ return { status: status.value, value: arrayValue };
434
+ }
435
+ static async mergeObjectAsync(status, pairs) {
436
+ let syncPairs = [];
437
+ for (let pair of pairs) {
438
+ let key = await pair.key, value = await pair.value;
439
+ syncPairs.push({
440
+ key,
441
+ value
442
+ });
443
+ }
444
+ return _ParseStatus.mergeObjectSync(status, syncPairs);
445
+ }
446
+ static mergeObjectSync(status, pairs) {
447
+ let finalObject = {};
448
+ for (let pair of pairs) {
449
+ let { key, value } = pair;
450
+ if (key.status === "aborted" || value.status === "aborted")
451
+ return INVALID;
452
+ key.status === "dirty" && status.dirty(), value.status === "dirty" && status.dirty(), key.value !== "__proto__" && (typeof value.value < "u" || pair.alwaysSet) && (finalObject[key.value] = value.value);
453
+ }
454
+ return { status: status.value, value: finalObject };
455
+ }
456
+ }, INVALID = Object.freeze({
457
+ status: "aborted"
458
+ }), DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise < "u" && x instanceof Promise;
459
+
460
+ // ../../node_modules/zod/v3/helpers/errorUtil.js
461
+ var errorUtil;
462
+ (function(errorUtil2) {
463
+ errorUtil2.errToObj = (message) => typeof message == "string" ? { message } : message || {}, errorUtil2.toString = (message) => typeof message == "string" ? message : message?.message;
464
+ })(errorUtil || (errorUtil = {}));
465
+
466
+ // ../../node_modules/zod/v3/types.js
467
+ var ParseInputLazyPath = class {
468
+ constructor(parent, value, path, key) {
469
+ this._cachedPath = [], this.parent = parent, this.data = value, this._path = path, this._key = key;
470
+ }
471
+ get path() {
472
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
473
+ }
474
+ }, handleResult = (ctx, result) => {
475
+ if (isValid(result))
476
+ return { success: !0, data: result.value };
477
+ if (!ctx.common.issues.length)
478
+ throw new Error("Validation failed but no issues detected.");
479
+ return {
480
+ success: !1,
481
+ get error() {
482
+ if (this._error)
483
+ return this._error;
484
+ let error = new ZodError(ctx.common.issues);
485
+ return this._error = error, this._error;
486
+ }
487
+ };
488
+ };
489
+ function processCreateParams(params) {
490
+ if (!params)
491
+ return {};
492
+ let { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
493
+ if (errorMap2 && (invalid_type_error || required_error))
494
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
495
+ return errorMap2 ? { errorMap: errorMap2, description } : { errorMap: (iss, ctx) => {
496
+ let { message } = params;
497
+ return iss.code === "invalid_enum_value" ? { message: message ?? ctx.defaultError } : typeof ctx.data > "u" ? { message: message ?? required_error ?? ctx.defaultError } : iss.code !== "invalid_type" ? { message: ctx.defaultError } : { message: message ?? invalid_type_error ?? ctx.defaultError };
498
+ }, description };
499
+ }
500
+ var ZodType = class {
501
+ get description() {
502
+ return this._def.description;
503
+ }
504
+ _getType(input) {
505
+ return getParsedType(input.data);
506
+ }
507
+ _getOrReturnCtx(input, ctx) {
508
+ return ctx || {
509
+ common: input.parent.common,
510
+ data: input.data,
511
+ parsedType: getParsedType(input.data),
512
+ schemaErrorMap: this._def.errorMap,
513
+ path: input.path,
514
+ parent: input.parent
515
+ };
516
+ }
517
+ _processInputParams(input) {
518
+ return {
519
+ status: new ParseStatus(),
520
+ ctx: {
521
+ common: input.parent.common,
522
+ data: input.data,
523
+ parsedType: getParsedType(input.data),
524
+ schemaErrorMap: this._def.errorMap,
525
+ path: input.path,
526
+ parent: input.parent
527
+ }
528
+ };
529
+ }
530
+ _parseSync(input) {
531
+ let result = this._parse(input);
532
+ if (isAsync(result))
533
+ throw new Error("Synchronous parse encountered promise.");
534
+ return result;
535
+ }
536
+ _parseAsync(input) {
537
+ let result = this._parse(input);
538
+ return Promise.resolve(result);
539
+ }
540
+ parse(data, params) {
541
+ let result = this.safeParse(data, params);
542
+ if (result.success)
543
+ return result.data;
544
+ throw result.error;
545
+ }
546
+ safeParse(data, params) {
547
+ let ctx = {
548
+ common: {
549
+ issues: [],
550
+ async: params?.async ?? !1,
551
+ contextualErrorMap: params?.errorMap
552
+ },
553
+ path: params?.path || [],
554
+ schemaErrorMap: this._def.errorMap,
555
+ parent: null,
556
+ data,
557
+ parsedType: getParsedType(data)
558
+ }, result = this._parseSync({ data, path: ctx.path, parent: ctx });
559
+ return handleResult(ctx, result);
560
+ }
561
+ "~validate"(data) {
562
+ let ctx = {
563
+ common: {
564
+ issues: [],
565
+ async: !!this["~standard"].async
566
+ },
567
+ path: [],
568
+ schemaErrorMap: this._def.errorMap,
569
+ parent: null,
570
+ data,
571
+ parsedType: getParsedType(data)
572
+ };
573
+ if (!this["~standard"].async)
574
+ try {
575
+ let result = this._parseSync({ data, path: [], parent: ctx });
576
+ return isValid(result) ? {
577
+ value: result.value
578
+ } : {
579
+ issues: ctx.common.issues
580
+ };
581
+ } catch (err) {
582
+ err?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), ctx.common = {
583
+ issues: [],
584
+ async: !0
585
+ };
586
+ }
587
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
588
+ value: result.value
589
+ } : {
590
+ issues: ctx.common.issues
591
+ });
592
+ }
593
+ async parseAsync(data, params) {
594
+ let result = await this.safeParseAsync(data, params);
595
+ if (result.success)
596
+ return result.data;
597
+ throw result.error;
598
+ }
599
+ async safeParseAsync(data, params) {
600
+ let ctx = {
601
+ common: {
602
+ issues: [],
603
+ contextualErrorMap: params?.errorMap,
604
+ async: !0
605
+ },
606
+ path: params?.path || [],
607
+ schemaErrorMap: this._def.errorMap,
608
+ parent: null,
609
+ data,
610
+ parsedType: getParsedType(data)
611
+ }, maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx }), result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
612
+ return handleResult(ctx, result);
613
+ }
614
+ refine(check, message) {
615
+ let getIssueProperties = (val) => typeof message == "string" || typeof message > "u" ? { message } : typeof message == "function" ? message(val) : message;
616
+ return this._refinement((val, ctx) => {
617
+ let result = check(val), setError = () => ctx.addIssue({
618
+ code: ZodIssueCode.custom,
619
+ ...getIssueProperties(val)
620
+ });
621
+ return typeof Promise < "u" && result instanceof Promise ? result.then((data) => data ? !0 : (setError(), !1)) : result ? !0 : (setError(), !1);
622
+ });
623
+ }
624
+ refinement(check, refinementData) {
625
+ return this._refinement((val, ctx) => check(val) ? !0 : (ctx.addIssue(typeof refinementData == "function" ? refinementData(val, ctx) : refinementData), !1));
626
+ }
627
+ _refinement(refinement) {
628
+ return new ZodEffects({
629
+ schema: this,
630
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
631
+ effect: { type: "refinement", refinement }
632
+ });
633
+ }
634
+ superRefine(refinement) {
635
+ return this._refinement(refinement);
636
+ }
637
+ constructor(def) {
638
+ this.spa = this.safeParseAsync, this._def = def, 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"] = {
639
+ version: 1,
640
+ vendor: "zod",
641
+ validate: (data) => this["~validate"](data)
642
+ };
643
+ }
644
+ optional() {
645
+ return ZodOptional.create(this, this._def);
646
+ }
647
+ nullable() {
648
+ return ZodNullable.create(this, this._def);
649
+ }
650
+ nullish() {
651
+ return this.nullable().optional();
652
+ }
653
+ array() {
654
+ return ZodArray.create(this);
655
+ }
656
+ promise() {
657
+ return ZodPromise.create(this, this._def);
658
+ }
659
+ or(option) {
660
+ return ZodUnion.create([this, option], this._def);
661
+ }
662
+ and(incoming) {
663
+ return ZodIntersection.create(this, incoming, this._def);
664
+ }
665
+ transform(transform) {
666
+ return new ZodEffects({
667
+ ...processCreateParams(this._def),
668
+ schema: this,
669
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
670
+ effect: { type: "transform", transform }
671
+ });
672
+ }
673
+ default(def) {
674
+ let defaultValueFunc = typeof def == "function" ? def : () => def;
675
+ return new ZodDefault({
676
+ ...processCreateParams(this._def),
677
+ innerType: this,
678
+ defaultValue: defaultValueFunc,
679
+ typeName: ZodFirstPartyTypeKind.ZodDefault
680
+ });
681
+ }
682
+ brand() {
683
+ return new ZodBranded({
684
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
685
+ type: this,
686
+ ...processCreateParams(this._def)
687
+ });
688
+ }
689
+ catch(def) {
690
+ let catchValueFunc = typeof def == "function" ? def : () => def;
691
+ return new ZodCatch({
692
+ ...processCreateParams(this._def),
693
+ innerType: this,
694
+ catchValue: catchValueFunc,
695
+ typeName: ZodFirstPartyTypeKind.ZodCatch
696
+ });
697
+ }
698
+ describe(description) {
699
+ let This = this.constructor;
700
+ return new This({
701
+ ...this._def,
702
+ description
703
+ });
704
+ }
705
+ pipe(target) {
706
+ return ZodPipeline.create(this, target);
707
+ }
708
+ readonly() {
709
+ return ZodReadonly.create(this);
710
+ }
711
+ isOptional() {
712
+ return this.safeParse(void 0).success;
713
+ }
714
+ isNullable() {
715
+ return this.safeParse(null).success;
716
+ }
717
+ }, cuidRegex = /^c[^\s-]{8,}$/i, cuid2Regex = /^[0-9a-z]+$/, ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i, uuidRegex = /^[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, nanoidRegex = /^[a-z0-9_-]{21}$/i, jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, durationRegex = /^[-+]?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)?)??$/, emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, _emojiRegex = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", emojiRegex, ipv4Regex = /^(?:(?: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])$/, ipv4CidrRegex = /^(?:(?: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])$/, ipv6Regex = /^(([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]))$/, ipv6CidrRegex = /^(([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])$/, base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, dateRegexSource = "((\\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])))", dateRegex = new RegExp(`^${dateRegexSource}$`);
718
+ function timeRegexSource(args) {
719
+ let secondsRegexSource = "[0-5]\\d";
720
+ args.precision ? secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}` : args.precision == null && (secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`);
721
+ let secondsQuantifier = args.precision ? "+" : "?";
722
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
723
+ }
724
+ function timeRegex(args) {
725
+ return new RegExp(`^${timeRegexSource(args)}$`);
726
+ }
727
+ function datetimeRegex(args) {
728
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`, opts = [];
729
+ return opts.push(args.local ? "Z?" : "Z"), args.offset && opts.push("([+-]\\d{2}:?\\d{2})"), regex = `${regex}(${opts.join("|")})`, new RegExp(`^${regex}$`);
730
+ }
731
+ function isValidIP(ip, version) {
732
+ return !!((version === "v4" || !version) && ipv4Regex.test(ip) || (version === "v6" || !version) && ipv6Regex.test(ip));
733
+ }
734
+ function isValidJWT(jwt, alg) {
735
+ if (!jwtRegex.test(jwt))
736
+ return !1;
737
+ try {
738
+ let [header] = jwt.split(".");
739
+ if (!header)
740
+ return !1;
741
+ let base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "="), decoded = JSON.parse(atob(base64));
742
+ return !(typeof decoded != "object" || decoded === null || "typ" in decoded && decoded?.typ !== "JWT" || !decoded.alg || alg && decoded.alg !== alg);
743
+ } catch {
744
+ return !1;
745
+ }
746
+ }
747
+ function isValidCidr(ip, version) {
748
+ return !!((version === "v4" || !version) && ipv4CidrRegex.test(ip) || (version === "v6" || !version) && ipv6CidrRegex.test(ip));
749
+ }
750
+ var ZodString = class _ZodString extends ZodType {
751
+ _parse(input) {
752
+ if (this._def.coerce && (input.data = String(input.data)), this._getType(input) !== ZodParsedType.string) {
753
+ let ctx2 = this._getOrReturnCtx(input);
754
+ return addIssueToContext(ctx2, {
755
+ code: ZodIssueCode.invalid_type,
756
+ expected: ZodParsedType.string,
757
+ received: ctx2.parsedType
758
+ }), INVALID;
759
+ }
760
+ let status = new ParseStatus(), ctx;
761
+ for (let check of this._def.checks)
762
+ if (check.kind === "min")
763
+ input.data.length < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
764
+ code: ZodIssueCode.too_small,
765
+ minimum: check.value,
766
+ type: "string",
767
+ inclusive: !0,
768
+ exact: !1,
769
+ message: check.message
770
+ }), status.dirty());
771
+ else if (check.kind === "max")
772
+ input.data.length > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
773
+ code: ZodIssueCode.too_big,
774
+ maximum: check.value,
775
+ type: "string",
776
+ inclusive: !0,
777
+ exact: !1,
778
+ message: check.message
779
+ }), status.dirty());
780
+ else if (check.kind === "length") {
781
+ let tooBig = input.data.length > check.value, tooSmall = input.data.length < check.value;
782
+ (tooBig || tooSmall) && (ctx = this._getOrReturnCtx(input, ctx), tooBig ? addIssueToContext(ctx, {
783
+ code: ZodIssueCode.too_big,
784
+ maximum: check.value,
785
+ type: "string",
786
+ inclusive: !0,
787
+ exact: !0,
788
+ message: check.message
789
+ }) : tooSmall && addIssueToContext(ctx, {
790
+ code: ZodIssueCode.too_small,
791
+ minimum: check.value,
792
+ type: "string",
793
+ inclusive: !0,
794
+ exact: !0,
795
+ message: check.message
796
+ }), status.dirty());
797
+ } else if (check.kind === "email")
798
+ emailRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
799
+ validation: "email",
800
+ code: ZodIssueCode.invalid_string,
801
+ message: check.message
802
+ }), status.dirty());
803
+ else if (check.kind === "emoji")
804
+ emojiRegex || (emojiRegex = new RegExp(_emojiRegex, "u")), emojiRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
805
+ validation: "emoji",
806
+ code: ZodIssueCode.invalid_string,
807
+ message: check.message
808
+ }), status.dirty());
809
+ else if (check.kind === "uuid")
810
+ uuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
811
+ validation: "uuid",
812
+ code: ZodIssueCode.invalid_string,
813
+ message: check.message
814
+ }), status.dirty());
815
+ else if (check.kind === "nanoid")
816
+ nanoidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
817
+ validation: "nanoid",
818
+ code: ZodIssueCode.invalid_string,
819
+ message: check.message
820
+ }), status.dirty());
821
+ else if (check.kind === "cuid")
822
+ cuidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
823
+ validation: "cuid",
824
+ code: ZodIssueCode.invalid_string,
825
+ message: check.message
826
+ }), status.dirty());
827
+ else if (check.kind === "cuid2")
828
+ cuid2Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
829
+ validation: "cuid2",
830
+ code: ZodIssueCode.invalid_string,
831
+ message: check.message
832
+ }), status.dirty());
833
+ else if (check.kind === "ulid")
834
+ ulidRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
835
+ validation: "ulid",
836
+ code: ZodIssueCode.invalid_string,
837
+ message: check.message
838
+ }), status.dirty());
839
+ else if (check.kind === "url")
840
+ try {
841
+ new URL(input.data);
842
+ } catch {
843
+ ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
844
+ validation: "url",
845
+ code: ZodIssueCode.invalid_string,
846
+ message: check.message
847
+ }), status.dirty();
848
+ }
849
+ else check.kind === "regex" ? (check.regex.lastIndex = 0, check.regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
850
+ validation: "regex",
851
+ code: ZodIssueCode.invalid_string,
852
+ message: check.message
853
+ }), status.dirty())) : check.kind === "trim" ? input.data = input.data.trim() : check.kind === "includes" ? input.data.includes(check.value, check.position) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
854
+ code: ZodIssueCode.invalid_string,
855
+ validation: { includes: check.value, position: check.position },
856
+ message: check.message
857
+ }), status.dirty()) : check.kind === "toLowerCase" ? input.data = input.data.toLowerCase() : check.kind === "toUpperCase" ? input.data = input.data.toUpperCase() : check.kind === "startsWith" ? input.data.startsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
858
+ code: ZodIssueCode.invalid_string,
859
+ validation: { startsWith: check.value },
860
+ message: check.message
861
+ }), status.dirty()) : check.kind === "endsWith" ? input.data.endsWith(check.value) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
862
+ code: ZodIssueCode.invalid_string,
863
+ validation: { endsWith: check.value },
864
+ message: check.message
865
+ }), status.dirty()) : check.kind === "datetime" ? datetimeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
866
+ code: ZodIssueCode.invalid_string,
867
+ validation: "datetime",
868
+ message: check.message
869
+ }), status.dirty()) : check.kind === "date" ? dateRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
870
+ code: ZodIssueCode.invalid_string,
871
+ validation: "date",
872
+ message: check.message
873
+ }), status.dirty()) : check.kind === "time" ? timeRegex(check).test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
874
+ code: ZodIssueCode.invalid_string,
875
+ validation: "time",
876
+ message: check.message
877
+ }), status.dirty()) : check.kind === "duration" ? durationRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
878
+ validation: "duration",
879
+ code: ZodIssueCode.invalid_string,
880
+ message: check.message
881
+ }), status.dirty()) : check.kind === "ip" ? isValidIP(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
882
+ validation: "ip",
883
+ code: ZodIssueCode.invalid_string,
884
+ message: check.message
885
+ }), status.dirty()) : check.kind === "jwt" ? isValidJWT(input.data, check.alg) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
886
+ validation: "jwt",
887
+ code: ZodIssueCode.invalid_string,
888
+ message: check.message
889
+ }), status.dirty()) : check.kind === "cidr" ? isValidCidr(input.data, check.version) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
890
+ validation: "cidr",
891
+ code: ZodIssueCode.invalid_string,
892
+ message: check.message
893
+ }), status.dirty()) : check.kind === "base64" ? base64Regex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
894
+ validation: "base64",
895
+ code: ZodIssueCode.invalid_string,
896
+ message: check.message
897
+ }), status.dirty()) : check.kind === "base64url" ? base64urlRegex.test(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
898
+ validation: "base64url",
899
+ code: ZodIssueCode.invalid_string,
900
+ message: check.message
901
+ }), status.dirty()) : util.assertNever(check);
902
+ return { status: status.value, value: input.data };
903
+ }
904
+ _regex(regex, validation, message) {
905
+ return this.refinement((data) => regex.test(data), {
906
+ validation,
907
+ code: ZodIssueCode.invalid_string,
908
+ ...errorUtil.errToObj(message)
909
+ });
910
+ }
911
+ _addCheck(check) {
912
+ return new _ZodString({
913
+ ...this._def,
914
+ checks: [...this._def.checks, check]
915
+ });
916
+ }
917
+ email(message) {
918
+ return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
919
+ }
920
+ url(message) {
921
+ return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
922
+ }
923
+ emoji(message) {
924
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
925
+ }
926
+ uuid(message) {
927
+ return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
928
+ }
929
+ nanoid(message) {
930
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
931
+ }
932
+ cuid(message) {
933
+ return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
934
+ }
935
+ cuid2(message) {
936
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
937
+ }
938
+ ulid(message) {
939
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
940
+ }
941
+ base64(message) {
942
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
943
+ }
944
+ base64url(message) {
945
+ return this._addCheck({
946
+ kind: "base64url",
947
+ ...errorUtil.errToObj(message)
948
+ });
949
+ }
950
+ jwt(options) {
951
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
952
+ }
953
+ ip(options) {
954
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
955
+ }
956
+ cidr(options) {
957
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
958
+ }
959
+ datetime(options) {
960
+ return typeof options == "string" ? this._addCheck({
961
+ kind: "datetime",
962
+ precision: null,
963
+ offset: !1,
964
+ local: !1,
965
+ message: options
966
+ }) : this._addCheck({
967
+ kind: "datetime",
968
+ precision: typeof options?.precision > "u" ? null : options?.precision,
969
+ offset: options?.offset ?? !1,
970
+ local: options?.local ?? !1,
971
+ ...errorUtil.errToObj(options?.message)
972
+ });
973
+ }
974
+ date(message) {
975
+ return this._addCheck({ kind: "date", message });
976
+ }
977
+ time(options) {
978
+ return typeof options == "string" ? this._addCheck({
979
+ kind: "time",
980
+ precision: null,
981
+ message: options
982
+ }) : this._addCheck({
983
+ kind: "time",
984
+ precision: typeof options?.precision > "u" ? null : options?.precision,
985
+ ...errorUtil.errToObj(options?.message)
986
+ });
987
+ }
988
+ duration(message) {
989
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
990
+ }
991
+ regex(regex, message) {
992
+ return this._addCheck({
993
+ kind: "regex",
994
+ regex,
995
+ ...errorUtil.errToObj(message)
996
+ });
997
+ }
998
+ includes(value, options) {
999
+ return this._addCheck({
1000
+ kind: "includes",
1001
+ value,
1002
+ position: options?.position,
1003
+ ...errorUtil.errToObj(options?.message)
1004
+ });
1005
+ }
1006
+ startsWith(value, message) {
1007
+ return this._addCheck({
1008
+ kind: "startsWith",
1009
+ value,
1010
+ ...errorUtil.errToObj(message)
1011
+ });
1012
+ }
1013
+ endsWith(value, message) {
1014
+ return this._addCheck({
1015
+ kind: "endsWith",
1016
+ value,
1017
+ ...errorUtil.errToObj(message)
1018
+ });
1019
+ }
1020
+ min(minLength, message) {
1021
+ return this._addCheck({
1022
+ kind: "min",
1023
+ value: minLength,
1024
+ ...errorUtil.errToObj(message)
1025
+ });
1026
+ }
1027
+ max(maxLength, message) {
1028
+ return this._addCheck({
1029
+ kind: "max",
1030
+ value: maxLength,
1031
+ ...errorUtil.errToObj(message)
1032
+ });
1033
+ }
1034
+ length(len, message) {
1035
+ return this._addCheck({
1036
+ kind: "length",
1037
+ value: len,
1038
+ ...errorUtil.errToObj(message)
1039
+ });
1040
+ }
1041
+ /**
1042
+ * Equivalent to `.min(1)`
1043
+ */
1044
+ nonempty(message) {
1045
+ return this.min(1, errorUtil.errToObj(message));
1046
+ }
1047
+ trim() {
1048
+ return new _ZodString({
1049
+ ...this._def,
1050
+ checks: [...this._def.checks, { kind: "trim" }]
1051
+ });
1052
+ }
1053
+ toLowerCase() {
1054
+ return new _ZodString({
1055
+ ...this._def,
1056
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1057
+ });
1058
+ }
1059
+ toUpperCase() {
1060
+ return new _ZodString({
1061
+ ...this._def,
1062
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1063
+ });
1064
+ }
1065
+ get isDatetime() {
1066
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
1067
+ }
1068
+ get isDate() {
1069
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1070
+ }
1071
+ get isTime() {
1072
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1073
+ }
1074
+ get isDuration() {
1075
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1076
+ }
1077
+ get isEmail() {
1078
+ return !!this._def.checks.find((ch) => ch.kind === "email");
1079
+ }
1080
+ get isURL() {
1081
+ return !!this._def.checks.find((ch) => ch.kind === "url");
1082
+ }
1083
+ get isEmoji() {
1084
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1085
+ }
1086
+ get isUUID() {
1087
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
1088
+ }
1089
+ get isNANOID() {
1090
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1091
+ }
1092
+ get isCUID() {
1093
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
1094
+ }
1095
+ get isCUID2() {
1096
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1097
+ }
1098
+ get isULID() {
1099
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1100
+ }
1101
+ get isIP() {
1102
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1103
+ }
1104
+ get isCIDR() {
1105
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
1106
+ }
1107
+ get isBase64() {
1108
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1109
+ }
1110
+ get isBase64url() {
1111
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
1112
+ }
1113
+ get minLength() {
1114
+ let min = null;
1115
+ for (let ch of this._def.checks)
1116
+ ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
1117
+ return min;
1118
+ }
1119
+ get maxLength() {
1120
+ let max = null;
1121
+ for (let ch of this._def.checks)
1122
+ ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
1123
+ return max;
1124
+ }
1125
+ };
1126
+ ZodString.create = (params) => new ZodString({
1127
+ checks: [],
1128
+ typeName: ZodFirstPartyTypeKind.ZodString,
1129
+ coerce: params?.coerce ?? !1,
1130
+ ...processCreateParams(params)
1131
+ });
1132
+ function floatSafeRemainder(val, step) {
1133
+ let valDecCount = (val.toString().split(".")[1] || "").length, stepDecCount = (step.toString().split(".")[1] || "").length, decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount, valInt = Number.parseInt(val.toFixed(decCount).replace(".", "")), stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1134
+ return valInt % stepInt / 10 ** decCount;
1135
+ }
1136
+ var ZodNumber = class _ZodNumber extends ZodType {
1137
+ constructor() {
1138
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1139
+ }
1140
+ _parse(input) {
1141
+ if (this._def.coerce && (input.data = Number(input.data)), this._getType(input) !== ZodParsedType.number) {
1142
+ let ctx2 = this._getOrReturnCtx(input);
1143
+ return addIssueToContext(ctx2, {
1144
+ code: ZodIssueCode.invalid_type,
1145
+ expected: ZodParsedType.number,
1146
+ received: ctx2.parsedType
1147
+ }), INVALID;
1148
+ }
1149
+ let ctx, status = new ParseStatus();
1150
+ for (let check of this._def.checks)
1151
+ check.kind === "int" ? util.isInteger(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1152
+ code: ZodIssueCode.invalid_type,
1153
+ expected: "integer",
1154
+ received: "float",
1155
+ message: check.message
1156
+ }), status.dirty()) : check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1157
+ code: ZodIssueCode.too_small,
1158
+ minimum: check.value,
1159
+ type: "number",
1160
+ inclusive: check.inclusive,
1161
+ exact: !1,
1162
+ message: check.message
1163
+ }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1164
+ code: ZodIssueCode.too_big,
1165
+ maximum: check.value,
1166
+ type: "number",
1167
+ inclusive: check.inclusive,
1168
+ exact: !1,
1169
+ message: check.message
1170
+ }), status.dirty()) : check.kind === "multipleOf" ? floatSafeRemainder(input.data, check.value) !== 0 && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1171
+ code: ZodIssueCode.not_multiple_of,
1172
+ multipleOf: check.value,
1173
+ message: check.message
1174
+ }), status.dirty()) : check.kind === "finite" ? Number.isFinite(input.data) || (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1175
+ code: ZodIssueCode.not_finite,
1176
+ message: check.message
1177
+ }), status.dirty()) : util.assertNever(check);
1178
+ return { status: status.value, value: input.data };
1179
+ }
1180
+ gte(value, message) {
1181
+ return this.setLimit("min", value, !0, errorUtil.toString(message));
1182
+ }
1183
+ gt(value, message) {
1184
+ return this.setLimit("min", value, !1, errorUtil.toString(message));
1185
+ }
1186
+ lte(value, message) {
1187
+ return this.setLimit("max", value, !0, errorUtil.toString(message));
1188
+ }
1189
+ lt(value, message) {
1190
+ return this.setLimit("max", value, !1, errorUtil.toString(message));
1191
+ }
1192
+ setLimit(kind, value, inclusive, message) {
1193
+ return new _ZodNumber({
1194
+ ...this._def,
1195
+ checks: [
1196
+ ...this._def.checks,
1197
+ {
1198
+ kind,
1199
+ value,
1200
+ inclusive,
1201
+ message: errorUtil.toString(message)
1202
+ }
1203
+ ]
1204
+ });
1205
+ }
1206
+ _addCheck(check) {
1207
+ return new _ZodNumber({
1208
+ ...this._def,
1209
+ checks: [...this._def.checks, check]
1210
+ });
1211
+ }
1212
+ int(message) {
1213
+ return this._addCheck({
1214
+ kind: "int",
1215
+ message: errorUtil.toString(message)
1216
+ });
1217
+ }
1218
+ positive(message) {
1219
+ return this._addCheck({
1220
+ kind: "min",
1221
+ value: 0,
1222
+ inclusive: !1,
1223
+ message: errorUtil.toString(message)
1224
+ });
1225
+ }
1226
+ negative(message) {
1227
+ return this._addCheck({
1228
+ kind: "max",
1229
+ value: 0,
1230
+ inclusive: !1,
1231
+ message: errorUtil.toString(message)
1232
+ });
1233
+ }
1234
+ nonpositive(message) {
1235
+ return this._addCheck({
1236
+ kind: "max",
1237
+ value: 0,
1238
+ inclusive: !0,
1239
+ message: errorUtil.toString(message)
1240
+ });
1241
+ }
1242
+ nonnegative(message) {
1243
+ return this._addCheck({
1244
+ kind: "min",
1245
+ value: 0,
1246
+ inclusive: !0,
1247
+ message: errorUtil.toString(message)
1248
+ });
1249
+ }
1250
+ multipleOf(value, message) {
1251
+ return this._addCheck({
1252
+ kind: "multipleOf",
1253
+ value,
1254
+ message: errorUtil.toString(message)
1255
+ });
1256
+ }
1257
+ finite(message) {
1258
+ return this._addCheck({
1259
+ kind: "finite",
1260
+ message: errorUtil.toString(message)
1261
+ });
1262
+ }
1263
+ safe(message) {
1264
+ return this._addCheck({
1265
+ kind: "min",
1266
+ inclusive: !0,
1267
+ value: Number.MIN_SAFE_INTEGER,
1268
+ message: errorUtil.toString(message)
1269
+ })._addCheck({
1270
+ kind: "max",
1271
+ inclusive: !0,
1272
+ value: Number.MAX_SAFE_INTEGER,
1273
+ message: errorUtil.toString(message)
1274
+ });
1275
+ }
1276
+ get minValue() {
1277
+ let min = null;
1278
+ for (let ch of this._def.checks)
1279
+ ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
1280
+ return min;
1281
+ }
1282
+ get maxValue() {
1283
+ let max = null;
1284
+ for (let ch of this._def.checks)
1285
+ ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
1286
+ return max;
1287
+ }
1288
+ get isInt() {
1289
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1290
+ }
1291
+ get isFinite() {
1292
+ let max = null, min = null;
1293
+ for (let ch of this._def.checks) {
1294
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf")
1295
+ return !0;
1296
+ ch.kind === "min" ? (min === null || ch.value > min) && (min = ch.value) : ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
1297
+ }
1298
+ return Number.isFinite(min) && Number.isFinite(max);
1299
+ }
1300
+ };
1301
+ ZodNumber.create = (params) => new ZodNumber({
1302
+ checks: [],
1303
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
1304
+ coerce: params?.coerce || !1,
1305
+ ...processCreateParams(params)
1306
+ });
1307
+ var ZodBigInt = class _ZodBigInt extends ZodType {
1308
+ constructor() {
1309
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1310
+ }
1311
+ _parse(input) {
1312
+ if (this._def.coerce)
1313
+ try {
1314
+ input.data = BigInt(input.data);
1315
+ } catch {
1316
+ return this._getInvalidInput(input);
1317
+ }
1318
+ if (this._getType(input) !== ZodParsedType.bigint)
1319
+ return this._getInvalidInput(input);
1320
+ let ctx, status = new ParseStatus();
1321
+ for (let check of this._def.checks)
1322
+ check.kind === "min" ? (check.inclusive ? input.data < check.value : input.data <= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1323
+ code: ZodIssueCode.too_small,
1324
+ type: "bigint",
1325
+ minimum: check.value,
1326
+ inclusive: check.inclusive,
1327
+ message: check.message
1328
+ }), status.dirty()) : check.kind === "max" ? (check.inclusive ? input.data > check.value : input.data >= check.value) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1329
+ code: ZodIssueCode.too_big,
1330
+ type: "bigint",
1331
+ maximum: check.value,
1332
+ inclusive: check.inclusive,
1333
+ message: check.message
1334
+ }), status.dirty()) : check.kind === "multipleOf" ? input.data % check.value !== BigInt(0) && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1335
+ code: ZodIssueCode.not_multiple_of,
1336
+ multipleOf: check.value,
1337
+ message: check.message
1338
+ }), status.dirty()) : util.assertNever(check);
1339
+ return { status: status.value, value: input.data };
1340
+ }
1341
+ _getInvalidInput(input) {
1342
+ let ctx = this._getOrReturnCtx(input);
1343
+ return addIssueToContext(ctx, {
1344
+ code: ZodIssueCode.invalid_type,
1345
+ expected: ZodParsedType.bigint,
1346
+ received: ctx.parsedType
1347
+ }), INVALID;
1348
+ }
1349
+ gte(value, message) {
1350
+ return this.setLimit("min", value, !0, errorUtil.toString(message));
1351
+ }
1352
+ gt(value, message) {
1353
+ return this.setLimit("min", value, !1, errorUtil.toString(message));
1354
+ }
1355
+ lte(value, message) {
1356
+ return this.setLimit("max", value, !0, errorUtil.toString(message));
1357
+ }
1358
+ lt(value, message) {
1359
+ return this.setLimit("max", value, !1, errorUtil.toString(message));
1360
+ }
1361
+ setLimit(kind, value, inclusive, message) {
1362
+ return new _ZodBigInt({
1363
+ ...this._def,
1364
+ checks: [
1365
+ ...this._def.checks,
1366
+ {
1367
+ kind,
1368
+ value,
1369
+ inclusive,
1370
+ message: errorUtil.toString(message)
1371
+ }
1372
+ ]
1373
+ });
1374
+ }
1375
+ _addCheck(check) {
1376
+ return new _ZodBigInt({
1377
+ ...this._def,
1378
+ checks: [...this._def.checks, check]
1379
+ });
1380
+ }
1381
+ positive(message) {
1382
+ return this._addCheck({
1383
+ kind: "min",
1384
+ value: BigInt(0),
1385
+ inclusive: !1,
1386
+ message: errorUtil.toString(message)
1387
+ });
1388
+ }
1389
+ negative(message) {
1390
+ return this._addCheck({
1391
+ kind: "max",
1392
+ value: BigInt(0),
1393
+ inclusive: !1,
1394
+ message: errorUtil.toString(message)
1395
+ });
1396
+ }
1397
+ nonpositive(message) {
1398
+ return this._addCheck({
1399
+ kind: "max",
1400
+ value: BigInt(0),
1401
+ inclusive: !0,
1402
+ message: errorUtil.toString(message)
1403
+ });
1404
+ }
1405
+ nonnegative(message) {
1406
+ return this._addCheck({
1407
+ kind: "min",
1408
+ value: BigInt(0),
1409
+ inclusive: !0,
1410
+ message: errorUtil.toString(message)
1411
+ });
1412
+ }
1413
+ multipleOf(value, message) {
1414
+ return this._addCheck({
1415
+ kind: "multipleOf",
1416
+ value,
1417
+ message: errorUtil.toString(message)
1418
+ });
1419
+ }
1420
+ get minValue() {
1421
+ let min = null;
1422
+ for (let ch of this._def.checks)
1423
+ ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
1424
+ return min;
1425
+ }
1426
+ get maxValue() {
1427
+ let max = null;
1428
+ for (let ch of this._def.checks)
1429
+ ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
1430
+ return max;
1431
+ }
1432
+ };
1433
+ ZodBigInt.create = (params) => new ZodBigInt({
1434
+ checks: [],
1435
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
1436
+ coerce: params?.coerce ?? !1,
1437
+ ...processCreateParams(params)
1438
+ });
1439
+ var ZodBoolean = class extends ZodType {
1440
+ _parse(input) {
1441
+ if (this._def.coerce && (input.data = !!input.data), this._getType(input) !== ZodParsedType.boolean) {
1442
+ let ctx = this._getOrReturnCtx(input);
1443
+ return addIssueToContext(ctx, {
1444
+ code: ZodIssueCode.invalid_type,
1445
+ expected: ZodParsedType.boolean,
1446
+ received: ctx.parsedType
1447
+ }), INVALID;
1448
+ }
1449
+ return OK(input.data);
1450
+ }
1451
+ };
1452
+ ZodBoolean.create = (params) => new ZodBoolean({
1453
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
1454
+ coerce: params?.coerce || !1,
1455
+ ...processCreateParams(params)
1456
+ });
1457
+ var ZodDate = class _ZodDate extends ZodType {
1458
+ _parse(input) {
1459
+ if (this._def.coerce && (input.data = new Date(input.data)), this._getType(input) !== ZodParsedType.date) {
1460
+ let ctx2 = this._getOrReturnCtx(input);
1461
+ return addIssueToContext(ctx2, {
1462
+ code: ZodIssueCode.invalid_type,
1463
+ expected: ZodParsedType.date,
1464
+ received: ctx2.parsedType
1465
+ }), INVALID;
1466
+ }
1467
+ if (Number.isNaN(input.data.getTime())) {
1468
+ let ctx2 = this._getOrReturnCtx(input);
1469
+ return addIssueToContext(ctx2, {
1470
+ code: ZodIssueCode.invalid_date
1471
+ }), INVALID;
1472
+ }
1473
+ let status = new ParseStatus(), ctx;
1474
+ for (let check of this._def.checks)
1475
+ check.kind === "min" ? input.data.getTime() < check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1476
+ code: ZodIssueCode.too_small,
1477
+ message: check.message,
1478
+ inclusive: !0,
1479
+ exact: !1,
1480
+ minimum: check.value,
1481
+ type: "date"
1482
+ }), status.dirty()) : check.kind === "max" ? input.data.getTime() > check.value && (ctx = this._getOrReturnCtx(input, ctx), addIssueToContext(ctx, {
1483
+ code: ZodIssueCode.too_big,
1484
+ message: check.message,
1485
+ inclusive: !0,
1486
+ exact: !1,
1487
+ maximum: check.value,
1488
+ type: "date"
1489
+ }), status.dirty()) : util.assertNever(check);
1490
+ return {
1491
+ status: status.value,
1492
+ value: new Date(input.data.getTime())
1493
+ };
1494
+ }
1495
+ _addCheck(check) {
1496
+ return new _ZodDate({
1497
+ ...this._def,
1498
+ checks: [...this._def.checks, check]
1499
+ });
1500
+ }
1501
+ min(minDate, message) {
1502
+ return this._addCheck({
1503
+ kind: "min",
1504
+ value: minDate.getTime(),
1505
+ message: errorUtil.toString(message)
1506
+ });
1507
+ }
1508
+ max(maxDate, message) {
1509
+ return this._addCheck({
1510
+ kind: "max",
1511
+ value: maxDate.getTime(),
1512
+ message: errorUtil.toString(message)
1513
+ });
1514
+ }
1515
+ get minDate() {
1516
+ let min = null;
1517
+ for (let ch of this._def.checks)
1518
+ ch.kind === "min" && (min === null || ch.value > min) && (min = ch.value);
1519
+ return min != null ? new Date(min) : null;
1520
+ }
1521
+ get maxDate() {
1522
+ let max = null;
1523
+ for (let ch of this._def.checks)
1524
+ ch.kind === "max" && (max === null || ch.value < max) && (max = ch.value);
1525
+ return max != null ? new Date(max) : null;
1526
+ }
1527
+ };
1528
+ ZodDate.create = (params) => new ZodDate({
1529
+ checks: [],
1530
+ coerce: params?.coerce || !1,
1531
+ typeName: ZodFirstPartyTypeKind.ZodDate,
1532
+ ...processCreateParams(params)
1533
+ });
1534
+ var ZodSymbol = class extends ZodType {
1535
+ _parse(input) {
1536
+ if (this._getType(input) !== ZodParsedType.symbol) {
1537
+ let ctx = this._getOrReturnCtx(input);
1538
+ return addIssueToContext(ctx, {
1539
+ code: ZodIssueCode.invalid_type,
1540
+ expected: ZodParsedType.symbol,
1541
+ received: ctx.parsedType
1542
+ }), INVALID;
1543
+ }
1544
+ return OK(input.data);
1545
+ }
1546
+ };
1547
+ ZodSymbol.create = (params) => new ZodSymbol({
1548
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
1549
+ ...processCreateParams(params)
1550
+ });
1551
+ var ZodUndefined = class extends ZodType {
1552
+ _parse(input) {
1553
+ if (this._getType(input) !== ZodParsedType.undefined) {
1554
+ let ctx = this._getOrReturnCtx(input);
1555
+ return addIssueToContext(ctx, {
1556
+ code: ZodIssueCode.invalid_type,
1557
+ expected: ZodParsedType.undefined,
1558
+ received: ctx.parsedType
1559
+ }), INVALID;
1560
+ }
1561
+ return OK(input.data);
1562
+ }
1563
+ };
1564
+ ZodUndefined.create = (params) => new ZodUndefined({
1565
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
1566
+ ...processCreateParams(params)
1567
+ });
1568
+ var ZodNull = class extends ZodType {
1569
+ _parse(input) {
1570
+ if (this._getType(input) !== ZodParsedType.null) {
1571
+ let ctx = this._getOrReturnCtx(input);
1572
+ return addIssueToContext(ctx, {
1573
+ code: ZodIssueCode.invalid_type,
1574
+ expected: ZodParsedType.null,
1575
+ received: ctx.parsedType
1576
+ }), INVALID;
1577
+ }
1578
+ return OK(input.data);
1579
+ }
1580
+ };
1581
+ ZodNull.create = (params) => new ZodNull({
1582
+ typeName: ZodFirstPartyTypeKind.ZodNull,
1583
+ ...processCreateParams(params)
1584
+ });
1585
+ var ZodAny = class extends ZodType {
1586
+ constructor() {
1587
+ super(...arguments), this._any = !0;
1588
+ }
1589
+ _parse(input) {
1590
+ return OK(input.data);
1591
+ }
1592
+ };
1593
+ ZodAny.create = (params) => new ZodAny({
1594
+ typeName: ZodFirstPartyTypeKind.ZodAny,
1595
+ ...processCreateParams(params)
1596
+ });
1597
+ var ZodUnknown = class extends ZodType {
1598
+ constructor() {
1599
+ super(...arguments), this._unknown = !0;
1600
+ }
1601
+ _parse(input) {
1602
+ return OK(input.data);
1603
+ }
1604
+ };
1605
+ ZodUnknown.create = (params) => new ZodUnknown({
1606
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
1607
+ ...processCreateParams(params)
1608
+ });
1609
+ var ZodNever = class extends ZodType {
1610
+ _parse(input) {
1611
+ let ctx = this._getOrReturnCtx(input);
1612
+ return addIssueToContext(ctx, {
1613
+ code: ZodIssueCode.invalid_type,
1614
+ expected: ZodParsedType.never,
1615
+ received: ctx.parsedType
1616
+ }), INVALID;
1617
+ }
1618
+ };
1619
+ ZodNever.create = (params) => new ZodNever({
1620
+ typeName: ZodFirstPartyTypeKind.ZodNever,
1621
+ ...processCreateParams(params)
1622
+ });
1623
+ var ZodVoid = class extends ZodType {
1624
+ _parse(input) {
1625
+ if (this._getType(input) !== ZodParsedType.undefined) {
1626
+ let ctx = this._getOrReturnCtx(input);
1627
+ return addIssueToContext(ctx, {
1628
+ code: ZodIssueCode.invalid_type,
1629
+ expected: ZodParsedType.void,
1630
+ received: ctx.parsedType
1631
+ }), INVALID;
1632
+ }
1633
+ return OK(input.data);
1634
+ }
1635
+ };
1636
+ ZodVoid.create = (params) => new ZodVoid({
1637
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
1638
+ ...processCreateParams(params)
1639
+ });
1640
+ var ZodArray = class _ZodArray extends ZodType {
1641
+ _parse(input) {
1642
+ let { ctx, status } = this._processInputParams(input), def = this._def;
1643
+ if (ctx.parsedType !== ZodParsedType.array)
1644
+ return addIssueToContext(ctx, {
1645
+ code: ZodIssueCode.invalid_type,
1646
+ expected: ZodParsedType.array,
1647
+ received: ctx.parsedType
1648
+ }), INVALID;
1649
+ if (def.exactLength !== null) {
1650
+ let tooBig = ctx.data.length > def.exactLength.value, tooSmall = ctx.data.length < def.exactLength.value;
1651
+ (tooBig || tooSmall) && (addIssueToContext(ctx, {
1652
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
1653
+ minimum: tooSmall ? def.exactLength.value : void 0,
1654
+ maximum: tooBig ? def.exactLength.value : void 0,
1655
+ type: "array",
1656
+ inclusive: !0,
1657
+ exact: !0,
1658
+ message: def.exactLength.message
1659
+ }), status.dirty());
1660
+ }
1661
+ if (def.minLength !== null && ctx.data.length < def.minLength.value && (addIssueToContext(ctx, {
1662
+ code: ZodIssueCode.too_small,
1663
+ minimum: def.minLength.value,
1664
+ type: "array",
1665
+ inclusive: !0,
1666
+ exact: !1,
1667
+ message: def.minLength.message
1668
+ }), status.dirty()), def.maxLength !== null && ctx.data.length > def.maxLength.value && (addIssueToContext(ctx, {
1669
+ code: ZodIssueCode.too_big,
1670
+ maximum: def.maxLength.value,
1671
+ type: "array",
1672
+ inclusive: !0,
1673
+ exact: !1,
1674
+ message: def.maxLength.message
1675
+ }), status.dirty()), ctx.common.async)
1676
+ return Promise.all([...ctx.data].map((item, i) => def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i)))).then((result2) => ParseStatus.mergeArray(status, result2));
1677
+ let result = [...ctx.data].map((item, i) => def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i)));
1678
+ return ParseStatus.mergeArray(status, result);
1679
+ }
1680
+ get element() {
1681
+ return this._def.type;
1682
+ }
1683
+ min(minLength, message) {
1684
+ return new _ZodArray({
1685
+ ...this._def,
1686
+ minLength: { value: minLength, message: errorUtil.toString(message) }
1687
+ });
1688
+ }
1689
+ max(maxLength, message) {
1690
+ return new _ZodArray({
1691
+ ...this._def,
1692
+ maxLength: { value: maxLength, message: errorUtil.toString(message) }
1693
+ });
1694
+ }
1695
+ length(len, message) {
1696
+ return new _ZodArray({
1697
+ ...this._def,
1698
+ exactLength: { value: len, message: errorUtil.toString(message) }
1699
+ });
1700
+ }
1701
+ nonempty(message) {
1702
+ return this.min(1, message);
1703
+ }
1704
+ };
1705
+ ZodArray.create = (schema, params) => new ZodArray({
1706
+ type: schema,
1707
+ minLength: null,
1708
+ maxLength: null,
1709
+ exactLength: null,
1710
+ typeName: ZodFirstPartyTypeKind.ZodArray,
1711
+ ...processCreateParams(params)
1712
+ });
1713
+ function deepPartialify(schema) {
1714
+ if (schema instanceof ZodObject) {
1715
+ let newShape = {};
1716
+ for (let key in schema.shape) {
1717
+ let fieldSchema = schema.shape[key];
1718
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
1719
+ }
1720
+ return new ZodObject({
1721
+ ...schema._def,
1722
+ shape: () => newShape
1723
+ });
1724
+ } else return schema instanceof ZodArray ? new ZodArray({
1725
+ ...schema._def,
1726
+ type: deepPartialify(schema.element)
1727
+ }) : schema instanceof ZodOptional ? ZodOptional.create(deepPartialify(schema.unwrap())) : schema instanceof ZodNullable ? ZodNullable.create(deepPartialify(schema.unwrap())) : schema instanceof ZodTuple ? ZodTuple.create(schema.items.map((item) => deepPartialify(item))) : schema;
1728
+ }
1729
+ var ZodObject = class _ZodObject extends ZodType {
1730
+ constructor() {
1731
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1732
+ }
1733
+ _getCached() {
1734
+ if (this._cached !== null)
1735
+ return this._cached;
1736
+ let shape = this._def.shape(), keys = util.objectKeys(shape);
1737
+ return this._cached = { shape, keys }, this._cached;
1738
+ }
1739
+ _parse(input) {
1740
+ if (this._getType(input) !== ZodParsedType.object) {
1741
+ let ctx2 = this._getOrReturnCtx(input);
1742
+ return addIssueToContext(ctx2, {
1743
+ code: ZodIssueCode.invalid_type,
1744
+ expected: ZodParsedType.object,
1745
+ received: ctx2.parsedType
1746
+ }), INVALID;
1747
+ }
1748
+ let { status, ctx } = this._processInputParams(input), { shape, keys: shapeKeys } = this._getCached(), extraKeys = [];
1749
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip"))
1750
+ for (let key in ctx.data)
1751
+ shapeKeys.includes(key) || extraKeys.push(key);
1752
+ let pairs = [];
1753
+ for (let key of shapeKeys) {
1754
+ let keyValidator = shape[key], value = ctx.data[key];
1755
+ pairs.push({
1756
+ key: { status: "valid", value: key },
1757
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
1758
+ alwaysSet: key in ctx.data
1759
+ });
1760
+ }
1761
+ if (this._def.catchall instanceof ZodNever) {
1762
+ let unknownKeys = this._def.unknownKeys;
1763
+ if (unknownKeys === "passthrough")
1764
+ for (let key of extraKeys)
1765
+ pairs.push({
1766
+ key: { status: "valid", value: key },
1767
+ value: { status: "valid", value: ctx.data[key] }
1768
+ });
1769
+ else if (unknownKeys === "strict")
1770
+ extraKeys.length > 0 && (addIssueToContext(ctx, {
1771
+ code: ZodIssueCode.unrecognized_keys,
1772
+ keys: extraKeys
1773
+ }), status.dirty());
1774
+ else if (unknownKeys !== "strip")
1775
+ throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1776
+ } else {
1777
+ let catchall = this._def.catchall;
1778
+ for (let key of extraKeys) {
1779
+ let value = ctx.data[key];
1780
+ pairs.push({
1781
+ key: { status: "valid", value: key },
1782
+ value: catchall._parse(
1783
+ new ParseInputLazyPath(ctx, value, ctx.path, key)
1784
+ //, ctx.child(key), value, getParsedType(value)
1785
+ ),
1786
+ alwaysSet: key in ctx.data
1787
+ });
1788
+ }
1789
+ }
1790
+ return ctx.common.async ? Promise.resolve().then(async () => {
1791
+ let syncPairs = [];
1792
+ for (let pair of pairs) {
1793
+ let key = await pair.key, value = await pair.value;
1794
+ syncPairs.push({
1795
+ key,
1796
+ value,
1797
+ alwaysSet: pair.alwaysSet
1798
+ });
1799
+ }
1800
+ return syncPairs;
1801
+ }).then((syncPairs) => ParseStatus.mergeObjectSync(status, syncPairs)) : ParseStatus.mergeObjectSync(status, pairs);
1802
+ }
1803
+ get shape() {
1804
+ return this._def.shape();
1805
+ }
1806
+ strict(message) {
1807
+ return errorUtil.errToObj, new _ZodObject({
1808
+ ...this._def,
1809
+ unknownKeys: "strict",
1810
+ ...message !== void 0 ? {
1811
+ errorMap: (issue, ctx) => {
1812
+ let defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
1813
+ return issue.code === "unrecognized_keys" ? {
1814
+ message: errorUtil.errToObj(message).message ?? defaultError
1815
+ } : {
1816
+ message: defaultError
1817
+ };
1818
+ }
1819
+ } : {}
1820
+ });
1821
+ }
1822
+ strip() {
1823
+ return new _ZodObject({
1824
+ ...this._def,
1825
+ unknownKeys: "strip"
1826
+ });
1827
+ }
1828
+ passthrough() {
1829
+ return new _ZodObject({
1830
+ ...this._def,
1831
+ unknownKeys: "passthrough"
1832
+ });
1833
+ }
1834
+ // const AugmentFactory =
1835
+ // <Def extends ZodObjectDef>(def: Def) =>
1836
+ // <Augmentation extends ZodRawShape>(
1837
+ // augmentation: Augmentation
1838
+ // ): ZodObject<
1839
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1840
+ // Def["unknownKeys"],
1841
+ // Def["catchall"]
1842
+ // > => {
1843
+ // return new ZodObject({
1844
+ // ...def,
1845
+ // shape: () => ({
1846
+ // ...def.shape(),
1847
+ // ...augmentation,
1848
+ // }),
1849
+ // }) as any;
1850
+ // };
1851
+ extend(augmentation) {
1852
+ return new _ZodObject({
1853
+ ...this._def,
1854
+ shape: () => ({
1855
+ ...this._def.shape(),
1856
+ ...augmentation
1857
+ })
1858
+ });
1859
+ }
1860
+ /**
1861
+ * Prior to zod@1.0.12 there was a bug in the
1862
+ * inferred type of merged objects. Please
1863
+ * upgrade if you are experiencing issues.
1864
+ */
1865
+ merge(merging) {
1866
+ return new _ZodObject({
1867
+ unknownKeys: merging._def.unknownKeys,
1868
+ catchall: merging._def.catchall,
1869
+ shape: () => ({
1870
+ ...this._def.shape(),
1871
+ ...merging._def.shape()
1872
+ }),
1873
+ typeName: ZodFirstPartyTypeKind.ZodObject
1874
+ });
1875
+ }
1876
+ // merge<
1877
+ // Incoming extends AnyZodObject,
1878
+ // Augmentation extends Incoming["shape"],
1879
+ // NewOutput extends {
1880
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1881
+ // ? Augmentation[k]["_output"]
1882
+ // : k extends keyof Output
1883
+ // ? Output[k]
1884
+ // : never;
1885
+ // },
1886
+ // NewInput extends {
1887
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1888
+ // ? Augmentation[k]["_input"]
1889
+ // : k extends keyof Input
1890
+ // ? Input[k]
1891
+ // : never;
1892
+ // }
1893
+ // >(
1894
+ // merging: Incoming
1895
+ // ): ZodObject<
1896
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1897
+ // Incoming["_def"]["unknownKeys"],
1898
+ // Incoming["_def"]["catchall"],
1899
+ // NewOutput,
1900
+ // NewInput
1901
+ // > {
1902
+ // const merged: any = new ZodObject({
1903
+ // unknownKeys: merging._def.unknownKeys,
1904
+ // catchall: merging._def.catchall,
1905
+ // shape: () =>
1906
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1907
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1908
+ // }) as any;
1909
+ // return merged;
1910
+ // }
1911
+ setKey(key, schema) {
1912
+ return this.augment({ [key]: schema });
1913
+ }
1914
+ // merge<Incoming extends AnyZodObject>(
1915
+ // merging: Incoming
1916
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1917
+ // ZodObject<
1918
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1919
+ // Incoming["_def"]["unknownKeys"],
1920
+ // Incoming["_def"]["catchall"]
1921
+ // > {
1922
+ // // const mergedShape = objectUtil.mergeShapes(
1923
+ // // this._def.shape(),
1924
+ // // merging._def.shape()
1925
+ // // );
1926
+ // const merged: any = new ZodObject({
1927
+ // unknownKeys: merging._def.unknownKeys,
1928
+ // catchall: merging._def.catchall,
1929
+ // shape: () =>
1930
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1931
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1932
+ // }) as any;
1933
+ // return merged;
1934
+ // }
1935
+ catchall(index) {
1936
+ return new _ZodObject({
1937
+ ...this._def,
1938
+ catchall: index
1939
+ });
1940
+ }
1941
+ pick(mask) {
1942
+ let shape = {};
1943
+ for (let key of util.objectKeys(mask))
1944
+ mask[key] && this.shape[key] && (shape[key] = this.shape[key]);
1945
+ return new _ZodObject({
1946
+ ...this._def,
1947
+ shape: () => shape
1948
+ });
1949
+ }
1950
+ omit(mask) {
1951
+ let shape = {};
1952
+ for (let key of util.objectKeys(this.shape))
1953
+ mask[key] || (shape[key] = this.shape[key]);
1954
+ return new _ZodObject({
1955
+ ...this._def,
1956
+ shape: () => shape
1957
+ });
1958
+ }
1959
+ /**
1960
+ * @deprecated
1961
+ */
1962
+ deepPartial() {
1963
+ return deepPartialify(this);
1964
+ }
1965
+ partial(mask) {
1966
+ let newShape = {};
1967
+ for (let key of util.objectKeys(this.shape)) {
1968
+ let fieldSchema = this.shape[key];
1969
+ mask && !mask[key] ? newShape[key] = fieldSchema : newShape[key] = fieldSchema.optional();
1970
+ }
1971
+ return new _ZodObject({
1972
+ ...this._def,
1973
+ shape: () => newShape
1974
+ });
1975
+ }
1976
+ required(mask) {
1977
+ let newShape = {};
1978
+ for (let key of util.objectKeys(this.shape))
1979
+ if (mask && !mask[key])
1980
+ newShape[key] = this.shape[key];
1981
+ else {
1982
+ let newField = this.shape[key];
1983
+ for (; newField instanceof ZodOptional; )
1984
+ newField = newField._def.innerType;
1985
+ newShape[key] = newField;
1986
+ }
1987
+ return new _ZodObject({
1988
+ ...this._def,
1989
+ shape: () => newShape
1990
+ });
1991
+ }
1992
+ keyof() {
1993
+ return createZodEnum(util.objectKeys(this.shape));
1994
+ }
1995
+ };
1996
+ ZodObject.create = (shape, params) => new ZodObject({
1997
+ shape: () => shape,
1998
+ unknownKeys: "strip",
1999
+ catchall: ZodNever.create(),
2000
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2001
+ ...processCreateParams(params)
2002
+ });
2003
+ ZodObject.strictCreate = (shape, params) => new ZodObject({
2004
+ shape: () => shape,
2005
+ unknownKeys: "strict",
2006
+ catchall: ZodNever.create(),
2007
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2008
+ ...processCreateParams(params)
2009
+ });
2010
+ ZodObject.lazycreate = (shape, params) => new ZodObject({
2011
+ shape,
2012
+ unknownKeys: "strip",
2013
+ catchall: ZodNever.create(),
2014
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2015
+ ...processCreateParams(params)
2016
+ });
2017
+ var ZodUnion = class extends ZodType {
2018
+ _parse(input) {
2019
+ let { ctx } = this._processInputParams(input), options = this._def.options;
2020
+ function handleResults(results) {
2021
+ for (let result of results)
2022
+ if (result.result.status === "valid")
2023
+ return result.result;
2024
+ for (let result of results)
2025
+ if (result.result.status === "dirty")
2026
+ return ctx.common.issues.push(...result.ctx.common.issues), result.result;
2027
+ let unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2028
+ return addIssueToContext(ctx, {
2029
+ code: ZodIssueCode.invalid_union,
2030
+ unionErrors
2031
+ }), INVALID;
2032
+ }
2033
+ if (ctx.common.async)
2034
+ return Promise.all(options.map(async (option) => {
2035
+ let childCtx = {
2036
+ ...ctx,
2037
+ common: {
2038
+ ...ctx.common,
2039
+ issues: []
2040
+ },
2041
+ parent: null
2042
+ };
2043
+ return {
2044
+ result: await option._parseAsync({
2045
+ data: ctx.data,
2046
+ path: ctx.path,
2047
+ parent: childCtx
2048
+ }),
2049
+ ctx: childCtx
2050
+ };
2051
+ })).then(handleResults);
2052
+ {
2053
+ let dirty, issues = [];
2054
+ for (let option of options) {
2055
+ let childCtx = {
2056
+ ...ctx,
2057
+ common: {
2058
+ ...ctx.common,
2059
+ issues: []
2060
+ },
2061
+ parent: null
2062
+ }, result = option._parseSync({
2063
+ data: ctx.data,
2064
+ path: ctx.path,
2065
+ parent: childCtx
2066
+ });
2067
+ if (result.status === "valid")
2068
+ return result;
2069
+ result.status === "dirty" && !dirty && (dirty = { result, ctx: childCtx }), childCtx.common.issues.length && issues.push(childCtx.common.issues);
2070
+ }
2071
+ if (dirty)
2072
+ return ctx.common.issues.push(...dirty.ctx.common.issues), dirty.result;
2073
+ let unionErrors = issues.map((issues2) => new ZodError(issues2));
2074
+ return addIssueToContext(ctx, {
2075
+ code: ZodIssueCode.invalid_union,
2076
+ unionErrors
2077
+ }), INVALID;
2078
+ }
2079
+ }
2080
+ get options() {
2081
+ return this._def.options;
2082
+ }
2083
+ };
2084
+ ZodUnion.create = (types, params) => new ZodUnion({
2085
+ options: types,
2086
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
2087
+ ...processCreateParams(params)
2088
+ });
2089
+ var getDiscriminator = (type) => type instanceof ZodLazy ? getDiscriminator(type.schema) : type instanceof ZodEffects ? getDiscriminator(type.innerType()) : type instanceof ZodLiteral ? [type.value] : type instanceof ZodEnum ? type.options : type instanceof ZodNativeEnum ? util.objectValues(type.enum) : type instanceof ZodDefault ? getDiscriminator(type._def.innerType) : type instanceof ZodUndefined ? [void 0] : type instanceof ZodNull ? [null] : type instanceof ZodOptional ? [void 0, ...getDiscriminator(type.unwrap())] : type instanceof ZodNullable ? [null, ...getDiscriminator(type.unwrap())] : type instanceof ZodBranded || type instanceof ZodReadonly ? getDiscriminator(type.unwrap()) : type instanceof ZodCatch ? getDiscriminator(type._def.innerType) : [], ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
2090
+ _parse(input) {
2091
+ let { ctx } = this._processInputParams(input);
2092
+ if (ctx.parsedType !== ZodParsedType.object)
2093
+ return addIssueToContext(ctx, {
2094
+ code: ZodIssueCode.invalid_type,
2095
+ expected: ZodParsedType.object,
2096
+ received: ctx.parsedType
2097
+ }), INVALID;
2098
+ let discriminator = this.discriminator, discriminatorValue = ctx.data[discriminator], option = this.optionsMap.get(discriminatorValue);
2099
+ return option ? ctx.common.async ? option._parseAsync({
2100
+ data: ctx.data,
2101
+ path: ctx.path,
2102
+ parent: ctx
2103
+ }) : option._parseSync({
2104
+ data: ctx.data,
2105
+ path: ctx.path,
2106
+ parent: ctx
2107
+ }) : (addIssueToContext(ctx, {
2108
+ code: ZodIssueCode.invalid_union_discriminator,
2109
+ options: Array.from(this.optionsMap.keys()),
2110
+ path: [discriminator]
2111
+ }), INVALID);
2112
+ }
2113
+ get discriminator() {
2114
+ return this._def.discriminator;
2115
+ }
2116
+ get options() {
2117
+ return this._def.options;
2118
+ }
2119
+ get optionsMap() {
2120
+ return this._def.optionsMap;
2121
+ }
2122
+ /**
2123
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2124
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2125
+ * have a different value for each object in the union.
2126
+ * @param discriminator the name of the discriminator property
2127
+ * @param types an array of object schemas
2128
+ * @param params
2129
+ */
2130
+ static create(discriminator, options, params) {
2131
+ let optionsMap = /* @__PURE__ */ new Map();
2132
+ for (let type of options) {
2133
+ let discriminatorValues = getDiscriminator(type.shape[discriminator]);
2134
+ if (!discriminatorValues.length)
2135
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2136
+ for (let value of discriminatorValues) {
2137
+ if (optionsMap.has(value))
2138
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2139
+ optionsMap.set(value, type);
2140
+ }
2141
+ }
2142
+ return new _ZodDiscriminatedUnion({
2143
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2144
+ discriminator,
2145
+ options,
2146
+ optionsMap,
2147
+ ...processCreateParams(params)
2148
+ });
2149
+ }
2150
+ };
2151
+ function mergeValues(a, b) {
2152
+ let aType = getParsedType(a), bType = getParsedType(b);
2153
+ if (a === b)
2154
+ return { valid: !0, data: a };
2155
+ if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2156
+ let bKeys = util.objectKeys(b), sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1), newObj = { ...a, ...b };
2157
+ for (let key of sharedKeys) {
2158
+ let sharedValue = mergeValues(a[key], b[key]);
2159
+ if (!sharedValue.valid)
2160
+ return { valid: !1 };
2161
+ newObj[key] = sharedValue.data;
2162
+ }
2163
+ return { valid: !0, data: newObj };
2164
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2165
+ if (a.length !== b.length)
2166
+ return { valid: !1 };
2167
+ let newArray = [];
2168
+ for (let index = 0; index < a.length; index++) {
2169
+ let itemA = a[index], itemB = b[index], sharedValue = mergeValues(itemA, itemB);
2170
+ if (!sharedValue.valid)
2171
+ return { valid: !1 };
2172
+ newArray.push(sharedValue.data);
2173
+ }
2174
+ return { valid: !0, data: newArray };
2175
+ } else return aType === ZodParsedType.date && bType === ZodParsedType.date && +a == +b ? { valid: !0, data: a } : { valid: !1 };
2176
+ }
2177
+ var ZodIntersection = class extends ZodType {
2178
+ _parse(input) {
2179
+ let { status, ctx } = this._processInputParams(input), handleParsed = (parsedLeft, parsedRight) => {
2180
+ if (isAborted(parsedLeft) || isAborted(parsedRight))
2181
+ return INVALID;
2182
+ let merged = mergeValues(parsedLeft.value, parsedRight.value);
2183
+ return merged.valid ? ((isDirty(parsedLeft) || isDirty(parsedRight)) && status.dirty(), { status: status.value, value: merged.data }) : (addIssueToContext(ctx, {
2184
+ code: ZodIssueCode.invalid_intersection_types
2185
+ }), INVALID);
2186
+ };
2187
+ return ctx.common.async ? Promise.all([
2188
+ this._def.left._parseAsync({
2189
+ data: ctx.data,
2190
+ path: ctx.path,
2191
+ parent: ctx
2192
+ }),
2193
+ this._def.right._parseAsync({
2194
+ data: ctx.data,
2195
+ path: ctx.path,
2196
+ parent: ctx
2197
+ })
2198
+ ]).then(([left, right]) => handleParsed(left, right)) : handleParsed(this._def.left._parseSync({
2199
+ data: ctx.data,
2200
+ path: ctx.path,
2201
+ parent: ctx
2202
+ }), this._def.right._parseSync({
2203
+ data: ctx.data,
2204
+ path: ctx.path,
2205
+ parent: ctx
2206
+ }));
2207
+ }
2208
+ };
2209
+ ZodIntersection.create = (left, right, params) => new ZodIntersection({
2210
+ left,
2211
+ right,
2212
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
2213
+ ...processCreateParams(params)
2214
+ });
2215
+ var ZodTuple = class _ZodTuple extends ZodType {
2216
+ _parse(input) {
2217
+ let { status, ctx } = this._processInputParams(input);
2218
+ if (ctx.parsedType !== ZodParsedType.array)
2219
+ return addIssueToContext(ctx, {
2220
+ code: ZodIssueCode.invalid_type,
2221
+ expected: ZodParsedType.array,
2222
+ received: ctx.parsedType
2223
+ }), INVALID;
2224
+ if (ctx.data.length < this._def.items.length)
2225
+ return addIssueToContext(ctx, {
2226
+ code: ZodIssueCode.too_small,
2227
+ minimum: this._def.items.length,
2228
+ inclusive: !0,
2229
+ exact: !1,
2230
+ type: "array"
2231
+ }), INVALID;
2232
+ !this._def.rest && ctx.data.length > this._def.items.length && (addIssueToContext(ctx, {
2233
+ code: ZodIssueCode.too_big,
2234
+ maximum: this._def.items.length,
2235
+ inclusive: !0,
2236
+ exact: !1,
2237
+ type: "array"
2238
+ }), status.dirty());
2239
+ let items = [...ctx.data].map((item, itemIndex) => {
2240
+ let schema = this._def.items[itemIndex] || this._def.rest;
2241
+ return schema ? schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex)) : null;
2242
+ }).filter((x) => !!x);
2243
+ return ctx.common.async ? Promise.all(items).then((results) => ParseStatus.mergeArray(status, results)) : ParseStatus.mergeArray(status, items);
2244
+ }
2245
+ get items() {
2246
+ return this._def.items;
2247
+ }
2248
+ rest(rest) {
2249
+ return new _ZodTuple({
2250
+ ...this._def,
2251
+ rest
2252
+ });
2253
+ }
2254
+ };
2255
+ ZodTuple.create = (schemas, params) => {
2256
+ if (!Array.isArray(schemas))
2257
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2258
+ return new ZodTuple({
2259
+ items: schemas,
2260
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
2261
+ rest: null,
2262
+ ...processCreateParams(params)
2263
+ });
2264
+ };
2265
+ var ZodRecord = class _ZodRecord extends ZodType {
2266
+ get keySchema() {
2267
+ return this._def.keyType;
2268
+ }
2269
+ get valueSchema() {
2270
+ return this._def.valueType;
2271
+ }
2272
+ _parse(input) {
2273
+ let { status, ctx } = this._processInputParams(input);
2274
+ if (ctx.parsedType !== ZodParsedType.object)
2275
+ return addIssueToContext(ctx, {
2276
+ code: ZodIssueCode.invalid_type,
2277
+ expected: ZodParsedType.object,
2278
+ received: ctx.parsedType
2279
+ }), INVALID;
2280
+ let pairs = [], keyType = this._def.keyType, valueType = this._def.valueType;
2281
+ for (let key in ctx.data)
2282
+ pairs.push({
2283
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2284
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2285
+ alwaysSet: key in ctx.data
2286
+ });
2287
+ return ctx.common.async ? ParseStatus.mergeObjectAsync(status, pairs) : ParseStatus.mergeObjectSync(status, pairs);
2288
+ }
2289
+ get element() {
2290
+ return this._def.valueType;
2291
+ }
2292
+ static create(first, second, third) {
2293
+ return second instanceof ZodType ? new _ZodRecord({
2294
+ keyType: first,
2295
+ valueType: second,
2296
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2297
+ ...processCreateParams(third)
2298
+ }) : new _ZodRecord({
2299
+ keyType: ZodString.create(),
2300
+ valueType: first,
2301
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2302
+ ...processCreateParams(second)
2303
+ });
2304
+ }
2305
+ }, ZodMap = class extends ZodType {
2306
+ get keySchema() {
2307
+ return this._def.keyType;
2308
+ }
2309
+ get valueSchema() {
2310
+ return this._def.valueType;
2311
+ }
2312
+ _parse(input) {
2313
+ let { status, ctx } = this._processInputParams(input);
2314
+ if (ctx.parsedType !== ZodParsedType.map)
2315
+ return addIssueToContext(ctx, {
2316
+ code: ZodIssueCode.invalid_type,
2317
+ expected: ZodParsedType.map,
2318
+ received: ctx.parsedType
2319
+ }), INVALID;
2320
+ let keyType = this._def.keyType, valueType = this._def.valueType, pairs = [...ctx.data.entries()].map(([key, value], index) => ({
2321
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2322
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
2323
+ }));
2324
+ if (ctx.common.async) {
2325
+ let finalMap = /* @__PURE__ */ new Map();
2326
+ return Promise.resolve().then(async () => {
2327
+ for (let pair of pairs) {
2328
+ let key = await pair.key, value = await pair.value;
2329
+ if (key.status === "aborted" || value.status === "aborted")
2330
+ return INVALID;
2331
+ (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
2332
+ }
2333
+ return { status: status.value, value: finalMap };
2334
+ });
2335
+ } else {
2336
+ let finalMap = /* @__PURE__ */ new Map();
2337
+ for (let pair of pairs) {
2338
+ let key = pair.key, value = pair.value;
2339
+ if (key.status === "aborted" || value.status === "aborted")
2340
+ return INVALID;
2341
+ (key.status === "dirty" || value.status === "dirty") && status.dirty(), finalMap.set(key.value, value.value);
2342
+ }
2343
+ return { status: status.value, value: finalMap };
2344
+ }
2345
+ }
2346
+ };
2347
+ ZodMap.create = (keyType, valueType, params) => new ZodMap({
2348
+ valueType,
2349
+ keyType,
2350
+ typeName: ZodFirstPartyTypeKind.ZodMap,
2351
+ ...processCreateParams(params)
2352
+ });
2353
+ var ZodSet = class _ZodSet extends ZodType {
2354
+ _parse(input) {
2355
+ let { status, ctx } = this._processInputParams(input);
2356
+ if (ctx.parsedType !== ZodParsedType.set)
2357
+ return addIssueToContext(ctx, {
2358
+ code: ZodIssueCode.invalid_type,
2359
+ expected: ZodParsedType.set,
2360
+ received: ctx.parsedType
2361
+ }), INVALID;
2362
+ let def = this._def;
2363
+ def.minSize !== null && ctx.data.size < def.minSize.value && (addIssueToContext(ctx, {
2364
+ code: ZodIssueCode.too_small,
2365
+ minimum: def.minSize.value,
2366
+ type: "set",
2367
+ inclusive: !0,
2368
+ exact: !1,
2369
+ message: def.minSize.message
2370
+ }), status.dirty()), def.maxSize !== null && ctx.data.size > def.maxSize.value && (addIssueToContext(ctx, {
2371
+ code: ZodIssueCode.too_big,
2372
+ maximum: def.maxSize.value,
2373
+ type: "set",
2374
+ inclusive: !0,
2375
+ exact: !1,
2376
+ message: def.maxSize.message
2377
+ }), status.dirty());
2378
+ let valueType = this._def.valueType;
2379
+ function finalizeSet(elements2) {
2380
+ let parsedSet = /* @__PURE__ */ new Set();
2381
+ for (let element of elements2) {
2382
+ if (element.status === "aborted")
2383
+ return INVALID;
2384
+ element.status === "dirty" && status.dirty(), parsedSet.add(element.value);
2385
+ }
2386
+ return { status: status.value, value: parsedSet };
2387
+ }
2388
+ let elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2389
+ return ctx.common.async ? Promise.all(elements).then((elements2) => finalizeSet(elements2)) : finalizeSet(elements);
2390
+ }
2391
+ min(minSize, message) {
2392
+ return new _ZodSet({
2393
+ ...this._def,
2394
+ minSize: { value: minSize, message: errorUtil.toString(message) }
2395
+ });
2396
+ }
2397
+ max(maxSize, message) {
2398
+ return new _ZodSet({
2399
+ ...this._def,
2400
+ maxSize: { value: maxSize, message: errorUtil.toString(message) }
2401
+ });
2402
+ }
2403
+ size(size, message) {
2404
+ return this.min(size, message).max(size, message);
2405
+ }
2406
+ nonempty(message) {
2407
+ return this.min(1, message);
2408
+ }
2409
+ };
2410
+ ZodSet.create = (valueType, params) => new ZodSet({
2411
+ valueType,
2412
+ minSize: null,
2413
+ maxSize: null,
2414
+ typeName: ZodFirstPartyTypeKind.ZodSet,
2415
+ ...processCreateParams(params)
2416
+ });
2417
+ var ZodFunction = class _ZodFunction extends ZodType {
2418
+ constructor() {
2419
+ super(...arguments), this.validate = this.implement;
2420
+ }
2421
+ _parse(input) {
2422
+ let { ctx } = this._processInputParams(input);
2423
+ if (ctx.parsedType !== ZodParsedType.function)
2424
+ return addIssueToContext(ctx, {
2425
+ code: ZodIssueCode.invalid_type,
2426
+ expected: ZodParsedType.function,
2427
+ received: ctx.parsedType
2428
+ }), INVALID;
2429
+ function makeArgsIssue(args, error) {
2430
+ return makeIssue({
2431
+ data: args,
2432
+ path: ctx.path,
2433
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
2434
+ issueData: {
2435
+ code: ZodIssueCode.invalid_arguments,
2436
+ argumentsError: error
2437
+ }
2438
+ });
2439
+ }
2440
+ function makeReturnsIssue(returns, error) {
2441
+ return makeIssue({
2442
+ data: returns,
2443
+ path: ctx.path,
2444
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
2445
+ issueData: {
2446
+ code: ZodIssueCode.invalid_return_type,
2447
+ returnTypeError: error
2448
+ }
2449
+ });
2450
+ }
2451
+ let params = { errorMap: ctx.common.contextualErrorMap }, fn = ctx.data;
2452
+ if (this._def.returns instanceof ZodPromise) {
2453
+ let me = this;
2454
+ return OK(async function(...args) {
2455
+ let error = new ZodError([]), parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2456
+ throw error.addIssue(makeArgsIssue(args, e)), error;
2457
+ }), result = await Reflect.apply(fn, this, parsedArgs);
2458
+ return await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2459
+ throw error.addIssue(makeReturnsIssue(result, e)), error;
2460
+ });
2461
+ });
2462
+ } else {
2463
+ let me = this;
2464
+ return OK(function(...args) {
2465
+ let parsedArgs = me._def.args.safeParse(args, params);
2466
+ if (!parsedArgs.success)
2467
+ throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2468
+ let result = Reflect.apply(fn, this, parsedArgs.data), parsedReturns = me._def.returns.safeParse(result, params);
2469
+ if (!parsedReturns.success)
2470
+ throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2471
+ return parsedReturns.data;
2472
+ });
2473
+ }
2474
+ }
2475
+ parameters() {
2476
+ return this._def.args;
2477
+ }
2478
+ returnType() {
2479
+ return this._def.returns;
2480
+ }
2481
+ args(...items) {
2482
+ return new _ZodFunction({
2483
+ ...this._def,
2484
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
2485
+ });
2486
+ }
2487
+ returns(returnType) {
2488
+ return new _ZodFunction({
2489
+ ...this._def,
2490
+ returns: returnType
2491
+ });
2492
+ }
2493
+ implement(func) {
2494
+ return this.parse(func);
2495
+ }
2496
+ strictImplement(func) {
2497
+ return this.parse(func);
2498
+ }
2499
+ static create(args, returns, params) {
2500
+ return new _ZodFunction({
2501
+ args: args || ZodTuple.create([]).rest(ZodUnknown.create()),
2502
+ returns: returns || ZodUnknown.create(),
2503
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
2504
+ ...processCreateParams(params)
2505
+ });
2506
+ }
2507
+ }, ZodLazy = class extends ZodType {
2508
+ get schema() {
2509
+ return this._def.getter();
2510
+ }
2511
+ _parse(input) {
2512
+ let { ctx } = this._processInputParams(input);
2513
+ return this._def.getter()._parse({ data: ctx.data, path: ctx.path, parent: ctx });
2514
+ }
2515
+ };
2516
+ ZodLazy.create = (getter, params) => new ZodLazy({
2517
+ getter,
2518
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
2519
+ ...processCreateParams(params)
2520
+ });
2521
+ var ZodLiteral = class extends ZodType {
2522
+ _parse(input) {
2523
+ if (input.data !== this._def.value) {
2524
+ let ctx = this._getOrReturnCtx(input);
2525
+ return addIssueToContext(ctx, {
2526
+ received: ctx.data,
2527
+ code: ZodIssueCode.invalid_literal,
2528
+ expected: this._def.value
2529
+ }), INVALID;
2530
+ }
2531
+ return { status: "valid", value: input.data };
2532
+ }
2533
+ get value() {
2534
+ return this._def.value;
2535
+ }
2536
+ };
2537
+ ZodLiteral.create = (value, params) => new ZodLiteral({
2538
+ value,
2539
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
2540
+ ...processCreateParams(params)
2541
+ });
2542
+ function createZodEnum(values, params) {
2543
+ return new ZodEnum({
2544
+ values,
2545
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
2546
+ ...processCreateParams(params)
2547
+ });
2548
+ }
2549
+ var ZodEnum = class _ZodEnum extends ZodType {
2550
+ _parse(input) {
2551
+ if (typeof input.data != "string") {
2552
+ let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
2553
+ return addIssueToContext(ctx, {
2554
+ expected: util.joinValues(expectedValues),
2555
+ received: ctx.parsedType,
2556
+ code: ZodIssueCode.invalid_type
2557
+ }), INVALID;
2558
+ }
2559
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(input.data)) {
2560
+ let ctx = this._getOrReturnCtx(input), expectedValues = this._def.values;
2561
+ return addIssueToContext(ctx, {
2562
+ received: ctx.data,
2563
+ code: ZodIssueCode.invalid_enum_value,
2564
+ options: expectedValues
2565
+ }), INVALID;
2566
+ }
2567
+ return OK(input.data);
2568
+ }
2569
+ get options() {
2570
+ return this._def.values;
2571
+ }
2572
+ get enum() {
2573
+ let enumValues = {};
2574
+ for (let val of this._def.values)
2575
+ enumValues[val] = val;
2576
+ return enumValues;
2577
+ }
2578
+ get Values() {
2579
+ let enumValues = {};
2580
+ for (let val of this._def.values)
2581
+ enumValues[val] = val;
2582
+ return enumValues;
2583
+ }
2584
+ get Enum() {
2585
+ let enumValues = {};
2586
+ for (let val of this._def.values)
2587
+ enumValues[val] = val;
2588
+ return enumValues;
2589
+ }
2590
+ extract(values, newDef = this._def) {
2591
+ return _ZodEnum.create(values, {
2592
+ ...this._def,
2593
+ ...newDef
2594
+ });
2595
+ }
2596
+ exclude(values, newDef = this._def) {
2597
+ return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
2598
+ ...this._def,
2599
+ ...newDef
2600
+ });
2601
+ }
2602
+ };
2603
+ ZodEnum.create = createZodEnum;
2604
+ var ZodNativeEnum = class extends ZodType {
2605
+ _parse(input) {
2606
+ let nativeEnumValues = util.getValidEnumValues(this._def.values), ctx = this._getOrReturnCtx(input);
2607
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
2608
+ let expectedValues = util.objectValues(nativeEnumValues);
2609
+ return addIssueToContext(ctx, {
2610
+ expected: util.joinValues(expectedValues),
2611
+ received: ctx.parsedType,
2612
+ code: ZodIssueCode.invalid_type
2613
+ }), INVALID;
2614
+ }
2615
+ if (this._cache || (this._cache = new Set(util.getValidEnumValues(this._def.values))), !this._cache.has(input.data)) {
2616
+ let expectedValues = util.objectValues(nativeEnumValues);
2617
+ return addIssueToContext(ctx, {
2618
+ received: ctx.data,
2619
+ code: ZodIssueCode.invalid_enum_value,
2620
+ options: expectedValues
2621
+ }), INVALID;
2622
+ }
2623
+ return OK(input.data);
2624
+ }
2625
+ get enum() {
2626
+ return this._def.values;
2627
+ }
2628
+ };
2629
+ ZodNativeEnum.create = (values, params) => new ZodNativeEnum({
2630
+ values,
2631
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
2632
+ ...processCreateParams(params)
2633
+ });
2634
+ var ZodPromise = class extends ZodType {
2635
+ unwrap() {
2636
+ return this._def.type;
2637
+ }
2638
+ _parse(input) {
2639
+ let { ctx } = this._processInputParams(input);
2640
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === !1)
2641
+ return addIssueToContext(ctx, {
2642
+ code: ZodIssueCode.invalid_type,
2643
+ expected: ZodParsedType.promise,
2644
+ received: ctx.parsedType
2645
+ }), INVALID;
2646
+ let promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
2647
+ return OK(promisified.then((data) => this._def.type.parseAsync(data, {
2648
+ path: ctx.path,
2649
+ errorMap: ctx.common.contextualErrorMap
2650
+ })));
2651
+ }
2652
+ };
2653
+ ZodPromise.create = (schema, params) => new ZodPromise({
2654
+ type: schema,
2655
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
2656
+ ...processCreateParams(params)
2657
+ });
2658
+ var ZodEffects = class extends ZodType {
2659
+ innerType() {
2660
+ return this._def.schema;
2661
+ }
2662
+ sourceType() {
2663
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2664
+ }
2665
+ _parse(input) {
2666
+ let { status, ctx } = this._processInputParams(input), effect = this._def.effect || null, checkCtx = {
2667
+ addIssue: (arg) => {
2668
+ addIssueToContext(ctx, arg), arg.fatal ? status.abort() : status.dirty();
2669
+ },
2670
+ get path() {
2671
+ return ctx.path;
2672
+ }
2673
+ };
2674
+ if (checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx), effect.type === "preprocess") {
2675
+ let processed = effect.transform(ctx.data, checkCtx);
2676
+ if (ctx.common.async)
2677
+ return Promise.resolve(processed).then(async (processed2) => {
2678
+ if (status.value === "aborted")
2679
+ return INVALID;
2680
+ let result = await this._def.schema._parseAsync({
2681
+ data: processed2,
2682
+ path: ctx.path,
2683
+ parent: ctx
2684
+ });
2685
+ return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result;
2686
+ });
2687
+ {
2688
+ if (status.value === "aborted")
2689
+ return INVALID;
2690
+ let result = this._def.schema._parseSync({
2691
+ data: processed,
2692
+ path: ctx.path,
2693
+ parent: ctx
2694
+ });
2695
+ return result.status === "aborted" ? INVALID : result.status === "dirty" ? DIRTY(result.value) : status.value === "dirty" ? DIRTY(result.value) : result;
2696
+ }
2697
+ }
2698
+ if (effect.type === "refinement") {
2699
+ let executeRefinement = (acc) => {
2700
+ let result = effect.refinement(acc, checkCtx);
2701
+ if (ctx.common.async)
2702
+ return Promise.resolve(result);
2703
+ if (result instanceof Promise)
2704
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2705
+ return acc;
2706
+ };
2707
+ if (ctx.common.async === !1) {
2708
+ let inner = this._def.schema._parseSync({
2709
+ data: ctx.data,
2710
+ path: ctx.path,
2711
+ parent: ctx
2712
+ });
2713
+ return inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value), { status: status.value, value: inner.value });
2714
+ } else
2715
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => inner.status === "aborted" ? INVALID : (inner.status === "dirty" && status.dirty(), executeRefinement(inner.value).then(() => ({ status: status.value, value: inner.value }))));
2716
+ }
2717
+ if (effect.type === "transform")
2718
+ if (ctx.common.async === !1) {
2719
+ let base = this._def.schema._parseSync({
2720
+ data: ctx.data,
2721
+ path: ctx.path,
2722
+ parent: ctx
2723
+ });
2724
+ if (!isValid(base))
2725
+ return INVALID;
2726
+ let result = effect.transform(base.value, checkCtx);
2727
+ if (result instanceof Promise)
2728
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2729
+ return { status: status.value, value: result };
2730
+ } else
2731
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => isValid(base) ? Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
2732
+ status: status.value,
2733
+ value: result
2734
+ })) : INVALID);
2735
+ util.assertNever(effect);
2736
+ }
2737
+ };
2738
+ ZodEffects.create = (schema, effect, params) => new ZodEffects({
2739
+ schema,
2740
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
2741
+ effect,
2742
+ ...processCreateParams(params)
2743
+ });
2744
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => new ZodEffects({
2745
+ schema,
2746
+ effect: { type: "preprocess", transform: preprocess },
2747
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
2748
+ ...processCreateParams(params)
2749
+ });
2750
+ var ZodOptional = class extends ZodType {
2751
+ _parse(input) {
2752
+ return this._getType(input) === ZodParsedType.undefined ? OK(void 0) : this._def.innerType._parse(input);
2753
+ }
2754
+ unwrap() {
2755
+ return this._def.innerType;
2756
+ }
2757
+ };
2758
+ ZodOptional.create = (type, params) => new ZodOptional({
2759
+ innerType: type,
2760
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
2761
+ ...processCreateParams(params)
2762
+ });
2763
+ var ZodNullable = class extends ZodType {
2764
+ _parse(input) {
2765
+ return this._getType(input) === ZodParsedType.null ? OK(null) : this._def.innerType._parse(input);
2766
+ }
2767
+ unwrap() {
2768
+ return this._def.innerType;
2769
+ }
2770
+ };
2771
+ ZodNullable.create = (type, params) => new ZodNullable({
2772
+ innerType: type,
2773
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
2774
+ ...processCreateParams(params)
2775
+ });
2776
+ var ZodDefault = class extends ZodType {
2777
+ _parse(input) {
2778
+ let { ctx } = this._processInputParams(input), data = ctx.data;
2779
+ return ctx.parsedType === ZodParsedType.undefined && (data = this._def.defaultValue()), this._def.innerType._parse({
2780
+ data,
2781
+ path: ctx.path,
2782
+ parent: ctx
2783
+ });
2784
+ }
2785
+ removeDefault() {
2786
+ return this._def.innerType;
2787
+ }
2788
+ };
2789
+ ZodDefault.create = (type, params) => new ZodDefault({
2790
+ innerType: type,
2791
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
2792
+ defaultValue: typeof params.default == "function" ? params.default : () => params.default,
2793
+ ...processCreateParams(params)
2794
+ });
2795
+ var ZodCatch = class extends ZodType {
2796
+ _parse(input) {
2797
+ let { ctx } = this._processInputParams(input), newCtx = {
2798
+ ...ctx,
2799
+ common: {
2800
+ ...ctx.common,
2801
+ issues: []
2802
+ }
2803
+ }, result = this._def.innerType._parse({
2804
+ data: newCtx.data,
2805
+ path: newCtx.path,
2806
+ parent: {
2807
+ ...newCtx
2808
+ }
2809
+ });
2810
+ return isAsync(result) ? result.then((result2) => ({
2811
+ status: "valid",
2812
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
2813
+ get error() {
2814
+ return new ZodError(newCtx.common.issues);
2815
+ },
2816
+ input: newCtx.data
2817
+ })
2818
+ })) : {
2819
+ status: "valid",
2820
+ value: result.status === "valid" ? result.value : this._def.catchValue({
2821
+ get error() {
2822
+ return new ZodError(newCtx.common.issues);
2823
+ },
2824
+ input: newCtx.data
2825
+ })
2826
+ };
2827
+ }
2828
+ removeCatch() {
2829
+ return this._def.innerType;
2830
+ }
2831
+ };
2832
+ ZodCatch.create = (type, params) => new ZodCatch({
2833
+ innerType: type,
2834
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
2835
+ catchValue: typeof params.catch == "function" ? params.catch : () => params.catch,
2836
+ ...processCreateParams(params)
2837
+ });
2838
+ var ZodNaN = class extends ZodType {
2839
+ _parse(input) {
2840
+ if (this._getType(input) !== ZodParsedType.nan) {
2841
+ let ctx = this._getOrReturnCtx(input);
2842
+ return addIssueToContext(ctx, {
2843
+ code: ZodIssueCode.invalid_type,
2844
+ expected: ZodParsedType.nan,
2845
+ received: ctx.parsedType
2846
+ }), INVALID;
2847
+ }
2848
+ return { status: "valid", value: input.data };
2849
+ }
2850
+ };
2851
+ ZodNaN.create = (params) => new ZodNaN({
2852
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
2853
+ ...processCreateParams(params)
2854
+ });
2855
+ var BRAND = /* @__PURE__ */ Symbol("zod_brand"), ZodBranded = class extends ZodType {
2856
+ _parse(input) {
2857
+ let { ctx } = this._processInputParams(input), data = ctx.data;
2858
+ return this._def.type._parse({
2859
+ data,
2860
+ path: ctx.path,
2861
+ parent: ctx
2862
+ });
2863
+ }
2864
+ unwrap() {
2865
+ return this._def.type;
2866
+ }
2867
+ }, ZodPipeline = class _ZodPipeline extends ZodType {
2868
+ _parse(input) {
2869
+ let { status, ctx } = this._processInputParams(input);
2870
+ if (ctx.common.async)
2871
+ return (async () => {
2872
+ let inResult = await this._def.in._parseAsync({
2873
+ data: ctx.data,
2874
+ path: ctx.path,
2875
+ parent: ctx
2876
+ });
2877
+ return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), DIRTY(inResult.value)) : this._def.out._parseAsync({
2878
+ data: inResult.value,
2879
+ path: ctx.path,
2880
+ parent: ctx
2881
+ });
2882
+ })();
2883
+ {
2884
+ let inResult = this._def.in._parseSync({
2885
+ data: ctx.data,
2886
+ path: ctx.path,
2887
+ parent: ctx
2888
+ });
2889
+ return inResult.status === "aborted" ? INVALID : inResult.status === "dirty" ? (status.dirty(), {
2890
+ status: "dirty",
2891
+ value: inResult.value
2892
+ }) : this._def.out._parseSync({
2893
+ data: inResult.value,
2894
+ path: ctx.path,
2895
+ parent: ctx
2896
+ });
2897
+ }
2898
+ }
2899
+ static create(a, b) {
2900
+ return new _ZodPipeline({
2901
+ in: a,
2902
+ out: b,
2903
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
2904
+ });
2905
+ }
2906
+ }, ZodReadonly = class extends ZodType {
2907
+ _parse(input) {
2908
+ let result = this._def.innerType._parse(input), freeze = (data) => (isValid(data) && (data.value = Object.freeze(data.value)), data);
2909
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
2910
+ }
2911
+ unwrap() {
2912
+ return this._def.innerType;
2913
+ }
2914
+ };
2915
+ ZodReadonly.create = (type, params) => new ZodReadonly({
2916
+ innerType: type,
2917
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
2918
+ ...processCreateParams(params)
2919
+ });
2920
+ function cleanParams(params, data) {
2921
+ let p = typeof params == "function" ? params(data) : typeof params == "string" ? { message: params } : params;
2922
+ return typeof p == "string" ? { message: p } : p;
2923
+ }
2924
+ function custom(check, _params = {}, fatal) {
2925
+ return check ? ZodAny.create().superRefine((data, ctx) => {
2926
+ let r = check(data);
2927
+ if (r instanceof Promise)
2928
+ return r.then((r2) => {
2929
+ if (!r2) {
2930
+ let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0;
2931
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
2932
+ }
2933
+ });
2934
+ if (!r) {
2935
+ let params = cleanParams(_params, data), _fatal = params.fatal ?? fatal ?? !0;
2936
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
2937
+ }
2938
+ }) : ZodAny.create();
2939
+ }
2940
+ var late = {
2941
+ object: ZodObject.lazycreate
2942
+ }, ZodFirstPartyTypeKind;
2943
+ (function(ZodFirstPartyTypeKind2) {
2944
+ ZodFirstPartyTypeKind2.ZodString = "ZodString", ZodFirstPartyTypeKind2.ZodNumber = "ZodNumber", ZodFirstPartyTypeKind2.ZodNaN = "ZodNaN", ZodFirstPartyTypeKind2.ZodBigInt = "ZodBigInt", ZodFirstPartyTypeKind2.ZodBoolean = "ZodBoolean", ZodFirstPartyTypeKind2.ZodDate = "ZodDate", ZodFirstPartyTypeKind2.ZodSymbol = "ZodSymbol", ZodFirstPartyTypeKind2.ZodUndefined = "ZodUndefined", ZodFirstPartyTypeKind2.ZodNull = "ZodNull", ZodFirstPartyTypeKind2.ZodAny = "ZodAny", ZodFirstPartyTypeKind2.ZodUnknown = "ZodUnknown", ZodFirstPartyTypeKind2.ZodNever = "ZodNever", ZodFirstPartyTypeKind2.ZodVoid = "ZodVoid", ZodFirstPartyTypeKind2.ZodArray = "ZodArray", ZodFirstPartyTypeKind2.ZodObject = "ZodObject", ZodFirstPartyTypeKind2.ZodUnion = "ZodUnion", ZodFirstPartyTypeKind2.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", ZodFirstPartyTypeKind2.ZodIntersection = "ZodIntersection", ZodFirstPartyTypeKind2.ZodTuple = "ZodTuple", ZodFirstPartyTypeKind2.ZodRecord = "ZodRecord", ZodFirstPartyTypeKind2.ZodMap = "ZodMap", ZodFirstPartyTypeKind2.ZodSet = "ZodSet", ZodFirstPartyTypeKind2.ZodFunction = "ZodFunction", ZodFirstPartyTypeKind2.ZodLazy = "ZodLazy", ZodFirstPartyTypeKind2.ZodLiteral = "ZodLiteral", ZodFirstPartyTypeKind2.ZodEnum = "ZodEnum", ZodFirstPartyTypeKind2.ZodEffects = "ZodEffects", ZodFirstPartyTypeKind2.ZodNativeEnum = "ZodNativeEnum", ZodFirstPartyTypeKind2.ZodOptional = "ZodOptional", ZodFirstPartyTypeKind2.ZodNullable = "ZodNullable", ZodFirstPartyTypeKind2.ZodDefault = "ZodDefault", ZodFirstPartyTypeKind2.ZodCatch = "ZodCatch", ZodFirstPartyTypeKind2.ZodPromise = "ZodPromise", ZodFirstPartyTypeKind2.ZodBranded = "ZodBranded", ZodFirstPartyTypeKind2.ZodPipeline = "ZodPipeline", ZodFirstPartyTypeKind2.ZodReadonly = "ZodReadonly";
2945
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
2946
+ var instanceOfType = (cls, params = {
2947
+ message: `Input not instance of ${cls.name}`
2948
+ }) => custom((data) => data instanceof cls, params), stringType = ZodString.create, numberType = ZodNumber.create, nanType = ZodNaN.create, bigIntType = ZodBigInt.create, booleanType = ZodBoolean.create, dateType = ZodDate.create, symbolType = ZodSymbol.create, undefinedType = ZodUndefined.create, nullType = ZodNull.create, anyType = ZodAny.create, unknownType = ZodUnknown.create, neverType = ZodNever.create, voidType = ZodVoid.create, arrayType = ZodArray.create, objectType = ZodObject.create, strictObjectType = ZodObject.strictCreate, unionType = ZodUnion.create, discriminatedUnionType = ZodDiscriminatedUnion.create, intersectionType = ZodIntersection.create, tupleType = ZodTuple.create, recordType = ZodRecord.create, mapType = ZodMap.create, setType = ZodSet.create, functionType = ZodFunction.create, lazyType = ZodLazy.create, literalType = ZodLiteral.create, enumType = ZodEnum.create, nativeEnumType = ZodNativeEnum.create, promiseType = ZodPromise.create, effectsType = ZodEffects.create, optionalType = ZodOptional.create, nullableType = ZodNullable.create, preprocessType = ZodEffects.createWithPreprocess, pipelineType = ZodPipeline.create, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce = {
2949
+ string: ((arg) => ZodString.create({ ...arg, coerce: !0 })),
2950
+ number: ((arg) => ZodNumber.create({ ...arg, coerce: !0 })),
2951
+ boolean: ((arg) => ZodBoolean.create({
2952
+ ...arg,
2953
+ coerce: !0
2954
+ })),
2955
+ bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: !0 })),
2956
+ date: ((arg) => ZodDate.create({ ...arg, coerce: !0 }))
2957
+ };
2958
+ var NEVER = INVALID;
2959
+
2960
+ // src/cli/globalSettings.ts
2961
+ var DEFAULT_SETTINGS_PATH = join(homedir(), ".forkbook", "settings.json"), VERSION = 1, userSettingSchema = external_exports.object({
2962
+ version: external_exports.number(),
2963
+ // NOTE: every key (and subkey) below must be optional, for forwards compatibility reasons
2964
+ // (we can remove keys once they are deprecated)
2965
+ userSince: external_exports.number().optional()
2966
+ }), settings;
2967
+ async function globalSettings(filePath = DEFAULT_SETTINGS_PATH) {
2968
+ if (settings)
2969
+ return settings;
2970
+ try {
2971
+ let content = await fs.readFile(filePath, "utf8"), settingsValue = userSettingSchema.parse(JSON.parse(content));
2972
+ settings = new Settings(filePath, settingsValue);
2973
+ } catch {
2974
+ settings = new Settings(filePath, { version: VERSION, userSince: Date.now() }), await settings.save();
2975
+ }
2976
+ return settings;
2977
+ }
2978
+ function _clearGlobalSettings() {
2979
+ settings = void 0;
2980
+ }
2981
+ var Settings = class {
2982
+ /**
2983
+ * Create a new Settings instance
2984
+ *
2985
+ * @param filePath Path to the JSON settings file
2986
+ * @param value Loaded value of settings
2987
+ */
2988
+ constructor(filePath, value) {
2989
+ this.filePath = filePath, this.value = value;
2990
+ }
2991
+ /** Save settings to the file */
2992
+ async save() {
2993
+ invariant(this.filePath, "No file path to save settings to");
2994
+ try {
2995
+ await fs.mkdir(dirname(this.filePath), { recursive: !0 }), await fs.writeFile(this.filePath, JSON.stringify(this.value, null, 2));
2996
+ } catch (err) {
2997
+ console.warn(dedent`
2998
+ Unable to save global settings file to ${this.filePath}
2999
+ ${err && `Reason: ${err.message ?? err}`}`);
3000
+ }
3001
+ }
3002
+ };
3003
+
3004
+ export {
3005
+ globalSettings,
3006
+ _clearGlobalSettings,
3007
+ Settings
3008
+ };