react-luminus-components 1.3.20 → 1.3.21

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 (242) hide show
  1. package/README.md +355 -355
  2. package/package.json +105 -105
  3. package/dist/.vite/manifest.json +0 -187
  4. package/dist/NoInputContainer-BKPv5rmP.cjs +0 -253
  5. package/dist/NoInputContainer-C2e1tx-D.js +0 -7008
  6. package/dist/PrimaryButton-JNkq9258.js +0 -712
  7. package/dist/PrimaryButton-PjAN0Acn.cjs +0 -1
  8. package/dist/SimpleTooltip-BCnuzxKk.js +0 -5
  9. package/dist/SimpleTooltip-BTqqafx1.cjs +0 -1
  10. package/dist/components/BnfTableValueFormats/UserAvatarValueFormat/UserAvatarValueFormat.d.ts +0 -3
  11. package/dist/components/BnfTableValueFormats/index.d.ts +0 -1
  12. package/dist/components/Buttons/ContextButton/ContextButton.d.ts +0 -14
  13. package/dist/components/Buttons/ContextButton/FileUploadContextButton.d.ts +0 -12
  14. package/dist/components/Buttons/FloatingSubmit/FloatingFormSubmit.d.ts +0 -8
  15. package/dist/components/Buttons/IconButton/IconButton.d.ts +0 -13
  16. package/dist/components/Buttons/PrimaryButton/PrimaryButton.d.ts +0 -14
  17. package/dist/components/Buttons/index.d.ts +0 -5
  18. package/dist/components/Dropdown/Dropdown.d.ts +0 -8
  19. package/dist/components/Dropdown/comps/DropdownDivider/DropdownDivider.d.ts +0 -6
  20. package/dist/components/Dropdown/comps/DropdownItem/DropdownItem.d.ts +0 -9
  21. package/dist/components/Dropdown/comps/DropdownItem/FileUploadDropdownItem.d.ts +0 -12
  22. package/dist/components/Dropdown/comps/DropdownToggle/DropdownToggle.d.ts +0 -7
  23. package/dist/components/Dropdown/comps/SimpleToggle/SimpleToggle.d.ts +0 -10
  24. package/dist/components/Dropdown/comps/UserAvatarToggle/UserAvatarToggle.d.ts +0 -8
  25. package/dist/components/Dropdown/comps/index.d.ts +0 -6
  26. package/dist/components/Dropdown/index.d.ts +0 -2
  27. package/dist/components/Form/CheckInput/CheckInput.d.ts +0 -4
  28. package/dist/components/Form/DropdownPicker/DropdownPicker.d.ts +0 -4
  29. package/dist/components/Form/NumericStepperInput/NumericStepperInput.d.ts +0 -4
  30. package/dist/components/Form/SelectInput/SelectInput.d.ts +0 -4
  31. package/dist/components/Form/TextAreaInput/TextAreaInput.d.ts +0 -4
  32. package/dist/components/Form/TextInput/TextInput.d.ts +0 -4
  33. package/dist/components/Form/index.d.ts +0 -6
  34. package/dist/components/HookForm/CheckInput/HookFormCheckInput.d.ts +0 -4
  35. package/dist/components/HookForm/CustomSelectInput/CustomSelectInput.d.ts +0 -4
  36. package/dist/components/HookForm/DropdownPicker/HookFormDropdownPicker.d.ts +0 -4
  37. package/dist/components/HookForm/FileInput/HookFormFileInput.d.ts +0 -4
  38. package/dist/components/HookForm/FloatingSubmit/HookFormFloatingSubmit.d.ts +0 -8
  39. package/dist/components/HookForm/NumericStepperInput/HookFormNumericStepperInput.d.ts +0 -4
  40. package/dist/components/HookForm/RadioInput/HookFormRadioInput.d.ts +0 -4
  41. package/dist/components/HookForm/SelectInput/HookFormSelectInput.d.ts +0 -4
  42. package/dist/components/HookForm/TextAreaInput/HookFormTextAreaInput.d.ts +0 -4
  43. package/dist/components/HookForm/TextInput/HookFormTextInput.d.ts +0 -4
  44. package/dist/components/HookForm/index.d.ts +0 -10
  45. package/dist/components/InputContainers/FloatingLabelInput/FloatingLabelInput.d.ts +0 -34
  46. package/dist/components/InputContainers/InputAnchorContainer/InputAnchorContainer.d.ts +0 -9
  47. package/dist/components/InputContainers/NoInputContainer/NoInputContainer.d.ts +0 -34
  48. package/dist/components/InputContainers/RowLabelInput/RowLabelInput.d.ts +0 -34
  49. package/dist/components/InputContainers/index.d.ts +0 -4
  50. package/dist/components/NewTabs/Tab/Tab.d.ts +0 -10
  51. package/dist/components/NewTabs/TabPanel/TabPanel.d.ts +0 -11
  52. package/dist/components/NewTabs/Tabs/Tabs.d.ts +0 -9
  53. package/dist/components/NewTabs/index.d.ts +0 -3
  54. package/dist/components/Tabs/Tabs.d.ts +0 -9
  55. package/dist/components/Tabs/comps/Tab/Tab.d.ts +0 -7
  56. package/dist/components/Tabs/comps/index.d.ts +0 -1
  57. package/dist/components/Tabs/index.d.ts +0 -2
  58. package/dist/components/Tooltip/HtmlTooltip/HtmlTooltip.d.ts +0 -23
  59. package/dist/components/Tooltip/SimpleTooltip/SimpleTooltip.d.ts +0 -8
  60. package/dist/components/Tooltip/index.d.ts +0 -2
  61. package/dist/components/UserAvatar/AvatarIcon/AvatarIcon.d.ts +0 -8
  62. package/dist/components/UserAvatar/index.d.ts +0 -1
  63. package/dist/components/common/Alert/Alert.d.ts +0 -8
  64. package/dist/components/common/ApiFileDownloadButton/ApiFileDownloadButton.d.ts +0 -8
  65. package/dist/components/common/AppSearch/AppSearch.d.ts +0 -9
  66. package/dist/components/common/AppSearch/comps/AutocompleteWindow/AutocompleteWindow.d.ts +0 -12
  67. package/dist/components/common/AppSearch/comps/TypeSelector/TypeSelector.d.ts +0 -9
  68. package/dist/components/common/AppSearch/comps/index.d.ts +0 -2
  69. package/dist/components/common/AppSearch/hooks/useSearchItems.d.ts +0 -6
  70. package/dist/components/common/AuthTemplate/AuthTemplate.d.ts +0 -7
  71. package/dist/components/common/Backdrop/Backdrop.d.ts +0 -7
  72. package/dist/components/common/Badge/Badge.d.ts +0 -9
  73. package/dist/components/common/Card/Card.d.ts +0 -28
  74. package/dist/components/common/Collapse/Collapse.d.ts +0 -20
  75. package/dist/components/common/ConfirmDialog/ConfirmDialog.d.ts +0 -3
  76. package/dist/components/common/ErrorBoundary/ErrorBoundary.d.ts +0 -9
  77. package/dist/components/common/FloatingActionContainer/FloatingActionContainer.d.ts +0 -7
  78. package/dist/components/common/HomeDashboard/HomeDashboard.d.ts +0 -10
  79. package/dist/components/common/HomeDashboard/comps/FreeSpaceWidget/FreeSpaceWidget.d.ts +0 -9
  80. package/dist/components/common/HomeDashboard/comps/WidgetPicker/WidgetPicker.d.ts +0 -11
  81. package/dist/components/common/HomeDashboard/comps/index.d.ts +0 -1
  82. package/dist/components/common/HomeDashboard/hooks/useUserDashboard.d.ts +0 -6
  83. package/dist/components/common/ImgApi/ImgApi.d.ts +0 -4
  84. package/dist/components/common/ImgApi/hooks/useGetImgData.d.ts +0 -9
  85. package/dist/components/common/ImgDirect/ImgDirect.d.ts +0 -4
  86. package/dist/components/common/InvalidFeedback/InvalidFeedback.d.ts +0 -6
  87. package/dist/components/common/Loading/Loading.d.ts +0 -3
  88. package/dist/components/common/Loading/LoadingBlock.d.ts +0 -4
  89. package/dist/components/common/MonthPicker/MonthPicker.d.ts +0 -11
  90. package/dist/components/common/PhotoLibrary/PhotoLibrary.d.ts +0 -14
  91. package/dist/components/common/PhotoLightbox/PhotoLightbox.d.ts +0 -18
  92. package/dist/components/common/PromptDialog/PromptDialog.d.ts +0 -3
  93. package/dist/components/common/SimplePicker/SimplePicker.d.ts +0 -25
  94. package/dist/components/common/Timeline/Timeline.d.ts +0 -7
  95. package/dist/components/common/Typography/Typography.d.ts +0 -9
  96. package/dist/components/common/VersionInfo/VersionInfo.d.ts +0 -6
  97. package/dist/components/common/Widget/WidgetCard.d.ts +0 -8
  98. package/dist/components/common/Widget/WidgetWrapper.d.ts +0 -7
  99. package/dist/components/common/YearPicker/YearPicker.d.ts +0 -10
  100. package/dist/components/common/index.d.ts +0 -27
  101. package/dist/contexts/auth/AuthContext.d.ts +0 -9
  102. package/dist/contexts/auth/AuthProvider.d.ts +0 -16
  103. package/dist/contexts/confirm/ConfirmContext.d.ts +0 -9
  104. package/dist/contexts/confirm/ConfirmProvider.d.ts +0 -6
  105. package/dist/contexts/delegation/DelegationContext.d.ts +0 -7
  106. package/dist/contexts/delegation/DelegationProvider.d.ts +0 -6
  107. package/dist/contexts/index.d.ts +0 -11
  108. package/dist/contexts/loading/LoadingContext.d.ts +0 -8
  109. package/dist/contexts/loading/LoadingProvider.d.ts +0 -6
  110. package/dist/contexts/luminus-components/LuminusComponentsContext.d.ts +0 -24
  111. package/dist/contexts/luminus-components/LuminusComponentsProvider.d.ts +0 -25
  112. package/dist/contexts/prompt/PromptContext.d.ts +0 -13
  113. package/dist/contexts/prompt/PromptProvider.d.ts +0 -6
  114. package/dist/contexts/user/UserContext.d.ts +0 -11
  115. package/dist/contexts/user/UserProvider.d.ts +0 -6
  116. package/dist/contexts.cjs.js +0 -1
  117. package/dist/contexts.d.ts +0 -1
  118. package/dist/contexts.es.js +0 -360
  119. package/dist/dateUtils-7nL2BXlo.js +0 -131
  120. package/dist/dateUtils-DUA3CKds.cjs +0 -1
  121. package/dist/hooks/index.d.ts +0 -12
  122. package/dist/hooks/useAuth/hooks/useDevAuth.d.ts +0 -7
  123. package/dist/hooks/useAuth/hooks/useMsalAuth.d.ts +0 -8
  124. package/dist/hooks/useAuth/useAuth.d.ts +0 -8
  125. package/dist/hooks/useAxios/useAxios.d.ts +0 -10
  126. package/dist/hooks/useClickOutside/useClickOutside.d.ts +0 -3
  127. package/dist/hooks/useConfirm/useConfirm.d.ts +0 -8
  128. package/dist/hooks/useFormControlType/useFormControlType.d.ts +0 -2
  129. package/dist/hooks/useGetApiData/useGetApiData.d.ts +0 -9
  130. package/dist/hooks/useGetDataBound/useGetDataBound.d.ts +0 -2
  131. package/dist/hooks/useKeyPress/useKeyPress.d.ts +0 -2
  132. package/dist/hooks/useNotifications/useNotifications.d.ts +0 -4
  133. package/dist/hooks/usePermissions/usePermissions.d.ts +0 -4
  134. package/dist/hooks/usePrompt/usePrompt.d.ts +0 -8
  135. package/dist/hooks/useZodSchemaTypes/useZodSchemaTypes.d.ts +0 -74
  136. package/dist/hooks.cjs.js +0 -1
  137. package/dist/hooks.d.ts +0 -1
  138. package/dist/hooks.es.js +0 -2988
  139. package/dist/latinize-BQrinury.js +0 -950
  140. package/dist/latinize-DaqzUOla.cjs +0 -1
  141. package/dist/layout/FullScreenContainer/FullScreenContainer.d.ts +0 -4
  142. package/dist/layout/MainContainer/MainContainer.d.ts +0 -4
  143. package/dist/layout/PageTitle/PageTitle.d.ts +0 -6
  144. package/dist/layout/SideContentBar/SideContentBar.d.ts +0 -7
  145. package/dist/layout/SideMenu/MenuItem/MenuItem.d.ts +0 -11
  146. package/dist/layout/SideMenu/SideMenu.d.ts +0 -12
  147. package/dist/layout/TopBar/TopBar.d.ts +0 -9
  148. package/dist/layout/index.d.ts +0 -5
  149. package/dist/layout.cjs.js +0 -1
  150. package/dist/layout.d.ts +0 -1
  151. package/dist/layout.es.js +0 -132
  152. package/dist/main.cjs.js +0 -1
  153. package/dist/main.d.ts +0 -32
  154. package/dist/main.es.js +0 -4269
  155. package/dist/models/index.d.ts +0 -65
  156. package/dist/models/prop-types/ContainerProps.d.ts +0 -10
  157. package/dist/models/prop-types/DashboardWidgetCommonProps.d.ts +0 -5
  158. package/dist/models/prop-types/FormInputProps/FormCheckInputProps.d.ts +0 -6
  159. package/dist/models/prop-types/FormInputProps/FormFileInputProps.d.ts +0 -11
  160. package/dist/models/prop-types/FormInputProps/FormNumericStepperInputProps.d.ts +0 -8
  161. package/dist/models/prop-types/FormInputProps/FormRadioInputProps.d.ts +0 -6
  162. package/dist/models/prop-types/FormInputProps/FormSelectInputProps.d.ts +0 -7
  163. package/dist/models/prop-types/FormInputProps/FormTextAreaInputProps.d.ts +0 -7
  164. package/dist/models/prop-types/FormInputProps/FormTextInputProps.d.ts +0 -7
  165. package/dist/models/prop-types/HookFormInputProps/HookFormCheckInputProps.d.ts +0 -4
  166. package/dist/models/prop-types/HookFormInputProps/HookFormDropdownPickerProps.d.ts +0 -4
  167. package/dist/models/prop-types/HookFormInputProps/HookFormFileInputProps.d.ts +0 -4
  168. package/dist/models/prop-types/HookFormInputProps/HookFormInputBaseProps.d.ts +0 -7
  169. package/dist/models/prop-types/HookFormInputProps/HookFormInputProps.d.ts +0 -9
  170. package/dist/models/prop-types/HookFormInputProps/HookFormNumericStepperInputProps.d.ts +0 -4
  171. package/dist/models/prop-types/HookFormInputProps/HookFormRadioInputProps.d.ts +0 -4
  172. package/dist/models/prop-types/HookFormInputProps/HookFormSelectInputProps.d.ts +0 -4
  173. package/dist/models/prop-types/HookFormInputProps/HookFormTextAreaInputProps.d.ts +0 -7
  174. package/dist/models/prop-types/HookFormInputProps/HookFormTextInputProps.d.ts +0 -4
  175. package/dist/models/prop-types/ImgProps.d.ts +0 -7
  176. package/dist/models/prop-types/InputContainerProps.d.ts +0 -26
  177. package/dist/models/prop-types/InputProps/CheckInputProps.d.ts +0 -5
  178. package/dist/models/prop-types/InputProps/DropdownPickerProps.d.ts +0 -24
  179. package/dist/models/prop-types/InputProps/FileInputProps.d.ts +0 -6
  180. package/dist/models/prop-types/InputProps/InputBaseProps.d.ts +0 -15
  181. package/dist/models/prop-types/InputProps/NumericInputProps.d.ts +0 -6
  182. package/dist/models/prop-types/InputProps/RadioInputProps.d.ts +0 -6
  183. package/dist/models/prop-types/InputProps/SelectInputProps.d.ts +0 -9
  184. package/dist/models/prop-types/InputProps/TextAreaInputProps.d.ts +0 -5
  185. package/dist/models/prop-types/InputProps/TextInputProps.d.ts +0 -10
  186. package/dist/models/texts/AppSearchTexts.d.ts +0 -5
  187. package/dist/models/texts/AxiosTexts.d.ts +0 -8
  188. package/dist/models/texts/ConfirmTexts.d.ts +0 -7
  189. package/dist/models/texts/CustomSelectTexts.d.ts +0 -5
  190. package/dist/models/texts/DropdownPickerTexts.d.ts +0 -5
  191. package/dist/models/texts/ErrorBoundaryTexts.d.ts +0 -5
  192. package/dist/models/texts/FormSubmitTexts.d.ts +0 -4
  193. package/dist/models/texts/FormValidationTexts.d.ts +0 -5
  194. package/dist/models/texts/HomeDashboardTexts.d.ts +0 -6
  195. package/dist/models/texts/WidgetTexts.d.ts +0 -4
  196. package/dist/models/types/ApiErrorResult.d.ts +0 -8
  197. package/dist/models/types/DashboardConfig.d.ts +0 -5
  198. package/dist/models/types/DashboardWidget.d.ts +0 -9
  199. package/dist/models/types/DashboardWidgetConfig.d.ts +0 -5
  200. package/dist/models/types/DropdownPickerOption.d.ts +0 -7
  201. package/dist/models/types/EmployeeIndexModel.d.ts +0 -14
  202. package/dist/models/types/ErrorField.d.ts +0 -5
  203. package/dist/models/types/FormSelectOption.d.ts +0 -5
  204. package/dist/models/types/HookFormInputProps.d.ts +0 -9
  205. package/dist/models/types/LoginState.d.ts +0 -7
  206. package/dist/models/types/MenuItemType.d.ts +0 -11
  207. package/dist/models/types/MenuItemTypeExtended.d.ts +0 -6
  208. package/dist/models/types/NameIdIntModel.d.ts +0 -5
  209. package/dist/models/types/NameIdIntOptionalModel.d.ts +0 -5
  210. package/dist/models/types/NameIdStringModel.d.ts +0 -5
  211. package/dist/models/types/NameIdStringOptionalModel.d.ts +0 -5
  212. package/dist/models/types/PhotoAction.d.ts +0 -9
  213. package/dist/models/types/PhotoLibraryItemModel.d.ts +0 -7
  214. package/dist/models/types/PromptOptions.d.ts +0 -7
  215. package/dist/models/types/SearchResultGroupKeyModel.d.ts +0 -6
  216. package/dist/models/types/SearchResultGroupModel.d.ts +0 -7
  217. package/dist/models/types/SearchResultModel.d.ts +0 -8
  218. package/dist/models/types/SearchType.d.ts +0 -6
  219. package/dist/models/types/TimelineStep.d.ts +0 -11
  220. package/dist/models/types/TimelineStepState.d.ts +0 -5
  221. package/dist/models/types/UseGetApiDataOptions.d.ts +0 -9
  222. package/dist/models/types/UserLoginState.d.ts +0 -7
  223. package/dist/models/types/UserModel.d.ts +0 -11
  224. package/dist/searchUtils-Do20vjZW.cjs +0 -1
  225. package/dist/searchUtils-Du4JnXdQ.js +0 -7
  226. package/dist/style.css +0 -1
  227. package/dist/useConfirm-95WxctJ9.cjs +0 -1
  228. package/dist/useConfirm-DkHhgyYO.js +0 -27
  229. package/dist/useFormControlType-BAFqxupC.js +0 -20
  230. package/dist/useFormControlType-Dqz8sV4J.cjs +0 -1
  231. package/dist/usePermissions-B2G69gWH.js +0 -14
  232. package/dist/usePermissions-kfYKLHzs.cjs +0 -1
  233. package/dist/utils/apiErrorFields/apiErrorFieldsUtils.d.ts +0 -4
  234. package/dist/utils/date/dateUtils.d.ts +0 -1
  235. package/dist/utils/hookForm/hookFormUtils.d.ts +0 -3
  236. package/dist/utils/index.d.ts +0 -6
  237. package/dist/utils/object/objectUtils.d.ts +0 -2
  238. package/dist/utils/search/searchUtils.d.ts +0 -3
  239. package/dist/utils/text/textUtils.d.ts +0 -3
  240. package/dist/utils.cjs.js +0 -1
  241. package/dist/utils.d.ts +0 -1
  242. package/dist/utils.es.js +0 -27
