@polagram/core 0.0.4 → 0.1.1

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