@superlc/md-core 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_baseUniq-BfzcfZ4T.cjs +1 -0
- package/dist/_baseUniq-Y3ulau-C.js +477 -0
- package/dist/arc-Be_AVKBg.cjs +1 -0
- package/dist/arc-Ca7Zrknn.js +83 -0
- package/dist/architectureDiagram-VXUJARFQ-4Jx44yBn.cjs +36 -0
- package/dist/architectureDiagram-VXUJARFQ-DJeUU_qv.js +4665 -0
- package/dist/blockDiagram-VD42YOAC-BimcGKKd.cjs +122 -0
- package/dist/blockDiagram-VD42YOAC-D-giXjw6.js +2265 -0
- package/dist/c4Diagram-YG6GDRKO-Bl9iUUVb.cjs +10 -0
- package/dist/c4Diagram-YG6GDRKO-YxTtvGWw.js +1581 -0
- package/dist/channel-DOU_t-A5.js +5 -0
- package/dist/channel-DzR_mTuG.cjs +1 -0
- package/dist/chunk-4BX2VUAB-BT8x_a4k.cjs +1 -0
- package/dist/chunk-4BX2VUAB-qWjx6fvp.js +9 -0
- package/dist/chunk-55IACEB6-DRmMNyi7.js +8 -0
- package/dist/chunk-55IACEB6-DfzR1I2i.cjs +1 -0
- package/dist/chunk-B4BG7PRW-B4vBwkd7.js +1376 -0
- package/dist/chunk-B4BG7PRW-k_Ki7ZYa.cjs +165 -0
- package/dist/chunk-DI55MBZ5-67zt7BEa.cjs +220 -0
- package/dist/chunk-DI55MBZ5-B-Akunv8.js +1382 -0
- package/dist/chunk-FMBD7UC4-D-gJ-PKq.cjs +15 -0
- package/dist/chunk-FMBD7UC4-D1foMA2H.js +19 -0
- package/dist/chunk-QN33PNHL-DBsOH5IO.cjs +1 -0
- package/dist/chunk-QN33PNHL-DpeYRHMx.js +20 -0
- package/dist/chunk-QZHKN3VN-CWmChvMD.cjs +1 -0
- package/dist/chunk-QZHKN3VN-CoINyXCe.js +15 -0
- package/dist/chunk-TZMSLE5B-CMo-Qyqp.js +64 -0
- package/dist/chunk-TZMSLE5B-Psc_3Gkx.cjs +1 -0
- package/dist/classDiagram-2ON5EDUG-BrNHAA-E.js +16 -0
- package/dist/classDiagram-2ON5EDUG-CA1gbIW7.cjs +1 -0
- package/dist/classDiagram-v2-WZHVMYZB-BrNHAA-E.js +16 -0
- package/dist/classDiagram-v2-WZHVMYZB-CA1gbIW7.cjs +1 -0
- package/dist/clone-BOyua0mT.js +8 -0
- package/dist/clone-D7Rx0g6P.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-BBcnamAX.cjs +1 -0
- package/dist/cose-bilkent-S5V4N54A-xbHM31av.js +2605 -0
- package/dist/cytoscape.esm-DkGgpG6d.cjs +331 -0
- package/dist/cytoscape.esm-ZmItrg9y.js +18731 -0
- package/dist/dagre-6UL2VRFP-B5ZJ9Mmw.cjs +4 -0
- package/dist/dagre-6UL2VRFP-lY6fElcy.js +446 -0
- package/dist/defaultLocale-BgPVtth8.js +171 -0
- package/dist/defaultLocale-C4wbwF1n.cjs +1 -0
- package/dist/diagram-PSM6KHXK-DOgpThfE.js +534 -0
- package/dist/diagram-PSM6KHXK-NUCrGNCX.cjs +24 -0
- package/dist/diagram-QEK2KX5R-CKpcqpBk.js +221 -0
- package/dist/diagram-QEK2KX5R-P-pWAYvp.cjs +43 -0
- package/dist/diagram-S2PKOQOG-B4PYQerv.cjs +24 -0
- package/dist/diagram-S2PKOQOG-CZn9lft8.js +143 -0
- package/dist/erDiagram-Q2GNP2WA-D6UL-dgf.js +842 -0
- package/dist/erDiagram-Q2GNP2WA-DwYOfnOX.cjs +60 -0
- package/dist/flowDiagram-NV44I4VS-BvuqC7lR.cjs +162 -0
- package/dist/flowDiagram-NV44I4VS-YPdRK_ji.js +1627 -0
- package/dist/ganttDiagram-JELNMOA3-CGnvf7yj.js +2662 -0
- package/dist/ganttDiagram-JELNMOA3-wbYrtCNf.cjs +267 -0
- package/dist/gitGraphDiagram-NY62KEGX-BnpFLmUy.js +712 -0
- package/dist/gitGraphDiagram-NY62KEGX-BzlCJL63.cjs +65 -0
- package/dist/graph-Bv0JC_B1.cjs +1 -0
- package/dist/graph-DwDboYRQ.js +381 -0
- package/dist/index-A-U0gtM4.js +15167 -0
- package/dist/index-BC30feOR.cjs +300 -0
- package/dist/index.cjs +1 -300
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -14816
- package/dist/infoDiagram-WHAUD3N6-CPFFyZEz.cjs +2 -0
- package/dist/infoDiagram-WHAUD3N6-DF-Kn4KW.js +24 -0
- package/dist/init-CHZsXQcr.cjs +1 -0
- package/dist/init-DjUOC4st.js +16 -0
- package/dist/journeyDiagram-XKPGCS4Q-Bc3YJVQN.cjs +139 -0
- package/dist/journeyDiagram-XKPGCS4Q-CqUVbDan.js +836 -0
- package/dist/kanban-definition-3W4ZIXB7-BKxpdlfe.cjs +89 -0
- package/dist/kanban-definition-3W4ZIXB7-Zx7cVnZF.js +720 -0
- package/dist/layout-CrdknE74.js +1441 -0
- package/dist/layout-y4Mby5BC.cjs +1 -0
- package/dist/linear-D_NLLphh.cjs +1 -0
- package/dist/linear-Fqu_aevY.js +259 -0
- package/dist/mermaid/darkMode.d.ts +54 -0
- package/dist/mermaid/darkMode.d.ts.map +1 -0
- package/dist/mermaid/download.d.ts +27 -0
- package/dist/mermaid/download.d.ts.map +1 -0
- package/dist/mermaid/index.d.ts +9 -0
- package/dist/mermaid/index.d.ts.map +1 -0
- package/dist/mermaid/renderer.d.ts +36 -0
- package/dist/mermaid/renderer.d.ts.map +1 -0
- package/dist/mermaid/themes.d.ts +17 -0
- package/dist/mermaid/themes.d.ts.map +1 -0
- package/dist/mermaid/types.d.ts +117 -0
- package/dist/mermaid/types.d.ts.map +1 -0
- package/dist/mermaid.core-Buzus1hw.js +15321 -0
- package/dist/mermaid.core-CCMj67LO.cjs +255 -0
- package/dist/min-BNEwgiip.js +38 -0
- package/dist/min-CxfddLJo.cjs +1 -0
- package/dist/mindmap-definition-VGOIOE7T-C3sZAv1n.js +786 -0
- package/dist/mindmap-definition-VGOIOE7T-Cq9KhFIU.cjs +68 -0
- package/dist/ordinal-CagbB1m8.cjs +1 -0
- package/dist/ordinal-DfAQgscy.js +61 -0
- package/dist/pieDiagram-ADFJNKIX-Bib4GVaz.js +161 -0
- package/dist/pieDiagram-ADFJNKIX-CPJ4LdHJ.cjs +30 -0
- package/dist/quadrantDiagram-AYHSOK5B-Bw4qbzaI.js +1024 -0
- package/dist/quadrantDiagram-AYHSOK5B-Dldq3aFV.cjs +7 -0
- package/dist/requirementDiagram-UZGBJVZJ-BiMT5LBm.cjs +64 -0
- package/dist/requirementDiagram-UZGBJVZJ-DKt5E9D5.js +852 -0
- package/dist/sankeyDiagram-TZEHDZUN-BvqABFTj.cjs +10 -0
- package/dist/sankeyDiagram-TZEHDZUN-DPexJVr0.js +810 -0
- package/dist/sequenceDiagram-WL72ISMW-JcPuIgsZ.cjs +145 -0
- package/dist/sequenceDiagram-WL72ISMW-rx65Aq7k.js +2518 -0
- package/dist/stateDiagram-FKZM4ZOC-5jwz-EhH.cjs +1 -0
- package/dist/stateDiagram-FKZM4ZOC-D95elPzf.js +263 -0
- package/dist/stateDiagram-v2-4FDKWEC3-DKxcP1od.cjs +1 -0
- package/dist/stateDiagram-v2-4FDKWEC3-U8OyZJcH.js +16 -0
- package/dist/styles.css +292 -0
- package/dist/timeline-definition-IT6M3QCI-C_aFXPzu.cjs +61 -0
- package/dist/timeline-definition-IT6M3QCI-DzBIcxIH.js +801 -0
- package/dist/treemap-KMMF4GRG-CqQBq3TE.js +14157 -0
- package/dist/treemap-KMMF4GRG-DJHv4WOZ.cjs +128 -0
- package/dist/xychartDiagram-PRI3JC2R-M2dUh85s.cjs +7 -0
- package/dist/xychartDiagram-PRI3JC2R-ZNBNeiJf.js +1340 -0
- package/package.json +6 -2
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
import { _ as w, D as te, E as ae, H as he, e as ue, l as K, ba as P, d as Y, b as pe, a as fe, p as ge, q as me, g as ye, s as Se, F as ve, bb as xe, y as be } from "./mermaid.core-Buzus1hw.js";
|
|
2
|
+
import { s as we } from "./chunk-QN33PNHL-DpeYRHMx.js";
|
|
3
|
+
import { p as Ce } from "./chunk-4BX2VUAB-qWjx6fvp.js";
|
|
4
|
+
import { p as Te } from "./treemap-KMMF4GRG-CqQBq3TE.js";
|
|
5
|
+
import { b as O } from "./defaultLocale-BgPVtth8.js";
|
|
6
|
+
import { o as J } from "./ordinal-DfAQgscy.js";
|
|
7
|
+
function Le(t) {
|
|
8
|
+
var a = 0, l = t.children, n = l && l.length;
|
|
9
|
+
if (!n) a = 1;
|
|
10
|
+
else for (; --n >= 0; ) a += l[n].value;
|
|
11
|
+
t.value = a;
|
|
12
|
+
}
|
|
13
|
+
function $e() {
|
|
14
|
+
return this.eachAfter(Le);
|
|
15
|
+
}
|
|
16
|
+
function Ae(t, a) {
|
|
17
|
+
let l = -1;
|
|
18
|
+
for (const n of this)
|
|
19
|
+
t.call(a, n, ++l, this);
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
function Fe(t, a) {
|
|
23
|
+
for (var l = this, n = [l], o, s, d = -1; l = n.pop(); )
|
|
24
|
+
if (t.call(a, l, ++d, this), o = l.children)
|
|
25
|
+
for (s = o.length - 1; s >= 0; --s)
|
|
26
|
+
n.push(o[s]);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
function ke(t, a) {
|
|
30
|
+
for (var l = this, n = [l], o = [], s, d, h, g = -1; l = n.pop(); )
|
|
31
|
+
if (o.push(l), s = l.children)
|
|
32
|
+
for (d = 0, h = s.length; d < h; ++d)
|
|
33
|
+
n.push(s[d]);
|
|
34
|
+
for (; l = o.pop(); )
|
|
35
|
+
t.call(a, l, ++g, this);
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
function Ne(t, a) {
|
|
39
|
+
let l = -1;
|
|
40
|
+
for (const n of this)
|
|
41
|
+
if (t.call(a, n, ++l, this))
|
|
42
|
+
return n;
|
|
43
|
+
}
|
|
44
|
+
function Me(t) {
|
|
45
|
+
return this.eachAfter(function(a) {
|
|
46
|
+
for (var l = +t(a.data) || 0, n = a.children, o = n && n.length; --o >= 0; ) l += n[o].value;
|
|
47
|
+
a.value = l;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function _e(t) {
|
|
51
|
+
return this.eachBefore(function(a) {
|
|
52
|
+
a.children && a.children.sort(t);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function ze(t) {
|
|
56
|
+
for (var a = this, l = Ve(a, t), n = [a]; a !== l; )
|
|
57
|
+
a = a.parent, n.push(a);
|
|
58
|
+
for (var o = n.length; t !== l; )
|
|
59
|
+
n.splice(o, 0, t), t = t.parent;
|
|
60
|
+
return n;
|
|
61
|
+
}
|
|
62
|
+
function Ve(t, a) {
|
|
63
|
+
if (t === a) return t;
|
|
64
|
+
var l = t.ancestors(), n = a.ancestors(), o = null;
|
|
65
|
+
for (t = l.pop(), a = n.pop(); t === a; )
|
|
66
|
+
o = t, t = l.pop(), a = n.pop();
|
|
67
|
+
return o;
|
|
68
|
+
}
|
|
69
|
+
function De() {
|
|
70
|
+
for (var t = this, a = [t]; t = t.parent; )
|
|
71
|
+
a.push(t);
|
|
72
|
+
return a;
|
|
73
|
+
}
|
|
74
|
+
function Pe() {
|
|
75
|
+
return Array.from(this);
|
|
76
|
+
}
|
|
77
|
+
function Be() {
|
|
78
|
+
var t = [];
|
|
79
|
+
return this.eachBefore(function(a) {
|
|
80
|
+
a.children || t.push(a);
|
|
81
|
+
}), t;
|
|
82
|
+
}
|
|
83
|
+
function Ee() {
|
|
84
|
+
var t = this, a = [];
|
|
85
|
+
return t.each(function(l) {
|
|
86
|
+
l !== t && a.push({ source: l.parent, target: l });
|
|
87
|
+
}), a;
|
|
88
|
+
}
|
|
89
|
+
function* Re() {
|
|
90
|
+
var t = this, a, l = [t], n, o, s;
|
|
91
|
+
do
|
|
92
|
+
for (a = l.reverse(), l = []; t = a.pop(); )
|
|
93
|
+
if (yield t, n = t.children)
|
|
94
|
+
for (o = 0, s = n.length; o < s; ++o)
|
|
95
|
+
l.push(n[o]);
|
|
96
|
+
while (l.length);
|
|
97
|
+
}
|
|
98
|
+
function Q(t, a) {
|
|
99
|
+
t instanceof Map ? (t = [void 0, t], a === void 0 && (a = Ie)) : a === void 0 && (a = He);
|
|
100
|
+
for (var l = new U(t), n, o = [l], s, d, h, g; n = o.pop(); )
|
|
101
|
+
if ((d = a(n.data)) && (g = (d = Array.from(d)).length))
|
|
102
|
+
for (n.children = d, h = g - 1; h >= 0; --h)
|
|
103
|
+
o.push(s = d[h] = new U(d[h])), s.parent = n, s.depth = n.depth + 1;
|
|
104
|
+
return l.eachBefore(qe);
|
|
105
|
+
}
|
|
106
|
+
function We() {
|
|
107
|
+
return Q(this).eachBefore(Oe);
|
|
108
|
+
}
|
|
109
|
+
function He(t) {
|
|
110
|
+
return t.children;
|
|
111
|
+
}
|
|
112
|
+
function Ie(t) {
|
|
113
|
+
return Array.isArray(t) ? t[1] : null;
|
|
114
|
+
}
|
|
115
|
+
function Oe(t) {
|
|
116
|
+
t.data.value !== void 0 && (t.value = t.data.value), t.data = t.data.data;
|
|
117
|
+
}
|
|
118
|
+
function qe(t) {
|
|
119
|
+
var a = 0;
|
|
120
|
+
do
|
|
121
|
+
t.height = a;
|
|
122
|
+
while ((t = t.parent) && t.height < ++a);
|
|
123
|
+
}
|
|
124
|
+
function U(t) {
|
|
125
|
+
this.data = t, this.depth = this.height = 0, this.parent = null;
|
|
126
|
+
}
|
|
127
|
+
U.prototype = Q.prototype = {
|
|
128
|
+
constructor: U,
|
|
129
|
+
count: $e,
|
|
130
|
+
each: Ae,
|
|
131
|
+
eachAfter: ke,
|
|
132
|
+
eachBefore: Fe,
|
|
133
|
+
find: Ne,
|
|
134
|
+
sum: Me,
|
|
135
|
+
sort: _e,
|
|
136
|
+
path: ze,
|
|
137
|
+
ancestors: De,
|
|
138
|
+
descendants: Pe,
|
|
139
|
+
leaves: Be,
|
|
140
|
+
links: Ee,
|
|
141
|
+
copy: We,
|
|
142
|
+
[Symbol.iterator]: Re
|
|
143
|
+
};
|
|
144
|
+
function Ge(t) {
|
|
145
|
+
if (typeof t != "function") throw new Error();
|
|
146
|
+
return t;
|
|
147
|
+
}
|
|
148
|
+
function q() {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
function G(t) {
|
|
152
|
+
return function() {
|
|
153
|
+
return t;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function Xe(t) {
|
|
157
|
+
t.x0 = Math.round(t.x0), t.y0 = Math.round(t.y0), t.x1 = Math.round(t.x1), t.y1 = Math.round(t.y1);
|
|
158
|
+
}
|
|
159
|
+
function je(t, a, l, n, o) {
|
|
160
|
+
for (var s = t.children, d, h = -1, g = s.length, c = t.value && (n - a) / t.value; ++h < g; )
|
|
161
|
+
d = s[h], d.y0 = l, d.y1 = o, d.x0 = a, d.x1 = a += d.value * c;
|
|
162
|
+
}
|
|
163
|
+
function Ye(t, a, l, n, o) {
|
|
164
|
+
for (var s = t.children, d, h = -1, g = s.length, c = t.value && (o - l) / t.value; ++h < g; )
|
|
165
|
+
d = s[h], d.x0 = a, d.x1 = n, d.y0 = l, d.y1 = l += d.value * c;
|
|
166
|
+
}
|
|
167
|
+
var Ue = (1 + Math.sqrt(5)) / 2;
|
|
168
|
+
function Ze(t, a, l, n, o, s) {
|
|
169
|
+
for (var d = [], h = a.children, g, c, u = 0, b = 0, r = h.length, x, S, v = a.value, p, m, N, k, V, R, M; u < r; ) {
|
|
170
|
+
x = o - l, S = s - n;
|
|
171
|
+
do
|
|
172
|
+
p = h[b++].value;
|
|
173
|
+
while (!p && b < r);
|
|
174
|
+
for (m = N = p, R = Math.max(S / x, x / S) / (v * t), M = p * p * R, V = Math.max(N / M, M / m); b < r; ++b) {
|
|
175
|
+
if (p += c = h[b].value, c < m && (m = c), c > N && (N = c), M = p * p * R, k = Math.max(N / M, M / m), k > V) {
|
|
176
|
+
p -= c;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
V = k;
|
|
180
|
+
}
|
|
181
|
+
d.push(g = { value: p, dice: x < S, children: h.slice(u, b) }), g.dice ? je(g, l, n, o, v ? n += S * p / v : s) : Ye(g, l, n, v ? l += x * p / v : o, s), v -= p, u = b;
|
|
182
|
+
}
|
|
183
|
+
return d;
|
|
184
|
+
}
|
|
185
|
+
const Je = function t(a) {
|
|
186
|
+
function l(n, o, s, d, h) {
|
|
187
|
+
Ze(a, n, o, s, d, h);
|
|
188
|
+
}
|
|
189
|
+
return l.ratio = function(n) {
|
|
190
|
+
return t((n = +n) > 1 ? n : 1);
|
|
191
|
+
}, l;
|
|
192
|
+
}(Ue);
|
|
193
|
+
function Ke() {
|
|
194
|
+
var t = Je, a = !1, l = 1, n = 1, o = [0], s = q, d = q, h = q, g = q, c = q;
|
|
195
|
+
function u(r) {
|
|
196
|
+
return r.x0 = r.y0 = 0, r.x1 = l, r.y1 = n, r.eachBefore(b), o = [0], a && r.eachBefore(Xe), r;
|
|
197
|
+
}
|
|
198
|
+
function b(r) {
|
|
199
|
+
var x = o[r.depth], S = r.x0 + x, v = r.y0 + x, p = r.x1 - x, m = r.y1 - x;
|
|
200
|
+
p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), r.x0 = S, r.y0 = v, r.x1 = p, r.y1 = m, r.children && (x = o[r.depth + 1] = s(r) / 2, S += c(r) - x, v += d(r) - x, p -= h(r) - x, m -= g(r) - x, p < S && (S = p = (S + p) / 2), m < v && (v = m = (v + m) / 2), t(r, S, v, p, m));
|
|
201
|
+
}
|
|
202
|
+
return u.round = function(r) {
|
|
203
|
+
return arguments.length ? (a = !!r, u) : a;
|
|
204
|
+
}, u.size = function(r) {
|
|
205
|
+
return arguments.length ? (l = +r[0], n = +r[1], u) : [l, n];
|
|
206
|
+
}, u.tile = function(r) {
|
|
207
|
+
return arguments.length ? (t = Ge(r), u) : t;
|
|
208
|
+
}, u.padding = function(r) {
|
|
209
|
+
return arguments.length ? u.paddingInner(r).paddingOuter(r) : u.paddingInner();
|
|
210
|
+
}, u.paddingInner = function(r) {
|
|
211
|
+
return arguments.length ? (s = typeof r == "function" ? r : G(+r), u) : s;
|
|
212
|
+
}, u.paddingOuter = function(r) {
|
|
213
|
+
return arguments.length ? u.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r) : u.paddingTop();
|
|
214
|
+
}, u.paddingTop = function(r) {
|
|
215
|
+
return arguments.length ? (d = typeof r == "function" ? r : G(+r), u) : d;
|
|
216
|
+
}, u.paddingRight = function(r) {
|
|
217
|
+
return arguments.length ? (h = typeof r == "function" ? r : G(+r), u) : h;
|
|
218
|
+
}, u.paddingBottom = function(r) {
|
|
219
|
+
return arguments.length ? (g = typeof r == "function" ? r : G(+r), u) : g;
|
|
220
|
+
}, u.paddingLeft = function(r) {
|
|
221
|
+
return arguments.length ? (c = typeof r == "function" ? r : G(+r), u) : c;
|
|
222
|
+
}, u;
|
|
223
|
+
}
|
|
224
|
+
var E, ne = (E = class {
|
|
225
|
+
constructor() {
|
|
226
|
+
this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.setAccTitle = pe, this.getAccTitle = fe, this.setDiagramTitle = ge, this.getDiagramTitle = me, this.getAccDescription = ye, this.setAccDescription = Se;
|
|
227
|
+
}
|
|
228
|
+
getNodes() {
|
|
229
|
+
return this.nodes;
|
|
230
|
+
}
|
|
231
|
+
getConfig() {
|
|
232
|
+
const a = ve, l = ae();
|
|
233
|
+
return te({
|
|
234
|
+
...a.treemap,
|
|
235
|
+
...l.treemap ?? {}
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
addNode(a, l) {
|
|
239
|
+
this.nodes.push(a), this.levels.set(a, l), l === 0 && (this.outerNodes.push(a), this.root ?? (this.root = a));
|
|
240
|
+
}
|
|
241
|
+
getRoot() {
|
|
242
|
+
return { name: "", children: this.outerNodes };
|
|
243
|
+
}
|
|
244
|
+
addClass(a, l) {
|
|
245
|
+
const n = this.classes.get(a) ?? { id: a, styles: [], textStyles: [] }, o = l.replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";");
|
|
246
|
+
o && o.forEach((s) => {
|
|
247
|
+
xe(s) && (n != null && n.textStyles ? n.textStyles.push(s) : n.textStyles = [s]), n != null && n.styles ? n.styles.push(s) : n.styles = [s];
|
|
248
|
+
}), this.classes.set(a, n);
|
|
249
|
+
}
|
|
250
|
+
getClasses() {
|
|
251
|
+
return this.classes;
|
|
252
|
+
}
|
|
253
|
+
getStylesForClass(a) {
|
|
254
|
+
var l;
|
|
255
|
+
return ((l = this.classes.get(a)) == null ? void 0 : l.styles) ?? [];
|
|
256
|
+
}
|
|
257
|
+
clear() {
|
|
258
|
+
be(), this.nodes = [], this.levels = /* @__PURE__ */ new Map(), this.outerNodes = [], this.classes = /* @__PURE__ */ new Map(), this.root = void 0;
|
|
259
|
+
}
|
|
260
|
+
}, w(E, "TreeMapDB"), E);
|
|
261
|
+
function le(t) {
|
|
262
|
+
if (!t.length)
|
|
263
|
+
return [];
|
|
264
|
+
const a = [], l = [];
|
|
265
|
+
return t.forEach((n) => {
|
|
266
|
+
const o = {
|
|
267
|
+
name: n.name,
|
|
268
|
+
children: n.type === "Leaf" ? void 0 : []
|
|
269
|
+
};
|
|
270
|
+
for (o.classSelector = n == null ? void 0 : n.classSelector, n != null && n.cssCompiledStyles && (o.cssCompiledStyles = [n.cssCompiledStyles]), n.type === "Leaf" && n.value !== void 0 && (o.value = n.value); l.length > 0 && l[l.length - 1].level >= n.level; )
|
|
271
|
+
l.pop();
|
|
272
|
+
if (l.length === 0)
|
|
273
|
+
a.push(o);
|
|
274
|
+
else {
|
|
275
|
+
const s = l[l.length - 1].node;
|
|
276
|
+
s.children ? s.children.push(o) : s.children = [o];
|
|
277
|
+
}
|
|
278
|
+
n.type !== "Leaf" && l.push({ node: o, level: n.level });
|
|
279
|
+
}), a;
|
|
280
|
+
}
|
|
281
|
+
w(le, "buildHierarchy");
|
|
282
|
+
var Qe = /* @__PURE__ */ w((t, a) => {
|
|
283
|
+
Ce(t, a);
|
|
284
|
+
const l = [];
|
|
285
|
+
for (const s of t.TreemapRows ?? [])
|
|
286
|
+
s.$type === "ClassDefStatement" && a.addClass(s.className ?? "", s.styleText ?? "");
|
|
287
|
+
for (const s of t.TreemapRows ?? []) {
|
|
288
|
+
const d = s.item;
|
|
289
|
+
if (!d)
|
|
290
|
+
continue;
|
|
291
|
+
const h = s.indent ? parseInt(s.indent) : 0, g = et(d), c = d.classSelector ? a.getStylesForClass(d.classSelector) : [], u = c.length > 0 ? c.join(";") : void 0, b = {
|
|
292
|
+
level: h,
|
|
293
|
+
name: g,
|
|
294
|
+
type: d.$type,
|
|
295
|
+
value: d.value,
|
|
296
|
+
classSelector: d.classSelector,
|
|
297
|
+
cssCompiledStyles: u
|
|
298
|
+
};
|
|
299
|
+
l.push(b);
|
|
300
|
+
}
|
|
301
|
+
const n = le(l), o = /* @__PURE__ */ w((s, d) => {
|
|
302
|
+
for (const h of s)
|
|
303
|
+
a.addNode(h, d), h.children && h.children.length > 0 && o(h.children, d + 1);
|
|
304
|
+
}, "addNodesRecursively");
|
|
305
|
+
o(n, 0);
|
|
306
|
+
}, "populate"), et = /* @__PURE__ */ w((t) => t.name ? String(t.name) : "", "getItemName"), re = {
|
|
307
|
+
// @ts-expect-error - TreeMapDB is not assignable to DiagramDB
|
|
308
|
+
parser: { yy: void 0 },
|
|
309
|
+
parse: /* @__PURE__ */ w(async (t) => {
|
|
310
|
+
var a;
|
|
311
|
+
try {
|
|
312
|
+
const n = await Te("treemap", t);
|
|
313
|
+
K.debug("Treemap AST:", n);
|
|
314
|
+
const o = (a = re.parser) == null ? void 0 : a.yy;
|
|
315
|
+
if (!(o instanceof ne))
|
|
316
|
+
throw new Error(
|
|
317
|
+
"parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues."
|
|
318
|
+
);
|
|
319
|
+
Qe(n, o);
|
|
320
|
+
} catch (l) {
|
|
321
|
+
throw K.error("Error parsing treemap:", l), l;
|
|
322
|
+
}
|
|
323
|
+
}, "parse")
|
|
324
|
+
}, tt = 10, B = 10, X = 25, at = /* @__PURE__ */ w((t, a, l, n) => {
|
|
325
|
+
const o = n.db, s = o.getConfig(), d = s.padding ?? tt, h = o.getDiagramTitle(), g = o.getRoot(), { themeVariables: c } = ae();
|
|
326
|
+
if (!g)
|
|
327
|
+
return;
|
|
328
|
+
const u = h ? 30 : 0, b = he(a), r = s.nodeWidth ? s.nodeWidth * B : 960, x = s.nodeHeight ? s.nodeHeight * B : 500, S = r, v = x + u;
|
|
329
|
+
b.attr("viewBox", `0 0 ${S} ${v}`), ue(b, v, S, s.useMaxWidth);
|
|
330
|
+
let p;
|
|
331
|
+
try {
|
|
332
|
+
const e = s.valueFormat || ",";
|
|
333
|
+
if (e === "$0,0")
|
|
334
|
+
p = /* @__PURE__ */ w((i) => "$" + O(",")(i), "valueFormat");
|
|
335
|
+
else if (e.startsWith("$") && e.includes(",")) {
|
|
336
|
+
const i = /\.\d+/.exec(e), f = i ? i[0] : "";
|
|
337
|
+
p = /* @__PURE__ */ w((C) => "$" + O("," + f)(C), "valueFormat");
|
|
338
|
+
} else if (e.startsWith("$")) {
|
|
339
|
+
const i = e.substring(1);
|
|
340
|
+
p = /* @__PURE__ */ w((f) => "$" + O(i || "")(f), "valueFormat");
|
|
341
|
+
} else
|
|
342
|
+
p = O(e);
|
|
343
|
+
} catch (e) {
|
|
344
|
+
K.error("Error creating format function:", e), p = O(",");
|
|
345
|
+
}
|
|
346
|
+
const m = J().range([
|
|
347
|
+
"transparent",
|
|
348
|
+
c.cScale0,
|
|
349
|
+
c.cScale1,
|
|
350
|
+
c.cScale2,
|
|
351
|
+
c.cScale3,
|
|
352
|
+
c.cScale4,
|
|
353
|
+
c.cScale5,
|
|
354
|
+
c.cScale6,
|
|
355
|
+
c.cScale7,
|
|
356
|
+
c.cScale8,
|
|
357
|
+
c.cScale9,
|
|
358
|
+
c.cScale10,
|
|
359
|
+
c.cScale11
|
|
360
|
+
]), N = J().range([
|
|
361
|
+
"transparent",
|
|
362
|
+
c.cScalePeer0,
|
|
363
|
+
c.cScalePeer1,
|
|
364
|
+
c.cScalePeer2,
|
|
365
|
+
c.cScalePeer3,
|
|
366
|
+
c.cScalePeer4,
|
|
367
|
+
c.cScalePeer5,
|
|
368
|
+
c.cScalePeer6,
|
|
369
|
+
c.cScalePeer7,
|
|
370
|
+
c.cScalePeer8,
|
|
371
|
+
c.cScalePeer9,
|
|
372
|
+
c.cScalePeer10,
|
|
373
|
+
c.cScalePeer11
|
|
374
|
+
]), k = J().range([
|
|
375
|
+
c.cScaleLabel0,
|
|
376
|
+
c.cScaleLabel1,
|
|
377
|
+
c.cScaleLabel2,
|
|
378
|
+
c.cScaleLabel3,
|
|
379
|
+
c.cScaleLabel4,
|
|
380
|
+
c.cScaleLabel5,
|
|
381
|
+
c.cScaleLabel6,
|
|
382
|
+
c.cScaleLabel7,
|
|
383
|
+
c.cScaleLabel8,
|
|
384
|
+
c.cScaleLabel9,
|
|
385
|
+
c.cScaleLabel10,
|
|
386
|
+
c.cScaleLabel11
|
|
387
|
+
]);
|
|
388
|
+
h && b.append("text").attr("x", S / 2).attr("y", u / 2).attr("class", "treemapTitle").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(h);
|
|
389
|
+
const V = b.append("g").attr("transform", `translate(0, ${u})`).attr("class", "treemapContainer"), R = Q(g).sum((e) => e.value ?? 0).sort((e, i) => (i.value ?? 0) - (e.value ?? 0)), ee = Ke().size([r, x]).paddingTop(
|
|
390
|
+
(e) => e.children && e.children.length > 0 ? X + B : 0
|
|
391
|
+
).paddingInner(d).paddingLeft((e) => e.children && e.children.length > 0 ? B : 0).paddingRight((e) => e.children && e.children.length > 0 ? B : 0).paddingBottom((e) => e.children && e.children.length > 0 ? B : 0).round(!0)(R), se = ee.descendants().filter((e) => e.children && e.children.length > 0), W = V.selectAll(".treemapSection").data(se).enter().append("g").attr("class", "treemapSection").attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
392
|
+
W.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", X).attr("class", "treemapSectionHeader").attr("fill", "none").attr("fill-opacity", 0.6).attr("stroke-width", 0.6).attr("style", (e) => e.depth === 0 ? "display: none;" : ""), W.append("clipPath").attr("id", (e, i) => `clip-section-${a}-${i}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 12)).attr("height", X), W.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", (e, i) => `treemapSection section${i}`).attr("fill", (e) => m(e.data.name)).attr("fill-opacity", 0.6).attr("stroke", (e) => N(e.data.name)).attr("stroke-width", 2).attr("stroke-opacity", 0.4).attr("style", (e) => {
|
|
393
|
+
if (e.depth === 0)
|
|
394
|
+
return "display: none;";
|
|
395
|
+
const i = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
396
|
+
return i.nodeStyles + ";" + i.borderStyles.join(";");
|
|
397
|
+
}), W.append("text").attr("class", "treemapSectionLabel").attr("x", 6).attr("y", X / 2).attr("dominant-baseline", "middle").text((e) => e.depth === 0 ? "" : e.data.name).attr("font-weight", "bold").attr("style", (e) => {
|
|
398
|
+
if (e.depth === 0)
|
|
399
|
+
return "display: none;";
|
|
400
|
+
const i = "dominant-baseline: middle; font-size: 12px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
401
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
402
|
+
}).each(function(e) {
|
|
403
|
+
if (e.depth === 0)
|
|
404
|
+
return;
|
|
405
|
+
const i = Y(this), f = e.data.name;
|
|
406
|
+
i.text(f);
|
|
407
|
+
const C = e.x1 - e.x0, $ = 6;
|
|
408
|
+
let A;
|
|
409
|
+
s.showValues !== !1 && e.value ? A = C - 10 - 30 - 10 - $ : A = C - $ - 6;
|
|
410
|
+
const F = Math.max(15, A), y = i.node();
|
|
411
|
+
if (y.getComputedTextLength() > F) {
|
|
412
|
+
const T = "...";
|
|
413
|
+
let L = f;
|
|
414
|
+
for (; L.length > 0; ) {
|
|
415
|
+
if (L = f.substring(0, L.length - 1), L.length === 0) {
|
|
416
|
+
i.text(T), y.getComputedTextLength() > F && i.text("");
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
if (i.text(L + T), y.getComputedTextLength() <= F)
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}), s.showValues !== !1 && W.append("text").attr("class", "treemapSectionValue").attr("x", (e) => e.x1 - e.x0 - 10).attr("y", X / 2).attr("text-anchor", "end").attr("dominant-baseline", "middle").text((e) => e.value ? p(e.value) : "").attr("font-style", "italic").attr("style", (e) => {
|
|
424
|
+
if (e.depth === 0)
|
|
425
|
+
return "display: none;";
|
|
426
|
+
const i = "text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:" + k(e.data.name) + "; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
427
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
428
|
+
});
|
|
429
|
+
const ie = ee.leaves(), j = V.selectAll(".treemapLeafGroup").data(ie).enter().append("g").attr("class", (e, i) => `treemapNode treemapLeafGroup leaf${i}${e.data.classSelector ? ` ${e.data.classSelector}` : ""}x`).attr("transform", (e) => `translate(${e.x0},${e.y0})`);
|
|
430
|
+
j.append("rect").attr("width", (e) => e.x1 - e.x0).attr("height", (e) => e.y1 - e.y0).attr("class", "treemapLeaf").attr("fill", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("style", (e) => P({ cssCompiledStyles: e.data.cssCompiledStyles }).nodeStyles).attr("fill-opacity", 0.3).attr("stroke", (e) => e.parent ? m(e.parent.data.name) : m(e.data.name)).attr("stroke-width", 3), j.append("clipPath").attr("id", (e, i) => `clip-${a}-${i}`).append("rect").attr("width", (e) => Math.max(0, e.x1 - e.x0 - 4)).attr("height", (e) => Math.max(0, e.y1 - e.y0 - 4)), j.append("text").attr("class", "treemapLabel").attr("x", (e) => (e.x1 - e.x0) / 2).attr("y", (e) => (e.y1 - e.y0) / 2).attr("style", (e) => {
|
|
431
|
+
const i = "text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:" + k(e.data.name) + ";", f = P({ cssCompiledStyles: e.data.cssCompiledStyles });
|
|
432
|
+
return i + f.labelStyles.replace("color:", "fill:");
|
|
433
|
+
}).attr("clip-path", (e, i) => `url(#clip-${a}-${i})`).text((e) => e.data.name).each(function(e) {
|
|
434
|
+
const i = Y(this), f = e.x1 - e.x0, C = e.y1 - e.y0, $ = i.node(), A = 4, D = f - 2 * A, F = C - 2 * A;
|
|
435
|
+
if (D < 10 || F < 10) {
|
|
436
|
+
i.style("display", "none");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
let y = parseInt(i.style("font-size"), 10);
|
|
440
|
+
const _ = 8, T = 28, L = 0.6, z = 6, H = 2;
|
|
441
|
+
for (; $.getComputedTextLength() > D && y > _; )
|
|
442
|
+
y--, i.style("font-size", `${y}px`);
|
|
443
|
+
let I = Math.max(
|
|
444
|
+
z,
|
|
445
|
+
Math.min(T, Math.round(y * L))
|
|
446
|
+
), Z = y + H + I;
|
|
447
|
+
for (; Z > F && y > _ && (y--, I = Math.max(
|
|
448
|
+
z,
|
|
449
|
+
Math.min(T, Math.round(y * L))
|
|
450
|
+
), !(I < z && y === _)); )
|
|
451
|
+
i.style("font-size", `${y}px`), Z = y + H + I;
|
|
452
|
+
i.style("font-size", `${y}px`), ($.getComputedTextLength() > D || y < _ || F < y) && i.style("display", "none");
|
|
453
|
+
}), s.showValues !== !1 && j.append("text").attr("class", "treemapValue").attr("x", (i) => (i.x1 - i.x0) / 2).attr("y", function(i) {
|
|
454
|
+
return (i.y1 - i.y0) / 2;
|
|
455
|
+
}).attr("style", (i) => {
|
|
456
|
+
const f = "text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:" + k(i.data.name) + ";", C = P({ cssCompiledStyles: i.data.cssCompiledStyles });
|
|
457
|
+
return f + C.labelStyles.replace("color:", "fill:");
|
|
458
|
+
}).attr("clip-path", (i, f) => `url(#clip-${a}-${f})`).text((i) => i.value ? p(i.value) : "").each(function(i) {
|
|
459
|
+
const f = Y(this), C = this.parentNode;
|
|
460
|
+
if (!C) {
|
|
461
|
+
f.style("display", "none");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const $ = Y(C).select(".treemapLabel");
|
|
465
|
+
if ($.empty() || $.style("display") === "none") {
|
|
466
|
+
f.style("display", "none");
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const A = parseFloat($.style("font-size")), D = 28, F = 0.6, y = 6, _ = 2, T = Math.max(
|
|
470
|
+
y,
|
|
471
|
+
Math.min(D, Math.round(A * F))
|
|
472
|
+
);
|
|
473
|
+
f.style("font-size", `${T}px`);
|
|
474
|
+
const z = (i.y1 - i.y0) / 2 + A / 2 + _;
|
|
475
|
+
f.attr("y", z);
|
|
476
|
+
const H = i.x1 - i.x0, ce = i.y1 - i.y0 - 4, de = H - 2 * 4;
|
|
477
|
+
f.node().getComputedTextLength() > de || z + T > ce || T < y ? f.style("display", "none") : f.style("display", null);
|
|
478
|
+
});
|
|
479
|
+
const oe = s.diagramPadding ?? 8;
|
|
480
|
+
we(b, oe, "flowchart", (s == null ? void 0 : s.useMaxWidth) || !1);
|
|
481
|
+
}, "draw"), nt = /* @__PURE__ */ w(function(t, a) {
|
|
482
|
+
return a.db.getClasses();
|
|
483
|
+
}, "getClasses"), lt = { draw: at, getClasses: nt }, rt = {
|
|
484
|
+
sectionStrokeColor: "black",
|
|
485
|
+
sectionStrokeWidth: "1",
|
|
486
|
+
sectionFillColor: "#efefef",
|
|
487
|
+
leafStrokeColor: "black",
|
|
488
|
+
leafStrokeWidth: "1",
|
|
489
|
+
leafFillColor: "#efefef",
|
|
490
|
+
labelColor: "black",
|
|
491
|
+
labelFontSize: "12px",
|
|
492
|
+
valueFontSize: "10px",
|
|
493
|
+
valueColor: "black",
|
|
494
|
+
titleColor: "black",
|
|
495
|
+
titleFontSize: "14px"
|
|
496
|
+
}, st = /* @__PURE__ */ w(({
|
|
497
|
+
treemap: t
|
|
498
|
+
} = {}) => {
|
|
499
|
+
const a = te(rt, t);
|
|
500
|
+
return `
|
|
501
|
+
.treemapNode.section {
|
|
502
|
+
stroke: ${a.sectionStrokeColor};
|
|
503
|
+
stroke-width: ${a.sectionStrokeWidth};
|
|
504
|
+
fill: ${a.sectionFillColor};
|
|
505
|
+
}
|
|
506
|
+
.treemapNode.leaf {
|
|
507
|
+
stroke: ${a.leafStrokeColor};
|
|
508
|
+
stroke-width: ${a.leafStrokeWidth};
|
|
509
|
+
fill: ${a.leafFillColor};
|
|
510
|
+
}
|
|
511
|
+
.treemapLabel {
|
|
512
|
+
fill: ${a.labelColor};
|
|
513
|
+
font-size: ${a.labelFontSize};
|
|
514
|
+
}
|
|
515
|
+
.treemapValue {
|
|
516
|
+
fill: ${a.valueColor};
|
|
517
|
+
font-size: ${a.valueFontSize};
|
|
518
|
+
}
|
|
519
|
+
.treemapTitle {
|
|
520
|
+
fill: ${a.titleColor};
|
|
521
|
+
font-size: ${a.titleFontSize};
|
|
522
|
+
}
|
|
523
|
+
`;
|
|
524
|
+
}, "getStyles"), it = st, gt = {
|
|
525
|
+
parser: re,
|
|
526
|
+
get db() {
|
|
527
|
+
return new ne();
|
|
528
|
+
},
|
|
529
|
+
renderer: lt,
|
|
530
|
+
styles: it
|
|
531
|
+
};
|
|
532
|
+
export {
|
|
533
|
+
gt as diagram
|
|
534
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./mermaid.core-CCMj67LO.cjs"),se=require("./chunk-QN33PNHL-DBsOH5IO.cjs"),ie=require("./chunk-4BX2VUAB-BT8x_a4k.cjs"),oe=require("./treemap-KMMF4GRG-DJHv4WOZ.cjs"),I=require("./defaultLocale-C4wbwF1n.cjs"),U=require("./ordinal-CagbB1m8.cjs");function ce(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function de(){return this.eachAfter(ce)}function ue(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function he(t,a){for(var l=this,n=[l],o,s,d=-1;l=n.pop();)if(t.call(a,l,++d,this),o=l.children)for(s=o.length-1;s>=0;--s)n.push(o[s]);return this}function pe(t,a){for(var l=this,n=[l],o=[],s,d,h,m=-1;l=n.pop();)if(o.push(l),s=l.children)for(d=0,h=s.length;d<h;++d)n.push(s[d]);for(;l=o.pop();)t.call(a,l,++m,this);return this}function fe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function ge(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,o=n&&n.length;--o>=0;)l+=n[o].value;a.value=l})}function me(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function ye(t){for(var a=this,l=Se(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var o=n.length;t!==l;)n.splice(o,0,t),t=t.parent;return n}function Se(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),o=null;for(t=l.pop(),a=n.pop();t===a;)o=t,t=l.pop(),a=n.pop();return o}function ve(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function xe(){return Array.from(this)}function be(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function we(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*Ce(){var t=this,a,l=[t],n,o,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(o=0,s=n.length;o<s;++o)l.push(n[o]);while(l.length)}function K(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=Le)):a===void 0&&(a=Te);for(var l=new j(t),n,o=[l],s,d,h,m;n=o.pop();)if((d=a(n.data))&&(m=(d=Array.from(d)).length))for(n.children=d,h=m-1;h>=0;--h)o.push(s=d[h]=new j(d[h])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ae)}function _e(){return K(this).eachBefore($e)}function Te(t){return t.children}function Le(t){return Array.isArray(t)?t[1]:null}function $e(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ae(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function j(t){this.data=t,this.depth=this.height=0,this.parent=null}j.prototype=K.prototype={constructor:j,count:de,each:ue,eachAfter:pe,eachBefore:he,find:fe,sum:ge,sort:me,path:ye,ancestors:ve,descendants:xe,leaves:be,links:we,copy:_e,[Symbol.iterator]:Ce};function Me(t){if(typeof t!="function")throw new Error;return t}function q(){return 0}function O(t){return function(){return t}}function ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Ne(t,a,l,n,o){for(var s=t.children,d,h=-1,m=s.length,c=t.value&&(n-a)/t.value;++h<m;)d=s[h],d.y0=l,d.y1=o,d.x0=a,d.x1=a+=d.value*c}function Fe(t,a,l,n,o){for(var s=t.children,d,h=-1,m=s.length,c=t.value&&(o-l)/t.value;++h<m;)d=s[h],d.x0=a,d.x1=n,d.y0=l,d.y1=l+=d.value*c}var ze=(1+Math.sqrt(5))/2;function Ve(t,a,l,n,o,s){for(var d=[],h=a.children,m,c,p=0,w=0,r=h.length,b,v,x=a.value,f,y,k,M,V,R,N;p<r;){b=o-l,v=s-n;do f=h[w++].value;while(!f&&w<r);for(y=k=f,R=Math.max(v/b,b/v)/(x*t),N=f*f*R,V=Math.max(k/N,N/y);w<r;++w){if(f+=c=h[w].value,c<y&&(y=c),c>k&&(k=c),N=f*f*R,M=Math.max(k/N,N/y),M>V){f-=c;break}V=M}d.push(m={value:f,dice:b<v,children:h.slice(p,w)}),m.dice?Ne(m,l,n,o,x?n+=v*f/x:s):Fe(m,l,n,x?l+=b*f/x:o,s),x-=f,p=w}return d}const Pe=function t(a){function l(n,o,s,d,h){Ve(a,n,o,s,d,h)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l}(ze);function Be(){var t=Pe,a=!1,l=1,n=1,o=[0],s=q,d=q,h=q,m=q,c=q;function p(r){return r.x0=r.y0=0,r.x1=l,r.y1=n,r.eachBefore(w),o=[0],a&&r.eachBefore(ke),r}function w(r){var b=o[r.depth],v=r.x0+b,x=r.y0+b,f=r.x1-b,y=r.y1-b;f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),r.x0=v,r.y0=x,r.x1=f,r.y1=y,r.children&&(b=o[r.depth+1]=s(r)/2,v+=c(r)-b,x+=d(r)-b,f-=h(r)-b,y-=m(r)-b,f<v&&(v=f=(v+f)/2),y<x&&(x=y=(x+y)/2),t(r,v,x,f,y))}return p.round=function(r){return arguments.length?(a=!!r,p):a},p.size=function(r){return arguments.length?(l=+r[0],n=+r[1],p):[l,n]},p.tile=function(r){return arguments.length?(t=Me(r),p):t},p.padding=function(r){return arguments.length?p.paddingInner(r).paddingOuter(r):p.paddingInner()},p.paddingInner=function(r){return arguments.length?(s=typeof r=="function"?r:O(+r),p):s},p.paddingOuter=function(r){return arguments.length?p.paddingTop(r).paddingRight(r).paddingBottom(r).paddingLeft(r):p.paddingTop()},p.paddingTop=function(r){return arguments.length?(d=typeof r=="function"?r:O(+r),p):d},p.paddingRight=function(r){return arguments.length?(h=typeof r=="function"?r:O(+r),p):h},p.paddingBottom=function(r){return arguments.length?(m=typeof r=="function"?r:O(+r),p):m},p.paddingLeft=function(r){return arguments.length?(c=typeof r=="function"?r:O(+r),p):c},p}var D,Z=(D=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=u.setAccTitle,this.getAccTitle=u.getAccTitle,this.setDiagramTitle=u.setDiagramTitle,this.getDiagramTitle=u.getDiagramTitle,this.getAccDescription=u.getAccDescription,this.setAccDescription=u.setAccDescription}getNodes(){return this.nodes}getConfig(){const a=u.defaultConfig_default,l=u.getConfig();return u.cleanAndMerge({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??(this.root=a))}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},o=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");o&&o.forEach(s=>{u.isLabelStyle(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){u.clear(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},u.__name(D,"TreeMapDB"),D);function J(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const o={name:n.name,children:n.type==="Leaf"?void 0:[]};for(o.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(o.cssCompiledStyles=[n.cssCompiledStyles]),n.type==="Leaf"&&n.value!==void 0&&(o.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(o);else{const s=l[l.length-1].node;s.children?s.children.push(o):s.children=[o]}n.type!=="Leaf"&&l.push({node:o,level:n.level})}),a}u.__name(J,"buildHierarchy");var De=u.__name((t,a)=>{ie.populateCommonDb(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const d=s.item;if(!d)continue;const h=s.indent?parseInt(s.indent):0,m=Re(d),c=d.classSelector?a.getStylesForClass(d.classSelector):[],p=c.length>0?c.join(";"):void 0,w={level:h,name:m,type:d.$type,value:d.value,classSelector:d.classSelector,cssCompiledStyles:p};l.push(w)}const n=J(l),o=u.__name((s,d)=>{for(const h of s)a.addNode(h,d),h.children&&h.children.length>0&&o(h.children,d+1)},"addNodesRecursively");o(n,0)},"populate"),Re=u.__name(t=>t.name?String(t.name):"","getItemName"),ee={parser:{yy:void 0},parse:u.__name(async t=>{var a;try{const l=oe.parse,n=await l("treemap",t);u.log.debug("Treemap AST:",n);const o=(a=ee.parser)==null?void 0:a.yy;if(!(o instanceof Z))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");De(n,o)}catch(l){throw u.log.error("Error parsing treemap:",l),l}},"parse")},Ee=10,B=10,G=25,We=u.__name((t,a,l,n)=>{const o=n.db,s=o.getConfig(),d=s.padding??Ee,h=o.getDiagramTitle(),m=o.getRoot(),{themeVariables:c}=u.getConfig();if(!m)return;const p=h?30:0,w=u.selectSvgElement(a),r=s.nodeWidth?s.nodeWidth*B:960,b=s.nodeHeight?s.nodeHeight*B:500,v=r,x=b+p;w.attr("viewBox",`0 0 ${v} ${x}`),u.configureSvgSize(w,x,v,s.useMaxWidth);let f;try{const e=s.valueFormat||",";if(e==="$0,0")f=u.__name(i=>"$"+I.format(",")(i),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const i=/\.\d+/.exec(e),g=i?i[0]:"";f=u.__name(C=>"$"+I.format(","+g)(C),"valueFormat")}else if(e.startsWith("$")){const i=e.substring(1);f=u.__name(g=>"$"+I.format(i||"")(g),"valueFormat")}else f=I.format(e)}catch(e){u.log.error("Error creating format function:",e),f=I.format(",")}const y=U.ordinal().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),k=U.ordinal().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),M=U.ordinal().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);h&&w.append("text").attr("x",v/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);const V=w.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),R=K(m).sum(e=>e.value??0).sort((e,i)=>(i.value??0)-(e.value??0)),Q=Be().size([r,b]).paddingTop(e=>e.children&&e.children.length>0?G+B:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?B:0).paddingRight(e=>e.children&&e.children.length>0?B:0).paddingBottom(e=>e.children&&e.children.length>0?B:0).round(!0)(R),te=Q.descendants().filter(e=>e.children&&e.children.length>0),E=V.selectAll(".treemapSection").data(te).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),E.append("clipPath").attr("id",(e,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",G),E.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,i)=>`treemapSection section${i}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>k(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const i=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),E.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("style",e=>{if(e.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+M(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const i=u.select(this),g=e.data.name;i.text(g);const C=e.x1-e.x0,L=6;let $;s.showValues!==!1&&e.value?$=C-10-30-10-L:$=C-L-6;const A=Math.max(15,$),S=i.node();if(S.getComputedTextLength()>A){const _="...";let T=g;for(;T.length>0;){if(T=g.substring(0,T.length-1),T.length===0){i.text(_),S.getComputedTextLength()>A&&i.text("");break}if(i.text(T+_),S.getComputedTextLength()<=A)break}}}),s.showValues!==!1&&E.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?f(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+M(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")});const ae=Q.leaves(),X=V.selectAll(".treemapLeafGroup").data(ae).enter().append("g").attr("class",(e,i)=>`treemapNode treemapLeafGroup leaf${i}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);X.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),X.append("clipPath").attr("id",(e,i)=>`clip-${a}-${i}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),X.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const i="text-anchor: middle; dominant-baseline: middle; font-size: 38px;fill:"+M(e.data.name)+";",g=u.styles2String({cssCompiledStyles:e.data.cssCompiledStyles});return i+g.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,i)=>`url(#clip-${a}-${i})`).text(e=>e.data.name).each(function(e){const i=u.select(this),g=e.x1-e.x0,C=e.y1-e.y0,L=i.node(),$=4,P=g-2*$,A=C-2*$;if(P<10||A<10){i.style("display","none");return}let S=parseInt(i.style("font-size"),10);const F=8,_=28,T=.6,z=6,W=2;for(;L.getComputedTextLength()>P&&S>F;)S--,i.style("font-size",`${S}px`);let H=Math.max(z,Math.min(_,Math.round(S*T))),Y=S+W+H;for(;Y>A&&S>F&&(S--,H=Math.max(z,Math.min(_,Math.round(S*T))),!(H<z&&S===F));)i.style("font-size",`${S}px`),Y=S+W+H;i.style("font-size",`${S}px`),(L.getComputedTextLength()>P||S<F||A<S)&&i.style("display","none")}),s.showValues!==!1&&X.append("text").attr("class","treemapValue").attr("x",i=>(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const g="text-anchor: middle; dominant-baseline: hanging; font-size: 28px;fill:"+M(i.data.name)+";",C=u.styles2String({cssCompiledStyles:i.data.cssCompiledStyles});return g+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,g)=>`url(#clip-${a}-${g})`).text(i=>i.value?f(i.value):"").each(function(i){const g=u.select(this),C=this.parentNode;if(!C){g.style("display","none");return}const L=u.select(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){g.style("display","none");return}const $=parseFloat(L.style("font-size")),P=28,A=.6,S=6,F=2,_=Math.max(S,Math.min(P,Math.round($*A)));g.style("font-size",`${_}px`);const z=(i.y1-i.y0)/2+$/2+F;g.attr("y",z);const W=i.x1-i.x0,le=i.y1-i.y0-4,re=W-2*4;g.node().getComputedTextLength()>re||z+_>le||_<S?g.style("display","none"):g.style("display",null)});const ne=s.diagramPadding??8;se.setupViewPortForSVG(w,ne,"flowchart",(s==null?void 0:s.useMaxWidth)||!1)},"draw"),He=u.__name(function(t,a){return a.db.getClasses()},"getClasses"),Ie={draw:We,getClasses:He},qe={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelColor:"black",labelFontSize:"12px",valueFontSize:"10px",valueColor:"black",titleColor:"black",titleFontSize:"14px"},Oe=u.__name(({treemap:t}={})=>{const a=u.cleanAndMerge(qe,t);return`
|
|
2
|
+
.treemapNode.section {
|
|
3
|
+
stroke: ${a.sectionStrokeColor};
|
|
4
|
+
stroke-width: ${a.sectionStrokeWidth};
|
|
5
|
+
fill: ${a.sectionFillColor};
|
|
6
|
+
}
|
|
7
|
+
.treemapNode.leaf {
|
|
8
|
+
stroke: ${a.leafStrokeColor};
|
|
9
|
+
stroke-width: ${a.leafStrokeWidth};
|
|
10
|
+
fill: ${a.leafFillColor};
|
|
11
|
+
}
|
|
12
|
+
.treemapLabel {
|
|
13
|
+
fill: ${a.labelColor};
|
|
14
|
+
font-size: ${a.labelFontSize};
|
|
15
|
+
}
|
|
16
|
+
.treemapValue {
|
|
17
|
+
fill: ${a.valueColor};
|
|
18
|
+
font-size: ${a.valueFontSize};
|
|
19
|
+
}
|
|
20
|
+
.treemapTitle {
|
|
21
|
+
fill: ${a.titleColor};
|
|
22
|
+
font-size: ${a.titleFontSize};
|
|
23
|
+
}
|
|
24
|
+
`},"getStyles"),Ge=Oe,Xe={parser:ee,get db(){return new Z},renderer:Ie,styles:Ge};exports.diagram=Xe;
|