keycloakify 10.0.0-rc.12 → 10.0.0-rc.121

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 (1274) hide show
  1. package/PUBLIC_URL.d.ts +1 -1
  2. package/PUBLIC_URL.js +4 -4
  3. package/PUBLIC_URL.js.map +1 -1
  4. package/README.md +35 -246
  5. package/account/DefaultPage.d.ts +5 -0
  6. package/account/DefaultPage.js +44 -0
  7. package/account/DefaultPage.js.map +1 -0
  8. package/account/KcContext/KcContext.d.ts +268 -0
  9. package/account/KcContext/KcContext.js.map +1 -0
  10. package/account/KcContext/getKcContextMock.d.ts +24 -0
  11. package/account/KcContext/getKcContextMock.js +28 -0
  12. package/account/KcContext/getKcContextMock.js.map +1 -0
  13. package/account/KcContext/index.d.ts +2 -0
  14. package/account/KcContext/index.js +2 -0
  15. package/account/KcContext/index.js.map +1 -0
  16. package/account/KcContext/kcContextMocks.d.ts +4 -0
  17. package/account/KcContext/kcContextMocks.js +146 -0
  18. package/account/KcContext/kcContextMocks.js.map +1 -0
  19. package/account/Template.d.ts +2 -2
  20. package/account/Template.js +14 -12
  21. package/account/Template.js.map +1 -1
  22. package/account/TemplateProps.d.ts +3 -5
  23. package/account/i18n/GenericI18n.d.ts +6 -0
  24. package/account/i18n/GenericI18n.js +2 -0
  25. package/account/i18n/GenericI18n.js.map +1 -0
  26. package/account/i18n/i18n.d.ts +42 -50
  27. package/account/i18n/i18n.js +91 -92
  28. package/account/i18n/i18n.js.map +1 -1
  29. package/account/i18n/index.d.ts +5 -1
  30. package/account/i18n/index.js +1 -1
  31. package/account/i18n/index.js.map +1 -1
  32. package/account/i18n/messages_defaultSet/ar.d.ts +361 -0
  33. package/account/i18n/messages_defaultSet/ar.js +366 -0
  34. package/account/i18n/messages_defaultSet/ar.js.map +1 -0
  35. package/account/i18n/messages_defaultSet/ca.d.ts +361 -0
  36. package/account/i18n/messages_defaultSet/ca.js +366 -0
  37. package/account/i18n/messages_defaultSet/ca.js.map +1 -0
  38. package/account/i18n/messages_defaultSet/cs.d.ts +153 -0
  39. package/account/i18n/messages_defaultSet/cs.js +158 -0
  40. package/account/i18n/messages_defaultSet/cs.js.map +1 -0
  41. package/account/i18n/messages_defaultSet/da.d.ts +290 -0
  42. package/account/i18n/messages_defaultSet/da.js +295 -0
  43. package/account/i18n/messages_defaultSet/da.js.map +1 -0
  44. package/account/i18n/messages_defaultSet/de.d.ts +313 -0
  45. package/account/i18n/messages_defaultSet/de.js +318 -0
  46. package/account/i18n/messages_defaultSet/de.js.map +1 -0
  47. package/account/i18n/messages_defaultSet/el.d.ts +360 -0
  48. package/account/i18n/messages_defaultSet/el.js +365 -0
  49. package/account/i18n/messages_defaultSet/el.js.map +1 -0
  50. package/account/i18n/messages_defaultSet/en.d.ts +364 -0
  51. package/account/i18n/messages_defaultSet/en.js +369 -0
  52. package/account/i18n/messages_defaultSet/en.js.map +1 -0
  53. package/account/i18n/messages_defaultSet/es.d.ts +363 -0
  54. package/account/i18n/messages_defaultSet/es.js +368 -0
  55. package/account/i18n/messages_defaultSet/es.js.map +1 -0
  56. package/account/i18n/messages_defaultSet/fa.d.ts +361 -0
  57. package/account/i18n/messages_defaultSet/fa.js +366 -0
  58. package/account/i18n/messages_defaultSet/fa.js.map +1 -0
  59. package/account/i18n/messages_defaultSet/fi.d.ts +357 -0
  60. package/account/i18n/messages_defaultSet/fi.js +362 -0
  61. package/account/i18n/messages_defaultSet/fi.js.map +1 -0
  62. package/account/i18n/messages_defaultSet/fr.d.ts +164 -0
  63. package/account/i18n/messages_defaultSet/fr.js +169 -0
  64. package/account/i18n/messages_defaultSet/fr.js.map +1 -0
  65. package/account/i18n/messages_defaultSet/hu.d.ts +361 -0
  66. package/account/i18n/messages_defaultSet/hu.js +366 -0
  67. package/account/i18n/messages_defaultSet/hu.js.map +1 -0
  68. package/account/i18n/messages_defaultSet/index.d.ts +2096 -0
  69. package/account/i18n/messages_defaultSet/index.js +39 -0
  70. package/account/i18n/messages_defaultSet/index.js.map +1 -0
  71. package/account/i18n/messages_defaultSet/it.d.ts +301 -0
  72. package/account/i18n/messages_defaultSet/it.js +306 -0
  73. package/account/i18n/messages_defaultSet/it.js.map +1 -0
  74. package/account/i18n/messages_defaultSet/ja.d.ts +295 -0
  75. package/account/i18n/messages_defaultSet/ja.js +300 -0
  76. package/account/i18n/messages_defaultSet/ja.js.map +1 -0
  77. package/account/i18n/messages_defaultSet/lt.d.ts +138 -0
  78. package/account/i18n/messages_defaultSet/lt.js +143 -0
  79. package/account/i18n/messages_defaultSet/lt.js.map +1 -0
  80. package/account/i18n/messages_defaultSet/lv.d.ts +182 -0
  81. package/account/i18n/messages_defaultSet/lv.js +187 -0
  82. package/account/i18n/messages_defaultSet/lv.js.map +1 -0
  83. package/account/i18n/messages_defaultSet/nl.d.ts +330 -0
  84. package/account/i18n/messages_defaultSet/nl.js +335 -0
  85. package/account/i18n/messages_defaultSet/nl.js.map +1 -0
  86. package/account/i18n/messages_defaultSet/no.d.ts +138 -0
  87. package/account/i18n/messages_defaultSet/no.js +143 -0
  88. package/account/i18n/messages_defaultSet/no.js.map +1 -0
  89. package/account/i18n/messages_defaultSet/pl.d.ts +339 -0
  90. package/account/i18n/messages_defaultSet/pl.js +344 -0
  91. package/account/i18n/messages_defaultSet/pl.js.map +1 -0
  92. package/account/i18n/messages_defaultSet/pt-BR.d.ts +309 -0
  93. package/account/i18n/messages_defaultSet/pt-BR.js +314 -0
  94. package/account/i18n/messages_defaultSet/pt-BR.js.map +1 -0
  95. package/account/i18n/messages_defaultSet/ru.d.ts +206 -0
  96. package/account/i18n/messages_defaultSet/ru.js +211 -0
  97. package/account/i18n/messages_defaultSet/ru.js.map +1 -0
  98. package/account/i18n/messages_defaultSet/sk.d.ts +176 -0
  99. package/account/i18n/messages_defaultSet/sk.js +181 -0
  100. package/account/i18n/messages_defaultSet/sk.js.map +1 -0
  101. package/account/i18n/messages_defaultSet/sv.d.ts +135 -0
  102. package/account/i18n/messages_defaultSet/sv.js +140 -0
  103. package/account/i18n/messages_defaultSet/sv.js.map +1 -0
  104. package/account/i18n/messages_defaultSet/th.d.ts +339 -0
  105. package/account/i18n/messages_defaultSet/th.js +344 -0
  106. package/account/i18n/messages_defaultSet/th.js.map +1 -0
  107. package/account/i18n/messages_defaultSet/tr.d.ts +278 -0
  108. package/account/i18n/messages_defaultSet/tr.js +283 -0
  109. package/account/i18n/messages_defaultSet/tr.js.map +1 -0
  110. package/account/i18n/messages_defaultSet/uk.d.ts +339 -0
  111. package/account/i18n/messages_defaultSet/uk.js +344 -0
  112. package/account/i18n/messages_defaultSet/uk.js.map +1 -0
  113. package/account/i18n/messages_defaultSet/zh-CN.d.ts +148 -0
  114. package/account/i18n/messages_defaultSet/zh-CN.js +153 -0
  115. package/account/i18n/messages_defaultSet/zh-CN.js.map +1 -0
  116. package/account/i18n/useI18n.d.ts +14 -0
  117. package/account/i18n/useI18n.js +59 -0
  118. package/account/i18n/useI18n.js.map +1 -0
  119. package/account/index.d.ts +3 -7
  120. package/account/index.js +1 -5
  121. package/account/index.js.map +1 -1
  122. package/account/lib/kcClsx.d.ts +9 -0
  123. package/account/lib/kcClsx.js +19 -0
  124. package/account/lib/kcClsx.js.map +1 -0
  125. package/account/pages/Account.d.ts +1 -1
  126. package/account/pages/Account.js +7 -6
  127. package/account/pages/Account.js.map +1 -1
  128. package/account/pages/Applications.d.ts +1 -1
  129. package/account/pages/Applications.js +8 -9
  130. package/account/pages/Applications.js.map +1 -1
  131. package/account/pages/FederatedIdentity.d.ts +3 -3
  132. package/account/pages/FederatedIdentity.js +1 -1
  133. package/account/pages/FederatedIdentity.js.map +1 -1
  134. package/account/pages/Log.d.ts +1 -1
  135. package/account/pages/Log.js +3 -3
  136. package/account/pages/Log.js.map +1 -1
  137. package/account/pages/PageProps.d.ts +4 -6
  138. package/account/pages/Password.d.ts +1 -1
  139. package/account/pages/Password.js +16 -13
  140. package/account/pages/Password.js.map +1 -1
  141. package/account/pages/Sessions.d.ts +1 -1
  142. package/account/pages/Sessions.js +3 -4
  143. package/account/pages/Sessions.js.map +1 -1
  144. package/account/pages/Totp.d.ts +1 -1
  145. package/account/pages/Totp.js +9 -10
  146. package/account/pages/Totp.js.map +1 -1
  147. package/bin/193.index.js +160 -0
  148. package/bin/246.index.js +75118 -371
  149. package/bin/266.index.js +806 -0
  150. package/bin/304.index.js +1108 -0
  151. package/bin/31.index.js +799 -0
  152. package/bin/430.index.js +1349 -0
  153. package/bin/440.index.js +1537 -0
  154. package/bin/453.index.js +769 -0
  155. package/bin/525.index.js +41826 -0
  156. package/bin/526.index.js +1108 -0
  157. package/bin/599.index.js +560 -0
  158. package/bin/622.index.js +720 -0
  159. package/bin/678.index.js +10486 -0
  160. package/bin/697.index.js +4749 -0
  161. package/bin/720.index.js +243 -0
  162. package/bin/743.index.js +70 -0
  163. package/bin/780.index.js +895 -0
  164. package/bin/786.index.js +185 -0
  165. package/bin/877.index.js +275 -0
  166. package/bin/932.index.js +946 -0
  167. package/bin/941.index.js +4215 -0
  168. package/bin/97.index.js +677 -0
  169. package/bin/main.js +7685 -141696
  170. package/bin/shared/KeycloakVersionRange.d.ts +3 -3
  171. package/bin/shared/buildContext.d.ts +85 -0
  172. package/bin/shared/buildContext.js.map +1 -0
  173. package/bin/shared/constants.d.ts +18 -15
  174. package/bin/shared/constants.js +15 -15
  175. package/bin/shared/constants.js.map +1 -1
  176. package/bin/shared/copyKeycloakResourcesToPublic.d.ts +3 -3
  177. package/bin/shared/copyKeycloakResourcesToPublic.js.map +1 -1
  178. package/bin/shared/downloadKeycloakDefaultTheme.d.ts +11 -0
  179. package/bin/shared/downloadKeycloakDefaultTheme.js.map +1 -0
  180. package/bin/shared/downloadKeycloakStaticResources.d.ts +3 -5
  181. package/bin/shared/downloadKeycloakStaticResources.js.map +1 -1
  182. package/bin/shared/generateKcGenTs.d.ts +15 -0
  183. package/bin/shared/generateKcGenTs.js.map +1 -0
  184. package/bin/shared/getLatestsSemVersionedTag.d.ts +10 -0
  185. package/bin/shared/getLatestsSemVersionedTag.js.map +1 -0
  186. package/bin/shared/metaInfKeycloakThemes.d.ts +4 -8
  187. package/bin/shared/metaInfKeycloakThemes.js.map +1 -1
  188. package/bin/shared/promptKeycloakVersion.d.ts +1 -0
  189. package/bin/shared/promptKeycloakVersion.js.map +1 -1
  190. package/lib/BASE_URL.js.map +1 -1
  191. package/lib/getKcClsx.d.ts +11 -0
  192. package/lib/getKcClsx.js +56 -0
  193. package/lib/getKcClsx.js.map +1 -0
  194. package/login/DefaultPage.d.ts +12 -0
  195. package/login/DefaultPage.js +125 -0
  196. package/login/DefaultPage.js.map +1 -0
  197. package/login/KcContext/KcContext.d.ts +579 -0
  198. package/login/KcContext/KcContext.js.map +1 -0
  199. package/login/KcContext/getKcContextMock.d.ts +24 -0
  200. package/login/KcContext/getKcContextMock.js +28 -0
  201. package/login/KcContext/getKcContextMock.js.map +1 -0
  202. package/login/KcContext/index.d.ts +2 -0
  203. package/login/KcContext/index.js +2 -0
  204. package/login/KcContext/index.js.map +1 -0
  205. package/login/KcContext/kcContextMocks.d.ts +4 -0
  206. package/login/KcContext/kcContextMocks.js +333 -0
  207. package/login/KcContext/kcContextMocks.js.map +1 -0
  208. package/login/Template.d.ts +2 -2
  209. package/login/Template.js +31 -25
  210. package/login/Template.js.map +1 -1
  211. package/login/TemplateProps.d.ts +3 -6
  212. package/login/UserProfileFormFields.d.ts +3 -20
  213. package/login/UserProfileFormFields.js +81 -124
  214. package/login/UserProfileFormFields.js.map +1 -1
  215. package/login/UserProfileFormFieldsProps.d.ts +24 -0
  216. package/login/UserProfileFormFieldsProps.js +2 -0
  217. package/login/UserProfileFormFieldsProps.js.map +1 -0
  218. package/login/i18n/GenericI18n.d.ts +6 -0
  219. package/login/i18n/GenericI18n.js +2 -0
  220. package/login/i18n/GenericI18n.js.map +1 -0
  221. package/login/i18n/i18n.d.ts +42 -52
  222. package/login/i18n/i18n.js +88 -94
  223. package/login/i18n/i18n.js.map +1 -1
  224. package/login/i18n/index.d.ts +5 -1
  225. package/login/i18n/index.js +1 -1
  226. package/login/i18n/index.js.map +1 -1
  227. package/login/i18n/messages_defaultSet/ar.d.ts +447 -0
  228. package/login/i18n/messages_defaultSet/ar.js +452 -0
  229. package/login/i18n/messages_defaultSet/ar.js.map +1 -0
  230. package/login/i18n/messages_defaultSet/ca.d.ts +466 -0
  231. package/login/i18n/messages_defaultSet/ca.js +471 -0
  232. package/login/i18n/messages_defaultSet/ca.js.map +1 -0
  233. package/login/i18n/messages_defaultSet/cs.d.ts +444 -0
  234. package/login/i18n/messages_defaultSet/cs.js +449 -0
  235. package/login/i18n/messages_defaultSet/cs.js.map +1 -0
  236. package/login/i18n/messages_defaultSet/da.d.ts +319 -0
  237. package/login/i18n/messages_defaultSet/da.js +324 -0
  238. package/login/i18n/messages_defaultSet/da.js.map +1 -0
  239. package/login/i18n/messages_defaultSet/de.d.ts +378 -0
  240. package/login/i18n/messages_defaultSet/de.js +383 -0
  241. package/login/i18n/messages_defaultSet/de.js.map +1 -0
  242. package/login/i18n/messages_defaultSet/el.d.ts +461 -0
  243. package/login/i18n/messages_defaultSet/el.js +466 -0
  244. package/login/i18n/messages_defaultSet/el.js.map +1 -0
  245. package/login/i18n/messages_defaultSet/en.d.ts +476 -0
  246. package/login/i18n/messages_defaultSet/en.js +481 -0
  247. package/login/i18n/messages_defaultSet/en.js.map +1 -0
  248. package/login/i18n/messages_defaultSet/es.d.ts +476 -0
  249. package/login/i18n/messages_defaultSet/es.js +481 -0
  250. package/login/i18n/messages_defaultSet/es.js.map +1 -0
  251. package/login/i18n/messages_defaultSet/fa.d.ts +461 -0
  252. package/login/i18n/messages_defaultSet/fa.js +466 -0
  253. package/login/i18n/messages_defaultSet/fa.js.map +1 -0
  254. package/login/i18n/messages_defaultSet/fi.d.ts +377 -0
  255. package/login/i18n/messages_defaultSet/fi.js +382 -0
  256. package/login/i18n/messages_defaultSet/fi.js.map +1 -0
  257. package/login/i18n/messages_defaultSet/fr.d.ts +393 -0
  258. package/login/i18n/messages_defaultSet/fr.js +398 -0
  259. package/login/i18n/messages_defaultSet/fr.js.map +1 -0
  260. package/login/i18n/messages_defaultSet/hu.d.ts +466 -0
  261. package/login/i18n/messages_defaultSet/hu.js +471 -0
  262. package/login/i18n/messages_defaultSet/hu.js.map +1 -0
  263. package/login/i18n/messages_defaultSet/index.d.ts +3931 -0
  264. package/login/i18n/messages_defaultSet/index.js +39 -0
  265. package/login/i18n/messages_defaultSet/index.js.map +1 -0
  266. package/login/i18n/messages_defaultSet/it.d.ts +319 -0
  267. package/login/i18n/messages_defaultSet/it.js +324 -0
  268. package/login/i18n/messages_defaultSet/it.js.map +1 -0
  269. package/login/i18n/messages_defaultSet/ja.d.ts +323 -0
  270. package/login/i18n/messages_defaultSet/ja.js +328 -0
  271. package/login/i18n/messages_defaultSet/ja.js.map +1 -0
  272. package/login/i18n/messages_defaultSet/lt.d.ts +203 -0
  273. package/login/i18n/messages_defaultSet/lt.js +208 -0
  274. package/login/i18n/messages_defaultSet/lt.js.map +1 -0
  275. package/login/i18n/messages_defaultSet/lv.d.ts +214 -0
  276. package/login/i18n/messages_defaultSet/lv.js +219 -0
  277. package/login/i18n/messages_defaultSet/lv.js.map +1 -0
  278. package/login/i18n/messages_defaultSet/nl.d.ts +285 -0
  279. package/login/i18n/messages_defaultSet/nl.js +290 -0
  280. package/login/i18n/messages_defaultSet/nl.js.map +1 -0
  281. package/login/i18n/messages_defaultSet/no.d.ts +202 -0
  282. package/login/i18n/messages_defaultSet/no.js +207 -0
  283. package/login/i18n/messages_defaultSet/no.js.map +1 -0
  284. package/login/i18n/messages_defaultSet/pl.d.ts +292 -0
  285. package/login/i18n/messages_defaultSet/pl.js +297 -0
  286. package/login/i18n/messages_defaultSet/pl.js.map +1 -0
  287. package/login/i18n/messages_defaultSet/pt-BR.d.ts +346 -0
  288. package/login/i18n/messages_defaultSet/pt-BR.js +351 -0
  289. package/login/i18n/messages_defaultSet/pt-BR.js.map +1 -0
  290. package/login/i18n/messages_defaultSet/ru.d.ts +220 -0
  291. package/login/i18n/messages_defaultSet/ru.js +225 -0
  292. package/login/i18n/messages_defaultSet/ru.js.map +1 -0
  293. package/login/i18n/messages_defaultSet/sk.d.ts +447 -0
  294. package/login/i18n/messages_defaultSet/sk.js +452 -0
  295. package/login/i18n/messages_defaultSet/sk.js.map +1 -0
  296. package/login/i18n/messages_defaultSet/sv.d.ts +201 -0
  297. package/login/i18n/messages_defaultSet/sv.js +206 -0
  298. package/login/i18n/messages_defaultSet/sv.js.map +1 -0
  299. package/login/i18n/messages_defaultSet/th.d.ts +443 -0
  300. package/login/i18n/messages_defaultSet/th.js +448 -0
  301. package/login/i18n/messages_defaultSet/th.js.map +1 -0
  302. package/login/i18n/messages_defaultSet/tr.d.ts +270 -0
  303. package/login/i18n/messages_defaultSet/tr.js +275 -0
  304. package/login/i18n/messages_defaultSet/tr.js.map +1 -0
  305. package/login/i18n/messages_defaultSet/uk.d.ts +442 -0
  306. package/login/i18n/messages_defaultSet/uk.js +447 -0
  307. package/login/i18n/messages_defaultSet/uk.js.map +1 -0
  308. package/login/i18n/messages_defaultSet/zh-CN.d.ts +471 -0
  309. package/login/i18n/messages_defaultSet/zh-CN.js +476 -0
  310. package/login/i18n/messages_defaultSet/zh-CN.js.map +1 -0
  311. package/login/i18n/useI18n.d.ts +14 -0
  312. package/login/i18n/useI18n.js +59 -0
  313. package/login/i18n/useI18n.js.map +1 -0
  314. package/login/index.d.ts +3 -8
  315. package/login/index.js +1 -6
  316. package/login/index.js.map +1 -1
  317. package/login/lib/kcClsx.d.ts +9 -0
  318. package/login/lib/kcClsx.js +130 -0
  319. package/login/lib/kcClsx.js.map +1 -0
  320. package/login/lib/useUserProfileForm.d.ts +20 -8
  321. package/login/lib/useUserProfileForm.js +422 -295
  322. package/login/lib/useUserProfileForm.js.map +1 -1
  323. package/login/pages/Code.d.ts +1 -1
  324. package/login/pages/Code.js +3 -3
  325. package/login/pages/Code.js.map +1 -1
  326. package/login/pages/DeleteAccountConfirm.d.ts +1 -1
  327. package/login/pages/DeleteAccountConfirm.js +7 -4
  328. package/login/pages/DeleteAccountConfirm.js.map +1 -1
  329. package/login/pages/DeleteCredential.d.ts +1 -1
  330. package/login/pages/DeleteCredential.js +3 -4
  331. package/login/pages/DeleteCredential.js.map +1 -1
  332. package/login/pages/Error.d.ts +1 -1
  333. package/login/pages/Error.js +1 -1
  334. package/login/pages/Error.js.map +1 -1
  335. package/login/pages/FrontchannelLogout.d.ts +1 -1
  336. package/login/pages/FrontchannelLogout.js +1 -1
  337. package/login/pages/FrontchannelLogout.js.map +1 -1
  338. package/login/pages/IdpReviewUserProfile.d.ts +4 -3
  339. package/login/pages/IdpReviewUserProfile.js +4 -5
  340. package/login/pages/IdpReviewUserProfile.js.map +1 -1
  341. package/login/pages/Info.d.ts +1 -1
  342. package/login/pages/Info.js +19 -9
  343. package/login/pages/Info.js.map +1 -1
  344. package/login/pages/Login.d.ts +1 -1
  345. package/login/pages/Login.js +12 -8
  346. package/login/pages/Login.js.map +1 -1
  347. package/login/pages/LoginConfigTotp.d.ts +1 -1
  348. package/login/pages/LoginConfigTotp.js +10 -7
  349. package/login/pages/LoginConfigTotp.js.map +1 -1
  350. package/login/pages/LoginIdpLinkConfirm.d.ts +1 -1
  351. package/login/pages/LoginIdpLinkConfirm.js +3 -4
  352. package/login/pages/LoginIdpLinkConfirm.js.map +1 -1
  353. package/login/pages/LoginIdpLinkEmail.d.ts +2 -2
  354. package/login/pages/LoginIdpLinkEmail.js +1 -1
  355. package/login/pages/LoginIdpLinkEmail.js.map +1 -1
  356. package/login/pages/LoginOauth2DeviceVerifyUserCode.d.ts +3 -3
  357. package/login/pages/LoginOauth2DeviceVerifyUserCode.js +3 -4
  358. package/login/pages/LoginOauth2DeviceVerifyUserCode.js.map +1 -1
  359. package/login/pages/LoginOauthGrant.d.ts +3 -3
  360. package/login/pages/LoginOauthGrant.js +4 -5
  361. package/login/pages/LoginOauthGrant.js.map +1 -1
  362. package/login/pages/LoginOtp.d.ts +1 -1
  363. package/login/pages/LoginOtp.js +5 -4
  364. package/login/pages/LoginOtp.js.map +1 -1
  365. package/login/pages/LoginPageExpired.d.ts +1 -1
  366. package/login/pages/LoginPageExpired.js +1 -1
  367. package/login/pages/LoginPageExpired.js.map +1 -1
  368. package/login/pages/LoginPassword.d.ts +1 -1
  369. package/login/pages/LoginPassword.js +9 -7
  370. package/login/pages/LoginPassword.js.map +1 -1
  371. package/login/pages/LoginRecoveryAuthnCodeConfig.d.ts +1 -1
  372. package/login/pages/LoginRecoveryAuthnCodeConfig.js +16 -16
  373. package/login/pages/LoginRecoveryAuthnCodeConfig.js.map +1 -1
  374. package/login/pages/LoginRecoveryAuthnCodeInput.d.ts +1 -1
  375. package/login/pages/LoginRecoveryAuthnCodeInput.js +5 -4
  376. package/login/pages/LoginRecoveryAuthnCodeInput.js.map +1 -1
  377. package/login/pages/LoginResetOtp.d.ts +1 -1
  378. package/login/pages/LoginResetOtp.js +3 -4
  379. package/login/pages/LoginResetOtp.js.map +1 -1
  380. package/login/pages/LoginResetPassword.d.ts +1 -1
  381. package/login/pages/LoginResetPassword.js +6 -5
  382. package/login/pages/LoginResetPassword.js.map +1 -1
  383. package/login/pages/LoginUpdatePassword.d.ts +1 -1
  384. package/login/pages/LoginUpdatePassword.js +12 -9
  385. package/login/pages/LoginUpdatePassword.js.map +1 -1
  386. package/login/pages/LoginUpdateProfile.d.ts +4 -3
  387. package/login/pages/LoginUpdateProfile.js +5 -9
  388. package/login/pages/LoginUpdateProfile.js.map +1 -1
  389. package/login/pages/LoginUsername.d.ts +1 -1
  390. package/login/pages/LoginUsername.js +5 -5
  391. package/login/pages/LoginUsername.js.map +1 -1
  392. package/login/pages/LoginVerifyEmail.d.ts +1 -1
  393. package/login/pages/LoginVerifyEmail.js +1 -1
  394. package/login/pages/LoginVerifyEmail.js.map +1 -1
  395. package/login/pages/LoginX509Info.d.ts +1 -1
  396. package/login/pages/LoginX509Info.js +3 -4
  397. package/login/pages/LoginX509Info.js.map +1 -1
  398. package/login/pages/LogoutConfirm.d.ts +1 -1
  399. package/login/pages/LogoutConfirm.js +3 -4
  400. package/login/pages/LogoutConfirm.js.map +1 -1
  401. package/login/pages/PageProps.d.ts +3 -5
  402. package/login/pages/Register.d.ts +4 -3
  403. package/login/pages/Register.js +9 -19
  404. package/login/pages/Register.js.map +1 -1
  405. package/login/pages/SamlPostForm.d.ts +1 -1
  406. package/login/pages/SamlPostForm.js +2 -2
  407. package/login/pages/SamlPostForm.js.map +1 -1
  408. package/login/pages/SelectAuthenticator.d.ts +2 -2
  409. package/login/pages/SelectAuthenticator.js +4 -8
  410. package/login/pages/SelectAuthenticator.js.map +1 -1
  411. package/login/pages/Terms.d.ts +2 -2
  412. package/login/pages/Terms.js +3 -10
  413. package/login/pages/Terms.js.map +1 -1
  414. package/login/pages/UpdateEmail.d.ts +3 -2
  415. package/login/pages/UpdateEmail.js +6 -10
  416. package/login/pages/UpdateEmail.js.map +1 -1
  417. package/login/pages/WebauthnAuthenticate.d.ts +1 -1
  418. package/login/pages/WebauthnAuthenticate.js +25 -22
  419. package/login/pages/WebauthnAuthenticate.js.map +1 -1
  420. package/login/pages/WebauthnError.d.ts +1 -1
  421. package/login/pages/WebauthnError.js +4 -5
  422. package/login/pages/WebauthnError.js.map +1 -1
  423. package/login/pages/WebauthnRegister.d.ts +1 -1
  424. package/login/pages/WebauthnRegister.js +16 -17
  425. package/login/pages/WebauthnRegister.js.map +1 -1
  426. package/package.json +820 -9746
  427. package/src/PUBLIC_URL.ts +4 -4
  428. package/src/account/DefaultPage.tsx +41 -0
  429. package/src/account/KcContext/KcContext.ts +310 -0
  430. package/src/account/KcContext/getKcContextMock.ts +69 -0
  431. package/src/account/KcContext/index.ts +2 -0
  432. package/src/account/KcContext/kcContextMocks.ts +193 -0
  433. package/src/account/Template.tsx +20 -17
  434. package/src/account/TemplateProps.ts +4 -5
  435. package/src/account/i18n/GenericI18n.tsx +6 -0
  436. package/src/account/i18n/i18n.tsx +164 -144
  437. package/src/account/i18n/index.ts +5 -1
  438. package/src/account/i18n/messages_defaultSet/ar.ts +367 -0
  439. package/src/account/i18n/messages_defaultSet/ca.ts +367 -0
  440. package/src/account/i18n/messages_defaultSet/cs.ts +159 -0
  441. package/src/account/i18n/messages_defaultSet/da.ts +296 -0
  442. package/src/account/i18n/messages_defaultSet/de.ts +319 -0
  443. package/src/account/i18n/messages_defaultSet/el.ts +366 -0
  444. package/src/account/i18n/messages_defaultSet/en.ts +370 -0
  445. package/src/account/i18n/messages_defaultSet/es.ts +369 -0
  446. package/src/account/i18n/messages_defaultSet/fa.ts +367 -0
  447. package/src/account/i18n/messages_defaultSet/fi.ts +363 -0
  448. package/src/account/i18n/messages_defaultSet/fr.ts +170 -0
  449. package/src/account/i18n/messages_defaultSet/hu.ts +367 -0
  450. package/src/account/i18n/messages_defaultSet/index.ts +39 -0
  451. package/src/account/i18n/messages_defaultSet/it.ts +307 -0
  452. package/src/account/i18n/messages_defaultSet/ja.ts +301 -0
  453. package/src/account/i18n/messages_defaultSet/lt.ts +144 -0
  454. package/src/account/i18n/messages_defaultSet/lv.ts +188 -0
  455. package/src/account/i18n/messages_defaultSet/nl.ts +336 -0
  456. package/src/account/i18n/messages_defaultSet/no.ts +144 -0
  457. package/src/account/i18n/messages_defaultSet/pl.ts +345 -0
  458. package/src/account/i18n/messages_defaultSet/pt-BR.ts +315 -0
  459. package/src/account/i18n/messages_defaultSet/ru.ts +212 -0
  460. package/src/account/i18n/messages_defaultSet/sk.ts +182 -0
  461. package/src/account/i18n/messages_defaultSet/sv.ts +141 -0
  462. package/src/account/i18n/messages_defaultSet/th.ts +345 -0
  463. package/src/account/i18n/messages_defaultSet/tr.ts +284 -0
  464. package/src/account/i18n/messages_defaultSet/uk.ts +345 -0
  465. package/src/account/i18n/messages_defaultSet/zh-CN.ts +154 -0
  466. package/src/account/i18n/useI18n.tsx +95 -0
  467. package/src/account/index.ts +3 -10
  468. package/src/account/lib/kcClsx.ts +25 -0
  469. package/src/account/pages/Account.tsx +12 -18
  470. package/src/account/pages/Applications.tsx +8 -10
  471. package/src/account/pages/FederatedIdentity.tsx +4 -4
  472. package/src/account/pages/Log.tsx +5 -5
  473. package/src/account/pages/PageProps.ts +4 -6
  474. package/src/account/pages/Password.tsx +17 -19
  475. package/src/account/pages/Sessions.tsx +5 -6
  476. package/src/account/pages/Totp.tsx +32 -42
  477. package/src/bin/add-story.ts +105 -0
  478. package/src/bin/copy-keycloak-resources-to-public.ts +3 -6
  479. package/src/bin/eject-page.ts +256 -0
  480. package/src/bin/initialize-account-theme/copyBoilerplate.ts +32 -0
  481. package/src/bin/initialize-account-theme/index.ts +1 -0
  482. package/src/bin/initialize-account-theme/initialize-account-theme.ts +112 -0
  483. package/src/bin/initialize-account-theme/initializeAccountTheme_multiPage.ts +21 -0
  484. package/src/bin/initialize-account-theme/initializeAccountTheme_singlePage.ts +150 -0
  485. package/src/bin/initialize-account-theme/src/multi-page/KcContext.ts +12 -0
  486. package/src/bin/initialize-account-theme/src/multi-page/KcPage.tsx +25 -0
  487. package/src/bin/initialize-account-theme/src/multi-page/KcPageStory.tsx +38 -0
  488. package/src/bin/initialize-account-theme/src/multi-page/i18n.ts +5 -0
  489. package/src/bin/initialize-account-theme/src/single-page/KcContext.ts +7 -0
  490. package/src/bin/initialize-account-theme/src/single-page/KcPage.tsx +11 -0
  491. package/src/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts +92 -0
  492. package/src/bin/initialize-email-theme.ts +30 -26
  493. package/src/bin/keycloakify/buildJars/buildJar.ts +155 -80
  494. package/src/bin/keycloakify/buildJars/buildJars.ts +39 -32
  495. package/src/bin/keycloakify/buildJars/extensionVersions.ts +3 -2
  496. package/src/bin/keycloakify/buildJars/generatePom.ts +19 -11
  497. package/src/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.ts +44 -12
  498. package/src/bin/keycloakify/generateFtl/generateFtl.ts +76 -51
  499. package/src/bin/keycloakify/generateFtl/kcContextDeclarationTemplate.ftl +655 -0
  500. package/src/bin/keycloakify/generateResources/bringInAccountV1.ts +89 -0
  501. package/src/bin/keycloakify/generateResources/generateMessageProperties.ts +192 -0
  502. package/src/bin/keycloakify/generateResources/generateResources.ts +42 -0
  503. package/src/bin/keycloakify/generateResources/generateResourcesForMainTheme.ts +366 -0
  504. package/src/bin/keycloakify/generateResources/generateResourcesForThemeVariant.ts +70 -0
  505. package/src/bin/keycloakify/generateResources/index.ts +1 -0
  506. package/src/bin/keycloakify/generateResources/readExtraPageNames.ts +49 -0
  507. package/src/bin/keycloakify/generateResources/readFieldNameUsage.ts +91 -0
  508. package/src/bin/keycloakify/keycloakify.ts +53 -17
  509. package/src/bin/keycloakify/replacers/replaceImportsInCssCode.ts +52 -42
  510. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.ts +14 -11
  511. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/vite.ts +34 -19
  512. package/src/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.ts +53 -18
  513. package/src/bin/main.ts +113 -44
  514. package/src/bin/shared/KeycloakVersionRange.ts +5 -3
  515. package/src/bin/shared/buildContext.ts +896 -0
  516. package/src/bin/shared/constants.ts +23 -15
  517. package/src/bin/shared/copyKeycloakResourcesToPublic.ts +34 -23
  518. package/src/bin/shared/downloadKeycloakDefaultTheme.ts +297 -0
  519. package/src/bin/shared/downloadKeycloakStaticResources.ts +31 -27
  520. package/src/bin/shared/generateKcGenTs.ts +175 -0
  521. package/src/bin/shared/getLatestsSemVersionedTag.ts +180 -0
  522. package/src/bin/shared/metaInfKeycloakThemes.ts +25 -19
  523. package/src/bin/shared/promptKeycloakVersion.ts +32 -77
  524. package/src/bin/start-keycloak/appBuild.ts +184 -0
  525. package/src/bin/start-keycloak/index.ts +1 -0
  526. package/src/bin/start-keycloak/keycloakifyBuild.ts +43 -0
  527. package/src/bin/start-keycloak/myrealm-realm-18.json +2155 -0
  528. package/src/bin/start-keycloak/myrealm-realm-19.json +2186 -0
  529. package/src/bin/start-keycloak/myrealm-realm-20.json +2197 -0
  530. package/src/bin/start-keycloak/myrealm-realm-21.json +2201 -0
  531. package/src/bin/start-keycloak/myrealm-realm-23.json +2155 -0
  532. package/src/bin/start-keycloak/myrealm-realm-24.json +2318 -0
  533. package/src/bin/start-keycloak/myrealm-realm-25.json +2400 -0
  534. package/src/bin/start-keycloak/start-keycloak.ts +451 -0
  535. package/src/bin/tools/SemVer.ts +32 -13
  536. package/src/bin/tools/String.prototype.replaceAll.ts +9 -2
  537. package/src/bin/tools/assertNoPnpmDlx.ts +15 -0
  538. package/src/bin/tools/crawl.ts +4 -1
  539. package/src/bin/tools/crc32.ts +42 -24
  540. package/src/bin/tools/downloadAndExtractArchive.ts +256 -0
  541. package/src/bin/tools/escapeStringForPropertiesFile.ts +64 -0
  542. package/src/bin/tools/extractArchive.ts +140 -0
  543. package/src/bin/tools/fetchProxyOptions.ts +76 -53
  544. package/src/bin/tools/getAbsoluteAndInOsFormatPath.ts +10 -2
  545. package/src/bin/tools/npmInstall.ts +63 -0
  546. package/src/bin/tools/octokit-addons/getLatestsSemVersionedTag.ts +11 -4
  547. package/src/bin/tools/octokit-addons/listTags.ts +15 -4
  548. package/src/bin/tools/partitionPromiseSettledResults.ts +12 -3
  549. package/src/bin/tools/readThisNpmPackageVersion.ts +5 -1
  550. package/src/bin/tools/transformCodebase.ts +29 -10
  551. package/src/bin/tools/trimIndent.ts +4 -1
  552. package/src/bin/tsconfig.json +7 -4
  553. package/src/bin/update-kc-gen.ts +13 -0
  554. package/src/lib/getKcClsx.ts +89 -0
  555. package/src/login/DefaultPage.tsx +129 -0
  556. package/src/login/KcContext/KcContext.ts +756 -0
  557. package/src/login/KcContext/getKcContextMock.ts +69 -0
  558. package/src/login/KcContext/index.ts +8 -0
  559. package/src/login/KcContext/kcContextMocks.ts +582 -0
  560. package/src/login/Template.tsx +69 -92
  561. package/src/login/TemplateProps.ts +3 -7
  562. package/src/login/UserProfileFormFields.tsx +139 -220
  563. package/src/login/UserProfileFormFieldsProps.tsx +22 -0
  564. package/src/login/i18n/GenericI18n.tsx +6 -0
  565. package/src/login/i18n/i18n.tsx +161 -147
  566. package/src/login/i18n/index.ts +5 -1
  567. package/src/login/i18n/messages_defaultSet/ar.ts +453 -0
  568. package/src/login/i18n/messages_defaultSet/ca.ts +472 -0
  569. package/src/login/i18n/messages_defaultSet/cs.ts +450 -0
  570. package/src/login/i18n/messages_defaultSet/da.ts +325 -0
  571. package/src/login/i18n/messages_defaultSet/de.ts +384 -0
  572. package/src/login/i18n/messages_defaultSet/el.ts +467 -0
  573. package/src/login/i18n/messages_defaultSet/en.ts +482 -0
  574. package/src/login/i18n/messages_defaultSet/es.ts +482 -0
  575. package/src/login/i18n/messages_defaultSet/fa.ts +467 -0
  576. package/src/login/i18n/messages_defaultSet/fi.ts +383 -0
  577. package/src/login/i18n/messages_defaultSet/fr.ts +399 -0
  578. package/src/login/i18n/messages_defaultSet/hu.ts +472 -0
  579. package/src/login/i18n/messages_defaultSet/index.ts +39 -0
  580. package/src/login/i18n/messages_defaultSet/it.ts +325 -0
  581. package/src/login/i18n/messages_defaultSet/ja.ts +329 -0
  582. package/src/login/i18n/messages_defaultSet/lt.ts +209 -0
  583. package/src/login/i18n/messages_defaultSet/lv.ts +220 -0
  584. package/src/login/i18n/messages_defaultSet/nl.ts +291 -0
  585. package/src/login/i18n/messages_defaultSet/no.ts +208 -0
  586. package/src/login/i18n/messages_defaultSet/pl.ts +298 -0
  587. package/src/login/i18n/messages_defaultSet/pt-BR.ts +352 -0
  588. package/src/login/i18n/messages_defaultSet/ru.ts +226 -0
  589. package/src/login/i18n/messages_defaultSet/sk.ts +453 -0
  590. package/src/login/i18n/messages_defaultSet/sv.ts +207 -0
  591. package/src/login/i18n/messages_defaultSet/th.ts +449 -0
  592. package/src/login/i18n/messages_defaultSet/tr.ts +276 -0
  593. package/src/login/i18n/messages_defaultSet/uk.ts +448 -0
  594. package/src/login/i18n/messages_defaultSet/zh-CN.ts +477 -0
  595. package/src/login/i18n/useI18n.tsx +95 -0
  596. package/src/login/index.ts +3 -11
  597. package/src/login/lib/kcClsx.ts +143 -0
  598. package/src/login/lib/useUserProfileForm.tsx +513 -354
  599. package/src/login/pages/Code.tsx +8 -5
  600. package/src/login/pages/DeleteAccountConfirm.tsx +15 -10
  601. package/src/login/pages/DeleteCredential.tsx +9 -7
  602. package/src/login/pages/Error.tsx +10 -3
  603. package/src/login/pages/FrontchannelLogout.tsx +6 -3
  604. package/src/login/pages/IdpReviewUserProfile.tsx +20 -21
  605. package/src/login/pages/Info.tsx +31 -14
  606. package/src/login/pages/Login.tsx +51 -59
  607. package/src/login/pages/LoginConfigTotp.tsx +49 -43
  608. package/src/login/pages/LoginIdpLinkConfirm.tsx +7 -18
  609. package/src/login/pages/LoginIdpLinkEmail.tsx +9 -3
  610. package/src/login/pages/LoginOauth2DeviceVerifyUserCode.tsx +24 -23
  611. package/src/login/pages/LoginOauthGrant.tsx +14 -20
  612. package/src/login/pages/LoginOtp.tsx +34 -32
  613. package/src/login/pages/LoginPageExpired.tsx +2 -2
  614. package/src/login/pages/LoginPassword.tsx +29 -34
  615. package/src/login/pages/LoginRecoveryAuthnCodeConfig.tsx +34 -34
  616. package/src/login/pages/LoginRecoveryAuthnCodeInput.tsx +26 -24
  617. package/src/login/pages/LoginResetOtp.tsx +19 -22
  618. package/src/login/pages/LoginResetPassword.tsx +28 -26
  619. package/src/login/pages/LoginUpdatePassword.tsx +82 -84
  620. package/src/login/pages/LoginUpdateProfile.tsx +32 -30
  621. package/src/login/pages/LoginUsername.tsx +23 -34
  622. package/src/login/pages/LoginVerifyEmail.tsx +5 -2
  623. package/src/login/pages/LoginX509Info.tsx +24 -33
  624. package/src/login/pages/LogoutConfirm.tsx +8 -14
  625. package/src/login/pages/PageProps.ts +3 -5
  626. package/src/login/pages/Register.tsx +54 -54
  627. package/src/login/pages/SamlPostForm.tsx +3 -3
  628. package/src/login/pages/SelectAuthenticator.tsx +24 -25
  629. package/src/login/pages/Terms.tsx +14 -24
  630. package/src/login/pages/UpdateEmail.tsx +30 -33
  631. package/src/login/pages/WebauthnAuthenticate.tsx +43 -47
  632. package/src/login/pages/WebauthnError.tsx +15 -19
  633. package/src/login/pages/WebauthnRegister.tsx +28 -37
  634. package/src/tools/Array.prototype.every.ts +4 -1
  635. package/src/tools/LazyOrNot.ts +3 -1
  636. package/src/tools/Object.fromEntries.ts +23 -0
  637. package/src/tools/StatefulObservable/README.md +16 -0
  638. package/src/tools/StatefulObservable/StatefulObservable.ts +58 -0
  639. package/src/tools/StatefulObservable/hooks/index.ts +2 -0
  640. package/src/tools/StatefulObservable/hooks/useObservable.ts +25 -0
  641. package/src/tools/StatefulObservable/hooks/useRerenderOnChange.ts +19 -0
  642. package/src/tools/StatefulObservable/index.ts +2 -0
  643. package/src/tools/ValueOf.ts +2 -0
  644. package/src/tools/clsx.ts +6 -42
  645. package/src/tools/clsx_withTransform.ts +55 -0
  646. package/src/tools/deepAssign.ts +57 -19
  647. package/src/tools/formatNumber.ts +7 -3
  648. package/src/tools/structuredCloneButFunctions.ts +24 -0
  649. package/src/tools/useConstCallback.ts +3 -1
  650. package/src/tools/useInsertLinkTags.ts +78 -74
  651. package/src/tools/useInsertScriptTags.ts +69 -73
  652. package/src/tools/useOnFirstMount.ts +18 -0
  653. package/src/tools/useSetClassName.ts +4 -1
  654. package/src/vite-plugin/vite-plugin.ts +78 -40
  655. package/stories/account/pages/Account.stories.tsx +18 -0
  656. package/stories/account/pages/Applications.stories.tsx +80 -0
  657. package/stories/account/pages/FederatedIdentity.stories.tsx +38 -0
  658. package/stories/account/pages/Log.stories.tsx +356 -0
  659. package/stories/account/pages/Password.stories.tsx +28 -0
  660. package/stories/account/pages/Sessions.stories.tsx +59 -0
  661. package/stories/account/pages/Totp.stories.tsx +182 -0
  662. package/stories/login/pages/Code.stories.tsx +18 -0
  663. package/stories/login/pages/DeleteAccountConfirm.stories.tsx +18 -0
  664. package/stories/login/pages/DeleteCredential.stories.tsx +18 -0
  665. package/stories/login/pages/Error.stories.tsx +28 -0
  666. package/stories/login/pages/FrontchannelLogout.stories.tsx +18 -0
  667. package/stories/login/pages/IdpReviewUserProfile.stories.tsx +18 -0
  668. package/stories/login/pages/Info.stories.tsx +57 -0
  669. package/stories/login/pages/Login.stories.tsx +221 -0
  670. package/stories/login/pages/LoginConfigTotp.stories.tsx +43 -0
  671. package/stories/login/pages/LoginDeviceVerifyUserCode.stories.tsx +18 -0
  672. package/stories/login/pages/LoginIdpLinkConfirm.stories.tsx +18 -0
  673. package/stories/login/pages/LoginIdpLinkEmail.stories.tsx +18 -0
  674. package/stories/login/pages/LoginOauth2DeviceVerifyUserCode.stories.tsx +18 -0
  675. package/stories/login/pages/LoginOauthGrant.stories.tsx +18 -0
  676. package/stories/login/pages/LoginOtp.stories.tsx +18 -0
  677. package/stories/login/pages/LoginPageExpired.stories.tsx +18 -0
  678. package/stories/login/pages/LoginPassword.stories.tsx +18 -0
  679. package/stories/login/pages/LoginRecoveryAuthnCodeConfig.stories.tsx +18 -0
  680. package/stories/login/pages/LoginRecoveryAuthnCodeInput.stories.tsx +18 -0
  681. package/stories/login/pages/LoginResetOtp.stories.tsx +18 -0
  682. package/stories/login/pages/LoginResetPassword.stories.tsx +31 -0
  683. package/stories/login/pages/LoginUpdatePassword.stories.tsx +18 -0
  684. package/stories/login/pages/LoginUpdateProfile.stories.tsx +18 -0
  685. package/stories/login/pages/LoginUsername.stories.tsx +31 -0
  686. package/stories/login/pages/LoginVerifyEmail.stories.tsx +30 -0
  687. package/stories/login/pages/LoginX509Info.stories.tsx +18 -0
  688. package/stories/login/pages/LogoutConfirm.stories.tsx +18 -0
  689. package/stories/login/pages/Register.stories.tsx +187 -0
  690. package/stories/login/pages/SamlPostForm.stories.tsx +18 -0
  691. package/stories/login/pages/SelectAuthenticator.stories.tsx +84 -0
  692. package/stories/login/pages/Terms.stories.tsx +47 -0
  693. package/stories/login/pages/UpdateEmail.stories.tsx +18 -0
  694. package/stories/login/pages/WebauthnAuthenticate.stories.tsx +18 -0
  695. package/stories/login/pages/WebauthnError.stories.tsx +18 -0
  696. package/stories/login/pages/WebauthnRegister.stories.tsx +18 -0
  697. package/tools/Array.prototype.every.js +2 -1
  698. package/tools/Array.prototype.every.js.map +1 -1
  699. package/tools/HTMLElement.prototype.prepend.js.map +1 -1
  700. package/tools/Object.fromEntries.d.ts +1 -0
  701. package/tools/Object.fromEntries.js +17 -0
  702. package/tools/Object.fromEntries.js.map +1 -0
  703. package/tools/StatefulObservable/StatefulObservable.d.ts +8 -0
  704. package/tools/StatefulObservable/StatefulObservable.js +36 -0
  705. package/tools/StatefulObservable/StatefulObservable.js.map +1 -0
  706. package/tools/StatefulObservable/hooks/index.d.ts +2 -0
  707. package/tools/StatefulObservable/hooks/index.js +3 -0
  708. package/tools/StatefulObservable/hooks/index.js.map +1 -0
  709. package/tools/StatefulObservable/hooks/useObservable.d.ts +8 -0
  710. package/tools/StatefulObservable/hooks/useObservable.js +17 -0
  711. package/tools/StatefulObservable/hooks/useObservable.js.map +1 -0
  712. package/tools/StatefulObservable/hooks/useRerenderOnChange.d.ts +5 -0
  713. package/tools/StatefulObservable/hooks/useRerenderOnChange.js +14 -0
  714. package/tools/StatefulObservable/hooks/useRerenderOnChange.js.map +1 -0
  715. package/tools/StatefulObservable/index.d.ts +2 -0
  716. package/tools/StatefulObservable/index.js +3 -0
  717. package/tools/StatefulObservable/index.js.map +1 -0
  718. package/tools/ValueOf.d.ts +2 -0
  719. package/tools/ValueOf.js +2 -0
  720. package/tools/ValueOf.js.map +1 -0
  721. package/tools/clsx.d.ts +3 -2
  722. package/tools/clsx.js +5 -41
  723. package/tools/clsx.js.map +1 -1
  724. package/tools/clsx_withTransform.d.ts +5 -0
  725. package/tools/clsx_withTransform.js +43 -0
  726. package/tools/clsx_withTransform.js.map +1 -0
  727. package/tools/deepAssign.d.ts +1 -0
  728. package/tools/deepAssign.js +41 -16
  729. package/tools/deepAssign.js.map +1 -1
  730. package/tools/formatNumber.js +2 -1
  731. package/tools/formatNumber.js.map +1 -1
  732. package/tools/structuredCloneButFunctions.d.ts +7 -0
  733. package/tools/structuredCloneButFunctions.js +19 -0
  734. package/tools/structuredCloneButFunctions.js.map +1 -0
  735. package/tools/useConstCallback.js.map +1 -1
  736. package/tools/useInsertLinkTags.d.ts +11 -6
  737. package/tools/useInsertLinkTags.js +53 -52
  738. package/tools/useInsertLinkTags.js.map +1 -1
  739. package/tools/useInsertScriptTags.d.ts +15 -6
  740. package/tools/useInsertScriptTags.js +56 -61
  741. package/tools/useInsertScriptTags.js.map +1 -1
  742. package/tools/useOnFirstMount.d.ts +2 -0
  743. package/tools/useOnFirstMount.js +15 -0
  744. package/tools/useOnFirstMount.js.map +1 -0
  745. package/tools/useSetClassName.js.map +1 -1
  746. package/vite-plugin/index.js +41469 -38891
  747. package/vite-plugin/vite-plugin.d.ts +7 -5
  748. package/account/Fallback.d.ts +0 -5
  749. package/account/Fallback.js +0 -44
  750. package/account/Fallback.js.map +0 -1
  751. package/account/i18n/baseMessages/ar.d.ts +0 -359
  752. package/account/i18n/baseMessages/ar.js +0 -364
  753. package/account/i18n/baseMessages/ar.js.map +0 -1
  754. package/account/i18n/baseMessages/ca.d.ts +0 -359
  755. package/account/i18n/baseMessages/ca.js +0 -364
  756. package/account/i18n/baseMessages/ca.js.map +0 -1
  757. package/account/i18n/baseMessages/cs.d.ts +0 -151
  758. package/account/i18n/baseMessages/cs.js +0 -156
  759. package/account/i18n/baseMessages/cs.js.map +0 -1
  760. package/account/i18n/baseMessages/da.d.ts +0 -288
  761. package/account/i18n/baseMessages/da.js +0 -293
  762. package/account/i18n/baseMessages/da.js.map +0 -1
  763. package/account/i18n/baseMessages/de.d.ts +0 -311
  764. package/account/i18n/baseMessages/de.js +0 -316
  765. package/account/i18n/baseMessages/de.js.map +0 -1
  766. package/account/i18n/baseMessages/el.d.ts +0 -358
  767. package/account/i18n/baseMessages/el.js +0 -363
  768. package/account/i18n/baseMessages/el.js.map +0 -1
  769. package/account/i18n/baseMessages/en.d.ts +0 -362
  770. package/account/i18n/baseMessages/en.js +0 -367
  771. package/account/i18n/baseMessages/en.js.map +0 -1
  772. package/account/i18n/baseMessages/es.d.ts +0 -361
  773. package/account/i18n/baseMessages/es.js +0 -366
  774. package/account/i18n/baseMessages/es.js.map +0 -1
  775. package/account/i18n/baseMessages/fa.d.ts +0 -359
  776. package/account/i18n/baseMessages/fa.js +0 -364
  777. package/account/i18n/baseMessages/fa.js.map +0 -1
  778. package/account/i18n/baseMessages/fi.d.ts +0 -355
  779. package/account/i18n/baseMessages/fi.js +0 -360
  780. package/account/i18n/baseMessages/fi.js.map +0 -1
  781. package/account/i18n/baseMessages/fr.d.ts +0 -162
  782. package/account/i18n/baseMessages/fr.js +0 -167
  783. package/account/i18n/baseMessages/fr.js.map +0 -1
  784. package/account/i18n/baseMessages/hu.d.ts +0 -359
  785. package/account/i18n/baseMessages/hu.js +0 -364
  786. package/account/i18n/baseMessages/hu.js.map +0 -1
  787. package/account/i18n/baseMessages/index.d.ts +0 -2078
  788. package/account/i18n/baseMessages/index.js +0 -39
  789. package/account/i18n/baseMessages/index.js.map +0 -1
  790. package/account/i18n/baseMessages/it.d.ts +0 -299
  791. package/account/i18n/baseMessages/it.js +0 -304
  792. package/account/i18n/baseMessages/it.js.map +0 -1
  793. package/account/i18n/baseMessages/ja.d.ts +0 -293
  794. package/account/i18n/baseMessages/ja.js +0 -298
  795. package/account/i18n/baseMessages/ja.js.map +0 -1
  796. package/account/i18n/baseMessages/lt.d.ts +0 -136
  797. package/account/i18n/baseMessages/lt.js +0 -141
  798. package/account/i18n/baseMessages/lt.js.map +0 -1
  799. package/account/i18n/baseMessages/lv.d.ts +0 -180
  800. package/account/i18n/baseMessages/lv.js +0 -185
  801. package/account/i18n/baseMessages/lv.js.map +0 -1
  802. package/account/i18n/baseMessages/nl.d.ts +0 -328
  803. package/account/i18n/baseMessages/nl.js +0 -333
  804. package/account/i18n/baseMessages/nl.js.map +0 -1
  805. package/account/i18n/baseMessages/no.d.ts +0 -136
  806. package/account/i18n/baseMessages/no.js +0 -141
  807. package/account/i18n/baseMessages/no.js.map +0 -1
  808. package/account/i18n/baseMessages/pl.d.ts +0 -337
  809. package/account/i18n/baseMessages/pl.js +0 -342
  810. package/account/i18n/baseMessages/pl.js.map +0 -1
  811. package/account/i18n/baseMessages/pt-BR.d.ts +0 -307
  812. package/account/i18n/baseMessages/pt-BR.js +0 -312
  813. package/account/i18n/baseMessages/pt-BR.js.map +0 -1
  814. package/account/i18n/baseMessages/ru.d.ts +0 -204
  815. package/account/i18n/baseMessages/ru.js +0 -209
  816. package/account/i18n/baseMessages/ru.js.map +0 -1
  817. package/account/i18n/baseMessages/sk.d.ts +0 -174
  818. package/account/i18n/baseMessages/sk.js +0 -179
  819. package/account/i18n/baseMessages/sk.js.map +0 -1
  820. package/account/i18n/baseMessages/sv.d.ts +0 -133
  821. package/account/i18n/baseMessages/sv.js +0 -138
  822. package/account/i18n/baseMessages/sv.js.map +0 -1
  823. package/account/i18n/baseMessages/th.d.ts +0 -337
  824. package/account/i18n/baseMessages/th.js +0 -342
  825. package/account/i18n/baseMessages/th.js.map +0 -1
  826. package/account/i18n/baseMessages/tr.d.ts +0 -276
  827. package/account/i18n/baseMessages/tr.js +0 -281
  828. package/account/i18n/baseMessages/tr.js.map +0 -1
  829. package/account/i18n/baseMessages/uk.d.ts +0 -337
  830. package/account/i18n/baseMessages/uk.js +0 -342
  831. package/account/i18n/baseMessages/uk.js.map +0 -1
  832. package/account/i18n/baseMessages/zh-CN.d.ts +0 -146
  833. package/account/i18n/baseMessages/zh-CN.js +0 -151
  834. package/account/i18n/baseMessages/zh-CN.js.map +0 -1
  835. package/account/kcContext/KcContext.d.ts +0 -252
  836. package/account/kcContext/KcContext.js.map +0 -1
  837. package/account/kcContext/createGetKcContext.d.ts +0 -19
  838. package/account/kcContext/createGetKcContext.js +0 -73
  839. package/account/kcContext/createGetKcContext.js.map +0 -1
  840. package/account/kcContext/getKcContext.d.ts +0 -13
  841. package/account/kcContext/getKcContext.js +0 -13
  842. package/account/kcContext/getKcContext.js.map +0 -1
  843. package/account/kcContext/getKcContextFromWindow.d.ts +0 -8
  844. package/account/kcContext/getKcContextFromWindow.js +0 -5
  845. package/account/kcContext/getKcContextFromWindow.js.map +0 -1
  846. package/account/kcContext/index.d.ts +0 -1
  847. package/account/kcContext/index.js +0 -2
  848. package/account/kcContext/index.js.map +0 -1
  849. package/account/kcContext/kcContextMocks.d.ts +0 -4
  850. package/account/kcContext/kcContextMocks.js +0 -215
  851. package/account/kcContext/kcContextMocks.js.map +0 -1
  852. package/account/lib/useGetClassName.d.ts +0 -7
  853. package/account/lib/useGetClassName.js +0 -19
  854. package/account/lib/useGetClassName.js.map +0 -1
  855. package/bin/420.index.js +0 -508
  856. package/bin/509.index.js +0 -438
  857. package/bin/772.index.js +0 -1524
  858. package/bin/copy-keycloak-resources-to-public.d.ts +0 -4
  859. package/bin/copy-keycloak-resources-to-public.js +0 -72
  860. package/bin/copy-keycloak-resources-to-public.js.map +0 -1
  861. package/bin/download-builtin-keycloak-theme.d.ts +0 -4
  862. package/bin/download-builtin-keycloak-theme.js +0 -76
  863. package/bin/download-builtin-keycloak-theme.js.map +0 -1
  864. package/bin/eject-keycloak-page.d.ts +0 -5
  865. package/bin/eject-keycloak-page.js +0 -201
  866. package/bin/eject-keycloak-page.js.map +0 -1
  867. package/bin/initialize-email-theme.d.ts +0 -4
  868. package/bin/initialize-email-theme.js +0 -121
  869. package/bin/initialize-email-theme.js.map +0 -1
  870. package/bin/keycloakify/buildJars/buildJar.d.ts +0 -15
  871. package/bin/keycloakify/buildJars/buildJar.js +0 -213
  872. package/bin/keycloakify/buildJars/buildJar.js.map +0 -1
  873. package/bin/keycloakify/buildJars/buildJars.d.ts +0 -7
  874. package/bin/keycloakify/buildJars/buildJars.js +0 -104
  875. package/bin/keycloakify/buildJars/buildJars.js.map +0 -1
  876. package/bin/keycloakify/buildJars/extensionVersions.d.ts +0 -12
  877. package/bin/keycloakify/buildJars/extensionVersions.js +0 -7
  878. package/bin/keycloakify/buildJars/extensionVersions.js.map +0 -1
  879. package/bin/keycloakify/buildJars/generatePom.d.ts +0 -13
  880. package/bin/keycloakify/buildJars/generatePom.js +0 -95
  881. package/bin/keycloakify/buildJars/generatePom.js.map +0 -1
  882. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.d.ts +0 -7
  883. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js +0 -57
  884. package/bin/keycloakify/buildJars/getKeycloakVersionRangeForJar.js.map +0 -1
  885. package/bin/keycloakify/buildJars/index.d.ts +0 -1
  886. package/bin/keycloakify/buildJars/index.js +0 -18
  887. package/bin/keycloakify/buildJars/index.js.map +0 -1
  888. package/bin/keycloakify/generateFtl/generateFtl.d.ts +0 -23
  889. package/bin/keycloakify/generateFtl/generateFtl.js +0 -170
  890. package/bin/keycloakify/generateFtl/generateFtl.js.map +0 -1
  891. package/bin/keycloakify/generateFtl/index.d.ts +0 -1
  892. package/bin/keycloakify/generateFtl/index.js +0 -18
  893. package/bin/keycloakify/generateFtl/index.js.map +0 -1
  894. package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.d.ts +0 -9
  895. package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.js +0 -153
  896. package/bin/keycloakify/generateSrcMainResources/bringInAccountV1.js.map +0 -1
  897. package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.d.ts +0 -8
  898. package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.js +0 -271
  899. package/bin/keycloakify/generateSrcMainResources/generateMessageProperties.js.map +0 -1
  900. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.d.ts +0 -7
  901. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.js +0 -109
  902. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.js.map +0 -1
  903. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.d.ts +0 -17
  904. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.js +0 -341
  905. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.js.map +0 -1
  906. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.d.ts +0 -8
  907. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js +0 -47
  908. package/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.js.map +0 -1
  909. package/bin/keycloakify/generateSrcMainResources/index.d.ts +0 -1
  910. package/bin/keycloakify/generateSrcMainResources/index.js +0 -18
  911. package/bin/keycloakify/generateSrcMainResources/index.js.map +0 -1
  912. package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.d.ts +0 -5
  913. package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.js +0 -105
  914. package/bin/keycloakify/generateSrcMainResources/readExtraPageNames.js.map +0 -1
  915. package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.d.ts +0 -6
  916. package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.js +0 -142
  917. package/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.js.map +0 -1
  918. package/bin/keycloakify/generateStartKeycloakTestingContainer.d.ts +0 -13
  919. package/bin/keycloakify/generateStartKeycloakTestingContainer.js +0 -86
  920. package/bin/keycloakify/generateStartKeycloakTestingContainer.js.map +0 -1
  921. package/bin/keycloakify/index.d.ts +0 -1
  922. package/bin/keycloakify/index.js +0 -18
  923. package/bin/keycloakify/index.js.map +0 -1
  924. package/bin/keycloakify/keycloakify.d.ts +0 -4
  925. package/bin/keycloakify/keycloakify.js +0 -152
  926. package/bin/keycloakify/keycloakify.js.map +0 -1
  927. package/bin/keycloakify/replacers/replaceImportsInCssCode.d.ts +0 -15
  928. package/bin/keycloakify/replacers/replaceImportsInCssCode.js +0 -88
  929. package/bin/keycloakify/replacers/replaceImportsInCssCode.js.map +0 -1
  930. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.d.ts +0 -9
  931. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js +0 -38
  932. package/bin/keycloakify/replacers/replaceImportsInInlineCssCode.js.map +0 -1
  933. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.d.ts +0 -1
  934. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js +0 -18
  935. package/bin/keycloakify/replacers/replaceImportsInJsCode/index.js.map +0 -1
  936. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.d.ts +0 -12
  937. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js +0 -70
  938. package/bin/keycloakify/replacers/replaceImportsInJsCode/replaceImportsInJsCode.js.map +0 -1
  939. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.d.ts +0 -13
  940. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js +0 -95
  941. package/bin/keycloakify/replacers/replaceImportsInJsCode/vite.js.map +0 -1
  942. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.d.ts +0 -12
  943. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js +0 -103
  944. package/bin/keycloakify/replacers/replaceImportsInJsCode/webpack.js.map +0 -1
  945. package/bin/main.d.ts +0 -4
  946. package/bin/main.js.map +0 -1
  947. package/bin/main.original.js +0 -287
  948. package/bin/shared/KeycloakVersionRange.js +0 -3
  949. package/bin/shared/buildOptions.d.ts +0 -40
  950. package/bin/shared/buildOptions.js +0 -214
  951. package/bin/shared/buildOptions.js.map +0 -1
  952. package/bin/shared/copyKeycloakResourcesToPublic.js +0 -177
  953. package/bin/shared/downloadAndUnzip.d.ts +0 -16
  954. package/bin/shared/downloadAndUnzip.js +0 -255
  955. package/bin/shared/downloadAndUnzip.js.map +0 -1
  956. package/bin/shared/downloadBuiltinKeycloakTheme.d.ts +0 -9
  957. package/bin/shared/downloadBuiltinKeycloakTheme.js +0 -316
  958. package/bin/shared/downloadBuiltinKeycloakTheme.js.map +0 -1
  959. package/bin/shared/downloadKeycloakStaticResources.js +0 -102
  960. package/bin/shared/getJarFileBasename.d.ts +0 -6
  961. package/bin/shared/getJarFileBasename.js +0 -10
  962. package/bin/shared/getJarFileBasename.js.map +0 -1
  963. package/bin/shared/getThemeSrcDirPath.d.ts +0 -6
  964. package/bin/shared/getThemeSrcDirPath.js +0 -123
  965. package/bin/shared/getThemeSrcDirPath.js.map +0 -1
  966. package/bin/shared/metaInfKeycloakThemes.js +0 -51
  967. package/bin/shared/promptKeycloakVersion.js +0 -159
  968. package/bin/start-keycloak.d.ts +0 -8
  969. package/bin/start-keycloak.js +0 -287
  970. package/bin/start-keycloak.js.map +0 -1
  971. package/bin/tools/OptionalIfCanBeUndefined.d.ts +0 -14
  972. package/bin/tools/OptionalIfCanBeUndefined.js +0 -3
  973. package/bin/tools/OptionalIfCanBeUndefined.js.map +0 -1
  974. package/bin/tools/SemVer.d.ts +0 -26
  975. package/bin/tools/SemVer.js +0 -119
  976. package/bin/tools/SemVer.js.map +0 -1
  977. package/bin/tools/String.prototype.replaceAll.d.ts +0 -1
  978. package/bin/tools/String.prototype.replaceAll.js +0 -29
  979. package/bin/tools/String.prototype.replaceAll.js.map +0 -1
  980. package/bin/tools/crawl.d.ts +0 -5
  981. package/bin/tools/crawl.js +0 -74
  982. package/bin/tools/crawl.js.map +0 -1
  983. package/bin/tools/crc32.d.ts +0 -9
  984. package/bin/tools/crc32.js +0 -64
  985. package/bin/tools/crc32.js.map +0 -1
  986. package/bin/tools/deflate.d.ts +0 -24
  987. package/bin/tools/deflate.js +0 -164
  988. package/bin/tools/deflate.js.map +0 -1
  989. package/bin/tools/fetchProxyOptions.d.ts +0 -5
  990. package/bin/tools/fetchProxyOptions.js +0 -172
  991. package/bin/tools/fetchProxyOptions.js.map +0 -1
  992. package/bin/tools/fs.existsAsync.d.ts +0 -1
  993. package/bin/tools/fs.existsAsync.js +0 -86
  994. package/bin/tools/fs.existsAsync.js.map +0 -1
  995. package/bin/tools/fs.rm.d.ts +0 -8
  996. package/bin/tools/fs.rm.js +0 -151
  997. package/bin/tools/fs.rm.js.map +0 -1
  998. package/bin/tools/fs.rmSync.d.ts +0 -8
  999. package/bin/tools/fs.rmSync.js +0 -58
  1000. package/bin/tools/fs.rmSync.js.map +0 -1
  1001. package/bin/tools/getAbsoluteAndInOsFormatPath.d.ts +0 -4
  1002. package/bin/tools/getAbsoluteAndInOsFormatPath.js +0 -44
  1003. package/bin/tools/getAbsoluteAndInOsFormatPath.js.map +0 -1
  1004. package/bin/tools/getNpmWorkspaceRootDirPath.d.ts +0 -5
  1005. package/bin/tools/getNpmWorkspaceRootDirPath.js +0 -74
  1006. package/bin/tools/getNpmWorkspaceRootDirPath.js.map +0 -1
  1007. package/bin/tools/getThisCodebaseRootDirPath.d.ts +0 -1
  1008. package/bin/tools/getThisCodebaseRootDirPath.js +0 -43
  1009. package/bin/tools/getThisCodebaseRootDirPath.js.map +0 -1
  1010. package/bin/tools/isInside.d.ts +0 -4
  1011. package/bin/tools/isInside.js +0 -10
  1012. package/bin/tools/isInside.js.map +0 -1
  1013. package/bin/tools/kebabCaseToSnakeCase.d.ts +0 -1
  1014. package/bin/tools/kebabCaseToSnakeCase.js +0 -35
  1015. package/bin/tools/kebabCaseToSnakeCase.js.map +0 -1
  1016. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.d.ts +0 -14
  1017. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js +0 -116
  1018. package/bin/tools/octokit-addons/getLatestsSemVersionedTag.js.map +0 -1
  1019. package/bin/tools/octokit-addons/listTags.d.ts +0 -13
  1020. package/bin/tools/octokit-addons/listTags.js +0 -155
  1021. package/bin/tools/octokit-addons/listTags.js.map +0 -1
  1022. package/bin/tools/partitionPromiseSettledResults.d.ts +0 -2
  1023. package/bin/tools/partitionPromiseSettledResults.js +0 -41
  1024. package/bin/tools/partitionPromiseSettledResults.js.map +0 -1
  1025. package/bin/tools/readThisNpmPackageVersion.d.ts +0 -1
  1026. package/bin/tools/readThisNpmPackageVersion.js +0 -37
  1027. package/bin/tools/readThisNpmPackageVersion.js.map +0 -1
  1028. package/bin/tools/tee.d.ts +0 -3
  1029. package/bin/tools/tee.js +0 -37
  1030. package/bin/tools/tee.js.map +0 -1
  1031. package/bin/tools/transformCodebase.d.ts +0 -20
  1032. package/bin/tools/transformCodebase.js +0 -97
  1033. package/bin/tools/transformCodebase.js.map +0 -1
  1034. package/bin/tools/trimIndent.d.ts +0 -5
  1035. package/bin/tools/trimIndent.js +0 -82
  1036. package/bin/tools/trimIndent.js.map +0 -1
  1037. package/bin/tools/unzip.d.ts +0 -2
  1038. package/bin/tools/unzip.js +0 -274
  1039. package/bin/tools/unzip.js.map +0 -1
  1040. package/bin/tsconfig.tsbuildinfo +0 -1
  1041. package/lib/isStorybook.d.ts +0 -1
  1042. package/lib/isStorybook.js +0 -2
  1043. package/lib/isStorybook.js.map +0 -1
  1044. package/lib/useGetClassName.d.ts +0 -10
  1045. package/lib/useGetClassName.js +0 -14
  1046. package/lib/useGetClassName.js.map +0 -1
  1047. package/login/Fallback.d.ts +0 -11
  1048. package/login/Fallback.js +0 -125
  1049. package/login/Fallback.js.map +0 -1
  1050. package/login/i18n/baseMessages/ar.d.ts +0 -438
  1051. package/login/i18n/baseMessages/ar.js +0 -443
  1052. package/login/i18n/baseMessages/ar.js.map +0 -1
  1053. package/login/i18n/baseMessages/ca.d.ts +0 -457
  1054. package/login/i18n/baseMessages/ca.js +0 -462
  1055. package/login/i18n/baseMessages/ca.js.map +0 -1
  1056. package/login/i18n/baseMessages/cs.d.ts +0 -435
  1057. package/login/i18n/baseMessages/cs.js +0 -440
  1058. package/login/i18n/baseMessages/cs.js.map +0 -1
  1059. package/login/i18n/baseMessages/da.d.ts +0 -310
  1060. package/login/i18n/baseMessages/da.js +0 -315
  1061. package/login/i18n/baseMessages/da.js.map +0 -1
  1062. package/login/i18n/baseMessages/de.d.ts +0 -369
  1063. package/login/i18n/baseMessages/de.js +0 -374
  1064. package/login/i18n/baseMessages/de.js.map +0 -1
  1065. package/login/i18n/baseMessages/el.d.ts +0 -453
  1066. package/login/i18n/baseMessages/el.js +0 -458
  1067. package/login/i18n/baseMessages/el.js.map +0 -1
  1068. package/login/i18n/baseMessages/en.d.ts +0 -467
  1069. package/login/i18n/baseMessages/en.js +0 -472
  1070. package/login/i18n/baseMessages/en.js.map +0 -1
  1071. package/login/i18n/baseMessages/es.d.ts +0 -467
  1072. package/login/i18n/baseMessages/es.js +0 -472
  1073. package/login/i18n/baseMessages/es.js.map +0 -1
  1074. package/login/i18n/baseMessages/fa.d.ts +0 -453
  1075. package/login/i18n/baseMessages/fa.js +0 -458
  1076. package/login/i18n/baseMessages/fa.js.map +0 -1
  1077. package/login/i18n/baseMessages/fi.d.ts +0 -368
  1078. package/login/i18n/baseMessages/fi.js +0 -373
  1079. package/login/i18n/baseMessages/fi.js.map +0 -1
  1080. package/login/i18n/baseMessages/fr.d.ts +0 -384
  1081. package/login/i18n/baseMessages/fr.js +0 -389
  1082. package/login/i18n/baseMessages/fr.js.map +0 -1
  1083. package/login/i18n/baseMessages/hu.d.ts +0 -457
  1084. package/login/i18n/baseMessages/hu.js +0 -462
  1085. package/login/i18n/baseMessages/hu.js.map +0 -1
  1086. package/login/i18n/baseMessages/index.d.ts +0 -3824
  1087. package/login/i18n/baseMessages/index.js +0 -39
  1088. package/login/i18n/baseMessages/index.js.map +0 -1
  1089. package/login/i18n/baseMessages/it.d.ts +0 -310
  1090. package/login/i18n/baseMessages/it.js +0 -315
  1091. package/login/i18n/baseMessages/it.js.map +0 -1
  1092. package/login/i18n/baseMessages/ja.d.ts +0 -314
  1093. package/login/i18n/baseMessages/ja.js +0 -319
  1094. package/login/i18n/baseMessages/ja.js.map +0 -1
  1095. package/login/i18n/baseMessages/lt.d.ts +0 -194
  1096. package/login/i18n/baseMessages/lt.js +0 -199
  1097. package/login/i18n/baseMessages/lt.js.map +0 -1
  1098. package/login/i18n/baseMessages/lv.d.ts +0 -205
  1099. package/login/i18n/baseMessages/lv.js +0 -210
  1100. package/login/i18n/baseMessages/lv.js.map +0 -1
  1101. package/login/i18n/baseMessages/nl.d.ts +0 -276
  1102. package/login/i18n/baseMessages/nl.js +0 -281
  1103. package/login/i18n/baseMessages/nl.js.map +0 -1
  1104. package/login/i18n/baseMessages/no.d.ts +0 -193
  1105. package/login/i18n/baseMessages/no.js +0 -198
  1106. package/login/i18n/baseMessages/no.js.map +0 -1
  1107. package/login/i18n/baseMessages/pl.d.ts +0 -283
  1108. package/login/i18n/baseMessages/pl.js +0 -288
  1109. package/login/i18n/baseMessages/pl.js.map +0 -1
  1110. package/login/i18n/baseMessages/pt-BR.d.ts +0 -337
  1111. package/login/i18n/baseMessages/pt-BR.js +0 -342
  1112. package/login/i18n/baseMessages/pt-BR.js.map +0 -1
  1113. package/login/i18n/baseMessages/ru.d.ts +0 -211
  1114. package/login/i18n/baseMessages/ru.js +0 -216
  1115. package/login/i18n/baseMessages/ru.js.map +0 -1
  1116. package/login/i18n/baseMessages/sk.d.ts +0 -438
  1117. package/login/i18n/baseMessages/sk.js +0 -443
  1118. package/login/i18n/baseMessages/sk.js.map +0 -1
  1119. package/login/i18n/baseMessages/sv.d.ts +0 -192
  1120. package/login/i18n/baseMessages/sv.js +0 -197
  1121. package/login/i18n/baseMessages/sv.js.map +0 -1
  1122. package/login/i18n/baseMessages/th.d.ts +0 -434
  1123. package/login/i18n/baseMessages/th.js +0 -439
  1124. package/login/i18n/baseMessages/th.js.map +0 -1
  1125. package/login/i18n/baseMessages/tr.d.ts +0 -261
  1126. package/login/i18n/baseMessages/tr.js +0 -266
  1127. package/login/i18n/baseMessages/tr.js.map +0 -1
  1128. package/login/i18n/baseMessages/uk.d.ts +0 -433
  1129. package/login/i18n/baseMessages/uk.js +0 -438
  1130. package/login/i18n/baseMessages/uk.js.map +0 -1
  1131. package/login/i18n/baseMessages/zh-CN.d.ts +0 -462
  1132. package/login/i18n/baseMessages/zh-CN.js +0 -467
  1133. package/login/i18n/baseMessages/zh-CN.js.map +0 -1
  1134. package/login/kcContext/KcContext.d.ts +0 -561
  1135. package/login/kcContext/KcContext.js.map +0 -1
  1136. package/login/kcContext/createGetKcContext.d.ts +0 -19
  1137. package/login/kcContext/createGetKcContext.js +0 -109
  1138. package/login/kcContext/createGetKcContext.js.map +0 -1
  1139. package/login/kcContext/getKcContext.d.ts +0 -13
  1140. package/login/kcContext/getKcContext.js +0 -13
  1141. package/login/kcContext/getKcContext.js.map +0 -1
  1142. package/login/kcContext/getKcContextFromWindow.d.ts +0 -8
  1143. package/login/kcContext/getKcContextFromWindow.js +0 -5
  1144. package/login/kcContext/getKcContextFromWindow.js.map +0 -1
  1145. package/login/kcContext/index.d.ts +0 -1
  1146. package/login/kcContext/index.js +0 -2
  1147. package/login/kcContext/index.js.map +0 -1
  1148. package/login/kcContext/kcContextMocks.d.ts +0 -4
  1149. package/login/kcContext/kcContextMocks.js +0 -390
  1150. package/login/kcContext/kcContextMocks.js.map +0 -1
  1151. package/login/lib/useDownloadTerms.d.ts +0 -17
  1152. package/login/lib/useDownloadTerms.js +0 -32
  1153. package/login/lib/useDownloadTerms.js.map +0 -1
  1154. package/login/lib/useGetClassName.d.ts +0 -7
  1155. package/login/lib/useGetClassName.js +0 -130
  1156. package/login/lib/useGetClassName.js.map +0 -1
  1157. package/src/account/Fallback.tsx +0 -41
  1158. package/src/account/i18n/baseMessages/ar.ts +0 -365
  1159. package/src/account/i18n/baseMessages/ca.ts +0 -365
  1160. package/src/account/i18n/baseMessages/cs.ts +0 -157
  1161. package/src/account/i18n/baseMessages/da.ts +0 -294
  1162. package/src/account/i18n/baseMessages/de.ts +0 -317
  1163. package/src/account/i18n/baseMessages/el.ts +0 -364
  1164. package/src/account/i18n/baseMessages/en.ts +0 -368
  1165. package/src/account/i18n/baseMessages/es.ts +0 -367
  1166. package/src/account/i18n/baseMessages/fa.ts +0 -365
  1167. package/src/account/i18n/baseMessages/fi.ts +0 -361
  1168. package/src/account/i18n/baseMessages/fr.ts +0 -168
  1169. package/src/account/i18n/baseMessages/hu.ts +0 -365
  1170. package/src/account/i18n/baseMessages/index.ts +0 -39
  1171. package/src/account/i18n/baseMessages/it.ts +0 -305
  1172. package/src/account/i18n/baseMessages/ja.ts +0 -299
  1173. package/src/account/i18n/baseMessages/lt.ts +0 -142
  1174. package/src/account/i18n/baseMessages/lv.ts +0 -186
  1175. package/src/account/i18n/baseMessages/nl.ts +0 -334
  1176. package/src/account/i18n/baseMessages/no.ts +0 -142
  1177. package/src/account/i18n/baseMessages/pl.ts +0 -343
  1178. package/src/account/i18n/baseMessages/pt-BR.ts +0 -313
  1179. package/src/account/i18n/baseMessages/ru.ts +0 -210
  1180. package/src/account/i18n/baseMessages/sk.ts +0 -180
  1181. package/src/account/i18n/baseMessages/sv.ts +0 -139
  1182. package/src/account/i18n/baseMessages/th.ts +0 -343
  1183. package/src/account/i18n/baseMessages/tr.ts +0 -282
  1184. package/src/account/i18n/baseMessages/uk.ts +0 -343
  1185. package/src/account/i18n/baseMessages/zh-CN.ts +0 -152
  1186. package/src/account/kcContext/KcContext.ts +0 -285
  1187. package/src/account/kcContext/createGetKcContext.ts +0 -108
  1188. package/src/account/kcContext/getKcContext.ts +0 -21
  1189. package/src/account/kcContext/getKcContextFromWindow.ts +0 -11
  1190. package/src/account/kcContext/index.ts +0 -1
  1191. package/src/account/kcContext/kcContextMocks.ts +0 -260
  1192. package/src/account/lib/useGetClassName.ts +0 -20
  1193. package/src/bin/download-builtin-keycloak-theme.ts +0 -30
  1194. package/src/bin/eject-keycloak-page.ts +0 -126
  1195. package/src/bin/keycloakify/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +0 -521
  1196. package/src/bin/keycloakify/generateSrcMainResources/bringInAccountV1.ts +0 -79
  1197. package/src/bin/keycloakify/generateSrcMainResources/generateMessageProperties.ts +0 -179
  1198. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResources.ts +0 -32
  1199. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForMainTheme.ts +0 -261
  1200. package/src/bin/keycloakify/generateSrcMainResources/generateSrcMainResourcesForThemeVariant.ts +0 -56
  1201. package/src/bin/keycloakify/generateSrcMainResources/index.ts +0 -1
  1202. package/src/bin/keycloakify/generateSrcMainResources/readExtraPageNames.ts +0 -38
  1203. package/src/bin/keycloakify/generateSrcMainResources/readFieldNameUsage.ts +0 -56
  1204. package/src/bin/keycloakify/generateStartKeycloakTestingContainer.ts +0 -60
  1205. package/src/bin/keycloakify/replacers/replaceImportsInInlineCssCode.ts +0 -24
  1206. package/src/bin/shared/buildOptions.ts +0 -277
  1207. package/src/bin/shared/downloadAndUnzip.ts +0 -203
  1208. package/src/bin/shared/downloadBuiltinKeycloakTheme.ts +0 -264
  1209. package/src/bin/shared/getJarFileBasename.ts +0 -9
  1210. package/src/bin/shared/getThemeSrcDirPath.ts +0 -47
  1211. package/src/bin/start-keycloak.ts +0 -236
  1212. package/src/bin/tools/getNpmWorkspaceRootDirPath.ts +0 -27
  1213. package/src/bin/tools/unzip.ts +0 -141
  1214. package/src/lib/isStorybook.ts +0 -1
  1215. package/src/lib/useGetClassName.ts +0 -18
  1216. package/src/login/Fallback.tsx +0 -128
  1217. package/src/login/i18n/baseMessages/ar.ts +0 -444
  1218. package/src/login/i18n/baseMessages/ca.ts +0 -463
  1219. package/src/login/i18n/baseMessages/cs.ts +0 -441
  1220. package/src/login/i18n/baseMessages/da.ts +0 -316
  1221. package/src/login/i18n/baseMessages/de.ts +0 -375
  1222. package/src/login/i18n/baseMessages/el.ts +0 -459
  1223. package/src/login/i18n/baseMessages/en.ts +0 -473
  1224. package/src/login/i18n/baseMessages/es.ts +0 -473
  1225. package/src/login/i18n/baseMessages/fa.ts +0 -459
  1226. package/src/login/i18n/baseMessages/fi.ts +0 -374
  1227. package/src/login/i18n/baseMessages/fr.ts +0 -390
  1228. package/src/login/i18n/baseMessages/hu.ts +0 -463
  1229. package/src/login/i18n/baseMessages/index.ts +0 -39
  1230. package/src/login/i18n/baseMessages/it.ts +0 -316
  1231. package/src/login/i18n/baseMessages/ja.ts +0 -320
  1232. package/src/login/i18n/baseMessages/lt.ts +0 -200
  1233. package/src/login/i18n/baseMessages/lv.ts +0 -211
  1234. package/src/login/i18n/baseMessages/nl.ts +0 -282
  1235. package/src/login/i18n/baseMessages/no.ts +0 -199
  1236. package/src/login/i18n/baseMessages/pl.ts +0 -289
  1237. package/src/login/i18n/baseMessages/pt-BR.ts +0 -343
  1238. package/src/login/i18n/baseMessages/ru.ts +0 -217
  1239. package/src/login/i18n/baseMessages/sk.ts +0 -444
  1240. package/src/login/i18n/baseMessages/sv.ts +0 -198
  1241. package/src/login/i18n/baseMessages/th.ts +0 -440
  1242. package/src/login/i18n/baseMessages/tr.ts +0 -267
  1243. package/src/login/i18n/baseMessages/uk.ts +0 -439
  1244. package/src/login/i18n/baseMessages/zh-CN.ts +0 -468
  1245. package/src/login/kcContext/KcContext.ts +0 -746
  1246. package/src/login/kcContext/createGetKcContext.ts +0 -159
  1247. package/src/login/kcContext/getKcContext.ts +0 -21
  1248. package/src/login/kcContext/getKcContextFromWindow.ts +0 -11
  1249. package/src/login/kcContext/index.ts +0 -1
  1250. package/src/login/kcContext/kcContextMocks.ts +0 -630
  1251. package/src/login/lib/useDownloadTerms.ts +0 -57
  1252. package/src/login/lib/useGetClassName.ts +0 -132
  1253. package/src/tools/AndByDiscriminatingKey.ts +0 -25
  1254. package/src/tools/Markdown.ts +0 -3
  1255. package/src/tools/deepClone.ts +0 -17
  1256. package/src/tools/memoize.ts +0 -55
  1257. package/tools/AndByDiscriminatingKey.d.ts +0 -5
  1258. package/tools/AndByDiscriminatingKey.js +0 -2
  1259. package/tools/AndByDiscriminatingKey.js.map +0 -1
  1260. package/tools/Markdown.d.ts +0 -2
  1261. package/tools/Markdown.js +0 -3
  1262. package/tools/Markdown.js.map +0 -1
  1263. package/tools/deepClone.d.ts +0 -2
  1264. package/tools/deepClone.js +0 -14
  1265. package/tools/deepClone.js.map +0 -1
  1266. package/tools/memoize.d.ts +0 -7
  1267. package/tools/memoize.js +0 -38
  1268. package/tools/memoize.js.map +0 -1
  1269. package/tsconfig.tsbuildinfo +0 -1
  1270. package/vite-plugin/index.original.js +0 -17
  1271. package/vite-plugin/tsconfig.tsbuildinfo +0 -1
  1272. package/vite-plugin/vite-plugin.js +0 -136
  1273. /package/account/{kcContext → KcContext}/KcContext.js +0 -0
  1274. /package/login/{kcContext → KcContext}/KcContext.js +0 -0
