@psnext/slingcli 3.0.20260827-1 → 3.3.20260911-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (976) hide show
  1. package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +5 -0
  2. package/node_modules/@aws-sdk/core/dist-es/submodules/util/hasOwn.js +3 -0
  3. package/node_modules/@aws-sdk/core/dist-es/submodules/util/index.js +1 -0
  4. package/node_modules/@aws-sdk/core/dist-types/submodules/util/hasOwn.d.ts +4 -0
  5. package/node_modules/@aws-sdk/core/dist-types/submodules/util/index.d.ts +1 -0
  6. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/hasOwn.d.ts +1 -0
  7. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/util/index.d.ts +1 -0
  8. package/node_modules/@aws-sdk/core/package.json +1 -1
  9. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  10. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
  11. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
  12. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
  13. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
  14. package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +2 -2
  15. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  16. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  17. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  18. package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +2 -0
  19. package/node_modules/@aws-sdk/credential-provider-node/dist-es/runtime/memoize-chain.js +2 -0
  20. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  21. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  22. package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +3 -3
  23. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  24. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  25. package/node_modules/@aws-sdk/middleware-websocket/package.json +2 -2
  26. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
  27. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
  28. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
  29. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
  30. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
  31. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -4
  32. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +1 -0
  33. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +2 -3
  34. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +8 -1
  35. package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +2 -2
  36. package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
  37. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/chunks/{chunk-PBNSMEG7.js → chunk-VDBOM5UG.js} +9 -9
  38. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/cli.js +1 -1
  39. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/index.js +1 -1
  40. package/node_modules/@earendil-works/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
  41. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Client.md +25 -8
  42. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  43. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  44. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
  45. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
  46. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/api/readable.js +33 -43
  47. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
  48. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/connect.js +16 -2
  49. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/core/symbols.js +3 -0
  50. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/agent.js +7 -2
  51. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
  52. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h1.js +9 -1
  53. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client-h2.js +221 -12
  54. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/client.js +76 -30
  55. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  56. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
  57. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
  58. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +37 -8
  59. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
  60. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
  61. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  62. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +106 -22
  63. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/cache-handler.js +29 -5
  64. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  65. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  66. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/redirect-handler.js +21 -4
  67. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/handler/retry-handler.js +155 -32
  68. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/cache.js +65 -9
  69. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/decompress.js +115 -13
  70. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
  71. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dns.js +7 -0
  72. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/interceptor/dump.js +10 -23
  73. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-agent.js +13 -1
  74. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/mock/mock-utils.js +217 -27
  75. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/util/cache.js +43 -3
  76. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/cookies/parse.js +150 -147
  77. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  78. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
  79. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/index.js +6 -0
  80. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/request.js +2 -3
  81. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/fetch/util.js +6 -1
  82. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/webidl/index.js +3 -3
  83. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/connection.js +1 -1
  84. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  85. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  86. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/lib/web/websocket/websocket.js +22 -0
  87. package/node_modules/@earendil-works/pi-coding-agent/node_modules/undici/package.json +3 -3
  88. package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +4 -4
  89. package/node_modules/@earendil-works/pi-coding-agent/package.json +1 -1
  90. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  91. package/node_modules/@smithy/core/dist-cjs/submodules/errors/index.js +20 -0
  92. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +11 -10
  93. package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +11 -10
  94. package/node_modules/@smithy/core/dist-es/submodules/errors/errors.js +18 -0
  95. package/node_modules/@smithy/core/dist-es/submodules/errors/index.js +1 -0
  96. package/node_modules/@smithy/core/dist-es/submodules/retry/service-error-classification/service-error-classification.js +11 -10
  97. package/node_modules/@smithy/core/dist-types/submodules/errors/errors.d.ts +44 -0
  98. package/node_modules/@smithy/core/dist-types/submodules/errors/index.d.ts +1 -0
  99. package/node_modules/@smithy/core/dist-types/submodules/retry/service-error-classification/service-error-classification.d.ts +4 -0
  100. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/errors/errors.d.ts +44 -0
  101. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/errors/index.d.ts +1 -0
  102. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/retry/service-error-classification/service-error-classification.d.ts +4 -0
  103. package/node_modules/@smithy/core/errors.d.ts +5 -0
  104. package/node_modules/@smithy/core/errors.js +5 -0
  105. package/node_modules/@smithy/core/package.json +11 -2
  106. package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +2 -1
  107. package/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +2 -1
  108. package/node_modules/@smithy/fetch-http-handler/package.json +3 -3
  109. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +14 -0
  110. package/node_modules/@smithy/types/dist-types/ts3.4/http/httpHandlerInitialization.d.ts +14 -0
  111. package/node_modules/@smithy/types/package.json +1 -1
  112. package/node_modules/@types/node/README.md +3 -3
  113. package/node_modules/@types/node/assert/strict.d.ts +56 -13
  114. package/node_modules/@types/node/assert.d.ts +190 -189
  115. package/node_modules/@types/node/async_hooks.d.ts +43 -151
  116. package/node_modules/@types/node/buffer.buffer.d.ts +13 -12
  117. package/node_modules/@types/node/buffer.d.ts +237 -102
  118. package/node_modules/@types/node/child_process.d.ts +154 -39
  119. package/node_modules/@types/node/cluster.d.ts +384 -238
  120. package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
  121. package/node_modules/@types/node/compatibility/index.d.ts +9 -0
  122. package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  123. package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
  124. package/node_modules/@types/node/console.d.ts +404 -45
  125. package/node_modules/@types/node/constants.d.ts +10 -3
  126. package/node_modules/@types/node/crypto.d.ts +1600 -1007
  127. package/node_modules/@types/node/dgram.d.ts +81 -133
  128. package/node_modules/@types/node/diagnostics_channel.d.ts +59 -277
  129. package/node_modules/@types/node/dns/promises.d.ts +15 -9
  130. package/node_modules/@types/node/dns.d.ts +183 -136
  131. package/node_modules/@types/node/domain.d.ts +32 -12
  132. package/node_modules/@types/node/events.d.ts +696 -728
  133. package/node_modules/@types/node/fs/promises.d.ts +85 -256
  134. package/node_modules/@types/node/fs.d.ts +525 -865
  135. package/node_modules/@types/node/globals.d.ts +34 -12
  136. package/node_modules/@types/node/globals.typedarray.d.ts +0 -63
  137. package/node_modules/@types/node/http.d.ts +311 -432
  138. package/node_modules/@types/node/http2.d.ts +891 -545
  139. package/node_modules/@types/node/https.d.ts +243 -64
  140. package/node_modules/@types/node/index.d.ts +7 -25
  141. package/node_modules/@types/node/inspector.d.ts +58 -70
  142. package/node_modules/@types/node/inspector.generated.d.ts +411 -765
  143. package/node_modules/@types/node/module.d.ts +219 -54
  144. package/node_modules/@types/node/net.d.ts +222 -208
  145. package/node_modules/@types/node/os.d.ts +49 -41
  146. package/node_modules/@types/node/package.json +3 -13
  147. package/node_modules/@types/node/path.d.ts +141 -119
  148. package/node_modules/@types/node/perf_hooks.d.ts +673 -310
  149. package/node_modules/@types/node/process.d.ts +205 -389
  150. package/node_modules/@types/node/punycode.d.ts +31 -3
  151. package/node_modules/@types/node/querystring.d.ts +16 -3
  152. package/node_modules/@types/node/readline/promises.d.ts +6 -3
  153. package/node_modules/@types/node/readline.d.ts +152 -66
  154. package/node_modules/@types/node/repl.d.ts +109 -101
  155. package/node_modules/@types/node/sea.d.ts +116 -1
  156. package/node_modules/@types/node/sqlite.d.ts +68 -486
  157. package/node_modules/@types/node/stream/consumers.d.ts +15 -91
  158. package/node_modules/@types/node/stream/promises.d.ts +15 -136
  159. package/node_modules/@types/node/stream/web.d.ts +456 -179
  160. package/node_modules/@types/node/stream.d.ts +491 -603
  161. package/node_modules/@types/node/string_decoder.d.ts +43 -3
  162. package/node_modules/@types/node/test.d.ts +292 -513
  163. package/node_modules/@types/node/timers/promises.d.ts +18 -3
  164. package/node_modules/@types/node/timers.d.ts +141 -3
  165. package/node_modules/@types/node/tls.d.ts +242 -140
  166. package/node_modules/@types/node/trace_events.d.ts +97 -3
  167. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +8 -7
  168. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +0 -2
  169. package/node_modules/@types/node/ts5.6/index.d.ts +6 -26
  170. package/node_modules/@types/node/tty.d.ts +43 -61
  171. package/node_modules/@types/node/url.d.ts +584 -156
  172. package/node_modules/@types/node/util.d.ts +1110 -181
  173. package/node_modules/@types/node/v8.d.ts +36 -175
  174. package/node_modules/@types/node/vm.d.ts +209 -292
  175. package/node_modules/@types/node/wasi.d.ts +74 -24
  176. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +2 -27
  177. package/node_modules/@types/node/web-globals/domexception.d.ts +0 -15
  178. package/node_modules/@types/node/web-globals/events.d.ts +0 -9
  179. package/node_modules/@types/node/web-globals/fetch.d.ts +0 -14
  180. package/node_modules/@types/node/web-globals/navigator.d.ts +0 -3
  181. package/node_modules/@types/node/web-globals/streams.d.ts +0 -93
  182. package/node_modules/@types/node/worker_threads.d.ts +407 -257
  183. package/node_modules/@types/node/zlib.d.ts +165 -7
  184. package/node_modules/express-rate-limit/dist/index.cjs +6 -3
  185. package/node_modules/express-rate-limit/dist/index.d.cts +11 -0
  186. package/node_modules/express-rate-limit/dist/index.d.mts +11 -0
  187. package/node_modules/express-rate-limit/dist/index.d.ts +11 -0
  188. package/node_modules/express-rate-limit/dist/index.mjs +6 -3
  189. package/node_modules/express-rate-limit/{license.md → license} +7 -6
  190. package/node_modules/express-rate-limit/package.json +5 -5
  191. package/node_modules/express-rate-limit/readme.md +1 -0
  192. package/node_modules/fast-uri/index.js +20 -5
  193. package/node_modules/fast-uri/lib/utils.js +8 -1
  194. package/node_modules/fast-uri/package.json +1 -1
  195. package/node_modules/fast-uri/test/component-safe-serialization.test.js +58 -0
  196. package/node_modules/fast-uri/test/ipv6-validation.test.js +34 -0
  197. package/node_modules/hono/dist/cjs/client/client.js +4 -4
  198. package/node_modules/hono/dist/cjs/hono-base.js +7 -6
  199. package/node_modules/hono/dist/cjs/jsx/base.js +18 -1
  200. package/node_modules/hono/dist/cjs/jsx/components.js +25 -26
  201. package/node_modules/hono/dist/cjs/jsx/context.js +5 -5
  202. package/node_modules/hono/dist/cjs/jsx/dom/server.js +5 -1
  203. package/node_modules/hono/dist/cjs/jsx/intrinsic-element/components.js +2 -2
  204. package/node_modules/hono/dist/cjs/jsx/streaming.js +4 -5
  205. package/node_modules/hono/dist/client/client.js +4 -4
  206. package/node_modules/hono/dist/hono-base.js +7 -6
  207. package/node_modules/hono/dist/jsx/base.js +15 -1
  208. package/node_modules/hono/dist/jsx/components.js +26 -27
  209. package/node_modules/hono/dist/jsx/context.js +6 -6
  210. package/node_modules/hono/dist/jsx/dom/server.js +5 -1
  211. package/node_modules/hono/dist/jsx/intrinsic-element/components.js +3 -3
  212. package/node_modules/hono/dist/jsx/streaming.js +5 -6
  213. package/node_modules/hono/dist/types/context.d.ts +2 -2
  214. package/node_modules/hono/dist/types/jsx/base.d.ts +3 -0
  215. package/node_modules/hono/package.json +2 -2
  216. package/node_modules/ip-address/README.md +92 -82
  217. package/node_modules/ip-address/dist/common.d.ts +20 -0
  218. package/node_modules/ip-address/dist/common.js +36 -0
  219. package/node_modules/ip-address/dist/common.js.map +1 -1
  220. package/node_modules/ip-address/dist/ipv4.d.ts +50 -0
  221. package/node_modules/ip-address/dist/ipv4.js +75 -0
  222. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  223. package/node_modules/ip-address/dist/ipv6.d.ts +79 -10
  224. package/node_modules/ip-address/dist/ipv6.js +120 -30
  225. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  226. package/node_modules/ip-address/dist/v4/constants.d.ts +12 -0
  227. package/node_modules/ip-address/dist/v4/constants.js +40 -1
  228. package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
  229. package/node_modules/ip-address/dist/v6/constants.d.ts +14 -0
  230. package/node_modules/ip-address/dist/v6/constants.js +47 -1
  231. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  232. package/node_modules/ip-address/package.json +1 -1
  233. package/node_modules/jose/dist/types/index.d.ts +1 -2
  234. package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +12 -25
  235. package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +18 -32
  236. package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +12 -25
  237. package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +24 -50
  238. package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +15 -30
  239. package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +29 -52
  240. package/node_modules/jose/dist/types/jwk/embedded.d.ts +5 -8
  241. package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +7 -9
  242. package/node_modules/jose/dist/types/jwks/local.d.ts +10 -13
  243. package/node_modules/jose/dist/types/jwks/remote.d.ts +29 -41
  244. package/node_modules/jose/dist/types/jws/compact/sign.d.ts +8 -13
  245. package/node_modules/jose/dist/types/jws/compact/verify.d.ts +14 -26
  246. package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +10 -19
  247. package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +14 -26
  248. package/node_modules/jose/dist/types/jws/general/sign.d.ts +19 -33
  249. package/node_modules/jose/dist/types/jws/general/verify.d.ts +17 -32
  250. package/node_modules/jose/dist/types/jwt/decrypt.d.ts +20 -27
  251. package/node_modules/jose/dist/types/jwt/encrypt.d.ts +30 -35
  252. package/node_modules/jose/dist/types/jwt/sign.d.ts +8 -13
  253. package/node_modules/jose/dist/types/jwt/unsecured.d.ts +10 -19
  254. package/node_modules/jose/dist/types/jwt/verify.d.ts +19 -22
  255. package/node_modules/jose/dist/types/key/export.d.ts +10 -10
  256. package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +15 -22
  257. package/node_modules/jose/dist/types/key/generate_secret.d.ts +12 -19
  258. package/node_modules/jose/dist/types/key/import.d.ts +25 -31
  259. package/node_modules/jose/dist/types/types.d.ts +184 -319
  260. package/node_modules/jose/dist/types/util/base64url.d.ts +7 -7
  261. package/node_modules/jose/dist/types/util/decode_jwt.d.ts +5 -7
  262. package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +6 -5
  263. package/node_modules/jose/dist/types/util/errors.d.ts +50 -88
  264. package/node_modules/jose/dist/webapi/index.js +70 -32
  265. package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +6 -8
  266. package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +25 -48
  267. package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -14
  268. package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +34 -64
  269. package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
  270. package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +100 -172
  271. package/node_modules/jose/dist/webapi/jwk/embedded.js +29 -32
  272. package/node_modules/jose/dist/webapi/jwk/thumbprint.js +51 -70
  273. package/node_modules/jose/dist/webapi/jwks/local.js +53 -64
  274. package/node_modules/jose/dist/webapi/jwks/remote.js +88 -136
  275. package/node_modules/jose/dist/webapi/jws/compact/sign.js +19 -21
  276. package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
  277. package/node_modules/jose/dist/webapi/jws/flattened/sign.js +22 -31
  278. package/node_modules/jose/dist/webapi/jws/flattened/verify.js +11 -24
  279. package/node_modules/jose/dist/webapi/jws/general/sign.js +55 -73
  280. package/node_modules/jose/dist/webapi/jws/general/verify.js +43 -69
  281. package/node_modules/jose/dist/webapi/jwt/decrypt.js +12 -20
  282. package/node_modules/jose/dist/webapi/jwt/encrypt.js +43 -70
  283. package/node_modules/jose/dist/webapi/jwt/sign.js +17 -16
  284. package/node_modules/jose/dist/webapi/jwt/unsecured.js +31 -40
  285. package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
  286. package/node_modules/jose/dist/webapi/key/export.js +32 -41
  287. package/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -49
  288. package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -40
  289. package/node_modules/jose/dist/webapi/key/import.js +48 -56
  290. package/node_modules/jose/dist/webapi/lib/asn1.js +128 -169
  291. package/node_modules/jose/dist/webapi/lib/buffer_utils.js +72 -41
  292. package/node_modules/jose/dist/webapi/lib/content_encryption.js +75 -119
  293. package/node_modules/jose/dist/webapi/lib/deflate.js +35 -47
  294. package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +102 -93
  295. package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +178 -234
  296. package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +71 -138
  297. package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
  298. package/node_modules/jose/dist/webapi/lib/jws_sign.js +43 -82
  299. package/node_modules/jose/dist/webapi/lib/jws_verify.js +78 -131
  300. package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +123 -209
  301. package/node_modules/jose/dist/webapi/lib/key.js +147 -139
  302. package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
  303. package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
  304. package/node_modules/jose/dist/webapi/lib/key_management.js +169 -235
  305. package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
  306. package/node_modules/jose/dist/webapi/util/base64url.js +14 -37
  307. package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
  308. package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
  309. package/node_modules/jose/dist/webapi/util/errors.js +94 -84
  310. package/node_modules/jose/package.json +17 -81
  311. package/node_modules/protobufjs/dist/light/protobuf.js +59 -6
  312. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  313. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  314. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  315. package/node_modules/protobufjs/dist/minimal/protobuf.js +22 -2
  316. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  317. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  318. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  319. package/node_modules/protobufjs/dist/protobuf.js +59 -6
  320. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  321. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  322. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  323. package/node_modules/protobufjs/package.json +1 -1
  324. package/node_modules/protobufjs/src/decoder.js +32 -3
  325. package/node_modules/protobufjs/src/reader.js +20 -0
  326. package/node_modules/protobufjs/src/wrappers.js +5 -1
  327. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  328. package/node_modules/qs/CHANGELOG.md +15 -0
  329. package/node_modules/qs/README.md +19 -1
  330. package/node_modules/qs/dist/qs.js +21 -21
  331. package/node_modules/qs/eslint.config.mjs +1 -1
  332. package/node_modules/qs/lib/parse.js +3 -4
  333. package/node_modules/qs/lib/stringify.js +23 -8
  334. package/node_modules/qs/lib/utils.js +10 -3
  335. package/node_modules/qs/package.json +4 -4
  336. package/node_modules/qs/test/parse.js +192 -3
  337. package/node_modules/qs/test/stringify.js +317 -0
  338. package/node_modules/qs/test/utils.js +12 -0
  339. package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
  340. package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  341. package/node_modules/undici/lib/dispatcher/client-h2.js +70 -14
  342. package/node_modules/undici/lib/dispatcher/client.js +6 -2
  343. package/node_modules/undici/lib/handler/cache-handler.js +21 -5
  344. package/node_modules/undici/lib/handler/retry-handler.js +42 -7
  345. package/node_modules/undici/lib/interceptor/cache.js +20 -1
  346. package/node_modules/undici/lib/interceptor/decompress.js +146 -14
  347. package/node_modules/undici/lib/interceptor/dump.js +10 -23
  348. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
  349. package/node_modules/undici/lib/web/websocket/connection.js +1 -1
  350. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  351. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  352. package/node_modules/undici/package.json +1 -1
  353. package/node_modules/undici/types/interceptors.d.ts +2 -0
  354. package/node_modules/undici-types/agent.d.ts +13 -12
  355. package/node_modules/undici-types/api.d.ts +26 -26
  356. package/node_modules/undici-types/balanced-pool.d.ts +12 -13
  357. package/node_modules/undici-types/client.d.ts +34 -55
  358. package/node_modules/undici-types/connector.d.ts +2 -4
  359. package/node_modules/undici-types/cookies.d.ts +0 -2
  360. package/node_modules/undici-types/diagnostics-channel.d.ts +10 -18
  361. package/node_modules/undici-types/dispatcher.d.ts +137 -134
  362. package/node_modules/undici-types/env-http-proxy-agent.d.ts +3 -4
  363. package/node_modules/undici-types/errors.d.ts +54 -82
  364. package/node_modules/undici-types/eventsource.d.ts +4 -9
  365. package/node_modules/undici-types/fetch.d.ts +24 -46
  366. package/node_modules/undici-types/file.d.ts +39 -0
  367. package/node_modules/undici-types/filereader.d.ts +54 -0
  368. package/node_modules/undici-types/formdata.d.ts +7 -7
  369. package/node_modules/undici-types/global-dispatcher.d.ts +4 -4
  370. package/node_modules/undici-types/global-origin.d.ts +5 -5
  371. package/node_modules/undici-types/handlers.d.ts +9 -8
  372. package/node_modules/undici-types/header.d.ts +1 -162
  373. package/node_modules/undici-types/index.d.ts +47 -69
  374. package/node_modules/undici-types/interceptors.d.ts +9 -72
  375. package/node_modules/undici-types/mock-agent.d.ts +18 -36
  376. package/node_modules/undici-types/mock-client.d.ts +4 -6
  377. package/node_modules/undici-types/mock-errors.d.ts +3 -3
  378. package/node_modules/undici-types/mock-interceptor.d.ts +20 -21
  379. package/node_modules/undici-types/mock-pool.d.ts +4 -6
  380. package/node_modules/undici-types/package.json +1 -1
  381. package/node_modules/undici-types/patch.d.ts +4 -0
  382. package/node_modules/undici-types/pool-stats.d.ts +8 -8
  383. package/node_modules/undici-types/pool.d.ts +14 -14
  384. package/node_modules/undici-types/proxy-agent.d.ts +6 -7
  385. package/node_modules/undici-types/readable.d.ts +16 -19
  386. package/node_modules/undici-types/retry-agent.d.ts +1 -1
  387. package/node_modules/undici-types/retry-handler.d.ts +10 -19
  388. package/node_modules/undici-types/util.d.ts +3 -3
  389. package/node_modules/undici-types/webidl.d.ts +30 -148
  390. package/node_modules/undici-types/websocket.d.ts +10 -48
  391. package/node_modules/zod/README.md +27 -0
  392. package/node_modules/zod/compile.cjs +96 -0
  393. package/node_modules/zod/compile.d.cts +1 -0
  394. package/node_modules/zod/compile.d.ts +1 -0
  395. package/node_modules/zod/compile.js +52 -0
  396. package/node_modules/zod/index.cjs +21 -2
  397. package/node_modules/zod/index.d.cts +1 -2
  398. package/node_modules/zod/index.d.ts +1 -2
  399. package/node_modules/zod/index.js +5 -2
  400. package/node_modules/zod/locales/index.cjs +19 -0
  401. package/node_modules/zod/mini/index.cjs +19 -0
  402. package/node_modules/zod/package.json +20 -8
  403. package/node_modules/zod/src/compile.ts +56 -0
  404. package/node_modules/zod/src/index.ts +5 -2
  405. package/node_modules/zod/src/v3/ZodError.ts +22 -12
  406. package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
  407. package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
  408. package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
  409. package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
  410. package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
  411. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
  412. package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
  413. package/node_modules/zod/src/v3/types.ts +5 -5
  414. package/node_modules/zod/src/v4/classic/compat.ts +26 -18
  415. package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
  416. package/node_modules/zod/src/v4/classic/errors.ts +59 -44
  417. package/node_modules/zod/src/v4/classic/external.ts +14 -9
  418. package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
  419. package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
  420. package/node_modules/zod/src/v4/classic/index.ts +2 -2
  421. package/node_modules/zod/src/v4/classic/iso.ts +2 -72
  422. package/node_modules/zod/src/v4/classic/parse.ts +10 -4
  423. package/node_modules/zod/src/v4/classic/schemas.ts +652 -371
  424. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
  425. package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
  426. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +185 -0
  427. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
  428. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
  429. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
  430. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
  431. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
  432. package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
  433. package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +994 -0
  434. package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
  435. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
  436. package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
  437. package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
  438. package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
  439. package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
  440. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
  441. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
  442. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
  443. package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
  444. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +4 -0
  445. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
  446. package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
  447. package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
  448. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
  449. package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
  450. package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
  451. package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
  452. package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +297 -0
  453. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
  454. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
  455. package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
  456. package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
  457. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
  458. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
  459. package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
  460. package/node_modules/zod/src/v4/classic/tests/number.test.ts +46 -9
  461. package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
  462. package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  463. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
  464. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
  465. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
  466. package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
  467. package/node_modules/zod/src/v4/classic/tests/properties.test.ts +225 -0
  468. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
  469. package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
  470. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
  471. package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
  472. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
  473. package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
  474. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
  475. package/node_modules/zod/src/v4/classic/tests/string.test.ts +152 -5
  476. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
  477. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
  478. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1758 -202
  479. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
  480. package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
  481. package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
  482. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
  483. package/node_modules/zod/src/v4/core/api.ts +73 -13
  484. package/node_modules/zod/src/v4/core/checks.ts +58 -145
  485. package/node_modules/zod/src/v4/core/compile.ts +2302 -0
  486. package/node_modules/zod/src/v4/core/core.ts +98 -19
  487. package/node_modules/zod/src/v4/core/doc.ts +17 -9
  488. package/node_modules/zod/src/v4/core/errors.ts +113 -25
  489. package/node_modules/zod/src/v4/core/index.ts +3 -0
  490. package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
  491. package/node_modules/zod/src/v4/core/json-schema-processors.ts +468 -146
  492. package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
  493. package/node_modules/zod/src/v4/core/memoizer.ts +334 -0
  494. package/node_modules/zod/src/v4/core/parse.ts +164 -50
  495. package/node_modules/zod/src/v4/core/regexes.ts +38 -15
  496. package/node_modules/zod/src/v4/core/registries.ts +2 -2
  497. package/node_modules/zod/src/v4/core/schemas.ts +1073 -538
  498. package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
  499. package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +969 -0
  500. package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
  501. package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
  502. package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  503. package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
  504. package/node_modules/zod/src/v4/core/tests/compile.test.ts +1859 -0
  505. package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
  506. package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
  507. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
  508. package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
  509. package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
  510. package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
  511. package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
  512. package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  513. package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
  514. package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +31 -0
  515. package/node_modules/zod/src/v4/core/to-json-schema.ts +284 -49
  516. package/node_modules/zod/src/v4/core/util.ts +458 -157
  517. package/node_modules/zod/src/v4/core/versions.ts +2 -2
  518. package/node_modules/zod/src/v4/core/visit.ts +204 -0
  519. package/node_modules/zod/src/v4/index.ts +3 -3
  520. package/node_modules/zod/src/v4/locales/ar.ts +4 -0
  521. package/node_modules/zod/src/v4/locales/az.ts +4 -0
  522. package/node_modules/zod/src/v4/locales/be.ts +11 -0
  523. package/node_modules/zod/src/v4/locales/bg.ts +4 -0
  524. package/node_modules/zod/src/v4/locales/bn.ts +122 -0
  525. package/node_modules/zod/src/v4/locales/ca.ts +4 -0
  526. package/node_modules/zod/src/v4/locales/ckb.ts +139 -0
  527. package/node_modules/zod/src/v4/locales/cs.ts +4 -0
  528. package/node_modules/zod/src/v4/locales/da.ts +6 -2
  529. package/node_modules/zod/src/v4/locales/de.ts +4 -0
  530. package/node_modules/zod/src/v4/locales/el.ts +2 -0
  531. package/node_modules/zod/src/v4/locales/en.ts +16 -4
  532. package/node_modules/zod/src/v4/locales/eo.ts +4 -0
  533. package/node_modules/zod/src/v4/locales/es.ts +3 -0
  534. package/node_modules/zod/src/v4/locales/fa.ts +4 -0
  535. package/node_modules/zod/src/v4/locales/fi.ts +4 -0
  536. package/node_modules/zod/src/v4/locales/fr-CA.ts +4 -0
  537. package/node_modules/zod/src/v4/locales/fr.ts +20 -14
  538. package/node_modules/zod/src/v4/locales/gu.ts +122 -0
  539. package/node_modules/zod/src/v4/locales/he.ts +7 -1
  540. package/node_modules/zod/src/v4/locales/hi.ts +125 -0
  541. package/node_modules/zod/src/v4/locales/hr.ts +3 -0
  542. package/node_modules/zod/src/v4/locales/hu.ts +4 -0
  543. package/node_modules/zod/src/v4/locales/hy.ts +10 -0
  544. package/node_modules/zod/src/v4/locales/id.ts +4 -0
  545. package/node_modules/zod/src/v4/locales/index.ts +11 -0
  546. package/node_modules/zod/src/v4/locales/is.ts +4 -0
  547. package/node_modules/zod/src/v4/locales/it.ts +4 -0
  548. package/node_modules/zod/src/v4/locales/ja.ts +4 -0
  549. package/node_modules/zod/src/v4/locales/ka.ts +4 -0
  550. package/node_modules/zod/src/v4/locales/km.ts +4 -0
  551. package/node_modules/zod/src/v4/locales/kn.ts +125 -0
  552. package/node_modules/zod/src/v4/locales/ko.ts +4 -0
  553. package/node_modules/zod/src/v4/locales/lt.ts +3 -0
  554. package/node_modules/zod/src/v4/locales/mk.ts +4 -0
  555. package/node_modules/zod/src/v4/locales/ms.ts +4 -0
  556. package/node_modules/zod/src/v4/locales/ne.ts +127 -0
  557. package/node_modules/zod/src/v4/locales/nl.ts +4 -0
  558. package/node_modules/zod/src/v4/locales/nn.ts +120 -0
  559. package/node_modules/zod/src/v4/locales/no.ts +6 -2
  560. package/node_modules/zod/src/v4/locales/ota.ts +4 -0
  561. package/node_modules/zod/src/v4/locales/pl.ts +4 -0
  562. package/node_modules/zod/src/v4/locales/ps.ts +4 -0
  563. package/node_modules/zod/src/v4/locales/pt-BR.ts +160 -0
  564. package/node_modules/zod/src/v4/locales/pt.ts +100 -58
  565. package/node_modules/zod/src/v4/locales/ro.ts +2 -0
  566. package/node_modules/zod/src/v4/locales/ru.ts +11 -0
  567. package/node_modules/zod/src/v4/locales/sk.ts +122 -0
  568. package/node_modules/zod/src/v4/locales/sl.ts +4 -0
  569. package/node_modules/zod/src/v4/locales/sv.ts +6 -2
  570. package/node_modules/zod/src/v4/locales/ta.ts +4 -0
  571. package/node_modules/zod/src/v4/locales/tg.ts +134 -0
  572. package/node_modules/zod/src/v4/locales/th.ts +4 -0
  573. package/node_modules/zod/src/v4/locales/tk.ts +112 -0
  574. package/node_modules/zod/src/v4/locales/tr.ts +4 -0
  575. package/node_modules/zod/src/v4/locales/uk.ts +4 -0
  576. package/node_modules/zod/src/v4/locales/ur.ts +4 -0
  577. package/node_modules/zod/src/v4/locales/uz.ts +2 -0
  578. package/node_modules/zod/src/v4/locales/vi.ts +4 -0
  579. package/node_modules/zod/src/v4/locales/yo.ts +4 -0
  580. package/node_modules/zod/src/v4/locales/zh-CN.ts +4 -0
  581. package/node_modules/zod/src/v4/locales/zh-TW.ts +4 -0
  582. package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
  583. package/node_modules/zod/src/v4/mini/external.ts +12 -1
  584. package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
  585. package/node_modules/zod/src/v4/mini/parse.ts +2 -0
  586. package/node_modules/zod/src/v4/mini/schemas.ts +174 -59
  587. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
  588. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
  589. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
  590. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
  591. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
  592. package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
  593. package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
  594. package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
  595. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
  596. package/node_modules/zod/src/v4/mini/tests/index.test.ts +102 -5
  597. package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
  598. package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
  599. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
  600. package/node_modules/zod/src/v4/mini/tests/string.test.ts +37 -0
  601. package/node_modules/zod/v3/ZodError.cjs +41 -12
  602. package/node_modules/zod/v3/ZodError.d.cts +1 -1
  603. package/node_modules/zod/v3/ZodError.d.ts +1 -1
  604. package/node_modules/zod/v3/ZodError.js +22 -12
  605. package/node_modules/zod/v3/errors.cjs +19 -0
  606. package/node_modules/zod/v3/external.cjs +19 -0
  607. package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
  608. package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
  609. package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
  610. package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
  611. package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
  612. package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
  613. package/node_modules/zod/v3/helpers/util.cjs +19 -0
  614. package/node_modules/zod/v3/index.cjs +19 -0
  615. package/node_modules/zod/v3/standard-schema.cjs +19 -0
  616. package/node_modules/zod/v3/types.cjs +26 -5
  617. package/node_modules/zod/v3/types.js +7 -5
  618. package/node_modules/zod/v4/classic/checks.cjs +19 -0
  619. package/node_modules/zod/v4/classic/coerce.cjs +19 -0
  620. package/node_modules/zod/v4/classic/compat.cjs +19 -0
  621. package/node_modules/zod/v4/classic/compat.d.cts +9 -11
  622. package/node_modules/zod/v4/classic/compat.d.ts +9 -11
  623. package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
  624. package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
  625. package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
  626. package/node_modules/zod/v4/classic/deep-partial.js +13 -0
  627. package/node_modules/zod/v4/classic/errors.cjs +62 -34
  628. package/node_modules/zod/v4/classic/errors.d.cts +3 -4
  629. package/node_modules/zod/v4/classic/errors.d.ts +3 -4
  630. package/node_modules/zod/v4/classic/errors.js +43 -34
  631. package/node_modules/zod/v4/classic/external.cjs +51 -27
  632. package/node_modules/zod/v4/classic/external.d.cts +5 -2
  633. package/node_modules/zod/v4/classic/external.d.ts +5 -2
  634. package/node_modules/zod/v4/classic/external.js +5 -8
  635. package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
  636. package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
  637. package/node_modules/zod/v4/classic/in-out.cjs +82 -0
  638. package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
  639. package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
  640. package/node_modules/zod/v4/classic/in-out.js +36 -0
  641. package/node_modules/zod/v4/classic/index.cjs +21 -2
  642. package/node_modules/zod/v4/classic/index.d.cts +1 -2
  643. package/node_modules/zod/v4/classic/index.d.ts +1 -2
  644. package/node_modules/zod/v4/classic/index.js +2 -2
  645. package/node_modules/zod/v4/classic/iso.cjs +30 -22
  646. package/node_modules/zod/v4/classic/iso.d.cts +2 -17
  647. package/node_modules/zod/v4/classic/iso.d.ts +2 -17
  648. package/node_modules/zod/v4/classic/iso.js +2 -17
  649. package/node_modules/zod/v4/classic/parse.cjs +23 -1
  650. package/node_modules/zod/v4/classic/parse.d.cts +17 -4
  651. package/node_modules/zod/v4/classic/parse.d.ts +17 -4
  652. package/node_modules/zod/v4/classic/parse.js +1 -0
  653. package/node_modules/zod/v4/classic/schemas.cjs +591 -422
  654. package/node_modules/zod/v4/classic/schemas.d.cts +70 -19
  655. package/node_modules/zod/v4/classic/schemas.d.ts +70 -19
  656. package/node_modules/zod/v4/classic/schemas.js +564 -420
  657. package/node_modules/zod/v4/core/api.cjs +58 -4
  658. package/node_modules/zod/v4/core/api.d.cts +16 -10
  659. package/node_modules/zod/v4/core/api.d.ts +16 -10
  660. package/node_modules/zod/v4/core/api.js +36 -4
  661. package/node_modules/zod/v4/core/checks.cjs +56 -127
  662. package/node_modules/zod/v4/core/checks.d.cts +13 -13
  663. package/node_modules/zod/v4/core/checks.d.ts +13 -13
  664. package/node_modules/zod/v4/core/checks.js +37 -127
  665. package/node_modules/zod/v4/core/compile.cjs +1913 -0
  666. package/node_modules/zod/v4/core/compile.d.cts +65 -0
  667. package/node_modules/zod/v4/core/compile.d.ts +65 -0
  668. package/node_modules/zod/v4/core/compile.js +1863 -0
  669. package/node_modules/zod/v4/core/core.cjs +100 -18
  670. package/node_modules/zod/v4/core/core.d.cts +16 -4
  671. package/node_modules/zod/v4/core/core.d.ts +16 -4
  672. package/node_modules/zod/v4/core/core.js +82 -19
  673. package/node_modules/zod/v4/core/doc.cjs +31 -9
  674. package/node_modules/zod/v4/core/doc.d.cts +3 -1
  675. package/node_modules/zod/v4/core/doc.d.ts +3 -1
  676. package/node_modules/zod/v4/core/doc.js +12 -9
  677. package/node_modules/zod/v4/core/errors.cjs +126 -25
  678. package/node_modules/zod/v4/core/errors.d.cts +4 -0
  679. package/node_modules/zod/v4/core/errors.d.ts +4 -0
  680. package/node_modules/zod/v4/core/errors.js +107 -25
  681. package/node_modules/zod/v4/core/index.cjs +24 -1
  682. package/node_modules/zod/v4/core/index.d.cts +3 -0
  683. package/node_modules/zod/v4/core/index.d.ts +3 -0
  684. package/node_modules/zod/v4/core/index.js +3 -0
  685. package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
  686. package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
  687. package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
  688. package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
  689. package/node_modules/zod/v4/core/json-schema-processors.cjs +470 -149
  690. package/node_modules/zod/v4/core/json-schema-processors.d.cts +17 -0
  691. package/node_modules/zod/v4/core/json-schema-processors.d.ts +17 -0
  692. package/node_modules/zod/v4/core/json-schema-processors.js +427 -150
  693. package/node_modules/zod/v4/core/json-schema.cjs +19 -0
  694. package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
  695. package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
  696. package/node_modules/zod/v4/core/memoizer.cjs +363 -0
  697. package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
  698. package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
  699. package/node_modules/zod/v4/core/memoizer.js +314 -0
  700. package/node_modules/zod/v4/core/parse.cjs +148 -46
  701. package/node_modules/zod/v4/core/parse.d.cts +14 -11
  702. package/node_modules/zod/v4/core/parse.d.ts +14 -11
  703. package/node_modules/zod/v4/core/parse.js +127 -45
  704. package/node_modules/zod/v4/core/regexes.cjs +52 -17
  705. package/node_modules/zod/v4/core/regexes.d.cts +4 -0
  706. package/node_modules/zod/v4/core/regexes.d.ts +4 -0
  707. package/node_modules/zod/v4/core/regexes.js +30 -15
  708. package/node_modules/zod/v4/core/registries.cjs +19 -0
  709. package/node_modules/zod/v4/core/registries.js +2 -2
  710. package/node_modules/zod/v4/core/schemas.cjs +826 -387
  711. package/node_modules/zod/v4/core/schemas.d.cts +140 -36
  712. package/node_modules/zod/v4/core/schemas.d.ts +140 -36
  713. package/node_modules/zod/v4/core/schemas.js +796 -387
  714. package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
  715. package/node_modules/zod/v4/core/to-json-schema.cjs +270 -45
  716. package/node_modules/zod/v4/core/to-json-schema.d.cts +48 -5
  717. package/node_modules/zod/v4/core/to-json-schema.d.ts +48 -5
  718. package/node_modules/zod/v4/core/to-json-schema.js +248 -45
  719. package/node_modules/zod/v4/core/util.cjs +376 -157
  720. package/node_modules/zod/v4/core/util.d.cts +79 -1
  721. package/node_modules/zod/v4/core/util.d.ts +79 -1
  722. package/node_modules/zod/v4/core/util.js +345 -156
  723. package/node_modules/zod/v4/core/versions.cjs +21 -2
  724. package/node_modules/zod/v4/core/versions.d.cts +1 -1
  725. package/node_modules/zod/v4/core/versions.d.ts +1 -1
  726. package/node_modules/zod/v4/core/versions.js +2 -2
  727. package/node_modules/zod/v4/core/visit.cjs +226 -0
  728. package/node_modules/zod/v4/core/visit.d.cts +30 -0
  729. package/node_modules/zod/v4/core/visit.d.ts +30 -0
  730. package/node_modules/zod/v4/core/visit.js +181 -0
  731. package/node_modules/zod/v4/index.cjs +34 -5
  732. package/node_modules/zod/v4/index.d.cts +2 -2
  733. package/node_modules/zod/v4/index.d.ts +2 -2
  734. package/node_modules/zod/v4/index.js +3 -2
  735. package/node_modules/zod/v4/locales/ar.cjs +4 -0
  736. package/node_modules/zod/v4/locales/ar.js +4 -0
  737. package/node_modules/zod/v4/locales/az.cjs +4 -0
  738. package/node_modules/zod/v4/locales/az.js +4 -0
  739. package/node_modules/zod/v4/locales/be.cjs +11 -0
  740. package/node_modules/zod/v4/locales/be.js +11 -0
  741. package/node_modules/zod/v4/locales/bg.cjs +4 -0
  742. package/node_modules/zod/v4/locales/bg.js +4 -0
  743. package/node_modules/zod/v4/locales/bn.cjs +139 -0
  744. package/node_modules/zod/v4/locales/bn.d.cts +5 -0
  745. package/node_modules/zod/v4/locales/bn.d.ts +4 -0
  746. package/node_modules/zod/v4/locales/bn.js +112 -0
  747. package/node_modules/zod/v4/locales/ca.cjs +4 -0
  748. package/node_modules/zod/v4/locales/ca.js +4 -0
  749. package/node_modules/zod/v4/locales/ckb.cjs +159 -0
  750. package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
  751. package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
  752. package/node_modules/zod/v4/locales/ckb.js +132 -0
  753. package/node_modules/zod/v4/locales/cs.cjs +4 -0
  754. package/node_modules/zod/v4/locales/cs.js +4 -0
  755. package/node_modules/zod/v4/locales/da.cjs +6 -2
  756. package/node_modules/zod/v4/locales/da.js +6 -2
  757. package/node_modules/zod/v4/locales/de.cjs +4 -0
  758. package/node_modules/zod/v4/locales/de.js +4 -0
  759. package/node_modules/zod/v4/locales/el.cjs +2 -0
  760. package/node_modules/zod/v4/locales/el.js +2 -0
  761. package/node_modules/zod/v4/locales/en.cjs +15 -4
  762. package/node_modules/zod/v4/locales/en.js +15 -4
  763. package/node_modules/zod/v4/locales/eo.cjs +4 -0
  764. package/node_modules/zod/v4/locales/eo.js +4 -0
  765. package/node_modules/zod/v4/locales/es.cjs +3 -0
  766. package/node_modules/zod/v4/locales/es.js +3 -0
  767. package/node_modules/zod/v4/locales/fa.cjs +4 -0
  768. package/node_modules/zod/v4/locales/fa.js +4 -0
  769. package/node_modules/zod/v4/locales/fi.cjs +4 -0
  770. package/node_modules/zod/v4/locales/fi.js +4 -0
  771. package/node_modules/zod/v4/locales/fr-CA.cjs +4 -0
  772. package/node_modules/zod/v4/locales/fr-CA.js +4 -0
  773. package/node_modules/zod/v4/locales/fr.cjs +17 -14
  774. package/node_modules/zod/v4/locales/fr.js +17 -14
  775. package/node_modules/zod/v4/locales/gu.cjs +139 -0
  776. package/node_modules/zod/v4/locales/gu.d.cts +5 -0
  777. package/node_modules/zod/v4/locales/gu.d.ts +4 -0
  778. package/node_modules/zod/v4/locales/gu.js +112 -0
  779. package/node_modules/zod/v4/locales/he.cjs +6 -0
  780. package/node_modules/zod/v4/locales/he.js +6 -0
  781. package/node_modules/zod/v4/locales/hi.cjs +137 -0
  782. package/node_modules/zod/v4/locales/hi.d.cts +5 -0
  783. package/node_modules/zod/v4/locales/hi.d.ts +4 -0
  784. package/node_modules/zod/v4/locales/hi.js +110 -0
  785. package/node_modules/zod/v4/locales/hr.cjs +3 -0
  786. package/node_modules/zod/v4/locales/hr.js +3 -0
  787. package/node_modules/zod/v4/locales/hu.cjs +4 -0
  788. package/node_modules/zod/v4/locales/hu.js +4 -0
  789. package/node_modules/zod/v4/locales/hy.cjs +10 -0
  790. package/node_modules/zod/v4/locales/hy.js +10 -0
  791. package/node_modules/zod/v4/locales/id.cjs +4 -0
  792. package/node_modules/zod/v4/locales/id.js +4 -0
  793. package/node_modules/zod/v4/locales/index.cjs +43 -2
  794. package/node_modules/zod/v4/locales/index.d.cts +11 -0
  795. package/node_modules/zod/v4/locales/index.d.ts +11 -0
  796. package/node_modules/zod/v4/locales/index.js +11 -0
  797. package/node_modules/zod/v4/locales/is.cjs +4 -0
  798. package/node_modules/zod/v4/locales/is.js +4 -0
  799. package/node_modules/zod/v4/locales/it.cjs +4 -0
  800. package/node_modules/zod/v4/locales/it.js +4 -0
  801. package/node_modules/zod/v4/locales/ja.cjs +4 -0
  802. package/node_modules/zod/v4/locales/ja.js +4 -0
  803. package/node_modules/zod/v4/locales/ka.cjs +4 -0
  804. package/node_modules/zod/v4/locales/ka.js +4 -0
  805. package/node_modules/zod/v4/locales/km.cjs +4 -0
  806. package/node_modules/zod/v4/locales/km.js +4 -0
  807. package/node_modules/zod/v4/locales/kn.cjs +142 -0
  808. package/node_modules/zod/v4/locales/kn.d.cts +5 -0
  809. package/node_modules/zod/v4/locales/kn.d.ts +4 -0
  810. package/node_modules/zod/v4/locales/kn.js +115 -0
  811. package/node_modules/zod/v4/locales/ko.cjs +4 -0
  812. package/node_modules/zod/v4/locales/ko.js +4 -0
  813. package/node_modules/zod/v4/locales/lt.cjs +3 -0
  814. package/node_modules/zod/v4/locales/lt.js +3 -0
  815. package/node_modules/zod/v4/locales/mk.cjs +4 -0
  816. package/node_modules/zod/v4/locales/mk.js +4 -0
  817. package/node_modules/zod/v4/locales/ms.cjs +4 -0
  818. package/node_modules/zod/v4/locales/ms.js +4 -0
  819. package/node_modules/zod/v4/locales/ne.cjs +137 -0
  820. package/node_modules/zod/v4/locales/ne.d.cts +5 -0
  821. package/node_modules/zod/v4/locales/ne.d.ts +4 -0
  822. package/node_modules/zod/v4/locales/ne.js +110 -0
  823. package/node_modules/zod/v4/locales/nl.cjs +4 -0
  824. package/node_modules/zod/v4/locales/nl.js +4 -0
  825. package/node_modules/zod/v4/locales/nn.cjs +139 -0
  826. package/node_modules/zod/v4/locales/nn.d.cts +5 -0
  827. package/node_modules/zod/v4/locales/nn.d.ts +4 -0
  828. package/node_modules/zod/v4/locales/nn.js +112 -0
  829. package/node_modules/zod/v4/locales/no.cjs +6 -2
  830. package/node_modules/zod/v4/locales/no.js +6 -2
  831. package/node_modules/zod/v4/locales/ota.cjs +4 -0
  832. package/node_modules/zod/v4/locales/ota.js +4 -0
  833. package/node_modules/zod/v4/locales/pl.cjs +4 -0
  834. package/node_modules/zod/v4/locales/pl.js +4 -0
  835. package/node_modules/zod/v4/locales/ps.cjs +4 -0
  836. package/node_modules/zod/v4/locales/ps.js +4 -0
  837. package/node_modules/zod/v4/locales/pt-BR.cjs +169 -0
  838. package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
  839. package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
  840. package/node_modules/zod/v4/locales/pt-BR.js +142 -0
  841. package/node_modules/zod/v4/locales/pt.cjs +88 -55
  842. package/node_modules/zod/v4/locales/pt.js +88 -55
  843. package/node_modules/zod/v4/locales/ro.cjs +2 -0
  844. package/node_modules/zod/v4/locales/ro.js +2 -0
  845. package/node_modules/zod/v4/locales/ru.cjs +11 -0
  846. package/node_modules/zod/v4/locales/ru.js +11 -0
  847. package/node_modules/zod/v4/locales/sk.cjs +142 -0
  848. package/node_modules/zod/v4/locales/sk.d.cts +5 -0
  849. package/node_modules/zod/v4/locales/sk.d.ts +4 -0
  850. package/node_modules/zod/v4/locales/sk.js +115 -0
  851. package/node_modules/zod/v4/locales/sl.cjs +4 -0
  852. package/node_modules/zod/v4/locales/sl.js +4 -0
  853. package/node_modules/zod/v4/locales/sv.cjs +6 -2
  854. package/node_modules/zod/v4/locales/sv.js +6 -2
  855. package/node_modules/zod/v4/locales/ta.cjs +4 -0
  856. package/node_modules/zod/v4/locales/ta.js +4 -0
  857. package/node_modules/zod/v4/locales/tg.cjs +143 -0
  858. package/node_modules/zod/v4/locales/tg.d.cts +5 -0
  859. package/node_modules/zod/v4/locales/tg.d.ts +4 -0
  860. package/node_modules/zod/v4/locales/tg.js +116 -0
  861. package/node_modules/zod/v4/locales/th.cjs +4 -0
  862. package/node_modules/zod/v4/locales/th.js +4 -0
  863. package/node_modules/zod/v4/locales/tk.cjs +133 -0
  864. package/node_modules/zod/v4/locales/tk.d.cts +5 -0
  865. package/node_modules/zod/v4/locales/tk.d.ts +4 -0
  866. package/node_modules/zod/v4/locales/tk.js +106 -0
  867. package/node_modules/zod/v4/locales/tr.cjs +4 -0
  868. package/node_modules/zod/v4/locales/tr.js +4 -0
  869. package/node_modules/zod/v4/locales/uk.cjs +4 -0
  870. package/node_modules/zod/v4/locales/uk.js +4 -0
  871. package/node_modules/zod/v4/locales/ur.cjs +4 -0
  872. package/node_modules/zod/v4/locales/ur.js +4 -0
  873. package/node_modules/zod/v4/locales/uz.cjs +2 -0
  874. package/node_modules/zod/v4/locales/uz.js +2 -0
  875. package/node_modules/zod/v4/locales/vi.cjs +4 -0
  876. package/node_modules/zod/v4/locales/vi.js +4 -0
  877. package/node_modules/zod/v4/locales/yo.cjs +4 -0
  878. package/node_modules/zod/v4/locales/yo.js +4 -0
  879. package/node_modules/zod/v4/locales/zh-CN.cjs +4 -0
  880. package/node_modules/zod/v4/locales/zh-CN.js +4 -0
  881. package/node_modules/zod/v4/locales/zh-TW.cjs +4 -0
  882. package/node_modules/zod/v4/locales/zh-TW.js +4 -0
  883. package/node_modules/zod/v4/mini/checks.cjs +19 -0
  884. package/node_modules/zod/v4/mini/coerce.cjs +19 -0
  885. package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
  886. package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
  887. package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
  888. package/node_modules/zod/v4/mini/deep-partial.js +13 -0
  889. package/node_modules/zod/v4/mini/external.cjs +33 -1
  890. package/node_modules/zod/v4/mini/external.d.cts +5 -2
  891. package/node_modules/zod/v4/mini/external.d.ts +5 -2
  892. package/node_modules/zod/v4/mini/external.js +3 -1
  893. package/node_modules/zod/v4/mini/in-out.cjs +82 -0
  894. package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
  895. package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
  896. package/node_modules/zod/v4/mini/in-out.js +36 -0
  897. package/node_modules/zod/v4/mini/index.cjs +19 -0
  898. package/node_modules/zod/v4/mini/iso.cjs +19 -0
  899. package/node_modules/zod/v4/mini/parse.cjs +22 -1
  900. package/node_modules/zod/v4/mini/parse.d.cts +1 -1
  901. package/node_modules/zod/v4/mini/parse.d.ts +1 -1
  902. package/node_modules/zod/v4/mini/parse.js +1 -1
  903. package/node_modules/zod/v4/mini/schemas.cjs +115 -49
  904. package/node_modules/zod/v4/mini/schemas.d.cts +52 -14
  905. package/node_modules/zod/v4/mini/schemas.d.ts +52 -14
  906. package/node_modules/zod/v4/mini/schemas.js +90 -47
  907. package/node_modules/zod/v4-mini/index.cjs +19 -0
  908. package/package.json +3 -2
  909. package/skills/context-management/SKILL.md +258 -0
  910. package/skills/figma-implement-design/SKILL.md +258 -0
  911. package/skills/orchestrator/SKILL.md +82 -0
  912. package/skills/s-help/SKILL.md +42 -0
  913. package/skills/s-help/resources/README.md +23 -0
  914. package/skills/s-help/resources/commands.json +78 -0
  915. package/skills/s-help/resources/s-acm.md +26 -0
  916. package/skills/s-help/resources/s-bash-mode.md +23 -0
  917. package/skills/s-help/resources/s-bash-reset.md +23 -0
  918. package/skills/s-help/resources/s-context.md +25 -0
  919. package/skills/s-help/resources/s-filechanges-accept.md +25 -0
  920. package/skills/s-help/resources/s-filechanges-decline.md +30 -0
  921. package/skills/s-help/resources/s-filechanges.md +38 -0
  922. package/skills/s-help/resources/s-footer.md +38 -0
  923. package/skills/s-help/resources/s-promptlib.md +28 -0
  924. package/skills/s-help/resources/s-skills-manager.md +31 -0
  925. package/skills/s-help/resources/s-stash-history.md +26 -0
  926. package/skills/screenshot/SKILL.md +267 -0
  927. package/skills/screenshot/scripts/ensure_macos_permissions.sh +54 -0
  928. package/skills/screenshot/scripts/macos_display_info.swift +22 -0
  929. package/skills/screenshot/scripts/macos_permissions.swift +40 -0
  930. package/skills/screenshot/scripts/macos_window_info.swift +126 -0
  931. package/skills/screenshot/scripts/take_screenshot.ps1 +163 -0
  932. package/skills/screenshot/scripts/take_screenshot.py +585 -0
  933. package/slingshot/index.js +232 -230
  934. package/node_modules/@types/node/ffi.d.ts +0 -486
  935. package/node_modules/@types/node/inspector/promises.d.ts +0 -35
  936. package/node_modules/@types/node/path/posix.d.ts +0 -8
  937. package/node_modules/@types/node/path/win32.d.ts +0 -8
  938. package/node_modules/@types/node/quic.d.ts +0 -2151
  939. package/node_modules/@types/node/stream/iter.d.ts +0 -452
  940. package/node_modules/@types/node/test/reporters.d.ts +0 -59
  941. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +0 -71
  942. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +0 -72
  943. package/node_modules/@types/node/ts5.7/index.d.ts +0 -118
  944. package/node_modules/@types/node/util/types.d.ts +0 -558
  945. package/node_modules/@types/node/vfs.d.ts +0 -210
  946. package/node_modules/@types/node/web-globals/blob.d.ts +0 -23
  947. package/node_modules/@types/node/web-globals/console.d.ts +0 -9
  948. package/node_modules/@types/node/web-globals/crypto.d.ts +0 -39
  949. package/node_modules/@types/node/web-globals/encoding.d.ts +0 -11
  950. package/node_modules/@types/node/web-globals/importmeta.d.ts +0 -13
  951. package/node_modules/@types/node/web-globals/messaging.d.ts +0 -23
  952. package/node_modules/@types/node/web-globals/performance.d.ts +0 -45
  953. package/node_modules/@types/node/web-globals/timers.d.ts +0 -44
  954. package/node_modules/@types/node/web-globals/url.d.ts +0 -24
  955. package/node_modules/@types/node/zlib/iter.d.ts +0 -131
  956. package/node_modules/jose/dist/webapi/lib/base64.js +0 -22
  957. package/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -28
  958. package/node_modules/jose/dist/webapi/lib/helpers.js +0 -42
  959. package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -26
  960. package/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -17
  961. package/node_modules/jose/dist/webapi/lib/jwk_metadata.js +0 -20
  962. package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -17
  963. package/node_modules/jose/dist/webapi/lib/key_options.js +0 -6
  964. package/node_modules/jose/dist/webapi/lib/options.js +0 -74
  965. package/node_modules/jose/dist/webapi/lib/signing.js +0 -26
  966. package/node_modules/jose/dist/webapi/lib/type_checks.js +0 -33
  967. package/node_modules/undici-types/cache-interceptor.d.ts +0 -179
  968. package/node_modules/undici-types/client-stats.d.ts +0 -15
  969. package/node_modules/undici-types/dispatcher1-wrapper.d.ts +0 -7
  970. package/node_modules/undici-types/h2c-client.d.ts +0 -73
  971. package/node_modules/undici-types/mock-call-history.d.ts +0 -111
  972. package/node_modules/undici-types/round-robin-pool.d.ts +0 -39
  973. package/node_modules/undici-types/snapshot-agent.d.ts +0 -113
  974. package/node_modules/undici-types/socks5-proxy-agent.d.ts +0 -25
  975. package/node_modules/undici-types/utility.d.ts +0 -7
  976. package/node_modules/zod/src/v4/core/config.ts +0 -15
