@anthonyalayo/zod 0.0.0-stage → 4.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (842) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -2
  3. package/compile.cjs +96 -0
  4. package/compile.d.cts +1 -0
  5. package/compile.d.ts +1 -0
  6. package/compile.js +52 -0
  7. package/index.cjs +52 -0
  8. package/index.d.cts +3 -0
  9. package/index.d.ts +3 -0
  10. package/index.js +7 -0
  11. package/locales/index.cjs +36 -0
  12. package/locales/index.d.cts +1 -0
  13. package/locales/index.d.ts +1 -0
  14. package/locales/index.js +1 -0
  15. package/locales/package.json +7 -0
  16. package/mini/index.cjs +51 -0
  17. package/mini/index.d.cts +3 -0
  18. package/mini/index.d.ts +3 -0
  19. package/mini/index.js +3 -0
  20. package/mini/package.json +7 -0
  21. package/package.json +144 -4
  22. package/src/compile.ts +56 -0
  23. package/src/index.ts +7 -0
  24. package/src/locales/index.ts +1 -0
  25. package/src/mini/index.ts +3 -0
  26. package/src/v3/ZodError.ts +340 -0
  27. package/src/v3/benchmarks/datetime.ts +58 -0
  28. package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  29. package/src/v3/benchmarks/index.ts +59 -0
  30. package/src/v3/benchmarks/ipv4.ts +57 -0
  31. package/src/v3/benchmarks/object.ts +69 -0
  32. package/src/v3/benchmarks/primitives.ts +162 -0
  33. package/src/v3/benchmarks/realworld.ts +63 -0
  34. package/src/v3/benchmarks/string.ts +55 -0
  35. package/src/v3/benchmarks/union.ts +80 -0
  36. package/src/v3/errors.ts +13 -0
  37. package/src/v3/external.ts +6 -0
  38. package/src/v3/helpers/enumUtil.ts +17 -0
  39. package/src/v3/helpers/errorUtil.ts +8 -0
  40. package/src/v3/helpers/parseUtil.ts +176 -0
  41. package/src/v3/helpers/partialUtil.ts +34 -0
  42. package/src/v3/helpers/typeAliases.ts +2 -0
  43. package/src/v3/helpers/util.ts +224 -0
  44. package/src/v3/index.ts +4 -0
  45. package/src/v3/locales/en.ts +124 -0
  46. package/src/v3/standard-schema.ts +113 -0
  47. package/src/v3/tests/Mocker.ts +54 -0
  48. package/src/v3/tests/all-errors.test.ts +157 -0
  49. package/src/v3/tests/anyunknown.test.ts +28 -0
  50. package/src/v3/tests/array.test.ts +92 -0
  51. package/src/v3/tests/async-parsing.test.ts +388 -0
  52. package/src/v3/tests/async-refinements.test.ts +46 -0
  53. package/src/v3/tests/base.test.ts +29 -0
  54. package/src/v3/tests/bigint.test.ts +55 -0
  55. package/src/v3/tests/branded.test.ts +53 -0
  56. package/src/v3/tests/catch.test.ts +220 -0
  57. package/src/v3/tests/coerce.test.ts +133 -0
  58. package/src/v3/tests/complex.test.ts +70 -0
  59. package/src/v3/tests/custom.test.ts +31 -0
  60. package/src/v3/tests/date.test.ts +32 -0
  61. package/src/v3/tests/deepmasking.test.ts +186 -0
  62. package/src/v3/tests/default.test.ts +112 -0
  63. package/src/v3/tests/description.test.ts +33 -0
  64. package/src/v3/tests/discriminated-unions.test.ts +315 -0
  65. package/src/v3/tests/enum.test.ts +80 -0
  66. package/src/v3/tests/error.test.ts +586 -0
  67. package/src/v3/tests/firstparty.test.ts +87 -0
  68. package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  69. package/src/v3/tests/function.test.ts +261 -0
  70. package/src/v3/tests/generics.test.ts +48 -0
  71. package/src/v3/tests/instanceof.test.ts +37 -0
  72. package/src/v3/tests/intersection.test.ts +136 -0
  73. package/src/v3/tests/language-server.source.ts +76 -0
  74. package/src/v3/tests/language-server.test.ts +206 -0
  75. package/src/v3/tests/literal.test.ts +36 -0
  76. package/src/v3/tests/map.test.ts +110 -0
  77. package/src/v3/tests/masking.test.ts +4 -0
  78. package/src/v3/tests/mocker.test.ts +19 -0
  79. package/src/v3/tests/nan.test.ts +24 -0
  80. package/src/v3/tests/nativeEnum.test.ts +87 -0
  81. package/src/v3/tests/nullable.test.ts +42 -0
  82. package/src/v3/tests/number.test.ts +176 -0
  83. package/src/v3/tests/object-augmentation.test.ts +29 -0
  84. package/src/v3/tests/object-in-es5-env.test.ts +29 -0
  85. package/src/v3/tests/object.test.ts +431 -0
  86. package/src/v3/tests/optional.test.ts +42 -0
  87. package/src/v3/tests/parseUtil.test.ts +23 -0
  88. package/src/v3/tests/parser.test.ts +41 -0
  89. package/src/v3/tests/partials.test.ts +243 -0
  90. package/src/v3/tests/pickomit.test.ts +111 -0
  91. package/src/v3/tests/pipeline.test.ts +29 -0
  92. package/src/v3/tests/preprocess.test.ts +186 -0
  93. package/src/v3/tests/primitive.test.ts +440 -0
  94. package/src/v3/tests/promise.test.ts +90 -0
  95. package/src/v3/tests/readonly.test.ts +114 -0
  96. package/src/v3/tests/record.test.ts +171 -0
  97. package/src/v3/tests/recursive.test.ts +197 -0
  98. package/src/v3/tests/refine.test.ts +313 -0
  99. package/src/v3/tests/safeparse.test.ts +27 -0
  100. package/src/v3/tests/set.test.ts +148 -0
  101. package/src/v3/tests/standard-schema.test.ts +83 -0
  102. package/src/v3/tests/string.test.ts +922 -0
  103. package/src/v3/tests/transformer.test.ts +233 -0
  104. package/src/v3/tests/tuple.test.ts +90 -0
  105. package/src/v3/tests/unions.test.ts +57 -0
  106. package/src/v3/tests/validations.test.ts +133 -0
  107. package/src/v3/tests/void.test.ts +15 -0
  108. package/src/v3/types.ts +5149 -0
  109. package/src/v4/classic/checks.ts +33 -0
  110. package/src/v4/classic/coerce.ts +27 -0
  111. package/src/v4/classic/compat.ts +78 -0
  112. package/src/v4/classic/deep-partial.ts +76 -0
  113. package/src/v4/classic/errors.ts +97 -0
  114. package/src/v4/classic/external.ts +57 -0
  115. package/src/v4/classic/from-json-schema.ts +944 -0
  116. package/src/v4/classic/in-out.ts +45 -0
  117. package/src/v4/classic/index.ts +5 -0
  118. package/src/v4/classic/iso.ts +20 -0
  119. package/src/v4/classic/parse.ts +88 -0
  120. package/src/v4/classic/schemas.ts +3009 -0
  121. package/src/v4/classic/tests/anyunknown.test.ts +26 -0
  122. package/src/v4/classic/tests/apply.test.ts +86 -0
  123. package/src/v4/classic/tests/array.test.ts +339 -0
  124. package/src/v4/classic/tests/assignability.test.ts +402 -0
  125. package/src/v4/classic/tests/async-parsing.test.ts +381 -0
  126. package/src/v4/classic/tests/async-refinements.test.ts +68 -0
  127. package/src/v4/classic/tests/base.test.ts +7 -0
  128. package/src/v4/classic/tests/bigint.test.ts +89 -0
  129. package/src/v4/classic/tests/brand.test.ts +106 -0
  130. package/src/v4/classic/tests/catch.test.ts +604 -0
  131. package/src/v4/classic/tests/coalesce.test.ts +20 -0
  132. package/src/v4/classic/tests/codec-examples.test.ts +572 -0
  133. package/src/v4/classic/tests/codec.test.ts +704 -0
  134. package/src/v4/classic/tests/coerce.test.ts +160 -0
  135. package/src/v4/classic/tests/continuability.test.ts +374 -0
  136. package/src/v4/classic/tests/credit-card.test.ts +76 -0
  137. package/src/v4/classic/tests/custom.test.ts +40 -0
  138. package/src/v4/classic/tests/cyclic-data.test.ts +1248 -0
  139. package/src/v4/classic/tests/date.test.ts +92 -0
  140. package/src/v4/classic/tests/datetime.test.ts +316 -0
  141. package/src/v4/classic/tests/deep-partial.test.ts +380 -0
  142. package/src/v4/classic/tests/default-locale.test.ts +32 -0
  143. package/src/v4/classic/tests/default.test.ts +455 -0
  144. package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  145. package/src/v4/classic/tests/description.test.ts +32 -0
  146. package/src/v4/classic/tests/detached-methods.test.ts +221 -0
  147. package/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  148. package/src/v4/classic/tests/enum.test.ts +305 -0
  149. package/src/v4/classic/tests/error-utils.test.ts +917 -0
  150. package/src/v4/classic/tests/error.test.ts +1108 -0
  151. package/src/v4/classic/tests/file.test.ts +96 -0
  152. package/src/v4/classic/tests/firstparty.test.ts +179 -0
  153. package/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  154. package/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  155. package/src/v4/classic/tests/function.test.ts +391 -0
  156. package/src/v4/classic/tests/generics.test.ts +72 -0
  157. package/src/v4/classic/tests/global-config.test.ts +32 -0
  158. package/src/v4/classic/tests/hash.test.ts +67 -0
  159. package/src/v4/classic/tests/iban.test.ts +81 -0
  160. package/src/v4/classic/tests/in-out.test.ts +159 -0
  161. package/src/v4/classic/tests/index.test.ts +958 -0
  162. package/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  163. package/src/v4/classic/tests/instanceof.test.ts +127 -0
  164. package/src/v4/classic/tests/intersection.test.ts +368 -0
  165. package/src/v4/classic/tests/issue-schema.test.ts +215 -0
  166. package/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  167. package/src/v4/classic/tests/json.test.ts +109 -0
  168. package/src/v4/classic/tests/lazy.test.ts +276 -0
  169. package/src/v4/classic/tests/literal.test.ts +128 -0
  170. package/src/v4/classic/tests/locales_ka.test.ts +29 -0
  171. package/src/v4/classic/tests/locales_ro.test.ts +24 -0
  172. package/src/v4/classic/tests/map.test.ts +349 -0
  173. package/src/v4/classic/tests/nan.test.ts +21 -0
  174. package/src/v4/classic/tests/nested-refine.test.ts +168 -0
  175. package/src/v4/classic/tests/nonoptional.test.ts +101 -0
  176. package/src/v4/classic/tests/nullable.test.ts +22 -0
  177. package/src/v4/classic/tests/number.test.ts +401 -0
  178. package/src/v4/classic/tests/object.test.ts +1015 -0
  179. package/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  180. package/src/v4/classic/tests/optional.test.ts +366 -0
  181. package/src/v4/classic/tests/partial.test.ts +497 -0
  182. package/src/v4/classic/tests/pickomit.test.ts +211 -0
  183. package/src/v4/classic/tests/pipe.test.ts +101 -0
  184. package/src/v4/classic/tests/prefault.test.ts +144 -0
  185. package/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  186. package/src/v4/classic/tests/preprocess.test.ts +351 -0
  187. package/src/v4/classic/tests/primitive.test.ts +175 -0
  188. package/src/v4/classic/tests/promise.test.ts +81 -0
  189. package/src/v4/classic/tests/properties.test.ts +141 -0
  190. package/src/v4/classic/tests/prototypes.test.ts +23 -0
  191. package/src/v4/classic/tests/readonly.test.ts +184 -0
  192. package/src/v4/classic/tests/record.test.ts +901 -0
  193. package/src/v4/classic/tests/recursive-types.test.ts +707 -0
  194. package/src/v4/classic/tests/redos.test.ts +68 -0
  195. package/src/v4/classic/tests/refine.test.ts +720 -0
  196. package/src/v4/classic/tests/registries.test.ts +243 -0
  197. package/src/v4/classic/tests/set.test.ts +196 -0
  198. package/src/v4/classic/tests/standard-schema.test.ts +153 -0
  199. package/src/v4/classic/tests/string-formats.test.ts +125 -0
  200. package/src/v4/classic/tests/string.test.ts +1440 -0
  201. package/src/v4/classic/tests/stringbool.test.ts +124 -0
  202. package/src/v4/classic/tests/template-literal.test.ts +864 -0
  203. package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  204. package/src/v4/classic/tests/to-json-schema.test.ts +4811 -0
  205. package/src/v4/classic/tests/transform.test.ts +414 -0
  206. package/src/v4/classic/tests/tuple.test.ts +520 -0
  207. package/src/v4/classic/tests/union.test.ts +358 -0
  208. package/src/v4/classic/tests/update.test.ts +92 -0
  209. package/src/v4/classic/tests/url.test.ts +13 -0
  210. package/src/v4/classic/tests/validate.test.ts +645 -0
  211. package/src/v4/classic/tests/validations.test.ts +283 -0
  212. package/src/v4/classic/tests/void.test.ts +12 -0
  213. package/src/v4/core/api.ts +1875 -0
  214. package/src/v4/core/checks.ts +1266 -0
  215. package/src/v4/core/compile.ts +2323 -0
  216. package/src/v4/core/core.ts +230 -0
  217. package/src/v4/core/doc.ts +52 -0
  218. package/src/v4/core/errors.ts +543 -0
  219. package/src/v4/core/index.ts +19 -0
  220. package/src/v4/core/json-schema-generator.ts +131 -0
  221. package/src/v4/core/json-schema-processors.ts +944 -0
  222. package/src/v4/core/json-schema.ts +148 -0
  223. package/src/v4/core/memoizer.ts +404 -0
  224. package/src/v4/core/parse.ts +309 -0
  225. package/src/v4/core/regexes.ts +217 -0
  226. package/src/v4/core/registries.ts +105 -0
  227. package/src/v4/core/schemas.ts +5271 -0
  228. package/src/v4/core/standard-schema.ts +159 -0
  229. package/src/v4/core/tests/cached.test.ts +54 -0
  230. package/src/v4/core/tests/compile-differential.test.ts +1004 -0
  231. package/src/v4/core/tests/compile-generative.test.ts +445 -0
  232. package/src/v4/core/tests/compile-global.test.ts +89 -0
  233. package/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  234. package/src/v4/core/tests/compile-stats.test.ts +34 -0
  235. package/src/v4/core/tests/compile.test.ts +2056 -0
  236. package/src/v4/core/tests/email-regex.test.ts +140 -0
  237. package/src/v4/core/tests/extend.test.ts +59 -0
  238. package/src/v4/core/tests/index.test.ts +46 -0
  239. package/src/v4/core/tests/locales/be.test.ts +124 -0
  240. package/src/v4/core/tests/locales/el.test.ts +214 -0
  241. package/src/v4/core/tests/locales/en.test.ts +22 -0
  242. package/src/v4/core/tests/locales/es.test.ts +180 -0
  243. package/src/v4/core/tests/locales/fr.test.ts +72 -0
  244. package/src/v4/core/tests/locales/he.test.ts +391 -0
  245. package/src/v4/core/tests/locales/hr.test.ts +163 -0
  246. package/src/v4/core/tests/locales/hy.test.ts +15 -0
  247. package/src/v4/core/tests/locales/nl.test.ts +46 -0
  248. package/src/v4/core/tests/locales/parity.test.ts +67 -0
  249. package/src/v4/core/tests/locales/ru.test.ts +128 -0
  250. package/src/v4/core/tests/locales/tg.test.ts +85 -0
  251. package/src/v4/core/tests/locales/tk.test.ts +69 -0
  252. package/src/v4/core/tests/locales/tr.test.ts +69 -0
  253. package/src/v4/core/tests/locales/uz.test.ts +105 -0
  254. package/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  255. package/src/v4/core/tests/record-constructor.test.ts +125 -0
  256. package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  257. package/src/v4/core/tests/treeshake.test.ts +51 -0
  258. package/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  259. package/src/v4/core/to-json-schema.ts +857 -0
  260. package/src/v4/core/util.ts +1322 -0
  261. package/src/v4/core/versions.ts +5 -0
  262. package/src/v4/core/visit.ts +193 -0
  263. package/src/v4/core/zsf.ts +323 -0
  264. package/src/v4/index.ts +4 -0
  265. package/src/v4/locales/ar.ts +120 -0
  266. package/src/v4/locales/az.ts +116 -0
  267. package/src/v4/locales/be.ts +188 -0
  268. package/src/v4/locales/bg.ts +133 -0
  269. package/src/v4/locales/bn.ts +123 -0
  270. package/src/v4/locales/ca.ts +121 -0
  271. package/src/v4/locales/ckb.ts +140 -0
  272. package/src/v4/locales/cs.ts +123 -0
  273. package/src/v4/locales/da.ts +128 -0
  274. package/src/v4/locales/de.ts +121 -0
  275. package/src/v4/locales/el.ts +124 -0
  276. package/src/v4/locales/en.ts +136 -0
  277. package/src/v4/locales/eo.ts +123 -0
  278. package/src/v4/locales/es.ts +146 -0
  279. package/src/v4/locales/fa.ts +131 -0
  280. package/src/v4/locales/fi.ts +126 -0
  281. package/src/v4/locales/fr-CA.ts +121 -0
  282. package/src/v4/locales/fr.ts +140 -0
  283. package/src/v4/locales/gu.ts +123 -0
  284. package/src/v4/locales/he.ts +254 -0
  285. package/src/v4/locales/hi.ts +126 -0
  286. package/src/v4/locales/hr.ts +136 -0
  287. package/src/v4/locales/hu.ts +122 -0
  288. package/src/v4/locales/hy.ts +175 -0
  289. package/src/v4/locales/id.ts +120 -0
  290. package/src/v4/locales/index.ts +63 -0
  291. package/src/v4/locales/is.ts +124 -0
  292. package/src/v4/locales/it.ts +121 -0
  293. package/src/v4/locales/ja.ts +119 -0
  294. package/src/v4/locales/ka.ts +128 -0
  295. package/src/v4/locales/kh.ts +7 -0
  296. package/src/v4/locales/km.ts +124 -0
  297. package/src/v4/locales/kn.ts +126 -0
  298. package/src/v4/locales/ko.ts +126 -0
  299. package/src/v4/locales/lt.ts +260 -0
  300. package/src/v4/locales/mk.ts +123 -0
  301. package/src/v4/locales/ms.ts +120 -0
  302. package/src/v4/locales/ne.ts +128 -0
  303. package/src/v4/locales/nl.ts +126 -0
  304. package/src/v4/locales/nn.ts +121 -0
  305. package/src/v4/locales/no.ts +121 -0
  306. package/src/v4/locales/ota.ts +122 -0
  307. package/src/v4/locales/pl.ts +123 -0
  308. package/src/v4/locales/ps.ts +131 -0
  309. package/src/v4/locales/pt-BR.ts +161 -0
  310. package/src/v4/locales/pt.ts +159 -0
  311. package/src/v4/locales/ro.ts +132 -0
  312. package/src/v4/locales/ru.ts +188 -0
  313. package/src/v4/locales/sk.ts +123 -0
  314. package/src/v4/locales/sl.ts +123 -0
  315. package/src/v4/locales/sv.ts +124 -0
  316. package/src/v4/locales/ta.ts +123 -0
  317. package/src/v4/locales/tg.ts +135 -0
  318. package/src/v4/locales/th.ts +124 -0
  319. package/src/v4/locales/tk.ts +113 -0
  320. package/src/v4/locales/tr.ts +116 -0
  321. package/src/v4/locales/ua.ts +7 -0
  322. package/src/v4/locales/uk.ts +122 -0
  323. package/src/v4/locales/ur.ts +124 -0
  324. package/src/v4/locales/uz.ts +120 -0
  325. package/src/v4/locales/vi.ts +122 -0
  326. package/src/v4/locales/yo.ts +129 -0
  327. package/src/v4/locales/zh-CN.ts +121 -0
  328. package/src/v4/locales/zh-TW.ts +120 -0
  329. package/src/v4/mini/checks.ts +33 -0
  330. package/src/v4/mini/coerce.ts +27 -0
  331. package/src/v4/mini/deep-partial.ts +73 -0
  332. package/src/v4/mini/external.ts +52 -0
  333. package/src/v4/mini/in-out.ts +45 -0
  334. package/src/v4/mini/index.ts +3 -0
  335. package/src/v4/mini/iso.ts +66 -0
  336. package/src/v4/mini/parse.ts +16 -0
  337. package/src/v4/mini/schemas.ts +2051 -0
  338. package/src/v4/mini/tests/apply.test.ts +57 -0
  339. package/src/v4/mini/tests/assignability.test.ts +190 -0
  340. package/src/v4/mini/tests/brand.test.ts +94 -0
  341. package/src/v4/mini/tests/checks.test.ts +158 -0
  342. package/src/v4/mini/tests/codec.test.ts +582 -0
  343. package/src/v4/mini/tests/computed.test.ts +30 -0
  344. package/src/v4/mini/tests/cyclic-data.test.ts +97 -0
  345. package/src/v4/mini/tests/deep-partial.test.ts +54 -0
  346. package/src/v4/mini/tests/error.test.ts +41 -0
  347. package/src/v4/mini/tests/functions.test.ts +14 -0
  348. package/src/v4/mini/tests/index.test.ts +1175 -0
  349. package/src/v4/mini/tests/number.test.ts +109 -0
  350. package/src/v4/mini/tests/object.test.ts +292 -0
  351. package/src/v4/mini/tests/prototypes.test.ts +43 -0
  352. package/src/v4/mini/tests/recursive-types.test.ts +341 -0
  353. package/src/v4/mini/tests/standard-schema.test.ts +50 -0
  354. package/src/v4/mini/tests/string.test.ts +396 -0
  355. package/src/v4-mini/index.ts +3 -0
  356. package/v3/ZodError.cjs +167 -0
  357. package/v3/ZodError.d.cts +164 -0
  358. package/v3/ZodError.d.ts +164 -0
  359. package/v3/ZodError.js +143 -0
  360. package/v3/errors.cjs +36 -0
  361. package/v3/errors.d.cts +5 -0
  362. package/v3/errors.d.ts +5 -0
  363. package/v3/errors.js +9 -0
  364. package/v3/external.cjs +41 -0
  365. package/v3/external.d.cts +6 -0
  366. package/v3/external.d.ts +6 -0
  367. package/v3/external.js +6 -0
  368. package/v3/helpers/enumUtil.cjs +21 -0
  369. package/v3/helpers/enumUtil.d.cts +8 -0
  370. package/v3/helpers/enumUtil.d.ts +8 -0
  371. package/v3/helpers/enumUtil.js +1 -0
  372. package/v3/helpers/errorUtil.cjs +28 -0
  373. package/v3/helpers/errorUtil.d.cts +9 -0
  374. package/v3/helpers/errorUtil.d.ts +9 -0
  375. package/v3/helpers/errorUtil.js +6 -0
  376. package/v3/helpers/parseUtil.cjs +143 -0
  377. package/v3/helpers/parseUtil.d.cts +78 -0
  378. package/v3/helpers/parseUtil.d.ts +78 -0
  379. package/v3/helpers/parseUtil.js +109 -0
  380. package/v3/helpers/partialUtil.cjs +21 -0
  381. package/v3/helpers/partialUtil.d.cts +8 -0
  382. package/v3/helpers/partialUtil.d.ts +8 -0
  383. package/v3/helpers/partialUtil.js +1 -0
  384. package/v3/helpers/typeAliases.cjs +21 -0
  385. package/v3/helpers/typeAliases.d.cts +2 -0
  386. package/v3/helpers/typeAliases.d.ts +2 -0
  387. package/v3/helpers/typeAliases.js +1 -0
  388. package/v3/helpers/util.cjs +156 -0
  389. package/v3/helpers/util.d.cts +85 -0
  390. package/v3/helpers/util.d.ts +85 -0
  391. package/v3/helpers/util.js +133 -0
  392. package/v3/index.cjs +52 -0
  393. package/v3/index.d.cts +4 -0
  394. package/v3/index.d.ts +4 -0
  395. package/v3/index.js +4 -0
  396. package/v3/locales/en.cjs +112 -0
  397. package/v3/locales/en.d.cts +3 -0
  398. package/v3/locales/en.d.ts +3 -0
  399. package/v3/locales/en.js +109 -0
  400. package/v3/package.json +7 -0
  401. package/v3/standard-schema.cjs +21 -0
  402. package/v3/standard-schema.d.cts +102 -0
  403. package/v3/standard-schema.d.ts +102 -0
  404. package/v3/standard-schema.js +1 -0
  405. package/v3/types.cjs +3806 -0
  406. package/v3/types.d.cts +1034 -0
  407. package/v3/types.d.ts +1034 -0
  408. package/v3/types.js +3705 -0
  409. package/v4/classic/checks.cjs +53 -0
  410. package/v4/classic/checks.d.cts +1 -0
  411. package/v4/classic/checks.d.ts +1 -0
  412. package/v4/classic/checks.js +1 -0
  413. package/v4/classic/coerce.cjs +66 -0
  414. package/v4/classic/coerce.d.cts +17 -0
  415. package/v4/classic/coerce.d.ts +17 -0
  416. package/v4/classic/coerce.js +17 -0
  417. package/v4/classic/compat.cjs +80 -0
  418. package/v4/classic/compat.d.cts +48 -0
  419. package/v4/classic/compat.d.ts +48 -0
  420. package/v4/classic/compat.js +31 -0
  421. package/v4/classic/deep-partial.cjs +58 -0
  422. package/v4/classic/deep-partial.d.cts +14 -0
  423. package/v4/classic/deep-partial.d.ts +14 -0
  424. package/v4/classic/deep-partial.js +13 -0
  425. package/v4/classic/errors.cjs +102 -0
  426. package/v4/classic/errors.d.cts +29 -0
  427. package/v4/classic/errors.d.ts +29 -0
  428. package/v4/classic/errors.js +57 -0
  429. package/v4/classic/external.cjs +97 -0
  430. package/v4/classic/external.d.cts +19 -0
  431. package/v4/classic/external.d.ts +19 -0
  432. package/v4/classic/external.js +17 -0
  433. package/v4/classic/from-json-schema.cjs +926 -0
  434. package/v4/classic/from-json-schema.d.cts +12 -0
  435. package/v4/classic/from-json-schema.d.ts +12 -0
  436. package/v4/classic/from-json-schema.js +881 -0
  437. package/v4/classic/in-out.cjs +82 -0
  438. package/v4/classic/in-out.d.cts +8 -0
  439. package/v4/classic/in-out.d.ts +8 -0
  440. package/v4/classic/in-out.js +36 -0
  441. package/v4/classic/index.cjs +52 -0
  442. package/v4/classic/index.d.cts +3 -0
  443. package/v4/classic/index.d.ts +3 -0
  444. package/v4/classic/index.js +4 -0
  445. package/v4/classic/iso.cjs +68 -0
  446. package/v4/classic/iso.d.cts +7 -0
  447. package/v4/classic/iso.d.ts +7 -0
  448. package/v4/classic/iso.js +15 -0
  449. package/v4/classic/package.json +7 -0
  450. package/v4/classic/parse.cjs +63 -0
  451. package/v4/classic/parse.d.cts +44 -0
  452. package/v4/classic/parse.d.ts +44 -0
  453. package/v4/classic/parse.js +16 -0
  454. package/v4/classic/schemas.cjs +1750 -0
  455. package/v4/classic/schemas.d.cts +819 -0
  456. package/v4/classic/schemas.d.ts +819 -0
  457. package/v4/classic/schemas.js +1609 -0
  458. package/v4/core/api.cjs +1269 -0
  459. package/v4/core/api.d.cts +335 -0
  460. package/v4/core/api.d.ts +335 -0
  461. package/v4/core/api.js +1107 -0
  462. package/v4/core/checks.cjs +561 -0
  463. package/v4/core/checks.d.cts +294 -0
  464. package/v4/core/checks.d.ts +294 -0
  465. package/v4/core/checks.js +516 -0
  466. package/v4/core/compile.cjs +1915 -0
  467. package/v4/core/compile.d.cts +65 -0
  468. package/v4/core/compile.d.ts +65 -0
  469. package/v4/core/compile.js +1865 -0
  470. package/v4/core/core.cjs +167 -0
  471. package/v4/core/core.d.cts +82 -0
  472. package/v4/core/core.d.ts +82 -0
  473. package/v4/core/core.js +141 -0
  474. package/v4/core/doc.cjs +61 -0
  475. package/v4/core/doc.d.cts +16 -0
  476. package/v4/core/doc.d.ts +16 -0
  477. package/v4/core/doc.js +38 -0
  478. package/v4/core/errors.cjs +317 -0
  479. package/v4/core/errors.d.cts +225 -0
  480. package/v4/core/errors.d.ts +225 -0
  481. package/v4/core/errors.js +267 -0
  482. package/v4/core/index.cjs +70 -0
  483. package/v4/core/index.d.cts +19 -0
  484. package/v4/core/index.d.ts +19 -0
  485. package/v4/core/index.js +19 -0
  486. package/v4/core/json-schema-generator.cjs +122 -0
  487. package/v4/core/json-schema-generator.d.cts +65 -0
  488. package/v4/core/json-schema-generator.d.ts +65 -0
  489. package/v4/core/json-schema-generator.js +99 -0
  490. package/v4/core/json-schema-processors.cjs +945 -0
  491. package/v4/core/json-schema-processors.d.cts +65 -0
  492. package/v4/core/json-schema-processors.d.ts +65 -0
  493. package/v4/core/json-schema-processors.js +859 -0
  494. package/v4/core/json-schema.cjs +21 -0
  495. package/v4/core/json-schema.d.cts +89 -0
  496. package/v4/core/json-schema.d.ts +89 -0
  497. package/v4/core/json-schema.js +1 -0
  498. package/v4/core/memoizer.cjs +424 -0
  499. package/v4/core/memoizer.d.cts +15 -0
  500. package/v4/core/memoizer.d.ts +15 -0
  501. package/v4/core/memoizer.js +375 -0
  502. package/v4/core/package.json +7 -0
  503. package/v4/core/parse.cjs +233 -0
  504. package/v4/core/parse.d.cts +52 -0
  505. package/v4/core/parse.d.ts +52 -0
  506. package/v4/core/parse.js +175 -0
  507. package/v4/core/regexes.cjs +209 -0
  508. package/v4/core/regexes.d.cts +90 -0
  509. package/v4/core/regexes.d.ts +90 -0
  510. package/v4/core/regexes.js +156 -0
  511. package/v4/core/registries.cjs +75 -0
  512. package/v4/core/registries.d.cts +35 -0
  513. package/v4/core/registries.d.ts +35 -0
  514. package/v4/core/registries.js +51 -0
  515. package/v4/core/schemas.cjs +2754 -0
  516. package/v4/core/schemas.d.cts +1277 -0
  517. package/v4/core/schemas.d.ts +1277 -0
  518. package/v4/core/schemas.js +2691 -0
  519. package/v4/core/standard-schema.cjs +21 -0
  520. package/v4/core/standard-schema.d.cts +126 -0
  521. package/v4/core/standard-schema.d.ts +126 -0
  522. package/v4/core/standard-schema.js +1 -0
  523. package/v4/core/to-json-schema.cjs +681 -0
  524. package/v4/core/to-json-schema.d.cts +154 -0
  525. package/v4/core/to-json-schema.d.ts +154 -0
  526. package/v4/core/to-json-schema.js +651 -0
  527. package/v4/core/util.cjs +997 -0
  528. package/v4/core/util.d.cts +284 -0
  529. package/v4/core/util.d.ts +284 -0
  530. package/v4/core/util.js +904 -0
  531. package/v4/core/versions.cjs +27 -0
  532. package/v4/core/versions.d.cts +5 -0
  533. package/v4/core/versions.d.ts +5 -0
  534. package/v4/core/versions.js +5 -0
  535. package/v4/core/visit.cjs +214 -0
  536. package/v4/core/visit.d.cts +30 -0
  537. package/v4/core/visit.d.ts +30 -0
  538. package/v4/core/visit.js +169 -0
  539. package/v4/index.cjs +51 -0
  540. package/v4/index.d.cts +3 -0
  541. package/v4/index.d.ts +3 -0
  542. package/v4/index.js +4 -0
  543. package/v4/locales/ar.cjs +138 -0
  544. package/v4/locales/ar.d.cts +5 -0
  545. package/v4/locales/ar.d.ts +4 -0
  546. package/v4/locales/ar.js +111 -0
  547. package/v4/locales/az.cjs +137 -0
  548. package/v4/locales/az.d.cts +5 -0
  549. package/v4/locales/az.d.ts +4 -0
  550. package/v4/locales/az.js +110 -0
  551. package/v4/locales/be.cjs +195 -0
  552. package/v4/locales/be.d.cts +5 -0
  553. package/v4/locales/be.d.ts +4 -0
  554. package/v4/locales/be.js +168 -0
  555. package/v4/locales/bg.cjs +152 -0
  556. package/v4/locales/bg.d.cts +5 -0
  557. package/v4/locales/bg.d.ts +4 -0
  558. package/v4/locales/bg.js +125 -0
  559. package/v4/locales/bn.cjs +140 -0
  560. package/v4/locales/bn.d.cts +5 -0
  561. package/v4/locales/bn.d.ts +4 -0
  562. package/v4/locales/bn.js +113 -0
  563. package/v4/locales/ca.cjs +139 -0
  564. package/v4/locales/ca.d.cts +5 -0
  565. package/v4/locales/ca.d.ts +4 -0
  566. package/v4/locales/ca.js +112 -0
  567. package/v4/locales/ckb.cjs +160 -0
  568. package/v4/locales/ckb.d.cts +5 -0
  569. package/v4/locales/ckb.d.ts +4 -0
  570. package/v4/locales/ckb.js +133 -0
  571. package/v4/locales/cs.cjs +143 -0
  572. package/v4/locales/cs.d.cts +5 -0
  573. package/v4/locales/cs.d.ts +4 -0
  574. package/v4/locales/cs.js +116 -0
  575. package/v4/locales/da.cjs +147 -0
  576. package/v4/locales/da.d.cts +5 -0
  577. package/v4/locales/da.d.ts +4 -0
  578. package/v4/locales/da.js +120 -0
  579. package/v4/locales/de.cjs +140 -0
  580. package/v4/locales/de.d.cts +5 -0
  581. package/v4/locales/de.d.ts +4 -0
  582. package/v4/locales/de.js +113 -0
  583. package/v4/locales/el.cjs +139 -0
  584. package/v4/locales/el.d.cts +5 -0
  585. package/v4/locales/el.d.ts +4 -0
  586. package/v4/locales/el.js +112 -0
  587. package/v4/locales/en.cjs +152 -0
  588. package/v4/locales/en.d.cts +5 -0
  589. package/v4/locales/en.d.ts +4 -0
  590. package/v4/locales/en.js +125 -0
  591. package/v4/locales/eo.cjs +141 -0
  592. package/v4/locales/eo.d.cts +5 -0
  593. package/v4/locales/eo.d.ts +4 -0
  594. package/v4/locales/eo.js +114 -0
  595. package/v4/locales/es.cjs +164 -0
  596. package/v4/locales/es.d.cts +5 -0
  597. package/v4/locales/es.d.ts +4 -0
  598. package/v4/locales/es.js +137 -0
  599. package/v4/locales/fa.cjs +146 -0
  600. package/v4/locales/fa.d.cts +5 -0
  601. package/v4/locales/fa.d.ts +4 -0
  602. package/v4/locales/fa.js +119 -0
  603. package/v4/locales/fi.cjs +144 -0
  604. package/v4/locales/fi.d.cts +5 -0
  605. package/v4/locales/fi.d.ts +4 -0
  606. package/v4/locales/fi.js +117 -0
  607. package/v4/locales/fr-CA.cjs +139 -0
  608. package/v4/locales/fr-CA.d.cts +5 -0
  609. package/v4/locales/fr-CA.d.ts +4 -0
  610. package/v4/locales/fr-CA.js +112 -0
  611. package/v4/locales/fr.cjs +157 -0
  612. package/v4/locales/fr.d.cts +5 -0
  613. package/v4/locales/fr.d.ts +4 -0
  614. package/v4/locales/fr.js +130 -0
  615. package/v4/locales/gu.cjs +140 -0
  616. package/v4/locales/gu.d.cts +5 -0
  617. package/v4/locales/gu.d.ts +4 -0
  618. package/v4/locales/gu.js +113 -0
  619. package/v4/locales/he.cjs +249 -0
  620. package/v4/locales/he.d.cts +5 -0
  621. package/v4/locales/he.d.ts +4 -0
  622. package/v4/locales/he.js +222 -0
  623. package/v4/locales/hi.cjs +138 -0
  624. package/v4/locales/hi.d.cts +5 -0
  625. package/v4/locales/hi.d.ts +4 -0
  626. package/v4/locales/hi.js +111 -0
  627. package/v4/locales/hr.cjs +154 -0
  628. package/v4/locales/hr.d.cts +5 -0
  629. package/v4/locales/hr.d.ts +4 -0
  630. package/v4/locales/hr.js +127 -0
  631. package/v4/locales/hu.cjs +140 -0
  632. package/v4/locales/hu.d.cts +5 -0
  633. package/v4/locales/hu.d.ts +4 -0
  634. package/v4/locales/hu.js +113 -0
  635. package/v4/locales/hy.cjs +185 -0
  636. package/v4/locales/hy.d.cts +5 -0
  637. package/v4/locales/hy.d.ts +4 -0
  638. package/v4/locales/hy.js +158 -0
  639. package/v4/locales/id.cjs +138 -0
  640. package/v4/locales/id.d.cts +5 -0
  641. package/v4/locales/id.d.ts +4 -0
  642. package/v4/locales/id.js +111 -0
  643. package/v4/locales/index.cjs +152 -0
  644. package/v4/locales/index.d.cts +63 -0
  645. package/v4/locales/index.d.ts +63 -0
  646. package/v4/locales/index.js +63 -0
  647. package/v4/locales/is.cjs +141 -0
  648. package/v4/locales/is.d.cts +5 -0
  649. package/v4/locales/is.d.ts +4 -0
  650. package/v4/locales/is.js +114 -0
  651. package/v4/locales/it.cjs +140 -0
  652. package/v4/locales/it.d.cts +5 -0
  653. package/v4/locales/it.d.ts +4 -0
  654. package/v4/locales/it.js +113 -0
  655. package/v4/locales/ja.cjs +139 -0
  656. package/v4/locales/ja.d.cts +5 -0
  657. package/v4/locales/ja.d.ts +4 -0
  658. package/v4/locales/ja.js +112 -0
  659. package/v4/locales/ka.cjs +144 -0
  660. package/v4/locales/ka.d.cts +5 -0
  661. package/v4/locales/ka.d.ts +4 -0
  662. package/v4/locales/ka.js +117 -0
  663. package/v4/locales/kh.cjs +12 -0
  664. package/v4/locales/kh.d.cts +5 -0
  665. package/v4/locales/kh.d.ts +5 -0
  666. package/v4/locales/kh.js +5 -0
  667. package/v4/locales/km.cjs +142 -0
  668. package/v4/locales/km.d.cts +5 -0
  669. package/v4/locales/km.d.ts +4 -0
  670. package/v4/locales/km.js +115 -0
  671. package/v4/locales/kn.cjs +143 -0
  672. package/v4/locales/kn.d.cts +5 -0
  673. package/v4/locales/kn.d.ts +4 -0
  674. package/v4/locales/kn.js +116 -0
  675. package/v4/locales/ko.cjs +143 -0
  676. package/v4/locales/ko.d.cts +5 -0
  677. package/v4/locales/ko.d.ts +4 -0
  678. package/v4/locales/ko.js +116 -0
  679. package/v4/locales/lt.cjs +251 -0
  680. package/v4/locales/lt.d.cts +5 -0
  681. package/v4/locales/lt.d.ts +4 -0
  682. package/v4/locales/lt.js +224 -0
  683. package/v4/locales/mk.cjs +141 -0
  684. package/v4/locales/mk.d.cts +5 -0
  685. package/v4/locales/mk.d.ts +4 -0
  686. package/v4/locales/mk.js +114 -0
  687. package/v4/locales/ms.cjs +139 -0
  688. package/v4/locales/ms.d.cts +5 -0
  689. package/v4/locales/ms.d.ts +4 -0
  690. package/v4/locales/ms.js +112 -0
  691. package/v4/locales/ne.cjs +138 -0
  692. package/v4/locales/ne.d.cts +5 -0
  693. package/v4/locales/ne.d.ts +4 -0
  694. package/v4/locales/ne.js +111 -0
  695. package/v4/locales/nl.cjs +142 -0
  696. package/v4/locales/nl.d.cts +5 -0
  697. package/v4/locales/nl.d.ts +4 -0
  698. package/v4/locales/nl.js +115 -0
  699. package/v4/locales/nn.cjs +140 -0
  700. package/v4/locales/nn.d.cts +5 -0
  701. package/v4/locales/nn.d.ts +4 -0
  702. package/v4/locales/nn.js +113 -0
  703. package/v4/locales/no.cjs +140 -0
  704. package/v4/locales/no.d.cts +5 -0
  705. package/v4/locales/no.d.ts +4 -0
  706. package/v4/locales/no.js +113 -0
  707. package/v4/locales/ota.cjs +141 -0
  708. package/v4/locales/ota.d.cts +5 -0
  709. package/v4/locales/ota.d.ts +4 -0
  710. package/v4/locales/ota.js +114 -0
  711. package/v4/locales/package.json +7 -0
  712. package/v4/locales/pl.cjs +141 -0
  713. package/v4/locales/pl.d.cts +5 -0
  714. package/v4/locales/pl.d.ts +4 -0
  715. package/v4/locales/pl.js +114 -0
  716. package/v4/locales/ps.cjs +146 -0
  717. package/v4/locales/ps.d.cts +5 -0
  718. package/v4/locales/ps.d.ts +4 -0
  719. package/v4/locales/ps.js +119 -0
  720. package/v4/locales/pt-BR.cjs +170 -0
  721. package/v4/locales/pt-BR.d.cts +5 -0
  722. package/v4/locales/pt-BR.d.ts +4 -0
  723. package/v4/locales/pt-BR.js +143 -0
  724. package/v4/locales/pt.cjs +169 -0
  725. package/v4/locales/pt.d.cts +5 -0
  726. package/v4/locales/pt.d.ts +4 -0
  727. package/v4/locales/pt.js +142 -0
  728. package/v4/locales/ro.cjs +149 -0
  729. package/v4/locales/ro.d.cts +5 -0
  730. package/v4/locales/ro.d.ts +4 -0
  731. package/v4/locales/ro.js +122 -0
  732. package/v4/locales/ru.cjs +195 -0
  733. package/v4/locales/ru.d.cts +5 -0
  734. package/v4/locales/ru.d.ts +4 -0
  735. package/v4/locales/ru.js +168 -0
  736. package/v4/locales/sk.cjs +143 -0
  737. package/v4/locales/sk.d.cts +5 -0
  738. package/v4/locales/sk.d.ts +4 -0
  739. package/v4/locales/sk.js +116 -0
  740. package/v4/locales/sl.cjs +141 -0
  741. package/v4/locales/sl.d.cts +5 -0
  742. package/v4/locales/sl.d.ts +4 -0
  743. package/v4/locales/sl.js +114 -0
  744. package/v4/locales/sv.cjs +142 -0
  745. package/v4/locales/sv.d.cts +5 -0
  746. package/v4/locales/sv.d.ts +4 -0
  747. package/v4/locales/sv.js +115 -0
  748. package/v4/locales/ta.cjs +142 -0
  749. package/v4/locales/ta.d.cts +5 -0
  750. package/v4/locales/ta.d.ts +4 -0
  751. package/v4/locales/ta.js +115 -0
  752. package/v4/locales/tg.cjs +144 -0
  753. package/v4/locales/tg.d.cts +5 -0
  754. package/v4/locales/tg.d.ts +4 -0
  755. package/v4/locales/tg.js +117 -0
  756. package/v4/locales/th.cjs +142 -0
  757. package/v4/locales/th.d.cts +5 -0
  758. package/v4/locales/th.d.ts +4 -0
  759. package/v4/locales/th.js +115 -0
  760. package/v4/locales/tk.cjs +134 -0
  761. package/v4/locales/tk.d.cts +5 -0
  762. package/v4/locales/tk.d.ts +4 -0
  763. package/v4/locales/tk.js +107 -0
  764. package/v4/locales/tr.cjs +137 -0
  765. package/v4/locales/tr.d.cts +5 -0
  766. package/v4/locales/tr.d.ts +4 -0
  767. package/v4/locales/tr.js +110 -0
  768. package/v4/locales/ua.cjs +12 -0
  769. package/v4/locales/ua.d.cts +5 -0
  770. package/v4/locales/ua.d.ts +5 -0
  771. package/v4/locales/ua.js +5 -0
  772. package/v4/locales/uk.cjs +140 -0
  773. package/v4/locales/uk.d.cts +5 -0
  774. package/v4/locales/uk.d.ts +4 -0
  775. package/v4/locales/uk.js +113 -0
  776. package/v4/locales/ur.cjs +142 -0
  777. package/v4/locales/ur.d.cts +5 -0
  778. package/v4/locales/ur.d.ts +4 -0
  779. package/v4/locales/ur.js +115 -0
  780. package/v4/locales/uz.cjs +140 -0
  781. package/v4/locales/uz.d.cts +5 -0
  782. package/v4/locales/uz.d.ts +4 -0
  783. package/v4/locales/uz.js +113 -0
  784. package/v4/locales/vi.cjs +140 -0
  785. package/v4/locales/vi.d.cts +5 -0
  786. package/v4/locales/vi.d.ts +4 -0
  787. package/v4/locales/vi.js +113 -0
  788. package/v4/locales/yo.cjs +139 -0
  789. package/v4/locales/yo.d.cts +5 -0
  790. package/v4/locales/yo.d.ts +4 -0
  791. package/v4/locales/yo.js +112 -0
  792. package/v4/locales/zh-CN.cjs +141 -0
  793. package/v4/locales/zh-CN.d.cts +5 -0
  794. package/v4/locales/zh-CN.d.ts +4 -0
  795. package/v4/locales/zh-CN.js +114 -0
  796. package/v4/locales/zh-TW.cjs +139 -0
  797. package/v4/locales/zh-TW.d.cts +5 -0
  798. package/v4/locales/zh-TW.d.ts +4 -0
  799. package/v4/locales/zh-TW.js +112 -0
  800. package/v4/mini/checks.cjs +54 -0
  801. package/v4/mini/checks.d.cts +1 -0
  802. package/v4/mini/checks.d.ts +1 -0
  803. package/v4/mini/checks.js +1 -0
  804. package/v4/mini/coerce.cjs +71 -0
  805. package/v4/mini/coerce.d.cts +7 -0
  806. package/v4/mini/coerce.d.ts +7 -0
  807. package/v4/mini/coerce.js +22 -0
  808. package/v4/mini/deep-partial.cjs +58 -0
  809. package/v4/mini/deep-partial.d.cts +14 -0
  810. package/v4/mini/deep-partial.d.ts +14 -0
  811. package/v4/mini/deep-partial.js +13 -0
  812. package/v4/mini/external.cjs +95 -0
  813. package/v4/mini/external.d.cts +16 -0
  814. package/v4/mini/external.d.ts +16 -0
  815. package/v4/mini/external.js +16 -0
  816. package/v4/mini/in-out.cjs +82 -0
  817. package/v4/mini/in-out.d.cts +8 -0
  818. package/v4/mini/in-out.d.ts +8 -0
  819. package/v4/mini/in-out.js +36 -0
  820. package/v4/mini/index.cjs +51 -0
  821. package/v4/mini/index.d.cts +3 -0
  822. package/v4/mini/index.d.ts +3 -0
  823. package/v4/mini/index.js +3 -0
  824. package/v4/mini/iso.cjs +83 -0
  825. package/v4/mini/iso.d.cts +22 -0
  826. package/v4/mini/iso.d.ts +22 -0
  827. package/v4/mini/iso.js +34 -0
  828. package/v4/mini/package.json +7 -0
  829. package/v4/mini/parse.cjs +37 -0
  830. package/v4/mini/parse.d.cts +1 -0
  831. package/v4/mini/parse.d.ts +1 -0
  832. package/v4/mini/parse.js +1 -0
  833. package/v4/mini/schemas.cjs +1147 -0
  834. package/v4/mini/schemas.d.cts +480 -0
  835. package/v4/mini/schemas.d.ts +480 -0
  836. package/v4/mini/schemas.js +1002 -0
  837. package/v4/package.json +7 -0
  838. package/v4-mini/index.cjs +51 -0
  839. package/v4-mini/index.d.cts +3 -0
  840. package/v4-mini/index.d.ts +3 -0
  841. package/v4-mini/index.js +3 -0
  842. package/v4-mini/package.json +7 -0
