@amplitude/ai 0.1.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 (510) hide show
  1. package/.cursor/skills/instrument-with-amplitude-ai/SKILL.md +50 -0
  2. package/AGENTS.md +79 -0
  3. package/LICENSE +21 -0
  4. package/README.md +2111 -0
  5. package/bin/amplitude-ai-completions.mjs +19 -0
  6. package/bin/amplitude-ai-doctor.mjs +26 -0
  7. package/bin/amplitude-ai-init.mjs +27 -0
  8. package/bin/amplitude-ai-instrument.mjs +52 -0
  9. package/bin/amplitude-ai-mcp.mjs +8 -0
  10. package/bin/amplitude-ai-register-catalog.mjs +156 -0
  11. package/bin/amplitude-ai-status.mjs +28 -0
  12. package/bin/amplitude-ai.mjs +43 -0
  13. package/bin/validate-catalog-constants.mjs +134 -0
  14. package/data/agent_event_catalog.json +1277 -0
  15. package/dist/_virtual/rolldown_runtime.js +31 -0
  16. package/dist/bound-agent.d.ts +56 -0
  17. package/dist/bound-agent.d.ts.map +1 -0
  18. package/dist/bound-agent.js +155 -0
  19. package/dist/bound-agent.js.map +1 -0
  20. package/dist/cli/doctor.d.ts +17 -0
  21. package/dist/cli/doctor.d.ts.map +1 -0
  22. package/dist/cli/doctor.js +89 -0
  23. package/dist/cli/doctor.js.map +1 -0
  24. package/dist/cli/init.d.ts +14 -0
  25. package/dist/cli/init.d.ts.map +1 -0
  26. package/dist/cli/init.js +40 -0
  27. package/dist/cli/init.js.map +1 -0
  28. package/dist/cli/providers.d.ts +32 -0
  29. package/dist/cli/providers.d.ts.map +1 -0
  30. package/dist/cli/providers.js +46 -0
  31. package/dist/cli/providers.js.map +1 -0
  32. package/dist/cli/status.d.ts +14 -0
  33. package/dist/cli/status.d.ts.map +1 -0
  34. package/dist/cli/status.js +38 -0
  35. package/dist/cli/status.js.map +1 -0
  36. package/dist/client.d.ts +246 -0
  37. package/dist/client.d.ts.map +1 -0
  38. package/dist/client.js +369 -0
  39. package/dist/client.js.map +1 -0
  40. package/dist/config.d.ts +60 -0
  41. package/dist/config.d.ts.map +1 -0
  42. package/dist/config.js +57 -0
  43. package/dist/config.js.map +1 -0
  44. package/dist/context.d.ts +44 -0
  45. package/dist/context.d.ts.map +1 -0
  46. package/dist/context.js +53 -0
  47. package/dist/context.js.map +1 -0
  48. package/dist/core/constants.d.ts +96 -0
  49. package/dist/core/constants.d.ts.map +1 -0
  50. package/dist/core/constants.js +105 -0
  51. package/dist/core/constants.js.map +1 -0
  52. package/dist/core/enrichments.d.ts +139 -0
  53. package/dist/core/enrichments.d.ts.map +1 -0
  54. package/dist/core/enrichments.js +177 -0
  55. package/dist/core/enrichments.js.map +1 -0
  56. package/dist/core/privacy.d.ts +53 -0
  57. package/dist/core/privacy.d.ts.map +1 -0
  58. package/dist/core/privacy.js +235 -0
  59. package/dist/core/privacy.js.map +1 -0
  60. package/dist/core/tracking.d.ts +242 -0
  61. package/dist/core/tracking.d.ts.map +1 -0
  62. package/dist/core/tracking.js +469 -0
  63. package/dist/core/tracking.js.map +1 -0
  64. package/dist/decorators.d.ts +109 -0
  65. package/dist/decorators.d.ts.map +1 -0
  66. package/dist/decorators.js +281 -0
  67. package/dist/decorators.js.map +1 -0
  68. package/dist/exceptions.d.ts +19 -0
  69. package/dist/exceptions.d.ts.map +1 -0
  70. package/dist/exceptions.js +35 -0
  71. package/dist/exceptions.js.map +1 -0
  72. package/dist/index.d.ts +37 -0
  73. package/dist/index.js +38 -0
  74. package/dist/integrations/anthropic-tools.d.ts +38 -0
  75. package/dist/integrations/anthropic-tools.d.ts.map +1 -0
  76. package/dist/integrations/anthropic-tools.js +175 -0
  77. package/dist/integrations/anthropic-tools.js.map +1 -0
  78. package/dist/integrations/crewai.d.ts +14 -0
  79. package/dist/integrations/crewai.d.ts.map +1 -0
  80. package/dist/integrations/crewai.js +19 -0
  81. package/dist/integrations/crewai.js.map +1 -0
  82. package/dist/integrations/langchain.d.ts +37 -0
  83. package/dist/integrations/langchain.d.ts.map +1 -0
  84. package/dist/integrations/langchain.js +189 -0
  85. package/dist/integrations/langchain.js.map +1 -0
  86. package/dist/integrations/llamaindex.d.ts +44 -0
  87. package/dist/integrations/llamaindex.d.ts.map +1 -0
  88. package/dist/integrations/llamaindex.js +144 -0
  89. package/dist/integrations/llamaindex.js.map +1 -0
  90. package/dist/integrations/openai-agents.d.ts +35 -0
  91. package/dist/integrations/openai-agents.d.ts.map +1 -0
  92. package/dist/integrations/openai-agents.js +248 -0
  93. package/dist/integrations/openai-agents.js.map +1 -0
  94. package/dist/integrations/opentelemetry.d.ts +40 -0
  95. package/dist/integrations/opentelemetry.d.ts.map +1 -0
  96. package/dist/integrations/opentelemetry.js +146 -0
  97. package/dist/integrations/opentelemetry.js.map +1 -0
  98. package/dist/internals.d.ts +5 -0
  99. package/dist/internals.js +5 -0
  100. package/dist/mcp/contract.d.ts +27 -0
  101. package/dist/mcp/contract.d.ts.map +1 -0
  102. package/dist/mcp/contract.js +25 -0
  103. package/dist/mcp/contract.js.map +1 -0
  104. package/dist/mcp/index.d.ts +4 -0
  105. package/dist/mcp/index.js +5 -0
  106. package/dist/mcp/patterns.d.ts +11 -0
  107. package/dist/mcp/patterns.d.ts.map +1 -0
  108. package/dist/mcp/patterns.js +38 -0
  109. package/dist/mcp/patterns.js.map +1 -0
  110. package/dist/mcp/server.d.ts +10 -0
  111. package/dist/mcp/server.d.ts.map +1 -0
  112. package/dist/mcp/server.js +241 -0
  113. package/dist/mcp/server.js.map +1 -0
  114. package/dist/mcp/validate-file.d.ts +20 -0
  115. package/dist/mcp/validate-file.d.ts.map +1 -0
  116. package/dist/mcp/validate-file.js +122 -0
  117. package/dist/mcp/validate-file.js.map +1 -0
  118. package/dist/middleware.d.ts +32 -0
  119. package/dist/middleware.d.ts.map +1 -0
  120. package/dist/middleware.js +67 -0
  121. package/dist/middleware.js.map +1 -0
  122. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js +54 -0
  123. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map +1 -0
  124. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js +20 -0
  125. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map +1 -0
  126. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js +34 -0
  127. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map +1 -0
  128. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js +225 -0
  129. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map +1 -0
  130. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +22 -0
  131. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
  132. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +351 -0
  133. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
  134. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +634 -0
  135. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
  136. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +60 -0
  137. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -0
  138. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +122 -0
  139. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
  140. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +37 -0
  141. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
  142. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +858 -0
  143. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
  144. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +32 -0
  145. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -0
  146. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +74 -0
  147. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
  148. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1262 -0
  149. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
  150. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +83 -0
  151. package/dist/node_modules/.pnpm/@modelcontextprotocol_sdk@1.27.1_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
  152. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js +195 -0
  153. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/formats.js.map +1 -0
  154. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js +44 -0
  155. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/index.js.map +1 -0
  156. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js +88 -0
  157. package/dist/node_modules/.pnpm/ajv-formats@3.0.1_ajv@8.18.0/node_modules/ajv-formats/dist/limit.js.map +1 -0
  158. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js +107 -0
  159. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/ajv.js.map +1 -0
  160. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js +142 -0
  161. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
  162. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js +678 -0
  163. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
  164. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js +145 -0
  165. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
  166. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js +106 -0
  167. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/errors.js.map +1 -0
  168. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js +227 -0
  169. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/index.js.map +1 -0
  170. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js +33 -0
  171. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/names.js.map +1 -0
  172. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js +22 -0
  173. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
  174. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js +137 -0
  175. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/resolve.js.map +1 -0
  176. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js +65 -0
  177. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/rules.js.map +1 -0
  178. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js +150 -0
  179. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/util.js.map +1 -0
  180. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
  181. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
  182. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js +52 -0
  183. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
  184. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js +176 -0
  185. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
  186. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js +35 -0
  187. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
  188. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js +437 -0
  189. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
  190. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js +117 -0
  191. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
  192. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js +76 -0
  193. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
  194. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js +587 -0
  195. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/core.js.map +1 -0
  196. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.js +22 -0
  197. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/data.js.map +1 -0
  198. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.js +145 -0
  199. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/refs/json-schema-draft-07.js.map +1 -0
  200. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js +16 -0
  201. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/equal.js.map +1 -0
  202. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js +29 -0
  203. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
  204. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js +16 -0
  205. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/uri.js.map +1 -0
  206. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js +20 -0
  207. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
  208. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +61 -0
  209. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
  210. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +101 -0
  211. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
  212. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js +34 -0
  213. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
  214. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +21 -0
  215. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
  216. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js +94 -0
  217. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
  218. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +91 -0
  219. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
  220. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js +66 -0
  221. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
  222. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js +64 -0
  223. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
  224. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js +63 -0
  225. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
  226. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js +39 -0
  227. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
  228. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
  229. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
  230. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +56 -0
  231. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
  232. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +66 -0
  233. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
  234. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
  235. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
  236. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js +57 -0
  237. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
  238. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +46 -0
  239. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
  240. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +22 -0
  241. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
  242. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js +134 -0
  243. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
  244. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
  245. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
  246. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
  247. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
  248. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js +116 -0
  249. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
  250. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js +106 -0
  251. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
  252. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
  253. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
  254. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
  255. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
  256. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js +97 -0
  257. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
  258. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js +15 -0
  259. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
  260. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
  261. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
  262. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js +32 -0
  263. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
  264. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js +54 -0
  265. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
  266. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js +53 -0
  267. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
  268. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js +33 -0
  269. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
  270. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js +38 -0
  271. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
  272. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +52 -0
  273. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
  274. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +33 -0
  275. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
  276. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +32 -0
  277. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
  278. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js +43 -0
  279. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
  280. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js +77 -0
  281. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
  282. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
  283. package/dist/node_modules/.pnpm/ajv@8.18.0/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
  284. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js +37 -0
  285. package/dist/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js.map +1 -0
  286. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js +240 -0
  287. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js.map +1 -0
  288. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js +194 -0
  289. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js.map +1 -0
  290. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js +286 -0
  291. package/dist/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js.map +1 -0
  292. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js +82 -0
  293. package/dist/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js.map +1 -0
  294. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js +37 -0
  295. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
  296. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js +30 -0
  297. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
  298. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +16 -0
  299. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
  300. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +10 -0
  301. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +1 -0
  302. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js +57 -0
  303. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
  304. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +17 -0
  305. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
  306. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +23 -0
  307. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
  308. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +36 -0
  309. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
  310. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +8 -0
  311. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
  312. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +10 -0
  313. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
  314. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +10 -0
  315. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
  316. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +39 -0
  317. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
  318. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +13 -0
  319. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
  320. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +11 -0
  321. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
  322. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +11 -0
  323. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
  324. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +47 -0
  325. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
  326. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +17 -0
  327. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
  328. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +38 -0
  329. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
  330. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +16 -0
  331. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
  332. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +13 -0
  333. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
  334. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +11 -0
  335. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
  336. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +46 -0
  337. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
  338. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +37 -0
  339. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
  340. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +64 -0
  341. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
  342. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +20 -0
  343. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
  344. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +27 -0
  345. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
  346. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +10 -0
  347. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
  348. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +10 -0
  349. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
  350. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +56 -0
  351. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
  352. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +21 -0
  353. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
  354. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +250 -0
  355. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
  356. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +38 -0
  357. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
  358. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +10 -0
  359. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
  360. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +64 -0
  361. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
  362. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +10 -0
  363. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
  364. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js +78 -0
  365. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
  366. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +70 -0
  367. package/dist/node_modules/.pnpm/zod-to-json-schema@3.25.1_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
  368. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js +104 -0
  369. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.js.map +1 -0
  370. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js +11 -0
  371. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js.map +1 -0
  372. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js +10 -0
  373. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
  374. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js +110 -0
  375. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
  376. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js +99 -0
  377. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js.map +1 -0
  378. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js +84 -0
  379. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.js.map +1 -0
  380. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js +3160 -0
  381. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js.map +1 -0
  382. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/errors.js +23 -0
  383. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/errors.js.map +1 -0
  384. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/iso.js +38 -0
  385. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/iso.js.map +1 -0
  386. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js +12 -0
  387. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/parse.js.map +1 -0
  388. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js +611 -0
  389. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/classic/schemas.js.map +1 -0
  390. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/api.js +437 -0
  391. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/api.js.map +1 -0
  392. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/checks.js +360 -0
  393. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/checks.js.map +1 -0
  394. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js +50 -0
  395. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/core.js.map +1 -0
  396. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js +34 -0
  397. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/doc.js.map +1 -0
  398. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/errors.js +71 -0
  399. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/errors.js.map +1 -0
  400. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js +74 -0
  401. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/parse.js.map +1 -0
  402. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js +63 -0
  403. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/regexes.js.map +1 -0
  404. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/registries.js +50 -0
  405. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/registries.js.map +1 -0
  406. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.js +1098 -0
  407. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/schemas.js.map +1 -0
  408. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js +599 -0
  409. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  410. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js +267 -0
  411. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/util.js.map +1 -0
  412. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/versions.js +10 -0
  413. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/core/versions.js.map +1 -0
  414. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/mini/schemas.js +50 -0
  415. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v4/mini/schemas.js.map +1 -0
  416. package/dist/patching.d.ts +59 -0
  417. package/dist/patching.d.ts.map +1 -0
  418. package/dist/patching.js +891 -0
  419. package/dist/patching.js.map +1 -0
  420. package/dist/propagation.d.ts +8 -0
  421. package/dist/propagation.d.ts.map +1 -0
  422. package/dist/propagation.js +46 -0
  423. package/dist/propagation.js.map +1 -0
  424. package/dist/providers/anthropic.d.ts +44 -0
  425. package/dist/providers/anthropic.d.ts.map +1 -0
  426. package/dist/providers/anthropic.js +287 -0
  427. package/dist/providers/anthropic.js.map +1 -0
  428. package/dist/providers/azure-openai.d.ts +32 -0
  429. package/dist/providers/azure-openai.d.ts.map +1 -0
  430. package/dist/providers/azure-openai.js +39 -0
  431. package/dist/providers/azure-openai.js.map +1 -0
  432. package/dist/providers/base.d.ts +70 -0
  433. package/dist/providers/base.d.ts.map +1 -0
  434. package/dist/providers/base.js +141 -0
  435. package/dist/providers/base.js.map +1 -0
  436. package/dist/providers/bedrock.d.ts +41 -0
  437. package/dist/providers/bedrock.d.ts.map +1 -0
  438. package/dist/providers/bedrock.js +229 -0
  439. package/dist/providers/bedrock.js.map +1 -0
  440. package/dist/providers/gemini.d.ts +34 -0
  441. package/dist/providers/gemini.d.ts.map +1 -0
  442. package/dist/providers/gemini.js +225 -0
  443. package/dist/providers/gemini.js.map +1 -0
  444. package/dist/providers/mistral.d.ts +32 -0
  445. package/dist/providers/mistral.d.ts.map +1 -0
  446. package/dist/providers/mistral.js +218 -0
  447. package/dist/providers/mistral.js.map +1 -0
  448. package/dist/providers/openai.d.ts +61 -0
  449. package/dist/providers/openai.d.ts.map +1 -0
  450. package/dist/providers/openai.js +530 -0
  451. package/dist/providers/openai.js.map +1 -0
  452. package/dist/register.d.ts +1 -0
  453. package/dist/register.js +46 -0
  454. package/dist/register.js.map +1 -0
  455. package/dist/session.d.ts +46 -0
  456. package/dist/session.d.ts.map +1 -0
  457. package/dist/session.js +144 -0
  458. package/dist/session.js.map +1 -0
  459. package/dist/tenant.d.ts +30 -0
  460. package/dist/tenant.d.ts.map +1 -0
  461. package/dist/tenant.js +23 -0
  462. package/dist/tenant.js.map +1 -0
  463. package/dist/testing.d.ts +46 -0
  464. package/dist/testing.d.ts.map +1 -0
  465. package/dist/testing.js +120 -0
  466. package/dist/testing.js.map +1 -0
  467. package/dist/types.d.ts +384 -0
  468. package/dist/types.d.ts.map +1 -0
  469. package/dist/types.js +13 -0
  470. package/dist/types.js.map +1 -0
  471. package/dist/utils/costs.d.ts +27 -0
  472. package/dist/utils/costs.d.ts.map +1 -0
  473. package/dist/utils/costs.js +63 -0
  474. package/dist/utils/costs.js.map +1 -0
  475. package/dist/utils/debug.d.ts +6 -0
  476. package/dist/utils/debug.d.ts.map +1 -0
  477. package/dist/utils/debug.js +73 -0
  478. package/dist/utils/debug.js.map +1 -0
  479. package/dist/utils/logger.d.ts +11 -0
  480. package/dist/utils/logger.d.ts.map +1 -0
  481. package/dist/utils/logger.js +18 -0
  482. package/dist/utils/logger.js.map +1 -0
  483. package/dist/utils/model-tiers.d.ts +8 -0
  484. package/dist/utils/model-tiers.d.ts.map +1 -0
  485. package/dist/utils/model-tiers.js +76 -0
  486. package/dist/utils/model-tiers.js.map +1 -0
  487. package/dist/utils/providers.d.ts +5 -0
  488. package/dist/utils/providers.d.ts.map +1 -0
  489. package/dist/utils/providers.js +20 -0
  490. package/dist/utils/providers.js.map +1 -0
  491. package/dist/utils/resolve-module.d.ts +5 -0
  492. package/dist/utils/resolve-module.d.ts.map +1 -0
  493. package/dist/utils/resolve-module.js +29 -0
  494. package/dist/utils/resolve-module.js.map +1 -0
  495. package/dist/utils/streaming.d.ts +55 -0
  496. package/dist/utils/streaming.d.ts.map +1 -0
  497. package/dist/utils/streaming.js +72 -0
  498. package/dist/utils/streaming.js.map +1 -0
  499. package/dist/utils/tokens.d.ts +16 -0
  500. package/dist/utils/tokens.d.ts.map +1 -0
  501. package/dist/utils/tokens.js +80 -0
  502. package/dist/utils/tokens.js.map +1 -0
  503. package/dist/wrappers.d.ts +37 -0
  504. package/dist/wrappers.d.ts.map +1 -0
  505. package/dist/wrappers.js +61 -0
  506. package/dist/wrappers.js.map +1 -0
  507. package/llms-full.txt +127 -0
  508. package/llms.txt +28 -0
  509. package/mcp.schema.json +18 -0
  510. package/package.json +189 -0
