@anthonyalayo/zod 0.0.0-stage → 4.7.1

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