@huyooo/ai-chat-frontend-vue 0.2.13 → 0.2.14

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 (142) hide show
  1. package/README.md +85 -77
  2. package/dist/_baseUniq-Berj5otS.js +477 -0
  3. package/dist/arc-D4b-De5i.js +83 -0
  4. package/dist/architecture-U656AL7Q-B1R4o7wt.js +5 -0
  5. package/dist/architectureDiagram-VXUJARFQ-0H1LzSrf.js +4668 -0
  6. package/dist/blockDiagram-VD42YOAC-Dd6DMjLf.js +2265 -0
  7. package/dist/c4Diagram-YG6GDRKO-c6mpIonb.js +1581 -0
  8. package/dist/channel-CQSBI1fo.js +5 -0
  9. package/dist/chunk-4BX2VUAB-CfWC7lTG.js +9 -0
  10. package/dist/chunk-55IACEB6-joM8m2Zv.js +8 -0
  11. package/dist/chunk-B4BG7PRW-DN94Y3mS.js +1376 -0
  12. package/dist/chunk-DI55MBZ5-CPRGoFPG.js +1382 -0
  13. package/dist/chunk-FMBD7UC4-dUKl2TcN.js +19 -0
  14. package/dist/chunk-QN33PNHL-o3WmqquO.js +20 -0
  15. package/dist/chunk-QZHKN3VN-Btf62lRF.js +15 -0
  16. package/dist/chunk-TZMSLE5B-QCPpnm8Y.js +64 -0
  17. package/dist/classDiagram-2ON5EDUG-ERF9RE9K.js +16 -0
  18. package/dist/classDiagram-v2-WZHVMYZB-ERF9RE9K.js +16 -0
  19. package/dist/clone-B_B1yyxj.js +8 -0
  20. package/dist/components/ChatPanel.vue.d.ts +11 -7
  21. package/dist/components/ChatPanel.vue.d.ts.map +1 -1
  22. package/dist/components/common/SettingsPanel.vue.d.ts +10 -1
  23. package/dist/components/common/SettingsPanel.vue.d.ts.map +1 -1
  24. package/dist/components/common/ToggleSwitch.vue.d.ts.map +1 -1
  25. package/dist/components/input/ChatInput.vue.d.ts +4 -1
  26. package/dist/components/input/ChatInput.vue.d.ts.map +1 -1
  27. package/dist/components/input/DropdownSelector.vue.d.ts +10 -0
  28. package/dist/components/input/DropdownSelector.vue.d.ts.map +1 -1
  29. package/dist/components/message/MessageBubble.vue.d.ts +2 -2
  30. package/dist/components/message/MessageBubble.vue.d.ts.map +1 -1
  31. package/dist/components/message/PartsRenderer.vue.d.ts +6 -0
  32. package/dist/components/message/PartsRenderer.vue.d.ts.map +1 -1
  33. package/dist/components/message/parts/CollapsibleCard.vue.d.ts.map +1 -1
  34. package/dist/components/message/parts/ImagePart.vue.d.ts.map +1 -1
  35. package/dist/components/message/parts/SearchPart.vue.d.ts.map +1 -1
  36. package/dist/components/message/parts/TextPart.vue.d.ts +3 -1
  37. package/dist/components/message/parts/TextPart.vue.d.ts.map +1 -1
  38. package/dist/components/message/parts/ToolCallPart.vue.d.ts +9 -4
  39. package/dist/components/message/parts/ToolCallPart.vue.d.ts.map +1 -1
  40. package/dist/components/message/parts/index.d.ts +5 -1
  41. package/dist/components/message/parts/index.d.ts.map +1 -1
  42. package/dist/components/message/parts/visual-predicate.d.ts +7 -0
  43. package/dist/components/message/parts/visual-predicate.d.ts.map +1 -0
  44. package/dist/components/message/parts/visual-render.d.ts +2 -0
  45. package/dist/components/message/parts/visual-render.d.ts.map +1 -0
  46. package/dist/components/message/parts/visual.d.ts +3 -0
  47. package/dist/components/message/parts/visual.d.ts.map +1 -0
  48. package/dist/composables/useChat.d.ts +34 -10
  49. package/dist/composables/useChat.d.ts.map +1 -1
  50. package/dist/composables/useImageUpload.d.ts +7 -0
  51. package/dist/composables/useImageUpload.d.ts.map +1 -1
  52. package/dist/cose-bilkent-S5V4N54A-C-CkEnIH.js +2608 -0
  53. package/dist/cytoscape.esm-CjI2IsL8.js +18735 -0
  54. package/dist/dagre-6UL2VRFP-BbmZysl9.js +446 -0
  55. package/dist/defaultLocale-D7EN2tov.js +171 -0
  56. package/dist/diagram-PSM6KHXK-CMnope5e.js +533 -0
  57. package/dist/diagram-QEK2KX5R-Bc87skpo.js +221 -0
  58. package/dist/diagram-S2PKOQOG-BtkzC5-o.js +143 -0
  59. package/dist/erDiagram-Q2GNP2WA-CwQLdjh9.js +842 -0
  60. package/dist/flowDiagram-NV44I4VS-8ehMD0M4.js +1627 -0
  61. package/dist/ganttDiagram-JELNMOA3-dLX8Pbvy.js +2670 -0
  62. package/dist/gitGraph-F6HP7TQM-BBk5qfnx.js +5 -0
  63. package/dist/gitGraphDiagram-NY62KEGX-DG_fvWrq.js +712 -0
  64. package/dist/graph-B7BnGhuR.js +381 -0
  65. package/dist/index-Cr3tTH72.js +83883 -0
  66. package/dist/index.d.ts +7 -7
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +19 -56433
  69. package/dist/info-NVLQJR56-eZr6nVr1.js +5 -0
  70. package/dist/infoDiagram-WHAUD3N6-BcVYTft_.js +24 -0
  71. package/dist/init-DjUOC4st.js +16 -0
  72. package/dist/journeyDiagram-XKPGCS4Q-D4C72gYB.js +834 -0
  73. package/dist/kanban-definition-3W4ZIXB7-BuSjAlm6.js +721 -0
  74. package/dist/layout-LjYblgUu.js +1441 -0
  75. package/dist/linear-DtPqj295.js +259 -0
  76. package/dist/mermaid-parser.core-DdOZxjrw.js +15189 -0
  77. package/dist/min-DYbgfxu0.js +38 -0
  78. package/dist/mindmap-definition-VGOIOE7T-BZxsr4M_.js +787 -0
  79. package/dist/ordinal-DfAQgscy.js +61 -0
  80. package/dist/packet-BFZMPI3H-XfNBjRzf.js +5 -0
  81. package/dist/pie-7BOR55EZ-pJDdOv19.js +5 -0
  82. package/dist/pieDiagram-ADFJNKIX-DDwfWBNn.js +161 -0
  83. package/dist/quadrantDiagram-AYHSOK5B-Ddpxuto0.js +1024 -0
  84. package/dist/radar-NHE76QYJ-jE07d-4Z.js +5 -0
  85. package/dist/requirementDiagram-UZGBJVZJ-B_TLWQ-N.js +852 -0
  86. package/dist/sankeyDiagram-TZEHDZUN-C1TWrUpG.js +810 -0
  87. package/dist/sequenceDiagram-WL72ISMW-B8pqb5YX.js +2518 -0
  88. package/dist/stateDiagram-FKZM4ZOC-DwNT1ej6.js +263 -0
  89. package/dist/stateDiagram-v2-4FDKWEC3-CZQUitzd.js +16 -0
  90. package/dist/style.css +1 -1
  91. package/dist/timeline-definition-IT6M3QCI-BGdS1wvf.js +799 -0
  92. package/dist/treemap-KMMF4GRG-B_eEU0Q4.js +5 -0
  93. package/dist/types/index.d.ts +36 -37
  94. package/dist/types/index.d.ts.map +1 -1
  95. package/dist/xychartDiagram-PRI3JC2R-DtwXQqN4.js +1340 -0
  96. package/package.json +3 -3
  97. package/src/components/ChatPanel.vue +75 -13
  98. package/src/components/common/SettingsPanel.vue +169 -0
  99. package/src/components/input/ChatInput.vue +49 -34
  100. package/src/components/input/DropdownSelector.vue +175 -18
  101. package/src/components/message/MessageBubble.vue +61 -40
  102. package/src/components/message/PartsRenderer.vue +106 -27
  103. package/src/components/message/parts/CollapsibleCard.vue +8 -3
  104. package/src/components/message/parts/ImagePart.vue +0 -1
  105. package/src/components/message/parts/SearchPart.vue +2 -0
  106. package/src/components/message/parts/TextPart.vue +753 -11
  107. package/src/components/message/parts/ToolCallPart.vue +315 -246
  108. package/src/components/message/parts/index.ts +5 -1
  109. package/src/components/message/parts/visual-predicate.ts +43 -0
  110. package/src/components/message/parts/visual-render.ts +19 -0
  111. package/src/components/message/parts/visual.ts +12 -0
  112. package/src/composables/useChat.ts +560 -92
  113. package/src/composables/useImageUpload.ts +115 -11
  114. package/src/index.ts +6 -8
  115. package/src/styles.css +124 -0
  116. package/src/types/index.ts +52 -44
  117. package/dist/components/message/blocks/CodeBlock.vue.d.ts +0 -11
  118. package/dist/components/message/blocks/CodeBlock.vue.d.ts.map +0 -1
  119. package/dist/components/message/blocks/TextBlock.vue.d.ts +0 -7
  120. package/dist/components/message/blocks/TextBlock.vue.d.ts.map +0 -1
  121. package/dist/components/message/blocks/index.d.ts +0 -6
  122. package/dist/components/message/blocks/index.d.ts.map +0 -1
  123. package/dist/components/message/parts/ToolResultPart.vue.d.ts +0 -14
  124. package/dist/components/message/parts/ToolResultPart.vue.d.ts.map +0 -1
  125. package/dist/components/message/tool-results/DefaultToolResult.vue.d.ts +0 -4
  126. package/dist/components/message/tool-results/DefaultToolResult.vue.d.ts.map +0 -1
  127. package/dist/components/message/tool-results/SearchResults.vue.d.ts +0 -4
  128. package/dist/components/message/tool-results/SearchResults.vue.d.ts.map +0 -1
  129. package/dist/components/message/tool-results/WeatherCard.vue.d.ts +0 -4
  130. package/dist/components/message/tool-results/WeatherCard.vue.d.ts.map +0 -1
  131. package/dist/components/message/tool-results/index.d.ts +0 -7
  132. package/dist/components/message/tool-results/index.d.ts.map +0 -1
  133. package/src/components/message/ContentRenderer.vue +0 -61
  134. package/src/components/message/ToolResultRenderer.vue +0 -27
  135. package/src/components/message/blocks/CodeBlock.vue +0 -113
  136. package/src/components/message/blocks/TextBlock.vue +0 -21
  137. package/src/components/message/blocks/index.ts +0 -6
  138. package/src/components/message/parts/ToolResultPart.vue +0 -78
  139. package/src/components/message/tool-results/DefaultToolResult.vue +0 -45
  140. package/src/components/message/tool-results/SearchResults.vue +0 -133
  141. package/src/components/message/tool-results/WeatherCard.vue +0 -139
  142. package/src/components/message/tool-results/index.ts +0 -7
