@polagram/core 0.3.0 → 0.4.1
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/polagram-core.js +1350 -1313
- 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,38 @@ 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
|
+
return e.participantIds.filter(
|
|
1320
|
+
(n) => this.targetParticipantIds.has(n)
|
|
1321
|
+
).length !== e.participantIds.length ? [] : [e];
|
|
1322
|
+
}
|
|
1320
1323
|
// Helper to check if message involves the participant from selector
|
|
1321
1324
|
isRelatedToParticipant(e) {
|
|
1322
1325
|
return !!(e.from && this.targetParticipantIds.has(e.from) || e.to && this.targetParticipantIds.has(e.to));
|
|
@@ -1326,76 +1329,82 @@ class Jt extends K {
|
|
|
1326
1329
|
constructor(e) {
|
|
1327
1330
|
super(), this.layer = e;
|
|
1328
1331
|
}
|
|
1329
|
-
matcher = new
|
|
1332
|
+
matcher = new re();
|
|
1330
1333
|
mergedParticipantIds = /* @__PURE__ */ new Set();
|
|
1331
1334
|
targetParticipantId = "";
|
|
1332
1335
|
transform(e) {
|
|
1333
|
-
const
|
|
1336
|
+
const r = this.layer.selector, n = [];
|
|
1334
1337
|
if (e.participants.forEach((d) => {
|
|
1335
|
-
this.matcher.matchParticipant(d,
|
|
1336
|
-
}),
|
|
1338
|
+
this.matcher.matchParticipant(d, r) && n.push(d);
|
|
1339
|
+
}), n.length === 0)
|
|
1337
1340
|
return e;
|
|
1338
|
-
this.mergedParticipantIds = new Set(
|
|
1341
|
+
this.mergedParticipantIds = new Set(n.map((d) => d.id));
|
|
1339
1342
|
const i = this.layer.into || {};
|
|
1340
1343
|
let s = i.id, o = i.name;
|
|
1341
|
-
s || (o ? s = o.replace(/[^a-zA-Z0-9-_]/g, "_") : s =
|
|
1342
|
-
const a = [],
|
|
1344
|
+
s || (o ? s = o.replace(/[^a-zA-Z0-9-_]/g, "_") : s = n.map((d) => d.id).join("_")), o || (o = s), this.targetParticipantId = s;
|
|
1345
|
+
const a = [], p = !e.participants.some(
|
|
1343
1346
|
(d) => d.id === s && !this.mergedParticipantIds.has(d.id)
|
|
1344
1347
|
);
|
|
1345
|
-
let
|
|
1348
|
+
let h = !1;
|
|
1346
1349
|
for (const d of e.participants) {
|
|
1347
1350
|
if (this.mergedParticipantIds.has(d.id)) {
|
|
1348
|
-
if (
|
|
1351
|
+
if (p && !h) {
|
|
1349
1352
|
const f = {
|
|
1350
1353
|
id: s || "",
|
|
1351
1354
|
name: o || "",
|
|
1352
1355
|
type: "participant"
|
|
1353
1356
|
// Todo: map stereotype?
|
|
1354
1357
|
};
|
|
1355
|
-
a.push(f),
|
|
1358
|
+
a.push(f), h = !0;
|
|
1356
1359
|
}
|
|
1357
1360
|
continue;
|
|
1358
1361
|
}
|
|
1359
1362
|
d.id, a.push(d);
|
|
1360
1363
|
}
|
|
1361
|
-
return e.participants = a,
|
|
1364
|
+
return e.participants = a, e.groups = e.groups.map((d) => {
|
|
1365
|
+
const f = /* @__PURE__ */ new Set();
|
|
1366
|
+
return d.participantIds.forEach((g) => {
|
|
1367
|
+
this.mergedParticipantIds.has(g) ? f.add(this.targetParticipantId) : f.add(g);
|
|
1368
|
+
}), {
|
|
1369
|
+
...d,
|
|
1370
|
+
participantIds: Array.from(f)
|
|
1371
|
+
};
|
|
1372
|
+
}), super.transform(e);
|
|
1362
1373
|
}
|
|
1363
1374
|
visitEvent(e) {
|
|
1364
1375
|
if (e.kind === "message")
|
|
1365
1376
|
return this.transformMessage(e);
|
|
1366
|
-
if (e.kind === "note")
|
|
1367
|
-
return this.
|
|
1377
|
+
if (e.kind === "note" || e.kind === "ref")
|
|
1378
|
+
return this.transformMultiParticipantNode(e);
|
|
1368
1379
|
if (e.kind === "activation")
|
|
1369
1380
|
return this.transformActivation(e);
|
|
1370
1381
|
if (e.kind === "fragment") {
|
|
1371
|
-
const
|
|
1372
|
-
return
|
|
1382
|
+
const r = super.visitEvent(e);
|
|
1383
|
+
return r.length > 0 && r[0].kind === "fragment" && r[0].branches.every(
|
|
1373
1384
|
(s) => s.events.length === 0
|
|
1374
|
-
) ? [] :
|
|
1385
|
+
) ? [] : r;
|
|
1375
1386
|
}
|
|
1376
1387
|
return super.visitEvent(e);
|
|
1377
1388
|
}
|
|
1378
1389
|
transformMessage(e) {
|
|
1379
|
-
let
|
|
1380
|
-
return
|
|
1390
|
+
let r = e.from, n = e.to;
|
|
1391
|
+
return r && this.mergedParticipantIds.has(r) && (r = this.targetParticipantId), n && this.mergedParticipantIds.has(n) && (n = this.targetParticipantId), r === this.targetParticipantId && n === this.targetParticipantId ? [] : [
|
|
1381
1392
|
{
|
|
1382
1393
|
...e,
|
|
1383
|
-
from:
|
|
1384
|
-
to:
|
|
1394
|
+
from: r,
|
|
1395
|
+
to: n
|
|
1385
1396
|
}
|
|
1386
1397
|
];
|
|
1387
1398
|
}
|
|
1388
|
-
|
|
1389
|
-
const
|
|
1390
|
-
let
|
|
1391
|
-
for (const
|
|
1392
|
-
this.mergedParticipantIds.has(
|
|
1393
|
-
if (!
|
|
1399
|
+
transformMultiParticipantNode(e) {
|
|
1400
|
+
const r = /* @__PURE__ */ new Set();
|
|
1401
|
+
let n = !1;
|
|
1402
|
+
for (const s of e.participantIds)
|
|
1403
|
+
this.mergedParticipantIds.has(s) ? (r.add(this.targetParticipantId), n = !0) : r.add(s);
|
|
1404
|
+
if (!n)
|
|
1394
1405
|
return [e];
|
|
1395
|
-
const i = Array.from(
|
|
1396
|
-
return
|
|
1397
|
-
(o) => this.mergedParticipantIds.has(o)
|
|
1398
|
-
) ? [] : [
|
|
1406
|
+
const i = Array.from(r);
|
|
1407
|
+
return [
|
|
1399
1408
|
{
|
|
1400
1409
|
...e,
|
|
1401
1410
|
participantIds: i
|
|
@@ -1410,38 +1419,41 @@ class Wt extends K {
|
|
|
1410
1419
|
constructor(e) {
|
|
1411
1420
|
super(), this.layer = e;
|
|
1412
1421
|
}
|
|
1413
|
-
matcher = new
|
|
1422
|
+
matcher = new re();
|
|
1414
1423
|
removedParticipantIds = /* @__PURE__ */ new Set();
|
|
1415
1424
|
transform(e) {
|
|
1416
|
-
const
|
|
1417
|
-
return
|
|
1418
|
-
this.matcher.matchParticipant(
|
|
1425
|
+
const r = this.layer.selector;
|
|
1426
|
+
return r.kind === "participant" && (e.participants.forEach((n) => {
|
|
1427
|
+
this.matcher.matchParticipant(n, r) && this.removedParticipantIds.add(n.id);
|
|
1419
1428
|
}), e.participants = e.participants.filter(
|
|
1420
|
-
(
|
|
1421
|
-
)),
|
|
1422
|
-
(
|
|
1429
|
+
(n) => !this.removedParticipantIds.has(n.id)
|
|
1430
|
+
)), r.kind === "group" && (e.groups = e.groups.filter(
|
|
1431
|
+
(n) => !this.matcher.matchGroup(n, r)
|
|
1423
1432
|
)), super.transform(e);
|
|
1424
1433
|
}
|
|
1425
1434
|
visitEvent(e) {
|
|
1426
|
-
const
|
|
1427
|
-
if (
|
|
1435
|
+
const r = this.layer.selector;
|
|
1436
|
+
if (r.kind === "message" && e.kind === "message" && this.matcher.matchMessage(e, r))
|
|
1428
1437
|
return [];
|
|
1429
|
-
if (
|
|
1438
|
+
if (r.kind === "participant") {
|
|
1430
1439
|
if (e.kind === "message") {
|
|
1431
|
-
const
|
|
1432
|
-
if (this.isRelatedToRemovedParticipant(
|
|
1440
|
+
const n = e;
|
|
1441
|
+
if (this.isRelatedToRemovedParticipant(n)) return [];
|
|
1433
1442
|
}
|
|
1434
|
-
if (e.kind === "note"
|
|
1435
|
-
|
|
1436
|
-
))
|
|
1437
|
-
return [];
|
|
1443
|
+
if (e.kind === "note" || e.kind === "ref")
|
|
1444
|
+
return this.filterMultiParticipantNode(e);
|
|
1438
1445
|
if (e.kind === "activation") {
|
|
1439
|
-
const
|
|
1440
|
-
if (this.removedParticipantIds.has(
|
|
1446
|
+
const n = e;
|
|
1447
|
+
if (this.removedParticipantIds.has(n.participantId)) return [];
|
|
1441
1448
|
}
|
|
1442
1449
|
}
|
|
1443
1450
|
return super.visitEvent(e);
|
|
1444
1451
|
}
|
|
1452
|
+
filterMultiParticipantNode(e) {
|
|
1453
|
+
return e.participantIds.filter(
|
|
1454
|
+
(n) => !this.removedParticipantIds.has(n)
|
|
1455
|
+
).length !== e.participantIds.length ? [] : [e];
|
|
1456
|
+
}
|
|
1445
1457
|
isRelatedToRemovedParticipant(e) {
|
|
1446
1458
|
return !!(e.from && this.removedParticipantIds.has(e.from) || e.to && this.removedParticipantIds.has(e.to));
|
|
1447
1459
|
}
|
|
@@ -1450,12 +1462,12 @@ class Kt extends K {
|
|
|
1450
1462
|
constructor(e) {
|
|
1451
1463
|
super(), this.layer = e;
|
|
1452
1464
|
}
|
|
1453
|
-
matcher = new
|
|
1465
|
+
matcher = new re();
|
|
1454
1466
|
visitFragment(e) {
|
|
1455
|
-
const
|
|
1456
|
-
(
|
|
1467
|
+
const r = e.branches.find(
|
|
1468
|
+
(n) => this.matcher.matchBranch(n, this.layer.selector, e.operator)
|
|
1457
1469
|
);
|
|
1458
|
-
return
|
|
1470
|
+
return r ? this.mapEvents(r.events) : super.visitFragment(e);
|
|
1459
1471
|
}
|
|
1460
1472
|
}
|
|
1461
1473
|
class Yt {
|
|
@@ -1466,22 +1478,22 @@ class Yt {
|
|
|
1466
1478
|
/**
|
|
1467
1479
|
* Type-safe registration for a specific layer type.
|
|
1468
1480
|
*/
|
|
1469
|
-
registerTyped(e,
|
|
1470
|
-
this.factories.set(e,
|
|
1481
|
+
registerTyped(e, r) {
|
|
1482
|
+
this.factories.set(e, r);
|
|
1471
1483
|
}
|
|
1472
1484
|
/**
|
|
1473
1485
|
* Register a custom transformer factory.
|
|
1474
1486
|
*/
|
|
1475
|
-
register(e,
|
|
1476
|
-
this.factories.set(e,
|
|
1487
|
+
register(e, r) {
|
|
1488
|
+
this.factories.set(e, r);
|
|
1477
1489
|
}
|
|
1478
1490
|
/**
|
|
1479
1491
|
* Get a transformer for the given layer.
|
|
1480
1492
|
* @returns Transformer instance or null if no factory is registered
|
|
1481
1493
|
*/
|
|
1482
1494
|
get(e) {
|
|
1483
|
-
const
|
|
1484
|
-
return
|
|
1495
|
+
const r = this.factories.get(e.action);
|
|
1496
|
+
return r ? r(e) : null;
|
|
1485
1497
|
}
|
|
1486
1498
|
/**
|
|
1487
1499
|
* Check if a transformer is registered for the given action.
|
|
@@ -1492,13 +1504,13 @@ class Yt {
|
|
|
1492
1504
|
}
|
|
1493
1505
|
const qt = new Yt();
|
|
1494
1506
|
class ue {
|
|
1495
|
-
transform(e,
|
|
1496
|
-
let
|
|
1497
|
-
for (const i of
|
|
1507
|
+
transform(e, r) {
|
|
1508
|
+
let n = e;
|
|
1509
|
+
for (const i of r) {
|
|
1498
1510
|
const s = qt.get(i);
|
|
1499
|
-
s ?
|
|
1511
|
+
s ? n = s.transform(n) : console.warn(`Unknown action: ${i.action}`);
|
|
1500
1512
|
}
|
|
1501
|
-
return
|
|
1513
|
+
return n = new Gt().transform(n), n = new Vt().transform(n), n;
|
|
1502
1514
|
}
|
|
1503
1515
|
}
|
|
1504
1516
|
class Uo {
|
|
@@ -1509,17 +1521,17 @@ class Uo {
|
|
|
1509
1521
|
* @param code Source diagram code
|
|
1510
1522
|
* @param format Input format ('mermaid' or 'plantuml')
|
|
1511
1523
|
*/
|
|
1512
|
-
static init(e,
|
|
1513
|
-
const i = Ut.getParser(
|
|
1514
|
-
return new Xt(i,
|
|
1524
|
+
static init(e, r = "mermaid") {
|
|
1525
|
+
const i = Ut.getParser(r).parse(e);
|
|
1526
|
+
return new Xt(i, r);
|
|
1515
1527
|
}
|
|
1516
1528
|
}
|
|
1517
1529
|
class Xt {
|
|
1518
1530
|
ast;
|
|
1519
1531
|
layers = [];
|
|
1520
1532
|
sourceFormat;
|
|
1521
|
-
constructor(e,
|
|
1522
|
-
this.ast = e, this.sourceFormat =
|
|
1533
|
+
constructor(e, r = "mermaid") {
|
|
1534
|
+
this.ast = e, this.sourceFormat = r;
|
|
1523
1535
|
}
|
|
1524
1536
|
// -- Entity Filtering --
|
|
1525
1537
|
/**
|
|
@@ -1588,15 +1600,15 @@ class Xt {
|
|
|
1588
1600
|
* Generate Mermaid code from the transformed AST.
|
|
1589
1601
|
*/
|
|
1590
1602
|
toMermaid() {
|
|
1591
|
-
const
|
|
1592
|
-
return new Ye().generate(
|
|
1603
|
+
const r = new ue().transform(this.ast, this.layers);
|
|
1604
|
+
return new Ye().generate(r);
|
|
1593
1605
|
}
|
|
1594
1606
|
/**
|
|
1595
1607
|
* Generate PlantUML code from the transformed AST.
|
|
1596
1608
|
*/
|
|
1597
1609
|
toPlantUML() {
|
|
1598
|
-
const
|
|
1599
|
-
return new qe().generate(
|
|
1610
|
+
const r = new ue().transform(this.ast, this.layers);
|
|
1611
|
+
return new qe().generate(r);
|
|
1600
1612
|
}
|
|
1601
1613
|
/**
|
|
1602
1614
|
* Get the transformed AST (for advanced use cases).
|
|
@@ -1664,8 +1676,8 @@ const Go = {
|
|
|
1664
1676
|
return Array.from(D.keys());
|
|
1665
1677
|
}
|
|
1666
1678
|
};
|
|
1667
|
-
function u(t, e,
|
|
1668
|
-
function
|
|
1679
|
+
function u(t, e, r) {
|
|
1680
|
+
function n(a, c) {
|
|
1669
1681
|
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
1670
1682
|
value: {
|
|
1671
1683
|
def: c,
|
|
@@ -1676,29 +1688,29 @@ function u(t, e, n) {
|
|
|
1676
1688
|
}), a._zod.traits.has(t))
|
|
1677
1689
|
return;
|
|
1678
1690
|
a._zod.traits.add(t), e(a, c);
|
|
1679
|
-
const
|
|
1680
|
-
for (let d = 0; d <
|
|
1681
|
-
const f =
|
|
1682
|
-
f in a || (a[f] =
|
|
1691
|
+
const p = o.prototype, h = Object.keys(p);
|
|
1692
|
+
for (let d = 0; d < h.length; d++) {
|
|
1693
|
+
const f = h[d];
|
|
1694
|
+
f in a || (a[f] = p[f].bind(a));
|
|
1683
1695
|
}
|
|
1684
1696
|
}
|
|
1685
|
-
const i =
|
|
1697
|
+
const i = r?.Parent ?? Object;
|
|
1686
1698
|
class s extends i {
|
|
1687
1699
|
}
|
|
1688
1700
|
Object.defineProperty(s, "name", { value: t });
|
|
1689
1701
|
function o(a) {
|
|
1690
1702
|
var c;
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
for (const
|
|
1694
|
-
|
|
1695
|
-
return
|
|
1696
|
-
}
|
|
1697
|
-
return Object.defineProperty(o, "init", { value:
|
|
1698
|
-
value: (a) =>
|
|
1703
|
+
const p = r?.Parent ? new s() : this;
|
|
1704
|
+
n(p, a), (c = p._zod).deferred ?? (c.deferred = []);
|
|
1705
|
+
for (const h of p._zod.deferred)
|
|
1706
|
+
h();
|
|
1707
|
+
return p;
|
|
1708
|
+
}
|
|
1709
|
+
return Object.defineProperty(o, "init", { value: n }), Object.defineProperty(o, Symbol.hasInstance, {
|
|
1710
|
+
value: (a) => r?.Parent && a instanceof r.Parent ? !0 : a?._zod?.traits?.has(t)
|
|
1699
1711
|
}), Object.defineProperty(o, "name", { value: t }), o;
|
|
1700
1712
|
}
|
|
1701
|
-
class
|
|
1713
|
+
class M extends Error {
|
|
1702
1714
|
constructor() {
|
|
1703
1715
|
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
1704
1716
|
}
|
|
@@ -1713,13 +1725,13 @@ function C(t) {
|
|
|
1713
1725
|
return et;
|
|
1714
1726
|
}
|
|
1715
1727
|
function tt(t) {
|
|
1716
|
-
const e = Object.values(t).filter((
|
|
1717
|
-
return Object.entries(t).filter(([
|
|
1728
|
+
const e = Object.values(t).filter((n) => typeof n == "number");
|
|
1729
|
+
return Object.entries(t).filter(([n, i]) => e.indexOf(+n) === -1).map(([n, i]) => i);
|
|
1718
1730
|
}
|
|
1719
1731
|
function le(t, e) {
|
|
1720
1732
|
return typeof e == "bigint" ? e.toString() : e;
|
|
1721
1733
|
}
|
|
1722
|
-
function
|
|
1734
|
+
function ne(t) {
|
|
1723
1735
|
return {
|
|
1724
1736
|
get value() {
|
|
1725
1737
|
{
|
|
@@ -1733,26 +1745,26 @@ function me(t) {
|
|
|
1733
1745
|
return t == null;
|
|
1734
1746
|
}
|
|
1735
1747
|
function ge(t) {
|
|
1736
|
-
const e = t.startsWith("^") ? 1 : 0,
|
|
1737
|
-
return t.slice(e,
|
|
1748
|
+
const e = t.startsWith("^") ? 1 : 0, r = t.endsWith("$") ? t.length - 1 : t.length;
|
|
1749
|
+
return t.slice(e, r);
|
|
1738
1750
|
}
|
|
1739
1751
|
function Qt(t, e) {
|
|
1740
|
-
const
|
|
1741
|
-
let i = (
|
|
1742
|
-
if (i === 0 && /\d?e-\d?/.test(
|
|
1743
|
-
const c =
|
|
1752
|
+
const r = (t.toString().split(".")[1] || "").length, n = e.toString();
|
|
1753
|
+
let i = (n.split(".")[1] || "").length;
|
|
1754
|
+
if (i === 0 && /\d?e-\d?/.test(n)) {
|
|
1755
|
+
const c = n.match(/\d?e-(\d?)/);
|
|
1744
1756
|
c?.[1] && (i = Number.parseInt(c[1]));
|
|
1745
1757
|
}
|
|
1746
|
-
const s =
|
|
1758
|
+
const s = r > i ? r : i, o = Number.parseInt(t.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1747
1759
|
return o % a / 10 ** s;
|
|
1748
1760
|
}
|
|
1749
|
-
const
|
|
1750
|
-
function m(t, e,
|
|
1751
|
-
let
|
|
1761
|
+
const Ie = /* @__PURE__ */ Symbol("evaluating");
|
|
1762
|
+
function m(t, e, r) {
|
|
1763
|
+
let n;
|
|
1752
1764
|
Object.defineProperty(t, e, {
|
|
1753
1765
|
get() {
|
|
1754
|
-
if (
|
|
1755
|
-
return
|
|
1766
|
+
if (n !== Ie)
|
|
1767
|
+
return n === void 0 && (n = Ie, n = r()), n;
|
|
1756
1768
|
},
|
|
1757
1769
|
set(i) {
|
|
1758
1770
|
Object.defineProperty(t, e, {
|
|
@@ -1763,34 +1775,34 @@ function m(t, e, n) {
|
|
|
1763
1775
|
configurable: !0
|
|
1764
1776
|
});
|
|
1765
1777
|
}
|
|
1766
|
-
function
|
|
1778
|
+
function x(t, e, r) {
|
|
1767
1779
|
Object.defineProperty(t, e, {
|
|
1768
|
-
value:
|
|
1780
|
+
value: r,
|
|
1769
1781
|
writable: !0,
|
|
1770
1782
|
enumerable: !0,
|
|
1771
1783
|
configurable: !0
|
|
1772
1784
|
});
|
|
1773
1785
|
}
|
|
1774
|
-
function
|
|
1786
|
+
function L(...t) {
|
|
1775
1787
|
const e = {};
|
|
1776
|
-
for (const
|
|
1777
|
-
const
|
|
1778
|
-
Object.assign(e,
|
|
1788
|
+
for (const r of t) {
|
|
1789
|
+
const n = Object.getOwnPropertyDescriptors(r);
|
|
1790
|
+
Object.assign(e, n);
|
|
1779
1791
|
}
|
|
1780
1792
|
return Object.defineProperties({}, e);
|
|
1781
1793
|
}
|
|
1782
|
-
function
|
|
1794
|
+
function Ee(t) {
|
|
1783
1795
|
return JSON.stringify(t);
|
|
1784
1796
|
}
|
|
1785
1797
|
function Ht(t) {
|
|
1786
1798
|
return t.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1787
1799
|
}
|
|
1788
|
-
const
|
|
1800
|
+
const rt = "captureStackTrace" in Error ? Error.captureStackTrace : (...t) => {
|
|
1789
1801
|
};
|
|
1790
1802
|
function B(t) {
|
|
1791
1803
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1792
1804
|
}
|
|
1793
|
-
const
|
|
1805
|
+
const er = ne(() => {
|
|
1794
1806
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
1795
1807
|
return !1;
|
|
1796
1808
|
try {
|
|
@@ -1806,19 +1818,19 @@ function J(t) {
|
|
|
1806
1818
|
const e = t.constructor;
|
|
1807
1819
|
if (e === void 0 || typeof e != "function")
|
|
1808
1820
|
return !0;
|
|
1809
|
-
const
|
|
1810
|
-
return !(B(
|
|
1821
|
+
const r = e.prototype;
|
|
1822
|
+
return !(B(r) === !1 || Object.prototype.hasOwnProperty.call(r, "isPrototypeOf") === !1);
|
|
1811
1823
|
}
|
|
1812
|
-
function
|
|
1824
|
+
function nt(t) {
|
|
1813
1825
|
return J(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
|
|
1814
1826
|
}
|
|
1815
|
-
const
|
|
1816
|
-
function
|
|
1827
|
+
const tr = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
1828
|
+
function j(t) {
|
|
1817
1829
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1818
1830
|
}
|
|
1819
|
-
function N(t, e,
|
|
1820
|
-
const
|
|
1821
|
-
return (!e ||
|
|
1831
|
+
function N(t, e, r) {
|
|
1832
|
+
const n = new t._zod.constr(e ?? t._zod.def);
|
|
1833
|
+
return (!e || r?.parent) && (n._zod.parent = t), n;
|
|
1822
1834
|
}
|
|
1823
1835
|
function l(t) {
|
|
1824
1836
|
const e = t;
|
|
@@ -1833,79 +1845,79 @@ function l(t) {
|
|
|
1833
1845
|
}
|
|
1834
1846
|
return delete e.message, typeof e.error == "string" ? { ...e, error: () => e.error } : e;
|
|
1835
1847
|
}
|
|
1836
|
-
function
|
|
1848
|
+
function rr(t) {
|
|
1837
1849
|
return Object.keys(t).filter((e) => t[e]._zod.optin === "optional" && t[e]._zod.optout === "optional");
|
|
1838
1850
|
}
|
|
1839
|
-
const
|
|
1851
|
+
const nr = {
|
|
1840
1852
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1841
1853
|
int32: [-2147483648, 2147483647],
|
|
1842
1854
|
uint32: [0, 4294967295],
|
|
1843
1855
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1844
1856
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1845
1857
|
};
|
|
1846
|
-
function
|
|
1847
|
-
const
|
|
1858
|
+
function ir(t, e) {
|
|
1859
|
+
const r = t._zod.def, n = L(t._zod.def, {
|
|
1848
1860
|
get shape() {
|
|
1849
1861
|
const i = {};
|
|
1850
1862
|
for (const s in e) {
|
|
1851
|
-
if (!(s in
|
|
1863
|
+
if (!(s in r.shape))
|
|
1852
1864
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1853
|
-
e[s] && (i[s] =
|
|
1865
|
+
e[s] && (i[s] = r.shape[s]);
|
|
1854
1866
|
}
|
|
1855
|
-
return
|
|
1867
|
+
return x(this, "shape", i), i;
|
|
1856
1868
|
},
|
|
1857
1869
|
checks: []
|
|
1858
1870
|
});
|
|
1859
|
-
return N(t,
|
|
1871
|
+
return N(t, n);
|
|
1860
1872
|
}
|
|
1861
|
-
function
|
|
1862
|
-
const
|
|
1873
|
+
function sr(t, e) {
|
|
1874
|
+
const r = t._zod.def, n = L(t._zod.def, {
|
|
1863
1875
|
get shape() {
|
|
1864
1876
|
const i = { ...t._zod.def.shape };
|
|
1865
1877
|
for (const s in e) {
|
|
1866
|
-
if (!(s in
|
|
1878
|
+
if (!(s in r.shape))
|
|
1867
1879
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1868
1880
|
e[s] && delete i[s];
|
|
1869
1881
|
}
|
|
1870
|
-
return
|
|
1882
|
+
return x(this, "shape", i), i;
|
|
1871
1883
|
},
|
|
1872
1884
|
checks: []
|
|
1873
1885
|
});
|
|
1874
|
-
return N(t,
|
|
1886
|
+
return N(t, n);
|
|
1875
1887
|
}
|
|
1876
|
-
function
|
|
1888
|
+
function or(t, e) {
|
|
1877
1889
|
if (!J(e))
|
|
1878
1890
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
1879
|
-
const
|
|
1880
|
-
if (
|
|
1891
|
+
const r = t._zod.def.checks;
|
|
1892
|
+
if (r && r.length > 0)
|
|
1881
1893
|
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
1882
|
-
const i =
|
|
1894
|
+
const i = L(t._zod.def, {
|
|
1883
1895
|
get shape() {
|
|
1884
1896
|
const s = { ...t._zod.def.shape, ...e };
|
|
1885
|
-
return
|
|
1897
|
+
return x(this, "shape", s), s;
|
|
1886
1898
|
},
|
|
1887
1899
|
checks: []
|
|
1888
1900
|
});
|
|
1889
1901
|
return N(t, i);
|
|
1890
1902
|
}
|
|
1891
|
-
function
|
|
1903
|
+
function ar(t, e) {
|
|
1892
1904
|
if (!J(e))
|
|
1893
1905
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1894
|
-
const
|
|
1906
|
+
const r = {
|
|
1895
1907
|
...t._zod.def,
|
|
1896
1908
|
get shape() {
|
|
1897
|
-
const
|
|
1898
|
-
return
|
|
1909
|
+
const n = { ...t._zod.def.shape, ...e };
|
|
1910
|
+
return x(this, "shape", n), n;
|
|
1899
1911
|
},
|
|
1900
1912
|
checks: t._zod.def.checks
|
|
1901
1913
|
};
|
|
1902
|
-
return N(t,
|
|
1914
|
+
return N(t, r);
|
|
1903
1915
|
}
|
|
1904
|
-
function
|
|
1905
|
-
const
|
|
1916
|
+
function cr(t, e) {
|
|
1917
|
+
const r = L(t._zod.def, {
|
|
1906
1918
|
get shape() {
|
|
1907
|
-
const
|
|
1908
|
-
return
|
|
1919
|
+
const n = { ...t._zod.def.shape, ...e._zod.def.shape };
|
|
1920
|
+
return x(this, "shape", n), n;
|
|
1909
1921
|
},
|
|
1910
1922
|
get catchall() {
|
|
1911
1923
|
return e._zod.def.catchall;
|
|
@@ -1913,17 +1925,17 @@ function un(t, e) {
|
|
|
1913
1925
|
checks: []
|
|
1914
1926
|
// delete existing checks
|
|
1915
1927
|
});
|
|
1916
|
-
return N(t,
|
|
1928
|
+
return N(t, r);
|
|
1917
1929
|
}
|
|
1918
|
-
function
|
|
1919
|
-
const
|
|
1930
|
+
function ur(t, e, r) {
|
|
1931
|
+
const n = L(e._zod.def, {
|
|
1920
1932
|
get shape() {
|
|
1921
1933
|
const i = e._zod.def.shape, s = { ...i };
|
|
1922
|
-
if (
|
|
1923
|
-
for (const o in
|
|
1934
|
+
if (r)
|
|
1935
|
+
for (const o in r) {
|
|
1924
1936
|
if (!(o in i))
|
|
1925
1937
|
throw new Error(`Unrecognized key: "${o}"`);
|
|
1926
|
-
|
|
1938
|
+
r[o] && (s[o] = t ? new t({
|
|
1927
1939
|
type: "optional",
|
|
1928
1940
|
innerType: i[o]
|
|
1929
1941
|
}) : i[o]);
|
|
@@ -1934,21 +1946,21 @@ function hn(t, e, n) {
|
|
|
1934
1946
|
type: "optional",
|
|
1935
1947
|
innerType: i[o]
|
|
1936
1948
|
}) : i[o];
|
|
1937
|
-
return
|
|
1949
|
+
return x(this, "shape", s), s;
|
|
1938
1950
|
},
|
|
1939
1951
|
checks: []
|
|
1940
1952
|
});
|
|
1941
|
-
return N(e,
|
|
1953
|
+
return N(e, n);
|
|
1942
1954
|
}
|
|
1943
|
-
function
|
|
1944
|
-
const
|
|
1955
|
+
function pr(t, e, r) {
|
|
1956
|
+
const n = L(e._zod.def, {
|
|
1945
1957
|
get shape() {
|
|
1946
1958
|
const i = e._zod.def.shape, s = { ...i };
|
|
1947
|
-
if (
|
|
1948
|
-
for (const o in
|
|
1959
|
+
if (r)
|
|
1960
|
+
for (const o in r) {
|
|
1949
1961
|
if (!(o in s))
|
|
1950
1962
|
throw new Error(`Unrecognized key: "${o}"`);
|
|
1951
|
-
|
|
1963
|
+
r[o] && (s[o] = new t({
|
|
1952
1964
|
type: "nonoptional",
|
|
1953
1965
|
innerType: i[o]
|
|
1954
1966
|
}));
|
|
@@ -1959,47 +1971,47 @@ function pn(t, e, n) {
|
|
|
1959
1971
|
type: "nonoptional",
|
|
1960
1972
|
innerType: i[o]
|
|
1961
1973
|
});
|
|
1962
|
-
return
|
|
1974
|
+
return x(this, "shape", s), s;
|
|
1963
1975
|
},
|
|
1964
1976
|
checks: []
|
|
1965
1977
|
});
|
|
1966
|
-
return N(e,
|
|
1978
|
+
return N(e, n);
|
|
1967
1979
|
}
|
|
1968
1980
|
function F(t, e = 0) {
|
|
1969
1981
|
if (t.aborted === !0)
|
|
1970
1982
|
return !0;
|
|
1971
|
-
for (let
|
|
1972
|
-
if (t.issues[
|
|
1983
|
+
for (let r = e; r < t.issues.length; r++)
|
|
1984
|
+
if (t.issues[r]?.continue !== !0)
|
|
1973
1985
|
return !0;
|
|
1974
1986
|
return !1;
|
|
1975
1987
|
}
|
|
1976
1988
|
function it(t, e) {
|
|
1977
|
-
return e.map((
|
|
1978
|
-
var
|
|
1979
|
-
return (
|
|
1989
|
+
return e.map((r) => {
|
|
1990
|
+
var n;
|
|
1991
|
+
return (n = r).path ?? (n.path = []), r.path.unshift(t), r;
|
|
1980
1992
|
});
|
|
1981
1993
|
}
|
|
1982
1994
|
function Y(t) {
|
|
1983
1995
|
return typeof t == "string" ? t : t?.message;
|
|
1984
1996
|
}
|
|
1985
|
-
function R(t, e,
|
|
1986
|
-
const
|
|
1997
|
+
function R(t, e, r) {
|
|
1998
|
+
const n = { ...t, path: t.path ?? [] };
|
|
1987
1999
|
if (!t.message) {
|
|
1988
|
-
const i = Y(t.inst?._zod.def?.error?.(t)) ?? Y(e?.error?.(t)) ?? Y(
|
|
1989
|
-
|
|
2000
|
+
const i = Y(t.inst?._zod.def?.error?.(t)) ?? Y(e?.error?.(t)) ?? Y(r.customError?.(t)) ?? Y(r.localeError?.(t)) ?? "Invalid input";
|
|
2001
|
+
n.message = i;
|
|
1990
2002
|
}
|
|
1991
|
-
return delete
|
|
2003
|
+
return delete n.inst, delete n.continue, e?.reportInput || delete n.input, n;
|
|
1992
2004
|
}
|
|
1993
2005
|
function ve(t) {
|
|
1994
2006
|
return Array.isArray(t) ? "array" : typeof t == "string" ? "string" : "unknown";
|
|
1995
2007
|
}
|
|
1996
2008
|
function W(...t) {
|
|
1997
|
-
const [e,
|
|
2009
|
+
const [e, r, n] = t;
|
|
1998
2010
|
return typeof e == "string" ? {
|
|
1999
2011
|
message: e,
|
|
2000
2012
|
code: "custom",
|
|
2001
|
-
input:
|
|
2002
|
-
inst:
|
|
2013
|
+
input: r,
|
|
2014
|
+
inst: n
|
|
2003
2015
|
} : { ...e };
|
|
2004
2016
|
}
|
|
2005
2017
|
const st = (t, e) => {
|
|
@@ -2014,167 +2026,167 @@ const st = (t, e) => {
|
|
|
2014
2026
|
enumerable: !1
|
|
2015
2027
|
});
|
|
2016
2028
|
}, ot = u("$ZodError", st), at = u("$ZodError", st, { Parent: Error });
|
|
2017
|
-
function
|
|
2018
|
-
const
|
|
2029
|
+
function hr(t, e = (r) => r.message) {
|
|
2030
|
+
const r = {}, n = [];
|
|
2019
2031
|
for (const i of t.issues)
|
|
2020
|
-
i.path.length > 0 ? (
|
|
2021
|
-
return { formErrors:
|
|
2032
|
+
i.path.length > 0 ? (r[i.path[0]] = r[i.path[0]] || [], r[i.path[0]].push(e(i))) : n.push(e(i));
|
|
2033
|
+
return { formErrors: n, fieldErrors: r };
|
|
2022
2034
|
}
|
|
2023
|
-
function
|
|
2024
|
-
const
|
|
2035
|
+
function lr(t, e = (r) => r.message) {
|
|
2036
|
+
const r = { _errors: [] }, n = (i) => {
|
|
2025
2037
|
for (const s of i.issues)
|
|
2026
2038
|
if (s.code === "invalid_union" && s.errors.length)
|
|
2027
|
-
s.errors.map((o) =>
|
|
2039
|
+
s.errors.map((o) => n({ issues: o }));
|
|
2028
2040
|
else if (s.code === "invalid_key")
|
|
2029
|
-
|
|
2041
|
+
n({ issues: s.issues });
|
|
2030
2042
|
else if (s.code === "invalid_element")
|
|
2031
|
-
|
|
2043
|
+
n({ issues: s.issues });
|
|
2032
2044
|
else if (s.path.length === 0)
|
|
2033
|
-
|
|
2045
|
+
r._errors.push(e(s));
|
|
2034
2046
|
else {
|
|
2035
|
-
let o =
|
|
2047
|
+
let o = r, a = 0;
|
|
2036
2048
|
for (; a < s.path.length; ) {
|
|
2037
2049
|
const c = s.path[a];
|
|
2038
2050
|
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++;
|
|
2039
2051
|
}
|
|
2040
2052
|
}
|
|
2041
2053
|
};
|
|
2042
|
-
return
|
|
2054
|
+
return n(t), r;
|
|
2043
2055
|
}
|
|
2044
|
-
const _e = (t) => (e,
|
|
2045
|
-
const s =
|
|
2056
|
+
const _e = (t) => (e, r, n, i) => {
|
|
2057
|
+
const s = n ? Object.assign(n, { async: !1 }) : { async: !1 }, o = e._zod.run({ value: r, issues: [] }, s);
|
|
2046
2058
|
if (o instanceof Promise)
|
|
2047
|
-
throw new
|
|
2059
|
+
throw new M();
|
|
2048
2060
|
if (o.issues.length) {
|
|
2049
2061
|
const a = new (i?.Err ?? t)(o.issues.map((c) => R(c, s, C())));
|
|
2050
|
-
throw
|
|
2062
|
+
throw rt(a, i?.callee), a;
|
|
2051
2063
|
}
|
|
2052
2064
|
return o.value;
|
|
2053
|
-
}, ke = (t) => async (e,
|
|
2054
|
-
const s =
|
|
2055
|
-
let o = e._zod.run({ value:
|
|
2065
|
+
}, ke = (t) => async (e, r, n, i) => {
|
|
2066
|
+
const s = n ? Object.assign(n, { async: !0 }) : { async: !0 };
|
|
2067
|
+
let o = e._zod.run({ value: r, issues: [] }, s);
|
|
2056
2068
|
if (o instanceof Promise && (o = await o), o.issues.length) {
|
|
2057
2069
|
const a = new (i?.Err ?? t)(o.issues.map((c) => R(c, s, C())));
|
|
2058
|
-
throw
|
|
2070
|
+
throw rt(a, i?.callee), a;
|
|
2059
2071
|
}
|
|
2060
2072
|
return o.value;
|
|
2061
|
-
}, ie = (t) => (e,
|
|
2062
|
-
const i =
|
|
2073
|
+
}, ie = (t) => (e, r, n) => {
|
|
2074
|
+
const i = n ? { ...n, async: !1 } : { async: !1 }, s = e._zod.run({ value: r, issues: [] }, i);
|
|
2063
2075
|
if (s instanceof Promise)
|
|
2064
|
-
throw new
|
|
2076
|
+
throw new M();
|
|
2065
2077
|
return s.issues.length ? {
|
|
2066
2078
|
success: !1,
|
|
2067
2079
|
error: new (t ?? ot)(s.issues.map((o) => R(o, i, C())))
|
|
2068
2080
|
} : { success: !0, data: s.value };
|
|
2069
|
-
},
|
|
2070
|
-
const i =
|
|
2071
|
-
let s = e._zod.run({ value:
|
|
2081
|
+
}, dr = /* @__PURE__ */ ie(at), se = (t) => async (e, r, n) => {
|
|
2082
|
+
const i = n ? Object.assign(n, { async: !0 }) : { async: !0 };
|
|
2083
|
+
let s = e._zod.run({ value: r, issues: [] }, i);
|
|
2072
2084
|
return s instanceof Promise && (s = await s), s.issues.length ? {
|
|
2073
2085
|
success: !1,
|
|
2074
2086
|
error: new t(s.issues.map((o) => R(o, i, C())))
|
|
2075
2087
|
} : { success: !0, data: s.value };
|
|
2076
|
-
},
|
|
2077
|
-
const i =
|
|
2078
|
-
return _e(t)(e,
|
|
2079
|
-
},
|
|
2080
|
-
const i =
|
|
2081
|
-
return ke(t)(e,
|
|
2082
|
-
},
|
|
2083
|
-
const i =
|
|
2084
|
-
return ie(t)(e,
|
|
2085
|
-
},
|
|
2086
|
-
const i =
|
|
2087
|
-
return se(t)(e,
|
|
2088
|
-
},
|
|
2089
|
-
function
|
|
2090
|
-
return new RegExp(
|
|
2091
|
-
}
|
|
2092
|
-
const
|
|
2093
|
-
function
|
|
2088
|
+
}, fr = /* @__PURE__ */ se(at), mr = (t) => (e, r, n) => {
|
|
2089
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2090
|
+
return _e(t)(e, r, i);
|
|
2091
|
+
}, gr = (t) => (e, r, n) => _e(t)(e, r, n), vr = (t) => async (e, r, n) => {
|
|
2092
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2093
|
+
return ke(t)(e, r, i);
|
|
2094
|
+
}, _r = (t) => async (e, r, n) => ke(t)(e, r, n), kr = (t) => (e, r, n) => {
|
|
2095
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2096
|
+
return ie(t)(e, r, i);
|
|
2097
|
+
}, yr = (t) => (e, r, n) => ie(t)(e, r, n), Tr = (t) => async (e, r, n) => {
|
|
2098
|
+
const i = n ? Object.assign(n, { direction: "backward" }) : { direction: "backward" };
|
|
2099
|
+
return se(t)(e, r, i);
|
|
2100
|
+
}, 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})+$";
|
|
2101
|
+
function Zr() {
|
|
2102
|
+
return new RegExp(Ar, "u");
|
|
2103
|
+
}
|
|
2104
|
+
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}$`);
|
|
2105
|
+
function pt(t) {
|
|
2094
2106
|
const e = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
2095
2107
|
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+)?)?`;
|
|
2096
2108
|
}
|
|
2097
|
-
function
|
|
2098
|
-
return new RegExp(`^${
|
|
2109
|
+
function jr(t) {
|
|
2110
|
+
return new RegExp(`^${pt(t)}$`);
|
|
2099
2111
|
}
|
|
2100
|
-
function
|
|
2101
|
-
const e =
|
|
2102
|
-
t.local &&
|
|
2103
|
-
const
|
|
2104
|
-
return new RegExp(`^${ut}T(?:${
|
|
2112
|
+
function Ur(t) {
|
|
2113
|
+
const e = pt({ precision: t.precision }), r = ["Z"];
|
|
2114
|
+
t.local && r.push(""), t.offset && r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
2115
|
+
const n = `${e}(?:${r.join("|")})`;
|
|
2116
|
+
return new RegExp(`^${ut}T(?:${n})$`);
|
|
2105
2117
|
}
|
|
2106
|
-
const
|
|
2118
|
+
const Gr = (t) => {
|
|
2107
2119
|
const e = t ? `[\\s\\S]{${t?.minimum ?? 0},${t?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
2108
2120
|
return new RegExp(`^${e}$`);
|
|
2109
|
-
},
|
|
2110
|
-
var
|
|
2111
|
-
t._zod ?? (t._zod = {}), t._zod.def = e, (
|
|
2112
|
-
}),
|
|
2121
|
+
}, Vr = /^-?\d+$/, Br = /^-?\d+(?:\.\d+)?/, Jr = /^[^A-Z]*$/, Wr = /^[^a-z]*$/, w = /* @__PURE__ */ u("$ZodCheck", (t, e) => {
|
|
2122
|
+
var r;
|
|
2123
|
+
t._zod ?? (t._zod = {}), t._zod.def = e, (r = t._zod).onattach ?? (r.onattach = []);
|
|
2124
|
+
}), ht = {
|
|
2113
2125
|
number: "number",
|
|
2114
2126
|
bigint: "bigint",
|
|
2115
2127
|
object: "date"
|
|
2116
2128
|
}, lt = /* @__PURE__ */ u("$ZodCheckLessThan", (t, e) => {
|
|
2117
|
-
|
|
2118
|
-
const
|
|
2119
|
-
t._zod.onattach.push((
|
|
2120
|
-
const i =
|
|
2129
|
+
w.init(t, e);
|
|
2130
|
+
const r = ht[typeof e.value];
|
|
2131
|
+
t._zod.onattach.push((n) => {
|
|
2132
|
+
const i = n._zod.bag, s = (e.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
2121
2133
|
e.value < s && (e.inclusive ? i.maximum = e.value : i.exclusiveMaximum = e.value);
|
|
2122
|
-
}), t._zod.check = (
|
|
2123
|
-
(e.inclusive ?
|
|
2124
|
-
origin:
|
|
2134
|
+
}), t._zod.check = (n) => {
|
|
2135
|
+
(e.inclusive ? n.value <= e.value : n.value < e.value) || n.issues.push({
|
|
2136
|
+
origin: r,
|
|
2125
2137
|
code: "too_big",
|
|
2126
2138
|
maximum: e.value,
|
|
2127
|
-
input:
|
|
2139
|
+
input: n.value,
|
|
2128
2140
|
inclusive: e.inclusive,
|
|
2129
2141
|
inst: t,
|
|
2130
2142
|
continue: !e.abort
|
|
2131
2143
|
});
|
|
2132
2144
|
};
|
|
2133
2145
|
}), dt = /* @__PURE__ */ u("$ZodCheckGreaterThan", (t, e) => {
|
|
2134
|
-
|
|
2135
|
-
const
|
|
2136
|
-
t._zod.onattach.push((
|
|
2137
|
-
const i =
|
|
2146
|
+
w.init(t, e);
|
|
2147
|
+
const r = ht[typeof e.value];
|
|
2148
|
+
t._zod.onattach.push((n) => {
|
|
2149
|
+
const i = n._zod.bag, s = (e.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
2138
2150
|
e.value > s && (e.inclusive ? i.minimum = e.value : i.exclusiveMinimum = e.value);
|
|
2139
|
-
}), t._zod.check = (
|
|
2140
|
-
(e.inclusive ?
|
|
2141
|
-
origin:
|
|
2151
|
+
}), t._zod.check = (n) => {
|
|
2152
|
+
(e.inclusive ? n.value >= e.value : n.value > e.value) || n.issues.push({
|
|
2153
|
+
origin: r,
|
|
2142
2154
|
code: "too_small",
|
|
2143
2155
|
minimum: e.value,
|
|
2144
|
-
input:
|
|
2156
|
+
input: n.value,
|
|
2145
2157
|
inclusive: e.inclusive,
|
|
2146
2158
|
inst: t,
|
|
2147
2159
|
continue: !e.abort
|
|
2148
2160
|
});
|
|
2149
2161
|
};
|
|
2150
|
-
}),
|
|
2151
|
-
|
|
2152
|
-
var
|
|
2153
|
-
(
|
|
2154
|
-
}), t._zod.check = (
|
|
2155
|
-
if (typeof
|
|
2162
|
+
}), Kr = /* @__PURE__ */ u("$ZodCheckMultipleOf", (t, e) => {
|
|
2163
|
+
w.init(t, e), t._zod.onattach.push((r) => {
|
|
2164
|
+
var n;
|
|
2165
|
+
(n = r._zod.bag).multipleOf ?? (n.multipleOf = e.value);
|
|
2166
|
+
}), t._zod.check = (r) => {
|
|
2167
|
+
if (typeof r.value != typeof e.value)
|
|
2156
2168
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
2157
|
-
(typeof
|
|
2158
|
-
origin: typeof
|
|
2169
|
+
(typeof r.value == "bigint" ? r.value % e.value === BigInt(0) : Qt(r.value, e.value) === 0) || r.issues.push({
|
|
2170
|
+
origin: typeof r.value,
|
|
2159
2171
|
code: "not_multiple_of",
|
|
2160
2172
|
divisor: e.value,
|
|
2161
|
-
input:
|
|
2173
|
+
input: r.value,
|
|
2162
2174
|
inst: t,
|
|
2163
2175
|
continue: !e.abort
|
|
2164
2176
|
});
|
|
2165
2177
|
};
|
|
2166
|
-
}),
|
|
2167
|
-
|
|
2168
|
-
const
|
|
2178
|
+
}), Yr = /* @__PURE__ */ u("$ZodCheckNumberFormat", (t, e) => {
|
|
2179
|
+
w.init(t, e), e.format = e.format || "float64";
|
|
2180
|
+
const r = e.format?.includes("int"), n = r ? "int" : "number", [i, s] = nr[e.format];
|
|
2169
2181
|
t._zod.onattach.push((o) => {
|
|
2170
2182
|
const a = o._zod.bag;
|
|
2171
|
-
a.format = e.format, a.minimum = i, a.maximum = s,
|
|
2183
|
+
a.format = e.format, a.minimum = i, a.maximum = s, r && (a.pattern = Vr);
|
|
2172
2184
|
}), t._zod.check = (o) => {
|
|
2173
2185
|
const a = o.value;
|
|
2174
|
-
if (
|
|
2186
|
+
if (r) {
|
|
2175
2187
|
if (!Number.isInteger(a)) {
|
|
2176
2188
|
o.issues.push({
|
|
2177
|
-
expected:
|
|
2189
|
+
expected: n,
|
|
2178
2190
|
format: e.format,
|
|
2179
2191
|
code: "invalid_type",
|
|
2180
2192
|
continue: !1,
|
|
@@ -2190,7 +2202,7 @@ const Vn = (t) => {
|
|
|
2190
2202
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
2191
2203
|
note: "Integers must be within the safe integer range.",
|
|
2192
2204
|
inst: t,
|
|
2193
|
-
origin:
|
|
2205
|
+
origin: n,
|
|
2194
2206
|
continue: !e.abort
|
|
2195
2207
|
}) : o.issues.push({
|
|
2196
2208
|
input: a,
|
|
@@ -2198,7 +2210,7 @@ const Vn = (t) => {
|
|
|
2198
2210
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
2199
2211
|
note: "Integers must be within the safe integer range.",
|
|
2200
2212
|
inst: t,
|
|
2201
|
-
origin:
|
|
2213
|
+
origin: n,
|
|
2202
2214
|
continue: !e.abort
|
|
2203
2215
|
});
|
|
2204
2216
|
return;
|
|
@@ -2220,20 +2232,20 @@ const Vn = (t) => {
|
|
|
2220
2232
|
inst: t
|
|
2221
2233
|
});
|
|
2222
2234
|
};
|
|
2223
|
-
}),
|
|
2224
|
-
var
|
|
2225
|
-
|
|
2226
|
-
const i =
|
|
2235
|
+
}), qr = /* @__PURE__ */ u("$ZodCheckMaxLength", (t, e) => {
|
|
2236
|
+
var r;
|
|
2237
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2238
|
+
const i = n.value;
|
|
2227
2239
|
return !me(i) && i.length !== void 0;
|
|
2228
|
-
}), t._zod.onattach.push((
|
|
2229
|
-
const i =
|
|
2230
|
-
e.maximum < i && (
|
|
2231
|
-
}), t._zod.check = (
|
|
2232
|
-
const i =
|
|
2240
|
+
}), t._zod.onattach.push((n) => {
|
|
2241
|
+
const i = n._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
2242
|
+
e.maximum < i && (n._zod.bag.maximum = e.maximum);
|
|
2243
|
+
}), t._zod.check = (n) => {
|
|
2244
|
+
const i = n.value;
|
|
2233
2245
|
if (i.length <= e.maximum)
|
|
2234
2246
|
return;
|
|
2235
2247
|
const o = ve(i);
|
|
2236
|
-
|
|
2248
|
+
n.issues.push({
|
|
2237
2249
|
origin: o,
|
|
2238
2250
|
code: "too_big",
|
|
2239
2251
|
maximum: e.maximum,
|
|
@@ -2243,20 +2255,20 @@ const Vn = (t) => {
|
|
|
2243
2255
|
continue: !e.abort
|
|
2244
2256
|
});
|
|
2245
2257
|
};
|
|
2246
|
-
}),
|
|
2247
|
-
var
|
|
2248
|
-
|
|
2249
|
-
const i =
|
|
2258
|
+
}), Xr = /* @__PURE__ */ u("$ZodCheckMinLength", (t, e) => {
|
|
2259
|
+
var r;
|
|
2260
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2261
|
+
const i = n.value;
|
|
2250
2262
|
return !me(i) && i.length !== void 0;
|
|
2251
|
-
}), t._zod.onattach.push((
|
|
2252
|
-
const i =
|
|
2253
|
-
e.minimum > i && (
|
|
2254
|
-
}), t._zod.check = (
|
|
2255
|
-
const i =
|
|
2263
|
+
}), t._zod.onattach.push((n) => {
|
|
2264
|
+
const i = n._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
2265
|
+
e.minimum > i && (n._zod.bag.minimum = e.minimum);
|
|
2266
|
+
}), t._zod.check = (n) => {
|
|
2267
|
+
const i = n.value;
|
|
2256
2268
|
if (i.length >= e.minimum)
|
|
2257
2269
|
return;
|
|
2258
2270
|
const o = ve(i);
|
|
2259
|
-
|
|
2271
|
+
n.issues.push({
|
|
2260
2272
|
origin: o,
|
|
2261
2273
|
code: "too_small",
|
|
2262
2274
|
minimum: e.minimum,
|
|
@@ -2266,35 +2278,35 @@ const Vn = (t) => {
|
|
|
2266
2278
|
continue: !e.abort
|
|
2267
2279
|
});
|
|
2268
2280
|
};
|
|
2269
|
-
}),
|
|
2270
|
-
var
|
|
2271
|
-
|
|
2272
|
-
const i =
|
|
2281
|
+
}), Qr = /* @__PURE__ */ u("$ZodCheckLengthEquals", (t, e) => {
|
|
2282
|
+
var r;
|
|
2283
|
+
w.init(t, e), (r = t._zod.def).when ?? (r.when = (n) => {
|
|
2284
|
+
const i = n.value;
|
|
2273
2285
|
return !me(i) && i.length !== void 0;
|
|
2274
|
-
}), t._zod.onattach.push((
|
|
2275
|
-
const i =
|
|
2286
|
+
}), t._zod.onattach.push((n) => {
|
|
2287
|
+
const i = n._zod.bag;
|
|
2276
2288
|
i.minimum = e.length, i.maximum = e.length, i.length = e.length;
|
|
2277
|
-
}), t._zod.check = (
|
|
2278
|
-
const i =
|
|
2289
|
+
}), t._zod.check = (n) => {
|
|
2290
|
+
const i = n.value, s = i.length;
|
|
2279
2291
|
if (s === e.length)
|
|
2280
2292
|
return;
|
|
2281
2293
|
const o = ve(i), a = s > e.length;
|
|
2282
|
-
|
|
2294
|
+
n.issues.push({
|
|
2283
2295
|
origin: o,
|
|
2284
2296
|
...a ? { code: "too_big", maximum: e.length } : { code: "too_small", minimum: e.length },
|
|
2285
2297
|
inclusive: !0,
|
|
2286
2298
|
exact: !0,
|
|
2287
|
-
input:
|
|
2299
|
+
input: n.value,
|
|
2288
2300
|
inst: t,
|
|
2289
2301
|
continue: !e.abort
|
|
2290
2302
|
});
|
|
2291
2303
|
};
|
|
2292
2304
|
}), oe = /* @__PURE__ */ u("$ZodCheckStringFormat", (t, e) => {
|
|
2293
|
-
var
|
|
2294
|
-
|
|
2305
|
+
var r, n;
|
|
2306
|
+
w.init(t, e), t._zod.onattach.push((i) => {
|
|
2295
2307
|
const s = i._zod.bag;
|
|
2296
2308
|
s.format = e.format, e.pattern && (s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(e.pattern));
|
|
2297
|
-
}), e.pattern ? (
|
|
2309
|
+
}), e.pattern ? (r = t._zod).check ?? (r.check = (i) => {
|
|
2298
2310
|
e.pattern.lastIndex = 0, !e.pattern.test(i.value) && i.issues.push({
|
|
2299
2311
|
origin: "string",
|
|
2300
2312
|
code: "invalid_format",
|
|
@@ -2304,30 +2316,30 @@ const Vn = (t) => {
|
|
|
2304
2316
|
inst: t,
|
|
2305
2317
|
continue: !e.abort
|
|
2306
2318
|
});
|
|
2307
|
-
}) : (
|
|
2319
|
+
}) : (n = t._zod).check ?? (n.check = () => {
|
|
2308
2320
|
});
|
|
2309
|
-
}),
|
|
2310
|
-
oe.init(t, e), t._zod.check = (
|
|
2311
|
-
e.pattern.lastIndex = 0, !e.pattern.test(
|
|
2321
|
+
}), Hr = /* @__PURE__ */ u("$ZodCheckRegex", (t, e) => {
|
|
2322
|
+
oe.init(t, e), t._zod.check = (r) => {
|
|
2323
|
+
e.pattern.lastIndex = 0, !e.pattern.test(r.value) && r.issues.push({
|
|
2312
2324
|
origin: "string",
|
|
2313
2325
|
code: "invalid_format",
|
|
2314
2326
|
format: "regex",
|
|
2315
|
-
input:
|
|
2327
|
+
input: r.value,
|
|
2316
2328
|
pattern: e.pattern.toString(),
|
|
2317
2329
|
inst: t,
|
|
2318
2330
|
continue: !e.abort
|
|
2319
2331
|
});
|
|
2320
2332
|
};
|
|
2321
|
-
}),
|
|
2322
|
-
e.pattern ?? (e.pattern =
|
|
2323
|
-
}),
|
|
2324
|
-
e.pattern ?? (e.pattern =
|
|
2325
|
-
}),
|
|
2326
|
-
|
|
2327
|
-
const
|
|
2328
|
-
e.pattern =
|
|
2333
|
+
}), en = /* @__PURE__ */ u("$ZodCheckLowerCase", (t, e) => {
|
|
2334
|
+
e.pattern ?? (e.pattern = Jr), oe.init(t, e);
|
|
2335
|
+
}), tn = /* @__PURE__ */ u("$ZodCheckUpperCase", (t, e) => {
|
|
2336
|
+
e.pattern ?? (e.pattern = Wr), oe.init(t, e);
|
|
2337
|
+
}), rn = /* @__PURE__ */ u("$ZodCheckIncludes", (t, e) => {
|
|
2338
|
+
w.init(t, e);
|
|
2339
|
+
const r = j(e.includes), n = new RegExp(typeof e.position == "number" ? `^.{${e.position}}${r}` : r);
|
|
2340
|
+
e.pattern = n, t._zod.onattach.push((i) => {
|
|
2329
2341
|
const s = i._zod.bag;
|
|
2330
|
-
s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(
|
|
2342
|
+
s.patterns ?? (s.patterns = /* @__PURE__ */ new Set()), s.patterns.add(n);
|
|
2331
2343
|
}), t._zod.check = (i) => {
|
|
2332
2344
|
i.value.includes(e.includes, e.position) || i.issues.push({
|
|
2333
2345
|
origin: "string",
|
|
@@ -2339,46 +2351,46 @@ const Vn = (t) => {
|
|
|
2339
2351
|
continue: !e.abort
|
|
2340
2352
|
});
|
|
2341
2353
|
};
|
|
2342
|
-
}),
|
|
2343
|
-
|
|
2344
|
-
const
|
|
2345
|
-
e.pattern ?? (e.pattern =
|
|
2346
|
-
const i =
|
|
2347
|
-
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(
|
|
2348
|
-
}), t._zod.check = (
|
|
2349
|
-
|
|
2354
|
+
}), nn = /* @__PURE__ */ u("$ZodCheckStartsWith", (t, e) => {
|
|
2355
|
+
w.init(t, e);
|
|
2356
|
+
const r = new RegExp(`^${j(e.prefix)}.*`);
|
|
2357
|
+
e.pattern ?? (e.pattern = r), t._zod.onattach.push((n) => {
|
|
2358
|
+
const i = n._zod.bag;
|
|
2359
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
2360
|
+
}), t._zod.check = (n) => {
|
|
2361
|
+
n.value.startsWith(e.prefix) || n.issues.push({
|
|
2350
2362
|
origin: "string",
|
|
2351
2363
|
code: "invalid_format",
|
|
2352
2364
|
format: "starts_with",
|
|
2353
2365
|
prefix: e.prefix,
|
|
2354
|
-
input:
|
|
2366
|
+
input: n.value,
|
|
2355
2367
|
inst: t,
|
|
2356
2368
|
continue: !e.abort
|
|
2357
2369
|
});
|
|
2358
2370
|
};
|
|
2359
|
-
}),
|
|
2360
|
-
|
|
2361
|
-
const
|
|
2362
|
-
e.pattern ?? (e.pattern =
|
|
2363
|
-
const i =
|
|
2364
|
-
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(
|
|
2365
|
-
}), t._zod.check = (
|
|
2366
|
-
|
|
2371
|
+
}), sn = /* @__PURE__ */ u("$ZodCheckEndsWith", (t, e) => {
|
|
2372
|
+
w.init(t, e);
|
|
2373
|
+
const r = new RegExp(`.*${j(e.suffix)}$`);
|
|
2374
|
+
e.pattern ?? (e.pattern = r), t._zod.onattach.push((n) => {
|
|
2375
|
+
const i = n._zod.bag;
|
|
2376
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
2377
|
+
}), t._zod.check = (n) => {
|
|
2378
|
+
n.value.endsWith(e.suffix) || n.issues.push({
|
|
2367
2379
|
origin: "string",
|
|
2368
2380
|
code: "invalid_format",
|
|
2369
2381
|
format: "ends_with",
|
|
2370
2382
|
suffix: e.suffix,
|
|
2371
|
-
input:
|
|
2383
|
+
input: n.value,
|
|
2372
2384
|
inst: t,
|
|
2373
2385
|
continue: !e.abort
|
|
2374
2386
|
});
|
|
2375
2387
|
};
|
|
2376
|
-
}),
|
|
2377
|
-
|
|
2378
|
-
|
|
2388
|
+
}), on = /* @__PURE__ */ u("$ZodCheckOverwrite", (t, e) => {
|
|
2389
|
+
w.init(t, e), t._zod.check = (r) => {
|
|
2390
|
+
r.value = e.tx(r.value);
|
|
2379
2391
|
};
|
|
2380
2392
|
});
|
|
2381
|
-
class
|
|
2393
|
+
class an {
|
|
2382
2394
|
constructor(e = []) {
|
|
2383
2395
|
this.content = [], this.indent = 0, this && (this.args = e);
|
|
2384
2396
|
}
|
|
@@ -2390,116 +2402,116 @@ class ar {
|
|
|
2390
2402
|
e(this, { execution: "sync" }), e(this, { execution: "async" });
|
|
2391
2403
|
return;
|
|
2392
2404
|
}
|
|
2393
|
-
const
|
|
2394
|
-
`).filter((o) => o), i = Math.min(...
|
|
2405
|
+
const n = e.split(`
|
|
2406
|
+
`).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);
|
|
2395
2407
|
for (const o of s)
|
|
2396
2408
|
this.content.push(o);
|
|
2397
2409
|
}
|
|
2398
2410
|
compile() {
|
|
2399
|
-
const e = Function,
|
|
2400
|
-
return new e(...
|
|
2411
|
+
const e = Function, r = this?.args, i = [...(this?.content ?? [""]).map((s) => ` ${s}`)];
|
|
2412
|
+
return new e(...r, i.join(`
|
|
2401
2413
|
`));
|
|
2402
2414
|
}
|
|
2403
2415
|
}
|
|
2404
|
-
const
|
|
2416
|
+
const cn = {
|
|
2405
2417
|
major: 4,
|
|
2406
2418
|
minor: 2,
|
|
2407
2419
|
patch: 1
|
|
2408
2420
|
}, k = /* @__PURE__ */ u("$ZodType", (t, e) => {
|
|
2409
|
-
var
|
|
2410
|
-
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version =
|
|
2411
|
-
const
|
|
2412
|
-
t._zod.traits.has("$ZodCheck") &&
|
|
2413
|
-
for (const i of
|
|
2421
|
+
var r;
|
|
2422
|
+
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version = cn;
|
|
2423
|
+
const n = [...t._zod.def.checks ?? []];
|
|
2424
|
+
t._zod.traits.has("$ZodCheck") && n.unshift(t);
|
|
2425
|
+
for (const i of n)
|
|
2414
2426
|
for (const s of i._zod.onattach)
|
|
2415
2427
|
s(t);
|
|
2416
|
-
if (
|
|
2417
|
-
(
|
|
2428
|
+
if (n.length === 0)
|
|
2429
|
+
(r = t._zod).deferred ?? (r.deferred = []), t._zod.deferred?.push(() => {
|
|
2418
2430
|
t._zod.run = t._zod.parse;
|
|
2419
2431
|
});
|
|
2420
2432
|
else {
|
|
2421
2433
|
const i = (o, a, c) => {
|
|
2422
|
-
let
|
|
2434
|
+
let p = F(o), h;
|
|
2423
2435
|
for (const d of a) {
|
|
2424
2436
|
if (d._zod.def.when) {
|
|
2425
2437
|
if (!d._zod.def.when(o))
|
|
2426
2438
|
continue;
|
|
2427
|
-
} else if (
|
|
2439
|
+
} else if (p)
|
|
2428
2440
|
continue;
|
|
2429
|
-
const f = o.issues.length,
|
|
2430
|
-
if (
|
|
2431
|
-
throw new
|
|
2432
|
-
if (
|
|
2433
|
-
|
|
2434
|
-
await
|
|
2441
|
+
const f = o.issues.length, g = d._zod.check(o);
|
|
2442
|
+
if (g instanceof Promise && c?.async === !1)
|
|
2443
|
+
throw new M();
|
|
2444
|
+
if (h || g instanceof Promise)
|
|
2445
|
+
h = (h ?? Promise.resolve()).then(async () => {
|
|
2446
|
+
await g, o.issues.length !== f && (p || (p = F(o, f)));
|
|
2435
2447
|
});
|
|
2436
2448
|
else {
|
|
2437
2449
|
if (o.issues.length === f)
|
|
2438
2450
|
continue;
|
|
2439
|
-
|
|
2451
|
+
p || (p = F(o, f));
|
|
2440
2452
|
}
|
|
2441
2453
|
}
|
|
2442
|
-
return
|
|
2454
|
+
return h ? h.then(() => o) : o;
|
|
2443
2455
|
}, s = (o, a, c) => {
|
|
2444
2456
|
if (F(o))
|
|
2445
2457
|
return o.aborted = !0, o;
|
|
2446
|
-
const
|
|
2447
|
-
if (
|
|
2458
|
+
const p = i(a, n, c);
|
|
2459
|
+
if (p instanceof Promise) {
|
|
2448
2460
|
if (c.async === !1)
|
|
2449
|
-
throw new
|
|
2450
|
-
return
|
|
2461
|
+
throw new M();
|
|
2462
|
+
return p.then((h) => t._zod.parse(h, c));
|
|
2451
2463
|
}
|
|
2452
|
-
return t._zod.parse(
|
|
2464
|
+
return t._zod.parse(p, c);
|
|
2453
2465
|
};
|
|
2454
2466
|
t._zod.run = (o, a) => {
|
|
2455
2467
|
if (a.skipChecks)
|
|
2456
2468
|
return t._zod.parse(o, a);
|
|
2457
2469
|
if (a.direction === "backward") {
|
|
2458
|
-
const
|
|
2459
|
-
return
|
|
2470
|
+
const p = t._zod.parse({ value: o.value, issues: [] }, { ...a, skipChecks: !0 });
|
|
2471
|
+
return p instanceof Promise ? p.then((h) => s(h, o, a)) : s(p, o, a);
|
|
2460
2472
|
}
|
|
2461
2473
|
const c = t._zod.parse(o, a);
|
|
2462
2474
|
if (c instanceof Promise) {
|
|
2463
2475
|
if (a.async === !1)
|
|
2464
|
-
throw new
|
|
2465
|
-
return c.then((
|
|
2476
|
+
throw new M();
|
|
2477
|
+
return c.then((p) => i(p, n, a));
|
|
2466
2478
|
}
|
|
2467
|
-
return i(c,
|
|
2479
|
+
return i(c, n, a);
|
|
2468
2480
|
};
|
|
2469
2481
|
}
|
|
2470
2482
|
t["~standard"] = {
|
|
2471
2483
|
validate: (i) => {
|
|
2472
2484
|
try {
|
|
2473
|
-
const s =
|
|
2485
|
+
const s = dr(t, i);
|
|
2474
2486
|
return s.success ? { value: s.data } : { issues: s.error?.issues };
|
|
2475
2487
|
} catch {
|
|
2476
|
-
return
|
|
2488
|
+
return fr(t, i).then((o) => o.success ? { value: o.data } : { issues: o.error?.issues });
|
|
2477
2489
|
}
|
|
2478
2490
|
},
|
|
2479
2491
|
vendor: "zod",
|
|
2480
2492
|
version: 1
|
|
2481
2493
|
};
|
|
2482
2494
|
}), ye = /* @__PURE__ */ u("$ZodString", (t, e) => {
|
|
2483
|
-
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ??
|
|
2495
|
+
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ?? Gr(t._zod.bag), t._zod.parse = (r, n) => {
|
|
2484
2496
|
if (e.coerce)
|
|
2485
2497
|
try {
|
|
2486
|
-
|
|
2498
|
+
r.value = String(r.value);
|
|
2487
2499
|
} catch {
|
|
2488
2500
|
}
|
|
2489
|
-
return typeof
|
|
2501
|
+
return typeof r.value == "string" || r.issues.push({
|
|
2490
2502
|
expected: "string",
|
|
2491
2503
|
code: "invalid_type",
|
|
2492
|
-
input:
|
|
2504
|
+
input: r.value,
|
|
2493
2505
|
inst: t
|
|
2494
|
-
}),
|
|
2506
|
+
}), r;
|
|
2495
2507
|
};
|
|
2496
|
-
}),
|
|
2508
|
+
}), v = /* @__PURE__ */ u("$ZodStringFormat", (t, e) => {
|
|
2497
2509
|
oe.init(t, e), ye.init(t, e);
|
|
2498
|
-
}),
|
|
2499
|
-
e.pattern ?? (e.pattern =
|
|
2500
|
-
}),
|
|
2510
|
+
}), un = /* @__PURE__ */ u("$ZodGUID", (t, e) => {
|
|
2511
|
+
e.pattern ?? (e.pattern = Sr), v.init(t, e);
|
|
2512
|
+
}), pn = /* @__PURE__ */ u("$ZodUUID", (t, e) => {
|
|
2501
2513
|
if (e.version) {
|
|
2502
|
-
const
|
|
2514
|
+
const n = {
|
|
2503
2515
|
v1: 1,
|
|
2504
2516
|
v2: 2,
|
|
2505
2517
|
v3: 3,
|
|
@@ -2509,93 +2521,93 @@ const cr = {
|
|
|
2509
2521
|
v7: 7,
|
|
2510
2522
|
v8: 8
|
|
2511
2523
|
}[e.version];
|
|
2512
|
-
if (
|
|
2524
|
+
if (n === void 0)
|
|
2513
2525
|
throw new Error(`Invalid UUID version: "${e.version}"`);
|
|
2514
|
-
e.pattern ?? (e.pattern = ze(
|
|
2526
|
+
e.pattern ?? (e.pattern = ze(n));
|
|
2515
2527
|
} else
|
|
2516
2528
|
e.pattern ?? (e.pattern = ze());
|
|
2517
|
-
|
|
2518
|
-
}),
|
|
2519
|
-
e.pattern ?? (e.pattern =
|
|
2520
|
-
}),
|
|
2521
|
-
|
|
2529
|
+
v.init(t, e);
|
|
2530
|
+
}), hn = /* @__PURE__ */ u("$ZodEmail", (t, e) => {
|
|
2531
|
+
e.pattern ?? (e.pattern = Nr), v.init(t, e);
|
|
2532
|
+
}), ln = /* @__PURE__ */ u("$ZodURL", (t, e) => {
|
|
2533
|
+
v.init(t, e), t._zod.check = (r) => {
|
|
2522
2534
|
try {
|
|
2523
|
-
const
|
|
2524
|
-
e.hostname && (e.hostname.lastIndex = 0, e.hostname.test(i.hostname) ||
|
|
2535
|
+
const n = r.value.trim(), i = new URL(n);
|
|
2536
|
+
e.hostname && (e.hostname.lastIndex = 0, e.hostname.test(i.hostname) || r.issues.push({
|
|
2525
2537
|
code: "invalid_format",
|
|
2526
2538
|
format: "url",
|
|
2527
2539
|
note: "Invalid hostname",
|
|
2528
2540
|
pattern: e.hostname.source,
|
|
2529
|
-
input:
|
|
2541
|
+
input: r.value,
|
|
2530
2542
|
inst: t,
|
|
2531
2543
|
continue: !e.abort
|
|
2532
|
-
})), e.protocol && (e.protocol.lastIndex = 0, e.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) ||
|
|
2544
|
+
})), e.protocol && (e.protocol.lastIndex = 0, e.protocol.test(i.protocol.endsWith(":") ? i.protocol.slice(0, -1) : i.protocol) || r.issues.push({
|
|
2533
2545
|
code: "invalid_format",
|
|
2534
2546
|
format: "url",
|
|
2535
2547
|
note: "Invalid protocol",
|
|
2536
2548
|
pattern: e.protocol.source,
|
|
2537
|
-
input:
|
|
2549
|
+
input: r.value,
|
|
2538
2550
|
inst: t,
|
|
2539
2551
|
continue: !e.abort
|
|
2540
|
-
})), e.normalize ?
|
|
2552
|
+
})), e.normalize ? r.value = i.href : r.value = n;
|
|
2541
2553
|
return;
|
|
2542
2554
|
} catch {
|
|
2543
|
-
|
|
2555
|
+
r.issues.push({
|
|
2544
2556
|
code: "invalid_format",
|
|
2545
2557
|
format: "url",
|
|
2546
|
-
input:
|
|
2558
|
+
input: r.value,
|
|
2547
2559
|
inst: t,
|
|
2548
2560
|
continue: !e.abort
|
|
2549
2561
|
});
|
|
2550
2562
|
}
|
|
2551
2563
|
};
|
|
2552
|
-
}),
|
|
2553
|
-
e.pattern ?? (e.pattern =
|
|
2554
|
-
}),
|
|
2555
|
-
e.pattern ?? (e.pattern =
|
|
2556
|
-
}),
|
|
2557
|
-
e.pattern ?? (e.pattern =
|
|
2558
|
-
}),
|
|
2559
|
-
e.pattern ?? (e.pattern =
|
|
2560
|
-
}),
|
|
2561
|
-
e.pattern ?? (e.pattern =
|
|
2562
|
-
}),
|
|
2563
|
-
e.pattern ?? (e.pattern =
|
|
2564
|
-
}),
|
|
2565
|
-
e.pattern ?? (e.pattern =
|
|
2566
|
-
}),
|
|
2567
|
-
e.pattern ?? (e.pattern =
|
|
2568
|
-
}),
|
|
2569
|
-
e.pattern ?? (e.pattern =
|
|
2570
|
-
}),
|
|
2571
|
-
e.pattern ?? (e.pattern =
|
|
2572
|
-
}),
|
|
2573
|
-
e.pattern ?? (e.pattern =
|
|
2574
|
-
}),
|
|
2575
|
-
e.pattern ?? (e.pattern =
|
|
2576
|
-
}),
|
|
2577
|
-
e.pattern ?? (e.pattern =
|
|
2564
|
+
}), dn = /* @__PURE__ */ u("$ZodEmoji", (t, e) => {
|
|
2565
|
+
e.pattern ?? (e.pattern = Zr()), v.init(t, e);
|
|
2566
|
+
}), fn = /* @__PURE__ */ u("$ZodNanoID", (t, e) => {
|
|
2567
|
+
e.pattern ?? (e.pattern = Or), v.init(t, e);
|
|
2568
|
+
}), mn = /* @__PURE__ */ u("$ZodCUID", (t, e) => {
|
|
2569
|
+
e.pattern ?? (e.pattern = wr), v.init(t, e);
|
|
2570
|
+
}), gn = /* @__PURE__ */ u("$ZodCUID2", (t, e) => {
|
|
2571
|
+
e.pattern ?? (e.pattern = Ir), v.init(t, e);
|
|
2572
|
+
}), vn = /* @__PURE__ */ u("$ZodULID", (t, e) => {
|
|
2573
|
+
e.pattern ?? (e.pattern = Er), v.init(t, e);
|
|
2574
|
+
}), _n = /* @__PURE__ */ u("$ZodXID", (t, e) => {
|
|
2575
|
+
e.pattern ?? (e.pattern = zr), v.init(t, e);
|
|
2576
|
+
}), kn = /* @__PURE__ */ u("$ZodKSUID", (t, e) => {
|
|
2577
|
+
e.pattern ?? (e.pattern = $r), v.init(t, e);
|
|
2578
|
+
}), yn = /* @__PURE__ */ u("$ZodISODateTime", (t, e) => {
|
|
2579
|
+
e.pattern ?? (e.pattern = Ur(e)), v.init(t, e);
|
|
2580
|
+
}), Tn = /* @__PURE__ */ u("$ZodISODate", (t, e) => {
|
|
2581
|
+
e.pattern ?? (e.pattern = Mr), v.init(t, e);
|
|
2582
|
+
}), bn = /* @__PURE__ */ u("$ZodISOTime", (t, e) => {
|
|
2583
|
+
e.pattern ?? (e.pattern = jr(e)), v.init(t, e);
|
|
2584
|
+
}), wn = /* @__PURE__ */ u("$ZodISODuration", (t, e) => {
|
|
2585
|
+
e.pattern ?? (e.pattern = Pr), v.init(t, e);
|
|
2586
|
+
}), In = /* @__PURE__ */ u("$ZodIPv4", (t, e) => {
|
|
2587
|
+
e.pattern ?? (e.pattern = Cr), v.init(t, e), t._zod.bag.format = "ipv4";
|
|
2588
|
+
}), En = /* @__PURE__ */ u("$ZodIPv6", (t, e) => {
|
|
2589
|
+
e.pattern ?? (e.pattern = Rr), v.init(t, e), t._zod.bag.format = "ipv6", t._zod.check = (r) => {
|
|
2578
2590
|
try {
|
|
2579
|
-
new URL(`http://[${
|
|
2591
|
+
new URL(`http://[${r.value}]`);
|
|
2580
2592
|
} catch {
|
|
2581
|
-
|
|
2593
|
+
r.issues.push({
|
|
2582
2594
|
code: "invalid_format",
|
|
2583
2595
|
format: "ipv6",
|
|
2584
|
-
input:
|
|
2596
|
+
input: r.value,
|
|
2585
2597
|
inst: t,
|
|
2586
2598
|
continue: !e.abort
|
|
2587
2599
|
});
|
|
2588
2600
|
}
|
|
2589
2601
|
};
|
|
2590
|
-
}),
|
|
2591
|
-
e.pattern ?? (e.pattern =
|
|
2592
|
-
}), $
|
|
2593
|
-
e.pattern ?? (e.pattern =
|
|
2594
|
-
const
|
|
2602
|
+
}), zn = /* @__PURE__ */ u("$ZodCIDRv4", (t, e) => {
|
|
2603
|
+
e.pattern ?? (e.pattern = xr), v.init(t, e);
|
|
2604
|
+
}), $n = /* @__PURE__ */ u("$ZodCIDRv6", (t, e) => {
|
|
2605
|
+
e.pattern ?? (e.pattern = Lr), v.init(t, e), t._zod.check = (r) => {
|
|
2606
|
+
const n = r.value.split("/");
|
|
2595
2607
|
try {
|
|
2596
|
-
if (
|
|
2608
|
+
if (n.length !== 2)
|
|
2597
2609
|
throw new Error();
|
|
2598
|
-
const [i, s] =
|
|
2610
|
+
const [i, s] = n;
|
|
2599
2611
|
if (!s)
|
|
2600
2612
|
throw new Error();
|
|
2601
2613
|
const o = Number(s);
|
|
@@ -2605,10 +2617,10 @@ const cr = {
|
|
|
2605
2617
|
throw new Error();
|
|
2606
2618
|
new URL(`http://[${i}]`);
|
|
2607
2619
|
} catch {
|
|
2608
|
-
|
|
2620
|
+
r.issues.push({
|
|
2609
2621
|
code: "invalid_format",
|
|
2610
2622
|
format: "cidrv6",
|
|
2611
|
-
input:
|
|
2623
|
+
input: r.value,
|
|
2612
2624
|
inst: t,
|
|
2613
2625
|
continue: !e.abort
|
|
2614
2626
|
});
|
|
@@ -2626,153 +2638,153 @@ function ft(t) {
|
|
|
2626
2638
|
return !1;
|
|
2627
2639
|
}
|
|
2628
2640
|
}
|
|
2629
|
-
const
|
|
2630
|
-
e.pattern ?? (e.pattern =
|
|
2631
|
-
ft(
|
|
2641
|
+
const On = /* @__PURE__ */ u("$ZodBase64", (t, e) => {
|
|
2642
|
+
e.pattern ?? (e.pattern = Dr), v.init(t, e), t._zod.bag.contentEncoding = "base64", t._zod.check = (r) => {
|
|
2643
|
+
ft(r.value) || r.issues.push({
|
|
2632
2644
|
code: "invalid_format",
|
|
2633
2645
|
format: "base64",
|
|
2634
|
-
input:
|
|
2646
|
+
input: r.value,
|
|
2635
2647
|
inst: t,
|
|
2636
2648
|
continue: !e.abort
|
|
2637
2649
|
});
|
|
2638
2650
|
};
|
|
2639
2651
|
});
|
|
2640
|
-
function
|
|
2652
|
+
function Pn(t) {
|
|
2641
2653
|
if (!ct.test(t))
|
|
2642
2654
|
return !1;
|
|
2643
|
-
const e = t.replace(/[-_]/g, (
|
|
2644
|
-
return ft(
|
|
2655
|
+
const e = t.replace(/[-_]/g, (n) => n === "-" ? "+" : "/"), r = e.padEnd(Math.ceil(e.length / 4) * 4, "=");
|
|
2656
|
+
return ft(r);
|
|
2645
2657
|
}
|
|
2646
|
-
const
|
|
2647
|
-
e.pattern ?? (e.pattern = ct),
|
|
2648
|
-
|
|
2658
|
+
const Sn = /* @__PURE__ */ u("$ZodBase64URL", (t, e) => {
|
|
2659
|
+
e.pattern ?? (e.pattern = ct), v.init(t, e), t._zod.bag.contentEncoding = "base64url", t._zod.check = (r) => {
|
|
2660
|
+
Pn(r.value) || r.issues.push({
|
|
2649
2661
|
code: "invalid_format",
|
|
2650
2662
|
format: "base64url",
|
|
2651
|
-
input:
|
|
2663
|
+
input: r.value,
|
|
2652
2664
|
inst: t,
|
|
2653
2665
|
continue: !e.abort
|
|
2654
2666
|
});
|
|
2655
2667
|
};
|
|
2656
|
-
}),
|
|
2657
|
-
e.pattern ?? (e.pattern =
|
|
2668
|
+
}), Nn = /* @__PURE__ */ u("$ZodE164", (t, e) => {
|
|
2669
|
+
e.pattern ?? (e.pattern = Fr), v.init(t, e);
|
|
2658
2670
|
});
|
|
2659
|
-
function
|
|
2671
|
+
function An(t, e = null) {
|
|
2660
2672
|
try {
|
|
2661
|
-
const
|
|
2662
|
-
if (
|
|
2673
|
+
const r = t.split(".");
|
|
2674
|
+
if (r.length !== 3)
|
|
2663
2675
|
return !1;
|
|
2664
|
-
const [
|
|
2665
|
-
if (!
|
|
2676
|
+
const [n] = r;
|
|
2677
|
+
if (!n)
|
|
2666
2678
|
return !1;
|
|
2667
|
-
const i = JSON.parse(atob(
|
|
2679
|
+
const i = JSON.parse(atob(n));
|
|
2668
2680
|
return !("typ" in i && i?.typ !== "JWT" || !i.alg || e && (!("alg" in i) || i.alg !== e));
|
|
2669
2681
|
} catch {
|
|
2670
2682
|
return !1;
|
|
2671
2683
|
}
|
|
2672
2684
|
}
|
|
2673
|
-
const
|
|
2674
|
-
|
|
2675
|
-
|
|
2685
|
+
const Zn = /* @__PURE__ */ u("$ZodJWT", (t, e) => {
|
|
2686
|
+
v.init(t, e), t._zod.check = (r) => {
|
|
2687
|
+
An(r.value, e.alg) || r.issues.push({
|
|
2676
2688
|
code: "invalid_format",
|
|
2677
2689
|
format: "jwt",
|
|
2678
|
-
input:
|
|
2690
|
+
input: r.value,
|
|
2679
2691
|
inst: t,
|
|
2680
2692
|
continue: !e.abort
|
|
2681
2693
|
});
|
|
2682
2694
|
};
|
|
2683
2695
|
}), mt = /* @__PURE__ */ u("$ZodNumber", (t, e) => {
|
|
2684
|
-
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ??
|
|
2696
|
+
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ?? Br, t._zod.parse = (r, n) => {
|
|
2685
2697
|
if (e.coerce)
|
|
2686
2698
|
try {
|
|
2687
|
-
|
|
2699
|
+
r.value = Number(r.value);
|
|
2688
2700
|
} catch {
|
|
2689
2701
|
}
|
|
2690
|
-
const i =
|
|
2702
|
+
const i = r.value;
|
|
2691
2703
|
if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i))
|
|
2692
|
-
return
|
|
2704
|
+
return r;
|
|
2693
2705
|
const s = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : "Infinity" : void 0;
|
|
2694
|
-
return
|
|
2706
|
+
return r.issues.push({
|
|
2695
2707
|
expected: "number",
|
|
2696
2708
|
code: "invalid_type",
|
|
2697
2709
|
input: i,
|
|
2698
2710
|
inst: t,
|
|
2699
2711
|
...s ? { received: s } : {}
|
|
2700
|
-
}),
|
|
2712
|
+
}), r;
|
|
2701
2713
|
};
|
|
2702
|
-
}),
|
|
2703
|
-
|
|
2704
|
-
}),
|
|
2705
|
-
k.init(t, e), t._zod.parse = (
|
|
2706
|
-
}),
|
|
2707
|
-
k.init(t, e), t._zod.parse = (
|
|
2714
|
+
}), Cn = /* @__PURE__ */ u("$ZodNumberFormat", (t, e) => {
|
|
2715
|
+
Yr.init(t, e), mt.init(t, e);
|
|
2716
|
+
}), Rn = /* @__PURE__ */ u("$ZodUnknown", (t, e) => {
|
|
2717
|
+
k.init(t, e), t._zod.parse = (r) => r;
|
|
2718
|
+
}), xn = /* @__PURE__ */ u("$ZodNever", (t, e) => {
|
|
2719
|
+
k.init(t, e), t._zod.parse = (r, n) => (r.issues.push({
|
|
2708
2720
|
expected: "never",
|
|
2709
2721
|
code: "invalid_type",
|
|
2710
|
-
input:
|
|
2722
|
+
input: r.value,
|
|
2711
2723
|
inst: t
|
|
2712
|
-
}),
|
|
2724
|
+
}), r);
|
|
2713
2725
|
});
|
|
2714
|
-
function $e(t, e,
|
|
2715
|
-
t.issues.length && e.issues.push(...it(
|
|
2726
|
+
function $e(t, e, r) {
|
|
2727
|
+
t.issues.length && e.issues.push(...it(r, t.issues)), e.value[r] = t.value;
|
|
2716
2728
|
}
|
|
2717
|
-
const
|
|
2718
|
-
k.init(t, e), t._zod.parse = (
|
|
2719
|
-
const i =
|
|
2729
|
+
const Ln = /* @__PURE__ */ u("$ZodArray", (t, e) => {
|
|
2730
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
2731
|
+
const i = r.value;
|
|
2720
2732
|
if (!Array.isArray(i))
|
|
2721
|
-
return
|
|
2733
|
+
return r.issues.push({
|
|
2722
2734
|
expected: "array",
|
|
2723
2735
|
code: "invalid_type",
|
|
2724
2736
|
input: i,
|
|
2725
2737
|
inst: t
|
|
2726
|
-
}),
|
|
2727
|
-
|
|
2738
|
+
}), r;
|
|
2739
|
+
r.value = Array(i.length);
|
|
2728
2740
|
const s = [];
|
|
2729
2741
|
for (let o = 0; o < i.length; o++) {
|
|
2730
2742
|
const a = i[o], c = e.element._zod.run({
|
|
2731
2743
|
value: a,
|
|
2732
2744
|
issues: []
|
|
2733
|
-
},
|
|
2734
|
-
c instanceof Promise ? s.push(c.then((
|
|
2745
|
+
}, n);
|
|
2746
|
+
c instanceof Promise ? s.push(c.then((p) => $e(p, r, o))) : $e(c, r, o);
|
|
2735
2747
|
}
|
|
2736
|
-
return s.length ? Promise.all(s).then(() =>
|
|
2748
|
+
return s.length ? Promise.all(s).then(() => r) : r;
|
|
2737
2749
|
};
|
|
2738
2750
|
});
|
|
2739
|
-
function H(t, e,
|
|
2740
|
-
t.issues.length && e.issues.push(...it(
|
|
2751
|
+
function H(t, e, r, n) {
|
|
2752
|
+
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;
|
|
2741
2753
|
}
|
|
2742
2754
|
function gt(t) {
|
|
2743
2755
|
const e = Object.keys(t.shape);
|
|
2744
|
-
for (const
|
|
2745
|
-
if (!t.shape?.[
|
|
2746
|
-
throw new Error(`Invalid element at key "${
|
|
2747
|
-
const
|
|
2756
|
+
for (const n of e)
|
|
2757
|
+
if (!t.shape?.[n]?._zod?.traits?.has("$ZodType"))
|
|
2758
|
+
throw new Error(`Invalid element at key "${n}": expected a Zod schema`);
|
|
2759
|
+
const r = rr(t.shape);
|
|
2748
2760
|
return {
|
|
2749
2761
|
...t,
|
|
2750
2762
|
keys: e,
|
|
2751
2763
|
keySet: new Set(e),
|
|
2752
2764
|
numKeys: e.length,
|
|
2753
|
-
optionalKeys: new Set(
|
|
2765
|
+
optionalKeys: new Set(r)
|
|
2754
2766
|
};
|
|
2755
2767
|
}
|
|
2756
|
-
function vt(t, e,
|
|
2757
|
-
const o = [], a = i.keySet, c = i.catchall._zod,
|
|
2758
|
-
for (const
|
|
2759
|
-
if (a.has(
|
|
2768
|
+
function vt(t, e, r, n, i, s) {
|
|
2769
|
+
const o = [], a = i.keySet, c = i.catchall._zod, p = c.def.type;
|
|
2770
|
+
for (const h in e) {
|
|
2771
|
+
if (a.has(h))
|
|
2760
2772
|
continue;
|
|
2761
|
-
if (
|
|
2762
|
-
o.push(
|
|
2773
|
+
if (p === "never") {
|
|
2774
|
+
o.push(h);
|
|
2763
2775
|
continue;
|
|
2764
2776
|
}
|
|
2765
|
-
const d = c.run({ value: e[
|
|
2766
|
-
d instanceof Promise ? t.push(d.then((f) => H(f,
|
|
2777
|
+
const d = c.run({ value: e[h], issues: [] }, n);
|
|
2778
|
+
d instanceof Promise ? t.push(d.then((f) => H(f, r, h, e))) : H(d, r, h, e);
|
|
2767
2779
|
}
|
|
2768
|
-
return o.length &&
|
|
2780
|
+
return o.length && r.issues.push({
|
|
2769
2781
|
code: "unrecognized_keys",
|
|
2770
2782
|
keys: o,
|
|
2771
2783
|
input: e,
|
|
2772
2784
|
inst: s
|
|
2773
|
-
}), t.length ? Promise.all(t).then(() =>
|
|
2785
|
+
}), t.length ? Promise.all(t).then(() => r) : r;
|
|
2774
2786
|
}
|
|
2775
|
-
const
|
|
2787
|
+
const Dn = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
2776
2788
|
if (k.init(t, e), !Object.getOwnPropertyDescriptor(e, "shape")?.get) {
|
|
2777
2789
|
const a = e.shape;
|
|
2778
2790
|
Object.defineProperty(e, "shape", {
|
|
@@ -2784,15 +2796,15 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2784
2796
|
}
|
|
2785
2797
|
});
|
|
2786
2798
|
}
|
|
2787
|
-
const
|
|
2799
|
+
const n = ne(() => gt(e));
|
|
2788
2800
|
m(t._zod, "propValues", () => {
|
|
2789
2801
|
const a = e.shape, c = {};
|
|
2790
|
-
for (const
|
|
2791
|
-
const
|
|
2792
|
-
if (
|
|
2793
|
-
c[
|
|
2794
|
-
for (const d of
|
|
2795
|
-
c[
|
|
2802
|
+
for (const p in a) {
|
|
2803
|
+
const h = a[p]._zod;
|
|
2804
|
+
if (h.values) {
|
|
2805
|
+
c[p] ?? (c[p] = /* @__PURE__ */ new Set());
|
|
2806
|
+
for (const d of h.values)
|
|
2807
|
+
c[p].add(d);
|
|
2796
2808
|
}
|
|
2797
2809
|
}
|
|
2798
2810
|
return c;
|
|
@@ -2800,39 +2812,39 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2800
2812
|
const i = B, s = e.catchall;
|
|
2801
2813
|
let o;
|
|
2802
2814
|
t._zod.parse = (a, c) => {
|
|
2803
|
-
o ?? (o =
|
|
2804
|
-
const
|
|
2805
|
-
if (!i(
|
|
2815
|
+
o ?? (o = n.value);
|
|
2816
|
+
const p = a.value;
|
|
2817
|
+
if (!i(p))
|
|
2806
2818
|
return a.issues.push({
|
|
2807
2819
|
expected: "object",
|
|
2808
2820
|
code: "invalid_type",
|
|
2809
|
-
input:
|
|
2821
|
+
input: p,
|
|
2810
2822
|
inst: t
|
|
2811
2823
|
}), a;
|
|
2812
2824
|
a.value = {};
|
|
2813
|
-
const
|
|
2825
|
+
const h = [], d = o.shape;
|
|
2814
2826
|
for (const f of o.keys) {
|
|
2815
|
-
const
|
|
2816
|
-
|
|
2827
|
+
const I = d[f]._zod.run({ value: p[f], issues: [] }, c);
|
|
2828
|
+
I instanceof Promise ? h.push(I.then((ce) => H(ce, a, f, p))) : H(I, a, f, p);
|
|
2817
2829
|
}
|
|
2818
|
-
return s ? vt(
|
|
2830
|
+
return s ? vt(h, p, a, c, n.value, t) : h.length ? Promise.all(h).then(() => a) : a;
|
|
2819
2831
|
};
|
|
2820
|
-
}),
|
|
2821
|
-
|
|
2822
|
-
const
|
|
2823
|
-
const
|
|
2824
|
-
const O =
|
|
2832
|
+
}), Fn = /* @__PURE__ */ u("$ZodObjectJIT", (t, e) => {
|
|
2833
|
+
Dn.init(t, e);
|
|
2834
|
+
const r = t._zod.parse, n = ne(() => gt(e)), i = (f) => {
|
|
2835
|
+
const g = new an(["shape", "payload", "ctx"]), I = n.value, ce = (P) => {
|
|
2836
|
+
const O = Ee(P);
|
|
2825
2837
|
return `shape[${O}]._zod.run({ value: input[${O}], issues: [] }, ctx)`;
|
|
2826
2838
|
};
|
|
2827
|
-
|
|
2828
|
-
const
|
|
2839
|
+
g.write("const input = payload.value;");
|
|
2840
|
+
const be = /* @__PURE__ */ Object.create(null);
|
|
2829
2841
|
let St = 0;
|
|
2830
|
-
for (const P of
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
for (const P of
|
|
2834
|
-
const O =
|
|
2835
|
-
|
|
2842
|
+
for (const P of I.keys)
|
|
2843
|
+
be[P] = `key_${St++}`;
|
|
2844
|
+
g.write("const newResult = {};");
|
|
2845
|
+
for (const P of I.keys) {
|
|
2846
|
+
const O = be[P], G = Ee(P);
|
|
2847
|
+
g.write(`const ${O} = ${ce(P)};`), g.write(`
|
|
2836
2848
|
if (${O}.issues.length) {
|
|
2837
2849
|
payload.issues = payload.issues.concat(${O}.issues.map(iss => ({
|
|
2838
2850
|
...iss,
|
|
@@ -2851,25 +2863,25 @@ const Dr = /* @__PURE__ */ u("$ZodObject", (t, e) => {
|
|
|
2851
2863
|
|
|
2852
2864
|
`);
|
|
2853
2865
|
}
|
|
2854
|
-
|
|
2855
|
-
const Nt =
|
|
2866
|
+
g.write("payload.value = newResult;"), g.write("return payload;");
|
|
2867
|
+
const Nt = g.compile();
|
|
2856
2868
|
return (P, O) => Nt(f, P, O);
|
|
2857
2869
|
};
|
|
2858
2870
|
let s;
|
|
2859
|
-
const o = B, a = !et.jitless,
|
|
2871
|
+
const o = B, a = !et.jitless, p = a && er.value, h = e.catchall;
|
|
2860
2872
|
let d;
|
|
2861
|
-
t._zod.parse = (f,
|
|
2862
|
-
d ?? (d =
|
|
2863
|
-
const
|
|
2864
|
-
return o(
|
|
2873
|
+
t._zod.parse = (f, g) => {
|
|
2874
|
+
d ?? (d = n.value);
|
|
2875
|
+
const I = f.value;
|
|
2876
|
+
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({
|
|
2865
2877
|
expected: "object",
|
|
2866
2878
|
code: "invalid_type",
|
|
2867
|
-
input:
|
|
2879
|
+
input: I,
|
|
2868
2880
|
inst: t
|
|
2869
2881
|
}), f);
|
|
2870
2882
|
};
|
|
2871
2883
|
});
|
|
2872
|
-
function Oe(t, e,
|
|
2884
|
+
function Oe(t, e, r, n) {
|
|
2873
2885
|
for (const s of t)
|
|
2874
2886
|
if (s.issues.length === 0)
|
|
2875
2887
|
return e.value = s.value, e;
|
|
@@ -2877,8 +2889,8 @@ function Oe(t, e, n, r) {
|
|
|
2877
2889
|
return i.length === 1 ? (e.value = i[0].value, i[0]) : (e.issues.push({
|
|
2878
2890
|
code: "invalid_union",
|
|
2879
2891
|
input: e.value,
|
|
2880
|
-
inst:
|
|
2881
|
-
errors: t.map((s) => s.issues.map((o) => R(o,
|
|
2892
|
+
inst: r,
|
|
2893
|
+
errors: t.map((s) => s.issues.map((o) => R(o, n, C())))
|
|
2882
2894
|
}), e);
|
|
2883
2895
|
}
|
|
2884
2896
|
const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
@@ -2891,30 +2903,30 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2891
2903
|
return new RegExp(`^(${i.map((s) => ge(s.source)).join("|")})$`);
|
|
2892
2904
|
}
|
|
2893
2905
|
});
|
|
2894
|
-
const
|
|
2906
|
+
const r = e.options.length === 1, n = e.options[0]._zod.run;
|
|
2895
2907
|
t._zod.parse = (i, s) => {
|
|
2896
|
-
if (
|
|
2897
|
-
return
|
|
2908
|
+
if (r)
|
|
2909
|
+
return n(i, s);
|
|
2898
2910
|
let o = !1;
|
|
2899
2911
|
const a = [];
|
|
2900
2912
|
for (const c of e.options) {
|
|
2901
|
-
const
|
|
2913
|
+
const p = c._zod.run({
|
|
2902
2914
|
value: i.value,
|
|
2903
2915
|
issues: []
|
|
2904
2916
|
}, s);
|
|
2905
|
-
if (
|
|
2906
|
-
a.push(
|
|
2917
|
+
if (p instanceof Promise)
|
|
2918
|
+
a.push(p), o = !0;
|
|
2907
2919
|
else {
|
|
2908
|
-
if (
|
|
2909
|
-
return
|
|
2910
|
-
a.push(
|
|
2920
|
+
if (p.issues.length === 0)
|
|
2921
|
+
return p;
|
|
2922
|
+
a.push(p);
|
|
2911
2923
|
}
|
|
2912
2924
|
}
|
|
2913
2925
|
return o ? Promise.all(a).then((c) => Oe(c, i, t, s)) : Oe(a, i, t, s);
|
|
2914
2926
|
};
|
|
2915
|
-
}),
|
|
2927
|
+
}), Mn = /* @__PURE__ */ u("$ZodDiscriminatedUnion", (t, e) => {
|
|
2916
2928
|
e.inclusive = !1, _t.init(t, e);
|
|
2917
|
-
const
|
|
2929
|
+
const r = t._zod.parse;
|
|
2918
2930
|
m(t._zod, "propValues", () => {
|
|
2919
2931
|
const i = {};
|
|
2920
2932
|
for (const s of e.options) {
|
|
@@ -2923,13 +2935,13 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2923
2935
|
throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);
|
|
2924
2936
|
for (const [a, c] of Object.entries(o)) {
|
|
2925
2937
|
i[a] || (i[a] = /* @__PURE__ */ new Set());
|
|
2926
|
-
for (const
|
|
2927
|
-
i[a].add(
|
|
2938
|
+
for (const p of c)
|
|
2939
|
+
i[a].add(p);
|
|
2928
2940
|
}
|
|
2929
2941
|
}
|
|
2930
2942
|
return i;
|
|
2931
2943
|
});
|
|
2932
|
-
const
|
|
2944
|
+
const n = ne(() => {
|
|
2933
2945
|
const i = e.options, s = /* @__PURE__ */ new Map();
|
|
2934
2946
|
for (const o of i) {
|
|
2935
2947
|
const a = o._zod.propValues?.[e.discriminator];
|
|
@@ -2952,8 +2964,8 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2952
2964
|
input: o,
|
|
2953
2965
|
inst: t
|
|
2954
2966
|
}), i;
|
|
2955
|
-
const a =
|
|
2956
|
-
return a ? a._zod.run(i, s) : e.unionFallback ?
|
|
2967
|
+
const a = n.value.get(o?.[e.discriminator]);
|
|
2968
|
+
return a ? a._zod.run(i, s) : e.unionFallback ? r(i, s) : (i.issues.push({
|
|
2957
2969
|
code: "invalid_union",
|
|
2958
2970
|
errors: [],
|
|
2959
2971
|
note: "No matching discriminator",
|
|
@@ -2963,10 +2975,10 @@ const _t = /* @__PURE__ */ u("$ZodUnion", (t, e) => {
|
|
|
2963
2975
|
inst: t
|
|
2964
2976
|
}), i);
|
|
2965
2977
|
};
|
|
2966
|
-
}),
|
|
2967
|
-
k.init(t, e), t._zod.parse = (
|
|
2968
|
-
const i =
|
|
2969
|
-
return s instanceof Promise || o instanceof Promise ? Promise.all([s, o]).then(([c,
|
|
2978
|
+
}), jn = /* @__PURE__ */ u("$ZodIntersection", (t, e) => {
|
|
2979
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
2980
|
+
const i = r.value, s = e.left._zod.run({ value: i, issues: [] }, n), o = e.right._zod.run({ value: i, issues: [] }, n);
|
|
2981
|
+
return s instanceof Promise || o instanceof Promise ? Promise.all([s, o]).then(([c, p]) => Pe(r, c, p)) : Pe(r, s, o);
|
|
2970
2982
|
};
|
|
2971
2983
|
});
|
|
2972
2984
|
function de(t, e) {
|
|
@@ -2975,8 +2987,8 @@ function de(t, e) {
|
|
|
2975
2987
|
if (t instanceof Date && e instanceof Date && +t == +e)
|
|
2976
2988
|
return { valid: !0, data: t };
|
|
2977
2989
|
if (J(t) && J(e)) {
|
|
2978
|
-
const
|
|
2979
|
-
for (const s of
|
|
2990
|
+
const r = Object.keys(e), n = Object.keys(t).filter((s) => r.indexOf(s) !== -1), i = { ...t, ...e };
|
|
2991
|
+
for (const s of n) {
|
|
2980
2992
|
const o = de(t[s], e[s]);
|
|
2981
2993
|
if (!o.valid)
|
|
2982
2994
|
return {
|
|
@@ -2990,105 +3002,105 @@ function de(t, e) {
|
|
|
2990
3002
|
if (Array.isArray(t) && Array.isArray(e)) {
|
|
2991
3003
|
if (t.length !== e.length)
|
|
2992
3004
|
return { valid: !1, mergeErrorPath: [] };
|
|
2993
|
-
const
|
|
2994
|
-
for (let
|
|
2995
|
-
const i = t[
|
|
3005
|
+
const r = [];
|
|
3006
|
+
for (let n = 0; n < t.length; n++) {
|
|
3007
|
+
const i = t[n], s = e[n], o = de(i, s);
|
|
2996
3008
|
if (!o.valid)
|
|
2997
3009
|
return {
|
|
2998
3010
|
valid: !1,
|
|
2999
|
-
mergeErrorPath: [
|
|
3011
|
+
mergeErrorPath: [n, ...o.mergeErrorPath]
|
|
3000
3012
|
};
|
|
3001
|
-
|
|
3013
|
+
r.push(o.data);
|
|
3002
3014
|
}
|
|
3003
|
-
return { valid: !0, data:
|
|
3015
|
+
return { valid: !0, data: r };
|
|
3004
3016
|
}
|
|
3005
3017
|
return { valid: !1, mergeErrorPath: [] };
|
|
3006
3018
|
}
|
|
3007
|
-
function Pe(t, e,
|
|
3008
|
-
if (e.issues.length && t.issues.push(...e.issues),
|
|
3019
|
+
function Pe(t, e, r) {
|
|
3020
|
+
if (e.issues.length && t.issues.push(...e.issues), r.issues.length && t.issues.push(...r.issues), F(t))
|
|
3009
3021
|
return t;
|
|
3010
|
-
const
|
|
3011
|
-
if (!
|
|
3012
|
-
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(
|
|
3013
|
-
return t.value =
|
|
3022
|
+
const n = de(e.value, r.value);
|
|
3023
|
+
if (!n.valid)
|
|
3024
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(n.mergeErrorPath)}`);
|
|
3025
|
+
return t.value = n.data, t;
|
|
3014
3026
|
}
|
|
3015
|
-
const
|
|
3027
|
+
const Un = /* @__PURE__ */ u("$ZodEnum", (t, e) => {
|
|
3016
3028
|
k.init(t, e);
|
|
3017
|
-
const
|
|
3018
|
-
t._zod.values =
|
|
3029
|
+
const r = tt(e.entries), n = new Set(r);
|
|
3030
|
+
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) => {
|
|
3019
3031
|
const o = i.value;
|
|
3020
|
-
return
|
|
3032
|
+
return n.has(o) || i.issues.push({
|
|
3021
3033
|
code: "invalid_value",
|
|
3022
|
-
values:
|
|
3034
|
+
values: r,
|
|
3023
3035
|
input: o,
|
|
3024
3036
|
inst: t
|
|
3025
3037
|
}), i;
|
|
3026
3038
|
};
|
|
3027
|
-
}),
|
|
3039
|
+
}), Gn = /* @__PURE__ */ u("$ZodLiteral", (t, e) => {
|
|
3028
3040
|
if (k.init(t, e), e.values.length === 0)
|
|
3029
3041
|
throw new Error("Cannot create literal schema with no valid values");
|
|
3030
|
-
const
|
|
3031
|
-
t._zod.values =
|
|
3032
|
-
const s =
|
|
3033
|
-
return
|
|
3042
|
+
const r = new Set(e.values);
|
|
3043
|
+
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) => {
|
|
3044
|
+
const s = n.value;
|
|
3045
|
+
return r.has(s) || n.issues.push({
|
|
3034
3046
|
code: "invalid_value",
|
|
3035
3047
|
values: e.values,
|
|
3036
3048
|
input: s,
|
|
3037
3049
|
inst: t
|
|
3038
|
-
}),
|
|
3050
|
+
}), n;
|
|
3039
3051
|
};
|
|
3040
|
-
}),
|
|
3041
|
-
k.init(t, e), t._zod.parse = (
|
|
3042
|
-
if (
|
|
3052
|
+
}), Vn = /* @__PURE__ */ u("$ZodTransform", (t, e) => {
|
|
3053
|
+
k.init(t, e), t._zod.parse = (r, n) => {
|
|
3054
|
+
if (n.direction === "backward")
|
|
3043
3055
|
throw new He(t.constructor.name);
|
|
3044
|
-
const i = e.transform(
|
|
3045
|
-
if (
|
|
3046
|
-
return (i instanceof Promise ? i : Promise.resolve(i)).then((o) => (
|
|
3056
|
+
const i = e.transform(r.value, r);
|
|
3057
|
+
if (n.async)
|
|
3058
|
+
return (i instanceof Promise ? i : Promise.resolve(i)).then((o) => (r.value = o, r));
|
|
3047
3059
|
if (i instanceof Promise)
|
|
3048
|
-
throw new
|
|
3049
|
-
return
|
|
3060
|
+
throw new M();
|
|
3061
|
+
return r.value = i, r;
|
|
3050
3062
|
};
|
|
3051
3063
|
});
|
|
3052
3064
|
function Se(t, e) {
|
|
3053
3065
|
return t.issues.length && e === void 0 ? { issues: [], value: void 0 } : t;
|
|
3054
3066
|
}
|
|
3055
|
-
const
|
|
3067
|
+
const Bn = /* @__PURE__ */ u("$ZodOptional", (t, e) => {
|
|
3056
3068
|
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", () => {
|
|
3057
|
-
const
|
|
3058
|
-
return
|
|
3059
|
-
}), t._zod.parse = (
|
|
3069
|
+
const r = e.innerType._zod.pattern;
|
|
3070
|
+
return r ? new RegExp(`^(${ge(r.source)})?$`) : void 0;
|
|
3071
|
+
}), t._zod.parse = (r, n) => {
|
|
3060
3072
|
if (e.innerType._zod.optin === "optional") {
|
|
3061
|
-
const i = e.innerType._zod.run(
|
|
3062
|
-
return i instanceof Promise ? i.then((s) => Se(s,
|
|
3073
|
+
const i = e.innerType._zod.run(r, n);
|
|
3074
|
+
return i instanceof Promise ? i.then((s) => Se(s, r.value)) : Se(i, r.value);
|
|
3063
3075
|
}
|
|
3064
|
-
return
|
|
3076
|
+
return r.value === void 0 ? r : e.innerType._zod.run(r, n);
|
|
3065
3077
|
};
|
|
3066
|
-
}),
|
|
3078
|
+
}), Jn = /* @__PURE__ */ u("$ZodNullable", (t, e) => {
|
|
3067
3079
|
k.init(t, e), m(t._zod, "optin", () => e.innerType._zod.optin), m(t._zod, "optout", () => e.innerType._zod.optout), m(t._zod, "pattern", () => {
|
|
3068
|
-
const
|
|
3069
|
-
return
|
|
3070
|
-
}), m(t._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), t._zod.parse = (
|
|
3071
|
-
}),
|
|
3072
|
-
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (
|
|
3073
|
-
if (
|
|
3074
|
-
return e.innerType._zod.run(
|
|
3075
|
-
if (
|
|
3076
|
-
return
|
|
3077
|
-
const i = e.innerType._zod.run(
|
|
3080
|
+
const r = e.innerType._zod.pattern;
|
|
3081
|
+
return r ? new RegExp(`^(${ge(r.source)}|null)$`) : void 0;
|
|
3082
|
+
}), 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);
|
|
3083
|
+
}), Wn = /* @__PURE__ */ u("$ZodDefault", (t, e) => {
|
|
3084
|
+
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (r, n) => {
|
|
3085
|
+
if (n.direction === "backward")
|
|
3086
|
+
return e.innerType._zod.run(r, n);
|
|
3087
|
+
if (r.value === void 0)
|
|
3088
|
+
return r.value = e.defaultValue, r;
|
|
3089
|
+
const i = e.innerType._zod.run(r, n);
|
|
3078
3090
|
return i instanceof Promise ? i.then((s) => Ne(s, e)) : Ne(i, e);
|
|
3079
3091
|
};
|
|
3080
3092
|
});
|
|
3081
3093
|
function Ne(t, e) {
|
|
3082
3094
|
return t.value === void 0 && (t.value = e.defaultValue), t;
|
|
3083
3095
|
}
|
|
3084
|
-
const
|
|
3085
|
-
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (
|
|
3086
|
-
}),
|
|
3096
|
+
const Kn = /* @__PURE__ */ u("$ZodPrefault", (t, e) => {
|
|
3097
|
+
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));
|
|
3098
|
+
}), Yn = /* @__PURE__ */ u("$ZodNonOptional", (t, e) => {
|
|
3087
3099
|
k.init(t, e), m(t._zod, "values", () => {
|
|
3088
|
-
const
|
|
3089
|
-
return
|
|
3090
|
-
}), t._zod.parse = (
|
|
3091
|
-
const i = e.innerType._zod.run(
|
|
3100
|
+
const r = e.innerType._zod.values;
|
|
3101
|
+
return r ? new Set([...r].filter((n) => n !== void 0)) : void 0;
|
|
3102
|
+
}), t._zod.parse = (r, n) => {
|
|
3103
|
+
const i = e.innerType._zod.run(r, n);
|
|
3092
3104
|
return i instanceof Promise ? i.then((s) => Ae(s, t)) : Ae(i, t);
|
|
3093
3105
|
};
|
|
3094
3106
|
});
|
|
@@ -3100,70 +3112,70 @@ function Ae(t, e) {
|
|
|
3100
3112
|
inst: e
|
|
3101
3113
|
}), t;
|
|
3102
3114
|
}
|
|
3103
|
-
const
|
|
3104
|
-
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 = (
|
|
3105
|
-
if (
|
|
3106
|
-
return e.innerType._zod.run(
|
|
3107
|
-
const i = e.innerType._zod.run(
|
|
3108
|
-
return i instanceof Promise ? i.then((s) => (
|
|
3109
|
-
...
|
|
3115
|
+
const qn = /* @__PURE__ */ u("$ZodCatch", (t, e) => {
|
|
3116
|
+
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) => {
|
|
3117
|
+
if (n.direction === "backward")
|
|
3118
|
+
return e.innerType._zod.run(r, n);
|
|
3119
|
+
const i = e.innerType._zod.run(r, n);
|
|
3120
|
+
return i instanceof Promise ? i.then((s) => (r.value = s.value, s.issues.length && (r.value = e.catchValue({
|
|
3121
|
+
...r,
|
|
3110
3122
|
error: {
|
|
3111
|
-
issues: s.issues.map((o) => R(o,
|
|
3123
|
+
issues: s.issues.map((o) => R(o, n, C()))
|
|
3112
3124
|
},
|
|
3113
|
-
input:
|
|
3114
|
-
}),
|
|
3115
|
-
...
|
|
3125
|
+
input: r.value
|
|
3126
|
+
}), r.issues = []), r)) : (r.value = i.value, i.issues.length && (r.value = e.catchValue({
|
|
3127
|
+
...r,
|
|
3116
3128
|
error: {
|
|
3117
|
-
issues: i.issues.map((s) => R(s,
|
|
3129
|
+
issues: i.issues.map((s) => R(s, n, C()))
|
|
3118
3130
|
},
|
|
3119
|
-
input:
|
|
3120
|
-
}),
|
|
3131
|
+
input: r.value
|
|
3132
|
+
}), r.issues = []), r);
|
|
3121
3133
|
};
|
|
3122
|
-
}),
|
|
3123
|
-
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 = (
|
|
3124
|
-
if (
|
|
3125
|
-
const s = e.out._zod.run(
|
|
3126
|
-
return s instanceof Promise ? s.then((o) => q(o, e.in,
|
|
3134
|
+
}), Xn = /* @__PURE__ */ u("$ZodPipe", (t, e) => {
|
|
3135
|
+
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) => {
|
|
3136
|
+
if (n.direction === "backward") {
|
|
3137
|
+
const s = e.out._zod.run(r, n);
|
|
3138
|
+
return s instanceof Promise ? s.then((o) => q(o, e.in, n)) : q(s, e.in, n);
|
|
3127
3139
|
}
|
|
3128
|
-
const i = e.in._zod.run(
|
|
3129
|
-
return i instanceof Promise ? i.then((s) => q(s, e.out,
|
|
3140
|
+
const i = e.in._zod.run(r, n);
|
|
3141
|
+
return i instanceof Promise ? i.then((s) => q(s, e.out, n)) : q(i, e.out, n);
|
|
3130
3142
|
};
|
|
3131
3143
|
});
|
|
3132
|
-
function q(t, e,
|
|
3133
|
-
return t.issues.length ? (t.aborted = !0, t) : e._zod.run({ value: t.value, issues: t.issues },
|
|
3134
|
-
}
|
|
3135
|
-
const
|
|
3136
|
-
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 = (
|
|
3137
|
-
if (
|
|
3138
|
-
return e.innerType._zod.run(
|
|
3139
|
-
const i = e.innerType._zod.run(
|
|
3144
|
+
function q(t, e, r) {
|
|
3145
|
+
return t.issues.length ? (t.aborted = !0, t) : e._zod.run({ value: t.value, issues: t.issues }, r);
|
|
3146
|
+
}
|
|
3147
|
+
const Qn = /* @__PURE__ */ u("$ZodReadonly", (t, e) => {
|
|
3148
|
+
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) => {
|
|
3149
|
+
if (n.direction === "backward")
|
|
3150
|
+
return e.innerType._zod.run(r, n);
|
|
3151
|
+
const i = e.innerType._zod.run(r, n);
|
|
3140
3152
|
return i instanceof Promise ? i.then(Ze) : Ze(i);
|
|
3141
3153
|
};
|
|
3142
3154
|
});
|
|
3143
3155
|
function Ze(t) {
|
|
3144
3156
|
return t.value = Object.freeze(t.value), t;
|
|
3145
3157
|
}
|
|
3146
|
-
const
|
|
3147
|
-
|
|
3148
|
-
const
|
|
3158
|
+
const Hn = /* @__PURE__ */ u("$ZodCustom", (t, e) => {
|
|
3159
|
+
w.init(t, e), k.init(t, e), t._zod.parse = (r, n) => r, t._zod.check = (r) => {
|
|
3160
|
+
const n = r.value, i = e.fn(n);
|
|
3149
3161
|
if (i instanceof Promise)
|
|
3150
|
-
return i.then((s) => Ce(s,
|
|
3151
|
-
Ce(i,
|
|
3162
|
+
return i.then((s) => Ce(s, r, n, t));
|
|
3163
|
+
Ce(i, r, n, t);
|
|
3152
3164
|
};
|
|
3153
3165
|
});
|
|
3154
|
-
function Ce(t, e,
|
|
3166
|
+
function Ce(t, e, r, n) {
|
|
3155
3167
|
if (!t) {
|
|
3156
3168
|
const i = {
|
|
3157
3169
|
code: "custom",
|
|
3158
|
-
input:
|
|
3159
|
-
inst:
|
|
3170
|
+
input: r,
|
|
3171
|
+
inst: n,
|
|
3160
3172
|
// incorporates params.error into issue reporting
|
|
3161
|
-
path: [...
|
|
3173
|
+
path: [...n._zod.def.path ?? []],
|
|
3162
3174
|
// incorporates params.error into issue reporting
|
|
3163
|
-
continue: !
|
|
3175
|
+
continue: !n._zod.def.abort
|
|
3164
3176
|
// params: inst._zod.def.params,
|
|
3165
3177
|
};
|
|
3166
|
-
|
|
3178
|
+
n._zod.def.params && (i.params = n._zod.def.params), e.issues.push(W(i));
|
|
3167
3179
|
}
|
|
3168
3180
|
}
|
|
3169
3181
|
var Re;
|
|
@@ -3171,12 +3183,12 @@ class ei {
|
|
|
3171
3183
|
constructor() {
|
|
3172
3184
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
3173
3185
|
}
|
|
3174
|
-
add(e, ...
|
|
3175
|
-
const
|
|
3176
|
-
if (this._map.set(e,
|
|
3177
|
-
if (this._idmap.has(
|
|
3178
|
-
throw new Error(`ID ${
|
|
3179
|
-
this._idmap.set(
|
|
3186
|
+
add(e, ...r) {
|
|
3187
|
+
const n = r[0];
|
|
3188
|
+
if (this._map.set(e, n), n && typeof n == "object" && "id" in n) {
|
|
3189
|
+
if (this._idmap.has(n.id))
|
|
3190
|
+
throw new Error(`ID ${n.id} already exists in the registry`);
|
|
3191
|
+
this._idmap.set(n.id, e);
|
|
3180
3192
|
}
|
|
3181
3193
|
return this;
|
|
3182
3194
|
}
|
|
@@ -3184,15 +3196,15 @@ class ei {
|
|
|
3184
3196
|
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
3185
3197
|
}
|
|
3186
3198
|
remove(e) {
|
|
3187
|
-
const
|
|
3188
|
-
return
|
|
3199
|
+
const r = this._map.get(e);
|
|
3200
|
+
return r && typeof r == "object" && "id" in r && this._idmap.delete(r.id), this._map.delete(e), this;
|
|
3189
3201
|
}
|
|
3190
3202
|
get(e) {
|
|
3191
|
-
const
|
|
3192
|
-
if (
|
|
3193
|
-
const
|
|
3194
|
-
delete
|
|
3195
|
-
const i = { ...
|
|
3203
|
+
const r = e._zod.parent;
|
|
3204
|
+
if (r) {
|
|
3205
|
+
const n = { ...this.get(r) ?? {} };
|
|
3206
|
+
delete n.id;
|
|
3207
|
+
const i = { ...n, ...this._map.get(e) };
|
|
3196
3208
|
return Object.keys(i).length ? i : void 0;
|
|
3197
3209
|
}
|
|
3198
3210
|
return this._map.get(e);
|
|
@@ -3206,13 +3218,13 @@ function ti() {
|
|
|
3206
3218
|
}
|
|
3207
3219
|
(Re = globalThis).__zod_globalRegistry ?? (Re.__zod_globalRegistry = ti());
|
|
3208
3220
|
const V = globalThis.__zod_globalRegistry;
|
|
3209
|
-
function
|
|
3221
|
+
function ri(t, e) {
|
|
3210
3222
|
return new t({
|
|
3211
3223
|
type: "string",
|
|
3212
3224
|
...l(e)
|
|
3213
3225
|
});
|
|
3214
3226
|
}
|
|
3215
|
-
function
|
|
3227
|
+
function ni(t, e) {
|
|
3216
3228
|
return new t({
|
|
3217
3229
|
type: "string",
|
|
3218
3230
|
format: "email",
|
|
@@ -3221,7 +3233,7 @@ function ri(t, e) {
|
|
|
3221
3233
|
...l(e)
|
|
3222
3234
|
});
|
|
3223
3235
|
}
|
|
3224
|
-
function
|
|
3236
|
+
function xe(t, e) {
|
|
3225
3237
|
return new t({
|
|
3226
3238
|
type: "string",
|
|
3227
3239
|
format: "guid",
|
|
@@ -3287,7 +3299,7 @@ function ui(t, e) {
|
|
|
3287
3299
|
...l(e)
|
|
3288
3300
|
});
|
|
3289
3301
|
}
|
|
3290
|
-
function
|
|
3302
|
+
function pi(t, e) {
|
|
3291
3303
|
return new t({
|
|
3292
3304
|
type: "string",
|
|
3293
3305
|
format: "nanoid",
|
|
@@ -3296,7 +3308,7 @@ function hi(t, e) {
|
|
|
3296
3308
|
...l(e)
|
|
3297
3309
|
});
|
|
3298
3310
|
}
|
|
3299
|
-
function
|
|
3311
|
+
function hi(t, e) {
|
|
3300
3312
|
return new t({
|
|
3301
3313
|
type: "string",
|
|
3302
3314
|
format: "cuid",
|
|
@@ -3395,7 +3407,7 @@ function Ti(t, e) {
|
|
|
3395
3407
|
...l(e)
|
|
3396
3408
|
});
|
|
3397
3409
|
}
|
|
3398
|
-
function
|
|
3410
|
+
function bi(t, e) {
|
|
3399
3411
|
return new t({
|
|
3400
3412
|
type: "string",
|
|
3401
3413
|
format: "e164",
|
|
@@ -3404,7 +3416,7 @@ function wi(t, e) {
|
|
|
3404
3416
|
...l(e)
|
|
3405
3417
|
});
|
|
3406
3418
|
}
|
|
3407
|
-
function
|
|
3419
|
+
function wi(t, e) {
|
|
3408
3420
|
return new t({
|
|
3409
3421
|
type: "string",
|
|
3410
3422
|
format: "jwt",
|
|
@@ -3413,7 +3425,7 @@ function bi(t, e) {
|
|
|
3413
3425
|
...l(e)
|
|
3414
3426
|
});
|
|
3415
3427
|
}
|
|
3416
|
-
function
|
|
3428
|
+
function Ii(t, e) {
|
|
3417
3429
|
return new t({
|
|
3418
3430
|
type: "string",
|
|
3419
3431
|
format: "datetime",
|
|
@@ -3424,7 +3436,7 @@ function Ei(t, e) {
|
|
|
3424
3436
|
...l(e)
|
|
3425
3437
|
});
|
|
3426
3438
|
}
|
|
3427
|
-
function
|
|
3439
|
+
function Ei(t, e) {
|
|
3428
3440
|
return new t({
|
|
3429
3441
|
type: "string",
|
|
3430
3442
|
format: "date",
|
|
@@ -3476,7 +3488,7 @@ function Ni(t, e) {
|
|
|
3476
3488
|
...l(e)
|
|
3477
3489
|
});
|
|
3478
3490
|
}
|
|
3479
|
-
function
|
|
3491
|
+
function Le(t, e) {
|
|
3480
3492
|
return new lt({
|
|
3481
3493
|
check: "less_than",
|
|
3482
3494
|
...l(e),
|
|
@@ -3484,7 +3496,7 @@ function xe(t, e) {
|
|
|
3484
3496
|
inclusive: !1
|
|
3485
3497
|
});
|
|
3486
3498
|
}
|
|
3487
|
-
function
|
|
3499
|
+
function pe(t, e) {
|
|
3488
3500
|
return new lt({
|
|
3489
3501
|
check: "less_than",
|
|
3490
3502
|
...l(e),
|
|
@@ -3500,7 +3512,7 @@ function De(t, e) {
|
|
|
3500
3512
|
inclusive: !1
|
|
3501
3513
|
});
|
|
3502
3514
|
}
|
|
3503
|
-
function
|
|
3515
|
+
function he(t, e) {
|
|
3504
3516
|
return new dt({
|
|
3505
3517
|
check: "greater_than",
|
|
3506
3518
|
...l(e),
|
|
@@ -3509,35 +3521,35 @@ function pe(t, e) {
|
|
|
3509
3521
|
});
|
|
3510
3522
|
}
|
|
3511
3523
|
function Fe(t, e) {
|
|
3512
|
-
return new
|
|
3524
|
+
return new Kr({
|
|
3513
3525
|
check: "multiple_of",
|
|
3514
3526
|
...l(e),
|
|
3515
3527
|
value: t
|
|
3516
3528
|
});
|
|
3517
3529
|
}
|
|
3518
3530
|
function kt(t, e) {
|
|
3519
|
-
return new
|
|
3531
|
+
return new qr({
|
|
3520
3532
|
check: "max_length",
|
|
3521
3533
|
...l(e),
|
|
3522
3534
|
maximum: t
|
|
3523
3535
|
});
|
|
3524
3536
|
}
|
|
3525
3537
|
function ee(t, e) {
|
|
3526
|
-
return new
|
|
3538
|
+
return new Xr({
|
|
3527
3539
|
check: "min_length",
|
|
3528
3540
|
...l(e),
|
|
3529
3541
|
minimum: t
|
|
3530
3542
|
});
|
|
3531
3543
|
}
|
|
3532
3544
|
function yt(t, e) {
|
|
3533
|
-
return new
|
|
3545
|
+
return new Qr({
|
|
3534
3546
|
check: "length_equals",
|
|
3535
3547
|
...l(e),
|
|
3536
3548
|
length: t
|
|
3537
3549
|
});
|
|
3538
3550
|
}
|
|
3539
3551
|
function Ai(t, e) {
|
|
3540
|
-
return new
|
|
3552
|
+
return new Hr({
|
|
3541
3553
|
check: "string_format",
|
|
3542
3554
|
format: "regex",
|
|
3543
3555
|
...l(e),
|
|
@@ -3545,37 +3557,37 @@ function Ai(t, e) {
|
|
|
3545
3557
|
});
|
|
3546
3558
|
}
|
|
3547
3559
|
function Zi(t) {
|
|
3548
|
-
return new
|
|
3560
|
+
return new en({
|
|
3549
3561
|
check: "string_format",
|
|
3550
3562
|
format: "lowercase",
|
|
3551
3563
|
...l(t)
|
|
3552
3564
|
});
|
|
3553
3565
|
}
|
|
3554
3566
|
function Ci(t) {
|
|
3555
|
-
return new
|
|
3567
|
+
return new tn({
|
|
3556
3568
|
check: "string_format",
|
|
3557
3569
|
format: "uppercase",
|
|
3558
3570
|
...l(t)
|
|
3559
3571
|
});
|
|
3560
3572
|
}
|
|
3561
3573
|
function Ri(t, e) {
|
|
3562
|
-
return new
|
|
3574
|
+
return new rn({
|
|
3563
3575
|
check: "string_format",
|
|
3564
3576
|
format: "includes",
|
|
3565
3577
|
...l(e),
|
|
3566
3578
|
includes: t
|
|
3567
3579
|
});
|
|
3568
3580
|
}
|
|
3569
|
-
function
|
|
3570
|
-
return new
|
|
3581
|
+
function xi(t, e) {
|
|
3582
|
+
return new nn({
|
|
3571
3583
|
check: "string_format",
|
|
3572
3584
|
format: "starts_with",
|
|
3573
3585
|
...l(e),
|
|
3574
3586
|
prefix: t
|
|
3575
3587
|
});
|
|
3576
3588
|
}
|
|
3577
|
-
function
|
|
3578
|
-
return new
|
|
3589
|
+
function Li(t, e) {
|
|
3590
|
+
return new sn({
|
|
3579
3591
|
check: "string_format",
|
|
3580
3592
|
format: "ends_with",
|
|
3581
3593
|
...l(e),
|
|
@@ -3583,7 +3595,7 @@ function xi(t, e) {
|
|
|
3583
3595
|
});
|
|
3584
3596
|
}
|
|
3585
3597
|
function U(t) {
|
|
3586
|
-
return new
|
|
3598
|
+
return new on({
|
|
3587
3599
|
check: "overwrite",
|
|
3588
3600
|
tx: t
|
|
3589
3601
|
});
|
|
@@ -3594,50 +3606,50 @@ function Di(t) {
|
|
|
3594
3606
|
function Fi() {
|
|
3595
3607
|
return U((t) => t.trim());
|
|
3596
3608
|
}
|
|
3597
|
-
function
|
|
3609
|
+
function Mi() {
|
|
3598
3610
|
return U((t) => t.toLowerCase());
|
|
3599
3611
|
}
|
|
3600
|
-
function
|
|
3612
|
+
function ji() {
|
|
3601
3613
|
return U((t) => t.toUpperCase());
|
|
3602
3614
|
}
|
|
3603
3615
|
function Ui() {
|
|
3604
3616
|
return U((t) => Ht(t));
|
|
3605
3617
|
}
|
|
3606
|
-
function Gi(t, e,
|
|
3618
|
+
function Gi(t, e, r) {
|
|
3607
3619
|
return new t({
|
|
3608
3620
|
type: "array",
|
|
3609
3621
|
element: e,
|
|
3610
3622
|
// get element() {
|
|
3611
3623
|
// return element;
|
|
3612
3624
|
// },
|
|
3613
|
-
...l(
|
|
3625
|
+
...l(r)
|
|
3614
3626
|
});
|
|
3615
3627
|
}
|
|
3616
|
-
function Vi(t, e,
|
|
3628
|
+
function Vi(t, e, r) {
|
|
3617
3629
|
return new t({
|
|
3618
3630
|
type: "custom",
|
|
3619
3631
|
check: "custom",
|
|
3620
3632
|
fn: e,
|
|
3621
|
-
...l(
|
|
3633
|
+
...l(r)
|
|
3622
3634
|
});
|
|
3623
3635
|
}
|
|
3624
3636
|
function Bi(t) {
|
|
3625
|
-
const e = Ji((
|
|
3626
|
-
if (typeof
|
|
3627
|
-
|
|
3637
|
+
const e = Ji((r) => (r.addIssue = (n) => {
|
|
3638
|
+
if (typeof n == "string")
|
|
3639
|
+
r.issues.push(W(n, r.value, e._zod.def));
|
|
3628
3640
|
else {
|
|
3629
|
-
const i =
|
|
3630
|
-
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input =
|
|
3641
|
+
const i = n;
|
|
3642
|
+
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));
|
|
3631
3643
|
}
|
|
3632
|
-
}, t(
|
|
3644
|
+
}, t(r.value, r)));
|
|
3633
3645
|
return e;
|
|
3634
3646
|
}
|
|
3635
3647
|
function Ji(t, e) {
|
|
3636
|
-
const
|
|
3648
|
+
const r = new w({
|
|
3637
3649
|
check: "custom",
|
|
3638
3650
|
...l(e)
|
|
3639
3651
|
});
|
|
3640
|
-
return
|
|
3652
|
+
return r._zod.check = t, r;
|
|
3641
3653
|
}
|
|
3642
3654
|
function Tt(t) {
|
|
3643
3655
|
let e = t?.target ?? "draft-2020-12";
|
|
@@ -3656,62 +3668,62 @@ function Tt(t) {
|
|
|
3656
3668
|
external: t?.external ?? void 0
|
|
3657
3669
|
};
|
|
3658
3670
|
}
|
|
3659
|
-
function T(t, e,
|
|
3660
|
-
var
|
|
3671
|
+
function T(t, e, r = { path: [], schemaPath: [] }) {
|
|
3672
|
+
var n;
|
|
3661
3673
|
const i = t._zod.def, s = e.seen.get(t);
|
|
3662
3674
|
if (s)
|
|
3663
|
-
return s.count++,
|
|
3664
|
-
const o = { schema: {}, count: 1, cycle: void 0, path:
|
|
3675
|
+
return s.count++, r.schemaPath.includes(t) && (s.cycle = r.path), s.schema;
|
|
3676
|
+
const o = { schema: {}, count: 1, cycle: void 0, path: r.path };
|
|
3665
3677
|
e.seen.set(t, o);
|
|
3666
3678
|
const a = t._zod.toJSONSchema?.();
|
|
3667
3679
|
if (a)
|
|
3668
3680
|
o.schema = a;
|
|
3669
3681
|
else {
|
|
3670
|
-
const
|
|
3671
|
-
...
|
|
3672
|
-
schemaPath: [...
|
|
3673
|
-
path:
|
|
3682
|
+
const h = {
|
|
3683
|
+
...r,
|
|
3684
|
+
schemaPath: [...r.schemaPath, t],
|
|
3685
|
+
path: r.path
|
|
3674
3686
|
}, d = t._zod.parent;
|
|
3675
3687
|
if (d)
|
|
3676
|
-
o.ref = d, T(d, e,
|
|
3688
|
+
o.ref = d, T(d, e, h), e.seen.get(d).isParent = !0;
|
|
3677
3689
|
else if (t._zod.processJSONSchema)
|
|
3678
|
-
t._zod.processJSONSchema(e, o.schema,
|
|
3690
|
+
t._zod.processJSONSchema(e, o.schema, h);
|
|
3679
3691
|
else {
|
|
3680
|
-
const f = o.schema,
|
|
3681
|
-
if (!
|
|
3692
|
+
const f = o.schema, g = e.processors[i.type];
|
|
3693
|
+
if (!g)
|
|
3682
3694
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
|
|
3683
|
-
|
|
3695
|
+
g(t, e, f, h);
|
|
3684
3696
|
}
|
|
3685
3697
|
}
|
|
3686
3698
|
const c = e.metadataRegistry.get(t);
|
|
3687
|
-
return c && Object.assign(o.schema, c), e.io === "input" &&
|
|
3699
|
+
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;
|
|
3688
3700
|
}
|
|
3689
|
-
function
|
|
3690
|
-
const
|
|
3691
|
-
if (!
|
|
3701
|
+
function bt(t, e) {
|
|
3702
|
+
const r = t.seen.get(e);
|
|
3703
|
+
if (!r)
|
|
3692
3704
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3693
|
-
const
|
|
3705
|
+
const n = (s) => {
|
|
3694
3706
|
const o = t.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
3695
3707
|
if (t.external) {
|
|
3696
|
-
const
|
|
3697
|
-
if (
|
|
3698
|
-
return { ref: d(
|
|
3708
|
+
const h = t.external.registry.get(s[0])?.id, d = t.external.uri ?? ((g) => g);
|
|
3709
|
+
if (h)
|
|
3710
|
+
return { ref: d(h) };
|
|
3699
3711
|
const f = s[1].defId ?? s[1].schema.id ?? `schema${t.counter++}`;
|
|
3700
3712
|
return s[1].defId = f, { defId: f, ref: `${d("__shared")}#/${o}/${f}` };
|
|
3701
3713
|
}
|
|
3702
|
-
if (s[1] ===
|
|
3714
|
+
if (s[1] === r)
|
|
3703
3715
|
return { ref: "#" };
|
|
3704
|
-
const c = `#/${o}/`,
|
|
3705
|
-
return { defId:
|
|
3716
|
+
const c = `#/${o}/`, p = s[1].schema.id ?? `__schema${t.counter++}`;
|
|
3717
|
+
return { defId: p, ref: c + p };
|
|
3706
3718
|
}, i = (s) => {
|
|
3707
3719
|
if (s[1].schema.$ref)
|
|
3708
3720
|
return;
|
|
3709
|
-
const o = s[1], { ref: a, defId: c } =
|
|
3721
|
+
const o = s[1], { ref: a, defId: c } = n(s);
|
|
3710
3722
|
o.def = { ...o.schema }, c && (o.defId = c);
|
|
3711
|
-
const
|
|
3712
|
-
for (const
|
|
3713
|
-
delete h
|
|
3714
|
-
|
|
3723
|
+
const p = o.schema;
|
|
3724
|
+
for (const h in p)
|
|
3725
|
+
delete p[h];
|
|
3726
|
+
p.$ref = a;
|
|
3715
3727
|
};
|
|
3716
3728
|
if (t.cycles === "throw")
|
|
3717
3729
|
for (const s of t.seen.entries()) {
|
|
@@ -3748,19 +3760,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
3748
3760
|
}
|
|
3749
3761
|
}
|
|
3750
3762
|
}
|
|
3751
|
-
function
|
|
3752
|
-
const
|
|
3753
|
-
if (!
|
|
3763
|
+
function wt(t, e) {
|
|
3764
|
+
const r = t.seen.get(e);
|
|
3765
|
+
if (!r)
|
|
3754
3766
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3755
|
-
const
|
|
3756
|
-
const a = t.seen.get(o), c = a.def ?? a.schema,
|
|
3767
|
+
const n = (o) => {
|
|
3768
|
+
const a = t.seen.get(o), c = a.def ?? a.schema, p = { ...c };
|
|
3757
3769
|
if (a.ref === null)
|
|
3758
3770
|
return;
|
|
3759
|
-
const
|
|
3760
|
-
if (a.ref = null,
|
|
3761
|
-
|
|
3762
|
-
const d = t.seen.get(
|
|
3763
|
-
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,
|
|
3771
|
+
const h = a.ref;
|
|
3772
|
+
if (a.ref = null, h) {
|
|
3773
|
+
n(h);
|
|
3774
|
+
const d = t.seen.get(h).schema;
|
|
3775
|
+
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));
|
|
3764
3776
|
}
|
|
3765
3777
|
a.isParent || t.override({
|
|
3766
3778
|
zodSchema: o,
|
|
@@ -3769,7 +3781,7 @@ function bt(t, e) {
|
|
|
3769
3781
|
});
|
|
3770
3782
|
};
|
|
3771
3783
|
for (const o of [...t.seen.entries()].reverse())
|
|
3772
|
-
|
|
3784
|
+
n(o[0]);
|
|
3773
3785
|
const i = {};
|
|
3774
3786
|
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) {
|
|
3775
3787
|
const o = t.external.registry.get(e)?.id;
|
|
@@ -3777,7 +3789,7 @@ function bt(t, e) {
|
|
|
3777
3789
|
throw new Error("Schema is missing an `id` property");
|
|
3778
3790
|
i.$id = t.external.uri(o);
|
|
3779
3791
|
}
|
|
3780
|
-
Object.assign(i,
|
|
3792
|
+
Object.assign(i, r.def ?? r.schema);
|
|
3781
3793
|
const s = t.external?.defs ?? {};
|
|
3782
3794
|
for (const o of t.seen.entries()) {
|
|
3783
3795
|
const a = o[1];
|
|
@@ -3801,54 +3813,54 @@ function bt(t, e) {
|
|
|
3801
3813
|
throw new Error("Error converting schema to JSON.");
|
|
3802
3814
|
}
|
|
3803
3815
|
}
|
|
3804
|
-
function
|
|
3805
|
-
const
|
|
3806
|
-
if (
|
|
3816
|
+
function b(t, e) {
|
|
3817
|
+
const r = e ?? { seen: /* @__PURE__ */ new Set() };
|
|
3818
|
+
if (r.seen.has(t))
|
|
3807
3819
|
return !1;
|
|
3808
|
-
|
|
3809
|
-
const
|
|
3810
|
-
if (
|
|
3820
|
+
r.seen.add(t);
|
|
3821
|
+
const n = t._zod.def;
|
|
3822
|
+
if (n.type === "transform")
|
|
3811
3823
|
return !0;
|
|
3812
|
-
if (
|
|
3813
|
-
return
|
|
3814
|
-
if (
|
|
3815
|
-
return
|
|
3816
|
-
if (
|
|
3817
|
-
return
|
|
3818
|
-
if (
|
|
3819
|
-
return
|
|
3820
|
-
if (
|
|
3821
|
-
return
|
|
3822
|
-
if (
|
|
3823
|
-
return
|
|
3824
|
-
if (
|
|
3825
|
-
return
|
|
3826
|
-
if (
|
|
3827
|
-
for (const i in
|
|
3828
|
-
if (
|
|
3824
|
+
if (n.type === "array")
|
|
3825
|
+
return b(n.element, r);
|
|
3826
|
+
if (n.type === "set")
|
|
3827
|
+
return b(n.valueType, r);
|
|
3828
|
+
if (n.type === "lazy")
|
|
3829
|
+
return b(n.getter(), r);
|
|
3830
|
+
if (n.type === "promise" || n.type === "optional" || n.type === "nonoptional" || n.type === "nullable" || n.type === "readonly" || n.type === "default" || n.type === "prefault")
|
|
3831
|
+
return b(n.innerType, r);
|
|
3832
|
+
if (n.type === "intersection")
|
|
3833
|
+
return b(n.left, r) || b(n.right, r);
|
|
3834
|
+
if (n.type === "record" || n.type === "map")
|
|
3835
|
+
return b(n.keyType, r) || b(n.valueType, r);
|
|
3836
|
+
if (n.type === "pipe")
|
|
3837
|
+
return b(n.in, r) || b(n.out, r);
|
|
3838
|
+
if (n.type === "object") {
|
|
3839
|
+
for (const i in n.shape)
|
|
3840
|
+
if (b(n.shape[i], r))
|
|
3829
3841
|
return !0;
|
|
3830
3842
|
return !1;
|
|
3831
3843
|
}
|
|
3832
|
-
if (
|
|
3833
|
-
for (const i of
|
|
3834
|
-
if (
|
|
3844
|
+
if (n.type === "union") {
|
|
3845
|
+
for (const i of n.options)
|
|
3846
|
+
if (b(i, r))
|
|
3835
3847
|
return !0;
|
|
3836
3848
|
return !1;
|
|
3837
3849
|
}
|
|
3838
|
-
if (
|
|
3839
|
-
for (const i of
|
|
3840
|
-
if (
|
|
3850
|
+
if (n.type === "tuple") {
|
|
3851
|
+
for (const i of n.items)
|
|
3852
|
+
if (b(i, r))
|
|
3841
3853
|
return !0;
|
|
3842
|
-
return !!(
|
|
3854
|
+
return !!(n.rest && b(n.rest, r));
|
|
3843
3855
|
}
|
|
3844
3856
|
return !1;
|
|
3845
3857
|
}
|
|
3846
|
-
const Wi = (t, e = {}) => (
|
|
3847
|
-
const
|
|
3848
|
-
return T(t,
|
|
3849
|
-
}, te = (t, e) => (
|
|
3850
|
-
const { libraryOptions:
|
|
3851
|
-
return T(t, s),
|
|
3858
|
+
const Wi = (t, e = {}) => (r) => {
|
|
3859
|
+
const n = Tt({ ...r, processors: e });
|
|
3860
|
+
return T(t, n), bt(n, t), wt(n, t);
|
|
3861
|
+
}, te = (t, e) => (r) => {
|
|
3862
|
+
const { libraryOptions: n, target: i } = r ?? {}, s = Tt({ ...n ?? {}, target: i, io: e, processors: {} });
|
|
3863
|
+
return T(t, s), bt(s, t), wt(s, t);
|
|
3852
3864
|
}, Ki = {
|
|
3853
3865
|
guid: "uuid",
|
|
3854
3866
|
url: "uri",
|
|
@@ -3856,29 +3868,29 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3856
3868
|
json_string: "json-string",
|
|
3857
3869
|
regex: ""
|
|
3858
3870
|
// do not set
|
|
3859
|
-
}, Yi = (t, e,
|
|
3860
|
-
const i =
|
|
3871
|
+
}, Yi = (t, e, r, n) => {
|
|
3872
|
+
const i = r;
|
|
3861
3873
|
i.type = "string";
|
|
3862
|
-
const { minimum: s, maximum: o, format: a, patterns: c, contentEncoding:
|
|
3863
|
-
if (typeof s == "number" && (i.minLength = s), typeof o == "number" && (i.maxLength = o), a && (i.format = Ki[a] ?? a, i.format === "" && delete i.format),
|
|
3864
|
-
const
|
|
3865
|
-
|
|
3866
|
-
...
|
|
3874
|
+
const { minimum: s, maximum: o, format: a, patterns: c, contentEncoding: p } = t._zod.bag;
|
|
3875
|
+
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) {
|
|
3876
|
+
const h = [...c];
|
|
3877
|
+
h.length === 1 ? i.pattern = h[0].source : h.length > 1 && (i.allOf = [
|
|
3878
|
+
...h.map((d) => ({
|
|
3867
3879
|
...e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3868
3880
|
pattern: d.source
|
|
3869
3881
|
}))
|
|
3870
3882
|
]);
|
|
3871
3883
|
}
|
|
3872
|
-
}, qi = (t, e,
|
|
3873
|
-
const i =
|
|
3874
|
-
typeof a == "string" && a.includes("int") ? i.type = "integer" : i.type = "number", typeof
|
|
3875
|
-
}, Xi = (t, e,
|
|
3876
|
-
|
|
3877
|
-
}, Qi = (t, e,
|
|
3878
|
-
}, Hi = (t, e,
|
|
3884
|
+
}, qi = (t, e, r, n) => {
|
|
3885
|
+
const i = r, { minimum: s, maximum: o, format: a, multipleOf: c, exclusiveMaximum: p, exclusiveMinimum: h } = t._zod.bag;
|
|
3886
|
+
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);
|
|
3887
|
+
}, Xi = (t, e, r, n) => {
|
|
3888
|
+
r.not = {};
|
|
3889
|
+
}, Qi = (t, e, r, n) => {
|
|
3890
|
+
}, Hi = (t, e, r, n) => {
|
|
3879
3891
|
const i = t._zod.def, s = tt(i.entries);
|
|
3880
|
-
s.every((o) => typeof o == "number") && (
|
|
3881
|
-
}, es = (t, e,
|
|
3892
|
+
s.every((o) => typeof o == "number") && (r.type = "number"), s.every((o) => typeof o == "string") && (r.type = "string"), r.enum = s;
|
|
3893
|
+
}, es = (t, e, r, n) => {
|
|
3882
3894
|
const i = t._zod.def, s = [];
|
|
3883
3895
|
for (const o of i.values)
|
|
3884
3896
|
if (o === void 0) {
|
|
@@ -3892,74 +3904,74 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3892
3904
|
s.push(o);
|
|
3893
3905
|
if (s.length !== 0) if (s.length === 1) {
|
|
3894
3906
|
const o = s[0];
|
|
3895
|
-
|
|
3907
|
+
r.type = o === null ? "null" : typeof o, e.target === "draft-04" || e.target === "openapi-3.0" ? r.enum = [o] : r.const = o;
|
|
3896
3908
|
} else
|
|
3897
|
-
s.every((o) => typeof o == "number") && (
|
|
3898
|
-
}, ts = (t, e,
|
|
3909
|
+
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;
|
|
3910
|
+
}, ts = (t, e, r, n) => {
|
|
3899
3911
|
if (e.unrepresentable === "throw")
|
|
3900
3912
|
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3901
|
-
},
|
|
3913
|
+
}, rs = (t, e, r, n) => {
|
|
3902
3914
|
if (e.unrepresentable === "throw")
|
|
3903
3915
|
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3904
|
-
},
|
|
3905
|
-
const i =
|
|
3906
|
-
typeof o == "number" && (i.minItems = o), typeof a == "number" && (i.maxItems = a), i.type = "array", i.items = T(s.element, e, { ...
|
|
3907
|
-
}, is = (t, e,
|
|
3908
|
-
const i =
|
|
3916
|
+
}, ns = (t, e, r, n) => {
|
|
3917
|
+
const i = r, s = t._zod.def, { minimum: o, maximum: a } = t._zod.bag;
|
|
3918
|
+
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"] });
|
|
3919
|
+
}, is = (t, e, r, n) => {
|
|
3920
|
+
const i = r, s = t._zod.def;
|
|
3909
3921
|
i.type = "object", i.properties = {};
|
|
3910
3922
|
const o = s.shape;
|
|
3911
|
-
for (const
|
|
3912
|
-
i.properties[
|
|
3913
|
-
...
|
|
3914
|
-
path: [...
|
|
3923
|
+
for (const p in o)
|
|
3924
|
+
i.properties[p] = T(o[p], e, {
|
|
3925
|
+
...n,
|
|
3926
|
+
path: [...n.path, "properties", p]
|
|
3915
3927
|
});
|
|
3916
|
-
const a = new Set(Object.keys(o)), c = new Set([...a].filter((
|
|
3917
|
-
const
|
|
3918
|
-
return e.io === "input" ?
|
|
3928
|
+
const a = new Set(Object.keys(o)), c = new Set([...a].filter((p) => {
|
|
3929
|
+
const h = s.shape[p]._zod;
|
|
3930
|
+
return e.io === "input" ? h.optin === void 0 : h.optout === void 0;
|
|
3919
3931
|
}));
|
|
3920
3932
|
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, {
|
|
3921
|
-
...
|
|
3922
|
-
path: [...
|
|
3933
|
+
...n,
|
|
3934
|
+
path: [...n.path, "additionalProperties"]
|
|
3923
3935
|
})) : e.io === "output" && (i.additionalProperties = !1);
|
|
3924
|
-
}, ss = (t, e,
|
|
3936
|
+
}, ss = (t, e, r, n) => {
|
|
3925
3937
|
const i = t._zod.def, s = i.inclusive === !1, o = i.options.map((a, c) => T(a, e, {
|
|
3926
|
-
...
|
|
3927
|
-
path: [...
|
|
3938
|
+
...n,
|
|
3939
|
+
path: [...n.path, s ? "oneOf" : "anyOf", c]
|
|
3928
3940
|
}));
|
|
3929
|
-
s ?
|
|
3930
|
-
}, os = (t, e,
|
|
3941
|
+
s ? r.oneOf = o : r.anyOf = o;
|
|
3942
|
+
}, os = (t, e, r, n) => {
|
|
3931
3943
|
const i = t._zod.def, s = T(i.left, e, {
|
|
3932
|
-
...
|
|
3933
|
-
path: [...
|
|
3944
|
+
...n,
|
|
3945
|
+
path: [...n.path, "allOf", 0]
|
|
3934
3946
|
}), o = T(i.right, e, {
|
|
3935
|
-
...
|
|
3936
|
-
path: [...
|
|
3937
|
-
}), a = (
|
|
3947
|
+
...n,
|
|
3948
|
+
path: [...n.path, "allOf", 1]
|
|
3949
|
+
}), a = (p) => "allOf" in p && Object.keys(p).length === 1, c = [
|
|
3938
3950
|
...a(s) ? s.allOf : [s],
|
|
3939
3951
|
...a(o) ? o.allOf : [o]
|
|
3940
3952
|
];
|
|
3941
|
-
|
|
3942
|
-
}, as = (t, e,
|
|
3943
|
-
const i = t._zod.def, s = T(i.innerType, e,
|
|
3944
|
-
e.target === "openapi-3.0" ? (o.ref = i.innerType,
|
|
3945
|
-
}, cs = (t, e,
|
|
3953
|
+
r.allOf = c;
|
|
3954
|
+
}, as = (t, e, r, n) => {
|
|
3955
|
+
const i = t._zod.def, s = T(i.innerType, e, n), o = e.seen.get(t);
|
|
3956
|
+
e.target === "openapi-3.0" ? (o.ref = i.innerType, r.nullable = !0) : r.anyOf = [s, { type: "null" }];
|
|
3957
|
+
}, cs = (t, e, r, n) => {
|
|
3946
3958
|
const i = t._zod.def;
|
|
3947
|
-
T(i.innerType, e,
|
|
3959
|
+
T(i.innerType, e, n);
|
|
3948
3960
|
const s = e.seen.get(t);
|
|
3949
3961
|
s.ref = i.innerType;
|
|
3950
|
-
}, us = (t, e,
|
|
3962
|
+
}, us = (t, e, r, n) => {
|
|
3951
3963
|
const i = t._zod.def;
|
|
3952
|
-
T(i.innerType, e,
|
|
3964
|
+
T(i.innerType, e, n);
|
|
3953
3965
|
const s = e.seen.get(t);
|
|
3954
|
-
s.ref = i.innerType,
|
|
3955
|
-
},
|
|
3966
|
+
s.ref = i.innerType, r.default = JSON.parse(JSON.stringify(i.defaultValue));
|
|
3967
|
+
}, ps = (t, e, r, n) => {
|
|
3956
3968
|
const i = t._zod.def;
|
|
3957
|
-
T(i.innerType, e,
|
|
3969
|
+
T(i.innerType, e, n);
|
|
3958
3970
|
const s = e.seen.get(t);
|
|
3959
|
-
s.ref = i.innerType, e.io === "input" && (
|
|
3960
|
-
},
|
|
3971
|
+
s.ref = i.innerType, e.io === "input" && (r._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
|
|
3972
|
+
}, hs = (t, e, r, n) => {
|
|
3961
3973
|
const i = t._zod.def;
|
|
3962
|
-
T(i.innerType, e,
|
|
3974
|
+
T(i.innerType, e, n);
|
|
3963
3975
|
const s = e.seen.get(t);
|
|
3964
3976
|
s.ref = i.innerType;
|
|
3965
3977
|
let o;
|
|
@@ -3968,65 +3980,65 @@ const Wi = (t, e = {}) => (n) => {
|
|
|
3968
3980
|
} catch {
|
|
3969
3981
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3970
3982
|
}
|
|
3971
|
-
|
|
3972
|
-
}, ls = (t, e,
|
|
3983
|
+
r.default = o;
|
|
3984
|
+
}, ls = (t, e, r, n) => {
|
|
3973
3985
|
const i = t._zod.def, s = e.io === "input" ? i.in._zod.def.type === "transform" ? i.out : i.in : i.out;
|
|
3974
|
-
T(s, e,
|
|
3986
|
+
T(s, e, n);
|
|
3975
3987
|
const o = e.seen.get(t);
|
|
3976
3988
|
o.ref = s;
|
|
3977
|
-
}, ds = (t, e,
|
|
3989
|
+
}, ds = (t, e, r, n) => {
|
|
3978
3990
|
const i = t._zod.def;
|
|
3979
|
-
T(i.innerType, e,
|
|
3991
|
+
T(i.innerType, e, n);
|
|
3980
3992
|
const s = e.seen.get(t);
|
|
3981
|
-
s.ref = i.innerType,
|
|
3982
|
-
}, fs = (t, e,
|
|
3993
|
+
s.ref = i.innerType, r.readOnly = !0;
|
|
3994
|
+
}, fs = (t, e, r, n) => {
|
|
3983
3995
|
const i = t._zod.def;
|
|
3984
|
-
T(i.innerType, e,
|
|
3996
|
+
T(i.innerType, e, n);
|
|
3985
3997
|
const s = e.seen.get(t);
|
|
3986
3998
|
s.ref = i.innerType;
|
|
3987
3999
|
}, ms = /* @__PURE__ */ u("ZodISODateTime", (t, e) => {
|
|
3988
|
-
|
|
4000
|
+
yn.init(t, e), _.init(t, e);
|
|
3989
4001
|
});
|
|
3990
4002
|
function gs(t) {
|
|
3991
|
-
return
|
|
4003
|
+
return Ii(ms, t);
|
|
3992
4004
|
}
|
|
3993
4005
|
const vs = /* @__PURE__ */ u("ZodISODate", (t, e) => {
|
|
3994
|
-
|
|
4006
|
+
Tn.init(t, e), _.init(t, e);
|
|
3995
4007
|
});
|
|
3996
4008
|
function _s(t) {
|
|
3997
|
-
return
|
|
4009
|
+
return Ei(vs, t);
|
|
3998
4010
|
}
|
|
3999
4011
|
const ks = /* @__PURE__ */ u("ZodISOTime", (t, e) => {
|
|
4000
|
-
|
|
4012
|
+
bn.init(t, e), _.init(t, e);
|
|
4001
4013
|
});
|
|
4002
4014
|
function ys(t) {
|
|
4003
4015
|
return zi(ks, t);
|
|
4004
4016
|
}
|
|
4005
4017
|
const Ts = /* @__PURE__ */ u("ZodISODuration", (t, e) => {
|
|
4006
|
-
|
|
4018
|
+
wn.init(t, e), _.init(t, e);
|
|
4007
4019
|
});
|
|
4008
|
-
function
|
|
4020
|
+
function bs(t) {
|
|
4009
4021
|
return $i(Ts, t);
|
|
4010
4022
|
}
|
|
4011
|
-
const
|
|
4023
|
+
const ws = (t, e) => {
|
|
4012
4024
|
ot.init(t, e), t.name = "ZodError", Object.defineProperties(t, {
|
|
4013
4025
|
format: {
|
|
4014
|
-
value: (
|
|
4026
|
+
value: (r) => lr(t, r)
|
|
4015
4027
|
// enumerable: false,
|
|
4016
4028
|
},
|
|
4017
4029
|
flatten: {
|
|
4018
|
-
value: (
|
|
4030
|
+
value: (r) => hr(t, r)
|
|
4019
4031
|
// enumerable: false,
|
|
4020
4032
|
},
|
|
4021
4033
|
addIssue: {
|
|
4022
|
-
value: (
|
|
4023
|
-
t.issues.push(
|
|
4034
|
+
value: (r) => {
|
|
4035
|
+
t.issues.push(r), t.message = JSON.stringify(t.issues, le, 2);
|
|
4024
4036
|
}
|
|
4025
4037
|
// enumerable: false,
|
|
4026
4038
|
},
|
|
4027
4039
|
addIssues: {
|
|
4028
|
-
value: (
|
|
4029
|
-
t.issues.push(...
|
|
4040
|
+
value: (r) => {
|
|
4041
|
+
t.issues.push(...r), t.message = JSON.stringify(t.issues, le, 2);
|
|
4030
4042
|
}
|
|
4031
4043
|
// enumerable: false,
|
|
4032
4044
|
},
|
|
@@ -4037,126 +4049,126 @@ const bs = (t, e) => {
|
|
|
4037
4049
|
// enumerable: false,
|
|
4038
4050
|
}
|
|
4039
4051
|
});
|
|
4040
|
-
}, $ = u("ZodError",
|
|
4052
|
+
}, $ = u("ZodError", ws, {
|
|
4041
4053
|
Parent: Error
|
|
4042
|
-
}),
|
|
4054
|
+
}), 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"], {
|
|
4043
4055
|
jsonSchema: {
|
|
4044
4056
|
input: te(t, "input"),
|
|
4045
4057
|
output: te(t, "output")
|
|
4046
4058
|
}
|
|
4047
|
-
}), t.toJSONSchema = Wi(t, {}), t.def = e, t.type = e.type, Object.defineProperty(t, "_def", { value: e }), t.check = (...
|
|
4059
|
+
}), t.toJSONSchema = Wi(t, {}), t.def = e, t.type = e.type, Object.defineProperty(t, "_def", { value: e }), t.check = (...r) => t.clone(L(e, {
|
|
4048
4060
|
checks: [
|
|
4049
4061
|
...e.checks ?? [],
|
|
4050
|
-
...
|
|
4062
|
+
...r.map((n) => typeof n == "function" ? { _zod: { check: n, def: { check: "custom" }, onattach: [] } } : n)
|
|
4051
4063
|
]
|
|
4052
|
-
})), t.clone = (
|
|
4053
|
-
const
|
|
4054
|
-
return V.add(
|
|
4064
|
+
})), 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) => {
|
|
4065
|
+
const n = t.clone();
|
|
4066
|
+
return V.add(n, { description: r }), n;
|
|
4055
4067
|
}, Object.defineProperty(t, "description", {
|
|
4056
4068
|
get() {
|
|
4057
4069
|
return V.get(t)?.description;
|
|
4058
4070
|
},
|
|
4059
4071
|
configurable: !0
|
|
4060
|
-
}), t.meta = (...
|
|
4061
|
-
if (
|
|
4072
|
+
}), t.meta = (...r) => {
|
|
4073
|
+
if (r.length === 0)
|
|
4062
4074
|
return V.get(t);
|
|
4063
|
-
const
|
|
4064
|
-
return V.add(
|
|
4065
|
-
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)),
|
|
4066
|
-
ye.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4067
|
-
const
|
|
4068
|
-
t.format =
|
|
4069
|
-
}),
|
|
4070
|
-
ye.init(t, e),
|
|
4075
|
+
const n = t.clone();
|
|
4076
|
+
return V.add(n, r[0]), n;
|
|
4077
|
+
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)), It = /* @__PURE__ */ u("_ZodString", (t, e) => {
|
|
4078
|
+
ye.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, i, s) => Yi(t, n, i);
|
|
4079
|
+
const r = t._zod.bag;
|
|
4080
|
+
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());
|
|
4081
|
+
}), xs = /* @__PURE__ */ u("ZodString", (t, e) => {
|
|
4082
|
+
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));
|
|
4071
4083
|
});
|
|
4072
|
-
function
|
|
4073
|
-
return
|
|
4084
|
+
function E(t) {
|
|
4085
|
+
return ri(xs, t);
|
|
4074
4086
|
}
|
|
4075
4087
|
const _ = /* @__PURE__ */ u("ZodStringFormat", (t, e) => {
|
|
4076
|
-
|
|
4077
|
-
}),
|
|
4078
|
-
|
|
4079
|
-
}),
|
|
4080
|
-
|
|
4088
|
+
v.init(t, e), It.init(t, e);
|
|
4089
|
+
}), Ls = /* @__PURE__ */ u("ZodEmail", (t, e) => {
|
|
4090
|
+
hn.init(t, e), _.init(t, e);
|
|
4091
|
+
}), Me = /* @__PURE__ */ u("ZodGUID", (t, e) => {
|
|
4092
|
+
un.init(t, e), _.init(t, e);
|
|
4081
4093
|
}), X = /* @__PURE__ */ u("ZodUUID", (t, e) => {
|
|
4082
|
-
|
|
4094
|
+
pn.init(t, e), _.init(t, e);
|
|
4083
4095
|
}), Ds = /* @__PURE__ */ u("ZodURL", (t, e) => {
|
|
4084
|
-
|
|
4096
|
+
ln.init(t, e), _.init(t, e);
|
|
4085
4097
|
}), Fs = /* @__PURE__ */ u("ZodEmoji", (t, e) => {
|
|
4086
|
-
|
|
4087
|
-
}),
|
|
4088
|
-
|
|
4089
|
-
}),
|
|
4090
|
-
|
|
4098
|
+
dn.init(t, e), _.init(t, e);
|
|
4099
|
+
}), Ms = /* @__PURE__ */ u("ZodNanoID", (t, e) => {
|
|
4100
|
+
fn.init(t, e), _.init(t, e);
|
|
4101
|
+
}), js = /* @__PURE__ */ u("ZodCUID", (t, e) => {
|
|
4102
|
+
mn.init(t, e), _.init(t, e);
|
|
4091
4103
|
}), Us = /* @__PURE__ */ u("ZodCUID2", (t, e) => {
|
|
4092
|
-
|
|
4104
|
+
gn.init(t, e), _.init(t, e);
|
|
4093
4105
|
}), Gs = /* @__PURE__ */ u("ZodULID", (t, e) => {
|
|
4094
|
-
|
|
4106
|
+
vn.init(t, e), _.init(t, e);
|
|
4095
4107
|
}), Vs = /* @__PURE__ */ u("ZodXID", (t, e) => {
|
|
4096
|
-
|
|
4108
|
+
_n.init(t, e), _.init(t, e);
|
|
4097
4109
|
}), Bs = /* @__PURE__ */ u("ZodKSUID", (t, e) => {
|
|
4098
|
-
|
|
4110
|
+
kn.init(t, e), _.init(t, e);
|
|
4099
4111
|
}), Js = /* @__PURE__ */ u("ZodIPv4", (t, e) => {
|
|
4100
|
-
|
|
4112
|
+
In.init(t, e), _.init(t, e);
|
|
4101
4113
|
}), Ws = /* @__PURE__ */ u("ZodIPv6", (t, e) => {
|
|
4102
|
-
|
|
4114
|
+
En.init(t, e), _.init(t, e);
|
|
4103
4115
|
}), Ks = /* @__PURE__ */ u("ZodCIDRv4", (t, e) => {
|
|
4104
|
-
|
|
4116
|
+
zn.init(t, e), _.init(t, e);
|
|
4105
4117
|
}), Ys = /* @__PURE__ */ u("ZodCIDRv6", (t, e) => {
|
|
4106
|
-
$
|
|
4118
|
+
$n.init(t, e), _.init(t, e);
|
|
4107
4119
|
}), qs = /* @__PURE__ */ u("ZodBase64", (t, e) => {
|
|
4108
|
-
|
|
4120
|
+
On.init(t, e), _.init(t, e);
|
|
4109
4121
|
}), Xs = /* @__PURE__ */ u("ZodBase64URL", (t, e) => {
|
|
4110
|
-
|
|
4122
|
+
Sn.init(t, e), _.init(t, e);
|
|
4111
4123
|
}), Qs = /* @__PURE__ */ u("ZodE164", (t, e) => {
|
|
4112
|
-
|
|
4124
|
+
Nn.init(t, e), _.init(t, e);
|
|
4113
4125
|
}), Hs = /* @__PURE__ */ u("ZodJWT", (t, e) => {
|
|
4114
|
-
|
|
4115
|
-
}),
|
|
4116
|
-
mt.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4117
|
-
const
|
|
4118
|
-
t.minValue = Math.max(
|
|
4126
|
+
Zn.init(t, e), _.init(t, e);
|
|
4127
|
+
}), Et = /* @__PURE__ */ u("ZodNumber", (t, e) => {
|
|
4128
|
+
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;
|
|
4129
|
+
const r = t._zod.bag;
|
|
4130
|
+
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;
|
|
4119
4131
|
});
|
|
4120
4132
|
function eo(t) {
|
|
4121
|
-
return Oi(
|
|
4133
|
+
return Oi(Et, t);
|
|
4122
4134
|
}
|
|
4123
4135
|
const to = /* @__PURE__ */ u("ZodNumberFormat", (t, e) => {
|
|
4124
|
-
|
|
4136
|
+
Cn.init(t, e), Et.init(t, e);
|
|
4125
4137
|
});
|
|
4126
|
-
function
|
|
4138
|
+
function je(t) {
|
|
4127
4139
|
return Pi(to, t);
|
|
4128
4140
|
}
|
|
4129
|
-
const
|
|
4130
|
-
|
|
4141
|
+
const ro = /* @__PURE__ */ u("ZodUnknown", (t, e) => {
|
|
4142
|
+
Rn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => Qi();
|
|
4131
4143
|
});
|
|
4132
4144
|
function Ue() {
|
|
4133
|
-
return Si(
|
|
4145
|
+
return Si(ro);
|
|
4134
4146
|
}
|
|
4135
|
-
const
|
|
4136
|
-
|
|
4147
|
+
const no = /* @__PURE__ */ u("ZodNever", (t, e) => {
|
|
4148
|
+
xn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => Xi(t, r, n);
|
|
4137
4149
|
});
|
|
4138
4150
|
function io(t) {
|
|
4139
|
-
return Ni(
|
|
4151
|
+
return Ni(no, t);
|
|
4140
4152
|
}
|
|
4141
4153
|
const so = /* @__PURE__ */ u("ZodArray", (t, e) => {
|
|
4142
|
-
|
|
4154
|
+
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;
|
|
4143
4155
|
});
|
|
4144
4156
|
function Z(t, e) {
|
|
4145
4157
|
return Gi(so, t, e);
|
|
4146
4158
|
}
|
|
4147
4159
|
const oo = /* @__PURE__ */ u("ZodObject", (t, e) => {
|
|
4148
|
-
|
|
4160
|
+
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]);
|
|
4149
4161
|
});
|
|
4150
4162
|
function z(t, e) {
|
|
4151
|
-
const
|
|
4163
|
+
const r = {
|
|
4152
4164
|
type: "object",
|
|
4153
4165
|
shape: t ?? {},
|
|
4154
4166
|
...l(e)
|
|
4155
4167
|
};
|
|
4156
|
-
return new oo(
|
|
4168
|
+
return new oo(r);
|
|
4157
4169
|
}
|
|
4158
4170
|
const zt = /* @__PURE__ */ u("ZodUnion", (t, e) => {
|
|
4159
|
-
_t.init(t, e), y.init(t, e), t._zod.processJSONSchema = (
|
|
4171
|
+
_t.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ss(t, r, n, i), t.options = e.options;
|
|
4160
4172
|
});
|
|
4161
4173
|
function ae(t, e) {
|
|
4162
4174
|
return new zt({
|
|
@@ -4166,20 +4178,20 @@ function ae(t, e) {
|
|
|
4166
4178
|
});
|
|
4167
4179
|
}
|
|
4168
4180
|
const ao = /* @__PURE__ */ u("ZodDiscriminatedUnion", (t, e) => {
|
|
4169
|
-
zt.init(t, e),
|
|
4181
|
+
zt.init(t, e), Mn.init(t, e);
|
|
4170
4182
|
});
|
|
4171
|
-
function co(t, e,
|
|
4183
|
+
function co(t, e, r) {
|
|
4172
4184
|
return new ao({
|
|
4173
4185
|
type: "union",
|
|
4174
4186
|
options: e,
|
|
4175
4187
|
discriminator: t,
|
|
4176
|
-
...l(
|
|
4188
|
+
...l(r)
|
|
4177
4189
|
});
|
|
4178
4190
|
}
|
|
4179
4191
|
const uo = /* @__PURE__ */ u("ZodIntersection", (t, e) => {
|
|
4180
|
-
|
|
4192
|
+
jn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => os(t, r, n, i);
|
|
4181
4193
|
});
|
|
4182
|
-
function
|
|
4194
|
+
function po(t, e) {
|
|
4183
4195
|
return new uo({
|
|
4184
4196
|
type: "intersection",
|
|
4185
4197
|
left: t,
|
|
@@ -4187,12 +4199,12 @@ function ho(t, e) {
|
|
|
4187
4199
|
});
|
|
4188
4200
|
}
|
|
4189
4201
|
const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
4190
|
-
|
|
4191
|
-
const
|
|
4192
|
-
t.extract = (
|
|
4202
|
+
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);
|
|
4203
|
+
const r = new Set(Object.keys(e.entries));
|
|
4204
|
+
t.extract = (n, i) => {
|
|
4193
4205
|
const s = {};
|
|
4194
|
-
for (const o of
|
|
4195
|
-
if (
|
|
4206
|
+
for (const o of n)
|
|
4207
|
+
if (r.has(o))
|
|
4196
4208
|
s[o] = e.entries[o];
|
|
4197
4209
|
else
|
|
4198
4210
|
throw new Error(`Key ${o} not found in enum`);
|
|
@@ -4202,10 +4214,10 @@ const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
|
4202
4214
|
...l(i),
|
|
4203
4215
|
entries: s
|
|
4204
4216
|
});
|
|
4205
|
-
}, t.exclude = (
|
|
4217
|
+
}, t.exclude = (n, i) => {
|
|
4206
4218
|
const s = { ...e.entries };
|
|
4207
|
-
for (const o of
|
|
4208
|
-
if (
|
|
4219
|
+
for (const o of n)
|
|
4220
|
+
if (r.has(o))
|
|
4209
4221
|
delete s[o];
|
|
4210
4222
|
else
|
|
4211
4223
|
throw new Error(`Key ${o} not found in enum`);
|
|
@@ -4218,15 +4230,15 @@ const fe = /* @__PURE__ */ u("ZodEnum", (t, e) => {
|
|
|
4218
4230
|
};
|
|
4219
4231
|
});
|
|
4220
4232
|
function $t(t, e) {
|
|
4221
|
-
const
|
|
4233
|
+
const r = Array.isArray(t) ? Object.fromEntries(t.map((n) => [n, n])) : t;
|
|
4222
4234
|
return new fe({
|
|
4223
4235
|
type: "enum",
|
|
4224
|
-
entries:
|
|
4236
|
+
entries: r,
|
|
4225
4237
|
...l(e)
|
|
4226
4238
|
});
|
|
4227
4239
|
}
|
|
4228
|
-
const
|
|
4229
|
-
|
|
4240
|
+
const ho = /* @__PURE__ */ u("ZodLiteral", (t, e) => {
|
|
4241
|
+
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", {
|
|
4230
4242
|
get() {
|
|
4231
4243
|
if (e.values.length > 1)
|
|
4232
4244
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -4235,26 +4247,26 @@ const po = /* @__PURE__ */ u("ZodLiteral", (t, e) => {
|
|
|
4235
4247
|
});
|
|
4236
4248
|
});
|
|
4237
4249
|
function A(t, e) {
|
|
4238
|
-
return new
|
|
4250
|
+
return new ho({
|
|
4239
4251
|
type: "literal",
|
|
4240
4252
|
values: Array.isArray(t) ? t : [t],
|
|
4241
4253
|
...l(e)
|
|
4242
4254
|
});
|
|
4243
4255
|
}
|
|
4244
4256
|
const lo = /* @__PURE__ */ u("ZodTransform", (t, e) => {
|
|
4245
|
-
|
|
4246
|
-
if (
|
|
4257
|
+
Vn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => rs(t, r), t._zod.parse = (r, n) => {
|
|
4258
|
+
if (n.direction === "backward")
|
|
4247
4259
|
throw new He(t.constructor.name);
|
|
4248
|
-
|
|
4260
|
+
r.addIssue = (s) => {
|
|
4249
4261
|
if (typeof s == "string")
|
|
4250
|
-
|
|
4262
|
+
r.issues.push(W(s, r.value, e));
|
|
4251
4263
|
else {
|
|
4252
4264
|
const o = s;
|
|
4253
|
-
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input =
|
|
4265
|
+
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));
|
|
4254
4266
|
}
|
|
4255
4267
|
};
|
|
4256
|
-
const i = e.transform(
|
|
4257
|
-
return i instanceof Promise ? i.then((s) => (
|
|
4268
|
+
const i = e.transform(r.value, r);
|
|
4269
|
+
return i instanceof Promise ? i.then((s) => (r.value = s, r)) : (r.value = i, r);
|
|
4258
4270
|
};
|
|
4259
4271
|
});
|
|
4260
4272
|
function fo(t) {
|
|
@@ -4264,7 +4276,7 @@ function fo(t) {
|
|
|
4264
4276
|
});
|
|
4265
4277
|
}
|
|
4266
4278
|
const Ot = /* @__PURE__ */ u("ZodOptional", (t, e) => {
|
|
4267
|
-
|
|
4279
|
+
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;
|
|
4268
4280
|
});
|
|
4269
4281
|
function Ge(t) {
|
|
4270
4282
|
return new Ot({
|
|
@@ -4273,7 +4285,7 @@ function Ge(t) {
|
|
|
4273
4285
|
});
|
|
4274
4286
|
}
|
|
4275
4287
|
const mo = /* @__PURE__ */ u("ZodNullable", (t, e) => {
|
|
4276
|
-
|
|
4288
|
+
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;
|
|
4277
4289
|
});
|
|
4278
4290
|
function Ve(t) {
|
|
4279
4291
|
return new mo({
|
|
@@ -4282,31 +4294,31 @@ function Ve(t) {
|
|
|
4282
4294
|
});
|
|
4283
4295
|
}
|
|
4284
4296
|
const go = /* @__PURE__ */ u("ZodDefault", (t, e) => {
|
|
4285
|
-
|
|
4297
|
+
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;
|
|
4286
4298
|
});
|
|
4287
4299
|
function vo(t, e) {
|
|
4288
4300
|
return new go({
|
|
4289
4301
|
type: "default",
|
|
4290
4302
|
innerType: t,
|
|
4291
4303
|
get defaultValue() {
|
|
4292
|
-
return typeof e == "function" ? e() :
|
|
4304
|
+
return typeof e == "function" ? e() : nt(e);
|
|
4293
4305
|
}
|
|
4294
4306
|
});
|
|
4295
4307
|
}
|
|
4296
4308
|
const _o = /* @__PURE__ */ u("ZodPrefault", (t, e) => {
|
|
4297
|
-
|
|
4309
|
+
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;
|
|
4298
4310
|
});
|
|
4299
4311
|
function ko(t, e) {
|
|
4300
4312
|
return new _o({
|
|
4301
4313
|
type: "prefault",
|
|
4302
4314
|
innerType: t,
|
|
4303
4315
|
get defaultValue() {
|
|
4304
|
-
return typeof e == "function" ? e() :
|
|
4316
|
+
return typeof e == "function" ? e() : nt(e);
|
|
4305
4317
|
}
|
|
4306
4318
|
});
|
|
4307
4319
|
}
|
|
4308
4320
|
const Pt = /* @__PURE__ */ u("ZodNonOptional", (t, e) => {
|
|
4309
|
-
|
|
4321
|
+
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;
|
|
4310
4322
|
});
|
|
4311
4323
|
function yo(t, e) {
|
|
4312
4324
|
return new Pt({
|
|
@@ -4316,37 +4328,37 @@ function yo(t, e) {
|
|
|
4316
4328
|
});
|
|
4317
4329
|
}
|
|
4318
4330
|
const To = /* @__PURE__ */ u("ZodCatch", (t, e) => {
|
|
4319
|
-
|
|
4331
|
+
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;
|
|
4320
4332
|
});
|
|
4321
|
-
function
|
|
4333
|
+
function bo(t, e) {
|
|
4322
4334
|
return new To({
|
|
4323
4335
|
type: "catch",
|
|
4324
4336
|
innerType: t,
|
|
4325
4337
|
catchValue: typeof e == "function" ? e : () => e
|
|
4326
4338
|
});
|
|
4327
4339
|
}
|
|
4328
|
-
const
|
|
4329
|
-
|
|
4340
|
+
const wo = /* @__PURE__ */ u("ZodPipe", (t, e) => {
|
|
4341
|
+
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;
|
|
4330
4342
|
});
|
|
4331
4343
|
function Be(t, e) {
|
|
4332
|
-
return new
|
|
4344
|
+
return new wo({
|
|
4333
4345
|
type: "pipe",
|
|
4334
4346
|
in: t,
|
|
4335
4347
|
out: e
|
|
4336
4348
|
// ...util.normalizeParams(params),
|
|
4337
4349
|
});
|
|
4338
4350
|
}
|
|
4339
|
-
const
|
|
4340
|
-
|
|
4351
|
+
const Io = /* @__PURE__ */ u("ZodReadonly", (t, e) => {
|
|
4352
|
+
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;
|
|
4341
4353
|
});
|
|
4342
|
-
function
|
|
4343
|
-
return new
|
|
4354
|
+
function Eo(t) {
|
|
4355
|
+
return new Io({
|
|
4344
4356
|
type: "readonly",
|
|
4345
4357
|
innerType: t
|
|
4346
4358
|
});
|
|
4347
4359
|
}
|
|
4348
4360
|
const zo = /* @__PURE__ */ u("ZodCustom", (t, e) => {
|
|
4349
|
-
|
|
4361
|
+
Hn.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, n, i) => ts(t, r);
|
|
4350
4362
|
});
|
|
4351
4363
|
function $o(t, e = {}) {
|
|
4352
4364
|
return Vi(zo, t, e);
|
|
@@ -4355,86 +4367,111 @@ function Oo(t) {
|
|
|
4355
4367
|
return Bi(t);
|
|
4356
4368
|
}
|
|
4357
4369
|
const S = ae([
|
|
4358
|
-
|
|
4370
|
+
E(),
|
|
4359
4371
|
z({
|
|
4360
|
-
pattern:
|
|
4361
|
-
|
|
4372
|
+
pattern: E().describe(`Regex pattern to match.
|
|
4373
|
+
@example ".*\\\\.ts$"`),
|
|
4374
|
+
flags: E().optional().describe(`Regex flags to modify matching behavior (e.g. "i" for case-insensitive, "m" for multiline).
|
|
4375
|
+
@example "i"`)
|
|
4362
4376
|
})
|
|
4363
|
-
]), Po = z({
|
|
4364
|
-
kind: A("fragment")
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4377
|
+
]).describe("A string or a regex pattern to match text."), Po = z({
|
|
4378
|
+
kind: A("fragment").describe(`The type of element to select.
|
|
4379
|
+
@example "fragment"`),
|
|
4380
|
+
condition: S.optional().describe(`Filter by branch condition text (e.g. "Success").
|
|
4381
|
+
@example "Success"`),
|
|
4382
|
+
operator: ae([E(), Z(E())]).optional().describe(`Filter by loop/alt type.
|
|
4383
|
+
@example "loop"
|
|
4384
|
+
@values "loop", "alt", "opt", "break", "par", "critical"`)
|
|
4385
|
+
}).describe("Selects fragment (alt/loop/opt) blocks."), Te = z({
|
|
4386
|
+
kind: A("participant").describe(`The type of element to select.
|
|
4387
|
+
@example "participant"`),
|
|
4388
|
+
name: S.optional().describe(`Filter by participant name (the text displayed).
|
|
4389
|
+
@example "UserService"`),
|
|
4390
|
+
id: S.optional().describe(`Filter by participant ID (alias).
|
|
4391
|
+
@example "S1"`),
|
|
4392
|
+
stereotype: S.optional().describe(`Filter by stereotype (e.g. <<Service>>).
|
|
4393
|
+
@example "<<Service>>"`)
|
|
4394
|
+
}).describe("Selects participants in the diagram."), So = z({
|
|
4395
|
+
kind: A("message").describe(`The type of element to select.
|
|
4396
|
+
@example "message"`),
|
|
4397
|
+
text: S.optional().describe(`Filter by message content.
|
|
4398
|
+
@example "Login Request"`),
|
|
4399
|
+
from: S.optional().describe(`Filter by Sender participant ID.
|
|
4400
|
+
@example "User"`),
|
|
4401
|
+
to: S.optional().describe(`Filter by Receiver participant ID.
|
|
4402
|
+
@example "Database"`)
|
|
4403
|
+
}).describe("Selects messages between participants."), No = z({
|
|
4404
|
+
kind: A("group").describe(`The type of element to select.
|
|
4405
|
+
@example "group"`),
|
|
4406
|
+
name: S.optional().describe(`Filter by group name.
|
|
4407
|
+
@example "Services"`)
|
|
4408
|
+
}).describe("Selects groups (boxes/rectangles) of participants."), Ao = z({
|
|
4409
|
+
action: A("resolve").describe(`The operation to perform.
|
|
4410
|
+
@example "resolve"`),
|
|
4411
|
+
selector: Po.describe("Criteria for selecting fragments to resolve.")
|
|
4412
|
+
}).describe("Unwraps specific branches of fragments (alt, opt, loop), simplifying the diagram."), Zo = z({
|
|
4413
|
+
action: A("focus").describe(`The operation to perform.
|
|
4414
|
+
@example "focus"`),
|
|
4415
|
+
selector: Te.describe("Criteria for selecting participants to focus on.")
|
|
4416
|
+
}).describe("Keeps only interactions involving the selected participants, hiding everything else."), Co = z({
|
|
4417
|
+
action: A("remove").describe(`The operation to perform.
|
|
4418
|
+
@example "remove"`),
|
|
4390
4419
|
selector: ae([
|
|
4391
4420
|
Te,
|
|
4392
4421
|
So,
|
|
4393
4422
|
No
|
|
4394
|
-
])
|
|
4395
|
-
}), Ro = z({
|
|
4396
|
-
action: A("merge")
|
|
4423
|
+
]).describe("Criteria for selecting elements to remove.")
|
|
4424
|
+
}).describe("Removes the selected elements (participants, messages, or groups) from the diagram."), Ro = z({
|
|
4425
|
+
action: A("merge").describe(`The operation to perform.
|
|
4426
|
+
@example "merge"`),
|
|
4397
4427
|
into: z({
|
|
4398
|
-
name:
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4428
|
+
name: E().optional().describe(`The name of the new merged participant.
|
|
4429
|
+
@example "User System"`),
|
|
4430
|
+
id: E().optional().describe(`The ID of the new merged participant.
|
|
4431
|
+
@example "MergedUser"`),
|
|
4432
|
+
stereotype: E().optional().describe(`The stereotype of the new merged participant.
|
|
4433
|
+
@example "<<System>>"`)
|
|
4434
|
+
}).optional().describe("Configuration for the target participant to merge into."),
|
|
4435
|
+
selector: Te.describe("Criteria for selecting participants to merge.")
|
|
4436
|
+
}).describe("Merges multiple participants into a single participant."), xo = co("action", [
|
|
4404
4437
|
Ao,
|
|
4405
4438
|
Zo,
|
|
4406
4439
|
Co,
|
|
4407
4440
|
Ro
|
|
4408
|
-
]),
|
|
4409
|
-
name:
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
})
|
|
4441
|
+
]).describe("A transformation step to apply to the diagram."), Lo = z({
|
|
4442
|
+
name: E().describe(`Unique name for the lens. Used to generate the output filename.
|
|
4443
|
+
@example "web-view"`),
|
|
4444
|
+
suffix: E().optional().describe(`Custom file suffix. If omitted, defaults to ".<name>".
|
|
4445
|
+
@example ".web.mmd"`),
|
|
4446
|
+
layers: Z(xo).describe("Ordered list of transformation layers. Applied sequentially.")
|
|
4447
|
+
}).describe("A specific view or transformation configuration for the diagram."), Je = $t(["mermaid", "plantuml"]).describe(`Supported diagram format for parsing/generation.
|
|
4448
|
+
@example "mermaid"`), Do = z({
|
|
4449
|
+
input: Z(E()).describe(`Array of file paths or glob patterns to include.
|
|
4450
|
+
@example ["src/**/*.mmd"]`),
|
|
4451
|
+
outputDir: E().describe(`Directory where generated files will be saved.
|
|
4452
|
+
@example "generated"`),
|
|
4453
|
+
ignore: Z(E()).optional().describe(`Array of glob patterns to exclude files from processing.
|
|
4454
|
+
@example ["**/node_modules/**", "**/*.test.mmd"]`),
|
|
4455
|
+
lenses: Z(Lo).describe("List of lenses (transformations) to apply to the input diagrams."),
|
|
4456
|
+
format: Je.optional().describe("Input format (auto-detected if omitted)."),
|
|
4457
|
+
outputFormat: Je.optional().describe("Output format (same as input if omitted).")
|
|
4458
|
+
}).describe("Defines a conversion target: inputs, output location, and transformations."), Fo = z({
|
|
4459
|
+
version: eo().describe(`The version of the configuration schema. Currently, only version 1 is supported.
|
|
4460
|
+
@example 1`),
|
|
4461
|
+
targets: Z(Do).describe("A list of conversion targets.")
|
|
4462
|
+
}).describe("The root configuration object for Polagram.");
|
|
4426
4463
|
function Vo(t) {
|
|
4427
4464
|
const e = Fo.safeParse(t);
|
|
4428
4465
|
if (!e.success) {
|
|
4429
|
-
const
|
|
4466
|
+
const r = e.error.issues.map((n) => `[${n.path.join(".")}]: ${n.message}`).join(`
|
|
4430
4467
|
`);
|
|
4431
4468
|
throw new Error(`Invalid Polagram Configuration:
|
|
4432
|
-
${
|
|
4469
|
+
${r}`);
|
|
4433
4470
|
}
|
|
4434
4471
|
return e.data;
|
|
4435
4472
|
}
|
|
4436
4473
|
export {
|
|
4437
|
-
|
|
4474
|
+
we as FormatDetector,
|
|
4438
4475
|
Go as GeneratorFactory,
|
|
4439
4476
|
Ye as MermaidGeneratorVisitor,
|
|
4440
4477
|
Ut as ParserFactory,
|