@@ -1,10 +1,11 @@
1
- import type { $ZodTypeDiscriminable } from "./api.js";
2
1
  import * as checks from "./checks.js";
2
+ import type { $ZodNumberFormats } from "./checks.js";
3
+ import type { $ZodBigIntFormats } from "./checks.js";
3
4
  import * as core from "./core.js";
4
5
  import { Doc } from "./doc.js";
5
6
  import type * as errors from "./errors.js";
6
7
  import type * as JSONSchema from "./json-schema.js";
7
- import { parse, parseAsync, safeParse, safeParseAsync } from "./parse.js";
8
+ import { parse, parseAsync } from "./parse.js";
8
9
  import * as regexes from "./regexes.js";
9
10
  import type { StandardSchemaV1 } from "./standard-schema.js";
10
11
  import type { ProcessParams, ToJSONSchemaContext } from "./to-json-schema.js";
@@ -29,6 +30,15 @@ export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> ex
29
30
  readonly async?: boolean | undefined;
30
31
  readonly direction?: "forward" | "backward";
31
32
  readonly skipChecks?: boolean;
33
+ /** Set only by `validate`/`validateAsync`. A container may stop before its next child, never inside one, so a map entry and a tuple's fixed items parse whole. */
34
+ readonly abortEarly?: boolean;
35
+ }
36
+
37
+ /** Gives a container cycle support: `attach` wraps its parse, and `alloc` registers the object it builds into before any child is parsed so a reference back to the same input resolves to it. */
38
+ export interface $ZodMemoizer {
39
+ attach(inst: $ZodType): void;
40
+ guard(inst: $ZodType): void;
41
+ alloc<T extends object>(inst: $ZodType, payload: ParsePayload, empty: T, ctx: ParseContextInternal): T;
32
42
  }
