@shuttl-io/core 0.2.0

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