@@ -0,0 +1,3160 @@
1
+ import { ZodParsedType, getParsedType, util } from "./helpers/util.js";
2
+ import { ZodError, ZodIssueCode } from "./ZodError.js";
3
+ import en_default from "./locales/en.js";
4
+ import { getErrorMap } from "./errors.js";
5
+ import { DIRTY, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue } from "./helpers/parseUtil.js";
6
+ import { errorUtil } from "./helpers/errorUtil.js";
7
+
8
+ //#region node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
9
+ var ParseInputLazyPath = class {
10
+ constructor(parent, value, path, key) {
11
+ this._cachedPath = [];
12
+ this.parent = parent;
13
+ this.data = value;
14
+ this._path = path;
15
+ this._key = key;
16
+ }
17
+ get path() {
18
+ if (!this._cachedPath.length) if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
19
+ else this._cachedPath.push(...this._path, this._key);
20
+ return this._cachedPath;
21
+ }
22
+ };
23
+ const handleResult = (ctx, result) => {
24
+ if (isValid(result)) return {
25
+ success: true,
26
+ data: result.value
27
+ };
28
+ else {
29
+ if (!ctx.common.issues.length) throw new Error("Validation failed but no issues detected.");
30
+ return {
31
+ success: false,
32
+ get error() {
33
+ if (this._error) return this._error;
34
+ this._error = new ZodError(ctx.common.issues);
35
+ return this._error;
36
+ }
37
+ };
38
+ }
39
+ };
40
+ function processCreateParams(params) {
41
+ if (!params) return {};
42
+ const { errorMap, invalid_type_error, required_error, description } = params;
43
+ if (errorMap && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
44
+ if (errorMap) return {
45
+ errorMap,
46
+ description
47
+ };
48
+ const customMap = (iss, ctx) => {
49
+ const { message } = params;
50
+ if (iss.code === "invalid_enum_value") return { message: message ?? ctx.defaultError };
51
+ if (typeof ctx.data === "undefined") return { message: message ?? required_error ?? ctx.defaultError };
52
+ if (iss.code !== "invalid_type") return { message: ctx.defaultError };
53
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
54
+ };
55
+ return {
56
+ errorMap: customMap,
57
+ description
58
+ };
59
+ }
60
+ var ZodType = class {
61
+ get description() {
62
+ return this._def.description;
63
+ }
64
+ _getType(input) {
65
+ return getParsedType(input.data);
66
+ }
67
+ _getOrReturnCtx(input, ctx) {
68
+ return ctx || {
69
+ common: input.parent.common,
70
+ data: input.data,
71
+ parsedType: getParsedType(input.data),
72
+ schemaErrorMap: this._def.errorMap,
73
+ path: input.path,
74
+ parent: input.parent
75
+ };
76
+ }
77
+ _processInputParams(input) {
78
+ return {
79
+ status: new ParseStatus(),
80
+ ctx: {
81
+ common: input.parent.common,
82
+ data: input.data,
83
+ parsedType: getParsedType(input.data),
84
+ schemaErrorMap: this._def.errorMap,
85
+ path: input.path,
86
+ parent: input.parent
87
+ }
88
+ };
89
+ }
90
+ _parseSync(input) {
91
+ const result = this._parse(input);
92
+ if (isAsync(result)) throw new Error("Synchronous parse encountered promise.");
93
+ return result;
94
+ }
95
+ _parseAsync(input) {
96
+ const result = this._parse(input);
97
+ return Promise.resolve(result);
98
+ }
99
+ parse(data, params) {
100
+ const result = this.safeParse(data, params);
101
+ if (result.success) return result.data;
102
+ throw result.error;
103
+ }
104
+ safeParse(data, params) {
105
+ const ctx = {
106
+ common: {
107
+ issues: [],
108
+ async: params?.async ?? false,
109
+ contextualErrorMap: params?.errorMap
110
+ },
111
+ path: params?.path || [],
112
+ schemaErrorMap: this._def.errorMap,
113
+ parent: null,
114
+ data,
115
+ parsedType: getParsedType(data)
116
+ };
117
+ return handleResult(ctx, this._parseSync({
118
+ data,
119
+ path: ctx.path,
120
+ parent: ctx
121
+ }));
122
+ }
123
+ "~validate"(data) {
124
+ const ctx = {
125
+ common: {
126
+ issues: [],
127
+ async: !!this["~standard"].async
128
+ },
129
+ path: [],
130
+ schemaErrorMap: this._def.errorMap,
131
+ parent: null,
132
+ data,
133
+ parsedType: getParsedType(data)
134
+ };
135
+ if (!this["~standard"].async) try {
136
+ const result = this._parseSync({
137
+ data,
138
+ path: [],
139
+ parent: ctx
140
+ });
141
+ return isValid(result) ? { value: result.value } : { issues: ctx.common.issues };
142
+ } catch (err) {
143
+ if (err?.message?.toLowerCase()?.includes("encountered")) this["~standard"].async = true;
144
+ ctx.common = {
145
+ issues: [],
146
+ async: true
147
+ };
148
+ }
149
+ return this._parseAsync({
150
+ data,
151
+ path: [],
152
+ parent: ctx
153
+ }).then((result) => isValid(result) ? { value: result.value } : { issues: ctx.common.issues });
154
+ }
155
+ async parseAsync(data, params) {
156
+ const result = await this.safeParseAsync(data, params);
157
+ if (result.success) return result.data;
158
+ throw result.error;
159
+ }
160
+ async safeParseAsync(data, params) {
161
+ const ctx = {
162
+ common: {
163
+ issues: [],
164
+ contextualErrorMap: params?.errorMap,
165
+ async: true
166
+ },
167
+ path: params?.path || [],
168
+ schemaErrorMap: this._def.errorMap,
169
+ parent: null,
170
+ data,
171
+ parsedType: getParsedType(data)
172
+ };
173
+ const maybeAsyncResult = this._parse({
174
+ data,
175
+ path: ctx.path,
176
+ parent: ctx
177
+ });
178
+ return handleResult(ctx, await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult)));
179
+ }
180
+ refine(check, message) {
181
+ const getIssueProperties = (val) => {
182
+ if (typeof message === "string" || typeof message === "undefined") return { message };
183
+ else if (typeof message === "function") return message(val);
184
+ else return message;
185
+ };
186
+ return this._refinement((val, ctx) => {
187
+ const result = check(val);
188
+ const setError = () => ctx.addIssue({
189
+ code: ZodIssueCode.custom,
190
+ ...getIssueProperties(val)
191
+ });
192
+ if (typeof Promise !== "undefined" && result instanceof Promise) return result.then((data) => {
193
+ if (!data) {
194
+ setError();
195
+ return false;
196
+ } else return true;
197
+ });
198
+ if (!result) {
199
+ setError();
200
+ return false;
201
+ } else return true;
202
+ });
203
+ }
204
+ refinement(check, refinementData) {
205
+ return this._refinement((val, ctx) => {
206
+ if (!check(val)) {
207
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
208
+ return false;
209
+ } else return true;
210
+ });
211
+ }
212
+ _refinement(refinement) {
213
+ return new ZodEffects({
214
+ schema: this,
215
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
216
+ effect: {
217
+ type: "refinement",
218
+ refinement
219
+ }
220
+ });
221
+ }
222
+ superRefine(refinement) {
223
+ return this._refinement(refinement);
224
+ }
225
+ constructor(def) {
226
+ /** Alias of safeParseAsync */
227
+ this.spa = this.safeParseAsync;
228
+ this._def = def;
229
+ this.parse = this.parse.bind(this);
230
+ this.safeParse = this.safeParse.bind(this);
231
+ this.parseAsync = this.parseAsync.bind(this);
232
+ this.safeParseAsync = this.safeParseAsync.bind(this);
233
+ this.spa = this.spa.bind(this);
234
+ this.refine = this.refine.bind(this);
235
+ this.refinement = this.refinement.bind(this);
236
+ this.superRefine = this.superRefine.bind(this);
237
+ this.optional = this.optional.bind(this);
238
+ this.nullable = this.nullable.bind(this);
239
+ this.nullish = this.nullish.bind(this);
240
+ this.array = this.array.bind(this);
241
+ this.promise = this.promise.bind(this);
242
+ this.or = this.or.bind(this);
243
+ this.and = this.and.bind(this);
244
+ this.transform = this.transform.bind(this);
245
+ this.brand = this.brand.bind(this);
246
+ this.default = this.default.bind(this);
247
+ this.catch = this.catch.bind(this);
248
+ this.describe = this.describe.bind(this);
249
+ this.pipe = this.pipe.bind(this);
250
+ this.readonly = this.readonly.bind(this);
251
+ this.isNullable = this.isNullable.bind(this);
252
+ this.isOptional = this.isOptional.bind(this);
253
+ this["~standard"] = {
254
+ version: 1,
255
+ vendor: "zod",
256
+ validate: (data) => this["~validate"](data)
257
+ };
258
+ }
259
+ optional() {
260
+ return ZodOptional.create(this, this._def);
261
+ }
262
+ nullable() {
263
+ return ZodNullable.create(this, this._def);
264
+ }
265
+ nullish() {
266
+ return this.nullable().optional();
267
+ }
268
+ array() {
269
+ return ZodArray.create(this);
270
+ }
271
+ promise() {
272
+ return ZodPromise.create(this, this._def);
273
+ }
274
+ or(option) {
275
+ return ZodUnion.create([this, option], this._def);
276
+ }
277
+ and(incoming) {
278
+ return ZodIntersection.create(this, incoming, this._def);
279
+ }
280
+ transform(transform) {
281
+ return new ZodEffects({
282
+ ...processCreateParams(this._def),
283
+ schema: this,
284
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
285
+ effect: {
286
+ type: "transform",
287
+ transform
288
+ }
289
+ });
290
+ }
291
+ default(def) {
292
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
293
+ return new ZodDefault({
294
+ ...processCreateParams(this._def),
295
+ innerType: this,
296
+ defaultValue: defaultValueFunc,
297
+ typeName: ZodFirstPartyTypeKind.ZodDefault
298
+ });
299
+ }
300
+ brand() {
301
+ return new ZodBranded({
302
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
303
+ type: this,
304
+ ...processCreateParams(this._def)
305
+ });
306
+ }
307
+ catch(def) {
308
+ const catchValueFunc = typeof def === "function" ? def : () => def;
309
+ return new ZodCatch({
310
+ ...processCreateParams(this._def),
311
+ innerType: this,
312
+ catchValue: catchValueFunc,
313
+ typeName: ZodFirstPartyTypeKind.ZodCatch
314
+ });
315
+ }
316
+ describe(description) {
317
+ const This = this.constructor;
318
+ return new This({
319
+ ...this._def,
320
+ description
321
+ });
322
+ }
323
+ pipe(target) {
324
+ return ZodPipeline.create(this, target);
325
+ }
326
+ readonly() {
327
+ return ZodReadonly.create(this);
328
+ }
329
+ isOptional() {
330
+ return this.safeParse(void 0).success;
331
+ }
332
+ isNullable() {
333
+ return this.safeParse(null).success;
334
+ }
335
+ };
336
+ const cuidRegex = /^c[^\s-]{8,}$/i;
337
+ const cuid2Regex = /^[0-9a-z]+$/;
338
+ const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
339
+ const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
340
+ const nanoidRegex = /^[a-z0-9_-]{21}$/i;
341
+ const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
342
+ const durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
343
+ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
344
+ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
345
+ let emojiRegex;
346
+ const ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
347
+ const ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
348
+ const ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
349
+ const ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
350
+ const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
351
+ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
352
+ const dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
353
+ const dateRegex = /* @__PURE__ */ new RegExp(`^${dateRegexSource}$`);
354
+ function timeRegexSource(args) {
355
+ let secondsRegexSource = `[0-5]\\d`;
356
+ if (args.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
357
+ else if (args.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
358
+ const secondsQuantifier = args.precision ? "+" : "?";
359
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
360
+ }
361
+ function timeRegex(args) {
362
+ return /* @__PURE__ */ new RegExp(`^${timeRegexSource(args)}$`);
363
+ }
364
+ function datetimeRegex(args) {
365
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
366
+ const opts = [];
367
+ opts.push(args.local ? `Z?` : `Z`);
368
+ if (args.offset) opts.push(`([+-]\\d{2}:?\\d{2})`);
369
+ regex = `${regex}(${opts.join("|")})`;
370
+ return /* @__PURE__ */ new RegExp(`^${regex}$`);
371
+ }
372
+ function isValidIP(ip, version) {
373
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) return true;
374
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) return true;
375
+ return false;
376
+ }
377
+ function isValidJWT(jwt, alg) {
378
+ if (!jwtRegex.test(jwt)) return false;
379
+ try {
380
+ const [header] = jwt.split(".");
381
+ if (!header) return false;
382
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
383
+ const decoded = JSON.parse(atob(base64));
384
+ if (typeof decoded !== "object" || decoded === null) return false;
385
+ if ("typ" in decoded && decoded?.typ !== "JWT") return false;
386
+ if (!decoded.alg) return false;
387
+ if (alg && decoded.alg !== alg) return false;
388
+ return true;
389
+ } catch {
390
+ return false;
391
+ }
392
+ }
393
+ function isValidCidr(ip, version) {
394
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) return true;
395
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) return true;
396
+ return false;
397
+ }
398
+ var ZodString = class ZodString extends ZodType {
399
+ _parse(input) {
400
+ if (this._def.coerce) input.data = String(input.data);
401
+ if (this._getType(input) !== ZodParsedType.string) {
402
+ const ctx$1 = this._getOrReturnCtx(input);
403
+ addIssueToContext(ctx$1, {
404
+ code: ZodIssueCode.invalid_type,
405
+ expected: ZodParsedType.string,
406
+ received: ctx$1.parsedType
407
+ });
408
+ return INVALID;
409
+ }
410
+ const status = new ParseStatus();
411
+ let ctx = void 0;
412
+ for (const check of this._def.checks) if (check.kind === "min") {
413
+ if (input.data.length < check.value) {
414
+ ctx = this._getOrReturnCtx(input, ctx);
415
+ addIssueToContext(ctx, {
416
+ code: ZodIssueCode.too_small,
417
+ minimum: check.value,
418
+ type: "string",
419
+ inclusive: true,
420
+ exact: false,
421
+ message: check.message
422
+ });
423
+ status.dirty();
424
+ }
425
+ } else if (check.kind === "max") {
426
+ if (input.data.length > check.value) {
427
+ ctx = this._getOrReturnCtx(input, ctx);
428
+ addIssueToContext(ctx, {
429
+ code: ZodIssueCode.too_big,
430
+ maximum: check.value,
431
+ type: "string",
432
+ inclusive: true,
433
+ exact: false,
434
+ message: check.message
435
+ });
436
+ status.dirty();
437
+ }
438
+ } else if (check.kind === "length") {
439
+ const tooBig = input.data.length > check.value;
440
+ const tooSmall = input.data.length < check.value;
441
+ if (tooBig || tooSmall) {
442
+ ctx = this._getOrReturnCtx(input, ctx);
443
+ if (tooBig) addIssueToContext(ctx, {
444
+ code: ZodIssueCode.too_big,
445
+ maximum: check.value,
446
+ type: "string",
447
+ inclusive: true,
448
+ exact: true,
449
+ message: check.message
450
+ });
451
+ else if (tooSmall) addIssueToContext(ctx, {
452
+ code: ZodIssueCode.too_small,
453
+ minimum: check.value,
454
+ type: "string",
455
+ inclusive: true,
456
+ exact: true,
457
+ message: check.message
458
+ });
459
+ status.dirty();
460
+ }
461
+ } else if (check.kind === "email") {
462
+ if (!emailRegex.test(input.data)) {
463
+ ctx = this._getOrReturnCtx(input, ctx);
464
+ addIssueToContext(ctx, {
465
+ validation: "email",
466
+ code: ZodIssueCode.invalid_string,
467
+ message: check.message
468
+ });
469
+ status.dirty();
470
+ }
471
+ } else if (check.kind === "emoji") {
472
+ if (!emojiRegex) emojiRegex = new RegExp(_emojiRegex, "u");
473
+ if (!emojiRegex.test(input.data)) {
474
+ ctx = this._getOrReturnCtx(input, ctx);
475
+ addIssueToContext(ctx, {
476
+ validation: "emoji",
477
+ code: ZodIssueCode.invalid_string,
478
+ message: check.message
479
+ });
480
+ status.dirty();
481
+ }
482
+ } else if (check.kind === "uuid") {
483
+ if (!uuidRegex.test(input.data)) {
484
+ ctx = this._getOrReturnCtx(input, ctx);
485
+ addIssueToContext(ctx, {
486
+ validation: "uuid",
487
+ code: ZodIssueCode.invalid_string,
488
+ message: check.message
489
+ });
490
+ status.dirty();
491
+ }
492
+ } else if (check.kind === "nanoid") {
493
+ if (!nanoidRegex.test(input.data)) {
494
+ ctx = this._getOrReturnCtx(input, ctx);
495
+ addIssueToContext(ctx, {
496
+ validation: "nanoid",
497
+ code: ZodIssueCode.invalid_string,
498
+ message: check.message
499
+ });
500
+ status.dirty();
501
+ }
502
+ } else if (check.kind === "cuid") {
503
+ if (!cuidRegex.test(input.data)) {
504
+ ctx = this._getOrReturnCtx(input, ctx);
505
+ addIssueToContext(ctx, {
506
+ validation: "cuid",
507
+ code: ZodIssueCode.invalid_string,
508
+ message: check.message
509
+ });
510
+ status.dirty();
511
+ }
512
+ } else if (check.kind === "cuid2") {
513
+ if (!cuid2Regex.test(input.data)) {
514
+ ctx = this._getOrReturnCtx(input, ctx);
515
+ addIssueToContext(ctx, {
516
+ validation: "cuid2",
517
+ code: ZodIssueCode.invalid_string,
518
+ message: check.message
519
+ });
520
+ status.dirty();
521
+ }
522
+ } else if (check.kind === "ulid") {
523
+ if (!ulidRegex.test(input.data)) {
524
+ ctx = this._getOrReturnCtx(input, ctx);
525
+ addIssueToContext(ctx, {
526
+ validation: "ulid",
527
+ code: ZodIssueCode.invalid_string,
528
+ message: check.message
529
+ });
530
+ status.dirty();
531
+ }
532
+ } else if (check.kind === "url") try {
533
+ new URL(input.data);
534
+ } catch {
535
+ ctx = this._getOrReturnCtx(input, ctx);
536
+ addIssueToContext(ctx, {
537
+ validation: "url",
538
+ code: ZodIssueCode.invalid_string,
539
+ message: check.message
540
+ });
541
+ status.dirty();
542
+ }
543
+ else if (check.kind === "regex") {
544
+ check.regex.lastIndex = 0;
545
+ if (!check.regex.test(input.data)) {
546
+ ctx = this._getOrReturnCtx(input, ctx);
547
+ addIssueToContext(ctx, {
548
+ validation: "regex",
549
+ code: ZodIssueCode.invalid_string,
550
+ message: check.message
551
+ });
552
+ status.dirty();
553
+ }
554
+ } else if (check.kind === "trim") input.data = input.data.trim();
555
+ else if (check.kind === "includes") {
556
+ if (!input.data.includes(check.value, check.position)) {
557
+ ctx = this._getOrReturnCtx(input, ctx);
558
+ addIssueToContext(ctx, {
559
+ code: ZodIssueCode.invalid_string,
560
+ validation: {
561
+ includes: check.value,
562
+ position: check.position
563
+ },
564
+ message: check.message
565
+ });
566
+ status.dirty();
567
+ }
568
+ } else if (check.kind === "toLowerCase") input.data = input.data.toLowerCase();
569
+ else if (check.kind === "toUpperCase") input.data = input.data.toUpperCase();
570
+ else if (check.kind === "startsWith") {
571
+ if (!input.data.startsWith(check.value)) {
572
+ ctx = this._getOrReturnCtx(input, ctx);
573
+ addIssueToContext(ctx, {
574
+ code: ZodIssueCode.invalid_string,
575
+ validation: { startsWith: check.value },
576
+ message: check.message
577
+ });
578
+ status.dirty();
579
+ }
580
+ } else if (check.kind === "endsWith") {
581
+ if (!input.data.endsWith(check.value)) {
582
+ ctx = this._getOrReturnCtx(input, ctx);
583
+ addIssueToContext(ctx, {
584
+ code: ZodIssueCode.invalid_string,
585
+ validation: { endsWith: check.value },
586
+ message: check.message
587
+ });
588
+ status.dirty();
589
+ }
590
+ } else if (check.kind === "datetime") {
591
+ if (!datetimeRegex(check).test(input.data)) {
592
+ ctx = this._getOrReturnCtx(input, ctx);
593
+ addIssueToContext(ctx, {
594
+ code: ZodIssueCode.invalid_string,
595
+ validation: "datetime",
596
+ message: check.message
597
+ });
598
+ status.dirty();
599
+ }
600
+ } else if (check.kind === "date") {
601
+ if (!dateRegex.test(input.data)) {
602
+ ctx = this._getOrReturnCtx(input, ctx);
603
+ addIssueToContext(ctx, {
604
+ code: ZodIssueCode.invalid_string,
605
+ validation: "date",
606
+ message: check.message
607
+ });
608
+ status.dirty();
609
+ }
610
+ } else if (check.kind === "time") {
611
+ if (!timeRegex(check).test(input.data)) {
612
+ ctx = this._getOrReturnCtx(input, ctx);
613
+ addIssueToContext(ctx, {
614
+ code: ZodIssueCode.invalid_string,
615
+ validation: "time",
616
+ message: check.message
617
+ });
618
+ status.dirty();
619
+ }
620
+ } else if (check.kind === "duration") {
621
+ if (!durationRegex.test(input.data)) {
622
+ ctx = this._getOrReturnCtx(input, ctx);
623
+ addIssueToContext(ctx, {
624
+ validation: "duration",
625
+ code: ZodIssueCode.invalid_string,
626
+ message: check.message
627
+ });
628
+ status.dirty();
629
+ }
630
+ } else if (check.kind === "ip") {
631
+ if (!isValidIP(input.data, check.version)) {
632
+ ctx = this._getOrReturnCtx(input, ctx);
633
+ addIssueToContext(ctx, {
634
+ validation: "ip",
635
+ code: ZodIssueCode.invalid_string,
636
+ message: check.message
637
+ });
638
+ status.dirty();
639
+ }
640
+ } else if (check.kind === "jwt") {
641
+ if (!isValidJWT(input.data, check.alg)) {
642
+ ctx = this._getOrReturnCtx(input, ctx);
643
+ addIssueToContext(ctx, {
644
+ validation: "jwt",
645
+ code: ZodIssueCode.invalid_string,
646
+ message: check.message
647
+ });
648
+ status.dirty();
649
+ }
650
+ } else if (check.kind === "cidr") {
651
+ if (!isValidCidr(input.data, check.version)) {
652
+ ctx = this._getOrReturnCtx(input, ctx);
653
+ addIssueToContext(ctx, {
654
+ validation: "cidr",
655
+ code: ZodIssueCode.invalid_string,
656
+ message: check.message
657
+ });
658
+ status.dirty();
659
+ }
660
+ } else if (check.kind === "base64") {
661
+ if (!base64Regex.test(input.data)) {
662
+ ctx = this._getOrReturnCtx(input, ctx);
663
+ addIssueToContext(ctx, {
664
+ validation: "base64",
665
+ code: ZodIssueCode.invalid_string,
666
+ message: check.message
667
+ });
668
+ status.dirty();
669
+ }
670
+ } else if (check.kind === "base64url") {
671
+ if (!base64urlRegex.test(input.data)) {
672
+ ctx = this._getOrReturnCtx(input, ctx);
673
+ addIssueToContext(ctx, {
674
+ validation: "base64url",
675
+ code: ZodIssueCode.invalid_string,
676
+ message: check.message
677
+ });
678
+ status.dirty();
679
+ }
680
+ } else util.assertNever(check);
681
+ return {
682
+ status: status.value,
683
+ value: input.data
684
+ };
685
+ }
686
+ _regex(regex, validation, message) {
687
+ return this.refinement((data) => regex.test(data), {
688
+ validation,
689
+ code: ZodIssueCode.invalid_string,
690
+ ...errorUtil.errToObj(message)
691
+ });
692
+ }
693
+ _addCheck(check) {
694
+ return new ZodString({
695
+ ...this._def,
696
+ checks: [...this._def.checks, check]
697
+ });
698
+ }
699
+ email(message) {
700
+ return this._addCheck({
701
+ kind: "email",
702
+ ...errorUtil.errToObj(message)
703
+ });
704
+ }
705
+ url(message) {
706
+ return this._addCheck({
707
+ kind: "url",
708
+ ...errorUtil.errToObj(message)
709
+ });
710
+ }
711
+ emoji(message) {
712
+ return this._addCheck({
713
+ kind: "emoji",
714
+ ...errorUtil.errToObj(message)
715
+ });
716
+ }
717
+ uuid(message) {
718
+ return this._addCheck({
719
+ kind: "uuid",
720
+ ...errorUtil.errToObj(message)
721
+ });
722
+ }
723
+ nanoid(message) {
724
+ return this._addCheck({
725
+ kind: "nanoid",
726
+ ...errorUtil.errToObj(message)
727
+ });
728
+ }
729
+ cuid(message) {
730
+ return this._addCheck({
731
+ kind: "cuid",
732
+ ...errorUtil.errToObj(message)
733
+ });
734
+ }
735
+ cuid2(message) {
736
+ return this._addCheck({
737
+ kind: "cuid2",
738
+ ...errorUtil.errToObj(message)
739
+ });
740
+ }
741
+ ulid(message) {
742
+ return this._addCheck({
743
+ kind: "ulid",
744
+ ...errorUtil.errToObj(message)
745
+ });
746
+ }
747
+ base64(message) {
748
+ return this._addCheck({
749
+ kind: "base64",
750
+ ...errorUtil.errToObj(message)
751
+ });
752
+ }
753
+ base64url(message) {
754
+ return this._addCheck({
755
+ kind: "base64url",
756
+ ...errorUtil.errToObj(message)
757
+ });
758
+ }
759
+ jwt(options) {
760
+ return this._addCheck({
761
+ kind: "jwt",
762
+ ...errorUtil.errToObj(options)
763
+ });
764
+ }
765
+ ip(options) {
766
+ return this._addCheck({
767
+ kind: "ip",
768
+ ...errorUtil.errToObj(options)
769
+ });
770
+ }
771
+ cidr(options) {
772
+ return this._addCheck({
773
+ kind: "cidr",
774
+ ...errorUtil.errToObj(options)
775
+ });
776
+ }
777
+ datetime(options) {
778
+ if (typeof options === "string") return this._addCheck({
779
+ kind: "datetime",
780
+ precision: null,
781
+ offset: false,
782
+ local: false,
783
+ message: options
784
+ });
785
+ return this._addCheck({
786
+ kind: "datetime",
787
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
788
+ offset: options?.offset ?? false,
789
+ local: options?.local ?? false,
790
+ ...errorUtil.errToObj(options?.message)
791
+ });
792
+ }
793
+ date(message) {
794
+ return this._addCheck({
795
+ kind: "date",
796
+ message
797
+ });
798
+ }
799
+ time(options) {
800
+ if (typeof options === "string") return this._addCheck({
801
+ kind: "time",
802
+ precision: null,
803
+ message: options
804
+ });
805
+ return this._addCheck({
806
+ kind: "time",
807
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
808
+ ...errorUtil.errToObj(options?.message)
809
+ });
810
+ }
811
+ duration(message) {
812
+ return this._addCheck({
813
+ kind: "duration",
814
+ ...errorUtil.errToObj(message)
815
+ });
816
+ }
817
+ regex(regex, message) {
818
+ return this._addCheck({
819
+ kind: "regex",
820
+ regex,
821
+ ...errorUtil.errToObj(message)
822
+ });
823
+ }
824
+ includes(value, options) {
825
+ return this._addCheck({
826
+ kind: "includes",
827
+ value,
828
+ position: options?.position,
829
+ ...errorUtil.errToObj(options?.message)
830
+ });
831
+ }
832
+ startsWith(value, message) {
833
+ return this._addCheck({
834
+ kind: "startsWith",
835
+ value,
836
+ ...errorUtil.errToObj(message)
837
+ });
838
+ }
839
+ endsWith(value, message) {
840
+ return this._addCheck({
841
+ kind: "endsWith",
842
+ value,
843
+ ...errorUtil.errToObj(message)
844
+ });
845
+ }
846
+ min(minLength, message) {
847
+ return this._addCheck({
848
+ kind: "min",
849
+ value: minLength,
850
+ ...errorUtil.errToObj(message)
851
+ });
852
+ }
853
+ max(maxLength, message) {
854
+ return this._addCheck({
855
+ kind: "max",
856
+ value: maxLength,
857
+ ...errorUtil.errToObj(message)
858
+ });
859
+ }
860
+ length(len, message) {
861
+ return this._addCheck({
862
+ kind: "length",
863
+ value: len,
864
+ ...errorUtil.errToObj(message)
865
+ });
866
+ }
867
+ /**
868
+ * Equivalent to `.min(1)`
869
+ */
870
+ nonempty(message) {
871
+ return this.min(1, errorUtil.errToObj(message));
872
+ }
873
+ trim() {
874
+ return new ZodString({
875
+ ...this._def,
876
+ checks: [...this._def.checks, { kind: "trim" }]
877
+ });
878
+ }
879
+ toLowerCase() {
880
+ return new ZodString({
881
+ ...this._def,
882
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
883
+ });
884
+ }
885
+ toUpperCase() {
886
+ return new ZodString({
887
+ ...this._def,
888
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
889
+ });
890
+ }
891
+ get isDatetime() {
892
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
893
+ }
894
+ get isDate() {
895
+ return !!this._def.checks.find((ch) => ch.kind === "date");
896
+ }
897
+ get isTime() {
898
+ return !!this._def.checks.find((ch) => ch.kind === "time");
899
+ }
900
+ get isDuration() {
901
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
902
+ }
903
+ get isEmail() {
904
+ return !!this._def.checks.find((ch) => ch.kind === "email");
905
+ }
906
+ get isURL() {
907
+ return !!this._def.checks.find((ch) => ch.kind === "url");
908
+ }
909
+ get isEmoji() {
910
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
911
+ }
912
+ get isUUID() {
913
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
914
+ }
915
+ get isNANOID() {
916
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
917
+ }
918
+ get isCUID() {
919
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
920
+ }
921
+ get isCUID2() {
922
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
923
+ }
924
+ get isULID() {
925
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
926
+ }
927
+ get isIP() {
928
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
929
+ }
930
+ get isCIDR() {
931
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
932
+ }
933
+ get isBase64() {
934
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
935
+ }
936
+ get isBase64url() {
937
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
938
+ }
939
+ get minLength() {
940
+ let min = null;
941
+ for (const ch of this._def.checks) if (ch.kind === "min") {
942
+ if (min === null || ch.value > min) min = ch.value;
943
+ }
944
+ return min;
945
+ }
946
+ get maxLength() {
947
+ let max = null;
948
+ for (const ch of this._def.checks) if (ch.kind === "max") {
949
+ if (max === null || ch.value < max) max = ch.value;
950
+ }
951
+ return max;
952
+ }
953
+ };
954
+ ZodString.create = (params) => {
955
+ return new ZodString({
956
+ checks: [],
957
+ typeName: ZodFirstPartyTypeKind.ZodString,
958
+ coerce: params?.coerce ?? false,
959
+ ...processCreateParams(params)
960
+ });
961
+ };
962
+ function floatSafeRemainder(val, step) {
963
+ const valDecCount = (val.toString().split(".")[1] || "").length;
964
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
965
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
966
+ return Number.parseInt(val.toFixed(decCount).replace(".", "")) % Number.parseInt(step.toFixed(decCount).replace(".", "")) / 10 ** decCount;
967
+ }
968
+ var ZodNumber = class ZodNumber extends ZodType {
969
+ constructor() {
970
+ super(...arguments);
971
+ this.min = this.gte;
972
+ this.max = this.lte;
973
+ this.step = this.multipleOf;
974
+ }
975
+ _parse(input) {
976
+ if (this._def.coerce) input.data = Number(input.data);
977
+ if (this._getType(input) !== ZodParsedType.number) {
978
+ const ctx$1 = this._getOrReturnCtx(input);
979
+ addIssueToContext(ctx$1, {
980
+ code: ZodIssueCode.invalid_type,
981
+ expected: ZodParsedType.number,
982
+ received: ctx$1.parsedType
983
+ });
984
+ return INVALID;
985
+ }
986
+ let ctx = void 0;
987
+ const status = new ParseStatus();
988
+ for (const check of this._def.checks) if (check.kind === "int") {
989
+ if (!util.isInteger(input.data)) {
990
+ ctx = this._getOrReturnCtx(input, ctx);
991
+ addIssueToContext(ctx, {
992
+ code: ZodIssueCode.invalid_type,
993
+ expected: "integer",
994
+ received: "float",
995
+ message: check.message
996
+ });
997
+ status.dirty();
998
+ }
999
+ } else if (check.kind === "min") {
1000
+ if (check.inclusive ? input.data < check.value : input.data <= check.value) {
1001
+ ctx = this._getOrReturnCtx(input, ctx);
1002
+ addIssueToContext(ctx, {
1003
+ code: ZodIssueCode.too_small,
1004
+ minimum: check.value,
1005
+ type: "number",
1006
+ inclusive: check.inclusive,
1007
+ exact: false,
1008
+ message: check.message
1009
+ });
1010
+ status.dirty();
1011
+ }
1012
+ } else if (check.kind === "max") {
1013
+ if (check.inclusive ? input.data > check.value : input.data >= check.value) {
1014
+ ctx = this._getOrReturnCtx(input, ctx);
1015
+ addIssueToContext(ctx, {
1016
+ code: ZodIssueCode.too_big,
1017
+ maximum: check.value,
1018
+ type: "number",
1019
+ inclusive: check.inclusive,
1020
+ exact: false,
1021
+ message: check.message
1022
+ });
1023
+ status.dirty();
1024
+ }
1025
+ } else if (check.kind === "multipleOf") {
1026
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
1027
+ ctx = this._getOrReturnCtx(input, ctx);
1028
+ addIssueToContext(ctx, {
1029
+ code: ZodIssueCode.not_multiple_of,
1030
+ multipleOf: check.value,
1031
+ message: check.message
1032
+ });
1033
+ status.dirty();
1034
+ }
1035
+ } else if (check.kind === "finite") {
1036
+ if (!Number.isFinite(input.data)) {
1037
+ ctx = this._getOrReturnCtx(input, ctx);
1038
+ addIssueToContext(ctx, {
1039
+ code: ZodIssueCode.not_finite,
1040
+ message: check.message
1041
+ });
1042
+ status.dirty();
1043
+ }
1044
+ } else util.assertNever(check);
1045
+ return {
1046
+ status: status.value,
1047
+ value: input.data
1048
+ };
1049
+ }
1050
+ gte(value, message) {
1051
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1052
+ }
1053
+ gt(value, message) {
1054
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1055
+ }
1056
+ lte(value, message) {
1057
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1058
+ }
1059
+ lt(value, message) {
1060
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1061
+ }
1062
+ setLimit(kind, value, inclusive, message) {
1063
+ return new ZodNumber({
1064
+ ...this._def,
1065
+ checks: [...this._def.checks, {
1066
+ kind,
1067
+ value,
1068
+ inclusive,
1069
+ message: errorUtil.toString(message)
1070
+ }]
1071
+ });
1072
+ }
1073
+ _addCheck(check) {
1074
+ return new ZodNumber({
1075
+ ...this._def,
1076
+ checks: [...this._def.checks, check]
1077
+ });
1078
+ }
1079
+ int(message) {
1080
+ return this._addCheck({
1081
+ kind: "int",
1082
+ message: errorUtil.toString(message)
1083
+ });
1084
+ }
1085
+ positive(message) {
1086
+ return this._addCheck({
1087
+ kind: "min",
1088
+ value: 0,
1089
+ inclusive: false,
1090
+ message: errorUtil.toString(message)
1091
+ });
1092
+ }
1093
+ negative(message) {
1094
+ return this._addCheck({
1095
+ kind: "max",
1096
+ value: 0,
1097
+ inclusive: false,
1098
+ message: errorUtil.toString(message)
1099
+ });
1100
+ }
1101
+ nonpositive(message) {
1102
+ return this._addCheck({
1103
+ kind: "max",
1104
+ value: 0,
1105
+ inclusive: true,
1106
+ message: errorUtil.toString(message)
1107
+ });
1108
+ }
1109
+ nonnegative(message) {
1110
+ return this._addCheck({
1111
+ kind: "min",
1112
+ value: 0,
1113
+ inclusive: true,
1114
+ message: errorUtil.toString(message)
1115
+ });
1116
+ }
1117
+ multipleOf(value, message) {
1118
+ return this._addCheck({
1119
+ kind: "multipleOf",
1120
+ value,
1121
+ message: errorUtil.toString(message)
1122
+ });
1123
+ }
1124
+ finite(message) {
1125
+ return this._addCheck({
1126
+ kind: "finite",
1127
+ message: errorUtil.toString(message)
1128
+ });
1129
+ }
1130
+ safe(message) {
1131
+ return this._addCheck({
1132
+ kind: "min",
1133
+ inclusive: true,
1134
+ value: Number.MIN_SAFE_INTEGER,
1135
+ message: errorUtil.toString(message)
1136
+ })._addCheck({
1137
+ kind: "max",
1138
+ inclusive: true,
1139
+ value: Number.MAX_SAFE_INTEGER,
1140
+ message: errorUtil.toString(message)
1141
+ });
1142
+ }
1143
+ get minValue() {
1144
+ let min = null;
1145
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1146
+ if (min === null || ch.value > min) min = ch.value;
1147
+ }
1148
+ return min;
1149
+ }
1150
+ get maxValue() {
1151
+ let max = null;
1152
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1153
+ if (max === null || ch.value < max) max = ch.value;
1154
+ }
1155
+ return max;
1156
+ }
1157
+ get isInt() {
1158
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1159
+ }
1160
+ get isFinite() {
1161
+ let max = null;
1162
+ let min = null;
1163
+ for (const ch of this._def.checks) if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") return true;
1164
+ else if (ch.kind === "min") {
1165
+ if (min === null || ch.value > min) min = ch.value;
1166
+ } else if (ch.kind === "max") {
1167
+ if (max === null || ch.value < max) max = ch.value;
1168
+ }
1169
+ return Number.isFinite(min) && Number.isFinite(max);
1170
+ }
1171
+ };
1172
+ ZodNumber.create = (params) => {
1173
+ return new ZodNumber({
1174
+ checks: [],
1175
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
1176
+ coerce: params?.coerce || false,
1177
+ ...processCreateParams(params)
1178
+ });
1179
+ };
1180
+ var ZodBigInt = class ZodBigInt extends ZodType {
1181
+ constructor() {
1182
+ super(...arguments);
1183
+ this.min = this.gte;
1184
+ this.max = this.lte;
1185
+ }
1186
+ _parse(input) {
1187
+ if (this._def.coerce) try {
1188
+ input.data = BigInt(input.data);
1189
+ } catch {
1190
+ return this._getInvalidInput(input);
1191
+ }
1192
+ if (this._getType(input) !== ZodParsedType.bigint) return this._getInvalidInput(input);
1193
+ let ctx = void 0;
1194
+ const status = new ParseStatus();
1195
+ for (const check of this._def.checks) if (check.kind === "min") {
1196
+ if (check.inclusive ? input.data < check.value : input.data <= check.value) {
1197
+ ctx = this._getOrReturnCtx(input, ctx);
1198
+ addIssueToContext(ctx, {
1199
+ code: ZodIssueCode.too_small,
1200
+ type: "bigint",
1201
+ minimum: check.value,
1202
+ inclusive: check.inclusive,
1203
+ message: check.message
1204
+ });
1205
+ status.dirty();
1206
+ }
1207
+ } else if (check.kind === "max") {
1208
+ if (check.inclusive ? input.data > check.value : input.data >= check.value) {
1209
+ ctx = this._getOrReturnCtx(input, ctx);
1210
+ addIssueToContext(ctx, {
1211
+ code: ZodIssueCode.too_big,
1212
+ type: "bigint",
1213
+ maximum: check.value,
1214
+ inclusive: check.inclusive,
1215
+ message: check.message
1216
+ });
1217
+ status.dirty();
1218
+ }
1219
+ } else if (check.kind === "multipleOf") {
1220
+ if (input.data % check.value !== BigInt(0)) {
1221
+ ctx = this._getOrReturnCtx(input, ctx);
1222
+ addIssueToContext(ctx, {
1223
+ code: ZodIssueCode.not_multiple_of,
1224
+ multipleOf: check.value,
1225
+ message: check.message
1226
+ });
1227
+ status.dirty();
1228
+ }
1229
+ } else util.assertNever(check);
1230
+ return {
1231
+ status: status.value,
1232
+ value: input.data
1233
+ };
1234
+ }
1235
+ _getInvalidInput(input) {
1236
+ const ctx = this._getOrReturnCtx(input);
1237
+ addIssueToContext(ctx, {
1238
+ code: ZodIssueCode.invalid_type,
1239
+ expected: ZodParsedType.bigint,
1240
+ received: ctx.parsedType
1241
+ });
1242
+ return INVALID;
1243
+ }
1244
+ gte(value, message) {
1245
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1246
+ }
1247
+ gt(value, message) {
1248
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1249
+ }
1250
+ lte(value, message) {
1251
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1252
+ }
1253
+ lt(value, message) {
1254
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1255
+ }
1256
+ setLimit(kind, value, inclusive, message) {
1257
+ return new ZodBigInt({
1258
+ ...this._def,
1259
+ checks: [...this._def.checks, {
1260
+ kind,
1261
+ value,
1262
+ inclusive,
1263
+ message: errorUtil.toString(message)
1264
+ }]
1265
+ });
1266
+ }
1267
+ _addCheck(check) {
1268
+ return new ZodBigInt({
1269
+ ...this._def,
1270
+ checks: [...this._def.checks, check]
1271
+ });
1272
+ }
1273
+ positive(message) {
1274
+ return this._addCheck({
1275
+ kind: "min",
1276
+ value: BigInt(0),
1277
+ inclusive: false,
1278
+ message: errorUtil.toString(message)
1279
+ });
1280
+ }
1281
+ negative(message) {
1282
+ return this._addCheck({
1283
+ kind: "max",
1284
+ value: BigInt(0),
1285
+ inclusive: false,
1286
+ message: errorUtil.toString(message)
1287
+ });
1288
+ }
1289
+ nonpositive(message) {
1290
+ return this._addCheck({
1291
+ kind: "max",
1292
+ value: BigInt(0),
1293
+ inclusive: true,
1294
+ message: errorUtil.toString(message)
1295
+ });
1296
+ }
1297
+ nonnegative(message) {
1298
+ return this._addCheck({
1299
+ kind: "min",
1300
+ value: BigInt(0),
1301
+ inclusive: true,
1302
+ message: errorUtil.toString(message)
1303
+ });
1304
+ }
1305
+ multipleOf(value, message) {
1306
+ return this._addCheck({
1307
+ kind: "multipleOf",
1308
+ value,
1309
+ message: errorUtil.toString(message)
1310
+ });
1311
+ }
1312
+ get minValue() {
1313
+ let min = null;
1314
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1315
+ if (min === null || ch.value > min) min = ch.value;
1316
+ }
1317
+ return min;
1318
+ }
1319
+ get maxValue() {
1320
+ let max = null;
1321
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1322
+ if (max === null || ch.value < max) max = ch.value;
1323
+ }
1324
+ return max;
1325
+ }
1326
+ };
1327
+ ZodBigInt.create = (params) => {
1328
+ return new ZodBigInt({
1329
+ checks: [],
1330
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
1331
+ coerce: params?.coerce ?? false,
1332
+ ...processCreateParams(params)
1333
+ });
1334
+ };
1335
+ var ZodBoolean = class extends ZodType {
1336
+ _parse(input) {
1337
+ if (this._def.coerce) input.data = Boolean(input.data);
1338
+ if (this._getType(input) !== ZodParsedType.boolean) {
1339
+ const ctx = this._getOrReturnCtx(input);
1340
+ addIssueToContext(ctx, {
1341
+ code: ZodIssueCode.invalid_type,
1342
+ expected: ZodParsedType.boolean,
1343
+ received: ctx.parsedType
1344
+ });
1345
+ return INVALID;
1346
+ }
1347
+ return OK(input.data);
1348
+ }
1349
+ };
1350
+ ZodBoolean.create = (params) => {
1351
+ return new ZodBoolean({
1352
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
1353
+ coerce: params?.coerce || false,
1354
+ ...processCreateParams(params)
1355
+ });
1356
+ };
1357
+ var ZodDate = class ZodDate extends ZodType {
1358
+ _parse(input) {
1359
+ if (this._def.coerce) input.data = new Date(input.data);
1360
+ if (this._getType(input) !== ZodParsedType.date) {
1361
+ const ctx$1 = this._getOrReturnCtx(input);
1362
+ addIssueToContext(ctx$1, {
1363
+ code: ZodIssueCode.invalid_type,
1364
+ expected: ZodParsedType.date,
1365
+ received: ctx$1.parsedType
1366
+ });
1367
+ return INVALID;
1368
+ }
1369
+ if (Number.isNaN(input.data.getTime())) {
1370
+ addIssueToContext(this._getOrReturnCtx(input), { code: ZodIssueCode.invalid_date });
1371
+ return INVALID;
1372
+ }
1373
+ const status = new ParseStatus();
1374
+ let ctx = void 0;
1375
+ for (const check of this._def.checks) if (check.kind === "min") {
1376
+ if (input.data.getTime() < check.value) {
1377
+ ctx = this._getOrReturnCtx(input, ctx);
1378
+ addIssueToContext(ctx, {
1379
+ code: ZodIssueCode.too_small,
1380
+ message: check.message,
1381
+ inclusive: true,
1382
+ exact: false,
1383
+ minimum: check.value,
1384
+ type: "date"
1385
+ });
1386
+ status.dirty();
1387
+ }
1388
+ } else if (check.kind === "max") {
1389
+ if (input.data.getTime() > check.value) {
1390
+ ctx = this._getOrReturnCtx(input, ctx);
1391
+ addIssueToContext(ctx, {
1392
+ code: ZodIssueCode.too_big,
1393
+ message: check.message,
1394
+ inclusive: true,
1395
+ exact: false,
1396
+ maximum: check.value,
1397
+ type: "date"
1398
+ });
1399
+ status.dirty();
1400
+ }
1401
+ } else util.assertNever(check);
1402
+ return {
1403
+ status: status.value,
1404
+ value: new Date(input.data.getTime())
1405
+ };
1406
+ }
1407
+ _addCheck(check) {
1408
+ return new ZodDate({
1409
+ ...this._def,
1410
+ checks: [...this._def.checks, check]
1411
+ });
1412
+ }
1413
+ min(minDate, message) {
1414
+ return this._addCheck({
1415
+ kind: "min",
1416
+ value: minDate.getTime(),
1417
+ message: errorUtil.toString(message)
1418
+ });
1419
+ }
1420
+ max(maxDate, message) {
1421
+ return this._addCheck({
1422
+ kind: "max",
1423
+ value: maxDate.getTime(),
1424
+ message: errorUtil.toString(message)
1425
+ });
1426
+ }
1427
+ get minDate() {
1428
+ let min = null;
1429
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1430
+ if (min === null || ch.value > min) min = ch.value;
1431
+ }
1432
+ return min != null ? new Date(min) : null;
1433
+ }
1434
+ get maxDate() {
1435
+ let max = null;
1436
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1437
+ if (max === null || ch.value < max) max = ch.value;
1438
+ }
1439
+ return max != null ? new Date(max) : null;
1440
+ }
1441
+ };
1442
+ ZodDate.create = (params) => {
1443
+ return new ZodDate({
1444
+ checks: [],
1445
+ coerce: params?.coerce || false,
1446
+ typeName: ZodFirstPartyTypeKind.ZodDate,
1447
+ ...processCreateParams(params)
1448
+ });
1449
+ };
1450
+ var ZodSymbol = class extends ZodType {
1451
+ _parse(input) {
1452
+ if (this._getType(input) !== ZodParsedType.symbol) {
1453
+ const ctx = this._getOrReturnCtx(input);
1454
+ addIssueToContext(ctx, {
1455
+ code: ZodIssueCode.invalid_type,
1456
+ expected: ZodParsedType.symbol,
1457
+ received: ctx.parsedType
1458
+ });
1459
+ return INVALID;
1460
+ }
1461
+ return OK(input.data);
1462
+ }
1463
+ };
1464
+ ZodSymbol.create = (params) => {
1465
+ return new ZodSymbol({
1466
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
1467
+ ...processCreateParams(params)
1468
+ });
1469
+ };
1470
+ var ZodUndefined = class extends ZodType {
1471
+ _parse(input) {
1472
+ if (this._getType(input) !== ZodParsedType.undefined) {
1473
+ const ctx = this._getOrReturnCtx(input);
1474
+ addIssueToContext(ctx, {
1475
+ code: ZodIssueCode.invalid_type,
1476
+ expected: ZodParsedType.undefined,
1477
+ received: ctx.parsedType
1478
+ });
1479
+ return INVALID;
1480
+ }
1481
+ return OK(input.data);
1482
+ }
1483
+ };
1484
+ ZodUndefined.create = (params) => {
1485
+ return new ZodUndefined({
1486
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
1487
+ ...processCreateParams(params)
1488
+ });
1489
+ };
1490
+ var ZodNull = class extends ZodType {
1491
+ _parse(input) {
1492
+ if (this._getType(input) !== ZodParsedType.null) {
1493
+ const ctx = this._getOrReturnCtx(input);
1494
+ addIssueToContext(ctx, {
1495
+ code: ZodIssueCode.invalid_type,
1496
+ expected: ZodParsedType.null,
1497
+ received: ctx.parsedType
1498
+ });
1499
+ return INVALID;
1500
+ }
1501
+ return OK(input.data);
1502
+ }
1503
+ };
1504
+ ZodNull.create = (params) => {
1505
+ return new ZodNull({
1506
+ typeName: ZodFirstPartyTypeKind.ZodNull,
1507
+ ...processCreateParams(params)
1508
+ });
1509
+ };
1510
+ var ZodAny = class extends ZodType {
1511
+ constructor() {
1512
+ super(...arguments);
1513
+ this._any = true;
1514
+ }
1515
+ _parse(input) {
1516
+ return OK(input.data);
1517
+ }
1518
+ };
1519
+ ZodAny.create = (params) => {
1520
+ return new ZodAny({
1521
+ typeName: ZodFirstPartyTypeKind.ZodAny,
1522
+ ...processCreateParams(params)
1523
+ });
1524
+ };
1525
+ var ZodUnknown = class extends ZodType {
1526
+ constructor() {
1527
+ super(...arguments);
1528
+ this._unknown = true;
1529
+ }
1530
+ _parse(input) {
1531
+ return OK(input.data);
1532
+ }
1533
+ };
1534
+ ZodUnknown.create = (params) => {
1535
+ return new ZodUnknown({
1536
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
1537
+ ...processCreateParams(params)
1538
+ });
1539
+ };
1540
+ var ZodNever = class extends ZodType {
1541
+ _parse(input) {
1542
+ const ctx = this._getOrReturnCtx(input);
1543
+ addIssueToContext(ctx, {
1544
+ code: ZodIssueCode.invalid_type,
1545
+ expected: ZodParsedType.never,
1546
+ received: ctx.parsedType
1547
+ });
1548
+ return INVALID;
1549
+ }
1550
+ };
1551
+ ZodNever.create = (params) => {
1552
+ return new ZodNever({
1553
+ typeName: ZodFirstPartyTypeKind.ZodNever,
1554
+ ...processCreateParams(params)
1555
+ });
1556
+ };
1557
+ var ZodVoid = class extends ZodType {
1558
+ _parse(input) {
1559
+ if (this._getType(input) !== ZodParsedType.undefined) {
1560
+ const ctx = this._getOrReturnCtx(input);
1561
+ addIssueToContext(ctx, {
1562
+ code: ZodIssueCode.invalid_type,
1563
+ expected: ZodParsedType.void,
1564
+ received: ctx.parsedType
1565
+ });
1566
+ return INVALID;
1567
+ }
1568
+ return OK(input.data);
1569
+ }
1570
+ };
1571
+ ZodVoid.create = (params) => {
1572
+ return new ZodVoid({
1573
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
1574
+ ...processCreateParams(params)
1575
+ });
1576
+ };
1577
+ var ZodArray = class ZodArray extends ZodType {
1578
+ _parse(input) {
1579
+ const { ctx, status } = this._processInputParams(input);
1580
+ const def = this._def;
1581
+ if (ctx.parsedType !== ZodParsedType.array) {
1582
+ addIssueToContext(ctx, {
1583
+ code: ZodIssueCode.invalid_type,
1584
+ expected: ZodParsedType.array,
1585
+ received: ctx.parsedType
1586
+ });
1587
+ return INVALID;
1588
+ }
1589
+ if (def.exactLength !== null) {
1590
+ const tooBig = ctx.data.length > def.exactLength.value;
1591
+ const tooSmall = ctx.data.length < def.exactLength.value;
1592
+ if (tooBig || tooSmall) {
1593
+ addIssueToContext(ctx, {
1594
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
1595
+ minimum: tooSmall ? def.exactLength.value : void 0,
1596
+ maximum: tooBig ? def.exactLength.value : void 0,
1597
+ type: "array",
1598
+ inclusive: true,
1599
+ exact: true,
1600
+ message: def.exactLength.message
1601
+ });
1602
+ status.dirty();
1603
+ }
1604
+ }
1605
+ if (def.minLength !== null) {
1606
+ if (ctx.data.length < def.minLength.value) {
1607
+ addIssueToContext(ctx, {
1608
+ code: ZodIssueCode.too_small,
1609
+ minimum: def.minLength.value,
1610
+ type: "array",
1611
+ inclusive: true,
1612
+ exact: false,
1613
+ message: def.minLength.message
1614
+ });
1615
+ status.dirty();
1616
+ }
1617
+ }
1618
+ if (def.maxLength !== null) {
1619
+ if (ctx.data.length > def.maxLength.value) {
1620
+ addIssueToContext(ctx, {
1621
+ code: ZodIssueCode.too_big,
1622
+ maximum: def.maxLength.value,
1623
+ type: "array",
1624
+ inclusive: true,
1625
+ exact: false,
1626
+ message: def.maxLength.message
1627
+ });
1628
+ status.dirty();
1629
+ }
1630
+ }
1631
+ if (ctx.common.async) return Promise.all([...ctx.data].map((item, i) => {
1632
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1633
+ })).then((result$1) => {
1634
+ return ParseStatus.mergeArray(status, result$1);
1635
+ });
1636
+ const result = [...ctx.data].map((item, i) => {
1637
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
1638
+ });
1639
+ return ParseStatus.mergeArray(status, result);
1640
+ }
1641
+ get element() {
1642
+ return this._def.type;
1643
+ }
1644
+ min(minLength, message) {
1645
+ return new ZodArray({
1646
+ ...this._def,
1647
+ minLength: {
1648
+ value: minLength,
1649
+ message: errorUtil.toString(message)
1650
+ }
1651
+ });
1652
+ }
1653
+ max(maxLength, message) {
1654
+ return new ZodArray({
1655
+ ...this._def,
1656
+ maxLength: {
1657
+ value: maxLength,
1658
+ message: errorUtil.toString(message)
1659
+ }
1660
+ });
1661
+ }
1662
+ length(len, message) {
1663
+ return new ZodArray({
1664
+ ...this._def,
1665
+ exactLength: {
1666
+ value: len,
1667
+ message: errorUtil.toString(message)
1668
+ }
1669
+ });
1670
+ }
1671
+ nonempty(message) {
1672
+ return this.min(1, message);
1673
+ }
1674
+ };
1675
+ ZodArray.create = (schema, params) => {
1676
+ return new ZodArray({
1677
+ type: schema,
1678
+ minLength: null,
1679
+ maxLength: null,
1680
+ exactLength: null,
1681
+ typeName: ZodFirstPartyTypeKind.ZodArray,
1682
+ ...processCreateParams(params)
1683
+ });
1684
+ };
1685
+ function deepPartialify(schema) {
1686
+ if (schema instanceof ZodObject) {
1687
+ const newShape = {};
1688
+ for (const key in schema.shape) {
1689
+ const fieldSchema = schema.shape[key];
1690
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
1691
+ }
1692
+ return new ZodObject({
1693
+ ...schema._def,
1694
+ shape: () => newShape
1695
+ });
1696
+ } else if (schema instanceof ZodArray) return new ZodArray({
1697
+ ...schema._def,
1698
+ type: deepPartialify(schema.element)
1699
+ });
1700
+ else if (schema instanceof ZodOptional) return ZodOptional.create(deepPartialify(schema.unwrap()));
1701
+ else if (schema instanceof ZodNullable) return ZodNullable.create(deepPartialify(schema.unwrap()));
1702
+ else if (schema instanceof ZodTuple) return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
1703
+ else return schema;
1704
+ }
1705
+ var ZodObject = class ZodObject extends ZodType {
1706
+ constructor() {
1707
+ super(...arguments);
1708
+ this._cached = null;
1709
+ /**
1710
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
1711
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
1712
+ */
1713
+ this.nonstrict = this.passthrough;
1714
+ /**
1715
+ * @deprecated Use `.extend` instead
1716
+ * */
1717
+ this.augment = this.extend;
1718
+ }
1719
+ _getCached() {
1720
+ if (this._cached !== null) return this._cached;
1721
+ const shape = this._def.shape();
1722
+ this._cached = {
1723
+ shape,
1724
+ keys: util.objectKeys(shape)
1725
+ };
1726
+ return this._cached;
1727
+ }
1728
+ _parse(input) {
1729
+ if (this._getType(input) !== ZodParsedType.object) {
1730
+ const ctx$1 = this._getOrReturnCtx(input);
1731
+ addIssueToContext(ctx$1, {
1732
+ code: ZodIssueCode.invalid_type,
1733
+ expected: ZodParsedType.object,
1734
+ received: ctx$1.parsedType
1735
+ });
1736
+ return INVALID;
1737
+ }
1738
+ const { status, ctx } = this._processInputParams(input);
1739
+ const { shape, keys: shapeKeys } = this._getCached();
1740
+ const extraKeys = [];
1741
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
1742
+ for (const key in ctx.data) if (!shapeKeys.includes(key)) extraKeys.push(key);
1743
+ }
1744
+ const pairs = [];
1745
+ for (const key of shapeKeys) {
1746
+ const keyValidator = shape[key];
1747
+ const value = ctx.data[key];
1748
+ pairs.push({
1749
+ key: {
1750
+ status: "valid",
1751
+ value: key
1752
+ },
1753
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
1754
+ alwaysSet: key in ctx.data
1755
+ });
1756
+ }
1757
+ if (this._def.catchall instanceof ZodNever) {
1758
+ const unknownKeys = this._def.unknownKeys;
1759
+ if (unknownKeys === "passthrough") for (const key of extraKeys) pairs.push({
1760
+ key: {
1761
+ status: "valid",
1762
+ value: key
1763
+ },
1764
+ value: {
1765
+ status: "valid",
1766
+ value: ctx.data[key]
1767
+ }
1768
+ });
1769
+ else if (unknownKeys === "strict") {
1770
+ if (extraKeys.length > 0) {
1771
+ addIssueToContext(ctx, {
1772
+ code: ZodIssueCode.unrecognized_keys,
1773
+ keys: extraKeys
1774
+ });
1775
+ status.dirty();
1776
+ }
1777
+ } else if (unknownKeys === "strip") {} else throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
1778
+ } else {
1779
+ const catchall = this._def.catchall;
1780
+ for (const key of extraKeys) {
1781
+ const value = ctx.data[key];
1782
+ pairs.push({
1783
+ key: {
1784
+ status: "valid",
1785
+ value: key
1786
+ },
1787
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
1788
+ alwaysSet: key in ctx.data
1789
+ });
1790
+ }
1791
+ }
1792
+ if (ctx.common.async) return Promise.resolve().then(async () => {
1793
+ const syncPairs = [];
1794
+ for (const pair of pairs) {
1795
+ const key = await pair.key;
1796
+ const value = await pair.value;
1797
+ syncPairs.push({
1798
+ key,
1799
+ value,
1800
+ alwaysSet: pair.alwaysSet
1801
+ });
1802
+ }
1803
+ return syncPairs;
1804
+ }).then((syncPairs) => {
1805
+ return ParseStatus.mergeObjectSync(status, syncPairs);
1806
+ });
1807
+ else return ParseStatus.mergeObjectSync(status, pairs);
1808
+ }
1809
+ get shape() {
1810
+ return this._def.shape();
1811
+ }
1812
+ strict(message) {
1813
+ errorUtil.errToObj;
1814
+ return new ZodObject({
1815
+ ...this._def,
1816
+ unknownKeys: "strict",
1817
+ ...message !== void 0 ? { errorMap: (issue, ctx) => {
1818
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
1819
+ if (issue.code === "unrecognized_keys") return { message: errorUtil.errToObj(message).message ?? defaultError };
1820
+ return { message: defaultError };
1821
+ } } : {}
1822
+ });
1823
+ }
1824
+ strip() {
1825
+ return new ZodObject({
1826
+ ...this._def,
1827
+ unknownKeys: "strip"
1828
+ });
1829
+ }
1830
+ passthrough() {
1831
+ return new ZodObject({
1832
+ ...this._def,
1833
+ unknownKeys: "passthrough"
1834
+ });
1835
+ }
1836
+ extend(augmentation) {
1837
+ return new ZodObject({
1838
+ ...this._def,
1839
+ shape: () => ({
1840
+ ...this._def.shape(),
1841
+ ...augmentation
1842
+ })
1843
+ });
1844
+ }
1845
+ /**
1846
+ * Prior to zod@1.0.12 there was a bug in the
1847
+ * inferred type of merged objects. Please
1848
+ * upgrade if you are experiencing issues.
1849
+ */
1850
+ merge(merging) {
1851
+ return new ZodObject({
1852
+ unknownKeys: merging._def.unknownKeys,
1853
+ catchall: merging._def.catchall,
1854
+ shape: () => ({
1855
+ ...this._def.shape(),
1856
+ ...merging._def.shape()
1857
+ }),
1858
+ typeName: ZodFirstPartyTypeKind.ZodObject
1859
+ });
1860
+ }
1861
+ setKey(key, schema) {
1862
+ return this.augment({ [key]: schema });
1863
+ }
1864
+ catchall(index) {
1865
+ return new ZodObject({
1866
+ ...this._def,
1867
+ catchall: index
1868
+ });
1869
+ }
1870
+ pick(mask) {
1871
+ const shape = {};
1872
+ for (const key of util.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
1873
+ return new ZodObject({
1874
+ ...this._def,
1875
+ shape: () => shape
1876
+ });
1877
+ }
1878
+ omit(mask) {
1879
+ const shape = {};
1880
+ for (const key of util.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
1881
+ return new ZodObject({
1882
+ ...this._def,
1883
+ shape: () => shape
1884
+ });
1885
+ }
1886
+ /**
1887
+ * @deprecated
1888
+ */
1889
+ deepPartial() {
1890
+ return deepPartialify(this);
1891
+ }
1892
+ partial(mask) {
1893
+ const newShape = {};
1894
+ for (const key of util.objectKeys(this.shape)) {
1895
+ const fieldSchema = this.shape[key];
1896
+ if (mask && !mask[key]) newShape[key] = fieldSchema;
1897
+ else newShape[key] = fieldSchema.optional();
1898
+ }
1899
+ return new ZodObject({
1900
+ ...this._def,
1901
+ shape: () => newShape
1902
+ });
1903
+ }
1904
+ required(mask) {
1905
+ const newShape = {};
1906
+ for (const key of util.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
1907
+ else {
1908
+ let newField = this.shape[key];
1909
+ while (newField instanceof ZodOptional) newField = newField._def.innerType;
1910
+ newShape[key] = newField;
1911
+ }
1912
+ return new ZodObject({
1913
+ ...this._def,
1914
+ shape: () => newShape
1915
+ });
1916
+ }
1917
+ keyof() {
1918
+ return createZodEnum(util.objectKeys(this.shape));
1919
+ }
1920
+ };
1921
+ ZodObject.create = (shape, params) => {
1922
+ return new ZodObject({
1923
+ shape: () => shape,
1924
+ unknownKeys: "strip",
1925
+ catchall: ZodNever.create(),
1926
+ typeName: ZodFirstPartyTypeKind.ZodObject,
1927
+ ...processCreateParams(params)
1928
+ });
1929
+ };
1930
+ ZodObject.strictCreate = (shape, params) => {
1931
+ return new ZodObject({
1932
+ shape: () => shape,
1933
+ unknownKeys: "strict",
1934
+ catchall: ZodNever.create(),
1935
+ typeName: ZodFirstPartyTypeKind.ZodObject,
1936
+ ...processCreateParams(params)
1937
+ });
1938
+ };
1939
+ ZodObject.lazycreate = (shape, params) => {
1940
+ return new ZodObject({
1941
+ shape,
1942
+ unknownKeys: "strip",
1943
+ catchall: ZodNever.create(),
1944
+ typeName: ZodFirstPartyTypeKind.ZodObject,
1945
+ ...processCreateParams(params)
1946
+ });
1947
+ };
1948
+ var ZodUnion = class extends ZodType {
1949
+ _parse(input) {
1950
+ const { ctx } = this._processInputParams(input);
1951
+ const options = this._def.options;
1952
+ function handleResults(results) {
1953
+ for (const result of results) if (result.result.status === "valid") return result.result;
1954
+ for (const result of results) if (result.result.status === "dirty") {
1955
+ ctx.common.issues.push(...result.ctx.common.issues);
1956
+ return result.result;
1957
+ }
1958
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
1959
+ addIssueToContext(ctx, {
1960
+ code: ZodIssueCode.invalid_union,
1961
+ unionErrors
1962
+ });
1963
+ return INVALID;
1964
+ }
1965
+ if (ctx.common.async) return Promise.all(options.map(async (option) => {
1966
+ const childCtx = {
1967
+ ...ctx,
1968
+ common: {
1969
+ ...ctx.common,
1970
+ issues: []
1971
+ },
1972
+ parent: null
1973
+ };
1974
+ return {
1975
+ result: await option._parseAsync({
1976
+ data: ctx.data,
1977
+ path: ctx.path,
1978
+ parent: childCtx
1979
+ }),
1980
+ ctx: childCtx
1981
+ };
1982
+ })).then(handleResults);
1983
+ else {
1984
+ let dirty = void 0;
1985
+ const issues = [];
1986
+ for (const option of options) {
1987
+ const childCtx = {
1988
+ ...ctx,
1989
+ common: {
1990
+ ...ctx.common,
1991
+ issues: []
1992
+ },
1993
+ parent: null
1994
+ };
1995
+ const result = option._parseSync({
1996
+ data: ctx.data,
1997
+ path: ctx.path,
1998
+ parent: childCtx
1999
+ });
2000
+ if (result.status === "valid") return result;
2001
+ else if (result.status === "dirty" && !dirty) dirty = {
2002
+ result,
2003
+ ctx: childCtx
2004
+ };
2005
+ if (childCtx.common.issues.length) issues.push(childCtx.common.issues);
2006
+ }
2007
+ if (dirty) {
2008
+ ctx.common.issues.push(...dirty.ctx.common.issues);
2009
+ return dirty.result;
2010
+ }
2011
+ const unionErrors = issues.map((issues$1) => new ZodError(issues$1));
2012
+ addIssueToContext(ctx, {
2013
+ code: ZodIssueCode.invalid_union,
2014
+ unionErrors
2015
+ });
2016
+ return INVALID;
2017
+ }
2018
+ }
2019
+ get options() {
2020
+ return this._def.options;
2021
+ }
2022
+ };
2023
+ ZodUnion.create = (types, params) => {
2024
+ return new ZodUnion({
2025
+ options: types,
2026
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
2027
+ ...processCreateParams(params)
2028
+ });
2029
+ };
2030
+ const getDiscriminator = (type) => {
2031
+ if (type instanceof ZodLazy) return getDiscriminator(type.schema);
2032
+ else if (type instanceof ZodEffects) return getDiscriminator(type.innerType());
2033
+ else if (type instanceof ZodLiteral) return [type.value];
2034
+ else if (type instanceof ZodEnum) return type.options;
2035
+ else if (type instanceof ZodNativeEnum) return util.objectValues(type.enum);
2036
+ else if (type instanceof ZodDefault) return getDiscriminator(type._def.innerType);
2037
+ else if (type instanceof ZodUndefined) return [void 0];
2038
+ else if (type instanceof ZodNull) return [null];
2039
+ else if (type instanceof ZodOptional) return [void 0, ...getDiscriminator(type.unwrap())];
2040
+ else if (type instanceof ZodNullable) return [null, ...getDiscriminator(type.unwrap())];
2041
+ else if (type instanceof ZodBranded) return getDiscriminator(type.unwrap());
2042
+ else if (type instanceof ZodReadonly) return getDiscriminator(type.unwrap());
2043
+ else if (type instanceof ZodCatch) return getDiscriminator(type._def.innerType);
2044
+ else return [];
2045
+ };
2046
+ var ZodDiscriminatedUnion = class ZodDiscriminatedUnion extends ZodType {
2047
+ _parse(input) {
2048
+ const { ctx } = this._processInputParams(input);
2049
+ if (ctx.parsedType !== ZodParsedType.object) {
2050
+ addIssueToContext(ctx, {
2051
+ code: ZodIssueCode.invalid_type,
2052
+ expected: ZodParsedType.object,
2053
+ received: ctx.parsedType
2054
+ });
2055
+ return INVALID;
2056
+ }
2057
+ const discriminator = this.discriminator;
2058
+ const discriminatorValue = ctx.data[discriminator];
2059
+ const option = this.optionsMap.get(discriminatorValue);
2060
+ if (!option) {
2061
+ addIssueToContext(ctx, {
2062
+ code: ZodIssueCode.invalid_union_discriminator,
2063
+ options: Array.from(this.optionsMap.keys()),
2064
+ path: [discriminator]
2065
+ });
2066
+ return INVALID;
2067
+ }
2068
+ if (ctx.common.async) return option._parseAsync({
2069
+ data: ctx.data,
2070
+ path: ctx.path,
2071
+ parent: ctx
2072
+ });
2073
+ else return option._parseSync({
2074
+ data: ctx.data,
2075
+ path: ctx.path,
2076
+ parent: ctx
2077
+ });
2078
+ }
2079
+ get discriminator() {
2080
+ return this._def.discriminator;
2081
+ }
2082
+ get options() {
2083
+ return this._def.options;
2084
+ }
2085
+ get optionsMap() {
2086
+ return this._def.optionsMap;
2087
+ }
2088
+ /**
2089
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2090
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2091
+ * have a different value for each object in the union.
2092
+ * @param discriminator the name of the discriminator property
2093
+ * @param types an array of object schemas
2094
+ * @param params
2095
+ */
2096
+ static create(discriminator, options, params) {
2097
+ const optionsMap = /* @__PURE__ */ new Map();
2098
+ for (const type of options) {
2099
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2100
+ if (!discriminatorValues.length) throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2101
+ for (const value of discriminatorValues) {
2102
+ if (optionsMap.has(value)) throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2103
+ optionsMap.set(value, type);
2104
+ }
2105
+ }
2106
+ return new ZodDiscriminatedUnion({
2107
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2108
+ discriminator,
2109
+ options,
2110
+ optionsMap,
2111
+ ...processCreateParams(params)
2112
+ });
2113
+ }
2114
+ };
2115
+ function mergeValues(a, b) {
2116
+ const aType = getParsedType(a);
2117
+ const bType = getParsedType(b);
2118
+ if (a === b) return {
2119
+ valid: true,
2120
+ data: a
2121
+ };
2122
+ else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2123
+ const bKeys = util.objectKeys(b);
2124
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2125
+ const newObj = {
2126
+ ...a,
2127
+ ...b
2128
+ };
2129
+ for (const key of sharedKeys) {
2130
+ const sharedValue = mergeValues(a[key], b[key]);
2131
+ if (!sharedValue.valid) return { valid: false };
2132
+ newObj[key] = sharedValue.data;
2133
+ }
2134
+ return {
2135
+ valid: true,
2136
+ data: newObj
2137
+ };
2138
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2139
+ if (a.length !== b.length) return { valid: false };
2140
+ const newArray = [];
2141
+ for (let index = 0; index < a.length; index++) {
2142
+ const itemA = a[index];
2143
+ const itemB = b[index];
2144
+ const sharedValue = mergeValues(itemA, itemB);
2145
+ if (!sharedValue.valid) return { valid: false };
2146
+ newArray.push(sharedValue.data);
2147
+ }
2148
+ return {
2149
+ valid: true,
2150
+ data: newArray
2151
+ };
2152
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) return {
2153
+ valid: true,
2154
+ data: a
2155
+ };
2156
+ else return { valid: false };
2157
+ }
2158
+ var ZodIntersection = class extends ZodType {
2159
+ _parse(input) {
2160
+ const { status, ctx } = this._processInputParams(input);
2161
+ const handleParsed = (parsedLeft, parsedRight) => {
2162
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) return INVALID;
2163
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
2164
+ if (!merged.valid) {
2165
+ addIssueToContext(ctx, { code: ZodIssueCode.invalid_intersection_types });
2166
+ return INVALID;
2167
+ }
2168
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) status.dirty();
2169
+ return {
2170
+ status: status.value,
2171
+ value: merged.data
2172
+ };
2173
+ };
2174
+ if (ctx.common.async) return Promise.all([this._def.left._parseAsync({
2175
+ data: ctx.data,
2176
+ path: ctx.path,
2177
+ parent: ctx
2178
+ }), this._def.right._parseAsync({
2179
+ data: ctx.data,
2180
+ path: ctx.path,
2181
+ parent: ctx
2182
+ })]).then(([left, right]) => handleParsed(left, right));
2183
+ else return handleParsed(this._def.left._parseSync({
2184
+ data: ctx.data,
2185
+ path: ctx.path,
2186
+ parent: ctx
2187
+ }), this._def.right._parseSync({
2188
+ data: ctx.data,
2189
+ path: ctx.path,
2190
+ parent: ctx
2191
+ }));
2192
+ }
2193
+ };
2194
+ ZodIntersection.create = (left, right, params) => {
2195
+ return new ZodIntersection({
2196
+ left,
2197
+ right,
2198
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
2199
+ ...processCreateParams(params)
2200
+ });
2201
+ };
2202
+ var ZodTuple = class ZodTuple extends ZodType {
2203
+ _parse(input) {
2204
+ const { status, ctx } = this._processInputParams(input);
2205
+ if (ctx.parsedType !== ZodParsedType.array) {
2206
+ addIssueToContext(ctx, {
2207
+ code: ZodIssueCode.invalid_type,
2208
+ expected: ZodParsedType.array,
2209
+ received: ctx.parsedType
2210
+ });
2211
+ return INVALID;
2212
+ }
2213
+ if (ctx.data.length < this._def.items.length) {
2214
+ addIssueToContext(ctx, {
2215
+ code: ZodIssueCode.too_small,
2216
+ minimum: this._def.items.length,
2217
+ inclusive: true,
2218
+ exact: false,
2219
+ type: "array"
2220
+ });
2221
+ return INVALID;
2222
+ }
2223
+ if (!this._def.rest && ctx.data.length > this._def.items.length) {
2224
+ addIssueToContext(ctx, {
2225
+ code: ZodIssueCode.too_big,
2226
+ maximum: this._def.items.length,
2227
+ inclusive: true,
2228
+ exact: false,
2229
+ type: "array"
2230
+ });
2231
+ status.dirty();
2232
+ }
2233
+ const items = [...ctx.data].map((item, itemIndex) => {
2234
+ const schema = this._def.items[itemIndex] || this._def.rest;
2235
+ if (!schema) return null;
2236
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2237
+ }).filter((x) => !!x);
2238
+ if (ctx.common.async) return Promise.all(items).then((results) => {
2239
+ return ParseStatus.mergeArray(status, results);
2240
+ });
2241
+ else return ParseStatus.mergeArray(status, items);
2242
+ }
2243
+ get items() {
2244
+ return this._def.items;
2245
+ }
2246
+ rest(rest) {
2247
+ return new ZodTuple({
2248
+ ...this._def,
2249
+ rest
2250
+ });
2251
+ }
2252
+ };
2253
+ ZodTuple.create = (schemas, params) => {
2254
+ if (!Array.isArray(schemas)) throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2255
+ return new ZodTuple({
2256
+ items: schemas,
2257
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
2258
+ rest: null,
2259
+ ...processCreateParams(params)
2260
+ });
2261
+ };
2262
+ var ZodRecord = class ZodRecord extends ZodType {
2263
+ get keySchema() {
2264
+ return this._def.keyType;
2265
+ }
2266
+ get valueSchema() {
2267
+ return this._def.valueType;
2268
+ }
2269
+ _parse(input) {
2270
+ const { status, ctx } = this._processInputParams(input);
2271
+ if (ctx.parsedType !== ZodParsedType.object) {
2272
+ addIssueToContext(ctx, {
2273
+ code: ZodIssueCode.invalid_type,
2274
+ expected: ZodParsedType.object,
2275
+ received: ctx.parsedType
2276
+ });
2277
+ return INVALID;
2278
+ }
2279
+ const pairs = [];
2280
+ const keyType = this._def.keyType;
2281
+ const valueType = this._def.valueType;
2282
+ for (const key in ctx.data) pairs.push({
2283
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2284
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2285
+ alwaysSet: key in ctx.data
2286
+ });
2287
+ if (ctx.common.async) return ParseStatus.mergeObjectAsync(status, pairs);
2288
+ else return ParseStatus.mergeObjectSync(status, pairs);
2289
+ }
2290
+ get element() {
2291
+ return this._def.valueType;
2292
+ }
2293
+ static create(first, second, third) {
2294
+ if (second instanceof ZodType) return new ZodRecord({
2295
+ keyType: first,
2296
+ valueType: second,
2297
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2298
+ ...processCreateParams(third)
2299
+ });
2300
+ return new ZodRecord({
2301
+ keyType: ZodString.create(),
2302
+ valueType: first,
2303
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2304
+ ...processCreateParams(second)
2305
+ });
2306
+ }
2307
+ };
2308
+ var ZodMap = class extends ZodType {
2309
+ get keySchema() {
2310
+ return this._def.keyType;
2311
+ }
2312
+ get valueSchema() {
2313
+ return this._def.valueType;
2314
+ }
2315
+ _parse(input) {
2316
+ const { status, ctx } = this._processInputParams(input);
2317
+ if (ctx.parsedType !== ZodParsedType.map) {
2318
+ addIssueToContext(ctx, {
2319
+ code: ZodIssueCode.invalid_type,
2320
+ expected: ZodParsedType.map,
2321
+ received: ctx.parsedType
2322
+ });
2323
+ return INVALID;
2324
+ }
2325
+ const keyType = this._def.keyType;
2326
+ const valueType = this._def.valueType;
2327
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2328
+ return {
2329
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2330
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
2331
+ };
2332
+ });
2333
+ if (ctx.common.async) {
2334
+ const finalMap = /* @__PURE__ */ new Map();
2335
+ return Promise.resolve().then(async () => {
2336
+ for (const pair of pairs) {
2337
+ const key = await pair.key;
2338
+ const value = await pair.value;
2339
+ if (key.status === "aborted" || value.status === "aborted") return INVALID;
2340
+ if (key.status === "dirty" || value.status === "dirty") status.dirty();
2341
+ finalMap.set(key.value, value.value);
2342
+ }
2343
+ return {
2344
+ status: status.value,
2345
+ value: finalMap
2346
+ };
2347
+ });
2348
+ } else {
2349
+ const finalMap = /* @__PURE__ */ new Map();
2350
+ for (const pair of pairs) {
2351
+ const key = pair.key;
2352
+ const value = pair.value;
2353
+ if (key.status === "aborted" || value.status === "aborted") return INVALID;
2354
+ if (key.status === "dirty" || value.status === "dirty") status.dirty();
2355
+ finalMap.set(key.value, value.value);
2356
+ }
2357
+ return {
2358
+ status: status.value,
2359
+ value: finalMap
2360
+ };
2361
+ }
2362
+ }
2363
+ };
2364
+ ZodMap.create = (keyType, valueType, params) => {
2365
+ return new ZodMap({
2366
+ valueType,
2367
+ keyType,
2368
+ typeName: ZodFirstPartyTypeKind.ZodMap,
2369
+ ...processCreateParams(params)
2370
+ });
2371
+ };
2372
+ var ZodSet = class ZodSet extends ZodType {
2373
+ _parse(input) {
2374
+ const { status, ctx } = this._processInputParams(input);
2375
+ if (ctx.parsedType !== ZodParsedType.set) {
2376
+ addIssueToContext(ctx, {
2377
+ code: ZodIssueCode.invalid_type,
2378
+ expected: ZodParsedType.set,
2379
+ received: ctx.parsedType
2380
+ });
2381
+ return INVALID;
2382
+ }
2383
+ const def = this._def;
2384
+ if (def.minSize !== null) {
2385
+ if (ctx.data.size < def.minSize.value) {
2386
+ addIssueToContext(ctx, {
2387
+ code: ZodIssueCode.too_small,
2388
+ minimum: def.minSize.value,
2389
+ type: "set",
2390
+ inclusive: true,
2391
+ exact: false,
2392
+ message: def.minSize.message
2393
+ });
2394
+ status.dirty();
2395
+ }
2396
+ }
2397
+ if (def.maxSize !== null) {
2398
+ if (ctx.data.size > def.maxSize.value) {
2399
+ addIssueToContext(ctx, {
2400
+ code: ZodIssueCode.too_big,
2401
+ maximum: def.maxSize.value,
2402
+ type: "set",
2403
+ inclusive: true,
2404
+ exact: false,
2405
+ message: def.maxSize.message
2406
+ });
2407
+ status.dirty();
2408
+ }
2409
+ }
2410
+ const valueType = this._def.valueType;
2411
+ function finalizeSet(elements$1) {
2412
+ const parsedSet = /* @__PURE__ */ new Set();
2413
+ for (const element of elements$1) {
2414
+ if (element.status === "aborted") return INVALID;
2415
+ if (element.status === "dirty") status.dirty();
2416
+ parsedSet.add(element.value);
2417
+ }
2418
+ return {
2419
+ status: status.value,
2420
+ value: parsedSet
2421
+ };
2422
+ }
2423
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2424
+ if (ctx.common.async) return Promise.all(elements).then((elements$1) => finalizeSet(elements$1));
2425
+ else return finalizeSet(elements);
2426
+ }
2427
+ min(minSize, message) {
2428
+ return new ZodSet({
2429
+ ...this._def,
2430
+ minSize: {
2431
+ value: minSize,
2432
+ message: errorUtil.toString(message)
2433
+ }
2434
+ });
2435
+ }
2436
+ max(maxSize, message) {
2437
+ return new ZodSet({
2438
+ ...this._def,
2439
+ maxSize: {
2440
+ value: maxSize,
2441
+ message: errorUtil.toString(message)
2442
+ }
2443
+ });
2444
+ }
2445
+ size(size, message) {
2446
+ return this.min(size, message).max(size, message);
2447
+ }
2448
+ nonempty(message) {
2449
+ return this.min(1, message);
2450
+ }
2451
+ };
2452
+ ZodSet.create = (valueType, params) => {
2453
+ return new ZodSet({
2454
+ valueType,
2455
+ minSize: null,
2456
+ maxSize: null,
2457
+ typeName: ZodFirstPartyTypeKind.ZodSet,
2458
+ ...processCreateParams(params)
2459
+ });
2460
+ };
2461
+ var ZodFunction = class ZodFunction extends ZodType {
2462
+ constructor() {
2463
+ super(...arguments);
2464
+ this.validate = this.implement;
2465
+ }
2466
+ _parse(input) {
2467
+ const { ctx } = this._processInputParams(input);
2468
+ if (ctx.parsedType !== ZodParsedType.function) {
2469
+ addIssueToContext(ctx, {
2470
+ code: ZodIssueCode.invalid_type,
2471
+ expected: ZodParsedType.function,
2472
+ received: ctx.parsedType
2473
+ });
2474
+ return INVALID;
2475
+ }
2476
+ function makeArgsIssue(args, error) {
2477
+ return makeIssue({
2478
+ data: args,
2479
+ path: ctx.path,
2480
+ errorMaps: [
2481
+ ctx.common.contextualErrorMap,
2482
+ ctx.schemaErrorMap,
2483
+ getErrorMap(),
2484
+ en_default
2485
+ ].filter((x) => !!x),
2486
+ issueData: {
2487
+ code: ZodIssueCode.invalid_arguments,
2488
+ argumentsError: error
2489
+ }
2490
+ });
2491
+ }
2492
+ function makeReturnsIssue(returns, error) {
2493
+ return makeIssue({
2494
+ data: returns,
2495
+ path: ctx.path,
2496
+ errorMaps: [
2497
+ ctx.common.contextualErrorMap,
2498
+ ctx.schemaErrorMap,
2499
+ getErrorMap(),
2500
+ en_default
2501
+ ].filter((x) => !!x),
2502
+ issueData: {
2503
+ code: ZodIssueCode.invalid_return_type,
2504
+ returnTypeError: error
2505
+ }
2506
+ });
2507
+ }
2508
+ const params = { errorMap: ctx.common.contextualErrorMap };
2509
+ const fn = ctx.data;
2510
+ if (this._def.returns instanceof ZodPromise) {
2511
+ const me = this;
2512
+ return OK(async function(...args) {
2513
+ const error = new ZodError([]);
2514
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2515
+ error.addIssue(makeArgsIssue(args, e));
2516
+ throw error;
2517
+ });
2518
+ const result = await Reflect.apply(fn, this, parsedArgs);
2519
+ return await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2520
+ error.addIssue(makeReturnsIssue(result, e));
2521
+ throw error;
2522
+ });
2523
+ });
2524
+ } else {
2525
+ const me = this;
2526
+ return OK(function(...args) {
2527
+ const parsedArgs = me._def.args.safeParse(args, params);
2528
+ if (!parsedArgs.success) throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2529
+ const result = Reflect.apply(fn, this, parsedArgs.data);
2530
+ const parsedReturns = me._def.returns.safeParse(result, params);
2531
+ if (!parsedReturns.success) throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2532
+ return parsedReturns.data;
2533
+ });
2534
+ }
2535
+ }
2536
+ parameters() {
2537
+ return this._def.args;
2538
+ }
2539
+ returnType() {
2540
+ return this._def.returns;
2541
+ }
2542
+ args(...items) {
2543
+ return new ZodFunction({
2544
+ ...this._def,
2545
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
2546
+ });
2547
+ }
2548
+ returns(returnType) {
2549
+ return new ZodFunction({
2550
+ ...this._def,
2551
+ returns: returnType
2552
+ });
2553
+ }
2554
+ implement(func) {
2555
+ return this.parse(func);
2556
+ }
2557
+ strictImplement(func) {
2558
+ return this.parse(func);
2559
+ }
2560
+ static create(args, returns, params) {
2561
+ return new ZodFunction({
2562
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
2563
+ returns: returns || ZodUnknown.create(),
2564
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
2565
+ ...processCreateParams(params)
2566
+ });
2567
+ }
2568
+ };
2569
+ var ZodLazy = class extends ZodType {
2570
+ get schema() {
2571
+ return this._def.getter();
2572
+ }
2573
+ _parse(input) {
2574
+ const { ctx } = this._processInputParams(input);
2575
+ return this._def.getter()._parse({
2576
+ data: ctx.data,
2577
+ path: ctx.path,
2578
+ parent: ctx
2579
+ });
2580
+ }
2581
+ };
2582
+ ZodLazy.create = (getter, params) => {
2583
+ return new ZodLazy({
2584
+ getter,
2585
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
2586
+ ...processCreateParams(params)
2587
+ });
2588
+ };
2589
+ var ZodLiteral = class extends ZodType {
2590
+ _parse(input) {
2591
+ if (input.data !== this._def.value) {
2592
+ const ctx = this._getOrReturnCtx(input);
2593
+ addIssueToContext(ctx, {
2594
+ received: ctx.data,
2595
+ code: ZodIssueCode.invalid_literal,
2596
+ expected: this._def.value
2597
+ });
2598
+ return INVALID;
2599
+ }
2600
+ return {
2601
+ status: "valid",
2602
+ value: input.data
2603
+ };
2604
+ }
2605
+ get value() {
2606
+ return this._def.value;
2607
+ }
2608
+ };
2609
+ ZodLiteral.create = (value, params) => {
2610
+ return new ZodLiteral({
2611
+ value,
2612
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
2613
+ ...processCreateParams(params)
2614
+ });
2615
+ };
2616
+ function createZodEnum(values, params) {
2617
+ return new ZodEnum({
2618
+ values,
2619
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
2620
+ ...processCreateParams(params)
2621
+ });
2622
+ }
2623
+ var ZodEnum = class ZodEnum extends ZodType {
2624
+ _parse(input) {
2625
+ if (typeof input.data !== "string") {
2626
+ const ctx = this._getOrReturnCtx(input);
2627
+ const expectedValues = this._def.values;
2628
+ addIssueToContext(ctx, {
2629
+ expected: util.joinValues(expectedValues),
2630
+ received: ctx.parsedType,
2631
+ code: ZodIssueCode.invalid_type
2632
+ });
2633
+ return INVALID;
2634
+ }
2635
+ if (!this._cache) this._cache = new Set(this._def.values);
2636
+ if (!this._cache.has(input.data)) {
2637
+ const ctx = this._getOrReturnCtx(input);
2638
+ const expectedValues = this._def.values;
2639
+ addIssueToContext(ctx, {
2640
+ received: ctx.data,
2641
+ code: ZodIssueCode.invalid_enum_value,
2642
+ options: expectedValues
2643
+ });
2644
+ return INVALID;
2645
+ }
2646
+ return OK(input.data);
2647
+ }
2648
+ get options() {
2649
+ return this._def.values;
2650
+ }
2651
+ get enum() {
2652
+ const enumValues = {};
2653
+ for (const val of this._def.values) enumValues[val] = val;
2654
+ return enumValues;
2655
+ }
2656
+ get Values() {
2657
+ const enumValues = {};
2658
+ for (const val of this._def.values) enumValues[val] = val;
2659
+ return enumValues;
2660
+ }
2661
+ get Enum() {
2662
+ const enumValues = {};
2663
+ for (const val of this._def.values) enumValues[val] = val;
2664
+ return enumValues;
2665
+ }
2666
+ extract(values, newDef = this._def) {
2667
+ return ZodEnum.create(values, {
2668
+ ...this._def,
2669
+ ...newDef
2670
+ });
2671
+ }
2672
+ exclude(values, newDef = this._def) {
2673
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
2674
+ ...this._def,
2675
+ ...newDef
2676
+ });
2677
+ }
2678
+ };
2679
+ ZodEnum.create = createZodEnum;
2680
+ var ZodNativeEnum = class extends ZodType {
2681
+ _parse(input) {
2682
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
2683
+ const ctx = this._getOrReturnCtx(input);
2684
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
2685
+ const expectedValues = util.objectValues(nativeEnumValues);
2686
+ addIssueToContext(ctx, {
2687
+ expected: util.joinValues(expectedValues),
2688
+ received: ctx.parsedType,
2689
+ code: ZodIssueCode.invalid_type
2690
+ });
2691
+ return INVALID;
2692
+ }
2693
+ if (!this._cache) this._cache = new Set(util.getValidEnumValues(this._def.values));
2694
+ if (!this._cache.has(input.data)) {
2695
+ const expectedValues = util.objectValues(nativeEnumValues);
2696
+ addIssueToContext(ctx, {
2697
+ received: ctx.data,
2698
+ code: ZodIssueCode.invalid_enum_value,
2699
+ options: expectedValues
2700
+ });
2701
+ return INVALID;
2702
+ }
2703
+ return OK(input.data);
2704
+ }
2705
+ get enum() {
2706
+ return this._def.values;
2707
+ }
2708
+ };
2709
+ ZodNativeEnum.create = (values, params) => {
2710
+ return new ZodNativeEnum({
2711
+ values,
2712
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
2713
+ ...processCreateParams(params)
2714
+ });
2715
+ };
2716
+ var ZodPromise = class extends ZodType {
2717
+ unwrap() {
2718
+ return this._def.type;
2719
+ }
2720
+ _parse(input) {
2721
+ const { ctx } = this._processInputParams(input);
2722
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
2723
+ addIssueToContext(ctx, {
2724
+ code: ZodIssueCode.invalid_type,
2725
+ expected: ZodParsedType.promise,
2726
+ received: ctx.parsedType
2727
+ });
2728
+ return INVALID;
2729
+ }
2730
+ return OK((ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data)).then((data) => {
2731
+ return this._def.type.parseAsync(data, {
2732
+ path: ctx.path,
2733
+ errorMap: ctx.common.contextualErrorMap
2734
+ });
2735
+ }));
2736
+ }
2737
+ };
2738
+ ZodPromise.create = (schema, params) => {
2739
+ return new ZodPromise({
2740
+ type: schema,
2741
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
2742
+ ...processCreateParams(params)
2743
+ });
2744
+ };
2745
+ var ZodEffects = class extends ZodType {
2746
+ innerType() {
2747
+ return this._def.schema;
2748
+ }
2749
+ sourceType() {
2750
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2751
+ }
2752
+ _parse(input) {
2753
+ const { status, ctx } = this._processInputParams(input);
2754
+ const effect = this._def.effect || null;
2755
+ const checkCtx = {
2756
+ addIssue: (arg) => {
2757
+ addIssueToContext(ctx, arg);
2758
+ if (arg.fatal) status.abort();
2759
+ else status.dirty();
2760
+ },
2761
+ get path() {
2762
+ return ctx.path;
2763
+ }
2764
+ };
2765
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
2766
+ if (effect.type === "preprocess") {
2767
+ const processed = effect.transform(ctx.data, checkCtx);
2768
+ if (ctx.common.async) return Promise.resolve(processed).then(async (processed$1) => {
2769
+ if (status.value === "aborted") return INVALID;
2770
+ const result = await this._def.schema._parseAsync({
2771
+ data: processed$1,
2772
+ path: ctx.path,
2773
+ parent: ctx
2774
+ });
2775
+ if (result.status === "aborted") return INVALID;
2776
+ if (result.status === "dirty") return DIRTY(result.value);
2777
+ if (status.value === "dirty") return DIRTY(result.value);
2778
+ return result;
2779
+ });
2780
+ else {
2781
+ if (status.value === "aborted") return INVALID;
2782
+ const result = this._def.schema._parseSync({
2783
+ data: processed,
2784
+ path: ctx.path,
2785
+ parent: ctx
2786
+ });
2787
+ if (result.status === "aborted") return INVALID;
2788
+ if (result.status === "dirty") return DIRTY(result.value);
2789
+ if (status.value === "dirty") return DIRTY(result.value);
2790
+ return result;
2791
+ }
2792
+ }
2793
+ if (effect.type === "refinement") {
2794
+ const executeRefinement = (acc) => {
2795
+ const result = effect.refinement(acc, checkCtx);
2796
+ if (ctx.common.async) return Promise.resolve(result);
2797
+ if (result instanceof Promise) throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2798
+ return acc;
2799
+ };
2800
+ if (ctx.common.async === false) {
2801
+ const inner = this._def.schema._parseSync({
2802
+ data: ctx.data,
2803
+ path: ctx.path,
2804
+ parent: ctx
2805
+ });
2806
+ if (inner.status === "aborted") return INVALID;
2807
+ if (inner.status === "dirty") status.dirty();
2808
+ executeRefinement(inner.value);
2809
+ return {
2810
+ status: status.value,
2811
+ value: inner.value
2812
+ };
2813
+ } else return this._def.schema._parseAsync({
2814
+ data: ctx.data,
2815
+ path: ctx.path,
2816
+ parent: ctx
2817
+ }).then((inner) => {
2818
+ if (inner.status === "aborted") return INVALID;
2819
+ if (inner.status === "dirty") status.dirty();
2820
+ return executeRefinement(inner.value).then(() => {
2821
+ return {
2822
+ status: status.value,
2823
+ value: inner.value
2824
+ };
2825
+ });
2826
+ });
2827
+ }
2828
+ if (effect.type === "transform") if (ctx.common.async === false) {
2829
+ const base = this._def.schema._parseSync({
2830
+ data: ctx.data,
2831
+ path: ctx.path,
2832
+ parent: ctx
2833
+ });
2834
+ if (!isValid(base)) return INVALID;
2835
+ const result = effect.transform(base.value, checkCtx);
2836
+ if (result instanceof Promise) throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
2837
+ return {
2838
+ status: status.value,
2839
+ value: result
2840
+ };
2841
+ } else return this._def.schema._parseAsync({
2842
+ data: ctx.data,
2843
+ path: ctx.path,
2844
+ parent: ctx
2845
+ }).then((base) => {
2846
+ if (!isValid(base)) return INVALID;
2847
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
2848
+ status: status.value,
2849
+ value: result
2850
+ }));
2851
+ });
2852
+ util.assertNever(effect);
2853
+ }
2854
+ };
2855
+ ZodEffects.create = (schema, effect, params) => {
2856
+ return new ZodEffects({
2857
+ schema,
2858
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
2859
+ effect,
2860
+ ...processCreateParams(params)
2861
+ });
2862
+ };
2863
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
2864
+ return new ZodEffects({
2865
+ schema,
2866
+ effect: {
2867
+ type: "preprocess",
2868
+ transform: preprocess
2869
+ },
2870
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
2871
+ ...processCreateParams(params)
2872
+ });
2873
+ };
2874
+ var ZodOptional = class extends ZodType {
2875
+ _parse(input) {
2876
+ if (this._getType(input) === ZodParsedType.undefined) return OK(void 0);
2877
+ return this._def.innerType._parse(input);
2878
+ }
2879
+ unwrap() {
2880
+ return this._def.innerType;
2881
+ }
2882
+ };
2883
+ ZodOptional.create = (type, params) => {
2884
+ return new ZodOptional({
2885
+ innerType: type,
2886
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
2887
+ ...processCreateParams(params)
2888
+ });
2889
+ };
2890
+ var ZodNullable = class extends ZodType {
2891
+ _parse(input) {
2892
+ if (this._getType(input) === ZodParsedType.null) return OK(null);
2893
+ return this._def.innerType._parse(input);
2894
+ }
2895
+ unwrap() {
2896
+ return this._def.innerType;
2897
+ }
2898
+ };
2899
+ ZodNullable.create = (type, params) => {
2900
+ return new ZodNullable({
2901
+ innerType: type,
2902
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
2903
+ ...processCreateParams(params)
2904
+ });
2905
+ };
2906
+ var ZodDefault = class extends ZodType {
2907
+ _parse(input) {
2908
+ const { ctx } = this._processInputParams(input);
2909
+ let data = ctx.data;
2910
+ if (ctx.parsedType === ZodParsedType.undefined) data = this._def.defaultValue();
2911
+ return this._def.innerType._parse({
2912
+ data,
2913
+ path: ctx.path,
2914
+ parent: ctx
2915
+ });
2916
+ }
2917
+ removeDefault() {
2918
+ return this._def.innerType;
2919
+ }
2920
+ };
2921
+ ZodDefault.create = (type, params) => {
2922
+ return new ZodDefault({
2923
+ innerType: type,
2924
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
2925
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
2926
+ ...processCreateParams(params)
2927
+ });
2928
+ };
2929
+ var ZodCatch = class extends ZodType {
2930
+ _parse(input) {
2931
+ const { ctx } = this._processInputParams(input);
2932
+ const newCtx = {
2933
+ ...ctx,
2934
+ common: {
2935
+ ...ctx.common,
2936
+ issues: []
2937
+ }
2938
+ };
2939
+ const result = this._def.innerType._parse({
2940
+ data: newCtx.data,
2941
+ path: newCtx.path,
2942
+ parent: { ...newCtx }
2943
+ });
2944
+ if (isAsync(result)) return result.then((result$1) => {
2945
+ return {
2946
+ status: "valid",
2947
+ value: result$1.status === "valid" ? result$1.value : this._def.catchValue({
2948
+ get error() {
2949
+ return new ZodError(newCtx.common.issues);
2950
+ },
2951
+ input: newCtx.data
2952
+ })
2953
+ };
2954
+ });
2955
+ else return {
2956
+ status: "valid",
2957
+ value: result.status === "valid" ? result.value : this._def.catchValue({
2958
+ get error() {
2959
+ return new ZodError(newCtx.common.issues);
2960
+ },
2961
+ input: newCtx.data
2962
+ })
2963
+ };
2964
+ }
2965
+ removeCatch() {
2966
+ return this._def.innerType;
2967
+ }
2968
+ };
2969
+ ZodCatch.create = (type, params) => {
2970
+ return new ZodCatch({
2971
+ innerType: type,
2972
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
2973
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
2974
+ ...processCreateParams(params)
2975
+ });
2976
+ };
2977
+ var ZodNaN = class extends ZodType {
2978
+ _parse(input) {
2979
+ if (this._getType(input) !== ZodParsedType.nan) {
2980
+ const ctx = this._getOrReturnCtx(input);
2981
+ addIssueToContext(ctx, {
2982
+ code: ZodIssueCode.invalid_type,
2983
+ expected: ZodParsedType.nan,
2984
+ received: ctx.parsedType
2985
+ });
2986
+ return INVALID;
2987
+ }
2988
+ return {
2989
+ status: "valid",
2990
+ value: input.data
2991
+ };
2992
+ }
2993
+ };
2994
+ ZodNaN.create = (params) => {
2995
+ return new ZodNaN({
2996
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
2997
+ ...processCreateParams(params)
2998
+ });
2999
+ };
3000
+ var ZodBranded = class extends ZodType {
3001
+ _parse(input) {
3002
+ const { ctx } = this._processInputParams(input);
3003
+ const data = ctx.data;
3004
+ return this._def.type._parse({
3005
+ data,
3006
+ path: ctx.path,
3007
+ parent: ctx
3008
+ });
3009
+ }
3010
+ unwrap() {
3011
+ return this._def.type;
3012
+ }
3013
+ };
3014
+ var ZodPipeline = class ZodPipeline extends ZodType {
3015
+ _parse(input) {
3016
+ const { status, ctx } = this._processInputParams(input);
3017
+ if (ctx.common.async) {
3018
+ const handleAsync = async () => {
3019
+ const inResult = await this._def.in._parseAsync({
3020
+ data: ctx.data,
3021
+ path: ctx.path,
3022
+ parent: ctx
3023
+ });
3024
+ if (inResult.status === "aborted") return INVALID;
3025
+ if (inResult.status === "dirty") {
3026
+ status.dirty();
3027
+ return DIRTY(inResult.value);
3028
+ } else return this._def.out._parseAsync({
3029
+ data: inResult.value,
3030
+ path: ctx.path,
3031
+ parent: ctx
3032
+ });
3033
+ };
3034
+ return handleAsync();
3035
+ } else {
3036
+ const inResult = this._def.in._parseSync({
3037
+ data: ctx.data,
3038
+ path: ctx.path,
3039
+ parent: ctx
3040
+ });
3041
+ if (inResult.status === "aborted") return INVALID;
3042
+ if (inResult.status === "dirty") {
3043
+ status.dirty();
3044
+ return {
3045
+ status: "dirty",
3046
+ value: inResult.value
3047
+ };
3048
+ } else return this._def.out._parseSync({
3049
+ data: inResult.value,
3050
+ path: ctx.path,
3051
+ parent: ctx
3052
+ });
3053
+ }
3054
+ }
3055
+ static create(a, b) {
3056
+ return new ZodPipeline({
3057
+ in: a,
3058
+ out: b,
3059
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
3060
+ });
3061
+ }
3062
+ };
3063
+ var ZodReadonly = class extends ZodType {
3064
+ _parse(input) {
3065
+ const result = this._def.innerType._parse(input);
3066
+ const freeze = (data) => {
3067
+ if (isValid(data)) data.value = Object.freeze(data.value);
3068
+ return data;
3069
+ };
3070
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3071
+ }
3072
+ unwrap() {
3073
+ return this._def.innerType;
3074
+ }
3075
+ };
3076
+ ZodReadonly.create = (type, params) => {
3077
+ return new ZodReadonly({
3078
+ innerType: type,
3079
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3080
+ ...processCreateParams(params)
3081
+ });
3082
+ };
3083
+ const late = { object: ZodObject.lazycreate };
3084
+ var ZodFirstPartyTypeKind;
3085
+ (function(ZodFirstPartyTypeKind$1) {
3086
+ ZodFirstPartyTypeKind$1["ZodString"] = "ZodString";
3087
+ ZodFirstPartyTypeKind$1["ZodNumber"] = "ZodNumber";
3088
+ ZodFirstPartyTypeKind$1["ZodNaN"] = "ZodNaN";
3089
+ ZodFirstPartyTypeKind$1["ZodBigInt"] = "ZodBigInt";
3090
+ ZodFirstPartyTypeKind$1["ZodBoolean"] = "ZodBoolean";
3091
+ ZodFirstPartyTypeKind$1["ZodDate"] = "ZodDate";
3092
+ ZodFirstPartyTypeKind$1["ZodSymbol"] = "ZodSymbol";
3093
+ ZodFirstPartyTypeKind$1["ZodUndefined"] = "ZodUndefined";
3094
+ ZodFirstPartyTypeKind$1["ZodNull"] = "ZodNull";
3095
+ ZodFirstPartyTypeKind$1["ZodAny"] = "ZodAny";
3096
+ ZodFirstPartyTypeKind$1["ZodUnknown"] = "ZodUnknown";
3097
+ ZodFirstPartyTypeKind$1["ZodNever"] = "ZodNever";
3098
+ ZodFirstPartyTypeKind$1["ZodVoid"] = "ZodVoid";
3099
+ ZodFirstPartyTypeKind$1["ZodArray"] = "ZodArray";
3100
+ ZodFirstPartyTypeKind$1["ZodObject"] = "ZodObject";
3101
+ ZodFirstPartyTypeKind$1["ZodUnion"] = "ZodUnion";
3102
+ ZodFirstPartyTypeKind$1["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3103
+ ZodFirstPartyTypeKind$1["ZodIntersection"] = "ZodIntersection";
3104
+ ZodFirstPartyTypeKind$1["ZodTuple"] = "ZodTuple";
3105
+ ZodFirstPartyTypeKind$1["ZodRecord"] = "ZodRecord";
3106
+ ZodFirstPartyTypeKind$1["ZodMap"] = "ZodMap";
3107
+ ZodFirstPartyTypeKind$1["ZodSet"] = "ZodSet";
3108
+ ZodFirstPartyTypeKind$1["ZodFunction"] = "ZodFunction";
3109
+ ZodFirstPartyTypeKind$1["ZodLazy"] = "ZodLazy";
3110
+ ZodFirstPartyTypeKind$1["ZodLiteral"] = "ZodLiteral";
3111
+ ZodFirstPartyTypeKind$1["ZodEnum"] = "ZodEnum";
3112
+ ZodFirstPartyTypeKind$1["ZodEffects"] = "ZodEffects";
3113
+ ZodFirstPartyTypeKind$1["ZodNativeEnum"] = "ZodNativeEnum";
3114
+ ZodFirstPartyTypeKind$1["ZodOptional"] = "ZodOptional";
3115
+ ZodFirstPartyTypeKind$1["ZodNullable"] = "ZodNullable";
3116
+ ZodFirstPartyTypeKind$1["ZodDefault"] = "ZodDefault";
3117
+ ZodFirstPartyTypeKind$1["ZodCatch"] = "ZodCatch";
3118
+ ZodFirstPartyTypeKind$1["ZodPromise"] = "ZodPromise";
3119
+ ZodFirstPartyTypeKind$1["ZodBranded"] = "ZodBranded";
3120
+ ZodFirstPartyTypeKind$1["ZodPipeline"] = "ZodPipeline";
3121
+ ZodFirstPartyTypeKind$1["ZodReadonly"] = "ZodReadonly";
3122
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3123
+ const stringType = ZodString.create;
3124
+ const numberType = ZodNumber.create;
3125
+ const nanType = ZodNaN.create;
3126
+ const bigIntType = ZodBigInt.create;
3127
+ const booleanType = ZodBoolean.create;
3128
+ const dateType = ZodDate.create;
3129
+ const symbolType = ZodSymbol.create;
3130
+ const undefinedType = ZodUndefined.create;
3131
+ const nullType = ZodNull.create;
3132
+ const anyType = ZodAny.create;
3133
+ const unknownType = ZodUnknown.create;
3134
+ const neverType = ZodNever.create;
3135
+ const voidType = ZodVoid.create;
3136
+ const arrayType = ZodArray.create;
3137
+ const objectType = ZodObject.create;
3138
+ const strictObjectType = ZodObject.strictCreate;
3139
+ const unionType = ZodUnion.create;
3140
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
3141
+ const intersectionType = ZodIntersection.create;
3142
+ const tupleType = ZodTuple.create;
3143
+ const recordType = ZodRecord.create;
3144
+ const mapType = ZodMap.create;
3145
+ const setType = ZodSet.create;
3146
+ const functionType = ZodFunction.create;
3147
+ const lazyType = ZodLazy.create;
3148
+ const literalType = ZodLiteral.create;
3149
+ const enumType = ZodEnum.create;
3150
+ const nativeEnumType = ZodNativeEnum.create;
3151
+ const promiseType = ZodPromise.create;
3152
+ const effectsType = ZodEffects.create;
3153
+ const optionalType = ZodOptional.create;
3154
+ const nullableType = ZodNullable.create;
3155
+ const preprocessType = ZodEffects.createWithPreprocess;
3156
+ const pipelineType = ZodPipeline.create;
3157
+
3158
+ //#endregion
3159
+ export { ZodFirstPartyTypeKind, ZodOptional, enumType, numberType, objectType, stringType };
3160
+ //# sourceMappingURL=types.js.map