@ucap-llm/ai-ui 1.1.6 → 1.1.7

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 (55) hide show
  1. package/_basePickBy-7d00d05e.mjs +153 -0
  2. package/_baseUniq-1876be04.mjs +440 -0
  3. package/ai-ui.es.js +11 -78207
  4. package/ai-ui.umd.js +2701 -143
  5. package/arc-bb1e7b28.mjs +85 -0
  6. package/architecture-4AB2E3PP-26f07d27.mjs +10 -0
  7. package/architectureDiagram-IEHRJDOE-535e4958.mjs +4640 -0
  8. package/blockDiagram-JOT3LUYC-e5536854.mjs +2251 -0
  9. package/c4Diagram-VJAJSXHY-311741c3.mjs +1583 -0
  10. package/channel-5d097975.mjs +5 -0
  11. package/chunk-4BMEZGHF-55420838.mjs +9 -0
  12. package/chunk-A2AXSNBT-5f9de039.mjs +1373 -0
  13. package/chunk-AEK57VVT-bd6e836f.mjs +1416 -0
  14. package/chunk-D6G4REZN-69cf348a.mjs +64 -0
  15. package/chunk-RZ5BOZE2-ebe3985e.mjs +24 -0
  16. package/chunk-XZIHB7SX-ed9a9d65.mjs +15 -0
  17. package/classDiagram-GIVACNV2-4d61f06d.mjs +18 -0
  18. package/classDiagram-v2-COTLJTTW-4d61f06d.mjs +18 -0
  19. package/clone-44064c55.mjs +8 -0
  20. package/cytoscape.esm-bb479f88.mjs +18232 -0
  21. package/dagre-OKDRZEBW-0574359b.mjs +448 -0
  22. package/diagram-SSKATNLV-f4dd04b2.mjs +225 -0
  23. package/diagram-VNBRO52H-f77f925a.mjs +130 -0
  24. package/erDiagram-Q7BY3M3F-8213684f.mjs +843 -0
  25. package/flowDiagram-4HSFHLVR-1decdff6.mjs +1624 -0
  26. package/ganttDiagram-APWFNJXF-461381a5.mjs +2521 -0
  27. package/gitGraph-O2Q2CXLX-d961db16.mjs +10 -0
  28. package/gitGraphDiagram-7IBYFJ6S-be6c39c3.mjs +716 -0
  29. package/graph-7ba79f74.mjs +249 -0
  30. package/index-f5aac161.mjs +93487 -0
  31. package/info-4N47QTOZ-615527c9.mjs +10 -0
  32. package/infoDiagram-PH2N3AL5-064df479.mjs +26 -0
  33. package/init-f9637058.mjs +16 -0
  34. package/journeyDiagram-U35MCT3I-94c54b39.mjs +811 -0
  35. package/kanban-definition-NDS4AKOZ-58a05db1.mjs +720 -0
  36. package/katex-2e45926a.mjs +11700 -0
  37. package/layout-c953b0e7.mjs +1344 -0
  38. package/linear-3c81794f.mjs +447 -0
  39. package/mermaid-parser.core-7afd2b2f.mjs +12845 -0
  40. package/mindmap-definition-ALO5MXBD-60e68e28.mjs +3222 -0
  41. package/ordinal-980380c7.mjs +65 -0
  42. package/package.json +1 -1
  43. package/packet-KVYON367-4b5a305e.mjs +10 -0
  44. package/pie-R6RNRRYF-0f27d16d.mjs +10 -0
  45. package/pieDiagram-IB7DONF6-66cebf11.mjs +167 -0
  46. package/quadrantDiagram-7GDLP6J5-f2cbfc79.mjs +1027 -0
  47. package/radar-MK3ICKWK-9e1913d7.mjs +10 -0
  48. package/requirementDiagram-KVF5MWMF-36d316c2.mjs +853 -0
  49. package/sankeyDiagram-QLVOVGJD-76245efb.mjs +826 -0
  50. package/sequenceDiagram-X6HHIX6F-a0ec0021.mjs +2283 -0
  51. package/stateDiagram-DGXRK772-e6387816.mjs +274 -0
  52. package/stateDiagram-v2-YXO3MK2T-f011ada4.mjs +18 -0
  53. package/style.css +1 -1
  54. package/timeline-definition-BDJGKUSR-a62514a7.mjs +806 -0
  55. package/xychartDiagram-VJFVF3MP-1b807048.mjs +1306 -0
