@authhero/cloudflare-adapter 2.14.3 → 2.15.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.
@@ -1,62 +1,62 @@
1
- import { verificationMethodsSchema as lt } from "@authhero/adapter-interfaces";
2
- import ft from "wretch";
3
- function ht(n, e) {
4
- var t = {};
5
- for (var s in n) Object.prototype.hasOwnProperty.call(n, s) && e.indexOf(s) < 0 && (t[s] = n[s]);
6
- if (n != null && typeof Object.getOwnPropertySymbols == "function")
7
- for (var r = 0, s = Object.getOwnPropertySymbols(n); r < s.length; r++)
8
- e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(n, s[r]) && (t[s[r]] = n[s[r]]);
9
- return t;
10
- }
11
- function pt(n, e) {
12
- var t;
13
- return ((t = n?._def) === null || t === void 0 ? void 0 : t.typeName) === e;
14
- }
15
- function ue(n, e) {
16
- const t = n.ZodType.prototype[e];
17
- n.ZodType.prototype[e] = function(...s) {
18
- const r = t.apply(this, s);
1
+ import { verificationMethodsSchema as yt } from "@authhero/adapter-interfaces";
2
+ import _t from "wretch";
3
+ function gt(t, e) {
4
+ var n = {};
5
+ for (var s in t) Object.prototype.hasOwnProperty.call(t, s) && e.indexOf(s) < 0 && (n[s] = t[s]);
6
+ if (t != null && typeof Object.getOwnPropertySymbols == "function")
7
+ for (var r = 0, s = Object.getOwnPropertySymbols(t); r < s.length; r++)
8
+ e.indexOf(s[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, s[r]) && (n[s[r]] = t[s[r]]);
9
+ return n;
10
+ }
11
+ function vt(t, e) {
12
+ var n;
13
+ return ((n = t?._def) === null || n === void 0 ? void 0 : n.typeName) === e;
14
+ }
15
+ function ue(t, e) {
16
+ const n = t.ZodType.prototype[e];
17
+ t.ZodType.prototype[e] = function(...s) {
18
+ const r = n.apply(this, s);
19
19
  return r._def.openapi = this._def.openapi, r;
20
20
  };
21
21
  }
22
- function mt(n) {
23
- if (typeof n.ZodType.prototype.openapi < "u")
22
+ function bt(t) {
23
+ if (typeof t.ZodType.prototype.openapi < "u")
24
24
  return;
25
- n.ZodType.prototype.openapi = function(r, a) {
26
- var i, o, c, u, p, b;
27
- const C = typeof r == "string" ? a : r, w = C ?? {}, { param: Z } = w, ce = ht(w, ["param"]), M = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof r == "string" ? { refId: r } : void 0), J = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), ce), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || Z ? {
28
- param: Object.assign(Object.assign({}, (b = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || b === void 0 ? void 0 : b.param), Z)
29
- } : void 0), D = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(M).length > 0 ? { _internal: M } : void 0), Object.keys(J).length > 0 ? { metadata: J } : void 0) }));
30
- if (pt(this, "ZodObject")) {
31
- const ee = this.extend;
32
- D.extend = function(...Q) {
33
- var H, de, Me, De, Le, Ve, ze;
34
- const Be = ee.apply(this, Q);
35
- return Be._def.openapi = {
25
+ t.ZodType.prototype.openapi = function(r, a) {
26
+ var i, o, c, d, h, x;
27
+ const T = typeof r == "string" ? a : r, w = T ?? {}, { param: N } = w, te = gt(w, ["param"]), O = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof r == "string" ? { refId: r } : void 0), V = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), te), !((d = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || d === void 0) && d.param || N ? {
28
+ param: Object.assign(Object.assign({}, (x = (h = this._def.openapi) === null || h === void 0 ? void 0 : h.metadata) === null || x === void 0 ? void 0 : x.param), N)
29
+ } : void 0), E = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(O).length > 0 ? { _internal: O } : void 0), Object.keys(V).length > 0 ? { metadata: V } : void 0) }));
30
+ if (vt(this, "ZodObject")) {
31
+ const P = this.extend;
32
+ E.extend = function(...H) {
33
+ var Y, de, Le, De, Ve, ze, Be;
34
+ const Fe = P.apply(this, H);
35
+ return Fe._def.openapi = {
36
36
  _internal: {
37
- extendedFrom: !((de = (H = this._def.openapi) === null || H === void 0 ? void 0 : H._internal) === null || de === void 0) && de.refId ? { refId: (De = (Me = this._def.openapi) === null || Me === void 0 ? void 0 : Me._internal) === null || De === void 0 ? void 0 : De.refId, schema: this } : (Ve = (Le = this._def.openapi) === null || Le === void 0 ? void 0 : Le._internal) === null || Ve === void 0 ? void 0 : Ve.extendedFrom
37
+ extendedFrom: !((de = (Y = this._def.openapi) === null || Y === void 0 ? void 0 : Y._internal) === null || de === void 0) && de.refId ? { refId: (De = (Le = this._def.openapi) === null || Le === void 0 ? void 0 : Le._internal) === null || De === void 0 ? void 0 : De.refId, schema: this } : (ze = (Ve = this._def.openapi) === null || Ve === void 0 ? void 0 : Ve._internal) === null || ze === void 0 ? void 0 : ze.extendedFrom
38
38
  },
39
- metadata: (ze = Be._def.openapi) === null || ze === void 0 ? void 0 : ze.metadata
40
- }, Be;
39
+ metadata: (Be = Fe._def.openapi) === null || Be === void 0 ? void 0 : Be.metadata
40
+ }, Fe;
41
41
  };
42
42
  }
43
- return D;
44
- }, ue(n, "optional"), ue(n, "nullable"), ue(n, "default"), ue(n, "transform"), ue(n, "refine");
45
- const e = n.ZodObject.prototype.deepPartial;
46
- n.ZodObject.prototype.deepPartial = function() {
43
+ return E;
44
+ }, ue(t, "optional"), ue(t, "nullable"), ue(t, "default"), ue(t, "transform"), ue(t, "refine");
45
+ const e = t.ZodObject.prototype.deepPartial;
46
+ t.ZodObject.prototype.deepPartial = function() {
47
47
  const r = this._def.shape(), a = e.apply(this), i = a._def.shape();
48
48
  return Object.entries(i).forEach(([o, c]) => {
49
- var u, p;
50
- c._def.openapi = (p = (u = r[o]) === null || u === void 0 ? void 0 : u._def) === null || p === void 0 ? void 0 : p.openapi;
49
+ var d, h;
50
+ c._def.openapi = (h = (d = r[o]) === null || d === void 0 ? void 0 : d._def) === null || h === void 0 ? void 0 : h.openapi;
51
51
  }), a._def.openapi = void 0, a;
52
52
  };
