hub-ui-x 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +5 -0
  2. package/dist/_basePickBy-C1WsytTM.js +151 -0
  3. package/dist/_baseUniq-CGQBVjq6.js +614 -0
  4. package/dist/arc-CfWEFjh8.js +84 -0
  5. package/dist/architecture-4AB2E3PP-DcT_AgQk.js +5 -0
  6. package/dist/architectureDiagram-IEHRJDOE-HOxolPJX.js +4635 -0
  7. package/dist/blockDiagram-JOT3LUYC-DOUpbN2x.js +2248 -0
  8. package/dist/c4Diagram-VJAJSXHY-BFAcC0i5.js +1582 -0
  9. package/dist/channel-Cu0z2gst.js +5 -0
  10. package/dist/chart-CJ_SRNKN.js +9241 -0
  11. package/dist/chunk-4BMEZGHF-BBaiA8MA.js +9 -0
  12. package/dist/chunk-A2AXSNBT-BWpKSYi4.js +1373 -0
  13. package/dist/chunk-AEK57VVT-doTsaHuQ.js +1415 -0
  14. package/dist/chunk-D6G4REZN-B6Iq6yid.js +64 -0
  15. package/dist/chunk-RZ5BOZE2-OspkSZtw.js +25 -0
  16. package/dist/chunk-XZIHB7SX-BTYIr8g5.js +15 -0
  17. package/dist/classDiagram-GIVACNV2-B_ES2mS7.js +17 -0
  18. package/dist/classDiagram-v2-COTLJTTW-B_ES2mS7.js +17 -0
  19. package/dist/clone-BZBtMp_G.js +8 -0
  20. package/dist/colors-BD7LS4qt.js +7 -0
  21. package/dist/cytoscape.esm-Swd9B-1A.js +18633 -0
  22. package/dist/dagre-OKDRZEBW-qXmKnSET.js +447 -0
  23. package/dist/diagram-SSKATNLV-D9zp03W0.js +221 -0
  24. package/dist/diagram-VNBRO52H-CBXg8AYQ.js +126 -0
  25. package/dist/download-B6Cbg_6N.js +39 -0
  26. package/dist/echarts-CvKQD1G1.js +44028 -0
  27. package/dist/erDiagram-Q7BY3M3F-BOJJGO7u.js +842 -0
  28. package/dist/flowDiagram-4HSFHLVR-jSArwKHg.js +1623 -0
  29. package/dist/ganttDiagram-APWFNJXF-DlkSU7D9.js +2472 -0
  30. package/dist/gitGraph-O2Q2CXLX-BKCeQqs8.js +5 -0
  31. package/dist/gitGraphDiagram-7IBYFJ6S-DUvZEq_S.js +713 -0
  32. package/dist/graph-zFu0gYaZ.js +247 -0
  33. package/dist/helper-C5NlRbA2.js +13 -0
  34. package/dist/hub-ui-x.css +1 -0
  35. package/dist/hub-ui-x.es.ts +5 -0
  36. package/dist/hub-ui-x.umd.ts +3258 -0
  37. package/dist/index-evjDGH2n.js +62533 -0
  38. package/dist/info-4N47QTOZ-BYDGL7Ae.js +5 -0
  39. package/dist/infoDiagram-PH2N3AL5-DJvDYk-t.js +22 -0
  40. package/dist/init-DjUOC4st.js +16 -0
  41. package/dist/journeyDiagram-U35MCT3I---dClVe4.js +810 -0
  42. package/dist/kanban-definition-NDS4AKOZ-DPL_aBPT.js +719 -0
  43. package/dist/katex-9tX9hjoM.js +11692 -0
  44. package/dist/layout-BqSq5ofg.js +1324 -0
  45. package/dist/linear-fJjgKrP9.js +423 -0
  46. package/dist/mermaid-CZvYCPmi.js +14243 -0
  47. package/dist/mermaid-parser.core-Bz7ADZ88.js +12835 -0
  48. package/dist/min-DLf0xQMm.js +28 -0
  49. package/dist/mindmap-definition-ALO5MXBD-CzxIzyQv.js +3222 -0
  50. package/dist/mindmap-r94UHoYv.js +21909 -0
  51. package/dist/ordinal-DfAQgscy.js +61 -0
  52. package/dist/packet-KVYON367-D4di2cz5.js +5 -0
  53. package/dist/pie-R6RNRRYF-CcxAsT3F.js +5 -0
  54. package/dist/pieDiagram-IB7DONF6-B5HBkGlO.js +162 -0
  55. package/dist/quadrantDiagram-7GDLP6J5-BS5bmqKW.js +1025 -0
  56. package/dist/radar-MK3ICKWK-CVYy5goT.js +5 -0
  57. package/dist/requirementDiagram-KVF5MWMF-Cr8GcN4Y.js +851 -0
  58. package/dist/sankeyDiagram-QLVOVGJD-Bhq9k8_q.js +806 -0
  59. package/dist/sequenceDiagram-X6HHIX6F-CCmFoYyv.js +2282 -0
  60. package/dist/stateDiagram-DGXRK772-JkIqKyGq.js +271 -0
  61. package/dist/stateDiagram-v2-YXO3MK2T-DMxAxUZ1.js +17 -0
  62. package/dist/timeline-definition-BDJGKUSR-Bi42udQn.js +805 -0
  63. package/dist/transform-Bsa6BTXX.js +1834 -0
  64. package/dist/xychartDiagram-VJFVF3MP-BI97ppBM.js +1305 -0
  65. package/package.json +55 -0