@@ -0,0 +1,446 @@
1
+ import { _ as X, ar as F, as as Y, at as _, au as H, l as i, c as V, av as z, aw as U, ag as $, al as q, ah as P, af as K, ax as Q, ay as W, az as Z } from "./index-Cr3tTH72.js";
2
+ import { i as x, G as B } from "./graph-B7BnGhuR.js";
3
+ import { l as I } from "./layout-LjYblgUu.js";
4
+ import { c as L } from "./clone-B_B1yyxj.js";
5
+ import { m as A } from "./min-DYbgfxu0.js";
6
+ function p(e) {
7
+ var t = {
8
+ options: {
9
+ directed: e.isDirected(),
10
+ multigraph: e.isMultigraph(),
11
+ compound: e.isCompound()
12
+ },
13
+ nodes: ee(e),
14
+ edges: ne(e)
15
+ };
16
+ return x(e.graph()) || (t.value = L(e.graph())), t;
17
+ }
18
+ function ee(e) {
19
+ return A(e.nodes(), function(t) {
20
+ var n = e.node(t), o = e.parent(t), c = { v: t };
21
+ return x(n) || (c.value = n), x(o) || (c.parent = o), c;
22
+ });
23
+ }
24
+ function ne(e) {
25
+ return A(e.edges(), function(t) {
26
+ var n = e.edge(t), o = { v: t.v, w: t.w };
27
+ return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o;
28
+ });
29
+ }
30
+ var f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ X(() => {
31
+ b.clear(), J.clear(), f.clear();
32
+ }, "clear"), O = /* @__PURE__ */ X((e, t) => {
33
+ const n = b.get(t) || [];
34
+ return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e);
35
+ }, "isDescendant"), se = /* @__PURE__ */ X((e, t) => {
36
+ const n = b.get(t) || [];
37
+ 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);
38
+ }, "edgeInCluster"), G = /* @__PURE__ */ X((e, t, n, o) => {
39
+ i.warn(
40
+ "Copying children of ",
41
+ e,
42
+ "root",
43
+ o,
44
+ "data",
45
+ t.node(e),
46
+ o
47
+ );
48
+ const c = t.children(e) || [];
49
+ e !== o && c.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => {
50
+ if (t.children(a).length > 0)
51
+ G(a, t, n, o);
52
+ else {
53
+ const r = t.node(a);
54
+ 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(
55
+ "Not Setting parent for node=",
56
+ a,
57
+ "cluster!==rootId",
58
+ e !== o,
59
+ "node!==clusterId",
60
+ a !== e
61
+ ));
62
+ const u = t.edges(a);
63
+ i.debug("Copying Edges", u), u.forEach((l) => {
64
+ i.info("Edge", l);
65
+ const v = t.edge(l.v, l.w, l.name);
66
+ i.info("Edge data", v, o);
67
+ try {
68
+ 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(
69
+ "Skipping copy of edge ",
70
+ l.v,
71
+ "-->",
72
+ l.w,
73
+ " rootId: ",
74
+ o,
75
+ " clusterId:",
76
+ e
77
+ );
78
+ } catch (C) {
79
+ i.error(C);
80
+ }
81
+ });
82
+ }
83
+ i.debug("Removing node", a), t.removeNode(a);
84
+ });
85
+ }, "copy"), R = /* @__PURE__ */ X((e, t) => {
86
+ const n = t.children(e);
87
+ let o = [...n];
88
+ for (const c of n)
89
+ J.set(c, e), o = [...o, ...R(c, t)];
90
+ return o;
91
+ }, "extractDescendants"), ie = /* @__PURE__ */ X((e, t, n) => {
92
+ 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 }));
93
+ return a.filter((l) => r.some((v) => l.v === v.v && l.w === v.w));
94
+ }, "findCommonEdges"), D = /* @__PURE__ */ X((e, t, n) => {
95
+ const o = t.children(e);
96
+ if (i.trace("Searching children of id ", e, o), o.length < 1)
97
+ return e;
98
+ let c;
99
+ for (const a of o) {
100
+ const r = D(a, t, n), u = ie(t, n, r);
101
+ if (r)
102
+ if (u.length > 0)
103
+ c = r;
104
+ else
105
+ return r;
106
+ }
107
+ return c;
108
+ }, "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) => {
109
+ if (!e || t > 10) {
110
+ i.debug("Opting out, no graph ");
111
+ return;
112
+ } else
113
+ i.debug("Opting in, graph ");
114
+ e.nodes().forEach(function(n) {
115
+ e.children(n).length > 0 && (i.warn(
116
+ "Cluster identified",
117
+ n,
118
+ " Replacement id in edges: ",
119
+ D(n, e, n)
120
+ ), b.set(n, R(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) }));
121
+ }), e.nodes().forEach(function(n) {
122
+ const o = e.children(n), c = e.edges();
123
+ o.length > 0 ? (i.debug("Cluster identified", n, b), c.forEach((a) => {
124
+ const r = O(a.v, n), u = O(a.w, n);
125
+ r ^ u && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", b.get(n)), f.get(n).externalConnections = !0);
126
+ })) : i.debug("Not a cluster ", n, b);
127
+ });
128
+ for (let n of f.keys()) {
129
+ const o = f.get(n).id, c = e.parent(o);
130
+ c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c);
131
+ }
132
+ e.edges().forEach(function(n) {
133
+ const o = e.edge(n);
134
+ i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n)));
135
+ let c = n.v, a = n.w;
136
+ if (i.warn(
137
+ "Fix XXX",
138
+ f,
139
+ "ids:",
140
+ n.v,
141
+ n.w,
142
+ "Translating: ",
143
+ f.get(n.v),
144
+ " --- ",
145
+ f.get(n.w)
146
+ ), f.get(n.v) || f.get(n.w)) {
147
+ 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) {
148
+ const r = e.parent(c);
149
+ f.get(r).externalConnections = !0, o.fromCluster = n.v;
150
+ }
151
+ if (a !== n.w) {
152
+ const r = e.parent(a);
153
+ f.get(r).externalConnections = !0, o.toCluster = n.w;
154
+ }
155
+ i.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name);
156
+ }
157
+ }), i.warn("Adjusted Graph", p(e)), T(e, 0), i.trace(f);
158
+ }, "adjustClustersAndEdges"), T = /* @__PURE__ */ X((e, t) => {
159
+ var c, a;
160
+ if (i.warn("extractor - ", t, p(e), e.children("D")), t > 10) {
161
+ i.error("Bailing out");
162
+ return;
163
+ }
164
+ let n = e.nodes(), o = !1;
165
+ for (const r of n) {
166
+ const u = e.children(r);
167
+ o = o || u.length > 0;
168
+ }
169
+ if (!o) {
170
+ i.debug("Done, no node has children", e.nodes());
171
+ return;
172
+ }
173
+ i.debug("Nodes = ", n, t);
174
+ for (const r of n)
175
+ if (i.debug(
176
+ "Extracting node",
177
+ r,
178
+ f,
179
+ f.has(r) && !f.get(r).externalConnections,
180
+ !e.parent(r),
181
+ e.node(r),
182
+ e.children("D"),
183
+ " Depth ",
184
+ t
185
+ ), !f.has(r))
186
+ i.debug("Not a cluster", r, t);
187
+ else if (!f.get(r).externalConnections && e.children(r) && e.children(r).length > 0) {
188
+ i.warn(
189
+ "Cluster without external connections, without a parent and with children",
190
+ r,
191
+ t
192
+ );
193
+ let l = e.graph().rankdir === "TB" ? "LR" : "TB";
194
+ (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));
195
+ const v = new B({
196
+ multigraph: !0,
197
+ compound: !0
198
+ }).setGraph({
199
+ rankdir: l,
200
+ nodesep: 50,
201
+ ranksep: 50,
202
+ marginx: 8,
203
+ marginy: 8
204
+ }).setDefaultEdgeLabel(function() {
205
+ return {};
206
+ });
207
+ i.warn("Old graph before copy", p(e)), G(r, e, v, r), e.setNode(r, {
208
+ clusterNode: !0,
209
+ id: r,
210
+ clusterData: f.get(r).clusterData,
211
+ label: f.get(r).label,
212
+ graph: v
213
+ }), i.warn("New graph after copy node: (", r, ")", p(v)), i.debug("Old graph after copy", p(e));
214
+ } else
215
+ i.warn(
216
+ "Cluster ** ",
217
+ r,
218
+ " **not meeting the criteria !externalConnections:",
219
+ !f.get(r).externalConnections,
220
+ " no parent: ",
221
+ !e.parent(r),
222
+ " children ",
223
+ e.children(r) && e.children(r).length > 0,
224
+ e.children("D"),
225
+ t
226
+ ), i.debug(f);
227
+ n = e.nodes(), i.warn("New list of nodes", n);
228
+ for (const r of n) {
229
+ const u = e.node(r);
230
+ i.warn(" Now next level", r, u), u != null && u.clusterNode && T(u.graph, t + 1);
231
+ }
232
+ }, "extractor"), M = /* @__PURE__ */ X((e, t) => {
233
+ if (t.length === 0)
234
+ return [];
235
+ let n = Object.assign([], t);
236
+ return t.forEach((o) => {
237
+ const c = e.children(o), a = M(e, c);
238
+ n = [...n, ...a];
239
+ }), n;
240
+ }, "sorter"), oe = /* @__PURE__ */ X((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ X(async (e, t, n, o, c, a) => {
241
+ i.warn("Graph in recursive render:XAX", p(t), c);
242
+ const r = t.graph().rankdir;
243
+ i.trace("Dir in recursive render - dir:", r);
244
+ const u = e.insert("g").attr("class", "root");
245
+ 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]));
246
+ 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");
247
+ await Promise.all(
248
+ t.nodes().map(async function(d) {
249
+ const s = t.node(d);
250
+ if (c !== void 0) {
251
+ const w = JSON.parse(JSON.stringify(c.clusterData));
252
+ i.trace(
253
+ `Setting data for parent cluster XXX
254
+ Node.id = `,
255
+ d,
256
+ `
257
+ data=`,
258
+ w.height,
259
+ `
260
+ Parent cluster`,
261
+ c.height
262
+ ), t.setNode(c.id, w), t.parent(d) || (i.trace("Setting parent", d, c.id), t.setParent(d, c.id, w));
263
+ }
264
+ if (i.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) {
265
+ i.info("Cluster identified XBX", d, s.width, t.node(d));
266
+ const { ranksep: w, nodesep: m } = t.graph();
267
+ s.graph.setGraph({
268
+ ...s.graph.graph(),
269
+ ranksep: w + 25,
270
+ nodesep: m
271
+ });
272
+ const N = await j(
273
+ g,
274
+ s.graph,
275
+ n,
276
+ o,
277
+ t.node(d),
278
+ a
279
+ ), S = N.elem;
280
+ z(s, S), s.diff = N.diff || 0, i.info(
281
+ "New compound node after recursive render XAX",
282
+ d,
283
+ "width",
284
+ // node,
285
+ s.width,
286
+ "height",
287
+ s.height
288
+ // node.x,
289
+ // node.y
290
+ ), U(S, s);
291
+ } else
292
+ t.children(d).length > 0 ? (i.trace(
293
+ "Cluster - the non recursive path XBX",
294
+ d,
295
+ s.id,
296
+ s,
297
+ s.width,
298
+ "Graph:",
299
+ t
300
+ ), 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 }));
301
+ })
302
+ ), await (/* @__PURE__ */ X(async () => {
303
+ const d = t.edges().map(async function(s) {
304
+ const w = t.edge(s.v, s.w, s.name);
305
+ 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(
306
+ "Fix",
307
+ f,
308
+ "ids:",
309
+ s.v,
310
+ s.w,
311
+ "Translating: ",
312
+ f.get(s.v),
313
+ f.get(s.w)
314
+ ), await Z(C, w);
315
+ });
316
+ await Promise.all(d);
317
+ }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(p(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(p(t)));
318
+ let E = 0, { subGraphTitleTotalMargin: y } = q(a);
319
+ return await Promise.all(
320
+ oe(t).map(async function(d) {
321
+ var w;
322
+ const s = t.node(d);
323
+ if (i.info(
324
+ "Position XBX => " + d + ": (" + s.x,
325
+ "," + s.y,
326
+ ") width: ",
327
+ s.width,
328
+ " height: ",
329
+ s.height
330
+ ), s != null && s.clusterNode)
331
+ s.y += y, i.info(
332
+ "A tainted cluster node XBX1",
333
+ d,
334
+ s.id,
335
+ s.width,
336
+ s.height,
337
+ s.x,
338
+ s.y,
339
+ t.parent(d)
340
+ ), f.get(s.id).node = s, P(s);
341
+ else if (t.children(d).length > 0) {
342
+ i.info(
343
+ "A pure cluster node XBX1",
344
+ d,
345
+ s.id,
346
+ s.x,
347
+ s.y,
348
+ s.width,
349
+ s.height,
350
+ t.parent(d)
351
+ ), s.height += y, t.node(s.parentId);
352
+ 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;
353
+ i.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await K(l, s), f.get(s.id).node = s;
354
+ } else {
355
+ const m = t.node(s.parentId);
356
+ s.y += y / 2, i.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
+ m,
369
+ m == null ? void 0 : m.offsetY,
370
+ s
371
+ ), P(s);
372
+ }
373
+ })
374
+ ), t.edges().forEach(function(d) {
375
+ const s = t.edge(d);
376
+ i.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += y / 2);
377
+ const w = t.node(d.v);
378
+ var m = t.node(d.w);
379
+ const N = Q(v, s, f, n, w, m, o);
380
+ W(s, N);
381
+ }), t.nodes().forEach(function(d) {
382
+ const s = t.node(d);
383
+ i.info(d, s.type, s.diff), s.isGroup && (E = s.diff);
384
+ }), i.warn("Returning from recursive render XAX", u, E), { elem: u, diff: E };
385
+ }, "recursiveRender"), ue = /* @__PURE__ */ X(async (e, t) => {
386
+ var a, r, u, l, v, C;
387
+ const n = new B({
388
+ multigraph: !0,
389
+ compound: !0
390
+ }).setGraph({
391
+ rankdir: e.direction,
392
+ 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,
393
+ 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,
394
+ marginx: 8,
395
+ marginy: 8
396
+ }).setDefaultEdgeLabel(function() {
397
+ return {};
398
+ }), o = t.select("g");
399
+ F(o, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((g) => {
400
+ n.setNode(g.id, { ...g }), g.parentId && n.setParent(g.id, g.parentId);
401
+ }), i.debug("Edges:", e.edges), e.edges.forEach((g) => {
402
+ if (g.start === g.end) {
403
+ const h = g.start, E = h + "---" + h + "---1", y = h + "---" + h + "---2", d = n.node(h);
404
+ n.setNode(E, {
405
+ domId: E,
406
+ id: E,
407
+ parentId: d.parentId,
408
+ labelStyle: "",
409
+ label: "",
410
+ padding: 0,
411
+ shape: "labelRect",
412
+ // shape: 'rect',
413
+ style: "",
414
+ width: 10,
415
+ height: 10
416
+ }), n.setParent(E, d.parentId), n.setNode(y, {
417
+ domId: y,
418
+ id: y,
419
+ parentId: d.parentId,
420
+ labelStyle: "",
421
+ padding: 0,
422
+ // shape: 'rect',
423
+ shape: "labelRect",
424
+ label: "",
425
+ style: "",
426
+ width: 10,
427
+ height: 10
428
+ }), n.setParent(y, d.parentId);
429
+ const s = structuredClone(g), w = structuredClone(g), m = structuredClone(g);
430
+ 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, E, s, h + "-cyclic-special-0"), n.setEdge(E, y, w, h + "-cyclic-special-1"), n.setEdge(y, h, m, h + "-cyc<lic-special-2");
431
+ } else
432
+ n.setEdge(g.start, g.end, { ...g }, g.id);
433
+ }), i.warn("Graph at first:", JSON.stringify(p(n))), re(n), i.warn("Graph after XAX:", JSON.stringify(p(n)));
434
+ const c = V();
435
+ await j(
436
+ o,
437
+ n,
438
+ e.type,
439
+ e.diagramId,
440
+ void 0,
441
+ c
442
+ );
443
+ }, "render");
444
+ export {
445
+ ue as render
446
+ };
@@ -0,0 +1,171 @@
1
+ function H(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 ((e = (n = t ? n.toExponential(t - 1) : n.toExponential()).indexOf("e")) < 0) return null;
6
+ var 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 J(n) {
13
+ return n = j(Math.abs(n)), n ? n[1] : NaN;
14
+ }
15
+ function K(n, t) {
16
+ return function(e, i) {
17
+ for (var o = e.length, f = [], c = 0, u = n[0], p = 0; o > 0 && u > 0 && (p + u + 1 > i && (u = Math.max(1, i - p)), f.push(e.substring(o -= u, o + u)), !((p += u + 1) > i)); )
18
+ u = n[c = (c + 1) % n.length];
19
+ return f.reverse().join(t);
20
+ };
21
+ }
22
+ function Q(n) {
23
+ return function(t) {
24
+ return t.replace(/[0-9]/g, function(e) {
25
+ return n[+e];
26
+ });
27
+ };
28
+ }
29
+ var V = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
30
+ function N(n) {
31
+ if (!(t = V.exec(n))) throw new Error("invalid format: " + n);
32
+ var t;
33
+ return new $({
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
+ N.prototype = $.prototype;
47
+ function $(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
+ $.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 W(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 U;
70
+ function _(n, t) {
71
+ var e = j(n, t);
72
+ if (!e) return n + "";
73
+ var i = e[0], o = e[1], f = o - (U = Math.max(-8, Math.min(8, Math.floor(o / 3))) * 3) + 1, c = i.length;
74
+ return f === c ? i : f > c ? i + new Array(f - c + 1).join("0") : f > 0 ? i.slice(0, f) + "." + i.slice(f) : "0." + new Array(1 - f).join("0") + j(n, Math.max(0, t + f - 1))[0];
75
+ }
76
+ function G(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 I = {
83
+ "%": (n, t) => (n * 100).toFixed(t),
84
+ b: (n) => Math.round(n).toString(2),
85
+ c: (n) => n + "",
86
+ d: H,
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) => G(n * 100, t),
92
+ r: G,
93
+ s: _,
94
+ X: (n) => Math.round(n).toString(16).toUpperCase(),
95
+ x: (n) => Math.round(n).toString(16)
96
+ };
97
+ function X(n) {
98
+ return n;
99
+ }
100
+ var O = Array.prototype.map, R = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
101
+ function v(n) {
102
+ var t = n.grouping === void 0 || n.thousands === void 0 ? X : K(O.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 + "", f = n.numerals === void 0 ? X : Q(O.call(n.numerals, String)), c = n.percent === void 0 ? "%" : n.percent + "", u = n.minus === void 0 ? "−" : n.minus + "", p = n.nan === void 0 ? "NaN" : n.nan + "";
103
+ function F(a) {
104
+ a = N(a);
105
+ var x = a.fill, M = a.align, m = a.sign, w = a.symbol, l = a.zero, S = a.width, E = a.comma, g = a.precision, L = a.trim, d = a.type;
106
+ d === "n" ? (E = !0, d = "g") : I[d] || (g === void 0 && (g = 12), L = !0, d = "g"), (l || x === "0" && M === "=") && (l = !0, x = "0", M = "=");
107
+ var Z = w === "$" ? e : w === "#" && /[boxX]/.test(d) ? "0" + d.toLowerCase() : "", q = w === "$" ? i : /[%p]/.test(d) ? c : "", T = I[d], B = /[defgprs%]/.test(d);
108
+ g = g === void 0 ? 6 : /[gprs]/.test(d) ? Math.max(1, Math.min(21, g)) : Math.max(0, Math.min(20, g));
109
+ function C(r) {
110
+ var y = Z, h = q, b, D, k;
111
+ if (d === "c")
112
+ h = T(r) + h, r = "";
113
+ else {
114
+ r = +r;
115
+ var P = r < 0 || 1 / r < 0;
116
+ if (r = isNaN(r) ? p : T(Math.abs(r), g), L && (r = W(r)), P && +r == 0 && m !== "+" && (P = !1), y = (P ? m === "(" ? m : u : m === "-" || m === "(" ? "" : m) + y, h = (d === "s" ? R[8 + U / 3] : "") + h + (P && m === "(" ? ")" : ""), B) {
117
+ for (b = -1, D = r.length; ++b < D; )
118
+ if (k = r.charCodeAt(b), 48 > k || k > 57) {
119
+ h = (k === 46 ? o + r.slice(b + 1) : r.slice(b)) + h, r = r.slice(0, b);
120
+ break;
121
+ }
122
+ }
123
+ }
124
+ E && !l && (r = t(r, 1 / 0));
125
+ var z = y.length + r.length + h.length, s = z < S ? new Array(S - z + 1).join(x) : "";
126
+ switch (E && l && (r = t(s + r, s.length ? S - h.length : 1 / 0), s = ""), M) {
127
+ case "<":
128
+ r = y + r + h + s;
129
+ break;
130
+ case "=":
131
+ r = y + s + r + h;
132
+ break;
133
+ case "^":
134
+ r = s.slice(0, z = s.length >> 1) + y + r + h + s.slice(z);
135
+ break;
136
+ default:
137
+ r = s + y + r + h;
138
+ break;
139
+ }
140
+ return f(r);
141
+ }
142
+ return C.toString = function() {
143
+ return a + "";
144
+ }, C;
145
+ }
146
+ function Y(a, x) {
147
+ var M = F((a = N(a), a.type = "f", a)), m = Math.max(-8, Math.min(8, Math.floor(J(x) / 3))) * 3, w = Math.pow(10, -m), l = R[8 + m / 3];
148
+ return function(S) {
149
+ return M(w * S) + l;
150
+ };
151
+ }
152
+ return {
153
+ format: F,
154
+ formatPrefix: Y
155
+ };
156
+ }
157
+ var A, nn, tn;
158
+ rn({
159
+ thousands: ",",
160
+ grouping: [3],
161
+ currency: ["$", ""]
162
+ });
163
+ function rn(n) {
164
+ return A = v(n), nn = A.format, tn = A.formatPrefix, A;
165
+ }
166
+ export {
167
+ tn as a,
168
+ nn as b,
169
+ J as e,
170
+ N as f
171
+ };