@polagram/core 0.0.2
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/README.md +124 -0
- package/dist/index.d.ts +625 -0
- package/dist/polagram-core.js +3653 -0
- package/dist/polagram-core.umd.cjs +28 -0
- package/dist/src/api.d.ts +75 -0
- package/dist/src/api.js +160 -0
- package/dist/src/ast/ast.test.d.ts +1 -0
- package/dist/src/ast/ast.test.js +146 -0
- package/dist/src/ast/index.d.ts +119 -0
- package/dist/src/ast/index.js +2 -0
- package/dist/src/config/index.d.ts +1 -0
- package/dist/src/config/index.js +1 -0
- package/dist/src/config/schema.d.ts +182 -0
- package/dist/src/config/schema.js +78 -0
- package/dist/src/config/schema.test.d.ts +1 -0
- package/dist/src/config/schema.test.js +94 -0
- package/dist/src/generator/base/walker.d.ts +19 -0
- package/dist/src/generator/base/walker.js +56 -0
- package/dist/src/generator/base/walker.test.d.ts +1 -0
- package/dist/src/generator/base/walker.test.js +49 -0
- package/dist/src/generator/generators/mermaid.d.ts +24 -0
- package/dist/src/generator/generators/mermaid.js +140 -0
- package/dist/src/generator/generators/mermaid.test.d.ts +1 -0
- package/dist/src/generator/generators/mermaid.test.js +70 -0
- package/dist/src/generator/interface.d.ts +17 -0
- package/dist/src/generator/interface.js +1 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +17 -0
- package/dist/src/parser/base/lexer.d.ts +18 -0
- package/dist/src/parser/base/lexer.js +95 -0
- package/dist/src/parser/base/lexer.test.d.ts +1 -0
- package/dist/src/parser/base/lexer.test.js +53 -0
- package/dist/src/parser/base/parser.d.ts +14 -0
- package/dist/src/parser/base/parser.js +43 -0
- package/dist/src/parser/base/parser.test.d.ts +1 -0
- package/dist/src/parser/base/parser.test.js +90 -0
- package/dist/src/parser/index.d.ts +10 -0
- package/dist/src/parser/index.js +29 -0
- package/dist/src/parser/index.test.d.ts +1 -0
- package/dist/src/parser/index.test.js +23 -0
- package/dist/src/parser/interface.d.ts +8 -0
- package/dist/src/parser/interface.js +1 -0
- package/dist/src/parser/languages/mermaid/constants.d.ts +7 -0
- package/dist/src/parser/languages/mermaid/constants.js +20 -0
- package/dist/src/parser/languages/mermaid/index.d.ts +4 -0
- package/dist/src/parser/languages/mermaid/index.js +11 -0
- package/dist/src/parser/languages/mermaid/lexer.d.ts +14 -0
- package/dist/src/parser/languages/mermaid/lexer.js +152 -0
- package/dist/src/parser/languages/mermaid/lexer.test.d.ts +1 -0
- package/dist/src/parser/languages/mermaid/lexer.test.js +58 -0
- package/dist/src/parser/languages/mermaid/parser.d.ts +21 -0
- package/dist/src/parser/languages/mermaid/parser.js +340 -0
- package/dist/src/parser/languages/mermaid/parser.test.d.ts +1 -0
- package/dist/src/parser/languages/mermaid/parser.test.js +252 -0
- package/dist/src/parser/languages/mermaid/tokens.d.ts +9 -0
- package/dist/src/parser/languages/mermaid/tokens.js +1 -0
- package/dist/src/transformer/cleaners/prune-empty.d.ts +9 -0
- package/dist/src/transformer/cleaners/prune-empty.js +27 -0
- package/dist/src/transformer/cleaners/prune-empty.test.d.ts +1 -0
- package/dist/src/transformer/cleaners/prune-empty.test.js +69 -0
- package/dist/src/transformer/cleaners/prune-unused.d.ts +5 -0
- package/dist/src/transformer/cleaners/prune-unused.js +48 -0
- package/dist/src/transformer/cleaners/prune-unused.test.d.ts +1 -0
- package/dist/src/transformer/cleaners/prune-unused.test.js +71 -0
- package/dist/src/transformer/filters/focus.d.ts +13 -0
- package/dist/src/transformer/filters/focus.js +71 -0
- package/dist/src/transformer/filters/focus.test.d.ts +1 -0
- package/dist/src/transformer/filters/focus.test.js +50 -0
- package/dist/src/transformer/filters/remove.d.ts +12 -0
- package/dist/src/transformer/filters/remove.js +82 -0
- package/dist/src/transformer/filters/remove.test.d.ts +1 -0
- package/dist/src/transformer/filters/remove.test.js +38 -0
- package/dist/src/transformer/filters/resolve.d.ts +9 -0
- package/dist/src/transformer/filters/resolve.js +32 -0
- package/dist/src/transformer/filters/resolve.test.d.ts +1 -0
- package/dist/src/transformer/filters/resolve.test.js +48 -0
- package/dist/src/transformer/index.d.ts +10 -0
- package/dist/src/transformer/index.js +10 -0
- package/dist/src/transformer/lens.d.ts +12 -0
- package/dist/src/transformer/lens.js +58 -0
- package/dist/src/transformer/lens.test.d.ts +1 -0
- package/dist/src/transformer/lens.test.js +60 -0
- package/dist/src/transformer/orchestration/engine.d.ts +5 -0
- package/dist/src/transformer/orchestration/engine.js +24 -0
- package/dist/src/transformer/orchestration/engine.test.d.ts +1 -0
- package/dist/src/transformer/orchestration/engine.test.js +41 -0
- package/dist/src/transformer/orchestration/registry.d.ts +10 -0
- package/dist/src/transformer/orchestration/registry.js +27 -0
- package/dist/src/transformer/selector/matcher.d.ts +9 -0
- package/dist/src/transformer/selector/matcher.js +62 -0
- package/dist/src/transformer/selector/matcher.test.d.ts +1 -0
- package/dist/src/transformer/selector/matcher.test.js +53 -0
- package/dist/src/transformer/traverse/walker.d.ts +14 -0
- package/dist/src/transformer/traverse/walker.js +67 -0
- package/dist/src/transformer/traverse/walker.test.d.ts +1 -0
- package/dist/src/transformer/traverse/walker.test.js +48 -0
- package/dist/src/transformer/types.d.ts +47 -0
- package/dist/src/transformer/types.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,3653 @@
|
|
|
1
|
+
var Tt = Object.defineProperty;
|
|
2
|
+
var Zt = (e, t, n) => t in e ? Tt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var be = (e, t, n) => Zt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
class It {
|
|
5
|
+
constructor(t) {
|
|
6
|
+
this.input = t, this.readChar();
|
|
7
|
+
}
|
|
8
|
+
position = 0;
|
|
9
|
+
readPosition = 0;
|
|
10
|
+
ch = "";
|
|
11
|
+
line = 1;
|
|
12
|
+
column = 0;
|
|
13
|
+
getInput() {
|
|
14
|
+
return this.input;
|
|
15
|
+
}
|
|
16
|
+
readChar() {
|
|
17
|
+
this.readPosition >= this.input.length ? this.ch = "" : this.ch = this.input[this.readPosition], this.position = this.readPosition, this.readPosition += 1, this.column += 1, this.ch === `
|
|
18
|
+
` && (this.line += 1, this.column = 0);
|
|
19
|
+
}
|
|
20
|
+
peekChar() {
|
|
21
|
+
return this.readPosition >= this.input.length ? "" : this.input[this.readPosition];
|
|
22
|
+
}
|
|
23
|
+
skipWhitespace() {
|
|
24
|
+
for (; this.ch === " " || this.ch === " " || this.ch === "\r"; )
|
|
25
|
+
this.readChar();
|
|
26
|
+
}
|
|
27
|
+
readWhile(t) {
|
|
28
|
+
const n = this.position;
|
|
29
|
+
for (; t(this.ch); )
|
|
30
|
+
this.readChar();
|
|
31
|
+
return this.input.slice(n, this.position);
|
|
32
|
+
}
|
|
33
|
+
isLetter(t) {
|
|
34
|
+
return "a" <= t && t <= "z" || "A" <= t && t <= "Z" || t === "_" ? !0 : t.charCodeAt(0) > 127 ? !/[\s\d]/.test(t) : !1;
|
|
35
|
+
}
|
|
36
|
+
isDigit(t) {
|
|
37
|
+
return "0" <= t && t <= "9";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class Et extends It {
|
|
41
|
+
constructor(t) {
|
|
42
|
+
super(t);
|
|
43
|
+
}
|
|
44
|
+
nextToken() {
|
|
45
|
+
this.skipWhitespace();
|
|
46
|
+
const t = this.position, n = this.column;
|
|
47
|
+
let r;
|
|
48
|
+
switch (this.ch) {
|
|
49
|
+
case ":":
|
|
50
|
+
r = this.newToken("COLON", this.ch, t, n);
|
|
51
|
+
break;
|
|
52
|
+
case ",":
|
|
53
|
+
r = this.newToken("COMMA", this.ch, t, n);
|
|
54
|
+
break;
|
|
55
|
+
case "+":
|
|
56
|
+
r = this.newToken("PLUS", this.ch, t, n);
|
|
57
|
+
break;
|
|
58
|
+
case "-":
|
|
59
|
+
if (this.isArrowStart()) {
|
|
60
|
+
const i = this.readArrow();
|
|
61
|
+
return r = this.newToken("ARROW", i, t, n), r;
|
|
62
|
+
} else
|
|
63
|
+
r = this.newToken("MINUS", this.ch, t, n);
|
|
64
|
+
break;
|
|
65
|
+
case '"':
|
|
66
|
+
const o = this.readString();
|
|
67
|
+
return r = this.newToken("STRING", o, t, n), r;
|
|
68
|
+
case `
|
|
69
|
+
`:
|
|
70
|
+
r = this.newToken("NEWLINE", this.ch, t, n);
|
|
71
|
+
break;
|
|
72
|
+
case "":
|
|
73
|
+
r = this.newToken("EOF", "", t, n);
|
|
74
|
+
break;
|
|
75
|
+
default:
|
|
76
|
+
if (this.isLetter(this.ch)) {
|
|
77
|
+
const i = this.readIdentifier(), s = this.lookupIdent(i);
|
|
78
|
+
return this.newToken(s, i, t, n);
|
|
79
|
+
} else if (this.isDigit(this.ch)) {
|
|
80
|
+
const i = this.readNumber();
|
|
81
|
+
return this.newToken("IDENTIFIER", i, t, n);
|
|
82
|
+
} else
|
|
83
|
+
r = this.newToken("UNKNOWN", this.ch, t, n);
|
|
84
|
+
}
|
|
85
|
+
return this.readChar(), r;
|
|
86
|
+
}
|
|
87
|
+
newToken(t, n, r, o) {
|
|
88
|
+
return {
|
|
89
|
+
type: t,
|
|
90
|
+
literal: n,
|
|
91
|
+
line: this.line,
|
|
92
|
+
column: o,
|
|
93
|
+
start: r,
|
|
94
|
+
// If the lexer position has advanced beyond the start (consumed tokens like String/Arrow), use that position.
|
|
95
|
+
// Otherwise (simple chars), assume length-based calculation.
|
|
96
|
+
end: this.position > r ? this.position : r + n.length
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
readIdentifier() {
|
|
100
|
+
const t = this.position;
|
|
101
|
+
for (; this.isLetter(this.ch) || this.isDigit(this.ch); )
|
|
102
|
+
this.readChar();
|
|
103
|
+
return this.input.slice(t, this.position);
|
|
104
|
+
}
|
|
105
|
+
readNumber() {
|
|
106
|
+
const t = this.position;
|
|
107
|
+
for (; this.isDigit(this.ch); )
|
|
108
|
+
this.readChar();
|
|
109
|
+
return this.input.slice(t, this.position);
|
|
110
|
+
}
|
|
111
|
+
readString() {
|
|
112
|
+
const t = this.position + 1;
|
|
113
|
+
for (this.readChar(); this.ch !== '"' && this.ch !== "" && this.ch !== `
|
|
114
|
+
`; )
|
|
115
|
+
this.readChar();
|
|
116
|
+
const n = this.input.slice(t, this.position);
|
|
117
|
+
return this.ch, this.readChar(), n;
|
|
118
|
+
}
|
|
119
|
+
isArrowStart() {
|
|
120
|
+
if (this.ch !== "-") return !1;
|
|
121
|
+
const t = this.peekChar();
|
|
122
|
+
return t === ">" || t === "-" || t === ")" || t === "x";
|
|
123
|
+
}
|
|
124
|
+
readArrow() {
|
|
125
|
+
if (this.input.slice(this.position, this.position + 4) === "-->>")
|
|
126
|
+
return this.readMulti(4), "-->>";
|
|
127
|
+
const n = this.input.slice(this.position, this.position + 3);
|
|
128
|
+
if (n === "-->" || n === "--)" || n === "->>" || n === "--x")
|
|
129
|
+
return this.readMulti(3), n;
|
|
130
|
+
const r = this.input.slice(this.position, this.position + 2);
|
|
131
|
+
return r === "->" || r === "-)" || r === "-x" ? (this.readMulti(2), r) : "-";
|
|
132
|
+
}
|
|
133
|
+
readMulti(t) {
|
|
134
|
+
for (let n = 0; n < t; n++) this.readChar();
|
|
135
|
+
}
|
|
136
|
+
lookupIdent(t) {
|
|
137
|
+
return {
|
|
138
|
+
sequenceDiagram: "SEQUENCE_DIAGRAM",
|
|
139
|
+
participant: "PARTICIPANT",
|
|
140
|
+
actor: "ACTOR",
|
|
141
|
+
loop: "LOOP",
|
|
142
|
+
alt: "ALT",
|
|
143
|
+
opt: "OPT",
|
|
144
|
+
end: "END",
|
|
145
|
+
else: "ELSE",
|
|
146
|
+
note: "NOTE",
|
|
147
|
+
left: "LEFT",
|
|
148
|
+
right: "RIGHT",
|
|
149
|
+
over: "OVER",
|
|
150
|
+
of: "OF",
|
|
151
|
+
as: "AS",
|
|
152
|
+
title: "TITLE",
|
|
153
|
+
activate: "ACTIVATE",
|
|
154
|
+
deactivate: "DEACTIVATE",
|
|
155
|
+
box: "BOX"
|
|
156
|
+
}[t] || "IDENTIFIER";
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
class St {
|
|
160
|
+
constructor(t) {
|
|
161
|
+
this.lexer = t, this.advance(), this.advance();
|
|
162
|
+
}
|
|
163
|
+
currToken;
|
|
164
|
+
peekToken;
|
|
165
|
+
advance() {
|
|
166
|
+
this.currToken = this.peekToken, this.peekToken = this.lexer.nextToken();
|
|
167
|
+
}
|
|
168
|
+
curTokenIs(t) {
|
|
169
|
+
return this.currToken.type === t;
|
|
170
|
+
}
|
|
171
|
+
peekTokenIs(t) {
|
|
172
|
+
return this.peekToken.type === t;
|
|
173
|
+
}
|
|
174
|
+
expectPeek(t) {
|
|
175
|
+
return this.peekTokenIs(t) ? (this.advance(), !0) : !1;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const Ge = {
|
|
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
|
+
}, Ot = Object.entries(Ge).reduce((e, [t, n]) => {
|
|
188
|
+
const r = JSON.stringify({ type: n.type, style: n.style });
|
|
189
|
+
return e[r] = t, e;
|
|
190
|
+
}, {});
|
|
191
|
+
function Pt(e, t) {
|
|
192
|
+
const n = JSON.stringify({ type: e, style: t });
|
|
193
|
+
return Ot[n] || "->>";
|
|
194
|
+
}
|
|
195
|
+
class Nt extends St {
|
|
196
|
+
currentGroup = null;
|
|
197
|
+
idCounters = {
|
|
198
|
+
evt: 0,
|
|
199
|
+
frag: 0,
|
|
200
|
+
br: 0,
|
|
201
|
+
note: 0,
|
|
202
|
+
group: 0
|
|
203
|
+
};
|
|
204
|
+
constructor(t) {
|
|
205
|
+
super(t);
|
|
206
|
+
}
|
|
207
|
+
parse() {
|
|
208
|
+
const t = {
|
|
209
|
+
kind: "root",
|
|
210
|
+
meta: { version: "1.0.0", source: "unknown" },
|
|
211
|
+
participants: [],
|
|
212
|
+
groups: [],
|
|
213
|
+
events: []
|
|
214
|
+
};
|
|
215
|
+
return t.events = this.parseBlock(t), t;
|
|
216
|
+
}
|
|
217
|
+
parseBlock(t, n = []) {
|
|
218
|
+
const r = [];
|
|
219
|
+
for (; this.currToken.type !== "EOF"; ) {
|
|
220
|
+
const o = this.currToken.type;
|
|
221
|
+
if (n.includes(o))
|
|
222
|
+
return r;
|
|
223
|
+
if (o === "NEWLINE") {
|
|
224
|
+
this.advance();
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (o === "SEQUENCE_DIAGRAM") {
|
|
228
|
+
t.meta.source = "mermaid", this.advance();
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
if (o === "TITLE") {
|
|
232
|
+
this.advance(), t.meta.title = this.readRestOfLine();
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (o === "BOX") {
|
|
236
|
+
const i = this.parseGroup(t);
|
|
237
|
+
r.push(...i);
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (o === "PARTICIPANT" || o === "ACTOR") {
|
|
241
|
+
this.parseParticipant(t);
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (o === "LOOP" || o === "ALT" || o === "OPT") {
|
|
245
|
+
r.push(this.parseFragment(t));
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (o === "NOTE") {
|
|
249
|
+
r.push(this.parseNote(t));
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
if (o === "ACTIVATE" || o === "DEACTIVATE") {
|
|
253
|
+
r.push(this.parseActivation(t));
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (this.isParticipantToken(this.currToken)) {
|
|
257
|
+
const i = this.parseMessage(t);
|
|
258
|
+
if (i) {
|
|
259
|
+
r.push(i);
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
this.advance();
|
|
264
|
+
}
|
|
265
|
+
return r;
|
|
266
|
+
}
|
|
267
|
+
isParticipantToken(t) {
|
|
268
|
+
return t.type === "IDENTIFIER" || t.type === "STRING";
|
|
269
|
+
}
|
|
270
|
+
parseGroup(t) {
|
|
271
|
+
this.advance();
|
|
272
|
+
const n = this.readRestOfLine().trim();
|
|
273
|
+
let r = n, o;
|
|
274
|
+
const i = n.split(/\s+/);
|
|
275
|
+
if (i.length > 0) {
|
|
276
|
+
const l = i[0];
|
|
277
|
+
(l.startsWith("#") || ["rgb", "rgba", "transparent", "aqua", "grey", "gray", "purple", "red", "blue", "green"].includes(l.toLowerCase())) && (o = l, r = i.slice(1).join(" "));
|
|
278
|
+
}
|
|
279
|
+
r || (r = `Group ${this.idCounters.group + 1}`);
|
|
280
|
+
const s = {
|
|
281
|
+
kind: "group",
|
|
282
|
+
id: this.generateId("group"),
|
|
283
|
+
name: r,
|
|
284
|
+
type: "box",
|
|
285
|
+
participantIds: [],
|
|
286
|
+
style: o ? { backgroundColor: o } : void 0
|
|
287
|
+
};
|
|
288
|
+
t.groups.push(s);
|
|
289
|
+
const a = this.currentGroup;
|
|
290
|
+
this.currentGroup = s;
|
|
291
|
+
const u = this.parseBlock(t, ["END"]);
|
|
292
|
+
return this.currentGroup = a, this.currToken.type === "END" && this.advance(), u;
|
|
293
|
+
}
|
|
294
|
+
parseFragment(t) {
|
|
295
|
+
const n = this.currToken.type;
|
|
296
|
+
let r = "loop";
|
|
297
|
+
n === "ALT" && (r = "alt"), n === "OPT" && (r = "opt"), this.advance();
|
|
298
|
+
const o = this.readRestOfLine(), i = [], s = this.parseBlock(t, ["END", "ELSE"]);
|
|
299
|
+
for (i.push({
|
|
300
|
+
id: this.generateId("br"),
|
|
301
|
+
condition: o,
|
|
302
|
+
events: s
|
|
303
|
+
}); this.currToken.type === "ELSE"; ) {
|
|
304
|
+
this.advance();
|
|
305
|
+
const a = this.readRestOfLine(), u = this.parseBlock(t, ["END", "ELSE"]);
|
|
306
|
+
i.push({
|
|
307
|
+
id: this.generateId("br"),
|
|
308
|
+
condition: a,
|
|
309
|
+
events: u
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return this.currToken.type === "END" && this.advance(), {
|
|
313
|
+
kind: "fragment",
|
|
314
|
+
id: this.generateId("frag"),
|
|
315
|
+
operator: r,
|
|
316
|
+
branches: i
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
parseParticipant(t) {
|
|
320
|
+
const n = this.currToken.type === "ACTOR";
|
|
321
|
+
this.advance();
|
|
322
|
+
let r = "", o = "";
|
|
323
|
+
if (this.isParticipantToken(this.currToken) && (r = this.currToken.literal, o = r, this.advance()), this.currToken.type === "AS") {
|
|
324
|
+
this.advance();
|
|
325
|
+
const s = this.readRestOfLine().trim();
|
|
326
|
+
s && (o = s);
|
|
327
|
+
}
|
|
328
|
+
const i = t.participants.find((s) => s.id === r);
|
|
329
|
+
i ? (o !== r && (i.name = o), n && (i.type = "actor")) : t.participants.push({
|
|
330
|
+
id: r,
|
|
331
|
+
name: o,
|
|
332
|
+
type: n ? "actor" : "participant"
|
|
333
|
+
}), this.currentGroup && (this.currentGroup.participantIds.includes(r) || this.currentGroup.participantIds.push(r));
|
|
334
|
+
}
|
|
335
|
+
parseNote(t) {
|
|
336
|
+
this.advance();
|
|
337
|
+
let n = "over";
|
|
338
|
+
this.currToken.type === "LEFT" ? (n = "left", this.advance()) : this.currToken.type === "RIGHT" ? (n = "right", this.advance()) : this.currToken.type === "OVER" && (n = "over", this.advance()), this.currToken.type === "OF" && this.advance();
|
|
339
|
+
const r = [];
|
|
340
|
+
for (; this.isParticipantToken(this.currToken) && (r.push(this.currToken.literal), this.ensureParticipant(t, this.currToken.literal), this.advance(), this.currToken.type === "COMMA"); )
|
|
341
|
+
this.advance();
|
|
342
|
+
let o = "";
|
|
343
|
+
return this.currToken.type === "COLON" && (this.advance(), o = this.readRestOfLine()), {
|
|
344
|
+
kind: "note",
|
|
345
|
+
id: this.generateId("note"),
|
|
346
|
+
position: n,
|
|
347
|
+
participantIds: r,
|
|
348
|
+
text: o
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
parseActivation(t) {
|
|
352
|
+
const n = this.currToken.type === "ACTIVATE" ? "activate" : "deactivate";
|
|
353
|
+
this.advance();
|
|
354
|
+
let r = "";
|
|
355
|
+
return this.isParticipantToken(this.currToken) && (r = this.currToken.literal, this.ensureParticipant(t, r), this.advance()), {
|
|
356
|
+
kind: "activation",
|
|
357
|
+
participantId: r,
|
|
358
|
+
action: n
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
parseMessage(t) {
|
|
362
|
+
if (this.peekToken.type !== "ARROW")
|
|
363
|
+
return null;
|
|
364
|
+
const n = this.currToken.literal;
|
|
365
|
+
if (this.ensureParticipant(t, n), this.advance(), this.currToken.type !== "ARROW")
|
|
366
|
+
return null;
|
|
367
|
+
const r = this.currToken.literal;
|
|
368
|
+
this.advance();
|
|
369
|
+
let o = !1, i = !1;
|
|
370
|
+
if (this.currToken.type === "PLUS" && (o = !0, this.advance()), this.currToken.type === "MINUS" && (i = !0, this.advance()), !this.isParticipantToken(this.currToken)) return null;
|
|
371
|
+
const s = this.currToken.literal;
|
|
372
|
+
this.ensureParticipant(t, s), this.advance();
|
|
373
|
+
let a = "";
|
|
374
|
+
this.currToken.type === "COLON" && (this.advance(), a = this.readRestOfLine());
|
|
375
|
+
const { type: u, style: l } = this.resolveArrow(r);
|
|
376
|
+
return {
|
|
377
|
+
kind: "message",
|
|
378
|
+
id: this.generateId("evt"),
|
|
379
|
+
from: n,
|
|
380
|
+
to: s,
|
|
381
|
+
text: a,
|
|
382
|
+
type: u,
|
|
383
|
+
style: l,
|
|
384
|
+
lifecycle: o || i ? { activateTarget: o, deactivateSource: i } : void 0
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
resolveArrow(t) {
|
|
388
|
+
const n = Ge[t];
|
|
389
|
+
return n || { type: "sync", style: { line: "solid", head: "arrow" } };
|
|
390
|
+
}
|
|
391
|
+
generateId(t) {
|
|
392
|
+
return this.idCounters[t]++, `${t}_${this.idCounters[t]}`;
|
|
393
|
+
}
|
|
394
|
+
readRestOfLine() {
|
|
395
|
+
if (this.currToken.type === "NEWLINE" || this.currToken.type === "EOF")
|
|
396
|
+
return "";
|
|
397
|
+
const t = this.currToken.start;
|
|
398
|
+
let n = this.currToken.end;
|
|
399
|
+
for (; this.currToken.type !== "NEWLINE" && this.currToken.type !== "EOF"; )
|
|
400
|
+
n = this.currToken.end, this.advance();
|
|
401
|
+
return this.lexer.getInput().slice(t, n);
|
|
402
|
+
}
|
|
403
|
+
ensureParticipant(t, n) {
|
|
404
|
+
t.participants.find((r) => r.id === n) || t.participants.push({
|
|
405
|
+
id: n,
|
|
406
|
+
name: n,
|
|
407
|
+
type: "participant"
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
const At = {
|
|
412
|
+
parse: (e) => {
|
|
413
|
+
const t = new Et(e);
|
|
414
|
+
return new Nt(t).parse();
|
|
415
|
+
}
|
|
416
|
+
}, H = class H {
|
|
417
|
+
static register(t, n) {
|
|
418
|
+
this.parsers.set(t, n);
|
|
419
|
+
}
|
|
420
|
+
static getParser(t) {
|
|
421
|
+
const n = this.parsers.get(t);
|
|
422
|
+
if (!n)
|
|
423
|
+
throw new Error(`Parser for language '${t}' not found.`);
|
|
424
|
+
return n;
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
be(H, "parsers", /* @__PURE__ */ new Map()), H.register("mermaid", At);
|
|
428
|
+
let ce = H;
|
|
429
|
+
class Rt {
|
|
430
|
+
constructor(t) {
|
|
431
|
+
this.visitor = t;
|
|
432
|
+
}
|
|
433
|
+
traverse(t) {
|
|
434
|
+
this.visitor.visitRoot(t);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Dispatches a single event node to the appropriate visitor method.
|
|
438
|
+
* This is public so Visitors can call it recursively (e.g. inside Fragments/Groups).
|
|
439
|
+
*/
|
|
440
|
+
dispatchEvent(t) {
|
|
441
|
+
switch (t.kind) {
|
|
442
|
+
case "message":
|
|
443
|
+
this.visitor.visitMessage(t);
|
|
444
|
+
break;
|
|
445
|
+
case "fragment":
|
|
446
|
+
this.visitor.visitFragment(t);
|
|
447
|
+
break;
|
|
448
|
+
case "note":
|
|
449
|
+
this.visitor.visitNote(t);
|
|
450
|
+
break;
|
|
451
|
+
case "activation":
|
|
452
|
+
this.visitor.visitActivation(t);
|
|
453
|
+
break;
|
|
454
|
+
case "divider":
|
|
455
|
+
this.visitor.visitDivider(t);
|
|
456
|
+
break;
|
|
457
|
+
case "spacer":
|
|
458
|
+
this.visitor.visitSpacer(t);
|
|
459
|
+
break;
|
|
460
|
+
case "ref":
|
|
461
|
+
this.visitor.visitReference(t);
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Helper to iterate over a list of events.
|
|
467
|
+
*/
|
|
468
|
+
dispatchEvents(t) {
|
|
469
|
+
for (const n of t)
|
|
470
|
+
this.dispatchEvent(n);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
class Ct {
|
|
474
|
+
lines = [];
|
|
475
|
+
indentLevel = 0;
|
|
476
|
+
traverser;
|
|
477
|
+
constructor() {
|
|
478
|
+
this.traverser = new Rt(this);
|
|
479
|
+
}
|
|
480
|
+
generate(t) {
|
|
481
|
+
return this.lines = [], this.indentLevel = 0, this.traverser.traverse(t), this.lines.join(`
|
|
482
|
+
`);
|
|
483
|
+
}
|
|
484
|
+
visitRoot(t) {
|
|
485
|
+
this.lines.push("sequenceDiagram"), this.indentLevel++, t.meta?.title && this.add(`title ${t.meta.title}`);
|
|
486
|
+
for (const n of t.participants)
|
|
487
|
+
this.visitParticipant(n);
|
|
488
|
+
this.traverser.dispatchEvents(t.events);
|
|
489
|
+
}
|
|
490
|
+
visitParticipant(t) {
|
|
491
|
+
const n = t.type === "actor" ? "actor" : "participant", r = t.name;
|
|
492
|
+
t.id === t.name ? this.add(`${n} ${t.id}`) : this.add(`${n} ${t.id} as ${r}`);
|
|
493
|
+
}
|
|
494
|
+
visitParticipantGroup(t) {
|
|
495
|
+
let n = "box";
|
|
496
|
+
t.style?.backgroundColor && (n += ` ${t.style.backgroundColor}`), t.name && (n += ` ${t.name}`), this.add(n);
|
|
497
|
+
}
|
|
498
|
+
visitMessage(t) {
|
|
499
|
+
const n = t.from ?? "[*]", r = t.to ?? "[*]", o = Pt(t.type, t.style);
|
|
500
|
+
let i = "";
|
|
501
|
+
t.lifecycle?.activateTarget && (i += "+"), t.lifecycle?.deactivateSource && (i += "-"), this.add(`${n}${o}${i}${r}: ${t.text}`);
|
|
502
|
+
}
|
|
503
|
+
visitFragment(t) {
|
|
504
|
+
if (t.branches.length === 0) return;
|
|
505
|
+
const n = t.branches[0], r = n.condition ? ` ${n.condition}` : "";
|
|
506
|
+
this.add(`${t.operator}${r}`), this.indent(() => {
|
|
507
|
+
this.traverser.dispatchEvents(n.events);
|
|
508
|
+
});
|
|
509
|
+
for (let o = 1; o < t.branches.length; o++) {
|
|
510
|
+
const i = t.branches[o], s = i.condition ? ` ${i.condition}` : "";
|
|
511
|
+
this.add(`else${s}`), this.indent(() => {
|
|
512
|
+
this.traverser.dispatchEvents(i.events);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
this.add("end");
|
|
516
|
+
}
|
|
517
|
+
visitNote(t) {
|
|
518
|
+
const n = t.position;
|
|
519
|
+
let r = "";
|
|
520
|
+
t.participantIds.length > 0 && (r = t.participantIds.join(","), n !== "over" ? r = ` of ${r}` : r = ` ${r}`), this.add(`note ${n}${r}: ${t.text}`);
|
|
521
|
+
}
|
|
522
|
+
visitActivation(t) {
|
|
523
|
+
this.add(`${t.action} ${t.participantId}`);
|
|
524
|
+
}
|
|
525
|
+
visitDivider(t) {
|
|
526
|
+
this.add(`%% == ${t.text || ""} ==`);
|
|
527
|
+
}
|
|
528
|
+
visitSpacer(t) {
|
|
529
|
+
this.add(`...${t.text || ""}...`);
|
|
530
|
+
}
|
|
531
|
+
visitReference(t) {
|
|
532
|
+
this.add(`%% ref: ${t.text}`);
|
|
533
|
+
}
|
|
534
|
+
// --- Helpers ---
|
|
535
|
+
add(t) {
|
|
536
|
+
const n = " ".repeat(this.indentLevel);
|
|
537
|
+
this.lines.push(`${n}${t}`);
|
|
538
|
+
}
|
|
539
|
+
indent(t) {
|
|
540
|
+
this.indentLevel++, t(), this.indentLevel--;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
class Q {
|
|
544
|
+
transform(t) {
|
|
545
|
+
const n = this.mapEvents(t.events);
|
|
546
|
+
return {
|
|
547
|
+
...t,
|
|
548
|
+
events: n
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
mapEvents(t) {
|
|
552
|
+
return t.flatMap((n) => this.visitEvent(n));
|
|
553
|
+
}
|
|
554
|
+
visitEvent(t) {
|
|
555
|
+
return t.kind === "fragment" ? this.visitFragment(t) : [t];
|
|
556
|
+
}
|
|
557
|
+
visitFragment(t) {
|
|
558
|
+
const n = t.branches.map((r) => this.visitBranch(r));
|
|
559
|
+
return [{
|
|
560
|
+
...t,
|
|
561
|
+
branches: n
|
|
562
|
+
}];
|
|
563
|
+
}
|
|
564
|
+
visitBranch(t) {
|
|
565
|
+
return {
|
|
566
|
+
...t,
|
|
567
|
+
events: this.mapEvents(t.events)
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
class xt extends Q {
|
|
572
|
+
visitFragment(t) {
|
|
573
|
+
const n = super.visitFragment(t);
|
|
574
|
+
if (n.length === 0) return [];
|
|
575
|
+
const r = n[0], o = r.branches.filter((i) => i.events.length > 0);
|
|
576
|
+
return o.length === 0 ? [] : [{
|
|
577
|
+
...r,
|
|
578
|
+
branches: o
|
|
579
|
+
}];
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
class jt {
|
|
583
|
+
transform(t) {
|
|
584
|
+
const n = this.collectUsedParticipants(t.events), r = t.participants.filter((i) => n.has(i.id)), o = t.groups.map((i) => ({
|
|
585
|
+
...i,
|
|
586
|
+
participantIds: i.participantIds.filter((s) => n.has(s))
|
|
587
|
+
})).filter((i) => i.participantIds.length > 0);
|
|
588
|
+
return {
|
|
589
|
+
...t,
|
|
590
|
+
participants: r,
|
|
591
|
+
groups: o
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
collectUsedParticipants(t) {
|
|
595
|
+
const n = /* @__PURE__ */ new Set();
|
|
596
|
+
function r(o) {
|
|
597
|
+
for (const i of o)
|
|
598
|
+
switch (i.kind) {
|
|
599
|
+
case "message":
|
|
600
|
+
i.from && n.add(i.from), i.to && n.add(i.to);
|
|
601
|
+
break;
|
|
602
|
+
case "fragment":
|
|
603
|
+
for (const s of i.branches)
|
|
604
|
+
r(s.events);
|
|
605
|
+
break;
|
|
606
|
+
case "activation":
|
|
607
|
+
n.add(i.participantId);
|
|
608
|
+
break;
|
|
609
|
+
case "note":
|
|
610
|
+
i.participantIds.forEach((s) => n.add(s));
|
|
611
|
+
break;
|
|
612
|
+
case "ref":
|
|
613
|
+
i.participantIds.forEach((s) => n.add(s));
|
|
614
|
+
break;
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
return r(t), n;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
class fe {
|
|
621
|
+
// -- Branch / Fragment --
|
|
622
|
+
matchBranch(t, n, r) {
|
|
623
|
+
return !(n.operator && !(Array.isArray(n.operator) ? n.operator : [n.operator]).includes(r) || n.condition && (!t.condition || !this.matchText(t.condition, n.condition)));
|
|
624
|
+
}
|
|
625
|
+
// -- Participant --
|
|
626
|
+
matchParticipant(t, n) {
|
|
627
|
+
return !(n.id && !this.matchText(t.id, n.id) || n.name && !this.matchText(t.name, n.name) || n.stereotype && t.stereotype && !this.matchText(t.stereotype, n.stereotype));
|
|
628
|
+
}
|
|
629
|
+
// -- Message --
|
|
630
|
+
matchMessage(t, n) {
|
|
631
|
+
return !(n.text && !this.matchText(t.text, n.text) || n.from && t.from && !this.matchText(t.from, n.from) || n.to && t.to && !this.matchText(t.to, n.to));
|
|
632
|
+
}
|
|
633
|
+
// -- Group --
|
|
634
|
+
matchGroup(t, n) {
|
|
635
|
+
return !(n.name && t.name && !this.matchText(t.name, n.name));
|
|
636
|
+
}
|
|
637
|
+
// -- Helpers --
|
|
638
|
+
matchText(t, n) {
|
|
639
|
+
if (typeof n == "string")
|
|
640
|
+
return t === n;
|
|
641
|
+
if (n instanceof RegExp)
|
|
642
|
+
return n.test(t);
|
|
643
|
+
if (typeof n == "object" && n.pattern) {
|
|
644
|
+
const r = n.flags || "";
|
|
645
|
+
return new RegExp(n.pattern, r).test(t);
|
|
646
|
+
}
|
|
647
|
+
return !1;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
class Dt extends Q {
|
|
651
|
+
constructor(t) {
|
|
652
|
+
super(), this.layer = t;
|
|
653
|
+
}
|
|
654
|
+
matcher = new fe();
|
|
655
|
+
targetParticipantIds = /* @__PURE__ */ new Set();
|
|
656
|
+
transform(t) {
|
|
657
|
+
return this.resolveTargetParticipants(t), super.transform(t);
|
|
658
|
+
}
|
|
659
|
+
resolveTargetParticipants(t) {
|
|
660
|
+
this.targetParticipantIds.clear();
|
|
661
|
+
const n = this.layer.selector;
|
|
662
|
+
t.participants.forEach((r) => {
|
|
663
|
+
this.matcher.matchParticipant(r, n) && this.targetParticipantIds.add(r.id);
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
visitEvent(t) {
|
|
667
|
+
if (t.kind === "message") {
|
|
668
|
+
const n = t;
|
|
669
|
+
if (!this.isRelatedToParticipant(n))
|
|
670
|
+
return [];
|
|
671
|
+
}
|
|
672
|
+
if (t.kind === "note" && !t.participantIds.some((o) => this.targetParticipantIds.has(o)))
|
|
673
|
+
return [];
|
|
674
|
+
if (t.kind === "activation") {
|
|
675
|
+
const n = t;
|
|
676
|
+
if (!this.targetParticipantIds.has(n.participantId))
|
|
677
|
+
return [];
|
|
678
|
+
}
|
|
679
|
+
return super.visitEvent(t);
|
|
680
|
+
}
|
|
681
|
+
// Helper to check if message involves the participant from selector
|
|
682
|
+
isRelatedToParticipant(t) {
|
|
683
|
+
return !!(t.from && this.targetParticipantIds.has(t.from) || t.to && this.targetParticipantIds.has(t.to));
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
class Lt extends Q {
|
|
687
|
+
constructor(t) {
|
|
688
|
+
super(), this.layer = t;
|
|
689
|
+
}
|
|
690
|
+
matcher = new fe();
|
|
691
|
+
removedParticipantIds = /* @__PURE__ */ new Set();
|
|
692
|
+
transform(t) {
|
|
693
|
+
const n = this.layer.selector;
|
|
694
|
+
return n.kind === "participant" && (t.participants.forEach((r) => {
|
|
695
|
+
this.matcher.matchParticipant(r, n) && this.removedParticipantIds.add(r.id);
|
|
696
|
+
}), t.participants = t.participants.filter((r) => !this.removedParticipantIds.has(r.id))), n.kind === "group" && (t.groups = t.groups.filter((r) => !this.matcher.matchGroup(r, n))), super.transform(t);
|
|
697
|
+
}
|
|
698
|
+
visitEvent(t) {
|
|
699
|
+
const n = this.layer.selector;
|
|
700
|
+
if (n.kind === "message" && t.kind === "message" && this.matcher.matchMessage(t, n))
|
|
701
|
+
return [];
|
|
702
|
+
if (n.kind === "participant") {
|
|
703
|
+
if (t.kind === "message") {
|
|
704
|
+
const r = t;
|
|
705
|
+
if (this.isRelatedToRemovedParticipant(r)) return [];
|
|
706
|
+
}
|
|
707
|
+
if (t.kind === "note" && t.participantIds.some((i) => this.removedParticipantIds.has(i)))
|
|
708
|
+
return [];
|
|
709
|
+
if (t.kind === "activation") {
|
|
710
|
+
const r = t;
|
|
711
|
+
if (this.removedParticipantIds.has(r.participantId)) return [];
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return super.visitEvent(t);
|
|
715
|
+
}
|
|
716
|
+
isRelatedToRemovedParticipant(t) {
|
|
717
|
+
return !!(t.from && this.removedParticipantIds.has(t.from) || t.to && this.removedParticipantIds.has(t.to));
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
class Ft extends Q {
|
|
721
|
+
constructor(t) {
|
|
722
|
+
super(), this.layer = t;
|
|
723
|
+
}
|
|
724
|
+
matcher = new fe();
|
|
725
|
+
visitFragment(t) {
|
|
726
|
+
const n = t.branches.find(
|
|
727
|
+
(r) => this.matcher.matchBranch(r, this.layer.selector, t.operator)
|
|
728
|
+
);
|
|
729
|
+
return n ? this.mapEvents(n.events) : super.visitFragment(t);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
class Mt {
|
|
733
|
+
factories = /* @__PURE__ */ new Map();
|
|
734
|
+
constructor() {
|
|
735
|
+
this.register("resolve", (t) => new Ft(t)), this.register("focus", (t) => new Dt(t)), this.register("remove", (t) => new Lt(t));
|
|
736
|
+
}
|
|
737
|
+
register(t, n) {
|
|
738
|
+
this.factories.set(t, n);
|
|
739
|
+
}
|
|
740
|
+
get(t) {
|
|
741
|
+
const n = this.factories.get(t.action);
|
|
742
|
+
return n ? n(t) : null;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
const Ut = new Mt();
|
|
746
|
+
class ue {
|
|
747
|
+
transform(t, n) {
|
|
748
|
+
let r = t;
|
|
749
|
+
for (const o of n) {
|
|
750
|
+
const i = Ut.get(o);
|
|
751
|
+
i ? r = i.transform(r) : console.warn(`Unknown action: ${o.action}`);
|
|
752
|
+
}
|
|
753
|
+
return r = new xt().transform(r), r = new jt().transform(r), r;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function As(e) {
|
|
757
|
+
if (typeof e != "object" || e === null)
|
|
758
|
+
return !1;
|
|
759
|
+
const t = e;
|
|
760
|
+
if (Reflect.has(t, "name") && typeof t.name != "string" || !Array.isArray(t.layers))
|
|
761
|
+
return !1;
|
|
762
|
+
for (const n of t.layers)
|
|
763
|
+
if (!Jt(n))
|
|
764
|
+
return !1;
|
|
765
|
+
return !0;
|
|
766
|
+
}
|
|
767
|
+
function Jt(e) {
|
|
768
|
+
if (typeof e != "object" || e === null)
|
|
769
|
+
return !1;
|
|
770
|
+
const t = e;
|
|
771
|
+
return !(typeof t.action != "string" || !["focus", "remove", "resolve"].includes(t.action) || typeof t.selector != "object" || t.selector === null || typeof t.selector.kind != "string");
|
|
772
|
+
}
|
|
773
|
+
function Rs(e, t) {
|
|
774
|
+
return new ue().transform(e, t.layers);
|
|
775
|
+
}
|
|
776
|
+
class Cs {
|
|
777
|
+
constructor() {
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* Initialize a new Polagram transformation pipeline.
|
|
781
|
+
* @param code Source diagram code
|
|
782
|
+
* @param format Input format (currently only 'mermaid' is supported)
|
|
783
|
+
*/
|
|
784
|
+
static init(t, n = "mermaid") {
|
|
785
|
+
const o = ce.getParser(n).parse(t);
|
|
786
|
+
return new Vt(o);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
class Vt {
|
|
790
|
+
ast;
|
|
791
|
+
layers = [];
|
|
792
|
+
constructor(t) {
|
|
793
|
+
this.ast = t;
|
|
794
|
+
}
|
|
795
|
+
// -- Entity Filtering --
|
|
796
|
+
/**
|
|
797
|
+
* Focus on specific participants.
|
|
798
|
+
* Keeps only interactions involving the matched participants.
|
|
799
|
+
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
800
|
+
*/
|
|
801
|
+
focusParticipant(t) {
|
|
802
|
+
return this.layers.push({
|
|
803
|
+
action: "focus",
|
|
804
|
+
selector: this.normalizeParticipantSelector(t)
|
|
805
|
+
}), this;
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Remove specific participants and their interactions.
|
|
809
|
+
* @param selector Name (string/RegExp) or detailed ParticipantSelector
|
|
810
|
+
*/
|
|
811
|
+
removeParticipant(t) {
|
|
812
|
+
return this.layers.push({
|
|
813
|
+
action: "remove",
|
|
814
|
+
selector: this.normalizeParticipantSelector(t)
|
|
815
|
+
}), this;
|
|
816
|
+
}
|
|
817
|
+
// -- Message Filtering --
|
|
818
|
+
/**
|
|
819
|
+
* Remove specific messages.
|
|
820
|
+
* @param selector Message text (string/RegExp) or detailed MessageSelector
|
|
821
|
+
*/
|
|
822
|
+
removeMessage(t) {
|
|
823
|
+
return this.layers.push({
|
|
824
|
+
action: "remove",
|
|
825
|
+
selector: this.normalizeMessageSelector(t)
|
|
826
|
+
}), this;
|
|
827
|
+
}
|
|
828
|
+
// -- Group Filtering --
|
|
829
|
+
/**
|
|
830
|
+
* Remove specific groups (visual boxes).
|
|
831
|
+
* @param selector Group name (string/RegExp) or detailed GroupSelector
|
|
832
|
+
*/
|
|
833
|
+
removeGroup(t) {
|
|
834
|
+
return this.layers.push({
|
|
835
|
+
action: "remove",
|
|
836
|
+
selector: this.normalizeGroupSelector(t)
|
|
837
|
+
}), this;
|
|
838
|
+
}
|
|
839
|
+
// -- Structural Resolution --
|
|
840
|
+
/**
|
|
841
|
+
* Resolve (unwrap) specific fragments like 'alt', 'opt', 'loop'.
|
|
842
|
+
* Promotes the content of the matched branch and removes the wrapper.
|
|
843
|
+
* @param selector Condition text (string/RegExp) or detailed FragmentSelector
|
|
844
|
+
*/
|
|
845
|
+
resolveFragment(t) {
|
|
846
|
+
return this.layers.push({
|
|
847
|
+
action: "resolve",
|
|
848
|
+
selector: this.normalizeFragmentSelector(t)
|
|
849
|
+
}), this;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Apply a Lens (a named set of transformation layers).
|
|
853
|
+
* @param lens Lens object containing layers
|
|
854
|
+
*/
|
|
855
|
+
applyLens(t) {
|
|
856
|
+
return this.layers.push(...t.layers), this;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Generate Mermaid code from the transformed AST.
|
|
860
|
+
*/
|
|
861
|
+
toMermaid() {
|
|
862
|
+
const n = new ue().transform(this.ast, this.layers);
|
|
863
|
+
return new Ct().generate(n);
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Get the transformed AST (for advanced use cases).
|
|
867
|
+
*/
|
|
868
|
+
toAST() {
|
|
869
|
+
return new ue().transform(this.ast, this.layers);
|
|
870
|
+
}
|
|
871
|
+
// -- Helper Methods --
|
|
872
|
+
normalizeParticipantSelector(t) {
|
|
873
|
+
return this.isTextMatcher(t) ? { kind: "participant", name: t } : { kind: "participant", ...t };
|
|
874
|
+
}
|
|
875
|
+
normalizeMessageSelector(t) {
|
|
876
|
+
return this.isTextMatcher(t) ? { kind: "message", text: t } : { kind: "message", ...t };
|
|
877
|
+
}
|
|
878
|
+
normalizeGroupSelector(t) {
|
|
879
|
+
return this.isTextMatcher(t) ? { kind: "group", name: t } : { kind: "group", ...t };
|
|
880
|
+
}
|
|
881
|
+
normalizeFragmentSelector(t) {
|
|
882
|
+
return this.isTextMatcher(t) ? { kind: "fragment", condition: t } : { kind: "fragment", ...t };
|
|
883
|
+
}
|
|
884
|
+
isTextMatcher(t) {
|
|
885
|
+
return typeof t == "string" || t instanceof RegExp || typeof t == "object" && t !== null && "pattern" in t && !("kind" in t);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
function c(e, t, n) {
|
|
889
|
+
function r(a, u) {
|
|
890
|
+
if (a._zod || Object.defineProperty(a, "_zod", {
|
|
891
|
+
value: {
|
|
892
|
+
def: u,
|
|
893
|
+
constr: s,
|
|
894
|
+
traits: /* @__PURE__ */ new Set()
|
|
895
|
+
},
|
|
896
|
+
enumerable: !1
|
|
897
|
+
}), a._zod.traits.has(e))
|
|
898
|
+
return;
|
|
899
|
+
a._zod.traits.add(e), t(a, u);
|
|
900
|
+
const l = s.prototype, p = Object.keys(l);
|
|
901
|
+
for (let f = 0; f < p.length; f++) {
|
|
902
|
+
const d = p[f];
|
|
903
|
+
d in a || (a[d] = l[d].bind(a));
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
const o = n?.Parent ?? Object;
|
|
907
|
+
class i extends o {
|
|
908
|
+
}
|
|
909
|
+
Object.defineProperty(i, "name", { value: e });
|
|
910
|
+
function s(a) {
|
|
911
|
+
var u;
|
|
912
|
+
const l = n?.Parent ? new i() : this;
|
|
913
|
+
r(l, a), (u = l._zod).deferred ?? (u.deferred = []);
|
|
914
|
+
for (const p of l._zod.deferred)
|
|
915
|
+
p();
|
|
916
|
+
return l;
|
|
917
|
+
}
|
|
918
|
+
return Object.defineProperty(s, "init", { value: r }), Object.defineProperty(s, Symbol.hasInstance, {
|
|
919
|
+
value: (a) => n?.Parent && a instanceof n.Parent ? !0 : a?._zod?.traits?.has(e)
|
|
920
|
+
}), Object.defineProperty(s, "name", { value: e }), s;
|
|
921
|
+
}
|
|
922
|
+
class D extends Error {
|
|
923
|
+
constructor() {
|
|
924
|
+
super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
class We extends Error {
|
|
928
|
+
constructor(t) {
|
|
929
|
+
super(`Encountered unidirectional transform during encode: ${t}`), this.name = "ZodEncodeError";
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
const Be = {};
|
|
933
|
+
function A(e) {
|
|
934
|
+
return Be;
|
|
935
|
+
}
|
|
936
|
+
function Ke(e) {
|
|
937
|
+
const t = Object.values(e).filter((r) => typeof r == "number");
|
|
938
|
+
return Object.entries(e).filter(([r, o]) => t.indexOf(+r) === -1).map(([r, o]) => o);
|
|
939
|
+
}
|
|
940
|
+
function le(e, t) {
|
|
941
|
+
return typeof t == "bigint" ? t.toString() : t;
|
|
942
|
+
}
|
|
943
|
+
function ee(e) {
|
|
944
|
+
return {
|
|
945
|
+
get value() {
|
|
946
|
+
{
|
|
947
|
+
const t = e();
|
|
948
|
+
return Object.defineProperty(this, "value", { value: t }), t;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
function de(e) {
|
|
954
|
+
return e == null;
|
|
955
|
+
}
|
|
956
|
+
function me(e) {
|
|
957
|
+
const t = e.startsWith("^") ? 1 : 0, n = e.endsWith("$") ? e.length - 1 : e.length;
|
|
958
|
+
return e.slice(t, n);
|
|
959
|
+
}
|
|
960
|
+
function Gt(e, t) {
|
|
961
|
+
const n = (e.toString().split(".")[1] || "").length, r = t.toString();
|
|
962
|
+
let o = (r.split(".")[1] || "").length;
|
|
963
|
+
if (o === 0 && /\d?e-\d?/.test(r)) {
|
|
964
|
+
const u = r.match(/\d?e-(\d?)/);
|
|
965
|
+
u?.[1] && (o = Number.parseInt(u[1]));
|
|
966
|
+
}
|
|
967
|
+
const i = n > o ? n : o, s = Number.parseInt(e.toFixed(i).replace(".", "")), a = Number.parseInt(t.toFixed(i).replace(".", ""));
|
|
968
|
+
return s % a / 10 ** i;
|
|
969
|
+
}
|
|
970
|
+
const ze = /* @__PURE__ */ Symbol("evaluating");
|
|
971
|
+
function m(e, t, n) {
|
|
972
|
+
let r;
|
|
973
|
+
Object.defineProperty(e, t, {
|
|
974
|
+
get() {
|
|
975
|
+
if (r !== ze)
|
|
976
|
+
return r === void 0 && (r = ze, r = n()), r;
|
|
977
|
+
},
|
|
978
|
+
set(o) {
|
|
979
|
+
Object.defineProperty(e, t, {
|
|
980
|
+
value: o
|
|
981
|
+
// configurable: true,
|
|
982
|
+
});
|
|
983
|
+
},
|
|
984
|
+
configurable: !0
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
function C(e, t, n) {
|
|
988
|
+
Object.defineProperty(e, t, {
|
|
989
|
+
value: n,
|
|
990
|
+
writable: !0,
|
|
991
|
+
enumerable: !0,
|
|
992
|
+
configurable: !0
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
function x(...e) {
|
|
996
|
+
const t = {};
|
|
997
|
+
for (const n of e) {
|
|
998
|
+
const r = Object.getOwnPropertyDescriptors(n);
|
|
999
|
+
Object.assign(t, r);
|
|
1000
|
+
}
|
|
1001
|
+
return Object.defineProperties({}, t);
|
|
1002
|
+
}
|
|
1003
|
+
function $e(e) {
|
|
1004
|
+
return JSON.stringify(e);
|
|
1005
|
+
}
|
|
1006
|
+
function Wt(e) {
|
|
1007
|
+
return e.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1008
|
+
}
|
|
1009
|
+
const qe = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {
|
|
1010
|
+
};
|
|
1011
|
+
function J(e) {
|
|
1012
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
1013
|
+
}
|
|
1014
|
+
const Bt = ee(() => {
|
|
1015
|
+
if (typeof navigator < "u" && navigator?.userAgent?.includes("Cloudflare"))
|
|
1016
|
+
return !1;
|
|
1017
|
+
try {
|
|
1018
|
+
const e = Function;
|
|
1019
|
+
return new e(""), !0;
|
|
1020
|
+
} catch {
|
|
1021
|
+
return !1;
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
function V(e) {
|
|
1025
|
+
if (J(e) === !1)
|
|
1026
|
+
return !1;
|
|
1027
|
+
const t = e.constructor;
|
|
1028
|
+
if (t === void 0 || typeof t != "function")
|
|
1029
|
+
return !0;
|
|
1030
|
+
const n = t.prototype;
|
|
1031
|
+
return !(J(n) === !1 || Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") === !1);
|
|
1032
|
+
}
|
|
1033
|
+
function Xe(e) {
|
|
1034
|
+
return V(e) ? { ...e } : Array.isArray(e) ? [...e] : e;
|
|
1035
|
+
}
|
|
1036
|
+
const Kt = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
1037
|
+
function L(e) {
|
|
1038
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1039
|
+
}
|
|
1040
|
+
function P(e, t, n) {
|
|
1041
|
+
const r = new e._zod.constr(t ?? e._zod.def);
|
|
1042
|
+
return (!t || n?.parent) && (r._zod.parent = e), r;
|
|
1043
|
+
}
|
|
1044
|
+
function h(e) {
|
|
1045
|
+
const t = e;
|
|
1046
|
+
if (!t)
|
|
1047
|
+
return {};
|
|
1048
|
+
if (typeof t == "string")
|
|
1049
|
+
return { error: () => t };
|
|
1050
|
+
if (t?.message !== void 0) {
|
|
1051
|
+
if (t?.error !== void 0)
|
|
1052
|
+
throw new Error("Cannot specify both `message` and `error` params");
|
|
1053
|
+
t.error = t.message;
|
|
1054
|
+
}
|
|
1055
|
+
return delete t.message, typeof t.error == "string" ? { ...t, error: () => t.error } : t;
|
|
1056
|
+
}
|
|
1057
|
+
function qt(e) {
|
|
1058
|
+
return Object.keys(e).filter((t) => e[t]._zod.optin === "optional" && e[t]._zod.optout === "optional");
|
|
1059
|
+
}
|
|
1060
|
+
const Xt = {
|
|
1061
|
+
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1062
|
+
int32: [-2147483648, 2147483647],
|
|
1063
|
+
uint32: [0, 4294967295],
|
|
1064
|
+
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1065
|
+
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1066
|
+
};
|
|
1067
|
+
function Yt(e, t) {
|
|
1068
|
+
const n = e._zod.def, r = x(e._zod.def, {
|
|
1069
|
+
get shape() {
|
|
1070
|
+
const o = {};
|
|
1071
|
+
for (const i in t) {
|
|
1072
|
+
if (!(i in n.shape))
|
|
1073
|
+
throw new Error(`Unrecognized key: "${i}"`);
|
|
1074
|
+
t[i] && (o[i] = n.shape[i]);
|
|
1075
|
+
}
|
|
1076
|
+
return C(this, "shape", o), o;
|
|
1077
|
+
},
|
|
1078
|
+
checks: []
|
|
1079
|
+
});
|
|
1080
|
+
return P(e, r);
|
|
1081
|
+
}
|
|
1082
|
+
function Ht(e, t) {
|
|
1083
|
+
const n = e._zod.def, r = x(e._zod.def, {
|
|
1084
|
+
get shape() {
|
|
1085
|
+
const o = { ...e._zod.def.shape };
|
|
1086
|
+
for (const i in t) {
|
|
1087
|
+
if (!(i in n.shape))
|
|
1088
|
+
throw new Error(`Unrecognized key: "${i}"`);
|
|
1089
|
+
t[i] && delete o[i];
|
|
1090
|
+
}
|
|
1091
|
+
return C(this, "shape", o), o;
|
|
1092
|
+
},
|
|
1093
|
+
checks: []
|
|
1094
|
+
});
|
|
1095
|
+
return P(e, r);
|
|
1096
|
+
}
|
|
1097
|
+
function Qt(e, t) {
|
|
1098
|
+
if (!V(t))
|
|
1099
|
+
throw new Error("Invalid input to extend: expected a plain object");
|
|
1100
|
+
const n = e._zod.def.checks;
|
|
1101
|
+
if (n && n.length > 0)
|
|
1102
|
+
throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
|
|
1103
|
+
const o = x(e._zod.def, {
|
|
1104
|
+
get shape() {
|
|
1105
|
+
const i = { ...e._zod.def.shape, ...t };
|
|
1106
|
+
return C(this, "shape", i), i;
|
|
1107
|
+
},
|
|
1108
|
+
checks: []
|
|
1109
|
+
});
|
|
1110
|
+
return P(e, o);
|
|
1111
|
+
}
|
|
1112
|
+
function en(e, t) {
|
|
1113
|
+
if (!V(t))
|
|
1114
|
+
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1115
|
+
const n = {
|
|
1116
|
+
...e._zod.def,
|
|
1117
|
+
get shape() {
|
|
1118
|
+
const r = { ...e._zod.def.shape, ...t };
|
|
1119
|
+
return C(this, "shape", r), r;
|
|
1120
|
+
},
|
|
1121
|
+
checks: e._zod.def.checks
|
|
1122
|
+
};
|
|
1123
|
+
return P(e, n);
|
|
1124
|
+
}
|
|
1125
|
+
function tn(e, t) {
|
|
1126
|
+
const n = x(e._zod.def, {
|
|
1127
|
+
get shape() {
|
|
1128
|
+
const r = { ...e._zod.def.shape, ...t._zod.def.shape };
|
|
1129
|
+
return C(this, "shape", r), r;
|
|
1130
|
+
},
|
|
1131
|
+
get catchall() {
|
|
1132
|
+
return t._zod.def.catchall;
|
|
1133
|
+
},
|
|
1134
|
+
checks: []
|
|
1135
|
+
// delete existing checks
|
|
1136
|
+
});
|
|
1137
|
+
return P(e, n);
|
|
1138
|
+
}
|
|
1139
|
+
function nn(e, t, n) {
|
|
1140
|
+
const r = x(t._zod.def, {
|
|
1141
|
+
get shape() {
|
|
1142
|
+
const o = t._zod.def.shape, i = { ...o };
|
|
1143
|
+
if (n)
|
|
1144
|
+
for (const s in n) {
|
|
1145
|
+
if (!(s in o))
|
|
1146
|
+
throw new Error(`Unrecognized key: "${s}"`);
|
|
1147
|
+
n[s] && (i[s] = e ? new e({
|
|
1148
|
+
type: "optional",
|
|
1149
|
+
innerType: o[s]
|
|
1150
|
+
}) : o[s]);
|
|
1151
|
+
}
|
|
1152
|
+
else
|
|
1153
|
+
for (const s in o)
|
|
1154
|
+
i[s] = e ? new e({
|
|
1155
|
+
type: "optional",
|
|
1156
|
+
innerType: o[s]
|
|
1157
|
+
}) : o[s];
|
|
1158
|
+
return C(this, "shape", i), i;
|
|
1159
|
+
},
|
|
1160
|
+
checks: []
|
|
1161
|
+
});
|
|
1162
|
+
return P(t, r);
|
|
1163
|
+
}
|
|
1164
|
+
function rn(e, t, n) {
|
|
1165
|
+
const r = x(t._zod.def, {
|
|
1166
|
+
get shape() {
|
|
1167
|
+
const o = t._zod.def.shape, i = { ...o };
|
|
1168
|
+
if (n)
|
|
1169
|
+
for (const s in n) {
|
|
1170
|
+
if (!(s in i))
|
|
1171
|
+
throw new Error(`Unrecognized key: "${s}"`);
|
|
1172
|
+
n[s] && (i[s] = new e({
|
|
1173
|
+
type: "nonoptional",
|
|
1174
|
+
innerType: o[s]
|
|
1175
|
+
}));
|
|
1176
|
+
}
|
|
1177
|
+
else
|
|
1178
|
+
for (const s in o)
|
|
1179
|
+
i[s] = new e({
|
|
1180
|
+
type: "nonoptional",
|
|
1181
|
+
innerType: o[s]
|
|
1182
|
+
});
|
|
1183
|
+
return C(this, "shape", i), i;
|
|
1184
|
+
},
|
|
1185
|
+
checks: []
|
|
1186
|
+
});
|
|
1187
|
+
return P(t, r);
|
|
1188
|
+
}
|
|
1189
|
+
function j(e, t = 0) {
|
|
1190
|
+
if (e.aborted === !0)
|
|
1191
|
+
return !0;
|
|
1192
|
+
for (let n = t; n < e.issues.length; n++)
|
|
1193
|
+
if (e.issues[n]?.continue !== !0)
|
|
1194
|
+
return !0;
|
|
1195
|
+
return !1;
|
|
1196
|
+
}
|
|
1197
|
+
function Ye(e, t) {
|
|
1198
|
+
return t.map((n) => {
|
|
1199
|
+
var r;
|
|
1200
|
+
return (r = n).path ?? (r.path = []), n.path.unshift(e), n;
|
|
1201
|
+
});
|
|
1202
|
+
}
|
|
1203
|
+
function W(e) {
|
|
1204
|
+
return typeof e == "string" ? e : e?.message;
|
|
1205
|
+
}
|
|
1206
|
+
function R(e, t, n) {
|
|
1207
|
+
const r = { ...e, path: e.path ?? [] };
|
|
1208
|
+
if (!e.message) {
|
|
1209
|
+
const o = W(e.inst?._zod.def?.error?.(e)) ?? W(t?.error?.(e)) ?? W(n.customError?.(e)) ?? W(n.localeError?.(e)) ?? "Invalid input";
|
|
1210
|
+
r.message = o;
|
|
1211
|
+
}
|
|
1212
|
+
return delete r.inst, delete r.continue, t?.reportInput || delete r.input, r;
|
|
1213
|
+
}
|
|
1214
|
+
function ge(e) {
|
|
1215
|
+
return Array.isArray(e) ? "array" : typeof e == "string" ? "string" : "unknown";
|
|
1216
|
+
}
|
|
1217
|
+
function G(...e) {
|
|
1218
|
+
const [t, n, r] = e;
|
|
1219
|
+
return typeof t == "string" ? {
|
|
1220
|
+
message: t,
|
|
1221
|
+
code: "custom",
|
|
1222
|
+
input: n,
|
|
1223
|
+
inst: r
|
|
1224
|
+
} : { ...t };
|
|
1225
|
+
}
|
|
1226
|
+
const He = (e, t) => {
|
|
1227
|
+
e.name = "$ZodError", Object.defineProperty(e, "_zod", {
|
|
1228
|
+
value: e._zod,
|
|
1229
|
+
enumerable: !1
|
|
1230
|
+
}), Object.defineProperty(e, "issues", {
|
|
1231
|
+
value: t,
|
|
1232
|
+
enumerable: !1
|
|
1233
|
+
}), e.message = JSON.stringify(t, le, 2), Object.defineProperty(e, "toString", {
|
|
1234
|
+
value: () => e.message,
|
|
1235
|
+
enumerable: !1
|
|
1236
|
+
});
|
|
1237
|
+
}, Qe = c("$ZodError", He), et = c("$ZodError", He, { Parent: Error });
|
|
1238
|
+
function on(e, t = (n) => n.message) {
|
|
1239
|
+
const n = {}, r = [];
|
|
1240
|
+
for (const o of e.issues)
|
|
1241
|
+
o.path.length > 0 ? (n[o.path[0]] = n[o.path[0]] || [], n[o.path[0]].push(t(o))) : r.push(t(o));
|
|
1242
|
+
return { formErrors: r, fieldErrors: n };
|
|
1243
|
+
}
|
|
1244
|
+
function sn(e, t = (n) => n.message) {
|
|
1245
|
+
const n = { _errors: [] }, r = (o) => {
|
|
1246
|
+
for (const i of o.issues)
|
|
1247
|
+
if (i.code === "invalid_union" && i.errors.length)
|
|
1248
|
+
i.errors.map((s) => r({ issues: s }));
|
|
1249
|
+
else if (i.code === "invalid_key")
|
|
1250
|
+
r({ issues: i.issues });
|
|
1251
|
+
else if (i.code === "invalid_element")
|
|
1252
|
+
r({ issues: i.issues });
|
|
1253
|
+
else if (i.path.length === 0)
|
|
1254
|
+
n._errors.push(t(i));
|
|
1255
|
+
else {
|
|
1256
|
+
let s = n, a = 0;
|
|
1257
|
+
for (; a < i.path.length; ) {
|
|
1258
|
+
const u = i.path[a];
|
|
1259
|
+
a === i.path.length - 1 ? (s[u] = s[u] || { _errors: [] }, s[u]._errors.push(t(i))) : s[u] = s[u] || { _errors: [] }, s = s[u], a++;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
};
|
|
1263
|
+
return r(e), n;
|
|
1264
|
+
}
|
|
1265
|
+
const ve = (e) => (t, n, r, o) => {
|
|
1266
|
+
const i = r ? Object.assign(r, { async: !1 }) : { async: !1 }, s = t._zod.run({ value: n, issues: [] }, i);
|
|
1267
|
+
if (s instanceof Promise)
|
|
1268
|
+
throw new D();
|
|
1269
|
+
if (s.issues.length) {
|
|
1270
|
+
const a = new (o?.Err ?? e)(s.issues.map((u) => R(u, i, A())));
|
|
1271
|
+
throw qe(a, o?.callee), a;
|
|
1272
|
+
}
|
|
1273
|
+
return s.value;
|
|
1274
|
+
}, _e = (e) => async (t, n, r, o) => {
|
|
1275
|
+
const i = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
1276
|
+
let s = t._zod.run({ value: n, issues: [] }, i);
|
|
1277
|
+
if (s instanceof Promise && (s = await s), s.issues.length) {
|
|
1278
|
+
const a = new (o?.Err ?? e)(s.issues.map((u) => R(u, i, A())));
|
|
1279
|
+
throw qe(a, o?.callee), a;
|
|
1280
|
+
}
|
|
1281
|
+
return s.value;
|
|
1282
|
+
}, te = (e) => (t, n, r) => {
|
|
1283
|
+
const o = r ? { ...r, async: !1 } : { async: !1 }, i = t._zod.run({ value: n, issues: [] }, o);
|
|
1284
|
+
if (i instanceof Promise)
|
|
1285
|
+
throw new D();
|
|
1286
|
+
return i.issues.length ? {
|
|
1287
|
+
success: !1,
|
|
1288
|
+
error: new (e ?? Qe)(i.issues.map((s) => R(s, o, A())))
|
|
1289
|
+
} : { success: !0, data: i.value };
|
|
1290
|
+
}, an = /* @__PURE__ */ te(et), ne = (e) => async (t, n, r) => {
|
|
1291
|
+
const o = r ? Object.assign(r, { async: !0 }) : { async: !0 };
|
|
1292
|
+
let i = t._zod.run({ value: n, issues: [] }, o);
|
|
1293
|
+
return i instanceof Promise && (i = await i), i.issues.length ? {
|
|
1294
|
+
success: !1,
|
|
1295
|
+
error: new e(i.issues.map((s) => R(s, o, A())))
|
|
1296
|
+
} : { success: !0, data: i.value };
|
|
1297
|
+
}, cn = /* @__PURE__ */ ne(et), un = (e) => (t, n, r) => {
|
|
1298
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1299
|
+
return ve(e)(t, n, o);
|
|
1300
|
+
}, ln = (e) => (t, n, r) => ve(e)(t, n, r), pn = (e) => async (t, n, r) => {
|
|
1301
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1302
|
+
return _e(e)(t, n, o);
|
|
1303
|
+
}, hn = (e) => async (t, n, r) => _e(e)(t, n, r), fn = (e) => (t, n, r) => {
|
|
1304
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1305
|
+
return te(e)(t, n, o);
|
|
1306
|
+
}, dn = (e) => (t, n, r) => te(e)(t, n, r), mn = (e) => async (t, n, r) => {
|
|
1307
|
+
const o = r ? Object.assign(r, { direction: "backward" }) : { direction: "backward" };
|
|
1308
|
+
return ne(e)(t, n, o);
|
|
1309
|
+
}, gn = (e) => async (t, n, r) => ne(e)(t, n, r), vn = /^[cC][^\s-]{8,}$/, _n = /^[0-9a-z]+$/, yn = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/, kn = /^[0-9a-vA-V]{20}$/, wn = /^[A-Za-z0-9]{27}$/, bn = /^[a-zA-Z0-9_-]{21}$/, zn = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/, $n = /^([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})$/, Te = (e) => e ? new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`) : /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/, Tn = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/, Zn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1310
|
+
function In() {
|
|
1311
|
+
return new RegExp(Zn, "u");
|
|
1312
|
+
}
|
|
1313
|
+
const En = /^(?:(?: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])$/, Sn = /^(([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}|:))$/, On = /^((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])$/, Pn = /^(([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])$/, Nn = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/, tt = /^[A-Za-z0-9_-]*$/, An = /^\+(?:[0-9]){6,14}[0-9]$/, nt = "(?:(?:\\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])))", Rn = /* @__PURE__ */ new RegExp(`^${nt}$`);
|
|
1314
|
+
function rt(e) {
|
|
1315
|
+
const t = "(?:[01]\\d|2[0-3]):[0-5]\\d";
|
|
1316
|
+
return typeof e.precision == "number" ? e.precision === -1 ? `${t}` : e.precision === 0 ? `${t}:[0-5]\\d` : `${t}:[0-5]\\d\\.\\d{${e.precision}}` : `${t}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1317
|
+
}
|
|
1318
|
+
function Cn(e) {
|
|
1319
|
+
return new RegExp(`^${rt(e)}$`);
|
|
1320
|
+
}
|
|
1321
|
+
function xn(e) {
|
|
1322
|
+
const t = rt({ precision: e.precision }), n = ["Z"];
|
|
1323
|
+
e.local && n.push(""), e.offset && n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
|
|
1324
|
+
const r = `${t}(?:${n.join("|")})`;
|
|
1325
|
+
return new RegExp(`^${nt}T(?:${r})$`);
|
|
1326
|
+
}
|
|
1327
|
+
const jn = (e) => {
|
|
1328
|
+
const t = e ? `[\\s\\S]{${e?.minimum ?? 0},${e?.maximum ?? ""}}` : "[\\s\\S]*";
|
|
1329
|
+
return new RegExp(`^${t}$`);
|
|
1330
|
+
}, Dn = /^-?\d+$/, Ln = /^-?\d+(?:\.\d+)?/, Fn = /^[^A-Z]*$/, Mn = /^[^a-z]*$/, z = /* @__PURE__ */ c("$ZodCheck", (e, t) => {
|
|
1331
|
+
var n;
|
|
1332
|
+
e._zod ?? (e._zod = {}), e._zod.def = t, (n = e._zod).onattach ?? (n.onattach = []);
|
|
1333
|
+
}), ot = {
|
|
1334
|
+
number: "number",
|
|
1335
|
+
bigint: "bigint",
|
|
1336
|
+
object: "date"
|
|
1337
|
+
}, it = /* @__PURE__ */ c("$ZodCheckLessThan", (e, t) => {
|
|
1338
|
+
z.init(e, t);
|
|
1339
|
+
const n = ot[typeof t.value];
|
|
1340
|
+
e._zod.onattach.push((r) => {
|
|
1341
|
+
const o = r._zod.bag, i = (t.inclusive ? o.maximum : o.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1342
|
+
t.value < i && (t.inclusive ? o.maximum = t.value : o.exclusiveMaximum = t.value);
|
|
1343
|
+
}), e._zod.check = (r) => {
|
|
1344
|
+
(t.inclusive ? r.value <= t.value : r.value < t.value) || r.issues.push({
|
|
1345
|
+
origin: n,
|
|
1346
|
+
code: "too_big",
|
|
1347
|
+
maximum: t.value,
|
|
1348
|
+
input: r.value,
|
|
1349
|
+
inclusive: t.inclusive,
|
|
1350
|
+
inst: e,
|
|
1351
|
+
continue: !t.abort
|
|
1352
|
+
});
|
|
1353
|
+
};
|
|
1354
|
+
}), st = /* @__PURE__ */ c("$ZodCheckGreaterThan", (e, t) => {
|
|
1355
|
+
z.init(e, t);
|
|
1356
|
+
const n = ot[typeof t.value];
|
|
1357
|
+
e._zod.onattach.push((r) => {
|
|
1358
|
+
const o = r._zod.bag, i = (t.inclusive ? o.minimum : o.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1359
|
+
t.value > i && (t.inclusive ? o.minimum = t.value : o.exclusiveMinimum = t.value);
|
|
1360
|
+
}), e._zod.check = (r) => {
|
|
1361
|
+
(t.inclusive ? r.value >= t.value : r.value > t.value) || r.issues.push({
|
|
1362
|
+
origin: n,
|
|
1363
|
+
code: "too_small",
|
|
1364
|
+
minimum: t.value,
|
|
1365
|
+
input: r.value,
|
|
1366
|
+
inclusive: t.inclusive,
|
|
1367
|
+
inst: e,
|
|
1368
|
+
continue: !t.abort
|
|
1369
|
+
});
|
|
1370
|
+
};
|
|
1371
|
+
}), Un = /* @__PURE__ */ c("$ZodCheckMultipleOf", (e, t) => {
|
|
1372
|
+
z.init(e, t), e._zod.onattach.push((n) => {
|
|
1373
|
+
var r;
|
|
1374
|
+
(r = n._zod.bag).multipleOf ?? (r.multipleOf = t.value);
|
|
1375
|
+
}), e._zod.check = (n) => {
|
|
1376
|
+
if (typeof n.value != typeof t.value)
|
|
1377
|
+
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1378
|
+
(typeof n.value == "bigint" ? n.value % t.value === BigInt(0) : Gt(n.value, t.value) === 0) || n.issues.push({
|
|
1379
|
+
origin: typeof n.value,
|
|
1380
|
+
code: "not_multiple_of",
|
|
1381
|
+
divisor: t.value,
|
|
1382
|
+
input: n.value,
|
|
1383
|
+
inst: e,
|
|
1384
|
+
continue: !t.abort
|
|
1385
|
+
});
|
|
1386
|
+
};
|
|
1387
|
+
}), Jn = /* @__PURE__ */ c("$ZodCheckNumberFormat", (e, t) => {
|
|
1388
|
+
z.init(e, t), t.format = t.format || "float64";
|
|
1389
|
+
const n = t.format?.includes("int"), r = n ? "int" : "number", [o, i] = Xt[t.format];
|
|
1390
|
+
e._zod.onattach.push((s) => {
|
|
1391
|
+
const a = s._zod.bag;
|
|
1392
|
+
a.format = t.format, a.minimum = o, a.maximum = i, n && (a.pattern = Dn);
|
|
1393
|
+
}), e._zod.check = (s) => {
|
|
1394
|
+
const a = s.value;
|
|
1395
|
+
if (n) {
|
|
1396
|
+
if (!Number.isInteger(a)) {
|
|
1397
|
+
s.issues.push({
|
|
1398
|
+
expected: r,
|
|
1399
|
+
format: t.format,
|
|
1400
|
+
code: "invalid_type",
|
|
1401
|
+
continue: !1,
|
|
1402
|
+
input: a,
|
|
1403
|
+
inst: e
|
|
1404
|
+
});
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
if (!Number.isSafeInteger(a)) {
|
|
1408
|
+
a > 0 ? s.issues.push({
|
|
1409
|
+
input: a,
|
|
1410
|
+
code: "too_big",
|
|
1411
|
+
maximum: Number.MAX_SAFE_INTEGER,
|
|
1412
|
+
note: "Integers must be within the safe integer range.",
|
|
1413
|
+
inst: e,
|
|
1414
|
+
origin: r,
|
|
1415
|
+
continue: !t.abort
|
|
1416
|
+
}) : s.issues.push({
|
|
1417
|
+
input: a,
|
|
1418
|
+
code: "too_small",
|
|
1419
|
+
minimum: Number.MIN_SAFE_INTEGER,
|
|
1420
|
+
note: "Integers must be within the safe integer range.",
|
|
1421
|
+
inst: e,
|
|
1422
|
+
origin: r,
|
|
1423
|
+
continue: !t.abort
|
|
1424
|
+
});
|
|
1425
|
+
return;
|
|
1426
|
+
}
|
|
1427
|
+
}
|
|
1428
|
+
a < o && s.issues.push({
|
|
1429
|
+
origin: "number",
|
|
1430
|
+
input: a,
|
|
1431
|
+
code: "too_small",
|
|
1432
|
+
minimum: o,
|
|
1433
|
+
inclusive: !0,
|
|
1434
|
+
inst: e,
|
|
1435
|
+
continue: !t.abort
|
|
1436
|
+
}), a > i && s.issues.push({
|
|
1437
|
+
origin: "number",
|
|
1438
|
+
input: a,
|
|
1439
|
+
code: "too_big",
|
|
1440
|
+
maximum: i,
|
|
1441
|
+
inst: e
|
|
1442
|
+
});
|
|
1443
|
+
};
|
|
1444
|
+
}), Vn = /* @__PURE__ */ c("$ZodCheckMaxLength", (e, t) => {
|
|
1445
|
+
var n;
|
|
1446
|
+
z.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1447
|
+
const o = r.value;
|
|
1448
|
+
return !de(o) && o.length !== void 0;
|
|
1449
|
+
}), e._zod.onattach.push((r) => {
|
|
1450
|
+
const o = r._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1451
|
+
t.maximum < o && (r._zod.bag.maximum = t.maximum);
|
|
1452
|
+
}), e._zod.check = (r) => {
|
|
1453
|
+
const o = r.value;
|
|
1454
|
+
if (o.length <= t.maximum)
|
|
1455
|
+
return;
|
|
1456
|
+
const s = ge(o);
|
|
1457
|
+
r.issues.push({
|
|
1458
|
+
origin: s,
|
|
1459
|
+
code: "too_big",
|
|
1460
|
+
maximum: t.maximum,
|
|
1461
|
+
inclusive: !0,
|
|
1462
|
+
input: o,
|
|
1463
|
+
inst: e,
|
|
1464
|
+
continue: !t.abort
|
|
1465
|
+
});
|
|
1466
|
+
};
|
|
1467
|
+
}), Gn = /* @__PURE__ */ c("$ZodCheckMinLength", (e, t) => {
|
|
1468
|
+
var n;
|
|
1469
|
+
z.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1470
|
+
const o = r.value;
|
|
1471
|
+
return !de(o) && o.length !== void 0;
|
|
1472
|
+
}), e._zod.onattach.push((r) => {
|
|
1473
|
+
const o = r._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1474
|
+
t.minimum > o && (r._zod.bag.minimum = t.minimum);
|
|
1475
|
+
}), e._zod.check = (r) => {
|
|
1476
|
+
const o = r.value;
|
|
1477
|
+
if (o.length >= t.minimum)
|
|
1478
|
+
return;
|
|
1479
|
+
const s = ge(o);
|
|
1480
|
+
r.issues.push({
|
|
1481
|
+
origin: s,
|
|
1482
|
+
code: "too_small",
|
|
1483
|
+
minimum: t.minimum,
|
|
1484
|
+
inclusive: !0,
|
|
1485
|
+
input: o,
|
|
1486
|
+
inst: e,
|
|
1487
|
+
continue: !t.abort
|
|
1488
|
+
});
|
|
1489
|
+
};
|
|
1490
|
+
}), Wn = /* @__PURE__ */ c("$ZodCheckLengthEquals", (e, t) => {
|
|
1491
|
+
var n;
|
|
1492
|
+
z.init(e, t), (n = e._zod.def).when ?? (n.when = (r) => {
|
|
1493
|
+
const o = r.value;
|
|
1494
|
+
return !de(o) && o.length !== void 0;
|
|
1495
|
+
}), e._zod.onattach.push((r) => {
|
|
1496
|
+
const o = r._zod.bag;
|
|
1497
|
+
o.minimum = t.length, o.maximum = t.length, o.length = t.length;
|
|
1498
|
+
}), e._zod.check = (r) => {
|
|
1499
|
+
const o = r.value, i = o.length;
|
|
1500
|
+
if (i === t.length)
|
|
1501
|
+
return;
|
|
1502
|
+
const s = ge(o), a = i > t.length;
|
|
1503
|
+
r.issues.push({
|
|
1504
|
+
origin: s,
|
|
1505
|
+
...a ? { code: "too_big", maximum: t.length } : { code: "too_small", minimum: t.length },
|
|
1506
|
+
inclusive: !0,
|
|
1507
|
+
exact: !0,
|
|
1508
|
+
input: r.value,
|
|
1509
|
+
inst: e,
|
|
1510
|
+
continue: !t.abort
|
|
1511
|
+
});
|
|
1512
|
+
};
|
|
1513
|
+
}), re = /* @__PURE__ */ c("$ZodCheckStringFormat", (e, t) => {
|
|
1514
|
+
var n, r;
|
|
1515
|
+
z.init(e, t), e._zod.onattach.push((o) => {
|
|
1516
|
+
const i = o._zod.bag;
|
|
1517
|
+
i.format = t.format, t.pattern && (i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(t.pattern));
|
|
1518
|
+
}), t.pattern ? (n = e._zod).check ?? (n.check = (o) => {
|
|
1519
|
+
t.pattern.lastIndex = 0, !t.pattern.test(o.value) && o.issues.push({
|
|
1520
|
+
origin: "string",
|
|
1521
|
+
code: "invalid_format",
|
|
1522
|
+
format: t.format,
|
|
1523
|
+
input: o.value,
|
|
1524
|
+
...t.pattern ? { pattern: t.pattern.toString() } : {},
|
|
1525
|
+
inst: e,
|
|
1526
|
+
continue: !t.abort
|
|
1527
|
+
});
|
|
1528
|
+
}) : (r = e._zod).check ?? (r.check = () => {
|
|
1529
|
+
});
|
|
1530
|
+
}), Bn = /* @__PURE__ */ c("$ZodCheckRegex", (e, t) => {
|
|
1531
|
+
re.init(e, t), e._zod.check = (n) => {
|
|
1532
|
+
t.pattern.lastIndex = 0, !t.pattern.test(n.value) && n.issues.push({
|
|
1533
|
+
origin: "string",
|
|
1534
|
+
code: "invalid_format",
|
|
1535
|
+
format: "regex",
|
|
1536
|
+
input: n.value,
|
|
1537
|
+
pattern: t.pattern.toString(),
|
|
1538
|
+
inst: e,
|
|
1539
|
+
continue: !t.abort
|
|
1540
|
+
});
|
|
1541
|
+
};
|
|
1542
|
+
}), Kn = /* @__PURE__ */ c("$ZodCheckLowerCase", (e, t) => {
|
|
1543
|
+
t.pattern ?? (t.pattern = Fn), re.init(e, t);
|
|
1544
|
+
}), qn = /* @__PURE__ */ c("$ZodCheckUpperCase", (e, t) => {
|
|
1545
|
+
t.pattern ?? (t.pattern = Mn), re.init(e, t);
|
|
1546
|
+
}), Xn = /* @__PURE__ */ c("$ZodCheckIncludes", (e, t) => {
|
|
1547
|
+
z.init(e, t);
|
|
1548
|
+
const n = L(t.includes), r = new RegExp(typeof t.position == "number" ? `^.{${t.position}}${n}` : n);
|
|
1549
|
+
t.pattern = r, e._zod.onattach.push((o) => {
|
|
1550
|
+
const i = o._zod.bag;
|
|
1551
|
+
i.patterns ?? (i.patterns = /* @__PURE__ */ new Set()), i.patterns.add(r);
|
|
1552
|
+
}), e._zod.check = (o) => {
|
|
1553
|
+
o.value.includes(t.includes, t.position) || o.issues.push({
|
|
1554
|
+
origin: "string",
|
|
1555
|
+
code: "invalid_format",
|
|
1556
|
+
format: "includes",
|
|
1557
|
+
includes: t.includes,
|
|
1558
|
+
input: o.value,
|
|
1559
|
+
inst: e,
|
|
1560
|
+
continue: !t.abort
|
|
1561
|
+
});
|
|
1562
|
+
};
|
|
1563
|
+
}), Yn = /* @__PURE__ */ c("$ZodCheckStartsWith", (e, t) => {
|
|
1564
|
+
z.init(e, t);
|
|
1565
|
+
const n = new RegExp(`^${L(t.prefix)}.*`);
|
|
1566
|
+
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1567
|
+
const o = r._zod.bag;
|
|
1568
|
+
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
1569
|
+
}), e._zod.check = (r) => {
|
|
1570
|
+
r.value.startsWith(t.prefix) || r.issues.push({
|
|
1571
|
+
origin: "string",
|
|
1572
|
+
code: "invalid_format",
|
|
1573
|
+
format: "starts_with",
|
|
1574
|
+
prefix: t.prefix,
|
|
1575
|
+
input: r.value,
|
|
1576
|
+
inst: e,
|
|
1577
|
+
continue: !t.abort
|
|
1578
|
+
});
|
|
1579
|
+
};
|
|
1580
|
+
}), Hn = /* @__PURE__ */ c("$ZodCheckEndsWith", (e, t) => {
|
|
1581
|
+
z.init(e, t);
|
|
1582
|
+
const n = new RegExp(`.*${L(t.suffix)}$`);
|
|
1583
|
+
t.pattern ?? (t.pattern = n), e._zod.onattach.push((r) => {
|
|
1584
|
+
const o = r._zod.bag;
|
|
1585
|
+
o.patterns ?? (o.patterns = /* @__PURE__ */ new Set()), o.patterns.add(n);
|
|
1586
|
+
}), e._zod.check = (r) => {
|
|
1587
|
+
r.value.endsWith(t.suffix) || r.issues.push({
|
|
1588
|
+
origin: "string",
|
|
1589
|
+
code: "invalid_format",
|
|
1590
|
+
format: "ends_with",
|
|
1591
|
+
suffix: t.suffix,
|
|
1592
|
+
input: r.value,
|
|
1593
|
+
inst: e,
|
|
1594
|
+
continue: !t.abort
|
|
1595
|
+
});
|
|
1596
|
+
};
|
|
1597
|
+
}), Qn = /* @__PURE__ */ c("$ZodCheckOverwrite", (e, t) => {
|
|
1598
|
+
z.init(e, t), e._zod.check = (n) => {
|
|
1599
|
+
n.value = t.tx(n.value);
|
|
1600
|
+
};
|
|
1601
|
+
});
|
|
1602
|
+
class er {
|
|
1603
|
+
constructor(t = []) {
|
|
1604
|
+
this.content = [], this.indent = 0, this && (this.args = t);
|
|
1605
|
+
}
|
|
1606
|
+
indented(t) {
|
|
1607
|
+
this.indent += 1, t(this), this.indent -= 1;
|
|
1608
|
+
}
|
|
1609
|
+
write(t) {
|
|
1610
|
+
if (typeof t == "function") {
|
|
1611
|
+
t(this, { execution: "sync" }), t(this, { execution: "async" });
|
|
1612
|
+
return;
|
|
1613
|
+
}
|
|
1614
|
+
const r = t.split(`
|
|
1615
|
+
`).filter((s) => s), o = Math.min(...r.map((s) => s.length - s.trimStart().length)), i = r.map((s) => s.slice(o)).map((s) => " ".repeat(this.indent * 2) + s);
|
|
1616
|
+
for (const s of i)
|
|
1617
|
+
this.content.push(s);
|
|
1618
|
+
}
|
|
1619
|
+
compile() {
|
|
1620
|
+
const t = Function, n = this?.args, o = [...(this?.content ?? [""]).map((i) => ` ${i}`)];
|
|
1621
|
+
return new t(...n, o.join(`
|
|
1622
|
+
`));
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
const tr = {
|
|
1626
|
+
major: 4,
|
|
1627
|
+
minor: 2,
|
|
1628
|
+
patch: 1
|
|
1629
|
+
}, y = /* @__PURE__ */ c("$ZodType", (e, t) => {
|
|
1630
|
+
var n;
|
|
1631
|
+
e ?? (e = {}), e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = tr;
|
|
1632
|
+
const r = [...e._zod.def.checks ?? []];
|
|
1633
|
+
e._zod.traits.has("$ZodCheck") && r.unshift(e);
|
|
1634
|
+
for (const o of r)
|
|
1635
|
+
for (const i of o._zod.onattach)
|
|
1636
|
+
i(e);
|
|
1637
|
+
if (r.length === 0)
|
|
1638
|
+
(n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
|
|
1639
|
+
e._zod.run = e._zod.parse;
|
|
1640
|
+
});
|
|
1641
|
+
else {
|
|
1642
|
+
const o = (s, a, u) => {
|
|
1643
|
+
let l = j(s), p;
|
|
1644
|
+
for (const f of a) {
|
|
1645
|
+
if (f._zod.def.when) {
|
|
1646
|
+
if (!f._zod.def.when(s))
|
|
1647
|
+
continue;
|
|
1648
|
+
} else if (l)
|
|
1649
|
+
continue;
|
|
1650
|
+
const d = s.issues.length, v = f._zod.check(s);
|
|
1651
|
+
if (v instanceof Promise && u?.async === !1)
|
|
1652
|
+
throw new D();
|
|
1653
|
+
if (p || v instanceof Promise)
|
|
1654
|
+
p = (p ?? Promise.resolve()).then(async () => {
|
|
1655
|
+
await v, s.issues.length !== d && (l || (l = j(s, d)));
|
|
1656
|
+
});
|
|
1657
|
+
else {
|
|
1658
|
+
if (s.issues.length === d)
|
|
1659
|
+
continue;
|
|
1660
|
+
l || (l = j(s, d));
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
return p ? p.then(() => s) : s;
|
|
1664
|
+
}, i = (s, a, u) => {
|
|
1665
|
+
if (j(s))
|
|
1666
|
+
return s.aborted = !0, s;
|
|
1667
|
+
const l = o(a, r, u);
|
|
1668
|
+
if (l instanceof Promise) {
|
|
1669
|
+
if (u.async === !1)
|
|
1670
|
+
throw new D();
|
|
1671
|
+
return l.then((p) => e._zod.parse(p, u));
|
|
1672
|
+
}
|
|
1673
|
+
return e._zod.parse(l, u);
|
|
1674
|
+
};
|
|
1675
|
+
e._zod.run = (s, a) => {
|
|
1676
|
+
if (a.skipChecks)
|
|
1677
|
+
return e._zod.parse(s, a);
|
|
1678
|
+
if (a.direction === "backward") {
|
|
1679
|
+
const l = e._zod.parse({ value: s.value, issues: [] }, { ...a, skipChecks: !0 });
|
|
1680
|
+
return l instanceof Promise ? l.then((p) => i(p, s, a)) : i(l, s, a);
|
|
1681
|
+
}
|
|
1682
|
+
const u = e._zod.parse(s, a);
|
|
1683
|
+
if (u instanceof Promise) {
|
|
1684
|
+
if (a.async === !1)
|
|
1685
|
+
throw new D();
|
|
1686
|
+
return u.then((l) => o(l, r, a));
|
|
1687
|
+
}
|
|
1688
|
+
return o(u, r, a);
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
e["~standard"] = {
|
|
1692
|
+
validate: (o) => {
|
|
1693
|
+
try {
|
|
1694
|
+
const i = an(e, o);
|
|
1695
|
+
return i.success ? { value: i.data } : { issues: i.error?.issues };
|
|
1696
|
+
} catch {
|
|
1697
|
+
return cn(e, o).then((s) => s.success ? { value: s.data } : { issues: s.error?.issues });
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
vendor: "zod",
|
|
1701
|
+
version: 1
|
|
1702
|
+
};
|
|
1703
|
+
}), ye = /* @__PURE__ */ c("$ZodString", (e, t) => {
|
|
1704
|
+
y.init(e, t), e._zod.pattern = [...e?._zod.bag?.patterns ?? []].pop() ?? jn(e._zod.bag), e._zod.parse = (n, r) => {
|
|
1705
|
+
if (t.coerce)
|
|
1706
|
+
try {
|
|
1707
|
+
n.value = String(n.value);
|
|
1708
|
+
} catch {
|
|
1709
|
+
}
|
|
1710
|
+
return typeof n.value == "string" || n.issues.push({
|
|
1711
|
+
expected: "string",
|
|
1712
|
+
code: "invalid_type",
|
|
1713
|
+
input: n.value,
|
|
1714
|
+
inst: e
|
|
1715
|
+
}), n;
|
|
1716
|
+
};
|
|
1717
|
+
}), g = /* @__PURE__ */ c("$ZodStringFormat", (e, t) => {
|
|
1718
|
+
re.init(e, t), ye.init(e, t);
|
|
1719
|
+
}), nr = /* @__PURE__ */ c("$ZodGUID", (e, t) => {
|
|
1720
|
+
t.pattern ?? (t.pattern = $n), g.init(e, t);
|
|
1721
|
+
}), rr = /* @__PURE__ */ c("$ZodUUID", (e, t) => {
|
|
1722
|
+
if (t.version) {
|
|
1723
|
+
const r = {
|
|
1724
|
+
v1: 1,
|
|
1725
|
+
v2: 2,
|
|
1726
|
+
v3: 3,
|
|
1727
|
+
v4: 4,
|
|
1728
|
+
v5: 5,
|
|
1729
|
+
v6: 6,
|
|
1730
|
+
v7: 7,
|
|
1731
|
+
v8: 8
|
|
1732
|
+
}[t.version];
|
|
1733
|
+
if (r === void 0)
|
|
1734
|
+
throw new Error(`Invalid UUID version: "${t.version}"`);
|
|
1735
|
+
t.pattern ?? (t.pattern = Te(r));
|
|
1736
|
+
} else
|
|
1737
|
+
t.pattern ?? (t.pattern = Te());
|
|
1738
|
+
g.init(e, t);
|
|
1739
|
+
}), or = /* @__PURE__ */ c("$ZodEmail", (e, t) => {
|
|
1740
|
+
t.pattern ?? (t.pattern = Tn), g.init(e, t);
|
|
1741
|
+
}), ir = /* @__PURE__ */ c("$ZodURL", (e, t) => {
|
|
1742
|
+
g.init(e, t), e._zod.check = (n) => {
|
|
1743
|
+
try {
|
|
1744
|
+
const r = n.value.trim(), o = new URL(r);
|
|
1745
|
+
t.hostname && (t.hostname.lastIndex = 0, t.hostname.test(o.hostname) || n.issues.push({
|
|
1746
|
+
code: "invalid_format",
|
|
1747
|
+
format: "url",
|
|
1748
|
+
note: "Invalid hostname",
|
|
1749
|
+
pattern: t.hostname.source,
|
|
1750
|
+
input: n.value,
|
|
1751
|
+
inst: e,
|
|
1752
|
+
continue: !t.abort
|
|
1753
|
+
})), t.protocol && (t.protocol.lastIndex = 0, t.protocol.test(o.protocol.endsWith(":") ? o.protocol.slice(0, -1) : o.protocol) || n.issues.push({
|
|
1754
|
+
code: "invalid_format",
|
|
1755
|
+
format: "url",
|
|
1756
|
+
note: "Invalid protocol",
|
|
1757
|
+
pattern: t.protocol.source,
|
|
1758
|
+
input: n.value,
|
|
1759
|
+
inst: e,
|
|
1760
|
+
continue: !t.abort
|
|
1761
|
+
})), t.normalize ? n.value = o.href : n.value = r;
|
|
1762
|
+
return;
|
|
1763
|
+
} catch {
|
|
1764
|
+
n.issues.push({
|
|
1765
|
+
code: "invalid_format",
|
|
1766
|
+
format: "url",
|
|
1767
|
+
input: n.value,
|
|
1768
|
+
inst: e,
|
|
1769
|
+
continue: !t.abort
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
}), sr = /* @__PURE__ */ c("$ZodEmoji", (e, t) => {
|
|
1774
|
+
t.pattern ?? (t.pattern = In()), g.init(e, t);
|
|
1775
|
+
}), ar = /* @__PURE__ */ c("$ZodNanoID", (e, t) => {
|
|
1776
|
+
t.pattern ?? (t.pattern = bn), g.init(e, t);
|
|
1777
|
+
}), cr = /* @__PURE__ */ c("$ZodCUID", (e, t) => {
|
|
1778
|
+
t.pattern ?? (t.pattern = vn), g.init(e, t);
|
|
1779
|
+
}), ur = /* @__PURE__ */ c("$ZodCUID2", (e, t) => {
|
|
1780
|
+
t.pattern ?? (t.pattern = _n), g.init(e, t);
|
|
1781
|
+
}), lr = /* @__PURE__ */ c("$ZodULID", (e, t) => {
|
|
1782
|
+
t.pattern ?? (t.pattern = yn), g.init(e, t);
|
|
1783
|
+
}), pr = /* @__PURE__ */ c("$ZodXID", (e, t) => {
|
|
1784
|
+
t.pattern ?? (t.pattern = kn), g.init(e, t);
|
|
1785
|
+
}), hr = /* @__PURE__ */ c("$ZodKSUID", (e, t) => {
|
|
1786
|
+
t.pattern ?? (t.pattern = wn), g.init(e, t);
|
|
1787
|
+
}), fr = /* @__PURE__ */ c("$ZodISODateTime", (e, t) => {
|
|
1788
|
+
t.pattern ?? (t.pattern = xn(t)), g.init(e, t);
|
|
1789
|
+
}), dr = /* @__PURE__ */ c("$ZodISODate", (e, t) => {
|
|
1790
|
+
t.pattern ?? (t.pattern = Rn), g.init(e, t);
|
|
1791
|
+
}), mr = /* @__PURE__ */ c("$ZodISOTime", (e, t) => {
|
|
1792
|
+
t.pattern ?? (t.pattern = Cn(t)), g.init(e, t);
|
|
1793
|
+
}), gr = /* @__PURE__ */ c("$ZodISODuration", (e, t) => {
|
|
1794
|
+
t.pattern ?? (t.pattern = zn), g.init(e, t);
|
|
1795
|
+
}), vr = /* @__PURE__ */ c("$ZodIPv4", (e, t) => {
|
|
1796
|
+
t.pattern ?? (t.pattern = En), g.init(e, t), e._zod.bag.format = "ipv4";
|
|
1797
|
+
}), _r = /* @__PURE__ */ c("$ZodIPv6", (e, t) => {
|
|
1798
|
+
t.pattern ?? (t.pattern = Sn), g.init(e, t), e._zod.bag.format = "ipv6", e._zod.check = (n) => {
|
|
1799
|
+
try {
|
|
1800
|
+
new URL(`http://[${n.value}]`);
|
|
1801
|
+
} catch {
|
|
1802
|
+
n.issues.push({
|
|
1803
|
+
code: "invalid_format",
|
|
1804
|
+
format: "ipv6",
|
|
1805
|
+
input: n.value,
|
|
1806
|
+
inst: e,
|
|
1807
|
+
continue: !t.abort
|
|
1808
|
+
});
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
}), yr = /* @__PURE__ */ c("$ZodCIDRv4", (e, t) => {
|
|
1812
|
+
t.pattern ?? (t.pattern = On), g.init(e, t);
|
|
1813
|
+
}), kr = /* @__PURE__ */ c("$ZodCIDRv6", (e, t) => {
|
|
1814
|
+
t.pattern ?? (t.pattern = Pn), g.init(e, t), e._zod.check = (n) => {
|
|
1815
|
+
const r = n.value.split("/");
|
|
1816
|
+
try {
|
|
1817
|
+
if (r.length !== 2)
|
|
1818
|
+
throw new Error();
|
|
1819
|
+
const [o, i] = r;
|
|
1820
|
+
if (!i)
|
|
1821
|
+
throw new Error();
|
|
1822
|
+
const s = Number(i);
|
|
1823
|
+
if (`${s}` !== i)
|
|
1824
|
+
throw new Error();
|
|
1825
|
+
if (s < 0 || s > 128)
|
|
1826
|
+
throw new Error();
|
|
1827
|
+
new URL(`http://[${o}]`);
|
|
1828
|
+
} catch {
|
|
1829
|
+
n.issues.push({
|
|
1830
|
+
code: "invalid_format",
|
|
1831
|
+
format: "cidrv6",
|
|
1832
|
+
input: n.value,
|
|
1833
|
+
inst: e,
|
|
1834
|
+
continue: !t.abort
|
|
1835
|
+
});
|
|
1836
|
+
}
|
|
1837
|
+
};
|
|
1838
|
+
});
|
|
1839
|
+
function at(e) {
|
|
1840
|
+
if (e === "")
|
|
1841
|
+
return !0;
|
|
1842
|
+
if (e.length % 4 !== 0)
|
|
1843
|
+
return !1;
|
|
1844
|
+
try {
|
|
1845
|
+
return atob(e), !0;
|
|
1846
|
+
} catch {
|
|
1847
|
+
return !1;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
const wr = /* @__PURE__ */ c("$ZodBase64", (e, t) => {
|
|
1851
|
+
t.pattern ?? (t.pattern = Nn), g.init(e, t), e._zod.bag.contentEncoding = "base64", e._zod.check = (n) => {
|
|
1852
|
+
at(n.value) || n.issues.push({
|
|
1853
|
+
code: "invalid_format",
|
|
1854
|
+
format: "base64",
|
|
1855
|
+
input: n.value,
|
|
1856
|
+
inst: e,
|
|
1857
|
+
continue: !t.abort
|
|
1858
|
+
});
|
|
1859
|
+
};
|
|
1860
|
+
});
|
|
1861
|
+
function br(e) {
|
|
1862
|
+
if (!tt.test(e))
|
|
1863
|
+
return !1;
|
|
1864
|
+
const t = e.replace(/[-_]/g, (r) => r === "-" ? "+" : "/"), n = t.padEnd(Math.ceil(t.length / 4) * 4, "=");
|
|
1865
|
+
return at(n);
|
|
1866
|
+
}
|
|
1867
|
+
const zr = /* @__PURE__ */ c("$ZodBase64URL", (e, t) => {
|
|
1868
|
+
t.pattern ?? (t.pattern = tt), g.init(e, t), e._zod.bag.contentEncoding = "base64url", e._zod.check = (n) => {
|
|
1869
|
+
br(n.value) || n.issues.push({
|
|
1870
|
+
code: "invalid_format",
|
|
1871
|
+
format: "base64url",
|
|
1872
|
+
input: n.value,
|
|
1873
|
+
inst: e,
|
|
1874
|
+
continue: !t.abort
|
|
1875
|
+
});
|
|
1876
|
+
};
|
|
1877
|
+
}), $r = /* @__PURE__ */ c("$ZodE164", (e, t) => {
|
|
1878
|
+
t.pattern ?? (t.pattern = An), g.init(e, t);
|
|
1879
|
+
});
|
|
1880
|
+
function Tr(e, t = null) {
|
|
1881
|
+
try {
|
|
1882
|
+
const n = e.split(".");
|
|
1883
|
+
if (n.length !== 3)
|
|
1884
|
+
return !1;
|
|
1885
|
+
const [r] = n;
|
|
1886
|
+
if (!r)
|
|
1887
|
+
return !1;
|
|
1888
|
+
const o = JSON.parse(atob(r));
|
|
1889
|
+
return !("typ" in o && o?.typ !== "JWT" || !o.alg || t && (!("alg" in o) || o.alg !== t));
|
|
1890
|
+
} catch {
|
|
1891
|
+
return !1;
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
const Zr = /* @__PURE__ */ c("$ZodJWT", (e, t) => {
|
|
1895
|
+
g.init(e, t), e._zod.check = (n) => {
|
|
1896
|
+
Tr(n.value, t.alg) || n.issues.push({
|
|
1897
|
+
code: "invalid_format",
|
|
1898
|
+
format: "jwt",
|
|
1899
|
+
input: n.value,
|
|
1900
|
+
inst: e,
|
|
1901
|
+
continue: !t.abort
|
|
1902
|
+
});
|
|
1903
|
+
};
|
|
1904
|
+
}), ct = /* @__PURE__ */ c("$ZodNumber", (e, t) => {
|
|
1905
|
+
y.init(e, t), e._zod.pattern = e._zod.bag.pattern ?? Ln, e._zod.parse = (n, r) => {
|
|
1906
|
+
if (t.coerce)
|
|
1907
|
+
try {
|
|
1908
|
+
n.value = Number(n.value);
|
|
1909
|
+
} catch {
|
|
1910
|
+
}
|
|
1911
|
+
const o = n.value;
|
|
1912
|
+
if (typeof o == "number" && !Number.isNaN(o) && Number.isFinite(o))
|
|
1913
|
+
return n;
|
|
1914
|
+
const i = typeof o == "number" ? Number.isNaN(o) ? "NaN" : Number.isFinite(o) ? void 0 : "Infinity" : void 0;
|
|
1915
|
+
return n.issues.push({
|
|
1916
|
+
expected: "number",
|
|
1917
|
+
code: "invalid_type",
|
|
1918
|
+
input: o,
|
|
1919
|
+
inst: e,
|
|
1920
|
+
...i ? { received: i } : {}
|
|
1921
|
+
}), n;
|
|
1922
|
+
};
|
|
1923
|
+
}), Ir = /* @__PURE__ */ c("$ZodNumberFormat", (e, t) => {
|
|
1924
|
+
Jn.init(e, t), ct.init(e, t);
|
|
1925
|
+
}), Er = /* @__PURE__ */ c("$ZodUnknown", (e, t) => {
|
|
1926
|
+
y.init(e, t), e._zod.parse = (n) => n;
|
|
1927
|
+
}), Sr = /* @__PURE__ */ c("$ZodNever", (e, t) => {
|
|
1928
|
+
y.init(e, t), e._zod.parse = (n, r) => (n.issues.push({
|
|
1929
|
+
expected: "never",
|
|
1930
|
+
code: "invalid_type",
|
|
1931
|
+
input: n.value,
|
|
1932
|
+
inst: e
|
|
1933
|
+
}), n);
|
|
1934
|
+
});
|
|
1935
|
+
function Ze(e, t, n) {
|
|
1936
|
+
e.issues.length && t.issues.push(...Ye(n, e.issues)), t.value[n] = e.value;
|
|
1937
|
+
}
|
|
1938
|
+
const Or = /* @__PURE__ */ c("$ZodArray", (e, t) => {
|
|
1939
|
+
y.init(e, t), e._zod.parse = (n, r) => {
|
|
1940
|
+
const o = n.value;
|
|
1941
|
+
if (!Array.isArray(o))
|
|
1942
|
+
return n.issues.push({
|
|
1943
|
+
expected: "array",
|
|
1944
|
+
code: "invalid_type",
|
|
1945
|
+
input: o,
|
|
1946
|
+
inst: e
|
|
1947
|
+
}), n;
|
|
1948
|
+
n.value = Array(o.length);
|
|
1949
|
+
const i = [];
|
|
1950
|
+
for (let s = 0; s < o.length; s++) {
|
|
1951
|
+
const a = o[s], u = t.element._zod.run({
|
|
1952
|
+
value: a,
|
|
1953
|
+
issues: []
|
|
1954
|
+
}, r);
|
|
1955
|
+
u instanceof Promise ? i.push(u.then((l) => Ze(l, n, s))) : Ze(u, n, s);
|
|
1956
|
+
}
|
|
1957
|
+
return i.length ? Promise.all(i).then(() => n) : n;
|
|
1958
|
+
};
|
|
1959
|
+
});
|
|
1960
|
+
function q(e, t, n, r) {
|
|
1961
|
+
e.issues.length && t.issues.push(...Ye(n, e.issues)), e.value === void 0 ? n in r && (t.value[n] = void 0) : t.value[n] = e.value;
|
|
1962
|
+
}
|
|
1963
|
+
function ut(e) {
|
|
1964
|
+
const t = Object.keys(e.shape);
|
|
1965
|
+
for (const r of t)
|
|
1966
|
+
if (!e.shape?.[r]?._zod?.traits?.has("$ZodType"))
|
|
1967
|
+
throw new Error(`Invalid element at key "${r}": expected a Zod schema`);
|
|
1968
|
+
const n = qt(e.shape);
|
|
1969
|
+
return {
|
|
1970
|
+
...e,
|
|
1971
|
+
keys: t,
|
|
1972
|
+
keySet: new Set(t),
|
|
1973
|
+
numKeys: t.length,
|
|
1974
|
+
optionalKeys: new Set(n)
|
|
1975
|
+
};
|
|
1976
|
+
}
|
|
1977
|
+
function lt(e, t, n, r, o, i) {
|
|
1978
|
+
const s = [], a = o.keySet, u = o.catchall._zod, l = u.def.type;
|
|
1979
|
+
for (const p in t) {
|
|
1980
|
+
if (a.has(p))
|
|
1981
|
+
continue;
|
|
1982
|
+
if (l === "never") {
|
|
1983
|
+
s.push(p);
|
|
1984
|
+
continue;
|
|
1985
|
+
}
|
|
1986
|
+
const f = u.run({ value: t[p], issues: [] }, r);
|
|
1987
|
+
f instanceof Promise ? e.push(f.then((d) => q(d, n, p, t))) : q(f, n, p, t);
|
|
1988
|
+
}
|
|
1989
|
+
return s.length && n.issues.push({
|
|
1990
|
+
code: "unrecognized_keys",
|
|
1991
|
+
keys: s,
|
|
1992
|
+
input: t,
|
|
1993
|
+
inst: i
|
|
1994
|
+
}), e.length ? Promise.all(e).then(() => n) : n;
|
|
1995
|
+
}
|
|
1996
|
+
const Pr = /* @__PURE__ */ c("$ZodObject", (e, t) => {
|
|
1997
|
+
if (y.init(e, t), !Object.getOwnPropertyDescriptor(t, "shape")?.get) {
|
|
1998
|
+
const a = t.shape;
|
|
1999
|
+
Object.defineProperty(t, "shape", {
|
|
2000
|
+
get: () => {
|
|
2001
|
+
const u = { ...a };
|
|
2002
|
+
return Object.defineProperty(t, "shape", {
|
|
2003
|
+
value: u
|
|
2004
|
+
}), u;
|
|
2005
|
+
}
|
|
2006
|
+
});
|
|
2007
|
+
}
|
|
2008
|
+
const r = ee(() => ut(t));
|
|
2009
|
+
m(e._zod, "propValues", () => {
|
|
2010
|
+
const a = t.shape, u = {};
|
|
2011
|
+
for (const l in a) {
|
|
2012
|
+
const p = a[l]._zod;
|
|
2013
|
+
if (p.values) {
|
|
2014
|
+
u[l] ?? (u[l] = /* @__PURE__ */ new Set());
|
|
2015
|
+
for (const f of p.values)
|
|
2016
|
+
u[l].add(f);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
return u;
|
|
2020
|
+
});
|
|
2021
|
+
const o = J, i = t.catchall;
|
|
2022
|
+
let s;
|
|
2023
|
+
e._zod.parse = (a, u) => {
|
|
2024
|
+
s ?? (s = r.value);
|
|
2025
|
+
const l = a.value;
|
|
2026
|
+
if (!o(l))
|
|
2027
|
+
return a.issues.push({
|
|
2028
|
+
expected: "object",
|
|
2029
|
+
code: "invalid_type",
|
|
2030
|
+
input: l,
|
|
2031
|
+
inst: e
|
|
2032
|
+
}), a;
|
|
2033
|
+
a.value = {};
|
|
2034
|
+
const p = [], f = s.shape;
|
|
2035
|
+
for (const d of s.keys) {
|
|
2036
|
+
const $ = f[d]._zod.run({ value: l[d], issues: [] }, u);
|
|
2037
|
+
$ instanceof Promise ? p.push($.then((ie) => q(ie, a, d, l))) : q($, a, d, l);
|
|
2038
|
+
}
|
|
2039
|
+
return i ? lt(p, l, a, u, r.value, e) : p.length ? Promise.all(p).then(() => a) : a;
|
|
2040
|
+
};
|
|
2041
|
+
}), Nr = /* @__PURE__ */ c("$ZodObjectJIT", (e, t) => {
|
|
2042
|
+
Pr.init(e, t);
|
|
2043
|
+
const n = e._zod.parse, r = ee(() => ut(t)), o = (d) => {
|
|
2044
|
+
const v = new er(["shape", "payload", "ctx"]), $ = r.value, ie = (E) => {
|
|
2045
|
+
const Z = $e(E);
|
|
2046
|
+
return `shape[${Z}]._zod.run({ value: input[${Z}], issues: [] }, ctx)`;
|
|
2047
|
+
};
|
|
2048
|
+
v.write("const input = payload.value;");
|
|
2049
|
+
const we = /* @__PURE__ */ Object.create(null);
|
|
2050
|
+
let zt = 0;
|
|
2051
|
+
for (const E of $.keys)
|
|
2052
|
+
we[E] = `key_${zt++}`;
|
|
2053
|
+
v.write("const newResult = {};");
|
|
2054
|
+
for (const E of $.keys) {
|
|
2055
|
+
const Z = we[E], M = $e(E);
|
|
2056
|
+
v.write(`const ${Z} = ${ie(E)};`), v.write(`
|
|
2057
|
+
if (${Z}.issues.length) {
|
|
2058
|
+
payload.issues = payload.issues.concat(${Z}.issues.map(iss => ({
|
|
2059
|
+
...iss,
|
|
2060
|
+
path: iss.path ? [${M}, ...iss.path] : [${M}]
|
|
2061
|
+
})));
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
|
|
2065
|
+
if (${Z}.value === undefined) {
|
|
2066
|
+
if (${M} in input) {
|
|
2067
|
+
newResult[${M}] = undefined;
|
|
2068
|
+
}
|
|
2069
|
+
} else {
|
|
2070
|
+
newResult[${M}] = ${Z}.value;
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
`);
|
|
2074
|
+
}
|
|
2075
|
+
v.write("payload.value = newResult;"), v.write("return payload;");
|
|
2076
|
+
const $t = v.compile();
|
|
2077
|
+
return (E, Z) => $t(d, E, Z);
|
|
2078
|
+
};
|
|
2079
|
+
let i;
|
|
2080
|
+
const s = J, a = !Be.jitless, l = a && Bt.value, p = t.catchall;
|
|
2081
|
+
let f;
|
|
2082
|
+
e._zod.parse = (d, v) => {
|
|
2083
|
+
f ?? (f = r.value);
|
|
2084
|
+
const $ = d.value;
|
|
2085
|
+
return s($) ? a && l && v?.async === !1 && v.jitless !== !0 ? (i || (i = o(t.shape)), d = i(d, v), p ? lt([], $, d, v, f, e) : d) : n(d, v) : (d.issues.push({
|
|
2086
|
+
expected: "object",
|
|
2087
|
+
code: "invalid_type",
|
|
2088
|
+
input: $,
|
|
2089
|
+
inst: e
|
|
2090
|
+
}), d);
|
|
2091
|
+
};
|
|
2092
|
+
});
|
|
2093
|
+
function Ie(e, t, n, r) {
|
|
2094
|
+
for (const i of e)
|
|
2095
|
+
if (i.issues.length === 0)
|
|
2096
|
+
return t.value = i.value, t;
|
|
2097
|
+
const o = e.filter((i) => !j(i));
|
|
2098
|
+
return o.length === 1 ? (t.value = o[0].value, o[0]) : (t.issues.push({
|
|
2099
|
+
code: "invalid_union",
|
|
2100
|
+
input: t.value,
|
|
2101
|
+
inst: n,
|
|
2102
|
+
errors: e.map((i) => i.issues.map((s) => R(s, r, A())))
|
|
2103
|
+
}), t);
|
|
2104
|
+
}
|
|
2105
|
+
const pt = /* @__PURE__ */ c("$ZodUnion", (e, t) => {
|
|
2106
|
+
y.init(e, t), m(e._zod, "optin", () => t.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0), m(e._zod, "optout", () => t.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0), m(e._zod, "values", () => {
|
|
2107
|
+
if (t.options.every((o) => o._zod.values))
|
|
2108
|
+
return new Set(t.options.flatMap((o) => Array.from(o._zod.values)));
|
|
2109
|
+
}), m(e._zod, "pattern", () => {
|
|
2110
|
+
if (t.options.every((o) => o._zod.pattern)) {
|
|
2111
|
+
const o = t.options.map((i) => i._zod.pattern);
|
|
2112
|
+
return new RegExp(`^(${o.map((i) => me(i.source)).join("|")})$`);
|
|
2113
|
+
}
|
|
2114
|
+
});
|
|
2115
|
+
const n = t.options.length === 1, r = t.options[0]._zod.run;
|
|
2116
|
+
e._zod.parse = (o, i) => {
|
|
2117
|
+
if (n)
|
|
2118
|
+
return r(o, i);
|
|
2119
|
+
let s = !1;
|
|
2120
|
+
const a = [];
|
|
2121
|
+
for (const u of t.options) {
|
|
2122
|
+
const l = u._zod.run({
|
|
2123
|
+
value: o.value,
|
|
2124
|
+
issues: []
|
|
2125
|
+
}, i);
|
|
2126
|
+
if (l instanceof Promise)
|
|
2127
|
+
a.push(l), s = !0;
|
|
2128
|
+
else {
|
|
2129
|
+
if (l.issues.length === 0)
|
|
2130
|
+
return l;
|
|
2131
|
+
a.push(l);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
return s ? Promise.all(a).then((u) => Ie(u, o, e, i)) : Ie(a, o, e, i);
|
|
2135
|
+
};
|
|
2136
|
+
}), Ar = /* @__PURE__ */ c("$ZodDiscriminatedUnion", (e, t) => {
|
|
2137
|
+
t.inclusive = !1, pt.init(e, t);
|
|
2138
|
+
const n = e._zod.parse;
|
|
2139
|
+
m(e._zod, "propValues", () => {
|
|
2140
|
+
const o = {};
|
|
2141
|
+
for (const i of t.options) {
|
|
2142
|
+
const s = i._zod.propValues;
|
|
2143
|
+
if (!s || Object.keys(s).length === 0)
|
|
2144
|
+
throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);
|
|
2145
|
+
for (const [a, u] of Object.entries(s)) {
|
|
2146
|
+
o[a] || (o[a] = /* @__PURE__ */ new Set());
|
|
2147
|
+
for (const l of u)
|
|
2148
|
+
o[a].add(l);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
return o;
|
|
2152
|
+
});
|
|
2153
|
+
const r = ee(() => {
|
|
2154
|
+
const o = t.options, i = /* @__PURE__ */ new Map();
|
|
2155
|
+
for (const s of o) {
|
|
2156
|
+
const a = s._zod.propValues?.[t.discriminator];
|
|
2157
|
+
if (!a || a.size === 0)
|
|
2158
|
+
throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);
|
|
2159
|
+
for (const u of a) {
|
|
2160
|
+
if (i.has(u))
|
|
2161
|
+
throw new Error(`Duplicate discriminator value "${String(u)}"`);
|
|
2162
|
+
i.set(u, s);
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
return i;
|
|
2166
|
+
});
|
|
2167
|
+
e._zod.parse = (o, i) => {
|
|
2168
|
+
const s = o.value;
|
|
2169
|
+
if (!J(s))
|
|
2170
|
+
return o.issues.push({
|
|
2171
|
+
code: "invalid_type",
|
|
2172
|
+
expected: "object",
|
|
2173
|
+
input: s,
|
|
2174
|
+
inst: e
|
|
2175
|
+
}), o;
|
|
2176
|
+
const a = r.value.get(s?.[t.discriminator]);
|
|
2177
|
+
return a ? a._zod.run(o, i) : t.unionFallback ? n(o, i) : (o.issues.push({
|
|
2178
|
+
code: "invalid_union",
|
|
2179
|
+
errors: [],
|
|
2180
|
+
note: "No matching discriminator",
|
|
2181
|
+
discriminator: t.discriminator,
|
|
2182
|
+
input: s,
|
|
2183
|
+
path: [t.discriminator],
|
|
2184
|
+
inst: e
|
|
2185
|
+
}), o);
|
|
2186
|
+
};
|
|
2187
|
+
}), Rr = /* @__PURE__ */ c("$ZodIntersection", (e, t) => {
|
|
2188
|
+
y.init(e, t), e._zod.parse = (n, r) => {
|
|
2189
|
+
const o = n.value, i = t.left._zod.run({ value: o, issues: [] }, r), s = t.right._zod.run({ value: o, issues: [] }, r);
|
|
2190
|
+
return i instanceof Promise || s instanceof Promise ? Promise.all([i, s]).then(([u, l]) => Ee(n, u, l)) : Ee(n, i, s);
|
|
2191
|
+
};
|
|
2192
|
+
});
|
|
2193
|
+
function pe(e, t) {
|
|
2194
|
+
if (e === t)
|
|
2195
|
+
return { valid: !0, data: e };
|
|
2196
|
+
if (e instanceof Date && t instanceof Date && +e == +t)
|
|
2197
|
+
return { valid: !0, data: e };
|
|
2198
|
+
if (V(e) && V(t)) {
|
|
2199
|
+
const n = Object.keys(t), r = Object.keys(e).filter((i) => n.indexOf(i) !== -1), o = { ...e, ...t };
|
|
2200
|
+
for (const i of r) {
|
|
2201
|
+
const s = pe(e[i], t[i]);
|
|
2202
|
+
if (!s.valid)
|
|
2203
|
+
return {
|
|
2204
|
+
valid: !1,
|
|
2205
|
+
mergeErrorPath: [i, ...s.mergeErrorPath]
|
|
2206
|
+
};
|
|
2207
|
+
o[i] = s.data;
|
|
2208
|
+
}
|
|
2209
|
+
return { valid: !0, data: o };
|
|
2210
|
+
}
|
|
2211
|
+
if (Array.isArray(e) && Array.isArray(t)) {
|
|
2212
|
+
if (e.length !== t.length)
|
|
2213
|
+
return { valid: !1, mergeErrorPath: [] };
|
|
2214
|
+
const n = [];
|
|
2215
|
+
for (let r = 0; r < e.length; r++) {
|
|
2216
|
+
const o = e[r], i = t[r], s = pe(o, i);
|
|
2217
|
+
if (!s.valid)
|
|
2218
|
+
return {
|
|
2219
|
+
valid: !1,
|
|
2220
|
+
mergeErrorPath: [r, ...s.mergeErrorPath]
|
|
2221
|
+
};
|
|
2222
|
+
n.push(s.data);
|
|
2223
|
+
}
|
|
2224
|
+
return { valid: !0, data: n };
|
|
2225
|
+
}
|
|
2226
|
+
return { valid: !1, mergeErrorPath: [] };
|
|
2227
|
+
}
|
|
2228
|
+
function Ee(e, t, n) {
|
|
2229
|
+
if (t.issues.length && e.issues.push(...t.issues), n.issues.length && e.issues.push(...n.issues), j(e))
|
|
2230
|
+
return e;
|
|
2231
|
+
const r = pe(t.value, n.value);
|
|
2232
|
+
if (!r.valid)
|
|
2233
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);
|
|
2234
|
+
return e.value = r.data, e;
|
|
2235
|
+
}
|
|
2236
|
+
const Cr = /* @__PURE__ */ c("$ZodEnum", (e, t) => {
|
|
2237
|
+
y.init(e, t);
|
|
2238
|
+
const n = Ke(t.entries), r = new Set(n);
|
|
2239
|
+
e._zod.values = r, e._zod.pattern = new RegExp(`^(${n.filter((o) => Kt.has(typeof o)).map((o) => typeof o == "string" ? L(o) : o.toString()).join("|")})$`), e._zod.parse = (o, i) => {
|
|
2240
|
+
const s = o.value;
|
|
2241
|
+
return r.has(s) || o.issues.push({
|
|
2242
|
+
code: "invalid_value",
|
|
2243
|
+
values: n,
|
|
2244
|
+
input: s,
|
|
2245
|
+
inst: e
|
|
2246
|
+
}), o;
|
|
2247
|
+
};
|
|
2248
|
+
}), xr = /* @__PURE__ */ c("$ZodLiteral", (e, t) => {
|
|
2249
|
+
if (y.init(e, t), t.values.length === 0)
|
|
2250
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
2251
|
+
const n = new Set(t.values);
|
|
2252
|
+
e._zod.values = n, e._zod.pattern = new RegExp(`^(${t.values.map((r) => typeof r == "string" ? L(r) : r ? L(r.toString()) : String(r)).join("|")})$`), e._zod.parse = (r, o) => {
|
|
2253
|
+
const i = r.value;
|
|
2254
|
+
return n.has(i) || r.issues.push({
|
|
2255
|
+
code: "invalid_value",
|
|
2256
|
+
values: t.values,
|
|
2257
|
+
input: i,
|
|
2258
|
+
inst: e
|
|
2259
|
+
}), r;
|
|
2260
|
+
};
|
|
2261
|
+
}), jr = /* @__PURE__ */ c("$ZodTransform", (e, t) => {
|
|
2262
|
+
y.init(e, t), e._zod.parse = (n, r) => {
|
|
2263
|
+
if (r.direction === "backward")
|
|
2264
|
+
throw new We(e.constructor.name);
|
|
2265
|
+
const o = t.transform(n.value, n);
|
|
2266
|
+
if (r.async)
|
|
2267
|
+
return (o instanceof Promise ? o : Promise.resolve(o)).then((s) => (n.value = s, n));
|
|
2268
|
+
if (o instanceof Promise)
|
|
2269
|
+
throw new D();
|
|
2270
|
+
return n.value = o, n;
|
|
2271
|
+
};
|
|
2272
|
+
});
|
|
2273
|
+
function Se(e, t) {
|
|
2274
|
+
return e.issues.length && t === void 0 ? { issues: [], value: void 0 } : e;
|
|
2275
|
+
}
|
|
2276
|
+
const Dr = /* @__PURE__ */ c("$ZodOptional", (e, t) => {
|
|
2277
|
+
y.init(e, t), e._zod.optin = "optional", e._zod.optout = "optional", m(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, void 0]) : void 0), m(e._zod, "pattern", () => {
|
|
2278
|
+
const n = t.innerType._zod.pattern;
|
|
2279
|
+
return n ? new RegExp(`^(${me(n.source)})?$`) : void 0;
|
|
2280
|
+
}), e._zod.parse = (n, r) => {
|
|
2281
|
+
if (t.innerType._zod.optin === "optional") {
|
|
2282
|
+
const o = t.innerType._zod.run(n, r);
|
|
2283
|
+
return o instanceof Promise ? o.then((i) => Se(i, n.value)) : Se(o, n.value);
|
|
2284
|
+
}
|
|
2285
|
+
return n.value === void 0 ? n : t.innerType._zod.run(n, r);
|
|
2286
|
+
};
|
|
2287
|
+
}), Lr = /* @__PURE__ */ c("$ZodNullable", (e, t) => {
|
|
2288
|
+
y.init(e, t), m(e._zod, "optin", () => t.innerType._zod.optin), m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "pattern", () => {
|
|
2289
|
+
const n = t.innerType._zod.pattern;
|
|
2290
|
+
return n ? new RegExp(`^(${me(n.source)}|null)$`) : void 0;
|
|
2291
|
+
}), m(e._zod, "values", () => t.innerType._zod.values ? /* @__PURE__ */ new Set([...t.innerType._zod.values, null]) : void 0), e._zod.parse = (n, r) => n.value === null ? n : t.innerType._zod.run(n, r);
|
|
2292
|
+
}), Fr = /* @__PURE__ */ c("$ZodDefault", (e, t) => {
|
|
2293
|
+
y.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
2294
|
+
if (r.direction === "backward")
|
|
2295
|
+
return t.innerType._zod.run(n, r);
|
|
2296
|
+
if (n.value === void 0)
|
|
2297
|
+
return n.value = t.defaultValue, n;
|
|
2298
|
+
const o = t.innerType._zod.run(n, r);
|
|
2299
|
+
return o instanceof Promise ? o.then((i) => Oe(i, t)) : Oe(o, t);
|
|
2300
|
+
};
|
|
2301
|
+
});
|
|
2302
|
+
function Oe(e, t) {
|
|
2303
|
+
return e.value === void 0 && (e.value = t.defaultValue), e;
|
|
2304
|
+
}
|
|
2305
|
+
const Mr = /* @__PURE__ */ c("$ZodPrefault", (e, t) => {
|
|
2306
|
+
y.init(e, t), e._zod.optin = "optional", m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => (r.direction === "backward" || n.value === void 0 && (n.value = t.defaultValue), t.innerType._zod.run(n, r));
|
|
2307
|
+
}), Ur = /* @__PURE__ */ c("$ZodNonOptional", (e, t) => {
|
|
2308
|
+
y.init(e, t), m(e._zod, "values", () => {
|
|
2309
|
+
const n = t.innerType._zod.values;
|
|
2310
|
+
return n ? new Set([...n].filter((r) => r !== void 0)) : void 0;
|
|
2311
|
+
}), e._zod.parse = (n, r) => {
|
|
2312
|
+
const o = t.innerType._zod.run(n, r);
|
|
2313
|
+
return o instanceof Promise ? o.then((i) => Pe(i, e)) : Pe(o, e);
|
|
2314
|
+
};
|
|
2315
|
+
});
|
|
2316
|
+
function Pe(e, t) {
|
|
2317
|
+
return !e.issues.length && e.value === void 0 && e.issues.push({
|
|
2318
|
+
code: "invalid_type",
|
|
2319
|
+
expected: "nonoptional",
|
|
2320
|
+
input: e.value,
|
|
2321
|
+
inst: t
|
|
2322
|
+
}), e;
|
|
2323
|
+
}
|
|
2324
|
+
const Jr = /* @__PURE__ */ c("$ZodCatch", (e, t) => {
|
|
2325
|
+
y.init(e, t), m(e._zod, "optin", () => t.innerType._zod.optin), m(e._zod, "optout", () => t.innerType._zod.optout), m(e._zod, "values", () => t.innerType._zod.values), e._zod.parse = (n, r) => {
|
|
2326
|
+
if (r.direction === "backward")
|
|
2327
|
+
return t.innerType._zod.run(n, r);
|
|
2328
|
+
const o = t.innerType._zod.run(n, r);
|
|
2329
|
+
return o instanceof Promise ? o.then((i) => (n.value = i.value, i.issues.length && (n.value = t.catchValue({
|
|
2330
|
+
...n,
|
|
2331
|
+
error: {
|
|
2332
|
+
issues: i.issues.map((s) => R(s, r, A()))
|
|
2333
|
+
},
|
|
2334
|
+
input: n.value
|
|
2335
|
+
}), n.issues = []), n)) : (n.value = o.value, o.issues.length && (n.value = t.catchValue({
|
|
2336
|
+
...n,
|
|
2337
|
+
error: {
|
|
2338
|
+
issues: o.issues.map((i) => R(i, r, A()))
|
|
2339
|
+
},
|
|
2340
|
+
input: n.value
|
|
2341
|
+
}), n.issues = []), n);
|
|
2342
|
+
};
|
|
2343
|
+
}), Vr = /* @__PURE__ */ c("$ZodPipe", (e, t) => {
|
|
2344
|
+
y.init(e, t), m(e._zod, "values", () => t.in._zod.values), m(e._zod, "optin", () => t.in._zod.optin), m(e._zod, "optout", () => t.out._zod.optout), m(e._zod, "propValues", () => t.in._zod.propValues), e._zod.parse = (n, r) => {
|
|
2345
|
+
if (r.direction === "backward") {
|
|
2346
|
+
const i = t.out._zod.run(n, r);
|
|
2347
|
+
return i instanceof Promise ? i.then((s) => B(s, t.in, r)) : B(i, t.in, r);
|
|
2348
|
+
}
|
|
2349
|
+
const o = t.in._zod.run(n, r);
|
|
2350
|
+
return o instanceof Promise ? o.then((i) => B(i, t.out, r)) : B(o, t.out, r);
|
|
2351
|
+
};
|
|
2352
|
+
});
|
|
2353
|
+
function B(e, t, n) {
|
|
2354
|
+
return e.issues.length ? (e.aborted = !0, e) : t._zod.run({ value: e.value, issues: e.issues }, n);
|
|
2355
|
+
}
|
|
2356
|
+
const Gr = /* @__PURE__ */ c("$ZodReadonly", (e, t) => {
|
|
2357
|
+
y.init(e, t), m(e._zod, "propValues", () => t.innerType._zod.propValues), m(e._zod, "values", () => t.innerType._zod.values), m(e._zod, "optin", () => t.innerType?._zod?.optin), m(e._zod, "optout", () => t.innerType?._zod?.optout), e._zod.parse = (n, r) => {
|
|
2358
|
+
if (r.direction === "backward")
|
|
2359
|
+
return t.innerType._zod.run(n, r);
|
|
2360
|
+
const o = t.innerType._zod.run(n, r);
|
|
2361
|
+
return o instanceof Promise ? o.then(Ne) : Ne(o);
|
|
2362
|
+
};
|
|
2363
|
+
});
|
|
2364
|
+
function Ne(e) {
|
|
2365
|
+
return e.value = Object.freeze(e.value), e;
|
|
2366
|
+
}
|
|
2367
|
+
const Wr = /* @__PURE__ */ c("$ZodCustom", (e, t) => {
|
|
2368
|
+
z.init(e, t), y.init(e, t), e._zod.parse = (n, r) => n, e._zod.check = (n) => {
|
|
2369
|
+
const r = n.value, o = t.fn(r);
|
|
2370
|
+
if (o instanceof Promise)
|
|
2371
|
+
return o.then((i) => Ae(i, n, r, e));
|
|
2372
|
+
Ae(o, n, r, e);
|
|
2373
|
+
};
|
|
2374
|
+
});
|
|
2375
|
+
function Ae(e, t, n, r) {
|
|
2376
|
+
if (!e) {
|
|
2377
|
+
const o = {
|
|
2378
|
+
code: "custom",
|
|
2379
|
+
input: n,
|
|
2380
|
+
inst: r,
|
|
2381
|
+
// incorporates params.error into issue reporting
|
|
2382
|
+
path: [...r._zod.def.path ?? []],
|
|
2383
|
+
// incorporates params.error into issue reporting
|
|
2384
|
+
continue: !r._zod.def.abort
|
|
2385
|
+
// params: inst._zod.def.params,
|
|
2386
|
+
};
|
|
2387
|
+
r._zod.def.params && (o.params = r._zod.def.params), t.issues.push(G(o));
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
var Re;
|
|
2391
|
+
class Br {
|
|
2392
|
+
constructor() {
|
|
2393
|
+
this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map();
|
|
2394
|
+
}
|
|
2395
|
+
add(t, ...n) {
|
|
2396
|
+
const r = n[0];
|
|
2397
|
+
if (this._map.set(t, r), r && typeof r == "object" && "id" in r) {
|
|
2398
|
+
if (this._idmap.has(r.id))
|
|
2399
|
+
throw new Error(`ID ${r.id} already exists in the registry`);
|
|
2400
|
+
this._idmap.set(r.id, t);
|
|
2401
|
+
}
|
|
2402
|
+
return this;
|
|
2403
|
+
}
|
|
2404
|
+
clear() {
|
|
2405
|
+
return this._map = /* @__PURE__ */ new WeakMap(), this._idmap = /* @__PURE__ */ new Map(), this;
|
|
2406
|
+
}
|
|
2407
|
+
remove(t) {
|
|
2408
|
+
const n = this._map.get(t);
|
|
2409
|
+
return n && typeof n == "object" && "id" in n && this._idmap.delete(n.id), this._map.delete(t), this;
|
|
2410
|
+
}
|
|
2411
|
+
get(t) {
|
|
2412
|
+
const n = t._zod.parent;
|
|
2413
|
+
if (n) {
|
|
2414
|
+
const r = { ...this.get(n) ?? {} };
|
|
2415
|
+
delete r.id;
|
|
2416
|
+
const o = { ...r, ...this._map.get(t) };
|
|
2417
|
+
return Object.keys(o).length ? o : void 0;
|
|
2418
|
+
}
|
|
2419
|
+
return this._map.get(t);
|
|
2420
|
+
}
|
|
2421
|
+
has(t) {
|
|
2422
|
+
return this._map.has(t);
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
function Kr() {
|
|
2426
|
+
return new Br();
|
|
2427
|
+
}
|
|
2428
|
+
(Re = globalThis).__zod_globalRegistry ?? (Re.__zod_globalRegistry = Kr());
|
|
2429
|
+
const U = globalThis.__zod_globalRegistry;
|
|
2430
|
+
function qr(e, t) {
|
|
2431
|
+
return new e({
|
|
2432
|
+
type: "string",
|
|
2433
|
+
...h(t)
|
|
2434
|
+
});
|
|
2435
|
+
}
|
|
2436
|
+
function Xr(e, t) {
|
|
2437
|
+
return new e({
|
|
2438
|
+
type: "string",
|
|
2439
|
+
format: "email",
|
|
2440
|
+
check: "string_format",
|
|
2441
|
+
abort: !1,
|
|
2442
|
+
...h(t)
|
|
2443
|
+
});
|
|
2444
|
+
}
|
|
2445
|
+
function Ce(e, t) {
|
|
2446
|
+
return new e({
|
|
2447
|
+
type: "string",
|
|
2448
|
+
format: "guid",
|
|
2449
|
+
check: "string_format",
|
|
2450
|
+
abort: !1,
|
|
2451
|
+
...h(t)
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
function Yr(e, t) {
|
|
2455
|
+
return new e({
|
|
2456
|
+
type: "string",
|
|
2457
|
+
format: "uuid",
|
|
2458
|
+
check: "string_format",
|
|
2459
|
+
abort: !1,
|
|
2460
|
+
...h(t)
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
function Hr(e, t) {
|
|
2464
|
+
return new e({
|
|
2465
|
+
type: "string",
|
|
2466
|
+
format: "uuid",
|
|
2467
|
+
check: "string_format",
|
|
2468
|
+
abort: !1,
|
|
2469
|
+
version: "v4",
|
|
2470
|
+
...h(t)
|
|
2471
|
+
});
|
|
2472
|
+
}
|
|
2473
|
+
function Qr(e, t) {
|
|
2474
|
+
return new e({
|
|
2475
|
+
type: "string",
|
|
2476
|
+
format: "uuid",
|
|
2477
|
+
check: "string_format",
|
|
2478
|
+
abort: !1,
|
|
2479
|
+
version: "v6",
|
|
2480
|
+
...h(t)
|
|
2481
|
+
});
|
|
2482
|
+
}
|
|
2483
|
+
function eo(e, t) {
|
|
2484
|
+
return new e({
|
|
2485
|
+
type: "string",
|
|
2486
|
+
format: "uuid",
|
|
2487
|
+
check: "string_format",
|
|
2488
|
+
abort: !1,
|
|
2489
|
+
version: "v7",
|
|
2490
|
+
...h(t)
|
|
2491
|
+
});
|
|
2492
|
+
}
|
|
2493
|
+
function to(e, t) {
|
|
2494
|
+
return new e({
|
|
2495
|
+
type: "string",
|
|
2496
|
+
format: "url",
|
|
2497
|
+
check: "string_format",
|
|
2498
|
+
abort: !1,
|
|
2499
|
+
...h(t)
|
|
2500
|
+
});
|
|
2501
|
+
}
|
|
2502
|
+
function no(e, t) {
|
|
2503
|
+
return new e({
|
|
2504
|
+
type: "string",
|
|
2505
|
+
format: "emoji",
|
|
2506
|
+
check: "string_format",
|
|
2507
|
+
abort: !1,
|
|
2508
|
+
...h(t)
|
|
2509
|
+
});
|
|
2510
|
+
}
|
|
2511
|
+
function ro(e, t) {
|
|
2512
|
+
return new e({
|
|
2513
|
+
type: "string",
|
|
2514
|
+
format: "nanoid",
|
|
2515
|
+
check: "string_format",
|
|
2516
|
+
abort: !1,
|
|
2517
|
+
...h(t)
|
|
2518
|
+
});
|
|
2519
|
+
}
|
|
2520
|
+
function oo(e, t) {
|
|
2521
|
+
return new e({
|
|
2522
|
+
type: "string",
|
|
2523
|
+
format: "cuid",
|
|
2524
|
+
check: "string_format",
|
|
2525
|
+
abort: !1,
|
|
2526
|
+
...h(t)
|
|
2527
|
+
});
|
|
2528
|
+
}
|
|
2529
|
+
function io(e, t) {
|
|
2530
|
+
return new e({
|
|
2531
|
+
type: "string",
|
|
2532
|
+
format: "cuid2",
|
|
2533
|
+
check: "string_format",
|
|
2534
|
+
abort: !1,
|
|
2535
|
+
...h(t)
|
|
2536
|
+
});
|
|
2537
|
+
}
|
|
2538
|
+
function so(e, t) {
|
|
2539
|
+
return new e({
|
|
2540
|
+
type: "string",
|
|
2541
|
+
format: "ulid",
|
|
2542
|
+
check: "string_format",
|
|
2543
|
+
abort: !1,
|
|
2544
|
+
...h(t)
|
|
2545
|
+
});
|
|
2546
|
+
}
|
|
2547
|
+
function ao(e, t) {
|
|
2548
|
+
return new e({
|
|
2549
|
+
type: "string",
|
|
2550
|
+
format: "xid",
|
|
2551
|
+
check: "string_format",
|
|
2552
|
+
abort: !1,
|
|
2553
|
+
...h(t)
|
|
2554
|
+
});
|
|
2555
|
+
}
|
|
2556
|
+
function co(e, t) {
|
|
2557
|
+
return new e({
|
|
2558
|
+
type: "string",
|
|
2559
|
+
format: "ksuid",
|
|
2560
|
+
check: "string_format",
|
|
2561
|
+
abort: !1,
|
|
2562
|
+
...h(t)
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
function uo(e, t) {
|
|
2566
|
+
return new e({
|
|
2567
|
+
type: "string",
|
|
2568
|
+
format: "ipv4",
|
|
2569
|
+
check: "string_format",
|
|
2570
|
+
abort: !1,
|
|
2571
|
+
...h(t)
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
function lo(e, t) {
|
|
2575
|
+
return new e({
|
|
2576
|
+
type: "string",
|
|
2577
|
+
format: "ipv6",
|
|
2578
|
+
check: "string_format",
|
|
2579
|
+
abort: !1,
|
|
2580
|
+
...h(t)
|
|
2581
|
+
});
|
|
2582
|
+
}
|
|
2583
|
+
function po(e, t) {
|
|
2584
|
+
return new e({
|
|
2585
|
+
type: "string",
|
|
2586
|
+
format: "cidrv4",
|
|
2587
|
+
check: "string_format",
|
|
2588
|
+
abort: !1,
|
|
2589
|
+
...h(t)
|
|
2590
|
+
});
|
|
2591
|
+
}
|
|
2592
|
+
function ho(e, t) {
|
|
2593
|
+
return new e({
|
|
2594
|
+
type: "string",
|
|
2595
|
+
format: "cidrv6",
|
|
2596
|
+
check: "string_format",
|
|
2597
|
+
abort: !1,
|
|
2598
|
+
...h(t)
|
|
2599
|
+
});
|
|
2600
|
+
}
|
|
2601
|
+
function fo(e, t) {
|
|
2602
|
+
return new e({
|
|
2603
|
+
type: "string",
|
|
2604
|
+
format: "base64",
|
|
2605
|
+
check: "string_format",
|
|
2606
|
+
abort: !1,
|
|
2607
|
+
...h(t)
|
|
2608
|
+
});
|
|
2609
|
+
}
|
|
2610
|
+
function mo(e, t) {
|
|
2611
|
+
return new e({
|
|
2612
|
+
type: "string",
|
|
2613
|
+
format: "base64url",
|
|
2614
|
+
check: "string_format",
|
|
2615
|
+
abort: !1,
|
|
2616
|
+
...h(t)
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
function go(e, t) {
|
|
2620
|
+
return new e({
|
|
2621
|
+
type: "string",
|
|
2622
|
+
format: "e164",
|
|
2623
|
+
check: "string_format",
|
|
2624
|
+
abort: !1,
|
|
2625
|
+
...h(t)
|
|
2626
|
+
});
|
|
2627
|
+
}
|
|
2628
|
+
function vo(e, t) {
|
|
2629
|
+
return new e({
|
|
2630
|
+
type: "string",
|
|
2631
|
+
format: "jwt",
|
|
2632
|
+
check: "string_format",
|
|
2633
|
+
abort: !1,
|
|
2634
|
+
...h(t)
|
|
2635
|
+
});
|
|
2636
|
+
}
|
|
2637
|
+
function _o(e, t) {
|
|
2638
|
+
return new e({
|
|
2639
|
+
type: "string",
|
|
2640
|
+
format: "datetime",
|
|
2641
|
+
check: "string_format",
|
|
2642
|
+
offset: !1,
|
|
2643
|
+
local: !1,
|
|
2644
|
+
precision: null,
|
|
2645
|
+
...h(t)
|
|
2646
|
+
});
|
|
2647
|
+
}
|
|
2648
|
+
function yo(e, t) {
|
|
2649
|
+
return new e({
|
|
2650
|
+
type: "string",
|
|
2651
|
+
format: "date",
|
|
2652
|
+
check: "string_format",
|
|
2653
|
+
...h(t)
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
function ko(e, t) {
|
|
2657
|
+
return new e({
|
|
2658
|
+
type: "string",
|
|
2659
|
+
format: "time",
|
|
2660
|
+
check: "string_format",
|
|
2661
|
+
precision: null,
|
|
2662
|
+
...h(t)
|
|
2663
|
+
});
|
|
2664
|
+
}
|
|
2665
|
+
function wo(e, t) {
|
|
2666
|
+
return new e({
|
|
2667
|
+
type: "string",
|
|
2668
|
+
format: "duration",
|
|
2669
|
+
check: "string_format",
|
|
2670
|
+
...h(t)
|
|
2671
|
+
});
|
|
2672
|
+
}
|
|
2673
|
+
function bo(e, t) {
|
|
2674
|
+
return new e({
|
|
2675
|
+
type: "number",
|
|
2676
|
+
checks: [],
|
|
2677
|
+
...h(t)
|
|
2678
|
+
});
|
|
2679
|
+
}
|
|
2680
|
+
function zo(e, t) {
|
|
2681
|
+
return new e({
|
|
2682
|
+
type: "number",
|
|
2683
|
+
check: "number_format",
|
|
2684
|
+
abort: !1,
|
|
2685
|
+
format: "safeint",
|
|
2686
|
+
...h(t)
|
|
2687
|
+
});
|
|
2688
|
+
}
|
|
2689
|
+
function $o(e) {
|
|
2690
|
+
return new e({
|
|
2691
|
+
type: "unknown"
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
function To(e, t) {
|
|
2695
|
+
return new e({
|
|
2696
|
+
type: "never",
|
|
2697
|
+
...h(t)
|
|
2698
|
+
});
|
|
2699
|
+
}
|
|
2700
|
+
function xe(e, t) {
|
|
2701
|
+
return new it({
|
|
2702
|
+
check: "less_than",
|
|
2703
|
+
...h(t),
|
|
2704
|
+
value: e,
|
|
2705
|
+
inclusive: !1
|
|
2706
|
+
});
|
|
2707
|
+
}
|
|
2708
|
+
function se(e, t) {
|
|
2709
|
+
return new it({
|
|
2710
|
+
check: "less_than",
|
|
2711
|
+
...h(t),
|
|
2712
|
+
value: e,
|
|
2713
|
+
inclusive: !0
|
|
2714
|
+
});
|
|
2715
|
+
}
|
|
2716
|
+
function je(e, t) {
|
|
2717
|
+
return new st({
|
|
2718
|
+
check: "greater_than",
|
|
2719
|
+
...h(t),
|
|
2720
|
+
value: e,
|
|
2721
|
+
inclusive: !1
|
|
2722
|
+
});
|
|
2723
|
+
}
|
|
2724
|
+
function ae(e, t) {
|
|
2725
|
+
return new st({
|
|
2726
|
+
check: "greater_than",
|
|
2727
|
+
...h(t),
|
|
2728
|
+
value: e,
|
|
2729
|
+
inclusive: !0
|
|
2730
|
+
});
|
|
2731
|
+
}
|
|
2732
|
+
function De(e, t) {
|
|
2733
|
+
return new Un({
|
|
2734
|
+
check: "multiple_of",
|
|
2735
|
+
...h(t),
|
|
2736
|
+
value: e
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
function ht(e, t) {
|
|
2740
|
+
return new Vn({
|
|
2741
|
+
check: "max_length",
|
|
2742
|
+
...h(t),
|
|
2743
|
+
maximum: e
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
function X(e, t) {
|
|
2747
|
+
return new Gn({
|
|
2748
|
+
check: "min_length",
|
|
2749
|
+
...h(t),
|
|
2750
|
+
minimum: e
|
|
2751
|
+
});
|
|
2752
|
+
}
|
|
2753
|
+
function ft(e, t) {
|
|
2754
|
+
return new Wn({
|
|
2755
|
+
check: "length_equals",
|
|
2756
|
+
...h(t),
|
|
2757
|
+
length: e
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
function Zo(e, t) {
|
|
2761
|
+
return new Bn({
|
|
2762
|
+
check: "string_format",
|
|
2763
|
+
format: "regex",
|
|
2764
|
+
...h(t),
|
|
2765
|
+
pattern: e
|
|
2766
|
+
});
|
|
2767
|
+
}
|
|
2768
|
+
function Io(e) {
|
|
2769
|
+
return new Kn({
|
|
2770
|
+
check: "string_format",
|
|
2771
|
+
format: "lowercase",
|
|
2772
|
+
...h(e)
|
|
2773
|
+
});
|
|
2774
|
+
}
|
|
2775
|
+
function Eo(e) {
|
|
2776
|
+
return new qn({
|
|
2777
|
+
check: "string_format",
|
|
2778
|
+
format: "uppercase",
|
|
2779
|
+
...h(e)
|
|
2780
|
+
});
|
|
2781
|
+
}
|
|
2782
|
+
function So(e, t) {
|
|
2783
|
+
return new Xn({
|
|
2784
|
+
check: "string_format",
|
|
2785
|
+
format: "includes",
|
|
2786
|
+
...h(t),
|
|
2787
|
+
includes: e
|
|
2788
|
+
});
|
|
2789
|
+
}
|
|
2790
|
+
function Oo(e, t) {
|
|
2791
|
+
return new Yn({
|
|
2792
|
+
check: "string_format",
|
|
2793
|
+
format: "starts_with",
|
|
2794
|
+
...h(t),
|
|
2795
|
+
prefix: e
|
|
2796
|
+
});
|
|
2797
|
+
}
|
|
2798
|
+
function Po(e, t) {
|
|
2799
|
+
return new Hn({
|
|
2800
|
+
check: "string_format",
|
|
2801
|
+
format: "ends_with",
|
|
2802
|
+
...h(t),
|
|
2803
|
+
suffix: e
|
|
2804
|
+
});
|
|
2805
|
+
}
|
|
2806
|
+
function F(e) {
|
|
2807
|
+
return new Qn({
|
|
2808
|
+
check: "overwrite",
|
|
2809
|
+
tx: e
|
|
2810
|
+
});
|
|
2811
|
+
}
|
|
2812
|
+
function No(e) {
|
|
2813
|
+
return F((t) => t.normalize(e));
|
|
2814
|
+
}
|
|
2815
|
+
function Ao() {
|
|
2816
|
+
return F((e) => e.trim());
|
|
2817
|
+
}
|
|
2818
|
+
function Ro() {
|
|
2819
|
+
return F((e) => e.toLowerCase());
|
|
2820
|
+
}
|
|
2821
|
+
function Co() {
|
|
2822
|
+
return F((e) => e.toUpperCase());
|
|
2823
|
+
}
|
|
2824
|
+
function xo() {
|
|
2825
|
+
return F((e) => Wt(e));
|
|
2826
|
+
}
|
|
2827
|
+
function jo(e, t, n) {
|
|
2828
|
+
return new e({
|
|
2829
|
+
type: "array",
|
|
2830
|
+
element: t,
|
|
2831
|
+
// get element() {
|
|
2832
|
+
// return element;
|
|
2833
|
+
// },
|
|
2834
|
+
...h(n)
|
|
2835
|
+
});
|
|
2836
|
+
}
|
|
2837
|
+
function Do(e, t, n) {
|
|
2838
|
+
return new e({
|
|
2839
|
+
type: "custom",
|
|
2840
|
+
check: "custom",
|
|
2841
|
+
fn: t,
|
|
2842
|
+
...h(n)
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
function Lo(e) {
|
|
2846
|
+
const t = Fo((n) => (n.addIssue = (r) => {
|
|
2847
|
+
if (typeof r == "string")
|
|
2848
|
+
n.issues.push(G(r, n.value, t._zod.def));
|
|
2849
|
+
else {
|
|
2850
|
+
const o = r;
|
|
2851
|
+
o.fatal && (o.continue = !1), o.code ?? (o.code = "custom"), o.input ?? (o.input = n.value), o.inst ?? (o.inst = t), o.continue ?? (o.continue = !t._zod.def.abort), n.issues.push(G(o));
|
|
2852
|
+
}
|
|
2853
|
+
}, e(n.value, n)));
|
|
2854
|
+
return t;
|
|
2855
|
+
}
|
|
2856
|
+
function Fo(e, t) {
|
|
2857
|
+
const n = new z({
|
|
2858
|
+
check: "custom",
|
|
2859
|
+
...h(t)
|
|
2860
|
+
});
|
|
2861
|
+
return n._zod.check = e, n;
|
|
2862
|
+
}
|
|
2863
|
+
function dt(e) {
|
|
2864
|
+
let t = e?.target ?? "draft-2020-12";
|
|
2865
|
+
return t === "draft-4" && (t = "draft-04"), t === "draft-7" && (t = "draft-07"), {
|
|
2866
|
+
processors: e.processors ?? {},
|
|
2867
|
+
metadataRegistry: e?.metadata ?? U,
|
|
2868
|
+
target: t,
|
|
2869
|
+
unrepresentable: e?.unrepresentable ?? "throw",
|
|
2870
|
+
override: e?.override ?? (() => {
|
|
2871
|
+
}),
|
|
2872
|
+
io: e?.io ?? "output",
|
|
2873
|
+
counter: 0,
|
|
2874
|
+
seen: /* @__PURE__ */ new Map(),
|
|
2875
|
+
cycles: e?.cycles ?? "ref",
|
|
2876
|
+
reused: e?.reused ?? "inline",
|
|
2877
|
+
external: e?.external ?? void 0
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
function w(e, t, n = { path: [], schemaPath: [] }) {
|
|
2881
|
+
var r;
|
|
2882
|
+
const o = e._zod.def, i = t.seen.get(e);
|
|
2883
|
+
if (i)
|
|
2884
|
+
return i.count++, n.schemaPath.includes(e) && (i.cycle = n.path), i.schema;
|
|
2885
|
+
const s = { schema: {}, count: 1, cycle: void 0, path: n.path };
|
|
2886
|
+
t.seen.set(e, s);
|
|
2887
|
+
const a = e._zod.toJSONSchema?.();
|
|
2888
|
+
if (a)
|
|
2889
|
+
s.schema = a;
|
|
2890
|
+
else {
|
|
2891
|
+
const p = {
|
|
2892
|
+
...n,
|
|
2893
|
+
schemaPath: [...n.schemaPath, e],
|
|
2894
|
+
path: n.path
|
|
2895
|
+
}, f = e._zod.parent;
|
|
2896
|
+
if (f)
|
|
2897
|
+
s.ref = f, w(f, t, p), t.seen.get(f).isParent = !0;
|
|
2898
|
+
else if (e._zod.processJSONSchema)
|
|
2899
|
+
e._zod.processJSONSchema(t, s.schema, p);
|
|
2900
|
+
else {
|
|
2901
|
+
const d = s.schema, v = t.processors[o.type];
|
|
2902
|
+
if (!v)
|
|
2903
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);
|
|
2904
|
+
v(e, t, d, p);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
const u = t.metadataRegistry.get(e);
|
|
2908
|
+
return u && Object.assign(s.schema, u), t.io === "input" && b(e) && (delete s.schema.examples, delete s.schema.default), t.io === "input" && s.schema._prefault && ((r = s.schema).default ?? (r.default = s.schema._prefault)), delete s.schema._prefault, t.seen.get(e).schema;
|
|
2909
|
+
}
|
|
2910
|
+
function mt(e, t) {
|
|
2911
|
+
const n = e.seen.get(t);
|
|
2912
|
+
if (!n)
|
|
2913
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2914
|
+
const r = (i) => {
|
|
2915
|
+
const s = e.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2916
|
+
if (e.external) {
|
|
2917
|
+
const p = e.external.registry.get(i[0])?.id, f = e.external.uri ?? ((v) => v);
|
|
2918
|
+
if (p)
|
|
2919
|
+
return { ref: f(p) };
|
|
2920
|
+
const d = i[1].defId ?? i[1].schema.id ?? `schema${e.counter++}`;
|
|
2921
|
+
return i[1].defId = d, { defId: d, ref: `${f("__shared")}#/${s}/${d}` };
|
|
2922
|
+
}
|
|
2923
|
+
if (i[1] === n)
|
|
2924
|
+
return { ref: "#" };
|
|
2925
|
+
const u = `#/${s}/`, l = i[1].schema.id ?? `__schema${e.counter++}`;
|
|
2926
|
+
return { defId: l, ref: u + l };
|
|
2927
|
+
}, o = (i) => {
|
|
2928
|
+
if (i[1].schema.$ref)
|
|
2929
|
+
return;
|
|
2930
|
+
const s = i[1], { ref: a, defId: u } = r(i);
|
|
2931
|
+
s.def = { ...s.schema }, u && (s.defId = u);
|
|
2932
|
+
const l = s.schema;
|
|
2933
|
+
for (const p in l)
|
|
2934
|
+
delete l[p];
|
|
2935
|
+
l.$ref = a;
|
|
2936
|
+
};
|
|
2937
|
+
if (e.cycles === "throw")
|
|
2938
|
+
for (const i of e.seen.entries()) {
|
|
2939
|
+
const s = i[1];
|
|
2940
|
+
if (s.cycle)
|
|
2941
|
+
throw new Error(`Cycle detected: #/${s.cycle?.join("/")}/<root>
|
|
2942
|
+
|
|
2943
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
2944
|
+
}
|
|
2945
|
+
for (const i of e.seen.entries()) {
|
|
2946
|
+
const s = i[1];
|
|
2947
|
+
if (t === i[0]) {
|
|
2948
|
+
o(i);
|
|
2949
|
+
continue;
|
|
2950
|
+
}
|
|
2951
|
+
if (e.external) {
|
|
2952
|
+
const u = e.external.registry.get(i[0])?.id;
|
|
2953
|
+
if (t !== i[0] && u) {
|
|
2954
|
+
o(i);
|
|
2955
|
+
continue;
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
if (e.metadataRegistry.get(i[0])?.id) {
|
|
2959
|
+
o(i);
|
|
2960
|
+
continue;
|
|
2961
|
+
}
|
|
2962
|
+
if (s.cycle) {
|
|
2963
|
+
o(i);
|
|
2964
|
+
continue;
|
|
2965
|
+
}
|
|
2966
|
+
if (s.count > 1 && e.reused === "ref") {
|
|
2967
|
+
o(i);
|
|
2968
|
+
continue;
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
function gt(e, t) {
|
|
2973
|
+
const n = e.seen.get(t);
|
|
2974
|
+
if (!n)
|
|
2975
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2976
|
+
const r = (s) => {
|
|
2977
|
+
const a = e.seen.get(s), u = a.def ?? a.schema, l = { ...u };
|
|
2978
|
+
if (a.ref === null)
|
|
2979
|
+
return;
|
|
2980
|
+
const p = a.ref;
|
|
2981
|
+
if (a.ref = null, p) {
|
|
2982
|
+
r(p);
|
|
2983
|
+
const f = e.seen.get(p).schema;
|
|
2984
|
+
f.$ref && (e.target === "draft-07" || e.target === "draft-04" || e.target === "openapi-3.0") ? (u.allOf = u.allOf ?? [], u.allOf.push(f)) : (Object.assign(u, f), Object.assign(u, l));
|
|
2985
|
+
}
|
|
2986
|
+
a.isParent || e.override({
|
|
2987
|
+
zodSchema: s,
|
|
2988
|
+
jsonSchema: u,
|
|
2989
|
+
path: a.path ?? []
|
|
2990
|
+
});
|
|
2991
|
+
};
|
|
2992
|
+
for (const s of [...e.seen.entries()].reverse())
|
|
2993
|
+
r(s[0]);
|
|
2994
|
+
const o = {};
|
|
2995
|
+
if (e.target === "draft-2020-12" ? o.$schema = "https://json-schema.org/draft/2020-12/schema" : e.target === "draft-07" ? o.$schema = "http://json-schema.org/draft-07/schema#" : e.target === "draft-04" ? o.$schema = "http://json-schema.org/draft-04/schema#" : e.target, e.external?.uri) {
|
|
2996
|
+
const s = e.external.registry.get(t)?.id;
|
|
2997
|
+
if (!s)
|
|
2998
|
+
throw new Error("Schema is missing an `id` property");
|
|
2999
|
+
o.$id = e.external.uri(s);
|
|
3000
|
+
}
|
|
3001
|
+
Object.assign(o, n.def ?? n.schema);
|
|
3002
|
+
const i = e.external?.defs ?? {};
|
|
3003
|
+
for (const s of e.seen.entries()) {
|
|
3004
|
+
const a = s[1];
|
|
3005
|
+
a.def && a.defId && (i[a.defId] = a.def);
|
|
3006
|
+
}
|
|
3007
|
+
e.external || Object.keys(i).length > 0 && (e.target === "draft-2020-12" ? o.$defs = i : o.definitions = i);
|
|
3008
|
+
try {
|
|
3009
|
+
const s = JSON.parse(JSON.stringify(o));
|
|
3010
|
+
return Object.defineProperty(s, "~standard", {
|
|
3011
|
+
value: {
|
|
3012
|
+
...t["~standard"],
|
|
3013
|
+
jsonSchema: {
|
|
3014
|
+
input: Y(t, "input"),
|
|
3015
|
+
output: Y(t, "output")
|
|
3016
|
+
}
|
|
3017
|
+
},
|
|
3018
|
+
enumerable: !1,
|
|
3019
|
+
writable: !1
|
|
3020
|
+
}), s;
|
|
3021
|
+
} catch {
|
|
3022
|
+
throw new Error("Error converting schema to JSON.");
|
|
3023
|
+
}
|
|
3024
|
+
}
|
|
3025
|
+
function b(e, t) {
|
|
3026
|
+
const n = t ?? { seen: /* @__PURE__ */ new Set() };
|
|
3027
|
+
if (n.seen.has(e))
|
|
3028
|
+
return !1;
|
|
3029
|
+
n.seen.add(e);
|
|
3030
|
+
const r = e._zod.def;
|
|
3031
|
+
if (r.type === "transform")
|
|
3032
|
+
return !0;
|
|
3033
|
+
if (r.type === "array")
|
|
3034
|
+
return b(r.element, n);
|
|
3035
|
+
if (r.type === "set")
|
|
3036
|
+
return b(r.valueType, n);
|
|
3037
|
+
if (r.type === "lazy")
|
|
3038
|
+
return b(r.getter(), n);
|
|
3039
|
+
if (r.type === "promise" || r.type === "optional" || r.type === "nonoptional" || r.type === "nullable" || r.type === "readonly" || r.type === "default" || r.type === "prefault")
|
|
3040
|
+
return b(r.innerType, n);
|
|
3041
|
+
if (r.type === "intersection")
|
|
3042
|
+
return b(r.left, n) || b(r.right, n);
|
|
3043
|
+
if (r.type === "record" || r.type === "map")
|
|
3044
|
+
return b(r.keyType, n) || b(r.valueType, n);
|
|
3045
|
+
if (r.type === "pipe")
|
|
3046
|
+
return b(r.in, n) || b(r.out, n);
|
|
3047
|
+
if (r.type === "object") {
|
|
3048
|
+
for (const o in r.shape)
|
|
3049
|
+
if (b(r.shape[o], n))
|
|
3050
|
+
return !0;
|
|
3051
|
+
return !1;
|
|
3052
|
+
}
|
|
3053
|
+
if (r.type === "union") {
|
|
3054
|
+
for (const o of r.options)
|
|
3055
|
+
if (b(o, n))
|
|
3056
|
+
return !0;
|
|
3057
|
+
return !1;
|
|
3058
|
+
}
|
|
3059
|
+
if (r.type === "tuple") {
|
|
3060
|
+
for (const o of r.items)
|
|
3061
|
+
if (b(o, n))
|
|
3062
|
+
return !0;
|
|
3063
|
+
return !!(r.rest && b(r.rest, n));
|
|
3064
|
+
}
|
|
3065
|
+
return !1;
|
|
3066
|
+
}
|
|
3067
|
+
const Mo = (e, t = {}) => (n) => {
|
|
3068
|
+
const r = dt({ ...n, processors: t });
|
|
3069
|
+
return w(e, r), mt(r, e), gt(r, e);
|
|
3070
|
+
}, Y = (e, t) => (n) => {
|
|
3071
|
+
const { libraryOptions: r, target: o } = n ?? {}, i = dt({ ...r ?? {}, target: o, io: t, processors: {} });
|
|
3072
|
+
return w(e, i), mt(i, e), gt(i, e);
|
|
3073
|
+
}, Uo = {
|
|
3074
|
+
guid: "uuid",
|
|
3075
|
+
url: "uri",
|
|
3076
|
+
datetime: "date-time",
|
|
3077
|
+
json_string: "json-string",
|
|
3078
|
+
regex: ""
|
|
3079
|
+
// do not set
|
|
3080
|
+
}, Jo = (e, t, n, r) => {
|
|
3081
|
+
const o = n;
|
|
3082
|
+
o.type = "string";
|
|
3083
|
+
const { minimum: i, maximum: s, format: a, patterns: u, contentEncoding: l } = e._zod.bag;
|
|
3084
|
+
if (typeof i == "number" && (o.minLength = i), typeof s == "number" && (o.maxLength = s), a && (o.format = Uo[a] ?? a, o.format === "" && delete o.format), l && (o.contentEncoding = l), u && u.size > 0) {
|
|
3085
|
+
const p = [...u];
|
|
3086
|
+
p.length === 1 ? o.pattern = p[0].source : p.length > 1 && (o.allOf = [
|
|
3087
|
+
...p.map((f) => ({
|
|
3088
|
+
...t.target === "draft-07" || t.target === "draft-04" || t.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3089
|
+
pattern: f.source
|
|
3090
|
+
}))
|
|
3091
|
+
]);
|
|
3092
|
+
}
|
|
3093
|
+
}, Vo = (e, t, n, r) => {
|
|
3094
|
+
const o = n, { minimum: i, maximum: s, format: a, multipleOf: u, exclusiveMaximum: l, exclusiveMinimum: p } = e._zod.bag;
|
|
3095
|
+
typeof a == "string" && a.includes("int") ? o.type = "integer" : o.type = "number", typeof p == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (o.minimum = p, o.exclusiveMinimum = !0) : o.exclusiveMinimum = p), typeof i == "number" && (o.minimum = i, typeof p == "number" && t.target !== "draft-04" && (p >= i ? delete o.minimum : delete o.exclusiveMinimum)), typeof l == "number" && (t.target === "draft-04" || t.target === "openapi-3.0" ? (o.maximum = l, o.exclusiveMaximum = !0) : o.exclusiveMaximum = l), typeof s == "number" && (o.maximum = s, typeof l == "number" && t.target !== "draft-04" && (l <= s ? delete o.maximum : delete o.exclusiveMaximum)), typeof u == "number" && (o.multipleOf = u);
|
|
3096
|
+
}, Go = (e, t, n, r) => {
|
|
3097
|
+
n.not = {};
|
|
3098
|
+
}, Wo = (e, t, n, r) => {
|
|
3099
|
+
}, Bo = (e, t, n, r) => {
|
|
3100
|
+
const o = e._zod.def, i = Ke(o.entries);
|
|
3101
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), n.enum = i;
|
|
3102
|
+
}, Ko = (e, t, n, r) => {
|
|
3103
|
+
const o = e._zod.def, i = [];
|
|
3104
|
+
for (const s of o.values)
|
|
3105
|
+
if (s === void 0) {
|
|
3106
|
+
if (t.unrepresentable === "throw")
|
|
3107
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
3108
|
+
} else if (typeof s == "bigint") {
|
|
3109
|
+
if (t.unrepresentable === "throw")
|
|
3110
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
3111
|
+
i.push(Number(s));
|
|
3112
|
+
} else
|
|
3113
|
+
i.push(s);
|
|
3114
|
+
if (i.length !== 0) if (i.length === 1) {
|
|
3115
|
+
const s = i[0];
|
|
3116
|
+
n.type = s === null ? "null" : typeof s, t.target === "draft-04" || t.target === "openapi-3.0" ? n.enum = [s] : n.const = s;
|
|
3117
|
+
} else
|
|
3118
|
+
i.every((s) => typeof s == "number") && (n.type = "number"), i.every((s) => typeof s == "string") && (n.type = "string"), i.every((s) => typeof s == "boolean") && (n.type = "boolean"), i.every((s) => s === null) && (n.type = "null"), n.enum = i;
|
|
3119
|
+
}, qo = (e, t, n, r) => {
|
|
3120
|
+
if (t.unrepresentable === "throw")
|
|
3121
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3122
|
+
}, Xo = (e, t, n, r) => {
|
|
3123
|
+
if (t.unrepresentable === "throw")
|
|
3124
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3125
|
+
}, Yo = (e, t, n, r) => {
|
|
3126
|
+
const o = n, i = e._zod.def, { minimum: s, maximum: a } = e._zod.bag;
|
|
3127
|
+
typeof s == "number" && (o.minItems = s), typeof a == "number" && (o.maxItems = a), o.type = "array", o.items = w(i.element, t, { ...r, path: [...r.path, "items"] });
|
|
3128
|
+
}, Ho = (e, t, n, r) => {
|
|
3129
|
+
const o = n, i = e._zod.def;
|
|
3130
|
+
o.type = "object", o.properties = {};
|
|
3131
|
+
const s = i.shape;
|
|
3132
|
+
for (const l in s)
|
|
3133
|
+
o.properties[l] = w(s[l], t, {
|
|
3134
|
+
...r,
|
|
3135
|
+
path: [...r.path, "properties", l]
|
|
3136
|
+
});
|
|
3137
|
+
const a = new Set(Object.keys(s)), u = new Set([...a].filter((l) => {
|
|
3138
|
+
const p = i.shape[l]._zod;
|
|
3139
|
+
return t.io === "input" ? p.optin === void 0 : p.optout === void 0;
|
|
3140
|
+
}));
|
|
3141
|
+
u.size > 0 && (o.required = Array.from(u)), i.catchall?._zod.def.type === "never" ? o.additionalProperties = !1 : i.catchall ? i.catchall && (o.additionalProperties = w(i.catchall, t, {
|
|
3142
|
+
...r,
|
|
3143
|
+
path: [...r.path, "additionalProperties"]
|
|
3144
|
+
})) : t.io === "output" && (o.additionalProperties = !1);
|
|
3145
|
+
}, Qo = (e, t, n, r) => {
|
|
3146
|
+
const o = e._zod.def, i = o.inclusive === !1, s = o.options.map((a, u) => w(a, t, {
|
|
3147
|
+
...r,
|
|
3148
|
+
path: [...r.path, i ? "oneOf" : "anyOf", u]
|
|
3149
|
+
}));
|
|
3150
|
+
i ? n.oneOf = s : n.anyOf = s;
|
|
3151
|
+
}, ei = (e, t, n, r) => {
|
|
3152
|
+
const o = e._zod.def, i = w(o.left, t, {
|
|
3153
|
+
...r,
|
|
3154
|
+
path: [...r.path, "allOf", 0]
|
|
3155
|
+
}), s = w(o.right, t, {
|
|
3156
|
+
...r,
|
|
3157
|
+
path: [...r.path, "allOf", 1]
|
|
3158
|
+
}), a = (l) => "allOf" in l && Object.keys(l).length === 1, u = [
|
|
3159
|
+
...a(i) ? i.allOf : [i],
|
|
3160
|
+
...a(s) ? s.allOf : [s]
|
|
3161
|
+
];
|
|
3162
|
+
n.allOf = u;
|
|
3163
|
+
}, ti = (e, t, n, r) => {
|
|
3164
|
+
const o = e._zod.def, i = w(o.innerType, t, r), s = t.seen.get(e);
|
|
3165
|
+
t.target === "openapi-3.0" ? (s.ref = o.innerType, n.nullable = !0) : n.anyOf = [i, { type: "null" }];
|
|
3166
|
+
}, ni = (e, t, n, r) => {
|
|
3167
|
+
const o = e._zod.def;
|
|
3168
|
+
w(o.innerType, t, r);
|
|
3169
|
+
const i = t.seen.get(e);
|
|
3170
|
+
i.ref = o.innerType;
|
|
3171
|
+
}, ri = (e, t, n, r) => {
|
|
3172
|
+
const o = e._zod.def;
|
|
3173
|
+
w(o.innerType, t, r);
|
|
3174
|
+
const i = t.seen.get(e);
|
|
3175
|
+
i.ref = o.innerType, n.default = JSON.parse(JSON.stringify(o.defaultValue));
|
|
3176
|
+
}, oi = (e, t, n, r) => {
|
|
3177
|
+
const o = e._zod.def;
|
|
3178
|
+
w(o.innerType, t, r);
|
|
3179
|
+
const i = t.seen.get(e);
|
|
3180
|
+
i.ref = o.innerType, t.io === "input" && (n._prefault = JSON.parse(JSON.stringify(o.defaultValue)));
|
|
3181
|
+
}, ii = (e, t, n, r) => {
|
|
3182
|
+
const o = e._zod.def;
|
|
3183
|
+
w(o.innerType, t, r);
|
|
3184
|
+
const i = t.seen.get(e);
|
|
3185
|
+
i.ref = o.innerType;
|
|
3186
|
+
let s;
|
|
3187
|
+
try {
|
|
3188
|
+
s = o.catchValue(void 0);
|
|
3189
|
+
} catch {
|
|
3190
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3191
|
+
}
|
|
3192
|
+
n.default = s;
|
|
3193
|
+
}, si = (e, t, n, r) => {
|
|
3194
|
+
const o = e._zod.def, i = t.io === "input" ? o.in._zod.def.type === "transform" ? o.out : o.in : o.out;
|
|
3195
|
+
w(i, t, r);
|
|
3196
|
+
const s = t.seen.get(e);
|
|
3197
|
+
s.ref = i;
|
|
3198
|
+
}, ai = (e, t, n, r) => {
|
|
3199
|
+
const o = e._zod.def;
|
|
3200
|
+
w(o.innerType, t, r);
|
|
3201
|
+
const i = t.seen.get(e);
|
|
3202
|
+
i.ref = o.innerType, n.readOnly = !0;
|
|
3203
|
+
}, ci = (e, t, n, r) => {
|
|
3204
|
+
const o = e._zod.def;
|
|
3205
|
+
w(o.innerType, t, r);
|
|
3206
|
+
const i = t.seen.get(e);
|
|
3207
|
+
i.ref = o.innerType;
|
|
3208
|
+
}, ui = /* @__PURE__ */ c("ZodISODateTime", (e, t) => {
|
|
3209
|
+
fr.init(e, t), _.init(e, t);
|
|
3210
|
+
});
|
|
3211
|
+
function li(e) {
|
|
3212
|
+
return _o(ui, e);
|
|
3213
|
+
}
|
|
3214
|
+
const pi = /* @__PURE__ */ c("ZodISODate", (e, t) => {
|
|
3215
|
+
dr.init(e, t), _.init(e, t);
|
|
3216
|
+
});
|
|
3217
|
+
function hi(e) {
|
|
3218
|
+
return yo(pi, e);
|
|
3219
|
+
}
|
|
3220
|
+
const fi = /* @__PURE__ */ c("ZodISOTime", (e, t) => {
|
|
3221
|
+
mr.init(e, t), _.init(e, t);
|
|
3222
|
+
});
|
|
3223
|
+
function di(e) {
|
|
3224
|
+
return ko(fi, e);
|
|
3225
|
+
}
|
|
3226
|
+
const mi = /* @__PURE__ */ c("ZodISODuration", (e, t) => {
|
|
3227
|
+
gr.init(e, t), _.init(e, t);
|
|
3228
|
+
});
|
|
3229
|
+
function gi(e) {
|
|
3230
|
+
return wo(mi, e);
|
|
3231
|
+
}
|
|
3232
|
+
const vi = (e, t) => {
|
|
3233
|
+
Qe.init(e, t), e.name = "ZodError", Object.defineProperties(e, {
|
|
3234
|
+
format: {
|
|
3235
|
+
value: (n) => sn(e, n)
|
|
3236
|
+
// enumerable: false,
|
|
3237
|
+
},
|
|
3238
|
+
flatten: {
|
|
3239
|
+
value: (n) => on(e, n)
|
|
3240
|
+
// enumerable: false,
|
|
3241
|
+
},
|
|
3242
|
+
addIssue: {
|
|
3243
|
+
value: (n) => {
|
|
3244
|
+
e.issues.push(n), e.message = JSON.stringify(e.issues, le, 2);
|
|
3245
|
+
}
|
|
3246
|
+
// enumerable: false,
|
|
3247
|
+
},
|
|
3248
|
+
addIssues: {
|
|
3249
|
+
value: (n) => {
|
|
3250
|
+
e.issues.push(...n), e.message = JSON.stringify(e.issues, le, 2);
|
|
3251
|
+
}
|
|
3252
|
+
// enumerable: false,
|
|
3253
|
+
},
|
|
3254
|
+
isEmpty: {
|
|
3255
|
+
get() {
|
|
3256
|
+
return e.issues.length === 0;
|
|
3257
|
+
}
|
|
3258
|
+
// enumerable: false,
|
|
3259
|
+
}
|
|
3260
|
+
});
|
|
3261
|
+
}, T = c("ZodError", vi, {
|
|
3262
|
+
Parent: Error
|
|
3263
|
+
}), _i = /* @__PURE__ */ ve(T), yi = /* @__PURE__ */ _e(T), ki = /* @__PURE__ */ te(T), wi = /* @__PURE__ */ ne(T), bi = /* @__PURE__ */ un(T), zi = /* @__PURE__ */ ln(T), $i = /* @__PURE__ */ pn(T), Ti = /* @__PURE__ */ hn(T), Zi = /* @__PURE__ */ fn(T), Ii = /* @__PURE__ */ dn(T), Ei = /* @__PURE__ */ mn(T), Si = /* @__PURE__ */ gn(T), k = /* @__PURE__ */ c("ZodType", (e, t) => (y.init(e, t), Object.assign(e["~standard"], {
|
|
3264
|
+
jsonSchema: {
|
|
3265
|
+
input: Y(e, "input"),
|
|
3266
|
+
output: Y(e, "output")
|
|
3267
|
+
}
|
|
3268
|
+
}), e.toJSONSchema = Mo(e, {}), e.def = t, e.type = t.type, Object.defineProperty(e, "_def", { value: t }), e.check = (...n) => e.clone(x(t, {
|
|
3269
|
+
checks: [
|
|
3270
|
+
...t.checks ?? [],
|
|
3271
|
+
...n.map((r) => typeof r == "function" ? { _zod: { check: r, def: { check: "custom" }, onattach: [] } } : r)
|
|
3272
|
+
]
|
|
3273
|
+
})), e.clone = (n, r) => P(e, n, r), e.brand = () => e, e.register = ((n, r) => (n.add(e, r), e)), e.parse = (n, r) => _i(e, n, r, { callee: e.parse }), e.safeParse = (n, r) => ki(e, n, r), e.parseAsync = async (n, r) => yi(e, n, r, { callee: e.parseAsync }), e.safeParseAsync = async (n, r) => wi(e, n, r), e.spa = e.safeParseAsync, e.encode = (n, r) => bi(e, n, r), e.decode = (n, r) => zi(e, n, r), e.encodeAsync = async (n, r) => $i(e, n, r), e.decodeAsync = async (n, r) => Ti(e, n, r), e.safeEncode = (n, r) => Zi(e, n, r), e.safeDecode = (n, r) => Ii(e, n, r), e.safeEncodeAsync = async (n, r) => Ei(e, n, r), e.safeDecodeAsync = async (n, r) => Si(e, n, r), e.refine = (n, r) => e.check(ks(n, r)), e.superRefine = (n) => e.check(ws(n)), e.overwrite = (n) => e.check(F(n)), e.optional = () => Ue(e), e.nullable = () => Je(e), e.nullish = () => Ue(Je(e)), e.nonoptional = (n) => fs(e, n), e.array = () => N(e), e.or = (n) => ke([e, n]), e.and = (n) => os(e, n), e.transform = (n) => Ve(e, as(n)), e.default = (n) => ls(e, n), e.prefault = (n) => hs(e, n), e.catch = (n) => ms(e, n), e.pipe = (n) => Ve(e, n), e.readonly = () => _s(e), e.describe = (n) => {
|
|
3274
|
+
const r = e.clone();
|
|
3275
|
+
return U.add(r, { description: n }), r;
|
|
3276
|
+
}, Object.defineProperty(e, "description", {
|
|
3277
|
+
get() {
|
|
3278
|
+
return U.get(e)?.description;
|
|
3279
|
+
},
|
|
3280
|
+
configurable: !0
|
|
3281
|
+
}), e.meta = (...n) => {
|
|
3282
|
+
if (n.length === 0)
|
|
3283
|
+
return U.get(e);
|
|
3284
|
+
const r = e.clone();
|
|
3285
|
+
return U.add(r, n[0]), r;
|
|
3286
|
+
}, e.isOptional = () => e.safeParse(void 0).success, e.isNullable = () => e.safeParse(null).success, e)), vt = /* @__PURE__ */ c("_ZodString", (e, t) => {
|
|
3287
|
+
ye.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => Jo(e, r, o);
|
|
3288
|
+
const n = e._zod.bag;
|
|
3289
|
+
e.format = n.format ?? null, e.minLength = n.minimum ?? null, e.maxLength = n.maximum ?? null, e.regex = (...r) => e.check(Zo(...r)), e.includes = (...r) => e.check(So(...r)), e.startsWith = (...r) => e.check(Oo(...r)), e.endsWith = (...r) => e.check(Po(...r)), e.min = (...r) => e.check(X(...r)), e.max = (...r) => e.check(ht(...r)), e.length = (...r) => e.check(ft(...r)), e.nonempty = (...r) => e.check(X(1, ...r)), e.lowercase = (r) => e.check(Io(r)), e.uppercase = (r) => e.check(Eo(r)), e.trim = () => e.check(Ao()), e.normalize = (...r) => e.check(No(...r)), e.toLowerCase = () => e.check(Ro()), e.toUpperCase = () => e.check(Co()), e.slugify = () => e.check(xo());
|
|
3290
|
+
}), Oi = /* @__PURE__ */ c("ZodString", (e, t) => {
|
|
3291
|
+
ye.init(e, t), vt.init(e, t), e.email = (n) => e.check(Xr(Pi, n)), e.url = (n) => e.check(to(Ni, n)), e.jwt = (n) => e.check(vo(Bi, n)), e.emoji = (n) => e.check(no(Ai, n)), e.guid = (n) => e.check(Ce(Le, n)), e.uuid = (n) => e.check(Yr(K, n)), e.uuidv4 = (n) => e.check(Hr(K, n)), e.uuidv6 = (n) => e.check(Qr(K, n)), e.uuidv7 = (n) => e.check(eo(K, n)), e.nanoid = (n) => e.check(ro(Ri, n)), e.guid = (n) => e.check(Ce(Le, n)), e.cuid = (n) => e.check(oo(Ci, n)), e.cuid2 = (n) => e.check(io(xi, n)), e.ulid = (n) => e.check(so(ji, n)), e.base64 = (n) => e.check(fo(Vi, n)), e.base64url = (n) => e.check(mo(Gi, n)), e.xid = (n) => e.check(ao(Di, n)), e.ksuid = (n) => e.check(co(Li, n)), e.ipv4 = (n) => e.check(uo(Fi, n)), e.ipv6 = (n) => e.check(lo(Mi, n)), e.cidrv4 = (n) => e.check(po(Ui, n)), e.cidrv6 = (n) => e.check(ho(Ji, n)), e.e164 = (n) => e.check(go(Wi, n)), e.datetime = (n) => e.check(li(n)), e.date = (n) => e.check(hi(n)), e.time = (n) => e.check(di(n)), e.duration = (n) => e.check(gi(n));
|
|
3292
|
+
});
|
|
3293
|
+
function I(e) {
|
|
3294
|
+
return qr(Oi, e);
|
|
3295
|
+
}
|
|
3296
|
+
const _ = /* @__PURE__ */ c("ZodStringFormat", (e, t) => {
|
|
3297
|
+
g.init(e, t), vt.init(e, t);
|
|
3298
|
+
}), Pi = /* @__PURE__ */ c("ZodEmail", (e, t) => {
|
|
3299
|
+
or.init(e, t), _.init(e, t);
|
|
3300
|
+
}), Le = /* @__PURE__ */ c("ZodGUID", (e, t) => {
|
|
3301
|
+
nr.init(e, t), _.init(e, t);
|
|
3302
|
+
}), K = /* @__PURE__ */ c("ZodUUID", (e, t) => {
|
|
3303
|
+
rr.init(e, t), _.init(e, t);
|
|
3304
|
+
}), Ni = /* @__PURE__ */ c("ZodURL", (e, t) => {
|
|
3305
|
+
ir.init(e, t), _.init(e, t);
|
|
3306
|
+
}), Ai = /* @__PURE__ */ c("ZodEmoji", (e, t) => {
|
|
3307
|
+
sr.init(e, t), _.init(e, t);
|
|
3308
|
+
}), Ri = /* @__PURE__ */ c("ZodNanoID", (e, t) => {
|
|
3309
|
+
ar.init(e, t), _.init(e, t);
|
|
3310
|
+
}), Ci = /* @__PURE__ */ c("ZodCUID", (e, t) => {
|
|
3311
|
+
cr.init(e, t), _.init(e, t);
|
|
3312
|
+
}), xi = /* @__PURE__ */ c("ZodCUID2", (e, t) => {
|
|
3313
|
+
ur.init(e, t), _.init(e, t);
|
|
3314
|
+
}), ji = /* @__PURE__ */ c("ZodULID", (e, t) => {
|
|
3315
|
+
lr.init(e, t), _.init(e, t);
|
|
3316
|
+
}), Di = /* @__PURE__ */ c("ZodXID", (e, t) => {
|
|
3317
|
+
pr.init(e, t), _.init(e, t);
|
|
3318
|
+
}), Li = /* @__PURE__ */ c("ZodKSUID", (e, t) => {
|
|
3319
|
+
hr.init(e, t), _.init(e, t);
|
|
3320
|
+
}), Fi = /* @__PURE__ */ c("ZodIPv4", (e, t) => {
|
|
3321
|
+
vr.init(e, t), _.init(e, t);
|
|
3322
|
+
}), Mi = /* @__PURE__ */ c("ZodIPv6", (e, t) => {
|
|
3323
|
+
_r.init(e, t), _.init(e, t);
|
|
3324
|
+
}), Ui = /* @__PURE__ */ c("ZodCIDRv4", (e, t) => {
|
|
3325
|
+
yr.init(e, t), _.init(e, t);
|
|
3326
|
+
}), Ji = /* @__PURE__ */ c("ZodCIDRv6", (e, t) => {
|
|
3327
|
+
kr.init(e, t), _.init(e, t);
|
|
3328
|
+
}), Vi = /* @__PURE__ */ c("ZodBase64", (e, t) => {
|
|
3329
|
+
wr.init(e, t), _.init(e, t);
|
|
3330
|
+
}), Gi = /* @__PURE__ */ c("ZodBase64URL", (e, t) => {
|
|
3331
|
+
zr.init(e, t), _.init(e, t);
|
|
3332
|
+
}), Wi = /* @__PURE__ */ c("ZodE164", (e, t) => {
|
|
3333
|
+
$r.init(e, t), _.init(e, t);
|
|
3334
|
+
}), Bi = /* @__PURE__ */ c("ZodJWT", (e, t) => {
|
|
3335
|
+
Zr.init(e, t), _.init(e, t);
|
|
3336
|
+
}), _t = /* @__PURE__ */ c("ZodNumber", (e, t) => {
|
|
3337
|
+
ct.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => Vo(e, r, o), e.gt = (r, o) => e.check(je(r, o)), e.gte = (r, o) => e.check(ae(r, o)), e.min = (r, o) => e.check(ae(r, o)), e.lt = (r, o) => e.check(xe(r, o)), e.lte = (r, o) => e.check(se(r, o)), e.max = (r, o) => e.check(se(r, o)), e.int = (r) => e.check(Fe(r)), e.safe = (r) => e.check(Fe(r)), e.positive = (r) => e.check(je(0, r)), e.nonnegative = (r) => e.check(ae(0, r)), e.negative = (r) => e.check(xe(0, r)), e.nonpositive = (r) => e.check(se(0, r)), e.multipleOf = (r, o) => e.check(De(r, o)), e.step = (r, o) => e.check(De(r, o)), e.finite = () => e;
|
|
3338
|
+
const n = e._zod.bag;
|
|
3339
|
+
e.minValue = Math.max(n.minimum ?? Number.NEGATIVE_INFINITY, n.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null, e.maxValue = Math.min(n.maximum ?? Number.POSITIVE_INFINITY, n.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null, e.isInt = (n.format ?? "").includes("int") || Number.isSafeInteger(n.multipleOf ?? 0.5), e.isFinite = !0, e.format = n.format ?? null;
|
|
3340
|
+
});
|
|
3341
|
+
function Ki(e) {
|
|
3342
|
+
return bo(_t, e);
|
|
3343
|
+
}
|
|
3344
|
+
const qi = /* @__PURE__ */ c("ZodNumberFormat", (e, t) => {
|
|
3345
|
+
Ir.init(e, t), _t.init(e, t);
|
|
3346
|
+
});
|
|
3347
|
+
function Fe(e) {
|
|
3348
|
+
return zo(qi, e);
|
|
3349
|
+
}
|
|
3350
|
+
const Xi = /* @__PURE__ */ c("ZodUnknown", (e, t) => {
|
|
3351
|
+
Er.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Wo();
|
|
3352
|
+
});
|
|
3353
|
+
function Me() {
|
|
3354
|
+
return $o(Xi);
|
|
3355
|
+
}
|
|
3356
|
+
const Yi = /* @__PURE__ */ c("ZodNever", (e, t) => {
|
|
3357
|
+
Sr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Go(e, n, r);
|
|
3358
|
+
});
|
|
3359
|
+
function Hi(e) {
|
|
3360
|
+
return To(Yi, e);
|
|
3361
|
+
}
|
|
3362
|
+
const Qi = /* @__PURE__ */ c("ZodArray", (e, t) => {
|
|
3363
|
+
Or.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Yo(e, n, r, o), e.element = t.element, e.min = (n, r) => e.check(X(n, r)), e.nonempty = (n) => e.check(X(1, n)), e.max = (n, r) => e.check(ht(n, r)), e.length = (n, r) => e.check(ft(n, r)), e.unwrap = () => e.element;
|
|
3364
|
+
});
|
|
3365
|
+
function N(e, t) {
|
|
3366
|
+
return jo(Qi, e, t);
|
|
3367
|
+
}
|
|
3368
|
+
const es = /* @__PURE__ */ c("ZodObject", (e, t) => {
|
|
3369
|
+
Nr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Ho(e, n, r, o), m(e, "shape", () => t.shape), e.keyof = () => kt(Object.keys(e._zod.def.shape)), e.catchall = (n) => e.clone({ ...e._zod.def, catchall: n }), e.passthrough = () => e.clone({ ...e._zod.def, catchall: Me() }), e.loose = () => e.clone({ ...e._zod.def, catchall: Me() }), e.strict = () => e.clone({ ...e._zod.def, catchall: Hi() }), e.strip = () => e.clone({ ...e._zod.def, catchall: void 0 }), e.extend = (n) => Qt(e, n), e.safeExtend = (n) => en(e, n), e.merge = (n) => tn(e, n), e.pick = (n) => Yt(e, n), e.omit = (n) => Ht(e, n), e.partial = (...n) => nn(wt, e, n[0]), e.required = (...n) => rn(bt, e, n[0]);
|
|
3370
|
+
});
|
|
3371
|
+
function S(e, t) {
|
|
3372
|
+
const n = {
|
|
3373
|
+
type: "object",
|
|
3374
|
+
shape: e ?? {},
|
|
3375
|
+
...h(t)
|
|
3376
|
+
};
|
|
3377
|
+
return new es(n);
|
|
3378
|
+
}
|
|
3379
|
+
const yt = /* @__PURE__ */ c("ZodUnion", (e, t) => {
|
|
3380
|
+
pt.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Qo(e, n, r, o), e.options = t.options;
|
|
3381
|
+
});
|
|
3382
|
+
function ke(e, t) {
|
|
3383
|
+
return new yt({
|
|
3384
|
+
type: "union",
|
|
3385
|
+
options: e,
|
|
3386
|
+
...h(t)
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
const ts = /* @__PURE__ */ c("ZodDiscriminatedUnion", (e, t) => {
|
|
3390
|
+
yt.init(e, t), Ar.init(e, t);
|
|
3391
|
+
});
|
|
3392
|
+
function ns(e, t, n) {
|
|
3393
|
+
return new ts({
|
|
3394
|
+
type: "union",
|
|
3395
|
+
options: t,
|
|
3396
|
+
discriminator: e,
|
|
3397
|
+
...h(n)
|
|
3398
|
+
});
|
|
3399
|
+
}
|
|
3400
|
+
const rs = /* @__PURE__ */ c("ZodIntersection", (e, t) => {
|
|
3401
|
+
Rr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ei(e, n, r, o);
|
|
3402
|
+
});
|
|
3403
|
+
function os(e, t) {
|
|
3404
|
+
return new rs({
|
|
3405
|
+
type: "intersection",
|
|
3406
|
+
left: e,
|
|
3407
|
+
right: t
|
|
3408
|
+
});
|
|
3409
|
+
}
|
|
3410
|
+
const he = /* @__PURE__ */ c("ZodEnum", (e, t) => {
|
|
3411
|
+
Cr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (r, o, i) => Bo(e, r, o), e.enum = t.entries, e.options = Object.values(t.entries);
|
|
3412
|
+
const n = new Set(Object.keys(t.entries));
|
|
3413
|
+
e.extract = (r, o) => {
|
|
3414
|
+
const i = {};
|
|
3415
|
+
for (const s of r)
|
|
3416
|
+
if (n.has(s))
|
|
3417
|
+
i[s] = t.entries[s];
|
|
3418
|
+
else
|
|
3419
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
3420
|
+
return new he({
|
|
3421
|
+
...t,
|
|
3422
|
+
checks: [],
|
|
3423
|
+
...h(o),
|
|
3424
|
+
entries: i
|
|
3425
|
+
});
|
|
3426
|
+
}, e.exclude = (r, o) => {
|
|
3427
|
+
const i = { ...t.entries };
|
|
3428
|
+
for (const s of r)
|
|
3429
|
+
if (n.has(s))
|
|
3430
|
+
delete i[s];
|
|
3431
|
+
else
|
|
3432
|
+
throw new Error(`Key ${s} not found in enum`);
|
|
3433
|
+
return new he({
|
|
3434
|
+
...t,
|
|
3435
|
+
checks: [],
|
|
3436
|
+
...h(o),
|
|
3437
|
+
entries: i
|
|
3438
|
+
});
|
|
3439
|
+
};
|
|
3440
|
+
});
|
|
3441
|
+
function kt(e, t) {
|
|
3442
|
+
const n = Array.isArray(e) ? Object.fromEntries(e.map((r) => [r, r])) : e;
|
|
3443
|
+
return new he({
|
|
3444
|
+
type: "enum",
|
|
3445
|
+
entries: n,
|
|
3446
|
+
...h(t)
|
|
3447
|
+
});
|
|
3448
|
+
}
|
|
3449
|
+
const is = /* @__PURE__ */ c("ZodLiteral", (e, t) => {
|
|
3450
|
+
xr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Ko(e, n, r), e.values = new Set(t.values), Object.defineProperty(e, "value", {
|
|
3451
|
+
get() {
|
|
3452
|
+
if (t.values.length > 1)
|
|
3453
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
3454
|
+
return t.values[0];
|
|
3455
|
+
}
|
|
3456
|
+
});
|
|
3457
|
+
});
|
|
3458
|
+
function oe(e, t) {
|
|
3459
|
+
return new is({
|
|
3460
|
+
type: "literal",
|
|
3461
|
+
values: Array.isArray(e) ? e : [e],
|
|
3462
|
+
...h(t)
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3465
|
+
const ss = /* @__PURE__ */ c("ZodTransform", (e, t) => {
|
|
3466
|
+
jr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => Xo(e, n), e._zod.parse = (n, r) => {
|
|
3467
|
+
if (r.direction === "backward")
|
|
3468
|
+
throw new We(e.constructor.name);
|
|
3469
|
+
n.addIssue = (i) => {
|
|
3470
|
+
if (typeof i == "string")
|
|
3471
|
+
n.issues.push(G(i, n.value, t));
|
|
3472
|
+
else {
|
|
3473
|
+
const s = i;
|
|
3474
|
+
s.fatal && (s.continue = !1), s.code ?? (s.code = "custom"), s.input ?? (s.input = n.value), s.inst ?? (s.inst = e), n.issues.push(G(s));
|
|
3475
|
+
}
|
|
3476
|
+
};
|
|
3477
|
+
const o = t.transform(n.value, n);
|
|
3478
|
+
return o instanceof Promise ? o.then((i) => (n.value = i, n)) : (n.value = o, n);
|
|
3479
|
+
};
|
|
3480
|
+
});
|
|
3481
|
+
function as(e) {
|
|
3482
|
+
return new ss({
|
|
3483
|
+
type: "transform",
|
|
3484
|
+
transform: e
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
const wt = /* @__PURE__ */ c("ZodOptional", (e, t) => {
|
|
3488
|
+
Dr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ci(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
3489
|
+
});
|
|
3490
|
+
function Ue(e) {
|
|
3491
|
+
return new wt({
|
|
3492
|
+
type: "optional",
|
|
3493
|
+
innerType: e
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3496
|
+
const cs = /* @__PURE__ */ c("ZodNullable", (e, t) => {
|
|
3497
|
+
Lr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ti(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
3498
|
+
});
|
|
3499
|
+
function Je(e) {
|
|
3500
|
+
return new cs({
|
|
3501
|
+
type: "nullable",
|
|
3502
|
+
innerType: e
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
const us = /* @__PURE__ */ c("ZodDefault", (e, t) => {
|
|
3506
|
+
Fr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ri(e, n, r, o), e.unwrap = () => e._zod.def.innerType, e.removeDefault = e.unwrap;
|
|
3507
|
+
});
|
|
3508
|
+
function ls(e, t) {
|
|
3509
|
+
return new us({
|
|
3510
|
+
type: "default",
|
|
3511
|
+
innerType: e,
|
|
3512
|
+
get defaultValue() {
|
|
3513
|
+
return typeof t == "function" ? t() : Xe(t);
|
|
3514
|
+
}
|
|
3515
|
+
});
|
|
3516
|
+
}
|
|
3517
|
+
const ps = /* @__PURE__ */ c("ZodPrefault", (e, t) => {
|
|
3518
|
+
Mr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => oi(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
3519
|
+
});
|
|
3520
|
+
function hs(e, t) {
|
|
3521
|
+
return new ps({
|
|
3522
|
+
type: "prefault",
|
|
3523
|
+
innerType: e,
|
|
3524
|
+
get defaultValue() {
|
|
3525
|
+
return typeof t == "function" ? t() : Xe(t);
|
|
3526
|
+
}
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
const bt = /* @__PURE__ */ c("ZodNonOptional", (e, t) => {
|
|
3530
|
+
Ur.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ni(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
3531
|
+
});
|
|
3532
|
+
function fs(e, t) {
|
|
3533
|
+
return new bt({
|
|
3534
|
+
type: "nonoptional",
|
|
3535
|
+
innerType: e,
|
|
3536
|
+
...h(t)
|
|
3537
|
+
});
|
|
3538
|
+
}
|
|
3539
|
+
const ds = /* @__PURE__ */ c("ZodCatch", (e, t) => {
|
|
3540
|
+
Jr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ii(e, n, r, o), e.unwrap = () => e._zod.def.innerType, e.removeCatch = e.unwrap;
|
|
3541
|
+
});
|
|
3542
|
+
function ms(e, t) {
|
|
3543
|
+
return new ds({
|
|
3544
|
+
type: "catch",
|
|
3545
|
+
innerType: e,
|
|
3546
|
+
catchValue: typeof t == "function" ? t : () => t
|
|
3547
|
+
});
|
|
3548
|
+
}
|
|
3549
|
+
const gs = /* @__PURE__ */ c("ZodPipe", (e, t) => {
|
|
3550
|
+
Vr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => si(e, n, r, o), e.in = t.in, e.out = t.out;
|
|
3551
|
+
});
|
|
3552
|
+
function Ve(e, t) {
|
|
3553
|
+
return new gs({
|
|
3554
|
+
type: "pipe",
|
|
3555
|
+
in: e,
|
|
3556
|
+
out: t
|
|
3557
|
+
// ...util.normalizeParams(params),
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
const vs = /* @__PURE__ */ c("ZodReadonly", (e, t) => {
|
|
3561
|
+
Gr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => ai(e, n, r, o), e.unwrap = () => e._zod.def.innerType;
|
|
3562
|
+
});
|
|
3563
|
+
function _s(e) {
|
|
3564
|
+
return new vs({
|
|
3565
|
+
type: "readonly",
|
|
3566
|
+
innerType: e
|
|
3567
|
+
});
|
|
3568
|
+
}
|
|
3569
|
+
const ys = /* @__PURE__ */ c("ZodCustom", (e, t) => {
|
|
3570
|
+
Wr.init(e, t), k.init(e, t), e._zod.processJSONSchema = (n, r, o) => qo(e, n);
|
|
3571
|
+
});
|
|
3572
|
+
function ks(e, t = {}) {
|
|
3573
|
+
return Do(ys, e, t);
|
|
3574
|
+
}
|
|
3575
|
+
function ws(e) {
|
|
3576
|
+
return Lo(e);
|
|
3577
|
+
}
|
|
3578
|
+
const O = ke([
|
|
3579
|
+
I(),
|
|
3580
|
+
S({
|
|
3581
|
+
pattern: I(),
|
|
3582
|
+
flags: I().optional()
|
|
3583
|
+
})
|
|
3584
|
+
]), bs = S({
|
|
3585
|
+
kind: oe("fragment"),
|
|
3586
|
+
condition: O.optional(),
|
|
3587
|
+
operator: ke([I(), N(I())]).optional()
|
|
3588
|
+
// Note: Operator types might need to be refined if we want strict enum validation,
|
|
3589
|
+
// but string is flexible for now.
|
|
3590
|
+
}), zs = S({
|
|
3591
|
+
kind: oe("participant"),
|
|
3592
|
+
name: O.optional(),
|
|
3593
|
+
id: O.optional(),
|
|
3594
|
+
stereotype: O.optional()
|
|
3595
|
+
}), $s = S({
|
|
3596
|
+
kind: oe("message"),
|
|
3597
|
+
text: O.optional(),
|
|
3598
|
+
from: O.optional(),
|
|
3599
|
+
to: O.optional()
|
|
3600
|
+
}), Ts = S({
|
|
3601
|
+
kind: oe("group"),
|
|
3602
|
+
name: O.optional()
|
|
3603
|
+
}), Zs = ns("kind", [
|
|
3604
|
+
bs,
|
|
3605
|
+
zs,
|
|
3606
|
+
$s,
|
|
3607
|
+
Ts
|
|
3608
|
+
]), Is = kt(["focus", "remove", "resolve"]), Es = S({
|
|
3609
|
+
action: Is,
|
|
3610
|
+
selector: Zs
|
|
3611
|
+
}), Ss = S({
|
|
3612
|
+
name: I(),
|
|
3613
|
+
suffix: I().optional(),
|
|
3614
|
+
// Defaults to .name in logic
|
|
3615
|
+
layers: N(Es)
|
|
3616
|
+
}), Os = S({
|
|
3617
|
+
input: N(I()),
|
|
3618
|
+
outputDir: I(),
|
|
3619
|
+
ignore: N(I()).optional(),
|
|
3620
|
+
lenses: N(Ss)
|
|
3621
|
+
}), Ps = S({
|
|
3622
|
+
version: Ki(),
|
|
3623
|
+
targets: N(Os)
|
|
3624
|
+
});
|
|
3625
|
+
function xs(e) {
|
|
3626
|
+
const t = Ps.safeParse(e);
|
|
3627
|
+
if (!t.success) {
|
|
3628
|
+
const n = t.error.issues.map((r) => `[${r.path.join(".")}]: ${r.message}`).join(`
|
|
3629
|
+
`);
|
|
3630
|
+
throw new Error(`Invalid Polagram Configuration:
|
|
3631
|
+
${n}`);
|
|
3632
|
+
}
|
|
3633
|
+
return t.data;
|
|
3634
|
+
}
|
|
3635
|
+
export {
|
|
3636
|
+
Dt as FocusFilter,
|
|
3637
|
+
fe as Matcher,
|
|
3638
|
+
Ct as MermaidGeneratorVisitor,
|
|
3639
|
+
ce as ParserFactory,
|
|
3640
|
+
Cs as Polagram,
|
|
3641
|
+
Vt as PolagramBuilder,
|
|
3642
|
+
Ps as PolagramConfigSchema,
|
|
3643
|
+
Lt as RemoveFilter,
|
|
3644
|
+
Ft as ResolveFilter,
|
|
3645
|
+
xt as StructureCleaner,
|
|
3646
|
+
ue as TransformationEngine,
|
|
3647
|
+
Rt as Traverser,
|
|
3648
|
+
jt as UnusedCleaner,
|
|
3649
|
+
Rs as applyLens,
|
|
3650
|
+
Ut as transformerRegistry,
|
|
3651
|
+
xs as validateConfig,
|
|
3652
|
+
As as validateLens
|
|
3653
|
+
};
|