@vscode/markdown-editor 0.0.2-86 → 0.0.2-88
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/dist/web-editors.d.ts +4 -1
- package/dist/web-editors.js +835 -839
- package/dist/web-editors.js.map +1 -1
- package/package.json +2 -2
package/dist/web-editors.js
CHANGED
|
@@ -5,34 +5,34 @@ function k(e, t, n) {
|
|
|
5
5
|
if (c._zod || Object.defineProperty(c, "_zod", {
|
|
6
6
|
value: {
|
|
7
7
|
def: a,
|
|
8
|
-
constr:
|
|
8
|
+
constr: s,
|
|
9
9
|
traits: /* @__PURE__ */ new Set()
|
|
10
10
|
},
|
|
11
11
|
enumerable: !1
|
|
12
12
|
}), c._zod.traits.has(e))
|
|
13
13
|
return;
|
|
14
14
|
c._zod.traits.add(e), t(c, a);
|
|
15
|
-
const u =
|
|
15
|
+
const u = s.prototype, d = Object.keys(u);
|
|
16
16
|
for (let l = 0; l < d.length; l++) {
|
|
17
17
|
const f = d[l];
|
|
18
18
|
f in c || (c[f] = u[f].bind(c));
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
const o = n?.Parent ?? Object;
|
|
22
|
-
class
|
|
22
|
+
class i extends o {
|
|
23
23
|
}
|
|
24
|
-
Object.defineProperty(
|
|
25
|
-
function
|
|
24
|
+
Object.defineProperty(i, "name", { value: e });
|
|
25
|
+
function s(c) {
|
|
26
26
|
var a;
|
|
27
|
-
const u = n?.Parent ? new
|
|
27
|
+
const u = n?.Parent ? new i() : this;
|
|
28
28
|
r(u, c), (a = u._zod).deferred ?? (a.deferred = []);
|
|
29
29
|
for (const d of u._zod.deferred)
|
|
30
30
|
d();
|
|
31
31
|
return u;
|
|
32
32
|
}
|
|
33
|
-
return Object.defineProperty(
|
|
33
|
+
return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
34
34
|
value: (c) => n?.Parent && c instanceof n.Parent ? !0 : c?._zod?.traits?.has(e)
|
|
35
|
-
}), Object.defineProperty(
|
|
35
|
+
}), Object.defineProperty(s, "name", { value: e }), s;
|
|
36
36
|
}
|
|
37
37
|
let Ze = class extends Error {
|
|
38
38
|
constructor() {
|
|
@@ -51,7 +51,7 @@ function Dn(e) {
|
|
|
51
51
|
function Wr(e, t) {
|
|
52
52
|
return typeof t == "bigint" ? t.toString() : t;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function Br(e) {
|
|
55
55
|
return {
|
|
56
56
|
get value() {
|
|
57
57
|
{
|
|
@@ -87,7 +87,7 @@ const Ln = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
|
87
87
|
function mt(e) {
|
|
88
88
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function Kr(e) {
|
|
91
91
|
if (mt(e) === !1)
|
|
92
92
|
return !1;
|
|
93
93
|
const t = e.constructor;
|
|
@@ -153,8 +153,8 @@ function xe(e) {
|
|
|
153
153
|
return typeof e == "string" ? e : e?.message;
|
|
154
154
|
}
|
|
155
155
|
function fe(e, t, n) {
|
|
156
|
-
const r = e.message ? e.message : xe(e.inst?._zod.def?.error?.(e)) ?? xe(t?.error?.(e)) ?? xe(n.customError?.(e)) ?? xe(n.localeError?.(e)) ?? "Invalid input", { inst: o, continue:
|
|
157
|
-
return c.path ?? (c.path = []), c.message = r, t?.reportInput && (c.input =
|
|
156
|
+
const r = e.message ? e.message : xe(e.inst?._zod.def?.error?.(e)) ?? xe(t?.error?.(e)) ?? xe(n.customError?.(e)) ?? xe(n.localeError?.(e)) ?? "Invalid input", { inst: o, continue: i, input: s, ...c } = e;
|
|
157
|
+
return c.path ?? (c.path = []), c.message = r, t?.reportInput && (c.input = s), c;
|
|
158
158
|
}
|
|
159
159
|
const Un = (e, t) => {
|
|
160
160
|
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
@@ -168,37 +168,37 @@ const Un = (e, t) => {
|
|
|
168
168
|
enumerable: !1
|
|
169
169
|
});
|
|
170
170
|
}, to = k("$ZodError", Un), Qe = k("$ZodError", Un, { Parent: Error }), no = (e) => (t, n, r, o) => {
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
171
|
+
const i = r ? { ...r, async: !1 } : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
|
|
172
|
+
if (s instanceof Promise)
|
|
173
173
|
throw new Ze();
|
|
174
|
-
if (
|
|
175
|
-
const c = new (o?.Err ?? e)(
|
|
174
|
+
if (s.issues.length) {
|
|
175
|
+
const c = new (o?.Err ?? e)(s.issues.map((a) => fe(a, i, le())));
|
|
176
176
|
throw Ln(c, o?.callee), c;
|
|
177
177
|
}
|
|
178
|
-
return
|
|
178
|
+
return s.value;
|
|
179
179
|
}, ro = /* @__PURE__ */ no(Qe), oo = (e) => async (t, n, r, o) => {
|
|
180
|
-
const
|
|
181
|
-
let
|
|
182
|
-
if (
|
|
183
|
-
const c = new (o?.Err ?? e)(
|
|
180
|
+
const i = r ? { ...r, async: !0 } : { async: !0 };
|
|
181
|
+
let s = t._zod.run({ value: n, issues: [] }, i);
|
|
182
|
+
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
183
|
+
const c = new (o?.Err ?? e)(s.issues.map((a) => fe(a, i, le())));
|
|
184
184
|
throw Ln(c, o?.callee), c;
|
|
185
185
|
}
|
|
186
|
-
return
|
|
186
|
+
return s.value;
|
|
187
187
|
}, io = /* @__PURE__ */ oo(Qe), so = (e) => (t, n, r) => {
|
|
188
|
-
const o = r ? { ...r, async: !1 } : { async: !1 },
|
|
189
|
-
if (
|
|
188
|
+
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
189
|
+
if (i instanceof Promise)
|
|
190
190
|
throw new Ze();
|
|
191
|
-
return
|
|
191
|
+
return i.issues.length ? {
|
|
192
192
|
success: !1,
|
|
193
|
-
error: new (e ?? to)(
|
|
194
|
-
} : { success: !0, data:
|
|
193
|
+
error: new (e ?? to)(i.issues.map((s) => fe(s, o, le())))
|
|
194
|
+
} : { success: !0, data: i.value };
|
|
195
195
|
}, Y = /* @__PURE__ */ so(Qe), co = (e) => async (t, n, r) => {
|
|
196
196
|
const o = r ? { ...r, async: !0 } : { async: !0 };
|
|
197
|
-
let
|
|
198
|
-
return
|
|
197
|
+
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
198
|
+
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
199
199
|
success: !1,
|
|
200
|
-
error: new e(
|
|
201
|
-
} : { success: !0, data:
|
|
200
|
+
error: new e(i.issues.map((s) => fe(s, o, le())))
|
|
201
|
+
} : { success: !0, data: i.value };
|
|
202
202
|
}, Jn = /* @__PURE__ */ co(Qe), ao = (e) => {
|
|
203
203
|
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
204
204
|
return new RegExp(`^${t}$`);
|
|
@@ -213,8 +213,8 @@ const Un = (e, t) => {
|
|
|
213
213
|
Hn.init(e, t);
|
|
214
214
|
const n = fo[typeof t.value];
|
|
215
215
|
e._zod.onattach.push((r) => {
|
|
216
|
-
const o = r._zod.bag,
|
|
217
|
-
t.value >
|
|
216
|
+
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
217
|
+
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
218
218
|
}), e._zod.check = (r) => {
|
|
219
219
|
(t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
|
|
220
220
|
origin: n,
|
|
@@ -228,15 +228,15 @@ const Un = (e, t) => {
|
|
|
228
228
|
};
|
|
229
229
|
}), ho = /* @__PURE__ */ k("$ZodCheckNumberFormat", (e, t) => {
|
|
230
230
|
Hn.init(e, t), t.format = t.format || "float64";
|
|
231
|
-
const n = t.format?.includes("int"), r = n ? "int" : "number", [o,
|
|
232
|
-
e._zod.onattach.push((
|
|
233
|
-
const c =
|
|
234
|
-
c.format = t.format, c.minimum = o, c.maximum =
|
|
235
|
-
}), e._zod.check = (
|
|
236
|
-
const c =
|
|
231
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = Qr[t.format];
|
|
232
|
+
e._zod.onattach.push((s) => {
|
|
233
|
+
const c = s._zod.bag;
|
|
234
|
+
c.format = t.format, c.minimum = o, c.maximum = i, n && (c.pattern = uo);
|
|
235
|
+
}), e._zod.check = (s) => {
|
|
236
|
+
const c = s.value;
|
|
237
237
|
if (n) {
|
|
238
238
|
if (!Number.isInteger(c)) {
|
|
239
|
-
|
|
239
|
+
s.issues.push({
|
|
240
240
|
expected: r,
|
|
241
241
|
format: t.format,
|
|
242
242
|
code: "invalid_type",
|
|
@@ -247,7 +247,7 @@ const Un = (e, t) => {
|
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
if (!Number.isSafeInteger(c)) {
|
|
250
|
-
c > 0 ?
|
|
250
|
+
c > 0 ? s.issues.push({
|
|
251
251
|
input: c,
|
|
252
252
|
code: "too_big",
|
|
253
253
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
@@ -256,7 +256,7 @@ const Un = (e, t) => {
|
|
|
256
256
|
origin: r,
|
|
257
257
|
inclusive: !0,
|
|
258
258
|
continue: !t.abort
|
|
259
|
-
}) :
|
|
259
|
+
}) : s.issues.push({
|
|
260
260
|
input: c,
|
|
261
261
|
code: "too_small",
|
|
262
262
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
@@ -269,7 +269,7 @@ const Un = (e, t) => {
|
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
c < o &&
|
|
272
|
+
c < o && s.issues.push({
|
|
273
273
|
origin: "number",
|
|
274
274
|
input: c,
|
|
275
275
|
code: "too_small",
|
|
@@ -277,11 +277,11 @@ const Un = (e, t) => {
|
|
|
277
277
|
inclusive: !0,
|
|
278
278
|
inst: e,
|
|
279
279
|
continue: !t.abort
|
|
280
|
-
}), c >
|
|
280
|
+
}), c > i && s.issues.push({
|
|
281
281
|
origin: "number",
|
|
282
282
|
input: c,
|
|
283
283
|
code: "too_big",
|
|
284
|
-
maximum:
|
|
284
|
+
maximum: i,
|
|
285
285
|
inclusive: !0,
|
|
286
286
|
inst: e,
|
|
287
287
|
continue: !t.abort
|
|
@@ -297,38 +297,38 @@ const Un = (e, t) => {
|
|
|
297
297
|
const r = [...e._zod.def.checks ?? []];
|
|
298
298
|
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
299
299
|
for (const o of r)
|
|
300
|
-
for (const
|
|
301
|
-
|
|
300
|
+
for (const i of o._zod.onattach)
|
|
301
|
+
i(e);
|
|
302
302
|
if (r.length === 0)
|
|
303
303
|
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
304
304
|
e._zod.run = e._zod.parse;
|
|
305
305
|
});
|
|
306
306
|
else {
|
|
307
|
-
const o = (
|
|
308
|
-
let u = Oe(
|
|
307
|
+
const o = (s, c, a) => {
|
|
308
|
+
let u = Oe(s), d;
|
|
309
309
|
for (const l of c) {
|
|
310
310
|
if (l._zod.def.when) {
|
|
311
|
-
if (eo(
|
|
311
|
+
if (eo(s) || !l._zod.def.when(s))
|
|
312
312
|
continue;
|
|
313
313
|
} else if (u)
|
|
314
314
|
continue;
|
|
315
|
-
const f =
|
|
315
|
+
const f = s.issues.length, p = l._zod.check(s);
|
|
316
316
|
if (p instanceof Promise && a?.async === !1)
|
|
317
317
|
throw new Ze();
|
|
318
318
|
if (d || p instanceof Promise)
|
|
319
319
|
d = (d ?? Promise.resolve()).then(async () => {
|
|
320
|
-
await p,
|
|
320
|
+
await p, s.issues.length !== f && (u || (u = Oe(s, f)));
|
|
321
321
|
});
|
|
322
322
|
else {
|
|
323
|
-
if (
|
|
323
|
+
if (s.issues.length === f)
|
|
324
324
|
continue;
|
|
325
|
-
u || (u = Oe(
|
|
325
|
+
u || (u = Oe(s, f));
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
return d ? d.then(() =>
|
|
329
|
-
},
|
|
330
|
-
if (Oe(
|
|
331
|
-
return
|
|
328
|
+
return d ? d.then(() => s) : s;
|
|
329
|
+
}, i = (s, c, a) => {
|
|
330
|
+
if (Oe(s))
|
|
331
|
+
return s.aborted = !0, s;
|
|
332
332
|
const u = o(c, r, a);
|
|
333
333
|
if (u instanceof Promise) {
|
|
334
334
|
if (a.async === !1)
|
|
@@ -337,14 +337,14 @@ const Un = (e, t) => {
|
|
|
337
337
|
}
|
|
338
338
|
return e._zod.parse(u, a);
|
|
339
339
|
};
|
|
340
|
-
e._zod.run = (
|
|
340
|
+
e._zod.run = (s, c) => {
|
|
341
341
|
if (c.skipChecks)
|
|
342
|
-
return e._zod.parse(
|
|
342
|
+
return e._zod.parse(s, c);
|
|
343
343
|
if (c.direction === "backward") {
|
|
344
|
-
const u = e._zod.parse({ value:
|
|
345
|
-
return u instanceof Promise ? u.then((d) =>
|
|
344
|
+
const u = e._zod.parse({ value: s.value, issues: [] }, { ...c, skipChecks: !0 });
|
|
345
|
+
return u instanceof Promise ? u.then((d) => i(d, s, c)) : i(u, s, c);
|
|
346
346
|
}
|
|
347
|
-
const a = e._zod.parse(
|
|
347
|
+
const a = e._zod.parse(s, c);
|
|
348
348
|
if (a instanceof Promise) {
|
|
349
349
|
if (c.async === !1)
|
|
350
350
|
throw new Ze();
|
|
@@ -356,10 +356,10 @@ const Un = (e, t) => {
|
|
|
356
356
|
ee(e, "~standard", () => ({
|
|
357
357
|
validate: (o) => {
|
|
358
358
|
try {
|
|
359
|
-
const
|
|
360
|
-
return
|
|
359
|
+
const i = Y(e, o);
|
|
360
|
+
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
361
361
|
} catch {
|
|
362
|
-
return Jn(e, o).then((
|
|
362
|
+
return Jn(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
363
363
|
}
|
|
364
364
|
},
|
|
365
365
|
vendor: "zod",
|
|
@@ -389,13 +389,13 @@ const Un = (e, t) => {
|
|
|
389
389
|
const o = n.value;
|
|
390
390
|
if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
|
|
391
391
|
return n;
|
|
392
|
-
const
|
|
392
|
+
const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
|
|
393
393
|
return n.issues.push({
|
|
394
394
|
expected: "number",
|
|
395
395
|
code: "invalid_type",
|
|
396
396
|
input: o,
|
|
397
397
|
inst: e,
|
|
398
|
-
...
|
|
398
|
+
...i ? { received: i } : {}
|
|
399
399
|
}), n;
|
|
400
400
|
};
|
|
401
401
|
}), _o = /* @__PURE__ */ k("$ZodNumberFormat", (e, t) => {
|
|
@@ -442,25 +442,25 @@ const bo = /* @__PURE__ */ k("$ZodArray", (e, t) => {
|
|
|
442
442
|
inst: e
|
|
443
443
|
}), n;
|
|
444
444
|
n.value = Array(o.length);
|
|
445
|
-
const
|
|
446
|
-
for (let
|
|
447
|
-
const c = o[
|
|
445
|
+
const i = [];
|
|
446
|
+
for (let s = 0; s < o.length; s++) {
|
|
447
|
+
const c = o[s], a = t.element._zod.run({
|
|
448
448
|
value: c,
|
|
449
449
|
issues: []
|
|
450
450
|
}, r);
|
|
451
|
-
a instanceof Promise ?
|
|
451
|
+
a instanceof Promise ? i.push(a.then((u) => Jt(u, n, s))) : Jt(a, n, s);
|
|
452
452
|
}
|
|
453
|
-
return
|
|
453
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
454
454
|
};
|
|
455
455
|
});
|
|
456
|
-
function Ve(e, t, n, r, o,
|
|
457
|
-
const
|
|
456
|
+
function Ve(e, t, n, r, o, i) {
|
|
457
|
+
const s = n in r;
|
|
458
458
|
if (e.issues.length) {
|
|
459
|
-
if (o &&
|
|
459
|
+
if (o && i && !s)
|
|
460
460
|
return;
|
|
461
461
|
t.issues.push(...ge(n, e.issues));
|
|
462
462
|
}
|
|
463
|
-
if (!
|
|
463
|
+
if (!s && !o) {
|
|
464
464
|
e.issues.length || t.issues.push({
|
|
465
465
|
code: "invalid_type",
|
|
466
466
|
expected: "nonoptional",
|
|
@@ -469,7 +469,7 @@ function Ve(e, t, n, r, o, s) {
|
|
|
469
469
|
});
|
|
470
470
|
return;
|
|
471
471
|
}
|
|
472
|
-
e.value === void 0 ?
|
|
472
|
+
e.value === void 0 ? s && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
473
473
|
}
|
|
474
474
|
function wo(e) {
|
|
475
475
|
const t = Object.keys(e.shape);
|
|
@@ -485,23 +485,23 @@ function wo(e) {
|
|
|
485
485
|
optionalKeys: new Set(n)
|
|
486
486
|
};
|
|
487
487
|
}
|
|
488
|
-
function zo(e, t, n, r, o,
|
|
489
|
-
const
|
|
488
|
+
function zo(e, t, n, r, o, i) {
|
|
489
|
+
const s = [], c = o.keySet, a = o.catchall._zod, u = a.def.type, d = a.optin === "optional", l = a.optout === "optional";
|
|
490
490
|
for (const f in t) {
|
|
491
491
|
if (f === "__proto__" || c.has(f))
|
|
492
492
|
continue;
|
|
493
493
|
if (u === "never") {
|
|
494
|
-
|
|
494
|
+
s.push(f);
|
|
495
495
|
continue;
|
|
496
496
|
}
|
|
497
497
|
const p = a.run({ value: t[f], issues: [] }, r);
|
|
498
498
|
p instanceof Promise ? e.push(p.then((v) => Ve(v, n, f, t, d, l))) : Ve(p, n, f, t, d, l);
|
|
499
499
|
}
|
|
500
|
-
return
|
|
500
|
+
return s.length && n.issues.push({
|
|
501
501
|
code: "unrecognized_keys",
|
|
502
|
-
keys:
|
|
502
|
+
keys: s,
|
|
503
503
|
input: t,
|
|
504
|
-
inst:
|
|
504
|
+
inst: i
|
|
505
505
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
506
506
|
}
|
|
507
507
|
const $o = /* @__PURE__ */ k("$ZodObject", (e, t) => {
|
|
@@ -516,7 +516,7 @@ const $o = /* @__PURE__ */ k("$ZodObject", (e, t) => {
|
|
|
516
516
|
}
|
|
517
517
|
});
|
|
518
518
|
}
|
|
519
|
-
const r =
|
|
519
|
+
const r = Br(() => wo(t));
|
|
520
520
|
ee(e._zod, "propValues", () => {
|
|
521
521
|
const c = t.shape, a = {};
|
|
522
522
|
for (const u in c) {
|
|
@@ -529,10 +529,10 @@ const $o = /* @__PURE__ */ k("$ZodObject", (e, t) => {
|
|
|
529
529
|
}
|
|
530
530
|
return a;
|
|
531
531
|
});
|
|
532
|
-
const o = mt,
|
|
533
|
-
let
|
|
532
|
+
const o = mt, i = t.catchall;
|
|
533
|
+
let s;
|
|
534
534
|
e._zod.parse = (c, a) => {
|
|
535
|
-
|
|
535
|
+
s ?? (s = r.value);
|
|
536
536
|
const u = c.value;
|
|
537
537
|
if (!o(u))
|
|
538
538
|
return c.issues.push({
|
|
@@ -542,24 +542,24 @@ const $o = /* @__PURE__ */ k("$ZodObject", (e, t) => {
|
|
|
542
542
|
inst: e
|
|
543
543
|
}), c;
|
|
544
544
|
c.value = {};
|
|
545
|
-
const d = [], l =
|
|
546
|
-
for (const f of
|
|
545
|
+
const d = [], l = s.shape;
|
|
546
|
+
for (const f of s.keys) {
|
|
547
547
|
const p = l[f], v = p._zod.optin === "optional", w = p._zod.optout === "optional", $ = p._zod.run({ value: u[f], issues: [] }, a);
|
|
548
548
|
$ instanceof Promise ? d.push($.then((E) => Ve(E, c, f, u, v, w))) : Ve($, c, f, u, v, w);
|
|
549
549
|
}
|
|
550
|
-
return
|
|
550
|
+
return i ? zo(d, u, c, a, r.value, e) : d.length ? Promise.all(d).then(() => c) : c;
|
|
551
551
|
};
|
|
552
552
|
});
|
|
553
553
|
function qt(e, t, n, r) {
|
|
554
|
-
for (const
|
|
555
|
-
if (
|
|
556
|
-
return t.value =
|
|
557
|
-
const o = e.filter((
|
|
554
|
+
for (const i of e)
|
|
555
|
+
if (i.issues.length === 0)
|
|
556
|
+
return t.value = i.value, t;
|
|
557
|
+
const o = e.filter((i) => !Oe(i));
|
|
558
558
|
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
559
559
|
code: "invalid_union",
|
|
560
560
|
input: t.value,
|
|
561
561
|
inst: n,
|
|
562
|
-
errors: e.map((
|
|
562
|
+
errors: e.map((i) => i.issues.map((s) => fe(s, r, le())))
|
|
563
563
|
}), t);
|
|
564
564
|
}
|
|
565
565
|
const So = /* @__PURE__ */ k("$ZodUnion", (e, t) => {
|
|
@@ -576,38 +576,38 @@ const So = /* @__PURE__ */ k("$ZodUnion", (e, t) => {
|
|
|
576
576
|
e._zod.parse = (r, o) => {
|
|
577
577
|
if (n)
|
|
578
578
|
return n(r, o);
|
|
579
|
-
let
|
|
580
|
-
const
|
|
579
|
+
let i = !1;
|
|
580
|
+
const s = [];
|
|
581
581
|
for (const c of t.options) {
|
|
582
582
|
const a = c._zod.run({
|
|
583
583
|
value: r.value,
|
|
584
584
|
issues: []
|
|
585
585
|
}, o);
|
|
586
586
|
if (a instanceof Promise)
|
|
587
|
-
|
|
587
|
+
s.push(a), i = !0;
|
|
588
588
|
else {
|
|
589
589
|
if (a.issues.length === 0)
|
|
590
590
|
return a;
|
|
591
|
-
|
|
591
|
+
s.push(a);
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
|
-
return
|
|
594
|
+
return i ? Promise.all(s).then((c) => qt(c, r, e, o)) : qt(s, r, e, o);
|
|
595
595
|
};
|
|
596
596
|
}), ko = /* @__PURE__ */ k("$ZodRecord", (e, t) => {
|
|
597
597
|
V.init(e, t), e._zod.parse = (n, r) => {
|
|
598
598
|
const o = n.value;
|
|
599
|
-
if (!
|
|
599
|
+
if (!Kr(o))
|
|
600
600
|
return n.issues.push({
|
|
601
601
|
expected: "record",
|
|
602
602
|
code: "invalid_type",
|
|
603
603
|
input: o,
|
|
604
604
|
inst: e
|
|
605
605
|
}), n;
|
|
606
|
-
const
|
|
607
|
-
if (
|
|
606
|
+
const i = [], s = t.keyType._zod.values;
|
|
607
|
+
if (s) {
|
|
608
608
|
n.value = {};
|
|
609
609
|
const c = /* @__PURE__ */ new Set();
|
|
610
|
-
for (const u of
|
|
610
|
+
for (const u of s)
|
|
611
611
|
if (typeof u == "string" || typeof u == "number" || typeof u == "symbol") {
|
|
612
612
|
c.add(typeof u == "number" ? u.toString() : u);
|
|
613
613
|
const d = t.keyType._zod.run({ value: u, issues: [] }, r);
|
|
@@ -625,7 +625,7 @@ const So = /* @__PURE__ */ k("$ZodUnion", (e, t) => {
|
|
|
625
625
|
continue;
|
|
626
626
|
}
|
|
627
627
|
const l = d.value, f = t.valueType._zod.run({ value: o[u], issues: [] }, r);
|
|
628
|
-
f instanceof Promise ?
|
|
628
|
+
f instanceof Promise ? i.push(f.then((p) => {
|
|
629
629
|
p.issues.length && n.issues.push(...ge(u, p.issues)), n.value[l] = p.value;
|
|
630
630
|
})) : (f.issues.length && n.issues.push(...ge(u, f.issues)), n.value[l] = f.value);
|
|
631
631
|
}
|
|
@@ -664,22 +664,22 @@ const So = /* @__PURE__ */ k("$ZodUnion", (e, t) => {
|
|
|
664
664
|
continue;
|
|
665
665
|
}
|
|
666
666
|
const d = t.valueType._zod.run({ value: o[c], issues: [] }, r);
|
|
667
|
-
d instanceof Promise ?
|
|
667
|
+
d instanceof Promise ? i.push(d.then((l) => {
|
|
668
668
|
l.issues.length && n.issues.push(...ge(c, l.issues)), n.value[a.value] = l.value;
|
|
669
669
|
})) : (d.issues.length && n.issues.push(...ge(c, d.issues)), n.value[a.value] = d.value);
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
return
|
|
672
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
673
673
|
};
|
|
674
674
|
}), Io = /* @__PURE__ */ k("$ZodEnum", (e, t) => {
|
|
675
675
|
V.init(e, t);
|
|
676
676
|
const n = Dn(t.entries), r = new Set(n);
|
|
677
|
-
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Gr.has(typeof o)).map((o) => typeof o == "string" ? _t(o) : o.toString()).join("|")})$`), e._zod.parse = (o,
|
|
678
|
-
const
|
|
679
|
-
return r.has(
|
|
677
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Gr.has(typeof o)).map((o) => typeof o == "string" ? _t(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
678
|
+
const s = o.value;
|
|
679
|
+
return r.has(s) || o.issues.push({
|
|
680
680
|
code: "invalid_value",
|
|
681
681
|
values: n,
|
|
682
|
-
input:
|
|
682
|
+
input: s,
|
|
683
683
|
inst: e
|
|
684
684
|
}), o;
|
|
685
685
|
};
|
|
@@ -688,11 +688,11 @@ const So = /* @__PURE__ */ k("$ZodUnion", (e, t) => {
|
|
|
688
688
|
throw new Error("Cannot create literal schema with no valid values");
|
|
689
689
|
const n = new Set(t.values);
|
|
690
690
|
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((r) => typeof r == "string" ? _t(r) : r ? _t(r.toString()) : String(r)).join("|")})$`), e._zod.parse = (r, o) => {
|
|
691
|
-
const
|
|
692
|
-
return n.has(
|
|
691
|
+
const i = r.value;
|
|
692
|
+
return n.has(i) || r.issues.push({
|
|
693
693
|
code: "invalid_value",
|
|
694
694
|
values: t.values,
|
|
695
|
-
input:
|
|
695
|
+
input: i,
|
|
696
696
|
inst: e
|
|
697
697
|
}), r;
|
|
698
698
|
};
|
|
@@ -706,8 +706,8 @@ const Oo = /* @__PURE__ */ k("$ZodOptional", (e, t) => {
|
|
|
706
706
|
return n ? new RegExp(`^(${Fn(n.source)})?$`) : void 0;
|
|
707
707
|
}), e._zod.parse = (n, r) => {
|
|
708
708
|
if (t.innerType._zod.optin === "optional") {
|
|
709
|
-
const o = n.value,
|
|
710
|
-
return
|
|
709
|
+
const o = n.value, i = t.innerType._zod.run(n, r);
|
|
710
|
+
return i instanceof Promise ? i.then((s) => Ht(s, o)) : Ht(i, o);
|
|
711
711
|
}
|
|
712
712
|
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
713
713
|
};
|
|
@@ -837,14 +837,14 @@ function gt(e) {
|
|
|
837
837
|
}
|
|
838
838
|
function P(e, t, n = { path: [], schemaPath: [] }) {
|
|
839
839
|
var r;
|
|
840
|
-
const o = e._zod.def,
|
|
841
|
-
if (
|
|
842
|
-
return
|
|
843
|
-
const
|
|
844
|
-
t.seen.set(e,
|
|
840
|
+
const o = e._zod.def, i = t.seen.get(e);
|
|
841
|
+
if (i)
|
|
842
|
+
return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
|
|
843
|
+
const s = { schema: {}, count: 1, cycle: void 0, path: n.path };
|
|
844
|
+
t.seen.set(e, s);
|
|
845
845
|
const c = e._zod.toJSONSchema?.();
|
|
846
846
|
if (c)
|
|
847
|
-
|
|
847
|
+
s.schema = c;
|
|
848
848
|
else {
|
|
849
849
|
const d = {
|
|
850
850
|
...n,
|
|
@@ -852,50 +852,50 @@ function P(e, t, n = { path: [], schemaPath: [] }) {
|
|
|
852
852
|
path: n.path
|
|
853
853
|
};
|
|
854
854
|
if (e._zod.processJSONSchema)
|
|
855
|
-
e._zod.processJSONSchema(t,
|
|
855
|
+
e._zod.processJSONSchema(t, s.schema, d);
|
|
856
856
|
else {
|
|
857
|
-
const f =
|
|
857
|
+
const f = s.schema, p = t.processors[o.type];
|
|
858
858
|
if (!p)
|
|
859
859
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
860
860
|
p(e, t, f, d);
|
|
861
861
|
}
|
|
862
862
|
const l = e._zod.parent;
|
|
863
|
-
l && (
|
|
863
|
+
l && (s.ref || (s.ref = l), P(l, t, d), t.seen.get(l).isParent = !0);
|
|
864
864
|
}
|
|
865
865
|
const a = t.metadataRegistry.get(e);
|
|
866
|
-
return a && Object.assign(
|
|
866
|
+
return a && Object.assign(s.schema, a), t.io === "input" && j(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && "_prefault" in s.schema && ((r = s.schema).default ?? (r.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
|
|
867
867
|
}
|
|
868
868
|
function vt(e, t) {
|
|
869
869
|
const n = e.seen.get(t);
|
|
870
870
|
if (!n)
|
|
871
871
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
872
872
|
const r = /* @__PURE__ */ new Map();
|
|
873
|
-
for (const
|
|
874
|
-
const c = e.metadataRegistry.get(
|
|
873
|
+
for (const s of e.seen.entries()) {
|
|
874
|
+
const c = e.metadataRegistry.get(s[0])?.id;
|
|
875
875
|
if (c) {
|
|
876
876
|
const a = r.get(c);
|
|
877
|
-
if (a && a !==
|
|
877
|
+
if (a && a !== s[0])
|
|
878
878
|
throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
879
|
-
r.set(c,
|
|
879
|
+
r.set(c, s[0]);
|
|
880
880
|
}
|
|
881
881
|
}
|
|
882
|
-
const o = (
|
|
882
|
+
const o = (s) => {
|
|
883
883
|
const c = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
884
884
|
if (e.external) {
|
|
885
|
-
const l = e.external.registry.get(
|
|
885
|
+
const l = e.external.registry.get(s[0])?.id, f = e.external.uri ?? ((v) => v);
|
|
886
886
|
if (l)
|
|
887
887
|
return { ref: f(l) };
|
|
888
|
-
const p =
|
|
889
|
-
return
|
|
888
|
+
const p = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
|
|
889
|
+
return s[1].defId = p, { defId: p, ref: `${f("__shared")}#/${c}/${p}` };
|
|
890
890
|
}
|
|
891
|
-
if (
|
|
891
|
+
if (s[1] === n)
|
|
892
892
|
return { ref: "#" };
|
|
893
|
-
const u = `#/${c}/`, d =
|
|
893
|
+
const u = `#/${c}/`, d = s[1].schema.id ?? `__schema${e.counter++}`;
|
|
894
894
|
return { defId: d, ref: u + d };
|
|
895
|
-
},
|
|
896
|
-
if (
|
|
895
|
+
}, i = (s) => {
|
|
896
|
+
if (s[1].schema.$ref)
|
|
897
897
|
return;
|
|
898
|
-
const c =
|
|
898
|
+
const c = s[1], { ref: a, defId: u } = o(s);
|
|
899
899
|
c.def = { ...c.schema }, u && (c.defId = u);
|
|
900
900
|
const d = c.schema;
|
|
901
901
|
for (const l in d)
|
|
@@ -903,36 +903,36 @@ function vt(e, t) {
|
|
|
903
903
|
d.$ref = a;
|
|
904
904
|
};
|
|
905
905
|
if (e.cycles === "throw")
|
|
906
|
-
for (const
|
|
907
|
-
const c =
|
|
906
|
+
for (const s of e.seen.entries()) {
|
|
907
|
+
const c = s[1];
|
|
908
908
|
if (c.cycle)
|
|
909
909
|
throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
910
910
|
|
|
911
911
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
912
912
|
}
|
|
913
|
-
for (const
|
|
914
|
-
const c =
|
|
915
|
-
if (t ===
|
|
916
|
-
s
|
|
913
|
+
for (const s of e.seen.entries()) {
|
|
914
|
+
const c = s[1];
|
|
915
|
+
if (t === s[0]) {
|
|
916
|
+
i(s);
|
|
917
917
|
continue;
|
|
918
918
|
}
|
|
919
919
|
if (e.external) {
|
|
920
|
-
const u = e.external.registry.get(
|
|
921
|
-
if (t !==
|
|
922
|
-
s
|
|
920
|
+
const u = e.external.registry.get(s[0])?.id;
|
|
921
|
+
if (t !== s[0] && u) {
|
|
922
|
+
i(s);
|
|
923
923
|
continue;
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
-
if (e.metadataRegistry.get(
|
|
927
|
-
s
|
|
926
|
+
if (e.metadataRegistry.get(s[0])?.id) {
|
|
927
|
+
i(s);
|
|
928
928
|
continue;
|
|
929
929
|
}
|
|
930
930
|
if (c.cycle) {
|
|
931
|
-
s
|
|
931
|
+
i(s);
|
|
932
932
|
continue;
|
|
933
933
|
}
|
|
934
934
|
if (c.count > 1 && e.reused === "ref") {
|
|
935
|
-
s
|
|
935
|
+
i(s);
|
|
936
936
|
continue;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
@@ -980,14 +980,14 @@ function yt(e, t) {
|
|
|
980
980
|
o.$id = e.external.uri(c);
|
|
981
981
|
}
|
|
982
982
|
Object.assign(o, n.def ?? n.schema);
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
const
|
|
983
|
+
const i = e.metadataRegistry.get(t)?.id;
|
|
984
|
+
i !== void 0 && o.id === i && delete o.id;
|
|
985
|
+
const s = e.external?.defs ?? {};
|
|
986
986
|
for (const c of e.seen.entries()) {
|
|
987
987
|
const a = c[1];
|
|
988
|
-
a.def && a.defId && (a.def.id === a.defId && delete a.def.id,
|
|
988
|
+
a.def && a.defId && (a.def.id === a.defId && delete a.def.id, s[a.defId] = a.def);
|
|
989
989
|
}
|
|
990
|
-
e.external || Object.keys(
|
|
990
|
+
e.external || Object.keys(s).length > 0 && (e.target === "draft-2020-12" ? o.$defs = s : o.definitions = s);
|
|
991
991
|
try {
|
|
992
992
|
const c = JSON.parse(JSON.stringify(o));
|
|
993
993
|
return Object.defineProperty(c, "~standard", {
|
|
@@ -1048,8 +1048,8 @@ function j(e, t) {
|
|
|
1048
1048
|
return !1;
|
|
1049
1049
|
}
|
|
1050
1050
|
const Wt = (e, t, n = {}) => (r) => {
|
|
1051
|
-
const { libraryOptions: o, target:
|
|
1052
|
-
return P(e,
|
|
1051
|
+
const { libraryOptions: o, target: i } = r ?? {}, s = gt({ ...o ?? {}, target: i, io: t, processors: n });
|
|
1052
|
+
return P(e, s), vt(s, e), yt(s, e);
|
|
1053
1053
|
}, Lo = {
|
|
1054
1054
|
guid: "uuid",
|
|
1055
1055
|
url: "uri",
|
|
@@ -1060,8 +1060,8 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1060
1060
|
}, Uo = (e, t, n, r) => {
|
|
1061
1061
|
const o = n;
|
|
1062
1062
|
o.type = "string";
|
|
1063
|
-
const { minimum:
|
|
1064
|
-
if (typeof
|
|
1063
|
+
const { minimum: i, maximum: s, format: c, patterns: a, contentEncoding: u } = e._zod.bag;
|
|
1064
|
+
if (typeof i == "number" && (o.minLength = i), typeof s == "number" && (o.maxLength = s), c && (o.format = Lo[c] ?? c, o.format === "" && delete o.format, c === "time" && delete o.format), u && (o.contentEncoding = u), a && a.size > 0) {
|
|
1065
1065
|
const d = [...a];
|
|
1066
1066
|
d.length === 1 ? o.pattern = d[0].source : d.length > 1 && (o.allOf = [
|
|
1067
1067
|
...d.map((l) => ({
|
|
@@ -1071,10 +1071,10 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1071
1071
|
]);
|
|
1072
1072
|
}
|
|
1073
1073
|
}, Jo = (e, t, n, r) => {
|
|
1074
|
-
const o = n, { minimum:
|
|
1074
|
+
const o = n, { minimum: i, maximum: s, format: c, multipleOf: a, exclusiveMaximum: u, exclusiveMinimum: d } = e._zod.bag;
|
|
1075
1075
|
typeof c == "string" && c.includes("int") ? o.type = "integer" : o.type = "number";
|
|
1076
|
-
const l = typeof d == "number" && d >= (
|
|
1077
|
-
l ? p ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof
|
|
1076
|
+
const l = typeof d == "number" && d >= (i ?? Number.NEGATIVE_INFINITY), f = typeof u == "number" && u <= (s ?? Number.POSITIVE_INFINITY), p = t.target === "draft-04" || t.target === "openapi-3.0";
|
|
1077
|
+
l ? p ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof i == "number" && (o.minimum = i), f ? p ? (o.maximum = u, o.exclusiveMaximum = !0) : o.exclusiveMaximum = u : typeof s == "number" && (o.maximum = s), typeof a == "number" && (o.multipleOf = a);
|
|
1078
1078
|
}, qo = (e, t, n, r) => {
|
|
1079
1079
|
n.type = "boolean";
|
|
1080
1080
|
}, Ho = (e, t, n, r) => {
|
|
@@ -1085,10 +1085,10 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1085
1085
|
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
1086
1086
|
}, Wo = (e, t, n, r) => {
|
|
1087
1087
|
t.target === "openapi-3.0" ? (n.type = "string", n.nullable = !0, n.enum = [null]) : n.type = "null";
|
|
1088
|
-
},
|
|
1088
|
+
}, Bo = (e, t, n, r) => {
|
|
1089
1089
|
if (t.unrepresentable === "throw")
|
|
1090
1090
|
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
1091
|
-
},
|
|
1091
|
+
}, Ko = (e, t, n, r) => {
|
|
1092
1092
|
if (t.unrepresentable === "throw")
|
|
1093
1093
|
throw new Error("Void cannot be represented in JSON Schema");
|
|
1094
1094
|
}, Go = (e, t, n, r) => {
|
|
@@ -1099,40 +1099,40 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1099
1099
|
if (t.unrepresentable === "throw")
|
|
1100
1100
|
throw new Error("Date cannot be represented in JSON Schema");
|
|
1101
1101
|
}, ei = (e, t, n, r) => {
|
|
1102
|
-
const o = e._zod.def,
|
|
1103
|
-
|
|
1102
|
+
const o = e._zod.def, i = Dn(o.entries);
|
|
1103
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
|
|
1104
1104
|
}, ti = (e, t, n, r) => {
|
|
1105
|
-
const o = e._zod.def,
|
|
1106
|
-
for (const
|
|
1107
|
-
if (
|
|
1105
|
+
const o = e._zod.def, i = [];
|
|
1106
|
+
for (const s of o.values)
|
|
1107
|
+
if (s === void 0) {
|
|
1108
1108
|
if (t.unrepresentable === "throw")
|
|
1109
1109
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
1110
|
-
} else if (typeof
|
|
1110
|
+
} else if (typeof s == "bigint") {
|
|
1111
1111
|
if (t.unrepresentable === "throw")
|
|
1112
1112
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
1113
|
-
|
|
1113
|
+
i.push(Number(s));
|
|
1114
1114
|
} else
|
|
1115
|
-
|
|
1116
|
-
if (
|
|
1117
|
-
const
|
|
1118
|
-
n.type =
|
|
1115
|
+
i.push(s);
|
|
1116
|
+
if (i.length !== 0) if (i.length === 1) {
|
|
1117
|
+
const s = i[0];
|
|
1118
|
+
n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
|
|
1119
1119
|
} else
|
|
1120
|
-
|
|
1120
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
|
|
1121
1121
|
}, ni = (e, t, n, r) => {
|
|
1122
1122
|
if (t.unrepresentable === "throw")
|
|
1123
1123
|
throw new Error("NaN cannot be represented in JSON Schema");
|
|
1124
1124
|
}, ri = (e, t, n, r) => {
|
|
1125
|
-
const o = n,
|
|
1126
|
-
if (!
|
|
1125
|
+
const o = n, i = e._zod.pattern;
|
|
1126
|
+
if (!i)
|
|
1127
1127
|
throw new Error("Pattern not found in template literal");
|
|
1128
|
-
o.type = "string", o.pattern =
|
|
1128
|
+
o.type = "string", o.pattern = i.source;
|
|
1129
1129
|
}, oi = (e, t, n, r) => {
|
|
1130
|
-
const o = n,
|
|
1130
|
+
const o = n, i = {
|
|
1131
1131
|
type: "string",
|
|
1132
1132
|
format: "binary",
|
|
1133
1133
|
contentEncoding: "binary"
|
|
1134
|
-
}, { minimum:
|
|
1135
|
-
|
|
1134
|
+
}, { minimum: s, maximum: c, mime: a } = e._zod.bag;
|
|
1135
|
+
s !== void 0 && (i.minLength = s), c !== void 0 && (i.maxLength = c), a ? a.length === 1 ? (i.contentMediaType = a[0], Object.assign(o, i)) : (Object.assign(o, i), o.anyOf = a.map((u) => ({ contentMediaType: u }))) : Object.assign(o, i);
|
|
1136
1136
|
}, ii = (e, t, n, r) => {
|
|
1137
1137
|
n.type = "boolean";
|
|
1138
1138
|
}, si = (e, t, n, r) => {
|
|
@@ -1151,55 +1151,55 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1151
1151
|
if (t.unrepresentable === "throw")
|
|
1152
1152
|
throw new Error("Set cannot be represented in JSON Schema");
|
|
1153
1153
|
}, li = (e, t, n, r) => {
|
|
1154
|
-
const o = n,
|
|
1155
|
-
typeof
|
|
1154
|
+
const o = n, i = e._zod.def, { minimum: s, maximum: c } = e._zod.bag;
|
|
1155
|
+
typeof s == "number" && (o.minItems = s), typeof c == "number" && (o.maxItems = c), o.type = "array", o.items = P(i.element, t, {
|
|
1156
1156
|
...r,
|
|
1157
1157
|
path: [...r.path, "items"]
|
|
1158
1158
|
});
|
|
1159
1159
|
}, fi = (e, t, n, r) => {
|
|
1160
|
-
const o = n,
|
|
1160
|
+
const o = n, i = e._zod.def;
|
|
1161
1161
|
o.type = "object", o.properties = {};
|
|
1162
|
-
const
|
|
1163
|
-
for (const u in
|
|
1164
|
-
o.properties[u] = P(
|
|
1162
|
+
const s = i.shape;
|
|
1163
|
+
for (const u in s)
|
|
1164
|
+
o.properties[u] = P(s[u], t, {
|
|
1165
1165
|
...r,
|
|
1166
1166
|
path: [...r.path, "properties", u]
|
|
1167
1167
|
});
|
|
1168
|
-
const c = new Set(Object.keys(
|
|
1169
|
-
const d =
|
|
1168
|
+
const c = new Set(Object.keys(s)), a = new Set([...c].filter((u) => {
|
|
1169
|
+
const d = i.shape[u]._zod;
|
|
1170
1170
|
return t.io === "input" ? d.optin === void 0 : d.optout === void 0;
|
|
1171
1171
|
}));
|
|
1172
|
-
a.size > 0 && (o.required = Array.from(a)),
|
|
1172
|
+
a.size > 0 && (o.required = Array.from(a)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = P(i.catchall, t, {
|
|
1173
1173
|
...r,
|
|
1174
1174
|
path: [...r.path, "additionalProperties"]
|
|
1175
1175
|
})) : t.io === "output" && (o.additionalProperties = !1);
|
|
1176
1176
|
}, hi = (e, t, n, r) => {
|
|
1177
|
-
const o = e._zod.def,
|
|
1177
|
+
const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((c, a) => P(c, t, {
|
|
1178
1178
|
...r,
|
|
1179
|
-
path: [...r.path,
|
|
1179
|
+
path: [...r.path, i ? "oneOf" : "anyOf", a]
|
|
1180
1180
|
}));
|
|
1181
|
-
|
|
1181
|
+
i ? n.oneOf = s : n.anyOf = s;
|
|
1182
1182
|
}, pi = (e, t, n, r) => {
|
|
1183
|
-
const o = e._zod.def,
|
|
1183
|
+
const o = e._zod.def, i = P(o.left, t, {
|
|
1184
1184
|
...r,
|
|
1185
1185
|
path: [...r.path, "allOf", 0]
|
|
1186
|
-
}),
|
|
1186
|
+
}), s = P(o.right, t, {
|
|
1187
1187
|
...r,
|
|
1188
1188
|
path: [...r.path, "allOf", 1]
|
|
1189
1189
|
}), c = (u) => "allOf" in u && Object.keys(u).length === 1, a = [
|
|
1190
|
-
...c(
|
|
1191
|
-
...c(
|
|
1190
|
+
...c(i) ? i.allOf : [i],
|
|
1191
|
+
...c(s) ? s.allOf : [s]
|
|
1192
1192
|
];
|
|
1193
1193
|
n.allOf = a;
|
|
1194
1194
|
}, mi = (e, t, n, r) => {
|
|
1195
|
-
const o = n,
|
|
1195
|
+
const o = n, i = e._zod.def;
|
|
1196
1196
|
o.type = "array";
|
|
1197
|
-
const
|
|
1197
|
+
const s = t.target === "draft-2020-12" ? "prefixItems" : "items", c = t.target === "draft-2020-12" || t.target === "openapi-3.0" ? "items" : "additionalItems", a = i.items.map((f, p) => P(f, t, {
|
|
1198
1198
|
...r,
|
|
1199
|
-
path: [...r.path,
|
|
1200
|
-
})), u =
|
|
1199
|
+
path: [...r.path, s, p]
|
|
1200
|
+
})), u = i.rest ? P(i.rest, t, {
|
|
1201
1201
|
...r,
|
|
1202
|
-
path: [...r.path, c, ...t.target === "openapi-3.0" ? [
|
|
1202
|
+
path: [...r.path, c, ...t.target === "openapi-3.0" ? [i.items.length] : []]
|
|
1203
1203
|
}) : null;
|
|
1204
1204
|
t.target === "draft-2020-12" ? (o.prefixItems = a, u && (o.items = u)) : t.target === "openapi-3.0" ? (o.items = {
|
|
1205
1205
|
anyOf: a
|
|
@@ -1207,11 +1207,11 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1207
1207
|
const { minimum: d, maximum: l } = e._zod.bag;
|
|
1208
1208
|
typeof d == "number" && (o.minItems = d), typeof l == "number" && (o.maxItems = l);
|
|
1209
1209
|
}, _i = (e, t, n, r) => {
|
|
1210
|
-
const o = n,
|
|
1210
|
+
const o = n, i = e._zod.def;
|
|
1211
1211
|
o.type = "object";
|
|
1212
|
-
const
|
|
1213
|
-
if (
|
|
1214
|
-
const d = P(
|
|
1212
|
+
const s = i.keyType, a = s._zod.bag?.patterns;
|
|
1213
|
+
if (i.mode === "loose" && a && a.size > 0) {
|
|
1214
|
+
const d = P(i.valueType, t, {
|
|
1215
1215
|
...r,
|
|
1216
1216
|
path: [...r.path, "patternProperties", "*"]
|
|
1217
1217
|
});
|
|
@@ -1219,82 +1219,82 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1219
1219
|
for (const l of a)
|
|
1220
1220
|
o.patternProperties[l.source] = d;
|
|
1221
1221
|
} else
|
|
1222
|
-
(t.target === "draft-07" || t.target === "draft-2020-12") && (o.propertyNames = P(
|
|
1222
|
+
(t.target === "draft-07" || t.target === "draft-2020-12") && (o.propertyNames = P(i.keyType, t, {
|
|
1223
1223
|
...r,
|
|
1224
1224
|
path: [...r.path, "propertyNames"]
|
|
1225
|
-
})), o.additionalProperties = P(
|
|
1225
|
+
})), o.additionalProperties = P(i.valueType, t, {
|
|
1226
1226
|
...r,
|
|
1227
1227
|
path: [...r.path, "additionalProperties"]
|
|
1228
1228
|
});
|
|
1229
|
-
const u =
|
|
1229
|
+
const u = s._zod.values;
|
|
1230
1230
|
if (u) {
|
|
1231
1231
|
const d = [...u].filter((l) => typeof l == "string" || typeof l == "number");
|
|
1232
1232
|
d.length > 0 && (o.required = d);
|
|
1233
1233
|
}
|
|
1234
1234
|
}, gi = (e, t, n, r) => {
|
|
1235
|
-
const o = e._zod.def,
|
|
1236
|
-
t.target === "openapi-3.0" ? (
|
|
1235
|
+
const o = e._zod.def, i = P(o.innerType, t, r), s = t.seen.get(e);
|
|
1236
|
+
t.target === "openapi-3.0" ? (s.ref = o.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
|
|
1237
1237
|
}, vi = (e, t, n, r) => {
|
|
1238
1238
|
const o = e._zod.def;
|
|
1239
1239
|
P(o.innerType, t, r);
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1240
|
+
const i = t.seen.get(e);
|
|
1241
|
+
i.ref = o.innerType;
|
|
1242
1242
|
}, yi = (e, t, n, r) => {
|
|
1243
1243
|
const o = e._zod.def;
|
|
1244
1244
|
P(o.innerType, t, r);
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1245
|
+
const i = t.seen.get(e);
|
|
1246
|
+
i.ref = o.innerType, n.default = JSON.parse(JSON.stringify(o.defaultValue));
|
|
1247
1247
|
}, bi = (e, t, n, r) => {
|
|
1248
1248
|
const o = e._zod.def;
|
|
1249
1249
|
P(o.innerType, t, r);
|
|
1250
|
-
const
|
|
1251
|
-
|
|
1250
|
+
const i = t.seen.get(e);
|
|
1251
|
+
i.ref = o.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
|
|
1252
1252
|
}, wi = (e, t, n, r) => {
|
|
1253
1253
|
const o = e._zod.def;
|
|
1254
1254
|
P(o.innerType, t, r);
|
|
1255
|
-
const
|
|
1256
|
-
|
|
1257
|
-
let
|
|
1255
|
+
const i = t.seen.get(e);
|
|
1256
|
+
i.ref = o.innerType;
|
|
1257
|
+
let s;
|
|
1258
1258
|
try {
|
|
1259
|
-
|
|
1259
|
+
s = o.catchValue(void 0);
|
|
1260
1260
|
} catch {
|
|
1261
1261
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
1262
1262
|
}
|
|
1263
|
-
n.default =
|
|
1263
|
+
n.default = s;
|
|
1264
1264
|
}, zi = (e, t, n, r) => {
|
|
1265
|
-
const o = e._zod.def,
|
|
1266
|
-
P(
|
|
1265
|
+
const o = e._zod.def, i = o.in._zod.traits.has("$ZodTransform"), s = t.io === "input" ? i ? o.out : o.in : o.out;
|
|
1266
|
+
P(s, t, r);
|
|
1267
1267
|
const c = t.seen.get(e);
|
|
1268
|
-
c.ref =
|
|
1268
|
+
c.ref = s;
|
|
1269
1269
|
}, $i = (e, t, n, r) => {
|
|
1270
1270
|
const o = e._zod.def;
|
|
1271
1271
|
P(o.innerType, t, r);
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1272
|
+
const i = t.seen.get(e);
|
|
1273
|
+
i.ref = o.innerType, n.readOnly = !0;
|
|
1274
1274
|
}, Si = (e, t, n, r) => {
|
|
1275
1275
|
const o = e._zod.def;
|
|
1276
1276
|
P(o.innerType, t, r);
|
|
1277
|
-
const
|
|
1278
|
-
|
|
1277
|
+
const i = t.seen.get(e);
|
|
1278
|
+
i.ref = o.innerType;
|
|
1279
1279
|
}, ki = (e, t, n, r) => {
|
|
1280
1280
|
const o = e._zod.def;
|
|
1281
1281
|
P(o.innerType, t, r);
|
|
1282
|
-
const
|
|
1283
|
-
|
|
1282
|
+
const i = t.seen.get(e);
|
|
1283
|
+
i.ref = o.innerType;
|
|
1284
1284
|
}, Ii = (e, t, n, r) => {
|
|
1285
1285
|
const o = e._zod.innerType;
|
|
1286
1286
|
P(o, t, r);
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1289
|
-
},
|
|
1287
|
+
const i = t.seen.get(e);
|
|
1288
|
+
i.ref = o;
|
|
1289
|
+
}, Bt = {
|
|
1290
1290
|
string: Uo,
|
|
1291
1291
|
number: Jo,
|
|
1292
1292
|
boolean: qo,
|
|
1293
1293
|
bigint: Ho,
|
|
1294
1294
|
symbol: Vo,
|
|
1295
1295
|
null: Wo,
|
|
1296
|
-
undefined:
|
|
1297
|
-
void:
|
|
1296
|
+
undefined: Bo,
|
|
1297
|
+
void: Ko,
|
|
1298
1298
|
never: Go,
|
|
1299
1299
|
any: Yo,
|
|
1300
1300
|
unknown: Xo,
|
|
@@ -1329,33 +1329,33 @@ const Wt = (e, t, n = {}) => (r) => {
|
|
|
1329
1329
|
};
|
|
1330
1330
|
function Ei(e, t) {
|
|
1331
1331
|
if ("_idmap" in e) {
|
|
1332
|
-
const r = e, o = gt({ ...t, processors:
|
|
1332
|
+
const r = e, o = gt({ ...t, processors: Bt }), i = {};
|
|
1333
1333
|
for (const a of r._idmap.entries()) {
|
|
1334
1334
|
const [u, d] = a;
|
|
1335
1335
|
P(d, o);
|
|
1336
1336
|
}
|
|
1337
|
-
const
|
|
1337
|
+
const s = {}, c = {
|
|
1338
1338
|
registry: r,
|
|
1339
1339
|
uri: t?.uri,
|
|
1340
|
-
defs:
|
|
1340
|
+
defs: i
|
|
1341
1341
|
};
|
|
1342
1342
|
o.external = c;
|
|
1343
1343
|
for (const a of r._idmap.entries()) {
|
|
1344
1344
|
const [u, d] = a;
|
|
1345
|
-
vt(o, d),
|
|
1345
|
+
vt(o, d), s[u] = yt(o, d);
|
|
1346
1346
|
}
|
|
1347
|
-
if (Object.keys(
|
|
1347
|
+
if (Object.keys(i).length > 0) {
|
|
1348
1348
|
const a = o.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
1349
|
-
|
|
1350
|
-
[a]:
|
|
1349
|
+
s.__shared = {
|
|
1350
|
+
[a]: i
|
|
1351
1351
|
};
|
|
1352
1352
|
}
|
|
1353
|
-
return { schemas:
|
|
1353
|
+
return { schemas: s };
|
|
1354
1354
|
}
|
|
1355
|
-
const n = gt({ ...t, processors:
|
|
1355
|
+
const n = gt({ ...t, processors: Bt });
|
|
1356
1356
|
return P(e, n), vt(n, e), yt(n, e);
|
|
1357
1357
|
}
|
|
1358
|
-
const
|
|
1358
|
+
const B = /* @__PURE__ */ k("ZodMiniType", (e, t) => {
|
|
1359
1359
|
if (!e._zod)
|
|
1360
1360
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
1361
1361
|
V.init(e, t), e.def = t, e.type = t.type, e.parse = (n, r) => ro(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => Y(e, n, r), e.parseAsync = async (n, r) => io(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => Jn(e, n, r), e.check = (...n) => e.clone({
|
|
@@ -1368,49 +1368,49 @@ const K = /* @__PURE__ */ k("ZodMiniType", (e, t) => {
|
|
|
1368
1368
|
]
|
|
1369
1369
|
}, { parent: !0 }), e.with = e.check, e.clone = (n, r) => Yr(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.apply = (n) => n(e);
|
|
1370
1370
|
}), Oi = /* @__PURE__ */ k("ZodMiniString", (e, t) => {
|
|
1371
|
-
mo.init(e, t),
|
|
1371
|
+
mo.init(e, t), B.init(e, t);
|
|
1372
1372
|
});
|
|
1373
1373
|
// @__NO_SIDE_EFFECTS__
|
|
1374
1374
|
function m(e) {
|
|
1375
1375
|
return /* @__PURE__ */ Ro(Oi, e);
|
|
1376
1376
|
}
|
|
1377
|
-
const
|
|
1378
|
-
Wn.init(e, t),
|
|
1377
|
+
const Bn = /* @__PURE__ */ k("ZodMiniNumber", (e, t) => {
|
|
1378
|
+
Wn.init(e, t), B.init(e, t);
|
|
1379
1379
|
});
|
|
1380
1380
|
// @__NO_SIDE_EFFECTS__
|
|
1381
1381
|
function W(e) {
|
|
1382
|
-
return /* @__PURE__ */ No(
|
|
1382
|
+
return /* @__PURE__ */ No(Bn, e);
|
|
1383
1383
|
}
|
|
1384
1384
|
const Pi = /* @__PURE__ */ k("ZodMiniNumberFormat", (e, t) => {
|
|
1385
|
-
_o.init(e, t),
|
|
1385
|
+
_o.init(e, t), Bn.init(e, t);
|
|
1386
1386
|
});
|
|
1387
1387
|
// @__NO_SIDE_EFFECTS__
|
|
1388
1388
|
function ze(e) {
|
|
1389
1389
|
return /* @__PURE__ */ Co(Pi, e);
|
|
1390
1390
|
}
|
|
1391
1391
|
const Ti = /* @__PURE__ */ k("ZodMiniBoolean", (e, t) => {
|
|
1392
|
-
go.init(e, t),
|
|
1392
|
+
go.init(e, t), B.init(e, t);
|
|
1393
1393
|
});
|
|
1394
1394
|
// @__NO_SIDE_EFFECTS__
|
|
1395
1395
|
function et(e) {
|
|
1396
1396
|
return /* @__PURE__ */ Ao(Ti, e);
|
|
1397
1397
|
}
|
|
1398
1398
|
const Zi = /* @__PURE__ */ k("ZodMiniUnknown", (e, t) => {
|
|
1399
|
-
vo.init(e, t),
|
|
1399
|
+
vo.init(e, t), B.init(e, t);
|
|
1400
1400
|
});
|
|
1401
1401
|
// @__NO_SIDE_EFFECTS__
|
|
1402
1402
|
function de() {
|
|
1403
1403
|
return /* @__PURE__ */ jo(Zi);
|
|
1404
1404
|
}
|
|
1405
1405
|
const Ri = /* @__PURE__ */ k("ZodMiniVoid", (e, t) => {
|
|
1406
|
-
yo.init(e, t),
|
|
1406
|
+
yo.init(e, t), B.init(e, t);
|
|
1407
1407
|
});
|
|
1408
1408
|
// @__NO_SIDE_EFFECTS__
|
|
1409
|
-
function
|
|
1409
|
+
function Kt(e) {
|
|
1410
1410
|
return /* @__PURE__ */ Mo(Ri, e);
|
|
1411
1411
|
}
|
|
1412
1412
|
const Ni = /* @__PURE__ */ k("ZodMiniArray", (e, t) => {
|
|
1413
|
-
bo.init(e, t),
|
|
1413
|
+
bo.init(e, t), B.init(e, t);
|
|
1414
1414
|
});
|
|
1415
1415
|
// @__NO_SIDE_EFFECTS__
|
|
1416
1416
|
function H(e, t) {
|
|
@@ -1421,7 +1421,7 @@ function H(e, t) {
|
|
|
1421
1421
|
});
|
|
1422
1422
|
}
|
|
1423
1423
|
const Ci = /* @__PURE__ */ k("ZodMiniObject", (e, t) => {
|
|
1424
|
-
$o.init(e, t),
|
|
1424
|
+
$o.init(e, t), B.init(e, t), ee(e, "shape", () => t.shape);
|
|
1425
1425
|
});
|
|
1426
1426
|
// @__NO_SIDE_EFFECTS__
|
|
1427
1427
|
function g(e, t) {
|
|
@@ -1433,7 +1433,7 @@ function g(e, t) {
|
|
|
1433
1433
|
return new Ci(n);
|
|
1434
1434
|
}
|
|
1435
1435
|
const Ai = /* @__PURE__ */ k("ZodMiniUnion", (e, t) => {
|
|
1436
|
-
So.init(e, t),
|
|
1436
|
+
So.init(e, t), B.init(e, t);
|
|
1437
1437
|
});
|
|
1438
1438
|
// @__NO_SIDE_EFFECTS__
|
|
1439
1439
|
function je(e, t) {
|
|
@@ -1444,7 +1444,7 @@ function je(e, t) {
|
|
|
1444
1444
|
});
|
|
1445
1445
|
}
|
|
1446
1446
|
const Gt = /* @__PURE__ */ k("ZodMiniRecord", (e, t) => {
|
|
1447
|
-
ko.init(e, t),
|
|
1447
|
+
ko.init(e, t), B.init(e, t);
|
|
1448
1448
|
});
|
|
1449
1449
|
// @__NO_SIDE_EFFECTS__
|
|
1450
1450
|
function ji(e, t, n) {
|
|
@@ -1461,7 +1461,7 @@ function ji(e, t, n) {
|
|
|
1461
1461
|
});
|
|
1462
1462
|
}
|
|
1463
1463
|
const Mi = /* @__PURE__ */ k("ZodMiniEnum", (e, t) => {
|
|
1464
|
-
Io.init(e, t),
|
|
1464
|
+
Io.init(e, t), B.init(e, t), e.options = Object.values(t.entries);
|
|
1465
1465
|
});
|
|
1466
1466
|
// @__NO_SIDE_EFFECTS__
|
|
1467
1467
|
function ie(e, t) {
|
|
@@ -1473,10 +1473,10 @@ function ie(e, t) {
|
|
|
1473
1473
|
});
|
|
1474
1474
|
}
|
|
1475
1475
|
const xi = /* @__PURE__ */ k("ZodMiniLiteral", (e, t) => {
|
|
1476
|
-
Eo.init(e, t),
|
|
1476
|
+
Eo.init(e, t), B.init(e, t);
|
|
1477
1477
|
});
|
|
1478
1478
|
// @__NO_SIDE_EFFECTS__
|
|
1479
|
-
function
|
|
1479
|
+
function Kn(e, t) {
|
|
1480
1480
|
return new xi({
|
|
1481
1481
|
type: "literal",
|
|
1482
1482
|
values: Array.isArray(e) ? e : [e],
|
|
@@ -1484,7 +1484,7 @@ function Bn(e, t) {
|
|
|
1484
1484
|
});
|
|
1485
1485
|
}
|
|
1486
1486
|
const Di = /* @__PURE__ */ k("ZodMiniOptional", (e, t) => {
|
|
1487
|
-
Oo.init(e, t),
|
|
1487
|
+
Oo.init(e, t), B.init(e, t);
|
|
1488
1488
|
});
|
|
1489
1489
|
// @__NO_SIDE_EFFECTS__
|
|
1490
1490
|
function y(e) {
|
|
@@ -1519,8 +1519,8 @@ function re(e) {
|
|
|
1519
1519
|
const n = {};
|
|
1520
1520
|
for (const [r, o] of Object.entries(t)) {
|
|
1521
1521
|
if (!Fi.has(r)) continue;
|
|
1522
|
-
const
|
|
1523
|
-
|
|
1522
|
+
const i = Li(r, o);
|
|
1523
|
+
i !== void 0 && (n[r] = i);
|
|
1524
1524
|
}
|
|
1525
1525
|
if (n.type === "object" && !("additionalProperties" in n) && (n.additionalProperties = !1), Array.isArray(n.oneOf) && !("discriminator" in n)) {
|
|
1526
1526
|
const r = Ji(n.oneOf);
|
|
@@ -1576,16 +1576,16 @@ function Ji(e) {
|
|
|
1576
1576
|
if (n = n.filter((o) => Yt(t[r]).includes(o)), n.length === 0) return;
|
|
1577
1577
|
for (const r of n) {
|
|
1578
1578
|
const o = /* @__PURE__ */ new Set();
|
|
1579
|
-
let
|
|
1580
|
-
for (const
|
|
1581
|
-
const c =
|
|
1579
|
+
let i = !0;
|
|
1580
|
+
for (const s of t) {
|
|
1581
|
+
const c = s[r], a = JSON.stringify(c.const);
|
|
1582
1582
|
if (o.has(a)) {
|
|
1583
|
-
|
|
1583
|
+
i = !1;
|
|
1584
1584
|
break;
|
|
1585
1585
|
}
|
|
1586
1586
|
o.add(a);
|
|
1587
1587
|
}
|
|
1588
|
-
if (
|
|
1588
|
+
if (i) return { propertyName: r };
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
1591
|
function Yt(e) {
|
|
@@ -1602,8 +1602,8 @@ var Gn = class Yn {
|
|
|
1602
1602
|
clientStreamSchema;
|
|
1603
1603
|
serverStreamSchema;
|
|
1604
1604
|
kind = "request";
|
|
1605
|
-
constructor(t, n, r, o = {},
|
|
1606
|
-
this.paramsSchema = t, this.resultSchema = n, this.errorSchema = r, this.docs = o, this.clientStreamSchema =
|
|
1605
|
+
constructor(t, n, r, o = {}, i, s) {
|
|
1606
|
+
this.paramsSchema = t, this.resultSchema = n, this.errorSchema = r, this.docs = o, this.clientStreamSchema = i, this.serverStreamSchema = s;
|
|
1607
1607
|
}
|
|
1608
1608
|
/**
|
|
1609
1609
|
* Return a copy of this request type with stream payload schemas
|
|
@@ -1623,7 +1623,7 @@ var Gn = class Yn {
|
|
|
1623
1623
|
};
|
|
1624
1624
|
function O(e, t, n, r) {
|
|
1625
1625
|
const o = {};
|
|
1626
|
-
return new Gn(e, t ?? /* @__PURE__ */
|
|
1626
|
+
return new Gn(e, t ?? /* @__PURE__ */ Kt(), /* @__PURE__ */ Kt(), o);
|
|
1627
1627
|
}
|
|
1628
1628
|
function X(e, t = {}) {
|
|
1629
1629
|
return new Xn(e, t);
|
|
@@ -1637,16 +1637,16 @@ function Hi(e, t) {
|
|
|
1637
1637
|
const n = We(e.$defs) ? e.$defs : {}, r = wt(e);
|
|
1638
1638
|
if (Object.keys(n).length === 0 && r.size === 0) return re(e);
|
|
1639
1639
|
if (t === void 0) throw new Error("zodToSvcJsonSchema: local references require a component destination");
|
|
1640
|
-
const o = `method=${it(t.methodName)}&schema=${it(t.schemaPosition)}`,
|
|
1641
|
-
for (const u of Object.keys(n))
|
|
1642
|
-
const
|
|
1640
|
+
const o = `method=${it(t.methodName)}&schema=${it(t.schemaPosition)}`, i = /* @__PURE__ */ new Map();
|
|
1641
|
+
for (const u of Object.keys(n)) i.set(u, `${o}&def=${it(u)}`);
|
|
1642
|
+
const s = r.has("#") ? `${o}&root` : void 0, c = (u) => zt(u, i, s);
|
|
1643
1643
|
for (const [u, d] of Object.entries(n)) {
|
|
1644
|
-
const l =
|
|
1644
|
+
const l = i.get(u);
|
|
1645
1645
|
if (l === void 0) throw new Error(`zodToSvcJsonSchema: missing component for "${u}"`);
|
|
1646
1646
|
Xt(t.components, l, re(c(d)));
|
|
1647
1647
|
}
|
|
1648
1648
|
const a = c(e);
|
|
1649
|
-
return
|
|
1649
|
+
return s !== void 0 ? (Xt(t.components, s, re(a)), { $ref: $t(s) }) : re(a);
|
|
1650
1650
|
}
|
|
1651
1651
|
function wt(e, t = /* @__PURE__ */ new Set()) {
|
|
1652
1652
|
if (Array.isArray(e)) {
|
|
@@ -1662,8 +1662,8 @@ function zt(e, t, n) {
|
|
|
1662
1662
|
if (Array.isArray(e)) return e.map((o) => zt(o, t, n));
|
|
1663
1663
|
if (!We(e)) return e;
|
|
1664
1664
|
const r = {};
|
|
1665
|
-
for (const [o,
|
|
1666
|
-
o !== "$defs" && (o === "$ref" && typeof
|
|
1665
|
+
for (const [o, i] of Object.entries(e))
|
|
1666
|
+
o !== "$defs" && (o === "$ref" && typeof i == "string" ? r[o] = Vi(i, t, n) : r[o] = zt(i, t, n));
|
|
1667
1667
|
return r;
|
|
1668
1668
|
}
|
|
1669
1669
|
function Vi(e, t, n) {
|
|
@@ -1672,9 +1672,9 @@ function Vi(e, t, n) {
|
|
|
1672
1672
|
return $t(n);
|
|
1673
1673
|
}
|
|
1674
1674
|
if (e.startsWith("#/$defs/")) {
|
|
1675
|
-
const r = e.slice(8), o = [...t.keys()].find((
|
|
1676
|
-
if (
|
|
1677
|
-
return $t(
|
|
1675
|
+
const r = e.slice(8), o = [...t.keys()].find((s) => Qn(s) === r), i = o === void 0 ? void 0 : t.get(o);
|
|
1676
|
+
if (i === void 0) throw new Error(`zodToSvcJsonSchema: dangling local reference "${e}"`);
|
|
1677
|
+
return $t(i);
|
|
1678
1678
|
}
|
|
1679
1679
|
if (e.startsWith("#") && !e.startsWith("#/components/schemas/")) throw new Error(`zodToSvcJsonSchema: unsupported local reference "${e}"`);
|
|
1680
1680
|
return e;
|
|
@@ -1718,15 +1718,15 @@ function qe(e, t = /* @__PURE__ */ new Set()) {
|
|
|
1718
1718
|
if (Array.isArray(n)) r = `[${n.map((o) => qe(o === void 0 || typeof o == "symbol" ? null : o, t)).join(",")}]`;
|
|
1719
1719
|
else {
|
|
1720
1720
|
const o = [];
|
|
1721
|
-
for (const
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1721
|
+
for (const i of Object.keys(n).sort()) {
|
|
1722
|
+
const s = n[i];
|
|
1723
|
+
s === void 0 || typeof s == "symbol" || o.push(`${JSON.stringify(i)}:${qe(s, t)}`);
|
|
1724
1724
|
}
|
|
1725
1725
|
r = `{${o.join(",")}}`;
|
|
1726
1726
|
}
|
|
1727
1727
|
return t.delete(n), r;
|
|
1728
1728
|
}
|
|
1729
|
-
const
|
|
1729
|
+
const Bi = new Uint32Array([
|
|
1730
1730
|
1116352408,
|
|
1731
1731
|
1899447441,
|
|
1732
1732
|
3049323471,
|
|
@@ -1795,12 +1795,12 @@ const Ki = new Uint32Array([
|
|
|
1795
1795
|
function G(e, t) {
|
|
1796
1796
|
return e >>> t | e << 32 - t;
|
|
1797
1797
|
}
|
|
1798
|
-
function
|
|
1798
|
+
function Ki(e) {
|
|
1799
1799
|
const t = e.length, n = t * 8, r = t + 9 + 63 & -64, o = new Uint8Array(r);
|
|
1800
1800
|
o.set(e), o[t] = 128;
|
|
1801
|
-
const
|
|
1802
|
-
|
|
1803
|
-
const
|
|
1801
|
+
const i = new DataView(o.buffer);
|
|
1802
|
+
i.setUint32(r - 8, Math.floor(n / 4294967296), !1), i.setUint32(r - 4, n >>> 0, !1);
|
|
1803
|
+
const s = new Uint32Array([
|
|
1804
1804
|
1779033703,
|
|
1805
1805
|
3144134277,
|
|
1806
1806
|
1013904242,
|
|
@@ -1811,24 +1811,24 @@ function Bi(e) {
|
|
|
1811
1811
|
1541459225
|
|
1812
1812
|
]), c = /* @__PURE__ */ new Uint32Array(64);
|
|
1813
1813
|
for (let d = 0; d < r; d += 64) {
|
|
1814
|
-
for (let b = 0; b < 16; b++) c[b] =
|
|
1814
|
+
for (let b = 0; b < 16; b++) c[b] = i.getUint32(d + b * 4, !1);
|
|
1815
1815
|
for (let b = 16; b < 64; b++) {
|
|
1816
1816
|
const z = c[b - 15], F = c[b - 2], ae = G(z, 7) ^ G(z, 18) ^ z >>> 3, Ie = G(F, 17) ^ G(F, 19) ^ F >>> 10;
|
|
1817
1817
|
c[b] = c[b - 16] + ae + c[b - 7] + Ie >>> 0;
|
|
1818
1818
|
}
|
|
1819
|
-
let l =
|
|
1819
|
+
let l = s[0], f = s[1], p = s[2], v = s[3], w = s[4], $ = s[5], E = s[6], C = s[7];
|
|
1820
1820
|
for (let b = 0; b < 64; b++) {
|
|
1821
|
-
const z = G(w, 6) ^ G(w, 11) ^ G(w, 25), F = w & $ ^ ~w & E, ae = C + z + F +
|
|
1821
|
+
const z = G(w, 6) ^ G(w, 11) ^ G(w, 25), F = w & $ ^ ~w & E, ae = C + z + F + Bi[b] + c[b] >>> 0, Ie = (G(l, 2) ^ G(l, 13) ^ G(l, 22)) + (l & f ^ l & p ^ f & p) >>> 0;
|
|
1822
1822
|
C = E, E = $, $ = w, w = v + ae >>> 0, v = p, p = f, f = l, l = ae + Ie >>> 0;
|
|
1823
1823
|
}
|
|
1824
|
-
|
|
1824
|
+
s[0] = s[0] + l >>> 0, s[1] = s[1] + f >>> 0, s[2] = s[2] + p >>> 0, s[3] = s[3] + v >>> 0, s[4] = s[4] + w >>> 0, s[5] = s[5] + $ >>> 0, s[6] = s[6] + E >>> 0, s[7] = s[7] + C >>> 0;
|
|
1825
1825
|
}
|
|
1826
1826
|
const a = /* @__PURE__ */ new Uint8Array(32), u = new DataView(a.buffer);
|
|
1827
|
-
for (let d = 0; d < 8; d++) u.setUint32(d * 4,
|
|
1827
|
+
for (let d = 0; d < 8; d++) u.setUint32(d * 4, s[d], !1);
|
|
1828
1828
|
return a;
|
|
1829
1829
|
}
|
|
1830
1830
|
function Gi(e) {
|
|
1831
|
-
const t = Wi(St(e, !0)), n =
|
|
1831
|
+
const t = Wi(St(e, !0)), n = Ki(new TextEncoder().encode(t));
|
|
1832
1832
|
return Array.from(n.subarray(0, 8), (r) => r.toString(16).padStart(2, "0")).join("");
|
|
1833
1833
|
}
|
|
1834
1834
|
function St(e, t = !1) {
|
|
@@ -1869,22 +1869,22 @@ var Yi = class {
|
|
|
1869
1869
|
};
|
|
1870
1870
|
function Qt(e, t, n) {
|
|
1871
1871
|
const r = {}, o = {};
|
|
1872
|
-
for (const [
|
|
1873
|
-
const
|
|
1872
|
+
for (const [s, c] of Object.entries(t)) r[s] = Xi(s, c, o);
|
|
1873
|
+
const i = {
|
|
1874
1874
|
id: e.id,
|
|
1875
1875
|
hash: n,
|
|
1876
1876
|
methods: r
|
|
1877
1877
|
};
|
|
1878
|
-
return Object.keys(o).length > 0 && (
|
|
1878
|
+
return Object.keys(o).length > 0 && (i.components = { schemas: o }), e.description !== void 0 && (i.description = e.description), e.comment !== void 0 && (i.comment = e.comment), i;
|
|
1879
1879
|
}
|
|
1880
1880
|
function Xi(e, t, n) {
|
|
1881
1881
|
const r = t.docs;
|
|
1882
1882
|
if (t.kind === "request") {
|
|
1883
|
-
const
|
|
1883
|
+
const i = {
|
|
1884
1884
|
params: Ee(e, "params", t.paramsSchema, n),
|
|
1885
1885
|
result: Ee(e, "result", t.resultSchema, n)
|
|
1886
1886
|
};
|
|
1887
|
-
return t.clientStreamSchema !== void 0 && (
|
|
1887
|
+
return t.clientStreamSchema !== void 0 && (i.clientStream = Ee(e, "clientStream", t.clientStreamSchema, n)), t.serverStreamSchema !== void 0 && (i.serverStream = Ee(e, "serverStream", t.serverStreamSchema, n)), r.description !== void 0 && (i.description = r.description), r.comment !== void 0 && (i.comment = r.comment), r.annotations !== void 0 && (i.annotations = r.annotations), i;
|
|
1888
1888
|
}
|
|
1889
1889
|
const o = { params: Ee(e, "params", t.paramsSchema, n) };
|
|
1890
1890
|
return r.description !== void 0 && (o.description = r.description), r.comment !== void 0 && (o.comment = r.comment), r.annotations !== void 0 && (o.annotations = r.annotations), o;
|
|
@@ -2053,7 +2053,7 @@ const en = D({
|
|
|
2053
2053
|
portId: /* @__PURE__ */ m(),
|
|
2054
2054
|
requestId: /* @__PURE__ */ y(/* @__PURE__ */ je([/* @__PURE__ */ W(), /* @__PURE__ */ m()]))
|
|
2055
2055
|
}), cs = /* @__PURE__ */ g({
|
|
2056
|
-
type: /* @__PURE__ */
|
|
2056
|
+
type: /* @__PURE__ */ Kn("transit"),
|
|
2057
2057
|
ts: /* @__PURE__ */ W(),
|
|
2058
2058
|
nodeId: /* @__PURE__ */ m(),
|
|
2059
2059
|
in: /* @__PURE__ */ y(on),
|
|
@@ -2079,7 +2079,7 @@ const en = D({
|
|
|
2079
2079
|
data: /* @__PURE__ */ y(/* @__PURE__ */ de())
|
|
2080
2080
|
}))
|
|
2081
2081
|
}), as = /* @__PURE__ */ g({
|
|
2082
|
-
type: /* @__PURE__ */
|
|
2082
|
+
type: /* @__PURE__ */ Kn("overflow"),
|
|
2083
2083
|
dropped: (/* @__PURE__ */ W()).check(/* @__PURE__ */ ze(), /* @__PURE__ */ Re())
|
|
2084
2084
|
}), sn = /* @__PURE__ */ je([cs, as]), cn = /* @__PURE__ */ g({
|
|
2085
2085
|
delivered: (/* @__PURE__ */ W()).check(/* @__PURE__ */ ze(), /* @__PURE__ */ Re()),
|
|
@@ -2361,25 +2361,25 @@ var ar = class ur {
|
|
|
2361
2361
|
}
|
|
2362
2362
|
async sendRequest(t, n, r) {
|
|
2363
2363
|
this._throwIfClosed();
|
|
2364
|
-
const o = this._nextId++,
|
|
2364
|
+
const o = this._nextId++, i = {
|
|
2365
2365
|
jsonrpc: "2.0",
|
|
2366
2366
|
id: o,
|
|
2367
2367
|
method: t
|
|
2368
2368
|
};
|
|
2369
|
-
n !== void 0 && (
|
|
2370
|
-
const
|
|
2369
|
+
n !== void 0 && (i.params = n);
|
|
2370
|
+
const s = new Promise((c, a) => {
|
|
2371
2371
|
this._pending.set(String(o), {
|
|
2372
2372
|
resolve: c,
|
|
2373
2373
|
reject: a
|
|
2374
2374
|
});
|
|
2375
2375
|
});
|
|
2376
|
-
this._observeOutbound(
|
|
2376
|
+
this._observeOutbound(i, r);
|
|
2377
2377
|
try {
|
|
2378
|
-
await this._transport.send(
|
|
2378
|
+
await this._transport.send(i);
|
|
2379
2379
|
} catch (c) {
|
|
2380
2380
|
throw this._pending.delete(String(o)), this._observeSendFailure(o, c), c;
|
|
2381
2381
|
}
|
|
2382
|
-
return
|
|
2382
|
+
return s;
|
|
2383
2383
|
}
|
|
2384
2384
|
async sendNotification(t, n, r) {
|
|
2385
2385
|
this._throwIfClosed();
|
|
@@ -2391,23 +2391,23 @@ var ar = class ur {
|
|
|
2391
2391
|
}
|
|
2392
2392
|
sendRequestWithStream(t, n, r) {
|
|
2393
2393
|
this._throwIfClosed();
|
|
2394
|
-
const o = this._nextId++,
|
|
2395
|
-
let
|
|
2394
|
+
const o = this._nextId++, i = String(o);
|
|
2395
|
+
let s, c;
|
|
2396
2396
|
const a = new Promise((f, p) => {
|
|
2397
|
-
|
|
2397
|
+
s = f, c = p;
|
|
2398
2398
|
});
|
|
2399
|
-
this._pending.set(
|
|
2400
|
-
resolve:
|
|
2399
|
+
this._pending.set(i, {
|
|
2400
|
+
resolve: s,
|
|
2401
2401
|
reject: c
|
|
2402
|
-
}), r?.onStreamMessage && this._streamListeners.set(
|
|
2402
|
+
}), r?.onStreamMessage && this._streamListeners.set(i, r.onStreamMessage);
|
|
2403
2403
|
const u = this._makePinger(o, _e.toCallee);
|
|
2404
|
-
this._streamControl.set(
|
|
2404
|
+
this._streamControl.set(i, u.onControl);
|
|
2405
2405
|
const d = setInterval(() => {
|
|
2406
2406
|
this._sendStream(o, _e.toCallee, { control: { type: ne.ping } });
|
|
2407
2407
|
}, ys);
|
|
2408
2408
|
d.unref?.();
|
|
2409
2409
|
const l = () => {
|
|
2410
|
-
clearInterval(d), u.dispose(), this._streamControl.delete(
|
|
2410
|
+
clearInterval(d), u.dispose(), this._streamControl.delete(i);
|
|
2411
2411
|
};
|
|
2412
2412
|
return a.then(l, l), (async () => {
|
|
2413
2413
|
const f = {
|
|
@@ -2417,7 +2417,7 @@ var ar = class ur {
|
|
|
2417
2417
|
};
|
|
2418
2418
|
n !== void 0 && (f.params = n), this._observeOutbound(f, r), await this._transport.send(f);
|
|
2419
2419
|
})().catch((f) => {
|
|
2420
|
-
this._pending.delete(
|
|
2420
|
+
this._pending.delete(i), this._streamListeners.delete(i), this._observeSendFailure(o, f), l(), c(f instanceof Error ? f : new Error(String(f)));
|
|
2421
2421
|
}), {
|
|
2422
2422
|
result: a,
|
|
2423
2423
|
send: (f) => this._sendStream(o, _e.toCallee, { payload: f }),
|
|
@@ -2506,8 +2506,8 @@ var ar = class ur {
|
|
|
2506
2506
|
const r = String(t.id), o = this._pending.get(r);
|
|
2507
2507
|
if (!o) return;
|
|
2508
2508
|
if (this._pending.delete(r), this._streamListeners.delete(r), "error" in t) {
|
|
2509
|
-
const
|
|
2510
|
-
o.reject(
|
|
2509
|
+
const i = t.error, s = new oe(i.message, i.code, i.data);
|
|
2510
|
+
o.reject(s);
|
|
2511
2511
|
} else o.resolve(t.result);
|
|
2512
2512
|
return;
|
|
2513
2513
|
}
|
|
@@ -2535,11 +2535,11 @@ var ar = class ur {
|
|
|
2535
2535
|
this._streamControl.get(o)?.(n.control);
|
|
2536
2536
|
return;
|
|
2537
2537
|
}
|
|
2538
|
-
const
|
|
2539
|
-
|
|
2538
|
+
const i = this._streamListeners.get(o);
|
|
2539
|
+
i && i(n.payload);
|
|
2540
2540
|
}
|
|
2541
2541
|
async _handleRequest(t, n) {
|
|
2542
|
-
const r = String(t.id), o = this._makePinger(t.id, _e.toCaller),
|
|
2542
|
+
const r = String(t.id), o = this._makePinger(t.id, _e.toCaller), i = {
|
|
2543
2543
|
send: (a) => this._sendStream(t.id, _e.toCaller, { payload: a }),
|
|
2544
2544
|
onMessage: (a) => {
|
|
2545
2545
|
a ? this._streamListeners.set(r, a) : this._streamListeners.delete(r);
|
|
@@ -2548,9 +2548,9 @@ var ar = class ur {
|
|
|
2548
2548
|
markInspectionLifecycle: () => {
|
|
2549
2549
|
this._wireObserver !== void 0 && this._inboundInspectionRequests.add(r);
|
|
2550
2550
|
}
|
|
2551
|
-
},
|
|
2552
|
-
this._incomingAborts.set(r,
|
|
2553
|
-
a.type === ne.cancel ?
|
|
2551
|
+
}, s = new AbortController();
|
|
2552
|
+
this._incomingAborts.set(r, s), this._streamControl.set(r, (a) => {
|
|
2553
|
+
a.type === ne.cancel ? s.abort(new oe(a.reason ?? "cancelled", q.cancelled)) : o.onControl(a);
|
|
2554
2554
|
});
|
|
2555
2555
|
let c;
|
|
2556
2556
|
try {
|
|
@@ -2563,8 +2563,8 @@ var ar = class ur {
|
|
|
2563
2563
|
method: t.method,
|
|
2564
2564
|
params: t.params,
|
|
2565
2565
|
context: n,
|
|
2566
|
-
stream:
|
|
2567
|
-
signal:
|
|
2566
|
+
stream: i,
|
|
2567
|
+
signal: s.signal
|
|
2568
2568
|
});
|
|
2569
2569
|
} catch (a) {
|
|
2570
2570
|
c = { error: {
|
|
@@ -2630,8 +2630,8 @@ var ar = class ur {
|
|
|
2630
2630
|
o = at(n), o && this._outboundInspectionRequests.add(String(t.id));
|
|
2631
2631
|
else if (He(t)) {
|
|
2632
2632
|
if (t.id !== null) {
|
|
2633
|
-
const
|
|
2634
|
-
o = this._inboundInspectionRequests.delete(
|
|
2633
|
+
const i = String(t.id);
|
|
2634
|
+
o = this._inboundInspectionRequests.delete(i);
|
|
2635
2635
|
}
|
|
2636
2636
|
} else t.method === ve ? o = this._isInspectionStream(t) : o = at(n);
|
|
2637
2637
|
o || r("outbound", t);
|
|
@@ -2681,7 +2681,7 @@ var $s = class {
|
|
|
2681
2681
|
constructor(e, t, n, r = zs) {
|
|
2682
2682
|
this._options = e, this._send = t, this._onDispose = n, this._queueLimit = r;
|
|
2683
2683
|
let o;
|
|
2684
|
-
this.closed = new Promise((
|
|
2684
|
+
this.closed = new Promise((i) => o = i), this._resolveClosed = o;
|
|
2685
2685
|
}
|
|
2686
2686
|
enqueue(e) {
|
|
2687
2687
|
if (!this._active || this._options.methodPrefix !== void 0 && !e.method?.startsWith(this._options.methodPrefix)) return;
|
|
@@ -2748,9 +2748,9 @@ function ut(e, t) {
|
|
|
2748
2748
|
const r = new TextEncoder().encode(n);
|
|
2749
2749
|
if (r.byteLength <= t) return e;
|
|
2750
2750
|
const o = new TextEncoder();
|
|
2751
|
-
let
|
|
2752
|
-
for (; o.encode(
|
|
2753
|
-
return
|
|
2751
|
+
let i = new TextDecoder().decode(r.slice(0, t));
|
|
2752
|
+
for (; o.encode(i).byteLength > t; ) i = i.slice(0, -1);
|
|
2753
|
+
return i;
|
|
2754
2754
|
}
|
|
2755
2755
|
var Is = class {
|
|
2756
2756
|
_nodeId;
|
|
@@ -2790,7 +2790,7 @@ var Is = class {
|
|
|
2790
2790
|
if (this._subscribers.size === 0 && this._observers.size === 0) return;
|
|
2791
2791
|
const n = Date.now();
|
|
2792
2792
|
let r;
|
|
2793
|
-
const o = this._endpoint("id" in t ? t.id ?? void 0 : void 0),
|
|
2793
|
+
const o = this._endpoint("id" in t ? t.id ?? void 0 : void 0), i = {
|
|
2794
2794
|
type: "transit",
|
|
2795
2795
|
ts: n,
|
|
2796
2796
|
nodeId: this._nodeId,
|
|
@@ -2798,42 +2798,42 @@ var Is = class {
|
|
|
2798
2798
|
disposition: e === "inbound" ? "consumed" : "forwarded"
|
|
2799
2799
|
};
|
|
2800
2800
|
if (Pe(t)) {
|
|
2801
|
-
const
|
|
2802
|
-
this._requestMap(e).set(String(t.id),
|
|
2803
|
-
...
|
|
2801
|
+
const s = { method: t.method };
|
|
2802
|
+
this._requestMap(e).set(String(t.id), s), r = {
|
|
2803
|
+
...i,
|
|
2804
2804
|
kind: "request",
|
|
2805
2805
|
method: t.method,
|
|
2806
2806
|
params: t.params
|
|
2807
2807
|
};
|
|
2808
2808
|
} else if (He(t)) {
|
|
2809
|
-
const
|
|
2810
|
-
|
|
2811
|
-
...
|
|
2809
|
+
const s = e === "inbound" ? this._outboundRequests : this._inboundRequests, c = String(t.id), a = s.get(c);
|
|
2810
|
+
s.delete(c), r = {
|
|
2811
|
+
...i,
|
|
2812
2812
|
kind: "response",
|
|
2813
2813
|
method: a?.method,
|
|
2814
2814
|
result: "result" in t ? t.result : void 0,
|
|
2815
2815
|
error: "error" in t ? t.error : void 0
|
|
2816
2816
|
};
|
|
2817
2817
|
} else if (rr(t) && t.method === ve) {
|
|
2818
|
-
const
|
|
2818
|
+
const s = t.params, c = this._endpoint(s?.requestId);
|
|
2819
2819
|
r = {
|
|
2820
|
-
...
|
|
2820
|
+
...i,
|
|
2821
2821
|
...e === "inbound" ? { in: c } : { out: c },
|
|
2822
2822
|
kind: "stream",
|
|
2823
2823
|
method: ve,
|
|
2824
2824
|
params: t.params
|
|
2825
2825
|
};
|
|
2826
2826
|
} else r = {
|
|
2827
|
-
...
|
|
2827
|
+
...i,
|
|
2828
2828
|
kind: "notification",
|
|
2829
2829
|
method: t.method,
|
|
2830
2830
|
params: t.params
|
|
2831
2831
|
};
|
|
2832
|
-
for (const
|
|
2833
|
-
|
|
2832
|
+
for (const s of [...this._observers]) try {
|
|
2833
|
+
s(r);
|
|
2834
2834
|
} catch {
|
|
2835
2835
|
}
|
|
2836
|
-
for (const
|
|
2836
|
+
for (const s of this._subscribers) s.enqueue(r);
|
|
2837
2837
|
}
|
|
2838
2838
|
_requestMap(e) {
|
|
2839
2839
|
return e === "outbound" ? this._outboundRequests : this._inboundRequests;
|
|
@@ -2901,35 +2901,35 @@ var Is = class {
|
|
|
2901
2901
|
return this._register(t, n, r, !1);
|
|
2902
2902
|
}
|
|
2903
2903
|
_register(t, n, r, o) {
|
|
2904
|
-
const
|
|
2905
|
-
if (this._registry.has(
|
|
2904
|
+
const i = r.serviceId, s = `${i ?? ""}::${t.info.id}`;
|
|
2905
|
+
if (this._registry.has(s)) throw new Error(`Interface "${t.info.id}" already registered${i ? ` under service "${i}"` : ""}.`);
|
|
2906
2906
|
let c = !1;
|
|
2907
2907
|
if (r.serviceDescription !== void 0) {
|
|
2908
|
-
if (
|
|
2909
|
-
const d = this._serviceDescriptions.get(
|
|
2910
|
-
if (d !== void 0 && d !== r.serviceDescription) throw new Error(`register: conflicting descriptions for service "${
|
|
2911
|
-
this._serviceDescriptions.set(
|
|
2908
|
+
if (i === void 0) throw new Error("register: `serviceDescription` requires `serviceId`.");
|
|
2909
|
+
const d = this._serviceDescriptions.get(i);
|
|
2910
|
+
if (d !== void 0 && d !== r.serviceDescription) throw new Error(`register: conflicting descriptions for service "${i}".`);
|
|
2911
|
+
this._serviceDescriptions.set(i, r.serviceDescription), c = d === void 0;
|
|
2912
2912
|
}
|
|
2913
2913
|
if (r.rootPrincipalSets !== void 0) {
|
|
2914
|
-
if (
|
|
2915
|
-
const d = this._serviceRootPrincipalSets.get(
|
|
2916
|
-
if (d !== void 0 && !Os(d, r.rootPrincipalSets)) throw new Error(`register: conflicting rootPrincipalSets for service "${
|
|
2917
|
-
this._serviceRootPrincipalSets.set(
|
|
2914
|
+
if (i === void 0) throw new Error("register: `rootPrincipalSets` requires `serviceId`.");
|
|
2915
|
+
const d = this._serviceRootPrincipalSets.get(i);
|
|
2916
|
+
if (d !== void 0 && !Os(d, r.rootPrincipalSets)) throw new Error(`register: conflicting rootPrincipalSets for service "${i}".`);
|
|
2917
|
+
this._serviceRootPrincipalSets.set(i, r.rootPrincipalSets), c ||= d === void 0;
|
|
2918
2918
|
}
|
|
2919
2919
|
const a = {
|
|
2920
2920
|
iface: t,
|
|
2921
2921
|
handlers: n,
|
|
2922
|
-
serviceId:
|
|
2922
|
+
serviceId: i,
|
|
2923
2923
|
internalInspection: o
|
|
2924
2924
|
};
|
|
2925
|
-
if (this._registry.set(
|
|
2926
|
-
this._installServiceInspection(
|
|
2925
|
+
if (this._registry.set(s, a), this._notifyDirectoryWatchers(a, c), !o && i !== void 0 && this._inspection !== void 0 && !this._serviceInspectionRegistrations.has(i)) try {
|
|
2926
|
+
this._installServiceInspection(i);
|
|
2927
2927
|
} catch (d) {
|
|
2928
|
-
throw this._registry.delete(
|
|
2928
|
+
throw this._registry.delete(s), this._notifyDirectoryWatchers(a), d;
|
|
2929
2929
|
}
|
|
2930
2930
|
let u = !1;
|
|
2931
2931
|
return { dispose: () => {
|
|
2932
|
-
u || (u = !0, this._registry.get(
|
|
2932
|
+
u || (u = !0, this._registry.get(s) === a && (this._registry.delete(s), this._notifyDirectoryWatchers(a), i === void 0 && this._preset?.interfaceId === t.info.id && (this._preset = void 0), i !== void 0 && !this._hasBusinessServiceRegistration(i) && (this._removeServiceInspection(i), this._serviceDescriptions.delete(i), this._serviceRootPrincipalSets.delete(i))));
|
|
2933
2933
|
} };
|
|
2934
2934
|
}
|
|
2935
2935
|
/**
|
|
@@ -2955,8 +2955,8 @@ var Is = class {
|
|
|
2955
2955
|
interfaceHash: t.iface.schemaHash
|
|
2956
2956
|
}, o = n === "" ? void 0 : this._serviceDescriptions.get(n);
|
|
2957
2957
|
o !== void 0 && (r.serviceDescription = o);
|
|
2958
|
-
const
|
|
2959
|
-
return
|
|
2958
|
+
const i = n === "" ? void 0 : this._serviceRootPrincipalSets.get(n);
|
|
2959
|
+
return i !== void 0 && (r.rootPrincipalSets = i), r;
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
2962
2962
|
/** Subscribe to coarse local directory changes; listeners must re-list. */
|
|
@@ -2991,12 +2991,12 @@ var Is = class {
|
|
|
2991
2991
|
} };
|
|
2992
2992
|
const r = `${t.serviceId ?? ""}::`;
|
|
2993
2993
|
for (const c of [tn, nn]) if (this._registry.has(`${r}${c.info.id}`)) throw new Error(`enableReflection: partial reflection registration for service "${t.serviceId ?? ""}".`);
|
|
2994
|
-
const o = t.serviceId !== void 0 ? { serviceId: t.serviceId } : {},
|
|
2995
|
-
if (
|
|
2994
|
+
const o = t.serviceId !== void 0 ? { serviceId: t.serviceId } : {}, i = [];
|
|
2995
|
+
if (i.push(this.register(en, { get: () => this._preset ? {
|
|
2996
2996
|
serviceId: this._preset.serviceId,
|
|
2997
2997
|
interfaceId: this._preset.interfaceId,
|
|
2998
2998
|
interfaceHash: this._preset.hash
|
|
2999
|
-
} : {} }, o)),
|
|
2999
|
+
} : {} }, o)), i.push(this.register(tn, {
|
|
3000
3000
|
list: ({ interfaceId: c, interfaceIdPrefix: a, serviceId: u, serviceIdScopes: d, cursor: l, limit: f }) => {
|
|
3001
3001
|
const p = this.listRegisteredInterfaces().filter((E) => t.serviceId === void 0 || E.serviceId === t.serviceId).filter((E) => c === void 0 || E.interfaceId === c).filter((E) => a === void 0 || E.interfaceId.startsWith(a)).filter((E) => u === void 0 || E.serviceId === u).filter((E) => cr(E.serviceId, d)), v = l === void 0 ? 0 : Number.parseInt(l, 10) || 0, w = f === void 0 ? p.length : Math.min(p.length, v + f), $ = p.slice(v, w).map((E) => ({
|
|
3002
3002
|
serviceId: E.serviceId,
|
|
@@ -3028,7 +3028,7 @@ var Is = class {
|
|
|
3028
3028
|
}
|
|
3029
3029
|
u.signal.addEventListener("abort", f, { once: !0 });
|
|
3030
3030
|
})
|
|
3031
|
-
}, o)),
|
|
3031
|
+
}, o)), i.push(this.register(nn, { get: ({ interfaceId: c, hash: a }) => {
|
|
3032
3032
|
const u = this.findRegisteredInterface(c, a);
|
|
3033
3033
|
if (!u) throw new oe("Interface not found", q.methodNotFound, {
|
|
3034
3034
|
reason: "unknown-interface",
|
|
@@ -3039,14 +3039,14 @@ var Is = class {
|
|
|
3039
3039
|
} }, o)), t.serviceId !== void 0) try {
|
|
3040
3040
|
this.enableReflection();
|
|
3041
3041
|
} catch (c) {
|
|
3042
|
-
for (const a of
|
|
3042
|
+
for (const a of i.reverse()) a.dispose();
|
|
3043
3043
|
throw c;
|
|
3044
3044
|
}
|
|
3045
|
-
let
|
|
3045
|
+
let s = !1;
|
|
3046
3046
|
return { dispose: () => {
|
|
3047
|
-
if (!
|
|
3048
|
-
|
|
3049
|
-
for (const c of
|
|
3047
|
+
if (!s) {
|
|
3048
|
+
s = !0;
|
|
3049
|
+
for (const c of i.reverse()) c.dispose();
|
|
3050
3050
|
}
|
|
3051
3051
|
} };
|
|
3052
3052
|
}
|
|
@@ -3057,8 +3057,8 @@ var Is = class {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
for (const r of this._directoryWatchers) {
|
|
3059
3059
|
if (r.pending) continue;
|
|
3060
|
-
const o = un(r, t),
|
|
3061
|
-
!o && !
|
|
3060
|
+
const o = un(r, t), i = n && t.serviceId !== void 0 && [...this._registry.values()].some((s) => s.serviceId === t.serviceId && un(r, s));
|
|
3061
|
+
!o && !i || (r.pending = !0, queueMicrotask(() => {
|
|
3062
3062
|
r.pending = !1, this._directoryWatchers.has(r) && r.send();
|
|
3063
3063
|
}));
|
|
3064
3064
|
}
|
|
@@ -3078,26 +3078,26 @@ var Is = class {
|
|
|
3078
3078
|
...t !== void 0 ? { descriptors: [...t] } : {}
|
|
3079
3079
|
}, r = this._register(It, { getNodeId: () => n }, {}, !0), o = new Is(n.nodeId, n.portId, (c) => this._wireChannel?.setWireMessageObserver(c ? o.observe : void 0, c ? (a) => this._isInspectionMethod(a) : void 0));
|
|
3080
3080
|
this._trafficInspector = o;
|
|
3081
|
-
let
|
|
3082
|
-
const
|
|
3081
|
+
let i = !1;
|
|
3082
|
+
const s = {
|
|
3083
3083
|
...n,
|
|
3084
3084
|
observeTraffic: (c) => o.observeTransits(c),
|
|
3085
3085
|
dispose: () => {
|
|
3086
|
-
if (!
|
|
3087
|
-
|
|
3086
|
+
if (!i) {
|
|
3087
|
+
i = !0;
|
|
3088
3088
|
for (const c of [...this._serviceInspectionRegistrations.keys()]) this._removeServiceInspection(c);
|
|
3089
|
-
o.dispose(), this._trafficInspector === o && (this._trafficInspector = void 0), r.dispose(), this._inspection ===
|
|
3089
|
+
o.dispose(), this._trafficInspector === o && (this._trafficInspector = void 0), r.dispose(), this._inspection === s && (this._inspection = void 0);
|
|
3090
3090
|
}
|
|
3091
3091
|
}
|
|
3092
3092
|
};
|
|
3093
|
-
this._inspection =
|
|
3093
|
+
this._inspection = s;
|
|
3094
3094
|
try {
|
|
3095
3095
|
const c = new Set(Array.from(this._registry.values()).filter((a) => a.serviceId !== void 0 && !a.internalInspection).map((a) => a.serviceId));
|
|
3096
3096
|
for (const a of c) this._installServiceInspection(a);
|
|
3097
3097
|
} catch (c) {
|
|
3098
|
-
throw
|
|
3098
|
+
throw s.dispose(), c;
|
|
3099
3099
|
}
|
|
3100
|
-
return
|
|
3100
|
+
return s;
|
|
3101
3101
|
}
|
|
3102
3102
|
/** Number of active endpoint traffic stream subscribers. */
|
|
3103
3103
|
get trafficObserverCount() {
|
|
@@ -3107,7 +3107,7 @@ var Is = class {
|
|
|
3107
3107
|
this.channel.close();
|
|
3108
3108
|
}
|
|
3109
3109
|
_buildClient(t, n) {
|
|
3110
|
-
const { serviceId: r, ...o } = n,
|
|
3110
|
+
const { serviceId: r, ...o } = n, i = o, s = t.schemaHash, c = dt(t), a = {};
|
|
3111
3111
|
for (const [u, d] of Object.entries(t.members)) {
|
|
3112
3112
|
const l = r ? `${r}::${t.info.id}::${u}` : `${t.info.id}::${u}`;
|
|
3113
3113
|
if (d.kind === "request") if (d.clientStreamSchema !== void 0 || d.serverStreamSchema !== void 0) {
|
|
@@ -3122,12 +3122,12 @@ var Is = class {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
w(z);
|
|
3124
3124
|
} : void 0, E = $ !== void 0 ? {
|
|
3125
|
-
ctx:
|
|
3126
|
-
interfaceHash:
|
|
3125
|
+
ctx: i,
|
|
3126
|
+
interfaceHash: s,
|
|
3127
3127
|
onStreamMessage: $
|
|
3128
3128
|
} : {
|
|
3129
|
-
ctx:
|
|
3130
|
-
interfaceHash:
|
|
3129
|
+
ctx: i,
|
|
3130
|
+
interfaceHash: s
|
|
3131
3131
|
};
|
|
3132
3132
|
c && ct(E);
|
|
3133
3133
|
const C = this.channel.sendRequestWithStream(l, p, E), b = C.result.then((z) => {
|
|
@@ -3145,8 +3145,8 @@ var Is = class {
|
|
|
3145
3145
|
const f = d.resultSchema;
|
|
3146
3146
|
a[u] = async (p) => {
|
|
3147
3147
|
const v = {
|
|
3148
|
-
ctx:
|
|
3149
|
-
interfaceHash:
|
|
3148
|
+
ctx: i,
|
|
3149
|
+
interfaceHash: s
|
|
3150
3150
|
};
|
|
3151
3151
|
c && ct(v);
|
|
3152
3152
|
const w = await this.channel.sendRequest(l, p, v), $ = Y(f, w === null ? void 0 : w);
|
|
@@ -3156,8 +3156,8 @@ var Is = class {
|
|
|
3156
3156
|
}
|
|
3157
3157
|
else a[u] = async (f) => {
|
|
3158
3158
|
const p = {
|
|
3159
|
-
ctx:
|
|
3160
|
-
interfaceHash:
|
|
3159
|
+
ctx: i,
|
|
3160
|
+
interfaceHash: s
|
|
3161
3161
|
};
|
|
3162
3162
|
c && ct(p), this.channel.sendNotification(l, f, p);
|
|
3163
3163
|
};
|
|
@@ -3167,22 +3167,22 @@ var Is = class {
|
|
|
3167
3167
|
async _handleRequest(t) {
|
|
3168
3168
|
const n = this._parseRouted(t.method);
|
|
3169
3169
|
if (!n.ok) return De(n.reason, t.method);
|
|
3170
|
-
const { entry: r, memberName: o } = n,
|
|
3171
|
-
if (!s) return De("unknown-method", t.method);
|
|
3172
|
-
const i = r.handlers[o];
|
|
3170
|
+
const { entry: r, memberName: o } = n, i = r.iface.members[o];
|
|
3173
3171
|
if (!i) return De("unknown-method", t.method);
|
|
3174
|
-
const
|
|
3172
|
+
const s = r.handlers[o];
|
|
3173
|
+
if (!s) return De("unknown-method", t.method);
|
|
3174
|
+
const c = Y(i.paramsSchema, t.params);
|
|
3175
3175
|
if (!c.success) return { error: {
|
|
3176
3176
|
code: q.invalidParams,
|
|
3177
3177
|
message: "Invalid params",
|
|
3178
3178
|
data: { issues: c.error.issues }
|
|
3179
3179
|
} };
|
|
3180
|
-
if (!(
|
|
3181
|
-
const a = this._buildStreamApi(t.stream, t.signal,
|
|
3180
|
+
if (!(i instanceof Gn)) return De("unknown-method", t.method);
|
|
3181
|
+
const a = this._buildStreamApi(t.stream, t.signal, i);
|
|
3182
3182
|
try {
|
|
3183
|
-
const u =
|
|
3183
|
+
const u = s(c.data, t.context, a);
|
|
3184
3184
|
dt(r.iface) && t.stream.markInspectionLifecycle();
|
|
3185
|
-
const d = await u, l = Y(
|
|
3185
|
+
const d = await u, l = Y(i.resultSchema, d);
|
|
3186
3186
|
return l.success ? { result: d === void 0 ? null : d } : { error: {
|
|
3187
3187
|
code: q.internalError,
|
|
3188
3188
|
message: `Invalid result for ${t.method}`,
|
|
@@ -3203,17 +3203,17 @@ var Is = class {
|
|
|
3203
3203
|
return {
|
|
3204
3204
|
send: (o) => {
|
|
3205
3205
|
if (r.serverStreamSchema) {
|
|
3206
|
-
const
|
|
3207
|
-
if (!
|
|
3206
|
+
const i = Y(r.serverStreamSchema, o);
|
|
3207
|
+
if (!i.success) throw new Error(`Server stream payload failed schema validation: ${i.error.message}`);
|
|
3208
3208
|
}
|
|
3209
3209
|
return t.send(o);
|
|
3210
3210
|
},
|
|
3211
3211
|
onMessage: (o) => {
|
|
3212
|
-
t.onMessage((
|
|
3212
|
+
t.onMessage((i) => {
|
|
3213
3213
|
if (r.clientStreamSchema) {
|
|
3214
|
-
const
|
|
3215
|
-
if (!
|
|
3216
|
-
o(
|
|
3214
|
+
const s = Y(r.clientStreamSchema, i);
|
|
3215
|
+
if (!s.success) return;
|
|
3216
|
+
o(s.data);
|
|
3217
3217
|
return;
|
|
3218
3218
|
}
|
|
3219
3219
|
});
|
|
@@ -3225,12 +3225,12 @@ var Is = class {
|
|
|
3225
3225
|
_handleNotification(t) {
|
|
3226
3226
|
const n = this._parseRouted(t.method);
|
|
3227
3227
|
if (!n.ok) return;
|
|
3228
|
-
const { entry: r, memberName: o } = n,
|
|
3229
|
-
if (!(
|
|
3230
|
-
const
|
|
3231
|
-
if (!
|
|
3232
|
-
const c = Y(
|
|
3233
|
-
c.success &&
|
|
3228
|
+
const { entry: r, memberName: o } = n, i = r.iface.members[o];
|
|
3229
|
+
if (!(i instanceof Xn)) return;
|
|
3230
|
+
const s = r.handlers[o];
|
|
3231
|
+
if (!s) return;
|
|
3232
|
+
const c = Y(i.paramsSchema, t.params);
|
|
3233
|
+
c.success && s(c.data, t.context);
|
|
3234
3234
|
}
|
|
3235
3235
|
_parseRouted(t) {
|
|
3236
3236
|
const n = ps(t);
|
|
@@ -3243,20 +3243,20 @@ var Is = class {
|
|
|
3243
3243
|
ok: !1,
|
|
3244
3244
|
reason: "no-preset"
|
|
3245
3245
|
};
|
|
3246
|
-
const
|
|
3247
|
-
return
|
|
3246
|
+
const s = this._registry.get(`::${this._preset.interfaceId}`);
|
|
3247
|
+
return s ? {
|
|
3248
3248
|
ok: !0,
|
|
3249
|
-
entry:
|
|
3249
|
+
entry: s,
|
|
3250
3250
|
memberName: n.member
|
|
3251
3251
|
} : {
|
|
3252
3252
|
ok: !1,
|
|
3253
3253
|
reason: "no-preset"
|
|
3254
3254
|
};
|
|
3255
3255
|
}
|
|
3256
|
-
const r = n.kind === "full" ? n.serviceId : void 0, o = `${r ?? ""}::${n.interfaceId}`,
|
|
3257
|
-
return
|
|
3256
|
+
const r = n.kind === "full" ? n.serviceId : void 0, o = `${r ?? ""}::${n.interfaceId}`, i = this._registry.get(o);
|
|
3257
|
+
return i ? {
|
|
3258
3258
|
ok: !0,
|
|
3259
|
-
entry:
|
|
3259
|
+
entry: i,
|
|
3260
3260
|
memberName: n.member
|
|
3261
3261
|
} : {
|
|
3262
3262
|
ok: !1,
|
|
@@ -3267,24 +3267,24 @@ var Is = class {
|
|
|
3267
3267
|
if (this._serviceInspectionRegistrations.has(t)) return;
|
|
3268
3268
|
const n = this._inspection, r = this._trafficInspector;
|
|
3269
3269
|
if (n === void 0 || r === void 0) return;
|
|
3270
|
-
const o = [],
|
|
3270
|
+
const o = [], i = { serviceId: t };
|
|
3271
3271
|
try {
|
|
3272
3272
|
o.push(this._register(It, { getNodeId: () => ({
|
|
3273
3273
|
nodeId: n.nodeId,
|
|
3274
3274
|
portId: n.portId
|
|
3275
|
-
}) },
|
|
3275
|
+
}) }, i, !0)), o.push(this._register(tr, {
|
|
3276
3276
|
getGraph: () => this._endpointGraph(t, n),
|
|
3277
|
-
watchGraph: async (
|
|
3278
|
-
},
|
|
3279
|
-
watch: ({ methodPrefix:
|
|
3280
|
-
watchWithPayloads: ({ methodPrefix:
|
|
3281
|
-
methodPrefix:
|
|
3277
|
+
watchGraph: async (s, c, a) => (await Ts(a.signal), {})
|
|
3278
|
+
}, i, !0)), o.push(this._register(nr, {
|
|
3279
|
+
watch: ({ methodPrefix: s }, c, a) => this._watchTraffic(r, { methodPrefix: s }, a),
|
|
3280
|
+
watchWithPayloads: ({ methodPrefix: s, maxPayloadBytes: c }, a, u) => this._watchTraffic(r, {
|
|
3281
|
+
methodPrefix: s,
|
|
3282
3282
|
maxPayloadBytes: c
|
|
3283
3283
|
}, u)
|
|
3284
|
-
},
|
|
3285
|
-
} catch (
|
|
3284
|
+
}, i, !0));
|
|
3285
|
+
} catch (s) {
|
|
3286
3286
|
for (const c of o.reverse()) c.dispose();
|
|
3287
|
-
throw
|
|
3287
|
+
throw s;
|
|
3288
3288
|
}
|
|
3289
3289
|
this._serviceInspectionRegistrations.set(t, o);
|
|
3290
3290
|
}
|
|
@@ -3322,12 +3322,12 @@ var Is = class {
|
|
|
3322
3322
|
};
|
|
3323
3323
|
}
|
|
3324
3324
|
async _watchTraffic(t, n, r) {
|
|
3325
|
-
const o = t.subscribe(n, (
|
|
3326
|
-
r.signal.aborted ?
|
|
3325
|
+
const o = t.subscribe(n, (s) => r.send(s)), i = () => o.dispose();
|
|
3326
|
+
r.signal.aborted ? i() : r.signal.addEventListener("abort", i, { once: !0 });
|
|
3327
3327
|
try {
|
|
3328
3328
|
return await o.closed;
|
|
3329
3329
|
} finally {
|
|
3330
|
-
r.signal.removeEventListener("abort",
|
|
3330
|
+
r.signal.removeEventListener("abort", i), o.dispose();
|
|
3331
3331
|
}
|
|
3332
3332
|
}
|
|
3333
3333
|
};
|
|
@@ -3340,8 +3340,8 @@ function Os(e, t) {
|
|
|
3340
3340
|
for (let n = 0; n < e.length; n++) {
|
|
3341
3341
|
const r = e[n], o = t[n];
|
|
3342
3342
|
if (r.length !== o.length) return !1;
|
|
3343
|
-
for (let
|
|
3344
|
-
if (r[
|
|
3343
|
+
for (let i = 0; i < r.length; i++)
|
|
3344
|
+
if (r[i].principal !== o[i].principal || r[i].transitive === !0 != (o[i].transitive === !0)) return !1;
|
|
3345
3345
|
}
|
|
3346
3346
|
return !0;
|
|
3347
3347
|
}
|
|
@@ -3400,8 +3400,8 @@ function Zs(e, t) {
|
|
|
3400
3400
|
return r in t && (delete t[r], o = !0), r in e && (delete e[r], o = !0), o;
|
|
3401
3401
|
},
|
|
3402
3402
|
ownKeys(n) {
|
|
3403
|
-
const r = Reflect.ownKeys(e), o = Reflect.ownKeys(t),
|
|
3404
|
-
return [...r.filter((
|
|
3403
|
+
const r = Reflect.ownKeys(e), o = Reflect.ownKeys(t), i = new Set(o);
|
|
3404
|
+
return [...r.filter((s) => !i.has(s)), ...o];
|
|
3405
3405
|
},
|
|
3406
3406
|
defineProperty(n, r, o) {
|
|
3407
3407
|
return r in t && delete t[r], Reflect.defineProperty(e, r, o), !0;
|
|
@@ -3478,30 +3478,30 @@ function h(e, t, n) {
|
|
|
3478
3478
|
if (c._zod || Object.defineProperty(c, "_zod", {
|
|
3479
3479
|
value: {
|
|
3480
3480
|
def: a,
|
|
3481
|
-
constr:
|
|
3481
|
+
constr: s,
|
|
3482
3482
|
traits: /* @__PURE__ */ new Set()
|
|
3483
3483
|
},
|
|
3484
3484
|
enumerable: !1
|
|
3485
3485
|
}), c._zod.traits.has(e)) return;
|
|
3486
3486
|
c._zod.traits.add(e), t(c, a);
|
|
3487
|
-
const u =
|
|
3487
|
+
const u = s.prototype, d = Object.keys(u);
|
|
3488
3488
|
for (let l = 0; l < d.length; l++) {
|
|
3489
3489
|
const f = d[l];
|
|
3490
3490
|
f in c || (c[f] = u[f].bind(c));
|
|
3491
3491
|
}
|
|
3492
3492
|
}
|
|
3493
3493
|
const o = n?.Parent ?? Object;
|
|
3494
|
-
class
|
|
3494
|
+
class i extends o {
|
|
3495
3495
|
}
|
|
3496
|
-
Object.defineProperty(
|
|
3497
|
-
function
|
|
3496
|
+
Object.defineProperty(i, "name", { value: e });
|
|
3497
|
+
function s(c) {
|
|
3498
3498
|
var a;
|
|
3499
|
-
const u = n?.Parent ? new
|
|
3499
|
+
const u = n?.Parent ? new i() : this;
|
|
3500
3500
|
r(u, c), (a = u._zod).deferred ?? (a.deferred = []);
|
|
3501
3501
|
for (const d of u._zod.deferred) d();
|
|
3502
3502
|
return u;
|
|
3503
3503
|
}
|
|
3504
|
-
return Object.defineProperty(
|
|
3504
|
+
return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, { value: (c) => n?.Parent && c instanceof n.Parent ? !0 : c?._zod?.traits?.has(e) }), Object.defineProperty(s, "name", { value: e }), s;
|
|
3505
3505
|
}
|
|
3506
3506
|
var be = class extends Error {
|
|
3507
3507
|
constructor() {
|
|
@@ -3643,9 +3643,9 @@ function Fs(e, t) {
|
|
|
3643
3643
|
return ce(e, se(e._zod.def, {
|
|
3644
3644
|
get shape() {
|
|
3645
3645
|
const o = {};
|
|
3646
|
-
for (const
|
|
3647
|
-
if (!(
|
|
3648
|
-
t[
|
|
3646
|
+
for (const i in t) {
|
|
3647
|
+
if (!(i in n.shape)) throw new Error(`Unrecognized key: "${i}"`);
|
|
3648
|
+
t[i] && (o[i] = n.shape[i]);
|
|
3649
3649
|
}
|
|
3650
3650
|
return me(this, "shape", o), o;
|
|
3651
3651
|
},
|
|
@@ -3658,9 +3658,9 @@ function Ls(e, t) {
|
|
|
3658
3658
|
return ce(e, se(e._zod.def, {
|
|
3659
3659
|
get shape() {
|
|
3660
3660
|
const o = { ...e._zod.def.shape };
|
|
3661
|
-
for (const
|
|
3662
|
-
if (!(
|
|
3663
|
-
t[
|
|
3661
|
+
for (const i in t) {
|
|
3662
|
+
if (!(i in n.shape)) throw new Error(`Unrecognized key: "${i}"`);
|
|
3663
|
+
t[i] && delete o[i];
|
|
3664
3664
|
}
|
|
3665
3665
|
return me(this, "shape", o), o;
|
|
3666
3666
|
},
|
|
@@ -3713,19 +3713,19 @@ function Hs(e, t, n) {
|
|
|
3713
3713
|
if (r && r.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
3714
3714
|
return ce(t, se(t._zod.def, {
|
|
3715
3715
|
get shape() {
|
|
3716
|
-
const o = t._zod.def.shape,
|
|
3717
|
-
if (n) for (const
|
|
3718
|
-
if (!(
|
|
3719
|
-
n[
|
|
3716
|
+
const o = t._zod.def.shape, i = { ...o };
|
|
3717
|
+
if (n) for (const s in n) {
|
|
3718
|
+
if (!(s in o)) throw new Error(`Unrecognized key: "${s}"`);
|
|
3719
|
+
n[s] && (i[s] = e ? new e({
|
|
3720
3720
|
type: "optional",
|
|
3721
|
-
innerType: o[
|
|
3722
|
-
}) : o[
|
|
3721
|
+
innerType: o[s]
|
|
3722
|
+
}) : o[s]);
|
|
3723
3723
|
}
|
|
3724
|
-
else for (const
|
|
3724
|
+
else for (const s in o) i[s] = e ? new e({
|
|
3725
3725
|
type: "optional",
|
|
3726
|
-
innerType: o[
|
|
3727
|
-
}) : o[
|
|
3728
|
-
return me(this, "shape",
|
|
3726
|
+
innerType: o[s]
|
|
3727
|
+
}) : o[s];
|
|
3728
|
+
return me(this, "shape", i), i;
|
|
3729
3729
|
},
|
|
3730
3730
|
checks: []
|
|
3731
3731
|
}));
|
|
@@ -3733,16 +3733,16 @@ function Hs(e, t, n) {
|
|
|
3733
3733
|
function Vs(e, t, n) {
|
|
3734
3734
|
return ce(t, se(t._zod.def, { get shape() {
|
|
3735
3735
|
const r = t._zod.def.shape, o = { ...r };
|
|
3736
|
-
if (n) for (const
|
|
3737
|
-
if (!(
|
|
3738
|
-
n[
|
|
3736
|
+
if (n) for (const i in n) {
|
|
3737
|
+
if (!(i in o)) throw new Error(`Unrecognized key: "${i}"`);
|
|
3738
|
+
n[i] && (o[i] = new e({
|
|
3739
3739
|
type: "nonoptional",
|
|
3740
|
-
innerType: r[
|
|
3740
|
+
innerType: r[i]
|
|
3741
3741
|
}));
|
|
3742
3742
|
}
|
|
3743
|
-
else for (const
|
|
3743
|
+
else for (const i in r) o[i] = new e({
|
|
3744
3744
|
type: "nonoptional",
|
|
3745
|
-
innerType: r[
|
|
3745
|
+
innerType: r[i]
|
|
3746
3746
|
});
|
|
3747
3747
|
return me(this, "shape", o), o;
|
|
3748
3748
|
} }));
|
|
@@ -3767,8 +3767,8 @@ function Fe(e) {
|
|
|
3767
3767
|
return typeof e == "string" ? e : e?.message;
|
|
3768
3768
|
}
|
|
3769
3769
|
function pe(e, t, n) {
|
|
3770
|
-
const r = e.message ? e.message : Fe(e.inst?._zod.def?.error?.(e)) ?? Fe(t?.error?.(e)) ?? Fe(n.customError?.(e)) ?? Fe(n.localeError?.(e)) ?? "Invalid input", { inst: o, continue:
|
|
3771
|
-
return c.path ?? (c.path = []), c.message = r, t?.reportInput && (c.input =
|
|
3770
|
+
const r = e.message ? e.message : Fe(e.inst?._zod.def?.error?.(e)) ?? Fe(t?.error?.(e)) ?? Fe(n.customError?.(e)) ?? Fe(n.localeError?.(e)) ?? "Invalid input", { inst: o, continue: i, input: s, ...c } = e;
|
|
3771
|
+
return c.path ?? (c.path = []), c.message = r, t?.reportInput && (c.input = s), c;
|
|
3772
3772
|
}
|
|
3773
3773
|
function Ct(e) {
|
|
3774
3774
|
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
@@ -3794,7 +3794,7 @@ const _r = (e, t) => {
|
|
|
3794
3794
|
enumerable: !1
|
|
3795
3795
|
});
|
|
3796
3796
|
}, gr = h("$ZodError", _r), vr = h("$ZodError", _r, { Parent: Error });
|
|
3797
|
-
function
|
|
3797
|
+
function Bs(e, t = (n) => n.message) {
|
|
3798
3798
|
const n = {}, r = [];
|
|
3799
3799
|
for (const o of e.issues) o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
3800
3800
|
return {
|
|
@@ -3802,19 +3802,19 @@ function Ks(e, t = (n) => n.message) {
|
|
|
3802
3802
|
fieldErrors: n
|
|
3803
3803
|
};
|
|
3804
3804
|
}
|
|
3805
|
-
function
|
|
3806
|
-
const n = { _errors: [] }, r = (o,
|
|
3807
|
-
for (const
|
|
3808
|
-
else if (
|
|
3809
|
-
else if (
|
|
3805
|
+
function Ks(e, t = (n) => n.message) {
|
|
3806
|
+
const n = { _errors: [] }, r = (o, i = []) => {
|
|
3807
|
+
for (const s of o.issues) if (s.code === "invalid_union" && s.errors.length) s.errors.map((c) => r({ issues: c }, [...i, ...s.path]));
|
|
3808
|
+
else if (s.code === "invalid_key") r({ issues: s.issues }, [...i, ...s.path]);
|
|
3809
|
+
else if (s.code === "invalid_element") r({ issues: s.issues }, [...i, ...s.path]);
|
|
3810
3810
|
else {
|
|
3811
|
-
const c = [...
|
|
3812
|
-
if (c.length === 0) n._errors.push(t(
|
|
3811
|
+
const c = [...i, ...s.path];
|
|
3812
|
+
if (c.length === 0) n._errors.push(t(s));
|
|
3813
3813
|
else {
|
|
3814
3814
|
let a = n, u = 0;
|
|
3815
3815
|
for (; u < c.length; ) {
|
|
3816
3816
|
const d = c[u];
|
|
3817
|
-
u !== c.length - 1 ? a[d] = a[d] || { _errors: [] } : (a[d] = a[d] || { _errors: [] }, a[d]._errors.push(t(
|
|
3817
|
+
u !== c.length - 1 ? a[d] = a[d] || { _errors: [] } : (a[d] = a[d] || { _errors: [] }, a[d]._errors.push(t(s))), a = a[d], u++;
|
|
3818
3818
|
}
|
|
3819
3819
|
}
|
|
3820
3820
|
}
|
|
@@ -3822,64 +3822,64 @@ function Bs(e, t = (n) => n.message) {
|
|
|
3822
3822
|
return r(e), n;
|
|
3823
3823
|
}
|
|
3824
3824
|
const At = (e) => (t, n, r, o) => {
|
|
3825
|
-
const
|
|
3825
|
+
const i = r ? {
|
|
3826
3826
|
...r,
|
|
3827
3827
|
async: !1
|
|
3828
|
-
} : { async: !1 },
|
|
3828
|
+
} : { async: !1 }, s = t._zod.run({
|
|
3829
3829
|
value: n,
|
|
3830
3830
|
issues: []
|
|
3831
|
-
},
|
|
3832
|
-
if (
|
|
3833
|
-
if (
|
|
3834
|
-
const c = new (o?.Err ?? e)(
|
|
3831
|
+
}, i);
|
|
3832
|
+
if (s instanceof Promise) throw new be();
|
|
3833
|
+
if (s.issues.length) {
|
|
3834
|
+
const c = new (o?.Err ?? e)(s.issues.map((a) => pe(a, i, he())));
|
|
3835
3835
|
throw hr(c, o?.callee), c;
|
|
3836
3836
|
}
|
|
3837
|
-
return
|
|
3837
|
+
return s.value;
|
|
3838
3838
|
}, jt = (e) => async (t, n, r, o) => {
|
|
3839
|
-
const
|
|
3839
|
+
const i = r ? {
|
|
3840
3840
|
...r,
|
|
3841
3841
|
async: !0
|
|
3842
3842
|
} : { async: !0 };
|
|
3843
|
-
let
|
|
3843
|
+
let s = t._zod.run({
|
|
3844
3844
|
value: n,
|
|
3845
3845
|
issues: []
|
|
3846
|
-
},
|
|
3847
|
-
if (
|
|
3848
|
-
const c = new (o?.Err ?? e)(
|
|
3846
|
+
}, i);
|
|
3847
|
+
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
3848
|
+
const c = new (o?.Err ?? e)(s.issues.map((a) => pe(a, i, he())));
|
|
3849
3849
|
throw hr(c, o?.callee), c;
|
|
3850
3850
|
}
|
|
3851
|
-
return
|
|
3851
|
+
return s.value;
|
|
3852
3852
|
}, nt = (e) => (t, n, r) => {
|
|
3853
3853
|
const o = r ? {
|
|
3854
3854
|
...r,
|
|
3855
3855
|
async: !1
|
|
3856
|
-
} : { async: !1 },
|
|
3856
|
+
} : { async: !1 }, i = t._zod.run({
|
|
3857
3857
|
value: n,
|
|
3858
3858
|
issues: []
|
|
3859
3859
|
}, o);
|
|
3860
|
-
if (
|
|
3861
|
-
return
|
|
3860
|
+
if (i instanceof Promise) throw new be();
|
|
3861
|
+
return i.issues.length ? {
|
|
3862
3862
|
success: !1,
|
|
3863
|
-
error: new (e ?? gr)(
|
|
3863
|
+
error: new (e ?? gr)(i.issues.map((s) => pe(s, o, he())))
|
|
3864
3864
|
} : {
|
|
3865
3865
|
success: !0,
|
|
3866
|
-
data:
|
|
3866
|
+
data: i.value
|
|
3867
3867
|
};
|
|
3868
3868
|
}, Gs = /* @__PURE__ */ nt(vr), rt = (e) => async (t, n, r) => {
|
|
3869
3869
|
const o = r ? {
|
|
3870
3870
|
...r,
|
|
3871
3871
|
async: !0
|
|
3872
3872
|
} : { async: !0 };
|
|
3873
|
-
let
|
|
3873
|
+
let i = t._zod.run({
|
|
3874
3874
|
value: n,
|
|
3875
3875
|
issues: []
|
|
3876
3876
|
}, o);
|
|
3877
|
-
return
|
|
3877
|
+
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
3878
3878
|
success: !1,
|
|
3879
|
-
error: new e(
|
|
3879
|
+
error: new e(i.issues.map((s) => pe(s, o, he())))
|
|
3880
3880
|
} : {
|
|
3881
3881
|
success: !0,
|
|
3882
|
-
data:
|
|
3882
|
+
data: i.value
|
|
3883
3883
|
};
|
|
3884
3884
|
}, Ys = /* @__PURE__ */ rt(vr), Xs = (e) => (t, n, r) => {
|
|
3885
3885
|
const o = r ? {
|
|
@@ -3937,8 +3937,8 @@ const Ec = (e) => {
|
|
|
3937
3937
|
J.init(e, t);
|
|
3938
3938
|
const n = zr[typeof t.value];
|
|
3939
3939
|
e._zod.onattach.push((r) => {
|
|
3940
|
-
const o = r._zod.bag,
|
|
3941
|
-
t.value <
|
|
3940
|
+
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
3941
|
+
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
3942
3942
|
}), e._zod.check = (r) => {
|
|
3943
3943
|
(t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
|
|
3944
3944
|
origin: n,
|
|
@@ -3954,8 +3954,8 @@ const Ec = (e) => {
|
|
|
3954
3954
|
J.init(e, t);
|
|
3955
3955
|
const n = zr[typeof t.value];
|
|
3956
3956
|
e._zod.onattach.push((r) => {
|
|
3957
|
-
const o = r._zod.bag,
|
|
3958
|
-
t.value >
|
|
3957
|
+
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
3958
|
+
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
3959
3959
|
}), e._zod.check = (r) => {
|
|
3960
3960
|
(t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
|
|
3961
3961
|
origin: n,
|
|
@@ -3984,15 +3984,15 @@ const Ec = (e) => {
|
|
|
3984
3984
|
};
|
|
3985
3985
|
}), Cc = /* @__PURE__ */ h("$ZodCheckNumberFormat", (e, t) => {
|
|
3986
3986
|
J.init(e, t), t.format = t.format || "float64";
|
|
3987
|
-
const n = t.format?.includes("int"), r = n ? "int" : "number", [o,
|
|
3988
|
-
e._zod.onattach.push((
|
|
3989
|
-
const c =
|
|
3990
|
-
c.format = t.format, c.minimum = o, c.maximum =
|
|
3991
|
-
}), e._zod.check = (
|
|
3992
|
-
const c =
|
|
3987
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = Ds[t.format];
|
|
3988
|
+
e._zod.onattach.push((s) => {
|
|
3989
|
+
const c = s._zod.bag;
|
|
3990
|
+
c.format = t.format, c.minimum = o, c.maximum = i, n && (c.pattern = Oc);
|
|
3991
|
+
}), e._zod.check = (s) => {
|
|
3992
|
+
const c = s.value;
|
|
3993
3993
|
if (n) {
|
|
3994
3994
|
if (!Number.isInteger(c)) {
|
|
3995
|
-
|
|
3995
|
+
s.issues.push({
|
|
3996
3996
|
expected: r,
|
|
3997
3997
|
format: t.format,
|
|
3998
3998
|
code: "invalid_type",
|
|
@@ -4003,7 +4003,7 @@ const Ec = (e) => {
|
|
|
4003
4003
|
return;
|
|
4004
4004
|
}
|
|
4005
4005
|
if (!Number.isSafeInteger(c)) {
|
|
4006
|
-
c > 0 ?
|
|
4006
|
+
c > 0 ? s.issues.push({
|
|
4007
4007
|
input: c,
|
|
4008
4008
|
code: "too_big",
|
|
4009
4009
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
@@ -4012,7 +4012,7 @@ const Ec = (e) => {
|
|
|
4012
4012
|
origin: r,
|
|
4013
4013
|
inclusive: !0,
|
|
4014
4014
|
continue: !t.abort
|
|
4015
|
-
}) :
|
|
4015
|
+
}) : s.issues.push({
|
|
4016
4016
|
input: c,
|
|
4017
4017
|
code: "too_small",
|
|
4018
4018
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
@@ -4025,7 +4025,7 @@ const Ec = (e) => {
|
|
|
4025
4025
|
return;
|
|
4026
4026
|
}
|
|
4027
4027
|
}
|
|
4028
|
-
c < o &&
|
|
4028
|
+
c < o && s.issues.push({
|
|
4029
4029
|
origin: "number",
|
|
4030
4030
|
input: c,
|
|
4031
4031
|
code: "too_small",
|
|
@@ -4033,11 +4033,11 @@ const Ec = (e) => {
|
|
|
4033
4033
|
inclusive: !0,
|
|
4034
4034
|
inst: e,
|
|
4035
4035
|
continue: !t.abort
|
|
4036
|
-
}), c >
|
|
4036
|
+
}), c > i && s.issues.push({
|
|
4037
4037
|
origin: "number",
|
|
4038
4038
|
input: c,
|
|
4039
4039
|
code: "too_big",
|
|
4040
|
-
maximum:
|
|
4040
|
+
maximum: i,
|
|
4041
4041
|
inclusive: !0,
|
|
4042
4042
|
inst: e,
|
|
4043
4043
|
continue: !t.abort
|
|
@@ -4054,9 +4054,9 @@ const Ec = (e) => {
|
|
|
4054
4054
|
}), e._zod.check = (r) => {
|
|
4055
4055
|
const o = r.value;
|
|
4056
4056
|
if (o.length <= t.maximum) return;
|
|
4057
|
-
const
|
|
4057
|
+
const i = Ct(o);
|
|
4058
4058
|
r.issues.push({
|
|
4059
|
-
origin:
|
|
4059
|
+
origin: i,
|
|
4060
4060
|
code: "too_big",
|
|
4061
4061
|
maximum: t.maximum,
|
|
4062
4062
|
inclusive: !0,
|
|
@@ -4076,9 +4076,9 @@ const Ec = (e) => {
|
|
|
4076
4076
|
}), e._zod.check = (r) => {
|
|
4077
4077
|
const o = r.value;
|
|
4078
4078
|
if (o.length >= t.minimum) return;
|
|
4079
|
-
const
|
|
4079
|
+
const i = Ct(o);
|
|
4080
4080
|
r.issues.push({
|
|
4081
|
-
origin:
|
|
4081
|
+
origin: i,
|
|
4082
4082
|
code: "too_small",
|
|
4083
4083
|
minimum: t.minimum,
|
|
4084
4084
|
inclusive: !0,
|
|
@@ -4096,11 +4096,11 @@ const Ec = (e) => {
|
|
|
4096
4096
|
const o = r._zod.bag;
|
|
4097
4097
|
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
4098
4098
|
}), e._zod.check = (r) => {
|
|
4099
|
-
const o = r.value,
|
|
4100
|
-
if (
|
|
4101
|
-
const
|
|
4099
|
+
const o = r.value, i = o.length;
|
|
4100
|
+
if (i === t.length) return;
|
|
4101
|
+
const s = Ct(o), c = i > t.length;
|
|
4102
4102
|
r.issues.push({
|
|
4103
|
-
origin:
|
|
4103
|
+
origin: s,
|
|
4104
4104
|
...c ? {
|
|
4105
4105
|
code: "too_big",
|
|
4106
4106
|
maximum: t.length
|
|
@@ -4118,8 +4118,8 @@ const Ec = (e) => {
|
|
|
4118
4118
|
}), ot = /* @__PURE__ */ h("$ZodCheckStringFormat", (e, t) => {
|
|
4119
4119
|
var n, r;
|
|
4120
4120
|
J.init(e, t), e._zod.onattach.push((o) => {
|
|
4121
|
-
const
|
|
4122
|
-
|
|
4121
|
+
const i = o._zod.bag;
|
|
4122
|
+
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
4123
4123
|
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
4124
4124
|
t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
|
|
4125
4125
|
origin: "string",
|
|
@@ -4152,8 +4152,8 @@ const Ec = (e) => {
|
|
|
4152
4152
|
J.init(e, t);
|
|
4153
4153
|
const n = $e(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
4154
4154
|
t.pattern = r, e._zod.onattach.push((o) => {
|
|
4155
|
-
const
|
|
4156
|
-
|
|
4155
|
+
const i = o._zod.bag;
|
|
4156
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
4157
4157
|
}), e._zod.check = (o) => {
|
|
4158
4158
|
o.value.includes(t.includes, t.position) || o.issues.push({
|
|
4159
4159
|
origin: "string",
|
|
@@ -4235,32 +4235,32 @@ const Vc = {
|
|
|
4235
4235
|
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = Vc;
|
|
4236
4236
|
const r = [...e._zod.def.checks ?? []];
|
|
4237
4237
|
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
4238
|
-
for (const o of r) for (const
|
|
4238
|
+
for (const o of r) for (const i of o._zod.onattach) i(e);
|
|
4239
4239
|
if (r.length === 0)
|
|
4240
4240
|
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
4241
4241
|
e._zod.run = e._zod.parse;
|
|
4242
4242
|
});
|
|
4243
4243
|
else {
|
|
4244
|
-
const o = (
|
|
4245
|
-
let u = ye(
|
|
4244
|
+
const o = (s, c, a) => {
|
|
4245
|
+
let u = ye(s), d;
|
|
4246
4246
|
for (const l of c) {
|
|
4247
4247
|
if (l._zod.def.when) {
|
|
4248
|
-
if (Ws(
|
|
4248
|
+
if (Ws(s) || !l._zod.def.when(s)) continue;
|
|
4249
4249
|
} else if (u) continue;
|
|
4250
|
-
const f =
|
|
4250
|
+
const f = s.issues.length, p = l._zod.check(s);
|
|
4251
4251
|
if (p instanceof Promise && a?.async === !1) throw new be();
|
|
4252
4252
|
if (d || p instanceof Promise) d = (d ?? Promise.resolve()).then(async () => {
|
|
4253
|
-
await p,
|
|
4253
|
+
await p, s.issues.length !== f && (u || (u = ye(s, f)));
|
|
4254
4254
|
});
|
|
4255
4255
|
else {
|
|
4256
|
-
if (
|
|
4257
|
-
u || (u = ye(
|
|
4256
|
+
if (s.issues.length === f) continue;
|
|
4257
|
+
u || (u = ye(s, f));
|
|
4258
4258
|
}
|
|
4259
4259
|
}
|
|
4260
|
-
return d ? d.then(() =>
|
|
4261
|
-
},
|
|
4262
|
-
if (ye(
|
|
4263
|
-
return
|
|
4260
|
+
return d ? d.then(() => s) : s;
|
|
4261
|
+
}, i = (s, c, a) => {
|
|
4262
|
+
if (ye(s))
|
|
4263
|
+
return s.aborted = !0, s;
|
|
4264
4264
|
const u = o(c, r, a);
|
|
4265
4265
|
if (u instanceof Promise) {
|
|
4266
4266
|
if (a.async === !1) throw new be();
|
|
@@ -4268,19 +4268,19 @@ const Vc = {
|
|
|
4268
4268
|
}
|
|
4269
4269
|
return e._zod.parse(u, a);
|
|
4270
4270
|
};
|
|
4271
|
-
e._zod.run = (
|
|
4272
|
-
if (c.skipChecks) return e._zod.parse(
|
|
4271
|
+
e._zod.run = (s, c) => {
|
|
4272
|
+
if (c.skipChecks) return e._zod.parse(s, c);
|
|
4273
4273
|
if (c.direction === "backward") {
|
|
4274
4274
|
const u = e._zod.parse({
|
|
4275
|
-
value:
|
|
4275
|
+
value: s.value,
|
|
4276
4276
|
issues: []
|
|
4277
4277
|
}, {
|
|
4278
4278
|
...c,
|
|
4279
4279
|
skipChecks: !0
|
|
4280
4280
|
});
|
|
4281
|
-
return u instanceof Promise ? u.then((d) =>
|
|
4281
|
+
return u instanceof Promise ? u.then((d) => i(d, s, c)) : i(u, s, c);
|
|
4282
4282
|
}
|
|
4283
|
-
const a = e._zod.parse(
|
|
4283
|
+
const a = e._zod.parse(s, c);
|
|
4284
4284
|
if (a instanceof Promise) {
|
|
4285
4285
|
if (c.async === !1) throw new be();
|
|
4286
4286
|
return a.then((u) => o(u, r, c));
|
|
@@ -4291,10 +4291,10 @@ const Vc = {
|
|
|
4291
4291
|
I(e, "~standard", () => ({
|
|
4292
4292
|
validate: (o) => {
|
|
4293
4293
|
try {
|
|
4294
|
-
const
|
|
4295
|
-
return
|
|
4294
|
+
const i = Gs(e, o);
|
|
4295
|
+
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
4296
4296
|
} catch {
|
|
4297
|
-
return Ys(e, o).then((
|
|
4297
|
+
return Ys(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
4298
4298
|
}
|
|
4299
4299
|
},
|
|
4300
4300
|
vendor: "zod",
|
|
@@ -4317,7 +4317,7 @@ const Vc = {
|
|
|
4317
4317
|
ot.init(e, t), Mt.init(e, t);
|
|
4318
4318
|
}), Wc = /* @__PURE__ */ h("$ZodGUID", (e, t) => {
|
|
4319
4319
|
t.pattern ?? (t.pattern = hc), T.init(e, t);
|
|
4320
|
-
}),
|
|
4320
|
+
}), Bc = /* @__PURE__ */ h("$ZodUUID", (e, t) => {
|
|
4321
4321
|
if (t.version) {
|
|
4322
4322
|
const n = {
|
|
4323
4323
|
v1: 1,
|
|
@@ -4333,7 +4333,7 @@ const Vc = {
|
|
|
4333
4333
|
t.pattern ?? (t.pattern = hn(n));
|
|
4334
4334
|
} else t.pattern ?? (t.pattern = hn());
|
|
4335
4335
|
T.init(e, t);
|
|
4336
|
-
}),
|
|
4336
|
+
}), Kc = /* @__PURE__ */ h("$ZodEmail", (e, t) => {
|
|
4337
4337
|
t.pattern ?? (t.pattern = pc), T.init(e, t);
|
|
4338
4338
|
}), Gc = /* @__PURE__ */ h("$ZodURL", (e, t) => {
|
|
4339
4339
|
T.init(e, t), e._zod.check = (n) => {
|
|
@@ -4424,11 +4424,11 @@ const Vc = {
|
|
|
4424
4424
|
const r = n.value.split("/");
|
|
4425
4425
|
try {
|
|
4426
4426
|
if (r.length !== 2) throw new Error();
|
|
4427
|
-
const [o,
|
|
4428
|
-
if (!
|
|
4429
|
-
const
|
|
4430
|
-
if (`${
|
|
4431
|
-
if (
|
|
4427
|
+
const [o, i] = r;
|
|
4428
|
+
if (!i) throw new Error();
|
|
4429
|
+
const s = Number(i);
|
|
4430
|
+
if (`${s}` !== i) throw new Error();
|
|
4431
|
+
if (s < 0 || s > 128) throw new Error();
|
|
4432
4432
|
new URL(`http://[${o}]`);
|
|
4433
4433
|
} catch {
|
|
4434
4434
|
n.issues.push({
|
|
@@ -4509,13 +4509,13 @@ const ga = /* @__PURE__ */ h("$ZodJWT", (e, t) => {
|
|
|
4509
4509
|
}
|
|
4510
4510
|
const o = n.value;
|
|
4511
4511
|
if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o)) return n;
|
|
4512
|
-
const
|
|
4512
|
+
const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
|
|
4513
4513
|
return n.issues.push({
|
|
4514
4514
|
expected: "number",
|
|
4515
4515
|
code: "invalid_type",
|
|
4516
4516
|
input: o,
|
|
4517
4517
|
inst: e,
|
|
4518
|
-
...
|
|
4518
|
+
...i ? { received: i } : {}
|
|
4519
4519
|
}), n;
|
|
4520
4520
|
};
|
|
4521
4521
|
}), va = /* @__PURE__ */ h("$ZodNumberFormat", (e, t) => {
|
|
@@ -4558,24 +4558,24 @@ const za = /* @__PURE__ */ h("$ZodArray", (e, t) => {
|
|
|
4558
4558
|
inst: e
|
|
4559
4559
|
}), n;
|
|
4560
4560
|
n.value = Array(o.length);
|
|
4561
|
-
const
|
|
4562
|
-
for (let
|
|
4563
|
-
const c = o[
|
|
4561
|
+
const i = [];
|
|
4562
|
+
for (let s = 0; s < o.length; s++) {
|
|
4563
|
+
const c = o[s], a = t.element._zod.run({
|
|
4564
4564
|
value: c,
|
|
4565
4565
|
issues: []
|
|
4566
4566
|
}, r);
|
|
4567
|
-
a instanceof Promise ?
|
|
4567
|
+
a instanceof Promise ? i.push(a.then((u) => pn(u, n, s))) : pn(a, n, s);
|
|
4568
4568
|
}
|
|
4569
|
-
return
|
|
4569
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
4570
4570
|
};
|
|
4571
4571
|
});
|
|
4572
|
-
function
|
|
4573
|
-
const
|
|
4572
|
+
function Be(e, t, n, r, o, i) {
|
|
4573
|
+
const s = n in r;
|
|
4574
4574
|
if (e.issues.length) {
|
|
4575
|
-
if (o &&
|
|
4575
|
+
if (o && i && !s) return;
|
|
4576
4576
|
t.issues.push(...mr(n, e.issues));
|
|
4577
4577
|
}
|
|
4578
|
-
if (!
|
|
4578
|
+
if (!s && !o) {
|
|
4579
4579
|
e.issues.length || t.issues.push({
|
|
4580
4580
|
code: "invalid_type",
|
|
4581
4581
|
expected: "nonoptional",
|
|
@@ -4584,7 +4584,7 @@ function Ke(e, t, n, r, o, s) {
|
|
|
4584
4584
|
});
|
|
4585
4585
|
return;
|
|
4586
4586
|
}
|
|
4587
|
-
e.value === void 0 ?
|
|
4587
|
+
e.value === void 0 ? s && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
4588
4588
|
}
|
|
4589
4589
|
function Er(e) {
|
|
4590
4590
|
const t = Object.keys(e.shape);
|
|
@@ -4598,40 +4598,40 @@ function Er(e) {
|
|
|
4598
4598
|
optionalKeys: new Set(n)
|
|
4599
4599
|
};
|
|
4600
4600
|
}
|
|
4601
|
-
function Or(e, t, n, r, o,
|
|
4602
|
-
const
|
|
4601
|
+
function Or(e, t, n, r, o, i) {
|
|
4602
|
+
const s = [], c = o.keySet, a = o.catchall._zod, u = a.def.type, d = a.optin === "optional", l = a.optout === "optional";
|
|
4603
4603
|
for (const f in t) {
|
|
4604
4604
|
if (f === "__proto__" || c.has(f)) continue;
|
|
4605
4605
|
if (u === "never") {
|
|
4606
|
-
|
|
4606
|
+
s.push(f);
|
|
4607
4607
|
continue;
|
|
4608
4608
|
}
|
|
4609
4609
|
const p = a.run({
|
|
4610
4610
|
value: t[f],
|
|
4611
4611
|
issues: []
|
|
4612
4612
|
}, r);
|
|
4613
|
-
p instanceof Promise ? e.push(p.then((v) =>
|
|
4613
|
+
p instanceof Promise ? e.push(p.then((v) => Be(v, n, f, t, d, l))) : Be(p, n, f, t, d, l);
|
|
4614
4614
|
}
|
|
4615
|
-
return
|
|
4615
|
+
return s.length && n.issues.push({
|
|
4616
4616
|
code: "unrecognized_keys",
|
|
4617
|
-
keys:
|
|
4617
|
+
keys: s,
|
|
4618
4618
|
input: t,
|
|
4619
|
-
inst:
|
|
4619
|
+
inst: i
|
|
4620
4620
|
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
4621
4621
|
}
|
|
4622
4622
|
const $a = /* @__PURE__ */ h("$ZodObject", (e, t) => {
|
|
4623
4623
|
if (R.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
4624
|
-
const
|
|
4624
|
+
const s = t.shape;
|
|
4625
4625
|
Object.defineProperty(t, "shape", { get: () => {
|
|
4626
|
-
const c = { ...
|
|
4626
|
+
const c = { ...s };
|
|
4627
4627
|
return Object.defineProperty(t, "shape", { value: c }), c;
|
|
4628
4628
|
} });
|
|
4629
4629
|
}
|
|
4630
4630
|
const n = tt(() => Er(t));
|
|
4631
4631
|
I(e._zod, "propValues", () => {
|
|
4632
|
-
const
|
|
4633
|
-
for (const a in
|
|
4634
|
-
const u =
|
|
4632
|
+
const s = t.shape, c = {};
|
|
4633
|
+
for (const a in s) {
|
|
4634
|
+
const u = s[a]._zod;
|
|
4635
4635
|
if (u.values) {
|
|
4636
4636
|
c[a] ?? (c[a] = /* @__PURE__ */ new Set());
|
|
4637
4637
|
for (const d of u.values) c[a].add(d);
|
|
@@ -4640,27 +4640,27 @@ const $a = /* @__PURE__ */ h("$ZodObject", (e, t) => {
|
|
|
4640
4640
|
return c;
|
|
4641
4641
|
});
|
|
4642
4642
|
const r = Ne, o = t.catchall;
|
|
4643
|
-
let
|
|
4644
|
-
e._zod.parse = (
|
|
4645
|
-
|
|
4646
|
-
const a =
|
|
4643
|
+
let i;
|
|
4644
|
+
e._zod.parse = (s, c) => {
|
|
4645
|
+
i ?? (i = n.value);
|
|
4646
|
+
const a = s.value;
|
|
4647
4647
|
if (!r(a))
|
|
4648
|
-
return
|
|
4648
|
+
return s.issues.push({
|
|
4649
4649
|
expected: "object",
|
|
4650
4650
|
code: "invalid_type",
|
|
4651
4651
|
input: a,
|
|
4652
4652
|
inst: e
|
|
4653
|
-
}),
|
|
4654
|
-
|
|
4655
|
-
const u = [], d =
|
|
4656
|
-
for (const l of
|
|
4653
|
+
}), s;
|
|
4654
|
+
s.value = {};
|
|
4655
|
+
const u = [], d = i.shape;
|
|
4656
|
+
for (const l of i.keys) {
|
|
4657
4657
|
const f = d[l], p = f._zod.optin === "optional", v = f._zod.optout === "optional", w = f._zod.run({
|
|
4658
4658
|
value: a[l],
|
|
4659
4659
|
issues: []
|
|
4660
4660
|
}, c);
|
|
4661
|
-
w instanceof Promise ? u.push(w.then(($) =>
|
|
4661
|
+
w instanceof Promise ? u.push(w.then(($) => Be($, s, l, a, p, v))) : Be(w, s, l, a, p, v);
|
|
4662
4662
|
}
|
|
4663
|
-
return o ? Or(u, a,
|
|
4663
|
+
return o ? Or(u, a, s, c, n.value, e) : u.length ? Promise.all(u).then(() => s) : s;
|
|
4664
4664
|
};
|
|
4665
4665
|
}), Sa = /* @__PURE__ */ h("$ZodObjectJIT", (e, t) => {
|
|
4666
4666
|
$a.init(e, t);
|
|
@@ -4745,13 +4745,13 @@ const $a = /* @__PURE__ */ h("$ZodObject", (e, t) => {
|
|
|
4745
4745
|
const E = f.compile();
|
|
4746
4746
|
return (C, b) => E(l, C, b);
|
|
4747
4747
|
};
|
|
4748
|
-
let
|
|
4749
|
-
const
|
|
4748
|
+
let i;
|
|
4749
|
+
const s = Ne, c = !Zt.jitless, a = c && js.value, u = t.catchall;
|
|
4750
4750
|
let d;
|
|
4751
4751
|
e._zod.parse = (l, f) => {
|
|
4752
4752
|
d ?? (d = r.value);
|
|
4753
4753
|
const p = l.value;
|
|
4754
|
-
return
|
|
4754
|
+
return s(p) ? c && a && f?.async === !1 && f.jitless !== !0 ? (i || (i = o(t.shape)), l = i(l, f), u ? Or([], p, l, f, d, e) : l) : n(l, f) : (l.issues.push({
|
|
4755
4755
|
expected: "object",
|
|
4756
4756
|
code: "invalid_type",
|
|
4757
4757
|
input: p,
|
|
@@ -4760,14 +4760,14 @@ const $a = /* @__PURE__ */ h("$ZodObject", (e, t) => {
|
|
|
4760
4760
|
};
|
|
4761
4761
|
});
|
|
4762
4762
|
function mn(e, t, n, r) {
|
|
4763
|
-
for (const
|
|
4764
|
-
return t.value =
|
|
4765
|
-
const o = e.filter((
|
|
4763
|
+
for (const i of e) if (i.issues.length === 0)
|
|
4764
|
+
return t.value = i.value, t;
|
|
4765
|
+
const o = e.filter((i) => !ye(i));
|
|
4766
4766
|
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
4767
4767
|
code: "invalid_union",
|
|
4768
4768
|
input: t.value,
|
|
4769
4769
|
inst: n,
|
|
4770
|
-
errors: e.map((
|
|
4770
|
+
errors: e.map((i) => i.issues.map((s) => pe(s, r, he())))
|
|
4771
4771
|
}), t);
|
|
4772
4772
|
}
|
|
4773
4773
|
const Pr = /* @__PURE__ */ h("$ZodUnion", (e, t) => {
|
|
@@ -4782,31 +4782,31 @@ const Pr = /* @__PURE__ */ h("$ZodUnion", (e, t) => {
|
|
|
4782
4782
|
const n = t.options.length === 1 ? t.options[0]._zod.run : null;
|
|
4783
4783
|
e._zod.parse = (r, o) => {
|
|
4784
4784
|
if (n) return n(r, o);
|
|
4785
|
-
let
|
|
4786
|
-
const
|
|
4785
|
+
let i = !1;
|
|
4786
|
+
const s = [];
|
|
4787
4787
|
for (const c of t.options) {
|
|
4788
4788
|
const a = c._zod.run({
|
|
4789
4789
|
value: r.value,
|
|
4790
4790
|
issues: []
|
|
4791
4791
|
}, o);
|
|
4792
4792
|
if (a instanceof Promise)
|
|
4793
|
-
|
|
4793
|
+
s.push(a), i = !0;
|
|
4794
4794
|
else {
|
|
4795
4795
|
if (a.issues.length === 0) return a;
|
|
4796
|
-
|
|
4796
|
+
s.push(a);
|
|
4797
4797
|
}
|
|
4798
4798
|
}
|
|
4799
|
-
return
|
|
4799
|
+
return i ? Promise.all(s).then((c) => mn(c, r, e, o)) : mn(s, r, e, o);
|
|
4800
4800
|
};
|
|
4801
4801
|
}), ka = /* @__PURE__ */ h("$ZodDiscriminatedUnion", (e, t) => {
|
|
4802
4802
|
t.inclusive = !1, Pr.init(e, t);
|
|
4803
4803
|
const n = e._zod.parse;
|
|
4804
4804
|
I(e._zod, "propValues", () => {
|
|
4805
4805
|
const o = {};
|
|
4806
|
-
for (const
|
|
4807
|
-
const
|
|
4808
|
-
if (!
|
|
4809
|
-
for (const [c, a] of Object.entries(
|
|
4806
|
+
for (const i of t.options) {
|
|
4807
|
+
const s = i._zod.propValues;
|
|
4808
|
+
if (!s || Object.keys(s).length === 0) throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);
|
|
4809
|
+
for (const [c, a] of Object.entries(s)) {
|
|
4810
4810
|
o[c] || (o[c] = /* @__PURE__ */ new Set());
|
|
4811
4811
|
for (const u of a) o[c].add(u);
|
|
4812
4812
|
}
|
|
@@ -4814,48 +4814,48 @@ const Pr = /* @__PURE__ */ h("$ZodUnion", (e, t) => {
|
|
|
4814
4814
|
return o;
|
|
4815
4815
|
});
|
|
4816
4816
|
const r = tt(() => {
|
|
4817
|
-
const o = t.options,
|
|
4818
|
-
for (const
|
|
4819
|
-
const c =
|
|
4820
|
-
if (!c || c.size === 0) throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(
|
|
4817
|
+
const o = t.options, i = /* @__PURE__ */ new Map();
|
|
4818
|
+
for (const s of o) {
|
|
4819
|
+
const c = s._zod.propValues?.[t.discriminator];
|
|
4820
|
+
if (!c || c.size === 0) throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);
|
|
4821
4821
|
for (const a of c) {
|
|
4822
|
-
if (
|
|
4823
|
-
|
|
4822
|
+
if (i.has(a)) throw new Error(`Duplicate discriminator value "${String(a)}"`);
|
|
4823
|
+
i.set(a, s);
|
|
4824
4824
|
}
|
|
4825
4825
|
}
|
|
4826
|
-
return
|
|
4826
|
+
return i;
|
|
4827
4827
|
});
|
|
4828
|
-
e._zod.parse = (o,
|
|
4829
|
-
const
|
|
4830
|
-
if (!Ne(
|
|
4828
|
+
e._zod.parse = (o, i) => {
|
|
4829
|
+
const s = o.value;
|
|
4830
|
+
if (!Ne(s))
|
|
4831
4831
|
return o.issues.push({
|
|
4832
4832
|
code: "invalid_type",
|
|
4833
4833
|
expected: "object",
|
|
4834
|
-
input:
|
|
4834
|
+
input: s,
|
|
4835
4835
|
inst: e
|
|
4836
4836
|
}), o;
|
|
4837
|
-
const c = r.value.get(
|
|
4838
|
-
return c ? c._zod.run(o,
|
|
4837
|
+
const c = r.value.get(s?.[t.discriminator]);
|
|
4838
|
+
return c ? c._zod.run(o, i) : t.unionFallback || i.direction === "backward" ? n(o, i) : (o.issues.push({
|
|
4839
4839
|
code: "invalid_union",
|
|
4840
4840
|
errors: [],
|
|
4841
4841
|
note: "No matching discriminator",
|
|
4842
4842
|
discriminator: t.discriminator,
|
|
4843
4843
|
options: Array.from(r.value.keys()),
|
|
4844
|
-
input:
|
|
4844
|
+
input: s,
|
|
4845
4845
|
path: [t.discriminator],
|
|
4846
4846
|
inst: e
|
|
4847
4847
|
}), o);
|
|
4848
4848
|
};
|
|
4849
4849
|
}), Ia = /* @__PURE__ */ h("$ZodIntersection", (e, t) => {
|
|
4850
4850
|
R.init(e, t), e._zod.parse = (n, r) => {
|
|
4851
|
-
const o = n.value,
|
|
4851
|
+
const o = n.value, i = t.left._zod.run({
|
|
4852
4852
|
value: o,
|
|
4853
4853
|
issues: []
|
|
4854
|
-
}, r),
|
|
4854
|
+
}, r), s = t.right._zod.run({
|
|
4855
4855
|
value: o,
|
|
4856
4856
|
issues: []
|
|
4857
4857
|
}, r);
|
|
4858
|
-
return
|
|
4858
|
+
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([c, a]) => _n(n, c, a)) : _n(n, i, s);
|
|
4859
4859
|
};
|
|
4860
4860
|
});
|
|
4861
4861
|
function Ot(e, t) {
|
|
@@ -4868,17 +4868,17 @@ function Ot(e, t) {
|
|
|
4868
4868
|
data: e
|
|
4869
4869
|
};
|
|
4870
4870
|
if (Ce(e) && Ce(t)) {
|
|
4871
|
-
const n = Object.keys(t), r = Object.keys(e).filter((
|
|
4871
|
+
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = {
|
|
4872
4872
|
...e,
|
|
4873
4873
|
...t
|
|
4874
4874
|
};
|
|
4875
|
-
for (const
|
|
4876
|
-
const
|
|
4877
|
-
if (!
|
|
4875
|
+
for (const i of r) {
|
|
4876
|
+
const s = Ot(e[i], t[i]);
|
|
4877
|
+
if (!s.valid) return {
|
|
4878
4878
|
valid: !1,
|
|
4879
|
-
mergeErrorPath: [
|
|
4879
|
+
mergeErrorPath: [i, ...s.mergeErrorPath]
|
|
4880
4880
|
};
|
|
4881
|
-
o[
|
|
4881
|
+
o[i] = s.data;
|
|
4882
4882
|
}
|
|
4883
4883
|
return {
|
|
4884
4884
|
valid: !0,
|
|
@@ -4892,12 +4892,12 @@ function Ot(e, t) {
|
|
|
4892
4892
|
};
|
|
4893
4893
|
const n = [];
|
|
4894
4894
|
for (let r = 0; r < e.length; r++) {
|
|
4895
|
-
const o = e[r],
|
|
4896
|
-
if (!
|
|
4895
|
+
const o = e[r], i = t[r], s = Ot(o, i);
|
|
4896
|
+
if (!s.valid) return {
|
|
4897
4897
|
valid: !1,
|
|
4898
|
-
mergeErrorPath: [r, ...
|
|
4898
|
+
mergeErrorPath: [r, ...s.mergeErrorPath]
|
|
4899
4899
|
};
|
|
4900
|
-
n.push(
|
|
4900
|
+
n.push(s.data);
|
|
4901
4901
|
}
|
|
4902
4902
|
return {
|
|
4903
4903
|
valid: !0,
|
|
@@ -4920,24 +4920,24 @@ function _n(e, t, n) {
|
|
|
4920
4920
|
for (const c of n.issues) if (c.code === "unrecognized_keys") for (const a of c.keys)
|
|
4921
4921
|
r.has(a) || r.set(a, {}), r.get(a).r = !0;
|
|
4922
4922
|
else e.issues.push(c);
|
|
4923
|
-
const
|
|
4924
|
-
if (
|
|
4923
|
+
const i = [...r].filter(([, c]) => c.l && c.r).map(([c]) => c);
|
|
4924
|
+
if (i.length && o && e.issues.push({
|
|
4925
4925
|
...o,
|
|
4926
|
-
keys:
|
|
4926
|
+
keys: i
|
|
4927
4927
|
}), ye(e)) return e;
|
|
4928
|
-
const
|
|
4929
|
-
if (!
|
|
4930
|
-
return e.value =
|
|
4928
|
+
const s = Ot(t.value, n.value);
|
|
4929
|
+
if (!s.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);
|
|
4930
|
+
return e.value = s.data, e;
|
|
4931
4931
|
}
|
|
4932
4932
|
const Ea = /* @__PURE__ */ h("$ZodEnum", (e, t) => {
|
|
4933
4933
|
R.init(e, t);
|
|
4934
4934
|
const n = fr(t.entries), r = new Set(n);
|
|
4935
|
-
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Ms.has(typeof o)).map((o) => typeof o == "string" ? $e(o) : o.toString()).join("|")})$`), e._zod.parse = (o,
|
|
4936
|
-
const
|
|
4937
|
-
return r.has(
|
|
4935
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Ms.has(typeof o)).map((o) => typeof o == "string" ? $e(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
4936
|
+
const s = o.value;
|
|
4937
|
+
return r.has(s) || o.issues.push({
|
|
4938
4938
|
code: "invalid_value",
|
|
4939
4939
|
values: n,
|
|
4940
|
-
input:
|
|
4940
|
+
input: s,
|
|
4941
4941
|
inst: e
|
|
4942
4942
|
}), o;
|
|
4943
4943
|
};
|
|
@@ -4945,11 +4945,11 @@ const Ea = /* @__PURE__ */ h("$ZodEnum", (e, t) => {
|
|
|
4945
4945
|
if (R.init(e, t), t.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
4946
4946
|
const n = new Set(t.values);
|
|
4947
4947
|
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((r) => typeof r == "string" ? $e(r) : r ? $e(r.toString()) : String(r)).join("|")})$`), e._zod.parse = (r, o) => {
|
|
4948
|
-
const
|
|
4949
|
-
return n.has(
|
|
4948
|
+
const i = r.value;
|
|
4949
|
+
return n.has(i) || r.issues.push({
|
|
4950
4950
|
code: "invalid_value",
|
|
4951
4951
|
values: t.values,
|
|
4952
|
-
input:
|
|
4952
|
+
input: i,
|
|
4953
4953
|
inst: e
|
|
4954
4954
|
}), r;
|
|
4955
4955
|
};
|
|
@@ -4957,7 +4957,7 @@ const Ea = /* @__PURE__ */ h("$ZodEnum", (e, t) => {
|
|
|
4957
4957
|
R.init(e, t), e._zod.optin = "optional", e._zod.parse = (n, r) => {
|
|
4958
4958
|
if (r.direction === "backward") throw new lr(e.constructor.name);
|
|
4959
4959
|
const o = t.transform(n.value, n);
|
|
4960
|
-
if (r.async) return (o instanceof Promise ? o : Promise.resolve(o)).then((
|
|
4960
|
+
if (r.async) return (o instanceof Promise ? o : Promise.resolve(o)).then((i) => (n.value = i, n.fallback = !0, n));
|
|
4961
4961
|
if (o instanceof Promise) throw new be();
|
|
4962
4962
|
return n.value = o, n.fallback = !0, n;
|
|
4963
4963
|
};
|
|
@@ -4974,8 +4974,8 @@ const Tr = /* @__PURE__ */ h("$ZodOptional", (e, t) => {
|
|
|
4974
4974
|
return n ? new RegExp(`^(${Nt(n.source)})?$`) : void 0;
|
|
4975
4975
|
}), e._zod.parse = (n, r) => {
|
|
4976
4976
|
if (t.innerType._zod.optin === "optional") {
|
|
4977
|
-
const o = n.value,
|
|
4978
|
-
return
|
|
4977
|
+
const o = n.value, i = t.innerType._zod.run(n, r);
|
|
4978
|
+
return i instanceof Promise ? i.then((s) => gn(s, o)) : gn(i, o);
|
|
4979
4979
|
}
|
|
4980
4980
|
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
4981
4981
|
};
|
|
@@ -4992,7 +4992,7 @@ const Tr = /* @__PURE__ */ h("$ZodOptional", (e, t) => {
|
|
|
4992
4992
|
if (n.value === void 0)
|
|
4993
4993
|
return n.value = t.defaultValue, n;
|
|
4994
4994
|
const o = t.innerType._zod.run(n, r);
|
|
4995
|
-
return o instanceof Promise ? o.then((
|
|
4995
|
+
return o instanceof Promise ? o.then((i) => vn(i, t)) : vn(o, t);
|
|
4996
4996
|
};
|
|
4997
4997
|
});
|
|
4998
4998
|
function vn(e, t) {
|
|
@@ -5006,7 +5006,7 @@ const Na = /* @__PURE__ */ h("$ZodPrefault", (e, t) => {
|
|
|
5006
5006
|
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
5007
5007
|
}), e._zod.parse = (n, r) => {
|
|
5008
5008
|
const o = t.innerType._zod.run(n, r);
|
|
5009
|
-
return o instanceof Promise ? o.then((
|
|
5009
|
+
return o instanceof Promise ? o.then((i) => yn(i, e)) : yn(o, e);
|
|
5010
5010
|
};
|
|
5011
5011
|
});
|
|
5012
5012
|
function yn(e, t) {
|
|
@@ -5021,24 +5021,24 @@ const Aa = /* @__PURE__ */ h("$ZodCatch", (e, t) => {
|
|
|
5021
5021
|
R.init(e, t), e._zod.optin = "optional", I(e._zod, "optout", () => t.innerType._zod.optout), I(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
5022
5022
|
if (r.direction === "backward") return t.innerType._zod.run(n, r);
|
|
5023
5023
|
const o = t.innerType._zod.run(n, r);
|
|
5024
|
-
return o instanceof Promise ? o.then((
|
|
5024
|
+
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
5025
5025
|
...n,
|
|
5026
|
-
error: { issues:
|
|
5026
|
+
error: { issues: i.issues.map((s) => pe(s, r, he())) },
|
|
5027
5027
|
input: n.value
|
|
5028
5028
|
}), n.issues = [], n.fallback = !0), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
5029
5029
|
...n,
|
|
5030
|
-
error: { issues: o.issues.map((
|
|
5030
|
+
error: { issues: o.issues.map((i) => pe(i, r, he())) },
|
|
5031
5031
|
input: n.value
|
|
5032
5032
|
}), n.issues = [], n.fallback = !0), n);
|
|
5033
5033
|
};
|
|
5034
5034
|
}), ja = /* @__PURE__ */ h("$ZodPipe", (e, t) => {
|
|
5035
5035
|
R.init(e, t), I(e._zod, "values", () => t.in._zod.values), I(e._zod, "optin", () => t.in._zod.optin), I(e._zod, "optout", () => t.out._zod.optout), I(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
|
|
5036
5036
|
if (r.direction === "backward") {
|
|
5037
|
-
const
|
|
5038
|
-
return
|
|
5037
|
+
const i = t.out._zod.run(n, r);
|
|
5038
|
+
return i instanceof Promise ? i.then((s) => Le(s, t.in, r)) : Le(i, t.in, r);
|
|
5039
5039
|
}
|
|
5040
5040
|
const o = t.in._zod.run(n, r);
|
|
5041
|
-
return o instanceof Promise ? o.then((
|
|
5041
|
+
return o instanceof Promise ? o.then((i) => Le(i, t.out, r)) : Le(o, t.out, r);
|
|
5042
5042
|
};
|
|
5043
5043
|
});
|
|
5044
5044
|
function Le(e, t, n) {
|
|
@@ -5061,7 +5061,7 @@ function bn(e) {
|
|
|
5061
5061
|
const xa = /* @__PURE__ */ h("$ZodCustom", (e, t) => {
|
|
5062
5062
|
J.init(e, t), R.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
5063
5063
|
const r = n.value, o = t.fn(r);
|
|
5064
|
-
if (o instanceof Promise) return o.then((
|
|
5064
|
+
if (o instanceof Promise) return o.then((i) => wn(i, n, r, e));
|
|
5065
5065
|
wn(o, n, r, e);
|
|
5066
5066
|
};
|
|
5067
5067
|
});
|
|
@@ -5195,7 +5195,7 @@ function Wa(e, t) {
|
|
|
5195
5195
|
});
|
|
5196
5196
|
}
|
|
5197
5197
|
// @__NO_SIDE_EFFECTS__
|
|
5198
|
-
function
|
|
5198
|
+
function Ba(e, t) {
|
|
5199
5199
|
return new e({
|
|
5200
5200
|
type: "string",
|
|
5201
5201
|
format: "emoji",
|
|
@@ -5205,7 +5205,7 @@ function Ka(e, t) {
|
|
|
5205
5205
|
});
|
|
5206
5206
|
}
|
|
5207
5207
|
// @__NO_SIDE_EFFECTS__
|
|
5208
|
-
function
|
|
5208
|
+
function Ka(e, t) {
|
|
5209
5209
|
return new e({
|
|
5210
5210
|
type: "string",
|
|
5211
5211
|
format: "nanoid",
|
|
@@ -5473,7 +5473,7 @@ function Zr(e, t) {
|
|
|
5473
5473
|
});
|
|
5474
5474
|
}
|
|
5475
5475
|
// @__NO_SIDE_EFFECTS__
|
|
5476
|
-
function
|
|
5476
|
+
function Ke(e, t) {
|
|
5477
5477
|
return new jc({
|
|
5478
5478
|
check: "min_length",
|
|
5479
5479
|
..._(t),
|
|
@@ -5589,8 +5589,8 @@ function Zu(e, t) {
|
|
|
5589
5589
|
const n = /* @__PURE__ */ Ru((r) => (r.addIssue = (o) => {
|
|
5590
5590
|
if (typeof o == "string") r.issues.push(Ae(o, r.value, n._zod.def));
|
|
5591
5591
|
else {
|
|
5592
|
-
const
|
|
5593
|
-
|
|
5592
|
+
const i = o;
|
|
5593
|
+
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = r.value), i.inst ?? (i.inst = n), i.continue ?? (i.continue = !n._zod.def.abort), r.issues.push(Ae(i));
|
|
5594
5594
|
}
|
|
5595
5595
|
}, e(r.value, r)), t);
|
|
5596
5596
|
return n;
|
|
@@ -5625,102 +5625,102 @@ function A(e, t, n = {
|
|
|
5625
5625
|
schemaPath: []
|
|
5626
5626
|
}) {
|
|
5627
5627
|
var r;
|
|
5628
|
-
const o = e._zod.def,
|
|
5629
|
-
if (
|
|
5630
|
-
return
|
|
5631
|
-
const
|
|
5628
|
+
const o = e._zod.def, i = t.seen.get(e);
|
|
5629
|
+
if (i)
|
|
5630
|
+
return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
|
|
5631
|
+
const s = {
|
|
5632
5632
|
schema: {},
|
|
5633
5633
|
count: 1,
|
|
5634
5634
|
cycle: void 0,
|
|
5635
5635
|
path: n.path
|
|
5636
5636
|
};
|
|
5637
|
-
t.seen.set(e,
|
|
5637
|
+
t.seen.set(e, s);
|
|
5638
5638
|
const c = e._zod.toJSONSchema?.();
|
|
5639
|
-
if (c)
|
|
5639
|
+
if (c) s.schema = c;
|
|
5640
5640
|
else {
|
|
5641
5641
|
const u = {
|
|
5642
5642
|
...n,
|
|
5643
5643
|
schemaPath: [...n.schemaPath, e],
|
|
5644
5644
|
path: n.path
|
|
5645
5645
|
};
|
|
5646
|
-
if (e._zod.processJSONSchema) e._zod.processJSONSchema(t,
|
|
5646
|
+
if (e._zod.processJSONSchema) e._zod.processJSONSchema(t, s.schema, u);
|
|
5647
5647
|
else {
|
|
5648
|
-
const l =
|
|
5648
|
+
const l = s.schema, f = t.processors[o.type];
|
|
5649
5649
|
if (!f) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
5650
5650
|
f(e, t, l, u);
|
|
5651
5651
|
}
|
|
5652
5652
|
const d = e._zod.parent;
|
|
5653
|
-
d && (
|
|
5653
|
+
d && (s.ref || (s.ref = d), A(d, t, u), t.seen.get(d).isParent = !0);
|
|
5654
5654
|
}
|
|
5655
5655
|
const a = t.metadataRegistry.get(e);
|
|
5656
|
-
return a && Object.assign(
|
|
5656
|
+
return a && Object.assign(s.schema, a), t.io === "input" && M(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && "_prefault" in s.schema && ((r = s.schema).default ?? (r.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
|
|
5657
5657
|
}
|
|
5658
5658
|
function Cr(e, t) {
|
|
5659
5659
|
const n = e.seen.get(t);
|
|
5660
5660
|
if (!n) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
5661
5661
|
const r = /* @__PURE__ */ new Map();
|
|
5662
|
-
for (const
|
|
5663
|
-
const c = e.metadataRegistry.get(
|
|
5662
|
+
for (const s of e.seen.entries()) {
|
|
5663
|
+
const c = e.metadataRegistry.get(s[0])?.id;
|
|
5664
5664
|
if (c) {
|
|
5665
5665
|
const a = r.get(c);
|
|
5666
|
-
if (a && a !==
|
|
5667
|
-
r.set(c,
|
|
5666
|
+
if (a && a !== s[0]) throw new Error(`Duplicate schema id "${c}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
5667
|
+
r.set(c, s[0]);
|
|
5668
5668
|
}
|
|
5669
5669
|
}
|
|
5670
|
-
const o = (
|
|
5670
|
+
const o = (s) => {
|
|
5671
5671
|
const c = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
5672
5672
|
if (e.external) {
|
|
5673
|
-
const d = e.external.registry.get(
|
|
5673
|
+
const d = e.external.registry.get(s[0])?.id, l = e.external.uri ?? ((p) => p);
|
|
5674
5674
|
if (d) return { ref: l(d) };
|
|
5675
|
-
const f =
|
|
5676
|
-
return
|
|
5675
|
+
const f = s[1].defId ?? s[1].schema.id ?? `schema${e.counter++}`;
|
|
5676
|
+
return s[1].defId = f, {
|
|
5677
5677
|
defId: f,
|
|
5678
5678
|
ref: `${l("__shared")}#/${c}/${f}`
|
|
5679
5679
|
};
|
|
5680
5680
|
}
|
|
5681
|
-
if (
|
|
5682
|
-
const a = `#/${c}/`, u =
|
|
5681
|
+
if (s[1] === n) return { ref: "#" };
|
|
5682
|
+
const a = `#/${c}/`, u = s[1].schema.id ?? `__schema${e.counter++}`;
|
|
5683
5683
|
return {
|
|
5684
5684
|
defId: u,
|
|
5685
5685
|
ref: a + u
|
|
5686
5686
|
};
|
|
5687
|
-
},
|
|
5688
|
-
if (
|
|
5689
|
-
const c =
|
|
5687
|
+
}, i = (s) => {
|
|
5688
|
+
if (s[1].schema.$ref) return;
|
|
5689
|
+
const c = s[1], { ref: a, defId: u } = o(s);
|
|
5690
5690
|
c.def = { ...c.schema }, u && (c.defId = u);
|
|
5691
5691
|
const d = c.schema;
|
|
5692
5692
|
for (const l in d) delete d[l];
|
|
5693
5693
|
d.$ref = a;
|
|
5694
5694
|
};
|
|
5695
|
-
if (e.cycles === "throw") for (const
|
|
5696
|
-
const c =
|
|
5695
|
+
if (e.cycles === "throw") for (const s of e.seen.entries()) {
|
|
5696
|
+
const c = s[1];
|
|
5697
5697
|
if (c.cycle) throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
|
|
5698
5698
|
|
|
5699
5699
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
5700
5700
|
}
|
|
5701
|
-
for (const
|
|
5702
|
-
const c =
|
|
5703
|
-
if (t ===
|
|
5704
|
-
s
|
|
5701
|
+
for (const s of e.seen.entries()) {
|
|
5702
|
+
const c = s[1];
|
|
5703
|
+
if (t === s[0]) {
|
|
5704
|
+
i(s);
|
|
5705
5705
|
continue;
|
|
5706
5706
|
}
|
|
5707
5707
|
if (e.external) {
|
|
5708
|
-
const a = e.external.registry.get(
|
|
5709
|
-
if (t !==
|
|
5710
|
-
s
|
|
5708
|
+
const a = e.external.registry.get(s[0])?.id;
|
|
5709
|
+
if (t !== s[0] && a) {
|
|
5710
|
+
i(s);
|
|
5711
5711
|
continue;
|
|
5712
5712
|
}
|
|
5713
5713
|
}
|
|
5714
|
-
if (e.metadataRegistry.get(
|
|
5715
|
-
s
|
|
5714
|
+
if (e.metadataRegistry.get(s[0])?.id) {
|
|
5715
|
+
i(s);
|
|
5716
5716
|
continue;
|
|
5717
5717
|
}
|
|
5718
5718
|
if (c.cycle) {
|
|
5719
|
-
s
|
|
5719
|
+
i(s);
|
|
5720
5720
|
continue;
|
|
5721
5721
|
}
|
|
5722
5722
|
if (c.count > 1 && e.reused === "ref") {
|
|
5723
|
-
s
|
|
5723
|
+
i(s);
|
|
5724
5724
|
continue;
|
|
5725
5725
|
}
|
|
5726
5726
|
}
|
|
@@ -5762,14 +5762,14 @@ function Ar(e, t) {
|
|
|
5762
5762
|
o.$id = e.external.uri(c);
|
|
5763
5763
|
}
|
|
5764
5764
|
Object.assign(o, n.def ?? n.schema);
|
|
5765
|
-
const
|
|
5766
|
-
|
|
5767
|
-
const
|
|
5765
|
+
const i = e.metadataRegistry.get(t)?.id;
|
|
5766
|
+
i !== void 0 && o.id === i && delete o.id;
|
|
5767
|
+
const s = e.external?.defs ?? {};
|
|
5768
5768
|
for (const c of e.seen.entries()) {
|
|
5769
5769
|
const a = c[1];
|
|
5770
|
-
a.def && a.defId && (a.def.id === a.defId && delete a.def.id,
|
|
5770
|
+
a.def && a.defId && (a.def.id === a.defId && delete a.def.id, s[a.defId] = a.def);
|
|
5771
5771
|
}
|
|
5772
|
-
e.external || Object.keys(
|
|
5772
|
+
e.external || Object.keys(s).length > 0 && (e.target === "draft-2020-12" ? o.$defs = s : o.definitions = s);
|
|
5773
5773
|
try {
|
|
5774
5774
|
const c = JSON.parse(JSON.stringify(o));
|
|
5775
5775
|
return Object.defineProperty(c, "~standard", {
|
|
@@ -5822,13 +5822,13 @@ const Nu = (e, t = {}) => (n) => {
|
|
|
5822
5822
|
});
|
|
5823
5823
|
return A(e, r), Cr(r, e), Ar(r, e);
|
|
5824
5824
|
}, Ge = (e, t, n = {}) => (r) => {
|
|
5825
|
-
const { libraryOptions: o, target:
|
|
5825
|
+
const { libraryOptions: o, target: i } = r ?? {}, s = Nr({
|
|
5826
5826
|
...o ?? {},
|
|
5827
|
-
target:
|
|
5827
|
+
target: i,
|
|
5828
5828
|
io: t,
|
|
5829
5829
|
processors: n
|
|
5830
5830
|
});
|
|
5831
|
-
return A(e,
|
|
5831
|
+
return A(e, s), Cr(s, e), Ar(s, e);
|
|
5832
5832
|
}, Cu = {
|
|
5833
5833
|
guid: "uuid",
|
|
5834
5834
|
url: "uri",
|
|
@@ -5838,8 +5838,8 @@ const Nu = (e, t = {}) => (n) => {
|
|
|
5838
5838
|
}, Au = (e, t, n, r) => {
|
|
5839
5839
|
const o = n;
|
|
5840
5840
|
o.type = "string";
|
|
5841
|
-
const { minimum:
|
|
5842
|
-
if (typeof
|
|
5841
|
+
const { minimum: i, maximum: s, format: c, patterns: a, contentEncoding: u } = e._zod.bag;
|
|
5842
|
+
if (typeof i == "number" && (o.minLength = i), typeof s == "number" && (o.maxLength = s), c && (o.format = Cu[c] ?? c, o.format === "" && delete o.format, c === "time" && delete o.format), u && (o.contentEncoding = u), a && a.size > 0) {
|
|
5843
5843
|
const d = [...a];
|
|
5844
5844
|
d.length === 1 ? o.pattern = d[0].source : d.length > 1 && (o.allOf = [...d.map((l) => ({
|
|
5845
5845
|
...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
|
|
@@ -5847,45 +5847,45 @@ const Nu = (e, t = {}) => (n) => {
|
|
|
5847
5847
|
}))]);
|
|
5848
5848
|
}
|
|
5849
5849
|
}, ju = (e, t, n, r) => {
|
|
5850
|
-
const o = n, { minimum:
|
|
5850
|
+
const o = n, { minimum: i, maximum: s, format: c, multipleOf: a, exclusiveMaximum: u, exclusiveMinimum: d } = e._zod.bag;
|
|
5851
5851
|
typeof c == "string" && c.includes("int") ? o.type = "integer" : o.type = "number";
|
|
5852
|
-
const l = typeof d == "number" && d >= (
|
|
5853
|
-
l ? p ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof
|
|
5852
|
+
const l = typeof d == "number" && d >= (i ?? Number.NEGATIVE_INFINITY), f = typeof u == "number" && u <= (s ?? Number.POSITIVE_INFINITY), p = t.target === "draft-04" || t.target === "openapi-3.0";
|
|
5853
|
+
l ? p ? (o.minimum = d, o.exclusiveMinimum = !0) : o.exclusiveMinimum = d : typeof i == "number" && (o.minimum = i), f ? p ? (o.maximum = u, o.exclusiveMaximum = !0) : o.exclusiveMaximum = u : typeof s == "number" && (o.maximum = s), typeof a == "number" && (o.multipleOf = a);
|
|
5854
5854
|
}, Mu = (e, t, n, r) => {
|
|
5855
5855
|
n.type = "boolean";
|
|
5856
5856
|
}, xu = (e, t, n, r) => {
|
|
5857
5857
|
n.not = {};
|
|
5858
5858
|
}, Du = (e, t, n, r) => {
|
|
5859
|
-
const o = e._zod.def,
|
|
5860
|
-
|
|
5859
|
+
const o = e._zod.def, i = fr(o.entries);
|
|
5860
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
|
|
5861
5861
|
}, Fu = (e, t, n, r) => {
|
|
5862
|
-
const o = e._zod.def,
|
|
5863
|
-
for (const
|
|
5862
|
+
const o = e._zod.def, i = [];
|
|
5863
|
+
for (const s of o.values) if (s === void 0) {
|
|
5864
5864
|
if (t.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
5865
|
-
} else if (typeof
|
|
5865
|
+
} else if (typeof s == "bigint") {
|
|
5866
5866
|
if (t.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
5867
|
-
|
|
5868
|
-
} else
|
|
5869
|
-
if (
|
|
5870
|
-
const
|
|
5871
|
-
n.type =
|
|
5867
|
+
i.push(Number(s));
|
|
5868
|
+
} else i.push(s);
|
|
5869
|
+
if (i.length !== 0) if (i.length === 1) {
|
|
5870
|
+
const s = i[0];
|
|
5871
|
+
n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
|
|
5872
5872
|
} else
|
|
5873
|
-
|
|
5873
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
|
|
5874
5874
|
}, Lu = (e, t, n, r) => {
|
|
5875
5875
|
if (t.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
5876
5876
|
}, Uu = (e, t, n, r) => {
|
|
5877
5877
|
if (t.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
5878
5878
|
}, Ju = (e, t, n, r) => {
|
|
5879
|
-
const o = n,
|
|
5880
|
-
typeof
|
|
5879
|
+
const o = n, i = e._zod.def, { minimum: s, maximum: c } = e._zod.bag;
|
|
5880
|
+
typeof s == "number" && (o.minItems = s), typeof c == "number" && (o.maxItems = c), o.type = "array", o.items = A(i.element, t, {
|
|
5881
5881
|
...r,
|
|
5882
5882
|
path: [...r.path, "items"]
|
|
5883
5883
|
});
|
|
5884
5884
|
}, qu = (e, t, n, r) => {
|
|
5885
|
-
const o = n,
|
|
5885
|
+
const o = n, i = e._zod.def;
|
|
5886
5886
|
o.type = "object", o.properties = {};
|
|
5887
|
-
const
|
|
5888
|
-
for (const u in
|
|
5887
|
+
const s = i.shape;
|
|
5888
|
+
for (const u in s) o.properties[u] = A(s[u], t, {
|
|
5889
5889
|
...r,
|
|
5890
5890
|
path: [
|
|
5891
5891
|
...r.path,
|
|
@@ -5893,33 +5893,33 @@ const Nu = (e, t = {}) => (n) => {
|
|
|
5893
5893
|
u
|
|
5894
5894
|
]
|
|
5895
5895
|
});
|
|
5896
|
-
const c = new Set(Object.keys(
|
|
5897
|
-
const d =
|
|
5896
|
+
const c = new Set(Object.keys(s)), a = new Set([...c].filter((u) => {
|
|
5897
|
+
const d = i.shape[u]._zod;
|
|
5898
5898
|
return t.io === "input" ? d.optin === void 0 : d.optout === void 0;
|
|
5899
5899
|
}));
|
|
5900
|
-
a.size > 0 && (o.required = Array.from(a)),
|
|
5900
|
+
a.size > 0 && (o.required = Array.from(a)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = A(i.catchall, t, {
|
|
5901
5901
|
...r,
|
|
5902
5902
|
path: [...r.path, "additionalProperties"]
|
|
5903
5903
|
})) : t.io === "output" && (o.additionalProperties = !1);
|
|
5904
5904
|
}, Hu = (e, t, n, r) => {
|
|
5905
|
-
const o = e._zod.def,
|
|
5905
|
+
const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((c, a) => A(c, t, {
|
|
5906
5906
|
...r,
|
|
5907
5907
|
path: [
|
|
5908
5908
|
...r.path,
|
|
5909
|
-
|
|
5909
|
+
i ? "oneOf" : "anyOf",
|
|
5910
5910
|
a
|
|
5911
5911
|
]
|
|
5912
5912
|
}));
|
|
5913
|
-
|
|
5913
|
+
i ? n.oneOf = s : n.anyOf = s;
|
|
5914
5914
|
}, Vu = (e, t, n, r) => {
|
|
5915
|
-
const o = e._zod.def,
|
|
5915
|
+
const o = e._zod.def, i = A(o.left, t, {
|
|
5916
5916
|
...r,
|
|
5917
5917
|
path: [
|
|
5918
5918
|
...r.path,
|
|
5919
5919
|
"allOf",
|
|
5920
5920
|
0
|
|
5921
5921
|
]
|
|
5922
|
-
}),
|
|
5922
|
+
}), s = A(o.right, t, {
|
|
5923
5923
|
...r,
|
|
5924
5924
|
path: [
|
|
5925
5925
|
...r.path,
|
|
@@ -5927,52 +5927,52 @@ const Nu = (e, t = {}) => (n) => {
|
|
|
5927
5927
|
1
|
|
5928
5928
|
]
|
|
5929
5929
|
}), c = (a) => "allOf" in a && Object.keys(a).length === 1;
|
|
5930
|
-
n.allOf = [...c(
|
|
5930
|
+
n.allOf = [...c(i) ? i.allOf : [i], ...c(s) ? s.allOf : [s]];
|
|
5931
5931
|
}, Wu = (e, t, n, r) => {
|
|
5932
|
-
const o = e._zod.def,
|
|
5933
|
-
t.target === "openapi-3.0" ? (
|
|
5934
|
-
},
|
|
5932
|
+
const o = e._zod.def, i = A(o.innerType, t, r), s = t.seen.get(e);
|
|
5933
|
+
t.target === "openapi-3.0" ? (s.ref = o.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
|
|
5934
|
+
}, Bu = (e, t, n, r) => {
|
|
5935
5935
|
const o = e._zod.def;
|
|
5936
5936
|
A(o.innerType, t, r);
|
|
5937
|
-
const
|
|
5938
|
-
|
|
5939
|
-
},
|
|
5937
|
+
const i = t.seen.get(e);
|
|
5938
|
+
i.ref = o.innerType;
|
|
5939
|
+
}, Ku = (e, t, n, r) => {
|
|
5940
5940
|
const o = e._zod.def;
|
|
5941
5941
|
A(o.innerType, t, r);
|
|
5942
|
-
const
|
|
5943
|
-
|
|
5942
|
+
const i = t.seen.get(e);
|
|
5943
|
+
i.ref = o.innerType, n.default = JSON.parse(JSON.stringify(o.defaultValue));
|
|
5944
5944
|
}, Gu = (e, t, n, r) => {
|
|
5945
5945
|
const o = e._zod.def;
|
|
5946
5946
|
A(o.innerType, t, r);
|
|
5947
|
-
const
|
|
5948
|
-
|
|
5947
|
+
const i = t.seen.get(e);
|
|
5948
|
+
i.ref = o.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
|
|
5949
5949
|
}, Yu = (e, t, n, r) => {
|
|
5950
5950
|
const o = e._zod.def;
|
|
5951
5951
|
A(o.innerType, t, r);
|
|
5952
|
-
const
|
|
5953
|
-
|
|
5954
|
-
let
|
|
5952
|
+
const i = t.seen.get(e);
|
|
5953
|
+
i.ref = o.innerType;
|
|
5954
|
+
let s;
|
|
5955
5955
|
try {
|
|
5956
|
-
|
|
5956
|
+
s = o.catchValue(void 0);
|
|
5957
5957
|
} catch {
|
|
5958
5958
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
5959
5959
|
}
|
|
5960
|
-
n.default =
|
|
5960
|
+
n.default = s;
|
|
5961
5961
|
}, Xu = (e, t, n, r) => {
|
|
5962
|
-
const o = e._zod.def,
|
|
5963
|
-
A(
|
|
5962
|
+
const o = e._zod.def, i = o.in._zod.traits.has("$ZodTransform"), s = t.io === "input" ? i ? o.out : o.in : o.out;
|
|
5963
|
+
A(s, t, r);
|
|
5964
5964
|
const c = t.seen.get(e);
|
|
5965
|
-
c.ref =
|
|
5965
|
+
c.ref = s;
|
|
5966
5966
|
}, Qu = (e, t, n, r) => {
|
|
5967
5967
|
const o = e._zod.def;
|
|
5968
5968
|
A(o.innerType, t, r);
|
|
5969
|
-
const
|
|
5970
|
-
|
|
5969
|
+
const i = t.seen.get(e);
|
|
5970
|
+
i.ref = o.innerType, n.readOnly = !0;
|
|
5971
5971
|
}, jr = (e, t, n, r) => {
|
|
5972
5972
|
const o = e._zod.def;
|
|
5973
5973
|
A(o.innerType, t, r);
|
|
5974
|
-
const
|
|
5975
|
-
|
|
5974
|
+
const i = t.seen.get(e);
|
|
5975
|
+
i.ref = o.innerType;
|
|
5976
5976
|
}, ed = /* @__PURE__ */ h("ZodISODateTime", (e, t) => {
|
|
5977
5977
|
oa.init(e, t), Z.init(e, t);
|
|
5978
5978
|
});
|
|
@@ -5999,8 +5999,8 @@ function cd(e) {
|
|
|
5999
5999
|
}
|
|
6000
6000
|
const ad = (e, t) => {
|
|
6001
6001
|
gr.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
6002
|
-
format: { value: (n) =>
|
|
6003
|
-
flatten: { value: (n) =>
|
|
6002
|
+
format: { value: (n) => Ks(e, n) },
|
|
6003
|
+
flatten: { value: (n) => Bs(e, n) },
|
|
6004
6004
|
addIssue: { value: (n) => {
|
|
6005
6005
|
e.issues.push(n), e.message = JSON.stringify(e.issues, Et, 2);
|
|
6006
6006
|
} },
|
|
@@ -6011,20 +6011,20 @@ const ad = (e, t) => {
|
|
|
6011
6011
|
return e.issues.length === 0;
|
|
6012
6012
|
} }
|
|
6013
6013
|
});
|
|
6014
|
-
},
|
|
6014
|
+
}, K = /* @__PURE__ */ h("ZodError", ad, { Parent: Error }), ud = /* @__PURE__ */ At(K), dd = /* @__PURE__ */ jt(K), ld = /* @__PURE__ */ nt(K), fd = /* @__PURE__ */ rt(K), hd = /* @__PURE__ */ Xs(K), pd = /* @__PURE__ */ Qs(K), md = /* @__PURE__ */ ec(K), _d = /* @__PURE__ */ tc(K), gd = /* @__PURE__ */ nc(K), vd = /* @__PURE__ */ rc(K), yd = /* @__PURE__ */ oc(K), bd = /* @__PURE__ */ ic(K), En = /* @__PURE__ */ new WeakMap();
|
|
6015
6015
|
function Me(e, t, n) {
|
|
6016
6016
|
const r = Object.getPrototypeOf(e);
|
|
6017
6017
|
let o = En.get(r);
|
|
6018
6018
|
if (o || (o = /* @__PURE__ */ new Set(), En.set(r, o)), !o.has(t)) {
|
|
6019
6019
|
o.add(t);
|
|
6020
|
-
for (const
|
|
6021
|
-
const
|
|
6022
|
-
Object.defineProperty(r,
|
|
6020
|
+
for (const i in n) {
|
|
6021
|
+
const s = n[i];
|
|
6022
|
+
Object.defineProperty(r, i, {
|
|
6023
6023
|
configurable: !0,
|
|
6024
6024
|
enumerable: !1,
|
|
6025
6025
|
get() {
|
|
6026
|
-
const c =
|
|
6027
|
-
return Object.defineProperty(this,
|
|
6026
|
+
const c = s.bind(this);
|
|
6027
|
+
return Object.defineProperty(this, i, {
|
|
6028
6028
|
configurable: !0,
|
|
6029
6029
|
writable: !0,
|
|
6030
6030
|
enumerable: !0,
|
|
@@ -6032,7 +6032,7 @@ function Me(e, t, n) {
|
|
|
6032
6032
|
}), c;
|
|
6033
6033
|
},
|
|
6034
6034
|
set(c) {
|
|
6035
|
-
Object.defineProperty(this,
|
|
6035
|
+
Object.defineProperty(this, i, {
|
|
6036
6036
|
configurable: !0,
|
|
6037
6037
|
writable: !0,
|
|
6038
6038
|
enumerable: !0,
|
|
@@ -6142,7 +6142,7 @@ const N = /* @__PURE__ */ h("ZodType", (e, t) => (R.init(e, t), Object.assign(e[
|
|
|
6142
6142
|
},
|
|
6143
6143
|
configurable: !0
|
|
6144
6144
|
}), e)), Mr = /* @__PURE__ */ h("_ZodString", (e, t) => {
|
|
6145
|
-
Mt.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o,
|
|
6145
|
+
Mt.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o, i) => Au(e, r, o);
|
|
6146
6146
|
const n = e._zod.bag;
|
|
6147
6147
|
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, Me(e, "_ZodString", {
|
|
6148
6148
|
regex(...r) {
|
|
@@ -6158,7 +6158,7 @@ const N = /* @__PURE__ */ h("ZodType", (e, t) => (R.init(e, t), Object.assign(e[
|
|
|
6158
6158
|
return this.check(/* @__PURE__ */ $u(...r));
|
|
6159
6159
|
},
|
|
6160
6160
|
min(...r) {
|
|
6161
|
-
return this.check(/* @__PURE__ */
|
|
6161
|
+
return this.check(/* @__PURE__ */ Ke(...r));
|
|
6162
6162
|
},
|
|
6163
6163
|
max(...r) {
|
|
6164
6164
|
return this.check(/* @__PURE__ */ Zr(...r));
|
|
@@ -6167,7 +6167,7 @@ const N = /* @__PURE__ */ h("ZodType", (e, t) => (R.init(e, t), Object.assign(e[
|
|
|
6167
6167
|
return this.check(/* @__PURE__ */ Rr(...r));
|
|
6168
6168
|
},
|
|
6169
6169
|
nonempty(...r) {
|
|
6170
|
-
return this.check(/* @__PURE__ */
|
|
6170
|
+
return this.check(/* @__PURE__ */ Ke(1, ...r));
|
|
6171
6171
|
},
|
|
6172
6172
|
lowercase(r) {
|
|
6173
6173
|
return this.check(/* @__PURE__ */ yu(r));
|
|
@@ -6192,7 +6192,7 @@ const N = /* @__PURE__ */ h("ZodType", (e, t) => (R.init(e, t), Object.assign(e[
|
|
|
6192
6192
|
}
|
|
6193
6193
|
});
|
|
6194
6194
|
}), wd = /* @__PURE__ */ h("ZodString", (e, t) => {
|
|
6195
|
-
Mt.init(e, t), Mr.init(e, t), e.email = (n) => e.check(/* @__PURE__ */ Ua(zd, n)), e.url = (n) => e.check(/* @__PURE__ */ Wa($d, n)), e.jwt = (n) => e.check(/* @__PURE__ */ au(xd, n)), e.emoji = (n) => e.check(/* @__PURE__ */
|
|
6195
|
+
Mt.init(e, t), Mr.init(e, t), e.email = (n) => e.check(/* @__PURE__ */ Ua(zd, n)), e.url = (n) => e.check(/* @__PURE__ */ Wa($d, n)), e.jwt = (n) => e.check(/* @__PURE__ */ au(xd, n)), e.emoji = (n) => e.check(/* @__PURE__ */ Ba(Sd, n)), e.guid = (n) => e.check(/* @__PURE__ */ $n(On, n)), e.uuid = (n) => e.check(/* @__PURE__ */ Ja(Ue, n)), e.uuidv4 = (n) => e.check(/* @__PURE__ */ qa(Ue, n)), e.uuidv6 = (n) => e.check(/* @__PURE__ */ Ha(Ue, n)), e.uuidv7 = (n) => e.check(/* @__PURE__ */ Va(Ue, n)), e.nanoid = (n) => e.check(/* @__PURE__ */ Ka(kd, n)), e.guid = (n) => e.check(/* @__PURE__ */ $n(On, n)), e.cuid = (n) => e.check(/* @__PURE__ */ Ga(Id, n)), e.cuid2 = (n) => e.check(/* @__PURE__ */ Ya(Ed, n)), e.ulid = (n) => e.check(/* @__PURE__ */ Xa(Od, n)), e.base64 = (n) => e.check(/* @__PURE__ */ iu(Ad, n)), e.base64url = (n) => e.check(/* @__PURE__ */ su(jd, n)), e.xid = (n) => e.check(/* @__PURE__ */ Qa(Pd, n)), e.ksuid = (n) => e.check(/* @__PURE__ */ eu(Td, n)), e.ipv4 = (n) => e.check(/* @__PURE__ */ tu(Zd, n)), e.ipv6 = (n) => e.check(/* @__PURE__ */ nu(Rd, n)), e.cidrv4 = (n) => e.check(/* @__PURE__ */ ru(Nd, n)), e.cidrv6 = (n) => e.check(/* @__PURE__ */ ou(Cd, n)), e.e164 = (n) => e.check(/* @__PURE__ */ cu(Md, n)), e.datetime = (n) => e.check(td(n)), e.date = (n) => e.check(rd(n)), e.time = (n) => e.check(id(n)), e.duration = (n) => e.check(cd(n));
|
|
6196
6196
|
});
|
|
6197
6197
|
function L(e) {
|
|
6198
6198
|
return /* @__PURE__ */ La(wd, e);
|
|
@@ -6200,11 +6200,11 @@ function L(e) {
|
|
|
6200
6200
|
const Z = /* @__PURE__ */ h("ZodStringFormat", (e, t) => {
|
|
6201
6201
|
T.init(e, t), Mr.init(e, t);
|
|
6202
6202
|
}), zd = /* @__PURE__ */ h("ZodEmail", (e, t) => {
|
|
6203
|
-
|
|
6203
|
+
Kc.init(e, t), Z.init(e, t);
|
|
6204
6204
|
}), On = /* @__PURE__ */ h("ZodGUID", (e, t) => {
|
|
6205
6205
|
Wc.init(e, t), Z.init(e, t);
|
|
6206
6206
|
}), Ue = /* @__PURE__ */ h("ZodUUID", (e, t) => {
|
|
6207
|
-
|
|
6207
|
+
Bc.init(e, t), Z.init(e, t);
|
|
6208
6208
|
}), $d = /* @__PURE__ */ h("ZodURL", (e, t) => {
|
|
6209
6209
|
Gc.init(e, t), Z.init(e, t);
|
|
6210
6210
|
}), Sd = /* @__PURE__ */ h("ZodEmoji", (e, t) => {
|
|
@@ -6238,7 +6238,7 @@ const Z = /* @__PURE__ */ h("ZodStringFormat", (e, t) => {
|
|
|
6238
6238
|
}), xd = /* @__PURE__ */ h("ZodJWT", (e, t) => {
|
|
6239
6239
|
ga.init(e, t), Z.init(e, t);
|
|
6240
6240
|
}), xr = /* @__PURE__ */ h("ZodNumber", (e, t) => {
|
|
6241
|
-
Ir.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o,
|
|
6241
|
+
Ir.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o, i) => ju(e, r, o), Me(e, "ZodNumber", {
|
|
6242
6242
|
gt(r, o) {
|
|
6243
6243
|
return this.check(/* @__PURE__ */ kn(r, o));
|
|
6244
6244
|
},
|
|
@@ -6319,10 +6319,10 @@ function Jd(e) {
|
|
|
6319
6319
|
const qd = /* @__PURE__ */ h("ZodArray", (e, t) => {
|
|
6320
6320
|
za.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) => Ju(e, n, r, o), e.element = t.element, Me(e, "ZodArray", {
|
|
6321
6321
|
min(n, r) {
|
|
6322
|
-
return this.check(/* @__PURE__ */
|
|
6322
|
+
return this.check(/* @__PURE__ */ Ke(n, r));
|
|
6323
6323
|
},
|
|
6324
6324
|
nonempty(n) {
|
|
6325
|
-
return this.check(/* @__PURE__ */
|
|
6325
|
+
return this.check(/* @__PURE__ */ Ke(1, n));
|
|
6326
6326
|
},
|
|
6327
6327
|
max(n, r) {
|
|
6328
6328
|
return this.check(/* @__PURE__ */ Zr(n, r));
|
|
@@ -6417,7 +6417,7 @@ function Vd(e, t) {
|
|
|
6417
6417
|
const Wd = /* @__PURE__ */ h("ZodDiscriminatedUnion", (e, t) => {
|
|
6418
6418
|
Dr.init(e, t), ka.init(e, t);
|
|
6419
6419
|
});
|
|
6420
|
-
function
|
|
6420
|
+
function Bd(e, t, n) {
|
|
6421
6421
|
return new Wd({
|
|
6422
6422
|
type: "union",
|
|
6423
6423
|
options: t,
|
|
@@ -6425,38 +6425,38 @@ function Kd(e, t, n) {
|
|
|
6425
6425
|
..._(n)
|
|
6426
6426
|
});
|
|
6427
6427
|
}
|
|
6428
|
-
const
|
|
6428
|
+
const Kd = /* @__PURE__ */ h("ZodIntersection", (e, t) => {
|
|
6429
6429
|
Ia.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) => Vu(e, n, r, o);
|
|
6430
6430
|
});
|
|
6431
6431
|
function Gd(e, t) {
|
|
6432
|
-
return new
|
|
6432
|
+
return new Kd({
|
|
6433
6433
|
type: "intersection",
|
|
6434
6434
|
left: e,
|
|
6435
6435
|
right: t
|
|
6436
6436
|
});
|
|
6437
6437
|
}
|
|
6438
6438
|
const Tt = /* @__PURE__ */ h("ZodEnum", (e, t) => {
|
|
6439
|
-
Ea.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o,
|
|
6439
|
+
Ea.init(e, t), N.init(e, t), e._zod.processJSONSchema = (r, o, i) => Du(e, r, o), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
6440
6440
|
const n = new Set(Object.keys(t.entries));
|
|
6441
6441
|
e.extract = (r, o) => {
|
|
6442
|
-
const
|
|
6443
|
-
for (const
|
|
6444
|
-
else throw new Error(`Key ${
|
|
6442
|
+
const i = {};
|
|
6443
|
+
for (const s of r) if (n.has(s)) i[s] = t.entries[s];
|
|
6444
|
+
else throw new Error(`Key ${s} not found in enum`);
|
|
6445
6445
|
return new Tt({
|
|
6446
6446
|
...t,
|
|
6447
6447
|
checks: [],
|
|
6448
6448
|
..._(o),
|
|
6449
|
-
entries:
|
|
6449
|
+
entries: i
|
|
6450
6450
|
});
|
|
6451
6451
|
}, e.exclude = (r, o) => {
|
|
6452
|
-
const
|
|
6453
|
-
for (const
|
|
6454
|
-
else throw new Error(`Key ${
|
|
6452
|
+
const i = { ...t.entries };
|
|
6453
|
+
for (const s of r) if (n.has(s)) delete i[s];
|
|
6454
|
+
else throw new Error(`Key ${s} not found in enum`);
|
|
6455
6455
|
return new Tt({
|
|
6456
6456
|
...t,
|
|
6457
6457
|
checks: [],
|
|
6458
6458
|
..._(o),
|
|
6459
|
-
entries:
|
|
6459
|
+
entries: i
|
|
6460
6460
|
});
|
|
6461
6461
|
};
|
|
6462
6462
|
});
|
|
@@ -6484,15 +6484,15 @@ function Ye(e, t) {
|
|
|
6484
6484
|
const Xd = /* @__PURE__ */ h("ZodTransform", (e, t) => {
|
|
6485
6485
|
Pa.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) => Uu(e, n), e._zod.parse = (n, r) => {
|
|
6486
6486
|
if (r.direction === "backward") throw new lr(e.constructor.name);
|
|
6487
|
-
n.addIssue = (
|
|
6488
|
-
if (typeof
|
|
6487
|
+
n.addIssue = (i) => {
|
|
6488
|
+
if (typeof i == "string") n.issues.push(Ae(i, n.value, t));
|
|
6489
6489
|
else {
|
|
6490
|
-
const
|
|
6491
|
-
|
|
6490
|
+
const s = i;
|
|
6491
|
+
s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(Ae(s));
|
|
6492
6492
|
}
|
|
6493
6493
|
};
|
|
6494
6494
|
const o = t.transform(n.value, n);
|
|
6495
|
-
return o instanceof Promise ? o.then((
|
|
6495
|
+
return o instanceof Promise ? o.then((i) => (n.value = i, n.fallback = !0, n)) : (n.value = o, n.fallback = !0, n);
|
|
6496
6496
|
};
|
|
6497
6497
|
});
|
|
6498
6498
|
function Qd(e) {
|
|
@@ -6529,7 +6529,7 @@ function Zn(e) {
|
|
|
6529
6529
|
});
|
|
6530
6530
|
}
|
|
6531
6531
|
const rl = /* @__PURE__ */ h("ZodDefault", (e, t) => {
|
|
6532
|
-
Ra.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) =>
|
|
6532
|
+
Ra.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) => Ku(e, n, r, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
6533
6533
|
});
|
|
6534
6534
|
function ol(e, t) {
|
|
6535
6535
|
return new rl({
|
|
@@ -6553,7 +6553,7 @@ function sl(e, t) {
|
|
|
6553
6553
|
});
|
|
6554
6554
|
}
|
|
6555
6555
|
const Lr = /* @__PURE__ */ h("ZodNonOptional", (e, t) => {
|
|
6556
|
-
Ca.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) =>
|
|
6556
|
+
Ca.init(e, t), N.init(e, t), e._zod.processJSONSchema = (n, r, o) => Bu(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
6557
6557
|
});
|
|
6558
6558
|
function cl(e, t) {
|
|
6559
6559
|
return new Lr({
|
|
@@ -6612,7 +6612,7 @@ const Se = Pt(), _l = S({
|
|
|
6612
6612
|
offset: te().int().nonnegative(),
|
|
6613
6613
|
length: te().int().nonnegative(),
|
|
6614
6614
|
newText: L()
|
|
6615
|
-
}), Ur =
|
|
6615
|
+
}), Ur = Bd("kind", [S({
|
|
6616
6616
|
kind: Ye("replace"),
|
|
6617
6617
|
path: we(L()),
|
|
6618
6618
|
newValue: Se
|
|
@@ -6775,9 +6775,9 @@ function Cn(e, t, n) {
|
|
|
6775
6775
|
if (t.length === 0) return n;
|
|
6776
6776
|
const r = e === null || typeof e != "object" ? {} : e;
|
|
6777
6777
|
let o = r;
|
|
6778
|
-
for (let
|
|
6779
|
-
const
|
|
6780
|
-
(c === null || typeof c != "object") && (o[
|
|
6778
|
+
for (let i = 0; i < t.length - 1; i++) {
|
|
6779
|
+
const s = t[i], c = o[s];
|
|
6780
|
+
(c === null || typeof c != "object") && (o[s] = {}), o = o[s];
|
|
6781
6781
|
}
|
|
6782
6782
|
return o[t[t.length - 1]] = n, r;
|
|
6783
6783
|
}
|
|
@@ -6955,15 +6955,15 @@ var pt = class {
|
|
|
6955
6955
|
}
|
|
6956
6956
|
};
|
|
6957
6957
|
function Ol(e, t) {
|
|
6958
|
-
const n = e.filter((
|
|
6958
|
+
const n = e.filter((i) => "language" in i.selector && i.selector.language === t);
|
|
6959
6959
|
if (n.length > 0)
|
|
6960
6960
|
return n.length === 1 ? { kind: "match", provider: n[0] } : { kind: "ambiguous", providers: n };
|
|
6961
6961
|
let r = -1, o = [];
|
|
6962
|
-
for (const
|
|
6963
|
-
if (!("languagePrefix" in
|
|
6962
|
+
for (const i of e) {
|
|
6963
|
+
if (!("languagePrefix" in i.selector) || !t.startsWith(i.selector.languagePrefix))
|
|
6964
6964
|
continue;
|
|
6965
|
-
const
|
|
6966
|
-
|
|
6965
|
+
const s = i.selector.languagePrefix.length;
|
|
6966
|
+
s > r ? (r = s, o = [i]) : s === r && o.push(i);
|
|
6967
6967
|
}
|
|
6968
6968
|
if (o.length !== 0)
|
|
6969
6969
|
return o.length === 1 ? { kind: "match", provider: o[0] } : { kind: "ambiguous", providers: o };
|
|
@@ -6979,7 +6979,7 @@ const Pl = `
|
|
|
6979
6979
|
}
|
|
6980
6980
|
`, Xe = "vscode-markdown-editor::control", Tl = 1e4;
|
|
6981
6981
|
function Zl(e, t, n, r) {
|
|
6982
|
-
const o = Pl.replace(/<\/style/gi, "<\\/style"),
|
|
6982
|
+
const o = Pl.replace(/<\/style/gi, "<\\/style"), i = (n ?? "").replace(/<\/style/gi, "<\\/style"), s = r ? ` nonce="${jn(r)}"` : "", a = (t ? `<base href="${jn(t)}">` : "") + `<style data-vscode-markdown-editor-base>${o}</style><style data-vscode-markdown-editor-theme>${i}</style><script${s}>(function(){var t=document.currentScript.previousElementSibling;var sendSize=function(){parent.postMessage({type:${JSON.stringify(Xe)},height:Math.max(document.documentElement.scrollHeight,document.body?document.body.scrollHeight:0)},"*");};addEventListener("message",function(e){if(e.source!==parent)return;var d=e.data;if(d&&d.type===${JSON.stringify(Xe)}&&typeof d.themeCss==="string")t.textContent=d.themeCss;});addEventListener("load",sendSize);new ResizeObserver(sendSize).observe(document.documentElement);})();<\/script>`, u = r ? e.replace(/<script\b(?![^>]*\bnonce\s*=)/gi, `<script${s}`) : e, d = u.match(/<head[^>]*>/i);
|
|
6983
6983
|
if (d?.index !== void 0) {
|
|
6984
6984
|
const f = d.index + d[0].length;
|
|
6985
6985
|
return u.slice(0, f) + a + u.slice(f);
|
|
@@ -6998,7 +6998,7 @@ class Dl {
|
|
|
6998
6998
|
constructor(t) {
|
|
6999
6999
|
this._options = t, this._providers = t.providers, this._frameLayer = document.createElement("div"), this._frameLayer.style.position = "absolute", this._frameLayer.style.inset = "0", this._frameLayer.style.height = "0", this._frameLayer.style.pointerEvents = "none", this._frameLayer.style.zIndex = "1", t.frameRoot && this._setFrameRoot(t.frameRoot), this._observer = typeof IntersectionObserver > "u" ? void 0 : new IntersectionObserver((n) => {
|
|
7000
7000
|
for (const r of n)
|
|
7001
|
-
Array.from(this._logicalEditors).find((
|
|
7001
|
+
Array.from(this._logicalEditors).find((i) => i.element === r.target)?.setVisible(r.isIntersecting);
|
|
7002
7002
|
}, { root: t.root ?? null });
|
|
7003
7003
|
}
|
|
7004
7004
|
_frameLayer;
|
|
@@ -7041,10 +7041,10 @@ class Dl {
|
|
|
7041
7041
|
this._options.onAmbiguous?.(t, o.providers);
|
|
7042
7042
|
return;
|
|
7043
7043
|
}
|
|
7044
|
-
const
|
|
7045
|
-
if (this._rejectedProviders.has(
|
|
7044
|
+
const i = xn(o.provider.id, n);
|
|
7045
|
+
if (this._rejectedProviders.has(i))
|
|
7046
7046
|
return;
|
|
7047
|
-
const
|
|
7047
|
+
const s = new Rl(
|
|
7048
7048
|
this,
|
|
7049
7049
|
o.provider,
|
|
7050
7050
|
n,
|
|
@@ -7052,7 +7052,7 @@ class Dl {
|
|
|
7052
7052
|
this._options.defaultHeight ?? 120,
|
|
7053
7053
|
this._generation
|
|
7054
7054
|
);
|
|
7055
|
-
return this._logicalEditors.add(
|
|
7055
|
+
return this._logicalEditors.add(s), this._observer?.observe(s.element), this._layoutObserver && s.observeLayout(this._layoutObserver), this._observer || s.setVisible(!0), s;
|
|
7056
7056
|
}
|
|
7057
7057
|
dispose() {
|
|
7058
7058
|
if (!this._disposed) {
|
|
@@ -7067,29 +7067,30 @@ class Dl {
|
|
|
7067
7067
|
}
|
|
7068
7068
|
async resolve(t, n) {
|
|
7069
7069
|
const r = xn(t.provider.id, t.infoString);
|
|
7070
|
-
let o = this._descriptorCache.get(r),
|
|
7070
|
+
let o = this._descriptorCache.get(r), i;
|
|
7071
7071
|
try {
|
|
7072
|
-
o ? this._descriptorCacheHits++ : (o = t.provider.resolve(t.infoString), this._descriptorCache.set(r, o)),
|
|
7072
|
+
o ? this._descriptorCacheHits++ : (o = t.provider.resolve(t.infoString), this._descriptorCache.set(r, o)), i = await o;
|
|
7073
7073
|
} catch {
|
|
7074
7074
|
o && this._descriptorCache.get(r) === o && this._descriptorCache.delete(r), this._rejectEditor(t, n, r);
|
|
7075
7075
|
return;
|
|
7076
7076
|
}
|
|
7077
|
-
if (this._disposed || t.disposed || n !== this._generation || !
|
|
7077
|
+
if (this._disposed || t.disposed || n !== this._generation || !i) {
|
|
7078
7078
|
this._rejectEditor(t, n, r);
|
|
7079
7079
|
return;
|
|
7080
7080
|
}
|
|
7081
|
-
const
|
|
7082
|
-
let c = this._pools.get(
|
|
7081
|
+
const s = Al(t.provider.id, i);
|
|
7082
|
+
let c = this._pools.get(s);
|
|
7083
7083
|
if (!c) {
|
|
7084
7084
|
const a = this._ensureFrameRoot(t);
|
|
7085
7085
|
c = new Nl(
|
|
7086
7086
|
t.provider,
|
|
7087
|
-
|
|
7087
|
+
i,
|
|
7088
7088
|
this._frameLayer,
|
|
7089
7089
|
a,
|
|
7090
7090
|
this._options.scriptNonce,
|
|
7091
|
-
this._options.themeCss
|
|
7092
|
-
|
|
7091
|
+
this._options.themeCss,
|
|
7092
|
+
this._options.iframeBootstrapUrl
|
|
7093
|
+
), this._pools.set(s, c);
|
|
7093
7094
|
}
|
|
7094
7095
|
t.resolve(c);
|
|
7095
7096
|
}
|
|
@@ -7123,8 +7124,8 @@ class Dl {
|
|
|
7123
7124
|
}
|
|
7124
7125
|
}
|
|
7125
7126
|
class Rl {
|
|
7126
|
-
constructor(t, n, r, o,
|
|
7127
|
-
this._factory = t, this.provider = n, this.infoString = r, this._content = o, this.element = document.createElement("div"), this.element.style.width = "100%", this.element.style.minHeight = `${
|
|
7127
|
+
constructor(t, n, r, o, i, s) {
|
|
7128
|
+
this._factory = t, this.provider = n, this.infoString = r, this._content = o, this.element = document.createElement("div"), this.element.style.width = "100%", this.element.style.minHeight = `${i}px`, this._frameHost = document.createElement("div"), this._frameHost.style.width = "100%", this.element.appendChild(this._frameHost), this.estimateHeight = () => parseFloat(this.element.style.minHeight) || i, this._factory.resolve(this, s);
|
|
7128
7129
|
}
|
|
7129
7130
|
element;
|
|
7130
7131
|
onEdit;
|
|
@@ -7193,8 +7194,8 @@ class Rl {
|
|
|
7193
7194
|
}
|
|
7194
7195
|
}
|
|
7195
7196
|
class Nl {
|
|
7196
|
-
constructor(t, n, r, o, s,
|
|
7197
|
-
this._provider = t, this._frameLayer = r, this._frameRoot = o, this._scriptNonce =
|
|
7197
|
+
constructor(t, n, r, o, i, s, c) {
|
|
7198
|
+
this._provider = t, this._frameLayer = r, this._frameRoot = o, this._scriptNonce = i, this._themeCss = s, this._iframeBootstrapUrl = c, this.descriptor = n;
|
|
7198
7199
|
}
|
|
7199
7200
|
descriptor;
|
|
7200
7201
|
_frames = /* @__PURE__ */ new Set();
|
|
@@ -7241,8 +7242,8 @@ class Nl {
|
|
|
7241
7242
|
}
|
|
7242
7243
|
}
|
|
7243
7244
|
class Cl {
|
|
7244
|
-
constructor(t, n, r, o,
|
|
7245
|
-
this._descriptor = n, this._hostTransport = r, this._frameRoot =
|
|
7245
|
+
constructor(t, n, r, o, i, s, c) {
|
|
7246
|
+
this._descriptor = n, this._hostTransport = r, this._frameRoot = i, this._scriptNonce = s, this._themeCss = c, this.pool = t;
|
|
7246
7247
|
const a = document.createElement("iframe");
|
|
7247
7248
|
a.setAttribute("sandbox", Jr(n.sandbox)), a.setAttribute("allow", n.sandbox?.clipboardWrite ? "clipboard-write" : ""), a.style.width = "100%", a.style.border = "none", a.style.display = "block", a.style.position = "absolute", a.style.pointerEvents = "auto", a.style.background = "transparent", a.style.height = `${n.initialHeight ?? 120}px`, t.park(a), a.addEventListener("blur", () => {
|
|
7248
7249
|
const u = this.editor;
|
|
@@ -7280,8 +7281,8 @@ class Cl {
|
|
|
7280
7281
|
layout(t) {
|
|
7281
7282
|
if (this.editor !== t)
|
|
7282
7283
|
return;
|
|
7283
|
-
const n = t.element.getBoundingClientRect(), r = this._frameRoot.getBoundingClientRect(), o = this._frameRoot === document.body,
|
|
7284
|
-
this.iframe.style.top = `${
|
|
7284
|
+
const n = t.element.getBoundingClientRect(), r = this._frameRoot.getBoundingClientRect(), o = this._frameRoot === document.body, i = o ? n.top + window.scrollY : n.top - r.top + this._frameRoot.scrollTop, s = o ? n.left + window.scrollX : n.left - r.left + this._frameRoot.scrollLeft;
|
|
7285
|
+
this.iframe.style.top = `${i}px`, this.iframe.style.left = `${s}px`, this.iframe.style.width = `${n.width}px`;
|
|
7285
7286
|
}
|
|
7286
7287
|
dispose() {
|
|
7287
7288
|
this._disposed || (this._disposed = !0, this.unbind(), window.removeEventListener("message", this._onWindowMessage), this._host?.dispose(), this._transport?.dispose(), this._hostTransport?.dispose(), this.iframe.remove());
|
|
@@ -7308,16 +7309,11 @@ class Cl {
|
|
|
7308
7309
|
this._descriptor.resourceBaseUrl,
|
|
7309
7310
|
this._getThemeCss(),
|
|
7310
7311
|
this._scriptNonce
|
|
7311
|
-
)
|
|
7312
|
-
|
|
7313
|
-
this.iframe.
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
}, { once: !0 });
|
|
7317
|
-
const i = new URL("./iframe-bootstrap.html", location.href);
|
|
7318
|
-
i.search = new URLSearchParams({ id: s }).toString(), this.iframe.src = i.toString();
|
|
7319
|
-
} else
|
|
7320
|
-
this.iframe.srcdoc = o;
|
|
7312
|
+
);
|
|
7313
|
+
this._iframeBootstrapUrl ? (this.iframe.addEventListener("load", () => {
|
|
7314
|
+
const i = this.iframe.contentDocument;
|
|
7315
|
+
i && (i.open(), i.write(o), i.close());
|
|
7316
|
+
}, { once: !0 }), this.iframe.src = this._iframeBootstrapUrl) : this.iframe.srcdoc = o;
|
|
7321
7317
|
}
|
|
7322
7318
|
_getThemeCss() {
|
|
7323
7319
|
return typeof this._themeCss == "function" ? this._themeCss() : this._themeCss;
|