@wandox/sdk 0.1.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 (114) hide show
  1. package/README.md +59 -0
  2. package/dist/arc-BJMRTG9S.cjs +1 -0
  3. package/dist/arc-Vdco0qfw.js +83 -0
  4. package/dist/architectureDiagram-3BPJPVTR-BjEqcvey.js +4695 -0
  5. package/dist/architectureDiagram-3BPJPVTR-BvjJfAkh.cjs +36 -0
  6. package/dist/blockDiagram-GPEHLZMM-B1xf7RE9.js +2427 -0
  7. package/dist/blockDiagram-GPEHLZMM-B5VqovGY.cjs +132 -0
  8. package/dist/c4Diagram-AAUBKEIU-C4kjMRea.js +1578 -0
  9. package/dist/c4Diagram-AAUBKEIU-Ck5uEnJI.cjs +10 -0
  10. package/dist/channel-DlRtLuYv.js +5 -0
  11. package/dist/channel-Dm_yrRYJ.cjs +1 -0
  12. package/dist/chunk-2J33WTMH-CG2n_n4y.cjs +1 -0
  13. package/dist/chunk-2J33WTMH-CWvmGb4H.js +20 -0
  14. package/dist/chunk-4BX2VUAB-Bq3GzsD8.js +9 -0
  15. package/dist/chunk-4BX2VUAB-CdMctZeT.cjs +1 -0
  16. package/dist/chunk-55IACEB6-BdJhzL0d.js +8 -0
  17. package/dist/chunk-55IACEB6-sHyHtvg8.cjs +1 -0
  18. package/dist/chunk-727SXJPM-D-Vmam30.cjs +206 -0
  19. package/dist/chunk-727SXJPM-DmruCqjM.js +1529 -0
  20. package/dist/chunk-AQP2D5EJ-CWhKjcV3.cjs +231 -0
  21. package/dist/chunk-AQP2D5EJ-Ca0ak6w7.js +1399 -0
  22. package/dist/chunk-FMBD7UC4-CqV0NWQQ.js +19 -0
  23. package/dist/chunk-FMBD7UC4-DOxtd0OO.cjs +15 -0
  24. package/dist/chunk-ND2GUHAM-6EMX5Mu8.js +68 -0
  25. package/dist/chunk-ND2GUHAM-BXeDBtSC.cjs +1 -0
  26. package/dist/chunk-QZHKN3VN-B7FSI55w.js +15 -0
  27. package/dist/chunk-QZHKN3VN-CbbdNKnD.cjs +1 -0
  28. package/dist/classDiagram-4FO5ZUOK-0Kaf7WfA.js +16 -0
  29. package/dist/classDiagram-4FO5ZUOK-C4it2xBI.cjs +1 -0
  30. package/dist/classDiagram-v2-Q7XG4LA2-Byom5adL.js +16 -0
  31. package/dist/classDiagram-v2-Q7XG4LA2-C4it2xBI.cjs +1 -0
  32. package/dist/cose-bilkent-S5V4N54A-CuUv9oIm.js +2606 -0
  33. package/dist/cose-bilkent-S5V4N54A-Dh6nTopA.cjs +1 -0
  34. package/dist/cytoscape.esm-Cp8cXbK2.js +18729 -0
  35. package/dist/cytoscape.esm-fcqEUasK.cjs +331 -0
  36. package/dist/dagre-BM42HDAG-CwxJjZ2n.cjs +4 -0
  37. package/dist/dagre-BM42HDAG-DMBidMxP.js +448 -0
  38. package/dist/defaultLocale-BDVPUiG2.js +171 -0
  39. package/dist/defaultLocale-k2G_58r6.cjs +1 -0
  40. package/dist/diagram-2AECGRRQ-B2a4nXgJ.js +221 -0
  41. package/dist/diagram-2AECGRRQ-r7De7taS.cjs +43 -0
  42. package/dist/diagram-5GNKFQAL-CDiO79WC.cjs +10 -0
  43. package/dist/diagram-5GNKFQAL-DrHBNZzF.js +123 -0
  44. package/dist/diagram-KO2AKTUF-BcjWCXZr.js +466 -0
  45. package/dist/diagram-KO2AKTUF-CDlJCxVO.cjs +3 -0
  46. package/dist/diagram-LMA3HP47-BXFSAyNV.cjs +24 -0
  47. package/dist/diagram-LMA3HP47-DJxmyqn0.js +143 -0
  48. package/dist/diagram-OG6HWLK6-ATK__ca8.js +531 -0
  49. package/dist/diagram-OG6HWLK6-CgIyEO8_.cjs +24 -0
  50. package/dist/erDiagram-TEJ5UH35-D4baWNzQ.js +900 -0
  51. package/dist/erDiagram-TEJ5UH35-Dyuc5EB6.cjs +85 -0
  52. package/dist/flowDiagram-I6XJVG4X-BMZOncyU.js +1635 -0
  53. package/dist/flowDiagram-I6XJVG4X-C45fICr4.cjs +162 -0
  54. package/dist/ganttDiagram-6RSMTGT7-CiYZmmke.js +2526 -0
  55. package/dist/ganttDiagram-6RSMTGT7-Cxoj6IK8.cjs +292 -0
  56. package/dist/gitGraphDiagram-PVQCEYII-CQ9bNuwN.js +828 -0
  57. package/dist/gitGraphDiagram-PVQCEYII-rlaY9dfj.cjs +106 -0
  58. package/dist/graph-CBizzZ7K.js +1545 -0
  59. package/dist/graph-V5BNIbHU.cjs +1 -0
  60. package/dist/index-jBRold1l.js +173159 -0
  61. package/dist/index-sFrjovbM.cjs +804 -0
  62. package/dist/index.d.ts +54 -0
  63. package/dist/infoDiagram-5YYISTIA-CAzYIvUX.js +24 -0
  64. package/dist/infoDiagram-5YYISTIA-zX5rQglQ.cjs +2 -0
  65. package/dist/init-CHZsXQcr.cjs +1 -0
  66. package/dist/init-DjUOC4st.js +16 -0
  67. package/dist/ishikawaDiagram-YF4QCWOH-09prKBsn.cjs +70 -0
  68. package/dist/ishikawaDiagram-YF4QCWOH-Co8BnN24.js +622 -0
  69. package/dist/journeyDiagram-JHISSGLW-DkdWRF_-.cjs +139 -0
  70. package/dist/journeyDiagram-JHISSGLW-riCLiMCC.js +836 -0
  71. package/dist/kanban-definition-UN3LZRKU-DWipOCsx.cjs +89 -0
  72. package/dist/kanban-definition-UN3LZRKU-SRyCSn2H.js +725 -0
  73. package/dist/katex-Cf_UVKIT.cjs +257 -0
  74. package/dist/katex-RNjvZ8pg.js +11681 -0
  75. package/dist/layout-CbksXFOD.js +1728 -0
  76. package/dist/layout-Dh52gsIJ.cjs +1 -0
  77. package/dist/linear-C3xSMJV8.cjs +1 -0
  78. package/dist/linear-CmUCzX9U.js +259 -0
  79. package/dist/mermaid.core-BzNKr-OJ.cjs +308 -0
  80. package/dist/mermaid.core-CdBIz6FY.js +15475 -0
  81. package/dist/mindmap-definition-RKZ34NQL-Cs63oyIX.cjs +96 -0
  82. package/dist/mindmap-definition-RKZ34NQL-Gcma5iTd.js +830 -0
  83. package/dist/ordinal-CagbB1m8.cjs +1 -0
  84. package/dist/ordinal-DfAQgscy.js +61 -0
  85. package/dist/pieDiagram-4H26LBE5-CBGkD8dp.cjs +30 -0
  86. package/dist/pieDiagram-4H26LBE5-DSL8cVK1.js +164 -0
  87. package/dist/quadrantDiagram-W4KKPZXB-D3nCWRjF.cjs +7 -0
  88. package/dist/quadrantDiagram-W4KKPZXB-uod6bhUy.js +1026 -0
  89. package/dist/requirementDiagram-4Y6WPE33-Bc_6y7SM.js +884 -0
  90. package/dist/requirementDiagram-4Y6WPE33-D2mHlh5i.cjs +84 -0
  91. package/dist/sankeyDiagram-5OEKKPKP-DL_kXejW.cjs +40 -0
  92. package/dist/sankeyDiagram-5OEKKPKP-DMsjY4G4.js +847 -0
  93. package/dist/sequenceDiagram-3UESZ5HK-CBGalGOV.cjs +162 -0
  94. package/dist/sequenceDiagram-3UESZ5HK-CH2Z-Pis.js +2901 -0
  95. package/dist/stateDiagram-AJRCARHV-gEqlAI6t.js +263 -0
  96. package/dist/stateDiagram-AJRCARHV-rNMrAI-A.cjs +1 -0
  97. package/dist/stateDiagram-v2-BHNVJYJU-CDj7L1wi.js +16 -0
  98. package/dist/stateDiagram-v2-BHNVJYJU-LLlFJ1GM.cjs +1 -0
  99. package/dist/timeline-definition-PNZ67QCA-Bbuv3uu-.cjs +120 -0
  100. package/dist/timeline-definition-PNZ67QCA-DrGFbQdC.js +1068 -0
  101. package/dist/types.d.ts +295 -0
  102. package/dist/vennDiagram-CIIHVFJN-CGcAwVxU.js +1564 -0
  103. package/dist/vennDiagram-CIIHVFJN-DsSjXluJ.cjs +34 -0
  104. package/dist/wandox.cjs +1 -0
  105. package/dist/wandox.css +1 -0
  106. package/dist/wandox.js +6 -0
  107. package/dist/wandox.umd.js +4172 -0
  108. package/dist/wardley-L42UT6IY-DUnkyH_z.js +22539 -0
  109. package/dist/wardley-L42UT6IY-tDp0NbFW.cjs +165 -0
  110. package/dist/wardleyDiagram-YWT4CUSO-CB_Qa4lR.js +684 -0
  111. package/dist/wardleyDiagram-YWT4CUSO-D0BUmvVW.cjs +78 -0
  112. package/dist/xychartDiagram-2RQKCTM6-Bcq-ACuw.js +1342 -0
  113. package/dist/xychartDiagram-2RQKCTM6-BjeAPKLo.cjs +7 -0
  114. package/package.json +42 -0
