@authhero/cloudflare-adapter 2.21.18 → 2.22.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,40 +1,40 @@
1
1
  import { verificationMethodsSchema as ft } from "@authhero/adapter-interfaces";
2
2
  import pt from "wretch";
3
3
  function mt(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]);
4
+ var s = {};
5
+ for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (s[n] = t[n]);
6
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;
7
+ for (var r = 0, n = Object.getOwnPropertySymbols(t); r < n.length; r++)
8
+ e.indexOf(n[r]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[r]) && (s[n[r]] = t[n[r]]);
9
+ return s;
10
10
  }
11
- function _t(t, e) {
12
- var n;
13
- return ((n = t?._def) === null || n === void 0 ? void 0 : n.typeName) === e;
11
+ function yt(t, e) {
12
+ var s;
13
+ return ((s = t?._def) === null || s === void 0 ? void 0 : s.typeName) === e;
14
14
  }
15
15
  function ae(t, e) {
16
- const n = t.ZodType.prototype[e];
17
- t.ZodType.prototype[e] = function(...s) {
18
- const r = n.apply(this, s);
16
+ const s = t.ZodType.prototype[e];
17
+ t.ZodType.prototype[e] = function(...n) {
18
+ const r = s.apply(this, n);
19
19
  return r._def.openapi = this._def.openapi, r;
20
20
  };
21
21
  }
22
- function yt(t) {
22
+ function _t(t) {
23
23
  if (typeof t.ZodType.prototype.openapi < "u")
24
24
  return;
25
25
  t.ZodType.prototype.openapi = function(r, a) {
26
26
  var i, o, c, u, p, k;
27
- const T = typeof r == "string" ? a : r, S = T ?? {}, { param: E } = S, q = mt(S, ["param"]), x = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof r == "string" ? { refId: r } : void 0), L = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), q), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || E ? {
27
+ const C = typeof r == "string" ? a : r, S = C ?? {}, { param: E } = S, q = mt(S, ["param"]), x = Object.assign(Object.assign({}, (i = this._def.openapi) === null || i === void 0 ? void 0 : i._internal), typeof r == "string" ? { refId: r } : void 0), L = Object.assign(Object.assign(Object.assign({}, (o = this._def.openapi) === null || o === void 0 ? void 0 : o.metadata), q), !((u = (c = this._def.openapi) === null || c === void 0 ? void 0 : c.metadata) === null || u === void 0) && u.param || E ? {
28
28
  param: Object.assign(Object.assign({}, (k = (p = this._def.openapi) === null || p === void 0 ? void 0 : p.metadata) === null || k === void 0 ? void 0 : k.param), E)
29
29
  } : void 0), O = new this.constructor(Object.assign(Object.assign({}, this._def), { openapi: Object.assign(Object.assign({}, Object.keys(x).length > 0 ? { _internal: x } : void 0), Object.keys(L).length > 0 ? { metadata: L } : void 0) }));
30
- if (_t(this, "ZodObject")) {
30
+ if (yt(this, "ZodObject")) {
31
31
  const j = this.extend;
32
32
  O.extend = function(...W) {
33
- var Q, re, we, Se, Te, Ce, Ee;
33
+ var J, re, we, Se, Ce, Te, Ee;
34
34
  const Oe = j.apply(this, W);
35
35
  return Oe._def.openapi = {
36
36
  _internal: {
37
- extendedFrom: !((re = (Q = this._def.openapi) === null || Q === void 0 ? void 0 : Q._internal) === null || re === void 0) && re.refId ? { refId: (Se = (we = this._def.openapi) === null || we === void 0 ? void 0 : we._internal) === null || Se === void 0 ? void 0 : Se.refId, schema: this } : (Ce = (Te = this._def.openapi) === null || Te === void 0 ? void 0 : Te._internal) === null || Ce === void 0 ? void 0 : Ce.extendedFrom
37
+ extendedFrom: !((re = (J = this._def.openapi) === null || J === void 0 ? void 0 : J._internal) === null || re === void 0) && re.refId ? { refId: (Se = (we = this._def.openapi) === null || we === void 0 ? void 0 : we._internal) === null || Se === void 0 ? void 0 : Se.refId, schema: this } : (Te = (Ce = this._def.openapi) === null || Ce === void 0 ? void 0 : Ce._internal) === null || Te === void 0 ? void 0 : Te.extendedFrom
38
38
  },
39
39
  metadata: (Ee = Oe._def.openapi) === null || Ee === void 0 ? void 0 : Ee.metadata
40
40
  }, Oe;
@@ -50,14 +50,14 @@ function yt(t) {
50
50
  c._def.openapi = (p = (u = r[o]) === null || u === void 0 ? void 0 : u._def) === null || p === void 0 ? void 0 : p.openapi;
51
51
  }), a._def.openapi = void 0, a;
52
52
  };
53
- const n = t.ZodObject.prototype.pick;
53
+ const s = t.ZodObject.prototype.pick;
54
54
  t.ZodObject.prototype.pick = function(...r) {
55
- const a = n.apply(this, r);
55
+ const a = s.apply(this, r);
56
56
  return a._def.openapi = void 0, a;
57
57
  };
58
- const s = t.ZodObject.prototype.omit;
58
+ const n = t.ZodObject.prototype.omit;
59
59
  t.ZodObject.prototype.omit = function(...r) {
60
- const a = s.apply(this, r);
60
+ const a = n.apply(this, r);
61
61
  return a._def.openapi = void 0, a;
62
62
  };
63
63
  }
@@ -94,10 +94,10 @@ var b;
94
94
  function e(r) {
95
95
  }
96
96
  t.assertIs = e;
97
- function n(r) {
97
+ function s(r) {
98
98
  throw new Error();
99
99
  }
100
- t.assertNever = n, t.arrayToEnum = (r) => {
100
+ t.assertNever = s, t.arrayToEnum = (r) => {
101
101
  const a = {};
102
102
  for (const i of r)
103
103
  a[i] = i;
@@ -119,19 +119,19 @@ var b;
119
119
  if (a(i))
120
120
  return i;
121
121
  }, t.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
122
- function s(r, a = " | ") {
122
+ function n(r, a = " | ") {
123
123
  return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
124
124
  }
125
- t.joinValues = s, t.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
125
+ t.joinValues = n, t.jsonStringifyReplacer = (r, a) => typeof a == "bigint" ? a.toString() : a;
126
126
  })(b || (b = {}));
127
- var Re;
127
+ var $e;
128
128
  (function(t) {
129
- t.mergeShapes = (e, n) => ({
129
+ t.mergeShapes = (e, s) => ({
130
130
  ...e,
131
- ...n
131
+ ...s
132
132
  // second overwrites first
133
133
  });
134
- })(Re || (Re = {}));
134
+ })($e || ($e = {}));
135
135
  const h = b.arrayToEnum([
136
136
  "string",
137
137
  "nan",
@@ -197,18 +197,18 @@ class Z extends Error {
197
197
  return this.issues;
198
198
  }
199
199
  constructor(e) {
200
- super(), this.issues = [], this.addIssue = (s) => {
201
- this.issues = [...this.issues, s];
202
- }, this.addIssues = (s = []) => {
203
- this.issues = [...this.issues, ...s];
200
+ super(), this.issues = [], this.addIssue = (n) => {
201
+ this.issues = [...this.issues, n];
202
+ }, this.addIssues = (n = []) => {
203
+ this.issues = [...this.issues, ...n];
204
204
  };
205
- const n = new.target.prototype;
206
- Object.setPrototypeOf ? Object.setPrototypeOf(this, n) : this.__proto__ = n, this.name = "ZodError", this.issues = e;
205
+ const s = new.target.prototype;
206
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, s) : this.__proto__ = s, this.name = "ZodError", this.issues = e;
207
207
  }
208
208
  format(e) {
209
- const n = e || function(a) {
209
+ const s = e || function(a) {
210
210
  return a.message;
211
- }, s = { _errors: [] }, r = (a) => {
211
+ }, n = { _errors: [] }, r = (a) => {
212
212
  for (const i of a.issues)
213
213
  if (i.code === "invalid_union")
214
214
  i.unionErrors.map(r);
@@ -217,16 +217,16 @@ class Z extends Error {
217
217
  else if (i.code === "invalid_arguments")
218
218
  r(i.argumentsError);
219
219
  else if (i.path.length === 0)
220
- s._errors.push(n(i));
220
+ n._errors.push(s(i));
221
221
  else {
222
- let o = s, c = 0;
222
+ let o = n, c = 0;
223
223
  for (; c < i.path.length; ) {
224
224
  const u = i.path[c];
225
- c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(n(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
225
+ c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(s(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
226
226
  }
227
227
  }
228
228
  };
229
- return r(this), s;
229
+ return r(this), n;
230
230
  }
231
231
  static assert(e) {
232
232
  if (!(e instanceof Z))
@@ -241,15 +241,15 @@ class Z extends Error {
241
241
  get isEmpty() {
242
242
  return this.issues.length === 0;
243
243
  }
244
- flatten(e = (n) => n.message) {
245
- const n = {}, s = [];
244
+ flatten(e = (s) => s.message) {
245
+ const s = {}, n = [];
246
246
  for (const r of this.issues)
247
247
  if (r.path.length > 0) {
248
248
  const a = r.path[0];
249
- n[a] = n[a] || [], n[a].push(e(r));
249
+ s[a] = s[a] || [], s[a].push(e(r));
250
250
  } else
251
- s.push(e(r));
252
- return { formErrors: s, fieldErrors: n };
251
+ n.push(e(r));
252
+ return { formErrors: n, fieldErrors: s };
253
253
  }
254
254
  get formErrors() {
255
255
  return this.flatten();
@@ -257,67 +257,67 @@ class Z extends Error {
257
257
  }
258
258
  Z.create = (t) => new Z(t);
259
259
  const pe = (t, e) => {
260
- let n;
260
+ let s;
261
261
  switch (t.code) {
262
262
  case d.invalid_type:
263
- t.received === h.undefined ? n = "Required" : n = `Expected ${t.expected}, received ${t.received}`;
263
+ t.received === h.undefined ? s = "Required" : s = `Expected ${t.expected}, received ${t.received}`;
264
264
  break;
265
265
  case d.invalid_literal:
266
- n = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
266
+ s = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
267
267
  break;
268
268
  case d.unrecognized_keys:
269
- n = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
269
+ s = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
270
270
  break;
271
271
  case d.invalid_union:
272
- n = "Invalid input";
272
+ s = "Invalid input";
273
273
  break;
274
274
  case d.invalid_union_discriminator:
275
- n = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
275
+ s = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
276
276
  break;
277
277
  case d.invalid_enum_value:
278
- n = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
278
+ s = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
279
279
  break;
280
280
  case d.invalid_arguments:
281
- n = "Invalid function arguments";
281
+ s = "Invalid function arguments";
282
282
  break;
283
283
  case d.invalid_return_type:
284
- n = "Invalid function return type";
284
+ s = "Invalid function return type";
285
285
  break;
286
286
  case d.invalid_date:
287
- n = "Invalid date";
287
+ s = "Invalid date";
288
288
  break;
289
289
  case d.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";
290
+ typeof t.validation == "object" ? "includes" in t.validation ? (s = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (s = `${s} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? s = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? s = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? s = `Invalid ${t.validation}` : s = "Invalid";
291
291
  break;
292
292
  case d.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";
293
+ t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? s = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : s = "Invalid input";
294
294
  break;
295
295
  case d.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";
296
+ t.type === "array" ? s = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "less than"} ${t.maximum} element(s)` : t.type === "string" ? s = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at most" : "under"} ${t.maximum} character(s)` : t.type === "number" ? s = `Number must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "bigint" ? s = `BigInt must be ${t.exact ? "exactly" : t.inclusive ? "less than or equal to" : "less than"} ${t.maximum}` : t.type === "date" ? s = `Date must be ${t.exact ? "exactly" : t.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(t.maximum))}` : s = "Invalid input";
297
297
  break;
298
298
  case d.custom:
299
- n = "Invalid input";
299
+ s = "Invalid input";
300
300
  break;
301
301
  case d.invalid_intersection_types:
302
- n = "Intersection results could not be merged";
302
+ s = "Intersection results could not be merged";
303
303
  break;
304
304
  case d.not_multiple_of:
305
- n = `Number must be a multiple of ${t.multipleOf}`;
305
+ s = `Number must be a multiple of ${t.multipleOf}`;
306
306
  break;
307
307
  case d.not_finite:
308
- n = "Number must be finite";
308
+ s = "Number must be finite";
309
309
  break;
310
310
  default:
311
- n = e.defaultError, b.assertNever(t);
311
+ s = e.defaultError, b.assertNever(t);
312
312
  }
313
- return { message: n };
313
+ return { message: s };
314
314
  };
315
315
  let gt = pe;
316
316
  function Xe() {
317
317
  return gt;
318
318
  }
319
319
  const et = (t) => {
320
- const { data: e, path: n, errorMaps: s, issueData: r } = t, a = [...n, ...r.path || []], i = {
320
+ const { data: e, path: s, errorMaps: n, issueData: r } = t, a = [...s, ...r.path || []], i = {
321
321
  ...r,
322
322
  path: a
323
323
  };
@@ -328,7 +328,7 @@ const et = (t) => {
328
328
  message: r.message
329
329
  };
330
330
  let o = "";
331
- const c = s.filter((u) => !!u).slice().reverse();
331
+ const c = n.filter((u) => !!u).slice().reverse();
332
332
  for (const u of c)
333
333
  o = u(i, { data: e, defaultError: o }).message;
334
334
  return {
@@ -338,7 +338,7 @@ const et = (t) => {
338
338
  };
339
339
  };
340
340
  function l(t, e) {
341
- const n = Xe(), s = et({
341
+ const s = Xe(), n = et({
342
342
  issueData: e,
343
343
  data: t.data,
344
344
  path: t.path,
@@ -347,15 +347,15 @@ function l(t, e) {
347
347
  // contextual error map is first priority
348
348
  t.schemaErrorMap,
349
349
  // then schema-bound map if available
350
- n,
350
+ s,
351
351
  // then global override map
352
- n === pe ? void 0 : pe
352
+ s === pe ? void 0 : pe
353
353
  // then global default map
354
354
  ].filter((r) => !!r)
355
355
  });
356
- t.common.issues.push(s);
356
+ t.common.issues.push(n);
357
357
  }
358
- class C {
358
+ class T {
359
359
  constructor() {
360
360
  this.value = "valid";
361
361
  }
@@ -365,54 +365,54 @@ class C {
365
365
  abort() {
366
366
  this.value !== "aborted" && (this.value = "aborted");
367
367
  }
368
- static mergeArray(e, n) {
369
- const s = [];
370
- for (const r of n) {
368
+ static mergeArray(e, s) {
369
+ const n = [];
370
+ for (const r of s) {
371
371
  if (r.status === "aborted")
372
- return _;
373
- r.status === "dirty" && e.dirty(), s.push(r.value);
372
+ return y;
373
+ r.status === "dirty" && e.dirty(), n.push(r.value);
374
374
  }
375
- return { status: e.value, value: s };
375
+ return { status: e.value, value: n };
376
376
  }
377
- static async mergeObjectAsync(e, n) {
378
- const s = [];
379
- for (const r of n) {
377
+ static async mergeObjectAsync(e, s) {
378
+ const n = [];
379
+ for (const r of s) {
380
380
  const a = await r.key, i = await r.value;
381
- s.push({
381
+ n.push({
382
382
  key: a,
383
383
  value: i
384
384
  });
385
385
  }
386
- return C.mergeObjectSync(e, s);
386
+ return T.mergeObjectSync(e, n);
387
387
  }
388
- static mergeObjectSync(e, n) {
389
- const s = {};
390
- for (const r of n) {
388
+ static mergeObjectSync(e, s) {
389
+ const n = {};
390
+ for (const r of s) {
391
391
  const { key: a, value: i } = r;
392
392
  if (a.status === "aborted" || i.status === "aborted")
393
- return _;
394
- a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (s[a.value] = i.value);
393
+ return y;
394
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (n[a.value] = i.value);
395
395
  }
396
- return { status: e.value, value: s };
396
+ return { status: e.value, value: n };
397
397
  }
398
398
  }
399
- const _ = Object.freeze({
399
+ const y = Object.freeze({
400
400
  status: "aborted"
401
- }), te = (t) => ({ status: "dirty", value: t }), N = (t) => ({ status: "valid", value: t }), $e = (t) => t.status === "aborted", je = (t) => t.status === "dirty", J = (t) => t.status === "valid", oe = (t) => typeof Promise < "u" && t instanceof Promise;
401
+ }), te = (t) => ({ status: "dirty", value: t }), N = (t) => ({ status: "valid", value: t }), Re = (t) => t.status === "aborted", je = (t) => t.status === "dirty", Q = (t) => t.status === "valid", oe = (t) => typeof Promise < "u" && t instanceof Promise;
402
402
  var f;
403
403
  (function(t) {
404
404
  t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e?.message;
405
405
  })(f || (f = {}));
406
406
  class D {
407
- constructor(e, n, s, r) {
408
- this._cachedPath = [], this.parent = e, this.data = n, this._path = s, this._key = r;
407
+ constructor(e, s, n, r) {
408
+ this._cachedPath = [], this.parent = e, this.data = s, this._path = n, this._key = r;
409
409
  }
410
410
  get path() {
411
411
  return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
412
412
  }
413
413
  }
414
414
  const He = (t, e) => {
415
- if (J(e))
415
+ if (Q(e))
416
416
  return { success: !0, data: e.value };
417
417
  if (!t.common.issues.length)
418
418
  throw new Error("Validation failed but no issues detected.");
@@ -421,20 +421,20 @@ const He = (t, e) => {
421
421
  get error() {
422
422
  if (this._error)
423
423
  return this._error;
424
- const n = new Z(t.common.issues);
425
- return this._error = n, this._error;
424
+ const s = new Z(t.common.issues);
425
+ return this._error = s, this._error;
426
426
  }
427
427
  };
428
428
  };
429
429
  function g(t) {
430
430
  if (!t)
431
431
  return {};
432
- const { errorMap: e, invalid_type_error: n, required_error: s, description: r } = t;
433
- if (e && (n || s))
432
+ const { errorMap: e, invalid_type_error: s, required_error: n, description: r } = t;
433
+ if (e && (s || n))
434
434
  throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
435
435
  return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
436
436
  const { message: c } = t;
437
- 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 };
437
+ return i.code === "invalid_enum_value" ? { message: c ?? o.defaultError } : typeof o.data > "u" ? { message: c ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: c ?? s ?? o.defaultError };
438
438
  }, description: r };
439
439
  }
440
440
  class v {
@@ -444,8 +444,8 @@ class v {
444
444
  _getType(e) {
445
445
  return P(e.data);
446
446
  }
447
- _getOrReturnCtx(e, n) {
448
- return n || {
447
+ _getOrReturnCtx(e, s) {
448
+ return s || {
449
449
  common: e.parent.common,
450
450
  data: e.data,
451
451
  parsedType: P(e.data),
@@ -456,7 +456,7 @@ class v {
456
456
  }
457
457
  _processInputParams(e) {
458
458
  return {
459
- status: new C(),
459
+ status: new T(),
460
460
  ctx: {
461
461
  common: e.parent.common,
462
462
  data: e.data,
@@ -468,38 +468,38 @@ class v {
468
468
  };
469
469
  }
470
470
  _parseSync(e) {
471
- const n = this._parse(e);
472
- if (oe(n))
471
+ const s = this._parse(e);
472
+ if (oe(s))
473
473
  throw new Error("Synchronous parse encountered promise.");
474
- return n;
474
+ return s;
475
475
  }
476
476
  _parseAsync(e) {
477
- const n = this._parse(e);
478
- return Promise.resolve(n);
477
+ const s = this._parse(e);
478
+ return Promise.resolve(s);
479
479
  }
480
- parse(e, n) {
481
- const s = this.safeParse(e, n);
482
- if (s.success)
483
- return s.data;
484
- throw s.error;
480
+ parse(e, s) {
481
+ const n = this.safeParse(e, s);
482
+ if (n.success)
483
+ return n.data;
484
+ throw n.error;
485
485
  }
486
- safeParse(e, n) {
487
- const s = {
486
+ safeParse(e, s) {
487
+ const n = {
488
488
  common: {
489
489
  issues: [],
490
- async: n?.async ?? !1,
491
- contextualErrorMap: n?.errorMap
490
+ async: s?.async ?? !1,
491
+ contextualErrorMap: s?.errorMap
492
492
  },
493
- path: n?.path || [],
493
+ path: s?.path || [],
494
494
  schemaErrorMap: this._def.errorMap,
495
495
  parent: null,
496
496
  data: e,
497
497
  parsedType: P(e)
498
- }, r = this._parseSync({ data: e, path: s.path, parent: s });
499
- return He(s, r);
498
+ }, r = this._parseSync({ data: e, path: n.path, parent: n });
499
+ return He(n, r);
500
500
  }
501
501
  "~validate"(e) {
502
- const n = {
502
+ const s = {
503
503
  common: {
504
504
  issues: [],
505
505
  async: !!this["~standard"].async
@@ -512,60 +512,60 @@ class v {
512
512
  };
513
513
  if (!this["~standard"].async)
514
514
  try {
515
- const s = this._parseSync({ data: e, path: [], parent: n });
516
- return J(s) ? {
517
- value: s.value
515
+ const n = this._parseSync({ data: e, path: [], parent: s });
516
+ return Q(n) ? {
517
+ value: n.value
518
518
  } : {
519
- issues: n.common.issues
519
+ issues: s.common.issues
520
520
  };
521
- } catch (s) {
522
- s?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), n.common = {
521
+ } catch (n) {
522
+ n?.message?.toLowerCase()?.includes("encountered") && (this["~standard"].async = !0), s.common = {
523
523
  issues: [],
524
524
  async: !0
525
525
  };
526
526
  }
527
- return this._parseAsync({ data: e, path: [], parent: n }).then((s) => J(s) ? {
528
- value: s.value
527
+ return this._parseAsync({ data: e, path: [], parent: s }).then((n) => Q(n) ? {
528
+ value: n.value
529
529
  } : {
530
- issues: n.common.issues
530
+ issues: s.common.issues
531
531
  });
532
532
  }
533
- async parseAsync(e, n) {
534
- const s = await this.safeParseAsync(e, n);
535
- if (s.success)
536
- return s.data;
537
- throw s.error;
533
+ async parseAsync(e, s) {
534
+ const n = await this.safeParseAsync(e, s);
535
+ if (n.success)
536
+ return n.data;
537
+ throw n.error;
538
538
  }
539
- async safeParseAsync(e, n) {
540
- const s = {
539
+ async safeParseAsync(e, s) {
540
+ const n = {
541
541
  common: {
542
542
  issues: [],
543
- contextualErrorMap: n?.errorMap,
543
+ contextualErrorMap: s?.errorMap,
544
544
  async: !0
545
545
  },
546
- path: n?.path || [],
546
+ path: s?.path || [],
547
547
  schemaErrorMap: this._def.errorMap,
548
548
  parent: null,
549
549
  data: e,
550
550
  parsedType: P(e)
551
- }, r = this._parse({ data: e, path: s.path, parent: s }), a = await (oe(r) ? r : Promise.resolve(r));
552
- return He(s, a);
551
+ }, r = this._parse({ data: e, path: n.path, parent: n }), a = await (oe(r) ? r : Promise.resolve(r));
552
+ return He(n, a);
553
553
  }
554
- refine(e, n) {
555
- const s = (r) => typeof n == "string" || typeof n > "u" ? { message: n } : typeof n == "function" ? n(r) : n;
554
+ refine(e, s) {
555
+ const n = (r) => typeof s == "string" || typeof s > "u" ? { message: s } : typeof s == "function" ? s(r) : s;
556
556
  return this._refinement((r, a) => {
557
557
  const i = e(r), o = () => a.addIssue({
558
558
  code: d.custom,
559
- ...s(r)
559
+ ...n(r)
560
560
  });
561
561
  return typeof Promise < "u" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
562
562
  });
563
563
  }
564
- refinement(e, n) {
565
- return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof n == "function" ? n(s, r) : n), !1));
564
+ refinement(e, s) {
565
+ return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof s == "function" ? s(n, r) : s), !1));
566
566
  }
567
567
  _refinement(e) {
568
- return new U({
568
+ return new F({
569
569
  schema: this,
570
570
  typeName: m.ZodEffects,
571
571
  effect: { type: "refinement", refinement: e }
@@ -578,11 +578,11 @@ class v {
578
578
  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"] = {
579
579
  version: 1,
580
580
  vendor: "zod",
581
- validate: (n) => this["~validate"](n)
581
+ validate: (s) => this["~validate"](s)
582
582
  };
583
583
  }
584
584
  optional() {
585
- return V.create(this, this._def);
585
+ return B.create(this, this._def);
586
586
  }
587
587
  nullable() {
588
588
  return G.create(this, this._def);
@@ -591,7 +591,7 @@ class v {
591
591
  return this.nullable().optional();
592
592
  }
593
593
  array() {
594
- return R.create(this);
594
+ return $.create(this);
595
595
  }
596
596
  promise() {
597
597
  return he.create(this, this._def);
@@ -603,7 +603,7 @@ class v {
603
603
  return ue.create(this, e, this._def);
604
604
  }
605
605
  transform(e) {
606
- return new U({
606
+ return new F({
607
607
  ...g(this._def),
608
608
  schema: this,
609
609
  typeName: m.ZodEffects,
@@ -611,11 +611,11 @@ class v {
611
611
  });
612
612
  }
613
613
  default(e) {
614
- const n = typeof e == "function" ? e : () => e;
615
- return new _e({
614
+ const s = typeof e == "function" ? e : () => e;
615
+ return new ye({
616
616
  ...g(this._def),
617
617
  innerType: this,
618
- defaultValue: n,
618
+ defaultValue: s,
619
619
  typeName: m.ZodDefault
620
620
  });
621
621
  }
@@ -627,17 +627,17 @@ class v {
627
627
  });
628
628
  }
629
629
  catch(e) {
630
- const n = typeof e == "function" ? e : () => e;
631
- return new ye({
630
+ const s = typeof e == "function" ? e : () => e;
631
+ return new _e({
632
632
  ...g(this._def),
633
633
  innerType: this,
634
- catchValue: n,
634
+ catchValue: s,
635
635
  typeName: m.ZodCatch
636
636
  });
637
637
  }
638
638
  describe(e) {
639
- const n = this.constructor;
640
- return new n({
639
+ const s = this.constructor;
640
+ return new s({
641
641
  ...this._def,
642
642
  description: e
643
643
  });
@@ -655,22 +655,22 @@ class v {
655
655
  return this.safeParse(null).success;
656
656
  }
657
657
  }
658
- const vt = /^c[^\s-]{8,}$/i, bt = /^[0-9a-z]+$/, xt = /^[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, St = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Tt = /^[-+]?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, Et = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
658
+ const vt = /^c[^\s-]{8,}$/i, bt = /^[0-9a-z]+$/, xt = /^[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, St = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ct = /^[-+]?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)?)??$/, Tt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Et = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
659
659
  let Ae;
660
- const Ot = /^(?:(?: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])$/, 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])\/(3[0-2]|[12]?[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]))$/, Rt = /^(([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])$/, $t = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, jt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, tt = "((\\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(`^${tt}$`);
661
- function nt(t) {
660
+ const Ot = /^(?:(?: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])$/, 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])\/(3[0-2]|[12]?[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]))$/, $t = /^(([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])$/, Rt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, jt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, tt = "((\\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(`^${tt}$`);
661
+ function st(t) {
662
662
  let e = "[0-5]\\d";
663
663
  t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
664
- const n = t.precision ? "+" : "?";
665
- return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`;
664
+ const s = t.precision ? "+" : "?";
665
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${s}`;
666
666
  }
667
667
  function Zt(t) {
668
- return new RegExp(`^${nt(t)}$`);
668
+ return new RegExp(`^${st(t)}$`);
669
669
  }
670
- function st(t) {
671
- let e = `${tt}T${nt(t)}`;
672
- const n = [];
673
- return n.push(t.local ? "Z?" : "Z"), t.offset && n.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${n.join("|")})`, new RegExp(`^${e}$`);
670
+ function nt(t) {
671
+ let e = `${tt}T${st(t)}`;
672
+ const s = [];
673
+ return s.push(t.local ? "Z?" : "Z"), t.offset && s.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${s.join("|")})`, new RegExp(`^${e}$`);
674
674
  }
675
675
  function Dt(t, e) {
676
676
  return !!((e === "v4" || !e) && Ot.test(t) || (e === "v6" || !e) && Nt.test(t));
@@ -679,17 +679,17 @@ function Lt(t, e) {
679
679
  if (!St.test(t))
680
680
  return !1;
681
681
  try {
682
- const [n] = t.split(".");
683
- if (!n)
682
+ const [s] = t.split(".");
683
+ if (!s)
684
684
  return !1;
685
- const s = n.replace(/-/g, "+").replace(/_/g, "/").padEnd(n.length + (4 - n.length % 4) % 4, "="), r = JSON.parse(atob(s));
685
+ const n = s.replace(/-/g, "+").replace(/_/g, "/").padEnd(s.length + (4 - s.length % 4) % 4, "="), r = JSON.parse(atob(n));
686
686
  return !(typeof r != "object" || r === null || "typ" in r && r?.typ !== "JWT" || !r.alg || e && r.alg !== e);
687
687
  } catch {
688
688
  return !1;
689
689
  }
690
690
  }
691
691
  function Pt(t, e) {
692
- return !!((e === "v4" || !e) && At.test(t) || (e === "v6" || !e) && Rt.test(t));
692
+ return !!((e === "v4" || !e) && At.test(t) || (e === "v6" || !e) && $t.test(t));
693
693
  }
694
694
  class I extends v {
695
695
  _parse(e) {
@@ -699,9 +699,9 @@ class I extends v {
699
699
  code: d.invalid_type,
700
700
  expected: h.string,
701
701
  received: a.parsedType
702
- }), _;
702
+ }), y;
703
703
  }
704
- const s = new C();
704
+ const n = new T();
705
705
  let r;
706
706
  for (const a of this._def.checks)
707
707
  if (a.kind === "min")
@@ -712,7 +712,7 @@ class I extends v {
712
712
  inclusive: !0,
713
713
  exact: !1,
714
714
  message: a.message
715
- }), s.dirty());
715
+ }), n.dirty());
716
716
  else if (a.kind === "max")
717
717
  e.data.length > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
718
718
  code: d.too_big,
@@ -721,7 +721,7 @@ class I extends v {
721
721
  inclusive: !0,
722
722
  exact: !1,
723
723
  message: a.message
724
- }), s.dirty());
724
+ }), n.dirty());
725
725
  else if (a.kind === "length") {
726
726
  const i = e.data.length > a.value, o = e.data.length < a.value;
727
727
  (i || o) && (r = this._getOrReturnCtx(e, r), i ? l(r, {
@@ -738,49 +738,49 @@ class I extends v {
738
738
  inclusive: !0,
739
739
  exact: !0,
740
740
  message: a.message
741
- }), s.dirty());
741
+ }), n.dirty());
742
742
  } else if (a.kind === "email")
743
- Ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
743
+ Tt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
744
744
  validation: "email",
745
745
  code: d.invalid_string,
746
746
  message: a.message
747
- }), s.dirty());
747
+ }), n.dirty());
748
748
  else if (a.kind === "emoji")
749
749
  Ae || (Ae = new RegExp(Et, "u")), Ae.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
750
750
  validation: "emoji",
751
751
  code: d.invalid_string,
752
752
  message: a.message
753
- }), s.dirty());
753
+ }), n.dirty());
754
754
  else if (a.kind === "uuid")
755
755
  kt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
756
756
  validation: "uuid",
757
757
  code: d.invalid_string,
758
758
  message: a.message
759
- }), s.dirty());
759
+ }), n.dirty());
760
760
  else if (a.kind === "nanoid")
761
761
  wt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
762
762
  validation: "nanoid",
763
763
  code: d.invalid_string,
764
764
  message: a.message
765
- }), s.dirty());
765
+ }), n.dirty());
766
766
  else if (a.kind === "cuid")
767
767
  vt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
768
768
  validation: "cuid",
769
769
  code: d.invalid_string,
770
770
  message: a.message
771
- }), s.dirty());
771
+ }), n.dirty());
772
772
  else if (a.kind === "cuid2")
773
773
  bt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
774
774
  validation: "cuid2",
775
775
  code: d.invalid_string,
776
776
  message: a.message
777
- }), s.dirty());
777
+ }), n.dirty());
778
778
  else if (a.kind === "ulid")
779
779
  xt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
780
780
  validation: "ulid",
781
781
  code: d.invalid_string,
782
782
  message: a.message
783
- }), s.dirty());
783
+ }), n.dirty());
784
784
  else if (a.kind === "url")
