@zombie-mermaid/mermaid-parser 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,331 @@
1
1
  import { applyClickStatement as e, detectDiagramType as t, normalizeBrTags as n, splitClassShorthand as r, splitStatements as i, toDirection as a, tryApplyClassAssignment as o, tryApplyClassDef as s, tryApplyCssClass as c, tryApplyStyleStatement as l } from "@zombie-mermaid/core";
2
+ //#region packages/mermaid-parser/src/architecture/parser.ts
3
+ var u = String.raw`[\w-]+`, d = new RegExp(String.raw`^(group|service)\s+(${u})\s*(?:\(([^)]*)\))?\s*(?:\[([^\]]*)\])?(?:\s+in\s+(${u}))?$`), f = new RegExp(String.raw`^junction\s+(${u})(?:\s+in\s+(${u}))?$`), p = new RegExp(String.raw`^(${u})(\{group\})?:([LRTB])\s+(<)?--(>)?\s+([LRTB]):(${u})(\{group\})?$`), m = new RegExp(String.raw`^align\s+(?:row|column)\s+${u}(?:\s+${u})+$`);
4
+ function h(e, t) {
5
+ throw Error(`Architecture diagram, line ${e.line}: ${t} — "${e.text}"`);
6
+ }
7
+ function g(e) {
8
+ return e?.trim().replace(/^"(.*)"$/, "$1") || void 0;
9
+ }
10
+ function _(e) {
11
+ let t = {
12
+ groups: [],
13
+ services: [],
14
+ junctions: [],
15
+ edges: []
16
+ }, r = /* @__PURE__ */ new Map(), i = [], a = [], o = (e, t, n, a) => {
17
+ r.has(t) && h(e, `duplicate id "${t}"`), a === t && h(e, `"${t}" cannot be inside itself`), r.set(t, n), a && i.push({
18
+ stmt: e,
19
+ parent: a
20
+ });
21
+ };
22
+ for (let r = 1; r < e.length; r++) {
23
+ let i = e[r], s = i.text, c = s.match(d);
24
+ if (c) {
25
+ let e = c[1], r = c[2], a = c[4], s = c[5];
26
+ o(i, r, e, s);
27
+ let l = {
28
+ id: r,
29
+ icon: g(c[3]),
30
+ title: a === void 0 ? r : n(a.trim()),
31
+ parent: s
32
+ };
33
+ e === "group" ? t.groups.push(l) : t.services.push(l);
34
+ continue;
35
+ }
36
+ let l = s.match(f);
37
+ if (l) {
38
+ let e = l[1], n = l[2];
39
+ o(i, e, "junction", n), t.junctions.push({
40
+ id: e,
41
+ parent: n
42
+ });
43
+ continue;
44
+ }
45
+ let u = s.match(p);
46
+ if (u) {
47
+ a.push({
48
+ stmt: i,
49
+ edge: {
50
+ source: u[1],
51
+ sourceGroup: u[2] !== void 0,
52
+ sourcePort: u[3],
53
+ arrowStart: u[4] !== void 0,
54
+ arrowEnd: u[5] !== void 0,
55
+ targetPort: u[6],
56
+ target: u[7],
57
+ targetGroup: u[8] !== void 0
58
+ }
59
+ });
60
+ continue;
61
+ }
62
+ m.test(s) || h(i, "unrecognized statement");
63
+ }
64
+ for (let { stmt: e, parent: t } of i) r.get(t) !== "group" && h(e, `"in ${t}" must name a declared group`);
65
+ let s = /* @__PURE__ */ new Map();
66
+ for (let e of t.groups) e.parent && s.set(e.id, e.parent);
67
+ for (let e of t.groups) {
68
+ let t = /* @__PURE__ */ new Set([e.id]);
69
+ for (let n = s.get(e.id); n; n = s.get(n)) {
70
+ if (t.has(n)) throw Error(`Architecture diagram: group "${e.id}" is nested inside itself`);
71
+ t.add(n);
72
+ }
73
+ }
74
+ for (let { stmt: e, edge: n } of a) {
75
+ let i = [[n.source, n.sourceGroup], [n.target, n.targetGroup]];
76
+ for (let [n, a] of i) {
77
+ let i = r.get(n);
78
+ i || h(e, `unknown id "${n}"`), i === "group" && h(e, `edges connect services or junctions, not the group "${n}"`);
79
+ let o = [...t.services, ...t.junctions].find((e) => e.id === n)?.parent;
80
+ a && !o && h(e, `"{group}" needs "${n}" to be declared inside a group`);
81
+ }
82
+ t.edges.push(n);
83
+ }
84
+ return t;
85
+ }
86
+ //#endregion
87
+ //#region packages/mermaid-parser/src/architecture/to-graph.ts
88
+ var v = {
89
+ database: "cylinder",
90
+ disk: "cylinder",
91
+ cloud: "stadium",
92
+ internet: "circle"
93
+ }, y = /* @__PURE__ */ new Set(["L", "R"]);
94
+ function b(e) {
95
+ let t = 0, n = 0;
96
+ for (let r of e) for (let e of [r.sourcePort, r.targetPort]) y.has(e) ? t++ : n++;
97
+ return n > t ? "TB" : "LR";
98
+ }
99
+ function x(e, t) {
100
+ let [n, r] = t === "LR" || t === "RL" ? ["L", "R"] : ["T", "B"];
101
+ return e.sourcePort === r || e.targetPort === n ? !1 : e.sourcePort === n || e.targetPort === r;
102
+ }
103
+ function S(e) {
104
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
105
+ for (let r of e.services) t.set(r.id, {
106
+ id: r.id,
107
+ label: r.title,
108
+ shape: r.icon && v[r.icon] || "rectangle"
109
+ }), n.set(r.id, r.parent);
110
+ for (let r of e.junctions) t.set(r.id, {
111
+ id: r.id,
112
+ label: "",
113
+ shape: "filled-circle"
114
+ }), n.set(r.id, r.parent);
115
+ let r = /* @__PURE__ */ new Map();
116
+ for (let t of e.groups) r.set(t.id, {
117
+ id: t.id,
118
+ label: t.title,
119
+ nodeIds: [],
120
+ children: []
121
+ });
122
+ let i = [];
123
+ for (let t of e.groups) {
124
+ let e = r.get(t.id), n = t.parent ? r.get(t.parent) : void 0;
125
+ n ? n.children.push(e) : i.push(e);
126
+ }
127
+ for (let [e, t] of n) r.get(t ?? "")?.nodeIds.push(e);
128
+ let a = b(e.edges);
129
+ return {
130
+ direction: a,
131
+ nodes: t,
132
+ edges: e.edges.map((e) => {
133
+ let t = (e, t) => (t ? n.get(e) : void 0) ?? e, r = !x(e, a), [i, o] = r ? [t(e.source, e.sourceGroup), t(e.target, e.targetGroup)] : [t(e.target, e.targetGroup), t(e.source, e.sourceGroup)];
134
+ return {
135
+ source: i,
136
+ target: o,
137
+ style: "solid",
138
+ hasArrowStart: r ? e.arrowStart : e.arrowEnd,
139
+ hasArrowEnd: r ? e.arrowEnd : e.arrowStart
140
+ };
141
+ }),
142
+ subgraphs: i,
143
+ classDefs: /* @__PURE__ */ new Map(),
144
+ classAssignments: /* @__PURE__ */ new Map(),
145
+ nodeStyles: /* @__PURE__ */ new Map(),
146
+ linkStyles: /* @__PURE__ */ new Map(),
147
+ interactions: /* @__PURE__ */ new Map()
148
+ };
149
+ }
150
+ //#endregion
151
+ //#region packages/mermaid-parser/src/c4/parser.ts
152
+ var C = {
153
+ c4context: "context",
154
+ c4container: "container",
155
+ c4component: "component",
156
+ c4dynamic: "dynamic",
157
+ c4deployment: "deployment"
158
+ }, ee = /^(?:UpdateElementStyle|UpdateRelStyle|UpdateLayoutConfig|LAYOUT_[A-Z_]+|SHOW_LEGEND|SHOW_FLOATING_LEGEND|AddElementTag|AddRelTag|AddBoundaryTag|RoleTag)\b/, te = /^(Person|System|Container|Component)(Db|Queue)?(_Ext)?$/, ne = /^(?:Boundary|Enterprise_Boundary|System_Boundary|Container_Boundary)$/, w = /^(?:Deployment_Node|Node|Node_L|Node_R)$/, re = /^(Rel|BiRel|Rel_U|Rel_Up|Rel_D|Rel_Down|Rel_L|Rel_Left|Rel_R|Rel_Right|Rel_Back|RelIndex)$/, ie = {
159
+ Enterprise_Boundary: "ENTERPRISE",
160
+ System_Boundary: "SYSTEM",
161
+ Container_Boundary: "CONTAINER"
162
+ }, ae = {
163
+ Rel_U: "up",
164
+ Rel_Up: "up",
165
+ Rel_D: "down",
166
+ Rel_Down: "down",
167
+ Rel_L: "left",
168
+ Rel_Left: "left",
169
+ Rel_R: "right",
170
+ Rel_Right: "right"
171
+ };
172
+ function oe(e) {
173
+ let t = e.trim(), r = t.length >= 2 && t.startsWith("\"") && t.endsWith("\"") ? t.slice(1, -1) : t;
174
+ return n(r);
175
+ }
176
+ function se(e) {
177
+ let t = [], n = "", r = !1;
178
+ for (let i of e) i === "\"" && (r = !r), i === "," && !r ? (t.push(n), n = "") : n += i;
179
+ return r ? null : (t.push(n), t.map((e) => e.trim()).filter((e) => !e.startsWith("$")).map(oe));
180
+ }
181
+ var ce = /^([A-Za-z_][A-Za-z0-9_]*)\s*\((.*)\)\s*(\{)?\s*$/;
182
+ function T(e, t) {
183
+ throw Error(`C4 diagram, line ${e.line}: ${t} — "${e.text}"`);
184
+ }
185
+ function le(e) {
186
+ let t = C[e[0]?.text.trim().toLowerCase() ?? ""];
187
+ if (!t) throw Error(`C4 diagram: expected a header of C4Context, C4Container, C4Component, C4Dynamic or C4Deployment, got "${e[0]?.text ?? ""}"`);
188
+ let r = {
189
+ variant: t,
190
+ elements: [],
191
+ boundaries: [],
192
+ relationships: []
193
+ }, i = /* @__PURE__ */ new Set(), a = [], o, s = (e, t) => (t || T(e, "missing alias (first argument)"), i.has(t) && T(e, `duplicate alias "${t}"`), i.add(t), t);
194
+ for (let t = 1; t < e.length; t++) {
195
+ let i = e[t], c = i.text;
196
+ if (c === "}") {
197
+ a.length === 0 && T(i, "unmatched \"}\""), a.pop();
198
+ continue;
199
+ }
200
+ if (c === "{") {
201
+ o || T(i, "unexpected \"{\""), a.push(o), o = void 0;
202
+ continue;
203
+ }
204
+ o = void 0;
205
+ let l = c.match(/^title(?:\s+(.*))?$/i);
206
+ if (l) {
207
+ r.title = n((l[1] ?? "").trim());
208
+ continue;
209
+ }
210
+ if (ee.test(c)) continue;
211
+ let u = c.match(ce);
212
+ u || T(i, "unrecognized statement");
213
+ let d = u[1], f = u[3] === "{", p = se(u[2]);
214
+ p || T(i, "unbalanced quotes");
215
+ let m = d.match(te);
216
+ if (m) {
217
+ f && T(i, `"${d}" cannot contain a block`);
218
+ let e = m[1].toLowerCase(), t = m[2] === "Db" ? "db" : m[2] === "Queue" ? "queue" : "default", n = e === "container" || e === "component", o = s(i, p[0]), c = {
219
+ alias: o,
220
+ kind: e,
221
+ shape: t,
222
+ external: m[3] !== void 0,
223
+ label: p[1] || o
224
+ }, l = n ? p[2] : void 0, u = n ? p[3] : p[2];
225
+ l && (c.technology = l), u && (c.description = u), r.elements.push(c), a.at(-1)?.elementAliases.push(o);
226
+ continue;
227
+ }
228
+ if (ne.test(d) || w.test(d)) {
229
+ let e = w.test(d), t = s(i, p[0]), n = {
230
+ alias: t,
231
+ label: p[1] || t,
232
+ elementAliases: [],
233
+ children: []
234
+ };
235
+ n.type = ie[d] || (p[2] && (e || d === "Boundary") ? p[2] : e ? "node" : "system"), e && p[3] && (n.description = p[3]);
236
+ let c = a.at(-1);
237
+ c ? c.children.push(n) : r.boundaries.push(n), f ? a.push(n) : o = n;
238
+ continue;
239
+ }
240
+ if (d.match(re)) {
241
+ let e = d === "RelIndex" ? p.slice(1) : p;
242
+ (!e[0] || !e[1]) && T(i, "a relationship needs \"from\" and \"to\" aliases");
243
+ let t = {
244
+ from: e[0],
245
+ to: e[1],
246
+ label: e[2] ?? "",
247
+ bidirectional: d === "BiRel"
248
+ };
249
+ e[3] && (t.technology = e[3]), d === "Rel_Back" && (t.reversed = !0);
250
+ let n = ae[d];
251
+ n && (t.layout = n), r.relationships.push(t);
252
+ continue;
253
+ }
254
+ T(i, `unknown C4 macro "${d}"`);
255
+ }
256
+ if (a.length > 0) throw Error(`C4 diagram: boundary "${a.at(-1).alias}" is missing its closing "}"`);
257
+ r.variant === "dynamic" && r.relationships.forEach((e, t) => {
258
+ e.index = String(t + 1);
259
+ });
260
+ for (let e of r.relationships) for (let t of [e.from, e.to]) if (!i.has(t)) throw Error(`C4 diagram: relationship refers to undeclared alias "${t}"`);
261
+ return r;
262
+ }
263
+ //#endregion
264
+ //#region packages/mermaid-parser/src/c4/format.ts
265
+ function ue(e, t) {
266
+ let n = [];
267
+ for (let r of e.split("\n")) {
268
+ let e = "";
269
+ for (let i of r.split(/\s+/).filter(Boolean)) e && e.length + 1 + i.length > t ? (n.push(e), e = i) : e = e ? `${e} ${i}` : i;
270
+ n.push(e);
271
+ }
272
+ return n;
273
+ }
274
+ var de = {
275
+ person: "Person",
276
+ system: "Software System",
277
+ container: "Container",
278
+ component: "Component"
279
+ };
280
+ function fe(e) {
281
+ let t = (e.kind === "container" || e.kind === "component") && e.technology ? `: ${e.technology}` : "";
282
+ return `[${de[e.kind]}${t}]`;
283
+ }
284
+ function pe(e) {
285
+ return e.type ? `[${e.type}]` : void 0;
286
+ }
287
+ function me(e) {
288
+ let t = [], n = [e.index ? `${e.index}:` : "", e.label].filter(Boolean).join(" ");
289
+ return n && t.push(n), e.technology && t.push(`[${e.technology}]`), t;
290
+ }
291
+ function he(e) {
292
+ switch (e.layout) {
293
+ case "up": return {
294
+ source: e.to,
295
+ target: e.from,
296
+ axis: "vertical",
297
+ explicit: !0
298
+ };
299
+ case "left": return {
300
+ source: e.to,
301
+ target: e.from,
302
+ axis: "horizontal",
303
+ explicit: !0
304
+ };
305
+ case "right": return {
306
+ source: e.from,
307
+ target: e.to,
308
+ axis: "horizontal",
309
+ explicit: !0
310
+ };
311
+ case "down": return {
312
+ source: e.from,
313
+ target: e.to,
314
+ axis: "vertical",
315
+ explicit: !0
316
+ };
317
+ default: return {
318
+ source: e.from,
319
+ target: e.to,
320
+ axis: "vertical",
321
+ explicit: !1
322
+ };
323
+ }
324
+ }
325
+ //#endregion
2
326
  //#region packages/mermaid-parser/src/class/parser.ts
3
- var u = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--", d = new RegExp(u);
4
- function f(t) {
327
+ var E = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--", ge = new RegExp(E);
328
+ function _e(t) {
5
329
  let i = {
6
330
  classes: [],
7
331
  relationships: [],
@@ -11,100 +335,100 @@ function f(t) {
11
335
  classAssignments: /* @__PURE__ */ new Map(),
12
336
  nodeStyles: /* @__PURE__ */ new Map(),
13
337
  notes: []
14
- }, a = /* @__PURE__ */ new Map(), u = null, f = null, h = 0, g;
338
+ }, a = /* @__PURE__ */ new Map(), u = null, d = null, f = 0, p;
15
339
  for (let r = 1; r < t.length; r++) {
16
- let v = t[r], b = v.text;
17
- if (f && h > 0) {
18
- if (b === "}") {
19
- h--, h === 0 && (f = null, g = void 0);
340
+ let h = t[r], g = h.text;
341
+ if (d && f > 0) {
342
+ if (g === "}") {
343
+ f--, f === 0 && (d = null, p = void 0);
20
344
  continue;
21
345
  }
22
- let e = b.match(/^<<(\w+)>>$/);
346
+ let e = g.match(/^<<(\w+)>>$/);
23
347
  if (e) {
24
- f.annotation = e[1];
348
+ d.annotation = e[1];
25
349
  continue;
26
350
  }
27
- if (b.startsWith("<<")) throw Error(`Line ${v.line}: Malformed class annotation "${b}" — expected "<<name>>" (e.g. "<<interface>>").`);
28
- p(f, b, v.line);
351
+ if (g.startsWith("<<")) throw Error(`Line ${h.line}: Malformed class annotation "${g}" — expected "<<name>>" (e.g. "<<interface>>").`);
352
+ D(d, g, h.line);
29
353
  continue;
30
354
  }
31
- if (/^click\s+/i.test(b)) {
32
- e(b, i.interactions);
355
+ if (/^click\s+/i.test(g)) {
356
+ e(g, i.interactions);
33
357
  continue;
34
358
  }
35
- let x = b.match(/^note\s+(?:for\s+(\S+)\s+)?"([^"]*)"\s*$/);
36
- if (x) {
37
- let e = x[1];
359
+ let _ = g.match(/^note\s+(?:for\s+(\S+)\s+)?"([^"]*)"\s*$/);
360
+ if (_) {
361
+ let e = _[1];
38
362
  i.notes.push({
39
- text: n(x[2]),
363
+ text: n(_[2]),
40
364
  ...e ? { forClass: e } : {}
41
365
  });
42
366
  continue;
43
367
  }
44
- if (s(b, i) || l(b, i) || c(b, i) || o(b, i)) continue;
45
- let S = b.match(/^namespace\s+(\S+)\s*\{$/);
46
- if (S) {
368
+ if (s(g, i) || l(g, i) || c(g, i) || o(g, i)) continue;
369
+ let v = g.match(/^namespace\s+(\S+)\s*\{$/);
370
+ if (v) {
47
371
  u = {
48
- name: S[1],
372
+ name: v[1],
49
373
  classIds: []
50
374
  };
51
375
  continue;
52
376
  }
53
- if (b === "}" && u) {
377
+ if (g === "}" && u) {
54
378
  i.namespaces.push(u), u = null;
55
379
  continue;
56
380
  }
57
- let C = b.match(/^class\s+(\S+?)(?:\s*~(\w+)~)?\s*\{$/);
58
- if (C) {
59
- let e = _(C[1], C[2]);
60
- f = a.get(e) ?? null, h = 1, g = v.line;
381
+ let y = g.match(/^class\s+(\S+?)(?:\s*~(\w+)~)?\s*\{$/);
382
+ if (y) {
383
+ let e = m(y[1], y[2]);
384
+ d = a.get(e) ?? null, f = 1, p = h.line;
61
385
  continue;
62
386
  }
63
- let w = b.match(/^class\s+(\S+?)(?:\s*~(\w+)~)?\s*$/);
64
- if (w) {
65
- _(w[1], w[2]);
387
+ let b = g.match(/^class\s+(\S+?)(?:\s*~(\w+)~)?\s*$/);
388
+ if (b) {
389
+ m(b[1], b[2]);
66
390
  continue;
67
391
  }
68
- let T = b.match(/^class\s+(\S+?)\s*\{\s*(.*?)\s*\}$/);
69
- if (T) {
70
- let e = _(T[1], void 0), t = a.get(e), n = T[2], r = n.match(/^<<(\w+)>>$/);
392
+ let x = g.match(/^class\s+(\S+?)\s*\{\s*(.*?)\s*\}$/);
393
+ if (x) {
394
+ let e = m(x[1], void 0), t = a.get(e), n = x[2], r = n.match(/^<<(\w+)>>$/);
71
395
  if (t && r) t.annotation = r[1];
72
- else if (t && n.startsWith("<<")) throw Error(`Line ${v.line}: Malformed class annotation "${n}" — expected "<<name>>" (e.g. "<<interface>>").`);
73
- else t && n && p(t, n, v.line);
396
+ else if (t && n.startsWith("<<")) throw Error(`Line ${h.line}: Malformed class annotation "${n}" — expected "<<name>>" (e.g. "<<interface>>").`);
397
+ else t && n && D(t, n, h.line);
74
398
  continue;
75
399
  }
76
- let E = b.match(/^(\S+?)\s*:\s*(.+)$/);
77
- if (E) {
78
- let e = E[2];
400
+ let S = g.match(/^(\S+?)\s*:\s*(.+)$/);
401
+ if (S) {
402
+ let e = S[2];
79
403
  if (!e.match(/<\|--|--|\*--|o--|-->|\.\.>|\.\.\|>/)) {
80
- p(m(a, E[1]), e, v.line);
404
+ D(O(a, S[1]), e, h.line);
81
405
  continue;
82
406
  }
83
407
  }
84
- let D = y(b);
85
- if (D) {
86
- D.from = _(D.from, void 0, !1), D.to = _(D.to, void 0, !1), i.relationships.push(D);
408
+ let C = be(g);
409
+ if (C) {
410
+ C.from = m(C.from, void 0, !1), C.to = m(C.to, void 0, !1), i.relationships.push(C);
87
411
  continue;
88
412
  }
89
- if (d.test(b)) throw Error(`Line ${v.line}: Malformed class-diagram relationship "${b}". Expected "FROM ARROW TO" (optionally with cardinalities and a ": label"), e.g. "Animal <|-- Dog" or 'A "1" --> "*" B : label'. ARROW must be one of <|--, <|.., *--, o--, -->, --*, --o, --|>, ..>, ..|>, <--, <.., or --.`);
413
+ if (ge.test(g)) throw Error(`Line ${h.line}: Malformed class-diagram relationship "${g}". Expected "FROM ARROW TO" (optionally with cardinalities and a ": label"), e.g. "Animal <|-- Dog" or 'A "1" --> "*" B : label'. ARROW must be one of <|--, <|.., *--, o--, -->, --*, --o, --|>, ..>, ..|>, <--, <.., or --.`);
90
414
  }
91
- if (f !== null) throw Error(`Line ${g}: Unclosed class body for "${f.id}" — expected a closing "}" before the diagram ends.`);
415
+ if (d !== null) throw Error(`Line ${p}: Unclosed class body for "${d.id}" — expected a closing "}" before the diagram ends.`);
92
416
  return i.classes = [...a.values()], i;
93
- function _(e, t, n = !0) {
417
+ function m(e, t, n = !0) {
94
418
  let { id: o, className: s } = r(e), c = o, l = t;
95
419
  if (!l) {
96
420
  let e = o.match(/^(.+?)~(\w+)~$/);
97
421
  e && (c = e[1], l = e[2]);
98
422
  }
99
- let d = m(a, c);
423
+ let d = O(a, c);
100
424
  return l && (d.label = `${c}<${l}>`), s && i.classAssignments.set(c, s), n && u && u.classIds.push(c), c;
101
425
  }
102
426
  }
103
- function p(e, t, n) {
104
- let r = v(t, n);
427
+ function D(e, t, n) {
428
+ let r = ye(t, n);
105
429
  r && (r.isMethod ? e.methods.push(r.member) : e.attributes.push(r.member));
106
430
  }
107
- function m(e, t) {
431
+ function O(e, t) {
108
432
  let n = e.get(t);
109
433
  return n || (n = {
110
434
  id: t,
@@ -113,11 +437,11 @@ function m(e, t) {
113
437
  methods: []
114
438
  }, e.set(t, n)), n;
115
439
  }
116
- function h(e, t) {
440
+ function k(e, t) {
117
441
  return Math.max(0, e.split(t).length - 1);
118
442
  }
119
- function g(e) {
120
- let t = h(e, "~");
443
+ function ve(e) {
444
+ let t = k(e, "~");
121
445
  if (t <= 1) return e;
122
446
  let n = e, r = !1;
123
447
  t % 2 != 0 && n.startsWith("~") && (n = n.slice(1), r = !0);
@@ -125,26 +449,26 @@ function g(e) {
125
449
  for (; a !== -1 && o !== -1 && a !== o;) i[a] = "<", i[o] = ">", a = i.indexOf("~"), o = i.lastIndexOf("~");
126
450
  return r && i.unshift("~"), i.join("");
127
451
  }
128
- function _(e) {
452
+ function A(e) {
129
453
  let t = e.split(/(,)/), n = [];
130
454
  for (let e = 0; e < t.length; e++) {
131
455
  let r = t[e];
132
456
  if (r === "," && e > 0 && e + 1 < t.length) {
133
457
  let i = t[e - 1], a = t[e + 1];
134
- h(i, "~") === 1 && h(a, "~") === 1 && (r = `${i},${a}`, e++, n.pop());
458
+ k(i, "~") === 1 && k(a, "~") === 1 && (r = `${i},${a}`, e++, n.pop());
135
459
  }
136
- n.push(g(r));
460
+ n.push(ve(r));
137
461
  }
138
462
  return n.join("");
139
463
  }
140
- function v(e, t) {
464
+ function ye(e, t) {
141
465
  let n = e.trim().replace(/;$/, "");
142
466
  if (!n) return null;
143
467
  let r = "", i = n, a = i[0];
144
468
  if ((a === "+" || a === "-" || a === "#" || a === "~") && (r = a, i = i.slice(1).trim()), i.includes("(") && !i.includes(")")) throw Error(`Line ${t}: Malformed class member "${n}" — unclosed "(" in a method signature. Expected e.g. "+eat() void" or "+eat(Food f) void".`);
145
469
  let o = i.match(/^(.+?)\(([^)]*)\)(?:\s*(.+))?$/);
146
470
  if (o) {
147
- let e = _(o[1].trim()), t = o[2]?.trim(), n = t ? _(t) : void 0, a = o[3]?.trim(), s = a ? _(a) : void 0, c = e.endsWith("$") || i.includes("$"), l = e.endsWith("*") || i.includes("*");
471
+ let e = A(o[1].trim()), t = o[2]?.trim(), n = t ? A(t) : void 0, a = o[3]?.trim(), s = a ? A(a) : void 0, c = e.endsWith("$") || i.includes("$"), l = e.endsWith("*") || i.includes("*");
148
472
  return {
149
473
  member: {
150
474
  visibility: r,
@@ -158,7 +482,7 @@ function v(e, t) {
158
482
  isMethod: !0
159
483
  };
160
484
  }
161
- let s = _(i).split(/\s+/), c, l;
485
+ let s = A(i).split(/\s+/), c, l;
162
486
  s.length >= 2 ? (l = s[0], c = s.slice(1).join(" ")) : c = s[0] ?? i;
163
487
  let u = c.endsWith("$"), d = c.endsWith("*");
164
488
  return {
@@ -173,21 +497,21 @@ function v(e, t) {
173
497
  isMethod: !1
174
498
  };
175
499
  }
176
- function y(e) {
177
- let t = e.match(RegExp(`^(\\S+?)\\s+(?:"([^"]*?)"\\s+)?(${u})\\s+(?:"([^"]*?)"\\s+)?(\\S+?)(?::::([\\w][\\w-]*))?(?:\\s*:\\s*(.+))?$`));
500
+ function be(e) {
501
+ let t = e.match(RegExp(`^(\\S+?)\\s+(?:"([^"]*?)"\\s+)?(${E})\\s+(?:"([^"]*?)"\\s+)?(\\S+?)(?::::([\\w][\\w-]*))?(?:\\s*:\\s*(.+))?$`));
178
502
  if (!t) return null;
179
- let r = t[1], i = t[2], a = i ? n(i) : void 0, o = t[3].trim(), s = t[4], c = s ? n(s) : void 0, l = t[6] ? `${t[5]}:::${t[6]}` : t[5], d = t[7]?.trim(), f = d ? n(d) : void 0, p = b(o);
180
- return p ? {
503
+ let r = t[1], i = t[2], a = i ? n(i) : void 0, o = t[3].trim(), s = t[4], c = s ? n(s) : void 0, l = t[6] ? `${t[5]}:::${t[6]}` : t[5], u = t[7]?.trim(), d = u ? n(u) : void 0, f = j(o);
504
+ return f ? {
181
505
  from: r,
182
506
  to: l,
183
- type: p.type,
184
- markerAt: p.markerAt,
185
- label: f,
507
+ type: f.type,
508
+ markerAt: f.markerAt,
509
+ label: d,
186
510
  fromCardinality: a,
187
511
  toCardinality: c
188
512
  } : null;
189
513
  }
190
- function b(e) {
514
+ function j(e) {
191
515
  switch (e.trim()) {
192
516
  case "<|--": return {
193
517
  type: "inheritance",
@@ -246,12 +570,12 @@ function b(e) {
246
570
  }
247
571
  //#endregion
248
572
  //#region packages/mermaid-parser/src/class/format.ts
249
- function x(e) {
573
+ function M(e) {
250
574
  return `${e.visibility ? `${e.visibility} ` : ""}${e.isMethod ? `${e.name}(${e.params || ""})` : e.name}${e.type ? `: ${e.type}` : ""}`;
251
575
  }
252
576
  //#endregion
253
577
  //#region packages/mermaid-parser/src/er/parser.ts
254
- function S(e) {
578
+ function N(e) {
255
579
  let t = {
256
580
  entities: [],
257
581
  relationships: []
@@ -263,7 +587,7 @@ function S(e) {
263
587
  i = null;
264
588
  continue;
265
589
  }
266
- let e = w(c);
590
+ let e = F(c);
267
591
  e && i.attributes.push(e);
268
592
  continue;
269
593
  }
@@ -274,23 +598,23 @@ function S(e) {
274
598
  }
275
599
  let u = c.match(/^(\S+?)(?:\[(.+)\])?\s*\{(.*)$/);
276
600
  if (u) {
277
- let e = u[1], t = u[2], a = C(r, e, t === void 0 ? void 0 : n(t.trim().replace(/^["']|["']$/g, ""))), o = u[3].trim(), s = o.endsWith("}"), c = s ? o.slice(0, -1).trim() : o;
601
+ let e = u[1], t = u[2], a = P(r, e, t === void 0 ? void 0 : n(t.trim().replace(/^["']|["']$/g, ""))), o = u[3].trim(), s = o.endsWith("}"), c = s ? o.slice(0, -1).trim() : o;
278
602
  for (let e of c.split(";").map((e) => e.trim()).filter(Boolean)) {
279
- let t = w(e);
603
+ let t = F(e);
280
604
  t && a.attributes.push(t);
281
605
  }
282
606
  s || (i = a);
283
607
  continue;
284
608
  }
285
- let d = T(c, s.line);
609
+ let d = xe(c, s.line);
286
610
  if (d) {
287
- C(r, d.entity1), C(r, d.entity2), t.relationships.push(d);
611
+ P(r, d.entity1), P(r, d.entity2), t.relationships.push(d);
288
612
  continue;
289
613
  }
290
614
  }
291
615
  return t.entities = [...r.values()], t;
292
616
  }
293
- function C(e, t, n) {
617
+ function P(e, t, n) {
294
618
  let r = e.get(t);
295
619
  return r ? n !== void 0 && (r.label = n) : (r = {
296
620
  id: t,
@@ -298,7 +622,7 @@ function C(e, t, n) {
298
622
  attributes: []
299
623
  }, e.set(t, r)), r;
300
624
  }
301
- function w(e) {
625
+ function F(e) {
302
626
  let t = e.match(/^(\S+)\s+(\S+)(?:\s+(.+))?$/);
303
627
  if (!t) return null;
304
628
  let r = t[1], i = t[2], a = t[3]?.trim() ?? "", o = [], s, c = a.match(/"([^"]*)"/);
@@ -315,10 +639,10 @@ function w(e) {
315
639
  comment: s
316
640
  };
317
641
  }
318
- function T(e, t) {
642
+ function xe(e, t) {
319
643
  let r = e.match(/^(\S+)\s+(\S*(?:--|\.\.)\S*)\s+(\S+)\s*(?::\s*(.*))?$/);
320
644
  if (!r) return null;
321
- let i = r[1], a = r[2], o = r[3], s = r[4] !== void 0, c = r[4]?.trim() ?? "", l = a.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), u = l ? E(l[1]) : null, d = l ? D(l[3]) : null;
645
+ let i = r[1], a = r[2], o = r[3], s = r[4] !== void 0, c = r[4]?.trim() ?? "", l = a.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), u = l ? Se(l[1]) : null, d = l ? Ce(l[3]) : null;
322
646
  if (!u || !d) throw Error(`Line ${t}: Invalid ER relationship cardinality "${a}" in "${e}". Left side must be one of ||, |o, }|, }o; right side must be one of ||, o|, |{, o{ (e.g. "||--o{").`);
323
647
  if (!s || c.length === 0) throw Error(`Line ${t}: ER relationship "${i} ${a} ${o}" is missing a ": label" — expected e.g. "${i} ${a} ${o} : label".`);
324
648
  return {
@@ -330,36 +654,36 @@ function T(e, t) {
330
654
  identifying: l[2] === "--"
331
655
  };
332
656
  }
333
- function E(e) {
657
+ function Se(e) {
334
658
  return e === "||" ? "one" : e === "|o" ? "zero-one" : e === "}|" ? "many" : e === "}o" ? "zero-many" : null;
335
659
  }
336
- function D(e) {
660
+ function Ce(e) {
337
661
  return e === "||" ? "one" : e === "o|" ? "zero-one" : e === "|{" ? "many" : e === "o{" ? "zero-many" : null;
338
662
  }
339
663
  //#endregion
340
664
  //#region packages/mermaid-parser/src/sequence/box-color.ts
341
- var ee = new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")), O = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, k = /^(?:rgba?|hsla?)\(\s*[\d.%]+(?:[\s,/]+[\d.%]+){2,3}\s*\)$/i;
342
- function A(e) {
343
- return ee.has(e.toLowerCase()) || O.test(e) || k.test(e);
665
+ var we = new Set("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen".split(" ")), Te = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, Ee = /^(?:rgba?|hsla?)\(\s*[\d.%]+(?:[\s,/]+[\d.%]+){2,3}\s*\)$/i;
666
+ function I(e) {
667
+ return we.has(e.toLowerCase()) || Te.test(e) || Ee.test(e);
344
668
  }
345
- function j(e) {
669
+ function L(e) {
346
670
  let t = e.trim(), n = t.match(/^((?:rgba?|hsla?)\s*\([^)]*\)|#[0-9a-fA-F]+|\S+)?(.*)$/), r = n?.[1] ?? "", i = n?.[2]?.trim() ?? "";
347
- return r.toLowerCase() === "transparent" ? { label: i } : r !== "" && A(r) ? {
671
+ return r.toLowerCase() === "transparent" ? { label: i } : r !== "" && I(r) ? {
348
672
  color: r,
349
673
  label: i
350
674
  } : { label: t };
351
675
  }
352
676
  //#endregion
353
677
  //#region packages/mermaid-parser/src/sequence/parser.ts
354
- function M(e) {
678
+ function R(e) {
355
679
  return e === "loop" || e === "alt" || e === "opt" || e === "par" || e === "critical" || e === "break" || e === "rect";
356
680
  }
357
- function N(e) {
358
- if (!M(e)) throw Error(`Invalid block type: "${e}"`);
681
+ function z(e) {
682
+ if (!R(e)) throw Error(`Invalid block type: "${e}"`);
359
683
  return e;
360
684
  }
361
- var te = /^(.+?)\s*(<<->>|<<-->>|--?>?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/, ne = /^(.+?)\s*(<<->>|<<-->>|--?>?>|--?[)x]|--?>>|--?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/;
362
- function P(e) {
685
+ var De = /^(.+?)\s*(<<->>|<<-->>|--?>?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/, Oe = /^(.+?)\s*(<<->>|<<-->>|--?>?>|--?[)x]|--?>>|--?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/;
686
+ function B(e) {
363
687
  let t = {
364
688
  actors: [],
365
689
  messages: [],
@@ -379,7 +703,7 @@ function P(e) {
379
703
  let f = e[d], p = f.text, m = p.match(/^box(?:\s+(.*))?$/);
380
704
  if (m) {
381
705
  if (r.open !== void 0) throw Error(`Line ${f.line}: Sequence diagram: a box cannot be nested inside another box — close the open box with "end" first`);
382
- let { color: e, label: o } = j(m[1] ?? ""), c = {
706
+ let { color: e, label: o } = L(m[1] ?? ""), c = {
383
707
  label: n(o),
384
708
  actorIds: []
385
709
  };
@@ -394,13 +718,13 @@ function P(e) {
394
718
  id: i,
395
719
  label: n(h[3]?.trim() ?? i),
396
720
  type: e
397
- }), L(t, r, i, f.line), l = i;
721
+ }), U(t, r, i, f.line), l = i;
398
722
  continue;
399
723
  }
400
724
  let g = p.match(/^destroy\s+(.+)$/);
401
725
  if (g) {
402
726
  let e = g[1].trim();
403
- I(t, o, r, e, f.line), u = e;
727
+ H(t, o, r, e, f.line), u = e;
404
728
  continue;
405
729
  }
406
730
  let _ = p.match(/^autonumber(?:\s+(off|\d+(?:\.\d{1,2})?)(?:\s+(\d+(?:\.\d{1,2})?))?)?$/);
@@ -416,13 +740,13 @@ function P(e) {
416
740
  id: i,
417
741
  label: s,
418
742
  type: e
419
- })), L(t, r, i, f.line);
743
+ })), U(t, r, i, f.line);
420
744
  continue;
421
745
  }
422
746
  let y = p.match(/^Note\s+(left of|right of|over)\s+([^:]+):\s*(.+)$/i);
423
747
  if (y) {
424
748
  let e = y[1].toLowerCase(), i = y[2].trim(), a = n(y[3].trim()), s = i.split(",").map((e) => e.trim());
425
- for (let e of s) I(t, o, r, e, f.line);
749
+ for (let e of s) H(t, o, r, e, f.line);
426
750
  let c = "over";
427
751
  e === "left of" ? c = "left" : e === "right of" && (c = "right"), t.notes.push({
428
752
  actorIds: s,
@@ -434,7 +758,7 @@ function P(e) {
434
758
  }
435
759
  let b = p.match(/^(loop|alt|opt|par|critical|break|rect)\s*(.*)$/);
436
760
  if (b) {
437
- let e = N(b[1]), r = b[2]?.trim() ?? "", i = n(r);
761
+ let e = z(b[1]), r = b[2]?.trim() ?? "", i = n(r);
438
762
  s.push({
439
763
  type: e,
440
764
  label: i,
@@ -472,26 +796,26 @@ function P(e) {
472
796
  let S = p.match(/^(activate|deactivate)\s+(.+)$/);
473
797
  if (S) {
474
798
  let e = S[2].trim();
475
- I(t, o, r, e, f.line), t.activations.push({
799
+ H(t, o, r, e, f.line), t.activations.push({
476
800
  actorId: e,
477
801
  kind: S[1] === "activate" ? "start" : "end",
478
802
  afterIndex: t.messages.length - 1
479
803
  });
480
804
  continue;
481
805
  }
482
- let C = p.match(te) ?? p.match(ne);
806
+ let C = p.match(De) ?? p.match(Oe);
483
807
  if (C) {
484
808
  let e = C[2], n = C[4][0];
485
809
  if (n === ">" || n === ")") throw Error(`Line ${f.line}: Malformed sequence-diagram arrow in "${p}" — "${e}${n}" is not a recognized arrow. Expected one of: ->, -->, ->>, -->>, -x, --x, -), --), <<->>, <<-->>.`);
486
- R(t, o, r, c, C[1], C[2], C[3], C[4], C[5], f.line);
810
+ ke(t, o, r, c, C[1], C[2], C[3], C[4], C[5], f.line);
487
811
  let i = t.messages.length - 1, a = t.messages[i];
488
812
  if (l !== void 0) {
489
813
  if (a.to !== l) throw Error(`Line ${f.line}: The created participant ${l} does not have an associated creating message after its declaration. Please check the sequence diagram.`);
490
- F(t, l).createdAt = i, l = void 0;
814
+ V(t, l).createdAt = i, l = void 0;
491
815
  }
492
816
  if (u !== void 0) {
493
817
  if (a.from !== u && a.to !== u) throw Error(`Line ${f.line}: The destroyed participant ${u} does not have an associated destroying message after its declaration. Please check the sequence diagram.`);
494
- F(t, u).destroyedAt = i, u = void 0;
818
+ V(t, u).destroyedAt = i, u = void 0;
495
819
  }
496
820
  continue;
497
821
  }
@@ -506,21 +830,21 @@ function P(e) {
506
830
  }
507
831
  return t;
508
832
  }
509
- function F(e, t) {
833
+ function V(e, t) {
510
834
  let n = e.actors.find((e) => e.id === t);
511
835
  if (n === void 0)
512
836
  /* v8 ignore next */
513
837
  throw Error(`Sequence diagram: unknown actor "${t}"`);
514
838
  return n;
515
839
  }
516
- function I(e, t, n, r, i) {
840
+ function H(e, t, n, r, i) {
517
841
  t.has(r) || (t.add(r), e.actors.push({
518
842
  id: r,
519
843
  label: r,
520
844
  type: "participant"
521
- })), L(e, n, r, i);
845
+ })), U(e, n, r, i);
522
846
  }
523
- function L(e, t, n, r) {
847
+ function U(e, t, n, r) {
524
848
  let i = t.open;
525
849
  if (i === void 0) return;
526
850
  let a = t.membership.get(n);
@@ -532,8 +856,8 @@ function L(e, t, n, r) {
532
856
  t.membership.set(n, i), e.boxes[i].actorIds.push(n);
533
857
  }
534
858
  }
535
- function R(e, t, r, i, a, o, s, c, l, u) {
536
- I(e, t, r, a, u), I(e, t, r, c, u);
859
+ function ke(e, t, r, i, a, o, s, c, l, u) {
860
+ H(e, t, r, a, u), H(e, t, r, c, u);
537
861
  let d = o === "<<->>" || o === "<<-->>", f = d ? o === "<<-->>" ? "dashed" : "solid" : o.startsWith("--") ? "dashed" : "solid", p = o.includes(">>") || o.includes("x") ? "filled" : "open", m = o.includes("x"), h = {
538
862
  from: a,
539
863
  to: c,
@@ -545,14 +869,14 @@ function R(e, t, r, i, a, o, s, c, l, u) {
545
869
  }
546
870
  //#endregion
547
871
  //#region packages/mermaid-parser/src/sequence/activation-check.ts
548
- function z(e, t) {
872
+ function W(e, t) {
549
873
  if (t < 0) return "before the first message";
550
874
  let n = e.messages[t];
551
875
  if (!n) return "at an unresolved position";
552
876
  let r = n.label ? `: ${n.label}` : "";
553
877
  return `after message ${t + 1} ("${n.from} -> ${n.to}${r}")`;
554
878
  }
555
- function B(e) {
879
+ function G(e) {
556
880
  let t = /* @__PURE__ */ new Map();
557
881
  for (let n of e.activations) {
558
882
  let e = t.get(n.afterIndex) ?? [];
@@ -589,13 +913,13 @@ function B(e) {
589
913
  n.pop() === void 0 && a.push({
590
914
  code: "UNMATCHED_DEACTIVATION",
591
915
  actorId: t.actorId,
592
- message: `"deactivate ${t.actorId}" ${z(e, t.afterIndex)} has no matching "activate ${t.actorId}" open at that point.`
916
+ message: `"deactivate ${t.actorId}" ${W(e, t.afterIndex)} has no matching "activate ${t.actorId}" open at that point.`
593
917
  });
594
918
  }
595
919
  for (let [t, n] of i) for (let r of n) a.push({
596
920
  code: "DANGLING_ACTIVATION",
597
921
  actorId: t,
598
- message: `"activate ${t}" opened ${z(e, r)} is never closed with a matching "deactivate ${t}".`
922
+ message: `"activate ${t}" opened ${W(e, r)} is never closed with a matching "deactivate ${t}".`
599
923
  });
600
924
  return {
601
925
  ok: a.length === 0,
@@ -604,10 +928,10 @@ function B(e) {
604
928
  }
605
929
  //#endregion
606
930
  //#region packages/mermaid-parser/src/sequence/activation-fix.ts
607
- function re(e) {
931
+ function Ae(e) {
608
932
  let n = t(e);
609
933
  if (n !== "sequence") throw Error(`fixActivationBalance only supports sequence diagrams (source must start with "sequenceDiagram"); detected diagram type: "${n}".`);
610
- let r = B(P(i(e)));
934
+ let r = G(B(i(e)));
611
935
  if (r.ok) return {
612
936
  ok: !0,
613
937
  originalDiagram: e,
@@ -626,7 +950,7 @@ function re(e) {
626
950
  }
627
951
  //#endregion
628
952
  //#region packages/mermaid-parser/src/xychart/parser.ts
629
- function ie(e) {
953
+ function je(e) {
630
954
  let t = {}, n = {}, r = [], i, a = !1;
631
955
  for (let o of e) {
632
956
  let e = o.text;
@@ -641,7 +965,7 @@ function ie(e) {
641
965
  }
642
966
  let c = e.match(/^x-axis\s+(?:"([^"]*)"\s*)?\[([^\]]+)\]/);
643
967
  if (c) {
644
- c[1] && (t.title = c[1]), t.categories = V(c[2]).map((e) => H(e.trim()));
968
+ c[1] && (t.title = c[1]), t.categories = Me(c[2]).map((e) => Ne(e.trim()));
645
969
  continue;
646
970
  }
647
971
  let l = e.match(/^x-axis\s+(?:"([^"]*)"\s+)?(-?\d+(?:\.\d+)?)\s*-->\s*(-?\d+(?:\.\d+)?)/);
@@ -669,7 +993,7 @@ function ie(e) {
669
993
  if (f) {
670
994
  r.push({
671
995
  type: "bar",
672
- data: U(f[1], "bar", e, o.line)
996
+ data: K(f[1], "bar", e, o.line)
673
997
  });
674
998
  continue;
675
999
  }
@@ -677,12 +1001,12 @@ function ie(e) {
677
1001
  if (p) {
678
1002
  r.push({
679
1003
  type: "line",
680
- data: U(p[1], "line", e, o.line)
1004
+ data: K(p[1], "line", e, o.line)
681
1005
  });
682
1006
  continue;
683
1007
  }
684
1008
  let m = e.match(/^(x-axis|y-axis|bar|line|title)\b/i);
685
- if (m) throw G(m[1].toLowerCase(), e, o.line);
1009
+ if (m) throw Fe(m[1].toLowerCase(), e, o.line);
686
1010
  }
687
1011
  if (!n.range && r.length > 0) {
688
1012
  let e = r.flatMap((e) => e.data), t = Math.min(...e), i = Math.max(...e), a = i - t || 1;
@@ -702,36 +1026,36 @@ function ie(e) {
702
1026
  series: r
703
1027
  };
704
1028
  }
705
- function V(e) {
1029
+ function Me(e) {
706
1030
  let t = [], n = "", r = !1;
707
1031
  for (let i of e) i === "\"" ? (r = !r, n += i) : i === "," && !r ? (t.push(n), n = "") : n += i;
708
1032
  return t.push(n), t;
709
1033
  }
710
- function H(e) {
1034
+ function Ne(e) {
711
1035
  return e.length >= 2 && e.startsWith("\"") && e.endsWith("\"") ? e.slice(1, -1) : e;
712
1036
  }
713
- function U(e, t, n, r) {
1037
+ function K(e, t, n, r) {
714
1038
  return e.split(",").map((e, i) => {
715
1039
  let a = e.trim(), o = parseFloat(a);
716
1040
  if (a.length === 0 || Number.isNaN(o)) throw Error(`Line ${r}: Invalid numeric value ${JSON.stringify(a)} at position ${i + 1} in "${n}". Every value in a ${t} [...] list must be a number.`);
717
1041
  return o;
718
1042
  });
719
1043
  }
720
- var W = {
1044
+ var Pe = {
721
1045
  "x-axis": "x-axis [A, B, C] (categories) or x-axis 0 --> 100 (numeric range), either optionally preceded by a quoted title",
722
1046
  "y-axis": "y-axis 0 --> 100 (numeric range) or y-axis \"Title\" (title only), optionally preceded by a quoted title before a range",
723
1047
  bar: "bar [10, 20, 30] — a comma-separated numeric array in square brackets",
724
1048
  line: "line [10, 20, 30] — a comma-separated numeric array in square brackets",
725
1049
  title: "title \"Chart Title\" — a double-quoted string"
726
1050
  };
727
- function G(e, t, n) {
728
- let r = W[e] ?? e;
1051
+ function Fe(e, t, n) {
1052
+ let r = Pe[e] ?? e;
729
1053
  return /* @__PURE__ */ Error(`Line ${n}: Malformed xychart-beta "${e}" directive: "${t}". Expected: ${r}.`);
730
1054
  }
731
1055
  //#endregion
732
1056
  //#region packages/mermaid-parser/src/xychart/colors.ts
733
- var K = "#3b82f6";
734
- function q(e) {
1057
+ var q = "#3b82f6";
1058
+ function J(e) {
735
1059
  let t = e.replace("#", ""), n = parseInt(t.substring(0, 2), 16) / 255, r = parseInt(t.substring(2, 4), 16) / 255, i = parseInt(t.substring(4, 6), 16) / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = (a + o) / 2;
736
1060
  if (a === o) return [
737
1061
  0,
@@ -745,7 +1069,7 @@ function q(e) {
745
1069
  s * 100
746
1070
  ];
747
1071
  }
748
- function J(e, t, n) {
1072
+ function Ie(e, t, n) {
749
1073
  let r = t / 100, i = n / 100, a = (1 - Math.abs(2 * i - 1)) * r, o = a * (1 - Math.abs(e / 60 % 2 - 1)), s = i - a / 2, c, l, u;
750
1074
  e < 60 ? (c = a, l = o, u = 0) : e < 120 ? (c = o, l = a, u = 0) : e < 180 ? (c = 0, l = a, u = o) : e < 240 ? (c = 0, l = o, u = a) : e < 300 ? (c = o, l = 0, u = a) : (c = a, l = 0, u = o);
751
1075
  let d = (e) => Math.round((e + s) * 255).toString(16).padStart(2, "0");
@@ -755,12 +1079,12 @@ function Y(e) {
755
1079
  return /^#[0-9a-fA-F]{6}$/.test(e);
756
1080
  }
757
1081
  function X(e) {
758
- return q(e)[2] < 50;
1082
+ return J(e)[2] < 50;
759
1083
  }
760
- function ae(e, t, n) {
1084
+ function Le(e, t, n) {
761
1085
  if (e === 0) return t;
762
- let r = Y(t) ? t : K, i = n && Y(n) ? n : void 0, [a, o] = q(r), s = Math.max(55, Math.min(85, o)), c = Math.ceil(e / 2), l = e % 2 == 1, u = i && X(i) ? !l : l, d = u ? Math.max(25, 48 - c * 13) : Math.min(78, 55 + c * 11);
763
- return J(((a + (u ? -8 : 12) * c) % 360 + 360) % 360, s, d);
1086
+ let r = Y(t) ? t : q, i = n && Y(n) ? n : void 0, [a, o] = J(r), s = Math.max(55, Math.min(85, o)), c = Math.ceil(e / 2), l = e % 2 == 1, u = i && X(i) ? !l : l, d = u ? Math.max(25, 48 - c * 13) : Math.min(78, 55 + c * 11);
1087
+ return Ie(((a + (u ? -8 : 12) * c) % 360 + 360) % 360, s, d);
764
1088
  }
765
1089
  //#endregion
766
1090
  //#region packages/mermaid-parser/src/expanded-shapes.ts
@@ -890,18 +1214,18 @@ var Z = {
890
1214
  text: "text",
891
1215
  anchor: "anchor"
892
1216
  };
893
- function oe(e) {
1217
+ function Re(e) {
894
1218
  return Z[e.trim().toLowerCase()];
895
1219
  }
896
- function se() {
1220
+ function Q() {
897
1221
  return Object.keys(Z).sort();
898
1222
  }
899
- function Q(e) {
1223
+ function ze(e) {
900
1224
  let t = {};
901
- for (let n of ce(e, ",")) {
1225
+ for (let n of Be(e, ",")) {
902
1226
  let e = n.trim();
903
1227
  if (e.length === 0) continue;
904
- let r = le(e, ":");
1228
+ let r = Ve(e, ":");
905
1229
  if (r === -1) {
906
1230
  t.shape ??= $(e);
907
1231
  continue;
@@ -911,7 +1235,7 @@ function Q(e) {
911
1235
  }
912
1236
  return t;
913
1237
  }
914
- function ce(e, t) {
1238
+ function Be(e, t) {
915
1239
  let n = [], r = "", i = null;
916
1240
  for (let a of e) {
917
1241
  if (i !== null) {
@@ -930,7 +1254,7 @@ function ce(e, t) {
930
1254
  }
931
1255
  return n.push(r), n;
932
1256
  }
933
- function le(e, t) {
1257
+ function Ve(e, t) {
934
1258
  let n = null;
935
1259
  for (let r = 0; r < e.length; r++) {
936
1260
  let i = e[r];
@@ -949,7 +1273,7 @@ function le(e, t) {
949
1273
  function $(e) {
950
1274
  return e.length >= 2 && (e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'")) ? e.slice(1, -1) : e;
951
1275
  }
952
- function ue(e) {
1276
+ function He(e) {
953
1277
  if (!e.startsWith("@{")) return;
954
1278
  let t = 0, n = null;
955
1279
  for (let r = 1; r < e.length; r++) {
@@ -973,6 +1297,6 @@ function ue(e) {
973
1297
  }
974
1298
  }
975
1299
  //#endregion
976
- export { K as CHART_ACCENT_FALLBACK, B as checkActivationBalance, re as fixActivationBalance, x as formatClassMember, ae as getSeriesColor, M as isBlockType, A as isCssColor, X as isDarkBackground, Y as isValidHex, se as knownShapeNames, ue as matchExpandedBlock, j as parseBoxHeader, f as parseClassDiagram, S as parseErDiagram, Q as parseExpandedMeta, _ as parseGenericTypes, P as parseSequenceDiagram, ie as parseXYChart, oe as resolveShapeName, N as toBlockType };
1300
+ export { q as CHART_ACCENT_FALLBACK, S as architectureToGraph, pe as c4BoundaryTypeLine, he as c4Placement, me as c4RelLabelLines, fe as c4TypeLine, G as checkActivationBalance, Ae as fixActivationBalance, M as formatClassMember, Le as getSeriesColor, R as isBlockType, I as isCssColor, X as isDarkBackground, Y as isValidHex, Q as knownShapeNames, He as matchExpandedBlock, _ as parseArchitecture, L as parseBoxHeader, le as parseC4Diagram, _e as parseClassDiagram, N as parseErDiagram, ze as parseExpandedMeta, A as parseGenericTypes, B as parseSequenceDiagram, je as parseXYChart, Re as resolveShapeName, z as toBlockType, ue as wrapC4Text };
977
1301
 
978
1302
  //# sourceMappingURL=index.js.map