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