makecoder 1.0.25

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 (656) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +281 -0
  3. package/claude/commands/dev/ultra-think.md +153 -0
  4. package/claude/commands/docs/generate-api-documentation.md +80 -0
  5. package/claude/commands/git/commit.md +63 -0
  6. package/claude/commands/git/status.md +39 -0
  7. package/claude/commands/setup/migrate-to-typescript.md +76 -0
  8. package/claude/commands/test/generate-test-cases.md +76 -0
  9. package/dist/cc.mjs +4654 -0
  10. package/dist/coder.js +201 -0
  11. package/dist/codex +0 -0
  12. package/dist/codex.exe +0 -0
  13. package/dist/codex.mjs +162 -0
  14. package/dist/gcli.mjs +3162 -0
  15. package/dist/vendor/claude-code-jetbrains-plugin/lib/annotations-23.0.0.jar +0 -0
  16. package/dist/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.12-beta-searchableOptions.jar +0 -0
  17. package/dist/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.12-beta.jar +0 -0
  18. package/dist/vendor/claude-code-jetbrains-plugin/lib/config-1.4.3.jar +0 -0
  19. package/dist/vendor/claude-code-jetbrains-plugin/lib/jansi-2.4.1.jar +0 -0
  20. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-logging-jvm-7.0.0.jar +0 -0
  21. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-reflect-2.0.21.jar +0 -0
  22. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-sdk-jvm-0.4.0.jar +0 -0
  23. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-stdlib-2.1.20.jar +0 -0
  24. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-core-jvm-1.9.0.jar +0 -0
  25. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-slf4j-1.9.0.jar +0 -0
  26. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-bytestring-jvm-0.5.4.jar +0 -0
  27. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-core-jvm-0.5.4.jar +0 -0
  28. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-core-jvm-1.8.1.jar +0 -0
  29. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-json-jvm-1.8.1.jar +0 -0
  30. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-client-cio-jvm-3.0.2.jar +0 -0
  31. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-client-core-jvm-3.0.2.jar +0 -0
  32. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-events-jvm-3.0.2.jar +0 -0
  33. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-http-cio-jvm-3.0.2.jar +0 -0
  34. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-http-jvm-3.0.2.jar +0 -0
  35. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-io-jvm-3.0.2.jar +0 -0
  36. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-network-jvm-3.0.2.jar +0 -0
  37. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-network-tls-jvm-3.0.2.jar +0 -0
  38. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-serialization-jvm-3.0.2.jar +0 -0
  39. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-cio-jvm-3.0.2.jar +0 -0
  40. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-core-jvm-3.0.2.jar +0 -0
  41. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-sse-jvm-3.0.2.jar +0 -0
  42. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-websockets-jvm-3.0.2.jar +0 -0
  43. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-sse-jvm-3.0.2.jar +0 -0
  44. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-utils-jvm-3.0.2.jar +0 -0
  45. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-websocket-serialization-jvm-3.0.2.jar +0 -0
  46. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-websockets-jvm-3.0.2.jar +0 -0
  47. package/dist/vendor/claude-code-jetbrains-plugin/lib/slf4j-api-2.0.16.jar +0 -0
  48. package/dist/vendor/ripgrep/COPYING +3 -0
  49. package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  50. package/dist/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
  51. package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  52. package/dist/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
  53. package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  54. package/dist/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
  55. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  56. package/dist/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
  57. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  58. package/dist/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
  59. package/dist/zod/LICENSE +21 -0
  60. package/dist/zod/README.md +208 -0
  61. package/dist/zod/index.cjs +33 -0
  62. package/dist/zod/index.d.cts +4 -0
  63. package/dist/zod/index.d.ts +4 -0
  64. package/dist/zod/index.js +4 -0
  65. package/dist/zod/package.json +118 -0
  66. package/dist/zod/src/index.ts +4 -0
  67. package/dist/zod/src/v3/ZodError.ts +330 -0
  68. package/dist/zod/src/v3/benchmarks/datetime.ts +58 -0
  69. package/dist/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  70. package/dist/zod/src/v3/benchmarks/index.ts +59 -0
  71. package/dist/zod/src/v3/benchmarks/ipv4.ts +57 -0
  72. package/dist/zod/src/v3/benchmarks/object.ts +69 -0
  73. package/dist/zod/src/v3/benchmarks/primitives.ts +162 -0
  74. package/dist/zod/src/v3/benchmarks/realworld.ts +63 -0
  75. package/dist/zod/src/v3/benchmarks/string.ts +55 -0
  76. package/dist/zod/src/v3/benchmarks/union.ts +80 -0
  77. package/dist/zod/src/v3/errors.ts +13 -0
  78. package/dist/zod/src/v3/external.ts +6 -0
  79. package/dist/zod/src/v3/helpers/enumUtil.ts +17 -0
  80. package/dist/zod/src/v3/helpers/errorUtil.ts +8 -0
  81. package/dist/zod/src/v3/helpers/parseUtil.ts +176 -0
  82. package/dist/zod/src/v3/helpers/partialUtil.ts +34 -0
  83. package/dist/zod/src/v3/helpers/typeAliases.ts +2 -0
  84. package/dist/zod/src/v3/helpers/util.ts +224 -0
  85. package/dist/zod/src/v3/index.ts +4 -0
  86. package/dist/zod/src/v3/locales/en.ts +124 -0
  87. package/dist/zod/src/v3/standard-schema.ts +113 -0
  88. package/dist/zod/src/v3/tests/Mocker.ts +54 -0
  89. package/dist/zod/src/v3/tests/all-errors.test.ts +157 -0
  90. package/dist/zod/src/v3/tests/anyunknown.test.ts +28 -0
  91. package/dist/zod/src/v3/tests/array.test.ts +71 -0
  92. package/dist/zod/src/v3/tests/async-parsing.test.ts +388 -0
  93. package/dist/zod/src/v3/tests/async-refinements.test.ts +46 -0
  94. package/dist/zod/src/v3/tests/base.test.ts +29 -0
  95. package/dist/zod/src/v3/tests/bigint.test.ts +55 -0
  96. package/dist/zod/src/v3/tests/branded.test.ts +53 -0
  97. package/dist/zod/src/v3/tests/catch.test.ts +220 -0
  98. package/dist/zod/src/v3/tests/coerce.test.ts +133 -0
  99. package/dist/zod/src/v3/tests/complex.test.ts +56 -0
  100. package/dist/zod/src/v3/tests/custom.test.ts +31 -0
  101. package/dist/zod/src/v3/tests/date.test.ts +32 -0
  102. package/dist/zod/src/v3/tests/deepmasking.test.ts +186 -0
  103. package/dist/zod/src/v3/tests/default.test.ts +112 -0
  104. package/dist/zod/src/v3/tests/description.test.ts +33 -0
  105. package/dist/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  106. package/dist/zod/src/v3/tests/enum.test.ts +80 -0
  107. package/dist/zod/src/v3/tests/error.test.ts +551 -0
  108. package/dist/zod/src/v3/tests/firstparty.test.ts +87 -0
  109. package/dist/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  110. package/dist/zod/src/v3/tests/function.test.ts +257 -0
  111. package/dist/zod/src/v3/tests/generics.test.ts +48 -0
  112. package/dist/zod/src/v3/tests/instanceof.test.ts +37 -0
  113. package/dist/zod/src/v3/tests/intersection.test.ts +110 -0
  114. package/dist/zod/src/v3/tests/language-server.source.ts +76 -0
  115. package/dist/zod/src/v3/tests/language-server.test.ts +207 -0
  116. package/dist/zod/src/v3/tests/literal.test.ts +36 -0
  117. package/dist/zod/src/v3/tests/map.test.ts +110 -0
  118. package/dist/zod/src/v3/tests/masking.test.ts +4 -0
  119. package/dist/zod/src/v3/tests/mocker.test.ts +19 -0
  120. package/dist/zod/src/v3/tests/nan.test.ts +21 -0
  121. package/dist/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  122. package/dist/zod/src/v3/tests/nullable.test.ts +42 -0
  123. package/dist/zod/src/v3/tests/number.test.ts +176 -0
  124. package/dist/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  125. package/dist/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  126. package/dist/zod/src/v3/tests/object.test.ts +434 -0
  127. package/dist/zod/src/v3/tests/optional.test.ts +42 -0
  128. package/dist/zod/src/v3/tests/parseUtil.test.ts +23 -0
  129. package/dist/zod/src/v3/tests/parser.test.ts +41 -0
  130. package/dist/zod/src/v3/tests/partials.test.ts +243 -0
  131. package/dist/zod/src/v3/tests/pickomit.test.ts +111 -0
  132. package/dist/zod/src/v3/tests/pipeline.test.ts +29 -0
  133. package/dist/zod/src/v3/tests/preprocess.test.ts +186 -0
  134. package/dist/zod/src/v3/tests/primitive.test.ts +440 -0
  135. package/dist/zod/src/v3/tests/promise.test.ts +90 -0
  136. package/dist/zod/src/v3/tests/readonly.test.ts +194 -0
  137. package/dist/zod/src/v3/tests/record.test.ts +171 -0
  138. package/dist/zod/src/v3/tests/recursive.test.ts +197 -0
  139. package/dist/zod/src/v3/tests/refine.test.ts +313 -0
  140. package/dist/zod/src/v3/tests/safeparse.test.ts +27 -0
  141. package/dist/zod/src/v3/tests/set.test.ts +142 -0
  142. package/dist/zod/src/v3/tests/standard-schema.test.ts +83 -0
  143. package/dist/zod/src/v3/tests/string.test.ts +916 -0
  144. package/dist/zod/src/v3/tests/transformer.test.ts +233 -0
  145. package/dist/zod/src/v3/tests/tuple.test.ts +90 -0
  146. package/dist/zod/src/v3/tests/unions.test.ts +57 -0
  147. package/dist/zod/src/v3/tests/validations.test.ts +133 -0
  148. package/dist/zod/src/v3/tests/void.test.ts +15 -0
  149. package/dist/zod/src/v3/types.ts +5136 -0
  150. package/dist/zod/src/v4/classic/checks.ts +30 -0
  151. package/dist/zod/src/v4/classic/coerce.ts +27 -0
  152. package/dist/zod/src/v4/classic/compat.ts +66 -0
  153. package/dist/zod/src/v4/classic/errors.ts +75 -0
  154. package/dist/zod/src/v4/classic/external.ts +50 -0
  155. package/dist/zod/src/v4/classic/index.ts +5 -0
  156. package/dist/zod/src/v4/classic/iso.ts +90 -0
  157. package/dist/zod/src/v4/classic/parse.ts +33 -0
  158. package/dist/zod/src/v4/classic/schemas.ts +2054 -0
  159. package/dist/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  160. package/dist/zod/src/v4/classic/tests/array.test.ts +264 -0
  161. package/dist/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  162. package/dist/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  163. package/dist/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  164. package/dist/zod/src/v4/classic/tests/base.test.ts +7 -0
  165. package/dist/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  166. package/dist/zod/src/v4/classic/tests/brand.test.ts +63 -0
  167. package/dist/zod/src/v4/classic/tests/catch.test.ts +252 -0
  168. package/dist/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  169. package/dist/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  170. package/dist/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  171. package/dist/zod/src/v4/classic/tests/custom.test.ts +40 -0
  172. package/dist/zod/src/v4/classic/tests/date.test.ts +31 -0
  173. package/dist/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  174. package/dist/zod/src/v4/classic/tests/default.test.ts +313 -0
  175. package/dist/zod/src/v4/classic/tests/description.test.ts +32 -0
  176. package/dist/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  177. package/dist/zod/src/v4/classic/tests/enum.test.ts +285 -0
  178. package/dist/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  179. package/dist/zod/src/v4/classic/tests/error.test.ts +711 -0
  180. package/dist/zod/src/v4/classic/tests/file.test.ts +91 -0
  181. package/dist/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  182. package/dist/zod/src/v4/classic/tests/function.test.ts +268 -0
  183. package/dist/zod/src/v4/classic/tests/generics.test.ts +72 -0
  184. package/dist/zod/src/v4/classic/tests/index.test.ts +829 -0
  185. package/dist/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  186. package/dist/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  187. package/dist/zod/src/v4/classic/tests/json.test.ts +108 -0
  188. package/dist/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  189. package/dist/zod/src/v4/classic/tests/literal.test.ts +92 -0
  190. package/dist/zod/src/v4/classic/tests/map.test.ts +196 -0
  191. package/dist/zod/src/v4/classic/tests/nan.test.ts +21 -0
  192. package/dist/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  193. package/dist/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  194. package/dist/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  195. package/dist/zod/src/v4/classic/tests/number.test.ts +247 -0
  196. package/dist/zod/src/v4/classic/tests/object.test.ts +563 -0
  197. package/dist/zod/src/v4/classic/tests/optional.test.ts +123 -0
  198. package/dist/zod/src/v4/classic/tests/partial.test.ts +147 -0
  199. package/dist/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  200. package/dist/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  201. package/dist/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  202. package/dist/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  203. package/dist/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  204. package/dist/zod/src/v4/classic/tests/promise.test.ts +81 -0
  205. package/dist/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  206. package/dist/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  207. package/dist/zod/src/v4/classic/tests/record.test.ts +342 -0
  208. package/dist/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  209. package/dist/zod/src/v4/classic/tests/refine.test.ts +532 -0
  210. package/dist/zod/src/v4/classic/tests/registries.test.ts +204 -0
  211. package/dist/zod/src/v4/classic/tests/set.test.ts +179 -0
  212. package/dist/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  213. package/dist/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  214. package/dist/zod/src/v4/classic/tests/string.test.ts +881 -0
  215. package/dist/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  216. package/dist/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  217. package/dist/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  218. package/dist/zod/src/v4/classic/tests/transform.test.ts +250 -0
  219. package/dist/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  220. package/dist/zod/src/v4/classic/tests/union.test.ts +94 -0
  221. package/dist/zod/src/v4/classic/tests/validations.test.ts +283 -0
  222. package/dist/zod/src/v4/classic/tests/void.test.ts +12 -0
  223. package/dist/zod/src/v4/core/api.ts +1594 -0
  224. package/dist/zod/src/v4/core/checks.ts +1283 -0
  225. package/dist/zod/src/v4/core/config.ts +15 -0
  226. package/dist/zod/src/v4/core/core.ts +134 -0
  227. package/dist/zod/src/v4/core/doc.ts +44 -0
  228. package/dist/zod/src/v4/core/errors.ts +424 -0
  229. package/dist/zod/src/v4/core/function.ts +176 -0
  230. package/dist/zod/src/v4/core/index.ts +15 -0
  231. package/dist/zod/src/v4/core/json-schema.ts +143 -0
  232. package/dist/zod/src/v4/core/parse.ts +94 -0
  233. package/dist/zod/src/v4/core/regexes.ts +135 -0
  234. package/dist/zod/src/v4/core/registries.ts +96 -0
  235. package/dist/zod/src/v4/core/schemas.ts +3842 -0
  236. package/dist/zod/src/v4/core/standard-schema.ts +64 -0
  237. package/dist/zod/src/v4/core/tests/index.test.ts +46 -0
  238. package/dist/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  239. package/dist/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  240. package/dist/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  241. package/dist/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  242. package/dist/zod/src/v4/core/to-json-schema.ts +977 -0
  243. package/dist/zod/src/v4/core/util.ts +775 -0
  244. package/dist/zod/src/v4/core/versions.ts +5 -0
  245. package/dist/zod/src/v4/core/zsf.ts +323 -0
  246. package/dist/zod/src/v4/index.ts +4 -0
  247. package/dist/zod/src/v4/locales/ar.ts +125 -0
  248. package/dist/zod/src/v4/locales/az.ts +121 -0
  249. package/dist/zod/src/v4/locales/be.ts +184 -0
  250. package/dist/zod/src/v4/locales/ca.ts +127 -0
  251. package/dist/zod/src/v4/locales/cs.ts +142 -0
  252. package/dist/zod/src/v4/locales/de.ts +124 -0
  253. package/dist/zod/src/v4/locales/en.ts +127 -0
  254. package/dist/zod/src/v4/locales/eo.ts +125 -0
  255. package/dist/zod/src/v4/locales/es.ts +125 -0
  256. package/dist/zod/src/v4/locales/fa.ts +134 -0
  257. package/dist/zod/src/v4/locales/fi.ts +131 -0
  258. package/dist/zod/src/v4/locales/fr-CA.ts +126 -0
  259. package/dist/zod/src/v4/locales/fr.ts +124 -0
  260. package/dist/zod/src/v4/locales/he.ts +125 -0
  261. package/dist/zod/src/v4/locales/hu.ts +126 -0
  262. package/dist/zod/src/v4/locales/id.ts +125 -0
  263. package/dist/zod/src/v4/locales/index.ts +39 -0
  264. package/dist/zod/src/v4/locales/it.ts +125 -0
  265. package/dist/zod/src/v4/locales/ja.ts +122 -0
  266. package/dist/zod/src/v4/locales/kh.ts +126 -0
  267. package/dist/zod/src/v4/locales/ko.ts +131 -0
  268. package/dist/zod/src/v4/locales/mk.ts +127 -0
  269. package/dist/zod/src/v4/locales/ms.ts +124 -0
  270. package/dist/zod/src/v4/locales/nl.ts +126 -0
  271. package/dist/zod/src/v4/locales/no.ts +124 -0
  272. package/dist/zod/src/v4/locales/ota.ts +125 -0
  273. package/dist/zod/src/v4/locales/pl.ts +126 -0
  274. package/dist/zod/src/v4/locales/ps.ts +133 -0
  275. package/dist/zod/src/v4/locales/pt.ts +123 -0
  276. package/dist/zod/src/v4/locales/ru.ts +184 -0
  277. package/dist/zod/src/v4/locales/sl.ts +126 -0
  278. package/dist/zod/src/v4/locales/sv.ts +127 -0
  279. package/dist/zod/src/v4/locales/ta.ts +125 -0
  280. package/dist/zod/src/v4/locales/th.ts +126 -0
  281. package/dist/zod/src/v4/locales/tr.ts +121 -0
  282. package/dist/zod/src/v4/locales/ua.ts +126 -0
  283. package/dist/zod/src/v4/locales/ur.ts +126 -0
  284. package/dist/zod/src/v4/locales/vi.ts +125 -0
  285. package/dist/zod/src/v4/locales/zh-CN.ts +123 -0
  286. package/dist/zod/src/v4/locales/zh-TW.ts +125 -0
  287. package/dist/zod/src/v4/mini/checks.ts +32 -0
  288. package/dist/zod/src/v4/mini/coerce.ts +22 -0
  289. package/dist/zod/src/v4/mini/external.ts +40 -0
  290. package/dist/zod/src/v4/mini/index.ts +3 -0
  291. package/dist/zod/src/v4/mini/iso.ts +62 -0
  292. package/dist/zod/src/v4/mini/parse.ts +1 -0
  293. package/dist/zod/src/v4/mini/schemas.ts +1579 -0
  294. package/dist/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  295. package/dist/zod/src/v4/mini/tests/brand.test.ts +51 -0
  296. package/dist/zod/src/v4/mini/tests/checks.test.ts +144 -0
  297. package/dist/zod/src/v4/mini/tests/computed.test.ts +36 -0
  298. package/dist/zod/src/v4/mini/tests/error.test.ts +22 -0
  299. package/dist/zod/src/v4/mini/tests/functions.test.ts +43 -0
  300. package/dist/zod/src/v4/mini/tests/index.test.ts +871 -0
  301. package/dist/zod/src/v4/mini/tests/number.test.ts +95 -0
  302. package/dist/zod/src/v4/mini/tests/object.test.ts +185 -0
  303. package/dist/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  304. package/dist/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  305. package/dist/zod/src/v4/mini/tests/string.test.ts +299 -0
  306. package/dist/zod/src/v4-mini/index.ts +1 -0
  307. package/dist/zod/v3/ZodError.cjs +138 -0
  308. package/dist/zod/v3/ZodError.d.cts +164 -0
  309. package/dist/zod/v3/ZodError.d.ts +164 -0
  310. package/dist/zod/v3/ZodError.js +133 -0
  311. package/dist/zod/v3/errors.cjs +17 -0
  312. package/dist/zod/v3/errors.d.cts +5 -0
  313. package/dist/zod/v3/errors.d.ts +5 -0
  314. package/dist/zod/v3/errors.js +9 -0
  315. package/dist/zod/v3/external.cjs +22 -0
  316. package/dist/zod/v3/external.d.cts +6 -0
  317. package/dist/zod/v3/external.d.ts +6 -0
  318. package/dist/zod/v3/external.js +6 -0
  319. package/dist/zod/v3/helpers/enumUtil.cjs +2 -0
  320. package/dist/zod/v3/helpers/enumUtil.d.cts +8 -0
  321. package/dist/zod/v3/helpers/enumUtil.d.ts +8 -0
  322. package/dist/zod/v3/helpers/enumUtil.js +1 -0
  323. package/dist/zod/v3/helpers/errorUtil.cjs +9 -0
  324. package/dist/zod/v3/helpers/errorUtil.d.cts +9 -0
  325. package/dist/zod/v3/helpers/errorUtil.d.ts +9 -0
  326. package/dist/zod/v3/helpers/errorUtil.js +6 -0
  327. package/dist/zod/v3/helpers/parseUtil.cjs +124 -0
  328. package/dist/zod/v3/helpers/parseUtil.d.cts +78 -0
  329. package/dist/zod/v3/helpers/parseUtil.d.ts +78 -0
  330. package/dist/zod/v3/helpers/parseUtil.js +109 -0
  331. package/dist/zod/v3/helpers/partialUtil.cjs +2 -0
  332. package/dist/zod/v3/helpers/partialUtil.d.cts +8 -0
  333. package/dist/zod/v3/helpers/partialUtil.d.ts +8 -0
  334. package/dist/zod/v3/helpers/partialUtil.js +1 -0
  335. package/dist/zod/v3/helpers/typeAliases.cjs +2 -0
  336. package/dist/zod/v3/helpers/typeAliases.d.cts +2 -0
  337. package/dist/zod/v3/helpers/typeAliases.d.ts +2 -0
  338. package/dist/zod/v3/helpers/typeAliases.js +1 -0
  339. package/dist/zod/v3/helpers/util.cjs +137 -0
  340. package/dist/zod/v3/helpers/util.d.cts +85 -0
  341. package/dist/zod/v3/helpers/util.d.ts +85 -0
  342. package/dist/zod/v3/helpers/util.js +133 -0
  343. package/dist/zod/v3/index.cjs +33 -0
  344. package/dist/zod/v3/index.d.cts +4 -0
  345. package/dist/zod/v3/index.d.ts +4 -0
  346. package/dist/zod/v3/index.js +4 -0
  347. package/dist/zod/v3/locales/en.cjs +111 -0
  348. package/dist/zod/v3/locales/en.d.cts +3 -0
  349. package/dist/zod/v3/locales/en.d.ts +3 -0
  350. package/dist/zod/v3/locales/en.js +109 -0
  351. package/dist/zod/v3/standard-schema.cjs +2 -0
  352. package/dist/zod/v3/standard-schema.d.cts +102 -0
  353. package/dist/zod/v3/standard-schema.d.ts +102 -0
  354. package/dist/zod/v3/standard-schema.js +1 -0
  355. package/dist/zod/v3/types.cjs +3775 -0
  356. package/dist/zod/v3/types.d.cts +1031 -0
  357. package/dist/zod/v3/types.d.ts +1031 -0
  358. package/dist/zod/v3/types.js +3693 -0
  359. package/dist/zod/v4/classic/checks.cjs +32 -0
  360. package/dist/zod/v4/classic/checks.d.cts +1 -0
  361. package/dist/zod/v4/classic/checks.d.ts +1 -0
  362. package/dist/zod/v4/classic/checks.js +1 -0
  363. package/dist/zod/v4/classic/coerce.cjs +47 -0
  364. package/dist/zod/v4/classic/coerce.d.cts +17 -0
  365. package/dist/zod/v4/classic/coerce.d.ts +17 -0
  366. package/dist/zod/v4/classic/coerce.js +17 -0
  367. package/dist/zod/v4/classic/compat.cjs +57 -0
  368. package/dist/zod/v4/classic/compat.d.cts +46 -0
  369. package/dist/zod/v4/classic/compat.d.ts +46 -0
  370. package/dist/zod/v4/classic/compat.js +27 -0
  371. package/dist/zod/v4/classic/errors.cjs +67 -0
  372. package/dist/zod/v4/classic/errors.d.cts +30 -0
  373. package/dist/zod/v4/classic/errors.d.ts +30 -0
  374. package/dist/zod/v4/classic/errors.js +41 -0
  375. package/dist/zod/v4/classic/external.cjs +70 -0
  376. package/dist/zod/v4/classic/external.d.cts +13 -0
  377. package/dist/zod/v4/classic/external.d.ts +13 -0
  378. package/dist/zod/v4/classic/external.js +18 -0
  379. package/dist/zod/v4/classic/index.cjs +33 -0
  380. package/dist/zod/v4/classic/index.d.cts +4 -0
  381. package/dist/zod/v4/classic/index.d.ts +4 -0
  382. package/dist/zod/v4/classic/index.js +4 -0
  383. package/dist/zod/v4/classic/iso.cjs +60 -0
  384. package/dist/zod/v4/classic/iso.d.cts +22 -0
  385. package/dist/zod/v4/classic/iso.d.ts +22 -0
  386. package/dist/zod/v4/classic/iso.js +30 -0
  387. package/dist/zod/v4/classic/parse.cjs +32 -0
  388. package/dist/zod/v4/classic/parse.d.cts +23 -0
  389. package/dist/zod/v4/classic/parse.d.ts +23 -0
  390. package/dist/zod/v4/classic/parse.js +6 -0
  391. package/dist/zod/v4/classic/schemas.cjs +1109 -0
  392. package/dist/zod/v4/classic/schemas.d.cts +630 -0
  393. package/dist/zod/v4/classic/schemas.d.ts +630 -0
  394. package/dist/zod/v4/classic/schemas.js +1006 -0
  395. package/dist/zod/v4/core/api.cjs +1039 -0
  396. package/dist/zod/v4/core/api.d.cts +284 -0
  397. package/dist/zod/v4/core/api.d.ts +284 -0
  398. package/dist/zod/v4/core/api.js +906 -0
  399. package/dist/zod/v4/core/checks.cjs +591 -0
  400. package/dist/zod/v4/core/checks.d.cts +278 -0
  401. package/dist/zod/v4/core/checks.d.ts +278 -0
  402. package/dist/zod/v4/core/checks.js +565 -0
  403. package/dist/zod/v4/core/core.cjs +67 -0
  404. package/dist/zod/v4/core/core.d.cts +49 -0
  405. package/dist/zod/v4/core/core.d.ts +49 -0
  406. package/dist/zod/v4/core/core.js +61 -0
  407. package/dist/zod/v4/core/doc.cjs +39 -0
  408. package/dist/zod/v4/core/doc.d.cts +14 -0
  409. package/dist/zod/v4/core/doc.d.ts +14 -0
  410. package/dist/zod/v4/core/doc.js +35 -0
  411. package/dist/zod/v4/core/errors.cjs +226 -0
  412. package/dist/zod/v4/core/errors.d.cts +208 -0
  413. package/dist/zod/v4/core/errors.d.ts +208 -0
  414. package/dist/zod/v4/core/errors.js +195 -0
  415. package/dist/zod/v4/core/function.cjs +102 -0
  416. package/dist/zod/v4/core/function.d.cts +52 -0
  417. package/dist/zod/v4/core/function.d.ts +52 -0
  418. package/dist/zod/v4/core/function.js +75 -0
  419. package/dist/zod/v4/core/index.cjs +44 -0
  420. package/dist/zod/v4/core/index.d.cts +15 -0
  421. package/dist/zod/v4/core/index.d.ts +15 -0
  422. package/dist/zod/v4/core/index.js +15 -0
  423. package/dist/zod/v4/core/json-schema.cjs +2 -0
  424. package/dist/zod/v4/core/json-schema.d.cts +87 -0
  425. package/dist/zod/v4/core/json-schema.d.ts +87 -0
  426. package/dist/zod/v4/core/json-schema.js +1 -0
  427. package/dist/zod/v4/core/parse.cjs +87 -0
  428. package/dist/zod/v4/core/parse.d.cts +25 -0
  429. package/dist/zod/v4/core/parse.d.ts +25 -0
  430. package/dist/zod/v4/core/parse.js +57 -0
  431. package/dist/zod/v4/core/regexes.cjs +103 -0
  432. package/dist/zod/v4/core/regexes.d.cts +62 -0
  433. package/dist/zod/v4/core/regexes.d.ts +62 -0
  434. package/dist/zod/v4/core/regexes.js +95 -0
  435. package/dist/zod/v4/core/registries.cjs +56 -0
  436. package/dist/zod/v4/core/registries.d.cts +35 -0
  437. package/dist/zod/v4/core/registries.d.ts +35 -0
  438. package/dist/zod/v4/core/registries.js +51 -0
  439. package/dist/zod/v4/core/schemas.cjs +1748 -0
  440. package/dist/zod/v4/core/schemas.d.cts +1041 -0
  441. package/dist/zod/v4/core/schemas.d.ts +1041 -0
  442. package/dist/zod/v4/core/schemas.js +1717 -0
  443. package/dist/zod/v4/core/standard-schema.cjs +2 -0
  444. package/dist/zod/v4/core/standard-schema.d.cts +55 -0
  445. package/dist/zod/v4/core/standard-schema.d.ts +55 -0
  446. package/dist/zod/v4/core/standard-schema.js +1 -0
  447. package/dist/zod/v4/core/to-json-schema.cjs +854 -0
  448. package/dist/zod/v4/core/to-json-schema.d.cts +88 -0
  449. package/dist/zod/v4/core/to-json-schema.d.ts +88 -0
  450. package/dist/zod/v4/core/to-json-schema.js +849 -0
  451. package/dist/zod/v4/core/util.cjs +539 -0
  452. package/dist/zod/v4/core/util.d.cts +183 -0
  453. package/dist/zod/v4/core/util.d.ts +183 -0
  454. package/dist/zod/v4/core/util.js +493 -0
  455. package/dist/zod/v4/core/versions.cjs +8 -0
  456. package/dist/zod/v4/core/versions.d.cts +5 -0
  457. package/dist/zod/v4/core/versions.d.ts +5 -0
  458. package/dist/zod/v4/core/versions.js +5 -0
  459. package/dist/zod/v4/index.cjs +22 -0
  460. package/dist/zod/v4/index.d.cts +3 -0
  461. package/dist/zod/v4/index.d.ts +3 -0
  462. package/dist/zod/v4/index.js +3 -0
  463. package/dist/zod/v4/locales/ar.cjs +142 -0
  464. package/dist/zod/v4/locales/ar.d.cts +4 -0
  465. package/dist/zod/v4/locales/ar.d.ts +4 -0
  466. package/dist/zod/v4/locales/ar.js +116 -0
  467. package/dist/zod/v4/locales/az.cjs +141 -0
  468. package/dist/zod/v4/locales/az.d.cts +4 -0
  469. package/dist/zod/v4/locales/az.d.ts +4 -0
  470. package/dist/zod/v4/locales/az.js +115 -0
  471. package/dist/zod/v4/locales/be.cjs +190 -0
  472. package/dist/zod/v4/locales/be.d.cts +4 -0
  473. package/dist/zod/v4/locales/be.d.ts +4 -0
  474. package/dist/zod/v4/locales/be.js +164 -0
  475. package/dist/zod/v4/locales/ca.cjs +144 -0
  476. package/dist/zod/v4/locales/ca.d.cts +4 -0
  477. package/dist/zod/v4/locales/ca.d.ts +4 -0
  478. package/dist/zod/v4/locales/ca.js +118 -0
  479. package/dist/zod/v4/locales/cs.cjs +161 -0
  480. package/dist/zod/v4/locales/cs.d.cts +4 -0
  481. package/dist/zod/v4/locales/cs.d.ts +4 -0
  482. package/dist/zod/v4/locales/cs.js +135 -0
  483. package/dist/zod/v4/locales/de.cjs +142 -0
  484. package/dist/zod/v4/locales/de.d.cts +4 -0
  485. package/dist/zod/v4/locales/de.d.ts +4 -0
  486. package/dist/zod/v4/locales/de.js +116 -0
  487. package/dist/zod/v4/locales/en.cjs +145 -0
  488. package/dist/zod/v4/locales/en.d.cts +5 -0
  489. package/dist/zod/v4/locales/en.d.ts +5 -0
  490. package/dist/zod/v4/locales/en.js +117 -0
  491. package/dist/zod/v4/locales/eo.cjs +144 -0
  492. package/dist/zod/v4/locales/eo.d.cts +5 -0
  493. package/dist/zod/v4/locales/eo.d.ts +5 -0
  494. package/dist/zod/v4/locales/eo.js +116 -0
  495. package/dist/zod/v4/locales/es.cjs +143 -0
  496. package/dist/zod/v4/locales/es.d.cts +4 -0
  497. package/dist/zod/v4/locales/es.d.ts +4 -0
  498. package/dist/zod/v4/locales/es.js +117 -0
  499. package/dist/zod/v4/locales/fa.cjs +148 -0
  500. package/dist/zod/v4/locales/fa.d.cts +4 -0
  501. package/dist/zod/v4/locales/fa.d.ts +4 -0
  502. package/dist/zod/v4/locales/fa.js +122 -0
  503. package/dist/zod/v4/locales/fi.cjs +148 -0
  504. package/dist/zod/v4/locales/fi.d.cts +4 -0
  505. package/dist/zod/v4/locales/fi.d.ts +4 -0
  506. package/dist/zod/v4/locales/fi.js +122 -0
  507. package/dist/zod/v4/locales/fr-CA.cjs +143 -0
  508. package/dist/zod/v4/locales/fr-CA.d.cts +4 -0
  509. package/dist/zod/v4/locales/fr-CA.d.ts +4 -0
  510. package/dist/zod/v4/locales/fr-CA.js +117 -0
  511. package/dist/zod/v4/locales/fr.cjs +142 -0
  512. package/dist/zod/v4/locales/fr.d.cts +4 -0
  513. package/dist/zod/v4/locales/fr.d.ts +4 -0
  514. package/dist/zod/v4/locales/fr.js +116 -0
  515. package/dist/zod/v4/locales/he.cjs +143 -0
  516. package/dist/zod/v4/locales/he.d.cts +4 -0
  517. package/dist/zod/v4/locales/he.d.ts +4 -0
  518. package/dist/zod/v4/locales/he.js +117 -0
  519. package/dist/zod/v4/locales/hu.cjs +143 -0
  520. package/dist/zod/v4/locales/hu.d.cts +4 -0
  521. package/dist/zod/v4/locales/hu.d.ts +4 -0
  522. package/dist/zod/v4/locales/hu.js +117 -0
  523. package/dist/zod/v4/locales/id.cjs +142 -0
  524. package/dist/zod/v4/locales/id.d.cts +4 -0
  525. package/dist/zod/v4/locales/id.d.ts +4 -0
  526. package/dist/zod/v4/locales/id.js +116 -0
  527. package/dist/zod/v4/locales/index.cjs +84 -0
  528. package/dist/zod/v4/locales/index.d.cts +39 -0
  529. package/dist/zod/v4/locales/index.d.ts +39 -0
  530. package/dist/zod/v4/locales/index.js +39 -0
  531. package/dist/zod/v4/locales/it.cjs +143 -0
  532. package/dist/zod/v4/locales/it.d.cts +4 -0
  533. package/dist/zod/v4/locales/it.d.ts +4 -0
  534. package/dist/zod/v4/locales/it.js +117 -0
  535. package/dist/zod/v4/locales/ja.cjs +141 -0
  536. package/dist/zod/v4/locales/ja.d.cts +4 -0
  537. package/dist/zod/v4/locales/ja.d.ts +4 -0
  538. package/dist/zod/v4/locales/ja.js +115 -0
  539. package/dist/zod/v4/locales/kh.cjs +143 -0
  540. package/dist/zod/v4/locales/kh.d.cts +4 -0
  541. package/dist/zod/v4/locales/kh.d.ts +4 -0
  542. package/dist/zod/v4/locales/kh.js +117 -0
  543. package/dist/zod/v4/locales/ko.cjs +147 -0
  544. package/dist/zod/v4/locales/ko.d.cts +4 -0
  545. package/dist/zod/v4/locales/ko.d.ts +4 -0
  546. package/dist/zod/v4/locales/ko.js +121 -0
  547. package/dist/zod/v4/locales/mk.cjs +144 -0
  548. package/dist/zod/v4/locales/mk.d.cts +4 -0
  549. package/dist/zod/v4/locales/mk.d.ts +4 -0
  550. package/dist/zod/v4/locales/mk.js +118 -0
  551. package/dist/zod/v4/locales/ms.cjs +142 -0
  552. package/dist/zod/v4/locales/ms.d.cts +4 -0
  553. package/dist/zod/v4/locales/ms.d.ts +4 -0
  554. package/dist/zod/v4/locales/ms.js +116 -0
  555. package/dist/zod/v4/locales/nl.cjs +143 -0
  556. package/dist/zod/v4/locales/nl.d.cts +4 -0
  557. package/dist/zod/v4/locales/nl.d.ts +4 -0
  558. package/dist/zod/v4/locales/nl.js +117 -0
  559. package/dist/zod/v4/locales/no.cjs +142 -0
  560. package/dist/zod/v4/locales/no.d.cts +4 -0
  561. package/dist/zod/v4/locales/no.d.ts +4 -0
  562. package/dist/zod/v4/locales/no.js +116 -0
  563. package/dist/zod/v4/locales/ota.cjs +143 -0
  564. package/dist/zod/v4/locales/ota.d.cts +4 -0
  565. package/dist/zod/v4/locales/ota.d.ts +4 -0
  566. package/dist/zod/v4/locales/ota.js +117 -0
  567. package/dist/zod/v4/locales/pl.cjs +143 -0
  568. package/dist/zod/v4/locales/pl.d.cts +4 -0
  569. package/dist/zod/v4/locales/pl.d.ts +4 -0
  570. package/dist/zod/v4/locales/pl.js +117 -0
  571. package/dist/zod/v4/locales/ps.cjs +148 -0
  572. package/dist/zod/v4/locales/ps.d.cts +4 -0
  573. package/dist/zod/v4/locales/ps.d.ts +4 -0
  574. package/dist/zod/v4/locales/ps.js +122 -0
  575. package/dist/zod/v4/locales/pt.cjs +142 -0
  576. package/dist/zod/v4/locales/pt.d.cts +4 -0
  577. package/dist/zod/v4/locales/pt.d.ts +4 -0
  578. package/dist/zod/v4/locales/pt.js +116 -0
  579. package/dist/zod/v4/locales/ru.cjs +190 -0
  580. package/dist/zod/v4/locales/ru.d.cts +4 -0
  581. package/dist/zod/v4/locales/ru.d.ts +4 -0
  582. package/dist/zod/v4/locales/ru.js +164 -0
  583. package/dist/zod/v4/locales/sl.cjs +143 -0
  584. package/dist/zod/v4/locales/sl.d.cts +4 -0
  585. package/dist/zod/v4/locales/sl.d.ts +4 -0
  586. package/dist/zod/v4/locales/sl.js +117 -0
  587. package/dist/zod/v4/locales/sv.cjs +144 -0
  588. package/dist/zod/v4/locales/sv.d.cts +4 -0
  589. package/dist/zod/v4/locales/sv.d.ts +4 -0
  590. package/dist/zod/v4/locales/sv.js +118 -0
  591. package/dist/zod/v4/locales/ta.cjs +143 -0
  592. package/dist/zod/v4/locales/ta.d.cts +4 -0
  593. package/dist/zod/v4/locales/ta.d.ts +4 -0
  594. package/dist/zod/v4/locales/ta.js +117 -0
  595. package/dist/zod/v4/locales/th.cjs +143 -0
  596. package/dist/zod/v4/locales/th.d.cts +4 -0
  597. package/dist/zod/v4/locales/th.d.ts +4 -0
  598. package/dist/zod/v4/locales/th.js +117 -0
  599. package/dist/zod/v4/locales/tr.cjs +143 -0
  600. package/dist/zod/v4/locales/tr.d.cts +5 -0
  601. package/dist/zod/v4/locales/tr.d.ts +5 -0
  602. package/dist/zod/v4/locales/tr.js +115 -0
  603. package/dist/zod/v4/locales/ua.cjs +143 -0
  604. package/dist/zod/v4/locales/ua.d.cts +4 -0
  605. package/dist/zod/v4/locales/ua.d.ts +4 -0
  606. package/dist/zod/v4/locales/ua.js +117 -0
  607. package/dist/zod/v4/locales/ur.cjs +143 -0
  608. package/dist/zod/v4/locales/ur.d.cts +4 -0
  609. package/dist/zod/v4/locales/ur.d.ts +4 -0
  610. package/dist/zod/v4/locales/ur.js +117 -0
  611. package/dist/zod/v4/locales/vi.cjs +142 -0
  612. package/dist/zod/v4/locales/vi.d.cts +4 -0
  613. package/dist/zod/v4/locales/vi.d.ts +4 -0
  614. package/dist/zod/v4/locales/vi.js +116 -0
  615. package/dist/zod/v4/locales/zh-CN.cjs +142 -0
  616. package/dist/zod/v4/locales/zh-CN.d.cts +4 -0
  617. package/dist/zod/v4/locales/zh-CN.d.ts +4 -0
  618. package/dist/zod/v4/locales/zh-CN.js +116 -0
  619. package/dist/zod/v4/locales/zh-TW.cjs +143 -0
  620. package/dist/zod/v4/locales/zh-TW.d.cts +4 -0
  621. package/dist/zod/v4/locales/zh-TW.d.ts +4 -0
  622. package/dist/zod/v4/locales/zh-TW.js +117 -0
  623. package/dist/zod/v4/mini/checks.cjs +34 -0
  624. package/dist/zod/v4/mini/checks.d.cts +1 -0
  625. package/dist/zod/v4/mini/checks.d.ts +1 -0
  626. package/dist/zod/v4/mini/checks.js +1 -0
  627. package/dist/zod/v4/mini/coerce.cjs +47 -0
  628. package/dist/zod/v4/mini/coerce.d.cts +7 -0
  629. package/dist/zod/v4/mini/coerce.d.ts +7 -0
  630. package/dist/zod/v4/mini/coerce.js +17 -0
  631. package/dist/zod/v4/mini/external.cjs +62 -0
  632. package/dist/zod/v4/mini/external.d.cts +11 -0
  633. package/dist/zod/v4/mini/external.d.ts +11 -0
  634. package/dist/zod/v4/mini/external.js +13 -0
  635. package/dist/zod/v4/mini/index.cjs +32 -0
  636. package/dist/zod/v4/mini/index.d.cts +3 -0
  637. package/dist/zod/v4/mini/index.d.ts +3 -0
  638. package/dist/zod/v4/mini/index.js +3 -0
  639. package/dist/zod/v4/mini/iso.cjs +60 -0
  640. package/dist/zod/v4/mini/iso.d.cts +22 -0
  641. package/dist/zod/v4/mini/iso.d.ts +22 -0
  642. package/dist/zod/v4/mini/iso.js +30 -0
  643. package/dist/zod/v4/mini/parse.cjs +8 -0
  644. package/dist/zod/v4/mini/parse.d.cts +1 -0
  645. package/dist/zod/v4/mini/parse.d.ts +1 -0
  646. package/dist/zod/v4/mini/parse.js +1 -0
  647. package/dist/zod/v4/mini/schemas.cjs +839 -0
  648. package/dist/zod/v4/mini/schemas.d.cts +356 -0
  649. package/dist/zod/v4/mini/schemas.d.ts +356 -0
  650. package/dist/zod/v4/mini/schemas.js +732 -0
  651. package/dist/zod/v4-mini/index.cjs +17 -0
  652. package/dist/zod/v4-mini/index.d.cts +1 -0
  653. package/dist/zod/v4-mini/index.d.ts +1 -0
  654. package/dist/zod/v4-mini/index.js +1 -0
  655. package/package.json +42 -0
  656. package/scripts/postinstall.js +75 -0