@@ -0,0 +1,4215 @@
1
+ "use strict";
2
+ exports.id = 941;
3
+ exports.ids = [941];
4
+ exports.modules = {
5
+
6
+ /***/ 50379:
7
+ /***/ ((__unused_webpack_module, exports) => {
8
+
9
+
10
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11
+ exports.Reflect = void 0;
12
+ /** Always return null but pretends it returns an object of type T */
13
+ function Reflect() {
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
+ return null;
16
+ }
17
+ exports.Reflect = Reflect;
18
+ //# sourceMappingURL=Reflect.js.map
19
+
20
+ /***/ }),
21
+
22
+ /***/ 61502:
23
+ /***/ ((__unused_webpack_module, exports) => {
24
+
25
+
26
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
27
+ exports.capitalize = void 0;
28
+ /** @see <https://docs.tsafe.dev/capitalize> */
29
+ function capitalize(str) {
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ return (str.charAt(0).toUpperCase() + str.slice(1));
32
+ }
33
+ exports.capitalize = capitalize;
34
+ //# sourceMappingURL=capitalize.js.map
35
+
36
+ /***/ }),
37
+
38
+ /***/ 41370:
39
+ /***/ ((__unused_webpack_module, exports) => {
40
+
41
+
42
+ /* eslint-disable @typescript-eslint/no-explicit-any */
43
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
44
+ exports.exclude = void 0;
45
+ /** Return a function to use as Array.prototype.filter argument
46
+ * to exclude one or many primitive value element from the array.
47
+ * Ex: ([ "a", "b", "c" ] as const).filter(exclude("a")) return ("b" | "c")[]
48
+ * Ex: ([ "a", "b", "c", "d"] as const).filter(exclude(["a", "b"]) gives ("c" | "d")[]
49
+ */
50
+ function exclude(target) {
51
+ var test = target instanceof Object
52
+ ? function (element) { return target.indexOf(element) < 0; }
53
+ : function (element) { return element !== target; };
54
+ return function (str) {
55
+ return test(str);
56
+ };
57
+ }
58
+ exports.exclude = exclude;
59
+ //# sourceMappingURL=exclude.js.map
60
+
61
+ /***/ }),
62
+
63
+ /***/ 11800:
64
+ /***/ ((__unused_webpack_module, exports) => {
65
+
66
+
67
+ /* eslint-disable @typescript-eslint/no-explicit-any */
68
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
69
+ exports.flip = void 0;
70
+ /**
71
+ * Flip the value of a boolean without having to reference it twice
72
+ * after running flip(x.y, "z") x.y.z !== x.y.z,
73
+ * https://docs.tsafe.dev/flip
74
+ */
75
+ function flip(object, prop) {
76
+ if (object[prop] === undefined) {
77
+ return;
78
+ }
79
+ return (object[prop] = !object[prop]);
80
+ }
81
+ exports.flip = flip;
82
+ //# sourceMappingURL=flip.js.map
83
+
84
+ /***/ }),
85
+
86
+ /***/ 1666:
87
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
88
+
89
+
90
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
91
+ if (k2 === undefined) k2 = k;
92
+ var desc = Object.getOwnPropertyDescriptor(m, k);
93
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
94
+ desc = { enumerable: true, get: function() { return m[k]; } };
95
+ }
96
+ Object.defineProperty(o, k2, desc);
97
+ }) : (function(o, m, k, k2) {
98
+ if (k2 === undefined) k2 = k;
99
+ o[k2] = m[k];
100
+ }));
101
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
102
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
103
+ };
104
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
105
+ __exportStar(__webpack_require__(88078), exports);
106
+ __exportStar(__webpack_require__(41370), exports);
107
+ __exportStar(__webpack_require__(11800), exports);
108
+ __exportStar(__webpack_require__(43047), exports);
109
+ __exportStar(__webpack_require__(75268), exports);
110
+ __exportStar(__webpack_require__(66762), exports);
111
+ __exportStar(__webpack_require__(47393), exports);
112
+ __exportStar(__webpack_require__(94655), exports);
113
+ __exportStar(__webpack_require__(39612), exports);
114
+ __exportStar(__webpack_require__(68634), exports);
115
+ __exportStar(__webpack_require__(1049), exports);
116
+ __exportStar(__webpack_require__(50379), exports);
117
+ __exportStar(__webpack_require__(61502), exports);
118
+ __exportStar(__webpack_require__(99479), exports);
119
+ //# sourceMappingURL=index.js.map
120
+
121
+ /***/ }),
122
+
123
+ /***/ 75268:
124
+ /***/ ((__unused_webpack_module, exports) => {
125
+
126
+
127
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
128
+ exports.isPromiseLike = void 0;
129
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
+ function isPromiseLike(o) {
131
+ return typeof o === "object" && o !== null && "then" in o && typeof o.then === "function";
132
+ }
133
+ exports.isPromiseLike = isPromiseLike;
134
+ //# sourceMappingURL=isPromiseLike.js.map
135
+
136
+ /***/ }),
137
+
138
+ /***/ 1049:
139
+ /***/ ((__unused_webpack_module, exports) => {
140
+
141
+
142
+ /* eslint-disable @typescript-eslint/no-explicit-any */
143
+ /* eslint-disable @typescript-eslint/ban-types */
144
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
145
+ exports.noUndefined = void 0;
146
+ /**
147
+ * Removes the enumerable properties whose values are
148
+ * undefined.
149
+ *
150
+ * Example:
151
+ * noUndefined({ "foo": undefined, "bar": 3 }) returns
152
+ * a new object { "bar": 3 }
153
+ */
154
+ function noUndefined(obj) {
155
+ var out = {};
156
+ for (var key in obj) {
157
+ if (obj[key] === undefined) {
158
+ continue;
159
+ }
160
+ out[key] = obj[key];
161
+ }
162
+ return out;
163
+ }
164
+ exports.noUndefined = noUndefined;
165
+ //# sourceMappingURL=noUndefined.js.map
166
+
167
+ /***/ }),
168
+
169
+ /***/ 39612:
170
+ /***/ ((__unused_webpack_module, exports) => {
171
+
172
+
173
+ /* eslint-disable @typescript-eslint/no-explicit-any */
174
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
175
+ exports.objectEntries = void 0;
176
+ /** https://docs.tsafe.dev/objectentries */
177
+ function objectEntries(o) {
178
+ return Object.entries(o);
179
+ }
180
+ exports.objectEntries = objectEntries;
181
+ //# sourceMappingURL=objectEntries.js.map
182
+
183
+ /***/ }),
184
+
185
+ /***/ 68634:
186
+ /***/ ((__unused_webpack_module, exports) => {
187
+
188
+
189
+ /* eslint-disable @typescript-eslint/no-explicit-any */
190
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
191
+ exports.objectFromEntries = void 0;
192
+ /** https://docs.tsafe.dev/objectFromEntries */
193
+ function objectFromEntries(entries) {
194
+ return Object.fromEntries(entries);
195
+ }
196
+ exports.objectFromEntries = objectFromEntries;
197
+ //# sourceMappingURL=objectFromEntries.js.map
198
+
199
+ /***/ }),
200
+
201
+ /***/ 66762:
202
+ /***/ ((__unused_webpack_module, exports) => {
203
+
204
+
205
+ /* eslint-disable @typescript-eslint/no-explicit-any */
206
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
207
+ exports.objectKeys = void 0;
208
+ /** https://docs.tsafe.dev/objectKeys */
209
+ function objectKeys(o) {
210
+ return Object.keys(o);
211
+ }
212
+ exports.objectKeys = objectKeys;
213
+ //# sourceMappingURL=objectKeys.js.map
214
+
215
+ /***/ }),
216
+
217
+ /***/ 47393:
218
+ /***/ ((__unused_webpack_module, exports) => {
219
+
220
+
221
+ /* eslint-disable @typescript-eslint/no-namespace */
222
+ /* eslint-disable @typescript-eslint/no-explicit-any */
223
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
224
+ exports.typeGuard = void 0;
225
+ /** https://docs.tsafe.dev/typeguard */
226
+ function typeGuard(_value, isMatched) {
227
+ return isMatched;
228
+ }
229
+ exports.typeGuard = typeGuard;
230
+ //# sourceMappingURL=typeGuard.js.map
231
+
232
+ /***/ }),
233
+
234
+ /***/ 99479:
235
+ /***/ ((__unused_webpack_module, exports) => {
236
+
237
+
238
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
239
+ exports.uncapitalize = void 0;
240
+ /** @see <https://docs.tsafe.dev/capitalize#uncapitalize> */
241
+ function uncapitalize(str) {
242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
+ return (str.charAt(0).toLowerCase() + str.slice(1));
244
+ }
245
+ exports.uncapitalize = uncapitalize;
246
+ //# sourceMappingURL=uncapitalize.js.map
247
+
248
+ /***/ }),
249
+
250
+ /***/ 52300:
251
+ /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
252
+
253
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
254
+ /* harmony export */ "z": () => (/* binding */ z)
255
+ /* harmony export */ });
256
+ /* unused harmony exports BRAND, DIRTY, EMPTY_PATH, INVALID, NEVER, OK, ParseStatus, Schema, ZodAny, ZodArray, ZodBigInt, ZodBoolean, ZodBranded, ZodCatch, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodEffects, ZodEnum, ZodError, ZodFirstPartyTypeKind, ZodFunction, ZodIntersection, ZodIssueCode, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNativeEnum, ZodNever, ZodNull, ZodNullable, ZodNumber, ZodObject, ZodOptional, ZodParsedType, ZodPipeline, ZodPromise, ZodRecord, ZodSchema, ZodSet, ZodString, ZodSymbol, ZodTransformer, ZodTuple, ZodType, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, addIssueToContext, any, array, bigint, boolean, coerce, custom, date, default, defaultErrorMap, discriminatedUnion, effect, enum, function, getErrorMap, getParsedType, instanceof, intersection, isAborted, isAsync, isDirty, isValid, late, lazy, literal, makeIssue, map, nan, nativeEnum, never, null, nullable, number, object, objectUtil, oboolean, onumber, optional, ostring, pipeline, preprocess, promise, quotelessJson, record, set, setErrorMap, strictObject, string, symbol, transformer, tuple, undefined, union, unknown, util, void */
257
+ var util;
258
+ (function (util) {
259
+ util.assertEqual = (val) => val;
260
+ function assertIs(_arg) { }
261
+ util.assertIs = assertIs;
262
+ function assertNever(_x) {
263
+ throw new Error();
264
+ }
265
+ util.assertNever = assertNever;
266
+ util.arrayToEnum = (items) => {
267
+ const obj = {};
268
+ for (const item of items) {
269
+ obj[item] = item;
270
+ }
271
+ return obj;
272
+ };
273
+ util.getValidEnumValues = (obj) => {
274
+ const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
275
+ const filtered = {};
276
+ for (const k of validKeys) {
277
+ filtered[k] = obj[k];
278
+ }
279
+ return util.objectValues(filtered);
280
+ };
281
+ util.objectValues = (obj) => {
282
+ return util.objectKeys(obj).map(function (e) {
283
+ return obj[e];
284
+ });
285
+ };
286
+ util.objectKeys = typeof Object.keys === "function" // eslint-disable-line ban/ban
287
+ ? (obj) => Object.keys(obj) // eslint-disable-line ban/ban
288
+ : (object) => {
289
+ const keys = [];
290
+ for (const key in object) {
291
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
292
+ keys.push(key);
293
+ }
294
+ }
295
+ return keys;
296
+ };
297
+ util.find = (arr, checker) => {
298
+ for (const item of arr) {
299
+ if (checker(item))
300
+ return item;
301
+ }
302
+ return undefined;
303
+ };
304
+ util.isInteger = typeof Number.isInteger === "function"
305
+ ? (val) => Number.isInteger(val) // eslint-disable-line ban/ban
306
+ : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
307
+ function joinValues(array, separator = " | ") {
308
+ return array
309
+ .map((val) => (typeof val === "string" ? `'${val}'` : val))
310
+ .join(separator);
311
+ }
312
+ util.joinValues = joinValues;
313
+ util.jsonStringifyReplacer = (_, value) => {
314
+ if (typeof value === "bigint") {
315
+ return value.toString();
316
+ }
317
+ return value;
318
+ };
319
+ })(util || (util = {}));
320
+ var objectUtil;
321
+ (function (objectUtil) {
322
+ objectUtil.mergeShapes = (first, second) => {
323
+ return {
324
+ ...first,
325
+ ...second, // second overwrites first
326
+ };
327
+ };
328
+ })(objectUtil || (objectUtil = {}));
329
+ const ZodParsedType = util.arrayToEnum([
330
+ "string",
331
+ "nan",
332
+ "number",
333
+ "integer",
334
+ "float",
335
+ "boolean",
336
+ "date",
337
+ "bigint",
338
+ "symbol",
339
+ "function",
340
+ "undefined",
341
+ "null",
342
+ "array",
343
+ "object",
344
+ "unknown",
345
+ "promise",
346
+ "void",
347
+ "never",
348
+ "map",
349
+ "set",
350
+ ]);
351
+ const getParsedType = (data) => {
352
+ const t = typeof data;
353
+ switch (t) {
354
+ case "undefined":
355
+ return ZodParsedType.undefined;
356
+ case "string":
357
+ return ZodParsedType.string;
358
+ case "number":
359
+ return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
360
+ case "boolean":
361
+ return ZodParsedType.boolean;
362
+ case "function":
363
+ return ZodParsedType.function;
364
+ case "bigint":
365
+ return ZodParsedType.bigint;
366
+ case "symbol":
367
+ return ZodParsedType.symbol;
368
+ case "object":
369
+ if (Array.isArray(data)) {
370
+ return ZodParsedType.array;
371
+ }
372
+ if (data === null) {
373
+ return ZodParsedType.null;
374
+ }
375
+ if (data.then &&
376
+ typeof data.then === "function" &&
377
+ data.catch &&
378
+ typeof data.catch === "function") {
379
+ return ZodParsedType.promise;
380
+ }
381
+ if (typeof Map !== "undefined" && data instanceof Map) {
382
+ return ZodParsedType.map;
383
+ }
384
+ if (typeof Set !== "undefined" && data instanceof Set) {
385
+ return ZodParsedType.set;
386
+ }
387
+ if (typeof Date !== "undefined" && data instanceof Date) {
388
+ return ZodParsedType.date;
389
+ }
390
+ return ZodParsedType.object;
391
+ default:
392
+ return ZodParsedType.unknown;
393
+ }
394
+ };
395
+
396
+ const ZodIssueCode = util.arrayToEnum([
397
+ "invalid_type",
398
+ "invalid_literal",
399
+ "custom",
400
+ "invalid_union",
401
+ "invalid_union_discriminator",
402
+ "invalid_enum_value",
403
+ "unrecognized_keys",
404
+ "invalid_arguments",
405
+ "invalid_return_type",
406
+ "invalid_date",
407
+ "invalid_string",
408
+ "too_small",
409
+ "too_big",
410
+ "invalid_intersection_types",
411
+ "not_multiple_of",
412
+ "not_finite",
413
+ ]);
414
+ const quotelessJson = (obj) => {
415
+ const json = JSON.stringify(obj, null, 2);
416
+ return json.replace(/"([^"]+)":/g, "$1:");
417
+ };
418
+ class ZodError extends Error {
419
+ constructor(issues) {
420
+ super();
421
+ this.issues = [];
422
+ this.addIssue = (sub) => {
423
+ this.issues = [...this.issues, sub];
424
+ };
425
+ this.addIssues = (subs = []) => {
426
+ this.issues = [...this.issues, ...subs];
427
+ };
428
+ const actualProto = new.target.prototype;
429
+ if (Object.setPrototypeOf) {
430
+ // eslint-disable-next-line ban/ban
431
+ Object.setPrototypeOf(this, actualProto);
432
+ }
433
+ else {
434
+ this.__proto__ = actualProto;
435
+ }
436
+ this.name = "ZodError";
437
+ this.issues = issues;
438
+ }
439
+ get errors() {
440
+ return this.issues;
441
+ }
442
+ format(_mapper) {
443
+ const mapper = _mapper ||
444
+ function (issue) {
445
+ return issue.message;
446
+ };
447
+ const fieldErrors = { _errors: [] };
448
+ const processError = (error) => {
449
+ for (const issue of error.issues) {
450
+ if (issue.code === "invalid_union") {
451
+ issue.unionErrors.map(processError);
452
+ }
453
+ else if (issue.code === "invalid_return_type") {
454
+ processError(issue.returnTypeError);
455
+ }
456
+ else if (issue.code === "invalid_arguments") {
457
+ processError(issue.argumentsError);
458
+ }
459
+ else if (issue.path.length === 0) {
460
+ fieldErrors._errors.push(mapper(issue));
461
+ }
462
+ else {
463
+ let curr = fieldErrors;
464
+ let i = 0;
465
+ while (i < issue.path.length) {
466
+ const el = issue.path[i];
467
+ const terminal = i === issue.path.length - 1;
468
+ if (!terminal) {
469
+ curr[el] = curr[el] || { _errors: [] };
470
+ // if (typeof el === "string") {
471
+ // curr[el] = curr[el] || { _errors: [] };
472
+ // } else if (typeof el === "number") {
473
+ // const errorArray: any = [];
474
+ // errorArray._errors = [];
475
+ // curr[el] = curr[el] || errorArray;
476
+ // }
477
+ }
478
+ else {
479
+ curr[el] = curr[el] || { _errors: [] };
480
+ curr[el]._errors.push(mapper(issue));
481
+ }
482
+ curr = curr[el];
483
+ i++;
484
+ }
485
+ }
486
+ }
487
+ };
488
+ processError(this);
489
+ return fieldErrors;
490
+ }
491
+ toString() {
492
+ return this.message;
493
+ }
494
+ get message() {
495
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
496
+ }
497
+ get isEmpty() {
498
+ return this.issues.length === 0;
499
+ }
500
+ flatten(mapper = (issue) => issue.message) {
501
+ const fieldErrors = {};
502
+ const formErrors = [];
503
+ for (const sub of this.issues) {
504
+ if (sub.path.length > 0) {
505
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
506
+ fieldErrors[sub.path[0]].push(mapper(sub));
507
+ }
508
+ else {
509
+ formErrors.push(mapper(sub));
510
+ }
511
+ }
512
+ return { formErrors, fieldErrors };
513
+ }
514
+ get formErrors() {
515
+ return this.flatten();
516
+ }
517
+ }
518
+ ZodError.create = (issues) => {
519
+ const error = new ZodError(issues);
520
+ return error;
521
+ };
522
+
523
+ const errorMap = (issue, _ctx) => {
524
+ let message;
525
+ switch (issue.code) {
526
+ case ZodIssueCode.invalid_type:
527
+ if (issue.received === ZodParsedType.undefined) {
528
+ message = "Required";
529
+ }
530
+ else {
531
+ message = `Expected ${issue.expected}, received ${issue.received}`;
532
+ }
533
+ break;
534
+ case ZodIssueCode.invalid_literal:
535
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
536
+ break;
537
+ case ZodIssueCode.unrecognized_keys:
538
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
539
+ break;
540
+ case ZodIssueCode.invalid_union:
541
+ message = `Invalid input`;
542
+ break;
543
+ case ZodIssueCode.invalid_union_discriminator:
544
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
545
+ break;
546
+ case ZodIssueCode.invalid_enum_value:
547
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
548
+ break;
549
+ case ZodIssueCode.invalid_arguments:
550
+ message = `Invalid function arguments`;
551
+ break;
552
+ case ZodIssueCode.invalid_return_type:
553
+ message = `Invalid function return type`;
554
+ break;
555
+ case ZodIssueCode.invalid_date:
556
+ message = `Invalid date`;
557
+ break;
558
+ case ZodIssueCode.invalid_string:
559
+ if (typeof issue.validation === "object") {
560
+ if ("includes" in issue.validation) {
561
+ message = `Invalid input: must include "${issue.validation.includes}"`;
562
+ if (typeof issue.validation.position === "number") {
563
+ message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
564
+ }
565
+ }
566
+ else if ("startsWith" in issue.validation) {
567
+ message = `Invalid input: must start with "${issue.validation.startsWith}"`;
568
+ }
569
+ else if ("endsWith" in issue.validation) {
570
+ message = `Invalid input: must end with "${issue.validation.endsWith}"`;
571
+ }
572
+ else {
573
+ util.assertNever(issue.validation);
574
+ }
575
+ }
576
+ else if (issue.validation !== "regex") {
577
+ message = `Invalid ${issue.validation}`;
578
+ }
579
+ else {
580
+ message = "Invalid";
581
+ }
582
+ break;
583
+ case ZodIssueCode.too_small:
584
+ if (issue.type === "array")
585
+ message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
586
+ else if (issue.type === "string")
587
+ message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
588
+ else if (issue.type === "number")
589
+ message = `Number must be ${issue.exact
590
+ ? `exactly equal to `
591
+ : issue.inclusive
592
+ ? `greater than or equal to `
593
+ : `greater than `}${issue.minimum}`;
594
+ else if (issue.type === "date")
595
+ message = `Date must be ${issue.exact
596
+ ? `exactly equal to `
597
+ : issue.inclusive
598
+ ? `greater than or equal to `
599
+ : `greater than `}${new Date(Number(issue.minimum))}`;
600
+ else
601
+ message = "Invalid input";
602
+ break;
603
+ case ZodIssueCode.too_big:
604
+ if (issue.type === "array")
605
+ message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
606
+ else if (issue.type === "string")
607
+ message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
608
+ else if (issue.type === "number")
609
+ message = `Number must be ${issue.exact
610
+ ? `exactly`
611
+ : issue.inclusive
612
+ ? `less than or equal to`
613
+ : `less than`} ${issue.maximum}`;
614
+ else if (issue.type === "bigint")
615
+ message = `BigInt must be ${issue.exact
616
+ ? `exactly`
617
+ : issue.inclusive
618
+ ? `less than or equal to`
619
+ : `less than`} ${issue.maximum}`;
620
+ else if (issue.type === "date")
621
+ message = `Date must be ${issue.exact
622
+ ? `exactly`
623
+ : issue.inclusive
624
+ ? `smaller than or equal to`
625
+ : `smaller than`} ${new Date(Number(issue.maximum))}`;
626
+ else
627
+ message = "Invalid input";
628
+ break;
629
+ case ZodIssueCode.custom:
630
+ message = `Invalid input`;
631
+ break;
632
+ case ZodIssueCode.invalid_intersection_types:
633
+ message = `Intersection results could not be merged`;
634
+ break;
635
+ case ZodIssueCode.not_multiple_of:
636
+ message = `Number must be a multiple of ${issue.multipleOf}`;
637
+ break;
638
+ case ZodIssueCode.not_finite:
639
+ message = "Number must be finite";
640
+ break;
641
+ default:
642
+ message = _ctx.defaultError;
643
+ util.assertNever(issue);
644
+ }
645
+ return { message };
646
+ };
647
+
648
+ let overrideErrorMap = errorMap;
649
+ function setErrorMap(map) {
650
+ overrideErrorMap = map;
651
+ }
652
+ function getErrorMap() {
653
+ return overrideErrorMap;
654
+ }
655
+
656
+ const makeIssue = (params) => {
657
+ const { data, path, errorMaps, issueData } = params;
658
+ const fullPath = [...path, ...(issueData.path || [])];
659
+ const fullIssue = {
660
+ ...issueData,
661
+ path: fullPath,
662
+ };
663
+ let errorMessage = "";
664
+ const maps = errorMaps
665
+ .filter((m) => !!m)
666
+ .slice()
667
+ .reverse();
668
+ for (const map of maps) {
669
+ errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
670
+ }
671
+ return {
672
+ ...issueData,
673
+ path: fullPath,
674
+ message: issueData.message || errorMessage,
675
+ };
676
+ };
677
+ const EMPTY_PATH = [];
678
+ function addIssueToContext(ctx, issueData) {
679
+ const issue = makeIssue({
680
+ issueData: issueData,
681
+ data: ctx.data,
682
+ path: ctx.path,
683
+ errorMaps: [
684
+ ctx.common.contextualErrorMap,
685
+ ctx.schemaErrorMap,
686
+ getErrorMap(),
687
+ errorMap, // then global default map
688
+ ].filter((x) => !!x),
689
+ });
690
+ ctx.common.issues.push(issue);
691
+ }
692
+ class ParseStatus {
693
+ constructor() {
694
+ this.value = "valid";
695
+ }
696
+ dirty() {
697
+ if (this.value === "valid")
698
+ this.value = "dirty";
699
+ }
700
+ abort() {
701
+ if (this.value !== "aborted")
702
+ this.value = "aborted";
703
+ }
704
+ static mergeArray(status, results) {
705
+ const arrayValue = [];
706
+ for (const s of results) {
707
+ if (s.status === "aborted")
708
+ return INVALID;
709
+ if (s.status === "dirty")
710
+ status.dirty();
711
+ arrayValue.push(s.value);
712
+ }
713
+ return { status: status.value, value: arrayValue };
714
+ }
715
+ static async mergeObjectAsync(status, pairs) {
716
+ const syncPairs = [];
717
+ for (const pair of pairs) {
718
+ syncPairs.push({
719
+ key: await pair.key,
720
+ value: await pair.value,
721
+ });
722
+ }
723
+ return ParseStatus.mergeObjectSync(status, syncPairs);
724
+ }
725
+ static mergeObjectSync(status, pairs) {
726
+ const finalObject = {};
727
+ for (const pair of pairs) {
728
+ const { key, value } = pair;
729
+ if (key.status === "aborted")
730
+ return INVALID;
731
+ if (value.status === "aborted")
732
+ return INVALID;
733
+ if (key.status === "dirty")
734
+ status.dirty();
735
+ if (value.status === "dirty")
736
+ status.dirty();
737
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
738
+ finalObject[key.value] = value.value;
739
+ }
740
+ }
741
+ return { status: status.value, value: finalObject };
742
+ }
743
+ }
744
+ const INVALID = Object.freeze({
745
+ status: "aborted",
746
+ });
747
+ const DIRTY = (value) => ({ status: "dirty", value });
748
+ const OK = (value) => ({ status: "valid", value });
749
+ const isAborted = (x) => x.status === "aborted";
750
+ const isDirty = (x) => x.status === "dirty";
751
+ const isValid = (x) => x.status === "valid";
752
+ const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
753
+
754
+ var errorUtil;
755
+ (function (errorUtil) {
756
+ errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
757
+ errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
758
+ })(errorUtil || (errorUtil = {}));
759
+
760
+ class ParseInputLazyPath {
761
+ constructor(parent, value, path, key) {
762
+ this._cachedPath = [];
763
+ this.parent = parent;
764
+ this.data = value;
765
+ this._path = path;
766
+ this._key = key;
767
+ }
768
+ get path() {
769
+ if (!this._cachedPath.length) {
770
+ if (this._key instanceof Array) {
771
+ this._cachedPath.push(...this._path, ...this._key);
772
+ }
773
+ else {
774
+ this._cachedPath.push(...this._path, this._key);
775
+ }
776
+ }
777
+ return this._cachedPath;
778
+ }
779
+ }
780
+ const handleResult = (ctx, result) => {
781
+ if (isValid(result)) {
782
+ return { success: true, data: result.value };
783
+ }
784
+ else {
785
+ if (!ctx.common.issues.length) {
786
+ throw new Error("Validation failed but no issues detected.");
787
+ }
788
+ return {
789
+ success: false,
790
+ get error() {
791
+ if (this._error)
792
+ return this._error;
793
+ const error = new ZodError(ctx.common.issues);
794
+ this._error = error;
795
+ return this._error;
796
+ },
797
+ };
798
+ }
799
+ };
800
+ function processCreateParams(params) {
801
+ if (!params)
802
+ return {};
803
+ const { errorMap, invalid_type_error, required_error, description } = params;
804
+ if (errorMap && (invalid_type_error || required_error)) {
805
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
806
+ }
807
+ if (errorMap)
808
+ return { errorMap: errorMap, description };
809
+ const customMap = (iss, ctx) => {
810
+ if (iss.code !== "invalid_type")
811
+ return { message: ctx.defaultError };
812
+ if (typeof ctx.data === "undefined") {
813
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
814
+ }
815
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
816
+ };
817
+ return { errorMap: customMap, description };
818
+ }
819
+ class ZodType {
820
+ constructor(def) {
821
+ /** Alias of safeParseAsync */
822
+ this.spa = this.safeParseAsync;
823
+ this._def = def;
824
+ this.parse = this.parse.bind(this);
825
+ this.safeParse = this.safeParse.bind(this);
826
+ this.parseAsync = this.parseAsync.bind(this);
827
+ this.safeParseAsync = this.safeParseAsync.bind(this);
828
+ this.spa = this.spa.bind(this);
829
+ this.refine = this.refine.bind(this);
830
+ this.refinement = this.refinement.bind(this);
831
+ this.superRefine = this.superRefine.bind(this);
832
+ this.optional = this.optional.bind(this);
833
+ this.nullable = this.nullable.bind(this);
834
+ this.nullish = this.nullish.bind(this);
835
+ this.array = this.array.bind(this);
836
+ this.promise = this.promise.bind(this);
837
+ this.or = this.or.bind(this);
838
+ this.and = this.and.bind(this);
839
+ this.transform = this.transform.bind(this);
840
+ this.brand = this.brand.bind(this);
841
+ this.default = this.default.bind(this);
842
+ this.catch = this.catch.bind(this);
843
+ this.describe = this.describe.bind(this);
844
+ this.pipe = this.pipe.bind(this);
845
+ this.isNullable = this.isNullable.bind(this);
846
+ this.isOptional = this.isOptional.bind(this);
847
+ }
848
+ get description() {
849
+ return this._def.description;
850
+ }
851
+ _getType(input) {
852
+ return getParsedType(input.data);
853
+ }
854
+ _getOrReturnCtx(input, ctx) {
855
+ return (ctx || {
856
+ common: input.parent.common,
857
+ data: input.data,
858
+ parsedType: getParsedType(input.data),
859
+ schemaErrorMap: this._def.errorMap,
860
+ path: input.path,
861
+ parent: input.parent,
862
+ });
863
+ }
864
+ _processInputParams(input) {
865
+ return {
866
+ status: new ParseStatus(),
867
+ ctx: {
868
+ common: input.parent.common,
869
+ data: input.data,
870
+ parsedType: getParsedType(input.data),
871
+ schemaErrorMap: this._def.errorMap,
872
+ path: input.path,
873
+ parent: input.parent,
874
+ },
875
+ };
876
+ }
877
+ _parseSync(input) {
878
+ const result = this._parse(input);
879
+ if (isAsync(result)) {
880
+ throw new Error("Synchronous parse encountered promise.");
881
+ }
882
+ return result;
883
+ }
884
+ _parseAsync(input) {
885
+ const result = this._parse(input);
886
+ return Promise.resolve(result);
887
+ }
888
+ parse(data, params) {
889
+ const result = this.safeParse(data, params);
890
+ if (result.success)
891
+ return result.data;
892
+ throw result.error;
893
+ }
894
+ safeParse(data, params) {
895
+ var _a;
896
+ const ctx = {
897
+ common: {
898
+ issues: [],
899
+ async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
900
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
901
+ },
902
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
903
+ schemaErrorMap: this._def.errorMap,
904
+ parent: null,
905
+ data,
906
+ parsedType: getParsedType(data),
907
+ };
908
+ const result = this._parseSync({ data, path: ctx.path, parent: ctx });
909
+ return handleResult(ctx, result);
910
+ }
911
+ async parseAsync(data, params) {
912
+ const result = await this.safeParseAsync(data, params);
913
+ if (result.success)
914
+ return result.data;
915
+ throw result.error;
916
+ }
917
+ async safeParseAsync(data, params) {
918
+ const ctx = {
919
+ common: {
920
+ issues: [],
921
+ contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
922
+ async: true,
923
+ },
924
+ path: (params === null || params === void 0 ? void 0 : params.path) || [],
925
+ schemaErrorMap: this._def.errorMap,
926
+ parent: null,
927
+ data,
928
+ parsedType: getParsedType(data),
929
+ };
930
+ const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
931
+ const result = await (isAsync(maybeAsyncResult)
932
+ ? maybeAsyncResult
933
+ : Promise.resolve(maybeAsyncResult));
934
+ return handleResult(ctx, result);
935
+ }
936
+ refine(check, message) {
937
+ const getIssueProperties = (val) => {
938
+ if (typeof message === "string" || typeof message === "undefined") {
939
+ return { message };
940
+ }
941
+ else if (typeof message === "function") {
942
+ return message(val);
943
+ }
944
+ else {
945
+ return message;
946
+ }
947
+ };
948
+ return this._refinement((val, ctx) => {
949
+ const result = check(val);
950
+ const setError = () => ctx.addIssue({
951
+ code: ZodIssueCode.custom,
952
+ ...getIssueProperties(val),
953
+ });
954
+ if (typeof Promise !== "undefined" && result instanceof Promise) {
955
+ return result.then((data) => {
956
+ if (!data) {
957
+ setError();
958
+ return false;
959
+ }
960
+ else {
961
+ return true;
962
+ }
963
+ });
964
+ }
965
+ if (!result) {
966
+ setError();
967
+ return false;
968
+ }
969
+ else {
970
+ return true;
971
+ }
972
+ });
973
+ }
974
+ refinement(check, refinementData) {
975
+ return this._refinement((val, ctx) => {
976
+ if (!check(val)) {
977
+ ctx.addIssue(typeof refinementData === "function"
978
+ ? refinementData(val, ctx)
979
+ : refinementData);
980
+ return false;
981
+ }
982
+ else {
983
+ return true;
984
+ }
985
+ });
986
+ }
987
+ _refinement(refinement) {
988
+ return new ZodEffects({
989
+ schema: this,
990
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
991
+ effect: { type: "refinement", refinement },
992
+ });
993
+ }
994
+ superRefine(refinement) {
995
+ return this._refinement(refinement);
996
+ }
997
+ optional() {
998
+ return ZodOptional.create(this, this._def);
999
+ }
1000
+ nullable() {
1001
+ return ZodNullable.create(this, this._def);
1002
+ }
1003
+ nullish() {
1004
+ return this.nullable().optional();
1005
+ }
1006
+ array() {
1007
+ return ZodArray.create(this, this._def);
1008
+ }
1009
+ promise() {
1010
+ return ZodPromise.create(this, this._def);
1011
+ }
1012
+ or(option) {
1013
+ return ZodUnion.create([this, option], this._def);
1014
+ }
1015
+ and(incoming) {
1016
+ return ZodIntersection.create(this, incoming, this._def);
1017
+ }
1018
+ transform(transform) {
1019
+ return new ZodEffects({
1020
+ ...processCreateParams(this._def),
1021
+ schema: this,
1022
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
1023
+ effect: { type: "transform", transform },
1024
+ });
1025
+ }
1026
+ default(def) {
1027
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
1028
+ return new ZodDefault({
1029
+ ...processCreateParams(this._def),
1030
+ innerType: this,
1031
+ defaultValue: defaultValueFunc,
1032
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
1033
+ });
1034
+ }
1035
+ brand() {
1036
+ return new ZodBranded({
1037
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
1038
+ type: this,
1039
+ ...processCreateParams(this._def),
1040
+ });
1041
+ }
1042
+ catch(def) {
1043
+ const catchValueFunc = typeof def === "function" ? def : () => def;
1044
+ return new ZodCatch({
1045
+ ...processCreateParams(this._def),
1046
+ innerType: this,
1047
+ catchValue: catchValueFunc,
1048
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
1049
+ });
1050
+ }
1051
+ describe(description) {
1052
+ const This = this.constructor;
1053
+ return new This({
1054
+ ...this._def,
1055
+ description,
1056
+ });
1057
+ }
1058
+ pipe(target) {
1059
+ return ZodPipeline.create(this, target);
1060
+ }
1061
+ isOptional() {
1062
+ return this.safeParse(undefined).success;
1063
+ }
1064
+ isNullable() {
1065
+ return this.safeParse(null).success;
1066
+ }
1067
+ }
1068
+ const cuidRegex = /^c[^\s-]{8,}$/i;
1069
+ const cuid2Regex = /^[a-z][a-z0-9]*$/;
1070
+ const ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
1071
+ const uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1072
+ // from https://stackoverflow.com/a/46181/1550155
1073
+ // old version: too slow, didn't support unicode
1074
+ // const emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
1075
+ //old email regex
1076
+ // const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
1077
+ // eslint-disable-next-line
1078
+ const emailRegex = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
1079
+ // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
1080
+ const emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
1081
+ const ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
1082
+ const ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
1083
+ // Adapted from https://stackoverflow.com/a/3143231
1084
+ const datetimeRegex = (args) => {
1085
+ if (args.precision) {
1086
+ if (args.offset) {
1087
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
1088
+ }
1089
+ else {
1090
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1091
+ }
1092
+ }
1093
+ else if (args.precision === 0) {
1094
+ if (args.offset) {
1095
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
1096
+ }
1097
+ else {
1098
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1099
+ }
1100
+ }
1101
+ else {
1102
+ if (args.offset) {
1103
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`);
1104
+ }
1105
+ else {
1106
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1107
+ }
1108
+ }
1109
+ };
1110
+ function isValidIP(ip, version) {
1111
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
1112
+ return true;
1113
+ }
1114
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
1115
+ return true;
1116
+ }
1117
+ return false;
1118
+ }
1119
+ class ZodString extends ZodType {
1120
+ constructor() {
1121
+ super(...arguments);
1122
+ this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1123
+ validation,
1124
+ code: ZodIssueCode.invalid_string,
1125
+ ...errorUtil.errToObj(message),
1126
+ });
1127
+ /**
1128
+ * @deprecated Use z.string().min(1) instead.
1129
+ * @see {@link ZodString.min}
1130
+ */
1131
+ this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1132
+ this.trim = () => new ZodString({
1133
+ ...this._def,
1134
+ checks: [...this._def.checks, { kind: "trim" }],
1135
+ });
1136
+ this.toLowerCase = () => new ZodString({
1137
+ ...this._def,
1138
+ checks: [...this._def.checks, { kind: "toLowerCase" }],
1139
+ });
1140
+ this.toUpperCase = () => new ZodString({
1141
+ ...this._def,
1142
+ checks: [...this._def.checks, { kind: "toUpperCase" }],
1143
+ });
1144
+ }
1145
+ _parse(input) {
1146
+ if (this._def.coerce) {
1147
+ input.data = String(input.data);
1148
+ }
1149
+ const parsedType = this._getType(input);
1150
+ if (parsedType !== ZodParsedType.string) {
1151
+ const ctx = this._getOrReturnCtx(input);
1152
+ addIssueToContext(ctx, {
1153
+ code: ZodIssueCode.invalid_type,
1154
+ expected: ZodParsedType.string,
1155
+ received: ctx.parsedType,
1156
+ }
1157
+ //
1158
+ );
1159
+ return INVALID;
1160
+ }
1161
+ const status = new ParseStatus();
1162
+ let ctx = undefined;
1163
+ for (const check of this._def.checks) {
1164
+ if (check.kind === "min") {
1165
+ if (input.data.length < check.value) {
1166
+ ctx = this._getOrReturnCtx(input, ctx);
1167
+ addIssueToContext(ctx, {
1168
+ code: ZodIssueCode.too_small,
1169
+ minimum: check.value,
1170
+ type: "string",
1171
+ inclusive: true,
1172
+ exact: false,
1173
+ message: check.message,
1174
+ });
1175
+ status.dirty();
1176
+ }
1177
+ }
1178
+ else if (check.kind === "max") {
1179
+ if (input.data.length > check.value) {
1180
+ ctx = this._getOrReturnCtx(input, ctx);
1181
+ addIssueToContext(ctx, {
1182
+ code: ZodIssueCode.too_big,
1183
+ maximum: check.value,
1184
+ type: "string",
1185
+ inclusive: true,
1186
+ exact: false,
1187
+ message: check.message,
1188
+ });
1189
+ status.dirty();
1190
+ }
1191
+ }
1192
+ else if (check.kind === "length") {
1193
+ const tooBig = input.data.length > check.value;
1194
+ const tooSmall = input.data.length < check.value;
1195
+ if (tooBig || tooSmall) {
1196
+ ctx = this._getOrReturnCtx(input, ctx);
1197
+ if (tooBig) {
1198
+ addIssueToContext(ctx, {
1199
+ code: ZodIssueCode.too_big,
1200
+ maximum: check.value,
1201
+ type: "string",
1202
+ inclusive: true,
1203
+ exact: true,
1204
+ message: check.message,
1205
+ });
1206
+ }
1207
+ else if (tooSmall) {
1208
+ addIssueToContext(ctx, {
1209
+ code: ZodIssueCode.too_small,
1210
+ minimum: check.value,
1211
+ type: "string",
1212
+ inclusive: true,
1213
+ exact: true,
1214
+ message: check.message,
1215
+ });
1216
+ }
1217
+ status.dirty();
1218
+ }
1219
+ }
1220
+ else if (check.kind === "email") {
1221
+ if (!emailRegex.test(input.data)) {
1222
+ ctx = this._getOrReturnCtx(input, ctx);
1223
+ addIssueToContext(ctx, {
1224
+ validation: "email",
1225
+ code: ZodIssueCode.invalid_string,
1226
+ message: check.message,
1227
+ });
1228
+ status.dirty();
1229
+ }
1230
+ }
1231
+ else if (check.kind === "emoji") {
1232
+ if (!emojiRegex.test(input.data)) {
1233
+ ctx = this._getOrReturnCtx(input, ctx);
1234
+ addIssueToContext(ctx, {
1235
+ validation: "emoji",
1236
+ code: ZodIssueCode.invalid_string,
1237
+ message: check.message,
1238
+ });
1239
+ status.dirty();
1240
+ }
1241
+ }
1242
+ else if (check.kind === "uuid") {
1243
+ if (!uuidRegex.test(input.data)) {
1244
+ ctx = this._getOrReturnCtx(input, ctx);
1245
+ addIssueToContext(ctx, {
1246
+ validation: "uuid",
1247
+ code: ZodIssueCode.invalid_string,
1248
+ message: check.message,
1249
+ });
1250
+ status.dirty();
1251
+ }
1252
+ }
1253
+ else if (check.kind === "cuid") {
1254
+ if (!cuidRegex.test(input.data)) {
1255
+ ctx = this._getOrReturnCtx(input, ctx);
1256
+ addIssueToContext(ctx, {
1257
+ validation: "cuid",
1258
+ code: ZodIssueCode.invalid_string,
1259
+ message: check.message,
1260
+ });
1261
+ status.dirty();
1262
+ }
1263
+ }
1264
+ else if (check.kind === "cuid2") {
1265
+ if (!cuid2Regex.test(input.data)) {
1266
+ ctx = this._getOrReturnCtx(input, ctx);
1267
+ addIssueToContext(ctx, {
1268
+ validation: "cuid2",
1269
+ code: ZodIssueCode.invalid_string,
1270
+ message: check.message,
1271
+ });
1272
+ status.dirty();
1273
+ }
1274
+ }
1275
+ else if (check.kind === "ulid") {
1276
+ if (!ulidRegex.test(input.data)) {
1277
+ ctx = this._getOrReturnCtx(input, ctx);
1278
+ addIssueToContext(ctx, {
1279
+ validation: "ulid",
1280
+ code: ZodIssueCode.invalid_string,
1281
+ message: check.message,
1282
+ });
1283
+ status.dirty();
1284
+ }
1285
+ }
1286
+ else if (check.kind === "url") {
1287
+ try {
1288
+ new URL(input.data);
1289
+ }
1290
+ catch (_a) {
1291
+ ctx = this._getOrReturnCtx(input, ctx);
1292
+ addIssueToContext(ctx, {
1293
+ validation: "url",
1294
+ code: ZodIssueCode.invalid_string,
1295
+ message: check.message,
1296
+ });
1297
+ status.dirty();
1298
+ }
1299
+ }
1300
+ else if (check.kind === "regex") {
1301
+ check.regex.lastIndex = 0;
1302
+ const testResult = check.regex.test(input.data);
1303
+ if (!testResult) {
1304
+ ctx = this._getOrReturnCtx(input, ctx);
1305
+ addIssueToContext(ctx, {
1306
+ validation: "regex",
1307
+ code: ZodIssueCode.invalid_string,
1308
+ message: check.message,
1309
+ });
1310
+ status.dirty();
1311
+ }
1312
+ }
1313
+ else if (check.kind === "trim") {
1314
+ input.data = input.data.trim();
1315
+ }
1316
+ else if (check.kind === "includes") {
1317
+ if (!input.data.includes(check.value, check.position)) {
1318
+ ctx = this._getOrReturnCtx(input, ctx);
1319
+ addIssueToContext(ctx, {
1320
+ code: ZodIssueCode.invalid_string,
1321
+ validation: { includes: check.value, position: check.position },
1322
+ message: check.message,
1323
+ });
1324
+ status.dirty();
1325
+ }
1326
+ }
1327
+ else if (check.kind === "toLowerCase") {
1328
+ input.data = input.data.toLowerCase();
1329
+ }
1330
+ else if (check.kind === "toUpperCase") {
1331
+ input.data = input.data.toUpperCase();
1332
+ }
1333
+ else if (check.kind === "startsWith") {
1334
+ if (!input.data.startsWith(check.value)) {
1335
+ ctx = this._getOrReturnCtx(input, ctx);
1336
+ addIssueToContext(ctx, {
1337
+ code: ZodIssueCode.invalid_string,
1338
+ validation: { startsWith: check.value },
1339
+ message: check.message,
1340
+ });
1341
+ status.dirty();
1342
+ }
1343
+ }
1344
+ else if (check.kind === "endsWith") {
1345
+ if (!input.data.endsWith(check.value)) {
1346
+ ctx = this._getOrReturnCtx(input, ctx);
1347
+ addIssueToContext(ctx, {
1348
+ code: ZodIssueCode.invalid_string,
1349
+ validation: { endsWith: check.value },
1350
+ message: check.message,
1351
+ });
1352
+ status.dirty();
1353
+ }
1354
+ }
1355
+ else if (check.kind === "datetime") {
1356
+ const regex = datetimeRegex(check);
1357
+ if (!regex.test(input.data)) {
1358
+ ctx = this._getOrReturnCtx(input, ctx);
1359
+ addIssueToContext(ctx, {
1360
+ code: ZodIssueCode.invalid_string,
1361
+ validation: "datetime",
1362
+ message: check.message,
1363
+ });
1364
+ status.dirty();
1365
+ }
1366
+ }
1367
+ else if (check.kind === "ip") {
1368
+ if (!isValidIP(input.data, check.version)) {
1369
+ ctx = this._getOrReturnCtx(input, ctx);
1370
+ addIssueToContext(ctx, {
1371
+ validation: "ip",
1372
+ code: ZodIssueCode.invalid_string,
1373
+ message: check.message,
1374
+ });
1375
+ status.dirty();
1376
+ }
1377
+ }
1378
+ else {
1379
+ util.assertNever(check);
1380
+ }
1381
+ }
1382
+ return { status: status.value, value: input.data };
1383
+ }
1384
+ _addCheck(check) {
1385
+ return new ZodString({
1386
+ ...this._def,
1387
+ checks: [...this._def.checks, check],
1388
+ });
1389
+ }
1390
+ email(message) {
1391
+ return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1392
+ }
1393
+ url(message) {
1394
+ return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1395
+ }
1396
+ emoji(message) {
1397
+ return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1398
+ }
1399
+ uuid(message) {
1400
+ return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1401
+ }
1402
+ cuid(message) {
1403
+ return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1404
+ }
1405
+ cuid2(message) {
1406
+ return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1407
+ }
1408
+ ulid(message) {
1409
+ return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1410
+ }
1411
+ ip(options) {
1412
+ return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1413
+ }
1414
+ datetime(options) {
1415
+ var _a;
1416
+ if (typeof options === "string") {
1417
+ return this._addCheck({
1418
+ kind: "datetime",
1419
+ precision: null,
1420
+ offset: false,
1421
+ message: options,
1422
+ });
1423
+ }
1424
+ return this._addCheck({
1425
+ kind: "datetime",
1426
+ precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1427
+ offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1428
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1429
+ });
1430
+ }
1431
+ regex(regex, message) {
1432
+ return this._addCheck({
1433
+ kind: "regex",
1434
+ regex: regex,
1435
+ ...errorUtil.errToObj(message),
1436
+ });
1437
+ }
1438
+ includes(value, options) {
1439
+ return this._addCheck({
1440
+ kind: "includes",
1441
+ value: value,
1442
+ position: options === null || options === void 0 ? void 0 : options.position,
1443
+ ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1444
+ });
1445
+ }
1446
+ startsWith(value, message) {
1447
+ return this._addCheck({
1448
+ kind: "startsWith",
1449
+ value: value,
1450
+ ...errorUtil.errToObj(message),
1451
+ });
1452
+ }
1453
+ endsWith(value, message) {
1454
+ return this._addCheck({
1455
+ kind: "endsWith",
1456
+ value: value,
1457
+ ...errorUtil.errToObj(message),
1458
+ });
1459
+ }
1460
+ min(minLength, message) {
1461
+ return this._addCheck({
1462
+ kind: "min",
1463
+ value: minLength,
1464
+ ...errorUtil.errToObj(message),
1465
+ });
1466
+ }
1467
+ max(maxLength, message) {
1468
+ return this._addCheck({
1469
+ kind: "max",
1470
+ value: maxLength,
1471
+ ...errorUtil.errToObj(message),
1472
+ });
1473
+ }
1474
+ length(len, message) {
1475
+ return this._addCheck({
1476
+ kind: "length",
1477
+ value: len,
1478
+ ...errorUtil.errToObj(message),
1479
+ });
1480
+ }
1481
+ get isDatetime() {
1482
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
1483
+ }
1484
+ get isEmail() {
1485
+ return !!this._def.checks.find((ch) => ch.kind === "email");
1486
+ }
1487
+ get isURL() {
1488
+ return !!this._def.checks.find((ch) => ch.kind === "url");
1489
+ }
1490
+ get isEmoji() {
1491
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1492
+ }
1493
+ get isUUID() {
1494
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
1495
+ }
1496
+ get isCUID() {
1497
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
1498
+ }
1499
+ get isCUID2() {
1500
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1501
+ }
1502
+ get isULID() {
1503
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1504
+ }
1505
+ get isIP() {
1506
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1507
+ }
1508
+ get minLength() {
1509
+ let min = null;
1510
+ for (const ch of this._def.checks) {
1511
+ if (ch.kind === "min") {
1512
+ if (min === null || ch.value > min)
1513
+ min = ch.value;
1514
+ }
1515
+ }
1516
+ return min;
1517
+ }
1518
+ get maxLength() {
1519
+ let max = null;
1520
+ for (const ch of this._def.checks) {
1521
+ if (ch.kind === "max") {
1522
+ if (max === null || ch.value < max)
1523
+ max = ch.value;
1524
+ }
1525
+ }
1526
+ return max;
1527
+ }
1528
+ }
1529
+ ZodString.create = (params) => {
1530
+ var _a;
1531
+ return new ZodString({
1532
+ checks: [],
1533
+ typeName: ZodFirstPartyTypeKind.ZodString,
1534
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1535
+ ...processCreateParams(params),
1536
+ });
1537
+ };
1538
+ // https://stackoverflow.com/questions/3966484/why-does-modulus-operator-return-fractional-number-in-javascript/31711034#31711034
1539
+ function floatSafeRemainder(val, step) {
1540
+ const valDecCount = (val.toString().split(".")[1] || "").length;
1541
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
1542
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1543
+ const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1544
+ const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1545
+ return (valInt % stepInt) / Math.pow(10, decCount);
1546
+ }
1547
+ class ZodNumber extends ZodType {
1548
+ constructor() {
1549
+ super(...arguments);
1550
+ this.min = this.gte;
1551
+ this.max = this.lte;
1552
+ this.step = this.multipleOf;
1553
+ }
1554
+ _parse(input) {
1555
+ if (this._def.coerce) {
1556
+ input.data = Number(input.data);
1557
+ }
1558
+ const parsedType = this._getType(input);
1559
+ if (parsedType !== ZodParsedType.number) {
1560
+ const ctx = this._getOrReturnCtx(input);
1561
+ addIssueToContext(ctx, {
1562
+ code: ZodIssueCode.invalid_type,
1563
+ expected: ZodParsedType.number,
1564
+ received: ctx.parsedType,
1565
+ });
1566
+ return INVALID;
1567
+ }
1568
+ let ctx = undefined;
1569
+ const status = new ParseStatus();
1570
+ for (const check of this._def.checks) {
1571
+ if (check.kind === "int") {
1572
+ if (!util.isInteger(input.data)) {
1573
+ ctx = this._getOrReturnCtx(input, ctx);
1574
+ addIssueToContext(ctx, {
1575
+ code: ZodIssueCode.invalid_type,
1576
+ expected: "integer",
1577
+ received: "float",
1578
+ message: check.message,
1579
+ });
1580
+ status.dirty();
1581
+ }
1582
+ }
1583
+ else if (check.kind === "min") {
1584
+ const tooSmall = check.inclusive
1585
+ ? input.data < check.value
1586
+ : input.data <= check.value;
1587
+ if (tooSmall) {
1588
+ ctx = this._getOrReturnCtx(input, ctx);
1589
+ addIssueToContext(ctx, {
1590
+ code: ZodIssueCode.too_small,
1591
+ minimum: check.value,
1592
+ type: "number",
1593
+ inclusive: check.inclusive,
1594
+ exact: false,
1595
+ message: check.message,
1596
+ });
1597
+ status.dirty();
1598
+ }
1599
+ }
1600
+ else if (check.kind === "max") {
1601
+ const tooBig = check.inclusive
1602
+ ? input.data > check.value
1603
+ : input.data >= check.value;
1604
+ if (tooBig) {
1605
+ ctx = this._getOrReturnCtx(input, ctx);
1606
+ addIssueToContext(ctx, {
1607
+ code: ZodIssueCode.too_big,
1608
+ maximum: check.value,
1609
+ type: "number",
1610
+ inclusive: check.inclusive,
1611
+ exact: false,
1612
+ message: check.message,
1613
+ });
1614
+ status.dirty();
1615
+ }
1616
+ }
1617
+ else if (check.kind === "multipleOf") {
1618
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
1619
+ ctx = this._getOrReturnCtx(input, ctx);
1620
+ addIssueToContext(ctx, {
1621
+ code: ZodIssueCode.not_multiple_of,
1622
+ multipleOf: check.value,
1623
+ message: check.message,
1624
+ });
1625
+ status.dirty();
1626
+ }
1627
+ }
1628
+ else if (check.kind === "finite") {
1629
+ if (!Number.isFinite(input.data)) {
1630
+ ctx = this._getOrReturnCtx(input, ctx);
1631
+ addIssueToContext(ctx, {
1632
+ code: ZodIssueCode.not_finite,
1633
+ message: check.message,
1634
+ });
1635
+ status.dirty();
1636
+ }
1637
+ }
1638
+ else {
1639
+ util.assertNever(check);
1640
+ }
1641
+ }
1642
+ return { status: status.value, value: input.data };
1643
+ }
1644
+ gte(value, message) {
1645
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1646
+ }
1647
+ gt(value, message) {
1648
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1649
+ }
1650
+ lte(value, message) {
1651
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1652
+ }
1653
+ lt(value, message) {
1654
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1655
+ }
1656
+ setLimit(kind, value, inclusive, message) {
1657
+ return new ZodNumber({
1658
+ ...this._def,
1659
+ checks: [
1660
+ ...this._def.checks,
1661
+ {
1662
+ kind,
1663
+ value,
1664
+ inclusive,
1665
+ message: errorUtil.toString(message),
1666
+ },
1667
+ ],
1668
+ });
1669
+ }
1670
+ _addCheck(check) {
1671
+ return new ZodNumber({
1672
+ ...this._def,
1673
+ checks: [...this._def.checks, check],
1674
+ });
1675
+ }
1676
+ int(message) {
1677
+ return this._addCheck({
1678
+ kind: "int",
1679
+ message: errorUtil.toString(message),
1680
+ });
1681
+ }
1682
+ positive(message) {
1683
+ return this._addCheck({
1684
+ kind: "min",
1685
+ value: 0,
1686
+ inclusive: false,
1687
+ message: errorUtil.toString(message),
1688
+ });
1689
+ }
1690
+ negative(message) {
1691
+ return this._addCheck({
1692
+ kind: "max",
1693
+ value: 0,
1694
+ inclusive: false,
1695
+ message: errorUtil.toString(message),
1696
+ });
1697
+ }
1698
+ nonpositive(message) {
1699
+ return this._addCheck({
1700
+ kind: "max",
1701
+ value: 0,
1702
+ inclusive: true,
1703
+ message: errorUtil.toString(message),
1704
+ });
1705
+ }
1706
+ nonnegative(message) {
1707
+ return this._addCheck({
1708
+ kind: "min",
1709
+ value: 0,
1710
+ inclusive: true,
1711
+ message: errorUtil.toString(message),
1712
+ });
1713
+ }
1714
+ multipleOf(value, message) {
1715
+ return this._addCheck({
1716
+ kind: "multipleOf",
1717
+ value: value,
1718
+ message: errorUtil.toString(message),
1719
+ });
1720
+ }
1721
+ finite(message) {
1722
+ return this._addCheck({
1723
+ kind: "finite",
1724
+ message: errorUtil.toString(message),
1725
+ });
1726
+ }
1727
+ safe(message) {
1728
+ return this._addCheck({
1729
+ kind: "min",
1730
+ inclusive: true,
1731
+ value: Number.MIN_SAFE_INTEGER,
1732
+ message: errorUtil.toString(message),
1733
+ })._addCheck({
1734
+ kind: "max",
1735
+ inclusive: true,
1736
+ value: Number.MAX_SAFE_INTEGER,
1737
+ message: errorUtil.toString(message),
1738
+ });
1739
+ }
1740
+ get minValue() {
1741
+ let min = null;
1742
+ for (const ch of this._def.checks) {
1743
+ if (ch.kind === "min") {
1744
+ if (min === null || ch.value > min)
1745
+ min = ch.value;
1746
+ }
1747
+ }
1748
+ return min;
1749
+ }
1750
+ get maxValue() {
1751
+ let max = null;
1752
+ for (const ch of this._def.checks) {
1753
+ if (ch.kind === "max") {
1754
+ if (max === null || ch.value < max)
1755
+ max = ch.value;
1756
+ }
1757
+ }
1758
+ return max;
1759
+ }
1760
+ get isInt() {
1761
+ return !!this._def.checks.find((ch) => ch.kind === "int" ||
1762
+ (ch.kind === "multipleOf" && util.isInteger(ch.value)));
1763
+ }
1764
+ get isFinite() {
1765
+ let max = null, min = null;
1766
+ for (const ch of this._def.checks) {
1767
+ if (ch.kind === "finite" ||
1768
+ ch.kind === "int" ||
1769
+ ch.kind === "multipleOf") {
1770
+ return true;
1771
+ }
1772
+ else if (ch.kind === "min") {
1773
+ if (min === null || ch.value > min)
1774
+ min = ch.value;
1775
+ }
1776
+ else if (ch.kind === "max") {
1777
+ if (max === null || ch.value < max)
1778
+ max = ch.value;
1779
+ }
1780
+ }
1781
+ return Number.isFinite(min) && Number.isFinite(max);
1782
+ }
1783
+ }
1784
+ ZodNumber.create = (params) => {
1785
+ return new ZodNumber({
1786
+ checks: [],
1787
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
1788
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1789
+ ...processCreateParams(params),
1790
+ });
1791
+ };
1792
+ class ZodBigInt extends ZodType {
1793
+ constructor() {
1794
+ super(...arguments);
1795
+ this.min = this.gte;
1796
+ this.max = this.lte;
1797
+ }
1798
+ _parse(input) {
1799
+ if (this._def.coerce) {
1800
+ input.data = BigInt(input.data);
1801
+ }
1802
+ const parsedType = this._getType(input);
1803
+ if (parsedType !== ZodParsedType.bigint) {
1804
+ const ctx = this._getOrReturnCtx(input);
1805
+ addIssueToContext(ctx, {
1806
+ code: ZodIssueCode.invalid_type,
1807
+ expected: ZodParsedType.bigint,
1808
+ received: ctx.parsedType,
1809
+ });
1810
+ return INVALID;
1811
+ }
1812
+ let ctx = undefined;
1813
+ const status = new ParseStatus();
1814
+ for (const check of this._def.checks) {
1815
+ if (check.kind === "min") {
1816
+ const tooSmall = check.inclusive
1817
+ ? input.data < check.value
1818
+ : input.data <= check.value;
1819
+ if (tooSmall) {
1820
+ ctx = this._getOrReturnCtx(input, ctx);
1821
+ addIssueToContext(ctx, {
1822
+ code: ZodIssueCode.too_small,
1823
+ type: "bigint",
1824
+ minimum: check.value,
1825
+ inclusive: check.inclusive,
1826
+ message: check.message,
1827
+ });
1828
+ status.dirty();
1829
+ }
1830
+ }
1831
+ else if (check.kind === "max") {
1832
+ const tooBig = check.inclusive
1833
+ ? input.data > check.value
1834
+ : input.data >= check.value;
1835
+ if (tooBig) {
1836
+ ctx = this._getOrReturnCtx(input, ctx);
1837
+ addIssueToContext(ctx, {
1838
+ code: ZodIssueCode.too_big,
1839
+ type: "bigint",
1840
+ maximum: check.value,
1841
+ inclusive: check.inclusive,
1842
+ message: check.message,
1843
+ });
1844
+ status.dirty();
1845
+ }
1846
+ }
1847
+ else if (check.kind === "multipleOf") {
1848
+ if (input.data % check.value !== BigInt(0)) {
1849
+ ctx = this._getOrReturnCtx(input, ctx);
1850
+ addIssueToContext(ctx, {
1851
+ code: ZodIssueCode.not_multiple_of,
1852
+ multipleOf: check.value,
1853
+ message: check.message,
1854
+ });
1855
+ status.dirty();
1856
+ }
1857
+ }
1858
+ else {
1859
+ util.assertNever(check);
1860
+ }
1861
+ }
1862
+ return { status: status.value, value: input.data };
1863
+ }
1864
+ gte(value, message) {
1865
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1866
+ }
1867
+ gt(value, message) {
1868
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1869
+ }
1870
+ lte(value, message) {
1871
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1872
+ }
1873
+ lt(value, message) {
1874
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1875
+ }
1876
+ setLimit(kind, value, inclusive, message) {
1877
+ return new ZodBigInt({
1878
+ ...this._def,
1879
+ checks: [
1880
+ ...this._def.checks,
1881
+ {
1882
+ kind,
1883
+ value,
1884
+ inclusive,
1885
+ message: errorUtil.toString(message),
1886
+ },
1887
+ ],
1888
+ });
1889
+ }
1890
+ _addCheck(check) {
1891
+ return new ZodBigInt({
1892
+ ...this._def,
1893
+ checks: [...this._def.checks, check],
1894
+ });
1895
+ }
1896
+ positive(message) {
1897
+ return this._addCheck({
1898
+ kind: "min",
1899
+ value: BigInt(0),
1900
+ inclusive: false,
1901
+ message: errorUtil.toString(message),
1902
+ });
1903
+ }
1904
+ negative(message) {
1905
+ return this._addCheck({
1906
+ kind: "max",
1907
+ value: BigInt(0),
1908
+ inclusive: false,
1909
+ message: errorUtil.toString(message),
1910
+ });
1911
+ }
1912
+ nonpositive(message) {
1913
+ return this._addCheck({
1914
+ kind: "max",
1915
+ value: BigInt(0),
1916
+ inclusive: true,
1917
+ message: errorUtil.toString(message),
1918
+ });
1919
+ }
1920
+ nonnegative(message) {
1921
+ return this._addCheck({
1922
+ kind: "min",
1923
+ value: BigInt(0),
1924
+ inclusive: true,
1925
+ message: errorUtil.toString(message),
1926
+ });
1927
+ }
1928
+ multipleOf(value, message) {
1929
+ return this._addCheck({
1930
+ kind: "multipleOf",
1931
+ value,
1932
+ message: errorUtil.toString(message),
1933
+ });
1934
+ }
1935
+ get minValue() {
1936
+ let min = null;
1937
+ for (const ch of this._def.checks) {
1938
+ if (ch.kind === "min") {
1939
+ if (min === null || ch.value > min)
1940
+ min = ch.value;
1941
+ }
1942
+ }
1943
+ return min;
1944
+ }
1945
+ get maxValue() {
1946
+ let max = null;
1947
+ for (const ch of this._def.checks) {
1948
+ if (ch.kind === "max") {
1949
+ if (max === null || ch.value < max)
1950
+ max = ch.value;
1951
+ }
1952
+ }
1953
+ return max;
1954
+ }
1955
+ }
1956
+ ZodBigInt.create = (params) => {
1957
+ var _a;
1958
+ return new ZodBigInt({
1959
+ checks: [],
1960
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
1961
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1962
+ ...processCreateParams(params),
1963
+ });
1964
+ };
1965
+ class ZodBoolean extends ZodType {
1966
+ _parse(input) {
1967
+ if (this._def.coerce) {
1968
+ input.data = Boolean(input.data);
1969
+ }
1970
+ const parsedType = this._getType(input);
1971
+ if (parsedType !== ZodParsedType.boolean) {
1972
+ const ctx = this._getOrReturnCtx(input);
1973
+ addIssueToContext(ctx, {
1974
+ code: ZodIssueCode.invalid_type,
1975
+ expected: ZodParsedType.boolean,
1976
+ received: ctx.parsedType,
1977
+ });
1978
+ return INVALID;
1979
+ }
1980
+ return OK(input.data);
1981
+ }
1982
+ }
1983
+ ZodBoolean.create = (params) => {
1984
+ return new ZodBoolean({
1985
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
1986
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1987
+ ...processCreateParams(params),
1988
+ });
1989
+ };
1990
+ class ZodDate extends ZodType {
1991
+ _parse(input) {
1992
+ if (this._def.coerce) {
1993
+ input.data = new Date(input.data);
1994
+ }
1995
+ const parsedType = this._getType(input);
1996
+ if (parsedType !== ZodParsedType.date) {
1997
+ const ctx = this._getOrReturnCtx(input);
1998
+ addIssueToContext(ctx, {
1999
+ code: ZodIssueCode.invalid_type,
2000
+ expected: ZodParsedType.date,
2001
+ received: ctx.parsedType,
2002
+ });
2003
+ return INVALID;
2004
+ }
2005
+ if (isNaN(input.data.getTime())) {
2006
+ const ctx = this._getOrReturnCtx(input);
2007
+ addIssueToContext(ctx, {
2008
+ code: ZodIssueCode.invalid_date,
2009
+ });
2010
+ return INVALID;
2011
+ }
2012
+ const status = new ParseStatus();
2013
+ let ctx = undefined;
2014
+ for (const check of this._def.checks) {
2015
+ if (check.kind === "min") {
2016
+ if (input.data.getTime() < check.value) {
2017
+ ctx = this._getOrReturnCtx(input, ctx);
2018
+ addIssueToContext(ctx, {
2019
+ code: ZodIssueCode.too_small,
2020
+ message: check.message,
2021
+ inclusive: true,
2022
+ exact: false,
2023
+ minimum: check.value,
2024
+ type: "date",
2025
+ });
2026
+ status.dirty();
2027
+ }
2028
+ }
2029
+ else if (check.kind === "max") {
2030
+ if (input.data.getTime() > check.value) {
2031
+ ctx = this._getOrReturnCtx(input, ctx);
2032
+ addIssueToContext(ctx, {
2033
+ code: ZodIssueCode.too_big,
2034
+ message: check.message,
2035
+ inclusive: true,
2036
+ exact: false,
2037
+ maximum: check.value,
2038
+ type: "date",
2039
+ });
2040
+ status.dirty();
2041
+ }
2042
+ }
2043
+ else {
2044
+ util.assertNever(check);
2045
+ }
2046
+ }
2047
+ return {
2048
+ status: status.value,
2049
+ value: new Date(input.data.getTime()),
2050
+ };
2051
+ }
2052
+ _addCheck(check) {
2053
+ return new ZodDate({
2054
+ ...this._def,
2055
+ checks: [...this._def.checks, check],
2056
+ });
2057
+ }
2058
+ min(minDate, message) {
2059
+ return this._addCheck({
2060
+ kind: "min",
2061
+ value: minDate.getTime(),
2062
+ message: errorUtil.toString(message),
2063
+ });
2064
+ }
2065
+ max(maxDate, message) {
2066
+ return this._addCheck({
2067
+ kind: "max",
2068
+ value: maxDate.getTime(),
2069
+ message: errorUtil.toString(message),
2070
+ });
2071
+ }
2072
+ get minDate() {
2073
+ let min = null;
2074
+ for (const ch of this._def.checks) {
2075
+ if (ch.kind === "min") {
2076
+ if (min === null || ch.value > min)
2077
+ min = ch.value;
2078
+ }
2079
+ }
2080
+ return min != null ? new Date(min) : null;
2081
+ }
2082
+ get maxDate() {
2083
+ let max = null;
2084
+ for (const ch of this._def.checks) {
2085
+ if (ch.kind === "max") {
2086
+ if (max === null || ch.value < max)
2087
+ max = ch.value;
2088
+ }
2089
+ }
2090
+ return max != null ? new Date(max) : null;
2091
+ }
2092
+ }
2093
+ ZodDate.create = (params) => {
2094
+ return new ZodDate({
2095
+ checks: [],
2096
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2097
+ typeName: ZodFirstPartyTypeKind.ZodDate,
2098
+ ...processCreateParams(params),
2099
+ });
2100
+ };
2101
+ class ZodSymbol extends ZodType {
2102
+ _parse(input) {
2103
+ const parsedType = this._getType(input);
2104
+ if (parsedType !== ZodParsedType.symbol) {
2105
+ const ctx = this._getOrReturnCtx(input);
2106
+ addIssueToContext(ctx, {
2107
+ code: ZodIssueCode.invalid_type,
2108
+ expected: ZodParsedType.symbol,
2109
+ received: ctx.parsedType,
2110
+ });
2111
+ return INVALID;
2112
+ }
2113
+ return OK(input.data);
2114
+ }
2115
+ }
2116
+ ZodSymbol.create = (params) => {
2117
+ return new ZodSymbol({
2118
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
2119
+ ...processCreateParams(params),
2120
+ });
2121
+ };
2122
+ class ZodUndefined extends ZodType {
2123
+ _parse(input) {
2124
+ const parsedType = this._getType(input);
2125
+ if (parsedType !== ZodParsedType.undefined) {
2126
+ const ctx = this._getOrReturnCtx(input);
2127
+ addIssueToContext(ctx, {
2128
+ code: ZodIssueCode.invalid_type,
2129
+ expected: ZodParsedType.undefined,
2130
+ received: ctx.parsedType,
2131
+ });
2132
+ return INVALID;
2133
+ }
2134
+ return OK(input.data);
2135
+ }
2136
+ }
2137
+ ZodUndefined.create = (params) => {
2138
+ return new ZodUndefined({
2139
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
2140
+ ...processCreateParams(params),
2141
+ });
2142
+ };
2143
+ class ZodNull extends ZodType {
2144
+ _parse(input) {
2145
+ const parsedType = this._getType(input);
2146
+ if (parsedType !== ZodParsedType.null) {
2147
+ const ctx = this._getOrReturnCtx(input);
2148
+ addIssueToContext(ctx, {
2149
+ code: ZodIssueCode.invalid_type,
2150
+ expected: ZodParsedType.null,
2151
+ received: ctx.parsedType,
2152
+ });
2153
+ return INVALID;
2154
+ }
2155
+ return OK(input.data);
2156
+ }
2157
+ }
2158
+ ZodNull.create = (params) => {
2159
+ return new ZodNull({
2160
+ typeName: ZodFirstPartyTypeKind.ZodNull,
2161
+ ...processCreateParams(params),
2162
+ });
2163
+ };
2164
+ class ZodAny extends ZodType {
2165
+ constructor() {
2166
+ super(...arguments);
2167
+ // to prevent instances of other classes from extending ZodAny. this causes issues with catchall in ZodObject.
2168
+ this._any = true;
2169
+ }
2170
+ _parse(input) {
2171
+ return OK(input.data);
2172
+ }
2173
+ }
2174
+ ZodAny.create = (params) => {
2175
+ return new ZodAny({
2176
+ typeName: ZodFirstPartyTypeKind.ZodAny,
2177
+ ...processCreateParams(params),
2178
+ });
2179
+ };
2180
+ class ZodUnknown extends ZodType {
2181
+ constructor() {
2182
+ super(...arguments);
2183
+ // required
2184
+ this._unknown = true;
2185
+ }
2186
+ _parse(input) {
2187
+ return OK(input.data);
2188
+ }
2189
+ }
2190
+ ZodUnknown.create = (params) => {
2191
+ return new ZodUnknown({
2192
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
2193
+ ...processCreateParams(params),
2194
+ });
2195
+ };
2196
+ class ZodNever extends ZodType {
2197
+ _parse(input) {
2198
+ const ctx = this._getOrReturnCtx(input);
2199
+ addIssueToContext(ctx, {
2200
+ code: ZodIssueCode.invalid_type,
2201
+ expected: ZodParsedType.never,
2202
+ received: ctx.parsedType,
2203
+ });
2204
+ return INVALID;
2205
+ }
2206
+ }
2207
+ ZodNever.create = (params) => {
2208
+ return new ZodNever({
2209
+ typeName: ZodFirstPartyTypeKind.ZodNever,
2210
+ ...processCreateParams(params),
2211
+ });
2212
+ };
2213
+ class ZodVoid extends ZodType {
2214
+ _parse(input) {
2215
+ const parsedType = this._getType(input);
2216
+ if (parsedType !== ZodParsedType.undefined) {
2217
+ const ctx = this._getOrReturnCtx(input);
2218
+ addIssueToContext(ctx, {
2219
+ code: ZodIssueCode.invalid_type,
2220
+ expected: ZodParsedType.void,
2221
+ received: ctx.parsedType,
2222
+ });
2223
+ return INVALID;
2224
+ }
2225
+ return OK(input.data);
2226
+ }
2227
+ }
2228
+ ZodVoid.create = (params) => {
2229
+ return new ZodVoid({
2230
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
2231
+ ...processCreateParams(params),
2232
+ });
2233
+ };
2234
+ class ZodArray extends ZodType {
2235
+ _parse(input) {
2236
+ const { ctx, status } = this._processInputParams(input);
2237
+ const def = this._def;
2238
+ if (ctx.parsedType !== ZodParsedType.array) {
2239
+ addIssueToContext(ctx, {
2240
+ code: ZodIssueCode.invalid_type,
2241
+ expected: ZodParsedType.array,
2242
+ received: ctx.parsedType,
2243
+ });
2244
+ return INVALID;
2245
+ }
2246
+ if (def.exactLength !== null) {
2247
+ const tooBig = ctx.data.length > def.exactLength.value;
2248
+ const tooSmall = ctx.data.length < def.exactLength.value;
2249
+ if (tooBig || tooSmall) {
2250
+ addIssueToContext(ctx, {
2251
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2252
+ minimum: (tooSmall ? def.exactLength.value : undefined),
2253
+ maximum: (tooBig ? def.exactLength.value : undefined),
2254
+ type: "array",
2255
+ inclusive: true,
2256
+ exact: true,
2257
+ message: def.exactLength.message,
2258
+ });
2259
+ status.dirty();
2260
+ }
2261
+ }
2262
+ if (def.minLength !== null) {
2263
+ if (ctx.data.length < def.minLength.value) {
2264
+ addIssueToContext(ctx, {
2265
+ code: ZodIssueCode.too_small,
2266
+ minimum: def.minLength.value,
2267
+ type: "array",
2268
+ inclusive: true,
2269
+ exact: false,
2270
+ message: def.minLength.message,
2271
+ });
2272
+ status.dirty();
2273
+ }
2274
+ }
2275
+ if (def.maxLength !== null) {
2276
+ if (ctx.data.length > def.maxLength.value) {
2277
+ addIssueToContext(ctx, {
2278
+ code: ZodIssueCode.too_big,
2279
+ maximum: def.maxLength.value,
2280
+ type: "array",
2281
+ inclusive: true,
2282
+ exact: false,
2283
+ message: def.maxLength.message,
2284
+ });
2285
+ status.dirty();
2286
+ }
2287
+ }
2288
+ if (ctx.common.async) {
2289
+ return Promise.all([...ctx.data].map((item, i) => {
2290
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2291
+ })).then((result) => {
2292
+ return ParseStatus.mergeArray(status, result);
2293
+ });
2294
+ }
2295
+ const result = [...ctx.data].map((item, i) => {
2296
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2297
+ });
2298
+ return ParseStatus.mergeArray(status, result);
2299
+ }
2300
+ get element() {
2301
+ return this._def.type;
2302
+ }
2303
+ min(minLength, message) {
2304
+ return new ZodArray({
2305
+ ...this._def,
2306
+ minLength: { value: minLength, message: errorUtil.toString(message) },
2307
+ });
2308
+ }
2309
+ max(maxLength, message) {
2310
+ return new ZodArray({
2311
+ ...this._def,
2312
+ maxLength: { value: maxLength, message: errorUtil.toString(message) },
2313
+ });
2314
+ }
2315
+ length(len, message) {
2316
+ return new ZodArray({
2317
+ ...this._def,
2318
+ exactLength: { value: len, message: errorUtil.toString(message) },
2319
+ });
2320
+ }
2321
+ nonempty(message) {
2322
+ return this.min(1, message);
2323
+ }
2324
+ }
2325
+ ZodArray.create = (schema, params) => {
2326
+ return new ZodArray({
2327
+ type: schema,
2328
+ minLength: null,
2329
+ maxLength: null,
2330
+ exactLength: null,
2331
+ typeName: ZodFirstPartyTypeKind.ZodArray,
2332
+ ...processCreateParams(params),
2333
+ });
2334
+ };
2335
+ function deepPartialify(schema) {
2336
+ if (schema instanceof ZodObject) {
2337
+ const newShape = {};
2338
+ for (const key in schema.shape) {
2339
+ const fieldSchema = schema.shape[key];
2340
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2341
+ }
2342
+ return new ZodObject({
2343
+ ...schema._def,
2344
+ shape: () => newShape,
2345
+ });
2346
+ }
2347
+ else if (schema instanceof ZodArray) {
2348
+ return new ZodArray({
2349
+ ...schema._def,
2350
+ type: deepPartialify(schema.element),
2351
+ });
2352
+ }
2353
+ else if (schema instanceof ZodOptional) {
2354
+ return ZodOptional.create(deepPartialify(schema.unwrap()));
2355
+ }
2356
+ else if (schema instanceof ZodNullable) {
2357
+ return ZodNullable.create(deepPartialify(schema.unwrap()));
2358
+ }
2359
+ else if (schema instanceof ZodTuple) {
2360
+ return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2361
+ }
2362
+ else {
2363
+ return schema;
2364
+ }
2365
+ }
2366
+ class ZodObject extends ZodType {
2367
+ constructor() {
2368
+ super(...arguments);
2369
+ this._cached = null;
2370
+ /**
2371
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
2372
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
2373
+ */
2374
+ this.nonstrict = this.passthrough;
2375
+ // extend<
2376
+ // Augmentation extends ZodRawShape,
2377
+ // NewOutput extends util.flatten<{
2378
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2379
+ // ? Augmentation[k]["_output"]
2380
+ // : k extends keyof Output
2381
+ // ? Output[k]
2382
+ // : never;
2383
+ // }>,
2384
+ // NewInput extends util.flatten<{
2385
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2386
+ // ? Augmentation[k]["_input"]
2387
+ // : k extends keyof Input
2388
+ // ? Input[k]
2389
+ // : never;
2390
+ // }>
2391
+ // >(
2392
+ // augmentation: Augmentation
2393
+ // ): ZodObject<
2394
+ // extendShape<T, Augmentation>,
2395
+ // UnknownKeys,
2396
+ // Catchall,
2397
+ // NewOutput,
2398
+ // NewInput
2399
+ // > {
2400
+ // return new ZodObject({
2401
+ // ...this._def,
2402
+ // shape: () => ({
2403
+ // ...this._def.shape(),
2404
+ // ...augmentation,
2405
+ // }),
2406
+ // }) as any;
2407
+ // }
2408
+ /**
2409
+ * @deprecated Use `.extend` instead
2410
+ * */
2411
+ this.augment = this.extend;
2412
+ }
2413
+ _getCached() {
2414
+ if (this._cached !== null)
2415
+ return this._cached;
2416
+ const shape = this._def.shape();
2417
+ const keys = util.objectKeys(shape);
2418
+ return (this._cached = { shape, keys });
2419
+ }
2420
+ _parse(input) {
2421
+ const parsedType = this._getType(input);
2422
+ if (parsedType !== ZodParsedType.object) {
2423
+ const ctx = this._getOrReturnCtx(input);
2424
+ addIssueToContext(ctx, {
2425
+ code: ZodIssueCode.invalid_type,
2426
+ expected: ZodParsedType.object,
2427
+ received: ctx.parsedType,
2428
+ });
2429
+ return INVALID;
2430
+ }
2431
+ const { status, ctx } = this._processInputParams(input);
2432
+ const { shape, keys: shapeKeys } = this._getCached();
2433
+ const extraKeys = [];
2434
+ if (!(this._def.catchall instanceof ZodNever &&
2435
+ this._def.unknownKeys === "strip")) {
2436
+ for (const key in ctx.data) {
2437
+ if (!shapeKeys.includes(key)) {
2438
+ extraKeys.push(key);
2439
+ }
2440
+ }
2441
+ }
2442
+ const pairs = [];
2443
+ for (const key of shapeKeys) {
2444
+ const keyValidator = shape[key];
2445
+ const value = ctx.data[key];
2446
+ pairs.push({
2447
+ key: { status: "valid", value: key },
2448
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2449
+ alwaysSet: key in ctx.data,
2450
+ });
2451
+ }
2452
+ if (this._def.catchall instanceof ZodNever) {
2453
+ const unknownKeys = this._def.unknownKeys;
2454
+ if (unknownKeys === "passthrough") {
2455
+ for (const key of extraKeys) {
2456
+ pairs.push({
2457
+ key: { status: "valid", value: key },
2458
+ value: { status: "valid", value: ctx.data[key] },
2459
+ });
2460
+ }
2461
+ }
2462
+ else if (unknownKeys === "strict") {
2463
+ if (extraKeys.length > 0) {
2464
+ addIssueToContext(ctx, {
2465
+ code: ZodIssueCode.unrecognized_keys,
2466
+ keys: extraKeys,
2467
+ });
2468
+ status.dirty();
2469
+ }
2470
+ }
2471
+ else if (unknownKeys === "strip") ;
2472
+ else {
2473
+ throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2474
+ }
2475
+ }
2476
+ else {
2477
+ // run catchall validation
2478
+ const catchall = this._def.catchall;
2479
+ for (const key of extraKeys) {
2480
+ const value = ctx.data[key];
2481
+ pairs.push({
2482
+ key: { status: "valid", value: key },
2483
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key) //, ctx.child(key), value, getParsedType(value)
2484
+ ),
2485
+ alwaysSet: key in ctx.data,
2486
+ });
2487
+ }
2488
+ }
2489
+ if (ctx.common.async) {
2490
+ return Promise.resolve()
2491
+ .then(async () => {
2492
+ const syncPairs = [];
2493
+ for (const pair of pairs) {
2494
+ const key = await pair.key;
2495
+ syncPairs.push({
2496
+ key,
2497
+ value: await pair.value,
2498
+ alwaysSet: pair.alwaysSet,
2499
+ });
2500
+ }
2501
+ return syncPairs;
2502
+ })
2503
+ .then((syncPairs) => {
2504
+ return ParseStatus.mergeObjectSync(status, syncPairs);
2505
+ });
2506
+ }
2507
+ else {
2508
+ return ParseStatus.mergeObjectSync(status, pairs);
2509
+ }
2510
+ }
2511
+ get shape() {
2512
+ return this._def.shape();
2513
+ }
2514
+ strict(message) {
2515
+ errorUtil.errToObj;
2516
+ return new ZodObject({
2517
+ ...this._def,
2518
+ unknownKeys: "strict",
2519
+ ...(message !== undefined
2520
+ ? {
2521
+ errorMap: (issue, ctx) => {
2522
+ var _a, _b, _c, _d;
2523
+ const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2524
+ if (issue.code === "unrecognized_keys")
2525
+ return {
2526
+ message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
2527
+ };
2528
+ return {
2529
+ message: defaultError,
2530
+ };
2531
+ },
2532
+ }
2533
+ : {}),
2534
+ });
2535
+ }
2536
+ strip() {
2537
+ return new ZodObject({
2538
+ ...this._def,
2539
+ unknownKeys: "strip",
2540
+ });
2541
+ }
2542
+ passthrough() {
2543
+ return new ZodObject({
2544
+ ...this._def,
2545
+ unknownKeys: "passthrough",
2546
+ });
2547
+ }
2548
+ // const AugmentFactory =
2549
+ // <Def extends ZodObjectDef>(def: Def) =>
2550
+ // <Augmentation extends ZodRawShape>(
2551
+ // augmentation: Augmentation
2552
+ // ): ZodObject<
2553
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2554
+ // Def["unknownKeys"],
2555
+ // Def["catchall"]
2556
+ // > => {
2557
+ // return new ZodObject({
2558
+ // ...def,
2559
+ // shape: () => ({
2560
+ // ...def.shape(),
2561
+ // ...augmentation,
2562
+ // }),
2563
+ // }) as any;
2564
+ // };
2565
+ extend(augmentation) {
2566
+ return new ZodObject({
2567
+ ...this._def,
2568
+ shape: () => ({
2569
+ ...this._def.shape(),
2570
+ ...augmentation,
2571
+ }),
2572
+ });
2573
+ }
2574
+ /**
2575
+ * Prior to zod@1.0.12 there was a bug in the
2576
+ * inferred type of merged objects. Please
2577
+ * upgrade if you are experiencing issues.
2578
+ */
2579
+ merge(merging) {
2580
+ const merged = new ZodObject({
2581
+ unknownKeys: merging._def.unknownKeys,
2582
+ catchall: merging._def.catchall,
2583
+ shape: () => ({
2584
+ ...this._def.shape(),
2585
+ ...merging._def.shape(),
2586
+ }),
2587
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2588
+ });
2589
+ return merged;
2590
+ }
2591
+ // merge<
2592
+ // Incoming extends AnyZodObject,
2593
+ // Augmentation extends Incoming["shape"],
2594
+ // NewOutput extends {
2595
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2596
+ // ? Augmentation[k]["_output"]
2597
+ // : k extends keyof Output
2598
+ // ? Output[k]
2599
+ // : never;
2600
+ // },
2601
+ // NewInput extends {
2602
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2603
+ // ? Augmentation[k]["_input"]
2604
+ // : k extends keyof Input
2605
+ // ? Input[k]
2606
+ // : never;
2607
+ // }
2608
+ // >(
2609
+ // merging: Incoming
2610
+ // ): ZodObject<
2611
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2612
+ // Incoming["_def"]["unknownKeys"],
2613
+ // Incoming["_def"]["catchall"],
2614
+ // NewOutput,
2615
+ // NewInput
2616
+ // > {
2617
+ // const merged: any = new ZodObject({
2618
+ // unknownKeys: merging._def.unknownKeys,
2619
+ // catchall: merging._def.catchall,
2620
+ // shape: () =>
2621
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2622
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2623
+ // }) as any;
2624
+ // return merged;
2625
+ // }
2626
+ setKey(key, schema) {
2627
+ return this.augment({ [key]: schema });
2628
+ }
2629
+ // merge<Incoming extends AnyZodObject>(
2630
+ // merging: Incoming
2631
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2632
+ // ZodObject<
2633
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2634
+ // Incoming["_def"]["unknownKeys"],
2635
+ // Incoming["_def"]["catchall"]
2636
+ // > {
2637
+ // // const mergedShape = objectUtil.mergeShapes(
2638
+ // // this._def.shape(),
2639
+ // // merging._def.shape()
2640
+ // // );
2641
+ // const merged: any = new ZodObject({
2642
+ // unknownKeys: merging._def.unknownKeys,
2643
+ // catchall: merging._def.catchall,
2644
+ // shape: () =>
2645
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2646
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
2647
+ // }) as any;
2648
+ // return merged;
2649
+ // }
2650
+ catchall(index) {
2651
+ return new ZodObject({
2652
+ ...this._def,
2653
+ catchall: index,
2654
+ });
2655
+ }
2656
+ pick(mask) {
2657
+ const shape = {};
2658
+ util.objectKeys(mask).forEach((key) => {
2659
+ if (mask[key] && this.shape[key]) {
2660
+ shape[key] = this.shape[key];
2661
+ }
2662
+ });
2663
+ return new ZodObject({
2664
+ ...this._def,
2665
+ shape: () => shape,
2666
+ });
2667
+ }
2668
+ omit(mask) {
2669
+ const shape = {};
2670
+ util.objectKeys(this.shape).forEach((key) => {
2671
+ if (!mask[key]) {
2672
+ shape[key] = this.shape[key];
2673
+ }
2674
+ });
2675
+ return new ZodObject({
2676
+ ...this._def,
2677
+ shape: () => shape,
2678
+ });
2679
+ }
2680
+ /**
2681
+ * @deprecated
2682
+ */
2683
+ deepPartial() {
2684
+ return deepPartialify(this);
2685
+ }
2686
+ partial(mask) {
2687
+ const newShape = {};
2688
+ util.objectKeys(this.shape).forEach((key) => {
2689
+ const fieldSchema = this.shape[key];
2690
+ if (mask && !mask[key]) {
2691
+ newShape[key] = fieldSchema;
2692
+ }
2693
+ else {
2694
+ newShape[key] = fieldSchema.optional();
2695
+ }
2696
+ });
2697
+ return new ZodObject({
2698
+ ...this._def,
2699
+ shape: () => newShape,
2700
+ });
2701
+ }
2702
+ required(mask) {
2703
+ const newShape = {};
2704
+ util.objectKeys(this.shape).forEach((key) => {
2705
+ if (mask && !mask[key]) {
2706
+ newShape[key] = this.shape[key];
2707
+ }
2708
+ else {
2709
+ const fieldSchema = this.shape[key];
2710
+ let newField = fieldSchema;
2711
+ while (newField instanceof ZodOptional) {
2712
+ newField = newField._def.innerType;
2713
+ }
2714
+ newShape[key] = newField;
2715
+ }
2716
+ });
2717
+ return new ZodObject({
2718
+ ...this._def,
2719
+ shape: () => newShape,
2720
+ });
2721
+ }
2722
+ keyof() {
2723
+ return createZodEnum(util.objectKeys(this.shape));
2724
+ }
2725
+ }
2726
+ ZodObject.create = (shape, params) => {
2727
+ return new ZodObject({
2728
+ shape: () => shape,
2729
+ unknownKeys: "strip",
2730
+ catchall: ZodNever.create(),
2731
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2732
+ ...processCreateParams(params),
2733
+ });
2734
+ };
2735
+ ZodObject.strictCreate = (shape, params) => {
2736
+ return new ZodObject({
2737
+ shape: () => shape,
2738
+ unknownKeys: "strict",
2739
+ catchall: ZodNever.create(),
2740
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2741
+ ...processCreateParams(params),
2742
+ });
2743
+ };
2744
+ ZodObject.lazycreate = (shape, params) => {
2745
+ return new ZodObject({
2746
+ shape,
2747
+ unknownKeys: "strip",
2748
+ catchall: ZodNever.create(),
2749
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2750
+ ...processCreateParams(params),
2751
+ });
2752
+ };
2753
+ class ZodUnion extends ZodType {
2754
+ _parse(input) {
2755
+ const { ctx } = this._processInputParams(input);
2756
+ const options = this._def.options;
2757
+ function handleResults(results) {
2758
+ // return first issue-free validation if it exists
2759
+ for (const result of results) {
2760
+ if (result.result.status === "valid") {
2761
+ return result.result;
2762
+ }
2763
+ }
2764
+ for (const result of results) {
2765
+ if (result.result.status === "dirty") {
2766
+ // add issues from dirty option
2767
+ ctx.common.issues.push(...result.ctx.common.issues);
2768
+ return result.result;
2769
+ }
2770
+ }
2771
+ // return invalid
2772
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2773
+ addIssueToContext(ctx, {
2774
+ code: ZodIssueCode.invalid_union,
2775
+ unionErrors,
2776
+ });
2777
+ return INVALID;
2778
+ }
2779
+ if (ctx.common.async) {
2780
+ return Promise.all(options.map(async (option) => {
2781
+ const childCtx = {
2782
+ ...ctx,
2783
+ common: {
2784
+ ...ctx.common,
2785
+ issues: [],
2786
+ },
2787
+ parent: null,
2788
+ };
2789
+ return {
2790
+ result: await option._parseAsync({
2791
+ data: ctx.data,
2792
+ path: ctx.path,
2793
+ parent: childCtx,
2794
+ }),
2795
+ ctx: childCtx,
2796
+ };
2797
+ })).then(handleResults);
2798
+ }
2799
+ else {
2800
+ let dirty = undefined;
2801
+ const issues = [];
2802
+ for (const option of options) {
2803
+ const childCtx = {
2804
+ ...ctx,
2805
+ common: {
2806
+ ...ctx.common,
2807
+ issues: [],
2808
+ },
2809
+ parent: null,
2810
+ };
2811
+ const result = option._parseSync({
2812
+ data: ctx.data,
2813
+ path: ctx.path,
2814
+ parent: childCtx,
2815
+ });
2816
+ if (result.status === "valid") {
2817
+ return result;
2818
+ }
2819
+ else if (result.status === "dirty" && !dirty) {
2820
+ dirty = { result, ctx: childCtx };
2821
+ }
2822
+ if (childCtx.common.issues.length) {
2823
+ issues.push(childCtx.common.issues);
2824
+ }
2825
+ }
2826
+ if (dirty) {
2827
+ ctx.common.issues.push(...dirty.ctx.common.issues);
2828
+ return dirty.result;
2829
+ }
2830
+ const unionErrors = issues.map((issues) => new ZodError(issues));
2831
+ addIssueToContext(ctx, {
2832
+ code: ZodIssueCode.invalid_union,
2833
+ unionErrors,
2834
+ });
2835
+ return INVALID;
2836
+ }
2837
+ }
2838
+ get options() {
2839
+ return this._def.options;
2840
+ }
2841
+ }
2842
+ ZodUnion.create = (types, params) => {
2843
+ return new ZodUnion({
2844
+ options: types,
2845
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
2846
+ ...processCreateParams(params),
2847
+ });
2848
+ };
2849
+ /////////////////////////////////////////////////////
2850
+ /////////////////////////////////////////////////////
2851
+ ////////// //////////
2852
+ ////////// ZodDiscriminatedUnion //////////
2853
+ ////////// //////////
2854
+ /////////////////////////////////////////////////////
2855
+ /////////////////////////////////////////////////////
2856
+ const getDiscriminator = (type) => {
2857
+ if (type instanceof ZodLazy) {
2858
+ return getDiscriminator(type.schema);
2859
+ }
2860
+ else if (type instanceof ZodEffects) {
2861
+ return getDiscriminator(type.innerType());
2862
+ }
2863
+ else if (type instanceof ZodLiteral) {
2864
+ return [type.value];
2865
+ }
2866
+ else if (type instanceof ZodEnum) {
2867
+ return type.options;
2868
+ }
2869
+ else if (type instanceof ZodNativeEnum) {
2870
+ // eslint-disable-next-line ban/ban
2871
+ return Object.keys(type.enum);
2872
+ }
2873
+ else if (type instanceof ZodDefault) {
2874
+ return getDiscriminator(type._def.innerType);
2875
+ }
2876
+ else if (type instanceof ZodUndefined) {
2877
+ return [undefined];
2878
+ }
2879
+ else if (type instanceof ZodNull) {
2880
+ return [null];
2881
+ }
2882
+ else {
2883
+ return null;
2884
+ }
2885
+ };
2886
+ class ZodDiscriminatedUnion extends ZodType {
2887
+ _parse(input) {
2888
+ const { ctx } = this._processInputParams(input);
2889
+ if (ctx.parsedType !== ZodParsedType.object) {
2890
+ addIssueToContext(ctx, {
2891
+ code: ZodIssueCode.invalid_type,
2892
+ expected: ZodParsedType.object,
2893
+ received: ctx.parsedType,
2894
+ });
2895
+ return INVALID;
2896
+ }
2897
+ const discriminator = this.discriminator;
2898
+ const discriminatorValue = ctx.data[discriminator];
2899
+ const option = this.optionsMap.get(discriminatorValue);
2900
+ if (!option) {
2901
+ addIssueToContext(ctx, {
2902
+ code: ZodIssueCode.invalid_union_discriminator,
2903
+ options: Array.from(this.optionsMap.keys()),
2904
+ path: [discriminator],
2905
+ });
2906
+ return INVALID;
2907
+ }
2908
+ if (ctx.common.async) {
2909
+ return option._parseAsync({
2910
+ data: ctx.data,
2911
+ path: ctx.path,
2912
+ parent: ctx,
2913
+ });
2914
+ }
2915
+ else {
2916
+ return option._parseSync({
2917
+ data: ctx.data,
2918
+ path: ctx.path,
2919
+ parent: ctx,
2920
+ });
2921
+ }
2922
+ }
2923
+ get discriminator() {
2924
+ return this._def.discriminator;
2925
+ }
2926
+ get options() {
2927
+ return this._def.options;
2928
+ }
2929
+ get optionsMap() {
2930
+ return this._def.optionsMap;
2931
+ }
2932
+ /**
2933
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2934
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2935
+ * have a different value for each object in the union.
2936
+ * @param discriminator the name of the discriminator property
2937
+ * @param types an array of object schemas
2938
+ * @param params
2939
+ */
2940
+ static create(discriminator, options, params) {
2941
+ // Get all the valid discriminator values
2942
+ const optionsMap = new Map();
2943
+ // try {
2944
+ for (const type of options) {
2945
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2946
+ if (!discriminatorValues) {
2947
+ throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2948
+ }
2949
+ for (const value of discriminatorValues) {
2950
+ if (optionsMap.has(value)) {
2951
+ throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2952
+ }
2953
+ optionsMap.set(value, type);
2954
+ }
2955
+ }
2956
+ return new ZodDiscriminatedUnion({
2957
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2958
+ discriminator,
2959
+ options,
2960
+ optionsMap,
2961
+ ...processCreateParams(params),
2962
+ });
2963
+ }
2964
+ }
2965
+ function mergeValues(a, b) {
2966
+ const aType = getParsedType(a);
2967
+ const bType = getParsedType(b);
2968
+ if (a === b) {
2969
+ return { valid: true, data: a };
2970
+ }
2971
+ else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2972
+ const bKeys = util.objectKeys(b);
2973
+ const sharedKeys = util
2974
+ .objectKeys(a)
2975
+ .filter((key) => bKeys.indexOf(key) !== -1);
2976
+ const newObj = { ...a, ...b };
2977
+ for (const key of sharedKeys) {
2978
+ const sharedValue = mergeValues(a[key], b[key]);
2979
+ if (!sharedValue.valid) {
2980
+ return { valid: false };
2981
+ }
2982
+ newObj[key] = sharedValue.data;
2983
+ }
2984
+ return { valid: true, data: newObj };
2985
+ }
2986
+ else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2987
+ if (a.length !== b.length) {
2988
+ return { valid: false };
2989
+ }
2990
+ const newArray = [];
2991
+ for (let index = 0; index < a.length; index++) {
2992
+ const itemA = a[index];
2993
+ const itemB = b[index];
2994
+ const sharedValue = mergeValues(itemA, itemB);
2995
+ if (!sharedValue.valid) {
2996
+ return { valid: false };
2997
+ }
2998
+ newArray.push(sharedValue.data);
2999
+ }
3000
+ return { valid: true, data: newArray };
3001
+ }
3002
+ else if (aType === ZodParsedType.date &&
3003
+ bType === ZodParsedType.date &&
3004
+ +a === +b) {
3005
+ return { valid: true, data: a };
3006
+ }
3007
+ else {
3008
+ return { valid: false };
3009
+ }
3010
+ }
3011
+ class ZodIntersection extends ZodType {
3012
+ _parse(input) {
3013
+ const { status, ctx } = this._processInputParams(input);
3014
+ const handleParsed = (parsedLeft, parsedRight) => {
3015
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) {
3016
+ return INVALID;
3017
+ }
3018
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
3019
+ if (!merged.valid) {
3020
+ addIssueToContext(ctx, {
3021
+ code: ZodIssueCode.invalid_intersection_types,
3022
+ });
3023
+ return INVALID;
3024
+ }
3025
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) {
3026
+ status.dirty();
3027
+ }
3028
+ return { status: status.value, value: merged.data };
3029
+ };
3030
+ if (ctx.common.async) {
3031
+ return Promise.all([
3032
+ this._def.left._parseAsync({
3033
+ data: ctx.data,
3034
+ path: ctx.path,
3035
+ parent: ctx,
3036
+ }),
3037
+ this._def.right._parseAsync({
3038
+ data: ctx.data,
3039
+ path: ctx.path,
3040
+ parent: ctx,
3041
+ }),
3042
+ ]).then(([left, right]) => handleParsed(left, right));
3043
+ }
3044
+ else {
3045
+ return handleParsed(this._def.left._parseSync({
3046
+ data: ctx.data,
3047
+ path: ctx.path,
3048
+ parent: ctx,
3049
+ }), this._def.right._parseSync({
3050
+ data: ctx.data,
3051
+ path: ctx.path,
3052
+ parent: ctx,
3053
+ }));
3054
+ }
3055
+ }
3056
+ }
3057
+ ZodIntersection.create = (left, right, params) => {
3058
+ return new ZodIntersection({
3059
+ left: left,
3060
+ right: right,
3061
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
3062
+ ...processCreateParams(params),
3063
+ });
3064
+ };
3065
+ class ZodTuple extends ZodType {
3066
+ _parse(input) {
3067
+ const { status, ctx } = this._processInputParams(input);
3068
+ if (ctx.parsedType !== ZodParsedType.array) {
3069
+ addIssueToContext(ctx, {
3070
+ code: ZodIssueCode.invalid_type,
3071
+ expected: ZodParsedType.array,
3072
+ received: ctx.parsedType,
3073
+ });
3074
+ return INVALID;
3075
+ }
3076
+ if (ctx.data.length < this._def.items.length) {
3077
+ addIssueToContext(ctx, {
3078
+ code: ZodIssueCode.too_small,
3079
+ minimum: this._def.items.length,
3080
+ inclusive: true,
3081
+ exact: false,
3082
+ type: "array",
3083
+ });
3084
+ return INVALID;
3085
+ }
3086
+ const rest = this._def.rest;
3087
+ if (!rest && ctx.data.length > this._def.items.length) {
3088
+ addIssueToContext(ctx, {
3089
+ code: ZodIssueCode.too_big,
3090
+ maximum: this._def.items.length,
3091
+ inclusive: true,
3092
+ exact: false,
3093
+ type: "array",
3094
+ });
3095
+ status.dirty();
3096
+ }
3097
+ const items = [...ctx.data]
3098
+ .map((item, itemIndex) => {
3099
+ const schema = this._def.items[itemIndex] || this._def.rest;
3100
+ if (!schema)
3101
+ return null;
3102
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
3103
+ })
3104
+ .filter((x) => !!x); // filter nulls
3105
+ if (ctx.common.async) {
3106
+ return Promise.all(items).then((results) => {
3107
+ return ParseStatus.mergeArray(status, results);
3108
+ });
3109
+ }
3110
+ else {
3111
+ return ParseStatus.mergeArray(status, items);
3112
+ }
3113
+ }
3114
+ get items() {
3115
+ return this._def.items;
3116
+ }
3117
+ rest(rest) {
3118
+ return new ZodTuple({
3119
+ ...this._def,
3120
+ rest,
3121
+ });
3122
+ }
3123
+ }
3124
+ ZodTuple.create = (schemas, params) => {
3125
+ if (!Array.isArray(schemas)) {
3126
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
3127
+ }
3128
+ return new ZodTuple({
3129
+ items: schemas,
3130
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
3131
+ rest: null,
3132
+ ...processCreateParams(params),
3133
+ });
3134
+ };
3135
+ class ZodRecord extends ZodType {
3136
+ get keySchema() {
3137
+ return this._def.keyType;
3138
+ }
3139
+ get valueSchema() {
3140
+ return this._def.valueType;
3141
+ }
3142
+ _parse(input) {
3143
+ const { status, ctx } = this._processInputParams(input);
3144
+ if (ctx.parsedType !== ZodParsedType.object) {
3145
+ addIssueToContext(ctx, {
3146
+ code: ZodIssueCode.invalid_type,
3147
+ expected: ZodParsedType.object,
3148
+ received: ctx.parsedType,
3149
+ });
3150
+ return INVALID;
3151
+ }
3152
+ const pairs = [];
3153
+ const keyType = this._def.keyType;
3154
+ const valueType = this._def.valueType;
3155
+ for (const key in ctx.data) {
3156
+ pairs.push({
3157
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3158
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3159
+ });
3160
+ }
3161
+ if (ctx.common.async) {
3162
+ return ParseStatus.mergeObjectAsync(status, pairs);
3163
+ }
3164
+ else {
3165
+ return ParseStatus.mergeObjectSync(status, pairs);
3166
+ }
3167
+ }
3168
+ get element() {
3169
+ return this._def.valueType;
3170
+ }
3171
+ static create(first, second, third) {
3172
+ if (second instanceof ZodType) {
3173
+ return new ZodRecord({
3174
+ keyType: first,
3175
+ valueType: second,
3176
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
3177
+ ...processCreateParams(third),
3178
+ });
3179
+ }
3180
+ return new ZodRecord({
3181
+ keyType: ZodString.create(),
3182
+ valueType: first,
3183
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
3184
+ ...processCreateParams(second),
3185
+ });
3186
+ }
3187
+ }
3188
+ class ZodMap extends ZodType {
3189
+ _parse(input) {
3190
+ const { status, ctx } = this._processInputParams(input);
3191
+ if (ctx.parsedType !== ZodParsedType.map) {
3192
+ addIssueToContext(ctx, {
3193
+ code: ZodIssueCode.invalid_type,
3194
+ expected: ZodParsedType.map,
3195
+ received: ctx.parsedType,
3196
+ });
3197
+ return INVALID;
3198
+ }
3199
+ const keyType = this._def.keyType;
3200
+ const valueType = this._def.valueType;
3201
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
3202
+ return {
3203
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
3204
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"])),
3205
+ };
3206
+ });
3207
+ if (ctx.common.async) {
3208
+ const finalMap = new Map();
3209
+ return Promise.resolve().then(async () => {
3210
+ for (const pair of pairs) {
3211
+ const key = await pair.key;
3212
+ const value = await pair.value;
3213
+ if (key.status === "aborted" || value.status === "aborted") {
3214
+ return INVALID;
3215
+ }
3216
+ if (key.status === "dirty" || value.status === "dirty") {
3217
+ status.dirty();
3218
+ }
3219
+ finalMap.set(key.value, value.value);
3220
+ }
3221
+ return { status: status.value, value: finalMap };
3222
+ });
3223
+ }
3224
+ else {
3225
+ const finalMap = new Map();
3226
+ for (const pair of pairs) {
3227
+ const key = pair.key;
3228
+ const value = pair.value;
3229
+ if (key.status === "aborted" || value.status === "aborted") {
3230
+ return INVALID;
3231
+ }
3232
+ if (key.status === "dirty" || value.status === "dirty") {
3233
+ status.dirty();
3234
+ }
3235
+ finalMap.set(key.value, value.value);
3236
+ }
3237
+ return { status: status.value, value: finalMap };
3238
+ }
3239
+ }
3240
+ }
3241
+ ZodMap.create = (keyType, valueType, params) => {
3242
+ return new ZodMap({
3243
+ valueType,
3244
+ keyType,
3245
+ typeName: ZodFirstPartyTypeKind.ZodMap,
3246
+ ...processCreateParams(params),
3247
+ });
3248
+ };
3249
+ class ZodSet extends ZodType {
3250
+ _parse(input) {
3251
+ const { status, ctx } = this._processInputParams(input);
3252
+ if (ctx.parsedType !== ZodParsedType.set) {
3253
+ addIssueToContext(ctx, {
3254
+ code: ZodIssueCode.invalid_type,
3255
+ expected: ZodParsedType.set,
3256
+ received: ctx.parsedType,
3257
+ });
3258
+ return INVALID;
3259
+ }
3260
+ const def = this._def;
3261
+ if (def.minSize !== null) {
3262
+ if (ctx.data.size < def.minSize.value) {
3263
+ addIssueToContext(ctx, {
3264
+ code: ZodIssueCode.too_small,
3265
+ minimum: def.minSize.value,
3266
+ type: "set",
3267
+ inclusive: true,
3268
+ exact: false,
3269
+ message: def.minSize.message,
3270
+ });
3271
+ status.dirty();
3272
+ }
3273
+ }
3274
+ if (def.maxSize !== null) {
3275
+ if (ctx.data.size > def.maxSize.value) {
3276
+ addIssueToContext(ctx, {
3277
+ code: ZodIssueCode.too_big,
3278
+ maximum: def.maxSize.value,
3279
+ type: "set",
3280
+ inclusive: true,
3281
+ exact: false,
3282
+ message: def.maxSize.message,
3283
+ });
3284
+ status.dirty();
3285
+ }
3286
+ }
3287
+ const valueType = this._def.valueType;
3288
+ function finalizeSet(elements) {
3289
+ const parsedSet = new Set();
3290
+ for (const element of elements) {
3291
+ if (element.status === "aborted")
3292
+ return INVALID;
3293
+ if (element.status === "dirty")
3294
+ status.dirty();
3295
+ parsedSet.add(element.value);
3296
+ }
3297
+ return { status: status.value, value: parsedSet };
3298
+ }
3299
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
3300
+ if (ctx.common.async) {
3301
+ return Promise.all(elements).then((elements) => finalizeSet(elements));
3302
+ }
3303
+ else {
3304
+ return finalizeSet(elements);
3305
+ }
3306
+ }
3307
+ min(minSize, message) {
3308
+ return new ZodSet({
3309
+ ...this._def,
3310
+ minSize: { value: minSize, message: errorUtil.toString(message) },
3311
+ });
3312
+ }
3313
+ max(maxSize, message) {
3314
+ return new ZodSet({
3315
+ ...this._def,
3316
+ maxSize: { value: maxSize, message: errorUtil.toString(message) },
3317
+ });
3318
+ }
3319
+ size(size, message) {
3320
+ return this.min(size, message).max(size, message);
3321
+ }
3322
+ nonempty(message) {
3323
+ return this.min(1, message);
3324
+ }
3325
+ }
3326
+ ZodSet.create = (valueType, params) => {
3327
+ return new ZodSet({
3328
+ valueType,
3329
+ minSize: null,
3330
+ maxSize: null,
3331
+ typeName: ZodFirstPartyTypeKind.ZodSet,
3332
+ ...processCreateParams(params),
3333
+ });
3334
+ };
3335
+ class ZodFunction extends ZodType {
3336
+ constructor() {
3337
+ super(...arguments);
3338
+ this.validate = this.implement;
3339
+ }
3340
+ _parse(input) {
3341
+ const { ctx } = this._processInputParams(input);
3342
+ if (ctx.parsedType !== ZodParsedType.function) {
3343
+ addIssueToContext(ctx, {
3344
+ code: ZodIssueCode.invalid_type,
3345
+ expected: ZodParsedType.function,
3346
+ received: ctx.parsedType,
3347
+ });
3348
+ return INVALID;
3349
+ }
3350
+ function makeArgsIssue(args, error) {
3351
+ return makeIssue({
3352
+ data: args,
3353
+ path: ctx.path,
3354
+ errorMaps: [
3355
+ ctx.common.contextualErrorMap,
3356
+ ctx.schemaErrorMap,
3357
+ getErrorMap(),
3358
+ errorMap,
3359
+ ].filter((x) => !!x),
3360
+ issueData: {
3361
+ code: ZodIssueCode.invalid_arguments,
3362
+ argumentsError: error,
3363
+ },
3364
+ });
3365
+ }
3366
+ function makeReturnsIssue(returns, error) {
3367
+ return makeIssue({
3368
+ data: returns,
3369
+ path: ctx.path,
3370
+ errorMaps: [
3371
+ ctx.common.contextualErrorMap,
3372
+ ctx.schemaErrorMap,
3373
+ getErrorMap(),
3374
+ errorMap,
3375
+ ].filter((x) => !!x),
3376
+ issueData: {
3377
+ code: ZodIssueCode.invalid_return_type,
3378
+ returnTypeError: error,
3379
+ },
3380
+ });
3381
+ }
3382
+ const params = { errorMap: ctx.common.contextualErrorMap };
3383
+ const fn = ctx.data;
3384
+ if (this._def.returns instanceof ZodPromise) {
3385
+ return OK(async (...args) => {
3386
+ const error = new ZodError([]);
3387
+ const parsedArgs = await this._def.args
3388
+ .parseAsync(args, params)
3389
+ .catch((e) => {
3390
+ error.addIssue(makeArgsIssue(args, e));
3391
+ throw error;
3392
+ });
3393
+ const result = await fn(...parsedArgs);
3394
+ const parsedReturns = await this._def.returns._def.type
3395
+ .parseAsync(result, params)
3396
+ .catch((e) => {
3397
+ error.addIssue(makeReturnsIssue(result, e));
3398
+ throw error;
3399
+ });
3400
+ return parsedReturns;
3401
+ });
3402
+ }
3403
+ else {
3404
+ return OK((...args) => {
3405
+ const parsedArgs = this._def.args.safeParse(args, params);
3406
+ if (!parsedArgs.success) {
3407
+ throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3408
+ }
3409
+ const result = fn(...parsedArgs.data);
3410
+ const parsedReturns = this._def.returns.safeParse(result, params);
3411
+ if (!parsedReturns.success) {
3412
+ throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3413
+ }
3414
+ return parsedReturns.data;
3415
+ });
3416
+ }
3417
+ }
3418
+ parameters() {
3419
+ return this._def.args;
3420
+ }
3421
+ returnType() {
3422
+ return this._def.returns;
3423
+ }
3424
+ args(...items) {
3425
+ return new ZodFunction({
3426
+ ...this._def,
3427
+ args: ZodTuple.create(items).rest(ZodUnknown.create()),
3428
+ });
3429
+ }
3430
+ returns(returnType) {
3431
+ return new ZodFunction({
3432
+ ...this._def,
3433
+ returns: returnType,
3434
+ });
3435
+ }
3436
+ implement(func) {
3437
+ const validatedFunc = this.parse(func);
3438
+ return validatedFunc;
3439
+ }
3440
+ strictImplement(func) {
3441
+ const validatedFunc = this.parse(func);
3442
+ return validatedFunc;
3443
+ }
3444
+ static create(args, returns, params) {
3445
+ return new ZodFunction({
3446
+ args: (args
3447
+ ? args
3448
+ : ZodTuple.create([]).rest(ZodUnknown.create())),
3449
+ returns: returns || ZodUnknown.create(),
3450
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
3451
+ ...processCreateParams(params),
3452
+ });
3453
+ }
3454
+ }
3455
+ class ZodLazy extends ZodType {
3456
+ get schema() {
3457
+ return this._def.getter();
3458
+ }
3459
+ _parse(input) {
3460
+ const { ctx } = this._processInputParams(input);
3461
+ const lazySchema = this._def.getter();
3462
+ return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3463
+ }
3464
+ }
3465
+ ZodLazy.create = (getter, params) => {
3466
+ return new ZodLazy({
3467
+ getter: getter,
3468
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
3469
+ ...processCreateParams(params),
3470
+ });
3471
+ };
3472
+ class ZodLiteral extends ZodType {
3473
+ _parse(input) {
3474
+ if (input.data !== this._def.value) {
3475
+ const ctx = this._getOrReturnCtx(input);
3476
+ addIssueToContext(ctx, {
3477
+ received: ctx.data,
3478
+ code: ZodIssueCode.invalid_literal,
3479
+ expected: this._def.value,
3480
+ });
3481
+ return INVALID;
3482
+ }
3483
+ return { status: "valid", value: input.data };
3484
+ }
3485
+ get value() {
3486
+ return this._def.value;
3487
+ }
3488
+ }
3489
+ ZodLiteral.create = (value, params) => {
3490
+ return new ZodLiteral({
3491
+ value: value,
3492
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
3493
+ ...processCreateParams(params),
3494
+ });
3495
+ };
3496
+ function createZodEnum(values, params) {
3497
+ return new ZodEnum({
3498
+ values: values,
3499
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
3500
+ ...processCreateParams(params),
3501
+ });
3502
+ }
3503
+ class ZodEnum extends ZodType {
3504
+ _parse(input) {
3505
+ if (typeof input.data !== "string") {
3506
+ const ctx = this._getOrReturnCtx(input);
3507
+ const expectedValues = this._def.values;
3508
+ addIssueToContext(ctx, {
3509
+ expected: util.joinValues(expectedValues),
3510
+ received: ctx.parsedType,
3511
+ code: ZodIssueCode.invalid_type,
3512
+ });
3513
+ return INVALID;
3514
+ }
3515
+ if (this._def.values.indexOf(input.data) === -1) {
3516
+ const ctx = this._getOrReturnCtx(input);
3517
+ const expectedValues = this._def.values;
3518
+ addIssueToContext(ctx, {
3519
+ received: ctx.data,
3520
+ code: ZodIssueCode.invalid_enum_value,
3521
+ options: expectedValues,
3522
+ });
3523
+ return INVALID;
3524
+ }
3525
+ return OK(input.data);
3526
+ }
3527
+ get options() {
3528
+ return this._def.values;
3529
+ }
3530
+ get enum() {
3531
+ const enumValues = {};
3532
+ for (const val of this._def.values) {
3533
+ enumValues[val] = val;
3534
+ }
3535
+ return enumValues;
3536
+ }
3537
+ get Values() {
3538
+ const enumValues = {};
3539
+ for (const val of this._def.values) {
3540
+ enumValues[val] = val;
3541
+ }
3542
+ return enumValues;
3543
+ }
3544
+ get Enum() {
3545
+ const enumValues = {};
3546
+ for (const val of this._def.values) {
3547
+ enumValues[val] = val;
3548
+ }
3549
+ return enumValues;
3550
+ }
3551
+ extract(values) {
3552
+ return ZodEnum.create(values);
3553
+ }
3554
+ exclude(values) {
3555
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));
3556
+ }
3557
+ }
3558
+ ZodEnum.create = createZodEnum;
3559
+ class ZodNativeEnum extends ZodType {
3560
+ _parse(input) {
3561
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
3562
+ const ctx = this._getOrReturnCtx(input);
3563
+ if (ctx.parsedType !== ZodParsedType.string &&
3564
+ ctx.parsedType !== ZodParsedType.number) {
3565
+ const expectedValues = util.objectValues(nativeEnumValues);
3566
+ addIssueToContext(ctx, {
3567
+ expected: util.joinValues(expectedValues),
3568
+ received: ctx.parsedType,
3569
+ code: ZodIssueCode.invalid_type,
3570
+ });
3571
+ return INVALID;
3572
+ }
3573
+ if (nativeEnumValues.indexOf(input.data) === -1) {
3574
+ const expectedValues = util.objectValues(nativeEnumValues);
3575
+ addIssueToContext(ctx, {
3576
+ received: ctx.data,
3577
+ code: ZodIssueCode.invalid_enum_value,
3578
+ options: expectedValues,
3579
+ });
3580
+ return INVALID;
3581
+ }
3582
+ return OK(input.data);
3583
+ }
3584
+ get enum() {
3585
+ return this._def.values;
3586
+ }
3587
+ }
3588
+ ZodNativeEnum.create = (values, params) => {
3589
+ return new ZodNativeEnum({
3590
+ values: values,
3591
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3592
+ ...processCreateParams(params),
3593
+ });
3594
+ };
3595
+ class ZodPromise extends ZodType {
3596
+ unwrap() {
3597
+ return this._def.type;
3598
+ }
3599
+ _parse(input) {
3600
+ const { ctx } = this._processInputParams(input);
3601
+ if (ctx.parsedType !== ZodParsedType.promise &&
3602
+ ctx.common.async === false) {
3603
+ addIssueToContext(ctx, {
3604
+ code: ZodIssueCode.invalid_type,
3605
+ expected: ZodParsedType.promise,
3606
+ received: ctx.parsedType,
3607
+ });
3608
+ return INVALID;
3609
+ }
3610
+ const promisified = ctx.parsedType === ZodParsedType.promise
3611
+ ? ctx.data
3612
+ : Promise.resolve(ctx.data);
3613
+ return OK(promisified.then((data) => {
3614
+ return this._def.type.parseAsync(data, {
3615
+ path: ctx.path,
3616
+ errorMap: ctx.common.contextualErrorMap,
3617
+ });
3618
+ }));
3619
+ }
3620
+ }
3621
+ ZodPromise.create = (schema, params) => {
3622
+ return new ZodPromise({
3623
+ type: schema,
3624
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
3625
+ ...processCreateParams(params),
3626
+ });
3627
+ };
3628
+ class ZodEffects extends ZodType {
3629
+ innerType() {
3630
+ return this._def.schema;
3631
+ }
3632
+ sourceType() {
3633
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects
3634
+ ? this._def.schema.sourceType()
3635
+ : this._def.schema;
3636
+ }
3637
+ _parse(input) {
3638
+ const { status, ctx } = this._processInputParams(input);
3639
+ const effect = this._def.effect || null;
3640
+ if (effect.type === "preprocess") {
3641
+ const processed = effect.transform(ctx.data);
3642
+ if (ctx.common.async) {
3643
+ return Promise.resolve(processed).then((processed) => {
3644
+ return this._def.schema._parseAsync({
3645
+ data: processed,
3646
+ path: ctx.path,
3647
+ parent: ctx,
3648
+ });
3649
+ });
3650
+ }
3651
+ else {
3652
+ return this._def.schema._parseSync({
3653
+ data: processed,
3654
+ path: ctx.path,
3655
+ parent: ctx,
3656
+ });
3657
+ }
3658
+ }
3659
+ const checkCtx = {
3660
+ addIssue: (arg) => {
3661
+ addIssueToContext(ctx, arg);
3662
+ if (arg.fatal) {
3663
+ status.abort();
3664
+ }
3665
+ else {
3666
+ status.dirty();
3667
+ }
3668
+ },
3669
+ get path() {
3670
+ return ctx.path;
3671
+ },
3672
+ };
3673
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3674
+ if (effect.type === "refinement") {
3675
+ const executeRefinement = (acc
3676
+ // effect: RefinementEffect<any>
3677
+ ) => {
3678
+ const result = effect.refinement(acc, checkCtx);
3679
+ if (ctx.common.async) {
3680
+ return Promise.resolve(result);
3681
+ }
3682
+ if (result instanceof Promise) {
3683
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3684
+ }
3685
+ return acc;
3686
+ };
3687
+ if (ctx.common.async === false) {
3688
+ const inner = this._def.schema._parseSync({
3689
+ data: ctx.data,
3690
+ path: ctx.path,
3691
+ parent: ctx,
3692
+ });
3693
+ if (inner.status === "aborted")
3694
+ return INVALID;
3695
+ if (inner.status === "dirty")
3696
+ status.dirty();
3697
+ // return value is ignored
3698
+ executeRefinement(inner.value);
3699
+ return { status: status.value, value: inner.value };
3700
+ }
3701
+ else {
3702
+ return this._def.schema
3703
+ ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
3704
+ .then((inner) => {
3705
+ if (inner.status === "aborted")
3706
+ return INVALID;
3707
+ if (inner.status === "dirty")
3708
+ status.dirty();
3709
+ return executeRefinement(inner.value).then(() => {
3710
+ return { status: status.value, value: inner.value };
3711
+ });
3712
+ });
3713
+ }
3714
+ }
3715
+ if (effect.type === "transform") {
3716
+ if (ctx.common.async === false) {
3717
+ const base = this._def.schema._parseSync({
3718
+ data: ctx.data,
3719
+ path: ctx.path,
3720
+ parent: ctx,
3721
+ });
3722
+ if (!isValid(base))
3723
+ return base;
3724
+ const result = effect.transform(base.value, checkCtx);
3725
+ if (result instanceof Promise) {
3726
+ throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3727
+ }
3728
+ return { status: status.value, value: result };
3729
+ }
3730
+ else {
3731
+ return this._def.schema
3732
+ ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })
3733
+ .then((base) => {
3734
+ if (!isValid(base))
3735
+ return base;
3736
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3737
+ });
3738
+ }
3739
+ }
3740
+ util.assertNever(effect);
3741
+ }
3742
+ }
3743
+ ZodEffects.create = (schema, effect, params) => {
3744
+ return new ZodEffects({
3745
+ schema,
3746
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3747
+ effect,
3748
+ ...processCreateParams(params),
3749
+ });
3750
+ };
3751
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3752
+ return new ZodEffects({
3753
+ schema,
3754
+ effect: { type: "preprocess", transform: preprocess },
3755
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3756
+ ...processCreateParams(params),
3757
+ });
3758
+ };
3759
+ class ZodOptional extends ZodType {
3760
+ _parse(input) {
3761
+ const parsedType = this._getType(input);
3762
+ if (parsedType === ZodParsedType.undefined) {
3763
+ return OK(undefined);
3764
+ }
3765
+ return this._def.innerType._parse(input);
3766
+ }
3767
+ unwrap() {
3768
+ return this._def.innerType;
3769
+ }
3770
+ }
3771
+ ZodOptional.create = (type, params) => {
3772
+ return new ZodOptional({
3773
+ innerType: type,
3774
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
3775
+ ...processCreateParams(params),
3776
+ });
3777
+ };
3778
+ class ZodNullable extends ZodType {
3779
+ _parse(input) {
3780
+ const parsedType = this._getType(input);
3781
+ if (parsedType === ZodParsedType.null) {
3782
+ return OK(null);
3783
+ }
3784
+ return this._def.innerType._parse(input);
3785
+ }
3786
+ unwrap() {
3787
+ return this._def.innerType;
3788
+ }
3789
+ }
3790
+ ZodNullable.create = (type, params) => {
3791
+ return new ZodNullable({
3792
+ innerType: type,
3793
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
3794
+ ...processCreateParams(params),
3795
+ });
3796
+ };
3797
+ class ZodDefault extends ZodType {
3798
+ _parse(input) {
3799
+ const { ctx } = this._processInputParams(input);
3800
+ let data = ctx.data;
3801
+ if (ctx.parsedType === ZodParsedType.undefined) {
3802
+ data = this._def.defaultValue();
3803
+ }
3804
+ return this._def.innerType._parse({
3805
+ data,
3806
+ path: ctx.path,
3807
+ parent: ctx,
3808
+ });
3809
+ }
3810
+ removeDefault() {
3811
+ return this._def.innerType;
3812
+ }
3813
+ }
3814
+ ZodDefault.create = (type, params) => {
3815
+ return new ZodDefault({
3816
+ innerType: type,
3817
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
3818
+ defaultValue: typeof params.default === "function"
3819
+ ? params.default
3820
+ : () => params.default,
3821
+ ...processCreateParams(params),
3822
+ });
3823
+ };
3824
+ class ZodCatch extends ZodType {
3825
+ _parse(input) {
3826
+ const { ctx } = this._processInputParams(input);
3827
+ // newCtx is used to not collect issues from inner types in ctx
3828
+ const newCtx = {
3829
+ ...ctx,
3830
+ common: {
3831
+ ...ctx.common,
3832
+ issues: [],
3833
+ },
3834
+ };
3835
+ const result = this._def.innerType._parse({
3836
+ data: newCtx.data,
3837
+ path: newCtx.path,
3838
+ parent: {
3839
+ ...newCtx,
3840
+ },
3841
+ });
3842
+ if (isAsync(result)) {
3843
+ return result.then((result) => {
3844
+ return {
3845
+ status: "valid",
3846
+ value: result.status === "valid"
3847
+ ? result.value
3848
+ : this._def.catchValue({
3849
+ get error() {
3850
+ return new ZodError(newCtx.common.issues);
3851
+ },
3852
+ input: newCtx.data,
3853
+ }),
3854
+ };
3855
+ });
3856
+ }
3857
+ else {
3858
+ return {
3859
+ status: "valid",
3860
+ value: result.status === "valid"
3861
+ ? result.value
3862
+ : this._def.catchValue({
3863
+ get error() {
3864
+ return new ZodError(newCtx.common.issues);
3865
+ },
3866
+ input: newCtx.data,
3867
+ }),
3868
+ };
3869
+ }
3870
+ }
3871
+ removeCatch() {
3872
+ return this._def.innerType;
3873
+ }
3874
+ }
3875
+ ZodCatch.create = (type, params) => {
3876
+ return new ZodCatch({
3877
+ innerType: type,
3878
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
3879
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3880
+ ...processCreateParams(params),
3881
+ });
3882
+ };
3883
+ class ZodNaN extends ZodType {
3884
+ _parse(input) {
3885
+ const parsedType = this._getType(input);
3886
+ if (parsedType !== ZodParsedType.nan) {
3887
+ const ctx = this._getOrReturnCtx(input);
3888
+ addIssueToContext(ctx, {
3889
+ code: ZodIssueCode.invalid_type,
3890
+ expected: ZodParsedType.nan,
3891
+ received: ctx.parsedType,
3892
+ });
3893
+ return INVALID;
3894
+ }
3895
+ return { status: "valid", value: input.data };
3896
+ }
3897
+ }
3898
+ ZodNaN.create = (params) => {
3899
+ return new ZodNaN({
3900
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
3901
+ ...processCreateParams(params),
3902
+ });
3903
+ };
3904
+ const BRAND = Symbol("zod_brand");
3905
+ class ZodBranded extends ZodType {
3906
+ _parse(input) {
3907
+ const { ctx } = this._processInputParams(input);
3908
+ const data = ctx.data;
3909
+ return this._def.type._parse({
3910
+ data,
3911
+ path: ctx.path,
3912
+ parent: ctx,
3913
+ });
3914
+ }
3915
+ unwrap() {
3916
+ return this._def.type;
3917
+ }
3918
+ }
3919
+ class ZodPipeline extends ZodType {
3920
+ _parse(input) {
3921
+ const { status, ctx } = this._processInputParams(input);
3922
+ if (ctx.common.async) {
3923
+ const handleAsync = async () => {
3924
+ const inResult = await this._def.in._parseAsync({
3925
+ data: ctx.data,
3926
+ path: ctx.path,
3927
+ parent: ctx,
3928
+ });
3929
+ if (inResult.status === "aborted")
3930
+ return INVALID;
3931
+ if (inResult.status === "dirty") {
3932
+ status.dirty();
3933
+ return DIRTY(inResult.value);
3934
+ }
3935
+ else {
3936
+ return this._def.out._parseAsync({
3937
+ data: inResult.value,
3938
+ path: ctx.path,
3939
+ parent: ctx,
3940
+ });
3941
+ }
3942
+ };
3943
+ return handleAsync();
3944
+ }
3945
+ else {
3946
+ const inResult = this._def.in._parseSync({
3947
+ data: ctx.data,
3948
+ path: ctx.path,
3949
+ parent: ctx,
3950
+ });
3951
+ if (inResult.status === "aborted")
3952
+ return INVALID;
3953
+ if (inResult.status === "dirty") {
3954
+ status.dirty();
3955
+ return {
3956
+ status: "dirty",
3957
+ value: inResult.value,
3958
+ };
3959
+ }
3960
+ else {
3961
+ return this._def.out._parseSync({
3962
+ data: inResult.value,
3963
+ path: ctx.path,
3964
+ parent: ctx,
3965
+ });
3966
+ }
3967
+ }
3968
+ }
3969
+ static create(a, b) {
3970
+ return new ZodPipeline({
3971
+ in: a,
3972
+ out: b,
3973
+ typeName: ZodFirstPartyTypeKind.ZodPipeline,
3974
+ });
3975
+ }
3976
+ }
3977
+ const custom = (check, params = {},
3978
+ /*
3979
+ * @deprecated
3980
+ *
3981
+ * Pass `fatal` into the params object instead:
3982
+ *
3983
+ * ```ts
3984
+ * z.string().custom((val) => val.length > 5, { fatal: false })
3985
+ * ```
3986
+ *
3987
+ */
3988
+ fatal) => {
3989
+ if (check)
3990
+ return ZodAny.create().superRefine((data, ctx) => {
3991
+ var _a, _b;
3992
+ if (!check(data)) {
3993
+ const p = typeof params === "function"
3994
+ ? params(data)
3995
+ : typeof params === "string"
3996
+ ? { message: params }
3997
+ : params;
3998
+ const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;
3999
+ const p2 = typeof p === "string" ? { message: p } : p;
4000
+ ctx.addIssue({ code: "custom", ...p2, fatal: _fatal });
4001
+ }
4002
+ });
4003
+ return ZodAny.create();
4004
+ };
4005
+ const late = {
4006
+ object: ZodObject.lazycreate,
4007
+ };
4008
+ var ZodFirstPartyTypeKind;
4009
+ (function (ZodFirstPartyTypeKind) {
4010
+ ZodFirstPartyTypeKind["ZodString"] = "ZodString";
4011
+ ZodFirstPartyTypeKind["ZodNumber"] = "ZodNumber";
4012
+ ZodFirstPartyTypeKind["ZodNaN"] = "ZodNaN";
4013
+ ZodFirstPartyTypeKind["ZodBigInt"] = "ZodBigInt";
4014
+ ZodFirstPartyTypeKind["ZodBoolean"] = "ZodBoolean";
4015
+ ZodFirstPartyTypeKind["ZodDate"] = "ZodDate";
4016
+ ZodFirstPartyTypeKind["ZodSymbol"] = "ZodSymbol";
4017
+ ZodFirstPartyTypeKind["ZodUndefined"] = "ZodUndefined";
4018
+ ZodFirstPartyTypeKind["ZodNull"] = "ZodNull";
4019
+ ZodFirstPartyTypeKind["ZodAny"] = "ZodAny";
4020
+ ZodFirstPartyTypeKind["ZodUnknown"] = "ZodUnknown";
4021
+ ZodFirstPartyTypeKind["ZodNever"] = "ZodNever";
4022
+ ZodFirstPartyTypeKind["ZodVoid"] = "ZodVoid";
4023
+ ZodFirstPartyTypeKind["ZodArray"] = "ZodArray";
4024
+ ZodFirstPartyTypeKind["ZodObject"] = "ZodObject";
4025
+ ZodFirstPartyTypeKind["ZodUnion"] = "ZodUnion";
4026
+ ZodFirstPartyTypeKind["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
4027
+ ZodFirstPartyTypeKind["ZodIntersection"] = "ZodIntersection";
4028
+ ZodFirstPartyTypeKind["ZodTuple"] = "ZodTuple";
4029
+ ZodFirstPartyTypeKind["ZodRecord"] = "ZodRecord";
4030
+ ZodFirstPartyTypeKind["ZodMap"] = "ZodMap";
4031
+ ZodFirstPartyTypeKind["ZodSet"] = "ZodSet";
4032
+ ZodFirstPartyTypeKind["ZodFunction"] = "ZodFunction";
4033
+ ZodFirstPartyTypeKind["ZodLazy"] = "ZodLazy";
4034
+ ZodFirstPartyTypeKind["ZodLiteral"] = "ZodLiteral";
4035
+ ZodFirstPartyTypeKind["ZodEnum"] = "ZodEnum";
4036
+ ZodFirstPartyTypeKind["ZodEffects"] = "ZodEffects";
4037
+ ZodFirstPartyTypeKind["ZodNativeEnum"] = "ZodNativeEnum";
4038
+ ZodFirstPartyTypeKind["ZodOptional"] = "ZodOptional";
4039
+ ZodFirstPartyTypeKind["ZodNullable"] = "ZodNullable";
4040
+ ZodFirstPartyTypeKind["ZodDefault"] = "ZodDefault";
4041
+ ZodFirstPartyTypeKind["ZodCatch"] = "ZodCatch";
4042
+ ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
4043
+ ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
4044
+ ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
4045
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4046
+ const instanceOfType = (
4047
+ // const instanceOfType = <T extends new (...args: any[]) => any>(
4048
+ cls, params = {
4049
+ message: `Input not instance of ${cls.name}`,
4050
+ }) => custom((data) => data instanceof cls, params);
4051
+ const stringType = ZodString.create;
4052
+ const numberType = ZodNumber.create;
4053
+ const nanType = ZodNaN.create;
4054
+ const bigIntType = ZodBigInt.create;
4055
+ const booleanType = ZodBoolean.create;
4056
+ const dateType = ZodDate.create;
4057
+ const symbolType = ZodSymbol.create;
4058
+ const undefinedType = ZodUndefined.create;
4059
+ const nullType = ZodNull.create;
4060
+ const anyType = ZodAny.create;
4061
+ const unknownType = ZodUnknown.create;
4062
+ const neverType = ZodNever.create;
4063
+ const voidType = ZodVoid.create;
4064
+ const arrayType = ZodArray.create;
4065
+ const objectType = ZodObject.create;
4066
+ const strictObjectType = ZodObject.strictCreate;
4067
+ const unionType = ZodUnion.create;
4068
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
4069
+ const intersectionType = ZodIntersection.create;
4070
+ const tupleType = ZodTuple.create;
4071
+ const recordType = ZodRecord.create;
4072
+ const mapType = ZodMap.create;
4073
+ const setType = ZodSet.create;
4074
+ const functionType = ZodFunction.create;
4075
+ const lazyType = ZodLazy.create;
4076
+ const literalType = ZodLiteral.create;
4077
+ const enumType = ZodEnum.create;
4078
+ const nativeEnumType = ZodNativeEnum.create;
4079
+ const promiseType = ZodPromise.create;
4080
+ const effectsType = ZodEffects.create;
4081
+ const optionalType = ZodOptional.create;
4082
+ const nullableType = ZodNullable.create;
4083
+ const preprocessType = ZodEffects.createWithPreprocess;
4084
+ const pipelineType = ZodPipeline.create;
4085
+ const ostring = () => stringType().optional();
4086
+ const onumber = () => numberType().optional();
4087
+ const oboolean = () => booleanType().optional();
4088
+ const coerce = {
4089
+ string: ((arg) => ZodString.create({ ...arg, coerce: true })),
4090
+ number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),
4091
+ boolean: ((arg) => ZodBoolean.create({
4092
+ ...arg,
4093
+ coerce: true,
4094
+ })),
4095
+ bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),
4096
+ date: ((arg) => ZodDate.create({ ...arg, coerce: true })),
4097
+ };
4098
+ const NEVER = INVALID;
4099
+
4100
+ var z = /*#__PURE__*/Object.freeze({
4101
+ __proto__: null,
4102
+ defaultErrorMap: errorMap,
4103
+ setErrorMap: setErrorMap,
4104
+ getErrorMap: getErrorMap,
4105
+ makeIssue: makeIssue,
4106
+ EMPTY_PATH: EMPTY_PATH,
4107
+ addIssueToContext: addIssueToContext,
4108
+ ParseStatus: ParseStatus,
4109
+ INVALID: INVALID,
4110
+ DIRTY: DIRTY,
4111
+ OK: OK,
4112
+ isAborted: isAborted,
4113
+ isDirty: isDirty,
4114
+ isValid: isValid,
4115
+ isAsync: isAsync,
4116
+ get util () { return util; },
4117
+ get objectUtil () { return objectUtil; },
4118
+ ZodParsedType: ZodParsedType,
4119
+ getParsedType: getParsedType,
4120
+ ZodType: ZodType,
4121
+ ZodString: ZodString,
4122
+ ZodNumber: ZodNumber,
4123
+ ZodBigInt: ZodBigInt,
4124
+ ZodBoolean: ZodBoolean,
4125
+ ZodDate: ZodDate,
4126
+ ZodSymbol: ZodSymbol,
4127
+ ZodUndefined: ZodUndefined,
4128
+ ZodNull: ZodNull,
4129
+ ZodAny: ZodAny,
4130
+ ZodUnknown: ZodUnknown,
4131
+ ZodNever: ZodNever,
4132
+ ZodVoid: ZodVoid,
4133
+ ZodArray: ZodArray,
4134
+ ZodObject: ZodObject,
4135
+ ZodUnion: ZodUnion,
4136
+ ZodDiscriminatedUnion: ZodDiscriminatedUnion,
4137
+ ZodIntersection: ZodIntersection,
4138
+ ZodTuple: ZodTuple,
4139
+ ZodRecord: ZodRecord,
4140
+ ZodMap: ZodMap,
4141
+ ZodSet: ZodSet,
4142
+ ZodFunction: ZodFunction,
4143
+ ZodLazy: ZodLazy,
4144
+ ZodLiteral: ZodLiteral,
4145
+ ZodEnum: ZodEnum,
4146
+ ZodNativeEnum: ZodNativeEnum,
4147
+ ZodPromise: ZodPromise,
4148
+ ZodEffects: ZodEffects,
4149
+ ZodTransformer: ZodEffects,
4150
+ ZodOptional: ZodOptional,
4151
+ ZodNullable: ZodNullable,
4152
+ ZodDefault: ZodDefault,
4153
+ ZodCatch: ZodCatch,
4154
+ ZodNaN: ZodNaN,
4155
+ BRAND: BRAND,
4156
+ ZodBranded: ZodBranded,
4157
+ ZodPipeline: ZodPipeline,
4158
+ custom: custom,
4159
+ Schema: ZodType,
4160
+ ZodSchema: ZodType,
4161
+ late: late,
4162
+ get ZodFirstPartyTypeKind () { return ZodFirstPartyTypeKind; },
4163
+ coerce: coerce,
4164
+ any: anyType,
4165
+ array: arrayType,
4166
+ bigint: bigIntType,
4167
+ boolean: booleanType,
4168
+ date: dateType,
4169
+ discriminatedUnion: discriminatedUnionType,
4170
+ effect: effectsType,
4171
+ 'enum': enumType,
4172
+ 'function': functionType,
4173
+ 'instanceof': instanceOfType,
4174
+ intersection: intersectionType,
4175
+ lazy: lazyType,
4176
+ literal: literalType,
4177
+ map: mapType,
4178
+ nan: nanType,
4179
+ nativeEnum: nativeEnumType,
4180
+ never: neverType,
4181
+ 'null': nullType,
4182
+ nullable: nullableType,
4183
+ number: numberType,
4184
+ object: objectType,
4185
+ oboolean: oboolean,
4186
+ onumber: onumber,
4187
+ optional: optionalType,
4188
+ ostring: ostring,
4189
+ pipeline: pipelineType,
4190
+ preprocess: preprocessType,
4191
+ promise: promiseType,
4192
+ record: recordType,
4193
+ set: setType,
4194
+ strictObject: strictObjectType,
4195
+ string: stringType,
4196
+ symbol: symbolType,
4197
+ transformer: effectsType,
4198
+ tuple: tupleType,
4199
+ 'undefined': undefinedType,
4200
+ union: unionType,
4201
+ unknown: unknownType,
4202
+ 'void': voidType,
4203
+ NEVER: NEVER,
4204
+ ZodIssueCode: ZodIssueCode,
4205
+ quotelessJson: quotelessJson,
4206
+ ZodError: ZodError
4207
+ });
4208
+
4209
+
4210
+
4211
+
4212
+ /***/ })
4213
+
4214
+ };
4215
+ ;