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