@piveau/piveau-hub-ui-modules 4.6.52 → 4.6.53

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 (235) hide show
  1. package/dist/PvBadge/PvBadge.vue.mjs.map +1 -1
  2. package/dist/PvDataInfoBox/PvDataInfoBox.vue.mjs +1 -2
  3. package/dist/PvDataInfoBox/PvDataInfoBox.vue.mjs.map +1 -1
  4. package/dist/PvDataInfoBox/PvDataInfoBoxDescription.vue.mjs.map +1 -1
  5. package/dist/PvDataInfoBox/PvDataInfoBoxFooter.vue.mjs.map +1 -1
  6. package/dist/PvDataInfoBox/PvDataInfoBoxFormats.vue.mjs.map +1 -1
  7. package/dist/catalogues/CatalogPage.vue.mjs.map +1 -1
  8. package/dist/catalogues/CatalogPageDatasetCard.vue.mjs +5 -6
  9. package/dist/catalogues/CatalogPageDatasetCard.vue.mjs.map +1 -1
  10. package/dist/catalogues/Catalogues.vue.mjs.map +1 -1
  11. package/dist/catalogues/cataloguesFacets/CataloguesFacets.vue.mjs.map +1 -1
  12. package/dist/citation/DatasetCitationModal.vue.mjs.map +1 -1
  13. package/dist/citation/DatasetCitationTable.vue.mjs.map +1 -1
  14. package/dist/composables/useRuntimeEnv.d.ts +3 -2
  15. package/dist/configurations/config-schema/apiSchema.mjs +1 -1
  16. package/dist/configurations/config-schema/authenticationSchema.mjs +1 -1
  17. package/dist/configurations/config-schema/configSchema.d.ts +10 -5
  18. package/dist/configurations/config-schema/configSchema.mjs +18 -18
  19. package/dist/configurations/config-schema/contentSchema.d.ts +3 -0
  20. package/dist/configurations/config-schema/contentSchema.mjs +7 -6
  21. package/dist/configurations/config-schema/contentSchema.mjs.map +1 -1
  22. package/dist/configurations/config-schema/languagesSchema.d.ts +2 -2
  23. package/dist/configurations/config-schema/languagesSchema.mjs +1 -1
  24. package/dist/configurations/config-schema/metadataSchema.mjs +1 -1
  25. package/dist/configurations/config-schema/routingSchema.mjs +1 -1
  26. package/dist/configurations/config-schema/themesSchema.mjs +1 -1
  27. package/dist/configurations/config-schema/trackerSchema.mjs +1 -1
  28. package/dist/data-provider-interface/CatalogueMQA.vue.mjs.map +1 -1
  29. package/dist/data-provider-interface/DPIMenu.vue.d.ts +10 -10
  30. package/dist/data-provider-interface/DPIMenu.vue.mjs.map +1 -1
  31. package/dist/data-provider-interface/DataProviderInterface.vue.d.ts +19 -15
  32. package/dist/data-provider-interface/DataProviderInterface.vue.mjs.map +1 -1
  33. package/dist/data-provider-interface/components/AutocompleteInput.vue.mjs.map +1 -1
  34. package/dist/data-provider-interface/components/ConditionalInput.vue.mjs.map +1 -1
  35. package/dist/data-provider-interface/components/DataFetchingComponent.vue.d.ts +2 -2
  36. package/dist/data-provider-interface/components/DistributionStepper.vue.mjs +1 -2
  37. package/dist/data-provider-interface/components/DistributionStepper.vue.mjs.map +1 -1
  38. package/dist/data-provider-interface/components/Dropup.vue.d.ts +1 -1
  39. package/dist/data-provider-interface/components/Dropup.vue.mjs.map +1 -1
  40. package/dist/data-provider-interface/components/FileUpload.vue.d.ts +1 -1
  41. package/dist/data-provider-interface/components/FileUpload.vue.mjs.map +1 -1
  42. package/dist/data-provider-interface/components/InfoSlot.vue.mjs.map +1 -1
  43. package/dist/data-provider-interface/components/InputPageStep.vue.mjs.map +1 -1
  44. package/dist/data-provider-interface/components/LanguageSelector.vue.mjs.map +1 -1
  45. package/dist/data-provider-interface/components/Navigation.vue.d.ts +9 -8
  46. package/dist/data-provider-interface/components/Navigation.vue.mjs.map +1 -1
  47. package/dist/data-provider-interface/components/SelectControlledGroup.vue.mjs +1 -2
  48. package/dist/data-provider-interface/components/SelectControlledGroup.vue.mjs.map +1 -1
  49. package/dist/data-provider-interface/components/SimpleAccessURLInput.vue.mjs.map +1 -1
  50. package/dist/data-provider-interface/components/SimpleInput.vue.mjs.map +1 -1
  51. package/dist/data-provider-interface/components/SimpleSelect.vue.mjs.map +1 -1
  52. package/dist/data-provider-interface/components/SpatialInput.vue.mjs.map +1 -1
  53. package/dist/data-provider-interface/components/UniqueIdentifierInput.vue.mjs.map +1 -1
  54. package/dist/data-provider-interface/components/WidgetInput.vue.mjs.map +1 -1
  55. package/dist/data-provider-interface/views/DistributionInputPage.vue.mjs.map +1 -1
  56. package/dist/data-provider-interface/views/DistributionOverview.vue.d.ts +2 -2
  57. package/dist/data-provider-interface/views/DistributionOverview.vue.mjs.map +1 -1
  58. package/dist/data-provider-interface/views/DraftsPage.vue.d.ts +6 -5
  59. package/dist/data-provider-interface/views/DraftsPage.vue.mjs +14 -19
  60. package/dist/data-provider-interface/views/DraftsPage.vue.mjs.map +1 -1
  61. package/dist/data-provider-interface/views/InputPage.vue.d.ts +16 -12
  62. package/dist/data-provider-interface/views/InputPage.vue.mjs +2 -4
  63. package/dist/data-provider-interface/views/InputPage.vue.mjs.map +1 -1
  64. package/dist/data-provider-interface/views/LinkedDataViewer.vue.mjs.map +1 -1
  65. package/dist/data-provider-interface/views/OverviewPage/CatalogueOverview.vue.mjs.map +1 -1
  66. package/dist/data-provider-interface/views/OverviewPage/DatasetOverview.vue.mjs.map +1 -1
  67. package/dist/data-provider-interface/views/OverviewPage/DistributionOverview.vue.mjs.map +1 -1
  68. package/dist/data-provider-interface/views/OverviewPage/Properties/MultilingualProp.vue.mjs.map +1 -1
  69. package/dist/data-provider-interface/views/OverviewPage/Properties/SpecialProp.vue.mjs.map +1 -1
  70. package/dist/data-provider-interface/views/OverviewPage/Properties/StringProp.vue.mjs.map +1 -1
  71. package/dist/data-provider-interface/views/OverviewPage/Properties/URIProp.vue.mjs.map +1 -1
  72. package/dist/data-provider-interface/views/OverviewPage/Properties/URLProp.vue.mjs.map +1 -1
  73. package/dist/data-provider-interface/views/OverviewPage/PropertyEntry.vue.mjs.map +1 -1
  74. package/dist/data-provider-interface/views/OverviewPage.vue.d.ts +6 -3
  75. package/dist/data-provider-interface/views/OverviewPage.vue.mjs.map +1 -1
  76. package/dist/data-provider-interface/views/PropertyChooser.vue.mjs.map +1 -1
  77. package/dist/data-provider-interface/views/UserCataloguesPage.vue.mjs.map +1 -1
  78. package/dist/data-provider-interface/views/UserProfilePage.vue.mjs.map +1 -1
  79. package/dist/datasetDetails/AppMarkdownContent.vue.mjs.map +1 -1
  80. package/dist/datasetDetails/DatasetDetails.vue.mjs.map +1 -1
  81. package/dist/datasetDetails/DatasetDetailsActivityStream.vue.mjs.map +1 -1
  82. package/dist/datasetDetails/DatasetDetailsBanners.vue.d.ts +3 -1
  83. package/dist/datasetDetails/DatasetDetailsBanners.vue.mjs.map +1 -1
  84. package/dist/datasetDetails/DatasetDetailsCSVLinter.vue.mjs.map +1 -1
  85. package/dist/datasetDetails/DatasetDetailsCategories.vue.mjs.map +1 -1
  86. package/dist/datasetDetails/DatasetDetailsDataset.vue.mjs +2 -3
  87. package/dist/datasetDetails/DatasetDetailsDataset.vue.mjs.map +1 -1
  88. package/dist/datasetDetails/DatasetDetailsDataset.vue2.mjs +39 -39
  89. package/dist/datasetDetails/DatasetDetailsDataset.vue2.mjs.map +1 -1
  90. package/dist/datasetDetails/DatasetDetailsDescription.vue.d.ts +3 -1
  91. package/dist/datasetDetails/DatasetDetailsDescription.vue.mjs.map +1 -1
  92. package/dist/datasetDetails/DatasetDetailsFeedbackButton.vue.mjs.map +1 -1
  93. package/dist/datasetDetails/DatasetDetailsLinkedMetricsButton.vue.mjs.map +1 -1
  94. package/dist/datasetDetails/DatasetDetailsQuality.vue.mjs.map +1 -1
  95. package/dist/datasetDetails/DatasetDetailsShareButton.vue.mjs.map +1 -1
  96. package/dist/datasetDetails/DatasetDetailsSimilarDatasets.vue.mjs.map +1 -1
  97. package/dist/datasetDetails/DatasetDetailsSkeleton.vue.mjs.map +1 -1
  98. package/dist/datasetDetails/distributions/Distribution.vue.mjs.map +1 -1
  99. package/dist/datasetDetails/distributions/DistributionAdded.vue.mjs.map +1 -1
  100. package/dist/datasetDetails/distributions/DistributionDownloadAsModal.vue.mjs.map +1 -1
  101. package/dist/datasetDetails/distributions/DistributionFormat.vue.d.ts +2 -2
  102. package/dist/datasetDetails/distributions/DistributionFormat.vue.mjs.map +1 -1
  103. package/dist/datasetDetails/distributions/Distributions.vue.mjs.map +1 -1
  104. package/dist/datasetDetails/distributions/DistributionsHeader.vue.d.ts +4 -4
  105. package/dist/datasetDetails/distributions/DistributionsHeader.vue.mjs.map +1 -1
  106. package/dist/datasetDetails/distributions/DownloadAllDistributions.vue.d.ts +8 -8
  107. package/dist/datasetDetails/distributions/DownloadAllDistributions.vue.mjs +1 -2
  108. package/dist/datasetDetails/distributions/DownloadAllDistributions.vue.mjs.map +1 -1
  109. package/dist/datasetDetails/distributions/FadingDistributionOverlay.vue.mjs +5 -7
  110. package/dist/datasetDetails/distributions/FadingDistributionOverlay.vue.mjs.map +1 -1
  111. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue.mjs +5 -6
  112. package/dist/datasetDetails/distributions/distributionActions/DistributionActions.vue.mjs.map +1 -1
  113. package/dist/datasetDetails/distributions/distributionActions/DistributionDownload.vue.d.ts +2 -2
  114. package/dist/datasetDetails/distributions/distributionActions/DistributionDownload.vue.mjs +12 -15
  115. package/dist/datasetDetails/distributions/distributionActions/DistributionDownload.vue.mjs.map +1 -1
  116. package/dist/datasetDetails/distributions/distributionActions/DistributionDownloadAs.vue.mjs.map +1 -1
  117. package/dist/datasetDetails/distributions/distributionActions/DistributionDropdownDownload.vue.d.ts +2 -2
  118. package/dist/datasetDetails/distributions/distributionActions/DistributionDropdownDownload.vue.mjs.map +1 -1
  119. package/dist/datasetDetails/distributions/distributionActions/DistributionOptionsDropdown.vue.d.ts +4 -4
  120. package/dist/datasetDetails/distributions/distributionActions/DistributionOptionsDropdown.vue.mjs +5 -6
  121. package/dist/datasetDetails/distributions/distributionActions/DistributionOptionsDropdown.vue.mjs.map +1 -1
  122. package/dist/datasetDetails/distributions/distributionActions/DistributionPreview.vue.d.ts +4 -4
  123. package/dist/datasetDetails/distributions/distributionActions/DistributionPreview.vue.mjs.map +1 -1
  124. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue.d.ts +4 -4
  125. package/dist/datasetDetails/distributions/distributionActions/DistributionVisualizeButton.vue.mjs.map +1 -1
  126. package/dist/datasetDetails/distributions/distributionActions/LinkedDataButtonsDropdown.vue.mjs.map +1 -1
  127. package/dist/datasetDetails/distributions/distributionDetails/DistributionContent.vue.mjs +21 -22
  128. package/dist/datasetDetails/distributions/distributionDetails/DistributionContent.vue.mjs.map +1 -1
  129. package/dist/datasetDetails/distributions/distributionDetails/DistributionDescription.vue.d.ts +6 -6
  130. package/dist/datasetDetails/distributions/distributionDetails/DistributionDescription.vue.mjs.map +1 -1
  131. package/dist/datasetDetails/distributions/distributionDetails/DistributionDetails.vue.d.ts +16 -16
  132. package/dist/datasetDetails/distributions/distributionDetails/DistributionDetails.vue.mjs.map +1 -1
  133. package/dist/datasetDetails/distributions/distributionDetails/DistributionExpand.vue.d.ts +2 -2
  134. package/dist/datasetDetails/distributions/distributionDetails/DistributionExpand.vue.mjs.map +1 -1
  135. package/dist/datasetDetails/features/DatasetDetailsCategoriesKey.vue.d.ts +1 -1
  136. package/dist/datasetDetails/features/DatasetDetailsCategoriesKey.vue.mjs.map +1 -1
  137. package/dist/datasetDetails/features/DatasetDetailsDataServices.vue.mjs.map +1 -1
  138. package/dist/datasetDetails/features/DatasetDetailsFeatureHeader.vue.mjs.map +1 -1
  139. package/dist/datasetDetails/features/DatasetDetailsFeatures.vue.d.ts +2 -2
  140. package/dist/datasetDetails/features/DatasetDetailsFeatures.vue.mjs.map +1 -1
  141. package/dist/datasetDetails/features/DatasetDetailsHvdThemes.vue.d.ts +1 -1
  142. package/dist/datasetDetails/features/DatasetDetailsHvdThemes.vue.mjs.map +1 -1
  143. package/dist/datasetDetails/features/DatasetDetailsIsUsedBy.vue.mjs.map +1 -1
  144. package/dist/datasetDetails/features/DatasetDetailsKeywords.vue.d.ts +1 -1
  145. package/dist/datasetDetails/features/DatasetDetailsKeywords.vue.mjs.map +1 -1
  146. package/dist/datasetDetails/features/DatasetDetailsMap.vue.mjs.map +1 -1
  147. package/dist/datasetDetails/features/DatasetDetailsPages.vue.mjs.map +1 -1
  148. package/dist/datasetDetails/features/DatasetDetailsRelations.vue.mjs.map +1 -1
  149. package/dist/datasetDetails/features/DatasetDetailsSubject.vue.d.ts +1 -1
  150. package/dist/datasetDetails/features/DatasetDetailsSubject.vue.mjs.map +1 -1
  151. package/dist/datasetDetails/features/DatasetDetailsVisualisations.vue.mjs.map +1 -1
  152. package/dist/datasetDetails/header/DatasetDetailsHeader.vue.mjs.map +1 -1
  153. package/dist/datasetDetails/header/DatasetDetailsHeaderCatalogue.vue.d.ts +2 -2
  154. package/dist/datasetDetails/header/DatasetDetailsHeaderCatalogue.vue.mjs.map +1 -1
  155. package/dist/datasetDetails/header/DatasetDetailsHeaderTitle.vue.d.ts +2 -2
  156. package/dist/datasetDetails/header/DatasetDetailsHeaderTitle.vue.mjs.map +1 -1
  157. package/dist/datasetDetails/navigation/DatasetDetailsNavigation.vue.mjs.map +1 -1
  158. package/dist/datasetDetails/navigation/DatasetDetailsNavigationLinks.vue.d.ts +2 -2
  159. package/dist/datasetDetails/navigation/DatasetDetailsNavigationLinks.vue.mjs.map +1 -1
  160. package/dist/datasetDetails/navigation/DatasetDetailsNavigationPage.vue.mjs.map +1 -1
  161. package/dist/datasetDetails/navigation/DatasetDetailsNavigationPages.vue.d.ts +1 -7
  162. package/dist/datasetDetails/navigation/DatasetDetailsNavigationPages.vue.mjs.map +1 -1
  163. package/dist/datasetDetails/properties/DatasetDetailsProperties.vue.d.ts +1 -200
  164. package/dist/datasetDetails/properties/DatasetDetailsProperties.vue.mjs.map +1 -1
  165. package/dist/datasetDetails/properties/DatasetDetailsProperty.vue.mjs.map +1 -1
  166. package/dist/datasetDetails/properties/ValuesList.vue.mjs.map +1 -1
  167. package/dist/datasets/DatasetDate.vue.mjs.map +1 -1
  168. package/dist/datasets/DatasetList.vue.mjs.map +1 -1
  169. package/dist/datasets/Datasets.vue.mjs.map +1 -1
  170. package/dist/datasets/DatasetsFilters.vue.d.ts +1 -1
  171. package/dist/datasets/DatasetsFilters.vue.mjs.map +1 -1
  172. package/dist/datasets/DatasetsFiltersTabs.vue.d.ts +2 -2
  173. package/dist/datasets/DatasetsFiltersTabs.vue.mjs.map +1 -1
  174. package/dist/datasets/DatasetsTopControls.vue.d.ts +5 -5
  175. package/dist/datasets/DatasetsTopControls.vue.mjs +6 -8
  176. package/dist/datasets/DatasetsTopControls.vue.mjs.map +1 -1
  177. package/dist/datasets/datasetsFacets/DatasetsFacets.vue.mjs.map +1 -1
  178. package/dist/datasets/datasetsFacets/DatasetsFacetsItem.vue.mjs.map +1 -1
  179. package/dist/datasets/datasetsFacets/DatasetsMapFacet.vue.mjs.map +1 -1
  180. package/dist/embed/DatasetEmbedModal.vue.mjs.map +1 -1
  181. package/dist/embed/EmbedDataset.vue.mjs.map +1 -1
  182. package/dist/embed/EmbedDatasetSnippet.vue.mjs.map +1 -1
  183. package/dist/external/zod/lib/index +2849 -0
  184. package/dist/external/zod/lib/index.map +1 -0
  185. package/dist/facets/CatalogDetailsFacet.vue.mjs.map +1 -1
  186. package/dist/facets/ExpandableSelectFacet.vue.mjs.map +1 -1
  187. package/dist/facets/Facet.vue.mjs.map +1 -1
  188. package/dist/facets/FacetTitle.vue.mjs.map +1 -1
  189. package/dist/facets/RadioFacet.vue.mjs.map +1 -1
  190. package/dist/facets/SelectedFacetsOverview.vue.d.ts +2 -2
  191. package/dist/facets/SelectedFacetsOverview.vue.mjs.map +1 -1
  192. package/dist/form/FormKitGroup.vue.mjs.map +1 -1
  193. package/dist/form/Repeatable.vue2.mjs +1 -2
  194. package/dist/form/Repeatable.vue2.mjs.map +1 -1
  195. package/dist/map/MapBasic.vue.mjs.map +1 -1
  196. package/dist/map/MapBoundsReceiver.vue.mjs.map +1 -1
  197. package/dist/map/MapBoundsSender.vue.mjs.map +1 -1
  198. package/dist/modal/AppConfirmationDialog.vue.mjs.map +1 -1
  199. package/dist/modal/AppSnackbar.vue.mjs.map +1 -1
  200. package/dist/modal/AppToast.vue.mjs.map +1 -1
  201. package/dist/navigation/SubNavigation.vue.mjs.map +1 -1
  202. package/dist/pages/NotFound.vue.mjs.map +1 -1
  203. package/dist/pages/SparqlSearch.vue.mjs.map +1 -1
  204. package/dist/pages/user/UserImprint.vue.mjs.map +1 -1
  205. package/dist/pages/user/UserPrivacyPolicy.vue.mjs.map +1 -1
  206. package/dist/piveau-hub-ui-modules.css +1 -1
  207. package/dist/search/Search.vue.mjs.map +1 -1
  208. package/dist/services/datasetService.d.ts +1 -1
  209. package/dist/widgets/AppLink.vue.mjs.map +1 -1
  210. package/dist/widgets/Dropdown.vue.mjs.map +1 -1
  211. package/dist/widgets/Pagination.vue.d.ts +1 -1
  212. package/dist/widgets/Pagination.vue.mjs.map +1 -1
  213. package/dist/widgets/PropertyValue.vue.mjs.map +1 -1
  214. package/dist/widgets/PvBanner.vue.mjs.map +1 -1
  215. package/dist/widgets/PvButton.vue.mjs.map +1 -1
  216. package/dist/widgets/PvShowMore.vue.mjs.map +1 -1
  217. package/dist/widgets/ResourceAccessPopup.vue.d.ts +1 -1
  218. package/dist/widgets/ResourceAccessPopup.vue.mjs.map +1 -1
  219. package/dist/widgets/ResourceDetailsLinkedDataButton.vue.mjs.map +1 -1
  220. package/dist/widgets/Tooltip.vue.mjs.map +1 -1
  221. package/package.json +1 -1
  222. package/dist/external/zod/dist/esm/v3/ZodError +0 -84
  223. package/dist/external/zod/dist/esm/v3/ZodError.map +0 -1
  224. package/dist/external/zod/dist/esm/v3/errors +0 -10
  225. package/dist/external/zod/dist/esm/v3/errors.map +0 -1
  226. package/dist/external/zod/dist/esm/v3/helpers/errorUtil +0 -8
  227. package/dist/external/zod/dist/esm/v3/helpers/errorUtil.map +0 -1
  228. package/dist/external/zod/dist/esm/v3/helpers/parseUtil +0 -98
  229. package/dist/external/zod/dist/esm/v3/helpers/parseUtil.map +0 -1
  230. package/dist/external/zod/dist/esm/v3/helpers/util +0 -95
  231. package/dist/external/zod/dist/esm/v3/helpers/util.map +0 -1
  232. package/dist/external/zod/dist/esm/v3/locales/en +0 -62
  233. package/dist/external/zod/dist/esm/v3/locales/en.map +0 -1
  234. package/dist/external/zod/dist/esm/v3/types +0 -2440
  235. package/dist/external/zod/dist/esm/v3/types.map +0 -1
