ics-ui-kit 1.0.0-alpha.0 → 1.0.0-alpha.2

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 (134) hide show
  1. package/dist/CalendarPreviousMonthButton-CHMp8bkd.js +2964 -0
  2. package/dist/CalendarPreviousMonthButton-CHMp8bkd.js.map +1 -0
  3. package/dist/{CheckboxField-Ca48ZYoX.js → CheckboxField-xDqHgXHh.js} +2 -2
  4. package/dist/{CheckboxField-Ca48ZYoX.js.map → CheckboxField-xDqHgXHh.js.map} +1 -1
  5. package/dist/{Command-CsW4aK7M.js → Command-WsAKNQrY.js} +2 -2
  6. package/dist/{Command-CsW4aK7M.js.map → Command-WsAKNQrY.js.map} +1 -1
  7. package/dist/{Dialog-BT_775Iz.js → Dialog-i_Y-phdM.js} +42 -43
  8. package/dist/Dialog-i_Y-phdM.js.map +1 -0
  9. package/dist/{Field-BRPdaQ8D.js → Field-BcwUtgGr.js} +2 -2
  10. package/dist/{Field-BRPdaQ8D.js.map → Field-BcwUtgGr.js.map} +1 -1
  11. package/dist/{FieldLabel-ic0eq9Un.js → FieldLabel-DYu1AcGH.js} +2 -2
  12. package/dist/{FieldLabel-ic0eq9Un.js.map → FieldLabel-DYu1AcGH.js.map} +1 -1
  13. package/dist/{FormFooterTemplate-BIwnBQhL.js → FormFooterTemplate-CHlas_Pp.js} +2 -2
  14. package/dist/{FormFooterTemplate-BIwnBQhL.js.map → FormFooterTemplate-CHlas_Pp.js.map} +1 -1
  15. package/dist/FormStack-DfoaOry7.js +1205 -0
  16. package/dist/FormStack-DfoaOry7.js.map +1 -0
  17. package/dist/{IconTooltip-CgbefRXG.js → IconTooltip-R6_6_f40.js} +2 -2
  18. package/dist/{IconTooltip-CgbefRXG.js.map → IconTooltip-R6_6_f40.js.map} +1 -1
  19. package/dist/{Popover-Dz2eNsXh.js → Popover-XrJa7lyb.js} +49 -50
  20. package/dist/Popover-XrJa7lyb.js.map +1 -0
  21. package/dist/{Select-Bfbtj5zt.js → Select-DO02vXt3.js} +185 -186
  22. package/dist/{Select-Bfbtj5zt.js.map → Select-DO02vXt3.js.map} +1 -1
  23. package/dist/{Sheet-aLBPtE1k.js → Sheet-C2UoHLL0.js} +35 -36
  24. package/dist/Sheet-C2UoHLL0.js.map +1 -0
  25. package/dist/{TextOverflowTooltip-BaNPKqnO.js → TextOverflowTooltip-XPDdO9Dz.js} +2 -2
  26. package/dist/{TextOverflowTooltip-BaNPKqnO.js.map → TextOverflowTooltip-XPDdO9Dz.js.map} +1 -1
  27. package/dist/{Tooltip-DOgKy50D.js → Tooltip-D2XvRS0c.js} +63 -64
  28. package/dist/Tooltip-D2XvRS0c.js.map +1 -0
  29. package/dist/blocks/auth/otp-form.js +3240 -204
  30. package/dist/blocks/auth/otp-form.js.map +1 -1
  31. package/dist/components/alert-dialog/AlertDialog.d.ts +2 -4
  32. package/dist/components/alert-dialog.js +70 -71
  33. package/dist/components/alert-dialog.js.map +1 -1
  34. package/dist/components/calendar/components/calendar-dropdown/CalendarDropdown.d.ts +24 -0
  35. package/dist/components/calendar/styles.d.ts +61 -0
  36. package/dist/components/calendar-scroll/CalendarScroll.d.ts +21 -0
  37. package/dist/components/calendar-scroll/CalendarScroll.stories.d.ts +16 -0
  38. package/dist/components/calendar-scroll/index.d.ts +3 -0
  39. package/dist/components/calendar-scroll.d.ts +2 -0
  40. package/dist/components/calendar-scroll.js +181 -0
  41. package/dist/components/calendar-scroll.js.map +1 -0
  42. package/dist/components/calendar.js +51 -147
  43. package/dist/components/calendar.js.map +1 -1
  44. package/dist/components/checkbox.js +1 -1
  45. package/dist/components/command.js +1 -1
  46. package/dist/components/dialog/Dialog.d.ts +2 -4
  47. package/dist/components/dialog.js +3 -3
  48. package/dist/components/drawer/components/drawer-content/DrawerContent.d.ts +1 -2
  49. package/dist/components/drawer.js +96 -97
  50. package/dist/components/drawer.js.map +1 -1
  51. package/dist/components/dropdown/Dropdown.d.ts +2 -4
  52. package/dist/components/dropdown.js +251 -252
  53. package/dist/components/dropdown.js.map +1 -1
  54. package/dist/components/field.js +1 -1
  55. package/dist/components/file-upload.js +1 -1
  56. package/dist/components/form/Form.d.ts +14 -0
  57. package/dist/components/form/components/form-field/FormField.d.ts +4 -0
  58. package/dist/components/form.js +3 -3
  59. package/dist/components/icon-tooltip.js +1 -1
  60. package/dist/components/label.js +1 -1
  61. package/dist/components/overflow-tooltip.js +1 -1
  62. package/dist/components/popover/Popover.d.ts +1 -2
  63. package/dist/components/popover.js +1 -1
  64. package/dist/components/resizable/Resizable.d.ts +1 -1
  65. package/dist/components/scheduler.js +1 -1
  66. package/dist/components/search-select/multi-select/MultiSelect.d.ts +1 -1
  67. package/dist/components/search-select.js +3 -3
  68. package/dist/components/search-select.js.map +1 -1
  69. package/dist/components/select/Select.d.ts +1 -2
  70. package/dist/components/select.js +1 -1
  71. package/dist/components/sheet/Sheet.d.ts +1 -2
  72. package/dist/components/sheet.js +1 -1
  73. package/dist/components/sidebar.js +2 -2
  74. package/dist/components/switch.js +1 -1
  75. package/dist/components/tag-input.js +1 -1
  76. package/dist/components/tooltip/Tooltip.d.ts +2 -4
  77. package/dist/components/tooltip.js +1 -1
  78. package/dist/tailwind.css +406 -361
  79. package/package.json +22 -18
  80. package/dist/DayPicker-4hE1QEvO.js +0 -2452
  81. package/dist/DayPicker-4hE1QEvO.js.map +0 -1
  82. package/dist/Dialog-BT_775Iz.js.map +0 -1
  83. package/dist/FormStack-CxiZhx1n.js +0 -127
  84. package/dist/FormStack-CxiZhx1n.js.map +0 -1
  85. package/dist/Popover-Dz2eNsXh.js.map +0 -1
  86. package/dist/Sheet-aLBPtE1k.js.map +0 -1
  87. package/dist/Tooltip-DOgKy50D.js.map +0 -1
  88. package/dist/buildMatchPatternFn-d7GTeGl_.js +0 -68
  89. package/dist/buildMatchPatternFn-d7GTeGl_.js.map +0 -1
  90. package/dist/components/portal-container/PortalContainer.d.ts +0 -10
  91. package/dist/components/portal-container/index.d.ts +0 -2
  92. package/dist/components/portal-container/portalContainerEvents.d.ts +0 -12
  93. package/dist/components/portal-container/usePortalContainer.d.ts +0 -11
  94. package/dist/components/portal-container.d.ts +0 -2
  95. package/dist/components/portal-container.js +0 -14
  96. package/dist/components/portal-container.js.map +0 -1
  97. package/dist/index.esm-CXA6i4d7.js +0 -1282
  98. package/dist/index.esm-CXA6i4d7.js.map +0 -1
  99. package/dist/normalizeDates-9A3c9WYM.js +0 -32
  100. package/dist/normalizeDates-9A3c9WYM.js.map +0 -1
  101. package/dist/styles.css +0 -9064
  102. package/dist/styles.d.ts +0 -1
  103. package/dist/usePortalContainer-B1xla842.js +0 -33
  104. package/dist/usePortalContainer-B1xla842.js.map +0 -1
  105. package/dist/vendors/date-fns/index.d.ts +0 -12
  106. package/dist/vendors/date-fns/locale/en-US/index.d.ts +0 -5
  107. package/dist/vendors/date-fns/locale/en-US.d.ts +0 -2
  108. package/dist/vendors/date-fns/locale/en-US.js +0 -372
  109. package/dist/vendors/date-fns/locale/en-US.js.map +0 -1
  110. package/dist/vendors/date-fns/locale/ru/index.d.ts +0 -5
  111. package/dist/vendors/date-fns/locale/ru.d.ts +0 -2
  112. package/dist/vendors/date-fns/locale/ru.js +0 -569
  113. package/dist/vendors/date-fns/locale/ru.js.map +0 -1
  114. package/dist/vendors/date-fns.d.ts +0 -2
  115. package/dist/vendors/date-fns.js +0 -2
  116. package/dist/vendors/date-fns.js.map +0 -1
  117. package/dist/vendors/react-day-picker/index.d.ts +0 -13
  118. package/dist/vendors/react-day-picker.d.ts +0 -2
  119. package/dist/vendors/react-day-picker.js +0 -87
  120. package/dist/vendors/react-day-picker.js.map +0 -1
  121. package/dist/vendors/react-hook-form/index.d.ts +0 -14
  122. package/dist/vendors/react-hook-form.d.ts +0 -2
  123. package/dist/vendors/react-hook-form.js +0 -19
  124. package/dist/vendors/react-hook-form.js.map +0 -1
  125. package/dist/vendors/tanstack/react-table/index.d.ts +0 -13
  126. package/dist/vendors/tanstack/react-table.d.ts +0 -2
  127. package/dist/vendors/tanstack/react-table.js +0 -2090
  128. package/dist/vendors/tanstack/react-table.js.map +0 -1
  129. package/dist/vendors/zod/index.d.ts +0 -13
  130. package/dist/vendors/zod.d.ts +0 -2
  131. package/dist/vendors/zod.js +0 -3080
  132. package/dist/vendors/zod.js.map +0 -1
  133. package/dist/zod-BMNoK3aM.js +0 -75
  134. package/dist/zod-BMNoK3aM.js.map +0 -1