@@ -0,0 +1,847 @@
1
+ import { b2 as xt, a3 as _t, a$ as vt, $ as bt, b0 as St, a0 as wt, b as d, a2 as lt, P as Lt, aZ as X, b5 as Et, t as At, z as Tt } from "./mermaid.core-CdBIz6FY.js";
2
+ import { o as Mt } from "./ordinal-DfAQgscy.js";
3
+ function Nt(t) {
4
+ for (var n = t.length / 6 | 0, s = new Array(n), a = 0; a < n; ) s[a] = "#" + t.slice(a * 6, ++a * 6);
5
+ return s;
6
+ }
7
+ const Pt = Nt("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
8
+ function ct(t, n) {
9
+ let s;
10
+ if (n === void 0)
11
+ for (const a of t)
12
+ a != null && (s < a || s === void 0 && a >= a) && (s = a);
13
+ else {
14
+ let a = -1;
15
+ for (let u of t)
16
+ (u = n(u, ++a, t)) != null && (s < u || s === void 0 && u >= u) && (s = u);
17
+ }
18
+ return s;
19
+ }
20
+ function pt(t, n) {
21
+ let s;
22
+ if (n === void 0)
23
+ for (const a of t)
24
+ a != null && (s > a || s === void 0 && a >= a) && (s = a);
25
+ else {
26
+ let a = -1;
27
+ for (let u of t)
28
+ (u = n(u, ++a, t)) != null && (s > u || s === void 0 && u >= u) && (s = u);
29
+ }
30
+ return s;
31
+ }
32
+ function nt(t, n) {
33
+ let s = 0;
34
+ if (n === void 0)
35
+ for (let a of t)
36
+ (a = +a) && (s += a);
37
+ else {
38
+ let a = -1;
39
+ for (let u of t)
40
+ (u = +n(u, ++a, t)) && (s += u);
41
+ }
42
+ return s;
43
+ }
44
+ function Ct(t) {
45
+ return t.target.depth;
46
+ }
47
+ function $t(t) {
48
+ return t.depth;
49
+ }
50
+ function It(t, n) {
51
+ return n - 1 - t.height;
52
+ }
53
+ function kt(t, n) {
54
+ return t.sourceLinks.length ? t.depth : n - 1;
55
+ }
56
+ function Ot(t) {
57
+ return t.targetLinks.length ? t.depth : t.sourceLinks.length ? pt(t.sourceLinks, Ct) - 1 : 0;
58
+ }
59
+ function q(t) {
60
+ return function() {
61
+ return t;
62
+ };
63
+ }
64
+ function ut(t, n) {
65
+ return Q(t.source, n.source) || t.index - n.index;
66
+ }
67
+ function ht(t, n) {
68
+ return Q(t.target, n.target) || t.index - n.index;
69
+ }
70
+ function Q(t, n) {
71
+ return t.y0 - n.y0;
72
+ }
73
+ function it(t) {
74
+ return t.value;
75
+ }
76
+ function zt(t) {
77
+ return t.index;
78
+ }
79
+ function Dt(t) {
80
+ return t.nodes;
81
+ }
82
+ function jt(t) {
83
+ return t.links;
84
+ }
85
+ function ft(t, n) {
86
+ const s = t.get(n);
87
+ if (!s) throw new Error("missing: " + n);
88
+ return s;
89
+ }
90
+ function yt({ nodes: t }) {
91
+ for (const n of t) {
92
+ let s = n.y0, a = s;
93
+ for (const u of n.sourceLinks)
94
+ u.y0 = s + u.width / 2, s += u.width;
95
+ for (const u of n.targetLinks)
96
+ u.y1 = a + u.width / 2, a += u.width;
97
+ }
98
+ }
99
+ function Bt() {
100
+ let t = 0, n = 0, s = 1, a = 1, u = 24, y = 8, p, m = zt, o = kt, l, h, x = Dt, _ = jt, g = 6;
101
+ function v() {
102
+ const i = { nodes: x.apply(null, arguments), links: _.apply(null, arguments) };
103
+ return T(i), A(i), M(i), $(i), S(i), yt(i), i;
104
+ }
105
+ v.update = function(i) {
106
+ return yt(i), i;
107
+ }, v.nodeId = function(i) {
108
+ return arguments.length ? (m = typeof i == "function" ? i : q(i), v) : m;
109
+ }, v.nodeAlign = function(i) {
110
+ return arguments.length ? (o = typeof i == "function" ? i : q(i), v) : o;
111
+ }, v.nodeSort = function(i) {
112
+ return arguments.length ? (l = i, v) : l;
113
+ }, v.nodeWidth = function(i) {
114
+ return arguments.length ? (u = +i, v) : u;
115
+ }, v.nodePadding = function(i) {
116
+ return arguments.length ? (y = p = +i, v) : y;
117
+ }, v.nodes = function(i) {
118
+ return arguments.length ? (x = typeof i == "function" ? i : q(i), v) : x;
119
+ }, v.links = function(i) {
120
+ return arguments.length ? (_ = typeof i == "function" ? i : q(i), v) : _;
121
+ }, v.linkSort = function(i) {
122
+ return arguments.length ? (h = i, v) : h;
123
+ }, v.size = function(i) {
124
+ return arguments.length ? (t = n = 0, s = +i[0], a = +i[1], v) : [s - t, a - n];
125
+ }, v.extent = function(i) {
126
+ return arguments.length ? (t = +i[0][0], s = +i[1][0], n = +i[0][1], a = +i[1][1], v) : [[t, n], [s, a]];
127
+ }, v.iterations = function(i) {
128
+ return arguments.length ? (g = +i, v) : g;
129
+ };
130
+ function T({ nodes: i, links: f }) {
131
+ for (const [e, r] of i.entries())
132
+ r.index = e, r.sourceLinks = [], r.targetLinks = [];
133
+ const c = new Map(i.map((e, r) => [m(e, r, i), e]));
134
+ for (const [e, r] of f.entries()) {
135
+ r.index = e;
136
+ let { source: k, target: b } = r;
137
+ typeof k != "object" && (k = r.source = ft(c, k)), typeof b != "object" && (b = r.target = ft(c, b)), k.sourceLinks.push(r), b.targetLinks.push(r);
138
+ }
139
+ if (h != null)
140
+ for (const { sourceLinks: e, targetLinks: r } of i)
141
+ e.sort(h), r.sort(h);
142
+ }
143
+ function A({ nodes: i }) {
144
+ for (const f of i)
145
+ f.value = f.fixedValue === void 0 ? Math.max(nt(f.sourceLinks, it), nt(f.targetLinks, it)) : f.fixedValue;
146
+ }
147
+ function M({ nodes: i }) {
148
+ const f = i.length;
149
+ let c = new Set(i), e = /* @__PURE__ */ new Set(), r = 0;
150
+ for (; c.size; ) {
151
+ for (const k of c) {
152
+ k.depth = r;
153
+ for (const { target: b } of k.sourceLinks)
154
+ e.add(b);
155
+ }
156
+ if (++r > f) throw new Error("circular link");
157
+ c = e, e = /* @__PURE__ */ new Set();
158
+ }
159
+ }
160
+ function $({ nodes: i }) {
161
+ const f = i.length;
162
+ let c = new Set(i), e = /* @__PURE__ */ new Set(), r = 0;
163
+ for (; c.size; ) {
164
+ for (const k of c) {
165
+ k.height = r;
166
+ for (const { source: b } of k.targetLinks)
167
+ e.add(b);
168
+ }
169
+ if (++r > f) throw new Error("circular link");
170
+ c = e, e = /* @__PURE__ */ new Set();
171
+ }
172
+ }
173
+ function N({ nodes: i }) {
174
+ const f = ct(i, (r) => r.depth) + 1, c = (s - t - u) / (f - 1), e = new Array(f);
175
+ for (const r of i) {
176
+ const k = Math.max(0, Math.min(f - 1, Math.floor(o.call(null, r, f))));
177
+ r.layer = k, r.x0 = t + k * c, r.x1 = r.x0 + u, e[k] ? e[k].push(r) : e[k] = [r];
178
+ }
179
+ if (l) for (const r of e)
180
+ r.sort(l);
181
+ return e;
182
+ }
183
+ function z(i) {
184
+ const f = pt(i, (c) => (a - n - (c.length - 1) * p) / nt(c, it));
185
+ for (const c of i) {
186
+ let e = n;
187
+ for (const r of c) {
188
+ r.y0 = e, r.y1 = e + r.value * f, e = r.y1 + p;
189
+ for (const k of r.sourceLinks)
190
+ k.width = k.value * f;
191
+ }
192
+ e = (a - e + p) / (c.length + 1);
193
+ for (let r = 0; r < c.length; ++r) {
194
+ const k = c[r];
195
+ k.y0 += e * (r + 1), k.y1 += e * (r + 1);
196
+ }
197
+ w(c);
198
+ }
199
+ }
200
+ function S(i) {
201
+ const f = N(i);
202
+ p = Math.min(y, (a - n) / (ct(f, (c) => c.length) - 1)), z(f);
203
+ for (let c = 0; c < g; ++c) {
204
+ const e = Math.pow(0.99, c), r = Math.max(1 - e, (c + 1) / g);
205
+ R(f, e, r), P(f, e, r);
206
+ }
207
+ }
208
+ function P(i, f, c) {
209
+ for (let e = 1, r = i.length; e < r; ++e) {
210
+ const k = i[e];
211
+ for (const b of k) {
212
+ let L = 0, B = 0;
213
+ for (const { source: Y, value: et } of b.targetLinks) {
214
+ let H = et * (b.layer - Y.layer);
215
+ L += C(Y, b) * H, B += H;
216
+ }
217
+ if (!(B > 0)) continue;
218
+ let U = (L / B - b.y0) * f;
219
+ b.y0 += U, b.y1 += U, j(b);
220
+ }
221
+ l === void 0 && k.sort(Q), D(k, c);
222
+ }
223
+ }
224
+ function R(i, f, c) {
225
+ for (let e = i.length, r = e - 2; r >= 0; --r) {
226
+ const k = i[r];
227
+ for (const b of k) {
228
+ let L = 0, B = 0;
229
+ for (const { target: Y, value: et } of b.sourceLinks) {
230
+ let H = et * (Y.layer - b.layer);
231
+ L += E(b, Y) * H, B += H;
232
+ }
233
+ if (!(B > 0)) continue;
234
+ let U = (L / B - b.y0) * f;
235
+ b.y0 += U, b.y1 += U, j(b);
236
+ }
237
+ l === void 0 && k.sort(Q), D(k, c);
238
+ }
239
+ }
240
+ function D(i, f) {
241
+ const c = i.length >> 1, e = i[c];
242
+ I(i, e.y0 - p, c - 1, f), V(i, e.y1 + p, c + 1, f), I(i, a, i.length - 1, f), V(i, n, 0, f);
243
+ }
244
+ function V(i, f, c, e) {
245
+ for (; c < i.length; ++c) {
246
+ const r = i[c], k = (f - r.y0) * e;
247
+ k > 1e-6 && (r.y0 += k, r.y1 += k), f = r.y1 + p;
248
+ }
249
+ }
250
+ function I(i, f, c, e) {
251
+ for (; c >= 0; --c) {
252
+ const r = i[c], k = (r.y1 - f) * e;
253
+ k > 1e-6 && (r.y0 -= k, r.y1 -= k), f = r.y0 - p;
254
+ }
255
+ }
256
+ function j({ sourceLinks: i, targetLinks: f }) {
257
+ if (h === void 0) {
258
+ for (const { source: { sourceLinks: c } } of f)
259
+ c.sort(ht);
260
+ for (const { target: { targetLinks: c } } of i)
261
+ c.sort(ut);
262
+ }
263
+ }
264
+ function w(i) {
265
+ if (h === void 0)
266
+ for (const { sourceLinks: f, targetLinks: c } of i)
267
+ f.sort(ht), c.sort(ut);
268
+ }
269
+ function C(i, f) {
270
+ let c = i.y0 - (i.sourceLinks.length - 1) * p / 2;
271
+ for (const { target: e, width: r } of i.sourceLinks) {
272
+ if (e === f) break;
273
+ c += r + p;
274
+ }
275
+ for (const { source: e, width: r } of f.targetLinks) {
276
+ if (e === i) break;
277
+ c -= r;
278
+ }
279
+ return c;
280
+ }
281
+ function E(i, f) {
282
+ let c = f.y0 - (f.targetLinks.length - 1) * p / 2;
283
+ for (const { source: e, width: r } of f.targetLinks) {
284
+ if (e === i) break;
285
+ c += r + p;
286
+ }
287
+ for (const { target: e, width: r } of i.sourceLinks) {
288
+ if (e === f) break;
289
+ c -= r;
290
+ }
291
+ return c;
292
+ }
293
+ return v;
294
+ }
295
+ var rt = Math.PI, st = 2 * rt, F = 1e-6, Ft = st - F;
296
+ function ot() {
297
+ this._x0 = this._y0 = // start of current subpath
298
+ this._x1 = this._y1 = null, this._ = "";
299
+ }
300
+ function mt() {
301
+ return new ot();
302
+ }
303
+ ot.prototype = mt.prototype = {
304
+ constructor: ot,
305
+ moveTo: function(t, n) {
306
+ this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +n);
307
+ },
308
+ closePath: function() {
309
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
310
+ },
311
+ lineTo: function(t, n) {
312
+ this._ += "L" + (this._x1 = +t) + "," + (this._y1 = +n);
313
+ },
314
+ quadraticCurveTo: function(t, n, s, a) {
315
+ this._ += "Q" + +t + "," + +n + "," + (this._x1 = +s) + "," + (this._y1 = +a);
316
+ },
317
+ bezierCurveTo: function(t, n, s, a, u, y) {
318
+ this._ += "C" + +t + "," + +n + "," + +s + "," + +a + "," + (this._x1 = +u) + "," + (this._y1 = +y);
319
+ },
320
+ arcTo: function(t, n, s, a, u) {
321
+ t = +t, n = +n, s = +s, a = +a, u = +u;
322
+ var y = this._x1, p = this._y1, m = s - t, o = a - n, l = y - t, h = p - n, x = l * l + h * h;
323
+ if (u < 0) throw new Error("negative radius: " + u);
324
+ if (this._x1 === null)
325
+ this._ += "M" + (this._x1 = t) + "," + (this._y1 = n);
326
+ else if (x > F) if (!(Math.abs(h * m - o * l) > F) || !u)
327
+ this._ += "L" + (this._x1 = t) + "," + (this._y1 = n);
328
+ else {
329
+ var _ = s - y, g = a - p, v = m * m + o * o, T = _ * _ + g * g, A = Math.sqrt(v), M = Math.sqrt(x), $ = u * Math.tan((rt - Math.acos((v + x - T) / (2 * A * M))) / 2), N = $ / M, z = $ / A;
330
+ Math.abs(N - 1) > F && (this._ += "L" + (t + N * l) + "," + (n + N * h)), this._ += "A" + u + "," + u + ",0,0," + +(h * _ > l * g) + "," + (this._x1 = t + z * m) + "," + (this._y1 = n + z * o);
331
+ }
332
+ },
333
+ arc: function(t, n, s, a, u, y) {
334
+ t = +t, n = +n, s = +s, y = !!y;
335
+ var p = s * Math.cos(a), m = s * Math.sin(a), o = t + p, l = n + m, h = 1 ^ y, x = y ? a - u : u - a;
336
+ if (s < 0) throw new Error("negative radius: " + s);
337
+ this._x1 === null ? this._ += "M" + o + "," + l : (Math.abs(this._x1 - o) > F || Math.abs(this._y1 - l) > F) && (this._ += "L" + o + "," + l), s && (x < 0 && (x = x % st + st), x > Ft ? this._ += "A" + s + "," + s + ",0,1," + h + "," + (t - p) + "," + (n - m) + "A" + s + "," + s + ",0,1," + h + "," + (this._x1 = o) + "," + (this._y1 = l) : x > F && (this._ += "A" + s + "," + s + ",0," + +(x >= rt) + "," + h + "," + (this._x1 = t + s * Math.cos(u)) + "," + (this._y1 = n + s * Math.sin(u))));
338
+ },
339
+ rect: function(t, n, s, a) {
340
+ this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +n) + "h" + +s + "v" + +a + "h" + -s + "Z";
341
+ },
342
+ toString: function() {
343
+ return this._;
344
+ }
345
+ };
346
+ function dt(t) {
347
+ return function() {
348
+ return t;
349
+ };
350
+ }
351
+ function Rt(t) {
352
+ return t[0];
353
+ }
354
+ function Vt(t) {
355
+ return t[1];
356
+ }
357
+ var Wt = Array.prototype.slice;
358
+ function Gt(t) {
359
+ return t.source;
360
+ }
361
+ function Ut(t) {
362
+ return t.target;
363
+ }
364
+ function Yt(t) {
365
+ var n = Gt, s = Ut, a = Rt, u = Vt, y = null;
366
+ function p() {
367
+ var m, o = Wt.call(arguments), l = n.apply(this, o), h = s.apply(this, o);
368
+ if (y || (y = m = mt()), t(y, +a.apply(this, (o[0] = l, o)), +u.apply(this, o), +a.apply(this, (o[0] = h, o)), +u.apply(this, o)), m) return y = null, m + "" || null;
369
+ }
370
+ return p.source = function(m) {
371
+ return arguments.length ? (n = m, p) : n;
372
+ }, p.target = function(m) {
373
+ return arguments.length ? (s = m, p) : s;
374
+ }, p.x = function(m) {
375
+ return arguments.length ? (a = typeof m == "function" ? m : dt(+m), p) : a;
376
+ }, p.y = function(m) {
377
+ return arguments.length ? (u = typeof m == "function" ? m : dt(+m), p) : u;
378
+ }, p.context = function(m) {
379
+ return arguments.length ? (y = m ?? null, p) : y;
380
+ }, p;
381
+ }
382
+ function Ht(t, n, s, a, u) {
383
+ t.moveTo(n, s), t.bezierCurveTo(n = (n + a) / 2, s, n, u, a, u);
384
+ }
385
+ function Xt() {
386
+ return Yt(Ht);
387
+ }
388
+ function qt(t) {
389
+ return [t.source.x1, t.y0];
390
+ }
391
+ function Qt(t) {
392
+ return [t.target.x0, t.y1];
393
+ }
394
+ function Zt() {
395
+ return Xt().source(qt).target(Qt);
396
+ }
397
+ var at = function() {
398
+ var t = /* @__PURE__ */ d(function(m, o, l, h) {
399
+ for (l = l || {}, h = m.length; h--; l[m[h]] = o) ;
400
+ return l;
401
+ }, "o"), n = [1, 9], s = [1, 10], a = [1, 5, 10, 12], u = {
402
+ trace: /* @__PURE__ */ d(function() {
403
+ }, "trace"),
404
+ yy: {},
405
+ symbols_: { error: 2, start: 3, SANKEY: 4, NEWLINE: 5, csv: 6, opt_eof: 7, record: 8, csv_tail: 9, EOF: 10, "field[source]": 11, COMMA: 12, "field[target]": 13, "field[value]": 14, field: 15, escaped: 16, non_escaped: 17, DQUOTE: 18, ESCAPED_TEXT: 19, NON_ESCAPED_TEXT: 20, $accept: 0, $end: 1 },
406
+ terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
407
+ productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
408
+ performAction: /* @__PURE__ */ d(function(o, l, h, x, _, g, v) {
409
+ var T = g.length - 1;
410
+ switch (_) {
411
+ case 7:
412
+ const A = x.findOrCreateNode(g[T - 4].trim().replaceAll('""', '"')), M = x.findOrCreateNode(g[T - 2].trim().replaceAll('""', '"')), $ = parseFloat(g[T].trim());
413
+ x.addLink(A, M, $);
414
+ break;
415
+ case 8:
416
+ case 9:
417
+ case 11:
418
+ this.$ = g[T];
419
+ break;
420
+ case 10:
421
+ this.$ = g[T - 1];
422
+ break;
423
+ }
424
+ }, "anonymous"),
425
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: n, 20: s }, { 1: [2, 6], 7: 11, 10: [1, 12] }, t(s, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, t(a, [2, 8]), t(a, [2, 9]), { 19: [1, 16] }, t(a, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, t(s, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: n, 20: s }, { 15: 18, 16: 7, 17: 8, 18: n, 20: s }, { 18: [1, 19] }, t(s, [2, 3]), { 12: [1, 20] }, t(a, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: n, 20: s }, t([1, 5, 10], [2, 7])],
426
+ defaultActions: { 11: [2, 1], 12: [2, 5] },
427
+ parseError: /* @__PURE__ */ d(function(o, l) {
428
+ if (l.recoverable)
429
+ this.trace(o);
430
+ else {
431
+ var h = new Error(o);
432
+ throw h.hash = l, h;
433
+ }
434
+ }, "parseError"),
435
+ parse: /* @__PURE__ */ d(function(o) {
436
+ var l = this, h = [0], x = [], _ = [null], g = [], v = this.table, T = "", A = 0, M = 0, $ = 2, N = 1, z = g.slice.call(arguments, 1), S = Object.create(this.lexer), P = { yy: {} };
437
+ for (var R in this.yy)
438
+ Object.prototype.hasOwnProperty.call(this.yy, R) && (P.yy[R] = this.yy[R]);
439
+ S.setInput(o, P.yy), P.yy.lexer = S, P.yy.parser = this, typeof S.yylloc > "u" && (S.yylloc = {});
440
+ var D = S.yylloc;
441
+ g.push(D);
442
+ var V = S.options && S.options.ranges;
443
+ typeof P.yy.parseError == "function" ? this.parseError = P.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
444
+ function I(L) {
445
+ h.length = h.length - 2 * L, _.length = _.length - L, g.length = g.length - L;
446
+ }
447
+ d(I, "popStack");
448
+ function j() {
449
+ var L;
450
+ return L = x.pop() || S.lex() || N, typeof L != "number" && (L instanceof Array && (x = L, L = x.pop()), L = l.symbols_[L] || L), L;
451
+ }
452
+ d(j, "lex");
453
+ for (var w, C, E, i, f = {}, c, e, r, k; ; ) {
454
+ if (C = h[h.length - 1], this.defaultActions[C] ? E = this.defaultActions[C] : ((w === null || typeof w > "u") && (w = j()), E = v[C] && v[C][w]), typeof E > "u" || !E.length || !E[0]) {
455
+ var b = "";
456
+ k = [];
457
+ for (c in v[C])
458
+ this.terminals_[c] && c > $ && k.push("'" + this.terminals_[c] + "'");
459
+ S.showPosition ? b = "Parse error on line " + (A + 1) + `:
460
+ ` + S.showPosition() + `
461
+ Expecting ` + k.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : b = "Parse error on line " + (A + 1) + ": Unexpected " + (w == N ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(b, {
462
+ text: S.match,
463
+ token: this.terminals_[w] || w,
464
+ line: S.yylineno,
465
+ loc: D,
466
+ expected: k
467
+ });
468
+ }
469
+ if (E[0] instanceof Array && E.length > 1)
470
+ throw new Error("Parse Error: multiple actions possible at state: " + C + ", token: " + w);
471
+ switch (E[0]) {
472
+ case 1:
473
+ h.push(w), _.push(S.yytext), g.push(S.yylloc), h.push(E[1]), w = null, M = S.yyleng, T = S.yytext, A = S.yylineno, D = S.yylloc;
474
+ break;
475
+ case 2:
476
+ if (e = this.productions_[E[1]][1], f.$ = _[_.length - e], f._$ = {
477
+ first_line: g[g.length - (e || 1)].first_line,
478
+ last_line: g[g.length - 1].last_line,
479
+ first_column: g[g.length - (e || 1)].first_column,
480
+ last_column: g[g.length - 1].last_column
481
+ }, V && (f._$.range = [
482
+ g[g.length - (e || 1)].range[0],
483
+ g[g.length - 1].range[1]
484
+ ]), i = this.performAction.apply(f, [
485
+ T,
486
+ M,
487
+ A,
488
+ P.yy,
489
+ E[1],
490
+ _,
491
+ g
492
+ ].concat(z)), typeof i < "u")
493
+ return i;
494
+ e && (h = h.slice(0, -1 * e * 2), _ = _.slice(0, -1 * e), g = g.slice(0, -1 * e)), h.push(this.productions_[E[1]][0]), _.push(f.$), g.push(f._$), r = v[h[h.length - 2]][h[h.length - 1]], h.push(r);
495
+ break;
496
+ case 3:
497
+ return !0;
498
+ }
499
+ }
500
+ return !0;
501
+ }, "parse")
502
+ }, y = /* @__PURE__ */ function() {
503
+ var m = {
504
+ EOF: 1,
505
+ parseError: /* @__PURE__ */ d(function(l, h) {
506
+ if (this.yy.parser)
507
+ this.yy.parser.parseError(l, h);
508
+ else
509
+ throw new Error(l);
510
+ }, "parseError"),
511
+ // resets the lexer, sets new input
512
+ setInput: /* @__PURE__ */ d(function(o, l) {
513
+ return this.yy = l || this.yy || {}, this._input = o, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
514
+ first_line: 1,
515
+ first_column: 0,
516
+ last_line: 1,
517
+ last_column: 0
518
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
519
+ }, "setInput"),
520
+ // consumes and returns one char from the input
521
+ input: /* @__PURE__ */ d(function() {
522
+ var o = this._input[0];
523
+ this.yytext += o, this.yyleng++, this.offset++, this.match += o, this.matched += o;
524
+ var l = o.match(/(?:\r\n?|\n).*/g);
525
+ return l ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), o;
526
+ }, "input"),
527
+ // unshifts one char (or a string) into the input
528
+ unput: /* @__PURE__ */ d(function(o) {
529
+ var l = o.length, h = o.split(/(?:\r\n?|\n)/g);
530
+ this._input = o + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
531
+ var x = this.match.split(/(?:\r\n?|\n)/g);
532
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), h.length - 1 && (this.yylineno -= h.length - 1);
533
+ var _ = this.yylloc.range;
534
+ return this.yylloc = {
535
+ first_line: this.yylloc.first_line,
536
+ last_line: this.yylineno + 1,
537
+ first_column: this.yylloc.first_column,
538
+ last_column: h ? (h.length === x.length ? this.yylloc.first_column : 0) + x[x.length - h.length].length - h[0].length : this.yylloc.first_column - l
539
+ }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - l]), this.yyleng = this.yytext.length, this;
540
+ }, "unput"),
541
+ // When called from action, caches matched text and appends it on next action
542
+ more: /* @__PURE__ */ d(function() {
543
+ return this._more = !0, this;
544
+ }, "more"),
545
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
546
+ reject: /* @__PURE__ */ d(function() {
547
+ if (this.options.backtrack_lexer)
548
+ this._backtrack = !0;
549
+ else
550
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
551
+ ` + this.showPosition(), {
552
+ text: "",
553
+ token: null,
554
+ line: this.yylineno
555
+ });
556
+ return this;
557
+ }, "reject"),
558
+ // retain first n characters of the match
559
+ less: /* @__PURE__ */ d(function(o) {
560
+ this.unput(this.match.slice(o));
561
+ }, "less"),
562
+ // displays already matched input, i.e. for error messages
563
+ pastInput: /* @__PURE__ */ d(function() {
564
+ var o = this.matched.substr(0, this.matched.length - this.match.length);
565
+ return (o.length > 20 ? "..." : "") + o.substr(-20).replace(/\n/g, "");
566
+ }, "pastInput"),
567
+ // displays upcoming input, i.e. for error messages
568
+ upcomingInput: /* @__PURE__ */ d(function() {
569
+ var o = this.match;
570
+ return o.length < 20 && (o += this._input.substr(0, 20 - o.length)), (o.substr(0, 20) + (o.length > 20 ? "..." : "")).replace(/\n/g, "");
571
+ }, "upcomingInput"),
572
+ // displays the character position where the lexing error occurred, i.e. for error messages
573
+ showPosition: /* @__PURE__ */ d(function() {
574
+ var o = this.pastInput(), l = new Array(o.length + 1).join("-");
575
+ return o + this.upcomingInput() + `
576
+ ` + l + "^";
577
+ }, "showPosition"),
578
+ // test the lexed token: return FALSE when not a match, otherwise return token
579
+ test_match: /* @__PURE__ */ d(function(o, l) {
580
+ var h, x, _;
581
+ if (this.options.backtrack_lexer && (_ = {
582
+ yylineno: this.yylineno,
583
+ yylloc: {
584
+ first_line: this.yylloc.first_line,
585
+ last_line: this.last_line,
586
+ first_column: this.yylloc.first_column,
587
+ last_column: this.yylloc.last_column
588
+ },
589
+ yytext: this.yytext,
590
+ match: this.match,
591
+ matches: this.matches,
592
+ matched: this.matched,
593
+ yyleng: this.yyleng,
594
+ offset: this.offset,
595
+ _more: this._more,
596
+ _input: this._input,
597
+ yy: this.yy,
598
+ conditionStack: this.conditionStack.slice(0),
599
+ done: this.done
600
+ }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), x = o[0].match(/(?:\r\n?|\n).*/g), x && (this.yylineno += x.length), this.yylloc = {
601
+ first_line: this.yylloc.last_line,
602
+ last_line: this.yylineno + 1,
603
+ first_column: this.yylloc.last_column,
604
+ last_column: x ? x[x.length - 1].length - x[x.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + o[0].length
605
+ }, this.yytext += o[0], this.match += o[0], this.matches = o, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(o[0].length), this.matched += o[0], h = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), h)
606
+ return h;
607
+ if (this._backtrack) {
608
+ for (var g in _)
609
+ this[g] = _[g];
610
+ return !1;
611
+ }
612
+ return !1;
613
+ }, "test_match"),
614
+ // return next match in input
615
+ next: /* @__PURE__ */ d(function() {
616
+ if (this.done)
617
+ return this.EOF;
618
+ this._input || (this.done = !0);
619
+ var o, l, h, x;
620
+ this._more || (this.yytext = "", this.match = "");
621
+ for (var _ = this._currentRules(), g = 0; g < _.length; g++)
622
+ if (h = this._input.match(this.rules[_[g]]), h && (!l || h[0].length > l[0].length)) {
623
+ if (l = h, x = g, this.options.backtrack_lexer) {
624
+ if (o = this.test_match(h, _[g]), o !== !1)
625
+ return o;
626
+ if (this._backtrack) {
627
+ l = !1;
628
+ continue;
629
+ } else
630
+ return !1;
631
+ } else if (!this.options.flex)
632
+ break;
633
+ }
634
+ return l ? (o = this.test_match(l, _[x]), o !== !1 ? o : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
635
+ ` + this.showPosition(), {
636
+ text: "",
637
+ token: null,
638
+ line: this.yylineno
639
+ });
640
+ }, "next"),
641
+ // return next match that has a token
642
+ lex: /* @__PURE__ */ d(function() {
643
+ var l = this.next();
644
+ return l || this.lex();
645
+ }, "lex"),
646
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
647
+ begin: /* @__PURE__ */ d(function(l) {
648
+ this.conditionStack.push(l);
649
+ }, "begin"),
650
+ // pop the previously active lexer condition state off the condition stack
651
+ popState: /* @__PURE__ */ d(function() {
652
+ var l = this.conditionStack.length - 1;
653
+ return l > 0 ? this.conditionStack.pop() : this.conditionStack[0];
654
+ }, "popState"),
655
+ // produce the lexer rule set which is active for the currently active lexer condition state
656
+ _currentRules: /* @__PURE__ */ d(function() {
657
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
658
+ }, "_currentRules"),
659
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
660
+ topState: /* @__PURE__ */ d(function(l) {
661
+ return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
662
+ }, "topState"),
663
+ // alias for begin(condition)
664
+ pushState: /* @__PURE__ */ d(function(l) {
665
+ this.begin(l);
666
+ }, "pushState"),
667
+ // return the number of states currently on the stack
668
+ stateStackSize: /* @__PURE__ */ d(function() {
669
+ return this.conditionStack.length;
670
+ }, "stateStackSize"),
671
+ options: { "case-insensitive": !0 },
672
+ performAction: /* @__PURE__ */ d(function(l, h, x, _) {
673
+ switch (x) {
674
+ case 0:
675
+ return this.pushState("csv"), 4;
676
+ case 1:
677
+ return this.pushState("csv"), 4;
678
+ case 2:
679
+ return 10;
680
+ case 3:
681
+ return 5;
682
+ case 4:
683
+ return 12;
684
+ case 5:
685
+ return this.pushState("escaped_text"), 18;
686
+ case 6:
687
+ return 20;
688
+ case 7:
689
+ return this.popState("escaped_text"), 18;
690
+ case 8:
691
+ return 19;
692
+ }
693
+ }, "anonymous"),
694
+ rules: [/^(?:sankey-beta\b)/i, /^(?:sankey\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
695
+ conditions: { csv: { rules: [2, 3, 4, 5, 6, 7, 8], inclusive: !1 }, escaped_text: { rules: [7, 8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8], inclusive: !0 } }
696
+ };
697
+ return m;
698
+ }();
699
+ u.lexer = y;
700
+ function p() {
701
+ this.yy = {};
702
+ }
703
+ return d(p, "Parser"), p.prototype = u, u.Parser = p, new p();
704
+ }();
705
+ at.parser = at;
706
+ var Z = at, J = [], tt = [], K = /* @__PURE__ */ new Map(), Kt = /* @__PURE__ */ d(() => {
707
+ J = [], tt = [], K = /* @__PURE__ */ new Map(), At();
708
+ }, "clear"), W, Jt = (W = class {
709
+ constructor(n, s, a = 0) {
710
+ this.source = n, this.target = s, this.value = a;
711
+ }
712
+ }, d(W, "SankeyLink"), W), te = /* @__PURE__ */ d((t, n, s) => {
713
+ J.push(new Jt(t, n, s));
714
+ }, "addLink"), G, ee = (G = class {
715
+ constructor(n) {
716
+ this.ID = n;
717
+ }
718
+ }, d(G, "SankeyNode"), G), ne = /* @__PURE__ */ d((t) => {
719
+ t = Tt.sanitizeText(t, lt());
720
+ let n = K.get(t);
721
+ return n === void 0 && (n = new ee(t), K.set(t, n), tt.push(n)), n;
722
+ }, "findOrCreateNode"), ie = /* @__PURE__ */ d(() => tt, "getNodes"), re = /* @__PURE__ */ d(() => J, "getLinks"), se = /* @__PURE__ */ d(() => ({
723
+ nodes: tt.map((t) => ({ id: t.ID })),
724
+ links: J.map((t) => ({
725
+ source: t.source.ID,
726
+ target: t.target.ID,
727
+ value: t.value
728
+ }))
729
+ }), "getGraph"), oe = {
730
+ nodesMap: K,
731
+ getConfig: /* @__PURE__ */ d(() => lt().sankey, "getConfig"),
732
+ getNodes: ie,
733
+ getLinks: re,
734
+ getGraph: se,
735
+ addLink: te,
736
+ findOrCreateNode: ne,
737
+ getAccTitle: wt,
738
+ setAccTitle: St,
739
+ getAccDescription: bt,
740
+ setAccDescription: vt,
741
+ getDiagramTitle: _t,
742
+ setDiagramTitle: xt,
743
+ clear: Kt
744
+ }, O, gt = (O = class {
745
+ static next(n) {
746
+ return new O(n + ++O.count);
747
+ }
748
+ constructor(n) {
749
+ this.id = n, this.href = `#${n}`;
750
+ }
751
+ toString() {
752
+ return "url(" + this.href + ")";
753
+ }
754
+ }, d(O, "Uid"), O.count = 0, O), ae = {
755
+ left: $t,
756
+ right: It,
757
+ center: Ot,
758
+ justify: kt
759
+ }, le = /* @__PURE__ */ d((t) => {
760
+ let n = 0, s = 0;
761
+ for (const a of t) {
762
+ const u = a.value ?? 0;
763
+ u > n && (n = u, s = a.layer ?? 0);
764
+ }
765
+ return s;
766
+ }, "findCentralNodeLayer"), ce = /* @__PURE__ */ d(function(t, n, s, a) {
767
+ const { securityLevel: u, sankey: y } = lt(), p = Lt.sankey;
768
+ let m;
769
+ u === "sandbox" && (m = X("#i" + n));
770
+ const o = u === "sandbox" ? X(m.nodes()[0].contentDocument.body) : X("body"), l = u === "sandbox" ? o.select(`[id="${n}"]`) : X(`[id="${n}"]`), h = (y == null ? void 0 : y.width) ?? p.width, x = (y == null ? void 0 : y.height) ?? p.width, _ = (y == null ? void 0 : y.useMaxWidth) ?? p.useMaxWidth, g = (y == null ? void 0 : y.nodeAlignment) ?? p.nodeAlignment, v = (y == null ? void 0 : y.prefix) ?? p.prefix, T = (y == null ? void 0 : y.suffix) ?? p.suffix, A = (y == null ? void 0 : y.showValues) ?? p.showValues, M = (y == null ? void 0 : y.nodeWidth) ?? p.nodeWidth ?? 10, $ = (y == null ? void 0 : y.nodePadding) ?? p.nodePadding ?? 12, N = (y == null ? void 0 : y.labelStyle) ?? p.labelStyle ?? "legacy", z = (y == null ? void 0 : y.nodeColors) ?? {}, S = a.db.getGraph(), P = ae[g];
771
+ Bt().nodeId((e) => e.id).nodeWidth(M).nodePadding($ + (A ? 15 : 0)).nodeAlign(P).extent([
772
+ [0, 0],
773
+ [h, x]
774
+ ])(S);
775
+ const D = le(S.nodes), V = Mt(Pt), I = /* @__PURE__ */ d((e) => z[e] ?? V(e), "getNodeColor");
776
+ l.append("g").attr("class", "nodes").selectAll(".node").data(S.nodes).join("g").attr("class", "node").attr("id", (e) => (e.uid = gt.next("node-")).id).attr("transform", function(e) {
777
+ return "translate(" + e.x0 + "," + e.y0 + ")";
778
+ }).attr("x", (e) => e.x0).attr("y", (e) => e.y0).append("rect").attr("height", (e) => e.y1 - e.y0).attr("width", (e) => e.x1 - e.x0).attr("fill", (e) => I(e.id));
779
+ const j = /* @__PURE__ */ d(({ id: e, value: r }) => A ? `${e}
780
+ ${v}${Math.round(r * 100) / 100}${T}` : e, "getText"), w = /* @__PURE__ */ d((e) => N === "outlined" ? (e.layer ?? 0) < D ? { x: e.x0 - 6, anchor: "end" } : { x: e.x1 + 6, anchor: "start" } : e.x0 < h / 2 ? { x: e.x1 + 6, anchor: "start" } : { x: e.x0 - 6, anchor: "end" }, "getLabelPosition"), C = l.append("g").attr("class", "node-labels").attr("font-size", 14), E = /* @__PURE__ */ d((e) => C.selectAll(e ? `.${e}` : "text").data(S.nodes).join("text").attr("class", e ?? null).attr("x", (r) => w(r).x).attr("y", (r) => (r.y1 + r.y0) / 2).attr("dy", `${A ? "0" : "0.35"}em`).attr("text-anchor", (r) => w(r).anchor).text(j), "appendLabel");
781
+ N === "outlined" ? (E("sankey-label-bg"), E("sankey-label-fg")) : E();
782
+ const i = l.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(S.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"), f = (y == null ? void 0 : y.linkColor) ?? "gradient";
783
+ if (f === "gradient") {
784
+ const e = i.append("linearGradient").attr("id", (r) => (r.uid = gt.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (r) => r.source.x1).attr("x2", (r) => r.target.x0);
785
+ e.append("stop").attr("offset", "0%").attr("stop-color", (r) => I(r.source.id)), e.append("stop").attr("offset", "100%").attr("stop-color", (r) => I(r.target.id));
786
+ }
787
+ let c;
788
+ switch (f) {
789
+ case "gradient":
790
+ c = /* @__PURE__ */ d((e) => e.uid, "coloring");
791
+ break;
792
+ case "source":
793
+ c = /* @__PURE__ */ d((e) => I(e.source.id), "coloring");
794
+ break;
795
+ case "target":
796
+ c = /* @__PURE__ */ d((e) => I(e.target.id), "coloring");
797
+ break;
798
+ default:
799
+ c = f;
800
+ }
801
+ i.append("path").attr("d", Zt()).attr("stroke", c).attr("stroke-width", (e) => Math.max(1, e.width)), Et(void 0, l, 0, _);
802
+ }, "draw"), ue = {
803
+ draw: ce
804
+ }, he = /* @__PURE__ */ d((t) => t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, `
805
+ `).trim(), "prepareTextForParsing"), fe = /* @__PURE__ */ d((t) => `.label {
806
+ font-family: ${t.fontFamily};
807
+ }
808
+
809
+ .node-labels {
810
+ font-family: ${t.fontFamily};
811
+ }
812
+
813
+ /* Outlined label style - background stroke for better readability */
814
+ .sankey-label-bg {
815
+ stroke: ${t.mainBkg || t.background || "#fff"};
816
+ stroke-width: 4px;
817
+ stroke-linejoin: round;
818
+ paint-order: stroke;
819
+ }
820
+
821
+ /* Foreground label text */
822
+ .sankey-label-fg {
823
+ fill: ${t.textColor};
824
+ }
825
+
826
+ /* Node styling */
827
+ .node rect {
828
+ shape-rendering: crispEdges;
829
+ }
830
+
831
+ /* Link styling */
832
+ .link {
833
+ fill: none;
834
+ stroke-opacity: 0.5;
835
+ mix-blend-mode: multiply;
836
+ }
837
+ `, "getStyles"), ye = fe, de = Z.parse.bind(Z);
838
+ Z.parse = (t) => de(he(t));
839
+ var ke = {
840
+ styles: ye,
841
+ parser: Z,
842
+ db: oe,
843
+ renderer: ue
844
+ };
845
+ export {
846
+ ke as diagram
847
+ };