@@ -1,2440 +0,0 @@
1
- import { ZodIssueCode as c, ZodError as B } from "./ZodError";
2
- import { ZodParsedType as h, util as x, getParsedType as Z } from "./helpers/util";
3
- import { errorUtil as u } from "./helpers/errorUtil";
4
- import { addIssueToContext as o, INVALID as p, OK as w, ParseStatus as k, isAsync as F, isValid as I, DIRTY as $, isAborted as me, isDirty as pe } from "./helpers/parseUtil";
5
- var W = globalThis && globalThis.__classPrivateFieldGet || function(a, e, t, s) {
6
- if (t === "a" && !s)
7
- throw new TypeError("Private accessor was defined without a getter");
8
- if (typeof e == "function" ? a !== e || !s : !e.has(a))
9
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
- return t === "m" ? s : t === "a" ? s.call(a) : s ? s.value : e.get(a);
11
- }, ge = globalThis && globalThis.__classPrivateFieldSet || function(a, e, t, s, r) {
12
- if (s === "m")
13
- throw new TypeError("Private method is not writable");
14
- if (s === "a" && !r)
15
- throw new TypeError("Private accessor was defined without a setter");
16
- if (typeof e == "function" ? a !== e || !r : !e.has(a))
17
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
18
- return s === "a" ? r.call(a, t) : r ? r.value = t : e.set(a, t), t;
19
- }, D, U;
20
- class C {
21
- constructor(e, t, s, r) {
22
- this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
23
- }
24
- get path() {
25
- return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
26
- }
27
- }
28
- const _e = (a, e) => {
29
- if (I(e))
30
- return { success: !0, data: e.value };
31
- if (!a.common.issues.length)
32
- throw new Error("Validation failed but no issues detected.");
33
- return {
34
- success: !1,
35
- get error() {
36
- if (this._error)
37
- return this._error;
38
- const t = new B(a.common.issues);
39
- return this._error = t, this._error;
40
- }
41
- };
42
- };
43
- function _(a) {
44
- if (!a)
45
- return {};
46
- const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = a;
47
- if (e && (t || s))
48
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
49
- return e ? { errorMap: e, description: r } : { errorMap: (d, i) => {
50
- const { message: l } = a;
51
- return d.code === "invalid_enum_value" ? { message: l ?? i.defaultError } : typeof i.data > "u" ? { message: l ?? s ?? i.defaultError } : d.code !== "invalid_type" ? { message: i.defaultError } : { message: l ?? t ?? i.defaultError };
52
- }, description: r };
53
- }
54
- class g {
55
- get description() {
56
- return this._def.description;
57
- }
58
- _getType(e) {
59
- return Z(e.data);
60
- }
61
- _getOrReturnCtx(e, t) {
62
- return t || {
63
- common: e.parent.common,
64
- data: e.data,
65
- parsedType: Z(e.data),
66
- schemaErrorMap: this._def.errorMap,
67
- path: e.path,
68
- parent: e.parent
69
- };
70
- }
71
- _processInputParams(e) {
72
- return {
73
- status: new k(),
74
- ctx: {
75
- common: e.parent.common,
76
- data: e.data,
77
- parsedType: Z(e.data),
78
- schemaErrorMap: this._def.errorMap,
79
- path: e.path,
80
- parent: e.parent
81
- }
82
- };
83
- }
84
- _parseSync(e) {
85
- const t = this._parse(e);
86
- if (F(t))
87
- throw new Error("Synchronous parse encountered promise.");
88
- return t;
89
- }
90
- _parseAsync(e) {
91
- const t = this._parse(e);
92
- return Promise.resolve(t);
93
- }
94
- parse(e, t) {
95
- const s = this.safeParse(e, t);
96
- if (s.success)
97
- return s.data;
98
- throw s.error;
99
- }
100
- safeParse(e, t) {
101
- const s = {
102
- common: {
103
- issues: [],
104
- async: (t == null ? void 0 : t.async) ?? !1,
105
- contextualErrorMap: t == null ? void 0 : t.errorMap
106
- },
107
- path: (t == null ? void 0 : t.path) || [],
108
- schemaErrorMap: this._def.errorMap,
109
- parent: null,
110
- data: e,
111
- parsedType: Z(e)
112
- }, r = this._parseSync({ data: e, path: s.path, parent: s });
113
- return _e(s, r);
114
- }
115
- "~validate"(e) {
116
- var s, r;
117
- const t = {
118
- common: {
119
- issues: [],
120
- async: !!this["~standard"].async
121
- },
122
- path: [],
123
- schemaErrorMap: this._def.errorMap,
124
- parent: null,
125
- data: e,
126
- parsedType: Z(e)
127
- };
128
- if (!this["~standard"].async)
129
- try {
130
- const n = this._parseSync({ data: e, path: [], parent: t });
131
- return I(n) ? {
132
- value: n.value
133
- } : {
134
- issues: t.common.issues
135
- };
136
- } catch (n) {
137
- (r = (s = n == null ? void 0 : n.message) == null ? void 0 : s.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), t.common = {
138
- issues: [],
139
- async: !0
140
- };
141
- }
142
- return this._parseAsync({ data: e, path: [], parent: t }).then((n) => I(n) ? {
143
- value: n.value
144
- } : {
145
- issues: t.common.issues
146
- });
147
- }
148
- async parseAsync(e, t) {
149
- const s = await this.safeParseAsync(e, t);
150
- if (s.success)
151
- return s.data;
152
- throw s.error;
153
- }
154
- async safeParseAsync(e, t) {
155
- const s = {
156
- common: {
157
- issues: [],
158
- contextualErrorMap: t == null ? void 0 : t.errorMap,
159
- async: !0
160
- },
161
- path: (t == null ? void 0 : t.path) || [],
162
- schemaErrorMap: this._def.errorMap,
163
- parent: null,
164
- data: e,
165
- parsedType: Z(e)
166
- }, r = this._parse({ data: e, path: s.path, parent: s }), n = await (F(r) ? r : Promise.resolve(r));
167
- return _e(s, n);
168
- }
169
- refine(e, t) {
170
- const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
171
- return this._refinement((r, n) => {
172
- const d = e(r), i = () => n.addIssue({
173
- code: c.custom,
174
- ...s(r)
175
- });
176
- return typeof Promise < "u" && d instanceof Promise ? d.then((l) => l ? !0 : (i(), !1)) : d ? !0 : (i(), !1);
177
- });
178
- }
179
- refinement(e, t) {
180
- return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
181
- }
182
- _refinement(e) {
183
- return new O({
184
- schema: this,
185
- typeName: f.ZodEffects,
186
- effect: { type: "refinement", refinement: e }
187
- });
188
- }
189
- superRefine(e) {
190
- return this._refinement(e);
191
- }
192
- constructor(e) {
193
- this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
194
- version: 1,
195
- vendor: "zod",
196
- validate: (t) => this["~validate"](t)
197
- };
198
- }
199
- optional() {
200
- return S.create(this, this._def);
201
- }
202
- nullable() {
203
- return z.create(this, this._def);
204
- }
205
- nullish() {
206
- return this.nullable().optional();
207
- }
208
- array() {
209
- return T.create(this);
210
- }
211
- promise() {
212
- return H.create(this, this._def);
213
- }
214
- or(e) {
215
- return J.create([this, e], this._def);
216
- }
217
- and(e) {
218
- return Y.create(this, e, this._def);
219
- }
220
- transform(e) {
221
- return new O({
222
- ..._(this._def),
223
- schema: this,
224
- typeName: f.ZodEffects,
225
- effect: { type: "transform", transform: e }
226
- });
227
- }
228
- default(e) {
229
- const t = typeof e == "function" ? e : () => e;
230
- return new oe({
231
- ..._(this._def),
232
- innerType: this,
233
- defaultValue: t,
234
- typeName: f.ZodDefault
235
- });
236
- }
237
- brand() {
238
- return new Fe({
239
- typeName: f.ZodBranded,
240
- type: this,
241
- ..._(this._def)
242
- });
243
- }
244
- catch(e) {
245
- const t = typeof e == "function" ? e : () => e;
246
- return new ue({
247
- ..._(this._def),
248
- innerType: this,
249
- catchValue: t,
250
- typeName: f.ZodCatch
251
- });
252
- }
253
- describe(e) {
254
- const t = this.constructor;
255
- return new t({
256
- ...this._def,
257
- description: e
258
- });
259
- }
260
- pipe(e) {
261
- return fe.create(this, e);
262
- }
263
- readonly() {
264
- return he.create(this);
265
- }
266
- isOptional() {
267
- return this.safeParse(void 0).success;
268
- }
269
- isNullable() {
270
- return this.safeParse(null).success;
271
- }
272
- }
273
- const we = /^c[^\s-]{8,}$/i, be = /^[0-9a-z]+$/, Te = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ce = /^[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, Ze = /^[a-z0-9_-]{21}$/i, Se = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ae = /^[-+]?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)?)??$/, Oe = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Re = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
274
- let Q;
275
- const Ne = /^(?:(?: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])$/, je = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Ee = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Ie = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Le = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Pe = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, ye = "((\\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])))", Ve = new RegExp(`^${ye}$`);
276
- function ve(a) {
277
- let e = "[0-5]\\d";
278
- a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`);
279
- const t = a.precision ? "+" : "?";
280
- return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
281
- }
282
- function ze(a) {
283
- return new RegExp(`^${ve(a)}$`);
284
- }
285
- function Me(a) {
286
- let e = `${ye}T${ve(a)}`;
287
- const t = [];
288
- return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
289
- }
290
- function $e(a, e) {
291
- return !!((e === "v4" || !e) && Ne.test(a) || (e === "v6" || !e) && Ee.test(a));
292
- }
293
- function De(a, e) {
294
- if (!Se.test(a))
295
- return !1;
296
- try {
297
- const [t] = a.split("."), s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
298
- return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
299
- } catch {
300
- return !1;
301
- }
302
- }
303
- function Ue(a, e) {
304
- return !!((e === "v4" || !e) && je.test(a) || (e === "v6" || !e) && Ie.test(a));
305
- }
306
- class b extends g {
307
- _parse(e) {
308
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
309
- const n = this._getOrReturnCtx(e);
310
- return o(n, {
311
- code: c.invalid_type,
312
- expected: h.string,
313
- received: n.parsedType
314
- }), p;
315
- }
316
- const s = new k();
317
- let r;
318
- for (const n of this._def.checks)
319
- if (n.kind === "min")
320
- e.data.length < n.value && (r = this._getOrReturnCtx(e, r), o(r, {
321
- code: c.too_small,
322
- minimum: n.value,
323
- type: "string",
324
- inclusive: !0,
325
- exact: !1,
326
- message: n.message
327
- }), s.dirty());
328
- else if (n.kind === "max")
329
- e.data.length > n.value && (r = this._getOrReturnCtx(e, r), o(r, {
330
- code: c.too_big,
331
- maximum: n.value,
332
- type: "string",
333
- inclusive: !0,
334
- exact: !1,
335
- message: n.message
336
- }), s.dirty());
337
- else if (n.kind === "length") {
338
- const d = e.data.length > n.value, i = e.data.length < n.value;
339
- (d || i) && (r = this._getOrReturnCtx(e, r), d ? o(r, {
340
- code: c.too_big,
341
- maximum: n.value,
342
- type: "string",
343
- inclusive: !0,
344
- exact: !0,
345
- message: n.message
346
- }) : i && o(r, {
347
- code: c.too_small,
348
- minimum: n.value,
349
- type: "string",
350
- inclusive: !0,
351
- exact: !0,
352
- message: n.message
353
- }), s.dirty());
354
- } else if (n.kind === "email")
355
- Oe.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
356
- validation: "email",
357
- code: c.invalid_string,
358
- message: n.message
359
- }), s.dirty());
360
- else if (n.kind === "emoji")
361
- Q || (Q = new RegExp(Re, "u")), Q.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
362
- validation: "emoji",
363
- code: c.invalid_string,
364
- message: n.message
365
- }), s.dirty());
366
- else if (n.kind === "uuid")
367
- Ce.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
368
- validation: "uuid",
369
- code: c.invalid_string,
370
- message: n.message
371
- }), s.dirty());
372
- else if (n.kind === "nanoid")
373
- Ze.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
374
- validation: "nanoid",
375
- code: c.invalid_string,
376
- message: n.message
377
- }), s.dirty());
378
- else if (n.kind === "cuid")
379
- we.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
380
- validation: "cuid",
381
- code: c.invalid_string,
382
- message: n.message
383
- }), s.dirty());
384
- else if (n.kind === "cuid2")
385
- be.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
386
- validation: "cuid2",
387
- code: c.invalid_string,
388
- message: n.message
389
- }), s.dirty());
390
- else if (n.kind === "ulid")
391
- Te.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
392
- validation: "ulid",
393
- code: c.invalid_string,
394
- message: n.message
395
- }), s.dirty());
396
- else if (n.kind === "url")
397
- try {
398
- new URL(e.data);
399
- } catch {
400
- r = this._getOrReturnCtx(e, r), o(r, {
401
- validation: "url",
402
- code: c.invalid_string,
403
- message: n.message
404
- }), s.dirty();
405
- }
406
- else
407
- n.kind === "regex" ? (n.regex.lastIndex = 0, n.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
408
- validation: "regex",
409
- code: c.invalid_string,
410
- message: n.message
411
- }), s.dirty())) : n.kind === "trim" ? e.data = e.data.trim() : n.kind === "includes" ? e.data.includes(n.value, n.position) || (r = this._getOrReturnCtx(e, r), o(r, {
412
- code: c.invalid_string,
413
- validation: { includes: n.value, position: n.position },
414
- message: n.message
415
- }), s.dirty()) : n.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : n.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : n.kind === "startsWith" ? e.data.startsWith(n.value) || (r = this._getOrReturnCtx(e, r), o(r, {
416
- code: c.invalid_string,
417
- validation: { startsWith: n.value },
418
- message: n.message
419
- }), s.dirty()) : n.kind === "endsWith" ? e.data.endsWith(n.value) || (r = this._getOrReturnCtx(e, r), o(r, {
420
- code: c.invalid_string,
421
- validation: { endsWith: n.value },
422
- message: n.message
423
- }), s.dirty()) : n.kind === "datetime" ? Me(n).test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
424
- code: c.invalid_string,
425
- validation: "datetime",
426
- message: n.message
427
- }), s.dirty()) : n.kind === "date" ? Ve.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
428
- code: c.invalid_string,
429
- validation: "date",
430
- message: n.message
431
- }), s.dirty()) : n.kind === "time" ? ze(n).test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
432
- code: c.invalid_string,
433
- validation: "time",
434
- message: n.message
435
- }), s.dirty()) : n.kind === "duration" ? Ae.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
436
- validation: "duration",
437
- code: c.invalid_string,
438
- message: n.message
439
- }), s.dirty()) : n.kind === "ip" ? $e(e.data, n.version) || (r = this._getOrReturnCtx(e, r), o(r, {
440
- validation: "ip",
441
- code: c.invalid_string,
442
- message: n.message
443
- }), s.dirty()) : n.kind === "jwt" ? De(e.data, n.alg) || (r = this._getOrReturnCtx(e, r), o(r, {
444
- validation: "jwt",
445
- code: c.invalid_string,
446
- message: n.message
447
- }), s.dirty()) : n.kind === "cidr" ? Ue(e.data, n.version) || (r = this._getOrReturnCtx(e, r), o(r, {
448
- validation: "cidr",
449
- code: c.invalid_string,
450
- message: n.message
451
- }), s.dirty()) : n.kind === "base64" ? Le.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
452
- validation: "base64",
453
- code: c.invalid_string,
454
- message: n.message
455
- }), s.dirty()) : n.kind === "base64url" ? Pe.test(e.data) || (r = this._getOrReturnCtx(e, r), o(r, {
456
- validation: "base64url",
457
- code: c.invalid_string,
458
- message: n.message
459
- }), s.dirty()) : x.assertNever(n);
460
- return { status: s.value, value: e.data };
461
- }
462
- _regex(e, t, s) {
463
- return this.refinement((r) => e.test(r), {
464
- validation: t,
465
- code: c.invalid_string,
466
- ...u.errToObj(s)
467
- });
468
- }
469
- _addCheck(e) {
470
- return new b({
471
- ...this._def,
472
- checks: [...this._def.checks, e]
473
- });
474
- }
475
- email(e) {
476
- return this._addCheck({ kind: "email", ...u.errToObj(e) });
477
- }
478
- url(e) {
479
- return this._addCheck({ kind: "url", ...u.errToObj(e) });
480
- }
481
- emoji(e) {
482
- return this._addCheck({ kind: "emoji", ...u.errToObj(e) });
483
- }
484
- uuid(e) {
485
- return this._addCheck({ kind: "uuid", ...u.errToObj(e) });
486
- }
487
- nanoid(e) {
488
- return this._addCheck({ kind: "nanoid", ...u.errToObj(e) });
489
- }
490
- cuid(e) {
491
- return this._addCheck({ kind: "cuid", ...u.errToObj(e) });
492
- }
493
- cuid2(e) {
494
- return this._addCheck({ kind: "cuid2", ...u.errToObj(e) });
495
- }
496
- ulid(e) {
497
- return this._addCheck({ kind: "ulid", ...u.errToObj(e) });
498
- }
499
- base64(e) {
500
- return this._addCheck({ kind: "base64", ...u.errToObj(e) });
501
- }
502
- base64url(e) {
503
- return this._addCheck({
504
- kind: "base64url",
505
- ...u.errToObj(e)
506
- });
507
- }
508
- jwt(e) {
509
- return this._addCheck({ kind: "jwt", ...u.errToObj(e) });
510
- }
511
- ip(e) {
512
- return this._addCheck({ kind: "ip", ...u.errToObj(e) });
513
- }
514
- cidr(e) {
515
- return this._addCheck({ kind: "cidr", ...u.errToObj(e) });
516
- }
517
- datetime(e) {
518
- return typeof e == "string" ? this._addCheck({
519
- kind: "datetime",
520
- precision: null,
521
- offset: !1,
522
- local: !1,
523
- message: e
524
- }) : this._addCheck({
525
- kind: "datetime",
526
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
527
- offset: (e == null ? void 0 : e.offset) ?? !1,
528
- local: (e == null ? void 0 : e.local) ?? !1,
529
- ...u.errToObj(e == null ? void 0 : e.message)
530
- });
531
- }
532
- date(e) {
533
- return this._addCheck({ kind: "date", message: e });
534
- }
535
- time(e) {
536
- return typeof e == "string" ? this._addCheck({
537
- kind: "time",
538
- precision: null,
539
- message: e
540
- }) : this._addCheck({
541
- kind: "time",
542
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
543
- ...u.errToObj(e == null ? void 0 : e.message)
544
- });
545
- }
546
- duration(e) {
547
- return this._addCheck({ kind: "duration", ...u.errToObj(e) });
548
- }
549
- regex(e, t) {
550
- return this._addCheck({
551
- kind: "regex",
552
- regex: e,
553
- ...u.errToObj(t)
554
- });
555
- }
556
- includes(e, t) {
557
- return this._addCheck({
558
- kind: "includes",
559
- value: e,
560
- position: t == null ? void 0 : t.position,
561
- ...u.errToObj(t == null ? void 0 : t.message)
562
- });
563
- }
564
- startsWith(e, t) {
565
- return this._addCheck({
566
- kind: "startsWith",
567
- value: e,
568
- ...u.errToObj(t)
569
- });
570
- }
571
- endsWith(e, t) {
572
- return this._addCheck({
573
- kind: "endsWith",
574
- value: e,
575
- ...u.errToObj(t)
576
- });
577
- }
578
- min(e, t) {
579
- return this._addCheck({
580
- kind: "min",
581
- value: e,
582
- ...u.errToObj(t)
583
- });
584
- }
585
- max(e, t) {
586
- return this._addCheck({
587
- kind: "max",
588
- value: e,
589
- ...u.errToObj(t)
590
- });
591
- }
592
- length(e, t) {
593
- return this._addCheck({
594
- kind: "length",
595
- value: e,
596
- ...u.errToObj(t)
597
- });
598
- }
599
- /**
600
- * Equivalent to `.min(1)`
601
- */
602
- nonempty(e) {
603
- return this.min(1, u.errToObj(e));
604
- }
605
- trim() {
606
- return new b({
607
- ...this._def,
608
- checks: [...this._def.checks, { kind: "trim" }]
609
- });
610
- }
611
- toLowerCase() {
612
- return new b({
613
- ...this._def,
614
- checks: [...this._def.checks, { kind: "toLowerCase" }]
615
- });
616
- }
617
- toUpperCase() {
618
- return new b({
619
- ...this._def,
620
- checks: [...this._def.checks, { kind: "toUpperCase" }]
621
- });
622
- }
623
- get isDatetime() {
624
- return !!this._def.checks.find((e) => e.kind === "datetime");
625
- }
626
- get isDate() {
627
- return !!this._def.checks.find((e) => e.kind === "date");
628
- }
629
- get isTime() {
630
- return !!this._def.checks.find((e) => e.kind === "time");
631
- }
632
- get isDuration() {
633
- return !!this._def.checks.find((e) => e.kind === "duration");
634
- }
635
- get isEmail() {
636
- return !!this._def.checks.find((e) => e.kind === "email");
637
- }
638
- get isURL() {
639
- return !!this._def.checks.find((e) => e.kind === "url");
640
- }
641
- get isEmoji() {
642
- return !!this._def.checks.find((e) => e.kind === "emoji");
643
- }
644
- get isUUID() {
645
- return !!this._def.checks.find((e) => e.kind === "uuid");
646
- }
647
- get isNANOID() {
648
- return !!this._def.checks.find((e) => e.kind === "nanoid");
649
- }
650
- get isCUID() {
651
- return !!this._def.checks.find((e) => e.kind === "cuid");
652
- }
653
- get isCUID2() {
654
- return !!this._def.checks.find((e) => e.kind === "cuid2");
655
- }
656
- get isULID() {
657
- return !!this._def.checks.find((e) => e.kind === "ulid");
658
- }
659
- get isIP() {
660
- return !!this._def.checks.find((e) => e.kind === "ip");
661
- }
662
- get isCIDR() {
663
- return !!this._def.checks.find((e) => e.kind === "cidr");
664
- }
665
- get isBase64() {
666
- return !!this._def.checks.find((e) => e.kind === "base64");
667
- }
668
- get isBase64url() {
669
- return !!this._def.checks.find((e) => e.kind === "base64url");
670
- }
671
- get minLength() {
672
- let e = null;
673
- for (const t of this._def.checks)
674
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
675
- return e;
676
- }
677
- get maxLength() {
678
- let e = null;
679
- for (const t of this._def.checks)
680
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
681
- return e;
682
- }
683
- }
684
- b.create = (a) => new b({
685
- checks: [],
686
- typeName: f.ZodString,
687
- coerce: (a == null ? void 0 : a.coerce) ?? !1,
688
- ..._(a)
689
- });
690
- function Be(a, e) {
691
- const t = (a.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, n = Number.parseInt(a.toFixed(r).replace(".", "")), d = Number.parseInt(e.toFixed(r).replace(".", ""));
692
- return n % d / 10 ** r;
693
- }
694
- class R extends g {
695
- constructor() {
696
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
697
- }
698
- _parse(e) {
699
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
700
- const n = this._getOrReturnCtx(e);
701
- return o(n, {
702
- code: c.invalid_type,
703
- expected: h.number,
704
- received: n.parsedType
705
- }), p;
706
- }
707
- let s;
708
- const r = new k();
709
- for (const n of this._def.checks)
710
- n.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), o(s, {
711
- code: c.invalid_type,
712
- expected: "integer",
713
- received: "float",
714
- message: n.message
715
- }), r.dirty()) : n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), o(s, {
716
- code: c.too_small,
717
- minimum: n.value,
718
- type: "number",
719
- inclusive: n.inclusive,
720
- exact: !1,
721
- message: n.message
722
- }), r.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), o(s, {
723
- code: c.too_big,
724
- maximum: n.value,
725
- type: "number",
726
- inclusive: n.inclusive,
727
- exact: !1,
728
- message: n.message
729
- }), r.dirty()) : n.kind === "multipleOf" ? Be(e.data, n.value) !== 0 && (s = this._getOrReturnCtx(e, s), o(s, {
730
- code: c.not_multiple_of,
731
- multipleOf: n.value,
732
- message: n.message
733
- }), r.dirty()) : n.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), o(s, {
734
- code: c.not_finite,
735
- message: n.message
736
- }), r.dirty()) : x.assertNever(n);
737
- return { status: r.value, value: e.data };
738
- }
739
- gte(e, t) {
740
- return this.setLimit("min", e, !0, u.toString(t));
741
- }
742
- gt(e, t) {
743
- return this.setLimit("min", e, !1, u.toString(t));
744
- }
745
- lte(e, t) {
746
- return this.setLimit("max", e, !0, u.toString(t));
747
- }
748
- lt(e, t) {
749
- return this.setLimit("max", e, !1, u.toString(t));
750
- }
751
- setLimit(e, t, s, r) {
752
- return new R({
753
- ...this._def,
754
- checks: [
755
- ...this._def.checks,
756
- {
757
- kind: e,
758
- value: t,
759
- inclusive: s,
760
- message: u.toString(r)
761
- }
762
- ]
763
- });
764
- }
765
- _addCheck(e) {
766
- return new R({
767
- ...this._def,
768
- checks: [...this._def.checks, e]
769
- });
770
- }
771
- int(e) {
772
- return this._addCheck({
773
- kind: "int",
774
- message: u.toString(e)
775
- });
776
- }
777
- positive(e) {
778
- return this._addCheck({
779
- kind: "min",
780
- value: 0,
781
- inclusive: !1,
782
- message: u.toString(e)
783
- });
784
- }
785
- negative(e) {
786
- return this._addCheck({
787
- kind: "max",
788
- value: 0,
789
- inclusive: !1,
790
- message: u.toString(e)
791
- });
792
- }
793
- nonpositive(e) {
794
- return this._addCheck({
795
- kind: "max",
796
- value: 0,
797
- inclusive: !0,
798
- message: u.toString(e)
799
- });
800
- }
801
- nonnegative(e) {
802
- return this._addCheck({
803
- kind: "min",
804
- value: 0,
805
- inclusive: !0,
806
- message: u.toString(e)
807
- });
808
- }
809
- multipleOf(e, t) {
810
- return this._addCheck({
811
- kind: "multipleOf",
812
- value: e,
813
- message: u.toString(t)
814
- });
815
- }
816
- finite(e) {
817
- return this._addCheck({
818
- kind: "finite",
819
- message: u.toString(e)
820
- });
821
- }
822
- safe(e) {
823
- return this._addCheck({
824
- kind: "min",
825
- inclusive: !0,
826
- value: Number.MIN_SAFE_INTEGER,
827
- message: u.toString(e)
828
- })._addCheck({
829
- kind: "max",
830
- inclusive: !0,
831
- value: Number.MAX_SAFE_INTEGER,
832
- message: u.toString(e)
833
- });
834
- }
835
- get minValue() {
836
- let e = null;
837
- for (const t of this._def.checks)
838
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
839
- return e;
840
- }
841
- get maxValue() {
842
- let e = null;
843
- for (const t of this._def.checks)
844
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
845
- return e;
846
- }
847
- get isInt() {
848
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
849
- }
850
- get isFinite() {
851
- let e = null, t = null;
852
- for (const s of this._def.checks) {
853
- if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
854
- return !0;
855
- s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
856
- }
857
- return Number.isFinite(t) && Number.isFinite(e);
858
- }
859
- }
860
- R.create = (a) => new R({
861
- checks: [],
862
- typeName: f.ZodNumber,
863
- coerce: (a == null ? void 0 : a.coerce) || !1,
864
- ..._(a)
865
- });
866
- class N extends g {
867
- constructor() {
868
- super(...arguments), this.min = this.gte, this.max = this.lte;
869
- }
870
- _parse(e) {
871
- if (this._def.coerce)
872
- try {
873
- e.data = BigInt(e.data);
874
- } catch {
875
- return this._getInvalidInput(e);
876
- }
877
- if (this._getType(e) !== h.bigint)
878
- return this._getInvalidInput(e);
879
- let s;
880
- const r = new k();
881
- for (const n of this._def.checks)
882
- n.kind === "min" ? (n.inclusive ? e.data < n.value : e.data <= n.value) && (s = this._getOrReturnCtx(e, s), o(s, {
883
- code: c.too_small,
884
- type: "bigint",
885
- minimum: n.value,
886
- inclusive: n.inclusive,
887
- message: n.message
888
- }), r.dirty()) : n.kind === "max" ? (n.inclusive ? e.data > n.value : e.data >= n.value) && (s = this._getOrReturnCtx(e, s), o(s, {
889
- code: c.too_big,
890
- type: "bigint",
891
- maximum: n.value,
892
- inclusive: n.inclusive,
893
- message: n.message
894
- }), r.dirty()) : n.kind === "multipleOf" ? e.data % n.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), o(s, {
895
- code: c.not_multiple_of,
896
- multipleOf: n.value,
897
- message: n.message
898
- }), r.dirty()) : x.assertNever(n);
899
- return { status: r.value, value: e.data };
900
- }
901
- _getInvalidInput(e) {
902
- const t = this._getOrReturnCtx(e);
903
- return o(t, {
904
- code: c.invalid_type,
905
- expected: h.bigint,
906
- received: t.parsedType
907
- }), p;
908
- }
909
- gte(e, t) {
910
- return this.setLimit("min", e, !0, u.toString(t));
911
- }
912
- gt(e, t) {
913
- return this.setLimit("min", e, !1, u.toString(t));
914
- }
915
- lte(e, t) {
916
- return this.setLimit("max", e, !0, u.toString(t));
917
- }
918
- lt(e, t) {
919
- return this.setLimit("max", e, !1, u.toString(t));
920
- }
921
- setLimit(e, t, s, r) {
922
- return new N({
923
- ...this._def,
924
- checks: [
925
- ...this._def.checks,
926
- {
927
- kind: e,
928
- value: t,
929
- inclusive: s,
930
- message: u.toString(r)
931
- }
932
- ]
933
- });
934
- }
935
- _addCheck(e) {
936
- return new N({
937
- ...this._def,
938
- checks: [...this._def.checks, e]
939
- });
940
- }
941
- positive(e) {
942
- return this._addCheck({
943
- kind: "min",
944
- value: BigInt(0),
945
- inclusive: !1,
946
- message: u.toString(e)
947
- });
948
- }
949
- negative(e) {
950
- return this._addCheck({
951
- kind: "max",
952
- value: BigInt(0),
953
- inclusive: !1,
954
- message: u.toString(e)
955
- });
956
- }
957
- nonpositive(e) {
958
- return this._addCheck({
959
- kind: "max",
960
- value: BigInt(0),
961
- inclusive: !0,
962
- message: u.toString(e)
963
- });
964
- }
965
- nonnegative(e) {
966
- return this._addCheck({
967
- kind: "min",
968
- value: BigInt(0),
969
- inclusive: !0,
970
- message: u.toString(e)
971
- });
972
- }
973
- multipleOf(e, t) {
974
- return this._addCheck({
975
- kind: "multipleOf",
976
- value: e,
977
- message: u.toString(t)
978
- });
979
- }
980
- get minValue() {
981
- let e = null;
982
- for (const t of this._def.checks)
983
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
984
- return e;
985
- }
986
- get maxValue() {
987
- let e = null;
988
- for (const t of this._def.checks)
989
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
990
- return e;
991
- }
992
- }
993
- N.create = (a) => new N({
994
- checks: [],
995
- typeName: f.ZodBigInt,
996
- coerce: (a == null ? void 0 : a.coerce) ?? !1,
997
- ..._(a)
998
- });
999
- class G extends g {
1000
- _parse(e) {
1001
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
1002
- const s = this._getOrReturnCtx(e);
1003
- return o(s, {
1004
- code: c.invalid_type,
1005
- expected: h.boolean,
1006
- received: s.parsedType
1007
- }), p;
1008
- }
1009
- return w(e.data);
1010
- }
1011
- }
1012
- G.create = (a) => new G({
1013
- typeName: f.ZodBoolean,
1014
- coerce: (a == null ? void 0 : a.coerce) || !1,
1015
- ..._(a)
1016
- });
1017
- class L extends g {
1018
- _parse(e) {
1019
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
1020
- const n = this._getOrReturnCtx(e);
1021
- return o(n, {
1022
- code: c.invalid_type,
1023
- expected: h.date,
1024
- received: n.parsedType
1025
- }), p;
1026
- }
1027
- if (Number.isNaN(e.data.getTime())) {
1028
- const n = this._getOrReturnCtx(e);
1029
- return o(n, {
1030
- code: c.invalid_date
1031
- }), p;
1032
- }
1033
- const s = new k();
1034
- let r;
1035
- for (const n of this._def.checks)
1036
- n.kind === "min" ? e.data.getTime() < n.value && (r = this._getOrReturnCtx(e, r), o(r, {
1037
- code: c.too_small,
1038
- message: n.message,
1039
- inclusive: !0,
1040
- exact: !1,
1041
- minimum: n.value,
1042
- type: "date"
1043
- }), s.dirty()) : n.kind === "max" ? e.data.getTime() > n.value && (r = this._getOrReturnCtx(e, r), o(r, {
1044
- code: c.too_big,
1045
- message: n.message,
1046
- inclusive: !0,
1047
- exact: !1,
1048
- maximum: n.value,
1049
- type: "date"
1050
- }), s.dirty()) : x.assertNever(n);
1051
- return {
1052
- status: s.value,
1053
- value: new Date(e.data.getTime())
1054
- };
1055
- }
1056
- _addCheck(e) {
1057
- return new L({
1058
- ...this._def,
1059
- checks: [...this._def.checks, e]
1060
- });
1061
- }
1062
- min(e, t) {
1063
- return this._addCheck({
1064
- kind: "min",
1065
- value: e.getTime(),
1066
- message: u.toString(t)
1067
- });
1068
- }
1069
- max(e, t) {
1070
- return this._addCheck({
1071
- kind: "max",
1072
- value: e.getTime(),
1073
- message: u.toString(t)
1074
- });
1075
- }
1076
- get minDate() {
1077
- let e = null;
1078
- for (const t of this._def.checks)
1079
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1080
- return e != null ? new Date(e) : null;
1081
- }
1082
- get maxDate() {
1083
- let e = null;
1084
- for (const t of this._def.checks)
1085
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1086
- return e != null ? new Date(e) : null;
1087
- }
1088
- }
1089
- L.create = (a) => new L({
1090
- checks: [],
1091
- coerce: (a == null ? void 0 : a.coerce) || !1,
1092
- typeName: f.ZodDate,
1093
- ..._(a)
1094
- });
1095
- class X extends g {
1096
- _parse(e) {
1097
- if (this._getType(e) !== h.symbol) {
1098
- const s = this._getOrReturnCtx(e);
1099
- return o(s, {
1100
- code: c.invalid_type,
1101
- expected: h.symbol,
1102
- received: s.parsedType
1103
- }), p;
1104
- }
1105
- return w(e.data);
1106
- }
1107
- }
1108
- X.create = (a) => new X({
1109
- typeName: f.ZodSymbol,
1110
- ..._(a)
1111
- });
1112
- class K extends g {
1113
- _parse(e) {
1114
- if (this._getType(e) !== h.undefined) {
1115
- const s = this._getOrReturnCtx(e);
1116
- return o(s, {
1117
- code: c.invalid_type,
1118
- expected: h.undefined,
1119
- received: s.parsedType
1120
- }), p;
1121
- }
1122
- return w(e.data);
1123
- }
1124
- }
1125
- K.create = (a) => new K({
1126
- typeName: f.ZodUndefined,
1127
- ..._(a)
1128
- });
1129
- class ee extends g {
1130
- _parse(e) {
1131
- if (this._getType(e) !== h.null) {
1132
- const s = this._getOrReturnCtx(e);
1133
- return o(s, {
1134
- code: c.invalid_type,
1135
- expected: h.null,
1136
- received: s.parsedType
1137
- }), p;
1138
- }
1139
- return w(e.data);
1140
- }
1141
- }
1142
- ee.create = (a) => new ee({
1143
- typeName: f.ZodNull,
1144
- ..._(a)
1145
- });
1146
- class te extends g {
1147
- constructor() {
1148
- super(...arguments), this._any = !0;
1149
- }
1150
- _parse(e) {
1151
- return w(e.data);
1152
- }
1153
- }
1154
- te.create = (a) => new te({
1155
- typeName: f.ZodAny,
1156
- ..._(a)
1157
- });
1158
- class se extends g {
1159
- constructor() {
1160
- super(...arguments), this._unknown = !0;
1161
- }
1162
- _parse(e) {
1163
- return w(e.data);
1164
- }
1165
- }
1166
- se.create = (a) => new se({
1167
- typeName: f.ZodUnknown,
1168
- ..._(a)
1169
- });
1170
- class A extends g {
1171
- _parse(e) {
1172
- const t = this._getOrReturnCtx(e);
1173
- return o(t, {
1174
- code: c.invalid_type,
1175
- expected: h.never,
1176
- received: t.parsedType
1177
- }), p;
1178
- }
1179
- }
1180
- A.create = (a) => new A({
1181
- typeName: f.ZodNever,
1182
- ..._(a)
1183
- });
1184
- class re extends g {
1185
- _parse(e) {
1186
- if (this._getType(e) !== h.undefined) {
1187
- const s = this._getOrReturnCtx(e);
1188
- return o(s, {
1189
- code: c.invalid_type,
1190
- expected: h.void,
1191
- received: s.parsedType
1192
- }), p;
1193
- }
1194
- return w(e.data);
1195
- }
1196
- }
1197
- re.create = (a) => new re({
1198
- typeName: f.ZodVoid,
1199
- ..._(a)
1200
- });
1201
- class T extends g {
1202
- _parse(e) {
1203
- const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
1204
- if (t.parsedType !== h.array)
1205
- return o(t, {
1206
- code: c.invalid_type,
1207
- expected: h.array,
1208
- received: t.parsedType
1209
- }), p;
1210
- if (r.exactLength !== null) {
1211
- const d = t.data.length > r.exactLength.value, i = t.data.length < r.exactLength.value;
1212
- (d || i) && (o(t, {
1213
- code: d ? c.too_big : c.too_small,
1214
- minimum: i ? r.exactLength.value : void 0,
1215
- maximum: d ? r.exactLength.value : void 0,
1216
- type: "array",
1217
- inclusive: !0,
1218
- exact: !0,
1219
- message: r.exactLength.message
1220
- }), s.dirty());
1221
- }
1222
- if (r.minLength !== null && t.data.length < r.minLength.value && (o(t, {
1223
- code: c.too_small,
1224
- minimum: r.minLength.value,
1225
- type: "array",
1226
- inclusive: !0,
1227
- exact: !1,
1228
- message: r.minLength.message
1229
- }), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (o(t, {
1230
- code: c.too_big,
1231
- maximum: r.maxLength.value,
1232
- type: "array",
1233
- inclusive: !0,
1234
- exact: !1,
1235
- message: r.maxLength.message
1236
- }), s.dirty()), t.common.async)
1237
- return Promise.all([...t.data].map((d, i) => r.type._parseAsync(new C(t, d, t.path, i)))).then((d) => k.mergeArray(s, d));
1238
- const n = [...t.data].map((d, i) => r.type._parseSync(new C(t, d, t.path, i)));
1239
- return k.mergeArray(s, n);
1240
- }
1241
- get element() {
1242
- return this._def.type;
1243
- }
1244
- min(e, t) {
1245
- return new T({
1246
- ...this._def,
1247
- minLength: { value: e, message: u.toString(t) }
1248
- });
1249
- }
1250
- max(e, t) {
1251
- return new T({
1252
- ...this._def,
1253
- maxLength: { value: e, message: u.toString(t) }
1254
- });
1255
- }
1256
- length(e, t) {
1257
- return new T({
1258
- ...this._def,
1259
- exactLength: { value: e, message: u.toString(t) }
1260
- });
1261
- }
1262
- nonempty(e) {
1263
- return this.min(1, e);
1264
- }
1265
- }
1266
- T.create = (a, e) => new T({
1267
- type: a,
1268
- minLength: null,
1269
- maxLength: null,
1270
- exactLength: null,
1271
- typeName: f.ZodArray,
1272
- ..._(e)
1273
- });
1274
- function E(a) {
1275
- if (a instanceof v) {
1276
- const e = {};
1277
- for (const t in a.shape) {
1278
- const s = a.shape[t];
1279
- e[t] = S.create(E(s));
1280
- }
1281
- return new v({
1282
- ...a._def,
1283
- shape: () => e
1284
- });
1285
- } else
1286
- return a instanceof T ? new T({
1287
- ...a._def,
1288
- type: E(a.element)
1289
- }) : a instanceof S ? S.create(E(a.unwrap())) : a instanceof z ? z.create(E(a.unwrap())) : a instanceof j ? j.create(a.items.map((e) => E(e))) : a;
1290
- }
1291
- class v extends g {
1292
- constructor() {
1293
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1294
- }
1295
- _getCached() {
1296
- if (this._cached !== null)
1297
- return this._cached;
1298
- const e = this._def.shape(), t = x.objectKeys(e);
1299
- return this._cached = { shape: e, keys: t }, this._cached;
1300
- }
1301
- _parse(e) {
1302
- if (this._getType(e) !== h.object) {
1303
- const m = this._getOrReturnCtx(e);
1304
- return o(m, {
1305
- code: c.invalid_type,
1306
- expected: h.object,
1307
- received: m.parsedType
1308
- }), p;
1309
- }
1310
- const { status: s, ctx: r } = this._processInputParams(e), { shape: n, keys: d } = this._getCached(), i = [];
1311
- if (!(this._def.catchall instanceof A && this._def.unknownKeys === "strip"))
1312
- for (const m in r.data)
1313
- d.includes(m) || i.push(m);
1314
- const l = [];
1315
- for (const m of d) {
1316
- const y = n[m], M = r.data[m];
1317
- l.push({
1318
- key: { status: "valid", value: m },
1319
- value: y._parse(new C(r, M, r.path, m)),
1320
- alwaysSet: m in r.data
1321
- });
1322
- }
1323
- if (this._def.catchall instanceof A) {
1324
- const m = this._def.unknownKeys;
1325
- if (m === "passthrough")
1326
- for (const y of i)
1327
- l.push({
1328
- key: { status: "valid", value: y },
1329
- value: { status: "valid", value: r.data[y] }
1330
- });
1331
- else if (m === "strict")
1332
- i.length > 0 && (o(r, {
1333
- code: c.unrecognized_keys,
1334
- keys: i
1335
- }), s.dirty());
1336
- else if (m !== "strip")
1337
- throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1338
- } else {
1339
- const m = this._def.catchall;
1340
- for (const y of i) {
1341
- const M = r.data[y];
1342
- l.push({
1343
- key: { status: "valid", value: y },
1344
- value: m._parse(
1345
- new C(r, M, r.path, y)
1346
- //, ctx.child(key), value, getParsedType(value)
1347
- ),
1348
- alwaysSet: y in r.data
1349
- });
1350
- }
1351
- }
1352
- return r.common.async ? Promise.resolve().then(async () => {
1353
- const m = [];
1354
- for (const y of l) {
1355
- const M = await y.key, ke = await y.value;
1356
- m.push({
1357
- key: M,
1358
- value: ke,
1359
- alwaysSet: y.alwaysSet
1360
- });
1361
- }
1362
- return m;
1363
- }).then((m) => k.mergeObjectSync(s, m)) : k.mergeObjectSync(s, l);
1364
- }
1365
- get shape() {
1366
- return this._def.shape();
1367
- }
1368
- strict(e) {
1369
- return u.errToObj, new v({
1370
- ...this._def,
1371
- unknownKeys: "strict",
1372
- ...e !== void 0 ? {
1373
- errorMap: (t, s) => {
1374
- var n, d;
1375
- const r = ((d = (n = this._def).errorMap) == null ? void 0 : d.call(n, t, s).message) ?? s.defaultError;
1376
- return t.code === "unrecognized_keys" ? {
1377
- message: u.errToObj(e).message ?? r
1378
- } : {
1379
- message: r
1380
- };
1381
- }
1382
- } : {}
1383
- });
1384
- }
1385
- strip() {
1386
- return new v({
1387
- ...this._def,
1388
- unknownKeys: "strip"
1389
- });
1390
- }
1391
- passthrough() {
1392
- return new v({
1393
- ...this._def,
1394
- unknownKeys: "passthrough"
1395
- });
1396
- }
1397
- // const AugmentFactory =
1398
- // <Def extends ZodObjectDef>(def: Def) =>
1399
- // <Augmentation extends ZodRawShape>(
1400
- // augmentation: Augmentation
1401
- // ): ZodObject<
1402
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1403
- // Def["unknownKeys"],
1404
- // Def["catchall"]
1405
- // > => {
1406
- // return new ZodObject({
1407
- // ...def,
1408
- // shape: () => ({
1409
- // ...def.shape(),
1410
- // ...augmentation,
1411
- // }),
1412
- // }) as any;
1413
- // };
1414
- extend(e) {
1415
- return new v({
1416
- ...this._def,
1417
- shape: () => ({
1418
- ...this._def.shape(),
1419
- ...e
1420
- })
1421
- });
1422
- }
1423
- /**
1424
- * Prior to zod@1.0.12 there was a bug in the
1425
- * inferred type of merged objects. Please
1426
- * upgrade if you are experiencing issues.
1427
- */
1428
- merge(e) {
1429
- return new v({
1430
- unknownKeys: e._def.unknownKeys,
1431
- catchall: e._def.catchall,
1432
- shape: () => ({
1433
- ...this._def.shape(),
1434
- ...e._def.shape()
1435
- }),
1436
- typeName: f.ZodObject
1437
- });
1438
- }
1439
- // merge<
1440
- // Incoming extends AnyZodObject,
1441
- // Augmentation extends Incoming["shape"],
1442
- // NewOutput extends {
1443
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1444
- // ? Augmentation[k]["_output"]
1445
- // : k extends keyof Output
1446
- // ? Output[k]
1447
- // : never;
1448
- // },
1449
- // NewInput extends {
1450
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1451
- // ? Augmentation[k]["_input"]
1452
- // : k extends keyof Input
1453
- // ? Input[k]
1454
- // : never;
1455
- // }
1456
- // >(
1457
- // merging: Incoming
1458
- // ): ZodObject<
1459
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1460
- // Incoming["_def"]["unknownKeys"],
1461
- // Incoming["_def"]["catchall"],
1462
- // NewOutput,
1463
- // NewInput
1464
- // > {
1465
- // const merged: any = new ZodObject({
1466
- // unknownKeys: merging._def.unknownKeys,
1467
- // catchall: merging._def.catchall,
1468
- // shape: () =>
1469
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1470
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1471
- // }) as any;
1472
- // return merged;
1473
- // }
1474
- setKey(e, t) {
1475
- return this.augment({ [e]: t });
1476
- }
1477
- // merge<Incoming extends AnyZodObject>(
1478
- // merging: Incoming
1479
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1480
- // ZodObject<
1481
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1482
- // Incoming["_def"]["unknownKeys"],
1483
- // Incoming["_def"]["catchall"]
1484
- // > {
1485
- // // const mergedShape = objectUtil.mergeShapes(
1486
- // // this._def.shape(),
1487
- // // merging._def.shape()
1488
- // // );
1489
- // const merged: any = new ZodObject({
1490
- // unknownKeys: merging._def.unknownKeys,
1491
- // catchall: merging._def.catchall,
1492
- // shape: () =>
1493
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1494
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1495
- // }) as any;
1496
- // return merged;
1497
- // }
1498
- catchall(e) {
1499
- return new v({
1500
- ...this._def,
1501
- catchall: e
1502
- });
1503
- }
1504
- pick(e) {
1505
- const t = {};
1506
- for (const s of x.objectKeys(e))
1507
- e[s] && this.shape[s] && (t[s] = this.shape[s]);
1508
- return new v({
1509
- ...this._def,
1510
- shape: () => t
1511
- });
1512
- }
1513
- omit(e) {
1514
- const t = {};
1515
- for (const s of x.objectKeys(this.shape))
1516
- e[s] || (t[s] = this.shape[s]);
1517
- return new v({
1518
- ...this._def,
1519
- shape: () => t
1520
- });
1521
- }
1522
- /**
1523
- * @deprecated
1524
- */
1525
- deepPartial() {
1526
- return E(this);
1527
- }
1528
- partial(e) {
1529
- const t = {};
1530
- for (const s of x.objectKeys(this.shape)) {
1531
- const r = this.shape[s];
1532
- e && !e[s] ? t[s] = r : t[s] = r.optional();
1533
- }
1534
- return new v({
1535
- ...this._def,
1536
- shape: () => t
1537
- });
1538
- }
1539
- required(e) {
1540
- const t = {};
1541
- for (const s of x.objectKeys(this.shape))
1542
- if (e && !e[s])
1543
- t[s] = this.shape[s];
1544
- else {
1545
- let n = this.shape[s];
1546
- for (; n instanceof S; )
1547
- n = n._def.innerType;
1548
- t[s] = n;
1549
- }
1550
- return new v({
1551
- ...this._def,
1552
- shape: () => t
1553
- });
1554
- }
1555
- keyof() {
1556
- return xe(x.objectKeys(this.shape));
1557
- }
1558
- }
1559
- v.create = (a, e) => new v({
1560
- shape: () => a,
1561
- unknownKeys: "strip",
1562
- catchall: A.create(),
1563
- typeName: f.ZodObject,
1564
- ..._(e)
1565
- });
1566
- v.strictCreate = (a, e) => new v({
1567
- shape: () => a,
1568
- unknownKeys: "strict",
1569
- catchall: A.create(),
1570
- typeName: f.ZodObject,
1571
- ..._(e)
1572
- });
1573
- v.lazycreate = (a, e) => new v({
1574
- shape: a,
1575
- unknownKeys: "strip",
1576
- catchall: A.create(),
1577
- typeName: f.ZodObject,
1578
- ..._(e)
1579
- });
1580
- class J extends g {
1581
- _parse(e) {
1582
- const { ctx: t } = this._processInputParams(e), s = this._def.options;
1583
- function r(n) {
1584
- for (const i of n)
1585
- if (i.result.status === "valid")
1586
- return i.result;
1587
- for (const i of n)
1588
- if (i.result.status === "dirty")
1589
- return t.common.issues.push(...i.ctx.common.issues), i.result;
1590
- const d = n.map((i) => new B(i.ctx.common.issues));
1591
- return o(t, {
1592
- code: c.invalid_union,
1593
- unionErrors: d
1594
- }), p;
1595
- }
1596
- if (t.common.async)
1597
- return Promise.all(s.map(async (n) => {
1598
- const d = {
1599
- ...t,
1600
- common: {
1601
- ...t.common,
1602
- issues: []
1603
- },
1604
- parent: null
1605
- };
1606
- return {
1607
- result: await n._parseAsync({
1608
- data: t.data,
1609
- path: t.path,
1610
- parent: d
1611
- }),
1612
- ctx: d
1613
- };
1614
- })).then(r);
1615
- {
1616
- let n;
1617
- const d = [];
1618
- for (const l of s) {
1619
- const m = {
1620
- ...t,
1621
- common: {
1622
- ...t.common,
1623
- issues: []
1624
- },
1625
- parent: null
1626
- }, y = l._parseSync({
1627
- data: t.data,
1628
- path: t.path,
1629
- parent: m
1630
- });
1631
- if (y.status === "valid")
1632
- return y;
1633
- y.status === "dirty" && !n && (n = { result: y, ctx: m }), m.common.issues.length && d.push(m.common.issues);
1634
- }
1635
- if (n)
1636
- return t.common.issues.push(...n.ctx.common.issues), n.result;
1637
- const i = d.map((l) => new B(l));
1638
- return o(t, {
1639
- code: c.invalid_union,
1640
- unionErrors: i
1641
- }), p;
1642
- }
1643
- }
1644
- get options() {
1645
- return this._def.options;
1646
- }
1647
- }
1648
- J.create = (a, e) => new J({
1649
- options: a,
1650
- typeName: f.ZodUnion,
1651
- ..._(e)
1652
- });
1653
- function ae(a, e) {
1654
- const t = Z(a), s = Z(e);
1655
- if (a === e)
1656
- return { valid: !0, data: a };
1657
- if (t === h.object && s === h.object) {
1658
- const r = x.objectKeys(e), n = x.objectKeys(a).filter((i) => r.indexOf(i) !== -1), d = { ...a, ...e };
1659
- for (const i of n) {
1660
- const l = ae(a[i], e[i]);
1661
- if (!l.valid)
1662
- return { valid: !1 };
1663
- d[i] = l.data;
1664
- }
1665
- return { valid: !0, data: d };
1666
- } else if (t === h.array && s === h.array) {
1667
- if (a.length !== e.length)
1668
- return { valid: !1 };
1669
- const r = [];
1670
- for (let n = 0; n < a.length; n++) {
1671
- const d = a[n], i = e[n], l = ae(d, i);
1672
- if (!l.valid)
1673
- return { valid: !1 };
1674
- r.push(l.data);
1675
- }
1676
- return { valid: !0, data: r };
1677
- } else
1678
- return t === h.date && s === h.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
1679
- }
1680
- class Y extends g {
1681
- _parse(e) {
1682
- const { status: t, ctx: s } = this._processInputParams(e), r = (n, d) => {
1683
- if (me(n) || me(d))
1684
- return p;
1685
- const i = ae(n.value, d.value);
1686
- return i.valid ? ((pe(n) || pe(d)) && t.dirty(), { status: t.value, value: i.data }) : (o(s, {
1687
- code: c.invalid_intersection_types
1688
- }), p);
1689
- };
1690
- return s.common.async ? Promise.all([
1691
- this._def.left._parseAsync({
1692
- data: s.data,
1693
- path: s.path,
1694
- parent: s
1695
- }),
1696
- this._def.right._parseAsync({
1697
- data: s.data,
1698
- path: s.path,
1699
- parent: s
1700
- })
1701
- ]).then(([n, d]) => r(n, d)) : r(this._def.left._parseSync({
1702
- data: s.data,
1703
- path: s.path,
1704
- parent: s
1705
- }), this._def.right._parseSync({
1706
- data: s.data,
1707
- path: s.path,
1708
- parent: s
1709
- }));
1710
- }
1711
- }
1712
- Y.create = (a, e, t) => new Y({
1713
- left: a,
1714
- right: e,
1715
- typeName: f.ZodIntersection,
1716
- ..._(t)
1717
- });
1718
- class j extends g {
1719
- _parse(e) {
1720
- const { status: t, ctx: s } = this._processInputParams(e);
1721
- if (s.parsedType !== h.array)
1722
- return o(s, {
1723
- code: c.invalid_type,
1724
- expected: h.array,
1725
- received: s.parsedType
1726
- }), p;
1727
- if (s.data.length < this._def.items.length)
1728
- return o(s, {
1729
- code: c.too_small,
1730
- minimum: this._def.items.length,
1731
- inclusive: !0,
1732
- exact: !1,
1733
- type: "array"
1734
- }), p;
1735
- !this._def.rest && s.data.length > this._def.items.length && (o(s, {
1736
- code: c.too_big,
1737
- maximum: this._def.items.length,
1738
- inclusive: !0,
1739
- exact: !1,
1740
- type: "array"
1741
- }), t.dirty());
1742
- const n = [...s.data].map((d, i) => {
1743
- const l = this._def.items[i] || this._def.rest;
1744
- return l ? l._parse(new C(s, d, s.path, i)) : null;
1745
- }).filter((d) => !!d);
1746
- return s.common.async ? Promise.all(n).then((d) => k.mergeArray(t, d)) : k.mergeArray(t, n);
1747
- }
1748
- get items() {
1749
- return this._def.items;
1750
- }
1751
- rest(e) {
1752
- return new j({
1753
- ...this._def,
1754
- rest: e
1755
- });
1756
- }
1757
- }
1758
- j.create = (a, e) => {
1759
- if (!Array.isArray(a))
1760
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
1761
- return new j({
1762
- items: a,
1763
- typeName: f.ZodTuple,
1764
- rest: null,
1765
- ..._(e)
1766
- });
1767
- };
1768
- class q extends g {
1769
- get keySchema() {
1770
- return this._def.keyType;
1771
- }
1772
- get valueSchema() {
1773
- return this._def.valueType;
1774
- }
1775
- _parse(e) {
1776
- const { status: t, ctx: s } = this._processInputParams(e);
1777
- if (s.parsedType !== h.object)
1778
- return o(s, {
1779
- code: c.invalid_type,
1780
- expected: h.object,
1781
- received: s.parsedType
1782
- }), p;
1783
- const r = [], n = this._def.keyType, d = this._def.valueType;
1784
- for (const i in s.data)
1785
- r.push({
1786
- key: n._parse(new C(s, i, s.path, i)),
1787
- value: d._parse(new C(s, s.data[i], s.path, i)),
1788
- alwaysSet: i in s.data
1789
- });
1790
- return s.common.async ? k.mergeObjectAsync(t, r) : k.mergeObjectSync(t, r);
1791
- }
1792
- get element() {
1793
- return this._def.valueType;
1794
- }
1795
- static create(e, t, s) {
1796
- return t instanceof g ? new q({
1797
- keyType: e,
1798
- valueType: t,
1799
- typeName: f.ZodRecord,
1800
- ..._(s)
1801
- }) : new q({
1802
- keyType: b.create(),
1803
- valueType: e,
1804
- typeName: f.ZodRecord,
1805
- ..._(t)
1806
- });
1807
- }
1808
- }
1809
- class ne extends g {
1810
- get keySchema() {
1811
- return this._def.keyType;
1812
- }
1813
- get valueSchema() {
1814
- return this._def.valueType;
1815
- }
1816
- _parse(e) {
1817
- const { status: t, ctx: s } = this._processInputParams(e);
1818
- if (s.parsedType !== h.map)
1819
- return o(s, {
1820
- code: c.invalid_type,
1821
- expected: h.map,
1822
- received: s.parsedType
1823
- }), p;
1824
- const r = this._def.keyType, n = this._def.valueType, d = [...s.data.entries()].map(([i, l], m) => ({
1825
- key: r._parse(new C(s, i, s.path, [m, "key"])),
1826
- value: n._parse(new C(s, l, s.path, [m, "value"]))
1827
- }));
1828
- if (s.common.async) {
1829
- const i = /* @__PURE__ */ new Map();
1830
- return Promise.resolve().then(async () => {
1831
- for (const l of d) {
1832
- const m = await l.key, y = await l.value;
1833
- if (m.status === "aborted" || y.status === "aborted")
1834
- return p;
1835
- (m.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(m.value, y.value);
1836
- }
1837
- return { status: t.value, value: i };
1838
- });
1839
- } else {
1840
- const i = /* @__PURE__ */ new Map();
1841
- for (const l of d) {
1842
- const m = l.key, y = l.value;
1843
- if (m.status === "aborted" || y.status === "aborted")
1844
- return p;
1845
- (m.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(m.value, y.value);
1846
- }
1847
- return { status: t.value, value: i };
1848
- }
1849
- }
1850
- }
1851
- ne.create = (a, e, t) => new ne({
1852
- valueType: e,
1853
- keyType: a,
1854
- typeName: f.ZodMap,
1855
- ..._(t)
1856
- });
1857
- class P extends g {
1858
- _parse(e) {
1859
- const { status: t, ctx: s } = this._processInputParams(e);
1860
- if (s.parsedType !== h.set)
1861
- return o(s, {
1862
- code: c.invalid_type,
1863
- expected: h.set,
1864
- received: s.parsedType
1865
- }), p;
1866
- const r = this._def;
1867
- r.minSize !== null && s.data.size < r.minSize.value && (o(s, {
1868
- code: c.too_small,
1869
- minimum: r.minSize.value,
1870
- type: "set",
1871
- inclusive: !0,
1872
- exact: !1,
1873
- message: r.minSize.message
1874
- }), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (o(s, {
1875
- code: c.too_big,
1876
- maximum: r.maxSize.value,
1877
- type: "set",
1878
- inclusive: !0,
1879
- exact: !1,
1880
- message: r.maxSize.message
1881
- }), t.dirty());
1882
- const n = this._def.valueType;
1883
- function d(l) {
1884
- const m = /* @__PURE__ */ new Set();
1885
- for (const y of l) {
1886
- if (y.status === "aborted")
1887
- return p;
1888
- y.status === "dirty" && t.dirty(), m.add(y.value);
1889
- }
1890
- return { status: t.value, value: m };
1891
- }
1892
- const i = [...s.data.values()].map((l, m) => n._parse(new C(s, l, s.path, m)));
1893
- return s.common.async ? Promise.all(i).then((l) => d(l)) : d(i);
1894
- }
1895
- min(e, t) {
1896
- return new P({
1897
- ...this._def,
1898
- minSize: { value: e, message: u.toString(t) }
1899
- });
1900
- }
1901
- max(e, t) {
1902
- return new P({
1903
- ...this._def,
1904
- maxSize: { value: e, message: u.toString(t) }
1905
- });
1906
- }
1907
- size(e, t) {
1908
- return this.min(e, t).max(e, t);
1909
- }
1910
- nonempty(e) {
1911
- return this.min(1, e);
1912
- }
1913
- }
1914
- P.create = (a, e) => new P({
1915
- valueType: a,
1916
- minSize: null,
1917
- maxSize: null,
1918
- typeName: f.ZodSet,
1919
- ..._(e)
1920
- });
1921
- class ie extends g {
1922
- get schema() {
1923
- return this._def.getter();
1924
- }
1925
- _parse(e) {
1926
- const { ctx: t } = this._processInputParams(e);
1927
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
1928
- }
1929
- }
1930
- ie.create = (a, e) => new ie({
1931
- getter: a,
1932
- typeName: f.ZodLazy,
1933
- ..._(e)
1934
- });
1935
- class de extends g {
1936
- _parse(e) {
1937
- if (e.data !== this._def.value) {
1938
- const t = this._getOrReturnCtx(e);
1939
- return o(t, {
1940
- received: t.data,
1941
- code: c.invalid_literal,
1942
- expected: this._def.value
1943
- }), p;
1944
- }
1945
- return { status: "valid", value: e.data };
1946
- }
1947
- get value() {
1948
- return this._def.value;
1949
- }
1950
- }
1951
- de.create = (a, e) => new de({
1952
- value: a,
1953
- typeName: f.ZodLiteral,
1954
- ..._(e)
1955
- });
1956
- function xe(a, e) {
1957
- return new V({
1958
- values: a,
1959
- typeName: f.ZodEnum,
1960
- ..._(e)
1961
- });
1962
- }
1963
- class V extends g {
1964
- constructor() {
1965
- super(...arguments), D.set(this, void 0);
1966
- }
1967
- _parse(e) {
1968
- if (typeof e.data != "string") {
1969
- const t = this._getOrReturnCtx(e), s = this._def.values;
1970
- return o(t, {
1971
- expected: x.joinValues(s),
1972
- received: t.parsedType,
1973
- code: c.invalid_type
1974
- }), p;
1975
- }
1976
- if (W(this, D, "f") || ge(this, D, new Set(this._def.values), "f"), !W(this, D, "f").has(e.data)) {
1977
- const t = this._getOrReturnCtx(e), s = this._def.values;
1978
- return o(t, {
1979
- received: t.data,
1980
- code: c.invalid_enum_value,
1981
- options: s
1982
- }), p;
1983
- }
1984
- return w(e.data);
1985
- }
1986
- get options() {
1987
- return this._def.values;
1988
- }
1989
- get enum() {
1990
- const e = {};
1991
- for (const t of this._def.values)
1992
- e[t] = t;
1993
- return e;
1994
- }
1995
- get Values() {
1996
- const e = {};
1997
- for (const t of this._def.values)
1998
- e[t] = t;
1999
- return e;
2000
- }
2001
- get Enum() {
2002
- const e = {};
2003
- for (const t of this._def.values)
2004
- e[t] = t;
2005
- return e;
2006
- }
2007
- extract(e, t = this._def) {
2008
- return V.create(e, {
2009
- ...this._def,
2010
- ...t
2011
- });
2012
- }
2013
- exclude(e, t = this._def) {
2014
- return V.create(this.options.filter((s) => !e.includes(s)), {
2015
- ...this._def,
2016
- ...t
2017
- });
2018
- }
2019
- }
2020
- D = /* @__PURE__ */ new WeakMap();
2021
- V.create = xe;
2022
- class ce extends g {
2023
- constructor() {
2024
- super(...arguments), U.set(this, void 0);
2025
- }
2026
- _parse(e) {
2027
- const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2028
- if (s.parsedType !== h.string && s.parsedType !== h.number) {
2029
- const r = x.objectValues(t);
2030
- return o(s, {
2031
- expected: x.joinValues(r),
2032
- received: s.parsedType,
2033
- code: c.invalid_type
2034
- }), p;
2035
- }
2036
- if (W(this, U, "f") || ge(this, U, new Set(x.getValidEnumValues(this._def.values)), "f"), !W(this, U, "f").has(e.data)) {
2037
- const r = x.objectValues(t);
2038
- return o(s, {
2039
- received: s.data,
2040
- code: c.invalid_enum_value,
2041
- options: r
2042
- }), p;
2043
- }
2044
- return w(e.data);
2045
- }
2046
- get enum() {
2047
- return this._def.values;
2048
- }
2049
- }
2050
- U = /* @__PURE__ */ new WeakMap();
2051
- ce.create = (a, e) => new ce({
2052
- values: a,
2053
- typeName: f.ZodNativeEnum,
2054
- ..._(e)
2055
- });
2056
- class H extends g {
2057
- unwrap() {
2058
- return this._def.type;
2059
- }
2060
- _parse(e) {
2061
- const { ctx: t } = this._processInputParams(e);
2062
- if (t.parsedType !== h.promise && t.common.async === !1)
2063
- return o(t, {
2064
- code: c.invalid_type,
2065
- expected: h.promise,
2066
- received: t.parsedType
2067
- }), p;
2068
- const s = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
2069
- return w(s.then((r) => this._def.type.parseAsync(r, {
2070
- path: t.path,
2071
- errorMap: t.common.contextualErrorMap
2072
- })));
2073
- }
2074
- }
2075
- H.create = (a, e) => new H({
2076
- type: a,
2077
- typeName: f.ZodPromise,
2078
- ..._(e)
2079
- });
2080
- class O extends g {
2081
- innerType() {
2082
- return this._def.schema;
2083
- }
2084
- sourceType() {
2085
- return this._def.schema._def.typeName === f.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2086
- }
2087
- _parse(e) {
2088
- const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, n = {
2089
- addIssue: (d) => {
2090
- o(s, d), d.fatal ? t.abort() : t.dirty();
2091
- },
2092
- get path() {
2093
- return s.path;
2094
- }
2095
- };
2096
- if (n.addIssue = n.addIssue.bind(n), r.type === "preprocess") {
2097
- const d = r.transform(s.data, n);
2098
- if (s.common.async)
2099
- return Promise.resolve(d).then(async (i) => {
2100
- if (t.value === "aborted")
2101
- return p;
2102
- const l = await this._def.schema._parseAsync({
2103
- data: i,
2104
- path: s.path,
2105
- parent: s
2106
- });
2107
- return l.status === "aborted" ? p : l.status === "dirty" ? $(l.value) : t.value === "dirty" ? $(l.value) : l;
2108
- });
2109
- {
2110
- if (t.value === "aborted")
2111
- return p;
2112
- const i = this._def.schema._parseSync({
2113
- data: d,
2114
- path: s.path,
2115
- parent: s
2116
- });
2117
- return i.status === "aborted" ? p : i.status === "dirty" ? $(i.value) : t.value === "dirty" ? $(i.value) : i;
2118
- }
2119
- }
2120
- if (r.type === "refinement") {
2121
- const d = (i) => {
2122
- const l = r.refinement(i, n);
2123
- if (s.common.async)
2124
- return Promise.resolve(l);
2125
- if (l instanceof Promise)
2126
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2127
- return i;
2128
- };
2129
- if (s.common.async === !1) {
2130
- const i = this._def.schema._parseSync({
2131
- data: s.data,
2132
- path: s.path,
2133
- parent: s
2134
- });
2135
- return i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), d(i.value), { status: t.value, value: i.value });
2136
- } else
2137
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), d(i.value).then(() => ({ status: t.value, value: i.value }))));
2138
- }
2139
- if (r.type === "transform")
2140
- if (s.common.async === !1) {
2141
- const d = this._def.schema._parseSync({
2142
- data: s.data,
2143
- path: s.path,
2144
- parent: s
2145
- });
2146
- if (!I(d))
2147
- return d;
2148
- const i = r.transform(d.value, n);
2149
- if (i instanceof Promise)
2150
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2151
- return { status: t.value, value: i };
2152
- } else
2153
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => I(d) ? Promise.resolve(r.transform(d.value, n)).then((i) => ({
2154
- status: t.value,
2155
- value: i
2156
- })) : d);
2157
- x.assertNever(r);
2158
- }
2159
- }
2160
- O.create = (a, e, t) => new O({
2161
- schema: a,
2162
- typeName: f.ZodEffects,
2163
- effect: e,
2164
- ..._(t)
2165
- });
2166
- O.createWithPreprocess = (a, e, t) => new O({
2167
- schema: e,
2168
- effect: { type: "preprocess", transform: a },
2169
- typeName: f.ZodEffects,
2170
- ..._(t)
2171
- });
2172
- class S extends g {
2173
- _parse(e) {
2174
- return this._getType(e) === h.undefined ? w(void 0) : this._def.innerType._parse(e);
2175
- }
2176
- unwrap() {
2177
- return this._def.innerType;
2178
- }
2179
- }
2180
- S.create = (a, e) => new S({
2181
- innerType: a,
2182
- typeName: f.ZodOptional,
2183
- ..._(e)
2184
- });
2185
- class z extends g {
2186
- _parse(e) {
2187
- return this._getType(e) === h.null ? w(null) : this._def.innerType._parse(e);
2188
- }
2189
- unwrap() {
2190
- return this._def.innerType;
2191
- }
2192
- }
2193
- z.create = (a, e) => new z({
2194
- innerType: a,
2195
- typeName: f.ZodNullable,
2196
- ..._(e)
2197
- });
2198
- class oe extends g {
2199
- _parse(e) {
2200
- const { ctx: t } = this._processInputParams(e);
2201
- let s = t.data;
2202
- return t.parsedType === h.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2203
- data: s,
2204
- path: t.path,
2205
- parent: t
2206
- });
2207
- }
2208
- removeDefault() {
2209
- return this._def.innerType;
2210
- }
2211
- }
2212
- oe.create = (a, e) => new oe({
2213
- innerType: a,
2214
- typeName: f.ZodDefault,
2215
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2216
- ..._(e)
2217
- });
2218
- class ue extends g {
2219
- _parse(e) {
2220
- const { ctx: t } = this._processInputParams(e), s = {
2221
- ...t,
2222
- common: {
2223
- ...t.common,
2224
- issues: []
2225
- }
2226
- }, r = this._def.innerType._parse({
2227
- data: s.data,
2228
- path: s.path,
2229
- parent: {
2230
- ...s
2231
- }
2232
- });
2233
- return F(r) ? r.then((n) => ({
2234
- status: "valid",
2235
- value: n.status === "valid" ? n.value : this._def.catchValue({
2236
- get error() {
2237
- return new B(s.common.issues);
2238
- },
2239
- input: s.data
2240
- })
2241
- })) : {
2242
- status: "valid",
2243
- value: r.status === "valid" ? r.value : this._def.catchValue({
2244
- get error() {
2245
- return new B(s.common.issues);
2246
- },
2247
- input: s.data
2248
- })
2249
- };
2250
- }
2251
- removeCatch() {
2252
- return this._def.innerType;
2253
- }
2254
- }
2255
- ue.create = (a, e) => new ue({
2256
- innerType: a,
2257
- typeName: f.ZodCatch,
2258
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2259
- ..._(e)
2260
- });
2261
- class le extends g {
2262
- _parse(e) {
2263
- if (this._getType(e) !== h.nan) {
2264
- const s = this._getOrReturnCtx(e);
2265
- return o(s, {
2266
- code: c.invalid_type,
2267
- expected: h.nan,
2268
- received: s.parsedType
2269
- }), p;
2270
- }
2271
- return { status: "valid", value: e.data };
2272
- }
2273
- }
2274
- le.create = (a) => new le({
2275
- typeName: f.ZodNaN,
2276
- ..._(a)
2277
- });
2278
- class Fe extends g {
2279
- _parse(e) {
2280
- const { ctx: t } = this._processInputParams(e), s = t.data;
2281
- return this._def.type._parse({
2282
- data: s,
2283
- path: t.path,
2284
- parent: t
2285
- });
2286
- }
2287
- unwrap() {
2288
- return this._def.type;
2289
- }
2290
- }
2291
- class fe extends g {
2292
- _parse(e) {
2293
- const { status: t, ctx: s } = this._processInputParams(e);
2294
- if (s.common.async)
2295
- return (async () => {
2296
- const n = await this._def.in._parseAsync({
2297
- data: s.data,
2298
- path: s.path,
2299
- parent: s
2300
- });
2301
- return n.status === "aborted" ? p : n.status === "dirty" ? (t.dirty(), $(n.value)) : this._def.out._parseAsync({
2302
- data: n.value,
2303
- path: s.path,
2304
- parent: s
2305
- });
2306
- })();
2307
- {
2308
- const r = this._def.in._parseSync({
2309
- data: s.data,
2310
- path: s.path,
2311
- parent: s
2312
- });
2313
- return r.status === "aborted" ? p : r.status === "dirty" ? (t.dirty(), {
2314
- status: "dirty",
2315
- value: r.value
2316
- }) : this._def.out._parseSync({
2317
- data: r.value,
2318
- path: s.path,
2319
- parent: s
2320
- });
2321
- }
2322
- }
2323
- static create(e, t) {
2324
- return new fe({
2325
- in: e,
2326
- out: t,
2327
- typeName: f.ZodPipeline
2328
- });
2329
- }
2330
- }
2331
- class he extends g {
2332
- _parse(e) {
2333
- const t = this._def.innerType._parse(e), s = (r) => (I(r) && (r.value = Object.freeze(r.value)), r);
2334
- return F(t) ? t.then((r) => s(r)) : s(t);
2335
- }
2336
- unwrap() {
2337
- return this._def.innerType;
2338
- }
2339
- }
2340
- he.create = (a, e) => new he({
2341
- innerType: a,
2342
- typeName: f.ZodReadonly,
2343
- ..._(e)
2344
- });
2345
- v.lazycreate;
2346
- var f;
2347
- (function(a) {
2348
- a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
2349
- })(f || (f = {}));
2350
- const qe = b.create, He = R.create;
2351
- le.create;
2352
- N.create;
2353
- const Qe = G.create;
2354
- L.create;
2355
- X.create;
2356
- K.create;
2357
- ee.create;
2358
- te.create;
2359
- se.create;
2360
- A.create;
2361
- re.create;
2362
- const Xe = T.create, Ke = v.create;
2363
- v.strictCreate;
2364
- const et = J.create;
2365
- Y.create;
2366
- const tt = j.create, st = q.create;
2367
- ne.create;
2368
- P.create;
2369
- ie.create;
2370
- const rt = de.create, at = V.create;
2371
- ce.create;
2372
- H.create;
2373
- O.create;
2374
- S.create;
2375
- z.create;
2376
- O.createWithPreprocess;
2377
- const nt = {
2378
- string: (a) => b.create({ ...a, coerce: !0 }),
2379
- number: (a) => R.create({ ...a, coerce: !0 }),
2380
- boolean: (a) => G.create({
2381
- ...a,
2382
- coerce: !0
2383
- }),
2384
- bigint: (a) => N.create({ ...a, coerce: !0 }),
2385
- date: (a) => L.create({ ...a, coerce: !0 })
2386
- };
2387
- export {
2388
- g as Schema,
2389
- te as ZodAny,
2390
- T as ZodArray,
2391
- N as ZodBigInt,
2392
- G as ZodBoolean,
2393
- Fe as ZodBranded,
2394
- ue as ZodCatch,
2395
- L as ZodDate,
2396
- oe as ZodDefault,
2397
- O as ZodEffects,
2398
- V as ZodEnum,
2399
- f as ZodFirstPartyTypeKind,
2400
- Y as ZodIntersection,
2401
- ie as ZodLazy,
2402
- de as ZodLiteral,
2403
- ne as ZodMap,
2404
- le as ZodNaN,
2405
- ce as ZodNativeEnum,
2406
- A as ZodNever,
2407
- ee as ZodNull,
2408
- z as ZodNullable,
2409
- R as ZodNumber,
2410
- v as ZodObject,
2411
- S as ZodOptional,
2412
- fe as ZodPipeline,
2413
- H as ZodPromise,
2414
- he as ZodReadonly,
2415
- q as ZodRecord,
2416
- g as ZodSchema,
2417
- P as ZodSet,
2418
- b as ZodString,
2419
- X as ZodSymbol,
2420
- O as ZodTransformer,
2421
- j as ZodTuple,
2422
- g as ZodType,
2423
- K as ZodUndefined,
2424
- J as ZodUnion,
2425
- se as ZodUnknown,
2426
- re as ZodVoid,
2427
- Xe as array,
2428
- Qe as boolean,
2429
- nt as coerce,
2430
- Me as datetimeRegex,
2431
- at as enum,
2432
- rt as literal,
2433
- He as number,
2434
- Ke as object,
2435
- st as record,
2436
- qe as string,
2437
- tt as tuple,
2438
- et as union
2439
- };
2440
- //# sourceMappingURL=types.map