@@ -1,309 +1,3345 @@
1
- var $ = Object.defineProperty;
2
- var z = (t, o, n) => o in t ? $(t, o, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[o] = n;
3
- var P = (t, o, n) => z(t, typeof o != "symbol" ? o + "" : o, n);
4
- import { jsx as a, jsxs as x } from "react/jsx-runtime";
5
- import S, { useMemo as N, useState as O, useCallback as B } from "react";
6
- import { a as D, F as L, g as R } from "../../FormStack-CxiZhx1n.js";
7
- import { s as G } from "../../zod-BMNoK3aM.js";
8
- import { e as V } from "../../index.esm-CXA6i4d7.js";
9
- import { z as v } from "../../vendors/zod.js";
10
- import { B as E } from "../../Button-_qdP4hSf.js";
11
- import { T as A } from "../../TextInput-CoL8nOyt.js";
12
- import { c as j } from "../../cn-dsXlqdJg.js";
13
- import { T as I } from "../../index-BVqs-uqP.js";
14
- import { L as k } from "../../loader-circle-D1YXTEGq.js";
15
- import { c as q, I as H, a as J, b as K } from "../../InputOTP-DkVh6bBz.js";
16
- class w extends Error {
17
- constructor(n, r = "invalid_code") {
18
- super(n);
19
- P(this, "type");
20
- this.type = r, this.name = "OTPError", Object.setPrototypeOf(this, w.prototype);
1
+ var yt = Object.defineProperty;
2
+ var vt = (r, e, t) => e in r ? yt(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var Fe = (r, e, t) => vt(r, typeof e != "symbol" ? e + "" : e, t);
4
+ import { jsx as w, jsxs as Oe } from "react/jsx-runtime";
5
+ import z, { useMemo as Ue, useState as We, useCallback as be } from "react";
6
+ import { h as je, s as Ae, i as gt, j as Qe, a as Ke, F as Le, g as et } from "../../FormStack-DfoaOry7.js";
7
+ import { B as De } from "../../Button-_qdP4hSf.js";
8
+ import { T as _t } from "../../TextInput-CoL8nOyt.js";
9
+ import { c as tt } from "../../cn-dsXlqdJg.js";
10
+ import { T as Be } from "../../index-BVqs-uqP.js";
11
+ import { L as rt } from "../../loader-circle-D1YXTEGq.js";
12
+ import { c as xt, I as bt, a as kt, b as wt } from "../../InputOTP-DkVh6bBz.js";
13
+ const qe = (r, e, t) => {
14
+ if (r && "reportValidity" in r) {
15
+ const n = je(t, e);
16
+ r.setCustomValidity(n && n.message || ""), r.reportValidity();
17
+ }
18
+ }, nt = (r, e) => {
19
+ for (const t in e.fields) {
20
+ const n = e.fields[t];
21
+ n && n.ref && "reportValidity" in n.ref ? qe(n.ref, t, r) : n && n.refs && n.refs.forEach((s) => qe(s, t, r));
22
+ }
23
+ }, Tt = (r, e) => {
24
+ e.shouldUseNativeValidation && nt(r, e);
25
+ const t = {};
26
+ for (const n in r) {
27
+ const s = je(e.fields, n), a = Object.assign(r[n] || {}, { ref: s && s.ref });
28
+ if (Ct(e.names || Object.keys(r), n)) {
29
+ const i = Object.assign({}, je(t, n));
30
+ Ae(i, "root", a), Ae(t, n, i);
31
+ } else Ae(t, n, a);
32
+ }
33
+ return t;
34
+ }, Ct = (r, e) => {
35
+ const t = Je(e);
36
+ return r.some((n) => Je(n).match(`^${t}\\.\\d+`));
37
+ };
38
+ function Je(r) {
39
+ return r.replace(/\]|\[/g, "");
40
+ }
41
+ function St(r, e) {
42
+ for (var t = {}; r.length; ) {
43
+ var n = r[0], s = n.code, a = n.message, i = n.path.join(".");
44
+ if (!t[i]) if ("unionErrors" in n) {
45
+ var o = n.unionErrors[0].errors[0];
46
+ t[i] = { message: o.message, type: o.code };
47
+ } else t[i] = { message: a, type: s };
48
+ if ("unionErrors" in n && n.unionErrors.forEach(function(h) {
49
+ return h.errors.forEach(function(x) {
50
+ return r.push(x);
51
+ });
52
+ }), e) {
53
+ var u = t[i].types, d = u && u[n.code];
54
+ t[i] = gt(i, e, t, s, d ? [].concat(d, n.message) : n.message);
55
+ }
56
+ r.shift();
57
+ }
58
+ return t;
59
+ }
60
+ function Zt(r, e, t) {
61
+ return t === void 0 && (t = {}), function(n, s, a) {
62
+ try {
63
+ return Promise.resolve(function(i, o) {
64
+ try {
65
+ var u = Promise.resolve(r[t.mode === "sync" ? "parse" : "parseAsync"](n, e)).then(function(d) {
66
+ return a.shouldUseNativeValidation && nt({}, a), { errors: {}, values: t.raw ? Object.assign({}, n) : d };
67
+ });
68
+ } catch (d) {
69
+ return o(d);
70
+ }
71
+ return u && u.then ? u.then(void 0, o) : u;
72
+ }(0, function(i) {
73
+ if (function(o) {
74
+ return Array.isArray(o?.errors);
75
+ }(i)) return { values: {}, errors: Tt(St(i.errors, !a.shouldUseNativeValidation && a.criteriaMode === "all"), a) };
76
+ throw i;
77
+ }));
78
+ } catch (i) {
79
+ return Promise.reject(i);
80
+ }
81
+ };
82
+ }
83
+ var _;
84
+ (function(r) {
85
+ r.assertEqual = (s) => s;
86
+ function e(s) {
87
+ }
88
+ r.assertIs = e;
89
+ function t(s) {
90
+ throw new Error();
91
+ }
92
+ r.assertNever = t, r.arrayToEnum = (s) => {
93
+ const a = {};
94
+ for (const i of s)
95
+ a[i] = i;
96
+ return a;
97
+ }, r.getValidEnumValues = (s) => {
98
+ const a = r.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
99
+ for (const o of a)
100
+ i[o] = s[o];
101
+ return r.objectValues(i);
102
+ }, r.objectValues = (s) => r.objectKeys(s).map(function(a) {
103
+ return s[a];
104
+ }), r.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
105
+ const a = [];
106
+ for (const i in s)
107
+ Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
108
+ return a;
109
+ }, r.find = (s, a) => {
110
+ for (const i of s)
111
+ if (a(i))
112
+ return i;
113
+ }, r.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
114
+ function n(s, a = " | ") {
115
+ return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
116
+ }
117
+ r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
118
+ })(_ || (_ = {}));
119
+ var Pe;
120
+ (function(r) {
121
+ r.mergeShapes = (e, t) => ({
122
+ ...e,
123
+ ...t
124
+ // second overwrites first
125
+ });
126
+ })(Pe || (Pe = {}));
127
+ const f = _.arrayToEnum([
128
+ "string",
129
+ "nan",
130
+ "number",
131
+ "integer",
132
+ "float",
133
+ "boolean",
134
+ "date",
135
+ "bigint",
136
+ "symbol",
137
+ "function",
138
+ "undefined",
139
+ "null",
140
+ "array",
141
+ "object",
142
+ "unknown",
143
+ "promise",
144
+ "void",
145
+ "never",
146
+ "map",
147
+ "set"
148
+ ]), L = (r) => {
149
+ switch (typeof r) {
150
+ case "undefined":
151
+ return f.undefined;
152
+ case "string":
153
+ return f.string;
154
+ case "number":
155
+ return isNaN(r) ? f.nan : f.number;
156
+ case "boolean":
157
+ return f.boolean;
158
+ case "function":
159
+ return f.function;
160
+ case "bigint":
161
+ return f.bigint;
162
+ case "symbol":
163
+ return f.symbol;
164
+ case "object":
165
+ 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;
166
+ default:
167
+ return f.unknown;
168
+ }
169
+ }, c = _.arrayToEnum([
170
+ "invalid_type",
171
+ "invalid_literal",
172
+ "custom",
173
+ "invalid_union",
174
+ "invalid_union_discriminator",
175
+ "invalid_enum_value",
176
+ "unrecognized_keys",
177
+ "invalid_arguments",
178
+ "invalid_return_type",
179
+ "invalid_date",
180
+ "invalid_string",
181
+ "too_small",
182
+ "too_big",
183
+ "invalid_intersection_types",
184
+ "not_multiple_of",
185
+ "not_finite"
186
+ ]), Et = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
187
+ class O extends Error {
188
+ get errors() {
189
+ return this.issues;
190
+ }
191
+ constructor(e) {
192
+ super(), this.issues = [], this.addIssue = (n) => {
193
+ this.issues = [...this.issues, n];
194
+ }, this.addIssues = (n = []) => {
195
+ this.issues = [...this.issues, ...n];
196
+ };
197
+ const t = new.target.prototype;
198
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
199
+ }
200
+ format(e) {
201
+ const t = e || function(a) {
202
+ return a.message;
203
+ }, n = { _errors: [] }, s = (a) => {
204
+ for (const i of a.issues)
205
+ if (i.code === "invalid_union")
206
+ i.unionErrors.map(s);
207
+ else if (i.code === "invalid_return_type")
208
+ s(i.returnTypeError);
209
+ else if (i.code === "invalid_arguments")
210
+ s(i.argumentsError);
211
+ else if (i.path.length === 0)
212
+ n._errors.push(t(i));
213
+ else {
214
+ let o = n, u = 0;
215
+ for (; u < i.path.length; ) {
216
+ const d = i.path[u];
217
+ u === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(t(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], u++;
218
+ }
219
+ }
220
+ };
221
+ return s(this), n;
222
+ }
223
+ static assert(e) {
224
+ if (!(e instanceof O))
225
+ throw new Error(`Not a ZodError: ${e}`);
226
+ }
227
+ toString() {
228
+ return this.message;
229
+ }
230
+ get message() {
231
+ return JSON.stringify(this.issues, _.jsonStringifyReplacer, 2);
232
+ }
233
+ get isEmpty() {
234
+ return this.issues.length === 0;
235
+ }
236
+ flatten(e = (t) => t.message) {
237
+ const t = {}, n = [];
238
+ for (const s of this.issues)
239
+ s.path.length > 0 ? (t[s.path[0]] = t[s.path[0]] || [], t[s.path[0]].push(e(s))) : n.push(e(s));
240
+ return { formErrors: n, fieldErrors: t };
241
+ }
242
+ get formErrors() {
243
+ return this.flatten();
244
+ }
245
+ }
246
+ O.create = (r) => new O(r);
247
+ const re = (r, e) => {
248
+ let t;
249
+ switch (r.code) {
250
+ case c.invalid_type:
251
+ r.received === f.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`;
252
+ break;
253
+ case c.invalid_literal:
254
+ t = `Invalid literal value, expected ${JSON.stringify(r.expected, _.jsonStringifyReplacer)}`;
255
+ break;
256
+ case c.unrecognized_keys:
257
+ t = `Unrecognized key(s) in object: ${_.joinValues(r.keys, ", ")}`;
258
+ break;
259
+ case c.invalid_union:
260
+ t = "Invalid input";
261
+ break;
262
+ case c.invalid_union_discriminator:
263
+ t = `Invalid discriminator value. Expected ${_.joinValues(r.options)}`;
264
+ break;
265
+ case c.invalid_enum_value:
266
+ t = `Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;
267
+ break;
268
+ case c.invalid_arguments:
269
+ t = "Invalid function arguments";
270
+ break;
271
+ case c.invalid_return_type:
272
+ t = "Invalid function return type";
273
+ break;
274
+ case c.invalid_date:
275
+ t = "Invalid date";
276
+ break;
277
+ case c.invalid_string:
278
+ 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}"` : _.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid";
279
+ break;
280
+ case c.too_small:
281
+ 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";
282
+ break;
283
+ case c.too_big:
284
+ 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";
285
+ break;
286
+ case c.custom:
287
+ t = "Invalid input";
288
+ break;
289
+ case c.invalid_intersection_types:
290
+ t = "Intersection results could not be merged";
291
+ break;
292
+ case c.not_multiple_of:
293
+ t = `Number must be a multiple of ${r.multipleOf}`;
294
+ break;
295
+ case c.not_finite:
296
+ t = "Number must be finite";
297
+ break;
298
+ default:
299
+ t = e.defaultError, _.assertNever(r);
300
+ }
301
+ return { message: t };
302
+ };
303
+ let st = re;
304
+ function Ot(r) {
305
+ st = r;
306
+ }
307
+ function ke() {
308
+ return st;
309
+ }
310
+ const we = (r) => {
311
+ const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
312
+ ...s,
313
+ path: a
314
+ };
315
+ if (s.message !== void 0)
316
+ return {
317
+ ...s,
318
+ path: a,
319
+ message: s.message
320
+ };
321
+ let o = "";
322
+ const u = n.filter((d) => !!d).slice().reverse();
323
+ for (const d of u)
324
+ o = d(i, { data: e, defaultError: o }).message;
325
+ return {
326
+ ...s,
327
+ path: a,
328
+ message: o
329
+ };
330
+ }, Nt = [];
331
+ function l(r, e) {
332
+ const t = ke(), n = we({
333
+ issueData: e,
334
+ data: r.data,
335
+ path: r.path,
336
+ errorMaps: [
337
+ r.common.contextualErrorMap,
338
+ // contextual error map is first priority
339
+ r.schemaErrorMap,
340
+ // then schema-bound map if available
341
+ t,
342
+ // then global override map
343
+ t === re ? void 0 : re
344
+ // then global default map
345
+ ].filter((s) => !!s)
346
+ });
347
+ r.common.issues.push(n);
348
+ }
349
+ class T {
350
+ constructor() {
351
+ this.value = "valid";
352
+ }
353
+ dirty() {
354
+ this.value === "valid" && (this.value = "dirty");
355
+ }
356
+ abort() {
357
+ this.value !== "aborted" && (this.value = "aborted");
358
+ }
359
+ static mergeArray(e, t) {
360
+ const n = [];
361
+ for (const s of t) {
362
+ if (s.status === "aborted")
363
+ return y;
364
+ s.status === "dirty" && e.dirty(), n.push(s.value);
365
+ }
366
+ return { status: e.value, value: n };
367
+ }
368
+ static async mergeObjectAsync(e, t) {
369
+ const n = [];
370
+ for (const s of t) {
371
+ const a = await s.key, i = await s.value;
372
+ n.push({
373
+ key: a,
374
+ value: i
375
+ });
376
+ }
377
+ return T.mergeObjectSync(e, n);
378
+ }
379
+ static mergeObjectSync(e, t) {
380
+ const n = {};
381
+ for (const s of t) {
382
+ const { key: a, value: i } = s;
383
+ if (a.status === "aborted" || i.status === "aborted")
384
+ return y;
385
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
386
+ }
387
+ return { status: e.value, value: n };
388
+ }
389
+ }
390
+ const y = Object.freeze({
391
+ status: "aborted"
392
+ }), K = (r) => ({ status: "dirty", value: r }), S = (r) => ({ status: "valid", value: r }), $e = (r) => r.status === "aborted", Ve = (r) => r.status === "dirty", G = (r) => r.status === "valid", oe = (r) => typeof Promise < "u" && r instanceof Promise;
393
+ function Te(r, e, t, n) {
394
+ if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
395
+ return e.get(r);
396
+ }
397
+ function at(r, e, t, n, s) {
398
+ if (typeof e == "function" ? r !== e || !0 : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
399
+ return e.set(r, t), t;
400
+ }
401
+ var m;
402
+ (function(r) {
403
+ r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e?.message;
404
+ })(m || (m = {}));
405
+ var ae, ie;
406
+ class $ {
407
+ constructor(e, t, n, s) {
408
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
409
+ }
410
+ get path() {
411
+ return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
412
+ }
413
+ }
414
+ const Ye = (r, e) => {
415
+ if (G(e))
416
+ return { success: !0, data: e.value };
417
+ if (!r.common.issues.length)
418
+ throw new Error("Validation failed but no issues detected.");
419
+ return {
420
+ success: !1,
421
+ get error() {
422
+ if (this._error)
423
+ return this._error;
424
+ const t = new O(r.common.issues);
425
+ return this._error = t, this._error;
426
+ }
427
+ };
428
+ };
429
+ function v(r) {
430
+ if (!r)
431
+ return {};
432
+ const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
433
+ if (e && (t || n))
434
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
435
+ return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
436
+ var u, d;
437
+ const { message: h } = r;
438
+ return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: (u = h ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (d = h ?? t) !== null && d !== void 0 ? d : o.defaultError };
439
+ }, description: s };
440
+ }
441
+ class g {
442
+ get description() {
443
+ return this._def.description;
444
+ }
445
+ _getType(e) {
446
+ return L(e.data);
447
+ }
448
+ _getOrReturnCtx(e, t) {
449
+ return t || {
450
+ common: e.parent.common,
451
+ data: e.data,
452
+ parsedType: L(e.data),
453
+ schemaErrorMap: this._def.errorMap,
454
+ path: e.path,
455
+ parent: e.parent
456
+ };
457
+ }
458
+ _processInputParams(e) {
459
+ return {
460
+ status: new T(),
461
+ ctx: {
462
+ common: e.parent.common,
463
+ data: e.data,
464
+ parsedType: L(e.data),
465
+ schemaErrorMap: this._def.errorMap,
466
+ path: e.path,
467
+ parent: e.parent
468
+ }
469
+ };
470
+ }
471
+ _parseSync(e) {
472
+ const t = this._parse(e);
473
+ if (oe(t))
474
+ throw new Error("Synchronous parse encountered promise.");
475
+ return t;
476
+ }
477
+ _parseAsync(e) {
478
+ const t = this._parse(e);
479
+ return Promise.resolve(t);
480
+ }
481
+ parse(e, t) {
482
+ const n = this.safeParse(e, t);
483
+ if (n.success)
484
+ return n.data;
485
+ throw n.error;
486
+ }
487
+ safeParse(e, t) {
488
+ var n;
489
+ const s = {
490
+ common: {
491
+ issues: [],
492
+ async: (n = t?.async) !== null && n !== void 0 ? n : !1,
493
+ contextualErrorMap: t?.errorMap
494
+ },
495
+ path: t?.path || [],
496
+ schemaErrorMap: this._def.errorMap,
497
+ parent: null,
498
+ data: e,
499
+ parsedType: L(e)
500
+ }, a = this._parseSync({ data: e, path: s.path, parent: s });
501
+ return Ye(s, a);
502
+ }
503
+ "~validate"(e) {
504
+ var t, n;
505
+ const s = {
506
+ common: {
507
+ issues: [],
508
+ async: !!this["~standard"].async
509
+ },
510
+ path: [],
511
+ schemaErrorMap: this._def.errorMap,
512
+ parent: null,
513
+ data: e,
514
+ parsedType: L(e)
515
+ };
516
+ if (!this["~standard"].async)
517
+ try {
518
+ const a = this._parseSync({ data: e, path: [], parent: s });
519
+ return G(a) ? {
520
+ value: a.value
521
+ } : {
522
+ issues: s.common.issues
523
+ };
524
+ } catch (a) {
525
+ !((n = (t = a?.message) === null || t === void 0 ? void 0 : t.toLowerCase()) === null || n === void 0) && n.includes("encountered") && (this["~standard"].async = !0), s.common = {
526
+ issues: [],
527
+ async: !0
528
+ };
529
+ }
530
+ return this._parseAsync({ data: e, path: [], parent: s }).then((a) => G(a) ? {
531
+ value: a.value
532
+ } : {
533
+ issues: s.common.issues
534
+ });
535
+ }
536
+ async parseAsync(e, t) {
537
+ const n = await this.safeParseAsync(e, t);
538
+ if (n.success)
539
+ return n.data;
540
+ throw n.error;
541
+ }
542
+ async safeParseAsync(e, t) {
543
+ const n = {
544
+ common: {
545
+ issues: [],
546
+ contextualErrorMap: t?.errorMap,
547
+ async: !0
548
+ },
549
+ path: t?.path || [],
550
+ schemaErrorMap: this._def.errorMap,
551
+ parent: null,
552
+ data: e,
553
+ parsedType: L(e)
554
+ }, s = this._parse({ data: e, path: n.path, parent: n }), a = await (oe(s) ? s : Promise.resolve(s));
555
+ return Ye(n, a);
556
+ }
557
+ refine(e, t) {
558
+ const n = (s) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(s) : t;
559
+ return this._refinement((s, a) => {
560
+ const i = e(s), o = () => a.addIssue({
561
+ code: c.custom,
562
+ ...n(s)
563
+ });
564
+ return typeof Promise < "u" && i instanceof Promise ? i.then((u) => u ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
565
+ });
566
+ }
567
+ refinement(e, t) {
568
+ return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
569
+ }
570
+ _refinement(e) {
571
+ return new j({
572
+ schema: this,
573
+ typeName: p.ZodEffects,
574
+ effect: { type: "refinement", refinement: e }
575
+ });
576
+ }
577
+ superRefine(e) {
578
+ return this._refinement(e);
579
+ }
580
+ constructor(e) {
581
+ 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"] = {
582
+ version: 1,
583
+ vendor: "zod",
584
+ validate: (t) => this["~validate"](t)
585
+ };
586
+ }
587
+ optional() {
588
+ return P.create(this, this._def);
589
+ }
590
+ nullable() {
591
+ return q.create(this, this._def);
592
+ }
593
+ nullish() {
594
+ return this.nullable().optional();
595
+ }
596
+ array() {
597
+ return I.create(this);
598
+ }
599
+ promise() {
600
+ return se.create(this, this._def);
601
+ }
602
+ or(e) {
603
+ return le.create([this, e], this._def);
604
+ }
605
+ and(e) {
606
+ return fe.create(this, e, this._def);
607
+ }
608
+ transform(e) {
609
+ return new j({
610
+ ...v(this._def),
611
+ schema: this,
612
+ typeName: p.ZodEffects,
613
+ effect: { type: "transform", transform: e }
614
+ });
615
+ }
616
+ default(e) {
617
+ const t = typeof e == "function" ? e : () => e;
618
+ return new ve({
619
+ ...v(this._def),
620
+ innerType: this,
621
+ defaultValue: t,
622
+ typeName: p.ZodDefault
623
+ });
624
+ }
625
+ brand() {
626
+ return new ze({
627
+ typeName: p.ZodBranded,
628
+ type: this,
629
+ ...v(this._def)
630
+ });
631
+ }
632
+ catch(e) {
633
+ const t = typeof e == "function" ? e : () => e;
634
+ return new ge({
635
+ ...v(this._def),
636
+ innerType: this,
637
+ catchValue: t,
638
+ typeName: p.ZodCatch
639
+ });
640
+ }
641
+ describe(e) {
642
+ const t = this.constructor;
643
+ return new t({
644
+ ...this._def,
645
+ description: e
646
+ });
647
+ }
648
+ pipe(e) {
649
+ return xe.create(this, e);
650
+ }
651
+ readonly() {
652
+ return _e.create(this);
653
+ }
654
+ isOptional() {
655
+ return this.safeParse(void 0).success;
656
+ }
657
+ isNullable() {
658
+ return this.safeParse(null).success;
659
+ }
660
+ }
661
+ const At = /^c[^\s-]{8,}$/i, Rt = /^[0-9a-z]+$/, It = /^[0-9A-HJKMNP-TV-Z]{26}$/i, jt = /^[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, Pt = /^[a-z0-9_-]{21}$/i, $t = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Vt = /^[-+]?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)?)??$/, Mt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Lt = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
662
+ let Re;
663
+ const Dt = /^(?:(?: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])$/, Bt = /^(?:(?: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])$/, zt = /^(([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]))$/, Ft = /^(([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])$/, Ut = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Wt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, it = "((\\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])))", qt = new RegExp(`^${it}$`);
664
+ function ot(r) {
665
+ let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
666
+ return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
667
+ }
668
+ function Jt(r) {
669
+ return new RegExp(`^${ot(r)}$`);
670
+ }
671
+ function dt(r) {
672
+ let e = `${it}T${ot(r)}`;
673
+ const t = [];
674
+ return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
675
+ }
676
+ function Yt(r, e) {
677
+ return !!((e === "v4" || !e) && Dt.test(r) || (e === "v6" || !e) && zt.test(r));
678
+ }
679
+ function Gt(r, e) {
680
+ if (!$t.test(r))
681
+ return !1;
682
+ try {
683
+ const [t] = r.split("."), n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(n));
684
+ return !(typeof s != "object" || s === null || !s.typ || !s.alg || e && s.alg !== e);
685
+ } catch {
686
+ return !1;
687
+ }
688
+ }
689
+ function Ht(r, e) {
690
+ return !!((e === "v4" || !e) && Bt.test(r) || (e === "v6" || !e) && Ft.test(r));
691
+ }
692
+ class R extends g {
693
+ _parse(e) {
694
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
695
+ const a = this._getOrReturnCtx(e);
696
+ return l(a, {
697
+ code: c.invalid_type,
698
+ expected: f.string,
699
+ received: a.parsedType
700
+ }), y;
701
+ }
702
+ const n = new T();
703
+ let s;
704
+ for (const a of this._def.checks)
705
+ if (a.kind === "min")
706
+ e.data.length < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
707
+ code: c.too_small,
708
+ minimum: a.value,
709
+ type: "string",
710
+ inclusive: !0,
711
+ exact: !1,
712
+ message: a.message
713
+ }), n.dirty());
714
+ else if (a.kind === "max")
715
+ e.data.length > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
716
+ code: c.too_big,
717
+ maximum: a.value,
718
+ type: "string",
719
+ inclusive: !0,
720
+ exact: !1,
721
+ message: a.message
722
+ }), n.dirty());
723
+ else if (a.kind === "length") {
724
+ const i = e.data.length > a.value, o = e.data.length < a.value;
725
+ (i || o) && (s = this._getOrReturnCtx(e, s), i ? l(s, {
726
+ code: c.too_big,
727
+ maximum: a.value,
728
+ type: "string",
729
+ inclusive: !0,
730
+ exact: !0,
731
+ message: a.message
732
+ }) : o && l(s, {
733
+ code: c.too_small,
734
+ minimum: a.value,
735
+ type: "string",
736
+ inclusive: !0,
737
+ exact: !0,
738
+ message: a.message
739
+ }), n.dirty());
740
+ } else if (a.kind === "email")
741
+ Mt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
742
+ validation: "email",
743
+ code: c.invalid_string,
744
+ message: a.message
745
+ }), n.dirty());
746
+ else if (a.kind === "emoji")
747
+ Re || (Re = new RegExp(Lt, "u")), Re.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
748
+ validation: "emoji",
749
+ code: c.invalid_string,
750
+ message: a.message
751
+ }), n.dirty());
752
+ else if (a.kind === "uuid")
753
+ jt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
754
+ validation: "uuid",
755
+ code: c.invalid_string,
756
+ message: a.message
757
+ }), n.dirty());
758
+ else if (a.kind === "nanoid")
759
+ Pt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
760
+ validation: "nanoid",
761
+ code: c.invalid_string,
762
+ message: a.message
763
+ }), n.dirty());
764
+ else if (a.kind === "cuid")
765
+ At.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
766
+ validation: "cuid",
767
+ code: c.invalid_string,
768
+ message: a.message
769
+ }), n.dirty());
770
+ else if (a.kind === "cuid2")
771
+ Rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
772
+ validation: "cuid2",
773
+ code: c.invalid_string,
774
+ message: a.message
775
+ }), n.dirty());
776
+ else if (a.kind === "ulid")
777
+ It.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
778
+ validation: "ulid",
779
+ code: c.invalid_string,
780
+ message: a.message
781
+ }), n.dirty());
782
+ else if (a.kind === "url")
783
+ try {
784
+ new URL(e.data);
785
+ } catch {
786
+ s = this._getOrReturnCtx(e, s), l(s, {
787
+ validation: "url",
788
+ code: c.invalid_string,
789
+ message: a.message
790
+ }), n.dirty();
791
+ }
792
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
793
+ validation: "regex",
794
+ code: c.invalid_string,
795
+ message: a.message
796
+ }), 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, {
797
+ code: c.invalid_string,
798
+ validation: { includes: a.value, position: a.position },
799
+ message: a.message
800
+ }), 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, {
801
+ code: c.invalid_string,
802
+ validation: { startsWith: a.value },
803
+ message: a.message
804
+ }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), l(s, {
805
+ code: c.invalid_string,
806
+ validation: { endsWith: a.value },
807
+ message: a.message
808
+ }), n.dirty()) : a.kind === "datetime" ? dt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
809
+ code: c.invalid_string,
810
+ validation: "datetime",
811
+ message: a.message
812
+ }), n.dirty()) : a.kind === "date" ? qt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
813
+ code: c.invalid_string,
814
+ validation: "date",
815
+ message: a.message
816
+ }), n.dirty()) : a.kind === "time" ? Jt(a).test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
817
+ code: c.invalid_string,
818
+ validation: "time",
819
+ message: a.message
820
+ }), n.dirty()) : a.kind === "duration" ? Vt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
821
+ validation: "duration",
822
+ code: c.invalid_string,
823
+ message: a.message
824
+ }), n.dirty()) : a.kind === "ip" ? Yt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
825
+ validation: "ip",
826
+ code: c.invalid_string,
827
+ message: a.message
828
+ }), n.dirty()) : a.kind === "jwt" ? Gt(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), l(s, {
829
+ validation: "jwt",
830
+ code: c.invalid_string,
831
+ message: a.message
832
+ }), n.dirty()) : a.kind === "cidr" ? Ht(e.data, a.version) || (s = this._getOrReturnCtx(e, s), l(s, {
833
+ validation: "cidr",
834
+ code: c.invalid_string,
835
+ message: a.message
836
+ }), n.dirty()) : a.kind === "base64" ? Ut.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
837
+ validation: "base64",
838
+ code: c.invalid_string,
839
+ message: a.message
840
+ }), n.dirty()) : a.kind === "base64url" ? Wt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
841
+ validation: "base64url",
842
+ code: c.invalid_string,
843
+ message: a.message
844
+ }), n.dirty()) : _.assertNever(a);
845
+ return { status: n.value, value: e.data };
846
+ }
847
+ _regex(e, t, n) {
848
+ return this.refinement((s) => e.test(s), {
849
+ validation: t,
850
+ code: c.invalid_string,
851
+ ...m.errToObj(n)
852
+ });
853
+ }
854
+ _addCheck(e) {
855
+ return new R({
856
+ ...this._def,
857
+ checks: [...this._def.checks, e]
858
+ });
859
+ }
860
+ email(e) {
861
+ return this._addCheck({ kind: "email", ...m.errToObj(e) });
862
+ }
863
+ url(e) {
864
+ return this._addCheck({ kind: "url", ...m.errToObj(e) });
865
+ }
866
+ emoji(e) {
867
+ return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
868
+ }
869
+ uuid(e) {
870
+ return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
871
+ }
872
+ nanoid(e) {
873
+ return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
874
+ }
875
+ cuid(e) {
876
+ return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
877
+ }
878
+ cuid2(e) {
879
+ return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
880
+ }
881
+ ulid(e) {
882
+ return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
883
+ }
884
+ base64(e) {
885
+ return this._addCheck({ kind: "base64", ...m.errToObj(e) });
886
+ }
887
+ base64url(e) {
888
+ return this._addCheck({
889
+ kind: "base64url",
890
+ ...m.errToObj(e)
891
+ });
892
+ }
893
+ jwt(e) {
894
+ return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
895
+ }
896
+ ip(e) {
897
+ return this._addCheck({ kind: "ip", ...m.errToObj(e) });
898
+ }
899
+ cidr(e) {
900
+ return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
901
+ }
902
+ datetime(e) {
903
+ var t, n;
904
+ return typeof e == "string" ? this._addCheck({
905
+ kind: "datetime",
906
+ precision: null,
907
+ offset: !1,
908
+ local: !1,
909
+ message: e
910
+ }) : this._addCheck({
911
+ kind: "datetime",
912
+ precision: typeof e?.precision > "u" ? null : e?.precision,
913
+ offset: (t = e?.offset) !== null && t !== void 0 ? t : !1,
914
+ local: (n = e?.local) !== null && n !== void 0 ? n : !1,
915
+ ...m.errToObj(e?.message)
916
+ });
917
+ }
918
+ date(e) {
919
+ return this._addCheck({ kind: "date", message: e });
920
+ }
921
+ time(e) {
922
+ return typeof e == "string" ? this._addCheck({
923
+ kind: "time",
924
+ precision: null,
925
+ message: e
926
+ }) : this._addCheck({
927
+ kind: "time",
928
+ precision: typeof e?.precision > "u" ? null : e?.precision,
929
+ ...m.errToObj(e?.message)
930
+ });
931
+ }
932
+ duration(e) {
933
+ return this._addCheck({ kind: "duration", ...m.errToObj(e) });
934
+ }
935
+ regex(e, t) {
936
+ return this._addCheck({
937
+ kind: "regex",
938
+ regex: e,
939
+ ...m.errToObj(t)
940
+ });
941
+ }
942
+ includes(e, t) {
943
+ return this._addCheck({
944
+ kind: "includes",
945
+ value: e,
946
+ position: t?.position,
947
+ ...m.errToObj(t?.message)
948
+ });
949
+ }
950
+ startsWith(e, t) {
951
+ return this._addCheck({
952
+ kind: "startsWith",
953
+ value: e,
954
+ ...m.errToObj(t)
955
+ });
956
+ }
957
+ endsWith(e, t) {
958
+ return this._addCheck({
959
+ kind: "endsWith",
960
+ value: e,
961
+ ...m.errToObj(t)
962
+ });
963
+ }
964
+ min(e, t) {
965
+ return this._addCheck({
966
+ kind: "min",
967
+ value: e,
968
+ ...m.errToObj(t)
969
+ });
970
+ }
971
+ max(e, t) {
972
+ return this._addCheck({
973
+ kind: "max",
974
+ value: e,
975
+ ...m.errToObj(t)
976
+ });
977
+ }
978
+ length(e, t) {
979
+ return this._addCheck({
980
+ kind: "length",
981
+ value: e,
982
+ ...m.errToObj(t)
983
+ });
984
+ }
985
+ /**
986
+ * Equivalent to `.min(1)`
987
+ */
988
+ nonempty(e) {
989
+ return this.min(1, m.errToObj(e));
990
+ }
991
+ trim() {
992
+ return new R({
993
+ ...this._def,
994
+ checks: [...this._def.checks, { kind: "trim" }]
995
+ });
996
+ }
997
+ toLowerCase() {
998
+ return new R({
999
+ ...this._def,
1000
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1001
+ });
1002
+ }
1003
+ toUpperCase() {
1004
+ return new R({
1005
+ ...this._def,
1006
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1007
+ });
1008
+ }
1009
+ get isDatetime() {
1010
+ return !!this._def.checks.find((e) => e.kind === "datetime");
1011
+ }
1012
+ get isDate() {
1013
+ return !!this._def.checks.find((e) => e.kind === "date");
1014
+ }
1015
+ get isTime() {
1016
+ return !!this._def.checks.find((e) => e.kind === "time");
1017
+ }
1018
+ get isDuration() {
1019
+ return !!this._def.checks.find((e) => e.kind === "duration");
1020
+ }
1021
+ get isEmail() {
1022
+ return !!this._def.checks.find((e) => e.kind === "email");
1023
+ }
1024
+ get isURL() {
1025
+ return !!this._def.checks.find((e) => e.kind === "url");
1026
+ }
1027
+ get isEmoji() {
1028
+ return !!this._def.checks.find((e) => e.kind === "emoji");
1029
+ }
1030
+ get isUUID() {
1031
+ return !!this._def.checks.find((e) => e.kind === "uuid");
1032
+ }
1033
+ get isNANOID() {
1034
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
1035
+ }
1036
+ get isCUID() {
1037
+ return !!this._def.checks.find((e) => e.kind === "cuid");
1038
+ }
1039
+ get isCUID2() {
1040
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
1041
+ }
1042
+ get isULID() {
1043
+ return !!this._def.checks.find((e) => e.kind === "ulid");
1044
+ }
1045
+ get isIP() {
1046
+ return !!this._def.checks.find((e) => e.kind === "ip");
1047
+ }
1048
+ get isCIDR() {
1049
+ return !!this._def.checks.find((e) => e.kind === "cidr");
1050
+ }
1051
+ get isBase64() {
1052
+ return !!this._def.checks.find((e) => e.kind === "base64");
1053
+ }
1054
+ get isBase64url() {
1055
+ return !!this._def.checks.find((e) => e.kind === "base64url");
1056
+ }
1057
+ get minLength() {
1058
+ let e = null;
1059
+ for (const t of this._def.checks)
1060
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1061
+ return e;
1062
+ }
1063
+ get maxLength() {
1064
+ let e = null;
1065
+ for (const t of this._def.checks)
1066
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1067
+ return e;
1068
+ }
1069
+ }
1070
+ R.create = (r) => {
1071
+ var e;
1072
+ return new R({
1073
+ checks: [],
1074
+ typeName: p.ZodString,
1075
+ coerce: (e = r?.coerce) !== null && e !== void 0 ? e : !1,
1076
+ ...v(r)
1077
+ });
1078
+ };
1079
+ function Xt(r, e) {
1080
+ 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(".", ""));
1081
+ return a % i / Math.pow(10, s);
1082
+ }
1083
+ class F extends g {
1084
+ constructor() {
1085
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1086
+ }
1087
+ _parse(e) {
1088
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1089
+ const a = this._getOrReturnCtx(e);
1090
+ return l(a, {
1091
+ code: c.invalid_type,
1092
+ expected: f.number,
1093
+ received: a.parsedType
1094
+ }), y;
1095
+ }
1096
+ let n;
1097
+ const s = new T();
1098
+ for (const a of this._def.checks)
1099
+ a.kind === "int" ? _.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
1100
+ code: c.invalid_type,
1101
+ expected: "integer",
1102
+ received: "float",
1103
+ message: a.message
1104
+ }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1105
+ code: c.too_small,
1106
+ minimum: a.value,
1107
+ type: "number",
1108
+ inclusive: a.inclusive,
1109
+ exact: !1,
1110
+ message: a.message
1111
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1112
+ code: c.too_big,
1113
+ maximum: a.value,
1114
+ type: "number",
1115
+ inclusive: a.inclusive,
1116
+ exact: !1,
1117
+ message: a.message
1118
+ }), s.dirty()) : a.kind === "multipleOf" ? Xt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
1119
+ code: c.not_multiple_of,
1120
+ multipleOf: a.value,
1121
+ message: a.message
1122
+ }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
1123
+ code: c.not_finite,
1124
+ message: a.message
1125
+ }), s.dirty()) : _.assertNever(a);
1126
+ return { status: s.value, value: e.data };
1127
+ }
1128
+ gte(e, t) {
1129
+ return this.setLimit("min", e, !0, m.toString(t));
1130
+ }
1131
+ gt(e, t) {
1132
+ return this.setLimit("min", e, !1, m.toString(t));
1133
+ }
1134
+ lte(e, t) {
1135
+ return this.setLimit("max", e, !0, m.toString(t));
1136
+ }
1137
+ lt(e, t) {
1138
+ return this.setLimit("max", e, !1, m.toString(t));
1139
+ }
1140
+ setLimit(e, t, n, s) {
1141
+ return new F({
1142
+ ...this._def,
1143
+ checks: [
1144
+ ...this._def.checks,
1145
+ {
1146
+ kind: e,
1147
+ value: t,
1148
+ inclusive: n,
1149
+ message: m.toString(s)
1150
+ }
1151
+ ]
1152
+ });
1153
+ }
1154
+ _addCheck(e) {
1155
+ return new F({
1156
+ ...this._def,
1157
+ checks: [...this._def.checks, e]
1158
+ });
1159
+ }
1160
+ int(e) {
1161
+ return this._addCheck({
1162
+ kind: "int",
1163
+ message: m.toString(e)
1164
+ });
1165
+ }
1166
+ positive(e) {
1167
+ return this._addCheck({
1168
+ kind: "min",
1169
+ value: 0,
1170
+ inclusive: !1,
1171
+ message: m.toString(e)
1172
+ });
1173
+ }
1174
+ negative(e) {
1175
+ return this._addCheck({
1176
+ kind: "max",
1177
+ value: 0,
1178
+ inclusive: !1,
1179
+ message: m.toString(e)
1180
+ });
1181
+ }
1182
+ nonpositive(e) {
1183
+ return this._addCheck({
1184
+ kind: "max",
1185
+ value: 0,
1186
+ inclusive: !0,
1187
+ message: m.toString(e)
1188
+ });
1189
+ }
1190
+ nonnegative(e) {
1191
+ return this._addCheck({
1192
+ kind: "min",
1193
+ value: 0,
1194
+ inclusive: !0,
1195
+ message: m.toString(e)
1196
+ });
1197
+ }
1198
+ multipleOf(e, t) {
1199
+ return this._addCheck({
1200
+ kind: "multipleOf",
1201
+ value: e,
1202
+ message: m.toString(t)
1203
+ });
1204
+ }
1205
+ finite(e) {
1206
+ return this._addCheck({
1207
+ kind: "finite",
1208
+ message: m.toString(e)
1209
+ });
1210
+ }
1211
+ safe(e) {
1212
+ return this._addCheck({
1213
+ kind: "min",
1214
+ inclusive: !0,
1215
+ value: Number.MIN_SAFE_INTEGER,
1216
+ message: m.toString(e)
1217
+ })._addCheck({
1218
+ kind: "max",
1219
+ inclusive: !0,
1220
+ value: Number.MAX_SAFE_INTEGER,
1221
+ message: m.toString(e)
1222
+ });
1223
+ }
1224
+ get minValue() {
1225
+ let e = null;
1226
+ for (const t of this._def.checks)
1227
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1228
+ return e;
1229
+ }
1230
+ get maxValue() {
1231
+ let e = null;
1232
+ for (const t of this._def.checks)
1233
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1234
+ return e;
1235
+ }
1236
+ get isInt() {
1237
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && _.isInteger(e.value));
1238
+ }
1239
+ get isFinite() {
1240
+ let e = null, t = null;
1241
+ for (const n of this._def.checks) {
1242
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
1243
+ return !0;
1244
+ n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1245
+ }
1246
+ return Number.isFinite(t) && Number.isFinite(e);
1247
+ }
1248
+ }
1249
+ F.create = (r) => new F({
1250
+ checks: [],
1251
+ typeName: p.ZodNumber,
1252
+ coerce: r?.coerce || !1,
1253
+ ...v(r)
1254
+ });
1255
+ class U extends g {
1256
+ constructor() {
1257
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1258
+ }
1259
+ _parse(e) {
1260
+ if (this._def.coerce)
1261
+ try {
1262
+ e.data = BigInt(e.data);
1263
+ } catch {
1264
+ return this._getInvalidInput(e);
1265
+ }
1266
+ if (this._getType(e) !== f.bigint)
1267
+ return this._getInvalidInput(e);
1268
+ let n;
1269
+ const s = new T();
1270
+ for (const a of this._def.checks)
1271
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1272
+ code: c.too_small,
1273
+ type: "bigint",
1274
+ minimum: a.value,
1275
+ inclusive: a.inclusive,
1276
+ message: a.message
1277
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1278
+ code: c.too_big,
1279
+ type: "bigint",
1280
+ maximum: a.value,
1281
+ inclusive: a.inclusive,
1282
+ message: a.message
1283
+ }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
1284
+ code: c.not_multiple_of,
1285
+ multipleOf: a.value,
1286
+ message: a.message
1287
+ }), s.dirty()) : _.assertNever(a);
1288
+ return { status: s.value, value: e.data };
1289
+ }
1290
+ _getInvalidInput(e) {
1291
+ const t = this._getOrReturnCtx(e);
1292
+ return l(t, {
1293
+ code: c.invalid_type,
1294
+ expected: f.bigint,
1295
+ received: t.parsedType
1296
+ }), y;
1297
+ }
1298
+ gte(e, t) {
1299
+ return this.setLimit("min", e, !0, m.toString(t));
1300
+ }
1301
+ gt(e, t) {
1302
+ return this.setLimit("min", e, !1, m.toString(t));
1303
+ }
1304
+ lte(e, t) {
1305
+ return this.setLimit("max", e, !0, m.toString(t));
1306
+ }
1307
+ lt(e, t) {
1308
+ return this.setLimit("max", e, !1, m.toString(t));
1309
+ }
1310
+ setLimit(e, t, n, s) {
1311
+ return new U({
1312
+ ...this._def,
1313
+ checks: [
1314
+ ...this._def.checks,
1315
+ {
1316
+ kind: e,
1317
+ value: t,
1318
+ inclusive: n,
1319
+ message: m.toString(s)
1320
+ }
1321
+ ]
1322
+ });
1323
+ }
1324
+ _addCheck(e) {
1325
+ return new U({
1326
+ ...this._def,
1327
+ checks: [...this._def.checks, e]
1328
+ });
1329
+ }
1330
+ positive(e) {
1331
+ return this._addCheck({
1332
+ kind: "min",
1333
+ value: BigInt(0),
1334
+ inclusive: !1,
1335
+ message: m.toString(e)
1336
+ });
1337
+ }
1338
+ negative(e) {
1339
+ return this._addCheck({
1340
+ kind: "max",
1341
+ value: BigInt(0),
1342
+ inclusive: !1,
1343
+ message: m.toString(e)
1344
+ });
1345
+ }
1346
+ nonpositive(e) {
1347
+ return this._addCheck({
1348
+ kind: "max",
1349
+ value: BigInt(0),
1350
+ inclusive: !0,
1351
+ message: m.toString(e)
1352
+ });
1353
+ }
1354
+ nonnegative(e) {
1355
+ return this._addCheck({
1356
+ kind: "min",
1357
+ value: BigInt(0),
1358
+ inclusive: !0,
1359
+ message: m.toString(e)
1360
+ });
1361
+ }
1362
+ multipleOf(e, t) {
1363
+ return this._addCheck({
1364
+ kind: "multipleOf",
1365
+ value: e,
1366
+ message: m.toString(t)
1367
+ });
1368
+ }
1369
+ get minValue() {
1370
+ let e = null;
1371
+ for (const t of this._def.checks)
1372
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1373
+ return e;
1374
+ }
1375
+ get maxValue() {
1376
+ let e = null;
1377
+ for (const t of this._def.checks)
1378
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1379
+ return e;
1380
+ }
1381
+ }
1382
+ U.create = (r) => {
1383
+ var e;
1384
+ return new U({
1385
+ checks: [],
1386
+ typeName: p.ZodBigInt,
1387
+ coerce: (e = r?.coerce) !== null && e !== void 0 ? e : !1,
1388
+ ...v(r)
1389
+ });
1390
+ };
1391
+ class de extends g {
1392
+ _parse(e) {
1393
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1394
+ const n = this._getOrReturnCtx(e);
1395
+ return l(n, {
1396
+ code: c.invalid_type,
1397
+ expected: f.boolean,
1398
+ received: n.parsedType
1399
+ }), y;
1400
+ }
1401
+ return S(e.data);
1402
+ }
1403
+ }
1404
+ de.create = (r) => new de({
1405
+ typeName: p.ZodBoolean,
1406
+ coerce: r?.coerce || !1,
1407
+ ...v(r)
1408
+ });
1409
+ class H extends g {
1410
+ _parse(e) {
1411
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1412
+ const a = this._getOrReturnCtx(e);
1413
+ return l(a, {
1414
+ code: c.invalid_type,
1415
+ expected: f.date,
1416
+ received: a.parsedType
1417
+ }), y;
1418
+ }
1419
+ if (isNaN(e.data.getTime())) {
1420
+ const a = this._getOrReturnCtx(e);
1421
+ return l(a, {
1422
+ code: c.invalid_date
1423
+ }), y;
1424
+ }
1425
+ const n = new T();
1426
+ let s;
1427
+ for (const a of this._def.checks)
1428
+ a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1429
+ code: c.too_small,
1430
+ message: a.message,
1431
+ inclusive: !0,
1432
+ exact: !1,
1433
+ minimum: a.value,
1434
+ type: "date"
1435
+ }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), l(s, {
1436
+ code: c.too_big,
1437
+ message: a.message,
1438
+ inclusive: !0,
1439
+ exact: !1,
1440
+ maximum: a.value,
1441
+ type: "date"
1442
+ }), n.dirty()) : _.assertNever(a);
1443
+ return {
1444
+ status: n.value,
1445
+ value: new Date(e.data.getTime())
1446
+ };
1447
+ }
1448
+ _addCheck(e) {
1449
+ return new H({
1450
+ ...this._def,
1451
+ checks: [...this._def.checks, e]
1452
+ });
1453
+ }
1454
+ min(e, t) {
1455
+ return this._addCheck({
1456
+ kind: "min",
1457
+ value: e.getTime(),
1458
+ message: m.toString(t)
1459
+ });
1460
+ }
1461
+ max(e, t) {
1462
+ return this._addCheck({
1463
+ kind: "max",
1464
+ value: e.getTime(),
1465
+ message: m.toString(t)
1466
+ });
1467
+ }
1468
+ get minDate() {
1469
+ let e = null;
1470
+ for (const t of this._def.checks)
1471
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1472
+ return e != null ? new Date(e) : null;
1473
+ }
1474
+ get maxDate() {
1475
+ let e = null;
1476
+ for (const t of this._def.checks)
1477
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1478
+ return e != null ? new Date(e) : null;
1479
+ }
1480
+ }
1481
+ H.create = (r) => new H({
1482
+ checks: [],
1483
+ coerce: r?.coerce || !1,
1484
+ typeName: p.ZodDate,
1485
+ ...v(r)
1486
+ });
1487
+ class Ce extends g {
1488
+ _parse(e) {
1489
+ if (this._getType(e) !== f.symbol) {
1490
+ const n = this._getOrReturnCtx(e);
1491
+ return l(n, {
1492
+ code: c.invalid_type,
1493
+ expected: f.symbol,
1494
+ received: n.parsedType
1495
+ }), y;
1496
+ }
1497
+ return S(e.data);
1498
+ }
1499
+ }
1500
+ Ce.create = (r) => new Ce({
1501
+ typeName: p.ZodSymbol,
1502
+ ...v(r)
1503
+ });
1504
+ class ce extends g {
1505
+ _parse(e) {
1506
+ if (this._getType(e) !== f.undefined) {
1507
+ const n = this._getOrReturnCtx(e);
1508
+ return l(n, {
1509
+ code: c.invalid_type,
1510
+ expected: f.undefined,
1511
+ received: n.parsedType
1512
+ }), y;
1513
+ }
1514
+ return S(e.data);
1515
+ }
1516
+ }
1517
+ ce.create = (r) => new ce({
1518
+ typeName: p.ZodUndefined,
1519
+ ...v(r)
1520
+ });
1521
+ class ue extends g {
1522
+ _parse(e) {
1523
+ if (this._getType(e) !== f.null) {
1524
+ const n = this._getOrReturnCtx(e);
1525
+ return l(n, {
1526
+ code: c.invalid_type,
1527
+ expected: f.null,
1528
+ received: n.parsedType
1529
+ }), y;
1530
+ }
1531
+ return S(e.data);
1532
+ }
1533
+ }
1534
+ ue.create = (r) => new ue({
1535
+ typeName: p.ZodNull,
1536
+ ...v(r)
1537
+ });
1538
+ class ne extends g {
1539
+ constructor() {
1540
+ super(...arguments), this._any = !0;
1541
+ }
1542
+ _parse(e) {
1543
+ return S(e.data);
1544
+ }
1545
+ }
1546
+ ne.create = (r) => new ne({
1547
+ typeName: p.ZodAny,
1548
+ ...v(r)
1549
+ });
1550
+ class Y extends g {
1551
+ constructor() {
1552
+ super(...arguments), this._unknown = !0;
1553
+ }
1554
+ _parse(e) {
1555
+ return S(e.data);
1556
+ }
1557
+ }
1558
+ Y.create = (r) => new Y({
1559
+ typeName: p.ZodUnknown,
1560
+ ...v(r)
1561
+ });
1562
+ class D extends g {
1563
+ _parse(e) {
1564
+ const t = this._getOrReturnCtx(e);
1565
+ return l(t, {
1566
+ code: c.invalid_type,
1567
+ expected: f.never,
1568
+ received: t.parsedType
1569
+ }), y;
1570
+ }
1571
+ }
1572
+ D.create = (r) => new D({
1573
+ typeName: p.ZodNever,
1574
+ ...v(r)
1575
+ });
1576
+ class Se extends g {
1577
+ _parse(e) {
1578
+ if (this._getType(e) !== f.undefined) {
1579
+ const n = this._getOrReturnCtx(e);
1580
+ return l(n, {
1581
+ code: c.invalid_type,
1582
+ expected: f.void,
1583
+ received: n.parsedType
1584
+ }), y;
1585
+ }
1586
+ return S(e.data);
1587
+ }
1588
+ }
1589
+ Se.create = (r) => new Se({
1590
+ typeName: p.ZodVoid,
1591
+ ...v(r)
1592
+ });
1593
+ class I extends g {
1594
+ _parse(e) {
1595
+ const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
1596
+ if (t.parsedType !== f.array)
1597
+ return l(t, {
1598
+ code: c.invalid_type,
1599
+ expected: f.array,
1600
+ received: t.parsedType
1601
+ }), y;
1602
+ if (s.exactLength !== null) {
1603
+ const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1604
+ (i || o) && (l(t, {
1605
+ code: i ? c.too_big : c.too_small,
1606
+ minimum: o ? s.exactLength.value : void 0,
1607
+ maximum: i ? s.exactLength.value : void 0,
1608
+ type: "array",
1609
+ inclusive: !0,
1610
+ exact: !0,
1611
+ message: s.exactLength.message
1612
+ }), n.dirty());
1613
+ }
1614
+ if (s.minLength !== null && t.data.length < s.minLength.value && (l(t, {
1615
+ code: c.too_small,
1616
+ minimum: s.minLength.value,
1617
+ type: "array",
1618
+ inclusive: !0,
1619
+ exact: !1,
1620
+ message: s.minLength.message
1621
+ }), n.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (l(t, {
1622
+ code: c.too_big,
1623
+ maximum: s.maxLength.value,
1624
+ type: "array",
1625
+ inclusive: !0,
1626
+ exact: !1,
1627
+ message: s.maxLength.message
1628
+ }), n.dirty()), t.common.async)
1629
+ return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new $(t, i, t.path, o)))).then((i) => T.mergeArray(n, i));
1630
+ const a = [...t.data].map((i, o) => s.type._parseSync(new $(t, i, t.path, o)));
1631
+ return T.mergeArray(n, a);
1632
+ }
1633
+ get element() {
1634
+ return this._def.type;
1635
+ }
1636
+ min(e, t) {
1637
+ return new I({
1638
+ ...this._def,
1639
+ minLength: { value: e, message: m.toString(t) }
1640
+ });
1641
+ }
1642
+ max(e, t) {
1643
+ return new I({
1644
+ ...this._def,
1645
+ maxLength: { value: e, message: m.toString(t) }
1646
+ });
1647
+ }
1648
+ length(e, t) {
1649
+ return new I({
1650
+ ...this._def,
1651
+ exactLength: { value: e, message: m.toString(t) }
1652
+ });
1653
+ }
1654
+ nonempty(e) {
1655
+ return this.min(1, e);
1656
+ }
1657
+ }
1658
+ I.create = (r, e) => new I({
1659
+ type: r,
1660
+ minLength: null,
1661
+ maxLength: null,
1662
+ exactLength: null,
1663
+ typeName: p.ZodArray,
1664
+ ...v(e)
1665
+ });
1666
+ function Q(r) {
1667
+ if (r instanceof b) {
1668
+ const e = {};
1669
+ for (const t in r.shape) {
1670
+ const n = r.shape[t];
1671
+ e[t] = P.create(Q(n));
1672
+ }
1673
+ return new b({
1674
+ ...r._def,
1675
+ shape: () => e
1676
+ });
1677
+ } else return r instanceof I ? new I({
1678
+ ...r._def,
1679
+ type: Q(r.element)
1680
+ }) : r instanceof P ? P.create(Q(r.unwrap())) : r instanceof q ? q.create(Q(r.unwrap())) : r instanceof V ? V.create(r.items.map((e) => Q(e))) : r;
1681
+ }
1682
+ class b extends g {
1683
+ constructor() {
1684
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1685
+ }
1686
+ _getCached() {
1687
+ if (this._cached !== null)
1688
+ return this._cached;
1689
+ const e = this._def.shape(), t = _.objectKeys(e);
1690
+ return this._cached = { shape: e, keys: t };
1691
+ }
1692
+ _parse(e) {
1693
+ if (this._getType(e) !== f.object) {
1694
+ const d = this._getOrReturnCtx(e);
1695
+ return l(d, {
1696
+ code: c.invalid_type,
1697
+ expected: f.object,
1698
+ received: d.parsedType
1699
+ }), y;
1700
+ }
1701
+ const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1702
+ if (!(this._def.catchall instanceof D && this._def.unknownKeys === "strip"))
1703
+ for (const d in s.data)
1704
+ i.includes(d) || o.push(d);
1705
+ const u = [];
1706
+ for (const d of i) {
1707
+ const h = a[d], x = s.data[d];
1708
+ u.push({
1709
+ key: { status: "valid", value: d },
1710
+ value: h._parse(new $(s, x, s.path, d)),
1711
+ alwaysSet: d in s.data
1712
+ });
1713
+ }
1714
+ if (this._def.catchall instanceof D) {
1715
+ const d = this._def.unknownKeys;
1716
+ if (d === "passthrough")
1717
+ for (const h of o)
1718
+ u.push({
1719
+ key: { status: "valid", value: h },
1720
+ value: { status: "valid", value: s.data[h] }
1721
+ });
1722
+ else if (d === "strict")
1723
+ o.length > 0 && (l(s, {
1724
+ code: c.unrecognized_keys,
1725
+ keys: o
1726
+ }), n.dirty());
1727
+ else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1728
+ } else {
1729
+ const d = this._def.catchall;
1730
+ for (const h of o) {
1731
+ const x = s.data[h];
1732
+ u.push({
1733
+ key: { status: "valid", value: h },
1734
+ value: d._parse(
1735
+ new $(s, x, s.path, h)
1736
+ //, ctx.child(key), value, getParsedType(value)
1737
+ ),
1738
+ alwaysSet: h in s.data
1739
+ });
1740
+ }
1741
+ }
1742
+ return s.common.async ? Promise.resolve().then(async () => {
1743
+ const d = [];
1744
+ for (const h of u) {
1745
+ const x = await h.key, k = await h.value;
1746
+ d.push({
1747
+ key: x,
1748
+ value: k,
1749
+ alwaysSet: h.alwaysSet
1750
+ });
1751
+ }
1752
+ return d;
1753
+ }).then((d) => T.mergeObjectSync(n, d)) : T.mergeObjectSync(n, u);
1754
+ }
1755
+ get shape() {
1756
+ return this._def.shape();
1757
+ }
1758
+ strict(e) {
1759
+ return m.errToObj, new b({
1760
+ ...this._def,
1761
+ unknownKeys: "strict",
1762
+ ...e !== void 0 ? {
1763
+ errorMap: (t, n) => {
1764
+ var s, a, i, o;
1765
+ 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;
1766
+ return t.code === "unrecognized_keys" ? {
1767
+ message: (o = m.errToObj(e).message) !== null && o !== void 0 ? o : u
1768
+ } : {
1769
+ message: u
1770
+ };
1771
+ }
1772
+ } : {}
1773
+ });
1774
+ }
1775
+ strip() {
1776
+ return new b({
1777
+ ...this._def,
1778
+ unknownKeys: "strip"
1779
+ });
1780
+ }
1781
+ passthrough() {
1782
+ return new b({
1783
+ ...this._def,
1784
+ unknownKeys: "passthrough"
1785
+ });
1786
+ }
1787
+ // const AugmentFactory =
1788
+ // <Def extends ZodObjectDef>(def: Def) =>
1789
+ // <Augmentation extends ZodRawShape>(
1790
+ // augmentation: Augmentation
1791
+ // ): ZodObject<
1792
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1793
+ // Def["unknownKeys"],
1794
+ // Def["catchall"]
1795
+ // > => {
1796
+ // return new ZodObject({
1797
+ // ...def,
1798
+ // shape: () => ({
1799
+ // ...def.shape(),
1800
+ // ...augmentation,
1801
+ // }),
1802
+ // }) as any;
1803
+ // };
1804
+ extend(e) {
1805
+ return new b({
1806
+ ...this._def,
1807
+ shape: () => ({
1808
+ ...this._def.shape(),
1809
+ ...e
1810
+ })
1811
+ });
1812
+ }
1813
+ /**
1814
+ * Prior to zod@1.0.12 there was a bug in the
1815
+ * inferred type of merged objects. Please
1816
+ * upgrade if you are experiencing issues.
1817
+ */
1818
+ merge(e) {
1819
+ return new b({
1820
+ unknownKeys: e._def.unknownKeys,
1821
+ catchall: e._def.catchall,
1822
+ shape: () => ({
1823
+ ...this._def.shape(),
1824
+ ...e._def.shape()
1825
+ }),
1826
+ typeName: p.ZodObject
1827
+ });
1828
+ }
1829
+ // merge<
1830
+ // Incoming extends AnyZodObject,
1831
+ // Augmentation extends Incoming["shape"],
1832
+ // NewOutput extends {
1833
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1834
+ // ? Augmentation[k]["_output"]
1835
+ // : k extends keyof Output
1836
+ // ? Output[k]
1837
+ // : never;
1838
+ // },
1839
+ // NewInput extends {
1840
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1841
+ // ? Augmentation[k]["_input"]
1842
+ // : k extends keyof Input
1843
+ // ? Input[k]
1844
+ // : never;
1845
+ // }
1846
+ // >(
1847
+ // merging: Incoming
1848
+ // ): ZodObject<
1849
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1850
+ // Incoming["_def"]["unknownKeys"],
1851
+ // Incoming["_def"]["catchall"],
1852
+ // NewOutput,
1853
+ // NewInput
1854
+ // > {
1855
+ // const merged: any = new ZodObject({
1856
+ // unknownKeys: merging._def.unknownKeys,
1857
+ // catchall: merging._def.catchall,
1858
+ // shape: () =>
1859
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1860
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1861
+ // }) as any;
1862
+ // return merged;
1863
+ // }
1864
+ setKey(e, t) {
1865
+ return this.augment({ [e]: t });
1866
+ }
1867
+ // merge<Incoming extends AnyZodObject>(
1868
+ // merging: Incoming
1869
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1870
+ // ZodObject<
1871
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1872
+ // Incoming["_def"]["unknownKeys"],
1873
+ // Incoming["_def"]["catchall"]
1874
+ // > {
1875
+ // // const mergedShape = objectUtil.mergeShapes(
1876
+ // // this._def.shape(),
1877
+ // // merging._def.shape()
1878
+ // // );
1879
+ // const merged: any = new ZodObject({
1880
+ // unknownKeys: merging._def.unknownKeys,
1881
+ // catchall: merging._def.catchall,
1882
+ // shape: () =>
1883
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1884
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1885
+ // }) as any;
1886
+ // return merged;
1887
+ // }
1888
+ catchall(e) {
1889
+ return new b({
1890
+ ...this._def,
1891
+ catchall: e
1892
+ });
1893
+ }
1894
+ pick(e) {
1895
+ const t = {};
1896
+ return _.objectKeys(e).forEach((n) => {
1897
+ e[n] && this.shape[n] && (t[n] = this.shape[n]);
1898
+ }), new b({
1899
+ ...this._def,
1900
+ shape: () => t
1901
+ });
1902
+ }
1903
+ omit(e) {
1904
+ const t = {};
1905
+ return _.objectKeys(this.shape).forEach((n) => {
1906
+ e[n] || (t[n] = this.shape[n]);
1907
+ }), new b({
1908
+ ...this._def,
1909
+ shape: () => t
1910
+ });
1911
+ }
1912
+ /**
1913
+ * @deprecated
1914
+ */
1915
+ deepPartial() {
1916
+ return Q(this);
1917
+ }
1918
+ partial(e) {
1919
+ const t = {};
1920
+ return _.objectKeys(this.shape).forEach((n) => {
1921
+ const s = this.shape[n];
1922
+ e && !e[n] ? t[n] = s : t[n] = s.optional();
1923
+ }), new b({
1924
+ ...this._def,
1925
+ shape: () => t
1926
+ });
1927
+ }
1928
+ required(e) {
1929
+ const t = {};
1930
+ return _.objectKeys(this.shape).forEach((n) => {
1931
+ if (e && !e[n])
1932
+ t[n] = this.shape[n];
1933
+ else {
1934
+ let a = this.shape[n];
1935
+ for (; a instanceof P; )
1936
+ a = a._def.innerType;
1937
+ t[n] = a;
1938
+ }
1939
+ }), new b({
1940
+ ...this._def,
1941
+ shape: () => t
1942
+ });
1943
+ }
1944
+ keyof() {
1945
+ return ct(_.objectKeys(this.shape));
1946
+ }
1947
+ }
1948
+ b.create = (r, e) => new b({
1949
+ shape: () => r,
1950
+ unknownKeys: "strip",
1951
+ catchall: D.create(),
1952
+ typeName: p.ZodObject,
1953
+ ...v(e)
1954
+ });
1955
+ b.strictCreate = (r, e) => new b({
1956
+ shape: () => r,
1957
+ unknownKeys: "strict",
1958
+ catchall: D.create(),
1959
+ typeName: p.ZodObject,
1960
+ ...v(e)
1961
+ });
1962
+ b.lazycreate = (r, e) => new b({
1963
+ shape: r,
1964
+ unknownKeys: "strip",
1965
+ catchall: D.create(),
1966
+ typeName: p.ZodObject,
1967
+ ...v(e)
1968
+ });
1969
+ class le extends g {
1970
+ _parse(e) {
1971
+ const { ctx: t } = this._processInputParams(e), n = this._def.options;
1972
+ function s(a) {
1973
+ for (const o of a)
1974
+ if (o.result.status === "valid")
1975
+ return o.result;
1976
+ for (const o of a)
1977
+ if (o.result.status === "dirty")
1978
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
1979
+ const i = a.map((o) => new O(o.ctx.common.issues));
1980
+ return l(t, {
1981
+ code: c.invalid_union,
1982
+ unionErrors: i
1983
+ }), y;
1984
+ }
1985
+ if (t.common.async)
1986
+ return Promise.all(n.map(async (a) => {
1987
+ const i = {
1988
+ ...t,
1989
+ common: {
1990
+ ...t.common,
1991
+ issues: []
1992
+ },
1993
+ parent: null
1994
+ };
1995
+ return {
1996
+ result: await a._parseAsync({
1997
+ data: t.data,
1998
+ path: t.path,
1999
+ parent: i
2000
+ }),
2001
+ ctx: i
2002
+ };
2003
+ })).then(s);
2004
+ {
2005
+ let a;
2006
+ const i = [];
2007
+ for (const u of n) {
2008
+ const d = {
2009
+ ...t,
2010
+ common: {
2011
+ ...t.common,
2012
+ issues: []
2013
+ },
2014
+ parent: null
2015
+ }, h = u._parseSync({
2016
+ data: t.data,
2017
+ path: t.path,
2018
+ parent: d
2019
+ });
2020
+ if (h.status === "valid")
2021
+ return h;
2022
+ h.status === "dirty" && !a && (a = { result: h, ctx: d }), d.common.issues.length && i.push(d.common.issues);
2023
+ }
2024
+ if (a)
2025
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
2026
+ const o = i.map((u) => new O(u));
2027
+ return l(t, {
2028
+ code: c.invalid_union,
2029
+ unionErrors: o
2030
+ }), y;
2031
+ }
2032
+ }
2033
+ get options() {
2034
+ return this._def.options;
2035
+ }
2036
+ }
2037
+ le.create = (r, e) => new le({
2038
+ options: r,
2039
+ typeName: p.ZodUnion,
2040
+ ...v(e)
2041
+ });
2042
+ const M = (r) => r instanceof me ? M(r.schema) : r instanceof j ? M(r.innerType()) : r instanceof pe ? [r.value] : r instanceof W ? r.options : r instanceof ye ? _.objectValues(r.enum) : r instanceof ve ? M(r._def.innerType) : r instanceof ce ? [void 0] : r instanceof ue ? [null] : r instanceof P ? [void 0, ...M(r.unwrap())] : r instanceof q ? [null, ...M(r.unwrap())] : r instanceof ze || r instanceof _e ? M(r.unwrap()) : r instanceof ge ? M(r._def.innerType) : [];
2043
+ class Ne extends g {
2044
+ _parse(e) {
2045
+ const { ctx: t } = this._processInputParams(e);
2046
+ if (t.parsedType !== f.object)
2047
+ return l(t, {
2048
+ code: c.invalid_type,
2049
+ expected: f.object,
2050
+ received: t.parsedType
2051
+ }), y;
2052
+ const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
2053
+ return a ? t.common.async ? a._parseAsync({
2054
+ data: t.data,
2055
+ path: t.path,
2056
+ parent: t
2057
+ }) : a._parseSync({
2058
+ data: t.data,
2059
+ path: t.path,
2060
+ parent: t
2061
+ }) : (l(t, {
2062
+ code: c.invalid_union_discriminator,
2063
+ options: Array.from(this.optionsMap.keys()),
2064
+ path: [n]
2065
+ }), y);
2066
+ }
2067
+ get discriminator() {
2068
+ return this._def.discriminator;
2069
+ }
2070
+ get options() {
2071
+ return this._def.options;
2072
+ }
2073
+ get optionsMap() {
2074
+ return this._def.optionsMap;
2075
+ }
2076
+ /**
2077
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2078
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2079
+ * have a different value for each object in the union.
2080
+ * @param discriminator the name of the discriminator property
2081
+ * @param types an array of object schemas
2082
+ * @param params
2083
+ */
2084
+ static create(e, t, n) {
2085
+ const s = /* @__PURE__ */ new Map();
2086
+ for (const a of t) {
2087
+ const i = M(a.shape[e]);
2088
+ if (!i.length)
2089
+ throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2090
+ for (const o of i) {
2091
+ if (s.has(o))
2092
+ throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2093
+ s.set(o, a);
2094
+ }
2095
+ }
2096
+ return new Ne({
2097
+ typeName: p.ZodDiscriminatedUnion,
2098
+ discriminator: e,
2099
+ options: t,
2100
+ optionsMap: s,
2101
+ ...v(n)
2102
+ });
2103
+ }
2104
+ }
2105
+ function Me(r, e) {
2106
+ const t = L(r), n = L(e);
2107
+ if (r === e)
2108
+ return { valid: !0, data: r };
2109
+ if (t === f.object && n === f.object) {
2110
+ const s = _.objectKeys(e), a = _.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
2111
+ for (const o of a) {
2112
+ const u = Me(r[o], e[o]);
2113
+ if (!u.valid)
2114
+ return { valid: !1 };
2115
+ i[o] = u.data;
2116
+ }
2117
+ return { valid: !0, data: i };
2118
+ } else if (t === f.array && n === f.array) {
2119
+ if (r.length !== e.length)
2120
+ return { valid: !1 };
2121
+ const s = [];
2122
+ for (let a = 0; a < r.length; a++) {
2123
+ const i = r[a], o = e[a], u = Me(i, o);
2124
+ if (!u.valid)
2125
+ return { valid: !1 };
2126
+ s.push(u.data);
2127
+ }
2128
+ return { valid: !0, data: s };
2129
+ } else return t === f.date && n === f.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
2130
+ }
2131
+ class fe extends g {
2132
+ _parse(e) {
2133
+ const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
2134
+ if ($e(a) || $e(i))
2135
+ return y;
2136
+ const o = Me(a.value, i.value);
2137
+ return o.valid ? ((Ve(a) || Ve(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
2138
+ code: c.invalid_intersection_types
2139
+ }), y);
2140
+ };
2141
+ return n.common.async ? Promise.all([
2142
+ this._def.left._parseAsync({
2143
+ data: n.data,
2144
+ path: n.path,
2145
+ parent: n
2146
+ }),
2147
+ this._def.right._parseAsync({
2148
+ data: n.data,
2149
+ path: n.path,
2150
+ parent: n
2151
+ })
2152
+ ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
2153
+ data: n.data,
2154
+ path: n.path,
2155
+ parent: n
2156
+ }), this._def.right._parseSync({
2157
+ data: n.data,
2158
+ path: n.path,
2159
+ parent: n
2160
+ }));
2161
+ }
2162
+ }
2163
+ fe.create = (r, e, t) => new fe({
2164
+ left: r,
2165
+ right: e,
2166
+ typeName: p.ZodIntersection,
2167
+ ...v(t)
2168
+ });
2169
+ class V extends g {
2170
+ _parse(e) {
2171
+ const { status: t, ctx: n } = this._processInputParams(e);
2172
+ if (n.parsedType !== f.array)
2173
+ return l(n, {
2174
+ code: c.invalid_type,
2175
+ expected: f.array,
2176
+ received: n.parsedType
2177
+ }), y;
2178
+ if (n.data.length < this._def.items.length)
2179
+ return l(n, {
2180
+ code: c.too_small,
2181
+ minimum: this._def.items.length,
2182
+ inclusive: !0,
2183
+ exact: !1,
2184
+ type: "array"
2185
+ }), y;
2186
+ !this._def.rest && n.data.length > this._def.items.length && (l(n, {
2187
+ code: c.too_big,
2188
+ maximum: this._def.items.length,
2189
+ inclusive: !0,
2190
+ exact: !1,
2191
+ type: "array"
2192
+ }), t.dirty());
2193
+ const a = [...n.data].map((i, o) => {
2194
+ const u = this._def.items[o] || this._def.rest;
2195
+ return u ? u._parse(new $(n, i, n.path, o)) : null;
2196
+ }).filter((i) => !!i);
2197
+ return n.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
2198
+ }
2199
+ get items() {
2200
+ return this._def.items;
2201
+ }
2202
+ rest(e) {
2203
+ return new V({
2204
+ ...this._def,
2205
+ rest: e
2206
+ });
2207
+ }
2208
+ }
2209
+ V.create = (r, e) => {
2210
+ if (!Array.isArray(r))
2211
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2212
+ return new V({
2213
+ items: r,
2214
+ typeName: p.ZodTuple,
2215
+ rest: null,
2216
+ ...v(e)
2217
+ });
2218
+ };
2219
+ class he extends g {
2220
+ get keySchema() {
2221
+ return this._def.keyType;
2222
+ }
2223
+ get valueSchema() {
2224
+ return this._def.valueType;
2225
+ }
2226
+ _parse(e) {
2227
+ const { status: t, ctx: n } = this._processInputParams(e);
2228
+ if (n.parsedType !== f.object)
2229
+ return l(n, {
2230
+ code: c.invalid_type,
2231
+ expected: f.object,
2232
+ received: n.parsedType
2233
+ }), y;
2234
+ const s = [], a = this._def.keyType, i = this._def.valueType;
2235
+ for (const o in n.data)
2236
+ s.push({
2237
+ key: a._parse(new $(n, o, n.path, o)),
2238
+ value: i._parse(new $(n, n.data[o], n.path, o)),
2239
+ alwaysSet: o in n.data
2240
+ });
2241
+ return n.common.async ? T.mergeObjectAsync(t, s) : T.mergeObjectSync(t, s);
2242
+ }
2243
+ get element() {
2244
+ return this._def.valueType;
2245
+ }
2246
+ static create(e, t, n) {
2247
+ return t instanceof g ? new he({
2248
+ keyType: e,
2249
+ valueType: t,
2250
+ typeName: p.ZodRecord,
2251
+ ...v(n)
2252
+ }) : new he({
2253
+ keyType: R.create(),
2254
+ valueType: e,
2255
+ typeName: p.ZodRecord,
2256
+ ...v(t)
2257
+ });
2258
+ }
2259
+ }
2260
+ class Ze extends g {
2261
+ get keySchema() {
2262
+ return this._def.keyType;
2263
+ }
2264
+ get valueSchema() {
2265
+ return this._def.valueType;
2266
+ }
2267
+ _parse(e) {
2268
+ const { status: t, ctx: n } = this._processInputParams(e);
2269
+ if (n.parsedType !== f.map)
2270
+ return l(n, {
2271
+ code: c.invalid_type,
2272
+ expected: f.map,
2273
+ received: n.parsedType
2274
+ }), y;
2275
+ const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], d) => ({
2276
+ key: s._parse(new $(n, o, n.path, [d, "key"])),
2277
+ value: a._parse(new $(n, u, n.path, [d, "value"]))
2278
+ }));
2279
+ if (n.common.async) {
2280
+ const o = /* @__PURE__ */ new Map();
2281
+ return Promise.resolve().then(async () => {
2282
+ for (const u of i) {
2283
+ const d = await u.key, h = await u.value;
2284
+ if (d.status === "aborted" || h.status === "aborted")
2285
+ return y;
2286
+ (d.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(d.value, h.value);
2287
+ }
2288
+ return { status: t.value, value: o };
2289
+ });
2290
+ } else {
2291
+ const o = /* @__PURE__ */ new Map();
2292
+ for (const u of i) {
2293
+ const d = u.key, h = u.value;
2294
+ if (d.status === "aborted" || h.status === "aborted")
2295
+ return y;
2296
+ (d.status === "dirty" || h.status === "dirty") && t.dirty(), o.set(d.value, h.value);
2297
+ }
2298
+ return { status: t.value, value: o };
2299
+ }
2300
+ }
2301
+ }
2302
+ Ze.create = (r, e, t) => new Ze({
2303
+ valueType: e,
2304
+ keyType: r,
2305
+ typeName: p.ZodMap,
2306
+ ...v(t)
2307
+ });
2308
+ class X extends g {
2309
+ _parse(e) {
2310
+ const { status: t, ctx: n } = this._processInputParams(e);
2311
+ if (n.parsedType !== f.set)
2312
+ return l(n, {
2313
+ code: c.invalid_type,
2314
+ expected: f.set,
2315
+ received: n.parsedType
2316
+ }), y;
2317
+ const s = this._def;
2318
+ s.minSize !== null && n.data.size < s.minSize.value && (l(n, {
2319
+ code: c.too_small,
2320
+ minimum: s.minSize.value,
2321
+ type: "set",
2322
+ inclusive: !0,
2323
+ exact: !1,
2324
+ message: s.minSize.message
2325
+ }), t.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (l(n, {
2326
+ code: c.too_big,
2327
+ maximum: s.maxSize.value,
2328
+ type: "set",
2329
+ inclusive: !0,
2330
+ exact: !1,
2331
+ message: s.maxSize.message
2332
+ }), t.dirty());
2333
+ const a = this._def.valueType;
2334
+ function i(u) {
2335
+ const d = /* @__PURE__ */ new Set();
2336
+ for (const h of u) {
2337
+ if (h.status === "aborted")
2338
+ return y;
2339
+ h.status === "dirty" && t.dirty(), d.add(h.value);
2340
+ }
2341
+ return { status: t.value, value: d };
2342
+ }
2343
+ const o = [...n.data.values()].map((u, d) => a._parse(new $(n, u, n.path, d)));
2344
+ return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
2345
+ }
2346
+ min(e, t) {
2347
+ return new X({
2348
+ ...this._def,
2349
+ minSize: { value: e, message: m.toString(t) }
2350
+ });
2351
+ }
2352
+ max(e, t) {
2353
+ return new X({
2354
+ ...this._def,
2355
+ maxSize: { value: e, message: m.toString(t) }
2356
+ });
2357
+ }
2358
+ size(e, t) {
2359
+ return this.min(e, t).max(e, t);
2360
+ }
2361
+ nonempty(e) {
2362
+ return this.min(1, e);
2363
+ }
2364
+ }
2365
+ X.create = (r, e) => new X({
2366
+ valueType: r,
2367
+ minSize: null,
2368
+ maxSize: null,
2369
+ typeName: p.ZodSet,
2370
+ ...v(e)
2371
+ });
2372
+ class ee extends g {
2373
+ constructor() {
2374
+ super(...arguments), this.validate = this.implement;
2375
+ }
2376
+ _parse(e) {
2377
+ const { ctx: t } = this._processInputParams(e);
2378
+ if (t.parsedType !== f.function)
2379
+ return l(t, {
2380
+ code: c.invalid_type,
2381
+ expected: f.function,
2382
+ received: t.parsedType
2383
+ }), y;
2384
+ function n(o, u) {
2385
+ return we({
2386
+ data: o,
2387
+ path: t.path,
2388
+ errorMaps: [
2389
+ t.common.contextualErrorMap,
2390
+ t.schemaErrorMap,
2391
+ ke(),
2392
+ re
2393
+ ].filter((d) => !!d),
2394
+ issueData: {
2395
+ code: c.invalid_arguments,
2396
+ argumentsError: u
2397
+ }
2398
+ });
2399
+ }
2400
+ function s(o, u) {
2401
+ return we({
2402
+ data: o,
2403
+ path: t.path,
2404
+ errorMaps: [
2405
+ t.common.contextualErrorMap,
2406
+ t.schemaErrorMap,
2407
+ ke(),
2408
+ re
2409
+ ].filter((d) => !!d),
2410
+ issueData: {
2411
+ code: c.invalid_return_type,
2412
+ returnTypeError: u
2413
+ }
2414
+ });
2415
+ }
2416
+ const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2417
+ if (this._def.returns instanceof se) {
2418
+ const o = this;
2419
+ return S(async function(...u) {
2420
+ const d = new O([]), h = await o._def.args.parseAsync(u, a).catch((Z) => {
2421
+ throw d.addIssue(n(u, Z)), d;
2422
+ }), x = await Reflect.apply(i, this, h);
2423
+ return await o._def.returns._def.type.parseAsync(x, a).catch((Z) => {
2424
+ throw d.addIssue(s(x, Z)), d;
2425
+ });
2426
+ });
2427
+ } else {
2428
+ const o = this;
2429
+ return S(function(...u) {
2430
+ const d = o._def.args.safeParse(u, a);
2431
+ if (!d.success)
2432
+ throw new O([n(u, d.error)]);
2433
+ const h = Reflect.apply(i, this, d.data), x = o._def.returns.safeParse(h, a);
2434
+ if (!x.success)
2435
+ throw new O([s(h, x.error)]);
2436
+ return x.data;
2437
+ });
2438
+ }
2439
+ }
2440
+ parameters() {
2441
+ return this._def.args;
2442
+ }
2443
+ returnType() {
2444
+ return this._def.returns;
2445
+ }
2446
+ args(...e) {
2447
+ return new ee({
2448
+ ...this._def,
2449
+ args: V.create(e).rest(Y.create())
2450
+ });
2451
+ }
2452
+ returns(e) {
2453
+ return new ee({
2454
+ ...this._def,
2455
+ returns: e
2456
+ });
2457
+ }
2458
+ implement(e) {
2459
+ return this.parse(e);
2460
+ }
2461
+ strictImplement(e) {
2462
+ return this.parse(e);
2463
+ }
2464
+ static create(e, t, n) {
2465
+ return new ee({
2466
+ args: e || V.create([]).rest(Y.create()),
2467
+ returns: t || Y.create(),
2468
+ typeName: p.ZodFunction,
2469
+ ...v(n)
2470
+ });
2471
+ }
2472
+ }
2473
+ class me extends g {
2474
+ get schema() {
2475
+ return this._def.getter();
2476
+ }
2477
+ _parse(e) {
2478
+ const { ctx: t } = this._processInputParams(e);
2479
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2480
+ }
2481
+ }
2482
+ me.create = (r, e) => new me({
2483
+ getter: r,
2484
+ typeName: p.ZodLazy,
2485
+ ...v(e)
2486
+ });
2487
+ class pe extends g {
2488
+ _parse(e) {
2489
+ if (e.data !== this._def.value) {
2490
+ const t = this._getOrReturnCtx(e);
2491
+ return l(t, {
2492
+ received: t.data,
2493
+ code: c.invalid_literal,
2494
+ expected: this._def.value
2495
+ }), y;
2496
+ }
2497
+ return { status: "valid", value: e.data };
2498
+ }
2499
+ get value() {
2500
+ return this._def.value;
2501
+ }
2502
+ }
2503
+ pe.create = (r, e) => new pe({
2504
+ value: r,
2505
+ typeName: p.ZodLiteral,
2506
+ ...v(e)
2507
+ });
2508
+ function ct(r, e) {
2509
+ return new W({
2510
+ values: r,
2511
+ typeName: p.ZodEnum,
2512
+ ...v(e)
2513
+ });
2514
+ }
2515
+ class W extends g {
2516
+ constructor() {
2517
+ super(...arguments), ae.set(this, void 0);
2518
+ }
2519
+ _parse(e) {
2520
+ if (typeof e.data != "string") {
2521
+ const t = this._getOrReturnCtx(e), n = this._def.values;
2522
+ return l(t, {
2523
+ expected: _.joinValues(n),
2524
+ received: t.parsedType,
2525
+ code: c.invalid_type
2526
+ }), y;
2527
+ }
2528
+ if (Te(this, ae) || at(this, ae, new Set(this._def.values)), !Te(this, ae).has(e.data)) {
2529
+ const t = this._getOrReturnCtx(e), n = this._def.values;
2530
+ return l(t, {
2531
+ received: t.data,
2532
+ code: c.invalid_enum_value,
2533
+ options: n
2534
+ }), y;
2535
+ }
2536
+ return S(e.data);
2537
+ }
2538
+ get options() {
2539
+ return this._def.values;
2540
+ }
2541
+ get enum() {
2542
+ const e = {};
2543
+ for (const t of this._def.values)
2544
+ e[t] = t;
2545
+ return e;
2546
+ }
2547
+ get Values() {
2548
+ const e = {};
2549
+ for (const t of this._def.values)
2550
+ e[t] = t;
2551
+ return e;
2552
+ }
2553
+ get Enum() {
2554
+ const e = {};
2555
+ for (const t of this._def.values)
2556
+ e[t] = t;
2557
+ return e;
2558
+ }
2559
+ extract(e, t = this._def) {
2560
+ return W.create(e, {
2561
+ ...this._def,
2562
+ ...t
2563
+ });
2564
+ }
2565
+ exclude(e, t = this._def) {
2566
+ return W.create(this.options.filter((n) => !e.includes(n)), {
2567
+ ...this._def,
2568
+ ...t
2569
+ });
2570
+ }
2571
+ }
2572
+ ae = /* @__PURE__ */ new WeakMap();
2573
+ W.create = ct;
2574
+ class ye extends g {
2575
+ constructor() {
2576
+ super(...arguments), ie.set(this, void 0);
2577
+ }
2578
+ _parse(e) {
2579
+ const t = _.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2580
+ if (n.parsedType !== f.string && n.parsedType !== f.number) {
2581
+ const s = _.objectValues(t);
2582
+ return l(n, {
2583
+ expected: _.joinValues(s),
2584
+ received: n.parsedType,
2585
+ code: c.invalid_type
2586
+ }), y;
2587
+ }
2588
+ if (Te(this, ie) || at(this, ie, new Set(_.getValidEnumValues(this._def.values))), !Te(this, ie).has(e.data)) {
2589
+ const s = _.objectValues(t);
2590
+ return l(n, {
2591
+ received: n.data,
2592
+ code: c.invalid_enum_value,
2593
+ options: s
2594
+ }), y;
2595
+ }
2596
+ return S(e.data);
2597
+ }
2598
+ get enum() {
2599
+ return this._def.values;
2600
+ }
2601
+ }
2602
+ ie = /* @__PURE__ */ new WeakMap();
2603
+ ye.create = (r, e) => new ye({
2604
+ values: r,
2605
+ typeName: p.ZodNativeEnum,
2606
+ ...v(e)
2607
+ });
2608
+ class se extends g {
2609
+ unwrap() {
2610
+ return this._def.type;
2611
+ }
2612
+ _parse(e) {
2613
+ const { ctx: t } = this._processInputParams(e);
2614
+ if (t.parsedType !== f.promise && t.common.async === !1)
2615
+ return l(t, {
2616
+ code: c.invalid_type,
2617
+ expected: f.promise,
2618
+ received: t.parsedType
2619
+ }), y;
2620
+ const n = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2621
+ return S(n.then((s) => this._def.type.parseAsync(s, {
2622
+ path: t.path,
2623
+ errorMap: t.common.contextualErrorMap
2624
+ })));
2625
+ }
2626
+ }
2627
+ se.create = (r, e) => new se({
2628
+ type: r,
2629
+ typeName: p.ZodPromise,
2630
+ ...v(e)
2631
+ });
2632
+ class j extends g {
2633
+ innerType() {
2634
+ return this._def.schema;
2635
+ }
2636
+ sourceType() {
2637
+ return this._def.schema._def.typeName === p.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2638
+ }
2639
+ _parse(e) {
2640
+ const { status: t, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
2641
+ addIssue: (i) => {
2642
+ l(n, i), i.fatal ? t.abort() : t.dirty();
2643
+ },
2644
+ get path() {
2645
+ return n.path;
2646
+ }
2647
+ };
2648
+ if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2649
+ const i = s.transform(n.data, a);
2650
+ if (n.common.async)
2651
+ return Promise.resolve(i).then(async (o) => {
2652
+ if (t.value === "aborted")
2653
+ return y;
2654
+ const u = await this._def.schema._parseAsync({
2655
+ data: o,
2656
+ path: n.path,
2657
+ parent: n
2658
+ });
2659
+ return u.status === "aborted" ? y : u.status === "dirty" || t.value === "dirty" ? K(u.value) : u;
2660
+ });
2661
+ {
2662
+ if (t.value === "aborted")
2663
+ return y;
2664
+ const o = this._def.schema._parseSync({
2665
+ data: i,
2666
+ path: n.path,
2667
+ parent: n
2668
+ });
2669
+ return o.status === "aborted" ? y : o.status === "dirty" || t.value === "dirty" ? K(o.value) : o;
2670
+ }
2671
+ }
2672
+ if (s.type === "refinement") {
2673
+ const i = (o) => {
2674
+ const u = s.refinement(o, a);
2675
+ if (n.common.async)
2676
+ return Promise.resolve(u);
2677
+ if (u instanceof Promise)
2678
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2679
+ return o;
2680
+ };
2681
+ if (n.common.async === !1) {
2682
+ const o = this._def.schema._parseSync({
2683
+ data: n.data,
2684
+ path: n.path,
2685
+ parent: n
2686
+ });
2687
+ return o.status === "aborted" ? y : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2688
+ } else
2689
+ 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 }))));
2690
+ }
2691
+ if (s.type === "transform")
2692
+ if (n.common.async === !1) {
2693
+ const i = this._def.schema._parseSync({
2694
+ data: n.data,
2695
+ path: n.path,
2696
+ parent: n
2697
+ });
2698
+ if (!G(i))
2699
+ return i;
2700
+ const o = s.transform(i.value, a);
2701
+ if (o instanceof Promise)
2702
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2703
+ return { status: t.value, value: o };
2704
+ } else
2705
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => G(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({ status: t.value, value: o })) : i);
2706
+ _.assertNever(s);
2707
+ }
2708
+ }
2709
+ j.create = (r, e, t) => new j({
2710
+ schema: r,
2711
+ typeName: p.ZodEffects,
2712
+ effect: e,
2713
+ ...v(t)
2714
+ });
2715
+ j.createWithPreprocess = (r, e, t) => new j({
2716
+ schema: e,
2717
+ effect: { type: "preprocess", transform: r },
2718
+ typeName: p.ZodEffects,
2719
+ ...v(t)
2720
+ });
2721
+ class P extends g {
2722
+ _parse(e) {
2723
+ return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
2724
+ }
2725
+ unwrap() {
2726
+ return this._def.innerType;
2727
+ }
2728
+ }
2729
+ P.create = (r, e) => new P({
2730
+ innerType: r,
2731
+ typeName: p.ZodOptional,
2732
+ ...v(e)
2733
+ });
2734
+ class q extends g {
2735
+ _parse(e) {
2736
+ return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
2737
+ }
2738
+ unwrap() {
2739
+ return this._def.innerType;
2740
+ }
2741
+ }
2742
+ q.create = (r, e) => new q({
2743
+ innerType: r,
2744
+ typeName: p.ZodNullable,
2745
+ ...v(e)
2746
+ });
2747
+ class ve extends g {
2748
+ _parse(e) {
2749
+ const { ctx: t } = this._processInputParams(e);
2750
+ let n = t.data;
2751
+ return t.parsedType === f.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2752
+ data: n,
2753
+ path: t.path,
2754
+ parent: t
2755
+ });
2756
+ }
2757
+ removeDefault() {
2758
+ return this._def.innerType;
2759
+ }
2760
+ }
2761
+ ve.create = (r, e) => new ve({
2762
+ innerType: r,
2763
+ typeName: p.ZodDefault,
2764
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2765
+ ...v(e)
2766
+ });
2767
+ class ge extends g {
2768
+ _parse(e) {
2769
+ const { ctx: t } = this._processInputParams(e), n = {
2770
+ ...t,
2771
+ common: {
2772
+ ...t.common,
2773
+ issues: []
2774
+ }
2775
+ }, s = this._def.innerType._parse({
2776
+ data: n.data,
2777
+ path: n.path,
2778
+ parent: {
2779
+ ...n
2780
+ }
2781
+ });
2782
+ return oe(s) ? s.then((a) => ({
2783
+ status: "valid",
2784
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2785
+ get error() {
2786
+ return new O(n.common.issues);
2787
+ },
2788
+ input: n.data
2789
+ })
2790
+ })) : {
2791
+ status: "valid",
2792
+ value: s.status === "valid" ? s.value : this._def.catchValue({
2793
+ get error() {
2794
+ return new O(n.common.issues);
2795
+ },
2796
+ input: n.data
2797
+ })
2798
+ };
2799
+ }
2800
+ removeCatch() {
2801
+ return this._def.innerType;
2802
+ }
2803
+ }
2804
+ ge.create = (r, e) => new ge({
2805
+ innerType: r,
2806
+ typeName: p.ZodCatch,
2807
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2808
+ ...v(e)
2809
+ });
2810
+ class Ee extends g {
2811
+ _parse(e) {
2812
+ if (this._getType(e) !== f.nan) {
2813
+ const n = this._getOrReturnCtx(e);
2814
+ return l(n, {
2815
+ code: c.invalid_type,
2816
+ expected: f.nan,
2817
+ received: n.parsedType
2818
+ }), y;
2819
+ }
2820
+ return { status: "valid", value: e.data };
2821
+ }
2822
+ }
2823
+ Ee.create = (r) => new Ee({
2824
+ typeName: p.ZodNaN,
2825
+ ...v(r)
2826
+ });
2827
+ const Qt = Symbol("zod_brand");
2828
+ class ze extends g {
2829
+ _parse(e) {
2830
+ const { ctx: t } = this._processInputParams(e), n = t.data;
2831
+ return this._def.type._parse({
2832
+ data: n,
2833
+ path: t.path,
2834
+ parent: t
2835
+ });
2836
+ }
2837
+ unwrap() {
2838
+ return this._def.type;
2839
+ }
2840
+ }
2841
+ class xe extends g {
2842
+ _parse(e) {
2843
+ const { status: t, ctx: n } = this._processInputParams(e);
2844
+ if (n.common.async)
2845
+ return (async () => {
2846
+ const a = await this._def.in._parseAsync({
2847
+ data: n.data,
2848
+ path: n.path,
2849
+ parent: n
2850
+ });
2851
+ return a.status === "aborted" ? y : a.status === "dirty" ? (t.dirty(), K(a.value)) : this._def.out._parseAsync({
2852
+ data: a.value,
2853
+ path: n.path,
2854
+ parent: n
2855
+ });
2856
+ })();
2857
+ {
2858
+ const s = this._def.in._parseSync({
2859
+ data: n.data,
2860
+ path: n.path,
2861
+ parent: n
2862
+ });
2863
+ return s.status === "aborted" ? y : s.status === "dirty" ? (t.dirty(), {
2864
+ status: "dirty",
2865
+ value: s.value
2866
+ }) : this._def.out._parseSync({
2867
+ data: s.value,
2868
+ path: n.path,
2869
+ parent: n
2870
+ });
2871
+ }
2872
+ }
2873
+ static create(e, t) {
2874
+ return new xe({
2875
+ in: e,
2876
+ out: t,
2877
+ typeName: p.ZodPipeline
2878
+ });
2879
+ }
2880
+ }
2881
+ class _e extends g {
2882
+ _parse(e) {
2883
+ const t = this._def.innerType._parse(e), n = (s) => (G(s) && (s.value = Object.freeze(s.value)), s);
2884
+ return oe(t) ? t.then((s) => n(s)) : n(t);
2885
+ }
2886
+ unwrap() {
2887
+ return this._def.innerType;
2888
+ }
2889
+ }
2890
+ _e.create = (r, e) => new _e({
2891
+ innerType: r,
2892
+ typeName: p.ZodReadonly,
2893
+ ...v(e)
2894
+ });
2895
+ function Ge(r, e) {
2896
+ const t = typeof r == "function" ? r(e) : typeof r == "string" ? { message: r } : r;
2897
+ return typeof t == "string" ? { message: t } : t;
2898
+ }
2899
+ function ut(r, e = {}, t) {
2900
+ return r ? ne.create().superRefine((n, s) => {
2901
+ var a, i;
2902
+ const o = r(n);
2903
+ if (o instanceof Promise)
2904
+ return o.then((u) => {
2905
+ var d, h;
2906
+ if (!u) {
2907
+ const x = Ge(e, n), k = (h = (d = x.fatal) !== null && d !== void 0 ? d : t) !== null && h !== void 0 ? h : !0;
2908
+ s.addIssue({ code: "custom", ...x, fatal: k });
2909
+ }
2910
+ });
2911
+ if (!o) {
2912
+ const u = Ge(e, n), d = (i = (a = u.fatal) !== null && a !== void 0 ? a : t) !== null && i !== void 0 ? i : !0;
2913
+ s.addIssue({ code: "custom", ...u, fatal: d });
2914
+ }
2915
+ }) : ne.create();
2916
+ }
2917
+ const Kt = {
2918
+ object: b.lazycreate
2919
+ };
2920
+ var p;
2921
+ (function(r) {
2922
+ 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";
2923
+ })(p || (p = {}));
2924
+ const er = (r, e = {
2925
+ message: `Input not instance of ${r.name}`
2926
+ }) => ut((t) => t instanceof r, e), lt = R.create, ft = F.create, tr = Ee.create, rr = U.create, ht = de.create, nr = H.create, sr = Ce.create, ar = ce.create, ir = ue.create, or = ne.create, dr = Y.create, cr = D.create, ur = Se.create, lr = I.create, fr = b.create, hr = b.strictCreate, mr = le.create, pr = Ne.create, yr = fe.create, vr = V.create, gr = he.create, _r = Ze.create, xr = X.create, br = ee.create, kr = me.create, wr = pe.create, Tr = W.create, Cr = ye.create, Sr = se.create, He = j.create, Zr = P.create, Er = q.create, Or = j.createWithPreprocess, Nr = xe.create, Ar = () => lt().optional(), Rr = () => ft().optional(), Ir = () => ht().optional(), jr = {
2927
+ string: (r) => R.create({ ...r, coerce: !0 }),
2928
+ number: (r) => F.create({ ...r, coerce: !0 }),
2929
+ boolean: (r) => de.create({
2930
+ ...r,
2931
+ coerce: !0
2932
+ }),
2933
+ bigint: (r) => U.create({ ...r, coerce: !0 }),
2934
+ date: (r) => H.create({ ...r, coerce: !0 })
2935
+ }, Pr = y;
2936
+ var Xe = /* @__PURE__ */ Object.freeze({
2937
+ __proto__: null,
2938
+ defaultErrorMap: re,
2939
+ setErrorMap: Ot,
2940
+ getErrorMap: ke,
2941
+ makeIssue: we,
2942
+ EMPTY_PATH: Nt,
2943
+ addIssueToContext: l,
2944
+ ParseStatus: T,
2945
+ INVALID: y,
2946
+ DIRTY: K,
2947
+ OK: S,
2948
+ isAborted: $e,
2949
+ isDirty: Ve,
2950
+ isValid: G,
2951
+ isAsync: oe,
2952
+ get util() {
2953
+ return _;
2954
+ },
2955
+ get objectUtil() {
2956
+ return Pe;
2957
+ },
2958
+ ZodParsedType: f,
2959
+ getParsedType: L,
2960
+ ZodType: g,
2961
+ datetimeRegex: dt,
2962
+ ZodString: R,
2963
+ ZodNumber: F,
2964
+ ZodBigInt: U,
2965
+ ZodBoolean: de,
2966
+ ZodDate: H,
2967
+ ZodSymbol: Ce,
2968
+ ZodUndefined: ce,
2969
+ ZodNull: ue,
2970
+ ZodAny: ne,
2971
+ ZodUnknown: Y,
2972
+ ZodNever: D,
2973
+ ZodVoid: Se,
2974
+ ZodArray: I,
2975
+ ZodObject: b,
2976
+ ZodUnion: le,
2977
+ ZodDiscriminatedUnion: Ne,
2978
+ ZodIntersection: fe,
2979
+ ZodTuple: V,
2980
+ ZodRecord: he,
2981
+ ZodMap: Ze,
2982
+ ZodSet: X,
2983
+ ZodFunction: ee,
2984
+ ZodLazy: me,
2985
+ ZodLiteral: pe,
2986
+ ZodEnum: W,
2987
+ ZodNativeEnum: ye,
2988
+ ZodPromise: se,
2989
+ ZodEffects: j,
2990
+ ZodTransformer: j,
2991
+ ZodOptional: P,
2992
+ ZodNullable: q,
2993
+ ZodDefault: ve,
2994
+ ZodCatch: ge,
2995
+ ZodNaN: Ee,
2996
+ BRAND: Qt,
2997
+ ZodBranded: ze,
2998
+ ZodPipeline: xe,
2999
+ ZodReadonly: _e,
3000
+ custom: ut,
3001
+ Schema: g,
3002
+ ZodSchema: g,
3003
+ late: Kt,
3004
+ get ZodFirstPartyTypeKind() {
3005
+ return p;
3006
+ },
3007
+ coerce: jr,
3008
+ any: or,
3009
+ array: lr,
3010
+ bigint: rr,
3011
+ boolean: ht,
3012
+ date: nr,
3013
+ discriminatedUnion: pr,
3014
+ effect: He,
3015
+ enum: Tr,
3016
+ function: br,
3017
+ instanceof: er,
3018
+ intersection: yr,
3019
+ lazy: kr,
3020
+ literal: wr,
3021
+ map: _r,
3022
+ nan: tr,
3023
+ nativeEnum: Cr,
3024
+ never: cr,
3025
+ null: ir,
3026
+ nullable: Er,
3027
+ number: ft,
3028
+ object: fr,
3029
+ oboolean: Ir,
3030
+ onumber: Rr,
3031
+ optional: Zr,
3032
+ ostring: Ar,
3033
+ pipeline: Nr,
3034
+ preprocess: Or,
3035
+ promise: Sr,
3036
+ record: gr,
3037
+ set: xr,
3038
+ strictObject: hr,
3039
+ string: lt,
3040
+ symbol: sr,
3041
+ transformer: He,
3042
+ tuple: vr,
3043
+ undefined: ar,
3044
+ union: mr,
3045
+ unknown: dr,
3046
+ void: ur,
3047
+ NEVER: Pr,
3048
+ ZodIssueCode: c,
3049
+ quotelessJson: Et,
3050
+ ZodError: O
3051
+ });
3052
+ class te extends Error {
3053
+ constructor(t, n = "invalid_code") {
3054
+ super(t);
3055
+ Fe(this, "type");
3056
+ this.type = n, this.name = "OTPError", Object.setPrototypeOf(this, te.prototype);
21
3057
  }
22
3058
  // Factory методы для удобства
23
- static invalidCode(n = "Неверный код подтверждения") {
24
- return new w(n, "invalid_code");
3059
+ static invalidCode(t = "Неверный код подтверждения") {
3060
+ return new te(t, "invalid_code");
25
3061
  }
26
- static invalidEmail(n = "Неверный email") {
27
- return new w(n, "invalid_email");
3062
+ static invalidEmail(t = "Неверный email") {
3063
+ return new te(t, "invalid_email");
28
3064
  }
29
3065
  }
30
- const Q = I({
3066
+ const $r = Be({
31
3067
  slots: {
32
3068
  button: "w-full",
33
3069
  iconButton: "animate-spin"
34
3070
  }
35
- }), _ = S.forwardRef((t, o) => {
3071
+ }), mt = z.forwardRef((r, e) => {
36
3072
  const {
37
- defaultEmail: n,
38
- emailPlaceholder: r = "you@company.com",
39
- emailLabel: e = "Email",
40
- emailDescription: i,
41
- sendButtonText: p = "Отправить",
42
- onSendCode: f,
43
- onEmailChange: g,
44
- showSendButton: u = !0,
3073
+ defaultEmail: t,
3074
+ emailPlaceholder: n = "you@company.com",
3075
+ emailLabel: s = "Email",
3076
+ emailDescription: a,
3077
+ sendButtonText: i = "Отправить",
3078
+ onSendCode: o,
3079
+ onEmailChange: u,
3080
+ showSendButton: d = !0,
45
3081
  labelClassName: h,
46
- emailValidation: y
47
- } = t, [s, b] = S.useState(!1), l = Q(), d = v.object({
48
- email: y || v.string().email("Введите корректный email")
49
- }), C = V({
50
- resolver: G(d),
3082
+ emailValidation: x
3083
+ } = r, [k, Z] = z.useState(!1), C = $r(), A = Xe.object({
3084
+ email: x || Xe.string().email("Введите корректный email")
3085
+ }), B = Qe({
3086
+ resolver: Zt(A),
51
3087
  defaultValues: {
52
- email: n || ""
3088
+ email: t || ""
53
3089
  }
54
- }), m = async (c) => {
55
- b(!0);
3090
+ }), N = async (E) => {
3091
+ Z(!0);
56
3092
  try {
57
- await f?.(c.email);
58
- } catch (T) {
59
- if (T instanceof w && T.type === "invalid_email") {
60
- C.setError("email", {
3093
+ await o?.(E.email);
3094
+ } catch (J) {
3095
+ if (J instanceof te && J.type === "invalid_email") {
3096
+ B.setError("email", {
61
3097
  type: "manual",
62
- message: T.message
3098
+ message: J.message
63
3099
  });
64
3100
  return;
65
3101
  }
66
- throw T;
3102
+ throw J;
67
3103
  } finally {
68
- b(!1);
3104
+ Z(!1);
69
3105
  }
70
3106
  };
71
- return /* @__PURE__ */ a(D, { asChild: !0, ...C, children: /* @__PURE__ */ a("form", { ref: o, onSubmit: C.handleSubmit(m), noValidate: !0, children: /* @__PURE__ */ x(L, { children: [
72
- /* @__PURE__ */ a(
73
- R,
3107
+ return /* @__PURE__ */ w(Ke, { asChild: !0, ...B, children: /* @__PURE__ */ w("form", { ref: e, onSubmit: B.handleSubmit(N), noValidate: !0, children: /* @__PURE__ */ Oe(Le, { children: [
3108
+ /* @__PURE__ */ w(
3109
+ et,
74
3110
  {
75
3111
  name: "email",
76
- title: e,
77
- description: i,
3112
+ title: s,
3113
+ description: a,
78
3114
  labelClassName: h,
79
- control: ({ field: c }) => /* @__PURE__ */ a(
80
- A,
3115
+ control: ({ field: E }) => /* @__PURE__ */ w(
3116
+ _t,
81
3117
  {
82
- type: y ? "text" : "email",
83
- placeholder: r,
3118
+ type: x ? "text" : "email",
3119
+ placeholder: n,
84
3120
  showClearIcon: !0,
85
- ...c,
86
- onChange: (T) => {
87
- c.onChange(T), g?.(T || "");
3121
+ ...E,
3122
+ onChange: (J) => {
3123
+ E.onChange(J), u?.(J || "");
88
3124
  }
89
3125
  }
90
3126
  )
91
3127
  }
92
3128
  ),
93
- u && /* @__PURE__ */ a(
94
- E,
3129
+ d && /* @__PURE__ */ w(
3130
+ De,
95
3131
  {
96
3132
  type: "submit",
97
- disabled: !C.getValues("email") || s,
98
- startIcon: s ? k : void 0,
99
- className: l.button(),
100
- iconClassName: j(s && l.iconButton()),
101
- children: p
3133
+ disabled: !B.getValues("email") || k,
3134
+ startIcon: k ? rt : void 0,
3135
+ className: C.button(),
3136
+ iconClassName: tt(k && C.iconButton()),
3137
+ children: i
102
3138
  }
103
3139
  )
104
3140
  ] }) }) });
105
3141
  });
106
- _.displayName = "EmailForm";
107
- const F = {
3142
+ mt.displayName = "EmailForm";
3143
+ const Ie = {
108
3144
  otpLabel: "Код доступа",
109
3145
  confirmButtonText: "Подтвердить",
110
3146
  showConfirmButton: !0
111
- }, U = I({
3147
+ }, Vr = Be({
112
3148
  slots: {
113
3149
  button: "w-full",
114
3150
  iconButton: "animate-spin"
115
3151
  }
116
- }), W = (t) => {
3152
+ }), Mr = (r) => {
117
3153
  const {
118
- otpFormat: o = "3-3",
119
- autoSubmit: n = !0,
120
- otpLabel: r = F.otpLabel,
121
- otpDescription: e,
122
- confirmButtonText: i = F.confirmButtonText,
123
- onConfirmCode: p,
124
- showConfirmButton: f = F.showConfirmButton,
125
- labelClassName: g
126
- } = t, u = N(() => X(o), [o]), h = N(() => u.reduce((m, c) => m + c, 0), [u]), y = U(), [s, b] = S.useState(!1), l = V(), d = async (m) => {
127
- if (p) {
128
- b(!0);
3154
+ otpFormat: e = "3-3",
3155
+ autoSubmit: t = !0,
3156
+ otpLabel: n = Ie.otpLabel,
3157
+ otpDescription: s,
3158
+ confirmButtonText: a = Ie.confirmButtonText,
3159
+ onConfirmCode: i,
3160
+ showConfirmButton: o = Ie.showConfirmButton,
3161
+ labelClassName: u
3162
+ } = r, d = Ue(() => Lr(e), [e]), h = Ue(() => d.reduce((N, E) => N + E, 0), [d]), x = Vr(), [k, Z] = z.useState(!1), C = Qe(), A = async (N) => {
3163
+ if (i) {
3164
+ Z(!0);
129
3165
  try {
130
- await p(m.otp);
131
- } catch (c) {
132
- if (c instanceof w && c.type === "invalid_code") {
133
- l.setError("otp", {
3166
+ await i(N.otp);
3167
+ } catch (E) {
3168
+ if (E instanceof te && E.type === "invalid_code") {
3169
+ C.setError("otp", {
134
3170
  type: "manual",
135
- message: c.message
3171
+ message: E.message
136
3172
  });
137
3173
  return;
138
3174
  }
139
- throw c;
3175
+ throw E;
140
3176
  } finally {
141
- b(!1);
3177
+ Z(!1);
142
3178
  }
143
3179
  }
144
- }, C = (m) => {
145
- l.clearErrors("otp"), l.setValue("otp", m), m.length === h && n && l.handleSubmit(d)();
3180
+ }, B = (N) => {
3181
+ C.clearErrors("otp"), C.setValue("otp", N), N.length === h && t && C.handleSubmit(A)();
146
3182
  };
147
- return /* @__PURE__ */ a(D, { asChild: !0, ...l, children: /* @__PURE__ */ a("form", { onSubmit: l.handleSubmit(d), noValidate: !0, children: /* @__PURE__ */ x(L, { children: [
148
- /* @__PURE__ */ a(
149
- R,
3183
+ return /* @__PURE__ */ w(Ke, { asChild: !0, ...C, children: /* @__PURE__ */ w("form", { onSubmit: C.handleSubmit(A), noValidate: !0, children: /* @__PURE__ */ Oe(Le, { children: [
3184
+ /* @__PURE__ */ w(
3185
+ et,
150
3186
  {
151
3187
  name: "otp",
152
- title: r,
153
- description: e,
154
- labelClassName: g,
155
- control: ({ field: m }) => /* @__PURE__ */ a(q, { autoFocus: !0, maxLength: h, ...m, onChange: C, children: Y(u) })
3188
+ title: n,
3189
+ description: s,
3190
+ labelClassName: u,
3191
+ control: ({ field: N }) => /* @__PURE__ */ w(xt, { autoFocus: !0, maxLength: h, ...N, onChange: B, children: Dr(d) })
156
3192
  }
157
3193
  ),
158
- f && /* @__PURE__ */ a(
159
- E,
3194
+ o && /* @__PURE__ */ w(
3195
+ De,
160
3196
  {
161
3197
  type: "submit",
162
- disabled: s || l.getValues("otp")?.length !== h,
163
- startIcon: s ? k : void 0,
164
- className: y.button(),
165
- iconClassName: j(s && y.iconButton()),
166
- children: i
3198
+ disabled: k || C.getValues("otp")?.length !== h,
3199
+ startIcon: k ? rt : void 0,
3200
+ className: x.button(),
3201
+ iconClassName: tt(k && x.iconButton()),
3202
+ children: a
167
3203
  }
168
3204
  )
169
3205
  ] }) }) });
170
- }, X = (t, o = [3, 3], n) => {
171
- if (!t.includes("-")) {
172
- const e = parseInt(t, 10);
173
- return isNaN(e) || e <= 0 ? o : [e];
174
- }
175
- return t.split("-").map((e) => {
176
- const i = parseInt(e, 10);
177
- return isNaN(i) || i <= 0 ? 1 : i;
3206
+ }, Lr = (r, e = [3, 3], t) => {
3207
+ if (!r.includes("-")) {
3208
+ const s = parseInt(r, 10);
3209
+ return isNaN(s) || s <= 0 ? e : [s];
3210
+ }
3211
+ return r.split("-").map((s) => {
3212
+ const a = parseInt(s, 10);
3213
+ return isNaN(a) || a <= 0 ? 1 : a;
178
3214
  });
179
- }, Y = (t) => {
180
- let o = 0;
181
- return t.map((n, r) => {
182
- const e = Array.from({ length: n }, () => /* @__PURE__ */ a(H, { index: o++ }, o)), i = /* @__PURE__ */ a(K, { children: e }, `group-${r}`);
183
- return r < t.length - 1 ? /* @__PURE__ */ x(S.Fragment, { children: [
184
- i,
185
- /* @__PURE__ */ a(J, {})
186
- ] }, `fragment-${r}`) : i;
3215
+ }, Dr = (r) => {
3216
+ let e = 0;
3217
+ return r.map((t, n) => {
3218
+ const s = Array.from({ length: t }, () => /* @__PURE__ */ w(bt, { index: e++ }, e)), a = /* @__PURE__ */ w(wt, { children: s }, `group-${n}`);
3219
+ return n < r.length - 1 ? /* @__PURE__ */ Oe(z.Fragment, { children: [
3220
+ a,
3221
+ /* @__PURE__ */ w(kt, {})
3222
+ ] }, `fragment-${n}`) : a;
187
3223
  });
188
- }, Z = I({
3224
+ }, Br = Be({
189
3225
  slots: {
190
3226
  button: "w-full"
191
3227
  }
192
- }), M = S.forwardRef((t, o) => {
3228
+ }), pt = z.forwardRef((r, e) => {
193
3229
  const {
194
- lastSentTime: n,
195
- resendDelay: r = 60,
196
- resendButtonText: e = "Отправить код повторно",
197
- resendCountdownText: i = (d) => `Отправить код повторно через ${d} сек.`,
198
- onResend: p
199
- } = t, [f, g] = S.useState(0), [u, h] = S.useState(!1), y = Z();
200
- S.useEffect(() => {
201
- if (!n) {
202
- g(0);
3230
+ lastSentTime: t,
3231
+ resendDelay: n = 60,
3232
+ resendButtonText: s = "Отправить код повторно",
3233
+ resendCountdownText: a = (A) => `Отправить код повторно через ${A} сек.`,
3234
+ onResend: i
3235
+ } = r, [o, u] = z.useState(0), [d, h] = z.useState(!1), x = Br();
3236
+ z.useEffect(() => {
3237
+ if (!t) {
3238
+ u(0);
203
3239
  return;
204
3240
  }
205
- const d = () => {
206
- const m = Math.floor((Date.now() - n) / 1e3), c = Math.max(0, r - m);
207
- g(c);
3241
+ const A = () => {
3242
+ const N = Math.floor((Date.now() - t) / 1e3), E = Math.max(0, n - N);
3243
+ u(E);
208
3244
  };
209
- d();
210
- const C = setInterval(d, 1e3);
211
- return () => clearInterval(C);
212
- }, [n, r]);
213
- const s = async () => {
214
- if (!(f > 0)) {
3245
+ A();
3246
+ const B = setInterval(A, 1e3);
3247
+ return () => clearInterval(B);
3248
+ }, [t, n]);
3249
+ const k = async () => {
3250
+ if (!(o > 0)) {
215
3251
  h(!0);
216
3252
  try {
217
- await p?.();
218
- } catch (d) {
219
- console.error("Error resending code:", d);
3253
+ await i?.();
3254
+ } catch (A) {
3255
+ console.error("Error resending code:", A);
220
3256
  } finally {
221
3257
  h(!1);
222
3258
  }
223
3259
  }
224
- }, b = f > 0 || u, l = f > 0 ? i(f) : e;
225
- return /* @__PURE__ */ a(
226
- E,
3260
+ }, Z = o > 0 || d, C = o > 0 ? a(o) : s;
3261
+ return /* @__PURE__ */ w(
3262
+ De,
227
3263
  {
228
- ref: o,
229
- onClick: s,
230
- disabled: b,
3264
+ ref: e,
3265
+ onClick: k,
3266
+ disabled: Z,
231
3267
  variant: "link",
232
3268
  type: "button",
233
- className: y.button(),
234
- children: l
3269
+ className: x.button(),
3270
+ children: C
235
3271
  }
236
3272
  );
237
3273
  });
238
- M.displayName = "ResendButton";
239
- const tt = (t) => {
240
- const { onSendCode: o, onConfirmCode: n } = t, { labelClassName: r = "w-24" } = t, [e, i] = O(null), [p, f] = O(null), g = B(
241
- (s) => {
242
- e && s !== e && i(null);
3274
+ pt.displayName = "ResendButton";
3275
+ const zr = (r) => {
3276
+ const { onSendCode: e, onConfirmCode: t } = r, { labelClassName: n = "w-24" } = r, [s, a] = We(null), [i, o] = We(null), u = be(
3277
+ (k) => {
3278
+ s && k !== s && a(null);
243
3279
  },
244
- [e]
245
- ), u = B(
246
- async (s, b = !1) => {
3280
+ [s]
3281
+ ), d = be(
3282
+ async (k, Z = !1) => {
247
3283
  try {
248
- await o?.(s, b), f(Date.now()), i(s);
249
- } catch (l) {
250
- throw console.error("Error sending code:", l), l;
3284
+ await e?.(k, Z), o(Date.now()), a(k);
3285
+ } catch (C) {
3286
+ throw console.error("Error sending code:", C), C;
251
3287
  }
252
3288
  },
253
- [o]
254
- ), h = B(async () => {
255
- e && await u(e, !0);
256
- }, [u, e]), y = B(
257
- async (s) => {
258
- await n?.({ email: e, otp: s });
3289
+ [e]
3290
+ ), h = be(async () => {
3291
+ s && await d(s, !0);
3292
+ }, [d, s]), x = be(
3293
+ async (k) => {
3294
+ await t?.({ email: s, otp: k });
259
3295
  },
260
- [n, e]
3296
+ [t, s]
261
3297
  );
262
- return /* @__PURE__ */ x(L, { children: [
263
- /* @__PURE__ */ a(
264
- _,
3298
+ return /* @__PURE__ */ Oe(Le, { children: [
3299
+ /* @__PURE__ */ w(
3300
+ mt,
265
3301
  {
266
- defaultEmail: t.defaultEmail,
267
- emailPlaceholder: t.emailPlaceholder,
268
- emailLabel: t.emailLabel,
269
- emailDescription: t.emailDescription,
270
- onEmailChange: g,
271
- sendButtonText: t.sendButtonText,
272
- onSendCode: u,
273
- showSendButton: !e,
274
- labelClassName: r,
275
- emailValidation: t.emailValidation
3302
+ defaultEmail: r.defaultEmail,
3303
+ emailPlaceholder: r.emailPlaceholder,
3304
+ emailLabel: r.emailLabel,
3305
+ emailDescription: r.emailDescription,
3306
+ onEmailChange: u,
3307
+ sendButtonText: r.sendButtonText,
3308
+ onSendCode: d,
3309
+ showSendButton: !s,
3310
+ labelClassName: n,
3311
+ emailValidation: r.emailValidation
276
3312
  }
277
3313
  ),
278
- e && /* @__PURE__ */ a(
279
- W,
3314
+ s && /* @__PURE__ */ w(
3315
+ Mr,
280
3316
  {
281
- otpFormat: t.otpFormat,
282
- autoSubmit: t.autoSubmit,
283
- pasteTransformer: t.pasteTransformer,
284
- otpLabel: t.otpLabel,
285
- otpDescription: t.otpDescription,
286
- confirmButtonText: t.confirmButtonText,
287
- onConfirmCode: y,
288
- labelClassName: r
3317
+ otpFormat: r.otpFormat,
3318
+ autoSubmit: r.autoSubmit,
3319
+ pasteTransformer: r.pasteTransformer,
3320
+ otpLabel: r.otpLabel,
3321
+ otpDescription: r.otpDescription,
3322
+ confirmButtonText: r.confirmButtonText,
3323
+ onConfirmCode: x,
3324
+ labelClassName: n
289
3325
  },
290
- p
3326
+ i
291
3327
  ),
292
- e && /* @__PURE__ */ a(
293
- M,
3328
+ s && /* @__PURE__ */ w(
3329
+ pt,
294
3330
  {
295
- resendDelay: t.resendDelay,
296
- resendButtonText: t.resendButtonText,
297
- resendCountdownText: t.resendCountdownText,
3331
+ resendDelay: r.resendDelay,
3332
+ resendButtonText: r.resendButtonText,
3333
+ resendCountdownText: r.resendCountdownText,
298
3334
  onResend: h,
299
- lastSentTime: p
3335
+ lastSentTime: i
300
3336
  }
301
3337
  )
302
3338
  ] });
303
3339
  };
304
- tt.displayName = "OTPForm";
3340
+ zr.displayName = "OTPForm";
305
3341
  export {
306
- w as OTPError,
307
- tt as OTPForm
3342
+ te as OTPError,
3343
+ zr as OTPForm
308
3344
  };
309
3345
  //# sourceMappingURL=otp-form.js.map