33
43
 
34
44
  export interface ParsePayload<T = unknown> {
@@ -36,11 +46,9 @@ export interface ParsePayload<T = unknown> {
36
46
  issues: errors.$ZodRawIssue[];
37
47
  /** A way to mark a whole payload as aborted. Used in codecs/pipes. */
38
48
  aborted?: boolean;
39
- /** @internal Marks a value as a fallback that an outer wrapper (e.g.
40
- * $ZodOptional) may override with its own interpretation when input was
41
- * undefined. Set by $ZodCatch when catchValue substitutes and by every
42
- * $ZodTransform invocation. */
43
- fallback?: boolean | undefined;
49
+ /** @internal Set when the value came from a repeat visit to a node still being
50
+ * parsed. Its checks run on the node itself, against the finished value. */
51
+ memo?: boolean | undefined;
44
52
  }
45
53
 
46
54
  export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
@@ -88,7 +96,8 @@ export interface $ZodTypeDef {
88
96
  | "promise"
89
97
  | "lazy"
90
98
  | "function"
91
- | "custom";
99
+ | "custom"
100
+ | "properties";
92
101
  error?: errors.$ZodErrorMap<never> | undefined;
93
102
  checks?: checks.$ZodCheck<never>[];
94
103
  }
@@ -120,8 +129,13 @@ export interface _$ZodTypeInternals {
120
129
  * @default Required
121
130
  */
122
131
 
123
- /** @internal */
124
- optin?: "optional" | undefined;
132
+ /** @internal Three rungs, each strictly stronger than the last:
133
+ * undefined — required; the container may not omit this slot
134
+ * "optional" — the container may omit it; nothing is supplied in its place
135
+ * "defaulted" — the container may omit it AND this schema substitutes a value
136
+ * Consumers asking "may the slot be absent?" test `!== undefined`.
137
+ * $ZodOptional asks the stronger question and tests `=== "defaulted"`. */
138
+ optin?: "optional" | "defaulted" | undefined;
125
139
  /** @internal */
126
140
  optout?: "optional" | undefined;
127
141
 
@@ -187,137 +201,164 @@ export interface $ZodType<
187
201
  export interface _$ZodType<T extends $ZodTypeInternals = $ZodTypeInternals>
188
202
  extends $ZodType<T["output"], T["input"], T> {}
189
203
 
190
- export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
191
- inst ??= {} as any;
192
-
193
- inst._zod.def = def; // set _def property
194
- inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
195
- inst._zod.version = version;
196
-
197
- const checks = [...(inst._zod.def.checks ?? [])];
198
-
199
- // if inst is itself a checks.$ZodCheck, run it as a check
200
- if (inst._zod.traits.has("$ZodCheck")) {
201
- checks.unshift(inst as any);
202
- }
203
-
204
- for (const ch of checks) {
205
- for (const fn of ch._zod.onattach) {
206
- fn(inst);
204
+ export const $ZodType: core.$constructor<$ZodType> = /*@__PURE__*/ core.$constructor<$ZodType>(
205
+ "$ZodType",
206
+ (inst, def) => {
207
+ inst ??= {} as any;
208
+
209
+ inst._zod.def = def; // set _def property
210
+ inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
211
+ inst._zod.version = version;
212
+
213
+ const defChecks = inst._zod.def.checks;
214
+ // if inst is itself a checks.$ZodCheck, run it as a check
215
+ const checks: checks.$ZodCheck<never>[] = inst._zod.traits.has("$ZodCheck")
216
+ ? [inst as any, ...(defChecks ?? [])]
217
+ : defChecks?.length
218
+ ? [...defChecks]
219
+ : [];
220
+
221
+ for (const ch of checks) {
222
+ for (const fn of ch._zod.onattach) {
223
+ fn(inst);
224
+ }
207
225
  }
208
- }
209
226
 
210
- if (checks.length === 0) {
211
- // deferred initializer
212
- // inst._zod.parse is not yet defined
213
- inst._zod.deferred ??= [];
214
- inst._zod.deferred?.push(() => {
215
- inst._zod.run = inst._zod.parse;
216
- });
217
- } else {
218
- const runChecks = (
219
- payload: ParsePayload,
220
- checks: checks.$ZodCheck<never>[],
221
- ctx?: ParseContextInternal | undefined
222
- ): util.MaybeAsync<ParsePayload> => {
223
- let isAborted = util.aborted(payload);
224
-
225
- let asyncResult!: Promise<unknown> | undefined;
226
- for (const ch of checks) {
227
- if (ch._zod.def.when) {
228
- if (util.explicitlyAborted(payload)) continue;
229
- const shouldRun = ch._zod.def.when(payload);
230
- if (!shouldRun) continue;
231
- } else if (isAborted) {
232
- continue;
233
- }
234
- const currLen = payload.issues.length;
235
- const _ = ch._zod.check(payload as any) as any as ParsePayload;
227
+ if (checks.length === 0) {
228
+ // deferred initializer inst._zod.parse is not yet defined
229
+ inst._zod.deferred ??= [];
230
+ inst._zod.deferred?.push(() => {
231
+ inst._zod.run = inst._zod.parse;
232
+ });
233
+ } else {
234
+ const runChecks = (
235
+ payload: ParsePayload,
236
+ checks: checks.$ZodCheck<never>[],
237
+ ctx?: ParseContextInternal | undefined
238
+ ): util.MaybeAsync<ParsePayload> => {
239
+ if (payload.memo) return payload;
240
+
241
+ let isAborted = util.aborted(payload);
242
+
243
+ let asyncResult!: Promise<unknown> | undefined;
244
+ for (const ch of checks) {
245
+ if (ch._zod.def.when) {
246
+ if (util.explicitlyAborted(payload)) continue;
247
+ const shouldRun = ch._zod.def.when(payload);
248
+ if (!shouldRun) continue;
249
+ } else if (isAborted) {
250
+ continue;
251
+ }
252
+ const currLen = payload.issues.length;
253
+ const _ = ch._zod.check(payload as any) as any as ParsePayload;
236
254
 
237
- if (_ instanceof Promise && ctx?.async === false) {
238
- throw new core.$ZodAsyncError();
239
- }
240
- if (asyncResult || _ instanceof Promise) {
241
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
242
- await _;
255
+ if (_ instanceof Promise && ctx?.async === false) {
256
+ throw new core.$ZodAsyncError();
257
+ }
258
+ if (asyncResult || _ instanceof Promise) {
259
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
260
+ await _;
261
+ const nextLen = payload.issues.length;
262
+ if (nextLen === currLen) return;
263
+ util.attachSchema(payload.issues, currLen, inst);
264
+ if (!isAborted) isAborted = util.aborted(payload, currLen);
265
+ });
266
+ } else {
243
267
  const nextLen = payload.issues.length;
244
- if (nextLen === currLen) return;
268
+ if (nextLen === currLen) continue;
269
+ util.attachSchema(payload.issues, currLen, inst);
245
270
  if (!isAborted) isAborted = util.aborted(payload, currLen);
271
+ }
272
+ }
273
+
274
+ if (asyncResult) {
275
+ return asyncResult.then(() => {
276
+ return payload;
246
277
  });
247
- } else {
248
- const nextLen = payload.issues.length;
249
- if (nextLen === currLen) continue;
250
- if (!isAborted) isAborted = util.aborted(payload, currLen);
251
278
  }
252
- }
279
+ return payload;
280
+ };
253
281
 
254
- if (asyncResult) {
255
- return asyncResult.then(() => {
256
- return payload;
257
- });
258
- }
259
- return payload;
260
- };
282
+ const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
283
+ // abort if the canary is aborted
284
+ if (util.aborted(canary)) {
285
+ canary.aborted = true;
286
+ return canary;
287
+ }
261
288
 
262
- const handleCanaryResult = (canary: ParsePayload, payload: ParsePayload, ctx: ParseContextInternal) => {
263
- // abort if the canary is aborted
264
- if (util.aborted(canary)) {
265
- canary.aborted = true;
266
- return canary;
267
- }
289
+ // run checks first, then
290
+ const checkResult = runChecks(payload, checks, ctx);
291
+ if (checkResult instanceof Promise) {
292
+ if (ctx.async === false) throw new core.$ZodAsyncError();
293
+ return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
294
+ }
295
+ return inst._zod.parse(checkResult, ctx);
296
+ };
268
297
 
269
- // run checks first, then
270
- const checkResult = runChecks(payload, checks, ctx);
271
- if (checkResult instanceof Promise) {
272
- if (ctx.async === false) throw new core.$ZodAsyncError();
273
- return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
274
- }
275
- return inst._zod.parse(checkResult, ctx);
276
- };
298
+ inst._zod.run = (payload, ctx) => {
299
+ if (ctx.skipChecks) {
300
+ return inst._zod.parse(payload, ctx);
301
+ }
302
+ if (ctx.direction === "backward") {
303
+ // run canary initial pass (no checks)
304
+ const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
277
305
 
278
- inst._zod.run = (payload, ctx) => {
279
- if (ctx.skipChecks) {
280
- return inst._zod.parse(payload, ctx);
281
- }
282
- if (ctx.direction === "backward") {
283
- // run canary
284
- // initial pass (no checks)
285
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
306
+ if (canary instanceof Promise) {
307
+ return canary.then((canary) => {
308
+ return handleCanaryResult(canary, payload, ctx);
309
+ });
310
+ }
286
311
 
287
- if (canary instanceof Promise) {
288
- return canary.then((canary) => {
289
- return handleCanaryResult(canary, payload, ctx);
290
- });
312
+ return handleCanaryResult(canary, payload, ctx);
291
313
  }
292
314
 
293
- return handleCanaryResult(canary, payload, ctx);
294
- }
295
-
296
- // forward
297
- const result = inst._zod.parse(payload, ctx);
298
- if (result instanceof Promise) {
299
- if (ctx.async === false) throw new core.$ZodAsyncError();
300
- return result.then((result) => runChecks(result, checks, ctx));
301
- }
315
+ // forward
316
+ const result = inst._zod.parse(payload, ctx);
317
+ if (result instanceof Promise) {
318
+ if (ctx.async === false) throw new core.$ZodAsyncError();
319
+ return result.then((result) => runChecks(result, checks, ctx));
320
+ }
302
321
 
303
- return runChecks(result, checks, ctx);
304
- };
322
+ return runChecks(result, checks, ctx);
323
+ };
324
+ }
325
+ },
326
+ {
327
+ // Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
328
+ get "~standard"(): StandardSchemaV1.Props<any, any> {
329
+ return util.hide(this, "~standard", standardProps(this));
330
+ },
331
+ set "~standard"(value: StandardSchemaV1.Props<any, any>) {
332
+ util.own(this, "~standard", value);
333
+ },
305
334
  }
335
+ );
336
+
337
+ /** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
338
+ // a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
339
+ const toStandardResult = (r: ParsePayload, ctx: ParseContextInternal) =>
340
+ r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
341
+
342
+ async function validateAsync(inst: $ZodType, value: unknown) {
343
+ const ctx: ParseContextInternal = { async: true };
344
+ return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)) as ParsePayload, ctx);
345
+ }
306
346
 
307
- // Lazy initialize ~standard to avoid creating objects for every schema
308
- util.defineLazy(inst, "~standard", () => ({
347
+ export function standardProps(inst: $ZodType): StandardSchemaV1.Props<any, any> {
348
+ return {
309
349
  validate: (value: unknown) => {
350
+ const ctx: ParseContextInternal = { async: false };
310
351
  try {
311
- const r = safeParse(inst, value);
312
- return r.success ? { value: r.data } : { issues: r.error?.issues };
313
- } catch (_) {
314
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
315
- }
352
+ const r = inst._zod.run({ value, issues: [] }, ctx);
353
+ if (!(r instanceof Promise)) return toStandardResult(r, ctx);
354
+ } catch (_) {}
355
+ // async function so a synchronously throwing check rejects instead of escaping validate
356
+ return validateAsync(inst, value);
316
357
  },
317
358
  vendor: "zod",
318
359
  version: 1 as const,
319
- }));
320
- });
360
+ };
361
+ }
321
362
 
322
363
  export { clone } from "./util.js";
323
364
 
@@ -347,6 +388,8 @@ export interface $ZodStringInternals<Input> extends $ZodTypeInternals<string, In
347
388
  patterns: Set<RegExp>;
348
389
  format: string;
349
390
  contentEncoding: string;
391
+ /** the pattern admits strings its `format` keyword forbids, so `toJSONSchema` must not emit it */
392
+ laxFormat: boolean;
350
393
  }>;
351
394
  }
352
395
 
@@ -356,7 +399,8 @@ export interface $ZodString<Input = unknown> extends _$ZodType<$ZodStringInterna
356
399
 
357
400
  export const $ZodString: core.$constructor<$ZodString> = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
358
401
  $ZodType.init(inst, def);
359
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
402
+ // a format's own pattern, else unbounded; a template literal derives the check-aware form itself
403
+ inst._zod.pattern = (def as $ZodStringFormatDef).pattern ?? regexes.anyString;
360
404
  inst._zod.parse = (payload, _) => {
361
405
  if (def.coerce)
362
406
  try {
@@ -477,70 +521,103 @@ export interface $ZodURL extends $ZodType {
477
521
  _zod: $ZodURLInternals;
478
522
  }
479
523
 
524
+ /** The `://` guard rejected the input before the URL constructor saw it. */
525
+ export const URL_BAD_FORMAT = 1;
526
+ /** The URL constructor rejected the input. */
527
+ export const URL_UNPARSEABLE = 2;
528
+
529
+ /** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
530
+ export function parseURLObject(
531
+ trimmed: string,
532
+ def: Pick<$ZodURLDef, "protocol" | "normalize">
533
+ ): URL | typeof URL_BAD_FORMAT | typeof URL_UNPARSEABLE {
534
+ // When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
535
+ if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
536
+ return URL_BAD_FORMAT;
537
+ }
538
+
539
+ try {
540
+ // @ts-ignore
541
+ return new URL(trimmed);
542
+ } catch {
543
+ return URL_UNPARSEABLE;
544
+ }
545
+ }
546
+
547
+ const asciiTabOrNewline = /[\t\n\r]/g;
548
+
549
+ /** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
550
+ export function stripTabAndNewline(value: string): string {
551
+ return value.replace(asciiTabOrNewline, "");
552
+ }
553
+
554
+ export function urlHostnameOk(url: URL, hostname: RegExp): boolean {
555
+ hostname.lastIndex = 0;
556
+ return hostname.test(url.hostname);
557
+ }
558
+
559
+ export function urlProtocolOk(url: URL, protocol: RegExp): boolean {
560
+ protocol.lastIndex = 0;
561
+ return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
562
+ }
563
+
480
564
  export const $ZodURL: core.$constructor<$ZodURL> = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
481
565
  $ZodStringFormat.init(inst, def);
482
566
  inst._zod.check = (payload) => {
483
567
  try {
484
568
  // Trim whitespace from input
485
569
  const trimmed = payload.value.trim();
570
+ const url = parseURLObject(trimmed, def);
486
571
 
487
- // When normalize is off, require :// for http/https URLs
488
- // This prevents strings like "http:example.com" or "https:/path" from being silently accepted
489
- if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {
490
- if (!/^https?:\/\//i.test(trimmed)) {
491
- payload.issues.push({
492
- code: "invalid_format",
493
- format: "url",
494
- note: "Invalid URL format",
495
- input: payload.value,
496
- inst,
497
- continue: !def.abort,
498
- });
499
- return;
500
- }
572
+ if (url === URL_BAD_FORMAT) {
573
+ payload.issues.push({
574
+ code: "invalid_format",
575
+ format: "url",
576
+ note: "Invalid URL format",
577
+ input: payload.value,
578
+ inst,
579
+ continue: !def.abort,
580
+ });
581
+ return;
501
582
  }
502
583
 
503
- // @ts-ignore
504
- const url = new URL(trimmed);
584
+ if (url === URL_UNPARSEABLE) {
585
+ payload.issues.push({
586
+ code: "invalid_format",
587
+ format: "url",
588
+ input: payload.value,
589
+ inst,
590
+ continue: !def.abort,
591
+ });
592
+ return;
593
+ }
505
594
 
506
- if (def.hostname) {
507
- def.hostname.lastIndex = 0;
508
- if (!def.hostname.test(url.hostname)) {
509
- payload.issues.push({
510
- code: "invalid_format",
511
- format: "url",
512
- note: "Invalid hostname",
513
- pattern: def.hostname.source,
514
- input: payload.value,
515
- inst,
516
- continue: !def.abort,
517
- });
518
- }
595
+ if (def.hostname && !urlHostnameOk(url, def.hostname)) {
596
+ payload.issues.push({
597
+ code: "invalid_format",
598
+ format: "url",
599
+ note: "Invalid hostname",
600
+ pattern: def.hostname.source,
601
+ input: payload.value,
602
+ inst,
603
+ continue: !def.abort,
604
+ });
519
605
  }
520
606
 
521
- if (def.protocol) {
522
- def.protocol.lastIndex = 0;
523
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
524
- payload.issues.push({
525
- code: "invalid_format",
526
- format: "url",
527
- note: "Invalid protocol",
528
- pattern: def.protocol.source,
529
- input: payload.value,
530
- inst,
531
- continue: !def.abort,
532
- });
533
- }
607
+ if (def.protocol && !urlProtocolOk(url, def.protocol)) {
608
+ payload.issues.push({
609
+ code: "invalid_format",
610
+ format: "url",
611
+ note: "Invalid protocol",
612
+ pattern: def.protocol.source,
613
+ input: payload.value,
614
+ inst,
615
+ continue: !def.abort,
616
+ });
534
617
  }
535
618
 
536
619
  // Set the output value based on normalize flag
537
- if (def.normalize) {
538
- // Use normalized URL
539
- payload.value = url.href;
540
- } else {
541
- // Preserve the original input (trimmed)
542
- payload.value = trimmed;
543
- }
620
+ payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
544
621
 
545
622
  return;
546
623
  } catch (_) {
@@ -574,8 +651,12 @@ export const $ZodEmoji: core.$constructor<$ZodEmoji> = /*@__PURE__*/ core.$const
574
651
 
575
652
  ////////////////////////////// ZodNanoID //////////////////////////////
576
653
 
577
- export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {}
578
- export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {}
654
+ export interface $ZodNanoIDDef extends $ZodStringFormatDef<"nanoid"> {
655
+ length?: number | undefined;
656
+ }
657
+ export interface $ZodNanoIDInternals extends $ZodStringFormatInternals<"nanoid"> {
658
+ def: $ZodNanoIDDef;
659
+ }
579
660
 
580
661
  export interface $ZodNanoID extends $ZodType {
581
662
  _zod: $ZodNanoIDInternals;
@@ -584,7 +665,9 @@ export interface $ZodNanoID extends $ZodType {
584
665
  export const $ZodNanoID: core.$constructor<$ZodNanoID> = /*@__PURE__*/ core.$constructor(
585
666
  "$ZodNanoID",
586
667
  (inst, def): void => {
587
- def.pattern ??= regexes.nanoid;
668
+ if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
669
+ throw new Error(`Invalid nanoid length: ${def.length}`);
670
+ def.pattern ??= def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length);
588
671
  $ZodStringFormat.init(inst, def);
589
672
  }
590
673
  );
@@ -782,8 +865,6 @@ export interface $ZodIPv4 extends $ZodType {
782
865
  export const $ZodIPv4: core.$constructor<$ZodIPv4> = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def): void => {
783
866
  def.pattern ??= regexes.ipv4;
784
867
  $ZodStringFormat.init(inst, def);
785
-
786
- inst._zod.bag.format = `ipv4`;
787
868
  });
788
869
 
789
870
  ////////////////////////////// ZodIPv6 //////////////////////////////
@@ -800,18 +881,26 @@ export interface $ZodIPv6 extends $ZodType {
800
881
  _zod: $ZodIPv6Internals;
801
882
  }
802
883
 
884
+ /** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
885
+ const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
886
+
887
+ export function isValidIPv6(value: string): boolean {
888
+ if (!ipv6Alphabet.test(value)) return false;
889
+ try {
890
+ // @ts-ignore
891
+ new URL(`http://[${value}]`);
892
+ return true;
893
+ } catch {
894
+ return false;
895
+ }
896
+ }
897
+
803
898
  export const $ZodIPv6: core.$constructor<$ZodIPv6> = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def): void => {
804
899
  def.pattern ??= regexes.ipv6;
805
900
  $ZodStringFormat.init(inst, def);
806
901
 
807
- inst._zod.bag.format = `ipv6`;
808
-
809
902
  inst._zod.check = (payload) => {
810
- try {
811
- // @ts-ignore
812
- new URL(`http://[${payload.value}]`);
813
- // return;
814
- } catch {
903
+ if (!isValidIPv6(payload.value)) {
815
904
  payload.issues.push({
816
905
  code: "invalid_format",
817
906
  format: "ipv6",
@@ -839,8 +928,6 @@ export interface $ZodMAC extends $ZodType {
839
928
  export const $ZodMAC: core.$constructor<$ZodMAC> = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def): void => {
840
929
  def.pattern ??= regexes.mac(def.delimiter);
841
930
  $ZodStringFormat.init(inst, def);
842
-
843
- inst._zod.bag.format = `mac`;
844
931
  });
845
932
 
846
933
  ////////////////////////////// ZodCIDRv4 //////////////////////////////
@@ -879,6 +966,17 @@ export interface $ZodCIDRv6 extends $ZodType {
879
966
  _zod: $ZodCIDRv6Internals;
880
967
  }
881
968
 
969
+ export function isValidCIDRv6(value: string): boolean {
970
+ const parts = value.split("/");
971
+ if (parts.length !== 2) return false;
972
+ const [address, prefix] = parts;
973
+ if (!prefix) return false;
974
+ const prefixNum = Number(prefix);
975
+ if (`${prefixNum}` !== prefix) return false;
976
+ if (prefixNum < 0 || prefixNum > 128) return false;
977
+ return isValidIPv6(address);
978
+ }
979
+
882
980
  export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$constructor(
883
981
  "$ZodCIDRv6",
884
982
  (inst, def): void => {
@@ -886,17 +984,7 @@ export const $ZodCIDRv6: core.$constructor<$ZodCIDRv6> = /*@__PURE__*/ core.$con
886
984
  $ZodStringFormat.init(inst, def);
887
985
 
888
986
  inst._zod.check = (payload) => {
889
- const parts = payload.value.split("/");
890
- try {
891
- if (parts.length !== 2) throw new Error();
892
- const [address, prefix] = parts;
893
- if (!prefix) throw new Error();
894
- const prefixNum = Number(prefix);
895
- if (`${prefixNum}` !== prefix) throw new Error();
896
- if (prefixNum < 0 || prefixNum > 128) throw new Error();
897
- // @ts-ignore
898
- new URL(`http://[${address}]`);
899
- } catch {
987
+ if (!isValidCIDRv6(payload.value)) {
900
988
  payload.issues.push({
901
989
  code: "invalid_format",
902
990
  format: "cidrv6",
@@ -931,14 +1019,15 @@ export interface $ZodBase64 extends $ZodType {
931
1019
  _zod: $ZodBase64Internals;
932
1020
  }
933
1021
 
1022
+ // lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
1023
+ export const base64Charset: RegExp = /^[0-9a-zA-Z+/]*={0,2}$/;
1024
+
934
1025
  export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$constructor(
935
1026
  "$ZodBase64",
936
1027
  (inst, def): void => {
937
- def.pattern ??= regexes.base64;
1028
+ def.pattern ??= base64Charset;
938
1029
  $ZodStringFormat.init(inst, def);
939
1030
 
940
- inst._zod.bag.contentEncoding = "base64";
941
-
942
1031
  inst._zod.check = (payload) => {
943
1032
  if (isValidBase64(payload.value)) return;
944
1033
 
@@ -953,9 +1042,12 @@ export const $ZodBase64: core.$constructor<$ZodBase64> = /*@__PURE__*/ core.$con
953
1042
  }
954
1043
  );
955
1044
 
956
- ////////////////////////////// ZodBase64 //////////////////////////////
1045
+ ////////////////////////////// ZodBase64URL //////////////////////////////
1046
+ // lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
1047
+ export const base64urlCharset: RegExp = /^[A-Za-z0-9_-]*$/;
1048
+
957
1049
  export function isValidBase64URL(data: string): boolean {
958
- if (!regexes.base64url.test(data)) return false;
1050
+ if (!base64urlCharset.test(data)) return false;
959
1051
  const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
960
1052
  const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
961
1053
  return isValidBase64(padded);
@@ -971,11 +1063,9 @@ export interface $ZodBase64URL extends $ZodType {
971
1063
  export const $ZodBase64URL: core.$constructor<$ZodBase64URL> = /*@__PURE__*/ core.$constructor(
972
1064
  "$ZodBase64URL",
973
1065
  (inst, def): void => {
974
- def.pattern ??= regexes.base64url;
1066
+ def.pattern ??= base64urlCharset;
975
1067
  $ZodStringFormat.init(inst, def);
976
1068
 
977
- inst._zod.bag.contentEncoding = "base64url";
978
-
979
1069
  inst._zod.check = (payload) => {
980
1070
  if (isValidBase64URL(payload.value)) return;
981
1071
 
@@ -1004,6 +1094,103 @@ export const $ZodE164: core.$constructor<$ZodE164> = /*@__PURE__*/ core.$constru
1004
1094
  $ZodStringFormat.init(inst, def);
1005
1095
  });
1006
1096
 
1097
+ ////////////////////////////// ZodCreditCard //////////////////////////////
1098
+
1099
+ const CC_SANITIZE = /[- ]/g;
1100
+
1101
+ /** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
1102
+ function isLuhnAlgo(digits: string): boolean {
1103
+ let length = digits.length;
1104
+ let bit = 1;
1105
+ let sum = 0;
1106
+ while (length) {
1107
+ const value = digits.charCodeAt(--length) - 48;
1108
+ bit ^= 1;
1109
+ sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value]! : value;
1110
+ }
1111
+ return sum % 10 === 0;
1112
+ }
1113
+
1114
+ export function isValidCreditCard(input: string): boolean {
1115
+ if (!regexes.creditCard.test(input)) return false;
1116
+ return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
1117
+ }
1118
+
1119
+ export interface $ZodCreditCardDef extends $ZodStringFormatDef<"credit_card"> {}
1120
+ export interface $ZodCreditCardInternals extends $ZodStringFormatInternals<"credit_card"> {
1121
+ def: $ZodCreditCardDef;
1122
+ }
1123
+
1124
+ export interface $ZodCreditCard extends $ZodType {
1125
+ _zod: $ZodCreditCardInternals;
1126
+ }
1127
+
1128
+ export const $ZodCreditCard: core.$constructor<$ZodCreditCard> = /*@__PURE__*/ core.$constructor(
1129
+ "$ZodCreditCard",
1130
+ (inst, def): void => {
1131
+ // Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.
1132
+ def.pattern ??= regexes.creditCard;
1133
+ $ZodStringFormat.init(inst, def);
1134
+ inst._zod.check = (payload) => {
1135
+ if (isValidCreditCard(payload.value)) return;
1136
+ payload.issues.push({
1137
+ code: "invalid_format",
1138
+ format: "credit_card",
1139
+ input: payload.value,
1140
+ inst,
1141
+ continue: !def.abort,
1142
+ });
1143
+ };
1144
+ }
1145
+ );
1146
+
1147
+ ////////////////////////////// ZodIBAN //////////////////////////////
1148
+
1149
+ // iso 7064 mod 97-10 checksum without BigInt
1150
+ function isIso7064Mod97(iban: string): boolean {
1151
+ let remainder = 0;
1152
+ const len = iban.length;
1153
+ for (let i = 4; i < len; i++) {
1154
+ const code = iban.charCodeAt(i);
1155
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
1156
+ }
1157
+ for (let i = 0; i < 4; i++) {
1158
+ const code = iban.charCodeAt(i);
1159
+ remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
1160
+ }
1161
+ return remainder === 1;
1162
+ }
1163
+
1164
+ export function isValidIBAN(input: string): boolean {
1165
+ if (!regexes.iban.test(input)) return false;
1166
+ return isIso7064Mod97(input);
1167
+ }
1168
+
1169
+ export interface $ZodIBANDef extends $ZodStringFormatDef<"iban"> {}
1170
+ export interface $ZodIBANInternals extends $ZodStringFormatInternals<"iban"> {
1171
+ def: $ZodIBANDef;
1172
+ }
1173
+
1174
+ export interface $ZodIBAN extends $ZodType {
1175
+ _zod: $ZodIBANInternals;
1176
+ }
1177
+
1178
+ export const $ZodIBAN: core.$constructor<$ZodIBAN> = /*@__PURE__*/ core.$constructor("$ZodIBAN", (inst, def): void => {
1179
+ // shape only — checksum is not expressible as a pattern
1180
+ def.pattern ??= regexes.iban;
1181
+ $ZodStringFormat.init(inst, def);
1182
+ inst._zod.check = (payload) => {
1183
+ if (isValidIBAN(payload.value)) return;
1184
+ payload.issues.push({
1185
+ code: "invalid_format",
1186
+ format: "iban",
1187
+ input: payload.value,
1188
+ inst,
1189
+ continue: !def.abort,
1190
+ });
1191
+ };
1192
+ });
1193
+
1007
1194
  ////////////////////////////// ZodJWT //////////////////////////////
1008
1195
 
1009
1196
  export function isValidJWT(token: string, algorithm: util.JWTAlgorithm | null = null): boolean {
@@ -1120,7 +1307,7 @@ export interface $ZodNumber<Input = unknown> extends $ZodType {
1120
1307
  export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
1121
1308
  $ZodType.init(inst, def);
1122
1309
 
1123
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
1310
+ inst._zod.pattern = regexes.number;
1124
1311
  inst._zod.parse = (payload, _ctx) => {
1125
1312
  if (def.coerce)
1126
1313
  try {
@@ -1136,7 +1323,7 @@ export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$con
1136
1323
  ? Number.isNaN(input)
1137
1324
  ? "NaN"
1138
1325
  : !Number.isFinite(input)
1139
- ? "Infinity"
1326
+ ? String(input)
1140
1327
  : undefined
1141
1328
  : undefined;
1142
1329
 
@@ -1155,15 +1342,19 @@ export const $ZodNumber: core.$constructor<$ZodNumber> = /*@__PURE__*/ core.$con
1155
1342
  ///////////////////////////////////////////////
1156
1343
  ////////// ZodNumberFormat //////////
1157
1344
  ///////////////////////////////////////////////
1158
- export interface $ZodNumberFormatDef extends $ZodNumberDef, checks.$ZodCheckNumberFormatDef {}
1159
-
1160
- export interface $ZodNumberFormatInternals extends $ZodNumberInternals<number>, checks.$ZodCheckNumberFormatInternals {
1161
- def: $ZodNumberFormatDef;
1345
+ export interface $ZodNumberFormatDef<Format extends $ZodNumberFormats = $ZodNumberFormats>
1346
+ extends $ZodNumberDef,
1347
+ checks.$ZodCheckNumberFormatDef<Format> {}
1348
+
1349
+ export interface $ZodNumberFormatInternals<Format extends $ZodNumberFormats = $ZodNumberFormats>
1350
+ extends $ZodNumberInternals<number>,
1351
+ checks.$ZodCheckNumberFormatInternals<Format> {
1352
+ def: $ZodNumberFormatDef<Format>;
1162
1353
  isst: errors.$ZodIssueInvalidType;
1163
1354
  }
1164
1355
 
1165
- export interface $ZodNumberFormat extends $ZodType {
1166
- _zod: $ZodNumberFormatInternals;
1356
+ export interface $ZodNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends $ZodType {
1357
+ _zod: $ZodNumberFormatInternals<Format>;
1167
1358
  }
1168
1359
 
1169
1360
  export const $ZodNumberFormat: core.$constructor<$ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
@@ -1278,16 +1469,20 @@ export const $ZodBigInt: core.$constructor<$ZodBigInt> = /*@__PURE__*/ core.$con
1278
1469
  ///////////////////////////////////////////////
1279
1470
  ////////// ZodBigIntFormat //////////
1280
1471
  ///////////////////////////////////////////////
1281
- export interface $ZodBigIntFormatDef extends $ZodBigIntDef, checks.$ZodCheckBigIntFormatDef {
1472
+ export interface $ZodBigIntFormatDef<Format extends $ZodBigIntFormats = $ZodBigIntFormats>
1473
+ extends $ZodBigIntDef,
1474
+ checks.$ZodCheckBigIntFormatDef<Format> {
1282
1475
  check: "bigint_format";
1283
1476
  }
1284
1477
 
1285
- export interface $ZodBigIntFormatInternals extends $ZodBigIntInternals<bigint>, checks.$ZodCheckBigIntFormatInternals {
1286
- def: $ZodBigIntFormatDef;
1478
+ export interface $ZodBigIntFormatInternals<Format extends $ZodBigIntFormats = $ZodBigIntFormats>
1479
+ extends $ZodBigIntInternals<bigint>,
1480
+ checks.$ZodCheckBigIntFormatInternals<Format> {
1481
+ def: $ZodBigIntFormatDef<Format>;
1287
1482
  }
1288
1483
 
1289
- export interface $ZodBigIntFormat extends $ZodType {
1290
- _zod: $ZodBigIntFormatInternals;
1484
+ export interface $ZodBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends $ZodType {
1485
+ _zod: $ZodBigIntFormatInternals<Format>;
1291
1486
  }
1292
1487
 
1293
1488
  export const $ZodBigIntFormat: core.$constructor<$ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
@@ -1637,6 +1832,9 @@ function handleArrayResult(result: ParsePayload<any>, final: ParsePayload<any[]>
1637
1832
  export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
1638
1833
  $ZodType.init(inst, def);
1639
1834
 
1835
+ const memo = core.globalConfig.memoizer;
1836
+ memo?.attach(inst);
1837
+
1640
1838
  inst._zod.parse = (payload, ctx) => {
1641
1839
  const input = payload.value;
1642
1840
 
@@ -1651,8 +1849,9 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1651
1849
  return payload;
1652
1850
  }
1653
1851
 
1654
- payload.value = Array(input.length);
1852
+ payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
1655
1853
  const proms: Promise<any>[] = [];
1854
+ const abortEarly = ctx?.abortEarly;
1656
1855
  for (let i = 0; i < input.length; i++) {
1657
1856
  const item = input[i];
1658
1857
  const result = def.element._zod.run(
@@ -1667,6 +1866,8 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1667
1866
  proms.push(result.then((result) => handleArrayResult(result, payload, i)));
1668
1867
  } else {
1669
1868
  handleArrayResult(result, payload, i);
1869
+ // the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
1870
+ if (abortEarly && result.issues.length !== 0 && util.aborted(result)) break;
1670
1871
  }
1671
1872
  }
1672
1873
 
@@ -1687,12 +1888,12 @@ export const $ZodArray: core.$constructor<$ZodArray> = /*@__PURE__*/ core.$const
1687
1888
  //////////////////////////////////////////
1688
1889
 
1689
1890
  type OptionalOutSchema = { _zod: { optout: "optional" } };
1690
- type OptionalInSchema = { _zod: { optin: "optional" } };
1891
+ type OptionalInSchema = { _zod: { optin: "optional" | "defaulted" } };
1691
1892
 
1692
1893
  export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1693
1894
  ? util.IsAny<T[keyof T]> extends true
1694
1895
  ? Record<string, unknown>
1695
- : Record<string, core.output<T[keyof T]>>
1896
+ : { [k in string]: core.output<T[keyof T]> }
1696
1897
  : keyof (T & Extra) extends never
1697
1898
  ? Record<string, never>
1698
1899
  : util.Prettify<
@@ -1736,7 +1937,7 @@ export type $InferObjectOutput<T extends $ZodLooseShape, Extra extends Record<st
1736
1937
  export type $InferObjectInput<T extends $ZodLooseShape, Extra extends Record<string, unknown>> = string extends keyof T
1737
1938
  ? util.IsAny<T[keyof T]> extends true
1738
1939
  ? Record<string, unknown>
1739
- : Record<string, core.input<T[keyof T]>>
1940
+ : { [k in string]: core.input<T[keyof T]> }
1740
1941
  : keyof (T & Extra) extends never
1741
1942
  ? Record<string, never>
1742
1943
  : util.Prettify<
@@ -1752,19 +1953,24 @@ function handlePropertyResult(
1752
1953
  final: ParsePayload,
1753
1954
  key: PropertyKey,
1754
1955
  input: any,
1755
- isOptionalIn: boolean,
1756
- isOptionalOut: boolean
1956
+ optin: "optional" | "defaulted" | undefined,
1957
+ optout: "optional" | undefined
1757
1958
  ) {
1758
1959
  const isPresent = key in input;
1960
+ const isOptionalOut = optout === "optional";
1961
+ // The middle rung means "absence permitted, nothing supplied in its place", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.
1962
+ if (!isPresent && isOptionalOut && optin === "optional") {
1963
+ return;
1964
+ }
1759
1965
  if (result.issues.length) {
1760
1966
  // For optional-in/out schemas, ignore errors on absent keys.
1761
- if (isOptionalIn && isOptionalOut && !isPresent) {
1967
+ if (optin !== undefined && isOptionalOut && !isPresent) {
1762
1968
  return;
1763
1969
  }
1764
1970
  final.issues.push(...util.prefixIssues(key, result.issues));
1765
1971
  }
1766
1972
 
1767
- if (!isPresent && !isOptionalIn) {
1973
+ if (!isPresent && optin === undefined) {
1768
1974
  if (!result.issues.length) {
1769
1975
  final.issues.push({
1770
1976
  code: "invalid_type",
@@ -1777,7 +1983,7 @@ function handlePropertyResult(
1777
1983
  }
1778
1984
 
1779
1985
  if (result.value === undefined) {
1780
- if (isPresent) {
1986
+ if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
1781
1987
  (final.value as any)[key] = undefined;
1782
1988
  }
1783
1989
  } else {
@@ -1835,18 +2041,27 @@ export interface $ZodObject<
1835
2041
  out Params extends $ZodObjectConfig = $ZodObjectConfig,
1836
2042
  > extends $ZodType<any, any, $ZodObjectInternals<Shape, Params>> {}
1837
2043
 
2044
+ // one shared instance; a fresh [] per schema cost 56 bytes retained
2045
+ const NO_SYMBOL_KEYS: symbol[] = [];
2046
+
1838
2047
  function normalizeDef(def: $ZodObjectDef) {
1839
2048
  const keys = Object.keys(def.shape);
1840
- for (const k of keys) {
1841
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1842
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
2049
+ const ownSymbols = Object.getOwnPropertySymbols(def.shape);
2050
+ const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
2051
+ // aliases `keys` when there are no symbols, so a string-only shape keeps one array
2052
+ const allKeys: (string | symbol)[] = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
2053
+ for (const k of allKeys) {
2054
+ if (!(def.shape as any)?.[k]?._zod?.traits?.has("$ZodType")) {
2055
+ throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
1843
2056
  }
1844
2057
  }
1845
2058
  const okeys = util.optionalKeys(def.shape);
1846
2059
 
1847
2060
  return {
1848
2061
  ...def,
1849
- keys,
2062
+ allKeys,
2063
+ symbolKeys,
2064
+ // string-only: handleCatchall matches it against `for...in`, which never yields a symbol
1850
2065
  keySet: new Set(keys),
1851
2066
  numKeys: keys.length,
1852
2067
  optionalKeys: new Set(okeys),
@@ -1857,21 +2072,31 @@ function handleCatchall(
1857
2072
  proms: Promise<any>[],
1858
2073
  input: any,
1859
2074
  payload: ParsePayload,
1860
- ctx: ParseContext,
2075
+ ctx: ParseContextInternal,
1861
2076
  def: ReturnType<typeof normalizeDef>,
1862
- inst: $ZodObject
2077
+ inst: $ZodObject,
2078
+ abortEarly: boolean
1863
2079
  ) {
1864
2080
  const unrecognized: string[] = [];
1865
2081
  const keySet = def.keySet;
1866
2082
  const _catchall = def.catchall!._zod;
1867
2083
  const t = _catchall.def.type;
1868
- const isOptionalIn = _catchall.optin === "optional";
1869
- const isOptionalOut = _catchall.optout === "optional";
2084
+ const optin = _catchall.optin;
2085
+ const optout = _catchall.optout;
2086
+ // starts at 0, not the current length: the shape phase already ran and may have aborted
2087
+ let seen = 0;
1870
2088
  for (const key in input) {
1871
- // skip __proto__ so it can't replace the result prototype via the
1872
- // assignment setter on the plain {} we build into
1873
- if (key === "__proto__") continue;
2089
+ if (abortEarly && payload.issues.length !== seen) {
2090
+ if (util.aborted(payload, seen)) break;
2091
+ seen = payload.issues.length;
2092
+ }
2093
+ // Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
1874
2094
  if (keySet.has(key)) continue;
2095
+ // Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.
2096
+ if (key === "__proto__") {
2097
+ if (t === "never") unrecognized.push(key);
2098
+ continue;
2099
+ }
1875
2100
  if (t === "never") {
1876
2101
  unrecognized.push(key);
1877
2102
  continue;
@@ -1879,9 +2104,9 @@ function handleCatchall(
1879
2104
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1880
2105
 
1881
2106
  if (r instanceof Promise) {
1882
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
2107
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1883
2108
  } else {
1884
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2109
+ handlePropertyResult(r, payload, key, input, optin, optout);
1885
2110
  }
1886
2111
  }
1887
2112
 
@@ -1891,6 +2116,8 @@ function handleCatchall(
1891
2116
  keys: unrecognized,
1892
2117
  input,
1893
2118
  inst,
2119
+ // Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
2120
+ continue: true,
1894
2121
  });
1895
2122
  }
1896
2123
 
@@ -1903,32 +2130,35 @@ function handleCatchall(
1903
2130
  export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
1904
2131
  // requires cast because technically $ZodObject doesn't extend
1905
2132
  $ZodType.init(inst, def);
1906
- // const sh = def.shape;
1907
2133
  const desc = Object.getOwnPropertyDescriptor(def, "shape");
1908
- if (!desc?.get) {
1909
- const sh = def.shape;
1910
- Object.defineProperty(def, "shape", {
1911
- get: () => {
1912
- const newSh = { ...sh };
1913
- Object.defineProperty(def, "shape", {
1914
- value: newSh,
1915
- });
1916
-
1917
- return newSh;
1918
- },
1919
- });
2134
+ // a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
2135
+ const sh = desc?.get ? (desc.get as util.ShapeGetter).raw : (def.shape ?? {});
2136
+ if (sh) {
2137
+ // Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
2138
+ const get: util.ShapeGetter = () => {
2139
+ const newSh = { ...sh };
2140
+ Object.defineProperty(def, "shape", { value: newSh });
2141
+ get.raw = newSh;
2142
+ return newSh;
2143
+ };
2144
+ get.raw = sh;
2145
+ Object.defineProperty(def, "shape", { get });
1920
2146
  }
1921
2147
 
1922
2148
  const _normalized = util.cached(() => normalizeDef(def));
1923
2149
 
1924
- util.defineLazy(inst._zod, "propValues", () => {
1925
- const shape = def.shape;
2150
+ util.defineLazyInternal(inst, "propValues", (zod) => {
2151
+ const shape = zod.def.shape;
1926
2152
  const propValues: util.PropValues = {};
1927
2153
  for (const key in shape) {
1928
2154
  const field = shape[key]!._zod;
1929
2155
  if (field.values) {
1930
- propValues[key] ??= new Set();
2156
+ if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
2157
+ util.assignProp(propValues, key, new Set());
2158
+ }
1931
2159
  for (const v of field.values) propValues[key].add(v);
2160
+ // An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.
2161
+ if (field.optin !== undefined) propValues[key].add(undefined);
1932
2162
  }
1933
2163
  }
1934
2164
  return propValues;
@@ -1938,6 +2168,8 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1938
2168
  const catchall = def.catchall;
1939
2169
 
1940
2170
  let value!: typeof _normalized.value;
2171
+ const memo = core.globalConfig.memoizer;
2172
+ memo?.attach(inst);
1941
2173
 
1942
2174
  inst._zod.parse = (payload, ctx) => {
1943
2175
  value ??= _normalized.value;
@@ -1952,21 +2184,28 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1952
2184
  return payload;
1953
2185
  }
1954
2186
 
1955
- payload.value = {};
2187
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
1956
2188
 
1957
2189
  const proms: Promise<any>[] = [];
1958
2190
  const shape = value.shape;
2191
+ const abortEarly = ctx?.abortEarly;
2192
+ let seen = payload.issues.length;
1959
2193
 
1960
- for (const key of value.keys) {
1961
- const el = shape[key]!;
1962
- const isOptionalIn = el._zod.optin === "optional";
1963
- const isOptionalOut = el._zod.optout === "optional";
2194
+ for (const key of value.allKeys) {
2195
+ if (abortEarly && payload.issues.length !== seen) {
2196
+ if (util.aborted(payload, seen)) break;
2197
+ seen = payload.issues.length;
2198
+ }
2199
+ if (key === "__proto__") continue;
2200
+ const el = (shape as any)[key]!;
2201
+ const optin = el._zod.optin;
2202
+ const optout = el._zod.optout;
1964
2203
 
1965
2204
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1966
2205
  if (r instanceof Promise) {
1967
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
2206
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
1968
2207
  } else {
1969
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
2208
+ handlePropertyResult(r, payload, key, input, optin, optout);
1970
2209
  }
1971
2210
  }
1972
2211
 
@@ -1974,7 +2213,7 @@ export const $ZodObject: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$con
1974
2213
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
1975
2214
  }
1976
2215
 
1977
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
2216
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
1978
2217
  };
1979
2218
  });
1980
2219
 
@@ -1987,63 +2226,71 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
1987
2226
  const superParse = inst._zod.parse;
1988
2227
  const _normalized = util.cached(() => normalizeDef(def));
1989
2228
 
2229
+ const memo = core.globalConfig.memoizer;
2230
+
1990
2231
  const generateFastpass = (shape: any) => {
1991
- const doc = new Doc(["shape", "payload", "ctx"]);
1992
2232
  const normalized = _normalized.value;
1993
-
1994
- const parseStr = (key: string) => {
1995
- const k = util.esc(key);
1996
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1997
- };
2233
+ const syms = normalized.symbolKeys;
2234
+ // a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
2235
+ const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
2236
+
2237
+ const parseStr = (k: string) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
2238
+
2239
+ // prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
2240
+ const prefixStr = (id: string, k: string) => `
2241
+ let ${id}_ab = false;
2242
+ for (let i = 0; i < ${id}.issues.length; i++) {
2243
+ const iss = ${id}.issues[i];
2244
+ iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
2245
+ payload.issues.push(iss);
2246
+ if (iss.continue !== true) ${id}_ab = true;
2247
+ }
2248
+ if (${id}_ab && ctx && ctx.abortEarly) {
2249
+ payload.value = newResult;
2250
+ return payload;
2251
+ }`;
1998
2252
 
1999
2253
  doc.write(`const input = payload.value;`);
2000
2254
 
2001
2255
  const ids: any = Object.create(null);
2002
2256
  let counter = 0;
2003
- for (const key of normalized.keys) {
2257
+ for (const key of normalized.allKeys) {
2004
2258
  ids[key] = `key_${counter++}`;
2005
2259
  }
2006
2260
 
2007
2261
  // A: preserve key order {
2008
- doc.write(`const newResult = {};`);
2009
- for (const key of normalized.keys) {
2262
+ doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
2263
+ for (const key of normalized.allKeys) {
2264
+ if (key === "__proto__") continue;
2010
2265
  const id = ids[key];
2011
- const k = util.esc(key);
2266
+ const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
2267
+ const isPresent = `${k} in input`;
2012
2268
  const schema = shape[key];
2013
- const isOptionalIn = schema?._zod?.optin === "optional";
2269
+ const optin = schema?._zod?.optin;
2270
+ const isOptionalIn = optin !== undefined;
2014
2271
  const isOptionalOut = schema?._zod?.optout === "optional";
2015
2272
 
2016
- doc.write(`const ${id} = ${parseStr(key)};`);
2273
+ doc.write(`const ${id} = ${parseStr(k)};`);
2017
2274
 
2018
2275
  if (isOptionalIn && isOptionalOut) {
2019
- // For optional-in/out schemas, ignore errors on absent keys
2276
+ // For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.
2277
+ const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
2020
2278
  doc.write(`
2021
- if (${id}.issues.length) {
2022
- if (${k} in input) {
2023
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2024
- ...iss,
2025
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2026
- })));
2279
+ const ${id}_present = ${isPresent};
2280
+ if (!${id}.issues.length || ${id}_present) {
2281
+ if (${id}.issues.length) {${prefixStr(id, k)}
2027
2282
  }
2028
- }
2029
-
2030
- if (${id}.value === undefined) {
2031
- if (${k} in input) {
2032
- newResult[${k}] = undefined;
2283
+
2284
+ if (${assign}) {
2285
+ newResult[${k}] = ${id}.value;
2033
2286
  }
2034
- } else {
2035
- newResult[${k}] = ${id}.value;
2036
2287
  }
2037
-
2288
+
2038
2289
  `);
2039
2290
  } else if (!isOptionalIn) {
2040
2291
  doc.write(`
2041
- const ${id}_present = ${k} in input;
2042
- if (${id}.issues.length) {
2043
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2044
- ...iss,
2045
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2046
- })));
2292
+ const ${id}_present = ${isPresent};
2293
+ if (${id}.issues.length) {${prefixStr(id, k)}
2047
2294
  }
2048
2295
  if (!${id}_present && !${id}.issues.length) {
2049
2296
  payload.issues.push({
@@ -2052,42 +2299,38 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
2052
2299
  input: undefined,
2053
2300
  path: [${k}]
2054
2301
  });
2302
+ if (ctx && ctx.abortEarly) {
2303
+ payload.value = newResult;
2304
+ return payload;
2305
+ }
2055
2306
  }
2056
2307
 
2057
2308
  if (${id}_present) {
2058
- if (${id}.value === undefined) {
2059
- newResult[${k}] = undefined;
2060
- } else {
2061
- newResult[${k}] = ${id}.value;
2062
- }
2309
+ newResult[${k}] = ${id}.value;
2063
2310
  }
2064
2311
 
2065
2312
  `);
2066
2313
  } else {
2067
2314
  doc.write(`
2068
- if (${id}.issues.length) {
2069
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2070
- ...iss,
2071
- path: iss.path ? [${k}, ...iss.path] : [${k}]
2072
- })));
2315
+ if (${id}.issues.length) {${prefixStr(id, k)}
2073
2316
  }
2074
-
2075
- if (${id}.value === undefined) {
2076
- if (${k} in input) {
2077
- newResult[${k}] = undefined;
2078
- }
2079
- } else {
2317
+ `);
2318
+ if (optin === "defaulted") {
2319
+ doc.write(`newResult[${k}] = ${id}.value;`);
2320
+ } else {
2321
+ doc.write(`
2322
+ if (${id}.value !== undefined || ${isPresent}) {
2080
2323
  newResult[${k}] = ${id}.value;
2081
2324
  }
2082
-
2083
2325
  `);
2326
+ }
2084
2327
  }
2085
2328
  }
2086
2329
 
2087
2330
  doc.write(`payload.value = newResult;`);
2088
2331
  doc.write(`return payload;`);
2089
- const fn = doc.compile();
2090
- return (payload: any, ctx: any) => fn(shape, payload, ctx);
2332
+ // closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone
2333
+ return doc.compile() as (payload: any, ctx: any) => any;
2091
2334
  };
2092
2335
 
2093
2336
  let fastpass!: ReturnType<typeof generateFastpass>;
@@ -2120,7 +2363,7 @@ export const $ZodObjectJIT: core.$constructor<$ZodObject> = /*@__PURE__*/ core.$
2120
2363
  payload = fastpass(payload, ctx);
2121
2364
 
2122
2365
  if (!catchall) return payload;
2123
- return handleCatchall([], input, payload, ctx, value, inst);
2366
+ return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
2124
2367
  }
2125
2368
 
2126
2369
  return superParse(payload, ctx);
@@ -2155,7 +2398,7 @@ export interface $ZodUnionInternals<T extends readonly SomeType[] = readonly $Zo
2155
2398
  output: $InferUnionOutput<T[number]>;
2156
2399
  input: $InferUnionInput<T[number]>;
2157
2400
  // if any element in the union is optional, then the union is optional
2158
- optin: IsOptionalIn<T[number]> extends false ? "optional" | undefined : "optional";
2401
+ optin: IsOptionalIn<T[number]> extends false ? "optional" | "defaulted" | undefined : "optional" | "defaulted";
2159
2402
  optout: IsOptionalOut<T[number]> extends false ? "optional" | undefined : "optional";
2160
2403
  }
2161
2404
 
@@ -2192,24 +2435,28 @@ function handleUnionResults(results: ParsePayload[], final: ParsePayload, inst:
2192
2435
  export const $ZodUnion: core.$constructor<$ZodUnion> = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
2193
2436
  $ZodType.init(inst, def);
2194
2437
 
2195
- util.defineLazy(inst._zod, "optin", () =>
2196
- def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined
2438
+ util.defineLazyInternal(inst, "optin", (zod) =>
2439
+ zod.def.options.some((o) => o._zod.optin === "defaulted")
2440
+ ? "defaulted"
2441
+ : zod.def.options.some((o) => o._zod.optin !== undefined)
2442
+ ? "optional"
2443
+ : undefined
2197
2444
  );
2198
2445
 
2199
- util.defineLazy(inst._zod, "optout", () =>
2200
- def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
2446
+ util.defineLazyInternal(inst, "optout", (zod) =>
2447
+ zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined
2201
2448
  );
2202
2449
 
2203
- util.defineLazy(inst._zod, "values", () => {
2204
- if (def.options.every((o) => o._zod.values)) {
2205
- return new Set<util.Primitive>(def.options.flatMap((option) => Array.from(option._zod.values!)));
2450
+ util.defineLazyInternal(inst, "values", (zod) => {
2451
+ if (zod.def.options.every((o) => o._zod.values)) {
2452
+ return new Set<util.Primitive>(zod.def.options.flatMap((option) => Array.from(option._zod.values!)));
2206
2453
  }
2207
2454
  return undefined;
2208
2455
  });
2209
2456
 
2210
- util.defineLazy(inst._zod, "pattern", () => {
2211
- if (def.options.every((o) => o._zod.pattern)) {
2212
- const patterns = def.options.map((o) => o._zod.pattern);
2457
+ util.defineLazyInternal(inst, "pattern", (zod) => {
2458
+ if (zod.def.options.every((o) => o._zod.pattern)) {
2459
+ const patterns = zod.def.options.map((o) => o._zod.pattern);
2213
2460
  return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p!.source)).join("|")})$`);
2214
2461
  }
2215
2462
  return undefined;
@@ -2254,14 +2501,17 @@ function handleExclusiveUnionResults(
2254
2501
  inst: $ZodUnion,
2255
2502
  ctx?: ParseContext
2256
2503
  ) {
2257
- const successes = results.filter((r) => r.issues.length === 0);
2504
+ const matches: number[] = [];
2505
+ for (let i = 0; i < results.length; i++) {
2506
+ if (results[i].issues.length === 0) matches.push(i);
2507
+ }
2258
2508
 
2259
- if (successes.length === 1) {
2260
- final.value = successes[0].value;
2509
+ if (matches.length === 1) {
2510
+ final.value = results[matches[0]].value;
2261
2511
  return final;
2262
2512
  }
2263
2513
 
2264
- if (successes.length === 0) {
2514
+ if (matches.length === 0) {
2265
2515
  // No matches - same as regular union
2266
2516
  final.issues.push({
2267
2517
  code: "invalid_union",
@@ -2277,6 +2527,7 @@ function handleExclusiveUnionResults(
2277
2527
  inst,
2278
2528
  errors: [],
2279
2529
  inclusive: false,
2530
+ matches,
2280
2531
  });
2281
2532
  }
2282
2533
 
@@ -2348,6 +2599,65 @@ export interface $ZodDiscriminatedUnionInternals<
2348
2599
  > extends $ZodUnionInternals<Options> {
2349
2600
  def: $ZodDiscriminatedUnionDef<Options, Disc>;
2350
2601
  propValues: util.PropValues;
2602
+ bag: util.LoosePartial<{
2603
+ optionsMap: Map<util.Primitive, $ZodType | null>;
2604
+ }>;
2605
+ }
2606
+
2607
+ /** The discriminator values a member of `Options` can declare. An omittable discriminator contributes `undefined`, matching what `propValues` claims for it. */
2608
+ export type $DiscriminatorValue<Options extends readonly SomeType[], Disc extends string> = {
2609
+ [I in keyof Options]: Options[I] extends { _zod: { output: infer Out } }
2610
+ ? Disc extends keyof Out
2611
+ ? Out[Disc]
2612
+ : never
2613
+ : never;
2614
+ }[number];
2615
+
2616
+ /** The member of `Options` that declares `V`. */
2617
+ export type $DiscriminatedOption<Options extends readonly SomeType[], Disc extends string, V> = {
2618
+ [I in keyof Options]: Options[I] extends { _zod: { output: infer Out } }
2619
+ ? Disc extends keyof Out
2620
+ ? V extends Out[Disc]
2621
+ ? Options[I]
2622
+ : never
2623
+ : never
2624
+ : never;
2625
+ }[number];
2626
+
2627
+ /** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
2628
+ export function getDiscriminatedOption<
2629
+ Options extends readonly SomeType[],
2630
+ Disc extends string,
2631
+ const V extends $DiscriminatorValue<Options, Disc>,
2632
+ >(union: $ZodDiscriminatedUnion<Options, Disc>, value: V): $DiscriminatedOption<Options, Disc, V> {
2633
+ const internals = union._zod;
2634
+ let map = internals.bag.optionsMap;
2635
+ if (!map) {
2636
+ map = discriminatorMap(internals.def);
2637
+ internals.bag.optionsMap = map;
2638
+ }
2639
+ const option = map.get(value as util.Primitive);
2640
+ if (option === null) throw new Error(`Ambiguous discriminator value "${String(value)}"`);
2641
+ return option as any;
2642
+ }
2643
+
2644
+ function discriminatorMap(def: $ZodDiscriminatedUnionDef<readonly SomeType[]>): Map<util.Primitive, $ZodType | null> {
2645
+ const map = new Map<util.Primitive, $ZodType | null>();
2646
+ for (const option of def.options as readonly $ZodType[]) {
2647
+ const values = option._zod.propValues?.[def.discriminator];
2648
+ if (!values || values.size === 0)
2649
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2650
+ for (const value of values) {
2651
+ if (map.has(value)) {
2652
+ if (value !== undefined) throw new Error(`Duplicate discriminator value "${String(value)}"`);
2653
+ // keep the collision marked so a later member cannot reclaim it
2654
+ map.set(value, null);
2655
+ } else {
2656
+ map.set(value, option);
2657
+ }
2658
+ }
2659
+ }
2660
+ return map;
2351
2661
  }
2352
2662
 
2353
2663
  export interface $ZodDiscriminatedUnion<
@@ -2365,39 +2675,37 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2365
2675
  $ZodUnion.init(inst, def);
2366
2676
 
2367
2677
  const _super = inst._zod.parse;
2368
- util.defineLazy(inst._zod, "propValues", () => {
2678
+ util.defineLazyInternal(inst, "propValues", (zod) => {
2369
2679
  const propValues: util.PropValues = {};
2370
- for (const option of def.options) {
2680
+ let undefinedCount = 0;
2681
+ for (const option of zod.def.options) {
2371
2682
  const pv = option._zod.propValues;
2372
2683
  if (!pv || Object.keys(pv).length === 0)
2373
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
2684
+ throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
2685
+ if (pv[zod.def.discriminator]?.has(undefined)) undefinedCount++;
2374
2686
  for (const [k, v] of Object.entries(pv!)) {
2375
- if (!propValues[k]) propValues[k] = new Set();
2687
+ if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
2688
+ util.assignProp(propValues, k, new Set());
2689
+ }
2376
2690
  for (const val of v) {
2377
2691
  propValues[k].add(val);
2378
2692
  }
2379
2693
  }
2380
2694
  }
2695
+ if (!zod.def.unionFallback && undefinedCount > 1) propValues[zod.def.discriminator]?.delete(undefined);
2381
2696
  return propValues;
2382
2697
  });
2383
2698
 
2384
- const disc = util.cached(() => {
2385
- const opts = def.options as $ZodTypeDiscriminable[];
2386
- const map: Map<util.Primitive, $ZodType> = new Map();
2387
- for (const o of opts) {
2388
- const values = o._zod.propValues?.[def.discriminator];
2389
- if (!values || values.size === 0)
2390
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
2391
- for (const v of values) {
2392
- if (map.has(v)) {
2393
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
2394
- }
2395
- map.set(v, o);
2396
- }
2699
+ // Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
2700
+ def.options.forEach((option, i) => {
2701
+ const propShape = util.rawShape(option._zod.def);
2702
+ if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
2703
+ throw new Error(`Invalid discriminated union option at index "${i}"`);
2397
2704
  }
2398
- return map;
2399
2705
  });
2400
2706
 
2707
+ const disc = util.cached(() => discriminatorMap(def));
2708
+
2401
2709
  inst._zod.parse = (payload, ctx) => {
2402
2710
  const input = payload.value;
2403
2711
  if (!util.isObject(input)) {
@@ -2411,15 +2719,16 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2411
2719
  return payload;
2412
2720
  }
2413
2721
 
2414
- const opt = disc.value.get(input?.[def.discriminator] as any);
2415
- if (opt) {
2722
+ const value = input?.[def.discriminator];
2723
+ const opt = disc.value.get(value as util.Primitive);
2724
+ // forward metadata cannot choose an encoder for an absent tag
2725
+ if (opt && (value !== undefined || ctx.direction !== "backward")) {
2416
2726
  return opt._zod.run(payload, ctx) as any;
2417
2727
  }
2418
2728
 
2419
2729
  // Fall back to union matching when the fast discriminator path fails:
2420
2730
  // - explicitly enabled via unionFallback, or
2421
- // - during backward direction (encode), since codec-based discriminators
2422
- // have different values in forward vs backward directions
2731
+ // - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
2423
2732
  if (def.unionFallback || ctx.direction === "backward") {
2424
2733
  return _super(payload, ctx);
2425
2734
  }
@@ -2430,7 +2739,7 @@ export const $ZodDiscriminatedUnion: core.$constructor<$ZodDiscriminatedUnion> =
2430
2739
  errors: [],
2431
2740
  note: "No matching discriminator",
2432
2741
  discriminator: def.discriminator,
2433
- options: Array.from(disc.value.keys()),
2742
+ options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
2434
2743
  input,
2435
2744
  path: [def.discriminator],
2436
2745
  inst,
@@ -2492,7 +2801,7 @@ export const $ZodIntersection: core.$constructor<$ZodIntersection> = /*@__PURE__
2492
2801
  }
2493
2802
  );
2494
2803
 
2495
- function mergeValues(
2804
+ export function mergeValues(
2496
2805
  a: any,
2497
2806
  b: any
2498
2807
  ): { valid: true; data: any } | { valid: false; mergeErrorPath: (string | number)[] } {
@@ -2510,7 +2819,9 @@ function mergeValues(
2510
2819
  const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
2511
2820
 
2512
2821
  const newObj: any = { ...a, ...b };
2822
+ if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
2513
2823
  for (const key of sharedKeys) {
2824
+ if (key === "__proto__") continue;
2514
2825
  const sharedValue = mergeValues(a[key], b[key]);
2515
2826
  if (!sharedValue.valid) {
2516
2827
  return {
@@ -2551,44 +2862,52 @@ function mergeValues(
2551
2862
  }
2552
2863
 
2553
2864
  function handleIntersectionResults(result: ParsePayload, left: ParsePayload, right: ParsePayload): ParsePayload {
2554
- // Track which side(s) report each key as unrecognized
2865
+ // Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.
2555
2866
  const unrecKeys = new Map<string, { l?: true; r?: true }>();
2556
2867
  let unrecIssue: errors.$ZodRawIssue | undefined;
2868
+ const keyIssues = new Map<string, errors.$ZodRawIssue>();
2557
2869
 
2558
- for (const iss of left.issues) {
2559
- if (iss.code === "unrecognized_keys") {
2870
+ const collect = (iss: errors.$ZodRawIssue, side: "l" | "r"): boolean => {
2871
+ let keys: string[];
2872
+ if (iss.code === "unrecognized_keys" && !iss.path?.length) {
2560
2873
  unrecIssue ??= iss;
2561
- for (const k of iss.keys) {
2562
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2563
- unrecKeys.get(k)!.l = true;
2564
- }
2874
+ keys = iss.keys as string[];
2875
+ } else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
2876
+ const k = String(iss.path[0]);
2877
+ if (!keyIssues.has(k)) keyIssues.set(k, iss);
2878
+ keys = [k];
2565
2879
  } else {
2566
- result.issues.push(iss);
2880
+ return false;
2881
+ }
2882
+ for (const k of keys) {
2883
+ if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2884
+ unrecKeys.get(k)![side] = true;
2567
2885
  }
2886
+ return true;
2887
+ };
2888
+
2889
+ for (const iss of left.issues) {
2890
+ if (!collect(iss, "l")) result.issues.push(iss);
2568
2891
  }
2569
2892
 
2570
2893
  for (const iss of right.issues) {
2571
- if (iss.code === "unrecognized_keys") {
2572
- for (const k of iss.keys) {
2573
- if (!unrecKeys.has(k)) unrecKeys.set(k, {});
2574
- unrecKeys.get(k)!.r = true;
2575
- }
2576
- } else {
2577
- result.issues.push(iss);
2578
- }
2894
+ if (!collect(iss, "r")) result.issues.push(iss);
2579
2895
  }
2580
2896
 
2581
- // Report only keys unrecognized by BOTH sides
2897
+ // Report only keys rejected by BOTH sides
2582
2898
  const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
2583
- if (bothKeys.length && unrecIssue) {
2584
- result.issues.push({ ...unrecIssue, keys: bothKeys });
2899
+ if (bothKeys.length) {
2900
+ const aggregated = unrecIssue ? bothKeys.filter((k) => (unrecIssue!.keys as string[]).includes(k)) : [];
2901
+ if (aggregated.length) result.issues.push({ ...unrecIssue!, keys: aggregated });
2902
+ for (const k of bothKeys) {
2903
+ if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k)!);
2904
+ }
2585
2905
  }
2586
2906
 
2587
- if (util.aborted(result)) return result;
2588
-
2589
2907
  const merged = mergeValues(left.value, right.value);
2590
2908
 
2591
2909
  if (!merged.valid) {
2910
+ if (util.aborted(result)) return result;
2592
2911
  throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
2593
2912
  }
2594
2913
 
@@ -2624,7 +2943,7 @@ type TupleInputTypeWithOptionals<T extends util.TupleItems> = T extends readonly
2624
2943
  ...infer Prefix extends SomeType[],
2625
2944
  infer Tail extends SomeType,
2626
2945
  ]
2627
- ? Tail["_zod"]["optin"] extends "optional"
2946
+ ? Tail["_zod"]["optin"] extends "optional" | "defaulted"
2628
2947
  ? [...TupleInputTypeWithOptionals<Prefix>, core.input<Tail>?]
2629
2948
  : TupleInputTypeNoOptionals<T>
2630
2949
  : [];
@@ -2666,6 +2985,8 @@ export interface $ZodTuple<
2666
2985
  export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
2667
2986
  $ZodType.init(inst, def);
2668
2987
  const items = def.items;
2988
+ const memo = core.globalConfig.memoizer;
2989
+ memo?.attach(inst);
2669
2990
 
2670
2991
  inst._zod.parse = (payload, ctx) => {
2671
2992
  const input = payload.value;
@@ -2679,7 +3000,7 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2679
3000
  return payload;
2680
3001
  }
2681
3002
 
2682
- payload.value = [];
3003
+ payload.value = memo ? memo.alloc(inst, payload, [] as unknown[], ctx) : [];
2683
3004
  const proms: Promise<any>[] = [];
2684
3005
 
2685
3006
  const optinStart = getTupleOptStart(items, "optin");
@@ -2709,11 +3030,11 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2709
3030
  }
2710
3031
  }
2711
3032
 
2712
- // Run every item in parallel, collecting results into an indexed
2713
- // array. The post-processing in `handleTupleResults` walks them in
2714
- // order so it can decide whether an absent optional-output error can
2715
- // truncate the tail or must be reported to preserve required output.
3033
+ // Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
2716
3034
  const itemResults: ParsePayload[] = new Array(items.length);
3035
+ // only tracked when there is a rest loop to skip
3036
+ const abortEarly = def.rest ? ctx?.abortEarly : undefined;
3037
+ let itemAborted = false;
2717
3038
  for (let i = 0; i < items.length; i++) {
2718
3039
  const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
2719
3040
  if (r instanceof Promise) {
@@ -2724,13 +3045,20 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2724
3045
  );
2725
3046
  } else {
2726
3047
  itemResults[i] = r;
3048
+ if (abortEarly && !itemAborted && r.issues.length) itemAborted = util.aborted(r);
2727
3049
  }
2728
3050
  }
2729
3051
 
2730
- if (def.rest) {
3052
+ // sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
3053
+ if (def.rest && !itemAborted) {
2731
3054
  let i = items.length - 1;
2732
3055
  const rest = input.slice(items.length);
3056
+ let seen = payload.issues.length;
2733
3057
  for (const el of rest) {
3058
+ if (abortEarly && payload.issues.length !== seen) {
3059
+ if (util.aborted(payload, seen)) break;
3060
+ seen = payload.issues.length;
3061
+ }
2734
3062
  i++;
2735
3063
  const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
2736
3064
  if (result instanceof Promise) {
@@ -2750,7 +3078,9 @@ export const $ZodTuple: core.$constructor<$ZodTuple> = /*@__PURE__*/ core.$const
2750
3078
 
2751
3079
  function getTupleOptStart(items: readonly $ZodType[], key: "optin" | "optout") {
2752
3080
  for (let i = items.length - 1; i >= 0; i--) {
2753
- if (items[i]._zod[key] !== "optional") return i + 1;
3081
+ // optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
3082
+ const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
3083
+ if (!omittable) return i + 1;
2754
3084
  }
2755
3085
  return 0;
2756
3086
  }
@@ -2769,12 +3099,15 @@ function handleTupleResults(
2769
3099
  input: unknown[],
2770
3100
  optoutStart: number
2771
3101
  ) {
2772
- // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
2773
- // rule, but only after `optoutStart`: the first index where the output
2774
- // tuple tail can be absent.
3102
+ // Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.
2775
3103
  for (let i = 0; i < items.length; i++) {
2776
3104
  const r = itemResults[i];
2777
3105
  const isPresent = i < input.length;
3106
+ // The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.
3107
+ if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
3108
+ final.value.length = i;
3109
+ break;
3110
+ }
2778
3111
  if (r.issues.length) {
2779
3112
  if (!isPresent && i >= optoutStart) {
2780
3113
  final.value.length = i;
@@ -2817,6 +3150,7 @@ export interface $ZodRecordDef<Key extends $ZodRecordKey = $ZodRecordKey, Value
2817
3150
  valueType: Value;
2818
3151
  /** @default "strict" - errors on keys not matching keyType. "loose" passes through non-matching keys unchanged. */
2819
3152
  mode?: "strict" | "loose";
3153
+ partial?: boolean;
2820
3154
  }
2821
3155
 
2822
3156
  // export type $InferZodRecordOutput<
@@ -2856,7 +3190,10 @@ export type $InferZodRecordInput<
2856
3190
  Value extends SomeType = $ZodType,
2857
3191
  > = Key extends $partial
2858
3192
  ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>>
2859
- : Record<core.input<Key> & PropertyKey, core.input<Value>>;
3193
+ : // A value schema that accepts an absent slot makes the key omittable on the way in, exactly as it does in an object shape. The output side keeps every key, since the parser fills each one.
3194
+ [Value] extends [OptionalInSchema]
3195
+ ? Partial<Record<core.input<Key> & PropertyKey, core.input<Value>>>
3196
+ : Record<core.input<Key> & PropertyKey, core.input<Value>>;
2860
3197
 
2861
3198
  export interface $ZodRecordInternals<Key extends $ZodRecordKey = $ZodRecordKey, Value extends SomeType = $ZodType>
2862
3199
  extends $ZodTypeInternals<$InferZodRecordOutput<Key, Value>, $InferZodRecordInput<Key, Value>> {
@@ -2874,6 +3211,8 @@ export interface $ZodRecord<Key extends $ZodRecordKey = $ZodRecordKey, Value ext
2874
3211
 
2875
3212
  export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
2876
3213
  $ZodType.init(inst, def);
3214
+ const memo = core.globalConfig.memoizer;
3215
+ memo?.attach(inst);
2877
3216
 
2878
3217
  inst._zod.parse = (payload, ctx) => {
2879
3218
  const input = payload.value;
@@ -2889,15 +3228,18 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2889
3228
  return payload;
2890
3229
  }
2891
3230
 
3231
+ // no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
2892
3232
  const proms: Promise<any>[] = [];
2893
3233
 
2894
3234
  const values = def.keyType._zod.values;
2895
- if (values) {
2896
- payload.value = {};
3235
+ if (values && !def.partial) {
3236
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
2897
3237
  const recordKeys = new Set<string | symbol>();
2898
3238
  for (const key of values) {
2899
3239
  if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
2900
3240
  recordKeys.add(typeof key === "number" ? key.toString() : key);
3241
+ // A declared __proto__ is stripped but is not an unrecognized key.
3242
+ if (key === "__proto__") continue;
2901
3243
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
2902
3244
  if (keyResult instanceof Promise) {
2903
3245
  throw new Error("Async schemas not supported in object keys currently");
@@ -2914,6 +3256,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2914
3256
  continue;
2915
3257
  }
2916
3258
  const outKey = keyResult.value as PropertyKey;
3259
+ if (outKey === "__proto__") continue;
2917
3260
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2918
3261
 
2919
3262
  if (result instanceof Promise) {
@@ -2937,8 +3280,14 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2937
3280
  let unrecognized!: string[];
2938
3281
  for (const key in input) {
2939
3282
  if (!recordKeys.has(key)) {
2940
- unrecognized = unrecognized ?? [];
2941
- unrecognized.push(key);
3283
+ if (def.mode === "loose") {
3284
+ // skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
3285
+ if (key === "__proto__") continue;
3286
+ payload.value[key] = input[key];
3287
+ } else {
3288
+ unrecognized = unrecognized ?? [];
3289
+ unrecognized.push(key);
3290
+ }
2942
3291
  }
2943
3292
  }
2944
3293
  if (unrecognized && unrecognized.length > 0) {
@@ -2948,10 +3297,13 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2948
3297
  input,
2949
3298
  inst,
2950
3299
  keys: unrecognized,
3300
+ continue: true,
2951
3301
  });
2952
3302
  }
2953
3303
  } else {
2954
- payload.value = {};
3304
+ payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
3305
+ // An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.
3306
+ let unrecognized!: string[];
2955
3307
  // Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
2956
3308
  for (const key of Reflect.ownKeys(input)) {
2957
3309
  if (key === "__proto__") continue;
@@ -2961,8 +3313,7 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2961
3313
  throw new Error("Async schemas not supported in object keys currently");
2962
3314
  }
2963
3315
 
2964
- // Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
2965
- // This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
3316
+ // Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
2966
3317
  const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
2967
3318
  if (checkNumericKey) {
2968
3319
  const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
@@ -2978,6 +3329,9 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2978
3329
  if (def.mode === "loose") {
2979
3330
  // Pass through unchanged
2980
3331
  payload.value[key] = input[key];
3332
+ } else if (values) {
3333
+ unrecognized = unrecognized ?? [];
3334
+ unrecognized.push(key as string);
2981
3335
  } else {
2982
3336
  // Default "strict" behavior: error on invalid key
2983
3337
  payload.issues.push({
@@ -2992,6 +3346,10 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
2992
3346
  continue;
2993
3347
  }
2994
3348
 
3349
+ // the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under
3350
+ const outKey = keyResult.value as PropertyKey;
3351
+ if (outKey === "__proto__") continue;
3352
+
2995
3353
  const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
2996
3354
 
2997
3355
  if (result instanceof Promise) {
@@ -3000,16 +3358,27 @@ export const $ZodRecord: core.$constructor<$ZodRecord> = /*@__PURE__*/ core.$con
3000
3358
  if (result.issues.length) {
3001
3359
  payload.issues.push(...util.prefixIssues(key, result.issues));
3002
3360
  }
3003
- payload.value[keyResult.value as PropertyKey] = result.value;
3361
+ payload.value[outKey] = result.value;
3004
3362
  })
3005
3363
  );
3006
3364
  } else {
3007
3365
  if (result.issues.length) {
3008
3366
  payload.issues.push(...util.prefixIssues(key, result.issues));
3009
3367
  }
3010
- payload.value[keyResult.value as PropertyKey] = result.value;
3368
+ payload.value[outKey] = result.value;
3011
3369
  }
3012
3370
  }
3371
+
3372
+ if (unrecognized && unrecognized.length > 0) {
3373
+ payload.issues.push({
3374
+ code: "unrecognized_keys",
3375
+
3376
+ input,
3377
+ inst,
3378
+ keys: unrecognized,
3379
+ continue: true,
3380
+ });
3381
+ }
3013
3382
  }
3014
3383
 
3015
3384
  if (proms.length) {
@@ -3046,6 +3415,8 @@ export interface $ZodMap<Key extends SomeType = $ZodType, Value extends SomeType
3046
3415
 
3047
3416
  export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
3048
3417
  $ZodType.init(inst, def);
3418
+ const memo = core.globalConfig.memoizer;
3419
+ memo?.attach(inst);
3049
3420
 
3050
3421
  inst._zod.parse = (payload, ctx) => {
3051
3422
  const input = payload.value;
@@ -3061,9 +3432,15 @@ export const $ZodMap: core.$constructor<$ZodMap> = /*@__PURE__*/ core.$construct
3061
3432
  }
3062
3433
 
3063
3434
  const proms: Promise<any>[] = [];
3064
- payload.value = new Map();
3435
+ payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
3436
+ const abortEarly = ctx?.abortEarly;
3437
+ let seen = payload.issues.length;
3065
3438
 
3066
3439
  for (const [key, value] of input) {
3440
+ if (abortEarly && payload.issues.length !== seen) {
3441
+ if (util.aborted(payload, seen)) break;
3442
+ seen = payload.issues.length;
3443
+ }
3067
3444
  const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
3068
3445
  const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
3069
3446
 
@@ -3150,6 +3527,8 @@ export interface $ZodSet<T extends SomeType = $ZodType> extends $ZodType {
3150
3527
 
3151
3528
  export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
3152
3529
  $ZodType.init(inst, def);
3530
+ const memo = core.globalConfig.memoizer;
3531
+ memo?.attach(inst);
3153
3532
 
3154
3533
  inst._zod.parse = (payload, ctx) => {
3155
3534
  const input = payload.value;
@@ -3164,8 +3543,14 @@ export const $ZodSet: core.$constructor<$ZodSet> = /*@__PURE__*/ core.$construct
3164
3543
  }
3165
3544
 
3166
3545
  const proms: Promise<any>[] = [];
3167
- payload.value = new Set();
3546
+ payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
3547
+ const abortEarly = ctx?.abortEarly;
3548
+ let seen = payload.issues.length;
3168
3549
  for (const item of input) {
3550
+ if (abortEarly && payload.issues.length !== seen) {
3551
+ if (util.aborted(payload, seen)) break;
3552
+ seen = payload.issues.length;
3553
+ }
3169
3554
  const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
3170
3555
  if (result instanceof Promise) {
3171
3556
  proms.push(result.then((result) => handleSetResult(result, payload)));
@@ -3224,12 +3609,13 @@ export const $ZodEnum: core.$constructor<$ZodEnum> = /*@__PURE__*/ core.$constru
3224
3609
  const valuesSet = new Set<util.Primitive>(values);
3225
3610
  inst._zod.values = valuesSet;
3226
3611
 
3227
- inst._zod.pattern = new RegExp(
3228
- `^(${values
3229
- .filter((k) => util.propertyKeyTypes.has(typeof k))
3230
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
3231
- .join("|")})$`
3232
- );
3612
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3613
+ const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
3614
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
3615
+ return new RegExp(
3616
+ patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$"
3617
+ );
3618
+ });
3233
3619
 
3234
3620
  inst._zod.parse = (payload, _ctx) => {
3235
3621
  const input = payload.value;
@@ -3275,18 +3661,23 @@ export const $ZodLiteral: core.$constructor<$ZodLiteral> = /*@__PURE__*/ core.$c
3275
3661
  "$ZodLiteral",
3276
3662
  (inst, def) => {
3277
3663
  $ZodType.init(inst, def);
3278
- if (def.values.length === 0) {
3279
- throw new Error("Cannot create literal schema with no valid values");
3280
- }
3281
3664
 
3282
3665
  const values = new Set<util.Literal>(def.values);
3283
3666
  inst._zod.values = values;
3284
- inst._zod.pattern = new RegExp(
3285
- `^(${def.values
3286
3667
 
3287
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
3288
- .join("|")})$`
3289
- );
3668
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3669
+ const vals = zod.def.values;
3670
+ // unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
3671
+ return new RegExp(
3672
+ vals.length
3673
+ ? `^(${vals
3674
+ .map((o: util.Literal) =>
3675
+ typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)
3676
+ )
3677
+ .join("|")})$`
3678
+ : "^[^\\s\\S]$"
3679
+ );
3680
+ });
3290
3681
 
3291
3682
  inst._zod.parse = (payload, _ctx) => {
3292
3683
  const input = payload.value;
@@ -3423,6 +3814,8 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3423
3814
  (inst, def) => {
3424
3815
  $ZodType.init(inst, def);
3425
3816
  inst._zod.optin = "optional";
3817
+ core.globalConfig.memoizer?.guard(inst);
3818
+
3426
3819
  inst._zod.parse = (payload, ctx) => {
3427
3820
  if (ctx.direction === "backward") {
3428
3821
  throw new core.$ZodEncodeError(inst.constructor.name);
@@ -3433,7 +3826,6 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3433
3826
  const output = _out instanceof Promise ? _out : Promise.resolve(_out);
3434
3827
  return output.then((output) => {
3435
3828
  payload.value = output;
3436
- payload.fallback = true;
3437
3829
  return payload;
3438
3830
  });
3439
3831
  }
@@ -3443,7 +3835,6 @@ export const $ZodTransform: core.$constructor<$ZodTransform> = /*@__PURE__*/ cor
3443
3835
  }
3444
3836
 
3445
3837
  payload.value = _out;
3446
- payload.fallback = true;
3447
3838
  return payload;
3448
3839
  };
3449
3840
  }
@@ -3464,7 +3855,7 @@ export interface $ZodOptionalDef<T extends SomeType = $ZodType> extends $ZodType
3464
3855
  export interface $ZodOptionalInternals<T extends SomeType = $ZodType>
3465
3856
  extends $ZodTypeInternals<core.output<T> | undefined, core.input<T> | undefined> {
3466
3857
  def: $ZodOptionalDef<T>;
3467
- optin: "optional";
3858
+ optin: "optional" | "defaulted";
3468
3859
  optout: "optional";
3469
3860
  isst: never;
3470
3861
  values: T["_zod"]["values"];
@@ -3475,37 +3866,39 @@ export interface $ZodOptional<T extends SomeType = $ZodType> extends $ZodType {
3475
3866
  _zod: $ZodOptionalInternals<T>;
3476
3867
  }
3477
3868
 
3478
- function handleOptionalResult(result: ParsePayload, input: unknown) {
3479
- if (input === undefined && (result.issues.length || result.fallback)) {
3480
- return { issues: [], value: undefined };
3481
- }
3482
- return result;
3869
+ function handleOptionalResult(payload: ParsePayload, result: ParsePayload) {
3870
+ // A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.
3871
+ payload.value = result.issues.length ? undefined : result.value;
3872
+ return payload;
3483
3873
  }
3484
3874
 
3485
3875
  export const $ZodOptional: core.$constructor<$ZodOptional> = /*@__PURE__*/ core.$constructor(
3486
3876
  "$ZodOptional",
3487
3877
  (inst, def) => {
3488
3878
  $ZodType.init(inst, def);
3489
- inst._zod.optin = "optional";
3879
+ // .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
3880
+ util.defineLazyInternal(inst, "optin", (zod) =>
3881
+ zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"
3882
+ );
3490
3883
  inst._zod.optout = "optional";
3491
3884
 
3492
- util.defineLazy(inst._zod, "values", () => {
3493
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
3885
+ util.defineLazyInternal(inst, "values", (zod) => {
3886
+ const values = (zod.def as $ZodOptionalDef).innerType._zod.values;
3887
+ return values ? new Set([...values, undefined]) : undefined;
3494
3888
  });
3495
- util.defineLazy(inst._zod, "pattern", () => {
3496
- const pattern = def.innerType._zod.pattern;
3889
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3890
+ const pattern = (zod.def as $ZodOptionalDef).innerType._zod.pattern;
3497
3891
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
3498
3892
  });
3499
3893
 
3500
3894
  inst._zod.parse = (payload, ctx) => {
3501
- if (def.innerType._zod.optin === "optional") {
3502
- const input = payload.value;
3503
- const result = def.innerType._zod.run(payload, ctx);
3504
- if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
3505
- return handleOptionalResult(result, input);
3506
- }
3507
3895
  if (payload.value === undefined) {
3508
- return payload;
3896
+ // Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
3897
+ if (def.innerType._zod.optin !== "defaulted") return payload;
3898
+ // Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.
3899
+ const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
3900
+ if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
3901
+ return handleOptionalResult(payload, result);
3509
3902
  }
3510
3903
  return def.innerType._zod.run(payload, ctx);
3511
3904
  };
@@ -3541,8 +3934,8 @@ export const $ZodExactOptional: core.$constructor<$ZodExactOptional> = /*@__PURE
3541
3934
  $ZodOptional.init(inst, def);
3542
3935
 
3543
3936
  // Override values/pattern to NOT add undefined
3544
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3545
- util.defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
3937
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3938
+ util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
3546
3939
 
3547
3940
  // Override parse to just delegate (no undefined handling)
3548
3941
  inst._zod.parse = (payload, ctx) => {
@@ -3581,16 +3974,16 @@ export const $ZodNullable: core.$constructor<$ZodNullable> = /*@__PURE__*/ core.
3581
3974
  "$ZodNullable",
3582
3975
  (inst, def) => {
3583
3976
  $ZodType.init(inst, def);
3584
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3585
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3977
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
3978
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
3586
3979
 
3587
- util.defineLazy(inst._zod, "pattern", () => {
3588
- const pattern = def.innerType._zod.pattern;
3980
+ util.defineLazyInternal(inst, "pattern", (zod) => {
3981
+ const pattern = zod.def.innerType._zod.pattern;
3589
3982
  return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
3590
3983
  });
3591
3984
 
3592
- util.defineLazy(inst._zod, "values", () => {
3593
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
3985
+ util.defineLazyInternal(inst, "values", (zod) => {
3986
+ return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
3594
3987
  });
3595
3988
 
3596
3989
  inst._zod.parse = (payload, ctx) => {
@@ -3619,7 +4012,7 @@ export interface $ZodDefaultDef<T extends SomeType = $ZodType> extends $ZodTypeD
3619
4012
  export interface $ZodDefaultInternals<T extends SomeType = $ZodType>
3620
4013
  extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
3621
4014
  def: $ZodDefaultDef<T>;
3622
- optin: "optional";
4015
+ optin: "defaulted";
3623
4016
  optout?: "optional" | undefined; // required
3624
4017
  isst: never;
3625
4018
  values: T["_zod"]["values"];
@@ -3635,8 +4028,8 @@ export const $ZodDefault: core.$constructor<$ZodDefault> = /*@__PURE__*/ core.$c
3635
4028
  $ZodType.init(inst, def);
3636
4029
 
3637
4030
  // inst._zod.qin = "true";
3638
- inst._zod.optin = "optional";
3639
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4031
+ inst._zod.optin = "defaulted";
4032
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3640
4033
 
3641
4034
  inst._zod.parse = (payload, ctx) => {
3642
4035
  if (ctx.direction === "backward") {
@@ -3684,9 +4077,9 @@ export interface $ZodPrefaultDef<T extends SomeType = $ZodType> extends $ZodType
3684
4077
  }
3685
4078
 
3686
4079
  export interface $ZodPrefaultInternals<T extends SomeType = $ZodType>
3687
- extends $ZodTypeInternals<util.NoUndefined<core.output<T>>, core.input<T> | undefined> {
4080
+ extends $ZodTypeInternals<core.output<T>, core.input<T> | undefined> {
3688
4081
  def: $ZodPrefaultDef<T>;
3689
- optin: "optional";
4082
+ optin: "defaulted";
3690
4083
  optout?: "optional" | undefined;
3691
4084
  isst: never;
3692
4085
  values: T["_zod"]["values"];
@@ -3701,8 +4094,8 @@ export const $ZodPrefault: core.$constructor<$ZodPrefault> = /*@__PURE__*/ core.
3701
4094
  (inst, def) => {
3702
4095
  $ZodType.init(inst, def);
3703
4096
 
3704
- inst._zod.optin = "optional";
3705
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4097
+ inst._zod.optin = "defaulted";
4098
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3706
4099
 
3707
4100
  inst._zod.parse = (payload, ctx) => {
3708
4101
  if (ctx.direction === "backward") {
@@ -3748,8 +4141,8 @@ export const $ZodNonOptional: core.$constructor<$ZodNonOptional> = /*@__PURE__*/
3748
4141
  (inst, def) => {
3749
4142
  $ZodType.init(inst, def);
3750
4143
 
3751
- util.defineLazy(inst._zod, "values", () => {
3752
- const v = def.innerType._zod.values;
4144
+ util.defineLazyInternal(inst, "values", (zod) => {
4145
+ const v = zod.def.innerType._zod.values;
3753
4146
  return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
3754
4147
  });
3755
4148
 
@@ -3893,11 +4286,33 @@ export interface $ZodCatch<T extends SomeType = $ZodType> extends $ZodType {
3893
4286
  _zod: $ZodCatchInternals<T>;
3894
4287
  }
3895
4288
 
4289
+ function handleCatchResult(payload: ParsePayload, result: ParsePayload, def: $ZodCatchDef, ctx: ParseContextInternal) {
4290
+ if (!result.issues.length) {
4291
+ payload.value = result.value;
4292
+ // The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.
4293
+ if (result.memo) payload.memo = true;
4294
+ return payload;
4295
+ }
4296
+
4297
+ // Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.
4298
+ payload.value = def.catchValue({
4299
+ ...result,
4300
+ value: payload.value,
4301
+ error: {
4302
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
4303
+ },
4304
+ input: payload.value,
4305
+ });
4306
+ return payload;
4307
+ }
4308
+
3896
4309
  export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
3897
4310
  $ZodType.init(inst, def);
3898
- inst._zod.optin = "optional";
3899
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3900
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4311
+ util.defineLazyInternal(inst, "optin", (zod) =>
4312
+ zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"
4313
+ );
4314
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
4315
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
3901
4316
 
3902
4317
  inst._zod.parse = (payload, ctx) => {
3903
4318
  if (ctx.direction === "backward") {
@@ -3905,41 +4320,12 @@ export const $ZodCatch: core.$constructor<$ZodCatch> = /*@__PURE__*/ core.$const
3905
4320
  }
3906
4321
 
3907
4322
  // Forward direction (decode): apply catch logic
3908
- const result = def.innerType._zod.run(payload, ctx);
4323
+ const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
3909
4324
  if (result instanceof Promise) {
3910
- return result.then((result) => {
3911
- payload.value = result.value;
3912
- if (result.issues.length) {
3913
- payload.value = def.catchValue({
3914
- ...payload,
3915
- error: {
3916
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3917
- },
3918
- input: payload.value,
3919
- });
3920
- payload.issues = [];
3921
- payload.fallback = true;
3922
- }
3923
-
3924
- return payload;
3925
- });
3926
- }
3927
-
3928
- payload.value = result.value;
3929
- if (result.issues.length) {
3930
- payload.value = def.catchValue({
3931
- ...payload,
3932
- error: {
3933
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
3934
- },
3935
- input: payload.value,
3936
- });
3937
-
3938
- payload.issues = [];
3939
- payload.fallback = true;
4325
+ return result.then((result) => handleCatchResult(payload, result, def, ctx));
3940
4326
  }
3941
4327
 
3942
- return payload;
4328
+ return handleCatchResult(payload, result, def, ctx);
3943
4329
  };
3944
4330
  });
3945
4331
 
@@ -4013,10 +4399,10 @@ export interface $ZodPipe<A extends SomeType = $ZodType, B extends SomeType = $Z
4013
4399
 
4014
4400
  export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
4015
4401
  $ZodType.init(inst, def);
4016
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
4017
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
4018
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
4019
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
4402
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
4403
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
4404
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
4405
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
4020
4406
 
4021
4407
  inst._zod.parse = (payload, ctx) => {
4022
4408
  if (ctx.direction === "backward") {
@@ -4036,12 +4422,13 @@ export const $ZodPipe: core.$constructor<$ZodPipe> = /*@__PURE__*/ core.$constru
4036
4422
  });
4037
4423
 
4038
4424
  function handlePipeResult(left: ParsePayload, next: $ZodType, ctx: ParseContextInternal) {
4039
- if (left.issues.length) {
4425
+ // Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.
4426
+ if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
4040
4427
  // prevent further checks
4041
4428
  left.aborted = true;
4042
4429
  return left;
4043
4430
  }
4044
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
4431
+ return next._zod.run({ value: left.value, issues: left.issues }, ctx);
4045
4432
  }
4046
4433
 
4047
4434
  ////////////////////////////////////////////
@@ -4072,10 +4459,10 @@ export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $
4072
4459
 
4073
4460
  export const $ZodCodec: core.$constructor<$ZodCodec> = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
4074
4461
  $ZodType.init(inst, def);
4075
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
4076
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
4077
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
4078
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
4462
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
4463
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
4464
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
4465
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
4079
4466
 
4080
4467
  inst._zod.parse = (payload, ctx) => {
4081
4468
  const direction = ctx.direction || "forward";
@@ -4136,19 +4523,22 @@ function handleCodecTxResult(left: ParsePayload, value: any, nextSchema: SomeTyp
4136
4523
  ////////// //////////
4137
4524
  /////////////////////////////////////////////////
4138
4525
  /////////////////////////////////////////////////
4139
- export interface $ZodPreprocessDef<B extends SomeType = $ZodType> extends $ZodPipeDef<$ZodTransform, B> {
4140
- in: $ZodTransform;
4526
+ export interface $ZodPreprocessDef<B extends SomeType = $ZodType, I = unknown>
4527
+ extends $ZodPipeDef<$ZodTransform<unknown, I>, B> {
4528
+ in: $ZodTransform<unknown, I>;
4141
4529
  out: B;
4142
4530
  }
4143
4531
 
4144
- export interface $ZodPreprocessInternals<B extends SomeType = $ZodType> extends $ZodPipeInternals<$ZodTransform, B> {
4145
- def: $ZodPreprocessDef<B>;
4532
+ export interface $ZodPreprocessInternals<B extends SomeType = $ZodType, I = unknown>
4533
+ extends $ZodPipeInternals<$ZodTransform<unknown, I>, B> {
4534
+ def: $ZodPreprocessDef<B, I>;
4146
4535
  optin: B["_zod"]["optin"];
4147
4536
  optout: B["_zod"]["optout"];
4148
4537
  }
4149
4538
 
4150
- export interface $ZodPreprocess<B extends SomeType = $ZodType> extends $ZodPipe<$ZodTransform, B> {
4151
- _zod: $ZodPreprocessInternals<B>;
4539
+ export interface $ZodPreprocess<B extends SomeType = $ZodType, I = unknown>
4540
+ extends $ZodPipe<$ZodTransform<unknown, I>, B> {
4541
+ _zod: $ZodPreprocessInternals<B, I>;
4152
4542
  }
4153
4543
 
4154
4544
  export const $ZodPreprocess: core.$constructor<$ZodPreprocess> = /*@__PURE__*/ core.$constructor(
@@ -4189,10 +4579,10 @@ export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.
4189
4579
  "$ZodReadonly",
4190
4580
  (inst, def) => {
4191
4581
  $ZodType.init(inst, def);
4192
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
4193
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
4194
- util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
4195
- util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
4582
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
4583
+ util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
4584
+ util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
4585
+ util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
4196
4586
 
4197
4587
  inst._zod.parse = (payload, ctx) => {
4198
4588
  if (ctx.direction === "backward") {
@@ -4208,7 +4598,8 @@ export const $ZodReadonly: core.$constructor<$ZodReadonly> = /*@__PURE__*/ core.
4208
4598
  );
4209
4599
 
4210
4600
  function handleReadonlyResult(payload: ParsePayload): ParsePayload {
4211
- payload.value = Object.freeze(payload.value);
4601
+ // A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.
4602
+ if (!payload.memo) payload.value = Object.freeze(payload.value);
4212
4603
  return payload;
4213
4604
  }
4214
4605
 
@@ -4285,6 +4676,51 @@ export type $PartsToTemplateLiteral<Parts extends $ZodTemplateLiteralPart[]> = [
4285
4676
  : never
4286
4677
  : never;
4287
4678
 
4679
+ // a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
4680
+ function leafPattern(schema: $ZodType): string | undefined {
4681
+ const def = schema._zod.def as { pattern?: RegExp; format?: string; checks?: checks.$ZodCheck[] };
4682
+ let pattern = def.pattern;
4683
+ let isInt = !!def.format?.includes("int");
4684
+ let minimum: number | undefined;
4685
+ let maximum: number | undefined;
4686
+ for (const ch of def.checks ?? []) {
4687
+ const d = ch._zod.def as { pattern?: RegExp; format?: string; minimum?: number; maximum?: number; length?: number };
4688
+ if (d.pattern) pattern = d.pattern;
4689
+ isInt ||= !!d.format?.includes("int");
4690
+ const lo = d.minimum ?? d.length;
4691
+ const hi = d.maximum ?? d.length;
4692
+ if (lo !== undefined && (minimum === undefined || lo > minimum)) minimum = lo;
4693
+ if (hi !== undefined && (maximum === undefined || hi < maximum)) maximum = hi;
4694
+ }
4695
+ if (pattern) return pattern.source;
4696
+ // an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
4697
+ if (minimum !== undefined && maximum !== undefined && minimum > maximum) return "(?!)";
4698
+ if (minimum !== undefined || maximum !== undefined) return regexes.string({ minimum, maximum }).source;
4699
+ const own = schema._zod.pattern;
4700
+ return (isInt && own === regexes.number ? regexes.integer : own)?.source;
4701
+ }
4702
+
4703
+ // a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
4704
+ function partPattern(schema: $ZodType): string | undefined {
4705
+ const def = schema._zod.def as { innerType?: $ZodType; options?: $ZodType[] };
4706
+ const own = schema._zod.pattern?.source;
4707
+ // lazy resolves its inner on the internals, not the def
4708
+ const inner = def.innerType ?? (schema._zod as { innerType?: $ZodType }).innerType;
4709
+ if (inner) {
4710
+ const before = inner._zod.pattern?.source;
4711
+ const after = partPattern(inner);
4712
+ if (own && before && after && after !== before) {
4713
+ return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
4714
+ }
4715
+ return own;
4716
+ }
4717
+ if (def.options) {
4718
+ const sources = def.options.map(partPattern);
4719
+ if (sources.every(Boolean)) return `^(${sources.map((s) => util.cleanRegex(s!)).join("|")})$`;
4720
+ }
4721
+ return leafPattern(schema);
4722
+ }
4723
+
4288
4724
  export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
4289
4725
  "$ZodTemplateLiteral",
4290
4726
  (inst, def) => {
@@ -4293,18 +4729,11 @@ export const $ZodTemplateLiteral: core.$constructor<$ZodTemplateLiteral> = /*@__
4293
4729
  for (const part of def.parts) {
4294
4730
  if (typeof part === "object" && part !== null) {
4295
4731
  // is Zod schema
4296
- if (!part._zod.pattern) {
4297
- // if (!source)
4732
+ const source = partPattern(part);
4733
+ if (!source) {
4298
4734
  throw new Error(`Invalid template literal part, no pattern found: ${[...(part as any)._zod.traits].shift()}`);
4299
4735
  }
4300
-
4301
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
4302
-
4303
- if (!source) throw new Error(`Invalid template literal part: ${part._zod.traits}`);
4304
-
4305
- const start = source.startsWith("^") ? 1 : 0;
4306
- const end = source.endsWith("$") ? source.length - 1 : source.length;
4307
- regexParts.push(source.slice(start, end));
4736
+ regexParts.push(util.cleanRegex(source));
4308
4737
  } else if (part === null || util.primitiveTypes.has(typeof part)) {
4309
4738
  regexParts.push(util.escapeRegex(`${part}`));
4310
4739
  } else {
@@ -4424,35 +4853,45 @@ export const $ZodFunction: core.$constructor<$ZodFunction> = /*@__PURE__*/ core.
4424
4853
  "$ZodFunction",
4425
4854
  (inst, def) => {
4426
4855
  $ZodType.init(inst, def);
4427
- inst._def = def;
4856
+ // Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
4857
+ Object.defineProperty(inst, "_def", { value: def });
4428
4858
  inst._zod.def = def;
4429
4859
 
4430
4860
  inst.implement = (func) => {
4431
4861
  if (typeof func !== "function") {
4432
4862
  throw new Error("implement() must be called with a function");
4433
4863
  }
4434
- return function (this: any, ...args: never[]) {
4435
- const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4436
- const result = Reflect.apply(func, this, parsedArgs as never[]);
4437
- if (inst._def.output) {
4438
- return parse(inst._def.output, result);
4439
- }
4440
- return result as any;
4441
- };
4864
+ // Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
4865
+ return Object.defineProperty(
4866
+ function (this: any, ...args: never[]) {
4867
+ const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
4868
+ const result = Reflect.apply(func, this, parsedArgs as never[]);
4869
+ if (inst._def.output) {
4870
+ return parse(inst._def.output, result);
4871
+ }
4872
+ return result as any;
4873
+ },
4874
+ "_zod",
4875
+ { value: inst._zod, enumerable: false }
4876
+ ) as any;
4442
4877
  };
4443
4878
 
4444
4879
  inst.implementAsync = (func) => {
4445
4880
  if (typeof func !== "function") {
4446
4881
  throw new Error("implementAsync() must be called with a function");
4447
4882
  }
4448
- return async function (this: any, ...args: never[]) {
4449
- const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4450
- const result = await Reflect.apply(func, this, parsedArgs as never[]);
4451
- if (inst._def.output) {
4452
- return await parseAsync(inst._def.output, result);
4453
- }
4454
- return result;
4455
- } as any;
4883
+ return Object.defineProperty(
4884
+ async function (this: any, ...args: never[]) {
4885
+ const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
4886
+ const result = await Reflect.apply(func, this, parsedArgs as never[]);
4887
+ if (inst._def.output) {
4888
+ return await parseAsync(inst._def.output, result);
4889
+ }
4890
+ return result;
4891
+ },
4892
+ "_zod",
4893
+ { value: inst._zod, enumerable: false }
4894
+ ) as any;
4456
4895
  };
4457
4896
 
4458
4897
  inst._zod.parse = (payload, _ctx) => {
@@ -4576,18 +5015,16 @@ export interface $ZodLazy<T extends SomeType = $ZodType> extends $ZodType {
4576
5015
  export const $ZodLazy: core.$constructor<$ZodLazy> = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
4577
5016
  $ZodType.init(inst, def);
4578
5017
 
4579
- // Cache the resolved inner type on the shared `def` so all clones of this
4580
- // lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
4581
- // preserving identity for cycle detection on recursive schemas.
5018
+ // Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.
4582
5019
  util.defineLazy(inst._zod, "innerType", () => {
4583
5020
  const d = def as $ZodLazyDef & { _cachedInner?: $ZodType };
4584
5021
  if (!d._cachedInner) d._cachedInner = def.getter() as $ZodType;
4585
5022
  return d._cachedInner;
4586
5023
  });
4587
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
4588
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
4589
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
4590
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
5024
+ util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
5025
+ util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
5026
+ util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
5027
+ util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
4591
5028
  inst._zod.parse = (payload, ctx) => {
4592
5029
  const inner = inst._zod.innerType;
4593
5030
  return inner._zod.run(payload, ctx);
@@ -4659,6 +5096,101 @@ function handleRefineResult(result: unknown, payload: ParsePayload, input: unkno
4659
5096
  }
4660
5097
  }
4661
5098
 
5099
+ ////////////////////////////////////////
5100
+ ////////////////////////////////////////
5101
+ ////////// //////////
5102
+ ////////// $ZodProperties //////////
5103
+ ////////// //////////
5104
+ ////////////////////////////////////////
5105
+ ////////////////////////////////////////
5106
+ export interface $ZodPropertiesDef<Shape extends $ZodShape = $ZodShape> extends $ZodTypeDef, checks.$ZodCheckDef {
5107
+ type: "properties";
5108
+ check: "properties";
5109
+ shape: Shape;
5110
+ }
5111
+
5112
+ // both sides infer the INPUT type: the shape is asserted and its results discarded, so a default, catch or transform inside it would make an output-typed inference a lie. The check side widens a literal to its primitive, so spreading over a `string` property still type-checks (#6520).
5113
+ export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape>
5114
+ extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>,
5115
+ checks.$ZodCheckInternals<{ -readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>> }> {
5116
+ def: $ZodPropertiesDef<Shape>;
5117
+ isst: errors.$ZodIssueInvalidType;
5118
+ issc: errors.$ZodIssue;
5119
+ }
5120
+
5121
+ export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
5122
+ _zod: $ZodPropertiesInternals<Shape>;
5123
+ // yields the schema itself, so pre-4.6 `.check(...z.properties(shape))` spread call sites keep working
5124
+ [Symbol.iterator](): Iterator<this>;
5125
+ }
5126
+
5127
+ // asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
5128
+ function handlePropertiesResult(result: ParsePayload, payload: ParsePayload, key: string | symbol): void {
5129
+ if (result.issues.length) {
5130
+ payload.issues.push(...util.prefixIssues(key, result.issues));
5131
+ }
5132
+ }
5133
+
5134
+ export const $ZodProperties: core.$constructor<$ZodProperties> = /*@__PURE__*/ core.$constructor(
5135
+ "$ZodProperties",
5136
+ (inst, def) => {
5137
+ // $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
5138
+ $ZodType.init(inst, def);
5139
+ checks.$ZodCheck.init(inst, def);
5140
+
5141
+ const memo = core.globalConfig.memoizer;
5142
+ memo?.attach(inst);
5143
+
5144
+ // key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
5145
+ let entries!: [string | symbol, $ZodType][];
5146
+ const runShape = (payload: ParsePayload, ctx: ParseContextInternal): util.MaybeAsync<void> => {
5147
+ entries ??= Reflect.ownKeys(def.shape).map((key) => [key, (def.shape as any)[key] as $ZodType]);
5148
+ const input = payload.value as any;
5149
+ let proms: Promise<any>[] | undefined;
5150
+ for (const [key, schema] of entries) {
5151
+ const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
5152
+ if (result instanceof Promise) {
5153
+ proms ??= [];
5154
+ proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
5155
+ } else {
5156
+ handlePropertiesResult(result, payload, key);
5157
+ }
5158
+ }
5159
+ if (proms) return Promise.all(proms).then(() => undefined);
5160
+ return undefined;
5161
+ };
5162
+
5163
+ inst._zod.parse = (payload, ctx) => {
5164
+ const input = payload.value;
5165
+ // as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
5166
+ if (input === null || (typeof input !== "object" && typeof input !== "function")) {
5167
+ payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
5168
+ return payload;
5169
+ }
5170
+ // both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
5171
+ if (ctx.direction === "backward") ctx = { ...ctx, direction: "forward" };
5172
+ // the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
5173
+ if (memo) memo.alloc(inst, payload, input, ctx);
5174
+ const result = runShape(payload, ctx);
5175
+ return result instanceof Promise ? result.then(() => payload) : payload;
5176
+ };
5177
+
5178
+ // as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
5179
+ inst._zod.check = (payload) => {
5180
+ if (payload.value == null) {
5181
+ payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
5182
+ return undefined;
5183
+ }
5184
+ return runShape(payload, {});
5185
+ };
5186
+ },
5187
+ {
5188
+ *[Symbol.iterator]() {
5189
+ yield this;
5190
+ },
5191
+ }
5192
+ );
5193
+
4662
5194
  export type $ZodTypes =
4663
5195
  | $ZodString
4664
5196
  | $ZodNumber
@@ -4691,6 +5223,7 @@ export type $ZodTypes =
4691
5223
  | $ZodPrefault
4692
5224
  | $ZodTemplateLiteral
4693
5225
  | $ZodCustom
5226
+ | $ZodProperties
4694
5227
  | $ZodTransform
4695
5228
  | $ZodNonOptional
4696
5229
  | $ZodReadonly
@@ -4724,6 +5257,8 @@ export type $ZodStringFormatTypes =
4724
5257
  | $ZodBase64
4725
5258
  | $ZodBase64URL
4726
5259
  | $ZodE164
5260
+ | $ZodCreditCard
5261
+ | $ZodIBAN
4727
5262
  | $ZodJWT
4728
5263
  | $ZodCustomStringFormat<"hex">
4729
5264
  | $ZodCustomStringFormat<util.HashFormat>