@makoojs/cli 0.5.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/DevTerminal-BtHO2wRA.js +2396 -0
  2. package/dist/DevTerminal-DNh8U_O4.cjs +30 -0
  3. package/dist/bin.js +29 -580
  4. package/dist/bridge/protocol.d.ts +64 -0
  5. package/dist/bridge/runtime.cjs +1 -0
  6. package/dist/bridge/runtime.d.ts +38 -0
  7. package/dist/bridge/runtime.js +168 -0
  8. package/dist/bridge/server.d.ts +15 -0
  9. package/dist/bridge/store.d.ts +17 -0
  10. package/dist/commands/version.d.ts +1 -0
  11. package/dist/config/resolve.d.ts +1 -5
  12. package/dist/config/types.d.ts +40 -9
  13. package/dist/errors.d.ts +766 -0
  14. package/dist/index.cjs +2 -149
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +216 -2934
  17. package/dist/monkey/clipboard.d.ts +2 -0
  18. package/dist/monkey/download.d.ts +2 -0
  19. package/dist/monkey/index.d.ts +1 -0
  20. package/dist/monkey/info.d.ts +3 -0
  21. package/dist/monkey/menu.d.ts +3 -0
  22. package/dist/monkey/notification.d.ts +2 -0
  23. package/dist/monkey/request.d.ts +8 -0
  24. package/dist/monkey/resource.d.ts +3 -0
  25. package/dist/monkey/storage.d.ts +10 -0
  26. package/dist/monkey/style.d.ts +3 -0
  27. package/dist/monkey/tab.d.ts +5 -0
  28. package/dist/protocol-D8uLFi4g.cjs +1 -0
  29. package/dist/protocol-ZRHs80xs.js +4 -0
  30. package/dist/{cli/commands/dev → tui}/DevTerminal.d.ts +12 -6
  31. package/dist/{cli/injections → tui}/renderInjections.d.ts +1 -1
  32. package/dist/version-DiRsgSMp.js +19 -0
  33. package/dist/version-ENbM57wf.cjs +1 -0
  34. package/dist/vite/makoo.d.ts +3 -0
  35. package/dist/vite/makooDev.d.ts +28 -6
  36. package/package.json +5 -6
  37. package/dist/cli/version.d.ts +0 -1
  38. package/dist/config/defaults.d.ts +0 -5
  39. package/dist/config/errors.d.ts +0 -3
  40. package/dist/config/validation.d.ts +0 -11
  41. package/dist/session/DevSession.d.ts +0 -14
  42. package/dist/session/types.d.ts +0 -47
  43. /package/dist/{cli → commands}/bin.d.ts +0 -0
  44. /package/dist/{cli/commands → commands}/build.d.ts +0 -0
  45. /package/dist/{cli/commands/dev → commands}/dev.d.ts +0 -0
  46. /package/dist/{cli/commands → commands}/preview.d.ts +0 -0
  47. /package/dist/{cli → tui}/terminalColor.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,2775 +1,43 @@
