jialing-code 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (460) hide show
  1. package/README.md +97 -0
  2. package/dist/chunk-065m026w.js +97 -0
  3. package/dist/chunk-06saje2v.js +39 -0
  4. package/dist/chunk-0731m51q.js +8 -0
  5. package/dist/chunk-0975ccyw.js +265 -0
  6. package/dist/chunk-09n3fjx5.js +67 -0
  7. package/dist/chunk-0bdjdzew.js +41 -0
  8. package/dist/chunk-0ce6kd7y.js +212 -0
  9. package/dist/chunk-0e1xsncc.js +969 -0
  10. package/dist/chunk-0m2861gw.js +154 -0
  11. package/dist/chunk-0paqc2yw.js +15 -0
  12. package/dist/chunk-0rg6yrhy.js +99 -0
  13. package/dist/chunk-0sakxrcf.js +643 -0
  14. package/dist/chunk-0v9hwxvz.js +105 -0
  15. package/dist/chunk-0vkfrmqm.js +690 -0
  16. package/dist/chunk-0vvfnhhv.js +248 -0
  17. package/dist/chunk-0w4rsycj.js +145 -0
  18. package/dist/chunk-0x9b2nmd.js +63 -0
  19. package/dist/chunk-0xjaqda8.js +1124 -0
  20. package/dist/chunk-1141xmr4.js +8 -0
  21. package/dist/chunk-13d1842d.js +154 -0
  22. package/dist/chunk-1921a6yb.js +32 -0
  23. package/dist/chunk-1ad8mk9g.js +527 -0
  24. package/dist/chunk-1ax41pws.js +28 -0
  25. package/dist/chunk-1c8z1b5v.js +16 -0
  26. package/dist/chunk-1cbn5kxf.js +7 -0
  27. package/dist/chunk-1eapde8a.js +726 -0
  28. package/dist/chunk-1h2famwb.js +49 -0
  29. package/dist/chunk-1jggnf7z.js +85 -0
  30. package/dist/chunk-1k92pn9c.js +32 -0
  31. package/dist/chunk-1qakq4sn.js +802 -0
  32. package/dist/chunk-1rvz0433.js +722 -0
  33. package/dist/chunk-1xkekb9y.js +19 -0
  34. package/dist/chunk-238g70xa.js +36 -0
  35. package/dist/chunk-24ge0eqa.js +106 -0
  36. package/dist/chunk-278vghwm.js +5395 -0
  37. package/dist/chunk-27xc1csx.js +104 -0
  38. package/dist/chunk-2a42s11t.js +412 -0
  39. package/dist/chunk-2aa02aw6.js +438 -0
  40. package/dist/chunk-2eykm0j0.js +20 -0
  41. package/dist/chunk-2gzv8nrw.js +205 -0
  42. package/dist/chunk-2k995y2x.js +880 -0
  43. package/dist/chunk-2nayx6q1.js +63 -0
  44. package/dist/chunk-2sd2w2h4.js +44 -0
  45. package/dist/chunk-2tw2ve8h.js +145 -0
  46. package/dist/chunk-30rst83v.js +168 -0
  47. package/dist/chunk-3aavh06g.js +1581 -0
  48. package/dist/chunk-3b0yvt2h.js +469 -0
  49. package/dist/chunk-3be7ka25.js +56 -0
  50. package/dist/chunk-3c25bcsw.js +17 -0
  51. package/dist/chunk-3dyxka97.js +584 -0
  52. package/dist/chunk-3f7rypmf.js +16544 -0
  53. package/dist/chunk-3fsd7f51.js +93 -0
  54. package/dist/chunk-3gqdqmzb.js +75 -0
  55. package/dist/chunk-3h8a89gy.js +46 -0
  56. package/dist/chunk-3m84sret.js +71 -0
  57. package/dist/chunk-3nb7j3js.js +96 -0
  58. package/dist/chunk-3p08nvn2.js +98 -0
  59. package/dist/chunk-3r09htpc.js +318 -0
  60. package/dist/chunk-3r24h7t6.js +113 -0
  61. package/dist/chunk-3rkfxjtq.js +80 -0
  62. package/dist/chunk-3tmk7dc2.js +604 -0
  63. package/dist/chunk-3w6s9m5w.js +16 -0
  64. package/dist/chunk-43qjymy5.js +92 -0
  65. package/dist/chunk-44fpr6jq.js +434 -0
  66. package/dist/chunk-45kxdsp8.js +444 -0
  67. package/dist/chunk-495d85x1.js +8066 -0
  68. package/dist/chunk-4ba796se.js +1095 -0
  69. package/dist/chunk-4g3v8y12.js +23 -0
  70. package/dist/chunk-4h53xj8n.js +3445 -0
  71. package/dist/chunk-4jm600zv.js +13 -0
  72. package/dist/chunk-4jy9dtwk.js +116 -0
  73. package/dist/chunk-4p60dd45.js +55 -0
  74. package/dist/chunk-4z0jsrqg.js +81 -0
  75. package/dist/chunk-4zfkzkt6.js +37 -0
  76. package/dist/chunk-55wgxwa9.js +13877 -0
  77. package/dist/chunk-5dbk24zg.js +890 -0
  78. package/dist/chunk-5hzvp4va.js +115 -0
  79. package/dist/chunk-5kbt1mbt.js +500 -0
  80. package/dist/chunk-5pen7vr8.js +176 -0
  81. package/dist/chunk-5r280eng.js +198 -0
  82. package/dist/chunk-5srym52s.js +88 -0
  83. package/dist/chunk-600kg7k6.js +41 -0
  84. package/dist/chunk-616w0qj3.js +160 -0
  85. package/dist/chunk-62jw1t8c.js +94 -0
  86. package/dist/chunk-62xmt9mk.js +372 -0
  87. package/dist/chunk-64bvg7c3.js +229 -0
  88. package/dist/chunk-65yhe4s0.js +281 -0
  89. package/dist/chunk-6aewh27m.js +102 -0
  90. package/dist/chunk-6bd8brc4.js +48 -0
  91. package/dist/chunk-6dj5t602.js +341 -0
  92. package/dist/chunk-6exxdk1p.js +6956 -0
  93. package/dist/chunk-6f5j8fs0.js +752 -0
  94. package/dist/chunk-6g62sjpf.js +328 -0
  95. package/dist/chunk-6gecq2ta.js +1493 -0
  96. package/dist/chunk-6gr3c3w9.js +378 -0
  97. package/dist/chunk-6kpbgc5w.js +23 -0
  98. package/dist/chunk-6kseqw79.js +154 -0
  99. package/dist/chunk-6mxm1qd0.js +40764 -0
  100. package/dist/chunk-6n2qgm9v.js +8 -0
  101. package/dist/chunk-6tq2v3rk.js +186 -0
  102. package/dist/chunk-6wsdhj3v.js +93 -0
  103. package/dist/chunk-6zw9fhgb.js +4389 -0
  104. package/dist/chunk-71grc1mw.js +111 -0
  105. package/dist/chunk-73rpbt04.js +1947 -0
  106. package/dist/chunk-748feghg.js +604 -0
  107. package/dist/chunk-75e8gtg9.js +84 -0
  108. package/dist/chunk-75th4717.js +780 -0
  109. package/dist/chunk-760252na.js +101 -0
  110. package/dist/chunk-7739pg2c.js +4261 -0
  111. package/dist/chunk-778fnx46.js +472 -0
  112. package/dist/chunk-77g09znh.js +391 -0
  113. package/dist/chunk-7aw745vx.js +40175 -0
  114. package/dist/chunk-7m2nd8da.js +110 -0
  115. package/dist/chunk-7n35vjtw.js +444 -0
  116. package/dist/chunk-7n5ss4sh.js +144 -0
  117. package/dist/chunk-7rjnxcfe.js +107 -0
  118. package/dist/chunk-7sb5axvf.js +122 -0
  119. package/dist/chunk-7wm5s02e.js +216 -0
  120. package/dist/chunk-7ymfj7m3.js +151 -0
  121. package/dist/chunk-7z8j9qfn.js +121 -0
  122. package/dist/chunk-7zsapntc.js +216 -0
  123. package/dist/chunk-805fhkfh.js +908 -0
  124. package/dist/chunk-80k1nj24.js +253 -0
  125. package/dist/chunk-83hfzbx3.js +10 -0
  126. package/dist/chunk-85cypsdd.js +92 -0
  127. package/dist/chunk-8760caxf.js +2644 -0
  128. package/dist/chunk-88f6egg6.js +387 -0
  129. package/dist/chunk-88r7kwgj.js +22 -0
  130. package/dist/chunk-89e1v45e.js +463 -0
  131. package/dist/chunk-8bedvdm1.js +32 -0
  132. package/dist/chunk-8c4x4vdz.js +177 -0
  133. package/dist/chunk-8hq5kk3y.js +44 -0
  134. package/dist/chunk-8ngxagxq.js +18 -0
  135. package/dist/chunk-8tnsngw2.js +31 -0
  136. package/dist/chunk-8wjnca8h.js +307 -0
  137. package/dist/chunk-8y12jxg8.js +10 -0
  138. package/dist/chunk-8ymf4e6z.js +48 -0
  139. package/dist/chunk-90wp6wez.js +10510 -0
  140. package/dist/chunk-92bp5bnf.js +650 -0
  141. package/dist/chunk-92q8sx5z.js +90 -0
  142. package/dist/chunk-958rtmtx.js +10476 -0
  143. package/dist/chunk-9e2kqv5g.js +125 -0
  144. package/dist/chunk-9f4f1hy5.js +281 -0
  145. package/dist/chunk-9gbamk79.js +93 -0
  146. package/dist/chunk-9k5s3ryh.js +167 -0
  147. package/dist/chunk-9xzfqm15.js +97 -0
  148. package/dist/chunk-9zgdvbm6.js +110 -0
  149. package/dist/chunk-a0p3q8jw.js +24 -0
  150. package/dist/chunk-a22sayzp.js +220 -0
  151. package/dist/chunk-a8ejc632.js +3094 -0
  152. package/dist/chunk-a8gj9d9z.js +120 -0
  153. package/dist/chunk-a9vdeb6y.js +258 -0
  154. package/dist/chunk-a9yev47v.js +674 -0
  155. package/dist/chunk-a9zh40sj.js +48 -0
  156. package/dist/chunk-ack5mfba.js +105 -0
  157. package/dist/chunk-ae76ded0.js +30 -0
  158. package/dist/chunk-akjw4dh6.js +538 -0
  159. package/dist/chunk-asc6wz4q.js +1188 -0
  160. package/dist/chunk-atqejh3p.js +273 -0
  161. package/dist/chunk-atv2e6b7.js +61 -0
  162. package/dist/chunk-axvvkwz8.js +1551 -0
  163. package/dist/chunk-azgz7kj9.js +38 -0
  164. package/dist/chunk-b3zave8q.js +275 -0
  165. package/dist/chunk-b4wg70y1.js +54 -0
  166. package/dist/chunk-b8b13qn2.js +100 -0
  167. package/dist/chunk-bg3mt9bm.js +28 -0
  168. package/dist/chunk-bh4jvcjn.js +91 -0
  169. package/dist/chunk-bhdt6k7w.js +15 -0
  170. package/dist/chunk-bm1qb16p.js +17 -0
  171. package/dist/chunk-bpvsd1j1.js +266 -0
  172. package/dist/chunk-bqfnp99q.js +477 -0
  173. package/dist/chunk-bsbmmfyt.js +17 -0
  174. package/dist/chunk-bsbt34jm.js +42 -0
  175. package/dist/chunk-c78akdhr.js +458 -0
  176. package/dist/chunk-cdz5yb0r.js +57 -0
  177. package/dist/chunk-cfv996bs.js +22 -0
  178. package/dist/chunk-cgfdkzhb.js +12 -0
  179. package/dist/chunk-ckh4r5er.js +257 -0
  180. package/dist/chunk-cmgjnvn9.js +89 -0
  181. package/dist/chunk-cpjgvay8.js +687 -0
  182. package/dist/chunk-crfryjx9.js +276 -0
  183. package/dist/chunk-ctw5jwcd.js +213 -0
  184. package/dist/chunk-cvy3vntc.js +65 -0
  185. package/dist/chunk-cwbzz504.js +94 -0
  186. package/dist/chunk-cy2hswr1.js +15 -0
  187. package/dist/chunk-cyejkay3.js +222 -0
  188. package/dist/chunk-d18z9pna.js +106 -0
  189. package/dist/chunk-d5cq0n0v.js +162 -0
  190. package/dist/chunk-db45aryp.js +50 -0
  191. package/dist/chunk-de8nqh0z.js +790 -0
  192. package/dist/chunk-dfw6h350.js +2336 -0
  193. package/dist/chunk-dgqrcy74.js +48 -0
  194. package/dist/chunk-dn75ptgd.js +184 -0
  195. package/dist/chunk-dnh7jtpb.js +37 -0
  196. package/dist/chunk-dpshyv9m.js +90 -0
  197. package/dist/chunk-dt8cdvnm.js +642 -0
  198. package/dist/chunk-dtxby6fr.js +306 -0
  199. package/dist/chunk-dv1wfr85.js +6373 -0
  200. package/dist/chunk-dw363edx.js +1154 -0
  201. package/dist/chunk-dwrdacck.js +62 -0
  202. package/dist/chunk-dxnnv5e3.js +276 -0
  203. package/dist/chunk-e3g8q4cn.js +1646 -0
  204. package/dist/chunk-e3m9k9s2.js +542 -0
  205. package/dist/chunk-e4q49asn.js +155 -0
  206. package/dist/chunk-e5pntxye.js +37 -0
  207. package/dist/chunk-e7393td6.js +42 -0
  208. package/dist/chunk-ead42yrh.js +87 -0
  209. package/dist/chunk-eb90vwvr.js +152 -0
  210. package/dist/chunk-ecvwk9hg.js +250 -0
  211. package/dist/chunk-edjd6aay.js +173 -0
  212. package/dist/chunk-eg0h8mtm.js +130 -0
  213. package/dist/chunk-ehtwnxpg.js +1591 -0
  214. package/dist/chunk-ek686gx1.js +94 -0
  215. package/dist/chunk-eqp1rfft.js +17 -0
  216. package/dist/chunk-evhwt0ar.js +1015 -0
  217. package/dist/chunk-ewadzrm8.js +103 -0
  218. package/dist/chunk-ewsgsw9h.js +172291 -0
  219. package/dist/chunk-f0pa0r7e.js +3198 -0
  220. package/dist/chunk-f2mhrmww.js +62 -0
  221. package/dist/chunk-f39zxvwn.js +401 -0
  222. package/dist/chunk-f46z54tq.js +374 -0
  223. package/dist/chunk-f5ma3nh5.js +3436 -0
  224. package/dist/chunk-f60q23az.js +3038 -0
  225. package/dist/chunk-f6v2nz57.js +107 -0
  226. package/dist/chunk-f6yjan38.js +38 -0
  227. package/dist/chunk-fbv4apne.js +51 -0
  228. package/dist/chunk-fem4s778.js +70 -0
  229. package/dist/chunk-fezm1kn8.js +376 -0
  230. package/dist/chunk-fm1n3ysp.js +6108 -0
  231. package/dist/chunk-frg83bfw.js +225 -0
  232. package/dist/chunk-fscm8db0.js +692 -0
  233. package/dist/chunk-fyc5fepv.js +10 -0
  234. package/dist/chunk-g0j0t6qk.js +26 -0
  235. package/dist/chunk-g0nc1ftf.js +849 -0
  236. package/dist/chunk-g338npwr.js +1061 -0
  237. package/dist/chunk-g3t0act8.js +8 -0
  238. package/dist/chunk-g75w4hw3.js +26 -0
  239. package/dist/chunk-g8vp82en.js +1866 -0
  240. package/dist/chunk-gax0fcbx.js +182 -0
  241. package/dist/chunk-gsz4dh3y.js +606 -0
  242. package/dist/chunk-gtfffm7h.js +440 -0
  243. package/dist/chunk-gver9zb9.js +420 -0
  244. package/dist/chunk-gyj242zr.js +20 -0
  245. package/dist/chunk-h0qngp9w.js +157 -0
  246. package/dist/chunk-h14kemnk.js +123 -0
  247. package/dist/chunk-h8wj1a74.js +8960 -0
  248. package/dist/chunk-h9mcb2eg.js +87 -0
  249. package/dist/chunk-h9nh2980.js +91 -0
  250. package/dist/chunk-hakdhagh.js +16606 -0
  251. package/dist/chunk-hbc6ymdv.js +55 -0
  252. package/dist/chunk-hh7cmy4k.js +20 -0
  253. package/dist/chunk-hjhc4cpt.js +69 -0
  254. package/dist/chunk-hjwez8qc.js +5018 -0
  255. package/dist/chunk-hk9xz7gk.js +118 -0
  256. package/dist/chunk-hqmz36b3.js +552 -0
  257. package/dist/chunk-hrzerbfw.js +1299 -0
  258. package/dist/chunk-hs8ph4p8.js +8 -0
  259. package/dist/chunk-ht1xwrnd.js +716 -0
  260. package/dist/chunk-hvmfg2dc.js +338 -0
  261. package/dist/chunk-hx2tr4ep.js +7189 -0
  262. package/dist/chunk-hzhe8ygc.js +547 -0
  263. package/dist/chunk-j2k4p94p.js +55 -0
  264. package/dist/chunk-j3a4p81y.js +184 -0
  265. package/dist/chunk-j49g6g3s.js +57 -0
  266. package/dist/chunk-j5d5hp9h.js +71 -0
  267. package/dist/chunk-j64ga6ta.js +8035 -0
  268. package/dist/chunk-j7tyxan1.js +116 -0
  269. package/dist/chunk-j8v4774z.js +424 -0
  270. package/dist/chunk-jafes477.js +29 -0
  271. package/dist/chunk-jd32zbps.js +15 -0
  272. package/dist/chunk-jdgeec04.js +4249 -0
  273. package/dist/chunk-jftd4jq5.js +4521 -0
  274. package/dist/chunk-jkxqhv6y.js +812 -0
  275. package/dist/chunk-jmfr6h0n.js +120 -0
  276. package/dist/chunk-jn4aabmx.js +40 -0
  277. package/dist/chunk-jnhkref0.js +30 -0
  278. package/dist/chunk-jsbpm1gz.js +27 -0
  279. package/dist/chunk-jtcyjc3k.js +5802 -0
  280. package/dist/chunk-jx817w05.js +11 -0
  281. package/dist/chunk-jzmz18nn.js +65 -0
  282. package/dist/chunk-k0p9w03v.js +4957 -0
  283. package/dist/chunk-k3dcdnck.js +89 -0
  284. package/dist/chunk-k3wadzcd.js +88 -0
  285. package/dist/chunk-kaeshsk1.js +713 -0
  286. package/dist/chunk-kbkey9ed.js +522 -0
  287. package/dist/chunk-kcwfhqbb.js +196 -0
  288. package/dist/chunk-key6jr7p.js +224 -0
  289. package/dist/chunk-knay8cy9.js +173 -0
  290. package/dist/chunk-kr3rg2y1.js +95 -0
  291. package/dist/chunk-kwekc97v.js +18 -0
  292. package/dist/chunk-m06q12hg.js +61 -0
  293. package/dist/chunk-m2mcpbhk.js +43 -0
  294. package/dist/chunk-m8v220gz.js +71 -0
  295. package/dist/chunk-mgpqy78h.js +208 -0
  296. package/dist/chunk-mkejwh4t.js +16 -0
  297. package/dist/chunk-mptyw5n1.js +107 -0
  298. package/dist/chunk-mqajm0dp.js +66 -0
  299. package/dist/chunk-mrksbgxj.js +490 -0
  300. package/dist/chunk-msjfc5ba.js +246 -0
  301. package/dist/chunk-mt25echc.js +6157 -0
  302. package/dist/chunk-mt3jfnr8.js +277 -0
  303. package/dist/chunk-mtn242d4.js +9300 -0
  304. package/dist/chunk-mzfkvave.js +169 -0
  305. package/dist/chunk-n0qaeaa5.js +256 -0
  306. package/dist/chunk-n1erf6kh.js +22820 -0
  307. package/dist/chunk-n2avk1r2.js +61 -0
  308. package/dist/chunk-n6atnpcq.js +765 -0
  309. package/dist/chunk-n7ttdtk0.js +641 -0
  310. package/dist/chunk-ncnfzby5.js +822 -0
  311. package/dist/chunk-ncnr1jtf.js +2058 -0
  312. package/dist/chunk-nerv0jvx.js +74 -0
  313. package/dist/chunk-ngd2abep.js +90 -0
  314. package/dist/chunk-nka1g8f4.js +773 -0
  315. package/dist/chunk-nnaxkc2z.js +128 -0
  316. package/dist/chunk-npyrtj8j.js +691 -0
  317. package/dist/chunk-nq0fxyxh.js +752 -0
  318. package/dist/chunk-nrmffak7.js +114 -0
  319. package/dist/chunk-nsz546wq.js +1170 -0
  320. package/dist/chunk-nt837qt9.js +21 -0
  321. package/dist/chunk-nv64x1z5.js +86 -0
  322. package/dist/chunk-nxsh6de2.js +1711 -0
  323. package/dist/chunk-nz4getcr.js +40 -0
  324. package/dist/chunk-p1f607pa.js +83 -0
  325. package/dist/chunk-p2816w9z.js +1486 -0
  326. package/dist/chunk-p2d5nh3g.js +342 -0
  327. package/dist/chunk-p4r5y02t.js +90 -0
  328. package/dist/chunk-p7g7pf3f.js +336 -0
  329. package/dist/chunk-pb4ad8r2.js +110 -0
  330. package/dist/chunk-pbrhz0zr.js +716 -0
  331. package/dist/chunk-ps49ymvj.js +43 -0
  332. package/dist/chunk-pwnt3veb.js +103 -0
  333. package/dist/chunk-pwwa7s62.js +11 -0
  334. package/dist/chunk-px3w0kde.js +299 -0
  335. package/dist/chunk-pzn777jb.js +756 -0
  336. package/dist/chunk-q25bjaev.js +15 -0
  337. package/dist/chunk-q5by3da6.js +8 -0
  338. package/dist/chunk-q6av622g.js +38 -0
  339. package/dist/chunk-q6xkvtf2.js +1318 -0
  340. package/dist/chunk-q81jx1tq.js +476 -0
  341. package/dist/chunk-qehb6fk5.js +339 -0
  342. package/dist/chunk-qj1avx1q.js +87 -0
  343. package/dist/chunk-qn2dxr66.js +105 -0
  344. package/dist/chunk-qnfx3qtx.js +617 -0
  345. package/dist/chunk-qp18kd4h.js +48 -0
  346. package/dist/chunk-qp2qdcda.js +100 -0
  347. package/dist/chunk-qpjy9tcf.js +133 -0
  348. package/dist/chunk-qqfa0dqg.js +2343 -0
  349. package/dist/chunk-qwh3htcz.js +202 -0
  350. package/dist/chunk-qz2x630m.js +49145 -0
  351. package/dist/chunk-r3vakcs1.js +496 -0
  352. package/dist/chunk-r66hz8j6.js +34 -0
  353. package/dist/chunk-r6b58y3x.js +17 -0
  354. package/dist/chunk-rekp48rk.js +62 -0
  355. package/dist/chunk-rn0v1hk8.js +34 -0
  356. package/dist/chunk-rs1xrs6m.js +534 -0
  357. package/dist/chunk-rs45skes.js +123 -0
  358. package/dist/chunk-rzszqp82.js +524 -0
  359. package/dist/chunk-s274nv8k.js +8 -0
  360. package/dist/chunk-s3pzvdss.js +50 -0
  361. package/dist/chunk-s9mesaw0.js +26840 -0
  362. package/dist/chunk-sd36yzx8.js +954 -0
  363. package/dist/chunk-sdj9b9wh.js +782 -0
  364. package/dist/chunk-sdw2q69p.js +227 -0
  365. package/dist/chunk-sfgp9cc0.js +130 -0
  366. package/dist/chunk-spqaamnc.js +63 -0
  367. package/dist/chunk-spzrs4df.js +73 -0
  368. package/dist/chunk-sxkr7k43.js +55 -0
  369. package/dist/chunk-szj5wvdy.js +28 -0
  370. package/dist/chunk-t0rgmccj.js +39 -0
  371. package/dist/chunk-t1nnzjgg.js +17 -0
  372. package/dist/chunk-t94fcnt8.js +566 -0
  373. package/dist/chunk-tjaqa99q.js +125 -0
  374. package/dist/chunk-tjq2evtw.js +328 -0
  375. package/dist/chunk-ts2p6bv1.js +224 -0
  376. package/dist/chunk-ttk5dzz8.js +25 -0
  377. package/dist/chunk-tw0q7ynt.js +59 -0
  378. package/dist/chunk-v02jkvgy.js +131 -0
  379. package/dist/chunk-v084bqt3.js +1529 -0
  380. package/dist/chunk-v0amythm.js +164 -0
  381. package/dist/chunk-v1kzp02e.js +785 -0
  382. package/dist/chunk-v1mgv1et.js +15 -0
  383. package/dist/chunk-v399mzxk.js +58 -0
  384. package/dist/chunk-v3gm2day.js +8 -0
  385. package/dist/chunk-v43hrrxp.js +71 -0
  386. package/dist/chunk-v6aqb2aj.js +102 -0
  387. package/dist/chunk-v78fj8by.js +145 -0
  388. package/dist/chunk-v7qmhjdn.js +1921 -0
  389. package/dist/chunk-v9smspw2.js +4301 -0
  390. package/dist/chunk-vdw93s4h.js +2431 -0
  391. package/dist/chunk-vest0y6x.js +3830 -0
  392. package/dist/chunk-vf5sd1nq.js +12 -0
  393. package/dist/chunk-vratq94g.js +349 -0
  394. package/dist/chunk-vrz7t3m3.js +20 -0
  395. package/dist/chunk-vtb185z9.js +70 -0
  396. package/dist/chunk-vx01rvg8.js +654 -0
  397. package/dist/chunk-vyc0rjyx.js +31 -0
  398. package/dist/chunk-vyjeh50y.js +2149 -0
  399. package/dist/chunk-vzpffsza.js +269 -0
  400. package/dist/chunk-w2ef3kxk.js +3353 -0
  401. package/dist/chunk-w2z5pqd3.js +336 -0
  402. package/dist/chunk-w3whm4mn.js +432 -0
  403. package/dist/chunk-w7wgpqcp.js +157 -0
  404. package/dist/chunk-waa00cvb.js +301 -0
  405. package/dist/chunk-wb0qm4es.js +155 -0
  406. package/dist/chunk-wbkahkdc.js +27 -0
  407. package/dist/chunk-wfz0qffj.js +3939 -0
  408. package/dist/chunk-wn0cx0pt.js +283 -0
  409. package/dist/chunk-wv6gzt9c.js +726 -0
  410. package/dist/chunk-wx42ycm4.js +998 -0
  411. package/dist/chunk-wxkpgy05.js +268 -0
  412. package/dist/chunk-wzpdet3m.js +843 -0
  413. package/dist/chunk-x0mwzt38.js +714 -0
  414. package/dist/chunk-x592wbfh.js +244 -0
  415. package/dist/chunk-x5pqsp9r.js +100 -0
  416. package/dist/chunk-x679thag.js +825 -0
  417. package/dist/chunk-x8b7vft8.js +132 -0
  418. package/dist/chunk-x8cftch7.js +119 -0
  419. package/dist/chunk-x9q7r885.js +348 -0
  420. package/dist/chunk-xawkt0vb.js +1585 -0
  421. package/dist/chunk-xdw5dv00.js +8 -0
  422. package/dist/chunk-xe9cc860.js +287 -0
  423. package/dist/chunk-xjr9c3vt.js +101 -0
  424. package/dist/chunk-xk7zaqta.js +21933 -0
  425. package/dist/chunk-xktbmawc.js +678 -0
  426. package/dist/chunk-xn6yw46v.js +140 -0
  427. package/dist/chunk-xsq9ae7x.js +90 -0
  428. package/dist/chunk-xszk7n10.js +14358 -0
  429. package/dist/chunk-xt8a5r1t.js +84 -0
  430. package/dist/chunk-xydyndkv.js +195 -0
  431. package/dist/chunk-xzt10yc5.js +60 -0
  432. package/dist/chunk-y04y95dr.js +91 -0
  433. package/dist/chunk-y1784krc.js +19 -0
  434. package/dist/chunk-y1x32h3x.js +128 -0
  435. package/dist/chunk-y3s7aww5.js +99 -0
  436. package/dist/chunk-y47cg3kz.js +42 -0
  437. package/dist/chunk-y7kzvepn.js +469 -0
  438. package/dist/chunk-y89kbsyc.js +287 -0
  439. package/dist/chunk-yd87p1c3.js +159 -0
  440. package/dist/chunk-yf3yw8fw.js +105 -0
  441. package/dist/chunk-ygbf0ezx.js +1391 -0
  442. package/dist/chunk-yjbxnshv.js +208 -0
  443. package/dist/chunk-ynednmqd.js +192 -0
  444. package/dist/chunk-yvhez44y.js +259 -0
  445. package/dist/chunk-ywxd4qw4.js +22 -0
  446. package/dist/chunk-yzrmgpy4.js +117 -0
  447. package/dist/chunk-z0b2vb24.js +862 -0
  448. package/dist/chunk-z1zj044v.js +655 -0
  449. package/dist/chunk-z2dp53wn.js +17 -0
  450. package/dist/chunk-z3w0xasa.js +165 -0
  451. package/dist/chunk-z7ycmrb3.js +644 -0
  452. package/dist/chunk-zh11tdkb.js +347 -0
  453. package/dist/chunk-zk2wsm7d.js +15 -0
  454. package/dist/chunk-zqfqcf22.js +229 -0
  455. package/dist/chunk-zqk2j8px.js +699 -0
  456. package/dist/chunk-zqvsc10j.js +2833 -0
  457. package/dist/chunk-zsfxha74.js +17655 -0
  458. package/dist/chunk-zvc4snyb.js +117 -0
  459. package/dist/cli.js +194 -0
  460. package/package.json +173 -0