@@ -0,0 +1,448 @@
1
+ import { _ as X, aq as F, ar as Y, as as _, at as H, l as i, d as V, au as q, av as U, af as $, ak as z, ag as P, ae as K, aw as Q, ax as W, ay as Z } from "./index-f5aac161.mjs";
2
+ import { G as B } from "./graph-7ba79f74.mjs";
3
+ import { l as I } from "./layout-c953b0e7.mjs";
4
+ import { i as x } from "./_baseUniq-1876be04.mjs";
5
+ import { c as L } from "./clone-44064c55.mjs";
6
+ import { m as A } from "./_basePickBy-7d00d05e.mjs";
7
+ import "vue";
8
+ function E(e) {
9
+ var t = {
10
+ options: {
11
+ directed: e.isDirected(),
12
+ multigraph: e.isMultigraph(),
13
+ compound: e.isCompound()
14
+ },
15
+ nodes: ee(e),
16
+ edges: ne(e)
17
+ };
18
+ return x(e.graph()) || (t.value = L(e.graph())), t;
19
+ }
20
+ function ee(e) {
21
+ return A(e.nodes(), function(t) {
22
+ var n = e.node(t), o = e.parent(t), c = { v: t };
23
+ return x(n) || (c.value = n), x(o) || (c.parent = o), c;
24
+ });
25
+ }
26
+ function ne(e) {
27
+ return A(e.edges(), function(t) {
28
+ var n = e.edge(t), o = { v: t.v, w: t.w };
29
+ return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o;
30
+ });
31
+ }
32
+ var f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ X(() => {
33
+ b.clear(), J.clear(), f.clear();
34
+ }, "clear"), O = /* @__PURE__ */ X((e, t) => {
35
+ const n = b.get(t) || [];
36
+ return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
37
+ }, "isDescendant"), se = /* @__PURE__ */ X((e, t) => {
38
+ const n = b.get(t) || [];
39
+ 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);
40
+ }, "edgeInCluster"), G = /* @__PURE__ */ X((e, t, n, o) => {
41
+ i.warn(
42
+ "Copying children of ",
43
+ e,
44
+ "root",
45
+ o,
46
+ "data",
47
+ t.node(e),
48
+ o
49
+ );
50
+ const c = t.children(e) || [];
51
+ e !== o && c.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => {
52
+ if (t.children(a).length > 0)
53
+ G(a, t, n, o);
54
+ else {
55
+ const r = t.node(a);
56
+ 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(
57
+ "Not Setting parent for node=",
58
+ a,
59
+ "cluster!==rootId",
60
+ e !== o,
61
+ "node!==clusterId",
62
+ a !== e
63
+ ));
64
+ const u = t.edges(a);
65
+ i.debug("Copying Edges", u), u.forEach((l) => {
66
+ i.info("Edge", l);
67
+ const h = t.edge(l.v, l.w, l.name);
68
+ i.info("Edge data", h, o);
69
+ try {
70
+ se(l, o) ? (i.info("Copying as ", l.v, l.w, h, l.name), n.setEdge(l.v, l.w, h, l.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info(
71
+ "Skipping copy of edge ",
72
+ l.v,
73
+ "-->",
74
+ l.w,
75
+ " rootId: ",
76
+ o,
77
+ " clusterId:",
78
+ e
79
+ );
80
+ } catch (C) {
81
+ i.error(C);
82
+ }
83
+ });
84
+ }
85
+ i.debug("Removing node", a), t.removeNode(a);
86
+ });
87
+ }, "copy"), R = /* @__PURE__ */ X((e, t) => {
88
+ const n = t.children(e);
89
+ let o = [...n];
90
+ for (const c of n)
91
+ J.set(c, e), o = [...o, ...R(c, t)];
92
+ return o;
93
+ }, "extractDescendants"), ie = /* @__PURE__ */ X((e, t, n) => {
94
+ 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 }));
95
+ return a.filter((l) => r.some((h) => l.v === h.v && l.w === h.w));
96
+ }, "findCommonEdges"), D = /* @__PURE__ */ X((e, t, n) => {
97
+ const o = t.children(e);
98
+ if (i.trace("Searching children of id ", e, o), o.length < 1)
99
+ return e;
100
+ let c;
101
+ for (const a of o) {
102
+ const r = D(a, t, n), u = ie(t, n, r);
103
+ if (r)
104
+ if (u.length > 0)
105
+ c = r;
106
+ else
107
+ return r;
108
+ }
109
+ return c;
110
+ }, "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) => {
111
+ if (!e || t > 10) {
112
+ i.debug("Opting out, no graph ");
113
+ return;
114
+ } else
115
+ i.debug("Opting in, graph ");
116
+ e.nodes().forEach(function(n) {
117
+ e.children(n).length > 0 && (i.warn(
118
+ "Cluster identified",
119
+ n,
120
+ " Replacement id in edges: ",
121
+ D(n, e, n)
122
+ ), b.set(n, R(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) }));
123
+ }), e.nodes().forEach(function(n) {
124
+ const o = e.children(n), c = e.edges();
125
+ o.length > 0 ? (i.debug("Cluster identified", n, b), c.forEach((a) => {
126
+ const r = O(a.v, n), u = O(a.w, n);
127
+ r ^ u && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", b.get(n)), f.get(n).externalConnections = !0);
128
+ })) : i.debug("Not a cluster ", n, b);
129
+ });
130
+ for (let n of f.keys()) {
131
+ const o = f.get(n).id, c = e.parent(o);
132
+ c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c);
133
+ }
134
+ e.edges().forEach(function(n) {
135
+ const o = e.edge(n);
136
+ i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
137
+ let c = n.v, a = n.w;
138
+ if (i.warn(
139
+ "Fix XXX",
140
+ f,
141
+ "ids:",
142
+ n.v,
143
+ n.w,
144
+ "Translating: ",
145
+ f.get(n.v),
146
+ " --- ",
147
+ f.get(n.w)
148
+ ), f.get(n.v) || f.get(n.w)) {
149
+ 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) {
150
+ const r = e.parent(c);
151
+ f.get(r).externalConnections = !0, o.fromCluster = n.v;
152
+ }
153
+ if (a !== n.w) {
154
+ const r = e.parent(a);
155
+ f.get(r).externalConnections = !0, o.toCluster = n.w;
156
+ }
157
+ i.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name);
158
+ }
159
+ }), i.warn("Adjusted Graph", E(e)), T(e, 0), i.trace(f);
160
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ X((e, t) => {
161
+ var c, a;
162
+ if (i.warn("extractor - ", t, E(e), e.children("D")), t > 10) {
163
+ i.error("Bailing out");
164
+ return;
165
+ }
166
+ let n = e.nodes(), o = !1;
167
+ for (const r of n) {
168
+ const u = e.children(r);
169
+ o = o || u.length > 0;
170
+ }
171
+ if (!o) {
172
+ i.debug("Done, no node has children", e.nodes());
173
+ return;
174
+ }
175
+ i.debug("Nodes = ", n, t);
176
+ for (const r of n)
177
+ if (i.debug(
178
+ "Extracting node",
179
+ r,
180
+ f,
181
+ f.has(r) && !f.get(r).externalConnections,
182
+ !e.parent(r),
183
+ e.node(r),
184
+ e.children("D"),
185
+ " Depth ",
186
+ t
187
+ ), !f.has(r))
188
+ i.debug("Not a cluster", r, t);
189
+ else if (!f.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
190
+ i.warn(
191
+ "Cluster without external connections, without a parent and with children",
192
+ r,
193
+ t
194
+ );
195
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
196
+ (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));
197
+ const h = new B({
198
+ multigraph: !0,
199
+ compound: !0
200
+ }).setGraph({
201
+ rankdir: l,
202
+ nodesep: 50,
203
+ ranksep: 50,
204
+ marginx: 8,
205
+ marginy: 8
206
+ }).setDefaultEdgeLabel(function() {
207
+ return {};
208
+ });
209
+ i.warn("Old graph before copy", E(e)), G(r, e, h, r), e.setNode(r, {
210
+ clusterNode: !0,
211
+ id: r,
212
+ clusterData: f.get(r).clusterData,
213
+ label: f.get(r).label,
214
+ graph: h
215
+ }), i.warn("New graph after copy node: (", r, ")", E(h)), i.debug("Old graph after copy", E(e));
216
+ } else
217
+ i.warn(
218
+ "Cluster ** ",
219
+ r,
220
+ " **not meeting the criteria !externalConnections:",
221
+ !f.get(r).externalConnections,
222
+ " no parent: ",
223
+ !e.parent(r),
224
+ " children ",
225
+ e.children(r) && e.children(r).length > 0,
226
+ e.children("D"),
227
+ t
228
+ ), i.debug(f);
229
+ n = e.nodes(), i.warn("New list of nodes", n);
230
+ for (const r of n) {
231
+ const u = e.node(r);
232
+ i.warn(" Now next level", r, u), u != null && u.clusterNode && T(u.graph, t + 1);
233
+ }
234
+ }, "extractor"), M = /* @__PURE__ */ X((e, t) => {
235
+ if (t.length === 0)
236
+ return [];
237
+ let n = Object.assign([], t);
238
+ return t.forEach((o) => {
239
+ const c = e.children(o), a = M(e, c);
240
+ n = [...n, ...a];
241
+ }), n;
242
+ }, "sorter"), oe = /* @__PURE__ */ X((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ X(async (e, t, n, o, c, a) => {
243
+ i.warn("Graph in recursive render:XAX", E(t), c);
244
+ const r = t.graph().rankdir;
245
+ i.trace("Dir in recursive render - dir:", r);
246
+ const u = e.insert("g").attr("class", "root");
247
+ 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]));
248
+ const l = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), C = u.insert("g").attr("class", "edgeLabels"), g = u.insert("g").attr("class", "nodes");
249
+ await Promise.all(
250
+ t.nodes().map(async function(d) {
251
+ const s = t.node(d);
252
+ if (c !== void 0) {
253
+ const w = JSON.parse(JSON.stringify(c.clusterData));
254
+ i.trace(
255
+ `Setting data for parent cluster XXX
256
+ Node.id = `,
257
+ d,
258
+ `
259
+ data=`,
260
+ w.height,
261
+ `
262
+ Parent cluster`,
263
+ c.height
264
+ ), t.setNode(c.id, w), t.parent(d) || (i.trace("Setting parent", d, c.id), t.setParent(d, c.id, w));
265
+ }
266
+ if (i.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) {
267
+ i.info("Cluster identified XBX", d, s.width, t.node(d));
268
+ const { ranksep: w, nodesep: m } = t.graph();
269
+ s.graph.setGraph({
270
+ ...s.graph.graph(),
271
+ ranksep: w + 25,
272
+ nodesep: m
273
+ });
274
+ const N = await j(
275
+ g,
276
+ s.graph,
277
+ n,
278
+ o,
279
+ t.node(d),
280
+ a
281
+ ), S = N.elem;
282
+ q(s, S), s.diff = N.diff || 0, i.info(
283
+ "New compound node after recursive render XAX",
284
+ d,
285
+ "width",
286
+ // node,
287
+ s.width,
288
+ "height",
289
+ s.height
290
+ // node.x,
291
+ // node.y
292
+ ), U(S, s);
293
+ } else
294
+ t.children(d).length > 0 ? (i.trace(
295
+ "Cluster - the non recursive path XBX",
296
+ d,
297
+ s.id,
298
+ s,
299
+ s.width,
300
+ "Graph:",
301
+ t
302
+ ), 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 }));
303
+ })
304
+ ), await (/* @__PURE__ */ X(async () => {
305
+ const d = t.edges().map(async function(s) {
306
+ const w = t.edge(s.v, s.w, s.name);
307
+ 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(
308
+ "Fix",
309
+ f,
310
+ "ids:",
311
+ s.v,
312
+ s.w,
313
+ "Translating: ",
314
+ f.get(s.v),
315
+ f.get(s.w)
316
+ ), await Z(C, w);
317
+ });
318
+ await Promise.all(d);
319
+ }, "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)));
320
+ let p = 0, { subGraphTitleTotalMargin: y } = z(a);
321
+ return await Promise.all(
322
+ oe(t).map(async function(d) {
323
+ var w;
324
+ const s = t.node(d);
325
+ if (i.info(
326
+ "Position XBX => " + d + ": (" + s.x,
327
+ "," + s.y,
328
+ ") width: ",
329
+ s.width,
330
+ " height: ",
331
+ s.height
332
+ ), s != null && s.clusterNode)
333
+ s.y += y, i.info(
334
+ "A tainted cluster node XBX1",
335
+ d,
336
+ s.id,
337
+ s.width,
338
+ s.height,
339
+ s.x,
340
+ s.y,
341
+ t.parent(d)
342
+ ), f.get(s.id).node = s, P(s);
343
+ else if (t.children(d).length > 0) {
344
+ i.info(
345
+ "A pure cluster node XBX1",
346
+ d,
347
+ s.id,
348
+ s.x,
349
+ s.y,
350
+ s.width,
351
+ s.height,
352
+ t.parent(d)
353
+ ), s.height += y, t.node(s.parentId);
354
+ 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;
355
+ i.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await K(l, s), f.get(s.id).node = s;
356
+ } else {
357
+ const m = t.node(s.parentId);
358
+ s.y += y / 2, i.info(
359
+ "A regular node XBX1 - using the padding",
360
+ s.id,
361
+ "parent",
362
+ s.parentId,
363
+ s.width,
364
+ s.height,
365
+ s.x,
366
+ s.y,
367
+ "offsetY",
368
+ s.offsetY,
369
+ "parent",
370
+ m,
371
+ m == null ? void 0 : m.offsetY,
372
+ s
373
+ ), P(s);
374
+ }
375
+ })
376
+ ), t.edges().forEach(function(d) {
377
+ const s = t.edge(d);
378
+ i.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += y / 2);
379
+ const w = t.node(d.v);
380
+ var m = t.node(d.w);
381
+ const N = Q(h, s, f, n, w, m, o);
382
+ W(s, N);
383
+ }), t.nodes().forEach(function(d) {
384
+ const s = t.node(d);
385
+ i.info(d, s.type, s.diff), s.isGroup && (p = s.diff);
386
+ }), i.warn("Returning from recursive render XAX", u, p), { elem: u, diff: p };
387
+ }, "recursiveRender"), we = /* @__PURE__ */ X(async (e, t) => {
388
+ var a, r, u, l, h, C;
389
+ const n = new B({
390
+ multigraph: !0,
391
+ compound: !0
392
+ }).setGraph({
393
+ rankdir: e.direction,
394
+ 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,
395
+ ranksep: ((l = e.config) == null ? void 0 : l.rankSpacing) || ((C = (h = e.config) == null ? void 0 : h.flowchart) == null ? void 0 : C.rankSpacing) || e.rankSpacing,
396
+ marginx: 8,
397
+ marginy: 8
398
+ }).setDefaultEdgeLabel(function() {
399
+ return {};
400
+ }), o = t.select("g");
401
+ F(o, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((g) => {
402
+ n.setNode(g.id, { ...g }), g.parentId && n.setParent(g.id, g.parentId);
403
+ }), i.debug("Edges:", e.edges), e.edges.forEach((g) => {
404
+ if (g.start === g.end) {
405
+ const v = g.start, p = v + "---" + v + "---1", y = v + "---" + v + "---2", d = n.node(v);
406
+ n.setNode(p, {
407
+ domId: p,
408
+ id: p,
409
+ parentId: d.parentId,
410
+ labelStyle: "",
411
+ label: "",
412
+ padding: 0,
413
+ shape: "labelRect",
414
+ // shape: 'rect',
415
+ style: "",
416
+ width: 10,
417
+ height: 10
418
+ }), n.setParent(p, d.parentId), n.setNode(y, {
419
+ domId: y,
420
+ id: y,
421
+ parentId: d.parentId,
422
+ labelStyle: "",
423
+ padding: 0,
424
+ // shape: 'rect',
425
+ shape: "labelRect",
426
+ label: "",
427
+ style: "",
428
+ width: 10,
429
+ height: 10
430
+ }), n.setParent(y, d.parentId);
431
+ const s = structuredClone(g), w = structuredClone(g), m = structuredClone(g);
432
+ s.label = "", s.arrowTypeEnd = "none", s.id = v + "-cyclic-special-1", w.arrowTypeStart = "none", w.arrowTypeEnd = "none", w.id = v + "-cyclic-special-mid", m.label = "", d.isGroup && (s.fromCluster = v, m.toCluster = v), m.id = v + "-cyclic-special-2", m.arrowTypeStart = "none", n.setEdge(v, p, s, v + "-cyclic-special-0"), n.setEdge(p, y, w, v + "-cyclic-special-1"), n.setEdge(y, v, m, v + "-cyc<lic-special-2");
433
+ } else
434
+ n.setEdge(g.start, g.end, { ...g }, g.id);
435
+ }), i.warn("Graph at first:", JSON.stringify(E(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(E(n)));
436
+ const c = V();
437
+ await j(
438
+ o,
439
+ n,
440
+ e.type,
441
+ e.diagramId,
442
+ void 0,
443
+ c
444
+ );
445
+ }, "render");
446
+ export {
447
+ we as render
448
+ };
@@ -0,0 +1,225 @@
1
+ import { p as k } from "./chunk-4BMEZGHF-55420838.mjs";
2
+ import { C as R, _ as l, s as E, g as I, n as _, o as D, b as F, c as G, l as P, D as y, E as C, t as z, H, K as V } from "./index-f5aac161.mjs";
3
+ import { p as W } from "./mermaid-parser.core-7afd2b2f.mjs";
4
+ import "vue";
5
+ import "./_baseUniq-1876be04.mjs";
6
+ import "./_basePickBy-7d00d05e.mjs";
7
+ import "./clone-44064c55.mjs";
8
+ var h = {
9
+ showLegend: !0,
10
+ ticks: 5,
11
+ max: null,
12
+ min: 0,
13
+ graticule: "circle"
14
+ }, w = {
15
+ axes: [],
16
+ curves: [],
17
+ options: h
18
+ }, m = structuredClone(w), B = R.radar, j = /* @__PURE__ */ l(() => y({
19
+ ...B,
20
+ ...C().radar
21
+ }), "getConfig"), b = /* @__PURE__ */ l(() => m.axes, "getAxes"), K = /* @__PURE__ */ l(() => m.curves, "getCurves"), N = /* @__PURE__ */ l(() => m.options, "getOptions"), U = /* @__PURE__ */ l((a) => {
22
+ m.axes = a.map((t) => ({
23
+ name: t.name,
24
+ label: t.label ?? t.name
25
+ }));
26
+ }, "setAxes"), X = /* @__PURE__ */ l((a) => {
27
+ m.curves = a.map((t) => ({
28
+ name: t.name,
29
+ label: t.label ?? t.name,
30
+ entries: Y(t.entries)
31
+ }));
32
+ }, "setCurves"), Y = /* @__PURE__ */ l((a) => {
33
+ if (a[0].axis == null)
34
+ return a.map((e) => e.value);
35
+ const t = b();
36
+ if (t.length === 0)
37
+ throw new Error("Axes must be populated before curves for reference entries");
38
+ return t.map((e) => {
39
+ const r = a.find((s) => {
40
+ var o;
41
+ return ((o = s.axis) == null ? void 0 : o.$refText) === e.name;
42
+ });
43
+ if (r === void 0)
44
+ throw new Error("Missing entry for axis " + e.label);
45
+ return r.value;
46
+ });
47
+ }, "computeCurveEntries"), Z = /* @__PURE__ */ l((a) => {
48
+ var e, r, s, o, i;
49
+ const t = a.reduce(
50
+ (n, c) => (n[c.name] = c, n),
51
+ {}
52
+ );
53
+ m.options = {
54
+ showLegend: ((e = t.showLegend) == null ? void 0 : e.value) ?? h.showLegend,
55
+ ticks: ((r = t.ticks) == null ? void 0 : r.value) ?? h.ticks,
56
+ max: ((s = t.max) == null ? void 0 : s.value) ?? h.max,
57
+ min: ((o = t.min) == null ? void 0 : o.value) ?? h.min,
58
+ graticule: ((i = t.graticule) == null ? void 0 : i.value) ?? h.graticule
59
+ };
60
+ }, "setOptions"), q = /* @__PURE__ */ l(() => {
61
+ z(), m = structuredClone(w);
62
+ }, "clear"), $ = {
63
+ getAxes: b,
64
+ getCurves: K,
65
+ getOptions: N,
66
+ setAxes: U,
67
+ setCurves: X,
68
+ setOptions: Z,
69
+ getConfig: j,
70
+ clear: q,
71
+ setAccTitle: E,
72
+ getAccTitle: I,
73
+ setDiagramTitle: _,
74
+ getDiagramTitle: D,
75
+ getAccDescription: F,
76
+ setAccDescription: G
77
+ }, J = /* @__PURE__ */ l((a) => {
78
+ k(a, $);
79
+ const { axes: t, curves: e, options: r } = a;
80
+ $.setAxes(t), $.setCurves(e), $.setOptions(r);
81
+ }, "populate"), Q = {
82
+ parse: /* @__PURE__ */ l(async (a) => {
83
+ const t = await W("radar", a);
84
+ P.debug(t), J(t);
85
+ }, "parse")
86
+ }, tt = /* @__PURE__ */ l((a, t, e, r) => {
87
+ const s = r.db, o = s.getAxes(), i = s.getCurves(), n = s.getOptions(), c = s.getConfig(), d = s.getDiagramTitle(), u = H(t), p = et(u, c), g = n.max ?? Math.max(...i.map((f) => Math.max(...f.entries))), x = n.min, v = Math.min(c.width, c.height) / 2;
88
+ at(p, o, v, n.ticks, n.graticule), rt(p, o, v, c), M(p, o, i, x, g, n.graticule, c), T(p, i, n.showLegend, c), p.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop);
89
+ }, "draw"), et = /* @__PURE__ */ l((a, t) => {
90
+ const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = {
91
+ x: t.marginLeft + t.width / 2,
92
+ y: t.marginTop + t.height / 2
93
+ };
94
+ return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`);
95
+ }, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, s) => {
96
+ if (s === "circle")
97
+ for (let o = 0; o < r; o++) {
98
+ const i = e * (o + 1) / r;
99
+ a.append("circle").attr("r", i).attr("class", "radarGraticule");
100
+ }
101
+ else if (s === "polygon") {
102
+ const o = t.length;
103
+ for (let i = 0; i < r; i++) {
104
+ const n = e * (i + 1) / r, c = t.map((d, u) => {
105
+ const p = 2 * u * Math.PI / o - Math.PI / 2, g = n * Math.cos(p), x = n * Math.sin(p);
106
+ return `${g},${x}`;
107
+ }).join(" ");
108
+ a.append("polygon").attr("points", c).attr("class", "radarGraticule");
109
+ }
110
+ }
111
+ }, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => {
112
+ const s = t.length;
113
+ for (let o = 0; o < s; o++) {
114
+ const i = t[o].label, n = 2 * o * Math.PI / s - Math.PI / 2;
115
+ 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");
116
+ }
117
+ }, "drawAxes");
118
+ function M(a, t, e, r, s, o, i) {
119
+ const n = t.length, c = Math.min(i.width, i.height) / 2;
120
+ e.forEach((d, u) => {
121
+ if (d.entries.length !== n)
122
+ return;
123
+ const p = d.entries.map((g, x) => {
124
+ const v = 2 * Math.PI * x / n - Math.PI / 2, f = A(g, r, s, c), O = f * Math.cos(v), S = f * Math.sin(v);
125
+ return { x: O, y: S };
126
+ });
127
+ o === "circle" ? a.append("path").attr("d", L(p, i.curveTension)).attr("class", `radarCurve-${u}`) : o === "polygon" && a.append("polygon").attr("points", p.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${u}`);
128
+ });
129
+ }
130
+ l(M, "drawCurves");
131
+ function A(a, t, e, r) {
132
+ const s = Math.min(Math.max(a, t), e);
133
+ return r * (s - t) / (e - t);
134
+ }
135
+ l(A, "relativeRadius");
136
+ function L(a, t) {
137
+ const e = a.length;
138
+ let r = `M${a[0].x},${a[0].y}`;
139
+ for (let s = 0; s < e; s++) {
140
+ const o = a[(s - 1 + e) % e], i = a[s], n = a[(s + 1) % e], c = a[(s + 2) % e], d = {
141
+ x: i.x + (n.x - o.x) * t,
142
+ y: i.y + (n.y - o.y) * t
143
+ }, u = {
144
+ x: n.x - (c.x - i.x) * t,
145
+ y: n.y - (c.y - i.y) * t
146
+ };
147
+ r += ` C${d.x},${d.y} ${u.x},${u.y} ${n.x},${n.y}`;
148
+ }
149
+ return `${r} Z`;
150
+ }
151
+ l(L, "closedRoundCurve");
152
+ function T(a, t, e, r) {
153
+ if (!e)
154
+ return;
155
+ const s = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20;
156
+ t.forEach((n, c) => {
157
+ const d = a.append("g").attr("transform", `translate(${s}, ${o + c * i})`);
158
+ 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);
159
+ });
160
+ }
161
+ l(T, "drawLegend");
162
+ var st = { draw: tt }, nt = /* @__PURE__ */ l((a, t) => {
163
+ let e = "";
164
+ for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
165
+ const s = a[`cScale${r}`];
166
+ e += `
167
+ .radarCurve-${r} {
168
+ color: ${s};
169
+ fill: ${s};
170
+ fill-opacity: ${t.curveOpacity};
171
+ stroke: ${s};
172
+ stroke-width: ${t.curveStrokeWidth};
173
+ }
174
+ .radarLegendBox-${r} {
175
+ fill: ${s};
176
+ fill-opacity: ${t.curveOpacity};
177
+ stroke: ${s};
178
+ }
179
+ `;
180
+ }
181
+ return e;
182
+ }, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => {
183
+ const t = V(), e = C(), r = y(t, e.themeVariables), s = y(r.radar, a);
184
+ return { themeVariables: r, radarOptions: s };
185
+ }, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => {
186
+ const { themeVariables: t, radarOptions: e } = ot(a);
187
+ return `
188
+ .radarTitle {
189
+ font-size: ${t.fontSize};
190
+ color: ${t.titleColor};
191
+ dominant-baseline: hanging;
192
+ text-anchor: middle;
193
+ }
194
+ .radarAxisLine {
195
+ stroke: ${e.axisColor};
196
+ stroke-width: ${e.axisStrokeWidth};
197
+ }
198
+ .radarAxisLabel {
199
+ dominant-baseline: middle;
200
+ text-anchor: middle;
201
+ font-size: ${e.axisLabelFontSize}px;
202
+ color: ${e.axisColor};
203
+ }
204
+ .radarGraticule {
205
+ fill: ${e.graticuleColor};
206
+ fill-opacity: ${e.graticuleOpacity};
207
+ stroke: ${e.graticuleColor};
208
+ stroke-width: ${e.graticuleStrokeWidth};
209
+ }
210
+ .radarLegendText {
211
+ text-anchor: start;
212
+ font-size: ${e.legendFontSize}px;
213
+ dominant-baseline: hanging;
214
+ }
215
+ ${nt(t, e)}
216
+ `;
217
+ }, "styles"), ht = {
218
+ parser: Q,
219
+ db: $,
220
+ renderer: st,
221
+ styles: it
222
+ };
223
+ export {
224
+ ht as diagram
225
+ };