package/dist/hooks.es.js DELETED
@@ -1,2988 +0,0 @@
1
- import { Q as Xe, a4 as Me, ap as Ke } from "./NoInputContainer-C2e1tx-D.js";
2
- import { aI as yr, a9 as _r, aH as vr } from "./NoInputContainer-C2e1tx-D.js";
3
- import { a as xr, u as kr } from "./useConfirm-DkHhgyYO.js";
4
- import { useContext as ze, useRef as Fe, useState as Pe, useCallback as et, useEffect as De } from "react";
5
- import { f as tt } from "./latinize-BQrinury.js";
6
- import { i as rt } from "./dateUtils-7nL2BXlo.js";
7
- import "react-hook-form";
8
- import { a as wr, b as Tr, u as Zr } from "./useFormControlType-BAFqxupC.js";
9
- import { u as Sr } from "./usePermissions-B2G69gWH.js";
10
- var x;
11
- (function(r) {
12
- r.assertEqual = (s) => s;
13
- function e(s) {
14
- }
15
- r.assertIs = e;
16
- function t(s) {
17
- throw new Error();
18
- }
19
- r.assertNever = t, r.arrayToEnum = (s) => {
20
- const a = {};
21
- for (const i of s)
22
- a[i] = i;
23
- return a;
24
- }, r.getValidEnumValues = (s) => {
25
- const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
26
- for (const o of a)
27
- i[o] = s[o];
28
- return r.objectValues(i);
29
- }, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
30
- return s[a];
31
- }), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
32
- const a = [];
33
- for (const i in s)
34
- Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
35
- return a;
36
- }, r.find = (s, a) => {
37
- for (const i of s)
38
- if (a(i))
39
- return i;
40
- }, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
41
- function n(s, a = " | ") {
42
- return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
43
- }
44
- r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
45
- })(x || (x = {}));
46
- var Oe;
47
- (function(r) {
48
- r.mergeShapes = (e, t) => ({
49
- ...e,
50
- ...t
51
- // second overwrites first
52
- });
53
- })(Oe || (Oe = {}));
54
- const f = x.arrayToEnum([
55
- "string",
56
- "nan",
57
- "number",
58
- "integer",
59
- "float",
60
- "boolean",
61
- "date",
62
- "bigint",
63
- "symbol",
64
- "function",
65
- "undefined",
66
- "null",
67
- "array",
68
- "object",
69
- "unknown",
70
- "promise",
71
- "void",
72
- "never",
73
- "map",
74
- "set"
75
- ]), D = (r) => {
76
- switch (typeof r) {
77
- case "undefined":
78
- return f.undefined;
79
- case "string":
80
- return f.string;
81
- case "number":
82
- return isNaN(r) ? f.nan : f.number;
83
- case "boolean":
84
- return f.boolean;
85
- case "function":
86
- return f.function;
87
- case "bigint":
88
- return f.bigint;
89
- case "symbol":
90
- return f.symbol;
91
- case "object":
92
- return Array.isArray(r) ? f.array : r === null ? f.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? f.promise : typeof Map < "u" && r instanceof Map ? f.map : typeof Set < "u" && r instanceof Set ? f.set : typeof Date < "u" && r instanceof Date ? f.date : f.object;
93
- default:
94
- return f.unknown;
95
- }
96
- }, d = x.arrayToEnum([
97
- "invalid_type",
98
- "invalid_literal",
99
- "custom",
100
- "invalid_union",
101
- "invalid_union_discriminator",
102
- "invalid_enum_value",
103
- "unrecognized_keys",
104
- "invalid_arguments",
105
- "invalid_return_type",
106
- "invalid_date",
107
- "invalid_string",
108
- "too_small",
109
- "too_big",
110
- "invalid_intersection_types",
111
- "not_multiple_of",
112
- "not_finite"
113
- ]), nt = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
114
- class N extends Error {
115
- constructor(e) {
116
- super(), this.issues = [], this.addIssue = (n) => {
117
- this.issues = [...this.issues, n];
118
- }, this.addIssues = (n = []) => {
119
- this.issues = [...this.issues, ...n];
120
- };
121
- const t = new.target.prototype;
122
- Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
123
- }
124
- get errors() {
125
- return this.issues;
126
- }
127
- format(e) {
128
- const t = e || function(a) {
129
- return a.message;
130
- }, n = { _errors: [] }, s = (a) => {
131
- for (const i of a.issues)
132
- if (i.code === "invalid_union")
133
- i.unionErrors.map(s);
134
- else if (i.code === "invalid_return_type")
135
- s(i.returnTypeError);
136
- else if (i.code === "invalid_arguments")
137
- s(i.argumentsError);
138
- else if (i.path.length === 0)
139
- n._errors.push(t(i));
140
- else {
141
- let o = n, u = 0;
142
- for (; u < i.path.length; ) {
143
- const c = i.path[u];
144
- u === i.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(t(i))) : o[c] = o[c] || { _errors: [] }, o = o[c], u++;
145
- }
146
- }
147
- };
148
- return s(this), n;
149
- }
150
- static assert(e) {
151
- if (!(e instanceof N))
152
- throw new Error(`Not a ZodError: ${e}`);
153
- }
154
- toString() {
155
- return this.message;
156
- }
157
- get message() {
158
- return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
159
- }
160
- get isEmpty() {
161
- return this.issues.length === 0;
162
- }
163
- flatten(e = (t) => t.message) {
164
- const t = {}, n = [];
165
- for (const s of this.issues)
166
- s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : n.push(e(s));
167
- return { formErrors: n, fieldErrors: t };
168
- }
169
- get formErrors() {
170
- return this.flatten();
171
- }
172
- }
173
- N.create = (r) => new N(r);
174
- const X = (r, e) => {
175
- let t;
176
- switch (r.code) {
177
- case d.invalid_type:
178
- r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
179
- break;
180
- case d.invalid_literal:
181
- t = `Invalid literal value, expected ${JSON.stringify(r.expected, x.jsonStringifyReplacer)}`;
182
- break;
183
- case d.unrecognized_keys:
184
- t = `Unrecognized key(s) in object: ${x.joinValues(r.keys, ", ")}`;
185
- break;
186
- case d.invalid_union:
187
- t = "Invalid input";
188
- break;
189
- case d.invalid_union_discriminator:
190
- t = `Invalid discriminator value. Expected ${x.joinValues(r.options)}`;
191
- break;
192
- case d.invalid_enum_value:
193
- t = `Invalid enum value. Expected ${x.joinValues(r.options)}, received '${r.received}'`;
194
- break;
195
- case d.invalid_arguments:
196
- t = "Invalid function arguments";
197
- break;
198
- case d.invalid_return_type:
199
- t = "Invalid function return type";
200
- break;
201
- case d.invalid_date:
202
- t = "Invalid date";
203
- break;
204
- case d.invalid_string:
205
- typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : x.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
206
- break;
207
- case d.too_small:
208
- r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input";
209
- break;
210
- case d.too_big:
211
- r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input";
212
- break;
213
- case d.custom:
214
- t = "Invalid input";
215
- break;
216
- case d.invalid_intersection_types:
217
- t = "Intersection results could not be merged";
218
- break;
219
- case d.not_multiple_of:
220
- t = `Number must be a multiple of ${r.multipleOf}`;
221
- break;
222
- case d.not_finite:
223
- t = "Number must be finite";
224
- break;
225
- default:
226
- t = e.defaultError, x.assertNever(r);
227
- }
228
- return { message: t };
229
- };
230
- let Ve = X;
231
- function st(r) {
232
- Ve = r;
233
- }
234
- function ge() {
235
- return Ve;
236
- }
237
- const xe = (r) => {
238
- const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
239
- ...s,
240
- path: a
241
- };
242
- if (s.message !== void 0)
243
- return {
244
- ...s,
245
- path: a,
246
- message: s.message
247
- };
248
- let o = "";
249
- const u = n.filter((c) => !!c).slice().reverse();
250
- for (const c of u)
251
- o = c(i, { data: e, defaultError: o }).message;
252
- return {
253
- ...s,
254
- path: a,
255
- message: o
256
- };
257
- }, at = [];
258
- function l(r, e) {
259
- const t = ge(), n = xe({
260
- issueData: e,
261
- data: r.data,
262
- path: r.path,
263
- errorMaps: [
264
- r.common.contextualErrorMap,
265
- r.schemaErrorMap,
266
- t,
267
- t === X ? void 0 : X
268
- // then global default map
269
- ].filter((s) => !!s)
270
- });
271
- r.common.issues.push(n);
272
- }
273
- class Z {
274
- constructor() {
275
- this.value = "valid";
276
- }
277
- dirty() {
278
- this.value === "valid" && (this.value = "dirty");
279
- }
280
- abort() {
281
- this.value !== "aborted" && (this.value = "aborted");
282
- }
283
- static mergeArray(e, t) {
284
- const n = [];
285
- for (const s of t) {
286
- if (s.status === "aborted")
287
- return y;
288
- s.status === "dirty" && e.dirty(), n.push(s.value);
289
- }
290
- return { status: e.value, value: n };
291
- }
292
- static async mergeObjectAsync(e, t) {
293
- const n = [];
294
- for (const s of t) {
295
- const a = await s.key, i = await s.value;
296
- n.push({
297
- key: a,
298
- value: i
299
- });
300
- }
301
- return Z.mergeObjectSync(e, n);
302
- }
303
- static mergeObjectSync(e, t) {
304
- const n = {};
305
- for (const s of t) {
306
- const { key: a, value: i } = s;
307
- if (a.status === "aborted" || i.status === "aborted")
308
- return y;
309
- a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
310
- }
311
- return { status: e.value, value: n };
312
- }
313
- }
314
- const y = Object.freeze({
315
- status: "aborted"
316
- }), G = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), Ne = (r) => r.status === "aborted", Ee = (r) => r.status === "dirty", se = (r) => r.status === "valid", ae = (r) => typeof Promise < "u" && r instanceof Promise;
317
- function ke(r, e, t, n) {
318
- if (typeof e == "function" ? r !== e || !n : !e.has(r))
319
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
320
- return e.get(r);
321
- }
322
- function Le(r, e, t, n, s) {
323
- if (typeof e == "function" ? r !== e || !s : !e.has(r))
324
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
325
- return e.set(r, t), t;
326
- }
327
- var h;
328
- (function(r) {
329
- r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
330
- })(h || (h = {}));
331
- var re, ne;
332
- class A {
333
- constructor(e, t, n, s) {
334
- this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
335
- }
336
- get path() {
337
- return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
338
- }
339
- }
340
- const Ae = (r, e) => {
341
- if (se(e))
342
- return { success: !0, data: e.value };
343
- if (!r.common.issues.length)
344
- throw new Error("Validation failed but no issues detected.");
345
- return {
346
- success: !1,
347
- get error() {
348
- if (this._error)
349
- return this._error;
350
- const t = new N(r.common.issues);
351
- return this._error = t, this._error;
352
- }
353
- };
354
- };
355
- function v(r) {
356
- if (!r)
357
- return {};
358
- const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
359
- if (e && (t || n))
360
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
361
- return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
362
- var u, c;
363
- const { message: m } = r;
364
- return i.code === "invalid_enum_value" ? { message: m ?? o.defaultError } : typeof o.data > "u" ? { message: (u = m ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = m ?? t) !== null && c !== void 0 ? c : o.defaultError };
365
- }, description: s };
366
- }
367
- class g {
368
- constructor(e) {
369
- 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);
370
- }
371
- get description() {
372
- return this._def.description;
373
- }
374
- _getType(e) {
375
- return D(e.data);
376
- }
377
- _getOrReturnCtx(e, t) {
378
- return t || {
379
- common: e.parent.common,
380
- data: e.data,
381
- parsedType: D(e.data),
382
- schemaErrorMap: this._def.errorMap,
383
- path: e.path,
384
- parent: e.parent
385
- };
386
- }
387
- _processInputParams(e) {
388
- return {
389
- status: new Z(),
390
- ctx: {
391
- common: e.parent.common,
392
- data: e.data,
393
- parsedType: D(e.data),
394
- schemaErrorMap: this._def.errorMap,
395
- path: e.path,
396
- parent: e.parent
397
- }
398
- };
399
- }
400
- _parseSync(e) {
401
- const t = this._parse(e);
402
- if (ae(t))
403
- throw new Error("Synchronous parse encountered promise.");
404
- return t;
405
- }
406
- _parseAsync(e) {
407
- const t = this._parse(e);
408
- return Promise.resolve(t);
409
- }
410
- parse(e, t) {
411
- const n = this.safeParse(e, t);
412
- if (n.success)
413
- return n.data;
414
- throw n.error;
415
- }
416
- safeParse(e, t) {
417
- var n;
418
- const s = {
419
- common: {
420
- issues: [],
421
- async: (n = t == null ? void 0 : t.async) !== null && n !== void 0 ? n : !1,
422
- contextualErrorMap: t == null ? void 0 : t.errorMap
423
- },
424
- path: (t == null ? void 0 : t.path) || [],
425
- schemaErrorMap: this._def.errorMap,
426
- parent: null,
427
- data: e,
428
- parsedType: D(e)
429
- }, a = this._parseSync({ data: e, path: s.path, parent: s });
430
- return Ae(s, a);
431
- }
432
- async parseAsync(e, t) {
433
- const n = await this.safeParseAsync(e, t);
434
- if (n.success)
435
- return n.data;
436
- throw n.error;
437
- }
438
- async safeParseAsync(e, t) {
439
- const n = {
440
- common: {
441
- issues: [],
442
- contextualErrorMap: t == null ? void 0 : t.errorMap,
443
- async: !0
444
- },
445
- path: (t == null ? void 0 : t.path) || [],
446
- schemaErrorMap: this._def.errorMap,
447
- parent: null,
448
- data: e,
449
- parsedType: D(e)
450
- }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ae(s) ? s : Promise.resolve(s));
451
- return Ae(n, a);
452
- }
453
- refine(e, t) {
454
- const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
455
- return this._refinement((s, a) => {
456
- const i = e(s), o = () => a.addIssue({
457
- code: d.custom,
458
- ...n(s)
459
- });
460
- return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
461
- });
462
- }
463
- refinement(e, t) {
464
- return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
465
- }
466
- _refinement(e) {
467
- return new I({
468
- schema: this,
469
- typeName: p.ZodEffects,
470
- effect: { type: "refinement", refinement: e }
471
- });
472
- }
473
- superRefine(e) {
474
- return this._refinement(e);
475
- }
476
- optional() {
477
- return j.create(this, this._def);
478
- }
479
- nullable() {
480
- return U.create(this, this._def);
481
- }
482
- nullish() {
483
- return this.nullable().optional();
484
- }
485
- array() {
486
- return R.create(this, this._def);
487
- }
488
- promise() {
489
- return F.create(this, this._def);
490
- }
491
- or(e) {
492
- return ce.create([this, e], this._def);
493
- }
494
- and(e) {
495
- return ue.create(this, e, this._def);
496
- }
497
- transform(e) {
498
- return new I({
499
- ...v(this._def),
500
- schema: this,
501
- typeName: p.ZodEffects,
502
- effect: { type: "transform", transform: e }
503
- });
504
- }
505
- default(e) {
506
- const t = typeof e == "function" ? e : () => e;
507
- return new pe({
508
- ...v(this._def),
509
- innerType: this,
510
- defaultValue: t,
511
- typeName: p.ZodDefault
512
- });
513
- }
514
- brand() {
515
- return new Ie({
516
- typeName: p.ZodBranded,
517
- type: this,
518
- ...v(this._def)
519
- });
520
- }
521
- catch(e) {
522
- const t = typeof e == "function" ? e : () => e;
523
- return new ye({
524
- ...v(this._def),
525
- innerType: this,
526
- catchValue: t,
527
- typeName: p.ZodCatch
528
- });
529
- }
530
- describe(e) {
531
- const t = this.constructor;
532
- return new t({
533
- ...this._def,
534
- description: e
535
- });
536
- }
537
- pipe(e) {
538
- return ve.create(this, e);
539
- }
540
- readonly() {
541
- return _e.create(this);
542
- }
543
- isOptional() {
544
- return this.safeParse(void 0).success;
545
- }
546
- isNullable() {
547
- return this.safeParse(null).success;
548
- }
549
- }
550
- const it = /^c[^\s-]{8,}$/i, ot = /^[0-9a-z]+$/, dt = /^[0-9A-HJKMNP-TV-Z]{26}$/, ct = /^[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, ut = /^[a-z0-9_-]{21}$/i, lt = /^[-+]?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)?)??$/, ft = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, ht = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
551
- let Se;
552
- const mt = /^(?:(?: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])$/, pt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, yt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, qe = "((\\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])))", _t = new RegExp(`^${qe}$`);
553
- function Ue(r) {
554
- let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
555
- return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
556
- }
557
- function vt(r) {
558
- return new RegExp(`^${Ue(r)}$`);
559
- }
560
- function Be(r) {
561
- let e = `${qe}T${Ue(r)}`;
562
- const t = [];
563
- return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
564
- }
565
- function gt(r, e) {
566
- return !!((e === "v4" || !e) && mt.test(r) || (e === "v6" || !e) && pt.test(r));
567
- }
568
- class E extends g {
569
- _parse(e) {
570
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
571
- const a = this._getOrReturnCtx(e);
572
- return l(a, {
573
- code: d.invalid_type,
574
- expected: f.string,
575
- received: a.parsedType
576
- }), y;
577
- }
578
- const n = new Z();
579
- let s;
580
- for (const a of this._def.checks)
581
- if (a.kind === "min")
582
- e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
583
- code: d.too_small,
584
- minimum: a.value,
585
- type: "string",
586
- inclusive: !0,
587
- exact: !1,
588
- message: a.message
589
- }), n.dirty());
590
- else if (a.kind === "max")
591
- e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
592
- code: d.too_big,
593
- maximum: a.value,
594
- type: "string",
595
- inclusive: !0,
596
- exact: !1,
597
- message: a.message
598
- }), n.dirty());
599
- else if (a.kind === "length") {
600
- const i = e.data.length > a.value, o = e.data.length < a.value;
601
- (i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
602
- code: d.too_big,
603
- maximum: a.value,
604
- type: "string",
605
- inclusive: !0,
606
- exact: !0,
607
- message: a.message
608
- }) : o && l(s, {
609
- code: d.too_small,
610
- minimum: a.value,
611
- type: "string",
612
- inclusive: !0,
613
- exact: !0,
614
- message: a.message
615
- }), n.dirty());
616
- } else if (a.kind === "email")
617
- ft.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
618
- validation: "email",
619
- code: d.invalid_string,
620
- message: a.message
621
- }), n.dirty());
622
- else if (a.kind === "emoji")
623
- Se || (Se = new RegExp(ht, "u")), Se.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
624
- validation: "emoji",
625
- code: d.invalid_string,
626
- message: a.message
627
- }), n.dirty());
628
- else if (a.kind === "uuid")
629
- ct.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
630
- validation: "uuid",
631
- code: d.invalid_string,
632
- message: a.message
633
- }), n.dirty());
634
- else if (a.kind === "nanoid")
635
- ut.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
636
- validation: "nanoid",
637
- code: d.invalid_string,
638
- message: a.message
639
- }), n.dirty());
640
- else if (a.kind === "cuid")
641
- it.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
642
- validation: "cuid",
643
- code: d.invalid_string,
644
- message: a.message
645
- }), n.dirty());
646
- else if (a.kind === "cuid2")
647
- ot.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
648
- validation: "cuid2",
649
- code: d.invalid_string,
650
- message: a.message
651
- }), n.dirty());
652
- else if (a.kind === "ulid")
653
- dt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
654
- validation: "ulid",
655
- code: d.invalid_string,
656
- message: a.message
657
- }), n.dirty());
658
- else if (a.kind === "url")
659
- try {
660
- new URL(e.data);
661
- } catch {
662
- s = this._getOrReturnCtx(e, s), l(s, {
663
- validation: "url",
664
- code: d.invalid_string,
665
- message: a.message
666
- }), n.dirty();
667
- }
668
- else
669
- a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
670
- validation: "regex",
671
- code: d.invalid_string,
672
- message: a.message
673
- }), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), l(s, {
674
- code: d.invalid_string,
675
- validation: { includes: a.value, position: a.position },
676
- message: a.message
677
- }), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
678
- code: d.invalid_string,
679
- validation: { startsWith: a.value },
680
- message: a.message
681
- }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
682
- code: d.invalid_string,
683
- validation: { endsWith: a.value },
684
- message: a.message
685
- }), n.dirty()) : a.kind === "datetime" ? Be(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
686
- code: d.invalid_string,
687
- validation: "datetime",
688
- message: a.message
689
- }), n.dirty()) : a.kind === "date" ? _t.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
690
- code: d.invalid_string,
691
- validation: "date",
692
- message: a.message
693
- }), n.dirty()) : a.kind === "time" ? vt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
694
- code: d.invalid_string,
695
- validation: "time",
696
- message: a.message
697
- }), n.dirty()) : a.kind === "duration" ? lt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
698
- validation: "duration",
699
- code: d.invalid_string,
700
- message: a.message
701
- }), n.dirty()) : a.kind === "ip" ? gt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
702
- validation: "ip",
703
- code: d.invalid_string,
704
- message: a.message
705
- }), n.dirty()) : a.kind === "base64" ? yt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
706
- validation: "base64",
707
- code: d.invalid_string,
708
- message: a.message
709
- }), n.dirty()) : x.assertNever(a);
710
- return { status: n.value, value: e.data };
711
- }
712
- _regex(e, t, n) {
713
- return this.refinement((s) => e.test(s), {
714
- validation: t,
715
- code: d.invalid_string,
716
- ...h.errToObj(n)
717
- });
718
- }
719
- _addCheck(e) {
720
- return new E({
721
- ...this._def,
722
- checks: [...this._def.checks, e]
723
- });
724
- }
725
- email(e) {
726
- return this._addCheck({ kind: "email", ...h.errToObj(e) });
727
- }
728
- url(e) {
729
- return this._addCheck({ kind: "url", ...h.errToObj(e) });
730
- }
731
- emoji(e) {
732
- return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
733
- }
734
- uuid(e) {
735
- return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
736
- }
737
- nanoid(e) {
738
- return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
739
- }
740
- cuid(e) {
741
- return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
742
- }
743
- cuid2(e) {
744
- return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
745
- }
746
- ulid(e) {
747
- return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
748
- }
749
- base64(e) {
750
- return this._addCheck({ kind: "base64", ...h.errToObj(e) });
751
- }
752
- ip(e) {
753
- return this._addCheck({ kind: "ip", ...h.errToObj(e) });
754
- }
755
- datetime(e) {
756
- var t, n;
757
- return typeof e == "string" ? this._addCheck({
758
- kind: "datetime",
759
- precision: null,
760
- offset: !1,
761
- local: !1,
762
- message: e
763
- }) : this._addCheck({
764
- kind: "datetime",
765
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
766
- offset: (t = e == null ? void 0 : e.offset) !== null && t !== void 0 ? t : !1,
767
- local: (n = e == null ? void 0 : e.local) !== null && n !== void 0 ? n : !1,
768
- ...h.errToObj(e == null ? void 0 : e.message)
769
- });
770
- }
771
- date(e) {
772
- return this._addCheck({ kind: "date", message: e });
773
- }
774
- time(e) {
775
- return typeof e == "string" ? this._addCheck({
776
- kind: "time",
777
- precision: null,
778
- message: e
779
- }) : this._addCheck({
780
- kind: "time",
781
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
782
- ...h.errToObj(e == null ? void 0 : e.message)
783
- });
784
- }
785
- duration(e) {
786
- return this._addCheck({ kind: "duration", ...h.errToObj(e) });
787
- }
788
- regex(e, t) {
789
- return this._addCheck({
790
- kind: "regex",
791
- regex: e,
792
- ...h.errToObj(t)
793
- });
794
- }
795
- includes(e, t) {
796
- return this._addCheck({
797
- kind: "includes",
798
- value: e,
799
- position: t == null ? void 0 : t.position,
800
- ...h.errToObj(t == null ? void 0 : t.message)
801
- });
802
- }
803
- startsWith(e, t) {
804
- return this._addCheck({
805
- kind: "startsWith",
806
- value: e,
807
- ...h.errToObj(t)
808
- });
809
- }
810
- endsWith(e, t) {
811
- return this._addCheck({
812
- kind: "endsWith",
813
- value: e,
814
- ...h.errToObj(t)
815
- });
816
- }
817
- min(e, t) {
818
- return this._addCheck({
819
- kind: "min",
820
- value: e,
821
- ...h.errToObj(t)
822
- });
823
- }
824
- max(e, t) {
825
- return this._addCheck({
826
- kind: "max",
827
- value: e,
828
- ...h.errToObj(t)
829
- });
830
- }
831
- length(e, t) {
832
- return this._addCheck({
833
- kind: "length",
834
- value: e,
835
- ...h.errToObj(t)
836
- });
837
- }
838
- /**
839
- * @deprecated Use z.string().min(1) instead.
840
- * @see {@link ZodString.min}
841
- */
842
- nonempty(e) {
843
- return this.min(1, h.errToObj(e));
844
- }
845
- trim() {
846
- return new E({
847
- ...this._def,
848
- checks: [...this._def.checks, { kind: "trim" }]
849
- });
850
- }
851
- toLowerCase() {
852
- return new E({
853
- ...this._def,
854
- checks: [...this._def.checks, { kind: "toLowerCase" }]
855
- });
856
- }
857
- toUpperCase() {
858
- return new E({
859
- ...this._def,
860
- checks: [...this._def.checks, { kind: "toUpperCase" }]
861
- });
862
- }
863
- get isDatetime() {
864
- return !!this._def.checks.find((e) => e.kind === "datetime");
865
- }
866
- get isDate() {
867
- return !!this._def.checks.find((e) => e.kind === "date");
868
- }
869
- get isTime() {
870
- return !!this._def.checks.find((e) => e.kind === "time");
871
- }
872
- get isDuration() {
873
- return !!this._def.checks.find((e) => e.kind === "duration");
874
- }
875
- get isEmail() {
876
- return !!this._def.checks.find((e) => e.kind === "email");
877
- }
878
- get isURL() {
879
- return !!this._def.checks.find((e) => e.kind === "url");
880
- }
881
- get isEmoji() {
882
- return !!this._def.checks.find((e) => e.kind === "emoji");
883
- }
884
- get isUUID() {
885
- return !!this._def.checks.find((e) => e.kind === "uuid");
886
- }
887
- get isNANOID() {
888
- return !!this._def.checks.find((e) => e.kind === "nanoid");
889
- }
890
- get isCUID() {
891
- return !!this._def.checks.find((e) => e.kind === "cuid");
892
- }
893
- get isCUID2() {
894
- return !!this._def.checks.find((e) => e.kind === "cuid2");
895
- }
896
- get isULID() {
897
- return !!this._def.checks.find((e) => e.kind === "ulid");
898
- }
899
- get isIP() {
900
- return !!this._def.checks.find((e) => e.kind === "ip");
901
- }
902
- get isBase64() {
903
- return !!this._def.checks.find((e) => e.kind === "base64");
904
- }
905
- get minLength() {
906
- let e = null;
907
- for (const t of this._def.checks)
908
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
909
- return e;
910
- }
911
- get maxLength() {
912
- let e = null;
913
- for (const t of this._def.checks)
914
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
915
- return e;
916
- }
917
- }
918
- E.create = (r) => {
919
- var e;
920
- return new E({
921
- checks: [],
922
- typeName: p.ZodString,
923
- coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
924
- ...v(r)
925
- });
926
- };
927
- function xt(r, e) {
928
- const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
929
- return a % i / Math.pow(10, s);
930
- }
931
- class V extends g {
932
- constructor() {
933
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
934
- }
935
- _parse(e) {
936
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
937
- const a = this._getOrReturnCtx(e);
938
- return l(a, {
939
- code: d.invalid_type,
940
- expected: f.number,
941
- received: a.parsedType
942
- }), y;
943
- }
944
- let n;
945
- const s = new Z();
946
- for (const a of this._def.checks)
947
- a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
948
- code: d.invalid_type,
949
- expected: "integer",
950
- received: "float",
951
- message: a.message
952
- }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
953
- code: d.too_small,
954
- minimum: a.value,
955
- type: "number",
956
- inclusive: a.inclusive,
957
- exact: !1,
958
- message: a.message
959
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
960
- code: d.too_big,
961
- maximum: a.value,
962
- type: "number",
963
- inclusive: a.inclusive,
964
- exact: !1,
965
- message: a.message
966
- }), s.dirty()) : a.kind === "multipleOf" ? xt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
967
- code: d.not_multiple_of,
968
- multipleOf: a.value,
969
- message: a.message
970
- }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
971
- code: d.not_finite,
972
- message: a.message
973
- }), s.dirty()) : x.assertNever(a);
974
- return { status: s.value, value: e.data };
975
- }
976
- gte(e, t) {
977
- return this.setLimit("min", e, !0, h.toString(t));
978
- }
979
- gt(e, t) {
980
- return this.setLimit("min", e, !1, h.toString(t));
981
- }
982
- lte(e, t) {
983
- return this.setLimit("max", e, !0, h.toString(t));
984
- }
985
- lt(e, t) {
986
- return this.setLimit("max", e, !1, h.toString(t));
987
- }
988
- setLimit(e, t, n, s) {
989
- return new V({
990
- ...this._def,
991
- checks: [
992
- ...this._def.checks,
993
- {
994
- kind: e,
995
- value: t,
996
- inclusive: n,
997
- message: h.toString(s)
998
- }
999
- ]
1000
- });
1001
- }
1002
- _addCheck(e) {
1003
- return new V({
1004
- ...this._def,
1005
- checks: [...this._def.checks, e]
1006
- });
1007
- }
1008
- int(e) {
1009
- return this._addCheck({
1010
- kind: "int",
1011
- message: h.toString(e)
1012
- });
1013
- }
1014
- positive(e) {
1015
- return this._addCheck({
1016
- kind: "min",
1017
- value: 0,
1018
- inclusive: !1,
1019
- message: h.toString(e)
1020
- });
1021
- }
1022
- negative(e) {
1023
- return this._addCheck({
1024
- kind: "max",
1025
- value: 0,
1026
- inclusive: !1,
1027
- message: h.toString(e)
1028
- });
1029
- }
1030
- nonpositive(e) {
1031
- return this._addCheck({
1032
- kind: "max",
1033
- value: 0,
1034
- inclusive: !0,
1035
- message: h.toString(e)
1036
- });
1037
- }
1038
- nonnegative(e) {
1039
- return this._addCheck({
1040
- kind: "min",
1041
- value: 0,
1042
- inclusive: !0,
1043
- message: h.toString(e)
1044
- });
1045
- }
1046
- multipleOf(e, t) {
1047
- return this._addCheck({
1048
- kind: "multipleOf",
1049
- value: e,
1050
- message: h.toString(t)
1051
- });
1052
- }
1053
- finite(e) {
1054
- return this._addCheck({
1055
- kind: "finite",
1056
- message: h.toString(e)
1057
- });
1058
- }
1059
- safe(e) {
1060
- return this._addCheck({
1061
- kind: "min",
1062
- inclusive: !0,
1063
- value: Number.MIN_SAFE_INTEGER,
1064
- message: h.toString(e)
1065
- })._addCheck({
1066
- kind: "max",
1067
- inclusive: !0,
1068
- value: Number.MAX_SAFE_INTEGER,
1069
- message: h.toString(e)
1070
- });
1071
- }
1072
- get minValue() {
1073
- let e = null;
1074
- for (const t of this._def.checks)
1075
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1076
- return e;
1077
- }
1078
- get maxValue() {
1079
- let e = null;
1080
- for (const t of this._def.checks)
1081
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1082
- return e;
1083
- }
1084
- get isInt() {
1085
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
1086
- }
1087
- get isFinite() {
1088
- let e = null, t = null;
1089
- for (const n of this._def.checks) {
1090
- if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
1091
- return !0;
1092
- n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1093
- }
1094
- return Number.isFinite(t) && Number.isFinite(e);
1095
- }
1096
- }
1097
- V.create = (r) => new V({
1098
- checks: [],
1099
- typeName: p.ZodNumber,
1100
- coerce: (r == null ? void 0 : r.coerce) || !1,
1101
- ...v(r)
1102
- });
1103
- class L extends g {
1104
- constructor() {
1105
- super(...arguments), this.min = this.gte, this.max = this.lte;
1106
- }
1107
- _parse(e) {
1108
- if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== f.bigint) {
1109
- const a = this._getOrReturnCtx(e);
1110
- return l(a, {
1111
- code: d.invalid_type,
1112
- expected: f.bigint,
1113
- received: a.parsedType
1114
- }), y;
1115
- }
1116
- let n;
1117
- const s = new Z();
1118
- for (const a of this._def.checks)
1119
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1120
- code: d.too_small,
1121
- type: "bigint",
1122
- minimum: a.value,
1123
- inclusive: a.inclusive,
1124
- message: a.message
1125
- }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1126
- code: d.too_big,
1127
- type: "bigint",
1128
- maximum: a.value,
1129
- inclusive: a.inclusive,
1130
- message: a.message
1131
- }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
1132
- code: d.not_multiple_of,
1133
- multipleOf: a.value,
1134
- message: a.message
1135
- }), s.dirty()) : x.assertNever(a);
1136
- return { status: s.value, value: e.data };
1137
- }
1138
- gte(e, t) {
1139
- return this.setLimit("min", e, !0, h.toString(t));
1140
- }
1141
- gt(e, t) {
1142
- return this.setLimit("min", e, !1, h.toString(t));
1143
- }
1144
- lte(e, t) {
1145
- return this.setLimit("max", e, !0, h.toString(t));
1146
- }
1147
- lt(e, t) {
1148
- return this.setLimit("max", e, !1, h.toString(t));
1149
- }
1150
- setLimit(e, t, n, s) {
1151
- return new L({
1152
- ...this._def,
1153
- checks: [
1154
- ...this._def.checks,
1155
- {
1156
- kind: e,
1157
- value: t,
1158
- inclusive: n,
1159
- message: h.toString(s)
1160
- }
1161
- ]
1162
- });
1163
- }
1164
- _addCheck(e) {
1165
- return new L({
1166
- ...this._def,
1167
- checks: [...this._def.checks, e]
1168
- });
1169
- }
1170
- positive(e) {
1171
- return this._addCheck({
1172
- kind: "min",
1173
- value: BigInt(0),
1174
- inclusive: !1,
1175
- message: h.toString(e)
1176
- });
1177
- }
1178
- negative(e) {
1179
- return this._addCheck({
1180
- kind: "max",
1181
- value: BigInt(0),
1182
- inclusive: !1,
1183
- message: h.toString(e)
1184
- });
1185
- }
1186
- nonpositive(e) {
1187
- return this._addCheck({
1188
- kind: "max",
1189
- value: BigInt(0),
1190
- inclusive: !0,
1191
- message: h.toString(e)
1192
- });
1193
- }
1194
- nonnegative(e) {
1195
- return this._addCheck({
1196
- kind: "min",
1197
- value: BigInt(0),
1198
- inclusive: !0,
1199
- message: h.toString(e)
1200
- });
1201
- }
1202
- multipleOf(e, t) {
1203
- return this._addCheck({
1204
- kind: "multipleOf",
1205
- value: e,
1206
- message: h.toString(t)
1207
- });
1208
- }
1209
- get minValue() {
1210
- let e = null;
1211
- for (const t of this._def.checks)
1212
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1213
- return e;
1214
- }
1215
- get maxValue() {
1216
- let e = null;
1217
- for (const t of this._def.checks)
1218
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1219
- return e;
1220
- }
1221
- }
1222
- L.create = (r) => {
1223
- var e;
1224
- return new L({
1225
- checks: [],
1226
- typeName: p.ZodBigInt,
1227
- coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
1228
- ...v(r)
1229
- });
1230
- };
1231
- class ie extends g {
1232
- _parse(e) {
1233
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1234
- const n = this._getOrReturnCtx(e);
1235
- return l(n, {
1236
- code: d.invalid_type,
1237
- expected: f.boolean,
1238
- received: n.parsedType
1239
- }), y;
1240
- }
1241
- return S(e.data);
1242
- }
1243
- }
1244
- ie.create = (r) => new ie({
1245
- typeName: p.ZodBoolean,
1246
- coerce: (r == null ? void 0 : r.coerce) || !1,
1247
- ...v(r)
1248
- });
1249
- class Y extends g {
1250
- _parse(e) {
1251
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1252
- const a = this._getOrReturnCtx(e);
1253
- return l(a, {
1254
- code: d.invalid_type,
1255
- expected: f.date,
1256
- received: a.parsedType
1257
- }), y;
1258
- }
1259
- if (isNaN(e.data.getTime())) {
1260
- const a = this._getOrReturnCtx(e);
1261
- return l(a, {
1262
- code: d.invalid_date
1263
- }), y;
1264
- }
1265
- const n = new Z();
1266
- let s;
1267
- for (const a of this._def.checks)
1268
- a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1269
- code: d.too_small,
1270
- message: a.message,
1271
- inclusive: !0,
1272
- exact: !1,
1273
- minimum: a.value,
1274
- type: "date"
1275
- }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1276
- code: d.too_big,
1277
- message: a.message,
1278
- inclusive: !0,
1279
- exact: !1,
1280
- maximum: a.value,
1281
- type: "date"
1282
- }), n.dirty()) : x.assertNever(a);
1283
- return {
1284
- status: n.value,
1285
- value: new Date(e.data.getTime())
1286
- };
1287
- }
1288
- _addCheck(e) {
1289
- return new Y({
1290
- ...this._def,
1291
- checks: [...this._def.checks, e]
1292
- });
1293
- }
1294
- min(e, t) {
1295
- return this._addCheck({
1296
- kind: "min",
1297
- value: e.getTime(),
1298
- message: h.toString(t)
1299
- });
1300
- }
1301
- max(e, t) {
1302
- return this._addCheck({
1303
- kind: "max",
1304
- value: e.getTime(),
1305
- message: h.toString(t)
1306
- });
1307
- }
1308
- get minDate() {
1309
- let e = null;
1310
- for (const t of this._def.checks)
1311
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1312
- return e != null ? new Date(e) : null;
1313
- }
1314
- get maxDate() {
1315
- let e = null;
1316
- for (const t of this._def.checks)
1317
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1318
- return e != null ? new Date(e) : null;
1319
- }
1320
- }
1321
- Y.create = (r) => new Y({
1322
- checks: [],
1323
- coerce: (r == null ? void 0 : r.coerce) || !1,
1324
- typeName: p.ZodDate,
1325
- ...v(r)
1326
- });
1327
- class be extends g {
1328
- _parse(e) {
1329
- if (this._getType(e) !== f.symbol) {
1330
- const n = this._getOrReturnCtx(e);
1331
- return l(n, {
1332
- code: d.invalid_type,
1333
- expected: f.symbol,
1334
- received: n.parsedType
1335
- }), y;
1336
- }
1337
- return S(e.data);
1338
- }
1339
- }
1340
- be.create = (r) => new be({
1341
- typeName: p.ZodSymbol,
1342
- ...v(r)
1343
- });
1344
- class oe extends g {
1345
- _parse(e) {
1346
- if (this._getType(e) !== f.undefined) {
1347
- const n = this._getOrReturnCtx(e);
1348
- return l(n, {
1349
- code: d.invalid_type,
1350
- expected: f.undefined,
1351
- received: n.parsedType
1352
- }), y;
1353
- }
1354
- return S(e.data);
1355
- }
1356
- }
1357
- oe.create = (r) => new oe({
1358
- typeName: p.ZodUndefined,
1359
- ...v(r)
1360
- });
1361
- class de extends g {
1362
- _parse(e) {
1363
- if (this._getType(e) !== f.null) {
1364
- const n = this._getOrReturnCtx(e);
1365
- return l(n, {
1366
- code: d.invalid_type,
1367
- expected: f.null,
1368
- received: n.parsedType
1369
- }), y;
1370
- }
1371
- return S(e.data);
1372
- }
1373
- }
1374
- de.create = (r) => new de({
1375
- typeName: p.ZodNull,
1376
- ...v(r)
1377
- });
1378
- class K extends g {
1379
- constructor() {
1380
- super(...arguments), this._any = !0;
1381
- }
1382
- _parse(e) {
1383
- return S(e.data);
1384
- }
1385
- }
1386
- K.create = (r) => new K({
1387
- typeName: p.ZodAny,
1388
- ...v(r)
1389
- });
1390
- class W extends g {
1391
- constructor() {
1392
- super(...arguments), this._unknown = !0;
1393
- }
1394
- _parse(e) {
1395
- return S(e.data);
1396
- }
1397
- }
1398
- W.create = (r) => new W({
1399
- typeName: p.ZodUnknown,
1400
- ...v(r)
1401
- });
1402
- class z extends g {
1403
- _parse(e) {
1404
- const t = this._getOrReturnCtx(e);
1405
- return l(t, {
1406
- code: d.invalid_type,
1407
- expected: f.never,
1408
- received: t.parsedType
1409
- }), y;
1410
- }
1411
- }
1412
- z.create = (r) => new z({
1413
- typeName: p.ZodNever,
1414
- ...v(r)
1415
- });
1416
- class we extends g {
1417
- _parse(e) {
1418
- if (this._getType(e) !== f.undefined) {
1419
- const n = this._getOrReturnCtx(e);
1420
- return l(n, {
1421
- code: d.invalid_type,
1422
- expected: f.void,
1423
- received: n.parsedType
1424
- }), y;
1425
- }
1426
- return S(e.data);
1427
- }
1428
- }
1429
- we.create = (r) => new we({
1430
- typeName: p.ZodVoid,
1431
- ...v(r)
1432
- });
1433
- class R extends g {
1434
- _parse(e) {
1435
- const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
1436
- if (t.parsedType !== f.array)
1437
- return l(t, {
1438
- code: d.invalid_type,
1439
- expected: f.array,
1440
- received: t.parsedType
1441
- }), y;
1442
- if (s.exactLength !== null) {
1443
- const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1444
- (i || o) && (l(t, {
1445
- code: i ? d.too_big : d.too_small,
1446
- minimum: o ? s.exactLength.value : void 0,
1447
- maximum: i ? s.exactLength.value : void 0,
1448
- type: "array",
1449
- inclusive: !0,
1450
- exact: !0,
1451
- message: s.exactLength.message
1452
- }), n.dirty());
1453
- }
1454
- if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
1455
- code: d.too_small,
1456
- minimum: s.minLength.value,
1457
- type: "array",
1458
- inclusive: !0,
1459
- exact: !1,
1460
- message: s.minLength.message
1461
- }), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
1462
- code: d.too_big,
1463
- maximum: s.maxLength.value,
1464
- type: "array",
1465
- inclusive: !0,
1466
- exact: !1,
1467
- message: s.maxLength.message
1468
- }), n.dirty()), t.common.async)
1469
- return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new A(t, i, t.path, o)))).then((i) => Z.mergeArray(n, i));
1470
- const a = [...t.data].map((i, o) => s.type._parseSync(new A(t, i, t.path, o)));
1471
- return Z.mergeArray(n, a);
1472
- }
1473
- get element() {
1474
- return this._def.type;
1475
- }
1476
- min(e, t) {
1477
- return new R({
1478
- ...this._def,
1479
- minLength: { value: e, message: h.toString(t) }
1480
- });
1481
- }
1482
- max(e, t) {
1483
- return new R({
1484
- ...this._def,
1485
- maxLength: { value: e, message: h.toString(t) }
1486
- });
1487
- }
1488
- length(e, t) {
1489
- return new R({
1490
- ...this._def,
1491
- exactLength: { value: e, message: h.toString(t) }
1492
- });
1493
- }
1494
- nonempty(e) {
1495
- return this.min(1, e);
1496
- }
1497
- }
1498
- R.create = (r, e) => new R({
1499
- type: r,
1500
- minLength: null,
1501
- maxLength: null,
1502
- exactLength: null,
1503
- typeName: p.ZodArray,
1504
- ...v(e)
1505
- });
1506
- function J(r) {
1507
- if (r instanceof b) {
1508
- const e = {};
1509
- for (const t in r.shape) {
1510
- const n = r.shape[t];
1511
- e[t] = j.create(J(n));
1512
- }
1513
- return new b({
1514
- ...r._def,
1515
- shape: () => e
1516
- });
1517
- } else
1518
- return r instanceof R ? new R({
1519
- ...r._def,
1520
- type: J(r.element)
1521
- }) : r instanceof j ? j.create(J(r.unwrap())) : r instanceof U ? U.create(J(r.unwrap())) : r instanceof $ ? $.create(r.items.map((e) => J(e))) : r;
1522
- }
1523
- class b extends g {
1524
- constructor() {
1525
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1526
- }
1527
- _getCached() {
1528
- if (this._cached !== null)
1529
- return this._cached;
1530
- const e = this._def.shape(), t = x.objectKeys(e);
1531
- return this._cached = { shape: e, keys: t };
1532
- }
1533
- _parse(e) {
1534
- if (this._getType(e) !== f.object) {
1535
- const c = this._getOrReturnCtx(e);
1536
- return l(c, {
1537
- code: d.invalid_type,
1538
- expected: f.object,
1539
- received: c.parsedType
1540
- }), y;
1541
- }
1542
- const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1543
- if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
1544
- for (const c in s.data)
1545
- i.includes(c) || o.push(c);
1546
- const u = [];
1547
- for (const c of i) {
1548
- const m = a[c], C = s.data[c];
1549
- u.push({
1550
- key: { status: "valid", value: c },
1551
- value: m._parse(new A(s, C, s.path, c)),
1552
- alwaysSet: c in s.data
1553
- });
1554
- }
1555
- if (this._def.catchall instanceof z) {
1556
- const c = this._def.unknownKeys;
1557
- if (c === "passthrough")
1558
- for (const m of o)
1559
- u.push({
1560
- key: { status: "valid", value: m },
1561
- value: { status: "valid", value: s.data[m] }
1562
- });
1563
- else if (c === "strict")
1564
- o.length > 0 && (l(s, {
1565
- code: d.unrecognized_keys,
1566
- keys: o
1567
- }), n.dirty());
1568
- else if (c !== "strip")
1569
- throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1570
- } else {
1571
- const c = this._def.catchall;
1572
- for (const m of o) {
1573
- const C = s.data[m];
1574
- u.push({
1575
- key: { status: "valid", value: m },
1576
- value: c._parse(
1577
- new A(s, C, s.path, m)
1578
- //, ctx.child(key), value, getParsedType(value)
1579
- ),
1580
- alwaysSet: m in s.data
1581
- });
1582
- }
1583
- }
1584
- return s.common.async ? Promise.resolve().then(async () => {
1585
- const c = [];
1586
- for (const m of u) {
1587
- const C = await m.key, B = await m.value;
1588
- c.push({
1589
- key: C,
1590
- value: B,
1591
- alwaysSet: m.alwaysSet
1592
- });
1593
- }
1594
- return c;
1595
- }).then((c) => Z.mergeObjectSync(n, c)) : Z.mergeObjectSync(n, u);
1596
- }
1597
- get shape() {
1598
- return this._def.shape();
1599
- }
1600
- strict(e) {
1601
- return h.errToObj, new b({
1602
- ...this._def,
1603
- unknownKeys: "strict",
1604
- ...e !== void 0 ? {
1605
- errorMap: (t, n) => {
1606
- var s, a, i, o;
1607
- const u = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, t, n).message) !== null && i !== void 0 ? i : n.defaultError;
1608
- return t.code === "unrecognized_keys" ? {
1609
- message: (o = h.errToObj(e).message) !== null && o !== void 0 ? o : u
1610
- } : {
1611
- message: u
1612
- };
1613
- }
1614
- } : {}
1615
- });
1616
- }
1617
- strip() {
1618
- return new b({
1619
- ...this._def,
1620
- unknownKeys: "strip"
1621
- });
1622
- }
1623
- passthrough() {
1624
- return new b({
1625
- ...this._def,
1626
- unknownKeys: "passthrough"
1627
- });
1628
- }
1629
- // const AugmentFactory =
1630
- // <Def extends ZodObjectDef>(def: Def) =>
1631
- // <Augmentation extends ZodRawShape>(
1632
- // augmentation: Augmentation
1633
- // ): ZodObject<
1634
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1635
- // Def["unknownKeys"],
1636
- // Def["catchall"]
1637
- // > => {
1638
- // return new ZodObject({
1639
- // ...def,
1640
- // shape: () => ({
1641
- // ...def.shape(),
1642
- // ...augmentation,
1643
- // }),
1644
- // }) as any;
1645
- // };
1646
- extend(e) {
1647
- return new b({
1648
- ...this._def,
1649
- shape: () => ({
1650
- ...this._def.shape(),
1651
- ...e
1652
- })
1653
- });
1654
- }
1655
- /**
1656
- * Prior to zod@1.0.12 there was a bug in the
1657
- * inferred type of merged objects. Please
1658
- * upgrade if you are experiencing issues.
1659
- */
1660
- merge(e) {
1661
- return new b({
1662
- unknownKeys: e._def.unknownKeys,
1663
- catchall: e._def.catchall,
1664
- shape: () => ({
1665
- ...this._def.shape(),
1666
- ...e._def.shape()
1667
- }),
1668
- typeName: p.ZodObject
1669
- });
1670
- }
1671
- // merge<
1672
- // Incoming extends AnyZodObject,
1673
- // Augmentation extends Incoming["shape"],
1674
- // NewOutput extends {
1675
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1676
- // ? Augmentation[k]["_output"]
1677
- // : k extends keyof Output
1678
- // ? Output[k]
1679
- // : never;
1680
- // },
1681
- // NewInput extends {
1682
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1683
- // ? Augmentation[k]["_input"]
1684
- // : k extends keyof Input
1685
- // ? Input[k]
1686
- // : never;
1687
- // }
1688
- // >(
1689
- // merging: Incoming
1690
- // ): ZodObject<
1691
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1692
- // Incoming["_def"]["unknownKeys"],
1693
- // Incoming["_def"]["catchall"],
1694
- // NewOutput,
1695
- // NewInput
1696
- // > {
1697
- // const merged: any = new ZodObject({
1698
- // unknownKeys: merging._def.unknownKeys,
1699
- // catchall: merging._def.catchall,
1700
- // shape: () =>
1701
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1702
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1703
- // }) as any;
1704
- // return merged;
1705
- // }
1706
- setKey(e, t) {
1707
- return this.augment({ [e]: t });
1708
- }
1709
- // merge<Incoming extends AnyZodObject>(
1710
- // merging: Incoming
1711
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1712
- // ZodObject<
1713
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1714
- // Incoming["_def"]["unknownKeys"],
1715
- // Incoming["_def"]["catchall"]
1716
- // > {
1717
- // // const mergedShape = objectUtil.mergeShapes(
1718
- // // this._def.shape(),
1719
- // // merging._def.shape()
1720
- // // );
1721
- // const merged: any = new ZodObject({
1722
- // unknownKeys: merging._def.unknownKeys,
1723
- // catchall: merging._def.catchall,
1724
- // shape: () =>
1725
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1726
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1727
- // }) as any;
1728
- // return merged;
1729
- // }
1730
- catchall(e) {
1731
- return new b({
1732
- ...this._def,
1733
- catchall: e
1734
- });
1735
- }
1736
- pick(e) {
1737
- const t = {};
1738
- return x.objectKeys(e).forEach((n) => {
1739
- e[n] && this.shape[n] && (t[n] = this.shape[n]);
1740
- }), new b({
1741
- ...this._def,
1742
- shape: () => t
1743
- });
1744
- }
1745
- omit(e) {
1746
- const t = {};
1747
- return x.objectKeys(this.shape).forEach((n) => {
1748
- e[n] || (t[n] = this.shape[n]);
1749
- }), new b({
1750
- ...this._def,
1751
- shape: () => t
1752
- });
1753
- }
1754
- /**
1755
- * @deprecated
1756
- */
1757
- deepPartial() {
1758
- return J(this);
1759
- }
1760
- partial(e) {
1761
- const t = {};
1762
- return x.objectKeys(this.shape).forEach((n) => {
1763
- const s = this.shape[n];
1764
- e && !e[n] ? t[n] = s : t[n] = s.optional();
1765
- }), new b({
1766
- ...this._def,
1767
- shape: () => t
1768
- });
1769
- }
1770
- required(e) {
1771
- const t = {};
1772
- return x.objectKeys(this.shape).forEach((n) => {
1773
- if (e && !e[n])
1774
- t[n] = this.shape[n];
1775
- else {
1776
- let a = this.shape[n];
1777
- for (; a instanceof j; )
1778
- a = a._def.innerType;
1779
- t[n] = a;
1780
- }
1781
- }), new b({
1782
- ...this._def,
1783
- shape: () => t
1784
- });
1785
- }
1786
- keyof() {
1787
- return We(x.objectKeys(this.shape));
1788
- }
1789
- }
1790
- b.create = (r, e) => new b({
1791
- shape: () => r,
1792
- unknownKeys: "strip",
1793
- catchall: z.create(),
1794
- typeName: p.ZodObject,
1795
- ...v(e)
1796
- });
1797
- b.strictCreate = (r, e) => new b({
1798
- shape: () => r,
1799
- unknownKeys: "strict",
1800
- catchall: z.create(),
1801
- typeName: p.ZodObject,
1802
- ...v(e)
1803
- });
1804
- b.lazycreate = (r, e) => new b({
1805
- shape: r,
1806
- unknownKeys: "strip",
1807
- catchall: z.create(),
1808
- typeName: p.ZodObject,
1809
- ...v(e)
1810
- });
1811
- class ce extends g {
1812
- _parse(e) {
1813
- const { ctx: t } = this._processInputParams(e), n = this._def.options;
1814
- function s(a) {
1815
- for (const o of a)
1816
- if (o.result.status === "valid")
1817
- return o.result;
1818
- for (const o of a)
1819
- if (o.result.status === "dirty")
1820
- return t.common.issues.push(...o.ctx.common.issues), o.result;
1821
- const i = a.map((o) => new N(o.ctx.common.issues));
1822
- return l(t, {
1823
- code: d.invalid_union,
1824
- unionErrors: i
1825
- }), y;
1826
- }
1827
- if (t.common.async)
1828
- return Promise.all(n.map(async (a) => {
1829
- const i = {
1830
- ...t,
1831
- common: {
1832
- ...t.common,
1833
- issues: []
1834
- },
1835
- parent: null
1836
- };
1837
- return {
1838
- result: await a._parseAsync({
1839
- data: t.data,
1840
- path: t.path,
1841
- parent: i
1842
- }),
1843
- ctx: i
1844
- };
1845
- })).then(s);
1846
- {
1847
- let a;
1848
- const i = [];
1849
- for (const u of n) {
1850
- const c = {
1851
- ...t,
1852
- common: {
1853
- ...t.common,
1854
- issues: []
1855
- },
1856
- parent: null
1857
- }, m = u._parseSync({
1858
- data: t.data,
1859
- path: t.path,
1860
- parent: c
1861
- });
1862
- if (m.status === "valid")
1863
- return m;
1864
- m.status === "dirty" && !a && (a = { result: m, ctx: c }), c.common.issues.length && i.push(c.common.issues);
1865
- }
1866
- if (a)
1867
- return t.common.issues.push(...a.ctx.common.issues), a.result;
1868
- const o = i.map((u) => new N(u));
1869
- return l(t, {
1870
- code: d.invalid_union,
1871
- unionErrors: o
1872
- }), y;
1873
- }
1874
- }
1875
- get options() {
1876
- return this._def.options;
1877
- }
1878
- }
1879
- ce.create = (r, e) => new ce({
1880
- options: r,
1881
- typeName: p.ZodUnion,
1882
- ...v(e)
1883
- });
1884
- const M = (r) => r instanceof fe ? M(r.schema) : r instanceof I ? M(r.innerType()) : r instanceof he ? [r.value] : r instanceof q ? r.options : r instanceof me ? x.objectValues(r.enum) : r instanceof pe ? M(r._def.innerType) : r instanceof oe ? [void 0] : r instanceof de ? [null] : r instanceof j ? [void 0, ...M(r.unwrap())] : r instanceof U ? [null, ...M(r.unwrap())] : r instanceof Ie || r instanceof _e ? M(r.unwrap()) : r instanceof ye ? M(r._def.innerType) : [];
1885
- class Ce extends g {
1886
- _parse(e) {
1887
- const { ctx: t } = this._processInputParams(e);
1888
- if (t.parsedType !== f.object)
1889
- return l(t, {
1890
- code: d.invalid_type,
1891
- expected: f.object,
1892
- received: t.parsedType
1893
- }), y;
1894
- const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
1895
- return a ? t.common.async ? a._parseAsync({
1896
- data: t.data,
1897
- path: t.path,
1898
- parent: t
1899
- }) : a._parseSync({
1900
- data: t.data,
1901
- path: t.path,
1902
- parent: t
1903
- }) : (l(t, {
1904
- code: d.invalid_union_discriminator,
1905
- options: Array.from(this.optionsMap.keys()),
1906
- path: [n]
1907
- }), y);
1908
- }
1909
- get discriminator() {
1910
- return this._def.discriminator;
1911
- }
1912
- get options() {
1913
- return this._def.options;
1914
- }
1915
- get optionsMap() {
1916
- return this._def.optionsMap;
1917
- }
1918
- /**
1919
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1920
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1921
- * have a different value for each object in the union.
1922
- * @param discriminator the name of the discriminator property
1923
- * @param types an array of object schemas
1924
- * @param params
1925
- */
1926
- static create(e, t, n) {
1927
- const s = /* @__PURE__ */ new Map();
1928
- for (const a of t) {
1929
- const i = M(a.shape[e]);
1930
- if (!i.length)
1931
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1932
- for (const o of i) {
1933
- if (s.has(o))
1934
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
1935
- s.set(o, a);
1936
- }
1937
- }
1938
- return new Ce({
1939
- typeName: p.ZodDiscriminatedUnion,
1940
- discriminator: e,
1941
- options: t,
1942
- optionsMap: s,
1943
- ...v(n)
1944
- });
1945
- }
1946
- }
1947
- function Re(r, e) {
1948
- const t = D(r), n = D(e);
1949
- if (r === e)
1950
- return { valid: !0, data: r };
1951
- if (t === f.object && n === f.object) {
1952
- const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
1953
- for (const o of a) {
1954
- const u = Re(r[o], e[o]);
1955
- if (!u.valid)
1956
- return { valid: !1 };
1957
- i[o] = u.data;
1958
- }
1959
- return { valid: !0, data: i };
1960
- } else if (t === f.array && n === f.array) {
1961
- if (r.length !== e.length)
1962
- return { valid: !1 };
1963
- const s = [];
1964
- for (let a = 0; a < r.length; a++) {
1965
- const i = r[a], o = e[a], u = Re(i, o);
1966
- if (!u.valid)
1967
- return { valid: !1 };
1968
- s.push(u.data);
1969
- }
1970
- return { valid: !0, data: s };
1971
- } else
1972
- return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
1973
- }
1974
- class ue extends g {
1975
- _parse(e) {
1976
- const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
1977
- if (Ne(a) || Ne(i))
1978
- return y;
1979
- const o = Re(a.value, i.value);
1980
- return o.valid ? ((Ee(a) || Ee(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
1981
- code: d.invalid_intersection_types
1982
- }), y);
1983
- };
1984
- return n.common.async ? Promise.all([
1985
- this._def.left._parseAsync({
1986
- data: n.data,
1987
- path: n.path,
1988
- parent: n
1989
- }),
1990
- this._def.right._parseAsync({
1991
- data: n.data,
1992
- path: n.path,
1993
- parent: n
1994
- })
1995
- ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
1996
- data: n.data,
1997
- path: n.path,
1998
- parent: n
1999
- }), this._def.right._parseSync({
2000
- data: n.data,
2001
- path: n.path,
2002
- parent: n
2003
- }));
2004
- }
2005
- }
2006
- ue.create = (r, e, t) => new ue({
2007
- left: r,
2008
- right: e,
2009
- typeName: p.ZodIntersection,
2010
- ...v(t)
2011
- });
2012
- class $ extends g {
2013
- _parse(e) {
2014
- const { status: t, ctx: n } = this._processInputParams(e);
2015
- if (n.parsedType !== f.array)
2016
- return l(n, {
2017
- code: d.invalid_type,
2018
- expected: f.array,
2019
- received: n.parsedType
2020
- }), y;
2021
- if (n.data.length < this._def.items.length)
2022
- return l(n, {
2023
- code: d.too_small,
2024
- minimum: this._def.items.length,
2025
- inclusive: !0,
2026
- exact: !1,
2027
- type: "array"
2028
- }), y;
2029
- !this._def.rest && n.data.length > this._def.items.length && (l(n, {
2030
- code: d.too_big,
2031
- maximum: this._def.items.length,
2032
- inclusive: !0,
2033
- exact: !1,
2034
- type: "array"
2035
- }), t.dirty());
2036
- const a = [...n.data].map((i, o) => {
2037
- const u = this._def.items[o] || this._def.rest;
2038
- return u ? u._parse(new A(n, i, n.path, o)) : null;
2039
- }).filter((i) => !!i);
2040
- return n.common.async ? Promise.all(a).then((i) => Z.mergeArray(t, i)) : Z.mergeArray(t, a);
2041
- }
2042
- get items() {
2043
- return this._def.items;
2044
- }
2045
- rest(e) {
2046
- return new $({
2047
- ...this._def,
2048
- rest: e
2049
- });
2050
- }
2051
- }
2052
- $.create = (r, e) => {
2053
- if (!Array.isArray(r))
2054
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2055
- return new $({
2056
- items: r,
2057
- typeName: p.ZodTuple,
2058
- rest: null,
2059
- ...v(e)
2060
- });
2061
- };
2062
- class le extends g {
2063
- get keySchema() {
2064
- return this._def.keyType;
2065
- }
2066
- get valueSchema() {
2067
- return this._def.valueType;
2068
- }
2069
- _parse(e) {
2070
- const { status: t, ctx: n } = this._processInputParams(e);
2071
- if (n.parsedType !== f.object)
2072
- return l(n, {
2073
- code: d.invalid_type,
2074
- expected: f.object,
2075
- received: n.parsedType
2076
- }), y;
2077
- const s = [], a = this._def.keyType, i = this._def.valueType;
2078
- for (const o in n.data)
2079
- s.push({
2080
- key: a._parse(new A(n, o, n.path, o)),
2081
- value: i._parse(new A(n, n.data[o], n.path, o)),
2082
- alwaysSet: o in n.data
2083
- });
2084
- return n.common.async ? Z.mergeObjectAsync(t, s) : Z.mergeObjectSync(t, s);
2085
- }
2086
- get element() {
2087
- return this._def.valueType;
2088
- }
2089
- static create(e, t, n) {
2090
- return t instanceof g ? new le({
2091
- keyType: e,
2092
- valueType: t,
2093
- typeName: p.ZodRecord,
2094
- ...v(n)
2095
- }) : new le({
2096
- keyType: E.create(),
2097
- valueType: e,
2098
- typeName: p.ZodRecord,
2099
- ...v(t)
2100
- });
2101
- }
2102
- }
2103
- class Te extends g {
2104
- get keySchema() {
2105
- return this._def.keyType;
2106
- }
2107
- get valueSchema() {
2108
- return this._def.valueType;
2109
- }
2110
- _parse(e) {
2111
- const { status: t, ctx: n } = this._processInputParams(e);
2112
- if (n.parsedType !== f.map)
2113
- return l(n, {
2114
- code: d.invalid_type,
2115
- expected: f.map,
2116
- received: n.parsedType
2117
- }), y;
2118
- const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
2119
- key: s._parse(new A(n, o, n.path, [c, "key"])),
2120
- value: a._parse(new A(n, u, n.path, [c, "value"]))
2121
- }));
2122
- if (n.common.async) {
2123
- const o = /* @__PURE__ */ new Map();
2124
- return Promise.resolve().then(async () => {
2125
- for (const u of i) {
2126
- const c = await u.key, m = await u.value;
2127
- if (c.status === "aborted" || m.status === "aborted")
2128
- return y;
2129
- (c.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(c.value, m.value);
2130
- }
2131
- return { status: t.value, value: o };
2132
- });
2133
- } else {
2134
- const o = /* @__PURE__ */ new Map();
2135
- for (const u of i) {
2136
- const c = u.key, m = u.value;
2137
- if (c.status === "aborted" || m.status === "aborted")
2138
- return y;
2139
- (c.status === "dirty" || m.status === "dirty") && t.dirty(), o.set(c.value, m.value);
2140
- }
2141
- return { status: t.value, value: o };
2142
- }
2143
- }
2144
- }
2145
- Te.create = (r, e, t) => new Te({
2146
- valueType: e,
2147
- keyType: r,
2148
- typeName: p.ZodMap,
2149
- ...v(t)
2150
- });
2151
- class H extends g {
2152
- _parse(e) {
2153
- const { status: t, ctx: n } = this._processInputParams(e);
2154
- if (n.parsedType !== f.set)
2155
- return l(n, {
2156
- code: d.invalid_type,
2157
- expected: f.set,
2158
- received: n.parsedType
2159
- }), y;
2160
- const s = this._def;
2161
- s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
2162
- code: d.too_small,
2163
- minimum: s.minSize.value,
2164
- type: "set",
2165
- inclusive: !0,
2166
- exact: !1,
2167
- message: s.minSize.message
2168
- }), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
2169
- code: d.too_big,
2170
- maximum: s.maxSize.value,
2171
- type: "set",
2172
- inclusive: !0,
2173
- exact: !1,
2174
- message: s.maxSize.message
2175
- }), t.dirty());
2176
- const a = this._def.valueType;
2177
- function i(u) {
2178
- const c = /* @__PURE__ */ new Set();
2179
- for (const m of u) {
2180
- if (m.status === "aborted")
2181
- return y;
2182
- m.status === "dirty" && t.dirty(), c.add(m.value);
2183
- }
2184
- return { status: t.value, value: c };
2185
- }
2186
- const o = [...n.data.values()].map((u, c) => a._parse(new A(n, u, n.path, c)));
2187
- return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2188
- }
2189
- min(e, t) {
2190
- return new H({
2191
- ...this._def,
2192
- minSize: { value: e, message: h.toString(t) }
2193
- });
2194
- }
2195
- max(e, t) {
2196
- return new H({
2197
- ...this._def,
2198
- maxSize: { value: e, message: h.toString(t) }
2199
- });
2200
- }
2201
- size(e, t) {
2202
- return this.min(e, t).max(e, t);
2203
- }
2204
- nonempty(e) {
2205
- return this.min(1, e);
2206
- }
2207
- }
2208
- H.create = (r, e) => new H({
2209
- valueType: r,
2210
- minSize: null,
2211
- maxSize: null,
2212
- typeName: p.ZodSet,
2213
- ...v(e)
2214
- });
2215
- class Q extends g {
2216
- constructor() {
2217
- super(...arguments), this.validate = this.implement;
2218
- }
2219
- _parse(e) {
2220
- const { ctx: t } = this._processInputParams(e);
2221
- if (t.parsedType !== f.function)
2222
- return l(t, {
2223
- code: d.invalid_type,
2224
- expected: f.function,
2225
- received: t.parsedType
2226
- }), y;
2227
- function n(o, u) {
2228
- return xe({
2229
- data: o,
2230
- path: t.path,
2231
- errorMaps: [
2232
- t.common.contextualErrorMap,
2233
- t.schemaErrorMap,
2234
- ge(),
2235
- X
2236
- ].filter((c) => !!c),
2237
- issueData: {
2238
- code: d.invalid_arguments,
2239
- argumentsError: u
2240
- }
2241
- });
2242
- }
2243
- function s(o, u) {
2244
- return xe({
2245
- data: o,
2246
- path: t.path,
2247
- errorMaps: [
2248
- t.common.contextualErrorMap,
2249
- t.schemaErrorMap,
2250
- ge(),
2251
- X
2252
- ].filter((c) => !!c),
2253
- issueData: {
2254
- code: d.invalid_return_type,
2255
- returnTypeError: u
2256
- }
2257
- });
2258
- }
2259
- const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2260
- if (this._def.returns instanceof F) {
2261
- const o = this;
2262
- return S(async function(...u) {
2263
- const c = new N([]), m = await o._def.args.parseAsync(u, a).catch((P) => {
2264
- throw c.addIssue(n(u, P)), c;
2265
- }), C = await Reflect.apply(i, this, m);
2266
- return await o._def.returns._def.type.parseAsync(C, a).catch((P) => {
2267
- throw c.addIssue(s(C, P)), c;
2268
- });
2269
- });
2270
- } else {
2271
- const o = this;
2272
- return S(function(...u) {
2273
- const c = o._def.args.safeParse(u, a);
2274
- if (!c.success)
2275
- throw new N([n(u, c.error)]);
2276
- const m = Reflect.apply(i, this, c.data), C = o._def.returns.safeParse(m, a);
2277
- if (!C.success)
2278
- throw new N([s(m, C.error)]);
2279
- return C.data;
2280
- });
2281
- }
2282
- }
2283
- parameters() {
2284
- return this._def.args;
2285
- }
2286
- returnType() {
2287
- return this._def.returns;
2288
- }
2289
- args(...e) {
2290
- return new Q({
2291
- ...this._def,
2292
- args: $.create(e).rest(W.create())
2293
- });
2294
- }
2295
- returns(e) {
2296
- return new Q({
2297
- ...this._def,
2298
- returns: e
2299
- });
2300
- }
2301
- implement(e) {
2302
- return this.parse(e);
2303
- }
2304
- strictImplement(e) {
2305
- return this.parse(e);
2306
- }
2307
- static create(e, t, n) {
2308
- return new Q({
2309
- args: e || $.create([]).rest(W.create()),
2310
- returns: t || W.create(),
2311
- typeName: p.ZodFunction,
2312
- ...v(n)
2313
- });
2314
- }
2315
- }
2316
- class fe extends g {
2317
- get schema() {
2318
- return this._def.getter();
2319
- }
2320
- _parse(e) {
2321
- const { ctx: t } = this._processInputParams(e);
2322
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2323
- }
2324
- }
2325
- fe.create = (r, e) => new fe({
2326
- getter: r,
2327
- typeName: p.ZodLazy,
2328
- ...v(e)
2329
- });
2330
- class he extends g {
2331
- _parse(e) {
2332
- if (e.data !== this._def.value) {
2333
- const t = this._getOrReturnCtx(e);
2334
- return l(t, {
2335
- received: t.data,
2336
- code: d.invalid_literal,
2337
- expected: this._def.value
2338
- }), y;
2339
- }
2340
- return { status: "valid", value: e.data };
2341
- }
2342
- get value() {
2343
- return this._def.value;
2344
- }
2345
- }
2346
- he.create = (r, e) => new he({
2347
- value: r,
2348
- typeName: p.ZodLiteral,
2349
- ...v(e)
2350
- });
2351
- function We(r, e) {
2352
- return new q({
2353
- values: r,
2354
- typeName: p.ZodEnum,
2355
- ...v(e)
2356
- });
2357
- }
2358
- class q extends g {
2359
- constructor() {
2360
- super(...arguments), re.set(this, void 0);
2361
- }
2362
- _parse(e) {
2363
- if (typeof e.data != "string") {
2364
- const t = this._getOrReturnCtx(e), n = this._def.values;
2365
- return l(t, {
2366
- expected: x.joinValues(n),
2367
- received: t.parsedType,
2368
- code: d.invalid_type
2369
- }), y;
2370
- }
2371
- if (ke(this, re) || Le(this, re, new Set(this._def.values)), !ke(this, re).has(e.data)) {
2372
- const t = this._getOrReturnCtx(e), n = this._def.values;
2373
- return l(t, {
2374
- received: t.data,
2375
- code: d.invalid_enum_value,
2376
- options: n
2377
- }), y;
2378
- }
2379
- return S(e.data);
2380
- }
2381
- get options() {
2382
- return this._def.values;
2383
- }
2384
- get enum() {
2385
- const e = {};
2386
- for (const t of this._def.values)
2387
- e[t] = t;
2388
- return e;
2389
- }
2390
- get Values() {
2391
- const e = {};
2392
- for (const t of this._def.values)
2393
- e[t] = t;
2394
- return e;
2395
- }
2396
- get Enum() {
2397
- const e = {};
2398
- for (const t of this._def.values)
2399
- e[t] = t;
2400
- return e;
2401
- }
2402
- extract(e, t = this._def) {
2403
- return q.create(e, {
2404
- ...this._def,
2405
- ...t
2406
- });
2407
- }
2408
- exclude(e, t = this._def) {
2409
- return q.create(this.options.filter((n) => !e.includes(n)), {
2410
- ...this._def,
2411
- ...t
2412
- });
2413
- }
2414
- }
2415
- re = /* @__PURE__ */ new WeakMap();
2416
- q.create = We;
2417
- class me extends g {
2418
- constructor() {
2419
- super(...arguments), ne.set(this, void 0);
2420
- }
2421
- _parse(e) {
2422
- const t = x.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2423
- if (n.parsedType !== f.string && n.parsedType !== f.number) {
2424
- const s = x.objectValues(t);
2425
- return l(n, {
2426
- expected: x.joinValues(s),
2427
- received: n.parsedType,
2428
- code: d.invalid_type
2429
- }), y;
2430
- }
2431
- if (ke(this, ne) || Le(this, ne, new Set(x.getValidEnumValues(this._def.values))), !ke(this, ne).has(e.data)) {
2432
- const s = x.objectValues(t);
2433
- return l(n, {
2434
- received: n.data,
2435
- code: d.invalid_enum_value,
2436
- options: s
2437
- }), y;
2438
- }
2439
- return S(e.data);
2440
- }
2441
- get enum() {
2442
- return this._def.values;
2443
- }
2444
- }
2445
- ne = /* @__PURE__ */ new WeakMap();
2446
- me.create = (r, e) => new me({
2447
- values: r,
2448
- typeName: p.ZodNativeEnum,
2449
- ...v(e)
2450
- });
2451
- class F extends g {
2452
- unwrap() {
2453
- return this._def.type;
2454
- }
2455
- _parse(e) {
2456
- const { ctx: t } = this._processInputParams(e);
2457
- if (t.parsedType !== f.promise && t.common.async === !1)
2458
- return l(t, {
2459
- code: d.invalid_type,
2460
- expected: f.promise,
2461
- received: t.parsedType
2462
- }), y;
2463
- const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2464
- return S(n.then((s) => this._def.type.parseAsync(s, {
2465
- path: t.path,
2466
- errorMap: t.common.contextualErrorMap
2467
- })));
2468
- }
2469
- }
2470
- F.create = (r, e) => new F({
2471
- type: r,
2472
- typeName: p.ZodPromise,
2473
- ...v(e)
2474
- });
2475
- class I extends g {
2476
- innerType() {
2477
- return this._def.schema;
2478
- }
2479
- sourceType() {
2480
- return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2481
- }
2482
- _parse(e) {
2483
- const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
2484
- addIssue: (i) => {
2485
- l(n, i), i.fatal ? t.abort() : t.dirty();
2486
- },
2487
- get path() {
2488
- return n.path;
2489
- }
2490
- };
2491
- if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2492
- const i = s.transform(n.data, a);
2493
- if (n.common.async)
2494
- return Promise.resolve(i).then(async (o) => {
2495
- if (t.value === "aborted")
2496
- return y;
2497
- const u = await this._def.schema._parseAsync({
2498
- data: o,
2499
- path: n.path,
2500
- parent: n
2501
- });
2502
- return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? G(u.value) : u;
2503
- });
2504
- {
2505
- if (t.value === "aborted")
2506
- return y;
2507
- const o = this._def.schema._parseSync({
2508
- data: i,
2509
- path: n.path,
2510
- parent: n
2511
- });
2512
- return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? G(o.value) : o;
2513
- }
2514
- }
2515
- if (s.type === "refinement") {
2516
- const i = (o) => {
2517
- const u = s.refinement(o, a);
2518
- if (n.common.async)
2519
- return Promise.resolve(u);
2520
- if (u instanceof Promise)
2521
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2522
- return o;
2523
- };
2524
- if (n.common.async === !1) {
2525
- const o = this._def.schema._parseSync({
2526
- data: n.data,
2527
- path: n.path,
2528
- parent: n
2529
- });
2530
- return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2531
- } else
2532
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2533
- }
2534
- if (s.type === "transform")
2535
- if (n.common.async === !1) {
2536
- const i = this._def.schema._parseSync({
2537
- data: n.data,
2538
- path: n.path,
2539
- parent: n
2540
- });
2541
- if (!se(i))
2542
- return i;
2543
- const o = s.transform(i.value, a);
2544
- if (o instanceof Promise)
2545
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2546
- return { status: t.value, value: o };
2547
- } else
2548
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => se(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2549
- x.assertNever(s);
2550
- }
2551
- }
2552
- I.create = (r, e, t) => new I({
2553
- schema: r,
2554
- typeName: p.ZodEffects,
2555
- effect: e,
2556
- ...v(t)
2557
- });
2558
- I.createWithPreprocess = (r, e, t) => new I({
2559
- schema: e,
2560
- effect: { type: "preprocess", transform: r },
2561
- typeName: p.ZodEffects,
2562
- ...v(t)
2563
- });
2564
- class j extends g {
2565
- _parse(e) {
2566
- return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
2567
- }
2568
- unwrap() {
2569
- return this._def.innerType;
2570
- }
2571
- }
2572
- j.create = (r, e) => new j({
2573
- innerType: r,
2574
- typeName: p.ZodOptional,
2575
- ...v(e)
2576
- });
2577
- class U extends g {
2578
- _parse(e) {
2579
- return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
2580
- }
2581
- unwrap() {
2582
- return this._def.innerType;
2583
- }
2584
- }
2585
- U.create = (r, e) => new U({
2586
- innerType: r,
2587
- typeName: p.ZodNullable,
2588
- ...v(e)
2589
- });
2590
- class pe extends g {
2591
- _parse(e) {
2592
- const { ctx: t } = this._processInputParams(e);
2593
- let n = t.data;
2594
- return t.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2595
- data: n,
2596
- path: t.path,
2597
- parent: t
2598
- });
2599
- }
2600
- removeDefault() {
2601
- return this._def.innerType;
2602
- }
2603
- }
2604
- pe.create = (r, e) => new pe({
2605
- innerType: r,
2606
- typeName: p.ZodDefault,
2607
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2608
- ...v(e)
2609
- });
2610
- class ye extends g {
2611
- _parse(e) {
2612
- const { ctx: t } = this._processInputParams(e), n = {
2613
- ...t,
2614
- common: {
2615
- ...t.common,
2616
- issues: []
2617
- }
2618
- }, s = this._def.innerType._parse({
2619
- data: n.data,
2620
- path: n.path,
2621
- parent: {
2622
- ...n
2623
- }
2624
- });
2625
- return ae(s) ? s.then((a) => ({
2626
- status: "valid",
2627
- value: a.status === "valid" ? a.value : this._def.catchValue({
2628
- get error() {
2629
- return new N(n.common.issues);
2630
- },
2631
- input: n.data
2632
- })
2633
- })) : {
2634
- status: "valid",
2635
- value: s.status === "valid" ? s.value : this._def.catchValue({
2636
- get error() {
2637
- return new N(n.common.issues);
2638
- },
2639
- input: n.data
2640
- })
2641
- };
2642
- }
2643
- removeCatch() {
2644
- return this._def.innerType;
2645
- }
2646
- }
2647
- ye.create = (r, e) => new ye({
2648
- innerType: r,
2649
- typeName: p.ZodCatch,
2650
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2651
- ...v(e)
2652
- });
2653
- class Ze extends g {
2654
- _parse(e) {
2655
- if (this._getType(e) !== f.nan) {
2656
- const n = this._getOrReturnCtx(e);
2657
- return l(n, {
2658
- code: d.invalid_type,
2659
- expected: f.nan,
2660
- received: n.parsedType
2661
- }), y;
2662
- }
2663
- return { status: "valid", value: e.data };
2664
- }
2665
- }
2666
- Ze.create = (r) => new Ze({
2667
- typeName: p.ZodNaN,
2668
- ...v(r)
2669
- });
2670
- const kt = Symbol("zod_brand");
2671
- class Ie extends g {
2672
- _parse(e) {
2673
- const { ctx: t } = this._processInputParams(e), n = t.data;
2674
- return this._def.type._parse({
2675
- data: n,
2676
- path: t.path,
2677
- parent: t
2678
- });
2679
- }
2680
- unwrap() {
2681
- return this._def.type;
2682
- }
2683
- }
2684
- class ve extends g {
2685
- _parse(e) {
2686
- const { status: t, ctx: n } = this._processInputParams(e);
2687
- if (n.common.async)
2688
- return (async () => {
2689
- const a = await this._def.in._parseAsync({
2690
- data: n.data,
2691
- path: n.path,
2692
- parent: n
2693
- });
2694
- return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), G(a.value)) : this._def.out._parseAsync({
2695
- data: a.value,
2696
- path: n.path,
2697
- parent: n
2698
- });
2699
- })();
2700
- {
2701
- const s = this._def.in._parseSync({
2702
- data: n.data,
2703
- path: n.path,
2704
- parent: n
2705
- });
2706
- return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
2707
- status: "dirty",
2708
- value: s.value
2709
- }) : this._def.out._parseSync({
2710
- data: s.value,
2711
- path: n.path,
2712
- parent: n
2713
- });
2714
- }
2715
- }
2716
- static create(e, t) {
2717
- return new ve({
2718
- in: e,
2719
- out: t,
2720
- typeName: p.ZodPipeline
2721
- });
2722
- }
2723
- }
2724
- class _e extends g {
2725
- _parse(e) {
2726
- const t = this._def.innerType._parse(e), n = (s) => (se(s) && (s.value = Object.freeze(s.value)), s);
2727
- return ae(t) ? t.then((s) => n(s)) : n(t);
2728
- }
2729
- unwrap() {
2730
- return this._def.innerType;
2731
- }
2732
- }
2733
- _e.create = (r, e) => new _e({
2734
- innerType: r,
2735
- typeName: p.ZodReadonly,
2736
- ...v(e)
2737
- });
2738
- function Ye(r, e = {}, t) {
2739
- return r ? K.create().superRefine((n, s) => {
2740
- var a, i;
2741
- if (!r(n)) {
2742
- const o = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (i = (a = o.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0, c = typeof o == "string" ? { message: o } : o;
2743
- s.addIssue({ code: "custom", ...c, fatal: u });
2744
- }
2745
- }) : K.create();
2746
- }
2747
- const bt = {
2748
- object: b.lazycreate
2749
- };
2750
- var p;
2751
- (function(r) {
2752
- r.ZodString = "ZodString", r.ZodNumber = "ZodNumber", r.ZodNaN = "ZodNaN", r.ZodBigInt = "ZodBigInt", r.ZodBoolean = "ZodBoolean", r.ZodDate = "ZodDate", r.ZodSymbol = "ZodSymbol", r.ZodUndefined = "ZodUndefined", r.ZodNull = "ZodNull", r.ZodAny = "ZodAny", r.ZodUnknown = "ZodUnknown", r.ZodNever = "ZodNever", r.ZodVoid = "ZodVoid", r.ZodArray = "ZodArray", r.ZodObject = "ZodObject", r.ZodUnion = "ZodUnion", r.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", r.ZodIntersection = "ZodIntersection", r.ZodTuple = "ZodTuple", r.ZodRecord = "ZodRecord", r.ZodMap = "ZodMap", r.ZodSet = "ZodSet", r.ZodFunction = "ZodFunction", r.ZodLazy = "ZodLazy", r.ZodLiteral = "ZodLiteral", r.ZodEnum = "ZodEnum", r.ZodEffects = "ZodEffects", r.ZodNativeEnum = "ZodNativeEnum", r.ZodOptional = "ZodOptional", r.ZodNullable = "ZodNullable", r.ZodDefault = "ZodDefault", r.ZodCatch = "ZodCatch", r.ZodPromise = "ZodPromise", r.ZodBranded = "ZodBranded", r.ZodPipeline = "ZodPipeline", r.ZodReadonly = "ZodReadonly";
2753
- })(p || (p = {}));
2754
- const wt = (r, e = {
2755
- message: `Input not instance of ${r.name}`
2756
- }) => Ye((t) => t instanceof r, e), He = E.create, Je = V.create, Tt = Ze.create, Zt = L.create, Ge = ie.create, Ct = Y.create, St = be.create, Ot = oe.create, Nt = de.create, Et = K.create, Rt = W.create, It = z.create, jt = we.create, At = R.create, $t = b.create, Mt = b.strictCreate, zt = ce.create, Pt = Ce.create, Dt = ue.create, Vt = $.create, Lt = le.create, qt = Te.create, Ut = H.create, Bt = Q.create, Wt = fe.create, Yt = he.create, Ht = q.create, Jt = me.create, Gt = F.create, $e = I.create, Qt = j.create, Xt = U.create, Kt = I.createWithPreprocess, Ft = ve.create, er = () => He().optional(), tr = () => Je().optional(), rr = () => Ge().optional(), nr = {
2757
- string: (r) => E.create({ ...r, coerce: !0 }),
2758
- number: (r) => V.create({ ...r, coerce: !0 }),
2759
- boolean: (r) => ie.create({
2760
- ...r,
2761
- coerce: !0
2762
- }),
2763
- bigint: (r) => L.create({ ...r, coerce: !0 }),
2764
- date: (r) => Y.create({ ...r, coerce: !0 })
2765
- }, sr = y;
2766
- var O = /* @__PURE__ */ Object.freeze({
2767
- __proto__: null,
2768
- defaultErrorMap: X,
2769
- setErrorMap: st,
2770
- getErrorMap: ge,
2771
- makeIssue: xe,
2772
- EMPTY_PATH: at,
2773
- addIssueToContext: l,
2774
- ParseStatus: Z,
2775
- INVALID: y,
2776
- DIRTY: G,
2777
- OK: S,
2778
- isAborted: Ne,
2779
- isDirty: Ee,
2780
- isValid: se,
2781
- isAsync: ae,
2782
- get util() {
2783
- return x;
2784
- },
2785
- get objectUtil() {
2786
- return Oe;
2787
- },
2788
- ZodParsedType: f,
2789
- getParsedType: D,
2790
- ZodType: g,
2791
- datetimeRegex: Be,
2792
- ZodString: E,
2793
- ZodNumber: V,
2794
- ZodBigInt: L,
2795
- ZodBoolean: ie,
2796
- ZodDate: Y,
2797
- ZodSymbol: be,
2798
- ZodUndefined: oe,
2799
- ZodNull: de,
2800
- ZodAny: K,
2801
- ZodUnknown: W,
2802
- ZodNever: z,
2803
- ZodVoid: we,
2804
- ZodArray: R,
2805
- ZodObject: b,
2806
- ZodUnion: ce,
2807
- ZodDiscriminatedUnion: Ce,
2808
- ZodIntersection: ue,
2809
- ZodTuple: $,
2810
- ZodRecord: le,
2811
- ZodMap: Te,
2812
- ZodSet: H,
2813
- ZodFunction: Q,
2814
- ZodLazy: fe,
2815
- ZodLiteral: he,
2816
- ZodEnum: q,
2817
- ZodNativeEnum: me,
2818
- ZodPromise: F,
2819
- ZodEffects: I,
2820
- ZodTransformer: I,
2821
- ZodOptional: j,
2822
- ZodNullable: U,
2823
- ZodDefault: pe,
2824
- ZodCatch: ye,
2825
- ZodNaN: Ze,
2826
- BRAND: kt,
2827
- ZodBranded: Ie,
2828
- ZodPipeline: ve,
2829
- ZodReadonly: _e,
2830
- custom: Ye,
2831
- Schema: g,
2832
- ZodSchema: g,
2833
- late: bt,
2834
- get ZodFirstPartyTypeKind() {
2835
- return p;
2836
- },
2837
- coerce: nr,
2838
- any: Et,
2839
- array: At,
2840
- bigint: Zt,
2841
- boolean: Ge,
2842
- date: Ct,
2843
- discriminatedUnion: Pt,
2844
- effect: $e,
2845
- enum: Ht,
2846
- function: Bt,
2847
- instanceof: wt,
2848
- intersection: Dt,
2849
- lazy: Wt,
2850
- literal: Yt,
2851
- map: qt,
2852
- nan: Tt,
2853
- nativeEnum: Jt,
2854
- never: It,
2855
- null: Nt,
2856
- nullable: Xt,
2857
- number: Je,
2858
- object: $t,
2859
- oboolean: rr,
2860
- onumber: tr,
2861
- optional: Qt,
2862
- ostring: er,
2863
- pipeline: Ft,
2864
- preprocess: Kt,
2865
- promise: Gt,
2866
- record: Lt,
2867
- set: Ut,
2868
- strictObject: Mt,
2869
- string: He,
2870
- symbol: St,
2871
- transformer: $e,
2872
- tuple: Vt,
2873
- undefined: Ot,
2874
- union: zt,
2875
- unknown: Rt,
2876
- void: jt,
2877
- NEVER: sr,
2878
- ZodIssueCode: d,
2879
- quotelessJson: nt,
2880
- ZodError: N
2881
- });
2882
- const lr = () => {
2883
- const { formValidationTexts: r } = ze(Xe), e = (_) => (_ != null && _.useCoerce ? O.coerce : O).string({
2884
- invalid_type_error: r.required,
2885
- required_error: r.required
2886
- }).transform((w) => w ?? null), t = (_) => e(_).nullable().optional().transform((k) => k ?? null), n = (_) => {
2887
- const k = (_ != null && _.useCoerce ? O.coerce : O).number({
2888
- invalid_type_error: r.required,
2889
- required_error: r.required
2890
- });
2891
- return (_ == null ? void 0 : _.min) !== void 0 && k.min(_.min), (_ == null ? void 0 : _.max) !== void 0 && k.max(_.max), k.transform((w) => w ?? null);
2892
- }, s = (_) => n(_).nullable().optional().transform((k) => k ?? null), a = (_) => (_ != null && _.useCoerce ? O.coerce : O).boolean({
2893
- invalid_type_error: r.required,
2894
- required_error: r.required
2895
- }).transform((k) => k ?? null), i = (_) => (_ != null && _.useCoerce ? O.coerce : O).string({
2896
- invalid_type_error: r.required,
2897
- required_error: r.required
2898
- }).refine(rt, { message: r.invalidDate }).transform((w) => w ?? null), o = (_) => i(_).nullable().transform((k) => k ?? null), u = (_, k) => O.enum(_, {
2899
- invalid_type_error: r.required,
2900
- required_error: r.required
2901
- }).transform((je) => je ?? null);
2902
- return {
2903
- zString: t,
2904
- zStringRequired: e,
2905
- zNumber: s,
2906
- zNumberRequired: n,
2907
- zBool: a,
2908
- zDate: o,
2909
- zDateRequired: i,
2910
- zEnum: (_, k) => u(_).nullable().transform((w) => w ?? null),
2911
- zEnumRequired: u,
2912
- zObjectIdInt: (_) => O.object({ id: s({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
2913
- zObjectIdIntRequired: (_) => O.object({ id: n() }).transform((w) => w ?? null),
2914
- zObjectIdStr: (_) => O.object({ id: t({ useCoerce: !0 }) }).nullable().transform((w) => w ?? null),
2915
- zObjectIdStrRequired: (_) => O.object({ id: e() }).transform((w) => w ?? null),
2916
- zFile: ({ required: _, multiple: k, maxFileSize: w }) => O.any().transform((T) => Array.from(T ?? [])).refine((T) => !_ || (T == null ? void 0 : T.length) > 0, "File is required.").refine((T) => k || (T == null ? void 0 : T.length) <= 1, "Multiple files not allowed.").refine((T) => T.every((Qe) => Qe.size <= w), `Maximum file size is ${tt(w)}.`).transform((T) => (k ? T : T == null ? void 0 : T[0]) ?? null)
2917
- };
2918
- }, te = {
2919
- loadOnInit: !0,
2920
- silent: !1,
2921
- enabled: !0,
2922
- nullStateBeforeLoad: !0
2923
- }, fr = (r, { loadOnInit: e = te.loadOnInit, enabled: t = te.enabled, silent: n = te.silent, nullStateBeforeLoad: s = te.nullStateBeforeLoad, customApiUrl: a, customBearerToken: i } = te) => {
2924
- const o = Me({ silent: n, customToken: i, differentBaseUrl: a }), { startLoading: u, stopLoading: c } = ze(Ke), m = Fe(0), [C, B] = Pe(null), P = et(async (ee, _) => {
2925
- if (t !== !1) {
2926
- !n && u(`loadData-${r}-${_}`), s && B(null);
2927
- try {
2928
- const k = await o.get(r, {
2929
- signal: ee
2930
- });
2931
- B(k.data);
2932
- } finally {
2933
- !n && c(`loadData-${r}-${_}`);
2934
- }
2935
- }
2936
- }, [t, n, u, r, s, o, c]);
2937
- return De(() => {
2938
- if (e === !1)
2939
- return;
2940
- const ee = new AbortController();
2941
- return P(ee.signal, ++m.current), () => {
2942
- ee.abort();
2943
- };
2944
- }, [P, e]), { data: C, setData: B, reloadData: P };
2945
- }, ar = (r) => {
2946
- let e = "pending", t;
2947
- const n = r.then((s) => {
2948
- e = "success", t = s;
2949
- }, (s) => {
2950
- e = "error", t = s;
2951
- });
2952
- return () => {
2953
- switch (e) {
2954
- case "pending":
2955
- throw n;
2956
- case "success":
2957
- return t;
2958
- case "error":
2959
- throw t;
2960
- default:
2961
- throw new Error("Unknown status");
2962
- }
2963
- };
2964
- };
2965
- function hr(r) {
2966
- const e = Me({ silent: !0 }), [t, n] = Pe(null);
2967
- return De(() => {
2968
- (async () => {
2969
- const a = e.get(r).then((i) => i.data);
2970
- n(ar(a));
2971
- })();
2972
- }, [e, r]), t;
2973
- }
2974
- export {
2975
- yr as cancelToken,
2976
- _r as useAuth,
2977
- Me as useAxios,
2978
- wr as useClickOutside,
2979
- xr as useConfirm,
2980
- Tr as useFormControlType,
2981
- fr as useGetApiData,
2982
- hr as useGetDataBound,
2983
- Zr as useKeyPress,
2984
- vr as useNotifications,
2985
- Sr as usePermissions,
2986
- kr as usePrompt,
2987
- lr as useZodSchemaTypes
2988
- };