@polagram/core 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +20 -4
- package/dist/polagram-core.js +1382 -1318
- package/dist/polagram-core.umd.cjs +47 -17
- package/package.json +4 -2
package/dist/polagram-core.js
CHANGED
|
@@ -8,15 +8,15 @@ const We = {
|
|
|
8
8
|
"-x": { type: "destroy", style: { line: "solid", head: "cross" } },
|
|
9
9
|
"--x": { type: "destroy", style: { line: "dotted", head: "cross" } }
|
|
10
10
|
}, At = Object.entries(We).reduce(
|
|
11
|
-
(t, [e,
|
|
12
|
-
const
|
|
13
|
-
return t[
|
|
11
|
+
(t, [e, r]) => {
|
|
12
|
+
const n = JSON.stringify({ type: r.type, style: r.style });
|
|
13
|
+
return t[n] = e, t;
|
|
14
14
|
},
|
|
15
15
|
{}
|
|
16
16
|
);
|
|
17
17
|
function Zt(t, e) {
|
|
18
|
-
const
|
|
19
|
-
return At[
|
|
18
|
+
const r = JSON.stringify({ type: t, style: e });
|
|
19
|
+
return At[r] || "->>";
|
|
20
20
|
}
|
|
21
21
|
class Ke {
|
|
22
22
|
constructor(e) {
|
|
@@ -58,8 +58,8 @@ class Ke {
|
|
|
58
58
|
* Helper to iterate over a list of events.
|
|
59
59
|
*/
|
|
60
60
|
dispatchEvents(e) {
|
|
61
|
-
for (const
|
|
62
|
-
this.dispatchEvent(
|
|
61
|
+
for (const r of e)
|
|
62
|
+
this.dispatchEvent(r);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
class Ye {
|
|
@@ -77,48 +77,48 @@ class Ye {
|
|
|
77
77
|
}
|
|
78
78
|
visitRoot(e) {
|
|
79
79
|
this.lines.push("sequenceDiagram"), this.indentLevel++, e.meta?.title && this.add(`title ${e.meta.title}`);
|
|
80
|
-
const
|
|
80
|
+
const r = /* @__PURE__ */ new Map();
|
|
81
81
|
for (const i of e.participants)
|
|
82
|
-
|
|
82
|
+
r.set(i.id, []);
|
|
83
83
|
for (const i of e.groups)
|
|
84
84
|
for (const s of i.participantIds) {
|
|
85
|
-
const o =
|
|
85
|
+
const o = r.get(s);
|
|
86
86
|
o && o.push(i);
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const n = [];
|
|
89
89
|
for (const i of e.participants) {
|
|
90
|
-
const s =
|
|
90
|
+
const s = r.get(i.id) || [];
|
|
91
91
|
let o = 0;
|
|
92
|
-
const a = Math.min(
|
|
93
|
-
for (let c = 0; c < a &&
|
|
92
|
+
const a = Math.min(n.length, s.length);
|
|
93
|
+
for (let c = 0; c < a && n[c] === s[c]; c++)
|
|
94
94
|
o++;
|
|
95
|
-
for (;
|
|
96
|
-
this.indentLevel--, this.add("end"),
|
|
95
|
+
for (; n.length > o; )
|
|
96
|
+
this.indentLevel--, this.add("end"), n.pop();
|
|
97
97
|
for (let c = o; c < s.length; c++) {
|
|
98
|
-
const
|
|
99
|
-
let
|
|
100
|
-
|
|
98
|
+
const p = s[c];
|
|
99
|
+
let h = "box";
|
|
100
|
+
p.style?.backgroundColor && (h += ` ${p.style.backgroundColor}`), p.name && (h += ` ${p.name}`), this.add(h), this.indentLevel++, n.push(p);
|
|
101
101
|
}
|
|
102
102
|
this.visitParticipant(i);
|
|
103
103
|
}
|
|
104
|
-
for (;
|
|
105
|
-
this.indentLevel--, this.add("end"),
|
|
104
|
+
for (; n.length > 0; )
|
|
105
|
+
this.indentLevel--, this.add("end"), n.pop();
|
|
106
106
|
this.traverser.dispatchEvents(e.events);
|
|
107
107
|
}
|
|
108
108
|
visitParticipant(e) {
|
|
109
|
-
const
|
|
110
|
-
e.id === e.name ? this.add(`${
|
|
109
|
+
const r = e.type === "actor" ? "actor" : "participant", n = e.name;
|
|
110
|
+
e.id === e.name ? this.add(`${r} ${e.id}`) : this.add(`${r} ${e.id} as ${n}`);
|
|
111
111
|
}
|
|
112
112
|
visitMessage(e) {
|
|
113
|
-
const
|
|
113
|
+
const r = e.from ?? "[*]", n = e.to ?? "[*]", i = Zt(e.type, e.style);
|
|
114
114
|
let s = "";
|
|
115
|
-
e.lifecycle?.activateTarget && (s += "+"), e.lifecycle?.deactivateSource && (s += "-"), this.add(`${
|
|
115
|
+
e.lifecycle?.activateTarget && (s += "+"), e.lifecycle?.deactivateSource && (s += "-"), this.add(`${r}${i}${s}${n}: ${e.text}`);
|
|
116
116
|
}
|
|
117
117
|
visitFragment(e) {
|
|
118
118
|
if (e.branches.length === 0) return;
|
|
119
|
-
const
|
|
120
|
-
this.add(`${e.operator}${
|
|
121
|
-
this.traverser.dispatchEvents(
|
|
119
|
+
const r = e.branches[0], n = r.condition ? ` ${r.condition}` : "";
|
|
120
|
+
this.add(`${e.operator}${n}`), this.indent(() => {
|
|
121
|
+
this.traverser.dispatchEvents(r.events);
|
|
122
122
|
});
|
|
123
123
|
let i = "else";
|
|
124
124
|
e.operator === "par" ? i = "and" : e.operator === "critical" && (i = "option");
|
|
@@ -131,9 +131,9 @@ class Ye {
|
|
|
131
131
|
this.add("end");
|
|
132
132
|
}
|
|
133
133
|
visitNote(e) {
|
|
134
|
-
const
|
|
135
|
-
let
|
|
136
|
-
e.participantIds.length > 0 && (
|
|
134
|
+
const r = e.position;
|
|
135
|
+
let n = "";
|
|
136
|
+
e.participantIds.length > 0 && (n = e.participantIds.join(","), r !== "over" ? n = ` of ${n}` : n = ` ${n}`), this.add(`note ${r}${n}: ${e.text}`);
|
|
137
137
|
}
|
|
138
138
|
visitActivation(e) {
|
|
139
139
|
this.add(`${e.action} ${e.participantId}`);
|
|
@@ -149,8 +149,8 @@ class Ye {
|
|
|
149
149
|
}
|
|
150
150
|
// --- Helpers ---
|
|
151
151
|
add(e) {
|
|
152
|
-
const
|
|
153
|
-
this.lines.push(`${
|
|
152
|
+
const r = " ".repeat(this.indentLevel);
|
|
153
|
+
this.lines.push(`${r}${e}`);
|
|
154
154
|
}
|
|
155
155
|
indent(e) {
|
|
156
156
|
this.indentLevel++, e(), this.indentLevel--;
|
|
@@ -168,31 +168,31 @@ class qe {
|
|
|
168
168
|
}
|
|
169
169
|
visitRoot(e) {
|
|
170
170
|
this.add("@startuml"), e.meta.title && this.add(`title ${e.meta.title}`);
|
|
171
|
-
const
|
|
171
|
+
const r = /* @__PURE__ */ new Map();
|
|
172
172
|
for (const i of e.participants)
|
|
173
|
-
|
|
173
|
+
r.set(i.id, []);
|
|
174
174
|
for (const i of e.groups)
|
|
175
175
|
for (const s of i.participantIds) {
|
|
176
|
-
const o =
|
|
176
|
+
const o = r.get(s);
|
|
177
177
|
o && o.push(i);
|
|
178
178
|
}
|
|
179
|
-
const
|
|
179
|
+
const n = [];
|
|
180
180
|
for (const i of e.participants) {
|
|
181
|
-
const s =
|
|
181
|
+
const s = r.get(i.id) || [];
|
|
182
182
|
let o = 0;
|
|
183
|
-
const a = Math.min(
|
|
184
|
-
for (let c = 0; c < a &&
|
|
183
|
+
const a = Math.min(n.length, s.length);
|
|
184
|
+
for (let c = 0; c < a && n[c] === s[c]; c++)
|
|
185
185
|
o++;
|
|
186
|
-
for (;
|
|
187
|
-
this.add("end box"),
|
|
186
|
+
for (; n.length > o; )
|
|
187
|
+
this.add("end box"), n.pop();
|
|
188
188
|
for (let c = o; c < s.length; c++) {
|
|
189
|
-
const
|
|
190
|
-
this.add(`box${d}${
|
|
189
|
+
const p = s[c], h = p.style?.backgroundColor ? ` ${p.style.backgroundColor}` : "", d = p.name ? ` "${p.name}"` : "";
|
|
190
|
+
this.add(`box${d}${h}`), n.push(p);
|
|
191
191
|
}
|
|
192
192
|
this.visitParticipant(i);
|
|
193
193
|
}
|
|
194
|
-
for (;
|
|
195
|
-
this.add("end box"),
|
|
194
|
+
for (; n.length > 0; )
|
|
195
|
+
this.add("end box"), n.pop();
|
|
196
196
|
this.traverser.dispatchEvents(e.events), this.add("@enduml");
|
|
197
197
|
}
|
|
198
198
|
visitParticipant(e) {
|
|
@@ -201,20 +201,20 @@ class qe {
|
|
|
201
201
|
visitParticipantGroup(e) {
|
|
202
202
|
}
|
|
203
203
|
visitMessage(e) {
|
|
204
|
-
const
|
|
204
|
+
const r = e.from || "[*]", n = e.to || "[*]";
|
|
205
205
|
let i = "->";
|
|
206
|
-
e.type === "reply" ? i = "-->" : e.type === "async" && (i = "->>"), this.add(`${
|
|
206
|
+
e.type === "reply" ? i = "-->" : e.type === "async" && (i = "->>"), this.add(`${r} ${i} ${n}: ${e.text}`);
|
|
207
207
|
}
|
|
208
208
|
visitFragment(e) {
|
|
209
|
-
const
|
|
210
|
-
e.branches.forEach((
|
|
211
|
-
i === 0 ? this.add(`${
|
|
209
|
+
const r = e.operator;
|
|
210
|
+
e.branches.forEach((n, i) => {
|
|
211
|
+
i === 0 ? this.add(`${r} ${n.condition || ""}`.trim()) : this.add(`else ${n.condition || ""}`.trim()), this.traverser.dispatchEvents(n.events);
|
|
212
212
|
}), this.add("end");
|
|
213
213
|
}
|
|
214
214
|
visitNote(e) {
|
|
215
|
-
const
|
|
215
|
+
const r = e.position || "over", n = e.participantIds.join(", ");
|
|
216
216
|
let i = "";
|
|
217
|
-
e.participantIds.length > 0 ?
|
|
217
|
+
e.participantIds.length > 0 ? r === "over" ? i = `note over ${n}` : i = `note ${r} of ${n}` : i = `note ${r}`, this.add(i), e.text.split(`
|
|
218
218
|
`).forEach((s) => {
|
|
219
219
|
this.add(` ${s}`);
|
|
220
220
|
}), this.add("end note");
|
|
@@ -229,8 +229,8 @@ class qe {
|
|
|
229
229
|
this.add("|||");
|
|
230
230
|
}
|
|
231
231
|
visitReference(e) {
|
|
232
|
-
const
|
|
233
|
-
this.add(`ref over ${
|
|
232
|
+
const r = e.participantIds.join(", ");
|
|
233
|
+
this.add(`ref over ${r}: ${e.text}`);
|
|
234
234
|
}
|
|
235
235
|
// --- Helpers ---
|
|
236
236
|
add(e) {
|
|
@@ -261,10 +261,10 @@ class Xe {
|
|
|
261
261
|
this.readChar();
|
|
262
262
|
}
|
|
263
263
|
readWhile(e) {
|
|
264
|
-
const
|
|
264
|
+
const r = this.position;
|
|
265
265
|
for (; e(this.ch); )
|
|
266
266
|
this.readChar();
|
|
267
|
-
return this.input.slice(
|
|
267
|
+
return this.input.slice(r, this.position);
|
|
268
268
|
}
|
|
269
269
|
isLetter(e) {
|
|
270
270
|
return "a" <= e && e <= "z" || "A" <= e && e <= "Z" || e === "_" ? !0 : e.charCodeAt(0) > 127 ? !/[\s\d]/.test(e) : !1;
|
|
@@ -290,20 +290,20 @@ class Xe {
|
|
|
290
290
|
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
291
291
|
`; )
|
|
292
292
|
this.readChar();
|
|
293
|
-
const
|
|
294
|
-
return this.readChar(),
|
|
293
|
+
const r = this.input.slice(e, this.position);
|
|
294
|
+
return this.readChar(), r;
|
|
295
295
|
}
|
|
296
296
|
/**
|
|
297
297
|
* Create a token with position information.
|
|
298
298
|
*/
|
|
299
|
-
createToken(e,
|
|
299
|
+
createToken(e, r, n, i) {
|
|
300
300
|
return {
|
|
301
301
|
type: e,
|
|
302
|
-
literal:
|
|
302
|
+
literal: r,
|
|
303
303
|
line: this.line,
|
|
304
304
|
column: i,
|
|
305
|
-
start:
|
|
306
|
-
end: this.position >
|
|
305
|
+
start: n,
|
|
306
|
+
end: this.position > n ? this.position : n + r.length
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
309
|
}
|
|
@@ -311,58 +311,58 @@ let Ct = class extends Xe {
|
|
|
311
311
|
nextToken() {
|
|
312
312
|
if (this.skipWhitespace(), this.ch === "%" && this.peekChar() === "%")
|
|
313
313
|
return this.skipComment(), this.nextToken();
|
|
314
|
-
const e = this.position,
|
|
315
|
-
let
|
|
314
|
+
const e = this.position, r = this.column;
|
|
315
|
+
let n;
|
|
316
316
|
switch (this.ch) {
|
|
317
317
|
case ":":
|
|
318
|
-
|
|
318
|
+
n = this.newToken("COLON", this.ch, e, r);
|
|
319
319
|
break;
|
|
320
320
|
case ",":
|
|
321
|
-
|
|
321
|
+
n = this.newToken("COMMA", this.ch, e, r);
|
|
322
322
|
break;
|
|
323
323
|
case "+":
|
|
324
|
-
|
|
324
|
+
n = this.newToken("PLUS", this.ch, e, r);
|
|
325
325
|
break;
|
|
326
326
|
case "-":
|
|
327
327
|
if (this.isArrowStart()) {
|
|
328
328
|
const i = this.readArrow();
|
|
329
|
-
return
|
|
329
|
+
return n = this.newToken("ARROW", i, e, r), n;
|
|
330
330
|
} else
|
|
331
|
-
|
|
331
|
+
n = this.newToken("MINUS", this.ch, e, r);
|
|
332
332
|
break;
|
|
333
333
|
case '"': {
|
|
334
334
|
const i = this.readString();
|
|
335
|
-
return
|
|
335
|
+
return n = this.newToken("STRING", i, e, r), n;
|
|
336
336
|
}
|
|
337
337
|
case `
|
|
338
338
|
`:
|
|
339
|
-
|
|
339
|
+
n = this.newToken("NEWLINE", this.ch, e, r);
|
|
340
340
|
break;
|
|
341
341
|
case "":
|
|
342
|
-
|
|
342
|
+
n = this.newToken("EOF", "", e, r);
|
|
343
343
|
break;
|
|
344
344
|
default:
|
|
345
345
|
if (this.isLetter(this.ch)) {
|
|
346
346
|
const i = this.readIdentifier(), s = this.lookupIdent(i);
|
|
347
|
-
return this.newToken(s, i, e,
|
|
347
|
+
return this.newToken(s, i, e, r);
|
|
348
348
|
} else if (this.isDigit(this.ch)) {
|
|
349
349
|
const i = this.readNumber();
|
|
350
|
-
return this.newToken("IDENTIFIER", i, e,
|
|
350
|
+
return this.newToken("IDENTIFIER", i, e, r);
|
|
351
351
|
} else
|
|
352
|
-
|
|
352
|
+
n = this.newToken("UNKNOWN", this.ch, e, r);
|
|
353
353
|
}
|
|
354
|
-
return this.readChar(),
|
|
354
|
+
return this.readChar(), n;
|
|
355
355
|
}
|
|
356
|
-
newToken(e,
|
|
356
|
+
newToken(e, r, n, i) {
|
|
357
357
|
return {
|
|
358
358
|
type: e,
|
|
359
|
-
literal:
|
|
359
|
+
literal: r,
|
|
360
360
|
line: this.line,
|
|
361
361
|
column: i,
|
|
362
|
-
start:
|
|
362
|
+
start: n,
|
|
363
363
|
// If the lexer position has advanced beyond the start (consumed tokens like String/Arrow), use that position.
|
|
364
364
|
// Otherwise (simple chars), assume length-based calculation.
|
|
365
|
-
end: this.position >
|
|
365
|
+
end: this.position > n ? this.position : n + r.length
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
readNumber() {
|
|
@@ -376,8 +376,8 @@ let Ct = class extends Xe {
|
|
|
376
376
|
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
377
377
|
`; )
|
|
378
378
|
this.readChar();
|
|
379
|
-
const
|
|
380
|
-
return this.ch, this.readChar(),
|
|
379
|
+
const r = this.input.slice(e, this.position);
|
|
380
|
+
return this.ch, this.readChar(), r;
|
|
381
381
|
}
|
|
382
382
|
isArrowStart() {
|
|
383
383
|
if (this.ch !== "-") return !1;
|
|
@@ -387,14 +387,14 @@ let Ct = class extends Xe {
|
|
|
387
387
|
readArrow() {
|
|
388
388
|
if (this.input.slice(this.position, this.position + 4) === "-->>")
|
|
389
389
|
return this.readMulti(4), "-->>";
|
|
390
|
-
const
|
|
391
|
-
if (
|
|
392
|
-
return this.readMulti(3),
|
|
393
|
-
const
|
|
394
|
-
return
|
|
390
|
+
const r = this.input.slice(this.position, this.position + 3);
|
|
391
|
+
if (r === "-->" || r === "--)" || r === "->>" || r === "--x")
|
|
392
|
+
return this.readMulti(3), r;
|
|
393
|
+
const n = this.input.slice(this.position, this.position + 2);
|
|
394
|
+
return n === "->" || n === "-)" || n === "-x" ? (this.readMulti(2), n) : "-";
|
|
395
395
|
}
|
|
396
396
|
readMulti(e) {
|
|
397
|
-
for (let
|
|
397
|
+
for (let r = 0; r < e; r++) this.readChar();
|
|
398
398
|
}
|
|
399
399
|
skipComment() {
|
|
400
400
|
for (; this.ch !== `
|
|
@@ -487,12 +487,12 @@ let Rt = class extends Qe {
|
|
|
487
487
|
};
|
|
488
488
|
return e.events = this.parseBlock(e), e;
|
|
489
489
|
}
|
|
490
|
-
parseBlock(e,
|
|
491
|
-
const
|
|
490
|
+
parseBlock(e, r = []) {
|
|
491
|
+
const n = [];
|
|
492
492
|
for (; !this.isCurrentToken("EOF"); ) {
|
|
493
493
|
const i = this.getCurrentTokenType();
|
|
494
|
-
if (
|
|
495
|
-
return
|
|
494
|
+
if (r.includes(i))
|
|
495
|
+
return n;
|
|
496
496
|
if (i === "NEWLINE") {
|
|
497
497
|
this.advance();
|
|
498
498
|
continue;
|
|
@@ -507,7 +507,7 @@ let Rt = class extends Qe {
|
|
|
507
507
|
}
|
|
508
508
|
if (i === "BOX") {
|
|
509
509
|
const s = this.parseGroup(e);
|
|
510
|
-
|
|
510
|
+
n.push(...s);
|
|
511
511
|
continue;
|
|
512
512
|
}
|
|
513
513
|
if (i === "PARTICIPANT" || i === "ACTOR") {
|
|
@@ -515,39 +515,39 @@ let Rt = class extends Qe {
|
|
|
515
515
|
continue;
|
|
516
516
|
}
|
|
517
517
|
if (i === "LOOP" || i === "ALT" || i === "OPT" || i === "PAR" || i === "BREAK" || i === "CRITICAL" || i === "RECT") {
|
|
518
|
-
|
|
518
|
+
n.push(this.parseFragment(e));
|
|
519
519
|
continue;
|
|
520
520
|
}
|
|
521
521
|
if (i === "NOTE") {
|
|
522
|
-
|
|
522
|
+
n.push(this.parseNote(e));
|
|
523
523
|
continue;
|
|
524
524
|
}
|
|
525
525
|
if (i === "ACTIVATE" || i === "DEACTIVATE") {
|
|
526
|
-
|
|
526
|
+
n.push(this.parseActivation(e));
|
|
527
527
|
continue;
|
|
528
528
|
}
|
|
529
529
|
if (this.isParticipantToken(this.currToken)) {
|
|
530
530
|
const s = this.parseMessage(e);
|
|
531
531
|
if (s) {
|
|
532
|
-
|
|
532
|
+
n.push(s);
|
|
533
533
|
continue;
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
this.advance();
|
|
537
537
|
}
|
|
538
|
-
return
|
|
538
|
+
return n;
|
|
539
539
|
}
|
|
540
540
|
isParticipantToken(e) {
|
|
541
541
|
return e.type === "IDENTIFIER" || e.type === "STRING";
|
|
542
542
|
}
|
|
543
543
|
parseGroup(e) {
|
|
544
544
|
this.advance();
|
|
545
|
-
const
|
|
546
|
-
let
|
|
547
|
-
const s =
|
|
545
|
+
const r = this.readRestOfLine().trim();
|
|
546
|
+
let n = r, i;
|
|
547
|
+
const s = r.split(/\s+/);
|
|
548
548
|
if (s.length > 0) {
|
|
549
|
-
const
|
|
550
|
-
(
|
|
549
|
+
const p = s[0];
|
|
550
|
+
(p.startsWith("#") || [
|
|
551
551
|
"rgb",
|
|
552
552
|
"rgba",
|
|
553
553
|
"transparent",
|
|
@@ -558,13 +558,13 @@ let Rt = class extends Qe {
|
|
|
558
558
|
"red",
|
|
559
559
|
"blue",
|
|
560
560
|
"green"
|
|
561
|
-
].includes(
|
|
561
|
+
].includes(p.toLowerCase())) && (i = p, n = s.slice(1).join(" "));
|
|
562
562
|
}
|
|
563
|
-
|
|
563
|
+
n || (n = `Group ${this.idCounters.group + 1}`);
|
|
564
564
|
const o = {
|
|
565
565
|
kind: "group",
|
|
566
566
|
id: this.generateId("group"),
|
|
567
|
-
name:
|
|
567
|
+
name: n,
|
|
568
568
|
type: "box",
|
|
569
569
|
participantIds: [],
|
|
570
570
|
style: i ? { backgroundColor: i } : void 0
|
|
@@ -576,12 +576,12 @@ let Rt = class extends Qe {
|
|
|
576
576
|
return this.currentGroup = a, this.isCurrentToken("END") && this.advance(), c;
|
|
577
577
|
}
|
|
578
578
|
parseFragment(e) {
|
|
579
|
-
const
|
|
580
|
-
let
|
|
581
|
-
|
|
579
|
+
const r = this.getCurrentTokenType();
|
|
580
|
+
let n = "loop";
|
|
581
|
+
r === "ALT" && (n = "alt"), r === "OPT" && (n = "opt"), r === "PAR" && (n = "par"), r === "BREAK" && (n = "break"), r === "CRITICAL" && (n = "critical"), r === "RECT" && (n = "rect"), this.advance();
|
|
582
582
|
const i = this.readRestOfLine(), s = [];
|
|
583
583
|
let o;
|
|
584
|
-
|
|
584
|
+
n === "par" ? o = ["END", "ELSE", "AND"] : n === "critical" ? o = ["END", "OPTION"] : o = ["END", "ELSE"];
|
|
585
585
|
const a = this.parseBlock(e, o);
|
|
586
586
|
for (s.push({
|
|
587
587
|
id: this.generateId("br"),
|
|
@@ -589,87 +589,87 @@ let Rt = class extends Qe {
|
|
|
589
589
|
events: a
|
|
590
590
|
}); this.isCurrentToken("AND"); ) {
|
|
591
591
|
this.advance();
|
|
592
|
-
const c = this.readRestOfLine(),
|
|
592
|
+
const c = this.readRestOfLine(), p = this.parseBlock(e, ["END", "AND"]);
|
|
593
593
|
s.push({
|
|
594
594
|
id: this.generateId("br"),
|
|
595
595
|
condition: c,
|
|
596
|
-
events:
|
|
596
|
+
events: p
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
for (; this.isCurrentToken("OPTION"); ) {
|
|
600
600
|
this.advance();
|
|
601
|
-
const c = this.readRestOfLine(),
|
|
601
|
+
const c = this.readRestOfLine(), p = this.parseBlock(e, ["END", "OPTION"]);
|
|
602
602
|
s.push({
|
|
603
603
|
id: this.generateId("br"),
|
|
604
604
|
condition: c,
|
|
605
|
-
events:
|
|
605
|
+
events: p
|
|
606
606
|
});
|
|
607
607
|
}
|
|
608
608
|
for (; this.isCurrentToken("ELSE"); ) {
|
|
609
609
|
this.advance();
|
|
610
|
-
const c = this.readRestOfLine(),
|
|
610
|
+
const c = this.readRestOfLine(), p = this.parseBlock(e, ["END", "ELSE"]);
|
|
611
611
|
s.push({
|
|
612
612
|
id: this.generateId("br"),
|
|
613
613
|
condition: c,
|
|
614
|
-
events:
|
|
614
|
+
events: p
|
|
615
615
|
});
|
|
616
616
|
}
|
|
617
617
|
return this.isCurrentToken("END") && this.advance(), {
|
|
618
618
|
kind: "fragment",
|
|
619
619
|
id: this.generateId("frag"),
|
|
620
|
-
operator:
|
|
620
|
+
operator: n,
|
|
621
621
|
branches: s
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
624
|
parseParticipant(e) {
|
|
625
|
-
const
|
|
625
|
+
const r = this.currToken.type === "ACTOR";
|
|
626
626
|
this.advance();
|
|
627
|
-
let
|
|
628
|
-
if (this.isParticipantToken(this.currToken) && (
|
|
627
|
+
let n = "", i = "";
|
|
628
|
+
if (this.isParticipantToken(this.currToken) && (n = this.currToken.literal, i = n, this.advance()), this.currToken.type === "AS") {
|
|
629
629
|
this.advance();
|
|
630
630
|
const o = this.readRestOfLine().trim();
|
|
631
631
|
o && (i = o);
|
|
632
632
|
}
|
|
633
|
-
const s = e.participants.find((o) => o.id ===
|
|
634
|
-
s ? (i !==
|
|
635
|
-
id:
|
|
633
|
+
const s = e.participants.find((o) => o.id === n);
|
|
634
|
+
s ? (i !== n && (s.name = i), r && (s.type = "actor")) : e.participants.push({
|
|
635
|
+
id: n,
|
|
636
636
|
name: i,
|
|
637
|
-
type:
|
|
638
|
-
}), this.currentGroup && (this.currentGroup.participantIds.includes(
|
|
637
|
+
type: r ? "actor" : "participant"
|
|
638
|
+
}), this.currentGroup && (this.currentGroup.participantIds.includes(n) || this.currentGroup.participantIds.push(n));
|
|
639
639
|
}
|
|
640
640
|
parseNote(e) {
|
|
641
641
|
this.advance();
|
|
642
|
-
let
|
|
643
|
-
this.currToken.type === "LEFT" ? (
|
|
644
|
-
const
|
|
645
|
-
for (; this.isParticipantToken(this.currToken) && (
|
|
642
|
+
let r = "over";
|
|
643
|
+
this.currToken.type === "LEFT" ? (r = "left", this.advance()) : this.currToken.type === "RIGHT" ? (r = "right", this.advance()) : this.currToken.type === "OVER" && (r = "over", this.advance()), this.currToken.type === "OF" && this.advance();
|
|
644
|
+
const n = [];
|
|
645
|
+
for (; this.isParticipantToken(this.currToken) && (n.push(this.currToken.literal), this.ensureParticipant(e, this.currToken.literal), this.advance(), this.currToken.type === "COMMA"); )
|
|
646
646
|
this.advance();
|
|
647
647
|
let i = "";
|
|
648
648
|
return this.currToken.type === "COLON" && (this.advance(), i = this.readRestOfLine()), {
|
|
649
649
|
kind: "note",
|
|
650
650
|
id: this.generateId("note"),
|
|
651
|
-
position:
|
|
652
|
-
participantIds:
|
|
651
|
+
position: r,
|
|
652
|
+
participantIds: n,
|
|
653
653
|
text: i
|
|
654
654
|
};
|
|
655
655
|
}
|
|
656
656
|
parseActivation(e) {
|
|
657
|
-
const
|
|
657
|
+
const r = this.currToken.type === "ACTIVATE" ? "activate" : "deactivate";
|
|
658
658
|
this.advance();
|
|
659
|
-
let
|
|
660
|
-
return this.isParticipantToken(this.currToken) && (
|
|
659
|
+
let n = "";
|
|
660
|
+
return this.isParticipantToken(this.currToken) && (n = this.currToken.literal, this.ensureParticipant(e, n), this.advance()), {
|
|
661
661
|
kind: "activation",
|
|
662
|
-
participantId:
|
|
663
|
-
action:
|
|
662
|
+
participantId: n,
|
|
663
|
+
action: r
|
|
664
664
|
};
|
|
665
665
|
}
|
|
666
666
|
parseMessage(e) {
|
|
667
667
|
if (this.peekToken.type !== "ARROW")
|
|
668
668
|
return null;
|
|
669
|
-
const n = this.currToken.literal;
|
|
670
|
-
if (this.ensureParticipant(e, n), this.advance(), this.currToken.type !== "ARROW")
|
|
671
|
-
return null;
|
|
672
669
|
const r = this.currToken.literal;
|
|
670
|
+
if (this.ensureParticipant(e, r), this.advance(), this.currToken.type !== "ARROW")
|
|
671
|
+
return null;
|
|
672
|
+
const n = this.currToken.literal;
|
|
673
673
|
this.advance();
|
|
674
674
|
let i = !1, s = !1;
|
|
675
675
|
if (this.isCurrentToken("PLUS") && (i = !0, this.advance()), this.isCurrentToken("MINUS") && (s = !0, this.advance()), !this.isParticipantToken(this.currToken)) return null;
|
|
@@ -677,21 +677,21 @@ let Rt = class extends Qe {
|
|
|
677
677
|
this.ensureParticipant(e, o), this.advance();
|
|
678
678
|
let a = "";
|
|
679
679
|
this.isCurrentToken("COLON") && (this.advance(), a = this.readRestOfLine());
|
|
680
|
-
const { type: c, style:
|
|
680
|
+
const { type: c, style: p } = this.resolveArrow(n);
|
|
681
681
|
return {
|
|
682
682
|
kind: "message",
|
|
683
683
|
id: this.generateId("evt"),
|
|
684
|
-
from:
|
|
684
|
+
from: r,
|
|
685
685
|
to: o,
|
|
686
686
|
text: a,
|
|
687
687
|
type: c,
|
|
688
|
-
style:
|
|
688
|
+
style: p,
|
|
689
689
|
lifecycle: i || s ? { activateTarget: i, deactivateSource: s } : void 0
|
|
690
690
|
};
|
|
691
691
|
}
|
|
692
692
|
resolveArrow(e) {
|
|
693
|
-
const
|
|
694
|
-
return
|
|
693
|
+
const r = We[e];
|
|
694
|
+
return r || { type: "sync", style: { line: "solid", head: "arrow" } };
|
|
695
695
|
}
|
|
696
696
|
generateId(e) {
|
|
697
697
|
return this.idCounters[e]++, `${e}_${this.idCounters[e]}`;
|
|
@@ -700,76 +700,76 @@ let Rt = class extends Qe {
|
|
|
700
700
|
if (this.isCurrentToken("NEWLINE") || this.isCurrentToken("EOF"))
|
|
701
701
|
return "";
|
|
702
702
|
const e = this.currToken.start;
|
|
703
|
-
let
|
|
703
|
+
let r = this.currToken.end;
|
|
704
704
|
for (; !this.isCurrentToken("NEWLINE") && !this.isCurrentToken("EOF"); )
|
|
705
|
-
|
|
706
|
-
return this.lexer.getInput().slice(e,
|
|
705
|
+
r = this.currToken.end, this.advance();
|
|
706
|
+
return this.lexer.getInput().slice(e, r);
|
|
707
707
|
}
|
|
708
|
-
ensureParticipant(e,
|
|
709
|
-
e.participants.find((
|
|
710
|
-
id:
|
|
711
|
-
name:
|
|
708
|
+
ensureParticipant(e, r) {
|
|
709
|
+
e.participants.find((n) => n.id === r) || e.participants.push({
|
|
710
|
+
id: r,
|
|
711
|
+
name: r,
|
|
712
712
|
type: "participant"
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
};
|
|
716
|
-
const
|
|
716
|
+
const xt = {
|
|
717
717
|
parse: (t) => {
|
|
718
718
|
const e = new Ct(t);
|
|
719
719
|
return new Rt(e).parse();
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
|
-
class
|
|
722
|
+
class Lt extends Xe {
|
|
723
723
|
nextToken() {
|
|
724
724
|
this.skipWhitespace();
|
|
725
|
-
const e = this.position,
|
|
726
|
-
let
|
|
725
|
+
const e = this.position, r = this.column;
|
|
726
|
+
let n;
|
|
727
727
|
switch (this.ch) {
|
|
728
728
|
case `
|
|
729
729
|
`:
|
|
730
|
-
|
|
730
|
+
n = this.newToken("NEWLINE", this.ch, e, r);
|
|
731
731
|
break;
|
|
732
732
|
case "@":
|
|
733
|
-
this.peekString("startuml") ? (this.readMulti(9),
|
|
733
|
+
this.peekString("startuml") ? (this.readMulti(9), n = this.newToken("START_UML", "@startuml", e, r)) : this.peekString("enduml") ? (this.readMulti(7), n = this.newToken("END_UML", "@enduml", e, r)) : n = this.newToken("UNKNOWN", this.ch, e, r);
|
|
734
734
|
break;
|
|
735
735
|
case ",":
|
|
736
|
-
|
|
736
|
+
n = this.newToken("COMMA", ",", e, r);
|
|
737
737
|
break;
|
|
738
738
|
case '"': {
|
|
739
739
|
const i = this.readString();
|
|
740
|
-
return this.newToken("STRING", i, e,
|
|
740
|
+
return this.newToken("STRING", i, e, r);
|
|
741
741
|
}
|
|
742
742
|
case ":":
|
|
743
|
-
|
|
743
|
+
n = this.newToken("COLON", ":", e, r);
|
|
744
744
|
break;
|
|
745
745
|
case "-": {
|
|
746
746
|
const i = this.readArrow();
|
|
747
|
-
i ?
|
|
747
|
+
i ? n = this.newToken("ARROW", i, e, r) : n = this.newToken("UNKNOWN", this.ch, e, r);
|
|
748
748
|
break;
|
|
749
749
|
}
|
|
750
750
|
case "=": {
|
|
751
751
|
if (this.peekExact("=")) {
|
|
752
752
|
const i = this.readDivider();
|
|
753
|
-
return this.newToken("DIVIDER", i, e,
|
|
753
|
+
return this.newToken("DIVIDER", i, e, r);
|
|
754
754
|
}
|
|
755
|
-
|
|
755
|
+
n = this.newToken("UNKNOWN", this.ch, e, r);
|
|
756
756
|
break;
|
|
757
757
|
}
|
|
758
758
|
case "":
|
|
759
|
-
|
|
759
|
+
n = this.newToken("EOF", "", e, r);
|
|
760
760
|
break;
|
|
761
761
|
default:
|
|
762
762
|
if (this.isLetter(this.ch)) {
|
|
763
763
|
const i = this.readIdentifier(), s = this.lookupIdent(i);
|
|
764
|
-
return this.newToken(s, i, e,
|
|
764
|
+
return this.newToken(s, i, e, r);
|
|
765
765
|
} else
|
|
766
|
-
|
|
766
|
+
n = this.newToken("UNKNOWN", this.ch, e, r);
|
|
767
767
|
}
|
|
768
|
-
return this.readChar(),
|
|
768
|
+
return this.readChar(), n;
|
|
769
769
|
}
|
|
770
|
-
newToken(e,
|
|
771
|
-
const s = this.position ===
|
|
772
|
-
return { type: e, literal:
|
|
770
|
+
newToken(e, r, n, i) {
|
|
771
|
+
const s = this.position === n ? n + r.length : this.position;
|
|
772
|
+
return { type: e, literal: r, line: this.line, column: i, start: n, end: s };
|
|
773
773
|
}
|
|
774
774
|
// Override readString to handle PlantUML specific behavior
|
|
775
775
|
readString() {
|
|
@@ -777,8 +777,8 @@ class xt extends Xe {
|
|
|
777
777
|
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
778
778
|
`; )
|
|
779
779
|
this.readChar();
|
|
780
|
-
const
|
|
781
|
-
return this.readChar(),
|
|
780
|
+
const r = this.input.slice(e, this.position);
|
|
781
|
+
return this.readChar(), r;
|
|
782
782
|
}
|
|
783
783
|
lookupIdent(e) {
|
|
784
784
|
return {
|
|
@@ -816,8 +816,8 @@ class xt extends Xe {
|
|
|
816
816
|
return this.input[this.position + 1] === e;
|
|
817
817
|
}
|
|
818
818
|
peekString(e) {
|
|
819
|
-
for (let
|
|
820
|
-
if (this.input[this.position + 1 +
|
|
819
|
+
for (let r = 0; r < e.length; r++)
|
|
820
|
+
if (this.input[this.position + 1 + r] !== e[r]) return !1;
|
|
821
821
|
return !0;
|
|
822
822
|
}
|
|
823
823
|
readRestOfLine() {
|
|
@@ -828,11 +828,11 @@ class xt extends Xe {
|
|
|
828
828
|
return this.input.slice(e, this.position).trim();
|
|
829
829
|
}
|
|
830
830
|
readMulti(e) {
|
|
831
|
-
for (let
|
|
831
|
+
for (let r = 0; r < e; r++) this.readChar();
|
|
832
832
|
}
|
|
833
833
|
readDivider() {
|
|
834
|
-
const
|
|
835
|
-
return
|
|
834
|
+
const r = this.readRestOfLine().match(/^==\s*(.*?)\s*==$/);
|
|
835
|
+
return r ? r[1] : "";
|
|
836
836
|
}
|
|
837
837
|
}
|
|
838
838
|
class Dt extends Qe {
|
|
@@ -869,41 +869,41 @@ class Dt extends Qe {
|
|
|
869
869
|
continue;
|
|
870
870
|
}
|
|
871
871
|
if (this.currToken.type === "DIVIDER") {
|
|
872
|
-
const
|
|
872
|
+
const r = {
|
|
873
873
|
kind: "divider",
|
|
874
874
|
id: `div_${e.events.length + 1}`,
|
|
875
875
|
text: this.currToken.literal || void 0
|
|
876
876
|
};
|
|
877
|
-
e.events.push(
|
|
877
|
+
e.events.push(r), this.advance();
|
|
878
878
|
continue;
|
|
879
879
|
}
|
|
880
880
|
if (this.isParticipantToken(this.currToken)) {
|
|
881
|
-
const
|
|
882
|
-
if (
|
|
883
|
-
e.events.push(
|
|
881
|
+
const r = this.parseMessage(e);
|
|
882
|
+
if (r) {
|
|
883
|
+
e.events.push(r);
|
|
884
884
|
continue;
|
|
885
885
|
}
|
|
886
886
|
}
|
|
887
887
|
if (this.currToken.type === "ACTIVATE" || this.currToken.type === "DEACTIVATE") {
|
|
888
|
-
const
|
|
889
|
-
|
|
888
|
+
const r = this.parseActivation(e);
|
|
889
|
+
r && e.events.push(r);
|
|
890
890
|
continue;
|
|
891
891
|
}
|
|
892
892
|
if (this.currToken.type === "NOTE") {
|
|
893
|
-
const
|
|
894
|
-
|
|
893
|
+
const r = this.parseNote(e);
|
|
894
|
+
r && e.events.push(r);
|
|
895
895
|
continue;
|
|
896
896
|
}
|
|
897
897
|
if (["ALT", "OPT", "LOOP"].includes(this.currToken.type)) {
|
|
898
|
-
const
|
|
899
|
-
|
|
898
|
+
const r = this.parseFragment(e);
|
|
899
|
+
r && e.events.push(r);
|
|
900
900
|
continue;
|
|
901
901
|
}
|
|
902
902
|
if (this.currToken.type === "END")
|
|
903
903
|
return e;
|
|
904
904
|
if (this.currToken.type === "BOX") {
|
|
905
|
-
const
|
|
906
|
-
|
|
905
|
+
const r = this.parseGroup(e);
|
|
906
|
+
r && e.groups.push(r);
|
|
907
907
|
continue;
|
|
908
908
|
}
|
|
909
909
|
this.advance();
|
|
@@ -912,8 +912,8 @@ class Dt extends Qe {
|
|
|
912
912
|
}
|
|
913
913
|
parseGroup(e) {
|
|
914
914
|
this.advance();
|
|
915
|
-
let
|
|
916
|
-
this.currToken.type === "STRING" && (
|
|
915
|
+
let r = "", n;
|
|
916
|
+
this.currToken.type === "STRING" && (r = this.currToken.literal, this.advance()), this.currToken.type === "UNKNOWN" && this.currToken.literal === "#" && (this.advance(), this.isTokenType("IDENTIFIER") && (n = `#${this.currToken.literal}`, this.advance()));
|
|
917
917
|
const i = [];
|
|
918
918
|
for (; this.currToken.type !== "EOF"; ) {
|
|
919
919
|
if (this.currToken.type === "END") {
|
|
@@ -936,14 +936,14 @@ class Dt extends Qe {
|
|
|
936
936
|
return {
|
|
937
937
|
kind: "group",
|
|
938
938
|
id: `group_${e.groups.length + 1}`,
|
|
939
|
-
name:
|
|
939
|
+
name: r,
|
|
940
940
|
type: "box",
|
|
941
941
|
participantIds: i,
|
|
942
|
-
style:
|
|
942
|
+
style: n ? { backgroundColor: n } : void 0
|
|
943
943
|
};
|
|
944
944
|
}
|
|
945
945
|
parseFragment(e) {
|
|
946
|
-
const
|
|
946
|
+
const r = "fragment", n = this.currToken.literal.toLowerCase();
|
|
947
947
|
this.advance();
|
|
948
948
|
const i = this.readRestOfLine().trim(), s = [];
|
|
949
949
|
let o = [];
|
|
@@ -955,8 +955,8 @@ class Dt extends Qe {
|
|
|
955
955
|
}
|
|
956
956
|
if (this.currToken.type === "ELSE") {
|
|
957
957
|
this.advance();
|
|
958
|
-
const
|
|
959
|
-
o = [], s.push({ id: `br_${s.length + 1}`, condition:
|
|
958
|
+
const p = this.readRestOfLine().trim();
|
|
959
|
+
o = [], s.push({ id: `br_${s.length + 1}`, condition: p, events: o });
|
|
960
960
|
continue;
|
|
961
961
|
}
|
|
962
962
|
if (this.currToken.type === "NEWLINE") {
|
|
@@ -967,9 +967,9 @@ class Dt extends Qe {
|
|
|
967
967
|
c && o.push(c);
|
|
968
968
|
}
|
|
969
969
|
return {
|
|
970
|
-
kind:
|
|
970
|
+
kind: r,
|
|
971
971
|
id: `frag_${e.events.length + 1}`,
|
|
972
|
-
operator:
|
|
972
|
+
operator: n,
|
|
973
973
|
branches: s
|
|
974
974
|
};
|
|
975
975
|
}
|
|
@@ -978,17 +978,17 @@ class Dt extends Qe {
|
|
|
978
978
|
if (["PARTICIPANT", "ACTOR", "DATABASE", "BOUNDARY", "CONTROL", "ENTITY", "COLLECTIONS", "QUEUE"].includes(this.currToken.type))
|
|
979
979
|
return this.parseParticipant(e), null;
|
|
980
980
|
if (this.isParticipantToken(this.currToken)) {
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
981
|
+
const r = this.parseMessage(e);
|
|
982
|
+
if (r) return r;
|
|
983
983
|
}
|
|
984
984
|
return this.currToken.type === "ACTIVATE" || this.currToken.type === "DEACTIVATE" ? this.parseActivation(e) : this.currToken.type === "NOTE" ? this.parseNote(e) : ["ALT", "OPT", "LOOP"].includes(this.currToken.type) ? this.parseFragment(e) : (this.advance(), null);
|
|
985
985
|
}
|
|
986
986
|
parseNote(e) {
|
|
987
987
|
this.advance();
|
|
988
|
-
let
|
|
989
|
-
this.currToken.type === "LEFT" ? (
|
|
990
|
-
const
|
|
991
|
-
for (; this.isParticipantToken(this.currToken) && (
|
|
988
|
+
let r = "over";
|
|
989
|
+
this.currToken.type === "LEFT" ? (r = "left", this.advance()) : this.currToken.type === "RIGHT" ? (r = "right", this.advance()) : this.currToken.type === "OVER" && (r = "over", this.advance()), this.currToken.type === "OF" && this.advance();
|
|
990
|
+
const n = [];
|
|
991
|
+
for (; this.isParticipantToken(this.currToken) && (n.push(this.currToken.literal), this.ensureParticipant(e, this.currToken.literal), this.advance(), this.currToken.type === "COMMA"); )
|
|
992
992
|
this.advance();
|
|
993
993
|
let i = "";
|
|
994
994
|
if (this.currToken.type === "COLON")
|
|
@@ -1009,23 +1009,23 @@ class Dt extends Qe {
|
|
|
1009
1009
|
return {
|
|
1010
1010
|
kind: "note",
|
|
1011
1011
|
id: `note_${e.events.length + 1}`,
|
|
1012
|
-
position:
|
|
1013
|
-
participantIds:
|
|
1012
|
+
position: r,
|
|
1013
|
+
participantIds: n,
|
|
1014
1014
|
text: i
|
|
1015
1015
|
};
|
|
1016
1016
|
}
|
|
1017
1017
|
parseActivation(e) {
|
|
1018
|
-
const
|
|
1018
|
+
const r = this.currToken.type === "ACTIVATE" ? "activate" : "deactivate";
|
|
1019
1019
|
this.advance();
|
|
1020
|
-
let
|
|
1020
|
+
let n = "";
|
|
1021
1021
|
if (this.isParticipantToken(this.currToken))
|
|
1022
|
-
|
|
1022
|
+
n = this.currToken.literal, this.ensureParticipant(e, n), this.advance();
|
|
1023
1023
|
else
|
|
1024
1024
|
return null;
|
|
1025
1025
|
return {
|
|
1026
1026
|
kind: "activation",
|
|
1027
|
-
participantId:
|
|
1028
|
-
action:
|
|
1027
|
+
participantId: n,
|
|
1028
|
+
action: r
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
1031
|
isParticipantToken(e) {
|
|
@@ -1034,9 +1034,9 @@ class Dt extends Qe {
|
|
|
1034
1034
|
parseMessage(e) {
|
|
1035
1035
|
if (this.peekToken.type !== "ARROW")
|
|
1036
1036
|
return null;
|
|
1037
|
-
const n = this.currToken.literal;
|
|
1038
|
-
this.ensureParticipant(e, n), this.advance();
|
|
1039
1037
|
const r = this.currToken.literal;
|
|
1038
|
+
this.ensureParticipant(e, r), this.advance();
|
|
1039
|
+
const n = this.currToken.literal;
|
|
1040
1040
|
if (this.advance(), !this.isParticipantToken(this.currToken))
|
|
1041
1041
|
return null;
|
|
1042
1042
|
const i = this.currToken.literal;
|
|
@@ -1044,60 +1044,60 @@ class Dt extends Qe {
|
|
|
1044
1044
|
let s = "";
|
|
1045
1045
|
this.currToken.type === "COLON" && (this.advance(), s = this.readRestOfLine().trim());
|
|
1046
1046
|
let o = "sync", a = { line: "solid", head: "arrow" };
|
|
1047
|
-
return
|
|
1047
|
+
return n === "-->" ? (o = "reply", a = { line: "dotted", head: "arrow" }) : n === "->" && (o = "sync", a = { line: "solid", head: "arrow" }), {
|
|
1048
1048
|
kind: "message",
|
|
1049
1049
|
id: `msg_${e.events.length + 1}`,
|
|
1050
1050
|
// Simple ID generation
|
|
1051
|
-
from:
|
|
1051
|
+
from: r,
|
|
1052
1052
|
to: i,
|
|
1053
1053
|
text: s,
|
|
1054
1054
|
type: o,
|
|
1055
1055
|
style: a
|
|
1056
1056
|
};
|
|
1057
1057
|
}
|
|
1058
|
-
ensureParticipant(e,
|
|
1059
|
-
e.participants.find((
|
|
1060
|
-
id:
|
|
1061
|
-
name:
|
|
1058
|
+
ensureParticipant(e, r) {
|
|
1059
|
+
e.participants.find((n) => n.id === r) || e.participants.push({
|
|
1060
|
+
id: r,
|
|
1061
|
+
name: r,
|
|
1062
1062
|
type: "participant"
|
|
1063
1063
|
});
|
|
1064
1064
|
}
|
|
1065
1065
|
parseParticipant(e) {
|
|
1066
|
-
const
|
|
1067
|
-
let
|
|
1068
|
-
|
|
1066
|
+
const r = this.currToken.type;
|
|
1067
|
+
let n = "participant";
|
|
1068
|
+
r === "ACTOR" && (n = "actor"), r === "DATABASE" && (n = "database"), r === "BOUNDARY" && (n = "boundary"), r === "CONTROL" && (n = "control"), r === "ENTITY" && (n = "entity"), r === "COLLECTIONS" && (n = "collections"), r === "QUEUE" && (n = "queue"), this.advance();
|
|
1069
1069
|
let i = "", s = "";
|
|
1070
1070
|
(this.currToken.type === "STRING" || this.currToken.type === "IDENTIFIER") && (i = this.currToken.literal, s = i, this.advance()), this.currToken.type === "AS" && (this.advance(), this.isTokenType("IDENTIFIER") && (s = this.currToken.literal, this.advance())), e.participants.push({
|
|
1071
1071
|
id: s,
|
|
1072
1072
|
name: i,
|
|
1073
|
-
type:
|
|
1073
|
+
type: n
|
|
1074
1074
|
});
|
|
1075
1075
|
}
|
|
1076
1076
|
readRestOfLine() {
|
|
1077
1077
|
if (this.currToken.type === "NEWLINE" || this.currToken.type === "EOF")
|
|
1078
1078
|
return "";
|
|
1079
1079
|
const e = this.currToken.start;
|
|
1080
|
-
let
|
|
1080
|
+
let r = this.currToken.end;
|
|
1081
1081
|
for (; !this.isTokenType("NEWLINE") && !this.isTokenType("EOF"); )
|
|
1082
|
-
|
|
1083
|
-
return this.lexer.getInput().slice(e,
|
|
1082
|
+
r = this.currToken.end, this.advance();
|
|
1083
|
+
return this.lexer.getInput().slice(e, r).trim();
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
const Ft = {
|
|
1087
1087
|
parse: (t) => {
|
|
1088
|
-
const e = new
|
|
1088
|
+
const e = new Lt(t);
|
|
1089
1089
|
return new Dt(e).parse();
|
|
1090
1090
|
}
|
|
1091
|
-
},
|
|
1091
|
+
}, Mt = {
|
|
1092
1092
|
".puml": "plantuml",
|
|
1093
1093
|
".plantuml": "plantuml",
|
|
1094
1094
|
".pu": "plantuml",
|
|
1095
1095
|
".mmd": "mermaid",
|
|
1096
1096
|
".mermaid": "mermaid"
|
|
1097
|
-
},
|
|
1097
|
+
}, jt = [
|
|
1098
1098
|
{ pattern: /^\s*@startuml/m, format: "plantuml" },
|
|
1099
1099
|
{ pattern: /^\s*sequenceDiagram/m, format: "mermaid" }
|
|
1100
|
-
],
|
|
1100
|
+
], we = {
|
|
1101
1101
|
/**
|
|
1102
1102
|
* Detect diagram format from file path and content.
|
|
1103
1103
|
*
|
|
@@ -1114,8 +1114,8 @@ const Ft = {
|
|
|
1114
1114
|
* ```
|
|
1115
1115
|
*/
|
|
1116
1116
|
detect(t, e) {
|
|
1117
|
-
const
|
|
1118
|
-
return
|
|
1117
|
+
const r = we.detectByExtension(t);
|
|
1118
|
+
return r || we.detectByContent(e);
|
|
1119
1119
|
},
|
|
1120
1120
|
/**
|
|
1121
1121
|
* Detect format based on file extension.
|
|
@@ -1125,7 +1125,7 @@ const Ft = {
|
|
|
1125
1125
|
*/
|
|
1126
1126
|
detectByExtension(t) {
|
|
1127
1127
|
const e = t.toLowerCase().match(/\.[^.]+$/)?.[0];
|
|
1128
|
-
return e &&
|
|
1128
|
+
return e && Mt[e] || null;
|
|
1129
1129
|
},
|
|
1130
1130
|
/**
|
|
1131
1131
|
* Detect format based on content patterns.
|
|
@@ -1134,9 +1134,9 @@ const Ft = {
|
|
|
1134
1134
|
* @returns Detected format, or null if no pattern matches
|
|
1135
1135
|
*/
|
|
1136
1136
|
detectByContent(t) {
|
|
1137
|
-
for (const { pattern: e, format:
|
|
1137
|
+
for (const { pattern: e, format: r } of jt)
|
|
1138
1138
|
if (e.test(t))
|
|
1139
|
-
return
|
|
1139
|
+
return r;
|
|
1140
1140
|
return null;
|
|
1141
1141
|
},
|
|
1142
1142
|
/**
|
|
@@ -1154,7 +1154,7 @@ const Ft = {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
}, Q = /* @__PURE__ */ new Map();
|
|
1157
|
-
Q.set("mermaid",
|
|
1157
|
+
Q.set("mermaid", xt);
|
|
1158
1158
|
Q.set("plantuml", Ft);
|
|
1159
1159
|
const Ut = {
|
|
1160
1160
|
register(t, e) {
|
|
@@ -1169,24 +1169,24 @@ const Ut = {
|
|
|
1169
1169
|
};
|
|
1170
1170
|
class K {
|
|
1171
1171
|
transform(e) {
|
|
1172
|
-
const
|
|
1172
|
+
const r = this.mapEvents(e.events);
|
|
1173
1173
|
return {
|
|
1174
1174
|
...e,
|
|
1175
|
-
events:
|
|
1175
|
+
events: r
|
|
1176
1176
|
};
|
|
1177
1177
|
}
|
|
1178
1178
|
mapEvents(e) {
|
|
1179
|
-
return e.flatMap((
|
|
1179
|
+
return e.flatMap((r) => this.visitEvent(r));
|
|
1180
1180
|
}
|
|
1181
1181
|
visitEvent(e) {
|
|
1182
1182
|
return e.kind === "fragment" ? this.visitFragment(e) : [e];
|
|
1183
1183
|
}
|
|
1184
1184
|
visitFragment(e) {
|
|
1185
|
-
const
|
|
1185
|
+
const r = e.branches.map((n) => this.visitBranch(n));
|
|
1186
1186
|
return [
|
|
1187
1187
|
{
|
|
1188
1188
|
...e,
|
|
1189
|
-
branches:
|
|
1189
|
+
branches: r
|
|
1190
1190
|
}
|
|
1191
1191
|
];
|
|
1192
1192
|
}
|
|
@@ -1199,12 +1199,12 @@ class K {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
class Gt extends K {
|
|
1201
1201
|
visitFragment(e) {
|
|
1202
|
-
const
|
|
1203
|
-
if (
|
|
1204
|
-
const
|
|
1202
|
+
const r = super.visitFragment(e);
|
|
1203
|
+
if (r.length === 0) return [];
|
|
1204
|
+
const n = r[0], i = n.branches.filter((s) => s.events.length > 0);
|
|
1205
1205
|
return i.length === 0 ? [] : [
|
|
1206
1206
|
{
|
|
1207
|
-
...
|
|
1207
|
+
...n,
|
|
1208
1208
|
branches: i
|
|
1209
1209
|
}
|
|
1210
1210
|
];
|
|
@@ -1212,74 +1212,74 @@ class Gt extends K {
|
|
|
1212
1212
|
}
|
|
1213
1213
|
class Vt {
|
|
1214
1214
|
transform(e) {
|
|
1215
|
-
const
|
|
1216
|
-
(s) =>
|
|
1215
|
+
const r = this.collectUsedParticipants(e.events), n = e.participants.filter(
|
|
1216
|
+
(s) => r.has(s.id)
|
|
1217
1217
|
), i = e.groups.map((s) => ({
|
|
1218
1218
|
...s,
|
|
1219
|
-
participantIds: s.participantIds.filter((o) =>
|
|
1219
|
+
participantIds: s.participantIds.filter((o) => r.has(o))
|
|
1220
1220
|
})).filter((s) => s.participantIds.length > 0);
|
|
1221
1221
|
return {
|
|
1222
1222
|
...e,
|
|
1223
|
-
participants:
|
|
1223
|
+
participants: n,
|
|
1224
1224
|
groups: i
|
|
1225
1225
|
};
|
|
1226
1226
|
}
|
|
1227
1227
|
collectUsedParticipants(e) {
|
|
1228
|
-
const
|
|
1229
|
-
function
|
|
1228
|
+
const r = /* @__PURE__ */ new Set();
|
|
1229
|
+
function n(i) {
|
|
1230
1230
|
for (const s of i)
|
|
1231
1231
|
switch (s.kind) {
|
|
1232
1232
|
case "message":
|
|
1233
|
-
s.from &&
|
|
1233
|
+
s.from && r.add(s.from), s.to && r.add(s.to);
|
|
1234
1234
|
break;
|
|
1235
1235
|
case "fragment":
|
|
1236
1236
|
for (const o of s.branches)
|
|
1237
|
-
|
|
1237
|
+
n(o.events);
|
|
1238
1238
|
break;
|
|
1239
1239
|
case "activation":
|
|
1240
|
-
|
|
1240
|
+
r.add(s.participantId);
|
|
1241
1241
|
break;
|
|
1242
1242
|
case "note":
|
|
1243
1243
|
s.participantIds.forEach((o) => {
|
|
1244
|
-
|
|
1244
|
+
r.add(o);
|
|
1245
1245
|
});
|
|
1246
1246
|
break;
|
|
1247
1247
|
case "ref":
|
|
1248
1248
|
s.participantIds.forEach((o) => {
|
|
1249
|
-
|
|
1249
|
+
r.add(o);
|
|
1250
1250
|
});
|
|
1251
1251
|
break;
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
|
-
return
|
|
1254
|
+
return n(e), r;
|
|
1255
1255
|
}
|
|
1256
1256
|
}
|
|
1257
|
-
class
|
|
1257
|
+
class re {
|
|
1258
1258
|
// -- Branch / Fragment --
|
|
1259
|
-
matchBranch(e,
|
|
1260
|
-
return !(
|
|
1259
|
+
matchBranch(e, r, n) {
|
|
1260
|
+
return !(r.operator && !(Array.isArray(r.operator) ? r.operator : [r.operator]).includes(n) || r.condition && (!e.condition || !this.matchText(e.condition, r.condition)));
|
|
1261
1261
|
}
|
|
1262
1262
|
// -- Participant --
|
|
1263
|
-
matchParticipant(e,
|
|
1264
|
-
return !(
|
|
1263
|
+
matchParticipant(e, r) {
|
|
1264
|
+
return !(r.id && !this.matchText(e.id, r.id) || r.name && !this.matchText(e.name, r.name) || r.stereotype && e.stereotype && !this.matchText(e.stereotype, r.stereotype));
|
|
1265
1265
|
}
|
|
1266
1266
|
// -- Message --
|
|
1267
|
-
matchMessage(e,
|
|
1268
|
-
return !(
|
|
1267
|
+
matchMessage(e, r) {
|
|
1268
|
+
return !(r.text && !this.matchText(e.text, r.text) || r.from && e.from && !this.matchText(e.from, r.from) || r.to && e.to && !this.matchText(e.to, r.to));
|
|
1269
1269
|
}
|
|
1270
1270
|
// -- Group --
|
|
1271
|
-
matchGroup(e,
|
|
1272
|
-
return !(
|
|
1271
|
+
matchGroup(e, r) {
|
|
1272
|
+
return !(r.name && e.name && !this.matchText(e.name, r.name));
|
|
1273
1273
|
}
|
|
1274
1274
|
// -- Helpers --
|
|
1275
|
-
matchText(e,
|
|
1276
|
-
if (typeof
|
|
1277
|
-
return e ===
|
|
1278
|
-
if (
|
|
1279
|
-
return
|
|
1280
|
-
if (typeof
|
|
1281
|
-
const
|
|
1282
|
-
return new RegExp(
|
|
1275
|
+
matchText(e, r) {
|
|
1276
|
+
if (typeof r == "string")
|
|
1277
|
+
return e === r;
|
|
1278
|
+
if (r instanceof RegExp)
|
|
1279
|
+
return r.test(e);
|
|
1280
|
+
if (typeof r == "object" && r.pattern) {
|
|
1281
|
+
const n = r.flags || "";
|
|
1282
|
+
return new RegExp(r.pattern, n).test(e);
|
|
1283
1283
|
}
|
|
1284
1284
|
return !1;
|
|
1285
1285
|
}
|
|
@@ -1288,35 +1288,44 @@ class Bt extends K {
|
|
|
1288
1288
|
constructor(e) {
|
|
1289
1289
|
super(), this.layer = e;
|
|
1290
1290
|
}
|
|
1291
|
-
matcher = new
|
|
1291
|
+
matcher = new re();
|
|
1292
1292
|
targetParticipantIds = /* @__PURE__ */ new Set();
|
|
1293
1293
|
transform(e) {
|
|
1294
1294
|
return this.resolveTargetParticipants(e), super.transform(e);
|
|
1295
1295
|
}
|
|
1296
1296
|
resolveTargetParticipants(e) {
|
|
1297
1297
|
this.targetParticipantIds.clear();
|
|
1298
|
-
const
|
|
1299
|
-
e.participants.forEach((
|
|
1300
|
-
this.matcher.matchParticipant(
|
|
1298
|
+
const r = this.layer.selector;
|
|
1299
|
+
e.participants.forEach((n) => {
|
|
1300
|
+
this.matcher.matchParticipant(n, r) && this.targetParticipantIds.add(n.id);
|
|
1301
1301
|
});
|
|
1302
1302
|
}
|
|
1303
1303
|
visitEvent(e) {
|
|
1304
1304
|
if (e.kind === "message") {
|
|
1305
|
-
const
|
|
1306
|
-
if (!this.isRelatedToParticipant(
|
|
1305
|
+
const r = e;
|
|
1306
|
+
if (!this.isRelatedToParticipant(r))
|
|
1307
1307
|
return [];
|
|
1308
1308
|
}
|
|
1309
|
-
if (e.kind === "note"
|
|
1310
|
-
|
|
1311
|
-
))
|
|
1312
|
-
return [];
|
|
1309
|
+
if (e.kind === "note" || e.kind === "ref")
|
|
1310
|
+
return this.filterMultiParticipantNode(e);
|
|
1313
1311
|
if (e.kind === "activation") {
|
|
1314
|
-
const
|
|
1315
|
-
if (!this.targetParticipantIds.has(
|
|
1312
|
+
const r = e;
|
|
1313
|
+
if (!this.targetParticipantIds.has(r.participantId))
|
|
1316
1314
|
return [];
|
|
1317
1315
|
}
|
|
1318
1316
|
return super.visitEvent(e);
|
|
1319
1317
|
}
|
|
1318
|
+
filterMultiParticipantNode(e) {
|
|
1319
|
+
const r = e.participantIds.filter(
|
|
1320
|
+
(n) => this.targetParticipantIds.has(n)
|
|
1321
|
+
);
|
|
1322
|
+
return r.length === 0 ? [] : [
|
|
1323
|
+
{
|
|
1324
|
+
...e,
|
|
1325
|
+
participantIds: r
|
|
1326
|
+
}
|
|
1327
|
+
];
|
|
1328
|
+
}
|
|
1320
1329
|
// Helper to check if message involves the participant from selector
|
|
1321
1330
|
isRelatedToParticipant(e) {
|
|
1322
1331
|
return !!(e.from && this.targetParticipantIds.has(e.from) || e.to && this.targetParticipantIds.has(e.to));
|
|
@@ -1324,67 +1333,84 @@ class Bt extends K {
|
|
|
1324
1333
|
}
|
|
1325
1334
|
class Jt extends K {
|
|
1326
1335
|
constructor(e) {
|
|
1327
|
-
super(), this.layer = e
|
|
1336
|
+
super(), this.layer = e;
|
|
1328
1337
|
}
|
|
1329
|
-
matcher = new
|
|
1338
|
+
matcher = new re();
|
|
1330
1339
|
mergedParticipantIds = /* @__PURE__ */ new Set();
|
|
1331
|
-
|
|
1340
|
+
targetParticipantId = "";
|
|
1332
1341
|
transform(e) {
|
|
1333
|
-
const
|
|
1334
|
-
if (e.participants.forEach((
|
|
1335
|
-
this.matcher.matchParticipant(
|
|
1336
|
-
}),
|
|
1342
|
+
const r = this.layer.selector, n = [];
|
|
1343
|
+
if (e.participants.forEach((d) => {
|
|
1344
|
+
this.matcher.matchParticipant(d, r) && n.push(d);
|
|
1345
|
+
}), n.length === 0)
|
|
1337
1346
|
return e;
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
+
this.mergedParticipantIds = new Set(n.map((d) => d.id));
|
|
1348
|
+
const i = this.layer.into || {};
|
|
1349
|
+
let s = i.id, o = i.name;
|
|
1350
|
+
s || (o ? s = o.replace(/[^a-zA-Z0-9-_]/g, "_") : s = n.map((d) => d.id).join("_")), o || (o = s), this.targetParticipantId = s;
|
|
1351
|
+
const a = [], p = !e.participants.some(
|
|
1352
|
+
(d) => d.id === s && !this.mergedParticipantIds.has(d.id)
|
|
1353
|
+
);
|
|
1354
|
+
let h = !1;
|
|
1355
|
+
for (const d of e.participants) {
|
|
1356
|
+
if (this.mergedParticipantIds.has(d.id)) {
|
|
1357
|
+
if (p && !h) {
|
|
1358
|
+
const f = {
|
|
1359
|
+
id: s || "",
|
|
1360
|
+
name: o || "",
|
|
1361
|
+
type: "participant"
|
|
1362
|
+
// Todo: map stereotype?
|
|
1363
|
+
};
|
|
1364
|
+
a.push(f), h = !0;
|
|
1365
|
+
}
|
|
1366
|
+
continue;
|
|
1367
|
+
}
|
|
1368
|
+
d.id, a.push(d);
|
|
1347
1369
|
}
|
|
1348
|
-
return e.participants = e.
|
|
1349
|
-
|
|
1350
|
-
|
|
1370
|
+
return e.participants = a, e.groups = e.groups.map((d) => {
|
|
1371
|
+
const f = /* @__PURE__ */ new Set();
|
|
1372
|
+
return d.participantIds.forEach((g) => {
|
|
1373
|
+
this.mergedParticipantIds.has(g) ? f.add(this.targetParticipantId) : f.add(g);
|
|
1374
|
+
}), {
|
|
1375
|
+
...d,
|
|
1376
|
+
participantIds: Array.from(f)
|
|
1377
|
+
};
|
|
1378
|
+
}), super.transform(e);
|
|
1351
1379
|
}
|
|
1352
1380
|
visitEvent(e) {
|
|
1353
1381
|
if (e.kind === "message")
|
|
1354
1382
|
return this.transformMessage(e);
|
|
1355
|
-
if (e.kind === "note")
|
|
1356
|
-
return this.
|
|
1383
|
+
if (e.kind === "note" || e.kind === "ref")
|
|
1384
|
+
return this.transformMultiParticipantNode(e);
|
|
1357
1385
|
if (e.kind === "activation")
|
|
1358
1386
|
return this.transformActivation(e);
|
|
1359
1387
|
if (e.kind === "fragment") {
|
|
1360
|
-
const
|
|
1361
|
-
return
|
|
1388
|
+
const r = super.visitEvent(e);
|
|
1389
|
+
return r.length > 0 && r[0].kind === "fragment" && r[0].branches.every(
|
|
1362
1390
|
(s) => s.events.length === 0
|
|
1363
|
-
) ? [] :
|
|
1391
|
+
) ? [] : r;
|
|
1364
1392
|
}
|
|
1365
1393
|
return super.visitEvent(e);
|
|
1366
1394
|
}
|
|
1367
1395
|
transformMessage(e) {
|
|
1368
|
-
let
|
|
1369
|
-
return
|
|
1396
|
+
let r = e.from, n = e.to;
|
|
1397
|
+
return r && this.mergedParticipantIds.has(r) && (r = this.targetParticipantId), n && this.mergedParticipantIds.has(n) && (n = this.targetParticipantId), r === this.targetParticipantId && n === this.targetParticipantId ? [] : [
|
|
1370
1398
|
{
|
|
1371
1399
|
...e,
|
|
1372
|
-
from:
|
|
1373
|
-
to:
|
|
1400
|
+
from: r,
|
|
1401
|
+
to: n
|
|
1374
1402
|
}
|
|
1375
1403
|
];
|
|
1376
1404
|
}
|
|
1377
|
-
|
|
1378
|
-
const
|
|
1379
|
-
let
|
|
1380
|
-
for (const
|
|
1381
|
-
this.mergedParticipantIds.has(
|
|
1382
|
-
if (!
|
|
1405
|
+
transformMultiParticipantNode(e) {
|
|
1406
|
+
const r = /* @__PURE__ */ new Set();
|
|
1407
|
+
let n = !1;
|
|
1408
|
+
for (const s of e.participantIds)
|
|
1409
|
+
this.mergedParticipantIds.has(s) ? (r.add(this.targetParticipantId), n = !0) : r.add(s);
|
|
1410
|
+
if (!n)
|
|
1383
1411
|
return [e];
|
|
1384
|
-
const i = Array.from(
|
|
1385
|
-
return
|
|
1386
|
-
(o) => this.mergedParticipantIds.has(o)
|
|
1387
|
-
) ? [] : [
|
|
1412
|
+
const i = Array.from(r);
|
|
1413
|
+
return [
|
|
1388
1414
|
{
|
|
1389
1415
|
...e,
|
|
1390
1416
|
participantIds: i
|
|
@@ -1399,38 +1425,47 @@ class Wt extends K {
|
|
|
1399
1425
|
constructor(e) {
|
|
1400
1426
|
super(), this.layer = e;
|
|
1401
1427
|
}
|
|
1402
|
-
matcher = new
|
|
1428
|
+
matcher = new re();
|
|
1403
1429
|
removedParticipantIds = /* @__PURE__ */ new Set();
|
|
1404
1430
|
transform(e) {
|
|
1405
|
-
const
|
|
1406
|
-
return
|
|
1407
|
-
this.matcher.matchParticipant(
|
|
1431
|
+
const r = this.layer.selector;
|
|
1432
|
+
return r.kind === "participant" && (e.participants.forEach((n) => {
|
|
1433
|
+
this.matcher.matchParticipant(n, r) && this.removedParticipantIds.add(n.id);
|
|
1408
1434
|
}), e.participants = e.participants.filter(
|
|
1409
|
-
(
|
|
1410
|
-
)),
|
|
1411
|
-
(
|
|
1435
|
+
(n) => !this.removedParticipantIds.has(n.id)
|
|
1436
|
+
)), r.kind === "group" && (e.groups = e.groups.filter(
|
|
1437
|
+
(n) => !this.matcher.matchGroup(n, r)
|
|
1412
1438
|
)), super.transform(e);
|
|
1413
1439
|
}
|
|
1414
1440
|
visitEvent(e) {
|
|
1415
|
-
const
|
|
1416
|
-
if (
|
|
1441
|
+
const r = this.layer.selector;
|
|
1442
|
+
if (r.kind === "message" && e.kind === "message" && this.matcher.matchMessage(e, r))
|
|
1417
1443
|
return [];
|
|
1418
|
-
if (
|
|
1444
|
+
if (r.kind === "participant") {
|
|
1419
1445
|
if (e.kind === "message") {
|
|
1420
|
-
const
|
|
1421
|
-
if (this.isRelatedToRemovedParticipant(
|
|
1446
|
+
const n = e;
|
|
1447
|
+
if (this.isRelatedToRemovedParticipant(n)) return [];
|
|
1422
1448
|
}
|
|
1423
|
-
if (e.kind === "note"
|
|
1424
|
-
|
|
1425
|
-
))
|
|
1426
|
-
return [];
|
|
1449
|
+
if (e.kind === "note" || e.kind === "ref")
|
|
1450
|
+
return this.filterMultiParticipantNode(e);
|
|
1427
1451
|
if (e.kind === "activation") {
|
|
1428
|
-
const
|
|
1429
|
-
if (this.removedParticipantIds.has(
|
|
1452
|
+
const n = e;
|
|
1453
|
+
if (this.removedParticipantIds.has(n.participantId)) return [];
|
|
1430
1454
|
}
|
|
1431
1455
|
}
|
|
1432
1456
|
return super.visitEvent(e);
|
|
1433
1457
|
}
|
|
1458
|
+
filterMultiParticipantNode(e) {
|
|
1459
|
+
const r = e.participantIds.filter(
|
|
1460
|
+
(n) => !this.removedParticipantIds.has(n)
|
|
1461
|
+
);
|
|
1462
|
+
return r.length === 0 ? [] : [
|
|
1463
|
+
{
|
|
1464
|
+
...e,
|
|
1465
|
+
participantIds: r
|
|
1466
|
+
}
|
|
1467
|
+
];
|
|
1468
|
+
}
|
|
1434
1469
|
isRelatedToRemovedParticipant(e) {
|
|
1435
1470
|
return !!(e.from && this.removedParticipantIds.has(e.from) || e.to && this.removedParticipantIds.has(e.to));
|
|
1436
1471
|
}
|
|
@@ -1439,12 +1474,12 @@ class Kt extends K {
|
|
|
1439
1474
|
constructor(e) {
|
|
1440
1475
|
super(), this.layer = e;
|
|
1441
1476
|
}
|
|
1442
|
-
matcher = new
|
|
1477
|
+
matcher = new re();
|
|
1443
1478
|
visitFragment(e) {
|
|
1444
|
-
const
|
|
1445
|
-
(
|
|
1479
|
+
const r = e.branches.find(
|
|
1480
|
+
(n) => this.matcher.matchBranch(n, this.layer.selector, e.operator)
|
|
1446
1481
|
);
|
|
1447
|
-
return
|
|
1482
|
+
return r ? this.mapEvents(r.events) : super.visitFragment(e);
|
|
1448
1483
|
}
|
|
1449
1484
|
}
|
|
1450
1485
|
class Yt {
|
|
@@ -1455,22 +1490,22 @@ class Yt {
|
|
|
1455
1490
|
/**
|
|
1456
1491
|
* Type-safe registration for a specific layer type.
|
|
1457
1492
|
*/
|
|
1458
|
-
registerTyped(e,
|
|
1459
|
-
this.factories.set(e,
|
|
1493
|
+
registerTyped(e, r) {
|
|
1494
|
+
this.factories.set(e, r);
|
|
1460
1495
|
}
|
|
1461
1496
|
/**
|
|
1462
1497
|
* Register a custom transformer factory.
|
|
1463
1498
|
*/
|
|
1464
|
-
register(e,
|
|
1465
|
-
this.factories.set(e,
|
|
1499
|
+
register(e, r) {
|
|
1500
|
+
this.factories.set(e, r);
|
|
1466
1501
|
}
|
|
1467
1502
|
/**
|
|
1468
1503
|
* Get a transformer for the given layer.
|
|
1469
1504
|
* @returns Transformer instance or null if no factory is registered
|
|
1470
1505
|
*/
|
|
1471
1506
|
get(e) {
|
|
1472
|
-
const
|
|
1473
|
-
return
|
|
1507
|
+
const r = this.factories.get(e.action);
|
|
1508
|
+
return r ? r(e) : null;
|
|
1474
1509
|
}
|
|
1475
1510
|
/**
|
|
1476
1511
|
* Check if a transformer is registered for the given action.
|
|
@@ -1481,13 +1516,13 @@ class Yt {
|
|
|
1481
1516
|
}
|
|
1482
1517
|
const qt = new Yt();
|
|
1483
1518
|
class ue {
|
|
1484
|
-
transform(e,
|
|
1485
|
-
let
|
|
1486
|
-
for (const i of
|
|
1519
|
+
transform(e, r) {
|
|
1520
|
+
let n = e;
|
|
1521
|
+
for (const i of r) {
|
|
1487
1522
|
const s = qt.get(i);
|
|
1488
|
-
s ?
|
|
1523
|
+
s ? n = s.transform(n) : console.warn(`Unknown action: ${i.action}`);
|
|
1489
1524
|
}
|
|
1490
|
-
return
|
|
1525
|
+
return n = new Gt().transform(n), n = new Vt().transform(n), n;
|
|
1491
1526
|
}
|
|
1492
1527
|
}
|
|
1493
1528
|
class Uo {
|
|
@@ -1498,17 +1533,17 @@ class Uo {
|
|
|
1498
1533
|
* @param code Source diagram code
|
|
1499
1534
|
* @param format Input format ('mermaid' or 'plantuml')
|
|
1500
1535
|
*/
|
|
1501
|
-
static init(e,
|
|
1502
|
-
const i = Ut.getParser(
|
|
1503
|
-
return new Xt(i,
|
|
1536
|
+
static init(e, r = "mermaid") {
|
|
1537
|
+
const i = Ut.getParser(r).parse(e);
|
|
1538
|
+
return new Xt(i, r);
|
|
1504
1539
|
}
|
|
1505
1540
|
}
|
|
1506
1541
|
class Xt {
|
|
1507
1542
|
ast;
|
|
1508
1543
|
layers = [];
|
|
1509
1544
|
sourceFormat;
|
|
1510
|
-
constructor(e,
|
|
1511
|
-
this.ast = e, this.sourceFormat =
|
|
1545
|
+
constructor(e, r = "mermaid") {
|
|
1546
|
+
this.ast = e, this.sourceFormat = r;
|
|
1512
1547
|
}
|
|
1513
1548
|
// -- Entity Filtering --
|
|
1514
1549
|
/**
|
|
@@ -1577,15 +1612,15 @@ class Xt {
|
|
|
1577
1612
|
* Generate Mermaid code from the transformed AST.
|
|
1578
1613
|
*/
|
|
1579
1614
|
toMermaid() {
|
|
1580
|
-
const
|
|
1581
|
-
return new Ye().generate(
|
|
1615
|
+
const r = new ue().transform(this.ast, this.layers);
|
|
1616
|
+
return new Ye().generate(r);
|
|
1582
1617
|
}
|
|
1583
1618
|
/**
|
|
1584
1619
|
* Generate PlantUML code from the transformed AST.
|
|
1585
1620
|
*/
|
|
1586
1621
|
toPlantUML() {
|
|
1587
|
-
const
|
|
1588
|
-
return new qe().generate(
|
|
1622
|
+
const r = new ue().transform(this.ast, this.layers);
|
|
1623
|
+
return new qe().generate(r);
|
|
1589
1624
|
}
|
|
1590
1625
|
/**
|
|
1591
1626
|
* Get the transformed AST (for advanced use cases).
|
|
@@ -1653,8 +1688,8 @@ const Go = {
|
|
|
1653
1688
|
return Array.from(D.keys());
|
|
1654
1689
|
}
|
|
1655
1690
|
};
|
|
1656
|
-
function u(t, e,
|
|
1657
|
-
function
|
|
1691
|
+
function u(t, e, r) {
|
|
1692
|
+
function n(a, c) {
|
|
1658
1693
|
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
1659
1694
|
value: {
|
|
1660
1695
|
def: c,
|
|
@@ -1665,29 +1700,29 @@ function u(t, e, n) {
|
|
|
1665
1700
|
}), a._zod.traits.has(t))
|
|
1666
1701
|
return;
|
|
1667
1702
|
a._zod.traits.add(t), e(a, c);
|
|
1668
|
-
const
|
|
1669
|
-
for (let d = 0; d <
|
|
1670
|
-
const f =
|
|
1671
|
-
f in a || (a[f] =
|
|
1703
|
+
const p = o.prototype, h = Object.keys(p);
|
|
1704
|
+
for (let d = 0; d < h.length; d++) {
|
|
1705
|
+
const f = h[d];
|
|
1706
|
+
f in a || (a[f] = p[f].bind(a));
|
|
1672
1707
|
}
|
|
1673
1708
|
}
|
|
1674
|
-
const i =
|
|
1709
|
+
const i = r?.Parent ?? Object;
|
|
1675
1710
|
class s extends i {
|
|
1676
1711
|
}
|
|
1677
1712
|
Object.defineProperty(s, "name", { value: t });
|
|
1678
1713
|
function o(a) {
|
|
1679
1714
|
var c;
|
|
1680
|
-
const
|
|
1681
|
-
|
|
1682
|
-
for (const
|
|
1683
|
-
|
|
1684
|
-
return
|
|
1685
|
-
}
|
|
1686
|
-
return Object.defineProperty(o, "init", { value:
|
|
1687
|
-
value: (a) =>
|
|
1715
|
+
const p = r?.Parent ? new s() : this;
|
|
1716
|
+
n(p, a), (c = p._zod).deferred ?? (c.deferred = []);
|
|
1717
|
+
for (const h of p._zod.deferred)
|
|
1718
|
+
h();
|
|
1719
|
+
return p;
|
|
1720
|
+
}
|
|
1721
|
+
return Object.defineProperty(o, "init", { value: n }), Object.defineProperty(o, Symbol.hasInstance, {
|
|
1722
|
+
value: (a) => r?.Parent && a instanceof r.Parent ? !0 : a?._zod?.traits?.has(t)
|
|
1688
1723
|
}), Object.defineProperty(o, "name", { value: t }), o;
|
|
1689
1724
|
}
|
|
1690
|
-
class
|
|
1725
|
+
class M extends Error {
|
|
1691
1726
|
constructor() {
|
|
1692
1727
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
1693
1728
|
}
|
|
@@ -1702,13 +1737,13 @@ function C(t) {
|
|
|
1702
1737
|
return et;
|
|
1703
1738
|
}
|
|
1704
1739
|
function tt(t) {
|
|
1705
|
-
const e = Object.values(t).filter((
|
|
1706
|
-
return Object.entries(t).filter(([
|
|
1740
|
+
const e = Object.values(t).filter((n) => typeof n == "number");
|
|
1741
|
+
return Object.entries(t).filter(([n, i]) => e.indexOf(+n) === -1).map(([n, i]) => i);
|
|
1707
1742
|
}
|
|
1708
1743
|
function le(t, e) {
|
|
1709
1744
|
return typeof e == "bigint" ? e.toString() : e;
|
|
1710
1745
|
}
|
|
1711
|
-
function
|
|
1746
|
+
function ne(t) {
|
|
1712
1747
|
return {
|
|
1713
1748
|
get value() {
|
|
1714
1749
|
{
|
|
@@ -1722,26 +1757,26 @@ function me(t) {
|
|
|
1722
1757
|
return t == null;
|
|
1723
1758
|
}
|
|
1724
1759
|
function ge(t) {
|
|
1725
|
-
const e = t.startsWith("^") ? 1 : 0,
|
|
1726
|
-
return t.slice(e,
|
|
1760
|
+
const e = t.startsWith("^") ? 1 : 0, r = t.endsWith("$") ? t.length - 1 : t.length;
|
|
1761
|
+
return t.slice(e, r);
|
|
1727
1762
|
}
|
|
1728
1763
|
function Qt(t, e) {
|
|
1729
|
-
const
|
|
1730
|
-
let i = (
|
|
1731
|
-
if (i === 0 && /\d?e-\d?/.test(
|
|
1732
|
-
const c =
|
|
1764
|
+
const r = (t.toString().split(".")[1] || "").length, n = e.toString();
|
|
1765
|
+
let i = (n.split(".")[1] || "").length;
|
|
1766
|
+
if (i === 0 && /\d?e-\d?/.test(n)) {
|
|
1767
|
+
const c = n.match(/\d?e-(\d?)/);
|
|
1733
1768
|
c?.[1] && (i = Number.parseInt(c[1]));
|
|
1734
1769
|
}
|
|
1735
|
-
const s =
|
|
1770
|
+
const s = r > i ? r : i, o = Number.parseInt(t.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1736
1771
|
return o % a / 10 ** s;
|
|
1737
1772
|
}
|
|
1738
|
-
const
|
|
1739
|
-
function m(t, e,
|
|
1740
|
-
let
|
|
1773
|
+
const Ie = /* @__PURE__ */ Symbol("evaluating");
|
|
1774
|
+
function m(t, e, r) {
|
|
1775
|
+
let n;
|
|
1741
1776
|
Object.defineProperty(t, e, {
|
|
1742
1777
|
get() {
|
|
1743
|
-
if (
|
|
1744
|
-
return
|
|
1778
|
+
if (n !== Ie)
|
|
1779
|
+
return n === void 0 && (n = Ie, n = r()), n;
|
|
1745
1780
|
},
|
|
1746
1781
|
set(i) {
|
|
1747
1782
|
Object.defineProperty(t, e, {
|
|
@@ -1752,34 +1787,34 @@ function m(t, e, n) {
|
|
|
1752
1787
|
configurable: !0
|
|
1753
1788
|
});
|
|
1754
1789
|
}
|
|
1755
|
-
function
|
|
1790
|
+
function x(t, e, r) {
|
|
1756
1791
|
Object.defineProperty(t, e, {
|
|
1757
|
-
value:
|
|
1792
|
+
value: r,
|
|
1758
1793
|
writable: !0,
|
|
1759
1794
|
enumerable: !0,
|
|
1760
1795
|
configurable: !0
|
|
1761
1796
|
});
|
|
1762
1797
|
}
|
|
1763
|
-
function
|
|
1798
|
+
function L(...t) {
|
|
1764
1799
|
const e = {};
|
|
1765
|
-
for (const
|
|
1766
|
-
const
|
|
1767
|
-
Object.assign(e,
|
|
1800
|
+
for (const r of t) {
|
|
1801
|
+
const n = Object.getOwnPropertyDescriptors(r);
|
|
1802
|
+
Object.assign(e, n);
|
|
1768
1803
|
}
|
|
1769
1804
|
return Object.defineProperties({}, e);
|
|
1770
1805
|
}
|
|
1771
|
-
function
|
|
1806
|
+
function Ee(t) {
|
|
1772
1807
|
return JSON.stringify(t);
|
|
1773
1808
|
}
|
|
1774
1809
|
function Ht(t) {
|
|
1775
1810
|
return t.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1776
1811
|
}
|
|
1777
|
-
const
|
|
1812
|
+
const rt = "captureStackTrace" in Error ? Error.captureStackTrace : (...t) => {
|
|
1778
1813
|
};
|
|
1779
1814
|
function B(t) {
|
|
1780
1815
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1781
1816
|
}
|
|
1782
|
-
const
|
|
1817
|
+
const er = ne(() => {
|
|
1783
1818
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
1784
1819
|
return !1;
|
|
1785
1820
|
try {
|
|
@@ -1795,19 +1830,19 @@ function J(t) {
|
|
|
1795
1830
|
const e = t.constructor;
|
|
1796
1831
|
if (e === void 0 || typeof e != "function")
|
|
1797
1832
|
return !0;
|
|
1798
|
-
const
|
|
1799
|
-
return !(B(
|
|
1833
|
+
const r = e.prototype;
|
|
1834
|
+
return !(B(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
|
|
1800
1835
|
}
|
|
1801
|
-
function
|
|
1836
|
+
function nt(t) {
|
|
1802
1837
|
return J(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
|
|
1803
1838
|
}
|
|
1804
|
-
const
|
|
1805
|
-
function
|
|
1839
|
+
const tr = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
1840
|
+
function j(t) {
|
|
1806
1841
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1807
1842
|
}
|
|
1808
|
-
function N(t, e,
|
|
1809
|
-
const
|
|
1810
|
-
return (!e ||
|
|
1843
|
+
function N(t, e, r) {
|
|
1844
|
+
const n = new t._zod.constr(e ?? t._zod.def);
|
|
1845
|
+
return (!e || r?.parent) && (n._zod.parent = t), n;
|
|
1811
1846
|
}
|
|
1812
1847
|
function l(t) {
|
|
1813
1848
|
const e = t;
|
|
@@ -1822,79 +1857,79 @@ function l(t) {
|
|
|
1822
1857
|
}
|
|
1823
1858
|
return delete e.message, typeof e.error == "string" ? { ...e, error: () => e.error } : e;
|
|
1824
1859
|
}
|
|
1825
|
-
function
|
|
1860
|
+
function rr(t) {
|
|
1826
1861
|
return Object.keys(t).filter((e) => t[e]._zod.optin === "optional" && t[e]._zod.optout === "optional");
|
|
1827
1862
|
}
|
|
1828
|
-
const
|
|
1863
|
+
const nr = {
|
|
1829
1864
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1830
1865
|
int32: [-2147483648, 2147483647],
|
|
1831
1866
|
uint32: [0, 4294967295],
|
|
1832
1867
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1833
1868
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1834
1869
|
};
|
|
1835
|
-
function
|
|
1836
|
-
const
|
|
1870
|
+
function ir(t, e) {
|
|
1871
|
+
const r = t._zod.def, n = L(t._zod.def, {
|
|
1837
1872
|
get shape() {
|
|
1838
1873
|
const i = {};
|
|
1839
1874
|
for (const s in e) {
|
|
1840
|
-
if (!(s in
|
|
1875
|
+
if (!(s in r.shape))
|
|
1841
1876
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1842
|
-
e[s] && (i[s] =
|
|
1877
|
+
e[s] && (i[s] = r.shape[s]);
|
|
1843
1878
|
}
|
|
1844
|
-
return
|
|
1879
|
+
return x(this, "shape", i), i;
|
|
1845
1880
|
},
|
|
1846
1881
|
checks: []
|
|
1847
1882
|
});
|
|
1848
|
-
return N(t,
|
|
1883
|
+
return N(t, n);
|
|
1849
1884
|
}
|
|
1850
|
-
function
|
|
1851
|
-
const
|
|
1885
|
+
function sr(t, e) {
|
|
1886
|
+
const r = t._zod.def, n = L(t._zod.def, {
|
|
1852
1887
|
get shape() {
|
|
1853
1888
|
const i = { ...t._zod.def.shape };
|
|
1854
1889
|
for (const s in e) {
|
|
1855
|
-
if (!(s in
|
|
1890
|
+
if (!(s in r.shape))
|
|
1856
1891
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1857
1892
|
e[s] && delete i[s];
|
|
1858
1893
|
}
|
|
1859
|
-
return
|
|
1894
|
+
return x(this, "shape", i), i;
|
|
1860
1895
|
},
|
|
1861
1896
|
checks: []
|
|
1862
1897
|
});
|
|
1863
|
-
return N(t,
|
|
1898
|
+
return N(t, n);
|
|
1864
1899
|
}
|
|
1865
|
-
function
|
|
1900
|
+
function or(t, e) {
|
|
1866
1901
|
if (!J(e))
|
|
1867
1902
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
1868
|
-
const
|
|
1869
|
-
if (
|
|
1903
|
+
const r = t._zod.def.checks;
|
|
1904
|
+
if (r && r.length > 0)
|
|
1870
1905
|
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
1871
|
-
const i =
|
|
1906
|
+
const i = L(t._zod.def, {
|
|
1872
1907
|
get shape() {
|
|
1873
1908
|
const s = { ...t._zod.def.shape, ...e };
|
|
1874
|
-
return
|
|
1909
|
+
return x(this, "shape", s), s;
|
|
1875
1910
|
},
|
|
1876
1911
|
checks: []
|
|
1877
1912
|
});
|
|
1878
1913
|
return N(t, i);
|
|
1879
1914
|
}
|
|
1880
|
-
function
|
|
1915
|
+
function ar(t, e) {
|
|
1881
1916
|
if (!J(e))
|
|
1882
1917
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1883
|
-
const
|
|
1918
|
+
const r = {
|
|
1884
1919
|
...t._zod.def,
|
|
1885
1920
|
get shape() {
|
|
1886
|
-
const
|
|
1887
|
-
return
|
|
1921
|
+
const n = { ...t._zod.def.shape, ...e };
|
|
1922
|
+
return x(this, "shape", n), n;
|
|
1888
1923
|
},
|
|
1889
1924
|
checks: t._zod.def.checks
|
|
1890
1925
|
};
|
|
1891
|
-
return N(t,
|
|
1926
|
+
return N(t, r);
|
|
1892
1927
|
}
|
|
1893
|
-
function
|
|
1894
|
-
const
|
|
1928
|
+
function cr(t, e) {
|
|
1929
|
+
const r = L(t._zod.def, {
|
|
1895
1930
|
get shape() {
|
|
1896
|
-
const
|
|
1897
|
-
return
|
|
1931
|
+
const n = { ...t._zod.def.shape, ...e._zod.def.shape };
|
|
1932
|
+
return x(this, "shape", n), n;
|
|
1898
1933
|
},
|
|
1899
1934
|
get catchall() {
|
|
1900
1935
|
return e._zod.def.catchall;
|
|
@@ -1902,17 +1937,17 @@ function un(t, e) {
|
|
|
1902
1937
|
checks: []
|
|
1903
1938
|
// delete existing checks
|
|
1904
1939
|
});
|
|
1905
|
-
return N(t,
|
|
1940
|
+
return N(t, r);
|
|
1906
1941
|
}
|
|
1907
|
-
function
|
|
1908
|
-
const
|
|
1942
|
+
function ur(t, e, r) {
|
|
1943
|
+
const n = L(e._zod.def, {
|
|
1909
1944
|
get shape() {
|
|
1910
1945
|
const i = e._zod.def.shape, s = { ...i };
|
|
1911
|
-
if (
|
|
1912
|
-
for (const o in
|
|
1946
|
+
if (r)
|
|
1947
|
+
for (const o in r) {
|
|
1913
1948
|
if (!(o in i))
|
|
1914
1949
|
throw new Error(`Unrecognized key: "${o}"`);
|
|
1915
|
-
|
|
1950
|
+
r[o] && (s[o] = t ? new t({
|
|
1916
1951
|
type: "optional",
|
|
1917
1952
|
innerType: i[o]
|
|
1918
1953
|
}) : i[o]);
|
|
@@ -1923,21 +1958,21 @@ function hn(t, e, n) {
|
|
|
1923
1958
|
type: "optional",
|
|
1924
1959
|
innerType: i[o]
|
|
1925
1960
|
}) : i[o];
|
|
1926
|
-
return
|
|
1961
|
+
return x(this, "shape", s), s;
|
|
1927
1962
|
},
|
|
1928
1963
|
checks: []
|
|
1929
1964
|
});
|
|
1930
|
-
return N(e,
|
|
1965
|
+
return N(e, n);
|
|
1931
1966
|
}
|
|
1932
|
-
function
|
|
1933
|
-
const
|
|
1967
|
+
function pr(t, e, r) {
|
|
1968
|
+
const n = L(e._zod.def, {
|
|
1934
1969
|
get shape() {
|
|
1935
1970
|
const i = e._zod.def.shape, s = { ...i };
|
|
1936
|
-
if (
|
|
1937
|
-
for (const o in
|
|
1971
|
+
if (r)
|
|
1972
|
+
for (const o in r) {
|
|
1938
1973
|
if (!(o in s))
|
|
1939
1974
|
throw new Error(`Unrecognized key: "${o}"`);
|
|
1940
|
-
|
|
1975
|
+
r[o] && (s[o] = new t({
|
|
1941
1976
|
type: "nonoptional",
|
|
1942
1977
|
innerType: i[o]
|
|
1943
1978
|
}));
|
|
@@ -1948,47 +1983,47 @@ function pn(t, e, n) {
|
|
|
1948
1983
|
type: "nonoptional",
|
|
1949
1984
|
innerType: i[o]
|
|
1950
1985
|
});
|
|
1951
|
-
return
|
|
1986
|
+
return x(this, "shape", s), s;
|
|
1952
1987
|
},
|
|
1953
1988
|
checks: []
|
|
1954
1989
|
});
|
|
1955
|
-
return N(e,
|
|
1990
|
+
return N(e, n);
|
|
1956
1991
|
}
|
|
1957
1992
|
function F(t, e = 0) {
|
|
1958
1993
|
if (t.aborted === !0)
|
|
1959
1994
|
return !0;
|
|
1960
|
-
for (let
|
|
1961
|
-
if (t.issues[
|
|
1995
|
+
for (let r = e; r < t.issues.length; r++)
|
|
1996
|
+
if (t.issues[r]?.continue !== !0)
|
|
1962
1997
|
return !0;
|
|
1963
1998
|
return !1;
|
|
1964
1999
|
}
|
|
1965
2000
|
function it(t, e) {
|
|
1966
|
-
return e.map((
|
|
1967
|
-
var
|
|
1968
|
-
return (
|
|
2001
|
+
return e.map((r) => {
|
|
2002
|
+
var n;
|
|
2003
|
+
return (n = r).path ?? (n.path = []), r.path.unshift(t), r;
|
|
1969
2004
|
});
|
|
1970
2005
|
}
|
|
1971
2006
|
function Y(t) {
|
|
1972
2007
|
return typeof t == "string" ? t : t?.message;
|
|
1973
2008
|
}
|
|
1974
|
-
function R(t, e,
|
|
1975
|
-
const
|
|
2009
|
+
function R(t, e, r) {
|
|
2010
|
+
const n = { ...t, path: t.path ?? [] };
|
|
1976
2011
|
if (!t.message) {
|
|
1977
|
-
const i = Y(t.inst?._zod.def?.error?.(t)) ?? Y(e?.error?.(t)) ?? Y(
|
|
1978
|
-
|
|
2012
|
+
const i = Y(t.inst?._zod.def?.error?.(t)) ?? Y(e?.error?.(t)) ?? Y(r.customError?.(t)) ?? Y(r.localeError?.(t)) ?? "Invalid input";
|
|
2013
|
+
n.message = i;
|
|
1979
2014
|
}
|
|
1980
|
-
return delete
|
|
2015
|
+
return delete n.inst, delete n.continue, e?.reportInput || delete n.input, n;
|
|
1981
2016
|
}
|
|
1982
2017
|
function ve(t) {
|
|
1983
2018
|
return Array.isArray(t) ? "array" : typeof t == "string" ? "string" : "unknown";
|
|
1984
2019
|
}
|
|
1985
2020
|
function W(...t) {
|
|
1986
|
-
const [e,
|
|
2021
|
+
const [e, r, n] = t;
|
|
1987
2022
|
return typeof e == "string" ? {
|
|
1988
2023
|
message: e,
|
|
1989
2024
|
code: "custom",
|
|
1990
|
-
input:
|
|
1991
|
-
inst:
|
|
2025
|
+
input: r,
|
|
2026
|
+
inst: n
|
|
1992
2027
|
} : { ...e };
|
|
1993
2028
|
}
|
|
1994
2029
|
const st = (t, e) => {
|
|
@@ -2003,167 +2038,167 @@ const st = (t, e) => {
|
|
|
2003
2038
|
enumerable: !1
|
|
2004
2039
|
});
|
|
2005
2040
|
}, ot = u("$ZodError", st), at = u("$ZodError", st, { Parent: Error });
|
|
2006
|
-
function
|
|
2007
|
-
const
|
|
2041
|
+
function hr(t, e = (r) => r.message) {
|
|
2042
|
+
const r = {}, n = [];
|
|
2008
2043
|
for (const i of t.issues)
|
|
2009
|
-
i.path.length > 0 ? (
|
|
2010
|
-
return { formErrors:
|
|
2044
|
+
i.path.length > 0 ? (r[i.path[0]] = r[i.path[0]] || [], r[i.path[0]].push(e(i))) : n.push(e(i));
|
|
2045
|
+
return { formErrors: n, fieldErrors: r };
|
|
2011
2046
|
}
|
|
2012
|
-
function
|
|
2013
|
-
const
|
|
2047
|
+
function lr(t, e = (r) => r.message) {
|
|
2048
|
+
const r = { _errors: [] }, n = (i) => {
|
|
2014
2049
|
for (const s of i.issues)
|
|
2015
2050
|
if (s.code === "invalid_union" && s.errors.length)
|
|
2016
|
-
s.errors.map((o) =>
|
|
2051
|
+
s.errors.map((o) => n({ issues: o }));
|
|
2017
2052
|
else if (s.code === "invalid_key")
|
|
2018
|
-
|
|
2053
|
+
n({ issues: s.issues });
|
|
2019
2054
|
else if (s.code === "invalid_element")
|
|
2020
|
-
|
|
2055
|
+
n({ issues: s.issues });
|
|
2021
2056
|
else if (s.path.length === 0)
|
|
2022
|
-
|
|
2057
|
+
r._errors.push(e(s));
|
|
2023
2058
|
else {
|
|
2024
|
-
let o =
|
|
2059
|
+
let o = r, a = 0;
|
|
2025
2060
|
for (; a < s.path.length; ) {
|
|
2026
2061
|
const c = s.path[a];
|
|
2027
2062
|
a === s.path.length - 1 ? (o[c] = o[c] || { _errors: [] }, o[c]._errors.push(e(s))) : o[c] = o[c] || { _errors: [] }, o = o[c], a++;
|
|
2028
2063
|
}
|
|
2029
2064
|
}
|
|
2030
2065
|
};
|
|
2031
|
-
return
|
|
2066
|
+
return n(t), r;
|
|
2032
2067
|
}
|
|
2033
|
-
const _e = (t) => (e,
|
|
2034
|
-
const s =
|
|
2068
|
+
const _e = (t) => (e, r, n, i) => {
|
|
2069
|
+
const s = n ? Object.assign(n, { async: !1 }) : { async: !1 }, o = e._zod.run({ value: r, issues: [] }, s);
|
|
2035
2070
|
if (o instanceof Promise)
|
|
2036
|
-
throw new
|
|
2071
|
+
throw new M();
|
|
2037
2072
|
if (o.issues.length) {
|
|
2038
2073
|
const a = new (i?.Err ?? t)(o.issues.map((c) => R(c, s, C())));
|
|
2039
|
-
throw
|
|
2074
|
+
throw rt(a, i?.callee), a;
|
|
2040
2075
|
}
|
|
2041
2076
|
return o.value;
|
|
2042
|
-
}, ke = (t) => async (e,
|
|
2043
|
-
const s =
|
|
2044
|
-
let o = e._zod.run({ value:
|
|
2077
|
+
}, ke = (t) => async (e, r, n, i) => {
|
|
2078
|
+
const s = n ? Object.assign(n, { async: !0 }) : { async: !0 };
|
|
2079
|
+
let o = e._zod.run({ value: r, issues: [] }, s);
|
|
2045
2080
|
if (o instanceof Promise && (o = await o), o.issues.length) {
|
|
2046
2081
|
const a = new (i?.Err ?? t)(o.issues.map((c) => R(c, s, C())));
|
|
2047
|
-
throw
|
|
2082
|
+
throw rt(a, i?.callee), a;
|
|
2048
2083
|
}
|
|
2049
2084
|
return o.value;
|
|
2050
|
-
}, ie = (t) => (e,
|
|
2051
|
-
const i =
|
|
2085
|
+
}, ie = (t) => (e, r, n) => {
|
|
2086
|
+
const i = n ? { ...n, async: !1 } : { async: !1 }, s = e._zod.run({ value: r, issues: [] }, i);
|
|
2052
2087
|
if (s instanceof Promise)
|
|
2053
|
-
throw new
|
|
2088
|
+
throw new M();
|
|
2054
2089
|
return s.issues.length ? {
|
|
2055
2090
|
success: !1,
|
|
2056
2091
|
error: new (t ?? ot)(s.issues.map((o) => R(o, i, C())))
|
|
2057
2092
|
} : { success: !0, data: s.value };
|
|
2058
|
-
},
|
|
2059
|
-
const i =
|
|
2060
|
-
let s = e._zod.run({ value:
|
|
2093
|
+
}, dr = /* @__PURE__ */ ie(at), se = (t) => async (e, r, n) => {
|
|
2094
|
+
const i = n ? Object.assign(n, { async: !0 }) : { async: !0 };
|
|
2095
|
+
let s = e._zod.run({ value: r, issues: [] }, i);
|
|
2061
2096
|
return s instanceof Promise && (s = await s), s.issues.length ? {
|
|
2062
2097
|
success: !1,
|
|
2063
2098
|
error: new t(s.issues.map((o) => R(o, i, C())))
|
|
2064
2099
|
} : { success: !0, data: s.value };
|
|
2065
|
-
},
|
|
2066
|
-
const i =
|
|
2067
|
-
return _e(t)(e,
|
|
2068
|
-
},
|
|
2069
|
-
const i =
|
|
2070
|
-
return ke(t)(e,
|
|
2071
|
-
},
|
|
2072
|
-
const i =
|
|
2073
|
-
return ie(t)(e,
|
|
2074
|
-
},
|
|
2075
|
-
const i =
|
|
2076
|
-
return se(t)(e,
|
|
2077
|
-
},
|
|
2078
|
-
function
|
|
2079
|
-
return new RegExp(
|
|
2080
|
-
}
|
|
2081
|
-
const
|
|
2082
|
-
function
|
|
2100
|
+
}, fr = /* @__PURE__ */ se(at), mr = (t) => (e, r, n) => {
|
|
2101
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2102
|
+
return _e(t)(e, r, i);
|
|
2103
|
+
}, gr = (t) => (e, r, n) => _e(t)(e, r, n), vr = (t) => async (e, r, n) => {
|
|
2104
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2105
|
+
return ke(t)(e, r, i);
|
|
2106
|
+
}, _r = (t) => async (e, r, n) => ke(t)(e, r, n), kr = (t) => (e, r, n) => {
|
|
2107
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2108
|
+
return ie(t)(e, r, i);
|
|
2109
|
+
}, yr = (t) => (e, r, n) => ie(t)(e, r, n), Tr = (t) => async (e, r, n) => {
|
|
2110
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2111
|
+
return se(t)(e, r, i);
|
|
2112
|
+
}, br = (t) => async (e, r, n) => se(t)(e, r, n), wr = /^[cC][^\s-]{8,}$/, Ir = /^[0-9a-z]+$/, Er = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, zr = /^[0-9a-vA-V]{20}$/, $r = /^[A-Za-z0-9]{27}$/, Or = /^[a-zA-Z0-9_-]{21}$/, Pr = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Sr = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/, ze = (t) => t ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Nr = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Ar = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
2113
|
+
function Zr() {
|
|
2114
|
+
return new RegExp(Ar, "u");
|
|
2115
|
+
}
|
|
2116
|
+
const Cr = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Rr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/, xr = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/, Lr = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Dr = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, ct = /^[A-Za-z0-9_-]*$/, Fr = /^\+(?:[0-9]){6,14}[0-9]$/, ut = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))", Mr = /* @__PURE__ */ new RegExp(`^${ut}$`);
|
|
2117
|
+
function pt(t) {
|
|
2083
2118
|
const e = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
2084
2119
|
return typeof t.precision == "number" ? t.precision === -1 ? `${e}` : t.precision === 0 ? `${e}:[0-5]\\d` : `${e}:[0-5]\\d\\.\\d{${t.precision}}` : `${e}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
2085
2120
|
}
|
|
2086
|
-
function
|
|
2087
|
-
return new RegExp(`^${
|
|
2121
|
+
function jr(t) {
|
|
2122
|
+
return new RegExp(`^${pt(t)}$`);
|
|
2088
2123
|
}
|
|
2089
|
-
function
|
|
2090
|
-
const e =
|
|
2091
|
-
t.local &&
|
|
2092
|
-
const
|
|
2093
|
-
return new RegExp(`^${ut}T(?:${
|
|
2124
|
+
function Ur(t) {
|
|
2125
|
+
const e = pt({ precision: t.precision }), r = ["Z"];
|
|
2126
|
+
t.local && r.push(""), t.offset && r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
2127
|
+
const n = `${e}(?:${r.join("|")})`;
|
|
2128
|
+
return new RegExp(`^${ut}T(?:${n})$`);
|
|
2094
2129
|
}
|
|
2095
|
-
const
|
|
2130
|
+
const Gr = (t) => {
|
|
2096
2131
|
const e = t ? `[\\s\\S]{${t?.minimum ?? 0},${t?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
2097
2132
|
return new RegExp(`^${e}$`);
|
|
2098
|
-
},
|
|
2099
|
-
var
|
|
2100
|
-
t._zod ?? (t._zod = {}), t._zod.def = e, (
|
|
2101
|
-
}),
|
|
2133
|
+
}, Vr = /^-?\d+$/, Br = /^-?\d+(?:\.\d+)?/, Jr = /^[^A-Z]*$/, Wr = /^[^a-z]*$/, w = /* @__PURE__ */ u("$ZodCheck", (t, e) => {
|
|
2134
|
+
var r;
|
|
2135
|
+
t._zod ?? (t._zod = {}), t._zod.def = e, (r = t._zod).onattach ?? (r.onattach = []);
|
|
2136
|
+
}), ht = {
|
|
2102
2137
|
number: "number",
|
|
2103
2138
|
bigint: "bigint",
|
|
2104
2139
|
object: "date"
|
|
2105
2140
|
}, lt = /* @__PURE__ */ u("$ZodCheckLessThan", (t, e) => {
|
|
2106
|
-
|
|
2107
|
-
const
|
|
2108
|
-
t._zod.onattach.push((
|
|
2109
|
-
const i =
|
|
2141
|
+
w.init(t, e);
|
|
2142
|
+
const r = ht[typeof e.value];
|
|
2143
|
+
t._zod.onattach.push((n) => {
|
|
2144
|
+
const i = n._zod.bag, s = (e.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
2110
2145
|
e.value < s && (e.inclusive ? i.maximum = e.value : i.exclusiveMaximum = e.value);
|
|
2111
|
-
}), t._zod.check = (
|
|
2112
|
-
(e.inclusive ?
|
|
2113
|
-
origin:
|
|
2146
|
+
}), t._zod.check = (n) => {
|
|
2147
|
+
(e.inclusive ? n.value <= e.value : n.value < e.value) || n.issues.push({
|
|
2148
|
+
origin: r,
|
|
2114
2149
|
code: "too_big",
|
|
2115
2150
|
maximum: e.value,
|
|
2116
|
-
input:
|
|
2151
|
+
input: n.value,
|
|
2117
2152
|
inclusive: e.inclusive,
|
|
2118
2153
|
inst: t,
|
|
2119
2154
|
continue: !e.abort
|
|
2120
2155
|
});
|
|
2121
2156
|
};
|
|
2122
2157
|
}), dt = /* @__PURE__ */ u("$ZodCheckGreaterThan", (t, e) => {
|
|
2123
|
-
|
|
2124
|
-
const
|
|
2125
|
-
t._zod.onattach.push((
|
|
2126
|
-
const i =
|
|
2158
|
+
w.init(t, e);
|
|
2159
|
+
const r = ht[typeof e.value];
|
|
2160
|
+
t._zod.onattach.push((n) => {
|
|
2161
|
+
const i = n._zod.bag, s = (e.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
2127
2162
|
e.value > s && (e.inclusive ? i.minimum = e.value : i.exclusiveMinimum = e.value);
|
|
2128
|
-
}), t._zod.check = (
|
|
2129
|
-
(e.inclusive ?
|
|
2130
|
-
origin:
|
|
2163
|
+
}), t._zod.check = (n) => {
|
|
2164
|
+
(e.inclusive ? n.value >= e.value : n.value > e.value) || n.issues.push({
|
|
2165
|
+
origin: r,
|
|
2131
2166
|
code: "too_small",
|
|
2132
2167
|
minimum: e.value,
|
|
2133
|
-
input:
|
|
2168
|
+
input: n.value,
|
|
2134
2169
|
inclusive: e.inclusive,
|
|
2135
2170
|
inst: t,
|
|
2136
2171
|
continue: !e.abort
|
|
2137
2172
|
});
|
|
2138
2173
|
};
|
|
2139
|
-
}),
|
|
2140
|
-
|
|
2141
|
-
var
|
|
2142
|
-
(
|
|
2143
|
-
}), t._zod.check = (
|
|
2144
|
-
if (typeof
|
|
2174
|
+
}), Kr = /* @__PURE__ */ u("$ZodCheckMultipleOf", (t, e) => {
|
|
2175
|
+
w.init(t, e), t._zod.onattach.push((r) => {
|
|
2176
|
+
var n;
|
|
2177
|
+
(n = r._zod.bag).multipleOf ?? (n.multipleOf = e.value);
|
|
2178
|
+
}), t._zod.check = (r) => {
|
|
2179
|
+
if (typeof r.value != typeof e.value)
|
|
2145
2180
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
2146
|
-
(typeof
|
|
2147
|
-
origin: typeof
|
|
2181
|
+
(typeof r.value == "bigint" ? r.value % e.value === BigInt(0) : Qt(r.value, e.value) === 0) || r.issues.push({
|
|
2182
|
+
origin: typeof r.value,
|
|
2148
2183
|
code: "not_multiple_of",
|
|
2149
2184
|
divisor: e.value,
|
|
2150
|
-
input:
|
|
2185
|
+
input: r.value,
|
|
2151
2186
|
inst: t,
|
|
2152
2187
|
continue: !e.abort
|
|
2153
2188
|
});
|
|
2154
2189
|
};
|
|
2155
|
-
}),
|
|
2156
|
-
|
|
2157
|
-
const
|
|
2190
|
+
}), Yr = /* @__PURE__ */ u("$ZodCheckNumberFormat", (t, e) => {
|
|
2191
|
+
w.init(t, e), e.format = e.format || "float64";
|
|
2192
|
+
const r = e.format?.includes("int"), n = r ? "int" : "number", [i, s] = nr[e.format];
|
|
2158
2193
|
t._zod.onattach.push((o) => {
|
|
2159
2194
|
const a = o._zod.bag;
|
|
2160
|
-
a.format = e.format, a.minimum = i, a.maximum = s,
|
|
2195
|
+
a.format = e.format, a.minimum = i, a.maximum = s, r && (a.pattern = Vr);
|
|
2161
2196
|
}), t._zod.check = (o) => {
|
|
2162
2197
|
const a = o.value;
|
|
2163
|
-
if (
|
|
2198
|
+
if (r) {
|
|
2164
2199
|
if (!Number.isInteger(a)) {
|
|
2165
2200
|
o.issues.push({
|
|
2166
|
-
expected:
|
|
2201
|
+
expected: n,
|
|
2167
2202
|
format: e.format,
|
|
2168
2203
|
code: "invalid_type",
|
|
2169
2204
|
continue: !1,
|
|
@@ -2179,7 +2214,7 @@ const Vn = (t) => {
|
|
|
2179
2214
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2180
2215
|
note: "Integers must be within the safe integer range.",
|
|
2181
2216
|
inst: t,
|
|
2182
|
-
origin:
|
|
2217
|
+
origin: n,
|
|
2183
2218
|
continue: !e.abort
|
|
2184
2219
|
}) : o.issues.push({
|
|
2185
2220
|
input: a,
|
|
@@ -2187,7 +2222,7 @@ const Vn = (t) => {
|
|
|
2187
2222
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2188
2223
|
note: "Integers must be within the safe integer range.",
|
|
2189
2224
|
inst: t,
|
|
2190
|
-
origin:
|
|
2225
|
+
origin: n,
|
|
2191
2226
|
continue: !e.abort
|
|
2192
2227
|
});
|
|
2193
2228
|
return;
|
|
@@ -2209,20 +2244,20 @@ const Vn = (t) => {
|
|
|
2209
2244
|
inst: t
|
|
2210
2245
|
});
|
|
2211
2246
|
};
|
|
2212
|
-
}),
|
|
2213
|
-
var
|
|
2214
|
-
|
|
2215
|
-
const i =
|
|
2247
|
+
}), qr = /* @__PURE__ */ u("$ZodCheckMaxLength", (t, e) => {
|
|
2248
|
+
var r;
|
|
2249
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2250
|
+
const i = n.value;
|
|
2216
2251
|
return !me(i) && i.length !== void 0;
|
|
2217
|
-
}), t._zod.onattach.push((
|
|
2218
|
-
const i =
|
|
2219
|
-
e.maximum < i && (
|
|
2220
|
-
}), t._zod.check = (
|
|
2221
|
-
const i =
|
|
2252
|
+
}), t._zod.onattach.push((n) => {
|
|
2253
|
+
const i = n._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
2254
|
+
e.maximum < i && (n._zod.bag.maximum = e.maximum);
|
|
2255
|
+
}), t._zod.check = (n) => {
|
|
2256
|
+
const i = n.value;
|
|
2222
2257
|
if (i.length <= e.maximum)
|
|
2223
2258
|
return;
|
|
2224
2259
|
const o = ve(i);
|
|
2225
|
-
|
|
2260
|
+
n.issues.push({
|
|
2226
2261
|
origin: o,
|
|
2227
2262
|
code: "too_big",
|
|
2228
2263
|
maximum: e.maximum,
|
|
@@ -2232,20 +2267,20 @@ const Vn = (t) => {
|
|
|
2232
2267
|
continue: !e.abort
|
|
2233
2268
|
});
|
|
2234
2269
|
};
|
|
2235
|
-
}),
|
|
2236
|
-
var
|
|
2237
|
-
|
|
2238
|
-
const i =
|
|
2270
|
+
}), Xr = /* @__PURE__ */ u("$ZodCheckMinLength", (t, e) => {
|
|
2271
|
+
var r;
|
|
2272
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2273
|
+
const i = n.value;
|
|
2239
2274
|
return !me(i) && i.length !== void 0;
|
|
2240
|
-
}), t._zod.onattach.push((
|
|
2241
|
-
const i =
|
|
2242
|
-
e.minimum > i && (
|
|
2243
|
-
}), t._zod.check = (
|
|
2244
|
-
const i =
|
|
2275
|
+
}), t._zod.onattach.push((n) => {
|
|
2276
|
+
const i = n._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
2277
|
+
e.minimum > i && (n._zod.bag.minimum = e.minimum);
|
|
2278
|
+
}), t._zod.check = (n) => {
|
|
2279
|
+
const i = n.value;
|
|
2245
2280
|
if (i.length >= e.minimum)
|
|
2246
2281
|
return;
|
|
2247
2282
|
const o = ve(i);
|
|
2248
|
-
|
|
2283
|
+
n.issues.push({
|
|
2249
2284
|
origin: o,
|
|
2250
2285
|
code: "too_small",
|
|
2251
2286
|
minimum: e.minimum,
|
|
@@ -2255,35 +2290,35 @@ const Vn = (t) => {
|
|
|
2255
2290
|
continue: !e.abort
|
|
2256
2291
|
});
|
|
2257
2292
|
};
|
|
2258
|
-
}),
|
|
2259
|
-
var
|
|
2260
|
-
|
|
2261
|
-
const i =
|
|
2293
|
+
}), Qr = /* @__PURE__ */ u("$ZodCheckLengthEquals", (t, e) => {
|
|
2294
|
+
var r;
|
|
2295
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2296
|
+
const i = n.value;
|
|
2262
2297
|
return !me(i) && i.length !== void 0;
|
|
2263
|
-
}), t._zod.onattach.push((
|
|
2264
|
-
const i =
|
|
2298
|
+
}), t._zod.onattach.push((n) => {
|
|
2299
|
+
const i = n._zod.bag;
|
|
2265
2300
|
i.minimum = e.length, i.maximum = e.length, i.length = e.length;
|
|
2266
|
-
}), t._zod.check = (
|
|
2267
|
-
const i =
|
|
2301
|
+
}), t._zod.check = (n) => {
|
|
2302
|
+
const i = n.value, s = i.length;
|
|
2268
2303
|
if (s === e.length)
|
|
2269
2304
|
return;
|
|
2270
2305
|
const o = ve(i), a = s > e.length;
|
|
2271
|
-
|
|
2306
|
+
n.issues.push({
|
|
2272
2307
|
origin: o,
|
|
2273
2308
|
...a ? { code: "too_big", maximum: e.length } : { code: "too_small", minimum: e.length },
|
|
2274
2309
|
inclusive: !0,
|
|
2275
2310
|
exact: !0,
|
|
2276
|
-
input:
|
|
2311
|
+
input: n.value,
|
|
2277
2312
|
inst: t,
|
|
2278
2313
|
continue: !e.abort
|
|
2279
2314
|
});
|
|
2280
2315
|
};
|
|
2281
2316
|
}), oe = /* @__PURE__ */ u("$ZodCheckStringFormat", (t, e) => {
|
|
2282
|
-
var
|
|
2283
|
-
|
|
2317
|
+
var r, n;
|
|
2318
|
+
w.init(t, e), t._zod.onattach.push((i) => {
|
|
2284
2319
|
const s = i._zod.bag;
|
|
2285
2320
|
s.format = e.format, e.pattern && (s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(e.pattern));
|
|
2286
|
-
}), e.pattern ? (
|
|
2321
|
+
}), e.pattern ? (r = t._zod).check ?? (r.check = (i) => {
|
|
2287
2322
|
e.pattern.lastIndex = 0, !e.pattern.test(i.value) && i.issues.push({
|
|
2288
2323
|
origin: "string",
|
|
2289
2324
|
code: "invalid_format",
|
|
@@ -2293,30 +2328,30 @@ const Vn = (t) => {
|
|
|
2293
2328
|
inst: t,
|
|
2294
2329
|
continue: !e.abort
|
|
2295
2330
|
});
|
|
2296
|
-
}) : (
|
|
2331
|
+
}) : (n = t._zod).check ?? (n.check = () => {
|
|
2297
2332
|
});
|
|
2298
|
-
}),
|
|
2299
|
-
oe.init(t, e), t._zod.check = (
|
|
2300
|
-
e.pattern.lastIndex = 0, !e.pattern.test(
|
|
2333
|
+
}), Hr = /* @__PURE__ */ u("$ZodCheckRegex", (t, e) => {
|
|
2334
|
+
oe.init(t, e), t._zod.check = (r) => {
|
|
2335
|
+
e.pattern.lastIndex = 0, !e.pattern.test(r.value) && r.issues.push({
|
|
2301
2336
|
origin: "string",
|
|
2302
2337
|
code: "invalid_format",
|
|
2303
2338
|
format: "regex",
|
|
2304
|
-
input:
|
|
2339
|
+
input: r.value,
|
|
2305
2340
|
pattern: e.pattern.toString(),
|
|
2306
2341
|
inst: t,
|
|
2307
2342
|
continue: !e.abort
|
|
2308
2343
|
});
|
|
2309
2344
|
};
|
|
2310
|
-
}),
|
|
2311
|
-
e.pattern ?? (e.pattern =
|
|
2312
|
-
}),
|
|
2313
|
-
e.pattern ?? (e.pattern =
|
|
2314
|
-
}),
|
|
2315
|
-
|
|
2316
|
-
const
|
|
2317
|
-
e.pattern =
|
|
2345
|
+
}), en = /* @__PURE__ */ u("$ZodCheckLowerCase", (t, e) => {
|
|
2346
|
+
e.pattern ?? (e.pattern = Jr), oe.init(t, e);
|
|
2347
|
+
}), tn = /* @__PURE__ */ u("$ZodCheckUpperCase", (t, e) => {
|
|
2348
|
+
e.pattern ?? (e.pattern = Wr), oe.init(t, e);
|
|
2349
|
+
}), rn = /* @__PURE__ */ u("$ZodCheckIncludes", (t, e) => {
|
|
2350
|
+
w.init(t, e);
|
|
2351
|
+
const r = j(e.includes), n = new RegExp(typeof e.position == "number" ? `^.{${e.position}}${r}` : r);
|
|
2352
|
+
e.pattern = n, t._zod.onattach.push((i) => {
|
|
2318
2353
|
const s = i._zod.bag;
|
|
2319
|
-
s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(
|
|
2354
|
+
s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(n);
|
|
2320
2355
|
}), t._zod.check = (i) => {
|
|
2321
2356
|
i.value.includes(e.includes, e.position) || i.issues.push({
|
|
2322
2357
|
origin: "string",
|
|
@@ -2328,46 +2363,46 @@ const Vn = (t) => {
|
|
|
2328
2363
|
continue: !e.abort
|
|
2329
2364
|
});
|
|
2330
2365
|
};
|
|
2331
|
-
}),
|
|
2332
|
-
|
|
2333
|
-
const
|
|
2334
|
-
e.pattern ?? (e.pattern =
|
|
2335
|
-
const i =
|
|
2336
|
-
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(
|
|
2337
|
-
}), t._zod.check = (
|
|
2338
|
-
|
|
2366
|
+
}), nn = /* @__PURE__ */ u("$ZodCheckStartsWith", (t, e) => {
|
|
2367
|
+
w.init(t, e);
|
|
2368
|
+
const r = new RegExp(`^${j(e.prefix)}.*`);
|
|
2369
|
+
e.pattern ?? (e.pattern = r), t._zod.onattach.push((n) => {
|
|
2370
|
+
const i = n._zod.bag;
|
|
2371
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
2372
|
+
}), t._zod.check = (n) => {
|
|
2373
|
+
n.value.startsWith(e.prefix) || n.issues.push({
|
|
2339
2374
|
origin: "string",
|
|
2340
2375
|
code: "invalid_format",
|
|
2341
2376
|
format: "starts_with",
|
|
2342
2377
|
prefix: e.prefix,
|
|
2343
|
-
input:
|
|
2378
|
+
input: n.value,
|
|
2344
2379
|
inst: t,
|
|
2345
2380
|
continue: !e.abort
|
|
2346
2381
|
});
|
|
2347
2382
|
};
|
|
2348
|
-
}),
|
|
2349
|
-
|
|
2350
|
-
const
|
|
2351
|
-
e.pattern ?? (e.pattern =
|
|
2352
|
-
const i =
|
|
2353
|
-
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(
|
|
2354
|
-
}), t._zod.check = (
|
|
2355
|
-
|
|
2383
|
+
}), sn = /* @__PURE__ */ u("$ZodCheckEndsWith", (t, e) => {
|
|
2384
|
+
w.init(t, e);
|
|
2385
|
+
const r = new RegExp(`.*${j(e.suffix)}$`);
|
|
2386
|
+
e.pattern ?? (e.pattern = r), t._zod.onattach.push((n) => {
|
|
2387
|
+
const i = n._zod.bag;
|
|
2388
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
2389
|
+
}), t._zod.check = (n) => {
|
|
2390
|
+
n.value.endsWith(e.suffix) || n.issues.push({
|
|
2356
2391
|
origin: "string",
|
|
2357
2392
|
code: "invalid_format",
|
|
2358
2393
|
format: "ends_with",
|
|
2359
2394
|
suffix: e.suffix,
|
|
2360
|
-
input:
|
|
2395
|
+
input: n.value,
|
|
2361
2396
|
inst: t,
|
|
2362
2397
|
continue: !e.abort
|
|
2363
2398
|
});
|
|
2364
2399
|
};
|
|
2365
|
-
}),
|
|
2366
|
-
|
|
2367
|
-
|
|
2400
|
+
}), on = /* @__PURE__ */ u("$ZodCheckOverwrite", (t, e) => {
|
|
2401
|
+
w.init(t, e), t._zod.check = (r) => {
|
|
2402
|
+
r.value = e.tx(r.value);
|
|
2368
2403
|
};
|
|
2369
2404
|
});
|
|
2370
|
-
class
|
|
2405
|
+
class an {
|
|
2371
2406
|
constructor(e = []) {
|
|
2372
2407
|
this.content = [], this.indent = 0, this && (this.args = e);
|
|
2373
2408
|
}
|
|
@@ -2379,116 +2414,116 @@ class ar {
|
|
|
2379
2414
|
e(this, { execution: "sync" }), e(this, { execution: "async" });
|
|
2380
2415
|
return;
|
|
2381
2416
|
}
|
|
2382
|
-
const
|
|
2383
|
-
`).filter((o) => o), i = Math.min(...
|
|
2417
|
+
const n = e.split(`
|
|
2418
|
+
`).filter((o) => o), i = Math.min(...n.map((o) => o.length - o.trimStart().length)), s = n.map((o) => o.slice(i)).map((o) => " ".repeat(this.indent * 2) + o);
|
|
2384
2419
|
for (const o of s)
|
|
2385
2420
|
this.content.push(o);
|
|
2386
2421
|
}
|
|
2387
2422
|
compile() {
|
|
2388
|
-
const e = Function,
|
|
2389
|
-
return new e(...
|
|
2423
|
+
const e = Function, r = this?.args, i = [...(this?.content ?? [""]).map((s) => ` ${s}`)];
|
|
2424
|
+
return new e(...r, i.join(`
|
|
2390
2425
|
`));
|
|
2391
2426
|
}
|
|
2392
2427
|
}
|
|
2393
|
-
const
|
|
2428
|
+
const cn = {
|
|
2394
2429
|
major: 4,
|
|
2395
2430
|
minor: 2,
|
|
2396
2431
|
patch: 1
|
|
2397
2432
|
}, k = /* @__PURE__ */ u("$ZodType", (t, e) => {
|
|
2398
|
-
var
|
|
2399
|
-
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version =
|
|
2400
|
-
const
|
|
2401
|
-
t._zod.traits.has("$ZodCheck") &&
|
|
2402
|
-
for (const i of
|
|
2433
|
+
var r;
|
|
2434
|
+
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version = cn;
|
|
2435
|
+
const n = [...t._zod.def.checks ?? []];
|
|
2436
|
+
t._zod.traits.has("$ZodCheck") && n.unshift(t);
|
|
2437
|
+
for (const i of n)
|
|
2403
2438
|
for (const s of i._zod.onattach)
|
|
2404
2439
|
s(t);
|
|
2405
|
-
if (
|
|
2406
|
-
(
|
|
2440
|
+
if (n.length === 0)
|
|
2441
|
+
(r = t._zod).deferred ?? (r.deferred = []), t._zod.deferred?.push(() => {
|
|
2407
2442
|
t._zod.run = t._zod.parse;
|
|
2408
2443
|
});
|
|
2409
2444
|
else {
|
|
2410
2445
|
const i = (o, a, c) => {
|
|
2411
|
-
let
|
|
2446
|
+
let p = F(o), h;
|
|
2412
2447
|
for (const d of a) {
|
|
2413
2448
|
if (d._zod.def.when) {
|
|
2414
2449
|
if (!d._zod.def.when(o))
|
|
2415
2450
|
continue;
|
|
2416
|
-
} else if (
|
|
2451
|
+
} else if (p)
|
|
2417
2452
|
continue;
|
|
2418
|
-
const f = o.issues.length,
|
|
2419
|
-
if (
|
|
2420
|
-
throw new
|
|
2421
|
-
if (
|
|
2422
|
-
|
|
2423
|
-
await
|
|
2453
|
+
const f = o.issues.length, g = d._zod.check(o);
|
|
2454
|
+
if (g instanceof Promise && c?.async === !1)
|
|
2455
|
+
throw new M();
|
|
2456
|
+
if (h || g instanceof Promise)
|
|
2457
|
+
h = (h ?? Promise.resolve()).then(async () => {
|
|
2458
|
+
await g, o.issues.length !== f && (p || (p = F(o, f)));
|
|
2424
2459
|
});
|
|
2425
2460
|
else {
|
|
2426
2461
|
if (o.issues.length === f)
|
|
2427
2462
|
continue;
|
|
2428
|
-
|
|
2463
|
+
p || (p = F(o, f));
|
|
2429
2464
|
}
|
|
2430
2465
|
}
|
|
2431
|
-
return
|
|
2466
|
+
return h ? h.then(() => o) : o;
|
|
2432
2467
|
}, s = (o, a, c) => {
|
|
2433
2468
|
if (F(o))
|
|
2434
2469
|
return o.aborted = !0, o;
|
|
2435
|
-
const
|
|
2436
|
-
if (
|
|
2470
|
+
const p = i(a, n, c);
|
|
2471
|
+
if (p instanceof Promise) {
|
|
2437
2472
|
if (c.async === !1)
|
|
2438
|
-
throw new
|
|
2439
|
-
return
|
|
2473
|
+
throw new M();
|
|
2474
|
+
return p.then((h) => t._zod.parse(h, c));
|
|
2440
2475
|
}
|
|
2441
|
-
return t._zod.parse(
|
|
2476
|
+
return t._zod.parse(p, c);
|
|
2442
2477
|
};
|
|
2443
2478
|
t._zod.run = (o, a) => {
|
|
2444
2479
|
if (a.skipChecks)
|
|
2445
2480
|
return t._zod.parse(o, a);
|
|
2446
2481
|
if (a.direction === "backward") {
|
|
2447
|
-
const
|
|
2448
|
-
return
|
|
2482
|
+
const p = t._zod.parse({ value: o.value, issues: [] }, { ...a, skipChecks: !0 });
|
|
2483
|
+
return p instanceof Promise ? p.then((h) => s(h, o, a)) : s(p, o, a);
|
|
2449
2484
|
}
|
|
2450
2485
|
const c = t._zod.parse(o, a);
|
|
2451
2486
|
if (c instanceof Promise) {
|
|
2452
2487
|
if (a.async === !1)
|
|
2453
|
-
throw new
|
|
2454
|
-
return c.then((
|
|
2488
|
+
throw new M();
|
|
2489
|
+
return c.then((p) => i(p, n, a));
|
|
2455
2490
|
}
|
|
2456
|
-
return i(c,
|
|
2491
|
+
return i(c, n, a);
|
|
2457
2492
|
};
|
|
2458
2493
|
}
|
|
2459
2494
|
t["~standard"] = {
|
|
2460
2495
|
validate: (i) => {
|
|
2461
2496
|
try {
|
|
2462
|
-
const s =
|
|
2497
|
+
const s = dr(t, i);
|
|
2463
2498
|
return s.success ? { value: s.data } : { issues: s.error?.issues };
|
|
2464
2499
|
} catch {
|
|
2465
|
-
return
|
|
2500
|
+
return fr(t, i).then((o) => o.success ? { value: o.data } : { issues: o.error?.issues });
|
|
2466
2501
|
}
|
|
2467
2502
|
},
|
|
2468
2503
|
vendor: "zod",
|
|
2469
2504
|
version: 1
|
|
2470
2505
|
};
|
|
2471
2506
|
}), ye = /* @__PURE__ */ u("$ZodString", (t, e) => {
|
|
2472
|
-
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ??
|
|
2507
|
+
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ?? Gr(t._zod.bag), t._zod.parse = (r, n) => {
|
|
2473
2508
|
if (e.coerce)
|
|
2474
2509
|
try {
|
|
2475
|
-
|
|
2510
|
+
r.value = String(r.value);
|
|
2476
2511
|
} catch {
|
|
2477
2512
|
}
|
|
2478
|
-
return typeof
|
|
2513
|
+
return typeof r.value == "string" || r.issues.push({
|
|
2479
2514
|
expected: "string",
|
|
2480
2515
|
code: "invalid_type",
|
|
2481
|
-
input:
|
|
2516
|
+
input: r.value,
|
|
2482
2517
|
inst: t
|
|
2483
|
-
}),
|
|
2518
|
+
}), r;
|
|
2484
2519
|
};
|
|
2485
|
-
}),
|
|
2520
|
+
}), v = /* @__PURE__ */ u("$ZodStringFormat", (t, e) => {
|
|
2486
2521
|
oe.init(t, e), ye.init(t, e);
|
|
2487
|
-
}),
|
|
2488
|
-
e.pattern ?? (e.pattern =
|
|
2489
|
-
}),
|
|
2522
|
+
}), un = /* @__PURE__ */ u("$ZodGUID", (t, e) => {
|
|
2523
|
+
e.pattern ?? (e.pattern = Sr), v.init(t, e);
|
|
2524
|
+
}), pn = /* @__PURE__ */ u("$ZodUUID", (t, e) => {
|
|
2490
2525
|
if (e.version) {
|
|
2491
|
-
const
|
|
2526
|
+
const n = {
|
|
2492
2527
|
v1: 1,
|
|
2493
2528
|
v2: 2,
|
|
2494
2529
|
v3: 3,
|
|
@@ -2498,93 +2533,93 @@ const cr = {
|
|
|
2498
2533
|
v7: 7,
|
|
2499
2534
|
v8: 8
|
|
2500
2535
|
}[e.version];
|
|
2501
|
-
if (
|
|
2536
|
+
if (n === void 0)
|
|
2502
2537
|
throw new Error(`Invalid UUID version: "${e.version}"`);
|
|
2503
|
-
e.pattern ?? (e.pattern = ze(
|
|
2538
|
+
e.pattern ?? (e.pattern = ze(n));
|
|
2504
2539
|
} else
|
|
2505
2540
|
e.pattern ?? (e.pattern = ze());
|
|
2506
|
-
|
|
2507
|
-
}),
|
|
2508
|
-
e.pattern ?? (e.pattern =
|
|
2509
|
-
}),
|
|
2510
|
-
|
|
2541
|
+
v.init(t, e);
|
|
2542
|
+
}), hn = /* @__PURE__ */ u("$ZodEmail", (t, e) => {
|
|
2543
|
+
e.pattern ?? (e.pattern = Nr), v.init(t, e);
|
|
2544
|
+
}), ln = /* @__PURE__ */ u("$ZodURL", (t, e) => {
|
|
2545
|
+
v.init(t, e), t._zod.check = (r) => {
|
|
2511
2546
|
try {
|
|
2512
|
-
const
|
|
2513
|
-
e.hostname && (e.hostname.lastIndex = 0, e.hostname.test(i.hostname) ||
|
|
2547
|
+
const n = r.value.trim(), i = new URL(n);
|
|
2548
|
+
e.hostname && (e.hostname.lastIndex = 0, e.hostname.test(i.hostname) || r.issues.push({
|
|
2514
2549
|
code: "invalid_format",
|
|
2515
2550
|
format: "url",
|
|
2516
2551
|
note: "Invalid hostname",
|
|
2517
2552
|
pattern: e.hostname.source,
|
|
2518
|
-
input:
|
|
2553
|
+
input: r.value,
|
|
2519
2554
|
inst: t,
|
|
2520
2555
|
continue: !e.abort
|
|
2521
|
-
})), e.protocol && (e.protocol.lastIndex = 0, e.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) ||
|
|
2556
|
+
})), e.protocol && (e.protocol.lastIndex = 0, e.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || r.issues.push({
|
|
2522
2557
|
code: "invalid_format",
|
|
2523
2558
|
format: "url",
|
|
2524
2559
|
note: "Invalid protocol",
|
|
2525
2560
|
pattern: e.protocol.source,
|
|
2526
|
-
input:
|
|
2561
|
+
input: r.value,
|
|
2527
2562
|
inst: t,
|
|
2528
2563
|
continue: !e.abort
|
|
2529
|
-
})), e.normalize ?
|
|
2564
|
+
})), e.normalize ? r.value = i.href : r.value = n;
|
|
2530
2565
|
return;
|
|
2531
2566
|
} catch {
|
|
2532
|
-
|
|
2567
|
+
r.issues.push({
|
|
2533
2568
|
code: "invalid_format",
|
|
2534
2569
|
format: "url",
|
|
2535
|
-
input:
|
|
2570
|
+
input: r.value,
|
|
2536
2571
|
inst: t,
|
|
2537
2572
|
continue: !e.abort
|
|
2538
2573
|
});
|
|
2539
2574
|
}
|
|
2540
2575
|
};
|
|
2541
|
-
}),
|
|
2542
|
-
e.pattern ?? (e.pattern =
|
|
2543
|
-
}),
|
|
2544
|
-
e.pattern ?? (e.pattern =
|
|
2545
|
-
}),
|
|
2546
|
-
e.pattern ?? (e.pattern =
|
|
2547
|
-
}),
|
|
2548
|
-
e.pattern ?? (e.pattern =
|
|
2549
|
-
}),
|
|
2550
|
-
e.pattern ?? (e.pattern =
|
|
2551
|
-
}),
|
|
2552
|
-
e.pattern ?? (e.pattern =
|
|
2553
|
-
}),
|
|
2554
|
-
e.pattern ?? (e.pattern =
|
|
2555
|
-
}),
|
|
2556
|
-
e.pattern ?? (e.pattern =
|
|
2557
|
-
}),
|
|
2558
|
-
e.pattern ?? (e.pattern =
|
|
2559
|
-
}),
|
|
2560
|
-
e.pattern ?? (e.pattern =
|
|
2561
|
-
}),
|
|
2562
|
-
e.pattern ?? (e.pattern =
|
|
2563
|
-
}),
|
|
2564
|
-
e.pattern ?? (e.pattern =
|
|
2565
|
-
}),
|
|
2566
|
-
e.pattern ?? (e.pattern =
|
|
2576
|
+
}), dn = /* @__PURE__ */ u("$ZodEmoji", (t, e) => {
|
|
2577
|
+
e.pattern ?? (e.pattern = Zr()), v.init(t, e);
|
|
2578
|
+
}), fn = /* @__PURE__ */ u("$ZodNanoID", (t, e) => {
|
|
2579
|
+
e.pattern ?? (e.pattern = Or), v.init(t, e);
|
|
2580
|
+
}), mn = /* @__PURE__ */ u("$ZodCUID", (t, e) => {
|
|
2581
|
+
e.pattern ?? (e.pattern = wr), v.init(t, e);
|
|
2582
|
+
}), gn = /* @__PURE__ */ u("$ZodCUID2", (t, e) => {
|
|
2583
|
+
e.pattern ?? (e.pattern = Ir), v.init(t, e);
|
|
2584
|
+
}), vn = /* @__PURE__ */ u("$ZodULID", (t, e) => {
|
|
2585
|
+
e.pattern ?? (e.pattern = Er), v.init(t, e);
|
|
2586
|
+
}), _n = /* @__PURE__ */ u("$ZodXID", (t, e) => {
|
|
2587
|
+
e.pattern ?? (e.pattern = zr), v.init(t, e);
|
|
2588
|
+
}), kn = /* @__PURE__ */ u("$ZodKSUID", (t, e) => {
|
|
2589
|
+
e.pattern ?? (e.pattern = $r), v.init(t, e);
|
|
2590
|
+
}), yn = /* @__PURE__ */ u("$ZodISODateTime", (t, e) => {
|
|
2591
|
+
e.pattern ?? (e.pattern = Ur(e)), v.init(t, e);
|
|
2592
|
+
}), Tn = /* @__PURE__ */ u("$ZodISODate", (t, e) => {
|
|
2593
|
+
e.pattern ?? (e.pattern = Mr), v.init(t, e);
|
|
2594
|
+
}), bn = /* @__PURE__ */ u("$ZodISOTime", (t, e) => {
|
|
2595
|
+
e.pattern ?? (e.pattern = jr(e)), v.init(t, e);
|
|
2596
|
+
}), wn = /* @__PURE__ */ u("$ZodISODuration", (t, e) => {
|
|
2597
|
+
e.pattern ?? (e.pattern = Pr), v.init(t, e);
|
|
2598
|
+
}), In = /* @__PURE__ */ u("$ZodIPv4", (t, e) => {
|
|
2599
|
+
e.pattern ?? (e.pattern = Cr), v.init(t, e), t._zod.bag.format = "ipv4";
|
|
2600
|
+
}), En = /* @__PURE__ */ u("$ZodIPv6", (t, e) => {
|
|
2601
|
+
e.pattern ?? (e.pattern = Rr), v.init(t, e), t._zod.bag.format = "ipv6", t._zod.check = (r) => {
|
|
2567
2602
|
try {
|
|
2568
|
-
new URL(`http://[${
|
|
2603
|
+
new URL(`http://[${r.value}]`);
|
|
2569
2604
|
} catch {
|
|
2570
|
-
|
|
2605
|
+
r.issues.push({
|
|
2571
2606
|
code: "invalid_format",
|
|
2572
2607
|
format: "ipv6",
|
|
2573
|
-
input:
|
|
2608
|
+
input: r.value,
|
|
2574
2609
|
inst: t,
|
|
2575
2610
|
continue: !e.abort
|
|
2576
2611
|
});
|
|
2577
2612
|
}
|
|
2578
2613
|
};
|
|
2579
|
-
}),
|
|
2580
|
-
e.pattern ?? (e.pattern =
|
|
2581
|
-
}), $
|
|
2582
|
-
e.pattern ?? (e.pattern =
|
|
2583
|
-
const
|
|
2614
|
+
}), zn = /* @__PURE__ */ u("$ZodCIDRv4", (t, e) => {
|
|
2615
|
+
e.pattern ?? (e.pattern = xr), v.init(t, e);
|
|
2616
|
+
}), $n = /* @__PURE__ */ u("$ZodCIDRv6", (t, e) => {
|
|
2617
|
+
e.pattern ?? (e.pattern = Lr), v.init(t, e), t._zod.check = (r) => {
|
|
2618
|
+
const n = r.value.split("/");
|
|
2584
2619
|
try {
|
|
2585
|
-
if (
|
|
2620
|
+
if (n.length !== 2)
|
|
2586
2621
|
throw new Error();
|
|
2587
|
-
const [i, s] =
|
|
2622
|
+
const [i, s] = n;
|
|
2588
2623
|
if (!s)
|
|
2589
2624
|
throw new Error();
|
|
2590
2625
|
const o = Number(s);
|
|
@@ -2594,10 +2629,10 @@ const cr = {
|
|
|
2594
2629
|
throw new Error();
|
|
2595
2630
|
new URL(`http://[${i}]`);
|
|
2596
2631
|
} catch {
|
|
2597
|
-
|
|
2632
|
+
r.issues.push({
|
|
2598
2633
|
code: "invalid_format",
|
|
2599
2634
|
format: "cidrv6",
|
|
2600
|
-
input:
|
|
2635
|
+
input: r.value,
|
|
2601
2636
|
inst: t,
|
|
2602
2637
|
continue: !e.abort
|
|
2603
2638
|
});
|
|
@@ -2615,153 +2650,153 @@ function ft(t) {
|
|
|
2615
2650
|
return !1;
|
|
2616
2651
|
}
|
|
2617
2652
|
}
|
|
2618
|
-
const
|
|
2619
|
-
e.pattern ?? (e.pattern =
|
|
2620
|
-
ft(
|
|
2653
|
+
const On = /* @__PURE__ */ u("$ZodBase64", (t, e) => {
|
|
2654
|
+
e.pattern ?? (e.pattern = Dr), v.init(t, e), t._zod.bag.contentEncoding = "base64", t._zod.check = (r) => {
|
|
2655
|
+
ft(r.value) || r.issues.push({
|
|
2621
2656
|
code: "invalid_format",
|
|
2622
2657
|
format: "base64",
|
|
2623
|
-
input:
|
|
2658
|
+
input: r.value,
|
|
2624
2659
|
inst: t,
|
|
2625
2660
|
continue: !e.abort
|
|
2626
2661
|
});
|
|
2627
2662
|
};
|
|
2628
2663
|
});
|
|
2629
|
-
function
|
|
2664
|
+
function Pn(t) {
|
|
2630
2665
|
if (!ct.test(t))
|
|
2631
2666
|
return !1;
|
|
2632
|
-
const e = t.replace(/[-_]/g, (
|
|
2633
|
-
return ft(
|
|
2667
|
+
const e = t.replace(/[-_]/g, (n) => n === "-" ? "+" : "/"), r = e.padEnd(Math.ceil(e.length / 4) * 4, "=");
|
|
2668
|
+
return ft(r);
|
|
2634
2669
|
}
|
|
2635
|
-
const
|
|
2636
|
-
e.pattern ?? (e.pattern = ct),
|
|
2637
|
-
|
|
2670
|
+
const Sn = /* @__PURE__ */ u("$ZodBase64URL", (t, e) => {
|
|
2671
|
+
e.pattern ?? (e.pattern = ct), v.init(t, e), t._zod.bag.contentEncoding = "base64url", t._zod.check = (r) => {
|
|
2672
|
+
Pn(r.value) || r.issues.push({
|
|
2638
2673
|
code: "invalid_format",
|
|
2639
2674
|
format: "base64url",
|
|
2640
|
-
input:
|
|
2675
|
+
input: r.value,
|
|
2641
2676
|
inst: t,
|
|
2642
2677
|
continue: !e.abort
|
|
2643
2678
|
});
|
|
2644
2679
|
};
|
|
2645
|
-
}),
|
|
2646
|
-
e.pattern ?? (e.pattern =
|
|
2680
|
+
}), Nn = /* @__PURE__ */ u("$ZodE164", (t, e) => {
|
|
2681
|
+
e.pattern ?? (e.pattern = Fr), v.init(t, e);
|
|
2647
2682
|
});
|
|
2648
|
-
function
|
|
2683
|
+
function An(t, e = null) {
|
|
2649
2684
|
try {
|
|
2650
|
-
const
|
|
2651
|
-
if (
|
|
2685
|
+
const r = t.split(".");
|
|
2686
|
+
if (r.length !== 3)
|
|
2652
2687
|
return !1;
|
|
2653
|
-
const [
|
|
2654
|
-
if (!
|
|
2688
|
+
const [n] = r;
|
|
2689
|
+
if (!n)
|
|
2655
2690
|
return !1;
|
|
2656
|
-
const i = JSON.parse(atob(
|
|
2691
|
+
const i = JSON.parse(atob(n));
|
|
2657
2692
|
return !("typ" in i && i?.typ !== "JWT" || !i.alg || e && (!("alg" in i) || i.alg !== e));
|
|
2658
2693
|
} catch {
|
|
2659
2694
|
return !1;
|
|
2660
2695
|
}
|
|
2661
2696
|
}
|
|
2662
|
-
const
|
|
2663
|
-
|
|
2664
|
-
|
|
2697
|
+
const Zn = /* @__PURE__ */ u("$ZodJWT", (t, e) => {
|
|
2698
|
+
v.init(t, e), t._zod.check = (r) => {
|
|
2699
|
+
An(r.value, e.alg) || r.issues.push({
|
|
2665
2700
|
code: "invalid_format",
|
|
2666
2701
|
format: "jwt",
|
|
2667
|
-
input:
|
|
2702
|
+
input: r.value,
|
|
2668
2703
|
inst: t,
|
|
2669
2704
|
continue: !e.abort
|
|
2670
2705
|
});
|
|
2671
2706
|
};
|
|
2672
2707
|
}), mt = /* @__PURE__ */ u("$ZodNumber", (t, e) => {
|
|
2673
|
-
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ??
|
|
2708
|
+
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ?? Br, t._zod.parse = (r, n) => {
|
|
2674
2709
|
if (e.coerce)
|
|
2675
2710
|
try {
|
|
2676
|
-
|
|
2711
|
+
r.value = Number(r.value);
|
|
2677
2712
|
} catch {
|
|
2678
2713
|
}
|
|
2679
|
-
const i =
|
|
2714
|
+
const i = r.value;
|
|
2680
2715
|
if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i))
|
|
2681
|
-
return
|
|
2716
|
+
return r;
|
|
2682
2717
|
const s = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
|
|
2683
|
-
return
|
|
2718
|
+
return r.issues.push({
|
|
2684
2719
|
expected: "number",
|
|
2685
2720
|
code: "invalid_type",
|
|
2686
2721
|
input: i,
|
|
2687
2722
|
inst: t,
|
|
2688
2723
|
...s ? { received: s } : {}
|
|
2689
|
-
}),
|
|
2724
|
+
}), r;
|
|
2690
2725
|
};
|
|
2691
|
-
}),
|
|
2692
|
-
|
|
2693
|
-
}),
|
|
2694
|
-
k.init(t, e), t._zod.parse = (
|
|
2695
|
-
}),
|
|
2696
|
-
k.init(t, e), t._zod.parse = (
|
|
2726
|
+
}), Cn = /* @__PURE__ */ u("$ZodNumberFormat", (t, e) => {
|
|
2727
|
+
Yr.init(t, e), mt.init(t, e);
|
|
2728
|
+
}), Rn = /* @__PURE__ */ u("$ZodUnknown", (t, e) => {
|
|
2729
|
+
k.init(t, e), t._zod.parse = (r) => r;
|
|
2730
|
+
}), xn = /* @__PURE__ */ u("$ZodNever", (t, e) => {
|
|
2731
|
+
k.init(t, e), t._zod.parse = (r, n) => (r.issues.push({
|
|
2697
2732
|
expected: "never",
|
|
2698
2733
|
code: "invalid_type",
|
|
2699
|
-
input:
|
|
2734
|
+
input: r.value,
|
|
2700
2735
|
inst: t
|
|
2701
|
-
}),
|
|
2736
|
+
}), r);
|
|
2702
2737
|
});
|
|
2703
|
-
function $e(t, e,
|
|
2704
|
-
t.issues.length && e.issues.push(...it(
|
|
2738
|
+
function $e(t, e, r) {
|
|
2739
|
+
t.issues.length && e.issues.push(...it(r, t.issues)), e.value[r] = t.value;
|
|
2705
2740
|
}
|
|
2706
|
-
const
|
|
2707
|
-
k.init(t, e), t._zod.parse = (
|
|
2708
|
-
const i =
|
|
2741
|
+
const Ln = /* @__PURE__ */ u("$ZodArray", (t, e) => {
|
|
2742
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
2743
|
+
const i = r.value;
|
|
2709
2744
|
if (!Array.isArray(i))
|
|
2710
|
-
return
|
|
2745
|
+
return r.issues.push({
|
|
2711
2746
|
expected: "array",
|
|
2712
2747
|
code: "invalid_type",
|
|
2713
2748
|
input: i,
|
|
2714
2749
|
inst: t
|
|
2715
|
-
}),
|
|
2716
|
-
|
|
2750
|
+
}), r;
|
|
2751
|
+
r.value = Array(i.length);
|
|
2717
2752
|
const s = [];
|
|
2718
2753
|
for (let o = 0; o < i.length; o++) {
|
|
2719
2754
|
const a = i[o], c = e.element._zod.run({
|
|
2720
2755
|
value: a,
|
|
2721
2756
|
issues: []
|
|
2722
|
-
},
|
|
2723
|
-
c instanceof Promise ? s.push(c.then((
|
|
2757
|
+
}, n);
|
|
2758
|
+
c instanceof Promise ? s.push(c.then((p) => $e(p, r, o))) : $e(c, r, o);
|
|
2724
2759
|
}
|
|
2725
|
-
return s.length ? Promise.all(s).then(() =>
|
|
2760
|
+
return s.length ? Promise.all(s).then(() => r) : r;
|
|
2726
2761
|
};
|
|
2727
2762
|
});
|
|
2728
|
-
function H(t, e,
|
|
2729
|
-
t.issues.length && e.issues.push(...it(
|
|
2763
|
+
function H(t, e, r, n) {
|
|
2764
|
+
t.issues.length && e.issues.push(...it(r, t.issues)), t.value === void 0 ? r in n && (e.value[r] = void 0) : e.value[r] = t.value;
|
|
2730
2765
|
}
|
|
2731
2766
|
function gt(t) {
|
|
2732
2767
|
const e = Object.keys(t.shape);
|
|
2733
|
-
for (const
|
|
2734
|
-
if (!t.shape?.[
|
|
2735
|
-
throw new Error(`Invalid element at key "${
|
|
2736
|
-
const
|
|
2768
|
+
for (const n of e)
|
|
2769
|
+
if (!t.shape?.[n]?._zod?.traits?.has("$ZodType"))
|
|
2770
|
+
throw new Error(`Invalid element at key "${n}": expected a Zod schema`);
|
|
2771
|
+
const r = rr(t.shape);
|
|
2737
2772
|
return {
|
|
2738
2773
|
...t,
|
|
2739
2774
|
keys: e,
|
|
2740
2775
|
keySet: new Set(e),
|
|
2741
2776
|
numKeys: e.length,
|
|
2742
|
-
optionalKeys: new Set(
|
|
2777
|
+
optionalKeys: new Set(r)
|
|
2743
2778
|
};
|
|
2744
2779
|
}
|
|
2745
|
-
function vt(t, e,
|
|
2746
|
-
const o = [], a = i.keySet, c = i.catchall._zod,
|
|
2747
|
-
for (const
|
|
2748
|
-
if (a.has(
|
|
2780
|
+
function vt(t, e, r, n, i, s) {
|
|
2781
|
+
const o = [], a = i.keySet, c = i.catchall._zod, p = c.def.type;
|
|
2782
|
+
for (const h in e) {
|
|
2783
|
+
if (a.has(h))
|
|
2749
2784
|
continue;
|
|
2750
|
-
if (
|
|
2751
|
-
o.push(
|
|
2785
|
+
if (p === "never") {
|
|
2786
|
+
o.push(h);
|
|
2752
2787
|
continue;
|
|
2753
2788
|
}
|
|
2754
|
-
const d = c.run({ value: e[
|
|
2755
|
-
d instanceof Promise ? t.push(d.then((f) => H(f,
|
|
2789
|
+
const d = c.run({ value: e[h], issues: [] }, n);
|
|
2790
|
+
d instanceof Promise ? t.push(d.then((f) => H(f, r, h, e))) : H(d, r, h, e);
|
|
2756
2791
|
}
|
|
2757
|
-
return o.length &&
|
|
2792
|
+
return o.length && r.issues.push({
|
|
2758
2793
|
code: "unrecognized_keys",
|
|
2759
2794
|
keys: o,
|
|
2760
2795
|
input: e,
|
|
2761
2796
|
inst: s
|
|
2762
|
-
}), t.length ? Promise.all(t).then(() =>
|
|
2797
|
+
}), t.length ? Promise.all(t).then(() => r) : r;
|
|
2763
2798
|
}
|
|
2764
|
-
const
|
|
2799
|
+
const Dn = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
2765
2800
|
if (k.init(t, e), !Object.getOwnPropertyDescriptor(e, "shape")?.get) {
|
|
2766
2801
|
const a = e.shape;
|
|
2767
2802
|
Object.defineProperty(e, "shape", {
|
|
@@ -2773,15 +2808,15 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2773
2808
|
}
|
|
2774
2809
|
});
|
|
2775
2810
|
}
|
|
2776
|
-
const
|
|
2811
|
+
const n = ne(() => gt(e));
|
|
2777
2812
|
m(t._zod, "propValues", () => {
|
|
2778
2813
|
const a = e.shape, c = {};
|
|
2779
|
-
for (const
|
|
2780
|
-
const
|
|
2781
|
-
if (
|
|
2782
|
-
c[
|
|
2783
|
-
for (const d of
|
|
2784
|
-
c[
|
|
2814
|
+
for (const p in a) {
|
|
2815
|
+
const h = a[p]._zod;
|
|
2816
|
+
if (h.values) {
|
|
2817
|
+
c[p] ?? (c[p] = /* @__PURE__ */ new Set());
|
|
2818
|
+
for (const d of h.values)
|
|
2819
|
+
c[p].add(d);
|
|
2785
2820
|
}
|
|
2786
2821
|
}
|
|
2787
2822
|
return c;
|
|
@@ -2789,39 +2824,39 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2789
2824
|
const i = B, s = e.catchall;
|
|
2790
2825
|
let o;
|
|
2791
2826
|
t._zod.parse = (a, c) => {
|
|
2792
|
-
o ?? (o =
|
|
2793
|
-
const
|
|
2794
|
-
if (!i(
|
|
2827
|
+
o ?? (o = n.value);
|
|
2828
|
+
const p = a.value;
|
|
2829
|
+
if (!i(p))
|
|
2795
2830
|
return a.issues.push({
|
|
2796
2831
|
expected: "object",
|
|
2797
2832
|
code: "invalid_type",
|
|
2798
|
-
input:
|
|
2833
|
+
input: p,
|
|
2799
2834
|
inst: t
|
|
2800
2835
|
}), a;
|
|
2801
2836
|
a.value = {};
|
|
2802
|
-
const
|
|
2837
|
+
const h = [], d = o.shape;
|
|
2803
2838
|
for (const f of o.keys) {
|
|
2804
|
-
const
|
|
2805
|
-
|
|
2839
|
+
const I = d[f]._zod.run({ value: p[f], issues: [] }, c);
|
|
2840
|
+
I instanceof Promise ? h.push(I.then((ce) => H(ce, a, f, p))) : H(I, a, f, p);
|
|
2806
2841
|
}
|
|
2807
|
-
return s ? vt(
|
|
2842
|
+
return s ? vt(h, p, a, c, n.value, t) : h.length ? Promise.all(h).then(() => a) : a;
|
|
2808
2843
|
};
|
|
2809
|
-
}),
|
|
2810
|
-
|
|
2811
|
-
const
|
|
2812
|
-
const
|
|
2813
|
-
const O =
|
|
2844
|
+
}), Fn = /* @__PURE__ */ u("$ZodObjectJIT", (t, e) => {
|
|
2845
|
+
Dn.init(t, e);
|
|
2846
|
+
const r = t._zod.parse, n = ne(() => gt(e)), i = (f) => {
|
|
2847
|
+
const g = new an(["shape", "payload", "ctx"]), I = n.value, ce = (P) => {
|
|
2848
|
+
const O = Ee(P);
|
|
2814
2849
|
return `shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`;
|
|
2815
2850
|
};
|
|
2816
|
-
|
|
2817
|
-
const
|
|
2851
|
+
g.write("const input = payload.value;");
|
|
2852
|
+
const be = /* @__PURE__ */ Object.create(null);
|
|
2818
2853
|
let St = 0;
|
|
2819
|
-
for (const P of
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
for (const P of
|
|
2823
|
-
const O =
|
|
2824
|
-
|
|
2854
|
+
for (const P of I.keys)
|
|
2855
|
+
be[P] = `key_${St++}`;
|
|
2856
|
+
g.write("const newResult = {};");
|
|
2857
|
+
for (const P of I.keys) {
|
|
2858
|
+
const O = be[P], G = Ee(P);
|
|
2859
|
+
g.write(`const ${O} = ${ce(P)};`), g.write(`
|
|
2825
2860
|
if (${O}.issues.length) {
|
|
2826
2861
|
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
2827
2862
|
...iss,
|
|
@@ -2840,25 +2875,25 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2840
2875
|
|
|
2841
2876
|
`);
|
|
2842
2877
|
}
|
|
2843
|
-
|
|
2844
|
-
const Nt =
|
|
2878
|
+
g.write("payload.value = newResult;"), g.write("return payload;");
|
|
2879
|
+
const Nt = g.compile();
|
|
2845
2880
|
return (P, O) => Nt(f, P, O);
|
|
2846
2881
|
};
|
|
2847
2882
|
let s;
|
|
2848
|
-
const o = B, a = !et.jitless,
|
|
2883
|
+
const o = B, a = !et.jitless, p = a && er.value, h = e.catchall;
|
|
2849
2884
|
let d;
|
|
2850
|
-
t._zod.parse = (f,
|
|
2851
|
-
d ?? (d =
|
|
2852
|
-
const
|
|
2853
|
-
return o(
|
|
2885
|
+
t._zod.parse = (f, g) => {
|
|
2886
|
+
d ?? (d = n.value);
|
|
2887
|
+
const I = f.value;
|
|
2888
|
+
return o(I) ? a && p && g?.async === !1 && g.jitless !== !0 ? (s || (s = i(e.shape)), f = s(f, g), h ? vt([], I, f, g, d, t) : f) : r(f, g) : (f.issues.push({
|
|
2854
2889
|
expected: "object",
|
|
2855
2890
|
code: "invalid_type",
|
|
2856
|
-
input:
|
|
2891
|
+
input: I,
|
|
2857
2892
|
inst: t
|
|
2858
2893
|
}), f);
|
|
2859
2894
|
};
|
|
2860
2895
|
});
|
|
2861
|
-
function Oe(t, e,
|
|
2896
|
+
function Oe(t, e, r, n) {
|
|
2862
2897
|
for (const s of t)
|
|
2863
2898
|
if (s.issues.length === 0)
|
|
2864
2899
|
return e.value = s.value, e;
|
|
@@ -2866,8 +2901,8 @@ function Oe(t, e, n, r) {
|
|
|
2866
2901
|
return i.length === 1 ? (e.value = i[0].value, i[0]) : (e.issues.push({
|
|
2867
2902
|
code: "invalid_union",
|
|
2868
2903
|
input: e.value,
|
|
2869
|
-
inst:
|
|
2870
|
-
errors: t.map((s) => s.issues.map((o) => R(o,
|
|
2904
|
+
inst: r,
|
|
2905
|
+
errors: t.map((s) => s.issues.map((o) => R(o, n, C())))
|
|
2871
2906
|
}), e);
|
|
2872
2907
|
}
|
|
2873
2908
|
const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
@@ -2880,30 +2915,30 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2880
2915
|
return new RegExp(`^(${i.map((s) => ge(s.source)).join("|")})$`);
|
|
2881
2916
|
}
|
|
2882
2917
|
});
|
|
2883
|
-
const
|
|
2918
|
+
const r = e.options.length === 1, n = e.options[0]._zod.run;
|
|
2884
2919
|
t._zod.parse = (i, s) => {
|
|
2885
|
-
if (
|
|
2886
|
-
return
|
|
2920
|
+
if (r)
|
|
2921
|
+
return n(i, s);
|
|
2887
2922
|
let o = !1;
|
|
2888
2923
|
const a = [];
|
|
2889
2924
|
for (const c of e.options) {
|
|
2890
|
-
const
|
|
2925
|
+
const p = c._zod.run({
|
|
2891
2926
|
value: i.value,
|
|
2892
2927
|
issues: []
|
|
2893
2928
|
}, s);
|
|
2894
|
-
if (
|
|
2895
|
-
a.push(
|
|
2929
|
+
if (p instanceof Promise)
|
|
2930
|
+
a.push(p), o = !0;
|
|
2896
2931
|
else {
|
|
2897
|
-
if (
|
|
2898
|
-
return
|
|
2899
|
-
a.push(
|
|
2932
|
+
if (p.issues.length === 0)
|
|
2933
|
+
return p;
|
|
2934
|
+
a.push(p);
|
|
2900
2935
|
}
|
|
2901
2936
|
}
|
|
2902
2937
|
return o ? Promise.all(a).then((c) => Oe(c, i, t, s)) : Oe(a, i, t, s);
|
|
2903
2938
|
};
|
|
2904
|
-
}),
|
|
2939
|
+
}), Mn = /* @__PURE__ */ u("$ZodDiscriminatedUnion", (t, e) => {
|
|
2905
2940
|
e.inclusive = !1, _t.init(t, e);
|
|
2906
|
-
const
|
|
2941
|
+
const r = t._zod.parse;
|
|
2907
2942
|
m(t._zod, "propValues", () => {
|
|
2908
2943
|
const i = {};
|
|
2909
2944
|
for (const s of e.options) {
|
|
@@ -2912,13 +2947,13 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2912
2947
|
throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);
|
|
2913
2948
|
for (const [a, c] of Object.entries(o)) {
|
|
2914
2949
|
i[a] || (i[a] = /* @__PURE__ */ new Set());
|
|
2915
|
-
for (const
|
|
2916
|
-
i[a].add(
|
|
2950
|
+
for (const p of c)
|
|
2951
|
+
i[a].add(p);
|
|
2917
2952
|
}
|
|
2918
2953
|
}
|
|
2919
2954
|
return i;
|
|
2920
2955
|
});
|
|
2921
|
-
const
|
|
2956
|
+
const n = ne(() => {
|
|
2922
2957
|
const i = e.options, s = /* @__PURE__ */ new Map();
|
|
2923
2958
|
for (const o of i) {
|
|
2924
2959
|
const a = o._zod.propValues?.[e.discriminator];
|
|
@@ -2941,8 +2976,8 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2941
2976
|
input: o,
|
|
2942
2977
|
inst: t
|
|
2943
2978
|
}), i;
|
|
2944
|
-
const a =
|
|
2945
|
-
return a ? a._zod.run(i, s) : e.unionFallback ?
|
|
2979
|
+
const a = n.value.get(o?.[e.discriminator]);
|
|
2980
|
+
return a ? a._zod.run(i, s) : e.unionFallback ? r(i, s) : (i.issues.push({
|
|
2946
2981
|
code: "invalid_union",
|
|
2947
2982
|
errors: [],
|
|
2948
2983
|
note: "No matching discriminator",
|
|
@@ -2952,10 +2987,10 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2952
2987
|
inst: t
|
|
2953
2988
|
}), i);
|
|
2954
2989
|
};
|
|
2955
|
-
}),
|
|
2956
|
-
k.init(t, e), t._zod.parse = (
|
|
2957
|
-
const i =
|
|
2958
|
-
return s instanceof Promise || o instanceof Promise ? Promise.all([s, o]).then(([c,
|
|
2990
|
+
}), jn = /* @__PURE__ */ u("$ZodIntersection", (t, e) => {
|
|
2991
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
2992
|
+
const i = r.value, s = e.left._zod.run({ value: i, issues: [] }, n), o = e.right._zod.run({ value: i, issues: [] }, n);
|
|
2993
|
+
return s instanceof Promise || o instanceof Promise ? Promise.all([s, o]).then(([c, p]) => Pe(r, c, p)) : Pe(r, s, o);
|
|
2959
2994
|
};
|
|
2960
2995
|
});
|
|
2961
2996
|
function de(t, e) {
|
|
@@ -2964,8 +2999,8 @@ function de(t, e) {
|
|
|
2964
2999
|
if (t instanceof Date && e instanceof Date && +t == +e)
|
|
2965
3000
|
return { valid: !0, data: t };
|
|
2966
3001
|
if (J(t) && J(e)) {
|
|
2967
|
-
const
|
|
2968
|
-
for (const s of
|
|
3002
|
+
const r = Object.keys(e), n = Object.keys(t).filter((s) => r.indexOf(s) !== -1), i = { ...t, ...e };
|
|
3003
|
+
for (const s of n) {
|
|
2969
3004
|
const o = de(t[s], e[s]);
|
|
2970
3005
|
if (!o.valid)
|
|
2971
3006
|
return {
|
|
@@ -2979,105 +3014,105 @@ function de(t, e) {
|
|
|
2979
3014
|
if (Array.isArray(t) && Array.isArray(e)) {
|
|
2980
3015
|
if (t.length !== e.length)
|
|
2981
3016
|
return { valid: !1, mergeErrorPath: [] };
|
|
2982
|
-
const
|
|
2983
|
-
for (let
|
|
2984
|
-
const i = t[
|
|
3017
|
+
const r = [];
|
|
3018
|
+
for (let n = 0; n < t.length; n++) {
|
|
3019
|
+
const i = t[n], s = e[n], o = de(i, s);
|
|
2985
3020
|
if (!o.valid)
|
|
2986
3021
|
return {
|
|
2987
3022
|
valid: !1,
|
|
2988
|
-
mergeErrorPath: [
|
|
3023
|
+
mergeErrorPath: [n, ...o.mergeErrorPath]
|
|
2989
3024
|
};
|
|
2990
|
-
|
|
3025
|
+
r.push(o.data);
|
|
2991
3026
|
}
|
|
2992
|
-
return { valid: !0, data:
|
|
3027
|
+
return { valid: !0, data: r };
|
|
2993
3028
|
}
|
|
2994
3029
|
return { valid: !1, mergeErrorPath: [] };
|
|
2995
3030
|
}
|
|
2996
|
-
function Pe(t, e,
|
|
2997
|
-
if (e.issues.length && t.issues.push(...e.issues),
|
|
3031
|
+
function Pe(t, e, r) {
|
|
3032
|
+
if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), F(t))
|
|
2998
3033
|
return t;
|
|
2999
|
-
const
|
|
3000
|
-
if (!
|
|
3001
|
-
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(
|
|
3002
|
-
return t.value =
|
|
3034
|
+
const n = de(e.value, r.value);
|
|
3035
|
+
if (!n.valid)
|
|
3036
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);
|
|
3037
|
+
return t.value = n.data, t;
|
|
3003
3038
|
}
|
|
3004
|
-
const
|
|
3039
|
+
const Un = /* @__PURE__ */ u("$ZodEnum", (t, e) => {
|
|
3005
3040
|
k.init(t, e);
|
|
3006
|
-
const
|
|
3007
|
-
t._zod.values =
|
|
3041
|
+
const r = tt(e.entries), n = new Set(r);
|
|
3042
|
+
t._zod.values = n, t._zod.pattern = new RegExp(`^(${r.filter((i) => tr.has(typeof i)).map((i) => typeof i == "string" ? j(i) : i.toString()).join("|")})$`), t._zod.parse = (i, s) => {
|
|
3008
3043
|
const o = i.value;
|
|
3009
|
-
return
|
|
3044
|
+
return n.has(o) || i.issues.push({
|
|
3010
3045
|
code: "invalid_value",
|
|
3011
|
-
values:
|
|
3046
|
+
values: r,
|
|
3012
3047
|
input: o,
|
|
3013
3048
|
inst: t
|
|
3014
3049
|
}), i;
|
|
3015
3050
|
};
|
|
3016
|
-
}),
|
|
3051
|
+
}), Gn = /* @__PURE__ */ u("$ZodLiteral", (t, e) => {
|
|
3017
3052
|
if (k.init(t, e), e.values.length === 0)
|
|
3018
3053
|
throw new Error("Cannot create literal schema with no valid values");
|
|
3019
|
-
const
|
|
3020
|
-
t._zod.values =
|
|
3021
|
-
const s =
|
|
3022
|
-
return
|
|
3054
|
+
const r = new Set(e.values);
|
|
3055
|
+
t._zod.values = r, t._zod.pattern = new RegExp(`^(${e.values.map((n) => typeof n == "string" ? j(n) : n ? j(n.toString()) : String(n)).join("|")})$`), t._zod.parse = (n, i) => {
|
|
3056
|
+
const s = n.value;
|
|
3057
|
+
return r.has(s) || n.issues.push({
|
|
3023
3058
|
code: "invalid_value",
|
|
3024
3059
|
values: e.values,
|
|
3025
3060
|
input: s,
|
|
3026
3061
|
inst: t
|
|
3027
|
-
}),
|
|
3062
|
+
}), n;
|
|
3028
3063
|
};
|
|
3029
|
-
}),
|
|
3030
|
-
k.init(t, e), t._zod.parse = (
|
|
3031
|
-
if (
|
|
3064
|
+
}), Vn = /* @__PURE__ */ u("$ZodTransform", (t, e) => {
|
|
3065
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
3066
|
+
if (n.direction === "backward")
|
|
3032
3067
|
throw new He(t.constructor.name);
|
|
3033
|
-
const i = e.transform(
|
|
3034
|
-
if (
|
|
3035
|
-
return (i instanceof Promise ? i : Promise.resolve(i)).then((o) => (
|
|
3068
|
+
const i = e.transform(r.value, r);
|
|
3069
|
+
if (n.async)
|
|
3070
|
+
return (i instanceof Promise ? i : Promise.resolve(i)).then((o) => (r.value = o, r));
|
|
3036
3071
|
if (i instanceof Promise)
|
|
3037
|
-
throw new
|
|
3038
|
-
return
|
|
3072
|
+
throw new M();
|
|
3073
|
+
return r.value = i, r;
|
|
3039
3074
|
};
|
|
3040
3075
|
});
|
|
3041
3076
|
function Se(t, e) {
|
|
3042
3077
|
return t.issues.length && e === void 0 ? { issues: [], value: void 0 } : t;
|
|
3043
3078
|
}
|
|
3044
|
-
const
|
|
3079
|
+
const Bn = /* @__PURE__ */ u("$ZodOptional", (t, e) => {
|
|
3045
3080
|
k.init(t, e), t._zod.optin = "optional", t._zod.optout = "optional", m(t._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, void 0]) : void 0), m(t._zod, "pattern", () => {
|
|
3046
|
-
const
|
|
3047
|
-
return
|
|
3048
|
-
}), t._zod.parse = (
|
|
3081
|
+
const r = e.innerType._zod.pattern;
|
|
3082
|
+
return r ? new RegExp(`^(${ge(r.source)})?$`) : void 0;
|
|
3083
|
+
}), t._zod.parse = (r, n) => {
|
|
3049
3084
|
if (e.innerType._zod.optin === "optional") {
|
|
3050
|
-
const i = e.innerType._zod.run(
|
|
3051
|
-
return i instanceof Promise ? i.then((s) => Se(s,
|
|
3085
|
+
const i = e.innerType._zod.run(r, n);
|
|
3086
|
+
return i instanceof Promise ? i.then((s) => Se(s, r.value)) : Se(i, r.value);
|
|
3052
3087
|
}
|
|
3053
|
-
return
|
|
3088
|
+
return r.value === void 0 ? r : e.innerType._zod.run(r, n);
|
|
3054
3089
|
};
|
|
3055
|
-
}),
|
|
3090
|
+
}), Jn = /* @__PURE__ */ u("$ZodNullable", (t, e) => {
|
|
3056
3091
|
k.init(t, e), m(t._zod, "optin", () => e.innerType._zod.optin), m(t._zod, "optout", () => e.innerType._zod.optout), m(t._zod, "pattern", () => {
|
|
3057
|
-
const
|
|
3058
|
-
return
|
|
3059
|
-
}), m(t._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), t._zod.parse = (
|
|
3060
|
-
}),
|
|
3061
|
-
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (
|
|
3062
|
-
if (
|
|
3063
|
-
return e.innerType._zod.run(
|
|
3064
|
-
if (
|
|
3065
|
-
return
|
|
3066
|
-
const i = e.innerType._zod.run(
|
|
3092
|
+
const r = e.innerType._zod.pattern;
|
|
3093
|
+
return r ? new RegExp(`^(${ge(r.source)}|null)$`) : void 0;
|
|
3094
|
+
}), m(t._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), t._zod.parse = (r, n) => r.value === null ? r : e.innerType._zod.run(r, n);
|
|
3095
|
+
}), Wn = /* @__PURE__ */ u("$ZodDefault", (t, e) => {
|
|
3096
|
+
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (r, n) => {
|
|
3097
|
+
if (n.direction === "backward")
|
|
3098
|
+
return e.innerType._zod.run(r, n);
|
|
3099
|
+
if (r.value === void 0)
|
|
3100
|
+
return r.value = e.defaultValue, r;
|
|
3101
|
+
const i = e.innerType._zod.run(r, n);
|
|
3067
3102
|
return i instanceof Promise ? i.then((s) => Ne(s, e)) : Ne(i, e);
|
|
3068
3103
|
};
|
|
3069
3104
|
});
|
|
3070
3105
|
function Ne(t, e) {
|
|
3071
3106
|
return t.value === void 0 && (t.value = e.defaultValue), t;
|
|
3072
3107
|
}
|
|
3073
|
-
const
|
|
3074
|
-
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (
|
|
3075
|
-
}),
|
|
3108
|
+
const Kn = /* @__PURE__ */ u("$ZodPrefault", (t, e) => {
|
|
3109
|
+
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (r, n) => (n.direction === "backward" || r.value === void 0 && (r.value = e.defaultValue), e.innerType._zod.run(r, n));
|
|
3110
|
+
}), Yn = /* @__PURE__ */ u("$ZodNonOptional", (t, e) => {
|
|
3076
3111
|
k.init(t, e), m(t._zod, "values", () => {
|
|
3077
|
-
const
|
|
3078
|
-
return
|
|
3079
|
-
}), t._zod.parse = (
|
|
3080
|
-
const i = e.innerType._zod.run(
|
|
3112
|
+
const r = e.innerType._zod.values;
|
|
3113
|
+
return r ? new Set([...r].filter((n) => n !== void 0)) : void 0;
|
|
3114
|
+
}), t._zod.parse = (r, n) => {
|
|
3115
|
+
const i = e.innerType._zod.run(r, n);
|
|
3081
3116
|
return i instanceof Promise ? i.then((s) => Ae(s, t)) : Ae(i, t);
|
|
3082
3117
|
};
|
|
3083
3118
|
});
|
|
@@ -3089,70 +3124,70 @@ function Ae(t, e) {
|
|
|
3089
3124
|
inst: e
|
|
3090
3125
|
}), t;
|
|
3091
3126
|
}
|
|
3092
|
-
const
|
|
3093
|
-
k.init(t, e), m(t._zod, "optin", () => e.innerType._zod.optin), m(t._zod, "optout", () => e.innerType._zod.optout), m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (
|
|
3094
|
-
if (
|
|
3095
|
-
return e.innerType._zod.run(
|
|
3096
|
-
const i = e.innerType._zod.run(
|
|
3097
|
-
return i instanceof Promise ? i.then((s) => (
|
|
3098
|
-
...
|
|
3127
|
+
const qn = /* @__PURE__ */ u("$ZodCatch", (t, e) => {
|
|
3128
|
+
k.init(t, e), m(t._zod, "optin", () => e.innerType._zod.optin), m(t._zod, "optout", () => e.innerType._zod.optout), m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (r, n) => {
|
|
3129
|
+
if (n.direction === "backward")
|
|
3130
|
+
return e.innerType._zod.run(r, n);
|
|
3131
|
+
const i = e.innerType._zod.run(r, n);
|
|
3132
|
+
return i instanceof Promise ? i.then((s) => (r.value = s.value, s.issues.length && (r.value = e.catchValue({
|
|
3133
|
+
...r,
|
|
3099
3134
|
error: {
|
|
3100
|
-
issues: s.issues.map((o) => R(o,
|
|
3135
|
+
issues: s.issues.map((o) => R(o, n, C()))
|
|
3101
3136
|
},
|
|
3102
|
-
input:
|
|
3103
|
-
}),
|
|
3104
|
-
...
|
|
3137
|
+
input: r.value
|
|
3138
|
+
}), r.issues = []), r)) : (r.value = i.value, i.issues.length && (r.value = e.catchValue({
|
|
3139
|
+
...r,
|
|
3105
3140
|
error: {
|
|
3106
|
-
issues: i.issues.map((s) => R(s,
|
|
3141
|
+
issues: i.issues.map((s) => R(s, n, C()))
|
|
3107
3142
|
},
|
|
3108
|
-
input:
|
|
3109
|
-
}),
|
|
3143
|
+
input: r.value
|
|
3144
|
+
}), r.issues = []), r);
|
|
3110
3145
|
};
|
|
3111
|
-
}),
|
|
3112
|
-
k.init(t, e), m(t._zod, "values", () => e.in._zod.values), m(t._zod, "optin", () => e.in._zod.optin), m(t._zod, "optout", () => e.out._zod.optout), m(t._zod, "propValues", () => e.in._zod.propValues), t._zod.parse = (
|
|
3113
|
-
if (
|
|
3114
|
-
const s = e.out._zod.run(
|
|
3115
|
-
return s instanceof Promise ? s.then((o) => q(o, e.in,
|
|
3146
|
+
}), Xn = /* @__PURE__ */ u("$ZodPipe", (t, e) => {
|
|
3147
|
+
k.init(t, e), m(t._zod, "values", () => e.in._zod.values), m(t._zod, "optin", () => e.in._zod.optin), m(t._zod, "optout", () => e.out._zod.optout), m(t._zod, "propValues", () => e.in._zod.propValues), t._zod.parse = (r, n) => {
|
|
3148
|
+
if (n.direction === "backward") {
|
|
3149
|
+
const s = e.out._zod.run(r, n);
|
|
3150
|
+
return s instanceof Promise ? s.then((o) => q(o, e.in, n)) : q(s, e.in, n);
|
|
3116
3151
|
}
|
|
3117
|
-
const i = e.in._zod.run(
|
|
3118
|
-
return i instanceof Promise ? i.then((s) => q(s, e.out,
|
|
3152
|
+
const i = e.in._zod.run(r, n);
|
|
3153
|
+
return i instanceof Promise ? i.then((s) => q(s, e.out, n)) : q(i, e.out, n);
|
|
3119
3154
|
};
|
|
3120
3155
|
});
|
|
3121
|
-
function q(t, e,
|
|
3122
|
-
return t.issues.length ? (t.aborted = !0, t) : e._zod.run({ value: t.value, issues: t.issues },
|
|
3123
|
-
}
|
|
3124
|
-
const
|
|
3125
|
-
k.init(t, e), m(t._zod, "propValues", () => e.innerType._zod.propValues), m(t._zod, "values", () => e.innerType._zod.values), m(t._zod, "optin", () => e.innerType?._zod?.optin), m(t._zod, "optout", () => e.innerType?._zod?.optout), t._zod.parse = (
|
|
3126
|
-
if (
|
|
3127
|
-
return e.innerType._zod.run(
|
|
3128
|
-
const i = e.innerType._zod.run(
|
|
3156
|
+
function q(t, e, r) {
|
|
3157
|
+
return t.issues.length ? (t.aborted = !0, t) : e._zod.run({ value: t.value, issues: t.issues }, r);
|
|
3158
|
+
}
|
|
3159
|
+
const Qn = /* @__PURE__ */ u("$ZodReadonly", (t, e) => {
|
|
3160
|
+
k.init(t, e), m(t._zod, "propValues", () => e.innerType._zod.propValues), m(t._zod, "values", () => e.innerType._zod.values), m(t._zod, "optin", () => e.innerType?._zod?.optin), m(t._zod, "optout", () => e.innerType?._zod?.optout), t._zod.parse = (r, n) => {
|
|
3161
|
+
if (n.direction === "backward")
|
|
3162
|
+
return e.innerType._zod.run(r, n);
|
|
3163
|
+
const i = e.innerType._zod.run(r, n);
|
|
3129
3164
|
return i instanceof Promise ? i.then(Ze) : Ze(i);
|
|
3130
3165
|
};
|
|
3131
3166
|
});
|
|
3132
3167
|
function Ze(t) {
|
|
3133
3168
|
return t.value = Object.freeze(t.value), t;
|
|
3134
3169
|
}
|
|
3135
|
-
const
|
|
3136
|
-
|
|
3137
|
-
const
|
|
3170
|
+
const Hn = /* @__PURE__ */ u("$ZodCustom", (t, e) => {
|
|
3171
|
+
w.init(t, e), k.init(t, e), t._zod.parse = (r, n) => r, t._zod.check = (r) => {
|
|
3172
|
+
const n = r.value, i = e.fn(n);
|
|
3138
3173
|
if (i instanceof Promise)
|
|
3139
|
-
return i.then((s) => Ce(s,
|
|
3140
|
-
Ce(i,
|
|
3174
|
+
return i.then((s) => Ce(s, r, n, t));
|
|
3175
|
+
Ce(i, r, n, t);
|
|
3141
3176
|
};
|
|
3142
3177
|
});
|
|
3143
|
-
function Ce(t, e,
|
|
3178
|
+
function Ce(t, e, r, n) {
|
|
3144
3179
|
if (!t) {
|
|
3145
3180
|
const i = {
|
|
3146
3181
|
code: "custom",
|
|
3147
|
-
input:
|
|
3148
|
-
inst:
|
|
3182
|
+
input: r,
|
|
3183
|
+
inst: n,
|
|
3149
3184
|
// incorporates params.error into issue reporting
|
|
3150
|
-
path: [...
|
|
3185
|
+
path: [...n._zod.def.path ?? []],
|
|
3151
3186
|
// incorporates params.error into issue reporting
|
|
3152
|
-
continue: !
|
|
3187
|
+
continue: !n._zod.def.abort
|
|
3153
3188
|
// params: inst._zod.def.params,
|
|
3154
3189
|
};
|
|
3155
|
-
|
|
3190
|
+
n._zod.def.params && (i.params = n._zod.def.params), e.issues.push(W(i));
|
|
3156
3191
|
}
|
|
3157
3192
|
}
|
|
3158
3193
|
var Re;
|
|
@@ -3160,12 +3195,12 @@ class ei {
|
|
|
3160
3195
|
constructor() {
|
|
3161
3196
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
3162
3197
|
}
|
|
3163
|
-
add(e, ...
|
|
3164
|
-
const
|
|
3165
|
-
if (this._map.set(e,
|
|
3166
|
-
if (this._idmap.has(
|
|
3167
|
-
throw new Error(`ID ${
|
|
3168
|
-
this._idmap.set(
|
|
3198
|
+
add(e, ...r) {
|
|
3199
|
+
const n = r[0];
|
|
3200
|
+
if (this._map.set(e, n), n && typeof n == "object" && "id" in n) {
|
|
3201
|
+
if (this._idmap.has(n.id))
|
|
3202
|
+
throw new Error(`ID ${n.id} already exists in the registry`);
|
|
3203
|
+
this._idmap.set(n.id, e);
|
|
3169
3204
|
}
|
|
3170
3205
|
return this;
|
|
3171
3206
|
}
|
|
@@ -3173,15 +3208,15 @@ class ei {
|
|
|
3173
3208
|
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
3174
3209
|
}
|
|
3175
3210
|
remove(e) {
|
|
3176
|
-
const
|
|
3177
|
-
return
|
|
3211
|
+
const r = this._map.get(e);
|
|
3212
|
+
return r && typeof r == "object" && "id" in r && this._idmap.delete(r.id), this._map.delete(e), this;
|
|
3178
3213
|
}
|
|
3179
3214
|
get(e) {
|
|
3180
|
-
const
|
|
3181
|
-
if (
|
|
3182
|
-
const
|
|
3183
|
-
delete
|
|
3184
|
-
const i = { ...
|
|
3215
|
+
const r = e._zod.parent;
|
|
3216
|
+
if (r) {
|
|
3217
|
+
const n = { ...this.get(r) ?? {} };
|
|
3218
|
+
delete n.id;
|
|
3219
|
+
const i = { ...n, ...this._map.get(e) };
|
|
3185
3220
|
return Object.keys(i).length ? i : void 0;
|
|
3186
3221
|
}
|
|
3187
3222
|
return this._map.get(e);
|
|
@@ -3195,13 +3230,13 @@ function ti() {
|
|
|
3195
3230
|
}
|
|
3196
3231
|
(Re = globalThis).__zod_globalRegistry ?? (Re.__zod_globalRegistry = ti());
|
|
3197
3232
|
const V = globalThis.__zod_globalRegistry;
|
|
3198
|
-
function
|
|
3233
|
+
function ri(t, e) {
|
|
3199
3234
|
return new t({
|
|
3200
3235
|
type: "string",
|
|
3201
3236
|
...l(e)
|
|
3202
3237
|
});
|
|
3203
3238
|
}
|
|
3204
|
-
function
|
|
3239
|
+
function ni(t, e) {
|
|
3205
3240
|
return new t({
|
|
3206
3241
|
type: "string",
|
|
3207
3242
|
format: "email",
|
|
@@ -3210,7 +3245,7 @@ function ri(t, e) {
|
|
|
3210
3245
|
...l(e)
|
|
3211
3246
|
});
|
|
3212
3247
|
}
|
|
3213
|
-
function
|
|
3248
|
+
function xe(t, e) {
|
|
3214
3249
|
return new t({
|
|
3215
3250
|
type: "string",
|
|
3216
3251
|
format: "guid",
|
|
@@ -3276,7 +3311,7 @@ function ui(t, e) {
|
|
|
3276
3311
|
...l(e)
|
|
3277
3312
|
});
|
|
3278
3313
|
}
|
|
3279
|
-
function
|
|
3314
|
+
function pi(t, e) {
|
|
3280
3315
|
return new t({
|
|
3281
3316
|
type: "string",
|
|
3282
3317
|
format: "nanoid",
|
|
@@ -3285,7 +3320,7 @@ function hi(t, e) {
|
|
|
3285
3320
|
...l(e)
|
|
3286
3321
|
});
|
|
3287
3322
|
}
|
|
3288
|
-
function
|
|
3323
|
+
function hi(t, e) {
|
|
3289
3324
|
return new t({
|
|
3290
3325
|
type: "string",
|
|
3291
3326
|
format: "cuid",
|
|
@@ -3384,7 +3419,7 @@ function Ti(t, e) {
|
|
|
3384
3419
|
...l(e)
|
|
3385
3420
|
});
|
|
3386
3421
|
}
|
|
3387
|
-
function
|
|
3422
|
+
function bi(t, e) {
|
|
3388
3423
|
return new t({
|
|
3389
3424
|
type: "string",
|
|
3390
3425
|
format: "e164",
|
|
@@ -3393,7 +3428,7 @@ function wi(t, e) {
|
|
|
3393
3428
|
...l(e)
|
|
3394
3429
|
});
|
|
3395
3430
|
}
|
|
3396
|
-
function
|
|
3431
|
+
function wi(t, e) {
|
|
3397
3432
|
return new t({
|
|
3398
3433
|
type: "string",
|
|
3399
3434
|
format: "jwt",
|
|
@@ -3402,7 +3437,7 @@ function bi(t, e) {
|
|
|
3402
3437
|
...l(e)
|
|
3403
3438
|
});
|
|
3404
3439
|
}
|
|
3405
|
-
function
|
|
3440
|
+
function Ii(t, e) {
|
|
3406
3441
|
return new t({
|
|
3407
3442
|
type: "string",
|
|
3408
3443
|
format: "datetime",
|
|
@@ -3413,7 +3448,7 @@ function Ei(t, e) {
|
|
|
3413
3448
|
...l(e)
|
|
3414
3449
|
});
|
|
3415
3450
|
}
|
|
3416
|
-
function
|
|
3451
|
+
function Ei(t, e) {
|
|
3417
3452
|
return new t({
|
|
3418
3453
|
type: "string",
|
|
3419
3454
|
format: "date",
|
|
@@ -3465,7 +3500,7 @@ function Ni(t, e) {
|
|
|
3465
3500
|
...l(e)
|
|
3466
3501
|
});
|
|
3467
3502
|
}
|
|
3468
|
-
function
|
|
3503
|
+
function Le(t, e) {
|
|
3469
3504
|
return new lt({
|
|
3470
3505
|
check: "less_than",
|
|
3471
3506
|
...l(e),
|
|
@@ -3473,7 +3508,7 @@ function xe(t, e) {
|
|
|
3473
3508
|
inclusive: !1
|
|
3474
3509
|
});
|
|
3475
3510
|
}
|
|
3476
|
-
function
|
|
3511
|
+
function pe(t, e) {
|
|
3477
3512
|
return new lt({
|
|
3478
3513
|
check: "less_than",
|
|
3479
3514
|
...l(e),
|
|
@@ -3489,7 +3524,7 @@ function De(t, e) {
|
|
|
3489
3524
|
inclusive: !1
|
|
3490
3525
|
});
|
|
3491
3526
|
}
|
|
3492
|
-
function
|
|
3527
|
+
function he(t, e) {
|
|
3493
3528
|
return new dt({
|
|
3494
3529
|
check: "greater_than",
|
|
3495
3530
|
...l(e),
|
|
@@ -3498,35 +3533,35 @@ function pe(t, e) {
|
|
|
3498
3533
|
});
|
|
3499
3534
|
}
|
|
3500
3535
|
function Fe(t, e) {
|
|
3501
|
-
return new
|
|
3536
|
+
return new Kr({
|
|
3502
3537
|
check: "multiple_of",
|
|
3503
3538
|
...l(e),
|
|
3504
3539
|
value: t
|
|
3505
3540
|
});
|
|
3506
3541
|
}
|
|
3507
3542
|
function kt(t, e) {
|
|
3508
|
-
return new
|
|
3543
|
+
return new qr({
|
|
3509
3544
|
check: "max_length",
|
|
3510
3545
|
...l(e),
|
|
3511
3546
|
maximum: t
|
|
3512
3547
|
});
|
|
3513
3548
|
}
|
|
3514
3549
|
function ee(t, e) {
|
|
3515
|
-
return new
|
|
3550
|
+
return new Xr({
|
|
3516
3551
|
check: "min_length",
|
|
3517
3552
|
...l(e),
|
|
3518
3553
|
minimum: t
|
|
3519
3554
|
});
|
|
3520
3555
|
}
|
|
3521
3556
|
function yt(t, e) {
|
|
3522
|
-
return new
|
|
3557
|
+
return new Qr({
|
|
3523
3558
|
check: "length_equals",
|
|
3524
3559
|
...l(e),
|
|
3525
3560
|
length: t
|
|
3526
3561
|
});
|
|
3527
3562
|
}
|
|
3528
3563
|
function Ai(t, e) {
|
|
3529
|
-
return new
|
|
3564
|
+
return new Hr({
|
|
3530
3565
|
check: "string_format",
|
|
3531
3566
|
format: "regex",
|
|
3532
3567
|
...l(e),
|
|
@@ -3534,37 +3569,37 @@ function Ai(t, e) {
|
|
|
3534
3569
|
});
|
|
3535
3570
|
}
|
|
3536
3571
|
function Zi(t) {
|
|
3537
|
-
return new
|
|
3572
|
+
return new en({
|
|
3538
3573
|
check: "string_format",
|
|
3539
3574
|
format: "lowercase",
|
|
3540
3575
|
...l(t)
|
|
3541
3576
|
});
|
|
3542
3577
|
}
|
|
3543
3578
|
function Ci(t) {
|
|
3544
|
-
return new
|
|
3579
|
+
return new tn({
|
|
3545
3580
|
check: "string_format",
|
|
3546
3581
|
format: "uppercase",
|
|
3547
3582
|
...l(t)
|
|
3548
3583
|
});
|
|
3549
3584
|
}
|
|
3550
3585
|
function Ri(t, e) {
|
|
3551
|
-
return new
|
|
3586
|
+
return new rn({
|
|
3552
3587
|
check: "string_format",
|
|
3553
3588
|
format: "includes",
|
|
3554
3589
|
...l(e),
|
|
3555
3590
|
includes: t
|
|
3556
3591
|
});
|
|
3557
3592
|
}
|
|
3558
|
-
function
|
|
3559
|
-
return new
|
|
3593
|
+
function xi(t, e) {
|
|
3594
|
+
return new nn({
|
|
3560
3595
|
check: "string_format",
|
|
3561
3596
|
format: "starts_with",
|
|
3562
3597
|
...l(e),
|
|
3563
3598
|
prefix: t
|
|
3564
3599
|
});
|
|
3565
3600
|
}
|
|
3566
|
-
function
|
|
3567
|
-
return new
|
|
3601
|
+
function Li(t, e) {
|
|
3602
|
+
return new sn({
|
|
3568
3603
|
check: "string_format",
|
|
3569
3604
|
format: "ends_with",
|
|
3570
3605
|
...l(e),
|
|
@@ -3572,7 +3607,7 @@ function xi(t, e) {
|
|
|
3572
3607
|
});
|
|
3573
3608
|
}
|
|
3574
3609
|
function U(t) {
|
|
3575
|
-
return new
|
|
3610
|
+
return new on({
|
|
3576
3611
|
check: "overwrite",
|
|
3577
3612
|
tx: t
|
|
3578
3613
|
});
|
|
@@ -3583,50 +3618,50 @@ function Di(t) {
|
|
|
3583
3618
|
function Fi() {
|
|
3584
3619
|
return U((t) => t.trim());
|
|
3585
3620
|
}
|
|
3586
|
-
function
|
|
3621
|
+
function Mi() {
|
|
3587
3622
|
return U((t) => t.toLowerCase());
|
|
3588
3623
|
}
|
|
3589
|
-
function
|
|
3624
|
+
function ji() {
|
|
3590
3625
|
return U((t) => t.toUpperCase());
|
|
3591
3626
|
}
|
|
3592
3627
|
function Ui() {
|
|
3593
3628
|
return U((t) => Ht(t));
|
|
3594
3629
|
}
|
|
3595
|
-
function Gi(t, e,
|
|
3630
|
+
function Gi(t, e, r) {
|
|
3596
3631
|
return new t({
|
|
3597
3632
|
type: "array",
|
|
3598
3633
|
element: e,
|
|
3599
3634
|
// get element() {
|
|
3600
3635
|
// return element;
|
|
3601
3636
|
// },
|
|
3602
|
-
...l(
|
|
3637
|
+
...l(r)
|
|
3603
3638
|
});
|
|
3604
3639
|
}
|
|
3605
|
-
function Vi(t, e,
|
|
3640
|
+
function Vi(t, e, r) {
|
|
3606
3641
|
return new t({
|
|
3607
3642
|
type: "custom",
|
|
3608
3643
|
check: "custom",
|
|
3609
3644
|
fn: e,
|
|
3610
|
-
...l(
|
|
3645
|
+
...l(r)
|
|
3611
3646
|
});
|
|
3612
3647
|
}
|
|
3613
3648
|
function Bi(t) {
|
|
3614
|
-
const e = Ji((
|
|
3615
|
-
if (typeof
|
|
3616
|
-
|
|
3649
|
+
const e = Ji((r) => (r.addIssue = (n) => {
|
|
3650
|
+
if (typeof n == "string")
|
|
3651
|
+
r.issues.push(W(n, r.value, e._zod.def));
|
|
3617
3652
|
else {
|
|
3618
|
-
const i =
|
|
3619
|
-
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input =
|
|
3653
|
+
const i = n;
|
|
3654
|
+
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = r.value), i.inst ?? (i.inst = e), i.continue ?? (i.continue = !e._zod.def.abort), r.issues.push(W(i));
|
|
3620
3655
|
}
|
|
3621
|
-
}, t(
|
|
3656
|
+
}, t(r.value, r)));
|
|
3622
3657
|
return e;
|
|
3623
3658
|
}
|
|
3624
3659
|
function Ji(t, e) {
|
|
3625
|
-
const
|
|
3660
|
+
const r = new w({
|
|
3626
3661
|
check: "custom",
|
|
3627
3662
|
...l(e)
|
|
3628
3663
|
});
|
|
3629
|
-
return
|
|
3664
|
+
return r._zod.check = t, r;
|
|
3630
3665
|
}
|
|
3631
3666
|
function Tt(t) {
|
|
3632
3667
|
let e = t?.target ?? "draft-2020-12";
|
|
@@ -3645,62 +3680,62 @@ function Tt(t) {
|
|
|
3645
3680
|
external: t?.external ?? void 0
|
|
3646
3681
|
};
|
|
3647
3682
|
}
|
|
3648
|
-
function T(t, e,
|
|
3649
|
-
var
|
|
3683
|
+
function T(t, e, r = { path: [], schemaPath: [] }) {
|
|
3684
|
+
var n;
|
|
3650
3685
|
const i = t._zod.def, s = e.seen.get(t);
|
|
3651
3686
|
if (s)
|
|
3652
|
-
return s.count++,
|
|
3653
|
-
const o = { schema: {}, count: 1, cycle: void 0, path:
|
|
3687
|
+
return s.count++, r.schemaPath.includes(t) && (s.cycle = r.path), s.schema;
|
|
3688
|
+
const o = { schema: {}, count: 1, cycle: void 0, path: r.path };
|
|
3654
3689
|
e.seen.set(t, o);
|
|
3655
3690
|
const a = t._zod.toJSONSchema?.();
|
|
3656
3691
|
if (a)
|
|
3657
3692
|
o.schema = a;
|
|
3658
3693
|
else {
|
|
3659
|
-
const
|
|
3660
|
-
...
|
|
3661
|
-
schemaPath: [...
|
|
3662
|
-
path:
|
|
3694
|
+
const h = {
|
|
3695
|
+
...r,
|
|
3696
|
+
schemaPath: [...r.schemaPath, t],
|
|
3697
|
+
path: r.path
|
|
3663
3698
|
}, d = t._zod.parent;
|
|
3664
3699
|
if (d)
|
|
3665
|
-
o.ref = d, T(d, e,
|
|
3700
|
+
o.ref = d, T(d, e, h), e.seen.get(d).isParent = !0;
|
|
3666
3701
|
else if (t._zod.processJSONSchema)
|
|
3667
|
-
t._zod.processJSONSchema(e, o.schema,
|
|
3702
|
+
t._zod.processJSONSchema(e, o.schema, h);
|
|
3668
3703
|
else {
|
|
3669
|
-
const f = o.schema,
|
|
3670
|
-
if (!
|
|
3704
|
+
const f = o.schema, g = e.processors[i.type];
|
|
3705
|
+
if (!g)
|
|
3671
3706
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
|
|
3672
|
-
|
|
3707
|
+
g(t, e, f, h);
|
|
3673
3708
|
}
|
|
3674
3709
|
}
|
|
3675
3710
|
const c = e.metadataRegistry.get(t);
|
|
3676
|
-
return c && Object.assign(o.schema, c), e.io === "input" &&
|
|
3711
|
+
return c && Object.assign(o.schema, c), e.io === "input" && b(t) && (delete o.schema.examples, delete o.schema.default), e.io === "input" && o.schema._prefault && ((n = o.schema).default ?? (n.default = o.schema._prefault)), delete o.schema._prefault, e.seen.get(t).schema;
|
|
3677
3712
|
}
|
|
3678
|
-
function
|
|
3679
|
-
const
|
|
3680
|
-
if (!
|
|
3713
|
+
function bt(t, e) {
|
|
3714
|
+
const r = t.seen.get(e);
|
|
3715
|
+
if (!r)
|
|
3681
3716
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3682
|
-
const
|
|
3717
|
+
const n = (s) => {
|
|
3683
3718
|
const o = t.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
3684
3719
|
if (t.external) {
|
|
3685
|
-
const
|
|
3686
|
-
if (
|
|
3687
|
-
return { ref: d(
|
|
3720
|
+
const h = t.external.registry.get(s[0])?.id, d = t.external.uri ?? ((g) => g);
|
|
3721
|
+
if (h)
|
|
3722
|
+
return { ref: d(h) };
|
|
3688
3723
|
const f = s[1].defId ?? s[1].schema.id ?? `schema${t.counter++}`;
|
|
3689
3724
|
return s[1].defId = f, { defId: f, ref: `${d("__shared")}#/${o}/${f}` };
|
|
3690
3725
|
}
|
|
3691
|
-
if (s[1] ===
|
|
3726
|
+
if (s[1] === r)
|
|
3692
3727
|
return { ref: "#" };
|
|
3693
|
-
const c = `#/${o}/`,
|
|
3694
|
-
return { defId:
|
|
3728
|
+
const c = `#/${o}/`, p = s[1].schema.id ?? `__schema${t.counter++}`;
|
|
3729
|
+
return { defId: p, ref: c + p };
|
|
3695
3730
|
}, i = (s) => {
|
|
3696
3731
|
if (s[1].schema.$ref)
|
|
3697
3732
|
return;
|
|
3698
|
-
const o = s[1], { ref: a, defId: c } =
|
|
3733
|
+
const o = s[1], { ref: a, defId: c } = n(s);
|
|
3699
3734
|
o.def = { ...o.schema }, c && (o.defId = c);
|
|
3700
|
-
const
|
|
3701
|
-
for (const
|
|
3702
|
-
delete h
|
|
3703
|
-
|
|
3735
|
+
const p = o.schema;
|
|
3736
|
+
for (const h in p)
|
|
3737
|
+
delete p[h];
|
|
3738
|
+
p.$ref = a;
|
|
3704
3739
|
};
|
|
3705
3740
|
if (t.cycles === "throw")
|
|
3706
3741
|
for (const s of t.seen.entries()) {
|
|
@@ -3737,19 +3772,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3737
3772
|
}
|
|
3738
3773
|
}
|
|
3739
3774
|
}
|
|
3740
|
-
function
|
|
3741
|
-
const
|
|
3742
|
-
if (!
|
|
3775
|
+
function wt(t, e) {
|
|
3776
|
+
const r = t.seen.get(e);
|
|
3777
|
+
if (!r)
|
|
3743
3778
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3744
|
-
const
|
|
3745
|
-
const a = t.seen.get(o), c = a.def ?? a.schema,
|
|
3779
|
+
const n = (o) => {
|
|
3780
|
+
const a = t.seen.get(o), c = a.def ?? a.schema, p = { ...c };
|
|
3746
3781
|
if (a.ref === null)
|
|
3747
3782
|
return;
|
|
3748
|
-
const
|
|
3749
|
-
if (a.ref = null,
|
|
3750
|
-
|
|
3751
|
-
const d = t.seen.get(
|
|
3752
|
-
d.$ref && (t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(d)) : (Object.assign(c, d), Object.assign(c,
|
|
3783
|
+
const h = a.ref;
|
|
3784
|
+
if (a.ref = null, h) {
|
|
3785
|
+
n(h);
|
|
3786
|
+
const d = t.seen.get(h).schema;
|
|
3787
|
+
d.$ref && (t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0") ? (c.allOf = c.allOf ?? [], c.allOf.push(d)) : (Object.assign(c, d), Object.assign(c, p));
|
|
3753
3788
|
}
|
|
3754
3789
|
a.isParent || t.override({
|
|
3755
3790
|
zodSchema: o,
|
|
@@ -3758,7 +3793,7 @@ function bt(t, e) {
|
|
|
3758
3793
|
});
|
|
3759
3794
|
};
|
|
3760
3795
|
for (const o of [...t.seen.entries()].reverse())
|
|
3761
|
-
|
|
3796
|
+
n(o[0]);
|
|
3762
3797
|
const i = {};
|
|
3763
3798
|
if (t.target === "draft-2020-12" ? i.$schema = "https://json-schema.org/draft/2020-12/schema" : t.target === "draft-07" ? i.$schema = "http://json-schema.org/draft-07/schema#" : t.target === "draft-04" ? i.$schema = "http://json-schema.org/draft-04/schema#" : t.target, t.external?.uri) {
|
|
3764
3799
|
const o = t.external.registry.get(e)?.id;
|
|
@@ -3766,7 +3801,7 @@ function bt(t, e) {
|
|
|
3766
3801
|
throw new Error("Schema is missing an `id` property");
|
|
3767
3802
|
i.$id = t.external.uri(o);
|
|
3768
3803
|
}
|
|
3769
|
-
Object.assign(i,
|
|
3804
|
+
Object.assign(i, r.def ?? r.schema);
|
|
3770
3805
|
const s = t.external?.defs ?? {};
|
|
3771
3806
|
for (const o of t.seen.entries()) {
|
|
3772
3807
|
const a = o[1];
|
|
@@ -3790,54 +3825,54 @@ function bt(t, e) {
|
|
|
3790
3825
|
throw new Error("Error converting schema to JSON.");
|
|
3791
3826
|
}
|
|
3792
3827
|
}
|
|
3793
|
-
function
|
|
3794
|
-
const
|
|
3795
|
-
if (
|
|
3828
|
+
function b(t, e) {
|
|
3829
|
+
const r = e ?? { seen: /* @__PURE__ */ new Set() };
|
|
3830
|
+
if (r.seen.has(t))
|
|
3796
3831
|
return !1;
|
|
3797
|
-
|
|
3798
|
-
const
|
|
3799
|
-
if (
|
|
3832
|
+
r.seen.add(t);
|
|
3833
|
+
const n = t._zod.def;
|
|
3834
|
+
if (n.type === "transform")
|
|
3800
3835
|
return !0;
|
|
3801
|
-
if (
|
|
3802
|
-
return
|
|
3803
|
-
if (
|
|
3804
|
-
return
|
|
3805
|
-
if (
|
|
3806
|
-
return
|
|
3807
|
-
if (
|
|
3808
|
-
return
|
|
3809
|
-
if (
|
|
3810
|
-
return
|
|
3811
|
-
if (
|
|
3812
|
-
return
|
|
3813
|
-
if (
|
|
3814
|
-
return
|
|
3815
|
-
if (
|
|
3816
|
-
for (const i in
|
|
3817
|
-
if (
|
|
3836
|
+
if (n.type === "array")
|
|
3837
|
+
return b(n.element, r);
|
|
3838
|
+
if (n.type === "set")
|
|
3839
|
+
return b(n.valueType, r);
|
|
3840
|
+
if (n.type === "lazy")
|
|
3841
|
+
return b(n.getter(), r);
|
|
3842
|
+
if (n.type === "promise" || n.type === "optional" || n.type === "nonoptional" || n.type === "nullable" || n.type === "readonly" || n.type === "default" || n.type === "prefault")
|
|
3843
|
+
return b(n.innerType, r);
|
|
3844
|
+
if (n.type === "intersection")
|
|
3845
|
+
return b(n.left, r) || b(n.right, r);
|
|
3846
|
+
if (n.type === "record" || n.type === "map")
|
|
3847
|
+
return b(n.keyType, r) || b(n.valueType, r);
|
|
3848
|
+
if (n.type === "pipe")
|
|
3849
|
+
return b(n.in, r) || b(n.out, r);
|
|
3850
|
+
if (n.type === "object") {
|
|
3851
|
+
for (const i in n.shape)
|
|
3852
|
+
if (b(n.shape[i], r))
|
|
3818
3853
|
return !0;
|
|
3819
3854
|
return !1;
|
|
3820
3855
|
}
|
|
3821
|
-
if (
|
|
3822
|
-
for (const i of
|
|
3823
|
-
if (
|
|
3856
|
+
if (n.type === "union") {
|
|
3857
|
+
for (const i of n.options)
|
|
3858
|
+
if (b(i, r))
|
|
3824
3859
|
return !0;
|
|
3825
3860
|
return !1;
|
|
3826
3861
|
}
|
|
3827
|
-
if (
|
|
3828
|
-
for (const i of
|
|
3829
|
-
if (
|
|
3862
|
+
if (n.type === "tuple") {
|
|
3863
|
+
for (const i of n.items)
|
|
3864
|
+
if (b(i, r))
|
|
3830
3865
|
return !0;
|
|
3831
|
-
return !!(
|
|
3866
|
+
return !!(n.rest && b(n.rest, r));
|
|
3832
3867
|
}
|
|
3833
3868
|
return !1;
|
|
3834
3869
|
}
|
|
3835
|
-
const Wi = (t, e = {}) => (
|
|
3836
|
-
const
|
|
3837
|
-
return T(t,
|
|
3838
|
-
}, te = (t, e) => (
|
|
3839
|
-
const { libraryOptions:
|
|
3840
|
-
return T(t, s),
|
|
3870
|
+
const Wi = (t, e = {}) => (r) => {
|
|
3871
|
+
const n = Tt({ ...r, processors: e });
|
|
3872
|
+
return T(t, n), bt(n, t), wt(n, t);
|
|
3873
|
+
}, te = (t, e) => (r) => {
|
|
3874
|
+
const { libraryOptions: n, target: i } = r ?? {}, s = Tt({ ...n ?? {}, target: i, io: e, processors: {} });
|
|
3875
|
+
return T(t, s), bt(s, t), wt(s, t);
|
|
3841
3876
|
}, Ki = {
|
|
3842
3877
|
guid: "uuid",
|
|
3843
3878
|
url: "uri",
|
|
@@ -3845,29 +3880,29 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3845
3880
|
json_string: "json-string",
|
|
3846
3881
|
regex: ""
|
|
3847
3882
|
// do not set
|
|
3848
|
-
}, Yi = (t, e,
|
|
3849
|
-
const i =
|
|
3883
|
+
}, Yi = (t, e, r, n) => {
|
|
3884
|
+
const i = r;
|
|
3850
3885
|
i.type = "string";
|
|
3851
|
-
const { minimum: s, maximum: o, format: a, patterns: c, contentEncoding:
|
|
3852
|
-
if (typeof s == "number" && (i.minLength = s), typeof o == "number" && (i.maxLength = o), a && (i.format = Ki[a] ?? a, i.format === "" && delete i.format),
|
|
3853
|
-
const
|
|
3854
|
-
|
|
3855
|
-
...
|
|
3886
|
+
const { minimum: s, maximum: o, format: a, patterns: c, contentEncoding: p } = t._zod.bag;
|
|
3887
|
+
if (typeof s == "number" && (i.minLength = s), typeof o == "number" && (i.maxLength = o), a && (i.format = Ki[a] ?? a, i.format === "" && delete i.format), p && (i.contentEncoding = p), c && c.size > 0) {
|
|
3888
|
+
const h = [...c];
|
|
3889
|
+
h.length === 1 ? i.pattern = h[0].source : h.length > 1 && (i.allOf = [
|
|
3890
|
+
...h.map((d) => ({
|
|
3856
3891
|
...e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3857
3892
|
pattern: d.source
|
|
3858
3893
|
}))
|
|
3859
3894
|
]);
|
|
3860
3895
|
}
|
|
3861
|
-
}, qi = (t, e,
|
|
3862
|
-
const i =
|
|
3863
|
-
typeof a == "string" && a.includes("int") ? i.type = "integer" : i.type = "number", typeof
|
|
3864
|
-
}, Xi = (t, e,
|
|
3865
|
-
|
|
3866
|
-
}, Qi = (t, e,
|
|
3867
|
-
}, Hi = (t, e,
|
|
3896
|
+
}, qi = (t, e, r, n) => {
|
|
3897
|
+
const i = r, { minimum: s, maximum: o, format: a, multipleOf: c, exclusiveMaximum: p, exclusiveMinimum: h } = t._zod.bag;
|
|
3898
|
+
typeof a == "string" && a.includes("int") ? i.type = "integer" : i.type = "number", typeof h == "number" && (e.target === "draft-04" || e.target === "openapi-3.0" ? (i.minimum = h, i.exclusiveMinimum = !0) : i.exclusiveMinimum = h), typeof s == "number" && (i.minimum = s, typeof h == "number" && e.target !== "draft-04" && (h >= s ? delete i.minimum : delete i.exclusiveMinimum)), typeof p == "number" && (e.target === "draft-04" || e.target === "openapi-3.0" ? (i.maximum = p, i.exclusiveMaximum = !0) : i.exclusiveMaximum = p), typeof o == "number" && (i.maximum = o, typeof p == "number" && e.target !== "draft-04" && (p <= o ? delete i.maximum : delete i.exclusiveMaximum)), typeof c == "number" && (i.multipleOf = c);
|
|
3899
|
+
}, Xi = (t, e, r, n) => {
|
|
3900
|
+
r.not = {};
|
|
3901
|
+
}, Qi = (t, e, r, n) => {
|
|
3902
|
+
}, Hi = (t, e, r, n) => {
|
|
3868
3903
|
const i = t._zod.def, s = tt(i.entries);
|
|
3869
|
-
s.every((o) => typeof o == "number") && (
|
|
3870
|
-
}, es = (t, e,
|
|
3904
|
+
s.every((o) => typeof o == "number") && (r.type = "number"), s.every((o) => typeof o == "string") && (r.type = "string"), r.enum = s;
|
|
3905
|
+
}, es = (t, e, r, n) => {
|
|
3871
3906
|
const i = t._zod.def, s = [];
|
|
3872
3907
|
for (const o of i.values)
|
|
3873
3908
|
if (o === void 0) {
|
|
@@ -3881,74 +3916,74 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3881
3916
|
s.push(o);
|
|
3882
3917
|
if (s.length !== 0) if (s.length === 1) {
|
|
3883
3918
|
const o = s[0];
|
|
3884
|
-
|
|
3919
|
+
r.type = o === null ? "null" : typeof o, e.target === "draft-04" || e.target === "openapi-3.0" ? r.enum = [o] : r.const = o;
|
|
3885
3920
|
} else
|
|
3886
|
-
s.every((o) => typeof o == "number") && (
|
|
3887
|
-
}, ts = (t, e,
|
|
3921
|
+
s.every((o) => typeof o == "number") && (r.type = "number"), s.every((o) => typeof o == "string") && (r.type = "string"), s.every((o) => typeof o == "boolean") && (r.type = "boolean"), s.every((o) => o === null) && (r.type = "null"), r.enum = s;
|
|
3922
|
+
}, ts = (t, e, r, n) => {
|
|
3888
3923
|
if (e.unrepresentable === "throw")
|
|
3889
3924
|
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3890
|
-
},
|
|
3925
|
+
}, rs = (t, e, r, n) => {
|
|
3891
3926
|
if (e.unrepresentable === "throw")
|
|
3892
3927
|
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3893
|
-
},
|
|
3894
|
-
const i =
|
|
3895
|
-
typeof o == "number" && (i.minItems = o), typeof a == "number" && (i.maxItems = a), i.type = "array", i.items = T(s.element, e, { ...
|
|
3896
|
-
}, is = (t, e,
|
|
3897
|
-
const i =
|
|
3928
|
+
}, ns = (t, e, r, n) => {
|
|
3929
|
+
const i = r, s = t._zod.def, { minimum: o, maximum: a } = t._zod.bag;
|
|
3930
|
+
typeof o == "number" && (i.minItems = o), typeof a == "number" && (i.maxItems = a), i.type = "array", i.items = T(s.element, e, { ...n, path: [...n.path, "items"] });
|
|
3931
|
+
}, is = (t, e, r, n) => {
|
|
3932
|
+
const i = r, s = t._zod.def;
|
|
3898
3933
|
i.type = "object", i.properties = {};
|
|
3899
3934
|
const o = s.shape;
|
|
3900
|
-
for (const
|
|
3901
|
-
i.properties[
|
|
3902
|
-
...
|
|
3903
|
-
path: [...
|
|
3935
|
+
for (const p in o)
|
|
3936
|
+
i.properties[p] = T(o[p], e, {
|
|
3937
|
+
...n,
|
|
3938
|
+
path: [...n.path, "properties", p]
|
|
3904
3939
|
});
|
|
3905
|
-
const a = new Set(Object.keys(o)), c = new Set([...a].filter((
|
|
3906
|
-
const
|
|
3907
|
-
return e.io === "input" ?
|
|
3940
|
+
const a = new Set(Object.keys(o)), c = new Set([...a].filter((p) => {
|
|
3941
|
+
const h = s.shape[p]._zod;
|
|
3942
|
+
return e.io === "input" ? h.optin === void 0 : h.optout === void 0;
|
|
3908
3943
|
}));
|
|
3909
3944
|
c.size > 0 && (i.required = Array.from(c)), s.catchall?._zod.def.type === "never" ? i.additionalProperties = !1 : s.catchall ? s.catchall && (i.additionalProperties = T(s.catchall, e, {
|
|
3910
|
-
...
|
|
3911
|
-
path: [...
|
|
3945
|
+
...n,
|
|
3946
|
+
path: [...n.path, "additionalProperties"]
|
|
3912
3947
|
})) : e.io === "output" && (i.additionalProperties = !1);
|
|
3913
|
-
}, ss = (t, e,
|
|
3948
|
+
}, ss = (t, e, r, n) => {
|
|
3914
3949
|
const i = t._zod.def, s = i.inclusive === !1, o = i.options.map((a, c) => T(a, e, {
|
|
3915
|
-
...
|
|
3916
|
-
path: [...
|
|
3950
|
+
...n,
|
|
3951
|
+
path: [...n.path, s ? "oneOf" : "anyOf", c]
|
|
3917
3952
|
}));
|
|
3918
|
-
s ?
|
|
3919
|
-
}, os = (t, e,
|
|
3953
|
+
s ? r.oneOf = o : r.anyOf = o;
|
|
3954
|
+
}, os = (t, e, r, n) => {
|
|
3920
3955
|
const i = t._zod.def, s = T(i.left, e, {
|
|
3921
|
-
...
|
|
3922
|
-
path: [...
|
|
3956
|
+
...n,
|
|
3957
|
+
path: [...n.path, "allOf", 0]
|
|
3923
3958
|
}), o = T(i.right, e, {
|
|
3924
|
-
...
|
|
3925
|
-
path: [...
|
|
3926
|
-
}), a = (
|
|
3959
|
+
...n,
|
|
3960
|
+
path: [...n.path, "allOf", 1]
|
|
3961
|
+
}), a = (p) => "allOf" in p && Object.keys(p).length === 1, c = [
|
|
3927
3962
|
...a(s) ? s.allOf : [s],
|
|
3928
3963
|
...a(o) ? o.allOf : [o]
|
|
3929
3964
|
];
|
|
3930
|
-
|
|
3931
|
-
}, as = (t, e,
|
|
3932
|
-
const i = t._zod.def, s = T(i.innerType, e,
|
|
3933
|
-
e.target === "openapi-3.0" ? (o.ref = i.innerType,
|
|
3934
|
-
}, cs = (t, e,
|
|
3965
|
+
r.allOf = c;
|
|
3966
|
+
}, as = (t, e, r, n) => {
|
|
3967
|
+
const i = t._zod.def, s = T(i.innerType, e, n), o = e.seen.get(t);
|
|
3968
|
+
e.target === "openapi-3.0" ? (o.ref = i.innerType, r.nullable = !0) : r.anyOf = [s, { type: "null" }];
|
|
3969
|
+
}, cs = (t, e, r, n) => {
|
|
3935
3970
|
const i = t._zod.def;
|
|
3936
|
-
T(i.innerType, e,
|
|
3971
|
+
T(i.innerType, e, n);
|
|
3937
3972
|
const s = e.seen.get(t);
|
|
3938
3973
|
s.ref = i.innerType;
|
|
3939
|
-
}, us = (t, e,
|
|
3974
|
+
}, us = (t, e, r, n) => {
|
|
3940
3975
|
const i = t._zod.def;
|
|
3941
|
-
T(i.innerType, e,
|
|
3976
|
+
T(i.innerType, e, n);
|
|
3942
3977
|
const s = e.seen.get(t);
|
|
3943
|
-
s.ref = i.innerType,
|
|
3944
|
-
},
|
|
3978
|
+
s.ref = i.innerType, r.default = JSON.parse(JSON.stringify(i.defaultValue));
|
|
3979
|
+
}, ps = (t, e, r, n) => {
|
|
3945
3980
|
const i = t._zod.def;
|
|
3946
|
-
T(i.innerType, e,
|
|
3981
|
+
T(i.innerType, e, n);
|
|
3947
3982
|
const s = e.seen.get(t);
|
|
3948
|
-
s.ref = i.innerType, e.io === "input" && (
|
|
3949
|
-
},
|
|
3983
|
+
s.ref = i.innerType, e.io === "input" && (r._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
|
|
3984
|
+
}, hs = (t, e, r, n) => {
|
|
3950
3985
|
const i = t._zod.def;
|
|
3951
|
-
T(i.innerType, e,
|
|
3986
|
+
T(i.innerType, e, n);
|
|
3952
3987
|
const s = e.seen.get(t);
|
|
3953
3988
|
s.ref = i.innerType;
|
|
3954
3989
|
let o;
|
|
@@ -3957,65 +3992,65 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3957
3992
|
} catch {
|
|
3958
3993
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3959
3994
|
}
|
|
3960
|
-
|
|
3961
|
-
}, ls = (t, e,
|
|
3995
|
+
r.default = o;
|
|
3996
|
+
}, ls = (t, e, r, n) => {
|
|
3962
3997
|
const i = t._zod.def, s = e.io === "input" ? i.in._zod.def.type === "transform" ? i.out : i.in : i.out;
|
|
3963
|
-
T(s, e,
|
|
3998
|
+
T(s, e, n);
|
|
3964
3999
|
const o = e.seen.get(t);
|
|
3965
4000
|
o.ref = s;
|
|
3966
|
-
}, ds = (t, e,
|
|
4001
|
+
}, ds = (t, e, r, n) => {
|
|
3967
4002
|
const i = t._zod.def;
|
|
3968
|
-
T(i.innerType, e,
|
|
4003
|
+
T(i.innerType, e, n);
|
|
3969
4004
|
const s = e.seen.get(t);
|
|
3970
|
-
s.ref = i.innerType,
|
|
3971
|
-
}, fs = (t, e,
|
|
4005
|
+
s.ref = i.innerType, r.readOnly = !0;
|
|
4006
|
+
}, fs = (t, e, r, n) => {
|
|
3972
4007
|
const i = t._zod.def;
|
|
3973
|
-
T(i.innerType, e,
|
|
4008
|
+
T(i.innerType, e, n);
|
|
3974
4009
|
const s = e.seen.get(t);
|
|
3975
4010
|
s.ref = i.innerType;
|
|
3976
4011
|
}, ms = /* @__PURE__ */ u("ZodISODateTime", (t, e) => {
|
|
3977
|
-
|
|
4012
|
+
yn.init(t, e), _.init(t, e);
|
|
3978
4013
|
});
|
|
3979
4014
|
function gs(t) {
|
|
3980
|
-
return
|
|
4015
|
+
return Ii(ms, t);
|
|
3981
4016
|
}
|
|
3982
4017
|
const vs = /* @__PURE__ */ u("ZodISODate", (t, e) => {
|
|
3983
|
-
|
|
4018
|
+
Tn.init(t, e), _.init(t, e);
|
|
3984
4019
|
});
|
|
3985
4020
|
function _s(t) {
|
|
3986
|
-
return
|
|
4021
|
+
return Ei(vs, t);
|
|
3987
4022
|
}
|
|
3988
4023
|
const ks = /* @__PURE__ */ u("ZodISOTime", (t, e) => {
|
|
3989
|
-
|
|
4024
|
+
bn.init(t, e), _.init(t, e);
|
|
3990
4025
|
});
|
|
3991
4026
|
function ys(t) {
|
|
3992
4027
|
return zi(ks, t);
|
|
3993
4028
|
}
|
|
3994
4029
|
const Ts = /* @__PURE__ */ u("ZodISODuration", (t, e) => {
|
|
3995
|
-
|
|
4030
|
+
wn.init(t, e), _.init(t, e);
|
|
3996
4031
|
});
|
|
3997
|
-
function
|
|
4032
|
+
function bs(t) {
|
|
3998
4033
|
return $i(Ts, t);
|
|
3999
4034
|
}
|
|
4000
|
-
const
|
|
4035
|
+
const ws = (t, e) => {
|
|
4001
4036
|
ot.init(t, e), t.name = "ZodError", Object.defineProperties(t, {
|
|
4002
4037
|
format: {
|
|
4003
|
-
value: (
|
|
4038
|
+
value: (r) => lr(t, r)
|
|
4004
4039
|
// enumerable: false,
|
|
4005
4040
|
},
|
|
4006
4041
|
flatten: {
|
|
4007
|
-
value: (
|
|
4042
|
+
value: (r) => hr(t, r)
|
|
4008
4043
|
// enumerable: false,
|
|
4009
4044
|
},
|
|
4010
4045
|
addIssue: {
|
|
4011
|
-
value: (
|
|
4012
|
-
t.issues.push(
|
|
4046
|
+
value: (r) => {
|
|
4047
|
+
t.issues.push(r), t.message = JSON.stringify(t.issues, le, 2);
|
|
4013
4048
|
}
|
|
4014
4049
|
// enumerable: false,
|
|
4015
4050
|
},
|
|
4016
4051
|
addIssues: {
|
|
4017
|
-
value: (
|
|
4018
|
-
t.issues.push(...
|
|
4052
|
+
value: (r) => {
|
|
4053
|
+
t.issues.push(...r), t.message = JSON.stringify(t.issues, le, 2);
|
|
4019
4054
|
}
|
|
4020
4055
|
// enumerable: false,
|
|
4021
4056
|
},
|
|
@@ -4026,126 +4061,126 @@ const bs = (t, e) => {
|
|
|
4026
4061
|
// enumerable: false,
|
|
4027
4062
|
}
|
|
4028
4063
|
});
|
|
4029
|
-
},
|
|
4064
|
+
}, $ = u("ZodError", ws, {
|
|
4030
4065
|
Parent: Error
|
|
4031
|
-
}),
|
|
4066
|
+
}), Is = /* @__PURE__ */ _e($), Es = /* @__PURE__ */ ke($), zs = /* @__PURE__ */ ie($), $s = /* @__PURE__ */ se($), Os = /* @__PURE__ */ mr($), Ps = /* @__PURE__ */ gr($), Ss = /* @__PURE__ */ vr($), Ns = /* @__PURE__ */ _r($), As = /* @__PURE__ */ kr($), Zs = /* @__PURE__ */ yr($), Cs = /* @__PURE__ */ Tr($), Rs = /* @__PURE__ */ br($), y = /* @__PURE__ */ u("ZodType", (t, e) => (k.init(t, e), Object.assign(t["~standard"], {
|
|
4032
4067
|
jsonSchema: {
|
|
4033
4068
|
input: te(t, "input"),
|
|
4034
4069
|
output: te(t, "output")
|
|
4035
4070
|
}
|
|
4036
|
-
}), t.toJSONSchema = Wi(t, {}), t.def = e, t.type = e.type, Object.defineProperty(t, "_def", { value: e }), t.check = (...
|
|
4071
|
+
}), t.toJSONSchema = Wi(t, {}), t.def = e, t.type = e.type, Object.defineProperty(t, "_def", { value: e }), t.check = (...r) => t.clone(L(e, {
|
|
4037
4072
|
checks: [
|
|
4038
4073
|
...e.checks ?? [],
|
|
4039
|
-
...
|
|
4074
|
+
...r.map((n) => typeof n == "function" ? { _zod: { check: n, def: { check: "custom" }, onattach: [] } } : n)
|
|
4040
4075
|
]
|
|
4041
|
-
})), t.clone = (
|
|
4042
|
-
const
|
|
4043
|
-
return V.add(
|
|
4076
|
+
})), t.clone = (r, n) => N(t, r, n), t.brand = () => t, t.register = ((r, n) => (r.add(t, n), t)), t.parse = (r, n) => Is(t, r, n, { callee: t.parse }), t.safeParse = (r, n) => zs(t, r, n), t.parseAsync = async (r, n) => Es(t, r, n, { callee: t.parseAsync }), t.safeParseAsync = async (r, n) => $s(t, r, n), t.spa = t.safeParseAsync, t.encode = (r, n) => Os(t, r, n), t.decode = (r, n) => Ps(t, r, n), t.encodeAsync = async (r, n) => Ss(t, r, n), t.decodeAsync = async (r, n) => Ns(t, r, n), t.safeEncode = (r, n) => As(t, r, n), t.safeDecode = (r, n) => Zs(t, r, n), t.safeEncodeAsync = async (r, n) => Cs(t, r, n), t.safeDecodeAsync = async (r, n) => Rs(t, r, n), t.refine = (r, n) => t.check($o(r, n)), t.superRefine = (r) => t.check(Oo(r)), t.overwrite = (r) => t.check(U(r)), t.optional = () => Ge(t), t.nullable = () => Ve(t), t.nullish = () => Ge(Ve(t)), t.nonoptional = (r) => yo(t, r), t.array = () => Z(t), t.or = (r) => ae([t, r]), t.and = (r) => po(t, r), t.transform = (r) => Be(t, fo(r)), t.default = (r) => vo(t, r), t.prefault = (r) => ko(t, r), t.catch = (r) => bo(t, r), t.pipe = (r) => Be(t, r), t.readonly = () => Eo(t), t.describe = (r) => {
|
|
4077
|
+
const n = t.clone();
|
|
4078
|
+
return V.add(n, { description: r }), n;
|
|
4044
4079
|
}, Object.defineProperty(t, "description", {
|
|
4045
4080
|
get() {
|
|
4046
4081
|
return V.get(t)?.description;
|
|
4047
4082
|
},
|
|
4048
4083
|
configurable: !0
|
|
4049
|
-
}), t.meta = (...
|
|
4050
|
-
if (
|
|
4084
|
+
}), t.meta = (...r) => {
|
|
4085
|
+
if (r.length === 0)
|
|
4051
4086
|
return V.get(t);
|
|
4052
|
-
const
|
|
4053
|
-
return V.add(
|
|
4054
|
-
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)),
|
|
4055
|
-
ye.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4056
|
-
const
|
|
4057
|
-
t.format =
|
|
4058
|
-
}),
|
|
4059
|
-
ye.init(t, e),
|
|
4087
|
+
const n = t.clone();
|
|
4088
|
+
return V.add(n, r[0]), n;
|
|
4089
|
+
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)), It = /* @__PURE__ */ u("_ZodString", (t, e) => {
|
|
4090
|
+
ye.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, i, s) => Yi(t, n, i);
|
|
4091
|
+
const r = t._zod.bag;
|
|
4092
|
+
t.format = r.format ?? null, t.minLength = r.minimum ?? null, t.maxLength = r.maximum ?? null, t.regex = (...n) => t.check(Ai(...n)), t.includes = (...n) => t.check(Ri(...n)), t.startsWith = (...n) => t.check(xi(...n)), t.endsWith = (...n) => t.check(Li(...n)), t.min = (...n) => t.check(ee(...n)), t.max = (...n) => t.check(kt(...n)), t.length = (...n) => t.check(yt(...n)), t.nonempty = (...n) => t.check(ee(1, ...n)), t.lowercase = (n) => t.check(Zi(n)), t.uppercase = (n) => t.check(Ci(n)), t.trim = () => t.check(Fi()), t.normalize = (...n) => t.check(Di(...n)), t.toLowerCase = () => t.check(Mi()), t.toUpperCase = () => t.check(ji()), t.slugify = () => t.check(Ui());
|
|
4093
|
+
}), xs = /* @__PURE__ */ u("ZodString", (t, e) => {
|
|
4094
|
+
ye.init(t, e), It.init(t, e), t.email = (r) => t.check(ni(Ls, r)), t.url = (r) => t.check(ci(Ds, r)), t.jwt = (r) => t.check(wi(Hs, r)), t.emoji = (r) => t.check(ui(Fs, r)), t.guid = (r) => t.check(xe(Me, r)), t.uuid = (r) => t.check(ii(X, r)), t.uuidv4 = (r) => t.check(si(X, r)), t.uuidv6 = (r) => t.check(oi(X, r)), t.uuidv7 = (r) => t.check(ai(X, r)), t.nanoid = (r) => t.check(pi(Ms, r)), t.guid = (r) => t.check(xe(Me, r)), t.cuid = (r) => t.check(hi(js, r)), t.cuid2 = (r) => t.check(li(Us, r)), t.ulid = (r) => t.check(di(Gs, r)), t.base64 = (r) => t.check(yi(qs, r)), t.base64url = (r) => t.check(Ti(Xs, r)), t.xid = (r) => t.check(fi(Vs, r)), t.ksuid = (r) => t.check(mi(Bs, r)), t.ipv4 = (r) => t.check(gi(Js, r)), t.ipv6 = (r) => t.check(vi(Ws, r)), t.cidrv4 = (r) => t.check(_i(Ks, r)), t.cidrv6 = (r) => t.check(ki(Ys, r)), t.e164 = (r) => t.check(bi(Qs, r)), t.datetime = (r) => t.check(gs(r)), t.date = (r) => t.check(_s(r)), t.time = (r) => t.check(ys(r)), t.duration = (r) => t.check(bs(r));
|
|
4060
4095
|
});
|
|
4061
|
-
function
|
|
4062
|
-
return
|
|
4096
|
+
function E(t) {
|
|
4097
|
+
return ri(xs, t);
|
|
4063
4098
|
}
|
|
4064
4099
|
const _ = /* @__PURE__ */ u("ZodStringFormat", (t, e) => {
|
|
4065
|
-
|
|
4066
|
-
}),
|
|
4067
|
-
|
|
4068
|
-
}),
|
|
4069
|
-
|
|
4100
|
+
v.init(t, e), It.init(t, e);
|
|
4101
|
+
}), Ls = /* @__PURE__ */ u("ZodEmail", (t, e) => {
|
|
4102
|
+
hn.init(t, e), _.init(t, e);
|
|
4103
|
+
}), Me = /* @__PURE__ */ u("ZodGUID", (t, e) => {
|
|
4104
|
+
un.init(t, e), _.init(t, e);
|
|
4070
4105
|
}), X = /* @__PURE__ */ u("ZodUUID", (t, e) => {
|
|
4071
|
-
|
|
4106
|
+
pn.init(t, e), _.init(t, e);
|
|
4072
4107
|
}), Ds = /* @__PURE__ */ u("ZodURL", (t, e) => {
|
|
4073
|
-
|
|
4108
|
+
ln.init(t, e), _.init(t, e);
|
|
4074
4109
|
}), Fs = /* @__PURE__ */ u("ZodEmoji", (t, e) => {
|
|
4075
|
-
|
|
4076
|
-
}),
|
|
4077
|
-
|
|
4078
|
-
}),
|
|
4079
|
-
|
|
4110
|
+
dn.init(t, e), _.init(t, e);
|
|
4111
|
+
}), Ms = /* @__PURE__ */ u("ZodNanoID", (t, e) => {
|
|
4112
|
+
fn.init(t, e), _.init(t, e);
|
|
4113
|
+
}), js = /* @__PURE__ */ u("ZodCUID", (t, e) => {
|
|
4114
|
+
mn.init(t, e), _.init(t, e);
|
|
4080
4115
|
}), Us = /* @__PURE__ */ u("ZodCUID2", (t, e) => {
|
|
4081
|
-
|
|
4116
|
+
gn.init(t, e), _.init(t, e);
|
|
4082
4117
|
}), Gs = /* @__PURE__ */ u("ZodULID", (t, e) => {
|
|
4083
|
-
|
|
4118
|
+
vn.init(t, e), _.init(t, e);
|
|
4084
4119
|
}), Vs = /* @__PURE__ */ u("ZodXID", (t, e) => {
|
|
4085
|
-
|
|
4120
|
+
_n.init(t, e), _.init(t, e);
|
|
4086
4121
|
}), Bs = /* @__PURE__ */ u("ZodKSUID", (t, e) => {
|
|
4087
|
-
|
|
4122
|
+
kn.init(t, e), _.init(t, e);
|
|
4088
4123
|
}), Js = /* @__PURE__ */ u("ZodIPv4", (t, e) => {
|
|
4089
|
-
|
|
4124
|
+
In.init(t, e), _.init(t, e);
|
|
4090
4125
|
}), Ws = /* @__PURE__ */ u("ZodIPv6", (t, e) => {
|
|
4091
|
-
|
|
4126
|
+
En.init(t, e), _.init(t, e);
|
|
4092
4127
|
}), Ks = /* @__PURE__ */ u("ZodCIDRv4", (t, e) => {
|
|
4093
|
-
|
|
4128
|
+
zn.init(t, e), _.init(t, e);
|
|
4094
4129
|
}), Ys = /* @__PURE__ */ u("ZodCIDRv6", (t, e) => {
|
|
4095
|
-
$
|
|
4130
|
+
$n.init(t, e), _.init(t, e);
|
|
4096
4131
|
}), qs = /* @__PURE__ */ u("ZodBase64", (t, e) => {
|
|
4097
|
-
|
|
4132
|
+
On.init(t, e), _.init(t, e);
|
|
4098
4133
|
}), Xs = /* @__PURE__ */ u("ZodBase64URL", (t, e) => {
|
|
4099
|
-
|
|
4134
|
+
Sn.init(t, e), _.init(t, e);
|
|
4100
4135
|
}), Qs = /* @__PURE__ */ u("ZodE164", (t, e) => {
|
|
4101
|
-
|
|
4136
|
+
Nn.init(t, e), _.init(t, e);
|
|
4102
4137
|
}), Hs = /* @__PURE__ */ u("ZodJWT", (t, e) => {
|
|
4103
|
-
|
|
4104
|
-
}),
|
|
4105
|
-
mt.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4106
|
-
const
|
|
4107
|
-
t.minValue = Math.max(
|
|
4138
|
+
Zn.init(t, e), _.init(t, e);
|
|
4139
|
+
}), Et = /* @__PURE__ */ u("ZodNumber", (t, e) => {
|
|
4140
|
+
mt.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, i, s) => qi(t, n, i), t.gt = (n, i) => t.check(De(n, i)), t.gte = (n, i) => t.check(he(n, i)), t.min = (n, i) => t.check(he(n, i)), t.lt = (n, i) => t.check(Le(n, i)), t.lte = (n, i) => t.check(pe(n, i)), t.max = (n, i) => t.check(pe(n, i)), t.int = (n) => t.check(je(n)), t.safe = (n) => t.check(je(n)), t.positive = (n) => t.check(De(0, n)), t.nonnegative = (n) => t.check(he(0, n)), t.negative = (n) => t.check(Le(0, n)), t.nonpositive = (n) => t.check(pe(0, n)), t.multipleOf = (n, i) => t.check(Fe(n, i)), t.step = (n, i) => t.check(Fe(n, i)), t.finite = () => t;
|
|
4141
|
+
const r = t._zod.bag;
|
|
4142
|
+
t.minValue = Math.max(r.minimum ?? Number.NEGATIVE_INFINITY, r.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, t.maxValue = Math.min(r.maximum ?? Number.POSITIVE_INFINITY, r.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, t.isInt = (r.format ?? "").includes("int") || Number.isSafeInteger(r.multipleOf ?? 0.5), t.isFinite = !0, t.format = r.format ?? null;
|
|
4108
4143
|
});
|
|
4109
4144
|
function eo(t) {
|
|
4110
|
-
return Oi(
|
|
4145
|
+
return Oi(Et, t);
|
|
4111
4146
|
}
|
|
4112
4147
|
const to = /* @__PURE__ */ u("ZodNumberFormat", (t, e) => {
|
|
4113
|
-
|
|
4148
|
+
Cn.init(t, e), Et.init(t, e);
|
|
4114
4149
|
});
|
|
4115
|
-
function
|
|
4150
|
+
function je(t) {
|
|
4116
4151
|
return Pi(to, t);
|
|
4117
4152
|
}
|
|
4118
|
-
const
|
|
4119
|
-
|
|
4153
|
+
const ro = /* @__PURE__ */ u("ZodUnknown", (t, e) => {
|
|
4154
|
+
Rn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => Qi();
|
|
4120
4155
|
});
|
|
4121
4156
|
function Ue() {
|
|
4122
|
-
return Si(
|
|
4157
|
+
return Si(ro);
|
|
4123
4158
|
}
|
|
4124
|
-
const
|
|
4125
|
-
|
|
4159
|
+
const no = /* @__PURE__ */ u("ZodNever", (t, e) => {
|
|
4160
|
+
xn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => Xi(t, r, n);
|
|
4126
4161
|
});
|
|
4127
4162
|
function io(t) {
|
|
4128
|
-
return Ni(
|
|
4163
|
+
return Ni(no, t);
|
|
4129
4164
|
}
|
|
4130
4165
|
const so = /* @__PURE__ */ u("ZodArray", (t, e) => {
|
|
4131
|
-
|
|
4166
|
+
Ln.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ns(t, r, n, i), t.element = e.element, t.min = (r, n) => t.check(ee(r, n)), t.nonempty = (r) => t.check(ee(1, r)), t.max = (r, n) => t.check(kt(r, n)), t.length = (r, n) => t.check(yt(r, n)), t.unwrap = () => t.element;
|
|
4132
4167
|
});
|
|
4133
4168
|
function Z(t, e) {
|
|
4134
4169
|
return Gi(so, t, e);
|
|
4135
4170
|
}
|
|
4136
4171
|
const oo = /* @__PURE__ */ u("ZodObject", (t, e) => {
|
|
4137
|
-
|
|
4172
|
+
Fn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => is(t, r, n, i), m(t, "shape", () => e.shape), t.keyof = () => $t(Object.keys(t._zod.def.shape)), t.catchall = (r) => t.clone({ ...t._zod.def, catchall: r }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: Ue() }), t.loose = () => t.clone({ ...t._zod.def, catchall: Ue() }), t.strict = () => t.clone({ ...t._zod.def, catchall: io() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (r) => or(t, r), t.safeExtend = (r) => ar(t, r), t.merge = (r) => cr(t, r), t.pick = (r) => ir(t, r), t.omit = (r) => sr(t, r), t.partial = (...r) => ur(Ot, t, r[0]), t.required = (...r) => pr(Pt, t, r[0]);
|
|
4138
4173
|
});
|
|
4139
4174
|
function z(t, e) {
|
|
4140
|
-
const
|
|
4175
|
+
const r = {
|
|
4141
4176
|
type: "object",
|
|
4142
4177
|
shape: t ?? {},
|
|
4143
4178
|
...l(e)
|
|
4144
4179
|
};
|
|
4145
|
-
return new oo(
|
|
4180
|
+
return new oo(r);
|
|
4146
4181
|
}
|
|
4147
4182
|
const zt = /* @__PURE__ */ u("ZodUnion", (t, e) => {
|
|
4148
|
-
_t.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4183
|
+
_t.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ss(t, r, n, i), t.options = e.options;
|
|
4149
4184
|
});
|
|
4150
4185
|
function ae(t, e) {
|
|
4151
4186
|
return new zt({
|
|
@@ -4155,20 +4190,20 @@ function ae(t, e) {
|
|
|
4155
4190
|
});
|
|
4156
4191
|
}
|
|
4157
4192
|
const ao = /* @__PURE__ */ u("ZodDiscriminatedUnion", (t, e) => {
|
|
4158
|
-
zt.init(t, e),
|
|
4193
|
+
zt.init(t, e), Mn.init(t, e);
|
|
4159
4194
|
});
|
|
4160
|
-
function co(t, e,
|
|
4195
|
+
function co(t, e, r) {
|
|
4161
4196
|
return new ao({
|
|
4162
4197
|
type: "union",
|
|
4163
4198
|
options: e,
|
|
4164
4199
|
discriminator: t,
|
|
4165
|
-
...l(
|
|
4200
|
+
...l(r)
|
|
4166
4201
|
});
|
|
4167
4202
|
}
|
|
4168
4203
|
const uo = /* @__PURE__ */ u("ZodIntersection", (t, e) => {
|
|
4169
|
-
|
|
4204
|
+
jn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => os(t, r, n, i);
|
|
4170
4205
|
});
|
|
4171
|
-
function
|
|
4206
|
+
function po(t, e) {
|
|
4172
4207
|
return new uo({
|
|
4173
4208
|
type: "intersection",
|
|
4174
4209
|
left: t,
|
|
@@ -4176,12 +4211,12 @@ function ho(t, e) {
|
|
|
4176
4211
|
});
|
|
4177
4212
|
}
|
|
4178
4213
|
const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
4179
|
-
|
|
4180
|
-
const
|
|
4181
|
-
t.extract = (
|
|
4214
|
+
Un.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, i, s) => Hi(t, n, i), t.enum = e.entries, t.options = Object.values(e.entries);
|
|
4215
|
+
const r = new Set(Object.keys(e.entries));
|
|
4216
|
+
t.extract = (n, i) => {
|
|
4182
4217
|
const s = {};
|
|
4183
|
-
for (const o of
|
|
4184
|
-
if (
|
|
4218
|
+
for (const o of n)
|
|
4219
|
+
if (r.has(o))
|
|
4185
4220
|
s[o] = e.entries[o];
|
|
4186
4221
|
else
|
|
4187
4222
|
throw new Error(`Key ${o} not found in enum`);
|
|
@@ -4191,10 +4226,10 @@ const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
|
4191
4226
|
...l(i),
|
|
4192
4227
|
entries: s
|
|
4193
4228
|
});
|
|
4194
|
-
}, t.exclude = (
|
|
4229
|
+
}, t.exclude = (n, i) => {
|
|
4195
4230
|
const s = { ...e.entries };
|
|
4196
|
-
for (const o of
|
|
4197
|
-
if (
|
|
4231
|
+
for (const o of n)
|
|
4232
|
+
if (r.has(o))
|
|
4198
4233
|
delete s[o];
|
|
4199
4234
|
else
|
|
4200
4235
|
throw new Error(`Key ${o} not found in enum`);
|
|
@@ -4207,15 +4242,15 @@ const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
|
4207
4242
|
};
|
|
4208
4243
|
});
|
|
4209
4244
|
function $t(t, e) {
|
|
4210
|
-
const
|
|
4245
|
+
const r = Array.isArray(t) ? Object.fromEntries(t.map((n) => [n, n])) : t;
|
|
4211
4246
|
return new fe({
|
|
4212
4247
|
type: "enum",
|
|
4213
|
-
entries:
|
|
4248
|
+
entries: r,
|
|
4214
4249
|
...l(e)
|
|
4215
4250
|
});
|
|
4216
4251
|
}
|
|
4217
|
-
const
|
|
4218
|
-
|
|
4252
|
+
const ho = /* @__PURE__ */ u("ZodLiteral", (t, e) => {
|
|
4253
|
+
Gn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => es(t, r, n), t.values = new Set(e.values), Object.defineProperty(t, "value", {
|
|
4219
4254
|
get() {
|
|
4220
4255
|
if (e.values.length > 1)
|
|
4221
4256
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -4224,26 +4259,26 @@ const po = /* @__PURE__ */ u("ZodLiteral", (t, e) => {
|
|
|
4224
4259
|
});
|
|
4225
4260
|
});
|
|
4226
4261
|
function A(t, e) {
|
|
4227
|
-
return new
|
|
4262
|
+
return new ho({
|
|
4228
4263
|
type: "literal",
|
|
4229
4264
|
values: Array.isArray(t) ? t : [t],
|
|
4230
4265
|
...l(e)
|
|
4231
4266
|
});
|
|
4232
4267
|
}
|
|
4233
4268
|
const lo = /* @__PURE__ */ u("ZodTransform", (t, e) => {
|
|
4234
|
-
|
|
4235
|
-
if (
|
|
4269
|
+
Vn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => rs(t, r), t._zod.parse = (r, n) => {
|
|
4270
|
+
if (n.direction === "backward")
|
|
4236
4271
|
throw new He(t.constructor.name);
|
|
4237
|
-
|
|
4272
|
+
r.addIssue = (s) => {
|
|
4238
4273
|
if (typeof s == "string")
|
|
4239
|
-
|
|
4274
|
+
r.issues.push(W(s, r.value, e));
|
|
4240
4275
|
else {
|
|
4241
4276
|
const o = s;
|
|
4242
|
-
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input =
|
|
4277
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = r.value), o.inst ?? (o.inst = t), r.issues.push(W(o));
|
|
4243
4278
|
}
|
|
4244
4279
|
};
|
|
4245
|
-
const i = e.transform(
|
|
4246
|
-
return i instanceof Promise ? i.then((s) => (
|
|
4280
|
+
const i = e.transform(r.value, r);
|
|
4281
|
+
return i instanceof Promise ? i.then((s) => (r.value = s, r)) : (r.value = i, r);
|
|
4247
4282
|
};
|
|
4248
4283
|
});
|
|
4249
4284
|
function fo(t) {
|
|
@@ -4253,7 +4288,7 @@ function fo(t) {
|
|
|
4253
4288
|
});
|
|
4254
4289
|
}
|
|
4255
4290
|
const Ot = /* @__PURE__ */ u("ZodOptional", (t, e) => {
|
|
4256
|
-
|
|
4291
|
+
Bn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => fs(t, r, n, i), t.unwrap = () => t._zod.def.innerType;
|
|
4257
4292
|
});
|
|
4258
4293
|
function Ge(t) {
|
|
4259
4294
|
return new Ot({
|
|
@@ -4262,7 +4297,7 @@ function Ge(t) {
|
|
|
4262
4297
|
});
|
|
4263
4298
|
}
|
|
4264
4299
|
const mo = /* @__PURE__ */ u("ZodNullable", (t, e) => {
|
|
4265
|
-
|
|
4300
|
+
Jn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => as(t, r, n, i), t.unwrap = () => t._zod.def.innerType;
|
|
4266
4301
|
});
|
|
4267
4302
|
function Ve(t) {
|
|
4268
4303
|
return new mo({
|
|
@@ -4271,31 +4306,31 @@ function Ve(t) {
|
|
|
4271
4306
|
});
|
|
4272
4307
|
}
|
|
4273
4308
|
const go = /* @__PURE__ */ u("ZodDefault", (t, e) => {
|
|
4274
|
-
|
|
4309
|
+
Wn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => us(t, r, n, i), t.unwrap = () => t._zod.def.innerType, t.removeDefault = t.unwrap;
|
|
4275
4310
|
});
|
|
4276
4311
|
function vo(t, e) {
|
|
4277
4312
|
return new go({
|
|
4278
4313
|
type: "default",
|
|
4279
4314
|
innerType: t,
|
|
4280
4315
|
get defaultValue() {
|
|
4281
|
-
return typeof e == "function" ? e() :
|
|
4316
|
+
return typeof e == "function" ? e() : nt(e);
|
|
4282
4317
|
}
|
|
4283
4318
|
});
|
|
4284
4319
|
}
|
|
4285
4320
|
const _o = /* @__PURE__ */ u("ZodPrefault", (t, e) => {
|
|
4286
|
-
|
|
4321
|
+
Kn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ps(t, r, n, i), t.unwrap = () => t._zod.def.innerType;
|
|
4287
4322
|
});
|
|
4288
4323
|
function ko(t, e) {
|
|
4289
4324
|
return new _o({
|
|
4290
4325
|
type: "prefault",
|
|
4291
4326
|
innerType: t,
|
|
4292
4327
|
get defaultValue() {
|
|
4293
|
-
return typeof e == "function" ? e() :
|
|
4328
|
+
return typeof e == "function" ? e() : nt(e);
|
|
4294
4329
|
}
|
|
4295
4330
|
});
|
|
4296
4331
|
}
|
|
4297
4332
|
const Pt = /* @__PURE__ */ u("ZodNonOptional", (t, e) => {
|
|
4298
|
-
|
|
4333
|
+
Yn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => cs(t, r, n, i), t.unwrap = () => t._zod.def.innerType;
|
|
4299
4334
|
});
|
|
4300
4335
|
function yo(t, e) {
|
|
4301
4336
|
return new Pt({
|
|
@@ -4305,37 +4340,37 @@ function yo(t, e) {
|
|
|
4305
4340
|
});
|
|
4306
4341
|
}
|
|
4307
4342
|
const To = /* @__PURE__ */ u("ZodCatch", (t, e) => {
|
|
4308
|
-
|
|
4343
|
+
qn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => hs(t, r, n, i), t.unwrap = () => t._zod.def.innerType, t.removeCatch = t.unwrap;
|
|
4309
4344
|
});
|
|
4310
|
-
function
|
|
4345
|
+
function bo(t, e) {
|
|
4311
4346
|
return new To({
|
|
4312
4347
|
type: "catch",
|
|
4313
4348
|
innerType: t,
|
|
4314
4349
|
catchValue: typeof e == "function" ? e : () => e
|
|
4315
4350
|
});
|
|
4316
4351
|
}
|
|
4317
|
-
const
|
|
4318
|
-
|
|
4352
|
+
const wo = /* @__PURE__ */ u("ZodPipe", (t, e) => {
|
|
4353
|
+
Xn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ls(t, r, n, i), t.in = e.in, t.out = e.out;
|
|
4319
4354
|
});
|
|
4320
4355
|
function Be(t, e) {
|
|
4321
|
-
return new
|
|
4356
|
+
return new wo({
|
|
4322
4357
|
type: "pipe",
|
|
4323
4358
|
in: t,
|
|
4324
4359
|
out: e
|
|
4325
4360
|
// ...util.normalizeParams(params),
|
|
4326
4361
|
});
|
|
4327
4362
|
}
|
|
4328
|
-
const
|
|
4329
|
-
|
|
4363
|
+
const Io = /* @__PURE__ */ u("ZodReadonly", (t, e) => {
|
|
4364
|
+
Qn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ds(t, r, n, i), t.unwrap = () => t._zod.def.innerType;
|
|
4330
4365
|
});
|
|
4331
|
-
function
|
|
4332
|
-
return new
|
|
4366
|
+
function Eo(t) {
|
|
4367
|
+
return new Io({
|
|
4333
4368
|
type: "readonly",
|
|
4334
4369
|
innerType: t
|
|
4335
4370
|
});
|
|
4336
4371
|
}
|
|
4337
4372
|
const zo = /* @__PURE__ */ u("ZodCustom", (t, e) => {
|
|
4338
|
-
|
|
4373
|
+
Hn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ts(t, r);
|
|
4339
4374
|
});
|
|
4340
4375
|
function $o(t, e = {}) {
|
|
4341
4376
|
return Vi(zo, t, e);
|
|
@@ -4344,82 +4379,111 @@ function Oo(t) {
|
|
|
4344
4379
|
return Bi(t);
|
|
4345
4380
|
}
|
|
4346
4381
|
const S = ae([
|
|
4347
|
-
|
|
4382
|
+
E(),
|
|
4348
4383
|
z({
|
|
4349
|
-
pattern:
|
|
4350
|
-
|
|
4384
|
+
pattern: E().describe(`Regex pattern to match.
|
|
4385
|
+
@example ".*\\\\.ts$"`),
|
|
4386
|
+
flags: E().optional().describe(`Regex flags to modify matching behavior (e.g. "i" for case-insensitive, "m" for multiline).
|
|
4387
|
+
@example "i"`)
|
|
4351
4388
|
})
|
|
4352
|
-
]), Po = z({
|
|
4353
|
-
kind: A("fragment")
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4389
|
+
]).describe("A string or a regex pattern to match text."), Po = z({
|
|
4390
|
+
kind: A("fragment").describe(`The type of element to select.
|
|
4391
|
+
@example "fragment"`),
|
|
4392
|
+
condition: S.optional().describe(`Filter by branch condition text (e.g. "Success").
|
|
4393
|
+
@example "Success"`),
|
|
4394
|
+
operator: ae([E(), Z(E())]).optional().describe(`Filter by loop/alt type.
|
|
4395
|
+
@example "loop"
|
|
4396
|
+
@values "loop", "alt", "opt", "break", "par", "critical"`)
|
|
4397
|
+
}).describe("Selects fragment (alt/loop/opt) blocks."), Te = z({
|
|
4398
|
+
kind: A("participant").describe(`The type of element to select.
|
|
4399
|
+
@example "participant"`),
|
|
4400
|
+
name: S.optional().describe(`Filter by participant name (the text displayed).
|
|
4401
|
+
@example "UserService"`),
|
|
4402
|
+
id: S.optional().describe(`Filter by participant ID (alias).
|
|
4403
|
+
@example "S1"`),
|
|
4404
|
+
stereotype: S.optional().describe(`Filter by stereotype (e.g. <<Service>>).
|
|
4405
|
+
@example "<<Service>>"`)
|
|
4406
|
+
}).describe("Selects participants in the diagram."), So = z({
|
|
4407
|
+
kind: A("message").describe(`The type of element to select.
|
|
4408
|
+
@example "message"`),
|
|
4409
|
+
text: S.optional().describe(`Filter by message content.
|
|
4410
|
+
@example "Login Request"`),
|
|
4411
|
+
from: S.optional().describe(`Filter by Sender participant ID.
|
|
4412
|
+
@example "User"`),
|
|
4413
|
+
to: S.optional().describe(`Filter by Receiver participant ID.
|
|
4414
|
+
@example "Database"`)
|
|
4415
|
+
}).describe("Selects messages between participants."), No = z({
|
|
4416
|
+
kind: A("group").describe(`The type of element to select.
|
|
4417
|
+
@example "group"`),
|
|
4418
|
+
name: S.optional().describe(`Filter by group name.
|
|
4419
|
+
@example "Services"`)
|
|
4420
|
+
}).describe("Selects groups (boxes/rectangles) of participants."), Ao = z({
|
|
4421
|
+
action: A("resolve").describe(`The operation to perform.
|
|
4422
|
+
@example "resolve"`),
|
|
4423
|
+
selector: Po.describe("Criteria for selecting fragments to resolve.")
|
|
4424
|
+
}).describe("Unwraps specific branches of fragments (alt, opt, loop), simplifying the diagram."), Zo = z({
|
|
4425
|
+
action: A("focus").describe(`The operation to perform.
|
|
4426
|
+
@example "focus"`),
|
|
4427
|
+
selector: Te.describe("Criteria for selecting participants to focus on.")
|
|
4428
|
+
}).describe("Keeps only interactions involving the selected participants, hiding everything else."), Co = z({
|
|
4429
|
+
action: A("remove").describe(`The operation to perform.
|
|
4430
|
+
@example "remove"`),
|
|
4379
4431
|
selector: ae([
|
|
4380
4432
|
Te,
|
|
4381
4433
|
So,
|
|
4382
4434
|
No
|
|
4383
|
-
])
|
|
4384
|
-
}), Ro = z({
|
|
4385
|
-
action: A("merge")
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4435
|
+
]).describe("Criteria for selecting elements to remove.")
|
|
4436
|
+
}).describe("Removes the selected elements (participants, messages, or groups) from the diagram."), Ro = z({
|
|
4437
|
+
action: A("merge").describe(`The operation to perform.
|
|
4438
|
+
@example "merge"`),
|
|
4439
|
+
into: z({
|
|
4440
|
+
name: E().optional().describe(`The name of the new merged participant.
|
|
4441
|
+
@example "User System"`),
|
|
4442
|
+
id: E().optional().describe(`The ID of the new merged participant.
|
|
4443
|
+
@example "MergedUser"`),
|
|
4444
|
+
stereotype: E().optional().describe(`The stereotype of the new merged participant.
|
|
4445
|
+
@example "<<System>>"`)
|
|
4446
|
+
}).optional().describe("Configuration for the target participant to merge into."),
|
|
4447
|
+
selector: Te.describe("Criteria for selecting participants to merge.")
|
|
4448
|
+
}).describe("Merges multiple participants into a single participant."), xo = co("action", [
|
|
4389
4449
|
Ao,
|
|
4390
4450
|
Zo,
|
|
4391
4451
|
Co,
|
|
4392
4452
|
Ro
|
|
4393
|
-
]),
|
|
4394
|
-
name:
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
})
|
|
4453
|
+
]).describe("A transformation step to apply to the diagram."), Lo = z({
|
|
4454
|
+
name: E().describe(`Unique name for the lens. Used to generate the output filename.
|
|
4455
|
+
@example "web-view"`),
|
|
4456
|
+
suffix: E().optional().describe(`Custom file suffix. If omitted, defaults to ".<name>".
|
|
4457
|
+
@example ".web.mmd"`),
|
|
4458
|
+
layers: Z(xo).describe("Ordered list of transformation layers. Applied sequentially.")
|
|
4459
|
+
}).describe("A specific view or transformation configuration for the diagram."), Je = $t(["mermaid", "plantuml"]).describe(`Supported diagram format for parsing/generation.
|
|
4460
|
+
@example "mermaid"`), Do = z({
|
|
4461
|
+
input: Z(E()).describe(`Array of file paths or glob patterns to include.
|
|
4462
|
+
@example ["src/**/*.mmd"]`),
|
|
4463
|
+
outputDir: E().describe(`Directory where generated files will be saved.
|
|
4464
|
+
@example "generated"`),
|
|
4465
|
+
ignore: Z(E()).optional().describe(`Array of glob patterns to exclude files from processing.
|
|
4466
|
+
@example ["**/node_modules/**", "**/*.test.mmd"]`),
|
|
4467
|
+
lenses: Z(Lo).describe("List of lenses (transformations) to apply to the input diagrams."),
|
|
4468
|
+
format: Je.optional().describe("Input format (auto-detected if omitted)."),
|
|
4469
|
+
outputFormat: Je.optional().describe("Output format (same as input if omitted).")
|
|
4470
|
+
}).describe("Defines a conversion target: inputs, output location, and transformations."), Fo = z({
|
|
4471
|
+
version: eo().describe(`The version of the configuration schema. Currently, only version 1 is supported.
|
|
4472
|
+
@example 1`),
|
|
4473
|
+
targets: Z(Do).describe("A list of conversion targets.")
|
|
4474
|
+
}).describe("The root configuration object for Polagram.");
|
|
4411
4475
|
function Vo(t) {
|
|
4412
4476
|
const e = Fo.safeParse(t);
|
|
4413
4477
|
if (!e.success) {
|
|
4414
|
-
const
|
|
4478
|
+
const r = e.error.issues.map((n) => `[${n.path.join(".")}]: ${n.message}`).join(`
|
|
4415
4479
|
`);
|
|
4416
4480
|
throw new Error(`Invalid Polagram Configuration:
|
|
4417
|
-
${
|
|
4481
|
+
${r}`);
|
|
4418
4482
|
}
|
|
4419
4483
|
return e.data;
|
|
4420
4484
|
}
|
|
4421
4485
|
export {
|
|
4422
|
-
|
|
4486
|
+
we as FormatDetector,
|
|
4423
4487
|
Go as GeneratorFactory,
|
|
4424
4488
|
Ye as MermaidGeneratorVisitor,
|
|
4425
4489
|
Ut as ParserFactory,
|