1
- import e, { cdn as t } from "vite-plugin-monkey";
2
- import { isAbsolute as n, normalize as r, resolve as i } from "node:path";
3
- import a from "node:process";
4
- import { MakooError as o } from "@makoojs/core";
5
- //#region packages/cli/src/config/defaults.ts
6
- var s = {
7
- open: a.platform === "win32" || a.platform === "darwin",
8
- prefix: (e) => `server:${e}`,
9
- mountGmApi: !1
10
- }, c = {
11
- metaFileName: !1,
12
- autoGrant: !0
13
- }, l = {
14
- align: 2,
15
- styleImport: !0
16
- }, u;
17
- function d(e, t, n) {
18
- function r(n, r) {
19
- if (n._zod || Object.defineProperty(n, "_zod", {
20
- value: {
21
- def: r,
22
- constr: o,
23
- traits: /* @__PURE__ */ new Set()
24
- },
25
- enumerable: !1
26
- }), n._zod.traits.has(e)) return;
27
- n._zod.traits.add(e), t(n, r);
28
- let i = o.prototype, a = Object.keys(i);
29
- for (let e = 0; e < a.length; e++) {
30
- let t = a[e];
31
- t in n || (n[t] = i[t].bind(n));
32
- }
33
- }
34
- let i = n?.Parent ?? Object;
35
- class a extends i {}
36
- Object.defineProperty(a, "name", { value: e });
37
- function o(e) {
38
- var t;
39
- let i = n?.Parent ? new a() : this;
40
- r(i, e), (t = i._zod).deferred ?? (t.deferred = []);
41
- for (let e of i._zod.deferred) e();
42
- return i;
43
- }
44
- return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, { value: (t) => n?.Parent && t instanceof n.Parent ? !0 : t?._zod?.traits?.has(e) }), Object.defineProperty(o, "name", { value: e }), o;
45
- }
46
- var f = class extends Error {
47
- constructor() {
48
- super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
49
- }
50
- }, p = class extends Error {
51
- constructor(e) {
52
- super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
53
- }
54
- };
55
- (u = globalThis).__zod_globalConfig ?? (u.__zod_globalConfig = {});
56
- var m = globalThis.__zod_globalConfig;
57
- function h(e) {
58
- return e && Object.assign(m, e), m;
59
- }
60
- //#endregion
61
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
62
- function ee(e) {
63
- let t = Object.values(e).filter((e) => typeof e == "number");
64
- return Object.entries(e).filter(([e, n]) => t.indexOf(+e) === -1).map(([e, t]) => t);
65
- }
66
- function g(e, t) {
67
- return typeof t == "bigint" ? t.toString() : t;
68
- }
69
- function _(e) {
70
- return { get value() {
71
- {
72
- let t = e();
73
- return Object.defineProperty(this, "value", { value: t }), t;
74
- }
75
- } };
76
- }
77
- function te(e) {
78
- return e == null;
79
- }
80
- function ne(e) {
81
- let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
82
- return e.slice(t, n);
83
- }
84
- var re = /* @__PURE__*/ Symbol("evaluating");
85
- function v(e, t, n) {
86
- let r;
87
- Object.defineProperty(e, t, {
88
- get() {
89
- if (r !== re) return r === void 0 && (r = re, r = n()), r;
90
- },
91
- set(n) {
92
- Object.defineProperty(e, t, { value: n });
93
- },
94
- configurable: !0
95
- });
96
- }
97
- function y(e, t, n) {
98
- Object.defineProperty(e, t, {
99
- value: n,
100
- writable: !0,
101
- enumerable: !0,
102
- configurable: !0
103
- });
104
- }
105
- function b(...e) {
106
- let t = {};
107
- for (let n of e) {
108
- let e = Object.getOwnPropertyDescriptors(n);
109
- Object.assign(t, e);
110
- }
111
- return Object.defineProperties({}, t);
112
- }
113
- function ie(e) {
114
- return JSON.stringify(e);
115
- }
116
- function ae(e) {
117
- return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
118
- }
119
- var oe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {};
120
- function x(e) {
121
- return typeof e == "object" && !!e && !Array.isArray(e);
122
- }
123
- var se = /* @__PURE__*/ _(() => {
124
- if (m.jitless || typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare")) return !1;
125
- try {
126
- return Function(""), !0;
127
- } catch {
128
- return !1;
129
- }
130
- });
131
- function S(e) {
132
- if (x(e) === !1) return !1;
133
- let t = e.constructor;
134
- if (t === void 0 || typeof t != "function") return !0;
135
- let n = t.prototype;
136
- return x(n) !== !1 && Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") !== !1;
137
- }
138
- function ce(e) {
139
- return S(e) ? { ...e } : Array.isArray(e) ? [...e] : e instanceof Map ? new Map(e) : e instanceof Set ? new Set(e) : e;
140
- }
141
- var le = /* @__PURE__*/ new Set([
142
- "string",
143
- "number",
144
- "symbol"
145
- ]);
146
- function C(e) {
147
- return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
148
- }
149
- function w(e, t, n) {
150
- let r = new e._zod.constr(t ?? e._zod.def);
151
- return (!t || n?.parent) && (r._zod.parent = e), r;
152
- }
153
- function T(e) {
154
- let t = e;
155
- if (!t) return {};
156
- if (typeof t == "string") return { error: () => t };
157
- if (t?.message !== void 0) {
158
- if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
159
- t.error = t.message;
160
- }
161
- return delete t.message, typeof t.error == "string" ? {
162
- ...t,
163
- error: () => t.error
164
- } : t;
165
- }
166
- function ue(e) {
167
- return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
168
- }
169
- -Number.MAX_VALUE, Number.MAX_VALUE;
170
- function de(e, t) {
171
- let n = e._zod.def, r = n.checks;
172
- if (r && r.length > 0) throw Error(".pick() cannot be used on object schemas containing refinements");
173
- return w(e, b(e._zod.def, {
174
- get shape() {
175
- let e = {};
176
- for (let r in t) {
177
- if (!(r in n.shape)) throw Error(`Unrecognized key: "${r}"`);
178
- t[r] && (e[r] = n.shape[r]);
179
- }
180
- return y(this, "shape", e), e;
181
- },
182
- checks: []
183
- }));
184
- }
185
- function fe(e, t) {
186
- let n = e._zod.def, r = n.checks;
187
- if (r && r.length > 0) throw Error(".omit() cannot be used on object schemas containing refinements");
188
- return w(e, b(e._zod.def, {
189
- get shape() {
190
- let r = { ...e._zod.def.shape };
191
- for (let e in t) {
192
- if (!(e in n.shape)) throw Error(`Unrecognized key: "${e}"`);
193
- t[e] && delete r[e];
194
- }
195
- return y(this, "shape", r), r;
196
- },
197
- checks: []
198
- }));
199
- }
200
- function pe(e, t) {
201
- if (!S(t)) throw Error("Invalid input to extend: expected a plain object");
202
- let n = e._zod.def.checks;
203
- if (n && n.length > 0) {
204
- let n = e._zod.def.shape;
205
- for (let e in t) if (Object.getOwnPropertyDescriptor(n, e) !== void 0) throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
206
- }
207
- return w(e, b(e._zod.def, { get shape() {
208
- let n = {
209
- ...e._zod.def.shape,
210
- ...t
211
- };
212
- return y(this, "shape", n), n;
213
- } }));
214
- }
215
- function me(e, t) {
216
- if (!S(t)) throw Error("Invalid input to safeExtend: expected a plain object");
217
- return w(e, b(e._zod.def, { get shape() {
218
- let n = {
219
- ...e._zod.def.shape,
220
- ...t
221
- };
222
- return y(this, "shape", n), n;
223
- } }));
224
- }
225
- function he(e, t) {
226
- if (e._zod.def.checks?.length) throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
227
- return w(e, b(e._zod.def, {
228
- get shape() {
229
- let n = {
230
- ...e._zod.def.shape,
231
- ...t._zod.def.shape
232
- };
233
- return y(this, "shape", n), n;
234
- },
235
- get catchall() {
236
- return t._zod.def.catchall;
237
- },
238
- checks: t._zod.def.checks ?? []
239
- }));
240
- }
241
- function ge(e, t, n) {
242
- let r = t._zod.def.checks;
243
- if (r && r.length > 0) throw Error(".partial() cannot be used on object schemas containing refinements");
244
- return w(t, b(t._zod.def, {
245
- get shape() {
246
- let r = t._zod.def.shape, i = { ...r };
247
- if (n) for (let t in n) {
248
- if (!(t in r)) throw Error(`Unrecognized key: "${t}"`);
249
- n[t] && (i[t] = e ? new e({
250
- type: "optional",
251
- innerType: r[t]
252
- }) : r[t]);
253
- }
254
- else for (let t in r) i[t] = e ? new e({
255
- type: "optional",
256
- innerType: r[t]
257
- }) : r[t];
258
- return y(this, "shape", i), i;
259
- },
260
- checks: []
261
- }));
262
- }
263
- function _e(e, t, n) {
264
- return w(t, b(t._zod.def, { get shape() {
265
- let r = t._zod.def.shape, i = { ...r };
266
- if (n) for (let t in n) {
267
- if (!(t in i)) throw Error(`Unrecognized key: "${t}"`);
268
- n[t] && (i[t] = new e({
269
- type: "nonoptional",
270
- innerType: r[t]
271
- }));
272
- }
273
- else for (let t in r) i[t] = new e({
274
- type: "nonoptional",
275
- innerType: r[t]
276
- });
277
- return y(this, "shape", i), i;
278
- } }));
279
- }
280
- function E(e, t = 0) {
281
- if (e.aborted === !0) return !0;
282
- for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0;
283
- return !1;
284
- }
285
- function ve(e, t = 0) {
286
- if (e.aborted === !0) return !0;
287
- for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0;
288
- return !1;
289
- }
290
- function ye(e, t) {
291
- return t.map((t) => {
292
- var n;
293
- return (n = t).path ?? (n.path = []), t.path.unshift(e), t;
294
- });
295
- }
296
- function D(e) {
297
- return typeof e == "string" ? e : e?.message;
298
- }
299
- function O(e, t, n) {
300
- let r = e.message ? e.message : D(e.inst?._zod.def?.error?.(e)) ?? D(t?.error?.(e)) ?? D(n.customError?.(e)) ?? D(n.localeError?.(e)) ?? "Invalid input", { inst: i, continue: a, input: o, ...s } = e;
301
- return s.path ??= [], s.message = r, t?.reportInput && (s.input = o), s;
302
- }
303
- function k(e) {
304
- return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
305
- }
306
- function A(...e) {
307
- let [t, n, r] = e;
308
- return typeof t == "string" ? {
309
- message: t,
310
- code: "custom",
311
- input: n,
312
- inst: r
313
- } : { ...t };
314
- }
315
- //#endregion
316
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
317
- var be = (e, t) => {
318
- e.name = "$ZodError", Object.defineProperty(e, "_zod", {
319
- value: e._zod,
320
- enumerable: !1
321
- }), Object.defineProperty(e, "issues", {
322
- value: t,
323
- enumerable: !1
324
- }), e.message = JSON.stringify(t, g, 2), Object.defineProperty(e, "toString", {
325
- value: () => e.message,
326
- enumerable: !1
327
- });
328
- }, xe = d("$ZodError", be), Se = d("$ZodError", be, { Parent: Error });
329
- function Ce(e, t = (e) => e.message) {
330
- let n = {}, r = [];
331
- for (let i of e.issues) i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(t(i))) : r.push(t(i));
332
- return {
333
- formErrors: r,
334
- fieldErrors: n
335
- };
336
- }
337
- function we(e, t = (e) => e.message) {
338
- let n = { _errors: [] }, r = (e, i = []) => {
339
- for (let a of e.issues) if (a.code === "invalid_union" && a.errors.length) a.errors.map((e) => r({ issues: e }, [...i, ...a.path]));
340
- else if (a.code === "invalid_key") r({ issues: a.issues }, [...i, ...a.path]);
341
- else if (a.code === "invalid_element") r({ issues: a.issues }, [...i, ...a.path]);
342
- else {
343
- let e = [...i, ...a.path];
344
- if (e.length === 0) n._errors.push(t(a));
345
- else {
346
- let r = n, i = 0;
347
- for (; i < e.length;) {
348
- let n = e[i];
349
- i === e.length - 1 ? (r[n] = r[n] || { _errors: [] }, r[n]._errors.push(t(a))) : r[n] = r[n] || { _errors: [] }, r = r[n], i++;
350
- }
351
- }
352
- }
353
- };
354
- return r(e), n;
355
- }
356
- //#endregion
357
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
358
- var Te = (e) => (t, n, r, i) => {
359
- let a = r ? {
360
- ...r,
361
- async: !1
362
- } : { async: !1 }, o = t._zod.run({
363
- value: n,
364
- issues: []
365
- }, a);
366
- if (o instanceof Promise) throw new f();
367
- if (o.issues.length) {
368
- let t = new ((i?.Err) ?? e)(o.issues.map((e) => O(e, a, h())));
369
- throw oe(t, i?.callee), t;
370
- }
371
- return o.value;
372
- }, Ee = (e) => async (t, n, r, i) => {
373
- let a = r ? {
374
- ...r,
375
- async: !0
376
- } : { async: !0 }, o = t._zod.run({
377
- value: n,
378
- issues: []
379
- }, a);
380
- if (o instanceof Promise && (o = await o), o.issues.length) {
381
- let t = new ((i?.Err) ?? e)(o.issues.map((e) => O(e, a, h())));
382
- throw oe(t, i?.callee), t;
383
- }
384
- return o.value;
385
- }, j = (e) => (t, n, r) => {
386
- let i = r ? {
387
- ...r,
388
- async: !1
389
- } : { async: !1 }, a = t._zod.run({
390
- value: n,
391
- issues: []
392
- }, i);
393
- if (a instanceof Promise) throw new f();
394
- return a.issues.length ? {
395
- success: !1,
396
- error: new (e ?? xe)(a.issues.map((e) => O(e, i, h())))
397
- } : {
398
- success: !0,
399
- data: a.value
400
- };
401
- }, De = /* @__PURE__*/ j(Se), M = (e) => async (t, n, r) => {
402
- let i = r ? {
403
- ...r,
404
- async: !0
405
- } : { async: !0 }, a = t._zod.run({
406
- value: n,
407
- issues: []
408
- }, i);
409
- return a instanceof Promise && (a = await a), a.issues.length ? {
410
- success: !1,
411
- error: new e(a.issues.map((e) => O(e, i, h())))
412
- } : {
413
- success: !0,
414
- data: a.value
415
- };
416
- }, Oe = /* @__PURE__*/ M(Se), ke = (e) => (t, n, r) => {
417
- let i = r ? {
418
- ...r,
419
- direction: "backward"
420
- } : { direction: "backward" };
421
- return Te(e)(t, n, i);
422
- }, Ae = (e) => (t, n, r) => Te(e)(t, n, r), je = (e) => async (t, n, r) => {
423
- let i = r ? {
424
- ...r,
425
- direction: "backward"
426
- } : { direction: "backward" };
427
- return Ee(e)(t, n, i);
428
- }, Me = (e) => async (t, n, r) => Ee(e)(t, n, r), Ne = (e) => (t, n, r) => {
429
- let i = r ? {
430
- ...r,
431
- direction: "backward"
432
- } : { direction: "backward" };
433
- return j(e)(t, n, i);
434
- }, Pe = (e) => (t, n, r) => j(e)(t, n, r), Fe = (e) => async (t, n, r) => {
435
- let i = r ? {
436
- ...r,
437
- direction: "backward"
438
- } : { direction: "backward" };
439
- return M(e)(t, n, i);
440
- }, Ie = (e) => async (t, n, r) => M(e)(t, n, r), Le = /^[cC][0-9a-z]{6,}$/, Re = /^[0-9a-z]+$/, ze = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, Be = /^[0-9a-vA-V]{20}$/, Ve = /^[A-Za-z0-9]{27}$/, He = /^[a-zA-Z0-9_-]{21}$/, Ue = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, We = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, Ge = (e) => e ? RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Ke = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, qe = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
441
- function Je() {
442
- return new RegExp(qe, "u");
443
- }
444
- var Ye = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Xe = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, Ze = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Qe = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, $e = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, et = /^[A-Za-z0-9_-]*$/, tt = /^https?$/, nt = /^\+[1-9]\d{6,14}$/, rt = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", it = /*@__PURE__*/ RegExp(`^${rt}$`);
445
- function at(e) {
446
- let t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
447
- return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
448
- }
449
- function ot(e) {
450
- return RegExp(`^${at(e)}$`);
451
- }
452
- function st(e) {
453
- let t = at({ precision: e.precision }), n = ["Z"];
454
- e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
455
- let r = `${t}(?:${n.join("|")})`;
456
- return RegExp(`^${rt}T(?:${r})$`);
457
- }
458
- var ct = (e) => {
459
- let t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
460
- return RegExp(`^${t}$`);
461
- }, lt = /^[^A-Z]*$/, ut = /^[^a-z]*$/, N = /*@__PURE__*/ d("$ZodCheck", (e, t) => {
462
- var n;
463
- e._zod ??= {}, e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
464
- }), dt = /*@__PURE__*/ d("$ZodCheckMaxLength", (e, t) => {
465
- var n;
466
- N.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
467
- let t = e.value;
468
- return !te(t) && t.length !== void 0;
469
- }), e._zod.onattach.push((e) => {
470
- let n = e._zod.bag.maximum ?? Infinity;
471
- t.maximum < n && (e._zod.bag.maximum = t.maximum);
472
- }), e._zod.check = (n) => {
473
- let r = n.value;
474
- if (r.length <= t.maximum) return;
475
- let i = k(r);
476
- n.issues.push({
477
- origin: i,
478
- code: "too_big",
479
- maximum: t.maximum,
480
- inclusive: !0,
481
- input: r,
482
- inst: e,
483
- continue: !t.abort
484
- });
485
- };
486
- }), ft = /*@__PURE__*/ d("$ZodCheckMinLength", (e, t) => {
487
- var n;
488
- N.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
489
- let t = e.value;
490
- return !te(t) && t.length !== void 0;
491
- }), e._zod.onattach.push((e) => {
492
- let n = e._zod.bag.minimum ?? -Infinity;
493
- t.minimum > n && (e._zod.bag.minimum = t.minimum);
494
- }), e._zod.check = (n) => {
495
- let r = n.value;
496
- if (r.length >= t.minimum) return;
497
- let i = k(r);
498
- n.issues.push({
499
- origin: i,
500
- code: "too_small",
501
- minimum: t.minimum,
502
- inclusive: !0,
503
- input: r,
504
- inst: e,
505
- continue: !t.abort
506
- });
507
- };
508
- }), pt = /*@__PURE__*/ d("$ZodCheckLengthEquals", (e, t) => {
509
- var n;
510
- N.init(e, t), (n = e._zod.def).when ?? (n.when = (e) => {
511
- let t = e.value;
512
- return !te(t) && t.length !== void 0;
513
- }), e._zod.onattach.push((e) => {
514
- let n = e._zod.bag;
515
- n.minimum = t.length, n.maximum = t.length, n.length = t.length;
516
- }), e._zod.check = (n) => {
517
- let r = n.value, i = r.length;
518
- if (i === t.length) return;
519
- let a = k(r), o = i > t.length;
520
- n.issues.push({
521
- origin: a,
522
- ...o ? {
523
- code: "too_big",
524
- maximum: t.length
525
- } : {
526
- code: "too_small",
527
- minimum: t.length
528
- },
529
- inclusive: !0,
530
- exact: !0,
531
- input: n.value,
532
- inst: e,
533
- continue: !t.abort
534
- });
535
- };
536
- }), P = /*@__PURE__*/ d("$ZodCheckStringFormat", (e, t) => {
537
- var n, r;
538
- N.init(e, t), e._zod.onattach.push((e) => {
539
- let n = e._zod.bag;
540
- n.format = t.format, t.pattern && (n.patterns ??= /* @__PURE__ */ new Set(), n.patterns.add(t.pattern));
541
- }), t.pattern ? (n = e._zod).check ?? (n.check = (n) => {
542
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
543
- origin: "string",
544
- code: "invalid_format",
545
- format: t.format,
546
- input: n.value,
547
- ...t.pattern ? { pattern: t.pattern.toString() } : {},
548
- inst: e,
549
- continue: !t.abort
550
- });
551
- }) : (r = e._zod).check ?? (r.check = () => {});
552
- }), mt = /*@__PURE__*/ d("$ZodCheckRegex", (e, t) => {
553
- P.init(e, t), e._zod.check = (n) => {
554
- t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
555
- origin: "string",
556
- code: "invalid_format",
557
- format: "regex",
558
- input: n.value,
559
- pattern: t.pattern.toString(),
560
- inst: e,
561
- continue: !t.abort
562
- });
563
- };
564
- }), ht = /*@__PURE__*/ d("$ZodCheckLowerCase", (e, t) => {
565
- t.pattern ??= lt, P.init(e, t);
566
- }), gt = /*@__PURE__*/ d("$ZodCheckUpperCase", (e, t) => {
567
- t.pattern ??= ut, P.init(e, t);
568
- }), _t = /*@__PURE__*/ d("$ZodCheckIncludes", (e, t) => {
569
- N.init(e, t);
570
- let n = C(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
571
- t.pattern = r, e._zod.onattach.push((e) => {
572
- let t = e._zod.bag;
573
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(r);
574
- }), e._zod.check = (n) => {
575
- n.value.includes(t.includes, t.position) || n.issues.push({
576
- origin: "string",
577
- code: "invalid_format",
578
- format: "includes",
579
- includes: t.includes,
580
- input: n.value,
581
- inst: e,
582
- continue: !t.abort
583
- });
584
- };
585
- }), vt = /*@__PURE__*/ d("$ZodCheckStartsWith", (e, t) => {
586
- N.init(e, t);
587
- let n = RegExp(`^${C(t.prefix)}.*`);
588
- t.pattern ??= n, e._zod.onattach.push((e) => {
589
- let t = e._zod.bag;
590
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
591
- }), e._zod.check = (n) => {
592
- n.value.startsWith(t.prefix) || n.issues.push({
593
- origin: "string",
594
- code: "invalid_format",
595
- format: "starts_with",
596
- prefix: t.prefix,
597
- input: n.value,
598
- inst: e,
599
- continue: !t.abort
600
- });
601
- };
602
- }), yt = /*@__PURE__*/ d("$ZodCheckEndsWith", (e, t) => {
603
- N.init(e, t);
604
- let n = RegExp(`.*${C(t.suffix)}$`);
605
- t.pattern ??= n, e._zod.onattach.push((e) => {
606
- let t = e._zod.bag;
607
- t.patterns ??= /* @__PURE__ */ new Set(), t.patterns.add(n);
608
- }), e._zod.check = (n) => {
609
- n.value.endsWith(t.suffix) || n.issues.push({
610
- origin: "string",
611
- code: "invalid_format",
612
- format: "ends_with",
613
- suffix: t.suffix,
614
- input: n.value,
615
- inst: e,
616
- continue: !t.abort
617
- });
618
- };
619
- }), bt = /*@__PURE__*/ d("$ZodCheckOverwrite", (e, t) => {
620
- N.init(e, t), e._zod.check = (e) => {
621
- e.value = t.tx(e.value);
622
- };
623
- }), xt = class {
624
- constructor(e = []) {
625
- this.content = [], this.indent = 0, this && (this.args = e);
626
- }
627
- indented(e) {
628
- this.indent += 1, e(this), --this.indent;
629
- }
630
- write(e) {
631
- if (typeof e == "function") {
632
- e(this, { execution: "sync" }), e(this, { execution: "async" });
633
- return;
634
- }
635
- let t = e.split("\n").filter((e) => e), n = Math.min(...t.map((e) => e.length - e.trimStart().length)), r = t.map((e) => e.slice(n)).map((e) => " ".repeat(this.indent * 2) + e);
636
- for (let e of r) this.content.push(e);
637
- }
638
- compile() {
639
- let e = Function, t = this?.args, n = [...(this?.content ?? [""]).map((e) => ` ${e}`)];
640
- return new e(...t, n.join("\n"));
641
- }
642
- }, St = {
643
- major: 4,
644
- minor: 4,
645
- patch: 3
646
- }, F = /*@__PURE__*/ d("$ZodType", (e, t) => {
647
- var n;
648
- e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = St;
649
- let r = [...e._zod.def.checks ?? []];
650
- e._zod.traits.has("$ZodCheck") && r.unshift(e);
651
- for (let t of r) for (let n of t._zod.onattach) n(e);
652
- if (r.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
653
- e._zod.run = e._zod.parse;
654
- });
655
- else {
656
- let t = (e, t, n) => {
657
- let r = E(e), i;
658
- for (let a of t) {
659
- if (a._zod.def.when) {
660
- if (ve(e) || !a._zod.def.when(e)) continue;
661
- } else if (r) continue;
662
- let t = e.issues.length, o = a._zod.check(e);
663
- if (o instanceof Promise && n?.async === !1) throw new f();
664
- if (i || o instanceof Promise) i = (i ?? Promise.resolve()).then(async () => {
665
- await o, e.issues.length !== t && (r ||= E(e, t));
666
- });
667
- else {
668
- if (e.issues.length === t) continue;
669
- r ||= E(e, t);
670
- }
671
- }
672
- return i ? i.then(() => e) : e;
673
- }, n = (n, i, a) => {
674
- if (E(n)) return n.aborted = !0, n;
675
- let o = t(i, r, a);
676
- if (o instanceof Promise) {
677
- if (a.async === !1) throw new f();
678
- return o.then((t) => e._zod.parse(t, a));
679
- }
680
- return e._zod.parse(o, a);
681
- };
682
- e._zod.run = (i, a) => {
683
- if (a.skipChecks) return e._zod.parse(i, a);
684
- if (a.direction === "backward") {
685
- let t = e._zod.parse({
686
- value: i.value,
687
- issues: []
688
- }, {
689
- ...a,
690
- skipChecks: !0
691
- });
692
- return t instanceof Promise ? t.then((e) => n(e, i, a)) : n(t, i, a);
693
- }
694
- let o = e._zod.parse(i, a);
695
- if (o instanceof Promise) {
696
- if (a.async === !1) throw new f();
697
- return o.then((e) => t(e, r, a));
698
- }
699
- return t(o, r, a);
700
- };
701
- }
702
- v(e, "~standard", () => ({
703
- validate: (t) => {
704
- try {
705
- let n = De(e, t);
706
- return n.success ? { value: n.data } : { issues: n.error?.issues };
707
- } catch {
708
- return Oe(e, t).then((e) => e.success ? { value: e.data } : { issues: e.error?.issues });
709
- }
710
- },
711
- vendor: "zod",
712
- version: 1
713
- }));
714
- }), I = /*@__PURE__*/ d("$ZodString", (e, t) => {
715
- F.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? ct(e._zod.bag), e._zod.parse = (n, r) => {
716
- if (t.coerce) try {
717
- n.value = String(n.value);
718
- } catch {}
719
- return typeof n.value == "string" || n.issues.push({
720
- expected: "string",
721
- code: "invalid_type",
722
- input: n.value,
723
- inst: e
724
- }), n;
725
- };
726
- }), L = /*@__PURE__*/ d("$ZodStringFormat", (e, t) => {
727
- P.init(e, t), I.init(e, t);
728
- }), Ct = /*@__PURE__*/ d("$ZodGUID", (e, t) => {
729
- t.pattern ??= We, L.init(e, t);
730
- }), wt = /*@__PURE__*/ d("$ZodUUID", (e, t) => {
731
- if (t.version) {
732
- let e = {
733
- v1: 1,
734
- v2: 2,
735
- v3: 3,
736
- v4: 4,
737
- v5: 5,
738
- v6: 6,
739
- v7: 7,
740
- v8: 8
741
- }[t.version];
742
- if (e === void 0) throw Error(`Invalid UUID version: "${t.version}"`);
743
- t.pattern ??= Ge(e);
744
- } else t.pattern ??= Ge();
745
- L.init(e, t);
746
- }), Tt = /*@__PURE__*/ d("$ZodEmail", (e, t) => {
747
- t.pattern ??= Ke, L.init(e, t);
748
- }), Et = /*@__PURE__*/ d("$ZodURL", (e, t) => {
749
- L.init(e, t), e._zod.check = (n) => {
750
- try {
751
- let r = n.value.trim();
752
- if (!t.normalize && t.protocol?.source === tt.source && !/^https?:\/\//i.test(r)) {
753
- n.issues.push({
754
- code: "invalid_format",
755
- format: "url",
756
- note: "Invalid URL format",
757
- input: n.value,
758
- inst: e,
759
- continue: !t.abort
760
- });
761
- return;
762
- }
763
- let i = new URL(r);
764
- t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(i.hostname) || n.issues.push({
765
- code: "invalid_format",
766
- format: "url",
767
- note: "Invalid hostname",
768
- pattern: t.hostname.source,
769
- input: n.value,
770
- inst: e,
771
- continue: !t.abort
772
- })), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || n.issues.push({
773
- code: "invalid_format",
774
- format: "url",
775
- note: "Invalid protocol",
776
- pattern: t.protocol.source,
777
- input: n.value,
778
- inst: e,
779
- continue: !t.abort
780
- })), n.value = t.normalize ? i.href : r;
781
- return;
782
- } catch {
783
- n.issues.push({
784
- code: "invalid_format",
785
- format: "url",
786
- input: n.value,
787
- inst: e,
788
- continue: !t.abort
789
- });
790
- }
791
- };
792
- }), Dt = /*@__PURE__*/ d("$ZodEmoji", (e, t) => {
793
- t.pattern ??= Je(), L.init(e, t);
794
- }), Ot = /*@__PURE__*/ d("$ZodNanoID", (e, t) => {
795
- t.pattern ??= He, L.init(e, t);
796
- }), kt = /*@__PURE__*/ d("$ZodCUID", (e, t) => {
797
- t.pattern ??= Le, L.init(e, t);
798
- }), At = /*@__PURE__*/ d("$ZodCUID2", (e, t) => {
799
- t.pattern ??= Re, L.init(e, t);
800
- }), jt = /*@__PURE__*/ d("$ZodULID", (e, t) => {
801
- t.pattern ??= ze, L.init(e, t);
802
- }), Mt = /*@__PURE__*/ d("$ZodXID", (e, t) => {
803
- t.pattern ??= Be, L.init(e, t);
804
- }), Nt = /*@__PURE__*/ d("$ZodKSUID", (e, t) => {
805
- t.pattern ??= Ve, L.init(e, t);
806
- }), Pt = /*@__PURE__*/ d("$ZodISODateTime", (e, t) => {
807
- t.pattern ??= st(t), L.init(e, t);
808
- }), Ft = /*@__PURE__*/ d("$ZodISODate", (e, t) => {
809
- t.pattern ??= it, L.init(e, t);
810
- }), It = /*@__PURE__*/ d("$ZodISOTime", (e, t) => {
811
- t.pattern ??= ot(t), L.init(e, t);
812
- }), Lt = /*@__PURE__*/ d("$ZodISODuration", (e, t) => {
813
- t.pattern ??= Ue, L.init(e, t);
814
- }), Rt = /*@__PURE__*/ d("$ZodIPv4", (e, t) => {
815
- t.pattern ??= Ye, L.init(e, t), e._zod.bag.format = "ipv4";
816
- }), zt = /*@__PURE__*/ d("$ZodIPv6", (e, t) => {
817
- t.pattern ??= Xe, L.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
818
- try {
819
- new URL(`http://[${n.value}]`);
820
- } catch {
821
- n.issues.push({
822
- code: "invalid_format",
823
- format: "ipv6",
824
- input: n.value,
825
- inst: e,
826
- continue: !t.abort
827
- });
828
- }
829
- };
830
- }), Bt = /*@__PURE__*/ d("$ZodCIDRv4", (e, t) => {
831
- t.pattern ??= Ze, L.init(e, t);
832
- }), Vt = /*@__PURE__*/ d("$ZodCIDRv6", (e, t) => {
833
- t.pattern ??= Qe, L.init(e, t), e._zod.check = (n) => {
834
- let r = n.value.split("/");
835
- try {
836
- if (r.length !== 2) throw Error();
837
- let [e, t] = r;
838
- if (!t) throw Error();
839
- let n = Number(t);
840
- if (`${n}` !== t || n < 0 || n > 128) throw Error();
841
- new URL(`http://[${e}]`);
842
- } catch {
843
- n.issues.push({
844
- code: "invalid_format",
845
- format: "cidrv6",
846
- input: n.value,
847
- inst: e,
848
- continue: !t.abort
849
- });
850
- }
851
- };
852
- });
853
- function Ht(e) {
854
- if (e === "") return !0;
855
- if (/\s/.test(e) || e.length % 4 != 0) return !1;
856
- try {
857
- return atob(e), !0;
858
- } catch {
859
- return !1;
860
- }
861
- }
862
- var Ut = /*@__PURE__*/ d("$ZodBase64", (e, t) => {
863
- t.pattern ??= $e, L.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
864
- Ht(n.value) || n.issues.push({
865
- code: "invalid_format",
866
- format: "base64",
867
- input: n.value,
868
- inst: e,
869
- continue: !t.abort
870
- });
871
- };
872
- });
873
- function Wt(e) {
874
- if (!et.test(e)) return !1;
875
- let t = e.replace(/[-_]/g, (e) => e === "-" ? "+" : "/");
876
- return Ht(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
877
- }
878
- var Gt = /*@__PURE__*/ d("$ZodBase64URL", (e, t) => {
879
- t.pattern ??= et, L.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
880
- Wt(n.value) || n.issues.push({
881
- code: "invalid_format",
882
- format: "base64url",
883
- input: n.value,
884
- inst: e,
885
- continue: !t.abort
886
- });
887
- };
888
- }), Kt = /*@__PURE__*/ d("$ZodE164", (e, t) => {
889
- t.pattern ??= nt, L.init(e, t);
890
- });
891
- function qt(e, t = null) {
892
- try {
893
- let n = e.split(".");
894
- if (n.length !== 3) return !1;
895
- let [r] = n;
896
- if (!r) return !1;
897
- let i = JSON.parse(atob(r));
898
- return !("typ" in i && i?.typ !== "JWT" || !i.alg || t && (!("alg" in i) || i.alg !== t));
899
- } catch {
900
- return !1;
901
- }
902
- }
903
- var Jt = /*@__PURE__*/ d("$ZodJWT", (e, t) => {
904
- L.init(e, t), e._zod.check = (n) => {
905
- qt(n.value, t.alg) || n.issues.push({
906
- code: "invalid_format",
907
- format: "jwt",
908
- input: n.value,
909
- inst: e,
910
- continue: !t.abort
911
- });
912
- };
913
- }), Yt = /*@__PURE__*/ d("$ZodUnknown", (e, t) => {
914
- F.init(e, t), e._zod.parse = (e) => e;
915
- }), Xt = /*@__PURE__*/ d("$ZodNever", (e, t) => {
916
- F.init(e, t), e._zod.parse = (t, n) => (t.issues.push({
917
- expected: "never",
918
- code: "invalid_type",
919
- input: t.value,
920
- inst: e
921
- }), t);
922
- });
923
- function Zt(e, t, n) {
924
- e.issues.length && t.issues.push(...ye(n, e.issues)), t.value[n] = e.value;
925
- }
926
- var Qt = /*@__PURE__*/ d("$ZodArray", (e, t) => {
927
- F.init(e, t), e._zod.parse = (n, r) => {
928
- let i = n.value;
929
- if (!Array.isArray(i)) return n.issues.push({
930
- expected: "array",
931
- code: "invalid_type",
932
- input: i,
933
- inst: e
934
- }), n;
935
- n.value = Array(i.length);
936
- let a = [];
937
- for (let e = 0; e < i.length; e++) {
938
- let o = i[e], s = t.element._zod.run({
939
- value: o,
940
- issues: []
941
- }, r);
942
- s instanceof Promise ? a.push(s.then((t) => Zt(t, n, e))) : Zt(s, n, e);
943
- }
944
- return a.length ? Promise.all(a).then(() => n) : n;
945
- };
946
- });
947
- function R(e, t, n, r, i, a) {
948
- let o = n in r;
949
- if (e.issues.length) {
950
- if (i && a && !o) return;
951
- t.issues.push(...ye(n, e.issues));
952
- }
953
- if (!o && !i) {
954
- e.issues.length || t.issues.push({
955
- code: "invalid_type",
956
- expected: "nonoptional",
957
- input: void 0,
958
- path: [n]
959
- });
960
- return;
961
- }
962
- e.value === void 0 ? o && (t.value[n] = void 0) : t.value[n] = e.value;
963
- }
964
- function $t(e) {
965
- let t = Object.keys(e.shape);
966
- for (let n of t) if (!e.shape?.[n]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${n}": expected a Zod schema`);
967
- let n = ue(e.shape);
968
- return {
969
- ...e,
970
- keys: t,
971
- keySet: new Set(t),
972
- numKeys: t.length,
973
- optionalKeys: new Set(n)
974
- };
975
- }
976
- function en(e, t, n, r, i, a) {
977
- let o = [], s = i.keySet, c = i.catchall._zod, l = c.def.type, u = c.optin === "optional", d = c.optout === "optional";
978
- for (let i in t) {
979
- if (i === "__proto__" || s.has(i)) continue;
980
- if (l === "never") {
981
- o.push(i);
982
- continue;
983
- }
984
- let a = c.run({
985
- value: t[i],
986
- issues: []
987
- }, r);
988
- a instanceof Promise ? e.push(a.then((e) => R(e, n, i, t, u, d))) : R(a, n, i, t, u, d);
989
- }
990
- return o.length && n.issues.push({
991
- code: "unrecognized_keys",
992
- keys: o,
993
- input: t,
994
- inst: a
995
- }), e.length ? Promise.all(e).then(() => n) : n;
996
- }
997
- var tn = /*@__PURE__*/ d("$ZodObject", (e, t) => {
998
- if (F.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
999
- let e = t.shape;
1000
- Object.defineProperty(t, "shape", { get: () => {
1001
- let n = { ...e };
1002
- return Object.defineProperty(t, "shape", { value: n }), n;
1003
- } });
1004
- }
1005
- let n = _(() => $t(t));
1006
- v(e._zod, "propValues", () => {
1007
- let e = t.shape, n = {};
1008
- for (let t in e) {
1009
- let r = e[t]._zod;
1010
- if (r.values) {
1011
- n[t] ?? (n[t] = /* @__PURE__ */ new Set());
1012
- for (let e of r.values) n[t].add(e);
1013
- }
1014
- }
1015
- return n;
1016
- });
1017
- let r = x, i = t.catchall, a;
1018
- e._zod.parse = (t, o) => {
1019
- a ??= n.value;
1020
- let s = t.value;
1021
- if (!r(s)) return t.issues.push({
1022
- expected: "object",
1023
- code: "invalid_type",
1024
- input: s,
1025
- inst: e
1026
- }), t;
1027
- t.value = {};
1028
- let c = [], l = a.shape;
1029
- for (let e of a.keys) {
1030
- let n = l[e], r = n._zod.optin === "optional", i = n._zod.optout === "optional", a = n._zod.run({
1031
- value: s[e],
1032
- issues: []
1033
- }, o);
1034
- a instanceof Promise ? c.push(a.then((n) => R(n, t, e, s, r, i))) : R(a, t, e, s, r, i);
1035
- }
1036
- return i ? en(c, s, t, o, n.value, e) : c.length ? Promise.all(c).then(() => t) : t;
1037
- };
1038
- }), nn = /*@__PURE__*/ d("$ZodObjectJIT", (e, t) => {
1039
- tn.init(e, t);
1040
- let n = e._zod.parse, r = _(() => $t(t)), i = (e) => {
1041
- let t = new xt([
1042
- "shape",
1043
- "payload",
1044
- "ctx"
1045
- ]), n = r.value, i = (e) => {
1046
- let t = ie(e);
1047
- return `shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`;
1048
- };
1049
- t.write("const input = payload.value;");
1050
- let a = Object.create(null), o = 0;
1051
- for (let e of n.keys) a[e] = `key_${o++}`;
1052
- t.write("const newResult = {};");
1053
- for (let r of n.keys) {
1054
- let n = a[r], o = ie(r), s = e[r], c = s?._zod?.optin === "optional", l = s?._zod?.optout === "optional";
1055
- t.write(`const ${n} = ${i(r)};`), c && l ? t.write(`
1056
- if (${n}.issues.length) {
1057
- if (${o} in input) {
1058
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1059
- ...iss,
1060
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1061
- })));
1062
- }
1063
- }
1064
-
1065
- if (${n}.value === undefined) {
1066
- if (${o} in input) {
1067
- newResult[${o}] = undefined;
1068
- }
1069
- } else {
1070
- newResult[${o}] = ${n}.value;
1071
- }
1072
-
1073
- `) : c ? t.write(`
1074
- if (${n}.issues.length) {
1075
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1076
- ...iss,
1077
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1078
- })));
1079
- }
1080
-
1081
- if (${n}.value === undefined) {
1082
- if (${o} in input) {
1083
- newResult[${o}] = undefined;
1084
- }
1085
- } else {
1086
- newResult[${o}] = ${n}.value;
1087
- }
1088
-
1089
- `) : t.write(`
1090
- const ${n}_present = ${o} in input;
1091
- if (${n}.issues.length) {
1092
- payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
1093
- ...iss,
1094
- path: iss.path ? [${o}, ...iss.path] : [${o}]
1095
- })));
1096
- }
1097
- if (!${n}_present && !${n}.issues.length) {
1098
- payload.issues.push({
1099
- code: "invalid_type",
1100
- expected: "nonoptional",
1101
- input: undefined,
1102
- path: [${o}]
1103
- });
1104
- }
1105
-
1106
- if (${n}_present) {
1107
- if (${n}.value === undefined) {
1108
- newResult[${o}] = undefined;
1109
- } else {
1110
- newResult[${o}] = ${n}.value;
1111
- }
1112
- }
1113
-
1114
- `);
1115
- }
1116
- t.write("payload.value = newResult;"), t.write("return payload;");
1117
- let s = t.compile();
1118
- return (t, n) => s(e, t, n);
1119
- }, a, o = x, s = !m.jitless, c = s && se.value, l = t.catchall, u;
1120
- e._zod.parse = (d, f) => {
1121
- u ??= r.value;
1122
- let p = d.value;
1123
- return o(p) ? s && c && f?.async === !1 && f.jitless !== !0 ? (a ||= i(t.shape), d = a(d, f), l ? en([], p, d, f, u, e) : d) : n(d, f) : (d.issues.push({
1124
- expected: "object",
1125
- code: "invalid_type",
1126
- input: p,
1127
- inst: e
1128
- }), d);
1129
- };
1130
- });
1131
- function rn(e, t, n, r) {
1132
- for (let n of e) if (n.issues.length === 0) return t.value = n.value, t;
1133
- let i = e.filter((e) => !E(e));
1134
- return i.length === 1 ? (t.value = i[0].value, i[0]) : (t.issues.push({
1135
- code: "invalid_union",
1136
- input: t.value,
1137
- inst: n,
1138
- errors: e.map((e) => e.issues.map((e) => O(e, r, h())))
1139
- }), t);
1140
- }
1141
- var an = /*@__PURE__*/ d("$ZodUnion", (e, t) => {
1142
- F.init(e, t), v(e._zod, "optin", () => t.options.some((e) => e._zod.optin === "optional") ? "optional" : void 0), v(e._zod, "optout", () => t.options.some((e) => e._zod.optout === "optional") ? "optional" : void 0), v(e._zod, "values", () => {
1143
- if (t.options.every((e) => e._zod.values)) return new Set(t.options.flatMap((e) => Array.from(e._zod.values)));
1144
- }), v(e._zod, "pattern", () => {
1145
- if (t.options.every((e) => e._zod.pattern)) {
1146
- let e = t.options.map((e) => e._zod.pattern);
1147
- return RegExp(`^(${e.map((e) => ne(e.source)).join("|")})$`);
1148
- }
1149
- });
1150
- let n = t.options.length === 1 ? t.options[0]._zod.run : null;
1151
- e._zod.parse = (r, i) => {
1152
- if (n) return n(r, i);
1153
- let a = !1, o = [];
1154
- for (let e of t.options) {
1155
- let t = e._zod.run({
1156
- value: r.value,
1157
- issues: []
1158
- }, i);
1159
- if (t instanceof Promise) o.push(t), a = !0;
1160
- else {
1161
- if (t.issues.length === 0) return t;
1162
- o.push(t);
1163
- }
1164
- }
1165
- return a ? Promise.all(o).then((t) => rn(t, r, e, i)) : rn(o, r, e, i);
1166
- };
1167
- }), on = /*@__PURE__*/ d("$ZodIntersection", (e, t) => {
1168
- F.init(e, t), e._zod.parse = (e, n) => {
1169
- let r = e.value, i = t.left._zod.run({
1170
- value: r,
1171
- issues: []
1172
- }, n), a = t.right._zod.run({
1173
- value: r,
1174
- issues: []
1175
- }, n);
1176
- return i instanceof Promise || a instanceof Promise ? Promise.all([i, a]).then(([t, n]) => sn(e, t, n)) : sn(e, i, a);
1177
- };
1178
- });
1179
- function z(e, t) {
1180
- if (e === t || e instanceof Date && t instanceof Date && +e == +t) return {
1181
- valid: !0,
1182
- data: e
1183
- };
1184
- if (S(e) && S(t)) {
1185
- let n = Object.keys(t), r = Object.keys(e).filter((e) => n.indexOf(e) !== -1), i = {
1186
- ...e,
1187
- ...t
1188
- };
1189
- for (let n of r) {
1190
- let r = z(e[n], t[n]);
1191
- if (!r.valid) return {
1192
- valid: !1,
1193
- mergeErrorPath: [n, ...r.mergeErrorPath]
1194
- };
1195
- i[n] = r.data;
1196
- }
1197
- return {
1198
- valid: !0,
1199
- data: i
1200
- };
1201
- }
1202
- if (Array.isArray(e) && Array.isArray(t)) {
1203
- if (e.length !== t.length) return {
1204
- valid: !1,
1205
- mergeErrorPath: []
1206
- };
1207
- let n = [];
1208
- for (let r = 0; r < e.length; r++) {
1209
- let i = e[r], a = t[r], o = z(i, a);
1210
- if (!o.valid) return {
1211
- valid: !1,
1212
- mergeErrorPath: [r, ...o.mergeErrorPath]
1213
- };
1214
- n.push(o.data);
1215
- }
1216
- return {
1217
- valid: !0,
1218
- data: n
1219
- };
1220
- }
1221
- return {
1222
- valid: !1,
1223
- mergeErrorPath: []
1224
- };
1225
- }
1226
- function sn(e, t, n) {
1227
- let r = /* @__PURE__ */ new Map(), i;
1228
- for (let n of t.issues) if (n.code === "unrecognized_keys") {
1229
- i ??= n;
1230
- for (let e of n.keys) r.has(e) || r.set(e, {}), r.get(e).l = !0;
1231
- } else e.issues.push(n);
1232
- for (let t of n.issues) if (t.code === "unrecognized_keys") for (let e of t.keys) r.has(e) || r.set(e, {}), r.get(e).r = !0;
1233
- else e.issues.push(t);
1234
- let a = [...r].filter(([, e]) => e.l && e.r).map(([e]) => e);
1235
- if (a.length && i && e.issues.push({
1236
- ...i,
1237
- keys: a
1238
- }), E(e)) return e;
1239
- let o = z(t.value, n.value);
1240
- if (!o.valid) throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);
1241
- return e.value = o.data, e;
1242
- }
1243
- var cn = /*@__PURE__*/ d("$ZodEnum", (e, t) => {
1244
- F.init(e, t);
1245
- let n = ee(t.entries), r = new Set(n);
1246
- e._zod.values = r, e._zod.pattern = RegExp(`^(${n.filter((e) => le.has(typeof e)).map((e) => typeof e == "string" ? C(e) : e.toString()).join("|")})$`), e._zod.parse = (t, i) => {
1247
- let a = t.value;
1248
- return r.has(a) || t.issues.push({
1249
- code: "invalid_value",
1250
- values: n,
1251
- input: a,
1252
- inst: e
1253
- }), t;
1254
- };
1255
- }), ln = /*@__PURE__*/ d("$ZodTransform", (e, t) => {
1256
- F.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
1257
- if (r.direction === "backward") throw new p(e.constructor.name);
1258
- let i = t.transform(n.value, n);
1259
- if (r.async) return (i instanceof Promise ? i : Promise.resolve(i)).then((e) => (n.value = e, n.fallback = !0, n));
1260
- if (i instanceof Promise) throw new f();
1261
- return n.value = i, n.fallback = !0, n;
1262
- };
1263
- });
1264
- function un(e, t) {
1265
- return t === void 0 && (e.issues.length || e.fallback) ? {
1266
- issues: [],
1267
- value: void 0
1268
- } : e;
1269
- }
1270
- var dn = /*@__PURE__*/ d("$ZodOptional", (e, t) => {
1271
- F.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", v(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), v(e._zod, "pattern", () => {
1272
- let e = t.innerType._zod.pattern;
1273
- return e ? RegExp(`^(${ne(e.source)})?$`) : void 0;
1274
- }), e._zod.parse = (e, n) => {
1275
- if (t.innerType._zod.optin === "optional") {
1276
- let r = e.value, i = t.innerType._zod.run(e, n);
1277
- return i instanceof Promise ? i.then((e) => un(e, r)) : un(i, r);
1278
- }
1279
- return e.value === void 0 ? e : t.innerType._zod.run(e, n);
1280
- };
1281
- }), fn = /*@__PURE__*/ d("$ZodExactOptional", (e, t) => {
1282
- dn.init(e, t), v(e._zod, "values", () => t.innerType._zod.values), v(e._zod, "pattern", () => t.innerType._zod.pattern), e._zod.parse = (e, n) => t.innerType._zod.run(e, n);
1283
- }), pn = /*@__PURE__*/ d("$ZodNullable", (e, t) => {
1284
- F.init(e, t), v(e._zod, "optin", () => t.innerType._zod.optin), v(e._zod, "optout", () => t.innerType._zod.optout), v(e._zod, "pattern", () => {
1285
- let e = t.innerType._zod.pattern;
1286
- return e ? RegExp(`^(${ne(e.source)}|null)$`) : void 0;
1287
- }), v(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (e, n) => e.value === null ? e : t.innerType._zod.run(e, n);
1288
- }), mn = /*@__PURE__*/ d("$ZodDefault", (e, t) => {
1289
- F.init(e, t), e._zod.optin = "optional", v(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1290
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1291
- if (e.value === void 0) return e.value = t.defaultValue, e;
1292
- let r = t.innerType._zod.run(e, n);
1293
- return r instanceof Promise ? r.then((e) => hn(e, t)) : hn(r, t);
1294
- };
1295
- });
1296
- function hn(e, t) {
1297
- return e.value === void 0 && (e.value = t.defaultValue), e;
1298
- }
1299
- var gn = /*@__PURE__*/ d("$ZodPrefault", (e, t) => {
1300
- F.init(e, t), e._zod.optin = "optional", v(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => (n.direction === "backward" || e.value === void 0 && (e.value = t.defaultValue), t.innerType._zod.run(e, n));
1301
- }), _n = /*@__PURE__*/ d("$ZodNonOptional", (e, t) => {
1302
- F.init(e, t), v(e._zod, "values", () => {
1303
- let e = t.innerType._zod.values;
1304
- return e ? new Set([...e].filter((e) => e !== void 0)) : void 0;
1305
- }), e._zod.parse = (n, r) => {
1306
- let i = t.innerType._zod.run(n, r);
1307
- return i instanceof Promise ? i.then((t) => vn(t, e)) : vn(i, e);
1308
- };
1309
- });
1310
- function vn(e, t) {
1311
- return !e.issues.length && e.value === void 0 && e.issues.push({
1312
- code: "invalid_type",
1313
- expected: "nonoptional",
1314
- input: e.value,
1315
- inst: t
1316
- }), e;
1317
- }
1318
- var yn = /*@__PURE__*/ d("$ZodCatch", (e, t) => {
1319
- F.init(e, t), e._zod.optin = "optional", v(e._zod, "optout", () => t.innerType._zod.optout), v(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (e, n) => {
1320
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1321
- let r = t.innerType._zod.run(e, n);
1322
- return r instanceof Promise ? r.then((r) => (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1323
- ...e,
1324
- error: { issues: r.issues.map((e) => O(e, n, h())) },
1325
- input: e.value
1326
- }), e.issues = [], e.fallback = !0), e)) : (e.value = r.value, r.issues.length && (e.value = t.catchValue({
1327
- ...e,
1328
- error: { issues: r.issues.map((e) => O(e, n, h())) },
1329
- input: e.value
1330
- }), e.issues = [], e.fallback = !0), e);
1331
- };
1332
- }), bn = /*@__PURE__*/ d("$ZodPipe", (e, t) => {
1333
- F.init(e, t), v(e._zod, "values", () => t.in._zod.values), v(e._zod, "optin", () => t.in._zod.optin), v(e._zod, "optout", () => t.out._zod.optout), v(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (e, n) => {
1334
- if (n.direction === "backward") {
1335
- let r = t.out._zod.run(e, n);
1336
- return r instanceof Promise ? r.then((e) => B(e, t.in, n)) : B(r, t.in, n);
1337
- }
1338
- let r = t.in._zod.run(e, n);
1339
- return r instanceof Promise ? r.then((e) => B(e, t.out, n)) : B(r, t.out, n);
1340
- };
1341
- });
1342
- function B(e, t, n) {
1343
- return e.issues.length ? (e.aborted = !0, e) : t._zod.run({
1344
- value: e.value,
1345
- issues: e.issues,
1346
- fallback: e.fallback
1347
- }, n);
1348
- }
1349
- var xn = /*@__PURE__*/ d("$ZodReadonly", (e, t) => {
1350
- F.init(e, t), v(e._zod, "propValues", () => t.innerType._zod.propValues), v(e._zod, "values", () => t.innerType._zod.values), v(e._zod, "optin", () => t.innerType?._zod?.optin), v(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (e, n) => {
1351
- if (n.direction === "backward") return t.innerType._zod.run(e, n);
1352
- let r = t.innerType._zod.run(e, n);
1353
- return r instanceof Promise ? r.then(Sn) : Sn(r);
1354
- };
1355
- });
1356
- function Sn(e) {
1357
- return e.value = Object.freeze(e.value), e;
1358
- }
1359
- var Cn = /*@__PURE__*/ d("$ZodCustom", (e, t) => {
1360
- N.init(e, t), F.init(e, t), e._zod.parse = (e, t) => e, e._zod.check = (n) => {
1361
- let r = n.value, i = t.fn(r);
1362
- if (i instanceof Promise) return i.then((t) => wn(t, n, r, e));
1363
- wn(i, n, r, e);
1364
- };
1365
- });
1366
- function wn(e, t, n, r) {
1367
- if (!e) {
1368
- let e = {
1369
- code: "custom",
1370
- input: n,
1371
- inst: r,
1372
- path: [...r._zod.def.path ?? []],
1373
- continue: !r._zod.def.abort
1374
- };
1375
- r._zod.def.params && (e.params = r._zod.def.params), t.issues.push(A(e));
1376
- }
1377
- }
1378
- //#endregion
1379
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
1380
- var Tn, En = class {
1381
- constructor() {
1382
- this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
1383
- }
1384
- add(e, ...t) {
1385
- let n = t[0];
1386
- return this._map.set(e, n), n && typeof n == "object" && "id" in n && this._idmap.set(n.id, e), this;
1387
- }
1388
- clear() {
1389
- return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
1390
- }
1391
- remove(e) {
1392
- let t = this._map.get(e);
1393
- return t && typeof t == "object" && "id" in t && this._idmap.delete(t.id), this._map.delete(e), this;
1394
- }
1395
- get(e) {
1396
- let t = e._zod.parent;
1397
- if (t) {
1398
- let n = { ...this.get(t) ?? {} };
1399
- delete n.id;
1400
- let r = {
1401
- ...n,
1402
- ...this._map.get(e)
1403
- };
1404
- return Object.keys(r).length ? r : void 0;
1405
- }
1406
- return this._map.get(e);
1407
- }
1408
- has(e) {
1409
- return this._map.has(e);
1410
- }
1411
- };
1412
- function Dn() {
1413
- return new En();
1414
- }
1415
- (Tn = globalThis).__zod_globalRegistry ?? (Tn.__zod_globalRegistry = Dn());
1416
- var V = globalThis.__zod_globalRegistry;
1417
- //#endregion
1418
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
1419
- // @__NO_SIDE_EFFECTS__
1420
- function On(e, t) {
1421
- return new e({
1422
- type: "string",
1423
- ...T(t)
1424
- });
1425
- }
1426
- // @__NO_SIDE_EFFECTS__
1427
- function kn(e, t) {
1428
- return new e({
1429
- type: "string",
1430
- format: "email",
1431
- check: "string_format",
1432
- abort: !1,
1433
- ...T(t)
1434
- });
1435
- }
1436
- // @__NO_SIDE_EFFECTS__
1437
- function An(e, t) {
1438
- return new e({
1439
- type: "string",
1440
- format: "guid",
1441
- check: "string_format",
1442
- abort: !1,
1443
- ...T(t)
1444
- });
1445
- }
1446
- // @__NO_SIDE_EFFECTS__
1447
- function jn(e, t) {
1448
- return new e({
1449
- type: "string",
1450
- format: "uuid",
1451
- check: "string_format",
1452
- abort: !1,
1453
- ...T(t)
1454
- });
1455
- }
1456
- // @__NO_SIDE_EFFECTS__
1457
- function Mn(e, t) {
1458
- return new e({
1459
- type: "string",
1460
- format: "uuid",
1461
- check: "string_format",
1462
- abort: !1,
1463
- version: "v4",
1464
- ...T(t)
1465
- });
1466
- }
1467
- // @__NO_SIDE_EFFECTS__
1468
- function Nn(e, t) {
1469
- return new e({
1470
- type: "string",
1471
- format: "uuid",
1472
- check: "string_format",
1473
- abort: !1,
1474
- version: "v6",
1475
- ...T(t)
1476
- });
1477
- }
1478
- // @__NO_SIDE_EFFECTS__
1479
- function Pn(e, t) {
1480
- return new e({
1481
- type: "string",
1482
- format: "uuid",
1483
- check: "string_format",
1484
- abort: !1,
1485
- version: "v7",
1486
- ...T(t)
1487
- });
1488
- }
1489
- // @__NO_SIDE_EFFECTS__
1490
- function Fn(e, t) {
1491
- return new e({
1492
- type: "string",
1493
- format: "url",
1494
- check: "string_format",
1495
- abort: !1,
1496
- ...T(t)
1497
- });
1498
- }
1499
- // @__NO_SIDE_EFFECTS__
1500
- function In(e, t) {
1501
- return new e({
1502
- type: "string",
1503
- format: "emoji",
1504
- check: "string_format",
1505
- abort: !1,
1506
- ...T(t)
1507
- });
1508
- }
1509
- // @__NO_SIDE_EFFECTS__
1510
- function Ln(e, t) {
1511
- return new e({
1512
- type: "string",
1513
- format: "nanoid",
1514
- check: "string_format",
1515
- abort: !1,
1516
- ...T(t)
1517
- });
1518
- }
1519
- // @__NO_SIDE_EFFECTS__
1520
- function Rn(e, t) {
1521
- return new e({
1522
- type: "string",
1523
- format: "cuid",
1524
- check: "string_format",
1525
- abort: !1,
1526
- ...T(t)
1527
- });
1528
- }
1529
- // @__NO_SIDE_EFFECTS__
1530
- function zn(e, t) {
1531
- return new e({
1532
- type: "string",
1533
- format: "cuid2",
1534
- check: "string_format",
1535
- abort: !1,
1536
- ...T(t)
1537
- });
1538
- }
1539
- // @__NO_SIDE_EFFECTS__
1540
- function Bn(e, t) {
1541
- return new e({
1542
- type: "string",
1543
- format: "ulid",
1544
- check: "string_format",
1545
- abort: !1,
1546
- ...T(t)
1547
- });
1548
- }
1549
- // @__NO_SIDE_EFFECTS__
1550
- function Vn(e, t) {
1551
- return new e({
1552
- type: "string",
1553
- format: "xid",
1554
- check: "string_format",
1555
- abort: !1,
1556
- ...T(t)
1557
- });
1558
- }
1559
- // @__NO_SIDE_EFFECTS__
1560
- function Hn(e, t) {
1561
- return new e({
1562
- type: "string",
1563
- format: "ksuid",
1564
- check: "string_format",
1565
- abort: !1,
1566
- ...T(t)
1567
- });
1568
- }
1569
- // @__NO_SIDE_EFFECTS__
1570
- function Un(e, t) {
1571
- return new e({
1572
- type: "string",
1573
- format: "ipv4",
1574
- check: "string_format",
1575
- abort: !1,
1576
- ...T(t)
1577
- });
1578
- }
1579
- // @__NO_SIDE_EFFECTS__
1580
- function Wn(e, t) {
1581
- return new e({
1582
- type: "string",
1583
- format: "ipv6",
1584
- check: "string_format",
1585
- abort: !1,
1586
- ...T(t)
1587
- });
1588
- }
1589
- // @__NO_SIDE_EFFECTS__
1590
- function Gn(e, t) {
1591
- return new e({
1592
- type: "string",
1593
- format: "cidrv4",
1594
- check: "string_format",
1595
- abort: !1,
1596
- ...T(t)
1597
- });
1598
- }
1599
- // @__NO_SIDE_EFFECTS__
1600
- function Kn(e, t) {
1601
- return new e({
1602
- type: "string",
1603
- format: "cidrv6",
1604
- check: "string_format",
1605
- abort: !1,
1606
- ...T(t)
1607
- });
1608
- }
1609
- // @__NO_SIDE_EFFECTS__
1610
- function qn(e, t) {
1611
- return new e({
1612
- type: "string",
1613
- format: "base64",
1614
- check: "string_format",
1615
- abort: !1,
1616
- ...T(t)
1617
- });
1618
- }
1619
- // @__NO_SIDE_EFFECTS__
1620
- function Jn(e, t) {
1621
- return new e({
1622
- type: "string",
1623
- format: "base64url",
1624
- check: "string_format",
1625
- abort: !1,
1626
- ...T(t)
1627
- });
1628
- }
1629
- // @__NO_SIDE_EFFECTS__
1630
- function Yn(e, t) {
1631
- return new e({
1632
- type: "string",
1633
- format: "e164",
1634
- check: "string_format",
1635
- abort: !1,
1636
- ...T(t)
1637
- });
1638
- }
1639
- // @__NO_SIDE_EFFECTS__
1640
- function Xn(e, t) {
1641
- return new e({
1642
- type: "string",
1643
- format: "jwt",
1644
- check: "string_format",
1645
- abort: !1,
1646
- ...T(t)
1647
- });
1648
- }
1649
- // @__NO_SIDE_EFFECTS__
1650
- function Zn(e, t) {
1651
- return new e({
1652
- type: "string",
1653
- format: "datetime",
1654
- check: "string_format",
1655
- offset: !1,
1656
- local: !1,
1657
- precision: null,
1658
- ...T(t)
1659
- });
1660
- }
1661
- // @__NO_SIDE_EFFECTS__
1662
- function Qn(e, t) {
1663
- return new e({
1664
- type: "string",
1665
- format: "date",
1666
- check: "string_format",
1667
- ...T(t)
1668
- });
1669
- }
1670
- // @__NO_SIDE_EFFECTS__
1671
- function $n(e, t) {
1672
- return new e({
1673
- type: "string",
1674
- format: "time",
1675
- check: "string_format",
1676
- precision: null,
1677
- ...T(t)
1678
- });
1679
- }
1680
- // @__NO_SIDE_EFFECTS__
1681
- function er(e, t) {
1682
- return new e({
1683
- type: "string",
1684
- format: "duration",
1685
- check: "string_format",
1686
- ...T(t)
1687
- });
1688
- }
1689
- // @__NO_SIDE_EFFECTS__
1690
- function tr(e) {
1691
- return new e({ type: "unknown" });
1692
- }
1693
- // @__NO_SIDE_EFFECTS__
1694
- function nr(e, t) {
1695
- return new e({
1696
- type: "never",
1697
- ...T(t)
1698
- });
1699
- }
1700
- // @__NO_SIDE_EFFECTS__
1701
- function rr(e, t) {
1702
- return new dt({
1703
- check: "max_length",
1704
- ...T(t),
1705
- maximum: e
1706
- });
1707
- }
1708
- // @__NO_SIDE_EFFECTS__
1709
- function H(e, t) {
1710
- return new ft({
1711
- check: "min_length",
1712
- ...T(t),
1713
- minimum: e
1714
- });
1715
- }
1716
- // @__NO_SIDE_EFFECTS__
1717
- function ir(e, t) {
1718
- return new pt({
1719
- check: "length_equals",
1720
- ...T(t),
1721
- length: e
1722
- });
1723
- }
1724
- // @__NO_SIDE_EFFECTS__
1725
- function ar(e, t) {
1726
- return new mt({
1727
- check: "string_format",
1728
- format: "regex",
1729
- ...T(t),
1730
- pattern: e
1731
- });
1732
- }
1733
- // @__NO_SIDE_EFFECTS__
1734
- function or(e) {
1735
- return new ht({
1736
- check: "string_format",
1737
- format: "lowercase",
1738
- ...T(e)
1739
- });
1740
- }
1741
- // @__NO_SIDE_EFFECTS__
1742
- function sr(e) {
1743
- return new gt({
1744
- check: "string_format",
1745
- format: "uppercase",
1746
- ...T(e)
1747
- });
1748
- }
1749
- // @__NO_SIDE_EFFECTS__
1750
- function cr(e, t) {
1751
- return new _t({
1752
- check: "string_format",
1753
- format: "includes",
1754
- ...T(t),
1755
- includes: e
1756
- });
1757
- }
1758
- // @__NO_SIDE_EFFECTS__
1759
- function lr(e, t) {
1760
- return new vt({
1761
- check: "string_format",
1762
- format: "starts_with",
1763
- ...T(t),
1764
- prefix: e
1765
- });
1766
- }
1767
- // @__NO_SIDE_EFFECTS__
1768
- function ur(e, t) {
1769
- return new yt({
1770
- check: "string_format",
1771
- format: "ends_with",
1772
- ...T(t),
1773
- suffix: e
1774
- });
1775
- }
1776
- // @__NO_SIDE_EFFECTS__
1777
- function U(e) {
1778
- return new bt({
1779
- check: "overwrite",
1780
- tx: e
1781
- });
1782
- }
1783
- // @__NO_SIDE_EFFECTS__
1784
- function dr(e) {
1785
- return /* @__PURE__ */ U((t) => t.normalize(e));
1786
- }
1787
- // @__NO_SIDE_EFFECTS__
1788
- function fr() {
1789
- return /* @__PURE__ */ U((e) => e.trim());
1790
- }
1791
- // @__NO_SIDE_EFFECTS__
1792
- function pr() {
1793
- return /* @__PURE__ */ U((e) => e.toLowerCase());
1794
- }
1795
- // @__NO_SIDE_EFFECTS__
1796
- function mr() {
1797
- return /* @__PURE__ */ U((e) => e.toUpperCase());
1798
- }
1799
- // @__NO_SIDE_EFFECTS__
1800
- function hr() {
1801
- return /* @__PURE__ */ U((e) => ae(e));
1802
- }
1803
- // @__NO_SIDE_EFFECTS__
1804
- function gr(e, t, n) {
1805
- return new e({
1806
- type: "array",
1807
- element: t,
1808
- ...T(n)
1809
- });
1810
- }
1811
- // @__NO_SIDE_EFFECTS__
1812
- function _r(e, t, n) {
1813
- return new e({
1814
- type: "custom",
1815
- check: "custom",
1816
- fn: t,
1817
- ...T(n)
1818
- });
1819
- }
1820
- // @__NO_SIDE_EFFECTS__
1821
- function vr(e, t) {
1822
- let n = /* @__PURE__ */ yr((t) => (t.addIssue = (e) => {
1823
- if (typeof e == "string") t.issues.push(A(e, t.value, n._zod.def));
1824
- else {
1825
- let r = e;
1826
- r.fatal && (r.continue = !1), r.code ??= "custom", r.input ??= t.value, r.inst ??= n, r.continue ??= !n._zod.def.abort, t.issues.push(A(r));
1827
- }
1828
- }, e(t.value, t)), t);
1829
- return n;
1830
- }
1831
- // @__NO_SIDE_EFFECTS__
1832
- function yr(e, t) {
1833
- let n = new N({
1834
- check: "custom",
1835
- ...T(t)
1836
- });
1837
- return n._zod.check = e, n;
1838
- }
1839
- //#endregion
1840
- //#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
1841
- function br(e) {
1842
- let t = e?.target ?? "draft-2020-12";
1843
- return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
1844
- processors: e.processors ?? {},
1845
- metadataRegistry: e?.metadata ?? V,
1846
- target: t,
1847
- unrepresentable: e?.unrepresentable ?? "throw",
1848
- override: e?.override ?? (() => {}),
1849
- io: e?.io ?? "output",
1850
- counter: 0,
1851
- seen: /* @__PURE__ */ new Map(),
1852
- cycles: e?.cycles ?? "ref",
1853
- reused: e?.reused ?? "inline",
1854
- external: e?.external ?? void 0
1855
- };
1856
- }
1857
- function W(e, t, n = {
1858
- path: [],
1859
- schemaPath: []
1860
- }) {
1861
- var r;
1862
- let i = e._zod.def, a = t.seen.get(e);
1863
- if (a) return a.count++, n.schemaPath.includes(e) && (a.cycle = n.path), a.schema;
1864
- let o = {
1865
- schema: {},
1866
- count: 1,
1867
- cycle: void 0,
1868
- path: n.path
1869
- };
1870
- t.seen.set(e, o);
1871
- let s = e._zod.toJSONSchema?.();
1872
- if (s) o.schema = s;
1873
- else {
1874
- let r = {
1875
- ...n,
1876
- schemaPath: [...n.schemaPath, e],
1877
- path: n.path
1878
- };
1879
- if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, o.schema, r);
1880
- else {
1881
- let n = o.schema, a = t.processors[i.type];
1882
- if (!a) throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
1883
- a(e, t, n, r);
1884
- }
1885
- let a = e._zod.parent;
1886
- a && (o.ref ||= a, W(a, t, r), t.seen.get(a).isParent = !0);
1887
- }
1888
- let c = t.metadataRegistry.get(e);
1889
- return c && Object.assign(o.schema, c), t.io === "input" && G(e) && (delete o.schema.examples, delete o.schema.default), t.io === "input" && "_prefault" in o.schema && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, t.seen.get(e).schema;
1890
- }
1891
- function xr(e, t) {
1892
- let n = e.seen.get(t);
1893
- if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
1894
- let r = /* @__PURE__ */ new Map();
1895
- for (let t of e.seen.entries()) {
1896
- let n = e.metadataRegistry.get(t[0])?.id;
1897
- if (n) {
1898
- let e = r.get(n);
1899
- if (e && e !== t[0]) throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
1900
- r.set(n, t[0]);
1901
- }
1902
- }
1903
- let i = (t) => {
1904
- let r = e.target === "draft-2020-12" ? "$defs" : "definitions";
1905
- if (e.external) {
1906
- let n = e.external.registry.get(t[0])?.id, i = e.external.uri ?? ((e) => e);
1907
- if (n) return { ref: i(n) };
1908
- let a = t[1].defId ?? t[1].schema.id ?? `schema${e.counter++}`;
1909
- return t[1].defId = a, {
1910
- defId: a,
1911
- ref: `${i("__shared")}#/${r}/${a}`
1912
- };
1913
- }
1914
- if (t[1] === n) return { ref: "#" };
1915
- let i = `#/${r}/`, a = t[1].schema.id ?? `__schema${e.counter++}`;
1916
- return {
1917
- defId: a,
1918
- ref: i + a
1919
- };
1920
- }, a = (e) => {
1921
- if (e[1].schema.$ref) return;
1922
- let t = e[1], { ref: n, defId: r } = i(e);
1923
- t.def = { ...t.schema }, r && (t.defId = r);
1924
- let a = t.schema;
1925
- for (let e in a) delete a[e];
1926
- a.$ref = n;
1927
- };
1928
- if (e.cycles === "throw") for (let t of e.seen.entries()) {
1929
- let e = t[1];
1930
- if (e.cycle) throw Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>
1931
-
1932
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
1933
- }
1934
- for (let n of e.seen.entries()) {
1935
- let r = n[1];
1936
- if (t === n[0]) {
1937
- a(n);
1938
- continue;
1939
- }
1940
- if (e.external) {
1941
- let r = e.external.registry.get(n[0])?.id;
1942
- if (t !== n[0] && r) {
1943
- a(n);
1944
- continue;
1945
- }
1946
- }
1947
- if (e.metadataRegistry.get(n[0])?.id) {
1948
- a(n);
1949
- continue;
1950
- }
1951
- if (r.cycle) {
1952
- a(n);
1953
- continue;
1954
- }
1955
- if (r.count > 1 && e.reused === "ref") {
1956
- a(n);
1957
- continue;
1958
- }
1959
- }
1960
- }
1961
- function Sr(e, t) {
1962
- let n = e.seen.get(t);
1963
- if (!n) throw Error("Unprocessed schema. This is a bug in Zod.");
1964
- let r = (t) => {
1965
- let n = e.seen.get(t);
1966
- if (n.ref === null) return;
1967
- let i = n.def ?? n.schema, a = { ...i }, o = n.ref;
1968
- if (n.ref = null, o) {
1969
- r(o);
1970
- let n = e.seen.get(o), s = n.schema;
1971
- if (s.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (i.allOf = i.allOf ?? [], i.allOf.push(s)) : Object.assign(i, s), Object.assign(i, a), t._zod.parent === o) for (let e in i) e !== "$ref" && e !== "allOf" && (e in a || delete i[e]);
1972
- if (s.$ref && n.def) for (let e in i) e !== "$ref" && e !== "allOf" && e in n.def && JSON.stringify(i[e]) === JSON.stringify(n.def[e]) && delete i[e];
1973
- }
1974
- let s = t._zod.parent;
1975
- if (s && s !== o) {
1976
- r(s);
1977
- let t = e.seen.get(s);
1978
- if (t?.schema.$ref && (i.$ref = t.schema.$ref, t.def)) for (let e in i) e !== "$ref" && e !== "allOf" && e in t.def && JSON.stringify(i[e]) === JSON.stringify(t.def[e]) && delete i[e];
1979
- }
1980
- e.override({
1981
- zodSchema: t,
1982
- jsonSchema: i,
1983
- path: n.path ?? []
1984
- });
1985
- };
1986
- for (let t of [...e.seen.entries()].reverse()) r(t[0]);
1987
- let i = {};
1988
- if (e.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
1989
- let n = e.external.registry.get(t)?.id;
1990
- if (!n) throw Error("Schema is missing an `id` property");
1991
- i.$id = e.external.uri(n);
1992
- }
1993
- Object.assign(i, n.def ?? n.schema);
1994
- let a = e.metadataRegistry.get(t)?.id;
1995
- a !== void 0 && i.id === a && delete i.id;
1996
- let o = e.external?.defs ?? {};
1997
- for (let t of e.seen.entries()) {
1998
- let e = t[1];
1999
- e.def && e.defId && (e.def.id === e.defId && delete e.def.id, o[e.defId] = e.def);
2000
- }
2001
- e.external || Object.keys(o).length > 0 && (e.target === "draft-2020-12" ? i.$defs = o : i.definitions = o);
2002
- try {
2003
- let n = JSON.parse(JSON.stringify(i));
2004
- return Object.defineProperty(n, "~standard", {
2005
- value: {
2006
- ...t["~standard"],
2007
- jsonSchema: {
2008
- input: K(t, "input", e.processors),
2009
- output: K(t, "output", e.processors)
2010
- }
2011
- },
2012
- enumerable: !1,
2013
- writable: !1
2014
- }), n;
2015
- } catch {
2016
- throw Error("Error converting schema to JSON.");
2017
- }
2018
- }
2019
- function G(e, t) {
2020
- let n = t ?? { seen: /* @__PURE__ */ new Set() };
2021
- if (n.seen.has(e)) return !1;
2022
- n.seen.add(e);
2023
- let r = e._zod.def;
2024
- if (r.type === "transform") return !0;
2025
- if (r.type === "array") return G(r.element, n);
2026
- if (r.type === "set") return G(r.valueType, n);
2027
- if (r.type === "lazy") return G(r.getter(), n);
2028
- if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault") return G(r.innerType, n);
2029
- if (r.type === "intersection") return G(r.left, n) || G(r.right, n);
2030
- if (r.type === "record" || r.type === "map") return G(r.keyType, n) || G(r.valueType, n);
2031
- if (r.type === "pipe") return e._zod.traits.has("$ZodCodec") ? !0 : G(r.in, n) || G(r.out, n);
2032
- if (r.type === "object") {
2033
- for (let e in r.shape) if (G(r.shape[e], n)) return !0;
2034
- return !1;
2035
- }
2036
- if (r.type === "union") {
2037
- for (let e of r.options) if (G(e, n)) return !0;
2038
- return !1;
2039
- }
2040
- if (r.type === "tuple") {
2041
- for (let e of r.items) if (G(e, n)) return !0;
2042
- return !!(r.rest && G(r.rest, n));
2043
- }
2044
- return !1;
2045
- }
2046
- var Cr = (e, t = {}) => (n) => {
2047
- let r = br({
2048
- ...n,
2049
- processors: t
2050
- });
2051
- return W(e, r), xr(r, e), Sr(r, e);
2052
- }, K = (e, t, n = {}) => (r) => {
2053
- let { libraryOptions: i, target: a } = r ?? {}, o = br({
2054
- ...i ?? {},
2055
- target: a,
2056
- io: t,
2057
- processors: n
2058
- });
2059
- return W(e, o), xr(o, e), Sr(o, e);
2060
- }, wr = {
2061
- guid: "uuid",
2062
- url: "uri",
2063
- datetime: "date-time",
2064
- json_string: "json-string",
2065
- regex: ""
2066
- }, Tr = (e, t, n, r) => {
2067
- let i = n;
2068
- i.type = "string";
2069
- let { minimum: a, maximum: o, format: s, patterns: c, contentEncoding: l } = e._zod.bag;
2070
- if (typeof a == "number" && (i.minLength = a), typeof o == "number" && (i.maxLength = o), s && (i.format = wr[s] ?? s, i.format === "" && delete i.format, s === "time" && delete i.format), l && (i.contentEncoding = l), c && c.size > 0) {
2071
- let e = [...c];
2072
- e.length === 1 ? i.pattern = e[0].source : e.length > 1 && (i.allOf = [...e.map((e) => ({
2073
- ...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
2074
- pattern: e.source
2075
- }))]);
2076
- }
2077
- }, Er = (e, t, n, r) => {
2078
- n.not = {};
2079
- }, Dr = (e, t, n, r) => {
2080
- let i = e._zod.def, a = ee(i.entries);
2081
- a.every((e) => typeof e == "number") && (n.type = "number"), a.every((e) => typeof e == "string") && (n.type = "string"), n.enum = a;
2082
- }, Or = (e, t, n, r) => {
2083
- if (t.unrepresentable === "throw") throw Error("Custom types cannot be represented in JSON Schema");
2084
- }, kr = (e, t, n, r) => {
2085
- if (t.unrepresentable === "throw") throw Error("Transforms cannot be represented in JSON Schema");
2086
- }, Ar = (e, t, n, r) => {
2087
- let i = n, a = e._zod.def, { minimum: o, maximum: s } = e._zod.bag;
2088
- typeof o == "number" && (i.minItems = o), typeof s == "number" && (i.maxItems = s), i.type = "array", i.items = W(a.element, t, {
2089
- ...r,
2090
- path: [...r.path, "items"]
2091
- });
2092
- }, jr = (e, t, n, r) => {
2093
- let i = n, a = e._zod.def;
2094
- i.type = "object", i.properties = {};
2095
- let o = a.shape;
2096
- for (let e in o) i.properties[e] = W(o[e], t, {
2097
- ...r,
2098
- path: [
2099
- ...r.path,
2100
- "properties",
2101
- e
2102
- ]
2103
- });
2104
- let s = new Set(Object.keys(o)), c = new Set([...s].filter((e) => {
2105
- let n = a.shape[e]._zod;
2106
- return t.io === "input" ? n.optin === void 0 : n.optout === void 0;
2107
- }));
2108
- c.size > 0 && (i.required = Array.from(c)), a.catchall?._zod.def.type === "never" ? i.additionalProperties = !1 : a.catchall ? a.catchall && (i.additionalProperties = W(a.catchall, t, {
2109
- ...r,
2110
- path: [...r.path, "additionalProperties"]
2111
- })) : t.io === "output" && (i.additionalProperties = !1);
2112
- }, Mr = (e, t, n, r) => {
2113
- let i = e._zod.def, a = i.inclusive === !1, o = i.options.map((e, n) => W(e, t, {
2114
- ...r,
2115
- path: [
2116
- ...r.path,
2117
- a ? "oneOf" : "anyOf",
2118
- n
2119
- ]
2120
- }));
2121
- a ? n.oneOf = o : n.anyOf = o;
2122
- }, Nr = (e, t, n, r) => {
2123
- let i = e._zod.def, a = W(i.left, t, {
2124
- ...r,
2125
- path: [
2126
- ...r.path,
2127
- "allOf",
2128
- 0
2129
- ]
2130
- }), o = W(i.right, t, {
2131
- ...r,
2132
- path: [
2133
- ...r.path,
2134
- "allOf",
2135
- 1
2136
- ]
2137
- }), s = (e) => "allOf" in e && Object.keys(e).length === 1;
2138
- n.allOf = [...s(a) ? a.allOf : [a], ...s(o) ? o.allOf : [o]];
2139
- }, Pr = (e, t, n, r) => {
2140
- let i = e._zod.def, a = W(i.innerType, t, r), o = t.seen.get(e);
2141
- t.target === "openapi-3.0" ? (o.ref = i.innerType, n.nullable = !0) : n.anyOf = [a, { type: "null" }];
2142
- }, Fr = (e, t, n, r) => {
2143
- let i = e._zod.def;
2144
- W(i.innerType, t, r);
2145
- let a = t.seen.get(e);
2146
- a.ref = i.innerType;
2147
- }, Ir = (e, t, n, r) => {
2148
- let i = e._zod.def;
2149
- W(i.innerType, t, r);
2150
- let a = t.seen.get(e);
2151
- a.ref = i.innerType, n.default = JSON.parse(JSON.stringify(i.defaultValue));
2152
- }, Lr = (e, t, n, r) => {
2153
- let i = e._zod.def;
2154
- W(i.innerType, t, r);
2155
- let a = t.seen.get(e);
2156
- a.ref = i.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
2157
- }, Rr = (e, t, n, r) => {
2158
- let i = e._zod.def;
2159
- W(i.innerType, t, r);
2160
- let a = t.seen.get(e);
2161
- a.ref = i.innerType;
2162
- let o;
2163
- try {
2164
- o = i.catchValue(void 0);
2165
- } catch {
2166
- throw Error("Dynamic catch values are not supported in JSON Schema");
2167
- }
2168
- n.default = o;
2169
- }, zr = (e, t, n, r) => {
2170
- let i = e._zod.def, a = i.in._zod.traits.has("$ZodTransform"), o = t.io === "input" ? a ? i.out : i.in : i.out;
2171
- W(o, t, r);
2172
- let s = t.seen.get(e);
2173
- s.ref = o;
2174
- }, Br = (e, t, n, r) => {
2175
- let i = e._zod.def;
2176
- W(i.innerType, t, r);
2177
- let a = t.seen.get(e);
2178
- a.ref = i.innerType, n.readOnly = !0;
2179
- }, Vr = (e, t, n, r) => {
2180
- let i = e._zod.def;
2181
- W(i.innerType, t, r);
2182
- let a = t.seen.get(e);
2183
- a.ref = i.innerType;
2184
- }, Hr = /*@__PURE__*/ d("ZodISODateTime", (e, t) => {
2185
- Pt.init(e, t), Z.init(e, t);
2186
- });
2187
- function Ur(e) {
2188
- return /* @__PURE__ */ Zn(Hr, e);
2189
- }
2190
- var Wr = /*@__PURE__*/ d("ZodISODate", (e, t) => {
2191
- Ft.init(e, t), Z.init(e, t);
2192
- });
2193
- function Gr(e) {
2194
- return /* @__PURE__ */ Qn(Wr, e);
2195
- }
2196
- var Kr = /*@__PURE__*/ d("ZodISOTime", (e, t) => {
2197
- It.init(e, t), Z.init(e, t);
2198
- });
2199
- function qr(e) {
2200
- return /* @__PURE__ */ $n(Kr, e);
2201
- }
2202
- var Jr = /*@__PURE__*/ d("ZodISODuration", (e, t) => {
2203
- Lt.init(e, t), Z.init(e, t);
2204
- });
2205
- function Yr(e) {
2206
- return /* @__PURE__ */ er(Jr, e);
2207
- }
2208
- var q = /*@__PURE__*/ d("ZodError", (e, t) => {
2209
- xe.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
2210
- format: { value: (t) => we(e, t) },
2211
- flatten: { value: (t) => Ce(e, t) },
2212
- addIssue: { value: (t) => {
2213
- e.issues.push(t), e.message = JSON.stringify(e.issues, g, 2);
2214
- } },
2215
- addIssues: { value: (t) => {
2216
- e.issues.push(...t), e.message = JSON.stringify(e.issues, g, 2);
2217
- } },
2218
- isEmpty: { get() {
2219
- return e.issues.length === 0;
2220
- } }
2221
- });
2222
- }, { Parent: Error }), Xr = /* @__PURE__ */ Te(q), Zr = /* @__PURE__ */ Ee(q), Qr = /* @__PURE__ */ j(q), $r = /* @__PURE__ */ M(q), ei = /* @__PURE__ */ ke(q), ti = /* @__PURE__ */ Ae(q), ni = /* @__PURE__ */ je(q), ri = /* @__PURE__ */ Me(q), ii = /* @__PURE__ */ Ne(q), ai = /* @__PURE__ */ Pe(q), oi = /* @__PURE__ */ Fe(q), si = /* @__PURE__ */ Ie(q), ci = /* @__PURE__ */ new WeakMap();
2223
- function J(e, t, n) {
2224
- let r = Object.getPrototypeOf(e), i = ci.get(r);
2225
- if (i || (i = /* @__PURE__ */ new Set(), ci.set(r, i)), !i.has(t)) {
2226
- i.add(t);
2227
- for (let e in n) {
2228
- let t = n[e];
2229
- Object.defineProperty(r, e, {
2230
- configurable: !0,
2231
- enumerable: !1,
2232
- get() {
2233
- let n = t.bind(this);
2234
- return Object.defineProperty(this, e, {
2235
- configurable: !0,
2236
- writable: !0,
2237
- enumerable: !0,
2238
- value: n
2239
- }), n;
2240
- },
2241
- set(t) {
2242
- Object.defineProperty(this, e, {
2243
- configurable: !0,
2244
- writable: !0,
2245
- enumerable: !0,
2246
- value: t
2247
- });
2248
- }
2249
- });
2250
- }
2251
- }
2252
- }
2253
- var Y = /*@__PURE__*/ d("ZodType", (e, t) => (F.init(e, t), Object.assign(e["~standard"], { jsonSchema: {
2254
- input: K(e, "input"),
2255
- output: K(e, "output")
2256
- } }), e.toJSONSchema = Cr(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.parse = (t, n) => Xr(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => Qr(e, t, n), e.parseAsync = async (t, n) => Zr(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => $r(e, t, n), e.spa = e.safeParseAsync, e.encode = (t, n) => ei(e, t, n), e.decode = (t, n) => ti(e, t, n), e.encodeAsync = async (t, n) => ni(e, t, n), e.decodeAsync = async (t, n) => ri(e, t, n), e.safeEncode = (t, n) => ii(e, t, n), e.safeDecode = (t, n) => ai(e, t, n), e.safeEncodeAsync = async (t, n) => oi(e, t, n), e.safeDecodeAsync = async (t, n) => si(e, t, n), J(e, "ZodType", {
2257
- check(...e) {
2258
- let t = this.def;
2259
- return this.clone(b(t, { checks: [...t.checks ?? [], ...e.map((e) => typeof e == "function" ? { _zod: {
2260
- check: e,
2261
- def: { check: "custom" },
2262
- onattach: []
2263
- } } : e)] }), { parent: !0 });
2264
- },
2265
- with(...e) {
2266
- return this.check(...e);
2267
- },
2268
- clone(e, t) {
2269
- return w(this, e, t);
2270
- },
2271
- brand() {
2272
- return this;
2273
- },
2274
- register(e, t) {
2275
- return e.add(this, t), this;
2276
- },
2277
- refine(e, t) {
2278
- return this.check(da(e, t));
2279
- },
2280
- superRefine(e, t) {
2281
- return this.check(fa(e, t));
2282
- },
2283
- overwrite(e) {
2284
- return this.check(/* @__PURE__ */ U(e));
2285
- },
2286
- optional() {
2287
- return qi(this);
2288
- },
2289
- exactOptional() {
2290
- return Yi(this);
2291
- },
2292
- nullable() {
2293
- return Zi(this);
2294
- },
2295
- nullish() {
2296
- return qi(Zi(this));
2297
- },
2298
- nonoptional(e) {
2299
- return ra(this, e);
2300
- },
2301
- array() {
2302
- return Pi(this);
2303
- },
2304
- or(e) {
2305
- return zi([this, e]);
2306
- },
2307
- and(e) {
2308
- return Vi(this, e);
2309
- },
2310
- transform(e) {
2311
- return sa(this, Gi(e));
2312
- },
2313
- default(e) {
2314
- return $i(this, e);
2315
- },
2316
- prefault(e) {
2317
- return ta(this, e);
2318
- },
2319
- catch(e) {
2320
- return aa(this, e);
2321
- },
2322
- pipe(e) {
2323
- return sa(this, e);
2324
- },
2325
- readonly() {
2326
- return la(this);
2327
- },
2328
- describe(e) {
2329
- let t = this.clone();
2330
- return V.add(t, { description: e }), t;
2331
- },
2332
- meta(...e) {
2333
- if (e.length === 0) return V.get(this);
2334
- let t = this.clone();
2335
- return V.add(t, e[0]), t;
2336
- },
2337
- isOptional() {
2338
- return this.safeParse(void 0).success;
2339
- },
2340
- isNullable() {
2341
- return this.safeParse(null).success;
2342
- },
2343
- apply(e) {
2344
- return e(this);
2345
- }
2346
- }), Object.defineProperty(e, "description", {
2347
- get() {
2348
- return V.get(e)?.description;
2349
- },
2350
- configurable: !0
2351
- }), e)), li = /*@__PURE__*/ d("_ZodString", (e, t) => {
2352
- I.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Tr(e, t, n, r);
2353
- let n = e._zod.bag;
2354
- e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, J(e, "_ZodString", {
2355
- regex(...e) {
2356
- return this.check(/* @__PURE__ */ ar(...e));
2357
- },
2358
- includes(...e) {
2359
- return this.check(/* @__PURE__ */ cr(...e));
2360
- },
2361
- startsWith(...e) {
2362
- return this.check(/* @__PURE__ */ lr(...e));
2363
- },
2364
- endsWith(...e) {
2365
- return this.check(/* @__PURE__ */ ur(...e));
2366
- },
2367
- min(...e) {
2368
- return this.check(/* @__PURE__ */ H(...e));
2369
- },
2370
- max(...e) {
2371
- return this.check(/* @__PURE__ */ rr(...e));
2372
- },
2373
- length(...e) {
2374
- return this.check(/* @__PURE__ */ ir(...e));
2375
- },
2376
- nonempty(...e) {
2377
- return this.check(/* @__PURE__ */ H(1, ...e));
2378
- },
2379
- lowercase(e) {
2380
- return this.check(/* @__PURE__ */ or(e));
2381
- },
2382
- uppercase(e) {
2383
- return this.check(/* @__PURE__ */ sr(e));
2384
- },
2385
- trim() {
2386
- return this.check(/* @__PURE__ */ fr());
2387
- },
2388
- normalize(...e) {
2389
- return this.check(/* @__PURE__ */ dr(...e));
2390
- },
2391
- toLowerCase() {
2392
- return this.check(/* @__PURE__ */ pr());
2393
- },
2394
- toUpperCase() {
2395
- return this.check(/* @__PURE__ */ mr());
2396
- },
2397
- slugify() {
2398
- return this.check(/* @__PURE__ */ hr());
2399
- }
2400
- });
2401
- }), ui = /*@__PURE__*/ d("ZodString", (e, t) => {
2402
- I.init(e, t), li.init(e, t), e.email = (t) => e.check(/* @__PURE__ */ kn(di, t)), e.url = (t) => e.check(/* @__PURE__ */ Fn(pi, t)), e.jwt = (t) => e.check(/* @__PURE__ */ Xn(Oi, t)), e.emoji = (t) => e.check(/* @__PURE__ */ In(mi, t)), e.guid = (t) => e.check(/* @__PURE__ */ An(fi, t)), e.uuid = (t) => e.check(/* @__PURE__ */ jn(Q, t)), e.uuidv4 = (t) => e.check(/* @__PURE__ */ Mn(Q, t)), e.uuidv6 = (t) => e.check(/* @__PURE__ */ Nn(Q, t)), e.uuidv7 = (t) => e.check(/* @__PURE__ */ Pn(Q, t)), e.nanoid = (t) => e.check(/* @__PURE__ */ Ln(hi, t)), e.guid = (t) => e.check(/* @__PURE__ */ An(fi, t)), e.cuid = (t) => e.check(/* @__PURE__ */ Rn(gi, t)), e.cuid2 = (t) => e.check(/* @__PURE__ */ zn(_i, t)), e.ulid = (t) => e.check(/* @__PURE__ */ Bn(vi, t)), e.base64 = (t) => e.check(/* @__PURE__ */ qn(Ti, t)), e.base64url = (t) => e.check(/* @__PURE__ */ Jn(Ei, t)), e.xid = (t) => e.check(/* @__PURE__ */ Vn(yi, t)), e.ksuid = (t) => e.check(/* @__PURE__ */ Hn(bi, t)), e.ipv4 = (t) => e.check(/* @__PURE__ */ Un(xi, t)), e.ipv6 = (t) => e.check(/* @__PURE__ */ Wn(Si, t)), e.cidrv4 = (t) => e.check(/* @__PURE__ */ Gn(Ci, t)), e.cidrv6 = (t) => e.check(/* @__PURE__ */ Kn(wi, t)), e.e164 = (t) => e.check(/* @__PURE__ */ Yn(Di, t)), e.datetime = (t) => e.check(Ur(t)), e.date = (t) => e.check(Gr(t)), e.time = (t) => e.check(qr(t)), e.duration = (t) => e.check(Yr(t));
2403
- });
2404
- function X(e) {
2405
- return /* @__PURE__ */ On(ui, e);
2406
- }
2407
- var Z = /*@__PURE__*/ d("ZodStringFormat", (e, t) => {
2408
- L.init(e, t), li.init(e, t);
2409
- }), di = /*@__PURE__*/ d("ZodEmail", (e, t) => {
2410
- Tt.init(e, t), Z.init(e, t);
2411
- }), fi = /*@__PURE__*/ d("ZodGUID", (e, t) => {
2412
- Ct.init(e, t), Z.init(e, t);
2413
- }), Q = /*@__PURE__*/ d("ZodUUID", (e, t) => {
2414
- wt.init(e, t), Z.init(e, t);
2415
- }), pi = /*@__PURE__*/ d("ZodURL", (e, t) => {
2416
- Et.init(e, t), Z.init(e, t);
2417
- }), mi = /*@__PURE__*/ d("ZodEmoji", (e, t) => {
2418
- Dt.init(e, t), Z.init(e, t);
2419
- }), hi = /*@__PURE__*/ d("ZodNanoID", (e, t) => {
2420
- Ot.init(e, t), Z.init(e, t);
2421
- }), gi = /*@__PURE__*/ d("ZodCUID", (e, t) => {
2422
- kt.init(e, t), Z.init(e, t);
2423
- }), _i = /*@__PURE__*/ d("ZodCUID2", (e, t) => {
2424
- At.init(e, t), Z.init(e, t);
2425
- }), vi = /*@__PURE__*/ d("ZodULID", (e, t) => {
2426
- jt.init(e, t), Z.init(e, t);
2427
- }), yi = /*@__PURE__*/ d("ZodXID", (e, t) => {
2428
- Mt.init(e, t), Z.init(e, t);
2429
- }), bi = /*@__PURE__*/ d("ZodKSUID", (e, t) => {
2430
- Nt.init(e, t), Z.init(e, t);
2431
- }), xi = /*@__PURE__*/ d("ZodIPv4", (e, t) => {
2432
- Rt.init(e, t), Z.init(e, t);
2433
- }), Si = /*@__PURE__*/ d("ZodIPv6", (e, t) => {
2434
- zt.init(e, t), Z.init(e, t);
2435
- }), Ci = /*@__PURE__*/ d("ZodCIDRv4", (e, t) => {
2436
- Bt.init(e, t), Z.init(e, t);
2437
- }), wi = /*@__PURE__*/ d("ZodCIDRv6", (e, t) => {
2438
- Vt.init(e, t), Z.init(e, t);
2439
- }), Ti = /*@__PURE__*/ d("ZodBase64", (e, t) => {
2440
- Ut.init(e, t), Z.init(e, t);
2441
- }), Ei = /*@__PURE__*/ d("ZodBase64URL", (e, t) => {
2442
- Gt.init(e, t), Z.init(e, t);
2443
- }), Di = /*@__PURE__*/ d("ZodE164", (e, t) => {
2444
- Kt.init(e, t), Z.init(e, t);
2445
- }), Oi = /*@__PURE__*/ d("ZodJWT", (e, t) => {
2446
- Jt.init(e, t), Z.init(e, t);
2447
- }), ki = /*@__PURE__*/ d("ZodUnknown", (e, t) => {
2448
- Yt.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (e, t, n) => void 0;
2449
- });
2450
- function Ai() {
2451
- return /* @__PURE__ */ tr(ki);
2452
- }
2453
- var ji = /*@__PURE__*/ d("ZodNever", (e, t) => {
2454
- Xt.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Er(e, t, n, r);
2455
- });
2456
- function Mi(e) {
2457
- return /* @__PURE__ */ nr(ji, e);
2458
- }
2459
- var Ni = /*@__PURE__*/ d("ZodArray", (e, t) => {
2460
- Qt.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ar(e, t, n, r), e.element = t.element, J(e, "ZodArray", {
2461
- min(e, t) {
2462
- return this.check(/* @__PURE__ */ H(e, t));
2463
- },
2464
- nonempty(e) {
2465
- return this.check(/* @__PURE__ */ H(1, e));
2466
- },
2467
- max(e, t) {
2468
- return this.check(/* @__PURE__ */ rr(e, t));
2469
- },
2470
- length(e, t) {
2471
- return this.check(/* @__PURE__ */ ir(e, t));
2472
- },
2473
- unwrap() {
2474
- return this.element;
2475
- }
2476
- });
2477
- });
2478
- function Pi(e, t) {
2479
- return /* @__PURE__ */ gr(Ni, e, t);
2480
- }
2481
- var Fi = /*@__PURE__*/ d("ZodObject", (e, t) => {
2482
- nn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => jr(e, t, n, r), v(e, "shape", () => t.shape), J(e, "ZodObject", {
2483
- keyof() {
2484
- return Ui(Object.keys(this._zod.def.shape));
2485
- },
2486
- catchall(e) {
2487
- return this.clone({
2488
- ...this._zod.def,
2489
- catchall: e
2490
- });
2491
- },
2492
- passthrough() {
2493
- return this.clone({
2494
- ...this._zod.def,
2495
- catchall: Ai()
2496
- });
2497
- },
2498
- loose() {
2499
- return this.clone({
2500
- ...this._zod.def,
2501
- catchall: Ai()
2502
- });
2503
- },
2504
- strict() {
2505
- return this.clone({
2506
- ...this._zod.def,
2507
- catchall: Mi()
2508
- });
2509
- },
2510
- strip() {
2511
- return this.clone({
2512
- ...this._zod.def,
2513
- catchall: void 0
2514
- });
2515
- },
2516
- extend(e) {
2517
- return pe(this, e);
2518
- },
2519
- safeExtend(e) {
2520
- return me(this, e);
2521
- },
2522
- merge(e) {
2523
- return he(this, e);
2524
- },
2525
- pick(e) {
2526
- return de(this, e);
2527
- },
2528
- omit(e) {
2529
- return fe(this, e);
2530
- },
2531
- partial(...e) {
2532
- return ge(Ki, this, e[0]);
2533
- },
2534
- required(...e) {
2535
- return _e(na, this, e[0]);
2536
- }
2537
- });
2538
- });
2539
- function Ii(e, t) {
2540
- return new Fi({
2541
- type: "object",
2542
- shape: e ?? {},
2543
- ...T(t)
2544
- });
2545
- }
2546
- function Li(e, t) {
2547
- return new Fi({
2548
- type: "object",
2549
- shape: e,
2550
- catchall: Mi(),
2551
- ...T(t)
2552
- });
2553
- }
2554
- var Ri = /*@__PURE__*/ d("ZodUnion", (e, t) => {
2555
- an.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Mr(e, t, n, r), e.options = t.options;
2556
- });
2557
- function zi(e, t) {
2558
- return new Ri({
2559
- type: "union",
2560
- options: e,
2561
- ...T(t)
2562
- });
2563
- }
2564
- var Bi = /*@__PURE__*/ d("ZodIntersection", (e, t) => {
2565
- on.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Nr(e, t, n, r);
2566
- });
2567
- function Vi(e, t) {
2568
- return new Bi({
2569
- type: "intersection",
2570
- left: e,
2571
- right: t
2572
- });
2573
- }
2574
- var Hi = /*@__PURE__*/ d("ZodEnum", (e, t) => {
2575
- cn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Dr(e, t, n, r), e.enum = t.entries, e.options = Object.values(t.entries);
2576
- let n = new Set(Object.keys(t.entries));
2577
- e.extract = (e, r) => {
2578
- let i = {};
2579
- for (let r of e) if (n.has(r)) i[r] = t.entries[r];
2580
- else throw Error(`Key ${r} not found in enum`);
2581
- return new Hi({
2582
- ...t,
2583
- checks: [],
2584
- ...T(r),
2585
- entries: i
2586
- });
2587
- }, e.exclude = (e, r) => {
2588
- let i = { ...t.entries };
2589
- for (let t of e) if (n.has(t)) delete i[t];
2590
- else throw Error(`Key ${t} not found in enum`);
2591
- return new Hi({
2592
- ...t,
2593
- checks: [],
2594
- ...T(r),
2595
- entries: i
2596
- });
2597
- };
2598
- });
2599
- function Ui(e, t) {
2600
- return new Hi({
2601
- type: "enum",
2602
- entries: Array.isArray(e) ? Object.fromEntries(e.map((e) => [e, e])) : e,
2603
- ...T(t)
2604
- });
2605
- }
2606
- var Wi = /*@__PURE__*/ d("ZodTransform", (e, t) => {
2607
- ln.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => kr(e, t, n, r), e._zod.parse = (n, r) => {
2608
- if (r.direction === "backward") throw new p(e.constructor.name);
2609
- n.addIssue = (r) => {
2610
- if (typeof r == "string") n.issues.push(A(r, n.value, t));
2611
- else {
2612
- let t = r;
2613
- t.fatal && (t.continue = !1), t.code ??= "custom", t.input ??= n.value, t.inst ??= e, n.issues.push(A(t));
2614
- }
2615
- };
2616
- let i = t.transform(n.value, n);
2617
- return i instanceof Promise ? i.then((e) => (n.value = e, n.fallback = !0, n)) : (n.value = i, n.fallback = !0, n);
2618
- };
2619
- });
2620
- function Gi(e) {
2621
- return new Wi({
2622
- type: "transform",
2623
- transform: e
2624
- });
2625
- }
2626
- var Ki = /*@__PURE__*/ d("ZodOptional", (e, t) => {
2627
- dn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Vr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2628
- });
2629
- function qi(e) {
2630
- return new Ki({
2631
- type: "optional",
2632
- innerType: e
2633
- });
2634
- }
2635
- var Ji = /*@__PURE__*/ d("ZodExactOptional", (e, t) => {
2636
- fn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Vr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2637
- });
2638
- function Yi(e) {
2639
- return new Ji({
2640
- type: "optional",
2641
- innerType: e
2642
- });
2643
- }
2644
- var Xi = /*@__PURE__*/ d("ZodNullable", (e, t) => {
2645
- pn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Pr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2646
- });
2647
- function Zi(e) {
2648
- return new Xi({
2649
- type: "nullable",
2650
- innerType: e
2651
- });
2652
- }
2653
- var Qi = /*@__PURE__*/ d("ZodDefault", (e, t) => {
2654
- mn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Ir(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
2655
- });
2656
- function $i(e, t) {
2657
- return new Qi({
2658
- type: "default",
2659
- innerType: e,
2660
- get defaultValue() {
2661
- return typeof t == "function" ? t() : ce(t);
2662
- }
2663
- });
2664
- }
2665
- var ea = /*@__PURE__*/ d("ZodPrefault", (e, t) => {
2666
- gn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Lr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2667
- });
2668
- function ta(e, t) {
2669
- return new ea({
2670
- type: "prefault",
2671
- innerType: e,
2672
- get defaultValue() {
2673
- return typeof t == "function" ? t() : ce(t);
2674
- }
2675
- });
2676
- }
2677
- var na = /*@__PURE__*/ d("ZodNonOptional", (e, t) => {
2678
- _n.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Fr(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2679
- });
2680
- function ra(e, t) {
2681
- return new na({
2682
- type: "nonoptional",
2683
- innerType: e,
2684
- ...T(t)
2685
- });
2686
- }
2687
- var ia = /*@__PURE__*/ d("ZodCatch", (e, t) => {
2688
- yn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Rr(e, t, n, r), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
2689
- });
2690
- function aa(e, t) {
2691
- return new ia({
2692
- type: "catch",
2693
- innerType: e,
2694
- catchValue: typeof t == "function" ? t : () => t
2695
- });
2696
- }
2697
- var oa = /*@__PURE__*/ d("ZodPipe", (e, t) => {
2698
- bn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => zr(e, t, n, r), e.in = t.in, e.out = t.out;
2699
- });
2700
- function sa(e, t) {
2701
- return new oa({
2702
- type: "pipe",
2703
- in: e,
2704
- out: t
2705
- });
2706
- }
2707
- var ca = /*@__PURE__*/ d("ZodReadonly", (e, t) => {
2708
- xn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Br(e, t, n, r), e.unwrap = () => e._zod.def.innerType;
2709
- });
2710
- function la(e) {
2711
- return new ca({
2712
- type: "readonly",
2713
- innerType: e
2714
- });
2715
- }
2716
- var ua = /*@__PURE__*/ d("ZodCustom", (e, t) => {
2717
- Cn.init(e, t), Y.init(e, t), e._zod.processJSONSchema = (t, n, r) => Or(e, t, n, r);
2718
- });
2719
- function da(e, t = {}) {
2720
- return /* @__PURE__ */ _r(ua, e, t);
2721
- }
2722
- function fa(e, t) {
2723
- return /* @__PURE__ */ vr(e, t);
2724
- }
2725
- //#endregion
2726
- //#region packages/cli/src/config/errors.ts
2727
- var pa = { CLI_CONFIG_INVALID: "MAKOO_CLI_CONFIG_INVALID" }, ma = Li({
2728
- name: X().min(1, "app.name is required"),
2729
- version: X().min(1, "app.version is required"),
2730
- description: X().optional()
2731
- }), ha = Ii({}).loose(), ga = Li({
2732
- entry: X().min(1, "entry is required"),
2733
- app: ma,
2734
- monkey: ha
2735
- });
2736
- function _a(e) {
2737
- let t = ga.safeParse(e);
2738
- if (!t.success) throw va(t.error);
2739
- }
2740
- function va(e) {
2741
- let t = e.issues.map((e) => `${e.path.map(String).join(".") || "(root)"}: ${e.message}`);
2742
- return new o(t.join("\n"), {
2743
- code: pa.CLI_CONFIG_INVALID,
2744
- cause: e
2745
- });
2746
- }
2747
- //#endregion
1
+ import { t as e } from "./version-DiRsgSMp.js";
2
+ import { t } from "./protocol-ZRHs80xs.js";
3
+ import n, { cdn as r } from "vite-plugin-monkey";
4
+ import { isAbsolute as i, join as a, normalize as o, resolve as s } from "node:path";
5
+ import c from "node:process";
6
+ import { createRequire as l } from "node:module";
7
+ import { isIP as u } from "node:net";
8
+ import { randomBytes as d } from "node:crypto";
9
+ import { defineMakooErrors as f } from "@makoojs/core";
2748
10
  //#region packages/cli/src/config/resolve.ts
2749
- var ya = (e, t) => n(t) ? r(t) : r(i(e, t)), ba = (e) => r(e ? i(e) : a.cwd()), xa = (e) => typeof e == "string" ? { "": e } : e, Sa = (e) => ({
11
+ var p = {
12
+ open: c.platform === "win32" || c.platform === "darwin",
13
+ prefix: (e) => `server:${e}`,
14
+ mountGmApi: !1
15
+ }, m = {
16
+ metaFileName: !1,
17
+ autoGrant: !0
18
+ }, h = {
19
+ align: 2,
20
+ styleImport: !0
21
+ }, g = ".user.js", _ = (e, t) => i(t) ? o(t) : o(s(e, t)), v = (e) => o(e ? s(e) : c.cwd()), y = (e) => typeof e == "string" ? { "": e } : e, b = (e) => ({
2750
22
  ...e,
2751
- name: xa(e.name),
2752
- description: xa(e.description)
2753
- }), Ca = (e, t) => t === !1 || t === void 0 ? !1 : t === !0 ? e.replace(/\.user\.js$/, ".meta.js") : typeof t == "function" ? t(e) : t, wa = (e) => ({
2754
- name: e.name,
2755
- version: e.version,
2756
- description: e.description
2757
- }), Ta = (e) => ({
2758
- open: e.server?.open ?? s.open,
2759
- prefix: e.server?.prefix ?? s.prefix,
2760
- mountGmApi: s.mountGmApi
2761
- }), Ea = (e, t) => {
2762
- let n = t.build?.fileName ?? `${e.name}.user.js`;
23
+ name: y(e.name),
24
+ description: y(e.description)
25
+ }), x = (e, t) => t === !1 || t === void 0 ? !1 : t === !0 ? e.replace(/\.user\.js$/, ".meta.js") : typeof t == "function" ? t(e) : t, S = (e) => ({
26
+ open: e.server?.open ?? p.open,
27
+ prefix: e.server?.prefix ?? p.prefix,
28
+ mountGmApi: p.mountGmApi
29
+ }), C = (e, t) => {
30
+ let n = t.build?.fileName ?? `${e.name}${g}`;
2763
31
  return {
2764
32
  fileName: n,
2765
- metaFileName: Ca(n, t.build?.metaFileName ?? c.metaFileName),
33
+ metaFileName: x(n, t.build?.metaFileName ?? m.metaFileName),
2766
34
  externalGlobals: t.build?.externalGlobals,
2767
- autoGrant: t.build?.autoGrant ?? c.autoGrant,
35
+ autoGrant: t.build?.autoGrant ?? m.autoGrant,
2768
36
  externalResource: t.build?.externalResource,
2769
37
  systemjs: t.build?.systemjs,
2770
38
  cssSideEffects: t.build?.cssSideEffects
2771
39
  };
2772
- }, Da = (e, t) => {
40
+ }, w = (e, t) => {
2773
41
  let { userscript: n, align: r, styleImport: i, server: a, build: o, ...s } = t;
2774
42
  return {
2775
43
  ...s,
@@ -2779,215 +47,229 @@ var ya = (e, t) => n(t) ? r(t) : r(i(e, t)), ba = (e) => r(e ? i(e) : a.cwd()),
2779
47
  version: e.version,
2780
48
  description: e.description
2781
49
  },
2782
- align: r ?? l.align,
2783
- styleImport: i ?? l.styleImport,
2784
- server: Ta(t),
2785
- build: Ea(e, t)
50
+ align: r ?? h.align,
51
+ styleImport: i ?? h.styleImport,
52
+ server: S(t),
53
+ build: C(e, t)
2786
54
  };
2787
- }, Oa = (e, t) => {
2788
- _a(e);
2789
- let n = ba(t), r = wa(e.app);
55
+ }, T = (e, t) => {
56
+ let n = v(t);
2790
57
  return {
2791
58
  root: n,
2792
- entry: ya(n, e.entry),
2793
- app: r,
2794
- monkey: Da(r, e.monkey)
59
+ entry: _(n, e.entry),
60
+ app: e.app,
61
+ monkey: w(e.app, e.monkey)
2795
62
  };
2796
- }, ka = (e) => ({
63
+ }, E = (e) => ({
2797
64
  ...e.monkey,
2798
65
  entry: e.entry,
2799
- userscript: Sa(e.monkey.userscript),
66
+ userscript: b(e.monkey.userscript),
2800
67
  server: { ...e.monkey.server },
2801
68
  build: { ...e.monkey.build }
2802
69
  });
2803
70
  //#endregion
2804
71
  //#region packages/cli/src/vite/makoo.ts
2805
- function Aa(t) {
2806
- let { root: n, ...r } = t, i = ka(Oa(r, n));
2807
- return e(i);
72
+ function D(e) {
73
+ let { root: t, ...r } = e, i = E(T(r, t));
74
+ return n(i);
2808
75
  }
2809
76
  //#endregion
2810
- //#region packages/cli/src/session/DevSession.ts
2811
- var ja = 5, Ma = class {
2812
- clients = /* @__PURE__ */ new Map();
2813
- nextClientId = 1;
77
+ //#region packages/cli/src/bridge/server.ts
78
+ var O = d(16).toString("hex");
79
+ async function k(n, r) {
80
+ let { createDevServer: i } = await import("devframe/adapters/dev"), { defineDevframe: a, defineRpcFunction: o } = await import("devframe"), { createInteractiveAuth: s } = await import("devframe/recipes/interactive-auth"), c = await e(), l, u = o({
81
+ name: t,
82
+ type: "action",
83
+ handler: (e) => {
84
+ let t = l?.rpc.getCurrentRpcSession()?.meta?.id;
85
+ t !== void 0 && n.replacePage(t, e);
86
+ }
87
+ }), d = await i(a({
88
+ id: "makoo",
89
+ name: "Makoo",
90
+ version: c,
91
+ packageName: "@makoojs/cli",
92
+ homepage: "https://github.com/makoojs/Makoo",
93
+ description: "Makoo userscript development bridge",
94
+ importMetaUrl: import.meta.url ?? (typeof __filename < "u" ? __filename : void 0),
95
+ setup(e) {
96
+ l = e, e.rpc.register(u);
97
+ }
98
+ }), {
99
+ host: r.host,
100
+ port: r.port,
101
+ auth: ((e) => s(e, {
102
+ clientAuthTokens: [O],
103
+ banner: () => {}
104
+ })),
105
+ allowedOrigins: !1,
106
+ sse: !1,
107
+ mcp: !1,
108
+ onPeerDisconnect: (e, t) => {
109
+ n.disconnect(t.id);
110
+ }
111
+ });
112
+ return {
113
+ endpoint: {
114
+ host: r.host,
115
+ port: r.port,
116
+ token: O
117
+ },
118
+ close: () => d.close()
119
+ };
120
+ }
121
+ //#endregion
122
+ //#region packages/cli/src/bridge/store.ts
123
+ var A = class {
124
+ pages = /* @__PURE__ */ new Map();
2814
125
  onChange = null;
126
+ replacePage(e, t) {
127
+ this.pages.set(e, t), this.onChange?.();
128
+ }
129
+ disconnect(e) {
130
+ this.pages.delete(e) && this.onChange?.();
131
+ }
2815
132
  subscribe(e) {
2816
133
  return this.onChange = e, () => {
2817
134
  this.onChange === e && (this.onChange = null);
2818
135
  };
2819
136
  }
2820
- open(e, t) {
2821
- let n = this.clients.get(e);
2822
- n || (n = {
2823
- clientId: this.nextClientId,
2824
- runtimes: /* @__PURE__ */ new Map()
2825
- }, this.nextClientId += 1, this.clients.set(e, n)), n.runtimes.set(t.runtimeId, {
2826
- injections: /* @__PURE__ */ new Map(),
2827
- diagnostics: []
2828
- }), this.onChange?.();
2829
- }
2830
- updateInjection(e, t) {
2831
- let n = this.clients.get(e)?.runtimes.get(t.runtimeId);
2832
- n && (n.injections.set(t.injection.name, t.injection), this.onChange?.());
2833
- }
2834
- applyNotice(e, t) {
2835
- let n = this.clients.get(e)?.runtimes, r = n?.get(t.runtimeId);
2836
- if (!n || !r) return;
2837
- let { notice: i } = t;
2838
- switch (i.type) {
2839
- case "injection-removed":
2840
- r.injections.delete(i.name);
2841
- break;
2842
- case "diagnostic":
2843
- r.diagnostics.push(i), r.diagnostics.length > ja && r.diagnostics.shift();
2844
- break;
2845
- case "instance-disposed": n.delete(t.runtimeId);
2846
- }
2847
- this.onChange?.();
2848
- }
2849
- disconnect(e) {
2850
- this.clients.get(e) && (this.clients.delete(e), this.onChange?.());
2851
- }
2852
- isEmpty() {
2853
- return this.clients.size === 0;
2854
- }
2855
137
  getRuntimeSnapshots() {
2856
- return [...this.clients.values()].flatMap((e) => [...e.runtimes.entries()].map(([t, n]) => ({
2857
- clientId: e.clientId,
2858
- runtimeId: t,
2859
- injections: [...n.injections.values()],
2860
- diagnostics: [...n.diagnostics]
138
+ return [...this.pages.entries()].flatMap(([e, t]) => t.map((t) => ({
139
+ clientId: e,
140
+ ...t
2861
141
  })));
2862
142
  }
2863
- }, Na = "\0virtual:makoo-dev", Pa = "@makoojs/core", $ = {
2864
- open: "makoo:runtime:open",
2865
- injection: "makoo:runtime:injection",
2866
- notice: "makoo:runtime:notice"
2867
- }, Fa = Symbol("makooDev.bindSession");
2868
- function Ia(e) {
2869
- let t = JSON.stringify(e);
2870
- return `
2871
- export * from ${t};
2872
- import { createMakoo as __makooCreateMakoo } from ${t};
2873
-
2874
- function __makooSend(event, payload) {
2875
- try {
2876
- import.meta.hot?.send(event, payload);
2877
- } catch {
2878
- // Session transport failures must not affect the user runtime.
2879
- }
2880
- }
2881
-
2882
- function __makooSerializeError(error) {
2883
- const serialized = { code: error.code, message: error.message };
2884
- if (error.cause !== undefined) {
2885
- serialized.cause = error.cause instanceof Error ? error.cause.message : String(error.cause);
2886
- }
2887
- return serialized;
2888
- }
2889
-
2890
- function __makooSnapshotInjection(declaration, statusHandle) {
2891
- const isComponent = declaration.kind === 'component';
2892
- const snapshot = {
2893
- name: declaration.name,
2894
- kind: isComponent ? 'component' : 'standalone-listener',
2895
- status: statusHandle.getSnapshot()
143
+ }, j = f({
144
+ MAKOO_DEV_HOST_INVALID: {
145
+ category: "configuration",
146
+ message: (e) => `makooDev: invalid host ${JSON.stringify(e.host)}; expected an IPv4/IPv6 literal or 'localhost'.`
147
+ },
148
+ MAKOO_DEV_PORT_INVALID: {
149
+ category: "configuration",
150
+ message: (e) => `makooDev: invalid port ${String(e.port)}; expected an integer between 1 and 65535.`
151
+ }
152
+ }), M = "\0virtual:makoo-dev", N = "@makoojs/core", P = "devframe/client", F = "makoo:dev", I = /* @__PURE__ */ new WeakSet();
153
+ function L(e) {
154
+ let t = e.port ?? 9999, n = e.host ?? "127.0.0.1";
155
+ if (!Number.isInteger(t) || t < 1 || t > 65535) throw j.createThrowable("MAKOO_DEV_PORT_INVALID", { details: { port: e.port } });
156
+ if (n !== "localhost" && u(n) === 0) throw j.createThrowable("MAKOO_DEV_HOST_INVALID", { details: { host: e.host } });
157
+ return {
158
+ host: n,
159
+ port: t
2896
160
  };
2897
- if (statusHandle.lastError) snapshot.lastError = __makooSerializeError(statusHandle.lastError);
2898
- if (isComponent) {
2899
- snapshot.attachedListeners = statusHandle.attachedListenerNames.map((listenerName) => ({
2900
- name: listenerName,
2901
- status: statusHandle.attachedListener(listenerName).getSnapshot()
2902
- }));
2903
- }
2904
- return snapshot;
2905
161
  }
2906
-
2907
- function __makooSerializeNotice(notice) {
2908
- if (notice.type !== 'diagnostic') return notice;
2909
- return { ...notice, error: __makooSerializeError(notice.error) };
162
+ function R(e) {
163
+ return e === "localhost" || e === "::1" || e.startsWith("127.");
2910
164
  }
2911
-
2912
- function __makooWatchInjection(runtime, runtimeId, declaration) {
2913
- let statusHandle;
2914
- try {
2915
- statusHandle = runtime.statusHandle(declaration.name);
2916
- } catch {
2917
- // An earlier mount in the same batch already removed this injection.
2918
- return;
2919
- }
2920
- const push = () => {
2921
- __makooSend('${$.injection}', {
2922
- runtimeId,
2923
- injection: __makooSnapshotInjection(declaration, statusHandle)
2924
- });
2925
- };
2926
- push();
2927
- statusHandle.subscribe(push);
2928
- if (declaration.kind === 'component') {
2929
- for (const listenerName of statusHandle.attachedListenerNames) {
2930
- statusHandle.attachedListener(listenerName).subscribe(push);
2931
- }
2932
- }
165
+ function z(e) {
166
+ return `export * from ${JSON.stringify(e)};`;
2933
167
  }
2934
-
2935
- let __makooNextRuntimeId = 1;
2936
-
2937
- export function createMakoo() {
2938
- const runtime = __makooCreateMakoo();
2939
- const runtimeId = __makooNextRuntimeId++;
2940
- __makooSend('${$.open}', { runtimeId });
2941
- runtime.observe((notice) => {
2942
- __makooSend('${$.notice}', { runtimeId, notice: __makooSerializeNotice(notice) });
2943
- });
2944
- return {
2945
- ...runtime,
2946
- apply(declarations) {
2947
- runtime.apply(declarations);
2948
- for (const declaration of declarations) {
2949
- __makooWatchInjection(runtime, runtimeId, declaration);
2950
- }
168
+ function B(e, t, n) {
169
+ let r = JSON.stringify(e);
170
+ return [
171
+ `export * from ${r};`,
172
+ `import { createMakoo as __makooBaseCreateMakoo } from ${r};`,
173
+ `import { instrument as __makooInstrument } from ${JSON.stringify(t)};`,
174
+ `export const createMakoo = __makooInstrument(__makooBaseCreateMakoo, ${JSON.stringify(n)});`
175
+ ].join("\n");
176
+ }
177
+ function V(e) {
178
+ let { address: t, startBridge: n, createTerminal: r } = e, i = new A(), a = /* @__PURE__ */ new Map(), o = null, s, c = !1, l, u, d = () => {
179
+ if (u === void 0) try {
180
+ u = e.resolveDevframeClient();
181
+ } catch {
182
+ u = null;
2951
183
  }
2952
- };
2953
- }
2954
- `;
2955
- }
2956
- function La() {
2957
- let e = null, t = new Ma();
2958
- return {
2959
- name: "makoo:dev",
184
+ return u;
185
+ }, f = async (e) => {
186
+ try {
187
+ s = n(i, t), await s;
188
+ } catch (n) {
189
+ s = void 0;
190
+ let r = n?.code, i = e.config.logger;
191
+ r === "EADDRINUSE" || r === "DF0052" ? i.warn(`[makoo] port ${t.port} on ${t.host} is already in use; the makooDev bridge was not started. Configure another port with makooDev({ port }).`) : i.warn(`[makoo] the makooDev bridge failed to start (${n instanceof Error ? n.message : String(n)}); continuing without it.`);
192
+ return;
193
+ }
194
+ R(t.host) || e.config.logger.warn(`[makoo] the makooDev bridge is listening on ${t.host}:${t.port}, reachable beyond this machine; access is protected by token only.`);
195
+ }, p = (e, t) => {
196
+ let n = a.get(e);
197
+ n === void 0 && (n = Promise.resolve().then(() => r(e, i)), a.set(e, n)), n.then(t).catch((t) => {
198
+ e.config.logger.warn(`[makoo] the dev terminal failed (${t instanceof Error ? t.message : String(t)})`);
199
+ });
200
+ }, m = {
201
+ name: F,
2960
202
  apply: "serve",
2961
203
  enforce: "pre",
2962
- api: { session: t },
204
+ config() {
205
+ return { optimizeDeps: { exclude: [P] } };
206
+ },
207
+ configResolved(e) {
208
+ let t = e.plugins.findIndex((e) => e.name === F);
209
+ e.plugins.indexOf(m) !== t && (c = !0, e.logger.warn("[makoo] makooDev() is registered more than once; keeping the first instance active."));
210
+ },
2963
211
  async resolveId(t, n, r) {
2964
- if (t !== Pa) return null;
2965
- let i = await this.resolve(Pa, n, {
212
+ if (c) return null;
213
+ if (t === P && n === e.runtimeFile) return d();
214
+ if (t !== N) return null;
215
+ let i = await this.resolve(N, n, {
2966
216
  ...r,
2967
217
  skipSelf: !0
2968
218
  });
2969
- return i ? (e = i.id, Na) : null;
219
+ return i ? (o = i.id, M) : null;
2970
220
  },
2971
- load(t) {
2972
- return t !== Na || !e ? null : Ia(e);
221
+ async load(t) {
222
+ if (c || t !== M || o === null) return null;
223
+ let n = await s?.catch(() => void 0);
224
+ return n === void 0 ? z(o) : e.runtimeFile === void 0 ? (l?.config.logger.warn("[makoo] the page runtime module could not be located; serving @makoojs/core without instrumentation."), z(o)) : d() === null ? (l?.config.logger.warn("[makoo] devframe/client could not be resolved; serving @makoojs/core without instrumentation."), z(o)) : B(o, e.runtimeFile, n.endpoint);
2973
225
  },
2974
226
  configureServer(e) {
2975
- let n = e.config.inlineConfig[Fa];
2976
- n?.(t);
2977
- for (let n of Object.values(e.environments)) {
2978
- let { hot: e } = n;
2979
- e.on($.open, (e, n) => {
2980
- t.open(n, e);
2981
- }), e.on($.injection, (e, n) => {
2982
- t.updateInjection(n, e);
2983
- }), e.on($.notice, (e, n) => {
2984
- t.applyNotice(n, e);
2985
- }), e.on("vite:client:disconnect", (e, n) => {
2986
- t.disconnect(n);
2987
- });
227
+ if (c) return;
228
+ l = e;
229
+ let { httpServer: t } = e;
230
+ if (!t) {
231
+ e.config.logger.warn("[makoo] makooDev does not support middleware mode; the bridge and terminal stay off.");
232
+ return;
2988
233
  }
234
+ let n = e.printUrls, r = e.bindCLIShortcuts, i = () => p(e, (e) => e.showHome()), a = () => {
235
+ I.add(e.config.inlineConfig), p(e, (e) => e.activate());
236
+ };
237
+ e.printUrls = i, e.bindCLIShortcuts = a, t.once("listening", () => {
238
+ if (f(e), e.printUrls !== i || e.bindCLIShortcuts !== a) {
239
+ e.printUrls === i && (e.printUrls = n), e.bindCLIShortcuts === a && (e.bindCLIShortcuts = r), e.config.logger.warn("[makoo] another plugin overrode printUrls/bindCLIShortcuts; the makooDev terminal stays inactive while the bridge keeps running.");
240
+ return;
241
+ }
242
+ I.has(e.config.inlineConfig) && p(e, async (e) => {
243
+ await e.showHome(), e.activate();
244
+ });
245
+ });
246
+ },
247
+ async closeBundle() {
248
+ let e = [...a.values()];
249
+ a.clear();
250
+ let t = s;
251
+ s = void 0;
252
+ for (let t of e) await t.then((e) => e.close(), () => {});
253
+ await t?.then((e) => e.close(), () => {});
2989
254
  }
2990
255
  };
256
+ return m;
257
+ }
258
+ function H(e = {}) {
259
+ let t = import.meta.dirname ?? (typeof __dirname < "u" ? __dirname : void 0);
260
+ return V({
261
+ address: L(e),
262
+ runtimeFile: t === void 0 ? void 0 : a(t, "bridge/runtime.js"),
263
+ startBridge: k,
264
+ resolveDevframeClient: () => {
265
+ if (t === void 0) throw Error("module location unavailable");
266
+ return l(a(t, "index.js")).resolve(P);
267
+ },
268
+ createTerminal: async (e, t) => {
269
+ let { DevTerminal: n } = await import("./DevTerminal-BtHO2wRA.js");
270
+ return new n(e, t);
271
+ }
272
+ });
2991
273
  }
2992
274
  //#endregion
2993
- export { t as cdn, Aa as makoo, La as makooDev };
275
+ export { r as cdn, D as makoo, H as makooDev };