785
785
  try {
786
786
  new URL(e.data);
@@ -789,68 +789,68 @@ class I extends v {
789
789
  validation: "url",
790
790
  code: d.invalid_string,
791
791
  message: a.message
792
- }), s.dirty();
792
+ }), n.dirty();
793
793
  }
794
794
  else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
795
795
  validation: "regex",
796
796
  code: d.invalid_string,
797
797
  message: a.message
798
- }), 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, {
798
+ }), n.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, {
799
799
  code: d.invalid_string,
800
800
  validation: { includes: a.value, position: a.position },
801
801
  message: a.message
802
- }), 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, {
802
+ }), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
803
803
  code: d.invalid_string,
804
804
  validation: { startsWith: a.value },
805
805
  message: a.message
806
- }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
806
+ }), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), l(r, {
807
807
  code: d.invalid_string,
808
808
  validation: { endsWith: a.value },
809
809
  message: a.message
810
- }), s.dirty()) : a.kind === "datetime" ? st(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
810
+ }), n.dirty()) : a.kind === "datetime" ? nt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
811
811
  code: d.invalid_string,
812
812
  validation: "datetime",
813
813
  message: a.message
814
- }), s.dirty()) : a.kind === "date" ? It.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
814
+ }), n.dirty()) : a.kind === "date" ? It.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
815
815
  code: d.invalid_string,
816
816
  validation: "date",
817
817
  message: a.message
818
- }), s.dirty()) : a.kind === "time" ? Zt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
818
+ }), n.dirty()) : a.kind === "time" ? Zt(a).test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
819
819
  code: d.invalid_string,
820
820
  validation: "time",
821
821
  message: a.message
822
- }), s.dirty()) : a.kind === "duration" ? Tt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
822
+ }), n.dirty()) : a.kind === "duration" ? Ct.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
823
823
  validation: "duration",
824
824
  code: d.invalid_string,
825
825
  message: a.message
826
- }), s.dirty()) : a.kind === "ip" ? Dt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
826
+ }), n.dirty()) : a.kind === "ip" ? Dt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
827
827
  validation: "ip",
828
828
  code: d.invalid_string,
829
829
  message: a.message
830
- }), s.dirty()) : a.kind === "jwt" ? Lt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), l(r, {
830
+ }), n.dirty()) : a.kind === "jwt" ? Lt(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), l(r, {
831
831
  validation: "jwt",
832
832
  code: d.invalid_string,
833
833
  message: a.message
834
- }), s.dirty()) : a.kind === "cidr" ? Pt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
834
+ }), n.dirty()) : a.kind === "cidr" ? Pt(e.data, a.version) || (r = this._getOrReturnCtx(e, r), l(r, {
835
835
  validation: "cidr",
836
836
  code: d.invalid_string,
837
837
  message: a.message
838
- }), s.dirty()) : a.kind === "base64" ? $t.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
838
+ }), n.dirty()) : a.kind === "base64" ? Rt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
839
839
  validation: "base64",
840
840
  code: d.invalid_string,
841
841
  message: a.message
842
- }), s.dirty()) : a.kind === "base64url" ? jt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
842
+ }), n.dirty()) : a.kind === "base64url" ? jt.test(e.data) || (r = this._getOrReturnCtx(e, r), l(r, {
843
843
  validation: "base64url",
844
844
  code: d.invalid_string,
845
845
  message: a.message
846
- }), s.dirty()) : b.assertNever(a);
847
- return { status: s.value, value: e.data };
846
+ }), n.dirty()) : b.assertNever(a);
847
+ return { status: n.value, value: e.data };
848
848
  }
