zombie-mermaid 2.2.2 → 2.2.3
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/ascii.cjs +7 -7
- package/dist/ascii.cjs.map +1 -1
- package/dist/ascii.js +943 -913
- package/dist/ascii.js.map +1 -1
- package/dist/cli.js +3265 -3229
- package/dist/index.cjs +51 -51
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +191 -161
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +84 -13
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.js +84 -13
- package/dist/mcp.js.map +1 -1
- package/package.json +3 -3
- package/packages/ascii-renderer/src/class-diagram.ts +192 -12
- package/packages/ascii-renderer/src/sequence.ts +42 -8
- package/src/__tests__/ascii-class-box-occupancy.test.ts +82 -43
- package/src/__tests__/ascii-class-detour-label-routing-487.test.ts +8 -8
- package/src/__tests__/ascii-class-parent-alignment-971.test.ts +139 -0
- package/src/__tests__/ascii-class-parent-alignment-972.test.ts +208 -0
- package/src/__tests__/ascii-sequence-form-invariants.test.ts +51 -0
package/dist/ascii.js
CHANGED
|
@@ -386,8 +386,8 @@ var ae = {
|
|
|
386
386
|
groupHeader: 5,
|
|
387
387
|
innerStroke: 12,
|
|
388
388
|
keyBadge: 10
|
|
389
|
-
}, oe = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--",
|
|
390
|
-
function
|
|
389
|
+
}, oe = "<\\|--|<\\|\\.\\.|\\*--|o--|-->|--\\*|--o|--\\|>|\\.\\.>|\\.\\.\\|>|<--|<\\.\\.?|--", se = new RegExp(oe);
|
|
390
|
+
function ce(t) {
|
|
391
391
|
let n = {
|
|
392
392
|
classes: [],
|
|
393
393
|
relationships: [],
|
|
@@ -411,7 +411,7 @@ function se(t) {
|
|
|
411
411
|
continue;
|
|
412
412
|
}
|
|
413
413
|
if (d.startsWith("<<")) throw Error(`Line ${u.line}: Malformed class annotation "${d}" — expected "<<name>>" (e.g. "<<interface>>").`);
|
|
414
|
-
|
|
414
|
+
L(a, d, u.line);
|
|
415
415
|
continue;
|
|
416
416
|
}
|
|
417
417
|
if (/^click\s+/i.test(d)) {
|
|
@@ -456,23 +456,23 @@ function se(t) {
|
|
|
456
456
|
let e = c(g[1], void 0), t = r.get(e), n = g[2], i = n.match(/^<<(\w+)>>$/);
|
|
457
457
|
if (t && i) t.annotation = i[1];
|
|
458
458
|
else if (t && n.startsWith("<<")) throw Error(`Line ${u.line}: Malformed class annotation "${n}" — expected "<<name>>" (e.g. "<<interface>>").`);
|
|
459
|
-
else t && n &&
|
|
459
|
+
else t && n && L(t, n, u.line);
|
|
460
460
|
continue;
|
|
461
461
|
}
|
|
462
462
|
let _ = d.match(/^(\S+?)\s*:\s*(.+)$/);
|
|
463
463
|
if (_) {
|
|
464
464
|
let e = _[2];
|
|
465
465
|
if (!e.match(/<\|--|--|\*--|o--|-->|\.\.>|\.\.\|>/)) {
|
|
466
|
-
|
|
466
|
+
L(le(r, _[1]), e, u.line);
|
|
467
467
|
continue;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
let v =
|
|
470
|
+
let v = me(d);
|
|
471
471
|
if (v) {
|
|
472
472
|
v.from = c(v.from, void 0, !1), v.to = c(v.to, void 0, !1), n.relationships.push(v);
|
|
473
473
|
continue;
|
|
474
474
|
}
|
|
475
|
-
if (
|
|
475
|
+
if (se.test(d)) throw Error(`Line ${u.line}: Malformed class-diagram relationship "${d}". 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 --.`);
|
|
476
476
|
}
|
|
477
477
|
if (a !== null) throw Error(`Line ${s}: Unclosed class body for "${a.id}" — expected a closing "}" before the diagram ends.`);
|
|
478
478
|
return n.classes = [...r.values()], n;
|
|
@@ -482,15 +482,15 @@ function se(t) {
|
|
|
482
482
|
let e = o.match(/^(.+?)~(\w+)~$/);
|
|
483
483
|
e && (c = e[1], l = e[2]);
|
|
484
484
|
}
|
|
485
|
-
let u =
|
|
485
|
+
let u = le(r, c);
|
|
486
486
|
return l && (u.label = `${c}<${l}>`), s && n.classAssignments.set(c, s), a && i && i.classIds.push(c), c;
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
function
|
|
490
|
-
let r =
|
|
489
|
+
function L(e, t, n) {
|
|
490
|
+
let r = pe(t, n);
|
|
491
491
|
r && (r.isMethod ? e.methods.push(r.member) : e.attributes.push(r.member));
|
|
492
492
|
}
|
|
493
|
-
function
|
|
493
|
+
function le(e, t) {
|
|
494
494
|
let n = e.get(t);
|
|
495
495
|
return n || (n = {
|
|
496
496
|
id: t,
|
|
@@ -499,11 +499,11 @@ function ce(e, t) {
|
|
|
499
499
|
methods: []
|
|
500
500
|
}, e.set(t, n)), n;
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function ue(e, t) {
|
|
503
503
|
return Math.max(0, e.split(t).length - 1);
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
let t =
|
|
505
|
+
function de(e) {
|
|
506
|
+
let t = ue(e, "~");
|
|
507
507
|
if (t <= 1) return e;
|
|
508
508
|
let n = e, r = !1;
|
|
509
509
|
t % 2 != 0 && n.startsWith("~") && (n = n.slice(1), r = !0);
|
|
@@ -511,26 +511,26 @@ function ue(e) {
|
|
|
511
511
|
for (; a !== -1 && o !== -1 && a !== o;) i[a] = "<", i[o] = ">", a = i.indexOf("~"), o = i.lastIndexOf("~");
|
|
512
512
|
return r && i.unshift("~"), i.join("");
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function fe(e) {
|
|
515
515
|
let t = e.split(/(,)/), n = [];
|
|
516
516
|
for (let e = 0; e < t.length; e++) {
|
|
517
517
|
let r = t[e];
|
|
518
518
|
if (r === "," && e > 0 && e + 1 < t.length) {
|
|
519
519
|
let i = t[e - 1], a = t[e + 1];
|
|
520
|
-
|
|
520
|
+
ue(i, "~") === 1 && ue(a, "~") === 1 && (r = `${i},${a}`, e++, n.pop());
|
|
521
521
|
}
|
|
522
|
-
n.push(
|
|
522
|
+
n.push(de(r));
|
|
523
523
|
}
|
|
524
524
|
return n.join("");
|
|
525
525
|
}
|
|
526
|
-
function
|
|
526
|
+
function pe(e, t) {
|
|
527
527
|
let n = e.trim().replace(/;$/, "");
|
|
528
528
|
if (!n) return null;
|
|
529
529
|
let r = "", i = n, a = i[0];
|
|
530
530
|
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".`);
|
|
531
531
|
let o = i.match(/^(.+?)\(([^)]*)\)(?:\s*(.+))?$/);
|
|
532
532
|
if (o) {
|
|
533
|
-
let e =
|
|
533
|
+
let e = fe(o[1].trim()), t = o[2]?.trim(), n = t ? fe(t) : void 0, a = o[3]?.trim(), s = a ? fe(a) : void 0, c = e.endsWith("$") || i.includes("$"), l = e.endsWith("*") || i.includes("*");
|
|
534
534
|
return {
|
|
535
535
|
member: {
|
|
536
536
|
visibility: r,
|
|
@@ -544,7 +544,7 @@ function fe(e, t) {
|
|
|
544
544
|
isMethod: !0
|
|
545
545
|
};
|
|
546
546
|
}
|
|
547
|
-
let s =
|
|
547
|
+
let s = fe(i).split(/\s+/), c, l;
|
|
548
548
|
s.length >= 2 ? (l = s[0], c = s.slice(1).join(" ")) : c = s[0] ?? i;
|
|
549
549
|
let u = c.endsWith("$"), d = c.endsWith("*");
|
|
550
550
|
return {
|
|
@@ -559,10 +559,10 @@ function fe(e, t) {
|
|
|
559
559
|
isMethod: !1
|
|
560
560
|
};
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function me(e) {
|
|
563
563
|
let t = e.match(RegExp(`^(\\S+?)\\s+(?:"([^"]*?)"\\s+)?(${oe})\\s+(?:"([^"]*?)"\\s+)?(\\S+?)(?::::([\\w][\\w-]*))?(?:\\s*:\\s*(.+))?$`));
|
|
564
564
|
if (!t) return null;
|
|
565
|
-
let n = t[1], r = t[2], i = r ? M(r) : void 0, a = t[3].trim(), o = t[4], s = o ? M(o) : void 0, c = t[6] ? `${t[5]}:::${t[6]}` : t[5], l = t[7]?.trim(), u = l ? M(l) : void 0, d =
|
|
565
|
+
let n = t[1], r = t[2], i = r ? M(r) : void 0, a = t[3].trim(), o = t[4], s = o ? M(o) : void 0, c = t[6] ? `${t[5]}:::${t[6]}` : t[5], l = t[7]?.trim(), u = l ? M(l) : void 0, d = he(a);
|
|
566
566
|
return d ? {
|
|
567
567
|
from: n,
|
|
568
568
|
to: c,
|
|
@@ -573,7 +573,7 @@ function pe(e) {
|
|
|
573
573
|
toCardinality: s
|
|
574
574
|
} : null;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function he(e) {
|
|
577
577
|
switch (e.trim()) {
|
|
578
578
|
case "<|--": return {
|
|
579
579
|
type: "inheritance",
|
|
@@ -632,12 +632,12 @@ function me(e) {
|
|
|
632
632
|
}
|
|
633
633
|
//#endregion
|
|
634
634
|
//#region packages/mermaid-parser/src/class/format.ts
|
|
635
|
-
function
|
|
635
|
+
function ge(e) {
|
|
636
636
|
return `${e.visibility ? `${e.visibility} ` : ""}${e.isMethod ? `${e.name}(${e.params || ""})` : e.name}${e.type ? `: ${e.type}` : ""}`;
|
|
637
637
|
}
|
|
638
638
|
//#endregion
|
|
639
639
|
//#region packages/mermaid-parser/src/er/parser.ts
|
|
640
|
-
function
|
|
640
|
+
function _e(e) {
|
|
641
641
|
let t = {
|
|
642
642
|
entities: [],
|
|
643
643
|
relationships: []
|
|
@@ -649,7 +649,7 @@ function z(e) {
|
|
|
649
649
|
r = null;
|
|
650
650
|
continue;
|
|
651
651
|
}
|
|
652
|
-
let e =
|
|
652
|
+
let e = R(o);
|
|
653
653
|
e && r.attributes.push(e);
|
|
654
654
|
continue;
|
|
655
655
|
}
|
|
@@ -660,23 +660,23 @@ function z(e) {
|
|
|
660
660
|
}
|
|
661
661
|
let c = o.match(/^(\S+?)(?:\[(.+)\])?\s*\{(.*)$/);
|
|
662
662
|
if (c) {
|
|
663
|
-
let e = c[1], t = c[2], i =
|
|
663
|
+
let e = c[1], t = c[2], i = ve(n, e, t === void 0 ? void 0 : M(t.trim().replace(/^["']|["']$/g, ""))), a = c[3].trim(), o = a.endsWith("}"), s = o ? a.slice(0, -1).trim() : a;
|
|
664
664
|
for (let e of s.split(";").map((e) => e.trim()).filter(Boolean)) {
|
|
665
|
-
let t =
|
|
665
|
+
let t = R(e);
|
|
666
666
|
t && i.attributes.push(t);
|
|
667
667
|
}
|
|
668
668
|
o || (r = i);
|
|
669
669
|
continue;
|
|
670
670
|
}
|
|
671
|
-
let l =
|
|
671
|
+
let l = ye(o, a.line);
|
|
672
672
|
if (l) {
|
|
673
|
-
|
|
673
|
+
ve(n, l.entity1), ve(n, l.entity2), t.relationships.push(l);
|
|
674
674
|
continue;
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
return t.entities = [...n.values()], t;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function ve(e, t, n) {
|
|
680
680
|
let r = e.get(t);
|
|
681
681
|
return r ? n !== void 0 && (r.label = n) : (r = {
|
|
682
682
|
id: t,
|
|
@@ -684,7 +684,7 @@ function ge(e, t, n) {
|
|
|
684
684
|
attributes: []
|
|
685
685
|
}, e.set(t, r)), r;
|
|
686
686
|
}
|
|
687
|
-
function
|
|
687
|
+
function R(e) {
|
|
688
688
|
let t = e.match(/^(\S+)\s+(\S+)(?:\s+(.+))?$/);
|
|
689
689
|
if (!t) return null;
|
|
690
690
|
let n = t[1], r = t[2], i = t[3]?.trim() ?? "", a = [], o, s = i.match(/"([^"]*)"/);
|
|
@@ -701,10 +701,10 @@ function _e(e) {
|
|
|
701
701
|
comment: o
|
|
702
702
|
};
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function ye(e, t) {
|
|
705
705
|
let n = e.match(/^(\S+)\s+(\S*(?:--|\.\.)\S*)\s+(\S+)\s*(?::\s*(.*))?$/);
|
|
706
706
|
if (!n) return null;
|
|
707
|
-
let r = n[1], i = n[2], a = n[3], o = n[4] !== void 0, s = n[4]?.trim() ?? "", c = i.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), l = c ?
|
|
707
|
+
let r = n[1], i = n[2], a = n[3], o = n[4] !== void 0, s = n[4]?.trim() ?? "", c = i.match(/^([|o}{]*)(--|\.\.?)([|o}{]*)$/), l = c ? be(c[1]) : null, u = c ? xe(c[3]) : null;
|
|
708
708
|
if (!l || !u) throw Error(`Line ${t}: Invalid ER relationship cardinality "${i}" in "${e}". Left side must be one of ||, |o, }|, }o; right side must be one of ||, o|, |{, o{ (e.g. "||--o{").`);
|
|
709
709
|
if (!o || s.length === 0) throw Error(`Line ${t}: ER relationship "${r} ${i} ${a}" is missing a ": label" — expected e.g. "${r} ${i} ${a} : label".`);
|
|
710
710
|
return {
|
|
@@ -716,36 +716,36 @@ function ve(e, t) {
|
|
|
716
716
|
identifying: c[2] === "--"
|
|
717
717
|
};
|
|
718
718
|
}
|
|
719
|
-
function
|
|
719
|
+
function be(e) {
|
|
720
720
|
return e === "||" ? "one" : e === "|o" ? "zero-one" : e === "}|" ? "many" : e === "}o" ? "zero-many" : null;
|
|
721
721
|
}
|
|
722
|
-
function
|
|
722
|
+
function xe(e) {
|
|
723
723
|
return e === "||" ? "one" : e === "o|" ? "zero-one" : e === "|{" ? "many" : e === "o{" ? "zero-many" : null;
|
|
724
724
|
}
|
|
725
725
|
//#endregion
|
|
726
726
|
//#region packages/mermaid-parser/src/sequence/box-color.ts
|
|
727
|
-
var
|
|
728
|
-
function
|
|
729
|
-
return
|
|
727
|
+
var Se = 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(" ")), Ce = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i, we = /^(?:rgba?|hsla?)\(\s*[\d.%]+(?:[\s,/]+[\d.%]+){2,3}\s*\)$/i;
|
|
728
|
+
function Te(e) {
|
|
729
|
+
return Se.has(e.toLowerCase()) || Ce.test(e) || we.test(e);
|
|
730
730
|
}
|
|
731
|
-
function
|
|
731
|
+
function Ee(e) {
|
|
732
732
|
let t = e.trim(), n = t.match(/^((?:rgba?|hsla?)\s*\([^)]*\)|#[0-9a-fA-F]+|\S+)?(.*)$/), r = n?.[1] ?? "", i = n?.[2]?.trim() ?? "";
|
|
733
|
-
return r.toLowerCase() === "transparent" ? { label: i } : r !== "" &&
|
|
733
|
+
return r.toLowerCase() === "transparent" ? { label: i } : r !== "" && Te(r) ? {
|
|
734
734
|
color: r,
|
|
735
735
|
label: i
|
|
736
736
|
} : { label: t };
|
|
737
737
|
}
|
|
738
738
|
//#endregion
|
|
739
739
|
//#region packages/mermaid-parser/src/sequence/parser.ts
|
|
740
|
-
function
|
|
740
|
+
function z(e) {
|
|
741
741
|
return e === "loop" || e === "alt" || e === "opt" || e === "par" || e === "critical" || e === "break" || e === "rect";
|
|
742
742
|
}
|
|
743
|
-
function
|
|
744
|
-
if (!
|
|
743
|
+
function De(e) {
|
|
744
|
+
if (!z(e)) throw Error(`Invalid block type: "${e}"`);
|
|
745
745
|
return e;
|
|
746
746
|
}
|
|
747
|
-
var
|
|
748
|
-
function
|
|
747
|
+
var Oe = /^(.+?)\s*(<<->>|<<-->>|--?>?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/, ke = /^(.+?)\s*(<<->>|<<-->>|--?>?>|--?[)x]|--?>>|--?>)\s*([+-]?)(.+?)\s*:\s*(.+)$/;
|
|
748
|
+
function Ae(e) {
|
|
749
749
|
let t = {
|
|
750
750
|
actors: [],
|
|
751
751
|
messages: [],
|
|
@@ -765,7 +765,7 @@ function ke(e) {
|
|
|
765
765
|
let d = e[u], f = d.text, p = f.match(/^box(?:\s+(.*))?$/);
|
|
766
766
|
if (p) {
|
|
767
767
|
if (n.open !== void 0) throw Error(`Line ${d.line}: Sequence diagram: a box cannot be nested inside another box — close the open box with "end" first`);
|
|
768
|
-
let { color: e, label: a } =
|
|
768
|
+
let { color: e, label: a } = Ee(p[1] ?? ""), s = {
|
|
769
769
|
label: M(a),
|
|
770
770
|
actorIds: []
|
|
771
771
|
};
|
|
@@ -780,13 +780,13 @@ function ke(e) {
|
|
|
780
780
|
id: r,
|
|
781
781
|
label: M(m[3]?.trim() ?? r),
|
|
782
782
|
type: e
|
|
783
|
-
}),
|
|
783
|
+
}), Ne(t, n, r, d.line), c = r;
|
|
784
784
|
continue;
|
|
785
785
|
}
|
|
786
786
|
let h = f.match(/^destroy\s+(.+)$/);
|
|
787
787
|
if (h) {
|
|
788
788
|
let e = h[1].trim();
|
|
789
|
-
|
|
789
|
+
Me(t, a, n, e, d.line), l = e;
|
|
790
790
|
continue;
|
|
791
791
|
}
|
|
792
792
|
let g = f.match(/^autonumber(?:\s+(off|\d+(?:\.\d{1,2})?)(?:\s+(\d+(?:\.\d{1,2})?))?)?$/);
|
|
@@ -802,13 +802,13 @@ function ke(e) {
|
|
|
802
802
|
id: r,
|
|
803
803
|
label: i,
|
|
804
804
|
type: e
|
|
805
|
-
})),
|
|
805
|
+
})), Ne(t, n, r, d.line);
|
|
806
806
|
continue;
|
|
807
807
|
}
|
|
808
808
|
let v = f.match(/^Note\s+(left of|right of|over)\s+([^:]+):\s*(.+)$/i);
|
|
809
809
|
if (v) {
|
|
810
810
|
let e = v[1].toLowerCase(), r = v[2].trim(), i = M(v[3].trim()), o = r.split(",").map((e) => e.trim());
|
|
811
|
-
for (let e of o)
|
|
811
|
+
for (let e of o) Me(t, a, n, e, d.line);
|
|
812
812
|
let s = "over";
|
|
813
813
|
e === "left of" ? s = "left" : e === "right of" && (s = "right"), t.notes.push({
|
|
814
814
|
actorIds: o,
|
|
@@ -820,7 +820,7 @@ function ke(e) {
|
|
|
820
820
|
}
|
|
821
821
|
let y = f.match(/^(loop|alt|opt|par|critical|break|rect)\s*(.*)$/);
|
|
822
822
|
if (y) {
|
|
823
|
-
let e =
|
|
823
|
+
let e = De(y[1]), n = M(y[2]?.trim() ?? "");
|
|
824
824
|
o.push({
|
|
825
825
|
type: e,
|
|
826
826
|
label: n,
|
|
@@ -858,26 +858,26 @@ function ke(e) {
|
|
|
858
858
|
let x = f.match(/^(activate|deactivate)\s+(.+)$/);
|
|
859
859
|
if (x) {
|
|
860
860
|
let e = x[2].trim();
|
|
861
|
-
|
|
861
|
+
Me(t, a, n, e, d.line), t.activations.push({
|
|
862
862
|
actorId: e,
|
|
863
863
|
kind: x[1] === "activate" ? "start" : "end",
|
|
864
864
|
afterIndex: t.messages.length - 1
|
|
865
865
|
});
|
|
866
866
|
continue;
|
|
867
867
|
}
|
|
868
|
-
let S = f.match(
|
|
868
|
+
let S = f.match(Oe) ?? f.match(ke);
|
|
869
869
|
if (S) {
|
|
870
870
|
let e = S[2], r = S[4][0];
|
|
871
871
|
if (r === ">" || r === ")") throw Error(`Line ${d.line}: Malformed sequence-diagram arrow in "${f}" — "${e}${r}" is not a recognized arrow. Expected one of: ->, -->, ->>, -->>, -x, --x, -), --), <<->>, <<-->>.`);
|
|
872
|
-
|
|
872
|
+
Pe(t, a, n, s, S[1], S[2], S[3], S[4], S[5], d.line);
|
|
873
873
|
let i = t.messages.length - 1, o = t.messages[i];
|
|
874
874
|
if (c !== void 0) {
|
|
875
875
|
if (o.to !== c) throw Error(`Line ${d.line}: The created participant ${c} does not have an associated creating message after its declaration. Please check the sequence diagram.`);
|
|
876
|
-
|
|
876
|
+
je(t, c).createdAt = i, c = void 0;
|
|
877
877
|
}
|
|
878
878
|
if (l !== void 0) {
|
|
879
879
|
if (o.from !== l && o.to !== l) throw Error(`Line ${d.line}: The destroyed participant ${l} does not have an associated destroying message after its declaration. Please check the sequence diagram.`);
|
|
880
|
-
|
|
880
|
+
je(t, l).destroyedAt = i, l = void 0;
|
|
881
881
|
}
|
|
882
882
|
continue;
|
|
883
883
|
}
|
|
@@ -892,21 +892,21 @@ function ke(e) {
|
|
|
892
892
|
}
|
|
893
893
|
return t;
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function je(e, t) {
|
|
896
896
|
let n = e.actors.find((e) => e.id === t);
|
|
897
897
|
if (n === void 0)
|
|
898
898
|
/* v8 ignore next */
|
|
899
899
|
throw Error(`Sequence diagram: unknown actor "${t}"`);
|
|
900
900
|
return n;
|
|
901
901
|
}
|
|
902
|
-
function
|
|
902
|
+
function Me(e, t, n, r, i) {
|
|
903
903
|
t.has(r) || (t.add(r), e.actors.push({
|
|
904
904
|
id: r,
|
|
905
905
|
label: r,
|
|
906
906
|
type: "participant"
|
|
907
|
-
})),
|
|
907
|
+
})), Ne(e, n, r, i);
|
|
908
908
|
}
|
|
909
|
-
function
|
|
909
|
+
function Ne(e, t, n, r) {
|
|
910
910
|
let i = t.open;
|
|
911
911
|
if (i === void 0) return;
|
|
912
912
|
let a = t.membership.get(n);
|
|
@@ -918,8 +918,8 @@ function Me(e, t, n, r) {
|
|
|
918
918
|
t.membership.set(n, i), e.boxes[i].actorIds.push(n);
|
|
919
919
|
}
|
|
920
920
|
}
|
|
921
|
-
function
|
|
922
|
-
|
|
921
|
+
function Pe(e, t, n, r, i, a, o, s, c, l) {
|
|
922
|
+
Me(e, t, n, i, l), Me(e, t, n, s, l);
|
|
923
923
|
let u = a === "<<->>" || a === "<<-->>", d = u ? a === "<<-->>" ? "dashed" : "solid" : a.startsWith("--") ? "dashed" : "solid", f = a.includes(">>") || a.includes("x") ? "filled" : "open", p = a.includes("x"), m = {
|
|
924
924
|
from: i,
|
|
925
925
|
to: s,
|
|
@@ -931,7 +931,7 @@ function Ne(e, t, n, r, i, a, o, s, c, l) {
|
|
|
931
931
|
}
|
|
932
932
|
//#endregion
|
|
933
933
|
//#region packages/mermaid-parser/src/xychart/parser.ts
|
|
934
|
-
function
|
|
934
|
+
function Fe(e) {
|
|
935
935
|
let t = {}, n = {}, r = [], i, a = !1;
|
|
936
936
|
for (let o of e) {
|
|
937
937
|
let e = o.text;
|
|
@@ -974,7 +974,7 @@ function Pe(e) {
|
|
|
974
974
|
if (f) {
|
|
975
975
|
r.push({
|
|
976
976
|
type: "bar",
|
|
977
|
-
data:
|
|
977
|
+
data: Ie(f[1], "bar", e, o.line)
|
|
978
978
|
});
|
|
979
979
|
continue;
|
|
980
980
|
}
|
|
@@ -982,12 +982,12 @@ function Pe(e) {
|
|
|
982
982
|
if (p) {
|
|
983
983
|
r.push({
|
|
984
984
|
type: "line",
|
|
985
|
-
data:
|
|
985
|
+
data: Ie(p[1], "line", e, o.line)
|
|
986
986
|
});
|
|
987
987
|
continue;
|
|
988
988
|
}
|
|
989
989
|
let m = e.match(/^(x-axis|y-axis|bar|line|title)\b/i);
|
|
990
|
-
if (m) throw
|
|
990
|
+
if (m) throw Re(m[1].toLowerCase(), e, o.line);
|
|
991
991
|
}
|
|
992
992
|
if (!n.range && r.length > 0) {
|
|
993
993
|
let e = r.flatMap((e) => e.data), t = Math.min(...e), i = Math.max(...e), a = i - t || 1;
|
|
@@ -1007,28 +1007,28 @@ function Pe(e) {
|
|
|
1007
1007
|
series: r
|
|
1008
1008
|
};
|
|
1009
1009
|
}
|
|
1010
|
-
function
|
|
1010
|
+
function Ie(e, t, n, r) {
|
|
1011
1011
|
return e.split(",").map((e, i) => {
|
|
1012
1012
|
let a = e.trim(), o = parseFloat(a);
|
|
1013
1013
|
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.`);
|
|
1014
1014
|
return o;
|
|
1015
1015
|
});
|
|
1016
1016
|
}
|
|
1017
|
-
var
|
|
1017
|
+
var Le = {
|
|
1018
1018
|
"x-axis": "x-axis [A, B, C] (categories) or x-axis 0 --> 100 (numeric range), either optionally preceded by a quoted title",
|
|
1019
1019
|
"y-axis": "y-axis 0 --> 100 (numeric range) or y-axis \"Title\" (title only), optionally preceded by a quoted title before a range",
|
|
1020
1020
|
bar: "bar [10, 20, 30] — a comma-separated numeric array in square brackets",
|
|
1021
1021
|
line: "line [10, 20, 30] — a comma-separated numeric array in square brackets",
|
|
1022
1022
|
title: "title \"Chart Title\" — a double-quoted string"
|
|
1023
1023
|
};
|
|
1024
|
-
function
|
|
1025
|
-
let r =
|
|
1024
|
+
function Re(e, t, n) {
|
|
1025
|
+
let r = Le[e] ?? e;
|
|
1026
1026
|
return /* @__PURE__ */ Error(`Line ${n}: Malformed xychart-beta "${e}" directive: "${t}". Expected: ${r}.`);
|
|
1027
1027
|
}
|
|
1028
1028
|
//#endregion
|
|
1029
1029
|
//#region packages/mermaid-parser/src/xychart/colors.ts
|
|
1030
|
-
var
|
|
1031
|
-
function
|
|
1030
|
+
var ze = "#3b82f6";
|
|
1031
|
+
function Be(e) {
|
|
1032
1032
|
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;
|
|
1033
1033
|
if (a === o) return [
|
|
1034
1034
|
0,
|
|
@@ -1042,26 +1042,26 @@ function ze(e) {
|
|
|
1042
1042
|
s * 100
|
|
1043
1043
|
];
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function Ve(e, t, n) {
|
|
1046
1046
|
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;
|
|
1047
1047
|
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);
|
|
1048
1048
|
let d = (e) => Math.round((e + s) * 255).toString(16).padStart(2, "0");
|
|
1049
1049
|
return `#${d(c)}${d(l)}${d(u)}`;
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function He(e) {
|
|
1052
1052
|
return /^#[0-9a-fA-F]{6}$/.test(e);
|
|
1053
1053
|
}
|
|
1054
|
-
function
|
|
1055
|
-
return
|
|
1054
|
+
function Ue(e) {
|
|
1055
|
+
return Be(e)[2] < 50;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function We(e, t, n) {
|
|
1058
1058
|
if (e === 0) return t;
|
|
1059
|
-
let r =
|
|
1060
|
-
return
|
|
1059
|
+
let r = He(t) ? t : ze, i = n && He(n) ? n : void 0, [a, o] = Be(r), s = Math.max(55, Math.min(85, o)), c = Math.ceil(e / 2), l = e % 2 == 1, u = i && Ue(i) ? !l : l, d = u ? Math.max(25, 48 - c * 13) : Math.min(78, 55 + c * 11);
|
|
1060
|
+
return Ve(((a + (u ? -8 : 12) * c) % 360 + 360) % 360, s, d);
|
|
1061
1061
|
}
|
|
1062
1062
|
//#endregion
|
|
1063
1063
|
//#region packages/mermaid-parser/src/expanded-shapes.ts
|
|
1064
|
-
var
|
|
1064
|
+
var Ge = {
|
|
1065
1065
|
rect: "rectangle",
|
|
1066
1066
|
rectangle: "rectangle",
|
|
1067
1067
|
proc: "rectangle",
|
|
@@ -1187,25 +1187,25 @@ var We = {
|
|
|
1187
1187
|
text: "text",
|
|
1188
1188
|
anchor: "anchor"
|
|
1189
1189
|
};
|
|
1190
|
-
function Ge(e) {
|
|
1191
|
-
return We[e.trim().toLowerCase()];
|
|
1192
|
-
}
|
|
1193
1190
|
function Ke(e) {
|
|
1191
|
+
return Ge[e.trim().toLowerCase()];
|
|
1192
|
+
}
|
|
1193
|
+
function qe(e) {
|
|
1194
1194
|
let t = {};
|
|
1195
|
-
for (let n of
|
|
1195
|
+
for (let n of Je(e, ",")) {
|
|
1196
1196
|
let e = n.trim();
|
|
1197
1197
|
if (e.length === 0) continue;
|
|
1198
|
-
let r =
|
|
1198
|
+
let r = Ye(e, ":");
|
|
1199
1199
|
if (r === -1) {
|
|
1200
|
-
t.shape ??=
|
|
1200
|
+
t.shape ??= Xe(e);
|
|
1201
1201
|
continue;
|
|
1202
1202
|
}
|
|
1203
|
-
let i = e.slice(0, r).trim().toLowerCase(), a =
|
|
1203
|
+
let i = e.slice(0, r).trim().toLowerCase(), a = Xe(e.slice(r + 1).trim());
|
|
1204
1204
|
i.length > 0 && (t[i] = a);
|
|
1205
1205
|
}
|
|
1206
1206
|
return t;
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function Je(e, t) {
|
|
1209
1209
|
let n = [], r = "", i = null;
|
|
1210
1210
|
for (let a of e) {
|
|
1211
1211
|
if (i !== null) {
|
|
@@ -1224,7 +1224,7 @@ function qe(e, t) {
|
|
|
1224
1224
|
}
|
|
1225
1225
|
return n.push(r), n;
|
|
1226
1226
|
}
|
|
1227
|
-
function
|
|
1227
|
+
function Ye(e, t) {
|
|
1228
1228
|
let n = null;
|
|
1229
1229
|
for (let r = 0; r < e.length; r++) {
|
|
1230
1230
|
let i = e[r];
|
|
@@ -1240,10 +1240,10 @@ function Je(e, t) {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
return -1;
|
|
1242
1242
|
}
|
|
1243
|
-
function
|
|
1243
|
+
function Xe(e) {
|
|
1244
1244
|
return e.length >= 2 && (e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'")) ? e.slice(1, -1) : e;
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function Ze(e) {
|
|
1247
1247
|
if (!e.startsWith("@{")) return;
|
|
1248
1248
|
let t = 0, n = null;
|
|
1249
1249
|
for (let r = 1; r < e.length; r++) {
|
|
@@ -1268,18 +1268,18 @@ function Xe(e) {
|
|
|
1268
1268
|
}
|
|
1269
1269
|
//#endregion
|
|
1270
1270
|
//#region packages/ascii-renderer/src/hyperlinks.ts
|
|
1271
|
-
function
|
|
1271
|
+
function Qe(e) {
|
|
1272
1272
|
return [e.length - 1, (e[0]?.length ?? 1) - 1];
|
|
1273
1273
|
}
|
|
1274
|
-
var
|
|
1275
|
-
function
|
|
1274
|
+
var $e = "\x1B]8;;\x1B\\";
|
|
1275
|
+
function et(e) {
|
|
1276
1276
|
return `\x1b]8;;${e.replace(/[^\x21-\x7e]/gu, (e) => encodeURIComponent(e))}\x1b\\`;
|
|
1277
1277
|
}
|
|
1278
|
-
var
|
|
1279
|
-
function
|
|
1280
|
-
return e.replace(
|
|
1278
|
+
var tt = /\x1b\]8;[^\x07\x1b]*(?:\x1b\\|\x07)/g;
|
|
1279
|
+
function nt(e) {
|
|
1280
|
+
return e.replace(tt, "");
|
|
1281
1281
|
}
|
|
1282
|
-
function
|
|
1282
|
+
function rt(e, t) {
|
|
1283
1283
|
let n = [];
|
|
1284
1284
|
for (let r = 0; r <= e; r++) {
|
|
1285
1285
|
let e = [];
|
|
@@ -1288,51 +1288,51 @@ function nt(e, t) {
|
|
|
1288
1288
|
}
|
|
1289
1289
|
return n;
|
|
1290
1290
|
}
|
|
1291
|
-
function
|
|
1291
|
+
function it(e, t, n, r) {
|
|
1292
1292
|
let i = e[t];
|
|
1293
1293
|
i === void 0 || n < 0 || n >= i.length || (i[n] = r);
|
|
1294
1294
|
}
|
|
1295
|
-
function
|
|
1295
|
+
function at(e) {
|
|
1296
1296
|
for (let t of e) t.reverse();
|
|
1297
1297
|
return e;
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1300
|
-
let [a, o] =
|
|
1299
|
+
function ot(e, t, n, r, i) {
|
|
1300
|
+
let [a, o] = Qe(t), s = Math.max(1, i?.from ?? 1), c = Math.min(o - 1, i?.to ?? o - 1);
|
|
1301
1301
|
for (let i = s; i <= c; i++) {
|
|
1302
1302
|
let o = -1, s = -1;
|
|
1303
1303
|
for (let e = 1; e <= a - 1; e++) t[e]?.[i] !== " " && (o === -1 && (o = e), s = e);
|
|
1304
|
-
if (o !== -1) for (let t = o; t <= s; t++)
|
|
1304
|
+
if (o !== -1) for (let t = o; t <= s; t++) it(e, t + n.x, i + n.y, r);
|
|
1305
1305
|
}
|
|
1306
1306
|
}
|
|
1307
|
-
function
|
|
1308
|
-
let [r, i] =
|
|
1307
|
+
function st(e, n) {
|
|
1308
|
+
let [r, i] = Qe(e.canvas), a = rt(r, i);
|
|
1309
1309
|
for (let r of e.nodes) {
|
|
1310
1310
|
if (!r.drawing || !r.drawingCoord) continue;
|
|
1311
1311
|
let e = t(n.get(r.name)?.href);
|
|
1312
|
-
e !== void 0 &&
|
|
1312
|
+
e !== void 0 && ot(a, r.drawing, r.drawingCoord, e);
|
|
1313
1313
|
}
|
|
1314
1314
|
return a;
|
|
1315
1315
|
}
|
|
1316
|
-
var
|
|
1316
|
+
var ct = class {
|
|
1317
1317
|
current = null;
|
|
1318
1318
|
advance(e) {
|
|
1319
1319
|
if (e === this.current) return "";
|
|
1320
|
-
let t = this.current === null ? "" :
|
|
1321
|
-
return e !== null && (t +=
|
|
1320
|
+
let t = this.current === null ? "" : $e;
|
|
1321
|
+
return e !== null && (t += et(e)), this.current = e, t;
|
|
1322
1322
|
}
|
|
1323
1323
|
finish() {
|
|
1324
|
-
let e = this.current === null ? "" :
|
|
1324
|
+
let e = this.current === null ? "" : $e;
|
|
1325
1325
|
return this.current = null, e;
|
|
1326
1326
|
}
|
|
1327
1327
|
};
|
|
1328
|
-
function
|
|
1329
|
-
let n = new
|
|
1328
|
+
function lt(e, t) {
|
|
1329
|
+
let n = new ct(), r = "";
|
|
1330
1330
|
for (let [i, a] of e.entries()) r += n.advance(t[i] ?? null) + a;
|
|
1331
1331
|
return r + n.finish();
|
|
1332
1332
|
}
|
|
1333
1333
|
//#endregion
|
|
1334
1334
|
//#region packages/ascii-renderer/src/ansi.ts
|
|
1335
|
-
var
|
|
1335
|
+
var ut = {
|
|
1336
1336
|
fg: "#27272a",
|
|
1337
1337
|
border: "#a1a1aa",
|
|
1338
1338
|
line: "#71717a",
|
|
@@ -1340,7 +1340,7 @@ var lt = {
|
|
|
1340
1340
|
corner: "#71717a",
|
|
1341
1341
|
junction: "#a1a1aa"
|
|
1342
1342
|
};
|
|
1343
|
-
function
|
|
1343
|
+
function dt(e) {
|
|
1344
1344
|
let t = e.line ?? l(e.fg, e.bg, ae.line), n = e.border ?? l(e.fg, e.bg, ae.nodeStroke);
|
|
1345
1345
|
return {
|
|
1346
1346
|
fg: e.fg,
|
|
@@ -1353,7 +1353,7 @@ function ut(e) {
|
|
|
1353
1353
|
junction: n
|
|
1354
1354
|
};
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function ft() {
|
|
1357
1357
|
let e = globalThis.process;
|
|
1358
1358
|
if (e) {
|
|
1359
1359
|
if (!e.stdout?.isTTY) return "none";
|
|
@@ -1362,19 +1362,19 @@ function dt() {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
return typeof document < "u" ? "html" : "none";
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1365
|
+
function pt(e) {
|
|
1366
1366
|
return i(e.startsWith("#") ? e : `#${e}`) ?? {
|
|
1367
1367
|
r: 0,
|
|
1368
1368
|
g: 0,
|
|
1369
1369
|
b: 0
|
|
1370
1370
|
};
|
|
1371
1371
|
}
|
|
1372
|
-
var
|
|
1373
|
-
function
|
|
1374
|
-
let { r: t, g: n, b: r } =
|
|
1375
|
-
return `${
|
|
1372
|
+
var mt = "\x1B[", ht = `${mt}0m`;
|
|
1373
|
+
function gt(e) {
|
|
1374
|
+
let { r: t, g: n, b: r } = pt(e);
|
|
1375
|
+
return `${mt}38;2;${t};${n};${r}m`;
|
|
1376
1376
|
}
|
|
1377
|
-
function
|
|
1377
|
+
function _t(e, t, n) {
|
|
1378
1378
|
let r = (e + t + n) / 3;
|
|
1379
1379
|
if (Math.max(Math.abs(e - r), Math.abs(t - r), Math.abs(n - r)) < 10) {
|
|
1380
1380
|
let e = Math.round(r / 255 * 23);
|
|
@@ -1383,21 +1383,21 @@ function gt(e, t, n) {
|
|
|
1383
1383
|
let i = (e) => e < 48 ? 0 : e < 115 ? 1 : Math.min(5, Math.floor((e - 35) / 40)), a = i(e), o = i(t), s = i(n);
|
|
1384
1384
|
return 16 + 36 * a + 6 * o + s;
|
|
1385
1385
|
}
|
|
1386
|
-
function _t(e) {
|
|
1387
|
-
let { r: t, g: n, b: r } = ft(e);
|
|
1388
|
-
return `${pt}38;5;${gt(t, n, r)}m`;
|
|
1389
|
-
}
|
|
1390
1386
|
function vt(e) {
|
|
1391
|
-
let { r: t, g: n, b: r } =
|
|
1392
|
-
return
|
|
1387
|
+
let { r: t, g: n, b: r } = pt(e);
|
|
1388
|
+
return `${mt}38;5;${_t(t, n, r)}m`;
|
|
1393
1389
|
}
|
|
1394
1390
|
function yt(e) {
|
|
1395
|
-
|
|
1391
|
+
let { r: t, g: n, b: r } = pt(e), i = .299 * t + .587 * n + .114 * r, a = i > 100 ? 0 : 60, o;
|
|
1392
|
+
return o = t > 180 && n < 100 && r < 100 ? 31 : n > 180 && t < 100 && r < 100 ? 32 : t > 150 && n > 150 && r < 100 ? 33 : r > 180 && t < 100 && n < 100 ? 34 : t > 150 && r > 150 && n < 100 ? 35 : n > 150 && r > 150 && t < 100 ? 36 : i > 200 ? 37 : i < 50 ? 30 : 37, `${mt}${o + a}m`;
|
|
1396
1393
|
}
|
|
1397
|
-
function bt(e
|
|
1398
|
-
return
|
|
1394
|
+
function bt(e) {
|
|
1395
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1399
1396
|
}
|
|
1400
1397
|
function xt(e, t) {
|
|
1398
|
+
return `<span style="color:${e}">${bt(t)}</span>`;
|
|
1399
|
+
}
|
|
1400
|
+
function St(e, t) {
|
|
1401
1401
|
switch (e) {
|
|
1402
1402
|
case "text": return t.fg;
|
|
1403
1403
|
case "border": return t.border;
|
|
@@ -1408,37 +1408,37 @@ function xt(e, t) {
|
|
|
1408
1408
|
default: return t.fg;
|
|
1409
1409
|
}
|
|
1410
1410
|
}
|
|
1411
|
-
function
|
|
1411
|
+
function Ct(e, t, n) {
|
|
1412
1412
|
if (n === "none") return "";
|
|
1413
|
-
let r =
|
|
1413
|
+
let r = St(e, t);
|
|
1414
1414
|
switch (n) {
|
|
1415
|
-
case "truecolor": return
|
|
1416
|
-
case "ansi256": return
|
|
1417
|
-
case "ansi16": return
|
|
1415
|
+
case "truecolor": return gt(r);
|
|
1416
|
+
case "ansi256": return vt(r);
|
|
1417
|
+
case "ansi16": return yt(r);
|
|
1418
1418
|
default: return "";
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
|
-
function
|
|
1422
|
-
if (r === "none") return i ?
|
|
1423
|
-
if (r === "html") return
|
|
1424
|
-
let a = new
|
|
1421
|
+
function wt(e, t, n, r, i) {
|
|
1422
|
+
if (r === "none") return i ? lt(e, i) : e.join("");
|
|
1423
|
+
if (r === "html") return Tt(e, t, n);
|
|
1424
|
+
let a = new ct(), o = "", s = null, c = "";
|
|
1425
1425
|
for (let [l, u] of e.entries()) {
|
|
1426
1426
|
let e = t[l] ?? null, d = i ? a.advance(i[l] ?? null) : "";
|
|
1427
1427
|
if (u === " ") {
|
|
1428
|
-
c.length > 0 && (o += s === null ? c :
|
|
1428
|
+
c.length > 0 && (o += s === null ? c : Ct(s, n, r) + c + ht, c = "", s = null), o += d + u;
|
|
1429
1429
|
continue;
|
|
1430
1430
|
}
|
|
1431
1431
|
if (e === s) {
|
|
1432
1432
|
c += d + u;
|
|
1433
1433
|
continue;
|
|
1434
1434
|
}
|
|
1435
|
-
c.length > 0 && (o += s === null ? c :
|
|
1435
|
+
c.length > 0 && (o += s === null ? c : Ct(s, n, r) + c + ht), c = d + u, s = e;
|
|
1436
1436
|
}
|
|
1437
|
-
return c.length > 0 && s !== null ? o +=
|
|
1437
|
+
return c.length > 0 && s !== null ? o += Ct(s, n, r) + c + ht : c.length > 0 && (o += c), o + a.finish();
|
|
1438
1438
|
}
|
|
1439
|
-
function
|
|
1439
|
+
function Tt(e, t, n) {
|
|
1440
1440
|
let r = "", i = null, a = "", o = () => {
|
|
1441
|
-
a.length !== 0 && (r += i === null ?
|
|
1441
|
+
a.length !== 0 && (r += i === null ? bt(a) : xt(St(i, n), a), a = "", i = null);
|
|
1442
1442
|
};
|
|
1443
1443
|
for (let [n, s] of e.entries()) {
|
|
1444
1444
|
let e = t[n] ?? null;
|
|
@@ -1454,56 +1454,56 @@ function wt(e, t, n) {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
return o(), r;
|
|
1456
1456
|
}
|
|
1457
|
-
function
|
|
1457
|
+
function Et(e, t, n) {
|
|
1458
1458
|
if (n === "none" || e.length === 0) return e;
|
|
1459
|
-
if (n === "html") return
|
|
1459
|
+
if (n === "html") return xt(t, e);
|
|
1460
1460
|
let r;
|
|
1461
1461
|
switch (n) {
|
|
1462
1462
|
case "truecolor":
|
|
1463
|
-
r =
|
|
1463
|
+
r = gt(t);
|
|
1464
1464
|
break;
|
|
1465
1465
|
case "ansi256":
|
|
1466
|
-
r =
|
|
1466
|
+
r = vt(t);
|
|
1467
1467
|
break;
|
|
1468
1468
|
case "ansi16":
|
|
1469
|
-
r =
|
|
1469
|
+
r = yt(t);
|
|
1470
1470
|
break;
|
|
1471
1471
|
default: return e;
|
|
1472
1472
|
}
|
|
1473
|
-
return `${r}${e}${
|
|
1473
|
+
return `${r}${e}${ht}`;
|
|
1474
1474
|
}
|
|
1475
|
-
var
|
|
1476
|
-
function
|
|
1477
|
-
return
|
|
1475
|
+
var Dt = /\p{Mn}|\p{Me}/u;
|
|
1476
|
+
function Ot(e) {
|
|
1477
|
+
return Dt.test(e);
|
|
1478
1478
|
}
|
|
1479
|
-
var
|
|
1480
|
-
function
|
|
1479
|
+
var kt = new Intl.Segmenter(void 0, { granularity: "grapheme" }), At = "️";
|
|
1480
|
+
function jt(e) {
|
|
1481
1481
|
let t = [];
|
|
1482
|
-
for (let { segment: n } of
|
|
1482
|
+
for (let { segment: n } of kt.segment(e)) t.push(n);
|
|
1483
1483
|
return t;
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1486
|
-
if (e.includes(
|
|
1485
|
+
function Mt(e) {
|
|
1486
|
+
if (e.includes(At)) return 2;
|
|
1487
1487
|
let t = !1, n = !1;
|
|
1488
|
-
for (let r of e) j(r) && (t = !0),
|
|
1488
|
+
for (let r of e) j(r) && (t = !0), Ot(r) || (n = !0);
|
|
1489
1489
|
return t ? 2 : +!!n;
|
|
1490
1490
|
}
|
|
1491
|
-
function
|
|
1491
|
+
function B(e) {
|
|
1492
1492
|
let t = 0;
|
|
1493
|
-
for (let n of
|
|
1493
|
+
for (let n of jt(e)) t += Mt(n);
|
|
1494
1494
|
return t;
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function Nt(e) {
|
|
1497
1497
|
let t = [];
|
|
1498
|
-
for (let n of
|
|
1499
|
-
let e =
|
|
1498
|
+
for (let n of jt(e)) {
|
|
1499
|
+
let e = Mt(n);
|
|
1500
1500
|
e !== 0 && (t.push(n), e === 2 && t.push(""));
|
|
1501
1501
|
}
|
|
1502
1502
|
return t;
|
|
1503
1503
|
}
|
|
1504
1504
|
//#endregion
|
|
1505
1505
|
//#region packages/ascii-renderer/src/canvas.ts
|
|
1506
|
-
function
|
|
1506
|
+
function V(e, t) {
|
|
1507
1507
|
let n = [];
|
|
1508
1508
|
for (let r = 0; r <= e; r++) {
|
|
1509
1509
|
let e = [];
|
|
@@ -1512,11 +1512,11 @@ function H(e, t) {
|
|
|
1512
1512
|
}
|
|
1513
1513
|
return n;
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1516
|
-
let [t, n] =
|
|
1517
|
-
return
|
|
1515
|
+
function H(e) {
|
|
1516
|
+
let [t, n] = Lt(e);
|
|
1517
|
+
return V(t, n);
|
|
1518
1518
|
}
|
|
1519
|
-
function
|
|
1519
|
+
function Pt(e, t) {
|
|
1520
1520
|
let n = [];
|
|
1521
1521
|
for (let r = 0; r <= e; r++) {
|
|
1522
1522
|
let e = [];
|
|
@@ -1525,27 +1525,27 @@ function Nt(e, t) {
|
|
|
1525
1525
|
}
|
|
1526
1526
|
return n;
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1529
|
-
let r = e.length - 1, i = (e[0]?.length ?? 1) - 1, a =
|
|
1528
|
+
function Ft(e, t, n) {
|
|
1529
|
+
let r = e.length - 1, i = (e[0]?.length ?? 1) - 1, a = Pt(Math.max(t, r), Math.max(n, i));
|
|
1530
1530
|
for (let t = 0; t < a.length; t++) for (let n = 0; n < (a[0]?.length ?? 0); n++) t < e.length && n < (e[0]?.length ?? 0) && (a[t][n] = e[t][n]);
|
|
1531
1531
|
return e.length = 0, e.push(...a), e;
|
|
1532
1532
|
}
|
|
1533
|
-
function
|
|
1534
|
-
(t >= e.length || n >= (e[0]?.length ?? 0)) &&
|
|
1533
|
+
function It(e, t, n, r) {
|
|
1534
|
+
(t >= e.length || n >= (e[0]?.length ?? 0)) && Ft(e, t, n), e[t][n] = r;
|
|
1535
1535
|
}
|
|
1536
|
-
function
|
|
1536
|
+
function Lt(e) {
|
|
1537
1537
|
return [e.length - 1, (e[0]?.length ?? 1) - 1];
|
|
1538
1538
|
}
|
|
1539
|
-
function
|
|
1540
|
-
let [r, i] =
|
|
1539
|
+
function Rt(e, t, n) {
|
|
1540
|
+
let [r, i] = Lt(e), a = V(Math.max(t, r), Math.max(n, i));
|
|
1541
1541
|
for (let t = 0; t < a.length; t++) for (let n = 0; n < (a[0]?.length ?? 0); n++) t < e.length && n < (e[0]?.length ?? 0) && (a[t][n] = e[t][n]);
|
|
1542
1542
|
return e.length = 0, e.push(...a), e;
|
|
1543
1543
|
}
|
|
1544
|
-
function
|
|
1545
|
-
let [a, o] =
|
|
1546
|
-
t < 0 || t > a || n < 0 || n > o || (e[t][n] = r, i &&
|
|
1544
|
+
function U(e, t, n, r, i) {
|
|
1545
|
+
let [a, o] = Lt(e);
|
|
1546
|
+
t < 0 || t > a || n < 0 || n > o || (e[t][n] = r, i && It(i.roleCanvas, t, n, i.role));
|
|
1547
1547
|
}
|
|
1548
|
-
var
|
|
1548
|
+
var zt = /* @__PURE__ */ new Set([
|
|
1549
1549
|
"─",
|
|
1550
1550
|
"│",
|
|
1551
1551
|
"┌",
|
|
@@ -1562,13 +1562,13 @@ var Rt = /* @__PURE__ */ new Set([
|
|
|
1562
1562
|
"╶",
|
|
1563
1563
|
"╷"
|
|
1564
1564
|
]);
|
|
1565
|
-
function zt(e) {
|
|
1566
|
-
return Rt.has(e);
|
|
1567
|
-
}
|
|
1568
1565
|
function Bt(e) {
|
|
1566
|
+
return zt.has(e);
|
|
1567
|
+
}
|
|
1568
|
+
function Vt(e) {
|
|
1569
1569
|
return /^[a-zA-Z0-9]$/.test(e);
|
|
1570
1570
|
}
|
|
1571
|
-
var
|
|
1571
|
+
var Ht = {
|
|
1572
1572
|
"─": {
|
|
1573
1573
|
"│": "┼",
|
|
1574
1574
|
"┌": "┬",
|
|
@@ -1680,43 +1680,43 @@ var Vt = {
|
|
|
1680
1680
|
"┬": "┼"
|
|
1681
1681
|
}
|
|
1682
1682
|
};
|
|
1683
|
-
function
|
|
1684
|
-
return
|
|
1683
|
+
function Ut(e, t) {
|
|
1684
|
+
return Ht[e]?.[t] ?? e;
|
|
1685
1685
|
}
|
|
1686
|
-
function
|
|
1687
|
-
let [i, a] =
|
|
1686
|
+
function Wt(e, t, n, ...r) {
|
|
1687
|
+
let [i, a] = Lt(e);
|
|
1688
1688
|
for (let e of r) {
|
|
1689
|
-
let [n, r] =
|
|
1689
|
+
let [n, r] = Lt(e);
|
|
1690
1690
|
i = Math.max(i, n + t.x), a = Math.max(a, r + t.y);
|
|
1691
1691
|
}
|
|
1692
|
-
let o =
|
|
1692
|
+
let o = V(i, a);
|
|
1693
1693
|
for (let t = 0; t <= i; t++) for (let n = 0; n <= a; n++) t < e.length && n < (e[0]?.length ?? 0) && (o[t][n] = e[t][n]);
|
|
1694
1694
|
for (let e of r) for (let r = 0; r < e.length; r++) for (let i = 0; i < (e[0]?.length ?? 0); i++) {
|
|
1695
1695
|
let a = e[r][i];
|
|
1696
1696
|
if (a !== " ") {
|
|
1697
1697
|
let e = r + t.x, s = i + t.y, c = o[e][s];
|
|
1698
|
-
!n &&
|
|
1698
|
+
!n && Bt(a) && Bt(c) ? o[e][s] = Ut(c, a) : Vt(c) && Vt(a) || (o[e][s] = a);
|
|
1699
1699
|
}
|
|
1700
1700
|
}
|
|
1701
1701
|
return o;
|
|
1702
1702
|
}
|
|
1703
|
-
function
|
|
1704
|
-
let [n, r] =
|
|
1703
|
+
function Gt(e, t) {
|
|
1704
|
+
let [n, r] = Lt(e), i = [], a = t?.roleCanvas, o = t?.colorMode ?? "none", s = t?.theme ?? ut, c = o === "html" ? void 0 : t?.linkCanvas;
|
|
1705
1705
|
for (let t = 0; t <= r; t++) if (o === "none" || !a) {
|
|
1706
1706
|
let r = [];
|
|
1707
1707
|
for (let i = 0; i <= n; i++) r.push(e[i][t]);
|
|
1708
1708
|
if (c) {
|
|
1709
1709
|
let e = r.map((e, n) => c[n]?.[t] ?? null);
|
|
1710
|
-
i.push(
|
|
1710
|
+
i.push(lt(r, e));
|
|
1711
1711
|
} else i.push(r.join(""));
|
|
1712
1712
|
} else {
|
|
1713
1713
|
let r = [], l = [], u = [];
|
|
1714
1714
|
for (let i = 0; i <= n; i++) r.push(e[i][t]), l.push(a[i]?.[t] ?? null), u.push(c?.[i]?.[t] ?? null);
|
|
1715
|
-
i.push(
|
|
1715
|
+
i.push(wt(r, l, s, o, c ? u : void 0));
|
|
1716
1716
|
}
|
|
1717
1717
|
return i.join("\n");
|
|
1718
1718
|
}
|
|
1719
|
-
var
|
|
1719
|
+
var Kt = {
|
|
1720
1720
|
"▲": "▼",
|
|
1721
1721
|
"▼": "▲",
|
|
1722
1722
|
"◤": "◣",
|
|
@@ -1734,41 +1734,41 @@ var Gt = {
|
|
|
1734
1734
|
"╵": "╷",
|
|
1735
1735
|
"╷": "╵"
|
|
1736
1736
|
};
|
|
1737
|
-
function
|
|
1737
|
+
function qt(e) {
|
|
1738
1738
|
for (let t of e) t.reverse();
|
|
1739
1739
|
for (let t of e) for (let [e, n] of t.entries()) {
|
|
1740
|
-
let r =
|
|
1740
|
+
let r = Kt[n];
|
|
1741
1741
|
r && (t[e] = r);
|
|
1742
1742
|
}
|
|
1743
1743
|
return e;
|
|
1744
1744
|
}
|
|
1745
|
-
function
|
|
1745
|
+
function Jt(e) {
|
|
1746
1746
|
for (let t of e) t.reverse();
|
|
1747
1747
|
return e;
|
|
1748
1748
|
}
|
|
1749
|
-
function
|
|
1750
|
-
let i =
|
|
1751
|
-
|
|
1749
|
+
function Yt(e, t, n, r = !1) {
|
|
1750
|
+
let i = Nt(n);
|
|
1751
|
+
Rt(e, t.x + i.length, t.y);
|
|
1752
1752
|
for (let [n, a] of i.entries()) {
|
|
1753
1753
|
let i = t.x + n, o = e[i][t.y];
|
|
1754
1754
|
(r || o === " ") && (e[i][t.y] = a);
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
function
|
|
1757
|
+
function Xt(e, t, n) {
|
|
1758
1758
|
let r = 0, i = 0;
|
|
1759
1759
|
for (let e of t.values()) r += e;
|
|
1760
1760
|
for (let e of n.values()) i += e;
|
|
1761
|
-
|
|
1761
|
+
Rt(e, r - 1, i - 1);
|
|
1762
1762
|
}
|
|
1763
|
-
function
|
|
1763
|
+
function Zt(e, t, n) {
|
|
1764
1764
|
let r = 0, i = 0;
|
|
1765
1765
|
for (let e of t.values()) r += e;
|
|
1766
1766
|
for (let e of n.values()) i += e;
|
|
1767
|
-
|
|
1767
|
+
Ft(e, r - 1, i - 1);
|
|
1768
1768
|
}
|
|
1769
1769
|
//#endregion
|
|
1770
1770
|
//#region packages/ascii-renderer/src/xychart.ts
|
|
1771
|
-
var
|
|
1771
|
+
var Qt = 60, $t = 20, en = {
|
|
1772
1772
|
hLine: "─",
|
|
1773
1773
|
vLine: "│",
|
|
1774
1774
|
origin: "┼",
|
|
@@ -1780,7 +1780,7 @@ var Zt = 60, Qt = 20, $t = {
|
|
|
1780
1780
|
cornerTR: "╮",
|
|
1781
1781
|
cornerBL: "╰",
|
|
1782
1782
|
cornerBR: "╯"
|
|
1783
|
-
},
|
|
1783
|
+
}, tn = {
|
|
1784
1784
|
hLine: "-",
|
|
1785
1785
|
vLine: "|",
|
|
1786
1786
|
origin: "+",
|
|
@@ -1793,11 +1793,11 @@ var Zt = 60, Qt = 20, $t = {
|
|
|
1793
1793
|
cornerBL: "+",
|
|
1794
1794
|
cornerBR: "+"
|
|
1795
1795
|
};
|
|
1796
|
-
function
|
|
1796
|
+
function nn(e, t) {
|
|
1797
1797
|
let n = t.accent ?? "#3b82f6";
|
|
1798
|
-
return e <= 1 ? [n] : Array.from({ length: e }, (e, r) =>
|
|
1798
|
+
return e <= 1 ? [n] : Array.from({ length: e }, (e, r) => We(r, n, t.bg));
|
|
1799
1799
|
}
|
|
1800
|
-
function
|
|
1800
|
+
function rn(e, t) {
|
|
1801
1801
|
switch (e) {
|
|
1802
1802
|
case "text": return t.fg;
|
|
1803
1803
|
case "border": return t.border;
|
|
@@ -1808,56 +1808,56 @@ function nn(e, t) {
|
|
|
1808
1808
|
default: return t.fg;
|
|
1809
1809
|
}
|
|
1810
1810
|
}
|
|
1811
|
-
function rn(e, t, n, r) {
|
|
1812
|
-
let i = Pe(_(e)), a = t.useAscii ? en : $t;
|
|
1813
|
-
return i.horizontal ? on(i, a, n, r) : an(i, a, n, r);
|
|
1814
|
-
}
|
|
1815
1811
|
function an(e, t, n, r) {
|
|
1816
|
-
let i =
|
|
1812
|
+
let i = Fe(_(e)), a = t.useAscii ? tn : en;
|
|
1813
|
+
return i.horizontal ? sn(i, a, n, r) : on(i, a, n, r);
|
|
1814
|
+
}
|
|
1815
|
+
function on(e, t, n, r) {
|
|
1816
|
+
let i = vn(e);
|
|
1817
1817
|
if (i === 0) return "";
|
|
1818
1818
|
let a = e.yAxis.range;
|
|
1819
1819
|
if (!a)
|
|
1820
1820
|
/* v8 ignore next */
|
|
1821
1821
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
1822
|
-
let o =
|
|
1822
|
+
let o = bn(a.min, a.max), s = o.map((e) => xn(e)), c = Math.max(...s.map((e) => e.length)) + 1, l = Math.max(Qt, i * 6), u = $t, d = Math.floor(l / i), f = yn(e, i), p = !!e.title, m = !!e.xAxis.title, h = !!e.yAxis.title, g = e.series.length > 1, _ = p ? 0 : -1, v = (p ? 2 : 0) + +!!g, y = h ? 2 : 0, b = y + c + 1, x = b + d * i + 2, S = v + u, C = S + 1, w = m ? C + 1 : -1, T = C + 1 + +!!m + 0, E = dn(x, T), D = fn(x, T), O = pn(x, T), ee = nn(e.series.length, r), k = (e) => {
|
|
1823
1823
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
1824
1824
|
return Math.round(t * 19);
|
|
1825
1825
|
}, A = (e) => b + Math.floor(d * (e + .5));
|
|
1826
|
-
e.title && _ >= 0 &&
|
|
1827
|
-
for (let e = 0; e < u; e++)
|
|
1828
|
-
|
|
1826
|
+
e.title && _ >= 0 && hn(E, D, _, Math.floor(x / 2 - e.title.length / 2), e.title, "text"), g && un(E, D, O, e, +!!p, x, t, ee);
|
|
1827
|
+
for (let e = 0; e < u; e++) W(E, D, v + (19 - e), b - 1, t.vLine, "border");
|
|
1828
|
+
W(E, D, S, b - 1, t.origin, "border");
|
|
1829
1829
|
for (let e of o) {
|
|
1830
1830
|
let n = k(e);
|
|
1831
1831
|
if (n < 0 || n >= u) continue;
|
|
1832
|
-
let r = v + (19 - n), i =
|
|
1833
|
-
|
|
1832
|
+
let r = v + (19 - n), i = xn(e);
|
|
1833
|
+
W(E, D, r, b - 1, n === 0 ? t.origin : t.yTick, "border");
|
|
1834
1834
|
let a = y + c - i.length;
|
|
1835
|
-
|
|
1835
|
+
hn(E, D, r, Math.max(0, a), i, "text");
|
|
1836
1836
|
}
|
|
1837
|
-
for (let e = b; e < b + d * i; e++)
|
|
1837
|
+
for (let e = b; e < b + d * i; e++) W(E, D, S, e, t.hLine, "border");
|
|
1838
1838
|
for (let e = 0; e < i; e++) {
|
|
1839
1839
|
let n = A(e);
|
|
1840
|
-
|
|
1840
|
+
W(E, D, S, n, t.xTick, "border");
|
|
1841
1841
|
let r = f[e], i = n - Math.floor(r.length / 2);
|
|
1842
|
-
|
|
1842
|
+
hn(E, D, C, Math.max(0, i), r, "text");
|
|
1843
1843
|
}
|
|
1844
1844
|
if (e.xAxis.title && w >= 0) {
|
|
1845
1845
|
let t = e.xAxis.title;
|
|
1846
|
-
|
|
1846
|
+
hn(E, D, w, Math.floor(x / 2 - t.length / 2), t, "text");
|
|
1847
1847
|
}
|
|
1848
1848
|
if (e.yAxis.title) {
|
|
1849
1849
|
let t = e.yAxis.title, n = v + Math.max(0, Math.floor((u - t.length) / 2));
|
|
1850
1850
|
for (let e = 0; e < t.length; e++) {
|
|
1851
1851
|
let r = n + e;
|
|
1852
1852
|
if (r >= v + u) break;
|
|
1853
|
-
|
|
1853
|
+
W(E, D, r, 0, t[e], "text");
|
|
1854
1854
|
}
|
|
1855
1855
|
}
|
|
1856
1856
|
for (let e of o) {
|
|
1857
1857
|
let n = k(e);
|
|
1858
1858
|
if (n < 0 || n >= u) continue;
|
|
1859
1859
|
let r = v + (19 - n);
|
|
1860
|
-
for (let e = b; e < b + d * i; e++)
|
|
1860
|
+
for (let e = b; e < b + d * i; e++) mn(E, r, e) === " " && W(E, D, r, e, t.grid, "line");
|
|
1861
1861
|
}
|
|
1862
1862
|
let te = [];
|
|
1863
1863
|
for (let t = 0; t < e.series.length; t++) e.series[t].type === "bar" && te.push({
|
|
@@ -1872,7 +1872,7 @@ function an(e, t, n, r) {
|
|
|
1872
1872
|
let o = A(e) - Math.floor(n / 2), s = k(i.data[e]), c = Math.min(r, s), l = Math.max(r, s);
|
|
1873
1873
|
for (let e = c; e <= l; e++) {
|
|
1874
1874
|
let r = v + (19 - e);
|
|
1875
|
-
for (let e = o; e < o + n; e++)
|
|
1875
|
+
for (let e = o; e < o + n; e++) W(E, D, r, e, t.bar, "arrow", O, a);
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
1878
|
}
|
|
@@ -1885,43 +1885,43 @@ function an(e, t, n, r) {
|
|
|
1885
1885
|
for (let e of j) {
|
|
1886
1886
|
if (e.data.length === 0) continue;
|
|
1887
1887
|
let n = ee[e.globalIdx];
|
|
1888
|
-
|
|
1888
|
+
cn(E, D, e.data, A, k, v, u, b, d * i, t, O, n);
|
|
1889
1889
|
}
|
|
1890
|
-
return
|
|
1890
|
+
return gn(E, D, O, n, r);
|
|
1891
1891
|
}
|
|
1892
|
-
function
|
|
1893
|
-
let i =
|
|
1892
|
+
function sn(e, t, n, r) {
|
|
1893
|
+
let i = vn(e);
|
|
1894
1894
|
if (i === 0) return "";
|
|
1895
1895
|
let a = e.yAxis.range;
|
|
1896
1896
|
if (!a)
|
|
1897
1897
|
/* v8 ignore next */
|
|
1898
1898
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
1899
|
-
let o =
|
|
1899
|
+
let o = bn(a.min, a.max), s = yn(e, i), c = Math.max(...s.map((e) => e.length)) + 1, l = Math.max(Qt, 40), u = Math.max(2, Math.floor($t / i)), d = u * i, f = !!e.title, p = !!e.yAxis.title, m = e.series.length > 1, h = (f ? 2 : 0) + +!!m, g = c + 1, _ = g + l + 2, v = h + d + 2 + +!!p, y = h + d, b = dn(_, v), x = fn(_, v), S = pn(_, v), C = nn(e.series.length, r), w = (e) => {
|
|
1900
1900
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
1901
1901
|
return g + Math.round(t * 59);
|
|
1902
1902
|
}, T = (e) => h + Math.floor(u * (e + .5));
|
|
1903
|
-
e.title &&
|
|
1904
|
-
for (let e = h; e < h + d; e++)
|
|
1905
|
-
|
|
1903
|
+
e.title && hn(b, x, 0, Math.floor(_ / 2 - e.title.length / 2), e.title, "text"), m && un(b, x, S, e, +!!f, _, t, C);
|
|
1904
|
+
for (let e = h; e < h + d; e++) W(b, x, e, g - 1, t.vLine, "border");
|
|
1905
|
+
W(b, x, y, g - 1, t.origin, "border");
|
|
1906
1906
|
for (let e = 0; e < i; e++) {
|
|
1907
1907
|
let t = T(e), n = s[e], r = c - n.length;
|
|
1908
|
-
|
|
1908
|
+
hn(b, x, t, Math.max(0, r), n, "text");
|
|
1909
1909
|
}
|
|
1910
|
-
for (let e = g; e < g + l; e++)
|
|
1910
|
+
for (let e = g; e < g + l; e++) W(b, x, y, e, t.hLine, "border");
|
|
1911
1911
|
for (let e of o) {
|
|
1912
1912
|
let n = w(e);
|
|
1913
1913
|
if (n < g || n >= g + l) continue;
|
|
1914
|
-
|
|
1915
|
-
let r =
|
|
1916
|
-
|
|
1914
|
+
W(b, x, y, n, t.xTick, "border");
|
|
1915
|
+
let r = xn(e);
|
|
1916
|
+
hn(b, x, y + 1, n - Math.floor(r.length / 2), r, "text");
|
|
1917
1917
|
}
|
|
1918
1918
|
if (e.yAxis.title) {
|
|
1919
1919
|
let t = e.yAxis.title;
|
|
1920
|
-
|
|
1920
|
+
hn(b, x, v - 1, Math.floor(_ / 2 - t.length / 2), t, "text");
|
|
1921
1921
|
}
|
|
1922
1922
|
for (let e of o) {
|
|
1923
1923
|
let n = w(e);
|
|
1924
|
-
if (!(n < g || n >= g + l)) for (let e = h; e < h + d; e++)
|
|
1924
|
+
if (!(n < g || n >= g + l)) for (let e = h; e < h + d; e++) mn(b, e, n) === " " && W(b, x, e, n, t.grid, "line");
|
|
1925
1925
|
}
|
|
1926
1926
|
let E = [];
|
|
1927
1927
|
for (let t = 0; t < e.series.length; t++) e.series[t].type === "bar" && E.push({
|
|
@@ -1934,7 +1934,7 @@ function on(e, t, n, r) {
|
|
|
1934
1934
|
let r = E[n], i = C[r.globalIdx];
|
|
1935
1935
|
for (let n = 0; n < r.data.length; n++) {
|
|
1936
1936
|
let a = T(n), o = w(r.data[n]), s = Math.min(e, o), c = Math.max(e, o);
|
|
1937
|
-
for (let e = a; e < a + 1; e++) for (let n = s; n <= c; n++)
|
|
1937
|
+
for (let e = a; e < a + 1; e++) for (let n = s; n <= c; n++) W(b, x, e, n, t.bar, "arrow", S, i);
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
@@ -1946,18 +1946,18 @@ function on(e, t, n, r) {
|
|
|
1946
1946
|
for (let e of D) {
|
|
1947
1947
|
if (e.data.length === 0) continue;
|
|
1948
1948
|
let n = C[e.globalIdx];
|
|
1949
|
-
|
|
1949
|
+
ln(b, x, e.data, T, w, h, d, g, l, t, S, n);
|
|
1950
1950
|
}
|
|
1951
|
-
return
|
|
1951
|
+
return gn(b, x, S, n, r);
|
|
1952
1952
|
}
|
|
1953
|
-
function
|
|
1953
|
+
function cn(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1954
1954
|
if (n.length === 0) return;
|
|
1955
1955
|
let f = n.map((e, t) => ({
|
|
1956
1956
|
col: r(t),
|
|
1957
1957
|
row: i(e)
|
|
1958
1958
|
})), p = (n, r, i) => {
|
|
1959
1959
|
let l = a + (o - 1 - r);
|
|
1960
|
-
l >= 0 && n >= s && n < s + c &&
|
|
1960
|
+
l >= 0 && n >= s && n < s + c && W(e, t, l, n, i, "arrow", u, d);
|
|
1961
1961
|
};
|
|
1962
1962
|
if (f.length === 1) {
|
|
1963
1963
|
p(f[0].col, f[0].row, l.hLine);
|
|
@@ -1986,13 +1986,13 @@ function sn(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
}
|
|
1988
1988
|
}
|
|
1989
|
-
function
|
|
1989
|
+
function ln(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1990
1990
|
if (n.length === 0) return;
|
|
1991
1991
|
let f = n.map((e, t) => ({
|
|
1992
1992
|
row: r(t),
|
|
1993
1993
|
col: i(e)
|
|
1994
1994
|
})), p = (n, r, i) => {
|
|
1995
|
-
n >= a && n < a + o && r >= s && r < s + c &&
|
|
1995
|
+
n >= a && n < a + o && r >= s && r < s + c && W(e, t, n, r, i, "arrow", u, d);
|
|
1996
1996
|
};
|
|
1997
1997
|
if (f.length === 1) {
|
|
1998
1998
|
p(f[0].row, f[0].col, l.vLine);
|
|
@@ -2013,7 +2013,7 @@ function cn(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
2013
2013
|
for (let e = r + 1; e <= n.row; e++) p(e, n.col, l.vLine);
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
|
-
function
|
|
2016
|
+
function un(e, t, n, r, i, a, o, s) {
|
|
2017
2017
|
let c = [], l = 0, u = 0;
|
|
2018
2018
|
for (let e = 0; e < r.series.length; e++) r.series[e].type === "bar" ? (c.push({
|
|
2019
2019
|
symbol: o.bar,
|
|
@@ -2030,31 +2030,31 @@ function ln(e, t, n, r, i, a, o, s) {
|
|
|
2030
2030
|
for (let r = 0; r < c.length; r++) {
|
|
2031
2031
|
r > 0 && (f += 2);
|
|
2032
2032
|
let a = c[r];
|
|
2033
|
-
|
|
2033
|
+
W(e, t, i, f, a.symbol, "arrow", n, s[a.globalIdx]), f += 1, f += 1, hn(e, t, i, f, a.label, "text"), f += a.label.length;
|
|
2034
2034
|
}
|
|
2035
2035
|
}
|
|
2036
|
-
function un(e, t) {
|
|
2037
|
-
return H(e - 1, t - 1);
|
|
2038
|
-
}
|
|
2039
2036
|
function dn(e, t) {
|
|
2040
|
-
return
|
|
2037
|
+
return V(e - 1, t - 1);
|
|
2041
2038
|
}
|
|
2042
2039
|
function fn(e, t) {
|
|
2040
|
+
return Pt(e - 1, t - 1);
|
|
2041
|
+
}
|
|
2042
|
+
function pn(e, t) {
|
|
2043
2043
|
return Array.from({ length: e }, () => Array.from({ length: t }).fill(null));
|
|
2044
2044
|
}
|
|
2045
|
-
function
|
|
2046
|
-
r >= 0 && r < e.length && n >= 0 && n < (e[0]?.length ?? 0) && (
|
|
2045
|
+
function W(e, t, n, r, i, a, o, s) {
|
|
2046
|
+
r >= 0 && r < e.length && n >= 0 && n < (e[0]?.length ?? 0) && (U(e, r, n, i, {
|
|
2047
2047
|
role: a,
|
|
2048
2048
|
roleCanvas: t
|
|
2049
2049
|
}), o && s && (o[r][n] = s));
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function mn(e, t, n) {
|
|
2052
2052
|
return n >= 0 && n < e.length && t >= 0 && t < e[0].length ? e[n][t] : " ";
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2055
|
-
for (let o = 0; o < i.length; o++)
|
|
2054
|
+
function hn(e, t, n, r, i, a) {
|
|
2055
|
+
for (let o = 0; o < i.length; o++) W(e, t, n, r + o, i[o], a);
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function gn(e, t, n, r, i) {
|
|
2058
2058
|
if (e.length === 0) return "";
|
|
2059
2059
|
let a = e[0].length, o = e.length, s = [];
|
|
2060
2060
|
for (let c = 0; c < a; c++) {
|
|
@@ -2062,39 +2062,39 @@ function hn(e, t, n, r, i) {
|
|
|
2062
2062
|
for (let r = 0; r < o; r++) a.push(e[r][c]), l.push(t[r][c]), u.push(n[r][c]);
|
|
2063
2063
|
let d = a.length - 1;
|
|
2064
2064
|
for (; d >= 0 && a[d] === " ";) d--;
|
|
2065
|
-
d < 0 ? s.push("") : s.push(
|
|
2065
|
+
d < 0 ? s.push("") : s.push(_n(a.slice(0, d + 1), l.slice(0, d + 1), u.slice(0, d + 1), i, r));
|
|
2066
2066
|
}
|
|
2067
2067
|
for (; s.length > 0 && s[s.length - 1] === "";) s.pop();
|
|
2068
2068
|
return s.join("\n");
|
|
2069
2069
|
}
|
|
2070
|
-
function
|
|
2070
|
+
function _n(e, t, n, r, i) {
|
|
2071
2071
|
if (i === "none") return e.join("");
|
|
2072
2072
|
let a = "", o = null, s = "";
|
|
2073
2073
|
for (let c = 0; c < e.length; c++) {
|
|
2074
2074
|
let l = e[c];
|
|
2075
2075
|
if (l === " ") {
|
|
2076
|
-
s.length > 0 && (a += o ?
|
|
2076
|
+
s.length > 0 && (a += o ? Et(s, o, i) : s, s = "", o = null), a += " ";
|
|
2077
2077
|
continue;
|
|
2078
2078
|
}
|
|
2079
|
-
let u = n[c] ?? null, d = t[c] ?? null, f = u ?? (d ?
|
|
2080
|
-
f === o ? s += l : (s.length > 0 && (a += o ?
|
|
2079
|
+
let u = n[c] ?? null, d = t[c] ?? null, f = u ?? (d ? rn(d, r) : null);
|
|
2080
|
+
f === o ? s += l : (s.length > 0 && (a += o ? Et(s, o, i) : s), s = l, o = f);
|
|
2081
2081
|
}
|
|
2082
|
-
return s.length > 0 && (a += o ?
|
|
2082
|
+
return s.length > 0 && (a += o ? Et(s, o, i) : s), a;
|
|
2083
2083
|
}
|
|
2084
|
-
function
|
|
2084
|
+
function vn(e) {
|
|
2085
2085
|
if (e.xAxis.categories) return e.xAxis.categories.length;
|
|
2086
2086
|
for (let t of e.series) if (t.data.length > 0) return t.data.length;
|
|
2087
2087
|
return 0;
|
|
2088
2088
|
}
|
|
2089
|
-
function
|
|
2089
|
+
function yn(e, t) {
|
|
2090
2090
|
if (e.xAxis.categories) return e.xAxis.categories;
|
|
2091
2091
|
if (e.xAxis.range) {
|
|
2092
2092
|
let { min: n, max: r } = e.xAxis.range, i = t > 1 ? (r - n) / (t - 1) : 0;
|
|
2093
|
-
return Array.from({ length: t }, (e, t) =>
|
|
2093
|
+
return Array.from({ length: t }, (e, t) => xn(n + i * t));
|
|
2094
2094
|
}
|
|
2095
2095
|
return Array.from({ length: t }, (e, t) => String(t + 1));
|
|
2096
2096
|
}
|
|
2097
|
-
function
|
|
2097
|
+
function bn(e, t) {
|
|
2098
2098
|
let n = t - e;
|
|
2099
2099
|
if (n <= 0) return [e];
|
|
2100
2100
|
let r = n / 6, i = 10 ** Math.floor(Math.log10(r)), a = r / i, o;
|
|
@@ -2103,78 +2103,78 @@ function yn(e, t) {
|
|
|
2103
2103
|
for (let e = s; e <= t + o * .001; e += o) c.push(Math.round(e * 1e10) / 1e10);
|
|
2104
2104
|
return c;
|
|
2105
2105
|
}
|
|
2106
|
-
function
|
|
2106
|
+
function xn(e) {
|
|
2107
2107
|
return Number.isInteger(e) ? String(e) : e.toFixed(+(Math.abs(e) < 10));
|
|
2108
2108
|
}
|
|
2109
2109
|
//#endregion
|
|
2110
2110
|
//#region packages/ascii-renderer/src/types.ts
|
|
2111
|
-
var
|
|
2111
|
+
var G = {
|
|
2112
2112
|
x: 1,
|
|
2113
2113
|
y: 0
|
|
2114
|
-
},
|
|
2114
|
+
}, K = {
|
|
2115
2115
|
x: 1,
|
|
2116
2116
|
y: 2
|
|
2117
|
-
},
|
|
2117
|
+
}, q = {
|
|
2118
2118
|
x: 0,
|
|
2119
2119
|
y: 1
|
|
2120
|
-
},
|
|
2120
|
+
}, J = {
|
|
2121
2121
|
x: 2,
|
|
2122
2122
|
y: 1
|
|
2123
|
-
},
|
|
2123
|
+
}, Sn = {
|
|
2124
2124
|
x: 2,
|
|
2125
2125
|
y: 0
|
|
2126
|
-
},
|
|
2126
|
+
}, Cn = {
|
|
2127
2127
|
x: 0,
|
|
2128
2128
|
y: 0
|
|
2129
|
-
},
|
|
2129
|
+
}, wn = {
|
|
2130
2130
|
x: 2,
|
|
2131
2131
|
y: 2
|
|
2132
|
-
},
|
|
2132
|
+
}, Tn = {
|
|
2133
2133
|
x: 0,
|
|
2134
2134
|
y: 2
|
|
2135
|
-
},
|
|
2135
|
+
}, En = {
|
|
2136
2136
|
x: 1,
|
|
2137
2137
|
y: 1
|
|
2138
2138
|
};
|
|
2139
|
-
function
|
|
2139
|
+
function Y(e, t) {
|
|
2140
2140
|
return e.x === t.x && e.y === t.y;
|
|
2141
2141
|
}
|
|
2142
|
-
function En(e) {
|
|
2143
|
-
return X(e, K) || X(e, q) || X(e, J) || X(e, Y);
|
|
2144
|
-
}
|
|
2145
2142
|
function Dn(e) {
|
|
2146
|
-
|
|
2143
|
+
return Y(e, G) || Y(e, K) || Y(e, q) || Y(e, J);
|
|
2144
|
+
}
|
|
2145
|
+
function On(e) {
|
|
2146
|
+
if (!Dn(e)) throw Error(`Expected a cardinal direction (Up/Down/Left/Right); got {x:${e.x}, y:${e.y}}`);
|
|
2147
2147
|
return e;
|
|
2148
2148
|
}
|
|
2149
|
-
function
|
|
2149
|
+
function kn(e, t, n, r) {
|
|
2150
2150
|
return Math.max(r, n + (e - t));
|
|
2151
2151
|
}
|
|
2152
|
-
function kn(e, t) {
|
|
2153
|
-
return e.x === t.x && e.y === t.y;
|
|
2154
|
-
}
|
|
2155
2152
|
function An(e, t) {
|
|
2156
2153
|
return e.x === t.x && e.y === t.y;
|
|
2157
2154
|
}
|
|
2158
2155
|
function jn(e, t) {
|
|
2156
|
+
return e.x === t.x && e.y === t.y;
|
|
2157
|
+
}
|
|
2158
|
+
function Mn(e, t) {
|
|
2159
2159
|
return {
|
|
2160
2160
|
x: e.x + t.x,
|
|
2161
2161
|
y: e.y + t.y
|
|
2162
2162
|
};
|
|
2163
2163
|
}
|
|
2164
|
-
function
|
|
2164
|
+
function Nn(e) {
|
|
2165
2165
|
return `${e.x},${e.y}`;
|
|
2166
2166
|
}
|
|
2167
|
-
function
|
|
2167
|
+
function X(e) {
|
|
2168
2168
|
let t = e.gridCoord;
|
|
2169
2169
|
if (t === null)
|
|
2170
2170
|
/* v8 ignore next */
|
|
2171
2171
|
throw Error(`Node "${e.name}" has no gridCoord; grid layout must run before it is read`);
|
|
2172
2172
|
return t;
|
|
2173
2173
|
}
|
|
2174
|
-
var
|
|
2174
|
+
var Pn = {
|
|
2175
2175
|
name: "",
|
|
2176
2176
|
styles: {}
|
|
2177
|
-
},
|
|
2177
|
+
}, Fn = class {
|
|
2178
2178
|
#e = /* @__PURE__ */ new Set();
|
|
2179
2179
|
has(e) {
|
|
2180
2180
|
return this.#e.has(e);
|
|
@@ -2189,45 +2189,45 @@ var Nn = {
|
|
|
2189
2189
|
return this.#e.keys();
|
|
2190
2190
|
}
|
|
2191
2191
|
};
|
|
2192
|
-
function
|
|
2193
|
-
return new
|
|
2192
|
+
function In() {
|
|
2193
|
+
return new Fn();
|
|
2194
2194
|
}
|
|
2195
|
-
function
|
|
2196
|
-
let t =
|
|
2195
|
+
function Ln(e) {
|
|
2196
|
+
let t = In();
|
|
2197
2197
|
for (let n of e.keys()) t.add(n);
|
|
2198
2198
|
return t;
|
|
2199
2199
|
}
|
|
2200
|
-
function Ln(e, t) {
|
|
2201
|
-
return e.has(Mn(t));
|
|
2202
|
-
}
|
|
2203
2200
|
function Rn(e, t) {
|
|
2204
|
-
return
|
|
2201
|
+
return e.has(Nn(t));
|
|
2205
2202
|
}
|
|
2206
|
-
function zn(e, t
|
|
2207
|
-
|
|
2203
|
+
function zn(e, t) {
|
|
2204
|
+
return t.x < 0 || t.y < 0 ? !1 : !Rn(e, t);
|
|
2205
|
+
}
|
|
2206
|
+
function Bn(e, t, n = 3) {
|
|
2207
|
+
for (let r = 0; r < n; r++) for (let i = 0; i < n; i++) if (Rn(e, {
|
|
2208
2208
|
x: t.x + r,
|
|
2209
2209
|
y: t.y + i
|
|
2210
2210
|
})) return !1;
|
|
2211
2211
|
return !0;
|
|
2212
2212
|
}
|
|
2213
|
-
function
|
|
2214
|
-
if (!
|
|
2213
|
+
function Vn(e, t, n = 3) {
|
|
2214
|
+
if (!Bn(e, t, n)) throw Error(`Grid block at (${t.x},${t.y}) is already occupied`);
|
|
2215
2215
|
for (let r = 0; r < n; r++) for (let i = 0; i < n; i++) {
|
|
2216
2216
|
let n = {
|
|
2217
2217
|
x: t.x + r,
|
|
2218
2218
|
y: t.y + i
|
|
2219
2219
|
};
|
|
2220
|
-
e.add(
|
|
2220
|
+
e.add(Nn(n));
|
|
2221
2221
|
}
|
|
2222
2222
|
}
|
|
2223
|
-
var
|
|
2224
|
-
function
|
|
2223
|
+
var Hn = 1e5;
|
|
2224
|
+
function Un(e) {
|
|
2225
2225
|
if (e.length === 0) return [];
|
|
2226
2226
|
let t = [e[0]];
|
|
2227
2227
|
for (let n = 1; n < e.length; n++) {
|
|
2228
2228
|
let r = e[n - 1], i = e[n], a = r.x, o = r.y, s = Math.abs(i.x - r.x), c = Math.abs(i.y - r.y), l = r.x < i.x ? 1 : -1, u = r.y < i.y ? 1 : -1, d = s - c, f = 0;
|
|
2229
2229
|
for (; a !== i.x || o !== i.y;) {
|
|
2230
|
-
if (f >=
|
|
2230
|
+
if (f >= Hn) throw Error(`pathCells: segment from (${r.x},${r.y}) to (${i.x},${i.y}) did not reach its endpoint within ${Hn} steps`);
|
|
2231
2231
|
let e = 2 * d;
|
|
2232
2232
|
e > -c && (d -= c, a += l), e < s && (d += s, o += u), t.push({
|
|
2233
2233
|
x: a,
|
|
@@ -2239,7 +2239,7 @@ function Hn(e) {
|
|
|
2239
2239
|
}
|
|
2240
2240
|
//#endregion
|
|
2241
2241
|
//#region packages/ascii-renderer/src/pathfinder.ts
|
|
2242
|
-
var
|
|
2242
|
+
var Wn = class {
|
|
2243
2243
|
items = [];
|
|
2244
2244
|
get length() {
|
|
2245
2245
|
return this.items.length;
|
|
@@ -2269,11 +2269,11 @@ var Un = class {
|
|
|
2269
2269
|
}
|
|
2270
2270
|
}
|
|
2271
2271
|
};
|
|
2272
|
-
function
|
|
2272
|
+
function Gn(e, t) {
|
|
2273
2273
|
let n = Math.abs(e.x - t.x), r = Math.abs(e.y - t.y);
|
|
2274
2274
|
return n === 0 || r === 0 ? n + r : n + r + 1;
|
|
2275
2275
|
}
|
|
2276
|
-
var
|
|
2276
|
+
var Kn = [
|
|
2277
2277
|
{
|
|
2278
2278
|
x: 1,
|
|
2279
2279
|
y: 0
|
|
@@ -2290,48 +2290,48 @@ var Gn = [
|
|
|
2290
2290
|
x: 0,
|
|
2291
2291
|
y: -1
|
|
2292
2292
|
}
|
|
2293
|
-
],
|
|
2294
|
-
function
|
|
2293
|
+
], qn = 5e4, Jn = 2e5;
|
|
2294
|
+
function Yn(e = Jn) {
|
|
2295
2295
|
return { remaining: e };
|
|
2296
2296
|
}
|
|
2297
|
-
function
|
|
2297
|
+
function Xn(e, t, n, r) {
|
|
2298
2298
|
if (r && r.remaining <= 0) return null;
|
|
2299
|
-
let i = new
|
|
2299
|
+
let i = new Wn();
|
|
2300
2300
|
i.push({
|
|
2301
2301
|
coord: t,
|
|
2302
2302
|
priority: 0
|
|
2303
2303
|
});
|
|
2304
2304
|
let a = /* @__PURE__ */ new Map();
|
|
2305
|
-
a.set(
|
|
2305
|
+
a.set(Nn(t), 0);
|
|
2306
2306
|
let o = /* @__PURE__ */ new Map();
|
|
2307
|
-
o.set(
|
|
2307
|
+
o.set(Nn(t), null);
|
|
2308
2308
|
let s = 0;
|
|
2309
2309
|
for (; i.length > 0;) {
|
|
2310
|
-
if (++s >
|
|
2310
|
+
if (++s > qn) return null;
|
|
2311
2311
|
if (r) {
|
|
2312
2312
|
if (r.remaining <= 0) return null;
|
|
2313
2313
|
r.remaining--;
|
|
2314
2314
|
}
|
|
2315
2315
|
let t = i.pop().coord;
|
|
2316
|
-
if (
|
|
2316
|
+
if (An(t, n)) {
|
|
2317
2317
|
let e = [], n = t;
|
|
2318
|
-
for (; n !== null;) e.unshift(n), n = o.get(
|
|
2318
|
+
for (; n !== null;) e.unshift(n), n = o.get(Nn(n)) ?? null;
|
|
2319
2319
|
return e;
|
|
2320
2320
|
}
|
|
2321
|
-
let c = a.get(
|
|
2321
|
+
let c = a.get(Nn(t));
|
|
2322
2322
|
if (c === void 0)
|
|
2323
2323
|
/* v8 ignore next */
|
|
2324
|
-
throw Error(`A* pathfinding: missing cost for visited cell ${
|
|
2325
|
-
for (let r of
|
|
2324
|
+
throw Error(`A* pathfinding: missing cost for visited cell ${Nn(t)}`);
|
|
2325
|
+
for (let r of Kn) {
|
|
2326
2326
|
let s = {
|
|
2327
2327
|
x: t.x + r.x,
|
|
2328
2328
|
y: t.y + r.y
|
|
2329
2329
|
};
|
|
2330
|
-
if (!
|
|
2331
|
-
let l = c + 1, u =
|
|
2330
|
+
if (!zn(e, s) && !An(s, n)) continue;
|
|
2331
|
+
let l = c + 1, u = Nn(s), d = a.get(u);
|
|
2332
2332
|
if (d === void 0 || l < d) {
|
|
2333
2333
|
a.set(u, l);
|
|
2334
|
-
let e = l +
|
|
2334
|
+
let e = l + Gn(s, n);
|
|
2335
2335
|
i.push({
|
|
2336
2336
|
coord: s,
|
|
2337
2337
|
priority: e
|
|
@@ -2341,7 +2341,7 @@ function Yn(e, t, n, r) {
|
|
|
2341
2341
|
}
|
|
2342
2342
|
return null;
|
|
2343
2343
|
}
|
|
2344
|
-
function
|
|
2344
|
+
function Zn(e) {
|
|
2345
2345
|
if (e.length <= 2) return e;
|
|
2346
2346
|
let t = /* @__PURE__ */ new Set(), n = e[0], r = e[1];
|
|
2347
2347
|
for (let i = 2; i < e.length; i++) {
|
|
@@ -2350,7 +2350,7 @@ function Xn(e) {
|
|
|
2350
2350
|
}
|
|
2351
2351
|
return e.filter((e, n) => !t.has(n));
|
|
2352
2352
|
}
|
|
2353
|
-
function
|
|
2353
|
+
function Qn(e, t, n, r) {
|
|
2354
2354
|
if (t.x === n.x && t.y === n.y) return !0;
|
|
2355
2355
|
let i = t.x === n.x;
|
|
2356
2356
|
if (!i && t.y !== n.y) return !1;
|
|
@@ -2363,12 +2363,12 @@ function Zn(e, t, n, r) {
|
|
|
2363
2363
|
x: o,
|
|
2364
2364
|
y: t.y
|
|
2365
2365
|
};
|
|
2366
|
-
if (!(n && !r) && !
|
|
2366
|
+
if (!(n && !r) && !zn(e, a)) return !1;
|
|
2367
2367
|
if (n) break;
|
|
2368
2368
|
}
|
|
2369
2369
|
return !0;
|
|
2370
2370
|
}
|
|
2371
|
-
function
|
|
2371
|
+
function $n(e, t, n, r) {
|
|
2372
2372
|
let i = r ? {
|
|
2373
2373
|
x: n.x,
|
|
2374
2374
|
y: t.y
|
|
@@ -2376,25 +2376,25 @@ function Qn(e, t, n, r) {
|
|
|
2376
2376
|
x: t.x,
|
|
2377
2377
|
y: n.y
|
|
2378
2378
|
};
|
|
2379
|
-
return !
|
|
2379
|
+
return !Qn(e, t, i, !0) || !Qn(e, i, n, !1) ? null : [
|
|
2380
2380
|
t,
|
|
2381
2381
|
i,
|
|
2382
2382
|
n
|
|
2383
2383
|
];
|
|
2384
2384
|
}
|
|
2385
|
-
function
|
|
2385
|
+
function er(e, t, n, r) {
|
|
2386
2386
|
if (t.x === n.x || t.y === n.y) return null;
|
|
2387
|
-
let i =
|
|
2388
|
-
return
|
|
2387
|
+
let i = Y(r, q) || Y(r, J);
|
|
2388
|
+
return $n(e.grid, t, n, i) ?? $n(e.grid, t, n, !i);
|
|
2389
2389
|
}
|
|
2390
|
-
function
|
|
2390
|
+
function tr(e, t, n, r) {
|
|
2391
2391
|
if (!e.pathBudget) throw Error("routeEdge requires graph.pathBudget to be set; call createPathBudget() (see grid.ts createMapping) before routing edges");
|
|
2392
|
-
let i =
|
|
2393
|
-
return i ?
|
|
2392
|
+
let i = er(e, t, n, r) ?? Xn(e.grid, t, n, e.pathBudget);
|
|
2393
|
+
return i ? Zn(i) : null;
|
|
2394
2394
|
}
|
|
2395
2395
|
//#endregion
|
|
2396
2396
|
//#region packages/ascii-renderer/src/edge-bundling.ts
|
|
2397
|
-
function
|
|
2397
|
+
function nr(e) {
|
|
2398
2398
|
if (e.config.graphDirection !== "TD") return [];
|
|
2399
2399
|
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Map();
|
|
2400
2400
|
for (let t of e.edges) {
|
|
@@ -2403,7 +2403,7 @@ function tr(e) {
|
|
|
2403
2403
|
e.push(t), r.set(t.to, e);
|
|
2404
2404
|
}
|
|
2405
2405
|
for (let [i, a] of r) {
|
|
2406
|
-
if (a.length < 2 || !
|
|
2406
|
+
if (a.length < 2 || !rr(a, e) || a.some((e) => n.has(e))) continue;
|
|
2407
2407
|
let r = {
|
|
2408
2408
|
type: "fan-in",
|
|
2409
2409
|
edges: [...a],
|
|
@@ -2411,8 +2411,8 @@ function tr(e) {
|
|
|
2411
2411
|
otherNodes: a.map((e) => e.from),
|
|
2412
2412
|
junctionPoint: null,
|
|
2413
2413
|
sharedPath: [],
|
|
2414
|
-
junctionDir:
|
|
2415
|
-
sharedNodeDir:
|
|
2414
|
+
junctionDir: En,
|
|
2415
|
+
sharedNodeDir: En
|
|
2416
2416
|
};
|
|
2417
2417
|
for (let e of a) e.bundle = r, n.add(e);
|
|
2418
2418
|
t.push(r);
|
|
@@ -2424,7 +2424,7 @@ function tr(e) {
|
|
|
2424
2424
|
e.push(t), i.set(t.from, e);
|
|
2425
2425
|
}
|
|
2426
2426
|
for (let [r, a] of i) {
|
|
2427
|
-
if (a.length < 2 || !
|
|
2427
|
+
if (a.length < 2 || !rr(a, e)) continue;
|
|
2428
2428
|
let i = {
|
|
2429
2429
|
type: "fan-out",
|
|
2430
2430
|
edges: [...a],
|
|
@@ -2432,20 +2432,20 @@ function tr(e) {
|
|
|
2432
2432
|
otherNodes: a.map((e) => e.to),
|
|
2433
2433
|
junctionPoint: null,
|
|
2434
2434
|
sharedPath: [],
|
|
2435
|
-
junctionDir:
|
|
2436
|
-
sharedNodeDir:
|
|
2435
|
+
junctionDir: En,
|
|
2436
|
+
sharedNodeDir: En
|
|
2437
2437
|
};
|
|
2438
2438
|
for (let e of a) e.bundle = i, n.add(e);
|
|
2439
2439
|
t.push(i);
|
|
2440
2440
|
}
|
|
2441
2441
|
return t;
|
|
2442
2442
|
}
|
|
2443
|
-
function
|
|
2443
|
+
function rr(e, t) {
|
|
2444
2444
|
if (e.length < 2) return !1;
|
|
2445
|
-
let n = e[0].style, r =
|
|
2445
|
+
let n = e[0].style, r = Q(t, e[0].from), i = Q(t, e[0].to);
|
|
2446
2446
|
for (let a of e) {
|
|
2447
2447
|
if (a.style !== n || a.text.length > 0) return !1;
|
|
2448
|
-
let e =
|
|
2448
|
+
let e = Q(t, a.from), o = Q(t, a.to);
|
|
2449
2449
|
if (e !== r || o !== i || e !== o) return !1;
|
|
2450
2450
|
}
|
|
2451
2451
|
let a = e.every((t) => t.to === e[0].to), o = a ? e.map((e) => e.from) : e.map((e) => e.to);
|
|
@@ -2465,8 +2465,8 @@ function nr(e, t) {
|
|
|
2465
2465
|
}
|
|
2466
2466
|
return !0;
|
|
2467
2467
|
}
|
|
2468
|
-
function
|
|
2469
|
-
let n = e.config.graphDirection, r =
|
|
2468
|
+
function ir(e, t) {
|
|
2469
|
+
let n = e.config.graphDirection, r = X(t.sharedNode);
|
|
2470
2470
|
if (t.type === "fan-in") {
|
|
2471
2471
|
if (n === "TD") {
|
|
2472
2472
|
let e = r.y - 1;
|
|
@@ -2492,66 +2492,66 @@ function rr(e, t) {
|
|
|
2492
2492
|
y: r.y + 1
|
|
2493
2493
|
};
|
|
2494
2494
|
}
|
|
2495
|
-
function
|
|
2495
|
+
function ar(e, t) {
|
|
2496
2496
|
let n = e.config.graphDirection;
|
|
2497
|
-
t.junctionPoint =
|
|
2497
|
+
t.junctionPoint = ir(e, t);
|
|
2498
2498
|
let r = t.junctionPoint;
|
|
2499
2499
|
if (t.type === "fan-in") {
|
|
2500
|
-
t.junctionDir = n === "TD" ?
|
|
2501
|
-
let i =
|
|
2502
|
-
t.sharedPath =
|
|
2500
|
+
t.junctionDir = n === "TD" ? G : q, t.sharedNodeDir = n === "TD" ? K : J;
|
|
2501
|
+
let i = X(t.sharedNode), a = On(n === "TD" ? G : q), o = Mn(i, a);
|
|
2502
|
+
t.sharedPath = tr(e, r, o, a) ?? [r, o];
|
|
2503
2503
|
for (let i of t.edges) {
|
|
2504
|
-
let o =
|
|
2505
|
-
i.pathToJunction =
|
|
2504
|
+
let o = X(i.from), s = On(n === "TD" ? K : J), c = Mn(o, s);
|
|
2505
|
+
i.pathToJunction = tr(e, c, r, s) ?? [c, r], i.startDir = s, i.endDir = a, i.path = [...i.pathToJunction, ...t.sharedPath.slice(1)];
|
|
2506
2506
|
}
|
|
2507
2507
|
} else {
|
|
2508
|
-
t.junctionDir = n === "TD" ?
|
|
2509
|
-
let i =
|
|
2510
|
-
t.sharedPath =
|
|
2508
|
+
t.junctionDir = n === "TD" ? K : J, t.sharedNodeDir = n === "TD" ? G : q;
|
|
2509
|
+
let i = X(t.sharedNode), a = On(n === "TD" ? K : J), o = Mn(i, a);
|
|
2510
|
+
t.sharedPath = tr(e, o, r, a) ?? [o, r];
|
|
2511
2511
|
for (let i of t.edges) {
|
|
2512
|
-
let o =
|
|
2513
|
-
i.pathToJunction =
|
|
2512
|
+
let o = X(i.to), s = On(n === "TD" ? G : q), c = Mn(o, s);
|
|
2513
|
+
i.pathToJunction = tr(e, r, c, s) ?? [r, c], i.startDir = a, i.endDir = s, i.path = [...t.sharedPath, ...i.pathToJunction.slice(1)];
|
|
2514
2514
|
}
|
|
2515
2515
|
}
|
|
2516
2516
|
}
|
|
2517
|
-
function
|
|
2518
|
-
for (let t of e.bundles)
|
|
2517
|
+
function or(e) {
|
|
2518
|
+
for (let t of e.bundles) ar(e, t);
|
|
2519
2519
|
}
|
|
2520
2520
|
//#endregion
|
|
2521
2521
|
//#region packages/ascii-renderer/src/edge-cell-styles.ts
|
|
2522
|
-
function
|
|
2522
|
+
function sr() {
|
|
2523
2523
|
return /* @__PURE__ */ new Map();
|
|
2524
2524
|
}
|
|
2525
|
-
function
|
|
2526
|
-
for (let i of
|
|
2527
|
-
if (
|
|
2528
|
-
let n = t.get(
|
|
2525
|
+
function cr(e, t, n, r) {
|
|
2526
|
+
for (let i of Un(n)) {
|
|
2527
|
+
if (Rn(e, i)) continue;
|
|
2528
|
+
let n = t.get(Nn(i));
|
|
2529
2529
|
if (n !== void 0 && n !== r) return i;
|
|
2530
2530
|
}
|
|
2531
2531
|
return null;
|
|
2532
2532
|
}
|
|
2533
|
-
function
|
|
2534
|
-
for (let i of
|
|
2535
|
-
if (
|
|
2536
|
-
let n =
|
|
2533
|
+
function lr(e, t, n, r) {
|
|
2534
|
+
for (let i of Un(n)) {
|
|
2535
|
+
if (Rn(e, i)) continue;
|
|
2536
|
+
let n = Nn(i);
|
|
2537
2537
|
t.has(n) || t.set(n, r);
|
|
2538
2538
|
}
|
|
2539
2539
|
}
|
|
2540
2540
|
//#endregion
|
|
2541
2541
|
//#region packages/ascii-renderer/src/multiline-utils.ts
|
|
2542
|
-
function
|
|
2542
|
+
function Z(e) {
|
|
2543
2543
|
return e.split("\n");
|
|
2544
2544
|
}
|
|
2545
|
-
function lr(e) {
|
|
2546
|
-
let t = Q(e);
|
|
2547
|
-
return Math.max(...t.map((e) => V(e)), 0);
|
|
2548
|
-
}
|
|
2549
2545
|
function ur(e) {
|
|
2550
|
-
|
|
2546
|
+
let t = Z(e);
|
|
2547
|
+
return Math.max(...t.map((e) => B(e)), 0);
|
|
2548
|
+
}
|
|
2549
|
+
function dr(e) {
|
|
2550
|
+
return Z(e).length;
|
|
2551
2551
|
}
|
|
2552
2552
|
//#endregion
|
|
2553
2553
|
//#region packages/ascii-renderer/src/shapes/corners.ts
|
|
2554
|
-
var
|
|
2554
|
+
var fr = {
|
|
2555
2555
|
rectangle: {
|
|
2556
2556
|
unicode: {
|
|
2557
2557
|
tl: "┌",
|
|
@@ -3099,14 +3099,14 @@ var dr = {
|
|
|
3099
3099
|
}
|
|
3100
3100
|
}
|
|
3101
3101
|
};
|
|
3102
|
-
function
|
|
3103
|
-
let n =
|
|
3102
|
+
function pr(e, t) {
|
|
3103
|
+
let n = fr[e] ?? fr.rectangle;
|
|
3104
3104
|
return t ? n.ascii : n.unicode;
|
|
3105
3105
|
}
|
|
3106
3106
|
//#endregion
|
|
3107
3107
|
//#region packages/ascii-renderer/src/shapes/rectangle.ts
|
|
3108
|
-
function
|
|
3109
|
-
let n =
|
|
3108
|
+
function mr(e, t) {
|
|
3109
|
+
let n = Z(e), r = Math.max(...n.map((e) => B(e)), 0), i = n.length, a = 2 * t.padding + r, o = a + 2, s = i + 2 * t.padding, c = s % 2 == 0 ? s + 1 : s;
|
|
3110
3110
|
return {
|
|
3111
3111
|
width: o,
|
|
3112
3112
|
height: c + 2,
|
|
@@ -3128,8 +3128,8 @@ function pr(e, t) {
|
|
|
3128
3128
|
]
|
|
3129
3129
|
};
|
|
3130
3130
|
}
|
|
3131
|
-
function
|
|
3132
|
-
let { width: i, height: a } = t, o =
|
|
3131
|
+
function hr(e, t, n, r) {
|
|
3132
|
+
let { width: i, height: a } = t, o = V(i - 1, a - 1), s = {
|
|
3133
3133
|
x: 0,
|
|
3134
3134
|
y: 0
|
|
3135
3135
|
}, c = {
|
|
@@ -3139,9 +3139,9 @@ function mr(e, t, n, r) {
|
|
|
3139
3139
|
for (let e = s.x + 1; e < c.x; e++) o[e][s.y] = l, o[e][c.y] = l;
|
|
3140
3140
|
for (let e = s.y + 1; e < c.y; e++) o[s.x][e] = u, o[c.x][e] = u;
|
|
3141
3141
|
o[s.x][s.y] = n.tl, o[c.x][s.y] = n.tr, o[s.x][c.y] = n.bl, o[c.x][c.y] = n.br;
|
|
3142
|
-
let d =
|
|
3142
|
+
let d = Z(e), f = i - 1, p = a - 1, m = Math.floor(p / 2) - Math.floor((d.length - 1) / 2);
|
|
3143
3143
|
for (let e = 0; e < d.length; e++) {
|
|
3144
|
-
let t = d[e], n = Math.floor(f / 2) - Math.ceil(
|
|
3144
|
+
let t = d[e], n = Math.floor(f / 2) - Math.ceil(B(t) / 2) + 1, r = Nt(t);
|
|
3145
3145
|
for (let t = 0; t < r.length; t++) {
|
|
3146
3146
|
let i = n + t, a = m + e;
|
|
3147
3147
|
i >= 0 && i < o.length && a >= 0 && a < o[0].length && (o[i][a] = r[t]);
|
|
@@ -3149,30 +3149,30 @@ function mr(e, t, n, r) {
|
|
|
3149
3149
|
}
|
|
3150
3150
|
return o;
|
|
3151
3151
|
}
|
|
3152
|
-
function
|
|
3152
|
+
function gr(e, t, n) {
|
|
3153
3153
|
let { width: r, height: i } = t, a = n.x + Math.floor(r / 2), o = n.y + Math.floor(i / 2);
|
|
3154
|
-
return
|
|
3154
|
+
return Y(e, G) ? {
|
|
3155
3155
|
x: a,
|
|
3156
3156
|
y: n.y
|
|
3157
|
-
} :
|
|
3157
|
+
} : Y(e, K) ? {
|
|
3158
3158
|
x: a,
|
|
3159
3159
|
y: n.y + i - 1
|
|
3160
|
-
} :
|
|
3160
|
+
} : Y(e, q) ? {
|
|
3161
3161
|
x: n.x,
|
|
3162
3162
|
y: o
|
|
3163
|
-
} :
|
|
3163
|
+
} : Y(e, J) ? {
|
|
3164
3164
|
x: n.x + r - 1,
|
|
3165
3165
|
y: o
|
|
3166
|
-
} :
|
|
3166
|
+
} : Y(e, Cn) ? {
|
|
3167
3167
|
x: n.x,
|
|
3168
3168
|
y: n.y
|
|
3169
|
-
} :
|
|
3169
|
+
} : Y(e, Sn) ? {
|
|
3170
3170
|
x: n.x + r - 1,
|
|
3171
3171
|
y: n.y
|
|
3172
|
-
} :
|
|
3172
|
+
} : Y(e, Tn) ? {
|
|
3173
3173
|
x: n.x,
|
|
3174
3174
|
y: n.y + i - 1
|
|
3175
|
-
} :
|
|
3175
|
+
} : Y(e, wn) ? {
|
|
3176
3176
|
x: n.x + r - 1,
|
|
3177
3177
|
y: n.y + i - 1
|
|
3178
3178
|
} : {
|
|
@@ -3180,31 +3180,31 @@ function hr(e, t, n) {
|
|
|
3180
3180
|
y: o
|
|
3181
3181
|
};
|
|
3182
3182
|
}
|
|
3183
|
-
var
|
|
3184
|
-
getDimensions:
|
|
3183
|
+
var _r = {
|
|
3184
|
+
getDimensions: mr,
|
|
3185
3185
|
render(e, t, n) {
|
|
3186
|
-
return
|
|
3186
|
+
return hr(e, t, pr("rectangle", n.useAscii), n.useAscii);
|
|
3187
3187
|
},
|
|
3188
|
-
getAttachmentPoint:
|
|
3189
|
-
},
|
|
3190
|
-
["rectangle",
|
|
3188
|
+
getAttachmentPoint: gr
|
|
3189
|
+
}, vr = /* @__PURE__ */ new Map([
|
|
3190
|
+
["rectangle", _r],
|
|
3191
3191
|
["rounded", {
|
|
3192
|
-
getDimensions:
|
|
3192
|
+
getDimensions: mr,
|
|
3193
3193
|
render(e, t, n) {
|
|
3194
|
-
return
|
|
3194
|
+
return hr(e, t, pr("rounded", n.useAscii), n.useAscii);
|
|
3195
3195
|
},
|
|
3196
|
-
getAttachmentPoint:
|
|
3196
|
+
getAttachmentPoint: gr
|
|
3197
3197
|
}],
|
|
3198
3198
|
["diamond", {
|
|
3199
|
-
getDimensions:
|
|
3199
|
+
getDimensions: mr,
|
|
3200
3200
|
render(e, t, n) {
|
|
3201
|
-
return
|
|
3201
|
+
return hr(e, t, pr("diamond", n.useAscii), n.useAscii);
|
|
3202
3202
|
},
|
|
3203
|
-
getAttachmentPoint:
|
|
3203
|
+
getAttachmentPoint: gr
|
|
3204
3204
|
}],
|
|
3205
3205
|
["stadium", {
|
|
3206
3206
|
getDimensions(e, t) {
|
|
3207
|
-
let n =
|
|
3207
|
+
let n = Z(e), r = Math.max(...n.map((e) => B(e)), 0), i = n.length, a = 2 * t.padding + r, o = a + 4, s = i + 2 * t.padding;
|
|
3208
3208
|
return {
|
|
3209
3209
|
width: o,
|
|
3210
3210
|
height: Math.max(s + 2, 3),
|
|
@@ -3227,7 +3227,7 @@ var gr = {
|
|
|
3227
3227
|
};
|
|
3228
3228
|
},
|
|
3229
3229
|
render(e, t, n) {
|
|
3230
|
-
let { width: r, height: i } = t, a =
|
|
3230
|
+
let { width: r, height: i } = t, a = V(r - 1, i - 1), o = Math.floor(i / 2), s = n.useAscii ? "-" : "─";
|
|
3231
3231
|
if (i === 3) a[0][o] = "(", a[r - 1][o] = ")";
|
|
3232
3232
|
else if (n.useAscii) {
|
|
3233
3233
|
for (let e = 0; e < i; e++) a[0][e] = "(", a[r - 1][e] = ")";
|
|
@@ -3241,9 +3241,9 @@ var gr = {
|
|
|
3241
3241
|
for (let e = 1; e < r - 1; e++) a[e][i - 1] = s;
|
|
3242
3242
|
a[r - 1][i - 1] = "╯";
|
|
3243
3243
|
}
|
|
3244
|
-
let c =
|
|
3244
|
+
let c = Z(e), l = o - Math.floor((c.length - 1) / 2);
|
|
3245
3245
|
for (let e = 0; e < c.length; e++) {
|
|
3246
|
-
let t = c[e], n = Math.floor(r / 2) - Math.floor(
|
|
3246
|
+
let t = c[e], n = Math.floor(r / 2) - Math.floor(B(t) / 2), o = Nt(t);
|
|
3247
3247
|
for (let t = 0; t < o.length; t++) {
|
|
3248
3248
|
let s = n + t, c = l + e;
|
|
3249
3249
|
s > 0 && s < r - 1 && c >= 0 && c < i && (a[s][c] = o[t]);
|
|
@@ -3251,18 +3251,18 @@ var gr = {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
return a;
|
|
3253
3253
|
},
|
|
3254
|
-
getAttachmentPoint:
|
|
3254
|
+
getAttachmentPoint: gr
|
|
3255
3255
|
}],
|
|
3256
3256
|
["circle", {
|
|
3257
|
-
getDimensions:
|
|
3257
|
+
getDimensions: mr,
|
|
3258
3258
|
render(e, t, n) {
|
|
3259
|
-
return
|
|
3259
|
+
return hr(e, t, pr("circle", n.useAscii), n.useAscii);
|
|
3260
3260
|
},
|
|
3261
|
-
getAttachmentPoint:
|
|
3261
|
+
getAttachmentPoint: gr
|
|
3262
3262
|
}],
|
|
3263
3263
|
["subroutine", {
|
|
3264
3264
|
getDimensions(e, t) {
|
|
3265
|
-
let n =
|
|
3265
|
+
let n = Z(e), r = Math.max(...n.map((e) => B(e)), 0), i = n.length, a = 2 * t.padding + r, o = a + 4, s = i + 2 * t.padding;
|
|
3266
3266
|
return {
|
|
3267
3267
|
width: o,
|
|
3268
3268
|
height: s + 2,
|
|
@@ -3285,7 +3285,7 @@ var gr = {
|
|
|
3285
3285
|
};
|
|
3286
3286
|
},
|
|
3287
3287
|
render(e, t, n) {
|
|
3288
|
-
let { width: r, height: i } = t, a =
|
|
3288
|
+
let { width: r, height: i } = t, a = V(r - 1, i - 1), o = n.useAscii ? "-" : "─", s = n.useAscii ? "|" : "│";
|
|
3289
3289
|
a[0][0] = n.useAscii ? "+" : "┌", a[1][0] = n.useAscii ? "+" : "┬";
|
|
3290
3290
|
for (let e = 2; e < r - 2; e++) a[e][0] = o;
|
|
3291
3291
|
a[r - 2][0] = n.useAscii ? "+" : "┬", a[r - 1][0] = n.useAscii ? "+" : "┐";
|
|
@@ -3293,9 +3293,9 @@ var gr = {
|
|
|
3293
3293
|
a[0][i - 1] = n.useAscii ? "+" : "└", a[1][i - 1] = n.useAscii ? "+" : "┴";
|
|
3294
3294
|
for (let e = 2; e < r - 2; e++) a[e][i - 1] = o;
|
|
3295
3295
|
a[r - 2][i - 1] = n.useAscii ? "+" : "┴", a[r - 1][i - 1] = n.useAscii ? "+" : "┘";
|
|
3296
|
-
let c =
|
|
3296
|
+
let c = Z(e), l = Math.floor(i / 2) - Math.floor((c.length - 1) / 2);
|
|
3297
3297
|
for (let e = 0; e < c.length; e++) {
|
|
3298
|
-
let t = c[e], n = Math.floor(r / 2) - Math.floor(
|
|
3298
|
+
let t = c[e], n = Math.floor(r / 2) - Math.floor(B(t) / 2), o = Nt(t);
|
|
3299
3299
|
for (let t = 0; t < o.length; t++) {
|
|
3300
3300
|
let s = n + t, c = l + e;
|
|
3301
3301
|
s > 1 && s < r - 2 && c > 0 && c < i - 1 && (a[s][c] = o[t]);
|
|
@@ -3303,25 +3303,25 @@ var gr = {
|
|
|
3303
3303
|
}
|
|
3304
3304
|
return a;
|
|
3305
3305
|
},
|
|
3306
|
-
getAttachmentPoint:
|
|
3306
|
+
getAttachmentPoint: gr
|
|
3307
3307
|
}],
|
|
3308
3308
|
["doublecircle", {
|
|
3309
|
-
getDimensions:
|
|
3309
|
+
getDimensions: mr,
|
|
3310
3310
|
render(e, t, n) {
|
|
3311
|
-
return
|
|
3311
|
+
return hr(e, t, pr("doublecircle", n.useAscii), n.useAscii);
|
|
3312
3312
|
},
|
|
3313
|
-
getAttachmentPoint:
|
|
3313
|
+
getAttachmentPoint: gr
|
|
3314
3314
|
}],
|
|
3315
3315
|
["hexagon", {
|
|
3316
|
-
getDimensions:
|
|
3316
|
+
getDimensions: mr,
|
|
3317
3317
|
render(e, t, n) {
|
|
3318
|
-
return
|
|
3318
|
+
return hr(e, t, pr("hexagon", n.useAscii), n.useAscii);
|
|
3319
3319
|
},
|
|
3320
|
-
getAttachmentPoint:
|
|
3320
|
+
getAttachmentPoint: gr
|
|
3321
3321
|
}],
|
|
3322
3322
|
["cylinder", {
|
|
3323
3323
|
getDimensions(e, t) {
|
|
3324
|
-
let n =
|
|
3324
|
+
let n = Z(e), r = Math.max(...n.map((e) => B(e)), 0), i = n.length, a = 2 * t.padding + r, o = a + 2, s = i + 2 * t.padding + 2;
|
|
3325
3325
|
return {
|
|
3326
3326
|
width: o,
|
|
3327
3327
|
height: s + 2,
|
|
@@ -3344,7 +3344,7 @@ var gr = {
|
|
|
3344
3344
|
};
|
|
3345
3345
|
},
|
|
3346
3346
|
render(e, t, n) {
|
|
3347
|
-
let { width: r, height: i } = t, a =
|
|
3347
|
+
let { width: r, height: i } = t, a = V(r - 1, i - 1), o = n.useAscii ? "-" : "─", s = n.useAscii ? "|" : "│";
|
|
3348
3348
|
a[0][0] = n.useAscii ? "." : "╭";
|
|
3349
3349
|
for (let e = 1; e < r - 1; e++) a[e][0] = o;
|
|
3350
3350
|
a[r - 1][0] = n.useAscii ? "." : "╮", a[0][1] = s;
|
|
@@ -3356,9 +3356,9 @@ var gr = {
|
|
|
3356
3356
|
a[r - 1][i - 2] = s, a[0][i - 1] = n.useAscii ? "'" : "╰";
|
|
3357
3357
|
for (let e = 1; e < r - 1; e++) a[e][i - 1] = o;
|
|
3358
3358
|
a[r - 1][i - 1] = n.useAscii ? "'" : "╯";
|
|
3359
|
-
let c =
|
|
3359
|
+
let c = Z(e), l = Math.floor(i / 2) - Math.floor((c.length - 1) / 2);
|
|
3360
3360
|
for (let e = 0; e < c.length; e++) {
|
|
3361
|
-
let t = c[e], n = Math.floor(r / 2) - Math.floor(
|
|
3361
|
+
let t = c[e], n = Math.floor(r / 2) - Math.floor(B(t) / 2), o = Nt(t);
|
|
3362
3362
|
for (let t = 0; t < o.length; t++) {
|
|
3363
3363
|
let s = n + t, c = l + e;
|
|
3364
3364
|
s > 0 && s < r - 1 && c > 1 && c < i - 2 && (a[s][c] = o[t]);
|
|
@@ -3366,42 +3366,42 @@ var gr = {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
return a;
|
|
3368
3368
|
},
|
|
3369
|
-
getAttachmentPoint:
|
|
3369
|
+
getAttachmentPoint: gr
|
|
3370
3370
|
}],
|
|
3371
3371
|
["asymmetric", {
|
|
3372
|
-
getDimensions:
|
|
3372
|
+
getDimensions: mr,
|
|
3373
3373
|
render(e, t, n) {
|
|
3374
|
-
return
|
|
3374
|
+
return hr(e, t, pr("asymmetric", n.useAscii), n.useAscii);
|
|
3375
3375
|
},
|
|
3376
|
-
getAttachmentPoint:
|
|
3376
|
+
getAttachmentPoint: gr
|
|
3377
3377
|
}],
|
|
3378
3378
|
["trapezoid", {
|
|
3379
|
-
getDimensions:
|
|
3379
|
+
getDimensions: mr,
|
|
3380
3380
|
render(e, t, n) {
|
|
3381
|
-
return
|
|
3381
|
+
return hr(e, t, pr("trapezoid", n.useAscii), n.useAscii);
|
|
3382
3382
|
},
|
|
3383
|
-
getAttachmentPoint:
|
|
3383
|
+
getAttachmentPoint: gr
|
|
3384
3384
|
}],
|
|
3385
3385
|
["trapezoid-alt", {
|
|
3386
|
-
getDimensions:
|
|
3386
|
+
getDimensions: mr,
|
|
3387
3387
|
render(e, t, n) {
|
|
3388
|
-
return
|
|
3388
|
+
return hr(e, t, pr("trapezoid-alt", n.useAscii), n.useAscii);
|
|
3389
3389
|
},
|
|
3390
|
-
getAttachmentPoint:
|
|
3390
|
+
getAttachmentPoint: gr
|
|
3391
3391
|
}],
|
|
3392
3392
|
["parallelogram", {
|
|
3393
|
-
getDimensions:
|
|
3393
|
+
getDimensions: mr,
|
|
3394
3394
|
render(e, t, n) {
|
|
3395
|
-
return
|
|
3395
|
+
return hr(e, t, pr("parallelogram", n.useAscii), n.useAscii);
|
|
3396
3396
|
},
|
|
3397
|
-
getAttachmentPoint:
|
|
3397
|
+
getAttachmentPoint: gr
|
|
3398
3398
|
}],
|
|
3399
3399
|
["parallelogram-alt", {
|
|
3400
|
-
getDimensions:
|
|
3400
|
+
getDimensions: mr,
|
|
3401
3401
|
render(e, t, n) {
|
|
3402
|
-
return
|
|
3402
|
+
return hr(e, t, pr("parallelogram-alt", n.useAscii), n.useAscii);
|
|
3403
3403
|
},
|
|
3404
|
-
getAttachmentPoint:
|
|
3404
|
+
getAttachmentPoint: gr
|
|
3405
3405
|
}],
|
|
3406
3406
|
["state-start", {
|
|
3407
3407
|
getDimensions(e, t) {
|
|
@@ -3427,21 +3427,21 @@ var gr = {
|
|
|
3427
3427
|
};
|
|
3428
3428
|
},
|
|
3429
3429
|
render(e, t, n) {
|
|
3430
|
-
let { width: r, height: i } = t, a =
|
|
3430
|
+
let { width: r, height: i } = t, a = V(r - 1, i - 1), o = Math.floor(r / 2);
|
|
3431
3431
|
return n.useAscii ? (a[0][0] = ".", a[1][0] = "-", a[2][0] = "-", a[3][0] = "-", a[4][0] = ".", a[0][1] = "|", a[o][1] = "*", a[4][1] = "|", a[0][2] = "'", a[1][2] = "-", a[2][2] = "-", a[3][2] = "-", a[4][2] = "'") : (a[0][0] = "╭", a[1][0] = "─", a[2][0] = "─", a[3][0] = "─", a[4][0] = "╮", a[0][1] = "│", a[o][1] = "●", a[4][1] = "│", a[0][2] = "╰", a[1][2] = "─", a[2][2] = "─", a[3][2] = "─", a[4][2] = "╯"), a;
|
|
3432
3432
|
},
|
|
3433
3433
|
getAttachmentPoint(e, t, n) {
|
|
3434
3434
|
let { width: r, height: i } = t, a = n.x + Math.floor(r / 2), o = n.y + Math.floor(i / 2);
|
|
3435
|
-
return
|
|
3435
|
+
return Y(e, G) ? {
|
|
3436
3436
|
x: a,
|
|
3437
3437
|
y: n.y
|
|
3438
|
-
} :
|
|
3438
|
+
} : Y(e, K) ? {
|
|
3439
3439
|
x: a,
|
|
3440
3440
|
y: n.y + i - 1
|
|
3441
|
-
} :
|
|
3441
|
+
} : Y(e, q) ? {
|
|
3442
3442
|
x: n.x,
|
|
3443
3443
|
y: o
|
|
3444
|
-
} :
|
|
3444
|
+
} : Y(e, J) ? {
|
|
3445
3445
|
x: n.x + r - 1,
|
|
3446
3446
|
y: o
|
|
3447
3447
|
} : {
|
|
@@ -3474,21 +3474,21 @@ var gr = {
|
|
|
3474
3474
|
};
|
|
3475
3475
|
},
|
|
3476
3476
|
render(e, t, n) {
|
|
3477
|
-
let { width: r, height: i } = t, a =
|
|
3477
|
+
let { width: r, height: i } = t, a = V(r - 1, i - 1), o = Math.floor(r / 2);
|
|
3478
3478
|
return n.useAscii ? (a[0][0] = "#", a[1][0] = "=", a[2][0] = "=", a[3][0] = "=", a[4][0] = "#", a[0][1] = "#", a[o][1] = "*", a[4][1] = "#", a[0][2] = "#", a[1][2] = "=", a[2][2] = "=", a[3][2] = "=", a[4][2] = "#") : (a[0][0] = "╔", a[1][0] = "═", a[2][0] = "═", a[3][0] = "═", a[4][0] = "╗", a[0][1] = "║", a[o][1] = "◎", a[4][1] = "║", a[0][2] = "╚", a[1][2] = "═", a[2][2] = "═", a[3][2] = "═", a[4][2] = "╝"), a;
|
|
3479
3479
|
},
|
|
3480
3480
|
getAttachmentPoint(e, t, n) {
|
|
3481
3481
|
let { width: r, height: i } = t, a = n.x + Math.floor(r / 2), o = n.y + Math.floor(i / 2);
|
|
3482
|
-
return
|
|
3482
|
+
return Y(e, G) ? {
|
|
3483
3483
|
x: a,
|
|
3484
3484
|
y: n.y
|
|
3485
|
-
} :
|
|
3485
|
+
} : Y(e, K) ? {
|
|
3486
3486
|
x: a,
|
|
3487
3487
|
y: n.y + i - 1
|
|
3488
|
-
} :
|
|
3488
|
+
} : Y(e, q) ? {
|
|
3489
3489
|
x: n.x,
|
|
3490
3490
|
y: o
|
|
3491
|
-
} :
|
|
3491
|
+
} : Y(e, J) ? {
|
|
3492
3492
|
x: n.x + r - 1,
|
|
3493
3493
|
y: o
|
|
3494
3494
|
} : {
|
|
@@ -3498,18 +3498,18 @@ var gr = {
|
|
|
3498
3498
|
}
|
|
3499
3499
|
}]
|
|
3500
3500
|
]);
|
|
3501
|
-
function
|
|
3502
|
-
return
|
|
3501
|
+
function yr(e) {
|
|
3502
|
+
return vr.get(e) ?? _r;
|
|
3503
3503
|
}
|
|
3504
|
-
function
|
|
3505
|
-
return
|
|
3504
|
+
function br(e, t, n) {
|
|
3505
|
+
return yr(e).getDimensions(t, n);
|
|
3506
3506
|
}
|
|
3507
|
-
function
|
|
3508
|
-
return
|
|
3507
|
+
function xr(e, t, n, r) {
|
|
3508
|
+
return yr(e).getAttachmentPoint(t, n, r);
|
|
3509
3509
|
}
|
|
3510
3510
|
//#endregion
|
|
3511
3511
|
//#region packages/ascii-renderer/src/grid.ts
|
|
3512
|
-
function
|
|
3512
|
+
function Sr(e, t, n) {
|
|
3513
3513
|
let r = n ? {
|
|
3514
3514
|
x: t.x + n.x,
|
|
3515
3515
|
y: t.y + n.y
|
|
@@ -3523,21 +3523,21 @@ function xr(e, t, n) {
|
|
|
3523
3523
|
y: a + Math.floor(s / 2) + e.offsetY
|
|
3524
3524
|
};
|
|
3525
3525
|
}
|
|
3526
|
-
function
|
|
3527
|
-
return t.map((t) =>
|
|
3526
|
+
function Cr(e, t) {
|
|
3527
|
+
return t.map((t) => Sr(e, t));
|
|
3528
3528
|
}
|
|
3529
|
-
function
|
|
3529
|
+
function wr(e, t, n, r) {
|
|
3530
3530
|
let i = r ?? Pr(e, t);
|
|
3531
|
-
return
|
|
3531
|
+
return Bn(e.grid, n, 3) ? (Vn(e.grid, n, 3), t.gridCoord = n, n) : i === "LR" ? wr(e, t, {
|
|
3532
3532
|
x: n.x,
|
|
3533
3533
|
y: n.y + 4
|
|
3534
|
-
}, i) :
|
|
3534
|
+
}, i) : wr(e, t, {
|
|
3535
3535
|
x: n.x + 4,
|
|
3536
3536
|
y: n.y
|
|
3537
3537
|
}, i);
|
|
3538
3538
|
}
|
|
3539
|
-
function
|
|
3540
|
-
let n =
|
|
3539
|
+
function Tr(e, t) {
|
|
3540
|
+
let n = X(t), r = e.config.boxBorderPadding, i = br(t.shape, t.displayLabel, {
|
|
3541
3541
|
useAscii: e.config.useAscii,
|
|
3542
3542
|
padding: r
|
|
3543
3543
|
}), a = i.gridColumns, o = i.gridRows;
|
|
@@ -3560,26 +3560,26 @@ function wr(e, t) {
|
|
|
3560
3560
|
e.rowHeight.set(n.y - 1, Math.max(i, r));
|
|
3561
3561
|
}
|
|
3562
3562
|
}
|
|
3563
|
-
function
|
|
3563
|
+
function Er(e, t) {
|
|
3564
3564
|
for (let n of t) e.columnWidth.has(n.x) || e.columnWidth.set(n.x, Math.floor(e.config.paddingX / 2)), e.rowHeight.has(n.y) || e.rowHeight.set(n.y, Math.floor(e.config.paddingY / 2));
|
|
3565
3565
|
}
|
|
3566
|
-
var
|
|
3567
|
-
function
|
|
3566
|
+
var Dr = 8;
|
|
3567
|
+
function Or(e, t, n, r) {
|
|
3568
3568
|
let i = [];
|
|
3569
3569
|
try {
|
|
3570
|
-
for (let a = 0; a <
|
|
3571
|
-
let a =
|
|
3570
|
+
for (let a = 0; a < Dr; a++) {
|
|
3571
|
+
let a = cr(r, n, t.path, t.style);
|
|
3572
3572
|
if (!a) return;
|
|
3573
|
-
e.grid.add(
|
|
3573
|
+
e.grid.add(Nn(a)), i.push(a), ci(e, t);
|
|
3574
3574
|
}
|
|
3575
3575
|
} finally {
|
|
3576
|
-
for (let t of i) e.grid.delete(
|
|
3576
|
+
for (let t of i) e.grid.delete(Nn(t));
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
|
-
function
|
|
3579
|
+
function kr(e, t) {
|
|
3580
3580
|
return e.subgraphs.some((e) => e.nodes.includes(t));
|
|
3581
3581
|
}
|
|
3582
|
-
function
|
|
3582
|
+
function Q(e, t) {
|
|
3583
3583
|
let n = null;
|
|
3584
3584
|
for (let r of e.subgraphs) r.nodes.includes(t) && (!n || Ar(n, r)) && (n = r);
|
|
3585
3585
|
return n;
|
|
@@ -3593,7 +3593,7 @@ function Ar(e, t) {
|
|
|
3593
3593
|
return !1;
|
|
3594
3594
|
}
|
|
3595
3595
|
function jr(e, t) {
|
|
3596
|
-
let n =
|
|
3596
|
+
let n = Q(e, t);
|
|
3597
3597
|
if (!n) return null;
|
|
3598
3598
|
let r = n;
|
|
3599
3599
|
for (; r.parent;) r = r.parent;
|
|
@@ -3617,23 +3617,23 @@ function Nr(e, t, n) {
|
|
|
3617
3617
|
return !1;
|
|
3618
3618
|
}
|
|
3619
3619
|
function Pr(e, t) {
|
|
3620
|
-
let n =
|
|
3620
|
+
let n = Q(e, t);
|
|
3621
3621
|
return n?.direction ? n.direction : e.config.graphDirection;
|
|
3622
3622
|
}
|
|
3623
3623
|
function Fr(e, t) {
|
|
3624
|
-
let n =
|
|
3624
|
+
let n = Q(e, t);
|
|
3625
3625
|
if (!n) return !1;
|
|
3626
3626
|
let r = !1;
|
|
3627
|
-
for (let i of e.edges) if (i.to === t &&
|
|
3627
|
+
for (let i of e.edges) if (i.to === t && Q(e, i.from) !== n) {
|
|
3628
3628
|
r = !0;
|
|
3629
3629
|
break;
|
|
3630
3630
|
}
|
|
3631
3631
|
if (!r) return !1;
|
|
3632
|
-
let i =
|
|
3632
|
+
let i = X(t).y;
|
|
3633
3633
|
for (let r of n.nodes) {
|
|
3634
3634
|
if (r === t || !r.gridCoord) continue;
|
|
3635
3635
|
let a = !1;
|
|
3636
|
-
for (let t of e.edges) if (t.to === r &&
|
|
3636
|
+
for (let t of e.edges) if (t.to === r && Q(e, t.from) !== n) {
|
|
3637
3637
|
a = !0;
|
|
3638
3638
|
break;
|
|
3639
3639
|
}
|
|
@@ -3651,7 +3651,7 @@ function Ir(e, t) {
|
|
|
3651
3651
|
n = Math.min(n, t), r = Math.min(r, o), i = Math.max(i, s), a = Math.max(a, c);
|
|
3652
3652
|
}
|
|
3653
3653
|
t.minX = n - 2, t.minY = r - 2 - 2, t.maxX = i + 2, t.maxY = a + 2;
|
|
3654
|
-
let o = Math.max(0, ...
|
|
3654
|
+
let o = Math.max(0, ...Z(t.name).map((e) => B(e))), s = t.maxX - t.minX, c = o + 1;
|
|
3655
3655
|
if (c > s) {
|
|
3656
3656
|
let e = c - s, n = Math.floor(e / 2), r = e - n;
|
|
3657
3657
|
t.minX -= n, t.maxX += r;
|
|
@@ -3726,7 +3726,7 @@ function Ur(e, t, n, r, i) {
|
|
|
3726
3726
|
x: t[a],
|
|
3727
3727
|
y: s
|
|
3728
3728
|
};
|
|
3729
|
-
if (
|
|
3729
|
+
if (Bn(e.grid, c, 3)) return c;
|
|
3730
3730
|
let l = Hr(e, c);
|
|
3731
3731
|
if (!l || jr(e, l) !== n) return null;
|
|
3732
3732
|
o += 4;
|
|
@@ -3740,10 +3740,10 @@ function Wr(e, t, n, r) {
|
|
|
3740
3740
|
let a = n.get(i);
|
|
3741
3741
|
if (!a) return;
|
|
3742
3742
|
n.delete(i);
|
|
3743
|
-
let o =
|
|
3743
|
+
let o = X(t), s = Pr(e, t) === "LR" ? "y" : "x";
|
|
3744
3744
|
for (let t of a) {
|
|
3745
3745
|
let n = Pr(e, t), a = Ur(e, o, i, s, 1);
|
|
3746
|
-
|
|
3746
|
+
wr(e, e.nodes[t.index], a ?? o, n), r.add(t);
|
|
3747
3747
|
}
|
|
3748
3748
|
}
|
|
3749
3749
|
function Gr(e, t) {
|
|
@@ -3757,7 +3757,7 @@ function Gr(e, t) {
|
|
|
3757
3757
|
let a = [...Xr(e, r)].sort((t, n) => Yr(e, t, n));
|
|
3758
3758
|
for (let o of a) {
|
|
3759
3759
|
if (o.gridCoord !== null) continue;
|
|
3760
|
-
let a =
|
|
3760
|
+
let a = Q(e, r), s = Q(e, o), c = a && a === s && a.direction ? a.direction : e.config.graphDirection, l = c === "LR" ? i.x + 4 : i.y + 4, u;
|
|
3761
3761
|
u = c === e.config.graphDirection ? t[l] ?? 0 : c === "LR" ? i.y : i.x;
|
|
3762
3762
|
let d = c === "LR" ? {
|
|
3763
3763
|
x: l,
|
|
@@ -3766,7 +3766,7 @@ function Gr(e, t) {
|
|
|
3766
3766
|
x: u,
|
|
3767
3767
|
y: l
|
|
3768
3768
|
};
|
|
3769
|
-
|
|
3769
|
+
wr(e, e.nodes[o.index], d, c), c === e.config.graphDirection && (t[l] = u + 4), n = !0;
|
|
3770
3770
|
}
|
|
3771
3771
|
}
|
|
3772
3772
|
}
|
|
@@ -3775,9 +3775,9 @@ function Kr(e) {
|
|
|
3775
3775
|
let t = e.config.graphDirection, n = [], r = /* @__PURE__ */ new Set();
|
|
3776
3776
|
for (let t of e.edges) t.from !== t.to && r.add(t.to.name);
|
|
3777
3777
|
let i = Vr(e, e.nodes.filter((e) => !r.has(e.name))).filter((t) => {
|
|
3778
|
-
let n =
|
|
3778
|
+
let n = Q(e, t);
|
|
3779
3779
|
if (!n) return !0;
|
|
3780
|
-
for (let r of e.edges) if (r.to === t &&
|
|
3780
|
+
for (let r of e.edges) if (r.to === t && Q(e, r.from) !== n) return !1;
|
|
3781
3781
|
return !0;
|
|
3782
3782
|
}), a = new Set(i), o = [], s = [];
|
|
3783
3783
|
for (let t of i) {
|
|
@@ -3790,9 +3790,9 @@ function Kr(e) {
|
|
|
3790
3790
|
r ? r.push(t) : l.set(n, [t]);
|
|
3791
3791
|
}
|
|
3792
3792
|
let u = /* @__PURE__ */ new Set(), d = !1, f = !1;
|
|
3793
|
-
for (let t of c)
|
|
3793
|
+
for (let t of c) kr(e, t) ? Xr(e, t).length > 0 && (f = !0) : d = !0;
|
|
3794
3794
|
let p = t === "LR" && d && f, m, h = [];
|
|
3795
|
-
p ? (m = c.filter((t) => !
|
|
3795
|
+
p ? (m = c.filter((t) => !kr(e, t)), h = c.filter((t) => kr(e, t))) : m = c;
|
|
3796
3796
|
for (let r of m) {
|
|
3797
3797
|
let i = t === "LR" ? {
|
|
3798
3798
|
x: 0,
|
|
@@ -3801,7 +3801,7 @@ function Kr(e) {
|
|
|
3801
3801
|
x: n[0] ?? 0,
|
|
3802
3802
|
y: 0
|
|
3803
3803
|
};
|
|
3804
|
-
|
|
3804
|
+
wr(e, e.nodes[r.index], i), n[0] = (n[0] ?? 0) + 4, Wr(e, r, l, u);
|
|
3805
3805
|
}
|
|
3806
3806
|
if (p && h.length > 0) for (let r of h) {
|
|
3807
3807
|
let i = t === "LR" ? {
|
|
@@ -3811,7 +3811,7 @@ function Kr(e) {
|
|
|
3811
3811
|
x: n[4] ?? 0,
|
|
3812
3812
|
y: 4
|
|
3813
3813
|
};
|
|
3814
|
-
|
|
3814
|
+
wr(e, e.nodes[r.index], i), n[4] = (n[4] ?? 0) + 4, Wr(e, r, l, u);
|
|
3815
3815
|
}
|
|
3816
3816
|
Gr(e, n);
|
|
3817
3817
|
for (let t of o) {
|
|
@@ -3834,27 +3834,27 @@ function Kr(e) {
|
|
|
3834
3834
|
x: n[0] ?? 0,
|
|
3835
3835
|
y: 0
|
|
3836
3836
|
}, n[0] = (n[0] ?? 0) + 4;
|
|
3837
|
-
|
|
3837
|
+
wr(e, e.nodes[t.index], o, i);
|
|
3838
3838
|
}
|
|
3839
3839
|
Gr(e, n);
|
|
3840
|
-
for (let t of e.nodes)
|
|
3841
|
-
e.pathBudget =
|
|
3842
|
-
let g =
|
|
3840
|
+
for (let t of e.nodes) Tr(e, t);
|
|
3841
|
+
e.pathBudget = Yn(), oi(e), e.bundles = nr(e), or(e);
|
|
3842
|
+
let g = sr(), _ = Ln(e.grid);
|
|
3843
3843
|
for (let t of e.edges) {
|
|
3844
3844
|
if (t.bundle && t.path.length > 0) {
|
|
3845
|
-
|
|
3845
|
+
Er(e, t.path), lr(_, g, t.path, t.style), di(e, t);
|
|
3846
3846
|
continue;
|
|
3847
3847
|
}
|
|
3848
|
-
ci(e, t),
|
|
3848
|
+
ci(e, t), Or(e, t, g, _), Er(e, t.path), lr(_, g, t.path, t.style), di(e, t);
|
|
3849
3849
|
}
|
|
3850
|
-
for (let t of e.nodes) t.drawingCoord =
|
|
3851
|
-
|
|
3850
|
+
for (let t of e.nodes) t.drawingCoord = Sr(e, X(t)), t.drawing = Hi(t, e);
|
|
3851
|
+
Xt(e.canvas, e.columnWidth, e.rowHeight), Zt(e.roleCanvas, e.columnWidth, e.rowHeight), Rr(e), zr(e);
|
|
3852
3852
|
}
|
|
3853
3853
|
function qr(e, t) {
|
|
3854
3854
|
return e.edges.filter((e) => e.from.name === t.name);
|
|
3855
3855
|
}
|
|
3856
3856
|
function Jr(e, t) {
|
|
3857
|
-
let n =
|
|
3857
|
+
let n = Q(e, t), r = [], i = n;
|
|
3858
3858
|
for (; i !== null;) r.unshift(i), i = i.parent;
|
|
3859
3859
|
return r;
|
|
3860
3860
|
}
|
|
@@ -3870,28 +3870,28 @@ function Xr(e, t) {
|
|
|
3870
3870
|
//#endregion
|
|
3871
3871
|
//#region packages/ascii-renderer/src/edge-routing.ts
|
|
3872
3872
|
function Zr(e) {
|
|
3873
|
-
return e ===
|
|
3873
|
+
return e === G ? K : e === K ? G : e === q ? J : e === J ? q : e === Sn ? Tn : e === Cn ? wn : e === wn ? Cn : e === Tn ? Sn : En;
|
|
3874
3874
|
}
|
|
3875
3875
|
function $(e, t) {
|
|
3876
|
-
return e.x === t.x ? e.y < t.y ?
|
|
3876
|
+
return e.x === t.x ? e.y < t.y ? K : G : e.y === t.y ? e.x < t.x ? J : q : e.x < t.x ? e.y < t.y ? wn : Sn : e.y < t.y ? Tn : Cn;
|
|
3877
3877
|
}
|
|
3878
3878
|
function Qr(e) {
|
|
3879
3879
|
return e === "LR" ? [
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3880
|
+
J,
|
|
3881
|
+
K,
|
|
3882
|
+
K,
|
|
3883
|
+
J
|
|
3884
3884
|
] : [
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3885
|
+
K,
|
|
3886
|
+
J,
|
|
3887
|
+
J,
|
|
3888
|
+
K
|
|
3889
3889
|
];
|
|
3890
3890
|
}
|
|
3891
3891
|
function $r(e, t) {
|
|
3892
3892
|
if (e.from === e.to) return Qr(t);
|
|
3893
|
-
let n = $(
|
|
3894
|
-
return
|
|
3893
|
+
let n = $(X(e.from), X(e.to)), r, i, a, o, s = t === "LR" ? Y(n, q) || Y(n, Cn) || Y(n, Tn) : Y(n, G) || Y(n, Cn) || Y(n, Sn);
|
|
3894
|
+
return Y(n, wn) ? t === "LR" ? (r = K, i = q, a = J, o = G) : (r = J, i = G, a = K, o = q) : Y(n, Sn) ? t === "LR" ? (r = G, i = q, a = J, o = K) : (r = J, i = K, a = G, o = q) : Y(n, Tn) ? t === "LR" ? (r = K, i = K, a = q, o = G) : (r = q, i = G, a = K, o = J) : Y(n, Cn) ? t === "LR" ? (r = K, i = K, a = q, o = K) : (r = J, i = J, a = G, o = J) : s ? t === "LR" && Y(n, q) ? (r = K, i = K, a = q, o = J) : t === "TD" && Y(n, G) ? (r = J, i = J, a = G, o = K) : (r = n, i = Zr(n), a = n, o = Zr(n)) : (r = n, i = Zr(n), a = n, o = Zr(n)), [
|
|
3895
3895
|
r,
|
|
3896
3896
|
i,
|
|
3897
3897
|
a,
|
|
@@ -3906,7 +3906,7 @@ function ni(e, t) {
|
|
|
3906
3906
|
function ri(e, t, n = []) {
|
|
3907
3907
|
for (let r = 1; r < t.length - 1; r++) {
|
|
3908
3908
|
let i = t[r];
|
|
3909
|
-
if (
|
|
3909
|
+
if (Rn(e.grid, i) && !n.some((e) => ni(e, i))) return !1;
|
|
3910
3910
|
}
|
|
3911
3911
|
return !0;
|
|
3912
3912
|
}
|
|
@@ -3936,7 +3936,7 @@ function oi(e) {
|
|
|
3936
3936
|
}
|
|
3937
3937
|
}
|
|
3938
3938
|
function si(e, t, n, r, i) {
|
|
3939
|
-
let a =
|
|
3939
|
+
let a = Mn(X(t.from), n), o = Mn(X(t.to), r), s = Y(n, q) || Y(n, J), c = [t.from, t.to], l = t.parallelLane.usedOffsets, u = Y(n, J) ? 1 : Y(n, q) ? -1 : Y(n, K) ? 1 : -1, d = Y(r, J) ? 1 : Y(r, q) ? -1 : Y(r, K) ? 1 : -1, f = s ? {
|
|
3940
3940
|
x: a.x + u,
|
|
3941
3941
|
y: a.y
|
|
3942
3942
|
} : {
|
|
@@ -3964,12 +3964,12 @@ function si(e, t, n, r, i) {
|
|
|
3964
3964
|
}, {
|
|
3965
3965
|
x: i,
|
|
3966
3966
|
y: o.y
|
|
3967
|
-
}], d =
|
|
3967
|
+
}], d = Zn([
|
|
3968
3968
|
a,
|
|
3969
3969
|
...u,
|
|
3970
3970
|
o
|
|
3971
3971
|
]);
|
|
3972
|
-
if (ri(e,
|
|
3972
|
+
if (ri(e, Un(d), c)) return l.add(n), {
|
|
3973
3973
|
path: d,
|
|
3974
3974
|
labelSegment: u
|
|
3975
3975
|
};
|
|
@@ -3998,7 +3998,7 @@ function si(e, t, n, r, i) {
|
|
|
3998
3998
|
}, {
|
|
3999
3999
|
x: i,
|
|
4000
4000
|
y: f.y
|
|
4001
|
-
}], y =
|
|
4001
|
+
}], y = Zn(s ? [
|
|
4002
4002
|
a,
|
|
4003
4003
|
f,
|
|
4004
4004
|
{
|
|
@@ -4025,7 +4025,7 @@ function si(e, t, n, r, i) {
|
|
|
4025
4025
|
p,
|
|
4026
4026
|
o
|
|
4027
4027
|
]);
|
|
4028
|
-
if (ri(e,
|
|
4028
|
+
if (ri(e, Un(y), c)) return l.add(n), {
|
|
4029
4029
|
path: y,
|
|
4030
4030
|
labelSegment: v
|
|
4031
4031
|
};
|
|
@@ -4039,15 +4039,15 @@ function si(e, t, n, r, i) {
|
|
|
4039
4039
|
};
|
|
4040
4040
|
}
|
|
4041
4041
|
function ci(e, t) {
|
|
4042
|
-
let n =
|
|
4042
|
+
let n = Q(e, t.from), r = Q(e, t.to), [i, a, o, s] = $r(t, n && n === r && n.direction ? n.direction : e.config.graphDirection);
|
|
4043
4043
|
if (t.parallelLane && t.parallelLane.index > 0) {
|
|
4044
|
-
let n =
|
|
4044
|
+
let n = Y(i, a), r = n ? o : i, c = n ? s : a;
|
|
4045
4045
|
t.startDir = r, t.endDir = c;
|
|
4046
4046
|
let l = si(e, t, r, c, t.parallelLane.index);
|
|
4047
|
-
t.path = l.path, t.text.length > 0 && pi(e, t, l.labelSegment,
|
|
4047
|
+
t.path = l.path, t.text.length > 0 && pi(e, t, l.labelSegment, B(t.text));
|
|
4048
4048
|
return;
|
|
4049
4049
|
}
|
|
4050
|
-
let c =
|
|
4050
|
+
let c = Mn(X(t.from), i), l = Mn(X(t.to), a), u = tr(e, c, l, On(i)), d = tr(e, Mn(X(t.from), o), Mn(X(t.to), s), On(o));
|
|
4051
4051
|
if (u !== null && d !== null) {
|
|
4052
4052
|
u.length <= d.length ? (t.startDir = i, t.endDir = a, t.path = u) : (t.startDir = o, t.endDir = s, t.path = d);
|
|
4053
4053
|
return;
|
|
@@ -4081,7 +4081,7 @@ function ui(e, t, n, r) {
|
|
|
4081
4081
|
}
|
|
4082
4082
|
function di(e, t) {
|
|
4083
4083
|
if (t.text.length === 0 || t.parallelLane && t.parallelLane.index > 0) return;
|
|
4084
|
-
let n =
|
|
4084
|
+
let n = B(t.text), r = fi(t.path), i = r.length, a = [];
|
|
4085
4085
|
for (let t = 1; t < i; t++) {
|
|
4086
4086
|
let n = r[t - 1], i = r[t], o = [n, i], s = mi(e, o), c = n.x === i.x;
|
|
4087
4087
|
a.push({
|
|
@@ -4091,7 +4091,7 @@ function di(e, t) {
|
|
|
4091
4091
|
isVertical: c
|
|
4092
4092
|
});
|
|
4093
4093
|
}
|
|
4094
|
-
let o = (t) => ri(e,
|
|
4094
|
+
let o = (t) => ri(e, Un(t)), s = (e) => e.index === 1 || e.index === a.length, c = a.filter((e) => e.width >= n && !s(e) && o(e.line)), l;
|
|
4095
4095
|
if (c.length > 0) c.sort((e, t) => t.index - e.index), l = c[0].line;
|
|
4096
4096
|
else {
|
|
4097
4097
|
let e = a.filter((e) => e.width >= n && o(e.line));
|
|
@@ -4176,63 +4176,63 @@ var hi = {
|
|
|
4176
4176
|
};
|
|
4177
4177
|
function gi(e, t, n, r, i, a, o = "solid") {
|
|
4178
4178
|
let s = $(t, n), c = [], l = hi[o], u = a ? l.h.ascii : l.h.unicode, d = a ? l.v.ascii : l.v.unicode;
|
|
4179
|
-
if (
|
|
4179
|
+
if (Y(s, G)) for (let a = t.y - r; a >= n.y - i; a--) c.push({
|
|
4180
4180
|
x: t.x,
|
|
4181
4181
|
y: a
|
|
4182
|
-
}),
|
|
4183
|
-
else if (
|
|
4182
|
+
}), U(e, t.x, a, d);
|
|
4183
|
+
else if (Y(s, K)) for (let a = t.y + r; a <= n.y + i; a++) c.push({
|
|
4184
4184
|
x: t.x,
|
|
4185
4185
|
y: a
|
|
4186
|
-
}),
|
|
4187
|
-
else if (
|
|
4186
|
+
}), U(e, t.x, a, d);
|
|
4187
|
+
else if (Y(s, q)) for (let a = t.x - r; a >= n.x - i; a--) c.push({
|
|
4188
4188
|
x: a,
|
|
4189
4189
|
y: t.y
|
|
4190
|
-
}),
|
|
4191
|
-
else if (
|
|
4190
|
+
}), U(e, a, t.y, u);
|
|
4191
|
+
else if (Y(s, J)) for (let a = t.x + r; a <= n.x + i; a++) c.push({
|
|
4192
4192
|
x: a,
|
|
4193
4193
|
y: t.y
|
|
4194
|
-
}),
|
|
4195
|
-
else if (
|
|
4194
|
+
}), U(e, a, t.y, u);
|
|
4195
|
+
else if (Y(s, Cn)) {
|
|
4196
4196
|
for (let i = t.x - r; i >= n.x; i--) c.push({
|
|
4197
4197
|
x: i,
|
|
4198
4198
|
y: t.y
|
|
4199
|
-
}),
|
|
4199
|
+
}), U(e, i, t.y, u);
|
|
4200
4200
|
for (let r = t.y - 1; r >= n.y - i; r--) c.push({
|
|
4201
4201
|
x: n.x,
|
|
4202
4202
|
y: r
|
|
4203
|
-
}),
|
|
4204
|
-
} else if (
|
|
4203
|
+
}), U(e, n.x, r, d);
|
|
4204
|
+
} else if (Y(s, Sn)) {
|
|
4205
4205
|
for (let i = t.x + r; i <= n.x; i++) c.push({
|
|
4206
4206
|
x: i,
|
|
4207
4207
|
y: t.y
|
|
4208
|
-
}),
|
|
4208
|
+
}), U(e, i, t.y, u);
|
|
4209
4209
|
for (let r = t.y - 1; r >= n.y - i; r--) c.push({
|
|
4210
4210
|
x: n.x,
|
|
4211
4211
|
y: r
|
|
4212
|
-
}),
|
|
4213
|
-
} else if (
|
|
4212
|
+
}), U(e, n.x, r, d);
|
|
4213
|
+
} else if (Y(s, Tn)) {
|
|
4214
4214
|
for (let i = t.x - r; i >= n.x; i--) c.push({
|
|
4215
4215
|
x: i,
|
|
4216
4216
|
y: t.y
|
|
4217
|
-
}),
|
|
4217
|
+
}), U(e, i, t.y, u);
|
|
4218
4218
|
for (let r = t.y + 1; r <= n.y + i; r++) c.push({
|
|
4219
4219
|
x: n.x,
|
|
4220
4220
|
y: r
|
|
4221
|
-
}),
|
|
4222
|
-
} else if (
|
|
4221
|
+
}), U(e, n.x, r, d);
|
|
4222
|
+
} else if (Y(s, wn)) {
|
|
4223
4223
|
if (n.x - t.x <= 1) for (let a = t.y + r; a <= n.y + i; a++) c.push({
|
|
4224
4224
|
x: t.x,
|
|
4225
4225
|
y: a
|
|
4226
|
-
}),
|
|
4226
|
+
}), U(e, t.x, a, d);
|
|
4227
4227
|
else {
|
|
4228
4228
|
for (let i = t.x + r; i <= n.x; i++) c.push({
|
|
4229
4229
|
x: i,
|
|
4230
4230
|
y: t.y
|
|
4231
|
-
}),
|
|
4231
|
+
}), U(e, i, t.y, u);
|
|
4232
4232
|
for (let r = t.y + 1; r <= n.y + i; r++) c.push({
|
|
4233
4233
|
x: n.x,
|
|
4234
4234
|
y: r
|
|
4235
|
-
}),
|
|
4235
|
+
}), U(e, n.x, r, d);
|
|
4236
4236
|
}
|
|
4237
4237
|
}
|
|
4238
4238
|
return c;
|
|
@@ -4241,7 +4241,7 @@ function gi(e, t, n, r, i, a, o = "solid") {
|
|
|
4241
4241
|
//#region packages/ascii-renderer/src/draw-arrows.ts
|
|
4242
4242
|
function _i(e, t) {
|
|
4243
4243
|
if (t.path.length === 0) {
|
|
4244
|
-
let t =
|
|
4244
|
+
let t = H(e.canvas);
|
|
4245
4245
|
return [
|
|
4246
4246
|
t,
|
|
4247
4247
|
t,
|
|
@@ -4251,17 +4251,17 @@ function _i(e, t) {
|
|
|
4251
4251
|
t
|
|
4252
4252
|
];
|
|
4253
4253
|
}
|
|
4254
|
-
let n = Di(e, t), [r, i, a] = yi(e, t.path, t.style), o = i.length > 0, s = t.style === "invisible", c = o && !s ? Si(e, t.path, i[0], t.from) :
|
|
4255
|
-
l = t.hasArrowEnd && o ? wi(e, i[i.length - 1], a[a.length - 1], t.endMarker) :
|
|
4254
|
+
let n = Di(e, t), [r, i, a] = yi(e, t.path, t.style), o = i.length > 0, s = t.style === "invisible", c = o && !s ? Si(e, t.path, i[0], t.from) : H(e.canvas), l;
|
|
4255
|
+
l = t.hasArrowEnd && o ? wi(e, i[i.length - 1], a[a.length - 1], t.endMarker) : H(e.canvas);
|
|
4256
4256
|
let u;
|
|
4257
4257
|
if (t.hasArrowStart && o) {
|
|
4258
4258
|
let n = i[0][0], r = vi(a[0]), o = {
|
|
4259
4259
|
x: n.x,
|
|
4260
4260
|
y: n.y
|
|
4261
4261
|
};
|
|
4262
|
-
|
|
4263
|
-
} else u =
|
|
4264
|
-
let d = s ?
|
|
4262
|
+
Y(a[0], J) ? o.x = n.x - 1 : Y(a[0], q) ? o.x = n.x + 1 : Y(a[0], K) ? o.y = n.y - 1 : Y(a[0], G) && (o.y = n.y + 1), u = wi(e, [n, o], r, t.startMarker);
|
|
4263
|
+
} else u = H(e.canvas);
|
|
4264
|
+
let d = s ? H(e.canvas) : Ti(e, t.path);
|
|
4265
4265
|
return [
|
|
4266
4266
|
r,
|
|
4267
4267
|
c,
|
|
@@ -4272,13 +4272,13 @@ function _i(e, t) {
|
|
|
4272
4272
|
];
|
|
4273
4273
|
}
|
|
4274
4274
|
function vi(e) {
|
|
4275
|
-
return
|
|
4275
|
+
return Y(e, G) ? K : Y(e, K) ? G : Y(e, q) ? J : Y(e, J) ? q : Y(e, Cn) ? wn : Y(e, Sn) ? Tn : Y(e, Tn) ? Sn : Y(e, wn) ? Cn : En;
|
|
4276
4276
|
}
|
|
4277
4277
|
function yi(e, t, n = "solid") {
|
|
4278
|
-
let r =
|
|
4278
|
+
let r = H(e.canvas), i = t[0], a = [], o = [];
|
|
4279
4279
|
for (let s = 1; s < t.length; s++) {
|
|
4280
|
-
let c = t[s], l =
|
|
4281
|
-
if (
|
|
4280
|
+
let c = t[s], l = Sr(e, i), u = Sr(e, c);
|
|
4281
|
+
if (jn(l, u)) {
|
|
4282
4282
|
i = c;
|
|
4283
4283
|
continue;
|
|
4284
4284
|
}
|
|
@@ -4309,22 +4309,22 @@ var bi = /* @__PURE__ */ new Set([
|
|
|
4309
4309
|
"="
|
|
4310
4310
|
]);
|
|
4311
4311
|
function Si(e, t, n, r) {
|
|
4312
|
-
let i =
|
|
4312
|
+
let i = H(e.canvas), a = e.config.useAscii;
|
|
4313
4313
|
if (r.shape === "state-start" || r.shape === "state-end") return i;
|
|
4314
4314
|
let o = n[0], s = $(t[0], t[1]), c = a ? "+" : null, l = (t, n) => e.canvas[t]?.[n];
|
|
4315
|
-
if (
|
|
4315
|
+
if (Y(s, G)) {
|
|
4316
4316
|
let e = o.x, t = o.y + 1, n = l(e, t);
|
|
4317
|
-
|
|
4318
|
-
} else if (
|
|
4317
|
+
U(i, e, t, n !== void 0 && xi.has(n) ? c ?? "┴" : a ? "|" : "│");
|
|
4318
|
+
} else if (Y(s, K)) {
|
|
4319
4319
|
let e = o.x, t = o.y - 1, n = l(e, t);
|
|
4320
|
-
|
|
4321
|
-
} else if (
|
|
4320
|
+
U(i, e, t, n !== void 0 && xi.has(n) ? c ?? "┬" : a ? "|" : "│");
|
|
4321
|
+
} else if (Y(s, q) || Y(s, J)) {
|
|
4322
4322
|
let e = r.drawingCoord, t = r.drawing;
|
|
4323
4323
|
if (e === null || t === null)
|
|
4324
4324
|
/* v8 ignore next */
|
|
4325
4325
|
throw Error(`drawBoxStart: node "${r.name}" has no drawingCoord/drawing assigned`);
|
|
4326
|
-
let n = t.length, u =
|
|
4327
|
-
|
|
4326
|
+
let n = t.length, u = Y(s, q) ? e.x : e.x + n - 1, d = o.y, f = l(u, d);
|
|
4327
|
+
U(i, u, d, f !== void 0 && bi.has(f) ? c ?? (Y(s, q) ? "┤" : "├") : a ? "-" : "─");
|
|
4328
4328
|
}
|
|
4329
4329
|
return i;
|
|
4330
4330
|
}
|
|
@@ -4333,18 +4333,18 @@ function Ci(e, t) {
|
|
|
4333
4333
|
if (t === "cross") return e ? "x" : "✕";
|
|
4334
4334
|
}
|
|
4335
4335
|
function wi(e, t, n, r) {
|
|
4336
|
-
let i =
|
|
4336
|
+
let i = H(e.canvas);
|
|
4337
4337
|
if (t.length === 0) return i;
|
|
4338
4338
|
let a = t[0], o = t[t.length - 1], s = $(a, o);
|
|
4339
|
-
(t.length === 1 ||
|
|
4339
|
+
(t.length === 1 || Y(s, En)) && (s = n);
|
|
4340
4340
|
let c, l = Ci(e.config.useAscii, r);
|
|
4341
|
-
return c = l === void 0 ? e.config.useAscii ?
|
|
4341
|
+
return c = l === void 0 ? e.config.useAscii ? Y(s, G) ? "^" : Y(s, K) ? "v" : Y(s, q) ? "<" : Y(s, J) ? ">" : Y(n, G) ? "^" : Y(n, K) ? "v" : Y(n, q) ? "<" : Y(n, J) ? ">" : "*" : Y(s, G) ? "▲" : Y(s, K) ? "▼" : Y(s, q) ? "◄" : Y(s, J) ? "►" : Y(s, Sn) ? "◥" : Y(s, Cn) ? "◤" : Y(s, wn) ? "◢" : Y(s, Tn) ? "◣" : Y(n, G) ? "▲" : Y(n, K) ? "▼" : Y(n, q) ? "◄" : Y(n, J) ? "►" : Y(n, Sn) ? "◥" : Y(n, Cn) ? "◤" : Y(n, wn) ? "◢" : Y(n, Tn) ? "◣" : "●" : l, U(i, o.x, o.y, c), i;
|
|
4342
4342
|
}
|
|
4343
4343
|
function Ti(e, t) {
|
|
4344
|
-
let n =
|
|
4344
|
+
let n = H(e.canvas);
|
|
4345
4345
|
for (let r = 1; r < t.length - 1; r++) {
|
|
4346
|
-
let i = t[r], a =
|
|
4347
|
-
c = e.config.useAscii ? "+" :
|
|
4346
|
+
let i = t[r], a = Sr(e, i), o = $(t[r - 1], i), s = $(i, t[r + 1]), c;
|
|
4347
|
+
c = e.config.useAscii ? "+" : Y(o, J) && Y(s, K) || Y(o, G) && Y(s, q) ? "┐" : Y(o, J) && Y(s, G) || Y(o, K) && Y(s, q) ? "┘" : Y(o, q) && Y(s, K) || Y(o, G) && Y(s, J) ? "┌" : Y(o, q) && Y(s, G) || Y(o, K) && Y(s, J) ? "└" : "+", U(n, a.x, a.y, c);
|
|
4348
4348
|
}
|
|
4349
4349
|
return n;
|
|
4350
4350
|
}
|
|
@@ -4352,9 +4352,9 @@ function Ei(e, t) {
|
|
|
4352
4352
|
return e.edges.some((e) => e !== t && e.from === t.to && e.to === t.from);
|
|
4353
4353
|
}
|
|
4354
4354
|
function Di(e, t) {
|
|
4355
|
-
let n =
|
|
4355
|
+
let n = H(e.canvas);
|
|
4356
4356
|
if (t.text.length === 0) return n;
|
|
4357
|
-
let r =
|
|
4357
|
+
let r = Cr(e, t.labelLine), i;
|
|
4358
4358
|
if (t.path.length >= 2) {
|
|
4359
4359
|
let e = t.path[0].y, n = t.path[t.path.length - 1].y;
|
|
4360
4360
|
n < e ? i = !0 : n > e && (i = !1);
|
|
@@ -4369,11 +4369,11 @@ function Oi(e, t, n, r, i = !1) {
|
|
|
4369
4369
|
let e = c - s, t = Math.max(1, Math.floor(e / 4));
|
|
4370
4370
|
(i ? r : !r) ? u -= t : u += t;
|
|
4371
4371
|
}
|
|
4372
|
-
let d =
|
|
4372
|
+
let d = Z(n), f = u - Math.floor((d.length - 1) / 2);
|
|
4373
4373
|
for (let t = 0; t < d.length; t++) {
|
|
4374
4374
|
let n = d[t];
|
|
4375
|
-
|
|
4376
|
-
x: l - Math.floor(
|
|
4375
|
+
Yt(e, {
|
|
4376
|
+
x: l - Math.floor(B(n) / 2),
|
|
4377
4377
|
y: f + t
|
|
4378
4378
|
}, n);
|
|
4379
4379
|
}
|
|
@@ -4381,7 +4381,7 @@ function Oi(e, t, n, r, i = !1) {
|
|
|
4381
4381
|
//#endregion
|
|
4382
4382
|
//#region packages/ascii-renderer/src/draw-bundles.ts
|
|
4383
4383
|
function ki(e, t, n) {
|
|
4384
|
-
let r =
|
|
4384
|
+
let r = X(t), i = 0;
|
|
4385
4385
|
for (let t = 0; t < 2; t++) i += e.columnWidth.get(r.x + t) ?? 0;
|
|
4386
4386
|
let a = 0;
|
|
4387
4387
|
for (let t = 0; t < 2; t++) a += e.rowHeight.get(r.y + t) ?? 0;
|
|
@@ -4408,10 +4408,10 @@ function ki(e, t, n) {
|
|
|
4408
4408
|
if (s === null)
|
|
4409
4409
|
/* v8 ignore next */
|
|
4410
4410
|
throw Error(`Node "${t.name}" has no drawingCoord; grid layout must run before bundled-edge drawing`);
|
|
4411
|
-
return
|
|
4411
|
+
return xr(t.shape, n, o, s);
|
|
4412
4412
|
}
|
|
4413
4413
|
function Ai(e, t, n) {
|
|
4414
|
-
let r =
|
|
4414
|
+
let r = H(e.canvas), i = t.pathToJunction;
|
|
4415
4415
|
if (!i || i.length === 0) return [
|
|
4416
4416
|
r,
|
|
4417
4417
|
r,
|
|
@@ -4420,20 +4420,20 @@ function Ai(e, t, n) {
|
|
|
4420
4420
|
r,
|
|
4421
4421
|
r
|
|
4422
4422
|
];
|
|
4423
|
-
let a =
|
|
4423
|
+
let a = H(e.canvas), o = e.config.useAscii, s = i.map((r, a) => n.type === "fan-in" && a === 0 ? ki(e, t.from, t.startDir) : n.type === "fan-out" && a === i.length - 1 ? ki(e, t.to, t.endDir) : Sr(e, r));
|
|
4424
4424
|
for (let e = 1; e < s.length; e++) {
|
|
4425
4425
|
let n = s[e - 1], r = s[e];
|
|
4426
|
-
|
|
4426
|
+
jn(n, r) || gi(a, n, r, 1, -1, o, t.style);
|
|
4427
4427
|
}
|
|
4428
|
-
let c =
|
|
4428
|
+
let c = H(e.canvas);
|
|
4429
4429
|
for (let t = 1; t < i.length - 1; t++) {
|
|
4430
|
-
let n = i[t], r =
|
|
4431
|
-
l = o ? "+" :
|
|
4430
|
+
let n = i[t], r = Sr(e, n), a = $(i[t - 1], n), s = $(n, i[t + 1]), l;
|
|
4431
|
+
l = o ? "+" : Y(a, J) && Y(s, K) || Y(a, G) && Y(s, q) ? "┐" : Y(a, J) && Y(s, G) || Y(a, K) && Y(s, q) ? "┘" : Y(a, q) && Y(s, K) || Y(a, G) && Y(s, J) ? "┌" : Y(a, q) && Y(s, G) || Y(a, K) && Y(s, J) ? "└" : "+", U(c, r.x, r.y, l);
|
|
4432
4432
|
}
|
|
4433
|
-
let l =
|
|
4433
|
+
let l = H(e.canvas);
|
|
4434
4434
|
if (n.type === "fan-in" && i.length >= 2) {
|
|
4435
4435
|
let e = s[0], t = $(i[0], i[1]), n = o ? "+" : null;
|
|
4436
|
-
|
|
4436
|
+
Y(t, G) ? U(l, e.x, e.y, n ?? "┴") : Y(t, K) ? U(l, e.x, e.y, n ?? "┬") : Y(t, q) ? U(l, e.x, e.y, n ?? "┤") : Y(t, J) && U(l, e.x, e.y, n ?? "├");
|
|
4437
4437
|
}
|
|
4438
4438
|
return [
|
|
4439
4439
|
a,
|
|
@@ -4441,126 +4441,126 @@ function Ai(e, t, n) {
|
|
|
4441
4441
|
r,
|
|
4442
4442
|
r,
|
|
4443
4443
|
c,
|
|
4444
|
-
|
|
4444
|
+
H(e.canvas)
|
|
4445
4445
|
];
|
|
4446
4446
|
}
|
|
4447
4447
|
function ji(e, t) {
|
|
4448
|
-
let n =
|
|
4448
|
+
let n = H(e.canvas), r = H(e.canvas);
|
|
4449
4449
|
if (t.sharedPath.length < 2) return [n, r];
|
|
4450
4450
|
let i = e.config.useAscii, a = t.edges[0]?.style ?? "solid", o = e.config.graphDirection, s = t.sharedPath.map((n, r) => {
|
|
4451
4451
|
if (t.type === "fan-in" && r === t.sharedPath.length - 1) {
|
|
4452
|
-
let n = o === "TD" ?
|
|
4452
|
+
let n = o === "TD" ? G : q;
|
|
4453
4453
|
return ki(e, t.sharedNode, n);
|
|
4454
4454
|
}
|
|
4455
4455
|
if (t.type === "fan-out" && r === 0) {
|
|
4456
|
-
let n = o === "TD" ?
|
|
4456
|
+
let n = o === "TD" ? K : J;
|
|
4457
4457
|
return ki(e, t.sharedNode, n);
|
|
4458
4458
|
}
|
|
4459
|
-
return
|
|
4459
|
+
return Sr(e, n);
|
|
4460
4460
|
});
|
|
4461
4461
|
for (let e = 1; e < s.length; e++) {
|
|
4462
4462
|
let t = s[e - 1], r = s[e];
|
|
4463
|
-
|
|
4463
|
+
jn(t, r) || gi(n, t, r, 1, -1, i, a);
|
|
4464
4464
|
}
|
|
4465
4465
|
for (let n = 1; n < t.sharedPath.length - 1; n++) {
|
|
4466
|
-
let a = t.sharedPath[n], o =
|
|
4467
|
-
l = i ? "+" :
|
|
4466
|
+
let a = t.sharedPath[n], o = Sr(e, a), s = $(t.sharedPath[n - 1], a), c = $(a, t.sharedPath[n + 1]), l;
|
|
4467
|
+
l = i ? "+" : Y(s, J) && Y(c, K) || Y(s, G) && Y(c, q) ? "┐" : Y(s, J) && Y(c, G) || Y(s, K) && Y(c, q) ? "┘" : Y(s, q) && Y(c, K) || Y(s, G) && Y(c, J) ? "┌" : Y(s, q) && Y(c, G) || Y(s, K) && Y(c, J) ? "└" : "+", U(r, o.x, o.y, l);
|
|
4468
4468
|
}
|
|
4469
4469
|
return [n, r];
|
|
4470
4470
|
}
|
|
4471
4471
|
function Mi(e, t) {
|
|
4472
|
-
let n =
|
|
4472
|
+
let n = H(e.canvas);
|
|
4473
4473
|
if (t.sharedPath.length < 2) return n;
|
|
4474
|
-
let r = t.sharedPath.length - 1, i = t.sharedPath[r - 1], a = t.sharedPath[r], o = $(i, a), s = e.config.graphDirection, c = s === "TD" ?
|
|
4474
|
+
let r = t.sharedPath.length - 1, i = t.sharedPath[r - 1], a = t.sharedPath[r], o = $(i, a), s = e.config.graphDirection, c = s === "TD" ? G : q, l = ki(e, t.sharedNode, c);
|
|
4475
4475
|
s === "TD" ? --l.y : --l.x;
|
|
4476
4476
|
let u = t.edges[0]?.endMarker, d = t.edges.every((e) => e.endMarker === u) ? u : void 0, f = Ci(e.config.useAscii, d), p;
|
|
4477
|
-
return p = f === void 0 ? e.config.useAscii ?
|
|
4477
|
+
return p = f === void 0 ? e.config.useAscii ? Y(o, G) ? "^" : Y(o, K) ? "v" : Y(o, q) ? "<" : Y(o, J) ? ">" : "v" : Y(o, G) ? "▲" : Y(o, K) ? "▼" : Y(o, q) ? "◄" : Y(o, J) ? "►" : "▼" : f, U(n, l.x, l.y, p), n;
|
|
4478
4478
|
}
|
|
4479
4479
|
function Ni(e, t) {
|
|
4480
|
-
let n =
|
|
4480
|
+
let n = H(e.canvas);
|
|
4481
4481
|
if (!t.pathToJunction || t.pathToJunction.length < 2) return n;
|
|
4482
|
-
let r = t.pathToJunction.length - 1, i = t.pathToJunction[r - 1], a = t.pathToJunction[r], o = $(i, a), s = e.config.graphDirection, c = s === "TD" ?
|
|
4482
|
+
let r = t.pathToJunction.length - 1, i = t.pathToJunction[r - 1], a = t.pathToJunction[r], o = $(i, a), s = e.config.graphDirection, c = s === "TD" ? G : q, l = ki(e, t.to, c);
|
|
4483
4483
|
s === "TD" ? --l.y : --l.x;
|
|
4484
4484
|
let u = Ci(e.config.useAscii, t.endMarker), d;
|
|
4485
|
-
return d = u === void 0 ? e.config.useAscii ?
|
|
4485
|
+
return d = u === void 0 ? e.config.useAscii ? Y(o, G) ? "^" : Y(o, K) ? "v" : Y(o, q) ? "<" : Y(o, J) ? ">" : "v" : Y(o, G) ? "▲" : Y(o, K) ? "▼" : Y(o, q) ? "◄" : Y(o, J) ? "►" : "▼" : u, U(n, l.x, l.y, d), n;
|
|
4486
4486
|
}
|
|
4487
4487
|
function Pi(e) {
|
|
4488
|
-
return
|
|
4488
|
+
return Y(e, G) ? K : Y(e, K) ? G : Y(e, q) ? J : Y(e, J) ? q : e;
|
|
4489
4489
|
}
|
|
4490
4490
|
function Fi(e, t) {
|
|
4491
|
-
let n =
|
|
4491
|
+
let n = H(e.canvas);
|
|
4492
4492
|
if (t.sharedPath.length < 2) return n;
|
|
4493
|
-
let r = t.sharedPath[0], i = t.sharedPath[1], a = Pi($(r, i)), o = e.config.graphDirection, s = o === "TD" ?
|
|
4493
|
+
let r = t.sharedPath[0], i = t.sharedPath[1], a = Pi($(r, i)), o = e.config.graphDirection, s = o === "TD" ? K : J, c = ki(e, t.sharedNode, s);
|
|
4494
4494
|
o === "TD" ? c.y += 1 : c.x += 1;
|
|
4495
4495
|
let l;
|
|
4496
|
-
return l = e.config.useAscii ?
|
|
4496
|
+
return l = e.config.useAscii ? Y(a, G) ? "^" : Y(a, K) ? "v" : Y(a, q) ? "<" : Y(a, J) ? ">" : "^" : Y(a, G) ? "▲" : Y(a, K) ? "▼" : Y(a, q) ? "◄" : Y(a, J) ? "►" : "▲", U(n, c.x, c.y, l), n;
|
|
4497
4497
|
}
|
|
4498
4498
|
function Ii(e, t) {
|
|
4499
|
-
let n =
|
|
4499
|
+
let n = H(e.canvas);
|
|
4500
4500
|
if (!t.pathToJunction || t.pathToJunction.length < 2) return n;
|
|
4501
4501
|
let r = t.pathToJunction[0], i = t.pathToJunction[1], a = Pi($(r, i)), o = ki(e, t.from, t.startDir);
|
|
4502
|
-
|
|
4502
|
+
Y(t.startDir, G) ? --o.y : Y(t.startDir, K) ? o.y += 1 : Y(t.startDir, q) ? --o.x : Y(t.startDir, J) && (o.x += 1);
|
|
4503
4503
|
let s;
|
|
4504
|
-
return s = e.config.useAscii ?
|
|
4504
|
+
return s = e.config.useAscii ? Y(a, G) ? "^" : Y(a, K) ? "v" : Y(a, q) ? "<" : Y(a, J) ? ">" : "v" : Y(a, G) ? "▲" : Y(a, K) ? "▼" : Y(a, q) ? "◄" : Y(a, J) ? "►" : "▼", U(n, o.x, o.y, s), n;
|
|
4505
4505
|
}
|
|
4506
4506
|
function Li(e, t) {
|
|
4507
|
-
let n =
|
|
4507
|
+
let n = H(e.canvas);
|
|
4508
4508
|
if (!t.junctionPoint) return n;
|
|
4509
|
-
let r =
|
|
4509
|
+
let r = Sr(e, t.junctionPoint), i = e.config.useAscii, a = !1, o = !1, s = !1, c = !1;
|
|
4510
4510
|
if (t.sharedPath.length >= 2) {
|
|
4511
4511
|
let e = t.type === "fan-in" ? 0 : t.sharedPath.length - 1, n = t.type === "fan-in" ? 1 : t.sharedPath.length - 2, r = $(t.sharedPath[e], t.sharedPath[n]);
|
|
4512
|
-
|
|
4512
|
+
Y(r, K) ? o = !0 : Y(r, G) ? a = !0 : Y(r, J) ? c = !0 : Y(r, q) && (s = !0);
|
|
4513
4513
|
}
|
|
4514
4514
|
for (let e of t.edges) if (e.pathToJunction && e.pathToJunction.length >= 2) {
|
|
4515
4515
|
let n = t.type === "fan-in" ? e.pathToJunction.length - 1 : 0, r = t.type === "fan-in" ? e.pathToJunction.length - 2 : 1, i = $(e.pathToJunction[r], e.pathToJunction[n]);
|
|
4516
|
-
|
|
4516
|
+
Y(i, K) ? a = !0 : Y(i, G) ? o = !0 : Y(i, J) ? s = !0 : Y(i, q) && (c = !0);
|
|
4517
4517
|
}
|
|
4518
4518
|
let l;
|
|
4519
|
-
return l = i ? "+" : a && o && s && c ? "┼" : o && s && c && !a ? "┬" : a && s && c && !o ? "┴" : a && o && c && !s ? "├" : a && o && s && !c ? "┤" : s && c ? "─" : a && o ? "│" : o && c ? "┌" : o && s ? "┐" : a && c ? "└" : a && s ? "┘" : "┼",
|
|
4519
|
+
return l = i ? "+" : a && o && s && c ? "┼" : o && s && c && !a ? "┬" : a && s && c && !o ? "┴" : a && o && c && !s ? "├" : a && o && s && !c ? "┤" : s && c ? "─" : a && o ? "│" : o && c ? "┌" : o && s ? "┐" : a && c ? "└" : a && s ? "┘" : "┼", U(n, r.x, r.y, l), n;
|
|
4520
4520
|
}
|
|
4521
4521
|
//#endregion
|
|
4522
4522
|
//#region packages/ascii-renderer/src/draw-subgraphs.ts
|
|
4523
4523
|
function Ri(e, t) {
|
|
4524
4524
|
let n = e.maxX - e.minX, r = e.maxY - e.minY;
|
|
4525
|
-
if (n <= 0 || r <= 0) return
|
|
4525
|
+
if (n <= 0 || r <= 0) return V(0, 0);
|
|
4526
4526
|
let i = {
|
|
4527
4527
|
x: 0,
|
|
4528
4528
|
y: 0
|
|
4529
4529
|
}, a = {
|
|
4530
4530
|
x: n,
|
|
4531
4531
|
y: r
|
|
4532
|
-
}, o =
|
|
4532
|
+
}, o = V(n, r);
|
|
4533
4533
|
if (t.config.useAscii) {
|
|
4534
|
-
for (let e = i.x + 1; e < a.x; e++)
|
|
4535
|
-
for (let e = i.x + 1; e < a.x; e++)
|
|
4536
|
-
for (let e = i.y + 1; e < a.y; e++)
|
|
4537
|
-
for (let e = i.y + 1; e < a.y; e++)
|
|
4538
|
-
|
|
4534
|
+
for (let e = i.x + 1; e < a.x; e++) U(o, e, i.y, "-");
|
|
4535
|
+
for (let e = i.x + 1; e < a.x; e++) U(o, e, a.y, "-");
|
|
4536
|
+
for (let e = i.y + 1; e < a.y; e++) U(o, i.x, e, "|");
|
|
4537
|
+
for (let e = i.y + 1; e < a.y; e++) U(o, a.x, e, "|");
|
|
4538
|
+
U(o, i.x, i.y, "+"), U(o, a.x, i.y, "+"), U(o, i.x, a.y, "+"), U(o, a.x, a.y, "+");
|
|
4539
4539
|
} else {
|
|
4540
|
-
for (let e = i.x + 1; e < a.x; e++)
|
|
4541
|
-
for (let e = i.x + 1; e < a.x; e++)
|
|
4542
|
-
for (let e = i.y + 1; e < a.y; e++)
|
|
4543
|
-
for (let e = i.y + 1; e < a.y; e++)
|
|
4544
|
-
|
|
4540
|
+
for (let e = i.x + 1; e < a.x; e++) U(o, e, i.y, "─");
|
|
4541
|
+
for (let e = i.x + 1; e < a.x; e++) U(o, e, a.y, "─");
|
|
4542
|
+
for (let e = i.y + 1; e < a.y; e++) U(o, i.x, e, "│");
|
|
4543
|
+
for (let e = i.y + 1; e < a.y; e++) U(o, a.x, e, "│");
|
|
4544
|
+
U(o, i.x, i.y, "┌"), U(o, a.x, i.y, "┐"), U(o, i.x, a.y, "└"), U(o, a.x, a.y, "┘");
|
|
4545
4545
|
}
|
|
4546
4546
|
return o;
|
|
4547
4547
|
}
|
|
4548
4548
|
function zi(e, t) {
|
|
4549
4549
|
let n = e.maxX - e.minX, r = e.maxY - e.minY;
|
|
4550
4550
|
if (n <= 0 || r <= 0) return [
|
|
4551
|
-
|
|
4551
|
+
V(0, 0),
|
|
4552
4552
|
{
|
|
4553
4553
|
x: 0,
|
|
4554
4554
|
y: 0
|
|
4555
4555
|
},
|
|
4556
4556
|
[]
|
|
4557
4557
|
];
|
|
4558
|
-
let i =
|
|
4558
|
+
let i = V(n, r), a = [], o = Z(e.name);
|
|
4559
4559
|
for (let e = 0; e < o.length; e++) {
|
|
4560
|
-
let t = o[e], s = 1 + e, c = 1 + Math.ceil((n - 1 -
|
|
4560
|
+
let t = o[e], s = 1 + e, c = 1 + Math.ceil((n - 1 - B(t)) / 2);
|
|
4561
4561
|
c < 1 && (c = 1);
|
|
4562
|
-
let l =
|
|
4563
|
-
for (let e = 0; e < l.length; e++) c + e >= n || s >= r || (
|
|
4562
|
+
let l = Nt(t);
|
|
4563
|
+
for (let e = 0; e < l.length; e++) c + e >= n || s >= r || (U(i, c + e, s, l[e]), a.push({
|
|
4564
4564
|
x: c + e,
|
|
4565
4565
|
y: s
|
|
4566
4566
|
}));
|
|
@@ -4580,7 +4580,7 @@ function Bi(e, t) {
|
|
|
4580
4580
|
return Vi(e, t);
|
|
4581
4581
|
}
|
|
4582
4582
|
function Vi(e, t) {
|
|
4583
|
-
let n =
|
|
4583
|
+
let n = X(e), r = t.config.useAscii, i = 0;
|
|
4584
4584
|
for (let e = 0; e < 2; e++) i += t.columnWidth.get(n.x + e) ?? 0;
|
|
4585
4585
|
let a = 0;
|
|
4586
4586
|
for (let e = 0; e < 2; e++) a += t.rowHeight.get(n.y + e) ?? 0;
|
|
@@ -4590,7 +4590,7 @@ function Vi(e, t) {
|
|
|
4590
4590
|
}, s = {
|
|
4591
4591
|
x: i,
|
|
4592
4592
|
y: a
|
|
4593
|
-
}, c =
|
|
4593
|
+
}, c = V(Math.max(o.x, s.x), Math.max(o.y, s.y)), l = pr(e.shape, r), u = e.shape === "state-end", d = r ? u ? "=" : "-" : u ? "═" : "─", f = r ? u ? "‖" : "|" : u ? "║" : "│", p = u ? r ? {
|
|
4594
4594
|
tl: "#",
|
|
4595
4595
|
tr: "#",
|
|
4596
4596
|
bl: "#",
|
|
@@ -4601,15 +4601,15 @@ function Vi(e, t) {
|
|
|
4601
4601
|
bl: "╚",
|
|
4602
4602
|
br: "╝"
|
|
4603
4603
|
} : l;
|
|
4604
|
-
for (let e = o.x + 1; e < s.x; e++)
|
|
4605
|
-
for (let e = o.x + 1; e < s.x; e++)
|
|
4606
|
-
for (let e = o.y + 1; e < s.y; e++)
|
|
4607
|
-
for (let e = o.y + 1; e < s.y; e++)
|
|
4608
|
-
|
|
4609
|
-
let m = e.displayLabel, h =
|
|
4604
|
+
for (let e = o.x + 1; e < s.x; e++) U(c, e, o.y, d);
|
|
4605
|
+
for (let e = o.x + 1; e < s.x; e++) U(c, e, s.y, d);
|
|
4606
|
+
for (let e = o.y + 1; e < s.y; e++) U(c, o.x, e, f);
|
|
4607
|
+
for (let e = o.y + 1; e < s.y; e++) U(c, s.x, e, f);
|
|
4608
|
+
U(c, o.x, o.y, p.tl), U(c, s.x, o.y, p.tr), U(c, o.x, s.y, p.bl), U(c, s.x, s.y, p.br);
|
|
4609
|
+
let m = e.displayLabel, h = Z(m), g = o.y + Math.floor(a / 2) - Math.floor((h.length - 1) / 2);
|
|
4610
4610
|
for (let e = 0; e < h.length; e++) {
|
|
4611
|
-
let t = h[e], n =
|
|
4612
|
-
for (let t = 0; t < a.length; t++)
|
|
4611
|
+
let t = h[e], n = B(t), r = o.x + Math.floor(i / 2) - Math.ceil(n / 2) + 1, a = Nt(t);
|
|
4612
|
+
for (let t = 0; t < a.length; t++) U(c, r + t, g + e, a[t]);
|
|
4613
4613
|
}
|
|
4614
4614
|
return c;
|
|
4615
4615
|
}
|
|
@@ -4621,7 +4621,7 @@ function Ui(e) {
|
|
|
4621
4621
|
}
|
|
4622
4622
|
function Wi(e, t = 1) {
|
|
4623
4623
|
let n = Math.max(0, t), r = 0;
|
|
4624
|
-
for (let t of e) for (let e of t) r = Math.max(r,
|
|
4624
|
+
for (let t of e) for (let e of t) r = Math.max(r, B(e));
|
|
4625
4625
|
let i = 0;
|
|
4626
4626
|
for (let t of e) i += Math.max(t.length, 1);
|
|
4627
4627
|
return {
|
|
@@ -4630,25 +4630,25 @@ function Wi(e, t = 1) {
|
|
|
4630
4630
|
};
|
|
4631
4631
|
}
|
|
4632
4632
|
function Gi(e, t, n = 1) {
|
|
4633
|
-
let r = Math.max(0, n), { width: i, height: a } = Wi(e, r), o = t ? "-" : "─", s = t ? "|" : "│", c = t ? "+" : "┌", l = t ? "+" : "┐", u = t ? "+" : "└", d = t ? "+" : "┘", f = t ? "+" : "├", p = t ? "+" : "┤", m =
|
|
4634
|
-
|
|
4635
|
-
for (let e = 1; e < i - 1; e++)
|
|
4636
|
-
|
|
4637
|
-
for (let e = 1; e < i - 1; e++)
|
|
4638
|
-
|
|
4639
|
-
for (let e = 1; e < a - 1; e++)
|
|
4633
|
+
let r = Math.max(0, n), { width: i, height: a } = Wi(e, r), o = t ? "-" : "─", s = t ? "|" : "│", c = t ? "+" : "┌", l = t ? "+" : "┐", u = t ? "+" : "└", d = t ? "+" : "┘", f = t ? "+" : "├", p = t ? "+" : "┤", m = V(i - 1, a - 1);
|
|
4634
|
+
U(m, 0, 0, c);
|
|
4635
|
+
for (let e = 1; e < i - 1; e++) U(m, e, 0, o);
|
|
4636
|
+
U(m, i - 1, 0, l), U(m, 0, a - 1, u);
|
|
4637
|
+
for (let e = 1; e < i - 1; e++) U(m, e, a - 1, o);
|
|
4638
|
+
U(m, i - 1, a - 1, d);
|
|
4639
|
+
for (let e = 1; e < a - 1; e++) U(m, 0, e, s), U(m, i - 1, e, s);
|
|
4640
4640
|
let h = 1;
|
|
4641
4641
|
for (let t = 0; t < e.length; t++) {
|
|
4642
4642
|
let n = e[t], a = n.length > 0 ? n : [""];
|
|
4643
4643
|
for (let e of a) {
|
|
4644
|
-
let t = 1 + r, n =
|
|
4645
|
-
for (let e = 0; e < n.length; e++)
|
|
4644
|
+
let t = 1 + r, n = Nt(e);
|
|
4645
|
+
for (let e = 0; e < n.length; e++) U(m, t + e, h, n[e]);
|
|
4646
4646
|
h++;
|
|
4647
4647
|
}
|
|
4648
4648
|
if (t < e.length - 1) {
|
|
4649
|
-
|
|
4650
|
-
for (let e = 1; e < i - 1; e++)
|
|
4651
|
-
|
|
4649
|
+
U(m, 0, h, f);
|
|
4650
|
+
for (let e = 1; e < i - 1; e++) U(m, e, h, o);
|
|
4651
|
+
U(m, i - 1, h, p), h++;
|
|
4652
4652
|
}
|
|
4653
4653
|
}
|
|
4654
4654
|
return m;
|
|
@@ -4667,7 +4667,7 @@ function qi(e, t, n, r) {
|
|
|
4667
4667
|
let o = t[i]?.[a];
|
|
4668
4668
|
if (o && o !== " ") {
|
|
4669
4669
|
let t = i + n.x, o = a + n.y;
|
|
4670
|
-
t >= 0 && o >= 0 &&
|
|
4670
|
+
t >= 0 && o >= 0 && It(e, t, o, r);
|
|
4671
4671
|
}
|
|
4672
4672
|
}
|
|
4673
4673
|
}
|
|
@@ -4680,7 +4680,7 @@ function Yi(e, t, n) {
|
|
|
4680
4680
|
let o = t[i]?.[a];
|
|
4681
4681
|
if (o && o !== " ") {
|
|
4682
4682
|
let t = i + n.x, s = a + n.y;
|
|
4683
|
-
t >= 0 && s >= 0 &&
|
|
4683
|
+
t >= 0 && s >= 0 && It(e, t, s, r(o) ? "border" : "text");
|
|
4684
4684
|
}
|
|
4685
4685
|
}
|
|
4686
4686
|
}
|
|
@@ -4694,9 +4694,9 @@ function Xi(e) {
|
|
|
4694
4694
|
x: n.minX,
|
|
4695
4695
|
y: n.minY
|
|
4696
4696
|
};
|
|
4697
|
-
e.canvas =
|
|
4697
|
+
e.canvas = Wt(e.canvas, i, t, r), qi(e.roleCanvas, r, i, "border");
|
|
4698
4698
|
}
|
|
4699
|
-
for (let n of e.nodes) !n.drawn && n.drawingCoord && n.drawing && (e.canvas =
|
|
4699
|
+
for (let n of e.nodes) !n.drawn && n.drawingCoord && n.drawing && (e.canvas = Wt(e.canvas, n.drawingCoord, t, n.drawing), Yi(e.roleCanvas, n.drawing, n.drawingCoord), n.drawn = !0);
|
|
4700
4700
|
let i = [], a = [], o = [], s = [], c = [], l = [], u = [], d = /* @__PURE__ */ new Set();
|
|
4701
4701
|
for (let t of e.edges) if (t.bundle && t.pathToJunction) {
|
|
4702
4702
|
let n = t.bundle, [r, f, , , p, m] = Ai(e, t, n);
|
|
@@ -4726,14 +4726,14 @@ function Xi(e) {
|
|
|
4726
4726
|
let [n, r, u, d, f, p] = _i(e, t);
|
|
4727
4727
|
i.push(n), a.push(f), o.push(u), s.push(d), c.push(r), l.push(p);
|
|
4728
4728
|
}
|
|
4729
|
-
e.canvas =
|
|
4729
|
+
e.canvas = Wt(e.canvas, n, t, ...i), Ji(e.roleCanvas, i, n, "line"), e.canvas = Wt(e.canvas, n, t, ...a), Ji(e.roleCanvas, a, n, "corner"), e.canvas = Wt(e.canvas, n, t, ...u), Ji(e.roleCanvas, u, n, "junction"), e.canvas = Wt(e.canvas, n, t, ...o), Ji(e.roleCanvas, o, n, "arrow"), e.canvas = Wt(e.canvas, n, t, ...c), Ji(e.roleCanvas, c, n, "junction"), e.canvas = Wt(e.canvas, n, t, ...s), Ji(e.roleCanvas, s, n, "arrow"), e.canvas = Wt(e.canvas, n, t, ...l), Ji(e.roleCanvas, l, n, "text");
|
|
4730
4730
|
for (let n of e.subgraphs) {
|
|
4731
4731
|
if (n.nodes.length === 0) continue;
|
|
4732
4732
|
let [r, i, a] = zi(n, e);
|
|
4733
|
-
e.canvas =
|
|
4733
|
+
e.canvas = Wt(e.canvas, i, t, r), qi(e.roleCanvas, r, i, "text");
|
|
4734
4734
|
for (let { x: t, y: n } of a) {
|
|
4735
4735
|
let a = r[t]?.[n];
|
|
4736
|
-
a === " " && (
|
|
4736
|
+
a === " " && (U(e.canvas, t + i.x, n + i.y, a), It(e.roleCanvas, t + i.x, n + i.y, "text"));
|
|
4737
4737
|
}
|
|
4738
4738
|
}
|
|
4739
4739
|
return e.canvas;
|
|
@@ -4756,7 +4756,7 @@ function Qi(e) {
|
|
|
4756
4756
|
return `${e.keys.length > 0 ? e.keys.join(",") + " " : " "}${e.type} ${e.name}`;
|
|
4757
4757
|
}
|
|
4758
4758
|
function $i(e) {
|
|
4759
|
-
let t =
|
|
4759
|
+
let t = Z(e.label), n = e.attributes.map(Qi);
|
|
4760
4760
|
return n.length === 0 ? [t] : [t, n];
|
|
4761
4761
|
}
|
|
4762
4762
|
function ea(e, t, n = !1, r = !1) {
|
|
@@ -4801,9 +4801,9 @@ function na(e, t, n) {
|
|
|
4801
4801
|
return r;
|
|
4802
4802
|
}
|
|
4803
4803
|
function ra(e, t, n, r) {
|
|
4804
|
-
let i =
|
|
4804
|
+
let i = _e(_(e));
|
|
4805
4805
|
if (i.entities.length === 0) return "";
|
|
4806
|
-
let a = t.useAscii, o =
|
|
4806
|
+
let a = t.useAscii, o = kn(t.paddingX, 5, 6, 6), s = kn(t.paddingY, 5, 4, 2), c = kn(t.paddingY, 5, 2, 1), l = Math.max(...[
|
|
4807
4807
|
"one",
|
|
4808
4808
|
"zero-one",
|
|
4809
4809
|
"many",
|
|
@@ -4819,7 +4819,7 @@ function ra(e, t, n, r) {
|
|
|
4819
4819
|
let m = /* @__PURE__ */ new Map();
|
|
4820
4820
|
for (let e of i.relationships) {
|
|
4821
4821
|
if (!e.label) continue;
|
|
4822
|
-
let t = [e.entity1, e.entity2].sort().join("|"), n =
|
|
4822
|
+
let t = [e.entity1, e.entity2].sort().join("|"), n = ur(e.label);
|
|
4823
4823
|
m.set(t, Math.max(m.get(t) ?? 0, n));
|
|
4824
4824
|
}
|
|
4825
4825
|
let h = ta(i), g = /* @__PURE__ */ new Map(), v = 0;
|
|
@@ -4847,9 +4847,9 @@ function ra(e, t, n, r) {
|
|
|
4847
4847
|
let y = 0, b = 0;
|
|
4848
4848
|
for (let e of g.values()) y = Math.max(y, e.x + e.width), b = Math.max(b, e.y + e.height);
|
|
4849
4849
|
y += 4, b += 2;
|
|
4850
|
-
let x =
|
|
4850
|
+
let x = V(y - 1, b - 1), S = Pt(y - 1, b - 1);
|
|
4851
4851
|
function C(e, t, n, r) {
|
|
4852
|
-
|
|
4852
|
+
U(x, e, t, n, {
|
|
4853
4853
|
role: r,
|
|
4854
4854
|
roleCanvas: S
|
|
4855
4855
|
});
|
|
@@ -4956,13 +4956,13 @@ function ra(e, t, n, r) {
|
|
|
4956
4956
|
if (v === void 0) {
|
|
4957
4957
|
for (let e = m; e <= h; e++) ee(e, _, r, "line");
|
|
4958
4958
|
if (j = _ + 1, e.label) {
|
|
4959
|
-
let t = m + b, n = h - b, r =
|
|
4959
|
+
let t = m + b, n = h - b, r = Z(e.label).length, i = _ + 1 + Math.max(s - 1, 1);
|
|
4960
4960
|
for (; j < i && !k(t, n, j, j + r - 1);) j++;
|
|
4961
4961
|
}
|
|
4962
4962
|
} else {
|
|
4963
|
-
let t = Math.max(c.y + c.height, d.y + d.height, v), n = e.label ?
|
|
4963
|
+
let t = Math.max(c.y + c.height, d.y + d.height, v), n = e.label ? Z(e.label).length : 0, a = t + 1, o = t + Math.max(s * 3, 4);
|
|
4964
4964
|
for (; a < o && !k(m, h, a, a + n);) a++;
|
|
4965
|
-
|
|
4965
|
+
Rt(x, h + 1, a + n + 1), Ft(S, h + 1, a + n + 1);
|
|
4966
4966
|
for (let e = _; e <= a; e++) O(m, e, i, "line"), O(h, e, i, "line");
|
|
4967
4967
|
for (let e = m; e <= h; e++) ee(e, a, r, "line");
|
|
4968
4968
|
m !== h && (F(m, a, "up", "right"), F(h, a, "up", "left")), j = a + 1;
|
|
@@ -4970,10 +4970,10 @@ function ra(e, t, n, r) {
|
|
|
4970
4970
|
for (let e = 0; e < C.length; e++) O(A + e, _, C[e], "arrow");
|
|
4971
4971
|
for (let e = 0; e < w.length; e++) O(te - w.length + 1 + e, _, w[e], "arrow");
|
|
4972
4972
|
if (e.label) {
|
|
4973
|
-
let t =
|
|
4973
|
+
let t = Z(e.label), n = Math.floor((m + h) / 2), r = m + b, i = h - b;
|
|
4974
4974
|
for (let e = 0; e < t.length; e++) {
|
|
4975
|
-
let a = t[e], o =
|
|
4976
|
-
if (
|
|
4975
|
+
let a = t[e], o = Nt(a), s = Math.max(r, n - Math.floor(o.length / 2)), c = j + e;
|
|
4976
|
+
if (Rt(x, Math.max(s + o.length, 1), Math.max(c + 1, 1)), Ft(S, Math.max(s + o.length, 1), Math.max(c + 1, 1)), T(o, s, c, r, i)) for (let e = 0; e < o.length; e++) {
|
|
4977
4977
|
let t = s + e;
|
|
4978
4978
|
t >= r && t <= i && O(t, c, o[e], "text");
|
|
4979
4979
|
}
|
|
@@ -4992,8 +4992,8 @@ function ra(e, t, n, r) {
|
|
|
4992
4992
|
for (let r = T; r <= A; r++) if (k(e, t, r, r + n)) return r;
|
|
4993
4993
|
return r;
|
|
4994
4994
|
}
|
|
4995
|
-
let N = m !== h, re = Math.min(m, h), ie = Math.max(m, h), P = N ? ne(re, ie, 0) : p,
|
|
4996
|
-
if (
|
|
4995
|
+
let N = m !== h, re = Math.min(m, h), ie = Math.max(m, h), P = N ? ne(re, ie, 0) : p, se = N ? P - 1 : p, ce = !_(m, T, A) || !_(h, T, A) || te(m, f, N ? P : p) || N && te(h, P, p), L = m;
|
|
4996
|
+
if (ce) {
|
|
4997
4997
|
let e = x.length, t;
|
|
4998
4998
|
for (let n = 0; n <= e; n++) {
|
|
4999
4999
|
let e = m + n;
|
|
@@ -5007,38 +5007,38 @@ function ra(e, t, n, r) {
|
|
|
5007
5007
|
break;
|
|
5008
5008
|
}
|
|
5009
5009
|
}
|
|
5010
|
-
|
|
5010
|
+
L = t ?? m;
|
|
5011
5011
|
for (let e = f; e <= v; e++) O(m, e, i, "line");
|
|
5012
|
-
for (let e = Math.min(m,
|
|
5013
|
-
for (let e = v; e <= y; e++) O(
|
|
5014
|
-
for (let e = Math.min(
|
|
5012
|
+
for (let e = Math.min(m, L); e <= Math.max(m, L); e++) ee(e, v, r, "line");
|
|
5013
|
+
for (let e = v; e <= y; e++) O(L, e, i, "line");
|
|
5014
|
+
for (let e = Math.min(L, h); e <= Math.max(L, h); e++) ee(e, y, r, "line");
|
|
5015
5015
|
for (let e = y; e <= p; e++) O(h, e, i, "line");
|
|
5016
|
-
if (m !==
|
|
5017
|
-
let e =
|
|
5018
|
-
F(m, v, "up", e), F(
|
|
5016
|
+
if (m !== L) {
|
|
5017
|
+
let e = L > m ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
5018
|
+
F(m, v, "up", e), F(L, v, "down", t);
|
|
5019
5019
|
}
|
|
5020
|
-
if (
|
|
5021
|
-
let e = h >
|
|
5022
|
-
F(
|
|
5020
|
+
if (L !== h) {
|
|
5021
|
+
let e = h > L ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
5022
|
+
F(L, y, "up", e), F(h, y, "down", t);
|
|
5023
5023
|
}
|
|
5024
|
-
M(
|
|
5024
|
+
M(L, v, y);
|
|
5025
5025
|
} else {
|
|
5026
|
-
for (let e = f; e <=
|
|
5027
|
-
if (M(m, f, N ? P :
|
|
5026
|
+
for (let e = f; e <= se; e++) O(m, e, i, "line");
|
|
5027
|
+
if (M(m, f, N ? P : se), N) {
|
|
5028
5028
|
for (let e = re; e <= ie; e++) ee(e, P, r, "line");
|
|
5029
5029
|
for (let e = P + 1; e <= p; e++) O(h, e, i, "line");
|
|
5030
5030
|
M(h, P, p);
|
|
5031
5031
|
let e = h > m ? "right" : "left", t = e === "right" ? "left" : "right";
|
|
5032
|
-
F(m, P, "up", e), F(h, P, "down", t),
|
|
5032
|
+
F(m, P, "up", e), F(h, P, "down", t), L = h;
|
|
5033
5033
|
}
|
|
5034
5034
|
}
|
|
5035
|
-
let
|
|
5036
|
-
for (let e = 0; e <
|
|
5037
|
-
let
|
|
5038
|
-
for (let e = 0; e <
|
|
5035
|
+
let le = ea(l, a, !1, !0);
|
|
5036
|
+
for (let e = 0; e < le.length; e++) O(m - Math.floor(le.length / 2) + e, v, le[e], "arrow");
|
|
5037
|
+
let ue = m === h ? m : h, de = ea(u, a, !0, !0);
|
|
5038
|
+
for (let e = 0; e < de.length; e++) O(ue - Math.floor(de.length / 2) + e, y, de[e], "arrow");
|
|
5039
5039
|
if (e.label) {
|
|
5040
|
-
let t =
|
|
5041
|
-
a >= 0 && (
|
|
5040
|
+
let t = Z(e.label), n = Math.max(le.length - 1 - Math.floor(le.length / 2), de.length - 1 - Math.floor(de.length / 2)), r = L + n + 2, i = t.map((e) => Nt(e)), a = r + Math.max(...i.map((e) => e.length)) - 1, o = t.length, s = Math.floor((f + p) / 2) - Math.floor((o - 1) / 2);
|
|
5041
|
+
a >= 0 && (Rt(x, a + 1, p + 1), Ft(S, a + 1, p + 1));
|
|
5042
5042
|
let c = null;
|
|
5043
5043
|
for (let e = 0; e <= p - f && c === null; e++) {
|
|
5044
5044
|
let t = e === 0 ? [s] : [s + e, s - e];
|
|
@@ -5060,7 +5060,7 @@ function ra(e, t, n, r) {
|
|
|
5060
5060
|
}
|
|
5061
5061
|
}
|
|
5062
5062
|
}
|
|
5063
|
-
return
|
|
5063
|
+
return Gt(x, {
|
|
5064
5064
|
roleCanvas: S,
|
|
5065
5065
|
colorMode: n,
|
|
5066
5066
|
theme: r
|
|
@@ -5077,7 +5077,7 @@ function ca(e) {
|
|
|
5077
5077
|
return e.seqNumber === void 0 ? ia : ia + String(e.seqNumber).length;
|
|
5078
5078
|
}
|
|
5079
5079
|
function la(e, t, n, r) {
|
|
5080
|
-
let i =
|
|
5080
|
+
let i = Ae(_(e));
|
|
5081
5081
|
if (i.actors.length === 0) return "";
|
|
5082
5082
|
let a = t.useAscii, o = a ? "-" : "─", s = a ? "|" : "│", c = a ? "+" : "┌", l = a ? "+" : "┐", u = a ? "+" : "└", d = a ? "+" : "┘", f = a ? "+" : "┬", p = a ? "+" : "┴", m = a ? "+" : "├", h = a ? "+" : "┤", g = /* @__PURE__ */ new Map();
|
|
5083
5083
|
i.actors.forEach((e, t) => g.set(e.id, t));
|
|
@@ -5089,11 +5089,11 @@ function la(e, t, n, r) {
|
|
|
5089
5089
|
return t;
|
|
5090
5090
|
}
|
|
5091
5091
|
function y(e) {
|
|
5092
|
-
let t =
|
|
5093
|
-
for (let n of e.dividers) n.label && (t = Math.max(t,
|
|
5092
|
+
let t = ur(e.label ? `${e.type} [${e.label}]` : e.type);
|
|
5093
|
+
for (let n of e.dividers) n.label && (t = Math.max(t, ur(`[${n.label}]`)));
|
|
5094
5094
|
return t;
|
|
5095
5095
|
}
|
|
5096
|
-
let b = Math.max(0, t.boxBorderPadding), x = (e) => Math.max(
|
|
5096
|
+
let b = Math.max(0, t.boxBorderPadding), x = (e) => Math.max(ur(e.label), e.type === "actor" ? oa : 0), S = (e) => dr(e.label) + (e.type === "actor" ? aa.length : 0), C = i.actors.map((e) => x(e) + 2 * b + 2), w = C.map((e) => Math.ceil(e / 2)), T = i.actors.map((e) => S(e) + 2), E = Math.max(...T, 3), D = (e, t) => t - Math.floor(C[e] / 2), O = Math.floor((E - 1) / 2), ee = E - 1 - O, k = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
|
|
5097
5097
|
i.actors.forEach((e, t) => {
|
|
5098
5098
|
e.createdAt !== void 0 && k.set(e.createdAt, t), e.destroyedAt !== void 0 && A.set(e.destroyedAt, t);
|
|
5099
5099
|
});
|
|
@@ -5104,32 +5104,34 @@ function la(e, t, n, r) {
|
|
|
5104
5104
|
lo: Math.min(...t),
|
|
5105
5105
|
hi: Math.max(...t)
|
|
5106
5106
|
};
|
|
5107
|
-
}), ne = M.length > 0, N = i.actors.map((e, t) => M.findIndex((e) => e.lo <= t && t <= e.hi)), re = +!!ne, ie = (e) => e === "" ? 0 :
|
|
5107
|
+
}), ne = M.length > 0, N = i.actors.map((e, t) => M.findIndex((e) => e.lo <= t && t <= e.hi)), re = +!!ne, ie = (e) => e === "" ? 0 : ur(e) + 6, P = Array(Math.max(i.actors.length - 1, 0)).fill(0);
|
|
5108
5108
|
for (let e of i.messages) {
|
|
5109
5109
|
let t = v(e.from), n = v(e.to);
|
|
5110
5110
|
if (t === n) continue;
|
|
5111
|
-
let r = Math.min(t, n), i = Math.max(t, n), a =
|
|
5111
|
+
let r = Math.min(t, n), i = Math.max(t, n), a = ur(e.label) + 4, o = i - r, s = Math.ceil(a / o);
|
|
5112
5112
|
for (let e = r; e < i; e++) P[e] = Math.max(P[e], s);
|
|
5113
5113
|
}
|
|
5114
5114
|
function F(e) {
|
|
5115
|
-
let t =
|
|
5116
|
-
return Math.max(...t.map((e) =>
|
|
5115
|
+
let t = Z(e.text);
|
|
5116
|
+
return Math.max(...t.map((e) => B(e))) + 2 + 2 * b;
|
|
5117
5117
|
}
|
|
5118
|
-
let I = Array(i.actors.length).fill(0), ae = Array(i.actors.length).fill(0);
|
|
5119
|
-
for (let e of i.notes) {
|
|
5120
|
-
|
|
5121
|
-
let t = g.get(e.actorIds[0]) ?? 0, n = F(e);
|
|
5118
|
+
let I = Array(i.actors.length).fill(0), ae = Array(i.actors.length).fill(0), oe = Array(i.actors.length).fill(0), se = Array(i.actors.length).fill(0);
|
|
5119
|
+
for (let e of i.notes) if (e.position === "left" || e.position === "right") {
|
|
5120
|
+
let t = v(e.actorIds[0]), n = F(e);
|
|
5122
5121
|
e.position === "left" ? I[t] = Math.max(I[t], n) : ae[t] = Math.max(ae[t], n);
|
|
5122
|
+
} else if (e.position === "over" && e.actorIds.length === 1) {
|
|
5123
|
+
let t = v(e.actorIds[0]), n = F(e), r = Math.floor(n / 2), i = n - r;
|
|
5124
|
+
oe[t] = Math.max(oe[t], r), se[t] = Math.max(se[t], i);
|
|
5123
5125
|
}
|
|
5124
|
-
let
|
|
5126
|
+
let ce = kn(t.paddingX, 5, 10, 4), L = [Math.max(w[0] + (N[0] === -1 ? 0 : 2), I[0] + 1, oe[0])];
|
|
5125
5127
|
for (let e = 1; e < i.actors.length; e++) {
|
|
5126
|
-
let t = N[e - 1], n = N[e], r = t === n ? 0 : (t === -1 ? 0 : 1) + (n === -1 ? 0 : 1), i = r === 0 ? 0 : r * 2 - 1, a = Math.max(ae[e - 1], I[e]) + 2, o = Math.max(w[e - 1] + w[e] + 2 + i, P[e - 1] + 2, a,
|
|
5128
|
+
let t = N[e - 1], n = N[e], r = t === n ? 0 : (t === -1 ? 0 : 1) + (n === -1 ? 0 : 1), i = r === 0 ? 0 : r * 2 - 1, a = Math.max(ae[e - 1], I[e], se[e - 1], oe[e]) + 2, o = Math.max(w[e - 1] + w[e] + 2 + i, P[e - 1] + 2, a, ce);
|
|
5127
5129
|
L[e] = L[e - 1] + o;
|
|
5128
5130
|
}
|
|
5129
|
-
let
|
|
5131
|
+
let le = (e) => D(e.lo, L[e.lo]) - 1 - 1, ue = (e) => Math.max(D(e.hi, L[e.hi]) + C[e.hi] - 1 + 1 + 1, le(e) + ie(e.label) - 1);
|
|
5130
5132
|
for (let e of M) {
|
|
5131
5133
|
if (e.hi + 1 >= i.actors.length) continue;
|
|
5132
|
-
let t = D(e.hi + 1, L[e.hi + 1]), n = N[e.hi + 1] === -1 ? 0 : 2, r =
|
|
5134
|
+
let t = D(e.hi + 1, L[e.hi + 1]), n = N[e.hi + 1] === -1 ? 0 : 2, r = ue(e) + 1 + 1 + n - t;
|
|
5133
5135
|
if (r > 0) {
|
|
5134
5136
|
let t = L.slice(e.hi + 1).map((e) => e + r);
|
|
5135
5137
|
L.splice(e.hi + 1, t.length, ...t);
|
|
@@ -5140,7 +5142,7 @@ function la(e, t, n, r) {
|
|
|
5140
5142
|
for (let o = e.startIndex; o <= e.endIndex && !(o >= i.messages.length); o++) {
|
|
5141
5143
|
let e = i.messages[o], s = v(e.from), c = v(e.to);
|
|
5142
5144
|
if (t = t === -1 ? Math.min(s, c) : Math.min(t, s, c), n = Math.max(n, s, c), r = Math.min(r, L[Math.min(s, c)]), a = Math.max(a, L[Math.max(s, c)]), s === c) {
|
|
5143
|
-
let t = L[s] + ia + 2 +
|
|
5145
|
+
let t = L[s] + ia + 2 + ur(e.label);
|
|
5144
5146
|
a = Math.max(a, t);
|
|
5145
5147
|
}
|
|
5146
5148
|
}
|
|
@@ -5151,239 +5153,239 @@ function la(e, t, n, r) {
|
|
|
5151
5153
|
L.splice(n + 1, e.length, ...e);
|
|
5152
5154
|
}
|
|
5153
5155
|
}
|
|
5154
|
-
let
|
|
5156
|
+
let de = [], fe = [], pe = /* @__PURE__ */ new Map(), me = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map(), ge = [], _e = re, ve = _e + E, R = ve + re, ye = kn(t.paddingY, 5, 1, 0), be = Math.max(ye, 1);
|
|
5155
5157
|
for (let e of i.notes) {
|
|
5156
5158
|
if (e.afterIndex !== -1) continue;
|
|
5157
|
-
|
|
5158
|
-
let t =
|
|
5159
|
+
R += ye;
|
|
5160
|
+
let t = Z(e.text), n = F(e), r = t.length + 2, i = g.get(e.actorIds[0]) ?? 0, a;
|
|
5159
5161
|
if (e.position === "left") a = L[i] - n - 1;
|
|
5160
5162
|
else if (e.position === "right") a = L[i] + 2;
|
|
5161
5163
|
else if (e.actorIds.length >= 2) {
|
|
5162
5164
|
let t = g.get(e.actorIds[1]) ?? i;
|
|
5163
5165
|
a = Math.floor((L[i] + L[t]) / 2) - Math.floor(n / 2);
|
|
5164
5166
|
} else a = L[i] - Math.floor(n / 2);
|
|
5165
|
-
a = Math.max(0, a),
|
|
5167
|
+
a = Math.max(0, a), ge.push({
|
|
5166
5168
|
x: a,
|
|
5167
|
-
y:
|
|
5169
|
+
y: R,
|
|
5168
5170
|
width: n,
|
|
5169
5171
|
height: r,
|
|
5170
5172
|
lines: t
|
|
5171
|
-
}),
|
|
5173
|
+
}), R += r;
|
|
5172
5174
|
}
|
|
5173
5175
|
for (let e = 0; e < i.messages.length; e++) {
|
|
5174
|
-
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].startIndex === e && (
|
|
5175
|
-
for (let t = 0; t < i.blocks.length; t++) for (let n = 0; n < i.blocks[t].dividers.length; n++) i.blocks[t].dividers[n].index === e && (
|
|
5176
|
-
|
|
5177
|
-
let t = i.messages[e], n = t.from === t.to, r =
|
|
5178
|
-
if (n)
|
|
5176
|
+
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].startIndex === e && (R += ye + 1, pe.set(t, R - 1));
|
|
5177
|
+
for (let t = 0; t < i.blocks.length; t++) for (let n = 0; n < i.blocks[t].dividers.length; n++) i.blocks[t].dividers[n].index === e && (R += ye, he.set(`${t}:${n}`, R), R += be);
|
|
5178
|
+
R += ye;
|
|
5179
|
+
let t = i.messages[e], n = t.from === t.to, r = dr(t.label), a = n ? void 0 : k.get(e), o = A.get(e);
|
|
5180
|
+
if (n) fe[e] = R + 1, de[e] = R, R += 2 + r;
|
|
5179
5181
|
else {
|
|
5180
5182
|
let t = a === void 0 ? 0 : O, n = a === void 0 ? 0 : ee;
|
|
5181
|
-
|
|
5183
|
+
fe[e] = R, de[e] = R + r + t, R += r + t + 1 + n, a !== void 0 && te.set(a, de[e] - t);
|
|
5182
5184
|
}
|
|
5183
|
-
o !== void 0 && (j.set(o,
|
|
5185
|
+
o !== void 0 && (j.set(o, R), R += 1);
|
|
5184
5186
|
for (let t = 0; t < i.notes.length; t++) if (i.notes[t].afterIndex === e) {
|
|
5185
|
-
|
|
5186
|
-
let e = i.notes[t], n =
|
|
5187
|
+
R += ye;
|
|
5188
|
+
let e = i.notes[t], n = Z(e.text), r = F(e), a = n.length + 2, o = g.get(e.actorIds[0]) ?? 0, s;
|
|
5187
5189
|
if (e.position === "left") s = L[o] - r - 1;
|
|
5188
5190
|
else if (e.position === "right") s = L[o] + 2;
|
|
5189
5191
|
else if (e.actorIds.length >= 2) {
|
|
5190
5192
|
let t = g.get(e.actorIds[1]) ?? o;
|
|
5191
5193
|
s = Math.floor((L[o] + L[t]) / 2) - Math.floor(r / 2);
|
|
5192
5194
|
} else s = L[o] - Math.floor(r / 2);
|
|
5193
|
-
s = Math.max(0, s),
|
|
5195
|
+
s = Math.max(0, s), ge.push({
|
|
5194
5196
|
x: s,
|
|
5195
|
-
y:
|
|
5197
|
+
y: R,
|
|
5196
5198
|
width: r,
|
|
5197
5199
|
height: a,
|
|
5198
5200
|
lines: n
|
|
5199
|
-
}),
|
|
5201
|
+
}), R += a;
|
|
5200
5202
|
}
|
|
5201
|
-
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].endIndex === e && (
|
|
5203
|
+
for (let t = 0; t < i.blocks.length; t++) i.blocks[t].endIndex === e && (R += ye, me.set(t, R), R += be);
|
|
5202
5204
|
}
|
|
5203
|
-
|
|
5204
|
-
let
|
|
5205
|
-
for (let e of M)
|
|
5205
|
+
R += be;
|
|
5206
|
+
let xe = R, Se = xe + re, Ce = Se + E + re, we = (L[L.length - 1] ?? 0) + (w[w.length - 1] ?? 0) + 2;
|
|
5207
|
+
for (let e of M) we = Math.max(we, ue(e) + 2);
|
|
5206
5208
|
for (let e = 0; e < i.messages.length; e++) {
|
|
5207
5209
|
let t = i.messages[e];
|
|
5208
5210
|
if (t.from === t.to) {
|
|
5209
|
-
let e = L[v(t.from)] + ca(t) + 2 + 2 +
|
|
5210
|
-
|
|
5211
|
+
let e = L[v(t.from)] + ca(t) + 2 + 2 + ur(t.label);
|
|
5212
|
+
we = Math.max(we, e + 1);
|
|
5211
5213
|
}
|
|
5212
5214
|
}
|
|
5213
|
-
for (let e of
|
|
5214
|
-
let
|
|
5215
|
-
function
|
|
5216
|
-
|
|
5215
|
+
for (let e of ge) we = Math.max(we, e.x + e.width + 1);
|
|
5216
|
+
let Te = V(we, Ce - 1), Ee = Pt(we, Ce - 1);
|
|
5217
|
+
function z(e, t, n, r) {
|
|
5218
|
+
U(Te, e, t, n, {
|
|
5217
5219
|
role: r,
|
|
5218
|
-
roleCanvas:
|
|
5220
|
+
roleCanvas: Ee
|
|
5219
5221
|
});
|
|
5220
5222
|
}
|
|
5221
|
-
function
|
|
5222
|
-
let a =
|
|
5223
|
+
function De(e, t, n, r, i) {
|
|
5224
|
+
let a = Nt(n);
|
|
5223
5225
|
for (let n = 0; n < a.length; n++) {
|
|
5224
5226
|
let o = e + n;
|
|
5225
5227
|
if (i !== void 0 && o >= i || a[n + 1] === "" && i !== void 0 && o + 1 >= i) break;
|
|
5226
|
-
|
|
5228
|
+
z(o, t, a[n], r);
|
|
5227
5229
|
}
|
|
5228
5230
|
}
|
|
5229
|
-
function
|
|
5230
|
-
let a = r === "actor" ? aa : [], f = [...a, ...
|
|
5231
|
-
|
|
5232
|
-
for (let e = 1; e < m - 1; e++)
|
|
5233
|
-
|
|
5231
|
+
function Oe(e, t, n, r, i) {
|
|
5232
|
+
let a = r === "actor" ? aa : [], f = [...a, ...Z(n)], p = Math.max(ur(n), a.length > 0 ? oa : 0), m = p + 2 * b + 2, h = i, g = h - 2, _ = e - Math.floor(m / 2);
|
|
5233
|
+
z(_, t, c, "border");
|
|
5234
|
+
for (let e = 1; e < m - 1; e++) z(_ + e, t, o, "border");
|
|
5235
|
+
z(_ + m - 1, t, l, "border");
|
|
5234
5236
|
for (let e = 0; e < g; e++) {
|
|
5235
5237
|
let n = t + 1 + e;
|
|
5236
|
-
|
|
5238
|
+
z(_, n, s, "border"), z(_ + m - 1, n, s, "border");
|
|
5237
5239
|
let r = f[e];
|
|
5238
|
-
r !== void 0 &&
|
|
5240
|
+
r !== void 0 && De(_ + 1 + b + Math.floor((p - B(r)) / 2), n, r, "text");
|
|
5239
5241
|
}
|
|
5240
5242
|
let v = t + h - 1;
|
|
5241
|
-
|
|
5242
|
-
for (let e = 1; e < m - 1; e++)
|
|
5243
|
-
|
|
5243
|
+
z(_, v, u, "border");
|
|
5244
|
+
for (let e = 1; e < m - 1; e++) z(_ + e, v, o, "border");
|
|
5245
|
+
z(_ + m - 1, v, d, "border");
|
|
5244
5246
|
}
|
|
5245
|
-
let
|
|
5247
|
+
let ke = (e) => {
|
|
5246
5248
|
let t = te.get(e);
|
|
5247
|
-
return t === void 0 ?
|
|
5248
|
-
},
|
|
5249
|
+
return t === void 0 ? ve : t + E;
|
|
5250
|
+
}, je = (e) => j.get(e) ?? xe;
|
|
5249
5251
|
for (let e = 0; e < i.actors.length; e++) {
|
|
5250
5252
|
let t = L[e];
|
|
5251
|
-
for (let n =
|
|
5252
|
-
}
|
|
5253
|
-
let
|
|
5254
|
-
function
|
|
5255
|
-
let r =
|
|
5256
|
-
|
|
5257
|
-
for (let e = r + 1; e < i; e++)
|
|
5258
|
-
for (let e = t + 1; e < a; e++)
|
|
5259
|
-
n !== "" &&
|
|
5253
|
+
for (let n = ke(e); n <= je(e); n++) z(t, n, s, "line");
|
|
5254
|
+
}
|
|
5255
|
+
let Me = a ? "+" : "┼";
|
|
5256
|
+
function Ne(e, t, n) {
|
|
5257
|
+
let r = le(e), i = ue(e), a = t + E + 1;
|
|
5258
|
+
z(r, t, c, "border"), z(i, t, l, "border"), z(r, a, u, "border"), z(i, a, d, "border");
|
|
5259
|
+
for (let e = r + 1; e < i; e++) z(e, t, o, "border"), z(e, a, o, "border");
|
|
5260
|
+
for (let e = t + 1; e < a; e++) z(r, e, s, "border"), z(i, e, s, "border");
|
|
5261
|
+
n !== "" && De(r + 2, t, ` ${Z(n)[0]} `, "text");
|
|
5260
5262
|
for (let n = e.lo; n <= e.hi; n++) {
|
|
5261
5263
|
let e = L[n];
|
|
5262
|
-
|
|
5264
|
+
ke(n) <= t && t <= je(n) && z(e, t, Me, "junction"), ke(n) <= a && a <= je(n) && z(e, a, Me, "junction");
|
|
5263
5265
|
}
|
|
5264
5266
|
}
|
|
5265
|
-
for (let e of M)
|
|
5267
|
+
for (let e of M) Ne(e, 0, e.label), Ne(e, xe, "");
|
|
5266
5268
|
for (let e = 0; e < i.actors.length; e++) {
|
|
5267
|
-
let t = i.actors[e], n = te.get(e) ??
|
|
5268
|
-
|
|
5269
|
+
let t = i.actors[e], n = te.get(e) ?? _e, r = j.has(e);
|
|
5270
|
+
Oe(L[e], n, t.label, t.type, E), r || Oe(L[e], Se, t.label, t.type, E), a || (z(L[e], n + E - 1, f, "junction"), r || z(L[e], Se, p, "junction"));
|
|
5269
5271
|
}
|
|
5270
5272
|
for (let e = 0; e < i.messages.length; e++) {
|
|
5271
5273
|
let t = i.messages[e], n = v(t.from), r = v(t.to), c = L[n], l = L[r], u = n === r, d = t.lineStyle === "dashed", f = t.arrowHead === "filled", p = t.isLost === !0, h = a ? "x" : "✕", g = d ? a ? "." : "╌" : o;
|
|
5272
5274
|
if (u) {
|
|
5273
|
-
let n =
|
|
5274
|
-
|
|
5275
|
+
let n = de[e], r = ca(t), i = t.seqNumber === void 0 ? void 0 : String(t.seqNumber), o = Z(t.label);
|
|
5276
|
+
z(c, n, m, "junction");
|
|
5275
5277
|
let l = c + 1;
|
|
5276
5278
|
if (i !== void 0) {
|
|
5277
|
-
for (let e = 0; e < i.length; e++)
|
|
5279
|
+
for (let e = 0; e < i.length; e++) z(c + 1 + e, n, i[e], "text");
|
|
5278
5280
|
l = c + 1 + i.length;
|
|
5279
5281
|
}
|
|
5280
|
-
for (let e = l; e < c + r; e++)
|
|
5281
|
-
|
|
5282
|
+
for (let e = l; e < c + r; e++) z(e, n, g, "line");
|
|
5283
|
+
z(c + r, n, a ? "+" : "┐", "corner");
|
|
5282
5284
|
let u = c + r + 2;
|
|
5283
5285
|
for (let e = 0; e < o.length; e++) {
|
|
5284
5286
|
let t = n + 1 + e;
|
|
5285
|
-
|
|
5287
|
+
z(c + r, t, s, "line"), De(u, t, o[e], "text", we);
|
|
5286
5288
|
}
|
|
5287
5289
|
let d = n + 1 + o.length;
|
|
5288
|
-
|
|
5289
|
-
for (let e = c + 1; e < c + r; e++)
|
|
5290
|
-
|
|
5290
|
+
z(c, d, p ? h : f ? a ? "<" : "◀" : a ? "<" : "◁", "arrow");
|
|
5291
|
+
for (let e = c + 1; e < c + r; e++) z(e, d, g, "line");
|
|
5292
|
+
z(c + r, d, a ? "+" : "┘", "corner");
|
|
5291
5293
|
} else {
|
|
5292
|
-
let n =
|
|
5294
|
+
let n = fe[e], i = de[e], o = c < l, s = k.get(e) === r, u = l;
|
|
5293
5295
|
if (s) {
|
|
5294
5296
|
let e = D(r, l), t = e + C[r] - 1;
|
|
5295
5297
|
u = o ? e - 1 : t + 1;
|
|
5296
5298
|
}
|
|
5297
|
-
let d = Math.floor((c + l) / 2), m =
|
|
5299
|
+
let d = Math.floor((c + l) / 2), m = Z(t.label);
|
|
5298
5300
|
for (let e = 0; e < m.length; e++) {
|
|
5299
5301
|
let t = m[e];
|
|
5300
|
-
|
|
5302
|
+
De(d - Math.floor(B(t) / 2), n + e, t, "text", we);
|
|
5301
5303
|
}
|
|
5302
5304
|
if (o) {
|
|
5303
|
-
for (let e = c + 1; e < u; e++)
|
|
5304
|
-
|
|
5305
|
+
for (let e = c + 1; e < u; e++) z(e, i, g, "line");
|
|
5306
|
+
z(u, i, p ? h : f ? a ? ">" : "▶" : a ? ">" : "▷", "arrow"), t.bidirectional && z(c, i, a ? "<" : "◀", "arrow");
|
|
5305
5307
|
} else {
|
|
5306
|
-
for (let e = u + 1; e < c; e++)
|
|
5307
|
-
|
|
5308
|
+
for (let e = u + 1; e < c; e++) z(e, i, g, "line");
|
|
5309
|
+
z(u, i, p ? h : f ? a ? "<" : "◀" : a ? "<" : "◁", "arrow"), t.bidirectional && z(c, i, a ? ">" : "▶", "arrow");
|
|
5308
5310
|
}
|
|
5309
5311
|
if (t.seqNumber !== void 0) {
|
|
5310
5312
|
let e = String(t.seqNumber);
|
|
5311
5313
|
if (o) {
|
|
5312
5314
|
let t = c + 1;
|
|
5313
|
-
if (t + e.length < l) for (let n = 0; n < e.length; n++)
|
|
5315
|
+
if (t + e.length < l) for (let n = 0; n < e.length; n++) z(t + n, i, e[n], "text");
|
|
5314
5316
|
} else {
|
|
5315
5317
|
let t = c - e.length;
|
|
5316
|
-
if (t > u) for (let n = 0; n < e.length; n++)
|
|
5318
|
+
if (t > u) for (let n = 0; n < e.length; n++) z(t + n, i, e[n], "text");
|
|
5317
5319
|
}
|
|
5318
5320
|
}
|
|
5319
5321
|
}
|
|
5320
5322
|
}
|
|
5321
|
-
for (let [e, t] of j)
|
|
5322
|
-
let
|
|
5323
|
+
for (let [e, t] of j) z(L[e], t, a ? "x" : "✕", "arrow");
|
|
5324
|
+
let Pe = we - 1;
|
|
5323
5325
|
for (let e = 0; e < i.blocks.length; e++) {
|
|
5324
|
-
let t = i.blocks[e], n =
|
|
5326
|
+
let t = i.blocks[e], n = pe.get(e), r = me.get(e);
|
|
5325
5327
|
if (n === void 0 || r === void 0) continue;
|
|
5326
|
-
let a =
|
|
5328
|
+
let a = we, f = 0;
|
|
5327
5329
|
for (let e = t.startIndex; e <= t.endIndex && !(e >= i.messages.length); e++) {
|
|
5328
5330
|
let t = i.messages[e], n = g.get(t.from) ?? 0, r = g.get(t.to) ?? 0;
|
|
5329
5331
|
if (a = Math.min(a, L[Math.min(n, r)]), f = Math.max(f, L[Math.max(n, r)]), n === r) {
|
|
5330
|
-
let e = L[n] + ca(t) + 2 +
|
|
5332
|
+
let e = L[n] + ca(t) + 2 + ur(t.label);
|
|
5331
5333
|
f = Math.max(f, e);
|
|
5332
5334
|
}
|
|
5333
5335
|
}
|
|
5334
5336
|
let p = a - sa, _ = f + sa, v = Infinity, b = -Infinity;
|
|
5335
5337
|
for (let e of L) e > f && e < v && (v = e), e < a && e > b && (b = e);
|
|
5336
|
-
_ >= v && (_ = Math.max(f, v - sa)), p <= b && (p = Math.min(a, b + sa)), p = Math.max(0, p), _ >
|
|
5338
|
+
_ >= v && (_ = Math.max(f, v - sa)), p <= b && (p = Math.min(a, b + sa)), p = Math.max(0, p), _ > Pe && (Rt(Te, _ + 1, Ce - 1), Ft(Ee, _ + 1, Ce - 1), Pe = _);
|
|
5337
5339
|
let x = t.label ? `${t.type} [${t.label}]` : t.type, S = p + 1 + y(t);
|
|
5338
5340
|
if (S > _) {
|
|
5339
5341
|
_ = S;
|
|
5340
|
-
let [e] =
|
|
5341
|
-
_ > e && (
|
|
5342
|
-
}
|
|
5343
|
-
|
|
5344
|
-
for (let e = p + 1; e < _; e++)
|
|
5345
|
-
|
|
5346
|
-
let C =
|
|
5347
|
-
for (let e = 0; e < C.length && n + e < r; e++)
|
|
5348
|
-
|
|
5349
|
-
for (let e = p + 1; e < _; e++)
|
|
5350
|
-
|
|
5351
|
-
for (let e = n + 1; e < r; e++)
|
|
5342
|
+
let [e] = Lt(Te);
|
|
5343
|
+
_ > e && (Rt(Te, _, Ce - 1), Ft(Ee, _, Ce - 1)), we = Math.max(we, _ + 1), Pe = Math.max(Pe, _);
|
|
5344
|
+
}
|
|
5345
|
+
z(p, n, c, "border");
|
|
5346
|
+
for (let e = p + 1; e < _; e++) z(e, n, o, "border");
|
|
5347
|
+
z(_, n, l, "border");
|
|
5348
|
+
let C = Z(x);
|
|
5349
|
+
for (let e = 0; e < C.length && n + e < r; e++) De(p + 1, n + e, C[e], "text", _);
|
|
5350
|
+
z(p, r, u, "border");
|
|
5351
|
+
for (let e = p + 1; e < _; e++) z(e, r, o, "border");
|
|
5352
|
+
z(_, r, d, "border");
|
|
5353
|
+
for (let e = n + 1; e < r; e++) z(p, e, s, "border"), z(_, e, s, "border");
|
|
5352
5354
|
for (let n = 0; n < t.dividers.length; n++) {
|
|
5353
|
-
let r =
|
|
5355
|
+
let r = he.get(`${e}:${n}`);
|
|
5354
5356
|
if (r === void 0) continue;
|
|
5355
|
-
let i =
|
|
5356
|
-
|
|
5357
|
-
for (let e = p + 1; e < _; e++)
|
|
5358
|
-
|
|
5357
|
+
let i = Fe();
|
|
5358
|
+
z(p, r, m, "junction");
|
|
5359
|
+
for (let e = p + 1; e < _; e++) z(e, r, i, "line");
|
|
5360
|
+
z(_, r, h, "junction");
|
|
5359
5361
|
let a = t.dividers[n].label;
|
|
5360
5362
|
if (a) {
|
|
5361
5363
|
let e = `[${a}]`;
|
|
5362
|
-
|
|
5364
|
+
De(p + 1, r, e, "text", _);
|
|
5363
5365
|
}
|
|
5364
5366
|
}
|
|
5365
5367
|
}
|
|
5366
|
-
for (let e of
|
|
5367
|
-
|
|
5368
|
-
for (let t = 1; t < e.width - 1; t++)
|
|
5369
|
-
|
|
5368
|
+
for (let e of ge) {
|
|
5369
|
+
Rt(Te, e.x + e.width, e.y + e.height), Ft(Ee, e.x + e.width, e.y + e.height), z(e.x, e.y, c, "border");
|
|
5370
|
+
for (let t = 1; t < e.width - 1; t++) z(e.x + t, e.y, o, "border");
|
|
5371
|
+
z(e.x + e.width - 1, e.y, l, "border");
|
|
5370
5372
|
for (let t = 0; t < e.lines.length; t++) {
|
|
5371
5373
|
let n = e.y + 1 + t;
|
|
5372
|
-
|
|
5373
|
-
for (let t = e.x + 1; t < e.x + e.width - 1; t++)
|
|
5374
|
-
|
|
5374
|
+
z(e.x, n, s, "border"), z(e.x + e.width - 1, n, s, "border");
|
|
5375
|
+
for (let t = e.x + 1; t < e.x + e.width - 1; t++) z(t, n, " ", "text");
|
|
5376
|
+
De(e.x + 1 + b, n, e.lines[t], "text");
|
|
5375
5377
|
}
|
|
5376
5378
|
let t = e.y + e.height - 1;
|
|
5377
|
-
|
|
5378
|
-
for (let n = 1; n < e.width - 1; n++)
|
|
5379
|
-
|
|
5379
|
+
z(e.x, t, u, "border");
|
|
5380
|
+
for (let n = 1; n < e.width - 1; n++) z(e.x + n, t, o, "border");
|
|
5381
|
+
z(e.x + e.width - 1, t, d, "border");
|
|
5380
5382
|
}
|
|
5381
|
-
return
|
|
5382
|
-
roleCanvas:
|
|
5383
|
+
return Gt(Te, {
|
|
5384
|
+
roleCanvas: Ee,
|
|
5383
5385
|
colorMode: n,
|
|
5384
5386
|
theme: r
|
|
5385
5387
|
});
|
|
5386
|
-
function
|
|
5388
|
+
function Fe() {
|
|
5387
5389
|
return a ? "-" : "╌";
|
|
5388
5390
|
}
|
|
5389
5391
|
}
|
|
@@ -5417,9 +5419,9 @@ function da(e, t) {
|
|
|
5417
5419
|
function fa(e) {
|
|
5418
5420
|
let t = [];
|
|
5419
5421
|
e.annotation && t.push(`<<${e.annotation}>>`);
|
|
5420
|
-
let n =
|
|
5422
|
+
let n = Z(e.label);
|
|
5421
5423
|
t.push(...n);
|
|
5422
|
-
let r = e.attributes.map(
|
|
5424
|
+
let r = e.attributes.map(ge), i = e.methods.map(ge), a = [t];
|
|
5423
5425
|
return r.length > 0 && a.push(r), i.length > 0 && a.push(i), a;
|
|
5424
5426
|
}
|
|
5425
5427
|
function pa(e, t) {
|
|
@@ -5454,7 +5456,7 @@ function ha(e, t, n, r, i) {
|
|
|
5454
5456
|
start: c,
|
|
5455
5457
|
cells: ["…"]
|
|
5456
5458
|
};
|
|
5457
|
-
let d = Math.max(0, l - u), f =
|
|
5459
|
+
let d = Math.max(0, l - u), f = Nt(n), p = f.length <= d ? f : o && !s ? f.slice(f.length - d) : f.slice(0, d), m = [
|
|
5458
5460
|
...o ? ["…"] : [],
|
|
5459
5461
|
...p,
|
|
5460
5462
|
...s ? ["…"] : []
|
|
@@ -5465,12 +5467,12 @@ function ha(e, t, n, r, i) {
|
|
|
5465
5467
|
};
|
|
5466
5468
|
}
|
|
5467
5469
|
function ga(e) {
|
|
5468
|
-
return Math.max(...
|
|
5470
|
+
return Math.max(...Z(e).map((e) => B(e))) + 2;
|
|
5469
5471
|
}
|
|
5470
5472
|
function _a(e, n, r, i, a = {}) {
|
|
5471
|
-
let { diagram: o, notesById: s } = va(
|
|
5473
|
+
let { diagram: o, notesById: s } = va(ce(_(e)));
|
|
5472
5474
|
if (o.classes.length === 0) return "";
|
|
5473
|
-
let c = n.useAscii, l =
|
|
5475
|
+
let c = n.useAscii, l = kn(n.paddingX, 5, 4, 1), u = kn(n.paddingY, 5, 3, 1), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
|
|
5474
5476
|
for (let e of o.classes) {
|
|
5475
5477
|
let t = fa(e);
|
|
5476
5478
|
d.set(e.id, t);
|
|
@@ -5558,33 +5560,61 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5558
5560
|
for (let e = 0; e <= S; e++) {
|
|
5559
5561
|
let t = C[e];
|
|
5560
5562
|
if (t.length === 0) continue;
|
|
5561
|
-
let n =
|
|
5563
|
+
let n = (e) => {
|
|
5564
|
+
let t = h.get(e);
|
|
5565
|
+
return t && t.size > 0 ? [...t].sort().join(",") : `root:${e}`;
|
|
5566
|
+
}, r = /* @__PURE__ */ new Map();
|
|
5562
5567
|
for (let e of t) {
|
|
5563
|
-
let t =
|
|
5568
|
+
let t = n(e), i = r.get(t);
|
|
5569
|
+
i || (i = [], r.set(t, i)), i.push(e);
|
|
5570
|
+
}
|
|
5571
|
+
let i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
5572
|
+
{
|
|
5573
|
+
let e = 0;
|
|
5574
|
+
for (let n of t) {
|
|
5575
|
+
let t = f.get(n), r = k.get(n), s = Math.max(0, r.left - Math.floor(t / 2)), c = Math.max(0, r.right - (t - 1 - Math.floor(t / 2)));
|
|
5576
|
+
i.set(n, e), a.set(n, s + t + c), o.set(n, s), e += s + t + c + l;
|
|
5577
|
+
}
|
|
5578
|
+
}
|
|
5579
|
+
let s = 0, c = 0, g = (e, t) => {
|
|
5580
|
+
let n = m.get(e), r = f.get(e), i = p.get(e), u = o.get(e), h = a.get(e);
|
|
5564
5581
|
A.set(e, {
|
|
5565
|
-
cls:
|
|
5582
|
+
cls: n,
|
|
5566
5583
|
sections: d.get(e),
|
|
5567
|
-
x:
|
|
5584
|
+
x: t + u,
|
|
5568
5585
|
y: te,
|
|
5569
|
-
width:
|
|
5570
|
-
height:
|
|
5571
|
-
});
|
|
5572
|
-
|
|
5573
|
-
|
|
5586
|
+
width: r,
|
|
5587
|
+
height: i
|
|
5588
|
+
}), j = Math.max(j, t + h), s = t + h + l, c = Math.max(c, i);
|
|
5589
|
+
}, _ = /* @__PURE__ */ new Set();
|
|
5590
|
+
for (let c of t) {
|
|
5591
|
+
if (_.has(c)) continue;
|
|
5592
|
+
let t = n(c), u = h.get(c), d = u ? [...u].filter((t) => v.get(t) < e) : [];
|
|
5593
|
+
if (d.length === 0) {
|
|
5594
|
+
g(c, Math.max(i.get(c), s, 0)), _.add(c);
|
|
5595
|
+
continue;
|
|
5596
|
+
}
|
|
5597
|
+
let p = r.get(t), m = d.map((e) => {
|
|
5598
|
+
let t = A.get(e);
|
|
5599
|
+
return t.x + Math.floor(t.width / 2);
|
|
5600
|
+
}), y = Math.round(m.reduce((e, t) => e + t, 0) / m.length), b = 0;
|
|
5601
|
+
for (let e = 0; e < p.length; e++) b += a.get(p[e]), e < p.length - 1 && (b += l);
|
|
5602
|
+
let x = o.get(p[0]), S = p[p.length - 1], C = a.get(S) - o.get(S) - f.get(S), w = b - x - C, T = y - x - Math.floor(w / 2), E = Math.max(T, s, 0);
|
|
5603
|
+
for (let e of p) g(e, E), _.add(e), E = s;
|
|
5574
5604
|
}
|
|
5575
|
-
te +=
|
|
5605
|
+
te += c + u;
|
|
5576
5606
|
}
|
|
5577
5607
|
let M = j, ne = 0;
|
|
5578
5608
|
for (let e of A.values()) M = Math.max(M, e.x + e.width), ne = Math.max(ne, e.y + e.height);
|
|
5579
5609
|
M += 4, ne += 2;
|
|
5580
|
-
let N =
|
|
5610
|
+
let N = V(M - 1, ne - 1), re = Pt(M - 1, ne - 1);
|
|
5581
5611
|
function ie(e, t, n, r) {
|
|
5582
|
-
|
|
5612
|
+
U(N, e, t, n, {
|
|
5583
5613
|
role: r,
|
|
5584
5614
|
roleCanvas: re
|
|
5585
5615
|
});
|
|
5586
5616
|
}
|
|
5587
|
-
let P = a.hyperlinks ?
|
|
5617
|
+
let P = a.hyperlinks ? rt(M - 1, ne - 1) : void 0;
|
|
5588
5618
|
for (let e of A.values()) {
|
|
5589
5619
|
let r = Gi(e.sections, c, n.boxBorderPadding);
|
|
5590
5620
|
for (let t = 0; t < r.length; t++) for (let n = 0; n < r[0].length; n++) {
|
|
@@ -5598,7 +5628,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5598
5628
|
let n = t(o.interactions.get(e.cls.id)?.href), i = e.sections[0];
|
|
5599
5629
|
if (n !== void 0 && i !== void 0) {
|
|
5600
5630
|
let t = 1 + +!!e.cls.annotation;
|
|
5601
|
-
|
|
5631
|
+
ot(P, r, {
|
|
5602
5632
|
x: e.x,
|
|
5603
5633
|
y: e.y
|
|
5604
5634
|
}, n, {
|
|
@@ -5623,51 +5653,51 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5623
5653
|
return !0;
|
|
5624
5654
|
}) ?? M + 2;
|
|
5625
5655
|
}
|
|
5626
|
-
let
|
|
5627
|
-
function
|
|
5656
|
+
let se = c ? "-" : "─", L = c ? "|" : "│", le = c ? "." : "╌", ue = c ? ":" : "┊";
|
|
5657
|
+
function de(e, t, n) {
|
|
5628
5658
|
let r = Math.floor(n / 2), i = n - 1 - r, a = t > r + i ? (r + i) / t : 1;
|
|
5629
5659
|
return Math.max(-r, Math.min(i, Math.round(e * a)));
|
|
5630
5660
|
}
|
|
5631
|
-
function
|
|
5661
|
+
function fe(e, t, n) {
|
|
5632
5662
|
let r = w.get(e) ?? E.get(e) ?? 0, i = w.get(e) ?? O.get(e) ?? 0, a = T.get(e) ?? D.get(e) ?? 0, o = T.get(e) ?? ee.get(e) ?? 0, s = t.x + Math.floor(t.width / 2), c = n.x + Math.floor(n.width / 2);
|
|
5633
5663
|
return {
|
|
5634
5664
|
fromCX: s + r,
|
|
5635
5665
|
toCX: c + i,
|
|
5636
|
-
fromAnchorX: s +
|
|
5637
|
-
toAnchorX: c +
|
|
5666
|
+
fromAnchorX: s + de(r, a, t.width),
|
|
5667
|
+
toAnchorX: c + de(i, o, n.width)
|
|
5638
5668
|
};
|
|
5639
5669
|
}
|
|
5640
|
-
function
|
|
5670
|
+
function pe(e, t, n, r) {
|
|
5641
5671
|
if (F.has(`${e},${t}`) || re[e]?.[t] === "arrow") return;
|
|
5642
5672
|
let i = N[e]?.[t];
|
|
5643
|
-
if (!c && i !== void 0 &&
|
|
5644
|
-
let a =
|
|
5673
|
+
if (!c && i !== void 0 && Bt(i) && Bt(n)) {
|
|
5674
|
+
let a = Ut(i, n);
|
|
5645
5675
|
ie(e, t, a, a === n ? r : "junction");
|
|
5646
5676
|
return;
|
|
5647
5677
|
}
|
|
5648
5678
|
ie(e, t, n, r);
|
|
5649
5679
|
}
|
|
5650
|
-
function
|
|
5680
|
+
function me(e, t, n, r, i) {
|
|
5651
5681
|
if (t === n) return;
|
|
5652
5682
|
let a = Math.min(t, n), o = Math.max(t, n);
|
|
5653
|
-
for (let t = a + 1; t < o; t++)
|
|
5683
|
+
for (let t = a + 1; t < o; t++) pe(t, e, r, "line");
|
|
5654
5684
|
if (c) {
|
|
5655
|
-
|
|
5685
|
+
pe(t, e, r, "line"), pe(n, e, r, "line");
|
|
5656
5686
|
return;
|
|
5657
5687
|
}
|
|
5658
5688
|
let s = n > t, l = i ? s ? "└" : "┘" : s ? "┌" : "┐", u = i ? s ? "┐" : "┌" : s ? "┘" : "└";
|
|
5659
|
-
|
|
5689
|
+
pe(t, e, l, "corner"), pe(n, e, u, "corner");
|
|
5660
5690
|
}
|
|
5661
|
-
let
|
|
5691
|
+
let he = /* @__PURE__ */ new Map(), ge = /* @__PURE__ */ new Map();
|
|
5662
5692
|
o.relationships.forEach((e, t) => {
|
|
5663
5693
|
let n = A.get(e.from), r = A.get(e.to);
|
|
5664
5694
|
if (!n || !r) return;
|
|
5665
|
-
let i = pa(e.type, e.markerAt), a = i.dashed ?
|
|
5695
|
+
let i = pa(e.type, e.markerAt), a = i.dashed ? le : se, o = i.dashed ? ue : L, s = /* @__PURE__ */ new Set([e.from, e.to]), { fromCX: l, toCX: u, fromAnchorX: d, toAnchorX: f } = fe(t, n, r), p = n.y + n.height - 1, m = r.y;
|
|
5666
5696
|
if (p < m) {
|
|
5667
5697
|
let e = oe(l, p + 1, m - 1, s), n = e !== l;
|
|
5668
|
-
if (e >= M &&
|
|
5698
|
+
if (e >= M && Rt(N, e + 2, ne), n) {
|
|
5669
5699
|
let n = p + 1, r = m - 1;
|
|
5670
|
-
|
|
5700
|
+
he.set(t, {
|
|
5671
5701
|
routeX: e,
|
|
5672
5702
|
exitY: n,
|
|
5673
5703
|
entryY: r,
|
|
@@ -5694,7 +5724,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5694
5724
|
}
|
|
5695
5725
|
} else {
|
|
5696
5726
|
let e = p + Math.floor((m - p) / 2), t = l !== d, n = u !== f;
|
|
5697
|
-
|
|
5727
|
+
me(p + 1, d, l, a, !0);
|
|
5698
5728
|
for (let n = p + (t ? 2 : 1); n <= e; n++) I(l, n, o, "line");
|
|
5699
5729
|
if (l !== u && e < (N[0]?.length ?? 0)) {
|
|
5700
5730
|
let t = Math.min(l, u), n = Math.max(l, u);
|
|
@@ -5702,7 +5732,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5702
5732
|
c || (I(l, e, l < u ? "└" : "┘", "corner"), I(u, e, l < u ? "┐" : "┌", "corner"));
|
|
5703
5733
|
}
|
|
5704
5734
|
for (let t = e + 1; t < m - +!!n; t++) I(u, t, o, "line");
|
|
5705
|
-
if (
|
|
5735
|
+
if (me(m - 1, f, u, a, !1), i.markerAt === "to") {
|
|
5706
5736
|
let e = i.type === "inheritance" || i.type === "realization";
|
|
5707
5737
|
I(f, m - 1, ma(i.type, c, e ? "up" : "down"), "arrow");
|
|
5708
5738
|
}
|
|
@@ -5710,7 +5740,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5710
5740
|
}
|
|
5711
5741
|
} else if (r.y + r.height - 1 < n.y) {
|
|
5712
5742
|
let e = n.y, t = r.y + r.height - 1, s = t + Math.floor((e - t) / 2), p = l !== d, m = u !== f;
|
|
5713
|
-
|
|
5743
|
+
me(e - 1, d, l, a, !1);
|
|
5714
5744
|
for (let t = e - (p ? 2 : 1); t >= s; t--) I(l, t, o, "line");
|
|
5715
5745
|
if (l !== u) {
|
|
5716
5746
|
let e = Math.min(l, u), t = Math.max(l, u);
|
|
@@ -5718,7 +5748,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5718
5748
|
!c && s >= 0 && s < ne && (I(l, s, l < u ? "┌" : "┐", "corner"), I(u, s, l < u ? "┘" : "└", "corner"));
|
|
5719
5749
|
}
|
|
5720
5750
|
for (let e = s - 1; e > t + +!!m; e--) I(u, e, o, "line");
|
|
5721
|
-
if (
|
|
5751
|
+
if (me(t + 1, f, u, a, !0), i.markerAt === "from") {
|
|
5722
5752
|
let t = ma(i.type, c, "up"), n = e - 1;
|
|
5723
5753
|
for (let e = 0; e < t.length; e++) I(d - Math.floor(t.length / 2) + e, n, t[e], "arrow");
|
|
5724
5754
|
}
|
|
@@ -5730,13 +5760,13 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5730
5760
|
let s = r.y + r.height - 1, m = Math.min(l, u), h = Math.max(l, u), g = Math.max(p, s);
|
|
5731
5761
|
for (let [t, r] of A.entries()) t !== e.from && t !== e.to && r.y === n.y && r.x < h + 1 && r.x + r.width > m && (g = Math.max(g, r.y + r.height - 1));
|
|
5732
5762
|
let _ = g + 2;
|
|
5733
|
-
|
|
5763
|
+
ge.set(t, _), Rt(N, M, _ + 1), Ft(re, M, _ + 1);
|
|
5734
5764
|
let v = l !== d, y = u !== f;
|
|
5735
|
-
|
|
5765
|
+
me(p + 1, d, l, a, !0);
|
|
5736
5766
|
for (let e = p + (v ? 2 : 1); e <= _; e++) I(l, e, o, "line");
|
|
5737
5767
|
for (let e = m; e <= h; e++) I(e, _, a, "line");
|
|
5738
5768
|
for (let e = _ - 1; e >= s + (y ? 2 : 1); e--) I(u, e, o, "line");
|
|
5739
|
-
if (
|
|
5769
|
+
if (me(s + 1, f, u, a, !0), i.markerAt === "from") {
|
|
5740
5770
|
let e = ma(i.type, c, "down"), t = p + 1;
|
|
5741
5771
|
for (let n = 0; n < e.length; n++) I(d - Math.floor(e.length / 2) + n, t, e[n], "arrow");
|
|
5742
5772
|
}
|
|
@@ -5746,10 +5776,10 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5746
5776
|
}
|
|
5747
5777
|
}
|
|
5748
5778
|
});
|
|
5749
|
-
function
|
|
5750
|
-
let { fromCX: i, toCX: a } =
|
|
5779
|
+
function _e(e, t, n, r) {
|
|
5780
|
+
let { fromCX: i, toCX: a } = fe(e, t, n), o = t.y + t.height - 1, s = n.y;
|
|
5751
5781
|
if (o < s) {
|
|
5752
|
-
let t =
|
|
5782
|
+
let t = he.get(e);
|
|
5753
5783
|
if (t) {
|
|
5754
5784
|
let e = t.exitY + 1, n = t.entryY;
|
|
5755
5785
|
if (n >= e) return {
|
|
@@ -5780,10 +5810,10 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5780
5810
|
return {
|
|
5781
5811
|
idealMidX: Math.floor((i + a) / 2),
|
|
5782
5812
|
/* v8 ignore next */
|
|
5783
|
-
baseMidY:
|
|
5813
|
+
baseMidY: ge.get(e) ?? Math.max(o, n.y + n.height - 1) + 2
|
|
5784
5814
|
};
|
|
5785
5815
|
}
|
|
5786
|
-
function
|
|
5816
|
+
function ve(e, t, n, r, i, a, o) {
|
|
5787
5817
|
let s = r, c = Math.floor(a / 2), l = e.y + e.height - 1, u = t.y, d = !1;
|
|
5788
5818
|
for (let e = 0; e < a; e++) {
|
|
5789
5819
|
let t = s - c + e, r = n - Math.floor(i / 2), a = Math.max(0, r);
|
|
@@ -5809,15 +5839,15 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5809
5839
|
}
|
|
5810
5840
|
return s;
|
|
5811
5841
|
}
|
|
5812
|
-
let
|
|
5842
|
+
let R = /* @__PURE__ */ new Map(), ye = [];
|
|
5813
5843
|
for (let [e, t] of o.relationships.entries()) {
|
|
5814
5844
|
if (!t.label) continue;
|
|
5815
5845
|
let n = A.get(t.from), r = A.get(t.to);
|
|
5816
5846
|
if (!n || !r) continue;
|
|
5817
|
-
let i =
|
|
5818
|
-
|
|
5847
|
+
let i = Z(t.label), a = Math.floor(i.length / 2), o = Math.max(...i.map(B)) + 2, { idealMidX: s, baseMidY: c } = _e(e, n, r, o), l = /* @__PURE__ */ new Set([t.from, t.to]), u = ve(n, r, s, c, o, i.length, l);
|
|
5848
|
+
R.set(t, u);
|
|
5819
5849
|
let d = Math.max(0, s - Math.floor(o / 2));
|
|
5820
|
-
|
|
5850
|
+
ye.push({
|
|
5821
5851
|
rel: t,
|
|
5822
5852
|
idealMidX: s,
|
|
5823
5853
|
naturalStart: d,
|
|
@@ -5826,24 +5856,24 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5826
5856
|
rowEnd: u + a
|
|
5827
5857
|
});
|
|
5828
5858
|
}
|
|
5829
|
-
let
|
|
5859
|
+
let be = da(ye, (e) => ({
|
|
5830
5860
|
idealMid: e.idealMidX,
|
|
5831
5861
|
start: e.naturalStart,
|
|
5832
5862
|
end: e.naturalEnd,
|
|
5833
5863
|
rowStart: e.rowStart,
|
|
5834
5864
|
rowEnd: e.rowEnd
|
|
5835
|
-
})),
|
|
5836
|
-
for (let e of
|
|
5837
|
-
let t =
|
|
5838
|
-
t &&
|
|
5865
|
+
})), xe = /* @__PURE__ */ new Map();
|
|
5866
|
+
for (let e of ye) {
|
|
5867
|
+
let t = be.get(e);
|
|
5868
|
+
t && xe.set(e.rel, t);
|
|
5839
5869
|
}
|
|
5840
5870
|
for (let [e, t] of o.relationships.entries()) {
|
|
5841
5871
|
let n = A.get(t.from), r = A.get(t.to);
|
|
5842
5872
|
if (!(!n || !r) && t.label) {
|
|
5843
|
-
let i =
|
|
5873
|
+
let i = Z(t.label), { idealMidX: a } = _e(e, n, r, Math.max(...i.map((e) => B(e))) + 2), o = R.get(t) - Math.floor(i.length / 2), s = xe.get(t);
|
|
5844
5874
|
for (let e = 0; e < i.length; e++) {
|
|
5845
|
-
let t = o + e, n = i[e], r =
|
|
5846
|
-
u > 0 && t >= 0 && (
|
|
5875
|
+
let t = o + e, n = i[e], r = Nt(` ${n} `), { start: c, cells: l } = ha(Math.max(0, a - Math.floor(r.length / 2)), r, n, Math.max(0, s.left), s.right), u = c + l.length;
|
|
5876
|
+
u > 0 && t >= 0 && (Rt(N, Math.max(u, 1), Math.max(t + 1, 1)), Ft(re, Math.max(u, 1), Math.max(t + 1, 1)));
|
|
5847
5877
|
for (let e = 0; e < l.length; e++) {
|
|
5848
5878
|
let n = c + e;
|
|
5849
5879
|
n >= 0 && t >= 0 && ie(n, t, l[e], "text");
|
|
@@ -5851,7 +5881,7 @@ function _a(e, n, r, i, a = {}) {
|
|
|
5851
5881
|
}
|
|
5852
5882
|
}
|
|
5853
5883
|
}
|
|
5854
|
-
return ba(s, A, N, c, ie),
|
|
5884
|
+
return ba(s, A, N, c, ie), Gt(N, {
|
|
5855
5885
|
roleCanvas: re,
|
|
5856
5886
|
colorMode: r,
|
|
5857
5887
|
theme: i,
|
|
@@ -5895,7 +5925,7 @@ function ya(e, t) {
|
|
|
5895
5925
|
}
|
|
5896
5926
|
function ba(e, t, n, r, i) {
|
|
5897
5927
|
if (e.size === 0) return;
|
|
5898
|
-
let a =
|
|
5928
|
+
let a = pr("rounded", r), o = r ? "." : "╌";
|
|
5899
5929
|
for (let [r, s] of e) {
|
|
5900
5930
|
let e = t.get(r);
|
|
5901
5931
|
if (!e) continue;
|
|
@@ -6188,7 +6218,7 @@ var Pa = /^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|
|
|
|
6188
6218
|
}
|
|
6189
6219
|
], Ia = /^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u, La = /^([\w\p{L}-]+)(?=@\{)/u;
|
|
6190
6220
|
function Ra(e) {
|
|
6191
|
-
if (e.shape) return
|
|
6221
|
+
if (e.shape) return Ke(e.shape) ?? "rectangle";
|
|
6192
6222
|
if (e.icon !== void 0 || e.img !== void 0) switch (e.form?.toLowerCase()) {
|
|
6193
6223
|
case "circle": return "circle";
|
|
6194
6224
|
case "rounded": return "rounded";
|
|
@@ -6206,8 +6236,8 @@ var Va = /^([\w-]+)(?=@\{)/;
|
|
|
6206
6236
|
function Ha(e, t) {
|
|
6207
6237
|
let n = e.match(Va);
|
|
6208
6238
|
if (!n || !t.edges.some((e) => e.id === n[1])) return !1;
|
|
6209
|
-
let r =
|
|
6210
|
-
return r ? (Ua(t, n[1],
|
|
6239
|
+
let r = Ze(e.slice(n[1].length));
|
|
6240
|
+
return r ? (Ua(t, n[1], qe(r.body)), !0) : !1;
|
|
6211
6241
|
}
|
|
6212
6242
|
function Ua(e, t, n) {
|
|
6213
6243
|
for (let r of e.edges) r.id === t && (n.animate !== void 0 && (r.animate = n.animate.toLowerCase() !== "false"), n.animation !== void 0 && (r.animate = !0));
|
|
@@ -6272,9 +6302,9 @@ function Ja(e, t, n) {
|
|
|
6272
6302
|
o && (a = o[2], i = o[1] + i.slice(o[0].length));
|
|
6273
6303
|
let s = i.match(La);
|
|
6274
6304
|
if (s) {
|
|
6275
|
-
let e = s[1], a =
|
|
6305
|
+
let e = s[1], a = Ze(i.slice(e.length));
|
|
6276
6306
|
if (a) {
|
|
6277
|
-
let o =
|
|
6307
|
+
let o = qe(a.body);
|
|
6278
6308
|
Ya(t, n, {
|
|
6279
6309
|
id: e,
|
|
6280
6310
|
label: M(za(e, o)),
|
|
@@ -6344,7 +6374,7 @@ function $a(e, t) {
|
|
|
6344
6374
|
drawing: null,
|
|
6345
6375
|
drawn: !1,
|
|
6346
6376
|
styleClassName: "",
|
|
6347
|
-
styleClass:
|
|
6377
|
+
styleClass: Pn
|
|
6348
6378
|
};
|
|
6349
6379
|
i.set(t, e), a++;
|
|
6350
6380
|
}
|
|
@@ -6402,9 +6432,9 @@ function $a(e, t) {
|
|
|
6402
6432
|
return {
|
|
6403
6433
|
nodes: o,
|
|
6404
6434
|
edges: s,
|
|
6405
|
-
canvas:
|
|
6406
|
-
roleCanvas:
|
|
6407
|
-
grid:
|
|
6435
|
+
canvas: V(0, 0),
|
|
6436
|
+
roleCanvas: Pt(0, 0),
|
|
6437
|
+
grid: In(),
|
|
6408
6438
|
columnWidth: /* @__PURE__ */ new Map(),
|
|
6409
6439
|
rowHeight: /* @__PURE__ */ new Map(),
|
|
6410
6440
|
subgraphs: c,
|
|
@@ -6511,8 +6541,8 @@ function co(e, t, n, r, i = {}) {
|
|
|
6511
6541
|
t.graphDirection = a.direction === "LR" || a.direction === "RL" ? "LR" : "TD";
|
|
6512
6542
|
let o = $a(a, t);
|
|
6513
6543
|
Kr(o), Xi(o);
|
|
6514
|
-
let s = i.hyperlinks ?
|
|
6515
|
-
return a.direction === "BT" && (
|
|
6544
|
+
let s = i.hyperlinks ? st(o, a.interactions) : void 0;
|
|
6545
|
+
return a.direction === "BT" && (qt(o.canvas), Jt(o.roleCanvas), s && at(s)), Gt(o.canvas, {
|
|
6516
6546
|
roleCanvas: o.roleCanvas,
|
|
6517
6547
|
colorMode: n,
|
|
6518
6548
|
theme: r,
|
|
@@ -6522,14 +6552,14 @@ function co(e, t, n, r, i = {}) {
|
|
|
6522
6552
|
//#endregion
|
|
6523
6553
|
//#region packages/ascii-renderer/src/registry.ts
|
|
6524
6554
|
var lo = {
|
|
6525
|
-
xychart: (e, t, n, r) =>
|
|
6555
|
+
xychart: (e, t, n, r) => an(e, t, n, r),
|
|
6526
6556
|
er: (e, t, n, r) => ra(e, t, n, r),
|
|
6527
6557
|
sequence: (e, t, n, r) => la(e, t, n, r),
|
|
6528
6558
|
class: (e, t, n, r, i) => _a(e, t, n, r, i),
|
|
6529
6559
|
flowchart: (e, t, n, r, i) => co(e, t, n, r, i)
|
|
6530
6560
|
}, uo = /\x1b\[[0-9;]*m/g;
|
|
6531
6561
|
function fo(e) {
|
|
6532
|
-
let t = e.split("\n"), n = t.reduce((e, t) => Math.max(e,
|
|
6562
|
+
let t = e.split("\n"), n = t.reduce((e, t) => Math.max(e, nt(t.replace(uo, "")).length), 0), r = String(Math.max(0, t.length - 1)).length, i = " ".repeat(r + 1);
|
|
6533
6563
|
return [
|
|
6534
6564
|
i + Array.from({ length: n }, (e, t) => String(Math.floor(t / 10) % 10)).join(""),
|
|
6535
6565
|
i + Array.from({ length: n }, (e, t) => String(t % 10)).join(""),
|
|
@@ -6545,8 +6575,8 @@ function po(e, t = {}) {
|
|
|
6545
6575
|
paddingY: t.paddingY ?? 5,
|
|
6546
6576
|
boxBorderPadding: t.boxBorderPadding ?? 1,
|
|
6547
6577
|
graphDirection: "TD"
|
|
6548
|
-
}, r = t.colorMode === "auto" || t.colorMode === void 0 ?
|
|
6549
|
-
...
|
|
6578
|
+
}, r = t.colorMode === "auto" || t.colorMode === void 0 ? ft() : t.colorMode, i = {
|
|
6579
|
+
...ut,
|
|
6550
6580
|
...t.theme
|
|
6551
6581
|
}, a = lo[v(e)](e, n, r, i, {
|
|
6552
6582
|
hyperlinks: t.hyperlinks ?? !1,
|
|
@@ -6556,6 +6586,6 @@ function po(e, t = {}) {
|
|
|
6556
6586
|
}
|
|
6557
6587
|
var mo = po;
|
|
6558
6588
|
//#endregion
|
|
6559
|
-
export {
|
|
6589
|
+
export { ut as DEFAULT_ASCII_THEME, ft as detectColorMode, dt as diagramColorsToAsciiTheme, po as renderMermaidASCII, mo as renderMermaidAscii };
|
|
6560
6590
|
|
|
6561
6591
|
//# sourceMappingURL=ascii.js.map
|