@yiyi_zhang/reactflow-ui 0.3.0 → 0.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +61 -22
  2. package/dist/AiWorkflowIDE.d.ts +217 -0
  3. package/dist/WorkflowIDE.d.ts +22 -3
  4. package/dist/ai-BJwQZcGK.js +15168 -0
  5. package/dist/ai.d.ts +30 -0
  6. package/dist/arc-BUGZGgtu.js +83 -0
  7. package/dist/architectureDiagram-3BPJPVTR-ZcgvTwSO.js +4692 -0
  8. package/dist/blockDiagram-GPEHLZMM-DtVtOBbH.js +2418 -0
  9. package/dist/c4Diagram-AAUBKEIU-tBS5Rcvm.js +1577 -0
  10. package/dist/channel-CURI9jmI.js +5 -0
  11. package/dist/chunk-2J33WTMH-D7gashNz.js +19 -0
  12. package/dist/chunk-4BX2VUAB-DE3VjyiZ.js +8 -0
  13. package/dist/chunk-55IACEB6-GYZ_m2MY.js +8 -0
  14. package/dist/chunk-727SXJPM-D4WVyvOg.js +1528 -0
  15. package/dist/chunk-AQP2D5EJ-Os2Uwqya.js +1387 -0
  16. package/dist/chunk-FMBD7UC4-B3CSVzS4.js +19 -0
  17. package/dist/chunk-ND2GUHAM-CNj_s1aK.js +68 -0
  18. package/dist/chunk-QZHKN3VN-DoV8iUKo.js +15 -0
  19. package/dist/classDiagram-4FO5ZUOK-Dr9C18x4.js +16 -0
  20. package/dist/classDiagram-v2-Q7XG4LA2-Dr9C18x4.js +16 -0
  21. package/dist/components/AiNative/AgentTimeline.d.ts +18 -0
  22. package/dist/components/AiNative/AiCommandCenter.d.ts +40 -0
  23. package/dist/components/AiNative/AiConfigPanel.d.ts +9 -0
  24. package/dist/components/AiNative/BusinessCanvas.d.ts +15 -0
  25. package/dist/components/AiNative/CanvasPreview.d.ts +16 -0
  26. package/dist/components/AiNative/ClarificationCard.d.ts +9 -0
  27. package/dist/components/AiNative/FailureSummaryCard.d.ts +20 -0
  28. package/dist/components/AiNative/LibraryPanel.d.ts +9 -0
  29. package/dist/components/AiNative/MermaidBlock.d.ts +6 -0
  30. package/dist/components/AiNative/PlanCard.d.ts +15 -0
  31. package/dist/components/AiNative/ProposalPreviewCard.d.ts +21 -0
  32. package/dist/components/AiNative/RecommendationCard.d.ts +10 -0
  33. package/dist/components/AiNative/RepairCard.d.ts +17 -0
  34. package/dist/components/AiNative/ReviewBar.d.ts +21 -0
  35. package/dist/components/AiNative/WorkflowRunCard.d.ts +14 -0
  36. package/dist/components/Controls/ModeSlider.d.ts +2 -0
  37. package/dist/components/ExecutionSummaryPanel.d.ts +4 -0
  38. package/dist/components/WorkflowRunPanel.d.ts +12 -0
  39. package/dist/components/nodes/NodeWrapper.d.ts +2 -1
  40. package/dist/cose-bilkent-S5V4N54A-CgQlI-io.js +2609 -0
  41. package/dist/cytoscape.esm-kVAWcYoG.js +18755 -0
  42. package/dist/dagre-BM42HDAG-CFMIuOmS.js +445 -0
  43. package/dist/defaultLocale-BgPVtth8.js +171 -0
  44. package/dist/diagram-2AECGRRQ-C5jZp2YX.js +217 -0
  45. package/dist/diagram-5GNKFQAL-DRUVcHpp.js +123 -0
  46. package/dist/diagram-KO2AKTUF-BOl4aaej.js +461 -0
  47. package/dist/diagram-LMA3HP47-ZeckPR2Q.js +142 -0
  48. package/dist/diagram-OG6HWLK6-qUWeLfa-.js +528 -0
  49. package/dist/erDiagram-TEJ5UH35-Bw_CWS13.js +899 -0
  50. package/dist/flowDiagram-I6XJVG4X-D3xEvQA-.js +1628 -0
  51. package/dist/ganttDiagram-6RSMTGT7-D8GvenY3.js +2707 -0
  52. package/dist/gitGraphDiagram-PVQCEYII-BWrN_HOm.js +815 -0
  53. package/dist/graph-BRoPeNF3.js +1545 -0
  54. package/dist/hooks/useNodeExecution.d.ts +1 -1
  55. package/dist/hooks/useNodeLayout.d.ts +1 -1
  56. package/dist/index.d.ts +3 -2
  57. package/dist/infoDiagram-5YYISTIA-Da8FG5tB.js +24 -0
  58. package/dist/init-DjUOC4st.js +16 -0
  59. package/dist/ishikawaDiagram-YF4QCWOH-Bg2_mKEc.js +621 -0
  60. package/dist/journeyDiagram-JHISSGLW-sFIxGfua.js +834 -0
  61. package/dist/kanban-definition-UN3LZRKU-CGmopzHd.js +724 -0
  62. package/dist/katex-DoRnZ_sp.js +11682 -0
  63. package/dist/layout-D9EpM4Fg.js +1728 -0
  64. package/dist/linear-BA49eco4.js +259 -0
  65. package/dist/mermaid.core-XSpZEAKP.js +16137 -0
  66. package/dist/mindmap-definition-RKZ34NQL-Bqf76QGB.js +827 -0
  67. package/dist/ordinal-B6-f3MAq.js +61 -0
  68. package/dist/pieDiagram-4H26LBE5-hHiP8HzL.js +163 -0
  69. package/dist/quadrantDiagram-W4KKPZXB-DSccwH8B.js +1024 -0
  70. package/dist/reactflow-ui-ai.es.js +12 -0
  71. package/dist/reactflow-ui.css +1 -1
  72. package/dist/reactflow-ui.es.js +8198 -7039
  73. package/dist/reactflow-ui.umd.js +52 -17
  74. package/dist/requirementDiagram-4Y6WPE33-DIpyoYZ_.js +882 -0
  75. package/dist/sankeyDiagram-5OEKKPKP-DsaPqq8D.js +847 -0
  76. package/dist/sequenceDiagram-3UESZ5HK-BNg7orie.js +2891 -0
  77. package/dist/services/ai/agentRunner.d.ts +51 -0
  78. package/dist/services/ai/contextEngine.d.ts +83 -0
  79. package/dist/services/ai/draftPersistence.d.ts +22 -0
  80. package/dist/services/ai/errorMessages.d.ts +16 -0
  81. package/dist/services/ai/intentClassifier.d.ts +17 -0
  82. package/dist/services/ai/protocolAdapter.d.ts +114 -0
  83. package/dist/services/ai/ruleEngine.d.ts +57 -0
  84. package/dist/services/ai/schemaRegistry.d.ts +51 -0
  85. package/dist/services/ai/systemPrompt.d.ts +30 -0
  86. package/dist/services/ai/toolDefs.d.ts +9 -0
  87. package/dist/services/ai/toolExecutor.d.ts +83 -0
  88. package/dist/services/ai/toolRegistry.d.ts +38 -0
  89. package/dist/services/ai/transport.d.ts +58 -0
  90. package/dist/services/aiService.d.ts +27 -5
  91. package/dist/stateDiagram-AJRCARHV-Rv1mSmnJ.js +263 -0
  92. package/dist/stateDiagram-v2-BHNVJYJU-BME16k02.js +16 -0
  93. package/dist/store/aiStore.d.ts +199 -0
  94. package/dist/store/ideStoresContext.d.ts +39 -0
  95. package/dist/store/libraryStore.d.ts +25 -0
  96. package/dist/timeline-definition-PNZ67QCA-CmmzdVk-.js +1055 -0
  97. package/dist/types/aiEvents.d.ts +38 -0
  98. package/dist/types/conductor.d.ts +23 -2
  99. package/dist/types/workflow.d.ts +36 -0
  100. package/dist/types/workflowLibrary.d.ts +27 -0
  101. package/dist/utils/executionAnalyzer.d.ts +32 -0
  102. package/dist/utils/nodeMeta.d.ts +6 -0
  103. package/dist/utils/proposalPreview.d.ts +19 -0
  104. package/dist/utils/taskTypeMeta.d.ts +18 -0
  105. package/dist/utils/workflowToMermaid.d.ts +7 -0
  106. package/dist/vennDiagram-CIIHVFJN-BQt00w9Q.js +1557 -0
  107. package/dist/wardley-L42UT6IY-D7b2ujEZ.js +22512 -0
  108. package/dist/wardleyDiagram-YWT4CUSO-LZpiODGN.js +675 -0
  109. package/dist/xychartDiagram-2RQKCTM6-BpJlv_mc.js +1342 -0
  110. package/package.json +14 -4