849
- _regex(e, n, s) {
849
+ _regex(e, s, n) {
850
850
  return this.refinement((r) => e.test(r), {
851
- validation: n,
851
+ validation: s,
852
852
  code: d.invalid_string,
853
- ...f.errToObj(s)
853
+ ...f.errToObj(n)
854
854
  });
855
855
  }
856
856
  _addCheck(e) {
@@ -933,54 +933,54 @@ class I extends v {
933
933
  duration(e) {
934
934
  return this._addCheck({ kind: "duration", ...f.errToObj(e) });
935
935
  }
936
- regex(e, n) {
936
+ regex(e, s) {
937
937
  return this._addCheck({
938
938
  kind: "regex",
939
939
  regex: e,
940
- ...f.errToObj(n)
940
+ ...f.errToObj(s)
941
941
  });
942
942
  }
943
- includes(e, n) {
943
+ includes(e, s) {
944
944
  return this._addCheck({
945
945
  kind: "includes",
946
946
  value: e,
947
- position: n?.position,
948
- ...f.errToObj(n?.message)
947
+ position: s?.position,
948
+ ...f.errToObj(s?.message)
949
949
  });
950
950
  }
951
- startsWith(e, n) {
951
+ startsWith(e, s) {
952
952
  return this._addCheck({
953
953
  kind: "startsWith",
954
954
  value: e,
955
- ...f.errToObj(n)
955
+ ...f.errToObj(s)
956
956
  });
957
957
  }
958
- endsWith(e, n) {
958
+ endsWith(e, s) {
959
959
  return this._addCheck({
960
960
  kind: "endsWith",
961
961
  value: e,
962
- ...f.errToObj(n)
962
+ ...f.errToObj(s)
963
963
  });
964
964
  }
965
- min(e, n) {
965
+ min(e, s) {
966
966
  return this._addCheck({
967
967
  kind: "min",
968
968
  value: e,
969
- ...f.errToObj(n)
969
+ ...f.errToObj(s)
970
970
  });
971
971
  }
972
- max(e, n) {
972
+ max(e, s) {
973
973
  return this._addCheck({
974
974
  kind: "max",
975
975
  value: e,
976
- ...f.errToObj(n)
976
+ ...f.errToObj(s)
977
977
  });
978
978
  }
979
- length(e, n) {
979
+ length(e, s) {
980
980
  return this._addCheck({
981
981
  kind: "length",
982
982
  value: e,
983
- ...f.errToObj(n)
983
+ ...f.errToObj(s)
984
984
  });
985
985
  }
986
986
  /**
@@ -1057,14 +1057,14 @@ class I extends v {
1057
1057
  }
1058
1058
  get minLength() {
1059
1059
  let e = null;
1060
- for (const n of this._def.checks)
1061
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1060
+ for (const s of this._def.checks)
1061
+ s.kind === "min" && (e === null || s.value > e) && (e = s.value);
1062
1062
  return e;
1063
1063
  }
1064
1064
  get maxLength() {
1065
1065
  let e = null;
1066
- for (const n of this._def.checks)
1067
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1066
+ for (const s of this._def.checks)
1067
+ s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1068
1068
  return e;
1069
1069
  }
1070
1070
  }
@@ -1075,7 +1075,7 @@ I.create = (t) => new I({
1075
1075
  ...g(t)
1076
1076
  });
1077
1077
  function Mt(t, e) {
1078
- 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(".", ""));
1078
+ const s = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = s > n ? s : n, a = Number.parseInt(t.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
1079
1079
  return a % i / 10 ** r;
1080
1080
  }
1081
1081
  class Y extends v {
@@ -1089,61 +1089,61 @@ class Y extends v {
1089
1089
  code: d.invalid_type,
1090
1090
  expected: h.number,
1091
1091
  received: a.parsedType
1092
- }), _;
1092
+ }), y;
1093
1093
  }
1094
- let s;
1095
- const r = new C();
1094
+ let n;
1095
+ const r = new T();
1096
1096
  for (const a of this._def.checks)
1097
- a.kind === "int" ? b.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1097
+ a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
1098
1098
  code: d.invalid_type,
1099
1099
  expected: "integer",
1100
1100
  received: "float",
1101
1101
  message: a.message
1102
- }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1102
+ }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1103
1103
  code: d.too_small,
1104
1104
  minimum: a.value,
1105
1105
  type: "number",
1106
1106
  inclusive: a.inclusive,
1107
1107
  exact: !1,
1108
1108
  message: a.message
1109
- }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1109
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1110
1110
  code: d.too_big,
1111
1111
  maximum: a.value,
1112
1112
  type: "number",
1113
1113
  inclusive: a.inclusive,
1114
1114
  exact: !1,
1115
1115
  message: a.message
1116
- }), r.dirty()) : a.kind === "multipleOf" ? Mt(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), l(s, {
1116
+ }), r.dirty()) : a.kind === "multipleOf" ? Mt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), l(n, {
1117
1117
  code: d.not_multiple_of,
1118
1118
  multipleOf: a.value,
1119
1119
  message: a.message
1120
- }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
1120
+ }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), l(n, {
1121
1121
  code: d.not_finite,
1122
1122
  message: a.message
1123
1123
  }), r.dirty()) : b.assertNever(a);
1124
1124
  return { status: r.value, value: e.data };
1125
1125
  }
1126
- gte(e, n) {
1127
- return this.setLimit("min", e, !0, f.toString(n));
1126
+ gte(e, s) {
1127
+ return this.setLimit("min", e, !0, f.toString(s));
1128
1128
  }
1129
- gt(e, n) {
1130
- return this.setLimit("min", e, !1, f.toString(n));
1129
+ gt(e, s) {
1130
+ return this.setLimit("min", e, !1, f.toString(s));
1131
1131
  }
1132
- lte(e, n) {
1133
- return this.setLimit("max", e, !0, f.toString(n));
1132
+ lte(e, s) {
1133
+ return this.setLimit("max", e, !0, f.toString(s));
1134
1134
  }
1135
- lt(e, n) {
1136
- return this.setLimit("max", e, !1, f.toString(n));
1135
+ lt(e, s) {
1136
+ return this.setLimit("max", e, !1, f.toString(s));
1137
1137
  }
1138
- setLimit(e, n, s, r) {
1138
+ setLimit(e, s, n, r) {
1139
1139
  return new Y({
1140
1140
  ...this._def,
1141
1141
  checks: [
1142
1142
  ...this._def.checks,
1143
1143
  {
1144
1144
  kind: e,
1145
- value: n,
1146
- inclusive: s,
1145
+ value: s,
1146
+ inclusive: n,
1147
1147
  message: f.toString(r)
1148
1148
  }
1149
1149
  ]
@@ -1193,11 +1193,11 @@ class Y extends v {
1193
1193
  message: f.toString(e)
1194
1194
  });
1195
1195
  }
1196
- multipleOf(e, n) {
1196
+ multipleOf(e, s) {
1197
1197
  return this._addCheck({
1198
1198
  kind: "multipleOf",
1199
1199
  value: e,
1200
- message: f.toString(n)
1200
+ message: f.toString(s)
1201
1201
  });
1202
1202
  }
1203
1203
  finite(e) {
@@ -1221,27 +1221,27 @@ class Y extends v {
1221
1221
  }
1222
1222
  get minValue() {
1223
1223
  let e = null;
1224
- for (const n of this._def.checks)
1225
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1224
+ for (const s of this._def.checks)
1225
+ s.kind === "min" && (e === null || s.value > e) && (e = s.value);
1226
1226
  return e;
1227
1227
  }
1228
1228
  get maxValue() {
1229
1229
  let e = null;
1230
- for (const n of this._def.checks)
1231
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1230
+ for (const s of this._def.checks)
1231
+ s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1232
1232
  return e;
1233
1233
  }
1234
1234
  get isInt() {
1235
1235
  return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1236
1236
  }
1237
1237
  get isFinite() {
1238
- let e = null, n = null;
1239
- for (const s of this._def.checks) {
1240
- if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
1238
+ let e = null, s = null;
1239
+ for (const n of this._def.checks) {
1240
+ if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
1241
1241
  return !0;
1242
- s.kind === "min" ? (n === null || s.value > n) && (n = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1242
+ n.kind === "min" ? (s === null || n.value > s) && (s = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1243
1243
  }
1244
- return Number.isFinite(n) && Number.isFinite(e);
1244
+ return Number.isFinite(s) && Number.isFinite(e);
1245
1245
  }
1246
1246
  }
1247
1247
  Y.create = (t) => new Y({
@@ -1250,7 +1250,7 @@ Y.create = (t) => new Y({
1250
1250
  coerce: t?.coerce || !1,
1251
1251
  ...g(t)
1252
1252
  });
1253
- class ne extends v {
1253
+ class se extends v {
1254
1254
  constructor() {
1255
1255
  super(...arguments), this.min = this.gte, this.max = this.lte;
1256
1256
  }
@@ -1263,22 +1263,22 @@ class ne extends v {
1263
1263
  }
1264
1264
  if (this._getType(e) !== h.bigint)
1265
1265
  return this._getInvalidInput(e);
1266
- let s;
1267
- const r = new C();
1266
+ let n;
1267
+ const r = new T();
1268
1268
  for (const a of this._def.checks)
1269
- a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1269
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1270
1270
  code: d.too_small,
1271
1271
  type: "bigint",
1272
1272
  minimum: a.value,
1273
1273
  inclusive: a.inclusive,
1274
1274
  message: a.message
1275
- }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), l(s, {
1275
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), l(n, {
1276
1276
  code: d.too_big,
1277
1277
  type: "bigint",
1278
1278
  maximum: a.value,
1279
1279
  inclusive: a.inclusive,
1280
1280
  message: a.message
1281
- }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), l(s, {
1281
+ }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), l(n, {
1282
1282
  code: d.not_multiple_of,
1283
1283
  multipleOf: a.value,
1284
1284
  message: a.message
@@ -1286,41 +1286,41 @@ class ne extends v {
1286
1286
  return { status: r.value, value: e.data };
1287
1287
  }
1288
1288
  _getInvalidInput(e) {
1289
- const n = this._getOrReturnCtx(e);
1290
- return l(n, {
1289
+ const s = this._getOrReturnCtx(e);
1290
+ return l(s, {
1291
1291
  code: d.invalid_type,
1292
1292
  expected: h.bigint,
1293
- received: n.parsedType
1294
- }), _;
1293
+ received: s.parsedType
1294
+ }), y;
1295
1295
  }
1296
- gte(e, n) {
1297
- return this.setLimit("min", e, !0, f.toString(n));
1296
+ gte(e, s) {
1297
+ return this.setLimit("min", e, !0, f.toString(s));
1298
1298
  }
1299
- gt(e, n) {
1300
- return this.setLimit("min", e, !1, f.toString(n));
1299
+ gt(e, s) {
1300
+ return this.setLimit("min", e, !1, f.toString(s));
1301
1301
  }
1302
- lte(e, n) {
1303
- return this.setLimit("max", e, !0, f.toString(n));
1302
+ lte(e, s) {
1303
+ return this.setLimit("max", e, !0, f.toString(s));
1304
1304
  }
1305
- lt(e, n) {
1306
- return this.setLimit("max", e, !1, f.toString(n));
1305
+ lt(e, s) {
1306
+ return this.setLimit("max", e, !1, f.toString(s));
1307
1307
  }
1308
- setLimit(e, n, s, r) {
1309
- return new ne({
1308
+ setLimit(e, s, n, r) {
1309
+ return new se({
1310
1310
  ...this._def,
1311
1311
  checks: [
1312
1312
  ...this._def.checks,
1313
1313
  {
1314
1314
  kind: e,
1315
- value: n,
1316
- inclusive: s,
1315
+ value: s,
1316
+ inclusive: n,
1317
1317
  message: f.toString(r)
1318
1318
  }
1319
1319
  ]
1320
1320
  });
1321
1321
  }
1322
1322
  _addCheck(e) {
1323
- return new ne({
1323
+ return new se({
1324
1324
  ...this._def,
1325
1325
  checks: [...this._def.checks, e]
1326
1326
  });
@@ -1357,27 +1357,27 @@ class ne extends v {
1357
1357
  message: f.toString(e)
1358
1358
  });
1359
1359
  }
1360
- multipleOf(e, n) {
1360
+ multipleOf(e, s) {
1361
1361
  return this._addCheck({
1362
1362
  kind: "multipleOf",
1363
1363
  value: e,
1364
- message: f.toString(n)
1364
+ message: f.toString(s)
1365
1365
  });
1366
1366
  }
1367
1367
  get minValue() {
1368
1368
  let e = null;
1369
- for (const n of this._def.checks)
1370
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1369
+ for (const s of this._def.checks)
1370
+ s.kind === "min" && (e === null || s.value > e) && (e = s.value);
1371
1371
  return e;
1372
1372
  }
1373
1373
  get maxValue() {
1374
1374
  let e = null;
1375
- for (const n of this._def.checks)
1376
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1375
+ for (const s of this._def.checks)
1376
+ s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1377
1377
  return e;
1378
1378
  }
1379
1379
  }
1380
- ne.create = (t) => new ne({
1380
+ se.create = (t) => new se({
1381
1381
  checks: [],
1382
1382
  typeName: m.ZodBigInt,
1383
1383
  coerce: t?.coerce ?? !1,
@@ -1386,12 +1386,12 @@ ne.create = (t) => new ne({
1386
1386
  class me extends v {
1387
1387
  _parse(e) {
1388
1388
  if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
1389
- const s = this._getOrReturnCtx(e);
1390
- return l(s, {
1389
+ const n = this._getOrReturnCtx(e);
1390
+ return l(n, {
1391
1391
  code: d.invalid_type,
1392
1392
  expected: h.boolean,
1393
- received: s.parsedType
1394
- }), _;
1393
+ received: n.parsedType
1394
+ }), y;
1395
1395
  }
1396
1396
  return N(e.data);
1397
1397
  }
@@ -1409,15 +1409,15 @@ class ce extends v {
1409
1409
  code: d.invalid_type,
1410
1410
  expected: h.date,
1411
1411
  received: a.parsedType
1412
- }), _;
1412
+ }), y;
1413
1413
  }
1414
1414
  if (Number.isNaN(e.data.getTime())) {
1415
1415
  const a = this._getOrReturnCtx(e);
1416
1416
  return l(a, {
1417
1417
  code: d.invalid_date
1418
- }), _;
1418
+ }), y;
1419
1419
  }
1420
- const s = new C();
1420
+ const n = new T();
1421
1421
  let r;
1422
1422
  for (const a of this._def.checks)
1423
1423
  a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), l(r, {
@@ -1427,16 +1427,16 @@ class ce extends v {
1427
1427
  exact: !1,
1428
1428
  minimum: a.value,
1429
1429
  type: "date"
1430
- }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1430
+ }), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), l(r, {
1431
1431
  code: d.too_big,
1432
1432
  message: a.message,
1433
1433
  inclusive: !0,
1434
1434
  exact: !1,
1435
1435
  maximum: a.value,
1436
1436
  type: "date"
1437
- }), s.dirty()) : b.assertNever(a);
1437
+ }), n.dirty()) : b.assertNever(a);
1438
1438
  return {
1439
- status: s.value,
1439
+ status: n.value,
1440
1440
  value: new Date(e.data.getTime())
1441
1441
  };
1442
1442
  }
@@ -1446,30 +1446,30 @@ class ce extends v {
1446
1446
  checks: [...this._def.checks, e]
1447
1447
  });
1448
1448
  }
1449
- min(e, n) {
1449
+ min(e, s) {
1450
1450
  return this._addCheck({
1451
1451
  kind: "min",
1452
1452
  value: e.getTime(),
1453
- message: f.toString(n)
1453
+ message: f.toString(s)
1454
1454
  });
1455
1455
  }
1456
- max(e, n) {
1456
+ max(e, s) {
1457
1457
  return this._addCheck({
1458
1458
  kind: "max",
1459
1459
  value: e.getTime(),
1460
- message: f.toString(n)
1460
+ message: f.toString(s)
1461
1461
  });
1462
1462
  }
1463
1463
  get minDate() {
1464
1464
  let e = null;
1465
- for (const n of this._def.checks)
1466
- n.kind === "min" && (e === null || n.value > e) && (e = n.value);
1465
+ for (const s of this._def.checks)
1466
+ s.kind === "min" && (e === null || s.value > e) && (e = s.value);
1467
1467
  return e != null ? new Date(e) : null;
1468
1468
  }
1469
1469
  get maxDate() {
1470
1470
  let e = null;
1471
- for (const n of this._def.checks)
1472
- n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1471
+ for (const s of this._def.checks)
1472
+ s.kind === "max" && (e === null || s.value < e) && (e = s.value);
1473
1473
  return e != null ? new Date(e) : null;
1474
1474
  }
1475
1475
  }
@@ -1482,12 +1482,12 @@ ce.create = (t) => new ce({
1482
1482
  class Ie extends v {
1483
1483
  _parse(e) {
1484
1484
  if (this._getType(e) !== h.symbol) {
1485
- const s = this._getOrReturnCtx(e);
1486
- return l(s, {
1485
+ const n = this._getOrReturnCtx(e);
1486
+ return l(n, {
1487
1487
  code: d.invalid_type,
1488
1488
  expected: h.symbol,
1489
- received: s.parsedType
1490
- }), _;
1489
+ received: n.parsedType
1490
+ }), y;
1491
1491
  }
1492
1492
  return N(e.data);
1493
1493
  }
@@ -1499,12 +1499,12 @@ Ie.create = (t) => new Ie({
1499
1499
  class Ze extends v {
1500
1500
  _parse(e) {
1501
1501
  if (this._getType(e) !== h.undefined) {
1502
- const s = this._getOrReturnCtx(e);
1503
- return l(s, {
1502
+ const n = this._getOrReturnCtx(e);
1503
+ return l(n, {
1504
1504
  code: d.invalid_type,
1505
1505
  expected: h.undefined,
1506
- received: s.parsedType
1507
- }), _;
1506
+ received: n.parsedType
1507
+ }), y;
1508
1508
  }
1509
1509
  return N(e.data);
1510
1510
  }
@@ -1516,12 +1516,12 @@ Ze.create = (t) => new Ze({
1516
1516
  class De extends v {
1517
1517
  _parse(e) {
1518
1518
  if (this._getType(e) !== h.null) {
1519
- const s = this._getOrReturnCtx(e);
1520
- return l(s, {
1519
+ const n = this._getOrReturnCtx(e);
1520
+ return l(n, {
1521
1521
  code: d.invalid_type,
1522
1522
  expected: h.null,
1523
- received: s.parsedType
1524
- }), _;
1523
+ received: n.parsedType
1524
+ }), y;
1525
1525
  }
1526
1526
  return N(e.data);
1527
1527
  }
@@ -1554,29 +1554,29 @@ Pe.create = (t) => new Pe({
1554
1554
  typeName: m.ZodUnknown,
1555
1555
  ...g(t)
1556
1556
  });
1557
- class B extends v {
1557
+ class V extends v {
1558
1558
  _parse(e) {
1559
- const n = this._getOrReturnCtx(e);
1560
- return l(n, {
1559
+ const s = this._getOrReturnCtx(e);
1560
+ return l(s, {
1561
1561
  code: d.invalid_type,
1562
1562
  expected: h.never,
1563
- received: n.parsedType
1564
- }), _;
1563
+ received: s.parsedType
1564
+ }), y;
1565
1565
  }
1566
1566
  }
1567
- B.create = (t) => new B({
1567
+ V.create = (t) => new V({
1568
1568
  typeName: m.ZodNever,
1569
1569
  ...g(t)
1570
1570
  });
1571
1571
  class Me extends v {
1572
1572
  _parse(e) {
1573
1573
  if (this._getType(e) !== h.undefined) {
1574
- const s = this._getOrReturnCtx(e);
1575
- return l(s, {
1574
+ const n = this._getOrReturnCtx(e);
1575
+ return l(n, {
1576
1576
  code: d.invalid_type,
1577
1577
  expected: h.void,
1578
- received: s.parsedType
1579
- }), _;
1578
+ received: n.parsedType
1579
+ }), y;
1580
1580
  }
1581
1581
  return N(e.data);
1582
1582
  }
@@ -1585,18 +1585,18 @@ Me.create = (t) => new Me({
1585
1585
  typeName: m.ZodVoid,
1586
1586
  ...g(t)
1587
1587
  });
1588
- class R extends v {
1588
+ class $ extends v {
1589
1589
  _parse(e) {
1590
- const { ctx: n, status: s } = this._processInputParams(e), r = this._def;
1591
- if (n.parsedType !== h.array)
1592
- return l(n, {
1590
+ const { ctx: s, status: n } = this._processInputParams(e), r = this._def;
1591
+ if (s.parsedType !== h.array)
1592
+ return l(s, {
1593
1593
  code: d.invalid_type,
1594
1594
  expected: h.array,
1595
- received: n.parsedType
1596
- }), _;
1595
+ received: s.parsedType
1596
+ }), y;
1597
1597
  if (r.exactLength !== null) {
1598
- const i = n.data.length > r.exactLength.value, o = n.data.length < r.exactLength.value;
1599
- (i || o) && (l(n, {
1598
+ const i = s.data.length > r.exactLength.value, o = s.data.length < r.exactLength.value;
1599
+ (i || o) && (l(s, {
1600
1600
  code: i ? d.too_big : d.too_small,
1601
1601
  minimum: o ? r.exactLength.value : void 0,
1602
1602
  maximum: i ? r.exactLength.value : void 0,
@@ -1604,53 +1604,53 @@ class R extends v {
1604
1604
  inclusive: !0,
1605
1605
  exact: !0,
1606
1606
  message: r.exactLength.message
1607
- }), s.dirty());
1607
+ }), n.dirty());
1608
1608
  }
1609
- if (r.minLength !== null && n.data.length < r.minLength.value && (l(n, {
1609
+ if (r.minLength !== null && s.data.length < r.minLength.value && (l(s, {
1610
1610
  code: d.too_small,
1611
1611
  minimum: r.minLength.value,
1612
1612
  type: "array",
1613
1613
  inclusive: !0,
1614
1614
  exact: !1,
1615
1615
  message: r.minLength.message
1616
- }), s.dirty()), r.maxLength !== null && n.data.length > r.maxLength.value && (l(n, {
1616
+ }), n.dirty()), r.maxLength !== null && s.data.length > r.maxLength.value && (l(s, {
1617
1617
  code: d.too_big,
1618
1618
  maximum: r.maxLength.value,
1619
1619
  type: "array",
1620
1620
  inclusive: !0,
1621
1621
  exact: !1,
1622
1622
  message: r.maxLength.message
1623
- }), s.dirty()), n.common.async)
1624
- return Promise.all([...n.data].map((i, o) => r.type._parseAsync(new D(n, i, n.path, o)))).then((i) => C.mergeArray(s, i));
1625
- const a = [...n.data].map((i, o) => r.type._parseSync(new D(n, i, n.path, o)));
1626
- return C.mergeArray(s, a);
1623
+ }), n.dirty()), s.common.async)
1624
+ return Promise.all([...s.data].map((i, o) => r.type._parseAsync(new D(s, i, s.path, o)))).then((i) => T.mergeArray(n, i));
1625
+ const a = [...s.data].map((i, o) => r.type._parseSync(new D(s, i, s.path, o)));
1626
+ return T.mergeArray(n, a);
1627
1627
  }
1628
1628
  get element() {
1629
1629
  return this._def.type;
1630
1630
  }
1631
- min(e, n) {
1632
- return new R({
1631
+ min(e, s) {
1632
+ return new $({
1633
1633
  ...this._def,
1634
- minLength: { value: e, message: f.toString(n) }
1634
+ minLength: { value: e, message: f.toString(s) }
1635
1635
  });
1636
1636
  }
1637
- max(e, n) {
1638
- return new R({
1637
+ max(e, s) {
1638
+ return new $({
1639
1639
  ...this._def,
1640
- maxLength: { value: e, message: f.toString(n) }
1640
+ maxLength: { value: e, message: f.toString(s) }
1641
1641
  });
1642
1642
  }
1643
- length(e, n) {
1644
- return new R({
1643
+ length(e, s) {
1644
+ return new $({
1645
1645
  ...this._def,
1646
- exactLength: { value: e, message: f.toString(n) }
1646
+ exactLength: { value: e, message: f.toString(s) }
1647
1647
  });
1648
1648
  }
1649
1649
  nonempty(e) {
1650
1650
  return this.min(1, e);
1651
1651
  }
1652
1652
  }
1653
- R.create = (t, e) => new R({
1653
+ $.create = (t, e) => new $({
1654
1654
  type: t,
1655
1655
  minLength: null,
1656
1656
  maxLength: null,
@@ -1661,18 +1661,18 @@ R.create = (t, e) => new R({
1661
1661
  function ee(t) {
1662
1662
  if (t instanceof w) {
1663
1663
  const e = {};
1664
- for (const n in t.shape) {
1665
- const s = t.shape[n];
1666
- e[n] = V.create(ee(s));
1664
+ for (const s in t.shape) {
1665
+ const n = t.shape[s];
1666
+ e[s] = B.create(ee(n));
1667
1667
  }
1668
1668
  return new w({
1669
1669
  ...t._def,
1670
1670
  shape: () => e
1671
1671
  });
1672
- } else return t instanceof R ? new R({
1672
+ } else return t instanceof $ ? new $({
1673
1673
  ...t._def,
1674
1674
  type: ee(t.element)
1675
- }) : t instanceof V ? V.create(ee(t.unwrap())) : t instanceof G ? G.create(ee(t.unwrap())) : t instanceof F ? F.create(t.items.map((e) => ee(e))) : t;
1675
+ }) : t instanceof B ? B.create(ee(t.unwrap())) : t instanceof G ? G.create(ee(t.unwrap())) : t instanceof z ? z.create(t.items.map((e) => ee(e))) : t;
1676
1676
  }
1677
1677
  class w extends v {
1678
1678
  constructor() {
@@ -1681,8 +1681,8 @@ class w extends v {
1681
1681
  _getCached() {
1682
1682
  if (this._cached !== null)
1683
1683
  return this._cached;
1684
- const e = this._def.shape(), n = b.objectKeys(e);
1685
- return this._cached = { shape: e, keys: n }, this._cached;
1684
+ const e = this._def.shape(), s = b.objectKeys(e);
1685
+ return this._cached = { shape: e, keys: s }, this._cached;
1686
1686
  }
1687
1687
  _parse(e) {
1688
1688
  if (this._getType(e) !== h.object) {
@@ -1691,10 +1691,10 @@ class w extends v {
1691
1691
  code: d.invalid_type,
1692
1692
  expected: h.object,
1693
1693
  received: u.parsedType
1694
- }), _;
1694
+ }), y;
1695
1695
  }
1696
- const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1697
- if (!(this._def.catchall instanceof B && this._def.unknownKeys === "strip"))
1696
+ const { status: n, ctx: r } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1697
+ if (!(this._def.catchall instanceof V && this._def.unknownKeys === "strip"))
1698
1698
  for (const u in r.data)
1699
1699
  i.includes(u) || o.push(u);
1700
1700
  const c = [];
@@ -1706,7 +1706,7 @@ class w extends v {
1706
1706
  alwaysSet: u in r.data
1707
1707
  });
1708
1708
  }
1709
- if (this._def.catchall instanceof B) {
1709
+ if (this._def.catchall instanceof V) {
1710
1710
  const u = this._def.unknownKeys;
1711
1711
  if (u === "passthrough")
1712
1712
  for (const p of o)
@@ -1718,7 +1718,7 @@ class w extends v {
1718
1718
  o.length > 0 && (l(r, {
1719
1719
  code: d.unrecognized_keys,
1720
1720
  keys: o
1721
- }), s.dirty());
1721
+ }), n.dirty());
1722
1722
  else if (u !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1723
1723
  } else {
1724
1724
  const u = this._def.catchall;
@@ -1737,15 +1737,15 @@ class w extends v {
1737
1737
  return r.common.async ? Promise.resolve().then(async () => {
1738
1738
  const u = [];
1739
1739
  for (const p of c) {
1740
- const k = await p.key, T = await p.value;
1740
+ const k = await p.key, C = await p.value;
1741
1741
  u.push({
1742
1742
  key: k,
1743
- value: T,
1743
+ value: C,
1744
1744
  alwaysSet: p.alwaysSet
1745
1745
  });
1746
1746
  }
1747
1747
  return u;
1748
- }).then((u) => C.mergeObjectSync(s, u)) : C.mergeObjectSync(s, c);
1748
+ }).then((u) => T.mergeObjectSync(n, u)) : T.mergeObjectSync(n, c);
1749
1749
  }
1750
1750
  get shape() {
1751
1751
  return this._def.shape();
@@ -1755,9 +1755,9 @@ class w extends v {
1755
1755
  ...this._def,
1756
1756
  unknownKeys: "strict",
1757
1757
  ...e !== void 0 ? {
1758
- errorMap: (n, s) => {
1759
- const r = this._def.errorMap?.(n, s).message ?? s.defaultError;
1760
- return n.code === "unrecognized_keys" ? {
1758
+ errorMap: (s, n) => {
1759
+ const r = this._def.errorMap?.(s, n).message ?? n.defaultError;
1760
+ return s.code === "unrecognized_keys" ? {
1761
1761
  message: f.errToObj(e).message ?? r
1762
1762
  } : {
1763
1763
  message: r
@@ -1855,8 +1855,8 @@ class w extends v {
1855
1855
  // }) as any;
1856
1856
  // return merged;
1857
1857
  // }
1858
- setKey(e, n) {
1859
- return this.augment({ [e]: n });
1858
+ setKey(e, s) {
1859
+ return this.augment({ [e]: s });
1860
1860
  }
1861
1861
  // merge<Incoming extends AnyZodObject>(
1862
1862
  // merging: Incoming
@@ -1886,21 +1886,21 @@ class w extends v {
1886
1886
  });
1887
1887
  }
1888
1888
  pick(e) {
1889
- const n = {};
1890
- for (const s of b.objectKeys(e))
1891
- e[s] && this.shape[s] && (n[s] = this.shape[s]);
1889
+ const s = {};
1890
+ for (const n of b.objectKeys(e))
1891
+ e[n] && this.shape[n] && (s[n] = this.shape[n]);
1892
1892
  return new w({
1893
1893
  ...this._def,
1894
- shape: () => n
1894
+ shape: () => s
1895
1895
  });
1896
1896
  }
1897
1897
  omit(e) {
1898
- const n = {};
1899
- for (const s of b.objectKeys(this.shape))
1900
- e[s] || (n[s] = this.shape[s]);
1898
+ const s = {};
1899
+ for (const n of b.objectKeys(this.shape))
1900
+ e[n] || (s[n] = this.shape[n]);
1901
1901
  return new w({
1902
1902
  ...this._def,
1903
- shape: () => n
1903
+ shape: () => s
1904
1904
  });
1905
1905
  }
1906
1906
  /**
@@ -1910,30 +1910,30 @@ class w extends v {
1910
1910
  return ee(this);
1911
1911
  }
1912
1912
  partial(e) {
1913
- const n = {};
1914
- for (const s of b.objectKeys(this.shape)) {
1915
- const r = this.shape[s];
1916
- e && !e[s] ? n[s] = r : n[s] = r.optional();
1913
+ const s = {};
1914
+ for (const n of b.objectKeys(this.shape)) {
1915
+ const r = this.shape[n];
1916
+ e && !e[n] ? s[n] = r : s[n] = r.optional();
1917
1917
  }
1918
1918
  return new w({
1919
1919
  ...this._def,
1920
- shape: () => n
1920
+ shape: () => s
1921
1921
  });
1922
1922
  }
1923
1923
  required(e) {
1924
- const n = {};
1925
- for (const s of b.objectKeys(this.shape))
1926
- if (e && !e[s])
1927
- n[s] = this.shape[s];
1924
+ const s = {};
1925
+ for (const n of b.objectKeys(this.shape))
1926
+ if (e && !e[n])
1927
+ s[n] = this.shape[n];
1928
1928
  else {
1929
- let a = this.shape[s];
1930
- for (; a instanceof V; )
1929
+ let a = this.shape[n];
1930
+ for (; a instanceof B; )
1931
1931
  a = a._def.innerType;
1932
- n[s] = a;
1932
+ s[n] = a;
1933
1933
  }
1934
1934
  return new w({
1935
1935
  ...this._def,
1936
- shape: () => n
1936
+ shape: () => s
1937
1937
  });
1938
1938
  }
1939
1939
  keyof() {
@@ -1943,54 +1943,54 @@ class w extends v {
1943
1943
  w.create = (t, e) => new w({
1944
1944
  shape: () => t,
1945
1945
  unknownKeys: "strip",
1946
- catchall: B.create(),
1946
+ catchall: V.create(),
1947
1947
  typeName: m.ZodObject,
1948
1948
  ...g(e)
1949
1949
  });
1950
1950
  w.strictCreate = (t, e) => new w({
1951
1951
  shape: () => t,
1952
1952
  unknownKeys: "strict",
1953
- catchall: B.create(),
1953
+ catchall: V.create(),
1954
1954
  typeName: m.ZodObject,
1955
1955
  ...g(e)
1956
1956
  });
1957
1957
  w.lazycreate = (t, e) => new w({
1958
1958
  shape: t,
1959
1959
  unknownKeys: "strip",
1960
- catchall: B.create(),
1960
+ catchall: V.create(),
1961
1961
  typeName: m.ZodObject,
1962
1962
  ...g(e)
1963
1963
  });
1964
1964
  class de extends v {
1965
1965
  _parse(e) {
1966
- const { ctx: n } = this._processInputParams(e), s = this._def.options;
1966
+ const { ctx: s } = this._processInputParams(e), n = this._def.options;
1967
1967
  function r(a) {
1968
1968
  for (const o of a)
1969
1969
  if (o.result.status === "valid")
1970
1970
  return o.result;
1971
1971
  for (const o of a)
1972
1972
  if (o.result.status === "dirty")
1973
- return n.common.issues.push(...o.ctx.common.issues), o.result;
1973
+ return s.common.issues.push(...o.ctx.common.issues), o.result;
1974
1974
  const i = a.map((o) => new Z(o.ctx.common.issues));
1975
- return l(n, {
1975
+ return l(s, {
1976
1976
  code: d.invalid_union,
1977
1977
  unionErrors: i
1978
- }), _;
1978
+ }), y;
1979
1979
  }
1980
- if (n.common.async)
1981
- return Promise.all(s.map(async (a) => {
1980
+ if (s.common.async)
1981
+ return Promise.all(n.map(async (a) => {
1982
1982
  const i = {
1983
- ...n,
1983
+ ...s,
1984
1984
  common: {
1985
- ...n.common,
1985
+ ...s.common,
1986
1986
  issues: []
1987
1987
  },
1988
1988
  parent: null
1989
1989
  };
1990
1990
  return {
1991
1991
  result: await a._parseAsync({
1992
- data: n.data,
1993
- path: n.path,
1992
+ data: s.data,
1993
+ path: s.path,
1994
1994
  parent: i
1995
1995
  }),
1996
1996
  ctx: i
@@ -1999,17 +1999,17 @@ class de extends v {
1999
1999
  {
2000
2000
  let a;
2001
2001
  const i = [];
2002
- for (const c of s) {
2002
+ for (const c of n) {
2003
2003
  const u = {
2004
- ...n,
2004
+ ...s,
2005
2005
  common: {
2006
- ...n.common,
2006
+ ...s.common,
2007
2007
  issues: []
2008
2008
  },
2009
2009
  parent: null
2010
2010
  }, p = c._parseSync({
2011
- data: n.data,
2012
- path: n.path,
2011
+ data: s.data,
2012
+ path: s.path,
2013
2013
  parent: u
2014
2014
  });
2015
2015
  if (p.status === "valid")
@@ -2017,12 +2017,12 @@ class de extends v {
2017
2017
  p.status === "dirty" && !a && (a = { result: p, ctx: u }), u.common.issues.length && i.push(u.common.issues);
2018
2018
  }
2019
2019
  if (a)
2020
- return n.common.issues.push(...a.ctx.common.issues), a.result;
2020
+ return s.common.issues.push(...a.ctx.common.issues), a.result;
2021
2021
  const o = i.map((c) => new Z(c));
2022
- return l(n, {
2022
+ return l(s, {
2023
2023
  code: d.invalid_union,
2024
2024
  unionErrors: o
2025
- }), _;
2025
+ }), y;
2026
2026
  }
2027
2027
  }
2028
2028
  get options() {
@@ -2034,114 +2034,114 @@ de.create = (t, e) => new de({
2034
2034
  typeName: m.ZodUnion,
2035
2035
  ...g(e)
2036
2036
  });
2037
- function Ve(t, e) {
2038
- const n = P(t), s = P(e);
2037
+ function Be(t, e) {
2038
+ const s = P(t), n = P(e);
2039
2039
  if (t === e)
2040
2040
  return { valid: !0, data: t };
2041
- if (n === h.object && s === h.object) {
2041
+ if (s === h.object && n === h.object) {
2042
2042
  const r = b.objectKeys(e), a = b.objectKeys(t).filter((o) => r.indexOf(o) !== -1), i = { ...t, ...e };
2043
2043
  for (const o of a) {
2044
- const c = Ve(t[o], e[o]);
2044
+ const c = Be(t[o], e[o]);
2045
2045
  if (!c.valid)
2046
2046
  return { valid: !1 };
2047
2047
  i[o] = c.data;
2048
2048
  }
2049
2049
  return { valid: !0, data: i };
2050
- } else if (n === h.array && s === h.array) {
2050
+ } else if (s === h.array && n === h.array) {
2051
2051
  if (t.length !== e.length)
2052
2052
  return { valid: !1 };
2053
2053
  const r = [];
2054
2054
  for (let a = 0; a < t.length; a++) {
2055
- const i = t[a], o = e[a], c = Ve(i, o);
2055
+ const i = t[a], o = e[a], c = Be(i, o);
2056
2056
  if (!c.valid)
2057
2057
  return { valid: !1 };
2058
2058
  r.push(c.data);
2059
2059
  }
2060
2060
  return { valid: !0, data: r };
2061
- } else return n === h.date && s === h.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2061
+ } else return s === h.date && n === h.date && +t == +e ? { valid: !0, data: t } : { valid: !1 };
2062
2062
  }
2063
2063
  class ue extends v {
2064
2064
  _parse(e) {
2065
- const { status: n, ctx: s } = this._processInputParams(e), r = (a, i) => {
2066
- if ($e(a) || $e(i))
2067
- return _;
2068
- const o = Ve(a.value, i.value);
2069
- return o.valid ? ((je(a) || je(i)) && n.dirty(), { status: n.value, value: o.data }) : (l(s, {
2065
+ const { status: s, ctx: n } = this._processInputParams(e), r = (a, i) => {
2066
+ if (Re(a) || Re(i))
2067
+ return y;
2068
+ const o = Be(a.value, i.value);
2069
+ return o.valid ? ((je(a) || je(i)) && s.dirty(), { status: s.value, value: o.data }) : (l(n, {
2070
2070
  code: d.invalid_intersection_types
2071
- }), _);
2071
+ }), y);
2072
2072
  };
2073
- return s.common.async ? Promise.all([
2073
+ return n.common.async ? Promise.all([
2074
2074
  this._def.left._parseAsync({
2075
- data: s.data,
2076
- path: s.path,
2077
- parent: s
2075
+ data: n.data,
2076
+ path: n.path,
2077
+ parent: n
2078
2078
  }),
2079
2079
  this._def.right._parseAsync({
2080
- data: s.data,
2081
- path: s.path,
2082
- parent: s
2080
+ data: n.data,
2081
+ path: n.path,
2082
+ parent: n
2083
2083
  })
2084
2084
  ]).then(([a, i]) => r(a, i)) : r(this._def.left._parseSync({
2085
- data: s.data,
2086
- path: s.path,
2087
- parent: s
2085
+ data: n.data,
2086
+ path: n.path,
2087
+ parent: n
2088
2088
  }), this._def.right._parseSync({
2089
- data: s.data,
2090
- path: s.path,
2091
- parent: s
2089
+ data: n.data,
2090
+ path: n.path,
2091
+ parent: n
2092
2092
  }));
2093
2093
  }
2094
2094
  }
2095
- ue.create = (t, e, n) => new ue({
2095
+ ue.create = (t, e, s) => new ue({
2096
2096
  left: t,
2097
2097
  right: e,
2098
2098
  typeName: m.ZodIntersection,
2099
- ...g(n)
2099
+ ...g(s)
2100
2100
  });
2101
- class F extends v {
2101
+ class z extends v {
2102
2102
  _parse(e) {
2103
- const { status: n, ctx: s } = this._processInputParams(e);
2104
- if (s.parsedType !== h.array)
2105
- return l(s, {
2103
+ const { status: s, ctx: n } = this._processInputParams(e);
2104
+ if (n.parsedType !== h.array)
2105
+ return l(n, {
2106
2106
  code: d.invalid_type,
2107
2107
  expected: h.array,
2108
- received: s.parsedType
2109
- }), _;
2110
- if (s.data.length < this._def.items.length)
2111
- return l(s, {
2108
+ received: n.parsedType
2109
+ }), y;
2110
+ if (n.data.length < this._def.items.length)
2111
+ return l(n, {
2112
2112
  code: d.too_small,
2113
2113
  minimum: this._def.items.length,
2114
2114
  inclusive: !0,
2115
2115
  exact: !1,
2116
2116
  type: "array"
2117
- }), _;
2118
- !this._def.rest && s.data.length > this._def.items.length && (l(s, {
2117
+ }), y;
2118
+ !this._def.rest && n.data.length > this._def.items.length && (l(n, {
2119
2119
  code: d.too_big,
2120
2120
  maximum: this._def.items.length,
2121
2121
  inclusive: !0,
2122
2122
  exact: !1,
2123
2123
  type: "array"
2124
- }), n.dirty());
2125
- const a = [...s.data].map((i, o) => {
2124
+ }), s.dirty());
2125
+ const a = [...n.data].map((i, o) => {
2126
2126
  const c = this._def.items[o] || this._def.rest;
2127
- return c ? c._parse(new D(s, i, s.path, o)) : null;
2127
+ return c ? c._parse(new D(n, i, n.path, o)) : null;
2128
2128
  }).filter((i) => !!i);
2129
- return s.common.async ? Promise.all(a).then((i) => C.mergeArray(n, i)) : C.mergeArray(n, a);
2129
+ return n.common.async ? Promise.all(a).then((i) => T.mergeArray(s, i)) : T.mergeArray(s, a);
2130
2130
  }
2131
2131
  get items() {
2132
2132
  return this._def.items;
2133
2133
  }
2134
2134
  rest(e) {
2135
- return new F({
2135
+ return new z({
2136
2136
  ...this._def,
2137
2137
  rest: e
2138
2138
  });
2139
2139
  }
2140
2140
  }
2141
- F.create = (t, e) => {
2141
+ z.create = (t, e) => {
2142
2142
  if (!Array.isArray(t))
2143
2143
  throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2144
- return new F({
2144
+ return new z({
2145
2145
  items: t,
2146
2146
  typeName: m.ZodTuple,
2147
2147
  rest: null,
@@ -2156,40 +2156,40 @@ class le extends v {
2156
2156
  return this._def.valueType;
2157
2157
  }
2158
2158
  _parse(e) {
2159
- const { status: n, ctx: s } = this._processInputParams(e);
2160
- if (s.parsedType !== h.object)
2161
- return l(s, {
2159
+ const { status: s, ctx: n } = this._processInputParams(e);
2160
+ if (n.parsedType !== h.object)
2161
+ return l(n, {
2162
2162
  code: d.invalid_type,
2163
2163
  expected: h.object,
2164
- received: s.parsedType
2165
- }), _;
2164
+ received: n.parsedType
2165
+ }), y;
2166
2166
  const r = [], a = this._def.keyType, i = this._def.valueType;
2167
- for (const o in s.data)
2167
+ for (const o in n.data)
2168
2168
  r.push({
2169
- key: a._parse(new D(s, o, s.path, o)),
2170
- value: i._parse(new D(s, s.data[o], s.path, o)),
2171
- alwaysSet: o in s.data
2169
+ key: a._parse(new D(n, o, n.path, o)),
2170
+ value: i._parse(new D(n, n.data[o], n.path, o)),
2171
+ alwaysSet: o in n.data
2172
2172
  });
2173
- return s.common.async ? C.mergeObjectAsync(n, r) : C.mergeObjectSync(n, r);
2173
+ return n.common.async ? T.mergeObjectAsync(s, r) : T.mergeObjectSync(s, r);
2174
2174
  }
2175
2175
  get element() {
2176
2176
  return this._def.valueType;
2177
2177
  }
2178
- static create(e, n, s) {
2179
- return n instanceof v ? new le({
2178
+ static create(e, s, n) {
2179
+ return s instanceof v ? new le({
2180
2180
  keyType: e,
2181
- valueType: n,
2181
+ valueType: s,
2182
2182
  typeName: m.ZodRecord,
2183
- ...g(s)
2183
+ ...g(n)
2184
2184
  }) : new le({
2185
2185
  keyType: I.create(),
2186
2186
  valueType: e,
2187
2187
  typeName: m.ZodRecord,
2188
- ...g(n)
2188
+ ...g(s)
2189
2189
  });
2190
2190
  }
2191
2191
  }
2192
- class Be extends v {
2192
+ class Ve extends v {
2193
2193
  get keySchema() {
2194
2194
  return this._def.keyType;
2195
2195
  }
@@ -2197,133 +2197,133 @@ class Be extends v {
2197
2197
  return this._def.valueType;
2198
2198
  }
2199
2199
  _parse(e) {
2200
- const { status: n, ctx: s } = this._processInputParams(e);
2201
- if (s.parsedType !== h.map)
2202
- return l(s, {
2200
+ const { status: s, ctx: n } = this._processInputParams(e);
2201
+ if (n.parsedType !== h.map)
2202
+ return l(n, {
2203
2203
  code: d.invalid_type,
2204
2204
  expected: h.map,
2205
- received: s.parsedType
2206
- }), _;
2207
- const r = this._def.keyType, a = this._def.valueType, i = [...s.data.entries()].map(([o, c], u) => ({
2208
- key: r._parse(new D(s, o, s.path, [u, "key"])),
2209
- value: a._parse(new D(s, c, s.path, [u, "value"]))
2205
+ received: n.parsedType
2206
+ }), y;
2207
+ const r = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, c], u) => ({
2208
+ key: r._parse(new D(n, o, n.path, [u, "key"])),
2209
+ value: a._parse(new D(n, c, n.path, [u, "value"]))
2210
2210
  }));
2211
- if (s.common.async) {
2211
+ if (n.common.async) {
2212
2212
  const o = /* @__PURE__ */ new Map();
2213
2213
  return Promise.resolve().then(async () => {
2214
2214
  for (const c of i) {
2215
2215
  const u = await c.key, p = await c.value;
2216
2216
  if (u.status === "aborted" || p.status === "aborted")
2217
- return _;
2218
- (u.status === "dirty" || p.status === "dirty") && n.dirty(), o.set(u.value, p.value);
2217
+ return y;
2218
+ (u.status === "dirty" || p.status === "dirty") && s.dirty(), o.set(u.value, p.value);
2219
2219
  }
2220
- return { status: n.value, value: o };
2220
+ return { status: s.value, value: o };
2221
2221
  });
2222
2222
  } else {
2223
2223
  const o = /* @__PURE__ */ new Map();
2224
2224
  for (const c of i) {
2225
2225
  const u = c.key, p = c.value;
2226
2226
  if (u.status === "aborted" || p.status === "aborted")
2227
- return _;
2228
- (u.status === "dirty" || p.status === "dirty") && n.dirty(), o.set(u.value, p.value);
2227
+ return y;
2228
+ (u.status === "dirty" || p.status === "dirty") && s.dirty(), o.set(u.value, p.value);
2229
2229
  }
2230
- return { status: n.value, value: o };
2230
+ return { status: s.value, value: o };
2231
2231
  }
2232
2232
  }
2233
2233
  }
2234
- Be.create = (t, e, n) => new Be({
2234
+ Ve.create = (t, e, s) => new Ve({
2235
2235
  valueType: e,
2236
2236
  keyType: t,
2237
2237
  typeName: m.ZodMap,
2238
- ...g(n)
2238
+ ...g(s)
2239
2239
  });
2240
- class se extends v {
2240
+ class ne extends v {
2241
2241
  _parse(e) {
2242
- const { status: n, ctx: s } = this._processInputParams(e);
2243
- if (s.parsedType !== h.set)
2244
- return l(s, {
2242
+ const { status: s, ctx: n } = this._processInputParams(e);
2243
+ if (n.parsedType !== h.set)
2244
+ return l(n, {
2245
2245
  code: d.invalid_type,
2246
2246
  expected: h.set,
2247
- received: s.parsedType
2248
- }), _;
2247
+ received: n.parsedType
2248
+ }), y;
2249
2249
  const r = this._def;
2250
- r.minSize !== null && s.data.size < r.minSize.value && (l(s, {
2250
+ r.minSize !== null && n.data.size < r.minSize.value && (l(n, {
2251
2251
  code: d.too_small,
2252
2252
  minimum: r.minSize.value,
2253
2253
  type: "set",
2254
2254
  inclusive: !0,
2255
2255
  exact: !1,
2256
2256
  message: r.minSize.message
2257
- }), n.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (l(s, {
2257
+ }), s.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (l(n, {
2258
2258
  code: d.too_big,
2259
2259
  maximum: r.maxSize.value,
2260
2260
  type: "set",
2261
2261
  inclusive: !0,
2262
2262
  exact: !1,
2263
2263
  message: r.maxSize.message
2264
- }), n.dirty());
2264
+ }), s.dirty());
2265
2265
  const a = this._def.valueType;
2266
2266
  function i(c) {
2267
2267
  const u = /* @__PURE__ */ new Set();
2268
2268
  for (const p of c) {
2269
2269
  if (p.status === "aborted")
2270
- return _;
2271
- p.status === "dirty" && n.dirty(), u.add(p.value);
2270
+ return y;
2271
+ p.status === "dirty" && s.dirty(), u.add(p.value);
2272
2272
  }
2273
- return { status: n.value, value: u };
2273
+ return { status: s.value, value: u };
2274
2274
  }
2275
- const o = [...s.data.values()].map((c, u) => a._parse(new D(s, c, s.path, u)));
2276
- return s.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2275
+ const o = [...n.data.values()].map((c, u) => a._parse(new D(n, c, n.path, u)));
2276
+ return n.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2277
2277
  }
2278
- min(e, n) {
2279
- return new se({
2278
+ min(e, s) {
2279
+ return new ne({
2280
2280
  ...this._def,
2281
- minSize: { value: e, message: f.toString(n) }
2281
+ minSize: { value: e, message: f.toString(s) }
2282
2282
  });
2283
2283
  }
2284
- max(e, n) {
2285
- return new se({
2284
+ max(e, s) {
2285
+ return new ne({
2286
2286
  ...this._def,
2287
- maxSize: { value: e, message: f.toString(n) }
2287
+ maxSize: { value: e, message: f.toString(s) }
2288
2288
  });
2289
2289
  }
2290
- size(e, n) {
2291
- return this.min(e, n).max(e, n);
2290
+ size(e, s) {
2291
+ return this.min(e, s).max(e, s);
2292
2292
  }
2293
2293
  nonempty(e) {
2294
2294
  return this.min(1, e);
2295
2295
  }
2296
2296
  }
2297
- se.create = (t, e) => new se({
2297
+ ne.create = (t, e) => new ne({
2298
2298
  valueType: t,
2299
2299
  minSize: null,
2300
2300
  maxSize: null,
2301
2301
  typeName: m.ZodSet,
2302
2302
  ...g(e)
2303
2303
  });
2304
- class ze extends v {
2304
+ class Ue extends v {
2305
2305
  get schema() {
2306
2306
  return this._def.getter();
2307
2307
  }
2308
2308
  _parse(e) {
2309
- const { ctx: n } = this._processInputParams(e);
2310
- return this._def.getter()._parse({ data: n.data, path: n.path, parent: n });
2309
+ const { ctx: s } = this._processInputParams(e);
2310
+ return this._def.getter()._parse({ data: s.data, path: s.path, parent: s });
2311
2311
  }
2312
2312
  }
2313
- ze.create = (t, e) => new ze({
2313
+ Ue.create = (t, e) => new Ue({
2314
2314
  getter: t,
2315
2315
  typeName: m.ZodLazy,
2316
2316
  ...g(e)
2317
2317
  });
2318
- class Fe extends v {
2318
+ class ze extends v {
2319
2319
  _parse(e) {
2320
2320
  if (e.data !== this._def.value) {
2321
- const n = this._getOrReturnCtx(e);
2322
- return l(n, {
2323
- received: n.data,
2321
+ const s = this._getOrReturnCtx(e);
2322
+ return l(s, {
2323
+ received: s.data,
2324
2324
  code: d.invalid_literal,
2325
2325
  expected: this._def.value
2326
- }), _;
2326
+ }), y;
2327
2327
  }
2328
2328
  return { status: "valid", value: e.data };
2329
2329
  }
@@ -2331,7 +2331,7 @@ class Fe extends v {
2331
2331
  return this._def.value;
2332
2332
  }
2333
2333
  }
2334
- Fe.create = (t, e) => new Fe({
2334
+ ze.create = (t, e) => new ze({
2335
2335
  value: t,
2336
2336
  typeName: m.ZodLiteral,
2337
2337
  ...g(e)
@@ -2346,20 +2346,20 @@ function rt(t, e) {
2346
2346
  class K extends v {
2347
2347
  _parse(e) {
2348
2348
  if (typeof e.data != "string") {
2349
- const n = this._getOrReturnCtx(e), s = this._def.values;
2350
- return l(n, {
2351
- expected: b.joinValues(s),
2352
- received: n.parsedType,
2349
+ const s = this._getOrReturnCtx(e), n = this._def.values;
2350
+ return l(s, {
2351
+ expected: b.joinValues(n),
2352
+ received: s.parsedType,
2353
2353
  code: d.invalid_type
2354
- }), _;
2354
+ }), y;
2355
2355
  }
2356
2356
  if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2357
- const n = this._getOrReturnCtx(e), s = this._def.values;
2358
- return l(n, {
2359
- received: n.data,
2357
+ const s = this._getOrReturnCtx(e), n = this._def.values;
2358
+ return l(s, {
2359
+ received: s.data,
2360
2360
  code: d.invalid_enum_value,
2361
- options: s
2362
- }), _;
2361
+ options: n
2362
+ }), y;
2363
2363
  }
2364
2364
  return N(e.data);
2365
2365
  }
@@ -2368,54 +2368,54 @@ class K extends v {
2368
2368
  }
2369
2369
  get enum() {
2370
2370
  const e = {};
2371
- for (const n of this._def.values)
2372
- e[n] = n;
2371
+ for (const s of this._def.values)
2372
+ e[s] = s;
2373
2373
  return e;
2374
2374
  }
2375
2375
  get Values() {
2376
2376
  const e = {};
2377
- for (const n of this._def.values)
2378
- e[n] = n;
2377
+ for (const s of this._def.values)
2378
+ e[s] = s;
2379
2379
  return e;
2380
2380
  }
2381
2381
  get Enum() {
2382
2382
  const e = {};
2383
- for (const n of this._def.values)
2384
- e[n] = n;
2383
+ for (const s of this._def.values)
2384
+ e[s] = s;
2385
2385
  return e;
2386
2386
  }
2387
- extract(e, n = this._def) {
2387
+ extract(e, s = this._def) {
2388
2388
  return K.create(e, {
2389
2389
  ...this._def,
2390
- ...n
2390
+ ...s
2391
2391
  });
2392
2392
  }
2393
- exclude(e, n = this._def) {
2394
- return K.create(this.options.filter((s) => !e.includes(s)), {
2393
+ exclude(e, s = this._def) {
2394
+ return K.create(this.options.filter((n) => !e.includes(n)), {
2395
2395
  ...this._def,
2396
- ...n
2396
+ ...s
2397
2397
  });
2398
2398
  }
2399
2399
  }
2400
2400
  K.create = rt;
2401
- class Ue extends v {
2401
+ class Fe extends v {
2402
2402
  _parse(e) {
2403
- const n = b.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2404
- if (s.parsedType !== h.string && s.parsedType !== h.number) {
2405
- const r = b.objectValues(n);
2406
- return l(s, {
2403
+ const s = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2404
+ if (n.parsedType !== h.string && n.parsedType !== h.number) {
2405
+ const r = b.objectValues(s);
2406
+ return l(n, {
2407
2407
  expected: b.joinValues(r),
2408
- received: s.parsedType,
2408
+ received: n.parsedType,
2409
2409
  code: d.invalid_type
2410
- }), _;
2410
+ }), y;
2411
2411
  }
2412
2412
  if (this._cache || (this._cache = new Set(b.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2413
- const r = b.objectValues(n);
2414
- return l(s, {
2415
- received: s.data,
2413
+ const r = b.objectValues(s);
2414
+ return l(n, {
2415
+ received: n.data,
2416
2416
  code: d.invalid_enum_value,
2417
2417
  options: r
2418
- }), _;
2418
+ }), y;
2419
2419
  }
2420
2420
  return N(e.data);
2421
2421
  }
@@ -2423,7 +2423,7 @@ class Ue extends v {
2423
2423
  return this._def.values;
2424
2424
  }
2425
2425
  }
2426
- Ue.create = (t, e) => new Ue({
2426
+ Fe.create = (t, e) => new Fe({
2427
2427
  values: t,
2428
2428
  typeName: m.ZodNativeEnum,
2429
2429
  ...g(e)
@@ -2433,17 +2433,17 @@ class he extends v {
2433
2433
  return this._def.type;
2434
2434
  }
2435
2435
  _parse(e) {
2436
- const { ctx: n } = this._processInputParams(e);
2437
- if (n.parsedType !== h.promise && n.common.async === !1)
2438
- return l(n, {
2436
+ const { ctx: s } = this._processInputParams(e);
2437
+ if (s.parsedType !== h.promise && s.common.async === !1)
2438
+ return l(s, {
2439
2439
  code: d.invalid_type,
2440
2440
  expected: h.promise,
2441
- received: n.parsedType
2442
- }), _;
2443
- const s = n.parsedType === h.promise ? n.data : Promise.resolve(n.data);
2444
- return N(s.then((r) => this._def.type.parseAsync(r, {
2445
- path: n.path,
2446
- errorMap: n.common.contextualErrorMap
2441
+ received: s.parsedType
2442
+ }), y;
2443
+ const n = s.parsedType === h.promise ? s.data : Promise.resolve(s.data);
2444
+ return N(n.then((r) => this._def.type.parseAsync(r, {
2445
+ path: s.path,
2446
+ errorMap: s.common.contextualErrorMap
2447
2447
  })));
2448
2448
  }
2449
2449
  }
@@ -2452,7 +2452,7 @@ he.create = (t, e) => new he({
2452
2452
  typeName: m.ZodPromise,
2453
2453
  ...g(e)
2454
2454
  });
2455
- class U extends v {
2455
+ class F extends v {
2456
2456
  innerType() {
2457
2457
  return this._def.schema;
2458
2458
  }
@@ -2460,91 +2460,91 @@ class U extends v {
2460
2460
  return this._def.schema._def.typeName === m.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2461
2461
  }
2462
2462
  _parse(e) {
2463
- const { status: n, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
2463
+ const { status: s, ctx: n } = this._processInputParams(e), r = this._def.effect || null, a = {
2464
2464
  addIssue: (i) => {
2465
- l(s, i), i.fatal ? n.abort() : n.dirty();
2465
+ l(n, i), i.fatal ? s.abort() : s.dirty();
2466
2466
  },
2467
2467
  get path() {
2468
- return s.path;
2468
+ return n.path;
2469
2469
  }
2470
2470
  };
2471
2471
  if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
2472
- const i = r.transform(s.data, a);
2473
- if (s.common.async)
2472
+ const i = r.transform(n.data, a);
2473
+ if (n.common.async)
2474
2474
  return Promise.resolve(i).then(async (o) => {
2475
- if (n.value === "aborted")
2476
- return _;
2475
+ if (s.value === "aborted")
2476
+ return y;
2477
2477
  const c = await this._def.schema._parseAsync({
2478
2478
  data: o,
2479
- path: s.path,
2480
- parent: s
2479
+ path: n.path,
2480
+ parent: n
2481
2481
  });
2482
- return c.status === "aborted" ? _ : c.status === "dirty" || n.value === "dirty" ? te(c.value) : c;
2482
+ return c.status === "aborted" ? y : c.status === "dirty" || s.value === "dirty" ? te(c.value) : c;
2483
2483
  });
2484
2484
  {
2485
- if (n.value === "aborted")
2486
- return _;
2485
+ if (s.value === "aborted")
2486
+ return y;
2487
2487
  const o = this._def.schema._parseSync({
2488
2488
  data: i,
2489
- path: s.path,
2490
- parent: s
2489
+ path: n.path,
2490
+ parent: n
2491
2491
  });
2492
- return o.status === "aborted" ? _ : o.status === "dirty" || n.value === "dirty" ? te(o.value) : o;
2492
+ return o.status === "aborted" ? y : o.status === "dirty" || s.value === "dirty" ? te(o.value) : o;
2493
2493
  }
2494
2494
  }
2495
2495
  if (r.type === "refinement") {
2496
2496
  const i = (o) => {
2497
2497
  const c = r.refinement(o, a);
2498
- if (s.common.async)
2498
+ if (n.common.async)
2499
2499
  return Promise.resolve(c);
2500
2500
  if (c instanceof Promise)
2501
2501
  throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2502
2502
  return o;
2503
2503
  };
2504
- if (s.common.async === !1) {
2504
+ if (n.common.async === !1) {
2505
2505
  const o = this._def.schema._parseSync({
2506
- data: s.data,
2507
- path: s.path,
2508
- parent: s
2506
+ data: n.data,
2507
+ path: n.path,
2508
+ parent: n
2509
2509
  });
2510
- return o.status === "aborted" ? _ : (o.status === "dirty" && n.dirty(), i(o.value), { status: n.value, value: o.value });
2510
+ return o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value), { status: s.value, value: o.value });
2511
2511
  } else
2512
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((o) => o.status === "aborted" ? _ : (o.status === "dirty" && n.dirty(), i(o.value).then(() => ({ status: n.value, value: o.value }))));
2512
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? y : (o.status === "dirty" && s.dirty(), i(o.value).then(() => ({ status: s.value, value: o.value }))));
2513
2513
  }
2514
2514
  if (r.type === "transform")
2515
- if (s.common.async === !1) {
2515
+ if (n.common.async === !1) {
2516
2516
  const i = this._def.schema._parseSync({
2517
- data: s.data,
2518
- path: s.path,
2519
- parent: s
2517
+ data: n.data,
2518
+ path: n.path,
2519
+ parent: n
2520
2520
  });
2521
- if (!J(i))
2522
- return _;
2521
+ if (!Q(i))
2522
+ return y;
2523
2523
  const o = r.transform(i.value, a);
2524
2524
  if (o instanceof Promise)
2525
2525
  throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2526
- return { status: n.value, value: o };
2526
+ return { status: s.value, value: o };
2527
2527
  } else
2528
- return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => J(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({
2529
- status: n.value,
2528
+ return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => Q(i) ? Promise.resolve(r.transform(i.value, a)).then((o) => ({
2529
+ status: s.value,
2530
2530
  value: o
2531
- })) : _);
2531
+ })) : y);
2532
2532
  b.assertNever(r);
2533
2533
  }
2534
2534
  }
2535
- U.create = (t, e, n) => new U({
2535
+ F.create = (t, e, s) => new F({
2536
2536
  schema: t,
2537
2537
  typeName: m.ZodEffects,
2538
2538
  effect: e,
2539
- ...g(n)
2539
+ ...g(s)
2540
2540
  });
2541
- U.createWithPreprocess = (t, e, n) => new U({
2541
+ F.createWithPreprocess = (t, e, s) => new F({
2542
2542
  schema: e,
2543
2543
  effect: { type: "preprocess", transform: t },
2544
2544
  typeName: m.ZodEffects,
2545
- ...g(n)
2545
+ ...g(s)
2546
2546
  });
2547
- class V extends v {
2547
+ class B extends v {
2548
2548
  _parse(e) {
2549
2549
  return this._getType(e) === h.undefined ? N(void 0) : this._def.innerType._parse(e);
2550
2550
  }
@@ -2552,7 +2552,7 @@ class V extends v {
2552
2552
  return this._def.innerType;
2553
2553
  }
2554
2554
  }
2555
- V.create = (t, e) => new V({
2555
+ B.create = (t, e) => new B({
2556
2556
  innerType: t,
2557
2557
  typeName: m.ZodOptional,
2558
2558
  ...g(e)
@@ -2570,56 +2570,56 @@ G.create = (t, e) => new G({
2570
2570
  typeName: m.ZodNullable,
2571
2571
  ...g(e)
2572
2572
  });
2573
- class _e extends v {
2573
+ class ye extends v {
2574
2574
  _parse(e) {
2575
- const { ctx: n } = this._processInputParams(e);
2576
- let s = n.data;
2577
- return n.parsedType === h.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2578
- data: s,
2579
- path: n.path,
2580
- parent: n
2575
+ const { ctx: s } = this._processInputParams(e);
2576
+ let n = s.data;
2577
+ return s.parsedType === h.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2578
+ data: n,
2579
+ path: s.path,
2580
+ parent: s
2581
2581
  });
2582
2582
  }
2583
2583
  removeDefault() {
2584
2584
  return this._def.innerType;
2585
2585
  }
2586
2586
  }
2587
- _e.create = (t, e) => new _e({
2587
+ ye.create = (t, e) => new ye({
2588
2588
  innerType: t,
2589
2589
  typeName: m.ZodDefault,
2590
2590
  defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2591
2591
  ...g(e)
2592
2592
  });
2593
- class ye extends v {
2593
+ class _e extends v {
2594
2594
  _parse(e) {
2595
- const { ctx: n } = this._processInputParams(e), s = {
2596
- ...n,
2595
+ const { ctx: s } = this._processInputParams(e), n = {
2596
+ ...s,
2597
2597
  common: {
2598
- ...n.common,
2598
+ ...s.common,
2599
2599
  issues: []
2600
2600
  }
2601
2601
  }, r = this._def.innerType._parse({
2602
- data: s.data,
2603
- path: s.path,
2602
+ data: n.data,
2603
+ path: n.path,
2604
2604
  parent: {
2605
- ...s
2605
+ ...n
2606
2606
  }
2607
2607
  });
2608
2608
  return oe(r) ? r.then((a) => ({
2609
2609
  status: "valid",
2610
2610
  value: a.status === "valid" ? a.value : this._def.catchValue({
2611
2611
  get error() {
2612
- return new Z(s.common.issues);
2612
+ return new Z(n.common.issues);
2613
2613
  },
2614
- input: s.data
2614
+ input: n.data
2615
2615
  })
2616
2616
  })) : {
2617
2617
  status: "valid",
2618
2618
  value: r.status === "valid" ? r.value : this._def.catchValue({
2619
2619
  get error() {
2620
- return new Z(s.common.issues);
2620
+ return new Z(n.common.issues);
2621
2621
  },
2622
- input: s.data
2622
+ input: n.data
2623
2623
  })
2624
2624
  };
2625
2625
  }
@@ -2627,7 +2627,7 @@ class ye extends v {
2627
2627
  return this._def.innerType;
2628
2628
  }
2629
2629
  }
2630
- ye.create = (t, e) => new ye({
2630
+ _e.create = (t, e) => new _e({
2631
2631
  innerType: t,
2632
2632
  typeName: m.ZodCatch,
2633
2633
  catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
@@ -2636,12 +2636,12 @@ ye.create = (t, e) => new ye({
2636
2636
  class qe extends v {
2637
2637
  _parse(e) {
2638
2638
  if (this._getType(e) !== h.nan) {
2639
- const s = this._getOrReturnCtx(e);
2640
- return l(s, {
2639
+ const n = this._getOrReturnCtx(e);
2640
+ return l(n, {
2641
2641
  code: d.invalid_type,
2642
2642
  expected: h.nan,
2643
- received: s.parsedType
2644
- }), _;
2643
+ received: n.parsedType
2644
+ }), y;
2645
2645
  }
2646
2646
  return { status: "valid", value: e.data };
2647
2647
  }
@@ -2652,11 +2652,11 @@ qe.create = (t) => new qe({
2652
2652
  });
2653
2653
  class at extends v {
2654
2654
  _parse(e) {
2655
- const { ctx: n } = this._processInputParams(e), s = n.data;
2655
+ const { ctx: s } = this._processInputParams(e), n = s.data;
2656
2656
  return this._def.type._parse({
2657
- data: s,
2658
- path: n.path,
2659
- parent: n
2657
+ data: n,
2658
+ path: s.path,
2659
+ parent: s
2660
2660
  });
2661
2661
  }
2662
2662
  unwrap() {
@@ -2665,48 +2665,48 @@ class at extends v {
2665
2665
  }
2666
2666
  class xe extends v {
2667
2667
  _parse(e) {
2668
- const { status: n, ctx: s } = this._processInputParams(e);
2669
- if (s.common.async)
2668
+ const { status: s, ctx: n } = this._processInputParams(e);
2669
+ if (n.common.async)
2670
2670
  return (async () => {
2671
2671
  const a = await this._def.in._parseAsync({
2672
- data: s.data,
2673
- path: s.path,
2674
- parent: s
2672
+ data: n.data,
2673
+ path: n.path,
2674
+ parent: n
2675
2675
  });
2676
- return a.status === "aborted" ? _ : a.status === "dirty" ? (n.dirty(), te(a.value)) : this._def.out._parseAsync({
2676
+ return a.status === "aborted" ? y : a.status === "dirty" ? (s.dirty(), te(a.value)) : this._def.out._parseAsync({
2677
2677
  data: a.value,
2678
- path: s.path,
2679
- parent: s
2678
+ path: n.path,
2679
+ parent: n
2680
2680
  });
2681
2681
  })();
2682
2682
  {
2683
2683
  const r = this._def.in._parseSync({
2684
- data: s.data,
2685
- path: s.path,
2686
- parent: s
2684
+ data: n.data,
2685
+ path: n.path,
2686
+ parent: n
2687
2687
  });
2688
- return r.status === "aborted" ? _ : r.status === "dirty" ? (n.dirty(), {
2688
+ return r.status === "aborted" ? y : r.status === "dirty" ? (s.dirty(), {
2689
2689
  status: "dirty",
2690
2690
  value: r.value
2691
2691
  }) : this._def.out._parseSync({
2692
2692
  data: r.value,
2693
- path: s.path,
2694
- parent: s
2693
+ path: n.path,
2694
+ parent: n
2695
2695
  });
2696
2696
  }
2697
2697
  }
2698
- static create(e, n) {
2698
+ static create(e, s) {
2699
2699
  return new xe({
2700
2700
  in: e,
2701
- out: n,
2701
+ out: s,
2702
2702
  typeName: m.ZodPipeline
2703
2703
  });
2704
2704
  }
2705
2705
  }
2706
2706
  class ge extends v {
2707
2707
  _parse(e) {
2708
- const n = this._def.innerType._parse(e), s = (r) => (J(r) && (r.value = Object.freeze(r.value)), r);
2709
- return oe(n) ? n.then((r) => s(r)) : s(n);
2708
+ const s = this._def.innerType._parse(e), n = (r) => (Q(r) && (r.value = Object.freeze(r.value)), r);
2709
+ return oe(s) ? s.then((r) => n(r)) : n(s);
2710
2710
  }
2711
2711
  unwrap() {
2712
2712
  return this._def.innerType;
@@ -2721,33 +2721,33 @@ var m;
2721
2721
  (function(t) {
2722
2722
  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";
2723
2723
  })(m || (m = {}));
2724
- const y = I.create, it = Y.create, ke = me.create;
2725
- B.create;
2726
- const A = R.create, $ = w.create;
2724
+ const _ = I.create, it = Y.create, ke = me.create;
2725
+ V.create;
2726
+ const A = $.create, R = w.create;
2727
2727
  de.create;
2728
2728
  ue.create;
2729
- F.create;
2729
+ z.create;
2730
2730
  const ot = le.create;
2731
2731
  K.create;
2732
2732
  he.create;
2733
- V.create;
2733
+ B.create;
2734
2734
  G.create;
2735
- const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2735
+ const Bt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2736
2736
  __proto__: null,
2737
2737
  DIRTY: te,
2738
- INVALID: _,
2738
+ INVALID: y,
2739
2739
  OK: N,
2740
- ParseStatus: C,
2740
+ ParseStatus: T,
2741
2741
  Schema: v,
2742
2742
  ZodAny: Le,
2743
- ZodArray: R,
2744
- ZodBigInt: ne,
2743
+ ZodArray: $,
2744
+ ZodBigInt: se,
2745
2745
  ZodBoolean: me,
2746
2746
  ZodBranded: at,
2747
- ZodCatch: ye,
2747
+ ZodCatch: _e,
2748
2748
  ZodDate: ce,
2749
- ZodDefault: _e,
2750
- ZodEffects: U,
2749
+ ZodDefault: ye,
2750
+ ZodEffects: F,
2751
2751
  ZodEnum: K,
2752
2752
  ZodError: Z,
2753
2753
  get ZodFirstPartyTypeKind() {
@@ -2755,28 +2755,28 @@ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2755
2755
  },
2756
2756
  ZodIntersection: ue,
2757
2757
  ZodIssueCode: d,
2758
- ZodLazy: ze,
2759
- ZodLiteral: Fe,
2760
- ZodMap: Be,
2758
+ ZodLazy: Ue,
2759
+ ZodLiteral: ze,
2760
+ ZodMap: Ve,
2761
2761
  ZodNaN: qe,
2762
- ZodNativeEnum: Ue,
2763
- ZodNever: B,
2762
+ ZodNativeEnum: Fe,
2763
+ ZodNever: V,
2764
2764
  ZodNull: De,
2765
2765
  ZodNullable: G,
2766
2766
  ZodNumber: Y,
2767
2767
  ZodObject: w,
2768
- ZodOptional: V,
2768
+ ZodOptional: B,
2769
2769
  ZodParsedType: h,
2770
2770
  ZodPipeline: xe,
2771
2771
  ZodPromise: he,
2772
2772
  ZodReadonly: ge,
2773
2773
  ZodRecord: le,
2774
2774
  ZodSchema: v,
2775
- ZodSet: se,
2775
+ ZodSet: ne,
2776
2776
  ZodString: I,
2777
2777
  ZodSymbol: Ie,
2778
- ZodTransformer: U,
2779
- ZodTuple: F,
2778
+ ZodTransformer: F,
2779
+ ZodTuple: z,
2780
2780
  ZodType: v,
2781
2781
  ZodUndefined: Ze,
2782
2782
  ZodUnion: de,
@@ -2785,52 +2785,52 @@ const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2785
2785
  addIssueToContext: l,
2786
2786
  array: A,
2787
2787
  boolean: ke,
2788
- datetimeRegex: st,
2788
+ datetimeRegex: nt,
2789
2789
  defaultErrorMap: pe,
2790
2790
  getErrorMap: Xe,
2791
2791
  getParsedType: P,
2792
- isAborted: $e,
2792
+ isAborted: Re,
2793
2793
  isAsync: oe,
2794
2794
  isDirty: je,
2795
- isValid: J,
2795
+ isValid: Q,
2796
2796
  makeIssue: et,
2797
2797
  number: it,
2798
- object: $,
2798
+ object: R,
2799
2799
  get objectUtil() {
2800
- return Re;
2800
+ return $e;
2801
2801
  },
2802
2802
  record: ot,
2803
- string: y,
2803
+ string: _,
2804
2804
  get util() {
2805
2805
  return b;
2806
2806
  }
2807
2807
  }, Symbol.toStringTag, { value: "Module" }));
2808
- yt(Vt);
2809
- const Bt = (t, e) => e.skipDedupe || e.method !== "GET", zt = (t, e) => e.method + "@" + t, Ft = (t) => t.clone(), Ut = ({ skip: t = Bt, key: e = zt, resolver: n = Ft } = {}) => {
2810
- const s = /* @__PURE__ */ new Map();
2808
+ _t(Bt);
2809
+ const Vt = (t, e) => e.skipDedupe || e.method !== "GET", Ut = (t, e) => e.method + "@" + t, zt = (t) => t.clone(), Ft = ({ skip: t = Vt, key: e = Ut, resolver: s = zt } = {}) => {
2810
+ const n = /* @__PURE__ */ new Map();
2811
2811
  return (r) => (a, i) => {
2812
2812
  if (t(a, i))
2813
2813
  return r(a, i);
2814
2814
  const o = e(a, i);
2815
- if (!s.has(o))
2816
- s.set(o, []);
2815
+ if (!n.has(o))
2816
+ n.set(o, []);
2817
2817
  else
2818
2818
  return new Promise((c, u) => {
2819
- s.get(o).push([c, u]);
2819
+ n.get(o).push([c, u]);
2820
2820
  });
2821
2821
  try {
2822
- return r(a, i).then((c) => (s.get(o).forEach(([u]) => u(n(c))), s.delete(o), c)).catch((c) => {
2823
- throw s.get(o).forEach(([, u]) => u(c)), s.delete(o), c;
2822
+ return r(a, i).then((c) => (n.get(o).forEach(([u]) => u(s(c))), n.delete(o), c)).catch((c) => {
2823
+ throw n.get(o).forEach(([, u]) => u(c)), n.delete(o), c;
2824
2824
  });
2825
2825
  } catch (c) {
2826
- return s.delete(o), Promise.reject(c);
2826
+ return n.delete(o), Promise.reject(c);
2827
2827
  }
2828
2828
  };
2829
- }, qt = (t, e) => t * e, Wt = (t) => t && (t.ok || t.status >= 400 && t.status < 500), Qt = ({ delayTimer: t = 500, delayRamp: e = qt, maxAttempts: n = 10, until: s = Wt, onRetry: r = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (u, p) => {
2829
+ }, qt = (t, e) => t * e, Wt = (t) => t && (t.ok || t.status >= 400 && t.status < 500), Jt = ({ delayTimer: t = 500, delayRamp: e = qt, maxAttempts: s = 10, until: n = Wt, onRetry: r = null, retryOnNetworkError: a = !1, resolveWithLatestResponse: i = !1, skip: o } = {}) => (c) => (u, p) => {
2830
2830
  let k = 0;
2831
2831
  if (o && o(u, p))
2832
2832
  return c(u, p);
2833
- const T = (S, E) => Promise.resolve(s(S, E)).then((q) => q ? S && i ? S : E ? Promise.reject(E) : S : (k++, !n || k <= n ? new Promise((x) => {
2833
+ const C = (S, E) => Promise.resolve(n(S, E)).then((q) => q ? S && i ? S : E ? Promise.reject(E) : S : (k++, !s || k <= s ? new Promise((x) => {
2834
2834
  const L = e(t, k);
2835
2835
  setTimeout(() => {
2836
2836
  typeof r == "function" ? Promise.resolve(r({
@@ -2844,78 +2844,78 @@ const Bt = (t, e) => e.skipDedupe || e.method !== "GET", zt = (t, e) => e.method
2844
2844
  x(c((j = O && O.url) !== null && j !== void 0 ? j : u, (W = O && O.options) !== null && W !== void 0 ? W : p));
2845
2845
  }) : x(c(u, p));
2846
2846
  }, L);
2847
- }).then(T).catch((x) => {
2847
+ }).then(C).catch((x) => {
2848
2848
  if (!a)
2849
2849
  throw x;
2850
- return T(null, x);
2850
+ return C(null, x);
2851
2851
  }) : S && i ? S : Promise.reject(E || new Error("Number of attempts exceeded."))));
2852
- return c(u, p).then(T).catch((S) => {
2852
+ return c(u, p).then(C).catch((S) => {
2853
2853
  if (!a)
2854
2854
  throw S;
2855
- return T(null, S);
2855
+ return C(null, S);
2856
2856
  });
2857
- }, ve = $({
2857
+ }, ve = R({
2858
2858
  code: it(),
2859
- message: y()
2860
- }), Ht = $({
2861
- message: y()
2862
- }), Jt = $({
2863
- emails: A(y()).optional(),
2864
- http_body: y().optional(),
2865
- http_url: y().optional(),
2866
- txt_name: y().optional(),
2867
- txt_value: y().optional()
2868
- }), Yt = $({
2869
- ciphers: A(y()).optional(),
2870
- early_hints: y().optional(),
2871
- http2: y().optional(),
2872
- min_tls_version: y().optional(),
2873
- tls_1_3: y().optional()
2874
- }), Kt = $({
2875
- id: y(),
2876
- bundle_method: y().optional(),
2877
- certificate_authority: y(),
2878
- custom_certificate: y().optional(),
2879
- custom_csr_id: y().optional(),
2880
- custom_key: y().optional(),
2881
- expires_on: y().optional(),
2882
- hosts: A(y()).optional(),
2883
- issuer: y().optional(),
2884
- method: y(),
2885
- serial_number: y().optional(),
2859
+ message: _()
2860
+ }), Ht = R({
2861
+ message: _()
2862
+ }), Qt = R({
2863
+ emails: A(_()).optional(),
2864
+ http_body: _().optional(),
2865
+ http_url: _().optional(),
2866
+ txt_name: _().optional(),
2867
+ txt_value: _().optional()
2868
+ }), Yt = R({
2869
+ ciphers: A(_()).optional(),
2870
+ early_hints: _().optional(),
2871
+ http2: _().optional(),
2872
+ min_tls_version: _().optional(),
2873
+ tls_1_3: _().optional()
2874
+ }), Kt = R({
2875
+ id: _(),
2876
+ bundle_method: _().optional(),
2877
+ certificate_authority: _(),
2878
+ custom_certificate: _().optional(),
2879
+ custom_csr_id: _().optional(),
2880
+ custom_key: _().optional(),
2881
+ expires_on: _().optional(),
2882
+ hosts: A(_()).optional(),
2883
+ issuer: _().optional(),
2884
+ method: _(),
2885
+ serial_number: _().optional(),
2886
2886
  settings: Yt.optional(),
2887
- signature: y().optional(),
2888
- type: y(),
2889
- uploaded_on: y().optional(),
2887
+ signature: _().optional(),
2888
+ type: _(),
2889
+ uploaded_on: _().optional(),
2890
2890
  validation_errors: A(Ht).optional(),
2891
- validation_records: A(Jt).optional(),
2891
+ validation_records: A(Qt).optional(),
2892
2892
  wildcard: ke()
2893
- }), Gt = $({
2894
- name: y(),
2895
- type: y(),
2896
- value: y()
2897
- }), Xt = $({
2898
- http_body: y().optional(),
2899
- http_url: y().optional()
2900
- }), ct = $({
2901
- id: y(),
2893
+ }), Gt = R({
2894
+ name: _(),
2895
+ type: _(),
2896
+ value: _()
2897
+ }), Xt = R({
2898
+ http_body: _().optional(),
2899
+ http_url: _().optional()
2900
+ }), ct = R({
2901
+ id: _(),
2902
2902
  ssl: Kt,
2903
- hostname: y(),
2904
- custom_metadata: ot(y()).optional(),
2905
- custom_origin_server: y().optional(),
2906
- custom_origin_sni: y().optional(),
2903
+ hostname: _(),
2904
+ custom_metadata: ot(_()).optional(),
2905
+ custom_origin_server: _().optional(),
2906
+ custom_origin_sni: _().optional(),
2907
2907
  ownership_verification: Gt.optional(),
2908
2908
  ownership_verification_http: Xt.optional(),
2909
- status: y(),
2910
- verification_errors: A(y()).optional(),
2911
- created_at: y()
2912
- }), ie = $({
2909
+ status: _(),
2910
+ verification_errors: A(_()).optional(),
2911
+ created_at: _()
2912
+ }), ie = R({
2913
2913
  errors: A(ve),
2914
2914
  messages: A(ve),
2915
2915
  success: ke(),
2916
2916
  result: ct
2917
2917
  });
2918
- $({
2918
+ R({
2919
2919
  errors: A(ve),
2920
2920
  messages: A(ve),
2921
2921
  success: ke(),
@@ -2926,23 +2926,23 @@ function H(t) {
2926
2926
  "X-Auth-Email": t.authEmail,
2927
2927
  "X-Auth-Key": t.authKey,
2928
2928
  "Content-Type": "application/json"
2929
- }).middlewares([Qt(), Ut()]);
2929
+ }).middlewares([Jt(), Ft()]);
2930
2930
  }
2931
- function Je(t) {
2932
- const e = {}, n = {};
2933
- if (!t) return { sslOverrides: e, rest: n };
2934
- for (const [s, r] of Object.entries(t))
2935
- s.startsWith("ssl.") ? e[s.slice(4)] = r : n[s] = r;
2936
- return { sslOverrides: e, rest: n };
2931
+ function Qe(t) {
2932
+ const e = {}, s = {};
2933
+ if (!t) return { sslOverrides: e, rest: s };
2934
+ for (const [n, r] of Object.entries(t))
2935
+ n.startsWith("ssl.") ? e[n.slice(4)] = r : s[n] = r;
2936
+ return { sslOverrides: e, rest: s };
2937
2937
  }
2938
2938
  function Ne(t) {
2939
2939
  const e = [];
2940
2940
  if (t.ssl.validation_records)
2941
- for (const s of t.ssl.validation_records)
2942
- s.txt_name && s.txt_value && e.push({
2941
+ for (const n of t.ssl.validation_records)
2942
+ n.txt_name && n.txt_value && e.push({
2943
2943
  name: "txt",
2944
- record: s.txt_value,
2945
- domain: s.txt_name
2944
+ record: n.txt_value,
2945
+ domain: n.txt_name
2946
2946
  });
2947
2947
  if (t.ownership_verification && e.push({
2948
2948
  name: "txt",
@@ -2953,13 +2953,13 @@ function Ne(t) {
2953
2953
  http_body: t.ownership_verification_http.http_body,
2954
2954
  http_url: t.ownership_verification_http.http_url
2955
2955
  }), t.ssl.validation_records)
2956
- for (const s of t.ssl.validation_records)
2957
- s.http_body && s.http_url && e.push({
2956
+ for (const n of t.ssl.validation_records)
2957
+ n.http_body && n.http_url && e.push({
2958
2958
  name: "http",
2959
- http_body: s.http_body,
2960
- http_url: s.http_url
2959
+ http_body: n.http_body,
2960
+ http_url: n.http_url
2961
2961
  });
2962
- const n = {
2962
+ const s = {
2963
2963
  ...t.domain_metadata || {},
2964
2964
  "ssl.method": t.ssl.method,
2965
2965
  "ssl.type": t.ssl.type,
@@ -2974,22 +2974,22 @@ function Ne(t) {
2974
2974
  verification: {
2975
2975
  methods: A(ft).parse(e)
2976
2976
  },
2977
- domain_metadata: n
2977
+ domain_metadata: s
2978
2978
  };
2979
2979
  }
2980
- function en(t) {
2980
+ function es(t) {
2981
2981
  return {
2982
- create: async (e, n) => {
2983
- const { sslOverrides: s, rest: r } = Je(
2984
- n.domain_metadata
2982
+ create: async (e, s) => {
2983
+ const { sslOverrides: n, rest: r } = Qe(
2984
+ s.domain_metadata
2985
2985
  ), { result: a, errors: i, success: o } = ie.parse(
2986
2986
  await H(t).post(
2987
2987
  {
2988
- hostname: n.domain,
2988
+ hostname: s.domain,
2989
2989
  ssl: {
2990
2990
  method: "txt",
2991
2991
  type: "dv",
2992
- ...s
2992
+ ...n
2993
2993
  },
2994
2994
  custom_metadata: t.enterprise ? {
2995
2995
  tenant_id: e
@@ -3009,30 +3009,30 @@ function en(t) {
3009
3009
  custom_domain_id: c.custom_domain_id,
3010
3010
  domain: c.domain,
3011
3011
  type: c.type,
3012
- domain_metadata: n.domain_metadata
3012
+ domain_metadata: s.domain_metadata
3013
3013
  }), c;
3014
3014
  },
3015
- get: async (e, n) => {
3016
- const s = await t.customDomainAdapter.get(
3015
+ get: async (e, s) => {
3016
+ const n = await t.customDomainAdapter.get(
3017
3017
  e,
3018
- n
3018
+ s
3019
3019
  );
3020
- if (!s)
3020
+ if (!n)
3021
3021
  throw new X(404);
3022
- const r = await H(t).get(`/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: a, errors: i, success: o } = ie.parse(r);
3022
+ const r = await H(t).get(`/custom_hostnames/${encodeURIComponent(s)}`).json(), { result: a, errors: i, success: o } = ie.parse(r);
3023
3023
  if (!o)
3024
3024
  throw new X(503, {
3025
3025
  message: JSON.stringify(i)
3026
3026
  });
3027
3027
  if (t.enterprise && a.custom_metadata?.tenant_id !== e)
3028
3028
  throw new X(404);
3029
- return Ne({ ...s, ...a });
3029
+ return Ne({ ...n, ...a });
3030
3030
  },
3031
3031
  getByDomain: async (e) => t.customDomainAdapter.getByDomain(e),
3032
3032
  list: async (e) => {
3033
- const n = await t.customDomainAdapter.list(e);
3033
+ const s = await t.customDomainAdapter.list(e);
3034
3034
  return (await Promise.all(
3035
- n.map(async (r) => {
3035
+ s.map(async (r) => {
3036
3036
  try {
3037
3037
  const a = await H(t).get(
3038
3038
  `/custom_hostnames/${encodeURIComponent(r.custom_domain_id)}`
@@ -3047,23 +3047,23 @@ function en(t) {
3047
3047
  })
3048
3048
  )).filter((r) => r !== null);
3049
3049
  },
3050
- remove: async (e, n) => {
3050
+ remove: async (e, s) => {
3051
3051
  if (t.enterprise) {
3052
3052
  const { result: r, success: a } = ie.parse(
3053
- await H(t).get(`/custom_hostnames/${encodeURIComponent(n)}`).json()
3053
+ await H(t).get(`/custom_hostnames/${encodeURIComponent(s)}`).json()
3054
3054
  );
3055
3055
  if (!a || r.custom_metadata?.tenant_id !== e)
3056
3056
  throw new X(404);
3057
3057
  }
3058
- const s = await H(t).delete(`/custom_hostnames/${encodeURIComponent(n)}`).res();
3059
- return s.ok && await t.customDomainAdapter.remove(e, n), s.ok;
3058
+ const n = await H(t).delete(`/custom_hostnames/${encodeURIComponent(s)}`).res();
3059
+ return n.ok && await t.customDomainAdapter.remove(e, s), n.ok;
3060
3060
  },
3061
- update: async (e, n, s) => {
3062
- const { sslOverrides: r } = Je(
3063
- s.domain_metadata
3061
+ update: async (e, s, n) => {
3062
+ const { sslOverrides: r } = Qe(
3063
+ n.domain_metadata
3064
3064
  ), a = {};
3065
3065
  if (Object.keys(r).length > 0) {
3066
- const i = await H(t).get(`/custom_hostnames/${encodeURIComponent(n)}`).json(), { result: o, success: c } = ie.parse(i);
3066
+ const i = await H(t).get(`/custom_hostnames/${encodeURIComponent(s)}`).json(), { result: o, success: c } = ie.parse(i);
3067
3067
  if (!c)
3068
3068
  throw new X(503, {
3069
3069
  message: "Failed to fetch current custom hostname state"
@@ -3078,7 +3078,7 @@ function en(t) {
3078
3078
  if (Object.keys(a).length > 0) {
3079
3079
  const i = await H(t).patch(
3080
3080
  a,
3081
- `/custom_hostnames/${encodeURIComponent(n)}`
3081
+ `/custom_hostnames/${encodeURIComponent(s)}`
3082
3082
  ).res();
3083
3083
  if (!i.ok)
3084
3084
  throw new X(503, {
@@ -3087,13 +3087,13 @@ function en(t) {
3087
3087
  }
3088
3088
  return t.customDomainAdapter.update(
3089
3089
  e,
3090
- n,
3091
- s
3090
+ s,
3091
+ n
3092
3092
  );
3093
3093
  }
3094
3094
  };
3095
3095
  }
3096
- class tn {
3096
+ class ts {
3097
3097
  constructor(e) {
3098
3098
  this.config = e;
3099
3099
  }
@@ -3116,19 +3116,19 @@ class tn {
3116
3116
  }
3117
3117
  async get(e) {
3118
3118
  try {
3119
- const n = await this.getCache(), s = this.createRequest(e), r = await n.match(s);
3119
+ const s = await this.getCache(), n = this.createRequest(e), r = await s.match(n);
3120
3120
  if (!r)
3121
3121
  return null;
3122
3122
  const a = await r.json();
3123
3123
  return a.expiresAt && new Date(a.expiresAt) < /* @__PURE__ */ new Date() ? (await this.delete(e), null) : a.value;
3124
- } catch (n) {
3125
- return console.error(`CloudflareCache: get error for key ${e}:`, n), null;
3124
+ } catch (s) {
3125
+ return console.error(`CloudflareCache: get error for key ${e}:`, s), null;
3126
3126
  }
3127
3127
  }
3128
- async set(e, n, s) {
3128
+ async set(e, s, n) {
3129
3129
  try {
3130
- const r = await this.getCache(), a = s ?? this.config.defaultTtlSeconds, i = a !== void 0, o = i ? Math.max(0, a) : 0, c = {
3131
- value: n,
3130
+ const r = await this.getCache(), a = n ?? this.config.defaultTtlSeconds, i = a !== void 0, o = i ? Math.max(0, a) : 0, c = {
3131
+ value: s,
3132
3132
  expiresAt: i ? new Date(Date.now() + (o > 0 ? o * 1e3 : -1)).toISOString() : void 0,
3133
3133
  cachedAt: (/* @__PURE__ */ new Date()).toISOString()
3134
3134
  }, u = this.createRequest(e), p = {
@@ -3145,10 +3145,10 @@ class tn {
3145
3145
  }
3146
3146
  async delete(e) {
3147
3147
  try {
3148
- const n = await this.getCache(), s = this.createRequest(e);
3149
- return await n.delete(s);
3150
- } catch (n) {
3151
- return console.error(`CloudflareCache: delete error for key ${e}:`, n), !1;
3148
+ const s = await this.getCache(), n = this.createRequest(e);
3149
+ return await s.delete(n);
3150
+ } catch (s) {
3151
+ return console.error(`CloudflareCache: delete error for key ${e}:`, s), !1;
3152
3152
  }
3153
3153
  }
3154
3154
  async deleteByPrefix(e) {
@@ -3162,7 +3162,7 @@ class tn {
3162
3162
  );
3163
3163
  }
3164
3164
  }
3165
- function nn(t = {}) {
3165
+ function ss(t = {}) {
3166
3166
  const e = {
3167
3167
  defaultTtlSeconds: 300,
3168
3168
  // 5 minutes default
@@ -3171,16 +3171,16 @@ function nn(t = {}) {
3171
3171
  ...t
3172
3172
  // user config overrides defaults
3173
3173
  };
3174
- return new tn(e);
3174
+ return new ts(e);
3175
3175
  }
3176
- let sn = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", dt = (t = 21) => {
3177
- let e = "", n = crypto.getRandomValues(new Uint8Array(t |= 0));
3176
+ let ns = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict", dt = (t = 21) => {
3177
+ let e = "", s = crypto.getRandomValues(new Uint8Array(t |= 0));
3178
3178
  for (; t--; )
3179
- e += sn[n[t] & 63];
3179
+ e += ns[s[t] & 63];
3180
3180
  return e;
3181
3181
  };
3182
3182
  async function We(t, e) {
3183
- const n = t.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), n);
3183
+ const s = t.timeout || 3e4, n = new AbortController(), r = setTimeout(() => n.abort(), s);
3184
3184
  try {
3185
3185
  const a = `https://api.sql.cloudflarestorage.com/api/v1/accounts/${t.accountId}/r2-sql/query/${t.warehouseName}`, i = await fetch(a, {
3186
3186
  method: "POST",
@@ -3192,7 +3192,7 @@ async function We(t, e) {
3192
3192
  body: JSON.stringify({
3193
3193
  query: e
3194
3194
  }),
3195
- signal: s.signal
3195
+ signal: n.signal
3196
3196
  });
3197
3197
  if (!i.ok)
3198
3198
  throw new Error(
@@ -3209,17 +3209,17 @@ async function We(t, e) {
3209
3209
  function be(t) {
3210
3210
  return `'${t.replace(/'/g, "''")}'`;
3211
3211
  }
3212
- function z(t) {
3212
+ function U(t) {
3213
3213
  return `"${t.replace(/"/g, '""')}"`;
3214
3214
  }
3215
3215
  function ut(t) {
3216
- const e = (n) => {
3217
- if (!n)
3216
+ const e = (s) => {
3217
+ if (!s)
3218
3218
  return "";
3219
3219
  try {
3220
- return JSON.parse(n);
3220
+ return JSON.parse(s);
3221
3221
  } catch {
3222
- return n;
3222
+ return s;
3223
3223
  }
3224
3224
  };
3225
3225
  return {
@@ -3254,46 +3254,46 @@ function ut(t) {
3254
3254
  } : void 0
3255
3255
  };
3256
3256
  }
3257
- function rn(t) {
3258
- return async (e, n) => {
3259
- const s = n.log_id || dt(), r = {
3260
- ...n,
3261
- log_id: s
3257
+ function rs(t) {
3258
+ return async (e, s) => {
3259
+ const n = s.log_id || dt(), r = {
3260
+ ...s,
3261
+ log_id: n
3262
3262
  };
3263
- return await an(t, e, r), r;
3263
+ return await as(t, e, r), r;
3264
3264
  };
3265
3265
  }
3266
- async function an(t, e, n) {
3267
- const s = (a) => a ? JSON.stringify(a) : void 0, r = {
3268
- id: n.log_id,
3266
+ async function as(t, e, s) {
3267
+ const n = (a) => a ? JSON.stringify(a) : void 0, r = {
3268
+ id: s.log_id,
3269
3269
  tenant_id: e,
3270
- type: n.type,
3271
- date: n.date,
3272
- description: n.description?.substring(0, 256),
3273
- ip: n.ip,
3274
- user_agent: n.user_agent,
3275
- details: s(n.details)?.substring(0, 8192),
3276
- isMobile: n.isMobile ? 1 : 0,
3277
- user_id: n.user_id,
3278
- user_name: n.user_name,
3279
- connection: n.connection,
3280
- connection_id: n.connection_id,
3281
- client_id: n.client_id,
3282
- client_name: n.client_name,
3283
- audience: n.audience,
3284
- scope: n.scope,
3285
- strategy: n.strategy,
3286
- strategy_type: n.strategy_type,
3287
- hostname: n.hostname,
3288
- auth0_client: s(n.auth0_client),
3289
- log_id: n.log_id,
3270
+ type: s.type,
3271
+ date: s.date,
3272
+ description: s.description?.substring(0, 256),
3273
+ ip: s.ip,
3274
+ user_agent: s.user_agent,
3275
+ details: n(s.details)?.substring(0, 8192),
3276
+ isMobile: s.isMobile ? 1 : 0,
3277
+ user_id: s.user_id,
3278
+ user_name: s.user_name,
3279
+ connection: s.connection,
3280
+ connection_id: s.connection_id,
3281
+ client_id: s.client_id,
3282
+ client_name: s.client_name,
3283
+ audience: s.audience,
3284
+ scope: s.scope,
3285
+ strategy: s.strategy,
3286
+ strategy_type: s.strategy_type,
3287
+ hostname: s.hostname,
3288
+ auth0_client: n(s.auth0_client),
3289
+ log_id: s.log_id,
3290
3290
  // Geo fields from location_info
3291
- country_code: n.location_info?.country_code,
3292
- city_name: n.location_info?.city_name,
3293
- latitude: n.location_info?.latitude,
3294
- longitude: n.location_info?.longitude,
3295
- time_zone: n.location_info?.time_zone,
3296
- continent_code: n.location_info?.continent_code
3291
+ country_code: s.location_info?.country_code,
3292
+ city_name: s.location_info?.city_name,
3293
+ latitude: s.location_info?.latitude,
3294
+ longitude: s.location_info?.longitude,
3295
+ time_zone: s.location_info?.time_zone,
3296
+ continent_code: s.location_info?.continent_code
3297
3297
  };
3298
3298
  try {
3299
3299
  if (t.pipelineBinding)
@@ -3325,12 +3325,12 @@ async function an(t, e, n) {
3325
3325
  throw console.error("Failed to send log to Pipeline:", a), a;
3326
3326
  }
3327
3327
  }
3328
- function on(t) {
3329
- return async (e, n) => {
3330
- const s = t.namespace || "default", r = t.tableName || "logs", a = `
3331
- SELECT * FROM ${z(s)}.${z(r)}
3328
+ function is(t) {
3329
+ return async (e, s) => {
3330
+ const n = t.namespace || "default", r = t.tableName || "logs", a = `
3331
+ SELECT * FROM ${U(n)}.${U(r)}
3332
3332
  WHERE tenant_id = ${be(e)}
3333
- AND id = ${be(n)}
3333
+ AND id = ${be(s)}
3334
3334
  LIMIT 1
3335
3335
  `, i = await We(t, a);
3336
3336
  if (i.length === 0)
@@ -3339,42 +3339,42 @@ function on(t) {
3339
3339
  return o ? ut(o) : null;
3340
3340
  };
3341
3341
  }
3342
- function cn(t) {
3342
+ function os(t) {
3343
3343
  const e = {};
3344
- return (t.match(/(\w+):(\S+)/g) || []).forEach((s) => {
3345
- const [r, a] = s.split(":");
3344
+ return (t.match(/(\w+):(\S+)/g) || []).forEach((n) => {
3345
+ const [r, a] = n.split(":");
3346
3346
  r && a && (e[r] = a);
3347
3347
  }), e;
3348
3348
  }
3349
- function dn(t) {
3349
+ function cs(t) {
3350
3350
  const e = [];
3351
- for (const [n, s] of Object.entries(t)) {
3352
- const r = n.replace(/[^a-zA-Z0-9_]/g, "");
3353
- r && s && e.push(
3354
- `${z(r)} = ${be(s)}`
3351
+ for (const [s, n] of Object.entries(t)) {
3352
+ const r = s.replace(/[^a-zA-Z0-9_]/g, "");
3353
+ r && n && e.push(
3354
+ `${U(r)} = ${be(n)}`
3355
3355
  );
3356
3356
  }
3357
3357
  return e;
3358
3358
  }
3359
- function un(t) {
3360
- return async (e, n = {}) => {
3361
- const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = n, c = t.namespace || "default", u = t.tableName || "logs", p = [
3359
+ function ds(t) {
3360
+ return async (e, s = {}) => {
3361
+ const { page: n = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = s, c = t.namespace || "default", u = t.tableName || "logs", p = [
3362
3362
  `tenant_id = ${be(e)}`
3363
3363
  ];
3364
3364
  if (o) {
3365
- const Q = cn(o);
3366
- p.push(...dn(Q));
3365
+ const J = os(o);
3366
+ p.push(...cs(J));
3367
3367
  }
3368
3368
  const k = p.join(" AND ");
3369
- let T = "ORDER BY date DESC";
3369
+ let C = "ORDER BY date DESC";
3370
3370
  if (i && i.sort_by) {
3371
- const Q = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), re = i.sort_order === "asc" ? "ASC" : "DESC";
3372
- T = `ORDER BY ${z(Q)} ${re}`;
3371
+ const J = i.sort_by.replace(/[^a-zA-Z0-9_]/g, ""), re = i.sort_order === "asc" ? "ASC" : "DESC";
3372
+ C = `ORDER BY ${U(J)} ${re}`;
3373
3373
  }
3374
- const S = s * r, E = `LIMIT ${r} OFFSET ${S}`, q = `
3375
- SELECT * FROM ${z(c)}.${z(u)}
3374
+ const S = n * r, E = `LIMIT ${r} OFFSET ${S}`, q = `
3375
+ SELECT * FROM ${U(c)}.${U(u)}
3376
3376
  WHERE ${k}
3377
- ${T}
3377
+ ${C}
3378
3378
  ${E}
3379
3379
  `, L = (await We(t, q)).map(ut);
3380
3380
  if (!a)
@@ -3385,7 +3385,7 @@ function un(t) {
3385
3385
  length: 0
3386
3386
  };
3387
3387
  const O = `
3388
- SELECT COUNT(*) as count FROM ${z(c)}.${z(u)}
3388
+ SELECT COUNT(*) as count FROM ${U(c)}.${U(u)}
3389
3389
  WHERE ${k}
3390
3390
  `, W = (await We(t, O))[0]?.count || 0;
3391
3391
  return {
@@ -3396,7 +3396,7 @@ function un(t) {
3396
3396
  };
3397
3397
  };
3398
3398
  }
3399
- function Sn() {
3399
+ function Ss() {
3400
3400
  return {
3401
3401
  async getDaily() {
3402
3402
  throw new Error(
@@ -3410,9 +3410,9 @@ function Sn() {
3410
3410
  }
3411
3411
  };
3412
3412
  }
3413
- function ln(t) {
3414
- const e = !!t.pipelineEndpoint, n = !!t.pipelineBinding;
3415
- if (!e && !n)
3413
+ function us(t) {
3414
+ const e = !!t.pipelineEndpoint, s = !!t.pipelineBinding;
3415
+ if (!e && !s)
3416
3416
  throw new Error(
3417
3417
  'R2 SQL logs adapter requires one of: "pipelineEndpoint" or "pipelineBinding"'
3418
3418
  );
@@ -3423,13 +3423,13 @@ function ln(t) {
3423
3423
  'R2 SQL logs adapter requires "warehouseName" configuration'
3424
3424
  );
3425
3425
  return {
3426
- create: rn(t),
3427
- list: un(t),
3428
- get: on(t)
3426
+ create: rs(t),
3427
+ list: ds(t),
3428
+ get: is(t)
3429
3429
  };
3430
3430
  }
3431
3431
  async function fe(t, e) {
3432
- const n = t.timeout || 3e4, s = new AbortController(), r = setTimeout(() => s.abort(), n);
3432
+ const s = t.timeout || 3e4, n = new AbortController(), r = setTimeout(() => n.abort(), s);
3433
3433
  try {
3434
3434
  const a = `https://api.cloudflare.com/client/v4/accounts/${t.accountId}/analytics_engine/sql`, i = await fetch(a, {
3435
3435
  method: "POST",
@@ -3438,7 +3438,7 @@ async function fe(t, e) {
3438
3438
  Authorization: `Bearer ${t.apiToken}`
3439
3439
  },
3440
3440
  body: e,
3441
- signal: s.signal
3441
+ signal: n.signal
3442
3442
  });
3443
3443
  if (!i.ok) {
3444
3444
  const c = await i.text();
@@ -3459,7 +3459,7 @@ async function fe(t, e) {
3459
3459
  function M(t) {
3460
3460
  return `'${t.replace(/'/g, "''").replace(/\\/g, "\\\\")}'`;
3461
3461
  }
3462
- function Qe(t) {
3462
+ function Je(t) {
3463
3463
  return `"${t.replace(/"/g, '""')}"`;
3464
3464
  }
3465
3465
  function lt(t) {
@@ -3470,11 +3470,11 @@ function lt(t) {
3470
3470
  } catch {
3471
3471
  return;
3472
3472
  }
3473
- }, n = t.double2 || t.timestamp, s = n ? new Date(n).toISOString() : "";
3473
+ }, s = t.double2 || t.timestamp, n = s ? new Date(s).toISOString() : "";
3474
3474
  return {
3475
3475
  log_id: t.blob1,
3476
3476
  type: t.blob3,
3477
- date: s,
3477
+ date: n,
3478
3478
  description: t.blob4,
3479
3479
  ip: t.blob5,
3480
3480
  user_agent: t.blob6,
@@ -3495,69 +3495,69 @@ function lt(t) {
3495
3495
  isMobile: t.double1 === 1
3496
3496
  };
3497
3497
  }
3498
- function hn(t) {
3499
- return async (e, n) => {
3500
- const s = n.log_id || dt(), r = {
3501
- ...n,
3502
- log_id: s
3498
+ function ls(t) {
3499
+ return async (e, s) => {
3500
+ const n = s.log_id || dt(), r = {
3501
+ ...s,
3502
+ log_id: n
3503
3503
  };
3504
- return fn(t, e, r), r;
3504
+ return hs(t, e, r), r;
3505
3505
  };
3506
3506
  }
3507
- function fn(t, e, n) {
3507
+ function hs(t, e, s) {
3508
3508
  if (!t.analyticsEngineBinding) {
3509
3509
  console.error("Analytics Engine binding not configured");
3510
3510
  return;
3511
3511
  }
3512
- const s = (a) => a == null ? "" : typeof a == "string" ? a : JSON.stringify(a), r = (a, i = 1024) => a.substring(0, i);
3512
+ const n = (a) => a == null ? "" : typeof a == "string" ? a : JSON.stringify(a), r = (a, i = 1024) => a.substring(0, i);
3513
3513
  try {
3514
3514
  t.analyticsEngineBinding.writeDataPoint({
3515
3515
  blobs: [
3516
- r(n.log_id),
3516
+ r(s.log_id),
3517
3517
  // blob1: log_id
3518
3518
  r(e),
3519
3519
  // blob2: tenant_id
3520
- r(n.type || ""),
3520
+ r(s.type || ""),
3521
3521
  // blob3: type
3522
- r(n.description || ""),
3522
+ r(s.description || ""),
3523
3523
  // blob4: description
3524
- r(n.ip || ""),
3524
+ r(s.ip || ""),
3525
3525
  // blob5: ip
3526
- r(n.user_agent || ""),
3526
+ r(s.user_agent || ""),
3527
3527
  // blob6: user_agent
3528
- r(n.user_id || ""),
3528
+ r(s.user_id || ""),
3529
3529
  // blob7: user_id
3530
- r(n.user_name || ""),
3530
+ r(s.user_name || ""),
3531
3531
  // blob8: user_name
3532
- r(n.connection || ""),
3532
+ r(s.connection || ""),
3533
3533
  // blob9: connection
3534
- r(n.connection_id || ""),
3534
+ r(s.connection_id || ""),
3535
3535
  // blob10: connection_id
3536
- r(n.client_id || ""),
3536
+ r(s.client_id || ""),
3537
3537
  // blob11: client_id
3538
- r(n.client_name || ""),
3538
+ r(s.client_name || ""),
3539
3539
  // blob12: client_name
3540
- r(n.audience || ""),
3540
+ r(s.audience || ""),
3541
3541
  // blob13: audience
3542
- r(n.scope || ""),
3542
+ r(s.scope || ""),
3543
3543
  // blob14: scope
3544
- r(n.strategy || ""),
3544
+ r(s.strategy || ""),
3545
3545
  // blob15: strategy
3546
- r(n.strategy_type || ""),
3546
+ r(s.strategy_type || ""),
3547
3547
  // blob16: strategy_type
3548
- r(n.hostname || ""),
3548
+ r(s.hostname || ""),
3549
3549
  // blob17: hostname
3550
- r(s(n.details)),
3550
+ r(n(s.details)),
3551
3551
  // blob18: details (JSON)
3552
- r(s(n.auth0_client)),
3552
+ r(n(s.auth0_client)),
3553
3553
  // blob19: auth0_client (JSON)
3554
- r(s(n.location_info))
3554
+ r(n(s.location_info))
3555
3555
  // blob20: location_info (JSON)
3556
3556
  ],
3557
3557
  doubles: [
3558
- n.isMobile ? 1 : 0,
3558
+ s.isMobile ? 1 : 0,
3559
3559
  // double1: isMobile
3560
- new Date(n.date).getTime()
3560
+ new Date(s.date).getTime()
3561
3561
  // double2: timestamp for sorting
3562
3562
  ],
3563
3563
  indexes: [e.substring(0, 96)]
@@ -3567,22 +3567,22 @@ function fn(t, e, n) {
3567
3567
  console.error("Failed to write log to Analytics Engine:", a);
3568
3568
  }
3569
3569
  }
3570
- function pn(t) {
3571
- return async (e, n) => {
3572
- const s = t.dataset || "authhero_logs", r = `
3570
+ function fs(t) {
3571
+ return async (e, s) => {
3572
+ const n = t.dataset || "authhero_logs", r = `
3573
3573
  SELECT *
3574
- FROM ${Qe(s)}
3574
+ FROM ${Je(n)}
3575
3575
  WHERE index1 = ${M(e)}
3576
- AND blob1 = ${M(n)}
3576
+ AND blob1 = ${M(s)}
3577
3577
  LIMIT 1
3578
3578
  `, a = await fe(t, r);
3579
3579
  return a.length === 0 || !a[0] ? null : lt(a[0]);
3580
3580
  };
3581
3581
  }
3582
- function mn(t) {
3582
+ function ps(t) {
3583
3583
  const e = {};
3584
- return (t.match(/(\w+):(\S+)/g) || []).forEach((s) => {
3585
- const r = s.indexOf(":"), a = s.substring(0, r), i = s.substring(r + 1);
3584
+ return (t.match(/(\w+):(\S+)/g) || []).forEach((n) => {
3585
+ const r = n.indexOf(":"), a = n.substring(0, r), i = n.substring(r + 1);
3586
3586
  a && i && (e[a] = i);
3587
3587
  }), e;
3588
3588
  }
@@ -3607,36 +3607,36 @@ function ht(t) {
3607
3607
  hostname: "blob17"
3608
3608
  }[t] || null;
3609
3609
  }
3610
- function _n(t) {
3610
+ function ms(t) {
3611
3611
  const e = [];
3612
- for (const [n, s] of Object.entries(t)) {
3613
- const r = ht(n);
3614
- r && s && e.push(`${r} = ${M(s)}`);
3612
+ for (const [s, n] of Object.entries(t)) {
3613
+ const r = ht(s);
3614
+ r && n && e.push(`${r} = ${M(n)}`);
3615
3615
  }
3616
3616
  return e;
3617
3617
  }
3618
- function yn(t) {
3618
+ function ys(t) {
3619
3619
  if (t === "date")
3620
3620
  return "double2";
3621
3621
  const e = ht(t);
3622
3622
  return e || "timestamp";
3623
3623
  }
3624
- function gn(t) {
3625
- return async (e, n = {}) => {
3626
- const { page: s = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = n, c = t.dataset || "authhero_logs", u = [`index1 = ${M(e)}`];
3624
+ function _s(t) {
3625
+ return async (e, s = {}) => {
3626
+ const { page: n = 0, per_page: r = 50, include_totals: a = !1, sort: i, q: o } = s, c = t.dataset || "authhero_logs", u = [`index1 = ${M(e)}`];
3627
3627
  if (o) {
3628
- const O = mn(o);
3629
- u.push(..._n(O));
3628
+ const O = ps(o);
3629
+ u.push(...ms(O));
3630
3630
  }
3631
3631
  const p = u.join(" AND ");
3632
3632
  let k = "ORDER BY timestamp DESC";
3633
3633
  if (i && i.sort_by) {
3634
- const O = yn(i.sort_by), j = i.sort_order === "asc" ? "ASC" : "DESC";
3634
+ const O = ys(i.sort_by), j = i.sort_order === "asc" ? "ASC" : "DESC";
3635
3635
  k = `ORDER BY ${O} ${j}`;
3636
3636
  }
3637
- const T = s * r, S = `LIMIT ${r} OFFSET ${T}`, E = `
3637
+ const C = n * r, S = `LIMIT ${r} OFFSET ${C}`, E = `
3638
3638
  SELECT *
3639
- FROM ${Qe(c)}
3639
+ FROM ${Je(c)}
3640
3640
  WHERE ${p}
3641
3641
  ${k}
3642
3642
  ${S}
@@ -3650,21 +3650,21 @@ function gn(t) {
3650
3650
  };
3651
3651
  const L = `
3652
3652
  SELECT count() as count
3653
- FROM ${Qe(c)}
3653
+ FROM ${Je(c)}
3654
3654
  WHERE ${p}
3655
3655
  `;
3656
3656
  try {
3657
3657
  const j = (await fe(t, L))[0]?.count || 0;
3658
3658
  return {
3659
3659
  logs: x,
3660
- start: T,
3660
+ start: C,
3661
3661
  limit: r,
3662
3662
  length: Number(j)
3663
3663
  };
3664
3664
  } catch {
3665
3665
  return {
3666
3666
  logs: x,
3667
- start: T,
3667
+ start: C,
3668
3668
  limit: r,
3669
3669
  length: x.length
3670
3670
  };
@@ -3684,33 +3684,33 @@ const Ye = [
3684
3684
  // SUCCESS_EXCHANGE_REFRESH_TOKEN_FOR_ACCESS_TOKEN
3685
3685
  "ssa"
3686
3686
  // SUCCESS_SILENT_AUTH
3687
- ], vn = ["pwd_leak", "signup_pwd_leak", "reset_pwd_leak"];
3687
+ ], gs = ["pwd_leak", "signup_pwd_leak", "reset_pwd_leak"];
3688
3688
  function Ke(t) {
3689
3689
  return `${t.slice(0, 4)}-${t.slice(4, 6)}-${t.slice(6, 8)}`;
3690
3690
  }
3691
3691
  function Ge(t) {
3692
3692
  return t.toISOString().split("T")[0];
3693
3693
  }
3694
- function Tn(t) {
3694
+ function Cs(t) {
3695
3695
  const e = t.dataset || "authhero_logs";
3696
3696
  return {
3697
- async getDaily(n, s = {}) {
3698
- const { from: r, to: a } = s, i = /* @__PURE__ */ new Date(), o = new Date(i);
3697
+ async getDaily(s, n = {}) {
3698
+ const { from: r, to: a } = n, i = /* @__PURE__ */ new Date(), o = new Date(i);
3699
3699
  o.setDate(o.getDate() - 30);
3700
- const c = r ? Ke(r) : Ge(o), u = a ? Ke(a) : Ge(i), p = (/* @__PURE__ */ new Date(`${c}T00:00:00Z`)).getTime(), k = (/* @__PURE__ */ new Date(`${u}T23:59:59.999Z`)).getTime(), T = Ye.map((x) => M(x)).join(
3700
+ const c = r ? Ke(r) : Ge(o), u = a ? Ke(a) : Ge(i), p = (/* @__PURE__ */ new Date(`${c}T00:00:00Z`)).getTime(), k = (/* @__PURE__ */ new Date(`${u}T23:59:59.999Z`)).getTime(), C = Ye.map((x) => M(x)).join(
3701
3701
  ", "
3702
- ), S = vn.map(
3702
+ ), S = gs.map(
3703
3703
  (x) => M(x)
3704
3704
  ).join(", "), E = `
3705
3705
  SELECT
3706
3706
  toDate(toDateTime(double2 / 1000)) AS date,
3707
- SUM(CASE WHEN blob3 IN (${T}) THEN 1 ELSE 0 END) AS logins,
3707
+ SUM(CASE WHEN blob3 IN (${C}) THEN 1 ELSE 0 END) AS logins,
3708
3708
  SUM(CASE WHEN blob3 = 'ss' THEN 1 ELSE 0 END) AS signups,
3709
3709
  SUM(CASE WHEN blob3 IN (${S}) THEN 1 ELSE 0 END) AS leaked_passwords,
3710
3710
  MIN(double2) AS first_event,
3711
3711
  MAX(double2) AS last_event
3712
3712
  FROM "${e}"
3713
- WHERE index1 = ${M(n)}
3713
+ WHERE index1 = ${M(s)}
3714
3714
  AND double2 >= ${p}
3715
3715
  AND double2 <= ${k}
3716
3716
  GROUP BY date
@@ -3725,15 +3725,15 @@ function Tn(t) {
3725
3725
  updated_at: x.last_event ? new Date(Number(x.last_event)).toISOString() : (/* @__PURE__ */ new Date()).toISOString()
3726
3726
  }));
3727
3727
  },
3728
- async getActiveUsers(n) {
3729
- const s = /* @__PURE__ */ new Date();
3730
- s.setDate(s.getDate() - 30);
3731
- const r = s.getTime(), a = Ye.map((u) => M(u)).join(
3728
+ async getActiveUsers(s) {
3729
+ const n = /* @__PURE__ */ new Date();
3730
+ n.setDate(n.getDate() - 30);
3731
+ const r = n.getTime(), a = Ye.map((u) => M(u)).join(
3732
3732
  ", "
3733
3733
  ), i = `
3734
3734
  SELECT COUNT(DISTINCT blob7) AS count
3735
3735
  FROM "${e}"
3736
- WHERE index1 = ${M(n)}
3736
+ WHERE index1 = ${M(s)}
3737
3737
  AND double2 >= ${r}
3738
3738
  AND blob3 IN (${a})
3739
3739
  AND blob7 IS NOT NULL
@@ -3743,26 +3743,26 @@ function Tn(t) {
3743
3743
  }
3744
3744
  };
3745
3745
  }
3746
- function bn(t) {
3746
+ function vs(t) {
3747
3747
  return t.analyticsEngineBinding || console.warn(
3748
3748
  "Analytics Engine: No binding configured. Logs will not be written to Analytics Engine."
3749
3749
  ), (!t.accountId || !t.apiToken) && console.warn(
3750
3750
  "Analytics Engine: accountId and apiToken are required for querying logs via SQL API."
3751
3751
  ), {
3752
- create: hn(t),
3753
- list: gn(t),
3754
- get: pn(t)
3752
+ create: ls(t),
3753
+ list: _s(t),
3754
+ get: fs(t)
3755
3755
  };
3756
3756
  }
3757
- function xn() {
3757
+ function bs() {
3758
3758
  return {
3759
3759
  async getGeoInfo(t) {
3760
3760
  try {
3761
- 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"];
3761
+ const e = t["cf-ipcountry"], s = t["cf-ipcity"], n = t["cf-iplatitude"], r = t["cf-iplongitude"], a = t["cf-timezone"], i = t["cf-ipcontinent"];
3762
3762
  return e ? {
3763
3763
  country_code: e,
3764
- city_name: n || "",
3765
- latitude: s || "",
3764
+ city_name: s || "",
3765
+ latitude: n || "",
3766
3766
  longitude: r || "",
3767
3767
  time_zone: a || "",
3768
3768
  continent_code: i || ""
@@ -3773,11 +3773,234 @@ function xn() {
3773
3773
  }
3774
3774
  };
3775
3775
  }
3776
- function Cn(t) {
3776
+ function xs(t) {
3777
+ return `// Auto-generated AuthHero code hook worker
3778
+
3779
+ const fnNames = {
3780
+ "post-user-login": "onExecutePostLogin",
3781
+ "credentials-exchange": "onExecuteCredentialsExchange",
3782
+ "pre-user-registration": "onExecutePreUserRegistration",
3783
+ "post-user-registration": "onExecutePostUserRegistration",
3784
+ };
3785
+
3786
+ const apiShapes = {
3787
+ "post-user-login": {
3788
+ accessToken: ["setCustomClaim"],
3789
+ idToken: ["setCustomClaim"],
3790
+ access: ["deny"],
3791
+ },
3792
+ "credentials-exchange": {
3793
+ accessToken: ["setCustomClaim"],
3794
+ idToken: ["setCustomClaim"],
3795
+ access: ["deny"],
3796
+ },
3797
+ "pre-user-registration": {
3798
+ user: ["setUserMetadata", "setLinkedTo"],
3799
+ access: ["deny"],
3800
+ },
3801
+ "post-user-registration": {},
3802
+ };
3803
+
3804
+ function createRecordingApiProxy(triggerId) {
3805
+ const calls = [];
3806
+ const shape = apiShapes[triggerId] || {};
3807
+ const api = {};
3808
+
3809
+ for (const [namespace, methods] of Object.entries(shape)) {
3810
+ const nsObj = {};
3811
+ for (const method of methods) {
3812
+ nsObj[method] = (...args) => {
3813
+ calls.push({ method: namespace + "." + method, args });
3814
+ };
3815
+ }
3816
+ api[namespace] = nsObj;
3817
+ }
3818
+
3819
+ return { api, getCalls: () => calls };
3820
+ }
3821
+
3822
+ // --- User code begins ---
3823
+ const exports = {};
3824
+ ${t}
3825
+ // --- User code ends ---
3826
+
3827
+ export default {
3828
+ async fetch(request) {
3829
+ const start = Date.now();
3830
+
3831
+ if (request.method !== "POST") {
3832
+ return new Response(JSON.stringify({
3833
+ success: false,
3834
+ error: "Method not allowed",
3835
+ durationMs: Date.now() - start,
3836
+ apiCalls: [],
3837
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
3838
+ }
3839
+
3840
+ let getCalls;
3841
+
3842
+ try {
3843
+ const { triggerId, event } = await request.json();
3844
+ const fnName = fnNames[triggerId];
3845
+
3846
+ if (!fnName) {
3847
+ return new Response(JSON.stringify({
3848
+ success: false,
3849
+ error: "Unknown trigger: " + triggerId,
3850
+ durationMs: Date.now() - start,
3851
+ apiCalls: [],
3852
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
3853
+ }
3854
+
3855
+ const proxy = createRecordingApiProxy(triggerId);
3856
+ getCalls = proxy.getCalls;
3857
+
3858
+ if (typeof exports[fnName] === "function") {
3859
+ await exports[fnName](event, proxy.api);
3860
+ }
3861
+
3862
+ return new Response(JSON.stringify({
3863
+ success: true,
3864
+ durationMs: Date.now() - start,
3865
+ apiCalls: getCalls(),
3866
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
3867
+
3868
+ } catch (err) {
3869
+ return new Response(JSON.stringify({
3870
+ success: false,
3871
+ error: err instanceof Error ? err.message : String(err),
3872
+ durationMs: Date.now() - start,
3873
+ apiCalls: getCalls ? getCalls() : [],
3874
+ }), { status: 200, headers: { "Content-Type": "application/json" } });
3875
+ }
3876
+ },
3877
+ };
3878
+ `;
3879
+ }
3880
+ class Ts {
3881
+ config;
3882
+ constructor(e) {
3883
+ this.config = e;
3884
+ }
3885
+ async execute(e) {
3886
+ const s = Date.now();
3887
+ if (!e.hookCodeId)
3888
+ return {
3889
+ success: !1,
3890
+ error: "CloudflareCodeExecutor requires hookCodeId",
3891
+ durationMs: Date.now() - s,
3892
+ apiCalls: []
3893
+ };
3894
+ const n = `hook-${e.hookCodeId}`, r = JSON.stringify({
3895
+ triggerId: e.triggerId,
3896
+ event: e.event
3897
+ });
3898
+ try {
3899
+ let a;
3900
+ if (this.config.dispatcher)
3901
+ a = await this.config.dispatcher.get(
3902
+ n,
3903
+ {},
3904
+ { limits: { cpuMs: e.cpuLimitMs ?? 5e3 } }
3905
+ ).fetch(
3906
+ new Request("https://hook.internal/execute", {
3907
+ method: "POST",
3908
+ headers: { "Content-Type": "application/json" },
3909
+ body: r
3910
+ })
3911
+ );
3912
+ else if (this.config.dispatchUrl)
3913
+ a = await fetch(`${this.config.dispatchUrl}/${n}`, {
3914
+ method: "POST",
3915
+ headers: {
3916
+ "Content-Type": "application/json",
3917
+ Authorization: `Bearer ${this.config.apiToken}`
3918
+ },
3919
+ body: r
3920
+ });
3921
+ else
3922
+ return {
3923
+ success: !1,
3924
+ error: "No dispatcher binding or dispatchUrl configured",
3925
+ durationMs: Date.now() - s,
3926
+ apiCalls: []
3927
+ };
3928
+ if (!a.ok) {
3929
+ const o = await a.text();
3930
+ return {
3931
+ success: !1,
3932
+ error: `Worker invocation failed (${a.status}): ${o}`,
3933
+ durationMs: Date.now() - s,
3934
+ apiCalls: []
3935
+ };
3936
+ }
3937
+ return {
3938
+ ...await a.json(),
3939
+ durationMs: Date.now() - s
3940
+ };
3941
+ } catch (a) {
3942
+ return {
3943
+ success: !1,
3944
+ error: a instanceof Error ? a.message : String(a),
3945
+ durationMs: Date.now() - s,
3946
+ apiCalls: []
3947
+ };
3948
+ }
3949
+ }
3950
+ /**
3951
+ * Deploy user code as a worker to the dispatch namespace.
3952
+ * Wraps the code in a worker template and uploads via Cloudflare API.
3953
+ */
3954
+ async deploy(e, s) {
3955
+ const n = `hook-${e}`, r = xs(s), a = `https://api.cloudflare.com/client/v4/accounts/${this.config.accountId}/workers/dispatch/namespaces/${this.config.dispatchNamespace}/scripts/${n}`, i = JSON.stringify({
3956
+ main_module: "index.js",
3957
+ compatibility_date: this.config.compatibilityDate ?? "2024-11-20"
3958
+ }), o = new FormData();
3959
+ o.append(
3960
+ "metadata",
3961
+ new Blob([i], { type: "application/json" })
3962
+ ), o.append(
3963
+ "index.js",
3964
+ new Blob([r], { type: "application/javascript+module" }),
3965
+ "index.js"
3966
+ );
3967
+ const c = await fetch(a, {
3968
+ method: "PUT",
3969
+ headers: {
3970
+ Authorization: `Bearer ${this.config.apiToken}`
3971
+ },
3972
+ body: o
3973
+ });
3974
+ if (!c.ok) {
3975
+ const u = await c.text();
3976
+ throw new Error(
3977
+ `Failed to deploy hook worker ${n}: ${c.status} ${u}`
3978
+ );
3979
+ }
3980
+ }
3981
+ /**
3982
+ * Remove a user worker from the dispatch namespace.
3983
+ */
3984
+ async remove(e) {
3985
+ const s = `hook-${e}`, n = `https://api.cloudflare.com/client/v4/accounts/${this.config.accountId}/workers/dispatch/namespaces/${this.config.dispatchNamespace}/scripts/${s}`, r = await fetch(n, {
3986
+ method: "DELETE",
3987
+ headers: {
3988
+ Authorization: `Bearer ${this.config.apiToken}`
3989
+ }
3990
+ });
3991
+ if (!r.ok && r.status !== 404) {
3992
+ const a = await r.text();
3993
+ throw new Error(
3994
+ `Failed to remove hook worker ${s}: ${r.status} ${a}`
3995
+ );
3996
+ }
3997
+ }
3998
+ }
3999
+ function Es(t) {
3777
4000
  const e = {
3778
- customDomains: en(t),
4001
+ customDomains: es(t),
3779
4002
  // Always create a cache adapter (let createCloudflareCache apply defaults)
3780
- cache: nn({
4003
+ cache: ss({
3781
4004
  ...t.cacheName && { cacheName: t.cacheName },
3782
4005
  ...t.defaultTtlSeconds !== void 0 && {
3783
4006
  defaultTtlSeconds: t.defaultTtlSeconds
@@ -3786,16 +4009,18 @@ function Cn(t) {
3786
4009
  }),
3787
4010
  // Always create the geo adapter - it extracts location from Cloudflare headers
3788
4011
  // passed at request time via getGeoInfo(headers)
3789
- geo: xn()
4012
+ geo: bs()
3790
4013
  };
3791
- return t.r2SqlLogs ? e.logs = ln(t.r2SqlLogs) : t.analyticsEngineLogs && (e.logs = bn(
4014
+ return t.r2SqlLogs ? e.logs = us(t.r2SqlLogs) : t.analyticsEngineLogs && (e.logs = vs(
3792
4015
  t.analyticsEngineLogs
3793
4016
  )), e;
3794
4017
  }
3795
4018
  export {
3796
- bn as createAnalyticsEngineLogsAdapter,
3797
- Tn as createAnalyticsEngineStatsAdapter,
3798
- ln as createR2SQLLogsAdapter,
3799
- Sn as createR2SQLStatsAdapter,
3800
- Cn as default
4019
+ Ts as CloudflareCodeExecutor,
4020
+ vs as createAnalyticsEngineLogsAdapter,
4021
+ Cs as createAnalyticsEngineStatsAdapter,
4022
+ us as createR2SQLLogsAdapter,
4023
+ Ss as createR2SQLStatsAdapter,
4024
+ Es as default,
4025
+ xs as generateWorkerScript
3801
4026
  };