@@ -0,0 +1,4301 @@
1
+ // @bun
2
+ import {
3
+ __commonJS,
4
+ __esm,
5
+ __export
6
+ } from "./chunk-qp2qdcda.js";
7
+
8
+ // node_modules/.bun/ignore@7.0.5/node_modules/ignore/index.js
9
+ var require_ignore = __commonJS((exports, module) => {
10
+ function makeArray(subject) {
11
+ return Array.isArray(subject) ? subject : [subject];
12
+ }
13
+ var UNDEFINED = undefined;
14
+ var EMPTY = "";
15
+ var SPACE = " ";
16
+ var ESCAPE = "\\";
17
+ var REGEX_TEST_BLANK_LINE = /^\s+$/;
18
+ var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
19
+ var REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/;
20
+ var REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/;
21
+ var REGEX_SPLITALL_CRLF = /\r?\n/g;
22
+ var REGEX_TEST_INVALID_PATH = /^\.{0,2}\/|^\.{1,2}$/;
23
+ var REGEX_TEST_TRAILING_SLASH = /\/$/;
24
+ var SLASH = "/";
25
+ var TMP_KEY_IGNORE = "node-ignore";
26
+ if (typeof Symbol !== "undefined") {
27
+ TMP_KEY_IGNORE = Symbol.for("node-ignore");
28
+ }
29
+ var KEY_IGNORE = TMP_KEY_IGNORE;
30
+ var define = (object, key, value) => {
31
+ Object.defineProperty(object, key, { value });
32
+ return value;
33
+ };
34
+ var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
35
+ var RETURN_FALSE = () => false;
36
+ var sanitizeRange = (range) => range.replace(REGEX_REGEXP_RANGE, (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0) ? match : EMPTY);
37
+ var cleanRangeBackSlash = (slashes) => {
38
+ const { length } = slashes;
39
+ return slashes.slice(0, length - length % 2);
40
+ };
41
+ var REPLACERS = [
42
+ [
43
+ /^\uFEFF/,
44
+ () => EMPTY
45
+ ],
46
+ [
47
+ /((?:\\\\)*?)(\\?\s+)$/,
48
+ (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
49
+ ],
50
+ [
51
+ /(\\+?)\s/g,
52
+ (_, m1) => {
53
+ const { length } = m1;
54
+ return m1.slice(0, length - length % 2) + SPACE;
55
+ }
56
+ ],
57
+ [
58
+ /[\\$.|*+(){^]/g,
59
+ (match) => `\\${match}`
60
+ ],
61
+ [
62
+ /(?!\\)\?/g,
63
+ () => "[^/]"
64
+ ],
65
+ [
66
+ /^\//,
67
+ () => "^"
68
+ ],
69
+ [
70
+ /\//g,
71
+ () => "\\/"
72
+ ],
73
+ [
74
+ /^\^*\\\*\\\*\\\//,
75
+ () => "^(?:.*\\/)?"
76
+ ],
77
+ [
78
+ /^(?=[^^])/,
79
+ function startingReplacer() {
80
+ return !/\/(?!$)/.test(this) ? "(?:^|\\/)" : "^";
81
+ }
82
+ ],
83
+ [
84
+ /\\\/\\\*\\\*(?=\\\/|$)/g,
85
+ (_, index, str) => index + 6 < str.length ? "(?:\\/[^\\/]+)*" : "\\/.+"
86
+ ],
87
+ [
88
+ /(^|[^\\]+)(\\\*)+(?=.+)/g,
89
+ (_, p1, p2) => {
90
+ const unescaped = p2.replace(/\\\*/g, "[^\\/]*");
91
+ return p1 + unescaped;
92
+ }
93
+ ],
94
+ [
95
+ /\\\\\\(?=[$.|*+(){^])/g,
96
+ () => ESCAPE
97
+ ],
98
+ [
99
+ /\\\\/g,
100
+ () => ESCAPE
101
+ ],
102
+ [
103
+ /(\\)?\[([^\]/]*?)(\\*)($|\])/g,
104
+ (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE ? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}` : close === "]" ? endEscape.length % 2 === 0 ? `[${sanitizeRange(range)}${endEscape}]` : "[]" : "[]"
105
+ ],
106
+ [
107
+ /(?:[^*])$/,
108
+ (match) => /\/$/.test(match) ? `${match}$` : `${match}(?=$|\\/$)`
109
+ ]
110
+ ];
111
+ var REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\/)?\\\*$/;
112
+ var MODE_IGNORE = "regex";
113
+ var MODE_CHECK_IGNORE = "checkRegex";
114
+ var UNDERSCORE = "_";
115
+ var TRAILING_WILD_CARD_REPLACERS = {
116
+ [MODE_IGNORE](_, p1) {
117
+ const prefix = p1 ? `${p1}[^/]+` : "[^/]*";
118
+ return `${prefix}(?=$|\\/$)`;
119
+ },
120
+ [MODE_CHECK_IGNORE](_, p1) {
121
+ const prefix = p1 ? `${p1}[^/]*` : "[^/]*";
122
+ return `${prefix}(?=$|\\/$)`;
123
+ }
124
+ };
125
+ var makeRegexPrefix = (pattern) => REPLACERS.reduce((prev, [matcher, replacer]) => prev.replace(matcher, replacer.bind(pattern)), pattern);
126
+ var isString = (subject) => typeof subject === "string";
127
+ var checkPattern = (pattern) => pattern && isString(pattern) && !REGEX_TEST_BLANK_LINE.test(pattern) && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern) && pattern.indexOf("#") !== 0;
128
+ var splitPattern = (pattern) => pattern.split(REGEX_SPLITALL_CRLF).filter(Boolean);
129
+
130
+ class IgnoreRule {
131
+ constructor(pattern, mark, body, ignoreCase, negative, prefix) {
132
+ this.pattern = pattern;
133
+ this.mark = mark;
134
+ this.negative = negative;
135
+ define(this, "body", body);
136
+ define(this, "ignoreCase", ignoreCase);
137
+ define(this, "regexPrefix", prefix);
138
+ }
139
+ get regex() {
140
+ const key = UNDERSCORE + MODE_IGNORE;
141
+ if (this[key]) {
142
+ return this[key];
143
+ }
144
+ return this._make(MODE_IGNORE, key);
145
+ }
146
+ get checkRegex() {
147
+ const key = UNDERSCORE + MODE_CHECK_IGNORE;
148
+ if (this[key]) {
149
+ return this[key];
150
+ }
151
+ return this._make(MODE_CHECK_IGNORE, key);
152
+ }
153
+ _make(mode, key) {
154
+ const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
155
+ const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
156
+ return define(this, key, regex);
157
+ }
158
+ }
159
+ var createRule = ({
160
+ pattern,
161
+ mark
162
+ }, ignoreCase) => {
163
+ let negative = false;
164
+ let body = pattern;
165
+ if (body.indexOf("!") === 0) {
166
+ negative = true;
167
+ body = body.substr(1);
168
+ }
169
+ body = body.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, "!").replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, "#");
170
+ const regexPrefix = makeRegexPrefix(body);
171
+ return new IgnoreRule(pattern, mark, body, ignoreCase, negative, regexPrefix);
172
+ };
173
+
174
+ class RuleManager {
175
+ constructor(ignoreCase) {
176
+ this._ignoreCase = ignoreCase;
177
+ this._rules = [];
178
+ }
179
+ _add(pattern) {
180
+ if (pattern && pattern[KEY_IGNORE]) {
181
+ this._rules = this._rules.concat(pattern._rules._rules);
182
+ this._added = true;
183
+ return;
184
+ }
185
+ if (isString(pattern)) {
186
+ pattern = {
187
+ pattern
188
+ };
189
+ }
190
+ if (checkPattern(pattern.pattern)) {
191
+ const rule = createRule(pattern, this._ignoreCase);
192
+ this._added = true;
193
+ this._rules.push(rule);
194
+ }
195
+ }
196
+ add(pattern) {
197
+ this._added = false;
198
+ makeArray(isString(pattern) ? splitPattern(pattern) : pattern).forEach(this._add, this);
199
+ return this._added;
200
+ }
201
+ test(path, checkUnignored, mode) {
202
+ let ignored = false;
203
+ let unignored = false;
204
+ let matchedRule;
205
+ this._rules.forEach((rule) => {
206
+ const { negative } = rule;
207
+ if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
208
+ return;
209
+ }
210
+ const matched = rule[mode].test(path);
211
+ if (!matched) {
212
+ return;
213
+ }
214
+ ignored = !negative;
215
+ unignored = negative;
216
+ matchedRule = negative ? UNDEFINED : rule;
217
+ });
218
+ const ret = {
219
+ ignored,
220
+ unignored
221
+ };
222
+ if (matchedRule) {
223
+ ret.rule = matchedRule;
224
+ }
225
+ return ret;
226
+ }
227
+ }
228
+ var throwError = (message, Ctor) => {
229
+ throw new Ctor(message);
230
+ };
231
+ var checkPath = (path, originalPath, doThrow) => {
232
+ if (!isString(path)) {
233
+ return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
234
+ }
235
+ if (!path) {
236
+ return doThrow(`path must not be empty`, TypeError);
237
+ }
238
+ if (checkPath.isNotRelative(path)) {
239
+ const r = "`path.relative()`d";
240
+ return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
241
+ }
242
+ return true;
243
+ };
244
+ var isNotRelative = (path) => REGEX_TEST_INVALID_PATH.test(path);
245
+ checkPath.isNotRelative = isNotRelative;
246
+ checkPath.convert = (p) => p;
247
+
248
+ class Ignore {
249
+ constructor({
250
+ ignorecase = true,
251
+ ignoreCase = ignorecase,
252
+ allowRelativePaths = false
253
+ } = {}) {
254
+ define(this, KEY_IGNORE, true);
255
+ this._rules = new RuleManager(ignoreCase);
256
+ this._strictPathCheck = !allowRelativePaths;
257
+ this._initCache();
258
+ }
259
+ _initCache() {
260
+ this._ignoreCache = Object.create(null);
261
+ this._testCache = Object.create(null);
262
+ }
263
+ add(pattern) {
264
+ if (this._rules.add(pattern)) {
265
+ this._initCache();
266
+ }
267
+ return this;
268
+ }
269
+ addPattern(pattern) {
270
+ return this.add(pattern);
271
+ }
272
+ _test(originalPath, cache, checkUnignored, slices) {
273
+ const path = originalPath && checkPath.convert(originalPath);
274
+ checkPath(path, originalPath, this._strictPathCheck ? throwError : RETURN_FALSE);
275
+ return this._t(path, cache, checkUnignored, slices);
276
+ }
277
+ checkIgnore(path) {
278
+ if (!REGEX_TEST_TRAILING_SLASH.test(path)) {
279
+ return this.test(path);
280
+ }
281
+ const slices = path.split(SLASH).filter(Boolean);
282
+ slices.pop();
283
+ if (slices.length) {
284
+ const parent = this._t(slices.join(SLASH) + SLASH, this._testCache, true, slices);
285
+ if (parent.ignored) {
286
+ return parent;
287
+ }
288
+ }
289
+ return this._rules.test(path, false, MODE_CHECK_IGNORE);
290
+ }
291
+ _t(path, cache, checkUnignored, slices) {
292
+ if (path in cache) {
293
+ return cache[path];
294
+ }
295
+ if (!slices) {
296
+ slices = path.split(SLASH).filter(Boolean);
297
+ }
298
+ slices.pop();
299
+ if (!slices.length) {
300
+ return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE);
301
+ }
302
+ const parent = this._t(slices.join(SLASH) + SLASH, cache, checkUnignored, slices);
303
+ return cache[path] = parent.ignored ? parent : this._rules.test(path, checkUnignored, MODE_IGNORE);
304
+ }
305
+ ignores(path) {
306
+ return this._test(path, this._ignoreCache, false).ignored;
307
+ }
308
+ createFilter() {
309
+ return (path) => !this.ignores(path);
310
+ }
311
+ filter(paths) {
312
+ return makeArray(paths).filter(this.createFilter());
313
+ }
314
+ test(path) {
315
+ return this._test(path, this._testCache, true);
316
+ }
317
+ }
318
+ var factory = (options) => new Ignore(options);
319
+ var isPathValid = (path) => checkPath(path && checkPath.convert(path), path, RETURN_FALSE);
320
+ var setupWindows = () => {
321
+ const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
322
+ checkPath.convert = makePosix;
323
+ const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
324
+ checkPath.isNotRelative = (path) => REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path) || isNotRelative(path);
325
+ };
326
+ if (typeof process !== "undefined" && process.platform === "win32") {
327
+ setupWindows();
328
+ }
329
+ module.exports = factory;
330
+ factory.default = factory;
331
+ module.exports.isPathValid = isPathValid;
332
+ define(module.exports, Symbol.for("setupWindows"), setupWindows);
333
+ });
334
+
335
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
336
+ var util, objectUtil, ZodParsedType, getParsedType = (data) => {
337
+ const t = typeof data;
338
+ switch (t) {
339
+ case "undefined":
340
+ return ZodParsedType.undefined;
341
+ case "string":
342
+ return ZodParsedType.string;
343
+ case "number":
344
+ return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
345
+ case "boolean":
346
+ return ZodParsedType.boolean;
347
+ case "function":
348
+ return ZodParsedType.function;
349
+ case "bigint":
350
+ return ZodParsedType.bigint;
351
+ case "symbol":
352
+ return ZodParsedType.symbol;
353
+ case "object":
354
+ if (Array.isArray(data)) {
355
+ return ZodParsedType.array;
356
+ }
357
+ if (data === null) {
358
+ return ZodParsedType.null;
359
+ }
360
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
361
+ return ZodParsedType.promise;
362
+ }
363
+ if (typeof Map !== "undefined" && data instanceof Map) {
364
+ return ZodParsedType.map;
365
+ }
366
+ if (typeof Set !== "undefined" && data instanceof Set) {
367
+ return ZodParsedType.set;
368
+ }
369
+ if (typeof Date !== "undefined" && data instanceof Date) {
370
+ return ZodParsedType.date;
371
+ }
372
+ return ZodParsedType.object;
373
+ default:
374
+ return ZodParsedType.unknown;
375
+ }
376
+ };
377
+ var init_util = __esm(() => {
378
+ (function(util2) {
379
+ util2.assertEqual = (_) => {};
380
+ function assertIs(_arg) {}
381
+ util2.assertIs = assertIs;
382
+ function assertNever(_x) {
383
+ throw new Error;
384
+ }
385
+ util2.assertNever = assertNever;
386
+ util2.arrayToEnum = (items) => {
387
+ const obj = {};
388
+ for (const item of items) {
389
+ obj[item] = item;
390
+ }
391
+ return obj;
392
+ };
393
+ util2.getValidEnumValues = (obj) => {
394
+ const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
395
+ const filtered = {};
396
+ for (const k of validKeys) {
397
+ filtered[k] = obj[k];
398
+ }
399
+ return util2.objectValues(filtered);
400
+ };
401
+ util2.objectValues = (obj) => {
402
+ return util2.objectKeys(obj).map(function(e) {
403
+ return obj[e];
404
+ });
405
+ };
406
+ util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
407
+ const keys = [];
408
+ for (const key in object) {
409
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
410
+ keys.push(key);
411
+ }
412
+ }
413
+ return keys;
414
+ };
415
+ util2.find = (arr, checker) => {
416
+ for (const item of arr) {
417
+ if (checker(item))
418
+ return item;
419
+ }
420
+ return;
421
+ };
422
+ util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
423
+ function joinValues(array, separator = " | ") {
424
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
425
+ }
426
+ util2.joinValues = joinValues;
427
+ util2.jsonStringifyReplacer = (_, value) => {
428
+ if (typeof value === "bigint") {
429
+ return value.toString();
430
+ }
431
+ return value;
432
+ };
433
+ })(util || (util = {}));
434
+ (function(objectUtil2) {
435
+ objectUtil2.mergeShapes = (first, second) => {
436
+ return {
437
+ ...first,
438
+ ...second
439
+ };
440
+ };
441
+ })(objectUtil || (objectUtil = {}));
442
+ ZodParsedType = util.arrayToEnum([
443
+ "string",
444
+ "nan",
445
+ "number",
446
+ "integer",
447
+ "float",
448
+ "boolean",
449
+ "date",
450
+ "bigint",
451
+ "symbol",
452
+ "function",
453
+ "undefined",
454
+ "null",
455
+ "array",
456
+ "object",
457
+ "unknown",
458
+ "promise",
459
+ "void",
460
+ "never",
461
+ "map",
462
+ "set"
463
+ ]);
464
+ });
465
+
466
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/ZodError.js
467
+ var ZodIssueCode, quotelessJson = (obj) => {
468
+ const json = JSON.stringify(obj, null, 2);
469
+ return json.replace(/"([^"]+)":/g, "$1:");
470
+ }, ZodError;
471
+ var init_ZodError = __esm(() => {
472
+ init_util();
473
+ ZodIssueCode = util.arrayToEnum([
474
+ "invalid_type",
475
+ "invalid_literal",
476
+ "custom",
477
+ "invalid_union",
478
+ "invalid_union_discriminator",
479
+ "invalid_enum_value",
480
+ "unrecognized_keys",
481
+ "invalid_arguments",
482
+ "invalid_return_type",
483
+ "invalid_date",
484
+ "invalid_string",
485
+ "too_small",
486
+ "too_big",
487
+ "invalid_intersection_types",
488
+ "not_multiple_of",
489
+ "not_finite"
490
+ ]);
491
+ ZodError = class ZodError extends Error {
492
+ get errors() {
493
+ return this.issues;
494
+ }
495
+ constructor(issues) {
496
+ super();
497
+ this.issues = [];
498
+ this.addIssue = (sub) => {
499
+ this.issues = [...this.issues, sub];
500
+ };
501
+ this.addIssues = (subs = []) => {
502
+ this.issues = [...this.issues, ...subs];
503
+ };
504
+ const actualProto = new.target.prototype;
505
+ if (Object.setPrototypeOf) {
506
+ Object.setPrototypeOf(this, actualProto);
507
+ } else {
508
+ this.__proto__ = actualProto;
509
+ }
510
+ this.name = "ZodError";
511
+ this.issues = issues;
512
+ }
513
+ format(_mapper) {
514
+ const mapper = _mapper || function(issue) {
515
+ return issue.message;
516
+ };
517
+ const fieldErrors = { _errors: [] };
518
+ const processError = (error) => {
519
+ for (const issue of error.issues) {
520
+ if (issue.code === "invalid_union") {
521
+ issue.unionErrors.map(processError);
522
+ } else if (issue.code === "invalid_return_type") {
523
+ processError(issue.returnTypeError);
524
+ } else if (issue.code === "invalid_arguments") {
525
+ processError(issue.argumentsError);
526
+ } else if (issue.path.length === 0) {
527
+ fieldErrors._errors.push(mapper(issue));
528
+ } else {
529
+ let curr = fieldErrors;
530
+ let i = 0;
531
+ while (i < issue.path.length) {
532
+ const el = issue.path[i];
533
+ const terminal = i === issue.path.length - 1;
534
+ if (!terminal) {
535
+ curr[el] = curr[el] || { _errors: [] };
536
+ } else {
537
+ curr[el] = curr[el] || { _errors: [] };
538
+ curr[el]._errors.push(mapper(issue));
539
+ }
540
+ curr = curr[el];
541
+ i++;
542
+ }
543
+ }
544
+ }
545
+ };
546
+ processError(this);
547
+ return fieldErrors;
548
+ }
549
+ static assert(value) {
550
+ if (!(value instanceof ZodError)) {
551
+ throw new Error(`Not a ZodError: ${value}`);
552
+ }
553
+ }
554
+ toString() {
555
+ return this.message;
556
+ }
557
+ get message() {
558
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
559
+ }
560
+ get isEmpty() {
561
+ return this.issues.length === 0;
562
+ }
563
+ flatten(mapper = (issue) => issue.message) {
564
+ const fieldErrors = {};
565
+ const formErrors = [];
566
+ for (const sub of this.issues) {
567
+ if (sub.path.length > 0) {
568
+ const firstEl = sub.path[0];
569
+ fieldErrors[firstEl] = fieldErrors[firstEl] || [];
570
+ fieldErrors[firstEl].push(mapper(sub));
571
+ } else {
572
+ formErrors.push(mapper(sub));
573
+ }
574
+ }
575
+ return { formErrors, fieldErrors };
576
+ }
577
+ get formErrors() {
578
+ return this.flatten();
579
+ }
580
+ };
581
+ ZodError.create = (issues) => {
582
+ const error = new ZodError(issues);
583
+ return error;
584
+ };
585
+ });
586
+
587
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/locales/en.js
588
+ var errorMap = (issue, _ctx) => {
589
+ let message;
590
+ switch (issue.code) {
591
+ case ZodIssueCode.invalid_type:
592
+ if (issue.received === ZodParsedType.undefined) {
593
+ message = "Required";
594
+ } else {
595
+ message = `Expected ${issue.expected}, received ${issue.received}`;
596
+ }
597
+ break;
598
+ case ZodIssueCode.invalid_literal:
599
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
600
+ break;
601
+ case ZodIssueCode.unrecognized_keys:
602
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
603
+ break;
604
+ case ZodIssueCode.invalid_union:
605
+ message = `Invalid input`;
606
+ break;
607
+ case ZodIssueCode.invalid_union_discriminator:
608
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
609
+ break;
610
+ case ZodIssueCode.invalid_enum_value:
611
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
612
+ break;
613
+ case ZodIssueCode.invalid_arguments:
614
+ message = `Invalid function arguments`;
615
+ break;
616
+ case ZodIssueCode.invalid_return_type:
617
+ message = `Invalid function return type`;
618
+ break;
619
+ case ZodIssueCode.invalid_date:
620
+ message = `Invalid date`;
621
+ break;
622
+ case ZodIssueCode.invalid_string:
623
+ if (typeof issue.validation === "object") {
624
+ if ("includes" in issue.validation) {
625
+ message = `Invalid input: must include "${issue.validation.includes}"`;
626
+ if (typeof issue.validation.position === "number") {
627
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
628
+ }
629
+ } else if ("startsWith" in issue.validation) {
630
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
631
+ } else if ("endsWith" in issue.validation) {
632
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
633
+ } else {
634
+ util.assertNever(issue.validation);
635
+ }
636
+ } else if (issue.validation !== "regex") {
637
+ message = `Invalid ${issue.validation}`;
638
+ } else {
639
+ message = "Invalid";
640
+ }
641
+ break;
642
+ case ZodIssueCode.too_small:
643
+ if (issue.type === "array")
644
+ message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
645
+ else if (issue.type === "string")
646
+ message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
647
+ else if (issue.type === "number")
648
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
649
+ else if (issue.type === "bigint")
650
+ message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
651
+ else if (issue.type === "date")
652
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
653
+ else
654
+ message = "Invalid input";
655
+ break;
656
+ case ZodIssueCode.too_big:
657
+ if (issue.type === "array")
658
+ message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
659
+ else if (issue.type === "string")
660
+ message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
661
+ else if (issue.type === "number")
662
+ message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
663
+ else if (issue.type === "bigint")
664
+ message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
665
+ else if (issue.type === "date")
666
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
667
+ else
668
+ message = "Invalid input";
669
+ break;
670
+ case ZodIssueCode.custom:
671
+ message = `Invalid input`;
672
+ break;
673
+ case ZodIssueCode.invalid_intersection_types:
674
+ message = `Intersection results could not be merged`;
675
+ break;
676
+ case ZodIssueCode.not_multiple_of:
677
+ message = `Number must be a multiple of ${issue.multipleOf}`;
678
+ break;
679
+ case ZodIssueCode.not_finite:
680
+ message = "Number must be finite";
681
+ break;
682
+ default:
683
+ message = _ctx.defaultError;
684
+ util.assertNever(issue);
685
+ }
686
+ return { message };
687
+ }, en_default;
688
+ var init_en = __esm(() => {
689
+ init_ZodError();
690
+ init_util();
691
+ en_default = errorMap;
692
+ });
693
+
694
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/errors.js
695
+ function setErrorMap(map) {
696
+ overrideErrorMap = map;
697
+ }
698
+ function getErrorMap() {
699
+ return overrideErrorMap;
700
+ }
701
+ var overrideErrorMap;
702
+ var init_errors = __esm(() => {
703
+ init_en();
704
+ overrideErrorMap = en_default;
705
+ });
706
+
707
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.js
708
+ var errorUtil;
709
+ var init_errorUtil = __esm(() => {
710
+ (function(errorUtil2) {
711
+ errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
712
+ errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
713
+ })(errorUtil || (errorUtil = {}));
714
+ });
715
+
716
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
717
+ function addIssueToContext(ctx, issueData) {
718
+ const overrideMap = getErrorMap();
719
+ const issue = makeIssue({
720
+ issueData,
721
+ data: ctx.data,
722
+ path: ctx.path,
723
+ errorMaps: [
724
+ ctx.common.contextualErrorMap,
725
+ ctx.schemaErrorMap,
726
+ overrideMap,
727
+ overrideMap === en_default ? undefined : en_default
728
+ ].filter((x) => !!x)
729
+ });
730
+ ctx.common.issues.push(issue);
731
+ }
732
+
733
+ class ParseStatus {
734
+ constructor() {
735
+ this.value = "valid";
736
+ }
737
+ dirty() {
738
+ if (this.value === "valid")
739
+ this.value = "dirty";
740
+ }
741
+ abort() {
742
+ if (this.value !== "aborted")
743
+ this.value = "aborted";
744
+ }
745
+ static mergeArray(status, results) {
746
+ const arrayValue = [];
747
+ for (const s of results) {
748
+ if (s.status === "aborted")
749
+ return INVALID;
750
+ if (s.status === "dirty")
751
+ status.dirty();
752
+ arrayValue.push(s.value);
753
+ }
754
+ return { status: status.value, value: arrayValue };
755
+ }
756
+ static async mergeObjectAsync(status, pairs) {
757
+ const syncPairs = [];
758
+ for (const pair of pairs) {
759
+ const key = await pair.key;
760
+ const value = await pair.value;
761
+ syncPairs.push({
762
+ key,
763
+ value
764
+ });
765
+ }
766
+ return ParseStatus.mergeObjectSync(status, syncPairs);
767
+ }
768
+ static mergeObjectSync(status, pairs) {
769
+ const finalObject = {};
770
+ for (const pair of pairs) {
771
+ const { key, value } = pair;
772
+ if (key.status === "aborted")
773
+ return INVALID;
774
+ if (value.status === "aborted")
775
+ return INVALID;
776
+ if (key.status === "dirty")
777
+ status.dirty();
778
+ if (value.status === "dirty")
779
+ status.dirty();
780
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
781
+ finalObject[key.value] = value.value;
782
+ }
783
+ }
784
+ return { status: status.value, value: finalObject };
785
+ }
786
+ }
787
+ var makeIssue = (params) => {
788
+ const { data, path, errorMaps, issueData } = params;
789
+ const fullPath = [...path, ...issueData.path || []];
790
+ const fullIssue = {
791
+ ...issueData,
792
+ path: fullPath
793
+ };
794
+ if (issueData.message !== undefined) {
795
+ return {
796
+ ...issueData,
797
+ path: fullPath,
798
+ message: issueData.message
799
+ };
800
+ }
801
+ let errorMessage = "";
802
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
803
+ for (const map of maps) {
804
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
805
+ }
806
+ return {
807
+ ...issueData,
808
+ path: fullPath,
809
+ message: errorMessage
810
+ };
811
+ }, EMPTY_PATH, INVALID, DIRTY = (value) => ({ status: "dirty", value }), OK = (value) => ({ status: "valid", value }), isAborted = (x) => x.status === "aborted", isDirty = (x) => x.status === "dirty", isValid = (x) => x.status === "valid", isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
812
+ var init_parseUtil = __esm(() => {
813
+ init_errors();
814
+ init_en();
815
+ EMPTY_PATH = [];
816
+ INVALID = Object.freeze({
817
+ status: "aborted"
818
+ });
819
+ });
820
+
821
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/types.js
822
+ class ParseInputLazyPath {
823
+ constructor(parent, value, path, key) {
824
+ this._cachedPath = [];
825
+ this.parent = parent;
826
+ this.data = value;
827
+ this._path = path;
828
+ this._key = key;
829
+ }
830
+ get path() {
831
+ if (!this._cachedPath.length) {
832
+ if (Array.isArray(this._key)) {
833
+ this._cachedPath.push(...this._path, ...this._key);
834
+ } else {
835
+ this._cachedPath.push(...this._path, this._key);
836
+ }
837
+ }
838
+ return this._cachedPath;
839
+ }
840
+ }
841
+ function processCreateParams(params) {
842
+ if (!params)
843
+ return {};
844
+ const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
845
+ if (errorMap2 && (invalid_type_error || required_error)) {
846
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
847
+ }
848
+ if (errorMap2)
849
+ return { errorMap: errorMap2, description };
850
+ const customMap = (iss, ctx) => {
851
+ const { message } = params;
852
+ if (iss.code === "invalid_enum_value") {
853
+ return { message: message ?? ctx.defaultError };
854
+ }
855
+ if (typeof ctx.data === "undefined") {
856
+ return { message: message ?? required_error ?? ctx.defaultError };
857
+ }
858
+ if (iss.code !== "invalid_type")
859
+ return { message: ctx.defaultError };
860
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
861
+ };
862
+ return { errorMap: customMap, description };
863
+ }
864
+
865
+ class ZodType {
866
+ get description() {
867
+ return this._def.description;
868
+ }
869
+ _getType(input) {
870
+ return getParsedType(input.data);
871
+ }
872
+ _getOrReturnCtx(input, ctx) {
873
+ return ctx || {
874
+ common: input.parent.common,
875
+ data: input.data,
876
+ parsedType: getParsedType(input.data),
877
+ schemaErrorMap: this._def.errorMap,
878
+ path: input.path,
879
+ parent: input.parent
880
+ };
881
+ }
882
+ _processInputParams(input) {
883
+ return {
884
+ status: new ParseStatus,
885
+ ctx: {
886
+ common: input.parent.common,
887
+ data: input.data,
888
+ parsedType: getParsedType(input.data),
889
+ schemaErrorMap: this._def.errorMap,
890
+ path: input.path,
891
+ parent: input.parent
892
+ }
893
+ };
894
+ }
895
+ _parseSync(input) {
896
+ const result = this._parse(input);
897
+ if (isAsync(result)) {
898
+ throw new Error("Synchronous parse encountered promise.");
899
+ }
900
+ return result;
901
+ }
902
+ _parseAsync(input) {
903
+ const result = this._parse(input);
904
+ return Promise.resolve(result);
905
+ }
906
+ parse(data, params) {
907
+ const result = this.safeParse(data, params);
908
+ if (result.success)
909
+ return result.data;
910
+ throw result.error;
911
+ }
912
+ safeParse(data, params) {
913
+ const ctx = {
914
+ common: {
915
+ issues: [],
916
+ async: params?.async ?? false,
917
+ contextualErrorMap: params?.errorMap
918
+ },
919
+ path: params?.path || [],
920
+ schemaErrorMap: this._def.errorMap,
921
+ parent: null,
922
+ data,
923
+ parsedType: getParsedType(data)
924
+ };
925
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
926
+ return handleResult(ctx, result);
927
+ }
928
+ "~validate"(data) {
929
+ const ctx = {
930
+ common: {
931
+ issues: [],
932
+ async: !!this["~standard"].async
933
+ },
934
+ path: [],
935
+ schemaErrorMap: this._def.errorMap,
936
+ parent: null,
937
+ data,
938
+ parsedType: getParsedType(data)
939
+ };
940
+ if (!this["~standard"].async) {
941
+ try {
942
+ const result = this._parseSync({ data, path: [], parent: ctx });
943
+ return isValid(result) ? {
944
+ value: result.value
945
+ } : {
946
+ issues: ctx.common.issues
947
+ };
948
+ } catch (err) {
949
+ if (err?.message?.toLowerCase()?.includes("encountered")) {
950
+ this["~standard"].async = true;
951
+ }
952
+ ctx.common = {
953
+ issues: [],
954
+ async: true
955
+ };
956
+ }
957
+ }
958
+ return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
959
+ value: result.value
960
+ } : {
961
+ issues: ctx.common.issues
962
+ });
963
+ }
964
+ async parseAsync(data, params) {
965
+ const result = await this.safeParseAsync(data, params);
966
+ if (result.success)
967
+ return result.data;
968
+ throw result.error;
969
+ }
970
+ async safeParseAsync(data, params) {
971
+ const ctx = {
972
+ common: {
973
+ issues: [],
974
+ contextualErrorMap: params?.errorMap,
975
+ async: true
976
+ },
977
+ path: params?.path || [],
978
+ schemaErrorMap: this._def.errorMap,
979
+ parent: null,
980
+ data,
981
+ parsedType: getParsedType(data)
982
+ };
983
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
984
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
985
+ return handleResult(ctx, result);
986
+ }
987
+ refine(check, message) {
988
+ const getIssueProperties = (val) => {
989
+ if (typeof message === "string" || typeof message === "undefined") {
990
+ return { message };
991
+ } else if (typeof message === "function") {
992
+ return message(val);
993
+ } else {
994
+ return message;
995
+ }
996
+ };
997
+ return this._refinement((val, ctx) => {
998
+ const result = check(val);
999
+ const setError = () => ctx.addIssue({
1000
+ code: ZodIssueCode.custom,
1001
+ ...getIssueProperties(val)
1002
+ });
1003
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
1004
+ return result.then((data) => {
1005
+ if (!data) {
1006
+ setError();
1007
+ return false;
1008
+ } else {
1009
+ return true;
1010
+ }
1011
+ });
1012
+ }
1013
+ if (!result) {
1014
+ setError();
1015
+ return false;
1016
+ } else {
1017
+ return true;
1018
+ }
1019
+ });
1020
+ }
1021
+ refinement(check, refinementData) {
1022
+ return this._refinement((val, ctx) => {
1023
+ if (!check(val)) {
1024
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
1025
+ return false;
1026
+ } else {
1027
+ return true;
1028
+ }
1029
+ });
1030
+ }
1031
+ _refinement(refinement) {
1032
+ return new ZodEffects({
1033
+ schema: this,
1034
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
1035
+ effect: { type: "refinement", refinement }
1036
+ });
1037
+ }
1038
+ superRefine(refinement) {
1039
+ return this._refinement(refinement);
1040
+ }
1041
+ constructor(def) {
1042
+ this.spa = this.safeParseAsync;
1043
+ this._def = def;
1044
+ this.parse = this.parse.bind(this);
1045
+ this.safeParse = this.safeParse.bind(this);
1046
+ this.parseAsync = this.parseAsync.bind(this);
1047
+ this.safeParseAsync = this.safeParseAsync.bind(this);
1048
+ this.spa = this.spa.bind(this);
1049
+ this.refine = this.refine.bind(this);
1050
+ this.refinement = this.refinement.bind(this);
1051
+ this.superRefine = this.superRefine.bind(this);
1052
+ this.optional = this.optional.bind(this);
1053
+ this.nullable = this.nullable.bind(this);
1054
+ this.nullish = this.nullish.bind(this);
1055
+ this.array = this.array.bind(this);
1056
+ this.promise = this.promise.bind(this);
1057
+ this.or = this.or.bind(this);
1058
+ this.and = this.and.bind(this);
1059
+ this.transform = this.transform.bind(this);
1060
+ this.brand = this.brand.bind(this);
1061
+ this.default = this.default.bind(this);
1062
+ this.catch = this.catch.bind(this);
1063
+ this.describe = this.describe.bind(this);
1064
+ this.pipe = this.pipe.bind(this);
1065
+ this.readonly = this.readonly.bind(this);
1066
+ this.isNullable = this.isNullable.bind(this);
1067
+ this.isOptional = this.isOptional.bind(this);
1068
+ this["~standard"] = {
1069
+ version: 1,
1070
+ vendor: "zod",
1071
+ validate: (data) => this["~validate"](data)
1072
+ };
1073
+ }
1074
+ optional() {
1075
+ return ZodOptional.create(this, this._def);
1076
+ }
1077
+ nullable() {
1078
+ return ZodNullable.create(this, this._def);
1079
+ }
1080
+ nullish() {
1081
+ return this.nullable().optional();
1082
+ }
1083
+ array() {
1084
+ return ZodArray.create(this);
1085
+ }
1086
+ promise() {
1087
+ return ZodPromise.create(this, this._def);
1088
+ }
1089
+ or(option) {
1090
+ return ZodUnion.create([this, option], this._def);
1091
+ }
1092
+ and(incoming) {
1093
+ return ZodIntersection.create(this, incoming, this._def);
1094
+ }
1095
+ transform(transform) {
1096
+ return new ZodEffects({
1097
+ ...processCreateParams(this._def),
1098
+ schema: this,
1099
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
1100
+ effect: { type: "transform", transform }
1101
+ });
1102
+ }
1103
+ default(def) {
1104
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
1105
+ return new ZodDefault({
1106
+ ...processCreateParams(this._def),
1107
+ innerType: this,
1108
+ defaultValue: defaultValueFunc,
1109
+ typeName: ZodFirstPartyTypeKind.ZodDefault
1110
+ });
1111
+ }
1112
+ brand() {
1113
+ return new ZodBranded({
1114
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
1115
+ type: this,
1116
+ ...processCreateParams(this._def)
1117
+ });
1118
+ }
1119
+ catch(def) {
1120
+ const catchValueFunc = typeof def === "function" ? def : () => def;
1121
+ return new ZodCatch({
1122
+ ...processCreateParams(this._def),
1123
+ innerType: this,
1124
+ catchValue: catchValueFunc,
1125
+ typeName: ZodFirstPartyTypeKind.ZodCatch
1126
+ });
1127
+ }
1128
+ describe(description) {
1129
+ const This = this.constructor;
1130
+ return new This({
1131
+ ...this._def,
1132
+ description
1133
+ });
1134
+ }
1135
+ pipe(target) {
1136
+ return ZodPipeline.create(this, target);
1137
+ }
1138
+ readonly() {
1139
+ return ZodReadonly.create(this);
1140
+ }
1141
+ isOptional() {
1142
+ return this.safeParse(undefined).success;
1143
+ }
1144
+ isNullable() {
1145
+ return this.safeParse(null).success;
1146
+ }
1147
+ }
1148
+ function timeRegexSource(args) {
1149
+ let secondsRegexSource = `[0-5]\\d`;
1150
+ if (args.precision) {
1151
+ secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
1152
+ } else if (args.precision == null) {
1153
+ secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
1154
+ }
1155
+ const secondsQuantifier = args.precision ? "+" : "?";
1156
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
1157
+ }
1158
+ function timeRegex(args) {
1159
+ return new RegExp(`^${timeRegexSource(args)}$`);
1160
+ }
1161
+ function datetimeRegex(args) {
1162
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
1163
+ const opts = [];
1164
+ opts.push(args.local ? `Z?` : `Z`);
1165
+ if (args.offset)
1166
+ opts.push(`([+-]\\d{2}:?\\d{2})`);
1167
+ regex = `${regex}(${opts.join("|")})`;
1168
+ return new RegExp(`^${regex}$`);
1169
+ }
1170
+ function isValidIP(ip, version) {
1171
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1172
+ return true;
1173
+ }
1174
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
1175
+ return true;
1176
+ }
1177
+ return false;
1178
+ }
1179
+ function isValidJWT(jwt, alg) {
1180
+ if (!jwtRegex.test(jwt))
1181
+ return false;
1182
+ try {
1183
+ const [header] = jwt.split(".");
1184
+ if (!header)
1185
+ return false;
1186
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
1187
+ const decoded = JSON.parse(atob(base64));
1188
+ if (typeof decoded !== "object" || decoded === null)
1189
+ return false;
1190
+ if ("typ" in decoded && decoded?.typ !== "JWT")
1191
+ return false;
1192
+ if (!decoded.alg)
1193
+ return false;
1194
+ if (alg && decoded.alg !== alg)
1195
+ return false;
1196
+ return true;
1197
+ } catch {
1198
+ return false;
1199
+ }
1200
+ }
1201
+ function isValidCidr(ip, version) {
1202
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
1203
+ return true;
1204
+ }
1205
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
1206
+ return true;
1207
+ }
1208
+ return false;
1209
+ }
1210
+ function floatSafeRemainder(val, step) {
1211
+ const valDecCount = (val.toString().split(".")[1] || "").length;
1212
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
1213
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1214
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1215
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1216
+ return valInt % stepInt / 10 ** decCount;
1217
+ }
1218
+ function deepPartialify(schema) {
1219
+ if (schema instanceof ZodObject) {
1220
+ const newShape = {};
1221
+ for (const key in schema.shape) {
1222
+ const fieldSchema = schema.shape[key];
1223
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
1224
+ }
1225
+ return new ZodObject({
1226
+ ...schema._def,
1227
+ shape: () => newShape
1228
+ });
1229
+ } else if (schema instanceof ZodArray) {
1230
+ return new ZodArray({
1231
+ ...schema._def,
1232
+ type: deepPartialify(schema.element)
1233
+ });
1234
+ } else if (schema instanceof ZodOptional) {
1235
+ return ZodOptional.create(deepPartialify(schema.unwrap()));
1236
+ } else if (schema instanceof ZodNullable) {
1237
+ return ZodNullable.create(deepPartialify(schema.unwrap()));
1238
+ } else if (schema instanceof ZodTuple) {
1239
+ return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
1240
+ } else {
1241
+ return schema;
1242
+ }
1243
+ }
1244
+ function mergeValues(a, b) {
1245
+ const aType = getParsedType(a);
1246
+ const bType = getParsedType(b);
1247
+ if (a === b) {
1248
+ return { valid: true, data: a };
1249
+ } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
1250
+ const bKeys = util.objectKeys(b);
1251
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
1252
+ const newObj = { ...a, ...b };
1253
+ for (const key of sharedKeys) {
1254
+ const sharedValue = mergeValues(a[key], b[key]);
1255
+ if (!sharedValue.valid) {
1256
+ return { valid: false };
1257
+ }
1258
+ newObj[key] = sharedValue.data;
1259
+ }
1260
+ return { valid: true, data: newObj };
1261
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
1262
+ if (a.length !== b.length) {
1263
+ return { valid: false };
1264
+ }
1265
+ const newArray = [];
1266
+ for (let index = 0;index < a.length; index++) {
1267
+ const itemA = a[index];
1268
+ const itemB = b[index];
1269
+ const sharedValue = mergeValues(itemA, itemB);
1270
+ if (!sharedValue.valid) {
1271
+ return { valid: false };
1272
+ }
1273
+ newArray.push(sharedValue.data);
1274
+ }
1275
+ return { valid: true, data: newArray };
1276
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
1277
+ return { valid: true, data: a };
1278
+ } else {
1279
+ return { valid: false };
1280
+ }
1281
+ }
1282
+ function createZodEnum(values, params) {
1283
+ return new ZodEnum({
1284
+ values,
1285
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
1286
+ ...processCreateParams(params)
1287
+ });
1288
+ }
1289
+ function cleanParams(params, data) {
1290
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
1291
+ const p2 = typeof p === "string" ? { message: p } : p;
1292
+ return p2;
1293
+ }
1294
+ function custom(check, _params = {}, fatal) {
1295
+ if (check)
1296
+ return ZodAny.create().superRefine((data, ctx) => {
1297
+ const r = check(data);
1298
+ if (r instanceof Promise) {
1299
+ return r.then((r2) => {
1300
+ if (!r2) {
1301
+ const params = cleanParams(_params, data);
1302
+ const _fatal = params.fatal ?? fatal ?? true;
1303
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
1304
+ }
1305
+ });
1306
+ }
1307
+ if (!r) {
1308
+ const params = cleanParams(_params, data);
1309
+ const _fatal = params.fatal ?? fatal ?? true;
1310
+ ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
1311
+ }
1312
+ return;
1313
+ });
1314
+ return ZodAny.create();
1315
+ }
1316
+ var handleResult = (ctx, result) => {
1317
+ if (isValid(result)) {
1318
+ return { success: true, data: result.value };
1319
+ } else {
1320
+ if (!ctx.common.issues.length) {
1321
+ throw new Error("Validation failed but no issues detected.");
1322
+ }
1323
+ return {
1324
+ success: false,
1325
+ get error() {
1326
+ if (this._error)
1327
+ return this._error;
1328
+ const error = new ZodError(ctx.common.issues);
1329
+ this._error = error;
1330
+ return this._error;
1331
+ }
1332
+ };
1333
+ }
1334
+ }, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, jwtRegex, durationRegex, emailRegex, _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`, emojiRegex, ipv4Regex, ipv4CidrRegex, ipv6Regex, ipv6CidrRegex, base64Regex, base64urlRegex, dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator = (type) => {
1335
+ if (type instanceof ZodLazy) {
1336
+ return getDiscriminator(type.schema);
1337
+ } else if (type instanceof ZodEffects) {
1338
+ return getDiscriminator(type.innerType());
1339
+ } else if (type instanceof ZodLiteral) {
1340
+ return [type.value];
1341
+ } else if (type instanceof ZodEnum) {
1342
+ return type.options;
1343
+ } else if (type instanceof ZodNativeEnum) {
1344
+ return util.objectValues(type.enum);
1345
+ } else if (type instanceof ZodDefault) {
1346
+ return getDiscriminator(type._def.innerType);
1347
+ } else if (type instanceof ZodUndefined) {
1348
+ return [undefined];
1349
+ } else if (type instanceof ZodNull) {
1350
+ return [null];
1351
+ } else if (type instanceof ZodOptional) {
1352
+ return [undefined, ...getDiscriminator(type.unwrap())];
1353
+ } else if (type instanceof ZodNullable) {
1354
+ return [null, ...getDiscriminator(type.unwrap())];
1355
+ } else if (type instanceof ZodBranded) {
1356
+ return getDiscriminator(type.unwrap());
1357
+ } else if (type instanceof ZodReadonly) {
1358
+ return getDiscriminator(type.unwrap());
1359
+ } else if (type instanceof ZodCatch) {
1360
+ return getDiscriminator(type._def.innerType);
1361
+ } else {
1362
+ return [];
1363
+ }
1364
+ }, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, instanceOfType = (cls, params = {
1365
+ message: `Input not instance of ${cls.name}`
1366
+ }) => custom((data) => data instanceof cls, params), stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType, ostring = () => stringType().optional(), onumber = () => numberType().optional(), oboolean = () => booleanType().optional(), coerce, NEVER;
1367
+ var init_types = __esm(() => {
1368
+ init_ZodError();
1369
+ init_errors();
1370
+ init_errorUtil();
1371
+ init_parseUtil();
1372
+ init_util();
1373
+ cuidRegex = /^c[^\s-]{8,}$/i;
1374
+ cuid2Regex = /^[0-9a-z]+$/;
1375
+ ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
1376
+ uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
1377
+ nanoidRegex = /^[a-z0-9_-]{21}$/i;
1378
+ jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
1379
+ durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
1380
+ emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1381
+ ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
1382
+ ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
1383
+ ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
1384
+ ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
1385
+ base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1386
+ base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
1387
+ dateRegex = new RegExp(`^${dateRegexSource}$`);
1388
+ ZodString = class ZodString extends ZodType {
1389
+ _parse(input) {
1390
+ if (this._def.coerce) {
1391
+ input.data = String(input.data);
1392
+ }
1393
+ const parsedType = this._getType(input);
1394
+ if (parsedType !== ZodParsedType.string) {
1395
+ const ctx2 = this._getOrReturnCtx(input);
1396
+ addIssueToContext(ctx2, {
1397
+ code: ZodIssueCode.invalid_type,
1398
+ expected: ZodParsedType.string,
1399
+ received: ctx2.parsedType
1400
+ });
1401
+ return INVALID;
1402
+ }
1403
+ const status = new ParseStatus;
1404
+ let ctx = undefined;
1405
+ for (const check of this._def.checks) {
1406
+ if (check.kind === "min") {
1407
+ if (input.data.length < check.value) {
1408
+ ctx = this._getOrReturnCtx(input, ctx);
1409
+ addIssueToContext(ctx, {
1410
+ code: ZodIssueCode.too_small,
1411
+ minimum: check.value,
1412
+ type: "string",
1413
+ inclusive: true,
1414
+ exact: false,
1415
+ message: check.message
1416
+ });
1417
+ status.dirty();
1418
+ }
1419
+ } else if (check.kind === "max") {
1420
+ if (input.data.length > check.value) {
1421
+ ctx = this._getOrReturnCtx(input, ctx);
1422
+ addIssueToContext(ctx, {
1423
+ code: ZodIssueCode.too_big,
1424
+ maximum: check.value,
1425
+ type: "string",
1426
+ inclusive: true,
1427
+ exact: false,
1428
+ message: check.message
1429
+ });
1430
+ status.dirty();
1431
+ }
1432
+ } else if (check.kind === "length") {
1433
+ const tooBig = input.data.length > check.value;
1434
+ const tooSmall = input.data.length < check.value;
1435
+ if (tooBig || tooSmall) {
1436
+ ctx = this._getOrReturnCtx(input, ctx);
1437
+ if (tooBig) {
1438
+ addIssueToContext(ctx, {
1439
+ code: ZodIssueCode.too_big,
1440
+ maximum: check.value,
1441
+ type: "string",
1442
+ inclusive: true,
1443
+ exact: true,
1444
+ message: check.message
1445
+ });
1446
+ } else if (tooSmall) {
1447
+ addIssueToContext(ctx, {
1448
+ code: ZodIssueCode.too_small,
1449
+ minimum: check.value,
1450
+ type: "string",
1451
+ inclusive: true,
1452
+ exact: true,
1453
+ message: check.message
1454
+ });
1455
+ }
1456
+ status.dirty();
1457
+ }
1458
+ } else if (check.kind === "email") {
1459
+ if (!emailRegex.test(input.data)) {
1460
+ ctx = this._getOrReturnCtx(input, ctx);
1461
+ addIssueToContext(ctx, {
1462
+ validation: "email",
1463
+ code: ZodIssueCode.invalid_string,
1464
+ message: check.message
1465
+ });
1466
+ status.dirty();
1467
+ }
1468
+ } else if (check.kind === "emoji") {
1469
+ if (!emojiRegex) {
1470
+ emojiRegex = new RegExp(_emojiRegex, "u");
1471
+ }
1472
+ if (!emojiRegex.test(input.data)) {
1473
+ ctx = this._getOrReturnCtx(input, ctx);
1474
+ addIssueToContext(ctx, {
1475
+ validation: "emoji",
1476
+ code: ZodIssueCode.invalid_string,
1477
+ message: check.message
1478
+ });
1479
+ status.dirty();
1480
+ }
1481
+ } else if (check.kind === "uuid") {
1482
+ if (!uuidRegex.test(input.data)) {
1483
+ ctx = this._getOrReturnCtx(input, ctx);
1484
+ addIssueToContext(ctx, {
1485
+ validation: "uuid",
1486
+ code: ZodIssueCode.invalid_string,
1487
+ message: check.message
1488
+ });
1489
+ status.dirty();
1490
+ }
1491
+ } else if (check.kind === "nanoid") {
1492
+ if (!nanoidRegex.test(input.data)) {
1493
+ ctx = this._getOrReturnCtx(input, ctx);
1494
+ addIssueToContext(ctx, {
1495
+ validation: "nanoid",
1496
+ code: ZodIssueCode.invalid_string,
1497
+ message: check.message
1498
+ });
1499
+ status.dirty();
1500
+ }
1501
+ } else if (check.kind === "cuid") {
1502
+ if (!cuidRegex.test(input.data)) {
1503
+ ctx = this._getOrReturnCtx(input, ctx);
1504
+ addIssueToContext(ctx, {
1505
+ validation: "cuid",
1506
+ code: ZodIssueCode.invalid_string,
1507
+ message: check.message
1508
+ });
1509
+ status.dirty();
1510
+ }
1511
+ } else if (check.kind === "cuid2") {
1512
+ if (!cuid2Regex.test(input.data)) {
1513
+ ctx = this._getOrReturnCtx(input, ctx);
1514
+ addIssueToContext(ctx, {
1515
+ validation: "cuid2",
1516
+ code: ZodIssueCode.invalid_string,
1517
+ message: check.message
1518
+ });
1519
+ status.dirty();
1520
+ }
1521
+ } else if (check.kind === "ulid") {
1522
+ if (!ulidRegex.test(input.data)) {
1523
+ ctx = this._getOrReturnCtx(input, ctx);
1524
+ addIssueToContext(ctx, {
1525
+ validation: "ulid",
1526
+ code: ZodIssueCode.invalid_string,
1527
+ message: check.message
1528
+ });
1529
+ status.dirty();
1530
+ }
1531
+ } else if (check.kind === "url") {
1532
+ try {
1533
+ new URL(input.data);
1534
+ } catch {
1535
+ ctx = this._getOrReturnCtx(input, ctx);
1536
+ addIssueToContext(ctx, {
1537
+ validation: "url",
1538
+ code: ZodIssueCode.invalid_string,
1539
+ message: check.message
1540
+ });
1541
+ status.dirty();
1542
+ }
1543
+ } else if (check.kind === "regex") {
1544
+ check.regex.lastIndex = 0;
1545
+ const testResult = check.regex.test(input.data);
1546
+ if (!testResult) {
1547
+ ctx = this._getOrReturnCtx(input, ctx);
1548
+ addIssueToContext(ctx, {
1549
+ validation: "regex",
1550
+ code: ZodIssueCode.invalid_string,
1551
+ message: check.message
1552
+ });
1553
+ status.dirty();
1554
+ }
1555
+ } else if (check.kind === "trim") {
1556
+ input.data = input.data.trim();
1557
+ } else if (check.kind === "includes") {
1558
+ if (!input.data.includes(check.value, check.position)) {
1559
+ ctx = this._getOrReturnCtx(input, ctx);
1560
+ addIssueToContext(ctx, {
1561
+ code: ZodIssueCode.invalid_string,
1562
+ validation: { includes: check.value, position: check.position },
1563
+ message: check.message
1564
+ });
1565
+ status.dirty();
1566
+ }
1567
+ } else if (check.kind === "toLowerCase") {
1568
+ input.data = input.data.toLowerCase();
1569
+ } else if (check.kind === "toUpperCase") {
1570
+ input.data = input.data.toUpperCase();
1571
+ } else if (check.kind === "startsWith") {
1572
+ if (!input.data.startsWith(check.value)) {
1573
+ ctx = this._getOrReturnCtx(input, ctx);
1574
+ addIssueToContext(ctx, {
1575
+ code: ZodIssueCode.invalid_string,
1576
+ validation: { startsWith: check.value },
1577
+ message: check.message
1578
+ });
1579
+ status.dirty();
1580
+ }
1581
+ } else if (check.kind === "endsWith") {
1582
+ if (!input.data.endsWith(check.value)) {
1583
+ ctx = this._getOrReturnCtx(input, ctx);
1584
+ addIssueToContext(ctx, {
1585
+ code: ZodIssueCode.invalid_string,
1586
+ validation: { endsWith: check.value },
1587
+ message: check.message
1588
+ });
1589
+ status.dirty();
1590
+ }
1591
+ } else if (check.kind === "datetime") {
1592
+ const regex = datetimeRegex(check);
1593
+ if (!regex.test(input.data)) {
1594
+ ctx = this._getOrReturnCtx(input, ctx);
1595
+ addIssueToContext(ctx, {
1596
+ code: ZodIssueCode.invalid_string,
1597
+ validation: "datetime",
1598
+ message: check.message
1599
+ });
1600
+ status.dirty();
1601
+ }
1602
+ } else if (check.kind === "date") {
1603
+ const regex = dateRegex;
1604
+ if (!regex.test(input.data)) {
1605
+ ctx = this._getOrReturnCtx(input, ctx);
1606
+ addIssueToContext(ctx, {
1607
+ code: ZodIssueCode.invalid_string,
1608
+ validation: "date",
1609
+ message: check.message
1610
+ });
1611
+ status.dirty();
1612
+ }
1613
+ } else if (check.kind === "time") {
1614
+ const regex = timeRegex(check);
1615
+ if (!regex.test(input.data)) {
1616
+ ctx = this._getOrReturnCtx(input, ctx);
1617
+ addIssueToContext(ctx, {
1618
+ code: ZodIssueCode.invalid_string,
1619
+ validation: "time",
1620
+ message: check.message
1621
+ });
1622
+ status.dirty();
1623
+ }
1624
+ } else if (check.kind === "duration") {
1625
+ if (!durationRegex.test(input.data)) {
1626
+ ctx = this._getOrReturnCtx(input, ctx);
1627
+ addIssueToContext(ctx, {
1628
+ validation: "duration",
1629
+ code: ZodIssueCode.invalid_string,
1630
+ message: check.message
1631
+ });
1632
+ status.dirty();
1633
+ }
1634
+ } else if (check.kind === "ip") {
1635
+ if (!isValidIP(input.data, check.version)) {
1636
+ ctx = this._getOrReturnCtx(input, ctx);
1637
+ addIssueToContext(ctx, {
1638
+ validation: "ip",
1639
+ code: ZodIssueCode.invalid_string,
1640
+ message: check.message
1641
+ });
1642
+ status.dirty();
1643
+ }
1644
+ } else if (check.kind === "jwt") {
1645
+ if (!isValidJWT(input.data, check.alg)) {
1646
+ ctx = this._getOrReturnCtx(input, ctx);
1647
+ addIssueToContext(ctx, {
1648
+ validation: "jwt",
1649
+ code: ZodIssueCode.invalid_string,
1650
+ message: check.message
1651
+ });
1652
+ status.dirty();
1653
+ }
1654
+ } else if (check.kind === "cidr") {
1655
+ if (!isValidCidr(input.data, check.version)) {
1656
+ ctx = this._getOrReturnCtx(input, ctx);
1657
+ addIssueToContext(ctx, {
1658
+ validation: "cidr",
1659
+ code: ZodIssueCode.invalid_string,
1660
+ message: check.message
1661
+ });
1662
+ status.dirty();
1663
+ }
1664
+ } else if (check.kind === "base64") {
1665
+ if (!base64Regex.test(input.data)) {
1666
+ ctx = this._getOrReturnCtx(input, ctx);
1667
+ addIssueToContext(ctx, {
1668
+ validation: "base64",
1669
+ code: ZodIssueCode.invalid_string,
1670
+ message: check.message
1671
+ });
1672
+ status.dirty();
1673
+ }
1674
+ } else if (check.kind === "base64url") {
1675
+ if (!base64urlRegex.test(input.data)) {
1676
+ ctx = this._getOrReturnCtx(input, ctx);
1677
+ addIssueToContext(ctx, {
1678
+ validation: "base64url",
1679
+ code: ZodIssueCode.invalid_string,
1680
+ message: check.message
1681
+ });
1682
+ status.dirty();
1683
+ }
1684
+ } else {
1685
+ util.assertNever(check);
1686
+ }
1687
+ }
1688
+ return { status: status.value, value: input.data };
1689
+ }
1690
+ _regex(regex, validation, message) {
1691
+ return this.refinement((data) => regex.test(data), {
1692
+ validation,
1693
+ code: ZodIssueCode.invalid_string,
1694
+ ...errorUtil.errToObj(message)
1695
+ });
1696
+ }
1697
+ _addCheck(check) {
1698
+ return new ZodString({
1699
+ ...this._def,
1700
+ checks: [...this._def.checks, check]
1701
+ });
1702
+ }
1703
+ email(message) {
1704
+ return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1705
+ }
1706
+ url(message) {
1707
+ return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1708
+ }
1709
+ emoji(message) {
1710
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1711
+ }
1712
+ uuid(message) {
1713
+ return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1714
+ }
1715
+ nanoid(message) {
1716
+ return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1717
+ }
1718
+ cuid(message) {
1719
+ return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1720
+ }
1721
+ cuid2(message) {
1722
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1723
+ }
1724
+ ulid(message) {
1725
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1726
+ }
1727
+ base64(message) {
1728
+ return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1729
+ }
1730
+ base64url(message) {
1731
+ return this._addCheck({
1732
+ kind: "base64url",
1733
+ ...errorUtil.errToObj(message)
1734
+ });
1735
+ }
1736
+ jwt(options) {
1737
+ return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
1738
+ }
1739
+ ip(options) {
1740
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1741
+ }
1742
+ cidr(options) {
1743
+ return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
1744
+ }
1745
+ datetime(options) {
1746
+ if (typeof options === "string") {
1747
+ return this._addCheck({
1748
+ kind: "datetime",
1749
+ precision: null,
1750
+ offset: false,
1751
+ local: false,
1752
+ message: options
1753
+ });
1754
+ }
1755
+ return this._addCheck({
1756
+ kind: "datetime",
1757
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1758
+ offset: options?.offset ?? false,
1759
+ local: options?.local ?? false,
1760
+ ...errorUtil.errToObj(options?.message)
1761
+ });
1762
+ }
1763
+ date(message) {
1764
+ return this._addCheck({ kind: "date", message });
1765
+ }
1766
+ time(options) {
1767
+ if (typeof options === "string") {
1768
+ return this._addCheck({
1769
+ kind: "time",
1770
+ precision: null,
1771
+ message: options
1772
+ });
1773
+ }
1774
+ return this._addCheck({
1775
+ kind: "time",
1776
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1777
+ ...errorUtil.errToObj(options?.message)
1778
+ });
1779
+ }
1780
+ duration(message) {
1781
+ return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1782
+ }
1783
+ regex(regex, message) {
1784
+ return this._addCheck({
1785
+ kind: "regex",
1786
+ regex,
1787
+ ...errorUtil.errToObj(message)
1788
+ });
1789
+ }
1790
+ includes(value, options) {
1791
+ return this._addCheck({
1792
+ kind: "includes",
1793
+ value,
1794
+ position: options?.position,
1795
+ ...errorUtil.errToObj(options?.message)
1796
+ });
1797
+ }
1798
+ startsWith(value, message) {
1799
+ return this._addCheck({
1800
+ kind: "startsWith",
1801
+ value,
1802
+ ...errorUtil.errToObj(message)
1803
+ });
1804
+ }
1805
+ endsWith(value, message) {
1806
+ return this._addCheck({
1807
+ kind: "endsWith",
1808
+ value,
1809
+ ...errorUtil.errToObj(message)
1810
+ });
1811
+ }
1812
+ min(minLength, message) {
1813
+ return this._addCheck({
1814
+ kind: "min",
1815
+ value: minLength,
1816
+ ...errorUtil.errToObj(message)
1817
+ });
1818
+ }
1819
+ max(maxLength, message) {
1820
+ return this._addCheck({
1821
+ kind: "max",
1822
+ value: maxLength,
1823
+ ...errorUtil.errToObj(message)
1824
+ });
1825
+ }
1826
+ length(len, message) {
1827
+ return this._addCheck({
1828
+ kind: "length",
1829
+ value: len,
1830
+ ...errorUtil.errToObj(message)
1831
+ });
1832
+ }
1833
+ nonempty(message) {
1834
+ return this.min(1, errorUtil.errToObj(message));
1835
+ }
1836
+ trim() {
1837
+ return new ZodString({
1838
+ ...this._def,
1839
+ checks: [...this._def.checks, { kind: "trim" }]
1840
+ });
1841
+ }
1842
+ toLowerCase() {
1843
+ return new ZodString({
1844
+ ...this._def,
1845
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1846
+ });
1847
+ }
1848
+ toUpperCase() {
1849
+ return new ZodString({
1850
+ ...this._def,
1851
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1852
+ });
1853
+ }
1854
+ get isDatetime() {
1855
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
1856
+ }
1857
+ get isDate() {
1858
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1859
+ }
1860
+ get isTime() {
1861
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1862
+ }
1863
+ get isDuration() {
1864
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1865
+ }
1866
+ get isEmail() {
1867
+ return !!this._def.checks.find((ch) => ch.kind === "email");
1868
+ }
1869
+ get isURL() {
1870
+ return !!this._def.checks.find((ch) => ch.kind === "url");
1871
+ }
1872
+ get isEmoji() {
1873
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1874
+ }
1875
+ get isUUID() {
1876
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
1877
+ }
1878
+ get isNANOID() {
1879
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1880
+ }
1881
+ get isCUID() {
1882
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
1883
+ }
1884
+ get isCUID2() {
1885
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1886
+ }
1887
+ get isULID() {
1888
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1889
+ }
1890
+ get isIP() {
1891
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1892
+ }
1893
+ get isCIDR() {
1894
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
1895
+ }
1896
+ get isBase64() {
1897
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1898
+ }
1899
+ get isBase64url() {
1900
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
1901
+ }
1902
+ get minLength() {
1903
+ let min = null;
1904
+ for (const ch of this._def.checks) {
1905
+ if (ch.kind === "min") {
1906
+ if (min === null || ch.value > min)
1907
+ min = ch.value;
1908
+ }
1909
+ }
1910
+ return min;
1911
+ }
1912
+ get maxLength() {
1913
+ let max = null;
1914
+ for (const ch of this._def.checks) {
1915
+ if (ch.kind === "max") {
1916
+ if (max === null || ch.value < max)
1917
+ max = ch.value;
1918
+ }
1919
+ }
1920
+ return max;
1921
+ }
1922
+ };
1923
+ ZodString.create = (params) => {
1924
+ return new ZodString({
1925
+ checks: [],
1926
+ typeName: ZodFirstPartyTypeKind.ZodString,
1927
+ coerce: params?.coerce ?? false,
1928
+ ...processCreateParams(params)
1929
+ });
1930
+ };
1931
+ ZodNumber = class ZodNumber extends ZodType {
1932
+ constructor() {
1933
+ super(...arguments);
1934
+ this.min = this.gte;
1935
+ this.max = this.lte;
1936
+ this.step = this.multipleOf;
1937
+ }
1938
+ _parse(input) {
1939
+ if (this._def.coerce) {
1940
+ input.data = Number(input.data);
1941
+ }
1942
+ const parsedType = this._getType(input);
1943
+ if (parsedType !== ZodParsedType.number) {
1944
+ const ctx2 = this._getOrReturnCtx(input);
1945
+ addIssueToContext(ctx2, {
1946
+ code: ZodIssueCode.invalid_type,
1947
+ expected: ZodParsedType.number,
1948
+ received: ctx2.parsedType
1949
+ });
1950
+ return INVALID;
1951
+ }
1952
+ let ctx = undefined;
1953
+ const status = new ParseStatus;
1954
+ for (const check of this._def.checks) {
1955
+ if (check.kind === "int") {
1956
+ if (!util.isInteger(input.data)) {
1957
+ ctx = this._getOrReturnCtx(input, ctx);
1958
+ addIssueToContext(ctx, {
1959
+ code: ZodIssueCode.invalid_type,
1960
+ expected: "integer",
1961
+ received: "float",
1962
+ message: check.message
1963
+ });
1964
+ status.dirty();
1965
+ }
1966
+ } else if (check.kind === "min") {
1967
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1968
+ if (tooSmall) {
1969
+ ctx = this._getOrReturnCtx(input, ctx);
1970
+ addIssueToContext(ctx, {
1971
+ code: ZodIssueCode.too_small,
1972
+ minimum: check.value,
1973
+ type: "number",
1974
+ inclusive: check.inclusive,
1975
+ exact: false,
1976
+ message: check.message
1977
+ });
1978
+ status.dirty();
1979
+ }
1980
+ } else if (check.kind === "max") {
1981
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1982
+ if (tooBig) {
1983
+ ctx = this._getOrReturnCtx(input, ctx);
1984
+ addIssueToContext(ctx, {
1985
+ code: ZodIssueCode.too_big,
1986
+ maximum: check.value,
1987
+ type: "number",
1988
+ inclusive: check.inclusive,
1989
+ exact: false,
1990
+ message: check.message
1991
+ });
1992
+ status.dirty();
1993
+ }
1994
+ } else if (check.kind === "multipleOf") {
1995
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
1996
+ ctx = this._getOrReturnCtx(input, ctx);
1997
+ addIssueToContext(ctx, {
1998
+ code: ZodIssueCode.not_multiple_of,
1999
+ multipleOf: check.value,
2000
+ message: check.message
2001
+ });
2002
+ status.dirty();
2003
+ }
2004
+ } else if (check.kind === "finite") {
2005
+ if (!Number.isFinite(input.data)) {
2006
+ ctx = this._getOrReturnCtx(input, ctx);
2007
+ addIssueToContext(ctx, {
2008
+ code: ZodIssueCode.not_finite,
2009
+ message: check.message
2010
+ });
2011
+ status.dirty();
2012
+ }
2013
+ } else {
2014
+ util.assertNever(check);
2015
+ }
2016
+ }
2017
+ return { status: status.value, value: input.data };
2018
+ }
2019
+ gte(value, message) {
2020
+ return this.setLimit("min", value, true, errorUtil.toString(message));
2021
+ }
2022
+ gt(value, message) {
2023
+ return this.setLimit("min", value, false, errorUtil.toString(message));
2024
+ }
2025
+ lte(value, message) {
2026
+ return this.setLimit("max", value, true, errorUtil.toString(message));
2027
+ }
2028
+ lt(value, message) {
2029
+ return this.setLimit("max", value, false, errorUtil.toString(message));
2030
+ }
2031
+ setLimit(kind, value, inclusive, message) {
2032
+ return new ZodNumber({
2033
+ ...this._def,
2034
+ checks: [
2035
+ ...this._def.checks,
2036
+ {
2037
+ kind,
2038
+ value,
2039
+ inclusive,
2040
+ message: errorUtil.toString(message)
2041
+ }
2042
+ ]
2043
+ });
2044
+ }
2045
+ _addCheck(check) {
2046
+ return new ZodNumber({
2047
+ ...this._def,
2048
+ checks: [...this._def.checks, check]
2049
+ });
2050
+ }
2051
+ int(message) {
2052
+ return this._addCheck({
2053
+ kind: "int",
2054
+ message: errorUtil.toString(message)
2055
+ });
2056
+ }
2057
+ positive(message) {
2058
+ return this._addCheck({
2059
+ kind: "min",
2060
+ value: 0,
2061
+ inclusive: false,
2062
+ message: errorUtil.toString(message)
2063
+ });
2064
+ }
2065
+ negative(message) {
2066
+ return this._addCheck({
2067
+ kind: "max",
2068
+ value: 0,
2069
+ inclusive: false,
2070
+ message: errorUtil.toString(message)
2071
+ });
2072
+ }
2073
+ nonpositive(message) {
2074
+ return this._addCheck({
2075
+ kind: "max",
2076
+ value: 0,
2077
+ inclusive: true,
2078
+ message: errorUtil.toString(message)
2079
+ });
2080
+ }
2081
+ nonnegative(message) {
2082
+ return this._addCheck({
2083
+ kind: "min",
2084
+ value: 0,
2085
+ inclusive: true,
2086
+ message: errorUtil.toString(message)
2087
+ });
2088
+ }
2089
+ multipleOf(value, message) {
2090
+ return this._addCheck({
2091
+ kind: "multipleOf",
2092
+ value,
2093
+ message: errorUtil.toString(message)
2094
+ });
2095
+ }
2096
+ finite(message) {
2097
+ return this._addCheck({
2098
+ kind: "finite",
2099
+ message: errorUtil.toString(message)
2100
+ });
2101
+ }
2102
+ safe(message) {
2103
+ return this._addCheck({
2104
+ kind: "min",
2105
+ inclusive: true,
2106
+ value: Number.MIN_SAFE_INTEGER,
2107
+ message: errorUtil.toString(message)
2108
+ })._addCheck({
2109
+ kind: "max",
2110
+ inclusive: true,
2111
+ value: Number.MAX_SAFE_INTEGER,
2112
+ message: errorUtil.toString(message)
2113
+ });
2114
+ }
2115
+ get minValue() {
2116
+ let min = null;
2117
+ for (const ch of this._def.checks) {
2118
+ if (ch.kind === "min") {
2119
+ if (min === null || ch.value > min)
2120
+ min = ch.value;
2121
+ }
2122
+ }
2123
+ return min;
2124
+ }
2125
+ get maxValue() {
2126
+ let max = null;
2127
+ for (const ch of this._def.checks) {
2128
+ if (ch.kind === "max") {
2129
+ if (max === null || ch.value < max)
2130
+ max = ch.value;
2131
+ }
2132
+ }
2133
+ return max;
2134
+ }
2135
+ get isInt() {
2136
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2137
+ }
2138
+ get isFinite() {
2139
+ let max = null;
2140
+ let min = null;
2141
+ for (const ch of this._def.checks) {
2142
+ if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2143
+ return true;
2144
+ } else if (ch.kind === "min") {
2145
+ if (min === null || ch.value > min)
2146
+ min = ch.value;
2147
+ } else if (ch.kind === "max") {
2148
+ if (max === null || ch.value < max)
2149
+ max = ch.value;
2150
+ }
2151
+ }
2152
+ return Number.isFinite(min) && Number.isFinite(max);
2153
+ }
2154
+ };
2155
+ ZodNumber.create = (params) => {
2156
+ return new ZodNumber({
2157
+ checks: [],
2158
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
2159
+ coerce: params?.coerce || false,
2160
+ ...processCreateParams(params)
2161
+ });
2162
+ };
2163
+ ZodBigInt = class ZodBigInt extends ZodType {
2164
+ constructor() {
2165
+ super(...arguments);
2166
+ this.min = this.gte;
2167
+ this.max = this.lte;
2168
+ }
2169
+ _parse(input) {
2170
+ if (this._def.coerce) {
2171
+ try {
2172
+ input.data = BigInt(input.data);
2173
+ } catch {
2174
+ return this._getInvalidInput(input);
2175
+ }
2176
+ }
2177
+ const parsedType = this._getType(input);
2178
+ if (parsedType !== ZodParsedType.bigint) {
2179
+ return this._getInvalidInput(input);
2180
+ }
2181
+ let ctx = undefined;
2182
+ const status = new ParseStatus;
2183
+ for (const check of this._def.checks) {
2184
+ if (check.kind === "min") {
2185
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2186
+ if (tooSmall) {
2187
+ ctx = this._getOrReturnCtx(input, ctx);
2188
+ addIssueToContext(ctx, {
2189
+ code: ZodIssueCode.too_small,
2190
+ type: "bigint",
2191
+ minimum: check.value,
2192
+ inclusive: check.inclusive,
2193
+ message: check.message
2194
+ });
2195
+ status.dirty();
2196
+ }
2197
+ } else if (check.kind === "max") {
2198
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2199
+ if (tooBig) {
2200
+ ctx = this._getOrReturnCtx(input, ctx);
2201
+ addIssueToContext(ctx, {
2202
+ code: ZodIssueCode.too_big,
2203
+ type: "bigint",
2204
+ maximum: check.value,
2205
+ inclusive: check.inclusive,
2206
+ message: check.message
2207
+ });
2208
+ status.dirty();
2209
+ }
2210
+ } else if (check.kind === "multipleOf") {
2211
+ if (input.data % check.value !== BigInt(0)) {
2212
+ ctx = this._getOrReturnCtx(input, ctx);
2213
+ addIssueToContext(ctx, {
2214
+ code: ZodIssueCode.not_multiple_of,
2215
+ multipleOf: check.value,
2216
+ message: check.message
2217
+ });
2218
+ status.dirty();
2219
+ }
2220
+ } else {
2221
+ util.assertNever(check);
2222
+ }
2223
+ }
2224
+ return { status: status.value, value: input.data };
2225
+ }
2226
+ _getInvalidInput(input) {
2227
+ const ctx = this._getOrReturnCtx(input);
2228
+ addIssueToContext(ctx, {
2229
+ code: ZodIssueCode.invalid_type,
2230
+ expected: ZodParsedType.bigint,
2231
+ received: ctx.parsedType
2232
+ });
2233
+ return INVALID;
2234
+ }
2235
+ gte(value, message) {
2236
+ return this.setLimit("min", value, true, errorUtil.toString(message));
2237
+ }
2238
+ gt(value, message) {
2239
+ return this.setLimit("min", value, false, errorUtil.toString(message));
2240
+ }
2241
+ lte(value, message) {
2242
+ return this.setLimit("max", value, true, errorUtil.toString(message));
2243
+ }
2244
+ lt(value, message) {
2245
+ return this.setLimit("max", value, false, errorUtil.toString(message));
2246
+ }
2247
+ setLimit(kind, value, inclusive, message) {
2248
+ return new ZodBigInt({
2249
+ ...this._def,
2250
+ checks: [
2251
+ ...this._def.checks,
2252
+ {
2253
+ kind,
2254
+ value,
2255
+ inclusive,
2256
+ message: errorUtil.toString(message)
2257
+ }
2258
+ ]
2259
+ });
2260
+ }
2261
+ _addCheck(check) {
2262
+ return new ZodBigInt({
2263
+ ...this._def,
2264
+ checks: [...this._def.checks, check]
2265
+ });
2266
+ }
2267
+ positive(message) {
2268
+ return this._addCheck({
2269
+ kind: "min",
2270
+ value: BigInt(0),
2271
+ inclusive: false,
2272
+ message: errorUtil.toString(message)
2273
+ });
2274
+ }
2275
+ negative(message) {
2276
+ return this._addCheck({
2277
+ kind: "max",
2278
+ value: BigInt(0),
2279
+ inclusive: false,
2280
+ message: errorUtil.toString(message)
2281
+ });
2282
+ }
2283
+ nonpositive(message) {
2284
+ return this._addCheck({
2285
+ kind: "max",
2286
+ value: BigInt(0),
2287
+ inclusive: true,
2288
+ message: errorUtil.toString(message)
2289
+ });
2290
+ }
2291
+ nonnegative(message) {
2292
+ return this._addCheck({
2293
+ kind: "min",
2294
+ value: BigInt(0),
2295
+ inclusive: true,
2296
+ message: errorUtil.toString(message)
2297
+ });
2298
+ }
2299
+ multipleOf(value, message) {
2300
+ return this._addCheck({
2301
+ kind: "multipleOf",
2302
+ value,
2303
+ message: errorUtil.toString(message)
2304
+ });
2305
+ }
2306
+ get minValue() {
2307
+ let min = null;
2308
+ for (const ch of this._def.checks) {
2309
+ if (ch.kind === "min") {
2310
+ if (min === null || ch.value > min)
2311
+ min = ch.value;
2312
+ }
2313
+ }
2314
+ return min;
2315
+ }
2316
+ get maxValue() {
2317
+ let max = null;
2318
+ for (const ch of this._def.checks) {
2319
+ if (ch.kind === "max") {
2320
+ if (max === null || ch.value < max)
2321
+ max = ch.value;
2322
+ }
2323
+ }
2324
+ return max;
2325
+ }
2326
+ };
2327
+ ZodBigInt.create = (params) => {
2328
+ return new ZodBigInt({
2329
+ checks: [],
2330
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
2331
+ coerce: params?.coerce ?? false,
2332
+ ...processCreateParams(params)
2333
+ });
2334
+ };
2335
+ ZodBoolean = class ZodBoolean extends ZodType {
2336
+ _parse(input) {
2337
+ if (this._def.coerce) {
2338
+ input.data = Boolean(input.data);
2339
+ }
2340
+ const parsedType = this._getType(input);
2341
+ if (parsedType !== ZodParsedType.boolean) {
2342
+ const ctx = this._getOrReturnCtx(input);
2343
+ addIssueToContext(ctx, {
2344
+ code: ZodIssueCode.invalid_type,
2345
+ expected: ZodParsedType.boolean,
2346
+ received: ctx.parsedType
2347
+ });
2348
+ return INVALID;
2349
+ }
2350
+ return OK(input.data);
2351
+ }
2352
+ };
2353
+ ZodBoolean.create = (params) => {
2354
+ return new ZodBoolean({
2355
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
2356
+ coerce: params?.coerce || false,
2357
+ ...processCreateParams(params)
2358
+ });
2359
+ };
2360
+ ZodDate = class ZodDate extends ZodType {
2361
+ _parse(input) {
2362
+ if (this._def.coerce) {
2363
+ input.data = new Date(input.data);
2364
+ }
2365
+ const parsedType = this._getType(input);
2366
+ if (parsedType !== ZodParsedType.date) {
2367
+ const ctx2 = this._getOrReturnCtx(input);
2368
+ addIssueToContext(ctx2, {
2369
+ code: ZodIssueCode.invalid_type,
2370
+ expected: ZodParsedType.date,
2371
+ received: ctx2.parsedType
2372
+ });
2373
+ return INVALID;
2374
+ }
2375
+ if (Number.isNaN(input.data.getTime())) {
2376
+ const ctx2 = this._getOrReturnCtx(input);
2377
+ addIssueToContext(ctx2, {
2378
+ code: ZodIssueCode.invalid_date
2379
+ });
2380
+ return INVALID;
2381
+ }
2382
+ const status = new ParseStatus;
2383
+ let ctx = undefined;
2384
+ for (const check of this._def.checks) {
2385
+ if (check.kind === "min") {
2386
+ if (input.data.getTime() < check.value) {
2387
+ ctx = this._getOrReturnCtx(input, ctx);
2388
+ addIssueToContext(ctx, {
2389
+ code: ZodIssueCode.too_small,
2390
+ message: check.message,
2391
+ inclusive: true,
2392
+ exact: false,
2393
+ minimum: check.value,
2394
+ type: "date"
2395
+ });
2396
+ status.dirty();
2397
+ }
2398
+ } else if (check.kind === "max") {
2399
+ if (input.data.getTime() > check.value) {
2400
+ ctx = this._getOrReturnCtx(input, ctx);
2401
+ addIssueToContext(ctx, {
2402
+ code: ZodIssueCode.too_big,
2403
+ message: check.message,
2404
+ inclusive: true,
2405
+ exact: false,
2406
+ maximum: check.value,
2407
+ type: "date"
2408
+ });
2409
+ status.dirty();
2410
+ }
2411
+ } else {
2412
+ util.assertNever(check);
2413
+ }
2414
+ }
2415
+ return {
2416
+ status: status.value,
2417
+ value: new Date(input.data.getTime())
2418
+ };
2419
+ }
2420
+ _addCheck(check) {
2421
+ return new ZodDate({
2422
+ ...this._def,
2423
+ checks: [...this._def.checks, check]
2424
+ });
2425
+ }
2426
+ min(minDate, message) {
2427
+ return this._addCheck({
2428
+ kind: "min",
2429
+ value: minDate.getTime(),
2430
+ message: errorUtil.toString(message)
2431
+ });
2432
+ }
2433
+ max(maxDate, message) {
2434
+ return this._addCheck({
2435
+ kind: "max",
2436
+ value: maxDate.getTime(),
2437
+ message: errorUtil.toString(message)
2438
+ });
2439
+ }
2440
+ get minDate() {
2441
+ let min = null;
2442
+ for (const ch of this._def.checks) {
2443
+ if (ch.kind === "min") {
2444
+ if (min === null || ch.value > min)
2445
+ min = ch.value;
2446
+ }
2447
+ }
2448
+ return min != null ? new Date(min) : null;
2449
+ }
2450
+ get maxDate() {
2451
+ let max = null;
2452
+ for (const ch of this._def.checks) {
2453
+ if (ch.kind === "max") {
2454
+ if (max === null || ch.value < max)
2455
+ max = ch.value;
2456
+ }
2457
+ }
2458
+ return max != null ? new Date(max) : null;
2459
+ }
2460
+ };
2461
+ ZodDate.create = (params) => {
2462
+ return new ZodDate({
2463
+ checks: [],
2464
+ coerce: params?.coerce || false,
2465
+ typeName: ZodFirstPartyTypeKind.ZodDate,
2466
+ ...processCreateParams(params)
2467
+ });
2468
+ };
2469
+ ZodSymbol = class ZodSymbol extends ZodType {
2470
+ _parse(input) {
2471
+ const parsedType = this._getType(input);
2472
+ if (parsedType !== ZodParsedType.symbol) {
2473
+ const ctx = this._getOrReturnCtx(input);
2474
+ addIssueToContext(ctx, {
2475
+ code: ZodIssueCode.invalid_type,
2476
+ expected: ZodParsedType.symbol,
2477
+ received: ctx.parsedType
2478
+ });
2479
+ return INVALID;
2480
+ }
2481
+ return OK(input.data);
2482
+ }
2483
+ };
2484
+ ZodSymbol.create = (params) => {
2485
+ return new ZodSymbol({
2486
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
2487
+ ...processCreateParams(params)
2488
+ });
2489
+ };
2490
+ ZodUndefined = class ZodUndefined extends ZodType {
2491
+ _parse(input) {
2492
+ const parsedType = this._getType(input);
2493
+ if (parsedType !== ZodParsedType.undefined) {
2494
+ const ctx = this._getOrReturnCtx(input);
2495
+ addIssueToContext(ctx, {
2496
+ code: ZodIssueCode.invalid_type,
2497
+ expected: ZodParsedType.undefined,
2498
+ received: ctx.parsedType
2499
+ });
2500
+ return INVALID;
2501
+ }
2502
+ return OK(input.data);
2503
+ }
2504
+ };
2505
+ ZodUndefined.create = (params) => {
2506
+ return new ZodUndefined({
2507
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
2508
+ ...processCreateParams(params)
2509
+ });
2510
+ };
2511
+ ZodNull = class ZodNull extends ZodType {
2512
+ _parse(input) {
2513
+ const parsedType = this._getType(input);
2514
+ if (parsedType !== ZodParsedType.null) {
2515
+ const ctx = this._getOrReturnCtx(input);
2516
+ addIssueToContext(ctx, {
2517
+ code: ZodIssueCode.invalid_type,
2518
+ expected: ZodParsedType.null,
2519
+ received: ctx.parsedType
2520
+ });
2521
+ return INVALID;
2522
+ }
2523
+ return OK(input.data);
2524
+ }
2525
+ };
2526
+ ZodNull.create = (params) => {
2527
+ return new ZodNull({
2528
+ typeName: ZodFirstPartyTypeKind.ZodNull,
2529
+ ...processCreateParams(params)
2530
+ });
2531
+ };
2532
+ ZodAny = class ZodAny extends ZodType {
2533
+ constructor() {
2534
+ super(...arguments);
2535
+ this._any = true;
2536
+ }
2537
+ _parse(input) {
2538
+ return OK(input.data);
2539
+ }
2540
+ };
2541
+ ZodAny.create = (params) => {
2542
+ return new ZodAny({
2543
+ typeName: ZodFirstPartyTypeKind.ZodAny,
2544
+ ...processCreateParams(params)
2545
+ });
2546
+ };
2547
+ ZodUnknown = class ZodUnknown extends ZodType {
2548
+ constructor() {
2549
+ super(...arguments);
2550
+ this._unknown = true;
2551
+ }
2552
+ _parse(input) {
2553
+ return OK(input.data);
2554
+ }
2555
+ };
2556
+ ZodUnknown.create = (params) => {
2557
+ return new ZodUnknown({
2558
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
2559
+ ...processCreateParams(params)
2560
+ });
2561
+ };
2562
+ ZodNever = class ZodNever extends ZodType {
2563
+ _parse(input) {
2564
+ const ctx = this._getOrReturnCtx(input);
2565
+ addIssueToContext(ctx, {
2566
+ code: ZodIssueCode.invalid_type,
2567
+ expected: ZodParsedType.never,
2568
+ received: ctx.parsedType
2569
+ });
2570
+ return INVALID;
2571
+ }
2572
+ };
2573
+ ZodNever.create = (params) => {
2574
+ return new ZodNever({
2575
+ typeName: ZodFirstPartyTypeKind.ZodNever,
2576
+ ...processCreateParams(params)
2577
+ });
2578
+ };
2579
+ ZodVoid = class ZodVoid extends ZodType {
2580
+ _parse(input) {
2581
+ const parsedType = this._getType(input);
2582
+ if (parsedType !== ZodParsedType.undefined) {
2583
+ const ctx = this._getOrReturnCtx(input);
2584
+ addIssueToContext(ctx, {
2585
+ code: ZodIssueCode.invalid_type,
2586
+ expected: ZodParsedType.void,
2587
+ received: ctx.parsedType
2588
+ });
2589
+ return INVALID;
2590
+ }
2591
+ return OK(input.data);
2592
+ }
2593
+ };
2594
+ ZodVoid.create = (params) => {
2595
+ return new ZodVoid({
2596
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
2597
+ ...processCreateParams(params)
2598
+ });
2599
+ };
2600
+ ZodArray = class ZodArray extends ZodType {
2601
+ _parse(input) {
2602
+ const { ctx, status } = this._processInputParams(input);
2603
+ const def = this._def;
2604
+ if (ctx.parsedType !== ZodParsedType.array) {
2605
+ addIssueToContext(ctx, {
2606
+ code: ZodIssueCode.invalid_type,
2607
+ expected: ZodParsedType.array,
2608
+ received: ctx.parsedType
2609
+ });
2610
+ return INVALID;
2611
+ }
2612
+ if (def.exactLength !== null) {
2613
+ const tooBig = ctx.data.length > def.exactLength.value;
2614
+ const tooSmall = ctx.data.length < def.exactLength.value;
2615
+ if (tooBig || tooSmall) {
2616
+ addIssueToContext(ctx, {
2617
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2618
+ minimum: tooSmall ? def.exactLength.value : undefined,
2619
+ maximum: tooBig ? def.exactLength.value : undefined,
2620
+ type: "array",
2621
+ inclusive: true,
2622
+ exact: true,
2623
+ message: def.exactLength.message
2624
+ });
2625
+ status.dirty();
2626
+ }
2627
+ }
2628
+ if (def.minLength !== null) {
2629
+ if (ctx.data.length < def.minLength.value) {
2630
+ addIssueToContext(ctx, {
2631
+ code: ZodIssueCode.too_small,
2632
+ minimum: def.minLength.value,
2633
+ type: "array",
2634
+ inclusive: true,
2635
+ exact: false,
2636
+ message: def.minLength.message
2637
+ });
2638
+ status.dirty();
2639
+ }
2640
+ }
2641
+ if (def.maxLength !== null) {
2642
+ if (ctx.data.length > def.maxLength.value) {
2643
+ addIssueToContext(ctx, {
2644
+ code: ZodIssueCode.too_big,
2645
+ maximum: def.maxLength.value,
2646
+ type: "array",
2647
+ inclusive: true,
2648
+ exact: false,
2649
+ message: def.maxLength.message
2650
+ });
2651
+ status.dirty();
2652
+ }
2653
+ }
2654
+ if (ctx.common.async) {
2655
+ return Promise.all([...ctx.data].map((item, i) => {
2656
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2657
+ })).then((result2) => {
2658
+ return ParseStatus.mergeArray(status, result2);
2659
+ });
2660
+ }
2661
+ const result = [...ctx.data].map((item, i) => {
2662
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2663
+ });
2664
+ return ParseStatus.mergeArray(status, result);
2665
+ }
2666
+ get element() {
2667
+ return this._def.type;
2668
+ }
2669
+ min(minLength, message) {
2670
+ return new ZodArray({
2671
+ ...this._def,
2672
+ minLength: { value: minLength, message: errorUtil.toString(message) }
2673
+ });
2674
+ }
2675
+ max(maxLength, message) {
2676
+ return new ZodArray({
2677
+ ...this._def,
2678
+ maxLength: { value: maxLength, message: errorUtil.toString(message) }
2679
+ });
2680
+ }
2681
+ length(len, message) {
2682
+ return new ZodArray({
2683
+ ...this._def,
2684
+ exactLength: { value: len, message: errorUtil.toString(message) }
2685
+ });
2686
+ }
2687
+ nonempty(message) {
2688
+ return this.min(1, message);
2689
+ }
2690
+ };
2691
+ ZodArray.create = (schema, params) => {
2692
+ return new ZodArray({
2693
+ type: schema,
2694
+ minLength: null,
2695
+ maxLength: null,
2696
+ exactLength: null,
2697
+ typeName: ZodFirstPartyTypeKind.ZodArray,
2698
+ ...processCreateParams(params)
2699
+ });
2700
+ };
2701
+ ZodObject = class ZodObject extends ZodType {
2702
+ constructor() {
2703
+ super(...arguments);
2704
+ this._cached = null;
2705
+ this.nonstrict = this.passthrough;
2706
+ this.augment = this.extend;
2707
+ }
2708
+ _getCached() {
2709
+ if (this._cached !== null)
2710
+ return this._cached;
2711
+ const shape = this._def.shape();
2712
+ const keys = util.objectKeys(shape);
2713
+ this._cached = { shape, keys };
2714
+ return this._cached;
2715
+ }
2716
+ _parse(input) {
2717
+ const parsedType = this._getType(input);
2718
+ if (parsedType !== ZodParsedType.object) {
2719
+ const ctx2 = this._getOrReturnCtx(input);
2720
+ addIssueToContext(ctx2, {
2721
+ code: ZodIssueCode.invalid_type,
2722
+ expected: ZodParsedType.object,
2723
+ received: ctx2.parsedType
2724
+ });
2725
+ return INVALID;
2726
+ }
2727
+ const { status, ctx } = this._processInputParams(input);
2728
+ const { shape, keys: shapeKeys } = this._getCached();
2729
+ const extraKeys = [];
2730
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2731
+ for (const key in ctx.data) {
2732
+ if (!shapeKeys.includes(key)) {
2733
+ extraKeys.push(key);
2734
+ }
2735
+ }
2736
+ }
2737
+ const pairs = [];
2738
+ for (const key of shapeKeys) {
2739
+ const keyValidator = shape[key];
2740
+ const value = ctx.data[key];
2741
+ pairs.push({
2742
+ key: { status: "valid", value: key },
2743
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2744
+ alwaysSet: key in ctx.data
2745
+ });
2746
+ }
2747
+ if (this._def.catchall instanceof ZodNever) {
2748
+ const unknownKeys = this._def.unknownKeys;
2749
+ if (unknownKeys === "passthrough") {
2750
+ for (const key of extraKeys) {
2751
+ pairs.push({
2752
+ key: { status: "valid", value: key },
2753
+ value: { status: "valid", value: ctx.data[key] }
2754
+ });
2755
+ }
2756
+ } else if (unknownKeys === "strict") {
2757
+ if (extraKeys.length > 0) {
2758
+ addIssueToContext(ctx, {
2759
+ code: ZodIssueCode.unrecognized_keys,
2760
+ keys: extraKeys
2761
+ });
2762
+ status.dirty();
2763
+ }
2764
+ } else if (unknownKeys === "strip") {} else {
2765
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2766
+ }
2767
+ } else {
2768
+ const catchall = this._def.catchall;
2769
+ for (const key of extraKeys) {
2770
+ const value = ctx.data[key];
2771
+ pairs.push({
2772
+ key: { status: "valid", value: key },
2773
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2774
+ alwaysSet: key in ctx.data
2775
+ });
2776
+ }
2777
+ }
2778
+ if (ctx.common.async) {
2779
+ return Promise.resolve().then(async () => {
2780
+ const syncPairs = [];
2781
+ for (const pair of pairs) {
2782
+ const key = await pair.key;
2783
+ const value = await pair.value;
2784
+ syncPairs.push({
2785
+ key,
2786
+ value,
2787
+ alwaysSet: pair.alwaysSet
2788
+ });
2789
+ }
2790
+ return syncPairs;
2791
+ }).then((syncPairs) => {
2792
+ return ParseStatus.mergeObjectSync(status, syncPairs);
2793
+ });
2794
+ } else {
2795
+ return ParseStatus.mergeObjectSync(status, pairs);
2796
+ }
2797
+ }
2798
+ get shape() {
2799
+ return this._def.shape();
2800
+ }
2801
+ strict(message) {
2802
+ errorUtil.errToObj;
2803
+ return new ZodObject({
2804
+ ...this._def,
2805
+ unknownKeys: "strict",
2806
+ ...message !== undefined ? {
2807
+ errorMap: (issue, ctx) => {
2808
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2809
+ if (issue.code === "unrecognized_keys")
2810
+ return {
2811
+ message: errorUtil.errToObj(message).message ?? defaultError
2812
+ };
2813
+ return {
2814
+ message: defaultError
2815
+ };
2816
+ }
2817
+ } : {}
2818
+ });
2819
+ }
2820
+ strip() {
2821
+ return new ZodObject({
2822
+ ...this._def,
2823
+ unknownKeys: "strip"
2824
+ });
2825
+ }
2826
+ passthrough() {
2827
+ return new ZodObject({
2828
+ ...this._def,
2829
+ unknownKeys: "passthrough"
2830
+ });
2831
+ }
2832
+ extend(augmentation) {
2833
+ return new ZodObject({
2834
+ ...this._def,
2835
+ shape: () => ({
2836
+ ...this._def.shape(),
2837
+ ...augmentation
2838
+ })
2839
+ });
2840
+ }
2841
+ merge(merging) {
2842
+ const merged = new ZodObject({
2843
+ unknownKeys: merging._def.unknownKeys,
2844
+ catchall: merging._def.catchall,
2845
+ shape: () => ({
2846
+ ...this._def.shape(),
2847
+ ...merging._def.shape()
2848
+ }),
2849
+ typeName: ZodFirstPartyTypeKind.ZodObject
2850
+ });
2851
+ return merged;
2852
+ }
2853
+ setKey(key, schema) {
2854
+ return this.augment({ [key]: schema });
2855
+ }
2856
+ catchall(index) {
2857
+ return new ZodObject({
2858
+ ...this._def,
2859
+ catchall: index
2860
+ });
2861
+ }
2862
+ pick(mask) {
2863
+ const shape = {};
2864
+ for (const key of util.objectKeys(mask)) {
2865
+ if (mask[key] && this.shape[key]) {
2866
+ shape[key] = this.shape[key];
2867
+ }
2868
+ }
2869
+ return new ZodObject({
2870
+ ...this._def,
2871
+ shape: () => shape
2872
+ });
2873
+ }
2874
+ omit(mask) {
2875
+ const shape = {};
2876
+ for (const key of util.objectKeys(this.shape)) {
2877
+ if (!mask[key]) {
2878
+ shape[key] = this.shape[key];
2879
+ }
2880
+ }
2881
+ return new ZodObject({
2882
+ ...this._def,
2883
+ shape: () => shape
2884
+ });
2885
+ }
2886
+ deepPartial() {
2887
+ return deepPartialify(this);
2888
+ }
2889
+ partial(mask) {
2890
+ const newShape = {};
2891
+ for (const key of util.objectKeys(this.shape)) {
2892
+ const fieldSchema = this.shape[key];
2893
+ if (mask && !mask[key]) {
2894
+ newShape[key] = fieldSchema;
2895
+ } else {
2896
+ newShape[key] = fieldSchema.optional();
2897
+ }
2898
+ }
2899
+ return new ZodObject({
2900
+ ...this._def,
2901
+ shape: () => newShape
2902
+ });
2903
+ }
2904
+ required(mask) {
2905
+ const newShape = {};
2906
+ for (const key of util.objectKeys(this.shape)) {
2907
+ if (mask && !mask[key]) {
2908
+ newShape[key] = this.shape[key];
2909
+ } else {
2910
+ const fieldSchema = this.shape[key];
2911
+ let newField = fieldSchema;
2912
+ while (newField instanceof ZodOptional) {
2913
+ newField = newField._def.innerType;
2914
+ }
2915
+ newShape[key] = newField;
2916
+ }
2917
+ }
2918
+ return new ZodObject({
2919
+ ...this._def,
2920
+ shape: () => newShape
2921
+ });
2922
+ }
2923
+ keyof() {
2924
+ return createZodEnum(util.objectKeys(this.shape));
2925
+ }
2926
+ };
2927
+ ZodObject.create = (shape, params) => {
2928
+ return new ZodObject({
2929
+ shape: () => shape,
2930
+ unknownKeys: "strip",
2931
+ catchall: ZodNever.create(),
2932
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2933
+ ...processCreateParams(params)
2934
+ });
2935
+ };
2936
+ ZodObject.strictCreate = (shape, params) => {
2937
+ return new ZodObject({
2938
+ shape: () => shape,
2939
+ unknownKeys: "strict",
2940
+ catchall: ZodNever.create(),
2941
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2942
+ ...processCreateParams(params)
2943
+ });
2944
+ };
2945
+ ZodObject.lazycreate = (shape, params) => {
2946
+ return new ZodObject({
2947
+ shape,
2948
+ unknownKeys: "strip",
2949
+ catchall: ZodNever.create(),
2950
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2951
+ ...processCreateParams(params)
2952
+ });
2953
+ };
2954
+ ZodUnion = class ZodUnion extends ZodType {
2955
+ _parse(input) {
2956
+ const { ctx } = this._processInputParams(input);
2957
+ const options = this._def.options;
2958
+ function handleResults(results) {
2959
+ for (const result of results) {
2960
+ if (result.result.status === "valid") {
2961
+ return result.result;
2962
+ }
2963
+ }
2964
+ for (const result of results) {
2965
+ if (result.result.status === "dirty") {
2966
+ ctx.common.issues.push(...result.ctx.common.issues);
2967
+ return result.result;
2968
+ }
2969
+ }
2970
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2971
+ addIssueToContext(ctx, {
2972
+ code: ZodIssueCode.invalid_union,
2973
+ unionErrors
2974
+ });
2975
+ return INVALID;
2976
+ }
2977
+ if (ctx.common.async) {
2978
+ return Promise.all(options.map(async (option) => {
2979
+ const childCtx = {
2980
+ ...ctx,
2981
+ common: {
2982
+ ...ctx.common,
2983
+ issues: []
2984
+ },
2985
+ parent: null
2986
+ };
2987
+ return {
2988
+ result: await option._parseAsync({
2989
+ data: ctx.data,
2990
+ path: ctx.path,
2991
+ parent: childCtx
2992
+ }),
2993
+ ctx: childCtx
2994
+ };
2995
+ })).then(handleResults);
2996
+ } else {
2997
+ let dirty = undefined;
2998
+ const issues = [];
2999
+ for (const option of options) {
3000
+ const childCtx = {
3001
+ ...ctx,
3002
+ common: {
3003
+ ...ctx.common,
3004
+ issues: []
3005
+ },
3006
+ parent: null
3007
+ };
3008
+ const result = option._parseSync({
3009
+ data: ctx.data,
3010
+ path: ctx.path,
3011
+ parent: childCtx
3012
+ });
3013
+ if (result.status === "valid") {
3014
+ return result;
3015
+ } else if (result.status === "dirty" && !dirty) {
3016
+ dirty = { result, ctx: childCtx };
3017
+ }
3018
+ if (childCtx.common.issues.length) {
3019
+ issues.push(childCtx.common.issues);
3020
+ }
3021
+ }
3022
+ if (dirty) {
3023
+ ctx.common.issues.push(...dirty.ctx.common.issues);
3024
+ return dirty.result;
3025
+ }
3026
+ const unionErrors = issues.map((issues2) => new ZodError(issues2));
3027
+ addIssueToContext(ctx, {
3028
+ code: ZodIssueCode.invalid_union,
3029
+ unionErrors
3030
+ });
3031
+ return INVALID;
3032
+ }
3033
+ }
3034
+ get options() {
3035
+ return this._def.options;
3036
+ }
3037
+ };
3038
+ ZodUnion.create = (types, params) => {
3039
+ return new ZodUnion({
3040
+ options: types,
3041
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
3042
+ ...processCreateParams(params)
3043
+ });
3044
+ };
3045
+ ZodDiscriminatedUnion = class ZodDiscriminatedUnion extends ZodType {
3046
+ _parse(input) {
3047
+ const { ctx } = this._processInputParams(input);
3048
+ if (ctx.parsedType !== ZodParsedType.object) {
3049
+ addIssueToContext(ctx, {
3050
+ code: ZodIssueCode.invalid_type,
3051
+ expected: ZodParsedType.object,
3052
+ received: ctx.parsedType
3053
+ });
3054
+ return INVALID;
3055
+ }
3056
+ const discriminator = this.discriminator;
3057
+ const discriminatorValue = ctx.data[discriminator];
3058
+ const option = this.optionsMap.get(discriminatorValue);
3059
+ if (!option) {
3060
+ addIssueToContext(ctx, {
3061
+ code: ZodIssueCode.invalid_union_discriminator,
3062
+ options: Array.from(this.optionsMap.keys()),
3063
+ path: [discriminator]
3064
+ });
3065
+ return INVALID;
3066
+ }
3067
+ if (ctx.common.async) {
3068
+ return option._parseAsync({
3069
+ data: ctx.data,
3070
+ path: ctx.path,
3071
+ parent: ctx
3072
+ });
3073
+ } else {
3074
+ return option._parseSync({
3075
+ data: ctx.data,
3076
+ path: ctx.path,
3077
+ parent: ctx
3078
+ });
3079
+ }
3080
+ }
3081
+ get discriminator() {
3082
+ return this._def.discriminator;
3083
+ }
3084
+ get options() {
3085
+ return this._def.options;
3086
+ }
3087
+ get optionsMap() {
3088
+ return this._def.optionsMap;
3089
+ }
3090
+ static create(discriminator, options, params) {
3091
+ const optionsMap = new Map;
3092
+ for (const type of options) {
3093
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
3094
+ if (!discriminatorValues.length) {
3095
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3096
+ }
3097
+ for (const value of discriminatorValues) {
3098
+ if (optionsMap.has(value)) {
3099
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
3100
+ }
3101
+ optionsMap.set(value, type);
3102
+ }
3103
+ }
3104
+ return new ZodDiscriminatedUnion({
3105
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
3106
+ discriminator,
3107
+ options,
3108
+ optionsMap,
3109
+ ...processCreateParams(params)
3110
+ });
3111
+ }
3112
+ };
3113
+ ZodIntersection = class ZodIntersection extends ZodType {
3114
+ _parse(input) {
3115
+ const { status, ctx } = this._processInputParams(input);
3116
+ const handleParsed = (parsedLeft, parsedRight) => {
3117
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) {
3118
+ return INVALID;
3119
+ }
3120
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
3121
+ if (!merged.valid) {
3122
+ addIssueToContext(ctx, {
3123
+ code: ZodIssueCode.invalid_intersection_types
3124
+ });
3125
+ return INVALID;
3126
+ }
3127
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) {
3128
+ status.dirty();
3129
+ }
3130
+ return { status: status.value, value: merged.data };
3131
+ };
3132
+ if (ctx.common.async) {
3133
+ return Promise.all([
3134
+ this._def.left._parseAsync({
3135
+ data: ctx.data,
3136
+ path: ctx.path,
3137
+ parent: ctx
3138
+ }),
3139
+ this._def.right._parseAsync({
3140
+ data: ctx.data,
3141
+ path: ctx.path,
3142
+ parent: ctx
3143
+ })
3144
+ ]).then(([left, right]) => handleParsed(left, right));
3145
+ } else {
3146
+ return handleParsed(this._def.left._parseSync({
3147
+ data: ctx.data,
3148
+ path: ctx.path,
3149
+ parent: ctx
3150
+ }), this._def.right._parseSync({
3151
+ data: ctx.data,
3152
+ path: ctx.path,
3153
+ parent: ctx
3154
+ }));
3155
+ }
3156
+ }
3157
+ };
3158
+ ZodIntersection.create = (left, right, params) => {
3159
+ return new ZodIntersection({
3160
+ left,
3161
+ right,
3162
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
3163
+ ...processCreateParams(params)
3164
+ });
3165
+ };
3166
+ ZodTuple = class ZodTuple extends ZodType {
3167
+ _parse(input) {
3168
+ const { status, ctx } = this._processInputParams(input);
3169
+ if (ctx.parsedType !== ZodParsedType.array) {
3170
+ addIssueToContext(ctx, {
3171
+ code: ZodIssueCode.invalid_type,
3172
+ expected: ZodParsedType.array,
3173
+ received: ctx.parsedType
3174
+ });
3175
+ return INVALID;
3176
+ }
3177
+ if (ctx.data.length < this._def.items.length) {
3178
+ addIssueToContext(ctx, {
3179
+ code: ZodIssueCode.too_small,
3180
+ minimum: this._def.items.length,
3181
+ inclusive: true,
3182
+ exact: false,
3183
+ type: "array"
3184
+ });
3185
+ return INVALID;
3186
+ }
3187
+ const rest = this._def.rest;
3188
+ if (!rest && ctx.data.length > this._def.items.length) {
3189
+ addIssueToContext(ctx, {
3190
+ code: ZodIssueCode.too_big,
3191
+ maximum: this._def.items.length,
3192
+ inclusive: true,
3193
+ exact: false,
3194
+ type: "array"
3195
+ });
3196
+ status.dirty();
3197
+ }
3198
+ const items = [...ctx.data].map((item, itemIndex) => {
3199
+ const schema = this._def.items[itemIndex] || this._def.rest;
3200
+ if (!schema)
3201
+ return null;
3202
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
3203
+ }).filter((x) => !!x);
3204
+ if (ctx.common.async) {
3205
+ return Promise.all(items).then((results) => {
3206
+ return ParseStatus.mergeArray(status, results);
3207
+ });
3208
+ } else {
3209
+ return ParseStatus.mergeArray(status, items);
3210
+ }
3211
+ }
3212
+ get items() {
3213
+ return this._def.items;
3214
+ }
3215
+ rest(rest) {
3216
+ return new ZodTuple({
3217
+ ...this._def,
3218
+ rest
3219
+ });
3220
+ }
3221
+ };
3222
+ ZodTuple.create = (schemas, params) => {
3223
+ if (!Array.isArray(schemas)) {
3224
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3225
+ }
3226
+ return new ZodTuple({
3227
+ items: schemas,
3228
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
3229
+ rest: null,
3230
+ ...processCreateParams(params)
3231
+ });
3232
+ };
3233
+ ZodRecord = class ZodRecord extends ZodType {
3234
+ get keySchema() {
3235
+ return this._def.keyType;
3236
+ }
3237
+ get valueSchema() {
3238
+ return this._def.valueType;
3239
+ }
3240
+ _parse(input) {
3241
+ const { status, ctx } = this._processInputParams(input);
3242
+ if (ctx.parsedType !== ZodParsedType.object) {
3243
+ addIssueToContext(ctx, {
3244
+ code: ZodIssueCode.invalid_type,
3245
+ expected: ZodParsedType.object,
3246
+ received: ctx.parsedType
3247
+ });
3248
+ return INVALID;
3249
+ }
3250
+ const pairs = [];
3251
+ const keyType = this._def.keyType;
3252
+ const valueType = this._def.valueType;
3253
+ for (const key in ctx.data) {
3254
+ pairs.push({
3255
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3256
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3257
+ alwaysSet: key in ctx.data
3258
+ });
3259
+ }
3260
+ if (ctx.common.async) {
3261
+ return ParseStatus.mergeObjectAsync(status, pairs);
3262
+ } else {
3263
+ return ParseStatus.mergeObjectSync(status, pairs);
3264
+ }
3265
+ }
3266
+ get element() {
3267
+ return this._def.valueType;
3268
+ }
3269
+ static create(first, second, third) {
3270
+ if (second instanceof ZodType) {
3271
+ return new ZodRecord({
3272
+ keyType: first,
3273
+ valueType: second,
3274
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
3275
+ ...processCreateParams(third)
3276
+ });
3277
+ }
3278
+ return new ZodRecord({
3279
+ keyType: ZodString.create(),
3280
+ valueType: first,
3281
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
3282
+ ...processCreateParams(second)
3283
+ });
3284
+ }
3285
+ };
3286
+ ZodMap = class ZodMap extends ZodType {
3287
+ get keySchema() {
3288
+ return this._def.keyType;
3289
+ }
3290
+ get valueSchema() {
3291
+ return this._def.valueType;
3292
+ }
3293
+ _parse(input) {
3294
+ const { status, ctx } = this._processInputParams(input);
3295
+ if (ctx.parsedType !== ZodParsedType.map) {
3296
+ addIssueToContext(ctx, {
3297
+ code: ZodIssueCode.invalid_type,
3298
+ expected: ZodParsedType.map,
3299
+ received: ctx.parsedType
3300
+ });
3301
+ return INVALID;
3302
+ }
3303
+ const keyType = this._def.keyType;
3304
+ const valueType = this._def.valueType;
3305
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
3306
+ return {
3307
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
3308
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
3309
+ };
3310
+ });
3311
+ if (ctx.common.async) {
3312
+ const finalMap = new Map;
3313
+ return Promise.resolve().then(async () => {
3314
+ for (const pair of pairs) {
3315
+ const key = await pair.key;
3316
+ const value = await pair.value;
3317
+ if (key.status === "aborted" || value.status === "aborted") {
3318
+ return INVALID;
3319
+ }
3320
+ if (key.status === "dirty" || value.status === "dirty") {
3321
+ status.dirty();
3322
+ }
3323
+ finalMap.set(key.value, value.value);
3324
+ }
3325
+ return { status: status.value, value: finalMap };
3326
+ });
3327
+ } else {
3328
+ const finalMap = new Map;
3329
+ for (const pair of pairs) {
3330
+ const key = pair.key;
3331
+ const value = pair.value;
3332
+ if (key.status === "aborted" || value.status === "aborted") {
3333
+ return INVALID;
3334
+ }
3335
+ if (key.status === "dirty" || value.status === "dirty") {
3336
+ status.dirty();
3337
+ }
3338
+ finalMap.set(key.value, value.value);
3339
+ }
3340
+ return { status: status.value, value: finalMap };
3341
+ }
3342
+ }
3343
+ };
3344
+ ZodMap.create = (keyType, valueType, params) => {
3345
+ return new ZodMap({
3346
+ valueType,
3347
+ keyType,
3348
+ typeName: ZodFirstPartyTypeKind.ZodMap,
3349
+ ...processCreateParams(params)
3350
+ });
3351
+ };
3352
+ ZodSet = class ZodSet extends ZodType {
3353
+ _parse(input) {
3354
+ const { status, ctx } = this._processInputParams(input);
3355
+ if (ctx.parsedType !== ZodParsedType.set) {
3356
+ addIssueToContext(ctx, {
3357
+ code: ZodIssueCode.invalid_type,
3358
+ expected: ZodParsedType.set,
3359
+ received: ctx.parsedType
3360
+ });
3361
+ return INVALID;
3362
+ }
3363
+ const def = this._def;
3364
+ if (def.minSize !== null) {
3365
+ if (ctx.data.size < def.minSize.value) {
3366
+ addIssueToContext(ctx, {
3367
+ code: ZodIssueCode.too_small,
3368
+ minimum: def.minSize.value,
3369
+ type: "set",
3370
+ inclusive: true,
3371
+ exact: false,
3372
+ message: def.minSize.message
3373
+ });
3374
+ status.dirty();
3375
+ }
3376
+ }
3377
+ if (def.maxSize !== null) {
3378
+ if (ctx.data.size > def.maxSize.value) {
3379
+ addIssueToContext(ctx, {
3380
+ code: ZodIssueCode.too_big,
3381
+ maximum: def.maxSize.value,
3382
+ type: "set",
3383
+ inclusive: true,
3384
+ exact: false,
3385
+ message: def.maxSize.message
3386
+ });
3387
+ status.dirty();
3388
+ }
3389
+ }
3390
+ const valueType = this._def.valueType;
3391
+ function finalizeSet(elements2) {
3392
+ const parsedSet = new Set;
3393
+ for (const element of elements2) {
3394
+ if (element.status === "aborted")
3395
+ return INVALID;
3396
+ if (element.status === "dirty")
3397
+ status.dirty();
3398
+ parsedSet.add(element.value);
3399
+ }
3400
+ return { status: status.value, value: parsedSet };
3401
+ }
3402
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3403
+ if (ctx.common.async) {
3404
+ return Promise.all(elements).then((elements2) => finalizeSet(elements2));
3405
+ } else {
3406
+ return finalizeSet(elements);
3407
+ }
3408
+ }
3409
+ min(minSize, message) {
3410
+ return new ZodSet({
3411
+ ...this._def,
3412
+ minSize: { value: minSize, message: errorUtil.toString(message) }
3413
+ });
3414
+ }
3415
+ max(maxSize, message) {
3416
+ return new ZodSet({
3417
+ ...this._def,
3418
+ maxSize: { value: maxSize, message: errorUtil.toString(message) }
3419
+ });
3420
+ }
3421
+ size(size, message) {
3422
+ return this.min(size, message).max(size, message);
3423
+ }
3424
+ nonempty(message) {
3425
+ return this.min(1, message);
3426
+ }
3427
+ };
3428
+ ZodSet.create = (valueType, params) => {
3429
+ return new ZodSet({
3430
+ valueType,
3431
+ minSize: null,
3432
+ maxSize: null,
3433
+ typeName: ZodFirstPartyTypeKind.ZodSet,
3434
+ ...processCreateParams(params)
3435
+ });
3436
+ };
3437
+ ZodFunction = class ZodFunction extends ZodType {
3438
+ constructor() {
3439
+ super(...arguments);
3440
+ this.validate = this.implement;
3441
+ }
3442
+ _parse(input) {
3443
+ const { ctx } = this._processInputParams(input);
3444
+ if (ctx.parsedType !== ZodParsedType.function) {
3445
+ addIssueToContext(ctx, {
3446
+ code: ZodIssueCode.invalid_type,
3447
+ expected: ZodParsedType.function,
3448
+ received: ctx.parsedType
3449
+ });
3450
+ return INVALID;
3451
+ }
3452
+ function makeArgsIssue(args, error) {
3453
+ return makeIssue({
3454
+ data: args,
3455
+ path: ctx.path,
3456
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3457
+ issueData: {
3458
+ code: ZodIssueCode.invalid_arguments,
3459
+ argumentsError: error
3460
+ }
3461
+ });
3462
+ }
3463
+ function makeReturnsIssue(returns, error) {
3464
+ return makeIssue({
3465
+ data: returns,
3466
+ path: ctx.path,
3467
+ errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
3468
+ issueData: {
3469
+ code: ZodIssueCode.invalid_return_type,
3470
+ returnTypeError: error
3471
+ }
3472
+ });
3473
+ }
3474
+ const params = { errorMap: ctx.common.contextualErrorMap };
3475
+ const fn = ctx.data;
3476
+ if (this._def.returns instanceof ZodPromise) {
3477
+ const me = this;
3478
+ return OK(async function(...args) {
3479
+ const error = new ZodError([]);
3480
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3481
+ error.addIssue(makeArgsIssue(args, e));
3482
+ throw error;
3483
+ });
3484
+ const result = await Reflect.apply(fn, this, parsedArgs);
3485
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3486
+ error.addIssue(makeReturnsIssue(result, e));
3487
+ throw error;
3488
+ });
3489
+ return parsedReturns;
3490
+ });
3491
+ } else {
3492
+ const me = this;
3493
+ return OK(function(...args) {
3494
+ const parsedArgs = me._def.args.safeParse(args, params);
3495
+ if (!parsedArgs.success) {
3496
+ throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3497
+ }
3498
+ const result = Reflect.apply(fn, this, parsedArgs.data);
3499
+ const parsedReturns = me._def.returns.safeParse(result, params);
3500
+ if (!parsedReturns.success) {
3501
+ throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3502
+ }
3503
+ return parsedReturns.data;
3504
+ });
3505
+ }
3506
+ }
3507
+ parameters() {
3508
+ return this._def.args;
3509
+ }
3510
+ returnType() {
3511
+ return this._def.returns;
3512
+ }
3513
+ args(...items) {
3514
+ return new ZodFunction({
3515
+ ...this._def,
3516
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
3517
+ });
3518
+ }
3519
+ returns(returnType) {
3520
+ return new ZodFunction({
3521
+ ...this._def,
3522
+ returns: returnType
3523
+ });
3524
+ }
3525
+ implement(func) {
3526
+ const validatedFunc = this.parse(func);
3527
+ return validatedFunc;
3528
+ }
3529
+ strictImplement(func) {
3530
+ const validatedFunc = this.parse(func);
3531
+ return validatedFunc;
3532
+ }
3533
+ static create(args, returns, params) {
3534
+ return new ZodFunction({
3535
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3536
+ returns: returns || ZodUnknown.create(),
3537
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
3538
+ ...processCreateParams(params)
3539
+ });
3540
+ }
3541
+ };
3542
+ ZodLazy = class ZodLazy extends ZodType {
3543
+ get schema() {
3544
+ return this._def.getter();
3545
+ }
3546
+ _parse(input) {
3547
+ const { ctx } = this._processInputParams(input);
3548
+ const lazySchema = this._def.getter();
3549
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3550
+ }
3551
+ };
3552
+ ZodLazy.create = (getter, params) => {
3553
+ return new ZodLazy({
3554
+ getter,
3555
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
3556
+ ...processCreateParams(params)
3557
+ });
3558
+ };
3559
+ ZodLiteral = class ZodLiteral extends ZodType {
3560
+ _parse(input) {
3561
+ if (input.data !== this._def.value) {
3562
+ const ctx = this._getOrReturnCtx(input);
3563
+ addIssueToContext(ctx, {
3564
+ received: ctx.data,
3565
+ code: ZodIssueCode.invalid_literal,
3566
+ expected: this._def.value
3567
+ });
3568
+ return INVALID;
3569
+ }
3570
+ return { status: "valid", value: input.data };
3571
+ }
3572
+ get value() {
3573
+ return this._def.value;
3574
+ }
3575
+ };
3576
+ ZodLiteral.create = (value, params) => {
3577
+ return new ZodLiteral({
3578
+ value,
3579
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
3580
+ ...processCreateParams(params)
3581
+ });
3582
+ };
3583
+ ZodEnum = class ZodEnum extends ZodType {
3584
+ _parse(input) {
3585
+ if (typeof input.data !== "string") {
3586
+ const ctx = this._getOrReturnCtx(input);
3587
+ const expectedValues = this._def.values;
3588
+ addIssueToContext(ctx, {
3589
+ expected: util.joinValues(expectedValues),
3590
+ received: ctx.parsedType,
3591
+ code: ZodIssueCode.invalid_type
3592
+ });
3593
+ return INVALID;
3594
+ }
3595
+ if (!this._cache) {
3596
+ this._cache = new Set(this._def.values);
3597
+ }
3598
+ if (!this._cache.has(input.data)) {
3599
+ const ctx = this._getOrReturnCtx(input);
3600
+ const expectedValues = this._def.values;
3601
+ addIssueToContext(ctx, {
3602
+ received: ctx.data,
3603
+ code: ZodIssueCode.invalid_enum_value,
3604
+ options: expectedValues
3605
+ });
3606
+ return INVALID;
3607
+ }
3608
+ return OK(input.data);
3609
+ }
3610
+ get options() {
3611
+ return this._def.values;
3612
+ }
3613
+ get enum() {
3614
+ const enumValues = {};
3615
+ for (const val of this._def.values) {
3616
+ enumValues[val] = val;
3617
+ }
3618
+ return enumValues;
3619
+ }
3620
+ get Values() {
3621
+ const enumValues = {};
3622
+ for (const val of this._def.values) {
3623
+ enumValues[val] = val;
3624
+ }
3625
+ return enumValues;
3626
+ }
3627
+ get Enum() {
3628
+ const enumValues = {};
3629
+ for (const val of this._def.values) {
3630
+ enumValues[val] = val;
3631
+ }
3632
+ return enumValues;
3633
+ }
3634
+ extract(values, newDef = this._def) {
3635
+ return ZodEnum.create(values, {
3636
+ ...this._def,
3637
+ ...newDef
3638
+ });
3639
+ }
3640
+ exclude(values, newDef = this._def) {
3641
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3642
+ ...this._def,
3643
+ ...newDef
3644
+ });
3645
+ }
3646
+ };
3647
+ ZodEnum.create = createZodEnum;
3648
+ ZodNativeEnum = class ZodNativeEnum extends ZodType {
3649
+ _parse(input) {
3650
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
3651
+ const ctx = this._getOrReturnCtx(input);
3652
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3653
+ const expectedValues = util.objectValues(nativeEnumValues);
3654
+ addIssueToContext(ctx, {
3655
+ expected: util.joinValues(expectedValues),
3656
+ received: ctx.parsedType,
3657
+ code: ZodIssueCode.invalid_type
3658
+ });
3659
+ return INVALID;
3660
+ }
3661
+ if (!this._cache) {
3662
+ this._cache = new Set(util.getValidEnumValues(this._def.values));
3663
+ }
3664
+ if (!this._cache.has(input.data)) {
3665
+ const expectedValues = util.objectValues(nativeEnumValues);
3666
+ addIssueToContext(ctx, {
3667
+ received: ctx.data,
3668
+ code: ZodIssueCode.invalid_enum_value,
3669
+ options: expectedValues
3670
+ });
3671
+ return INVALID;
3672
+ }
3673
+ return OK(input.data);
3674
+ }
3675
+ get enum() {
3676
+ return this._def.values;
3677
+ }
3678
+ };
3679
+ ZodNativeEnum.create = (values, params) => {
3680
+ return new ZodNativeEnum({
3681
+ values,
3682
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3683
+ ...processCreateParams(params)
3684
+ });
3685
+ };
3686
+ ZodPromise = class ZodPromise extends ZodType {
3687
+ unwrap() {
3688
+ return this._def.type;
3689
+ }
3690
+ _parse(input) {
3691
+ const { ctx } = this._processInputParams(input);
3692
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3693
+ addIssueToContext(ctx, {
3694
+ code: ZodIssueCode.invalid_type,
3695
+ expected: ZodParsedType.promise,
3696
+ received: ctx.parsedType
3697
+ });
3698
+ return INVALID;
3699
+ }
3700
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3701
+ return OK(promisified.then((data) => {
3702
+ return this._def.type.parseAsync(data, {
3703
+ path: ctx.path,
3704
+ errorMap: ctx.common.contextualErrorMap
3705
+ });
3706
+ }));
3707
+ }
3708
+ };
3709
+ ZodPromise.create = (schema, params) => {
3710
+ return new ZodPromise({
3711
+ type: schema,
3712
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
3713
+ ...processCreateParams(params)
3714
+ });
3715
+ };
3716
+ ZodEffects = class ZodEffects extends ZodType {
3717
+ innerType() {
3718
+ return this._def.schema;
3719
+ }
3720
+ sourceType() {
3721
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3722
+ }
3723
+ _parse(input) {
3724
+ const { status, ctx } = this._processInputParams(input);
3725
+ const effect = this._def.effect || null;
3726
+ const checkCtx = {
3727
+ addIssue: (arg) => {
3728
+ addIssueToContext(ctx, arg);
3729
+ if (arg.fatal) {
3730
+ status.abort();
3731
+ } else {
3732
+ status.dirty();
3733
+ }
3734
+ },
3735
+ get path() {
3736
+ return ctx.path;
3737
+ }
3738
+ };
3739
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3740
+ if (effect.type === "preprocess") {
3741
+ const processed = effect.transform(ctx.data, checkCtx);
3742
+ if (ctx.common.async) {
3743
+ return Promise.resolve(processed).then(async (processed2) => {
3744
+ if (status.value === "aborted")
3745
+ return INVALID;
3746
+ const result = await this._def.schema._parseAsync({
3747
+ data: processed2,
3748
+ path: ctx.path,
3749
+ parent: ctx
3750
+ });
3751
+ if (result.status === "aborted")
3752
+ return INVALID;
3753
+ if (result.status === "dirty")
3754
+ return DIRTY(result.value);
3755
+ if (status.value === "dirty")
3756
+ return DIRTY(result.value);
3757
+ return result;
3758
+ });
3759
+ } else {
3760
+ if (status.value === "aborted")
3761
+ return INVALID;
3762
+ const result = this._def.schema._parseSync({
3763
+ data: processed,
3764
+ path: ctx.path,
3765
+ parent: ctx
3766
+ });
3767
+ if (result.status === "aborted")
3768
+ return INVALID;
3769
+ if (result.status === "dirty")
3770
+ return DIRTY(result.value);
3771
+ if (status.value === "dirty")
3772
+ return DIRTY(result.value);
3773
+ return result;
3774
+ }
3775
+ }
3776
+ if (effect.type === "refinement") {
3777
+ const executeRefinement = (acc) => {
3778
+ const result = effect.refinement(acc, checkCtx);
3779
+ if (ctx.common.async) {
3780
+ return Promise.resolve(result);
3781
+ }
3782
+ if (result instanceof Promise) {
3783
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3784
+ }
3785
+ return acc;
3786
+ };
3787
+ if (ctx.common.async === false) {
3788
+ const inner = this._def.schema._parseSync({
3789
+ data: ctx.data,
3790
+ path: ctx.path,
3791
+ parent: ctx
3792
+ });
3793
+ if (inner.status === "aborted")
3794
+ return INVALID;
3795
+ if (inner.status === "dirty")
3796
+ status.dirty();
3797
+ executeRefinement(inner.value);
3798
+ return { status: status.value, value: inner.value };
3799
+ } else {
3800
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3801
+ if (inner.status === "aborted")
3802
+ return INVALID;
3803
+ if (inner.status === "dirty")
3804
+ status.dirty();
3805
+ return executeRefinement(inner.value).then(() => {
3806
+ return { status: status.value, value: inner.value };
3807
+ });
3808
+ });
3809
+ }
3810
+ }
3811
+ if (effect.type === "transform") {
3812
+ if (ctx.common.async === false) {
3813
+ const base = this._def.schema._parseSync({
3814
+ data: ctx.data,
3815
+ path: ctx.path,
3816
+ parent: ctx
3817
+ });
3818
+ if (!isValid(base))
3819
+ return INVALID;
3820
+ const result = effect.transform(base.value, checkCtx);
3821
+ if (result instanceof Promise) {
3822
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3823
+ }
3824
+ return { status: status.value, value: result };
3825
+ } else {
3826
+ return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3827
+ if (!isValid(base))
3828
+ return INVALID;
3829
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3830
+ status: status.value,
3831
+ value: result
3832
+ }));
3833
+ });
3834
+ }
3835
+ }
3836
+ util.assertNever(effect);
3837
+ }
3838
+ };
3839
+ ZodEffects.create = (schema, effect, params) => {
3840
+ return new ZodEffects({
3841
+ schema,
3842
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3843
+ effect,
3844
+ ...processCreateParams(params)
3845
+ });
3846
+ };
3847
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3848
+ return new ZodEffects({
3849
+ schema,
3850
+ effect: { type: "preprocess", transform: preprocess },
3851
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3852
+ ...processCreateParams(params)
3853
+ });
3854
+ };
3855
+ ZodOptional = class ZodOptional extends ZodType {
3856
+ _parse(input) {
3857
+ const parsedType = this._getType(input);
3858
+ if (parsedType === ZodParsedType.undefined) {
3859
+ return OK(undefined);
3860
+ }
3861
+ return this._def.innerType._parse(input);
3862
+ }
3863
+ unwrap() {
3864
+ return this._def.innerType;
3865
+ }
3866
+ };
3867
+ ZodOptional.create = (type, params) => {
3868
+ return new ZodOptional({
3869
+ innerType: type,
3870
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
3871
+ ...processCreateParams(params)
3872
+ });
3873
+ };
3874
+ ZodNullable = class ZodNullable extends ZodType {
3875
+ _parse(input) {
3876
+ const parsedType = this._getType(input);
3877
+ if (parsedType === ZodParsedType.null) {
3878
+ return OK(null);
3879
+ }
3880
+ return this._def.innerType._parse(input);
3881
+ }
3882
+ unwrap() {
3883
+ return this._def.innerType;
3884
+ }
3885
+ };
3886
+ ZodNullable.create = (type, params) => {
3887
+ return new ZodNullable({
3888
+ innerType: type,
3889
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
3890
+ ...processCreateParams(params)
3891
+ });
3892
+ };
3893
+ ZodDefault = class ZodDefault extends ZodType {
3894
+ _parse(input) {
3895
+ const { ctx } = this._processInputParams(input);
3896
+ let data = ctx.data;
3897
+ if (ctx.parsedType === ZodParsedType.undefined) {
3898
+ data = this._def.defaultValue();
3899
+ }
3900
+ return this._def.innerType._parse({
3901
+ data,
3902
+ path: ctx.path,
3903
+ parent: ctx
3904
+ });
3905
+ }
3906
+ removeDefault() {
3907
+ return this._def.innerType;
3908
+ }
3909
+ };
3910
+ ZodDefault.create = (type, params) => {
3911
+ return new ZodDefault({
3912
+ innerType: type,
3913
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
3914
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3915
+ ...processCreateParams(params)
3916
+ });
3917
+ };
3918
+ ZodCatch = class ZodCatch extends ZodType {
3919
+ _parse(input) {
3920
+ const { ctx } = this._processInputParams(input);
3921
+ const newCtx = {
3922
+ ...ctx,
3923
+ common: {
3924
+ ...ctx.common,
3925
+ issues: []
3926
+ }
3927
+ };
3928
+ const result = this._def.innerType._parse({
3929
+ data: newCtx.data,
3930
+ path: newCtx.path,
3931
+ parent: {
3932
+ ...newCtx
3933
+ }
3934
+ });
3935
+ if (isAsync(result)) {
3936
+ return result.then((result2) => {
3937
+ return {
3938
+ status: "valid",
3939
+ value: result2.status === "valid" ? result2.value : this._def.catchValue({
3940
+ get error() {
3941
+ return new ZodError(newCtx.common.issues);
3942
+ },
3943
+ input: newCtx.data
3944
+ })
3945
+ };
3946
+ });
3947
+ } else {
3948
+ return {
3949
+ status: "valid",
3950
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3951
+ get error() {
3952
+ return new ZodError(newCtx.common.issues);
3953
+ },
3954
+ input: newCtx.data
3955
+ })
3956
+ };
3957
+ }
3958
+ }
3959
+ removeCatch() {
3960
+ return this._def.innerType;
3961
+ }
3962
+ };
3963
+ ZodCatch.create = (type, params) => {
3964
+ return new ZodCatch({
3965
+ innerType: type,
3966
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
3967
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3968
+ ...processCreateParams(params)
3969
+ });
3970
+ };
3971
+ ZodNaN = class ZodNaN extends ZodType {
3972
+ _parse(input) {
3973
+ const parsedType = this._getType(input);
3974
+ if (parsedType !== ZodParsedType.nan) {
3975
+ const ctx = this._getOrReturnCtx(input);
3976
+ addIssueToContext(ctx, {
3977
+ code: ZodIssueCode.invalid_type,
3978
+ expected: ZodParsedType.nan,
3979
+ received: ctx.parsedType
3980
+ });
3981
+ return INVALID;
3982
+ }
3983
+ return { status: "valid", value: input.data };
3984
+ }
3985
+ };
3986
+ ZodNaN.create = (params) => {
3987
+ return new ZodNaN({
3988
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
3989
+ ...processCreateParams(params)
3990
+ });
3991
+ };
3992
+ BRAND = Symbol("zod_brand");
3993
+ ZodBranded = class ZodBranded extends ZodType {
3994
+ _parse(input) {
3995
+ const { ctx } = this._processInputParams(input);
3996
+ const data = ctx.data;
3997
+ return this._def.type._parse({
3998
+ data,
3999
+ path: ctx.path,
4000
+ parent: ctx
4001
+ });
4002
+ }
4003
+ unwrap() {
4004
+ return this._def.type;
4005
+ }
4006
+ };
4007
+ ZodPipeline = class ZodPipeline extends ZodType {
4008
+ _parse(input) {
4009
+ const { status, ctx } = this._processInputParams(input);
4010
+ if (ctx.common.async) {
4011
+ const handleAsync = async () => {
4012
+ const inResult = await this._def.in._parseAsync({
4013
+ data: ctx.data,
4014
+ path: ctx.path,
4015
+ parent: ctx
4016
+ });
4017
+ if (inResult.status === "aborted")
4018
+ return INVALID;
4019
+ if (inResult.status === "dirty") {
4020
+ status.dirty();
4021
+ return DIRTY(inResult.value);
4022
+ } else {
4023
+ return this._def.out._parseAsync({
4024
+ data: inResult.value,
4025
+ path: ctx.path,
4026
+ parent: ctx
4027
+ });
4028
+ }
4029
+ };
4030
+ return handleAsync();
4031
+ } else {
4032
+ const inResult = this._def.in._parseSync({
4033
+ data: ctx.data,
4034
+ path: ctx.path,
4035
+ parent: ctx
4036
+ });
4037
+ if (inResult.status === "aborted")
4038
+ return INVALID;
4039
+ if (inResult.status === "dirty") {
4040
+ status.dirty();
4041
+ return {
4042
+ status: "dirty",
4043
+ value: inResult.value
4044
+ };
4045
+ } else {
4046
+ return this._def.out._parseSync({
4047
+ data: inResult.value,
4048
+ path: ctx.path,
4049
+ parent: ctx
4050
+ });
4051
+ }
4052
+ }
4053
+ }
4054
+ static create(a, b) {
4055
+ return new ZodPipeline({
4056
+ in: a,
4057
+ out: b,
4058
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
4059
+ });
4060
+ }
4061
+ };
4062
+ ZodReadonly = class ZodReadonly extends ZodType {
4063
+ _parse(input) {
4064
+ const result = this._def.innerType._parse(input);
4065
+ const freeze = (data) => {
4066
+ if (isValid(data)) {
4067
+ data.value = Object.freeze(data.value);
4068
+ }
4069
+ return data;
4070
+ };
4071
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
4072
+ }
4073
+ unwrap() {
4074
+ return this._def.innerType;
4075
+ }
4076
+ };
4077
+ ZodReadonly.create = (type, params) => {
4078
+ return new ZodReadonly({
4079
+ innerType: type,
4080
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
4081
+ ...processCreateParams(params)
4082
+ });
4083
+ };
4084
+ late = {
4085
+ object: ZodObject.lazycreate
4086
+ };
4087
+ (function(ZodFirstPartyTypeKind2) {
4088
+ ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
4089
+ ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
4090
+ ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
4091
+ ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
4092
+ ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
4093
+ ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
4094
+ ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
4095
+ ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
4096
+ ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
4097
+ ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
4098
+ ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
4099
+ ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
4100
+ ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
4101
+ ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
4102
+ ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
4103
+ ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
4104
+ ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
4105
+ ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
4106
+ ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
4107
+ ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
4108
+ ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
4109
+ ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
4110
+ ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
4111
+ ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
4112
+ ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
4113
+ ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
4114
+ ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
4115
+ ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
4116
+ ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
4117
+ ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
4118
+ ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
4119
+ ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
4120
+ ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4121
+ ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4122
+ ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4123
+ ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
4124
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4125
+ stringType = ZodString.create;
4126
+ numberType = ZodNumber.create;
4127
+ nanType = ZodNaN.create;
4128
+ bigIntType = ZodBigInt.create;
4129
+ booleanType = ZodBoolean.create;
4130
+ dateType = ZodDate.create;
4131
+ symbolType = ZodSymbol.create;
4132
+ undefinedType = ZodUndefined.create;
4133
+ nullType = ZodNull.create;
4134
+ anyType = ZodAny.create;
4135
+ unknownType = ZodUnknown.create;
4136
+ neverType = ZodNever.create;
4137
+ voidType = ZodVoid.create;
4138
+ arrayType = ZodArray.create;
4139
+ objectType = ZodObject.create;
4140
+ strictObjectType = ZodObject.strictCreate;
4141
+ unionType = ZodUnion.create;
4142
+ discriminatedUnionType = ZodDiscriminatedUnion.create;
4143
+ intersectionType = ZodIntersection.create;
4144
+ tupleType = ZodTuple.create;
4145
+ recordType = ZodRecord.create;
4146
+ mapType = ZodMap.create;
4147
+ setType = ZodSet.create;
4148
+ functionType = ZodFunction.create;
4149
+ lazyType = ZodLazy.create;
4150
+ literalType = ZodLiteral.create;
4151
+ enumType = ZodEnum.create;
4152
+ nativeEnumType = ZodNativeEnum.create;
4153
+ promiseType = ZodPromise.create;
4154
+ effectsType = ZodEffects.create;
4155
+ optionalType = ZodOptional.create;
4156
+ nullableType = ZodNullable.create;
4157
+ preprocessType = ZodEffects.createWithPreprocess;
4158
+ pipelineType = ZodPipeline.create;
4159
+ coerce = {
4160
+ string: (arg) => ZodString.create({ ...arg, coerce: true }),
4161
+ number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
4162
+ boolean: (arg) => ZodBoolean.create({
4163
+ ...arg,
4164
+ coerce: true
4165
+ }),
4166
+ bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
4167
+ date: (arg) => ZodDate.create({ ...arg, coerce: true })
4168
+ };
4169
+ NEVER = INVALID;
4170
+ });
4171
+
4172
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/typeAliases.js
4173
+ var init_typeAliases = () => {};
4174
+
4175
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
4176
+ var exports_external = {};
4177
+ __export(exports_external, {
4178
+ void: () => voidType,
4179
+ util: () => util,
4180
+ unknown: () => unknownType,
4181
+ union: () => unionType,
4182
+ undefined: () => undefinedType,
4183
+ tuple: () => tupleType,
4184
+ transformer: () => effectsType,
4185
+ symbol: () => symbolType,
4186
+ string: () => stringType,
4187
+ strictObject: () => strictObjectType,
4188
+ setErrorMap: () => setErrorMap,
4189
+ set: () => setType,
4190
+ record: () => recordType,
4191
+ quotelessJson: () => quotelessJson,
4192
+ promise: () => promiseType,
4193
+ preprocess: () => preprocessType,
4194
+ pipeline: () => pipelineType,
4195
+ ostring: () => ostring,
4196
+ optional: () => optionalType,
4197
+ onumber: () => onumber,
4198
+ oboolean: () => oboolean,
4199
+ objectUtil: () => objectUtil,
4200
+ object: () => objectType,
4201
+ number: () => numberType,
4202
+ nullable: () => nullableType,
4203
+ null: () => nullType,
4204
+ never: () => neverType,
4205
+ nativeEnum: () => nativeEnumType,
4206
+ nan: () => nanType,
4207
+ map: () => mapType,
4208
+ makeIssue: () => makeIssue,
4209
+ literal: () => literalType,
4210
+ lazy: () => lazyType,
4211
+ late: () => late,
4212
+ isValid: () => isValid,
4213
+ isDirty: () => isDirty,
4214
+ isAsync: () => isAsync,
4215
+ isAborted: () => isAborted,
4216
+ intersection: () => intersectionType,
4217
+ instanceof: () => instanceOfType,
4218
+ getParsedType: () => getParsedType,
4219
+ getErrorMap: () => getErrorMap,
4220
+ function: () => functionType,
4221
+ enum: () => enumType,
4222
+ effect: () => effectsType,
4223
+ discriminatedUnion: () => discriminatedUnionType,
4224
+ defaultErrorMap: () => en_default,
4225
+ datetimeRegex: () => datetimeRegex,
4226
+ date: () => dateType,
4227
+ custom: () => custom,
4228
+ coerce: () => coerce,
4229
+ boolean: () => booleanType,
4230
+ bigint: () => bigIntType,
4231
+ array: () => arrayType,
4232
+ any: () => anyType,
4233
+ addIssueToContext: () => addIssueToContext,
4234
+ ZodVoid: () => ZodVoid,
4235
+ ZodUnknown: () => ZodUnknown,
4236
+ ZodUnion: () => ZodUnion,
4237
+ ZodUndefined: () => ZodUndefined,
4238
+ ZodType: () => ZodType,
4239
+ ZodTuple: () => ZodTuple,
4240
+ ZodTransformer: () => ZodEffects,
4241
+ ZodSymbol: () => ZodSymbol,
4242
+ ZodString: () => ZodString,
4243
+ ZodSet: () => ZodSet,
4244
+ ZodSchema: () => ZodType,
4245
+ ZodRecord: () => ZodRecord,
4246
+ ZodReadonly: () => ZodReadonly,
4247
+ ZodPromise: () => ZodPromise,
4248
+ ZodPipeline: () => ZodPipeline,
4249
+ ZodParsedType: () => ZodParsedType,
4250
+ ZodOptional: () => ZodOptional,
4251
+ ZodObject: () => ZodObject,
4252
+ ZodNumber: () => ZodNumber,
4253
+ ZodNullable: () => ZodNullable,
4254
+ ZodNull: () => ZodNull,
4255
+ ZodNever: () => ZodNever,
4256
+ ZodNativeEnum: () => ZodNativeEnum,
4257
+ ZodNaN: () => ZodNaN,
4258
+ ZodMap: () => ZodMap,
4259
+ ZodLiteral: () => ZodLiteral,
4260
+ ZodLazy: () => ZodLazy,
4261
+ ZodIssueCode: () => ZodIssueCode,
4262
+ ZodIntersection: () => ZodIntersection,
4263
+ ZodFunction: () => ZodFunction,
4264
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
4265
+ ZodError: () => ZodError,
4266
+ ZodEnum: () => ZodEnum,
4267
+ ZodEffects: () => ZodEffects,
4268
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
4269
+ ZodDefault: () => ZodDefault,
4270
+ ZodDate: () => ZodDate,
4271
+ ZodCatch: () => ZodCatch,
4272
+ ZodBranded: () => ZodBranded,
4273
+ ZodBoolean: () => ZodBoolean,
4274
+ ZodBigInt: () => ZodBigInt,
4275
+ ZodArray: () => ZodArray,
4276
+ ZodAny: () => ZodAny,
4277
+ Schema: () => ZodType,
4278
+ ParseStatus: () => ParseStatus,
4279
+ OK: () => OK,
4280
+ NEVER: () => NEVER,
4281
+ INVALID: () => INVALID,
4282
+ EMPTY_PATH: () => EMPTY_PATH,
4283
+ DIRTY: () => DIRTY,
4284
+ BRAND: () => BRAND
4285
+ });
4286
+ var init_external = __esm(() => {
4287
+ init_errors();
4288
+ init_parseUtil();
4289
+ init_typeAliases();
4290
+ init_util();
4291
+ init_types();
4292
+ init_ZodError();
4293
+ });
4294
+
4295
+ // node_modules/.bun/zod@3.25.76/node_modules/zod/index.js
4296
+ var init_zod = __esm(() => {
4297
+ init_external();
4298
+ init_external();
4299
+ });
4300
+
4301
+ export { require_ignore, stringType, numberType, booleanType, anyType, arrayType, objectType, strictObjectType, unionType, recordType, literalType, enumType, exports_external, init_zod };