@jsfsi-core/ts-crossplatform 1.0.14 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +17 -23
  2. package/dist/index.mjs +860 -753
  3. package/package.json +4 -4
package/dist/index.mjs CHANGED
@@ -1,36 +1,36 @@
1
- const At = (e = {}) => e, Rt = (e) => [e, void 0], Ct = (e) => [
1
+ const or = (e = {}) => e, ur = (e) => [e, void 0], sr = (e) => [
2
2
  void 0,
3
3
  e
4
4
  ];
5
- class Ft {
5
+ class ir {
6
6
  name;
7
7
  constructor() {
8
8
  this.name = this.constructor.name;
9
9
  }
10
10
  }
11
- const Mt = (
11
+ const cr = (
12
12
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
- (e) => (n) => !(n instanceof e)
14
- ), Ut = (
13
+ ((e) => (n) => !(n instanceof e))
14
+ ), ar = (
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- (e) => (n) => n instanceof e
17
- ), Vt = (e, n = process.env) => {
16
+ ((e) => (n) => n instanceof e)
17
+ ), lr = (e, n = process.env) => {
18
18
  const t = e.safeParse(n);
19
19
  if (!t.success)
20
20
  throw new Error(`Invalid environment variables: ${JSON.stringify(t.error.issues)}`);
21
21
  return t.data;
22
22
  };
23
- function Dt(e) {
23
+ function fr(e) {
24
24
  return new Promise((n) => setTimeout(n, e));
25
25
  }
26
- function Ue(e, n) {
26
+ function Ke(e, n) {
27
27
  return new Date(e).toLocaleDateString(n, {
28
28
  year: "numeric",
29
29
  month: "2-digit",
30
30
  day: "2-digit"
31
31
  });
32
32
  }
33
- function Ve(e, n) {
33
+ function Ye(e, n) {
34
34
  return new Date(e).toLocaleTimeString(n, {
35
35
  hour12: !1,
36
36
  hour: "2-digit",
@@ -38,49 +38,50 @@ function Ve(e, n) {
38
38
  second: "2-digit"
39
39
  });
40
40
  }
41
- function Lt(e, n) {
42
- return `${Ue(e, n)} ${Ve(e, n)}`;
41
+ function dr(e, n) {
42
+ return `${Ke(e, n)} ${Ye(e, n)}`;
43
43
  }
44
- const De = "00000000-0000-0000-0000-000000000000", Le = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
45
- function ye(e) {
46
- return typeof e == "string" && Le.test(e);
44
+ const qe = "00000000-0000-0000-0000-000000000000", Be = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;
45
+ function Ee(e) {
46
+ return typeof e == "string" && Be.test(e);
47
47
  }
48
- function Ge(e) {
49
- if (!ye(e))
48
+ function Xe(e) {
49
+ if (!Ee(e))
50
50
  throw TypeError("Invalid UUID");
51
51
  let n;
52
52
  return Uint8Array.of((n = parseInt(e.slice(0, 8), 16)) >>> 24, n >>> 16 & 255, n >>> 8 & 255, n & 255, (n = parseInt(e.slice(9, 13), 16)) >>> 8, n & 255, (n = parseInt(e.slice(14, 18), 16)) >>> 8, n & 255, (n = parseInt(e.slice(19, 23), 16)) >>> 8, n & 255, (n = parseInt(e.slice(24, 36), 16)) / 1099511627776 & 255, n / 4294967296 & 255, n >>> 24 & 255, n >>> 16 & 255, n >>> 8 & 255, n & 255);
53
53
  }
54
- const b = [];
54
+ const v = [];
55
55
  for (let e = 0; e < 256; ++e)
56
- b.push((e + 256).toString(16).slice(1));
57
- function Ke(e, n = 0) {
58
- return (b[e[n + 0]] + b[e[n + 1]] + b[e[n + 2]] + b[e[n + 3]] + "-" + b[e[n + 4]] + b[e[n + 5]] + "-" + b[e[n + 6]] + b[e[n + 7]] + "-" + b[e[n + 8]] + b[e[n + 9]] + "-" + b[e[n + 10]] + b[e[n + 11]] + b[e[n + 12]] + b[e[n + 13]] + b[e[n + 14]] + b[e[n + 15]]).toLowerCase();
59
- }
60
- let L;
61
- const Ye = new Uint8Array(16);
62
- function qe() {
63
- if (!L) {
56
+ v.push((e + 256).toString(16).slice(1));
57
+ function We(e, n = 0) {
58
+ return (v[e[n + 0]] + v[e[n + 1]] + v[e[n + 2]] + v[e[n + 3]] + "-" + v[e[n + 4]] + v[e[n + 5]] + "-" + v[e[n + 6]] + v[e[n + 7]] + "-" + v[e[n + 8]] + v[e[n + 9]] + "-" + v[e[n + 10]] + v[e[n + 11]] + v[e[n + 12]] + v[e[n + 13]] + v[e[n + 14]] + v[e[n + 15]]).toLowerCase();
59
+ }
60
+ let J;
61
+ const He = new Uint8Array(16);
62
+ function Qe() {
63
+ if (!J) {
64
64
  if (typeof crypto > "u" || !crypto.getRandomValues)
65
65
  throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
66
- L = crypto.getRandomValues.bind(crypto);
66
+ J = crypto.getRandomValues.bind(crypto);
67
67
  }
68
- return L(Ye);
68
+ return J(He);
69
69
  }
70
- const Be = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), re = { randomUUID: Be };
71
- function Xe(e, n, t) {
72
- if (re.randomUUID && !e)
73
- return re.randomUUID();
70
+ const en = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), oe = { randomUUID: en };
71
+ function nn(e, n, t) {
74
72
  e = e || {};
75
- const r = e.random ?? e.rng?.() ?? qe();
73
+ const r = e.random ?? e.rng?.() ?? Qe();
76
74
  if (r.length < 16)
77
75
  throw new Error("Random bytes length must be >= 16");
78
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, Ke(r);
76
+ return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, We(r);
77
+ }
78
+ function tn(e, n, t) {
79
+ return oe.randomUUID && !e ? oe.randomUUID() : nn(e);
79
80
  }
80
- class x {
81
+ class S {
81
82
  uuid;
82
83
  constructor(n) {
83
- Ge(n), this.uuid = n;
84
+ Xe(n), this.uuid = n;
84
85
  }
85
86
  toString() {
86
87
  return this.uuid;
@@ -89,62 +90,67 @@ class x {
89
90
  return this.uuid === n.toString();
90
91
  }
91
92
  static new() {
92
- return new x(Xe());
93
+ return new S(tn());
93
94
  }
94
95
  static empty() {
95
- return new x(De);
96
+ return new S(qe);
96
97
  }
97
98
  static isValid(n) {
98
- return !!(n && ye(n));
99
+ return !!(n && Ee(n));
99
100
  }
100
101
  static parse(n) {
101
- return n && x.isValid(n) ? new x(n) : void 0;
102
+ return n && S.isValid(n) ? new S(n) : void 0;
102
103
  }
103
104
  }
104
- function c(e, n, t) {
105
- function r(s, l) {
106
- var f;
107
- Object.defineProperty(s, "_zod", {
108
- value: s._zod ?? {},
105
+ function a(e, n, t) {
106
+ function r(i, c) {
107
+ var l;
108
+ Object.defineProperty(i, "_zod", {
109
+ value: i._zod ?? {},
109
110
  enumerable: !1
110
- }), (f = s._zod).traits ?? (f.traits = /* @__PURE__ */ new Set()), s._zod.traits.add(e), n(s, l);
111
- for (const y in i.prototype)
112
- y in s || Object.defineProperty(s, y, { value: i.prototype[y].bind(s) });
113
- s._zod.constr = i, s._zod.def = l;
111
+ }), (l = i._zod).traits ?? (l.traits = /* @__PURE__ */ new Set()), i._zod.traits.add(e), n(i, c);
112
+ for (const f in u.prototype)
113
+ f in i || Object.defineProperty(i, f, { value: u.prototype[f].bind(i) });
114
+ i._zod.constr = u, i._zod.def = c;
114
115
  }
115
116
  const o = t?.Parent ?? Object;
116
- class u extends o {
117
+ class s extends o {
117
118
  }
118
- Object.defineProperty(u, "name", { value: e });
119
- function i(s) {
120
- var l;
121
- const f = t?.Parent ? new u() : this;
122
- r(f, s), (l = f._zod).deferred ?? (l.deferred = []);
123
- for (const y of f._zod.deferred)
124
- y();
125
- return f;
119
+ Object.defineProperty(s, "name", { value: e });
120
+ function u(i) {
121
+ var c;
122
+ const l = t?.Parent ? new s() : this;
123
+ r(l, i), (c = l._zod).deferred ?? (c.deferred = []);
124
+ for (const f of l._zod.deferred)
125
+ f();
126
+ return l;
126
127
  }
127
- return Object.defineProperty(i, "init", { value: r }), Object.defineProperty(i, Symbol.hasInstance, {
128
- value: (s) => t?.Parent && s instanceof t.Parent ? !0 : s?._zod?.traits?.has(e)
129
- }), Object.defineProperty(i, "name", { value: e }), i;
128
+ return Object.defineProperty(u, "init", { value: r }), Object.defineProperty(u, Symbol.hasInstance, {
129
+ value: (i) => t?.Parent && i instanceof t.Parent ? !0 : i?._zod?.traits?.has(e)
130
+ }), Object.defineProperty(u, "name", { value: e }), u;
130
131
  }
131
- class S extends Error {
132
+ class j extends Error {
132
133
  constructor() {
133
134
  super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
134
135
  }
135
136
  }
136
- const ke = {};
137
+ class $e extends Error {
138
+ constructor(n) {
139
+ super(`Encountered unidirectional transform during encode: ${n}`), this.name = "ZodEncodeError";
140
+ }
141
+ }
142
+ const Ze = {};
137
143
  function P(e) {
138
- return ke;
144
+ return Ze;
139
145
  }
140
- function Je(e) {
146
+ function rn(e) {
141
147
  const n = Object.values(e).filter((r) => typeof r == "number");
142
148
  return Object.entries(e).filter(([r, o]) => n.indexOf(+r) === -1).map(([r, o]) => o);
143
149
  }
144
- function We(e, n) {
150
+ function q(e, n) {
145
151
  return typeof n == "bigint" ? n.toString() : n;
146
152
  }
147
- function $e(e) {
153
+ function W(e) {
148
154
  return {
149
155
  get value() {
150
156
  {
@@ -154,35 +160,41 @@ function $e(e) {
154
160
  }
155
161
  };
156
162
  }
157
- function J(e) {
163
+ function H(e) {
158
164
  return e == null;
159
165
  }
160
- function W(e) {
166
+ function Q(e) {
161
167
  const n = e.startsWith("^") ? 1 : 0, t = e.endsWith("$") ? e.length - 1 : e.length;
162
168
  return e.slice(n, t);
163
169
  }
164
- function He(e, n) {
165
- const t = (e.toString().split(".")[1] || "").length, r = (n.toString().split(".")[1] || "").length, o = t > r ? t : r, u = Number.parseInt(e.toFixed(o).replace(".", "")), i = Number.parseInt(n.toFixed(o).replace(".", ""));
166
- return u % i / 10 ** o;
170
+ function on(e, n) {
171
+ const t = (e.toString().split(".")[1] || "").length, r = n.toString();
172
+ let o = (r.split(".")[1] || "").length;
173
+ if (o === 0 && /\d?e-\d?/.test(r)) {
174
+ const c = r.match(/\d?e-(\d?)/);
175
+ c?.[1] && (o = Number.parseInt(c[1]));
176
+ }
177
+ const s = t > o ? t : o, u = Number.parseInt(e.toFixed(s).replace(".", "")), i = Number.parseInt(n.toFixed(s).replace(".", ""));
178
+ return u % i / 10 ** s;
167
179
  }
168
- function h(e, n, t) {
180
+ const ue = Symbol("evaluating");
181
+ function d(e, n, t) {
182
+ let r;
169
183
  Object.defineProperty(e, n, {
170
184
  get() {
171
- {
172
- const r = t();
173
- return e[n] = r, r;
174
- }
185
+ if (r !== ue)
186
+ return r === void 0 && (r = ue, r = t()), r;
175
187
  },
176
- set(r) {
188
+ set(o) {
177
189
  Object.defineProperty(e, n, {
178
- value: r
190
+ value: o
179
191
  // configurable: true,
180
192
  });
181
193
  },
182
194
  configurable: !0
183
195
  });
184
196
  }
185
- function H(e, n, t) {
197
+ function T(e, n, t) {
186
198
  Object.defineProperty(e, n, {
187
199
  value: t,
188
200
  writable: !0,
@@ -190,15 +202,23 @@ function H(e, n, t) {
190
202
  configurable: !0
191
203
  });
192
204
  }
193
- function O(e) {
205
+ function I(...e) {
206
+ const n = {};
207
+ for (const t of e) {
208
+ const r = Object.getOwnPropertyDescriptors(t);
209
+ Object.assign(n, r);
210
+ }
211
+ return Object.defineProperties({}, n);
212
+ }
213
+ function se(e) {
194
214
  return JSON.stringify(e);
195
215
  }
196
- const Ze = Error.captureStackTrace ? Error.captureStackTrace : (...e) => {
216
+ const Pe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
197
217
  };
198
- function Y(e) {
218
+ function F(e) {
199
219
  return typeof e == "object" && e !== null && !Array.isArray(e);
200
220
  }
201
- const Qe = $e(() => {
221
+ const un = W(() => {
202
222
  if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
203
223
  return !1;
204
224
  try {
@@ -208,24 +228,27 @@ const Qe = $e(() => {
208
228
  return !1;
209
229
  }
210
230
  });
211
- function q(e) {
212
- if (Y(e) === !1)
231
+ function x(e) {
232
+ if (F(e) === !1)
213
233
  return !1;
214
234
  const n = e.constructor;
215
235
  if (n === void 0)
216
236
  return !0;
217
237
  const t = n.prototype;
218
- return !(Y(t) === !1 || Object.prototype.hasOwnProperty.call(t, "isPrototypeOf") === !1);
238
+ return !(F(t) === !1 || Object.prototype.hasOwnProperty.call(t, "isPrototypeOf") === !1);
239
+ }
240
+ function Oe(e) {
241
+ return x(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
219
242
  }
220
- const en = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
221
- function nn(e) {
243
+ const sn = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
244
+ function cn(e) {
222
245
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
223
246
  }
224
- function N(e, n, t) {
247
+ function $(e, n, t) {
225
248
  const r = new e._zod.constr(n ?? e._zod.def);
226
249
  return (!n || t?.parent) && (r._zod.parent = e), r;
227
250
  }
228
- function g(e) {
251
+ function p(e) {
229
252
  const n = e;
230
253
  if (!n)
231
254
  return {};
@@ -238,134 +261,159 @@ function g(e) {
238
261
  }
239
262
  return delete n.message, typeof n.error == "string" ? { ...n, error: () => n.error } : n;
240
263
  }
241
- function tn(e) {
264
+ function an(e) {
242
265
  return Object.keys(e).filter((n) => e[n]._zod.optin === "optional" && e[n]._zod.optout === "optional");
243
266
  }
244
- const rn = {
267
+ const ln = {
245
268
  safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
246
269
  int32: [-2147483648, 2147483647],
247
270
  uint32: [0, 4294967295],
248
271
  float32: [-34028234663852886e22, 34028234663852886e22],
249
272
  float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
250
273
  };
251
- function on(e, n) {
252
- const t = {}, r = e._zod.def;
253
- for (const o in n) {
254
- if (!(o in r.shape))
255
- throw new Error(`Unrecognized key: "${o}"`);
256
- n[o] && (t[o] = r.shape[o]);
257
- }
258
- return N(e, {
259
- ...e._zod.def,
260
- shape: t,
274
+ function fn(e, n) {
275
+ const t = e._zod.def, r = I(e._zod.def, {
276
+ get shape() {
277
+ const o = {};
278
+ for (const s in n) {
279
+ if (!(s in t.shape))
280
+ throw new Error(`Unrecognized key: "${s}"`);
281
+ n[s] && (o[s] = t.shape[s]);
282
+ }
283
+ return T(this, "shape", o), o;
284
+ },
261
285
  checks: []
262
286
  });
287
+ return $(e, r);
263
288
  }
264
- function un(e, n) {
265
- const t = { ...e._zod.def.shape }, r = e._zod.def;
266
- for (const o in n) {
267
- if (!(o in r.shape))
268
- throw new Error(`Unrecognized key: "${o}"`);
269
- n[o] && delete t[o];
270
- }
271
- return N(e, {
272
- ...e._zod.def,
273
- shape: t,
289
+ function dn(e, n) {
290
+ const t = e._zod.def, r = I(e._zod.def, {
291
+ get shape() {
292
+ const o = { ...e._zod.def.shape };
293
+ for (const s in n) {
294
+ if (!(s in t.shape))
295
+ throw new Error(`Unrecognized key: "${s}"`);
296
+ n[s] && delete o[s];
297
+ }
298
+ return T(this, "shape", o), o;
299
+ },
274
300
  checks: []
275
301
  });
302
+ return $(e, r);
276
303
  }
277
- function sn(e, n) {
278
- if (!q(n))
304
+ function hn(e, n) {
305
+ if (!x(n))
279
306
  throw new Error("Invalid input to extend: expected a plain object");
307
+ const t = e._zod.def.checks;
308
+ if (t && t.length > 0)
309
+ throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
310
+ const o = I(e._zod.def, {
311
+ get shape() {
312
+ const s = { ...e._zod.def.shape, ...n };
313
+ return T(this, "shape", s), s;
314
+ },
315
+ checks: []
316
+ });
317
+ return $(e, o);
318
+ }
319
+ function pn(e, n) {
320
+ if (!x(n))
321
+ throw new Error("Invalid input to safeExtend: expected a plain object");
280
322
  const t = {
281
323
  ...e._zod.def,
282
324
  get shape() {
283
325
  const r = { ...e._zod.def.shape, ...n };
284
- return H(this, "shape", r), r;
326
+ return T(this, "shape", r), r;
285
327
  },
286
- checks: []
287
- // delete existing checks
328
+ checks: e._zod.def.checks
288
329
  };
289
- return N(e, t);
330
+ return $(e, t);
290
331
  }
291
- function cn(e, n) {
292
- return N(e, {
293
- ...e._zod.def,
332
+ function mn(e, n) {
333
+ const t = I(e._zod.def, {
294
334
  get shape() {
295
- const t = { ...e._zod.def.shape, ...n._zod.def.shape };
296
- return H(this, "shape", t), t;
335
+ const r = { ...e._zod.def.shape, ...n._zod.def.shape };
336
+ return T(this, "shape", r), r;
337
+ },
338
+ get catchall() {
339
+ return n._zod.def.catchall;
297
340
  },
298
- catchall: n._zod.def.catchall,
299
341
  checks: []
300
342
  // delete existing checks
301
343
  });
344
+ return $(e, t);
302
345
  }
303
- function an(e, n, t) {
304
- const r = n._zod.def.shape, o = { ...r };
305
- if (t)
306
- for (const u in t) {
307
- if (!(u in r))
308
- throw new Error(`Unrecognized key: "${u}"`);
309
- t[u] && (o[u] = e ? new e({
310
- type: "optional",
311
- innerType: r[u]
312
- }) : r[u]);
313
- }
314
- else
315
- for (const u in r)
316
- o[u] = e ? new e({
317
- type: "optional",
318
- innerType: r[u]
319
- }) : r[u];
320
- return N(n, {
321
- ...n._zod.def,
322
- shape: o,
346
+ function _n(e, n, t) {
347
+ const r = I(n._zod.def, {
348
+ get shape() {
349
+ const o = n._zod.def.shape, s = { ...o };
350
+ if (t)
351
+ for (const u in t) {
352
+ if (!(u in o))
353
+ throw new Error(`Unrecognized key: "${u}"`);
354
+ t[u] && (s[u] = e ? new e({
355
+ type: "optional",
356
+ innerType: o[u]
357
+ }) : o[u]);
358
+ }
359
+ else
360
+ for (const u in o)
361
+ s[u] = e ? new e({
362
+ type: "optional",
363
+ innerType: o[u]
364
+ }) : o[u];
365
+ return T(this, "shape", s), s;
366
+ },
323
367
  checks: []
324
368
  });
369
+ return $(n, r);
325
370
  }
326
- function ln(e, n, t) {
327
- const r = n._zod.def.shape, o = { ...r };
328
- if (t)
329
- for (const u in t) {
330
- if (!(u in o))
331
- throw new Error(`Unrecognized key: "${u}"`);
332
- t[u] && (o[u] = new e({
333
- type: "nonoptional",
334
- innerType: r[u]
335
- }));
336
- }
337
- else
338
- for (const u in r)
339
- o[u] = new e({
340
- type: "nonoptional",
341
- innerType: r[u]
342
- });
343
- return N(n, {
344
- ...n._zod.def,
345
- shape: o,
346
- // optional: [],
371
+ function gn(e, n, t) {
372
+ const r = I(n._zod.def, {
373
+ get shape() {
374
+ const o = n._zod.def.shape, s = { ...o };
375
+ if (t)
376
+ for (const u in t) {
377
+ if (!(u in s))
378
+ throw new Error(`Unrecognized key: "${u}"`);
379
+ t[u] && (s[u] = new e({
380
+ type: "nonoptional",
381
+ innerType: o[u]
382
+ }));
383
+ }
384
+ else
385
+ for (const u in o)
386
+ s[u] = new e({
387
+ type: "nonoptional",
388
+ innerType: o[u]
389
+ });
390
+ return T(this, "shape", s), s;
391
+ },
347
392
  checks: []
348
393
  });
394
+ return $(n, r);
349
395
  }
350
- function j(e, n = 0) {
396
+ function N(e, n = 0) {
397
+ if (e.aborted === !0)
398
+ return !0;
351
399
  for (let t = n; t < e.issues.length; t++)
352
400
  if (e.issues[t]?.continue !== !0)
353
401
  return !0;
354
402
  return !1;
355
403
  }
356
- function Q(e, n) {
404
+ function Te(e, n) {
357
405
  return n.map((t) => {
358
406
  var r;
359
407
  return (r = t).path ?? (r.path = []), t.path.unshift(e), t;
360
408
  });
361
409
  }
362
- function F(e) {
410
+ function C(e) {
363
411
  return typeof e == "string" ? e : e?.message;
364
412
  }
365
- function I(e, n, t) {
413
+ function O(e, n, t) {
366
414
  const r = { ...e, path: e.path ?? [] };
367
415
  if (!e.message) {
368
- const o = F(e.inst?._zod.def?.error?.(e)) ?? F(n?.error?.(e)) ?? F(t.customError?.(e)) ?? F(t.localeError?.(e)) ?? "Invalid input";
416
+ const o = C(e.inst?._zod.def?.error?.(e)) ?? C(n?.error?.(e)) ?? C(t.customError?.(e)) ?? C(t.localeError?.(e)) ?? "Invalid input";
369
417
  r.message = o;
370
418
  }
371
419
  return delete r.inst, delete r.continue, n?.reportInput || delete r.input, r;
@@ -373,7 +421,7 @@ function I(e, n, t) {
373
421
  function ee(e) {
374
422
  return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
375
423
  }
376
- function A(...e) {
424
+ function R(...e) {
377
425
  const [n, t, r] = e;
378
426
  return typeof n == "string" ? {
379
427
  message: n,
@@ -382,98 +430,102 @@ function A(...e) {
382
430
  inst: r
383
431
  } : { ...n };
384
432
  }
385
- const Ee = (e, n) => {
433
+ const Ie = (e, n) => {
386
434
  e.name = "$ZodError", Object.defineProperty(e, "_zod", {
387
435
  value: e._zod,
388
436
  enumerable: !1
389
437
  }), Object.defineProperty(e, "issues", {
390
438
  value: n,
391
439
  enumerable: !1
392
- }), Object.defineProperty(e, "message", {
393
- get() {
394
- return JSON.stringify(n, We, 2);
395
- },
396
- enumerable: !0
397
- // configurable: false,
398
- }), Object.defineProperty(e, "toString", {
440
+ }), e.message = JSON.stringify(n, q, 2), Object.defineProperty(e, "toString", {
399
441
  value: () => e.message,
400
442
  enumerable: !1
401
443
  });
402
- }, Pe = c("$ZodError", Ee), Ie = c("$ZodError", Ee, { Parent: Error });
403
- function fn(e, n = (t) => t.message) {
444
+ }, Ne = a("$ZodError", Ie), je = a("$ZodError", Ie, { Parent: Error });
445
+ function vn(e, n = (t) => t.message) {
404
446
  const t = {}, r = [];
405
447
  for (const o of e.issues)
406
448
  o.path.length > 0 ? (t[o.path[0]] = t[o.path[0]] || [], t[o.path[0]].push(n(o))) : r.push(n(o));
407
449
  return { formErrors: r, fieldErrors: t };
408
450
  }
409
- function pn(e, n) {
410
- const t = n || function(u) {
411
- return u.message;
412
- }, r = { _errors: [] }, o = (u) => {
413
- for (const i of u.issues)
414
- if (i.code === "invalid_union" && i.errors.length)
415
- i.errors.map((s) => o({ issues: s }));
416
- else if (i.code === "invalid_key")
417
- o({ issues: i.issues });
418
- else if (i.code === "invalid_element")
419
- o({ issues: i.issues });
420
- else if (i.path.length === 0)
421
- r._errors.push(t(i));
451
+ function zn(e, n = (t) => t.message) {
452
+ const t = { _errors: [] }, r = (o) => {
453
+ for (const s of o.issues)
454
+ if (s.code === "invalid_union" && s.errors.length)
455
+ s.errors.map((u) => r({ issues: u }));
456
+ else if (s.code === "invalid_key")
457
+ r({ issues: s.issues });
458
+ else if (s.code === "invalid_element")
459
+ r({ issues: s.issues });
460
+ else if (s.path.length === 0)
461
+ t._errors.push(n(s));
422
462
  else {
423
- let s = r, l = 0;
424
- for (; l < i.path.length; ) {
425
- const f = i.path[l];
426
- l === i.path.length - 1 ? (s[f] = s[f] || { _errors: [] }, s[f]._errors.push(t(i))) : s[f] = s[f] || { _errors: [] }, s = s[f], l++;
463
+ let u = t, i = 0;
464
+ for (; i < s.path.length; ) {
465
+ const c = s.path[i];
466
+ i === s.path.length - 1 ? (u[c] = u[c] || { _errors: [] }, u[c]._errors.push(n(s))) : u[c] = u[c] || { _errors: [] }, u = u[c], i++;
427
467
  }
428
468
  }
429
469
  };
430
- return o(e), r;
431
- }
432
- const hn = (e) => (n, t, r, o) => {
433
- const u = r ? Object.assign(r, { async: !1 }) : { async: !1 }, i = n._zod.run({ value: t, issues: [] }, u);
434
- if (i instanceof Promise)
435
- throw new S();
436
- if (i.issues.length) {
437
- const s = new (o?.Err ?? e)(i.issues.map((l) => I(l, u, P())));
438
- throw Ze(s, o?.callee), s;
470
+ return r(e), t;
471
+ }
472
+ const ne = (e) => (n, t, r, o) => {
473
+ const s = r ? Object.assign(r, { async: !1 }) : { async: !1 }, u = n._zod.run({ value: t, issues: [] }, s);
474
+ if (u instanceof Promise)
475
+ throw new j();
476
+ if (u.issues.length) {
477
+ const i = new (o?.Err ?? e)(u.issues.map((c) => O(c, s, P())));
478
+ throw Pe(i, o?.callee), i;
439
479
  }
440
- return i.value;
441
- }, dn = (e) => async (n, t, r, o) => {
442
- const u = r ? Object.assign(r, { async: !0 }) : { async: !0 };
443
- let i = n._zod.run({ value: t, issues: [] }, u);
444
- if (i instanceof Promise && (i = await i), i.issues.length) {
445
- const s = new (o?.Err ?? e)(i.issues.map((l) => I(l, u, P())));
446
- throw Ze(s, o?.callee), s;
480
+ return u.value;
481
+ }, te = (e) => async (n, t, r, o) => {
482
+ const s = r ? Object.assign(r, { async: !0 }) : { async: !0 };
483
+ let u = n._zod.run({ value: t, issues: [] }, s);
484
+ if (u instanceof Promise && (u = await u), u.issues.length) {
485
+ const i = new (o?.Err ?? e)(u.issues.map((c) => O(c, s, P())));
486
+ throw Pe(i, o?.callee), i;
447
487
  }
448
- return i.value;
449
- }, Ne = (e) => (n, t, r) => {
450
- const o = r ? { ...r, async: !1 } : { async: !1 }, u = n._zod.run({ value: t, issues: [] }, o);
451
- if (u instanceof Promise)
452
- throw new S();
453
- return u.issues.length ? {
488
+ return u.value;
489
+ }, V = (e) => (n, t, r) => {
490
+ const o = r ? { ...r, async: !1 } : { async: !1 }, s = n._zod.run({ value: t, issues: [] }, o);
491
+ if (s instanceof Promise)
492
+ throw new j();
493
+ return s.issues.length ? {
454
494
  success: !1,
455
- error: new (e ?? Pe)(u.issues.map((i) => I(i, o, P())))
456
- } : { success: !0, data: u.value };
457
- }, mn = /* @__PURE__ */ Ne(Ie), Te = (e) => async (n, t, r) => {
495
+ error: new (e ?? Ne)(s.issues.map((u) => O(u, o, P())))
496
+ } : { success: !0, data: s.value };
497
+ }, bn = /* @__PURE__ */ V(je), L = (e) => async (n, t, r) => {
458
498
  const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
459
- let u = n._zod.run({ value: t, issues: [] }, o);
460
- return u instanceof Promise && (u = await u), u.issues.length ? {
499
+ let s = n._zod.run({ value: t, issues: [] }, o);
500
+ return s instanceof Promise && (s = await s), s.issues.length ? {
461
501
  success: !1,
462
- error: new e(u.issues.map((i) => I(i, o, P())))
463
- } : { success: !0, data: u.value };
464
- }, _n = /* @__PURE__ */ Te(Ie), vn = /^\d+$/, gn = /^-?\d+(?:\.\d+)?/i, $ = /* @__PURE__ */ c("$ZodCheck", (e, n) => {
502
+ error: new e(s.issues.map((u) => O(u, o, P())))
503
+ } : { success: !0, data: s.value };
504
+ }, wn = /* @__PURE__ */ L(je), yn = (e) => (n, t, r) => {
505
+ const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
506
+ return ne(e)(n, t, o);
507
+ }, kn = (e) => (n, t, r) => ne(e)(n, t, r), En = (e) => async (n, t, r) => {
508
+ const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
509
+ return te(e)(n, t, o);
510
+ }, $n = (e) => async (n, t, r) => te(e)(n, t, r), Zn = (e) => (n, t, r) => {
511
+ const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
512
+ return V(e)(n, t, o);
513
+ }, Pn = (e) => (n, t, r) => V(e)(n, t, r), On = (e) => async (n, t, r) => {
514
+ const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
515
+ return L(e)(n, t, o);
516
+ }, Tn = (e) => async (n, t, r) => L(e)(n, t, r), In = /^-?\d+$/, Nn = /^-?\d+(?:\.\d+)?/, k = /* @__PURE__ */ a("$ZodCheck", (e, n) => {
465
517
  var t;
466
518
  e._zod ?? (e._zod = {}), e._zod.def = n, (t = e._zod).onattach ?? (t.onattach = []);
467
- }), Oe = {
519
+ }), Ae = {
468
520
  number: "number",
469
521
  bigint: "bigint",
470
522
  object: "date"
471
- }, xe = /* @__PURE__ */ c("$ZodCheckLessThan", (e, n) => {
472
- $.init(e, n);
473
- const t = Oe[typeof n.value];
523
+ }, Se = /* @__PURE__ */ a("$ZodCheckLessThan", (e, n) => {
524
+ k.init(e, n);
525
+ const t = Ae[typeof n.value];
474
526
  e._zod.onattach.push((r) => {
475
- const o = r._zod.bag, u = (n.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
476
- n.value < u && (n.inclusive ? o.maximum = n.value : o.exclusiveMaximum = n.value);
527
+ const o = r._zod.bag, s = (n.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
528
+ n.value < s && (n.inclusive ? o.maximum = n.value : o.exclusiveMaximum = n.value);
477
529
  }), e._zod.check = (r) => {
478
530
  (n.inclusive ? r.value <= n.value : r.value < n.value) || r.issues.push({
479
531
  origin: t,
@@ -485,12 +537,12 @@ const hn = (e) => (n, t, r, o) => {
485
537
  continue: !n.abort
486
538
  });
487
539
  };
488
- }), je = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, n) => {
489
- $.init(e, n);
490
- const t = Oe[typeof n.value];
540
+ }), xe = /* @__PURE__ */ a("$ZodCheckGreaterThan", (e, n) => {
541
+ k.init(e, n);
542
+ const t = Ae[typeof n.value];
491
543
  e._zod.onattach.push((r) => {
492
- const o = r._zod.bag, u = (n.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
493
- n.value > u && (n.inclusive ? o.minimum = n.value : o.exclusiveMinimum = n.value);
544
+ const o = r._zod.bag, s = (n.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
545
+ n.value > s && (n.inclusive ? o.minimum = n.value : o.exclusiveMinimum = n.value);
494
546
  }), e._zod.check = (r) => {
495
547
  (n.inclusive ? r.value >= n.value : r.value > n.value) || r.issues.push({
496
548
  origin: t,
@@ -502,14 +554,14 @@ const hn = (e) => (n, t, r, o) => {
502
554
  continue: !n.abort
503
555
  });
504
556
  };
505
- }), zn = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, n) => {
506
- $.init(e, n), e._zod.onattach.push((t) => {
557
+ }), jn = /* @__PURE__ */ a("$ZodCheckMultipleOf", (e, n) => {
558
+ k.init(e, n), e._zod.onattach.push((t) => {
507
559
  var r;
508
560
  (r = t._zod.bag).multipleOf ?? (r.multipleOf = n.value);
509
561
  }), e._zod.check = (t) => {
510
562
  if (typeof t.value != typeof n.value)
511
563
  throw new Error("Cannot mix number and bigint in multiple_of check.");
512
- (typeof t.value == "bigint" ? t.value % n.value === BigInt(0) : He(t.value, n.value) === 0) || t.issues.push({
564
+ (typeof t.value == "bigint" ? t.value % n.value === BigInt(0) : on(t.value, n.value) === 0) || t.issues.push({
513
565
  origin: typeof t.value,
514
566
  code: "not_multiple_of",
515
567
  divisor: n.value,
@@ -518,36 +570,37 @@ const hn = (e) => (n, t, r, o) => {
518
570
  continue: !n.abort
519
571
  });
520
572
  };
521
- }), wn = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, n) => {
522
- $.init(e, n), n.format = n.format || "float64";
523
- const t = n.format?.includes("int"), r = t ? "int" : "number", [o, u] = rn[n.format];
524
- e._zod.onattach.push((i) => {
525
- const s = i._zod.bag;
526
- s.format = n.format, s.minimum = o, s.maximum = u, t && (s.pattern = vn);
527
- }), e._zod.check = (i) => {
528
- const s = i.value;
573
+ }), An = /* @__PURE__ */ a("$ZodCheckNumberFormat", (e, n) => {
574
+ k.init(e, n), n.format = n.format || "float64";
575
+ const t = n.format?.includes("int"), r = t ? "int" : "number", [o, s] = ln[n.format];
576
+ e._zod.onattach.push((u) => {
577
+ const i = u._zod.bag;
578
+ i.format = n.format, i.minimum = o, i.maximum = s, t && (i.pattern = In);
579
+ }), e._zod.check = (u) => {
580
+ const i = u.value;
529
581
  if (t) {
530
- if (!Number.isInteger(s)) {
531
- i.issues.push({
582
+ if (!Number.isInteger(i)) {
583
+ u.issues.push({
532
584
  expected: r,
533
585
  format: n.format,
534
586
  code: "invalid_type",
535
- input: s,
587
+ continue: !1,
588
+ input: i,
536
589
  inst: e
537
590
  });
538
591
  return;
539
592
  }
540
- if (!Number.isSafeInteger(s)) {
541
- s > 0 ? i.issues.push({
542
- input: s,
593
+ if (!Number.isSafeInteger(i)) {
594
+ i > 0 ? u.issues.push({
595
+ input: i,
543
596
  code: "too_big",
544
597
  maximum: Number.MAX_SAFE_INTEGER,
545
598
  note: "Integers must be within the safe integer range.",
546
599
  inst: e,
547
600
  origin: r,
548
601
  continue: !n.abort
549
- }) : i.issues.push({
550
- input: s,
602
+ }) : u.issues.push({
603
+ input: i,
551
604
  code: "too_small",
552
605
  minimum: Number.MIN_SAFE_INTEGER,
553
606
  note: "Integers must be within the safe integer range.",
@@ -558,27 +611,27 @@ const hn = (e) => (n, t, r, o) => {
558
611
  return;
559
612
  }
560
613
  }
561
- s < o && i.issues.push({
614
+ i < o && u.issues.push({
562
615
  origin: "number",
563
- input: s,
616
+ input: i,
564
617
  code: "too_small",
565
618
  minimum: o,
566
619
  inclusive: !0,
567
620
  inst: e,
568
621
  continue: !n.abort
569
- }), s > u && i.issues.push({
622
+ }), i > s && u.issues.push({
570
623
  origin: "number",
571
- input: s,
624
+ input: i,
572
625
  code: "too_big",
573
- maximum: u,
626
+ maximum: s,
574
627
  inst: e
575
628
  });
576
629
  };
577
- }), bn = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, n) => {
630
+ }), Sn = /* @__PURE__ */ a("$ZodCheckMaxLength", (e, n) => {
578
631
  var t;
579
- $.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
632
+ k.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
580
633
  const o = r.value;
581
- return !J(o) && o.length !== void 0;
634
+ return !H(o) && o.length !== void 0;
582
635
  }), e._zod.onattach.push((r) => {
583
636
  const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
584
637
  n.maximum < o && (r._zod.bag.maximum = n.maximum);
@@ -586,9 +639,9 @@ const hn = (e) => (n, t, r, o) => {
586
639
  const o = r.value;
587
640
  if (o.length <= n.maximum)
588
641
  return;
589
- const i = ee(o);
642
+ const u = ee(o);
590
643
  r.issues.push({
591
- origin: i,
644
+ origin: u,
592
645
  code: "too_big",
593
646
  maximum: n.maximum,
594
647
  inclusive: !0,
@@ -597,11 +650,11 @@ const hn = (e) => (n, t, r, o) => {
597
650
  continue: !n.abort
598
651
  });
599
652
  };
600
- }), yn = /* @__PURE__ */ c("$ZodCheckMinLength", (e, n) => {
653
+ }), xn = /* @__PURE__ */ a("$ZodCheckMinLength", (e, n) => {
601
654
  var t;
602
- $.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
655
+ k.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
603
656
  const o = r.value;
604
- return !J(o) && o.length !== void 0;
657
+ return !H(o) && o.length !== void 0;
605
658
  }), e._zod.onattach.push((r) => {
606
659
  const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
607
660
  n.minimum > o && (r._zod.bag.minimum = n.minimum);
@@ -609,9 +662,9 @@ const hn = (e) => (n, t, r, o) => {
609
662
  const o = r.value;
610
663
  if (o.length >= n.minimum)
611
664
  return;
612
- const i = ee(o);
665
+ const u = ee(o);
613
666
  r.issues.push({
614
- origin: i,
667
+ origin: u,
615
668
  code: "too_small",
616
669
  minimum: n.minimum,
617
670
  inclusive: !0,
@@ -620,22 +673,22 @@ const hn = (e) => (n, t, r, o) => {
620
673
  continue: !n.abort
621
674
  });
622
675
  };
623
- }), kn = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, n) => {
676
+ }), Rn = /* @__PURE__ */ a("$ZodCheckLengthEquals", (e, n) => {
624
677
  var t;
625
- $.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
678
+ k.init(e, n), (t = e._zod.def).when ?? (t.when = (r) => {
626
679
  const o = r.value;
627
- return !J(o) && o.length !== void 0;
680
+ return !H(o) && o.length !== void 0;
628
681
  }), e._zod.onattach.push((r) => {
629
682
  const o = r._zod.bag;
630
683
  o.minimum = n.length, o.maximum = n.length, o.length = n.length;
631
684
  }), e._zod.check = (r) => {
632
- const o = r.value, u = o.length;
633
- if (u === n.length)
685
+ const o = r.value, s = o.length;
686
+ if (s === n.length)
634
687
  return;
635
- const i = ee(o), s = u > n.length;
688
+ const u = ee(o), i = s > n.length;
636
689
  r.issues.push({
637
- origin: i,
638
- ...s ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
690
+ origin: u,
691
+ ...i ? { code: "too_big", maximum: n.length } : { code: "too_small", minimum: n.length },
639
692
  inclusive: !0,
640
693
  exact: !0,
641
694
  input: r.value,
@@ -643,12 +696,12 @@ const hn = (e) => (n, t, r, o) => {
643
696
  continue: !n.abort
644
697
  });
645
698
  };
646
- }), $n = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, n) => {
647
- $.init(e, n), e._zod.check = (t) => {
699
+ }), Cn = /* @__PURE__ */ a("$ZodCheckOverwrite", (e, n) => {
700
+ k.init(e, n), e._zod.check = (t) => {
648
701
  t.value = n.tx(t.value);
649
702
  };
650
703
  });
651
- class Zn {
704
+ class Dn {
652
705
  constructor(n = []) {
653
706
  this.content = [], this.indent = 0, this && (this.args = n);
654
707
  }
@@ -661,80 +714,96 @@ class Zn {
661
714
  return;
662
715
  }
663
716
  const r = n.split(`
664
- `).filter((i) => i), o = Math.min(...r.map((i) => i.length - i.trimStart().length)), u = r.map((i) => i.slice(o)).map((i) => " ".repeat(this.indent * 2) + i);
665
- for (const i of u)
666
- this.content.push(i);
717
+ `).filter((u) => u), o = Math.min(...r.map((u) => u.length - u.trimStart().length)), s = r.map((u) => u.slice(o)).map((u) => " ".repeat(this.indent * 2) + u);
718
+ for (const u of s)
719
+ this.content.push(u);
667
720
  }
668
721
  compile() {
669
- const n = Function, t = this?.args, o = [...(this?.content ?? [""]).map((u) => ` ${u}`)];
722
+ const n = Function, t = this?.args, o = [...(this?.content ?? [""]).map((s) => ` ${s}`)];
670
723
  return new n(...t, o.join(`
671
724
  `));
672
725
  }
673
726
  }
674
- const En = {
727
+ const Un = {
675
728
  major: 4,
676
- minor: 0,
677
- patch: 5
678
- }, _ = /* @__PURE__ */ c("$ZodType", (e, n) => {
729
+ minor: 1,
730
+ patch: 12
731
+ }, m = /* @__PURE__ */ a("$ZodType", (e, n) => {
679
732
  var t;
680
- e ?? (e = {}), e._zod.def = n, e._zod.bag = e._zod.bag || {}, e._zod.version = En;
733
+ e ?? (e = {}), e._zod.def = n, e._zod.bag = e._zod.bag || {}, e._zod.version = Un;
681
734
  const r = [...e._zod.def.checks ?? []];
682
735
  e._zod.traits.has("$ZodCheck") && r.unshift(e);
683
736
  for (const o of r)
684
- for (const u of o._zod.onattach)
685
- u(e);
737
+ for (const s of o._zod.onattach)
738
+ s(e);
686
739
  if (r.length === 0)
687
740
  (t = e._zod).deferred ?? (t.deferred = []), e._zod.deferred?.push(() => {
688
741
  e._zod.run = e._zod.parse;
689
742
  });
690
743
  else {
691
- const o = (u, i, s) => {
692
- let l = j(u), f;
693
- for (const y of i) {
694
- if (y._zod.def.when) {
695
- if (!y._zod.def.when(u))
744
+ const o = (u, i, c) => {
745
+ let l = N(u), f;
746
+ for (const z of i) {
747
+ if (z._zod.def.when) {
748
+ if (!z._zod.def.when(u))
696
749
  continue;
697
750
  } else if (l)
698
751
  continue;
699
- const a = u.issues.length, p = y._zod.check(u);
700
- if (p instanceof Promise && s?.async === !1)
701
- throw new S();
702
- if (f || p instanceof Promise)
752
+ const h = u.issues.length, _ = z._zod.check(u);
753
+ if (_ instanceof Promise && c?.async === !1)
754
+ throw new j();
755
+ if (f || _ instanceof Promise)
703
756
  f = (f ?? Promise.resolve()).then(async () => {
704
- await p, u.issues.length !== a && (l || (l = j(u, a)));
757
+ await _, u.issues.length !== h && (l || (l = N(u, h)));
705
758
  });
706
759
  else {
707
- if (u.issues.length === a)
760
+ if (u.issues.length === h)
708
761
  continue;
709
- l || (l = j(u, a));
762
+ l || (l = N(u, h));
710
763
  }
711
764
  }
712
765
  return f ? f.then(() => u) : u;
766
+ }, s = (u, i, c) => {
767
+ if (N(u))
768
+ return u.aborted = !0, u;
769
+ const l = o(i, r, c);
770
+ if (l instanceof Promise) {
771
+ if (c.async === !1)
772
+ throw new j();
773
+ return l.then((f) => e._zod.parse(f, c));
774
+ }
775
+ return e._zod.parse(l, c);
713
776
  };
714
777
  e._zod.run = (u, i) => {
715
- const s = e._zod.parse(u, i);
716
- if (s instanceof Promise) {
778
+ if (i.skipChecks)
779
+ return e._zod.parse(u, i);
780
+ if (i.direction === "backward") {
781
+ const l = e._zod.parse({ value: u.value, issues: [] }, { ...i, skipChecks: !0 });
782
+ return l instanceof Promise ? l.then((f) => s(f, u, i)) : s(l, u, i);
783
+ }
784
+ const c = e._zod.parse(u, i);
785
+ if (c instanceof Promise) {
717
786
  if (i.async === !1)
718
- throw new S();
719
- return s.then((l) => o(l, r, i));
787
+ throw new j();
788
+ return c.then((l) => o(l, r, i));
720
789
  }
721
- return o(s, r, i);
790
+ return o(c, r, i);
722
791
  };
723
792
  }
724
793
  e["~standard"] = {
725
794
  validate: (o) => {
726
795
  try {
727
- const u = mn(e, o);
728
- return u.success ? { value: u.data } : { issues: u.error?.issues };
796
+ const s = bn(e, o);
797
+ return s.success ? { value: s.data } : { issues: s.error?.issues };
729
798
  } catch {
730
- return _n(e, o).then((i) => i.success ? { value: i.data } : { issues: i.error?.issues });
799
+ return wn(e, o).then((u) => u.success ? { value: u.data } : { issues: u.error?.issues });
731
800
  }
732
801
  },
733
802
  vendor: "zod",
734
803
  version: 1
735
804
  };
736
- }), Se = /* @__PURE__ */ c("$ZodNumber", (e, n) => {
737
- _.init(e, n), e._zod.pattern = e._zod.bag.pattern ?? gn, e._zod.parse = (t, r) => {
805
+ }), Re = /* @__PURE__ */ a("$ZodNumber", (e, n) => {
806
+ m.init(e, n), e._zod.pattern = e._zod.bag.pattern ?? Nn, e._zod.parse = (t, r) => {
738
807
  if (n.coerce)
739
808
  try {
740
809
  t.value = Number(t.value);
@@ -743,32 +812,32 @@ const En = {
743
812
  const o = t.value;
744
813
  if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
745
814
  return t;
746
- const u = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
815
+ const s = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
747
816
  return t.issues.push({
748
817
  expected: "number",
749
818
  code: "invalid_type",
750
819
  input: o,
751
820
  inst: e,
752
- ...u ? { received: u } : {}
821
+ ...s ? { received: s } : {}
753
822
  }), t;
754
823
  };
755
- }), Pn = /* @__PURE__ */ c("$ZodNumber", (e, n) => {
756
- wn.init(e, n), Se.init(e, n);
757
- }), In = /* @__PURE__ */ c("$ZodUnknown", (e, n) => {
758
- _.init(e, n), e._zod.parse = (t) => t;
759
- }), Nn = /* @__PURE__ */ c("$ZodNever", (e, n) => {
760
- _.init(e, n), e._zod.parse = (t, r) => (t.issues.push({
824
+ }), Fn = /* @__PURE__ */ a("$ZodNumber", (e, n) => {
825
+ An.init(e, n), Re.init(e, n);
826
+ }), Mn = /* @__PURE__ */ a("$ZodUnknown", (e, n) => {
827
+ m.init(e, n), e._zod.parse = (t) => t;
828
+ }), Vn = /* @__PURE__ */ a("$ZodNever", (e, n) => {
829
+ m.init(e, n), e._zod.parse = (t, r) => (t.issues.push({
761
830
  expected: "never",
762
831
  code: "invalid_type",
763
832
  input: t.value,
764
833
  inst: e
765
834
  }), t);
766
835
  });
767
- function oe(e, n, t) {
768
- e.issues.length && n.issues.push(...Q(t, e.issues)), n.value[t] = e.value;
836
+ function ie(e, n, t) {
837
+ e.issues.length && n.issues.push(...Te(t, e.issues)), n.value[t] = e.value;
769
838
  }
770
- const Tn = /* @__PURE__ */ c("$ZodArray", (e, n) => {
771
- _.init(e, n), e._zod.parse = (t, r) => {
839
+ const Ln = /* @__PURE__ */ a("$ZodArray", (e, n) => {
840
+ m.init(e, n), e._zod.parse = (t, r) => {
772
841
  const o = t.value;
773
842
  if (!Array.isArray(o))
774
843
  return t.issues.push({
@@ -778,186 +847,197 @@ const Tn = /* @__PURE__ */ c("$ZodArray", (e, n) => {
778
847
  inst: e
779
848
  }), t;
780
849
  t.value = Array(o.length);
781
- const u = [];
782
- for (let i = 0; i < o.length; i++) {
783
- const s = o[i], l = n.element._zod.run({
784
- value: s,
850
+ const s = [];
851
+ for (let u = 0; u < o.length; u++) {
852
+ const i = o[u], c = n.element._zod.run({
853
+ value: i,
785
854
  issues: []
786
855
  }, r);
787
- l instanceof Promise ? u.push(l.then((f) => oe(f, t, i))) : oe(l, t, i);
856
+ c instanceof Promise ? s.push(c.then((l) => ie(l, t, u))) : ie(c, t, u);
788
857
  }
789
- return u.length ? Promise.all(u).then(() => t) : t;
858
+ return s.length ? Promise.all(s).then(() => t) : t;
790
859
  };
791
860
  });
792
- function M(e, n, t) {
793
- e.issues.length && n.issues.push(...Q(t, e.issues)), n.value[t] = e.value;
794
- }
795
- function ue(e, n, t, r) {
796
- e.issues.length ? r[t] === void 0 ? t in r ? n.value[t] = void 0 : n.value[t] = e.value : n.issues.push(...Q(t, e.issues)) : e.value === void 0 ? t in r && (n.value[t] = void 0) : n.value[t] = e.value;
797
- }
798
- const On = /* @__PURE__ */ c("$ZodObject", (e, n) => {
799
- _.init(e, n);
800
- const t = $e(() => {
801
- const a = Object.keys(n.shape);
802
- for (const d of a)
803
- if (!(n.shape[d] instanceof _))
804
- throw new Error(`Invalid element at key "${d}": expected a Zod schema`);
805
- const p = tn(n.shape);
806
- return {
807
- shape: n.shape,
808
- keys: a,
809
- keySet: new Set(a),
810
- numKeys: a.length,
811
- optionalKeys: new Set(p)
812
- };
813
- });
814
- h(e._zod, "propValues", () => {
815
- const a = n.shape, p = {};
816
- for (const d in a) {
817
- const k = a[d]._zod;
818
- if (k.values) {
819
- p[d] ?? (p[d] = /* @__PURE__ */ new Set());
820
- for (const Z of k.values)
821
- p[d].add(Z);
861
+ function M(e, n, t, r) {
862
+ e.issues.length && n.issues.push(...Te(t, e.issues)), e.value === void 0 ? t in r && (n.value[t] = void 0) : n.value[t] = e.value;
863
+ }
864
+ function Ce(e) {
865
+ const n = Object.keys(e.shape);
866
+ for (const r of n)
867
+ if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
868
+ throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
869
+ const t = an(e.shape);
870
+ return {
871
+ ...e,
872
+ keys: n,
873
+ keySet: new Set(n),
874
+ numKeys: n.length,
875
+ optionalKeys: new Set(t)
876
+ };
877
+ }
878
+ function De(e, n, t, r, o, s) {
879
+ const u = [], i = o.keySet, c = o.catchall._zod, l = c.def.type;
880
+ for (const f of Object.keys(n)) {
881
+ if (i.has(f))
882
+ continue;
883
+ if (l === "never") {
884
+ u.push(f);
885
+ continue;
886
+ }
887
+ const z = c.run({ value: n[f], issues: [] }, r);
888
+ z instanceof Promise ? e.push(z.then((h) => M(h, t, f, n))) : M(z, t, f, n);
889
+ }
890
+ return u.length && t.issues.push({
891
+ code: "unrecognized_keys",
892
+ keys: u,
893
+ input: n,
894
+ inst: s
895
+ }), e.length ? Promise.all(e).then(() => t) : t;
896
+ }
897
+ const Gn = /* @__PURE__ */ a("$ZodObject", (e, n) => {
898
+ if (m.init(e, n), !Object.getOwnPropertyDescriptor(n, "shape")?.get) {
899
+ const i = n.shape;
900
+ Object.defineProperty(n, "shape", {
901
+ get: () => {
902
+ const c = { ...i };
903
+ return Object.defineProperty(n, "shape", {
904
+ value: c
905
+ }), c;
906
+ }
907
+ });
908
+ }
909
+ const r = W(() => Ce(n));
910
+ d(e._zod, "propValues", () => {
911
+ const i = n.shape, c = {};
912
+ for (const l in i) {
913
+ const f = i[l]._zod;
914
+ if (f.values) {
915
+ c[l] ?? (c[l] = /* @__PURE__ */ new Set());
916
+ for (const z of f.values)
917
+ c[l].add(z);
822
918
  }
823
919
  }
824
- return p;
920
+ return c;
825
921
  });
826
- const r = (a) => {
827
- const p = new Zn(["shape", "payload", "ctx"]), d = t.value, k = (w) => {
828
- const m = O(w);
829
- return `shape[${m}]._zod.run({ value: input[${m}], issues: [] }, ctx)`;
830
- };
831
- p.write("const input = payload.value;");
832
- const Z = /* @__PURE__ */ Object.create(null);
833
- let D = 0;
834
- for (const w of d.keys)
835
- Z[w] = `key_${D++}`;
836
- p.write("const newResult = {}");
837
- for (const w of d.keys)
838
- if (d.optionalKeys.has(w)) {
839
- const m = Z[w];
840
- p.write(`const ${m} = ${k(w)};`);
841
- const v = O(w);
842
- p.write(`
843
- if (${m}.issues.length) {
844
- if (input[${v}] === undefined) {
845
- if (${v} in input) {
846
- newResult[${v}] = undefined;
847
- }
848
- } else {
849
- payload.issues = payload.issues.concat(
850
- ${m}.issues.map((iss) => ({
851
- ...iss,
852
- path: iss.path ? [${v}, ...iss.path] : [${v}],
853
- }))
854
- );
855
- }
856
- } else if (${m}.value === undefined) {
857
- if (${v} in input) newResult[${v}] = undefined;
858
- } else {
859
- newResult[${v}] = ${m}.value;
860
- }
861
- `);
862
- } else {
863
- const m = Z[w];
864
- p.write(`const ${m} = ${k(w)};`), p.write(`
865
- if (${m}.issues.length) payload.issues = payload.issues.concat(${m}.issues.map(iss => ({
866
- ...iss,
867
- path: iss.path ? [${O(w)}, ...iss.path] : [${O(w)}]
868
- })));`), p.write(`newResult[${O(w)}] = ${m}.value`);
869
- }
870
- p.write("payload.value = newResult;"), p.write("return payload;");
871
- const R = p.compile();
872
- return (w, m) => R(a, w, m);
873
- };
874
- let o;
875
- const u = Y, i = !ke.jitless, l = i && Qe.value, f = n.catchall;
876
- let y;
877
- e._zod.parse = (a, p) => {
878
- y ?? (y = t.value);
879
- const d = a.value;
880
- if (!u(d))
881
- return a.issues.push({
922
+ const o = F, s = n.catchall;
923
+ let u;
924
+ e._zod.parse = (i, c) => {
925
+ u ?? (u = r.value);
926
+ const l = i.value;
927
+ if (!o(l))
928
+ return i.issues.push({
882
929
  expected: "object",
883
930
  code: "invalid_type",
884
- input: d,
931
+ input: l,
885
932
  inst: e
886
- }), a;
887
- const k = [];
888
- if (i && l && p?.async === !1 && p.jitless !== !0)
889
- o || (o = r(n.shape)), a = o(a, p);
890
- else {
891
- a.value = {};
892
- const m = y.shape;
893
- for (const v of y.keys) {
894
- const T = m[v], C = T._zod.run({ value: d[v], issues: [] }, p), ne = T._zod.optin === "optional" && T._zod.optout === "optional";
895
- C instanceof Promise ? k.push(C.then((te) => ne ? ue(te, a, v, d) : M(te, a, v))) : ne ? ue(C, a, v, d) : M(C, a, v);
896
- }
933
+ }), i;
934
+ i.value = {};
935
+ const f = [], z = u.shape;
936
+ for (const h of u.keys) {
937
+ const b = z[h]._zod.run({ value: l[h], issues: [] }, c);
938
+ b instanceof Promise ? f.push(b.then((G) => M(G, i, h, l))) : M(b, i, h, l);
897
939
  }
898
- if (!f)
899
- return k.length ? Promise.all(k).then(() => a) : a;
900
- const Z = [], D = y.keySet, R = f._zod, w = R.def.type;
901
- for (const m of Object.keys(d)) {
902
- if (D.has(m))
903
- continue;
904
- if (w === "never") {
905
- Z.push(m);
906
- continue;
907
- }
908
- const v = R.run({ value: d[m], issues: [] }, p);
909
- v instanceof Promise ? k.push(v.then((T) => M(T, a, m))) : M(v, a, m);
940
+ return s ? De(f, l, i, c, r.value, e) : f.length ? Promise.all(f).then(() => i) : i;
941
+ };
942
+ }), Jn = /* @__PURE__ */ a("$ZodObjectJIT", (e, n) => {
943
+ Gn.init(e, n);
944
+ const t = e._zod.parse, r = W(() => Ce(n)), o = (h) => {
945
+ const _ = new Dn(["shape", "payload", "ctx"]), b = r.value, G = (E) => {
946
+ const y = se(E);
947
+ return `shape[${y}]._zod.run({ value: input[${y}], issues: [] }, ctx)`;
948
+ };
949
+ _.write("const input = payload.value;");
950
+ const re = /* @__PURE__ */ Object.create(null);
951
+ let Ge = 0;
952
+ for (const E of b.keys)
953
+ re[E] = `key_${Ge++}`;
954
+ _.write("const newResult = {};");
955
+ for (const E of b.keys) {
956
+ const y = re[E], A = se(E);
957
+ _.write(`const ${y} = ${G(E)};`), _.write(`
958
+ if (${y}.issues.length) {
959
+ payload.issues = payload.issues.concat(${y}.issues.map(iss => ({
960
+ ...iss,
961
+ path: iss.path ? [${A}, ...iss.path] : [${A}]
962
+ })));
963
+ }
964
+
965
+
966
+ if (${y}.value === undefined) {
967
+ if (${A} in input) {
968
+ newResult[${A}] = undefined;
969
+ }
970
+ } else {
971
+ newResult[${A}] = ${y}.value;
972
+ }
973
+
974
+ `);
910
975
  }
911
- return Z.length && a.issues.push({
912
- code: "unrecognized_keys",
913
- keys: Z,
914
- input: d,
976
+ _.write("payload.value = newResult;"), _.write("return payload;");
977
+ const Je = _.compile();
978
+ return (E, y) => Je(h, E, y);
979
+ };
980
+ let s;
981
+ const u = F, i = !Ze.jitless, l = i && un.value, f = n.catchall;
982
+ let z;
983
+ e._zod.parse = (h, _) => {
984
+ z ?? (z = r.value);
985
+ const b = h.value;
986
+ return u(b) ? i && l && _?.async === !1 && _.jitless !== !0 ? (s || (s = o(n.shape)), h = s(h, _), f ? De([], b, h, _, z, e) : h) : t(h, _) : (h.issues.push({
987
+ expected: "object",
988
+ code: "invalid_type",
989
+ input: b,
915
990
  inst: e
916
- }), k.length ? Promise.all(k).then(() => a) : a;
991
+ }), h);
917
992
  };
918
993
  });
919
- function ie(e, n, t, r) {
920
- for (const o of e)
921
- if (o.issues.length === 0)
922
- return n.value = o.value, n;
923
- return n.issues.push({
994
+ function ce(e, n, t, r) {
995
+ for (const s of e)
996
+ if (s.issues.length === 0)
997
+ return n.value = s.value, n;
998
+ const o = e.filter((s) => !N(s));
999
+ return o.length === 1 ? (n.value = o[0].value, o[0]) : (n.issues.push({
924
1000
  code: "invalid_union",
925
1001
  input: n.value,
926
1002
  inst: t,
927
- errors: e.map((o) => o.issues.map((u) => I(u, r, P())))
928
- }), n;
929
- }
930
- const xn = /* @__PURE__ */ c("$ZodUnion", (e, n) => {
931
- _.init(e, n), h(e._zod, "optin", () => n.options.some((t) => t._zod.optin === "optional") ? "optional" : void 0), h(e._zod, "optout", () => n.options.some((t) => t._zod.optout === "optional") ? "optional" : void 0), h(e._zod, "values", () => {
932
- if (n.options.every((t) => t._zod.values))
933
- return new Set(n.options.flatMap((t) => Array.from(t._zod.values)));
934
- }), h(e._zod, "pattern", () => {
935
- if (n.options.every((t) => t._zod.pattern)) {
936
- const t = n.options.map((r) => r._zod.pattern);
937
- return new RegExp(`^(${t.map((r) => W(r.source)).join("|")})$`);
1003
+ errors: e.map((s) => s.issues.map((u) => O(u, r, P())))
1004
+ }), n);
1005
+ }
1006
+ const Kn = /* @__PURE__ */ a("$ZodUnion", (e, n) => {
1007
+ m.init(e, n), d(e._zod, "optin", () => n.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), d(e._zod, "optout", () => n.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), d(e._zod, "values", () => {
1008
+ if (n.options.every((o) => o._zod.values))
1009
+ return new Set(n.options.flatMap((o) => Array.from(o._zod.values)));
1010
+ }), d(e._zod, "pattern", () => {
1011
+ if (n.options.every((o) => o._zod.pattern)) {
1012
+ const o = n.options.map((s) => s._zod.pattern);
1013
+ return new RegExp(`^(${o.map((s) => Q(s.source)).join("|")})$`);
938
1014
  }
939
- }), e._zod.parse = (t, r) => {
940
- let o = !1;
941
- const u = [];
942
- for (const i of n.options) {
943
- const s = i._zod.run({
944
- value: t.value,
1015
+ });
1016
+ const t = n.options.length === 1, r = n.options[0]._zod.run;
1017
+ e._zod.parse = (o, s) => {
1018
+ if (t)
1019
+ return r(o, s);
1020
+ let u = !1;
1021
+ const i = [];
1022
+ for (const c of n.options) {
1023
+ const l = c._zod.run({
1024
+ value: o.value,
945
1025
  issues: []
946
- }, r);
947
- if (s instanceof Promise)
948
- u.push(s), o = !0;
1026
+ }, s);
1027
+ if (l instanceof Promise)
1028
+ i.push(l), u = !0;
949
1029
  else {
950
- if (s.issues.length === 0)
951
- return s;
952
- u.push(s);
1030
+ if (l.issues.length === 0)
1031
+ return l;
1032
+ i.push(l);
953
1033
  }
954
1034
  }
955
- return o ? Promise.all(u).then((i) => ie(i, t, e, r)) : ie(u, t, e, r);
1035
+ return u ? Promise.all(i).then((c) => ce(c, o, e, s)) : ce(i, o, e, s);
956
1036
  };
957
- }), jn = /* @__PURE__ */ c("$ZodIntersection", (e, n) => {
958
- _.init(e, n), e._zod.parse = (t, r) => {
959
- const o = t.value, u = n.left._zod.run({ value: o, issues: [] }, r), i = n.right._zod.run({ value: o, issues: [] }, r);
960
- return u instanceof Promise || i instanceof Promise ? Promise.all([u, i]).then(([l, f]) => se(t, l, f)) : se(t, u, i);
1037
+ }), Yn = /* @__PURE__ */ a("$ZodIntersection", (e, n) => {
1038
+ m.init(e, n), e._zod.parse = (t, r) => {
1039
+ const o = t.value, s = n.left._zod.run({ value: o, issues: [] }, r), u = n.right._zod.run({ value: o, issues: [] }, r);
1040
+ return s instanceof Promise || u instanceof Promise ? Promise.all([s, u]).then(([c, l]) => ae(t, c, l)) : ae(t, s, u);
961
1041
  };
962
1042
  });
963
1043
  function B(e, n) {
@@ -965,16 +1045,16 @@ function B(e, n) {
965
1045
  return { valid: !0, data: e };
966
1046
  if (e instanceof Date && n instanceof Date && +e == +n)
967
1047
  return { valid: !0, data: e };
968
- if (q(e) && q(n)) {
969
- const t = Object.keys(n), r = Object.keys(e).filter((u) => t.indexOf(u) !== -1), o = { ...e, ...n };
970
- for (const u of r) {
971
- const i = B(e[u], n[u]);
972
- if (!i.valid)
1048
+ if (x(e) && x(n)) {
1049
+ const t = Object.keys(n), r = Object.keys(e).filter((s) => t.indexOf(s) !== -1), o = { ...e, ...n };
1050
+ for (const s of r) {
1051
+ const u = B(e[s], n[s]);
1052
+ if (!u.valid)
973
1053
  return {
974
1054
  valid: !1,
975
- mergeErrorPath: [u, ...i.mergeErrorPath]
1055
+ mergeErrorPath: [s, ...u.mergeErrorPath]
976
1056
  };
977
- o[u] = i.data;
1057
+ o[s] = u.data;
978
1058
  }
979
1059
  return { valid: !0, data: o };
980
1060
  }
@@ -983,80 +1063,94 @@ function B(e, n) {
983
1063
  return { valid: !1, mergeErrorPath: [] };
984
1064
  const t = [];
985
1065
  for (let r = 0; r < e.length; r++) {
986
- const o = e[r], u = n[r], i = B(o, u);
987
- if (!i.valid)
1066
+ const o = e[r], s = n[r], u = B(o, s);
1067
+ if (!u.valid)
988
1068
  return {
989
1069
  valid: !1,
990
- mergeErrorPath: [r, ...i.mergeErrorPath]
1070
+ mergeErrorPath: [r, ...u.mergeErrorPath]
991
1071
  };
992
- t.push(i.data);
1072
+ t.push(u.data);
993
1073
  }
994
1074
  return { valid: !0, data: t };
995
1075
  }
996
1076
  return { valid: !1, mergeErrorPath: [] };
997
1077
  }
998
- function se(e, n, t) {
999
- if (n.issues.length && e.issues.push(...n.issues), t.issues.length && e.issues.push(...t.issues), j(e))
1078
+ function ae(e, n, t) {
1079
+ if (n.issues.length && e.issues.push(...n.issues), t.issues.length && e.issues.push(...t.issues), N(e))
1000
1080
  return e;
1001
1081
  const r = B(n.value, t.value);
1002
1082
  if (!r.valid)
1003
1083
  throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
1004
1084
  return e.value = r.data, e;
1005
1085
  }
1006
- const Sn = /* @__PURE__ */ c("$ZodEnum", (e, n) => {
1007
- _.init(e, n);
1008
- const t = Je(n.entries);
1009
- e._zod.values = new Set(t), e._zod.pattern = new RegExp(`^(${t.filter((r) => en.has(typeof r)).map((r) => typeof r == "string" ? nn(r) : r.toString()).join("|")})$`), e._zod.parse = (r, o) => {
1010
- const u = r.value;
1011
- return e._zod.values.has(u) || r.issues.push({
1086
+ const qn = /* @__PURE__ */ a("$ZodEnum", (e, n) => {
1087
+ m.init(e, n);
1088
+ const t = rn(n.entries), r = new Set(t);
1089
+ e._zod.values = r, e._zod.pattern = new RegExp(`^(${t.filter((o) => sn.has(typeof o)).map((o) => typeof o == "string" ? cn(o) : o.toString()).join("|")})$`), e._zod.parse = (o, s) => {
1090
+ const u = o.value;
1091
+ return r.has(u) || o.issues.push({
1012
1092
  code: "invalid_value",
1013
1093
  values: t,
1014
1094
  input: u,
1015
1095
  inst: e
1016
- }), r;
1096
+ }), o;
1017
1097
  };
1018
- }), An = /* @__PURE__ */ c("$ZodTransform", (e, n) => {
1019
- _.init(e, n), e._zod.parse = (t, r) => {
1098
+ }), Bn = /* @__PURE__ */ a("$ZodTransform", (e, n) => {
1099
+ m.init(e, n), e._zod.parse = (t, r) => {
1100
+ if (r.direction === "backward")
1101
+ throw new $e(e.constructor.name);
1020
1102
  const o = n.transform(t.value, t);
1021
1103
  if (r.async)
1022
- return (o instanceof Promise ? o : Promise.resolve(o)).then((i) => (t.value = i, t));
1104
+ return (o instanceof Promise ? o : Promise.resolve(o)).then((u) => (t.value = u, t));
1023
1105
  if (o instanceof Promise)
1024
- throw new S();
1106
+ throw new j();
1025
1107
  return t.value = o, t;
1026
1108
  };
1027
- }), Rn = /* @__PURE__ */ c("$ZodOptional", (e, n) => {
1028
- _.init(e, n), e._zod.optin = "optional", e._zod.optout = "optional", h(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, void 0]) : void 0), h(e._zod, "pattern", () => {
1109
+ });
1110
+ function le(e, n) {
1111
+ return e.issues.length && n === void 0 ? { issues: [], value: void 0 } : e;
1112
+ }
1113
+ const Xn = /* @__PURE__ */ a("$ZodOptional", (e, n) => {
1114
+ m.init(e, n), e._zod.optin = "optional", e._zod.optout = "optional", d(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, void 0]) : void 0), d(e._zod, "pattern", () => {
1029
1115
  const t = n.innerType._zod.pattern;
1030
- return t ? new RegExp(`^(${W(t.source)})?$`) : void 0;
1031
- }), e._zod.parse = (t, r) => n.innerType._zod.optin === "optional" ? n.innerType._zod.run(t, r) : t.value === void 0 ? t : n.innerType._zod.run(t, r);
1032
- }), Cn = /* @__PURE__ */ c("$ZodNullable", (e, n) => {
1033
- _.init(e, n), h(e._zod, "optin", () => n.innerType._zod.optin), h(e._zod, "optout", () => n.innerType._zod.optout), h(e._zod, "pattern", () => {
1116
+ return t ? new RegExp(`^(${Q(t.source)})?$`) : void 0;
1117
+ }), e._zod.parse = (t, r) => {
1118
+ if (n.innerType._zod.optin === "optional") {
1119
+ const o = n.innerType._zod.run(t, r);
1120
+ return o instanceof Promise ? o.then((s) => le(s, t.value)) : le(o, t.value);
1121
+ }
1122
+ return t.value === void 0 ? t : n.innerType._zod.run(t, r);
1123
+ };
1124
+ }), Wn = /* @__PURE__ */ a("$ZodNullable", (e, n) => {
1125
+ m.init(e, n), d(e._zod, "optin", () => n.innerType._zod.optin), d(e._zod, "optout", () => n.innerType._zod.optout), d(e._zod, "pattern", () => {
1034
1126
  const t = n.innerType._zod.pattern;
1035
- return t ? new RegExp(`^(${W(t.source)}|null)$`) : void 0;
1036
- }), h(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, null]) : void 0), e._zod.parse = (t, r) => t.value === null ? t : n.innerType._zod.run(t, r);
1037
- }), Fn = /* @__PURE__ */ c("$ZodDefault", (e, n) => {
1038
- _.init(e, n), e._zod.optin = "optional", h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1127
+ return t ? new RegExp(`^(${Q(t.source)}|null)$`) : void 0;
1128
+ }), d(e._zod, "values", () => n.innerType._zod.values ? /* @__PURE__ */ new Set([...n.innerType._zod.values, null]) : void 0), e._zod.parse = (t, r) => t.value === null ? t : n.innerType._zod.run(t, r);
1129
+ }), Hn = /* @__PURE__ */ a("$ZodDefault", (e, n) => {
1130
+ m.init(e, n), e._zod.optin = "optional", d(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1131
+ if (r.direction === "backward")
1132
+ return n.innerType._zod.run(t, r);
1039
1133
  if (t.value === void 0)
1040
1134
  return t.value = n.defaultValue, t;
1041
1135
  const o = n.innerType._zod.run(t, r);
1042
- return o instanceof Promise ? o.then((u) => ce(u, n)) : ce(o, n);
1136
+ return o instanceof Promise ? o.then((s) => fe(s, n)) : fe(o, n);
1043
1137
  };
1044
1138
  });
1045
- function ce(e, n) {
1139
+ function fe(e, n) {
1046
1140
  return e.value === void 0 && (e.value = n.defaultValue), e;
1047
1141
  }
1048
- const Mn = /* @__PURE__ */ c("$ZodPrefault", (e, n) => {
1049
- _.init(e, n), e._zod.optin = "optional", h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => (t.value === void 0 && (t.value = n.defaultValue), n.innerType._zod.run(t, r));
1050
- }), Un = /* @__PURE__ */ c("$ZodNonOptional", (e, n) => {
1051
- _.init(e, n), h(e._zod, "values", () => {
1142
+ const Qn = /* @__PURE__ */ a("$ZodPrefault", (e, n) => {
1143
+ m.init(e, n), e._zod.optin = "optional", d(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => (r.direction === "backward" || t.value === void 0 && (t.value = n.defaultValue), n.innerType._zod.run(t, r));
1144
+ }), et = /* @__PURE__ */ a("$ZodNonOptional", (e, n) => {
1145
+ m.init(e, n), d(e._zod, "values", () => {
1052
1146
  const t = n.innerType._zod.values;
1053
1147
  return t ? new Set([...t].filter((r) => r !== void 0)) : void 0;
1054
1148
  }), e._zod.parse = (t, r) => {
1055
1149
  const o = n.innerType._zod.run(t, r);
1056
- return o instanceof Promise ? o.then((u) => ae(u, e)) : ae(o, e);
1150
+ return o instanceof Promise ? o.then((s) => de(s, e)) : de(o, e);
1057
1151
  };
1058
1152
  });
1059
- function ae(e, n) {
1153
+ function de(e, n) {
1060
1154
  return !e.issues.length && e.value === void 0 && e.issues.push({
1061
1155
  code: "invalid_type",
1062
1156
  expected: "nonoptional",
@@ -1064,46 +1158,54 @@ function ae(e, n) {
1064
1158
  inst: n
1065
1159
  }), e;
1066
1160
  }
1067
- const Vn = /* @__PURE__ */ c("$ZodCatch", (e, n) => {
1068
- _.init(e, n), e._zod.optin = "optional", h(e._zod, "optout", () => n.innerType._zod.optout), h(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1161
+ const nt = /* @__PURE__ */ a("$ZodCatch", (e, n) => {
1162
+ m.init(e, n), d(e._zod, "optin", () => n.innerType._zod.optin), d(e._zod, "optout", () => n.innerType._zod.optout), d(e._zod, "values", () => n.innerType._zod.values), e._zod.parse = (t, r) => {
1163
+ if (r.direction === "backward")
1164
+ return n.innerType._zod.run(t, r);
1069
1165
  const o = n.innerType._zod.run(t, r);
1070
- return o instanceof Promise ? o.then((u) => (t.value = u.value, u.issues.length && (t.value = n.catchValue({
1166
+ return o instanceof Promise ? o.then((s) => (t.value = s.value, s.issues.length && (t.value = n.catchValue({
1071
1167
  ...t,
1072
1168
  error: {
1073
- issues: u.issues.map((i) => I(i, r, P()))
1169
+ issues: s.issues.map((u) => O(u, r, P()))
1074
1170
  },
1075
1171
  input: t.value
1076
1172
  }), t.issues = []), t)) : (t.value = o.value, o.issues.length && (t.value = n.catchValue({
1077
1173
  ...t,
1078
1174
  error: {
1079
- issues: o.issues.map((u) => I(u, r, P()))
1175
+ issues: o.issues.map((s) => O(s, r, P()))
1080
1176
  },
1081
1177
  input: t.value
1082
1178
  }), t.issues = []), t);
1083
1179
  };
1084
- }), Dn = /* @__PURE__ */ c("$ZodPipe", (e, n) => {
1085
- _.init(e, n), h(e._zod, "values", () => n.in._zod.values), h(e._zod, "optin", () => n.in._zod.optin), h(e._zod, "optout", () => n.out._zod.optout), h(e._zod, "propValues", () => n.in._zod.propValues), e._zod.parse = (t, r) => {
1180
+ }), tt = /* @__PURE__ */ a("$ZodPipe", (e, n) => {
1181
+ m.init(e, n), d(e._zod, "values", () => n.in._zod.values), d(e._zod, "optin", () => n.in._zod.optin), d(e._zod, "optout", () => n.out._zod.optout), d(e._zod, "propValues", () => n.in._zod.propValues), e._zod.parse = (t, r) => {
1182
+ if (r.direction === "backward") {
1183
+ const s = n.out._zod.run(t, r);
1184
+ return s instanceof Promise ? s.then((u) => D(u, n.in, r)) : D(s, n.in, r);
1185
+ }
1086
1186
  const o = n.in._zod.run(t, r);
1087
- return o instanceof Promise ? o.then((u) => le(u, n, r)) : le(o, n, r);
1187
+ return o instanceof Promise ? o.then((s) => D(s, n.out, r)) : D(o, n.out, r);
1088
1188
  };
1089
1189
  });
1090
- function le(e, n, t) {
1091
- return j(e) ? e : n.out._zod.run({ value: e.value, issues: e.issues }, t);
1190
+ function D(e, n, t) {
1191
+ return e.issues.length ? (e.aborted = !0, e) : n._zod.run({ value: e.value, issues: e.issues }, t);
1092
1192
  }
1093
- const Ln = /* @__PURE__ */ c("$ZodReadonly", (e, n) => {
1094
- _.init(e, n), h(e._zod, "propValues", () => n.innerType._zod.propValues), h(e._zod, "values", () => n.innerType._zod.values), h(e._zod, "optin", () => n.innerType._zod.optin), h(e._zod, "optout", () => n.innerType._zod.optout), e._zod.parse = (t, r) => {
1193
+ const rt = /* @__PURE__ */ a("$ZodReadonly", (e, n) => {
1194
+ m.init(e, n), d(e._zod, "propValues", () => n.innerType._zod.propValues), d(e._zod, "values", () => n.innerType._zod.values), d(e._zod, "optin", () => n.innerType._zod.optin), d(e._zod, "optout", () => n.innerType._zod.optout), e._zod.parse = (t, r) => {
1195
+ if (r.direction === "backward")
1196
+ return n.innerType._zod.run(t, r);
1095
1197
  const o = n.innerType._zod.run(t, r);
1096
- return o instanceof Promise ? o.then(fe) : fe(o);
1198
+ return o instanceof Promise ? o.then(he) : he(o);
1097
1199
  };
1098
1200
  });
1099
- function fe(e) {
1201
+ function he(e) {
1100
1202
  return e.value = Object.freeze(e.value), e;
1101
1203
  }
1102
- const Gn = /* @__PURE__ */ c("$ZodCustom", (e, n) => {
1103
- $.init(e, n), _.init(e, n), e._zod.parse = (t, r) => t, e._zod.check = (t) => {
1204
+ const ot = /* @__PURE__ */ a("$ZodCustom", (e, n) => {
1205
+ k.init(e, n), m.init(e, n), e._zod.parse = (t, r) => t, e._zod.check = (t) => {
1104
1206
  const r = t.value, o = n.fn(r);
1105
1207
  if (o instanceof Promise)
1106
- return o.then((u) => pe(u, t, r, e));
1208
+ return o.then((s) => pe(s, t, r, e));
1107
1209
  pe(o, t, r, e);
1108
1210
  };
1109
1211
  });
@@ -1119,12 +1221,12 @@ function pe(e, n, t, r) {
1119
1221
  continue: !r._zod.def.abort
1120
1222
  // params: inst._zod.def.params,
1121
1223
  };
1122
- r._zod.def.params && (o.params = r._zod.def.params), n.issues.push(A(o));
1224
+ r._zod.def.params && (o.params = r._zod.def.params), n.issues.push(R(o));
1123
1225
  }
1124
1226
  }
1125
- class Kn {
1227
+ class ut {
1126
1228
  constructor() {
1127
- this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map();
1229
+ this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1128
1230
  }
1129
1231
  add(n, ...t) {
1130
1232
  const r = t[0];
@@ -1136,7 +1238,7 @@ class Kn {
1136
1238
  return this;
1137
1239
  }
1138
1240
  clear() {
1139
- return this._map = /* @__PURE__ */ new Map(), this._idmap = /* @__PURE__ */ new Map(), this;
1241
+ return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1140
1242
  }
1141
1243
  remove(n) {
1142
1244
  const t = this._map.get(n);
@@ -1146,7 +1248,9 @@ class Kn {
1146
1248
  const t = n._zod.parent;
1147
1249
  if (t) {
1148
1250
  const r = { ...this.get(t) ?? {} };
1149
- return delete r.id, { ...r, ...this._map.get(n) };
1251
+ delete r.id;
1252
+ const o = { ...r, ...this._map.get(n) };
1253
+ return Object.keys(o).length ? o : void 0;
1150
1254
  }
1151
1255
  return this._map.get(n);
1152
1256
  }
@@ -1154,137 +1258,159 @@ class Kn {
1154
1258
  return this._map.has(n);
1155
1259
  }
1156
1260
  }
1157
- function Yn() {
1158
- return new Kn();
1261
+ function st() {
1262
+ return new ut();
1159
1263
  }
1160
- const U = /* @__PURE__ */ Yn();
1161
- function qn(e, n) {
1264
+ const U = /* @__PURE__ */ st();
1265
+ function it(e, n) {
1162
1266
  return new e({
1163
1267
  type: "number",
1164
1268
  checks: [],
1165
- ...g(n)
1269
+ ...p(n)
1166
1270
  });
1167
1271
  }
1168
- function Bn(e, n) {
1272
+ function ct(e, n) {
1169
1273
  return new e({
1170
1274
  type: "number",
1171
1275
  check: "number_format",
1172
1276
  abort: !1,
1173
1277
  format: "safeint",
1174
- ...g(n)
1278
+ ...p(n)
1175
1279
  });
1176
1280
  }
1177
- function Xn(e) {
1281
+ function at(e) {
1178
1282
  return new e({
1179
1283
  type: "unknown"
1180
1284
  });
1181
1285
  }
1182
- function Jn(e, n) {
1286
+ function lt(e, n) {
1183
1287
  return new e({
1184
1288
  type: "never",
1185
- ...g(n)
1289
+ ...p(n)
1186
1290
  });
1187
1291
  }
1188
- function he(e, n) {
1189
- return new xe({
1292
+ function me(e, n) {
1293
+ return new Se({
1190
1294
  check: "less_than",
1191
- ...g(n),
1295
+ ...p(n),
1192
1296
  value: e,
1193
1297
  inclusive: !1
1194
1298
  });
1195
1299
  }
1196
- function G(e, n) {
1197
- return new xe({
1300
+ function K(e, n) {
1301
+ return new Se({
1198
1302
  check: "less_than",
1199
- ...g(n),
1303
+ ...p(n),
1200
1304
  value: e,
1201
1305
  inclusive: !0
1202
1306
  });
1203
1307
  }
1204
- function de(e, n) {
1205
- return new je({
1308
+ function _e(e, n) {
1309
+ return new xe({
1206
1310
  check: "greater_than",
1207
- ...g(n),
1311
+ ...p(n),
1208
1312
  value: e,
1209
1313
  inclusive: !1
1210
1314
  });
1211
1315
  }
1212
- function K(e, n) {
1213
- return new je({
1316
+ function Y(e, n) {
1317
+ return new xe({
1214
1318
  check: "greater_than",
1215
- ...g(n),
1319
+ ...p(n),
1216
1320
  value: e,
1217
1321
  inclusive: !0
1218
1322
  });
1219
1323
  }
1220
- function me(e, n) {
1221
- return new zn({
1324
+ function ge(e, n) {
1325
+ return new jn({
1222
1326
  check: "multiple_of",
1223
- ...g(n),
1327
+ ...p(n),
1224
1328
  value: e
1225
1329
  });
1226
1330
  }
1227
- function Wn(e, n) {
1228
- return new bn({
1331
+ function ft(e, n) {
1332
+ return new Sn({
1229
1333
  check: "max_length",
1230
- ...g(n),
1334
+ ...p(n),
1231
1335
  maximum: e
1232
1336
  });
1233
1337
  }
1234
- function _e(e, n) {
1235
- return new yn({
1338
+ function ve(e, n) {
1339
+ return new xn({
1236
1340
  check: "min_length",
1237
- ...g(n),
1341
+ ...p(n),
1238
1342
  minimum: e
1239
1343
  });
1240
1344
  }
1241
- function Hn(e, n) {
1242
- return new kn({
1345
+ function dt(e, n) {
1346
+ return new Rn({
1243
1347
  check: "length_equals",
1244
- ...g(n),
1348
+ ...p(n),
1245
1349
  length: e
1246
1350
  });
1247
1351
  }
1248
- function Qn(e) {
1249
- return new $n({
1352
+ function ht(e) {
1353
+ return new Cn({
1250
1354
  check: "overwrite",
1251
1355
  tx: e
1252
1356
  });
1253
1357
  }
1254
- function et(e, n, t) {
1358
+ function pt(e, n, t) {
1255
1359
  return new e({
1256
1360
  type: "array",
1257
1361
  element: n,
1258
1362
  // get element() {
1259
1363
  // return element;
1260
1364
  // },
1261
- ...g(t)
1365
+ ...p(t)
1262
1366
  });
1263
1367
  }
1264
- function nt(e, n, t) {
1368
+ function mt(e, n, t) {
1265
1369
  return new e({
1266
1370
  type: "custom",
1267
1371
  check: "custom",
1268
1372
  fn: n,
1269
- ...g(t)
1373
+ ...p(t)
1374
+ });
1375
+ }
1376
+ function _t(e) {
1377
+ const n = gt((t) => (t.addIssue = (r) => {
1378
+ if (typeof r == "string")
1379
+ t.issues.push(R(r, t.value, n._zod.def));
1380
+ else {
1381
+ const o = r;
1382
+ o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = t.value), o.inst ?? (o.inst = n), o.continue ?? (o.continue = !n._zod.def.abort), t.issues.push(R(o));
1383
+ }
1384
+ }, e(t.value, t)));
1385
+ return n;
1386
+ }
1387
+ function gt(e, n) {
1388
+ const t = new k({
1389
+ check: "custom",
1390
+ ...p(n)
1270
1391
  });
1392
+ return t._zod.check = e, t;
1271
1393
  }
1272
- const tt = (e, n) => {
1273
- Pe.init(e, n), e.name = "ZodError", Object.defineProperties(e, {
1394
+ const vt = (e, n) => {
1395
+ Ne.init(e, n), e.name = "ZodError", Object.defineProperties(e, {
1274
1396
  format: {
1275
- value: (t) => pn(e, t)
1397
+ value: (t) => zn(e, t)
1276
1398
  // enumerable: false,
1277
1399
  },
1278
1400
  flatten: {
1279
- value: (t) => fn(e, t)
1401
+ value: (t) => vn(e, t)
1280
1402
  // enumerable: false,
1281
1403
  },
1282
1404
  addIssue: {
1283
- value: (t) => e.issues.push(t)
1405
+ value: (t) => {
1406
+ e.issues.push(t), e.message = JSON.stringify(e.issues, q, 2);
1407
+ }
1284
1408
  // enumerable: false,
1285
1409
  },
1286
1410
  addIssues: {
1287
- value: (t) => e.issues.push(...t)
1411
+ value: (t) => {
1412
+ e.issues.push(...t), e.message = JSON.stringify(e.issues, q, 2);
1413
+ }
1288
1414
  // enumerable: false,
1289
1415
  },
1290
1416
  isEmpty: {
@@ -1294,18 +1420,14 @@ const tt = (e, n) => {
1294
1420
  // enumerable: false,
1295
1421
  }
1296
1422
  });
1297
- }, V = c("ZodError", tt, {
1423
+ }, w = a("ZodError", vt, {
1298
1424
  Parent: Error
1299
- }), rt = /* @__PURE__ */ hn(V), ot = /* @__PURE__ */ dn(V), ut = /* @__PURE__ */ Ne(V), it = /* @__PURE__ */ Te(V), z = /* @__PURE__ */ c("ZodType", (e, n) => (_.init(e, n), e.def = n, Object.defineProperty(e, "_def", { value: n }), e.check = (...t) => e.clone(
1300
- {
1301
- ...n,
1302
- checks: [
1303
- ...n.checks ?? [],
1304
- ...t.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
1305
- ]
1306
- }
1307
- // { parent: true }
1308
- ), e.clone = (t, r) => N(e, t, r), e.brand = () => e, e.register = (t, r) => (t.add(e, r), e), e.parse = (t, r) => rt(e, t, r, { callee: e.parse }), e.safeParse = (t, r) => ut(e, t, r), e.parseAsync = async (t, r) => ot(e, t, r, { callee: e.parseAsync }), e.safeParseAsync = async (t, r) => it(e, t, r), e.spa = e.safeParseAsync, e.refine = (t, r) => e.check(jt(t, r)), e.superRefine = (t) => e.check(St(t)), e.overwrite = (t) => e.check(Qn(t)), e.optional = () => ze(e), e.nullable = () => we(e), e.nullish = () => ze(we(e)), e.nonoptional = (t) => Zt(e, t), e.array = () => Re(e), e.or = (t) => dt([e, t]), e.and = (t) => _t(e, t), e.transform = (t) => be(e, zt(t)), e.default = (t) => yt(e, t), e.prefault = (t) => $t(e, t), e.catch = (t) => Pt(e, t), e.pipe = (t) => be(e, t), e.readonly = () => Tt(e), e.describe = (t) => {
1425
+ }), zt = /* @__PURE__ */ ne(w), bt = /* @__PURE__ */ te(w), wt = /* @__PURE__ */ V(w), yt = /* @__PURE__ */ L(w), kt = /* @__PURE__ */ yn(w), Et = /* @__PURE__ */ kn(w), $t = /* @__PURE__ */ En(w), Zt = /* @__PURE__ */ $n(w), Pt = /* @__PURE__ */ Zn(w), Ot = /* @__PURE__ */ Pn(w), Tt = /* @__PURE__ */ On(w), It = /* @__PURE__ */ Tn(w), g = /* @__PURE__ */ a("ZodType", (e, n) => (m.init(e, n), e.def = n, e.type = n.type, Object.defineProperty(e, "_def", { value: n }), e.check = (...t) => e.clone(I(n, {
1426
+ checks: [
1427
+ ...n.checks ?? [],
1428
+ ...t.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
1429
+ ]
1430
+ })), e.clone = (t, r) => $(e, t, r), e.brand = () => e, e.register = ((t, r) => (t.add(e, r), e)), e.parse = (t, r) => zt(e, t, r, { callee: e.parse }), e.safeParse = (t, r) => wt(e, t, r), e.parseAsync = async (t, r) => bt(e, t, r, { callee: e.parseAsync }), e.safeParseAsync = async (t, r) => yt(e, t, r), e.spa = e.safeParseAsync, e.encode = (t, r) => kt(e, t, r), e.decode = (t, r) => Et(e, t, r), e.encodeAsync = async (t, r) => $t(e, t, r), e.decodeAsync = async (t, r) => Zt(e, t, r), e.safeEncode = (t, r) => Pt(e, t, r), e.safeDecode = (t, r) => Ot(e, t, r), e.safeEncodeAsync = async (t, r) => Tt(e, t, r), e.safeDecodeAsync = async (t, r) => It(e, t, r), e.refine = (t, r) => e.check(tr(t, r)), e.superRefine = (t) => e.check(rr(t)), e.overwrite = (t) => e.check(ht(t)), e.optional = () => we(e), e.nullable = () => ye(e), e.nullish = () => we(ye(e)), e.nonoptional = (t) => Bt(e, t), e.array = () => Fe(e), e.or = (t) => Dt([e, t]), e.and = (t) => Ft(e, t), e.transform = (t) => ke(e, Lt(t)), e.default = (t) => Kt(e, t), e.prefault = (t) => qt(e, t), e.catch = (t) => Wt(e, t), e.pipe = (t) => ke(e, t), e.readonly = () => er(e), e.describe = (t) => {
1309
1431
  const r = e.clone();
1310
1432
  return U.add(r, { description: t }), r;
1311
1433
  }, Object.defineProperty(e, "description", {
@@ -1318,260 +1440,245 @@ const tt = (e, n) => {
1318
1440
  return U.get(e);
1319
1441
  const r = e.clone();
1320
1442
  return U.add(r, t[0]), r;
1321
- }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Ae = /* @__PURE__ */ c("ZodNumber", (e, n) => {
1322
- Se.init(e, n), z.init(e, n), e.gt = (r, o) => e.check(de(r, o)), e.gte = (r, o) => e.check(K(r, o)), e.min = (r, o) => e.check(K(r, o)), e.lt = (r, o) => e.check(he(r, o)), e.lte = (r, o) => e.check(G(r, o)), e.max = (r, o) => e.check(G(r, o)), e.int = (r) => e.check(ve(r)), e.safe = (r) => e.check(ve(r)), e.positive = (r) => e.check(de(0, r)), e.nonnegative = (r) => e.check(K(0, r)), e.negative = (r) => e.check(he(0, r)), e.nonpositive = (r) => e.check(G(0, r)), e.multipleOf = (r, o) => e.check(me(r, o)), e.step = (r, o) => e.check(me(r, o)), e.finite = () => e;
1443
+ }, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), Ue = /* @__PURE__ */ a("ZodNumber", (e, n) => {
1444
+ Re.init(e, n), g.init(e, n), e.gt = (r, o) => e.check(_e(r, o)), e.gte = (r, o) => e.check(Y(r, o)), e.min = (r, o) => e.check(Y(r, o)), e.lt = (r, o) => e.check(me(r, o)), e.lte = (r, o) => e.check(K(r, o)), e.max = (r, o) => e.check(K(r, o)), e.int = (r) => e.check(ze(r)), e.safe = (r) => e.check(ze(r)), e.positive = (r) => e.check(_e(0, r)), e.nonnegative = (r) => e.check(Y(0, r)), e.negative = (r) => e.check(me(0, r)), e.nonpositive = (r) => e.check(K(0, r)), e.multipleOf = (r, o) => e.check(ge(r, o)), e.step = (r, o) => e.check(ge(r, o)), e.finite = () => e;
1323
1445
  const t = e._zod.bag;
1324
1446
  e.minValue = Math.max(t.minimum ?? Number.NEGATIVE_INFINITY, t.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(t.maximum ?? Number.POSITIVE_INFINITY, t.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (t.format ?? "").includes("int") || Number.isSafeInteger(t.multipleOf ?? 0.5), e.isFinite = !0, e.format = t.format ?? null;
1325
1447
  });
1326
- function E(e) {
1327
- return qn(Ae, e);
1448
+ function Z(e) {
1449
+ return it(Ue, e);
1328
1450
  }
1329
- const st = /* @__PURE__ */ c("ZodNumberFormat", (e, n) => {
1330
- Pn.init(e, n), Ae.init(e, n);
1451
+ const Nt = /* @__PURE__ */ a("ZodNumberFormat", (e, n) => {
1452
+ Fn.init(e, n), Ue.init(e, n);
1331
1453
  });
1332
- function ve(e) {
1333
- return Bn(st, e);
1454
+ function ze(e) {
1455
+ return ct(Nt, e);
1334
1456
  }
1335
- const ct = /* @__PURE__ */ c("ZodUnknown", (e, n) => {
1336
- In.init(e, n), z.init(e, n);
1457
+ const jt = /* @__PURE__ */ a("ZodUnknown", (e, n) => {
1458
+ Mn.init(e, n), g.init(e, n);
1337
1459
  });
1338
- function ge() {
1339
- return Xn(ct);
1460
+ function be() {
1461
+ return at(jt);
1340
1462
  }
1341
- const at = /* @__PURE__ */ c("ZodNever", (e, n) => {
1342
- Nn.init(e, n), z.init(e, n);
1463
+ const At = /* @__PURE__ */ a("ZodNever", (e, n) => {
1464
+ Vn.init(e, n), g.init(e, n);
1343
1465
  });
1344
- function lt(e) {
1345
- return Jn(at, e);
1466
+ function St(e) {
1467
+ return lt(At, e);
1346
1468
  }
1347
- const ft = /* @__PURE__ */ c("ZodArray", (e, n) => {
1348
- Tn.init(e, n), z.init(e, n), e.element = n.element, e.min = (t, r) => e.check(_e(t, r)), e.nonempty = (t) => e.check(_e(1, t)), e.max = (t, r) => e.check(Wn(t, r)), e.length = (t, r) => e.check(Hn(t, r)), e.unwrap = () => e.element;
1469
+ const xt = /* @__PURE__ */ a("ZodArray", (e, n) => {
1470
+ Ln.init(e, n), g.init(e, n), e.element = n.element, e.min = (t, r) => e.check(ve(t, r)), e.nonempty = (t) => e.check(ve(1, t)), e.max = (t, r) => e.check(ft(t, r)), e.length = (t, r) => e.check(dt(t, r)), e.unwrap = () => e.element;
1349
1471
  });
1350
- function Re(e, n) {
1351
- return et(ft, e, n);
1472
+ function Fe(e, n) {
1473
+ return pt(xt, e, n);
1352
1474
  }
1353
- const pt = /* @__PURE__ */ c("ZodObject", (e, n) => {
1354
- On.init(e, n), z.init(e, n), h(e, "shape", () => n.shape), e.keyof = () => vt(Object.keys(e._zod.def.shape)), e.catchall = (t) => e.clone({ ...e._zod.def, catchall: t }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: ge() }), e.loose = () => e.clone({ ...e._zod.def, catchall: ge() }), e.strict = () => e.clone({ ...e._zod.def, catchall: lt() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (t) => sn(e, t), e.merge = (t) => cn(e, t), e.pick = (t) => on(e, t), e.omit = (t) => un(e, t), e.partial = (...t) => an(Fe, e, t[0]), e.required = (...t) => ln(Me, e, t[0]);
1475
+ const Rt = /* @__PURE__ */ a("ZodObject", (e, n) => {
1476
+ Jn.init(e, n), g.init(e, n), d(e, "shape", () => n.shape), e.keyof = () => Mt(Object.keys(e._zod.def.shape)), e.catchall = (t) => e.clone({ ...e._zod.def, catchall: t }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: be() }), e.loose = () => e.clone({ ...e._zod.def, catchall: be() }), e.strict = () => e.clone({ ...e._zod.def, catchall: St() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (t) => hn(e, t), e.safeExtend = (t) => pn(e, t), e.merge = (t) => mn(e, t), e.pick = (t) => fn(e, t), e.omit = (t) => dn(e, t), e.partial = (...t) => _n(Ve, e, t[0]), e.required = (...t) => gn(Le, e, t[0]);
1355
1477
  });
1356
- function Ce(e, n) {
1478
+ function Me(e, n) {
1357
1479
  const t = {
1358
1480
  type: "object",
1359
- get shape() {
1360
- return H(this, "shape", { ...e }), this.shape;
1361
- },
1362
- ...g(n)
1481
+ shape: e ?? {},
1482
+ ...p(n)
1363
1483
  };
1364
- return new pt(t);
1484
+ return new Rt(t);
1365
1485
  }
1366
- const ht = /* @__PURE__ */ c("ZodUnion", (e, n) => {
1367
- xn.init(e, n), z.init(e, n), e.options = n.options;
1486
+ const Ct = /* @__PURE__ */ a("ZodUnion", (e, n) => {
1487
+ Kn.init(e, n), g.init(e, n), e.options = n.options;
1368
1488
  });
1369
- function dt(e, n) {
1370
- return new ht({
1489
+ function Dt(e, n) {
1490
+ return new Ct({
1371
1491
  type: "union",
1372
1492
  options: e,
1373
- ...g(n)
1493
+ ...p(n)
1374
1494
  });
1375
1495
  }
1376
- const mt = /* @__PURE__ */ c("ZodIntersection", (e, n) => {
1377
- jn.init(e, n), z.init(e, n);
1496
+ const Ut = /* @__PURE__ */ a("ZodIntersection", (e, n) => {
1497
+ Yn.init(e, n), g.init(e, n);
1378
1498
  });
1379
- function _t(e, n) {
1380
- return new mt({
1499
+ function Ft(e, n) {
1500
+ return new Ut({
1381
1501
  type: "intersection",
1382
1502
  left: e,
1383
1503
  right: n
1384
1504
  });
1385
1505
  }
1386
- const X = /* @__PURE__ */ c("ZodEnum", (e, n) => {
1387
- Sn.init(e, n), z.init(e, n), e.enum = n.entries, e.options = Object.values(n.entries);
1506
+ const X = /* @__PURE__ */ a("ZodEnum", (e, n) => {
1507
+ qn.init(e, n), g.init(e, n), e.enum = n.entries, e.options = Object.values(n.entries);
1388
1508
  const t = new Set(Object.keys(n.entries));
1389
1509
  e.extract = (r, o) => {
1390
- const u = {};
1391
- for (const i of r)
1392
- if (t.has(i))
1393
- u[i] = n.entries[i];
1510
+ const s = {};
1511
+ for (const u of r)
1512
+ if (t.has(u))
1513
+ s[u] = n.entries[u];
1394
1514
  else
1395
- throw new Error(`Key ${i} not found in enum`);
1515
+ throw new Error(`Key ${u} not found in enum`);
1396
1516
  return new X({
1397
1517
  ...n,
1398
1518
  checks: [],
1399
- ...g(o),
1400
- entries: u
1519
+ ...p(o),
1520
+ entries: s
1401
1521
  });
1402
1522
  }, e.exclude = (r, o) => {
1403
- const u = { ...n.entries };
1404
- for (const i of r)
1405
- if (t.has(i))
1406
- delete u[i];
1523
+ const s = { ...n.entries };
1524
+ for (const u of r)
1525
+ if (t.has(u))
1526
+ delete s[u];
1407
1527
  else
1408
- throw new Error(`Key ${i} not found in enum`);
1528
+ throw new Error(`Key ${u} not found in enum`);
1409
1529
  return new X({
1410
1530
  ...n,
1411
1531
  checks: [],
1412
- ...g(o),
1413
- entries: u
1532
+ ...p(o),
1533
+ entries: s
1414
1534
  });
1415
1535
  };
1416
1536
  });
1417
- function vt(e, n) {
1537
+ function Mt(e, n) {
1418
1538
  const t = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
1419
1539
  return new X({
1420
1540
  type: "enum",
1421
1541
  entries: t,
1422
- ...g(n)
1542
+ ...p(n)
1423
1543
  });
1424
1544
  }
1425
- const gt = /* @__PURE__ */ c("ZodTransform", (e, n) => {
1426
- An.init(e, n), z.init(e, n), e._zod.parse = (t, r) => {
1427
- t.addIssue = (u) => {
1428
- if (typeof u == "string")
1429
- t.issues.push(A(u, t.value, n));
1545
+ const Vt = /* @__PURE__ */ a("ZodTransform", (e, n) => {
1546
+ Bn.init(e, n), g.init(e, n), e._zod.parse = (t, r) => {
1547
+ if (r.direction === "backward")
1548
+ throw new $e(e.constructor.name);
1549
+ t.addIssue = (s) => {
1550
+ if (typeof s == "string")
1551
+ t.issues.push(R(s, t.value, n));
1430
1552
  else {
1431
- const i = u;
1432
- i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = t.value), i.inst ?? (i.inst = e), i.continue ?? (i.continue = !0), t.issues.push(A(i));
1553
+ const u = s;
1554
+ u.fatal && (u.continue = !1), u.code ?? (u.code = "custom"), u.input ?? (u.input = t.value), u.inst ?? (u.inst = e), t.issues.push(R(u));
1433
1555
  }
1434
1556
  };
1435
1557
  const o = n.transform(t.value, t);
1436
- return o instanceof Promise ? o.then((u) => (t.value = u, t)) : (t.value = o, t);
1558
+ return o instanceof Promise ? o.then((s) => (t.value = s, t)) : (t.value = o, t);
1437
1559
  };
1438
1560
  });
1439
- function zt(e) {
1440
- return new gt({
1561
+ function Lt(e) {
1562
+ return new Vt({
1441
1563
  type: "transform",
1442
1564
  transform: e
1443
1565
  });
1444
1566
  }
1445
- const Fe = /* @__PURE__ */ c("ZodOptional", (e, n) => {
1446
- Rn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
1567
+ const Ve = /* @__PURE__ */ a("ZodOptional", (e, n) => {
1568
+ Xn.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType;
1447
1569
  });
1448
- function ze(e) {
1449
- return new Fe({
1570
+ function we(e) {
1571
+ return new Ve({
1450
1572
  type: "optional",
1451
1573
  innerType: e
1452
1574
  });
1453
1575
  }
1454
- const wt = /* @__PURE__ */ c("ZodNullable", (e, n) => {
1455
- Cn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
1576
+ const Gt = /* @__PURE__ */ a("ZodNullable", (e, n) => {
1577
+ Wn.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType;
1456
1578
  });
1457
- function we(e) {
1458
- return new wt({
1579
+ function ye(e) {
1580
+ return new Gt({
1459
1581
  type: "nullable",
1460
1582
  innerType: e
1461
1583
  });
1462
1584
  }
1463
- const bt = /* @__PURE__ */ c("ZodDefault", (e, n) => {
1464
- Fn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
1585
+ const Jt = /* @__PURE__ */ a("ZodDefault", (e, n) => {
1586
+ Hn.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
1465
1587
  });
1466
- function yt(e, n) {
1467
- return new bt({
1588
+ function Kt(e, n) {
1589
+ return new Jt({
1468
1590
  type: "default",
1469
1591
  innerType: e,
1470
1592
  get defaultValue() {
1471
- return typeof n == "function" ? n() : n;
1593
+ return typeof n == "function" ? n() : Oe(n);
1472
1594
  }
1473
1595
  });
1474
1596
  }
1475
- const kt = /* @__PURE__ */ c("ZodPrefault", (e, n) => {
1476
- Mn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
1597
+ const Yt = /* @__PURE__ */ a("ZodPrefault", (e, n) => {
1598
+ Qn.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType;
1477
1599
  });
1478
- function $t(e, n) {
1479
- return new kt({
1600
+ function qt(e, n) {
1601
+ return new Yt({
1480
1602
  type: "prefault",
1481
1603
  innerType: e,
1482
1604
  get defaultValue() {
1483
- return typeof n == "function" ? n() : n;
1605
+ return typeof n == "function" ? n() : Oe(n);
1484
1606
  }
1485
1607
  });
1486
1608
  }
1487
- const Me = /* @__PURE__ */ c("ZodNonOptional", (e, n) => {
1488
- Un.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType;
1609
+ const Le = /* @__PURE__ */ a("ZodNonOptional", (e, n) => {
1610
+ et.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType;
1489
1611
  });
1490
- function Zt(e, n) {
1491
- return new Me({
1612
+ function Bt(e, n) {
1613
+ return new Le({
1492
1614
  type: "nonoptional",
1493
1615
  innerType: e,
1494
- ...g(n)
1616
+ ...p(n)
1495
1617
  });
1496
1618
  }
1497
- const Et = /* @__PURE__ */ c("ZodCatch", (e, n) => {
1498
- Vn.init(e, n), z.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
1619
+ const Xt = /* @__PURE__ */ a("ZodCatch", (e, n) => {
1620
+ nt.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
1499
1621
  });
1500
- function Pt(e, n) {
1501
- return new Et({
1622
+ function Wt(e, n) {
1623
+ return new Xt({
1502
1624
  type: "catch",
1503
1625
  innerType: e,
1504
1626
  catchValue: typeof n == "function" ? n : () => n
1505
1627
  });
1506
1628
  }
1507
- const It = /* @__PURE__ */ c("ZodPipe", (e, n) => {
1508
- Dn.init(e, n), z.init(e, n), e.in = n.in, e.out = n.out;
1629
+ const Ht = /* @__PURE__ */ a("ZodPipe", (e, n) => {
1630
+ tt.init(e, n), g.init(e, n), e.in = n.in, e.out = n.out;
1509
1631
  });
1510
- function be(e, n) {
1511
- return new It({
1632
+ function ke(e, n) {
1633
+ return new Ht({
1512
1634
  type: "pipe",
1513
1635
  in: e,
1514
1636
  out: n
1515
1637
  // ...util.normalizeParams(params),
1516
1638
  });
1517
1639
  }
1518
- const Nt = /* @__PURE__ */ c("ZodReadonly", (e, n) => {
1519
- Ln.init(e, n), z.init(e, n);
1640
+ const Qt = /* @__PURE__ */ a("ZodReadonly", (e, n) => {
1641
+ rt.init(e, n), g.init(e, n), e.unwrap = () => e._zod.def.innerType;
1520
1642
  });
1521
- function Tt(e) {
1522
- return new Nt({
1643
+ function er(e) {
1644
+ return new Qt({
1523
1645
  type: "readonly",
1524
1646
  innerType: e
1525
1647
  });
1526
1648
  }
1527
- const Ot = /* @__PURE__ */ c("ZodCustom", (e, n) => {
1528
- Gn.init(e, n), z.init(e, n);
1649
+ const nr = /* @__PURE__ */ a("ZodCustom", (e, n) => {
1650
+ ot.init(e, n), g.init(e, n);
1529
1651
  });
1530
- function xt(e) {
1531
- const n = new $({
1532
- check: "custom"
1533
- // ...util.normalizeParams(params),
1534
- });
1535
- return n._zod.check = e, n;
1536
- }
1537
- function jt(e, n = {}) {
1538
- return nt(Ot, e, n);
1539
- }
1540
- function St(e) {
1541
- const n = xt((t) => (t.addIssue = (r) => {
1542
- if (typeof r == "string")
1543
- t.issues.push(A(r, t.value, n._zod.def));
1544
- else {
1545
- const o = r;
1546
- o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = t.value), o.inst ?? (o.inst = n), o.continue ?? (o.continue = !n._zod.def.abort), t.issues.push(A(o));
1547
- }
1548
- }, e(t.value, t)));
1549
- return n;
1550
- }
1551
- const Gt = (e) => Ce({
1552
- pages: E(),
1553
- nextPage: E().optional(),
1554
- totalElements: E(),
1555
- currentPage: E(),
1556
- pageSize: E(),
1557
- elements: Re(e)
1558
- }), Kt = Ce({
1559
- page: E(),
1560
- pageSize: E()
1652
+ function tr(e, n = {}) {
1653
+ return mt(nr, e, n);
1654
+ }
1655
+ function rr(e) {
1656
+ return _t(e);
1657
+ }
1658
+ const hr = (e) => Me({
1659
+ pages: Z(),
1660
+ nextPage: Z().optional(),
1661
+ totalElements: Z(),
1662
+ currentPage: Z(),
1663
+ pageSize: Z(),
1664
+ elements: Fe(e)
1665
+ }), pr = Me({
1666
+ page: Z(),
1667
+ pageSize: Z()
1561
1668
  });
1562
1669
  export {
1563
- Ct as Fail,
1564
- Ft as Failure,
1565
- x as Guid,
1566
- Rt as Ok,
1567
- Kt as PageQuery,
1568
- Gt as createPageSchema,
1569
- Ue as formatDate,
1570
- Lt as formatDateTime,
1571
- Ve as formatTime,
1572
- Ut as isFailure,
1573
- At as mock,
1574
- Mt as notFailure,
1575
- Vt as parseConfig,
1576
- Dt as sleep
1670
+ sr as Fail,
1671
+ ir as Failure,
1672
+ S as Guid,
1673
+ ur as Ok,
1674
+ pr as PageQuery,
1675
+ hr as createPageSchema,
1676
+ Ke as formatDate,
1677
+ dr as formatDateTime,
1678
+ Ye as formatTime,
1679
+ ar as isFailure,
1680
+ or as mock,
1681
+ cr as notFailure,
1682
+ lr as parseConfig,
1683
+ fr as sleep
1577
1684
  };