@@ -0,0 +1,445 @@
1
+ import { _ as w, aV as _, aW as Y, aX as F, aY as j, l as r, c as H, aZ as V, a_ as $, ag as Q, aQ as U, ah as P, af as W, a$ as Z, b0 as q, b1 as z } from "./mermaid.core-XSpZEAKP.js";
2
+ import { i as N, G as B } from "./graph-BRoPeNF3.js";
3
+ import { b as K, m as R, l as I } from "./layout-D9EpM4Fg.js";
4
+ var ee = 4;
5
+ function ne(e) {
6
+ return K(e, ee);
7
+ }
8
+ function b(e) {
9
+ var t = {
10
+ options: {
11
+ directed: e.isDirected(),
12
+ multigraph: e.isMultigraph(),
13
+ compound: e.isCompound()
14
+ },
15
+ nodes: te(e),
16
+ edges: se(e)
17
+ };
18
+ return N(e.graph()) || (t.value = ne(e.graph())), t;
19
+ }
20
+ function te(e) {
21
+ return R(e.nodes(), function(t) {
22
+ var n = e.node(t), a = e.parent(t), i = { v: t };
23
+ return N(n) || (i.value = n), N(a) || (i.parent = a), i;
24
+ });
25
+ }
26
+ function se(e) {
27
+ return R(e.edges(), function(t) {
28
+ var n = e.edge(t), a = { v: t.v, w: t.w };
29
+ return N(t.name) || (a.name = t.name), N(n) || (a.value = n), a;
30
+ });
31
+ }
32
+ var d = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ w(() => {
33
+ y.clear(), A.clear(), d.clear();
34
+ }, "clear"), D = /* @__PURE__ */ w((e, t) => {
35
+ const n = y.get(t) || [];
36
+ return r.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
37
+ }, "isDescendant"), ie = /* @__PURE__ */ w((e, t) => {
38
+ const n = y.get(t) || [];
39
+ return r.info("Descendants of ", t, " is ", n), r.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || D(e.v, t) || D(e.w, t) || n.includes(e.w) : (r.debug("Tilt, ", t, ",not in descendants"), !1);
40
+ }, "edgeInCluster"), G = /* @__PURE__ */ w((e, t, n, a) => {
41
+ r.warn(
42
+ "Copying children of ",
43
+ e,
44
+ "root",
45
+ a,
46
+ "data",
47
+ t.node(e),
48
+ a
49
+ );
50
+ const i = t.children(e) || [];
51
+ e !== a && i.push(e), r.warn("Copying (nodes) clusterId", e, "nodes", i), i.forEach((o) => {
52
+ if (t.children(o).length > 0)
53
+ G(o, t, n, a);
54
+ else {
55
+ const l = t.node(o);
56
+ r.info("cp ", o, " to ", a, " with parent ", e), n.setNode(o, l), a !== t.parent(o) && (r.warn("Setting parent", o, t.parent(o)), n.setParent(o, t.parent(o))), e !== a && o !== e ? (r.debug("Setting parent", o, e), n.setParent(o, e)) : (r.info("In copy ", e, "root", a, "data", t.node(e), a), r.debug(
57
+ "Not Setting parent for node=",
58
+ o,
59
+ "cluster!==rootId",
60
+ e !== a,
61
+ "node!==clusterId",
62
+ o !== e
63
+ ));
64
+ const u = t.edges(o);
65
+ r.debug("Copying Edges", u), u.forEach((c) => {
66
+ r.info("Edge", c);
67
+ const m = t.edge(c.v, c.w, c.name);
68
+ r.info("Edge data", m, a);
69
+ try {
70
+ ie(c, a) ? (r.info("Copying as ", c.v, c.w, m, c.name), n.setEdge(c.v, c.w, m, c.name), r.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : r.info(
71
+ "Skipping copy of edge ",
72
+ c.v,
73
+ "-->",
74
+ c.w,
75
+ " rootId: ",
76
+ a,
77
+ " clusterId:",
78
+ e
79
+ );
80
+ } catch (h) {
81
+ r.error(h);
82
+ }
83
+ });
84
+ }
85
+ r.debug("Removing node", o), t.removeNode(o);
86
+ });
87
+ }, "copy"), J = /* @__PURE__ */ w((e, t) => {
88
+ const n = t.children(e);
89
+ let a = [...n];
90
+ for (const i of n)
91
+ A.set(i, e), a = [...a, ...J(i, t)];
92
+ return a;
93
+ }, "extractDescendants"), oe = /* @__PURE__ */ w((e, t, n) => {
94
+ const a = e.edges().filter((c) => c.v === t || c.w === t), i = e.edges().filter((c) => c.v === n || c.w === n), o = a.map((c) => ({ v: c.v === t ? n : c.v, w: c.w === t ? t : c.w })), l = i.map((c) => ({ v: c.v, w: c.w }));
95
+ return o.filter((c) => l.some((m) => c.v === m.v && c.w === m.w));
96
+ }, "findCommonEdges"), C = /* @__PURE__ */ w((e, t, n) => {
97
+ const a = t.children(e);
98
+ if (r.trace("Searching children of id ", e, a), a.length < 1)
99
+ return e;
100
+ let i;
101
+ for (const o of a) {
102
+ const l = C(o, t, n), u = oe(t, n, l);
103
+ if (l)
104
+ if (u.length > 0)
105
+ i = l;
106
+ else
107
+ return l;
108
+ }
109
+ return i;
110
+ }, "findNonClusterChild"), k = /* @__PURE__ */ w((e) => !d.has(e) || !d.get(e).externalConnections ? e : d.has(e) ? d.get(e).id : e, "getAnchorId"), ae = /* @__PURE__ */ w((e, t) => {
111
+ if (!e || t > 10) {
112
+ r.debug("Opting out, no graph ");
113
+ return;
114
+ } else
115
+ r.debug("Opting in, graph ");
116
+ e.nodes().forEach(function(n) {
117
+ e.children(n).length > 0 && (r.warn(
118
+ "Cluster identified",
119
+ n,
120
+ " Replacement id in edges: ",
121
+ C(n, e, n)
122
+ ), y.set(n, J(n, e)), d.set(n, { id: C(n, e, n), clusterData: e.node(n) }));
123
+ }), e.nodes().forEach(function(n) {
124
+ const a = e.children(n), i = e.edges();
125
+ a.length > 0 ? (r.debug("Cluster identified", n, y), i.forEach((o) => {
126
+ const l = D(o.v, n), u = D(o.w, n);
127
+ l ^ u && (r.warn("Edge: ", o, " leaves cluster ", n), r.warn("Descendants of XXX ", n, ": ", y.get(n)), d.get(n).externalConnections = !0);
128
+ })) : r.debug("Not a cluster ", n, y);
129
+ });
130
+ for (let n of d.keys()) {
131
+ const a = d.get(n).id, i = e.parent(a);
132
+ i !== n && d.has(i) && !d.get(i).externalConnections && (d.get(n).id = i);
133
+ }
134
+ e.edges().forEach(function(n) {
135
+ const a = e.edge(n);
136
+ r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), r.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
137
+ let i = n.v, o = n.w;
138
+ if (r.warn(
139
+ "Fix XXX",
140
+ d,
141
+ "ids:",
142
+ n.v,
143
+ n.w,
144
+ "Translating: ",
145
+ d.get(n.v),
146
+ " --- ",
147
+ d.get(n.w)
148
+ ), d.get(n.v) || d.get(n.w)) {
149
+ if (r.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), i = k(n.v), o = k(n.w), e.removeEdge(n.v, n.w, n.name), i !== n.v) {
150
+ const l = e.parent(i);
151
+ d.get(l).externalConnections = !0, a.fromCluster = n.v;
152
+ }
153
+ if (o !== n.w) {
154
+ const l = e.parent(o);
155
+ d.get(l).externalConnections = !0, a.toCluster = n.w;
156
+ }
157
+ r.warn("Fix Replacing with XXX", i, o, n.name), e.setEdge(i, o, a, n.name);
158
+ }
159
+ }), r.warn("Adjusted Graph", b(e)), T(e, 0), r.trace(d);
160
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ w((e, t) => {
161
+ if (r.warn("extractor - ", t, b(e), e.children("D")), t > 10) {
162
+ r.error("Bailing out");
163
+ return;
164
+ }
165
+ let n = e.nodes(), a = !1;
166
+ for (const i of n) {
167
+ const o = e.children(i);
168
+ a = a || o.length > 0;
169
+ }
170
+ if (!a) {
171
+ r.debug("Done, no node has children", e.nodes());
172
+ return;
173
+ }
174
+ r.debug("Nodes = ", n, t);
175
+ for (const i of n)
176
+ if (r.debug(
177
+ "Extracting node",
178
+ i,
179
+ d,
180
+ d.has(i) && !d.get(i).externalConnections,
181
+ !e.parent(i),
182
+ e.node(i),
183
+ e.children("D"),
184
+ " Depth ",
185
+ t
186
+ ), !d.has(i))
187
+ r.debug("Not a cluster", i, t);
188
+ else if (!d.get(i).externalConnections && e.children(i) && e.children(i).length > 0) {
189
+ r.warn(
190
+ "Cluster without external connections, without a parent and with children",
191
+ i,
192
+ t
193
+ );
194
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
195
+ d.get(i)?.clusterData?.dir && (l = d.get(i).clusterData.dir, r.warn("Fixing dir", d.get(i).clusterData.dir, l));
196
+ const u = 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
+ r.warn("Old graph before copy", b(e)), G(i, e, u, i), e.setNode(i, {
209
+ clusterNode: !0,
210
+ id: i,
211
+ clusterData: d.get(i).clusterData,
212
+ label: d.get(i).label,
213
+ graph: u
214
+ }), r.warn("New graph after copy node: (", i, ")", b(u)), r.debug("Old graph after copy", b(e));
215
+ } else
216
+ r.warn(
217
+ "Cluster ** ",
218
+ i,
219
+ " **not meeting the criteria !externalConnections:",
220
+ !d.get(i).externalConnections,
221
+ " no parent: ",
222
+ !e.parent(i),
223
+ " children ",
224
+ e.children(i) && e.children(i).length > 0,
225
+ e.children("D"),
226
+ t
227
+ ), r.debug(d);
228
+ n = e.nodes(), r.warn("New list of nodes", n);
229
+ for (const i of n) {
230
+ const o = e.node(i);
231
+ r.warn(" Now next level", i, o), o?.clusterNode && T(o.graph, t + 1);
232
+ }
233
+ }, "extractor"), L = /* @__PURE__ */ w((e, t) => {
234
+ if (t.length === 0)
235
+ return [];
236
+ let n = Object.assign([], t);
237
+ return t.forEach((a) => {
238
+ const i = e.children(a), o = L(e, i);
239
+ n = [...n, ...o];
240
+ }), n;
241
+ }, "sorter"), ce = /* @__PURE__ */ w((e) => L(e, e.children()), "sortNodesByHierarchy"), M = /* @__PURE__ */ w(async (e, t, n, a, i, o) => {
242
+ r.warn("Graph in recursive render:XAX", b(t), i);
243
+ const l = t.graph().rankdir;
244
+ r.trace("Dir in recursive render - dir:", l);
245
+ const u = e.insert("g").attr("class", "root");
246
+ t.nodes() ? r.info("Recursive render XXX", t.nodes()) : r.info("No nodes found for", t), t.edges().length > 0 && r.info("Recursive edges", t.edge(t.edges()[0]));
247
+ const c = u.insert("g").attr("class", "clusters"), m = u.insert("g").attr("class", "edgePaths"), h = u.insert("g").attr("class", "edgeLabels"), v = u.insert("g").attr("class", "nodes");
248
+ await Promise.all(
249
+ t.nodes().map(async function(f) {
250
+ const s = t.node(f);
251
+ if (i !== void 0) {
252
+ const g = JSON.parse(JSON.stringify(i.clusterData));
253
+ r.trace(
254
+ `Setting data for parent cluster XXX
255
+ Node.id = `,
256
+ f,
257
+ `
258
+ data=`,
259
+ g.height,
260
+ `
261
+ Parent cluster`,
262
+ i.height
263
+ ), t.setNode(i.id, g), t.parent(f) || (r.trace("Setting parent", f, i.id), t.setParent(f, i.id, g));
264
+ }
265
+ if (r.info("(Insert) Node XXX" + f + ": " + JSON.stringify(t.node(f))), s?.clusterNode) {
266
+ r.info("Cluster identified XBX", f, s.width, t.node(f));
267
+ const { ranksep: g, nodesep: E } = t.graph();
268
+ s.graph.setGraph({
269
+ ...s.graph.graph(),
270
+ ranksep: g + 25,
271
+ nodesep: E
272
+ });
273
+ const p = await M(
274
+ v,
275
+ s.graph,
276
+ n,
277
+ a,
278
+ t.node(f),
279
+ o
280
+ ), x = p.elem;
281
+ V(s, x), s.diff = p.diff || 0, r.info(
282
+ "New compound node after recursive render XAX",
283
+ f,
284
+ "width",
285
+ // node,
286
+ s.width,
287
+ "height",
288
+ s.height
289
+ // node.x,
290
+ // node.y
291
+ ), $(x, s);
292
+ } else
293
+ t.children(f).length > 0 ? (r.trace(
294
+ "Cluster - the non recursive path XBX",
295
+ f,
296
+ s.id,
297
+ s,
298
+ s.width,
299
+ "Graph:",
300
+ t
301
+ ), r.trace(C(s.id, t)), d.set(s.id, { id: C(s.id, t), node: s })) : (r.trace("Node - the non recursive path XAX", f, v, t.node(f), l), await Q(v, t.node(f), { config: o, dir: l }));
302
+ })
303
+ ), await (/* @__PURE__ */ w(async () => {
304
+ const f = t.edges().map(async function(s) {
305
+ const g = t.edge(s.v, s.w, s.name);
306
+ r.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), r.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), r.info(
307
+ "Fix",
308
+ d,
309
+ "ids:",
310
+ s.v,
311
+ s.w,
312
+ "Translating: ",
313
+ d.get(s.v),
314
+ d.get(s.w)
315
+ ), await z(h, g);
316
+ });
317
+ await Promise.all(f);
318
+ }, "processEdges"))(), r.info("Graph before layout:", JSON.stringify(b(t))), r.info("############################################# XXX"), r.info("### Layout ### XXX"), r.info("############################################# XXX"), I(t), r.info("Graph after layout:", JSON.stringify(b(t)));
319
+ let O = 0, { subGraphTitleTotalMargin: S } = U(o);
320
+ return await Promise.all(
321
+ ce(t).map(async function(f) {
322
+ const s = t.node(f);
323
+ if (r.info(
324
+ "Position XBX => " + f + ": (" + s.x,
325
+ "," + s.y,
326
+ ") width: ",
327
+ s.width,
328
+ " height: ",
329
+ s.height
330
+ ), s?.clusterNode)
331
+ s.y += S, r.info(
332
+ "A tainted cluster node XBX1",
333
+ f,
334
+ s.id,
335
+ s.width,
336
+ s.height,
337
+ s.x,
338
+ s.y,
339
+ t.parent(f)
340
+ ), d.get(s.id).node = s, P(s);
341
+ else if (t.children(f).length > 0) {
342
+ r.info(
343
+ "A pure cluster node XBX1",
344
+ f,
345
+ s.id,
346
+ s.x,
347
+ s.y,
348
+ s.width,
349
+ s.height,
350
+ t.parent(f)
351
+ ), s.height += S, t.node(s.parentId);
352
+ const g = s?.padding / 2 || 0, E = s?.labelBBox?.height || 0, p = E - g || 0;
353
+ r.debug("OffsetY", p, "labelHeight", E, "halfPadding", g), await W(c, s), d.get(s.id).node = s;
354
+ } else {
355
+ const g = t.node(s.parentId);
356
+ s.y += S / 2, r.info(
357
+ "A regular node XBX1 - using the padding",
358
+ s.id,
359
+ "parent",
360
+ s.parentId,
361
+ s.width,
362
+ s.height,
363
+ s.x,
364
+ s.y,
365
+ "offsetY",
366
+ s.offsetY,
367
+ "parent",
368
+ g,
369
+ g?.offsetY,
370
+ s
371
+ ), P(s);
372
+ }
373
+ })
374
+ ), t.edges().forEach(function(f) {
375
+ const s = t.edge(f);
376
+ r.info("Edge " + f.v + " -> " + f.w + ": " + JSON.stringify(s), s), s.points.forEach((x) => x.y += S / 2);
377
+ const g = t.node(f.v);
378
+ var E = t.node(f.w);
379
+ const p = Z(m, s, d, n, g, E, a);
380
+ q(s, p);
381
+ }), t.nodes().forEach(function(f) {
382
+ const s = t.node(f);
383
+ r.info(f, s.type, s.diff), s.isGroup && (O = s.diff);
384
+ }), r.warn("Returning from recursive render XAX", u, O), { elem: u, diff: O };
385
+ }, "recursiveRender"), ue = /* @__PURE__ */ w(async (e, t) => {
386
+ const n = new B({
387
+ multigraph: !0,
388
+ compound: !0
389
+ }).setGraph({
390
+ rankdir: e.direction,
391
+ nodesep: e.config?.nodeSpacing || e.config?.flowchart?.nodeSpacing || e.nodeSpacing,
392
+ ranksep: e.config?.rankSpacing || e.config?.flowchart?.rankSpacing || e.rankSpacing,
393
+ marginx: 8,
394
+ marginy: 8
395
+ }).setDefaultEdgeLabel(function() {
396
+ return {};
397
+ }), a = t.select("g");
398
+ _(a, e.markers, e.type, e.diagramId), Y(), F(), j(), re(), e.nodes.forEach((o) => {
399
+ n.setNode(o.id, { ...o }), o.parentId && n.setParent(o.id, o.parentId);
400
+ }), r.debug("Edges:", e.edges), e.edges.forEach((o) => {
401
+ if (o.start === o.end) {
402
+ const l = o.start, u = l + "---" + l + "---1", c = l + "---" + l + "---2", m = n.node(l);
403
+ n.setNode(u, {
404
+ domId: u,
405
+ id: u,
406
+ parentId: m.parentId,
407
+ labelStyle: "",
408
+ label: "",
409
+ padding: 0,
410
+ shape: "labelRect",
411
+ // shape: 'rect',
412
+ style: "",
413
+ width: 10,
414
+ height: 10
415
+ }), n.setParent(u, m.parentId), n.setNode(c, {
416
+ domId: c,
417
+ id: c,
418
+ parentId: m.parentId,
419
+ labelStyle: "",
420
+ padding: 0,
421
+ // shape: 'rect',
422
+ shape: "labelRect",
423
+ label: "",
424
+ style: "",
425
+ width: 10,
426
+ height: 10
427
+ }), n.setParent(c, m.parentId);
428
+ const h = structuredClone(o), v = structuredClone(o), X = structuredClone(o);
429
+ h.label = "", h.arrowTypeEnd = "none", h.endLabelLeft = "", h.endLabelRight = "", h.startLabelLeft = "", h.id = l + "-cyclic-special-1", v.startLabelRight = "", v.startLabelLeft = "", v.endLabelLeft = "", v.endLabelRight = "", v.arrowTypeStart = "none", v.arrowTypeEnd = "none", v.id = l + "-cyclic-special-mid", X.label = "", X.startLabelRight = "", X.startLabelLeft = "", X.arrowTypeStart = "none", m.isGroup && (h.fromCluster = l, X.toCluster = l), X.id = l + "-cyclic-special-2", X.arrowTypeStart = "none", n.setEdge(l, u, h, l + "-cyclic-special-0"), n.setEdge(u, c, v, l + "-cyclic-special-1"), n.setEdge(c, l, X, l + "-cyc<lic-special-2");
430
+ } else
431
+ n.setEdge(o.start, o.end, { ...o }, o.id);
432
+ }), r.warn("Graph at first:", JSON.stringify(b(n))), ae(n), r.warn("Graph after XAX:", JSON.stringify(b(n)));
433
+ const i = H();
434
+ await M(
435
+ a,
436
+ n,
437
+ e.type,
438
+ e.diagramId,
439
+ void 0,
440
+ i
441
+ );
442
+ }, "render");
443
+ export {
444
+ ue as render
445
+ };
@@ -0,0 +1,171 @@
1
+ function J(n) {
2
+ return Math.abs(n = Math.round(n)) >= 1e21 ? n.toLocaleString("en").replace(/,/g, "") : n.toString(10);
3
+ }
4
+ function j(n, t) {
5
+ if (!isFinite(n) || n === 0) return null;
6
+ var e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e"), i = n.slice(0, e);
7
+ return [
8
+ i.length > 1 ? i[0] + i.slice(2) : i,
9
+ +n.slice(e + 1)
10
+ ];
11
+ }
12
+ function K(n) {
13
+ return n = j(Math.abs(n)), n ? n[1] : NaN;
14
+ }
15
+ function Q(n, t) {
16
+ return function(e, i) {
17
+ for (var o = e.length, a = [], c = 0, h = n[0], M = 0; o > 0 && h > 0 && (M + h + 1 > i && (h = Math.max(1, i - M)), a.push(e.substring(o -= h, o + h)), !((M += h + 1) > i)); )
18
+ h = n[c = (c + 1) % n.length];
19
+ return a.reverse().join(t);
20
+ };
21
+ }
22
+ function V(n) {
23
+ return function(t) {
24
+ return t.replace(/[0-9]/g, function(e) {
25
+ return n[+e];
26
+ });
27
+ };
28
+ }
29
+ var W = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
30
+ function $(n) {
31
+ if (!(t = W.exec(n))) throw new Error("invalid format: " + n);
32
+ var t;
33
+ return new L({
34
+ fill: t[1],
35
+ align: t[2],
36
+ sign: t[3],
37
+ symbol: t[4],
38
+ zero: t[5],
39
+ width: t[6],
40
+ comma: t[7],
41
+ precision: t[8] && t[8].slice(1),
42
+ trim: t[9],
43
+ type: t[10]
44
+ });
45
+ }
46
+ $.prototype = L.prototype;
47
+ function L(n) {
48
+ this.fill = n.fill === void 0 ? " " : n.fill + "", this.align = n.align === void 0 ? ">" : n.align + "", this.sign = n.sign === void 0 ? "-" : n.sign + "", this.symbol = n.symbol === void 0 ? "" : n.symbol + "", this.zero = !!n.zero, this.width = n.width === void 0 ? void 0 : +n.width, this.comma = !!n.comma, this.precision = n.precision === void 0 ? void 0 : +n.precision, this.trim = !!n.trim, this.type = n.type === void 0 ? "" : n.type + "";
49
+ }
50
+ L.prototype.toString = function() {
51
+ return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
52
+ };
53
+ function _(n) {
54
+ n: for (var t = n.length, e = 1, i = -1, o; e < t; ++e)
55
+ switch (n[e]) {
56
+ case ".":
57
+ i = o = e;
58
+ break;
59
+ case "0":
60
+ i === 0 && (i = e), o = e;
61
+ break;
62
+ default:
63
+ if (!+n[e]) break n;
64
+ i > 0 && (i = 0);
65
+ break;
66
+ }
67
+ return i > 0 ? n.slice(0, i) + n.slice(o + 1) : n;
68
+ }
69
+ var N;
70
+ function v(n, t) {
71
+ var e = j(n, t);
72
+ if (!e) return N = void 0, n.toPrecision(t);
73
+ var i = e[0], o = e[1], a = o - (N = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
74
+ return a === c ? i : a > c ? i + new Array(a - c + 1).join("0") : a > 0 ? i.slice(0, a) + "." + i.slice(a) : "0." + new Array(1 - a).join("0") + j(n, Math.max(0, t + a - 1))[0];
75
+ }
76
+ function X(n, t) {
77
+ var e = j(n, t);
78
+ if (!e) return n + "";
79
+ var i = e[0], o = e[1];
80
+ return o < 0 ? "0." + new Array(-o).join("0") + i : i.length > o + 1 ? i.slice(0, o + 1) + "." + i.slice(o + 1) : i + new Array(o - i.length + 2).join("0");
81
+ }
82
+ const O = {
83
+ "%": (n, t) => (n * 100).toFixed(t),
84
+ b: (n) => Math.round(n).toString(2),
85
+ c: (n) => n + "",
86
+ d: J,
87
+ e: (n, t) => n.toExponential(t),
88
+ f: (n, t) => n.toFixed(t),
89
+ g: (n, t) => n.toPrecision(t),
90
+ o: (n) => Math.round(n).toString(8),
91
+ p: (n, t) => X(n * 100, t),
92
+ r: X,
93
+ s: v,
94
+ X: (n) => Math.round(n).toString(16).toUpperCase(),
95
+ x: (n) => Math.round(n).toString(16)
96
+ };
97
+ function R(n) {
98
+ return n;
99
+ }
100
+ var U = Array.prototype.map, Y = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
101
+ function nn(n) {
102
+ var t = n.grouping === void 0 || n.thousands === void 0 ? R : Q(U.call(n.grouping, Number), n.thousands + ""), e = n.currency === void 0 ? "" : n.currency[0] + "", i = n.currency === void 0 ? "" : n.currency[1] + "", o = n.decimal === void 0 ? "." : n.decimal + "", a = n.numerals === void 0 ? R : V(U.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", h = n.minus === void 0 ? "−" : n.minus + "", M = n.nan === void 0 ? "NaN" : n.nan + "";
103
+ function T(f, g) {
104
+ f = $(f);
105
+ var b = f.fill, p = f.align, m = f.sign, w = f.symbol, S = f.zero, E = f.width, F = f.comma, y = f.precision, C = f.trim, d = f.type;
106
+ d === "n" ? (F = !0, d = "g") : O[d] || (y === void 0 && (y = 12), C = !0, d = "g"), (S || b === "0" && p === "=") && (S = !0, b = "0", p = "=");
107
+ var q = (g && g.prefix !== void 0 ? g.prefix : "") + (w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : ""), B = (w === "$" ? i : /[%p]/.test(d) ? c : "") + (g && g.suffix !== void 0 ? g.suffix : ""), D = O[d], H = /[defgprs%]/.test(d);
108
+ y = y === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, y)) : Math.max(0, Math.min(20, y));
109
+ function G(r) {
110
+ var l = q, u = B, x, I, k;
111
+ if (d === "c")
112
+ u = D(r) + u, r = "";
113
+ else {
114
+ r = +r;
115
+ var P = r < 0 || 1 / r < 0;
116
+ if (r = isNaN(r) ? M : D(Math.abs(r), y), C && (r = _(r)), P && +r == 0 && m !== "+" && (P = !1), l = (P ? m === "(" ? m : h : m === "-" || m === "(" ? "" : m) + l, u = (d === "s" && !isNaN(r) && N !== void 0 ? Y[8 + N / 3] : "") + u + (P && m === "(" ? ")" : ""), H) {
117
+ for (x = -1, I = r.length; ++x < I; )
118
+ if (k = r.charCodeAt(x), 48 > k || k > 57) {
119
+ u = (k === 46 ? o + r.slice(x + 1) : r.slice(x)) + u, r = r.slice(0, x);
120
+ break;
121
+ }
122
+ }
123
+ }
124
+ F && !S && (r = t(r, 1 / 0));
125
+ var z = l.length + r.length + u.length, s = z < E ? new Array(E - z + 1).join(b) : "";
126
+ switch (F && S && (r = t(s + r, s.length ? E - u.length : 1 / 0), s = ""), p) {
127
+ case "<":
128
+ r = l + r + u + s;
129
+ break;
130
+ case "=":
131
+ r = l + s + r + u;
132
+ break;
133
+ case "^":
134
+ r = s.slice(0, z = s.length >> 1) + l + r + u + s.slice(z);
135
+ break;
136
+ default:
137
+ r = s + l + r + u;
138
+ break;
139
+ }
140
+ return a(r);
141
+ }
142
+ return G.toString = function() {
143
+ return f + "";
144
+ }, G;
145
+ }
146
+ function Z(f, g) {
147
+ var b = Math.max(-8, Math.min(8, Math.floor(K(g) / 3))) * 3, p = Math.pow(10, -b), m = T((f = $(f), f.type = "f", f), { suffix: Y[8 + b / 3] });
148
+ return function(w) {
149
+ return m(p * w);
150
+ };
151
+ }
152
+ return {
153
+ format: T,
154
+ formatPrefix: Z
155
+ };
156
+ }
157
+ var A, tn, rn;
158
+ en({
159
+ thousands: ",",
160
+ grouping: [3],
161
+ currency: ["$", ""]
162
+ });
163
+ function en(n) {
164
+ return A = nn(n), tn = A.format, rn = A.formatPrefix, A;
165
+ }
166
+ export {
167
+ rn as a,
168
+ tn as b,
169
+ K as e,
170
+ $ as f
171
+ };