@@ -0,0 +1,447 @@
1
+ import { _ as X, an as F, ao as Y, ap as _, aq as H, l as i, c as V, ar as q, as as U, ac as $, ah as z, ad as P, ab as K, at as Q, au as W, av as Z } from "./mermaid-CZvYCPmi.js";
2
+ import { G as B } from "./graph-zFu0gYaZ.js";
3
+ import { l as I } from "./layout-BqSq5ofg.js";
4
+ import { i as x } from "./_baseUniq-CGQBVjq6.js";
5
+ import { c as L } from "./clone-BZBtMp_G.js";
6
+ import { m as A } from "./_basePickBy-C1WsytTM.js";
7
+ function E(e) {
8
+ var t = {
9
+ options: {
10
+ directed: e.isDirected(),
11
+ multigraph: e.isMultigraph(),
12
+ compound: e.isCompound()
13
+ },
14
+ nodes: ee(e),
15
+ edges: ne(e)
16
+ };
17
+ return x(e.graph()) || (t.value = L(e.graph())), t;
18
+ }
19
+ function ee(e) {
20
+ return A(e.nodes(), function(t) {
21
+ var n = e.node(t), o = e.parent(t), c = { v: t };
22
+ return x(n) || (c.value = n), x(o) || (c.parent = o), c;
23
+ });
24
+ }
25
+ function ne(e) {
26
+ return A(e.edges(), function(t) {
27
+ var n = e.edge(t), o = { v: t.v, w: t.w };
28
+ return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o;
29
+ });
30
+ }
31
+ var f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ X(() => {
32
+ b.clear(), J.clear(), f.clear();
33
+ }, "clear"), O = /* @__PURE__ */ X((e, t) => {
34
+ const n = b.get(t) || [];
35
+ return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
36
+ }, "isDescendant"), se = /* @__PURE__ */ X((e, t) => {
37
+ const n = b.get(t) || [];
38
+ return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || O(e.v, t) || O(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1);
39
+ }, "edgeInCluster"), G = /* @__PURE__ */ X((e, t, n, o) => {
40
+ i.warn(
41
+ "Copying children of ",
42
+ e,
43
+ "root",
44
+ o,
45
+ "data",
46
+ t.node(e),
47
+ o
48
+ );
49
+ const c = t.children(e) || [];
50
+ e !== o && c.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => {
51
+ if (t.children(a).length > 0)
52
+ G(a, t, n, o);
53
+ else {
54
+ const r = t.node(a);
55
+ i.info("cp ", a, " to ", o, " with parent ", e), n.setNode(a, r), o !== t.parent(a) && (i.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== o && a !== e ? (i.debug("Setting parent", a, e), n.setParent(a, e)) : (i.info("In copy ", e, "root", o, "data", t.node(e), o), i.debug(
56
+ "Not Setting parent for node=",
57
+ a,
58
+ "cluster!==rootId",
59
+ e !== o,
60
+ "node!==clusterId",
61
+ a !== e
62
+ ));
63
+ const u = t.edges(a);
64
+ i.debug("Copying Edges", u), u.forEach((l) => {
65
+ i.info("Edge", l);
66
+ const v = t.edge(l.v, l.w, l.name);
67
+ i.info("Edge data", v, o);
68
+ try {
69
+ se(l, o) ? (i.info("Copying as ", l.v, l.w, v, l.name), n.setEdge(l.v, l.w, v, l.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
70
+ "Skipping copy of edge ",
71
+ l.v,
72
+ "-->",
73
+ l.w,
74
+ " rootId: ",
75
+ o,
76
+ " clusterId:",
77
+ e
78
+ );
79
+ } catch (C) {
80
+ i.error(C);
81
+ }
82
+ });
83
+ }
84
+ i.debug("Removing node", a), t.removeNode(a);
85
+ });
86
+ }, "copy"), R = /* @__PURE__ */ X((e, t) => {
87
+ const n = t.children(e);
88
+ let o = [...n];
89
+ for (const c of n)
90
+ J.set(c, e), o = [...o, ...R(c, t)];
91
+ return o;
92
+ }, "extractDescendants"), ie = /* @__PURE__ */ X((e, t, n) => {
93
+ const o = e.edges().filter((l) => l.v === t || l.w === t), c = e.edges().filter((l) => l.v === n || l.w === n), a = o.map((l) => ({ v: l.v === t ? n : l.v, w: l.w === t ? t : l.w })), r = c.map((l) => ({ v: l.v, w: l.w }));
94
+ return a.filter((l) => r.some((v) => l.v === v.v && l.w === v.w));
95
+ }, "findCommonEdges"), D = /* @__PURE__ */ X((e, t, n) => {
96
+ const o = t.children(e);
97
+ if (i.trace("Searching children of id ", e, o), o.length < 1)
98
+ return e;
99
+ let c;
100
+ for (const a of o) {
101
+ const r = D(a, t, n), u = ie(t, n, r);
102
+ if (r)
103
+ if (u.length > 0)
104
+ c = r;
105
+ else
106
+ return r;
107
+ }
108
+ return c;
109
+ }, "findNonClusterChild"), k = /* @__PURE__ */ X((e) => !f.has(e) || !f.get(e).externalConnections ? e : f.has(e) ? f.get(e).id : e, "getAnchorId"), re = /* @__PURE__ */ X((e, t) => {
110
+ if (!e || t > 10) {
111
+ i.debug("Opting out, no graph ");
112
+ return;
113
+ } else
114
+ i.debug("Opting in, graph ");
115
+ e.nodes().forEach(function(n) {
116
+ e.children(n).length > 0 && (i.warn(
117
+ "Cluster identified",
118
+ n,
119
+ " Replacement id in edges: ",
120
+ D(n, e, n)
121
+ ), b.set(n, R(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) }));
122
+ }), e.nodes().forEach(function(n) {
123
+ const o = e.children(n), c = e.edges();
124
+ o.length > 0 ? (i.debug("Cluster identified", n, b), c.forEach((a) => {
125
+ const r = O(a.v, n), u = O(a.w, n);
126
+ r ^ u && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", b.get(n)), f.get(n).externalConnections = !0);
127
+ })) : i.debug("Not a cluster ", n, b);
128
+ });
129
+ for (let n of f.keys()) {
130
+ const o = f.get(n).id, c = e.parent(o);
131
+ c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c);
132
+ }
133
+ e.edges().forEach(function(n) {
134
+ const o = e.edge(n);
135
+ i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
136
+ let c = n.v, a = n.w;
137
+ if (i.warn(
138
+ "Fix XXX",
139
+ f,
140
+ "ids:",
141
+ n.v,
142
+ n.w,
143
+ "Translating: ",
144
+ f.get(n.v),
145
+ " --- ",
146
+ f.get(n.w)
147
+ ), f.get(n.v) || f.get(n.w)) {
148
+ if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), c = k(n.v), a = k(n.w), e.removeEdge(n.v, n.w, n.name), c !== n.v) {
149
+ const r = e.parent(c);
150
+ f.get(r).externalConnections = !0, o.fromCluster = n.v;
151
+ }
152
+ if (a !== n.w) {
153
+ const r = e.parent(a);
154
+ f.get(r).externalConnections = !0, o.toCluster = n.w;
155
+ }
156
+ i.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name);
157
+ }
158
+ }), i.warn("Adjusted Graph", E(e)), T(e, 0), i.trace(f);
159
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ X((e, t) => {
160
+ var c, a;
161
+ if (i.warn("extractor - ", t, E(e), e.children("D")), t > 10) {
162
+ i.error("Bailing out");
163
+ return;
164
+ }
165
+ let n = e.nodes(), o = !1;
166
+ for (const r of n) {
167
+ const u = e.children(r);
168
+ o = o || u.length > 0;
169
+ }
170
+ if (!o) {
171
+ i.debug("Done, no node has children", e.nodes());
172
+ return;
173
+ }
174
+ i.debug("Nodes = ", n, t);
175
+ for (const r of n)
176
+ if (i.debug(
177
+ "Extracting node",
178
+ r,
179
+ f,
180
+ f.has(r) && !f.get(r).externalConnections,
181
+ !e.parent(r),
182
+ e.node(r),
183
+ e.children("D"),
184
+ " Depth ",
185
+ t
186
+ ), !f.has(r))
187
+ i.debug("Not a cluster", r, t);
188
+ else if (!f.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
189
+ i.warn(
190
+ "Cluster without external connections, without a parent and with children",
191
+ r,
192
+ t
193
+ );
194
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
195
+ (a = (c = f.get(r)) == null ? void 0 : c.clusterData) != null && a.dir && (l = f.get(r).clusterData.dir, i.warn("Fixing dir", f.get(r).clusterData.dir, l));
196
+ const v = new B({
197
+ multigraph: !0,
198
+ compound: !0
199
+ }).setGraph({
200
+ rankdir: l,
201
+ nodesep: 50,
202
+ ranksep: 50,
203
+ marginx: 8,
204
+ marginy: 8
205
+ }).setDefaultEdgeLabel(function() {
206
+ return {};
207
+ });
208
+ i.warn("Old graph before copy", E(e)), G(r, e, v, r), e.setNode(r, {
209
+ clusterNode: !0,
210
+ id: r,
211
+ clusterData: f.get(r).clusterData,
212
+ label: f.get(r).label,
213
+ graph: v
214
+ }), i.warn("New graph after copy node: (", r, ")", E(v)), i.debug("Old graph after copy", E(e));
215
+ } else
216
+ i.warn(
217
+ "Cluster ** ",
218
+ r,
219
+ " **not meeting the criteria !externalConnections:",
220
+ !f.get(r).externalConnections,
221
+ " no parent: ",
222
+ !e.parent(r),
223
+ " children ",
224
+ e.children(r) && e.children(r).length > 0,
225
+ e.children("D"),
226
+ t
227
+ ), i.debug(f);
228
+ n = e.nodes(), i.warn("New list of nodes", n);
229
+ for (const r of n) {
230
+ const u = e.node(r);
231
+ i.warn(" Now next level", r, u), u != null && u.clusterNode && T(u.graph, t + 1);
232
+ }
233
+ }, "extractor"), M = /* @__PURE__ */ X((e, t) => {
234
+ if (t.length === 0)
235
+ return [];
236
+ let n = Object.assign([], t);
237
+ return t.forEach((o) => {
238
+ const c = e.children(o), a = M(e, c);
239
+ n = [...n, ...a];
240
+ }), n;
241
+ }, "sorter"), oe = /* @__PURE__ */ X((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ X(async (e, t, n, o, c, a) => {
242
+ i.warn("Graph in recursive render:XAX", E(t), c);
243
+ const r = t.graph().rankdir;
244
+ i.trace("Dir in recursive render - dir:", r);
245
+ const u = e.insert("g").attr("class", "root");
246
+ t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0]));
247
+ const l = u.insert("g").attr("class", "clusters"), v = u.insert("g").attr("class", "edgePaths"), C = u.insert("g").attr("class", "edgeLabels"), g = u.insert("g").attr("class", "nodes");
248
+ await Promise.all(
249
+ t.nodes().map(async function(d) {
250
+ const s = t.node(d);
251
+ if (c !== void 0) {
252
+ const w = JSON.parse(JSON.stringify(c.clusterData));
253
+ i.trace(
254
+ `Setting data for parent cluster XXX
255
+ Node.id = `,
256
+ d,
257
+ `
258
+ data=`,
259
+ w.height,
260
+ `
261
+ Parent cluster`,
262
+ c.height
263
+ ), t.setNode(c.id, w), t.parent(d) || (i.trace("Setting parent", d, c.id), t.setParent(d, c.id, w));
264
+ }
265
+ if (i.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) {
266
+ i.info("Cluster identified XBX", d, s.width, t.node(d));
267
+ const { ranksep: w, nodesep: m } = t.graph();
268
+ s.graph.setGraph({
269
+ ...s.graph.graph(),
270
+ ranksep: w + 25,
271
+ nodesep: m
272
+ });
273
+ const N = await j(
274
+ g,
275
+ s.graph,
276
+ n,
277
+ o,
278
+ t.node(d),
279
+ a
280
+ ), S = N.elem;
281
+ q(s, S), s.diff = N.diff || 0, i.info(
282
+ "New compound node after recursive render XAX",
283
+ d,
284
+ "width",
285
+ // node,
286
+ s.width,
287
+ "height",
288
+ s.height
289
+ // node.x,
290
+ // node.y
291
+ ), U(S, s);
292
+ } else
293
+ t.children(d).length > 0 ? (i.trace(
294
+ "Cluster - the non recursive path XBX",
295
+ d,
296
+ s.id,
297
+ s,
298
+ s.width,
299
+ "Graph:",
300
+ t
301
+ ), i.trace(D(s.id, t)), f.set(s.id, { id: D(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", d, g, t.node(d), r), await $(g, t.node(d), { config: a, dir: r }));
302
+ })
303
+ ), await (/* @__PURE__ */ X(async () => {
304
+ const d = t.edges().map(async function(s) {
305
+ const w = t.edge(s.v, s.w, s.name);
306
+ i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info(
307
+ "Fix",
308
+ f,
309
+ "ids:",
310
+ s.v,
311
+ s.w,
312
+ "Translating: ",
313
+ f.get(s.v),
314
+ f.get(s.w)
315
+ ), await Z(C, w);
316
+ });
317
+ await Promise.all(d);
318
+ }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(E(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(E(t)));
319
+ let p = 0, { subGraphTitleTotalMargin: y } = z(a);
320
+ return await Promise.all(
321
+ oe(t).map(async function(d) {
322
+ var w;
323
+ const s = t.node(d);
324
+ if (i.info(
325
+ "Position XBX => " + d + ": (" + s.x,
326
+ "," + s.y,
327
+ ") width: ",
328
+ s.width,
329
+ " height: ",
330
+ s.height
331
+ ), s != null && s.clusterNode)
332
+ s.y += y, i.info(
333
+ "A tainted cluster node XBX1",
334
+ d,
335
+ s.id,
336
+ s.width,
337
+ s.height,
338
+ s.x,
339
+ s.y,
340
+ t.parent(d)
341
+ ), f.get(s.id).node = s, P(s);
342
+ else if (t.children(d).length > 0) {
343
+ i.info(
344
+ "A pure cluster node XBX1",
345
+ d,
346
+ s.id,
347
+ s.x,
348
+ s.y,
349
+ s.width,
350
+ s.height,
351
+ t.parent(d)
352
+ ), s.height += y, t.node(s.parentId);
353
+ const m = (s == null ? void 0 : s.padding) / 2 || 0, N = ((w = s == null ? void 0 : s.labelBBox) == null ? void 0 : w.height) || 0, S = N - m || 0;
354
+ i.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await K(l, s), f.get(s.id).node = s;
355
+ } else {
356
+ const m = t.node(s.parentId);
357
+ s.y += y / 2, i.info(
358
+ "A regular node XBX1 - using the padding",
359
+ s.id,
360
+ "parent",
361
+ s.parentId,
362
+ s.width,
363
+ s.height,
364
+ s.x,
365
+ s.y,
366
+ "offsetY",
367
+ s.offsetY,
368
+ "parent",
369
+ m,
370
+ m == null ? void 0 : m.offsetY,
371
+ s
372
+ ), P(s);
373
+ }
374
+ })
375
+ ), t.edges().forEach(function(d) {
376
+ const s = t.edge(d);
377
+ i.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += y / 2);
378
+ const w = t.node(d.v);
379
+ var m = t.node(d.w);
380
+ const N = Q(v, s, f, n, w, m, o);
381
+ W(s, N);
382
+ }), t.nodes().forEach(function(d) {
383
+ const s = t.node(d);
384
+ i.info(d, s.type, s.diff), s.isGroup && (p = s.diff);
385
+ }), i.warn("Returning from recursive render XAX", u, p), { elem: u, diff: p };
386
+ }, "recursiveRender"), ge = /* @__PURE__ */ X(async (e, t) => {
387
+ var a, r, u, l, v, C;
388
+ const n = new B({
389
+ multigraph: !0,
390
+ compound: !0
391
+ }).setGraph({
392
+ rankdir: e.direction,
393
+ nodesep: ((a = e.config) == null ? void 0 : a.nodeSpacing) || ((u = (r = e.config) == null ? void 0 : r.flowchart) == null ? void 0 : u.nodeSpacing) || e.nodeSpacing,
394
+ ranksep: ((l = e.config) == null ? void 0 : l.rankSpacing) || ((C = (v = e.config) == null ? void 0 : v.flowchart) == null ? void 0 : C.rankSpacing) || e.rankSpacing,
395
+ marginx: 8,
396
+ marginy: 8
397
+ }).setDefaultEdgeLabel(function() {
398
+ return {};
399
+ }), o = t.select("g");
400
+ F(o, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((g) => {
401
+ n.setNode(g.id, { ...g }), g.parentId && n.setParent(g.id, g.parentId);
402
+ }), i.debug("Edges:", e.edges), e.edges.forEach((g) => {
403
+ if (g.start === g.end) {
404
+ const h = g.start, p = h + "---" + h + "---1", y = h + "---" + h + "---2", d = n.node(h);
405
+ n.setNode(p, {
406
+ domId: p,
407
+ id: p,
408
+ parentId: d.parentId,
409
+ labelStyle: "",
410
+ label: "",
411
+ padding: 0,
412
+ shape: "labelRect",
413
+ // shape: 'rect',
414
+ style: "",
415
+ width: 10,
416
+ height: 10
417
+ }), n.setParent(p, d.parentId), n.setNode(y, {
418
+ domId: y,
419
+ id: y,
420
+ parentId: d.parentId,
421
+ labelStyle: "",
422
+ padding: 0,
423
+ // shape: 'rect',
424
+ shape: "labelRect",
425
+ label: "",
426
+ style: "",
427
+ width: 10,
428
+ height: 10
429
+ }), n.setParent(y, d.parentId);
430
+ const s = structuredClone(g), w = structuredClone(g), m = structuredClone(g);
431
+ s.label = "", s.arrowTypeEnd = "none", s.id = h + "-cyclic-special-1", w.arrowTypeStart = "none", w.arrowTypeEnd = "none", w.id = h + "-cyclic-special-mid", m.label = "", d.isGroup && (s.fromCluster = h, m.toCluster = h), m.id = h + "-cyclic-special-2", m.arrowTypeStart = "none", n.setEdge(h, p, s, h + "-cyclic-special-0"), n.setEdge(p, y, w, h + "-cyclic-special-1"), n.setEdge(y, h, m, h + "-cyc<lic-special-2");
432
+ } else
433
+ n.setEdge(g.start, g.end, { ...g }, g.id);
434
+ }), i.warn("Graph at first:", JSON.stringify(E(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(E(n)));
435
+ const c = V();
436
+ await j(
437
+ o,
438
+ n,
439
+ e.type,
440
+ e.diagramId,
441
+ void 0,
442
+ c
443
+ );
444
+ }, "render");
445
+ export {
446
+ ge as render
447
+ };
@@ -0,0 +1,221 @@
1
+ import { p as k } from "./chunk-4BMEZGHF-BBaiA8MA.js";
2
+ import { _ as l, s as I, g as R, p as E, o as _, a as D, b as F, G, x as P, C as y, D as C, E as z, l as V, I as W } from "./mermaid-CZvYCPmi.js";
3
+ import { p as B } from "./mermaid-parser.core-Bz7ADZ88.js";
4
+ var x = {
5
+ showLegend: !0,
6
+ ticks: 5,
7
+ max: null,
8
+ min: 0,
9
+ graticule: "circle"
10
+ }, w = {
11
+ axes: [],
12
+ curves: [],
13
+ options: x
14
+ }, h = structuredClone(w), H = z.radar, j = /* @__PURE__ */ l(() => y({
15
+ ...H,
16
+ ...C().radar
17
+ }), "getConfig"), b = /* @__PURE__ */ l(() => h.axes, "getAxes"), N = /* @__PURE__ */ l(() => h.curves, "getCurves"), U = /* @__PURE__ */ l(() => h.options, "getOptions"), X = /* @__PURE__ */ l((a) => {
18
+ h.axes = a.map((t) => ({
19
+ name: t.name,
20
+ label: t.label ?? t.name
21
+ }));
22
+ }, "setAxes"), Y = /* @__PURE__ */ l((a) => {
23
+ h.curves = a.map((t) => ({
24
+ name: t.name,
25
+ label: t.label ?? t.name,
26
+ entries: Z(t.entries)
27
+ }));
28
+ }, "setCurves"), Z = /* @__PURE__ */ l((a) => {
29
+ if (a[0].axis == null)
30
+ return a.map((e) => e.value);
31
+ const t = b();
32
+ if (t.length === 0)
33
+ throw new Error("Axes must be populated before curves for reference entries");
34
+ return t.map((e) => {
35
+ const r = a.find((s) => {
36
+ var o;
37
+ return ((o = s.axis) == null ? void 0 : o.$refText) === e.name;
38
+ });
39
+ if (r === void 0)
40
+ throw new Error("Missing entry for axis " + e.label);
41
+ return r.value;
42
+ });
43
+ }, "computeCurveEntries"), q = /* @__PURE__ */ l((a) => {
44
+ var e, r, s, o, i;
45
+ const t = a.reduce(
46
+ (n, c) => (n[c.name] = c, n),
47
+ {}
48
+ );
49
+ h.options = {
50
+ showLegend: ((e = t.showLegend) == null ? void 0 : e.value) ?? x.showLegend,
51
+ ticks: ((r = t.ticks) == null ? void 0 : r.value) ?? x.ticks,
52
+ max: ((s = t.max) == null ? void 0 : s.value) ?? x.max,
53
+ min: ((o = t.min) == null ? void 0 : o.value) ?? x.min,
54
+ graticule: ((i = t.graticule) == null ? void 0 : i.value) ?? x.graticule
55
+ };
56
+ }, "setOptions"), J = /* @__PURE__ */ l(() => {
57
+ P(), h = structuredClone(w);
58
+ }, "clear"), $ = {
59
+ getAxes: b,
60
+ getCurves: N,
61
+ getOptions: U,
62
+ setAxes: X,
63
+ setCurves: Y,
64
+ setOptions: q,
65
+ getConfig: j,
66
+ clear: J,
67
+ setAccTitle: F,
68
+ getAccTitle: D,
69
+ setDiagramTitle: _,
70
+ getDiagramTitle: E,
71
+ getAccDescription: R,
72
+ setAccDescription: I
73
+ }, K = /* @__PURE__ */ l((a) => {
74
+ k(a, $);
75
+ const { axes: t, curves: e, options: r } = a;
76
+ $.setAxes(t), $.setCurves(e), $.setOptions(r);
77
+ }, "populate"), Q = {
78
+ parse: /* @__PURE__ */ l(async (a) => {
79
+ const t = await B("radar", a);
80
+ V.debug(t), K(t);
81
+ }, "parse")
82
+ }, tt = /* @__PURE__ */ l((a, t, e, r) => {
83
+ const s = r.db, o = s.getAxes(), i = s.getCurves(), n = s.getOptions(), c = s.getConfig(), d = s.getDiagramTitle(), p = G(t), u = et(p, c), g = n.max ?? Math.max(...i.map((f) => Math.max(...f.entries))), m = n.min, v = Math.min(c.width, c.height) / 2;
84
+ at(u, o, v, n.ticks, n.graticule), rt(u, o, v, c), M(u, o, i, m, g, n.graticule, c), T(u, i, n.showLegend, c), u.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop);
85
+ }, "draw"), et = /* @__PURE__ */ l((a, t) => {
86
+ const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = {
87
+ x: t.marginLeft + t.width / 2,
88
+ y: t.marginTop + t.height / 2
89
+ };
90
+ return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`);
91
+ }, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, s) => {
92
+ if (s === "circle")
93
+ for (let o = 0; o < r; o++) {
94
+ const i = e * (o + 1) / r;
95
+ a.append("circle").attr("r", i).attr("class", "radarGraticule");
96
+ }
97
+ else if (s === "polygon") {
98
+ const o = t.length;
99
+ for (let i = 0; i < r; i++) {
100
+ const n = e * (i + 1) / r, c = t.map((d, p) => {
101
+ const u = 2 * p * Math.PI / o - Math.PI / 2, g = n * Math.cos(u), m = n * Math.sin(u);
102
+ return `${g},${m}`;
103
+ }).join(" ");
104
+ a.append("polygon").attr("points", c).attr("class", "radarGraticule");
105
+ }
106
+ }
107
+ }, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => {
108
+ const s = t.length;
109
+ for (let o = 0; o < s; o++) {
110
+ const i = t[o].label, n = 2 * o * Math.PI / s - Math.PI / 2;
111
+ a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * Math.cos(n)).attr("y2", e * r.axisScaleFactor * Math.sin(n)).attr("class", "radarAxisLine"), a.append("text").text(i).attr("x", e * r.axisLabelFactor * Math.cos(n)).attr("y", e * r.axisLabelFactor * Math.sin(n)).attr("class", "radarAxisLabel");
112
+ }
113
+ }, "drawAxes");
114
+ function M(a, t, e, r, s, o, i) {
115
+ const n = t.length, c = Math.min(i.width, i.height) / 2;
116
+ e.forEach((d, p) => {
117
+ if (d.entries.length !== n)
118
+ return;
119
+ const u = d.entries.map((g, m) => {
120
+ const v = 2 * Math.PI * m / n - Math.PI / 2, f = A(g, r, s, c), O = f * Math.cos(v), S = f * Math.sin(v);
121
+ return { x: O, y: S };
122
+ });
123
+ o === "circle" ? a.append("path").attr("d", L(u, i.curveTension)).attr("class", `radarCurve-${p}`) : o === "polygon" && a.append("polygon").attr("points", u.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${p}`);
124
+ });
125
+ }
126
+ l(M, "drawCurves");
127
+ function A(a, t, e, r) {
128
+ const s = Math.min(Math.max(a, t), e);
129
+ return r * (s - t) / (e - t);
130
+ }
131
+ l(A, "relativeRadius");
132
+ function L(a, t) {
133
+ const e = a.length;
134
+ let r = `M${a[0].x},${a[0].y}`;
135
+ for (let s = 0; s < e; s++) {
136
+ const o = a[(s - 1 + e) % e], i = a[s], n = a[(s + 1) % e], c = a[(s + 2) % e], d = {
137
+ x: i.x + (n.x - o.x) * t,
138
+ y: i.y + (n.y - o.y) * t
139
+ }, p = {
140
+ x: n.x - (c.x - i.x) * t,
141
+ y: n.y - (c.y - i.y) * t
142
+ };
143
+ r += ` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`;
144
+ }
145
+ return `${r} Z`;
146
+ }
147
+ l(L, "closedRoundCurve");
148
+ function T(a, t, e, r) {
149
+ if (!e)
150
+ return;
151
+ const s = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20;
152
+ t.forEach((n, c) => {
153
+ const d = a.append("g").attr("transform", `translate(${s}, ${o + c * i})`);
154
+ d.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${c}`), d.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(n.label);
155
+ });
156
+ }
157
+ l(T, "drawLegend");
158
+ var st = { draw: tt }, nt = /* @__PURE__ */ l((a, t) => {
159
+ let e = "";
160
+ for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
161
+ const s = a[`cScale${r}`];
162
+ e += `
163
+ .radarCurve-${r} {
164
+ color: ${s};
165
+ fill: ${s};
166
+ fill-opacity: ${t.curveOpacity};
167
+ stroke: ${s};
168
+ stroke-width: ${t.curveStrokeWidth};
169
+ }
170
+ .radarLegendBox-${r} {
171
+ fill: ${s};
172
+ fill-opacity: ${t.curveOpacity};
173
+ stroke: ${s};
174
+ }
175
+ `;
176
+ }
177
+ return e;
178
+ }, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => {
179
+ const t = W(), e = C(), r = y(t, e.themeVariables), s = y(r.radar, a);
180
+ return { themeVariables: r, radarOptions: s };
181
+ }, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => {
182
+ const { themeVariables: t, radarOptions: e } = ot(a);
183
+ return `
184
+ .radarTitle {
185
+ font-size: ${t.fontSize};
186
+ color: ${t.titleColor};
187
+ dominant-baseline: hanging;
188
+ text-anchor: middle;
189
+ }
190
+ .radarAxisLine {
191
+ stroke: ${e.axisColor};
192
+ stroke-width: ${e.axisStrokeWidth};
193
+ }
194
+ .radarAxisLabel {
195
+ dominant-baseline: middle;
196
+ text-anchor: middle;
197
+ font-size: ${e.axisLabelFontSize}px;
198
+ color: ${e.axisColor};
199
+ }
200
+ .radarGraticule {
201
+ fill: ${e.graticuleColor};
202
+ fill-opacity: ${e.graticuleOpacity};
203
+ stroke: ${e.graticuleColor};
204
+ stroke-width: ${e.graticuleStrokeWidth};
205
+ }
206
+ .radarLegendText {
207
+ text-anchor: start;
208
+ font-size: ${e.legendFontSize}px;
209
+ dominant-baseline: hanging;
210
+ }
211
+ ${nt(t, e)}
212
+ `;
213
+ }, "styles"), ut = {
214
+ parser: Q,
215
+ db: $,
216
+ renderer: st,
217
+ styles: it
218
+ };
219
+ export {
220
+ ut as diagram
221
+ };