@burdenoff/microfe-organization 2026.1013.2 → 2026.1101.1

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