@polagram/core 0.0.4 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +102 -113
- package/dist/polagram-core.js +1532 -1404
- package/dist/polagram-core.umd.cjs +22 -22
- package/package.json +3 -2
- package/dist/src/api.d.ts +0 -84
- package/dist/src/api.js +0 -183
- package/dist/src/ast/ast.test.d.ts +0 -1
- package/dist/src/ast/ast.test.js +0 -146
- package/dist/src/ast/index.d.ts +0 -119
- package/dist/src/ast/index.js +0 -2
- package/dist/src/config/index.d.ts +0 -1
- package/dist/src/config/index.js +0 -1
- package/dist/src/config/schema.d.ts +0 -198
- package/dist/src/config/schema.js +0 -82
- package/dist/src/config/schema.test.d.ts +0 -1
- package/dist/src/config/schema.test.js +0 -94
- package/dist/src/generator/base/walker.d.ts +0 -19
- package/dist/src/generator/base/walker.js +0 -56
- package/dist/src/generator/base/walker.test.d.ts +0 -1
- package/dist/src/generator/base/walker.test.js +0 -49
- package/dist/src/generator/generators/mermaid.d.ts +0 -24
- package/dist/src/generator/generators/mermaid.js +0 -140
- package/dist/src/generator/generators/mermaid.test.d.ts +0 -1
- package/dist/src/generator/generators/mermaid.test.js +0 -70
- package/dist/src/generator/generators/plantuml.d.ts +0 -17
- package/dist/src/generator/generators/plantuml.js +0 -131
- package/dist/src/generator/generators/plantuml.test.d.ts +0 -1
- package/dist/src/generator/generators/plantuml.test.js +0 -143
- package/dist/src/generator/interface.d.ts +0 -17
- package/dist/src/generator/interface.js +0 -1
- package/dist/src/index.d.ts +0 -13
- package/dist/src/index.js +0 -21
- package/dist/src/parser/base/lexer.d.ts +0 -18
- package/dist/src/parser/base/lexer.js +0 -95
- package/dist/src/parser/base/lexer.test.d.ts +0 -1
- package/dist/src/parser/base/lexer.test.js +0 -53
- package/dist/src/parser/base/parser.d.ts +0 -14
- package/dist/src/parser/base/parser.js +0 -43
- package/dist/src/parser/base/parser.test.d.ts +0 -1
- package/dist/src/parser/base/parser.test.js +0 -90
- package/dist/src/parser/base/token.d.ts +0 -18
- package/dist/src/parser/base/token.js +0 -1
- package/dist/src/parser/base/tokens.d.ts +0 -8
- package/dist/src/parser/base/tokens.js +0 -1
- package/dist/src/parser/format-detector.d.ts +0 -55
- package/dist/src/parser/format-detector.js +0 -98
- package/dist/src/parser/index.d.ts +0 -11
- package/dist/src/parser/index.js +0 -33
- package/dist/src/parser/index.test.d.ts +0 -1
- package/dist/src/parser/index.test.js +0 -23
- package/dist/src/parser/interface.d.ts +0 -8
- package/dist/src/parser/interface.js +0 -1
- package/dist/src/parser/languages/mermaid/constants.d.ts +0 -7
- package/dist/src/parser/languages/mermaid/constants.js +0 -20
- package/dist/src/parser/languages/mermaid/index.d.ts +0 -4
- package/dist/src/parser/languages/mermaid/index.js +0 -11
- package/dist/src/parser/languages/mermaid/lexer.d.ts +0 -14
- package/dist/src/parser/languages/mermaid/lexer.js +0 -152
- package/dist/src/parser/languages/mermaid/lexer.test.d.ts +0 -1
- package/dist/src/parser/languages/mermaid/lexer.test.js +0 -58
- package/dist/src/parser/languages/mermaid/parser.d.ts +0 -22
- package/dist/src/parser/languages/mermaid/parser.js +0 -340
- package/dist/src/parser/languages/mermaid/parser.test.d.ts +0 -1
- package/dist/src/parser/languages/mermaid/parser.test.js +0 -252
- package/dist/src/parser/languages/mermaid/tokens.d.ts +0 -9
- package/dist/src/parser/languages/mermaid/tokens.js +0 -1
- package/dist/src/parser/languages/plantuml/index.d.ts +0 -4
- package/dist/src/parser/languages/plantuml/index.js +0 -11
- package/dist/src/parser/languages/plantuml/lexer.d.ts +0 -15
- package/dist/src/parser/languages/plantuml/lexer.js +0 -143
- package/dist/src/parser/languages/plantuml/parser.d.ts +0 -23
- package/dist/src/parser/languages/plantuml/parser.js +0 -481
- package/dist/src/parser/languages/plantuml/parser.test.d.ts +0 -1
- package/dist/src/parser/languages/plantuml/parser.test.js +0 -236
- package/dist/src/parser/languages/plantuml/tokens.d.ts +0 -9
- package/dist/src/parser/languages/plantuml/tokens.js +0 -1
- package/dist/src/transformer/cleaners/prune-empty.d.ts +0 -9
- package/dist/src/transformer/cleaners/prune-empty.js +0 -27
- package/dist/src/transformer/cleaners/prune-empty.test.d.ts +0 -1
- package/dist/src/transformer/cleaners/prune-empty.test.js +0 -69
- package/dist/src/transformer/cleaners/prune-unused.d.ts +0 -5
- package/dist/src/transformer/cleaners/prune-unused.js +0 -48
- package/dist/src/transformer/cleaners/prune-unused.test.d.ts +0 -1
- package/dist/src/transformer/cleaners/prune-unused.test.js +0 -71
- package/dist/src/transformer/filters/focus.d.ts +0 -13
- package/dist/src/transformer/filters/focus.js +0 -71
- package/dist/src/transformer/filters/focus.test.d.ts +0 -1
- package/dist/src/transformer/filters/focus.test.js +0 -50
- package/dist/src/transformer/filters/remove.d.ts +0 -12
- package/dist/src/transformer/filters/remove.js +0 -82
- package/dist/src/transformer/filters/remove.test.d.ts +0 -1
- package/dist/src/transformer/filters/remove.test.js +0 -38
- package/dist/src/transformer/filters/resolve.d.ts +0 -9
- package/dist/src/transformer/filters/resolve.js +0 -32
- package/dist/src/transformer/filters/resolve.test.d.ts +0 -1
- package/dist/src/transformer/filters/resolve.test.js +0 -48
- package/dist/src/transformer/index.d.ts +0 -10
- package/dist/src/transformer/index.js +0 -10
- package/dist/src/transformer/lens.d.ts +0 -12
- package/dist/src/transformer/lens.js +0 -58
- package/dist/src/transformer/lens.test.d.ts +0 -1
- package/dist/src/transformer/lens.test.js +0 -60
- package/dist/src/transformer/orchestration/engine.d.ts +0 -5
- package/dist/src/transformer/orchestration/engine.js +0 -24
- package/dist/src/transformer/orchestration/engine.test.d.ts +0 -1
- package/dist/src/transformer/orchestration/engine.test.js +0 -52
- package/dist/src/transformer/orchestration/registry.d.ts +0 -10
- package/dist/src/transformer/orchestration/registry.js +0 -27
- package/dist/src/transformer/selector/matcher.d.ts +0 -9
- package/dist/src/transformer/selector/matcher.js +0 -62
- package/dist/src/transformer/selector/matcher.test.d.ts +0 -1
- package/dist/src/transformer/selector/matcher.test.js +0 -70
- package/dist/src/transformer/traverse/walker.d.ts +0 -14
- package/dist/src/transformer/traverse/walker.js +0 -67
- package/dist/src/transformer/traverse/walker.test.d.ts +0 -1
- package/dist/src/transformer/traverse/walker.test.js +0 -111
- package/dist/src/transformer/types.d.ts +0 -47
- package/dist/src/transformer/types.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/polagram-core.js
CHANGED
|
@@ -1,7 +1,209 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const We = {
|
|
2
|
+
"->": { type: "sync", style: { line: "solid", head: "open" } },
|
|
3
|
+
"->>": { type: "sync", style: { line: "solid", head: "arrow" } },
|
|
4
|
+
"-->": { type: "reply", style: { line: "dotted", head: "open" } },
|
|
5
|
+
"-->>": { type: "reply", style: { line: "dotted", head: "arrow" } },
|
|
6
|
+
"-)": { type: "async", style: { line: "solid", head: "async" } },
|
|
7
|
+
"--)": { type: "async", style: { line: "dotted", head: "async" } },
|
|
8
|
+
"-x": { type: "destroy", style: { line: "solid", head: "cross" } },
|
|
9
|
+
"--x": { type: "destroy", style: { line: "dotted", head: "cross" } }
|
|
10
|
+
}, Pt = Object.entries(We).reduce(
|
|
11
|
+
(t, [e, n]) => {
|
|
12
|
+
const r = JSON.stringify({ type: n.type, style: n.style });
|
|
13
|
+
return t[r] = e, t;
|
|
14
|
+
},
|
|
15
|
+
{}
|
|
16
|
+
);
|
|
17
|
+
function At(t, e) {
|
|
18
|
+
const n = JSON.stringify({ type: t, style: e });
|
|
19
|
+
return Pt[n] || "->>";
|
|
20
|
+
}
|
|
21
|
+
class Ke {
|
|
22
|
+
constructor(e) {
|
|
23
|
+
this.visitor = e;
|
|
24
|
+
}
|
|
25
|
+
traverse(e) {
|
|
26
|
+
this.visitor.visitRoot(e);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Dispatches a single event node to the appropriate visitor method.
|
|
30
|
+
* This is public so Visitors can call it recursively (e.g. inside Fragments/Groups).
|
|
31
|
+
*/
|
|
32
|
+
dispatchEvent(e) {
|
|
33
|
+
switch (e.kind) {
|
|
34
|
+
case "message":
|
|
35
|
+
this.visitor.visitMessage(e);
|
|
36
|
+
break;
|
|
37
|
+
case "fragment":
|
|
38
|
+
this.visitor.visitFragment(e);
|
|
39
|
+
break;
|
|
40
|
+
case "note":
|
|
41
|
+
this.visitor.visitNote(e);
|
|
42
|
+
break;
|
|
43
|
+
case "activation":
|
|
44
|
+
this.visitor.visitActivation(e);
|
|
45
|
+
break;
|
|
46
|
+
case "divider":
|
|
47
|
+
this.visitor.visitDivider(e);
|
|
48
|
+
break;
|
|
49
|
+
case "spacer":
|
|
50
|
+
this.visitor.visitSpacer(e);
|
|
51
|
+
break;
|
|
52
|
+
case "ref":
|
|
53
|
+
this.visitor.visitReference(e);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Helper to iterate over a list of events.
|
|
59
|
+
*/
|
|
60
|
+
dispatchEvents(e) {
|
|
61
|
+
for (const n of e)
|
|
62
|
+
this.dispatchEvent(n);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
class Ye {
|
|
66
|
+
lines = [];
|
|
67
|
+
indentLevel = 0;
|
|
68
|
+
traverser;
|
|
69
|
+
constructor() {
|
|
70
|
+
this.traverser = new Ke(this);
|
|
71
|
+
}
|
|
72
|
+
generate(e) {
|
|
73
|
+
return this.lines = [], this.indentLevel = 0, this.traverser.traverse(e), this.lines.join(`
|
|
74
|
+
`);
|
|
75
|
+
}
|
|
76
|
+
visitRoot(e) {
|
|
77
|
+
this.lines.push("sequenceDiagram"), this.indentLevel++, e.meta?.title && this.add(`title ${e.meta.title}`);
|
|
78
|
+
for (const n of e.participants)
|
|
79
|
+
this.visitParticipant(n);
|
|
80
|
+
this.traverser.dispatchEvents(e.events);
|
|
81
|
+
}
|
|
82
|
+
visitParticipant(e) {
|
|
83
|
+
const n = e.type === "actor" ? "actor" : "participant", r = e.name;
|
|
84
|
+
e.id === e.name ? this.add(`${n} ${e.id}`) : this.add(`${n} ${e.id} as ${r}`);
|
|
85
|
+
}
|
|
86
|
+
visitParticipantGroup(e) {
|
|
87
|
+
let n = "box";
|
|
88
|
+
e.style?.backgroundColor && (n += ` ${e.style.backgroundColor}`), e.name && (n += ` ${e.name}`), this.add(n);
|
|
89
|
+
}
|
|
90
|
+
visitMessage(e) {
|
|
91
|
+
const n = e.from ?? "[*]", r = e.to ?? "[*]", i = At(e.type, e.style);
|
|
92
|
+
let s = "";
|
|
93
|
+
e.lifecycle?.activateTarget && (s += "+"), e.lifecycle?.deactivateSource && (s += "-"), this.add(`${n}${i}${s}${r}: ${e.text}`);
|
|
94
|
+
}
|
|
95
|
+
visitFragment(e) {
|
|
96
|
+
if (e.branches.length === 0) return;
|
|
97
|
+
const n = e.branches[0], r = n.condition ? ` ${n.condition}` : "";
|
|
98
|
+
this.add(`${e.operator}${r}`), this.indent(() => {
|
|
99
|
+
this.traverser.dispatchEvents(n.events);
|
|
100
|
+
});
|
|
101
|
+
let i = "else";
|
|
102
|
+
e.operator === "par" ? i = "and" : e.operator === "critical" && (i = "option");
|
|
103
|
+
for (let s = 1; s < e.branches.length; s++) {
|
|
104
|
+
const o = e.branches[s], a = o.condition ? ` ${o.condition}` : "";
|
|
105
|
+
this.add(`${i}${a}`), this.indent(() => {
|
|
106
|
+
this.traverser.dispatchEvents(o.events);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
this.add("end");
|
|
110
|
+
}
|
|
111
|
+
visitNote(e) {
|
|
112
|
+
const n = e.position;
|
|
113
|
+
let r = "";
|
|
114
|
+
e.participantIds.length > 0 && (r = e.participantIds.join(","), n !== "over" ? r = ` of ${r}` : r = ` ${r}`), this.add(`note ${n}${r}: ${e.text}`);
|
|
115
|
+
}
|
|
116
|
+
visitActivation(e) {
|
|
117
|
+
this.add(`${e.action} ${e.participantId}`);
|
|
118
|
+
}
|
|
119
|
+
visitDivider(e) {
|
|
120
|
+
this.add(`%% == ${e.text || ""} ==`);
|
|
121
|
+
}
|
|
122
|
+
visitSpacer(e) {
|
|
123
|
+
this.add(`...${e.text || ""}...`);
|
|
124
|
+
}
|
|
125
|
+
visitReference(e) {
|
|
126
|
+
this.add(`%% ref: ${e.text}`);
|
|
127
|
+
}
|
|
128
|
+
// --- Helpers ---
|
|
129
|
+
add(e) {
|
|
130
|
+
const n = " ".repeat(this.indentLevel);
|
|
131
|
+
this.lines.push(`${n}${e}`);
|
|
132
|
+
}
|
|
133
|
+
indent(e) {
|
|
134
|
+
this.indentLevel++, e(), this.indentLevel--;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
class Xe {
|
|
138
|
+
lines = [];
|
|
139
|
+
traverser;
|
|
140
|
+
constructor() {
|
|
141
|
+
this.traverser = new Ke(this);
|
|
142
|
+
}
|
|
143
|
+
generate(e) {
|
|
144
|
+
return this.lines = [], this.traverser.traverse(e), this.lines.join(`
|
|
145
|
+
`);
|
|
146
|
+
}
|
|
147
|
+
visitRoot(e) {
|
|
148
|
+
this.add("@startuml"), e.meta.title && this.add(`title ${e.meta.title}`);
|
|
149
|
+
const n = new Map(e.participants.map((i) => [i.id, i])), r = /* @__PURE__ */ new Set();
|
|
150
|
+
for (const i of e.groups)
|
|
151
|
+
this.visitGroup(i, n), i.participantIds.forEach((s) => {
|
|
152
|
+
r.add(s);
|
|
153
|
+
});
|
|
154
|
+
for (const i of e.participants)
|
|
155
|
+
r.has(i.id) || this.visitParticipant(i);
|
|
156
|
+
this.traverser.dispatchEvents(e.events), this.add("@enduml");
|
|
157
|
+
}
|
|
158
|
+
visitParticipant(e) {
|
|
159
|
+
e.name === e.id ? this.add(`${e.type} ${e.id}`) : this.add(`${e.type} "${e.name}" as ${e.id}`);
|
|
160
|
+
}
|
|
161
|
+
visitParticipantGroup(e) {
|
|
162
|
+
}
|
|
163
|
+
// Internal method with context for group handling
|
|
164
|
+
visitGroup(e, n) {
|
|
165
|
+
const r = e.style?.backgroundColor ? ` ${e.style.backgroundColor}` : "", i = e.name ? ` "${e.name}"` : "";
|
|
166
|
+
this.add(`box${i}${r}`);
|
|
167
|
+
for (const s of e.participantIds) {
|
|
168
|
+
const o = n.get(s);
|
|
169
|
+
o && this.visitParticipant(o);
|
|
170
|
+
}
|
|
171
|
+
this.add("end box");
|
|
172
|
+
}
|
|
173
|
+
visitMessage(e) {
|
|
174
|
+
const n = e.from || "[*]", r = e.to || "[*]";
|
|
175
|
+
let i = "->";
|
|
176
|
+
e.type === "reply" ? i = "-->" : e.type === "async" && (i = "->>"), this.add(`${n} ${i} ${r}: ${e.text}`);
|
|
177
|
+
}
|
|
178
|
+
visitFragment(e) {
|
|
179
|
+
const n = e.operator;
|
|
180
|
+
e.branches.forEach((r, i) => {
|
|
181
|
+
i === 0 ? this.add(`${n} ${r.condition || ""}`.trim()) : this.add(`else ${r.condition || ""}`.trim()), this.traverser.dispatchEvents(r.events);
|
|
182
|
+
}), this.add("end");
|
|
183
|
+
}
|
|
184
|
+
visitNote(e) {
|
|
185
|
+
const n = e.position || "over", r = e.participantIds.join(", "), i = n === "left" || n === "right" ? `${n} of` : n;
|
|
186
|
+
this.add(`note ${i} ${r}: ${e.text}`);
|
|
187
|
+
}
|
|
188
|
+
visitActivation(e) {
|
|
189
|
+
this.add(`${e.action} ${e.participantId}`);
|
|
190
|
+
}
|
|
191
|
+
visitDivider(e) {
|
|
192
|
+
e.text ? this.add(`== ${e.text} ==`) : this.add("====");
|
|
193
|
+
}
|
|
194
|
+
visitSpacer(e) {
|
|
195
|
+
this.add("|||");
|
|
196
|
+
}
|
|
197
|
+
visitReference(e) {
|
|
198
|
+
const n = e.participantIds.join(", ");
|
|
199
|
+
this.add(`ref over ${n}: ${e.text}`);
|
|
200
|
+
}
|
|
201
|
+
// --- Helpers ---
|
|
202
|
+
add(e) {
|
|
203
|
+
this.lines.push(e);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
class qe {
|
|
5
207
|
constructor(e) {
|
|
6
208
|
this.input = e, this.readChar();
|
|
7
209
|
}
|
|
@@ -36,13 +238,45 @@ class Be {
|
|
|
36
238
|
isDigit(e) {
|
|
37
239
|
return "0" <= e && e <= "9";
|
|
38
240
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
241
|
+
// --- Common Helper Methods ---
|
|
242
|
+
/**
|
|
243
|
+
* Read an identifier (letters and digits).
|
|
244
|
+
*/
|
|
245
|
+
readIdentifier() {
|
|
246
|
+
const e = this.position;
|
|
247
|
+
for (; this.isLetter(this.ch) || this.isDigit(this.ch); )
|
|
248
|
+
this.readChar();
|
|
249
|
+
return this.input.slice(e, this.position);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Read a quoted string (consumes opening and closing quotes).
|
|
253
|
+
*/
|
|
254
|
+
readQuotedString() {
|
|
255
|
+
const e = this.position + 1;
|
|
256
|
+
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
257
|
+
`; )
|
|
258
|
+
this.readChar();
|
|
259
|
+
const n = this.input.slice(e, this.position);
|
|
260
|
+
return this.readChar(), n;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Create a token with position information.
|
|
264
|
+
*/
|
|
265
|
+
createToken(e, n, r, i) {
|
|
266
|
+
return {
|
|
267
|
+
type: e,
|
|
268
|
+
literal: n,
|
|
269
|
+
line: this.line,
|
|
270
|
+
column: i,
|
|
271
|
+
start: r,
|
|
272
|
+
end: this.position > r ? this.position : r + n.length
|
|
273
|
+
};
|
|
43
274
|
}
|
|
275
|
+
}
|
|
276
|
+
let Zt = class extends qe {
|
|
44
277
|
nextToken() {
|
|
45
|
-
this.skipWhitespace()
|
|
278
|
+
if (this.skipWhitespace(), this.ch === "%" && this.peekChar() === "%")
|
|
279
|
+
return this.skipComment(), this.nextToken();
|
|
46
280
|
const e = this.position, n = this.column;
|
|
47
281
|
let r;
|
|
48
282
|
switch (this.ch) {
|
|
@@ -57,14 +291,15 @@ let Pt = class extends Be {
|
|
|
57
291
|
break;
|
|
58
292
|
case "-":
|
|
59
293
|
if (this.isArrowStart()) {
|
|
60
|
-
const
|
|
61
|
-
return r = this.newToken("ARROW",
|
|
294
|
+
const i = this.readArrow();
|
|
295
|
+
return r = this.newToken("ARROW", i, e, n), r;
|
|
62
296
|
} else
|
|
63
297
|
r = this.newToken("MINUS", this.ch, e, n);
|
|
64
298
|
break;
|
|
65
|
-
case '"':
|
|
299
|
+
case '"': {
|
|
66
300
|
const i = this.readString();
|
|
67
301
|
return r = this.newToken("STRING", i, e, n), r;
|
|
302
|
+
}
|
|
68
303
|
case `
|
|
69
304
|
`:
|
|
70
305
|
r = this.newToken("NEWLINE", this.ch, e, n);
|
|
@@ -74,11 +309,11 @@ let Pt = class extends Be {
|
|
|
74
309
|
break;
|
|
75
310
|
default:
|
|
76
311
|
if (this.isLetter(this.ch)) {
|
|
77
|
-
const
|
|
78
|
-
return this.newToken(
|
|
312
|
+
const i = this.readIdentifier(), s = this.lookupIdent(i);
|
|
313
|
+
return this.newToken(s, i, e, n);
|
|
79
314
|
} else if (this.isDigit(this.ch)) {
|
|
80
|
-
const
|
|
81
|
-
return this.newToken("IDENTIFIER",
|
|
315
|
+
const i = this.readNumber();
|
|
316
|
+
return this.newToken("IDENTIFIER", i, e, n);
|
|
82
317
|
} else
|
|
83
318
|
r = this.newToken("UNKNOWN", this.ch, e, n);
|
|
84
319
|
}
|
|
@@ -96,12 +331,6 @@ let Pt = class extends Be {
|
|
|
96
331
|
end: this.position > r ? this.position : r + n.length
|
|
97
332
|
};
|
|
98
333
|
}
|
|
99
|
-
readIdentifier() {
|
|
100
|
-
const e = this.position;
|
|
101
|
-
for (; this.isLetter(this.ch) || this.isDigit(this.ch); )
|
|
102
|
-
this.readChar();
|
|
103
|
-
return this.input.slice(e, this.position);
|
|
104
|
-
}
|
|
105
334
|
readNumber() {
|
|
106
335
|
const e = this.position;
|
|
107
336
|
for (; this.isDigit(this.ch); )
|
|
@@ -133,9 +362,14 @@ let Pt = class extends Be {
|
|
|
133
362
|
readMulti(e) {
|
|
134
363
|
for (let n = 0; n < e; n++) this.readChar();
|
|
135
364
|
}
|
|
365
|
+
skipComment() {
|
|
366
|
+
for (; this.ch !== `
|
|
367
|
+
` && this.ch !== ""; )
|
|
368
|
+
this.readChar();
|
|
369
|
+
}
|
|
136
370
|
lookupIdent(e) {
|
|
137
371
|
return {
|
|
138
|
-
|
|
372
|
+
sequencediagram: "SEQUENCE_DIAGRAM",
|
|
139
373
|
participant: "PARTICIPANT",
|
|
140
374
|
actor: "ACTOR",
|
|
141
375
|
loop: "LOOP",
|
|
@@ -152,11 +386,17 @@ let Pt = class extends Be {
|
|
|
152
386
|
title: "TITLE",
|
|
153
387
|
activate: "ACTIVATE",
|
|
154
388
|
deactivate: "DEACTIVATE",
|
|
155
|
-
box: "BOX"
|
|
156
|
-
|
|
389
|
+
box: "BOX",
|
|
390
|
+
par: "PAR",
|
|
391
|
+
and: "AND",
|
|
392
|
+
break: "BREAK",
|
|
393
|
+
critical: "CRITICAL",
|
|
394
|
+
option: "OPTION",
|
|
395
|
+
rect: "RECT"
|
|
396
|
+
}[e.toLowerCase()] || "IDENTIFIER";
|
|
157
397
|
}
|
|
158
398
|
};
|
|
159
|
-
class
|
|
399
|
+
class Qe {
|
|
160
400
|
constructor(e) {
|
|
161
401
|
this.lexer = e, this.advance(), this.advance();
|
|
162
402
|
}
|
|
@@ -174,25 +414,27 @@ class Ke {
|
|
|
174
414
|
expectPeek(e) {
|
|
175
415
|
return this.peekTokenIs(e) ? (this.advance(), !0) : !1;
|
|
176
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Type-safe token type check for current token.
|
|
419
|
+
* Use this instead of `(this.currToken.type as T) === '...'`
|
|
420
|
+
*/
|
|
421
|
+
isCurrentToken(e) {
|
|
422
|
+
return this.currToken.type === e;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Check if current token is one of the given types.
|
|
426
|
+
*/
|
|
427
|
+
isCurrentTokenOneOf(e) {
|
|
428
|
+
return e.includes(this.currToken.type);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Get current token type safely.
|
|
432
|
+
*/
|
|
433
|
+
getCurrentTokenType() {
|
|
434
|
+
return this.currToken.type;
|
|
435
|
+
}
|
|
177
436
|
}
|
|
178
|
-
|
|
179
|
-
"->": { type: "sync", style: { line: "solid", head: "open" } },
|
|
180
|
-
"->>": { type: "sync", style: { line: "solid", head: "arrow" } },
|
|
181
|
-
"-->": { type: "reply", style: { line: "dotted", head: "open" } },
|
|
182
|
-
"-->>": { type: "reply", style: { line: "dotted", head: "arrow" } },
|
|
183
|
-
"-)": { type: "async", style: { line: "solid", head: "async" } },
|
|
184
|
-
"--)": { type: "async", style: { line: "dotted", head: "async" } },
|
|
185
|
-
"-x": { type: "destroy", style: { line: "solid", head: "cross" } },
|
|
186
|
-
"--x": { type: "destroy", style: { line: "dotted", head: "cross" } }
|
|
187
|
-
}, Zt = Object.entries(Xe).reduce((t, [e, n]) => {
|
|
188
|
-
const r = JSON.stringify({ type: n.type, style: n.style });
|
|
189
|
-
return t[r] = e, t;
|
|
190
|
-
}, {});
|
|
191
|
-
function Nt(t, e) {
|
|
192
|
-
const n = JSON.stringify({ type: t, style: e });
|
|
193
|
-
return Zt[n] || "->>";
|
|
194
|
-
}
|
|
195
|
-
let At = class extends Ke {
|
|
437
|
+
let Ct = class extends Qe {
|
|
196
438
|
currentGroup = null;
|
|
197
439
|
idCounters = {
|
|
198
440
|
evt: 0,
|
|
@@ -201,9 +443,6 @@ let At = class extends Ke {
|
|
|
201
443
|
note: 0,
|
|
202
444
|
group: 0
|
|
203
445
|
};
|
|
204
|
-
constructor(e) {
|
|
205
|
-
super(e);
|
|
206
|
-
}
|
|
207
446
|
parse() {
|
|
208
447
|
const e = {
|
|
209
448
|
kind: "root",
|
|
@@ -216,8 +455,8 @@ let At = class extends Ke {
|
|
|
216
455
|
}
|
|
217
456
|
parseBlock(e, n = []) {
|
|
218
457
|
const r = [];
|
|
219
|
-
for (; this.
|
|
220
|
-
const i = this.
|
|
458
|
+
for (; !this.isCurrentToken("EOF"); ) {
|
|
459
|
+
const i = this.getCurrentTokenType();
|
|
221
460
|
if (n.includes(i))
|
|
222
461
|
return r;
|
|
223
462
|
if (i === "NEWLINE") {
|
|
@@ -241,7 +480,7 @@ let At = class extends Ke {
|
|
|
241
480
|
this.parseParticipant(e);
|
|
242
481
|
continue;
|
|
243
482
|
}
|
|
244
|
-
if (i === "LOOP" || i === "ALT" || i === "OPT") {
|
|
483
|
+
if (i === "LOOP" || i === "ALT" || i === "OPT" || i === "PAR" || i === "BREAK" || i === "CRITICAL" || i === "RECT") {
|
|
245
484
|
r.push(this.parseFragment(e));
|
|
246
485
|
continue;
|
|
247
486
|
}
|
|
@@ -274,7 +513,18 @@ let At = class extends Ke {
|
|
|
274
513
|
const s = n.split(/\s+/);
|
|
275
514
|
if (s.length > 0) {
|
|
276
515
|
const h = s[0];
|
|
277
|
-
(h.startsWith("#") || [
|
|
516
|
+
(h.startsWith("#") || [
|
|
517
|
+
"rgb",
|
|
518
|
+
"rgba",
|
|
519
|
+
"transparent",
|
|
520
|
+
"aqua",
|
|
521
|
+
"grey",
|
|
522
|
+
"gray",
|
|
523
|
+
"purple",
|
|
524
|
+
"red",
|
|
525
|
+
"blue",
|
|
526
|
+
"green"
|
|
527
|
+
].includes(h.toLowerCase())) && (i = h, r = s.slice(1).join(" "));
|
|
278
528
|
}
|
|
279
529
|
r || (r = `Group ${this.idCounters.group + 1}`);
|
|
280
530
|
const o = {
|
|
@@ -289,27 +539,48 @@ let At = class extends Ke {
|
|
|
289
539
|
const a = this.currentGroup;
|
|
290
540
|
this.currentGroup = o;
|
|
291
541
|
const u = this.parseBlock(e, ["END"]);
|
|
292
|
-
return this.currentGroup = a, this.
|
|
542
|
+
return this.currentGroup = a, this.isCurrentToken("END") && this.advance(), u;
|
|
293
543
|
}
|
|
294
544
|
parseFragment(e) {
|
|
295
|
-
const n = this.
|
|
545
|
+
const n = this.getCurrentTokenType();
|
|
296
546
|
let r = "loop";
|
|
297
|
-
n === "ALT" && (r = "alt"), n === "OPT" && (r = "opt"), this.advance();
|
|
298
|
-
const i = this.readRestOfLine(), s = []
|
|
547
|
+
n === "ALT" && (r = "alt"), n === "OPT" && (r = "opt"), n === "PAR" && (r = "par"), n === "BREAK" && (r = "break"), n === "CRITICAL" && (r = "critical"), n === "RECT" && (r = "rect"), this.advance();
|
|
548
|
+
const i = this.readRestOfLine(), s = [];
|
|
549
|
+
let o;
|
|
550
|
+
r === "par" ? o = ["END", "ELSE", "AND"] : r === "critical" ? o = ["END", "OPTION"] : o = ["END", "ELSE"];
|
|
551
|
+
const a = this.parseBlock(e, o);
|
|
299
552
|
for (s.push({
|
|
300
553
|
id: this.generateId("br"),
|
|
301
554
|
condition: i,
|
|
302
|
-
events:
|
|
303
|
-
}); this.
|
|
555
|
+
events: a
|
|
556
|
+
}); this.isCurrentToken("AND"); ) {
|
|
557
|
+
this.advance();
|
|
558
|
+
const u = this.readRestOfLine(), h = this.parseBlock(e, ["END", "AND"]);
|
|
559
|
+
s.push({
|
|
560
|
+
id: this.generateId("br"),
|
|
561
|
+
condition: u,
|
|
562
|
+
events: h
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
for (; this.isCurrentToken("OPTION"); ) {
|
|
566
|
+
this.advance();
|
|
567
|
+
const u = this.readRestOfLine(), h = this.parseBlock(e, ["END", "OPTION"]);
|
|
568
|
+
s.push({
|
|
569
|
+
id: this.generateId("br"),
|
|
570
|
+
condition: u,
|
|
571
|
+
events: h
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
for (; this.isCurrentToken("ELSE"); ) {
|
|
304
575
|
this.advance();
|
|
305
|
-
const
|
|
576
|
+
const u = this.readRestOfLine(), h = this.parseBlock(e, ["END", "ELSE"]);
|
|
306
577
|
s.push({
|
|
307
578
|
id: this.generateId("br"),
|
|
308
|
-
condition:
|
|
309
|
-
events:
|
|
579
|
+
condition: u,
|
|
580
|
+
events: h
|
|
310
581
|
});
|
|
311
582
|
}
|
|
312
|
-
return this.
|
|
583
|
+
return this.isCurrentToken("END") && this.advance(), {
|
|
313
584
|
kind: "fragment",
|
|
314
585
|
id: this.generateId("frag"),
|
|
315
586
|
operator: r,
|
|
@@ -367,11 +638,11 @@ let At = class extends Ke {
|
|
|
367
638
|
const r = this.currToken.literal;
|
|
368
639
|
this.advance();
|
|
369
640
|
let i = !1, s = !1;
|
|
370
|
-
if (this.
|
|
641
|
+
if (this.isCurrentToken("PLUS") && (i = !0, this.advance()), this.isCurrentToken("MINUS") && (s = !0, this.advance()), !this.isParticipantToken(this.currToken)) return null;
|
|
371
642
|
const o = this.currToken.literal;
|
|
372
643
|
this.ensureParticipant(e, o), this.advance();
|
|
373
644
|
let a = "";
|
|
374
|
-
this.
|
|
645
|
+
this.isCurrentToken("COLON") && (this.advance(), a = this.readRestOfLine());
|
|
375
646
|
const { type: u, style: h } = this.resolveArrow(r);
|
|
376
647
|
return {
|
|
377
648
|
kind: "message",
|
|
@@ -385,18 +656,18 @@ let At = class extends Ke {
|
|
|
385
656
|
};
|
|
386
657
|
}
|
|
387
658
|
resolveArrow(e) {
|
|
388
|
-
const n =
|
|
659
|
+
const n = We[e];
|
|
389
660
|
return n || { type: "sync", style: { line: "solid", head: "arrow" } };
|
|
390
661
|
}
|
|
391
662
|
generateId(e) {
|
|
392
663
|
return this.idCounters[e]++, `${e}_${this.idCounters[e]}`;
|
|
393
664
|
}
|
|
394
665
|
readRestOfLine() {
|
|
395
|
-
if (this.
|
|
666
|
+
if (this.isCurrentToken("NEWLINE") || this.isCurrentToken("EOF"))
|
|
396
667
|
return "";
|
|
397
668
|
const e = this.currToken.start;
|
|
398
669
|
let n = this.currToken.end;
|
|
399
|
-
for (; this.
|
|
670
|
+
for (; !this.isCurrentToken("NEWLINE") && !this.isCurrentToken("EOF"); )
|
|
400
671
|
n = this.currToken.end, this.advance();
|
|
401
672
|
return this.lexer.getInput().slice(e, n);
|
|
402
673
|
}
|
|
@@ -410,14 +681,11 @@ let At = class extends Ke {
|
|
|
410
681
|
};
|
|
411
682
|
const Rt = {
|
|
412
683
|
parse: (t) => {
|
|
413
|
-
const e = new
|
|
414
|
-
return new
|
|
684
|
+
const e = new Zt(t);
|
|
685
|
+
return new Ct(e).parse();
|
|
415
686
|
}
|
|
416
687
|
};
|
|
417
|
-
class
|
|
418
|
-
constructor(e) {
|
|
419
|
-
super(e);
|
|
420
|
-
}
|
|
688
|
+
class xt extends qe {
|
|
421
689
|
nextToken() {
|
|
422
690
|
this.skipWhitespace();
|
|
423
691
|
const e = this.position, n = this.column;
|
|
@@ -433,23 +701,33 @@ class Ct extends Be {
|
|
|
433
701
|
case ",":
|
|
434
702
|
r = this.newToken("COMMA", ",", e, n);
|
|
435
703
|
break;
|
|
436
|
-
case '"':
|
|
704
|
+
case '"': {
|
|
437
705
|
const i = this.readString();
|
|
438
706
|
return this.newToken("STRING", i, e, n);
|
|
707
|
+
}
|
|
439
708
|
case ":":
|
|
440
709
|
r = this.newToken("COLON", ":", e, n);
|
|
441
710
|
break;
|
|
442
|
-
case "-":
|
|
443
|
-
const
|
|
444
|
-
|
|
711
|
+
case "-": {
|
|
712
|
+
const i = this.readArrow();
|
|
713
|
+
i ? r = this.newToken("ARROW", i, e, n) : r = this.newToken("UNKNOWN", this.ch, e, n);
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
case "=": {
|
|
717
|
+
if (this.peekExact("=")) {
|
|
718
|
+
const i = this.readDivider();
|
|
719
|
+
return this.newToken("DIVIDER", i, e, n);
|
|
720
|
+
}
|
|
721
|
+
r = this.newToken("UNKNOWN", this.ch, e, n);
|
|
445
722
|
break;
|
|
723
|
+
}
|
|
446
724
|
case "":
|
|
447
725
|
r = this.newToken("EOF", "", e, n);
|
|
448
726
|
break;
|
|
449
727
|
default:
|
|
450
728
|
if (this.isLetter(this.ch)) {
|
|
451
|
-
const
|
|
452
|
-
return this.newToken(
|
|
729
|
+
const i = this.readIdentifier(), s = this.lookupIdent(i);
|
|
730
|
+
return this.newToken(s, i, e, n);
|
|
453
731
|
} else
|
|
454
732
|
r = this.newToken("UNKNOWN", this.ch, e, n);
|
|
455
733
|
}
|
|
@@ -459,12 +737,7 @@ class Ct extends Be {
|
|
|
459
737
|
const s = this.position === r ? r + n.length : this.position;
|
|
460
738
|
return { type: e, literal: n, line: this.line, column: i, start: r, end: s };
|
|
461
739
|
}
|
|
462
|
-
|
|
463
|
-
const e = this.position;
|
|
464
|
-
for (; this.isLetter(this.ch) || this.isDigit(this.ch); )
|
|
465
|
-
this.readChar();
|
|
466
|
-
return this.input.slice(e, this.position);
|
|
467
|
-
}
|
|
740
|
+
// Override readString to handle PlantUML specific behavior
|
|
468
741
|
readString() {
|
|
469
742
|
const e = this.position + 1;
|
|
470
743
|
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
@@ -493,6 +766,11 @@ class Ct extends Be {
|
|
|
493
766
|
else: "ELSE",
|
|
494
767
|
end: "END",
|
|
495
768
|
box: "BOX",
|
|
769
|
+
boundary: "BOUNDARY",
|
|
770
|
+
control: "CONTROL",
|
|
771
|
+
entity: "ENTITY",
|
|
772
|
+
collections: "COLLECTIONS",
|
|
773
|
+
queue: "QUEUE",
|
|
496
774
|
"@startuml": "START_UML",
|
|
497
775
|
"@enduml": "END_UML"
|
|
498
776
|
}[e] || "IDENTIFIER";
|
|
@@ -518,11 +796,12 @@ class Ct extends Be {
|
|
|
518
796
|
readMulti(e) {
|
|
519
797
|
for (let n = 0; n < e; n++) this.readChar();
|
|
520
798
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
super(e);
|
|
799
|
+
readDivider() {
|
|
800
|
+
const n = this.readRestOfLine().match(/^==\s*(.*?)\s*==$/);
|
|
801
|
+
return n ? n[1] : "";
|
|
525
802
|
}
|
|
803
|
+
}
|
|
804
|
+
class Lt extends Qe {
|
|
526
805
|
/**
|
|
527
806
|
* Type-safe token type checker.
|
|
528
807
|
* Helps TypeScript understand token type after advance() calls.
|
|
@@ -551,10 +830,19 @@ class xt extends Ke {
|
|
|
551
830
|
this.advance(), e.meta.title = this.readRestOfLine().trim();
|
|
552
831
|
continue;
|
|
553
832
|
}
|
|
554
|
-
if (["PARTICIPANT", "ACTOR", "DATABASE"].includes(this.currToken.type)) {
|
|
833
|
+
if (["PARTICIPANT", "ACTOR", "DATABASE", "BOUNDARY", "CONTROL", "ENTITY", "COLLECTIONS", "QUEUE"].includes(this.currToken.type)) {
|
|
555
834
|
this.parseParticipant(e);
|
|
556
835
|
continue;
|
|
557
836
|
}
|
|
837
|
+
if (this.currToken.type === "DIVIDER") {
|
|
838
|
+
const n = {
|
|
839
|
+
kind: "divider",
|
|
840
|
+
id: `div_${e.events.length + 1}`,
|
|
841
|
+
text: this.currToken.literal || void 0
|
|
842
|
+
};
|
|
843
|
+
e.events.push(n), this.advance();
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
558
846
|
if (this.isParticipantToken(this.currToken)) {
|
|
559
847
|
const n = this.parseMessage(e);
|
|
560
848
|
if (n) {
|
|
@@ -591,14 +879,14 @@ class xt extends Ke {
|
|
|
591
879
|
parseGroup(e) {
|
|
592
880
|
this.advance();
|
|
593
881
|
let n = "", r;
|
|
594
|
-
this.currToken.type === "STRING" && (n = this.currToken.literal, this.advance()), this.currToken.type === "UNKNOWN" && this.currToken.literal === "#" && (this.advance(), this.isTokenType("IDENTIFIER") && (r =
|
|
882
|
+
this.currToken.type === "STRING" && (n = this.currToken.literal, this.advance()), this.currToken.type === "UNKNOWN" && this.currToken.literal === "#" && (this.advance(), this.isTokenType("IDENTIFIER") && (r = `#${this.currToken.literal}`, this.advance()));
|
|
595
883
|
const i = [];
|
|
596
884
|
for (; this.currToken.type !== "EOF"; ) {
|
|
597
885
|
if (this.currToken.type === "END") {
|
|
598
886
|
this.advance(), this.isTokenType("BOX") && this.advance();
|
|
599
887
|
break;
|
|
600
888
|
}
|
|
601
|
-
if (["PARTICIPANT", "ACTOR", "DATABASE"].includes(this.currToken.type)) {
|
|
889
|
+
if (["PARTICIPANT", "ACTOR", "DATABASE", "BOUNDARY", "CONTROL", "ENTITY", "COLLECTIONS", "QUEUE"].includes(this.currToken.type)) {
|
|
602
890
|
const s = e.participants.length;
|
|
603
891
|
this.parseParticipant(e);
|
|
604
892
|
const o = e.participants.length;
|
|
@@ -613,7 +901,7 @@ class xt extends Ke {
|
|
|
613
901
|
}
|
|
614
902
|
return {
|
|
615
903
|
kind: "group",
|
|
616
|
-
id:
|
|
904
|
+
id: `group_${e.groups.length + 1}`,
|
|
617
905
|
name: n,
|
|
618
906
|
type: "box",
|
|
619
907
|
participantIds: i,
|
|
@@ -625,7 +913,7 @@ class xt extends Ke {
|
|
|
625
913
|
this.advance();
|
|
626
914
|
const i = this.readRestOfLine().trim(), s = [];
|
|
627
915
|
let o = [];
|
|
628
|
-
const a = { condition: i, events: o };
|
|
916
|
+
const a = { id: `br_${s.length + 1}`, condition: i, events: o };
|
|
629
917
|
for (s.push(a); this.currToken.type !== "EOF"; ) {
|
|
630
918
|
if (this.currToken.type === "END") {
|
|
631
919
|
this.advance();
|
|
@@ -634,7 +922,7 @@ class xt extends Ke {
|
|
|
634
922
|
if (this.currToken.type === "ELSE") {
|
|
635
923
|
this.advance();
|
|
636
924
|
const h = this.readRestOfLine().trim();
|
|
637
|
-
o = [], s.push({ condition: h, events: o });
|
|
925
|
+
o = [], s.push({ id: `br_${s.length + 1}`, condition: h, events: o });
|
|
638
926
|
continue;
|
|
639
927
|
}
|
|
640
928
|
if (this.currToken.type === "NEWLINE") {
|
|
@@ -646,14 +934,14 @@ class xt extends Ke {
|
|
|
646
934
|
}
|
|
647
935
|
return {
|
|
648
936
|
kind: n,
|
|
649
|
-
id:
|
|
937
|
+
id: `frag_${e.events.length + 1}`,
|
|
650
938
|
operator: r,
|
|
651
939
|
branches: s
|
|
652
940
|
};
|
|
653
941
|
}
|
|
654
942
|
// Refactor parse() to use parseStatement
|
|
655
943
|
parseStatement(e) {
|
|
656
|
-
if (["PARTICIPANT", "ACTOR", "DATABASE"].includes(this.currToken.type))
|
|
944
|
+
if (["PARTICIPANT", "ACTOR", "DATABASE", "BOUNDARY", "CONTROL", "ENTITY", "COLLECTIONS", "QUEUE"].includes(this.currToken.type))
|
|
657
945
|
return this.parseParticipant(e), null;
|
|
658
946
|
if (this.isParticipantToken(this.currToken)) {
|
|
659
947
|
const n = this.parseMessage(e);
|
|
@@ -686,7 +974,7 @@ class xt extends Ke {
|
|
|
686
974
|
}
|
|
687
975
|
return {
|
|
688
976
|
kind: "note",
|
|
689
|
-
id:
|
|
977
|
+
id: `note_${e.events.length + 1}`,
|
|
690
978
|
position: n,
|
|
691
979
|
participantIds: r,
|
|
692
980
|
text: i
|
|
@@ -724,7 +1012,7 @@ class xt extends Ke {
|
|
|
724
1012
|
let o = "sync", a = { line: "solid", head: "arrow" };
|
|
725
1013
|
return r === "-->" ? (o = "reply", a = { line: "dotted", head: "arrow" }) : r === "->" && (o = "sync", a = { line: "solid", head: "arrow" }), {
|
|
726
1014
|
kind: "message",
|
|
727
|
-
id:
|
|
1015
|
+
id: `msg_${e.events.length + 1}`,
|
|
728
1016
|
// Simple ID generation
|
|
729
1017
|
from: n,
|
|
730
1018
|
to: i,
|
|
@@ -743,7 +1031,7 @@ class xt extends Ke {
|
|
|
743
1031
|
parseParticipant(e) {
|
|
744
1032
|
const n = this.currToken.type;
|
|
745
1033
|
let r = "participant";
|
|
746
|
-
n === "ACTOR" && (r = "actor"), n === "DATABASE" && (r = "database"), this.advance();
|
|
1034
|
+
n === "ACTOR" && (r = "actor"), n === "DATABASE" && (r = "database"), n === "BOUNDARY" && (r = "boundary"), n === "CONTROL" && (r = "control"), n === "ENTITY" && (r = "entity"), n === "COLLECTIONS" && (r = "collections"), n === "QUEUE" && (r = "queue"), this.advance();
|
|
747
1035
|
let i = "", s = "";
|
|
748
1036
|
(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({
|
|
749
1037
|
id: s,
|
|
@@ -752,7 +1040,8 @@ class xt extends Ke {
|
|
|
752
1040
|
});
|
|
753
1041
|
}
|
|
754
1042
|
readRestOfLine() {
|
|
755
|
-
if (this.currToken.type === "NEWLINE" || this.currToken.type === "EOF")
|
|
1043
|
+
if (this.currToken.type === "NEWLINE" || this.currToken.type === "EOF")
|
|
1044
|
+
return "";
|
|
756
1045
|
const e = this.currToken.start;
|
|
757
1046
|
let n = this.currToken.end;
|
|
758
1047
|
for (; !this.isTokenType("NEWLINE") && !this.isTokenType("EOF"); )
|
|
@@ -762,35 +1051,26 @@ class xt extends Ke {
|
|
|
762
1051
|
}
|
|
763
1052
|
const Dt = {
|
|
764
1053
|
parse: (t) => {
|
|
765
|
-
const e = new
|
|
766
|
-
return new
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
".mermaid": "mermaid"
|
|
779
|
-
};
|
|
780
|
-
/**
|
|
781
|
-
* Content patterns for format detection
|
|
782
|
-
*/
|
|
783
|
-
static CONTENT_PATTERNS = [
|
|
784
|
-
{ pattern: /^\s*@startuml/m, format: "plantuml" },
|
|
785
|
-
{ pattern: /^\s*sequenceDiagram/m, format: "mermaid" }
|
|
786
|
-
];
|
|
1054
|
+
const e = new xt(t);
|
|
1055
|
+
return new Lt(e).parse();
|
|
1056
|
+
}
|
|
1057
|
+
}, Ft = {
|
|
1058
|
+
".puml": "plantuml",
|
|
1059
|
+
".plantuml": "plantuml",
|
|
1060
|
+
".pu": "plantuml",
|
|
1061
|
+
".mmd": "mermaid",
|
|
1062
|
+
".mermaid": "mermaid"
|
|
1063
|
+
}, jt = [
|
|
1064
|
+
{ pattern: /^\s*@startuml/m, format: "plantuml" },
|
|
1065
|
+
{ pattern: /^\s*sequenceDiagram/m, format: "mermaid" }
|
|
1066
|
+
], be = {
|
|
787
1067
|
/**
|
|
788
1068
|
* Detect diagram format from file path and content.
|
|
789
|
-
*
|
|
1069
|
+
*
|
|
790
1070
|
* @param filePath - Path to the diagram file
|
|
791
1071
|
* @param content - Content of the diagram file
|
|
792
1072
|
* @returns Detected format, or null if format cannot be determined
|
|
793
|
-
*
|
|
1073
|
+
*
|
|
794
1074
|
* @example
|
|
795
1075
|
* ```typescript
|
|
796
1076
|
* const format = FormatDetector.detect('diagram.puml', content);
|
|
@@ -799,193 +1079,562 @@ class Fo {
|
|
|
799
1079
|
* }
|
|
800
1080
|
* ```
|
|
801
1081
|
*/
|
|
802
|
-
|
|
803
|
-
const
|
|
804
|
-
return
|
|
805
|
-
}
|
|
1082
|
+
detect(t, e) {
|
|
1083
|
+
const n = be.detectByExtension(t);
|
|
1084
|
+
return n || be.detectByContent(e);
|
|
1085
|
+
},
|
|
806
1086
|
/**
|
|
807
1087
|
* Detect format based on file extension.
|
|
808
|
-
*
|
|
1088
|
+
*
|
|
809
1089
|
* @param filePath - Path to the diagram file
|
|
810
1090
|
* @returns Detected format, or null if extension is not recognized
|
|
811
1091
|
*/
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
return
|
|
815
|
-
}
|
|
1092
|
+
detectByExtension(t) {
|
|
1093
|
+
const e = t.toLowerCase().match(/\.[^.]+$/)?.[0];
|
|
1094
|
+
return e && Ft[e] || null;
|
|
1095
|
+
},
|
|
816
1096
|
/**
|
|
817
1097
|
* Detect format based on content patterns.
|
|
818
|
-
*
|
|
1098
|
+
*
|
|
819
1099
|
* @param content - Content of the diagram file
|
|
820
1100
|
* @returns Detected format, or null if no pattern matches
|
|
821
1101
|
*/
|
|
822
|
-
|
|
823
|
-
for (const { pattern:
|
|
824
|
-
if (
|
|
825
|
-
return
|
|
1102
|
+
detectByContent(t) {
|
|
1103
|
+
for (const { pattern: e, format: n } of jt)
|
|
1104
|
+
if (e.test(t))
|
|
1105
|
+
return n;
|
|
826
1106
|
return null;
|
|
827
|
-
}
|
|
1107
|
+
},
|
|
828
1108
|
/**
|
|
829
1109
|
* Get file extension for a given format.
|
|
830
|
-
*
|
|
1110
|
+
*
|
|
831
1111
|
* @param format - Diagram format
|
|
832
1112
|
* @returns Default file extension for the format
|
|
833
1113
|
*/
|
|
834
|
-
|
|
835
|
-
switch (
|
|
1114
|
+
getDefaultExtension(t) {
|
|
1115
|
+
switch (t) {
|
|
836
1116
|
case "plantuml":
|
|
837
1117
|
return ".puml";
|
|
838
1118
|
case "mermaid":
|
|
839
1119
|
return ".mmd";
|
|
840
1120
|
}
|
|
841
1121
|
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1122
|
+
}, X = /* @__PURE__ */ new Map();
|
|
1123
|
+
X.set("mermaid", Rt);
|
|
1124
|
+
X.set("plantuml", Dt);
|
|
1125
|
+
const Ut = {
|
|
1126
|
+
register(t, e) {
|
|
1127
|
+
X.set(t, e);
|
|
1128
|
+
},
|
|
1129
|
+
getParser(t) {
|
|
1130
|
+
const e = X.get(t);
|
|
1131
|
+
if (!e)
|
|
1132
|
+
throw new Error(`Parser for language '${t}' not found.`);
|
|
1133
|
+
return e;
|
|
852
1134
|
}
|
|
853
1135
|
};
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1136
|
+
class ee {
|
|
1137
|
+
transform(e) {
|
|
1138
|
+
const n = this.mapEvents(e.events);
|
|
1139
|
+
return {
|
|
1140
|
+
...e,
|
|
1141
|
+
events: n
|
|
1142
|
+
};
|
|
859
1143
|
}
|
|
860
|
-
|
|
861
|
-
this.
|
|
1144
|
+
mapEvents(e) {
|
|
1145
|
+
return e.flatMap((n) => this.visitEvent(n));
|
|
862
1146
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
* This is public so Visitors can call it recursively (e.g. inside Fragments/Groups).
|
|
866
|
-
*/
|
|
867
|
-
dispatchEvent(e) {
|
|
868
|
-
switch (e.kind) {
|
|
869
|
-
case "message":
|
|
870
|
-
this.visitor.visitMessage(e);
|
|
871
|
-
break;
|
|
872
|
-
case "fragment":
|
|
873
|
-
this.visitor.visitFragment(e);
|
|
874
|
-
break;
|
|
875
|
-
case "note":
|
|
876
|
-
this.visitor.visitNote(e);
|
|
877
|
-
break;
|
|
878
|
-
case "activation":
|
|
879
|
-
this.visitor.visitActivation(e);
|
|
880
|
-
break;
|
|
881
|
-
case "divider":
|
|
882
|
-
this.visitor.visitDivider(e);
|
|
883
|
-
break;
|
|
884
|
-
case "spacer":
|
|
885
|
-
this.visitor.visitSpacer(e);
|
|
886
|
-
break;
|
|
887
|
-
case "ref":
|
|
888
|
-
this.visitor.visitReference(e);
|
|
889
|
-
break;
|
|
890
|
-
}
|
|
1147
|
+
visitEvent(e) {
|
|
1148
|
+
return e.kind === "fragment" ? this.visitFragment(e) : [e];
|
|
891
1149
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
1150
|
+
visitFragment(e) {
|
|
1151
|
+
const n = e.branches.map((r) => this.visitBranch(r));
|
|
1152
|
+
return [
|
|
1153
|
+
{
|
|
1154
|
+
...e,
|
|
1155
|
+
branches: n
|
|
1156
|
+
}
|
|
1157
|
+
];
|
|
1158
|
+
}
|
|
1159
|
+
visitBranch(e) {
|
|
1160
|
+
return {
|
|
1161
|
+
...e,
|
|
1162
|
+
events: this.mapEvents(e.events)
|
|
1163
|
+
};
|
|
898
1164
|
}
|
|
899
1165
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
a._zod.traits.add(t), e(a, u);
|
|
912
|
-
const h = o.prototype, p = Object.keys(h);
|
|
913
|
-
for (let f = 0; f < p.length; f++) {
|
|
914
|
-
const d = p[f];
|
|
915
|
-
d in a || (a[d] = h[d].bind(a));
|
|
916
|
-
}
|
|
1166
|
+
class Mt extends ee {
|
|
1167
|
+
visitFragment(e) {
|
|
1168
|
+
const n = super.visitFragment(e);
|
|
1169
|
+
if (n.length === 0) return [];
|
|
1170
|
+
const r = n[0], i = r.branches.filter((s) => s.events.length > 0);
|
|
1171
|
+
return i.length === 0 ? [] : [
|
|
1172
|
+
{
|
|
1173
|
+
...r,
|
|
1174
|
+
branches: i
|
|
1175
|
+
}
|
|
1176
|
+
];
|
|
917
1177
|
}
|
|
918
|
-
|
|
919
|
-
|
|
1178
|
+
}
|
|
1179
|
+
class Gt {
|
|
1180
|
+
transform(e) {
|
|
1181
|
+
const n = this.collectUsedParticipants(e.events), r = e.participants.filter(
|
|
1182
|
+
(s) => n.has(s.id)
|
|
1183
|
+
), i = e.groups.map((s) => ({
|
|
1184
|
+
...s,
|
|
1185
|
+
participantIds: s.participantIds.filter((o) => n.has(o))
|
|
1186
|
+
})).filter((s) => s.participantIds.length > 0);
|
|
1187
|
+
return {
|
|
1188
|
+
...e,
|
|
1189
|
+
participants: r,
|
|
1190
|
+
groups: i
|
|
1191
|
+
};
|
|
920
1192
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
1193
|
+
collectUsedParticipants(e) {
|
|
1194
|
+
const n = /* @__PURE__ */ new Set();
|
|
1195
|
+
function r(i) {
|
|
1196
|
+
for (const s of i)
|
|
1197
|
+
switch (s.kind) {
|
|
1198
|
+
case "message":
|
|
1199
|
+
s.from && n.add(s.from), s.to && n.add(s.to);
|
|
1200
|
+
break;
|
|
1201
|
+
case "fragment":
|
|
1202
|
+
for (const o of s.branches)
|
|
1203
|
+
r(o.events);
|
|
1204
|
+
break;
|
|
1205
|
+
case "activation":
|
|
1206
|
+
n.add(s.participantId);
|
|
1207
|
+
break;
|
|
1208
|
+
case "note":
|
|
1209
|
+
s.participantIds.forEach((o) => {
|
|
1210
|
+
n.add(o);
|
|
1211
|
+
});
|
|
1212
|
+
break;
|
|
1213
|
+
case "ref":
|
|
1214
|
+
s.participantIds.forEach((o) => {
|
|
1215
|
+
n.add(o);
|
|
1216
|
+
});
|
|
1217
|
+
break;
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
return r(e), n;
|
|
929
1221
|
}
|
|
930
|
-
return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, {
|
|
931
|
-
value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(t)
|
|
932
|
-
}), Object.defineProperty(o, "name", { value: t }), o;
|
|
933
1222
|
}
|
|
934
|
-
class
|
|
935
|
-
|
|
936
|
-
|
|
1223
|
+
class de {
|
|
1224
|
+
// -- Branch / Fragment --
|
|
1225
|
+
matchBranch(e, n, r) {
|
|
1226
|
+
return !(n.operator && !(Array.isArray(n.operator) ? n.operator : [n.operator]).includes(r) || n.condition && (!e.condition || !this.matchText(e.condition, n.condition)));
|
|
1227
|
+
}
|
|
1228
|
+
// -- Participant --
|
|
1229
|
+
matchParticipant(e, n) {
|
|
1230
|
+
return !(n.id && !this.matchText(e.id, n.id) || n.name && !this.matchText(e.name, n.name) || n.stereotype && e.stereotype && !this.matchText(e.stereotype, n.stereotype));
|
|
1231
|
+
}
|
|
1232
|
+
// -- Message --
|
|
1233
|
+
matchMessage(e, n) {
|
|
1234
|
+
return !(n.text && !this.matchText(e.text, n.text) || n.from && e.from && !this.matchText(e.from, n.from) || n.to && e.to && !this.matchText(e.to, n.to));
|
|
1235
|
+
}
|
|
1236
|
+
// -- Group --
|
|
1237
|
+
matchGroup(e, n) {
|
|
1238
|
+
return !(n.name && e.name && !this.matchText(e.name, n.name));
|
|
1239
|
+
}
|
|
1240
|
+
// -- Helpers --
|
|
1241
|
+
matchText(e, n) {
|
|
1242
|
+
if (typeof n == "string")
|
|
1243
|
+
return e === n;
|
|
1244
|
+
if (n instanceof RegExp)
|
|
1245
|
+
return n.test(e);
|
|
1246
|
+
if (typeof n == "object" && n.pattern) {
|
|
1247
|
+
const r = n.flags || "";
|
|
1248
|
+
return new RegExp(n.pattern, r).test(e);
|
|
1249
|
+
}
|
|
1250
|
+
return !1;
|
|
937
1251
|
}
|
|
938
1252
|
}
|
|
939
|
-
class
|
|
1253
|
+
class Vt extends ee {
|
|
940
1254
|
constructor(e) {
|
|
941
|
-
super(
|
|
1255
|
+
super(), this.layer = e;
|
|
1256
|
+
}
|
|
1257
|
+
matcher = new de();
|
|
1258
|
+
targetParticipantIds = /* @__PURE__ */ new Set();
|
|
1259
|
+
transform(e) {
|
|
1260
|
+
return this.resolveTargetParticipants(e), super.transform(e);
|
|
1261
|
+
}
|
|
1262
|
+
resolveTargetParticipants(e) {
|
|
1263
|
+
this.targetParticipantIds.clear();
|
|
1264
|
+
const n = this.layer.selector;
|
|
1265
|
+
e.participants.forEach((r) => {
|
|
1266
|
+
this.matcher.matchParticipant(r, n) && this.targetParticipantIds.add(r.id);
|
|
1267
|
+
});
|
|
1268
|
+
}
|
|
1269
|
+
visitEvent(e) {
|
|
1270
|
+
if (e.kind === "message") {
|
|
1271
|
+
const n = e;
|
|
1272
|
+
if (!this.isRelatedToParticipant(n))
|
|
1273
|
+
return [];
|
|
1274
|
+
}
|
|
1275
|
+
if (e.kind === "note" && !e.participantIds.some(
|
|
1276
|
+
(i) => this.targetParticipantIds.has(i)
|
|
1277
|
+
))
|
|
1278
|
+
return [];
|
|
1279
|
+
if (e.kind === "activation") {
|
|
1280
|
+
const n = e;
|
|
1281
|
+
if (!this.targetParticipantIds.has(n.participantId))
|
|
1282
|
+
return [];
|
|
1283
|
+
}
|
|
1284
|
+
return super.visitEvent(e);
|
|
1285
|
+
}
|
|
1286
|
+
// Helper to check if message involves the participant from selector
|
|
1287
|
+
isRelatedToParticipant(e) {
|
|
1288
|
+
return !!(e.from && this.targetParticipantIds.has(e.from) || e.to && this.targetParticipantIds.has(e.to));
|
|
942
1289
|
}
|
|
943
1290
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
1291
|
+
class Bt extends ee {
|
|
1292
|
+
constructor(e) {
|
|
1293
|
+
super(), this.layer = e;
|
|
1294
|
+
}
|
|
1295
|
+
matcher = new de();
|
|
1296
|
+
removedParticipantIds = /* @__PURE__ */ new Set();
|
|
1297
|
+
transform(e) {
|
|
1298
|
+
const n = this.layer.selector;
|
|
1299
|
+
return n.kind === "participant" && (e.participants.forEach((r) => {
|
|
1300
|
+
this.matcher.matchParticipant(r, n) && this.removedParticipantIds.add(r.id);
|
|
1301
|
+
}), e.participants = e.participants.filter(
|
|
1302
|
+
(r) => !this.removedParticipantIds.has(r.id)
|
|
1303
|
+
)), n.kind === "group" && (e.groups = e.groups.filter(
|
|
1304
|
+
(r) => !this.matcher.matchGroup(r, n)
|
|
1305
|
+
)), super.transform(e);
|
|
1306
|
+
}
|
|
1307
|
+
visitEvent(e) {
|
|
1308
|
+
const n = this.layer.selector;
|
|
1309
|
+
if (n.kind === "message" && e.kind === "message" && this.matcher.matchMessage(e, n))
|
|
1310
|
+
return [];
|
|
1311
|
+
if (n.kind === "participant") {
|
|
1312
|
+
if (e.kind === "message") {
|
|
1313
|
+
const r = e;
|
|
1314
|
+
if (this.isRelatedToRemovedParticipant(r)) return [];
|
|
1315
|
+
}
|
|
1316
|
+
if (e.kind === "note" && e.participantIds.some(
|
|
1317
|
+
(s) => this.removedParticipantIds.has(s)
|
|
1318
|
+
))
|
|
1319
|
+
return [];
|
|
1320
|
+
if (e.kind === "activation") {
|
|
1321
|
+
const r = e;
|
|
1322
|
+
if (this.removedParticipantIds.has(r.participantId)) return [];
|
|
961
1323
|
}
|
|
962
1324
|
}
|
|
963
|
-
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
function de(t) {
|
|
969
|
-
const e = t.startsWith("^") ? 1 : 0, n = t.endsWith("$") ? t.length - 1 : t.length;
|
|
970
|
-
return t.slice(e, n);
|
|
971
|
-
}
|
|
972
|
-
function jt(t, e) {
|
|
973
|
-
const n = (t.toString().split(".")[1] || "").length, r = e.toString();
|
|
974
|
-
let i = (r.split(".")[1] || "").length;
|
|
975
|
-
if (i === 0 && /\d?e-\d?/.test(r)) {
|
|
976
|
-
const u = r.match(/\d?e-(\d?)/);
|
|
977
|
-
u?.[1] && (i = Number.parseInt(u[1]));
|
|
1325
|
+
return super.visitEvent(e);
|
|
1326
|
+
}
|
|
1327
|
+
isRelatedToRemovedParticipant(e) {
|
|
1328
|
+
return !!(e.from && this.removedParticipantIds.has(e.from) || e.to && this.removedParticipantIds.has(e.to));
|
|
978
1329
|
}
|
|
979
|
-
const s = n > i ? n : i, o = Number.parseInt(t.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
980
|
-
return o % a / 10 ** s;
|
|
981
1330
|
}
|
|
982
|
-
|
|
1331
|
+
class Jt extends ee {
|
|
1332
|
+
constructor(e) {
|
|
1333
|
+
super(), this.layer = e;
|
|
1334
|
+
}
|
|
1335
|
+
matcher = new de();
|
|
1336
|
+
visitFragment(e) {
|
|
1337
|
+
const n = e.branches.find(
|
|
1338
|
+
(r) => this.matcher.matchBranch(r, this.layer.selector, e.operator)
|
|
1339
|
+
);
|
|
1340
|
+
return n ? this.mapEvents(n.events) : super.visitFragment(e);
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
class Wt {
|
|
1344
|
+
factories = /* @__PURE__ */ new Map();
|
|
1345
|
+
constructor() {
|
|
1346
|
+
this.registerTyped("resolve", (e) => new Jt(e)), this.registerTyped("focus", (e) => new Vt(e)), this.registerTyped("remove", (e) => new Bt(e));
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Type-safe registration for a specific layer type.
|
|
1350
|
+
*/
|
|
1351
|
+
registerTyped(e, n) {
|
|
1352
|
+
this.factories.set(e, n);
|
|
1353
|
+
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Register a custom transformer factory.
|
|
1356
|
+
*/
|
|
1357
|
+
register(e, n) {
|
|
1358
|
+
this.factories.set(e, n);
|
|
1359
|
+
}
|
|
1360
|
+
/**
|
|
1361
|
+
* Get a transformer for the given layer.
|
|
1362
|
+
* @returns Transformer instance or null if no factory is registered
|
|
1363
|
+
*/
|
|
1364
|
+
get(e) {
|
|
1365
|
+
const n = this.factories.get(e.action);
|
|
1366
|
+
return n ? n(e) : null;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* Check if a transformer is registered for the given action.
|
|
1370
|
+
*/
|
|
1371
|
+
has(e) {
|
|
1372
|
+
return this.factories.has(e);
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
const Kt = new Wt();
|
|
1376
|
+
class ae {
|
|
1377
|
+
transform(e, n) {
|
|
1378
|
+
let r = e;
|
|
1379
|
+
for (const i of n) {
|
|
1380
|
+
const s = Kt.get(i);
|
|
1381
|
+
s ? r = s.transform(r) : console.warn(`Unknown action: ${i.action}`);
|
|
1382
|
+
}
|
|
1383
|
+
return r = new Mt().transform(r), r = new Gt().transform(r), r;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
class Fo {
|
|
1387
|
+
constructor() {
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Initialize a new Polagram transformation pipeline.
|
|
1391
|
+
* @param code Source diagram code
|
|
1392
|
+
* @param format Input format ('mermaid' or 'plantuml')
|
|
1393
|
+
*/
|
|
1394
|
+
static init(e, n = "mermaid") {
|
|
1395
|
+
const i = Ut.getParser(n).parse(e);
|
|
1396
|
+
return new Yt(i, n);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
class Yt {
|
|
1400
|
+
ast;
|
|
1401
|
+
layers = [];
|
|
1402
|
+
sourceFormat;
|
|
1403
|
+
constructor(e, n = "mermaid") {
|
|
1404
|
+
this.ast = e, this.sourceFormat = n;
|
|
1405
|
+
}
|
|
1406
|
+
// -- Entity Filtering --
|
|
1407
|
+
/**
|
|
1408
|
+
* Focus on specific participants.
|
|
1409
|
+
* Keeps only interactions involving the matched participants.
|
|
1410
|
+
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
1411
|
+
*/
|
|
1412
|
+
focusParticipant(e) {
|
|
1413
|
+
return this.layers.push({
|
|
1414
|
+
action: "focus",
|
|
1415
|
+
selector: this.normalizeParticipantSelector(e)
|
|
1416
|
+
}), this;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Remove specific participants and their interactions.
|
|
1420
|
+
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
1421
|
+
*/
|
|
1422
|
+
removeParticipant(e) {
|
|
1423
|
+
return this.layers.push({
|
|
1424
|
+
action: "remove",
|
|
1425
|
+
selector: this.normalizeParticipantSelector(e)
|
|
1426
|
+
}), this;
|
|
1427
|
+
}
|
|
1428
|
+
// -- Message Filtering --
|
|
1429
|
+
/**
|
|
1430
|
+
* Remove specific messages.
|
|
1431
|
+
* @param selector Message text (string/RegExp) or detailed MessageSelector
|
|
1432
|
+
*/
|
|
1433
|
+
removeMessage(e) {
|
|
1434
|
+
return this.layers.push({
|
|
1435
|
+
action: "remove",
|
|
1436
|
+
selector: this.normalizeMessageSelector(e)
|
|
1437
|
+
}), this;
|
|
1438
|
+
}
|
|
1439
|
+
// -- Group Filtering --
|
|
1440
|
+
/**
|
|
1441
|
+
* Remove specific groups (visual boxes).
|
|
1442
|
+
* @param selector Group name (string/RegExp) or detailed GroupSelector
|
|
1443
|
+
*/
|
|
1444
|
+
removeGroup(e) {
|
|
1445
|
+
return this.layers.push({
|
|
1446
|
+
action: "remove",
|
|
1447
|
+
selector: this.normalizeGroupSelector(e)
|
|
1448
|
+
}), this;
|
|
1449
|
+
}
|
|
1450
|
+
// -- Structural Resolution --
|
|
1451
|
+
/**
|
|
1452
|
+
* Resolve (unwrap) specific fragments like 'alt', 'opt', 'loop'.
|
|
1453
|
+
* Promotes the content of the matched branch and removes the wrapper.
|
|
1454
|
+
* @param selector Condition text (string/RegExp) or detailed FragmentSelector
|
|
1455
|
+
*/
|
|
1456
|
+
resolveFragment(e) {
|
|
1457
|
+
return this.layers.push({
|
|
1458
|
+
action: "resolve",
|
|
1459
|
+
selector: this.normalizeFragmentSelector(e)
|
|
1460
|
+
}), this;
|
|
1461
|
+
}
|
|
1462
|
+
/**
|
|
1463
|
+
* Apply a Lens (a named set of transformation layers).
|
|
1464
|
+
* @param lens Lens object containing layers
|
|
1465
|
+
*/
|
|
1466
|
+
applyLens(e) {
|
|
1467
|
+
return this.layers.push(...e.layers), this;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Generate Mermaid code from the transformed AST.
|
|
1471
|
+
*/
|
|
1472
|
+
toMermaid() {
|
|
1473
|
+
const n = new ae().transform(this.ast, this.layers);
|
|
1474
|
+
return new Ye().generate(n);
|
|
1475
|
+
}
|
|
1476
|
+
/**
|
|
1477
|
+
* Generate PlantUML code from the transformed AST.
|
|
1478
|
+
*/
|
|
1479
|
+
toPlantUML() {
|
|
1480
|
+
const n = new ae().transform(this.ast, this.layers);
|
|
1481
|
+
return new Xe().generate(n);
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Get the transformed AST (for advanced use cases).
|
|
1485
|
+
*/
|
|
1486
|
+
toAST() {
|
|
1487
|
+
return new ae().transform(this.ast, this.layers);
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Get the source format detected/specified during init.
|
|
1491
|
+
*/
|
|
1492
|
+
getSourceFormat() {
|
|
1493
|
+
return this.sourceFormat;
|
|
1494
|
+
}
|
|
1495
|
+
// -- Helper Methods --
|
|
1496
|
+
normalizeParticipantSelector(e) {
|
|
1497
|
+
return this.isTextMatcher(e) ? { kind: "participant", name: e } : { kind: "participant", ...e };
|
|
1498
|
+
}
|
|
1499
|
+
normalizeMessageSelector(e) {
|
|
1500
|
+
return this.isTextMatcher(e) ? { kind: "message", text: e } : { kind: "message", ...e };
|
|
1501
|
+
}
|
|
1502
|
+
normalizeGroupSelector(e) {
|
|
1503
|
+
return this.isTextMatcher(e) ? { kind: "group", name: e } : { kind: "group", ...e };
|
|
1504
|
+
}
|
|
1505
|
+
normalizeFragmentSelector(e) {
|
|
1506
|
+
return this.isTextMatcher(e) ? { kind: "fragment", condition: e } : { kind: "fragment", ...e };
|
|
1507
|
+
}
|
|
1508
|
+
isTextMatcher(e) {
|
|
1509
|
+
return typeof e == "string" || e instanceof RegExp || typeof e == "object" && e !== null && "pattern" in e && !("kind" in e);
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
const L = /* @__PURE__ */ new Map();
|
|
1513
|
+
L.set("mermaid", () => new Ye());
|
|
1514
|
+
L.set("plantuml", () => new Xe());
|
|
1515
|
+
const jo = {
|
|
1516
|
+
/**
|
|
1517
|
+
* Register a custom generator.
|
|
1518
|
+
* @param language - Language identifier (e.g., 'mermaid', 'plantuml')
|
|
1519
|
+
* @param factory - Factory function that creates a generator instance
|
|
1520
|
+
*/
|
|
1521
|
+
register(t, e) {
|
|
1522
|
+
L.set(t, e);
|
|
1523
|
+
},
|
|
1524
|
+
/**
|
|
1525
|
+
* Get a generator for the specified language.
|
|
1526
|
+
* @param language - Language identifier
|
|
1527
|
+
* @returns A generator instance
|
|
1528
|
+
* @throws Error if no generator is registered for the language
|
|
1529
|
+
*/
|
|
1530
|
+
getGenerator(t) {
|
|
1531
|
+
const e = L.get(t);
|
|
1532
|
+
if (!e)
|
|
1533
|
+
throw new Error(`Generator for language '${t}' not found.`);
|
|
1534
|
+
return e();
|
|
1535
|
+
},
|
|
1536
|
+
/**
|
|
1537
|
+
* Check if a generator is registered for the given language.
|
|
1538
|
+
*/
|
|
1539
|
+
hasGenerator(t) {
|
|
1540
|
+
return L.has(t);
|
|
1541
|
+
},
|
|
1542
|
+
/**
|
|
1543
|
+
* Get list of registered languages.
|
|
1544
|
+
*/
|
|
1545
|
+
getLanguages() {
|
|
1546
|
+
return Array.from(L.keys());
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
function c(t, e, n) {
|
|
1550
|
+
function r(a, u) {
|
|
1551
|
+
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
1552
|
+
value: {
|
|
1553
|
+
def: u,
|
|
1554
|
+
constr: o,
|
|
1555
|
+
traits: /* @__PURE__ */ new Set()
|
|
1556
|
+
},
|
|
1557
|
+
enumerable: !1
|
|
1558
|
+
}), a._zod.traits.has(t))
|
|
1559
|
+
return;
|
|
1560
|
+
a._zod.traits.add(t), e(a, u);
|
|
1561
|
+
const h = o.prototype, p = Object.keys(h);
|
|
1562
|
+
for (let d = 0; d < p.length; d++) {
|
|
1563
|
+
const f = p[d];
|
|
1564
|
+
f in a || (a[f] = h[f].bind(a));
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
const i = n?.Parent ?? Object;
|
|
1568
|
+
class s extends i {
|
|
1569
|
+
}
|
|
1570
|
+
Object.defineProperty(s, "name", { value: t });
|
|
1571
|
+
function o(a) {
|
|
1572
|
+
var u;
|
|
1573
|
+
const h = n?.Parent ? new s() : this;
|
|
1574
|
+
r(h, a), (u = h._zod).deferred ?? (u.deferred = []);
|
|
1575
|
+
for (const p of h._zod.deferred)
|
|
1576
|
+
p();
|
|
1577
|
+
return h;
|
|
1578
|
+
}
|
|
1579
|
+
return Object.defineProperty(o, "init", { value: r }), Object.defineProperty(o, Symbol.hasInstance, {
|
|
1580
|
+
value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(t)
|
|
1581
|
+
}), Object.defineProperty(o, "name", { value: t }), o;
|
|
1582
|
+
}
|
|
1583
|
+
class F extends Error {
|
|
1584
|
+
constructor() {
|
|
1585
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
class He extends Error {
|
|
1589
|
+
constructor(e) {
|
|
1590
|
+
super(`Encountered unidirectional transform during encode: ${e}`), this.name = "ZodEncodeError";
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
const et = {};
|
|
1594
|
+
function Z(t) {
|
|
1595
|
+
return et;
|
|
1596
|
+
}
|
|
1597
|
+
function tt(t) {
|
|
1598
|
+
const e = Object.values(t).filter((r) => typeof r == "number");
|
|
1599
|
+
return Object.entries(t).filter(([r, i]) => e.indexOf(+r) === -1).map(([r, i]) => i);
|
|
1600
|
+
}
|
|
1601
|
+
function he(t, e) {
|
|
1602
|
+
return typeof e == "bigint" ? e.toString() : e;
|
|
1603
|
+
}
|
|
1604
|
+
function te(t) {
|
|
1605
|
+
return {
|
|
1606
|
+
get value() {
|
|
1607
|
+
{
|
|
1608
|
+
const e = t();
|
|
1609
|
+
return Object.defineProperty(this, "value", { value: e }), e;
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
function fe(t) {
|
|
1615
|
+
return t == null;
|
|
1616
|
+
}
|
|
1617
|
+
function me(t) {
|
|
1618
|
+
const e = t.startsWith("^") ? 1 : 0, n = t.endsWith("$") ? t.length - 1 : t.length;
|
|
1619
|
+
return t.slice(e, n);
|
|
1620
|
+
}
|
|
1621
|
+
function Xt(t, e) {
|
|
1622
|
+
const n = (t.toString().split(".")[1] || "").length, r = e.toString();
|
|
1623
|
+
let i = (r.split(".")[1] || "").length;
|
|
1624
|
+
if (i === 0 && /\d?e-\d?/.test(r)) {
|
|
1625
|
+
const u = r.match(/\d?e-(\d?)/);
|
|
1626
|
+
u?.[1] && (i = Number.parseInt(u[1]));
|
|
1627
|
+
}
|
|
1628
|
+
const s = n > i ? n : i, o = Number.parseInt(t.toFixed(s).replace(".", "")), a = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1629
|
+
return o % a / 10 ** s;
|
|
1630
|
+
}
|
|
1631
|
+
const Ee = /* @__PURE__ */ Symbol("evaluating");
|
|
983
1632
|
function m(t, e, n) {
|
|
984
1633
|
let r;
|
|
985
1634
|
Object.defineProperty(t, e, {
|
|
986
1635
|
get() {
|
|
987
|
-
if (r !==
|
|
988
|
-
return r === void 0 && (r =
|
|
1636
|
+
if (r !== Ee)
|
|
1637
|
+
return r === void 0 && (r = Ee, r = n()), r;
|
|
989
1638
|
},
|
|
990
1639
|
set(i) {
|
|
991
1640
|
Object.defineProperty(t, e, {
|
|
@@ -996,7 +1645,7 @@ function m(t, e, n) {
|
|
|
996
1645
|
configurable: !0
|
|
997
1646
|
});
|
|
998
1647
|
}
|
|
999
|
-
function
|
|
1648
|
+
function R(t, e, n) {
|
|
1000
1649
|
Object.defineProperty(t, e, {
|
|
1001
1650
|
value: n,
|
|
1002
1651
|
writable: !0,
|
|
@@ -1012,18 +1661,18 @@ function x(...t) {
|
|
|
1012
1661
|
}
|
|
1013
1662
|
return Object.defineProperties({}, e);
|
|
1014
1663
|
}
|
|
1015
|
-
function
|
|
1664
|
+
function ze(t) {
|
|
1016
1665
|
return JSON.stringify(t);
|
|
1017
1666
|
}
|
|
1018
|
-
function
|
|
1667
|
+
function qt(t) {
|
|
1019
1668
|
return t.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1020
1669
|
}
|
|
1021
|
-
const
|
|
1670
|
+
const nt = "captureStackTrace" in Error ? Error.captureStackTrace : (...t) => {
|
|
1022
1671
|
};
|
|
1023
|
-
function
|
|
1672
|
+
function V(t) {
|
|
1024
1673
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
1025
1674
|
}
|
|
1026
|
-
const
|
|
1675
|
+
const Qt = te(() => {
|
|
1027
1676
|
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
1028
1677
|
return !1;
|
|
1029
1678
|
try {
|
|
@@ -1033,23 +1682,23 @@ const Mt = ee(() => {
|
|
|
1033
1682
|
return !1;
|
|
1034
1683
|
}
|
|
1035
1684
|
});
|
|
1036
|
-
function
|
|
1037
|
-
if (
|
|
1685
|
+
function B(t) {
|
|
1686
|
+
if (V(t) === !1)
|
|
1038
1687
|
return !1;
|
|
1039
1688
|
const e = t.constructor;
|
|
1040
1689
|
if (e === void 0 || typeof e != "function")
|
|
1041
1690
|
return !0;
|
|
1042
1691
|
const n = e.prototype;
|
|
1043
|
-
return !(
|
|
1692
|
+
return !(V(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
1044
1693
|
}
|
|
1045
|
-
function
|
|
1046
|
-
return
|
|
1694
|
+
function rt(t) {
|
|
1695
|
+
return B(t) ? { ...t } : Array.isArray(t) ? [...t] : t;
|
|
1047
1696
|
}
|
|
1048
|
-
const
|
|
1697
|
+
const Ht = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
1049
1698
|
function j(t) {
|
|
1050
1699
|
return t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1051
1700
|
}
|
|
1052
|
-
function
|
|
1701
|
+
function P(t, e, n) {
|
|
1053
1702
|
const r = new t._zod.constr(e ?? t._zod.def);
|
|
1054
1703
|
return (!e || n?.parent) && (r._zod.parent = t), r;
|
|
1055
1704
|
}
|
|
@@ -1066,17 +1715,17 @@ function l(t) {
|
|
|
1066
1715
|
}
|
|
1067
1716
|
return delete e.message, typeof e.error == "string" ? { ...e, error: () => e.error } : e;
|
|
1068
1717
|
}
|
|
1069
|
-
function
|
|
1718
|
+
function en(t) {
|
|
1070
1719
|
return Object.keys(t).filter((e) => t[e]._zod.optin === "optional" && t[e]._zod.optout === "optional");
|
|
1071
1720
|
}
|
|
1072
|
-
const
|
|
1721
|
+
const tn = {
|
|
1073
1722
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1074
1723
|
int32: [-2147483648, 2147483647],
|
|
1075
1724
|
uint32: [0, 4294967295],
|
|
1076
1725
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1077
1726
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1078
1727
|
};
|
|
1079
|
-
function
|
|
1728
|
+
function nn(t, e) {
|
|
1080
1729
|
const n = t._zod.def, r = x(t._zod.def, {
|
|
1081
1730
|
get shape() {
|
|
1082
1731
|
const i = {};
|
|
@@ -1085,13 +1734,13 @@ function Jt(t, e) {
|
|
|
1085
1734
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1086
1735
|
e[s] && (i[s] = n.shape[s]);
|
|
1087
1736
|
}
|
|
1088
|
-
return
|
|
1737
|
+
return R(this, "shape", i), i;
|
|
1089
1738
|
},
|
|
1090
1739
|
checks: []
|
|
1091
1740
|
});
|
|
1092
|
-
return
|
|
1741
|
+
return P(t, r);
|
|
1093
1742
|
}
|
|
1094
|
-
function
|
|
1743
|
+
function rn(t, e) {
|
|
1095
1744
|
const n = t._zod.def, r = x(t._zod.def, {
|
|
1096
1745
|
get shape() {
|
|
1097
1746
|
const i = { ...t._zod.def.shape };
|
|
@@ -1100,14 +1749,14 @@ function Wt(t, e) {
|
|
|
1100
1749
|
throw new Error(`Unrecognized key: "${s}"`);
|
|
1101
1750
|
e[s] && delete i[s];
|
|
1102
1751
|
}
|
|
1103
|
-
return
|
|
1752
|
+
return R(this, "shape", i), i;
|
|
1104
1753
|
},
|
|
1105
1754
|
checks: []
|
|
1106
1755
|
});
|
|
1107
|
-
return
|
|
1756
|
+
return P(t, r);
|
|
1108
1757
|
}
|
|
1109
|
-
function
|
|
1110
|
-
if (!
|
|
1758
|
+
function sn(t, e) {
|
|
1759
|
+
if (!B(e))
|
|
1111
1760
|
throw new Error("Invalid input to extend: expected a plain object");
|
|
1112
1761
|
const n = t._zod.def.checks;
|
|
1113
1762
|
if (n && n.length > 0)
|
|
@@ -1115,30 +1764,30 @@ function Bt(t, e) {
|
|
|
1115
1764
|
const i = x(t._zod.def, {
|
|
1116
1765
|
get shape() {
|
|
1117
1766
|
const s = { ...t._zod.def.shape, ...e };
|
|
1118
|
-
return
|
|
1767
|
+
return R(this, "shape", s), s;
|
|
1119
1768
|
},
|
|
1120
1769
|
checks: []
|
|
1121
1770
|
});
|
|
1122
|
-
return
|
|
1771
|
+
return P(t, i);
|
|
1123
1772
|
}
|
|
1124
|
-
function
|
|
1125
|
-
if (!
|
|
1773
|
+
function on(t, e) {
|
|
1774
|
+
if (!B(e))
|
|
1126
1775
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1127
1776
|
const n = {
|
|
1128
1777
|
...t._zod.def,
|
|
1129
1778
|
get shape() {
|
|
1130
1779
|
const r = { ...t._zod.def.shape, ...e };
|
|
1131
|
-
return
|
|
1780
|
+
return R(this, "shape", r), r;
|
|
1132
1781
|
},
|
|
1133
1782
|
checks: t._zod.def.checks
|
|
1134
1783
|
};
|
|
1135
|
-
return
|
|
1784
|
+
return P(t, n);
|
|
1136
1785
|
}
|
|
1137
|
-
function
|
|
1786
|
+
function an(t, e) {
|
|
1138
1787
|
const n = x(t._zod.def, {
|
|
1139
1788
|
get shape() {
|
|
1140
1789
|
const r = { ...t._zod.def.shape, ...e._zod.def.shape };
|
|
1141
|
-
return
|
|
1790
|
+
return R(this, "shape", r), r;
|
|
1142
1791
|
},
|
|
1143
1792
|
get catchall() {
|
|
1144
1793
|
return e._zod.def.catchall;
|
|
@@ -1146,9 +1795,9 @@ function Xt(t, e) {
|
|
|
1146
1795
|
checks: []
|
|
1147
1796
|
// delete existing checks
|
|
1148
1797
|
});
|
|
1149
|
-
return
|
|
1798
|
+
return P(t, n);
|
|
1150
1799
|
}
|
|
1151
|
-
function
|
|
1800
|
+
function cn(t, e, n) {
|
|
1152
1801
|
const r = x(e._zod.def, {
|
|
1153
1802
|
get shape() {
|
|
1154
1803
|
const i = e._zod.def.shape, s = { ...i };
|
|
@@ -1167,13 +1816,13 @@ function qt(t, e, n) {
|
|
|
1167
1816
|
type: "optional",
|
|
1168
1817
|
innerType: i[o]
|
|
1169
1818
|
}) : i[o];
|
|
1170
|
-
return
|
|
1819
|
+
return R(this, "shape", s), s;
|
|
1171
1820
|
},
|
|
1172
1821
|
checks: []
|
|
1173
1822
|
});
|
|
1174
|
-
return
|
|
1823
|
+
return P(e, r);
|
|
1175
1824
|
}
|
|
1176
|
-
function
|
|
1825
|
+
function un(t, e, n) {
|
|
1177
1826
|
const r = x(e._zod.def, {
|
|
1178
1827
|
get shape() {
|
|
1179
1828
|
const i = e._zod.def.shape, s = { ...i };
|
|
@@ -1192,11 +1841,11 @@ function Yt(t, e, n) {
|
|
|
1192
1841
|
type: "nonoptional",
|
|
1193
1842
|
innerType: i[o]
|
|
1194
1843
|
});
|
|
1195
|
-
return
|
|
1844
|
+
return R(this, "shape", s), s;
|
|
1196
1845
|
},
|
|
1197
1846
|
checks: []
|
|
1198
1847
|
});
|
|
1199
|
-
return
|
|
1848
|
+
return P(e, r);
|
|
1200
1849
|
}
|
|
1201
1850
|
function D(t, e = 0) {
|
|
1202
1851
|
if (t.aborted === !0)
|
|
@@ -1206,27 +1855,27 @@ function D(t, e = 0) {
|
|
|
1206
1855
|
return !0;
|
|
1207
1856
|
return !1;
|
|
1208
1857
|
}
|
|
1209
|
-
function
|
|
1858
|
+
function it(t, e) {
|
|
1210
1859
|
return e.map((n) => {
|
|
1211
1860
|
var r;
|
|
1212
1861
|
return (r = n).path ?? (r.path = []), n.path.unshift(t), n;
|
|
1213
1862
|
});
|
|
1214
1863
|
}
|
|
1215
|
-
function
|
|
1864
|
+
function W(t) {
|
|
1216
1865
|
return typeof t == "string" ? t : t?.message;
|
|
1217
1866
|
}
|
|
1218
|
-
function
|
|
1867
|
+
function C(t, e, n) {
|
|
1219
1868
|
const r = { ...t, path: t.path ?? [] };
|
|
1220
1869
|
if (!t.message) {
|
|
1221
|
-
const i =
|
|
1870
|
+
const i = W(t.inst?._zod.def?.error?.(t)) ?? W(e?.error?.(t)) ?? W(n.customError?.(t)) ?? W(n.localeError?.(t)) ?? "Invalid input";
|
|
1222
1871
|
r.message = i;
|
|
1223
1872
|
}
|
|
1224
1873
|
return delete r.inst, delete r.continue, e?.reportInput || delete r.input, r;
|
|
1225
1874
|
}
|
|
1226
|
-
function
|
|
1875
|
+
function ge(t) {
|
|
1227
1876
|
return Array.isArray(t) ? "array" : typeof t == "string" ? "string" : "unknown";
|
|
1228
1877
|
}
|
|
1229
|
-
function
|
|
1878
|
+
function J(...t) {
|
|
1230
1879
|
const [e, n, r] = t;
|
|
1231
1880
|
return typeof e == "string" ? {
|
|
1232
1881
|
message: e,
|
|
@@ -1235,7 +1884,7 @@ function W(...t) {
|
|
|
1235
1884
|
inst: r
|
|
1236
1885
|
} : { ...e };
|
|
1237
1886
|
}
|
|
1238
|
-
const
|
|
1887
|
+
const st = (t, e) => {
|
|
1239
1888
|
t.name = "$ZodError", Object.defineProperty(t, "_zod", {
|
|
1240
1889
|
value: t._zod,
|
|
1241
1890
|
enumerable: !1
|
|
@@ -1246,14 +1895,14 @@ const nt = (t, e) => {
|
|
|
1246
1895
|
value: () => t.message,
|
|
1247
1896
|
enumerable: !1
|
|
1248
1897
|
});
|
|
1249
|
-
},
|
|
1250
|
-
function
|
|
1898
|
+
}, ot = c("$ZodError", st), at = c("$ZodError", st, { Parent: Error });
|
|
1899
|
+
function hn(t, e = (n) => n.message) {
|
|
1251
1900
|
const n = {}, r = [];
|
|
1252
1901
|
for (const i of t.issues)
|
|
1253
1902
|
i.path.length > 0 ? (n[i.path[0]] = n[i.path[0]] || [], n[i.path[0]].push(e(i))) : r.push(e(i));
|
|
1254
1903
|
return { formErrors: r, fieldErrors: n };
|
|
1255
1904
|
}
|
|
1256
|
-
function
|
|
1905
|
+
function pn(t, e = (n) => n.message) {
|
|
1257
1906
|
const n = { _errors: [] }, r = (i) => {
|
|
1258
1907
|
for (const s of i.issues)
|
|
1259
1908
|
if (s.code === "invalid_union" && s.errors.length)
|
|
@@ -1274,81 +1923,81 @@ function Qt(t, e = (n) => n.message) {
|
|
|
1274
1923
|
};
|
|
1275
1924
|
return r(t), n;
|
|
1276
1925
|
}
|
|
1277
|
-
const
|
|
1926
|
+
const ve = (t) => (e, n, r, i) => {
|
|
1278
1927
|
const s = r ? Object.assign(r, { async: !1 }) : { async: !1 }, o = e._zod.run({ value: n, issues: [] }, s);
|
|
1279
1928
|
if (o instanceof Promise)
|
|
1280
|
-
throw new
|
|
1929
|
+
throw new F();
|
|
1281
1930
|
if (o.issues.length) {
|
|
1282
|
-
const a = new (i?.Err ?? t)(o.issues.map((u) =>
|
|
1283
|
-
throw
|
|
1931
|
+
const a = new (i?.Err ?? t)(o.issues.map((u) => C(u, s, Z())));
|
|
1932
|
+
throw nt(a, i?.callee), a;
|
|
1284
1933
|
}
|
|
1285
1934
|
return o.value;
|
|
1286
|
-
},
|
|
1935
|
+
}, _e = (t) => async (e, n, r, i) => {
|
|
1287
1936
|
const s = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
1288
1937
|
let o = e._zod.run({ value: n, issues: [] }, s);
|
|
1289
1938
|
if (o instanceof Promise && (o = await o), o.issues.length) {
|
|
1290
|
-
const a = new (i?.Err ?? t)(o.issues.map((u) =>
|
|
1291
|
-
throw
|
|
1939
|
+
const a = new (i?.Err ?? t)(o.issues.map((u) => C(u, s, Z())));
|
|
1940
|
+
throw nt(a, i?.callee), a;
|
|
1292
1941
|
}
|
|
1293
1942
|
return o.value;
|
|
1294
|
-
},
|
|
1943
|
+
}, ne = (t) => (e, n, r) => {
|
|
1295
1944
|
const i = r ? { ...r, async: !1 } : { async: !1 }, s = e._zod.run({ value: n, issues: [] }, i);
|
|
1296
1945
|
if (s instanceof Promise)
|
|
1297
|
-
throw new
|
|
1946
|
+
throw new F();
|
|
1298
1947
|
return s.issues.length ? {
|
|
1299
1948
|
success: !1,
|
|
1300
|
-
error: new (t ??
|
|
1949
|
+
error: new (t ?? ot)(s.issues.map((o) => C(o, i, Z())))
|
|
1301
1950
|
} : { success: !0, data: s.value };
|
|
1302
|
-
},
|
|
1951
|
+
}, ln = /* @__PURE__ */ ne(at), re = (t) => async (e, n, r) => {
|
|
1303
1952
|
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
1304
1953
|
let s = e._zod.run({ value: n, issues: [] }, i);
|
|
1305
1954
|
return s instanceof Promise && (s = await s), s.issues.length ? {
|
|
1306
1955
|
success: !1,
|
|
1307
|
-
error: new t(s.issues.map((o) =>
|
|
1956
|
+
error: new t(s.issues.map((o) => C(o, i, Z())))
|
|
1308
1957
|
} : { success: !0, data: s.value };
|
|
1309
|
-
},
|
|
1310
|
-
const i = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1311
|
-
return ge(t)(e, n, i);
|
|
1312
|
-
}, rn = (t) => (e, n, r) => ge(t)(e, n, r), sn = (t) => async (e, n, r) => {
|
|
1958
|
+
}, dn = /* @__PURE__ */ re(at), fn = (t) => (e, n, r) => {
|
|
1313
1959
|
const i = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1314
1960
|
return ve(t)(e, n, i);
|
|
1315
|
-
},
|
|
1961
|
+
}, mn = (t) => (e, n, r) => ve(t)(e, n, r), gn = (t) => async (e, n, r) => {
|
|
1316
1962
|
const i = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1317
|
-
return
|
|
1318
|
-
},
|
|
1963
|
+
return _e(t)(e, n, i);
|
|
1964
|
+
}, vn = (t) => async (e, n, r) => _e(t)(e, n, r), _n = (t) => (e, n, r) => {
|
|
1319
1965
|
const i = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1320
1966
|
return ne(t)(e, n, i);
|
|
1321
|
-
},
|
|
1322
|
-
|
|
1323
|
-
return
|
|
1967
|
+
}, kn = (t) => (e, n, r) => ne(t)(e, n, r), yn = (t) => async (e, n, r) => {
|
|
1968
|
+
const i = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1969
|
+
return re(t)(e, n, i);
|
|
1970
|
+
}, Tn = (t) => async (e, n, r) => re(t)(e, n, r), wn = /^[cC][^\s-]{8,}$/, bn = /^[0-9a-z]+$/, En = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, zn = /^[0-9a-vA-V]{20}$/, In = /^[A-Za-z0-9]{27}$/, $n = /^[a-zA-Z0-9_-]{21}$/, On = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, Sn = /^([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})$/, Ie = (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)$/, Nn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Pn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1971
|
+
function An() {
|
|
1972
|
+
return new RegExp(Pn, "u");
|
|
1324
1973
|
}
|
|
1325
|
-
const
|
|
1326
|
-
function
|
|
1974
|
+
const Zn = /^(?:(?: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])$/, Cn = /^(([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}|:))$/, Rn = /^((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])$/, xn = /^(([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])$/, Ln = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, ct = /^[A-Za-z0-9_-]*$/, Dn = /^\+(?:[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])))", Fn = /* @__PURE__ */ new RegExp(`^${ut}$`);
|
|
1975
|
+
function ht(t) {
|
|
1327
1976
|
const e = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1328
1977
|
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+)?)?`;
|
|
1329
1978
|
}
|
|
1330
|
-
function
|
|
1331
|
-
return new RegExp(`^${
|
|
1979
|
+
function jn(t) {
|
|
1980
|
+
return new RegExp(`^${ht(t)}$`);
|
|
1332
1981
|
}
|
|
1333
|
-
function
|
|
1334
|
-
const e =
|
|
1982
|
+
function Un(t) {
|
|
1983
|
+
const e = ht({ precision: t.precision }), n = ["Z"];
|
|
1335
1984
|
t.local && n.push(""), t.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1336
1985
|
const r = `${e}(?:${n.join("|")})`;
|
|
1337
|
-
return new RegExp(`^${
|
|
1986
|
+
return new RegExp(`^${ut}T(?:${r})$`);
|
|
1338
1987
|
}
|
|
1339
|
-
const
|
|
1988
|
+
const Mn = (t) => {
|
|
1340
1989
|
const e = t ? `[\\s\\S]{${t?.minimum ?? 0},${t?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1341
1990
|
return new RegExp(`^${e}$`);
|
|
1342
|
-
},
|
|
1991
|
+
}, Gn = /^-?\d+$/, Vn = /^-?\d+(?:\.\d+)?/, Bn = /^[^A-Z]*$/, Jn = /^[^a-z]*$/, b = /* @__PURE__ */ c("$ZodCheck", (t, e) => {
|
|
1343
1992
|
var n;
|
|
1344
1993
|
t._zod ?? (t._zod = {}), t._zod.def = e, (n = t._zod).onattach ?? (n.onattach = []);
|
|
1345
|
-
}),
|
|
1994
|
+
}), pt = {
|
|
1346
1995
|
number: "number",
|
|
1347
1996
|
bigint: "bigint",
|
|
1348
1997
|
object: "date"
|
|
1349
|
-
},
|
|
1998
|
+
}, lt = /* @__PURE__ */ c("$ZodCheckLessThan", (t, e) => {
|
|
1350
1999
|
b.init(t, e);
|
|
1351
|
-
const n =
|
|
2000
|
+
const n = pt[typeof e.value];
|
|
1352
2001
|
t._zod.onattach.push((r) => {
|
|
1353
2002
|
const i = r._zod.bag, s = (e.inclusive ? i.maximum : i.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1354
2003
|
e.value < s && (e.inclusive ? i.maximum = e.value : i.exclusiveMaximum = e.value);
|
|
@@ -1363,9 +2012,9 @@ const Zn = (t) => {
|
|
|
1363
2012
|
continue: !e.abort
|
|
1364
2013
|
});
|
|
1365
2014
|
};
|
|
1366
|
-
}),
|
|
2015
|
+
}), dt = /* @__PURE__ */ c("$ZodCheckGreaterThan", (t, e) => {
|
|
1367
2016
|
b.init(t, e);
|
|
1368
|
-
const n =
|
|
2017
|
+
const n = pt[typeof e.value];
|
|
1369
2018
|
t._zod.onattach.push((r) => {
|
|
1370
2019
|
const i = r._zod.bag, s = (e.inclusive ? i.minimum : i.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1371
2020
|
e.value > s && (e.inclusive ? i.minimum = e.value : i.exclusiveMinimum = e.value);
|
|
@@ -1380,14 +2029,14 @@ const Zn = (t) => {
|
|
|
1380
2029
|
continue: !e.abort
|
|
1381
2030
|
});
|
|
1382
2031
|
};
|
|
1383
|
-
}),
|
|
2032
|
+
}), Wn = /* @__PURE__ */ c("$ZodCheckMultipleOf", (t, e) => {
|
|
1384
2033
|
b.init(t, e), t._zod.onattach.push((n) => {
|
|
1385
2034
|
var r;
|
|
1386
2035
|
(r = n._zod.bag).multipleOf ?? (r.multipleOf = e.value);
|
|
1387
2036
|
}), t._zod.check = (n) => {
|
|
1388
2037
|
if (typeof n.value != typeof e.value)
|
|
1389
2038
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1390
|
-
(typeof n.value == "bigint" ? n.value % e.value === BigInt(0) :
|
|
2039
|
+
(typeof n.value == "bigint" ? n.value % e.value === BigInt(0) : Xt(n.value, e.value) === 0) || n.issues.push({
|
|
1391
2040
|
origin: typeof n.value,
|
|
1392
2041
|
code: "not_multiple_of",
|
|
1393
2042
|
divisor: e.value,
|
|
@@ -1396,12 +2045,12 @@ const Zn = (t) => {
|
|
|
1396
2045
|
continue: !e.abort
|
|
1397
2046
|
});
|
|
1398
2047
|
};
|
|
1399
|
-
}),
|
|
2048
|
+
}), Kn = /* @__PURE__ */ c("$ZodCheckNumberFormat", (t, e) => {
|
|
1400
2049
|
b.init(t, e), e.format = e.format || "float64";
|
|
1401
|
-
const n = e.format?.includes("int"), r = n ? "int" : "number", [i, s] =
|
|
2050
|
+
const n = e.format?.includes("int"), r = n ? "int" : "number", [i, s] = tn[e.format];
|
|
1402
2051
|
t._zod.onattach.push((o) => {
|
|
1403
2052
|
const a = o._zod.bag;
|
|
1404
|
-
a.format = e.format, a.minimum = i, a.maximum = s, n && (a.pattern =
|
|
2053
|
+
a.format = e.format, a.minimum = i, a.maximum = s, n && (a.pattern = Gn);
|
|
1405
2054
|
}), t._zod.check = (o) => {
|
|
1406
2055
|
const a = o.value;
|
|
1407
2056
|
if (n) {
|
|
@@ -1453,7 +2102,7 @@ const Zn = (t) => {
|
|
|
1453
2102
|
inst: t
|
|
1454
2103
|
});
|
|
1455
2104
|
};
|
|
1456
|
-
}),
|
|
2105
|
+
}), Yn = /* @__PURE__ */ c("$ZodCheckMaxLength", (t, e) => {
|
|
1457
2106
|
var n;
|
|
1458
2107
|
b.init(t, e), (n = t._zod.def).when ?? (n.when = (r) => {
|
|
1459
2108
|
const i = r.value;
|
|
@@ -1465,7 +2114,7 @@ const Zn = (t) => {
|
|
|
1465
2114
|
const i = r.value;
|
|
1466
2115
|
if (i.length <= e.maximum)
|
|
1467
2116
|
return;
|
|
1468
|
-
const o =
|
|
2117
|
+
const o = ge(i);
|
|
1469
2118
|
r.issues.push({
|
|
1470
2119
|
origin: o,
|
|
1471
2120
|
code: "too_big",
|
|
@@ -1476,7 +2125,7 @@ const Zn = (t) => {
|
|
|
1476
2125
|
continue: !e.abort
|
|
1477
2126
|
});
|
|
1478
2127
|
};
|
|
1479
|
-
}),
|
|
2128
|
+
}), Xn = /* @__PURE__ */ c("$ZodCheckMinLength", (t, e) => {
|
|
1480
2129
|
var n;
|
|
1481
2130
|
b.init(t, e), (n = t._zod.def).when ?? (n.when = (r) => {
|
|
1482
2131
|
const i = r.value;
|
|
@@ -1488,7 +2137,7 @@ const Zn = (t) => {
|
|
|
1488
2137
|
const i = r.value;
|
|
1489
2138
|
if (i.length >= e.minimum)
|
|
1490
2139
|
return;
|
|
1491
|
-
const o =
|
|
2140
|
+
const o = ge(i);
|
|
1492
2141
|
r.issues.push({
|
|
1493
2142
|
origin: o,
|
|
1494
2143
|
code: "too_small",
|
|
@@ -1499,7 +2148,7 @@ const Zn = (t) => {
|
|
|
1499
2148
|
continue: !e.abort
|
|
1500
2149
|
});
|
|
1501
2150
|
};
|
|
1502
|
-
}),
|
|
2151
|
+
}), qn = /* @__PURE__ */ c("$ZodCheckLengthEquals", (t, e) => {
|
|
1503
2152
|
var n;
|
|
1504
2153
|
b.init(t, e), (n = t._zod.def).when ?? (n.when = (r) => {
|
|
1505
2154
|
const i = r.value;
|
|
@@ -1511,7 +2160,7 @@ const Zn = (t) => {
|
|
|
1511
2160
|
const i = r.value, s = i.length;
|
|
1512
2161
|
if (s === e.length)
|
|
1513
2162
|
return;
|
|
1514
|
-
const o =
|
|
2163
|
+
const o = ge(i), a = s > e.length;
|
|
1515
2164
|
r.issues.push({
|
|
1516
2165
|
origin: o,
|
|
1517
2166
|
...a ? { code: "too_big", maximum: e.length } : { code: "too_small", minimum: e.length },
|
|
@@ -1522,7 +2171,7 @@ const Zn = (t) => {
|
|
|
1522
2171
|
continue: !e.abort
|
|
1523
2172
|
});
|
|
1524
2173
|
};
|
|
1525
|
-
}),
|
|
2174
|
+
}), ie = /* @__PURE__ */ c("$ZodCheckStringFormat", (t, e) => {
|
|
1526
2175
|
var n, r;
|
|
1527
2176
|
b.init(t, e), t._zod.onattach.push((i) => {
|
|
1528
2177
|
const s = i._zod.bag;
|
|
@@ -1539,8 +2188,8 @@ const Zn = (t) => {
|
|
|
1539
2188
|
});
|
|
1540
2189
|
}) : (r = t._zod).check ?? (r.check = () => {
|
|
1541
2190
|
});
|
|
1542
|
-
}),
|
|
1543
|
-
|
|
2191
|
+
}), Qn = /* @__PURE__ */ c("$ZodCheckRegex", (t, e) => {
|
|
2192
|
+
ie.init(t, e), t._zod.check = (n) => {
|
|
1544
2193
|
e.pattern.lastIndex = 0, !e.pattern.test(n.value) && n.issues.push({
|
|
1545
2194
|
origin: "string",
|
|
1546
2195
|
code: "invalid_format",
|
|
@@ -1551,11 +2200,11 @@ const Zn = (t) => {
|
|
|
1551
2200
|
continue: !e.abort
|
|
1552
2201
|
});
|
|
1553
2202
|
};
|
|
1554
|
-
}),
|
|
1555
|
-
e.pattern ?? (e.pattern =
|
|
1556
|
-
}),
|
|
1557
|
-
e.pattern ?? (e.pattern =
|
|
1558
|
-
}),
|
|
2203
|
+
}), Hn = /* @__PURE__ */ c("$ZodCheckLowerCase", (t, e) => {
|
|
2204
|
+
e.pattern ?? (e.pattern = Bn), ie.init(t, e);
|
|
2205
|
+
}), er = /* @__PURE__ */ c("$ZodCheckUpperCase", (t, e) => {
|
|
2206
|
+
e.pattern ?? (e.pattern = Jn), ie.init(t, e);
|
|
2207
|
+
}), tr = /* @__PURE__ */ c("$ZodCheckIncludes", (t, e) => {
|
|
1559
2208
|
b.init(t, e);
|
|
1560
2209
|
const n = j(e.includes), r = new RegExp(typeof e.position == "number" ? `^.{${e.position}}${n}` : n);
|
|
1561
2210
|
e.pattern = r, t._zod.onattach.push((i) => {
|
|
@@ -1572,7 +2221,7 @@ const Zn = (t) => {
|
|
|
1572
2221
|
continue: !e.abort
|
|
1573
2222
|
});
|
|
1574
2223
|
};
|
|
1575
|
-
}),
|
|
2224
|
+
}), nr = /* @__PURE__ */ c("$ZodCheckStartsWith", (t, e) => {
|
|
1576
2225
|
b.init(t, e);
|
|
1577
2226
|
const n = new RegExp(`^${j(e.prefix)}.*`);
|
|
1578
2227
|
e.pattern ?? (e.pattern = n), t._zod.onattach.push((r) => {
|
|
@@ -1589,7 +2238,7 @@ const Zn = (t) => {
|
|
|
1589
2238
|
continue: !e.abort
|
|
1590
2239
|
});
|
|
1591
2240
|
};
|
|
1592
|
-
}),
|
|
2241
|
+
}), rr = /* @__PURE__ */ c("$ZodCheckEndsWith", (t, e) => {
|
|
1593
2242
|
b.init(t, e);
|
|
1594
2243
|
const n = new RegExp(`.*${j(e.suffix)}$`);
|
|
1595
2244
|
e.pattern ?? (e.pattern = n), t._zod.onattach.push((r) => {
|
|
@@ -1606,12 +2255,12 @@ const Zn = (t) => {
|
|
|
1606
2255
|
continue: !e.abort
|
|
1607
2256
|
});
|
|
1608
2257
|
};
|
|
1609
|
-
}),
|
|
2258
|
+
}), ir = /* @__PURE__ */ c("$ZodCheckOverwrite", (t, e) => {
|
|
1610
2259
|
b.init(t, e), t._zod.check = (n) => {
|
|
1611
2260
|
n.value = e.tx(n.value);
|
|
1612
2261
|
};
|
|
1613
2262
|
});
|
|
1614
|
-
class
|
|
2263
|
+
class sr {
|
|
1615
2264
|
constructor(e = []) {
|
|
1616
2265
|
this.content = [], this.indent = 0, this && (this.args = e);
|
|
1617
2266
|
}
|
|
@@ -1634,13 +2283,13 @@ class Kn {
|
|
|
1634
2283
|
`));
|
|
1635
2284
|
}
|
|
1636
2285
|
}
|
|
1637
|
-
const
|
|
2286
|
+
const or = {
|
|
1638
2287
|
major: 4,
|
|
1639
2288
|
minor: 2,
|
|
1640
2289
|
patch: 1
|
|
1641
2290
|
}, k = /* @__PURE__ */ c("$ZodType", (t, e) => {
|
|
1642
2291
|
var n;
|
|
1643
|
-
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version =
|
|
2292
|
+
t ?? (t = {}), t._zod.def = e, t._zod.bag = t._zod.bag || {}, t._zod.version = or;
|
|
1644
2293
|
const r = [...t._zod.def.checks ?? []];
|
|
1645
2294
|
t._zod.traits.has("$ZodCheck") && r.unshift(t);
|
|
1646
2295
|
for (const i of r)
|
|
@@ -1653,23 +2302,23 @@ const Xn = {
|
|
|
1653
2302
|
else {
|
|
1654
2303
|
const i = (o, a, u) => {
|
|
1655
2304
|
let h = D(o), p;
|
|
1656
|
-
for (const
|
|
1657
|
-
if (
|
|
1658
|
-
if (!
|
|
2305
|
+
for (const d of a) {
|
|
2306
|
+
if (d._zod.def.when) {
|
|
2307
|
+
if (!d._zod.def.when(o))
|
|
1659
2308
|
continue;
|
|
1660
2309
|
} else if (h)
|
|
1661
2310
|
continue;
|
|
1662
|
-
const
|
|
2311
|
+
const f = o.issues.length, v = d._zod.check(o);
|
|
1663
2312
|
if (v instanceof Promise && u?.async === !1)
|
|
1664
|
-
throw new
|
|
2313
|
+
throw new F();
|
|
1665
2314
|
if (p || v instanceof Promise)
|
|
1666
2315
|
p = (p ?? Promise.resolve()).then(async () => {
|
|
1667
|
-
await v, o.issues.length !==
|
|
2316
|
+
await v, o.issues.length !== f && (h || (h = D(o, f)));
|
|
1668
2317
|
});
|
|
1669
2318
|
else {
|
|
1670
|
-
if (o.issues.length ===
|
|
2319
|
+
if (o.issues.length === f)
|
|
1671
2320
|
continue;
|
|
1672
|
-
h || (h = D(o,
|
|
2321
|
+
h || (h = D(o, f));
|
|
1673
2322
|
}
|
|
1674
2323
|
}
|
|
1675
2324
|
return p ? p.then(() => o) : o;
|
|
@@ -1679,7 +2328,7 @@ const Xn = {
|
|
|
1679
2328
|
const h = i(a, r, u);
|
|
1680
2329
|
if (h instanceof Promise) {
|
|
1681
2330
|
if (u.async === !1)
|
|
1682
|
-
throw new
|
|
2331
|
+
throw new F();
|
|
1683
2332
|
return h.then((p) => t._zod.parse(p, u));
|
|
1684
2333
|
}
|
|
1685
2334
|
return t._zod.parse(h, u);
|
|
@@ -1694,7 +2343,7 @@ const Xn = {
|
|
|
1694
2343
|
const u = t._zod.parse(o, a);
|
|
1695
2344
|
if (u instanceof Promise) {
|
|
1696
2345
|
if (a.async === !1)
|
|
1697
|
-
throw new
|
|
2346
|
+
throw new F();
|
|
1698
2347
|
return u.then((h) => i(h, r, a));
|
|
1699
2348
|
}
|
|
1700
2349
|
return i(u, r, a);
|
|
@@ -1703,17 +2352,17 @@ const Xn = {
|
|
|
1703
2352
|
t["~standard"] = {
|
|
1704
2353
|
validate: (i) => {
|
|
1705
2354
|
try {
|
|
1706
|
-
const s =
|
|
2355
|
+
const s = ln(t, i);
|
|
1707
2356
|
return s.success ? { value: s.data } : { issues: s.error?.issues };
|
|
1708
2357
|
} catch {
|
|
1709
|
-
return
|
|
2358
|
+
return dn(t, i).then((o) => o.success ? { value: o.data } : { issues: o.error?.issues });
|
|
1710
2359
|
}
|
|
1711
2360
|
},
|
|
1712
2361
|
vendor: "zod",
|
|
1713
2362
|
version: 1
|
|
1714
2363
|
};
|
|
1715
|
-
}),
|
|
1716
|
-
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ??
|
|
2364
|
+
}), ke = /* @__PURE__ */ c("$ZodString", (t, e) => {
|
|
2365
|
+
k.init(t, e), t._zod.pattern = [...t?._zod.bag?.patterns ?? []].pop() ?? Mn(t._zod.bag), t._zod.parse = (n, r) => {
|
|
1717
2366
|
if (e.coerce)
|
|
1718
2367
|
try {
|
|
1719
2368
|
n.value = String(n.value);
|
|
@@ -1727,10 +2376,10 @@ const Xn = {
|
|
|
1727
2376
|
}), n;
|
|
1728
2377
|
};
|
|
1729
2378
|
}), g = /* @__PURE__ */ c("$ZodStringFormat", (t, e) => {
|
|
1730
|
-
|
|
1731
|
-
}),
|
|
1732
|
-
e.pattern ?? (e.pattern =
|
|
1733
|
-
}),
|
|
2379
|
+
ie.init(t, e), ke.init(t, e);
|
|
2380
|
+
}), ar = /* @__PURE__ */ c("$ZodGUID", (t, e) => {
|
|
2381
|
+
e.pattern ?? (e.pattern = Sn), g.init(t, e);
|
|
2382
|
+
}), cr = /* @__PURE__ */ c("$ZodUUID", (t, e) => {
|
|
1734
2383
|
if (e.version) {
|
|
1735
2384
|
const r = {
|
|
1736
2385
|
v1: 1,
|
|
@@ -1744,13 +2393,13 @@ const Xn = {
|
|
|
1744
2393
|
}[e.version];
|
|
1745
2394
|
if (r === void 0)
|
|
1746
2395
|
throw new Error(`Invalid UUID version: "${e.version}"`);
|
|
1747
|
-
e.pattern ?? (e.pattern =
|
|
2396
|
+
e.pattern ?? (e.pattern = Ie(r));
|
|
1748
2397
|
} else
|
|
1749
|
-
e.pattern ?? (e.pattern =
|
|
2398
|
+
e.pattern ?? (e.pattern = Ie());
|
|
1750
2399
|
g.init(t, e);
|
|
1751
|
-
}),
|
|
1752
|
-
e.pattern ?? (e.pattern =
|
|
1753
|
-
}),
|
|
2400
|
+
}), ur = /* @__PURE__ */ c("$ZodEmail", (t, e) => {
|
|
2401
|
+
e.pattern ?? (e.pattern = Nn), g.init(t, e);
|
|
2402
|
+
}), hr = /* @__PURE__ */ c("$ZodURL", (t, e) => {
|
|
1754
2403
|
g.init(t, e), t._zod.check = (n) => {
|
|
1755
2404
|
try {
|
|
1756
2405
|
const r = n.value.trim(), i = new URL(r);
|
|
@@ -1782,32 +2431,32 @@ const Xn = {
|
|
|
1782
2431
|
});
|
|
1783
2432
|
}
|
|
1784
2433
|
};
|
|
1785
|
-
}),
|
|
1786
|
-
e.pattern ?? (e.pattern =
|
|
1787
|
-
}),
|
|
1788
|
-
e.pattern ?? (e.pattern =
|
|
1789
|
-
}),
|
|
1790
|
-
e.pattern ?? (e.pattern =
|
|
1791
|
-
}),
|
|
1792
|
-
e.pattern ?? (e.pattern =
|
|
1793
|
-
}),
|
|
1794
|
-
e.pattern ?? (e.pattern =
|
|
1795
|
-
}),
|
|
1796
|
-
e.pattern ?? (e.pattern =
|
|
1797
|
-
}),
|
|
1798
|
-
e.pattern ?? (e.pattern =
|
|
1799
|
-
}),
|
|
1800
|
-
e.pattern ?? (e.pattern =
|
|
1801
|
-
}),
|
|
2434
|
+
}), pr = /* @__PURE__ */ c("$ZodEmoji", (t, e) => {
|
|
2435
|
+
e.pattern ?? (e.pattern = An()), g.init(t, e);
|
|
2436
|
+
}), lr = /* @__PURE__ */ c("$ZodNanoID", (t, e) => {
|
|
2437
|
+
e.pattern ?? (e.pattern = $n), g.init(t, e);
|
|
2438
|
+
}), dr = /* @__PURE__ */ c("$ZodCUID", (t, e) => {
|
|
2439
|
+
e.pattern ?? (e.pattern = wn), g.init(t, e);
|
|
2440
|
+
}), fr = /* @__PURE__ */ c("$ZodCUID2", (t, e) => {
|
|
2441
|
+
e.pattern ?? (e.pattern = bn), g.init(t, e);
|
|
2442
|
+
}), mr = /* @__PURE__ */ c("$ZodULID", (t, e) => {
|
|
2443
|
+
e.pattern ?? (e.pattern = En), g.init(t, e);
|
|
2444
|
+
}), gr = /* @__PURE__ */ c("$ZodXID", (t, e) => {
|
|
2445
|
+
e.pattern ?? (e.pattern = zn), g.init(t, e);
|
|
2446
|
+
}), vr = /* @__PURE__ */ c("$ZodKSUID", (t, e) => {
|
|
2447
|
+
e.pattern ?? (e.pattern = In), g.init(t, e);
|
|
2448
|
+
}), _r = /* @__PURE__ */ c("$ZodISODateTime", (t, e) => {
|
|
2449
|
+
e.pattern ?? (e.pattern = Un(e)), g.init(t, e);
|
|
2450
|
+
}), kr = /* @__PURE__ */ c("$ZodISODate", (t, e) => {
|
|
2451
|
+
e.pattern ?? (e.pattern = Fn), g.init(t, e);
|
|
2452
|
+
}), yr = /* @__PURE__ */ c("$ZodISOTime", (t, e) => {
|
|
2453
|
+
e.pattern ?? (e.pattern = jn(e)), g.init(t, e);
|
|
2454
|
+
}), Tr = /* @__PURE__ */ c("$ZodISODuration", (t, e) => {
|
|
1802
2455
|
e.pattern ?? (e.pattern = On), g.init(t, e);
|
|
1803
|
-
}),
|
|
1804
|
-
e.pattern ?? (e.pattern =
|
|
1805
|
-
}),
|
|
1806
|
-
e.pattern ?? (e.pattern =
|
|
1807
|
-
}), pr = /* @__PURE__ */ c("$ZodIPv4", (t, e) => {
|
|
1808
|
-
e.pattern ?? (e.pattern = wn), g.init(t, e), t._zod.bag.format = "ipv4";
|
|
1809
|
-
}), lr = /* @__PURE__ */ c("$ZodIPv6", (t, e) => {
|
|
1810
|
-
e.pattern ?? (e.pattern = bn), g.init(t, e), t._zod.bag.format = "ipv6", t._zod.check = (n) => {
|
|
2456
|
+
}), wr = /* @__PURE__ */ c("$ZodIPv4", (t, e) => {
|
|
2457
|
+
e.pattern ?? (e.pattern = Zn), g.init(t, e), t._zod.bag.format = "ipv4";
|
|
2458
|
+
}), br = /* @__PURE__ */ c("$ZodIPv6", (t, e) => {
|
|
2459
|
+
e.pattern ?? (e.pattern = Cn), g.init(t, e), t._zod.bag.format = "ipv6", t._zod.check = (n) => {
|
|
1811
2460
|
try {
|
|
1812
2461
|
new URL(`http://[${n.value}]`);
|
|
1813
2462
|
} catch {
|
|
@@ -1820,10 +2469,10 @@ const Xn = {
|
|
|
1820
2469
|
});
|
|
1821
2470
|
}
|
|
1822
2471
|
};
|
|
1823
|
-
}),
|
|
1824
|
-
e.pattern ?? (e.pattern =
|
|
1825
|
-
}),
|
|
1826
|
-
e.pattern ?? (e.pattern =
|
|
2472
|
+
}), Er = /* @__PURE__ */ c("$ZodCIDRv4", (t, e) => {
|
|
2473
|
+
e.pattern ?? (e.pattern = Rn), g.init(t, e);
|
|
2474
|
+
}), zr = /* @__PURE__ */ c("$ZodCIDRv6", (t, e) => {
|
|
2475
|
+
e.pattern ?? (e.pattern = xn), g.init(t, e), t._zod.check = (n) => {
|
|
1827
2476
|
const r = n.value.split("/");
|
|
1828
2477
|
try {
|
|
1829
2478
|
if (r.length !== 2)
|
|
@@ -1848,7 +2497,7 @@ const Xn = {
|
|
|
1848
2497
|
}
|
|
1849
2498
|
};
|
|
1850
2499
|
});
|
|
1851
|
-
function
|
|
2500
|
+
function ft(t) {
|
|
1852
2501
|
if (t === "")
|
|
1853
2502
|
return !0;
|
|
1854
2503
|
if (t.length % 4 !== 0)
|
|
@@ -1859,9 +2508,9 @@ function pt(t) {
|
|
|
1859
2508
|
return !1;
|
|
1860
2509
|
}
|
|
1861
2510
|
}
|
|
1862
|
-
const
|
|
1863
|
-
e.pattern ?? (e.pattern =
|
|
1864
|
-
|
|
2511
|
+
const Ir = /* @__PURE__ */ c("$ZodBase64", (t, e) => {
|
|
2512
|
+
e.pattern ?? (e.pattern = Ln), g.init(t, e), t._zod.bag.contentEncoding = "base64", t._zod.check = (n) => {
|
|
2513
|
+
ft(n.value) || n.issues.push({
|
|
1865
2514
|
code: "invalid_format",
|
|
1866
2515
|
format: "base64",
|
|
1867
2516
|
input: n.value,
|
|
@@ -1870,15 +2519,15 @@ const mr = /* @__PURE__ */ c("$ZodBase64", (t, e) => {
|
|
|
1870
2519
|
});
|
|
1871
2520
|
};
|
|
1872
2521
|
});
|
|
1873
|
-
function
|
|
1874
|
-
if (!
|
|
2522
|
+
function $r(t) {
|
|
2523
|
+
if (!ct.test(t))
|
|
1875
2524
|
return !1;
|
|
1876
2525
|
const e = t.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = e.padEnd(Math.ceil(e.length / 4) * 4, "=");
|
|
1877
|
-
return
|
|
2526
|
+
return ft(n);
|
|
1878
2527
|
}
|
|
1879
|
-
const
|
|
1880
|
-
e.pattern ?? (e.pattern =
|
|
1881
|
-
|
|
2528
|
+
const Or = /* @__PURE__ */ c("$ZodBase64URL", (t, e) => {
|
|
2529
|
+
e.pattern ?? (e.pattern = ct), g.init(t, e), t._zod.bag.contentEncoding = "base64url", t._zod.check = (n) => {
|
|
2530
|
+
$r(n.value) || n.issues.push({
|
|
1882
2531
|
code: "invalid_format",
|
|
1883
2532
|
format: "base64url",
|
|
1884
2533
|
input: n.value,
|
|
@@ -1886,10 +2535,10 @@ const vr = /* @__PURE__ */ c("$ZodBase64URL", (t, e) => {
|
|
|
1886
2535
|
continue: !e.abort
|
|
1887
2536
|
});
|
|
1888
2537
|
};
|
|
1889
|
-
}),
|
|
1890
|
-
e.pattern ?? (e.pattern =
|
|
2538
|
+
}), Sr = /* @__PURE__ */ c("$ZodE164", (t, e) => {
|
|
2539
|
+
e.pattern ?? (e.pattern = Dn), g.init(t, e);
|
|
1891
2540
|
});
|
|
1892
|
-
function
|
|
2541
|
+
function Nr(t, e = null) {
|
|
1893
2542
|
try {
|
|
1894
2543
|
const n = t.split(".");
|
|
1895
2544
|
if (n.length !== 3)
|
|
@@ -1903,9 +2552,9 @@ function kr(t, e = null) {
|
|
|
1903
2552
|
return !1;
|
|
1904
2553
|
}
|
|
1905
2554
|
}
|
|
1906
|
-
const
|
|
2555
|
+
const Pr = /* @__PURE__ */ c("$ZodJWT", (t, e) => {
|
|
1907
2556
|
g.init(t, e), t._zod.check = (n) => {
|
|
1908
|
-
|
|
2557
|
+
Nr(n.value, e.alg) || n.issues.push({
|
|
1909
2558
|
code: "invalid_format",
|
|
1910
2559
|
format: "jwt",
|
|
1911
2560
|
input: n.value,
|
|
@@ -1913,8 +2562,8 @@ const yr = /* @__PURE__ */ c("$ZodJWT", (t, e) => {
|
|
|
1913
2562
|
continue: !e.abort
|
|
1914
2563
|
});
|
|
1915
2564
|
};
|
|
1916
|
-
}),
|
|
1917
|
-
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ??
|
|
2565
|
+
}), mt = /* @__PURE__ */ c("$ZodNumber", (t, e) => {
|
|
2566
|
+
k.init(t, e), t._zod.pattern = t._zod.bag.pattern ?? Vn, t._zod.parse = (n, r) => {
|
|
1918
2567
|
if (e.coerce)
|
|
1919
2568
|
try {
|
|
1920
2569
|
n.value = Number(n.value);
|
|
@@ -1932,11 +2581,11 @@ const yr = /* @__PURE__ */ c("$ZodJWT", (t, e) => {
|
|
|
1932
2581
|
...s ? { received: s } : {}
|
|
1933
2582
|
}), n;
|
|
1934
2583
|
};
|
|
1935
|
-
}),
|
|
1936
|
-
|
|
1937
|
-
}),
|
|
2584
|
+
}), Ar = /* @__PURE__ */ c("$ZodNumberFormat", (t, e) => {
|
|
2585
|
+
Kn.init(t, e), mt.init(t, e);
|
|
2586
|
+
}), Zr = /* @__PURE__ */ c("$ZodUnknown", (t, e) => {
|
|
1938
2587
|
k.init(t, e), t._zod.parse = (n) => n;
|
|
1939
|
-
}),
|
|
2588
|
+
}), Cr = /* @__PURE__ */ c("$ZodNever", (t, e) => {
|
|
1940
2589
|
k.init(t, e), t._zod.parse = (n, r) => (n.issues.push({
|
|
1941
2590
|
expected: "never",
|
|
1942
2591
|
code: "invalid_type",
|
|
@@ -1944,10 +2593,10 @@ const yr = /* @__PURE__ */ c("$ZodJWT", (t, e) => {
|
|
|
1944
2593
|
inst: t
|
|
1945
2594
|
}), n);
|
|
1946
2595
|
});
|
|
1947
|
-
function
|
|
1948
|
-
t.issues.length && e.issues.push(...
|
|
2596
|
+
function $e(t, e, n) {
|
|
2597
|
+
t.issues.length && e.issues.push(...it(n, t.issues)), e.value[n] = t.value;
|
|
1949
2598
|
}
|
|
1950
|
-
const
|
|
2599
|
+
const Rr = /* @__PURE__ */ c("$ZodArray", (t, e) => {
|
|
1951
2600
|
k.init(t, e), t._zod.parse = (n, r) => {
|
|
1952
2601
|
const i = n.value;
|
|
1953
2602
|
if (!Array.isArray(i))
|
|
@@ -1964,20 +2613,20 @@ const zr = /* @__PURE__ */ c("$ZodArray", (t, e) => {
|
|
|
1964
2613
|
value: a,
|
|
1965
2614
|
issues: []
|
|
1966
2615
|
}, r);
|
|
1967
|
-
u instanceof Promise ? s.push(u.then((h) =>
|
|
2616
|
+
u instanceof Promise ? s.push(u.then((h) => $e(h, n, o))) : $e(u, n, o);
|
|
1968
2617
|
}
|
|
1969
2618
|
return s.length ? Promise.all(s).then(() => n) : n;
|
|
1970
2619
|
};
|
|
1971
2620
|
});
|
|
1972
|
-
function
|
|
1973
|
-
t.issues.length && e.issues.push(...
|
|
2621
|
+
function q(t, e, n, r) {
|
|
2622
|
+
t.issues.length && e.issues.push(...it(n, t.issues)), t.value === void 0 ? n in r && (e.value[n] = void 0) : e.value[n] = t.value;
|
|
1974
2623
|
}
|
|
1975
|
-
function
|
|
2624
|
+
function gt(t) {
|
|
1976
2625
|
const e = Object.keys(t.shape);
|
|
1977
2626
|
for (const r of e)
|
|
1978
2627
|
if (!t.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
1979
2628
|
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
1980
|
-
const n =
|
|
2629
|
+
const n = en(t.shape);
|
|
1981
2630
|
return {
|
|
1982
2631
|
...t,
|
|
1983
2632
|
keys: e,
|
|
@@ -1986,7 +2635,7 @@ function ft(t) {
|
|
|
1986
2635
|
optionalKeys: new Set(n)
|
|
1987
2636
|
};
|
|
1988
2637
|
}
|
|
1989
|
-
function
|
|
2638
|
+
function vt(t, e, n, r, i, s) {
|
|
1990
2639
|
const o = [], a = i.keySet, u = i.catchall._zod, h = u.def.type;
|
|
1991
2640
|
for (const p in e) {
|
|
1992
2641
|
if (a.has(p))
|
|
@@ -1995,8 +2644,8 @@ function dt(t, e, n, r, i, s) {
|
|
|
1995
2644
|
o.push(p);
|
|
1996
2645
|
continue;
|
|
1997
2646
|
}
|
|
1998
|
-
const
|
|
1999
|
-
|
|
2647
|
+
const d = u.run({ value: e[p], issues: [] }, r);
|
|
2648
|
+
d instanceof Promise ? t.push(d.then((f) => q(f, n, p, e))) : q(d, n, p, e);
|
|
2000
2649
|
}
|
|
2001
2650
|
return o.length && n.issues.push({
|
|
2002
2651
|
code: "unrecognized_keys",
|
|
@@ -2005,7 +2654,7 @@ function dt(t, e, n, r, i, s) {
|
|
|
2005
2654
|
inst: s
|
|
2006
2655
|
}), t.length ? Promise.all(t).then(() => n) : n;
|
|
2007
2656
|
}
|
|
2008
|
-
const
|
|
2657
|
+
const xr = /* @__PURE__ */ c("$ZodObject", (t, e) => {
|
|
2009
2658
|
if (k.init(t, e), !Object.getOwnPropertyDescriptor(e, "shape")?.get) {
|
|
2010
2659
|
const a = e.shape;
|
|
2011
2660
|
Object.defineProperty(e, "shape", {
|
|
@@ -2017,20 +2666,20 @@ const Er = /* @__PURE__ */ c("$ZodObject", (t, e) => {
|
|
|
2017
2666
|
}
|
|
2018
2667
|
});
|
|
2019
2668
|
}
|
|
2020
|
-
const r =
|
|
2669
|
+
const r = te(() => gt(e));
|
|
2021
2670
|
m(t._zod, "propValues", () => {
|
|
2022
2671
|
const a = e.shape, u = {};
|
|
2023
2672
|
for (const h in a) {
|
|
2024
2673
|
const p = a[h]._zod;
|
|
2025
2674
|
if (p.values) {
|
|
2026
2675
|
u[h] ?? (u[h] = /* @__PURE__ */ new Set());
|
|
2027
|
-
for (const
|
|
2028
|
-
u[h].add(
|
|
2676
|
+
for (const d of p.values)
|
|
2677
|
+
u[h].add(d);
|
|
2029
2678
|
}
|
|
2030
2679
|
}
|
|
2031
2680
|
return u;
|
|
2032
2681
|
});
|
|
2033
|
-
const i =
|
|
2682
|
+
const i = V, s = e.catchall;
|
|
2034
2683
|
let o;
|
|
2035
2684
|
t._zod.parse = (a, u) => {
|
|
2036
2685
|
o ?? (o = r.value);
|
|
@@ -2043,63 +2692,63 @@ const Er = /* @__PURE__ */ c("$ZodObject", (t, e) => {
|
|
|
2043
2692
|
inst: t
|
|
2044
2693
|
}), a;
|
|
2045
2694
|
a.value = {};
|
|
2046
|
-
const p = [],
|
|
2047
|
-
for (const
|
|
2048
|
-
const
|
|
2049
|
-
|
|
2695
|
+
const p = [], d = o.shape;
|
|
2696
|
+
for (const f of o.keys) {
|
|
2697
|
+
const E = d[f]._zod.run({ value: h[f], issues: [] }, u);
|
|
2698
|
+
E instanceof Promise ? p.push(E.then((oe) => q(oe, a, f, h))) : q(E, a, f, h);
|
|
2050
2699
|
}
|
|
2051
|
-
return s ?
|
|
2700
|
+
return s ? vt(p, h, a, u, r.value, t) : p.length ? Promise.all(p).then(() => a) : a;
|
|
2052
2701
|
};
|
|
2053
|
-
}),
|
|
2054
|
-
|
|
2055
|
-
const n = t._zod.parse, r =
|
|
2056
|
-
const v = new
|
|
2057
|
-
const
|
|
2058
|
-
return `shape[${
|
|
2702
|
+
}), Lr = /* @__PURE__ */ c("$ZodObjectJIT", (t, e) => {
|
|
2703
|
+
xr.init(t, e);
|
|
2704
|
+
const n = t._zod.parse, r = te(() => gt(e)), i = (f) => {
|
|
2705
|
+
const v = new sr(["shape", "payload", "ctx"]), E = r.value, oe = (O) => {
|
|
2706
|
+
const I = ze(O);
|
|
2707
|
+
return `shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`;
|
|
2059
2708
|
};
|
|
2060
2709
|
v.write("const input = payload.value;");
|
|
2061
2710
|
const we = /* @__PURE__ */ Object.create(null);
|
|
2062
|
-
let
|
|
2063
|
-
for (const O of
|
|
2064
|
-
we[O] = `key_${
|
|
2711
|
+
let St = 0;
|
|
2712
|
+
for (const O of E.keys)
|
|
2713
|
+
we[O] = `key_${St++}`;
|
|
2065
2714
|
v.write("const newResult = {};");
|
|
2066
|
-
for (const O of
|
|
2067
|
-
const
|
|
2068
|
-
v.write(`const ${
|
|
2069
|
-
if (${
|
|
2070
|
-
payload.issues = payload.issues.concat(${
|
|
2715
|
+
for (const O of E.keys) {
|
|
2716
|
+
const I = we[O], M = ze(O);
|
|
2717
|
+
v.write(`const ${I} = ${oe(O)};`), v.write(`
|
|
2718
|
+
if (${I}.issues.length) {
|
|
2719
|
+
payload.issues = payload.issues.concat(${I}.issues.map(iss => ({
|
|
2071
2720
|
...iss,
|
|
2072
2721
|
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
2073
2722
|
})));
|
|
2074
2723
|
}
|
|
2075
2724
|
|
|
2076
2725
|
|
|
2077
|
-
if (${
|
|
2726
|
+
if (${I}.value === undefined) {
|
|
2078
2727
|
if (${M} in input) {
|
|
2079
2728
|
newResult[${M}] = undefined;
|
|
2080
2729
|
}
|
|
2081
2730
|
} else {
|
|
2082
|
-
newResult[${M}] = ${
|
|
2731
|
+
newResult[${M}] = ${I}.value;
|
|
2083
2732
|
}
|
|
2084
2733
|
|
|
2085
2734
|
`);
|
|
2086
2735
|
}
|
|
2087
2736
|
v.write("payload.value = newResult;"), v.write("return payload;");
|
|
2088
|
-
const
|
|
2089
|
-
return (O,
|
|
2737
|
+
const Nt = v.compile();
|
|
2738
|
+
return (O, I) => Nt(f, O, I);
|
|
2090
2739
|
};
|
|
2091
2740
|
let s;
|
|
2092
|
-
const o =
|
|
2093
|
-
let
|
|
2094
|
-
t._zod.parse = (
|
|
2095
|
-
|
|
2096
|
-
const
|
|
2097
|
-
return o(
|
|
2741
|
+
const o = V, a = !et.jitless, h = a && Qt.value, p = e.catchall;
|
|
2742
|
+
let d;
|
|
2743
|
+
t._zod.parse = (f, v) => {
|
|
2744
|
+
d ?? (d = r.value);
|
|
2745
|
+
const E = f.value;
|
|
2746
|
+
return o(E) ? a && h && v?.async === !1 && v.jitless !== !0 ? (s || (s = i(e.shape)), f = s(f, v), p ? vt([], E, f, v, d, t) : f) : n(f, v) : (f.issues.push({
|
|
2098
2747
|
expected: "object",
|
|
2099
2748
|
code: "invalid_type",
|
|
2100
|
-
input:
|
|
2749
|
+
input: E,
|
|
2101
2750
|
inst: t
|
|
2102
|
-
}),
|
|
2751
|
+
}), f);
|
|
2103
2752
|
};
|
|
2104
2753
|
});
|
|
2105
2754
|
function Oe(t, e, n, r) {
|
|
@@ -2111,17 +2760,17 @@ function Oe(t, e, n, r) {
|
|
|
2111
2760
|
code: "invalid_union",
|
|
2112
2761
|
input: e.value,
|
|
2113
2762
|
inst: n,
|
|
2114
|
-
errors: t.map((s) => s.issues.map((o) =>
|
|
2763
|
+
errors: t.map((s) => s.issues.map((o) => C(o, r, Z())))
|
|
2115
2764
|
}), e);
|
|
2116
2765
|
}
|
|
2117
|
-
const
|
|
2766
|
+
const _t = /* @__PURE__ */ c("$ZodUnion", (t, e) => {
|
|
2118
2767
|
k.init(t, e), m(t._zod, "optin", () => e.options.some((i) => i._zod.optin === "optional") ? "optional" : void 0), m(t._zod, "optout", () => e.options.some((i) => i._zod.optout === "optional") ? "optional" : void 0), m(t._zod, "values", () => {
|
|
2119
2768
|
if (e.options.every((i) => i._zod.values))
|
|
2120
2769
|
return new Set(e.options.flatMap((i) => Array.from(i._zod.values)));
|
|
2121
2770
|
}), m(t._zod, "pattern", () => {
|
|
2122
2771
|
if (e.options.every((i) => i._zod.pattern)) {
|
|
2123
2772
|
const i = e.options.map((s) => s._zod.pattern);
|
|
2124
|
-
return new RegExp(`^(${i.map((s) =>
|
|
2773
|
+
return new RegExp(`^(${i.map((s) => me(s.source)).join("|")})$`);
|
|
2125
2774
|
}
|
|
2126
2775
|
});
|
|
2127
2776
|
const n = e.options.length === 1, r = e.options[0]._zod.run;
|
|
@@ -2145,8 +2794,8 @@ const mt = /* @__PURE__ */ c("$ZodUnion", (t, e) => {
|
|
|
2145
2794
|
}
|
|
2146
2795
|
return o ? Promise.all(a).then((u) => Oe(u, i, t, s)) : Oe(a, i, t, s);
|
|
2147
2796
|
};
|
|
2148
|
-
}),
|
|
2149
|
-
e.inclusive = !1,
|
|
2797
|
+
}), Dr = /* @__PURE__ */ c("$ZodDiscriminatedUnion", (t, e) => {
|
|
2798
|
+
e.inclusive = !1, _t.init(t, e);
|
|
2150
2799
|
const n = t._zod.parse;
|
|
2151
2800
|
m(t._zod, "propValues", () => {
|
|
2152
2801
|
const i = {};
|
|
@@ -2162,7 +2811,7 @@ const mt = /* @__PURE__ */ c("$ZodUnion", (t, e) => {
|
|
|
2162
2811
|
}
|
|
2163
2812
|
return i;
|
|
2164
2813
|
});
|
|
2165
|
-
const r =
|
|
2814
|
+
const r = te(() => {
|
|
2166
2815
|
const i = e.options, s = /* @__PURE__ */ new Map();
|
|
2167
2816
|
for (const o of i) {
|
|
2168
2817
|
const a = o._zod.propValues?.[e.discriminator];
|
|
@@ -2178,7 +2827,7 @@ const mt = /* @__PURE__ */ c("$ZodUnion", (t, e) => {
|
|
|
2178
2827
|
});
|
|
2179
2828
|
t._zod.parse = (i, s) => {
|
|
2180
2829
|
const o = i.value;
|
|
2181
|
-
if (!
|
|
2830
|
+
if (!V(o))
|
|
2182
2831
|
return i.issues.push({
|
|
2183
2832
|
code: "invalid_type",
|
|
2184
2833
|
expected: "object",
|
|
@@ -2196,7 +2845,7 @@ const mt = /* @__PURE__ */ c("$ZodUnion", (t, e) => {
|
|
|
2196
2845
|
inst: t
|
|
2197
2846
|
}), i);
|
|
2198
2847
|
};
|
|
2199
|
-
}),
|
|
2848
|
+
}), Fr = /* @__PURE__ */ c("$ZodIntersection", (t, e) => {
|
|
2200
2849
|
k.init(t, e), t._zod.parse = (n, r) => {
|
|
2201
2850
|
const i = n.value, s = e.left._zod.run({ value: i, issues: [] }, r), o = e.right._zod.run({ value: i, issues: [] }, r);
|
|
2202
2851
|
return s instanceof Promise || o instanceof Promise ? Promise.all([s, o]).then(([u, h]) => Se(n, u, h)) : Se(n, s, o);
|
|
@@ -2207,7 +2856,7 @@ function pe(t, e) {
|
|
|
2207
2856
|
return { valid: !0, data: t };
|
|
2208
2857
|
if (t instanceof Date && e instanceof Date && +t == +e)
|
|
2209
2858
|
return { valid: !0, data: t };
|
|
2210
|
-
if (
|
|
2859
|
+
if (B(t) && B(e)) {
|
|
2211
2860
|
const n = Object.keys(e), r = Object.keys(t).filter((s) => n.indexOf(s) !== -1), i = { ...t, ...e };
|
|
2212
2861
|
for (const s of r) {
|
|
2213
2862
|
const o = pe(t[s], e[s]);
|
|
@@ -2245,10 +2894,10 @@ function Se(t, e, n) {
|
|
|
2245
2894
|
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
2246
2895
|
return t.value = r.data, t;
|
|
2247
2896
|
}
|
|
2248
|
-
const
|
|
2897
|
+
const jr = /* @__PURE__ */ c("$ZodEnum", (t, e) => {
|
|
2249
2898
|
k.init(t, e);
|
|
2250
|
-
const n =
|
|
2251
|
-
t._zod.values = r, t._zod.pattern = new RegExp(`^(${n.filter((i) =>
|
|
2899
|
+
const n = tt(e.entries), r = new Set(n);
|
|
2900
|
+
t._zod.values = r, t._zod.pattern = new RegExp(`^(${n.filter((i) => Ht.has(typeof i)).map((i) => typeof i == "string" ? j(i) : i.toString()).join("|")})$`), t._zod.parse = (i, s) => {
|
|
2252
2901
|
const o = i.value;
|
|
2253
2902
|
return r.has(o) || i.issues.push({
|
|
2254
2903
|
code: "invalid_value",
|
|
@@ -2257,7 +2906,7 @@ const Sr = /* @__PURE__ */ c("$ZodEnum", (t, e) => {
|
|
|
2257
2906
|
inst: t
|
|
2258
2907
|
}), i;
|
|
2259
2908
|
};
|
|
2260
|
-
}),
|
|
2909
|
+
}), Ur = /* @__PURE__ */ c("$ZodLiteral", (t, e) => {
|
|
2261
2910
|
if (k.init(t, e), e.values.length === 0)
|
|
2262
2911
|
throw new Error("Cannot create literal schema with no valid values");
|
|
2263
2912
|
const n = new Set(e.values);
|
|
@@ -2270,62 +2919,62 @@ const Sr = /* @__PURE__ */ c("$ZodEnum", (t, e) => {
|
|
|
2270
2919
|
inst: t
|
|
2271
2920
|
}), r;
|
|
2272
2921
|
};
|
|
2273
|
-
}),
|
|
2922
|
+
}), Mr = /* @__PURE__ */ c("$ZodTransform", (t, e) => {
|
|
2274
2923
|
k.init(t, e), t._zod.parse = (n, r) => {
|
|
2275
2924
|
if (r.direction === "backward")
|
|
2276
|
-
throw new
|
|
2925
|
+
throw new He(t.constructor.name);
|
|
2277
2926
|
const i = e.transform(n.value, n);
|
|
2278
2927
|
if (r.async)
|
|
2279
2928
|
return (i instanceof Promise ? i : Promise.resolve(i)).then((o) => (n.value = o, n));
|
|
2280
2929
|
if (i instanceof Promise)
|
|
2281
|
-
throw new
|
|
2930
|
+
throw new F();
|
|
2282
2931
|
return n.value = i, n;
|
|
2283
2932
|
};
|
|
2284
2933
|
});
|
|
2285
|
-
function
|
|
2934
|
+
function Ne(t, e) {
|
|
2286
2935
|
return t.issues.length && e === void 0 ? { issues: [], value: void 0 } : t;
|
|
2287
2936
|
}
|
|
2288
|
-
const
|
|
2937
|
+
const Gr = /* @__PURE__ */ c("$ZodOptional", (t, e) => {
|
|
2289
2938
|
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", () => {
|
|
2290
2939
|
const n = e.innerType._zod.pattern;
|
|
2291
|
-
return n ? new RegExp(`^(${
|
|
2940
|
+
return n ? new RegExp(`^(${me(n.source)})?$`) : void 0;
|
|
2292
2941
|
}), t._zod.parse = (n, r) => {
|
|
2293
2942
|
if (e.innerType._zod.optin === "optional") {
|
|
2294
2943
|
const i = e.innerType._zod.run(n, r);
|
|
2295
|
-
return i instanceof Promise ? i.then((s) =>
|
|
2944
|
+
return i instanceof Promise ? i.then((s) => Ne(s, n.value)) : Ne(i, n.value);
|
|
2296
2945
|
}
|
|
2297
2946
|
return n.value === void 0 ? n : e.innerType._zod.run(n, r);
|
|
2298
2947
|
};
|
|
2299
|
-
}),
|
|
2948
|
+
}), Vr = /* @__PURE__ */ c("$ZodNullable", (t, e) => {
|
|
2300
2949
|
k.init(t, e), m(t._zod, "optin", () => e.innerType._zod.optin), m(t._zod, "optout", () => e.innerType._zod.optout), m(t._zod, "pattern", () => {
|
|
2301
2950
|
const n = e.innerType._zod.pattern;
|
|
2302
|
-
return n ? new RegExp(`^(${
|
|
2951
|
+
return n ? new RegExp(`^(${me(n.source)}|null)$`) : void 0;
|
|
2303
2952
|
}), m(t._zod, "values", () => e.innerType._zod.values ? /* @__PURE__ */ new Set([...e.innerType._zod.values, null]) : void 0), t._zod.parse = (n, r) => n.value === null ? n : e.innerType._zod.run(n, r);
|
|
2304
|
-
}),
|
|
2953
|
+
}), Br = /* @__PURE__ */ c("$ZodDefault", (t, e) => {
|
|
2305
2954
|
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (n, r) => {
|
|
2306
2955
|
if (r.direction === "backward")
|
|
2307
2956
|
return e.innerType._zod.run(n, r);
|
|
2308
2957
|
if (n.value === void 0)
|
|
2309
2958
|
return n.value = e.defaultValue, n;
|
|
2310
2959
|
const i = e.innerType._zod.run(n, r);
|
|
2311
|
-
return i instanceof Promise ? i.then((s) =>
|
|
2960
|
+
return i instanceof Promise ? i.then((s) => Pe(s, e)) : Pe(i, e);
|
|
2312
2961
|
};
|
|
2313
2962
|
});
|
|
2314
|
-
function
|
|
2963
|
+
function Pe(t, e) {
|
|
2315
2964
|
return t.value === void 0 && (t.value = e.defaultValue), t;
|
|
2316
2965
|
}
|
|
2317
|
-
const
|
|
2966
|
+
const Jr = /* @__PURE__ */ c("$ZodPrefault", (t, e) => {
|
|
2318
2967
|
k.init(t, e), t._zod.optin = "optional", m(t._zod, "values", () => e.innerType._zod.values), t._zod.parse = (n, r) => (r.direction === "backward" || n.value === void 0 && (n.value = e.defaultValue), e.innerType._zod.run(n, r));
|
|
2319
|
-
}),
|
|
2968
|
+
}), Wr = /* @__PURE__ */ c("$ZodNonOptional", (t, e) => {
|
|
2320
2969
|
k.init(t, e), m(t._zod, "values", () => {
|
|
2321
2970
|
const n = e.innerType._zod.values;
|
|
2322
2971
|
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
2323
2972
|
}), t._zod.parse = (n, r) => {
|
|
2324
2973
|
const i = e.innerType._zod.run(n, r);
|
|
2325
|
-
return i instanceof Promise ? i.then((s) =>
|
|
2974
|
+
return i instanceof Promise ? i.then((s) => Ae(s, t)) : Ae(i, t);
|
|
2326
2975
|
};
|
|
2327
2976
|
});
|
|
2328
|
-
function
|
|
2977
|
+
function Ae(t, e) {
|
|
2329
2978
|
return !t.issues.length && t.value === void 0 && t.issues.push({
|
|
2330
2979
|
code: "invalid_type",
|
|
2331
2980
|
expected: "nonoptional",
|
|
@@ -2333,7 +2982,7 @@ function Ne(t, e) {
|
|
|
2333
2982
|
inst: e
|
|
2334
2983
|
}), t;
|
|
2335
2984
|
}
|
|
2336
|
-
const
|
|
2985
|
+
const Kr = /* @__PURE__ */ c("$ZodCatch", (t, e) => {
|
|
2337
2986
|
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 = (n, r) => {
|
|
2338
2987
|
if (r.direction === "backward")
|
|
2339
2988
|
return e.innerType._zod.run(n, r);
|
|
@@ -2341,18 +2990,18 @@ const Dr = /* @__PURE__ */ c("$ZodCatch", (t, e) => {
|
|
|
2341
2990
|
return i instanceof Promise ? i.then((s) => (n.value = s.value, s.issues.length && (n.value = e.catchValue({
|
|
2342
2991
|
...n,
|
|
2343
2992
|
error: {
|
|
2344
|
-
issues: s.issues.map((o) =>
|
|
2993
|
+
issues: s.issues.map((o) => C(o, r, Z()))
|
|
2345
2994
|
},
|
|
2346
2995
|
input: n.value
|
|
2347
2996
|
}), n.issues = []), n)) : (n.value = i.value, i.issues.length && (n.value = e.catchValue({
|
|
2348
2997
|
...n,
|
|
2349
2998
|
error: {
|
|
2350
|
-
issues: i.issues.map((s) =>
|
|
2999
|
+
issues: i.issues.map((s) => C(s, r, Z()))
|
|
2351
3000
|
},
|
|
2352
3001
|
input: n.value
|
|
2353
3002
|
}), n.issues = []), n);
|
|
2354
3003
|
};
|
|
2355
|
-
}),
|
|
3004
|
+
}), Yr = /* @__PURE__ */ c("$ZodPipe", (t, e) => {
|
|
2356
3005
|
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 = (n, r) => {
|
|
2357
3006
|
if (r.direction === "backward") {
|
|
2358
3007
|
const s = e.out._zod.run(n, r);
|
|
@@ -2365,26 +3014,26 @@ const Dr = /* @__PURE__ */ c("$ZodCatch", (t, e) => {
|
|
|
2365
3014
|
function K(t, e, n) {
|
|
2366
3015
|
return t.issues.length ? (t.aborted = !0, t) : e._zod.run({ value: t.value, issues: t.issues }, n);
|
|
2367
3016
|
}
|
|
2368
|
-
const
|
|
3017
|
+
const Xr = /* @__PURE__ */ c("$ZodReadonly", (t, e) => {
|
|
2369
3018
|
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 = (n, r) => {
|
|
2370
3019
|
if (r.direction === "backward")
|
|
2371
3020
|
return e.innerType._zod.run(n, r);
|
|
2372
3021
|
const i = e.innerType._zod.run(n, r);
|
|
2373
|
-
return i instanceof Promise ? i.then(
|
|
3022
|
+
return i instanceof Promise ? i.then(Ze) : Ze(i);
|
|
2374
3023
|
};
|
|
2375
3024
|
});
|
|
2376
|
-
function
|
|
3025
|
+
function Ze(t) {
|
|
2377
3026
|
return t.value = Object.freeze(t.value), t;
|
|
2378
3027
|
}
|
|
2379
|
-
const
|
|
3028
|
+
const qr = /* @__PURE__ */ c("$ZodCustom", (t, e) => {
|
|
2380
3029
|
b.init(t, e), k.init(t, e), t._zod.parse = (n, r) => n, t._zod.check = (n) => {
|
|
2381
3030
|
const r = n.value, i = e.fn(r);
|
|
2382
3031
|
if (i instanceof Promise)
|
|
2383
|
-
return i.then((s) =>
|
|
2384
|
-
|
|
3032
|
+
return i.then((s) => Ce(s, n, r, t));
|
|
3033
|
+
Ce(i, n, r, t);
|
|
2385
3034
|
};
|
|
2386
3035
|
});
|
|
2387
|
-
function
|
|
3036
|
+
function Ce(t, e, n, r) {
|
|
2388
3037
|
if (!t) {
|
|
2389
3038
|
const i = {
|
|
2390
3039
|
code: "custom",
|
|
@@ -2396,11 +3045,11 @@ function Re(t, e, n, r) {
|
|
|
2396
3045
|
continue: !r._zod.def.abort
|
|
2397
3046
|
// params: inst._zod.def.params,
|
|
2398
3047
|
};
|
|
2399
|
-
r._zod.def.params && (i.params = r._zod.def.params), e.issues.push(
|
|
3048
|
+
r._zod.def.params && (i.params = r._zod.def.params), e.issues.push(J(i));
|
|
2400
3049
|
}
|
|
2401
3050
|
}
|
|
2402
|
-
var
|
|
2403
|
-
class
|
|
3051
|
+
var Re;
|
|
3052
|
+
class Qr {
|
|
2404
3053
|
constructor() {
|
|
2405
3054
|
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2406
3055
|
}
|
|
@@ -2434,18 +3083,18 @@ class Mr {
|
|
|
2434
3083
|
return this._map.has(e);
|
|
2435
3084
|
}
|
|
2436
3085
|
}
|
|
2437
|
-
function
|
|
2438
|
-
return new
|
|
3086
|
+
function Hr() {
|
|
3087
|
+
return new Qr();
|
|
2439
3088
|
}
|
|
2440
|
-
(
|
|
2441
|
-
const
|
|
2442
|
-
function
|
|
3089
|
+
(Re = globalThis).__zod_globalRegistry ?? (Re.__zod_globalRegistry = Hr());
|
|
3090
|
+
const G = globalThis.__zod_globalRegistry;
|
|
3091
|
+
function ei(t, e) {
|
|
2443
3092
|
return new t({
|
|
2444
3093
|
type: "string",
|
|
2445
3094
|
...l(e)
|
|
2446
3095
|
});
|
|
2447
3096
|
}
|
|
2448
|
-
function
|
|
3097
|
+
function ti(t, e) {
|
|
2449
3098
|
return new t({
|
|
2450
3099
|
type: "string",
|
|
2451
3100
|
format: "email",
|
|
@@ -2463,7 +3112,7 @@ function xe(t, e) {
|
|
|
2463
3112
|
...l(e)
|
|
2464
3113
|
});
|
|
2465
3114
|
}
|
|
2466
|
-
function
|
|
3115
|
+
function ni(t, e) {
|
|
2467
3116
|
return new t({
|
|
2468
3117
|
type: "string",
|
|
2469
3118
|
format: "uuid",
|
|
@@ -2472,7 +3121,7 @@ function Jr(t, e) {
|
|
|
2472
3121
|
...l(e)
|
|
2473
3122
|
});
|
|
2474
3123
|
}
|
|
2475
|
-
function
|
|
3124
|
+
function ri(t, e) {
|
|
2476
3125
|
return new t({
|
|
2477
3126
|
type: "string",
|
|
2478
3127
|
format: "uuid",
|
|
@@ -2482,7 +3131,7 @@ function Wr(t, e) {
|
|
|
2482
3131
|
...l(e)
|
|
2483
3132
|
});
|
|
2484
3133
|
}
|
|
2485
|
-
function
|
|
3134
|
+
function ii(t, e) {
|
|
2486
3135
|
return new t({
|
|
2487
3136
|
type: "string",
|
|
2488
3137
|
format: "uuid",
|
|
@@ -2492,7 +3141,7 @@ function Br(t, e) {
|
|
|
2492
3141
|
...l(e)
|
|
2493
3142
|
});
|
|
2494
3143
|
}
|
|
2495
|
-
function
|
|
3144
|
+
function si(t, e) {
|
|
2496
3145
|
return new t({
|
|
2497
3146
|
type: "string",
|
|
2498
3147
|
format: "uuid",
|
|
@@ -2502,7 +3151,7 @@ function Kr(t, e) {
|
|
|
2502
3151
|
...l(e)
|
|
2503
3152
|
});
|
|
2504
3153
|
}
|
|
2505
|
-
function
|
|
3154
|
+
function oi(t, e) {
|
|
2506
3155
|
return new t({
|
|
2507
3156
|
type: "string",
|
|
2508
3157
|
format: "url",
|
|
@@ -2511,7 +3160,7 @@ function Xr(t, e) {
|
|
|
2511
3160
|
...l(e)
|
|
2512
3161
|
});
|
|
2513
3162
|
}
|
|
2514
|
-
function
|
|
3163
|
+
function ai(t, e) {
|
|
2515
3164
|
return new t({
|
|
2516
3165
|
type: "string",
|
|
2517
3166
|
format: "emoji",
|
|
@@ -2520,7 +3169,7 @@ function qr(t, e) {
|
|
|
2520
3169
|
...l(e)
|
|
2521
3170
|
});
|
|
2522
3171
|
}
|
|
2523
|
-
function
|
|
3172
|
+
function ci(t, e) {
|
|
2524
3173
|
return new t({
|
|
2525
3174
|
type: "string",
|
|
2526
3175
|
format: "nanoid",
|
|
@@ -2529,7 +3178,7 @@ function Yr(t, e) {
|
|
|
2529
3178
|
...l(e)
|
|
2530
3179
|
});
|
|
2531
3180
|
}
|
|
2532
|
-
function
|
|
3181
|
+
function ui(t, e) {
|
|
2533
3182
|
return new t({
|
|
2534
3183
|
type: "string",
|
|
2535
3184
|
format: "cuid",
|
|
@@ -2538,7 +3187,7 @@ function Hr(t, e) {
|
|
|
2538
3187
|
...l(e)
|
|
2539
3188
|
});
|
|
2540
3189
|
}
|
|
2541
|
-
function
|
|
3190
|
+
function hi(t, e) {
|
|
2542
3191
|
return new t({
|
|
2543
3192
|
type: "string",
|
|
2544
3193
|
format: "cuid2",
|
|
@@ -2547,7 +3196,7 @@ function Qr(t, e) {
|
|
|
2547
3196
|
...l(e)
|
|
2548
3197
|
});
|
|
2549
3198
|
}
|
|
2550
|
-
function
|
|
3199
|
+
function pi(t, e) {
|
|
2551
3200
|
return new t({
|
|
2552
3201
|
type: "string",
|
|
2553
3202
|
format: "ulid",
|
|
@@ -2556,7 +3205,7 @@ function ei(t, e) {
|
|
|
2556
3205
|
...l(e)
|
|
2557
3206
|
});
|
|
2558
3207
|
}
|
|
2559
|
-
function
|
|
3208
|
+
function li(t, e) {
|
|
2560
3209
|
return new t({
|
|
2561
3210
|
type: "string",
|
|
2562
3211
|
format: "xid",
|
|
@@ -2565,7 +3214,7 @@ function ti(t, e) {
|
|
|
2565
3214
|
...l(e)
|
|
2566
3215
|
});
|
|
2567
3216
|
}
|
|
2568
|
-
function
|
|
3217
|
+
function di(t, e) {
|
|
2569
3218
|
return new t({
|
|
2570
3219
|
type: "string",
|
|
2571
3220
|
format: "ksuid",
|
|
@@ -2574,7 +3223,7 @@ function ni(t, e) {
|
|
|
2574
3223
|
...l(e)
|
|
2575
3224
|
});
|
|
2576
3225
|
}
|
|
2577
|
-
function
|
|
3226
|
+
function fi(t, e) {
|
|
2578
3227
|
return new t({
|
|
2579
3228
|
type: "string",
|
|
2580
3229
|
format: "ipv4",
|
|
@@ -2583,7 +3232,7 @@ function ri(t, e) {
|
|
|
2583
3232
|
...l(e)
|
|
2584
3233
|
});
|
|
2585
3234
|
}
|
|
2586
|
-
function
|
|
3235
|
+
function mi(t, e) {
|
|
2587
3236
|
return new t({
|
|
2588
3237
|
type: "string",
|
|
2589
3238
|
format: "ipv6",
|
|
@@ -2592,7 +3241,7 @@ function ii(t, e) {
|
|
|
2592
3241
|
...l(e)
|
|
2593
3242
|
});
|
|
2594
3243
|
}
|
|
2595
|
-
function
|
|
3244
|
+
function gi(t, e) {
|
|
2596
3245
|
return new t({
|
|
2597
3246
|
type: "string",
|
|
2598
3247
|
format: "cidrv4",
|
|
@@ -2601,7 +3250,7 @@ function si(t, e) {
|
|
|
2601
3250
|
...l(e)
|
|
2602
3251
|
});
|
|
2603
3252
|
}
|
|
2604
|
-
function
|
|
3253
|
+
function vi(t, e) {
|
|
2605
3254
|
return new t({
|
|
2606
3255
|
type: "string",
|
|
2607
3256
|
format: "cidrv6",
|
|
@@ -2610,7 +3259,7 @@ function oi(t, e) {
|
|
|
2610
3259
|
...l(e)
|
|
2611
3260
|
});
|
|
2612
3261
|
}
|
|
2613
|
-
function
|
|
3262
|
+
function _i(t, e) {
|
|
2614
3263
|
return new t({
|
|
2615
3264
|
type: "string",
|
|
2616
3265
|
format: "base64",
|
|
@@ -2619,7 +3268,7 @@ function ai(t, e) {
|
|
|
2619
3268
|
...l(e)
|
|
2620
3269
|
});
|
|
2621
3270
|
}
|
|
2622
|
-
function
|
|
3271
|
+
function ki(t, e) {
|
|
2623
3272
|
return new t({
|
|
2624
3273
|
type: "string",
|
|
2625
3274
|
format: "base64url",
|
|
@@ -2628,7 +3277,7 @@ function ci(t, e) {
|
|
|
2628
3277
|
...l(e)
|
|
2629
3278
|
});
|
|
2630
3279
|
}
|
|
2631
|
-
function
|
|
3280
|
+
function yi(t, e) {
|
|
2632
3281
|
return new t({
|
|
2633
3282
|
type: "string",
|
|
2634
3283
|
format: "e164",
|
|
@@ -2637,7 +3286,7 @@ function ui(t, e) {
|
|
|
2637
3286
|
...l(e)
|
|
2638
3287
|
});
|
|
2639
3288
|
}
|
|
2640
|
-
function
|
|
3289
|
+
function Ti(t, e) {
|
|
2641
3290
|
return new t({
|
|
2642
3291
|
type: "string",
|
|
2643
3292
|
format: "jwt",
|
|
@@ -2646,7 +3295,7 @@ function hi(t, e) {
|
|
|
2646
3295
|
...l(e)
|
|
2647
3296
|
});
|
|
2648
3297
|
}
|
|
2649
|
-
function
|
|
3298
|
+
function wi(t, e) {
|
|
2650
3299
|
return new t({
|
|
2651
3300
|
type: "string",
|
|
2652
3301
|
format: "datetime",
|
|
@@ -2657,7 +3306,7 @@ function pi(t, e) {
|
|
|
2657
3306
|
...l(e)
|
|
2658
3307
|
});
|
|
2659
3308
|
}
|
|
2660
|
-
function
|
|
3309
|
+
function bi(t, e) {
|
|
2661
3310
|
return new t({
|
|
2662
3311
|
type: "string",
|
|
2663
3312
|
format: "date",
|
|
@@ -2665,7 +3314,7 @@ function li(t, e) {
|
|
|
2665
3314
|
...l(e)
|
|
2666
3315
|
});
|
|
2667
3316
|
}
|
|
2668
|
-
function
|
|
3317
|
+
function Ei(t, e) {
|
|
2669
3318
|
return new t({
|
|
2670
3319
|
type: "string",
|
|
2671
3320
|
format: "time",
|
|
@@ -2674,7 +3323,7 @@ function fi(t, e) {
|
|
|
2674
3323
|
...l(e)
|
|
2675
3324
|
});
|
|
2676
3325
|
}
|
|
2677
|
-
function
|
|
3326
|
+
function zi(t, e) {
|
|
2678
3327
|
return new t({
|
|
2679
3328
|
type: "string",
|
|
2680
3329
|
format: "duration",
|
|
@@ -2682,14 +3331,14 @@ function di(t, e) {
|
|
|
2682
3331
|
...l(e)
|
|
2683
3332
|
});
|
|
2684
3333
|
}
|
|
2685
|
-
function
|
|
3334
|
+
function Ii(t, e) {
|
|
2686
3335
|
return new t({
|
|
2687
3336
|
type: "number",
|
|
2688
3337
|
checks: [],
|
|
2689
3338
|
...l(e)
|
|
2690
3339
|
});
|
|
2691
3340
|
}
|
|
2692
|
-
function
|
|
3341
|
+
function $i(t, e) {
|
|
2693
3342
|
return new t({
|
|
2694
3343
|
type: "number",
|
|
2695
3344
|
check: "number_format",
|
|
@@ -2698,145 +3347,145 @@ function gi(t, e) {
|
|
|
2698
3347
|
...l(e)
|
|
2699
3348
|
});
|
|
2700
3349
|
}
|
|
2701
|
-
function
|
|
3350
|
+
function Oi(t) {
|
|
2702
3351
|
return new t({
|
|
2703
3352
|
type: "unknown"
|
|
2704
3353
|
});
|
|
2705
3354
|
}
|
|
2706
|
-
function
|
|
3355
|
+
function Si(t, e) {
|
|
2707
3356
|
return new t({
|
|
2708
3357
|
type: "never",
|
|
2709
3358
|
...l(e)
|
|
2710
3359
|
});
|
|
2711
3360
|
}
|
|
2712
|
-
function
|
|
2713
|
-
return new
|
|
3361
|
+
function Le(t, e) {
|
|
3362
|
+
return new lt({
|
|
2714
3363
|
check: "less_than",
|
|
2715
3364
|
...l(e),
|
|
2716
3365
|
value: t,
|
|
2717
3366
|
inclusive: !1
|
|
2718
3367
|
});
|
|
2719
3368
|
}
|
|
2720
|
-
function
|
|
2721
|
-
return new
|
|
3369
|
+
function ce(t, e) {
|
|
3370
|
+
return new lt({
|
|
2722
3371
|
check: "less_than",
|
|
2723
3372
|
...l(e),
|
|
2724
3373
|
value: t,
|
|
2725
3374
|
inclusive: !0
|
|
2726
3375
|
});
|
|
2727
3376
|
}
|
|
2728
|
-
function
|
|
2729
|
-
return new
|
|
3377
|
+
function De(t, e) {
|
|
3378
|
+
return new dt({
|
|
2730
3379
|
check: "greater_than",
|
|
2731
3380
|
...l(e),
|
|
2732
3381
|
value: t,
|
|
2733
3382
|
inclusive: !1
|
|
2734
3383
|
});
|
|
2735
3384
|
}
|
|
2736
|
-
function
|
|
2737
|
-
return new
|
|
3385
|
+
function ue(t, e) {
|
|
3386
|
+
return new dt({
|
|
2738
3387
|
check: "greater_than",
|
|
2739
3388
|
...l(e),
|
|
2740
3389
|
value: t,
|
|
2741
3390
|
inclusive: !0
|
|
2742
3391
|
});
|
|
2743
3392
|
}
|
|
2744
|
-
function
|
|
2745
|
-
return new
|
|
3393
|
+
function Fe(t, e) {
|
|
3394
|
+
return new Wn({
|
|
2746
3395
|
check: "multiple_of",
|
|
2747
3396
|
...l(e),
|
|
2748
3397
|
value: t
|
|
2749
3398
|
});
|
|
2750
3399
|
}
|
|
2751
|
-
function
|
|
2752
|
-
return new
|
|
3400
|
+
function kt(t, e) {
|
|
3401
|
+
return new Yn({
|
|
2753
3402
|
check: "max_length",
|
|
2754
3403
|
...l(e),
|
|
2755
3404
|
maximum: t
|
|
2756
3405
|
});
|
|
2757
3406
|
}
|
|
2758
|
-
function
|
|
2759
|
-
return new
|
|
3407
|
+
function Q(t, e) {
|
|
3408
|
+
return new Xn({
|
|
2760
3409
|
check: "min_length",
|
|
2761
3410
|
...l(e),
|
|
2762
3411
|
minimum: t
|
|
2763
3412
|
});
|
|
2764
3413
|
}
|
|
2765
|
-
function
|
|
2766
|
-
return new
|
|
3414
|
+
function yt(t, e) {
|
|
3415
|
+
return new qn({
|
|
2767
3416
|
check: "length_equals",
|
|
2768
3417
|
...l(e),
|
|
2769
3418
|
length: t
|
|
2770
3419
|
});
|
|
2771
3420
|
}
|
|
2772
|
-
function
|
|
2773
|
-
return new
|
|
3421
|
+
function Ni(t, e) {
|
|
3422
|
+
return new Qn({
|
|
2774
3423
|
check: "string_format",
|
|
2775
3424
|
format: "regex",
|
|
2776
3425
|
...l(e),
|
|
2777
3426
|
pattern: t
|
|
2778
3427
|
});
|
|
2779
3428
|
}
|
|
2780
|
-
function
|
|
2781
|
-
return new
|
|
3429
|
+
function Pi(t) {
|
|
3430
|
+
return new Hn({
|
|
2782
3431
|
check: "string_format",
|
|
2783
3432
|
format: "lowercase",
|
|
2784
3433
|
...l(t)
|
|
2785
3434
|
});
|
|
2786
3435
|
}
|
|
2787
|
-
function
|
|
2788
|
-
return new
|
|
3436
|
+
function Ai(t) {
|
|
3437
|
+
return new er({
|
|
2789
3438
|
check: "string_format",
|
|
2790
3439
|
format: "uppercase",
|
|
2791
3440
|
...l(t)
|
|
2792
3441
|
});
|
|
2793
3442
|
}
|
|
2794
|
-
function
|
|
2795
|
-
return new
|
|
3443
|
+
function Zi(t, e) {
|
|
3444
|
+
return new tr({
|
|
2796
3445
|
check: "string_format",
|
|
2797
3446
|
format: "includes",
|
|
2798
3447
|
...l(e),
|
|
2799
3448
|
includes: t
|
|
2800
3449
|
});
|
|
2801
3450
|
}
|
|
2802
|
-
function
|
|
2803
|
-
return new
|
|
3451
|
+
function Ci(t, e) {
|
|
3452
|
+
return new nr({
|
|
2804
3453
|
check: "string_format",
|
|
2805
3454
|
format: "starts_with",
|
|
2806
3455
|
...l(e),
|
|
2807
3456
|
prefix: t
|
|
2808
3457
|
});
|
|
2809
3458
|
}
|
|
2810
|
-
function
|
|
2811
|
-
return new
|
|
3459
|
+
function Ri(t, e) {
|
|
3460
|
+
return new rr({
|
|
2812
3461
|
check: "string_format",
|
|
2813
3462
|
format: "ends_with",
|
|
2814
3463
|
...l(e),
|
|
2815
3464
|
suffix: t
|
|
2816
3465
|
});
|
|
2817
3466
|
}
|
|
2818
|
-
function
|
|
2819
|
-
return new
|
|
3467
|
+
function U(t) {
|
|
3468
|
+
return new ir({
|
|
2820
3469
|
check: "overwrite",
|
|
2821
3470
|
tx: t
|
|
2822
3471
|
});
|
|
2823
3472
|
}
|
|
2824
|
-
function
|
|
2825
|
-
return
|
|
3473
|
+
function xi(t) {
|
|
3474
|
+
return U((e) => e.normalize(t));
|
|
2826
3475
|
}
|
|
2827
|
-
function
|
|
2828
|
-
return
|
|
3476
|
+
function Li() {
|
|
3477
|
+
return U((t) => t.trim());
|
|
2829
3478
|
}
|
|
2830
|
-
function
|
|
2831
|
-
return
|
|
3479
|
+
function Di() {
|
|
3480
|
+
return U((t) => t.toLowerCase());
|
|
2832
3481
|
}
|
|
2833
|
-
function
|
|
2834
|
-
return
|
|
3482
|
+
function Fi() {
|
|
3483
|
+
return U((t) => t.toUpperCase());
|
|
2835
3484
|
}
|
|
2836
|
-
function
|
|
2837
|
-
return
|
|
3485
|
+
function ji() {
|
|
3486
|
+
return U((t) => qt(t));
|
|
2838
3487
|
}
|
|
2839
|
-
function
|
|
3488
|
+
function Ui(t, e, n) {
|
|
2840
3489
|
return new t({
|
|
2841
3490
|
type: "array",
|
|
2842
3491
|
element: e,
|
|
@@ -2846,7 +3495,7 @@ function Pi(t, e, n) {
|
|
|
2846
3495
|
...l(n)
|
|
2847
3496
|
});
|
|
2848
3497
|
}
|
|
2849
|
-
function
|
|
3498
|
+
function Mi(t, e, n) {
|
|
2850
3499
|
return new t({
|
|
2851
3500
|
type: "custom",
|
|
2852
3501
|
check: "custom",
|
|
@@ -2854,29 +3503,29 @@ function Zi(t, e, n) {
|
|
|
2854
3503
|
...l(n)
|
|
2855
3504
|
});
|
|
2856
3505
|
}
|
|
2857
|
-
function
|
|
2858
|
-
const e =
|
|
3506
|
+
function Gi(t) {
|
|
3507
|
+
const e = Vi((n) => (n.addIssue = (r) => {
|
|
2859
3508
|
if (typeof r == "string")
|
|
2860
|
-
n.issues.push(
|
|
3509
|
+
n.issues.push(J(r, n.value, e._zod.def));
|
|
2861
3510
|
else {
|
|
2862
3511
|
const i = r;
|
|
2863
|
-
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = e), i.continue ?? (i.continue = !e._zod.def.abort), n.issues.push(
|
|
3512
|
+
i.fatal && (i.continue = !1), i.code ?? (i.code = "custom"), i.input ?? (i.input = n.value), i.inst ?? (i.inst = e), i.continue ?? (i.continue = !e._zod.def.abort), n.issues.push(J(i));
|
|
2864
3513
|
}
|
|
2865
3514
|
}, t(n.value, n)));
|
|
2866
3515
|
return e;
|
|
2867
3516
|
}
|
|
2868
|
-
function
|
|
3517
|
+
function Vi(t, e) {
|
|
2869
3518
|
const n = new b({
|
|
2870
3519
|
check: "custom",
|
|
2871
3520
|
...l(e)
|
|
2872
3521
|
});
|
|
2873
3522
|
return n._zod.check = t, n;
|
|
2874
3523
|
}
|
|
2875
|
-
function
|
|
3524
|
+
function Tt(t) {
|
|
2876
3525
|
let e = t?.target ?? "draft-2020-12";
|
|
2877
3526
|
return e === "draft-4" && (e = "draft-04"), e === "draft-7" && (e = "draft-07"), {
|
|
2878
3527
|
processors: t.processors ?? {},
|
|
2879
|
-
metadataRegistry: t?.metadata ??
|
|
3528
|
+
metadataRegistry: t?.metadata ?? G,
|
|
2880
3529
|
target: e,
|
|
2881
3530
|
unrepresentable: t?.unrepresentable ?? "throw",
|
|
2882
3531
|
override: t?.override ?? (() => {
|
|
@@ -2904,33 +3553,33 @@ function T(t, e, n = { path: [], schemaPath: [] }) {
|
|
|
2904
3553
|
...n,
|
|
2905
3554
|
schemaPath: [...n.schemaPath, t],
|
|
2906
3555
|
path: n.path
|
|
2907
|
-
},
|
|
2908
|
-
if (
|
|
2909
|
-
o.ref =
|
|
3556
|
+
}, d = t._zod.parent;
|
|
3557
|
+
if (d)
|
|
3558
|
+
o.ref = d, T(d, e, p), e.seen.get(d).isParent = !0;
|
|
2910
3559
|
else if (t._zod.processJSONSchema)
|
|
2911
3560
|
t._zod.processJSONSchema(e, o.schema, p);
|
|
2912
3561
|
else {
|
|
2913
|
-
const
|
|
3562
|
+
const f = o.schema, v = e.processors[i.type];
|
|
2914
3563
|
if (!v)
|
|
2915
3564
|
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);
|
|
2916
|
-
v(t, e,
|
|
3565
|
+
v(t, e, f, p);
|
|
2917
3566
|
}
|
|
2918
3567
|
}
|
|
2919
3568
|
const u = e.metadataRegistry.get(t);
|
|
2920
3569
|
return u && Object.assign(o.schema, u), e.io === "input" && w(t) && (delete o.schema.examples, delete o.schema.default), e.io === "input" && o.schema._prefault && ((r = o.schema).default ?? (r.default = o.schema._prefault)), delete o.schema._prefault, e.seen.get(t).schema;
|
|
2921
3570
|
}
|
|
2922
|
-
function
|
|
3571
|
+
function wt(t, e) {
|
|
2923
3572
|
const n = t.seen.get(e);
|
|
2924
3573
|
if (!n)
|
|
2925
3574
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2926
3575
|
const r = (s) => {
|
|
2927
3576
|
const o = t.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2928
3577
|
if (t.external) {
|
|
2929
|
-
const p = t.external.registry.get(s[0])?.id,
|
|
3578
|
+
const p = t.external.registry.get(s[0])?.id, d = t.external.uri ?? ((v) => v);
|
|
2930
3579
|
if (p)
|
|
2931
|
-
return { ref:
|
|
2932
|
-
const
|
|
2933
|
-
return s[1].defId =
|
|
3580
|
+
return { ref: d(p) };
|
|
3581
|
+
const f = s[1].defId ?? s[1].schema.id ?? `schema${t.counter++}`;
|
|
3582
|
+
return s[1].defId = f, { defId: f, ref: `${d("__shared")}#/${o}/${f}` };
|
|
2934
3583
|
}
|
|
2935
3584
|
if (s[1] === n)
|
|
2936
3585
|
return { ref: "#" };
|
|
@@ -2981,7 +3630,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
2981
3630
|
}
|
|
2982
3631
|
}
|
|
2983
3632
|
}
|
|
2984
|
-
function
|
|
3633
|
+
function bt(t, e) {
|
|
2985
3634
|
const n = t.seen.get(e);
|
|
2986
3635
|
if (!n)
|
|
2987
3636
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
@@ -2992,8 +3641,8 @@ function yt(t, e) {
|
|
|
2992
3641
|
const p = a.ref;
|
|
2993
3642
|
if (a.ref = null, p) {
|
|
2994
3643
|
r(p);
|
|
2995
|
-
const
|
|
2996
|
-
|
|
3644
|
+
const d = t.seen.get(p).schema;
|
|
3645
|
+
d.$ref && (t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0") ? (u.allOf = u.allOf ?? [], u.allOf.push(d)) : (Object.assign(u, d), Object.assign(u, h));
|
|
2997
3646
|
}
|
|
2998
3647
|
a.isParent || t.override({
|
|
2999
3648
|
zodSchema: o,
|
|
@@ -3023,8 +3672,8 @@ function yt(t, e) {
|
|
|
3023
3672
|
value: {
|
|
3024
3673
|
...e["~standard"],
|
|
3025
3674
|
jsonSchema: {
|
|
3026
|
-
input:
|
|
3027
|
-
output:
|
|
3675
|
+
input: H(e, "input"),
|
|
3676
|
+
output: H(e, "output")
|
|
3028
3677
|
}
|
|
3029
3678
|
},
|
|
3030
3679
|
enumerable: !1,
|
|
@@ -3076,42 +3725,42 @@ function w(t, e) {
|
|
|
3076
3725
|
}
|
|
3077
3726
|
return !1;
|
|
3078
3727
|
}
|
|
3079
|
-
const
|
|
3080
|
-
const r =
|
|
3081
|
-
return T(t, r),
|
|
3082
|
-
},
|
|
3083
|
-
const { libraryOptions: r, target: i } = n ?? {}, s =
|
|
3084
|
-
return T(t, s),
|
|
3085
|
-
},
|
|
3728
|
+
const Bi = (t, e = {}) => (n) => {
|
|
3729
|
+
const r = Tt({ ...n, processors: e });
|
|
3730
|
+
return T(t, r), wt(r, t), bt(r, t);
|
|
3731
|
+
}, H = (t, e) => (n) => {
|
|
3732
|
+
const { libraryOptions: r, target: i } = n ?? {}, s = Tt({ ...r ?? {}, target: i, io: e, processors: {} });
|
|
3733
|
+
return T(t, s), wt(s, t), bt(s, t);
|
|
3734
|
+
}, Ji = {
|
|
3086
3735
|
guid: "uuid",
|
|
3087
3736
|
url: "uri",
|
|
3088
3737
|
datetime: "date-time",
|
|
3089
3738
|
json_string: "json-string",
|
|
3090
3739
|
regex: ""
|
|
3091
3740
|
// do not set
|
|
3092
|
-
},
|
|
3741
|
+
}, Wi = (t, e, n, r) => {
|
|
3093
3742
|
const i = n;
|
|
3094
3743
|
i.type = "string";
|
|
3095
3744
|
const { minimum: s, maximum: o, format: a, patterns: u, contentEncoding: h } = t._zod.bag;
|
|
3096
|
-
if (typeof s == "number" && (i.minLength = s), typeof o == "number" && (i.maxLength = o), a && (i.format =
|
|
3745
|
+
if (typeof s == "number" && (i.minLength = s), typeof o == "number" && (i.maxLength = o), a && (i.format = Ji[a] ?? a, i.format === "" && delete i.format), h && (i.contentEncoding = h), u && u.size > 0) {
|
|
3097
3746
|
const p = [...u];
|
|
3098
3747
|
p.length === 1 ? i.pattern = p[0].source : p.length > 1 && (i.allOf = [
|
|
3099
|
-
...p.map((
|
|
3748
|
+
...p.map((d) => ({
|
|
3100
3749
|
...e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3101
|
-
pattern:
|
|
3750
|
+
pattern: d.source
|
|
3102
3751
|
}))
|
|
3103
3752
|
]);
|
|
3104
3753
|
}
|
|
3105
|
-
},
|
|
3754
|
+
}, Ki = (t, e, n, r) => {
|
|
3106
3755
|
const i = n, { minimum: s, maximum: o, format: a, multipleOf: u, exclusiveMaximum: h, exclusiveMinimum: p } = t._zod.bag;
|
|
3107
3756
|
typeof a == "string" && a.includes("int") ? i.type = "integer" : i.type = "number", typeof p == "number" && (e.target === "draft-04" || e.target === "openapi-3.0" ? (i.minimum = p, i.exclusiveMinimum = !0) : i.exclusiveMinimum = p), typeof s == "number" && (i.minimum = s, typeof p == "number" && e.target !== "draft-04" && (p >= s ? delete i.minimum : delete i.exclusiveMinimum)), typeof h == "number" && (e.target === "draft-04" || e.target === "openapi-3.0" ? (i.maximum = h, i.exclusiveMaximum = !0) : i.exclusiveMaximum = h), typeof o == "number" && (i.maximum = o, typeof h == "number" && e.target !== "draft-04" && (h <= o ? delete i.maximum : delete i.exclusiveMaximum)), typeof u == "number" && (i.multipleOf = u);
|
|
3108
|
-
},
|
|
3757
|
+
}, Yi = (t, e, n, r) => {
|
|
3109
3758
|
n.not = {};
|
|
3110
|
-
},
|
|
3111
|
-
},
|
|
3112
|
-
const i = t._zod.def, s =
|
|
3759
|
+
}, Xi = (t, e, n, r) => {
|
|
3760
|
+
}, qi = (t, e, n, r) => {
|
|
3761
|
+
const i = t._zod.def, s = tt(i.entries);
|
|
3113
3762
|
s.every((o) => typeof o == "number") && (n.type = "number"), s.every((o) => typeof o == "string") && (n.type = "string"), n.enum = s;
|
|
3114
|
-
},
|
|
3763
|
+
}, Qi = (t, e, n, r) => {
|
|
3115
3764
|
const i = t._zod.def, s = [];
|
|
3116
3765
|
for (const o of i.values)
|
|
3117
3766
|
if (o === void 0) {
|
|
@@ -3128,16 +3777,16 @@ const Ri = (t, e = {}) => (n) => {
|
|
|
3128
3777
|
n.type = o === null ? "null" : typeof o, e.target === "draft-04" || e.target === "openapi-3.0" ? n.enum = [o] : n.const = o;
|
|
3129
3778
|
} else
|
|
3130
3779
|
s.every((o) => typeof o == "number") && (n.type = "number"), s.every((o) => typeof o == "string") && (n.type = "string"), s.every((o) => typeof o == "boolean") && (n.type = "boolean"), s.every((o) => o === null) && (n.type = "null"), n.enum = s;
|
|
3131
|
-
},
|
|
3780
|
+
}, Hi = (t, e, n, r) => {
|
|
3132
3781
|
if (e.unrepresentable === "throw")
|
|
3133
3782
|
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3134
|
-
},
|
|
3783
|
+
}, es = (t, e, n, r) => {
|
|
3135
3784
|
if (e.unrepresentable === "throw")
|
|
3136
3785
|
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3137
|
-
},
|
|
3786
|
+
}, ts = (t, e, n, r) => {
|
|
3138
3787
|
const i = n, s = t._zod.def, { minimum: o, maximum: a } = t._zod.bag;
|
|
3139
3788
|
typeof o == "number" && (i.minItems = o), typeof a == "number" && (i.maxItems = a), i.type = "array", i.items = T(s.element, e, { ...r, path: [...r.path, "items"] });
|
|
3140
|
-
},
|
|
3789
|
+
}, ns = (t, e, n, r) => {
|
|
3141
3790
|
const i = n, s = t._zod.def;
|
|
3142
3791
|
i.type = "object", i.properties = {};
|
|
3143
3792
|
const o = s.shape;
|
|
@@ -3154,13 +3803,13 @@ const Ri = (t, e = {}) => (n) => {
|
|
|
3154
3803
|
...r,
|
|
3155
3804
|
path: [...r.path, "additionalProperties"]
|
|
3156
3805
|
})) : e.io === "output" && (i.additionalProperties = !1);
|
|
3157
|
-
},
|
|
3806
|
+
}, rs = (t, e, n, r) => {
|
|
3158
3807
|
const i = t._zod.def, s = i.inclusive === !1, o = i.options.map((a, u) => T(a, e, {
|
|
3159
3808
|
...r,
|
|
3160
3809
|
path: [...r.path, s ? "oneOf" : "anyOf", u]
|
|
3161
3810
|
}));
|
|
3162
3811
|
s ? n.oneOf = o : n.anyOf = o;
|
|
3163
|
-
},
|
|
3812
|
+
}, is = (t, e, n, r) => {
|
|
3164
3813
|
const i = t._zod.def, s = T(i.left, e, {
|
|
3165
3814
|
...r,
|
|
3166
3815
|
path: [...r.path, "allOf", 0]
|
|
@@ -3172,25 +3821,25 @@ const Ri = (t, e = {}) => (n) => {
|
|
|
3172
3821
|
...a(o) ? o.allOf : [o]
|
|
3173
3822
|
];
|
|
3174
3823
|
n.allOf = u;
|
|
3175
|
-
},
|
|
3824
|
+
}, ss = (t, e, n, r) => {
|
|
3176
3825
|
const i = t._zod.def, s = T(i.innerType, e, r), o = e.seen.get(t);
|
|
3177
3826
|
e.target === "openapi-3.0" ? (o.ref = i.innerType, n.nullable = !0) : n.anyOf = [s, { type: "null" }];
|
|
3178
|
-
},
|
|
3827
|
+
}, os = (t, e, n, r) => {
|
|
3179
3828
|
const i = t._zod.def;
|
|
3180
3829
|
T(i.innerType, e, r);
|
|
3181
3830
|
const s = e.seen.get(t);
|
|
3182
3831
|
s.ref = i.innerType;
|
|
3183
|
-
},
|
|
3832
|
+
}, as = (t, e, n, r) => {
|
|
3184
3833
|
const i = t._zod.def;
|
|
3185
3834
|
T(i.innerType, e, r);
|
|
3186
3835
|
const s = e.seen.get(t);
|
|
3187
3836
|
s.ref = i.innerType, n.default = JSON.parse(JSON.stringify(i.defaultValue));
|
|
3188
|
-
},
|
|
3837
|
+
}, cs = (t, e, n, r) => {
|
|
3189
3838
|
const i = t._zod.def;
|
|
3190
3839
|
T(i.innerType, e, r);
|
|
3191
3840
|
const s = e.seen.get(t);
|
|
3192
3841
|
s.ref = i.innerType, e.io === "input" && (n._prefault = JSON.parse(JSON.stringify(i.defaultValue)));
|
|
3193
|
-
},
|
|
3842
|
+
}, us = (t, e, n, r) => {
|
|
3194
3843
|
const i = t._zod.def;
|
|
3195
3844
|
T(i.innerType, e, r);
|
|
3196
3845
|
const s = e.seen.get(t);
|
|
@@ -3202,53 +3851,53 @@ const Ri = (t, e = {}) => (n) => {
|
|
|
3202
3851
|
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3203
3852
|
}
|
|
3204
3853
|
n.default = o;
|
|
3205
|
-
},
|
|
3854
|
+
}, hs = (t, e, n, r) => {
|
|
3206
3855
|
const i = t._zod.def, s = e.io === "input" ? i.in._zod.def.type === "transform" ? i.out : i.in : i.out;
|
|
3207
3856
|
T(s, e, r);
|
|
3208
3857
|
const o = e.seen.get(t);
|
|
3209
3858
|
o.ref = s;
|
|
3210
|
-
},
|
|
3859
|
+
}, ps = (t, e, n, r) => {
|
|
3211
3860
|
const i = t._zod.def;
|
|
3212
3861
|
T(i.innerType, e, r);
|
|
3213
3862
|
const s = e.seen.get(t);
|
|
3214
3863
|
s.ref = i.innerType, n.readOnly = !0;
|
|
3215
|
-
},
|
|
3864
|
+
}, ls = (t, e, n, r) => {
|
|
3216
3865
|
const i = t._zod.def;
|
|
3217
3866
|
T(i.innerType, e, r);
|
|
3218
3867
|
const s = e.seen.get(t);
|
|
3219
3868
|
s.ref = i.innerType;
|
|
3220
|
-
},
|
|
3221
|
-
|
|
3869
|
+
}, ds = /* @__PURE__ */ c("ZodISODateTime", (t, e) => {
|
|
3870
|
+
_r.init(t, e), _.init(t, e);
|
|
3222
3871
|
});
|
|
3223
|
-
function
|
|
3224
|
-
return
|
|
3872
|
+
function fs(t) {
|
|
3873
|
+
return wi(ds, t);
|
|
3225
3874
|
}
|
|
3226
|
-
const
|
|
3227
|
-
|
|
3875
|
+
const ms = /* @__PURE__ */ c("ZodISODate", (t, e) => {
|
|
3876
|
+
kr.init(t, e), _.init(t, e);
|
|
3228
3877
|
});
|
|
3229
|
-
function
|
|
3230
|
-
return
|
|
3878
|
+
function gs(t) {
|
|
3879
|
+
return bi(ms, t);
|
|
3231
3880
|
}
|
|
3232
|
-
const
|
|
3233
|
-
|
|
3881
|
+
const vs = /* @__PURE__ */ c("ZodISOTime", (t, e) => {
|
|
3882
|
+
yr.init(t, e), _.init(t, e);
|
|
3234
3883
|
});
|
|
3235
|
-
function
|
|
3236
|
-
return
|
|
3884
|
+
function _s(t) {
|
|
3885
|
+
return Ei(vs, t);
|
|
3237
3886
|
}
|
|
3238
|
-
const
|
|
3239
|
-
|
|
3887
|
+
const ks = /* @__PURE__ */ c("ZodISODuration", (t, e) => {
|
|
3888
|
+
Tr.init(t, e), _.init(t, e);
|
|
3240
3889
|
});
|
|
3241
|
-
function
|
|
3242
|
-
return
|
|
3890
|
+
function ys(t) {
|
|
3891
|
+
return zi(ks, t);
|
|
3243
3892
|
}
|
|
3244
|
-
const
|
|
3245
|
-
|
|
3893
|
+
const Ts = (t, e) => {
|
|
3894
|
+
ot.init(t, e), t.name = "ZodError", Object.defineProperties(t, {
|
|
3246
3895
|
format: {
|
|
3247
|
-
value: (n) =>
|
|
3896
|
+
value: (n) => pn(t, n)
|
|
3248
3897
|
// enumerable: false,
|
|
3249
3898
|
},
|
|
3250
3899
|
flatten: {
|
|
3251
|
-
value: (n) =>
|
|
3900
|
+
value: (n) => hn(t, n)
|
|
3252
3901
|
// enumerable: false,
|
|
3253
3902
|
},
|
|
3254
3903
|
addIssue: {
|
|
@@ -3270,115 +3919,115 @@ const hs = (t, e) => {
|
|
|
3270
3919
|
// enumerable: false,
|
|
3271
3920
|
}
|
|
3272
3921
|
});
|
|
3273
|
-
},
|
|
3922
|
+
}, z = c("ZodError", Ts, {
|
|
3274
3923
|
Parent: Error
|
|
3275
|
-
}),
|
|
3924
|
+
}), ws = /* @__PURE__ */ ve(z), bs = /* @__PURE__ */ _e(z), Es = /* @__PURE__ */ ne(z), zs = /* @__PURE__ */ re(z), Is = /* @__PURE__ */ fn(z), $s = /* @__PURE__ */ mn(z), Os = /* @__PURE__ */ gn(z), Ss = /* @__PURE__ */ vn(z), Ns = /* @__PURE__ */ _n(z), Ps = /* @__PURE__ */ kn(z), As = /* @__PURE__ */ yn(z), Zs = /* @__PURE__ */ Tn(z), y = /* @__PURE__ */ c("ZodType", (t, e) => (k.init(t, e), Object.assign(t["~standard"], {
|
|
3276
3925
|
jsonSchema: {
|
|
3277
|
-
input:
|
|
3278
|
-
output:
|
|
3926
|
+
input: H(t, "input"),
|
|
3927
|
+
output: H(t, "output")
|
|
3279
3928
|
}
|
|
3280
|
-
}), t.toJSONSchema =
|
|
3929
|
+
}), t.toJSONSchema = Bi(t, {}), t.def = e, t.type = e.type, Object.defineProperty(t, "_def", { value: e }), t.check = (...n) => t.clone(x(e, {
|
|
3281
3930
|
checks: [
|
|
3282
3931
|
...e.checks ?? [],
|
|
3283
3932
|
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
3284
3933
|
]
|
|
3285
|
-
})), t.clone = (n, r) =>
|
|
3934
|
+
})), t.clone = (n, r) => P(t, n, r), t.brand = () => t, t.register = ((n, r) => (n.add(t, r), t)), t.parse = (n, r) => ws(t, n, r, { callee: t.parse }), t.safeParse = (n, r) => Es(t, n, r), t.parseAsync = async (n, r) => bs(t, n, r, { callee: t.parseAsync }), t.safeParseAsync = async (n, r) => zs(t, n, r), t.spa = t.safeParseAsync, t.encode = (n, r) => Is(t, n, r), t.decode = (n, r) => $s(t, n, r), t.encodeAsync = async (n, r) => Os(t, n, r), t.decodeAsync = async (n, r) => Ss(t, n, r), t.safeEncode = (n, r) => Ns(t, n, r), t.safeDecode = (n, r) => Ps(t, n, r), t.safeEncodeAsync = async (n, r) => As(t, n, r), t.safeDecodeAsync = async (n, r) => Zs(t, n, r), t.refine = (n, r) => t.check(zo(n, r)), t.superRefine = (n) => t.check(Io(n)), t.overwrite = (n) => t.check(U(n)), t.optional = () => Ge(t), t.nullable = () => Ve(t), t.nullish = () => Ge(Ve(t)), t.nonoptional = (n) => _o(t, n), t.array = () => A(t), t.or = (n) => ye([t, n]), t.and = (n) => co(t, n), t.transform = (n) => Be(t, po(n)), t.default = (n) => mo(t, n), t.prefault = (n) => vo(t, n), t.catch = (n) => yo(t, n), t.pipe = (n) => Be(t, n), t.readonly = () => bo(t), t.describe = (n) => {
|
|
3286
3935
|
const r = t.clone();
|
|
3287
|
-
return
|
|
3936
|
+
return G.add(r, { description: n }), r;
|
|
3288
3937
|
}, Object.defineProperty(t, "description", {
|
|
3289
3938
|
get() {
|
|
3290
|
-
return
|
|
3939
|
+
return G.get(t)?.description;
|
|
3291
3940
|
},
|
|
3292
3941
|
configurable: !0
|
|
3293
3942
|
}), t.meta = (...n) => {
|
|
3294
3943
|
if (n.length === 0)
|
|
3295
|
-
return
|
|
3944
|
+
return G.get(t);
|
|
3296
3945
|
const r = t.clone();
|
|
3297
|
-
return
|
|
3298
|
-
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)),
|
|
3299
|
-
|
|
3946
|
+
return G.add(r, n[0]), r;
|
|
3947
|
+
}, t.isOptional = () => t.safeParse(void 0).success, t.isNullable = () => t.safeParse(null).success, t)), Et = /* @__PURE__ */ c("_ZodString", (t, e) => {
|
|
3948
|
+
ke.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, i, s) => Wi(t, r, i);
|
|
3300
3949
|
const n = t._zod.bag;
|
|
3301
|
-
t.format = n.format ?? null, t.minLength = n.minimum ?? null, t.maxLength = n.maximum ?? null, t.regex = (...r) => t.check(
|
|
3302
|
-
}),
|
|
3303
|
-
|
|
3950
|
+
t.format = n.format ?? null, t.minLength = n.minimum ?? null, t.maxLength = n.maximum ?? null, t.regex = (...r) => t.check(Ni(...r)), t.includes = (...r) => t.check(Zi(...r)), t.startsWith = (...r) => t.check(Ci(...r)), t.endsWith = (...r) => t.check(Ri(...r)), t.min = (...r) => t.check(Q(...r)), t.max = (...r) => t.check(kt(...r)), t.length = (...r) => t.check(yt(...r)), t.nonempty = (...r) => t.check(Q(1, ...r)), t.lowercase = (r) => t.check(Pi(r)), t.uppercase = (r) => t.check(Ai(r)), t.trim = () => t.check(Li()), t.normalize = (...r) => t.check(xi(...r)), t.toLowerCase = () => t.check(Di()), t.toUpperCase = () => t.check(Fi()), t.slugify = () => t.check(ji());
|
|
3951
|
+
}), Cs = /* @__PURE__ */ c("ZodString", (t, e) => {
|
|
3952
|
+
ke.init(t, e), Et.init(t, e), t.email = (n) => t.check(ti(Rs, n)), t.url = (n) => t.check(oi(xs, n)), t.jwt = (n) => t.check(Ti(qs, n)), t.emoji = (n) => t.check(ai(Ls, n)), t.guid = (n) => t.check(xe(je, n)), t.uuid = (n) => t.check(ni(Y, n)), t.uuidv4 = (n) => t.check(ri(Y, n)), t.uuidv6 = (n) => t.check(ii(Y, n)), t.uuidv7 = (n) => t.check(si(Y, n)), t.nanoid = (n) => t.check(ci(Ds, n)), t.guid = (n) => t.check(xe(je, n)), t.cuid = (n) => t.check(ui(Fs, n)), t.cuid2 = (n) => t.check(hi(js, n)), t.ulid = (n) => t.check(pi(Us, n)), t.base64 = (n) => t.check(_i(Ks, n)), t.base64url = (n) => t.check(ki(Ys, n)), t.xid = (n) => t.check(li(Ms, n)), t.ksuid = (n) => t.check(di(Gs, n)), t.ipv4 = (n) => t.check(fi(Vs, n)), t.ipv6 = (n) => t.check(mi(Bs, n)), t.cidrv4 = (n) => t.check(gi(Js, n)), t.cidrv6 = (n) => t.check(vi(Ws, n)), t.e164 = (n) => t.check(yi(Xs, n)), t.datetime = (n) => t.check(fs(n)), t.date = (n) => t.check(gs(n)), t.time = (n) => t.check(_s(n)), t.duration = (n) => t.check(ys(n));
|
|
3304
3953
|
});
|
|
3305
|
-
function
|
|
3306
|
-
return
|
|
3954
|
+
function $(t) {
|
|
3955
|
+
return ei(Cs, t);
|
|
3307
3956
|
}
|
|
3308
3957
|
const _ = /* @__PURE__ */ c("ZodStringFormat", (t, e) => {
|
|
3309
|
-
g.init(t, e),
|
|
3310
|
-
}),
|
|
3311
|
-
|
|
3312
|
-
}),
|
|
3313
|
-
|
|
3314
|
-
}),
|
|
3315
|
-
|
|
3316
|
-
}),
|
|
3317
|
-
|
|
3318
|
-
}),
|
|
3319
|
-
er.init(t, e), _.init(t, e);
|
|
3320
|
-
}), Is = /* @__PURE__ */ c("ZodNanoID", (t, e) => {
|
|
3321
|
-
tr.init(t, e), _.init(t, e);
|
|
3322
|
-
}), Os = /* @__PURE__ */ c("ZodCUID", (t, e) => {
|
|
3323
|
-
nr.init(t, e), _.init(t, e);
|
|
3324
|
-
}), Ss = /* @__PURE__ */ c("ZodCUID2", (t, e) => {
|
|
3325
|
-
rr.init(t, e), _.init(t, e);
|
|
3326
|
-
}), Ps = /* @__PURE__ */ c("ZodULID", (t, e) => {
|
|
3327
|
-
ir.init(t, e), _.init(t, e);
|
|
3328
|
-
}), Zs = /* @__PURE__ */ c("ZodXID", (t, e) => {
|
|
3329
|
-
sr.init(t, e), _.init(t, e);
|
|
3330
|
-
}), Ns = /* @__PURE__ */ c("ZodKSUID", (t, e) => {
|
|
3331
|
-
or.init(t, e), _.init(t, e);
|
|
3332
|
-
}), As = /* @__PURE__ */ c("ZodIPv4", (t, e) => {
|
|
3958
|
+
g.init(t, e), Et.init(t, e);
|
|
3959
|
+
}), Rs = /* @__PURE__ */ c("ZodEmail", (t, e) => {
|
|
3960
|
+
ur.init(t, e), _.init(t, e);
|
|
3961
|
+
}), je = /* @__PURE__ */ c("ZodGUID", (t, e) => {
|
|
3962
|
+
ar.init(t, e), _.init(t, e);
|
|
3963
|
+
}), Y = /* @__PURE__ */ c("ZodUUID", (t, e) => {
|
|
3964
|
+
cr.init(t, e), _.init(t, e);
|
|
3965
|
+
}), xs = /* @__PURE__ */ c("ZodURL", (t, e) => {
|
|
3966
|
+
hr.init(t, e), _.init(t, e);
|
|
3967
|
+
}), Ls = /* @__PURE__ */ c("ZodEmoji", (t, e) => {
|
|
3333
3968
|
pr.init(t, e), _.init(t, e);
|
|
3334
|
-
}),
|
|
3969
|
+
}), Ds = /* @__PURE__ */ c("ZodNanoID", (t, e) => {
|
|
3335
3970
|
lr.init(t, e), _.init(t, e);
|
|
3336
|
-
}),
|
|
3337
|
-
fr.init(t, e), _.init(t, e);
|
|
3338
|
-
}), xs = /* @__PURE__ */ c("ZodCIDRv6", (t, e) => {
|
|
3971
|
+
}), Fs = /* @__PURE__ */ c("ZodCUID", (t, e) => {
|
|
3339
3972
|
dr.init(t, e), _.init(t, e);
|
|
3340
|
-
}),
|
|
3973
|
+
}), js = /* @__PURE__ */ c("ZodCUID2", (t, e) => {
|
|
3974
|
+
fr.init(t, e), _.init(t, e);
|
|
3975
|
+
}), Us = /* @__PURE__ */ c("ZodULID", (t, e) => {
|
|
3341
3976
|
mr.init(t, e), _.init(t, e);
|
|
3342
|
-
}),
|
|
3977
|
+
}), Ms = /* @__PURE__ */ c("ZodXID", (t, e) => {
|
|
3978
|
+
gr.init(t, e), _.init(t, e);
|
|
3979
|
+
}), Gs = /* @__PURE__ */ c("ZodKSUID", (t, e) => {
|
|
3343
3980
|
vr.init(t, e), _.init(t, e);
|
|
3344
|
-
}),
|
|
3345
|
-
|
|
3346
|
-
}),
|
|
3347
|
-
|
|
3348
|
-
}),
|
|
3349
|
-
|
|
3981
|
+
}), Vs = /* @__PURE__ */ c("ZodIPv4", (t, e) => {
|
|
3982
|
+
wr.init(t, e), _.init(t, e);
|
|
3983
|
+
}), Bs = /* @__PURE__ */ c("ZodIPv6", (t, e) => {
|
|
3984
|
+
br.init(t, e), _.init(t, e);
|
|
3985
|
+
}), Js = /* @__PURE__ */ c("ZodCIDRv4", (t, e) => {
|
|
3986
|
+
Er.init(t, e), _.init(t, e);
|
|
3987
|
+
}), Ws = /* @__PURE__ */ c("ZodCIDRv6", (t, e) => {
|
|
3988
|
+
zr.init(t, e), _.init(t, e);
|
|
3989
|
+
}), Ks = /* @__PURE__ */ c("ZodBase64", (t, e) => {
|
|
3990
|
+
Ir.init(t, e), _.init(t, e);
|
|
3991
|
+
}), Ys = /* @__PURE__ */ c("ZodBase64URL", (t, e) => {
|
|
3992
|
+
Or.init(t, e), _.init(t, e);
|
|
3993
|
+
}), Xs = /* @__PURE__ */ c("ZodE164", (t, e) => {
|
|
3994
|
+
Sr.init(t, e), _.init(t, e);
|
|
3995
|
+
}), qs = /* @__PURE__ */ c("ZodJWT", (t, e) => {
|
|
3996
|
+
Pr.init(t, e), _.init(t, e);
|
|
3997
|
+
}), zt = /* @__PURE__ */ c("ZodNumber", (t, e) => {
|
|
3998
|
+
mt.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, i, s) => Ki(t, r, i), t.gt = (r, i) => t.check(De(r, i)), t.gte = (r, i) => t.check(ue(r, i)), t.min = (r, i) => t.check(ue(r, i)), t.lt = (r, i) => t.check(Le(r, i)), t.lte = (r, i) => t.check(ce(r, i)), t.max = (r, i) => t.check(ce(r, i)), t.int = (r) => t.check(Ue(r)), t.safe = (r) => t.check(Ue(r)), t.positive = (r) => t.check(De(0, r)), t.nonnegative = (r) => t.check(ue(0, r)), t.negative = (r) => t.check(Le(0, r)), t.nonpositive = (r) => t.check(ce(0, r)), t.multipleOf = (r, i) => t.check(Fe(r, i)), t.step = (r, i) => t.check(Fe(r, i)), t.finite = () => t;
|
|
3350
3999
|
const n = t._zod.bag;
|
|
3351
4000
|
t.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, t.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, t.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), t.isFinite = !0, t.format = n.format ?? null;
|
|
3352
4001
|
});
|
|
3353
|
-
function
|
|
3354
|
-
return
|
|
4002
|
+
function Qs(t) {
|
|
4003
|
+
return Ii(zt, t);
|
|
3355
4004
|
}
|
|
3356
|
-
const
|
|
3357
|
-
|
|
4005
|
+
const Hs = /* @__PURE__ */ c("ZodNumberFormat", (t, e) => {
|
|
4006
|
+
Ar.init(t, e), zt.init(t, e);
|
|
3358
4007
|
});
|
|
3359
|
-
function
|
|
3360
|
-
return
|
|
4008
|
+
function Ue(t) {
|
|
4009
|
+
return $i(Hs, t);
|
|
3361
4010
|
}
|
|
3362
|
-
const
|
|
3363
|
-
|
|
4011
|
+
const eo = /* @__PURE__ */ c("ZodUnknown", (t, e) => {
|
|
4012
|
+
Zr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => Xi();
|
|
3364
4013
|
});
|
|
3365
|
-
function
|
|
3366
|
-
return
|
|
4014
|
+
function Me() {
|
|
4015
|
+
return Oi(eo);
|
|
3367
4016
|
}
|
|
3368
|
-
const
|
|
3369
|
-
|
|
4017
|
+
const to = /* @__PURE__ */ c("ZodNever", (t, e) => {
|
|
4018
|
+
Cr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => Yi(t, n, r);
|
|
3370
4019
|
});
|
|
3371
|
-
function
|
|
3372
|
-
return
|
|
4020
|
+
function no(t) {
|
|
4021
|
+
return Si(to, t);
|
|
3373
4022
|
}
|
|
3374
|
-
const
|
|
3375
|
-
|
|
4023
|
+
const ro = /* @__PURE__ */ c("ZodArray", (t, e) => {
|
|
4024
|
+
Rr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => ts(t, n, r, i), t.element = e.element, t.min = (n, r) => t.check(Q(n, r)), t.nonempty = (n) => t.check(Q(1, n)), t.max = (n, r) => t.check(kt(n, r)), t.length = (n, r) => t.check(yt(n, r)), t.unwrap = () => t.element;
|
|
3376
4025
|
});
|
|
3377
|
-
function
|
|
3378
|
-
return
|
|
4026
|
+
function A(t, e) {
|
|
4027
|
+
return Ui(ro, t, e);
|
|
3379
4028
|
}
|
|
3380
|
-
const
|
|
3381
|
-
|
|
4029
|
+
const io = /* @__PURE__ */ c("ZodObject", (t, e) => {
|
|
4030
|
+
Lr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => ns(t, n, r, i), m(t, "shape", () => e.shape), t.keyof = () => Te(Object.keys(t._zod.def.shape)), t.catchall = (n) => t.clone({ ...t._zod.def, catchall: n }), t.passthrough = () => t.clone({ ...t._zod.def, catchall: Me() }), t.loose = () => t.clone({ ...t._zod.def, catchall: Me() }), t.strict = () => t.clone({ ...t._zod.def, catchall: no() }), t.strip = () => t.clone({ ...t._zod.def, catchall: void 0 }), t.extend = (n) => sn(t, n), t.safeExtend = (n) => on(t, n), t.merge = (n) => an(t, n), t.pick = (n) => nn(t, n), t.omit = (n) => rn(t, n), t.partial = (...n) => cn($t, t, n[0]), t.required = (...n) => un(Ot, t, n[0]);
|
|
3382
4031
|
});
|
|
3383
4032
|
function S(t, e) {
|
|
3384
4033
|
const n = {
|
|
@@ -3386,41 +4035,41 @@ function S(t, e) {
|
|
|
3386
4035
|
shape: t ?? {},
|
|
3387
4036
|
...l(e)
|
|
3388
4037
|
};
|
|
3389
|
-
return new
|
|
4038
|
+
return new io(n);
|
|
3390
4039
|
}
|
|
3391
|
-
const
|
|
3392
|
-
|
|
4040
|
+
const It = /* @__PURE__ */ c("ZodUnion", (t, e) => {
|
|
4041
|
+
_t.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => rs(t, n, r, i), t.options = e.options;
|
|
3393
4042
|
});
|
|
3394
|
-
function
|
|
3395
|
-
return new
|
|
4043
|
+
function ye(t, e) {
|
|
4044
|
+
return new It({
|
|
3396
4045
|
type: "union",
|
|
3397
4046
|
options: t,
|
|
3398
4047
|
...l(e)
|
|
3399
4048
|
});
|
|
3400
4049
|
}
|
|
3401
|
-
const
|
|
3402
|
-
|
|
4050
|
+
const so = /* @__PURE__ */ c("ZodDiscriminatedUnion", (t, e) => {
|
|
4051
|
+
It.init(t, e), Dr.init(t, e);
|
|
3403
4052
|
});
|
|
3404
|
-
function
|
|
3405
|
-
return new
|
|
4053
|
+
function oo(t, e, n) {
|
|
4054
|
+
return new so({
|
|
3406
4055
|
type: "union",
|
|
3407
4056
|
options: e,
|
|
3408
4057
|
discriminator: t,
|
|
3409
4058
|
...l(n)
|
|
3410
4059
|
});
|
|
3411
4060
|
}
|
|
3412
|
-
const
|
|
3413
|
-
|
|
4061
|
+
const ao = /* @__PURE__ */ c("ZodIntersection", (t, e) => {
|
|
4062
|
+
Fr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => is(t, n, r, i);
|
|
3414
4063
|
});
|
|
3415
|
-
function
|
|
3416
|
-
return new
|
|
4064
|
+
function co(t, e) {
|
|
4065
|
+
return new ao({
|
|
3417
4066
|
type: "intersection",
|
|
3418
4067
|
left: t,
|
|
3419
4068
|
right: e
|
|
3420
4069
|
});
|
|
3421
4070
|
}
|
|
3422
4071
|
const le = /* @__PURE__ */ c("ZodEnum", (t, e) => {
|
|
3423
|
-
|
|
4072
|
+
jr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (r, i, s) => qi(t, r, i), t.enum = e.entries, t.options = Object.values(e.entries);
|
|
3424
4073
|
const n = new Set(Object.keys(e.entries));
|
|
3425
4074
|
t.extract = (r, i) => {
|
|
3426
4075
|
const s = {};
|
|
@@ -3450,7 +4099,7 @@ const le = /* @__PURE__ */ c("ZodEnum", (t, e) => {
|
|
|
3450
4099
|
});
|
|
3451
4100
|
};
|
|
3452
4101
|
});
|
|
3453
|
-
function
|
|
4102
|
+
function Te(t, e) {
|
|
3454
4103
|
const n = Array.isArray(t) ? Object.fromEntries(t.map((r) => [r, r])) : t;
|
|
3455
4104
|
return new le({
|
|
3456
4105
|
type: "enum",
|
|
@@ -3458,8 +4107,8 @@ function ye(t, e) {
|
|
|
3458
4107
|
...l(e)
|
|
3459
4108
|
});
|
|
3460
4109
|
}
|
|
3461
|
-
const
|
|
3462
|
-
|
|
4110
|
+
const uo = /* @__PURE__ */ c("ZodLiteral", (t, e) => {
|
|
4111
|
+
Ur.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => Qi(t, n, r), t.values = new Set(e.values), Object.defineProperty(t, "value", {
|
|
3463
4112
|
get() {
|
|
3464
4113
|
if (e.values.length > 1)
|
|
3465
4114
|
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
@@ -3467,179 +4116,179 @@ const Hs = /* @__PURE__ */ c("ZodLiteral", (t, e) => {
|
|
|
3467
4116
|
}
|
|
3468
4117
|
});
|
|
3469
4118
|
});
|
|
3470
|
-
function
|
|
3471
|
-
return new
|
|
4119
|
+
function se(t, e) {
|
|
4120
|
+
return new uo({
|
|
3472
4121
|
type: "literal",
|
|
3473
4122
|
values: Array.isArray(t) ? t : [t],
|
|
3474
4123
|
...l(e)
|
|
3475
4124
|
});
|
|
3476
4125
|
}
|
|
3477
|
-
const
|
|
3478
|
-
|
|
4126
|
+
const ho = /* @__PURE__ */ c("ZodTransform", (t, e) => {
|
|
4127
|
+
Mr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => es(t, n), t._zod.parse = (n, r) => {
|
|
3479
4128
|
if (r.direction === "backward")
|
|
3480
|
-
throw new
|
|
4129
|
+
throw new He(t.constructor.name);
|
|
3481
4130
|
n.addIssue = (s) => {
|
|
3482
4131
|
if (typeof s == "string")
|
|
3483
|
-
n.issues.push(
|
|
4132
|
+
n.issues.push(J(s, n.value, e));
|
|
3484
4133
|
else {
|
|
3485
4134
|
const o = s;
|
|
3486
|
-
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), n.issues.push(
|
|
4135
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), n.issues.push(J(o));
|
|
3487
4136
|
}
|
|
3488
4137
|
};
|
|
3489
4138
|
const i = e.transform(n.value, n);
|
|
3490
4139
|
return i instanceof Promise ? i.then((s) => (n.value = s, n)) : (n.value = i, n);
|
|
3491
4140
|
};
|
|
3492
4141
|
});
|
|
3493
|
-
function
|
|
3494
|
-
return new
|
|
4142
|
+
function po(t) {
|
|
4143
|
+
return new ho({
|
|
3495
4144
|
type: "transform",
|
|
3496
4145
|
transform: t
|
|
3497
4146
|
});
|
|
3498
4147
|
}
|
|
3499
|
-
const
|
|
3500
|
-
|
|
4148
|
+
const $t = /* @__PURE__ */ c("ZodOptional", (t, e) => {
|
|
4149
|
+
Gr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => ls(t, n, r, i), t.unwrap = () => t._zod.def.innerType;
|
|
3501
4150
|
});
|
|
3502
|
-
function
|
|
3503
|
-
return new
|
|
4151
|
+
function Ge(t) {
|
|
4152
|
+
return new $t({
|
|
3504
4153
|
type: "optional",
|
|
3505
4154
|
innerType: t
|
|
3506
4155
|
});
|
|
3507
4156
|
}
|
|
3508
|
-
const
|
|
3509
|
-
|
|
4157
|
+
const lo = /* @__PURE__ */ c("ZodNullable", (t, e) => {
|
|
4158
|
+
Vr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => ss(t, n, r, i), t.unwrap = () => t._zod.def.innerType;
|
|
3510
4159
|
});
|
|
3511
|
-
function
|
|
3512
|
-
return new
|
|
4160
|
+
function Ve(t) {
|
|
4161
|
+
return new lo({
|
|
3513
4162
|
type: "nullable",
|
|
3514
4163
|
innerType: t
|
|
3515
4164
|
});
|
|
3516
4165
|
}
|
|
3517
|
-
const
|
|
3518
|
-
|
|
4166
|
+
const fo = /* @__PURE__ */ c("ZodDefault", (t, e) => {
|
|
4167
|
+
Br.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => as(t, n, r, i), t.unwrap = () => t._zod.def.innerType, t.removeDefault = t.unwrap;
|
|
3519
4168
|
});
|
|
3520
|
-
function
|
|
3521
|
-
return new
|
|
4169
|
+
function mo(t, e) {
|
|
4170
|
+
return new fo({
|
|
3522
4171
|
type: "default",
|
|
3523
4172
|
innerType: t,
|
|
3524
4173
|
get defaultValue() {
|
|
3525
|
-
return typeof e == "function" ? e() :
|
|
4174
|
+
return typeof e == "function" ? e() : rt(e);
|
|
3526
4175
|
}
|
|
3527
4176
|
});
|
|
3528
4177
|
}
|
|
3529
|
-
const
|
|
3530
|
-
|
|
4178
|
+
const go = /* @__PURE__ */ c("ZodPrefault", (t, e) => {
|
|
4179
|
+
Jr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => cs(t, n, r, i), t.unwrap = () => t._zod.def.innerType;
|
|
3531
4180
|
});
|
|
3532
|
-
function
|
|
3533
|
-
return new
|
|
4181
|
+
function vo(t, e) {
|
|
4182
|
+
return new go({
|
|
3534
4183
|
type: "prefault",
|
|
3535
4184
|
innerType: t,
|
|
3536
4185
|
get defaultValue() {
|
|
3537
|
-
return typeof e == "function" ? e() :
|
|
4186
|
+
return typeof e == "function" ? e() : rt(e);
|
|
3538
4187
|
}
|
|
3539
4188
|
});
|
|
3540
4189
|
}
|
|
3541
|
-
const
|
|
3542
|
-
|
|
4190
|
+
const Ot = /* @__PURE__ */ c("ZodNonOptional", (t, e) => {
|
|
4191
|
+
Wr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => os(t, n, r, i), t.unwrap = () => t._zod.def.innerType;
|
|
3543
4192
|
});
|
|
3544
|
-
function
|
|
3545
|
-
return new
|
|
4193
|
+
function _o(t, e) {
|
|
4194
|
+
return new Ot({
|
|
3546
4195
|
type: "nonoptional",
|
|
3547
4196
|
innerType: t,
|
|
3548
4197
|
...l(e)
|
|
3549
4198
|
});
|
|
3550
4199
|
}
|
|
3551
|
-
const
|
|
3552
|
-
|
|
4200
|
+
const ko = /* @__PURE__ */ c("ZodCatch", (t, e) => {
|
|
4201
|
+
Kr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => us(t, n, r, i), t.unwrap = () => t._zod.def.innerType, t.removeCatch = t.unwrap;
|
|
3553
4202
|
});
|
|
3554
|
-
function
|
|
3555
|
-
return new
|
|
4203
|
+
function yo(t, e) {
|
|
4204
|
+
return new ko({
|
|
3556
4205
|
type: "catch",
|
|
3557
4206
|
innerType: t,
|
|
3558
4207
|
catchValue: typeof e == "function" ? e : () => e
|
|
3559
4208
|
});
|
|
3560
4209
|
}
|
|
3561
|
-
const
|
|
3562
|
-
|
|
4210
|
+
const To = /* @__PURE__ */ c("ZodPipe", (t, e) => {
|
|
4211
|
+
Yr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => hs(t, n, r, i), t.in = e.in, t.out = e.out;
|
|
3563
4212
|
});
|
|
3564
|
-
function
|
|
3565
|
-
return new
|
|
4213
|
+
function Be(t, e) {
|
|
4214
|
+
return new To({
|
|
3566
4215
|
type: "pipe",
|
|
3567
4216
|
in: t,
|
|
3568
4217
|
out: e
|
|
3569
4218
|
// ...util.normalizeParams(params),
|
|
3570
4219
|
});
|
|
3571
4220
|
}
|
|
3572
|
-
const
|
|
3573
|
-
|
|
4221
|
+
const wo = /* @__PURE__ */ c("ZodReadonly", (t, e) => {
|
|
4222
|
+
Xr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => ps(t, n, r, i), t.unwrap = () => t._zod.def.innerType;
|
|
3574
4223
|
});
|
|
3575
|
-
function
|
|
3576
|
-
return new
|
|
4224
|
+
function bo(t) {
|
|
4225
|
+
return new wo({
|
|
3577
4226
|
type: "readonly",
|
|
3578
4227
|
innerType: t
|
|
3579
4228
|
});
|
|
3580
4229
|
}
|
|
3581
|
-
const
|
|
3582
|
-
|
|
4230
|
+
const Eo = /* @__PURE__ */ c("ZodCustom", (t, e) => {
|
|
4231
|
+
qr.init(t, e), y.init(t, e), t._zod.processJSONSchema = (n, r, i) => Hi(t, n);
|
|
3583
4232
|
});
|
|
3584
|
-
function
|
|
3585
|
-
return
|
|
4233
|
+
function zo(t, e = {}) {
|
|
4234
|
+
return Mi(Eo, t, e);
|
|
3586
4235
|
}
|
|
3587
|
-
function
|
|
3588
|
-
return
|
|
4236
|
+
function Io(t) {
|
|
4237
|
+
return Gi(t);
|
|
3589
4238
|
}
|
|
3590
|
-
const
|
|
3591
|
-
|
|
4239
|
+
const N = ye([
|
|
4240
|
+
$(),
|
|
3592
4241
|
S({
|
|
3593
|
-
pattern:
|
|
3594
|
-
flags:
|
|
4242
|
+
pattern: $(),
|
|
4243
|
+
flags: $().optional()
|
|
3595
4244
|
})
|
|
3596
|
-
]),
|
|
3597
|
-
kind:
|
|
3598
|
-
condition:
|
|
3599
|
-
operator:
|
|
3600
|
-
// Note: Operator types might need to be refined if we want strict enum validation,
|
|
4245
|
+
]), $o = S({
|
|
4246
|
+
kind: se("fragment"),
|
|
4247
|
+
condition: N.optional(),
|
|
4248
|
+
operator: ye([$(), A($())]).optional()
|
|
4249
|
+
// Note: Operator types might need to be refined if we want strict enum validation,
|
|
3601
4250
|
// but string is flexible for now.
|
|
3602
|
-
}),
|
|
3603
|
-
kind:
|
|
3604
|
-
name:
|
|
3605
|
-
id:
|
|
3606
|
-
stereotype:
|
|
3607
|
-
}),
|
|
3608
|
-
kind:
|
|
3609
|
-
text:
|
|
3610
|
-
from:
|
|
3611
|
-
to:
|
|
3612
|
-
}),
|
|
3613
|
-
kind:
|
|
3614
|
-
name:
|
|
3615
|
-
}),
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
]),
|
|
3621
|
-
action:
|
|
3622
|
-
selector:
|
|
3623
|
-
}),
|
|
3624
|
-
name:
|
|
3625
|
-
suffix:
|
|
4251
|
+
}), Oo = S({
|
|
4252
|
+
kind: se("participant"),
|
|
4253
|
+
name: N.optional(),
|
|
4254
|
+
id: N.optional(),
|
|
4255
|
+
stereotype: N.optional()
|
|
4256
|
+
}), So = S({
|
|
4257
|
+
kind: se("message"),
|
|
4258
|
+
text: N.optional(),
|
|
4259
|
+
from: N.optional(),
|
|
4260
|
+
to: N.optional()
|
|
4261
|
+
}), No = S({
|
|
4262
|
+
kind: se("group"),
|
|
4263
|
+
name: N.optional()
|
|
4264
|
+
}), Po = oo("kind", [
|
|
4265
|
+
$o,
|
|
4266
|
+
Oo,
|
|
4267
|
+
So,
|
|
4268
|
+
No
|
|
4269
|
+
]), Ao = Te(["focus", "remove", "resolve"]), Zo = S({
|
|
4270
|
+
action: Ao,
|
|
4271
|
+
selector: Po
|
|
4272
|
+
}), Co = S({
|
|
4273
|
+
name: $(),
|
|
4274
|
+
suffix: $().optional(),
|
|
3626
4275
|
// Defaults to .name in logic
|
|
3627
|
-
layers:
|
|
3628
|
-
}),
|
|
3629
|
-
input:
|
|
3630
|
-
outputDir:
|
|
3631
|
-
ignore:
|
|
3632
|
-
lenses:
|
|
3633
|
-
format:
|
|
4276
|
+
layers: A(Zo)
|
|
4277
|
+
}), Je = Te(["mermaid", "plantuml"]), Ro = S({
|
|
4278
|
+
input: A($()),
|
|
4279
|
+
outputDir: $(),
|
|
4280
|
+
ignore: A($()).optional(),
|
|
4281
|
+
lenses: A(Co),
|
|
4282
|
+
format: Je.optional(),
|
|
3634
4283
|
// Input format (auto-detected if omitted)
|
|
3635
|
-
outputFormat:
|
|
4284
|
+
outputFormat: Je.optional()
|
|
3636
4285
|
// Output format (same as input if omitted)
|
|
3637
|
-
}),
|
|
3638
|
-
version:
|
|
3639
|
-
targets:
|
|
4286
|
+
}), xo = S({
|
|
4287
|
+
version: Qs(),
|
|
4288
|
+
targets: A(Ro)
|
|
3640
4289
|
});
|
|
3641
|
-
function
|
|
3642
|
-
const e =
|
|
4290
|
+
function Uo(t) {
|
|
4291
|
+
const e = xo.safeParse(t);
|
|
3643
4292
|
if (!e.success) {
|
|
3644
4293
|
const n = e.error.issues.map((r) => `[${r.path.join(".")}]: ${r.message}`).join(`
|
|
3645
4294
|
`);
|
|
@@ -3648,538 +4297,17 @@ ${n}`);
|
|
|
3648
4297
|
}
|
|
3649
4298
|
return e.data;
|
|
3650
4299
|
}
|
|
3651
|
-
class $o {
|
|
3652
|
-
lines = [];
|
|
3653
|
-
indentLevel = 0;
|
|
3654
|
-
traverser;
|
|
3655
|
-
constructor() {
|
|
3656
|
-
this.traverser = new Lt(this);
|
|
3657
|
-
}
|
|
3658
|
-
generate(e) {
|
|
3659
|
-
return this.lines = [], this.indentLevel = 0, this.traverser.traverse(e), this.lines.join(`
|
|
3660
|
-
`);
|
|
3661
|
-
}
|
|
3662
|
-
visitRoot(e) {
|
|
3663
|
-
this.lines.push("sequenceDiagram"), this.indentLevel++, e.meta?.title && this.add(`title ${e.meta.title}`);
|
|
3664
|
-
for (const n of e.participants)
|
|
3665
|
-
this.visitParticipant(n);
|
|
3666
|
-
this.traverser.dispatchEvents(e.events);
|
|
3667
|
-
}
|
|
3668
|
-
visitParticipant(e) {
|
|
3669
|
-
const n = e.type === "actor" ? "actor" : "participant", r = e.name;
|
|
3670
|
-
e.id === e.name ? this.add(`${n} ${e.id}`) : this.add(`${n} ${e.id} as ${r}`);
|
|
3671
|
-
}
|
|
3672
|
-
visitParticipantGroup(e) {
|
|
3673
|
-
let n = "box";
|
|
3674
|
-
e.style?.backgroundColor && (n += ` ${e.style.backgroundColor}`), e.name && (n += ` ${e.name}`), this.add(n);
|
|
3675
|
-
}
|
|
3676
|
-
visitMessage(e) {
|
|
3677
|
-
const n = e.from ?? "[*]", r = e.to ?? "[*]", i = Nt(e.type, e.style);
|
|
3678
|
-
let s = "";
|
|
3679
|
-
e.lifecycle?.activateTarget && (s += "+"), e.lifecycle?.deactivateSource && (s += "-"), this.add(`${n}${i}${s}${r}: ${e.text}`);
|
|
3680
|
-
}
|
|
3681
|
-
visitFragment(e) {
|
|
3682
|
-
if (e.branches.length === 0) return;
|
|
3683
|
-
const n = e.branches[0], r = n.condition ? ` ${n.condition}` : "";
|
|
3684
|
-
this.add(`${e.operator}${r}`), this.indent(() => {
|
|
3685
|
-
this.traverser.dispatchEvents(n.events);
|
|
3686
|
-
});
|
|
3687
|
-
for (let i = 1; i < e.branches.length; i++) {
|
|
3688
|
-
const s = e.branches[i], o = s.condition ? ` ${s.condition}` : "";
|
|
3689
|
-
this.add(`else${o}`), this.indent(() => {
|
|
3690
|
-
this.traverser.dispatchEvents(s.events);
|
|
3691
|
-
});
|
|
3692
|
-
}
|
|
3693
|
-
this.add("end");
|
|
3694
|
-
}
|
|
3695
|
-
visitNote(e) {
|
|
3696
|
-
const n = e.position;
|
|
3697
|
-
let r = "";
|
|
3698
|
-
e.participantIds.length > 0 && (r = e.participantIds.join(","), n !== "over" ? r = ` of ${r}` : r = ` ${r}`), this.add(`note ${n}${r}: ${e.text}`);
|
|
3699
|
-
}
|
|
3700
|
-
visitActivation(e) {
|
|
3701
|
-
this.add(`${e.action} ${e.participantId}`);
|
|
3702
|
-
}
|
|
3703
|
-
visitDivider(e) {
|
|
3704
|
-
this.add(`%% == ${e.text || ""} ==`);
|
|
3705
|
-
}
|
|
3706
|
-
visitSpacer(e) {
|
|
3707
|
-
this.add(`...${e.text || ""}...`);
|
|
3708
|
-
}
|
|
3709
|
-
visitReference(e) {
|
|
3710
|
-
this.add(`%% ref: ${e.text}`);
|
|
3711
|
-
}
|
|
3712
|
-
// --- Helpers ---
|
|
3713
|
-
add(e) {
|
|
3714
|
-
const n = " ".repeat(this.indentLevel);
|
|
3715
|
-
this.lines.push(`${n}${e}`);
|
|
3716
|
-
}
|
|
3717
|
-
indent(e) {
|
|
3718
|
-
this.indentLevel++, e(), this.indentLevel--;
|
|
3719
|
-
}
|
|
3720
|
-
}
|
|
3721
|
-
class Io {
|
|
3722
|
-
generate(e) {
|
|
3723
|
-
return this.visitRoot(e);
|
|
3724
|
-
}
|
|
3725
|
-
visitRoot(e) {
|
|
3726
|
-
const n = ["@startuml"];
|
|
3727
|
-
e.meta.title && n.push(`title ${e.meta.title}`);
|
|
3728
|
-
const r = new Map(e.participants.map((s) => [s.id, s])), i = /* @__PURE__ */ new Set();
|
|
3729
|
-
for (const s of e.groups)
|
|
3730
|
-
n.push(this.visitGroup(s, r)), s.participantIds.forEach((o) => i.add(o));
|
|
3731
|
-
for (const s of e.participants)
|
|
3732
|
-
i.has(s.id) || n.push(this.visitParticipant(s));
|
|
3733
|
-
for (const s of e.events)
|
|
3734
|
-
n.push(this.visitEvent(s));
|
|
3735
|
-
return n.push("@enduml"), n.join(`
|
|
3736
|
-
`);
|
|
3737
|
-
}
|
|
3738
|
-
visitParticipant(e) {
|
|
3739
|
-
return e.name === e.id ? `${e.type} ${e.id}` : `${e.type} "${e.name}" as ${e.id}`;
|
|
3740
|
-
}
|
|
3741
|
-
// Adjusted signature to pass context
|
|
3742
|
-
visitGroup(e, n) {
|
|
3743
|
-
const r = [], i = e.style?.backgroundColor ? ` ${e.style.backgroundColor}` : "", s = e.name ? ` "${e.name}"` : "";
|
|
3744
|
-
if (r.push(`box${s}${i}`), n)
|
|
3745
|
-
for (const o of e.participantIds) {
|
|
3746
|
-
const a = n.get(o);
|
|
3747
|
-
a && r.push(this.visitParticipant(a));
|
|
3748
|
-
}
|
|
3749
|
-
return r.push("end box"), r.join(`
|
|
3750
|
-
`);
|
|
3751
|
-
}
|
|
3752
|
-
visitMessage(e) {
|
|
3753
|
-
const n = e.from || "[*]", r = e.to || "[*]";
|
|
3754
|
-
let i = "->";
|
|
3755
|
-
return e.type === "reply" ? i = "-->" : e.type === "async" && (i = "->>"), e.style.line, `${n} ${i} ${r}: ${e.text}`;
|
|
3756
|
-
}
|
|
3757
|
-
visitFragment(e) {
|
|
3758
|
-
const n = [], r = e.operator;
|
|
3759
|
-
return e.branches.forEach((i, s) => {
|
|
3760
|
-
s === 0 ? n.push(`${r} ${i.condition || ""}`.trim()) : n.push(`else ${i.condition || ""}`.trim());
|
|
3761
|
-
for (const o of i.events)
|
|
3762
|
-
n.push(this.visitEvent(o));
|
|
3763
|
-
}), n.push("end"), n.join(`
|
|
3764
|
-
`);
|
|
3765
|
-
}
|
|
3766
|
-
visitEvent(e) {
|
|
3767
|
-
switch (e.kind) {
|
|
3768
|
-
case "message":
|
|
3769
|
-
return this.visitMessage(e);
|
|
3770
|
-
case "fragment":
|
|
3771
|
-
return this.visitFragment(e);
|
|
3772
|
-
case "note":
|
|
3773
|
-
return this.visitNote(e);
|
|
3774
|
-
case "activation":
|
|
3775
|
-
return this.visitActivation(e);
|
|
3776
|
-
case "divider":
|
|
3777
|
-
return this.visitDivider(e);
|
|
3778
|
-
case "spacer":
|
|
3779
|
-
return this.visitSpacer(e);
|
|
3780
|
-
case "ref":
|
|
3781
|
-
return this.visitReference(e);
|
|
3782
|
-
default:
|
|
3783
|
-
return "";
|
|
3784
|
-
}
|
|
3785
|
-
}
|
|
3786
|
-
visitNote(e) {
|
|
3787
|
-
const n = e.position || "over", r = e.participantIds.join(", ");
|
|
3788
|
-
return `note ${n === "left" || n === "right" ? `${n} of` : n} ${r}: ${e.text}`;
|
|
3789
|
-
}
|
|
3790
|
-
visitActivation(e) {
|
|
3791
|
-
return `${e.action} ${e.participantId}`;
|
|
3792
|
-
}
|
|
3793
|
-
visitParticipantGroup(e) {
|
|
3794
|
-
return "";
|
|
3795
|
-
}
|
|
3796
|
-
visitDivider(e) {
|
|
3797
|
-
return "";
|
|
3798
|
-
}
|
|
3799
|
-
visitSpacer(e) {
|
|
3800
|
-
return "";
|
|
3801
|
-
}
|
|
3802
|
-
visitReference(e) {
|
|
3803
|
-
return "";
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
class se {
|
|
3807
|
-
transform(e) {
|
|
3808
|
-
const n = this.mapEvents(e.events);
|
|
3809
|
-
return {
|
|
3810
|
-
...e,
|
|
3811
|
-
events: n
|
|
3812
|
-
};
|
|
3813
|
-
}
|
|
3814
|
-
mapEvents(e) {
|
|
3815
|
-
return e.flatMap((n) => this.visitEvent(n));
|
|
3816
|
-
}
|
|
3817
|
-
visitEvent(e) {
|
|
3818
|
-
return e.kind === "fragment" ? this.visitFragment(e) : [e];
|
|
3819
|
-
}
|
|
3820
|
-
visitFragment(e) {
|
|
3821
|
-
const n = e.branches.map((r) => this.visitBranch(r));
|
|
3822
|
-
return [{
|
|
3823
|
-
...e,
|
|
3824
|
-
branches: n
|
|
3825
|
-
}];
|
|
3826
|
-
}
|
|
3827
|
-
visitBranch(e) {
|
|
3828
|
-
return {
|
|
3829
|
-
...e,
|
|
3830
|
-
events: this.mapEvents(e.events)
|
|
3831
|
-
};
|
|
3832
|
-
}
|
|
3833
|
-
}
|
|
3834
|
-
class Oo extends se {
|
|
3835
|
-
visitFragment(e) {
|
|
3836
|
-
const n = super.visitFragment(e);
|
|
3837
|
-
if (n.length === 0) return [];
|
|
3838
|
-
const r = n[0], i = r.branches.filter((s) => s.events.length > 0);
|
|
3839
|
-
return i.length === 0 ? [] : [{
|
|
3840
|
-
...r,
|
|
3841
|
-
branches: i
|
|
3842
|
-
}];
|
|
3843
|
-
}
|
|
3844
|
-
}
|
|
3845
|
-
class So {
|
|
3846
|
-
transform(e) {
|
|
3847
|
-
const n = this.collectUsedParticipants(e.events), r = e.participants.filter((s) => n.has(s.id)), i = e.groups.map((s) => ({
|
|
3848
|
-
...s,
|
|
3849
|
-
participantIds: s.participantIds.filter((o) => n.has(o))
|
|
3850
|
-
})).filter((s) => s.participantIds.length > 0);
|
|
3851
|
-
return {
|
|
3852
|
-
...e,
|
|
3853
|
-
participants: r,
|
|
3854
|
-
groups: i
|
|
3855
|
-
};
|
|
3856
|
-
}
|
|
3857
|
-
collectUsedParticipants(e) {
|
|
3858
|
-
const n = /* @__PURE__ */ new Set();
|
|
3859
|
-
function r(i) {
|
|
3860
|
-
for (const s of i)
|
|
3861
|
-
switch (s.kind) {
|
|
3862
|
-
case "message":
|
|
3863
|
-
s.from && n.add(s.from), s.to && n.add(s.to);
|
|
3864
|
-
break;
|
|
3865
|
-
case "fragment":
|
|
3866
|
-
for (const o of s.branches)
|
|
3867
|
-
r(o.events);
|
|
3868
|
-
break;
|
|
3869
|
-
case "activation":
|
|
3870
|
-
n.add(s.participantId);
|
|
3871
|
-
break;
|
|
3872
|
-
case "note":
|
|
3873
|
-
s.participantIds.forEach((o) => n.add(o));
|
|
3874
|
-
break;
|
|
3875
|
-
case "ref":
|
|
3876
|
-
s.participantIds.forEach((o) => n.add(o));
|
|
3877
|
-
break;
|
|
3878
|
-
}
|
|
3879
|
-
}
|
|
3880
|
-
return r(e), n;
|
|
3881
|
-
}
|
|
3882
|
-
}
|
|
3883
|
-
class Te {
|
|
3884
|
-
// -- Branch / Fragment --
|
|
3885
|
-
matchBranch(e, n, r) {
|
|
3886
|
-
return !(n.operator && !(Array.isArray(n.operator) ? n.operator : [n.operator]).includes(r) || n.condition && (!e.condition || !this.matchText(e.condition, n.condition)));
|
|
3887
|
-
}
|
|
3888
|
-
// -- Participant --
|
|
3889
|
-
matchParticipant(e, n) {
|
|
3890
|
-
return !(n.id && !this.matchText(e.id, n.id) || n.name && !this.matchText(e.name, n.name) || n.stereotype && e.stereotype && !this.matchText(e.stereotype, n.stereotype));
|
|
3891
|
-
}
|
|
3892
|
-
// -- Message --
|
|
3893
|
-
matchMessage(e, n) {
|
|
3894
|
-
return !(n.text && !this.matchText(e.text, n.text) || n.from && e.from && !this.matchText(e.from, n.from) || n.to && e.to && !this.matchText(e.to, n.to));
|
|
3895
|
-
}
|
|
3896
|
-
// -- Group --
|
|
3897
|
-
matchGroup(e, n) {
|
|
3898
|
-
return !(n.name && e.name && !this.matchText(e.name, n.name));
|
|
3899
|
-
}
|
|
3900
|
-
// -- Helpers --
|
|
3901
|
-
matchText(e, n) {
|
|
3902
|
-
if (typeof n == "string")
|
|
3903
|
-
return e === n;
|
|
3904
|
-
if (n instanceof RegExp)
|
|
3905
|
-
return n.test(e);
|
|
3906
|
-
if (typeof n == "object" && n.pattern) {
|
|
3907
|
-
const r = n.flags || "";
|
|
3908
|
-
return new RegExp(n.pattern, r).test(e);
|
|
3909
|
-
}
|
|
3910
|
-
return !1;
|
|
3911
|
-
}
|
|
3912
|
-
}
|
|
3913
|
-
class Po extends se {
|
|
3914
|
-
constructor(e) {
|
|
3915
|
-
super(), this.layer = e;
|
|
3916
|
-
}
|
|
3917
|
-
matcher = new Te();
|
|
3918
|
-
targetParticipantIds = /* @__PURE__ */ new Set();
|
|
3919
|
-
transform(e) {
|
|
3920
|
-
return this.resolveTargetParticipants(e), super.transform(e);
|
|
3921
|
-
}
|
|
3922
|
-
resolveTargetParticipants(e) {
|
|
3923
|
-
this.targetParticipantIds.clear();
|
|
3924
|
-
const n = this.layer.selector;
|
|
3925
|
-
e.participants.forEach((r) => {
|
|
3926
|
-
this.matcher.matchParticipant(r, n) && this.targetParticipantIds.add(r.id);
|
|
3927
|
-
});
|
|
3928
|
-
}
|
|
3929
|
-
visitEvent(e) {
|
|
3930
|
-
if (e.kind === "message") {
|
|
3931
|
-
const n = e;
|
|
3932
|
-
if (!this.isRelatedToParticipant(n))
|
|
3933
|
-
return [];
|
|
3934
|
-
}
|
|
3935
|
-
if (e.kind === "note" && !e.participantIds.some((i) => this.targetParticipantIds.has(i)))
|
|
3936
|
-
return [];
|
|
3937
|
-
if (e.kind === "activation") {
|
|
3938
|
-
const n = e;
|
|
3939
|
-
if (!this.targetParticipantIds.has(n.participantId))
|
|
3940
|
-
return [];
|
|
3941
|
-
}
|
|
3942
|
-
return super.visitEvent(e);
|
|
3943
|
-
}
|
|
3944
|
-
// Helper to check if message involves the participant from selector
|
|
3945
|
-
isRelatedToParticipant(e) {
|
|
3946
|
-
return !!(e.from && this.targetParticipantIds.has(e.from) || e.to && this.targetParticipantIds.has(e.to));
|
|
3947
|
-
}
|
|
3948
|
-
}
|
|
3949
|
-
class Zo extends se {
|
|
3950
|
-
constructor(e) {
|
|
3951
|
-
super(), this.layer = e;
|
|
3952
|
-
}
|
|
3953
|
-
matcher = new Te();
|
|
3954
|
-
removedParticipantIds = /* @__PURE__ */ new Set();
|
|
3955
|
-
transform(e) {
|
|
3956
|
-
const n = this.layer.selector;
|
|
3957
|
-
return n.kind === "participant" && (e.participants.forEach((r) => {
|
|
3958
|
-
this.matcher.matchParticipant(r, n) && this.removedParticipantIds.add(r.id);
|
|
3959
|
-
}), e.participants = e.participants.filter((r) => !this.removedParticipantIds.has(r.id))), n.kind === "group" && (e.groups = e.groups.filter((r) => !this.matcher.matchGroup(r, n))), super.transform(e);
|
|
3960
|
-
}
|
|
3961
|
-
visitEvent(e) {
|
|
3962
|
-
const n = this.layer.selector;
|
|
3963
|
-
if (n.kind === "message" && e.kind === "message" && this.matcher.matchMessage(e, n))
|
|
3964
|
-
return [];
|
|
3965
|
-
if (n.kind === "participant") {
|
|
3966
|
-
if (e.kind === "message") {
|
|
3967
|
-
const r = e;
|
|
3968
|
-
if (this.isRelatedToRemovedParticipant(r)) return [];
|
|
3969
|
-
}
|
|
3970
|
-
if (e.kind === "note" && e.participantIds.some((s) => this.removedParticipantIds.has(s)))
|
|
3971
|
-
return [];
|
|
3972
|
-
if (e.kind === "activation") {
|
|
3973
|
-
const r = e;
|
|
3974
|
-
if (this.removedParticipantIds.has(r.participantId)) return [];
|
|
3975
|
-
}
|
|
3976
|
-
}
|
|
3977
|
-
return super.visitEvent(e);
|
|
3978
|
-
}
|
|
3979
|
-
isRelatedToRemovedParticipant(e) {
|
|
3980
|
-
return !!(e.from && this.removedParticipantIds.has(e.from) || e.to && this.removedParticipantIds.has(e.to));
|
|
3981
|
-
}
|
|
3982
|
-
}
|
|
3983
|
-
class No extends se {
|
|
3984
|
-
constructor(e) {
|
|
3985
|
-
super(), this.layer = e;
|
|
3986
|
-
}
|
|
3987
|
-
matcher = new Te();
|
|
3988
|
-
visitFragment(e) {
|
|
3989
|
-
const n = e.branches.find(
|
|
3990
|
-
(r) => this.matcher.matchBranch(r, this.layer.selector, e.operator)
|
|
3991
|
-
);
|
|
3992
|
-
return n ? this.mapEvents(n.events) : super.visitFragment(e);
|
|
3993
|
-
}
|
|
3994
|
-
}
|
|
3995
|
-
class Ao {
|
|
3996
|
-
factories = /* @__PURE__ */ new Map();
|
|
3997
|
-
constructor() {
|
|
3998
|
-
this.register("resolve", (e) => new No(e)), this.register("focus", (e) => new Po(e)), this.register("remove", (e) => new Zo(e));
|
|
3999
|
-
}
|
|
4000
|
-
register(e, n) {
|
|
4001
|
-
this.factories.set(e, n);
|
|
4002
|
-
}
|
|
4003
|
-
get(e) {
|
|
4004
|
-
const n = this.factories.get(e.action);
|
|
4005
|
-
return n ? n(e) : null;
|
|
4006
|
-
}
|
|
4007
|
-
}
|
|
4008
|
-
const Ro = new Ao();
|
|
4009
|
-
class q {
|
|
4010
|
-
transform(e, n) {
|
|
4011
|
-
let r = e;
|
|
4012
|
-
for (const i of n) {
|
|
4013
|
-
const s = Ro.get(i);
|
|
4014
|
-
s ? r = s.transform(r) : console.warn(`Unknown action: ${i.action}`);
|
|
4015
|
-
}
|
|
4016
|
-
return r = new Oo().transform(r), r = new So().transform(r), r;
|
|
4017
|
-
}
|
|
4018
|
-
}
|
|
4019
|
-
function Uo(t) {
|
|
4020
|
-
if (typeof t != "object" || t === null)
|
|
4021
|
-
return !1;
|
|
4022
|
-
const e = t;
|
|
4023
|
-
if (Reflect.has(e, "name") && typeof e.name != "string" || !Array.isArray(e.layers))
|
|
4024
|
-
return !1;
|
|
4025
|
-
for (const n of e.layers)
|
|
4026
|
-
if (!Co(n))
|
|
4027
|
-
return !1;
|
|
4028
|
-
return !0;
|
|
4029
|
-
}
|
|
4030
|
-
function Co(t) {
|
|
4031
|
-
if (typeof t != "object" || t === null)
|
|
4032
|
-
return !1;
|
|
4033
|
-
const e = t;
|
|
4034
|
-
return !(typeof e.action != "string" || !["focus", "remove", "resolve"].includes(e.action) || typeof e.selector != "object" || e.selector === null || typeof e.selector.kind != "string");
|
|
4035
|
-
}
|
|
4036
|
-
function Vo(t, e) {
|
|
4037
|
-
return new q().transform(t, e.layers);
|
|
4038
|
-
}
|
|
4039
|
-
class Go {
|
|
4040
|
-
constructor() {
|
|
4041
|
-
}
|
|
4042
|
-
/**
|
|
4043
|
-
* Initialize a new Polagram transformation pipeline.
|
|
4044
|
-
* @param code Source diagram code
|
|
4045
|
-
* @param format Input format ('mermaid' or 'plantuml')
|
|
4046
|
-
*/
|
|
4047
|
-
static init(e, n = "mermaid") {
|
|
4048
|
-
const i = ue.getParser(n).parse(e);
|
|
4049
|
-
return new xo(i, n);
|
|
4050
|
-
}
|
|
4051
|
-
}
|
|
4052
|
-
class xo {
|
|
4053
|
-
ast;
|
|
4054
|
-
layers = [];
|
|
4055
|
-
sourceFormat;
|
|
4056
|
-
constructor(e, n = "mermaid") {
|
|
4057
|
-
this.ast = e, this.sourceFormat = n;
|
|
4058
|
-
}
|
|
4059
|
-
// -- Entity Filtering --
|
|
4060
|
-
/**
|
|
4061
|
-
* Focus on specific participants.
|
|
4062
|
-
* Keeps only interactions involving the matched participants.
|
|
4063
|
-
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
4064
|
-
*/
|
|
4065
|
-
focusParticipant(e) {
|
|
4066
|
-
return this.layers.push({
|
|
4067
|
-
action: "focus",
|
|
4068
|
-
selector: this.normalizeParticipantSelector(e)
|
|
4069
|
-
}), this;
|
|
4070
|
-
}
|
|
4071
|
-
/**
|
|
4072
|
-
* Remove specific participants and their interactions.
|
|
4073
|
-
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
4074
|
-
*/
|
|
4075
|
-
removeParticipant(e) {
|
|
4076
|
-
return this.layers.push({
|
|
4077
|
-
action: "remove",
|
|
4078
|
-
selector: this.normalizeParticipantSelector(e)
|
|
4079
|
-
}), this;
|
|
4080
|
-
}
|
|
4081
|
-
// -- Message Filtering --
|
|
4082
|
-
/**
|
|
4083
|
-
* Remove specific messages.
|
|
4084
|
-
* @param selector Message text (string/RegExp) or detailed MessageSelector
|
|
4085
|
-
*/
|
|
4086
|
-
removeMessage(e) {
|
|
4087
|
-
return this.layers.push({
|
|
4088
|
-
action: "remove",
|
|
4089
|
-
selector: this.normalizeMessageSelector(e)
|
|
4090
|
-
}), this;
|
|
4091
|
-
}
|
|
4092
|
-
// -- Group Filtering --
|
|
4093
|
-
/**
|
|
4094
|
-
* Remove specific groups (visual boxes).
|
|
4095
|
-
* @param selector Group name (string/RegExp) or detailed GroupSelector
|
|
4096
|
-
*/
|
|
4097
|
-
removeGroup(e) {
|
|
4098
|
-
return this.layers.push({
|
|
4099
|
-
action: "remove",
|
|
4100
|
-
selector: this.normalizeGroupSelector(e)
|
|
4101
|
-
}), this;
|
|
4102
|
-
}
|
|
4103
|
-
// -- Structural Resolution --
|
|
4104
|
-
/**
|
|
4105
|
-
* Resolve (unwrap) specific fragments like 'alt', 'opt', 'loop'.
|
|
4106
|
-
* Promotes the content of the matched branch and removes the wrapper.
|
|
4107
|
-
* @param selector Condition text (string/RegExp) or detailed FragmentSelector
|
|
4108
|
-
*/
|
|
4109
|
-
resolveFragment(e) {
|
|
4110
|
-
return this.layers.push({
|
|
4111
|
-
action: "resolve",
|
|
4112
|
-
selector: this.normalizeFragmentSelector(e)
|
|
4113
|
-
}), this;
|
|
4114
|
-
}
|
|
4115
|
-
/**
|
|
4116
|
-
* Apply a Lens (a named set of transformation layers).
|
|
4117
|
-
* @param lens Lens object containing layers
|
|
4118
|
-
*/
|
|
4119
|
-
applyLens(e) {
|
|
4120
|
-
return this.layers.push(...e.layers), this;
|
|
4121
|
-
}
|
|
4122
|
-
/**
|
|
4123
|
-
* Generate Mermaid code from the transformed AST.
|
|
4124
|
-
*/
|
|
4125
|
-
toMermaid() {
|
|
4126
|
-
const n = new q().transform(this.ast, this.layers);
|
|
4127
|
-
return new $o().generate(n);
|
|
4128
|
-
}
|
|
4129
|
-
/**
|
|
4130
|
-
* Generate PlantUML code from the transformed AST.
|
|
4131
|
-
*/
|
|
4132
|
-
toPlantUML() {
|
|
4133
|
-
const n = new q().transform(this.ast, this.layers);
|
|
4134
|
-
return new Io().generate(n);
|
|
4135
|
-
}
|
|
4136
|
-
/**
|
|
4137
|
-
* Get the transformed AST (for advanced use cases).
|
|
4138
|
-
*/
|
|
4139
|
-
toAST() {
|
|
4140
|
-
return new q().transform(this.ast, this.layers);
|
|
4141
|
-
}
|
|
4142
|
-
/**
|
|
4143
|
-
* Get the source format detected/specified during init.
|
|
4144
|
-
*/
|
|
4145
|
-
getSourceFormat() {
|
|
4146
|
-
return this.sourceFormat;
|
|
4147
|
-
}
|
|
4148
|
-
// -- Helper Methods --
|
|
4149
|
-
normalizeParticipantSelector(e) {
|
|
4150
|
-
return this.isTextMatcher(e) ? { kind: "participant", name: e } : { kind: "participant", ...e };
|
|
4151
|
-
}
|
|
4152
|
-
normalizeMessageSelector(e) {
|
|
4153
|
-
return this.isTextMatcher(e) ? { kind: "message", text: e } : { kind: "message", ...e };
|
|
4154
|
-
}
|
|
4155
|
-
normalizeGroupSelector(e) {
|
|
4156
|
-
return this.isTextMatcher(e) ? { kind: "group", name: e } : { kind: "group", ...e };
|
|
4157
|
-
}
|
|
4158
|
-
normalizeFragmentSelector(e) {
|
|
4159
|
-
return this.isTextMatcher(e) ? { kind: "fragment", condition: e } : { kind: "fragment", ...e };
|
|
4160
|
-
}
|
|
4161
|
-
isTextMatcher(e) {
|
|
4162
|
-
return typeof e == "string" || e instanceof RegExp || typeof e == "object" && e !== null && "pattern" in e && !("kind" in e);
|
|
4163
|
-
}
|
|
4164
|
-
}
|
|
4165
4300
|
export {
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
xo as
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
q as TransformationEngine,
|
|
4179
|
-
Lt as Traverser,
|
|
4180
|
-
So as UnusedCleaner,
|
|
4181
|
-
Vo as applyLens,
|
|
4182
|
-
Ro as transformerRegistry,
|
|
4183
|
-
Mo as validateConfig,
|
|
4184
|
-
Uo as validateLens
|
|
4301
|
+
be as FormatDetector,
|
|
4302
|
+
jo as GeneratorFactory,
|
|
4303
|
+
Ye as MermaidGeneratorVisitor,
|
|
4304
|
+
Ut as ParserFactory,
|
|
4305
|
+
Xe as PlantUMLGeneratorVisitor,
|
|
4306
|
+
Fo as Polagram,
|
|
4307
|
+
Yt as PolagramBuilder,
|
|
4308
|
+
xo as PolagramConfigSchema,
|
|
4309
|
+
ae as TransformationEngine,
|
|
4310
|
+
Ke as Traverser,
|
|
4311
|
+
Kt as transformerRegistry,
|
|
4312
|
+
Uo as validateConfig
|
|
4185
4313
|
};
|