53
- const t = n.ZodObject.prototype.pick;
54
- n.ZodObject.prototype.pick = function(...r) {
55
- const a = t.apply(this, r);
53
+ const n = t.ZodObject.prototype.pick;
54
+ t.ZodObject.prototype.pick = function(...r) {
55
+ const a = n.apply(this, r);
56
56
  return a._def.openapi = void 0, a;
57
57
  };
58
- const s = n.ZodObject.prototype.omit;
59
- n.ZodObject.prototype.omit = function(...r) {
58
+ const s = t.ZodObject.prototype.omit;
59
+ t.ZodObject.prototype.omit = function(...r) {
60
60
  const a = s.apply(this, r);
61
61
  return a._def.openapi = void 0, a;
62
62
  };
@@ -64,9 +64,19 @@ function mt(n) {
64
64
  var le = class extends Error {
65
65
  res;
66
66
  status;
67
- constructor(n = 500, e) {
68
- super(e?.message, { cause: e?.cause }), this.res = e?.res, this.status = n;
67
+ /**
68
+ * Creates an instance of `HTTPException`.
69
+ * @param status - HTTP status code for the exception. Defaults to 500.
70
+ * @param options - Additional options for the exception.
71
+ */
72
+ constructor(t = 500, e) {
73
+ super(e?.message, { cause: e?.cause }), this.res = e?.res, this.status = t;
69
74
  }
75
+ /**
76
+ * Returns the response object associated with the exception.
77
+ * If a response object is not provided, a new response is created with the error message and status code.
78
+ * @returns The response object.
79
+ */
70
80
  getResponse() {
71
81
  return this.res ? new Response(this.res.body, {
72
82
  status: this.status,
@@ -77,52 +87,52 @@ var le = class extends Error {
77
87
  }
78
88
  };
79
89
  new Set(".\\+*[^]$()");
80
- var x;
81
- (function(n) {
82
- n.assertEqual = (r) => {
90
+ var b;
91
+ (function(t) {
92
+ t.assertEqual = (r) => {
83
93
  };
84
94
  function e(r) {
85
95
  }
86
- n.assertIs = e;
87
- function t(r) {
96
+ t.assertIs = e;
97
+ function n(r) {
88
98
  throw new Error();
89
99
  }
90
- n.assertNever = t, n.arrayToEnum = (r) => {
100
+ t.assertNever = n, t.arrayToEnum = (r) => {
91
101
  const a = {};
92
102
  for (const i of r)
93
103
  a[i] = i;
94
104
  return a;
95
- }, n.getValidEnumValues = (r) => {
96
- const a = n.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
105
+ }, t.getValidEnumValues = (r) => {
106
+ const a = t.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
97
107
  for (const o of a)
98
108
  i[o] = r[o];
99
- return n.objectValues(i);
100
- }, n.objectValues = (r) => n.objectKeys(r).map(function(a) {
109
+ return t.objectValues(i);
110
+ }, t.objectValues = (r) => t.objectKeys(r).map(function(a) {
101
111
  return r[a];
102
- }), n.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
112
+ }), t.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
103
113
  const a = [];
104
114
  for (const i in r)
105
115
  Object.prototype.hasOwnProperty.call(r, i) && a.push(i);
106
116
  return a;
107
- }, n.find = (r, a) => {
117
+ }, t.find = (r, a) => {
108
118
  for (const i of r)
109
119
  if (a(i))
110
120
  return i;
111
- }, n.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
121
+ }, t.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
112
122
  function s(r, a = " | ") {
113
123
  return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
114
124
  }
115
- n.joinValues = s, n.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
116
- })(x || (x = {}));
117
- var qe;
118
- (function(n) {
119
- n.mergeShapes = (e, t) => ({
125
+ t.joinValues = s, t.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
126
+ })(b || (b = {}));
127
+ var We;
128
+ (function(t) {
129
+ t.mergeShapes = (e, n) => ({
120
130
  ...e,
121
- ...t
131
+ ...n
122
132
  // second overwrites first
123
133
  });
124
- })(qe || (qe = {}));
125
- const f = x.arrayToEnum([
134
+ })(We || (We = {}));
135
+ const f = b.arrayToEnum([
126
136
  "string",
127
137
  "nan",
128
138
  "number",
@@ -143,14 +153,14 @@ const f = x.arrayToEnum([
143
153
  "never",
144
154
  "map",
145
155
  "set"
146
- ]), V = (n) => {
147
- switch (typeof n) {
156
+ ]), B = (t) => {
157
+ switch (typeof t) {
148
158
  case "undefined":
149
159
  return f.undefined;
150
160
  case "string":
151
161
  return f.string;
152
162
  case "number":
153
- return Number.isNaN(n) ? f.nan : f.number;
163
+ return Number.isNaN(t) ? f.nan : f.number;
154
164
  case "boolean":
155
165
  return f.boolean;
156
166
  case "function":
@@ -160,11 +170,11 @@ const f = x.arrayToEnum([
160
170
  case "symbol":
161
171
  return f.symbol;
162
172
  case "object":
163
- return Array.isArray(n) ? f.array : n === null ? f.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? f.promise : typeof Map < "u" && n instanceof Map ? f.map : typeof Set < "u" && n instanceof Set ? f.set : typeof Date < "u" && n instanceof Date ? f.date : f.object;
173
+ return Array.isArray(t) ? f.array : t === null ? f.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? f.promise : typeof Map < "u" && t instanceof Map ? f.map : typeof Set < "u" && t instanceof Set ? f.set : typeof Date < "u" && t instanceof Date ? f.date : f.object;
164
174
  default:
165
175
  return f.unknown;
166
176
  }
167
- }, d = x.arrayToEnum([
177
+ }, u = b.arrayToEnum([
168
178
  "invalid_type",
169
179
  "invalid_literal",
170
180
  "custom",
@@ -181,8 +191,8 @@ const f = x.arrayToEnum([
181
191
  "invalid_intersection_types",
182
192
  "not_multiple_of",
183
193
  "not_finite"
184
- ]), yt = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
185
- class O extends Error {
194
+ ]), xt = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
195
+ class A extends Error {
186
196
  get errors() {
187
197
  return this.issues;
188
198
  }
@@ -192,11 +202,11 @@ class O extends Error {
192
202
  }, this.addIssues = (s = []) => {
193
203
  this.issues = [...this.issues, ...s];
194
204
  };
195
- const t = new.target.prototype;
196
- Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
205
+ const n = new.target.prototype;
206
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, n) : this.__proto__ = n, this.name = "ZodError", this.issues = e;
197
207
  }
198
208
  format(e) {
199
- const t = e || function(a) {
209
+ const n = e || function(a) {
200
210
  return a.message;
201
211
  }, s = { _errors: [] }, r = (a) => {
202
212
  for (const i of a.issues)
@@ -207,110 +217,110 @@ class O extends Error {
207
217
  else if (i.code === "invalid_arguments")
208
218
  r(i.argumentsError);
209
219
  else if (i.path.length === 0)
210
- s._errors.push(t(i));
220
+ s._errors.push(n(i));
211
221
  else {
212
222
  let o = s, c = 0;
213
223
  for (; c < i.path.length; ) {
214
- const u = i.path[c];
215
- c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
224
+ const d = i.path[c];
225
+ c === i.path.length - 1 ? (o[d] = o[d] || { _errors: [] }, o[d]._errors.push(n(i))) : o[d] = o[d] || { _errors: [] }, o = o[d], c++;
216
226
  }
217
227
  }
218
228
  };
219
229
  return r(this), s;
220
230
  }
221
231
  static assert(e) {
222
- if (!(e instanceof O))
232
+ if (!(e instanceof A))
223
233
  throw new Error(`Not a ZodError: ${e}`);
224
234
  }
225
235
  toString() {
226
236
  return this.message;
227
237
  }
228
238
  get message() {
229
- return JSON.stringify(this.issues, x.jsonStringifyReplacer, 2);
239
+ return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
230
240
  }
231
241
  get isEmpty() {
232
242
  return this.issues.length === 0;
233
243
  }
234
- flatten(e = (t) => t.message) {
235
- const t = {}, s = [];
244
+ flatten(e = (n) => n.message) {
245
+ const n = {}, s = [];
236
246
  for (const r of this.issues)
237
247
  if (r.path.length > 0) {
238
248
  const a = r.path[0];
239
- t[a] = t[a] || [], t[a].push(e(r));
249
+ n[a] = n[a] || [], n[a].push(e(r));
240
250
  } else
241
251
  s.push(e(r));
242
- return { formErrors: s, fieldErrors: t };
252
+ return { formErrors: s, fieldErrors: n };
243
253
  }
244
254
  get formErrors() {
245
255
  return this.flatten();
246
256
  }
247
257
  }
248
- O.create = (n) => new O(n);
249
- const ae = (n, e) => {
250
- let t;
251
- switch (n.code) {
252
- case d.invalid_type:
253
- n.received === f.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
258
+ A.create = (t) => new A(t);
259
+ const ie = (t, e) => {
260
+ let n;
261
+ switch (t.code) {
262
+ case u.invalid_type:
263
+ t.received === f.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
254
264
  break;
255
- case d.invalid_literal:
256
- t = `Invalid literal value, expected ${JSON.stringify(n.expected, x.jsonStringifyReplacer)}`;
265
+ case u.invalid_literal:
266
+ n = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
257
267
  break;
258
- case d.unrecognized_keys:
259
- t = `Unrecognized key(s) in object: ${x.joinValues(n.keys, ", ")}`;
268
+ case u.unrecognized_keys:
269
+ n = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
260
270
  break;
261
- case d.invalid_union:
262
- t = "Invalid input";
271
+ case u.invalid_union:
272
+ n = "Invalid input";
263
273
  break;
264
- case d.invalid_union_discriminator:
265
- t = `Invalid discriminator value. Expected ${x.joinValues(n.options)}`;
274
+ case u.invalid_union_discriminator:
275
+ n = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
266
276
  break;
267
- case d.invalid_enum_value:
268
- t = `Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;
277
+ case u.invalid_enum_value:
278
+ n = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
269
279
  break;
270
- case d.invalid_arguments:
271
- t = "Invalid function arguments";
280
+ case u.invalid_arguments:
281
+ n = "Invalid function arguments";
272
282
  break;
273
- case d.invalid_return_type:
274
- t = "Invalid function return type";
283
+ case u.invalid_return_type:
284
+ n = "Invalid function return type";
275
285
  break;
276
- case d.invalid_date:
277
- t = "Invalid date";
286
+ case u.invalid_date:
287
+ n = "Invalid date";
278
288
  break;
279
- case d.invalid_string:
280
- typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : x.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
289
+ case u.invalid_string:
290
+ typeof t.validation == "object" ? "includes" in t.validation ? (n = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (n = `${n} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? n = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? n = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? n = `Invalid ${t.validation}` : n = "Invalid";
281
291
  break;
282
- case d.too_small:
283
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "bigint" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
292
+ case u.too_small:
293
+ t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? n = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : n = "Invalid input";
284
294
  break;
285
- case d.too_big:
286
- n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
295
+ case u.too_big:
296
+ t.type === "array" ? n = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? n = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? n = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? n = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? n = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : n = "Invalid input";
287
297
  break;
288
- case d.custom:
289
- t = "Invalid input";
298
+ case u.custom:
299
+ n = "Invalid input";
290
300
  break;
291
- case d.invalid_intersection_types:
292
- t = "Intersection results could not be merged";
301
+ case u.invalid_intersection_types:
302
+ n = "Intersection results could not be merged";
293
303
  break;
294
- case d.not_multiple_of:
295
- t = `Number must be a multiple of ${n.multipleOf}`;
304
+ case u.not_multiple_of:
305
+ n = `Number must be a multiple of ${t.multipleOf}`;
296
306
  break;
297
- case d.not_finite:
298
- t = "Number must be finite";
307
+ case u.not_finite:
308
+ n = "Number must be finite";
299
309
  break;
300
310
  default:
301
- t = e.defaultError, x.assertNever(n);
311
+ n = e.defaultError, b.assertNever(t);
302
312
  }
303
- return { message: t };
313
+ return { message: n };
304
314
  };
305
- let nt = ae;
306
- function _t(n) {
307
- nt = n;
315
+ let rt = ie;
316
+ function kt(t) {
317
+ rt = t;
308
318
  }
309
- function Ae() {
310
- return nt;
319
+ function Ee() {
320
+ return rt;
311
321
  }
312
- const Re = (n) => {
313
- const { data: e, path: t, errorMaps: s, issueData: r } = n, a = [...t, ...r.path || []], i = {
322
+ const Ae = (t) => {
323
+ const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i = {
314
324
  ...r,
315
325
  path: a
316
326
  };
@@ -321,34 +331,34 @@ const Re = (n) => {
321
331
  message: r.message
322
332
  };
323
333
  let o = "";
324
- const c = s.filter((u) => !!u).slice().reverse();
325
- for (const u of c)
326
- o = u(i, { data: e, defaultError: o }).message;
334
+ const c = s.filter((d) => !!d).slice().reverse();
335
+ for (const d of c)
336
+ o = d(i, { data: e, defaultError: o }).message;
327
337
  return {
328
338
  ...r,
329
339
  path: a,
330
340
  message: o
331
341
  };
332
- }, gt = [];
333
- function l(n, e) {
334
- const t = Ae(), s = Re({
342
+ }, wt = [];
343
+ function l(t, e) {
344
+ const n = Ee(), s = Ae({
335
345
  issueData: e,
336
- data: n.data,
337
- path: n.path,
346
+ data: t.data,
347
+ path: t.path,
338
348
  errorMaps: [
339
- n.common.contextualErrorMap,
349
+ t.common.contextualErrorMap,
340
350
  // contextual error map is first priority
341
- n.schemaErrorMap,
351
+ t.schemaErrorMap,
342
352
  // then schema-bound map if available
343
- t,
353
+ n,
344
354
  // then global override map
345
- t === ae ? void 0 : ae
355
+ n === ie ? void 0 : ie
346
356
  // then global default map
347
357
  ].filter((r) => !!r)
348
358
  });
349
- n.common.issues.push(s);
359
+ t.common.issues.push(s);
350
360
  }
351
- class T {
361
+ class S {
352
362
  constructor() {
353
363
  this.value = "valid";
354
364
  }
@@ -358,29 +368,29 @@ class T {
358
368
  abort() {
359
369
  this.value !== "aborted" && (this.value = "aborted");
360
370
  }
361
- static mergeArray(e, t) {
371
+ static mergeArray(e, n) {
362
372
  const s = [];
363
- for (const r of t) {
373
+ for (const r of n) {
364
374
  if (r.status === "aborted")
365
375
  return m;
366
376
  r.status === "dirty" && e.dirty(), s.push(r.value);
367
377
  }
368
378
  return { status: e.value, value: s };
369
379
  }
370
- static async mergeObjectAsync(e, t) {
380
+ static async mergeObjectAsync(e, n) {
371
381
  const s = [];
372
- for (const r of t) {
382
+ for (const r of n) {
373
383
  const a = await r.key, i = await r.value;
374
384
  s.push({
375
385
  key: a,
376
386
  value: i
377
387
  });
378
388
  }
379
- return T.mergeObjectSync(e, s);
389
+ return S.mergeObjectSync(e, s);
380
390
  }
381
- static mergeObjectSync(e, t) {
391
+ static mergeObjectSync(e, n) {
382
392
  const s = {};
383
- for (const r of t) {
393
+ for (const r of n) {
384
394
  const { key: a, value: i } = r;
385
395
  if (a.status === "aborted" || i.status === "aborted")
386
396
  return m;
@@ -391,43 +401,43 @@ class T {
391
401
  }
392
402
  const m = Object.freeze({
393
403
  status: "aborted"
394
- }), se = (n) => ({ status: "dirty", value: n }), S = (n) => ({ status: "valid", value: n }), We = (n) => n.status === "aborted", Je = (n) => n.status === "dirty", G = (n) => n.status === "valid", fe = (n) => typeof Promise < "u" && n instanceof Promise;
395
- var h;
396
- (function(n) {
397
- n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e?.message;
398
- })(h || (h = {}));
399
- class $ {
400
- constructor(e, t, s, r) {
401
- this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
404
+ }), re = (t) => ({ status: "dirty", value: t }), C = (t) => ({ status: "valid", value: t }), Je = (t) => t.status === "aborted", Qe = (t) => t.status === "dirty", K = (t) => t.status === "valid", fe = (t) => typeof Promise < "u" && t instanceof Promise;
405
+ var p;
406
+ (function(t) {
407
+ t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
408
+ })(p || (p = {}));
409
+ class L {
410
+ constructor(e, n, s, r) {
411
+ this._cachedPath = [], this.parent = e, this.data = n, this._path = s, this._key = r;
402
412
  }
403
413
  get path() {
404
414
  return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
405
415
  }
406
416
  }
407
- const Ke = (n, e) => {
408
- if (G(e))
417
+ const tt = (t, e) => {
418
+ if (K(e))
409
419
  return { success: !0, data: e.value };
410
- if (!n.common.issues.length)
420
+ if (!t.common.issues.length)
411
421
  throw new Error("Validation failed but no issues detected.");
412
422
  return {
413
423
  success: !1,
414
424
  get error() {
415
425
  if (this._error)
416
426
  return this._error;
417
- const t = new O(n.common.issues);
418
- return this._error = t, this._error;
427
+ const n = new A(t.common.issues);
428
+ return this._error = n, this._error;
419
429
  }
420
430
  };
421
431
  };
422
- function _(n) {
423
- if (!n)
432
+ function _(t) {
433
+ if (!t)
424
434
  return {};
425
- const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
426
- if (e && (t || s))
435
+ const { errorMap: e, invalid_type_error: n, required_error: s, description: r } = t;
436
+ if (e && (n || s))
427
437
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
428
438
  return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
429
- const { message: c } = n;
430
- return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? t ?? o.defaultError };
439
+ const { message: c } = t;
440
+ return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? s ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? n ?? o.defaultError };
431
441
  }, description: r };
432
442
  }
433
443
  class v {
@@ -435,13 +445,13 @@ class v {
435
445
  return this._def.description;
436
446
  }
437
447
  _getType(e) {
438
- return V(e.data);
448
+ return B(e.data);
439
449
  }
440
- _getOrReturnCtx(e, t) {
441
- return t || {
450
+ _getOrReturnCtx(e, n) {
451
+ return n || {
442
452
  common: e.parent.common,
443
453
  data: e.data,
444
- parsedType: V(e.data),
454
+ parsedType: B(e.data),
445
455
  schemaErrorMap: this._def.errorMap,
446
456
  path: e.path,
447
457
  parent: e.parent
@@ -449,11 +459,11 @@ class v {
449
459
  }
450
460
  _processInputParams(e) {
451
461
  return {
452
- status: new T(),
462
+ status: new S(),
453
463
  ctx: {
454
464
  common: e.parent.common,
455
465
  data: e.data,
456
- parsedType: V(e.data),
466
+ parsedType: B(e.data),
457
467
  schemaErrorMap: this._def.errorMap,
458
468
  path: e.path,
459
469
  parent: e.parent
@@ -461,38 +471,38 @@ class v {
461
471
  };
462
472
  }
463
473
  _parseSync(e) {
464
- const t = this._parse(e);
465
- if (fe(t))
474
+ const n = this._parse(e);
475
+ if (fe(n))
466
476
  throw new Error("Synchronous parse encountered promise.");
467
- return t;
477
+ return n;
468
478
  }
469
479
  _parseAsync(e) {
470
- const t = this._parse(e);
471
- return Promise.resolve(t);
480
+ const n = this._parse(e);
481
+ return Promise.resolve(n);
472
482
  }
473
- parse(e, t) {
474
- const s = this.safeParse(e, t);
483
+ parse(e, n) {
484
+ const s = this.safeParse(e, n);
475
485
  if (s.success)
476
486
  return s.data;
477
487
  throw s.error;
478
488
  }
479
- safeParse(e, t) {
489
+ safeParse(e, n) {
480
490
  const s = {
481
491
  common: {
482
492
  issues: [],
483
- async: t?.async ?? !1,
484
- contextualErrorMap: t?.errorMap
493
+ async: n?.async ?? !1,
494
+ contextualErrorMap: n?.errorMap
485
495
  },
486
- path: t?.path || [],
496
+ path: n?.path || [],
487
497
  schemaErrorMap: this._def.errorMap,
488
498
  parent: null,
489
499
  data: e,
490
- parsedType: V(e)
500
+ parsedType: B(e)
491
501
  }, r = this._parseSync({ data: e, path: s.path, parent: s });
492
- return Ke(s, r);
502
+ return tt(s, r);
493
503
  }
494
504
  "~validate"(e) {
495
- const t = {
505
+ const n = {
496
506
  common: {
497
507
  issues: [],
498
508
  async: !!this["~standard"].async
@@ -501,64 +511,64 @@ class v {
501
511
  schemaErrorMap: this._def.errorMap,
502
512
  parent: null,
503
513
  data: e,
504
- parsedType: V(e)
514
+ parsedType: B(e)
505
515
  };
506
516
  if (!this["~standard"].async)
507
517
  try {
508
- const s = this._parseSync({ data: e, path: [], parent: t });
509
- return G(s) ? {
518
+ const s = this._parseSync({ data: e, path: [], parent: n });
519
+ return K(s) ? {
510
520
  value: s.value
511
521
  } : {
512
- issues: t.common.issues
522
+ issues: n.common.issues
513
523
  };
514
524
  } catch (s) {
515
- s?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), t.common = {
525
+ s?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), n.common = {
516
526
  issues: [],
517
527
  async: !0
518
528
  };
519
529
  }
520
- return this._parseAsync({ data: e, path: [], parent: t }).then((s) => G(s) ? {
530
+ return this._parseAsync({ data: e, path: [], parent: n }).then((s) => K(s) ? {
521
531
  value: s.value
522
532
  } : {
523
- issues: t.common.issues
533
+ issues: n.common.issues
524
534
  });
525
535
  }
526
- async parseAsync(e, t) {
527
- const s = await this.safeParseAsync(e, t);
536
+ async parseAsync(e, n) {
537
+ const s = await this.safeParseAsync(e, n);
528
538
  if (s.success)
529
539
  return s.data;
530
540
  throw s.error;
531
541
  }
532
- async safeParseAsync(e, t) {
542
+ async safeParseAsync(e, n) {
533
543
  const s = {
534
544
  common: {
535
545
  issues: [],
536
- contextualErrorMap: t?.errorMap,
546
+ contextualErrorMap: n?.errorMap,
537
547
  async: !0
538
548
  },
539
- path: t?.path || [],
549
+ path: n?.path || [],
540
550
  schemaErrorMap: this._def.errorMap,
541
551
  parent: null,
542
552
  data: e,
543
- parsedType: V(e)
553
+ parsedType: B(e)
544
554
  }, r = this._parse({ data: e, path: s.path, parent: s }), a = await (fe(r) ? r : Promise.resolve(r));
545
- return Ke(s, a);
555
+ return tt(s, a);
546
556
  }
547
- refine(e, t) {
548
- const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
557
+ refine(e, n) {
558
+ const s = (r) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(r) : n;
549
559
  return this._refinement((r, a) => {
550
560
  const i = e(r), o = () => a.addIssue({
551
- code: d.custom,
561
+ code: u.custom,
552
562
  ...s(r)
553
563
  });
554
564
  return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
555
565
  });
556
566
  }
557
- refinement(e, t) {
558
- return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
567
+ refinement(e, n) {
568
+ return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof n == "function" ? n(s, r) : n), !1));
559
569
  }
560
570
  _refinement(e) {
561
- return new N({
571
+ return new I({
562
572
  schema: this,
563
573
  typeName: y.ZodEffects,
564
574
  effect: { type: "refinement", refinement: e }
@@ -571,23 +581,23 @@ class v {
571
581
  this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
572
582
  version: 1,
573
583
  vendor: "zod",
574
- validate: (t) => this["~validate"](t)
584
+ validate: (n) => this["~validate"](n)
575
585
  };
576
586
  }
577
587
  optional() {
578
- return I.create(this, this._def);
588
+ return M.create(this, this._def);
579
589
  }
580
590
  nullable() {
581
- return W.create(this, this._def);
591
+ return Q.create(this, this._def);
582
592
  }
583
593
  nullish() {
584
594
  return this.nullable().optional();
585
595
  }
586
596
  array() {
587
- return E.create(this);
597
+ return j.create(this);
588
598
  }
589
599
  promise() {
590
- return oe.create(this, this._def);
600
+ return ce.create(this, this._def);
591
601
  }
592
602
  or(e) {
593
603
  return ye.create([this, e], this._def);
@@ -596,7 +606,7 @@ class v {
596
606
  return _e.create(this, e, this._def);
597
607
  }
598
608
  transform(e) {
599
- return new N({
609
+ return new I({
600
610
  ..._(this._def),
601
611
  schema: this,
602
612
  typeName: y.ZodEffects,
@@ -604,33 +614,33 @@ class v {
604
614
  });
605
615
  }
606
616
  default(e) {
607
- const t = typeof e == "function" ? e : () => e;
617
+ const n = typeof e == "function" ? e : () => e;
608
618
  return new ke({
609
619
  ..._(this._def),
610
620
  innerType: this,
611
- defaultValue: t,
621
+ defaultValue: n,
612
622
  typeName: y.ZodDefault
613
623
  });
614
624
  }
615
625
  brand() {
616
- return new Ye({
626
+ return new Xe({
617
627
  typeName: y.ZodBranded,
618
628
  type: this,
619
629
  ..._(this._def)
620
630
  });
621
631
  }
622
632
  catch(e) {
623
- const t = typeof e == "function" ? e : () => e;
633
+ const n = typeof e == "function" ? e : () => e;
624
634
  return new we({
625
635
  ..._(this._def),
626
636
  innerType: this,
627
- catchValue: t,
637
+ catchValue: n,
628
638
  typeName: y.ZodCatch
629
639
  });
630
640
  }
631
641
  describe(e) {
632
- const t = this.constructor;
633
- return new t({
642
+ const n = this.constructor;
643
+ return new n({
634
644
  ...this._def,
635
645
  description: e
636
646
  });
@@ -648,58 +658,58 @@ class v {
648
658
  return this.safeParse(null).success;
649
659
  }
650
660
  }
651
- const vt = /^c[^\s-]{8,}$/i, xt = /^[0-9a-z]+$/, bt = /^[0-9A-HJKMNP-TV-Z]{26}$/i, kt = /^[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, wt = /^[a-z0-9_-]{21}$/i, Tt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, St = /^[-+]?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)?)??$/, Ct = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ot = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
652
- let Ue;
653
- const At = /^(?:(?: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])$/, Rt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Et = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Nt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, jt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Zt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, st = "((\\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])))", It = new RegExp(`^${st}$`);
654
- function rt(n) {
661
+ const Tt = /^c[^\s-]{8,}$/i, St = /^[0-9a-z]+$/, Ct = /^[0-9A-HJKMNP-TV-Z]{26}$/i, Ot = /^[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, Et = /^[a-z0-9_-]{21}$/i, At = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Rt = /^[-+]?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)?)??$/, Nt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, $t = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
662
+ let qe;
663
+ const jt = /^(?:(?: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])$/, It = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Zt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Pt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Mt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Lt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, at = "((\\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])))", Dt = new RegExp(`^${at}$`);
664
+ function it(t) {
655
665
  let e = "[0-5]\\d";
656
- n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
657
- const t = n.precision ? "+" : "?";
658
- return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
666
+ t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
667
+ const n = t.precision ? "+" : "?";
668
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`;
659
669
  }
660
- function $t(n) {
661
- return new RegExp(`^${rt(n)}$`);
670
+ function Vt(t) {
671
+ return new RegExp(`^${it(t)}$`);
662
672
  }
663
- function at(n) {
664
- let e = `${st}T${rt(n)}`;
665
- const t = [];
666
- return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
673
+ function ot(t) {
674
+ let e = `${at}T${it(t)}`;
675
+ const n = [];
676
+ return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
667
677
  }
668
- function Pt(n, e) {
669
- return !!((e === "v4" || !e) && At.test(n) || (e === "v6" || !e) && Et.test(n));
678
+ function zt(t, e) {
679
+ return !!((e === "v4" || !e) && jt.test(t) || (e === "v6" || !e) && Zt.test(t));
670
680
  }
671
- function Mt(n, e) {
672
- if (!Tt.test(n))
681
+ function Bt(t, e) {
682
+ if (!At.test(t))
673
683
  return !1;
674
684
  try {
675
- const [t] = n.split(".");
676
- if (!t)
685
+ const [n] = t.split(".");
686
+ if (!n)
677
687
  return !1;
678
- const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
688
+ const s = n.replace(/-/g, "+").replace(/_/g, "/").padEnd(n.length + (4 - n.length % 4) % 4, "="), r = JSON.parse(atob(s));
679
689
  return !(typeof r != "object" || r === null || "typ" in r && r?.typ !== "JWT" || !r.alg || e && r.alg !== e);
680
690
  } catch {
681
691
  return !1;
682
692
  }
683
693
  }
684
- function Dt(n, e) {
685
- return !!((e === "v4" || !e) && Rt.test(n) || (e === "v6" || !e) && Nt.test(n));
694
+ function Ft(t, e) {
695
+ return !!((e === "v4" || !e) && It.test(t) || (e === "v6" || !e) && Pt.test(t));
686
696
  }
687
- class R extends v {
697
+ class $ extends v {
688
698
  _parse(e) {
689
699
  if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== f.string) {
690
700
  const a = this._getOrReturnCtx(e);
691
701
  return l(a, {
692
- code: d.invalid_type,
702
+ code: u.invalid_type,
693
703
  expected: f.string,
694
704
  received: a.parsedType
695
705
  }), m;
696
706
  }
697
- const s = new T();
707
+ const s = new S();
698
708
  let r;
699
709
  for (const a of this._def.checks)
700
710
  if (a.kind === "min")
701
711
  e.data.length < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
702
- code: d.too_small,
712
+ code: u.too_small,
703
713
  minimum: a.value,
704
714
  type: "string",
705
715
  inclusive: !0,
@@ -708,7 +718,7 @@ class R extends v {
708
718
  }), s.dirty());
709
719
  else if (a.kind === "max")
710
720
  e.data.length > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
711
- code: d.too_big,
721
+ code: u.too_big,
712
722
  maximum: a.value,
713
723
  type: "string",
714
724
  inclusive: !0,
@@ -718,14 +728,14 @@ class R extends v {
718
728
  else if (a.kind === "length") {
719
729
  const i = e.data.length > a.value, o = e.data.length < a.value;
720
730
  (i || o) && (r = this._getOrReturnCtx(e, r), i ? l(r, {
721
- code: d.too_big,
731
+ code: u.too_big,
722
732
  maximum: a.value,
723
733
  type: "string",
724
734
  inclusive: !0,
725
735
  exact: !0,
726
736
  message: a.message
727
737
  }) : o && l(r, {
728
- code: d.too_small,
738
+ code: u.too_small,
729
739
  minimum: a.value,
730
740
  type: "string",
731
741
  inclusive: !0,
@@ -733,45 +743,45 @@ class R extends v {
733
743
  message: a.message
734
744
  }), s.dirty());
735
745
  } else if (a.kind === "email")
736
- Ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
746
+ Nt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
737
747
  validation: "email",
738
- code: d.invalid_string,
748
+ code: u.invalid_string,
739
749
  message: a.message
740
750
  }), s.dirty());
741
751
  else if (a.kind === "emoji")
742
- Ue || (Ue = new RegExp(Ot, "u")), Ue.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
752
+ qe || (qe = new RegExp($t, "u")), qe.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
743
753
  validation: "emoji",
744
- code: d.invalid_string,
754
+ code: u.invalid_string,
745
755
  message: a.message
746
756
  }), s.dirty());
747
757
  else if (a.kind === "uuid")
748
- kt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
758
+ Ot.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
749
759
  validation: "uuid",
750
- code: d.invalid_string,
760
+ code: u.invalid_string,
751
761
  message: a.message
752
762
  }), s.dirty());
753
763
  else if (a.kind === "nanoid")
754
- wt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
764
+ Et.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
755
765
  validation: "nanoid",
756
- code: d.invalid_string,
766
+ code: u.invalid_string,
757
767
  message: a.message
758
768
  }), s.dirty());
759
769
  else if (a.kind === "cuid")
760
- vt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
770
+ Tt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
761
771
  validation: "cuid",
762
- code: d.invalid_string,
772
+ code: u.invalid_string,
763
773
  message: a.message
764
774
  }), s.dirty());
765
775
  else if (a.kind === "cuid2")
766
- xt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
776
+ St.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
767
777
  validation: "cuid2",
768
- code: d.invalid_string,
778
+ code: u.invalid_string,
769
779
  message: a.message
770
780
  }), s.dirty());
771
781
  else if (a.kind === "ulid")
772
- bt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
782
+ Ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
773
783
  validation: "ulid",
774
- code: d.invalid_string,
784
+ code: u.invalid_string,
775
785
  message: a.message
776
786
  }), s.dirty());
777
787
  else if (a.kind === "url")
@@ -780,119 +790,119 @@ class R extends v {
780
790
  } catch {
781
791
  r = this._getOrReturnCtx(e, r), l(r, {
782
792
  validation: "url",
783
- code: d.invalid_string,
793
+ code: u.invalid_string,
784
794
  message: a.message
785
795
  }), s.dirty();
786
796
  }
787
797
  else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
788
798
  validation: "regex",
789
- code: d.invalid_string,
799
+ code: u.invalid_string,
790
800
  message: a.message
791
801
  }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), l(r, {
792
- code: d.invalid_string,
802
+ code: u.invalid_string,
793
803
  validation: { includes: a.value, position: a.position },
794
804
  message: a.message
795
805
  }), 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) || (r = this._getOrReturnCtx(e, r), l(r, {
796
- code: d.invalid_string,
806
+ code: u.invalid_string,
797
807
  validation: { startsWith: a.value },
798
808
  message: a.message
799
809
  }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
800
- code: d.invalid_string,
810
+ code: u.invalid_string,
801
811
  validation: { endsWith: a.value },
802
812
  message: a.message
803
- }), s.dirty()) : a.kind === "datetime" ? at(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
804
- code: d.invalid_string,
813
+ }), s.dirty()) : a.kind === "datetime" ? ot(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
814
+ code: u.invalid_string,
805
815
  validation: "datetime",
806
816
  message: a.message
807
- }), s.dirty()) : a.kind === "date" ? It.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
808
- code: d.invalid_string,
817
+ }), s.dirty()) : a.kind === "date" ? Dt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
818
+ code: u.invalid_string,
809
819
  validation: "date",
810
820
  message: a.message
811
- }), s.dirty()) : a.kind === "time" ? $t(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
812
- code: d.invalid_string,
821
+ }), s.dirty()) : a.kind === "time" ? Vt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
822
+ code: u.invalid_string,
813
823
  validation: "time",
814
824
  message: a.message
815
- }), s.dirty()) : a.kind === "duration" ? St.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
825
+ }), s.dirty()) : a.kind === "duration" ? Rt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
816
826
  validation: "duration",
817
- code: d.invalid_string,
827
+ code: u.invalid_string,
818
828
  message: a.message
819
- }), s.dirty()) : a.kind === "ip" ? Pt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
829
+ }), s.dirty()) : a.kind === "ip" ? zt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
820
830
  validation: "ip",
821
- code: d.invalid_string,
831
+ code: u.invalid_string,
822
832
  message: a.message
823
- }), s.dirty()) : a.kind === "jwt" ? Mt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), l(r, {
833
+ }), s.dirty()) : a.kind === "jwt" ? Bt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), l(r, {
824
834
  validation: "jwt",
825
- code: d.invalid_string,
835
+ code: u.invalid_string,
826
836
  message: a.message
827
- }), s.dirty()) : a.kind === "cidr" ? Dt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
837
+ }), s.dirty()) : a.kind === "cidr" ? Ft(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
828
838
  validation: "cidr",
829
- code: d.invalid_string,
839
+ code: u.invalid_string,
830
840
  message: a.message
831
- }), s.dirty()) : a.kind === "base64" ? jt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
841
+ }), s.dirty()) : a.kind === "base64" ? Mt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
832
842
  validation: "base64",
833
- code: d.invalid_string,
843
+ code: u.invalid_string,
834
844
  message: a.message
835
- }), s.dirty()) : a.kind === "base64url" ? Zt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
845
+ }), s.dirty()) : a.kind === "base64url" ? Lt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
836
846
  validation: "base64url",
837
- code: d.invalid_string,
847
+ code: u.invalid_string,
838
848
  message: a.message
839
- }), s.dirty()) : x.assertNever(a);
849
+ }), s.dirty()) : b.assertNever(a);
840
850
  return { status: s.value, value: e.data };
841
851
  }
842
- _regex(e, t, s) {
852
+ _regex(e, n, s) {
843
853
  return this.refinement((r) => e.test(r), {
844
- validation: t,
845
- code: d.invalid_string,
846
- ...h.errToObj(s)
854
+ validation: n,
855
+ code: u.invalid_string,
856
+ ...p.errToObj(s)
847
857
  });
848
858
  }
849
859
  _addCheck(e) {
850
- return new R({
860
+ return new $({
851
861
  ...this._def,
852
862
  checks: [...this._def.checks, e]
853
863
  });
854
864
  }
855
865
  email(e) {
856
- return this._addCheck({ kind: "email", ...h.errToObj(e) });
866
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
857
867
  }
858
868
  url(e) {
859
- return this._addCheck({ kind: "url", ...h.errToObj(e) });
869
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
860
870
  }
861
871
  emoji(e) {
862
- return this._addCheck({ kind: "emoji", ...h.errToObj(e) });
872
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
863
873
  }
864
874
  uuid(e) {
865
- return this._addCheck({ kind: "uuid", ...h.errToObj(e) });
875
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
866
876
  }
867
877
  nanoid(e) {
868
- return this._addCheck({ kind: "nanoid", ...h.errToObj(e) });
878
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
869
879
  }
870
880
  cuid(e) {
871
- return this._addCheck({ kind: "cuid", ...h.errToObj(e) });
881
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
872
882
  }
873
883
  cuid2(e) {
874
- return this._addCheck({ kind: "cuid2", ...h.errToObj(e) });
884
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
875
885
  }
876
886
  ulid(e) {
877
- return this._addCheck({ kind: "ulid", ...h.errToObj(e) });
887
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
878
888
  }
879
889
  base64(e) {
880
- return this._addCheck({ kind: "base64", ...h.errToObj(e) });
890
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
881
891
  }
882
892
  base64url(e) {
883
893
  return this._addCheck({
884
894
  kind: "base64url",
885
- ...h.errToObj(e)
895
+ ...p.errToObj(e)
886
896
  });
887
897
  }
888
898
  jwt(e) {
889
- return this._addCheck({ kind: "jwt", ...h.errToObj(e) });
899
+ return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
890
900
  }
891
901
  ip(e) {
892
- return this._addCheck({ kind: "ip", ...h.errToObj(e) });
902
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
893
903
  }
894
904
  cidr(e) {
895
- return this._addCheck({ kind: "cidr", ...h.errToObj(e) });
905
+ return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
896
906
  }
897
907
  datetime(e) {
898
908
  return typeof e == "string" ? this._addCheck({
@@ -906,7 +916,7 @@ class R extends v {
906
916
  precision: typeof e?.precision > "u" ? null : e?.precision,
907
917
  offset: e?.offset ?? !1,
908
918
  local: e?.local ?? !1,
909
- ...h.errToObj(e?.message)
919
+ ...p.errToObj(e?.message)
910
920
  });
911
921
  }
912
922
  date(e) {
@@ -920,82 +930,82 @@ class R extends v {
920
930
  }) : this._addCheck({
921
931
  kind: "time",
922
932
  precision: typeof e?.precision > "u" ? null : e?.precision,
923
- ...h.errToObj(e?.message)
933
+ ...p.errToObj(e?.message)
924
934
  });
925
935
  }
926
936
  duration(e) {
927
- return this._addCheck({ kind: "duration", ...h.errToObj(e) });
937
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
928
938
  }
929
- regex(e, t) {
939
+ regex(e, n) {
930
940
  return this._addCheck({
931
941
  kind: "regex",
932
942
  regex: e,
933
- ...h.errToObj(t)
943
+ ...p.errToObj(n)
934
944
  });
935
945
  }
936
- includes(e, t) {
946
+ includes(e, n) {
937
947
  return this._addCheck({
938
948
  kind: "includes",
939
949
  value: e,
940
- position: t?.position,
941
- ...h.errToObj(t?.message)
950
+ position: n?.position,
951
+ ...p.errToObj(n?.message)
942
952
  });
943
953
  }
944
- startsWith(e, t) {
954
+ startsWith(e, n) {
945
955
  return this._addCheck({
946
956
  kind: "startsWith",
947
957
  value: e,
948
- ...h.errToObj(t)
958
+ ...p.errToObj(n)
949
959
  });
950
960
  }
951
- endsWith(e, t) {
961
+ endsWith(e, n) {
952
962
  return this._addCheck({
953
963
  kind: "endsWith",
954
964
  value: e,
955
- ...h.errToObj(t)
965
+ ...p.errToObj(n)
956
966
  });
957
967
  }
958
- min(e, t) {
968
+ min(e, n) {
959
969
  return this._addCheck({
960
970
  kind: "min",
961
971
  value: e,
962
- ...h.errToObj(t)
972
+ ...p.errToObj(n)
963
973
  });
964
974
  }
965
- max(e, t) {
975
+ max(e, n) {
966
976
  return this._addCheck({
967
977
  kind: "max",
968
978
  value: e,
969
- ...h.errToObj(t)
979
+ ...p.errToObj(n)
970
980
  });
971
981
  }
972
- length(e, t) {
982
+ length(e, n) {
973
983
  return this._addCheck({
974
984
  kind: "length",
975
985
  value: e,
976
- ...h.errToObj(t)
986
+ ...p.errToObj(n)
977
987
  });
978
988
  }
979
989
  /**
980
990
  * Equivalent to `.min(1)`
981
991
  */
982
992
  nonempty(e) {
983
- return this.min(1, h.errToObj(e));
993
+ return this.min(1, p.errToObj(e));
984
994
  }
985
995
  trim() {
986
- return new R({
996
+ return new $({
987
997
  ...this._def,
988
998
  checks: [...this._def.checks, { kind: "trim" }]
989
999
  });
990
1000
  }
991
1001
  toLowerCase() {
992
- return new R({
1002
+ return new $({
993
1003
  ...this._def,
994
1004
  checks: [...this._def.checks, { kind: "toLowerCase" }]
995
1005
  });
996
1006
  }
997
1007
  toUpperCase() {
998
- return new R({
1008
+ return new $({
999
1009
  ...this._def,
1000
1010
  checks: [...this._def.checks, { kind: "toUpperCase" }]
1001
1011
  });
@@ -1050,25 +1060,25 @@ class R extends v {
1050
1060
  }
1051
1061
  get minLength() {
1052
1062
  let e = null;
1053
- for (const t of this._def.checks)
1054
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1063
+ for (const n of this._def.checks)
1064
+ n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1055
1065
  return e;
1056
1066
  }
1057
1067
  get maxLength() {
1058
1068
  let e = null;
1059
- for (const t of this._def.checks)
1060
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1069
+ for (const n of this._def.checks)
1070
+ n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1061
1071
  return e;
1062
1072
  }
1063
1073
  }
1064
- R.create = (n) => new R({
1074
+ $.create = (t) => new $({
1065
1075
  checks: [],
1066
1076
  typeName: y.ZodString,
1067
- coerce: n?.coerce ?? !1,
1068
- ..._(n)
1077
+ coerce: t?.coerce ?? !1,
1078
+ ..._(t)
1069
1079
  });
1070
- function Lt(n, e) {
1071
- const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = Number.parseInt(n.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
1080
+ function qt(t, e) {
1081
+ const n = (t.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = n > s ? n : s, a = Number.parseInt(t.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
1072
1082
  return a % i / 10 ** r;
1073
1083
  }
1074
1084
  class U extends v {
@@ -1079,65 +1089,65 @@ class U extends v {
1079
1089
  if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== f.number) {
1080
1090
  const a = this._getOrReturnCtx(e);
1081
1091
  return l(a, {
1082
- code: d.invalid_type,
1092
+ code: u.invalid_type,
1083
1093
  expected: f.number,
1084
1094
  received: a.parsedType
1085
1095
  }), m;
1086
1096
  }
1087
1097
  let s;
1088
- const r = new T();
1098
+ const r = new S();
1089
1099
  for (const a of this._def.checks)
1090
- a.kind === "int" ? x.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1091
- code: d.invalid_type,
1100
+ a.kind === "int" ? b.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1101
+ code: u.invalid_type,
1092
1102
  expected: "integer",
1093
1103
  received: "float",
1094
1104
  message: a.message
1095
1105
  }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1096
- code: d.too_small,
1106
+ code: u.too_small,
1097
1107
  minimum: a.value,
1098
1108
  type: "number",
1099
1109
  inclusive: a.inclusive,
1100
1110
  exact: !1,
1101
1111
  message: a.message
1102
1112
  }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1103
- code: d.too_big,
1113
+ code: u.too_big,
1104
1114
  maximum: a.value,
1105
1115
  type: "number",
1106
1116
  inclusive: a.inclusive,
1107
1117
  exact: !1,
1108
1118
  message: a.message
1109
- }), r.dirty()) : a.kind === "multipleOf" ? Lt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
1110
- code: d.not_multiple_of,
1119
+ }), r.dirty()) : a.kind === "multipleOf" ? qt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
1120
+ code: u.not_multiple_of,
1111
1121
  multipleOf: a.value,
1112
1122
  message: a.message
1113
1123
  }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1114
- code: d.not_finite,
1124
+ code: u.not_finite,
1115
1125
  message: a.message
1116
- }), r.dirty()) : x.assertNever(a);
1126
+ }), r.dirty()) : b.assertNever(a);
1117
1127
  return { status: r.value, value: e.data };
1118
1128
  }
1119
- gte(e, t) {
1120
- return this.setLimit("min", e, !0, h.toString(t));
1129
+ gte(e, n) {
1130
+ return this.setLimit("min", e, !0, p.toString(n));
1121
1131
  }
1122
- gt(e, t) {
1123
- return this.setLimit("min", e, !1, h.toString(t));
1132
+ gt(e, n) {
1133
+ return this.setLimit("min", e, !1, p.toString(n));
1124
1134
  }
1125
- lte(e, t) {
1126
- return this.setLimit("max", e, !0, h.toString(t));
1135
+ lte(e, n) {
1136
+ return this.setLimit("max", e, !0, p.toString(n));
1127
1137
  }
1128
- lt(e, t) {
1129
- return this.setLimit("max", e, !1, h.toString(t));
1138
+ lt(e, n) {
1139
+ return this.setLimit("max", e, !1, p.toString(n));
1130
1140
  }
1131
- setLimit(e, t, s, r) {
1141
+ setLimit(e, n, s, r) {
1132
1142
  return new U({
1133
1143
  ...this._def,
1134
1144
  checks: [
1135
1145
  ...this._def.checks,
1136
1146
  {
1137
1147
  kind: e,
1138
- value: t,
1148
+ value: n,
1139
1149
  inclusive: s,
1140
- message: h.toString(r)
1150
+ message: p.toString(r)
1141
1151
  }
1142
1152
  ]
1143
1153
  });
@@ -1151,7 +1161,7 @@ class U extends v {
1151
1161
  int(e) {
1152
1162
  return this._addCheck({
1153
1163
  kind: "int",
1154
- message: h.toString(e)
1164
+ message: p.toString(e)
1155
1165
  });
1156
1166
  }
1157
1167
  positive(e) {
@@ -1159,7 +1169,7 @@ class U extends v {
1159
1169
  kind: "min",
1160
1170
  value: 0,
1161
1171
  inclusive: !1,
1162
- message: h.toString(e)
1172
+ message: p.toString(e)
1163
1173
  });
1164
1174
  }
1165
1175
  negative(e) {
@@ -1167,7 +1177,7 @@ class U extends v {
1167
1177
  kind: "max",
1168
1178
  value: 0,
1169
1179
  inclusive: !1,
1170
- message: h.toString(e)
1180
+ message: p.toString(e)
1171
1181
  });
1172
1182
  }
1173
1183
  nonpositive(e) {
@@ -1175,7 +1185,7 @@ class U extends v {
1175
1185
  kind: "max",
1176
1186
  value: 0,
1177
1187
  inclusive: !0,
1178
- message: h.toString(e)
1188
+ message: p.toString(e)
1179
1189
  });
1180
1190
  }
1181
1191
  nonnegative(e) {
@@ -1183,20 +1193,20 @@ class U extends v {
1183
1193
  kind: "min",
1184
1194
  value: 0,
1185
1195
  inclusive: !0,
1186
- message: h.toString(e)
1196
+ message: p.toString(e)
1187
1197
  });
1188
1198
  }
1189
- multipleOf(e, t) {
1199
+ multipleOf(e, n) {
1190
1200
  return this._addCheck({
1191
1201
  kind: "multipleOf",
1192
1202
  value: e,
1193
- message: h.toString(t)
1203
+ message: p.toString(n)
1194
1204
  });
1195
1205
  }
1196
1206
  finite(e) {
1197
1207
  return this._addCheck({
1198
1208
  kind: "finite",
1199
- message: h.toString(e)
1209
+ message: p.toString(e)
1200
1210
  });
1201
1211
  }
1202
1212
  safe(e) {
@@ -1204,46 +1214,46 @@ class U extends v {
1204
1214
  kind: "min",
1205
1215
  inclusive: !0,
1206
1216
  value: Number.MIN_SAFE_INTEGER,
1207
- message: h.toString(e)
1217
+ message: p.toString(e)
1208
1218
  })._addCheck({
1209
1219
  kind: "max",
1210
1220
  inclusive: !0,
1211
1221
  value: Number.MAX_SAFE_INTEGER,
1212
- message: h.toString(e)
1222
+ message: p.toString(e)
1213
1223
  });
1214
1224
  }
1215
1225
  get minValue() {
1216
1226
  let e = null;
1217
- for (const t of this._def.checks)
1218
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1227
+ for (const n of this._def.checks)
1228
+ n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1219
1229
  return e;
1220
1230
  }
1221
1231
  get maxValue() {
1222
1232
  let e = null;
1223
- for (const t of this._def.checks)
1224
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1233
+ for (const n of this._def.checks)
1234
+ n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1225
1235
  return e;
1226
1236
  }
1227
1237
  get isInt() {
1228
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && x.isInteger(e.value));
1238
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1229
1239
  }
1230
1240
  get isFinite() {
1231
- let e = null, t = null;
1241
+ let e = null, n = null;
1232
1242
  for (const s of this._def.checks) {
1233
1243
  if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1234
1244
  return !0;
1235
- s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1245
+ s.kind === "min" ? (n === null || s.value > n) && (n = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1236
1246
  }
1237
- return Number.isFinite(t) && Number.isFinite(e);
1247
+ return Number.isFinite(n) && Number.isFinite(e);
1238
1248
  }
1239
1249
  }
1240
- U.create = (n) => new U({
1250
+ U.create = (t) => new U({
1241
1251
  checks: [],
1242
1252
  typeName: y.ZodNumber,
1243
- coerce: n?.coerce || !1,
1244
- ..._(n)
1253
+ coerce: t?.coerce || !1,
1254
+ ..._(t)
1245
1255
  });
1246
- class F extends v {
1256
+ class W extends v {
1247
1257
  constructor() {
1248
1258
  super(...arguments), this.min = this.gte, this.max = this.lte;
1249
1259
  }
@@ -1257,63 +1267,63 @@ class F extends v {
1257
1267
  if (this._getType(e) !== f.bigint)
1258
1268
  return this._getInvalidInput(e);
1259
1269
  let s;
1260
- const r = new T();
1270
+ const r = new S();
1261
1271
  for (const a of this._def.checks)
1262
1272
  a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1263
- code: d.too_small,
1273
+ code: u.too_small,
1264
1274
  type: "bigint",
1265
1275
  minimum: a.value,
1266
1276
  inclusive: a.inclusive,
1267
1277
  message: a.message
1268
1278
  }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1269
- code: d.too_big,
1279
+ code: u.too_big,
1270
1280
  type: "bigint",
1271
1281
  maximum: a.value,
1272
1282
  inclusive: a.inclusive,
1273
1283
  message: a.message
1274
1284
  }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
1275
- code: d.not_multiple_of,
1285
+ code: u.not_multiple_of,
1276
1286
  multipleOf: a.value,
1277
1287
  message: a.message
1278
- }), r.dirty()) : x.assertNever(a);
1288
+ }), r.dirty()) : b.assertNever(a);
1279
1289
  return { status: r.value, value: e.data };
1280
1290
  }
1281
1291
  _getInvalidInput(e) {
1282
- const t = this._getOrReturnCtx(e);
1283
- return l(t, {
1284
- code: d.invalid_type,
1292
+ const n = this._getOrReturnCtx(e);
1293
+ return l(n, {
1294
+ code: u.invalid_type,
1285
1295
  expected: f.bigint,
1286
- received: t.parsedType
1296
+ received: n.parsedType
1287
1297
  }), m;
1288
1298
  }
1289
- gte(e, t) {
1290
- return this.setLimit("min", e, !0, h.toString(t));
1299
+ gte(e, n) {
1300
+ return this.setLimit("min", e, !0, p.toString(n));
1291
1301
  }
1292
- gt(e, t) {
1293
- return this.setLimit("min", e, !1, h.toString(t));
1302
+ gt(e, n) {
1303
+ return this.setLimit("min", e, !1, p.toString(n));
1294
1304
  }
1295
- lte(e, t) {
1296
- return this.setLimit("max", e, !0, h.toString(t));
1305
+ lte(e, n) {
1306
+ return this.setLimit("max", e, !0, p.toString(n));
1297
1307
  }
1298
- lt(e, t) {
1299
- return this.setLimit("max", e, !1, h.toString(t));
1308
+ lt(e, n) {
1309
+ return this.setLimit("max", e, !1, p.toString(n));
1300
1310
  }
1301
- setLimit(e, t, s, r) {
1302
- return new F({
1311
+ setLimit(e, n, s, r) {
1312
+ return new W({
1303
1313
  ...this._def,
1304
1314
  checks: [
1305
1315
  ...this._def.checks,
1306
1316
  {
1307
1317
  kind: e,
1308
- value: t,
1318
+ value: n,
1309
1319
  inclusive: s,
1310
- message: h.toString(r)
1320
+ message: p.toString(r)
1311
1321
  }
1312
1322
  ]
1313
1323
  });
1314
1324
  }
1315
1325
  _addCheck(e) {
1316
- return new F({
1326
+ return new W({
1317
1327
  ...this._def,
1318
1328
  checks: [...this._def.checks, e]
1319
1329
  });
@@ -1323,7 +1333,7 @@ class F extends v {
1323
1333
  kind: "min",
1324
1334
  value: BigInt(0),
1325
1335
  inclusive: !1,
1326
- message: h.toString(e)
1336
+ message: p.toString(e)
1327
1337
  });
1328
1338
  }
1329
1339
  negative(e) {
@@ -1331,7 +1341,7 @@ class F extends v {
1331
1341
  kind: "max",
1332
1342
  value: BigInt(0),
1333
1343
  inclusive: !1,
1334
- message: h.toString(e)
1344
+ message: p.toString(e)
1335
1345
  });
1336
1346
  }
1337
1347
  nonpositive(e) {
@@ -1339,7 +1349,7 @@ class F extends v {
1339
1349
  kind: "max",
1340
1350
  value: BigInt(0),
1341
1351
  inclusive: !0,
1342
- message: h.toString(e)
1352
+ message: p.toString(e)
1343
1353
  });
1344
1354
  }
1345
1355
  nonnegative(e) {
@@ -1347,59 +1357,59 @@ class F extends v {
1347
1357
  kind: "min",
1348
1358
  value: BigInt(0),
1349
1359
  inclusive: !0,
1350
- message: h.toString(e)
1360
+ message: p.toString(e)
1351
1361
  });
1352
1362
  }
1353
- multipleOf(e, t) {
1363
+ multipleOf(e, n) {
1354
1364
  return this._addCheck({
1355
1365
  kind: "multipleOf",
1356
1366
  value: e,
1357
- message: h.toString(t)
1367
+ message: p.toString(n)
1358
1368
  });
1359
1369
  }
1360
1370
  get minValue() {
1361
1371
  let e = null;
1362
- for (const t of this._def.checks)
1363
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1372
+ for (const n of this._def.checks)
1373
+ n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1364
1374
  return e;
1365
1375
  }
1366
1376
  get maxValue() {
1367
1377
  let e = null;
1368
- for (const t of this._def.checks)
1369
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1378
+ for (const n of this._def.checks)
1379
+ n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1370
1380
  return e;
1371
1381
  }
1372
1382
  }
1373
- F.create = (n) => new F({
1383
+ W.create = (t) => new W({
1374
1384
  checks: [],
1375
1385
  typeName: y.ZodBigInt,
1376
- coerce: n?.coerce ?? !1,
1377
- ..._(n)
1386
+ coerce: t?.coerce ?? !1,
1387
+ ..._(t)
1378
1388
  });
1379
1389
  class he extends v {
1380
1390
  _parse(e) {
1381
1391
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== f.boolean) {
1382
1392
  const s = this._getOrReturnCtx(e);
1383
1393
  return l(s, {
1384
- code: d.invalid_type,
1394
+ code: u.invalid_type,
1385
1395
  expected: f.boolean,
1386
1396
  received: s.parsedType
1387
1397
  }), m;
1388
1398
  }
1389
- return S(e.data);
1399
+ return C(e.data);
1390
1400
  }
1391
1401
  }
1392
- he.create = (n) => new he({
1402
+ he.create = (t) => new he({
1393
1403
  typeName: y.ZodBoolean,
1394
- coerce: n?.coerce || !1,
1395
- ..._(n)
1404
+ coerce: t?.coerce || !1,
1405
+ ..._(t)
1396
1406
  });
1397
- class K extends v {
1407
+ class X extends v {
1398
1408
  _parse(e) {
1399
1409
  if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== f.date) {
1400
1410
  const a = this._getOrReturnCtx(e);
1401
1411
  return l(a, {
1402
- code: d.invalid_type,
1412
+ code: u.invalid_type,
1403
1413
  expected: f.date,
1404
1414
  received: a.parsedType
1405
1415
  }), m;
@@ -1407,190 +1417,190 @@ class K extends v {
1407
1417
  if (Number.isNaN(e.data.getTime())) {
1408
1418
  const a = this._getOrReturnCtx(e);
1409
1419
  return l(a, {
1410
- code: d.invalid_date
1420
+ code: u.invalid_date
1411
1421
  }), m;
1412
1422
  }
1413
- const s = new T();
1423
+ const s = new S();
1414
1424
  let r;
1415
1425
  for (const a of this._def.checks)
1416
1426
  a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1417
- code: d.too_small,
1427
+ code: u.too_small,
1418
1428
  message: a.message,
1419
1429
  inclusive: !0,
1420
1430
  exact: !1,
1421
1431
  minimum: a.value,
1422
1432
  type: "date"
1423
1433
  }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1424
- code: d.too_big,
1434
+ code: u.too_big,
1425
1435
  message: a.message,
1426
1436
  inclusive: !0,
1427
1437
  exact: !1,
1428
1438
  maximum: a.value,
1429
1439
  type: "date"
1430
- }), s.dirty()) : x.assertNever(a);
1440
+ }), s.dirty()) : b.assertNever(a);
1431
1441
  return {
1432
1442
  status: s.value,
1433
1443
  value: new Date(e.data.getTime())
1434
1444
  };
1435
1445
  }
1436
1446
  _addCheck(e) {
1437
- return new K({
1447
+ return new X({
1438
1448
  ...this._def,
1439
1449
  checks: [...this._def.checks, e]
1440
1450
  });
1441
1451
  }
1442
- min(e, t) {
1452
+ min(e, n) {
1443
1453
  return this._addCheck({
1444
1454
  kind: "min",
1445
1455
  value: e.getTime(),
1446
- message: h.toString(t)
1456
+ message: p.toString(n)
1447
1457
  });
1448
1458
  }
1449
- max(e, t) {
1459
+ max(e, n) {
1450
1460
  return this._addCheck({
1451
1461
  kind: "max",
1452
1462
  value: e.getTime(),
1453
- message: h.toString(t)
1463
+ message: p.toString(n)
1454
1464
  });
1455
1465
  }
1456
1466
  get minDate() {
1457
1467
  let e = null;
1458
- for (const t of this._def.checks)
1459
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1468
+ for (const n of this._def.checks)
1469
+ n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1460
1470
  return e != null ? new Date(e) : null;
1461
1471
  }
1462
1472
  get maxDate() {
1463
1473
  let e = null;
1464
- for (const t of this._def.checks)
1465
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1474
+ for (const n of this._def.checks)
1475
+ n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1466
1476
  return e != null ? new Date(e) : null;
1467
1477
  }
1468
1478
  }
1469
- K.create = (n) => new K({
1479
+ X.create = (t) => new X({
1470
1480
  checks: [],
1471
- coerce: n?.coerce || !1,
1481
+ coerce: t?.coerce || !1,
1472
1482
  typeName: y.ZodDate,
1473
- ..._(n)
1483
+ ..._(t)
1474
1484
  });
1475
- class Ee extends v {
1485
+ class Re extends v {
1476
1486
  _parse(e) {
1477
1487
  if (this._getType(e) !== f.symbol) {
1478
1488
  const s = this._getOrReturnCtx(e);
1479
1489
  return l(s, {
1480
- code: d.invalid_type,
1490
+ code: u.invalid_type,
1481
1491
  expected: f.symbol,
1482
1492
  received: s.parsedType
1483
1493
  }), m;
1484
1494
  }
1485
- return S(e.data);
1495
+ return C(e.data);
1486
1496
  }
1487
1497
  }
1488
- Ee.create = (n) => new Ee({
1498
+ Re.create = (t) => new Re({
1489
1499
  typeName: y.ZodSymbol,
1490
- ..._(n)
1500
+ ..._(t)
1491
1501
  });
1492
1502
  class pe extends v {
1493
1503
  _parse(e) {
1494
1504
  if (this._getType(e) !== f.undefined) {
1495
1505
  const s = this._getOrReturnCtx(e);
1496
1506
  return l(s, {
1497
- code: d.invalid_type,
1507
+ code: u.invalid_type,
1498
1508
  expected: f.undefined,
1499
1509
  received: s.parsedType
1500
1510
  }), m;
1501
1511
  }
1502
- return S(e.data);
1512
+ return C(e.data);
1503
1513
  }
1504
1514
  }
1505
- pe.create = (n) => new pe({
1515
+ pe.create = (t) => new pe({
1506
1516
  typeName: y.ZodUndefined,
1507
- ..._(n)
1517
+ ..._(t)
1508
1518
  });
1509
1519
  class me extends v {
1510
1520
  _parse(e) {
1511
1521
  if (this._getType(e) !== f.null) {
1512
1522
  const s = this._getOrReturnCtx(e);
1513
1523
  return l(s, {
1514
- code: d.invalid_type,
1524
+ code: u.invalid_type,
1515
1525
  expected: f.null,
1516
1526
  received: s.parsedType
1517
1527
  }), m;
1518
1528
  }
1519
- return S(e.data);
1529
+ return C(e.data);
1520
1530
  }
1521
1531
  }
1522
- me.create = (n) => new me({
1532
+ me.create = (t) => new me({
1523
1533
  typeName: y.ZodNull,
1524
- ..._(n)
1534
+ ..._(t)
1525
1535
  });
1526
- class ie extends v {
1536
+ class oe extends v {
1527
1537
  constructor() {
1528
1538
  super(...arguments), this._any = !0;
1529
1539
  }
1530
1540
  _parse(e) {
1531
- return S(e.data);
1541
+ return C(e.data);
1532
1542
  }
1533
1543
  }
1534
- ie.create = (n) => new ie({
1544
+ oe.create = (t) => new oe({
1535
1545
  typeName: y.ZodAny,
1536
- ..._(n)
1546
+ ..._(t)
1537
1547
  });
1538
- class Y extends v {
1548
+ class G extends v {
1539
1549
  constructor() {
1540
1550
  super(...arguments), this._unknown = !0;
1541
1551
  }
1542
1552
  _parse(e) {
1543
- return S(e.data);
1553
+ return C(e.data);
1544
1554
  }
1545
1555
  }
1546
- Y.create = (n) => new Y({
1556
+ G.create = (t) => new G({
1547
1557
  typeName: y.ZodUnknown,
1548
- ..._(n)
1558
+ ..._(t)
1549
1559
  });
1550
- class z extends v {
1560
+ class F extends v {
1551
1561
  _parse(e) {
1552
- const t = this._getOrReturnCtx(e);
1553
- return l(t, {
1554
- code: d.invalid_type,
1562
+ const n = this._getOrReturnCtx(e);
1563
+ return l(n, {
1564
+ code: u.invalid_type,
1555
1565
  expected: f.never,
1556
- received: t.parsedType
1566
+ received: n.parsedType
1557
1567
  }), m;
1558
1568
  }
1559
1569
  }
1560
- z.create = (n) => new z({
1570
+ F.create = (t) => new F({
1561
1571
  typeName: y.ZodNever,
1562
- ..._(n)
1572
+ ..._(t)
1563
1573
  });
1564
1574
  class Ne extends v {
1565
1575
  _parse(e) {
1566
1576
  if (this._getType(e) !== f.undefined) {
1567
1577
  const s = this._getOrReturnCtx(e);
1568
1578
  return l(s, {
1569
- code: d.invalid_type,
1579
+ code: u.invalid_type,
1570
1580
  expected: f.void,
1571
1581
  received: s.parsedType
1572
1582
  }), m;
1573
1583
  }
1574
- return S(e.data);
1584
+ return C(e.data);
1575
1585
  }
1576
1586
  }
1577
- Ne.create = (n) => new Ne({
1587
+ Ne.create = (t) => new Ne({
1578
1588
  typeName: y.ZodVoid,
1579
- ..._(n)
1589
+ ..._(t)
1580
1590
  });
1581
- class E extends v {
1591
+ class j extends v {
1582
1592
  _parse(e) {
1583
- const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
1584
- if (t.parsedType !== f.array)
1585
- return l(t, {
1586
- code: d.invalid_type,
1593
+ const { ctx: n, status: s } = this._processInputParams(e), r = this._def;
1594
+ if (n.parsedType !== f.array)
1595
+ return l(n, {
1596
+ code: u.invalid_type,
1587
1597
  expected: f.array,
1588
- received: t.parsedType
1598
+ received: n.parsedType
1589
1599
  }), m;
1590
1600
  if (r.exactLength !== null) {
1591
- const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
1592
- (i || o) && (l(t, {
1593
- code: i ? d.too_big : d.too_small,
1601
+ const i = n.data.length > r.exactLength.value, o = n.data.length < r.exactLength.value;
1602
+ (i || o) && (l(n, {
1603
+ code: i ? u.too_big : u.too_small,
1594
1604
  minimum: o ? r.exactLength.value : void 0,
1595
1605
  maximum: i ? r.exactLength.value : void 0,
1596
1606
  type: "array",
@@ -1599,73 +1609,73 @@ class E extends v {
1599
1609
  message: r.exactLength.message
1600
1610
  }), s.dirty());
1601
1611
  }
1602
- if (r.minLength !== null && t.data.length < r.minLength.value && (l(t, {
1603
- code: d.too_small,
1612
+ if (r.minLength !== null && n.data.length < r.minLength.value && (l(n, {
1613
+ code: u.too_small,
1604
1614
  minimum: r.minLength.value,
1605
1615
  type: "array",
1606
1616
  inclusive: !0,
1607
1617
  exact: !1,
1608
1618
  message: r.minLength.message
1609
- }), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (l(t, {
1610
- code: d.too_big,
1619
+ }), s.dirty()), r.maxLength !== null && n.data.length > r.maxLength.value && (l(n, {
1620
+ code: u.too_big,
1611
1621
  maximum: r.maxLength.value,
1612
1622
  type: "array",
1613
1623
  inclusive: !0,
1614
1624
  exact: !1,
1615
1625
  message: r.maxLength.message
1616
- }), s.dirty()), t.common.async)
1617
- return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new $(t, i, t.path, o)))).then((i) => T.mergeArray(s, i));
1618
- const a = [...t.data].map((i, o) => r.type._parseSync(new $(t, i, t.path, o)));
1619
- return T.mergeArray(s, a);
1626
+ }), s.dirty()), n.common.async)
1627
+ return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new L(n, i, n.path, o)))).then((i) => S.mergeArray(s, i));
1628
+ const a = [...n.data].map((i, o) => r.type._parseSync(new L(n, i, n.path, o)));
1629
+ return S.mergeArray(s, a);
1620
1630
  }
1621
1631
  get element() {
1622
1632
  return this._def.type;
1623
1633
  }
1624
- min(e, t) {
1625
- return new E({
1634
+ min(e, n) {
1635
+ return new j({
1626
1636
  ...this._def,
1627
- minLength: { value: e, message: h.toString(t) }
1637
+ minLength: { value: e, message: p.toString(n) }
1628
1638
  });
1629
1639
  }
1630
- max(e, t) {
1631
- return new E({
1640
+ max(e, n) {
1641
+ return new j({
1632
1642
  ...this._def,
1633
- maxLength: { value: e, message: h.toString(t) }
1643
+ maxLength: { value: e, message: p.toString(n) }
1634
1644
  });
1635
1645
  }
1636
- length(e, t) {
1637
- return new E({
1646
+ length(e, n) {
1647
+ return new j({
1638
1648
  ...this._def,
1639
- exactLength: { value: e, message: h.toString(t) }
1649
+ exactLength: { value: e, message: p.toString(n) }
1640
1650
  });
1641
1651
  }
1642
1652
  nonempty(e) {
1643
1653
  return this.min(1, e);
1644
1654
  }
1645
1655
  }
1646
- E.create = (n, e) => new E({
1647
- type: n,
1656
+ j.create = (t, e) => new j({
1657
+ type: t,
1648
1658
  minLength: null,
1649
1659
  maxLength: null,
1650
1660
  exactLength: null,
1651
1661
  typeName: y.ZodArray,
1652
1662
  ..._(e)
1653
1663
  });
1654
- function ne(n) {
1655
- if (n instanceof k) {
1664
+ function se(t) {
1665
+ if (t instanceof k) {
1656
1666
  const e = {};
1657
- for (const t in n.shape) {
1658
- const s = n.shape[t];
1659
- e[t] = I.create(ne(s));
1667
+ for (const n in t.shape) {
1668
+ const s = t.shape[n];
1669
+ e[n] = M.create(se(s));
1660
1670
  }
1661
1671
  return new k({
1662
- ...n._def,
1672
+ ...t._def,
1663
1673
  shape: () => e
1664
1674
  });
1665
- } else return n instanceof E ? new E({
1666
- ...n._def,
1667
- type: ne(n.element)
1668
- }) : n instanceof I ? I.create(ne(n.unwrap())) : n instanceof W ? W.create(ne(n.unwrap())) : n instanceof P ? P.create(n.items.map((e) => ne(e))) : n;
1675
+ } else return t instanceof j ? new j({
1676
+ ...t._def,
1677
+ type: se(t.element)
1678
+ }) : t instanceof M ? M.create(se(t.unwrap())) : t instanceof Q ? Q.create(se(t.unwrap())) : t instanceof D ? D.create(t.items.map((e) => se(e))) : t;
1669
1679
  }
1670
1680
  class k extends v {
1671
1681
  constructor() {
@@ -1674,84 +1684,84 @@ class k extends v {
1674
1684
  _getCached() {
1675
1685
  if (this._cached !== null)
1676
1686
  return this._cached;
1677
- const e = this._def.shape(), t = x.objectKeys(e);
1678
- return this._cached = { shape: e, keys: t }, this._cached;
1687
+ const e = this._def.shape(), n = b.objectKeys(e);
1688
+ return this._cached = { shape: e, keys: n }, this._cached;
1679
1689
  }
1680
1690
  _parse(e) {
1681
1691
  if (this._getType(e) !== f.object) {
1682
- const u = this._getOrReturnCtx(e);
1683
- return l(u, {
1684
- code: d.invalid_type,
1692
+ const d = this._getOrReturnCtx(e);
1693
+ return l(d, {
1694
+ code: u.invalid_type,
1685
1695
  expected: f.object,
1686
- received: u.parsedType
1696
+ received: d.parsedType
1687
1697
  }), m;
1688
1698
  }
1689
1699
  const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1690
- if (!(this._def.catchall instanceof z && this._def.unknownKeys === "strip"))
1691
- for (const u in r.data)
1692
- i.includes(u) || o.push(u);
1700
+ if (!(this._def.catchall instanceof F && this._def.unknownKeys === "strip"))
1701
+ for (const d in r.data)
1702
+ i.includes(d) || o.push(d);
1693
1703
  const c = [];
1694
- for (const u of i) {
1695
- const p = a[u], b = r.data[u];
1704
+ for (const d of i) {
1705
+ const h = a[d], x = r.data[d];
1696
1706
  c.push({
1697
- key: { status: "valid", value: u },
1698
- value: p._parse(new $(r, b, r.path, u)),
1699
- alwaysSet: u in r.data
1707
+ key: { status: "valid", value: d },
1708
+ value: h._parse(new L(r, x, r.path, d)),
1709
+ alwaysSet: d in r.data
1700
1710
  });
1701
1711
  }
1702
- if (this._def.catchall instanceof z) {
1703
- const u = this._def.unknownKeys;
1704
- if (u === "passthrough")
1705
- for (const p of o)
1712
+ if (this._def.catchall instanceof F) {
1713
+ const d = this._def.unknownKeys;
1714
+ if (d === "passthrough")
1715
+ for (const h of o)
1706
1716
  c.push({
1707
- key: { status: "valid", value: p },
1708
- value: { status: "valid", value: r.data[p] }
1717
+ key: { status: "valid", value: h },
1718
+ value: { status: "valid", value: r.data[h] }
1709
1719
  });
1710
- else if (u === "strict")
1720
+ else if (d === "strict")
1711
1721
  o.length > 0 && (l(r, {
1712
- code: d.unrecognized_keys,
1722
+ code: u.unrecognized_keys,
1713
1723
  keys: o
1714
1724
  }), s.dirty());
1715
- else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1725
+ else if (d !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1716
1726
  } else {
1717
- const u = this._def.catchall;
1718
- for (const p of o) {
1719
- const b = r.data[p];
1727
+ const d = this._def.catchall;
1728
+ for (const h of o) {
1729
+ const x = r.data[h];
1720
1730
  c.push({
1721
- key: { status: "valid", value: p },
1722
- value: u._parse(
1723
- new $(r, b, r.path, p)
1731
+ key: { status: "valid", value: h },
1732
+ value: d._parse(
1733
+ new L(r, x, r.path, h)
1724
1734
  //, ctx.child(key), value, getParsedType(value)
1725
1735
  ),
1726
- alwaysSet: p in r.data
1736
+ alwaysSet: h in r.data
1727
1737
  });
1728
1738
  }
1729
1739
  }
1730
1740
  return r.common.async ? Promise.resolve().then(async () => {
1731
- const u = [];
1732
- for (const p of c) {
1733
- const b = await p.key, C = await p.value;
1734
- u.push({
1735
- key: b,
1736
- value: C,
1737
- alwaysSet: p.alwaysSet
1741
+ const d = [];
1742
+ for (const h of c) {
1743
+ const x = await h.key, T = await h.value;
1744
+ d.push({
1745
+ key: x,
1746
+ value: T,
1747
+ alwaysSet: h.alwaysSet
1738
1748
  });
1739
1749
  }
1740
- return u;
1741
- }).then((u) => T.mergeObjectSync(s, u)) : T.mergeObjectSync(s, c);
1750
+ return d;
1751
+ }).then((d) => S.mergeObjectSync(s, d)) : S.mergeObjectSync(s, c);
1742
1752
  }
1743
1753
  get shape() {
1744
1754
  return this._def.shape();
1745
1755
  }
1746
1756
  strict(e) {
1747
- return h.errToObj, new k({
1757
+ return p.errToObj, new k({
1748
1758
  ...this._def,
1749
1759
  unknownKeys: "strict",
1750
1760
  ...e !== void 0 ? {
1751
- errorMap: (t, s) => {
1752
- const r = this._def.errorMap?.(t, s).message ?? s.defaultError;
1753
- return t.code === "unrecognized_keys" ? {
1754
- message: h.errToObj(e).message ?? r
1761
+ errorMap: (n, s) => {
1762
+ const r = this._def.errorMap?.(n, s).message ?? s.defaultError;
1763
+ return n.code === "unrecognized_keys" ? {
1764
+ message: p.errToObj(e).message ?? r
1755
1765
  } : {
1756
1766
  message: r
1757
1767
  };
@@ -1848,8 +1858,8 @@ class k extends v {
1848
1858
  // }) as any;
1849
1859
  // return merged;
1850
1860
  // }
1851
- setKey(e, t) {
1852
- return this.augment({ [e]: t });
1861
+ setKey(e, n) {
1862
+ return this.augment({ [e]: n });
1853
1863
  }
1854
1864
  // merge<Incoming extends AnyZodObject>(
1855
1865
  // merging: Incoming
@@ -1879,111 +1889,111 @@ class k extends v {
1879
1889
  });
1880
1890
  }
1881
1891
  pick(e) {
1882
- const t = {};
1883
- for (const s of x.objectKeys(e))
1884
- e[s] && this.shape[s] && (t[s] = this.shape[s]);
1892
+ const n = {};
1893
+ for (const s of b.objectKeys(e))
1894
+ e[s] && this.shape[s] && (n[s] = this.shape[s]);
1885
1895
  return new k({
1886
1896
  ...this._def,
1887
- shape: () => t
1897
+ shape: () => n
1888
1898
  });
1889
1899
  }
1890
1900
  omit(e) {
1891
- const t = {};
1892
- for (const s of x.objectKeys(this.shape))
1893
- e[s] || (t[s] = this.shape[s]);
1901
+ const n = {};
1902
+ for (const s of b.objectKeys(this.shape))
1903
+ e[s] || (n[s] = this.shape[s]);
1894
1904
  return new k({
1895
1905
  ...this._def,
1896
- shape: () => t
1906
+ shape: () => n
1897
1907
  });
1898
1908
  }
1899
1909
  /**
1900
1910
  * @deprecated
1901
1911
  */
1902
1912
  deepPartial() {
1903
- return ne(this);
1913
+ return se(this);
1904
1914
  }
1905
1915
  partial(e) {
1906
- const t = {};
1907
- for (const s of x.objectKeys(this.shape)) {
1916
+ const n = {};
1917
+ for (const s of b.objectKeys(this.shape)) {
1908
1918
  const r = this.shape[s];
1909
- e && !e[s] ? t[s] = r : t[s] = r.optional();
1919
+ e && !e[s] ? n[s] = r : n[s] = r.optional();
1910
1920
  }
1911
1921
  return new k({
1912
1922
  ...this._def,
1913
- shape: () => t
1923
+ shape: () => n
1914
1924
  });
1915
1925
  }
1916
1926
  required(e) {
1917
- const t = {};
1918
- for (const s of x.objectKeys(this.shape))
1927
+ const n = {};
1928
+ for (const s of b.objectKeys(this.shape))
1919
1929
  if (e && !e[s])
1920
- t[s] = this.shape[s];
1930
+ n[s] = this.shape[s];
1921
1931
  else {
1922
1932
  let a = this.shape[s];
1923
- for (; a instanceof I; )
1933
+ for (; a instanceof M; )
1924
1934
  a = a._def.innerType;
1925
- t[s] = a;
1935
+ n[s] = a;
1926
1936
  }
1927
1937
  return new k({
1928
1938
  ...this._def,
1929
- shape: () => t
1939
+ shape: () => n
1930
1940
  });
1931
1941
  }
1932
1942
  keyof() {
1933
- return it(x.objectKeys(this.shape));
1943
+ return ct(b.objectKeys(this.shape));
1934
1944
  }
1935
1945
  }
1936
- k.create = (n, e) => new k({
1937
- shape: () => n,
1946
+ k.create = (t, e) => new k({
1947
+ shape: () => t,
1938
1948
  unknownKeys: "strip",
1939
- catchall: z.create(),
1949
+ catchall: F.create(),
1940
1950
  typeName: y.ZodObject,
1941
1951
  ..._(e)
1942
1952
  });
1943
- k.strictCreate = (n, e) => new k({
1944
- shape: () => n,
1953
+ k.strictCreate = (t, e) => new k({
1954
+ shape: () => t,
1945
1955
  unknownKeys: "strict",
1946
- catchall: z.create(),
1956
+ catchall: F.create(),
1947
1957
  typeName: y.ZodObject,
1948
1958
  ..._(e)
1949
1959
  });
1950
- k.lazycreate = (n, e) => new k({
1951
- shape: n,
1960
+ k.lazycreate = (t, e) => new k({
1961
+ shape: t,
1952
1962
  unknownKeys: "strip",
1953
- catchall: z.create(),
1963
+ catchall: F.create(),
1954
1964
  typeName: y.ZodObject,
1955
1965
  ..._(e)
1956
1966
  });
1957
1967
  class ye extends v {
1958
1968
  _parse(e) {
1959
- const { ctx: t } = this._processInputParams(e), s = this._def.options;
1969
+ const { ctx: n } = this._processInputParams(e), s = this._def.options;
1960
1970
  function r(a) {
1961
1971
  for (const o of a)
1962
1972
  if (o.result.status === "valid")
1963
1973
  return o.result;
1964
1974
  for (const o of a)
1965
1975
  if (o.result.status === "dirty")
1966
- return t.common.issues.push(...o.ctx.common.issues), o.result;
1967
- const i = a.map((o) => new O(o.ctx.common.issues));
1968
- return l(t, {
1969
- code: d.invalid_union,
1976
+ return n.common.issues.push(...o.ctx.common.issues), o.result;
1977
+ const i = a.map((o) => new A(o.ctx.common.issues));
1978
+ return l(n, {
1979
+ code: u.invalid_union,
1970
1980
  unionErrors: i
1971
1981
  }), m;
1972
1982
  }
1973
- if (t.common.async)
1983
+ if (n.common.async)
1974
1984
  return Promise.all(s.map(async (a) => {
1975
1985
  const i = {
1976
- ...t,
1986
+ ...n,
1977
1987
  common: {
1978
- ...t.common,
1988
+ ...n.common,
1979
1989
  issues: []
1980
1990
  },
1981
1991
  parent: null
1982
1992
  };
1983
1993
  return {
1984
1994
  result: await a._parseAsync({
1985
- data: t.data,
1986
- path: t.path,
1995
+ data: n.data,
1996
+ path: n.path,
1987
1997
  parent: i
1988
1998
  }),
1989
1999
  ctx: i
@@ -1993,27 +2003,27 @@ class ye extends v {
1993
2003
  let a;
1994
2004
  const i = [];
1995
2005
  for (const c of s) {
1996
- const u = {
1997
- ...t,
2006
+ const d = {
2007
+ ...n,
1998
2008
  common: {
1999
- ...t.common,
2009
+ ...n.common,
2000
2010
  issues: []
2001
2011
  },
2002
2012
  parent: null
2003
- }, p = c._parseSync({
2004
- data: t.data,
2005
- path: t.path,
2006
- parent: u
2013
+ }, h = c._parseSync({
2014
+ data: n.data,
2015
+ path: n.path,
2016
+ parent: d
2007
2017
  });
2008
- if (p.status === "valid")
2009
- return p;
2010
- p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && i.push(u.common.issues);
2018
+ if (h.status === "valid")
2019
+ return h;
2020
+ h.status === "dirty" && !a && (a = { result: h, ctx: d }), d.common.issues.length && i.push(d.common.issues);
2011
2021
  }
2012
2022
  if (a)
2013
- return t.common.issues.push(...a.ctx.common.issues), a.result;
2014
- const o = i.map((c) => new O(c));
2015
- return l(t, {
2016
- code: d.invalid_union,
2023
+ return n.common.issues.push(...a.ctx.common.issues), a.result;
2024
+ const o = i.map((c) => new A(c));
2025
+ return l(n, {
2026
+ code: u.invalid_union,
2017
2027
  unionErrors: o
2018
2028
  }), m;
2019
2029
  }
@@ -2022,32 +2032,32 @@ class ye extends v {
2022
2032
  return this._def.options;
2023
2033
  }
2024
2034
  }
2025
- ye.create = (n, e) => new ye({
2026
- options: n,
2035
+ ye.create = (t, e) => new ye({
2036
+ options: t,
2027
2037
  typeName: y.ZodUnion,
2028
2038
  ..._(e)
2029
2039
  });
2030
- const L = (n) => n instanceof ve ? L(n.schema) : n instanceof N ? L(n.innerType()) : n instanceof xe ? [n.value] : n instanceof q ? n.options : n instanceof be ? x.objectValues(n.enum) : n instanceof ke ? L(n._def.innerType) : n instanceof pe ? [void 0] : n instanceof me ? [null] : n instanceof I ? [void 0, ...L(n.unwrap())] : n instanceof W ? [null, ...L(n.unwrap())] : n instanceof Ye || n instanceof Te ? L(n.unwrap()) : n instanceof we ? L(n._def.innerType) : [];
2031
- class Pe extends v {
2040
+ const z = (t) => t instanceof ve ? z(t.schema) : t instanceof I ? z(t.innerType()) : t instanceof be ? [t.value] : t instanceof J ? t.options : t instanceof xe ? b.objectValues(t.enum) : t instanceof ke ? z(t._def.innerType) : t instanceof pe ? [void 0] : t instanceof me ? [null] : t instanceof M ? [void 0, ...z(t.unwrap())] : t instanceof Q ? [null, ...z(t.unwrap())] : t instanceof Xe || t instanceof Te ? z(t.unwrap()) : t instanceof we ? z(t._def.innerType) : [];
2041
+ class Me extends v {
2032
2042
  _parse(e) {
2033
- const { ctx: t } = this._processInputParams(e);
2034
- if (t.parsedType !== f.object)
2035
- return l(t, {
2036
- code: d.invalid_type,
2043
+ const { ctx: n } = this._processInputParams(e);
2044
+ if (n.parsedType !== f.object)
2045
+ return l(n, {
2046
+ code: u.invalid_type,
2037
2047
  expected: f.object,
2038
- received: t.parsedType
2048
+ received: n.parsedType
2039
2049
  }), m;
2040
- const s = this.discriminator, r = t.data[s], a = this.optionsMap.get(r);
2041
- return a ? t.common.async ? a._parseAsync({
2042
- data: t.data,
2043
- path: t.path,
2044
- parent: t
2050
+ const s = this.discriminator, r = n.data[s], a = this.optionsMap.get(r);
2051
+ return a ? n.common.async ? a._parseAsync({
2052
+ data: n.data,
2053
+ path: n.path,
2054
+ parent: n
2045
2055
  }) : a._parseSync({
2046
- data: t.data,
2047
- path: t.path,
2048
- parent: t
2049
- }) : (l(t, {
2050
- code: d.invalid_union_discriminator,
2056
+ data: n.data,
2057
+ path: n.path,
2058
+ parent: n
2059
+ }) : (l(n, {
2060
+ code: u.invalid_union_discriminator,
2051
2061
  options: Array.from(this.optionsMap.keys()),
2052
2062
  path: [s]
2053
2063
  }), m);
@@ -2069,10 +2079,10 @@ class Pe extends v {
2069
2079
  * @param types an array of object schemas
2070
2080
  * @param params
2071
2081
  */
2072
- static create(e, t, s) {
2082
+ static create(e, n, s) {
2073
2083
  const r = /* @__PURE__ */ new Map();
2074
- for (const a of t) {
2075
- const i = L(a.shape[e]);
2084
+ for (const a of n) {
2085
+ const i = z(a.shape[e]);
2076
2086
  if (!i.length)
2077
2087
  throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
2078
2088
  for (const o of i) {
@@ -2081,49 +2091,49 @@ class Pe extends v {
2081
2091
  r.set(o, a);
2082
2092
  }
2083
2093
  }
2084
- return new Pe({
2094
+ return new Me({
2085
2095
  typeName: y.ZodDiscriminatedUnion,
2086
2096
  discriminator: e,
2087
- options: t,
2097
+ options: n,
2088
2098
  optionsMap: r,
2089
2099
  ..._(s)
2090
2100
  });
2091
2101
  }
2092
2102
  }
2093
- function Qe(n, e) {
2094
- const t = V(n), s = V(e);
2095
- if (n === e)
2096
- return { valid: !0, data: n };
2097
- if (t === f.object && s === f.object) {
2098
- const r = x.objectKeys(e), a = x.objectKeys(n).filter((o) => r.indexOf(o) !== -1), i = { ...n, ...e };
2103
+ function He(t, e) {
2104
+ const n = B(t), s = B(e);
2105
+ if (t === e)
2106
+ return { valid: !0, data: t };
2107
+ if (n === f.object && s === f.object) {
2108
+ const r = b.objectKeys(e), a = b.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = { ...t, ...e };
2099
2109
  for (const o of a) {
2100
- const c = Qe(n[o], e[o]);
2110
+ const c = He(t[o], e[o]);
2101
2111
  if (!c.valid)
2102
2112
  return { valid: !1 };
2103
2113
  i[o] = c.data;
2104
2114
  }
2105
2115
  return { valid: !0, data: i };
2106
- } else if (t === f.array && s === f.array) {
2107
- if (n.length !== e.length)
2116
+ } else if (n === f.array && s === f.array) {
2117
+ if (t.length !== e.length)
2108
2118
  return { valid: !1 };
2109
2119
  const r = [];
2110
- for (let a = 0; a < n.length; a++) {
2111
- const i = n[a], o = e[a], c = Qe(i, o);
2120
+ for (let a = 0; a < t.length; a++) {
2121
+ const i = t[a], o = e[a], c = He(i, o);
2112
2122
  if (!c.valid)
2113
2123
  return { valid: !1 };
2114
2124
  r.push(c.data);
2115
2125
  }
2116
2126
  return { valid: !0, data: r };
2117
- } else return t === f.date && s === f.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
2127
+ } else return n === f.date && s === f.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2118
2128
  }
2119
2129
  class _e extends v {
2120
2130
  _parse(e) {
2121
- const { status: t, ctx: s } = this._processInputParams(e), r = (a, i) => {
2122
- if (We(a) || We(i))
2131
+ const { status: n, ctx: s } = this._processInputParams(e), r = (a, i) => {
2132
+ if (Je(a) || Je(i))
2123
2133
  return m;
2124
- const o = Qe(a.value, i.value);
2125
- return o.valid ? ((Je(a) || Je(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(s, {
2126
- code: d.invalid_intersection_types
2134
+ const o = He(a.value, i.value);
2135
+ return o.valid ? ((Qe(a) || Qe(i)) && n.dirty(), { status: n.value, value: o.data }) : (l(s, {
2136
+ code: u.invalid_intersection_types
2127
2137
  }), m);
2128
2138
  };
2129
2139
  return s.common.async ? Promise.all([
@@ -2148,57 +2158,57 @@ class _e extends v {
2148
2158
  }));
2149
2159
  }
2150
2160
  }
2151
- _e.create = (n, e, t) => new _e({
2152
- left: n,
2161
+ _e.create = (t, e, n) => new _e({
2162
+ left: t,
2153
2163
  right: e,
2154
2164
  typeName: y.ZodIntersection,
2155
- ..._(t)
2165
+ ..._(n)
2156
2166
  });
2157
- class P extends v {
2167
+ class D extends v {
2158
2168
  _parse(e) {
2159
- const { status: t, ctx: s } = this._processInputParams(e);
2169
+ const { status: n, ctx: s } = this._processInputParams(e);
2160
2170
  if (s.parsedType !== f.array)
2161
2171
  return l(s, {
2162
- code: d.invalid_type,
2172
+ code: u.invalid_type,
2163
2173
  expected: f.array,
2164
2174
  received: s.parsedType
2165
2175
  }), m;
2166
2176
  if (s.data.length < this._def.items.length)
2167
2177
  return l(s, {
2168
- code: d.too_small,
2178
+ code: u.too_small,
2169
2179
  minimum: this._def.items.length,
2170
2180
  inclusive: !0,
2171
2181
  exact: !1,
2172
2182
  type: "array"
2173
2183
  }), m;
2174
2184
  !this._def.rest && s.data.length > this._def.items.length && (l(s, {
2175
- code: d.too_big,
2185
+ code: u.too_big,
2176
2186
  maximum: this._def.items.length,
2177
2187
  inclusive: !0,
2178
2188
  exact: !1,
2179
2189
  type: "array"
2180
- }), t.dirty());
2190
+ }), n.dirty());
2181
2191
  const a = [...s.data].map((i, o) => {
2182
2192
  const c = this._def.items[o] || this._def.rest;
2183
- return c ? c._parse(new $(s, i, s.path, o)) : null;
2193
+ return c ? c._parse(new L(s, i, s.path, o)) : null;
2184
2194
  }).filter((i) => !!i);
2185
- return s.common.async ? Promise.all(a).then((i) => T.mergeArray(t, i)) : T.mergeArray(t, a);
2195
+ return s.common.async ? Promise.all(a).then((i) => S.mergeArray(n, i)) : S.mergeArray(n, a);
2186
2196
  }
2187
2197
  get items() {
2188
2198
  return this._def.items;
2189
2199
  }
2190
2200
  rest(e) {
2191
- return new P({
2201
+ return new D({
2192
2202
  ...this._def,
2193
2203
  rest: e
2194
2204
  });
2195
2205
  }
2196
2206
  }
2197
- P.create = (n, e) => {
2198
- if (!Array.isArray(n))
2207
+ D.create = (t, e) => {
2208
+ if (!Array.isArray(t))
2199
2209
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2200
- return new P({
2201
- items: n,
2210
+ return new D({
2211
+ items: t,
2202
2212
  typeName: y.ZodTuple,
2203
2213
  rest: null,
2204
2214
  ..._(e)
@@ -2212,40 +2222,40 @@ class ge extends v {
2212
2222
  return this._def.valueType;
2213
2223
  }
2214
2224
  _parse(e) {
2215
- const { status: t, ctx: s } = this._processInputParams(e);
2225
+ const { status: n, ctx: s } = this._processInputParams(e);
2216
2226
  if (s.parsedType !== f.object)
2217
2227
  return l(s, {
2218
- code: d.invalid_type,
2228
+ code: u.invalid_type,
2219
2229
  expected: f.object,
2220
2230
  received: s.parsedType
2221
2231
  }), m;
2222
2232
  const r = [], a = this._def.keyType, i = this._def.valueType;
2223
2233
  for (const o in s.data)
2224
2234
  r.push({
2225
- key: a._parse(new $(s, o, s.path, o)),
2226
- value: i._parse(new $(s, s.data[o], s.path, o)),
2235
+ key: a._parse(new L(s, o, s.path, o)),
2236
+ value: i._parse(new L(s, s.data[o], s.path, o)),
2227
2237
  alwaysSet: o in s.data
2228
2238
  });
2229
- return s.common.async ? T.mergeObjectAsync(t, r) : T.mergeObjectSync(t, r);
2239
+ return s.common.async ? S.mergeObjectAsync(n, r) : S.mergeObjectSync(n, r);
2230
2240
  }
2231
2241
  get element() {
2232
2242
  return this._def.valueType;
2233
2243
  }
2234
- static create(e, t, s) {
2235
- return t instanceof v ? new ge({
2244
+ static create(e, n, s) {
2245
+ return n instanceof v ? new ge({
2236
2246
  keyType: e,
2237
- valueType: t,
2247
+ valueType: n,
2238
2248
  typeName: y.ZodRecord,
2239
2249
  ..._(s)
2240
2250
  }) : new ge({
2241
- keyType: R.create(),
2251
+ keyType: $.create(),
2242
2252
  valueType: e,
2243
2253
  typeName: y.ZodRecord,
2244
- ..._(t)
2254
+ ..._(n)
2245
2255
  });
2246
2256
  }
2247
2257
  }
2248
- class je extends v {
2258
+ class $e extends v {
2249
2259
  get keySchema() {
2250
2260
  return this._def.keyType;
2251
2261
  }
@@ -2253,165 +2263,165 @@ class je extends v {
2253
2263
  return this._def.valueType;
2254
2264
  }
2255
2265
  _parse(e) {
2256
- const { status: t, ctx: s } = this._processInputParams(e);
2266
+ const { status: n, ctx: s } = this._processInputParams(e);
2257
2267
  if (s.parsedType !== f.map)
2258
2268
  return l(s, {
2259
- code: d.invalid_type,
2269
+ code: u.invalid_type,
2260
2270
  expected: f.map,
2261
2271
  received: s.parsedType
2262
2272
  }), m;
2263
- const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
2264
- key: r._parse(new $(s, o, s.path, [u, "key"])),
2265
- value: a._parse(new $(s, c, s.path, [u, "value"]))
2273
+ const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], d) => ({
2274
+ key: r._parse(new L(s, o, s.path, [d, "key"])),
2275
+ value: a._parse(new L(s, c, s.path, [d, "value"]))
2266
2276
  }));
2267
2277
  if (s.common.async) {
2268
2278
  const o = /* @__PURE__ */ new Map();
2269
2279
  return Promise.resolve().then(async () => {
2270
2280
  for (const c of i) {
2271
- const u = await c.key, p = await c.value;
2272
- if (u.status === "aborted" || p.status === "aborted")
2281
+ const d = await c.key, h = await c.value;
2282
+ if (d.status === "aborted" || h.status === "aborted")
2273
2283
  return m;
2274
- (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2284
+ (d.status === "dirty" || h.status === "dirty") && n.dirty(), o.set(d.value, h.value);
2275
2285
  }
2276
- return { status: t.value, value: o };
2286
+ return { status: n.value, value: o };
2277
2287
  });
2278
2288
  } else {
2279
2289
  const o = /* @__PURE__ */ new Map();
2280
2290
  for (const c of i) {
2281
- const u = c.key, p = c.value;
2282
- if (u.status === "aborted" || p.status === "aborted")
2291
+ const d = c.key, h = c.value;
2292
+ if (d.status === "aborted" || h.status === "aborted")
2283
2293
  return m;
2284
- (u.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(u.value, p.value);
2294
+ (d.status === "dirty" || h.status === "dirty") && n.dirty(), o.set(d.value, h.value);
2285
2295
  }
2286
- return { status: t.value, value: o };
2296
+ return { status: n.value, value: o };
2287
2297
  }
2288
2298
  }
2289
2299
  }
2290
- je.create = (n, e, t) => new je({
2300
+ $e.create = (t, e, n) => new $e({
2291
2301
  valueType: e,
2292
- keyType: n,
2302
+ keyType: t,
2293
2303
  typeName: y.ZodMap,
2294
- ..._(t)
2304
+ ..._(n)
2295
2305
  });
2296
- class X extends v {
2306
+ class ee extends v {
2297
2307
  _parse(e) {
2298
- const { status: t, ctx: s } = this._processInputParams(e);
2308
+ const { status: n, ctx: s } = this._processInputParams(e);
2299
2309
  if (s.parsedType !== f.set)
2300
2310
  return l(s, {
2301
- code: d.invalid_type,
2311
+ code: u.invalid_type,
2302
2312
  expected: f.set,
2303
2313
  received: s.parsedType
2304
2314
  }), m;
2305
2315
  const r = this._def;
2306
2316
  r.minSize !== null && s.data.size < r.minSize.value && (l(s, {
2307
- code: d.too_small,
2317
+ code: u.too_small,
2308
2318
  minimum: r.minSize.value,
2309
2319
  type: "set",
2310
2320
  inclusive: !0,
2311
2321
  exact: !1,
2312
2322
  message: r.minSize.message
2313
- }), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (l(s, {
2314
- code: d.too_big,
2323
+ }), n.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (l(s, {
2324
+ code: u.too_big,
2315
2325
  maximum: r.maxSize.value,
2316
2326
  type: "set",
2317
2327
  inclusive: !0,
2318
2328
  exact: !1,
2319
2329
  message: r.maxSize.message
2320
- }), t.dirty());
2330
+ }), n.dirty());
2321
2331
  const a = this._def.valueType;
2322
2332
  function i(c) {
2323
- const u = /* @__PURE__ */ new Set();
2324
- for (const p of c) {
2325
- if (p.status === "aborted")
2333
+ const d = /* @__PURE__ */ new Set();
2334
+ for (const h of c) {
2335
+ if (h.status === "aborted")
2326
2336
  return m;
2327
- p.status === "dirty" && t.dirty(), u.add(p.value);
2337
+ h.status === "dirty" && n.dirty(), d.add(h.value);
2328
2338
  }
2329
- return { status: t.value, value: u };
2339
+ return { status: n.value, value: d };
2330
2340
  }
2331
- const o = [...s.data.values()].map((c, u) => a._parse(new $(s, c, s.path, u)));
2341
+ const o = [...s.data.values()].map((c, d) => a._parse(new L(s, c, s.path, d)));
2332
2342
  return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2333
2343
  }
2334
- min(e, t) {
2335
- return new X({
2344
+ min(e, n) {
2345
+ return new ee({
2336
2346
  ...this._def,
2337
- minSize: { value: e, message: h.toString(t) }
2347
+ minSize: { value: e, message: p.toString(n) }
2338
2348
  });
2339
2349
  }
2340
- max(e, t) {
2341
- return new X({
2350
+ max(e, n) {
2351
+ return new ee({
2342
2352
  ...this._def,
2343
- maxSize: { value: e, message: h.toString(t) }
2353
+ maxSize: { value: e, message: p.toString(n) }
2344
2354
  });
2345
2355
  }
2346
- size(e, t) {
2347
- return this.min(e, t).max(e, t);
2356
+ size(e, n) {
2357
+ return this.min(e, n).max(e, n);
2348
2358
  }
2349
2359
  nonempty(e) {
2350
2360
  return this.min(1, e);
2351
2361
  }
2352
2362
  }
2353
- X.create = (n, e) => new X({
2354
- valueType: n,
2363
+ ee.create = (t, e) => new ee({
2364
+ valueType: t,
2355
2365
  minSize: null,
2356
2366
  maxSize: null,
2357
2367
  typeName: y.ZodSet,
2358
2368
  ..._(e)
2359
2369
  });
2360
- class re extends v {
2370
+ class ae extends v {
2361
2371
  constructor() {
2362
2372
  super(...arguments), this.validate = this.implement;
2363
2373
  }
2364
2374
  _parse(e) {
2365
- const { ctx: t } = this._processInputParams(e);
2366
- if (t.parsedType !== f.function)
2367
- return l(t, {
2368
- code: d.invalid_type,
2375
+ const { ctx: n } = this._processInputParams(e);
2376
+ if (n.parsedType !== f.function)
2377
+ return l(n, {
2378
+ code: u.invalid_type,
2369
2379
  expected: f.function,
2370
- received: t.parsedType
2380
+ received: n.parsedType
2371
2381
  }), m;
2372
2382
  function s(o, c) {
2373
- return Re({
2383
+ return Ae({
2374
2384
  data: o,
2375
- path: t.path,
2376
- errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Ae(), ae].filter((u) => !!u),
2385
+ path: n.path,
2386
+ errorMaps: [n.common.contextualErrorMap, n.schemaErrorMap, Ee(), ie].filter((d) => !!d),
2377
2387
  issueData: {
2378
- code: d.invalid_arguments,
2388
+ code: u.invalid_arguments,
2379
2389
  argumentsError: c
2380
2390
  }
2381
2391
  });
2382
2392
  }
2383
2393
  function r(o, c) {
2384
- return Re({
2394
+ return Ae({
2385
2395
  data: o,
2386
- path: t.path,
2387
- errorMaps: [t.common.contextualErrorMap, t.schemaErrorMap, Ae(), ae].filter((u) => !!u),
2396
+ path: n.path,
2397
+ errorMaps: [n.common.contextualErrorMap, n.schemaErrorMap, Ee(), ie].filter((d) => !!d),
2388
2398
  issueData: {
2389
- code: d.invalid_return_type,
2399
+ code: u.invalid_return_type,
2390
2400
  returnTypeError: c
2391
2401
  }
2392
2402
  });
2393
2403
  }
2394
- const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
2395
- if (this._def.returns instanceof oe) {
2404
+ const a = { errorMap: n.common.contextualErrorMap }, i = n.data;
2405
+ if (this._def.returns instanceof ce) {
2396
2406
  const o = this;
2397
- return S(async function(...c) {
2398
- const u = new O([]), p = await o._def.args.parseAsync(c, a).catch((w) => {
2399
- throw u.addIssue(s(c, w)), u;
2400
- }), b = await Reflect.apply(i, this, p);
2401
- return await o._def.returns._def.type.parseAsync(b, a).catch((w) => {
2402
- throw u.addIssue(r(b, w)), u;
2407
+ return C(async function(...c) {
2408
+ const d = new A([]), h = await o._def.args.parseAsync(c, a).catch((w) => {
2409
+ throw d.addIssue(s(c, w)), d;
2410
+ }), x = await Reflect.apply(i, this, h);
2411
+ return await o._def.returns._def.type.parseAsync(x, a).catch((w) => {
2412
+ throw d.addIssue(r(x, w)), d;
2403
2413
  });
2404
2414
  });
2405
2415
  } else {
2406
2416
  const o = this;
2407
- return S(function(...c) {
2408
- const u = o._def.args.safeParse(c, a);
2409
- if (!u.success)
2410
- throw new O([s(c, u.error)]);
2411
- const p = Reflect.apply(i, this, u.data), b = o._def.returns.safeParse(p, a);
2412
- if (!b.success)
2413
- throw new O([r(p, b.error)]);
2414
- return b.data;
2417
+ return C(function(...c) {
2418
+ const d = o._def.args.safeParse(c, a);
2419
+ if (!d.success)
2420
+ throw new A([s(c, d.error)]);
2421
+ const h = Reflect.apply(i, this, d.data), x = o._def.returns.safeParse(h, a);
2422
+ if (!x.success)
2423
+ throw new A([r(h, x.error)]);
2424
+ return x.data;
2415
2425
  });
2416
2426
  }
2417
2427
  }
@@ -2422,13 +2432,13 @@ class re extends v {
2422
2432
  return this._def.returns;
2423
2433
  }
2424
2434
  args(...e) {
2425
- return new re({
2435
+ return new ae({
2426
2436
  ...this._def,
2427
- args: P.create(e).rest(Y.create())
2437
+ args: D.create(e).rest(G.create())
2428
2438
  });
2429
2439
  }
2430
2440
  returns(e) {
2431
- return new re({
2441
+ return new ae({
2432
2442
  ...this._def,
2433
2443
  returns: e
2434
2444
  });
@@ -2439,10 +2449,10 @@ class re extends v {
2439
2449
  strictImplement(e) {
2440
2450
  return this.parse(e);
2441
2451
  }
2442
- static create(e, t, s) {
2443
- return new re({
2444
- args: e || P.create([]).rest(Y.create()),
2445
- returns: t || Y.create(),
2452
+ static create(e, n, s) {
2453
+ return new ae({
2454
+ args: e || D.create([]).rest(G.create()),
2455
+ returns: n || G.create(),
2446
2456
  typeName: y.ZodFunction,
2447
2457
  ..._(s)
2448
2458
  });
@@ -2453,22 +2463,22 @@ class ve extends v {
2453
2463
  return this._def.getter();
2454
2464
  }
2455
2465
  _parse(e) {
2456
- const { ctx: t } = this._processInputParams(e);
2457
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2466
+ const { ctx: n } = this._processInputParams(e);
2467
+ return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
2458
2468
  }
2459
2469
  }
2460
- ve.create = (n, e) => new ve({
2461
- getter: n,
2470
+ ve.create = (t, e) => new ve({
2471
+ getter: t,
2462
2472
  typeName: y.ZodLazy,
2463
2473
  ..._(e)
2464
2474
  });
2465
- class xe extends v {
2475
+ class be extends v {
2466
2476
  _parse(e) {
2467
2477
  if (e.data !== this._def.value) {
2468
- const t = this._getOrReturnCtx(e);
2469
- return l(t, {
2470
- received: t.data,
2471
- code: d.invalid_literal,
2478
+ const n = this._getOrReturnCtx(e);
2479
+ return l(n, {
2480
+ received: n.data,
2481
+ code: u.invalid_literal,
2472
2482
  expected: this._def.value
2473
2483
  }), m;
2474
2484
  }
@@ -2478,128 +2488,128 @@ class xe extends v {
2478
2488
  return this._def.value;
2479
2489
  }
2480
2490
  }
2481
- xe.create = (n, e) => new xe({
2482
- value: n,
2491
+ be.create = (t, e) => new be({
2492
+ value: t,
2483
2493
  typeName: y.ZodLiteral,
2484
2494
  ..._(e)
2485
2495
  });
2486
- function it(n, e) {
2487
- return new q({
2488
- values: n,
2496
+ function ct(t, e) {
2497
+ return new J({
2498
+ values: t,
2489
2499
  typeName: y.ZodEnum,
2490
2500
  ..._(e)
2491
2501
  });
2492
2502
  }
2493
- class q extends v {
2503
+ class J extends v {
2494
2504
  _parse(e) {
2495
2505
  if (typeof e.data != "string") {
2496
- const t = this._getOrReturnCtx(e), s = this._def.values;
2497
- return l(t, {
2498
- expected: x.joinValues(s),
2499
- received: t.parsedType,
2500
- code: d.invalid_type
2506
+ const n = this._getOrReturnCtx(e), s = this._def.values;
2507
+ return l(n, {
2508
+ expected: b.joinValues(s),
2509
+ received: n.parsedType,
2510
+ code: u.invalid_type
2501
2511
  }), m;
2502
2512
  }
2503
2513
  if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2504
- const t = this._getOrReturnCtx(e), s = this._def.values;
2505
- return l(t, {
2506
- received: t.data,
2507
- code: d.invalid_enum_value,
2514
+ const n = this._getOrReturnCtx(e), s = this._def.values;
2515
+ return l(n, {
2516
+ received: n.data,
2517
+ code: u.invalid_enum_value,
2508
2518
  options: s
2509
2519
  }), m;
2510
2520
  }
2511
- return S(e.data);
2521
+ return C(e.data);
2512
2522
  }
2513
2523
  get options() {
2514
2524
  return this._def.values;
2515
2525
  }
2516
2526
  get enum() {
2517
2527
  const e = {};
2518
- for (const t of this._def.values)
2519
- e[t] = t;
2528
+ for (const n of this._def.values)
2529
+ e[n] = n;
2520
2530
  return e;
2521
2531
  }
2522
2532
  get Values() {
2523
2533
  const e = {};
2524
- for (const t of this._def.values)
2525
- e[t] = t;
2534
+ for (const n of this._def.values)
2535
+ e[n] = n;
2526
2536
  return e;
2527
2537
  }
2528
2538
  get Enum() {
2529
2539
  const e = {};
2530
- for (const t of this._def.values)
2531
- e[t] = t;
2540
+ for (const n of this._def.values)
2541
+ e[n] = n;
2532
2542
  return e;
2533
2543
  }
2534
- extract(e, t = this._def) {
2535
- return q.create(e, {
2544
+ extract(e, n = this._def) {
2545
+ return J.create(e, {
2536
2546
  ...this._def,
2537
- ...t
2547
+ ...n
2538
2548
  });
2539
2549
  }
2540
- exclude(e, t = this._def) {
2541
- return q.create(this.options.filter((s) => !e.includes(s)), {
2550
+ exclude(e, n = this._def) {
2551
+ return J.create(this.options.filter((s) => !e.includes(s)), {
2542
2552
  ...this._def,
2543
- ...t
2553
+ ...n
2544
2554
  });
2545
2555
  }
2546
2556
  }
2547
- q.create = it;
2548
- class be extends v {
2557
+ J.create = ct;
2558
+ class xe extends v {
2549
2559
  _parse(e) {
2550
- const t = x.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2560
+ const n = b.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2551
2561
  if (s.parsedType !== f.string && s.parsedType !== f.number) {
2552
- const r = x.objectValues(t);
2562
+ const r = b.objectValues(n);
2553
2563
  return l(s, {
2554
- expected: x.joinValues(r),
2564
+ expected: b.joinValues(r),
2555
2565
  received: s.parsedType,
2556
- code: d.invalid_type
2566
+ code: u.invalid_type
2557
2567
  }), m;
2558
2568
  }
2559
- if (this._cache || (this._cache = new Set(x.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2560
- const r = x.objectValues(t);
2569
+ if (this._cache || (this._cache = new Set(b.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2570
+ const r = b.objectValues(n);
2561
2571
  return l(s, {
2562
2572
  received: s.data,
2563
- code: d.invalid_enum_value,
2573
+ code: u.invalid_enum_value,
2564
2574
  options: r
2565
2575
  }), m;
2566
2576
  }
2567
- return S(e.data);
2577
+ return C(e.data);
2568
2578
  }
2569
2579
  get enum() {
2570
2580
  return this._def.values;
2571
2581
  }
2572
2582
  }
2573
- be.create = (n, e) => new be({
2574
- values: n,
2583
+ xe.create = (t, e) => new xe({
2584
+ values: t,
2575
2585
  typeName: y.ZodNativeEnum,
2576
2586
  ..._(e)
2577
2587
  });
2578
- class oe extends v {
2588
+ class ce extends v {
2579
2589
  unwrap() {
2580
2590
  return this._def.type;
2581
2591
  }
2582
2592
  _parse(e) {
2583
- const { ctx: t } = this._processInputParams(e);
2584
- if (t.parsedType !== f.promise && t.common.async === !1)
2585
- return l(t, {
2586
- code: d.invalid_type,
2593
+ const { ctx: n } = this._processInputParams(e);
2594
+ if (n.parsedType !== f.promise && n.common.async === !1)
2595
+ return l(n, {
2596
+ code: u.invalid_type,
2587
2597
  expected: f.promise,
2588
- received: t.parsedType
2598
+ received: n.parsedType
2589
2599
  }), m;
2590
- const s = t.parsedType === f.promise ? t.data : Promise.resolve(t.data);
2591
- return S(s.then((r) => this._def.type.parseAsync(r, {
2592
- path: t.path,
2593
- errorMap: t.common.contextualErrorMap
2600
+ const s = n.parsedType === f.promise ? n.data : Promise.resolve(n.data);
2601
+ return C(s.then((r) => this._def.type.parseAsync(r, {
2602
+ path: n.path,
2603
+ errorMap: n.common.contextualErrorMap
2594
2604
  })));
2595
2605
  }
2596
2606
  }
2597
- oe.create = (n, e) => new oe({
2598
- type: n,
2607
+ ce.create = (t, e) => new ce({
2608
+ type: t,
2599
2609
  typeName: y.ZodPromise,
2600
2610
  ..._(e)
2601
2611
  });
2602
- class N extends v {
2612
+ class I extends v {
2603
2613
  innerType() {
2604
2614
  return this._def.schema;
2605
2615
  }
@@ -2607,9 +2617,9 @@ class N extends v {
2607
2617
  return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2608
2618
  }
2609
2619
  _parse(e) {
2610
- const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
2620
+ const { status: n, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
2611
2621
  addIssue: (i) => {
2612
- l(s, i), i.fatal ? t.abort() : t.dirty();
2622
+ l(s, i), i.fatal ? n.abort() : n.dirty();
2613
2623
  },
2614
2624
  get path() {
2615
2625
  return s.path;
@@ -2619,24 +2629,24 @@ class N extends v {
2619
2629
  const i = r.transform(s.data, a);
2620
2630
  if (s.common.async)
2621
2631
  return Promise.resolve(i).then(async (o) => {
2622
- if (t.value === "aborted")
2632
+ if (n.value === "aborted")
2623
2633
  return m;
2624
2634
  const c = await this._def.schema._parseAsync({
2625
2635
  data: o,
2626
2636
  path: s.path,
2627
2637
  parent: s
2628
2638
  });
2629
- return c.status === "aborted" ? m : c.status === "dirty" || t.value === "dirty" ? se(c.value) : c;
2639
+ return c.status === "aborted" ? m : c.status === "dirty" || n.value === "dirty" ? re(c.value) : c;
2630
2640
  });
2631
2641
  {
2632
- if (t.value === "aborted")
2642
+ if (n.value === "aborted")
2633
2643
  return m;
2634
2644
  const o = this._def.schema._parseSync({
2635
2645
  data: i,
2636
2646
  path: s.path,
2637
2647
  parent: s
2638
2648
  });
2639
- return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? se(o.value) : o;
2649
+ return o.status === "aborted" ? m : o.status === "dirty" || n.value === "dirty" ? re(o.value) : o;
2640
2650
  }
2641
2651
  }
2642
2652
  if (r.type === "refinement") {
@@ -2654,9 +2664,9 @@ class N extends v {
2654
2664
  path: s.path,
2655
2665
  parent: s
2656
2666
  });
2657
- return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2667
+ return o.status === "aborted" ? m : (o.status === "dirty" && n.dirty(), i(o.value), { status: n.value, value: o.value });
2658
2668
  } else
2659
- 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 }))));
2669
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && n.dirty(), i(o.value).then(() => ({ status: n.value, value: o.value }))));
2660
2670
  }
2661
2671
  if (r.type === "transform")
2662
2672
  if (s.common.async === !1) {
@@ -2665,84 +2675,84 @@ class N extends v {
2665
2675
  path: s.path,
2666
2676
  parent: s
2667
2677
  });
2668
- if (!G(i))
2678
+ if (!K(i))
2669
2679
  return m;
2670
2680
  const o = r.transform(i.value, a);
2671
2681
  if (o instanceof Promise)
2672
2682
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2673
- return { status: t.value, value: o };
2683
+ return { status: n.value, value: o };
2674
2684
  } else
2675
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => G(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({
2676
- status: t.value,
2685
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => K(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({
2686
+ status: n.value,
2677
2687
  value: o
2678
2688
  })) : m);
2679
- x.assertNever(r);
2689
+ b.assertNever(r);
2680
2690
  }
2681
2691
  }
2682
- N.create = (n, e, t) => new N({
2683
- schema: n,
2692
+ I.create = (t, e, n) => new I({
2693
+ schema: t,
2684
2694
  typeName: y.ZodEffects,
2685
2695
  effect: e,
2686
- ..._(t)
2696
+ ..._(n)
2687
2697
  });
2688
- N.createWithPreprocess = (n, e, t) => new N({
2698
+ I.createWithPreprocess = (t, e, n) => new I({
2689
2699
  schema: e,
2690
- effect: { type: "preprocess", transform: n },
2700
+ effect: { type: "preprocess", transform: t },
2691
2701
  typeName: y.ZodEffects,
2692
- ..._(t)
2702
+ ..._(n)
2693
2703
  });
2694
- class I extends v {
2704
+ class M extends v {
2695
2705
  _parse(e) {
2696
- return this._getType(e) === f.undefined ? S(void 0) : this._def.innerType._parse(e);
2706
+ return this._getType(e) === f.undefined ? C(void 0) : this._def.innerType._parse(e);
2697
2707
  }
2698
2708
  unwrap() {
2699
2709
  return this._def.innerType;
2700
2710
  }
2701
2711
  }
2702
- I.create = (n, e) => new I({
2703
- innerType: n,
2712
+ M.create = (t, e) => new M({
2713
+ innerType: t,
2704
2714
  typeName: y.ZodOptional,
2705
2715
  ..._(e)
2706
2716
  });
2707
- class W extends v {
2717
+ class Q extends v {
2708
2718
  _parse(e) {
2709
- return this._getType(e) === f.null ? S(null) : this._def.innerType._parse(e);
2719
+ return this._getType(e) === f.null ? C(null) : this._def.innerType._parse(e);
2710
2720
  }
2711
2721
  unwrap() {
2712
2722
  return this._def.innerType;
2713
2723
  }
2714
2724
  }
2715
- W.create = (n, e) => new W({
2716
- innerType: n,
2725
+ Q.create = (t, e) => new Q({
2726
+ innerType: t,
2717
2727
  typeName: y.ZodNullable,
2718
2728
  ..._(e)
2719
2729
  });
2720
2730
  class ke extends v {
2721
2731
  _parse(e) {
2722
- const { ctx: t } = this._processInputParams(e);
2723
- let s = t.data;
2724
- return t.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2732
+ const { ctx: n } = this._processInputParams(e);
2733
+ let s = n.data;
2734
+ return n.parsedType === f.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2725
2735
  data: s,
2726
- path: t.path,
2727
- parent: t
2736
+ path: n.path,
2737
+ parent: n
2728
2738
  });
2729
2739
  }
2730
2740
  removeDefault() {
2731
2741
  return this._def.innerType;
2732
2742
  }
2733
2743
  }
2734
- ke.create = (n, e) => new ke({
2735
- innerType: n,
2744
+ ke.create = (t, e) => new ke({
2745
+ innerType: t,
2736
2746
  typeName: y.ZodDefault,
2737
2747
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2738
2748
  ..._(e)
2739
2749
  });
2740
2750
  class we extends v {
2741
2751
  _parse(e) {
2742
- const { ctx: t } = this._processInputParams(e), s = {
2743
- ...t,
2752
+ const { ctx: n } = this._processInputParams(e), s = {
2753
+ ...n,
2744
2754
  common: {
2745
- ...t.common,
2755
+ ...n.common,
2746
2756
  issues: []
2747
2757
  }
2748
2758
  }, r = this._def.innerType._parse({
@@ -2756,7 +2766,7 @@ class we extends v {
2756
2766
  status: "valid",
2757
2767
  value: a.status === "valid" ? a.value : this._def.catchValue({
2758
2768
  get error() {
2759
- return new O(s.common.issues);
2769
+ return new A(s.common.issues);
2760
2770
  },
2761
2771
  input: s.data
2762
2772
  })
@@ -2764,7 +2774,7 @@ class we extends v {
2764
2774
  status: "valid",
2765
2775
  value: r.status === "valid" ? r.value : this._def.catchValue({
2766
2776
  get error() {
2767
- return new O(s.common.issues);
2777
+ return new A(s.common.issues);
2768
2778
  },
2769
2779
  input: s.data
2770
2780
  })
@@ -2774,18 +2784,18 @@ class we extends v {
2774
2784
  return this._def.innerType;
2775
2785
  }
2776
2786
  }
2777
- we.create = (n, e) => new we({
2778
- innerType: n,
2787
+ we.create = (t, e) => new we({
2788
+ innerType: t,
2779
2789
  typeName: y.ZodCatch,
2780
2790
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2781
2791
  ..._(e)
2782
2792
  });
2783
- class Ze extends v {
2793
+ class je extends v {
2784
2794
  _parse(e) {
2785
2795
  if (this._getType(e) !== f.nan) {
2786
2796
  const s = this._getOrReturnCtx(e);
2787
2797
  return l(s, {
2788
- code: d.invalid_type,
2798
+ code: u.invalid_type,
2789
2799
  expected: f.nan,
2790
2800
  received: s.parsedType
2791
2801
  }), m;
@@ -2793,18 +2803,18 @@ class Ze extends v {
2793
2803
  return { status: "valid", value: e.data };
2794
2804
  }
2795
2805
  }
2796
- Ze.create = (n) => new Ze({
2806
+ je.create = (t) => new je({
2797
2807
  typeName: y.ZodNaN,
2798
- ..._(n)
2808
+ ..._(t)
2799
2809
  });
2800
- const Vt = Symbol("zod_brand");
2801
- class Ye extends v {
2810
+ const Ut = /* @__PURE__ */ Symbol("zod_brand");
2811
+ class Xe extends v {
2802
2812
  _parse(e) {
2803
- const { ctx: t } = this._processInputParams(e), s = t.data;
2813
+ const { ctx: n } = this._processInputParams(e), s = n.data;
2804
2814
  return this._def.type._parse({
2805
2815
  data: s,
2806
- path: t.path,
2807
- parent: t
2816
+ path: n.path,
2817
+ parent: n
2808
2818
  });
2809
2819
  }
2810
2820
  unwrap() {
@@ -2813,7 +2823,7 @@ class Ye extends v {
2813
2823
  }
2814
2824
  class Se extends v {
2815
2825
  _parse(e) {
2816
- const { status: t, ctx: s } = this._processInputParams(e);
2826
+ const { status: n, ctx: s } = this._processInputParams(e);
2817
2827
  if (s.common.async)
2818
2828
  return (async () => {
2819
2829
  const a = await this._def.in._parseAsync({
@@ -2821,7 +2831,7 @@ class Se extends v {
2821
2831
  path: s.path,
2822
2832
  parent: s
2823
2833
  });
2824
- return a.status === "aborted" ? m : a.status === "dirty" ? (t.dirty(), se(a.value)) : this._def.out._parseAsync({
2834
+ return a.status === "aborted" ? m : a.status === "dirty" ? (n.dirty(), re(a.value)) : this._def.out._parseAsync({
2825
2835
  data: a.value,
2826
2836
  path: s.path,
2827
2837
  parent: s
@@ -2833,7 +2843,7 @@ class Se extends v {
2833
2843
  path: s.path,
2834
2844
  parent: s
2835
2845
  });
2836
- return r.status === "aborted" ? m : r.status === "dirty" ? (t.dirty(), {
2846
+ return r.status === "aborted" ? m : r.status === "dirty" ? (n.dirty(), {
2837
2847
  status: "dirty",
2838
2848
  value: r.value
2839
2849
  }) : this._def.out._parseSync({
@@ -2843,249 +2853,249 @@ class Se extends v {
2843
2853
  });
2844
2854
  }
2845
2855
  }
2846
- static create(e, t) {
2856
+ static create(e, n) {
2847
2857
  return new Se({
2848
2858
  in: e,
2849
- out: t,
2859
+ out: n,
2850
2860
  typeName: y.ZodPipeline
2851
2861
  });
2852
2862
  }
2853
2863
  }
2854
2864
  class Te extends v {
2855
2865
  _parse(e) {
2856
- const t = this._def.innerType._parse(e), s = (r) => (G(r) && (r.value = Object.freeze(r.value)), r);
2857
- return fe(t) ? t.then((r) => s(r)) : s(t);
2866
+ const n = this._def.innerType._parse(e), s = (r) => (K(r) && (r.value = Object.freeze(r.value)), r);
2867
+ return fe(n) ? n.then((r) => s(r)) : s(n);
2858
2868
  }
2859
2869
  unwrap() {
2860
2870
  return this._def.innerType;
2861
2871
  }
2862
2872
  }
2863
- Te.create = (n, e) => new Te({
2864
- innerType: n,
2873
+ Te.create = (t, e) => new Te({
2874
+ innerType: t,
2865
2875
  typeName: y.ZodReadonly,
2866
2876
  ..._(e)
2867
2877
  });
2868
- function Xe(n, e) {
2869
- const t = typeof n == "function" ? n(e) : typeof n == "string" ? { message: n } : n;
2870
- return typeof t == "string" ? { message: t } : t;
2878
+ function nt(t, e) {
2879
+ const n = typeof t == "function" ? t(e) : typeof t == "string" ? { message: t } : t;
2880
+ return typeof n == "string" ? { message: n } : n;
2871
2881
  }
2872
- function ot(n, e = {}, t) {
2873
- return n ? ie.create().superRefine((s, r) => {
2874
- const a = n(s);
2882
+ function dt(t, e = {}, n) {
2883
+ return t ? oe.create().superRefine((s, r) => {
2884
+ const a = t(s);
2875
2885
  if (a instanceof Promise)
2876
2886
  return a.then((i) => {
2877
2887
  if (!i) {
2878
- const o = Xe(e, s), c = o.fatal ?? t ?? !0;
2888
+ const o = nt(e, s), c = o.fatal ?? n ?? !0;
2879
2889
  r.addIssue({ code: "custom", ...o, fatal: c });
2880
2890
  }
2881
2891
  });
2882
2892
  if (!a) {
2883
- const i = Xe(e, s), o = i.fatal ?? t ?? !0;
2893
+ const i = nt(e, s), o = i.fatal ?? n ?? !0;
2884
2894
  r.addIssue({ code: "custom", ...i, fatal: o });
2885
2895
  }
2886
- }) : ie.create();
2896
+ }) : oe.create();
2887
2897
  }
2888
- const zt = {
2898
+ const Wt = {
2889
2899
  object: k.lazycreate
2890
2900
  };
2891
2901
  var y;
2892
- (function(n) {
2893
- n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2902
+ (function(t) {
2903
+ t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
2894
2904
  })(y || (y = {}));
2895
- const Bt = (n, e = {
2896
- message: `Input not instance of ${n.name}`
2897
- }) => ot((t) => t instanceof n, e), g = R.create, Ge = U.create, Ut = Ze.create, Ft = F.create, Ce = he.create, qt = K.create, Wt = Ee.create, Jt = pe.create, Qt = me.create, Ht = ie.create, Yt = Y.create, Gt = z.create, Kt = Ne.create, A = E.create, j = k.create, Xt = k.strictCreate, en = ye.create, tn = Pe.create, nn = _e.create, sn = P.create, ct = ge.create, rn = je.create, an = X.create, on = re.create, cn = ve.create, dn = xe.create, un = q.create, ln = be.create, fn = oe.create, et = N.create, hn = I.create, pn = W.create, mn = N.createWithPreprocess, yn = Se.create, _n = () => g().optional(), gn = () => Ge().optional(), vn = () => Ce().optional(), xn = {
2898
- string: ((n) => R.create({ ...n, coerce: !0 })),
2899
- number: ((n) => U.create({ ...n, coerce: !0 })),
2900
- boolean: ((n) => he.create({
2901
- ...n,
2905
+ const Jt = (t, e = {
2906
+ message: `Input not instance of ${t.name}`
2907
+ }) => dt((n) => n instanceof t, e), g = $.create, et = U.create, Qt = je.create, Ht = W.create, Ce = he.create, Yt = X.create, Gt = Re.create, Kt = pe.create, Xt = me.create, en = oe.create, tn = G.create, nn = F.create, sn = Ne.create, R = j.create, Z = k.create, rn = k.strictCreate, an = ye.create, on = Me.create, cn = _e.create, dn = D.create, ut = ge.create, un = $e.create, ln = ee.create, fn = ae.create, hn = ve.create, pn = be.create, mn = J.create, yn = xe.create, _n = ce.create, st = I.create, gn = M.create, vn = Q.create, bn = I.createWithPreprocess, xn = Se.create, kn = () => g().optional(), wn = () => et().optional(), Tn = () => Ce().optional(), Sn = {
2908
+ string: ((t) => $.create({ ...t, coerce: !0 })),
2909
+ number: ((t) => U.create({ ...t, coerce: !0 })),
2910
+ boolean: ((t) => he.create({
2911
+ ...t,
2902
2912
  coerce: !0
2903
2913
  })),
2904
- bigint: ((n) => F.create({ ...n, coerce: !0 })),
2905
- date: ((n) => K.create({ ...n, coerce: !0 }))
2906
- }, bn = m, kn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2914
+ bigint: ((t) => W.create({ ...t, coerce: !0 })),
2915
+ date: ((t) => X.create({ ...t, coerce: !0 }))
2916
+ }, Cn = m, On = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2907
2917
  __proto__: null,
2908
- BRAND: Vt,
2909
- DIRTY: se,
2910
- EMPTY_PATH: gt,
2918
+ BRAND: Ut,
2919
+ DIRTY: re,
2920
+ EMPTY_PATH: wt,
2911
2921
  INVALID: m,
2912
- NEVER: bn,
2913
- OK: S,
2914
- ParseStatus: T,
2922
+ NEVER: Cn,
2923
+ OK: C,
2924
+ ParseStatus: S,
2915
2925
  Schema: v,
2916
- ZodAny: ie,
2917
- ZodArray: E,
2918
- ZodBigInt: F,
2926
+ ZodAny: oe,
2927
+ ZodArray: j,
2928
+ ZodBigInt: W,
2919
2929
  ZodBoolean: he,
2920
- ZodBranded: Ye,
2930
+ ZodBranded: Xe,
2921
2931
  ZodCatch: we,
2922
- ZodDate: K,
2932
+ ZodDate: X,
2923
2933
  ZodDefault: ke,
2924
- ZodDiscriminatedUnion: Pe,
2925
- ZodEffects: N,
2926
- ZodEnum: q,
2927
- ZodError: O,
2934
+ ZodDiscriminatedUnion: Me,
2935
+ ZodEffects: I,
2936
+ ZodEnum: J,
2937
+ ZodError: A,
2928
2938
  get ZodFirstPartyTypeKind() {
2929
2939
  return y;
2930
2940
  },
2931
- ZodFunction: re,
2941
+ ZodFunction: ae,
2932
2942
  ZodIntersection: _e,
2933
- ZodIssueCode: d,
2943
+ ZodIssueCode: u,
2934
2944
  ZodLazy: ve,
2935
- ZodLiteral: xe,
2936
- ZodMap: je,
2937
- ZodNaN: Ze,
2938
- ZodNativeEnum: be,
2939
- ZodNever: z,
2945
+ ZodLiteral: be,
2946
+ ZodMap: $e,
2947
+ ZodNaN: je,
2948
+ ZodNativeEnum: xe,
2949
+ ZodNever: F,
2940
2950
  ZodNull: me,
2941
- ZodNullable: W,
2951
+ ZodNullable: Q,
2942
2952
  ZodNumber: U,
2943
2953
  ZodObject: k,
2944
- ZodOptional: I,
2954
+ ZodOptional: M,
2945
2955
  ZodParsedType: f,
2946
2956
  ZodPipeline: Se,
2947
- ZodPromise: oe,
2957
+ ZodPromise: ce,
2948
2958
  ZodReadonly: Te,
2949
2959
  ZodRecord: ge,
2950
2960
  ZodSchema: v,
2951
- ZodSet: X,
2952
- ZodString: R,
2953
- ZodSymbol: Ee,
2954
- ZodTransformer: N,
2955
- ZodTuple: P,
2961
+ ZodSet: ee,
2962
+ ZodString: $,
2963
+ ZodSymbol: Re,
2964
+ ZodTransformer: I,
2965
+ ZodTuple: D,
2956
2966
  ZodType: v,
2957
2967
  ZodUndefined: pe,
2958
2968
  ZodUnion: ye,
2959
- ZodUnknown: Y,
2969
+ ZodUnknown: G,
2960
2970
  ZodVoid: Ne,
2961
2971
  addIssueToContext: l,
2962
- any: Ht,
2963
- array: A,
2964
- bigint: Ft,
2972
+ any: en,
2973
+ array: R,
2974
+ bigint: Ht,
2965
2975
  boolean: Ce,
2966
- coerce: xn,
2967
- custom: ot,
2968
- date: qt,
2969
- datetimeRegex: at,
2970
- defaultErrorMap: ae,
2971
- discriminatedUnion: tn,
2972
- effect: et,
2973
- enum: un,
2974
- function: on,
2975
- getErrorMap: Ae,
2976
- getParsedType: V,
2977
- instanceof: Bt,
2978
- intersection: nn,
2979
- isAborted: We,
2976
+ coerce: Sn,
2977
+ custom: dt,
2978
+ date: Yt,
2979
+ datetimeRegex: ot,
2980
+ defaultErrorMap: ie,
2981
+ discriminatedUnion: on,
2982
+ effect: st,
2983
+ enum: mn,
2984
+ function: fn,
2985
+ getErrorMap: Ee,
2986
+ getParsedType: B,
2987
+ instanceof: Jt,
2988
+ intersection: cn,
2989
+ isAborted: Je,
2980
2990
  isAsync: fe,
2981
- isDirty: Je,
2982
- isValid: G,
2983
- late: zt,
2984
- lazy: cn,
2985
- literal: dn,
2986
- makeIssue: Re,
2987
- map: rn,
2988
- nan: Ut,
2989
- nativeEnum: ln,
2990
- never: Gt,
2991
- null: Qt,
2992
- nullable: pn,
2993
- number: Ge,
2994
- object: j,
2991
+ isDirty: Qe,
2992
+ isValid: K,
2993
+ late: Wt,
2994
+ lazy: hn,
2995
+ literal: pn,
2996
+ makeIssue: Ae,
2997
+ map: un,
2998
+ nan: Qt,
2999
+ nativeEnum: yn,
3000
+ never: nn,
3001
+ null: Xt,
3002
+ nullable: vn,
3003
+ number: et,
3004
+ object: Z,
2995
3005
  get objectUtil() {
2996
- return qe;
3006
+ return We;
2997
3007
  },
2998
- oboolean: vn,
2999
- onumber: gn,
3000
- optional: hn,
3001
- ostring: _n,
3002
- pipeline: yn,
3003
- preprocess: mn,
3004
- promise: fn,
3005
- quotelessJson: yt,
3006
- record: ct,
3007
- set: an,
3008
- setErrorMap: _t,
3009
- strictObject: Xt,
3008
+ oboolean: Tn,
3009
+ onumber: wn,
3010
+ optional: gn,
3011
+ ostring: kn,
3012
+ pipeline: xn,
3013
+ preprocess: bn,
3014
+ promise: _n,
3015
+ quotelessJson: xt,
3016
+ record: ut,
3017
+ set: ln,
3018
+ setErrorMap: kt,
3019
+ strictObject: rn,
3010
3020
  string: g,
3011
- symbol: Wt,
3012
- transformer: et,
3013
- tuple: sn,
3014
- undefined: Jt,
3015
- union: en,
3016
- unknown: Yt,
3021
+ symbol: Gt,
3022
+ transformer: st,
3023
+ tuple: dn,
3024
+ undefined: Kt,
3025
+ union: an,
3026
+ unknown: tn,
3017
3027
  get util() {
3018
- return x;
3028
+ return b;
3019
3029
  },
3020
- void: Kt
3030
+ void: sn
3021
3031
  }, Symbol.toStringTag, { value: "Module" }));
3022
- mt(kn);
3023
- const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method + "@" + n, Sn = (n) => n.clone(), Cn = ({ skip: n = wn, key: e = Tn, resolver: t = Sn } = {}) => {
3032
+ bt(On);
3033
+ const En = (t, e) => e.skipDedupe || e.method !== "GET", An = (t, e) => e.method + "@" + t, Rn = (t) => t.clone(), Nn = ({ skip: t = En, key: e = An, resolver: n = Rn } = {}) => {
3024
3034
  const s = /* @__PURE__ */ new Map();
3025
3035
  return (r) => (a, i) => {
3026
- if (n(a, i))
3036
+ if (t(a, i))
3027
3037
  return r(a, i);
3028
3038
  const o = e(a, i);
3029
3039
  if (!s.has(o))
3030
3040
  s.set(o, []);
3031
3041
  else
3032
- return new Promise((c, u) => {
3033
- s.get(o).push([c, u]);
3042
+ return new Promise((c, d) => {
3043
+ s.get(o).push([c, d]);
3034
3044
  });
3035
3045
  try {
3036
- return r(a, i).then((c) => (s.get(o).forEach(([u]) => u(t(c))), s.delete(o), c)).catch((c) => {
3037
- throw s.get(o).forEach(([, u]) => u(c)), s.delete(o), c;
3046
+ return r(a, i).then((c) => (s.get(o).forEach(([d]) => d(n(c))), s.delete(o), c)).catch((c) => {
3047
+ throw s.get(o).forEach(([, d]) => d(c)), s.delete(o), c;
3038
3048
  });
3039
3049
  } catch (c) {
3040
3050
  return s.delete(o), Promise.reject(c);
3041
3051
  }
3042
3052
  };
3043
- }, On = (n, e) => n * e, An = (n) => n && (n.ok || n.status >= 400 && n.status < 500), Rn = ({ delayTimer: n = 500, delayRamp: e = On, maxAttempts: t = 10, until: s = An, onRetry: r = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (u, p) => {
3044
- let b = 0;
3045
- if (o && o(u, p))
3046
- return c(u, p);
3047
- const C = (w, Z) => Promise.resolve(s(w, Z)).then((ce) => ce ? w && i ? w : Z ? Promise.reject(Z) : w : (b++, !t || b <= t ? new Promise((M) => {
3048
- const J = e(n, b);
3053
+ }, $n = (t, e) => t * e, jn = (t) => t && (t.ok || t.status >= 400 && t.status < 500), In = ({ delayTimer: t = 500, delayRamp: e = $n, maxAttempts: n = 10, until: s = jn, onRetry: r = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (d, h) => {
3054
+ let x = 0;
3055
+ if (o && o(d, h))
3056
+ return c(d, h);
3057
+ const T = (w, N) => Promise.resolve(s(w, N)).then((te) => te ? w && i ? w : N ? Promise.reject(N) : w : (x++, !n || x <= n ? new Promise((O) => {
3058
+ const V = e(t, x);
3049
3059
  setTimeout(() => {
3050
3060
  typeof r == "function" ? Promise.resolve(r({
3051
3061
  response: w,
3052
- error: Z,
3053
- url: u,
3054
- attempt: b,
3055
- options: p
3056
- })).then((D = {}) => {
3057
- var ee, Q;
3058
- M(c((ee = D && D.url) !== null && ee !== void 0 ? ee : u, (Q = D && D.options) !== null && Q !== void 0 ? Q : p));
3059
- }) : M(c(u, p));
3060
- }, J);
3061
- }).then(C).catch((M) => {
3062
+ error: N,
3063
+ url: d,
3064
+ attempt: x,
3065
+ options: h
3066
+ })).then((E = {}) => {
3067
+ var P, H;
3068
+ O(c((P = E && E.url) !== null && P !== void 0 ? P : d, (H = E && E.options) !== null && H !== void 0 ? H : h));
3069
+ }) : O(c(d, h));
3070
+ }, V);
3071
+ }).then(T).catch((O) => {
3062
3072
  if (!a)
3063
- throw M;
3064
- return C(null, M);
3065
- }) : w && i ? w : Promise.reject(Z || new Error("Number of attempts exceeded."))));
3066
- return c(u, p).then(C).catch((w) => {
3073
+ throw O;
3074
+ return T(null, O);
3075
+ }) : w && i ? w : Promise.reject(N || new Error("Number of attempts exceeded."))));
3076
+ return c(d, h).then(T).catch((w) => {
3067
3077
  if (!a)
3068
3078
  throw w;
3069
- return C(null, w);
3079
+ return T(null, w);
3070
3080
  });
3071
- }, Ie = j({
3072
- code: Ge(),
3081
+ }, Ie = Z({
3082
+ code: et(),
3073
3083
  message: g()
3074
- }), En = j({
3084
+ }), Zn = Z({
3075
3085
  message: g()
3076
- }), Nn = j({
3077
- emails: A(g()).optional(),
3086
+ }), Pn = Z({
3087
+ emails: R(g()).optional(),
3078
3088
  http_body: g().optional(),
3079
3089
  http_url: g().optional(),
3080
3090
  txt_name: g().optional(),
3081
3091
  txt_value: g().optional()
3082
- }), jn = j({
3083
- ciphers: A(g()).optional(),
3092
+ }), Mn = Z({
3093
+ ciphers: R(g()).optional(),
3084
3094
  early_hints: g().optional(),
3085
3095
  http2: g().optional(),
3086
3096
  min_tls_version: g().optional(),
3087
3097
  tls_1_3: g().optional()
3088
- }), Zn = j({
3098
+ }), Ln = Z({
3089
3099
  id: g(),
3090
3100
  bundle_method: g().optional(),
3091
3101
  certificate_authority: g(),
@@ -3093,91 +3103,91 @@ const wn = (n, e) => e.skipDedupe || e.method !== "GET", Tn = (n, e) => e.method
3093
3103
  custom_csr_id: g().optional(),
3094
3104
  custom_key: g().optional(),
3095
3105
  expires_on: g().optional(),
3096
- hosts: A(g()).optional(),
3106
+ hosts: R(g()).optional(),
3097
3107
  issuer: g().optional(),
3098
3108
  method: g(),
3099
3109
  serial_number: g().optional(),
3100
- settings: jn.optional(),
3110
+ settings: Mn.optional(),
3101
3111
  signature: g().optional(),
3102
3112
  type: g(),
3103
3113
  uploaded_on: g().optional(),
3104
- validation_errors: A(En).optional(),
3105
- validation_records: A(Nn).optional(),
3114
+ validation_errors: R(Zn).optional(),
3115
+ validation_records: R(Pn).optional(),
3106
3116
  wildcard: Ce()
3107
- }), In = j({
3117
+ }), Dn = Z({
3108
3118
  name: g(),
3109
3119
  type: g(),
3110
3120
  value: g()
3111
- }), $n = j({
3121
+ }), Vn = Z({
3112
3122
  http_body: g().optional(),
3113
3123
  http_url: g().optional()
3114
- }), dt = j({
3124
+ }), lt = Z({
3115
3125
  id: g(),
3116
- ssl: Zn,
3126
+ ssl: Ln,
3117
3127
  hostname: g(),
3118
- custom_metadata: ct(g()).optional(),
3128
+ custom_metadata: ut(g()).optional(),
3119
3129
  custom_origin_server: g().optional(),
3120
3130
  custom_origin_sni: g().optional(),
3121
- ownership_verification: In.optional(),
3122
- ownership_verification_http: $n.optional(),
3131
+ ownership_verification: Dn.optional(),
3132
+ ownership_verification_http: Vn.optional(),
3123
3133
  status: g(),
3124
- verification_errors: A(g()).optional(),
3134
+ verification_errors: R(g()).optional(),
3125
3135
  created_at: g()
3126
- }), Oe = j({
3127
- errors: A(Ie),
3128
- messages: A(Ie),
3136
+ }), Oe = Z({
3137
+ errors: R(Ie),
3138
+ messages: R(Ie),
3129
3139
  success: Ce(),
3130
- result: dt
3140
+ result: lt
3131
3141
  });
3132
- j({
3133
- errors: A(Ie),
3134
- messages: A(Ie),
3142
+ Z({
3143
+ errors: R(Ie),
3144
+ messages: R(Ie),
3135
3145
  success: Ce(),
3136
- result: A(dt)
3146
+ result: R(lt)
3137
3147
  });
3138
- function te(n) {
3139
- return ft(`https://api.cloudflare.com/client/v4/zones/${n.zoneId}`).headers({
3140
- "X-Auth-Email": n.authEmail,
3141
- "X-Auth-Key": n.authKey,
3148
+ function ne(t) {
3149
+ return _t(`https://api.cloudflare.com/client/v4/zones/${t.zoneId}`).headers({
3150
+ "X-Auth-Email": t.authEmail,
3151
+ "X-Auth-Key": t.authKey,
3142
3152
  "Content-Type": "application/json"
3143
- }).middlewares([Rn(), Cn()]);
3153
+ }).middlewares([In(), Nn()]);
3144
3154
  }
3145
- function Fe(n) {
3155
+ function Ue(t) {
3146
3156
  const e = [];
3147
- if (n.ssl.validation_records)
3148
- for (const t of n.ssl.validation_records)
3149
- t.txt_name && t.txt_value && e.push({
3157
+ if (t.ssl.validation_records)
3158
+ for (const n of t.ssl.validation_records)
3159
+ n.txt_name && n.txt_value && e.push({
3150
3160
  name: "txt",
3151
- record: t.txt_value,
3152
- domain: t.txt_name
3161
+ record: n.txt_value,
3162
+ domain: n.txt_name
3153
3163
  });
3154
- return n.ownership_verification && e.push({
3164
+ return t.ownership_verification && e.push({
3155
3165
  name: "txt",
3156
- record: n.ownership_verification.value,
3157
- domain: n.ownership_verification.name
3166
+ record: t.ownership_verification.value,
3167
+ domain: t.ownership_verification.name
3158
3168
  }), {
3159
- custom_domain_id: n.id,
3160
- domain: n.hostname,
3161
- primary: n.primary,
3162
- status: n.status === "active" ? "ready" : "pending",
3169
+ custom_domain_id: t.id,
3170
+ domain: t.hostname,
3171
+ primary: t.primary,
3172
+ status: t.status === "active" ? "ready" : "pending",
3163
3173
  type: "auth0_managed_certs",
3164
3174
  verification: {
3165
- methods: A(lt).parse(e)
3175
+ methods: R(yt).parse(e)
3166
3176
  }
3167
3177
  };
3168
3178
  }
3169
- function Pn(n) {
3179
+ function zn(t) {
3170
3180
  return {
3171
- create: async (e, t) => {
3181
+ create: async (e, n) => {
3172
3182
  const { result: s, errors: r, success: a } = Oe.parse(
3173
- await te(n).post(
3183
+ await ne(t).post(
3174
3184
  {
3175
- hostname: t.domain,
3185
+ hostname: n.domain,
3176
3186
  ssl: {
3177
3187
  method: "txt",
3178
3188
  type: "dv"
3179
3189
  },
3180
- custom_metadata: n.enterprise ? {
3190
+ custom_metadata: t.enterprise ? {
3181
3191
  tenant_id: e
3182
3192
  } : void 0
3183
3193
  },
@@ -3186,42 +3196,42 @@ function Pn(n) {
3186
3196
  );
3187
3197
  if (!a)
3188
3198
  throw new Error(JSON.stringify(r));
3189
- const i = Fe({
3199
+ const i = Ue({
3190
3200
  ...s,
3191
3201
  primary: !1
3192
3202
  });
3193
- return await n.customDomainAdapter.create(e, {
3203
+ return await t.customDomainAdapter.create(e, {
3194
3204
  custom_domain_id: i.custom_domain_id,
3195
3205
  domain: i.domain,
3196
3206
  type: i.type
3197
3207
  }), i;
3198
3208
  },
3199
- get: async (e, t) => {
3200
- const s = await n.customDomainAdapter.get(
3209
+ get: async (e, n) => {
3210
+ const s = await t.customDomainAdapter.get(
3201
3211
  e,
3202
- t
3212
+ n
3203
3213
  );
3204
3214
  if (!s)
3205
3215
  throw new le(404);
3206
- const r = await te(n).get(`/custom_hostnames/${encodeURIComponent(t)}`).json(), { result: a, errors: i, success: o } = Oe.parse(r);
3216
+ const r = await ne(t).get(`/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: a, errors: i, success: o } = Oe.parse(r);
3207
3217
  if (!o)
3208
3218
  throw new le(503, {
3209
3219
  message: JSON.stringify(i)
3210
3220
  });
3211
- if (n.enterprise && a.custom_metadata?.tenant_id !== e)
3221
+ if (t.enterprise && a.custom_metadata?.tenant_id !== e)
3212
3222
  throw new le(404);
3213
- return Fe({ ...s, ...a });
3223
+ return Ue({ ...s, ...a });
3214
3224
  },
3215
- getByDomain: async (e) => n.customDomainAdapter.getByDomain(e),
3225
+ getByDomain: async (e) => t.customDomainAdapter.getByDomain(e),
3216
3226
  list: async (e) => {
3217
- const t = await n.customDomainAdapter.list(e);
3227
+ const n = await t.customDomainAdapter.list(e);
3218
3228
  return (await Promise.all(
3219
- t.map(async (r) => {
3229
+ n.map(async (r) => {
3220
3230
  try {
3221
- const a = await te(n).get(
3231
+ const a = await ne(t).get(
3222
3232
  `/custom_hostnames/${encodeURIComponent(r.custom_domain_id)}`
3223
3233
  ).json(), { result: i, success: o } = Oe.parse(a);
3224
- return !o || n.enterprise && i.custom_metadata?.tenant_id !== e ? null : Fe({
3234
+ return !o || t.enterprise && i.custom_metadata?.tenant_id !== e ? null : Ue({
3225
3235
  ...r,
3226
3236
  ...i
3227
3237
  });
@@ -3231,35 +3241,35 @@ function Pn(n) {
3231
3241
  })
3232
3242
  )).filter((r) => r !== null);
3233
3243
  },
3234
- remove: async (e, t) => {
3235
- if (n.enterprise) {
3244
+ remove: async (e, n) => {
3245
+ if (t.enterprise) {
3236
3246
  const { result: r, success: a } = Oe.parse(
3237
- await te(n).get(`/custom_hostnames/${encodeURIComponent(t)}`).json()
3247
+ await ne(t).get(`/custom_hostnames/${encodeURIComponent(n)}`).json()
3238
3248
  );
3239
3249
  if (!a || r.custom_metadata?.tenant_id !== e)
3240
3250
  throw new le(404);
3241
3251
  }
3242
- const s = await te(n).delete(`/custom_hostnames/${encodeURIComponent(t)}`).res();
3243
- return s.ok && await n.customDomainAdapter.remove(e, t), s.ok;
3252
+ const s = await ne(t).delete(`/custom_hostnames/${encodeURIComponent(n)}`).res();
3253
+ return s.ok && await t.customDomainAdapter.remove(e, n), s.ok;
3244
3254
  },
3245
- update: async (e, t, s) => {
3246
- const r = await te(n).patch(
3255
+ update: async (e, n, s) => {
3256
+ const r = await ne(t).patch(
3247
3257
  s,
3248
- `/custom_hostnames/${encodeURIComponent(t)}`
3258
+ `/custom_hostnames/${encodeURIComponent(n)}`
3249
3259
  ).res();
3250
3260
  if (!r.ok)
3251
3261
  throw new le(503, {
3252
3262
  message: await r.text()
3253
3263
  });
3254
- return n.customDomainAdapter.update(
3264
+ return t.customDomainAdapter.update(
3255
3265
  e,
3256
- t,
3266
+ n,
3257
3267
  s
3258
3268
  );
3259
3269
  }
3260
3270
  };
3261
3271
  }
3262
- class Mn {
3272
+ class Bn {
3263
3273
  constructor(e) {
3264
3274
  this.config = e;
3265
3275
  }
@@ -3281,39 +3291,39 @@ class Mn {
3281
3291
  }
3282
3292
  async get(e) {
3283
3293
  try {
3284
- const t = await this.getCache(), s = this.createRequest(e), r = await t.match(s);
3294
+ const n = await this.getCache(), s = this.createRequest(e), r = await n.match(s);
3285
3295
  if (!r)
3286
3296
  return null;
3287
3297
  const a = await r.json();
3288
3298
  return a.expiresAt && new Date(a.expiresAt) < /* @__PURE__ */ new Date() ? (await this.delete(e), null) : a.value;
3289
- } catch (t) {
3290
- return console.error(`CloudflareCache: get error for key ${e}:`, t), null;
3299
+ } catch (n) {
3300
+ return console.error(`CloudflareCache: get error for key ${e}:`, n), null;
3291
3301
  }
3292
3302
  }
3293
- async set(e, t, s) {
3303
+ async set(e, n, s) {
3294
3304
  try {
3295
3305
  const r = await this.getCache(), a = s ?? this.config.defaultTtlSeconds, i = a !== void 0, o = i ? Math.max(0, a) : 0, c = {
3296
- value: t,
3306
+ value: n,
3297
3307
  expiresAt: i ? new Date(Date.now() + (o > 0 ? o * 1e3 : -1)).toISOString() : void 0,
3298
3308
  cachedAt: (/* @__PURE__ */ new Date()).toISOString()
3299
- }, u = this.createRequest(e), p = {
3309
+ }, d = this.createRequest(e), h = {
3300
3310
  "Content-Type": "application/json"
3301
3311
  };
3302
- i && o > 0 && (p["Cache-Control"] = `max-age=${o}`);
3303
- const b = new Response(JSON.stringify(c), {
3304
- headers: p
3312
+ i && o > 0 && (h["Cache-Control"] = `max-age=${o}`);
3313
+ const x = new Response(JSON.stringify(c), {
3314
+ headers: h
3305
3315
  });
3306
- await r.put(u, b);
3316
+ await r.put(d, x);
3307
3317
  } catch (r) {
3308
3318
  console.error(`CloudflareCache: set error for key ${e}:`, r);
3309
3319
  }
3310
3320
  }
3311
3321
  async delete(e) {
3312
3322
  try {
3313
- const t = await this.getCache(), s = this.createRequest(e);
3314
- return await t.delete(s);
3315
- } catch (t) {
3316
- return console.error(`CloudflareCache: delete error for key ${e}:`, t), !1;
3323
+ const n = await this.getCache(), s = this.createRequest(e);
3324
+ return await n.delete(s);
3325
+ } catch (n) {
3326
+ return console.error(`CloudflareCache: delete error for key ${e}:`, n), !1;
3317
3327
  }
3318
3328
  }
3319
3329
  async clear() {
@@ -3322,32 +3332,32 @@ class Mn {
3322
3332
  );
3323
3333
  }
3324
3334
  }
3325
- function Dn(n = {}) {
3335
+ function Fn(t = {}) {
3326
3336
  const e = {
3327
3337
  defaultTtlSeconds: 300,
3328
3338
  // 5 minutes default
3329
3339
  keyPrefix: "authhero",
3330
3340
  // default prefix
3331
- ...n
3341
+ ...t
3332
3342
  // user config overrides defaults
3333
3343
  };
3334
- return new Mn(e);
3344
+ return new Bn(e);
3335
3345
  }
3336
- const Ln = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3337
- let Vn = (n = 21) => {
3338
- let e = "", t = crypto.getRandomValues(new Uint8Array(n |= 0));
3339
- for (; n--; )
3340
- e += Ln[t[n] & 63];
3346
+ const qn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3347
+ let ft = (t = 21) => {
3348
+ let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
3349
+ for (; t--; )
3350
+ e += qn[n[t] & 63];
3341
3351
  return e;
3342
3352
  };
3343
- async function He(n, e) {
3344
- const t = n.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), t);
3353
+ async function Ye(t, e) {
3354
+ const n = t.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), n);
3345
3355
  try {
3346
- const a = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${n.accountId}/r2-sql/query/${n.warehouseName}`, i = await fetch(a, {
3356
+ const a = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${t.accountId}/r2-sql/query/${t.warehouseName}`, i = await fetch(a, {
3347
3357
  method: "POST",
3348
3358
  headers: {
3349
3359
  "Content-Type": "application/json",
3350
- Authorization: `Bearer ${n.authToken}`
3360
+ Authorization: `Bearer ${t.authToken}`
3351
3361
  },
3352
3362
  // Request body should be shaped as { "query": "..." }
3353
3363
  body: JSON.stringify({
@@ -3367,80 +3377,30 @@ async function He(n, e) {
3367
3377
  clearTimeout(r);
3368
3378
  }
3369
3379
  }
3370
- function $e(n) {
3371
- return `'${n.replace(/'/g, "''")}'`;
3380
+ function Ze(t) {
3381
+ return `'${t.replace(/'/g, "''")}'`;
3372
3382
  }
3373
- function B(n) {
3374
- return `"${n.replace(/"/g, '""')}"`;
3383
+ function q(t) {
3384
+ return `"${t.replace(/"/g, '""')}"`;
3375
3385
  }
3376
- function ut(n) {
3377
- const e = (t) => {
3378
- if (!t)
3386
+ function ht(t) {
3387
+ const e = (n) => {
3388
+ if (!n)
3379
3389
  return "";
3380
3390
  try {
3381
- return JSON.parse(t);
3391
+ return JSON.parse(n);
3382
3392
  } catch {
3383
- return t;
3393
+ return n;
3384
3394
  }
3385
3395
  };
3386
3396
  return {
3387
- type: n.type,
3388
- date: n.date,
3389
- description: n.description,
3390
- ip: n.ip,
3391
- user_agent: n.user_agent,
3392
- details: e(n.details),
3393
- isMobile: !!n.isMobile,
3394
- user_id: n.user_id,
3395
- user_name: n.user_name,
3396
- connection: n.connection,
3397
- connection_id: n.connection_id,
3398
- client_id: n.client_id,
3399
- client_name: n.client_name,
3400
- audience: n.audience,
3401
- scope: n.scope,
3402
- strategy: n.strategy,
3403
- strategy_type: n.strategy_type,
3404
- hostname: n.hostname,
3405
- auth0_client: e(n.auth0_client),
3406
- log_id: n.id,
3407
- // Include location_info if any geo fields are present
3408
- location_info: n.country_code || n.city_name || n.latitude || n.longitude || n.time_zone || n.continent_code ? {
3409
- country_code: n.country_code || "",
3410
- city_name: n.city_name || "",
3411
- latitude: n.latitude || "",
3412
- longitude: n.longitude || "",
3413
- time_zone: n.time_zone || "",
3414
- continent_code: n.continent_code || ""
3415
- } : void 0
3416
- };
3417
- }
3418
- function zn(n) {
3419
- return async (e, t) => {
3420
- if (n.baseAdapter) {
3421
- const a = await n.baseAdapter.create(e, t);
3422
- return (n.pipelineEndpoint || n.pipelineBinding) && tt(n, e, a).catch((i) => {
3423
- console.error("Failed to send log to Pipeline:", i);
3424
- }), a;
3425
- }
3426
- const s = t.log_id || Vn(), r = {
3427
- ...t,
3428
- log_id: s
3429
- };
3430
- return await tt(n, e, r), r;
3431
- };
3432
- }
3433
- async function tt(n, e, t) {
3434
- const s = (a) => a ? JSON.stringify(a) : void 0, r = {
3435
- id: t.log_id,
3436
- tenant_id: e,
3437
3397
  type: t.type,
3438
3398
  date: t.date,
3439
- description: t.description?.substring(0, 256),
3399
+ description: t.description,
3440
3400
  ip: t.ip,
3441
3401
  user_agent: t.user_agent,
3442
- details: s(t.details)?.substring(0, 8192),
3443
- isMobile: t.isMobile ? 1 : 0,
3402
+ details: e(t.details),
3403
+ isMobile: !!t.isMobile,
3444
3404
  user_id: t.user_id,
3445
3405
  user_name: t.user_name,
3446
3406
  connection: t.connection,
@@ -3452,23 +3412,67 @@ async function tt(n, e, t) {
3452
3412
  strategy: t.strategy,
3453
3413
  strategy_type: t.strategy_type,
3454
3414
  hostname: t.hostname,
3455
- auth0_client: s(t.auth0_client),
3456
- log_id: t.log_id,
3415
+ auth0_client: e(t.auth0_client),
3416
+ log_id: t.id,
3417
+ // Include location_info if any geo fields are present
3418
+ location_info: t.country_code || t.city_name || t.latitude || t.longitude || t.time_zone || t.continent_code ? {
3419
+ country_code: t.country_code || "",
3420
+ city_name: t.city_name || "",
3421
+ latitude: t.latitude || "",
3422
+ longitude: t.longitude || "",
3423
+ time_zone: t.time_zone || "",
3424
+ continent_code: t.continent_code || ""
3425
+ } : void 0
3426
+ };
3427
+ }
3428
+ function Un(t) {
3429
+ return async (e, n) => {
3430
+ const s = n.log_id || ft(), r = {
3431
+ ...n,
3432
+ log_id: s
3433
+ };
3434
+ return await Wn(t, e, r), r;
3435
+ };
3436
+ }
3437
+ async function Wn(t, e, n) {
3438
+ const s = (a) => a ? JSON.stringify(a) : void 0, r = {
3439
+ id: n.log_id,
3440
+ tenant_id: e,
3441
+ type: n.type,
3442
+ date: n.date,
3443
+ description: n.description?.substring(0, 256),
3444
+ ip: n.ip,
3445
+ user_agent: n.user_agent,
3446
+ details: s(n.details)?.substring(0, 8192),
3447
+ isMobile: n.isMobile ? 1 : 0,
3448
+ user_id: n.user_id,
3449
+ user_name: n.user_name,
3450
+ connection: n.connection,
3451
+ connection_id: n.connection_id,
3452
+ client_id: n.client_id,
3453
+ client_name: n.client_name,
3454
+ audience: n.audience,
3455
+ scope: n.scope,
3456
+ strategy: n.strategy,
3457
+ strategy_type: n.strategy_type,
3458
+ hostname: n.hostname,
3459
+ auth0_client: s(n.auth0_client),
3460
+ log_id: n.log_id,
3457
3461
  // Geo fields from location_info
3458
- country_code: t.location_info?.country_code,
3459
- city_name: t.location_info?.city_name,
3460
- latitude: t.location_info?.latitude,
3461
- longitude: t.location_info?.longitude,
3462
- time_zone: t.location_info?.time_zone,
3463
- continent_code: t.location_info?.continent_code
3462
+ country_code: n.location_info?.country_code,
3463
+ city_name: n.location_info?.city_name,
3464
+ latitude: n.location_info?.latitude,
3465
+ longitude: n.location_info?.longitude,
3466
+ time_zone: n.location_info?.time_zone,
3467
+ continent_code: n.location_info?.continent_code
3464
3468
  };
3465
3469
  try {
3466
- if (n.pipelineBinding)
3467
- await n.pipelineBinding.send([r]);
3468
- else if (n.pipelineEndpoint) {
3469
- const a = n.timeout || 3e4, i = new AbortController(), o = setTimeout(() => i.abort(), a);
3470
+ if (t.pipelineBinding)
3471
+ await t.pipelineBinding.send([r]);
3472
+ else if (t.pipelineEndpoint) {
3473
+ const a = t.timeout || 3e4, i = new AbortController(), o = setTimeout(() => i.abort(), a);
3470
3474
  try {
3471
- const c = await fetch(n.pipelineEndpoint, {
3475
+ const c = await fetch(t.pipelineEndpoint, {
3472
3476
  method: "POST",
3473
3477
  headers: {
3474
3478
  "Content-Type": "application/json"
@@ -3492,109 +3496,357 @@ async function tt(n, e, t) {
3492
3496
  throw console.error("Failed to send log to Pipeline:", a), a;
3493
3497
  }
3494
3498
  }
3495
- function Bn(n) {
3496
- return async (e, t) => {
3497
- if (n.baseAdapter)
3498
- return n.baseAdapter.get(e, t);
3499
- const s = n.namespace || "default", r = n.tableName || "logs", a = `
3500
- SELECT * FROM ${B(s)}.${B(r)}
3501
- WHERE tenant_id = ${$e(e)}
3502
- AND id = ${$e(t)}
3499
+ function Jn(t) {
3500
+ return async (e, n) => {
3501
+ const s = t.namespace || "default", r = t.tableName || "logs", a = `
3502
+ SELECT * FROM ${q(s)}.${q(r)}
3503
+ WHERE tenant_id = ${Ze(e)}
3504
+ AND id = ${Ze(n)}
3503
3505
  LIMIT 1
3504
- `, i = await He(n, a);
3506
+ `, i = await Ye(t, a);
3505
3507
  if (i.length === 0)
3506
3508
  return null;
3507
3509
  const o = i[0];
3508
- return o ? ut(o) : null;
3510
+ return o ? ht(o) : null;
3509
3511
  };
3510
3512
  }
3511
- function Un(n) {
3513
+ function Qn(t) {
3512
3514
  const e = {};
3513
- return (n.match(/(\w+):(\S+)/g) || []).forEach((s) => {
3515
+ return (t.match(/(\w+):(\S+)/g) || []).forEach((s) => {
3514
3516
  const [r, a] = s.split(":");
3515
3517
  r && a && (e[r] = a);
3516
3518
  }), e;
3517
3519
  }
3518
- function Fn(n) {
3520
+ function Hn(t) {
3519
3521
  const e = [];
3520
- for (const [t, s] of Object.entries(n)) {
3521
- const r = t.replace(/[^a-zA-Z0-9_]/g, "");
3522
+ for (const [n, s] of Object.entries(t)) {
3523
+ const r = n.replace(/[^a-zA-Z0-9_]/g, "");
3522
3524
  r && s && e.push(
3523
- `${B(r)} = ${$e(s)}`
3525
+ `${q(r)} = ${Ze(s)}`
3524
3526
  );
3525
3527
  }
3526
3528
  return e;
3527
3529
  }
3528
- function qn(n) {
3529
- return async (e, t = {}) => {
3530
- if (n.baseAdapter)
3531
- return n.baseAdapter.list(e, t);
3532
- const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = t, c = n.namespace || "default", u = n.tableName || "logs", p = [
3533
- `tenant_id = ${$e(e)}`
3530
+ function Yn(t) {
3531
+ return async (e, n = {}) => {
3532
+ const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = n, c = t.namespace || "default", d = t.tableName || "logs", h = [
3533
+ `tenant_id = ${Ze(e)}`
3534
3534
  ];
3535
3535
  if (o) {
3536
- const H = Un(o);
3537
- p.push(...Fn(H));
3536
+ const Y = Qn(o);
3537
+ h.push(...Hn(Y));
3538
3538
  }
3539
- const b = p.join(" AND ");
3540
- let C = "ORDER BY date DESC";
3539
+ const x = h.join(" AND ");
3540
+ let T = "ORDER BY date DESC";
3541
3541
  if (i && i.sort_by) {
3542
- const H = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), de = i.sort_order === "asc" ? "ASC" : "DESC";
3543
- C = `ORDER BY ${B(H)} ${de}`;
3542
+ const Y = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), de = i.sort_order === "asc" ? "ASC" : "DESC";
3543
+ T = `ORDER BY ${q(Y)} ${de}`;
3544
3544
  }
3545
- const w = s * r, Z = `LIMIT ${r} OFFSET ${w}`, ce = `
3546
- SELECT * FROM ${B(c)}.${B(u)}
3547
- WHERE ${b}
3548
- ${C}
3549
- ${Z}
3550
- `, J = (await He(n, ce)).map(ut);
3545
+ const w = s * r, N = `LIMIT ${r} OFFSET ${w}`, te = `
3546
+ SELECT * FROM ${q(c)}.${q(d)}
3547
+ WHERE ${x}
3548
+ ${T}
3549
+ ${N}
3550
+ `, V = (await Ye(t, te)).map(ht);
3551
3551
  if (!a)
3552
3552
  return {
3553
- logs: J,
3553
+ logs: V,
3554
3554
  start: 0,
3555
3555
  limit: 0,
3556
3556
  length: 0
3557
3557
  };
3558
- const D = `
3559
- SELECT COUNT(*) as count FROM ${B(c)}.${B(u)}
3560
- WHERE ${b}
3561
- `, Q = (await He(n, D))[0]?.count || 0;
3558
+ const E = `
3559
+ SELECT COUNT(*) as count FROM ${q(c)}.${q(d)}
3560
+ WHERE ${x}
3561
+ `, H = (await Ye(t, E))[0]?.count || 0;
3562
3562
  return {
3563
- logs: J,
3563
+ logs: V,
3564
3564
  start: w,
3565
3565
  limit: r,
3566
- length: Number(Q)
3566
+ length: Number(H)
3567
3567
  };
3568
3568
  };
3569
3569
  }
3570
- function Wn(n) {
3571
- const e = !!n.baseAdapter, t = !!n.pipelineEndpoint, s = !!n.pipelineBinding;
3572
- if (!e && !t && !s)
3570
+ function Gn(t) {
3571
+ const e = !!t.pipelineEndpoint, n = !!t.pipelineBinding;
3572
+ if (!e && !n)
3573
3573
  throw new Error(
3574
- 'R2 SQL logs adapter requires one of: "baseAdapter", "pipelineEndpoint", or "pipelineBinding"'
3574
+ 'R2 SQL logs adapter requires one of: "pipelineEndpoint" or "pipelineBinding"'
3575
3575
  );
3576
- if (!e) {
3577
- if (!n.authToken)
3578
- throw new Error('R2 SQL logs adapter requires "authToken" configuration');
3579
- if (!n.warehouseName)
3576
+ if (!t.authToken)
3577
+ throw new Error('R2 SQL logs adapter requires "authToken" configuration');
3578
+ if (!t.warehouseName)
3579
+ throw new Error(
3580
+ 'R2 SQL logs adapter requires "warehouseName" configuration'
3581
+ );
3582
+ return {
3583
+ create: Un(t),
3584
+ list: Yn(t),
3585
+ get: Jn(t)
3586
+ };
3587
+ }
3588
+ async function Ge(t, e) {
3589
+ const n = t.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), n);
3590
+ try {
3591
+ const a = `https://api.cloudflare.com/client/v4/accounts/${t.accountId}/analytics_engine/sql`, i = await fetch(a, {
3592
+ method: "POST",
3593
+ headers: {
3594
+ "Content-Type": "text/plain",
3595
+ Authorization: `Bearer ${t.apiToken}`
3596
+ },
3597
+ body: e,
3598
+ signal: s.signal
3599
+ });
3600
+ if (!i.ok) {
3601
+ const c = await i.text();
3580
3602
  throw new Error(
3581
- 'R2 SQL logs adapter requires "warehouseName" configuration'
3603
+ `Analytics Engine query failed: ${i.status} ${i.statusText} - ${c}`
3582
3604
  );
3605
+ }
3606
+ const o = await i.json();
3607
+ if (!o.success && o.errors && o.errors.length > 0)
3608
+ throw new Error(
3609
+ `Analytics Engine error: ${o.errors.map((c) => c.message).join(", ")}`
3610
+ );
3611
+ return o.data || [];
3612
+ } finally {
3613
+ clearTimeout(r);
3614
+ }
3615
+ }
3616
+ function Pe(t) {
3617
+ return `'${t.replace(/'/g, "''").replace(/\\/g, "\\\\")}'`;
3618
+ }
3619
+ function Ke(t) {
3620
+ return `"${t.replace(/"/g, '""')}"`;
3621
+ }
3622
+ function pt(t) {
3623
+ const e = (r) => {
3624
+ if (r)
3625
+ try {
3626
+ return JSON.parse(r);
3627
+ } catch {
3628
+ return;
3629
+ }
3630
+ }, n = t.double2 || t.timestamp, s = n ? new Date(n).toISOString() : "";
3631
+ return {
3632
+ log_id: t.blob1,
3633
+ type: t.blob3,
3634
+ date: s,
3635
+ description: t.blob4,
3636
+ ip: t.blob5,
3637
+ user_agent: t.blob6,
3638
+ user_id: t.blob7,
3639
+ user_name: t.blob8,
3640
+ connection: t.blob9,
3641
+ connection_id: t.blob10,
3642
+ client_id: t.blob11,
3643
+ client_name: t.blob12,
3644
+ audience: t.blob13,
3645
+ scope: t.blob14,
3646
+ strategy: t.blob15,
3647
+ strategy_type: t.blob16,
3648
+ hostname: t.blob17,
3649
+ details: e(t.blob18),
3650
+ auth0_client: e(t.blob19),
3651
+ location_info: e(t.blob20),
3652
+ isMobile: t.double1 === 1
3653
+ };
3654
+ }
3655
+ function Kn(t) {
3656
+ return async (e, n) => {
3657
+ const s = n.log_id || ft(), r = {
3658
+ ...n,
3659
+ log_id: s
3660
+ };
3661
+ return Xn(t, e, r), r;
3662
+ };
3663
+ }
3664
+ function Xn(t, e, n) {
3665
+ if (!t.analyticsEngineBinding) {
3666
+ console.error("Analytics Engine binding not configured");
3667
+ return;
3583
3668
  }
3669
+ const s = (a) => a == null ? "" : typeof a == "string" ? a : JSON.stringify(a), r = (a, i = 1024) => a.substring(0, i);
3670
+ try {
3671
+ t.analyticsEngineBinding.writeDataPoint({
3672
+ blobs: [
3673
+ r(n.log_id),
3674
+ // blob1: log_id
3675
+ r(e),
3676
+ // blob2: tenant_id
3677
+ r(n.type || ""),
3678
+ // blob3: type
3679
+ r(n.description || ""),
3680
+ // blob4: description
3681
+ r(n.ip || ""),
3682
+ // blob5: ip
3683
+ r(n.user_agent || ""),
3684
+ // blob6: user_agent
3685
+ r(n.user_id || ""),
3686
+ // blob7: user_id
3687
+ r(n.user_name || ""),
3688
+ // blob8: user_name
3689
+ r(n.connection || ""),
3690
+ // blob9: connection
3691
+ r(n.connection_id || ""),
3692
+ // blob10: connection_id
3693
+ r(n.client_id || ""),
3694
+ // blob11: client_id
3695
+ r(n.client_name || ""),
3696
+ // blob12: client_name
3697
+ r(n.audience || ""),
3698
+ // blob13: audience
3699
+ r(n.scope || ""),
3700
+ // blob14: scope
3701
+ r(n.strategy || ""),
3702
+ // blob15: strategy
3703
+ r(n.strategy_type || ""),
3704
+ // blob16: strategy_type
3705
+ r(n.hostname || ""),
3706
+ // blob17: hostname
3707
+ r(s(n.details)),
3708
+ // blob18: details (JSON)
3709
+ r(s(n.auth0_client)),
3710
+ // blob19: auth0_client (JSON)
3711
+ r(s(n.location_info))
3712
+ // blob20: location_info (JSON)
3713
+ ],
3714
+ doubles: [
3715
+ n.isMobile ? 1 : 0,
3716
+ // double1: isMobile
3717
+ new Date(n.date).getTime()
3718
+ // double2: timestamp for sorting
3719
+ ],
3720
+ indexes: [e.substring(0, 96)]
3721
+ // index1: tenant_id
3722
+ });
3723
+ } catch (a) {
3724
+ console.error("Failed to write log to Analytics Engine:", a);
3725
+ }
3726
+ }
3727
+ function es(t) {
3728
+ return async (e, n) => {
3729
+ const s = t.dataset || "authhero_logs", r = `
3730
+ SELECT *
3731
+ FROM ${Ke(s)}
3732
+ WHERE index1 = ${Pe(e)}
3733
+ AND blob1 = ${Pe(n)}
3734
+ LIMIT 1
3735
+ `, a = await Ge(t, r);
3736
+ return a.length === 0 || !a[0] ? null : pt(a[0]);
3737
+ };
3738
+ }
3739
+ function ts(t) {
3740
+ const e = {};
3741
+ return (t.match(/(\w+):(\S+)/g) || []).forEach((s) => {
3742
+ const r = s.indexOf(":"), a = s.substring(0, r), i = s.substring(r + 1);
3743
+ a && i && (e[a] = i);
3744
+ }), e;
3745
+ }
3746
+ function mt(t) {
3584
3747
  return {
3585
- create: zn(n),
3586
- list: qn(n),
3587
- get: Bn(n)
3748
+ log_id: "blob1",
3749
+ tenant_id: "blob2",
3750
+ type: "blob3",
3751
+ description: "blob4",
3752
+ ip: "blob5",
3753
+ user_agent: "blob6",
3754
+ user_id: "blob7",
3755
+ user_name: "blob8",
3756
+ connection: "blob9",
3757
+ connection_id: "blob10",
3758
+ client_id: "blob11",
3759
+ client_name: "blob12",
3760
+ audience: "blob13",
3761
+ scope: "blob14",
3762
+ strategy: "blob15",
3763
+ strategy_type: "blob16",
3764
+ hostname: "blob17"
3765
+ }[t] || null;
3766
+ }
3767
+ function ns(t) {
3768
+ const e = [];
3769
+ for (const [n, s] of Object.entries(t)) {
3770
+ const r = mt(n);
3771
+ r && s && e.push(`${r} = ${Pe(s)}`);
3772
+ }
3773
+ return e;
3774
+ }
3775
+ function ss(t) {
3776
+ if (t === "date")
3777
+ return "double2";
3778
+ const e = mt(t);
3779
+ return e || "timestamp";
3780
+ }
3781
+ function rs(t) {
3782
+ return async (e, n = {}) => {
3783
+ const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = n, c = t.dataset || "authhero_logs", d = [`index1 = ${Pe(e)}`];
3784
+ if (o) {
3785
+ const E = ts(o);
3786
+ d.push(...ns(E));
3787
+ }
3788
+ const h = d.join(" AND ");
3789
+ let x = "ORDER BY timestamp DESC";
3790
+ if (i && i.sort_by) {
3791
+ const E = ss(i.sort_by), P = i.sort_order === "asc" ? "ASC" : "DESC";
3792
+ x = `ORDER BY ${E} ${P}`;
3793
+ }
3794
+ const T = s * r, w = `LIMIT ${r} OFFSET ${T}`, N = `
3795
+ SELECT *
3796
+ FROM ${Ke(c)}
3797
+ WHERE ${h}
3798
+ ${x}
3799
+ ${w}
3800
+ `, O = (await Ge(t, N)).map(pt);
3801
+ if (!a)
3802
+ return {
3803
+ logs: O,
3804
+ start: 0,
3805
+ limit: 0,
3806
+ length: 0
3807
+ };
3808
+ const V = `
3809
+ SELECT count() as count
3810
+ FROM ${Ke(c)}
3811
+ WHERE ${h}
3812
+ `;
3813
+ try {
3814
+ const P = (await Ge(t, V))[0]?.count || 0;
3815
+ return {
3816
+ logs: O,
3817
+ start: T,
3818
+ limit: r,
3819
+ length: Number(P)
3820
+ };
3821
+ } catch {
3822
+ return {
3823
+ logs: O,
3824
+ start: T,
3825
+ limit: r,
3826
+ length: O.length
3827
+ };
3828
+ }
3829
+ };
3830
+ }
3831
+ function as(t) {
3832
+ return t.analyticsEngineBinding || console.warn(
3833
+ "Analytics Engine: No binding configured. Logs will not be written to Analytics Engine."
3834
+ ), (!t.accountId || !t.apiToken) && console.warn(
3835
+ "Analytics Engine: accountId and apiToken are required for querying logs via SQL API."
3836
+ ), {
3837
+ create: Kn(t),
3838
+ list: rs(t),
3839
+ get: es(t)
3588
3840
  };
3589
3841
  }
3590
- function Jn() {
3842
+ function is() {
3591
3843
  return {
3592
- async getGeoInfo(n) {
3844
+ async getGeoInfo(t) {
3593
3845
  try {
3594
- const e = n["cf-ipcountry"], t = n["cf-ipcity"], s = n["cf-iplatitude"], r = n["cf-iplongitude"], a = n["cf-timezone"], i = n["cf-ipcontinent"];
3846
+ const e = t["cf-ipcountry"], n = t["cf-ipcity"], s = t["cf-iplatitude"], r = t["cf-iplongitude"], a = t["cf-timezone"], i = t["cf-ipcontinent"];
3595
3847
  return e ? {
3596
3848
  country_code: e,
3597
- city_name: t || "",
3849
+ city_name: n || "",
3598
3850
  latitude: s || "",
3599
3851
  longitude: r || "",
3600
3852
  time_zone: a || "",
@@ -3606,23 +3858,27 @@ function Jn() {
3606
3858
  }
3607
3859
  };
3608
3860
  }
3609
- function Yn(n) {
3861
+ function ds(t) {
3610
3862
  const e = {
3611
- customDomains: Pn(n),
3863
+ customDomains: zn(t),
3612
3864
  // Always create a cache adapter (let createCloudflareCache apply defaults)
3613
- cache: Dn({
3614
- ...n.cacheName && { cacheName: n.cacheName },
3615
- ...n.defaultTtlSeconds !== void 0 && {
3616
- defaultTtlSeconds: n.defaultTtlSeconds
3865
+ cache: Fn({
3866
+ ...t.cacheName && { cacheName: t.cacheName },
3867
+ ...t.defaultTtlSeconds !== void 0 && {
3868
+ defaultTtlSeconds: t.defaultTtlSeconds
3617
3869
  },
3618
- ...n.keyPrefix && { keyPrefix: n.keyPrefix }
3870
+ ...t.keyPrefix && { keyPrefix: t.keyPrefix }
3619
3871
  }),
3620
3872
  // Always create the geo adapter - it extracts location from Cloudflare headers
3621
3873
  // passed at request time via getGeoInfo(headers)
3622
- geo: Jn()
3874
+ geo: is()
3623
3875
  };
3624
- return n.r2SqlLogs && (e.logs = Wn(n.r2SqlLogs)), e;
3876
+ return t.r2SqlLogs ? e.logs = Gn(t.r2SqlLogs) : t.analyticsEngineLogs && (e.logs = as(
3877
+ t.analyticsEngineLogs
3878
+ )), e;
3625
3879
  }
3626
3880
  export {
3627
- Yn as default
3881
+ as as createAnalyticsEngineLogsAdapter,
3882
+ Gn as createR2SQLLogsAdapter,
3883
+ ds as default
3628
3884
  };