@telemetryos/root-sdk 1.6.1 → 1.7.0

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