@@ -0,0 +1,1748 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodUnion = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
27
+ exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = void 0;
28
+ exports.isValidBase64 = isValidBase64;
29
+ exports.isValidBase64URL = isValidBase64URL;
30
+ exports.isValidJWT = isValidJWT;
31
+ const checks = __importStar(require("./checks.cjs"));
32
+ const core = __importStar(require("./core.cjs"));
33
+ const doc_js_1 = require("./doc.cjs");
34
+ const parse_js_1 = require("./parse.cjs");
35
+ const regexes = __importStar(require("./regexes.cjs"));
36
+ const util = __importStar(require("./util.cjs"));
37
+ const versions_js_1 = require("./versions.cjs");
38
+ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
39
+ var _a;
40
+ inst ?? (inst = {});
41
+ inst._zod.def = def; // set _def property
42
+ inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
43
+ inst._zod.version = versions_js_1.version;
44
+ const checks = [...(inst._zod.def.checks ?? [])];
45
+ // if inst is itself a checks.$ZodCheck, run it as a check
46
+ if (inst._zod.traits.has("$ZodCheck")) {
47
+ checks.unshift(inst);
48
+ }
49
+ //
50
+ for (const ch of checks) {
51
+ for (const fn of ch._zod.onattach) {
52
+ fn(inst);
53
+ }
54
+ }
55
+ if (checks.length === 0) {
56
+ // deferred initializer
57
+ // inst._zod.parse is not yet defined
58
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
59
+ inst._zod.deferred?.push(() => {
60
+ inst._zod.run = inst._zod.parse;
61
+ });
62
+ }
63
+ else {
64
+ const runChecks = (payload, checks, ctx) => {
65
+ let isAborted = util.aborted(payload);
66
+ let asyncResult;
67
+ for (const ch of checks) {
68
+ if (ch._zod.def.when) {
69
+ const shouldRun = ch._zod.def.when(payload);
70
+ if (!shouldRun)
71
+ continue;
72
+ }
73
+ else if (isAborted) {
74
+ continue;
75
+ }
76
+ const currLen = payload.issues.length;
77
+ const _ = ch._zod.check(payload);
78
+ if (_ instanceof Promise && ctx?.async === false) {
79
+ throw new core.$ZodAsyncError();
80
+ }
81
+ if (asyncResult || _ instanceof Promise) {
82
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
83
+ await _;
84
+ const nextLen = payload.issues.length;
85
+ if (nextLen === currLen)
86
+ return;
87
+ if (!isAborted)
88
+ isAborted = util.aborted(payload, currLen);
89
+ });
90
+ }
91
+ else {
92
+ const nextLen = payload.issues.length;
93
+ if (nextLen === currLen)
94
+ continue;
95
+ if (!isAborted)
96
+ isAborted = util.aborted(payload, currLen);
97
+ }
98
+ }
99
+ if (asyncResult) {
100
+ return asyncResult.then(() => {
101
+ return payload;
102
+ });
103
+ }
104
+ return payload;
105
+ };
106
+ inst._zod.run = (payload, ctx) => {
107
+ const result = inst._zod.parse(payload, ctx);
108
+ if (result instanceof Promise) {
109
+ if (ctx.async === false)
110
+ throw new core.$ZodAsyncError();
111
+ return result.then((result) => runChecks(result, checks, ctx));
112
+ }
113
+ return runChecks(result, checks, ctx);
114
+ };
115
+ }
116
+ inst["~standard"] = {
117
+ validate: (value) => {
118
+ try {
119
+ const r = (0, parse_js_1.safeParse)(inst, value);
120
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
121
+ }
122
+ catch (_) {
123
+ return (0, parse_js_1.safeParseAsync)(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
124
+ }
125
+ },
126
+ vendor: "zod",
127
+ version: 1,
128
+ };
129
+ });
130
+ var util_js_1 = require("./util.cjs");
131
+ Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
132
+ exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
133
+ exports.$ZodType.init(inst, def);
134
+ inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
135
+ inst._zod.parse = (payload, _) => {
136
+ if (def.coerce)
137
+ try {
138
+ payload.value = String(payload.value);
139
+ }
140
+ catch (_) { }
141
+ if (typeof payload.value === "string")
142
+ return payload;
143
+ payload.issues.push({
144
+ expected: "string",
145
+ code: "invalid_type",
146
+ input: payload.value,
147
+ inst,
148
+ });
149
+ return payload;
150
+ };
151
+ });
152
+ exports.$ZodStringFormat = core.$constructor("$ZodStringFormat", (inst, def) => {
153
+ // check initialization must come first
154
+ checks.$ZodCheckStringFormat.init(inst, def);
155
+ exports.$ZodString.init(inst, def);
156
+ });
157
+ exports.$ZodGUID = core.$constructor("$ZodGUID", (inst, def) => {
158
+ def.pattern ?? (def.pattern = regexes.guid);
159
+ exports.$ZodStringFormat.init(inst, def);
160
+ });
161
+ exports.$ZodUUID = core.$constructor("$ZodUUID", (inst, def) => {
162
+ if (def.version) {
163
+ const versionMap = {
164
+ v1: 1,
165
+ v2: 2,
166
+ v3: 3,
167
+ v4: 4,
168
+ v5: 5,
169
+ v6: 6,
170
+ v7: 7,
171
+ v8: 8,
172
+ };
173
+ const v = versionMap[def.version];
174
+ if (v === undefined)
175
+ throw new Error(`Invalid UUID version: "${def.version}"`);
176
+ def.pattern ?? (def.pattern = regexes.uuid(v));
177
+ }
178
+ else
179
+ def.pattern ?? (def.pattern = regexes.uuid());
180
+ exports.$ZodStringFormat.init(inst, def);
181
+ });
182
+ exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
183
+ def.pattern ?? (def.pattern = regexes.email);
184
+ exports.$ZodStringFormat.init(inst, def);
185
+ });
186
+ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
187
+ exports.$ZodStringFormat.init(inst, def);
188
+ inst._zod.check = (payload) => {
189
+ try {
190
+ const orig = payload.value;
191
+ const url = new URL(orig);
192
+ const href = url.href;
193
+ if (def.hostname) {
194
+ def.hostname.lastIndex = 0;
195
+ if (!def.hostname.test(url.hostname)) {
196
+ payload.issues.push({
197
+ code: "invalid_format",
198
+ format: "url",
199
+ note: "Invalid hostname",
200
+ pattern: regexes.hostname.source,
201
+ input: payload.value,
202
+ inst,
203
+ continue: !def.abort,
204
+ });
205
+ }
206
+ }
207
+ if (def.protocol) {
208
+ def.protocol.lastIndex = 0;
209
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
210
+ payload.issues.push({
211
+ code: "invalid_format",
212
+ format: "url",
213
+ note: "Invalid protocol",
214
+ pattern: def.protocol.source,
215
+ input: payload.value,
216
+ inst,
217
+ continue: !def.abort,
218
+ });
219
+ }
220
+ }
221
+ // payload.value = url.href;
222
+ if (!orig.endsWith("/") && href.endsWith("/")) {
223
+ payload.value = href.slice(0, -1);
224
+ }
225
+ else {
226
+ payload.value = href;
227
+ }
228
+ return;
229
+ }
230
+ catch (_) {
231
+ payload.issues.push({
232
+ code: "invalid_format",
233
+ format: "url",
234
+ input: payload.value,
235
+ inst,
236
+ continue: !def.abort,
237
+ });
238
+ }
239
+ };
240
+ });
241
+ exports.$ZodEmoji = core.$constructor("$ZodEmoji", (inst, def) => {
242
+ def.pattern ?? (def.pattern = regexes.emoji());
243
+ exports.$ZodStringFormat.init(inst, def);
244
+ });
245
+ exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
246
+ def.pattern ?? (def.pattern = regexes.nanoid);
247
+ exports.$ZodStringFormat.init(inst, def);
248
+ });
249
+ exports.$ZodCUID = core.$constructor("$ZodCUID", (inst, def) => {
250
+ def.pattern ?? (def.pattern = regexes.cuid);
251
+ exports.$ZodStringFormat.init(inst, def);
252
+ });
253
+ exports.$ZodCUID2 = core.$constructor("$ZodCUID2", (inst, def) => {
254
+ def.pattern ?? (def.pattern = regexes.cuid2);
255
+ exports.$ZodStringFormat.init(inst, def);
256
+ });
257
+ exports.$ZodULID = core.$constructor("$ZodULID", (inst, def) => {
258
+ def.pattern ?? (def.pattern = regexes.ulid);
259
+ exports.$ZodStringFormat.init(inst, def);
260
+ });
261
+ exports.$ZodXID = core.$constructor("$ZodXID", (inst, def) => {
262
+ def.pattern ?? (def.pattern = regexes.xid);
263
+ exports.$ZodStringFormat.init(inst, def);
264
+ });
265
+ exports.$ZodKSUID = core.$constructor("$ZodKSUID", (inst, def) => {
266
+ def.pattern ?? (def.pattern = regexes.ksuid);
267
+ exports.$ZodStringFormat.init(inst, def);
268
+ });
269
+ exports.$ZodISODateTime = core.$constructor("$ZodISODateTime", (inst, def) => {
270
+ def.pattern ?? (def.pattern = regexes.datetime(def));
271
+ exports.$ZodStringFormat.init(inst, def);
272
+ });
273
+ exports.$ZodISODate = core.$constructor("$ZodISODate", (inst, def) => {
274
+ def.pattern ?? (def.pattern = regexes.date);
275
+ exports.$ZodStringFormat.init(inst, def);
276
+ });
277
+ exports.$ZodISOTime = core.$constructor("$ZodISOTime", (inst, def) => {
278
+ def.pattern ?? (def.pattern = regexes.time(def));
279
+ exports.$ZodStringFormat.init(inst, def);
280
+ });
281
+ exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
282
+ def.pattern ?? (def.pattern = regexes.duration);
283
+ exports.$ZodStringFormat.init(inst, def);
284
+ });
285
+ exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
286
+ def.pattern ?? (def.pattern = regexes.ipv4);
287
+ exports.$ZodStringFormat.init(inst, def);
288
+ inst._zod.onattach.push((inst) => {
289
+ const bag = inst._zod.bag;
290
+ bag.format = `ipv4`;
291
+ });
292
+ });
293
+ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
294
+ def.pattern ?? (def.pattern = regexes.ipv6);
295
+ exports.$ZodStringFormat.init(inst, def);
296
+ inst._zod.onattach.push((inst) => {
297
+ const bag = inst._zod.bag;
298
+ bag.format = `ipv6`;
299
+ });
300
+ inst._zod.check = (payload) => {
301
+ try {
302
+ new URL(`http://[${payload.value}]`);
303
+ // return;
304
+ }
305
+ catch {
306
+ payload.issues.push({
307
+ code: "invalid_format",
308
+ format: "ipv6",
309
+ input: payload.value,
310
+ inst,
311
+ continue: !def.abort,
312
+ });
313
+ }
314
+ };
315
+ });
316
+ exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
317
+ def.pattern ?? (def.pattern = regexes.cidrv4);
318
+ exports.$ZodStringFormat.init(inst, def);
319
+ });
320
+ exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
321
+ def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
322
+ exports.$ZodStringFormat.init(inst, def);
323
+ inst._zod.check = (payload) => {
324
+ const [address, prefix] = payload.value.split("/");
325
+ try {
326
+ if (!prefix)
327
+ throw new Error();
328
+ const prefixNum = Number(prefix);
329
+ if (`${prefixNum}` !== prefix)
330
+ throw new Error();
331
+ if (prefixNum < 0 || prefixNum > 128)
332
+ throw new Error();
333
+ new URL(`http://[${address}]`);
334
+ }
335
+ catch {
336
+ payload.issues.push({
337
+ code: "invalid_format",
338
+ format: "cidrv6",
339
+ input: payload.value,
340
+ inst,
341
+ continue: !def.abort,
342
+ });
343
+ }
344
+ };
345
+ });
346
+ ////////////////////////////// ZodBase64 //////////////////////////////
347
+ function isValidBase64(data) {
348
+ if (data === "")
349
+ return true;
350
+ if (data.length % 4 !== 0)
351
+ return false;
352
+ try {
353
+ atob(data);
354
+ return true;
355
+ }
356
+ catch {
357
+ return false;
358
+ }
359
+ }
360
+ exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
361
+ def.pattern ?? (def.pattern = regexes.base64);
362
+ exports.$ZodStringFormat.init(inst, def);
363
+ inst._zod.onattach.push((inst) => {
364
+ inst._zod.bag.contentEncoding = "base64";
365
+ });
366
+ inst._zod.check = (payload) => {
367
+ if (isValidBase64(payload.value))
368
+ return;
369
+ payload.issues.push({
370
+ code: "invalid_format",
371
+ format: "base64",
372
+ input: payload.value,
373
+ inst,
374
+ continue: !def.abort,
375
+ });
376
+ };
377
+ });
378
+ ////////////////////////////// ZodBase64 //////////////////////////////
379
+ function isValidBase64URL(data) {
380
+ if (!regexes.base64url.test(data))
381
+ return false;
382
+ const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
383
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
384
+ return isValidBase64(padded);
385
+ }
386
+ exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
387
+ def.pattern ?? (def.pattern = regexes.base64url);
388
+ exports.$ZodStringFormat.init(inst, def);
389
+ inst._zod.onattach.push((inst) => {
390
+ inst._zod.bag.contentEncoding = "base64url";
391
+ });
392
+ inst._zod.check = (payload) => {
393
+ if (isValidBase64URL(payload.value))
394
+ return;
395
+ payload.issues.push({
396
+ code: "invalid_format",
397
+ format: "base64url",
398
+ input: payload.value,
399
+ inst,
400
+ continue: !def.abort,
401
+ });
402
+ };
403
+ });
404
+ exports.$ZodE164 = core.$constructor("$ZodE164", (inst, def) => {
405
+ def.pattern ?? (def.pattern = regexes.e164);
406
+ exports.$ZodStringFormat.init(inst, def);
407
+ });
408
+ ////////////////////////////// ZodJWT //////////////////////////////
409
+ function isValidJWT(token, algorithm = null) {
410
+ try {
411
+ const tokensParts = token.split(".");
412
+ if (tokensParts.length !== 3)
413
+ return false;
414
+ const [header] = tokensParts;
415
+ if (!header)
416
+ return false;
417
+ const parsedHeader = JSON.parse(atob(header));
418
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
419
+ return false;
420
+ if (!parsedHeader.alg)
421
+ return false;
422
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
423
+ return false;
424
+ return true;
425
+ }
426
+ catch {
427
+ return false;
428
+ }
429
+ }
430
+ exports.$ZodJWT = core.$constructor("$ZodJWT", (inst, def) => {
431
+ exports.$ZodStringFormat.init(inst, def);
432
+ inst._zod.check = (payload) => {
433
+ if (isValidJWT(payload.value, def.alg))
434
+ return;
435
+ payload.issues.push({
436
+ code: "invalid_format",
437
+ format: "jwt",
438
+ input: payload.value,
439
+ inst,
440
+ continue: !def.abort,
441
+ });
442
+ };
443
+ });
444
+ exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (inst, def) => {
445
+ exports.$ZodStringFormat.init(inst, def);
446
+ inst._zod.check = (payload) => {
447
+ if (def.fn(payload.value))
448
+ return;
449
+ payload.issues.push({
450
+ code: "invalid_format",
451
+ format: def.format,
452
+ input: payload.value,
453
+ inst,
454
+ continue: !def.abort,
455
+ });
456
+ };
457
+ });
458
+ exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
459
+ exports.$ZodType.init(inst, def);
460
+ inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
461
+ inst._zod.parse = (payload, _ctx) => {
462
+ if (def.coerce)
463
+ try {
464
+ payload.value = Number(payload.value);
465
+ }
466
+ catch (_) { }
467
+ const input = payload.value;
468
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
469
+ return payload;
470
+ }
471
+ const received = typeof input === "number"
472
+ ? Number.isNaN(input)
473
+ ? "NaN"
474
+ : !Number.isFinite(input)
475
+ ? "Infinity"
476
+ : undefined
477
+ : undefined;
478
+ payload.issues.push({
479
+ expected: "number",
480
+ code: "invalid_type",
481
+ input,
482
+ inst,
483
+ ...(received ? { received } : {}),
484
+ });
485
+ return payload;
486
+ };
487
+ });
488
+ exports.$ZodNumberFormat = core.$constructor("$ZodNumber", (inst, def) => {
489
+ checks.$ZodCheckNumberFormat.init(inst, def);
490
+ exports.$ZodNumber.init(inst, def); // no format checksp
491
+ });
492
+ exports.$ZodBoolean = core.$constructor("$ZodBoolean", (inst, def) => {
493
+ exports.$ZodType.init(inst, def);
494
+ inst._zod.pattern = regexes.boolean;
495
+ inst._zod.parse = (payload, _ctx) => {
496
+ if (def.coerce)
497
+ try {
498
+ payload.value = Boolean(payload.value);
499
+ }
500
+ catch (_) { }
501
+ const input = payload.value;
502
+ if (typeof input === "boolean")
503
+ return payload;
504
+ payload.issues.push({
505
+ expected: "boolean",
506
+ code: "invalid_type",
507
+ input,
508
+ inst,
509
+ });
510
+ return payload;
511
+ };
512
+ });
513
+ exports.$ZodBigInt = core.$constructor("$ZodBigInt", (inst, def) => {
514
+ exports.$ZodType.init(inst, def);
515
+ inst._zod.pattern = regexes.bigint;
516
+ inst._zod.parse = (payload, _ctx) => {
517
+ if (def.coerce)
518
+ try {
519
+ payload.value = BigInt(payload.value);
520
+ }
521
+ catch (_) { }
522
+ if (typeof payload.value === "bigint")
523
+ return payload;
524
+ payload.issues.push({
525
+ expected: "bigint",
526
+ code: "invalid_type",
527
+ input: payload.value,
528
+ inst,
529
+ });
530
+ return payload;
531
+ };
532
+ });
533
+ exports.$ZodBigIntFormat = core.$constructor("$ZodBigInt", (inst, def) => {
534
+ checks.$ZodCheckBigIntFormat.init(inst, def);
535
+ exports.$ZodBigInt.init(inst, def); // no format checks
536
+ });
537
+ exports.$ZodSymbol = core.$constructor("$ZodSymbol", (inst, def) => {
538
+ exports.$ZodType.init(inst, def);
539
+ inst._zod.parse = (payload, _ctx) => {
540
+ const input = payload.value;
541
+ if (typeof input === "symbol")
542
+ return payload;
543
+ payload.issues.push({
544
+ expected: "symbol",
545
+ code: "invalid_type",
546
+ input,
547
+ inst,
548
+ });
549
+ return payload;
550
+ };
551
+ });
552
+ exports.$ZodUndefined = core.$constructor("$ZodUndefined", (inst, def) => {
553
+ exports.$ZodType.init(inst, def);
554
+ inst._zod.pattern = regexes.undefined;
555
+ inst._zod.values = new Set([undefined]);
556
+ inst._zod.optin = "optional";
557
+ inst._zod.optout = "optional";
558
+ inst._zod.parse = (payload, _ctx) => {
559
+ const input = payload.value;
560
+ if (typeof input === "undefined")
561
+ return payload;
562
+ payload.issues.push({
563
+ expected: "undefined",
564
+ code: "invalid_type",
565
+ input,
566
+ inst,
567
+ });
568
+ return payload;
569
+ };
570
+ });
571
+ exports.$ZodNull = core.$constructor("$ZodNull", (inst, def) => {
572
+ exports.$ZodType.init(inst, def);
573
+ inst._zod.pattern = regexes.null;
574
+ inst._zod.values = new Set([null]);
575
+ inst._zod.parse = (payload, _ctx) => {
576
+ const input = payload.value;
577
+ if (input === null)
578
+ return payload;
579
+ payload.issues.push({
580
+ expected: "null",
581
+ code: "invalid_type",
582
+ input,
583
+ inst,
584
+ });
585
+ return payload;
586
+ };
587
+ });
588
+ exports.$ZodAny = core.$constructor("$ZodAny", (inst, def) => {
589
+ exports.$ZodType.init(inst, def);
590
+ inst._zod.parse = (payload) => payload;
591
+ });
592
+ exports.$ZodUnknown = core.$constructor("$ZodUnknown", (inst, def) => {
593
+ exports.$ZodType.init(inst, def);
594
+ inst._zod.parse = (payload) => payload;
595
+ });
596
+ exports.$ZodNever = core.$constructor("$ZodNever", (inst, def) => {
597
+ exports.$ZodType.init(inst, def);
598
+ inst._zod.parse = (payload, _ctx) => {
599
+ payload.issues.push({
600
+ expected: "never",
601
+ code: "invalid_type",
602
+ input: payload.value,
603
+ inst,
604
+ });
605
+ return payload;
606
+ };
607
+ });
608
+ exports.$ZodVoid = core.$constructor("$ZodVoid", (inst, def) => {
609
+ exports.$ZodType.init(inst, def);
610
+ inst._zod.parse = (payload, _ctx) => {
611
+ const input = payload.value;
612
+ if (typeof input === "undefined")
613
+ return payload;
614
+ payload.issues.push({
615
+ expected: "void",
616
+ code: "invalid_type",
617
+ input,
618
+ inst,
619
+ });
620
+ return payload;
621
+ };
622
+ });
623
+ exports.$ZodDate = core.$constructor("$ZodDate", (inst, def) => {
624
+ exports.$ZodType.init(inst, def);
625
+ inst._zod.parse = (payload, _ctx) => {
626
+ if (def.coerce) {
627
+ try {
628
+ payload.value = new Date(payload.value);
629
+ }
630
+ catch (_err) { }
631
+ }
632
+ const input = payload.value;
633
+ const isDate = input instanceof Date;
634
+ const isValidDate = isDate && !Number.isNaN(input.getTime());
635
+ if (isValidDate)
636
+ return payload;
637
+ payload.issues.push({
638
+ expected: "date",
639
+ code: "invalid_type",
640
+ input,
641
+ ...(isDate ? { received: "Invalid Date" } : {}),
642
+ inst,
643
+ });
644
+ return payload;
645
+ };
646
+ });
647
+ function handleArrayResult(result, final, index) {
648
+ if (result.issues.length) {
649
+ final.issues.push(...util.prefixIssues(index, result.issues));
650
+ }
651
+ final.value[index] = result.value;
652
+ }
653
+ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
654
+ exports.$ZodType.init(inst, def);
655
+ inst._zod.parse = (payload, ctx) => {
656
+ const input = payload.value;
657
+ if (!Array.isArray(input)) {
658
+ payload.issues.push({
659
+ expected: "array",
660
+ code: "invalid_type",
661
+ input,
662
+ inst,
663
+ });
664
+ return payload;
665
+ }
666
+ payload.value = Array(input.length);
667
+ const proms = [];
668
+ for (let i = 0; i < input.length; i++) {
669
+ const item = input[i];
670
+ const result = def.element._zod.run({
671
+ value: item,
672
+ issues: [],
673
+ }, ctx);
674
+ if (result instanceof Promise) {
675
+ proms.push(result.then((result) => handleArrayResult(result, payload, i)));
676
+ }
677
+ else {
678
+ handleArrayResult(result, payload, i);
679
+ }
680
+ }
681
+ if (proms.length) {
682
+ return Promise.all(proms).then(() => payload);
683
+ }
684
+ return payload; //handleArrayResultsAsync(parseResults, final);
685
+ };
686
+ });
687
+ function handleObjectResult(result, final, key) {
688
+ // if(isOptional)
689
+ if (result.issues.length) {
690
+ final.issues.push(...util.prefixIssues(key, result.issues));
691
+ }
692
+ final.value[key] = result.value;
693
+ }
694
+ function handleOptionalObjectResult(result, final, key, input) {
695
+ if (result.issues.length) {
696
+ // validation failed against value schema
697
+ if (input[key] === undefined) {
698
+ // if input was undefined, ignore the error
699
+ if (key in input) {
700
+ final.value[key] = undefined;
701
+ }
702
+ else {
703
+ final.value[key] = result.value;
704
+ }
705
+ }
706
+ else {
707
+ final.issues.push(...util.prefixIssues(key, result.issues));
708
+ }
709
+ }
710
+ else if (result.value === undefined) {
711
+ // validation returned `undefined`
712
+ if (key in input)
713
+ final.value[key] = undefined;
714
+ }
715
+ else {
716
+ // non-undefined value
717
+ final.value[key] = result.value;
718
+ }
719
+ }
720
+ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
721
+ // requires cast because technically $ZodObject doesn't extend
722
+ exports.$ZodType.init(inst, def);
723
+ const _normalized = util.cached(() => {
724
+ const keys = Object.keys(def.shape);
725
+ for (const k of keys) {
726
+ if (!(def.shape[k] instanceof exports.$ZodType)) {
727
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
728
+ }
729
+ }
730
+ const okeys = util.optionalKeys(def.shape);
731
+ return {
732
+ shape: def.shape,
733
+ keys,
734
+ keySet: new Set(keys),
735
+ numKeys: keys.length,
736
+ optionalKeys: new Set(okeys),
737
+ };
738
+ });
739
+ util.defineLazy(inst._zod, "propValues", () => {
740
+ const shape = def.shape;
741
+ const propValues = {};
742
+ for (const key in shape) {
743
+ const field = shape[key]._zod;
744
+ if (field.values) {
745
+ propValues[key] ?? (propValues[key] = new Set());
746
+ for (const v of field.values)
747
+ propValues[key].add(v);
748
+ }
749
+ }
750
+ return propValues;
751
+ });
752
+ const generateFastpass = (shape) => {
753
+ const doc = new doc_js_1.Doc(["shape", "payload", "ctx"]);
754
+ const normalized = _normalized.value;
755
+ const parseStr = (key) => {
756
+ const k = util.esc(key);
757
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
758
+ };
759
+ doc.write(`const input = payload.value;`);
760
+ const ids = Object.create(null);
761
+ let counter = 0;
762
+ for (const key of normalized.keys) {
763
+ ids[key] = `key_${counter++}`;
764
+ }
765
+ // A: preserve key order {
766
+ doc.write(`const newResult = {}`);
767
+ for (const key of normalized.keys) {
768
+ if (normalized.optionalKeys.has(key)) {
769
+ const id = ids[key];
770
+ doc.write(`const ${id} = ${parseStr(key)};`);
771
+ const k = util.esc(key);
772
+ doc.write(`
773
+ if (${id}.issues.length) {
774
+ if (input[${k}] === undefined) {
775
+ if (${k} in input) {
776
+ newResult[${k}] = undefined;
777
+ }
778
+ } else {
779
+ payload.issues = payload.issues.concat(
780
+ ${id}.issues.map((iss) => ({
781
+ ...iss,
782
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
783
+ }))
784
+ );
785
+ }
786
+ } else if (${id}.value === undefined) {
787
+ if (${k} in input) newResult[${k}] = undefined;
788
+ } else {
789
+ newResult[${k}] = ${id}.value;
790
+ }
791
+ `);
792
+ }
793
+ else {
794
+ const id = ids[key];
795
+ // const id = ids[key];
796
+ doc.write(`const ${id} = ${parseStr(key)};`);
797
+ doc.write(`
798
+ if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
799
+ ...iss,
800
+ path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
801
+ })));`);
802
+ doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
803
+ }
804
+ }
805
+ doc.write(`payload.value = newResult;`);
806
+ doc.write(`return payload;`);
807
+ const fn = doc.compile();
808
+ return (payload, ctx) => fn(shape, payload, ctx);
809
+ };
810
+ let fastpass;
811
+ const isObject = util.isObject;
812
+ const jit = !core.globalConfig.jitless;
813
+ const allowsEval = util.allowsEval;
814
+ const fastEnabled = jit && allowsEval.value; // && !def.catchall;
815
+ const catchall = def.catchall;
816
+ let value;
817
+ inst._zod.parse = (payload, ctx) => {
818
+ value ?? (value = _normalized.value);
819
+ const input = payload.value;
820
+ if (!isObject(input)) {
821
+ payload.issues.push({
822
+ expected: "object",
823
+ code: "invalid_type",
824
+ input,
825
+ inst,
826
+ });
827
+ return payload;
828
+ }
829
+ const proms = [];
830
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
831
+ // always synchronous
832
+ if (!fastpass)
833
+ fastpass = generateFastpass(def.shape);
834
+ payload = fastpass(payload, ctx);
835
+ }
836
+ else {
837
+ payload.value = {};
838
+ const shape = value.shape;
839
+ for (const key of value.keys) {
840
+ const el = shape[key];
841
+ // do not add omitted optional keys
842
+ // if (!(key in input)) {
843
+ // if (optionalKeys.has(key)) continue;
844
+ // payload.issues.push({
845
+ // code: "invalid_type",
846
+ // path: [key],
847
+ // expected: "nonoptional",
848
+ // note: `Missing required key: "${key}"`,
849
+ // input,
850
+ // inst,
851
+ // });
852
+ // }
853
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
854
+ const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
855
+ if (r instanceof Promise) {
856
+ proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
857
+ }
858
+ else if (isOptional) {
859
+ handleOptionalObjectResult(r, payload, key, input);
860
+ }
861
+ else {
862
+ handleObjectResult(r, payload, key);
863
+ }
864
+ }
865
+ }
866
+ if (!catchall) {
867
+ // return payload;
868
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
869
+ }
870
+ const unrecognized = [];
871
+ // iterate over input keys
872
+ const keySet = value.keySet;
873
+ const _catchall = catchall._zod;
874
+ const t = _catchall.def.type;
875
+ for (const key of Object.keys(input)) {
876
+ if (keySet.has(key))
877
+ continue;
878
+ if (t === "never") {
879
+ unrecognized.push(key);
880
+ continue;
881
+ }
882
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
883
+ if (r instanceof Promise) {
884
+ proms.push(r.then((r) => handleObjectResult(r, payload, key)));
885
+ }
886
+ else {
887
+ handleObjectResult(r, payload, key);
888
+ }
889
+ }
890
+ if (unrecognized.length) {
891
+ payload.issues.push({
892
+ code: "unrecognized_keys",
893
+ keys: unrecognized,
894
+ input,
895
+ inst,
896
+ });
897
+ }
898
+ if (!proms.length)
899
+ return payload;
900
+ return Promise.all(proms).then(() => {
901
+ return payload;
902
+ });
903
+ };
904
+ });
905
+ function handleUnionResults(results, final, inst, ctx) {
906
+ for (const result of results) {
907
+ if (result.issues.length === 0) {
908
+ final.value = result.value;
909
+ return final;
910
+ }
911
+ }
912
+ final.issues.push({
913
+ code: "invalid_union",
914
+ input: final.value,
915
+ inst,
916
+ errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
917
+ });
918
+ return final;
919
+ }
920
+ exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
921
+ exports.$ZodType.init(inst, def);
922
+ util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
923
+ util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
924
+ util.defineLazy(inst._zod, "values", () => {
925
+ if (def.options.every((o) => o._zod.values)) {
926
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
927
+ }
928
+ return undefined;
929
+ });
930
+ util.defineLazy(inst._zod, "pattern", () => {
931
+ if (def.options.every((o) => o._zod.pattern)) {
932
+ const patterns = def.options.map((o) => o._zod.pattern);
933
+ return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
934
+ }
935
+ return undefined;
936
+ });
937
+ inst._zod.parse = (payload, ctx) => {
938
+ let async = false;
939
+ const results = [];
940
+ for (const option of def.options) {
941
+ const result = option._zod.run({
942
+ value: payload.value,
943
+ issues: [],
944
+ }, ctx);
945
+ if (result instanceof Promise) {
946
+ results.push(result);
947
+ async = true;
948
+ }
949
+ else {
950
+ if (result.issues.length === 0)
951
+ return result;
952
+ results.push(result);
953
+ }
954
+ }
955
+ if (!async)
956
+ return handleUnionResults(results, payload, inst, ctx);
957
+ return Promise.all(results).then((results) => {
958
+ return handleUnionResults(results, payload, inst, ctx);
959
+ });
960
+ };
961
+ });
962
+ exports.$ZodDiscriminatedUnion =
963
+ /*@__PURE__*/
964
+ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
965
+ exports.$ZodUnion.init(inst, def);
966
+ const _super = inst._zod.parse;
967
+ util.defineLazy(inst._zod, "propValues", () => {
968
+ const propValues = {};
969
+ for (const option of def.options) {
970
+ const pv = option._zod.propValues;
971
+ if (!pv || Object.keys(pv).length === 0)
972
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
973
+ for (const [k, v] of Object.entries(pv)) {
974
+ if (!propValues[k])
975
+ propValues[k] = new Set();
976
+ for (const val of v) {
977
+ propValues[k].add(val);
978
+ }
979
+ }
980
+ }
981
+ return propValues;
982
+ });
983
+ const disc = util.cached(() => {
984
+ const opts = def.options;
985
+ const map = new Map();
986
+ for (const o of opts) {
987
+ const values = o._zod.propValues[def.discriminator];
988
+ if (!values || values.size === 0)
989
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
990
+ for (const v of values) {
991
+ if (map.has(v)) {
992
+ throw new Error(`Duplicate discriminator value "${String(v)}"`);
993
+ }
994
+ map.set(v, o);
995
+ }
996
+ }
997
+ return map;
998
+ });
999
+ inst._zod.parse = (payload, ctx) => {
1000
+ const input = payload.value;
1001
+ if (!util.isObject(input)) {
1002
+ payload.issues.push({
1003
+ code: "invalid_type",
1004
+ expected: "object",
1005
+ input,
1006
+ inst,
1007
+ });
1008
+ return payload;
1009
+ }
1010
+ const opt = disc.value.get(input?.[def.discriminator]);
1011
+ if (opt) {
1012
+ return opt._zod.run(payload, ctx);
1013
+ }
1014
+ if (def.unionFallback) {
1015
+ return _super(payload, ctx);
1016
+ }
1017
+ // no matching discriminator
1018
+ payload.issues.push({
1019
+ code: "invalid_union",
1020
+ errors: [],
1021
+ note: "No matching discriminator",
1022
+ input,
1023
+ path: [def.discriminator],
1024
+ inst,
1025
+ });
1026
+ return payload;
1027
+ };
1028
+ });
1029
+ exports.$ZodIntersection = core.$constructor("$ZodIntersection", (inst, def) => {
1030
+ exports.$ZodType.init(inst, def);
1031
+ inst._zod.parse = (payload, ctx) => {
1032
+ const input = payload.value;
1033
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1034
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1035
+ const async = left instanceof Promise || right instanceof Promise;
1036
+ if (async) {
1037
+ return Promise.all([left, right]).then(([left, right]) => {
1038
+ return handleIntersectionResults(payload, left, right);
1039
+ });
1040
+ }
1041
+ return handleIntersectionResults(payload, left, right);
1042
+ };
1043
+ });
1044
+ function mergeValues(a, b) {
1045
+ // const aType = parse.t(a);
1046
+ // const bType = parse.t(b);
1047
+ if (a === b) {
1048
+ return { valid: true, data: a };
1049
+ }
1050
+ if (a instanceof Date && b instanceof Date && +a === +b) {
1051
+ return { valid: true, data: a };
1052
+ }
1053
+ if (util.isPlainObject(a) && util.isPlainObject(b)) {
1054
+ const bKeys = Object.keys(b);
1055
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1056
+ const newObj = { ...a, ...b };
1057
+ for (const key of sharedKeys) {
1058
+ const sharedValue = mergeValues(a[key], b[key]);
1059
+ if (!sharedValue.valid) {
1060
+ return {
1061
+ valid: false,
1062
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
1063
+ };
1064
+ }
1065
+ newObj[key] = sharedValue.data;
1066
+ }
1067
+ return { valid: true, data: newObj };
1068
+ }
1069
+ if (Array.isArray(a) && Array.isArray(b)) {
1070
+ if (a.length !== b.length) {
1071
+ return { valid: false, mergeErrorPath: [] };
1072
+ }
1073
+ const newArray = [];
1074
+ for (let index = 0; index < a.length; index++) {
1075
+ const itemA = a[index];
1076
+ const itemB = b[index];
1077
+ const sharedValue = mergeValues(itemA, itemB);
1078
+ if (!sharedValue.valid) {
1079
+ return {
1080
+ valid: false,
1081
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
1082
+ };
1083
+ }
1084
+ newArray.push(sharedValue.data);
1085
+ }
1086
+ return { valid: true, data: newArray };
1087
+ }
1088
+ return { valid: false, mergeErrorPath: [] };
1089
+ }
1090
+ function handleIntersectionResults(result, left, right) {
1091
+ if (left.issues.length) {
1092
+ result.issues.push(...left.issues);
1093
+ }
1094
+ if (right.issues.length) {
1095
+ result.issues.push(...right.issues);
1096
+ }
1097
+ if (util.aborted(result))
1098
+ return result;
1099
+ const merged = mergeValues(left.value, right.value);
1100
+ if (!merged.valid) {
1101
+ throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
1102
+ }
1103
+ result.value = merged.data;
1104
+ return result;
1105
+ }
1106
+ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
1107
+ exports.$ZodType.init(inst, def);
1108
+ const items = def.items;
1109
+ const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1110
+ inst._zod.parse = (payload, ctx) => {
1111
+ const input = payload.value;
1112
+ if (!Array.isArray(input)) {
1113
+ payload.issues.push({
1114
+ input,
1115
+ inst,
1116
+ expected: "tuple",
1117
+ code: "invalid_type",
1118
+ });
1119
+ return payload;
1120
+ }
1121
+ payload.value = [];
1122
+ const proms = [];
1123
+ if (!def.rest) {
1124
+ const tooBig = input.length > items.length;
1125
+ const tooSmall = input.length < optStart - 1;
1126
+ if (tooBig || tooSmall) {
1127
+ payload.issues.push({
1128
+ input,
1129
+ inst,
1130
+ origin: "array",
1131
+ ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
1132
+ });
1133
+ return payload;
1134
+ }
1135
+ }
1136
+ let i = -1;
1137
+ for (const item of items) {
1138
+ i++;
1139
+ if (i >= input.length)
1140
+ if (i >= optStart)
1141
+ continue;
1142
+ const result = item._zod.run({
1143
+ value: input[i],
1144
+ issues: [],
1145
+ }, ctx);
1146
+ if (result instanceof Promise) {
1147
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1148
+ }
1149
+ else {
1150
+ handleTupleResult(result, payload, i);
1151
+ }
1152
+ }
1153
+ if (def.rest) {
1154
+ const rest = input.slice(items.length);
1155
+ for (const el of rest) {
1156
+ i++;
1157
+ const result = def.rest._zod.run({
1158
+ value: el,
1159
+ issues: [],
1160
+ }, ctx);
1161
+ if (result instanceof Promise) {
1162
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1163
+ }
1164
+ else {
1165
+ handleTupleResult(result, payload, i);
1166
+ }
1167
+ }
1168
+ }
1169
+ if (proms.length)
1170
+ return Promise.all(proms).then(() => payload);
1171
+ return payload;
1172
+ };
1173
+ });
1174
+ function handleTupleResult(result, final, index) {
1175
+ if (result.issues.length) {
1176
+ final.issues.push(...util.prefixIssues(index, result.issues));
1177
+ }
1178
+ final.value[index] = result.value;
1179
+ }
1180
+ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
1181
+ exports.$ZodType.init(inst, def);
1182
+ inst._zod.parse = (payload, ctx) => {
1183
+ const input = payload.value;
1184
+ if (!util.isPlainObject(input)) {
1185
+ payload.issues.push({
1186
+ expected: "record",
1187
+ code: "invalid_type",
1188
+ input,
1189
+ inst,
1190
+ });
1191
+ return payload;
1192
+ }
1193
+ const proms = [];
1194
+ if (def.keyType._zod.values) {
1195
+ const values = def.keyType._zod.values;
1196
+ payload.value = {};
1197
+ for (const key of values) {
1198
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1199
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1200
+ if (result instanceof Promise) {
1201
+ proms.push(result.then((result) => {
1202
+ if (result.issues.length) {
1203
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1204
+ }
1205
+ payload.value[key] = result.value;
1206
+ }));
1207
+ }
1208
+ else {
1209
+ if (result.issues.length) {
1210
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1211
+ }
1212
+ payload.value[key] = result.value;
1213
+ }
1214
+ }
1215
+ }
1216
+ let unrecognized;
1217
+ for (const key in input) {
1218
+ if (!values.has(key)) {
1219
+ unrecognized = unrecognized ?? [];
1220
+ unrecognized.push(key);
1221
+ }
1222
+ }
1223
+ if (unrecognized && unrecognized.length > 0) {
1224
+ payload.issues.push({
1225
+ code: "unrecognized_keys",
1226
+ input,
1227
+ inst,
1228
+ keys: unrecognized,
1229
+ });
1230
+ }
1231
+ }
1232
+ else {
1233
+ payload.value = {};
1234
+ for (const key of Reflect.ownKeys(input)) {
1235
+ if (key === "__proto__")
1236
+ continue;
1237
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1238
+ if (keyResult instanceof Promise) {
1239
+ throw new Error("Async schemas not supported in object keys currently");
1240
+ }
1241
+ if (keyResult.issues.length) {
1242
+ payload.issues.push({
1243
+ origin: "record",
1244
+ code: "invalid_key",
1245
+ issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1246
+ input: key,
1247
+ path: [key],
1248
+ inst,
1249
+ });
1250
+ payload.value[keyResult.value] = keyResult.value;
1251
+ continue;
1252
+ }
1253
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1254
+ if (result instanceof Promise) {
1255
+ proms.push(result.then((result) => {
1256
+ if (result.issues.length) {
1257
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1258
+ }
1259
+ payload.value[keyResult.value] = result.value;
1260
+ }));
1261
+ }
1262
+ else {
1263
+ if (result.issues.length) {
1264
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1265
+ }
1266
+ payload.value[keyResult.value] = result.value;
1267
+ }
1268
+ }
1269
+ }
1270
+ if (proms.length) {
1271
+ return Promise.all(proms).then(() => payload);
1272
+ }
1273
+ return payload;
1274
+ };
1275
+ });
1276
+ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
1277
+ exports.$ZodType.init(inst, def);
1278
+ inst._zod.parse = (payload, ctx) => {
1279
+ const input = payload.value;
1280
+ if (!(input instanceof Map)) {
1281
+ payload.issues.push({
1282
+ expected: "map",
1283
+ code: "invalid_type",
1284
+ input,
1285
+ inst,
1286
+ });
1287
+ return payload;
1288
+ }
1289
+ const proms = [];
1290
+ payload.value = new Map();
1291
+ for (const [key, value] of input) {
1292
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1293
+ const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
1294
+ if (keyResult instanceof Promise || valueResult instanceof Promise) {
1295
+ proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
1296
+ handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1297
+ }));
1298
+ }
1299
+ else {
1300
+ handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1301
+ }
1302
+ }
1303
+ if (proms.length)
1304
+ return Promise.all(proms).then(() => payload);
1305
+ return payload;
1306
+ };
1307
+ });
1308
+ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
1309
+ if (keyResult.issues.length) {
1310
+ if (util.propertyKeyTypes.has(typeof key)) {
1311
+ final.issues.push(...util.prefixIssues(key, keyResult.issues));
1312
+ }
1313
+ else {
1314
+ final.issues.push({
1315
+ origin: "map",
1316
+ code: "invalid_key",
1317
+ input,
1318
+ inst,
1319
+ issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1320
+ });
1321
+ }
1322
+ }
1323
+ if (valueResult.issues.length) {
1324
+ if (util.propertyKeyTypes.has(typeof key)) {
1325
+ final.issues.push(...util.prefixIssues(key, valueResult.issues));
1326
+ }
1327
+ else {
1328
+ final.issues.push({
1329
+ origin: "map",
1330
+ code: "invalid_element",
1331
+ input,
1332
+ inst,
1333
+ key: key,
1334
+ issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1335
+ });
1336
+ }
1337
+ }
1338
+ final.value.set(keyResult.value, valueResult.value);
1339
+ }
1340
+ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
1341
+ exports.$ZodType.init(inst, def);
1342
+ inst._zod.parse = (payload, ctx) => {
1343
+ const input = payload.value;
1344
+ if (!(input instanceof Set)) {
1345
+ payload.issues.push({
1346
+ input,
1347
+ inst,
1348
+ expected: "set",
1349
+ code: "invalid_type",
1350
+ });
1351
+ return payload;
1352
+ }
1353
+ const proms = [];
1354
+ payload.value = new Set();
1355
+ for (const item of input) {
1356
+ const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
1357
+ if (result instanceof Promise) {
1358
+ proms.push(result.then((result) => handleSetResult(result, payload)));
1359
+ }
1360
+ else
1361
+ handleSetResult(result, payload);
1362
+ }
1363
+ if (proms.length)
1364
+ return Promise.all(proms).then(() => payload);
1365
+ return payload;
1366
+ };
1367
+ });
1368
+ function handleSetResult(result, final) {
1369
+ if (result.issues.length) {
1370
+ final.issues.push(...result.issues);
1371
+ }
1372
+ final.value.add(result.value);
1373
+ }
1374
+ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
1375
+ exports.$ZodType.init(inst, def);
1376
+ const values = util.getEnumValues(def.entries);
1377
+ inst._zod.values = new Set(values);
1378
+ inst._zod.pattern = new RegExp(`^(${values
1379
+ .filter((k) => util.propertyKeyTypes.has(typeof k))
1380
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1381
+ .join("|")})$`);
1382
+ inst._zod.parse = (payload, _ctx) => {
1383
+ const input = payload.value;
1384
+ if (inst._zod.values.has(input)) {
1385
+ return payload;
1386
+ }
1387
+ payload.issues.push({
1388
+ code: "invalid_value",
1389
+ values,
1390
+ input,
1391
+ inst,
1392
+ });
1393
+ return payload;
1394
+ };
1395
+ });
1396
+ exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
1397
+ exports.$ZodType.init(inst, def);
1398
+ inst._zod.values = new Set(def.values);
1399
+ inst._zod.pattern = new RegExp(`^(${def.values
1400
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
1401
+ .join("|")})$`);
1402
+ inst._zod.parse = (payload, _ctx) => {
1403
+ const input = payload.value;
1404
+ if (inst._zod.values.has(input)) {
1405
+ return payload;
1406
+ }
1407
+ payload.issues.push({
1408
+ code: "invalid_value",
1409
+ values: def.values,
1410
+ input,
1411
+ inst,
1412
+ });
1413
+ return payload;
1414
+ };
1415
+ });
1416
+ exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
1417
+ exports.$ZodType.init(inst, def);
1418
+ inst._zod.parse = (payload, _ctx) => {
1419
+ const input = payload.value;
1420
+ if (input instanceof File)
1421
+ return payload;
1422
+ payload.issues.push({
1423
+ expected: "file",
1424
+ code: "invalid_type",
1425
+ input,
1426
+ inst,
1427
+ });
1428
+ return payload;
1429
+ };
1430
+ });
1431
+ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
1432
+ exports.$ZodType.init(inst, def);
1433
+ inst._zod.parse = (payload, _ctx) => {
1434
+ const _out = def.transform(payload.value, payload);
1435
+ if (_ctx.async) {
1436
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1437
+ return output.then((output) => {
1438
+ payload.value = output;
1439
+ return payload;
1440
+ });
1441
+ }
1442
+ if (_out instanceof Promise) {
1443
+ throw new core.$ZodAsyncError();
1444
+ }
1445
+ payload.value = _out;
1446
+ return payload;
1447
+ };
1448
+ });
1449
+ exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
1450
+ exports.$ZodType.init(inst, def);
1451
+ inst._zod.optin = "optional";
1452
+ inst._zod.optout = "optional";
1453
+ util.defineLazy(inst._zod, "values", () => {
1454
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1455
+ });
1456
+ util.defineLazy(inst._zod, "pattern", () => {
1457
+ const pattern = def.innerType._zod.pattern;
1458
+ return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1459
+ });
1460
+ inst._zod.parse = (payload, ctx) => {
1461
+ if (def.innerType._zod.optin === "optional") {
1462
+ return def.innerType._zod.run(payload, ctx);
1463
+ }
1464
+ if (payload.value === undefined) {
1465
+ return payload;
1466
+ }
1467
+ return def.innerType._zod.run(payload, ctx);
1468
+ };
1469
+ });
1470
+ exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
1471
+ exports.$ZodType.init(inst, def);
1472
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1473
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1474
+ util.defineLazy(inst._zod, "pattern", () => {
1475
+ const pattern = def.innerType._zod.pattern;
1476
+ return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
1477
+ });
1478
+ util.defineLazy(inst._zod, "values", () => {
1479
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1480
+ });
1481
+ inst._zod.parse = (payload, ctx) => {
1482
+ if (payload.value === null)
1483
+ return payload;
1484
+ return def.innerType._zod.run(payload, ctx);
1485
+ };
1486
+ });
1487
+ exports.$ZodDefault = core.$constructor("$ZodDefault", (inst, def) => {
1488
+ exports.$ZodType.init(inst, def);
1489
+ // inst._zod.qin = "true";
1490
+ inst._zod.optin = "optional";
1491
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1492
+ inst._zod.parse = (payload, ctx) => {
1493
+ if (payload.value === undefined) {
1494
+ payload.value = def.defaultValue;
1495
+ /**
1496
+ * $ZodDefault always returns the default value immediately.
1497
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1498
+ return payload;
1499
+ }
1500
+ const result = def.innerType._zod.run(payload, ctx);
1501
+ if (result instanceof Promise) {
1502
+ return result.then((result) => handleDefaultResult(result, def));
1503
+ }
1504
+ return handleDefaultResult(result, def);
1505
+ };
1506
+ });
1507
+ function handleDefaultResult(payload, def) {
1508
+ if (payload.value === undefined) {
1509
+ payload.value = def.defaultValue;
1510
+ }
1511
+ return payload;
1512
+ }
1513
+ exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
1514
+ exports.$ZodType.init(inst, def);
1515
+ inst._zod.optin = "optional";
1516
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1517
+ inst._zod.parse = (payload, ctx) => {
1518
+ if (payload.value === undefined) {
1519
+ payload.value = def.defaultValue;
1520
+ }
1521
+ return def.innerType._zod.run(payload, ctx);
1522
+ };
1523
+ });
1524
+ exports.$ZodNonOptional = core.$constructor("$ZodNonOptional", (inst, def) => {
1525
+ exports.$ZodType.init(inst, def);
1526
+ util.defineLazy(inst._zod, "values", () => {
1527
+ const v = def.innerType._zod.values;
1528
+ return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1529
+ });
1530
+ inst._zod.parse = (payload, ctx) => {
1531
+ const result = def.innerType._zod.run(payload, ctx);
1532
+ if (result instanceof Promise) {
1533
+ return result.then((result) => handleNonOptionalResult(result, inst));
1534
+ }
1535
+ return handleNonOptionalResult(result, inst);
1536
+ };
1537
+ });
1538
+ function handleNonOptionalResult(payload, inst) {
1539
+ if (!payload.issues.length && payload.value === undefined) {
1540
+ payload.issues.push({
1541
+ code: "invalid_type",
1542
+ expected: "nonoptional",
1543
+ input: payload.value,
1544
+ inst,
1545
+ });
1546
+ }
1547
+ return payload;
1548
+ }
1549
+ exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
1550
+ exports.$ZodType.init(inst, def);
1551
+ inst._zod.parse = (payload, ctx) => {
1552
+ const result = def.innerType._zod.run(payload, ctx);
1553
+ if (result instanceof Promise) {
1554
+ return result.then((result) => {
1555
+ payload.value = result.issues.length === 0;
1556
+ return payload;
1557
+ });
1558
+ }
1559
+ payload.value = result.issues.length === 0;
1560
+ return payload;
1561
+ };
1562
+ });
1563
+ exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
1564
+ exports.$ZodType.init(inst, def);
1565
+ inst._zod.optin = "optional";
1566
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1567
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1568
+ inst._zod.parse = (payload, ctx) => {
1569
+ const result = def.innerType._zod.run(payload, ctx);
1570
+ if (result instanceof Promise) {
1571
+ return result.then((result) => {
1572
+ payload.value = result.value;
1573
+ if (result.issues.length) {
1574
+ payload.value = def.catchValue({
1575
+ ...payload,
1576
+ error: {
1577
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1578
+ },
1579
+ input: payload.value,
1580
+ });
1581
+ payload.issues = [];
1582
+ }
1583
+ return payload;
1584
+ });
1585
+ }
1586
+ payload.value = result.value;
1587
+ if (result.issues.length) {
1588
+ payload.value = def.catchValue({
1589
+ ...payload,
1590
+ error: {
1591
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1592
+ },
1593
+ input: payload.value,
1594
+ });
1595
+ payload.issues = [];
1596
+ }
1597
+ return payload;
1598
+ };
1599
+ });
1600
+ exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
1601
+ exports.$ZodType.init(inst, def);
1602
+ inst._zod.parse = (payload, _ctx) => {
1603
+ if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
1604
+ payload.issues.push({
1605
+ input: payload.value,
1606
+ inst,
1607
+ expected: "nan",
1608
+ code: "invalid_type",
1609
+ });
1610
+ return payload;
1611
+ }
1612
+ return payload;
1613
+ };
1614
+ });
1615
+ exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
1616
+ exports.$ZodType.init(inst, def);
1617
+ util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1618
+ util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1619
+ util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1620
+ inst._zod.parse = (payload, ctx) => {
1621
+ const left = def.in._zod.run(payload, ctx);
1622
+ if (left instanceof Promise) {
1623
+ return left.then((left) => handlePipeResult(left, def, ctx));
1624
+ }
1625
+ return handlePipeResult(left, def, ctx);
1626
+ };
1627
+ });
1628
+ function handlePipeResult(left, def, ctx) {
1629
+ if (util.aborted(left)) {
1630
+ return left;
1631
+ }
1632
+ return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1633
+ }
1634
+ exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
1635
+ exports.$ZodType.init(inst, def);
1636
+ util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1637
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1638
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1639
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1640
+ inst._zod.parse = (payload, ctx) => {
1641
+ const result = def.innerType._zod.run(payload, ctx);
1642
+ if (result instanceof Promise) {
1643
+ return result.then(handleReadonlyResult);
1644
+ }
1645
+ return handleReadonlyResult(result);
1646
+ };
1647
+ });
1648
+ function handleReadonlyResult(payload) {
1649
+ payload.value = Object.freeze(payload.value);
1650
+ return payload;
1651
+ }
1652
+ exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
1653
+ exports.$ZodType.init(inst, def);
1654
+ const regexParts = [];
1655
+ for (const part of def.parts) {
1656
+ if (part instanceof exports.$ZodType) {
1657
+ if (!part._zod.pattern) {
1658
+ // if (!source)
1659
+ throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
1660
+ }
1661
+ const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
1662
+ if (!source)
1663
+ throw new Error(`Invalid template literal part: ${part._zod.traits}`);
1664
+ const start = source.startsWith("^") ? 1 : 0;
1665
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
1666
+ regexParts.push(source.slice(start, end));
1667
+ }
1668
+ else if (part === null || util.primitiveTypes.has(typeof part)) {
1669
+ regexParts.push(util.escapeRegex(`${part}`));
1670
+ }
1671
+ else {
1672
+ throw new Error(`Invalid template literal part: ${part}`);
1673
+ }
1674
+ }
1675
+ inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
1676
+ inst._zod.parse = (payload, _ctx) => {
1677
+ if (typeof payload.value !== "string") {
1678
+ payload.issues.push({
1679
+ input: payload.value,
1680
+ inst,
1681
+ expected: "template_literal",
1682
+ code: "invalid_type",
1683
+ });
1684
+ return payload;
1685
+ }
1686
+ inst._zod.pattern.lastIndex = 0;
1687
+ if (!inst._zod.pattern.test(payload.value)) {
1688
+ payload.issues.push({
1689
+ input: payload.value,
1690
+ inst,
1691
+ code: "invalid_format",
1692
+ format: "template_literal",
1693
+ pattern: inst._zod.pattern.source,
1694
+ });
1695
+ return payload;
1696
+ }
1697
+ return payload;
1698
+ };
1699
+ });
1700
+ exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
1701
+ exports.$ZodType.init(inst, def);
1702
+ inst._zod.parse = (payload, ctx) => {
1703
+ return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
1704
+ };
1705
+ });
1706
+ exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
1707
+ exports.$ZodType.init(inst, def);
1708
+ util.defineLazy(inst._zod, "innerType", () => def.getter());
1709
+ util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1710
+ util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1711
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
1712
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
1713
+ inst._zod.parse = (payload, ctx) => {
1714
+ const inner = inst._zod.innerType;
1715
+ return inner._zod.run(payload, ctx);
1716
+ };
1717
+ });
1718
+ exports.$ZodCustom = core.$constructor("$ZodCustom", (inst, def) => {
1719
+ checks.$ZodCheck.init(inst, def);
1720
+ exports.$ZodType.init(inst, def);
1721
+ inst._zod.parse = (payload, _) => {
1722
+ return payload;
1723
+ };
1724
+ inst._zod.check = (payload) => {
1725
+ const input = payload.value;
1726
+ const r = def.fn(input);
1727
+ if (r instanceof Promise) {
1728
+ return r.then((r) => handleRefineResult(r, payload, input, inst));
1729
+ }
1730
+ handleRefineResult(r, payload, input, inst);
1731
+ return;
1732
+ };
1733
+ });
1734
+ function handleRefineResult(result, payload, input, inst) {
1735
+ if (!result) {
1736
+ const _iss = {
1737
+ code: "custom",
1738
+ input,
1739
+ inst, // incorporates params.error into issue reporting
1740
+ path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
1741
+ continue: !inst._zod.def.abort,
1742
+ // params: inst._zod.def.params,
1743
+ };
1744
+ if (inst._zod.def.params)
1745
+ _iss.params = inst._zod.def.params;
1746
+ payload.issues.push(util.issue(_iss));
1747
+ }
1748
+ }