@@ -0,0 +1,1750 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodXor = 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.ZodIBAN = exports.ZodCreditCard = exports.ZodE164 = exports.ZodBase64URL = exports.ZodBase64 = exports.ZodCIDRv6 = exports.ZodCIDRv4 = exports.ZodIPv6 = exports.ZodMAC = exports.ZodIPv4 = exports.ZodKSUID = exports.ZodXID = exports.ZodULID = exports.ZodCUID2 = exports.ZodCUID = exports.ZodNanoID = exports.ZodEmoji = exports.ZodURL = exports.ZodUUID = exports.ZodGUID = exports.ZodEmail = exports.ZodISODuration = exports.ZodISOTime = exports.ZodISODate = exports.ZodISODateTime = exports.ZodStringFormat = exports.ZodString = exports._ZodString = exports.ZodType = void 0;
30
+ exports.stringbool = exports.ZodInstanceOf = exports.meta = exports.describe = exports.ZodCustom = exports.ZodFunction = exports.ZodPromise = exports.ZodLazy = exports.ZodTemplateLiteral = exports.ZodReadonly = exports.ZodPreprocess = exports.ZodCodec = exports.ZodPipe = exports.ZodNaN = exports.ZodCatch = exports.ZodSuccess = exports.ZodNonOptional = exports.ZodPrefault = exports.ZodDefault = exports.ZodNullable = exports.ZodExactOptional = exports.ZodOptional = exports.ZodTransform = exports.ZodFile = exports.ZodLiteral = exports.ZodEnum = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = void 0;
31
+ exports.string = string;
32
+ exports.email = email;
33
+ exports.guid = guid;
34
+ exports.uuid = uuid;
35
+ exports.uuidv4 = uuidv4;
36
+ exports.uuidv6 = uuidv6;
37
+ exports.uuidv7 = uuidv7;
38
+ exports.url = url;
39
+ exports.httpUrl = httpUrl;
40
+ exports.emoji = emoji;
41
+ exports.nanoid = nanoid;
42
+ exports.cuid = cuid;
43
+ exports.cuid2 = cuid2;
44
+ exports.ulid = ulid;
45
+ exports.xid = xid;
46
+ exports.ksuid = ksuid;
47
+ exports.ipv4 = ipv4;
48
+ exports.mac = mac;
49
+ exports.ipv6 = ipv6;
50
+ exports.cidrv4 = cidrv4;
51
+ exports.cidrv6 = cidrv6;
52
+ exports.base64 = base64;
53
+ exports.base64url = base64url;
54
+ exports.e164 = e164;
55
+ exports.creditCard = creditCard;
56
+ exports.iban = iban;
57
+ exports.jwt = jwt;
58
+ exports.stringFormat = stringFormat;
59
+ exports.hostname = hostname;
60
+ exports.hex = hex;
61
+ exports.currencyCode = currencyCode;
62
+ exports.hash = hash;
63
+ exports.number = number;
64
+ exports.int = int;
65
+ exports.float32 = float32;
66
+ exports.float64 = float64;
67
+ exports.int32 = int32;
68
+ exports.uint32 = uint32;
69
+ exports.boolean = boolean;
70
+ exports.bigint = bigint;
71
+ exports.int64 = int64;
72
+ exports.uint64 = uint64;
73
+ exports.symbol = symbol;
74
+ exports.undefined = _undefined;
75
+ exports.null = _null;
76
+ exports.any = any;
77
+ exports.unknown = unknown;
78
+ exports.never = never;
79
+ exports.void = _void;
80
+ exports.date = date;
81
+ exports.array = array;
82
+ exports.keyof = keyof;
83
+ exports.object = object;
84
+ exports.strictObject = strictObject;
85
+ exports.looseObject = looseObject;
86
+ exports.union = union;
87
+ exports.xor = xor;
88
+ exports.discriminatedUnion = discriminatedUnion;
89
+ exports.intersection = intersection;
90
+ exports.tuple = tuple;
91
+ exports.record = record;
92
+ exports.partialRecord = partialRecord;
93
+ exports.looseRecord = looseRecord;
94
+ exports.map = map;
95
+ exports.set = set;
96
+ exports.enum = _enum;
97
+ exports.nativeEnum = nativeEnum;
98
+ exports.literal = literal;
99
+ exports.file = file;
100
+ exports.transform = transform;
101
+ exports.optional = optional;
102
+ exports.exactOptional = exactOptional;
103
+ exports.nullable = nullable;
104
+ exports.nullish = nullish;
105
+ exports._default = _default;
106
+ exports.prefault = prefault;
107
+ exports.nonoptional = nonoptional;
108
+ exports.success = success;
109
+ exports.catch = _catch;
110
+ exports.nan = nan;
111
+ exports.pipe = pipe;
112
+ exports.codec = codec;
113
+ exports.invertCodec = invertCodec;
114
+ exports.readonly = readonly;
115
+ exports.templateLiteral = templateLiteral;
116
+ exports.lazy = lazy;
117
+ exports.promise = promise;
118
+ exports._function = _function;
119
+ exports.function = _function;
120
+ exports._function = _function;
121
+ exports.function = _function;
122
+ exports.check = check;
123
+ exports.custom = custom;
124
+ exports.refine = refine;
125
+ exports.superRefine = superRefine;
126
+ exports.instanceof = _instanceof;
127
+ exports.json = json;
128
+ exports.preprocess = preprocess;
129
+ const core = __importStar(require("../core/index.cjs"));
130
+ const index_js_1 = require("../core/index.cjs");
131
+ const processors = __importStar(require("../core/json-schema-processors.cjs"));
132
+ const regexes = __importStar(require("../core/regexes.cjs"));
133
+ const to_json_schema_js_1 = require("../core/to-json-schema.cjs");
134
+ const en_js_1 = __importDefault(require("../locales/en.cjs"));
135
+ const checks = __importStar(require("./checks.cjs"));
136
+ const parse = __importStar(require("./parse.cjs"));
137
+ // Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.
138
+ function _ensureDefaultLocale() {
139
+ if (!core.globalConfig.localeError)
140
+ core.config((0, en_js_1.default)());
141
+ }
142
+ // the default memoizer is read by the core container init, which runs before `ZodType.init`, so each container calls this first
143
+ function _ensureDefaultMemoizer() {
144
+ if (!core.globalConfig.memoizer)
145
+ core.config({ memoizer: core.memoizer() });
146
+ }
147
+ // path segments descend through object shapes, `[]` into array elements, and transparently through wrappers that expose `innerType`; whatever remains selects checks by name and optional value
148
+ function _updateMessage(node, key, segs, error) {
149
+ const def = node._zod.def;
150
+ if (def.innerType)
151
+ return core.clone(node, { ...def, innerType: _updateMessage(def.innerType, key, segs, error) }, { parent: true });
152
+ const [seg, ...rest] = segs;
153
+ if (seg !== undefined && def.shape && Object.prototype.hasOwnProperty.call(def.shape, seg)) {
154
+ return core.clone(node, { ...def, shape: { ...def.shape, [seg]: _updateMessage(def.shape[seg], key, rest, error) } }, { parent: true });
155
+ }
156
+ if (seg === "[]" && def.element)
157
+ return core.clone(node, { ...def, element: _updateMessage(def.element, key, rest, error) }, { parent: true });
158
+ if (seg === undefined)
159
+ return core.clone(node, { ...def, error }, { parent: true });
160
+ if (rest.length > 1)
161
+ throw new Error(`update(): cannot resolve "${key}"`);
162
+ // schemas that act as their own check, e.g. z.int() or z.email()
163
+ if (def.check && _checkMatches(def, seg, rest[0]))
164
+ return core.clone(node, { ...def, error }, { parent: true });
165
+ let matched = false;
166
+ const nextChecks = (def.checks ?? []).map((ch) => {
167
+ if (!_checkMatches(ch._zod.def, seg, rest[0]))
168
+ return ch;
169
+ matched = true;
170
+ return core.clone(ch, { ...ch._zod.def, error });
171
+ });
172
+ if (!matched)
173
+ throw new Error(`update(): no "${seg}" check found for "${key}"`);
174
+ return core.clone(node, { ...def, checks: nextChecks }, { parent: true });
175
+ }
176
+ function _checkMatches(def, name, value) {
177
+ const kind = def.check;
178
+ let names;
179
+ let val;
180
+ if (kind === "min_length" || kind === "min_size")
181
+ [names, val] = [["min"], def.minimum];
182
+ else if (kind === "max_length" || kind === "max_size")
183
+ [names, val] = [["max"], def.maximum];
184
+ else if (kind === "length_equals")
185
+ [names, val] = [["length"], def.length];
186
+ else if (kind === "size_equals")
187
+ [names, val] = [["size"], def.size];
188
+ else if (kind === "greater_than")
189
+ [names, val] = [def.inclusive ? ["gte", "min"] : ["gt"], def.value];
190
+ else if (kind === "less_than")
191
+ [names, val] = [def.inclusive ? ["lte", "max"] : ["lt"], def.value];
192
+ else if (kind === "multiple_of")
193
+ [names, val] = [["multipleOf", "step"], def.value];
194
+ else if (kind === "string_format" || kind === "number_format" || kind === "bigint_format") {
195
+ names = [def.format, def.format.replace(/_([a-z])/g, (_, c) => c.toUpperCase())];
196
+ if (kind !== "string_format" && def.format.includes("int"))
197
+ names.push("int");
198
+ }
199
+ else if (kind === "custom")
200
+ names = ["refine"];
201
+ else
202
+ names = [];
203
+ names.push(kind);
204
+ if (!names.includes(name))
205
+ return false;
206
+ return value === undefined || ((typeof val === "number" || typeof val === "bigint") && String(val) === value);
207
+ }
208
+ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
209
+ _ensureDefaultLocale();
210
+ core.$ZodType.init(inst, def);
211
+ inst.def = def;
212
+ inst.type = def.type;
213
+ return inst;
214
+ }, {
215
+ check(...chks) {
216
+ const def = this.def;
217
+ return this.clone(index_js_1.util.mergeDefs(def, {
218
+ checks: [
219
+ ...(def.checks ?? []),
220
+ ...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
221
+ ],
222
+ }), { parent: true });
223
+ },
224
+ with(...chks) {
225
+ return this.check(...chks);
226
+ },
227
+ clone(def, params) {
228
+ return core.clone(this, def, params);
229
+ },
230
+ brand() {
231
+ return this;
232
+ },
233
+ register(reg, meta) {
234
+ reg.add(this, meta);
235
+ return this;
236
+ },
237
+ refine(check, params) {
238
+ return this.check(refine(check, params));
239
+ },
240
+ superRefine(refinement, params) {
241
+ return this.check(superRefine(refinement, params));
242
+ },
243
+ overwrite(fn) {
244
+ return this.check(checks.overwrite(fn));
245
+ },
246
+ optional() {
247
+ return optional(this);
248
+ },
249
+ exactOptional() {
250
+ return exactOptional(this);
251
+ },
252
+ nullable() {
253
+ return nullable(this);
254
+ },
255
+ nullish() {
256
+ return optional(nullable(this));
257
+ },
258
+ nonoptional(params) {
259
+ return nonoptional(this, params);
260
+ },
261
+ array() {
262
+ return array(this);
263
+ },
264
+ or(arg) {
265
+ return union([this, arg]);
266
+ },
267
+ and(arg) {
268
+ return intersection(this, arg);
269
+ },
270
+ transform(tx) {
271
+ return pipe(this, transform(tx));
272
+ },
273
+ default(d) {
274
+ return _default(this, d);
275
+ },
276
+ prefault(d) {
277
+ return prefault(this, d);
278
+ },
279
+ catch(params) {
280
+ return _catch(this, params);
281
+ },
282
+ pipe(target) {
283
+ return pipe(this, target);
284
+ },
285
+ readonly() {
286
+ return readonly(this);
287
+ },
288
+ describe(description) {
289
+ const cl = this.clone();
290
+ core.globalRegistry.add(cl, { description });
291
+ return cl;
292
+ },
293
+ meta(...args) {
294
+ // overloaded: meta() returns the registered metadata, meta(data) returns a clone with `data` registered. The mapped type picks up the second overload, so we accept variadic any-args and return `any` to satisfy both at runtime.
295
+ if (args.length === 0)
296
+ return core.globalRegistry.get(this);
297
+ const cl = this.clone();
298
+ core.globalRegistry.add(cl, args[0]);
299
+ return cl;
300
+ },
301
+ isOptional() {
302
+ return this.safeParse(undefined).success;
303
+ },
304
+ isNullable() {
305
+ return this.safeParse(null).success;
306
+ },
307
+ apply(fn, ...args) {
308
+ return args.length === 0 ? fn(this) : fn(this, ...args);
309
+ },
310
+ update(messages) {
311
+ let out = this;
312
+ for (const key in messages) {
313
+ const message = messages[key];
314
+ out = _updateMessage(out, key, key.split("."), (typeof message === "string" ? () => message : message));
315
+ }
316
+ return out;
317
+ },
318
+ // Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode.
319
+ get "~standard"() {
320
+ return index_js_1.util.hide(this, "~standard", {
321
+ ...core.standardProps(this),
322
+ jsonSchema: {
323
+ input: (0, to_json_schema_js_1.createStandardJSONSchemaMethod)(this, "input"),
324
+ output: (0, to_json_schema_js_1.createStandardJSONSchemaMethod)(this, "output"),
325
+ },
326
+ });
327
+ },
328
+ set "~standard"(value) {
329
+ index_js_1.util.own(this, "~standard", value);
330
+ },
331
+ parse: function _parse(data, params) {
332
+ return parse.parse(this, data, params, { callee: _parse });
333
+ },
334
+ parseAsync: async function _parseAsync(data, params) {
335
+ return await parse.parseAsync(this, data, params, { callee: _parseAsync });
336
+ },
337
+ safeParse(data, params) {
338
+ return parse.safeParse(this, data, params);
339
+ },
340
+ async safeParseAsync(data, params) {
341
+ return parse.safeParseAsync(this, data, params);
342
+ },
343
+ // `spa` is an alias: same function object as `safeParseAsync`, as before.
344
+ get spa() {
345
+ return this?.safeParseAsync;
346
+ },
347
+ set spa(value) {
348
+ index_js_1.util.own(this, "spa", value);
349
+ },
350
+ validate(data, params) {
351
+ return parse.validate(this, data, params);
352
+ },
353
+ validateAsync(data, params) {
354
+ return parse.validateAsync(this, data, params);
355
+ },
356
+ encode: function _encode(data, params) {
357
+ return parse.encode(this, data, params, { callee: _encode });
358
+ },
359
+ decode: function _decode(data, params) {
360
+ return parse.decode(this, data, params, { callee: _decode });
361
+ },
362
+ encodeAsync: async function _encodeAsync(data, params) {
363
+ return await parse.encodeAsync(this, data, params, { callee: _encodeAsync });
364
+ },
365
+ decodeAsync: async function _decodeAsync(data, params) {
366
+ return await parse.decodeAsync(this, data, params, { callee: _decodeAsync });
367
+ },
368
+ safeEncode(data, params) {
369
+ return parse.safeEncode(this, data, params);
370
+ },
371
+ safeDecode(data, params) {
372
+ return parse.safeDecode(this, data, params);
373
+ },
374
+ async safeEncodeAsync(data, params) {
375
+ return parse.safeEncodeAsync(this, data, params);
376
+ },
377
+ async safeDecodeAsync(data, params) {
378
+ return parse.safeDecodeAsync(this, data, params);
379
+ },
380
+ toJSONSchema(params) {
381
+ return (0, to_json_schema_js_1.createToJSONSchemaMethod)(this, {})(params);
382
+ },
383
+ // Reads through to the registry on every access, so it must not cache.
384
+ get description() {
385
+ return core.globalRegistry.get(this)?.description;
386
+ },
387
+ // No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.
388
+ get _def() {
389
+ return this._zod.def;
390
+ },
391
+ });
392
+ /** @internal */
393
+ exports._ZodString = core.$constructor("_ZodString", (inst, def) => {
394
+ core.$ZodString.init(inst, def);
395
+ exports.ZodType.init(inst, def);
396
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);
397
+ },
398
+ /*@__PURE__*/ index_js_1.util.derived({
399
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
400
+ minLength: (inst) => processors.aggregateChecks(inst).minimum ?? null,
401
+ maxLength: (inst) => processors.aggregateChecks(inst).maximum ?? null,
402
+ }, {
403
+ regex(...args) {
404
+ return this.check(checks.regex(...args));
405
+ },
406
+ includes(...args) {
407
+ return this.check(checks.includes(...args));
408
+ },
409
+ startsWith(...args) {
410
+ return this.check(checks.startsWith(...args));
411
+ },
412
+ endsWith(...args) {
413
+ return this.check(checks.endsWith(...args));
414
+ },
415
+ min(...args) {
416
+ return this.check(checks.minLength(...args));
417
+ },
418
+ max(...args) {
419
+ return this.check(checks.maxLength(...args));
420
+ },
421
+ length(...args) {
422
+ return this.check(checks.length(...args));
423
+ },
424
+ nonempty(...args) {
425
+ return this.check(checks.minLength(1, ...args));
426
+ },
427
+ lowercase(params) {
428
+ return this.check(checks.lowercase(params));
429
+ },
430
+ uppercase(params) {
431
+ return this.check(checks.uppercase(params));
432
+ },
433
+ trim() {
434
+ return this.check(checks.trim());
435
+ },
436
+ normalize(...args) {
437
+ return this.check(checks.normalize(...args));
438
+ },
439
+ toLowerCase() {
440
+ return this.check(checks.toLowerCase());
441
+ },
442
+ toUpperCase() {
443
+ return this.check(checks.toUpperCase());
444
+ },
445
+ slugify() {
446
+ return this.check(checks.slugify());
447
+ },
448
+ }));
449
+ exports.ZodString = core.$constructor("ZodString", (inst, def) => {
450
+ core.$ZodString.init(inst, def);
451
+ exports._ZodString.init(inst, def);
452
+ }, {
453
+ email(params) {
454
+ return this.check(core._email(exports.ZodEmail, params));
455
+ },
456
+ url(params) {
457
+ return this.check(core._url(exports.ZodURL, params));
458
+ },
459
+ jwt(params) {
460
+ return this.check(core._jwt(exports.ZodJWT, params));
461
+ },
462
+ emoji(params) {
463
+ return this.check(core._emoji(exports.ZodEmoji, params));
464
+ },
465
+ guid(params) {
466
+ return this.check(core._guid(exports.ZodGUID, params));
467
+ },
468
+ uuid(params) {
469
+ return this.check(core._uuid(exports.ZodUUID, params));
470
+ },
471
+ uuidv4(params) {
472
+ return this.check(core._uuidv4(exports.ZodUUID, params));
473
+ },
474
+ uuidv6(params) {
475
+ return this.check(core._uuidv6(exports.ZodUUID, params));
476
+ },
477
+ uuidv7(params) {
478
+ return this.check(core._uuidv7(exports.ZodUUID, params));
479
+ },
480
+ nanoid(params) {
481
+ return this.check(core._nanoid(exports.ZodNanoID, params));
482
+ },
483
+ cuid(params) {
484
+ return this.check(core._cuid(exports.ZodCUID, params));
485
+ },
486
+ cuid2(params) {
487
+ return this.check(core._cuid2(exports.ZodCUID2, params));
488
+ },
489
+ ulid(params) {
490
+ return this.check(core._ulid(exports.ZodULID, params));
491
+ },
492
+ base64(params) {
493
+ return this.check(core._base64(exports.ZodBase64, params));
494
+ },
495
+ base64url(params) {
496
+ return this.check(core._base64url(exports.ZodBase64URL, params));
497
+ },
498
+ xid(params) {
499
+ return this.check(core._xid(exports.ZodXID, params));
500
+ },
501
+ ksuid(params) {
502
+ return this.check(core._ksuid(exports.ZodKSUID, params));
503
+ },
504
+ ipv4(params) {
505
+ return this.check(core._ipv4(exports.ZodIPv4, params));
506
+ },
507
+ ipv6(params) {
508
+ return this.check(core._ipv6(exports.ZodIPv6, params));
509
+ },
510
+ cidrv4(params) {
511
+ return this.check(core._cidrv4(exports.ZodCIDRv4, params));
512
+ },
513
+ cidrv6(params) {
514
+ return this.check(core._cidrv6(exports.ZodCIDRv6, params));
515
+ },
516
+ e164(params) {
517
+ return this.check(core._e164(exports.ZodE164, params));
518
+ },
519
+ datetime(params) {
520
+ return this.check(core._isoDateTime(exports.ZodISODateTime, params));
521
+ },
522
+ date(params) {
523
+ return this.check(core._isoDate(exports.ZodISODate, params));
524
+ },
525
+ time(params) {
526
+ return this.check(core._isoTime(exports.ZodISOTime, params));
527
+ },
528
+ duration(params) {
529
+ return this.check(core._isoDuration(exports.ZodISODuration, params));
530
+ },
531
+ });
532
+ function string(params) {
533
+ return core._string(exports.ZodString, params);
534
+ }
535
+ exports.ZodStringFormat = core.$constructor("ZodStringFormat", (inst, def) => {
536
+ core.$ZodStringFormat.init(inst, def);
537
+ exports._ZodString.init(inst, def);
538
+ });
539
+ exports.ZodISODateTime = core.$constructor("ZodISODateTime", (inst, def) => {
540
+ core.$ZodISODateTime.init(inst, def);
541
+ exports.ZodStringFormat.init(inst, def);
542
+ });
543
+ exports.ZodISODate = core.$constructor("ZodISODate", (inst, def) => {
544
+ core.$ZodISODate.init(inst, def);
545
+ exports.ZodStringFormat.init(inst, def);
546
+ });
547
+ exports.ZodISOTime = core.$constructor("ZodISOTime", (inst, def) => {
548
+ core.$ZodISOTime.init(inst, def);
549
+ exports.ZodStringFormat.init(inst, def);
550
+ });
551
+ exports.ZodISODuration = core.$constructor("ZodISODuration", (inst, def) => {
552
+ core.$ZodISODuration.init(inst, def);
553
+ exports.ZodStringFormat.init(inst, def);
554
+ });
555
+ exports.ZodEmail = core.$constructor("ZodEmail", (inst, def) => {
556
+ // ZodStringFormat.init(inst, def);
557
+ core.$ZodEmail.init(inst, def);
558
+ exports.ZodStringFormat.init(inst, def);
559
+ });
560
+ function email(params) {
561
+ return core._email(exports.ZodEmail, params);
562
+ }
563
+ exports.ZodGUID = core.$constructor("ZodGUID", (inst, def) => {
564
+ // ZodStringFormat.init(inst, def);
565
+ core.$ZodGUID.init(inst, def);
566
+ exports.ZodStringFormat.init(inst, def);
567
+ });
568
+ function guid(params) {
569
+ return core._guid(exports.ZodGUID, params);
570
+ }
571
+ exports.ZodUUID = core.$constructor("ZodUUID", (inst, def) => {
572
+ // ZodStringFormat.init(inst, def);
573
+ core.$ZodUUID.init(inst, def);
574
+ exports.ZodStringFormat.init(inst, def);
575
+ });
576
+ function uuid(params) {
577
+ return core._uuid(exports.ZodUUID, params);
578
+ }
579
+ function uuidv4(params) {
580
+ return core._uuidv4(exports.ZodUUID, params);
581
+ }
582
+ // ZodUUIDv6
583
+ function uuidv6(params) {
584
+ return core._uuidv6(exports.ZodUUID, params);
585
+ }
586
+ // ZodUUIDv7
587
+ function uuidv7(params) {
588
+ return core._uuidv7(exports.ZodUUID, params);
589
+ }
590
+ exports.ZodURL = core.$constructor("ZodURL", (inst, def) => {
591
+ // ZodStringFormat.init(inst, def);
592
+ core.$ZodURL.init(inst, def);
593
+ exports.ZodStringFormat.init(inst, def);
594
+ });
595
+ function url(params) {
596
+ return core._url(exports.ZodURL, params);
597
+ }
598
+ function httpUrl(params) {
599
+ return core._url(exports.ZodURL, {
600
+ protocol: regexes.httpProtocol,
601
+ hostname: regexes.domain,
602
+ ...index_js_1.util.normalizeParams(params),
603
+ });
604
+ }
605
+ exports.ZodEmoji = core.$constructor("ZodEmoji", (inst, def) => {
606
+ // ZodStringFormat.init(inst, def);
607
+ core.$ZodEmoji.init(inst, def);
608
+ exports.ZodStringFormat.init(inst, def);
609
+ });
610
+ function emoji(params) {
611
+ return core._emoji(exports.ZodEmoji, params);
612
+ }
613
+ exports.ZodNanoID = core.$constructor("ZodNanoID", (inst, def) => {
614
+ // ZodStringFormat.init(inst, def);
615
+ core.$ZodNanoID.init(inst, def);
616
+ exports.ZodStringFormat.init(inst, def);
617
+ });
618
+ function nanoid(params) {
619
+ return core._nanoid(exports.ZodNanoID, params);
620
+ }
621
+ /**
622
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
623
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
624
+ * See https://github.com/paralleldrive/cuid.
625
+ */
626
+ exports.ZodCUID = core.$constructor("ZodCUID", (inst, def) => {
627
+ // ZodStringFormat.init(inst, def);
628
+ core.$ZodCUID.init(inst, def);
629
+ exports.ZodStringFormat.init(inst, def);
630
+ });
631
+ /**
632
+ * Validates a CUID v1 string.
633
+ *
634
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
635
+ * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
636
+ * See https://github.com/paralleldrive/cuid.
637
+ */
638
+ function cuid(params) {
639
+ return core._cuid(exports.ZodCUID, params);
640
+ }
641
+ exports.ZodCUID2 = core.$constructor("ZodCUID2", (inst, def) => {
642
+ // ZodStringFormat.init(inst, def);
643
+ core.$ZodCUID2.init(inst, def);
644
+ exports.ZodStringFormat.init(inst, def);
645
+ });
646
+ function cuid2(params) {
647
+ return core._cuid2(exports.ZodCUID2, params);
648
+ }
649
+ exports.ZodULID = core.$constructor("ZodULID", (inst, def) => {
650
+ // ZodStringFormat.init(inst, def);
651
+ core.$ZodULID.init(inst, def);
652
+ exports.ZodStringFormat.init(inst, def);
653
+ });
654
+ function ulid(params) {
655
+ return core._ulid(exports.ZodULID, params);
656
+ }
657
+ exports.ZodXID = core.$constructor("ZodXID", (inst, def) => {
658
+ // ZodStringFormat.init(inst, def);
659
+ core.$ZodXID.init(inst, def);
660
+ exports.ZodStringFormat.init(inst, def);
661
+ });
662
+ function xid(params) {
663
+ return core._xid(exports.ZodXID, params);
664
+ }
665
+ exports.ZodKSUID = core.$constructor("ZodKSUID", (inst, def) => {
666
+ // ZodStringFormat.init(inst, def);
667
+ core.$ZodKSUID.init(inst, def);
668
+ exports.ZodStringFormat.init(inst, def);
669
+ });
670
+ function ksuid(params) {
671
+ return core._ksuid(exports.ZodKSUID, params);
672
+ }
673
+ exports.ZodIPv4 = core.$constructor("ZodIPv4", (inst, def) => {
674
+ // ZodStringFormat.init(inst, def);
675
+ core.$ZodIPv4.init(inst, def);
676
+ exports.ZodStringFormat.init(inst, def);
677
+ });
678
+ function ipv4(params) {
679
+ return core._ipv4(exports.ZodIPv4, params);
680
+ }
681
+ exports.ZodMAC = core.$constructor("ZodMAC", (inst, def) => {
682
+ // ZodStringFormat.init(inst, def);
683
+ core.$ZodMAC.init(inst, def);
684
+ exports.ZodStringFormat.init(inst, def);
685
+ });
686
+ function mac(params) {
687
+ return core._mac(exports.ZodMAC, params);
688
+ }
689
+ exports.ZodIPv6 = core.$constructor("ZodIPv6", (inst, def) => {
690
+ // ZodStringFormat.init(inst, def);
691
+ core.$ZodIPv6.init(inst, def);
692
+ exports.ZodStringFormat.init(inst, def);
693
+ });
694
+ function ipv6(params) {
695
+ return core._ipv6(exports.ZodIPv6, params);
696
+ }
697
+ exports.ZodCIDRv4 = core.$constructor("ZodCIDRv4", (inst, def) => {
698
+ core.$ZodCIDRv4.init(inst, def);
699
+ exports.ZodStringFormat.init(inst, def);
700
+ });
701
+ function cidrv4(params) {
702
+ return core._cidrv4(exports.ZodCIDRv4, params);
703
+ }
704
+ exports.ZodCIDRv6 = core.$constructor("ZodCIDRv6", (inst, def) => {
705
+ core.$ZodCIDRv6.init(inst, def);
706
+ exports.ZodStringFormat.init(inst, def);
707
+ });
708
+ function cidrv6(params) {
709
+ return core._cidrv6(exports.ZodCIDRv6, params);
710
+ }
711
+ exports.ZodBase64 = core.$constructor("ZodBase64", (inst, def) => {
712
+ // ZodStringFormat.init(inst, def);
713
+ core.$ZodBase64.init(inst, def);
714
+ exports.ZodStringFormat.init(inst, def);
715
+ });
716
+ function base64(params) {
717
+ return core._base64(exports.ZodBase64, params);
718
+ }
719
+ exports.ZodBase64URL = core.$constructor("ZodBase64URL", (inst, def) => {
720
+ // ZodStringFormat.init(inst, def);
721
+ core.$ZodBase64URL.init(inst, def);
722
+ exports.ZodStringFormat.init(inst, def);
723
+ });
724
+ function base64url(params) {
725
+ return core._base64url(exports.ZodBase64URL, params);
726
+ }
727
+ exports.ZodE164 = core.$constructor("ZodE164", (inst, def) => {
728
+ // ZodStringFormat.init(inst, def);
729
+ core.$ZodE164.init(inst, def);
730
+ exports.ZodStringFormat.init(inst, def);
731
+ });
732
+ function e164(params) {
733
+ return core._e164(exports.ZodE164, params);
734
+ }
735
+ exports.ZodCreditCard = core.$constructor("ZodCreditCard", (inst, def) => {
736
+ core.$ZodCreditCard.init(inst, def);
737
+ exports.ZodStringFormat.init(inst, def);
738
+ });
739
+ function creditCard(params) {
740
+ return core._creditCard(exports.ZodCreditCard, params);
741
+ }
742
+ exports.ZodIBAN = core.$constructor("ZodIBAN", (inst, def) => {
743
+ core.$ZodIBAN.init(inst, def);
744
+ exports.ZodStringFormat.init(inst, def);
745
+ });
746
+ function iban(params) {
747
+ return core._iban(exports.ZodIBAN, params);
748
+ }
749
+ exports.ZodJWT = core.$constructor("ZodJWT", (inst, def) => {
750
+ // ZodStringFormat.init(inst, def);
751
+ core.$ZodJWT.init(inst, def);
752
+ exports.ZodStringFormat.init(inst, def);
753
+ });
754
+ function jwt(params) {
755
+ return core._jwt(exports.ZodJWT, params);
756
+ }
757
+ exports.ZodCustomStringFormat = core.$constructor("ZodCustomStringFormat", (inst, def) => {
758
+ // ZodStringFormat.init(inst, def);
759
+ core.$ZodCustomStringFormat.init(inst, def);
760
+ exports.ZodStringFormat.init(inst, def);
761
+ });
762
+ function stringFormat(format, fnOrRegex, _params = {}) {
763
+ return core._stringFormat(exports.ZodCustomStringFormat, format, fnOrRegex, _params);
764
+ }
765
+ function hostname(_params) {
766
+ return core._stringFormat(exports.ZodCustomStringFormat, "hostname", regexes.hostname, _params);
767
+ }
768
+ function hex(_params) {
769
+ return core._stringFormat(exports.ZodCustomStringFormat, "hex", regexes.hex, _params);
770
+ }
771
+ function currencyCode(_params) {
772
+ return core._stringFormat(exports.ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params);
773
+ }
774
+ function hash(alg, params) {
775
+ const enc = params?.enc ?? "hex";
776
+ const format = `${alg}_${enc}`;
777
+ const regex = core.regexes[format];
778
+ if (!regex)
779
+ throw new Error(`Unrecognized hash format: ${format}`);
780
+ return core._stringFormat(exports.ZodCustomStringFormat, format, regex, params);
781
+ }
782
+ exports.ZodNumber = core.$constructor("ZodNumber", (inst, def) => {
783
+ core.$ZodNumber.init(inst, def);
784
+ exports.ZodType.init(inst, def);
785
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
786
+ inst.isFinite = true;
787
+ },
788
+ /*@__PURE__*/ index_js_1.util.derived({
789
+ minValue: (inst) => {
790
+ const { minimum, exclusiveMinimum } = processors.aggregateChecks(inst);
791
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
792
+ },
793
+ maxValue: (inst) => {
794
+ const { maximum, exclusiveMaximum } = processors.aggregateChecks(inst);
795
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
796
+ },
797
+ isInt: (inst) => {
798
+ const { isInt, multipleOf } = processors.aggregateChecks(inst);
799
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
800
+ },
801
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
802
+ }, {
803
+ gt(value, params) {
804
+ return this.check(checks.gt(value, params));
805
+ },
806
+ gte(value, params) {
807
+ return this.check(checks.gte(value, params));
808
+ },
809
+ min(value, params) {
810
+ return this.check(checks.gte(value, params));
811
+ },
812
+ lt(value, params) {
813
+ return this.check(checks.lt(value, params));
814
+ },
815
+ lte(value, params) {
816
+ return this.check(checks.lte(value, params));
817
+ },
818
+ max(value, params) {
819
+ return this.check(checks.lte(value, params));
820
+ },
821
+ int(params) {
822
+ return this.check(int(params));
823
+ },
824
+ safe(params) {
825
+ return this.check(int(params));
826
+ },
827
+ positive(params) {
828
+ return this.check(checks.gt(0, params));
829
+ },
830
+ nonnegative(params) {
831
+ return this.check(checks.gte(0, params));
832
+ },
833
+ negative(params) {
834
+ return this.check(checks.lt(0, params));
835
+ },
836
+ nonpositive(params) {
837
+ return this.check(checks.lte(0, params));
838
+ },
839
+ multipleOf(value, params) {
840
+ return this.check(checks.multipleOf(value, params));
841
+ },
842
+ step(value, params) {
843
+ return this.check(checks.multipleOf(value, params));
844
+ },
845
+ finite() {
846
+ return this;
847
+ },
848
+ }));
849
+ function number(params) {
850
+ return core._number(exports.ZodNumber, params);
851
+ }
852
+ exports.ZodNumberFormat = core.$constructor("ZodNumberFormat", (inst, def) => {
853
+ core.$ZodNumberFormat.init(inst, def);
854
+ exports.ZodNumber.init(inst, def);
855
+ });
856
+ function int(params) {
857
+ return core._int(exports.ZodNumberFormat, params);
858
+ }
859
+ function float32(params) {
860
+ return core._float32(exports.ZodNumberFormat, params);
861
+ }
862
+ function float64(params) {
863
+ return core._float64(exports.ZodNumberFormat, params);
864
+ }
865
+ function int32(params) {
866
+ return core._int32(exports.ZodNumberFormat, params);
867
+ }
868
+ function uint32(params) {
869
+ return core._uint32(exports.ZodNumberFormat, params);
870
+ }
871
+ exports.ZodBoolean = core.$constructor("ZodBoolean", (inst, def) => {
872
+ core.$ZodBoolean.init(inst, def);
873
+ exports.ZodType.init(inst, def);
874
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);
875
+ });
876
+ function boolean(params) {
877
+ return core._boolean(exports.ZodBoolean, params);
878
+ }
879
+ exports.ZodBigInt = core.$constructor("ZodBigInt", (inst, def) => {
880
+ core.$ZodBigInt.init(inst, def);
881
+ exports.ZodType.init(inst, def);
882
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
883
+ },
884
+ /*@__PURE__*/ index_js_1.util.derived({
885
+ minValue: (inst) => processors.aggregateChecks(inst).minimum ?? null,
886
+ maxValue: (inst) => processors.aggregateChecks(inst).maximum ?? null,
887
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
888
+ }, {
889
+ gte(value, params) {
890
+ return this.check(checks.gte(value, params));
891
+ },
892
+ min(value, params) {
893
+ return this.check(checks.gte(value, params));
894
+ },
895
+ gt(value, params) {
896
+ return this.check(checks.gt(value, params));
897
+ },
898
+ lt(value, params) {
899
+ return this.check(checks.lt(value, params));
900
+ },
901
+ lte(value, params) {
902
+ return this.check(checks.lte(value, params));
903
+ },
904
+ max(value, params) {
905
+ return this.check(checks.lte(value, params));
906
+ },
907
+ positive(params) {
908
+ return this.check(checks.gt(BigInt(0), params));
909
+ },
910
+ negative(params) {
911
+ return this.check(checks.lt(BigInt(0), params));
912
+ },
913
+ nonpositive(params) {
914
+ return this.check(checks.lte(BigInt(0), params));
915
+ },
916
+ nonnegative(params) {
917
+ return this.check(checks.gte(BigInt(0), params));
918
+ },
919
+ multipleOf(value, params) {
920
+ return this.check(checks.multipleOf(value, params));
921
+ },
922
+ }));
923
+ function bigint(params) {
924
+ return core._bigint(exports.ZodBigInt, params);
925
+ }
926
+ exports.ZodBigIntFormat = core.$constructor("ZodBigIntFormat", (inst, def) => {
927
+ core.$ZodBigIntFormat.init(inst, def);
928
+ exports.ZodBigInt.init(inst, def);
929
+ });
930
+ function int64(params) {
931
+ return core._int64(exports.ZodBigIntFormat, params);
932
+ }
933
+ function uint64(params) {
934
+ return core._uint64(exports.ZodBigIntFormat, params);
935
+ }
936
+ exports.ZodSymbol = core.$constructor("ZodSymbol", (inst, def) => {
937
+ core.$ZodSymbol.init(inst, def);
938
+ exports.ZodType.init(inst, def);
939
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);
940
+ });
941
+ function symbol(params) {
942
+ return core._symbol(exports.ZodSymbol, params);
943
+ }
944
+ exports.ZodUndefined = core.$constructor("ZodUndefined", (inst, def) => {
945
+ core.$ZodUndefined.init(inst, def);
946
+ exports.ZodType.init(inst, def);
947
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);
948
+ });
949
+ function _undefined(params) {
950
+ return core._undefined(exports.ZodUndefined, params);
951
+ }
952
+ exports.ZodNull = core.$constructor("ZodNull", (inst, def) => {
953
+ core.$ZodNull.init(inst, def);
954
+ exports.ZodType.init(inst, def);
955
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);
956
+ });
957
+ function _null(params) {
958
+ return core._null(exports.ZodNull, params);
959
+ }
960
+ exports.ZodAny = core.$constructor("ZodAny", (inst, def) => {
961
+ core.$ZodAny.init(inst, def);
962
+ exports.ZodType.init(inst, def);
963
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);
964
+ });
965
+ function any() {
966
+ return core._any(exports.ZodAny);
967
+ }
968
+ exports.ZodUnknown = core.$constructor("ZodUnknown", (inst, def) => {
969
+ core.$ZodUnknown.init(inst, def);
970
+ exports.ZodType.init(inst, def);
971
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);
972
+ });
973
+ function unknown() {
974
+ return core._unknown(exports.ZodUnknown);
975
+ }
976
+ exports.ZodNever = core.$constructor("ZodNever", (inst, def) => {
977
+ core.$ZodNever.init(inst, def);
978
+ exports.ZodType.init(inst, def);
979
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);
980
+ });
981
+ function never(params) {
982
+ return core._never(exports.ZodNever, params);
983
+ }
984
+ exports.ZodVoid = core.$constructor("ZodVoid", (inst, def) => {
985
+ core.$ZodVoid.init(inst, def);
986
+ exports.ZodType.init(inst, def);
987
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);
988
+ });
989
+ function _void(params) {
990
+ return core._void(exports.ZodVoid, params);
991
+ }
992
+ exports.ZodDate = core.$constructor("ZodDate", (inst, def) => {
993
+ core.$ZodDate.init(inst, def);
994
+ exports.ZodType.init(inst, def);
995
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
996
+ inst.min = (value, params) => inst.check(checks.gte(value, params));
997
+ inst.max = (value, params) => inst.check(checks.lte(value, params));
998
+ },
999
+ /*@__PURE__*/ index_js_1.util.derived({
1000
+ minDate: (inst) => {
1001
+ const { minimum } = processors.aggregateChecks(inst);
1002
+ return minimum ? new Date(minimum) : null;
1003
+ },
1004
+ maxDate: (inst) => {
1005
+ const { maximum } = processors.aggregateChecks(inst);
1006
+ return maximum ? new Date(maximum) : null;
1007
+ },
1008
+ }, {}));
1009
+ function date(params) {
1010
+ return core._date(exports.ZodDate, params);
1011
+ }
1012
+ exports.ZodArray = core.$constructor("ZodArray", (inst, def) => {
1013
+ _ensureDefaultMemoizer();
1014
+ core.$ZodArray.init(inst, def);
1015
+ exports.ZodType.init(inst, def);
1016
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
1017
+ inst.element = def.element;
1018
+ }, {
1019
+ min(n, params) {
1020
+ return this.check(checks.minLength(n, params));
1021
+ },
1022
+ nonempty(params) {
1023
+ return this.check(checks.minLength(1, params));
1024
+ },
1025
+ max(n, params) {
1026
+ return this.check(checks.maxLength(n, params));
1027
+ },
1028
+ length(n, params) {
1029
+ return this.check(checks.length(n, params));
1030
+ },
1031
+ unwrap() {
1032
+ return this.element;
1033
+ },
1034
+ });
1035
+ function array(element, params) {
1036
+ return core._array(exports.ZodArray, element, params);
1037
+ }
1038
+ // .keyof
1039
+ function keyof(schema) {
1040
+ const shape = schema._zod.def.shape;
1041
+ return _enum(Object.keys(shape));
1042
+ }
1043
+ exports.ZodObject = core.$constructor("ZodObject", (inst, def) => {
1044
+ _ensureDefaultMemoizer();
1045
+ core.$ZodObjectJIT.init(inst, def);
1046
+ exports.ZodType.init(inst, def);
1047
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);
1048
+ index_js_1.util.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
1049
+ }, {
1050
+ keyof() {
1051
+ return _enum(Object.keys(this._zod.def.shape));
1052
+ },
1053
+ catchall(catchall) {
1054
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
1055
+ return this.clone(index_js_1.util.mergeDefs(this._zod.def, { catchall: catchall }));
1056
+ },
1057
+ passthrough() {
1058
+ return this.clone(index_js_1.util.mergeDefs(this._zod.def, { catchall: unknown() }));
1059
+ },
1060
+ loose() {
1061
+ return this.clone(index_js_1.util.mergeDefs(this._zod.def, { catchall: unknown() }));
1062
+ },
1063
+ strict() {
1064
+ return this.clone(index_js_1.util.mergeDefs(this._zod.def, { catchall: never() }));
1065
+ },
1066
+ strip() {
1067
+ return this.clone(index_js_1.util.mergeDefs(this._zod.def, { catchall: undefined }));
1068
+ },
1069
+ extend(incoming) {
1070
+ return index_js_1.util.extend(this, incoming);
1071
+ },
1072
+ safeExtend(incoming) {
1073
+ return index_js_1.util.safeExtend(this, incoming);
1074
+ },
1075
+ merge(other) {
1076
+ return index_js_1.util.merge(this, other);
1077
+ },
1078
+ pick(mask) {
1079
+ return index_js_1.util.pick(this, mask);
1080
+ },
1081
+ omit(mask) {
1082
+ return index_js_1.util.omit(this, mask);
1083
+ },
1084
+ partial(...args) {
1085
+ return index_js_1.util.partial(exports.ZodOptional, this, args[0]);
1086
+ },
1087
+ exactPartial(...args) {
1088
+ return index_js_1.util.partial(exports.ZodExactOptional, this, args[0], "exactPartial");
1089
+ },
1090
+ required(...args) {
1091
+ return index_js_1.util.required(exports.ZodNonOptional, this, args[0]);
1092
+ },
1093
+ });
1094
+ function object(shape, params) {
1095
+ const def = {
1096
+ type: "object",
1097
+ shape: shape ?? {},
1098
+ ...index_js_1.util.normalizeParams(params),
1099
+ };
1100
+ return new exports.ZodObject(def);
1101
+ }
1102
+ // strictObject
1103
+ function strictObject(shape, params) {
1104
+ return new exports.ZodObject({
1105
+ type: "object",
1106
+ shape,
1107
+ catchall: never(),
1108
+ ...index_js_1.util.normalizeParams(params),
1109
+ });
1110
+ }
1111
+ // looseObject
1112
+ function looseObject(shape, params) {
1113
+ return new exports.ZodObject({
1114
+ type: "object",
1115
+ shape,
1116
+ catchall: unknown(),
1117
+ ...index_js_1.util.normalizeParams(params),
1118
+ });
1119
+ }
1120
+ exports.ZodUnion = core.$constructor("ZodUnion", (inst, def) => {
1121
+ core.$ZodUnion.init(inst, def);
1122
+ exports.ZodType.init(inst, def);
1123
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
1124
+ inst.options = def.options;
1125
+ });
1126
+ function union(options, params) {
1127
+ return new exports.ZodUnion({
1128
+ type: "union",
1129
+ options: options,
1130
+ ...index_js_1.util.normalizeParams(params),
1131
+ });
1132
+ }
1133
+ exports.ZodXor = core.$constructor("ZodXor", (inst, def) => {
1134
+ exports.ZodUnion.init(inst, def);
1135
+ core.$ZodXor.init(inst, def);
1136
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
1137
+ inst.options = def.options;
1138
+ });
1139
+ /** Creates an exclusive union (XOR) where exactly one option must match.
1140
+ * Unlike regular unions that succeed when any option matches, xor fails if
1141
+ * zero or more than one option matches the input. */
1142
+ function xor(options, params) {
1143
+ return new exports.ZodXor({
1144
+ type: "union",
1145
+ options: options,
1146
+ inclusive: false,
1147
+ ...index_js_1.util.normalizeParams(params),
1148
+ });
1149
+ }
1150
+ exports.ZodDiscriminatedUnion = core.$constructor("ZodDiscriminatedUnion", (inst, def) => {
1151
+ exports.ZodUnion.init(inst, def);
1152
+ core.$ZodDiscriminatedUnion.init(inst, def);
1153
+ });
1154
+ function discriminatedUnion(discriminator, options, params) {
1155
+ // const [options, params] = args;
1156
+ return new exports.ZodDiscriminatedUnion({
1157
+ type: "union",
1158
+ options: options,
1159
+ discriminator,
1160
+ ...index_js_1.util.normalizeParams(params),
1161
+ });
1162
+ }
1163
+ exports.ZodIntersection = core.$constructor("ZodIntersection", (inst, def) => {
1164
+ core.$ZodIntersection.init(inst, def);
1165
+ exports.ZodType.init(inst, def);
1166
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);
1167
+ });
1168
+ function intersection(left, right) {
1169
+ return new exports.ZodIntersection({
1170
+ type: "intersection",
1171
+ left: left,
1172
+ right: right,
1173
+ });
1174
+ }
1175
+ exports.ZodTuple = core.$constructor("ZodTuple", (inst, def) => {
1176
+ _ensureDefaultMemoizer();
1177
+ core.$ZodTuple.init(inst, def);
1178
+ exports.ZodType.init(inst, def);
1179
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);
1180
+ }, {
1181
+ rest(rest) {
1182
+ return this.clone({
1183
+ ...this._zod.def,
1184
+ rest: rest,
1185
+ });
1186
+ },
1187
+ partial() {
1188
+ const def = this._zod.def;
1189
+ // a refinement was authored against the full arity; partialing would run it on a shorter array
1190
+ if (def.checks?.length)
1191
+ throw new Error(".partial() cannot be used on tuple schemas containing refinements");
1192
+ return this.clone({
1193
+ ...def,
1194
+ items: def.items.map((item) => new exports.ZodOptional({ type: "optional", innerType: item })),
1195
+ });
1196
+ },
1197
+ });
1198
+ function tuple(items, _paramsOrRest, _params) {
1199
+ const hasRest = _paramsOrRest instanceof core.$ZodType;
1200
+ const params = hasRest ? _params : _paramsOrRest;
1201
+ const rest = hasRest ? _paramsOrRest : null;
1202
+ return new exports.ZodTuple({
1203
+ type: "tuple",
1204
+ items: items,
1205
+ rest,
1206
+ ...index_js_1.util.normalizeParams(params),
1207
+ });
1208
+ }
1209
+ exports.ZodRecord = core.$constructor("ZodRecord", (inst, def) => {
1210
+ _ensureDefaultMemoizer();
1211
+ core.$ZodRecord.init(inst, def);
1212
+ exports.ZodType.init(inst, def);
1213
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);
1214
+ inst.keyType = def.keyType;
1215
+ inst.valueType = def.valueType;
1216
+ });
1217
+ function record(keyType, valueType, params) {
1218
+ // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
1219
+ if (!valueType || !valueType._zod) {
1220
+ return new exports.ZodRecord({
1221
+ type: "record",
1222
+ keyType: string(),
1223
+ valueType: keyType,
1224
+ ...index_js_1.util.normalizeParams(valueType),
1225
+ });
1226
+ }
1227
+ return new exports.ZodRecord({
1228
+ type: "record",
1229
+ keyType,
1230
+ valueType: valueType,
1231
+ ...index_js_1.util.normalizeParams(params),
1232
+ });
1233
+ }
1234
+ // type alksjf = core.output<core.$ZodRecordKey>;
1235
+ function partialRecord(keyType, valueType, params) {
1236
+ return new exports.ZodRecord({
1237
+ type: "record",
1238
+ keyType,
1239
+ valueType: valueType,
1240
+ ...index_js_1.util.normalizeParams(params),
1241
+ partial: true,
1242
+ });
1243
+ }
1244
+ function looseRecord(keyType, valueType, params) {
1245
+ return new exports.ZodRecord({
1246
+ type: "record",
1247
+ keyType,
1248
+ valueType: valueType,
1249
+ mode: "loose",
1250
+ ...index_js_1.util.normalizeParams(params),
1251
+ });
1252
+ }
1253
+ exports.ZodMap = core.$constructor("ZodMap", (inst, def) => {
1254
+ _ensureDefaultMemoizer();
1255
+ core.$ZodMap.init(inst, def);
1256
+ exports.ZodType.init(inst, def);
1257
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);
1258
+ inst.keyType = def.keyType;
1259
+ inst.valueType = def.valueType;
1260
+ inst.min = (...args) => inst.check(core._minSize(...args));
1261
+ inst.nonempty = (params) => inst.check(core._minSize(1, params));
1262
+ inst.max = (...args) => inst.check(core._maxSize(...args));
1263
+ inst.size = (...args) => inst.check(core._size(...args));
1264
+ });
1265
+ function map(keyType, valueType, params) {
1266
+ return new exports.ZodMap({
1267
+ type: "map",
1268
+ keyType: keyType,
1269
+ valueType: valueType,
1270
+ ...index_js_1.util.normalizeParams(params),
1271
+ });
1272
+ }
1273
+ exports.ZodSet = core.$constructor("ZodSet", (inst, def) => {
1274
+ _ensureDefaultMemoizer();
1275
+ core.$ZodSet.init(inst, def);
1276
+ exports.ZodType.init(inst, def);
1277
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
1278
+ inst.min = (...args) => inst.check(core._minSize(...args));
1279
+ inst.nonempty = (params) => inst.check(core._minSize(1, params));
1280
+ inst.max = (...args) => inst.check(core._maxSize(...args));
1281
+ inst.size = (...args) => inst.check(core._size(...args));
1282
+ });
1283
+ function set(valueType, params) {
1284
+ return new exports.ZodSet({
1285
+ type: "set",
1286
+ valueType: valueType,
1287
+ ...index_js_1.util.normalizeParams(params),
1288
+ });
1289
+ }
1290
+ exports.ZodEnum = core.$constructor("ZodEnum", (inst, def) => {
1291
+ core.$ZodEnum.init(inst, def);
1292
+ exports.ZodType.init(inst, def);
1293
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);
1294
+ inst.enum = def.entries;
1295
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
1296
+ inst.options = [...inst._zod.values];
1297
+ const keys = new Set(Object.keys(def.entries));
1298
+ inst.extract = (values, params) => {
1299
+ const newEntries = {};
1300
+ for (const value of values) {
1301
+ if (keys.has(value)) {
1302
+ newEntries[value] = def.entries[value];
1303
+ }
1304
+ else
1305
+ throw new Error(`Key ${value} not found in enum`);
1306
+ }
1307
+ return new exports.ZodEnum({
1308
+ ...def,
1309
+ checks: [],
1310
+ ...index_js_1.util.normalizeParams(params),
1311
+ entries: newEntries,
1312
+ });
1313
+ };
1314
+ inst.exclude = (values, params) => {
1315
+ const newEntries = { ...def.entries };
1316
+ for (const value of values) {
1317
+ if (keys.has(value)) {
1318
+ delete newEntries[value];
1319
+ }
1320
+ else
1321
+ throw new Error(`Key ${value} not found in enum`);
1322
+ }
1323
+ return new exports.ZodEnum({
1324
+ ...def,
1325
+ checks: [],
1326
+ ...index_js_1.util.normalizeParams(params),
1327
+ entries: newEntries,
1328
+ });
1329
+ };
1330
+ });
1331
+ function _enum(values, params) {
1332
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1333
+ return new exports.ZodEnum({
1334
+ type: "enum",
1335
+ entries,
1336
+ ...index_js_1.util.normalizeParams(params),
1337
+ });
1338
+ }
1339
+ /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
1340
+ *
1341
+ * ```ts
1342
+ * enum Colors { red, green, blue }
1343
+ * z.enum(Colors);
1344
+ * ```
1345
+ */
1346
+ function nativeEnum(entries, params) {
1347
+ return new exports.ZodEnum({
1348
+ type: "enum",
1349
+ entries,
1350
+ ...index_js_1.util.normalizeParams(params),
1351
+ });
1352
+ }
1353
+ exports.ZodLiteral = core.$constructor("ZodLiteral", (inst, def) => {
1354
+ core.$ZodLiteral.init(inst, def);
1355
+ exports.ZodType.init(inst, def);
1356
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);
1357
+ inst.values = new Set(def.values);
1358
+ Object.defineProperty(inst, "value", {
1359
+ get() {
1360
+ if (def.values.length > 1) {
1361
+ throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
1362
+ }
1363
+ return def.values[0];
1364
+ },
1365
+ });
1366
+ });
1367
+ function literal(value, params) {
1368
+ return new exports.ZodLiteral({
1369
+ type: "literal",
1370
+ values: Array.isArray(value) ? value : [value],
1371
+ ...index_js_1.util.normalizeParams(params),
1372
+ });
1373
+ }
1374
+ exports.ZodFile = core.$constructor("ZodFile", (inst, def) => {
1375
+ core.$ZodFile.init(inst, def);
1376
+ exports.ZodType.init(inst, def);
1377
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);
1378
+ inst.min = (size, params) => inst.check(core._minSize(size, params));
1379
+ inst.max = (size, params) => inst.check(core._maxSize(size, params));
1380
+ inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));
1381
+ });
1382
+ function file(params) {
1383
+ return core._file(exports.ZodFile, params);
1384
+ }
1385
+ exports.ZodTransform = core.$constructor("ZodTransform", (inst, def) => {
1386
+ _ensureDefaultMemoizer();
1387
+ core.$ZodTransform.init(inst, def);
1388
+ exports.ZodType.init(inst, def);
1389
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);
1390
+ inst._zod.parse = (payload, _ctx) => {
1391
+ if (_ctx.direction === "backward") {
1392
+ throw new core.$ZodEncodeError(inst.constructor.name);
1393
+ }
1394
+ payload.addIssue = (issue) => {
1395
+ if (typeof issue === "string") {
1396
+ payload.issues.push(index_js_1.util.issue(issue, payload.value, def));
1397
+ }
1398
+ else {
1399
+ // for Zod 3 backwards compatibility
1400
+ const _issue = issue;
1401
+ if (_issue.fatal)
1402
+ _issue.continue = false;
1403
+ _issue.code ?? (_issue.code = "custom");
1404
+ if (!("input" in _issue))
1405
+ _issue.input = payload.value;
1406
+ _issue.inst ?? (_issue.inst = inst);
1407
+ // _issue.continue ??= true;
1408
+ payload.issues.push(index_js_1.util.issue(_issue));
1409
+ }
1410
+ };
1411
+ const start = payload.issues.length;
1412
+ const output = def.transform(payload.value, payload);
1413
+ if (output instanceof Promise) {
1414
+ return output.then((output) => {
1415
+ payload.value = output;
1416
+ if (payload.issues.length !== start)
1417
+ index_js_1.util.ownPaths(payload.issues, start);
1418
+ return payload;
1419
+ });
1420
+ }
1421
+ payload.value = output;
1422
+ if (payload.issues.length !== start)
1423
+ index_js_1.util.ownPaths(payload.issues, start);
1424
+ return payload;
1425
+ };
1426
+ });
1427
+ function transform(fn) {
1428
+ return new exports.ZodTransform({
1429
+ type: "transform",
1430
+ transform: fn,
1431
+ });
1432
+ }
1433
+ exports.ZodOptional = core.$constructor("ZodOptional", (inst, def) => {
1434
+ core.$ZodOptional.init(inst, def);
1435
+ exports.ZodType.init(inst, def);
1436
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
1437
+ inst.unwrap = () => inst._zod.def.innerType;
1438
+ });
1439
+ function optional(innerType) {
1440
+ return new exports.ZodOptional({
1441
+ type: "optional",
1442
+ innerType: innerType,
1443
+ });
1444
+ }
1445
+ exports.ZodExactOptional = core.$constructor("ZodExactOptional", (inst, def) => {
1446
+ core.$ZodExactOptional.init(inst, def);
1447
+ exports.ZodType.init(inst, def);
1448
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
1449
+ inst.unwrap = () => inst._zod.def.innerType;
1450
+ });
1451
+ function exactOptional(innerType) {
1452
+ return new exports.ZodExactOptional({
1453
+ type: "optional",
1454
+ innerType: innerType,
1455
+ });
1456
+ }
1457
+ exports.ZodNullable = core.$constructor("ZodNullable", (inst, def) => {
1458
+ core.$ZodNullable.init(inst, def);
1459
+ exports.ZodType.init(inst, def);
1460
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);
1461
+ inst.unwrap = () => inst._zod.def.innerType;
1462
+ });
1463
+ function nullable(innerType) {
1464
+ return new exports.ZodNullable({
1465
+ type: "nullable",
1466
+ innerType: innerType,
1467
+ });
1468
+ }
1469
+ // nullish
1470
+ function nullish(innerType) {
1471
+ return optional(nullable(innerType));
1472
+ }
1473
+ exports.ZodDefault = core.$constructor("ZodDefault", (inst, def) => {
1474
+ core.$ZodDefault.init(inst, def);
1475
+ exports.ZodType.init(inst, def);
1476
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);
1477
+ inst.unwrap = () => inst._zod.def.innerType;
1478
+ inst.removeDefault = inst.unwrap;
1479
+ });
1480
+ function _default(innerType, defaultValue) {
1481
+ return new exports.ZodDefault({
1482
+ type: "default",
1483
+ innerType: innerType,
1484
+ get defaultValue() {
1485
+ return typeof defaultValue === "function" ? defaultValue() : index_js_1.util.shallowClone(defaultValue);
1486
+ },
1487
+ });
1488
+ }
1489
+ exports.ZodPrefault = core.$constructor("ZodPrefault", (inst, def) => {
1490
+ core.$ZodPrefault.init(inst, def);
1491
+ exports.ZodType.init(inst, def);
1492
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);
1493
+ inst.unwrap = () => inst._zod.def.innerType;
1494
+ });
1495
+ function prefault(innerType, defaultValue) {
1496
+ return new exports.ZodPrefault({
1497
+ type: "prefault",
1498
+ innerType: innerType,
1499
+ get defaultValue() {
1500
+ return typeof defaultValue === "function" ? defaultValue() : index_js_1.util.shallowClone(defaultValue);
1501
+ },
1502
+ });
1503
+ }
1504
+ exports.ZodNonOptional = core.$constructor("ZodNonOptional", (inst, def) => {
1505
+ core.$ZodNonOptional.init(inst, def);
1506
+ exports.ZodType.init(inst, def);
1507
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);
1508
+ inst.unwrap = () => inst._zod.def.innerType;
1509
+ });
1510
+ function nonoptional(innerType, params) {
1511
+ return new exports.ZodNonOptional({
1512
+ type: "nonoptional",
1513
+ innerType: innerType,
1514
+ ...index_js_1.util.normalizeParams(params),
1515
+ });
1516
+ }
1517
+ exports.ZodSuccess = core.$constructor("ZodSuccess", (inst, def) => {
1518
+ core.$ZodSuccess.init(inst, def);
1519
+ exports.ZodType.init(inst, def);
1520
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);
1521
+ inst.unwrap = () => inst._zod.def.innerType;
1522
+ });
1523
+ function success(innerType) {
1524
+ return new exports.ZodSuccess({
1525
+ type: "success",
1526
+ innerType: innerType,
1527
+ });
1528
+ }
1529
+ exports.ZodCatch = core.$constructor("ZodCatch", (inst, def) => {
1530
+ core.$ZodCatch.init(inst, def);
1531
+ exports.ZodType.init(inst, def);
1532
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);
1533
+ inst.unwrap = () => inst._zod.def.innerType;
1534
+ inst.removeCatch = inst.unwrap;
1535
+ });
1536
+ function _catch(innerType, catchValue) {
1537
+ return new exports.ZodCatch({
1538
+ type: "catch",
1539
+ innerType: innerType,
1540
+ catchValue: (typeof catchValue === "function" ? catchValue : core.util.constantCatch(catchValue)),
1541
+ });
1542
+ }
1543
+ exports.ZodNaN = core.$constructor("ZodNaN", (inst, def) => {
1544
+ core.$ZodNaN.init(inst, def);
1545
+ exports.ZodType.init(inst, def);
1546
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);
1547
+ });
1548
+ function nan(params) {
1549
+ return core._nan(exports.ZodNaN, params);
1550
+ }
1551
+ exports.ZodPipe = core.$constructor("ZodPipe", (inst, def) => {
1552
+ core.$ZodPipe.init(inst, def);
1553
+ exports.ZodType.init(inst, def);
1554
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);
1555
+ inst.in = def.in;
1556
+ inst.out = def.out;
1557
+ });
1558
+ function pipe(in_, out) {
1559
+ return new exports.ZodPipe({
1560
+ type: "pipe",
1561
+ in: in_,
1562
+ out: out,
1563
+ // ...util.normalizeParams(params),
1564
+ });
1565
+ }
1566
+ exports.ZodCodec = core.$constructor("ZodCodec", (inst, def) => {
1567
+ exports.ZodPipe.init(inst, def);
1568
+ core.$ZodCodec.init(inst, def);
1569
+ });
1570
+ function codec(in_, out, params) {
1571
+ return new exports.ZodCodec({
1572
+ type: "pipe",
1573
+ in: in_,
1574
+ out: out,
1575
+ transform: params.decode,
1576
+ reverseTransform: params.encode,
1577
+ });
1578
+ }
1579
+ function invertCodec(codec) {
1580
+ const def = codec._zod.def;
1581
+ return new exports.ZodCodec({
1582
+ type: "pipe",
1583
+ in: def.out,
1584
+ out: def.in,
1585
+ transform: def.reverseTransform,
1586
+ reverseTransform: def.transform,
1587
+ });
1588
+ }
1589
+ exports.ZodPreprocess = core.$constructor("ZodPreprocess", (inst, def) => {
1590
+ exports.ZodPipe.init(inst, def);
1591
+ core.$ZodPreprocess.init(inst, def);
1592
+ });
1593
+ exports.ZodReadonly = core.$constructor("ZodReadonly", (inst, def) => {
1594
+ core.$ZodReadonly.init(inst, def);
1595
+ exports.ZodType.init(inst, def);
1596
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);
1597
+ inst.unwrap = () => inst._zod.def.innerType;
1598
+ });
1599
+ function readonly(innerType) {
1600
+ return new exports.ZodReadonly({
1601
+ type: "readonly",
1602
+ innerType: innerType,
1603
+ });
1604
+ }
1605
+ exports.ZodTemplateLiteral = core.$constructor("ZodTemplateLiteral", (inst, def) => {
1606
+ core.$ZodTemplateLiteral.init(inst, def);
1607
+ exports.ZodType.init(inst, def);
1608
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);
1609
+ });
1610
+ function templateLiteral(parts, params) {
1611
+ return new exports.ZodTemplateLiteral({
1612
+ type: "template_literal",
1613
+ parts,
1614
+ ...index_js_1.util.normalizeParams(params),
1615
+ });
1616
+ }
1617
+ exports.ZodLazy = core.$constructor("ZodLazy", (inst, def) => {
1618
+ core.$ZodLazy.init(inst, def);
1619
+ exports.ZodType.init(inst, def);
1620
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);
1621
+ inst.unwrap = () => inst._zod.def.getter();
1622
+ });
1623
+ function lazy(getter) {
1624
+ return new exports.ZodLazy({
1625
+ type: "lazy",
1626
+ getter: getter,
1627
+ });
1628
+ }
1629
+ exports.ZodPromise = core.$constructor("ZodPromise", (inst, def) => {
1630
+ core.$ZodPromise.init(inst, def);
1631
+ exports.ZodType.init(inst, def);
1632
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);
1633
+ inst.unwrap = () => inst._zod.def.innerType;
1634
+ });
1635
+ function promise(innerType) {
1636
+ return new exports.ZodPromise({
1637
+ type: "promise",
1638
+ innerType: innerType,
1639
+ });
1640
+ }
1641
+ exports.ZodFunction = core.$constructor("ZodFunction", (inst, def) => {
1642
+ core.$ZodFunction.init(inst, def);
1643
+ exports.ZodType.init(inst, def);
1644
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);
1645
+ });
1646
+ function _function(params) {
1647
+ return new exports.ZodFunction({
1648
+ type: "function",
1649
+ input: Array.isArray(params?.input) ? tuple(params?.input) : (params?.input ?? array(unknown())),
1650
+ output: params?.output ?? unknown(),
1651
+ });
1652
+ }
1653
+ exports.ZodCustom = core.$constructor("ZodCustom", (inst, def) => {
1654
+ core.$ZodCustom.init(inst, def);
1655
+ exports.ZodType.init(inst, def);
1656
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);
1657
+ });
1658
+ // custom checks
1659
+ function check(fn) {
1660
+ const ch = new core.$ZodCheck({
1661
+ check: "custom",
1662
+ // ...util.normalizeParams(params),
1663
+ });
1664
+ ch._zod.check = fn;
1665
+ return ch;
1666
+ }
1667
+ function custom(fn, _params) {
1668
+ return core._custom(exports.ZodCustom, fn ?? (() => true), _params);
1669
+ }
1670
+ function refine(fn, _params = {}) {
1671
+ return core._refine(exports.ZodCustom, fn, _params);
1672
+ }
1673
+ // superRefine
1674
+ function superRefine(fn, params) {
1675
+ return core._superRefine(fn, params);
1676
+ }
1677
+ // Re-export describe and meta from core
1678
+ exports.describe = core.describe;
1679
+ exports.meta = core.meta;
1680
+ exports.ZodInstanceOf = core.$constructor("ZodInstanceOf", (inst, def) => {
1681
+ exports.ZodCustom.init(inst, def);
1682
+ }, {
1683
+ properties(shape, params) {
1684
+ // asserts in place, so the narrowed output type is truthful without a wrapper
1685
+ return this.check(core._properties(shape, params));
1686
+ },
1687
+ });
1688
+ function _instanceof(cls, params = {}) {
1689
+ const inst = new exports.ZodInstanceOf({
1690
+ type: "custom",
1691
+ check: "custom",
1692
+ fn: (data) => data instanceof cls,
1693
+ abort: true,
1694
+ ...index_js_1.util.normalizeParams(params),
1695
+ });
1696
+ inst._zod.bag.Class = cls;
1697
+ // Override check to emit invalid_type instead of custom
1698
+ inst._zod.check = (payload) => {
1699
+ if (!(payload.value instanceof cls)) {
1700
+ payload.issues.push({
1701
+ code: "invalid_type",
1702
+ expected: cls.name,
1703
+ input: payload.value,
1704
+ inst,
1705
+ path: [...(inst._zod.def.path ?? [])],
1706
+ });
1707
+ }
1708
+ };
1709
+ return inst;
1710
+ }
1711
+ // stringbool
1712
+ const stringbool = (...args) => core._stringbool({
1713
+ Codec: exports.ZodCodec,
1714
+ Boolean: exports.ZodBoolean,
1715
+ String: exports.ZodString,
1716
+ }, ...args);
1717
+ exports.stringbool = stringbool;
1718
+ function json(params) {
1719
+ const jsonSchema = lazy(() => {
1720
+ return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
1721
+ });
1722
+ return jsonSchema;
1723
+ }
1724
+ // preprocess
1725
+ function preprocess(fn, schema) {
1726
+ return new exports.ZodPreprocess({
1727
+ type: "pipe",
1728
+ in: transform(fn),
1729
+ out: schema,
1730
+ });
1731
+ }
1732
+
1733
+ // seal-cjs-exports
1734
+ (function () {
1735
+ var keys = Object.getOwnPropertyNames(exports);
1736
+ for (var i = 0; i < keys.length; i++) {
1737
+ var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
1738
+ if (!desc || !desc.get || !desc.configurable) continue;
1739
+ var value;
1740
+ try {
1741
+ value = desc.get();
1742
+ } catch (e) {
1743
+ continue;
1744
+ }
1745
+ // a circular require may not have settled this one yet, so leave it live
1746
+ if (value === undefined) continue;
1747
+ Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
1748
+ }
1749
+ Object.freeze(exports);
1750
+ })();