@zombie-mermaid/svg-renderer 5.6.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +35 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +792 -787
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -728,7 +728,8 @@ function St(e, t, n) {
|
|
|
728
728
|
}
|
|
729
729
|
//#endregion
|
|
730
730
|
//#region packages/svg-renderer/src/layout-engine/layer-alignment.ts
|
|
731
|
-
|
|
731
|
+
var Ct = 12;
|
|
732
|
+
function wt(e, t, n) {
|
|
732
733
|
if (e.length === 0) return;
|
|
733
734
|
let r = n === "LR" || n === "RL", i = /* @__PURE__ */ new Set();
|
|
734
735
|
for (let e of t) i.add(`${e.source}:${e.target}`), i.add(`${e.target}:${e.source}`);
|
|
@@ -749,60 +750,61 @@ function Ct(e, t, n) {
|
|
|
749
750
|
Math.abs(e) > .5 && (r ? t.x = a : t.y = a, l.set(t.id, e));
|
|
750
751
|
}
|
|
751
752
|
}
|
|
752
|
-
if (l.size
|
|
753
|
-
|
|
754
|
-
let
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
}
|
|
766
|
-
} else if (t.y += n, e.points.length > 1) {
|
|
767
|
-
let r = e.points[e.points.length - 2];
|
|
768
|
-
r.y === t.y - n && (r.y += n);
|
|
769
|
-
}
|
|
753
|
+
if (l.size === 0) return;
|
|
754
|
+
let u = r ? "x" : "y", d = (e, t, n, r) => {
|
|
755
|
+
let i = e[t], a = i[u];
|
|
756
|
+
i[u] += r;
|
|
757
|
+
let [o, s, c] = [
|
|
758
|
+
1,
|
|
759
|
+
2,
|
|
760
|
+
3
|
|
761
|
+
].map((r) => e[t + r * n]);
|
|
762
|
+
if (o[u] === a) o[u] += r;
|
|
763
|
+
else if (s && c && s[u] === o[u]) {
|
|
764
|
+
let e = Math.sign(o[u] - a), t = o[u] + e * Math.max(0, Ct - e * (o[u] - i[u]));
|
|
765
|
+
e * (c[u] - t) > 0 && (o[u] = s[u] = t);
|
|
770
766
|
}
|
|
767
|
+
};
|
|
768
|
+
for (let e of t) {
|
|
769
|
+
let { points: t } = e;
|
|
770
|
+
if (t.length < 2) continue;
|
|
771
|
+
let n = l.get(e.source), r = l.get(e.target);
|
|
772
|
+
n != null && d(t, 0, 1, n), r != null && d(t, t.length - 1, -1, r);
|
|
771
773
|
}
|
|
772
774
|
}
|
|
773
775
|
//#endregion
|
|
774
776
|
//#region packages/svg-renderer/src/layout-engine/edge-bundling.ts
|
|
775
|
-
var
|
|
776
|
-
function
|
|
777
|
+
var Tt = .5;
|
|
778
|
+
function Et(e, t, n) {
|
|
777
779
|
for (let r = 0; r < e.length - 1; r++) {
|
|
778
780
|
let i = e[r], a = e[r + 1], o = Math.min(i.x, a.x), s = Math.max(i.x, a.x), c = Math.min(i.y, a.y), l = Math.max(i.y, a.y);
|
|
779
781
|
for (let e of t) {
|
|
780
782
|
if (n.has(e.id)) continue;
|
|
781
|
-
let t = e.x +
|
|
783
|
+
let t = e.x + Tt, r = e.x + e.width - Tt, i = e.y + Tt, a = e.y + e.height - Tt;
|
|
782
784
|
if (!(t >= r || i >= a) && o < r && s > t && c < a && l > i) return !1;
|
|
783
785
|
}
|
|
784
786
|
}
|
|
785
787
|
return !0;
|
|
786
788
|
}
|
|
787
|
-
function
|
|
789
|
+
function Dt(e, t, n) {
|
|
788
790
|
let r = [];
|
|
789
|
-
for (let i of n) e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height && (r.push(i), r.push(...
|
|
791
|
+
for (let i of n) e >= i.x && e <= i.x + i.width && t >= i.y && t <= i.y + i.height && (r.push(i), r.push(...Dt(e, t, i.children)));
|
|
790
792
|
return r;
|
|
791
793
|
}
|
|
792
|
-
function
|
|
793
|
-
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(
|
|
794
|
+
function Ot(e, t, n, r, i) {
|
|
795
|
+
let a = i === "LR", o = i === "RL", s = i === "BT", c = a || o, l = new Set(Dt(t, n, r).map((e) => e.id)), u = Dt(c ? e : t, c ? n : e, r).find((e) => !l.has(e.id));
|
|
794
796
|
return u ? a ? u.x - 12 : o ? u.x + u.width + 12 : s ? u.y + u.height + 12 : u.y - 12 : e;
|
|
795
797
|
}
|
|
796
|
-
var
|
|
797
|
-
function
|
|
798
|
+
var kt = 2;
|
|
799
|
+
function At(e, t, n, r, i) {
|
|
798
800
|
for (let a of e) {
|
|
799
801
|
if (t.has(a) || a.source === a.target) continue;
|
|
800
802
|
let e = a.source === n ? a.points[0] : a.target === n ? a.points[a.points.length - 1] : void 0;
|
|
801
|
-
if (e && Math.abs((i ? e.x : e.y) - r) <=
|
|
803
|
+
if (e && Math.abs((i ? e.x : e.y) - r) <= kt) return !0;
|
|
802
804
|
}
|
|
803
805
|
return !1;
|
|
804
806
|
}
|
|
805
|
-
function
|
|
807
|
+
function jt(e, t, n, r) {
|
|
806
808
|
let i = new Map(t.map((e) => [e.id, e])), a = /* @__PURE__ */ new Set(), o = r === "LR", s = r === "RL", c = r === "BT", l = o || s, u = /* @__PURE__ */ new Map();
|
|
807
809
|
for (let t of e) {
|
|
808
810
|
if (t.source === t.target) continue;
|
|
@@ -827,9 +829,9 @@ function At(e, t, n, r) {
|
|
|
827
829
|
let h = p.x + p.width / 2, g = p.y + p.height / 2;
|
|
828
830
|
if (l) {
|
|
829
831
|
let i = o ? p.x + p.width : p.x, s = g;
|
|
830
|
-
if (
|
|
832
|
+
if (At(e, new Set(m.map((e) => e.edge)), d, i, !0)) continue;
|
|
831
833
|
let c = i + ((o ? Math.min(...m.map((e) => e.node.x)) : Math.max(...m.map((e) => e.node.x + e.node.width))) - i) / 2;
|
|
832
|
-
c =
|
|
834
|
+
c = Ot(c, h, g, n, r);
|
|
833
835
|
let l = [];
|
|
834
836
|
for (let { edge: e, node: n } of m) {
|
|
835
837
|
let r = o ? n.x : n.x + n.width, a = n.y + n.height / 2, u = [
|
|
@@ -850,7 +852,7 @@ function At(e, t, n, r) {
|
|
|
850
852
|
y: a
|
|
851
853
|
}
|
|
852
854
|
];
|
|
853
|
-
|
|
855
|
+
Et(u, t, /* @__PURE__ */ new Set([d, n.id])) && l.push({
|
|
854
856
|
edge: e,
|
|
855
857
|
points: u
|
|
856
858
|
});
|
|
@@ -859,9 +861,9 @@ function At(e, t, n, r) {
|
|
|
859
861
|
for (let { edge: e, points: t } of l) e.points = t, a.add(e);
|
|
860
862
|
} else {
|
|
861
863
|
let i = h, o = c ? p.y : p.y + p.height;
|
|
862
|
-
if (
|
|
864
|
+
if (At(e, new Set(m.map((e) => e.edge)), d, o, !1)) continue;
|
|
863
865
|
let s = o + ((c ? Math.max(...m.map((e) => e.node.y + e.node.height)) : Math.min(...m.map((e) => e.node.y))) - o) / 2;
|
|
864
|
-
s =
|
|
866
|
+
s = Ot(s, h, g, n, r);
|
|
865
867
|
let l = [];
|
|
866
868
|
for (let { edge: e, node: n } of m) {
|
|
867
869
|
let r = n.x + n.width / 2, a = c ? n.y + n.height : n.y, u = [
|
|
@@ -882,7 +884,7 @@ function At(e, t, n, r) {
|
|
|
882
884
|
y: a
|
|
883
885
|
}
|
|
884
886
|
];
|
|
885
|
-
|
|
887
|
+
Et(u, t, /* @__PURE__ */ new Set([d, n.id])) && l.push({
|
|
886
888
|
edge: e,
|
|
887
889
|
points: u
|
|
888
890
|
});
|
|
@@ -915,9 +917,9 @@ function At(e, t, n, r) {
|
|
|
915
917
|
let m = f.x + f.width / 2, h = f.y + f.height / 2;
|
|
916
918
|
if (l) {
|
|
917
919
|
let i = o ? f.x : f.x + f.width, s = h;
|
|
918
|
-
if (
|
|
920
|
+
if (At(e, new Set(p.map((e) => e.edge)), a, i, !0)) continue;
|
|
919
921
|
let c = o ? Math.max(...p.map((e) => e.node.x + e.node.width)) : Math.min(...p.map((e) => e.node.x)), l = c + (i - c) / 2;
|
|
920
|
-
l =
|
|
922
|
+
l = Ot(l, m, h, n, r);
|
|
921
923
|
let u = [];
|
|
922
924
|
for (let { edge: e, node: n } of p) {
|
|
923
925
|
let r = o ? n.x + n.width : n.x, c = n.y + n.height / 2, d = [
|
|
@@ -938,7 +940,7 @@ function At(e, t, n, r) {
|
|
|
938
940
|
y: s
|
|
939
941
|
}
|
|
940
942
|
];
|
|
941
|
-
|
|
943
|
+
Et(d, t, /* @__PURE__ */ new Set([n.id, a])) && u.push({
|
|
942
944
|
edge: e,
|
|
943
945
|
points: d
|
|
944
946
|
});
|
|
@@ -947,9 +949,9 @@ function At(e, t, n, r) {
|
|
|
947
949
|
for (let { edge: e, points: t } of u) e.points = t;
|
|
948
950
|
} else {
|
|
949
951
|
let i = m, o = c ? f.y + f.height : f.y;
|
|
950
|
-
if (
|
|
952
|
+
if (At(e, new Set(p.map((e) => e.edge)), a, o, !1)) continue;
|
|
951
953
|
let s = c ? Math.min(...p.map((e) => e.node.y)) : Math.max(...p.map((e) => e.node.y + e.node.height)), l = s + (o - s) / 2;
|
|
952
|
-
l =
|
|
954
|
+
l = Ot(l, m, h, n, r);
|
|
953
955
|
let u = [];
|
|
954
956
|
for (let { edge: e, node: n } of p) {
|
|
955
957
|
let r = n.x + n.width / 2, s = [
|
|
@@ -970,7 +972,7 @@ function At(e, t, n, r) {
|
|
|
970
972
|
y: o
|
|
971
973
|
}
|
|
972
974
|
];
|
|
973
|
-
|
|
975
|
+
Et(s, t, /* @__PURE__ */ new Set([n.id, a])) && u.push({
|
|
974
976
|
edge: e,
|
|
975
977
|
points: s
|
|
976
978
|
});
|
|
@@ -982,8 +984,8 @@ function At(e, t, n, r) {
|
|
|
982
984
|
}
|
|
983
985
|
//#endregion
|
|
984
986
|
//#region packages/svg-renderer/src/layout-engine/jog-straightening.ts
|
|
985
|
-
var
|
|
986
|
-
function
|
|
987
|
+
var Mt = 1.5, Nt = .01;
|
|
988
|
+
function Pt(e) {
|
|
987
989
|
let t = e.map((e) => ({ ...e })), n = 0;
|
|
988
990
|
for (; n + 3 < t.length;) {
|
|
989
991
|
let [e, r, i, a] = [
|
|
@@ -991,7 +993,7 @@ function Nt(e) {
|
|
|
991
993
|
t[n + 1],
|
|
992
994
|
t[n + 2],
|
|
993
995
|
t[n + 3]
|
|
994
|
-
], o = Math.abs(e.x - r.x) <
|
|
996
|
+
], o = Math.abs(e.x - r.x) < Nt && Math.abs(i.x - a.x) < Nt && Math.abs(r.y - i.y) < Nt && Math.abs(r.x - i.x) <= Mt && Math.abs(r.x - i.x) >= Nt, s = Math.abs(e.y - r.y) < Nt && Math.abs(i.y - a.y) < Nt && Math.abs(r.x - i.x) < Nt && Math.abs(r.y - i.y) <= Mt && Math.abs(r.y - i.y) >= Nt;
|
|
995
997
|
if (o) {
|
|
996
998
|
let r = (e.x + a.x) / 2;
|
|
997
999
|
t.splice(n, 4, {
|
|
@@ -1016,7 +1018,7 @@ function Nt(e) {
|
|
|
1016
1018
|
}
|
|
1017
1019
|
//#endregion
|
|
1018
1020
|
//#region packages/svg-renderer/src/layout-engine/elk-adapter-utils.ts
|
|
1019
|
-
function
|
|
1021
|
+
function Ft(e, t = 0, n = 0) {
|
|
1020
1022
|
let r = [];
|
|
1021
1023
|
if (!e.sections || e.sections.length === 0) return r;
|
|
1022
1024
|
let i = e.sections[0];
|
|
@@ -1032,7 +1034,7 @@ function Pt(e, t = 0, n = 0) {
|
|
|
1032
1034
|
y: i.endPoint.y + n
|
|
1033
1035
|
}), r;
|
|
1034
1036
|
}
|
|
1035
|
-
function
|
|
1037
|
+
function It(e, t = 0, n = 0) {
|
|
1036
1038
|
if (!e.labels || e.labels.length === 0) return;
|
|
1037
1039
|
let r = e.labels[0];
|
|
1038
1040
|
if (r.x != null && r.y != null) return {
|
|
@@ -1042,11 +1044,11 @@ function Ft(e, t = 0, n = 0) {
|
|
|
1042
1044
|
}
|
|
1043
1045
|
//#endregion
|
|
1044
1046
|
//#region packages/svg-renderer/src/layout-engine/from-elk.ts
|
|
1045
|
-
var
|
|
1046
|
-
function
|
|
1047
|
-
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(
|
|
1048
|
-
for (let e = 0; e <=
|
|
1049
|
-
let t = Math.PI * e /
|
|
1047
|
+
var Lt = 16, Rt = 28, zt = 18, Bt = 28, Vt = 10;
|
|
1048
|
+
function Ht(e, t) {
|
|
1049
|
+
let n = e.x + e.width, r = e.y + e.height / 2, i = Math.min(Bt, e.height * .6) / 2, a = Rt + t * zt, o = [];
|
|
1050
|
+
for (let e = 0; e <= Lt; e++) {
|
|
1051
|
+
let t = Math.PI * e / Lt;
|
|
1050
1052
|
o.push({
|
|
1051
1053
|
x: n + a * Math.sin(t),
|
|
1052
1054
|
y: r - i * Math.cos(t)
|
|
@@ -1055,12 +1057,12 @@ function Vt(e, t) {
|
|
|
1055
1057
|
return {
|
|
1056
1058
|
points: o,
|
|
1057
1059
|
labelPosition: {
|
|
1058
|
-
x: n + a +
|
|
1060
|
+
x: n + a + Vt,
|
|
1059
1061
|
y: r
|
|
1060
1062
|
}
|
|
1061
1063
|
};
|
|
1062
1064
|
}
|
|
1063
|
-
function
|
|
1065
|
+
function Ut(e, t, n) {
|
|
1064
1066
|
let r = /* @__PURE__ */ new Map();
|
|
1065
1067
|
for (let i = 0; i < e.edges.length; i++) {
|
|
1066
1068
|
let a = e.edges[i];
|
|
@@ -1069,7 +1071,7 @@ function Ht(e, t, n) {
|
|
|
1069
1071
|
if (!o) continue;
|
|
1070
1072
|
let s = r.get(o.id) ?? 0;
|
|
1071
1073
|
r.set(o.id, s + 1);
|
|
1072
|
-
let { points: c, labelPosition: l } =
|
|
1074
|
+
let { points: c, labelPosition: l } = Ht(o, s);
|
|
1073
1075
|
n.push({
|
|
1074
1076
|
source: a.source,
|
|
1075
1077
|
target: a.target,
|
|
@@ -1079,35 +1081,35 @@ function Ht(e, t, n) {
|
|
|
1079
1081
|
hasArrowEnd: a.hasArrowEnd,
|
|
1080
1082
|
points: c,
|
|
1081
1083
|
labelPosition: a.label ? l : void 0,
|
|
1082
|
-
inlineStyle:
|
|
1084
|
+
inlineStyle: tn(i, e),
|
|
1083
1085
|
id: a.id,
|
|
1084
1086
|
animate: a.animate
|
|
1085
1087
|
});
|
|
1086
1088
|
}
|
|
1087
1089
|
}
|
|
1088
|
-
function
|
|
1090
|
+
function Wt(e) {
|
|
1089
1091
|
let t = [];
|
|
1090
1092
|
for (let n of e) t.push({
|
|
1091
1093
|
x: n.x,
|
|
1092
1094
|
y: n.y,
|
|
1093
1095
|
right: n.x + n.width,
|
|
1094
1096
|
bottom: n.y + n.height
|
|
1095
|
-
}), t.push(...
|
|
1097
|
+
}), t.push(...Wt(n.children));
|
|
1096
1098
|
return t;
|
|
1097
1099
|
}
|
|
1098
|
-
function
|
|
1100
|
+
function Gt(e, t, n = !1) {
|
|
1099
1101
|
let r = [], i = [], a = [], o = /* @__PURE__ */ new Set();
|
|
1100
|
-
for (let e of t.subgraphs)
|
|
1101
|
-
|
|
1102
|
-
let s =
|
|
1103
|
-
|
|
1102
|
+
for (let e of t.subgraphs) en(e, o);
|
|
1103
|
+
Kt(e, t, o, r, a, 0, 0);
|
|
1104
|
+
let s = Wt(a);
|
|
1105
|
+
Yt(e, t, i, 0, 0, s.length > 0 ? {
|
|
1104
1106
|
leftX: Math.min(...s.map((e) => e.x)) - 20,
|
|
1105
1107
|
rightX: Math.max(...s.map((e) => e.right)) + 20
|
|
1106
|
-
} : void 0),
|
|
1108
|
+
} : void 0), wt(r, i, t.direction);
|
|
1107
1109
|
let c = new Map(r.map((e) => [e.id, e]));
|
|
1108
|
-
|
|
1110
|
+
Ut(t, c, i), n && jt(i, r, a, t.direction);
|
|
1109
1111
|
for (let e of i) {
|
|
1110
|
-
e.points =
|
|
1112
|
+
e.points = Pt(e.points);
|
|
1111
1113
|
let t = c.get(e.source), n = c.get(e.target);
|
|
1112
1114
|
t && (e.points = yt(e.points, t, !0)), n && (e.points = yt(e.points, n, !1));
|
|
1113
1115
|
}
|
|
@@ -1124,13 +1126,13 @@ function Wt(e, t, n = !1) {
|
|
|
1124
1126
|
groups: a
|
|
1125
1127
|
};
|
|
1126
1128
|
}
|
|
1127
|
-
function
|
|
1129
|
+
function Kt(e, t, n, r, i, a, o) {
|
|
1128
1130
|
if (e.children) for (let s of e.children) {
|
|
1129
1131
|
let e = (s.x ?? 0) + a, c = (s.y ?? 0) + o, l = s.width ?? 0, u = s.height ?? 0;
|
|
1130
1132
|
if (n.has(s.id)) {
|
|
1131
1133
|
let a = [];
|
|
1132
|
-
|
|
1133
|
-
let o =
|
|
1134
|
+
Kt(s, t, n, r, a, e, c);
|
|
1135
|
+
let o = $t(t.subgraphs, s.id);
|
|
1134
1136
|
i.push({
|
|
1135
1137
|
id: s.id,
|
|
1136
1138
|
label: o?.label ?? "",
|
|
@@ -1158,11 +1160,11 @@ function Gt(e, t, n, r, i, a, o) {
|
|
|
1158
1160
|
interaction: t.interactions.get(s.id)
|
|
1159
1161
|
});
|
|
1160
1162
|
}
|
|
1161
|
-
s.children && s.children.length > 0 &&
|
|
1163
|
+
s.children && s.children.length > 0 && Kt(s, t, n, r, i, e, c);
|
|
1162
1164
|
}
|
|
1163
1165
|
}
|
|
1164
1166
|
}
|
|
1165
|
-
function
|
|
1167
|
+
function qt(e) {
|
|
1166
1168
|
let t = /^e(\d+)$/.exec(e);
|
|
1167
1169
|
if (t) return {
|
|
1168
1170
|
edgeIndex: parseInt(t[1], 10),
|
|
@@ -1175,7 +1177,7 @@ function Kt(e) {
|
|
|
1175
1177
|
level: parseInt(n[3], 10)
|
|
1176
1178
|
};
|
|
1177
1179
|
}
|
|
1178
|
-
function
|
|
1180
|
+
function Jt(e) {
|
|
1179
1181
|
if (e.length === 0) return {
|
|
1180
1182
|
x: 0,
|
|
1181
1183
|
y: 0
|
|
@@ -1200,11 +1202,11 @@ function qt(e) {
|
|
|
1200
1202
|
}
|
|
1201
1203
|
return e[e.length - 1];
|
|
1202
1204
|
}
|
|
1203
|
-
function
|
|
1205
|
+
function Yt(e, t, n, r, i, a) {
|
|
1204
1206
|
let o = /* @__PURE__ */ new Map();
|
|
1205
|
-
|
|
1207
|
+
Xt(e, o, 0, 0);
|
|
1206
1208
|
let s = /* @__PURE__ */ new Map();
|
|
1207
|
-
|
|
1209
|
+
Qt(e, s, 0, 0, o);
|
|
1208
1210
|
let c = 0;
|
|
1209
1211
|
for (let [e, r] of s) {
|
|
1210
1212
|
let i = t.edges[e];
|
|
@@ -1217,9 +1219,9 @@ function Jt(e, t, n, r, i, a) {
|
|
|
1217
1219
|
let u = [...r.targetHops.keys()].sort((e, t) => e - t);
|
|
1218
1220
|
for (let e of u) s(r.targetHops.get(e));
|
|
1219
1221
|
let d;
|
|
1220
|
-
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ??
|
|
1221
|
-
let f =
|
|
1222
|
-
f !== o && c++, i.label && f !== o && f.length >= 2 && (d =
|
|
1222
|
+
i.label && o.length >= 2 && (d = r.bridge?.labelPosition ?? Jt(o));
|
|
1223
|
+
let f = Zt(o, a, c);
|
|
1224
|
+
f !== o && c++, i.label && f !== o && f.length >= 2 && (d = Jt(f)), n.push({
|
|
1223
1225
|
source: i.source,
|
|
1224
1226
|
target: i.target,
|
|
1225
1227
|
label: i.label,
|
|
@@ -1228,13 +1230,13 @@ function Jt(e, t, n, r, i, a) {
|
|
|
1228
1230
|
hasArrowEnd: i.hasArrowEnd,
|
|
1229
1231
|
points: it(t).has(e) ? [...f].reverse() : f,
|
|
1230
1232
|
labelPosition: d,
|
|
1231
|
-
inlineStyle:
|
|
1233
|
+
inlineStyle: tn(e, t),
|
|
1232
1234
|
id: i.id,
|
|
1233
1235
|
animate: i.animate
|
|
1234
1236
|
});
|
|
1235
1237
|
}
|
|
1236
1238
|
}
|
|
1237
|
-
function
|
|
1239
|
+
function Xt(e, t, n, r) {
|
|
1238
1240
|
t.set(e.id, {
|
|
1239
1241
|
x: n,
|
|
1240
1242
|
y: r
|
|
@@ -1242,10 +1244,10 @@ function Yt(e, t, n, r) {
|
|
|
1242
1244
|
for (let i of e.children ?? []) {
|
|
1243
1245
|
/* v8 ignore next */
|
|
1244
1246
|
let e = i.x ?? 0, a = i.y ?? 0;
|
|
1245
|
-
|
|
1247
|
+
Xt(i, t, n + e, r + a);
|
|
1246
1248
|
}
|
|
1247
1249
|
}
|
|
1248
|
-
function
|
|
1250
|
+
function Zt(e, t, n = 0) {
|
|
1249
1251
|
if (e.length < 2) return e;
|
|
1250
1252
|
let r = !1;
|
|
1251
1253
|
for (let t = 1; t < e.length; t++) {
|
|
@@ -1284,11 +1286,11 @@ function Xt(e, t, n = 0) {
|
|
|
1284
1286
|
}
|
|
1285
1287
|
return i;
|
|
1286
1288
|
}
|
|
1287
|
-
function
|
|
1289
|
+
function Qt(e, t, n, r, i) {
|
|
1288
1290
|
if (e.edges) for (let a of e.edges) {
|
|
1289
|
-
let e =
|
|
1291
|
+
let e = qt(a.id);
|
|
1290
1292
|
if (!e) continue;
|
|
1291
|
-
let { edgeIndex: o } = e, s = a.container, c = s ? i.get(s) : void 0, l = c?.x ?? n, u = c?.y ?? r, d =
|
|
1293
|
+
let { edgeIndex: o } = e, s = a.container, c = s ? i.get(s) : void 0, l = c?.x ?? n, u = c?.y ?? r, d = Ft(a, l, u), f = It(a, l, u), p = t.get(o) ?? {
|
|
1292
1294
|
sourceHops: /* @__PURE__ */ new Map(),
|
|
1293
1295
|
targetHops: /* @__PURE__ */ new Map()
|
|
1294
1296
|
};
|
|
@@ -1300,20 +1302,20 @@ function Zt(e, t, n, r, i) {
|
|
|
1300
1302
|
};
|
|
1301
1303
|
e.role === "bridge" ? p.bridge = m : e.role === "source" ? p.sourceHops.set(e.level, m) : p.targetHops.set(e.level, m);
|
|
1302
1304
|
}
|
|
1303
|
-
if (e.children) for (let a of e.children)
|
|
1305
|
+
if (e.children) for (let a of e.children) Qt(a, t, n + (a.x ?? 0), r + (a.y ?? 0), i);
|
|
1304
1306
|
}
|
|
1305
|
-
function
|
|
1307
|
+
function $t(e, t) {
|
|
1306
1308
|
for (let n of e) {
|
|
1307
1309
|
if (n.id === t) return n;
|
|
1308
|
-
let e =
|
|
1310
|
+
let e = $t(n.children, t);
|
|
1309
1311
|
if (e) return e;
|
|
1310
1312
|
}
|
|
1311
1313
|
}
|
|
1312
|
-
function
|
|
1314
|
+
function en(e, t) {
|
|
1313
1315
|
t.add(e.id);
|
|
1314
|
-
for (let n of e.children)
|
|
1316
|
+
for (let n of e.children) en(n, t);
|
|
1315
1317
|
}
|
|
1316
|
-
function
|
|
1318
|
+
function tn(e, t) {
|
|
1317
1319
|
let n, r = t.linkStyles.get("default");
|
|
1318
1320
|
r && (n = { ...r });
|
|
1319
1321
|
let i = t.linkStyles.get(e);
|
|
@@ -1324,12 +1326,12 @@ function en(e, t) {
|
|
|
1324
1326
|
}
|
|
1325
1327
|
//#endregion
|
|
1326
1328
|
//#region packages/svg-renderer/src/layout-engine/inner-edges.ts
|
|
1327
|
-
var
|
|
1329
|
+
var nn = 10, rn = 14, an = 14, on = 10, sn = 24, cn = 400, ln = /* @__PURE__ */ new Set([
|
|
1328
1330
|
"rectangle",
|
|
1329
1331
|
"rounded",
|
|
1330
1332
|
"subroutine"
|
|
1331
1333
|
]);
|
|
1332
|
-
function
|
|
1334
|
+
function un(e) {
|
|
1333
1335
|
let t = e === "TD" || e === "TB" || e === "BT", n = e === "BT" || e === "RL" ? -1 : 1;
|
|
1334
1336
|
return {
|
|
1335
1337
|
span: (e) => {
|
|
@@ -1350,17 +1352,17 @@ function ln(e) {
|
|
|
1350
1352
|
}
|
|
1351
1353
|
};
|
|
1352
1354
|
}
|
|
1353
|
-
function
|
|
1355
|
+
function dn(e, t, n) {
|
|
1354
1356
|
let r = Math.min(e.a, t.a), i = Math.max(e.a, t.a), a = Math.min(e.c, t.c), o = Math.max(e.c, t.c);
|
|
1355
1357
|
return i > n.a0 && r < n.a1 && o > n.c0 && a < n.c1;
|
|
1356
1358
|
}
|
|
1357
|
-
var
|
|
1359
|
+
var fn = (e, t) => ({
|
|
1358
1360
|
a0: e.a0 - t,
|
|
1359
1361
|
a1: e.a1 + t,
|
|
1360
1362
|
c0: e.c0 - t,
|
|
1361
1363
|
c1: e.c1 + t
|
|
1362
1364
|
});
|
|
1363
|
-
function
|
|
1365
|
+
function pn(e, t) {
|
|
1364
1366
|
let n = e.span({
|
|
1365
1367
|
x: t.x,
|
|
1366
1368
|
y: t.y,
|
|
@@ -1372,23 +1374,23 @@ function fn(e, t) {
|
|
|
1372
1374
|
c: n.c0
|
|
1373
1375
|
};
|
|
1374
1376
|
}
|
|
1375
|
-
function
|
|
1377
|
+
function mn(e, t, n) {
|
|
1376
1378
|
let r = e.c === t.c;
|
|
1377
1379
|
for (let i = 1; i < n.length; i++) {
|
|
1378
1380
|
let a = n[i - 1], o = n[i];
|
|
1379
1381
|
if (a.c === o.c === r) {
|
|
1380
1382
|
if (r) {
|
|
1381
1383
|
let n = Math.abs(e.c - a.c), r = Math.min(Math.max(e.a, t.a), Math.max(a.a, o.a)) - Math.max(Math.min(e.a, t.a), Math.min(a.a, o.a));
|
|
1382
|
-
if (n <
|
|
1384
|
+
if (n < rn && r > 0) return !0;
|
|
1383
1385
|
} else {
|
|
1384
1386
|
let n = Math.abs(e.a - a.a), r = Math.min(Math.max(e.c, t.c), Math.max(a.c, o.c)) - Math.max(Math.min(e.c, t.c), Math.min(a.c, o.c));
|
|
1385
|
-
if (n <
|
|
1387
|
+
if (n < rn && r > 0) return !0;
|
|
1386
1388
|
}
|
|
1387
1389
|
}
|
|
1388
1390
|
}
|
|
1389
1391
|
return !1;
|
|
1390
1392
|
}
|
|
1391
|
-
function
|
|
1393
|
+
function hn(e) {
|
|
1392
1394
|
let t = [];
|
|
1393
1395
|
for (let n of e) {
|
|
1394
1396
|
let e = t[t.length - 1];
|
|
@@ -1400,24 +1402,24 @@ function mn(e) {
|
|
|
1400
1402
|
}
|
|
1401
1403
|
return t;
|
|
1402
1404
|
}
|
|
1403
|
-
var
|
|
1405
|
+
var gn = (e) => {
|
|
1404
1406
|
let t = 0;
|
|
1405
1407
|
for (let n = 1; n < e.length; n++) t += Math.abs(e[n].a - e[n - 1].a) + Math.abs(e[n].c - e[n - 1].c);
|
|
1406
1408
|
return t;
|
|
1407
1409
|
};
|
|
1408
|
-
function
|
|
1409
|
-
let o =
|
|
1410
|
+
function _n(e, t, n, r, i, a = []) {
|
|
1411
|
+
let o = un(i), s = o.span(e), c = o.span(t), l = s.a1 <= c.a0, u = c.a1 <= s.a0;
|
|
1410
1412
|
if (!l && !u) return;
|
|
1411
1413
|
let d = o.span(r), f = {
|
|
1412
|
-
a0: d.a0 +
|
|
1413
|
-
a1: d.a1 -
|
|
1414
|
-
c0: d.c0 +
|
|
1415
|
-
c1: d.c1 -
|
|
1416
|
-
}, p = a.map((e) => e.map((e) =>
|
|
1414
|
+
a0: d.a0 + on,
|
|
1415
|
+
a1: d.a1 - on,
|
|
1416
|
+
c0: d.c0 + on,
|
|
1417
|
+
c1: d.c1 - on
|
|
1418
|
+
}, p = a.map((e) => e.map((e) => pn(o, e))), m = n.map((e) => fn(o.span(e), nn)), h = (e) => (e.c0 + e.c1) / 2, g = (e) => (e.a0 + e.a1) / 2, _ = (e) => ln.has(e.shape), v = (e) => {
|
|
1417
1419
|
for (let t of e) if (t.a < f.a0 || t.a > f.a1 || t.c < f.c0 || t.c > f.c1) return !1;
|
|
1418
1420
|
for (let t = 1; t < e.length; t++) {
|
|
1419
1421
|
let n = e[t - 1], r = e[t];
|
|
1420
|
-
if (n.a !== r.a && n.c !== r.c || m.some((e) =>
|
|
1422
|
+
if (n.a !== r.a && n.c !== r.c || m.some((e) => dn(n, r, e)) || dn(n, r, s) || dn(n, r, c) || p.some((e) => mn(n, r, e))) return !1;
|
|
1421
1423
|
}
|
|
1422
1424
|
return !0;
|
|
1423
1425
|
}, y = /* @__PURE__ */ new Set([
|
|
@@ -1427,10 +1429,10 @@ function gn(e, t, n, r, i, a = []) {
|
|
|
1427
1429
|
f.c1
|
|
1428
1430
|
]);
|
|
1429
1431
|
for (let e of m) y.add(e.c0 - 1), y.add(e.c1 + 1);
|
|
1430
|
-
for (let e of [s, c]) y.add(e.c0 -
|
|
1432
|
+
for (let e of [s, c]) y.add(e.c0 - nn), y.add(e.c1 + nn);
|
|
1431
1433
|
let b = (e, t, n) => _(e) ? n >= t.c0 + 4 && n <= t.c1 - 4 : Math.abs(n - h(t)) < .5, x = [];
|
|
1432
1434
|
if (l) {
|
|
1433
|
-
let n = (c.a0 - s.a1) / 2, r = s.a1 + Math.min(
|
|
1435
|
+
let n = (c.a0 - s.a1) / 2, r = s.a1 + Math.min(an, n), i = c.a0 - Math.min(an, n);
|
|
1434
1436
|
for (let n of y) {
|
|
1435
1437
|
b(e, s, n) && b(t, c, n) && x.push([{
|
|
1436
1438
|
a: s.a1,
|
|
@@ -1569,14 +1571,14 @@ function gn(e, t, n, r, i, a = []) {
|
|
|
1569
1571
|
}
|
|
1570
1572
|
let S, C = Infinity;
|
|
1571
1573
|
for (let t of x) {
|
|
1572
|
-
let n =
|
|
1574
|
+
let n = hn(t);
|
|
1573
1575
|
if (n.length < 2 || !v(n)) continue;
|
|
1574
|
-
let r = e.shape === "diamond" && n[0].a === s.a1 ?
|
|
1576
|
+
let r = e.shape === "diamond" && n[0].a === s.a1 ? cn : 0, i = gn(n) + sn * (n.length - 2) + r;
|
|
1575
1577
|
i < C && (S = n, C = i);
|
|
1576
1578
|
}
|
|
1577
1579
|
return S?.map(o.toPoint);
|
|
1578
1580
|
}
|
|
1579
|
-
function
|
|
1581
|
+
function vn(e) {
|
|
1580
1582
|
let t = {
|
|
1581
1583
|
x: e[0].x,
|
|
1582
1584
|
y: e[0].y
|
|
@@ -1592,24 +1594,24 @@ function _n(e) {
|
|
|
1592
1594
|
}
|
|
1593
1595
|
//#endregion
|
|
1594
1596
|
//#region packages/svg-renderer/src/layout-engine/compound-flat.ts
|
|
1595
|
-
var
|
|
1596
|
-
function
|
|
1597
|
-
return e.flatMap((e) => [e, ...
|
|
1597
|
+
var yn = "__zm_spine__", bn = 8, xn = 6, Sn = 12, Cn = 4, wn = 4, Tn = .25, En = .02, Dn = 40, On = (e) => e === "TD" || e === "TB" || e === "BT", kn = (e) => e.startsWith(yn);
|
|
1598
|
+
function An(e) {
|
|
1599
|
+
return e.flatMap((e) => [e, ...An(e.children)]);
|
|
1598
1600
|
}
|
|
1599
1601
|
function U(e) {
|
|
1600
1602
|
let t = new Set(e.nodeIds);
|
|
1601
1603
|
for (let n of e.children) for (let e of U(n)) t.add(e);
|
|
1602
1604
|
return t;
|
|
1603
1605
|
}
|
|
1604
|
-
function
|
|
1606
|
+
function jn(e) {
|
|
1605
1607
|
if (e.subgraphs.length === 0 || et(e) || dt(e.subgraphs)) return !1;
|
|
1606
|
-
for (let t of e.nodes.keys()) if (
|
|
1608
|
+
for (let t of e.nodes.keys()) if (kn(t)) return !1;
|
|
1607
1609
|
for (let t of e.edges) if (!e.nodes.has(t.source) || !e.nodes.has(t.target)) return !1;
|
|
1608
|
-
let t =
|
|
1610
|
+
let t = An(e.subgraphs);
|
|
1609
1611
|
return !t.some((t) => e.nodes.has(t.id)) && t.every((t) => [...U(t)].some((t) => e.nodes.has(t)));
|
|
1610
1612
|
}
|
|
1611
|
-
function
|
|
1612
|
-
let n =
|
|
1613
|
+
function Mn(e, t) {
|
|
1614
|
+
let n = On(t), r = (e) => n ? [e.y, e.y + e.height] : [e.x, e.x + e.width], i = [...e].sort((e, t) => {
|
|
1613
1615
|
let [n, i] = r(e), [a, o] = r(t);
|
|
1614
1616
|
return (n + i) / 2 - (a + o) / 2;
|
|
1615
1617
|
}), a = [];
|
|
@@ -1624,7 +1626,7 @@ function jn(e, t) {
|
|
|
1624
1626
|
let o = /* @__PURE__ */ new Map();
|
|
1625
1627
|
return a.forEach((e, t) => e.ids.forEach((e) => o.set(e, t))), o;
|
|
1626
1628
|
}
|
|
1627
|
-
function
|
|
1629
|
+
function Nn(e, t, n) {
|
|
1628
1630
|
let r = {
|
|
1629
1631
|
ghosts: [],
|
|
1630
1632
|
edges: []
|
|
@@ -1637,7 +1639,7 @@ function Mn(e, t, n) {
|
|
|
1637
1639
|
let o = e.filter((e) => t.get(e) === a).sort((e, t) => n(e) - n(t));
|
|
1638
1640
|
if (o.length > 0) c.set(a, o[0]);
|
|
1639
1641
|
else {
|
|
1640
|
-
let e = `${
|
|
1642
|
+
let e = `${yn}${i.id}__${a}`;
|
|
1641
1643
|
r.ghosts.push({
|
|
1642
1644
|
id: e,
|
|
1643
1645
|
subgraph: i.id
|
|
@@ -1646,7 +1648,7 @@ function Mn(e, t, n) {
|
|
|
1646
1648
|
}
|
|
1647
1649
|
for (let e = o; e < s; e++) {
|
|
1648
1650
|
let t = c.get(e), n = c.get(e + 1);
|
|
1649
|
-
!
|
|
1651
|
+
!kn(t) && !kn(n) || r.edges.push({
|
|
1650
1652
|
source: t,
|
|
1651
1653
|
target: n,
|
|
1652
1654
|
style: "invisible",
|
|
@@ -1657,7 +1659,7 @@ function Mn(e, t, n) {
|
|
|
1657
1659
|
}
|
|
1658
1660
|
return r;
|
|
1659
1661
|
}
|
|
1660
|
-
function
|
|
1662
|
+
function Pn(e, t, n, r = () => !1, i = () => !1) {
|
|
1661
1663
|
let a = (e) => {
|
|
1662
1664
|
let n = [...U(e)].filter((e) => t.has(e)).map((e) => t.get(e));
|
|
1663
1665
|
return n.length > 0 ? [Math.min(...n), Math.max(...n)] : void 0;
|
|
@@ -1679,9 +1681,9 @@ function Nn(e, t, n, r = () => !1, i = () => !1) {
|
|
|
1679
1681
|
for (let r of U(e)) n.has(r) && n.set(r, n.get(r) + l[t]);
|
|
1680
1682
|
});
|
|
1681
1683
|
}
|
|
1682
|
-
for (let a of e)
|
|
1684
|
+
for (let a of e) Pn(a.children, t, n, r, i);
|
|
1683
1685
|
}
|
|
1684
|
-
function
|
|
1686
|
+
function Fn(e, t, n, r, i) {
|
|
1685
1687
|
let a = new Map(t);
|
|
1686
1688
|
for (let t of r) {
|
|
1687
1689
|
let r = U(t);
|
|
@@ -1690,7 +1692,7 @@ function Pn(e, t, n, r, i) {
|
|
|
1690
1692
|
if (s.length === 0) continue;
|
|
1691
1693
|
let c = Math.min(...s.map((e) => n.get(e))), l = Math.max(...s.map((e) => n.get(e))), u = o.map((e) => a.get(e)), d = Math.min(...u), f = Math.max(...u), p = (d + f) / 2, m = 0;
|
|
1692
1694
|
for (let t of e) {
|
|
1693
|
-
if (r.has(t) ||
|
|
1695
|
+
if (r.has(t) || kn(t)) continue;
|
|
1694
1696
|
let e = n.get(t);
|
|
1695
1697
|
if (e === void 0 || e < c || e > l) continue;
|
|
1696
1698
|
m++;
|
|
@@ -1701,8 +1703,8 @@ function Pn(e, t, n, r, i) {
|
|
|
1701
1703
|
let o = new Map(e.map((e, t) => [e, t]));
|
|
1702
1704
|
return [...e].sort((e, t) => a.get(e) - a.get(t) || o.get(e) - o.get(t));
|
|
1703
1705
|
}
|
|
1704
|
-
var
|
|
1705
|
-
function
|
|
1706
|
+
var In = (e, t) => t >= Math.min(...e) && t <= Math.max(...e);
|
|
1707
|
+
function Ln(e, t, n) {
|
|
1706
1708
|
let r = (e) => {
|
|
1707
1709
|
let i = e.children.map(r), a = [...[...U(e)].flatMap((e) => {
|
|
1708
1710
|
let n = t.get(e);
|
|
@@ -1721,14 +1723,14 @@ function In(e, t, n) {
|
|
|
1721
1723
|
};
|
|
1722
1724
|
return e.map(r);
|
|
1723
1725
|
}
|
|
1724
|
-
var
|
|
1725
|
-
function
|
|
1726
|
-
let o =
|
|
1727
|
-
x: e.x -
|
|
1728
|
-
y: e.y -
|
|
1726
|
+
var Rn = (e) => e.flatMap((e) => [e, ...Rn(e.children)]);
|
|
1727
|
+
function zn(e, t, n, r, i, a) {
|
|
1728
|
+
let o = On(r), s = new Map(An(t).map((e) => [e.id, U(e)])), c = /* @__PURE__ */ new Map(), l = !1, u = [], d = (e) => o ? [e.x, e.x + e.width] : [e.y, e.y + e.height], f = (e) => o ? [e.y, e.y + e.height] : [e.x, e.x + e.width], p = ([e, t], [n, r]) => Math.max(0, Math.min(t, r) - Math.max(e, n)), m = (e) => ({
|
|
1729
|
+
x: e.x - Dn,
|
|
1730
|
+
y: e.y - Dn,
|
|
1729
1731
|
width: e.width + 80,
|
|
1730
1732
|
height: e.height + 80
|
|
1731
|
-
}), h = (e, t) => p(f(e), f(t)) > 0 ? p(d(e), d(t)) : 0, g =
|
|
1733
|
+
}), h = (e, t) => p(f(e), f(t)) > 0 ? p(d(e), d(t)) : 0, g = Rn(e), _ = new Map(g.map((e) => [e, m(e)])), v = (e, t, n, r) => {
|
|
1732
1734
|
let i = p(d(e), d(t)), a = p(f(e), f(t));
|
|
1733
1735
|
if (i <= 0 || a <= 0) return;
|
|
1734
1736
|
let s = i <= a, c = s === o, l = (e) => c ? e.x : e.y, m = (e) => c ? e.x + e.width : e.y + e.height, h = (e) => (l(e) + m(e)) / 2, g = h(n) <= h(r) ? n : r;
|
|
@@ -1742,7 +1744,7 @@ function Rn(e, t, n, r, i, a) {
|
|
|
1742
1744
|
let t = s.get(e.id), r = [...t].filter((e) => a.has(e)).map((e) => a.get(e)), o = new Set(r);
|
|
1743
1745
|
for (let [s, u] of n) {
|
|
1744
1746
|
if (t.has(s)) continue;
|
|
1745
|
-
if (o.has(a.get(s)) || !
|
|
1747
|
+
if (o.has(a.get(s)) || !In(r, a.get(s))) {
|
|
1746
1748
|
v(_.get(e), u, e, u);
|
|
1747
1749
|
continue;
|
|
1748
1750
|
}
|
|
@@ -1750,7 +1752,7 @@ function Rn(e, t, n, r, i, a) {
|
|
|
1750
1752
|
n <= 0 || (i.has(e.id) ? c.set(e.id, Math.max(c.get(e.id) ?? 0, n)) : l = !0);
|
|
1751
1753
|
}
|
|
1752
1754
|
}
|
|
1753
|
-
let y = (e, t) =>
|
|
1755
|
+
let y = (e, t) => Rn(e.children).includes(t);
|
|
1754
1756
|
for (let e = 0; e < g.length; e++) for (let t = e + 1; t < g.length; t++) {
|
|
1755
1757
|
let n = g[e], r = g[t];
|
|
1756
1758
|
y(n, r) || y(r, n) || v(_.get(n), r, n, r);
|
|
@@ -1761,17 +1763,17 @@ function Rn(e, t, n, r, i, a) {
|
|
|
1761
1763
|
requests: u
|
|
1762
1764
|
};
|
|
1763
1765
|
}
|
|
1764
|
-
function
|
|
1766
|
+
function Bn(e, t, n) {
|
|
1765
1767
|
let r = [...e.nodes.keys()], i = {
|
|
1766
1768
|
...e,
|
|
1767
1769
|
subgraphs: []
|
|
1768
|
-
}, a = He(e), o = t(i, { feedbackEdges: a }), s =
|
|
1770
|
+
}, a = He(e), o = t(i, { feedbackEdges: a }), s = Mn(o.nodes, e.direction), c = On(e.direction), l = new Map(o.nodes.map((e) => [e.id, e])), u = (e) => {
|
|
1769
1771
|
let t = l.get(e);
|
|
1770
1772
|
return c ? t.x : t.y;
|
|
1771
|
-
}, d =
|
|
1773
|
+
}, d = An(e.subgraphs), f = Nn(d, s, u), p = /* @__PURE__ */ new Map();
|
|
1772
1774
|
for (let e of f.ghosts) p.set(e.subgraph, [...p.get(e.subgraph) ?? [], e.id]);
|
|
1773
1775
|
let m = new Map(o.nodes.map((e) => [e.id, u(e.id)]));
|
|
1774
|
-
|
|
1776
|
+
Pn(e.subgraphs, s, m, (t, n) => {
|
|
1775
1777
|
let r = U(t), i = U(n), a = (t, n) => e.edges.some((e) => t.has(e.source) && n.has(e.target));
|
|
1776
1778
|
return a(r, i) && a(i, r);
|
|
1777
1779
|
}, (t, n) => {
|
|
@@ -1788,43 +1790,43 @@ function zn(e, t, n) {
|
|
|
1788
1790
|
label: " ",
|
|
1789
1791
|
shape: "rectangle"
|
|
1790
1792
|
});
|
|
1791
|
-
let g =
|
|
1793
|
+
let g = Fn([...h.keys()], m, s, d, p), _ = {
|
|
1792
1794
|
...i,
|
|
1793
1795
|
nodes: new Map(g.map((e) => [e, h.get(e)])),
|
|
1794
1796
|
edges: [...e.edges, ...f.edges]
|
|
1795
1797
|
}, v = new Set(f.edges.map((t, n) => e.edges.length + n)), y = (i) => {
|
|
1796
1798
|
let o = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
1797
1799
|
for (let l = 0;; l++) {
|
|
1798
|
-
let u = new Map(f.ghosts.map((e) => [e.id,
|
|
1800
|
+
let u = new Map(f.ghosts.map((e) => [e.id, bn + (o.get(e.subgraph) ?? 0)])), m = t(_, {
|
|
1799
1801
|
fixedWidths: u,
|
|
1800
1802
|
looseEdges: v,
|
|
1801
1803
|
detachedEdges: i,
|
|
1802
1804
|
walkOrder: r,
|
|
1803
1805
|
feedbackEdges: a,
|
|
1804
1806
|
forceNodeOrder: !0
|
|
1805
|
-
}), h = new Map(m.nodes.filter((e) => !
|
|
1807
|
+
}), h = new Map(m.nodes.filter((e) => !kn(e.id)).map((e) => [e.id, e])), g = Ln(e.subgraphs, h, n), y = zn(g, e.subgraphs, h, e.direction, new Set(p.keys()), s), { penetration: b, stuck: x } = y;
|
|
1806
1808
|
if (x) return;
|
|
1807
1809
|
if (b.size === 0) {
|
|
1808
1810
|
for (let t = 0; y.requests.length > 0; t++) {
|
|
1809
|
-
if (t ===
|
|
1810
|
-
|
|
1811
|
+
if (t === Sn) return;
|
|
1812
|
+
Un(y.requests.reduce((e, t) => t.amount > e.amount ? t : e), [...h.values()], m.edges), g = Ln(e.subgraphs, h, n), y = zn(g, e.subgraphs, h, e.direction, new Set(p.keys()), s);
|
|
1811
1813
|
}
|
|
1812
|
-
let t =
|
|
1813
|
-
return t &&
|
|
1814
|
+
let t = Hn(e, i, h, g, d);
|
|
1815
|
+
return t && Kn(m, [...h.values()], g, t, e.direction);
|
|
1814
1816
|
}
|
|
1815
|
-
if (l ===
|
|
1817
|
+
if (l === xn) return;
|
|
1816
1818
|
for (let [e, t] of b) {
|
|
1817
|
-
let n = o.get(e) ?? 0, r = c.get(e), i = r ? (r.overlap - t) / (n - r.width) : 0, a = i >
|
|
1819
|
+
let n = o.get(e) ?? 0, r = c.get(e), i = r ? (r.overlap - t) / (n - r.width) : 0, a = i > En ? i : Tn;
|
|
1818
1820
|
c.set(e, {
|
|
1819
1821
|
width: n,
|
|
1820
1822
|
overlap: t
|
|
1821
|
-
}), o.set(e, n + t / a +
|
|
1823
|
+
}), o.set(e, n + t / a + wn);
|
|
1822
1824
|
}
|
|
1823
1825
|
}
|
|
1824
|
-
}, b =
|
|
1826
|
+
}, b = Vn(e, f, s, d);
|
|
1825
1827
|
return (b.size > 0 ? y(b) : void 0) ?? y(/* @__PURE__ */ new Set());
|
|
1826
1828
|
}
|
|
1827
|
-
function
|
|
1829
|
+
function Vn(e, t, n, r) {
|
|
1828
1830
|
let i = r.map((e) => {
|
|
1829
1831
|
let t = U(e);
|
|
1830
1832
|
return {
|
|
@@ -1850,15 +1852,15 @@ function Bn(e, t, n, r) {
|
|
|
1850
1852
|
}
|
|
1851
1853
|
return o;
|
|
1852
1854
|
}
|
|
1853
|
-
function
|
|
1854
|
-
let a = new Map(
|
|
1855
|
+
function Hn(e, t, n, r, i) {
|
|
1856
|
+
let a = new Map(Rn(r).map((e) => [e.id, e])), o = [];
|
|
1855
1857
|
for (let r of t) {
|
|
1856
1858
|
let t = e.edges[r], s = n.get(t.source), c = n.get(t.target), l = i.filter((e) => {
|
|
1857
1859
|
let n = U(e);
|
|
1858
1860
|
return n.has(t.source) && n.has(t.target);
|
|
1859
1861
|
}).sort((e, t) => U(e).size - U(t).size)[0], u = l && a.get(l.id);
|
|
1860
1862
|
if (!s || !c || !u) return;
|
|
1861
|
-
let d =
|
|
1863
|
+
let d = _n(s, c, [...n.values()].filter((e) => e !== s && e !== c), u, e.direction, o.map((e) => e.points));
|
|
1862
1864
|
if (!d) return;
|
|
1863
1865
|
o.push({
|
|
1864
1866
|
source: t.source,
|
|
@@ -1868,42 +1870,42 @@ function Vn(e, t, n, r, i) {
|
|
|
1868
1870
|
hasArrowStart: t.hasArrowStart,
|
|
1869
1871
|
hasArrowEnd: t.hasArrowEnd,
|
|
1870
1872
|
points: d,
|
|
1871
|
-
labelPosition: t.label ?
|
|
1872
|
-
inlineStyle:
|
|
1873
|
+
labelPosition: t.label ? vn(d) : void 0,
|
|
1874
|
+
inlineStyle: tn(r, e),
|
|
1873
1875
|
id: t.id,
|
|
1874
1876
|
animate: t.animate
|
|
1875
1877
|
});
|
|
1876
1878
|
}
|
|
1877
1879
|
return o;
|
|
1878
1880
|
}
|
|
1879
|
-
function
|
|
1880
|
-
let { axis: r, amount: i, after: a } = e, o = i +
|
|
1881
|
+
function Un(e, t, n) {
|
|
1882
|
+
let { axis: r, amount: i, after: a } = e, o = i + Cn, s = t.filter((e) => e[r] >= a), c = Math.min(...s.map((e) => e[r]));
|
|
1881
1883
|
for (let e of s) e[r] += o;
|
|
1882
1884
|
let l = (e) => {
|
|
1883
1885
|
e[r] >= c && (e[r] += o);
|
|
1884
1886
|
};
|
|
1885
1887
|
for (let e of n) e.points.forEach(l), e.labelPosition && l(e.labelPosition);
|
|
1886
1888
|
}
|
|
1887
|
-
var
|
|
1888
|
-
function
|
|
1889
|
-
let i =
|
|
1889
|
+
var Wn = 8;
|
|
1890
|
+
function Gn(e, t, n, r) {
|
|
1891
|
+
let i = On(r) ? "y" : "x", a = i === "x" ? "y" : "x", o = i === "x" ? "width" : "height", s = i === "x" ? "height" : "width";
|
|
1890
1892
|
for (let { points: r } of e) for (let e = 1; e < r.length - 1;) {
|
|
1891
1893
|
let c = e;
|
|
1892
1894
|
for (; c + 1 < r.length - 1 && r[c + 1][i] === r[e][i];) c++;
|
|
1893
1895
|
let l = r.slice(e, c + 1), u = l[0], d = Math.min(...l.map((e) => e[a])), f = Math.max(...l.map((e) => e[a])), p = r[e - 1][i], m = r[c + 1][i], h = n.flatMap((e) => [e[i], e[i] + e[o]].map((t) => ({
|
|
1894
1896
|
g: e,
|
|
1895
1897
|
s: t
|
|
1896
|
-
}))).find(({ g: e, s: t }) => Math.abs(u[i] - t) <
|
|
1898
|
+
}))).find(({ g: e, s: t }) => Math.abs(u[i] - t) < Wn && f > e[a] && d < e[a] + e[s]);
|
|
1897
1899
|
if (h) {
|
|
1898
|
-
let e = h.s + (u[i] >= h.s ?
|
|
1900
|
+
let e = h.s + (u[i] >= h.s ? Wn : -8), n = (e - p) * (m - e) > 0, r = t.every((t) => t[i] + t[o] <= e || t[i] >= e || t[a] + t[s] <= d || t[a] >= f);
|
|
1899
1901
|
if (n && r) for (let t of l) t[i] = e;
|
|
1900
1902
|
}
|
|
1901
1903
|
e = c + 1;
|
|
1902
1904
|
}
|
|
1903
1905
|
}
|
|
1904
|
-
function
|
|
1905
|
-
let a = [...e.edges.filter((e) => !
|
|
1906
|
-
|
|
1906
|
+
function Kn(e, t, n, r, i) {
|
|
1907
|
+
let a = [...e.edges.filter((e) => !kn(e.source) && !kn(e.target)), ...r], o = Rn(n);
|
|
1908
|
+
Gn(a, t, o, i);
|
|
1907
1909
|
let s = [
|
|
1908
1910
|
...t.map((e) => e.x),
|
|
1909
1911
|
...o.map((e) => e.x),
|
|
@@ -1937,8 +1939,8 @@ function Gn(e, t, n, r, i) {
|
|
|
1937
1939
|
}
|
|
1938
1940
|
//#endregion
|
|
1939
1941
|
//#region packages/svg-renderer/src/layout-engine/layered.ts
|
|
1940
|
-
var
|
|
1941
|
-
function
|
|
1942
|
+
var qn = 12, Jn = 8, Yn = 4;
|
|
1943
|
+
function Xn(e, t, n) {
|
|
1942
1944
|
let r = e.map((e) => ({
|
|
1943
1945
|
axis: e.axis,
|
|
1944
1946
|
cross: e.cross,
|
|
@@ -1999,7 +2001,7 @@ function Yn(e, t, n) {
|
|
|
1999
2001
|
});
|
|
2000
2002
|
let g = r.map(() => 0), _ = [], v = [];
|
|
2001
2003
|
for (let e of h.values()) {
|
|
2002
|
-
let t =
|
|
2004
|
+
let t = Zn(e, r, i, a, n), o = Infinity, s = -Infinity;
|
|
2003
2005
|
for (let n of e) g[n] = t.get(n), o = Math.min(o, g[n] - r[n].cross / 2), s = Math.max(s, g[n] + r[n].cross / 2 + r[n].after);
|
|
2004
2006
|
_.push({
|
|
2005
2007
|
min: o,
|
|
@@ -2040,7 +2042,7 @@ function Yn(e, t, n) {
|
|
|
2040
2042
|
crossSize: b
|
|
2041
2043
|
};
|
|
2042
2044
|
}
|
|
2043
|
-
function
|
|
2045
|
+
function Zn(e, t, n, r, i) {
|
|
2044
2046
|
let a = [], o = /* @__PURE__ */ new Set(), s = [...e].sort((e, n) => t[e].rank - t[n].rank || e - n);
|
|
2045
2047
|
for (let e of s) {
|
|
2046
2048
|
if (o.has(e)) continue;
|
|
@@ -2069,7 +2071,7 @@ function Xn(e, t, n, r, i) {
|
|
|
2069
2071
|
};
|
|
2070
2072
|
u();
|
|
2071
2073
|
let f = c.map((e) => [...e]), p = d();
|
|
2072
|
-
for (let e = 0; e <
|
|
2074
|
+
for (let e = 0; e < Jn && p > 0; e++) {
|
|
2073
2075
|
let t = e % 2 == 0, i = c.map((e, t) => t);
|
|
2074
2076
|
t || i.reverse();
|
|
2075
2077
|
for (let e of i) {
|
|
@@ -2083,21 +2085,21 @@ function Xn(e, t, n, r, i) {
|
|
|
2083
2085
|
a < p && (p = a, f = c.map((e) => [...e]));
|
|
2084
2086
|
}
|
|
2085
2087
|
f.forEach((e, t) => c[t] = e);
|
|
2086
|
-
let m = /* @__PURE__ */ new Map(), h = (e, n) => (t[e].cross + t[n].cross) / 2 + t[e].after + (t[e].real && t[n].real ? i.nodeSep : Math.min(i.nodeSep,
|
|
2088
|
+
let m = /* @__PURE__ */ new Map(), h = (e, n) => (t[e].cross + t[n].cross) / 2 + t[e].after + (t[e].real && t[n].real ? i.nodeSep : Math.min(i.nodeSep, qn)), g = (e, t) => {
|
|
2087
2089
|
let n = e.slice(1).map((t, n) => h(e[n], t)), r = [0];
|
|
2088
|
-
n.forEach((e, t) => r.push(r[t] + e)),
|
|
2090
|
+
n.forEach((e, t) => r.push(r[t] + e)), Qn(e.map((e, n) => {
|
|
2089
2091
|
let i = (t[e] ?? []).filter((e) => m.has(e));
|
|
2090
2092
|
return (i.length === 0 ? m.get(e) ?? 0 : i.reduce((e, t) => e + m.get(t), 0) / i.length) - r[n];
|
|
2091
2093
|
})).forEach((t, n) => m.set(e[n], t + r[n]));
|
|
2092
2094
|
};
|
|
2093
2095
|
for (let e of c) g(e, []);
|
|
2094
|
-
for (let e = 0; e <
|
|
2096
|
+
for (let e = 0; e < Yn; e++) {
|
|
2095
2097
|
for (let e = 1; e < c.length; e++) g(c[e], n);
|
|
2096
2098
|
for (let e = c.length - 2; e >= 0; e--) g(c[e], r);
|
|
2097
2099
|
}
|
|
2098
2100
|
return m;
|
|
2099
2101
|
}
|
|
2100
|
-
function
|
|
2102
|
+
function Qn(e) {
|
|
2101
2103
|
let t = [];
|
|
2102
2104
|
for (let n of e) for (t.push({
|
|
2103
2105
|
sum: n,
|
|
@@ -2114,8 +2116,8 @@ function Zn(e) {
|
|
|
2114
2116
|
}
|
|
2115
2117
|
//#endregion
|
|
2116
2118
|
//#region packages/svg-renderer/src/layout-engine/simple-layout.ts
|
|
2117
|
-
var
|
|
2118
|
-
function
|
|
2119
|
+
var $n = 28, er = 18, tr = 10, nr = 32;
|
|
2120
|
+
function rr(e, t = {}) {
|
|
2119
2121
|
let n = {
|
|
2120
2122
|
...V,
|
|
2121
2123
|
...t,
|
|
@@ -2192,8 +2194,8 @@ function nr(e, t = {}) {
|
|
|
2192
2194
|
let S = (e) => {
|
|
2193
2195
|
let t = _.get(e);
|
|
2194
2196
|
if (!r || !t) return 0;
|
|
2195
|
-
let n = Math.max(0, ...t.map((e) => (h(e)?.cross ?? -10) +
|
|
2196
|
-
return
|
|
2197
|
+
let n = Math.max(0, ...t.map((e) => (h(e)?.cross ?? -10) + tr));
|
|
2198
|
+
return $n + (t.length - 1) * er + n;
|
|
2197
2199
|
}, C = (e) => {
|
|
2198
2200
|
let t = f(e), i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
2199
2201
|
for (let e of t) {
|
|
@@ -2204,7 +2206,7 @@ function nr(e, t = {}) {
|
|
|
2204
2206
|
}
|
|
2205
2207
|
let c = C(e);
|
|
2206
2208
|
i.set(e, c);
|
|
2207
|
-
let l = p(t.label, n.fontSizes.groupHeader, L.groupHeader).width, u = c.axisSize + v.axisStart + v.axisEnd, d = c.crossSize + v.crossStart + v.crossEnd, f = r ? 0 : l +
|
|
2209
|
+
let l = p(t.label, n.fontSizes.groupHeader, L.groupHeader).width, u = c.axisSize + v.axisStart + v.axisEnd, d = c.crossSize + v.crossStart + v.crossEnd, f = r ? 0 : l + nr, m = r ? l + nr : 0, h = Math.max(0, f - u), g = Math.max(0, m - d);
|
|
2208
2210
|
u += h, d += g, o.set(e, {
|
|
2209
2211
|
aSize: u,
|
|
2210
2212
|
cSize: d
|
|
@@ -2213,7 +2215,7 @@ function nr(e, t = {}) {
|
|
|
2213
2215
|
cross: v.crossStart + g / 2
|
|
2214
2216
|
});
|
|
2215
2217
|
}
|
|
2216
|
-
let c = new Map(t.map((e, t) => [e, t])), l = g.get(e ?? "") ?? [], u =
|
|
2218
|
+
let c = new Map(t.map((e, t) => [e, t])), l = g.get(e ?? "") ?? [], u = Xn(t.map((e) => ({
|
|
2217
2219
|
axis: o.get(e).aSize,
|
|
2218
2220
|
cross: o.get(e).cSize,
|
|
2219
2221
|
after: S(e)
|
|
@@ -2345,7 +2347,7 @@ function nr(e, t = {}) {
|
|
|
2345
2347
|
}
|
|
2346
2348
|
u.push(e);
|
|
2347
2349
|
}
|
|
2348
|
-
let d =
|
|
2350
|
+
let d = Pt(ir(u.map(ee)));
|
|
2349
2351
|
o && d.reverse();
|
|
2350
2352
|
let f = P.get(t.source), p = P.get(t.target);
|
|
2351
2353
|
f && (d = yt(d, f, !0)), p && (d = yt(d, p, !1)), te.push({
|
|
@@ -2357,11 +2359,11 @@ function nr(e, t = {}) {
|
|
|
2357
2359
|
hasArrowEnd: t.hasArrowEnd,
|
|
2358
2360
|
points: d,
|
|
2359
2361
|
labelPosition: r.label && ee(r.label),
|
|
2360
|
-
inlineStyle:
|
|
2362
|
+
inlineStyle: tn(n, e),
|
|
2361
2363
|
id: t.id,
|
|
2362
2364
|
animate: t.animate
|
|
2363
2365
|
});
|
|
2364
|
-
}),
|
|
2366
|
+
}), Ut(e, P, te);
|
|
2365
2367
|
let ne = (r ? w.crossSize : w.axisSize) + k * 2, F = (r ? w.axisSize : w.crossSize) + k * 2;
|
|
2366
2368
|
for (let e of te) {
|
|
2367
2369
|
for (let t of e.points) ne = Math.max(ne, t.x + B.width + k), F = Math.max(F, t.y + B.width + k);
|
|
@@ -2375,7 +2377,7 @@ function nr(e, t = {}) {
|
|
|
2375
2377
|
groups: O
|
|
2376
2378
|
};
|
|
2377
2379
|
}
|
|
2378
|
-
function
|
|
2380
|
+
function ir(e) {
|
|
2379
2381
|
return e.filter((t, n) => {
|
|
2380
2382
|
let r = e[n - 1], i = e[n + 1];
|
|
2381
2383
|
return !r || !i || !(r.x === t.x && t.x === i.x || r.y === t.y && t.y === i.y);
|
|
@@ -2383,28 +2385,28 @@ function rr(e) {
|
|
|
2383
2385
|
}
|
|
2384
2386
|
//#endregion
|
|
2385
2387
|
//#region packages/svg-renderer/src/layout-engine.ts
|
|
2386
|
-
function
|
|
2387
|
-
return
|
|
2388
|
+
function ar(e, t = {}) {
|
|
2389
|
+
return or(e, t);
|
|
2388
2390
|
}
|
|
2389
|
-
function
|
|
2391
|
+
function or(e, t, n) {
|
|
2390
2392
|
let r = {
|
|
2391
2393
|
...V,
|
|
2392
2394
|
...t,
|
|
2393
2395
|
fontSizes: Le(t.fontSizes)
|
|
2394
2396
|
};
|
|
2395
|
-
return
|
|
2397
|
+
return Gt(Ae(ht(e, r, n), t.layoutCache), e, r.mergeEdges);
|
|
2396
2398
|
}
|
|
2397
|
-
function
|
|
2399
|
+
function sr(e, t = {}) {
|
|
2398
2400
|
let n = ee(e);
|
|
2399
|
-
if (t.layout === "simple" && !et(n)) return
|
|
2401
|
+
if (t.layout === "simple" && !et(n)) return rr(n, t);
|
|
2400
2402
|
if (t.layout !== void 0 && t.layout !== "elk" && t.layout !== "simple") throw Error(`zombie-mermaid: unknown layout ${JSON.stringify(t.layout)}; use 'elk' or 'simple'.`);
|
|
2401
|
-
if (
|
|
2402
|
-
let e =
|
|
2403
|
+
if (jn(n)) {
|
|
2404
|
+
let e = Bn(n, (e, n) => or(e, t, n), Le(t.fontSizes));
|
|
2403
2405
|
if (e) return e;
|
|
2404
2406
|
}
|
|
2405
|
-
return
|
|
2407
|
+
return ar(n, t);
|
|
2406
2408
|
}
|
|
2407
|
-
function
|
|
2409
|
+
function cr(e, t = {}) {
|
|
2408
2410
|
return ht(e, {
|
|
2409
2411
|
...V,
|
|
2410
2412
|
...t,
|
|
@@ -2413,23 +2415,23 @@ function sr(e, t = {}) {
|
|
|
2413
2415
|
}
|
|
2414
2416
|
//#endregion
|
|
2415
2417
|
//#region packages/svg-renderer/src/title-gaps.ts
|
|
2416
|
-
var
|
|
2417
|
-
function
|
|
2418
|
-
return e.flatMap((e) => [e, ...
|
|
2418
|
+
var lr = 12, ur = 2;
|
|
2419
|
+
function dr(e) {
|
|
2420
|
+
return e.flatMap((e) => [e, ...dr(e.children)]);
|
|
2419
2421
|
}
|
|
2420
|
-
function
|
|
2422
|
+
function fr(e, t) {
|
|
2421
2423
|
let n = t.groupHeader + 16;
|
|
2422
|
-
return
|
|
2424
|
+
return dr(e).filter((e) => e.label !== "").map((e) => {
|
|
2423
2425
|
let r = p(e.label, t.groupHeader, L.groupHeader);
|
|
2424
2426
|
return {
|
|
2425
|
-
x: e.x +
|
|
2426
|
-
y: e.y + n / 2 - r.height / 2 -
|
|
2427
|
+
x: e.x + lr - ur,
|
|
2428
|
+
y: e.y + n / 2 - r.height / 2 - ur,
|
|
2427
2429
|
width: r.width + 4,
|
|
2428
2430
|
height: r.height + 4
|
|
2429
2431
|
};
|
|
2430
2432
|
});
|
|
2431
2433
|
}
|
|
2432
|
-
function
|
|
2434
|
+
function pr(e, t, n) {
|
|
2433
2435
|
let r = t.x - e.x, i = t.y - e.y, a = [
|
|
2434
2436
|
-r,
|
|
2435
2437
|
r,
|
|
@@ -2452,26 +2454,26 @@ function fr(e, t, n) {
|
|
|
2452
2454
|
}
|
|
2453
2455
|
return !0;
|
|
2454
2456
|
}
|
|
2455
|
-
function
|
|
2457
|
+
function mr(e) {
|
|
2456
2458
|
return {
|
|
2457
|
-
x: e.x +
|
|
2458
|
-
y: e.y +
|
|
2459
|
+
x: e.x + ur,
|
|
2460
|
+
y: e.y + ur,
|
|
2459
2461
|
width: e.width - 4,
|
|
2460
2462
|
height: e.height - 4
|
|
2461
2463
|
};
|
|
2462
2464
|
}
|
|
2463
|
-
function
|
|
2464
|
-
let n = e.points, r = t.map(
|
|
2465
|
-
for (let e = 0; e + 1 < n.length; e++) if (r.some((t) =>
|
|
2465
|
+
function hr(e, t) {
|
|
2466
|
+
let n = e.points, r = t.map(mr);
|
|
2467
|
+
for (let e = 0; e + 1 < n.length; e++) if (r.some((t) => pr(n[e], n[e + 1], t))) return !0;
|
|
2466
2468
|
return !1;
|
|
2467
2469
|
}
|
|
2468
|
-
function
|
|
2470
|
+
function gr(e) {
|
|
2469
2471
|
let t = 2166136261;
|
|
2470
2472
|
for (let n of e.map((e) => `${e.x},${e.y},${e.width},${e.height}`).join(";")) t = Math.imul(t ^ n.charCodeAt(0), 16777619);
|
|
2471
2473
|
return (t >>> 0).toString(36);
|
|
2472
2474
|
}
|
|
2473
|
-
function
|
|
2474
|
-
let r = `zm-title-gap-${
|
|
2475
|
+
function _r(e, t, n) {
|
|
2476
|
+
let r = `zm-title-gap-${gr(e)}`;
|
|
2475
2477
|
return {
|
|
2476
2478
|
id: r,
|
|
2477
2479
|
markup: ` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map((e) => ` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join("\n")}\n </mask>`
|
|
@@ -2479,25 +2481,25 @@ function gr(e, t, n) {
|
|
|
2479
2481
|
}
|
|
2480
2482
|
//#endregion
|
|
2481
2483
|
//#region packages/svg-renderer/src/renderer.ts
|
|
2482
|
-
function
|
|
2484
|
+
function vr(e, n, r = "Inter", i = !1, a = Ie, o = "linear", s, c = !0, l = !0, u, d, f = {}) {
|
|
2483
2485
|
let p = [], m = l && e.nodes.some((e) => !!S(e.interaction?.href));
|
|
2484
|
-
p.push(
|
|
2486
|
+
p.push(hi(O(e.width, e.height, n, i, u, d, m, f.styleAttribute, f.description), s)), p.push(t(r, !1, f.nonce)), c && e.edges.some((e) => e.animate) && p.push(yr(f.nonce)), p.push("<defs>"), p.push(br());
|
|
2485
2487
|
let h = /* @__PURE__ */ new Set();
|
|
2486
2488
|
for (let t of e.edges) t.inlineStyle?.stroke && h.add(t.inlineStyle.stroke);
|
|
2487
|
-
for (let e of h) p.push(
|
|
2488
|
-
let g =
|
|
2489
|
+
for (let e of h) p.push(xr(e));
|
|
2490
|
+
let g = fr(e.groups, a), _ = new Set(e.edges.filter((e) => hr(e, g))), v;
|
|
2489
2491
|
if (_.size > 0) {
|
|
2490
|
-
let t =
|
|
2492
|
+
let t = _r(g, e.width, e.height);
|
|
2491
2493
|
v = t.id, p.push(t.markup);
|
|
2492
2494
|
}
|
|
2493
2495
|
p.push("</defs>");
|
|
2494
|
-
for (let t of e.groups) p.push(
|
|
2495
|
-
for (let t of e.edges) p.push(
|
|
2496
|
-
for (let t of e.edges) t.label && p.push(
|
|
2497
|
-
for (let t of e.nodes) p.push(
|
|
2496
|
+
for (let t of e.groups) p.push(wr(t, r, a));
|
|
2497
|
+
for (let t of e.edges) p.push(Tr(t, o, c, _.has(t) ? v : void 0));
|
|
2498
|
+
for (let t of e.edges) t.label && p.push(Dr(t, r, a));
|
|
2499
|
+
for (let t of e.nodes) p.push(jr(t, r, a, l));
|
|
2498
2500
|
return p.push("</svg>"), p.join("\n");
|
|
2499
2501
|
}
|
|
2500
|
-
function
|
|
2502
|
+
function yr(e) {
|
|
2501
2503
|
return [
|
|
2502
2504
|
E(e),
|
|
2503
2505
|
" @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }",
|
|
@@ -2508,33 +2510,33 @@ function vr(e) {
|
|
|
2508
2510
|
"</style>"
|
|
2509
2511
|
].join("\n");
|
|
2510
2512
|
}
|
|
2511
|
-
function
|
|
2512
|
-
return
|
|
2513
|
+
function br() {
|
|
2514
|
+
return Sr("var(--_arrow)", "");
|
|
2513
2515
|
}
|
|
2514
|
-
function
|
|
2515
|
-
return
|
|
2516
|
+
function xr(e) {
|
|
2517
|
+
return Sr(o(e), l`-${Cr(e)}`);
|
|
2516
2518
|
}
|
|
2517
|
-
function
|
|
2519
|
+
function Sr(e, t) {
|
|
2518
2520
|
let n = B.width, r = B.height, i = n - 1, a = l`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`, o = l`<polygon points="0 0, ${n} ${r / 2}, 0 ${r}" ${a} />`, s = (e, t) => l` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r / 2}" orient="${t}">` + l`\n ${o}` + "\n </marker>";
|
|
2519
2521
|
return s(l`arrowhead${t}`, "auto") + "\n" + s(l`arrowhead-start${t}`, "auto-start-reverse");
|
|
2520
2522
|
}
|
|
2521
|
-
function
|
|
2523
|
+
function Cr(e) {
|
|
2522
2524
|
return e.replace(/[^a-zA-Z0-9]/g, (e) => e.charCodeAt(0).toString(16));
|
|
2523
2525
|
}
|
|
2524
|
-
function
|
|
2526
|
+
function wr(e, t, n) {
|
|
2525
2527
|
let r = n.groupHeader + 16, i = [];
|
|
2526
2528
|
if (e.region) {
|
|
2527
2529
|
i.push(l`<g class="subgraph subgraph-region" data-id="${o(e.id)}">`, l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" ` + l`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" stroke-dasharray="6 4" />`);
|
|
2528
|
-
for (let r of e.children) i.push(
|
|
2530
|
+
for (let r of e.children) i.push(wr(r, t, n));
|
|
2529
2531
|
return i.push("</g>"), i.join("\n");
|
|
2530
2532
|
}
|
|
2531
2533
|
i.push(l`<g class="subgraph" data-id="${o(e.id)}" data-label="${o(e.label)}">`), i.push(l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" ` + l`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`), i.push(l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" ` + l`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`), i.push(" " + y(e.label, e.x + 12, e.y + r / 2, n.groupHeader, l`font-size="${n.groupHeader}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));
|
|
2532
|
-
for (let r of e.children) i.push(
|
|
2534
|
+
for (let r of e.children) i.push(wr(r, t, n));
|
|
2533
2535
|
return i.push("</g>"), i.join("\n");
|
|
2534
2536
|
}
|
|
2535
|
-
function
|
|
2537
|
+
function Tr(e, t, n = !0, r) {
|
|
2536
2538
|
if (e.points.length < 2) return "";
|
|
2537
|
-
let i = n && (e.animate ?? !1), a = t !== "linear", s = e.style === "invisible", c = e.style === "dotted" ? " stroke-dasharray=\"4 4\"" : "", u = e.style === "thick" ? R.connector * 2 : R.connector, d = s ? "none" : o(e.inlineStyle?.stroke ?? "var(--_line)"), f = o(e.inlineStyle?.["stroke-width"] ?? String(u)), p = e.inlineStyle?.stroke ? l`-${
|
|
2539
|
+
let i = n && (e.animate ?? !1), a = t !== "linear", s = e.style === "invisible", c = e.style === "dotted" ? " stroke-dasharray=\"4 4\"" : "", u = e.style === "thick" ? R.connector * 2 : R.connector, d = s ? "none" : o(e.inlineStyle?.stroke ?? "var(--_line)"), f = o(e.inlineStyle?.["stroke-width"] ?? String(u)), p = e.inlineStyle?.stroke ? l`-${Cr(e.inlineStyle.stroke)}` : "", m = "";
|
|
2538
2540
|
s || (e.hasArrowEnd && (m += l` marker-end="url(#arrowhead${p})"`), e.hasArrowStart && (m += l` marker-start="url(#arrowhead-start${p})"`));
|
|
2539
2541
|
let h = [
|
|
2540
2542
|
l`class="edge${i ? " edge-animated" : ""}"`,
|
|
@@ -2545,35 +2547,35 @@ function wr(e, t, n = !0, r) {
|
|
|
2545
2547
|
l`data-arrow-end="${e.hasArrowEnd}"`
|
|
2546
2548
|
];
|
|
2547
2549
|
e.label && h.push(l`data-label="${o(e.label)}"`), e.id && h.push(l`data-id="${o(e.id)}"`);
|
|
2548
|
-
let g = i && !c ? " stroke-dasharray=\"8 6\"" : "", _ = a ? l`d="${_e(e.points, t)}"` : l`points="${
|
|
2550
|
+
let g = i && !c ? " stroke-dasharray=\"8 6\"" : "", _ = a ? l`d="${_e(e.points, t)}"` : l`points="${Er(e.points)}"`;
|
|
2549
2551
|
return l`<${a ? "path" : "polyline"} ${h.join(" ")} ${_} ` + l`fill="none" stroke="${d}" ` + l`stroke-width="${f}"${c}${g}${m}` + (r ? l` mask="url(#${r})"` : "") + " />";
|
|
2550
2552
|
}
|
|
2551
|
-
function
|
|
2553
|
+
function Er(e) {
|
|
2552
2554
|
return e.map((e) => l`${e.x},${e.y}`).join(" ");
|
|
2553
2555
|
}
|
|
2554
|
-
function
|
|
2556
|
+
function Dr(e, t, n) {
|
|
2555
2557
|
if (!e.label) return "";
|
|
2556
|
-
let r = e.label, i = e.labelPosition ??
|
|
2558
|
+
let r = e.label, i = e.labelPosition ?? kr(e.points), a = p(r, n.edgeLabel, L.edgeLabel), s = b(r, i.x, i.y, a.width, a.height, n.edgeLabel, 8, l`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`, "rx=\"2\" ry=\"2\" fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"1\"");
|
|
2557
2559
|
return l`<g class="edge-label" data-from="${o(e.source)}" data-to="${o(e.target)}" data-label="${o(r)}">\n` + l` ${s.replace(/\n/g, "\n ")}\n` + "</g>";
|
|
2558
2560
|
}
|
|
2559
|
-
function
|
|
2561
|
+
function Or(e, t) {
|
|
2560
2562
|
let n = e[t];
|
|
2561
2563
|
if (!n)
|
|
2562
2564
|
/* v8 ignore next */
|
|
2563
2565
|
throw Error(l`edgeMidpoint: missing point at index ${t}`);
|
|
2564
2566
|
return n;
|
|
2565
2567
|
}
|
|
2566
|
-
function
|
|
2568
|
+
function kr(e) {
|
|
2567
2569
|
if (e.length === 0) return {
|
|
2568
2570
|
x: 0,
|
|
2569
2571
|
y: 0
|
|
2570
2572
|
};
|
|
2571
2573
|
if (e.length === 1) return e[0];
|
|
2572
2574
|
let t = 0;
|
|
2573
|
-
for (let n = 1; n < e.length; n++) t +=
|
|
2575
|
+
for (let n = 1; n < e.length; n++) t += Ar(Or(e, n - 1), Or(e, n));
|
|
2574
2576
|
let n = t / 2;
|
|
2575
2577
|
for (let t = 1; t < e.length; t++) {
|
|
2576
|
-
let r =
|
|
2578
|
+
let r = Or(e, t - 1), i = Or(e, t), a = Ar(r, i);
|
|
2577
2579
|
if (n <= a) {
|
|
2578
2580
|
let e = n / a;
|
|
2579
2581
|
return {
|
|
@@ -2585,11 +2587,11 @@ function Or(e) {
|
|
|
2585
2587
|
}
|
|
2586
2588
|
return e[e.length - 1];
|
|
2587
2589
|
}
|
|
2588
|
-
function
|
|
2590
|
+
function Ar(e, t) {
|
|
2589
2591
|
return Math.sqrt((t.x - e.x) ** 2 + (t.y - e.y) ** 2);
|
|
2590
2592
|
}
|
|
2591
|
-
function
|
|
2592
|
-
let i =
|
|
2593
|
+
function jr(e, t, n, r = !0) {
|
|
2594
|
+
let i = Mr(e), a = pi(e, t, n), c = [], u = C(e.className), d = u ? l`node ${u}` : "node", f = e.interaction, p = [
|
|
2593
2595
|
l`class="${d}"`,
|
|
2594
2596
|
l`data-id="${o(e.id)}"`,
|
|
2595
2597
|
l`data-label="${o(e.label)}"`,
|
|
@@ -2603,66 +2605,66 @@ function Ar(e, t, n, r = !0) {
|
|
|
2603
2605
|
}
|
|
2604
2606
|
return r && f?.tooltip && c.push(l`${h}<title>${s(f.tooltip)}</title>`), c.push(l`${h}${i.replace(/\n/g, l`\n${h}`)}`), a && c.push(l`${h}${a.replace(/\n/g, l`\n${h}`)}`), m && c.push(" </a>"), c.push("</g>"), c.join("\n");
|
|
2605
2607
|
}
|
|
2606
|
-
function
|
|
2608
|
+
function Mr(e) {
|
|
2607
2609
|
let { x: t, y: n, width: r, height: i, shape: a, inlineStyle: s } = e, c = o(s?.fill ?? "var(--_node-fill)"), l = o(s?.stroke ?? "var(--_node-stroke)"), u = o(s?.["stroke-width"] ?? String(R.innerBox));
|
|
2608
2610
|
switch (a) {
|
|
2609
|
-
case "diamond": return
|
|
2610
|
-
case "rounded": return
|
|
2611
|
-
case "stadium": return
|
|
2612
|
-
case "circle": return
|
|
2613
|
-
case "subroutine": return
|
|
2614
|
-
case "doublecircle": return
|
|
2615
|
-
case "hexagon": return
|
|
2616
|
-
case "cylinder": return
|
|
2617
|
-
case "asymmetric": return
|
|
2618
|
-
case "trapezoid": return
|
|
2619
|
-
case "trapezoid-alt": return
|
|
2620
|
-
case "parallelogram": return
|
|
2621
|
-
case "parallelogram-alt": return
|
|
2622
|
-
case "state-start": return
|
|
2623
|
-
case "state-end": return
|
|
2624
|
-
case "document": return
|
|
2625
|
-
case "stacked-document": return
|
|
2626
|
-
case "stacked-process": return
|
|
2627
|
-
case "card": return
|
|
2628
|
-
case "lined-process": return
|
|
2629
|
-
case "divided-process": return
|
|
2630
|
-
case "window-pane": return
|
|
2631
|
-
case "triangle": return
|
|
2632
|
-
case "flipped-triangle": return
|
|
2633
|
-
case "filled-circle": return
|
|
2634
|
-
case "crossed-circle": return
|
|
2635
|
-
case "fork-join": return
|
|
2636
|
-
case "note": return
|
|
2637
|
-
case "notched-pentagon": return
|
|
2638
|
-
case "sloped-rectangle": return
|
|
2639
|
-
case "flag": return
|
|
2640
|
-
case "bow-tie-rectangle": return
|
|
2641
|
-
case "half-rounded-rectangle": return
|
|
2642
|
-
case "brace": return
|
|
2643
|
-
case "brace-right": return
|
|
2644
|
-
case "braces": return
|
|
2645
|
-
case "bolt": return
|
|
2611
|
+
case "diamond": return Lr(t, n, r, i, c, l, u);
|
|
2612
|
+
case "rounded": return Pr(t, n, r, i, c, l, u);
|
|
2613
|
+
case "stadium": return Fr(t, n, r, i, c, l, u);
|
|
2614
|
+
case "circle": return Ir(t, n, r, i, c, l, u);
|
|
2615
|
+
case "subroutine": return Rr(t, n, r, i, c, l, u);
|
|
2616
|
+
case "doublecircle": return zr(t, n, r, i, c, l, u);
|
|
2617
|
+
case "hexagon": return Br(t, n, r, i, c, l, u);
|
|
2618
|
+
case "cylinder": return Vr(t, n, r, i, c, l, u);
|
|
2619
|
+
case "asymmetric": return Hr(t, n, r, i, c, l, u);
|
|
2620
|
+
case "trapezoid": return Ur(t, n, r, i, c, l, u);
|
|
2621
|
+
case "trapezoid-alt": return Wr(t, n, r, i, c, l, u);
|
|
2622
|
+
case "parallelogram": return Gr(t, n, r, i, c, l, u);
|
|
2623
|
+
case "parallelogram-alt": return Kr(t, n, r, i, c, l, u);
|
|
2624
|
+
case "state-start": return di(t, n, r, i);
|
|
2625
|
+
case "state-end": return fi(t, n, r, i);
|
|
2626
|
+
case "document": return qr(t, n, r, i, c, l, u);
|
|
2627
|
+
case "stacked-document": return Jr(t, n, r, i, c, l, u, !0);
|
|
2628
|
+
case "stacked-process": return Jr(t, n, r, i, c, l, u, !1);
|
|
2629
|
+
case "card": return Yr(t, n, r, i, c, l, u);
|
|
2630
|
+
case "lined-process": return Xr(t, n, r, i, c, l, u);
|
|
2631
|
+
case "divided-process": return Zr(t, n, r, i, c, l, u);
|
|
2632
|
+
case "window-pane": return Qr(t, n, r, i, c, l, u);
|
|
2633
|
+
case "triangle": return $r(t, n, r, i, c, l, u, !1);
|
|
2634
|
+
case "flipped-triangle": return $r(t, n, r, i, c, l, u, !0);
|
|
2635
|
+
case "filled-circle": return ei(t, n, r, i, l);
|
|
2636
|
+
case "crossed-circle": return ti(t, n, r, i, c, l, u);
|
|
2637
|
+
case "fork-join": return ni(t, n, r, i, l);
|
|
2638
|
+
case "note": return ri(t, n, r, i, o(s?.fill ?? "var(--bg)"), l, u);
|
|
2639
|
+
case "notched-pentagon": return ii(t, n, r, i, c, l, u);
|
|
2640
|
+
case "sloped-rectangle": return ai(t, n, r, i, c, l, u);
|
|
2641
|
+
case "flag": return oi(t, n, r, i, c, l, u);
|
|
2642
|
+
case "bow-tie-rectangle": return si(t, n, r, i, c, l, u);
|
|
2643
|
+
case "half-rounded-rectangle": return ci(t, n, r, i, c, l, u);
|
|
2644
|
+
case "brace": return li(t, n, r, i, c, l, u, "left");
|
|
2645
|
+
case "brace-right": return li(t, n, r, i, c, l, u, "right");
|
|
2646
|
+
case "braces": return li(t, n, r, i, c, l, u, "both");
|
|
2647
|
+
case "bolt": return ui(t, n, r, i, c, l, u);
|
|
2646
2648
|
case "text":
|
|
2647
2649
|
case "anchor": return "";
|
|
2648
|
-
default: return
|
|
2650
|
+
default: return Nr(t, n, r, i, c, l, u);
|
|
2649
2651
|
}
|
|
2650
2652
|
}
|
|
2651
|
-
function
|
|
2653
|
+
function Nr(e, t, n, r, i, a, o) {
|
|
2652
2654
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + l`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2653
2655
|
}
|
|
2654
|
-
function
|
|
2656
|
+
function Pr(e, t, n, r, i, a, o) {
|
|
2655
2657
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + l`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2656
2658
|
}
|
|
2657
|
-
function
|
|
2659
|
+
function Fr(e, t, n, r, i, a, o) {
|
|
2658
2660
|
let s = r / 2;
|
|
2659
2661
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + l`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2660
2662
|
}
|
|
2661
|
-
function
|
|
2663
|
+
function Ir(e, t, n, r, i, a, o) {
|
|
2662
2664
|
let s = e + n / 2, c = t + r / 2, u = Math.min(n, r) / 2;
|
|
2663
2665
|
return l`<circle cx="${s}" cy="${c}" r="${u}" ` + l`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2664
2666
|
}
|
|
2665
|
-
function
|
|
2667
|
+
function Lr(e, t, n, r, i, a, o) {
|
|
2666
2668
|
let s = e + n / 2, c = t + r / 2, u = n / 2, d = r / 2, f = [
|
|
2667
2669
|
l`${s},${c - d}`,
|
|
2668
2670
|
l`${s + u},${c}`,
|
|
@@ -2671,14 +2673,14 @@ function Ir(e, t, n, r, i, a, o) {
|
|
|
2671
2673
|
].join(" ");
|
|
2672
2674
|
return l`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2673
2675
|
}
|
|
2674
|
-
function
|
|
2676
|
+
function Rr(e, t, n, r, i, a, o) {
|
|
2675
2677
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ` + l`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />` + l`\n<line x1="${e + 8}" y1="${t}" x2="${e + 8}" y2="${t + r}" ` + l`stroke="${a}" stroke-width="${o}" />` + l`\n<line x1="${e + n - 8}" y1="${t}" x2="${e + n - 8}" y2="${t + r}" ` + l`stroke="${a}" stroke-width="${o}" />`;
|
|
2676
2678
|
}
|
|
2677
|
-
function
|
|
2679
|
+
function zr(e, t, n, r, i, a, o) {
|
|
2678
2680
|
let s = e + n / 2, c = t + r / 2, u = Math.min(n, r) / 2, d = u - 5;
|
|
2679
2681
|
return l`<circle cx="${s}" cy="${c}" r="${u}" ` + l`fill="${i}" stroke="${a}" stroke-width="${o}" />` + l`\n<circle cx="${s}" cy="${c}" r="${d}" ` + l`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2680
2682
|
}
|
|
2681
|
-
function
|
|
2683
|
+
function Br(e, t, n, r, i, a, o) {
|
|
2682
2684
|
let s = r / 4, c = [
|
|
2683
2685
|
l`${e + s},${t}`,
|
|
2684
2686
|
l`${e + n - s},${t}`,
|
|
@@ -2689,11 +2691,11 @@ function zr(e, t, n, r, i, a, o) {
|
|
|
2689
2691
|
].join(" ");
|
|
2690
2692
|
return l`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2691
2693
|
}
|
|
2692
|
-
function
|
|
2694
|
+
function Vr(e, t, n, r, i, a, o) {
|
|
2693
2695
|
let s = e + n / 2, c = t + 7, u = r - 14;
|
|
2694
2696
|
return l`<rect x="${e}" y="${c}" width="${n}" height="${u}" ` + l`fill="${i}" stroke="none" />` + l`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />` + l`\n<line x1="${e + n}" y1="${c}" x2="${e + n}" y2="${c + u}" stroke="${a}" stroke-width="${o}" />` + l`\n<ellipse cx="${s}" cy="${t + r - 7}" rx="${n / 2}" ry="${7}" ` + l`fill="${i}" stroke="${a}" stroke-width="${o}" />` + l`\n<ellipse cx="${s}" cy="${c}" rx="${n / 2}" ry="${7}" ` + l`fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2695
2697
|
}
|
|
2696
|
-
function
|
|
2698
|
+
function Hr(e, t, n, r, i, a, o) {
|
|
2697
2699
|
let s = [
|
|
2698
2700
|
l`${e + 12},${t}`,
|
|
2699
2701
|
l`${e + n},${t}`,
|
|
@@ -2703,7 +2705,7 @@ function Vr(e, t, n, r, i, a, o) {
|
|
|
2703
2705
|
].join(" ");
|
|
2704
2706
|
return l`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2705
2707
|
}
|
|
2706
|
-
function
|
|
2708
|
+
function Ur(e, t, n, r, i, a, o) {
|
|
2707
2709
|
let s = n * .15, c = [
|
|
2708
2710
|
l`${e + s},${t}`,
|
|
2709
2711
|
l`${e + n - s},${t}`,
|
|
@@ -2712,7 +2714,7 @@ function Hr(e, t, n, r, i, a, o) {
|
|
|
2712
2714
|
].join(" ");
|
|
2713
2715
|
return l`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2714
2716
|
}
|
|
2715
|
-
function
|
|
2717
|
+
function Wr(e, t, n, r, i, a, o) {
|
|
2716
2718
|
let s = n * .15, c = [
|
|
2717
2719
|
l`${e},${t}`,
|
|
2718
2720
|
l`${e + n},${t}`,
|
|
@@ -2721,7 +2723,7 @@ function Ur(e, t, n, r, i, a, o) {
|
|
|
2721
2723
|
].join(" ");
|
|
2722
2724
|
return l`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2723
2725
|
}
|
|
2724
|
-
function
|
|
2726
|
+
function Gr(e, t, n, r, i, a, o) {
|
|
2725
2727
|
let s = n * .15, c = [
|
|
2726
2728
|
l`${e + s},${t}`,
|
|
2727
2729
|
l`${e + n},${t}`,
|
|
@@ -2730,7 +2732,7 @@ function Wr(e, t, n, r, i, a, o) {
|
|
|
2730
2732
|
].join(" ");
|
|
2731
2733
|
return l`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`;
|
|
2732
2734
|
}
|
|
2733
|
-
function
|
|
2735
|
+
function Kr(e, t, n, r, i, a, o) {
|
|
2734
2736
|
let s = n * .15, c = [
|
|
2735
2737
|
l`${e},${t}`,
|
|
2736
2738
|
l`${e + n - s},${t}`,
|
|
@@ -2742,16 +2744,16 @@ function Gr(e, t, n, r, i, a, o) {
|
|
|
2742
2744
|
function W(e, t, n) {
|
|
2743
2745
|
return l`fill="${e}" stroke="${t}" stroke-width="${n}"`;
|
|
2744
2746
|
}
|
|
2745
|
-
function
|
|
2747
|
+
function qr(e, t, n, r, i, a, o) {
|
|
2746
2748
|
let s = Math.min(10, r * .16), c = t + r - s, u = l`M ${e} ${t} L ${e + n} ${t} L ${e + n} ${c} ` + l`C ${e + n * .75} ${c + s * 1.8} ${e + n * .25} ${c - s * .8} ${e} ${c} Z`;
|
|
2747
2749
|
return l`<path d="${u}" ${W(i, a, o)} />`;
|
|
2748
2750
|
}
|
|
2749
|
-
function
|
|
2751
|
+
function Jr(e, t, n, r, i, a, o, s) {
|
|
2750
2752
|
let c = n - 10, u = r - 10, d = [];
|
|
2751
2753
|
for (let n = 2; n >= 1; n--) d.push(l`<rect x="${e + 5 * n}" y="${t + 5 * (2 - n)}" width="${c}" height="${u}" ` + l`${W(i, a, o)} />`);
|
|
2752
|
-
return d.push(s ?
|
|
2754
|
+
return d.push(s ? qr(e, t + 10, c, u, i, a, o) : l`<rect x="${e}" y="${t + 10}" width="${c}" height="${u}" ${W(i, a, o)} />`), d.join("\n");
|
|
2753
2755
|
}
|
|
2754
|
-
function
|
|
2756
|
+
function Yr(e, t, n, r, i, a, o) {
|
|
2755
2757
|
let s = Math.min(14, n * .12, r * .3), c = [
|
|
2756
2758
|
l`${e + s},${t}`,
|
|
2757
2759
|
l`${e + n},${t}`,
|
|
@@ -2761,19 +2763,19 @@ function Jr(e, t, n, r, i, a, o) {
|
|
|
2761
2763
|
].join(" ");
|
|
2762
2764
|
return l`<polygon points="${c}" ${W(i, a, o)} />`;
|
|
2763
2765
|
}
|
|
2764
|
-
function
|
|
2766
|
+
function Xr(e, t, n, r, i, a, o) {
|
|
2765
2767
|
let s = Math.min(12, n * .12);
|
|
2766
2768
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n` + l`<line x1="${e + s}" y1="${t}" x2="${e + s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />`;
|
|
2767
2769
|
}
|
|
2768
|
-
function
|
|
2770
|
+
function Zr(e, t, n, r, i, a, o) {
|
|
2769
2771
|
let s = t + Math.min(16, r * .3);
|
|
2770
2772
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n` + l`<line x1="${e}" y1="${s}" x2="${e + n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`;
|
|
2771
2773
|
}
|
|
2772
|
-
function
|
|
2774
|
+
function Qr(e, t, n, r, i, a, o) {
|
|
2773
2775
|
let s = e + Math.min(16, n * .16), c = t + Math.min(14, r * .28);
|
|
2774
2776
|
return l`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${W(i, a, o)} />\n` + l`<line x1="${s}" y1="${t}" x2="${s}" y2="${t + r}" stroke="${a}" stroke-width="${o}" />\n` + l`<line x1="${e}" y1="${c}" x2="${e + n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`;
|
|
2775
2777
|
}
|
|
2776
|
-
function
|
|
2778
|
+
function $r(e, t, n, r, i, a, o, s) {
|
|
2777
2779
|
let c = s ? [
|
|
2778
2780
|
l`${e},${t}`,
|
|
2779
2781
|
l`${e + n},${t}`,
|
|
@@ -2785,19 +2787,19 @@ function Qr(e, t, n, r, i, a, o, s) {
|
|
|
2785
2787
|
];
|
|
2786
2788
|
return l`<polygon points="${c.join(" ")}" ${W(i, a, o)} />`;
|
|
2787
2789
|
}
|
|
2788
|
-
function
|
|
2790
|
+
function ei(e, t, n, r, i) {
|
|
2789
2791
|
let a = Math.min(n, r) / 2 - 2;
|
|
2790
2792
|
return l`<circle cx="${e + n / 2}" cy="${t + r / 2}" r="${a}" fill="${i}" stroke="${i}" />`;
|
|
2791
2793
|
}
|
|
2792
|
-
function
|
|
2794
|
+
function ti(e, t, n, r, i, a, o) {
|
|
2793
2795
|
let s = e + n / 2, c = t + r / 2, u = Math.min(n, r) / 2 - 2, d = u / Math.SQRT2;
|
|
2794
2796
|
return l`<circle cx="${s}" cy="${c}" r="${u}" ${W(i, a, o)} />\n` + l`<line x1="${s - d}" y1="${c - d}" x2="${s + d}" y2="${c + d}" stroke="${a}" stroke-width="${o}" />\n` + l`<line x1="${s + d}" y1="${c - d}" x2="${s - d}" y2="${c + d}" stroke="${a}" stroke-width="${o}" />`;
|
|
2795
2797
|
}
|
|
2796
|
-
function
|
|
2798
|
+
function ni(e, t, n, r, i) {
|
|
2797
2799
|
let a = Math.min(8, r);
|
|
2798
2800
|
return l`<rect x="${e}" y="${t + (r - a) / 2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`;
|
|
2799
2801
|
}
|
|
2800
|
-
function
|
|
2802
|
+
function ri(e, t, n, r, i, a, o) {
|
|
2801
2803
|
let s = [
|
|
2802
2804
|
l`${e},${t}`,
|
|
2803
2805
|
l`${e + n - 6},${t}`,
|
|
@@ -2807,7 +2809,7 @@ function ni(e, t, n, r, i, a, o) {
|
|
|
2807
2809
|
].join(" ");
|
|
2808
2810
|
return l`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n` + l`<polygon points="${e + n - 6},${t} ${e + n},${t + 6} ${e + n - 6},${t + 6}" fill="var(--_inner-stroke)" stroke="${a}" stroke-width="${o}" />`;
|
|
2809
2811
|
}
|
|
2810
|
-
function
|
|
2812
|
+
function ii(e, t, n, r, i, a, o) {
|
|
2811
2813
|
let s = Math.min(14, n * .12, r * .3), c = [
|
|
2812
2814
|
l`${e + s},${t}`,
|
|
2813
2815
|
l`${e + n - s},${t}`,
|
|
@@ -2818,7 +2820,7 @@ function ri(e, t, n, r, i, a, o) {
|
|
|
2818
2820
|
].join(" ");
|
|
2819
2821
|
return l`<polygon points="${c}" ${W(i, a, o)} />`;
|
|
2820
2822
|
}
|
|
2821
|
-
function
|
|
2823
|
+
function ai(e, t, n, r, i, a, o) {
|
|
2822
2824
|
let s = Math.min(12, r * .3), c = [
|
|
2823
2825
|
l`${e},${t + s}`,
|
|
2824
2826
|
l`${e + n},${t}`,
|
|
@@ -2827,23 +2829,23 @@ function ii(e, t, n, r, i, a, o) {
|
|
|
2827
2829
|
].join(" ");
|
|
2828
2830
|
return l`<polygon points="${c}" ${W(i, a, o)} />`;
|
|
2829
2831
|
}
|
|
2830
|
-
function
|
|
2832
|
+
function oi(e, t, n, r, i, a, o) {
|
|
2831
2833
|
let s = Math.min(8, r * .14), c = l`M ${e} ${t + s} ` + l`C ${e + n * .25} ${t - s} ${e + n * .75} ${t + s * 2} ${e + n} ${t + s} ` + l`L ${e + n} ${t + r - s} ` + l`C ${e + n * .75} ${t + r + s} ${e + n * .25} ${t + r - s * 2} ${e} ${t + r - s} Z`;
|
|
2832
2834
|
return l`<path d="${c}" ${W(i, a, o)} />`;
|
|
2833
2835
|
}
|
|
2834
|
-
function
|
|
2836
|
+
function si(e, t, n, r, i, a, o) {
|
|
2835
2837
|
let s = Math.min(14, n * .12), c = l`M ${e + s} ${t} L ${e + n} ${t} ` + l`Q ${e + n - s * 1.4} ${t + r / 2} ${e + n} ${t + r} ` + l`L ${e + s} ${t + r} ` + l`Q ${e + s * 1.4} ${t + r / 2} ${e + s} ${t} Z`;
|
|
2836
2838
|
return l`<path d="${c}" ${W(i, a, o)} />`;
|
|
2837
2839
|
}
|
|
2838
|
-
function
|
|
2840
|
+
function ci(e, t, n, r, i, a, o) {
|
|
2839
2841
|
let s = r / 2, c = Math.max(0, n - s), u = l`M ${e} ${t} L ${e + c} ${t} ` + l`A ${s} ${s} 0 0 1 ${e + c} ${t + r} ` + l`L ${e} ${t + r} Z`;
|
|
2840
2842
|
return l`<path d="${u}" ${W(i, a, o)} />`;
|
|
2841
2843
|
}
|
|
2842
|
-
function
|
|
2844
|
+
function li(e, t, n, r, i, a, o, s) {
|
|
2843
2845
|
let c = Math.min(10, n * .12), u = [l`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`], d = l`M ${e + c} ${t} Q ${e} ${t} ${e} ${t + r * .25} ` + l`Q ${e} ${t + r / 2} ${e - c * .4} ${t + r / 2} ` + l`Q ${e} ${t + r / 2} ${e} ${t + r * .75} ` + l`Q ${e} ${t + r} ${e + c} ${t + r}`, f = l`M ${e + n - c} ${t} Q ${e + n} ${t} ${e + n} ${t + r * .25} ` + l`Q ${e + n} ${t + r / 2} ${e + n + c * .4} ${t + r / 2} ` + l`Q ${e + n} ${t + r / 2} ${e + n} ${t + r * .75} ` + l`Q ${e + n} ${t + r} ${e + n - c} ${t + r}`;
|
|
2844
2846
|
return (s === "left" || s === "both") && u.push(l`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`), (s === "right" || s === "both") && u.push(l`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`), u.join("\n");
|
|
2845
2847
|
}
|
|
2846
|
-
function
|
|
2848
|
+
function ui(e, t, n, r, i, a, o) {
|
|
2847
2849
|
let s = [
|
|
2848
2850
|
l`${e + n * .42},${t}`,
|
|
2849
2851
|
l`${e + n},${t}`,
|
|
@@ -2855,28 +2857,28 @@ function li(e, t, n, r, i, a, o) {
|
|
|
2855
2857
|
].join(" ");
|
|
2856
2858
|
return l`<polygon points="${s}" ${W(i, a, o)} />`;
|
|
2857
2859
|
}
|
|
2858
|
-
function
|
|
2860
|
+
function di(e, t, n, r) {
|
|
2859
2861
|
let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2;
|
|
2860
2862
|
return l`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`;
|
|
2861
2863
|
}
|
|
2862
|
-
function
|
|
2864
|
+
function fi(e, t, n, r) {
|
|
2863
2865
|
let i = e + n / 2, a = t + r / 2, o = Math.min(n, r) / 2 - 2, s = o - 4;
|
|
2864
2866
|
return l`<circle cx="${i}" cy="${a}" r="${o}" ` + l`fill="none" stroke="var(--_text)" stroke-width="${R.innerBox * 2}" />` + l`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`;
|
|
2865
2867
|
}
|
|
2866
|
-
function
|
|
2868
|
+
function pi(e, t, n) {
|
|
2867
2869
|
if ((e.shape === "state-start" || e.shape === "state-end") && !e.label) return "";
|
|
2868
2870
|
let r = e.x + e.width / 2, i = e.y + e.height / 2, a = o(e.inlineStyle?.color ?? d(e.inlineStyle?.fill, "var(--_text)")), s = l`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${L.nodeLabel}" fill="${a}"`, c = e.inlineStyle?.["font-family"];
|
|
2869
2871
|
return c && (s += l` style="font-family: ${o(c)};"`), y(e.label, r, i, n.nodeLabel, s);
|
|
2870
2872
|
}
|
|
2871
|
-
function
|
|
2873
|
+
function mi(e) {
|
|
2872
2874
|
return o(e).replace(/\r/g, " ").replace(/\n/g, " ").replace(/\t/g, "	");
|
|
2873
2875
|
}
|
|
2874
|
-
function
|
|
2875
|
-
return t === void 0 ? e : e.replace("<svg ", l`<svg data-src="${
|
|
2876
|
+
function hi(e, t) {
|
|
2877
|
+
return t === void 0 ? e : e.replace("<svg ", l`<svg data-src="${mi(t)}" `);
|
|
2876
2878
|
}
|
|
2877
2879
|
//#endregion
|
|
2878
2880
|
//#region packages/svg-renderer/src/resolve-colors.ts
|
|
2879
|
-
var
|
|
2881
|
+
var gi = class {
|
|
2880
2882
|
raw = /* @__PURE__ */ new Map();
|
|
2881
2883
|
resolved = /* @__PURE__ */ new Map();
|
|
2882
2884
|
inProgress = /* @__PURE__ */ new Set();
|
|
@@ -2888,13 +2890,13 @@ var hi = class {
|
|
|
2888
2890
|
let t = this.raw.get(e);
|
|
2889
2891
|
if (t === void 0 || this.inProgress.has(e)) return;
|
|
2890
2892
|
this.inProgress.add(e);
|
|
2891
|
-
let n =
|
|
2893
|
+
let n = Ci(t, this).trim();
|
|
2892
2894
|
this.inProgress.delete(e);
|
|
2893
2895
|
let r = !/\bvar\(|\bcolor-mix\(/.test(n);
|
|
2894
2896
|
return this.resolved.set(e, r ? n : void 0), r ? n : void 0;
|
|
2895
2897
|
}
|
|
2896
2898
|
};
|
|
2897
|
-
function
|
|
2899
|
+
function _i(e, t) {
|
|
2898
2900
|
let n = 0;
|
|
2899
2901
|
for (let r = t; r < e.length; r++) {
|
|
2900
2902
|
let t = e[r];
|
|
@@ -2903,7 +2905,7 @@ function gi(e, t) {
|
|
|
2903
2905
|
}
|
|
2904
2906
|
return -1;
|
|
2905
2907
|
}
|
|
2906
|
-
function
|
|
2908
|
+
function vi(e) {
|
|
2907
2909
|
let t = [], n = 0, r = 0;
|
|
2908
2910
|
for (let i = 0; i < e.length; i++) {
|
|
2909
2911
|
let a = e[i];
|
|
@@ -2911,12 +2913,12 @@ function _i(e) {
|
|
|
2911
2913
|
}
|
|
2912
2914
|
return t.push(e.slice(r)), t;
|
|
2913
2915
|
}
|
|
2914
|
-
var
|
|
2915
|
-
function
|
|
2916
|
-
let [n, ...r] =
|
|
2916
|
+
var yi = "(?<![\\w-])(var|color-mix)\\(";
|
|
2917
|
+
function bi(e, t) {
|
|
2918
|
+
let [n, ...r] = vi(e), i = (n ?? "").trim(), a = t.lookup(i);
|
|
2917
2919
|
return a === void 0 ? r.length > 0 ? r.join(",").trim() : null : a;
|
|
2918
2920
|
}
|
|
2919
|
-
function
|
|
2921
|
+
function xi(e) {
|
|
2920
2922
|
let t = e.trim().split(/\s+/), n, r;
|
|
2921
2923
|
for (let e of t) if (/^[\d.]+%$/.test(e)) {
|
|
2922
2924
|
if (r !== void 0) return null;
|
|
@@ -2930,61 +2932,61 @@ function bi(e) {
|
|
|
2930
2932
|
pct: r
|
|
2931
2933
|
};
|
|
2932
2934
|
}
|
|
2933
|
-
function
|
|
2934
|
-
let t =
|
|
2935
|
+
function Si(e) {
|
|
2936
|
+
let t = vi(e);
|
|
2935
2937
|
if (t.length !== 3) return null;
|
|
2936
2938
|
let [n, r, i] = t;
|
|
2937
2939
|
if (n === void 0 || r === void 0 || i === void 0 || !/^\s*in\s+srgb\s*$/i.test(n)) return null;
|
|
2938
|
-
let a =
|
|
2940
|
+
let a = xi(r), o = xi(i);
|
|
2939
2941
|
if (!a || !o) return null;
|
|
2940
2942
|
let s = v(a.color), c = v(o.color);
|
|
2941
2943
|
if (!s || !c) return null;
|
|
2942
2944
|
let l = h(s, c, a.pct, o.pct);
|
|
2943
2945
|
return l ? u(l) : null;
|
|
2944
2946
|
}
|
|
2945
|
-
function
|
|
2946
|
-
let n = "", r = 0, i = new RegExp(
|
|
2947
|
+
function Ci(e, t) {
|
|
2948
|
+
let n = "", r = 0, i = new RegExp(yi, "g"), a;
|
|
2947
2949
|
for (; (a = i.exec(e)) !== null;) {
|
|
2948
2950
|
let o = a[1];
|
|
2949
2951
|
if (o === void 0) continue;
|
|
2950
|
-
let s = a.index, c = s + o.length, l =
|
|
2952
|
+
let s = a.index, c = s + o.length, l = _i(e, c);
|
|
2951
2953
|
if (l === -1) break;
|
|
2952
|
-
let u =
|
|
2954
|
+
let u = Ci(e.slice(c + 1, l), t), d = o === "var" ? bi(u, t) : Si(u);
|
|
2953
2955
|
n += e.slice(r, s), n += d ?? `${o}(${u})`, r = l + 1, i.lastIndex = r;
|
|
2954
2956
|
}
|
|
2955
2957
|
return n + e.slice(r);
|
|
2956
2958
|
}
|
|
2957
|
-
function
|
|
2958
|
-
let n = new
|
|
2959
|
+
function wi(e, t) {
|
|
2960
|
+
let n = new gi();
|
|
2959
2961
|
for (let [e, r] of Object.entries(t)) n.declare(e, r);
|
|
2960
|
-
return
|
|
2962
|
+
return Ci(e, n);
|
|
2961
2963
|
}
|
|
2962
|
-
var
|
|
2963
|
-
function
|
|
2964
|
-
|
|
2964
|
+
var Ti = /(--[\w-]+)\s*:\s*([^;{}]+)/g, Ei = /(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g, Di = /* @__PURE__ */ new Set(["data-src"]);
|
|
2965
|
+
function Oi(e, t) {
|
|
2966
|
+
Ti.lastIndex = 0;
|
|
2965
2967
|
let n;
|
|
2966
|
-
for (; (n =
|
|
2968
|
+
for (; (n = Ti.exec(e)) !== null;) {
|
|
2967
2969
|
let [, e, r] = n;
|
|
2968
2970
|
e !== void 0 && r !== void 0 && t.declare(e, r.trim());
|
|
2969
2971
|
}
|
|
2970
2972
|
}
|
|
2971
|
-
function
|
|
2972
|
-
return e.replace(
|
|
2973
|
-
if (
|
|
2973
|
+
function ki(e, t) {
|
|
2974
|
+
return e.replace(Ei, (e, n, r, i, a) => {
|
|
2975
|
+
if (Di.has(r)) return e;
|
|
2974
2976
|
let o = a[0] ?? "\"";
|
|
2975
|
-
return `${n}${r}${i}${o}${
|
|
2977
|
+
return `${n}${r}${i}${o}${Ci(a.slice(1, -1), t)}${o}`;
|
|
2976
2978
|
});
|
|
2977
2979
|
}
|
|
2978
|
-
function
|
|
2979
|
-
let n = new
|
|
2980
|
+
function Ai(e, t) {
|
|
2981
|
+
let n = new gi();
|
|
2980
2982
|
n.declare("--bg", t.bg), n.declare("--fg", t.fg), t.line && n.declare("--line", t.line), t.accent && n.declare("--accent", t.accent), t.muted && n.declare("--muted", t.muted), t.surface && n.declare("--surface", t.surface), t.border && n.declare("--border", t.border);
|
|
2981
2983
|
for (let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)) {
|
|
2982
2984
|
let e = t[1];
|
|
2983
|
-
e !== void 0 &&
|
|
2985
|
+
e !== void 0 && Oi(e, n);
|
|
2984
2986
|
}
|
|
2985
2987
|
for (let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)) {
|
|
2986
2988
|
let e = t[1];
|
|
2987
|
-
e !== void 0 &&
|
|
2989
|
+
e !== void 0 && Oi(e.slice(1, -1), n);
|
|
2988
2990
|
}
|
|
2989
2991
|
let r = "", i = 0;
|
|
2990
2992
|
for (; i < e.length;) {
|
|
@@ -2993,7 +2995,7 @@ function ki(e, t) {
|
|
|
2993
2995
|
if (r += e.slice(i, t), e.startsWith("<style", t)) {
|
|
2994
2996
|
let a = e.indexOf(">", t), o = e.indexOf("</style>", t);
|
|
2995
2997
|
if (a === -1 || o === -1) break;
|
|
2996
|
-
r += e.slice(t, a + 1), r +=
|
|
2998
|
+
r += e.slice(t, a + 1), r += Ci(e.slice(a + 1, o), n), r += "</style>", i = o + 8;
|
|
2997
2999
|
continue;
|
|
2998
3000
|
}
|
|
2999
3001
|
let a = -1, o = null;
|
|
@@ -3008,7 +3010,7 @@ function ki(e, t) {
|
|
|
3008
3010
|
}
|
|
3009
3011
|
if (a === -1) break;
|
|
3010
3012
|
let s = e.slice(t, a + 1);
|
|
3011
|
-
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s :
|
|
3013
|
+
r += s.startsWith("<!") || s.startsWith("<?") || s.startsWith("</") ? s : ki(s, n), i = a + 1;
|
|
3012
3014
|
}
|
|
3013
3015
|
return r + e.slice(i);
|
|
3014
3016
|
}
|
|
@@ -3033,38 +3035,38 @@ var G = {
|
|
|
3033
3035
|
namespacePad: 16,
|
|
3034
3036
|
namespaceTitleFontSize: 12
|
|
3035
3037
|
};
|
|
3036
|
-
function
|
|
3038
|
+
function ji(e) {
|
|
3037
3039
|
return `note ${e}`;
|
|
3038
3040
|
}
|
|
3039
|
-
function
|
|
3041
|
+
function Mi(e) {
|
|
3040
3042
|
return `${e} link`;
|
|
3041
3043
|
}
|
|
3042
|
-
function
|
|
3044
|
+
function Ni(e) {
|
|
3043
3045
|
return `namespace ${e}`;
|
|
3044
3046
|
}
|
|
3045
|
-
function
|
|
3047
|
+
function Pi(e) {
|
|
3046
3048
|
let t = new Set(e.classes.map((e) => e.id)), n = /* @__PURE__ */ new Set(), r = [];
|
|
3047
3049
|
for (let [i, a] of e.namespaces.entries()) {
|
|
3048
3050
|
let e = [];
|
|
3049
3051
|
for (let r of a.classIds) !t.has(r) || n.has(r) || (n.add(r), e.push(r));
|
|
3050
3052
|
e.length > 0 && r.push({
|
|
3051
|
-
id:
|
|
3053
|
+
id: Ni(i),
|
|
3052
3054
|
name: a.name,
|
|
3053
3055
|
classIds: e
|
|
3054
3056
|
});
|
|
3055
3057
|
}
|
|
3056
3058
|
return r;
|
|
3057
3059
|
}
|
|
3058
|
-
function
|
|
3060
|
+
function Fi(e) {
|
|
3059
3061
|
return Ue(e.relationships.map((e) => ({
|
|
3060
3062
|
source: e.from,
|
|
3061
3063
|
target: e.to
|
|
3062
3064
|
})), e.classes.map((e) => e.id));
|
|
3063
3065
|
}
|
|
3064
|
-
function
|
|
3066
|
+
function Ii(e, t) {
|
|
3065
3067
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), i = Le(t.fontSizes);
|
|
3066
3068
|
for (let t of e.classes) {
|
|
3067
|
-
let e = t.annotation ? G.headerBaseHeight + G.annotationHeight : G.headerBaseHeight, r = t.attributes.length > 0 ? t.attributes.length * G.memberRowHeight + G.sectionPadY : G.emptySectionHeight, a = t.methods.length > 0 ? t.methods.length * G.memberRowHeight + G.sectionPadY : G.emptySectionHeight, o = I(t.label, i.nodeLabel, L.nodeLabel), s =
|
|
3069
|
+
let e = t.annotation ? G.headerBaseHeight + G.annotationHeight : G.headerBaseHeight, r = t.attributes.length > 0 ? t.attributes.length * G.memberRowHeight + G.sectionPadY : G.emptySectionHeight, a = t.methods.length > 0 ? t.methods.length * G.memberRowHeight + G.sectionPadY : G.emptySectionHeight, o = I(t.label, i.nodeLabel, L.nodeLabel), s = Bi(t.attributes), c = Bi(t.methods), l = Math.max(G.minWidth, o + G.boxPadX * 2, s + G.boxPadX * 2, c + G.boxPadX * 2), u = e + r + a;
|
|
3068
3070
|
n.set(t.id, {
|
|
3069
3071
|
width: l,
|
|
3070
3072
|
height: u,
|
|
@@ -3073,7 +3075,7 @@ function Fi(e, t) {
|
|
|
3073
3075
|
methodHeight: a
|
|
3074
3076
|
});
|
|
3075
3077
|
}
|
|
3076
|
-
let a =
|
|
3078
|
+
let a = Pi(e), o = /* @__PURE__ */ new Map();
|
|
3077
3079
|
for (let e of a) for (let t of e.classIds) o.set(t, e.id);
|
|
3078
3080
|
let s = /* @__PURE__ */ new Map(), c = [];
|
|
3079
3081
|
for (let e of a) {
|
|
@@ -3097,7 +3099,7 @@ function Fi(e, t) {
|
|
|
3097
3099
|
let n = Je(e, t), r = s.get(o.get(e) ?? "");
|
|
3098
3100
|
r?.children ? r.children.push(n) : c.push(n);
|
|
3099
3101
|
}
|
|
3100
|
-
let l = { fontSize: i.edgeLabel }, u =
|
|
3102
|
+
let l = { fontSize: i.edgeLabel }, u = Fi(e), d = [];
|
|
3101
3103
|
for (let [t, n] of e.relationships.entries()) {
|
|
3102
3104
|
let e = u.has(t);
|
|
3103
3105
|
d.push(Ze({
|
|
@@ -3110,12 +3112,12 @@ function Fi(e, t) {
|
|
|
3110
3112
|
}
|
|
3111
3113
|
let f = new Set(n.keys());
|
|
3112
3114
|
for (let [t, n] of e.notes.entries()) {
|
|
3113
|
-
let e =
|
|
3115
|
+
let e = ji(t), a = p(n.text, i.edgeLabel, L.edgeLabel), o = {
|
|
3114
3116
|
width: a.width + G.notePadX * 2,
|
|
3115
3117
|
height: a.height + G.notePadY * 2
|
|
3116
3118
|
};
|
|
3117
3119
|
r.set(e, o), c.push(Je(e, o)), n.forClass !== void 0 && f.has(n.forClass) && d.push(Ze({
|
|
3118
|
-
id:
|
|
3120
|
+
id: Mi(e),
|
|
3119
3121
|
source: e,
|
|
3120
3122
|
target: n.forClass,
|
|
3121
3123
|
labelStyle: l
|
|
@@ -3145,7 +3147,7 @@ function Fi(e, t) {
|
|
|
3145
3147
|
namespaces: a
|
|
3146
3148
|
};
|
|
3147
3149
|
}
|
|
3148
|
-
function
|
|
3150
|
+
function Li(e, t, n, r, i) {
|
|
3149
3151
|
let a = /* @__PURE__ */ new Map();
|
|
3150
3152
|
for (let e of t.classes) a.set(e.id, e);
|
|
3151
3153
|
let o = new Set(i.map((e) => e.id)), s = /* @__PURE__ */ new Map(), c = [];
|
|
@@ -3206,13 +3208,13 @@ function Ii(e, t, n, r, i) {
|
|
|
3206
3208
|
});
|
|
3207
3209
|
}
|
|
3208
3210
|
}
|
|
3209
|
-
let f = [], p =
|
|
3211
|
+
let f = [], p = Fi(t), m = e.edges ?? [];
|
|
3210
3212
|
for (let [e, n] of t.relationships.entries()) {
|
|
3211
3213
|
let t = m[e];
|
|
3212
3214
|
if (!t)
|
|
3213
3215
|
/* v8 ignore next */
|
|
3214
3216
|
throw Error(`Missing ELK edge for relationship ${e}`);
|
|
3215
|
-
let r = l(t), i =
|
|
3217
|
+
let r = l(t), i = Ft(t, r.x, r.y), a = p.has(e) ? i.reverse() : i, o = It(t, r.x, r.y);
|
|
3216
3218
|
f.push({
|
|
3217
3219
|
from: n.from,
|
|
3218
3220
|
to: n.to,
|
|
@@ -3231,11 +3233,11 @@ function Ii(e, t, n, r, i) {
|
|
|
3231
3233
|
for (let e of c) g.set(e.id, e);
|
|
3232
3234
|
let _ = [];
|
|
3233
3235
|
for (let [e, n] of t.notes.entries()) {
|
|
3234
|
-
let t =
|
|
3236
|
+
let t = ji(e), i = g.get(t), a = r.get(t);
|
|
3235
3237
|
if (!i || !a)
|
|
3236
3238
|
/* v8 ignore next */
|
|
3237
3239
|
throw Error(`Missing layout for note ${e}`);
|
|
3238
|
-
let o = h.get(
|
|
3240
|
+
let o = h.get(Mi(t));
|
|
3239
3241
|
_.push({
|
|
3240
3242
|
id: t,
|
|
3241
3243
|
text: n.text,
|
|
@@ -3244,7 +3246,7 @@ function Ii(e, t, n, r, i) {
|
|
|
3244
3246
|
y: i.y ?? 0,
|
|
3245
3247
|
width: i.width ?? a.width,
|
|
3246
3248
|
height: i.height ?? a.height,
|
|
3247
|
-
...o ? { linkPoints:
|
|
3249
|
+
...o ? { linkPoints: Ft(o, l(o).x, l(o).y) } : {}
|
|
3248
3250
|
});
|
|
3249
3251
|
}
|
|
3250
3252
|
return {
|
|
@@ -3256,7 +3258,7 @@ function Ii(e, t, n, r, i) {
|
|
|
3256
3258
|
namespaces: u
|
|
3257
3259
|
};
|
|
3258
3260
|
}
|
|
3259
|
-
function
|
|
3261
|
+
function Ri(e, t = {}) {
|
|
3260
3262
|
if (e.classes.length === 0 && e.notes.length === 0) return {
|
|
3261
3263
|
width: 0,
|
|
3262
3264
|
height: 0,
|
|
@@ -3265,54 +3267,54 @@ function Li(e, t = {}) {
|
|
|
3265
3267
|
notes: [],
|
|
3266
3268
|
namespaces: []
|
|
3267
3269
|
};
|
|
3268
|
-
let { elkGraph: n, classSizes: r, noteSizes: i, namespaces: a } =
|
|
3269
|
-
return
|
|
3270
|
+
let { elkGraph: n, classSizes: r, noteSizes: i, namespaces: a } = Ii(e, t);
|
|
3271
|
+
return Li(Ae(n, t.layoutCache), e, r, i, a);
|
|
3270
3272
|
}
|
|
3271
|
-
function
|
|
3273
|
+
function zi(e) {
|
|
3272
3274
|
return e.length * Math.ceil(Ne("M", G.memberFontSize));
|
|
3273
3275
|
}
|
|
3274
|
-
function
|
|
3276
|
+
function Bi(e) {
|
|
3275
3277
|
if (e.length === 0) return 0;
|
|
3276
3278
|
let t = 0;
|
|
3277
3279
|
for (let n of e) {
|
|
3278
|
-
let e =
|
|
3280
|
+
let e = zi(ne(n));
|
|
3279
3281
|
e > t && (t = e);
|
|
3280
3282
|
}
|
|
3281
3283
|
return t;
|
|
3282
3284
|
}
|
|
3283
3285
|
//#endregion
|
|
3284
3286
|
//#region packages/svg-renderer/src/class/renderer.ts
|
|
3285
|
-
var
|
|
3287
|
+
var Vi = {
|
|
3286
3288
|
memberSize: 11,
|
|
3287
3289
|
memberWeight: 400,
|
|
3288
3290
|
annotationSize: 10,
|
|
3289
3291
|
annotationWeight: 500
|
|
3290
3292
|
};
|
|
3291
|
-
function
|
|
3293
|
+
function Hi(e, t, n = "Inter", r = !1, i = Ie, a, o, s, c = !0, l = {}) {
|
|
3292
3294
|
let u = [], d = c && e.classes.some((e) => !!S(e.interaction?.href));
|
|
3293
|
-
u.push(
|
|
3294
|
-
for (let t of e.namespaces) u.push(
|
|
3295
|
-
for (let t of e.relationships) u.push(
|
|
3296
|
-
for (let t of e.notes) u.push(
|
|
3297
|
-
for (let t of e.classes) u.push(
|
|
3298
|
-
for (let t of e.notes) u.push(
|
|
3299
|
-
for (let t of e.relationships) u.push(
|
|
3295
|
+
u.push(hi(O(e.width, e.height, t, r, o, s, d, l.styleAttribute, l.description), a)), u.push(Be(n, !0, l.nonce)), u.push("<defs>"), u.push(Wi(e.relationships.some((e) => e.type === "lollipop"))), u.push("</defs>");
|
|
3296
|
+
for (let t of e.namespaces) u.push(Ui(t));
|
|
3297
|
+
for (let t of e.relationships) u.push(Zi(t));
|
|
3298
|
+
for (let t of e.notes) u.push(Xi(t));
|
|
3299
|
+
for (let t of e.classes) u.push(Gi(t, i, c));
|
|
3300
|
+
for (let t of e.notes) u.push(Yi(t, i));
|
|
3301
|
+
for (let t of e.relationships) u.push(ea(t, i));
|
|
3300
3302
|
return u.push("</svg>"), u.join("\n");
|
|
3301
3303
|
}
|
|
3302
|
-
function
|
|
3304
|
+
function Ui(e) {
|
|
3303
3305
|
let { x: t, y: n, width: r, height: i } = e, a = G.namespaceTitleHeight, s = R.outerBox;
|
|
3304
3306
|
return [
|
|
3305
3307
|
l`<g class="class-namespace" data-id="${o(e.name)}" data-label="${o(e.name)}">`,
|
|
3306
3308
|
l` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${s}" />`,
|
|
3307
3309
|
l` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${s}" />`,
|
|
3308
|
-
l` <text x="${t + G.namespacePad}" y="${n + a / 2}" dy="${z}" font-size="${G.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${
|
|
3310
|
+
l` <text x="${t + G.namespacePad}" y="${n + a / 2}" dy="${z}" font-size="${G.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${ra(e.name)}</text>`,
|
|
3309
3311
|
"</g>"
|
|
3310
3312
|
].join("\n");
|
|
3311
3313
|
}
|
|
3312
|
-
function
|
|
3313
|
-
return " <marker id=\"cls-inherit\" markerWidth=\"12\" markerHeight=\"10\" refX=\"12\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"0 0, 12 5, 0 10\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-composition\" markerWidth=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"1\" />\n </marker>\n <marker id=\"cls-aggregation\" markerWidth=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-arrow\" markerWidth=\"8\" markerHeight=\"6\" refX=\"8\" refY=\"3\" orient=\"auto-start-reverse\">\n <polyline points=\"0 0, 8 3, 0 6\" fill=\"none\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>";
|
|
3314
|
+
function Wi(e) {
|
|
3315
|
+
return " <marker id=\"cls-inherit\" markerWidth=\"12\" markerHeight=\"10\" refX=\"12\" refY=\"5\" orient=\"auto-start-reverse\">\n <polygon points=\"0 0, 12 5, 0 10\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-composition\" markerWidth=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" fill=\"var(--_arrow)\" stroke=\"var(--_arrow)\" stroke-width=\"1\" />\n </marker>\n <marker id=\"cls-aggregation\" markerWidth=\"18\" markerHeight=\"14\" refX=\"16.5\" refY=\"7\" orient=\"auto-start-reverse\">\n <polygon points=\"9 1.5, 16.5 7, 9 12.5, 1.5 7\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>\n <marker id=\"cls-arrow\" markerWidth=\"8\" markerHeight=\"6\" refX=\"8\" refY=\"3\" orient=\"auto-start-reverse\">\n <polyline points=\"0 0, 8 3, 0 6\" fill=\"none\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>" + (e ? "\n <marker id=\"cls-lollipop\" markerWidth=\"12\" markerHeight=\"12\" refX=\"11\" refY=\"6\" orient=\"auto-start-reverse\">\n <circle cx=\"6\" cy=\"6\" r=\"5\" fill=\"var(--bg)\" stroke=\"var(--_arrow)\" stroke-width=\"1.5\" />\n </marker>" : "");
|
|
3314
3316
|
}
|
|
3315
|
-
function
|
|
3317
|
+
function Gi(e, t, n = !0) {
|
|
3316
3318
|
let { x: r, y: i, width: a, height: s, headerHeight: c, attrHeight: u, inlineStyle: f } = e, p = [], m = e.interaction, h = o(f?.fill ?? "var(--_node-fill)"), g = o(f?.stroke ?? "var(--_node-stroke)"), _ = o(f?.["stroke-width"] ?? String(R.outerBox)), v = f?.fill ? h : "var(--_group-hdr)", b = f?.color ? o(f.color) : f?.fill ? o(d(f.fill, "var(--_text)")) : void 0, x = e.annotation ? l` data-annotation="${o(e.annotation)}"` : "", w = C(e.className), T = [
|
|
3317
3319
|
l`class="${w ? l`class-node ${w}` : "class-node"}"`,
|
|
3318
3320
|
l`data-id="${o(e.id)}"`,
|
|
@@ -3324,53 +3326,53 @@ function Wi(e, t, n = !0) {
|
|
|
3324
3326
|
let e = m?.target ? l` target="${o(m.target)}"` : "";
|
|
3325
3327
|
p.push(l` <a href="${o(E)}"${e}>`);
|
|
3326
3328
|
}
|
|
3327
|
-
n && m?.tooltip && p.push(l` <title>${
|
|
3329
|
+
n && m?.tooltip && p.push(l` <title>${ra(m.tooltip)}</title>`), p.push(l` <rect x="${r}" y="${i}" width="${a}" height="${s}" ` + l`rx="0" ry="0" fill="${h}" stroke="${g}" stroke-width="${_}" />`), p.push(l` <rect x="${r}" y="${i}" width="${a}" height="${c}" ` + l`rx="0" ry="0" fill="${v}" stroke="${g}" stroke-width="${_}" />`);
|
|
3328
3330
|
let D = i + c / 2;
|
|
3329
3331
|
if (e.annotation) {
|
|
3330
3332
|
let t = i + 12;
|
|
3331
|
-
p.push(l` <text x="${r + a / 2}" y="${t}" text-anchor="middle" dy="${z}" ` + l`font-size="${
|
|
3333
|
+
p.push(l` <text x="${r + a / 2}" y="${t}" text-anchor="middle" dy="${z}" ` + l`font-size="${Vi.annotationSize}" font-weight="${Vi.annotationWeight}" ` + l`font-style="italic" fill="${b ?? "var(--_text-muted)"}"><<${ra(e.annotation)}>></text>`), D = i + c / 2 + 6;
|
|
3332
3334
|
}
|
|
3333
3335
|
p.push(" " + y(e.label, r + a / 2, D, t.nodeLabel, l`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${b ?? "var(--_text)"}"`));
|
|
3334
3336
|
let O = i + c;
|
|
3335
3337
|
p.push(l` <line x1="${r}" y1="${O}" x2="${r + a}" y2="${O}" ` + l`stroke="${g}" stroke-width="${R.innerBox}" />`);
|
|
3336
3338
|
for (let t = 0; t < e.attributes.length; t++) {
|
|
3337
3339
|
let n = e.attributes[t], i = O + 4 + t * 20 + 10;
|
|
3338
|
-
p.push(" " +
|
|
3340
|
+
p.push(" " + qi(n, r + G.boxPadX, i, b));
|
|
3339
3341
|
}
|
|
3340
3342
|
let k = O + u;
|
|
3341
3343
|
p.push(l` <line x1="${r}" y1="${k}" x2="${r + a}" y2="${k}" ` + l`stroke="${g}" stroke-width="${R.innerBox}" />`);
|
|
3342
3344
|
for (let t = 0; t < e.methods.length; t++) {
|
|
3343
3345
|
let n = e.methods[t], i = k + 4 + t * 20 + 10;
|
|
3344
|
-
p.push(" " +
|
|
3346
|
+
p.push(" " + qi(n, r + G.boxPadX, i, b));
|
|
3345
3347
|
}
|
|
3346
3348
|
return E && p.push(" </a>"), p.push("</g>"), p.join("\n");
|
|
3347
3349
|
}
|
|
3348
|
-
var
|
|
3349
|
-
function
|
|
3350
|
+
var Ki = 700;
|
|
3351
|
+
function qi(e, t, n, r) {
|
|
3350
3352
|
let i = e.isAbstract ? " font-style=\"italic\"" : "", a = e.isStatic ? " text-decoration=\"underline\"" : "", o = r ?? "var(--_text-faint)", s = r ?? "var(--_text-sec)", c = r ?? "var(--_text-muted)", u = [];
|
|
3351
|
-
e.visibility && u.push(l`<tspan fill="${s}" font-weight="${
|
|
3353
|
+
e.visibility && u.push(l`<tspan fill="${s}" font-weight="${Ki}">${ra(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);
|
|
3352
3354
|
let d = e.isMethod ? l`${e.name}(${e.params || ""})` : e.name;
|
|
3353
|
-
return u.push(l`<tspan fill="${s}">${
|
|
3355
|
+
return u.push(l`<tspan fill="${s}">${ra(d)}</tspan>`), e.type && (u.push(l`<tspan fill="${o}">: </tspan>`), u.push(l`<tspan fill="${c}">${ra(e.type)}</tspan>`)), l`<text x="${t}" y="${n}" class="mono" dy="${z}" ` + l`font-size="${Vi.memberSize}" font-weight="${Vi.memberWeight}"${i}${a}>` + l`${u.join("")}</text>`;
|
|
3354
3356
|
}
|
|
3355
|
-
var
|
|
3356
|
-
function
|
|
3357
|
+
var Ji = 6;
|
|
3358
|
+
function Yi(e, t) {
|
|
3357
3359
|
let { x: n, y: r, width: i, height: a } = e, s = e.forClass === void 0 ? "" : l` data-for="${o(e.forClass)}"`, c = [
|
|
3358
3360
|
l`${n},${r}`,
|
|
3359
|
-
l`${n + i -
|
|
3360
|
-
l`${n + i},${r +
|
|
3361
|
+
l`${n + i - Ji},${r}`,
|
|
3362
|
+
l`${n + i},${r + Ji}`,
|
|
3361
3363
|
l`${n + i},${r + a}`,
|
|
3362
3364
|
l`${n},${r + a}`
|
|
3363
|
-
].join(" "), u = l`${n + i -
|
|
3365
|
+
].join(" "), u = l`${n + i - Ji},${r} ${n + i},${r + Ji} ` + l`${n + i - Ji},${r + Ji}`;
|
|
3364
3366
|
return l`<g class="class-note"${s}>` + l`\n <polygon points="${c}" ` + l`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />` + l`\n <polygon points="${u}" ` + l`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />` + l`\n ${y(e.text, n + i / 2, r + a / 2, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}` + "\n</g>";
|
|
3365
3367
|
}
|
|
3366
|
-
function
|
|
3368
|
+
function Xi(e) {
|
|
3367
3369
|
if (!e.linkPoints || e.linkPoints.length < 2) return "";
|
|
3368
3370
|
let t = e.linkPoints.map((e) => l`${e.x},${e.y}`).join(" "), n = e.forClass === void 0 ? "" : l` data-for="${o(e.forClass)}"`;
|
|
3369
3371
|
return l`<polyline class="class-note-link"${n} points="${t}" ` + l`fill="none" stroke="var(--_line)" stroke-width="${R.connector}" stroke-dasharray="2 3" />`;
|
|
3370
3372
|
}
|
|
3371
|
-
function
|
|
3373
|
+
function Zi(e) {
|
|
3372
3374
|
if (e.points.length < 2) return "";
|
|
3373
|
-
let t = e.points.map((e) => l`${e.x},${e.y}`).join(" "), n = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", r =
|
|
3375
|
+
let t = e.points.map((e) => l`${e.x},${e.y}`).join(" "), n = e.type === "dependency" || e.type === "realization" ? " stroke-dasharray=\"6 4\"" : "", r = Qi(e.type, e.markerAt), i = [
|
|
3374
3376
|
"class=\"class-relationship\"",
|
|
3375
3377
|
l`data-from="${o(e.from)}"`,
|
|
3376
3378
|
l`data-to="${o(e.to)}"`,
|
|
@@ -3379,11 +3381,11 @@ function Xi(e) {
|
|
|
3379
3381
|
];
|
|
3380
3382
|
return e.label && i.push(l`data-label="${o(e.label)}"`), e.fromCardinality && i.push(l`data-from-cardinality="${o(e.fromCardinality)}"`), e.toCardinality && i.push(l`data-to-cardinality="${o(e.toCardinality)}"`), l`<polyline ${i.join(" ")} points="${t}" fill="none" stroke="var(--_line)" ` + l`stroke-width="${R.connector}"${n}${r} />`;
|
|
3381
3383
|
}
|
|
3382
|
-
function
|
|
3383
|
-
let n =
|
|
3384
|
-
return n ? t === "
|
|
3384
|
+
function Qi(e, t) {
|
|
3385
|
+
let n = $i(e);
|
|
3386
|
+
return n ? (t === "to" ? "" : l` marker-start="url(#${n})"`) + (t === "from" ? "" : l` marker-end="url(#${n})"`) : "";
|
|
3385
3387
|
}
|
|
3386
|
-
function
|
|
3388
|
+
function $i(e) {
|
|
3387
3389
|
switch (e) {
|
|
3388
3390
|
case "inheritance":
|
|
3389
3391
|
case "realization": return "cls-inherit";
|
|
@@ -3391,33 +3393,34 @@ function Qi(e) {
|
|
|
3391
3393
|
case "aggregation": return "cls-aggregation";
|
|
3392
3394
|
case "association":
|
|
3393
3395
|
case "dependency": return "cls-arrow";
|
|
3396
|
+
case "lollipop": return "cls-lollipop";
|
|
3394
3397
|
default: return null;
|
|
3395
3398
|
}
|
|
3396
3399
|
}
|
|
3397
|
-
function
|
|
3400
|
+
function ea(e, t) {
|
|
3398
3401
|
if (!e.label && !e.fromCardinality && !e.toCardinality || e.points.length < 2) return "";
|
|
3399
3402
|
let n = [];
|
|
3400
3403
|
if (e.label) {
|
|
3401
|
-
let r = e.labelPosition ??
|
|
3404
|
+
let r = e.labelPosition ?? ta(e.points);
|
|
3402
3405
|
n.push(y(e.label, r.x, r.y - 8, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
3403
3406
|
}
|
|
3404
3407
|
if (e.fromCardinality && e.points.length >= 2) {
|
|
3405
|
-
let r = e.points[0], i = e.points[1], a =
|
|
3408
|
+
let r = e.points[0], i = e.points[1], a = na(r, i);
|
|
3406
3409
|
n.push(y(e.fromCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
3407
3410
|
}
|
|
3408
3411
|
if (e.toCardinality && e.points.length >= 2) {
|
|
3409
|
-
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a =
|
|
3412
|
+
let r = e.points[e.points.length - 1], i = e.points[e.points.length - 2], a = na(r, i);
|
|
3410
3413
|
n.push(y(e.toCardinality, r.x + a.x, r.y + a.y, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
3411
3414
|
}
|
|
3412
3415
|
return n.join("\n");
|
|
3413
3416
|
}
|
|
3414
|
-
function
|
|
3417
|
+
function ta(e) {
|
|
3415
3418
|
return e.length === 0 ? {
|
|
3416
3419
|
x: 0,
|
|
3417
3420
|
y: 0
|
|
3418
3421
|
} : e[Math.floor(e.length / 2)];
|
|
3419
3422
|
}
|
|
3420
|
-
function
|
|
3423
|
+
function na(e, t) {
|
|
3421
3424
|
let n = t.x - e.x, r = t.y - e.y;
|
|
3422
3425
|
return Math.abs(n) > Math.abs(r) ? {
|
|
3423
3426
|
x: n > 0 ? 14 : -14,
|
|
@@ -3427,7 +3430,7 @@ function ta(e, t) {
|
|
|
3427
3430
|
y: r > 0 ? 14 : -14
|
|
3428
3431
|
};
|
|
3429
3432
|
}
|
|
3430
|
-
var
|
|
3433
|
+
var ra = s, ia = {
|
|
3431
3434
|
padding: 40,
|
|
3432
3435
|
boxPadX: 14,
|
|
3433
3436
|
headerHeight: 34,
|
|
@@ -3438,18 +3441,18 @@ var na = s, ra = {
|
|
|
3438
3441
|
nodeSpacing: 70,
|
|
3439
3442
|
layerSpacing: 90
|
|
3440
3443
|
};
|
|
3441
|
-
function
|
|
3442
|
-
return e.length * Math.ceil(Ne("M",
|
|
3444
|
+
function aa(e) {
|
|
3445
|
+
return e.length * Math.ceil(Ne("M", ia.attrFontSize));
|
|
3443
3446
|
}
|
|
3444
|
-
function
|
|
3447
|
+
function oa(e, t) {
|
|
3445
3448
|
let n = /* @__PURE__ */ new Map(), r = Le(t.fontSizes);
|
|
3446
3449
|
for (let t of e.entities) {
|
|
3447
3450
|
let e = I(t.label, r.nodeLabel, L.nodeLabel), i = 0;
|
|
3448
3451
|
for (let e of t.attributes) {
|
|
3449
|
-
let t =
|
|
3452
|
+
let t = aa(`${e.type} ${e.name}${e.keys.length > 0 ? " " + e.keys.join(",") : ""}`);
|
|
3450
3453
|
t > i && (i = t);
|
|
3451
3454
|
}
|
|
3452
|
-
let a = Math.max(
|
|
3455
|
+
let a = Math.max(ia.minWidth, e + ia.boxPadX * 2, i + ia.boxPadX * 2), o = ia.headerHeight + Math.max(t.attributes.length, 1) * ia.rowHeight;
|
|
3453
3456
|
n.set(t.id, {
|
|
3454
3457
|
width: a,
|
|
3455
3458
|
height: o
|
|
@@ -3471,9 +3474,9 @@ function aa(e, t) {
|
|
|
3471
3474
|
layoutOptions: {
|
|
3472
3475
|
...qe({
|
|
3473
3476
|
direction: Ge(e.direction, We.er),
|
|
3474
|
-
nodeSpacing:
|
|
3475
|
-
layerSpacing:
|
|
3476
|
-
padding:
|
|
3477
|
+
nodeSpacing: ia.nodeSpacing,
|
|
3478
|
+
layerSpacing: ia.layerSpacing,
|
|
3479
|
+
padding: ia.padding
|
|
3477
3480
|
}),
|
|
3478
3481
|
"elk.edgeLabels.placement": "CENTER",
|
|
3479
3482
|
"elk.layered.considerModelOrder.strategy": "NODES_AND_EDGES",
|
|
@@ -3486,12 +3489,12 @@ function aa(e, t) {
|
|
|
3486
3489
|
entitySizes: n
|
|
3487
3490
|
};
|
|
3488
3491
|
}
|
|
3489
|
-
function
|
|
3492
|
+
function sa(e, t, n) {
|
|
3490
3493
|
let r = /* @__PURE__ */ new Map();
|
|
3491
3494
|
for (let e of t.entities) r.set(e.id, e);
|
|
3492
3495
|
let i = [];
|
|
3493
|
-
for (let
|
|
3494
|
-
let e = r.get(
|
|
3496
|
+
for (let a of e.children ?? []) {
|
|
3497
|
+
let e = r.get(a.id);
|
|
3495
3498
|
if (e) {
|
|
3496
3499
|
let r = n.get(e.id);
|
|
3497
3500
|
if (!r)
|
|
@@ -3501,18 +3504,20 @@ function oa(e, t, n) {
|
|
|
3501
3504
|
id: e.id,
|
|
3502
3505
|
label: e.label,
|
|
3503
3506
|
attributes: e.attributes,
|
|
3504
|
-
x:
|
|
3505
|
-
y:
|
|
3506
|
-
width:
|
|
3507
|
-
height:
|
|
3508
|
-
headerHeight:
|
|
3509
|
-
rowHeight:
|
|
3507
|
+
x: a.x ?? 0,
|
|
3508
|
+
y: a.y ?? 0,
|
|
3509
|
+
width: a.width ?? r.width,
|
|
3510
|
+
height: a.height ?? r.height,
|
|
3511
|
+
headerHeight: ia.headerHeight,
|
|
3512
|
+
rowHeight: ia.rowHeight,
|
|
3513
|
+
inlineStyle: x(e.id, t),
|
|
3514
|
+
className: t.classAssignments.get(e.id)
|
|
3510
3515
|
});
|
|
3511
3516
|
}
|
|
3512
3517
|
}
|
|
3513
3518
|
let a = [];
|
|
3514
3519
|
for (let [n, r] of (e.edges ?? []).entries()) {
|
|
3515
|
-
let e = t.relationships[n], i =
|
|
3520
|
+
let e = t.relationships[n], i = Ft(r);
|
|
3516
3521
|
a.push({
|
|
3517
3522
|
entity1: e.entity1,
|
|
3518
3523
|
entity2: e.entity2,
|
|
@@ -3530,58 +3535,58 @@ function oa(e, t, n) {
|
|
|
3530
3535
|
relationships: a
|
|
3531
3536
|
};
|
|
3532
3537
|
}
|
|
3533
|
-
function
|
|
3538
|
+
function ca(e, t = {}) {
|
|
3534
3539
|
if (e.entities.length === 0) return {
|
|
3535
3540
|
width: 0,
|
|
3536
3541
|
height: 0,
|
|
3537
3542
|
entities: [],
|
|
3538
3543
|
relationships: []
|
|
3539
3544
|
};
|
|
3540
|
-
let { elkGraph: n, entitySizes: r } =
|
|
3541
|
-
return
|
|
3545
|
+
let { elkGraph: n, entitySizes: r } = oa(e, t);
|
|
3546
|
+
return sa(Ae(n, t.layoutCache), e, r);
|
|
3542
3547
|
}
|
|
3543
3548
|
//#endregion
|
|
3544
3549
|
//#region packages/svg-renderer/src/er/renderer.ts
|
|
3545
|
-
var
|
|
3550
|
+
var la = 70, ua = {
|
|
3546
3551
|
attrSize: 11,
|
|
3547
3552
|
attrWeight: 400,
|
|
3548
3553
|
keySize: 9,
|
|
3549
3554
|
keyWeight: 600
|
|
3550
3555
|
};
|
|
3551
|
-
function
|
|
3556
|
+
function da(e, t, n = "Inter", r = !1, i = Ie, a, o, s, c = {}) {
|
|
3552
3557
|
let l = [];
|
|
3553
|
-
l.push(
|
|
3554
|
-
for (let t of e.relationships) l.push(
|
|
3555
|
-
for (let t of e.entities) l.push(
|
|
3556
|
-
for (let t of e.relationships) l.push(
|
|
3557
|
-
for (let t of e.relationships) l.push(
|
|
3558
|
+
l.push(hi(O(e.width, e.height, t, r, o, s, void 0, c.styleAttribute, c.description), a)), l.push(Be(n, !0, c.nonce)), l.push("<defs>"), l.push("</defs>");
|
|
3559
|
+
for (let t of e.relationships) l.push(ma(t));
|
|
3560
|
+
for (let t of e.entities) l.push(fa(t, i));
|
|
3561
|
+
for (let t of e.relationships) l.push(ga(t));
|
|
3562
|
+
for (let t of e.relationships) l.push(ha(t, i));
|
|
3558
3563
|
return l.push("</svg>"), l.join("\n");
|
|
3559
3564
|
}
|
|
3560
|
-
function
|
|
3561
|
-
let { id: n, x: r, y: i, width: a, height: s, headerHeight: c, rowHeight: u, label:
|
|
3562
|
-
|
|
3563
|
-
let
|
|
3564
|
-
|
|
3565
|
-
for (let e = 0; e <
|
|
3566
|
-
let t =
|
|
3567
|
-
|
|
3565
|
+
function fa(e, t) {
|
|
3566
|
+
let { id: n, x: r, y: i, width: a, height: s, headerHeight: c, rowHeight: u, label: f, attributes: p, inlineStyle: m } = e, h = [], g = o(m?.fill ?? "var(--_node-fill)"), _ = o(m?.stroke ?? "var(--_node-stroke)"), v = o(m?.["stroke-width"] ?? String(R.outerBox)), b = o(m?.["stroke-width"] ?? String(R.innerBox)), x = m?.fill ? g : "var(--_group-hdr)", S = m?.color ? o(m.color) : m?.fill ? o(d(m.fill, "var(--_text)")) : void 0, w = C(e.className);
|
|
3567
|
+
h.push(l`<g class="${w ? l`entity ${w}` : "entity"}" data-id="${o(n)}" data-label="${o(f)}">`), h.push(l` <rect x="${r}" y="${i}" width="${a}" height="${s}" ` + l`rx="0" ry="0" fill="${g}" stroke="${_}" stroke-width="${v}" />`), h.push(l` <rect x="${r}" y="${i}" width="${a}" height="${c}" ` + l`rx="0" ry="0" fill="${x}" stroke="${_}" stroke-width="${v}" />`), h.push(" " + y(f, r + a / 2, i + c / 2, t.nodeLabel, l`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${S ?? "var(--_text)"}"`));
|
|
3568
|
+
let T = i + c;
|
|
3569
|
+
h.push(l` <line x1="${r}" y1="${T}" x2="${r + a}" y2="${T}" ` + l`stroke="${_}" stroke-width="${b}" />`);
|
|
3570
|
+
for (let e = 0; e < p.length; e++) {
|
|
3571
|
+
let t = p[e], n = T + e * u + u / 2;
|
|
3572
|
+
h.push(" " + pa(t, r, n, a, S).replace(/\n/g, "\n "));
|
|
3568
3573
|
}
|
|
3569
|
-
return
|
|
3574
|
+
return p.length === 0 && h.push(l` <text x="${r + a / 2}" y="${T + u / 2}" text-anchor="middle" dy="${z}" ` + l`font-size="${ua.attrSize}" fill="${S ?? "var(--_text-muted)"}" font-style="italic">(no attributes)</text>`), h.push("</g>"), h.join("\n");
|
|
3570
3575
|
}
|
|
3571
|
-
function
|
|
3572
|
-
let
|
|
3576
|
+
function pa(e, t, n, r, i) {
|
|
3577
|
+
let a = [], o = e.comment && e.comment.length > 0;
|
|
3573
3578
|
if (e.comment && e.comment.length > 0) {
|
|
3574
3579
|
let t = e.comment.replace(/<br\s*\/?>/gi, "\n");
|
|
3575
|
-
|
|
3580
|
+
a.push(l`<g><title>${ya(t)}</title>`);
|
|
3576
3581
|
}
|
|
3577
|
-
let
|
|
3578
|
-
e.keys.length > 0 && (
|
|
3579
|
-
let
|
|
3580
|
-
|
|
3581
|
-
let
|
|
3582
|
-
return
|
|
3582
|
+
let s = 0;
|
|
3583
|
+
e.keys.length > 0 && (s = I(e.keys.join(","), ua.keySize, ua.keyWeight) + 8, a.push(l`<rect x="${t + 6}" y="${n - 7}" width="${s}" height="14" rx="2" ry="2" ` + "fill=\"var(--_key-badge)\" />"), a.push(l`<text x="${t + 6 + s / 2}" y="${n}" text-anchor="middle" dy="${z}" ` + l`font-size="${ua.keySize}" font-weight="${ua.keyWeight}" fill="${i ?? "var(--_text-sec)"}">${e.keys.join(",")}</text>`));
|
|
3584
|
+
let c = t + 8 + (s > 0 ? s + 6 : 0);
|
|
3585
|
+
a.push(l`<text x="${c}" y="${n}" class="mono" dy="${z}" ` + l`font-size="${ua.attrSize}" font-weight="${ua.attrWeight}">` + l`<tspan fill="${i ?? "var(--_text-muted)"}">${ya(e.type)}</tspan></text>`);
|
|
3586
|
+
let u = t + r - 8;
|
|
3587
|
+
return a.push(l`<text x="${u}" y="${n}" class="mono" text-anchor="end" dy="${z}" ` + l`font-size="${ua.attrSize}" font-weight="${ua.attrWeight}">` + l`<tspan fill="${i ?? "var(--_text-sec)"}">${ya(e.name)}</tspan></text>`), o && a.push("</g>"), a.join("\n");
|
|
3583
3588
|
}
|
|
3584
|
-
function
|
|
3589
|
+
function ma(e) {
|
|
3585
3590
|
if (e.points.length < 2) return "";
|
|
3586
3591
|
let t = e.points.map((e) => l`${e.x},${e.y}`).join(" "), n = e.identifying ? "" : " stroke-dasharray=\"6 4\"", r = e.label ? l` data-label="${o(e.label)}"` : "", i = [
|
|
3587
3592
|
"class=\"er-relationship\"",
|
|
@@ -3593,19 +3598,19 @@ function pa(e) {
|
|
|
3593
3598
|
];
|
|
3594
3599
|
return l`<polyline ${i.join(" ")}${r} points="${t}" fill="none" stroke="var(--_line)" ` + l`stroke-width="${R.connector}"${n} />`;
|
|
3595
3600
|
}
|
|
3596
|
-
function
|
|
3601
|
+
function ha(e, t) {
|
|
3597
3602
|
if (!e.label || e.points.length < 2) return "";
|
|
3598
|
-
let n =
|
|
3599
|
-
return l`<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" ` + "fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"0.5\" />" + l`\n${y(e.label, n.x, n.y, t.edgeLabel, l`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${
|
|
3603
|
+
let n = va(e.points), r = p(e.label, t.edgeLabel, L.edgeLabel), i = r.width + 8, a = r.height + 6;
|
|
3604
|
+
return l`<rect x="${n.x - i / 2}" y="${n.y - a / 2}" width="${i}" height="${a}" rx="2" ry="2" ` + "fill=\"var(--bg)\" stroke=\"var(--_inner-stroke)\" stroke-width=\"0.5\" />" + l`\n${y(e.label, n.x, n.y, t.edgeLabel, l`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${la}%, var(--bg))"`)}`;
|
|
3600
3605
|
}
|
|
3601
|
-
function
|
|
3606
|
+
function ga(e) {
|
|
3602
3607
|
if (e.points.length < 2) return "";
|
|
3603
3608
|
let t = [], n = e.points[0], r = e.points[1];
|
|
3604
|
-
t.push(
|
|
3609
|
+
t.push(_a(n, r, e.cardinality1));
|
|
3605
3610
|
let i = e.points[e.points.length - 1], a = e.points[e.points.length - 2];
|
|
3606
|
-
return t.push(
|
|
3611
|
+
return t.push(_a(i, a, e.cardinality2)), t.join("\n");
|
|
3607
3612
|
}
|
|
3608
|
-
function
|
|
3613
|
+
function _a(e, t, n) {
|
|
3609
3614
|
let r = [], i = R.connector + .25, a = e.x - t.x, o = e.y - t.y, s = Math.sqrt(a * a + o * o);
|
|
3610
3615
|
if (s === 0) return "";
|
|
3611
3616
|
let c = a / s, u = o / s, d = -u, f = c, p = e.x - c * 4, m = e.y - u * 4, h = e.x - c * 16, g = e.y - u * 16, _ = n === "one" || n === "zero-one", v = n === "many" || n === "zero-many", y = n === "zero-one" || n === "zero-many";
|
|
@@ -3628,7 +3633,7 @@ function ga(e, t, n) {
|
|
|
3628
3633
|
}
|
|
3629
3634
|
return r.join("\n");
|
|
3630
3635
|
}
|
|
3631
|
-
function
|
|
3636
|
+
function va(e) {
|
|
3632
3637
|
if (e.length === 0) return {
|
|
3633
3638
|
x: 0,
|
|
3634
3639
|
y: 0
|
|
@@ -3654,7 +3659,7 @@ function _a(e) {
|
|
|
3654
3659
|
}
|
|
3655
3660
|
return e[e.length - 1];
|
|
3656
3661
|
}
|
|
3657
|
-
var
|
|
3662
|
+
var ya = s, ba = {
|
|
3658
3663
|
padding: 30,
|
|
3659
3664
|
actorGap: 140,
|
|
3660
3665
|
actorHeight: 40,
|
|
@@ -3676,33 +3681,33 @@ var va = s, ya = {
|
|
|
3676
3681
|
noteStackGap: 4,
|
|
3677
3682
|
boxPad: 10
|
|
3678
3683
|
};
|
|
3679
|
-
function
|
|
3684
|
+
function xa(e) {
|
|
3680
3685
|
return e + 8;
|
|
3681
3686
|
}
|
|
3682
|
-
var
|
|
3687
|
+
var Sa = 14, Ca = /* @__PURE__ */ new Set([
|
|
3683
3688
|
"boundary",
|
|
3684
3689
|
"control",
|
|
3685
3690
|
"entity",
|
|
3686
3691
|
"database"
|
|
3687
3692
|
]);
|
|
3688
|
-
function
|
|
3689
|
-
return e.type === "actor" ||
|
|
3693
|
+
function wa(e) {
|
|
3694
|
+
return e.type === "actor" || Ca.has(e.participantType);
|
|
3690
3695
|
}
|
|
3691
|
-
var
|
|
3692
|
-
function
|
|
3696
|
+
var Ta = 4;
|
|
3697
|
+
function Ea(e, t, n) {
|
|
3693
3698
|
return 14 + p(e, t, n).height / 2;
|
|
3694
3699
|
}
|
|
3695
|
-
function
|
|
3700
|
+
function Da(e) {
|
|
3696
3701
|
return {
|
|
3697
|
-
...
|
|
3698
|
-
actorHeight: e?.actorHeight ??
|
|
3699
|
-
headerGap: e?.headerGap ??
|
|
3700
|
-
messageRowHeight: e?.messageRowHeight ??
|
|
3701
|
-
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ??
|
|
3702
|
-
noteStackGap: e?.noteStackGap ??
|
|
3702
|
+
...ba,
|
|
3703
|
+
actorHeight: e?.actorHeight ?? ba.actorHeight,
|
|
3704
|
+
headerGap: e?.headerGap ?? ba.headerGap,
|
|
3705
|
+
messageRowHeight: e?.messageRowHeight ?? ba.messageRowHeight,
|
|
3706
|
+
noteOffsetAfterMessage: e?.noteOffsetAfterMessage ?? ba.noteOffsetAfterMessage,
|
|
3707
|
+
noteStackGap: e?.noteStackGap ?? ba.noteStackGap
|
|
3703
3708
|
};
|
|
3704
3709
|
}
|
|
3705
|
-
function
|
|
3710
|
+
function Oa(e, t = {}) {
|
|
3706
3711
|
if (e.actors.length === 0) return {
|
|
3707
3712
|
width: 0,
|
|
3708
3713
|
height: 0,
|
|
@@ -3714,7 +3719,7 @@ function Da(e, t = {}) {
|
|
|
3714
3719
|
notes: [],
|
|
3715
3720
|
boxes: []
|
|
3716
3721
|
};
|
|
3717
|
-
let n =
|
|
3722
|
+
let n = Da(t.sequence), r = Le(t.fontSizes), i = e.actors.map((e) => {
|
|
3718
3723
|
let t = I(e.label, r.nodeLabel, L.nodeLabel);
|
|
3719
3724
|
return Math.max(t + n.actorPadX * 2, 80);
|
|
3720
3725
|
}), a = [], o = n.padding + i[0] / 2;
|
|
@@ -3727,7 +3732,7 @@ function Da(e, t = {}) {
|
|
|
3727
3732
|
}
|
|
3728
3733
|
let s = /* @__PURE__ */ new Map();
|
|
3729
3734
|
for (let t = 0; t < e.actors.length; t++) s.set(e.actors[t].id, t);
|
|
3730
|
-
let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ?
|
|
3735
|
+
let c = e.boxes.filter((e) => e.actorIds.length > 0), l = c.some((e) => e.label !== ""), u = c.length === 0 ? 0 : n.boxPad + (l ? xa(r.edgeLabel) : 0), d = n.padding + u, f = e.actors.map((e, t) => ({
|
|
3731
3736
|
id: e.id,
|
|
3732
3737
|
label: e.label,
|
|
3733
3738
|
type: e.type,
|
|
@@ -3745,7 +3750,7 @@ function Da(e, t = {}) {
|
|
|
3745
3750
|
height: 0
|
|
3746
3751
|
};
|
|
3747
3752
|
return e.color !== void 0 && (u.color = e.color), u;
|
|
3748
|
-
}), m = e.actors.map((e) =>
|
|
3753
|
+
}), m = e.actors.map((e) => wa(e) ? Ea(e.label, r.nodeLabel, L.nodeLabel) : 0), h = Math.max(0, ...e.actors.map((e, t) => e.createdAt === void 0 ? m[t] : 0)), g = r.edgeLabel + 12, _ = d + n.actorHeight + Math.max(n.headerGap, h > 0 ? h + Ta + g : 0), v = [], y = /* @__PURE__ */ new Map();
|
|
3749
3754
|
for (let t of e.blocks) {
|
|
3750
3755
|
let e = y.get(t.startIndex) ?? 0;
|
|
3751
3756
|
y.set(t.startIndex, Math.max(e, n.blockHeaderExtra));
|
|
@@ -3925,7 +3930,7 @@ function Da(e, t = {}) {
|
|
|
3925
3930
|
let r = e.destroyedAt, i = {
|
|
3926
3931
|
actorId: e.id,
|
|
3927
3932
|
x: a[t],
|
|
3928
|
-
topY: f[t].y + n.actorHeight + (m[t] > 0 ? m[t] +
|
|
3933
|
+
topY: f[t].y + n.actorHeight + (m[t] > 0 ? m[t] + Ta : 0),
|
|
3929
3934
|
bottomY: r === void 0 ? j - n.padding : v[r]?.y ?? _
|
|
3930
3935
|
};
|
|
3931
3936
|
return r !== void 0 && (i.destroyed = !0), i;
|
|
@@ -3946,36 +3951,36 @@ function Da(e, t = {}) {
|
|
|
3946
3951
|
}
|
|
3947
3952
|
//#endregion
|
|
3948
3953
|
//#region packages/svg-renderer/src/sequence/renderer.ts
|
|
3949
|
-
function
|
|
3954
|
+
function ka(e, n, r = "Inter", i = !1, a = Ie, o, s, c, l = {}) {
|
|
3950
3955
|
let u = [];
|
|
3951
|
-
u.push(
|
|
3952
|
-
for (let t of e.boxes) u.push(
|
|
3953
|
-
for (let t of e.blocks) u.push(
|
|
3954
|
-
let d =
|
|
3955
|
-
for (let t of e.lifelines) u.push(
|
|
3956
|
-
for (let t of e.activations) u.push(
|
|
3957
|
-
for (let t of e.messages) u.push(
|
|
3958
|
-
for (let t of e.notes) u.push(
|
|
3959
|
-
for (let t of e.actors) u.push(
|
|
3956
|
+
u.push(hi(O(e.width, e.height, n, i, s, c, void 0, l.styleAttribute, l.description), o)), u.push(t(r, !1, l.nonce)), u.push("<defs>"), u.push(Aa()), u.push("</defs>");
|
|
3957
|
+
for (let t of e.boxes) u.push(Ya(t, a));
|
|
3958
|
+
for (let t of e.blocks) u.push(Xa(t, a));
|
|
3959
|
+
let d = Va(e, a);
|
|
3960
|
+
for (let t of e.lifelines) u.push(Ua(t, d));
|
|
3961
|
+
for (let t of e.activations) u.push(Ga(t));
|
|
3962
|
+
for (let t of e.messages) u.push(Ka(t, a));
|
|
3963
|
+
for (let t of e.notes) u.push(Za(t, a));
|
|
3964
|
+
for (let t of e.actors) u.push(Ma(t, a));
|
|
3960
3965
|
return u.push("</svg>"), u.join("\n");
|
|
3961
3966
|
}
|
|
3962
|
-
function
|
|
3967
|
+
function Aa() {
|
|
3963
3968
|
let e = B.width, t = B.height;
|
|
3964
3969
|
return l` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">` + l`\n <polygon points="0 0, ${e} ${t / 2}, 0 ${t}" fill="var(--_arrow)" />` + "\n </marker>" + l`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t / 2}" orient="auto-start-reverse">` + l`\n <polyline points="0 0, ${e} ${t / 2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />` + "\n </marker>";
|
|
3965
3970
|
}
|
|
3966
|
-
var
|
|
3971
|
+
var ja = {
|
|
3967
3972
|
boundary: (e, t) => `\n <circle cx="15" cy="12" r="8" ${e} />\n <path d="M1 6V18M1 12H7" ${t} />`,
|
|
3968
3973
|
control: (e, t) => `\n <circle cx="12" cy="13" r="9" ${e} />\n <path d="M13 1L10 4L13 7" ${t} />`,
|
|
3969
3974
|
entity: (e, t) => `\n <circle cx="12" cy="11" r="9" ${e} />\n <path d="M3 22H21" ${t} />`,
|
|
3970
3975
|
database: (e, t) => `\n <path d="M2 5A10 3.5 0 0 1 22 5V19A10 3.5 0 0 1 2 19Z" ${e} />\n <path d="M2 5A10 3.5 0 0 0 22 5" ${t} />`
|
|
3971
3976
|
};
|
|
3972
|
-
function
|
|
3977
|
+
function Ma(e, t) {
|
|
3973
3978
|
let { id: n, x: r, y: i, width: a, height: s, label: c, type: u, participantType: d } = e, f = [], p = l`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`;
|
|
3974
3979
|
if (f.push(l`<g class="actor" data-id="${o(n)}" data-label="${o(c)}" data-type="${u}">`), u === "actor") {
|
|
3975
3980
|
let e = s / 24 * .9, n = r - 12 * e, a = i + (s - 24 * e) / 2, o = R.outerBox / e, u = "var(--_line)";
|
|
3976
3981
|
f.push(l` <g transform="translate(${n},${a}) scale(${e})">` + l`\n <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" fill="none" stroke="${u}" stroke-width="${o}" />` + l`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${u}" stroke-width="${o}" />` + l`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${u}" stroke-width="${o}" />` + "\n </g>"), f.push(" " + y(c, r, i + s + 14, t.nodeLabel, p));
|
|
3977
|
-
} else if (
|
|
3978
|
-
let e = s / 24 * .9, n = R.outerBox / e, a = l`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`, o = l`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`, u =
|
|
3982
|
+
} else if (wa(e)) {
|
|
3983
|
+
let e = s / 24 * .9, n = R.outerBox / e, a = l`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`, o = l`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`, u = ja[d](a, o);
|
|
3979
3984
|
f.push(l` <g transform="translate(${r - 12 * e},${i + (s - 24 * e) / 2}) scale(${e})">${u}\n </g>`), f.push(" " + y(c, r, i + s + 14, t.nodeLabel, p));
|
|
3980
3985
|
} else {
|
|
3981
3986
|
let e = r - a / 2, n = l`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}"`, o = r, u = i + s / 2;
|
|
@@ -3987,8 +3992,8 @@ function ja(e, t) {
|
|
|
3987
3992
|
}
|
|
3988
3993
|
return f.push("</g>"), f.join("\n");
|
|
3989
3994
|
}
|
|
3990
|
-
var
|
|
3991
|
-
function
|
|
3995
|
+
var Na = 30, Pa = 20, Fa = 8, Ia = 10, La = 18, Ra = 3, za = 2, Ba = 3;
|
|
3996
|
+
function Va(e, t) {
|
|
3992
3997
|
let n = [], r = (e) => p(e, t.edgeLabel, L.edgeLabel), i = (e, t, i) => {
|
|
3993
3998
|
let a = r(e);
|
|
3994
3999
|
n.push({
|
|
@@ -4006,64 +4011,64 @@ function Ba(e, t) {
|
|
|
4006
4011
|
y1: i + a.height / 2
|
|
4007
4012
|
});
|
|
4008
4013
|
};
|
|
4009
|
-
for (let t of e.messages) t.label && (t.isSelf ? a(t.label, t.x1 +
|
|
4014
|
+
for (let t of e.messages) t.label && (t.isSelf ? a(t.label, t.x1 + Na + Fa, t.y + Pa / 2) : i(t.label, (t.x1 + t.x2) / 2, t.y - Ia));
|
|
4010
4015
|
for (let r of e.blocks) {
|
|
4011
4016
|
let e = I(`${r.type}${r.label ? ` [${r.label}]` : ""}`.split("\n")[0] ?? "", t.edgeLabel, L.groupHeader) + 16;
|
|
4012
4017
|
n.push({
|
|
4013
4018
|
x0: r.x,
|
|
4014
4019
|
x1: r.x + e,
|
|
4015
4020
|
y0: r.y,
|
|
4016
|
-
y1: r.y +
|
|
4021
|
+
y1: r.y + La
|
|
4017
4022
|
});
|
|
4018
4023
|
for (let e of r.dividers) e.label && a(`[${e.label}]`, r.x + 8, e.y + 14);
|
|
4019
4024
|
}
|
|
4020
4025
|
return n;
|
|
4021
4026
|
}
|
|
4022
|
-
function Va(e, t) {
|
|
4023
|
-
let n = t.filter((t) => e.x > t.x0 - La && e.x < t.x1 + La && t.y1 + Ra > e.topY && t.y0 - Ra < e.bottomY).map((e) => [e.y0 - Ra, e.y1 + Ra]).sort((e, t) => e[0] - t[0]), r = [], i = e.topY;
|
|
4024
|
-
for (let [e, t] of n) e - i >= za && r.push([i, e]), i = Math.max(i, t);
|
|
4025
|
-
return e.bottomY - i >= za && r.push([i, e.bottomY]), r.length > 0 ? r : [[e.topY, e.bottomY]];
|
|
4026
|
-
}
|
|
4027
4027
|
function Ha(e, t) {
|
|
4028
|
-
let n =
|
|
4028
|
+
let n = t.filter((t) => e.x > t.x0 - Ra && e.x < t.x1 + Ra && t.y1 + za > e.topY && t.y0 - za < e.bottomY).map((e) => [e.y0 - za, e.y1 + za]).sort((e, t) => e[0] - t[0]), r = [], i = e.topY;
|
|
4029
|
+
for (let [e, t] of n) e - i >= Ba && r.push([i, e]), i = Math.max(i, t);
|
|
4030
|
+
return e.bottomY - i >= Ba && r.push([i, e.bottomY]), r.length > 0 ? r : [[e.topY, e.bottomY]];
|
|
4031
|
+
}
|
|
4032
|
+
function Ua(e, t) {
|
|
4033
|
+
let n = Ha(e, t).map(([t, n]) => l`<line class="lifeline" data-actor="${o(e.actorId)}" ` + l`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" ` + "stroke=\"var(--_line)\" stroke-width=\"0.75\" stroke-dasharray=\"6 4\" />").join("\n");
|
|
4029
4034
|
if (!e.destroyed) return n;
|
|
4030
|
-
let { x: r, bottomY: i } = e, a =
|
|
4035
|
+
let { x: r, bottomY: i } = e, a = Wa;
|
|
4031
4036
|
return n + l`\n<path class="destroy" data-actor="${o(e.actorId)}" ` + l`d="M${r - a} ${i - a} L${r + a} ${i + a} M${r + a} ${i - a} L${r - a} ${i + a}" ` + l`fill="none" stroke="var(--_line)" stroke-width="${R.outerBox}" stroke-linecap="round" />`;
|
|
4032
4037
|
}
|
|
4033
|
-
var
|
|
4034
|
-
function
|
|
4038
|
+
var Wa = 8;
|
|
4039
|
+
function Ga(e) {
|
|
4035
4040
|
return l`<rect class="activation" data-actor="${o(e.actorId)}" ` + l`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY - e.topY}" ` + l`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`;
|
|
4036
4041
|
}
|
|
4037
|
-
function
|
|
4042
|
+
function Ka(e, t) {
|
|
4038
4043
|
let n = [], r = e.lineStyle === "dashed" ? " stroke-dasharray=\"6 4\"" : "", i = e.arrowHead === "filled" ? "seq-arrow" : "seq-arrow-open", a = e.bidirectional ? l` marker-start="url(#${i})"` : "";
|
|
4039
4044
|
if (n.push(l`<g class="message" data-from="${o(e.from)}" data-to="${o(e.to)}" ` + l`data-label="${o(e.label)}" data-line-style="${e.lineStyle}" ` + l`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`), e.isSelf) {
|
|
4040
|
-
let o =
|
|
4045
|
+
let o = Na, s = Pa, c = Fa;
|
|
4041
4046
|
n.push(l` <polyline points="${e.x1},${e.y} ${e.x1 + o},${e.y} ${e.x1 + o},${e.y + s} ${e.x2},${e.y + s}" ` + l`fill="none" stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`), n.push(" " + y(e.label, e.x1 + o + c, e.y + s / 2, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
4042
4047
|
} else {
|
|
4043
4048
|
n.push(l` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" ` + l`stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`);
|
|
4044
4049
|
let o = (e.x1 + e.x2) / 2;
|
|
4045
|
-
n.push(" " + y(e.label, o, e.y -
|
|
4050
|
+
n.push(" " + y(e.label, o, e.y - Ia, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
4046
4051
|
}
|
|
4047
|
-
return e.seqNumber !== void 0 && n.push(" " +
|
|
4052
|
+
return e.seqNumber !== void 0 && n.push(" " + qa(e, t)), n.push("</g>"), n.join("\n");
|
|
4048
4053
|
}
|
|
4049
|
-
function
|
|
4054
|
+
function qa(e, t) {
|
|
4050
4055
|
let n = Math.max(t.edgeLabel - 2, 8), r = e.bidirectional ? e.x1 + Math.sign(e.x2 - e.x1) * (8 + B.width) : e.x1;
|
|
4051
4056
|
return "<g class=\"seq-number\">" + l`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${R.innerBox}" />` + y(String(e.seqNumber), r, e.y, n, l`font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`) + "</g>";
|
|
4052
4057
|
}
|
|
4053
|
-
var
|
|
4054
|
-
function Ja(e, t) {
|
|
4055
|
-
let n = e.label ? l` data-label="${o(e.label)}"` : "", r = e.color === void 0 ? "" : l` data-color="${o(e.color)}"`, i = e.color === void 0 ? "none" : l`color-mix(in srgb, ${o(e.color)} ${qa}%, var(--bg))`, a = [l`<g class="participant-box"${n}${r}>`, l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" ` + l`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];
|
|
4056
|
-
return e.label && a.push(" " + y(e.label, e.x + e.width / 2, e.y + ba(t.edgeLabel) / 2, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)), a.push("</g>"), a.join("\n");
|
|
4057
|
-
}
|
|
4058
|
+
var Ja = 35;
|
|
4058
4059
|
function Ya(e, t) {
|
|
4060
|
+
let n = e.label ? l` data-label="${o(e.label)}"` : "", r = e.color === void 0 ? "" : l` data-color="${o(e.color)}"`, i = e.color === void 0 ? "none" : l`color-mix(in srgb, ${o(e.color)} ${Ja}%, var(--bg))`, a = [l`<g class="participant-box"${n}${r}>`, l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" ` + l`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];
|
|
4061
|
+
return e.label && a.push(" " + y(e.label, e.x + e.width / 2, e.y + xa(t.edgeLabel) / 2, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)), a.push("</g>"), a.join("\n");
|
|
4062
|
+
}
|
|
4063
|
+
function Xa(e, t) {
|
|
4059
4064
|
let n = [], r = e.label ? l` data-label="${o(e.label)}"` : "";
|
|
4060
4065
|
n.push(l`<g class="block" data-type="${o(e.type)}"${r}>`), n.push(l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" ` + l`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`);
|
|
4061
|
-
let i = l`${e.type}${e.label ? l` [${e.label}]` : ""}`, a = i.split("\n")[0], s = I(a, t.edgeLabel, L.groupHeader) + 16, c =
|
|
4066
|
+
let i = l`${e.type}${e.label ? l` [${e.label}]` : ""}`, a = i.split("\n")[0], s = I(a, t.edgeLabel, L.groupHeader) + 16, c = La;
|
|
4062
4067
|
n.push(l` <rect x="${e.x}" y="${e.y}" width="${s}" height="${c}" ` + l`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`), n.push(" " + y(i, e.x + 6, e.y + c / 2, t.edgeLabel, l`font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));
|
|
4063
4068
|
for (let r of e.dividers) n.push(l` <line x1="${e.x}" y1="${r.y}" x2="${e.x + e.width}" y2="${r.y}" ` + "stroke=\"var(--_line)\" stroke-width=\"0.75\" stroke-dasharray=\"6 4\" />"), r.label && n.push(" " + y(l`[${r.label}]`, e.x + 8, r.y + 14, t.edgeLabel, l`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));
|
|
4064
4069
|
return n.push("</g>"), n.join("\n");
|
|
4065
4070
|
}
|
|
4066
|
-
function
|
|
4071
|
+
function Za(e, t) {
|
|
4067
4072
|
let { x: n, y: r, width: i, height: a } = e, s = e.actors && e.actors.length > 0 ? l` data-actors="${e.actors.map(o).join(",")}"` : "", c = e.position ? l` data-position="${o(e.position)}"` : "", u = [
|
|
4068
4073
|
l`${n},${r}`,
|
|
4069
4074
|
l`${n + i - 6},${r}`,
|
|
@@ -4102,23 +4107,23 @@ var K = {
|
|
|
4102
4107
|
legendGap: 6,
|
|
4103
4108
|
legendItemGap: 16
|
|
4104
4109
|
};
|
|
4105
|
-
function
|
|
4106
|
-
return e.horizontal ?
|
|
4110
|
+
function Qa(e, t = {}) {
|
|
4111
|
+
return e.horizontal ? eo(e) : $a(e);
|
|
4107
4112
|
}
|
|
4108
|
-
function
|
|
4113
|
+
function $a(e) {
|
|
4109
4114
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
4110
4115
|
if (!a)
|
|
4111
4116
|
/* v8 ignore next */
|
|
4112
4117
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
4113
|
-
let o = _(a.min, a.max), s =
|
|
4118
|
+
let o = _(a.min, a.max), s = co(o), c = Math.max(...s.map((e) => I(e, K.axisLabelFontSize, K.axisLabelFontWeight)), K.yLabelWidth), l = K.padding + (t ? K.titleHeight : 0) + (i ? K.legendHeight : 0), u = K.padding + K.xLabelHeight + (n ? K.axisTitlePad : 0), d = K.padding + c + K.yLabelGap + (r ? K.axisTitlePad : 0), f = K.padding, p = K.plotWidth, m = K.plotHeight, h = d + p + f, g = l + m + u, v = {
|
|
4114
4119
|
x: d,
|
|
4115
4120
|
y: l,
|
|
4116
4121
|
width: p,
|
|
4117
4122
|
height: m
|
|
4118
|
-
}, y =
|
|
4123
|
+
}, y = to(e), b = (e) => d + (e + .5) * (p / y), x = p / y, S = (e) => {
|
|
4119
4124
|
let t = (e - a.min) / (a.max - a.min || 1);
|
|
4120
4125
|
return l + m - t * m;
|
|
4121
|
-
}, C =
|
|
4126
|
+
}, C = ao(e, b, l + m, x), w = o.map((e, t) => ({
|
|
4122
4127
|
label: s[t],
|
|
4123
4128
|
x: d,
|
|
4124
4129
|
y: S(e),
|
|
@@ -4132,7 +4137,7 @@ function Qa(e) {
|
|
|
4132
4137
|
y1: S(e),
|
|
4133
4138
|
x2: d + p,
|
|
4134
4139
|
y2: S(e)
|
|
4135
|
-
})), E =
|
|
4140
|
+
})), E = no(e, y), D = e.series.map((e, t) => t), O = oo(e, b, S, x, a.min, E, D), k = so(e, b, S, E, D), A = K.padding + (t ? K.titleHeight : 0) + K.legendHeight / 2, ee = i ? uo(e, h / 2, A, D) : [], j = {
|
|
4136
4141
|
x1: d,
|
|
4137
4142
|
y1: l + m,
|
|
4138
4143
|
x2: d + p,
|
|
@@ -4177,12 +4182,12 @@ function Qa(e) {
|
|
|
4177
4182
|
legend: ee
|
|
4178
4183
|
};
|
|
4179
4184
|
}
|
|
4180
|
-
function
|
|
4185
|
+
function eo(e) {
|
|
4181
4186
|
let t = !!e.title, n = !!e.xAxis.title, r = !!e.yAxis.title, i = e.series.length > 1, a = e.yAxis.range;
|
|
4182
4187
|
if (!a)
|
|
4183
4188
|
/* v8 ignore next */
|
|
4184
4189
|
throw Error("XY chart: y-axis range was not set by the parser");
|
|
4185
|
-
let o = _(a.min, a.max), s =
|
|
4190
|
+
let o = _(a.min, a.max), s = co(o), c = to(e), l = no(e, c), u = Math.max(...l.map((e) => I(e, K.axisLabelFontSize, K.axisLabelFontWeight)), 40), d = K.padding + (t ? K.titleHeight : 0) + (i ? K.legendHeight : 0), f = K.padding + K.xLabelHeight + (r ? K.axisTitlePad : 0), p = K.padding + u + K.yLabelGap + (n ? K.axisTitlePad : 0), m = K.padding, h = K.plotWidth, g = K.plotHeight, v = p + h + m, y = d + g + f, b = {
|
|
4186
4191
|
x: p,
|
|
4187
4192
|
y: d,
|
|
4188
4193
|
width: h,
|
|
@@ -4298,28 +4303,28 @@ function $a(e) {
|
|
|
4298
4303
|
bars: k,
|
|
4299
4304
|
lines: A,
|
|
4300
4305
|
gridLines: E,
|
|
4301
|
-
legend: i ?
|
|
4306
|
+
legend: i ? uo(e, v / 2, F, D) : []
|
|
4302
4307
|
};
|
|
4303
4308
|
}
|
|
4304
|
-
function
|
|
4309
|
+
function to(e) {
|
|
4305
4310
|
if (e.xAxis.categories) return e.xAxis.categories.length;
|
|
4306
4311
|
for (let t of e.series) if (t.data.length > 0) return t.data.length;
|
|
4307
4312
|
return 1;
|
|
4308
4313
|
}
|
|
4309
|
-
function
|
|
4314
|
+
function no(e, t) {
|
|
4310
4315
|
if (e.xAxis.categories) return e.xAxis.categories;
|
|
4311
4316
|
if (e.xAxis.range) {
|
|
4312
4317
|
let { min: n, max: r } = e.xAxis.range, i = t > 1 ? (r - n) / (t - 1) : 0;
|
|
4313
|
-
return Array.from({ length: t }, (e, t) =>
|
|
4318
|
+
return Array.from({ length: t }, (e, t) => lo(n + i * t));
|
|
4314
4319
|
}
|
|
4315
4320
|
return Array.from({ length: t }, (e, t) => String(t + 1));
|
|
4316
4321
|
}
|
|
4317
|
-
var
|
|
4318
|
-
function
|
|
4322
|
+
var ro = 8;
|
|
4323
|
+
function io(e, t) {
|
|
4319
4324
|
let n = e.map((e) => I(e, K.axisLabelFontSize, K.axisLabelFontWeight));
|
|
4320
4325
|
for (let r = 1; r < e.length; r++) {
|
|
4321
4326
|
let i = !0;
|
|
4322
|
-
for (let a = 0; a + r < e.length; a += r) if (r * t - (n[a] + n[a + r]) / 2 <
|
|
4327
|
+
for (let a = 0; a + r < e.length; a += r) if (r * t - (n[a] + n[a + r]) / 2 < ro) {
|
|
4323
4328
|
i = !1;
|
|
4324
4329
|
break;
|
|
4325
4330
|
}
|
|
@@ -4327,8 +4332,8 @@ function ro(e, t) {
|
|
|
4327
4332
|
}
|
|
4328
4333
|
return Math.max(1, e.length);
|
|
4329
4334
|
}
|
|
4330
|
-
function
|
|
4331
|
-
let i =
|
|
4335
|
+
function ao(e, t, n, r) {
|
|
4336
|
+
let i = no(e, to(e)), a = io(i, r);
|
|
4332
4337
|
return i.map((e, r) => ({
|
|
4333
4338
|
label: r % a === 0 ? e : "",
|
|
4334
4339
|
x: t(r),
|
|
@@ -4340,7 +4345,7 @@ function io(e, t, n, r) {
|
|
|
4340
4345
|
textAnchor: "middle"
|
|
4341
4346
|
}));
|
|
4342
4347
|
}
|
|
4343
|
-
function
|
|
4348
|
+
function oo(e, t, n, r, i, a, o) {
|
|
4344
4349
|
let s = e.series.filter((e) => e.type === "bar").length;
|
|
4345
4350
|
if (s === 0) return [];
|
|
4346
4351
|
let c = r * (1 - K.barPadRatio), l = s > 1 ? (c - (s - 1) * K.barGroupGap) / s : c, u = Math.min(l, K.maxBarWidth), d = s > 1 ? u * s + K.barGroupGap * (s - 1) : u, f = [], p = 0, m = 0;
|
|
@@ -4366,7 +4371,7 @@ function ao(e, t, n, r, i, a, o) {
|
|
|
4366
4371
|
}
|
|
4367
4372
|
return f;
|
|
4368
4373
|
}
|
|
4369
|
-
function
|
|
4374
|
+
function so(e, t, n, r, i) {
|
|
4370
4375
|
let a = [], o = 0, s = 0;
|
|
4371
4376
|
for (let c of e.series) {
|
|
4372
4377
|
if (c.type !== "line") {
|
|
@@ -4387,14 +4392,14 @@ function oo(e, t, n, r, i) {
|
|
|
4387
4392
|
}
|
|
4388
4393
|
return a;
|
|
4389
4394
|
}
|
|
4390
|
-
function
|
|
4395
|
+
function co(e) {
|
|
4391
4396
|
let t = e.length > 1 ? Math.abs(e[1] - e[0]) : 0, n = t > 0 && t < 1 ? Math.ceil(-Math.log10(t) - 1e-9) : 0;
|
|
4392
4397
|
return e.map((e) => String(Number.isInteger(e) && n === 0 ? e : Number(e.toFixed(n))));
|
|
4393
4398
|
}
|
|
4394
|
-
function
|
|
4399
|
+
function lo(e) {
|
|
4395
4400
|
return Number.isInteger(e) ? String(e) : e.toFixed(+(Math.abs(e) < 10));
|
|
4396
4401
|
}
|
|
4397
|
-
function
|
|
4402
|
+
function uo(e, t, n, r) {
|
|
4398
4403
|
let i = [], a = 0, o = 0;
|
|
4399
4404
|
for (let t = 0; t < e.series.length; t++) {
|
|
4400
4405
|
let s = e.series[t], c = s.type === "bar" ? `Bar ${a + 1}` : `Line ${o + 1}`;
|
|
@@ -4438,24 +4443,24 @@ var q = {
|
|
|
4438
4443
|
minY: 4,
|
|
4439
4444
|
pointerSize: 6
|
|
4440
4445
|
};
|
|
4441
|
-
function
|
|
4442
|
-
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f =
|
|
4446
|
+
function fo(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
4447
|
+
let u = [], d = Math.max(0, ...e.bars.map((e) => e.colorIndex), ...e.lines.map((e) => e.colorIndex)), f = hi(O(e.width, e.height, n, i, s, c, void 0, l.styleAttribute, l.description).replace("<svg ", `<svg data-xychart-colors="${d}" `), o);
|
|
4443
4448
|
u.push(f), u.push(t(r, !1, l.nonce));
|
|
4444
|
-
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: g } =
|
|
4449
|
+
let p = Math.max(...e.lines.map((e) => e.points.length), 0), m = p > 0 && p <= 12, { style: h, defs: g } = po(e, a, m, n.accent, n.bg, l.nonce);
|
|
4445
4450
|
u.push(h), g && u.push(g);
|
|
4446
4451
|
let { plotArea: _ } = e, v = e.xAxis.ticks.map((e) => e.x), y = e.horizontal ? e.yAxis.ticks.map((e) => e.y) : e.gridLines.map((e) => e.y1), b = v.length > 1 ? Math.abs(v[1] - v[0]) : _.width / 6, x = y.length > 1 ? Math.abs(y[1] - y[0]) : _.height / 6, S = b / Math.max(1, Math.round(b / 20)), C = x / Math.max(1, Math.round(x / 20)), w = v[0] ?? _.x, T = y[0] ?? _.y, E = w - Math.ceil((w - _.x) / S) * S, D = T - Math.ceil((T - _.y) / C) * C;
|
|
4447
4452
|
for (let e = D; e <= _.y + _.height + .5; e += C) for (let t = E; t <= _.x + _.width + .5; t += S) u.push(`<circle cx="${Y(t)}" cy="${Y(e)}" r="1.5" class="xychart-grid"/>`);
|
|
4448
4453
|
let k = [];
|
|
4449
4454
|
for (let t of e.bars) {
|
|
4450
|
-
let n = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, r = e.horizontal ?
|
|
4455
|
+
let n = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, r = e.horizontal ? ho(t.x, t.y, t.width, t.height, q.barRadius) : mo(t.x, t.y, t.width, t.height, q.barRadius);
|
|
4451
4456
|
if (u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`), a) {
|
|
4452
|
-
let e =
|
|
4457
|
+
let e = yo(t.value), n = t.label ? `${t.label}: ${e}` : e, r = vo(t.x + t.width / 2, t.y, e);
|
|
4453
4458
|
k.push(`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(n)}</title>` + r + "</g>");
|
|
4454
4459
|
}
|
|
4455
4460
|
}
|
|
4456
4461
|
for (let t of e.lines) {
|
|
4457
4462
|
if (t.points.length === 0) continue;
|
|
4458
|
-
let e =
|
|
4463
|
+
let e = go(t.points);
|
|
4459
4464
|
u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`), u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`);
|
|
4460
4465
|
}
|
|
4461
4466
|
let A = [];
|
|
@@ -4478,16 +4483,16 @@ function uo(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
4478
4483
|
let n = e[0].x, r = e[0].label || "";
|
|
4479
4484
|
if (a && e.length > 1) {
|
|
4480
4485
|
let i = Math.min(...e.map((e) => e.y)), a = Math.max(...e.map((e) => e.y)), o = q.dotRadius * 3, s = `<rect x="${Y(n - o)}" y="${Y(i - o)}" width="${Y(o * 2)}" height="${Y(a - i + o * 2)}" fill="transparent" class="xychart-hit"/>`, c = e.map((e) => ({
|
|
4481
|
-
text:
|
|
4486
|
+
text: yo(e.value),
|
|
4482
4487
|
legendLabel: t.get(e.seriesIndex) || `Line ${e.seriesIndex + 1}`
|
|
4483
|
-
})), l =
|
|
4488
|
+
})), l = _o(n, i - q.dotRadius, r, c), u = c.map((e) => e.text), d = r ? `${r}: ${u.join(" · ")}` : u.join(" · "), f = `<g class="xychart-dot-group">${s}`;
|
|
4484
4489
|
for (let t of e) {
|
|
4485
4490
|
let e = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`;
|
|
4486
4491
|
f += `<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`;
|
|
4487
4492
|
}
|
|
4488
4493
|
f += `<title>${X(d)}</title>${l}</g>`, A.push(f);
|
|
4489
4494
|
} else if (a) {
|
|
4490
|
-
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, i =
|
|
4495
|
+
let t = e[0], r = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`, i = yo(t.value), a = t.label ? `${t.label}: ${i}` : i, o = vo(n, t.y - q.dotRadius, i), s = m ? `<circle cx="${Y(n)}" cy="${Y(t.y)}" r="${q.dotRadius * 3}" fill="transparent" class="xychart-hit"/>` : "";
|
|
4491
4496
|
A.push(`<g class="xychart-dot-group">${s}<circle cx="${Y(t.x)}" cy="${Y(t.y)}" r="${q.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${X(a)}</title>${o}</g>`);
|
|
4492
4497
|
} else for (let t of e) {
|
|
4493
4498
|
let e = ` data-value="${t.value}"${t.label ? ` data-label="${X(t.label)}"` : ""}`;
|
|
@@ -4518,7 +4523,7 @@ function uo(e, n, r = "Inter", i = !1, a = !1, o, s, c, l = {}) {
|
|
|
4518
4523
|
for (let e of A) u.push(e);
|
|
4519
4524
|
return u.push("</svg>"), u.join("\n");
|
|
4520
4525
|
}
|
|
4521
|
-
function
|
|
4526
|
+
function po(e, t, n, r, i, a) {
|
|
4522
4527
|
let o = r ?? j, s = /* @__PURE__ */ new Set();
|
|
4523
4528
|
for (let t of e.bars) s.add(t.colorIndex);
|
|
4524
4529
|
for (let t of e.lines) s.add(t.colorIndex);
|
|
@@ -4554,7 +4559,7 @@ ${l.join("\n")}${u}
|
|
|
4554
4559
|
defs: ""
|
|
4555
4560
|
};
|
|
4556
4561
|
}
|
|
4557
|
-
function
|
|
4562
|
+
function mo(e, t, n, r, i) {
|
|
4558
4563
|
let a = Math.min(i, n / 2, r / 2);
|
|
4559
4564
|
return a <= 0 ? `M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z` : [
|
|
4560
4565
|
`M${Y(e)},${Y(t + a)}`,
|
|
@@ -4568,7 +4573,7 @@ function po(e, t, n, r, i) {
|
|
|
4568
4573
|
"Z"
|
|
4569
4574
|
].join(" ");
|
|
4570
4575
|
}
|
|
4571
|
-
function
|
|
4576
|
+
function ho(e, t, n, r, i) {
|
|
4572
4577
|
let a = Math.min(i, n / 2, r / 2);
|
|
4573
4578
|
return a <= 0 ? `M${Y(e)},${Y(t)} h${Y(n)} v${Y(r)} h${Y(-n)} Z` : [
|
|
4574
4579
|
`M${Y(e + a)},${Y(t)}`,
|
|
@@ -4583,7 +4588,7 @@ function mo(e, t, n, r, i) {
|
|
|
4583
4588
|
"Z"
|
|
4584
4589
|
].join(" ");
|
|
4585
4590
|
}
|
|
4586
|
-
function
|
|
4591
|
+
function go(e) {
|
|
4587
4592
|
if (e.length === 0) return "";
|
|
4588
4593
|
if (e.length === 1) return `M${Y(e[0].x)},${Y(e[0].y)}`;
|
|
4589
4594
|
if (e.length === 2) return `M${Y(e[0].x)},${Y(e[0].y)} L${Y(e[1].x)},${Y(e[1].y)}`;
|
|
@@ -4608,7 +4613,7 @@ function ho(e) {
|
|
|
4608
4613
|
}
|
|
4609
4614
|
return o;
|
|
4610
4615
|
}
|
|
4611
|
-
function
|
|
4616
|
+
function _o(e, t, n, r) {
|
|
4612
4617
|
let i = I(n, J.fontSize, 600), a = Math.max(...r.map((e) => {
|
|
4613
4618
|
let t = I(e.legendLabel, J.fontSize, J.fontWeight), n = I(e.text, J.fontSize, J.fontWeight);
|
|
4614
4619
|
return t + 10 + n;
|
|
@@ -4620,11 +4625,11 @@ function go(e, t, n, r) {
|
|
|
4620
4625
|
for (let e of r) h += 20, m += `<text x="${Y(g)}" y="${Y(h)}" text-anchor="start" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.legendLabel)}</text>`, m += `<text x="${Y(_)}" y="${Y(h)}" text-anchor="end" font-size="${J.fontSize}" font-weight="${J.fontWeight}" dy="${z}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;
|
|
4621
4626
|
return m;
|
|
4622
4627
|
}
|
|
4623
|
-
function
|
|
4628
|
+
function vo(e, t, n) {
|
|
4624
4629
|
let r = I(n, J.fontSize, J.fontWeight) + J.padX * 2, i = J.height, a = Math.max(J.minY, t - J.offsetY - i - J.pointerSize), o = e - r / 2, s = e, c = a + i / 2, l = e, u = a + i, d = J.pointerSize, f = `<polygon points="${Y(l - d)},${Y(u)} ${Y(l + d)},${Y(u)} ${Y(l)},${Y(u + d)}" class="xychart-tip xychart-tip-ptr"/>`;
|
|
4625
4630
|
return `<rect x="${Y(o)}" y="${Y(a)}" width="${Y(r)}" height="${i}" rx="${J.rx}" class="xychart-tip xychart-tip-bg"/>` + f + `<text x="${Y(s)}" y="${Y(c)}" text-anchor="middle" dy="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`;
|
|
4626
4631
|
}
|
|
4627
|
-
function
|
|
4632
|
+
function yo(e) {
|
|
4628
4633
|
return Number.isInteger(e) ? e.toLocaleString("en-US") : e.toFixed(+(Math.abs(e) < 10));
|
|
4629
4634
|
}
|
|
4630
4635
|
function Y(e) {
|
|
@@ -4649,34 +4654,34 @@ var Z = {
|
|
|
4649
4654
|
paletteSize: 12,
|
|
4650
4655
|
highlightScale: 1.05,
|
|
4651
4656
|
minPercent: 1
|
|
4652
|
-
},
|
|
4657
|
+
}, bo = Math.PI * 2;
|
|
4653
4658
|
function Q(e) {
|
|
4654
4659
|
return String(Math.round(e * 100) / 100);
|
|
4655
4660
|
}
|
|
4656
|
-
function
|
|
4661
|
+
function xo(e, t, n, r) {
|
|
4657
4662
|
return {
|
|
4658
4663
|
x: e + n * Math.sin(r),
|
|
4659
4664
|
y: t - n * Math.cos(r)
|
|
4660
4665
|
};
|
|
4661
4666
|
}
|
|
4662
|
-
function
|
|
4663
|
-
if (i - r >=
|
|
4667
|
+
function So(e, t, n, r, i, a = 0) {
|
|
4668
|
+
if (i - r >= bo - 1e-9) {
|
|
4664
4669
|
let r = (n, r) => `M${Q(e)},${Q(t - n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t + n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t - n)}`;
|
|
4665
4670
|
return r(n, 1) + (a > 0 ? r(a, 0) : "") + "Z";
|
|
4666
4671
|
}
|
|
4667
|
-
let o =
|
|
4672
|
+
let o = xo(e, t, n, r), s = xo(e, t, n, i), c = +(i - r > Math.PI), l = `M${Q(o.x)},${Q(o.y)}A${Q(n)},${Q(n)},0,${c},1,${Q(s.x)},${Q(s.y)}`;
|
|
4668
4673
|
if (a <= 0) return `${l}L${Q(e)},${Q(t)}Z`;
|
|
4669
|
-
let u =
|
|
4674
|
+
let u = xo(e, t, a, i), d = xo(e, t, a, r);
|
|
4670
4675
|
return `${l}L${Q(u.x)},${Q(u.y)}A${Q(a)},${Q(a)},0,${c},0,${Q(d.x)},${Q(d.y)}Z`;
|
|
4671
4676
|
}
|
|
4672
|
-
function
|
|
4677
|
+
function Co(e, t, n) {
|
|
4673
4678
|
return n ? `${e} [${String(t)}]` : e;
|
|
4674
4679
|
}
|
|
4675
|
-
function
|
|
4680
|
+
function wo(e, t = {}) {
|
|
4676
4681
|
let n = Z.height, r = n, i = Math.min(r, n) / 2 - Z.margin, a = r / 2, o = n / 2, s = e.slices.reduce((e, t) => e + t.value, 0), c = e.slices.map((e, t) => ({
|
|
4677
4682
|
slice: e,
|
|
4678
4683
|
colorIndex: t % Z.paletteSize
|
|
4679
|
-
})).filter(({ slice: e }) => e.value / s * 100 >= Z.minPercent), l = c.reduce((e, t) => e + t.slice.value, 0), u = Z.legendRectSize + Z.legendSpacing, d = e.slices.length, f = d > 0 ? e.legendPosition ?? "right" : "right", p = e.slices.map((t) =>
|
|
4684
|
+
})).filter(({ slice: e }) => e.value / s * 100 >= Z.minPercent), l = c.reduce((e, t) => e + t.slice.value, 0), u = Z.legendRectSize + Z.legendSpacing, d = e.slices.length, f = d > 0 ? e.legendPosition ?? "right" : "right", p = e.slices.map((t) => Co(t.label, t.value, e.showData)), m = Math.max(0, ...p.map((e) => I(e, Z.legendFontSize, Z.fontWeight))), h = Z.legendRectSize + Z.legendSpacing, g = u * d, _ = f === "left" ? m + h : 0, v = f === "top" ? g + u : 0, y = a - m / 2 - h, b = o - g / 2, x = {
|
|
4680
4685
|
right: {
|
|
4681
4686
|
x: a + 12 * Z.legendRectSize,
|
|
4682
4687
|
y: b
|
|
@@ -4699,16 +4704,16 @@ function Co(e, t = {}) {
|
|
|
4699
4704
|
}
|
|
4700
4705
|
}[f], S = h + m, C = d > 0 && (f === "left" || f === "right") ? r + Z.margin + S : r + Z.margin, w = f === "top" || f === "bottom" ? n + g : n, T = e.title ?? "", E = T.length > 0 ? I(T, Z.titleFontSize, Z.fontWeight) : 0, D = a - E / 2, O = a + E / 2, k = x.x, A = x.x + S, ee = x.y, j = x.y + g - u + Z.legendRectSize, M = Math.min(0, D, d > 0 ? k : 0), N = Math.max(C, O, d > 0 ? A : 0), P = d > 0 ? Math.min(0, ee) : 0, te = d > 0 ? Math.max(w, j) : n, ne = -M, F = -P, re = a + _ + ne, ie = o + v + F, ae = [], oe = 0, se = e.donutHole ?? 0, ce = se > 0 && se <= .9 ? se * i : 0, le = i * (e.textPosition ?? Z.textPosition);
|
|
4701
4706
|
for (let { slice: t, colorIndex: n } of c) {
|
|
4702
|
-
let r = oe, a = oe + t.value / l *
|
|
4707
|
+
let r = oe, a = oe + t.value / l * bo;
|
|
4703
4708
|
oe = a;
|
|
4704
|
-
let o =
|
|
4709
|
+
let o = xo(re, ie, le, (r + a) / 2), c = e.highlightSlice !== void 0 && e.highlightSlice !== "hover" && e.highlightSlice !== "" && e.highlightSlice === t.label, u = c ? Z.highlightScale : 1;
|
|
4705
4710
|
ae.push({
|
|
4706
4711
|
label: t.label,
|
|
4707
4712
|
value: t.value,
|
|
4708
4713
|
colorIndex: n,
|
|
4709
4714
|
startAngle: r,
|
|
4710
4715
|
endAngle: a,
|
|
4711
|
-
path:
|
|
4716
|
+
path: So(re, ie, i * u, r, a, ce * u),
|
|
4712
4717
|
percentText: `${(t.value / s * 100).toFixed(0)}%`,
|
|
4713
4718
|
labelX: o.x,
|
|
4714
4719
|
labelY: o.y,
|
|
@@ -4747,17 +4752,17 @@ function Co(e, t = {}) {
|
|
|
4747
4752
|
}
|
|
4748
4753
|
//#endregion
|
|
4749
4754
|
//#region packages/svg-renderer/src/pie/renderer.ts
|
|
4750
|
-
function
|
|
4755
|
+
function To(e) {
|
|
4751
4756
|
return String(Math.round(e * 100) / 100);
|
|
4752
4757
|
}
|
|
4753
|
-
function
|
|
4758
|
+
function Eo(e, t, n) {
|
|
4754
4759
|
return e === 0 ? `var(--accent, ${j})` : F(e, t ?? j, n);
|
|
4755
4760
|
}
|
|
4756
|
-
function
|
|
4761
|
+
function Do(e, t, n) {
|
|
4757
4762
|
let r = /* @__PURE__ */ new Set();
|
|
4758
4763
|
for (let t of e.slices) r.add(t.colorIndex);
|
|
4759
4764
|
for (let t of e.legend) r.add(t.colorIndex);
|
|
4760
|
-
let i = [...r].sort((e, t) => e - t), a = i.map((e) => ` --pie-color-${e}: ${
|
|
4765
|
+
let i = [...r].sort((e, t) => e - t), a = i.map((e) => ` --pie-color-${e}: ${Eo(e, t.accent, t.bg)};`), o = i.map((e) => ` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`), s = e.slices.some((e) => e.highlighted) ? "\n .pie-slice.pie-highlight { opacity: 1; }" : "", c = a.length > 0 ? `\n svg {\n${a.join("\n")}\n }` : "";
|
|
4761
4766
|
return `${E(n)}
|
|
4762
4767
|
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
|
|
4763
4768
|
.pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }${s}
|
|
@@ -4767,18 +4772,18 @@ function Eo(e, t, n) {
|
|
|
4767
4772
|
${o.join("\n")}
|
|
4768
4773
|
</style>`;
|
|
4769
4774
|
}
|
|
4770
|
-
function
|
|
4775
|
+
function Oo(e, n, r = "Inter", i = !1, a, c, l, u = {}) {
|
|
4771
4776
|
let d = [];
|
|
4772
|
-
d.push(
|
|
4777
|
+
d.push(hi(O(e.width, e.height, n, i, c ?? e.accTitle, l, void 0, u.styleAttribute, e.accDescr), a)), d.push(t(r, !1, u.nonce)), d.push(Do(e, n, u.nonce)), d.push(`<circle cx="${To(e.cx)}" cy="${To(e.cy)}" r="${To(e.outerRadius)}" class="pie-outer"/>`);
|
|
4773
4778
|
for (let t of e.slices) d.push(`<path d="${t.path}" class="pie-slice${t.highlighted ? " pie-highlight" : ""} pie-color-${t.colorIndex}" data-label="${o(t.label)}" data-value="${t.value}"/>`);
|
|
4774
|
-
for (let t of e.slices) d.push(`<text x="${
|
|
4775
|
-
e.title && d.push(`<text x="${
|
|
4776
|
-
for (let t of e.legend) d.push(`<g class="pie-legend"><rect x="${
|
|
4779
|
+
for (let t of e.slices) d.push(`<text x="${To(t.labelX)}" y="${To(t.labelY)}" text-anchor="middle" class="pie-slice-label">${s(t.percentText)}</text>`);
|
|
4780
|
+
e.title && d.push(`<text x="${To(e.title.x)}" y="${To(e.title.y)}" text-anchor="middle" class="pie-title">${s(e.title.text)}</text>`);
|
|
4781
|
+
for (let t of e.legend) d.push(`<g class="pie-legend"><rect x="${To(t.x)}" y="${To(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${To(t.textX)}" y="${To(t.textY)}" class="pie-legend-text">${s(t.text)}</text></g>`);
|
|
4777
4782
|
return d.push("</svg>"), d.join("\n");
|
|
4778
4783
|
}
|
|
4779
4784
|
//#endregion
|
|
4780
4785
|
//#region packages/svg-renderer/src/c4/arial-widths.ts
|
|
4781
|
-
var
|
|
4786
|
+
var ko = 2048, Ao = [
|
|
4782
4787
|
569,
|
|
4783
4788
|
569,
|
|
4784
4789
|
727,
|
|
@@ -4874,7 +4879,7 @@ var Oo = 2048, ko = [
|
|
|
4874
4879
|
532,
|
|
4875
4880
|
684,
|
|
4876
4881
|
1196
|
|
4877
|
-
],
|
|
4882
|
+
], jo = [
|
|
4878
4883
|
569,
|
|
4879
4884
|
682,
|
|
4880
4885
|
971,
|
|
@@ -4971,9 +4976,9 @@ var Oo = 2048, ko = [
|
|
|
4971
4976
|
801,
|
|
4972
4977
|
1196
|
|
4973
4978
|
];
|
|
4974
|
-
function
|
|
4979
|
+
function Mo(e, t) {
|
|
4975
4980
|
let n = e.codePointAt(0);
|
|
4976
|
-
if (!(n < 32 || n > 126)) return (t ?
|
|
4981
|
+
if (!(n < 32 || n > 126)) return (t ? jo : Ao)[n - 32] / ko;
|
|
4977
4982
|
}
|
|
4978
4983
|
//#endregion
|
|
4979
4984
|
//#region packages/svg-renderer/src/c4/metrics.ts
|
|
@@ -5012,20 +5017,20 @@ var $ = {
|
|
|
5012
5017
|
personHeadOverlap: .27,
|
|
5013
5018
|
dbTrim: 3.91,
|
|
5014
5019
|
queueExtra: 10
|
|
5015
|
-
},
|
|
5016
|
-
function
|
|
5020
|
+
}, No = $.width - 2 * $.shapePadding;
|
|
5021
|
+
function Po(e, t, n) {
|
|
5017
5022
|
let r = [];
|
|
5018
5023
|
for (let i of e.split("\n")) {
|
|
5019
5024
|
let e = "";
|
|
5020
5025
|
for (let a of i.split(/\s+/).filter(Boolean)) {
|
|
5021
5026
|
let i = e ? `${e} ${a}` : a;
|
|
5022
|
-
e &&
|
|
5027
|
+
e && Bo(i, n, 400) > t ? (r.push(e), e = a) : e = i;
|
|
5023
5028
|
}
|
|
5024
5029
|
r.push(e);
|
|
5025
5030
|
}
|
|
5026
5031
|
return r;
|
|
5027
5032
|
}
|
|
5028
|
-
function
|
|
5033
|
+
function Fo(e, t) {
|
|
5029
5034
|
let n = Math.min(Math.max(e * $.personHeadRatio, $.personHeadMin), $.personHeadMax), r = n * (2 - $.personHeadOverlap), i = t === void 0 ? Infinity : t - r;
|
|
5030
5035
|
return {
|
|
5031
5036
|
rx: Math.min(e * $.personRx, i * $.personRxMaxOfHeight),
|
|
@@ -5033,43 +5038,43 @@ function Po(e, t) {
|
|
|
5033
5038
|
pillTop: r
|
|
5034
5039
|
};
|
|
5035
5040
|
}
|
|
5036
|
-
function
|
|
5037
|
-
return e * $.nameLine + $.typeLine +
|
|
5041
|
+
function Io(e, t) {
|
|
5042
|
+
return e * $.nameLine + $.typeLine + Lo(t);
|
|
5038
5043
|
}
|
|
5039
|
-
function
|
|
5044
|
+
function Lo(e) {
|
|
5040
5045
|
return e === 0 ? 0 : $.descrLine + (e - 1) * $.descrExtraLine;
|
|
5041
5046
|
}
|
|
5042
|
-
function
|
|
5047
|
+
function Ro(e) {
|
|
5043
5048
|
let t = e / 2;
|
|
5044
5049
|
return {
|
|
5045
5050
|
rx: t,
|
|
5046
5051
|
ry: t / (2.5 + e / 50)
|
|
5047
5052
|
};
|
|
5048
5053
|
}
|
|
5049
|
-
function
|
|
5054
|
+
function zo(e) {
|
|
5050
5055
|
let t = e / 2;
|
|
5051
5056
|
return {
|
|
5052
5057
|
rx: t / (2.5 + e / 50),
|
|
5053
5058
|
ry: t
|
|
5054
5059
|
};
|
|
5055
5060
|
}
|
|
5056
|
-
function
|
|
5061
|
+
function Bo(e, t, n) {
|
|
5057
5062
|
let r = 0;
|
|
5058
5063
|
for (let i of e) {
|
|
5059
|
-
let e =
|
|
5064
|
+
let e = Mo(i, n >= 600);
|
|
5060
5065
|
r += e === void 0 ? I(i, t, n) * $.textScale : e * t;
|
|
5061
5066
|
}
|
|
5062
5067
|
return r;
|
|
5063
5068
|
}
|
|
5064
|
-
function
|
|
5065
|
-
let i =
|
|
5069
|
+
function Vo(e, t, n, r) {
|
|
5070
|
+
let i = Io(t, n), a = i + 2 * $.shapePadding, o = Math.max($.width, r + 2 * $.shapePadding);
|
|
5066
5071
|
if (e.kind === "person") return {
|
|
5067
5072
|
width: o,
|
|
5068
|
-
height:
|
|
5073
|
+
height: Fo(o).pillTop + a,
|
|
5069
5074
|
textHeight: i
|
|
5070
5075
|
};
|
|
5071
5076
|
if (e.shape === "db") {
|
|
5072
|
-
let { ry: e } =
|
|
5077
|
+
let { ry: e } = Ro(o);
|
|
5073
5078
|
return {
|
|
5074
5079
|
width: o,
|
|
5075
5080
|
height: a + 2 * e - $.dbTrim,
|
|
@@ -5077,7 +5082,7 @@ function Bo(e, t, n, r) {
|
|
|
5077
5082
|
};
|
|
5078
5083
|
}
|
|
5079
5084
|
if (e.shape === "queue") {
|
|
5080
|
-
let e = i + $.queueExtra, { rx: t } =
|
|
5085
|
+
let e = i + $.queueExtra, { rx: t } = zo(e);
|
|
5081
5086
|
return {
|
|
5082
5087
|
width: o + 3 * t,
|
|
5083
5088
|
height: e,
|
|
@@ -5090,7 +5095,7 @@ function Bo(e, t, n, r) {
|
|
|
5090
5095
|
textHeight: i
|
|
5091
5096
|
};
|
|
5092
5097
|
}
|
|
5093
|
-
function
|
|
5098
|
+
function Ho(e) {
|
|
5094
5099
|
let t = "#ffffff";
|
|
5095
5100
|
if (e.external) switch (e.kind) {
|
|
5096
5101
|
case "person": return {
|
|
@@ -5137,48 +5142,48 @@ function Vo(e) {
|
|
|
5137
5142
|
};
|
|
5138
5143
|
}
|
|
5139
5144
|
}
|
|
5140
|
-
var
|
|
5141
|
-
function
|
|
5145
|
+
var Uo = $.messageSize + 5;
|
|
5146
|
+
function Wo(e) {
|
|
5142
5147
|
return e.labelLines ?? P(e);
|
|
5143
5148
|
}
|
|
5144
|
-
function
|
|
5149
|
+
function Go(e) {
|
|
5145
5150
|
let t = e.labelPosition;
|
|
5146
|
-
return t ?
|
|
5151
|
+
return t ? Wo(e).map((n, r, i) => ({
|
|
5147
5152
|
cx: e.technology !== void 0 && r === i.length - 1 && e.technologyX !== void 0 ? e.technologyX : t.x,
|
|
5148
|
-
cy: t.y + r *
|
|
5149
|
-
w:
|
|
5153
|
+
cy: t.y + r * Uo,
|
|
5154
|
+
w: Bo(n, $.messageSize, 400),
|
|
5150
5155
|
h: $.messageSize
|
|
5151
5156
|
})) : [];
|
|
5152
5157
|
}
|
|
5153
5158
|
//#endregion
|
|
5154
5159
|
//#region packages/svg-renderer/src/c4/layout.ts
|
|
5155
|
-
function
|
|
5160
|
+
function Ko() {
|
|
5156
5161
|
return { next: { cnt: 0 } };
|
|
5157
5162
|
}
|
|
5158
|
-
function
|
|
5163
|
+
function qo(e, t, n, r, i) {
|
|
5159
5164
|
e.next.startx = e.startx = t, e.next.stopx = e.stopx = n, e.next.starty = e.starty = r, e.next.stopy = e.stopy = i;
|
|
5160
5165
|
}
|
|
5161
|
-
function
|
|
5166
|
+
function Jo(e, t, n, r) {
|
|
5162
5167
|
let i = e[t];
|
|
5163
5168
|
e[t] = i === void 0 ? n : r(n, i);
|
|
5164
5169
|
}
|
|
5165
|
-
function
|
|
5170
|
+
function Yo(e, t) {
|
|
5166
5171
|
e.next.cnt += 1;
|
|
5167
5172
|
let n = $.shapeMargin, r = e.next.startx === e.next.stopx ? e.next.stopx + n : e.next.stopx + n * 2, i = r + t.width, a = e.next.starty + n * 2, o = a + t.height;
|
|
5168
|
-
(r >= e.widthLimit || i >= e.widthLimit || e.next.cnt > $.shapeInRow) && (r = e.next.startx + n + $.nextLinePaddingX, a = e.next.stopy + n * 2, e.next.stopx = i = r + t.width, e.next.starty = e.next.stopy, e.next.stopy = o = a + t.height, e.next.cnt = 1), t.x = r, t.y = a,
|
|
5173
|
+
(r >= e.widthLimit || i >= e.widthLimit || e.next.cnt > $.shapeInRow) && (r = e.next.startx + n + $.nextLinePaddingX, a = e.next.stopy + n * 2, e.next.stopx = i = r + t.width, e.next.starty = e.next.stopy, e.next.stopy = o = a + t.height, e.next.cnt = 1), t.x = r, t.y = a, Jo(e, "startx", r, Math.min), Jo(e, "starty", a, Math.min), Jo(e, "stopx", i, Math.max), Jo(e, "stopy", o, Math.max), Jo(e.next, "startx", r, Math.min), Jo(e.next, "starty", a, Math.min), Jo(e.next, "stopx", i, Math.max), Jo(e.next, "stopy", o, Math.max);
|
|
5169
5174
|
}
|
|
5170
|
-
function
|
|
5171
|
-
let t =
|
|
5175
|
+
function Xo(e) {
|
|
5176
|
+
let t = Po(e.label, No, $.nameSize), n = e.description ? Po(e.description, No, $.descrSize) : [], r = Math.max(...t.map((e) => Bo(e, $.nameSize, 700)), Bo(te(e), $.typeSize, 400), ...n.map((e) => Bo(e, $.descrSize, 400)));
|
|
5172
5177
|
return {
|
|
5173
5178
|
el: e,
|
|
5174
5179
|
nameLines: t,
|
|
5175
5180
|
descriptionLines: n,
|
|
5176
5181
|
x: 0,
|
|
5177
5182
|
y: 0,
|
|
5178
|
-
...
|
|
5183
|
+
...Vo(e, t.length, n.length, r)
|
|
5179
5184
|
};
|
|
5180
5185
|
}
|
|
5181
|
-
function
|
|
5186
|
+
function Zo(e) {
|
|
5182
5187
|
let t = /* @__PURE__ */ new Set(), n = new Map(e.elements.map((e) => [e.alias, e])), r = (e) => {
|
|
5183
5188
|
let i = e.elementAliases.flatMap((e) => {
|
|
5184
5189
|
t.add(e);
|
|
@@ -5198,15 +5203,15 @@ function Xo(e) {
|
|
|
5198
5203
|
children: i
|
|
5199
5204
|
};
|
|
5200
5205
|
}
|
|
5201
|
-
function
|
|
5206
|
+
function Qo(e) {
|
|
5202
5207
|
let t = /* @__PURE__ */ new Map(), n = [], r = $.diagramMarginX, i = $.diagramMarginY, a = (e, n) => {
|
|
5203
5208
|
for (let r of n) {
|
|
5204
|
-
let n =
|
|
5205
|
-
t.set(r.alias, n),
|
|
5209
|
+
let n = Xo(r);
|
|
5210
|
+
t.set(r.alias, n), Yo(e, n);
|
|
5206
5211
|
}
|
|
5207
5212
|
e.stopx += $.shapeMargin, e.stopy += $.shapeMargin;
|
|
5208
5213
|
}, o = (e, t, s) => {
|
|
5209
|
-
let c =
|
|
5214
|
+
let c = Ko();
|
|
5210
5215
|
c.widthLimit = e.widthLimit / Math.min($.boundaryInRow, t.length);
|
|
5211
5216
|
for (let [l, u] of t.entries()) {
|
|
5212
5217
|
let t = u.boundary, d = 0, f = d + 8;
|
|
@@ -5216,10 +5221,10 @@ function Zo(e) {
|
|
|
5216
5221
|
let m;
|
|
5217
5222
|
if (t?.description && (m = d + 20, d = m + $.boundaryDescrHeight), t || (d = $.rootHeadingHeight), l === 0 || l % $.boundaryInRow === 0) {
|
|
5218
5223
|
let t = e.startx + $.diagramMarginX, n = e.stopy + $.diagramMarginY + d;
|
|
5219
|
-
|
|
5224
|
+
qo(c, t, t, n, n);
|
|
5220
5225
|
} else {
|
|
5221
5226
|
let e = c.stopx === c.startx ? c.startx : c.stopx + $.diagramMarginX;
|
|
5222
|
-
|
|
5227
|
+
qo(c, e, e, c.starty, c.starty);
|
|
5223
5228
|
}
|
|
5224
5229
|
if (u.elements.length > 0 && a(c, u.elements), u.children.length > 0 && o(c, u.children, s + 1), t) {
|
|
5225
5230
|
let e = c.stopx - c.startx, r = c.stopy - c.starty;
|
|
@@ -5240,15 +5245,15 @@ function Zo(e) {
|
|
|
5240
5245
|
}
|
|
5241
5246
|
e.stopy = Math.max(c.stopy + $.shapeMargin, e.stopy), e.stopx = Math.max(c.stopx + $.shapeMargin, e.stopx), r = Math.max(r, e.stopx), i = Math.max(i, e.stopy);
|
|
5242
5247
|
}
|
|
5243
|
-
}, s =
|
|
5244
|
-
return
|
|
5248
|
+
}, s = Ko();
|
|
5249
|
+
return qo(s, $.diagramMarginX, $.diagramMarginX, $.diagramMarginY, $.diagramMarginY), s.widthLimit = $.screenWidth, o(s, [e], -1), {
|
|
5245
5250
|
elements: t,
|
|
5246
5251
|
boundaries: n,
|
|
5247
5252
|
maxX: r,
|
|
5248
5253
|
maxY: i
|
|
5249
5254
|
};
|
|
5250
5255
|
}
|
|
5251
|
-
function
|
|
5256
|
+
function $o(e, t) {
|
|
5252
5257
|
let n = e.x + e.width / 2, r = e.y + e.height / 2, i = t.x - n, a = t.y - r, o = e.width / 2, s = e.height / 2;
|
|
5253
5258
|
if (i === 0 && a === 0) return {
|
|
5254
5259
|
x: n,
|
|
@@ -5267,8 +5272,8 @@ function Qo(e, t) {
|
|
|
5267
5272
|
y: r + l
|
|
5268
5273
|
};
|
|
5269
5274
|
}
|
|
5270
|
-
function
|
|
5271
|
-
let n =
|
|
5275
|
+
function es(e, t) {
|
|
5276
|
+
let n = Fo(e.width, e.height), r = e.x + e.width / 2, i = e.y + e.height / 2, a = e.width, o = e.height, s = -o / 2 + n.headRadius, c = -o / 2 + n.pillTop, l = n.rx, u = (e, t, n, r, i, a) => Array.from({ length: r }, (o, s) => {
|
|
5272
5277
|
let c = (i + s * (a - i) / (r - 1)) * Math.PI / 180;
|
|
5273
5278
|
return {
|
|
5274
5279
|
x: e - n * Math.cos(c),
|
|
@@ -5281,7 +5286,7 @@ function $o(e, t) {
|
|
|
5281
5286
|
...u(a / 2 - l, o / 2 - l, l, 12, 270, 180),
|
|
5282
5287
|
...u(a / 2 - l, c + l, l, 12, 180, 90)
|
|
5283
5288
|
];
|
|
5284
|
-
return
|
|
5289
|
+
return ns({
|
|
5285
5290
|
x: r,
|
|
5286
5291
|
y: i
|
|
5287
5292
|
}, t, f.map((e) => ({
|
|
@@ -5289,7 +5294,7 @@ function $o(e, t) {
|
|
|
5289
5294
|
y: i + e.y
|
|
5290
5295
|
})));
|
|
5291
5296
|
}
|
|
5292
|
-
function
|
|
5297
|
+
function ts(e, t, n, r) {
|
|
5293
5298
|
let i = t.y - e.y, a = e.x - t.x, o = t.x * e.y - e.x * t.y, s = i * n.x + a * n.y + o, c = i * r.x + a * r.y + o;
|
|
5294
5299
|
if (s !== 0 && c !== 0 && s * c > 0) return;
|
|
5295
5300
|
let l = r.y - n.y, u = n.x - r.x, d = r.x * n.y - n.x * r.y, f = l * e.x + u * e.y + d, p = l * t.x + u * t.y + d;
|
|
@@ -5302,18 +5307,18 @@ function es(e, t, n, r) {
|
|
|
5302
5307
|
y: g < 0 ? (g - h) / m : (g + h) / m
|
|
5303
5308
|
};
|
|
5304
5309
|
}
|
|
5305
|
-
function
|
|
5310
|
+
function ns(e, t, n) {
|
|
5306
5311
|
let r, i = Infinity;
|
|
5307
5312
|
return n.forEach((a, o) => {
|
|
5308
|
-
let s =
|
|
5313
|
+
let s = ts(e, t, a, n[(o + 1) % n.length]);
|
|
5309
5314
|
if (!s) return;
|
|
5310
5315
|
let c = Math.hypot(s.x - t.x, s.y - t.y);
|
|
5311
5316
|
c < i && (r = s, i = c);
|
|
5312
5317
|
}), r ?? e;
|
|
5313
5318
|
}
|
|
5314
|
-
var
|
|
5315
|
-
function
|
|
5316
|
-
let n =
|
|
5319
|
+
var rs = 1e-6;
|
|
5320
|
+
function is(e, t) {
|
|
5321
|
+
let n = $o(e, t), r = e.x + e.width / 2, i = e.y + e.height / 2, { rx: a, ry: o } = Ro(e.width), s = n.x - r, c = Math.abs(s) < e.width / 2 - rs || Math.abs(Math.abs(s) - e.width / 2) <= rs && Math.abs(n.y - i) > e.height / 2 - o;
|
|
5317
5322
|
if (a === 0 || !c) return n;
|
|
5318
5323
|
let l = o * o * (1 - s * s / (a * a)), u = o - (l > 0 ? Math.sqrt(l) : l);
|
|
5319
5324
|
return t.y - i > 0 && (u = -u), {
|
|
@@ -5321,8 +5326,8 @@ function rs(e, t) {
|
|
|
5321
5326
|
y: n.y + u
|
|
5322
5327
|
};
|
|
5323
5328
|
}
|
|
5324
|
-
function
|
|
5325
|
-
let n =
|
|
5329
|
+
function as(e, t) {
|
|
5330
|
+
let n = $o(e, t), r = e.x + e.width / 2, i = e.y + e.height / 2, { rx: a, ry: o } = zo(e.height), s = n.y - i, c = Math.abs(s) < e.height / 2 - rs || Math.abs(Math.abs(s) - e.height / 2) <= rs && Math.abs(n.x - r) > e.width / 2 - a;
|
|
5326
5331
|
if (o === 0 || !c) return n;
|
|
5327
5332
|
let l = a * a * (1 - s * s / (o * o)), u = a - Math.sqrt(Math.abs(l));
|
|
5328
5333
|
return t.x - r > 0 && (u = -u), {
|
|
@@ -5330,16 +5335,16 @@ function is(e, t) {
|
|
|
5330
5335
|
y: n.y
|
|
5331
5336
|
};
|
|
5332
5337
|
}
|
|
5333
|
-
function
|
|
5338
|
+
function os(e, t) {
|
|
5334
5339
|
let n = e.el;
|
|
5335
|
-
return n?.kind === "person" ?
|
|
5340
|
+
return n?.kind === "person" ? es(e, t) : n?.shape === "db" ? is(e, t) : n?.shape === "queue" ? as(e, t) : $o(e, t);
|
|
5336
5341
|
}
|
|
5337
|
-
var
|
|
5342
|
+
var ss = (e) => ({
|
|
5338
5343
|
x: e.x + e.width / 2,
|
|
5339
5344
|
y: e.y + e.height / 2
|
|
5340
5345
|
});
|
|
5341
|
-
function
|
|
5342
|
-
let i = n.get(e.from), a = n.get(e.to), o =
|
|
5346
|
+
function cs(e, t, n, r) {
|
|
5347
|
+
let i = n.get(e.from), a = n.get(e.to), o = os(i, ss(a)), s = os(a, ss(i)), c = s.x - o.x, l = s.y - o.y, u = (e) => ({
|
|
5343
5348
|
x: e.x,
|
|
5344
5349
|
y: e.y + r
|
|
5345
5350
|
}), d = {
|
|
@@ -5353,35 +5358,35 @@ function ss(e, t, n, r) {
|
|
|
5353
5358
|
let t = {
|
|
5354
5359
|
x: Math.min(o.x, s.x) + Math.abs(c) / 2,
|
|
5355
5360
|
y: Math.min(o.y, s.y) + Math.abs(l) / 2
|
|
5356
|
-
}, n = P(e)[0], r = e.label !== "" || e.index !== void 0 ?
|
|
5361
|
+
}, n = P(e)[0], r = e.label !== "" || e.index !== void 0 ? Bo(n ?? "", $.messageSize, 400) : 0;
|
|
5357
5362
|
if (d.labelPosition = u({
|
|
5358
5363
|
x: t.x + r / 2,
|
|
5359
5364
|
y: t.y
|
|
5360
5365
|
}), e.technology) {
|
|
5361
|
-
let n =
|
|
5366
|
+
let n = Bo(`[${e.technology}]`, $.messageSize, 400);
|
|
5362
5367
|
d.technologyX = t.x + Math.max(r, n) / 2;
|
|
5363
5368
|
}
|
|
5364
5369
|
}
|
|
5365
5370
|
return d;
|
|
5366
5371
|
}
|
|
5367
|
-
var
|
|
5372
|
+
var ls = 2, us = 6, ds = 2, fs = [
|
|
5368
5373
|
0,
|
|
5369
5374
|
14,
|
|
5370
5375
|
-14,
|
|
5371
5376
|
28,
|
|
5372
5377
|
-28
|
|
5373
|
-
],
|
|
5378
|
+
], ps = [
|
|
5374
5379
|
.75,
|
|
5375
5380
|
.55,
|
|
5376
5381
|
.4
|
|
5377
|
-
],
|
|
5382
|
+
], ms = 1e3, hs = 100, gs = 10, _s = 2, vs = 5, ys = 4, bs = (e) => ({
|
|
5378
5383
|
x0: e.cx - e.w / 2,
|
|
5379
5384
|
x1: e.cx + e.w / 2,
|
|
5380
5385
|
y0: e.cy - e.h / 2,
|
|
5381
5386
|
y1: e.cy + e.h / 2
|
|
5382
|
-
}),
|
|
5383
|
-
function
|
|
5384
|
-
let t = e.points[0], n = e.points[e.points.length - 1], r = e.curve, i = Math.hypot(n.x - t.x, n.y - t.y), a = Math.max(1, Math.ceil(i /
|
|
5387
|
+
}), xs = (e, t) => e.x0 < t.x1 + ls && e.x1 > t.x0 - ls && e.y0 < t.y1 + ls && e.y1 > t.y0 - ls;
|
|
5388
|
+
function Ss(e) {
|
|
5389
|
+
let t = e.points[0], n = e.points[e.points.length - 1], r = e.curve, i = Math.hypot(n.x - t.x, n.y - t.y), a = Math.max(1, Math.ceil(i / ys));
|
|
5385
5390
|
return Array.from({ length: a + 1 }, (e, i) => {
|
|
5386
5391
|
let o = i / a;
|
|
5387
5392
|
if (!r) return {
|
|
@@ -5395,45 +5400,45 @@ function xs(e) {
|
|
|
5395
5400
|
};
|
|
5396
5401
|
});
|
|
5397
5402
|
}
|
|
5398
|
-
function
|
|
5403
|
+
function Cs(e) {
|
|
5399
5404
|
return e.flatMap((e) => {
|
|
5400
5405
|
let t = (e, t, n, r, i) => ({
|
|
5401
5406
|
x0: e - i,
|
|
5402
5407
|
x1: t + i,
|
|
5403
5408
|
y0: n - i,
|
|
5404
5409
|
y1: r + i,
|
|
5405
|
-
weight:
|
|
5410
|
+
weight: hs
|
|
5406
5411
|
}), n = (n, r, i, a) => {
|
|
5407
|
-
let o =
|
|
5408
|
-
return t(s - o / 2, s + o / 2, e.y + r - i / 2, e.y + r + i / 2,
|
|
5412
|
+
let o = Bo(n, i, a), s = e.x + e.width / 2;
|
|
5413
|
+
return t(s - o / 2, s + o / 2, e.y + r - i / 2, e.y + r + i / 2, vs);
|
|
5409
5414
|
}, r = N({
|
|
5410
5415
|
...e,
|
|
5411
5416
|
elementAliases: [],
|
|
5412
5417
|
children: []
|
|
5413
5418
|
});
|
|
5414
5419
|
return [
|
|
5415
|
-
t(e.x, e.x + e.width, e.y, e.y,
|
|
5416
|
-
t(e.x, e.x + e.width, e.y + e.height, e.y + e.height,
|
|
5417
|
-
t(e.x, e.x, e.y, e.y + e.height,
|
|
5418
|
-
t(e.x + e.width, e.x + e.width, e.y, e.y + e.height,
|
|
5420
|
+
t(e.x, e.x + e.width, e.y, e.y, _s),
|
|
5421
|
+
t(e.x, e.x + e.width, e.y + e.height, e.y + e.height, _s),
|
|
5422
|
+
t(e.x, e.x, e.y, e.y + e.height, _s),
|
|
5423
|
+
t(e.x + e.width, e.x + e.width, e.y, e.y + e.height, _s),
|
|
5419
5424
|
n(e.label, e.labelY, $.boundarySize + 2, 700),
|
|
5420
5425
|
...r ? [n(r, e.typeY, $.boundarySize, 400)] : [],
|
|
5421
5426
|
...e.description ? [n(e.description, e.descrY, $.boundarySize - 2, 400)] : []
|
|
5422
5427
|
];
|
|
5423
5428
|
});
|
|
5424
5429
|
}
|
|
5425
|
-
function
|
|
5426
|
-
return
|
|
5430
|
+
function ws(e, t) {
|
|
5431
|
+
return Go({
|
|
5427
5432
|
...e,
|
|
5428
5433
|
labelLines: t.lines,
|
|
5429
5434
|
labelPosition: t.position,
|
|
5430
5435
|
...t.technologyX === void 0 ? {} : { technologyX: t.technologyX }
|
|
5431
|
-
}).map(
|
|
5436
|
+
}).map(bs);
|
|
5432
5437
|
}
|
|
5433
|
-
function
|
|
5438
|
+
function Ts(e, t, n, r) {
|
|
5434
5439
|
let i = e.points[0], a = e.points[e.points.length - 1], o = e.labelPosition;
|
|
5435
5440
|
if (!o || !i || !a) return;
|
|
5436
|
-
let s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c), u = P(e), d = e.label !== "" || e.index !== void 0, f = d ?
|
|
5441
|
+
let s = a.x - i.x, c = a.y - i.y, l = Math.hypot(s, c), u = P(e), d = e.label !== "" || e.index !== void 0, f = d ? Bo(u[0], $.messageSize, 400) : 0, p = o.x - f / 2, m = [{
|
|
5437
5442
|
variant: {
|
|
5438
5443
|
lines: u,
|
|
5439
5444
|
position: o,
|
|
@@ -5443,11 +5448,11 @@ function ws(e, t, n, r) {
|
|
|
5443
5448
|
}];
|
|
5444
5449
|
if (d) {
|
|
5445
5450
|
let t = e.technology ? [`[${e.technology}]`] : [], n = /* @__PURE__ */ new Set([u.join("\n")]);
|
|
5446
|
-
|
|
5447
|
-
let i =
|
|
5451
|
+
ps.forEach((e, r) => {
|
|
5452
|
+
let i = Po(u[0], f * e, $.messageSize), a = [...i, ...t].join("\n");
|
|
5448
5453
|
if (n.has(a)) return;
|
|
5449
5454
|
n.add(a);
|
|
5450
|
-
let s = Math.max(...i.map((e) =>
|
|
5455
|
+
let s = Math.max(...i.map((e) => Bo(e, $.messageSize, 400)));
|
|
5451
5456
|
m.push({
|
|
5452
5457
|
variant: {
|
|
5453
5458
|
lines: [...i, ...t],
|
|
@@ -5460,12 +5465,12 @@ function ws(e, t, n, r) {
|
|
|
5460
5465
|
});
|
|
5461
5466
|
});
|
|
5462
5467
|
}
|
|
5463
|
-
let h = l === 0 ? 0 : s / l, g = l === 0 ? 0 : c / l, _ = l / 2 + Math.max(...
|
|
5468
|
+
let h = l === 0 ? 0 : s / l, g = l === 0 ? 0 : c / l, _ = l / 2 + Math.max(...fs) + ls, v = m.flatMap((t) => ws(e, t.variant)), y = {
|
|
5464
5469
|
x0: Math.min(...v.map((e) => e.x0)) - _,
|
|
5465
5470
|
x1: Math.max(...v.map((e) => e.x1)) + _,
|
|
5466
5471
|
y0: Math.min(...v.map((e) => e.y0)) - _,
|
|
5467
5472
|
y1: Math.max(...v.map((e) => e.y1)) + _
|
|
5468
|
-
}, b = (e) => e.x0 < y.x1 && e.x1 > y.x0 && e.y0 < y.y1 && e.y1 > y.y0, x = [...t, ...r].filter(b), S = Math.max(
|
|
5473
|
+
}, b = (e) => e.x0 < y.x1 && e.x1 > y.x0 && e.y0 < y.y1 && e.y1 > y.y0, x = [...t, ...r].filter(b), S = Math.max(ds, l / 200), C = n.filter((e) => b({
|
|
5469
5474
|
x0: Math.min(...e.map((e) => e.x)),
|
|
5470
5475
|
x1: Math.max(...e.map((e) => e.x)),
|
|
5471
5476
|
y0: Math.min(...e.map((e) => e.y)),
|
|
@@ -5477,8 +5482,8 @@ function ws(e, t, n, r) {
|
|
|
5477
5482
|
y1: Math.max(...e.map((e) => e.y))
|
|
5478
5483
|
})), T, E = (e) => T?.penalty === 0 && e >= T.cost;
|
|
5479
5484
|
for (let { variant: t, cost: n } of m) {
|
|
5480
|
-
let r =
|
|
5481
|
-
for (let e of
|
|
5485
|
+
let r = ws(e, t);
|
|
5486
|
+
for (let e of fs) if (!E(n + 2 * Math.abs(e))) for (let i = 0; i <= l / 2 && !E(n + 2 * Math.abs(e) + i); i += S) for (let a of i === 0 ? [1] : [1, -1]) {
|
|
5482
5487
|
let o = a * i, s = {
|
|
5483
5488
|
x: o * h - e * g,
|
|
5484
5489
|
y: o * g + e * h
|
|
@@ -5490,11 +5495,11 @@ function ws(e, t, n, r) {
|
|
|
5490
5495
|
})), l = 0, u = T?.penalty ?? Infinity;
|
|
5491
5496
|
for (let e of c) {
|
|
5492
5497
|
if (l > u) break;
|
|
5493
|
-
for (let t of x) if (
|
|
5498
|
+
for (let t of x) if (xs(e, t) && (l += t.weight), l > u) break;
|
|
5494
5499
|
if (l > u) break;
|
|
5495
5500
|
for (let [t, n] of C.entries()) {
|
|
5496
5501
|
let r = w[t];
|
|
5497
|
-
r.x1 <= e.x0 || r.x0 >= e.x1 || r.y1 <= e.y0 || r.y0 >= e.y1 || n.some((t) => t.x > e.x0 && t.x < e.x1 && t.y > e.y0 && t.y < e.y1) && (l +=
|
|
5502
|
+
r.x1 <= e.x0 || r.x0 >= e.x1 || r.y1 <= e.y0 || r.y0 >= e.y1 || n.some((t) => t.x > e.x0 && t.x < e.x1 && t.y > e.y0 && t.y < e.y1) && (l += gs);
|
|
5498
5503
|
}
|
|
5499
5504
|
}
|
|
5500
5505
|
let d = n + i + 2 * Math.abs(e);
|
|
@@ -5510,12 +5515,12 @@ function ws(e, t, n, r) {
|
|
|
5510
5515
|
e.labelPosition = {
|
|
5511
5516
|
x: D.position.x + O.x,
|
|
5512
5517
|
y: D.position.y + O.y
|
|
5513
|
-
}, D.lines !== u && (e.labelLines = D.lines), D.technologyX === void 0 ? delete e.technologyX : e.technologyX = D.technologyX + O.x, r.push(...
|
|
5514
|
-
...
|
|
5515
|
-
weight:
|
|
5518
|
+
}, D.lines !== u && (e.labelLines = D.lines), D.technologyX === void 0 ? delete e.technologyX : e.technologyX = D.technologyX + O.x, r.push(...Go(e).map((e) => ({
|
|
5519
|
+
...bs(e),
|
|
5520
|
+
weight: hs
|
|
5516
5521
|
})));
|
|
5517
5522
|
}
|
|
5518
|
-
function
|
|
5523
|
+
function Es(e, t = {}) {
|
|
5519
5524
|
if (e.elements.length === 0 && e.boundaries.length === 0) {
|
|
5520
5525
|
let t = {
|
|
5521
5526
|
variant: e.variant,
|
|
@@ -5527,7 +5532,7 @@ function Ts(e, t = {}) {
|
|
|
5527
5532
|
};
|
|
5528
5533
|
return e.title && (t.title = e.title), t;
|
|
5529
5534
|
}
|
|
5530
|
-
let n = Zo(
|
|
5535
|
+
let n = Qo(Zo(e)), r = e.title ? $.titleExtra : 0, i = $.diagramMarginY + r, a = e.elements.flatMap((e) => {
|
|
5531
5536
|
let t = n.elements.get(e.alias);
|
|
5532
5537
|
return t ? [{
|
|
5533
5538
|
...e,
|
|
@@ -5544,14 +5549,14 @@ function Ts(e, t = {}) {
|
|
|
5544
5549
|
})), s = /* @__PURE__ */ new Map();
|
|
5545
5550
|
for (let e of n.elements.values()) s.set(e.el.alias, e);
|
|
5546
5551
|
for (let e of n.boundaries) s.set(e.alias, e);
|
|
5547
|
-
let c = e.relationships.map((e, t) =>
|
|
5548
|
-
x0: e.x -
|
|
5549
|
-
x1: e.x + e.width +
|
|
5550
|
-
y0: e.y -
|
|
5551
|
-
y1: e.y + e.height +
|
|
5552
|
-
weight:
|
|
5553
|
-
})), ...
|
|
5554
|
-
c.forEach((e, t) =>
|
|
5552
|
+
let c = e.relationships.map((e, t) => cs(e, t, s, i)), l = [...a.map((e) => ({
|
|
5553
|
+
x0: e.x - us,
|
|
5554
|
+
x1: e.x + e.width + us,
|
|
5555
|
+
y0: e.y - us,
|
|
5556
|
+
y1: e.y + e.height + us,
|
|
5557
|
+
weight: ms
|
|
5558
|
+
})), ...Cs(o)], u = c.map(Ss), d = [];
|
|
5559
|
+
c.forEach((e, t) => Ts(e, l, u.filter((e, n) => n !== t), d));
|
|
5555
5560
|
let f = n.maxX + $.diagramMarginX, p = n.maxY + $.diagramMarginY + r, m = {
|
|
5556
5561
|
variant: e.variant,
|
|
5557
5562
|
width: f,
|
|
@@ -5567,23 +5572,23 @@ function Ts(e, t = {}) {
|
|
|
5567
5572
|
}
|
|
5568
5573
|
//#endregion
|
|
5569
5574
|
//#region packages/svg-renderer/src/c4/renderer.ts
|
|
5570
|
-
function
|
|
5575
|
+
function Ds(e, n, r = "Inter", i = !1, a = Ie, o, c, u, d = {}) {
|
|
5571
5576
|
let f = [];
|
|
5572
|
-
f.push(
|
|
5573
|
-
for (let t of e.boundaries) f.push(
|
|
5574
|
-
for (let t of e.elements) f.push(
|
|
5575
|
-
for (let t of e.relationships) f.push(Ls(t));
|
|
5577
|
+
f.push(hi(O(e.width, e.height, n, i, c ?? e.title, u, void 0, d.styleAttribute, d.description), o)), f.push(t(r, !1, d.nonce)), e.title && e.titlePosition && f.push(l`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${z}" ` + l`font-size="16" fill="var(--_text)">${s(e.title)}</text>`);
|
|
5578
|
+
for (let t of e.boundaries) f.push(ks(t));
|
|
5579
|
+
for (let t of e.elements) f.push(As(t));
|
|
5576
5580
|
for (let t of e.relationships) f.push(Rs(t));
|
|
5581
|
+
for (let t of e.relationships) f.push(zs(t));
|
|
5577
5582
|
return f.push("</svg>"), f.filter(Boolean).join("\n");
|
|
5578
5583
|
}
|
|
5579
|
-
function
|
|
5584
|
+
function Os(e, t, n, r, i) {
|
|
5580
5585
|
return l` <text x="${t}" y="${n}" text-anchor="middle" dy="${z}" font-size="${r}" ` + l`${i}>${s(e)}</text>`;
|
|
5581
5586
|
}
|
|
5582
|
-
function
|
|
5587
|
+
function ks(e) {
|
|
5583
5588
|
let t = [];
|
|
5584
5589
|
t.push(l`<g class="c4-boundary" data-id="${o(e.alias)}" data-label="${o(e.label)}" data-depth="${e.depth}">`), t.push(l` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" ` + "fill=\"none\" stroke=\"var(--_text)\" stroke-width=\"1\" stroke-dasharray=\"7,7\" />");
|
|
5585
5590
|
let n = e.x + e.width / 2;
|
|
5586
|
-
t.push(
|
|
5591
|
+
t.push(Os(e.label, n, e.y + (e.labelY ?? 8), $.boundarySize + 2, "font-weight=\"700\" fill=\"var(--_text)\""));
|
|
5587
5592
|
let r = N({
|
|
5588
5593
|
alias: e.alias,
|
|
5589
5594
|
label: e.label,
|
|
@@ -5591,51 +5596,51 @@ function Os(e) {
|
|
|
5591
5596
|
elementAliases: [],
|
|
5592
5597
|
children: []
|
|
5593
5598
|
});
|
|
5594
|
-
return r && e.typeY !== void 0 && t.push(
|
|
5599
|
+
return r && e.typeY !== void 0 && t.push(Os(r, n, e.y + e.typeY, $.boundarySize, "fill=\"var(--_text)\"")), e.description && e.descrY !== void 0 && t.push(Os(e.description, n, e.y + e.descrY, $.boundarySize - 2, "fill=\"var(--_text)\"")), t.push("</g>"), t.join("\n");
|
|
5595
5600
|
}
|
|
5596
|
-
function
|
|
5597
|
-
let t =
|
|
5601
|
+
function As(e) {
|
|
5602
|
+
let t = Ho(e), { x: n, y: r, width: i, height: a } = e, s = n + i / 2, c = Io(e.nameLines.length, e.descriptionLines.length), u = [];
|
|
5598
5603
|
u.push(l`<g class="c4-element" data-id="${o(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" ` + l`data-external="${e.external}" data-label="${o(e.label)}">`);
|
|
5599
5604
|
let d, f = s;
|
|
5600
|
-
if (e.kind === "person") u.push(...
|
|
5605
|
+
if (e.kind === "person") u.push(...Ms(e, t)), d = r + Fo(i).pillTop + $.shapePadding;
|
|
5601
5606
|
else if (e.shape === "db") {
|
|
5602
|
-
u.push(...
|
|
5603
|
-
let { ry: n } =
|
|
5607
|
+
u.push(...Ns(e, t));
|
|
5608
|
+
let { ry: n } = Ro(i);
|
|
5604
5609
|
d = r + (2 * n + a) / 2 - c / 2;
|
|
5605
5610
|
} else if (e.shape === "queue") {
|
|
5606
|
-
u.push(...
|
|
5607
|
-
let { rx: n } =
|
|
5611
|
+
u.push(...Ps(e, t));
|
|
5612
|
+
let { rx: n } = zo(a);
|
|
5608
5613
|
f = s - n, d = r + a / 2 - c / 2;
|
|
5609
5614
|
} else u.push(l` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" ` + l`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`), d = r + $.shapePadding;
|
|
5610
5615
|
let p = d;
|
|
5611
|
-
for (let n of e.nameLines) u.push(
|
|
5612
|
-
return u.push(
|
|
5613
|
-
u.push(
|
|
5614
|
-
}), p +=
|
|
5616
|
+
for (let n of e.nameLines) u.push(Os(n, f, p + $.nameLine / 2, $.nameSize, l`font-weight="700" fill="${t.text}"`)), p += $.nameLine;
|
|
5617
|
+
return u.push(Os(te(e), f, p + $.typeLine / 2, $.typeSize, l`fill="${t.text}"`)), p += $.typeLine, e.descriptionLines.forEach((e, n) => {
|
|
5618
|
+
u.push(Os(e, f, p + $.descrLine / 2 + n * $.descrExtraLine, $.descrSize, l`fill="${t.text}"`));
|
|
5619
|
+
}), p += Lo(e.descriptionLines.length), u.push("</g>"), u.join("\n");
|
|
5615
5620
|
}
|
|
5616
|
-
function
|
|
5617
|
-
let { x: t, y: n, width: r, height: i } = e, { rx: a, headRadius: o, pillTop: s } =
|
|
5621
|
+
function js(e) {
|
|
5622
|
+
let { x: t, y: n, width: r, height: i } = e, { rx: a, headRadius: o, pillTop: s } = Fo(r, i), c = t + r / 2, u = n + s, d = n + i, f = Math.sqrt(Math.max(0, o * o - (u - (n + o)) ** 2));
|
|
5618
5623
|
return l`M ${t + a} ${u} H ${c - f} A ${o} ${o} 0 1 1 ${c + f} ${u} ` + l`H ${t + r - a} A ${a} ${a} 0 0 1 ${t + r} ${u + a} V ${d - a} ` + l`A ${a} ${a} 0 0 1 ${t + r - a} ${d} H ${t + a} ` + l`A ${a} ${a} 0 0 1 ${t} ${d - a} V ${u + a} ` + l`A ${a} ${a} 0 0 1 ${t + a} ${u} Z`;
|
|
5619
5624
|
}
|
|
5620
|
-
function js(e, t) {
|
|
5621
|
-
return [l` <path class="c4-person-shape" d="${As(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`];
|
|
5622
|
-
}
|
|
5623
5625
|
function Ms(e, t) {
|
|
5624
|
-
|
|
5625
|
-
return [l` <path d="M ${n} ${r + s} L ${n} ${r + a - s} A ${o} ${s} 0 0 0 ${n + i} ${r + a - s} L ${n + i} ${r + s} Z" ${c} />`, l` <ellipse cx="${n + o}" cy="${r + s}" rx="${o}" ry="${s}" ${c} />`];
|
|
5626
|
+
return [l` <path class="c4-person-shape" d="${js(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`];
|
|
5626
5627
|
}
|
|
5627
5628
|
function Ns(e, t) {
|
|
5628
|
-
let { x: n, y: r, width: i, height: a } = e, { rx: o, ry: s } = Ro(
|
|
5629
|
-
return [l` <path d="M ${n
|
|
5629
|
+
let { x: n, y: r, width: i, height: a } = e, { rx: o, ry: s } = Ro(i), c = l`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;
|
|
5630
|
+
return [l` <path d="M ${n} ${r + s} L ${n} ${r + a - s} A ${o} ${s} 0 0 0 ${n + i} ${r + a - s} L ${n + i} ${r + s} Z" ${c} />`, l` <ellipse cx="${n + o}" cy="${r + s}" rx="${o}" ry="${s}" ${c} />`];
|
|
5630
5631
|
}
|
|
5631
5632
|
function Ps(e, t) {
|
|
5633
|
+
let { x: n, y: r, width: i, height: a } = e, { rx: o, ry: s } = zo(a), c = l`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;
|
|
5634
|
+
return [l` <path d="M ${n + i - o} ${r} H ${n + o} A ${o} ${s} 0 0 0 ${n + o} ${r + a} H ${n + i - o} Z" ${c} />`, l` <ellipse cx="${n + i - o}" cy="${r + s}" rx="${o}" ry="${s}" ${c} />`];
|
|
5635
|
+
}
|
|
5636
|
+
function Fs(e, t) {
|
|
5632
5637
|
let n = e.x - t.x, r = e.y - t.y, i = Math.hypot(n, r);
|
|
5633
5638
|
if (i === 0) return "";
|
|
5634
5639
|
let a = n / i, o = r / i, s = e.x - a * 10, c = e.y - o * 10;
|
|
5635
5640
|
return l`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s - o * 5},${c + a * 5} ${s + o * 5},${c - a * 5}" ` + "fill=\"var(--_text)\" />";
|
|
5636
5641
|
}
|
|
5637
|
-
var
|
|
5638
|
-
function
|
|
5642
|
+
var Is = 3, Ls = 1;
|
|
5643
|
+
function Rs(e) {
|
|
5639
5644
|
let [t, n] = [e.points[0], e.points[e.points.length - 1]];
|
|
5640
5645
|
if (!t || !n || t === n) return "";
|
|
5641
5646
|
let r = [
|
|
@@ -5644,109 +5649,109 @@ function Ls(e) {
|
|
|
5644
5649
|
l`data-to="${o(e.to)}"`
|
|
5645
5650
|
];
|
|
5646
5651
|
e.label && r.push(l`data-label="${o(e.label)}"`), e.technology && r.push(l`data-technology="${o(e.technology)}"`);
|
|
5647
|
-
let i = e.curve ? l`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}` : l`M ${t.x},${t.y} L ${n.x},${n.y}`, a = l`<path ${r.join(" ")} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`, s = e.curve ?? t, c = e.curve ?? n, u =
|
|
5652
|
+
let i = e.curve ? l`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}` : l`M ${t.x},${t.y} L ${n.x},${n.y}`, a = l`<path ${r.join(" ")} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`, s = e.curve ?? t, c = e.curve ?? n, u = Fs(n, s), d = Fs(t, c);
|
|
5648
5653
|
return [a, ...e.bidirectional ? [u, d] : [e.reversed ? d : u]].filter(Boolean).join("\n");
|
|
5649
5654
|
}
|
|
5650
|
-
function
|
|
5651
|
-
let t =
|
|
5655
|
+
function zs(e) {
|
|
5656
|
+
let t = Wo(e), n = Go(e);
|
|
5652
5657
|
if (n.length === 0) return "";
|
|
5653
|
-
let r = [l`<g class="c4-relationship-label" data-from="${o(e.from)}" data-to="${o(e.to)}">`], i = Math.min(...n.map((e) => e.cx - e.w / 2)) -
|
|
5658
|
+
let r = [l`<g class="c4-relationship-label" data-from="${o(e.from)}" data-to="${o(e.to)}">`], i = Math.min(...n.map((e) => e.cx - e.w / 2)) - Is, a = Math.max(...n.map((e) => e.cx + e.w / 2)) + Is, s = n[0].cy - n[0].h / 2 - Ls, c = n[n.length - 1], u = c.cy + c.h / 2 + Ls;
|
|
5654
5659
|
return r.push(l` <rect class="c4-label-plate" x="${i}" y="${s}" width="${a - i}" height="${u - s}" rx="2" ry="2" fill="var(--bg)" />`), t.forEach((i, a) => {
|
|
5655
5660
|
let o = e.technology !== void 0 && a === t.length - 1, s = n[a];
|
|
5656
|
-
r.push(
|
|
5661
|
+
r.push(Os(i, s.cx, s.cy, $.messageSize, o ? "font-style=\"italic\" fill=\"var(--_text)\"" : "fill=\"var(--_text)\""));
|
|
5657
5662
|
}), r.push("</g>"), r.join("\n");
|
|
5658
5663
|
}
|
|
5659
5664
|
//#endregion
|
|
5660
5665
|
//#region packages/svg-renderer/src/registry.ts
|
|
5661
|
-
var
|
|
5666
|
+
var Bs = {
|
|
5662
5667
|
type: "xychart",
|
|
5663
5668
|
parse: ue,
|
|
5664
|
-
layoutForSvg:
|
|
5669
|
+
layoutForSvg: Qa,
|
|
5665
5670
|
renderSvg(e, t, n) {
|
|
5666
5671
|
let r = n.interactivity === void 0 ? n.interactive ?? !1 : n.interactivity === "full";
|
|
5667
|
-
return
|
|
5672
|
+
return fo(e, t.colors, t.font, t.transparent, r, t.embedSource, t.title, t.decorative, t.emit);
|
|
5668
5673
|
}
|
|
5669
|
-
},
|
|
5674
|
+
}, Vs = {
|
|
5670
5675
|
type: "sequence",
|
|
5671
5676
|
parse: le,
|
|
5672
|
-
layoutForSvg:
|
|
5677
|
+
layoutForSvg: Oa,
|
|
5673
5678
|
renderSvg(e, t) {
|
|
5674
|
-
return
|
|
5679
|
+
return ka(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
5675
5680
|
}
|
|
5676
5681
|
};
|
|
5677
|
-
function
|
|
5682
|
+
function Hs(e) {
|
|
5678
5683
|
return (e.interactivity ?? "static") !== "none";
|
|
5679
5684
|
}
|
|
5680
|
-
function
|
|
5685
|
+
function Us(e) {
|
|
5681
5686
|
return (e.interactivity ?? "static") === "full";
|
|
5682
5687
|
}
|
|
5683
|
-
var
|
|
5688
|
+
var Ws = {
|
|
5684
5689
|
type: "class",
|
|
5685
5690
|
parse: ae,
|
|
5686
|
-
layoutForSvg:
|
|
5691
|
+
layoutForSvg: Ri,
|
|
5687
5692
|
renderSvg(e, t, n) {
|
|
5688
|
-
return
|
|
5693
|
+
return Hi(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, Hs(n), t.emit);
|
|
5689
5694
|
}
|
|
5690
|
-
},
|
|
5695
|
+
}, Gs = {
|
|
5691
5696
|
type: "er",
|
|
5692
5697
|
parse: oe,
|
|
5693
5698
|
layoutForSvg(e, t) {
|
|
5694
|
-
return
|
|
5699
|
+
return ca(A(e, t.direction), t);
|
|
5695
5700
|
},
|
|
5696
5701
|
renderSvg(e, t) {
|
|
5697
|
-
return
|
|
5702
|
+
return da(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
5698
5703
|
}
|
|
5699
|
-
},
|
|
5704
|
+
}, Ks = {
|
|
5700
5705
|
type: "flowchart",
|
|
5701
5706
|
parse: (e, t) => se(t),
|
|
5702
5707
|
layoutForSvg(e, t) {
|
|
5703
5708
|
return {
|
|
5704
|
-
graph:
|
|
5709
|
+
graph: sr(A(e, t.direction), t),
|
|
5705
5710
|
curve: t.curve ?? e.initConfig?.curve ?? "linear"
|
|
5706
5711
|
};
|
|
5707
5712
|
},
|
|
5708
5713
|
renderSvg(e, t, n) {
|
|
5709
|
-
return
|
|
5714
|
+
return vr(e.graph, t.colors, t.font, t.transparent, t.fontSizes, e.curve, t.embedSource, Us(n), Hs(n), t.title, t.decorative, t.emit);
|
|
5710
5715
|
}
|
|
5711
|
-
},
|
|
5716
|
+
}, qs = {
|
|
5712
5717
|
type: "c4",
|
|
5713
5718
|
parse: ie,
|
|
5714
5719
|
layoutForSvg(e, t) {
|
|
5715
|
-
return
|
|
5720
|
+
return Es(e, t);
|
|
5716
5721
|
},
|
|
5717
5722
|
renderSvg(e, t) {
|
|
5718
|
-
return
|
|
5719
|
-
}
|
|
5720
|
-
},
|
|
5721
|
-
xychart:
|
|
5722
|
-
er:
|
|
5723
|
-
sequence:
|
|
5724
|
-
class:
|
|
5725
|
-
flowchart:
|
|
5723
|
+
return Ds(e, t.colors, t.font, t.transparent, t.fontSizes, t.embedSource, t.title, t.decorative, t.emit);
|
|
5724
|
+
}
|
|
5725
|
+
}, Js = {
|
|
5726
|
+
xychart: Bs,
|
|
5727
|
+
er: Gs,
|
|
5728
|
+
sequence: Vs,
|
|
5729
|
+
class: Ws,
|
|
5730
|
+
flowchart: Ks,
|
|
5726
5731
|
architecture: {
|
|
5727
5732
|
type: "architecture",
|
|
5728
5733
|
parse: re,
|
|
5729
5734
|
layoutForSvg(e, t) {
|
|
5730
5735
|
return {
|
|
5731
|
-
graph:
|
|
5736
|
+
graph: ar(A(M(e), t.direction), t),
|
|
5732
5737
|
curve: t.curve ?? "linear"
|
|
5733
5738
|
};
|
|
5734
5739
|
},
|
|
5735
|
-
renderSvg:
|
|
5740
|
+
renderSvg: Ks.renderSvg
|
|
5736
5741
|
},
|
|
5737
|
-
c4:
|
|
5742
|
+
c4: qs,
|
|
5738
5743
|
pie: {
|
|
5739
5744
|
type: "pie",
|
|
5740
5745
|
parse: (e, t) => ce(t),
|
|
5741
|
-
layoutForSvg:
|
|
5746
|
+
layoutForSvg: wo,
|
|
5742
5747
|
renderSvg(e, t) {
|
|
5743
|
-
return
|
|
5748
|
+
return Oo(e, t.colors, t.font, t.transparent, t.embedSource, t.title, t.decorative, t.emit);
|
|
5744
5749
|
}
|
|
5745
5750
|
}
|
|
5746
5751
|
};
|
|
5747
5752
|
//#endregion
|
|
5748
5753
|
//#region packages/svg-renderer/src/index.ts
|
|
5749
|
-
function
|
|
5754
|
+
function Ys(t) {
|
|
5750
5755
|
return {
|
|
5751
5756
|
bg: t.bg ?? e.bg,
|
|
5752
5757
|
fg: t.fg ?? e.fg,
|
|
@@ -5757,20 +5762,20 @@ function Js(t) {
|
|
|
5757
5762
|
border: t.border
|
|
5758
5763
|
};
|
|
5759
5764
|
}
|
|
5760
|
-
function
|
|
5761
|
-
return k(
|
|
5765
|
+
function Xs(e = {}) {
|
|
5766
|
+
return k(Ys(e), e.transparent);
|
|
5762
5767
|
}
|
|
5763
|
-
function
|
|
5768
|
+
function Zs(e) {
|
|
5764
5769
|
return {
|
|
5765
5770
|
nonce: e.nonce,
|
|
5766
5771
|
styleAttribute: e.styleAttribute
|
|
5767
5772
|
};
|
|
5768
5773
|
}
|
|
5769
|
-
function
|
|
5770
|
-
let n =
|
|
5771
|
-
return t.resolveColors ?
|
|
5774
|
+
function Qs(e, t = {}) {
|
|
5775
|
+
let n = $s(tc(e, t));
|
|
5776
|
+
return t.resolveColors ? Ai(n, Ys(t)) : n;
|
|
5772
5777
|
}
|
|
5773
|
-
function
|
|
5778
|
+
function $s(e) {
|
|
5774
5779
|
let t = new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g), (e) => e[1] ?? ""));
|
|
5775
5780
|
if (t.size === 0) return e;
|
|
5776
5781
|
let n = 2166136261;
|
|
@@ -5778,18 +5783,18 @@ function Qs(e) {
|
|
|
5778
5783
|
let r = `zm${(n >>> 0).toString(36)}-`, i = (e) => t.has(e) && !e.startsWith("zm-") ? r + e : e;
|
|
5779
5784
|
return e.replace(/(\sid=")([^"]+)"/g, (e, t, n) => `${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g, (e, t) => `url(#${i(t)})`).replace(/(href=")#([^"]+)"/g, (e, t, n) => `${t}#${i(n)}"`);
|
|
5780
5785
|
}
|
|
5781
|
-
function
|
|
5786
|
+
function ec(e) {
|
|
5782
5787
|
let t = c(de(e)).text;
|
|
5783
|
-
|
|
5788
|
+
Js[i(t)].parse(T(t), t);
|
|
5784
5789
|
}
|
|
5785
|
-
function
|
|
5790
|
+
function tc(e, t) {
|
|
5786
5791
|
r("maxInputLength", e.length, t.limits);
|
|
5787
|
-
let a = c(de(e)), o = a.text, s =
|
|
5792
|
+
let a = c(de(e)), o = a.text, s = Ys(t), l = t.font ?? "Inter";
|
|
5788
5793
|
w(f(l));
|
|
5789
5794
|
let u = t.transparent ?? !1, d = Le(t.fontSizes), p = i(o), m = t.embedSource ? e : void 0, h = t.title ?? a.accTitle, g = t.decorative, _ = {
|
|
5790
|
-
...
|
|
5795
|
+
...Zs(t),
|
|
5791
5796
|
description: a.accDescr
|
|
5792
|
-
}, v = T(o), y =
|
|
5797
|
+
}, v = T(o), y = Js[p], b = y.parse(v, o), x = b;
|
|
5793
5798
|
x.nodes instanceof Map && Array.isArray(x.edges) && n(x.nodes.size, x.edges.length, t.limits);
|
|
5794
5799
|
let S = y.layoutForSvg(b, t), C = {
|
|
5795
5800
|
colors: s,
|
|
@@ -5803,11 +5808,11 @@ function ec(e, t) {
|
|
|
5803
5808
|
};
|
|
5804
5809
|
return y.renderSvg(S, C, t);
|
|
5805
5810
|
}
|
|
5806
|
-
async function
|
|
5807
|
-
return
|
|
5811
|
+
async function nc(e, t = {}) {
|
|
5812
|
+
return Qs(e, t);
|
|
5808
5813
|
}
|
|
5809
|
-
var
|
|
5814
|
+
var rc = Qs, ic = nc;
|
|
5810
5815
|
//#endregion
|
|
5811
|
-
export {
|
|
5816
|
+
export { Sa as ACTOR_LABEL_OFFSET, B as ARROW_HEAD, G as CLS, We as ELK_DIRECTION_FALLBACK, Se as ElkNotRegisteredError, Ie as FONT_SIZES, L as FONT_WEIGHTS, Re as GROUP_HEADER_CONTENT_PAD, Ye as INLINE_CENTERED_EDGE_LABEL, Pe as MONO_FONT, Fe as MONO_FONT_STACK, ze as NODE_PADDING, Z as PIE, R as STROKE_WIDTHS, z as TEXT_BASELINE_SHIFT, qe as baseElkLayoutOptions, xa as boxLabelHeight, Ze as buildElkEdge, Xe as buildElkEdgeLabel, Je as buildElkLeafNode, Be as buildSvgStyleBlock, Fi as classBackEdges, ji as classNoteId, yt as clipEdgeToShape, cr as convertToElkFormat, De as createLayoutCache, Ge as directionToElk, Ae as elkLayoutSync, Ke as elkPadding, Ne as estimateMonoTextWidth, I as estimateTextWidth, wi as evaluateCssColorValue, It as extractEdgeLabelPosition, Ft as extractEdgePoints, co as formatTickLabels, wa as hasLabelBelowIcon, Ri as layoutClassDiagramSync, ca as layoutErDiagramSync, sr as layoutFlowchartSync, ar as layoutGraphSync, wo as layoutPieChart, Oa as layoutSequenceDiagram, Qa as layoutXYChart, g as niceTickValues, Eo as pieColorValue, _e as pointsToPath, Ce as registerElk, Hi as renderClassSvg, da as renderErSvg, ic as renderMermaid, Qs as renderMermaidSVG, nc as renderMermaidSVGAsync, rc as renderMermaidSync, Oo as renderPieSvg, ka as renderSequenceSvg, vr as renderSvg, fo as renderXYChartSvg, Ai as resolveCssColors, Le as resolveFontSizes, go as smoothCurvePath, Xs as themeCssVariables, ec as validateMermaid, hi as withDataSrc, io as xLabelStep };
|
|
5812
5817
|
|
|
5813
5818
|
//# sourceMappingURL=index.js.map
|