@verdocs/web-sdk 2.3.88 → 4.0.5

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