@readme/markdown 7.10.2 → 7.10.3

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.
@@ -0,0 +1,1443 @@
1
+ "use strict";
2
+ exports.id = 11;
3
+ exports.ids = [11];
4
+ exports.modules = {
5
+
6
+ /***/ 7011:
7
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
+
9
+
10
+ // EXPORTS
11
+ __webpack_require__.d(__webpack_exports__, {
12
+ diagram: () => (/* binding */ diagram)
13
+ });
14
+
15
+ // EXTERNAL MODULE: ./node_modules/mermaid/dist/chunks/mermaid.core/chunk-S24QXQKS.mjs + 3 modules
16
+ var chunk_S24QXQKS = __webpack_require__(6322);
17
+ // EXTERNAL MODULE: ./node_modules/d3/src/index.js + 193 modules
18
+ var src = __webpack_require__(8066);
19
+ ;// ./node_modules/d3-sankey/node_modules/d3-array/src/min.js
20
+ function min(values, valueof) {
21
+ let min;
22
+ if (valueof === undefined) {
23
+ for (const value of values) {
24
+ if (value != null
25
+ && (min > value || (min === undefined && value >= value))) {
26
+ min = value;
27
+ }
28
+ }
29
+ } else {
30
+ let index = -1;
31
+ for (let value of values) {
32
+ if ((value = valueof(value, ++index, values)) != null
33
+ && (min > value || (min === undefined && value >= value))) {
34
+ min = value;
35
+ }
36
+ }
37
+ }
38
+ return min;
39
+ }
40
+
41
+ ;// ./node_modules/d3-sankey/src/align.js
42
+
43
+
44
+ function targetDepth(d) {
45
+ return d.target.depth;
46
+ }
47
+
48
+ function left(node) {
49
+ return node.depth;
50
+ }
51
+
52
+ function right(node, n) {
53
+ return n - 1 - node.height;
54
+ }
55
+
56
+ function justify(node, n) {
57
+ return node.sourceLinks.length ? node.depth : n - 1;
58
+ }
59
+
60
+ function center(node) {
61
+ return node.targetLinks.length ? node.depth
62
+ : node.sourceLinks.length ? min(node.sourceLinks, targetDepth) - 1
63
+ : 0;
64
+ }
65
+
66
+ ;// ./node_modules/d3-sankey/node_modules/d3-array/src/sum.js
67
+ function sum(values, valueof) {
68
+ let sum = 0;
69
+ if (valueof === undefined) {
70
+ for (let value of values) {
71
+ if (value = +value) {
72
+ sum += value;
73
+ }
74
+ }
75
+ } else {
76
+ let index = -1;
77
+ for (let value of values) {
78
+ if (value = +valueof(value, ++index, values)) {
79
+ sum += value;
80
+ }
81
+ }
82
+ }
83
+ return sum;
84
+ }
85
+
86
+ ;// ./node_modules/d3-sankey/node_modules/d3-array/src/max.js
87
+ function max(values, valueof) {
88
+ let max;
89
+ if (valueof === undefined) {
90
+ for (const value of values) {
91
+ if (value != null
92
+ && (max < value || (max === undefined && value >= value))) {
93
+ max = value;
94
+ }
95
+ }
96
+ } else {
97
+ let index = -1;
98
+ for (let value of values) {
99
+ if ((value = valueof(value, ++index, values)) != null
100
+ && (max < value || (max === undefined && value >= value))) {
101
+ max = value;
102
+ }
103
+ }
104
+ }
105
+ return max;
106
+ }
107
+
108
+ ;// ./node_modules/d3-sankey/src/constant.js
109
+ function constant(x) {
110
+ return function() {
111
+ return x;
112
+ };
113
+ }
114
+
115
+ ;// ./node_modules/d3-sankey/src/sankey.js
116
+
117
+
118
+
119
+
120
+ function ascendingSourceBreadth(a, b) {
121
+ return ascendingBreadth(a.source, b.source) || a.index - b.index;
122
+ }
123
+
124
+ function ascendingTargetBreadth(a, b) {
125
+ return ascendingBreadth(a.target, b.target) || a.index - b.index;
126
+ }
127
+
128
+ function ascendingBreadth(a, b) {
129
+ return a.y0 - b.y0;
130
+ }
131
+
132
+ function value(d) {
133
+ return d.value;
134
+ }
135
+
136
+ function defaultId(d) {
137
+ return d.index;
138
+ }
139
+
140
+ function defaultNodes(graph) {
141
+ return graph.nodes;
142
+ }
143
+
144
+ function defaultLinks(graph) {
145
+ return graph.links;
146
+ }
147
+
148
+ function find(nodeById, id) {
149
+ const node = nodeById.get(id);
150
+ if (!node) throw new Error("missing: " + id);
151
+ return node;
152
+ }
153
+
154
+ function computeLinkBreadths({nodes}) {
155
+ for (const node of nodes) {
156
+ let y0 = node.y0;
157
+ let y1 = y0;
158
+ for (const link of node.sourceLinks) {
159
+ link.y0 = y0 + link.width / 2;
160
+ y0 += link.width;
161
+ }
162
+ for (const link of node.targetLinks) {
163
+ link.y1 = y1 + link.width / 2;
164
+ y1 += link.width;
165
+ }
166
+ }
167
+ }
168
+
169
+ function Sankey() {
170
+ let x0 = 0, y0 = 0, x1 = 1, y1 = 1; // extent
171
+ let dx = 24; // nodeWidth
172
+ let dy = 8, py; // nodePadding
173
+ let id = defaultId;
174
+ let align = justify;
175
+ let sort;
176
+ let linkSort;
177
+ let nodes = defaultNodes;
178
+ let links = defaultLinks;
179
+ let iterations = 6;
180
+
181
+ function sankey() {
182
+ const graph = {nodes: nodes.apply(null, arguments), links: links.apply(null, arguments)};
183
+ computeNodeLinks(graph);
184
+ computeNodeValues(graph);
185
+ computeNodeDepths(graph);
186
+ computeNodeHeights(graph);
187
+ computeNodeBreadths(graph);
188
+ computeLinkBreadths(graph);
189
+ return graph;
190
+ }
191
+
192
+ sankey.update = function(graph) {
193
+ computeLinkBreadths(graph);
194
+ return graph;
195
+ };
196
+
197
+ sankey.nodeId = function(_) {
198
+ return arguments.length ? (id = typeof _ === "function" ? _ : constant(_), sankey) : id;
199
+ };
200
+
201
+ sankey.nodeAlign = function(_) {
202
+ return arguments.length ? (align = typeof _ === "function" ? _ : constant(_), sankey) : align;
203
+ };
204
+
205
+ sankey.nodeSort = function(_) {
206
+ return arguments.length ? (sort = _, sankey) : sort;
207
+ };
208
+
209
+ sankey.nodeWidth = function(_) {
210
+ return arguments.length ? (dx = +_, sankey) : dx;
211
+ };
212
+
213
+ sankey.nodePadding = function(_) {
214
+ return arguments.length ? (dy = py = +_, sankey) : dy;
215
+ };
216
+
217
+ sankey.nodes = function(_) {
218
+ return arguments.length ? (nodes = typeof _ === "function" ? _ : constant(_), sankey) : nodes;
219
+ };
220
+
221
+ sankey.links = function(_) {
222
+ return arguments.length ? (links = typeof _ === "function" ? _ : constant(_), sankey) : links;
223
+ };
224
+
225
+ sankey.linkSort = function(_) {
226
+ return arguments.length ? (linkSort = _, sankey) : linkSort;
227
+ };
228
+
229
+ sankey.size = function(_) {
230
+ return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], sankey) : [x1 - x0, y1 - y0];
231
+ };
232
+
233
+ sankey.extent = function(_) {
234
+ return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], sankey) : [[x0, y0], [x1, y1]];
235
+ };
236
+
237
+ sankey.iterations = function(_) {
238
+ return arguments.length ? (iterations = +_, sankey) : iterations;
239
+ };
240
+
241
+ function computeNodeLinks({nodes, links}) {
242
+ for (const [i, node] of nodes.entries()) {
243
+ node.index = i;
244
+ node.sourceLinks = [];
245
+ node.targetLinks = [];
246
+ }
247
+ const nodeById = new Map(nodes.map((d, i) => [id(d, i, nodes), d]));
248
+ for (const [i, link] of links.entries()) {
249
+ link.index = i;
250
+ let {source, target} = link;
251
+ if (typeof source !== "object") source = link.source = find(nodeById, source);
252
+ if (typeof target !== "object") target = link.target = find(nodeById, target);
253
+ source.sourceLinks.push(link);
254
+ target.targetLinks.push(link);
255
+ }
256
+ if (linkSort != null) {
257
+ for (const {sourceLinks, targetLinks} of nodes) {
258
+ sourceLinks.sort(linkSort);
259
+ targetLinks.sort(linkSort);
260
+ }
261
+ }
262
+ }
263
+
264
+ function computeNodeValues({nodes}) {
265
+ for (const node of nodes) {
266
+ node.value = node.fixedValue === undefined
267
+ ? Math.max(sum(node.sourceLinks, value), sum(node.targetLinks, value))
268
+ : node.fixedValue;
269
+ }
270
+ }
271
+
272
+ function computeNodeDepths({nodes}) {
273
+ const n = nodes.length;
274
+ let current = new Set(nodes);
275
+ let next = new Set;
276
+ let x = 0;
277
+ while (current.size) {
278
+ for (const node of current) {
279
+ node.depth = x;
280
+ for (const {target} of node.sourceLinks) {
281
+ next.add(target);
282
+ }
283
+ }
284
+ if (++x > n) throw new Error("circular link");
285
+ current = next;
286
+ next = new Set;
287
+ }
288
+ }
289
+
290
+ function computeNodeHeights({nodes}) {
291
+ const n = nodes.length;
292
+ let current = new Set(nodes);
293
+ let next = new Set;
294
+ let x = 0;
295
+ while (current.size) {
296
+ for (const node of current) {
297
+ node.height = x;
298
+ for (const {source} of node.targetLinks) {
299
+ next.add(source);
300
+ }
301
+ }
302
+ if (++x > n) throw new Error("circular link");
303
+ current = next;
304
+ next = new Set;
305
+ }
306
+ }
307
+
308
+ function computeNodeLayers({nodes}) {
309
+ const x = max(nodes, d => d.depth) + 1;
310
+ const kx = (x1 - x0 - dx) / (x - 1);
311
+ const columns = new Array(x);
312
+ for (const node of nodes) {
313
+ const i = Math.max(0, Math.min(x - 1, Math.floor(align.call(null, node, x))));
314
+ node.layer = i;
315
+ node.x0 = x0 + i * kx;
316
+ node.x1 = node.x0 + dx;
317
+ if (columns[i]) columns[i].push(node);
318
+ else columns[i] = [node];
319
+ }
320
+ if (sort) for (const column of columns) {
321
+ column.sort(sort);
322
+ }
323
+ return columns;
324
+ }
325
+
326
+ function initializeNodeBreadths(columns) {
327
+ const ky = min(columns, c => (y1 - y0 - (c.length - 1) * py) / sum(c, value));
328
+ for (const nodes of columns) {
329
+ let y = y0;
330
+ for (const node of nodes) {
331
+ node.y0 = y;
332
+ node.y1 = y + node.value * ky;
333
+ y = node.y1 + py;
334
+ for (const link of node.sourceLinks) {
335
+ link.width = link.value * ky;
336
+ }
337
+ }
338
+ y = (y1 - y + py) / (nodes.length + 1);
339
+ for (let i = 0; i < nodes.length; ++i) {
340
+ const node = nodes[i];
341
+ node.y0 += y * (i + 1);
342
+ node.y1 += y * (i + 1);
343
+ }
344
+ reorderLinks(nodes);
345
+ }
346
+ }
347
+
348
+ function computeNodeBreadths(graph) {
349
+ const columns = computeNodeLayers(graph);
350
+ py = Math.min(dy, (y1 - y0) / (max(columns, c => c.length) - 1));
351
+ initializeNodeBreadths(columns);
352
+ for (let i = 0; i < iterations; ++i) {
353
+ const alpha = Math.pow(0.99, i);
354
+ const beta = Math.max(1 - alpha, (i + 1) / iterations);
355
+ relaxRightToLeft(columns, alpha, beta);
356
+ relaxLeftToRight(columns, alpha, beta);
357
+ }
358
+ }
359
+
360
+ // Reposition each node based on its incoming (target) links.
361
+ function relaxLeftToRight(columns, alpha, beta) {
362
+ for (let i = 1, n = columns.length; i < n; ++i) {
363
+ const column = columns[i];
364
+ for (const target of column) {
365
+ let y = 0;
366
+ let w = 0;
367
+ for (const {source, value} of target.targetLinks) {
368
+ let v = value * (target.layer - source.layer);
369
+ y += targetTop(source, target) * v;
370
+ w += v;
371
+ }
372
+ if (!(w > 0)) continue;
373
+ let dy = (y / w - target.y0) * alpha;
374
+ target.y0 += dy;
375
+ target.y1 += dy;
376
+ reorderNodeLinks(target);
377
+ }
378
+ if (sort === undefined) column.sort(ascendingBreadth);
379
+ resolveCollisions(column, beta);
380
+ }
381
+ }
382
+
383
+ // Reposition each node based on its outgoing (source) links.
384
+ function relaxRightToLeft(columns, alpha, beta) {
385
+ for (let n = columns.length, i = n - 2; i >= 0; --i) {
386
+ const column = columns[i];
387
+ for (const source of column) {
388
+ let y = 0;
389
+ let w = 0;
390
+ for (const {target, value} of source.sourceLinks) {
391
+ let v = value * (target.layer - source.layer);
392
+ y += sourceTop(source, target) * v;
393
+ w += v;
394
+ }
395
+ if (!(w > 0)) continue;
396
+ let dy = (y / w - source.y0) * alpha;
397
+ source.y0 += dy;
398
+ source.y1 += dy;
399
+ reorderNodeLinks(source);
400
+ }
401
+ if (sort === undefined) column.sort(ascendingBreadth);
402
+ resolveCollisions(column, beta);
403
+ }
404
+ }
405
+
406
+ function resolveCollisions(nodes, alpha) {
407
+ const i = nodes.length >> 1;
408
+ const subject = nodes[i];
409
+ resolveCollisionsBottomToTop(nodes, subject.y0 - py, i - 1, alpha);
410
+ resolveCollisionsTopToBottom(nodes, subject.y1 + py, i + 1, alpha);
411
+ resolveCollisionsBottomToTop(nodes, y1, nodes.length - 1, alpha);
412
+ resolveCollisionsTopToBottom(nodes, y0, 0, alpha);
413
+ }
414
+
415
+ // Push any overlapping nodes down.
416
+ function resolveCollisionsTopToBottom(nodes, y, i, alpha) {
417
+ for (; i < nodes.length; ++i) {
418
+ const node = nodes[i];
419
+ const dy = (y - node.y0) * alpha;
420
+ if (dy > 1e-6) node.y0 += dy, node.y1 += dy;
421
+ y = node.y1 + py;
422
+ }
423
+ }
424
+
425
+ // Push any overlapping nodes up.
426
+ function resolveCollisionsBottomToTop(nodes, y, i, alpha) {
427
+ for (; i >= 0; --i) {
428
+ const node = nodes[i];
429
+ const dy = (node.y1 - y) * alpha;
430
+ if (dy > 1e-6) node.y0 -= dy, node.y1 -= dy;
431
+ y = node.y0 - py;
432
+ }
433
+ }
434
+
435
+ function reorderNodeLinks({sourceLinks, targetLinks}) {
436
+ if (linkSort === undefined) {
437
+ for (const {source: {sourceLinks}} of targetLinks) {
438
+ sourceLinks.sort(ascendingTargetBreadth);
439
+ }
440
+ for (const {target: {targetLinks}} of sourceLinks) {
441
+ targetLinks.sort(ascendingSourceBreadth);
442
+ }
443
+ }
444
+ }
445
+
446
+ function reorderLinks(nodes) {
447
+ if (linkSort === undefined) {
448
+ for (const {sourceLinks, targetLinks} of nodes) {
449
+ sourceLinks.sort(ascendingTargetBreadth);
450
+ targetLinks.sort(ascendingSourceBreadth);
451
+ }
452
+ }
453
+ }
454
+
455
+ // Returns the target.y0 that would produce an ideal link from source to target.
456
+ function targetTop(source, target) {
457
+ let y = source.y0 - (source.sourceLinks.length - 1) * py / 2;
458
+ for (const {target: node, width} of source.sourceLinks) {
459
+ if (node === target) break;
460
+ y += width + py;
461
+ }
462
+ for (const {source: node, width} of target.targetLinks) {
463
+ if (node === source) break;
464
+ y -= width;
465
+ }
466
+ return y;
467
+ }
468
+
469
+ // Returns the source.y0 that would produce an ideal link from source to target.
470
+ function sourceTop(source, target) {
471
+ let y = target.y0 - (target.targetLinks.length - 1) * py / 2;
472
+ for (const {source: node, width} of target.targetLinks) {
473
+ if (node === source) break;
474
+ y += width + py;
475
+ }
476
+ for (const {target: node, width} of source.sourceLinks) {
477
+ if (node === target) break;
478
+ y -= width;
479
+ }
480
+ return y;
481
+ }
482
+
483
+ return sankey;
484
+ }
485
+
486
+ ;// ./node_modules/d3-sankey/node_modules/d3-path/src/path.js
487
+ var pi = Math.PI,
488
+ tau = 2 * pi,
489
+ epsilon = 1e-6,
490
+ tauEpsilon = tau - epsilon;
491
+
492
+ function Path() {
493
+ this._x0 = this._y0 = // start of current subpath
494
+ this._x1 = this._y1 = null; // end of current subpath
495
+ this._ = "";
496
+ }
497
+
498
+ function path() {
499
+ return new Path;
500
+ }
501
+
502
+ Path.prototype = path.prototype = {
503
+ constructor: Path,
504
+ moveTo: function(x, y) {
505
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
506
+ },
507
+ closePath: function() {
508
+ if (this._x1 !== null) {
509
+ this._x1 = this._x0, this._y1 = this._y0;
510
+ this._ += "Z";
511
+ }
512
+ },
513
+ lineTo: function(x, y) {
514
+ this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
515
+ },
516
+ quadraticCurveTo: function(x1, y1, x, y) {
517
+ this._ += "Q" + (+x1) + "," + (+y1) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
518
+ },
519
+ bezierCurveTo: function(x1, y1, x2, y2, x, y) {
520
+ this._ += "C" + (+x1) + "," + (+y1) + "," + (+x2) + "," + (+y2) + "," + (this._x1 = +x) + "," + (this._y1 = +y);
521
+ },
522
+ arcTo: function(x1, y1, x2, y2, r) {
523
+ x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
524
+ var x0 = this._x1,
525
+ y0 = this._y1,
526
+ x21 = x2 - x1,
527
+ y21 = y2 - y1,
528
+ x01 = x0 - x1,
529
+ y01 = y0 - y1,
530
+ l01_2 = x01 * x01 + y01 * y01;
531
+
532
+ // Is the radius negative? Error.
533
+ if (r < 0) throw new Error("negative radius: " + r);
534
+
535
+ // Is this path empty? Move to (x1,y1).
536
+ if (this._x1 === null) {
537
+ this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1);
538
+ }
539
+
540
+ // Or, is (x1,y1) coincident with (x0,y0)? Do nothing.
541
+ else if (!(l01_2 > epsilon));
542
+
543
+ // Or, are (x0,y0), (x1,y1) and (x2,y2) collinear?
544
+ // Equivalently, is (x1,y1) coincident with (x2,y2)?
545
+ // Or, is the radius zero? Line to (x1,y1).
546
+ else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
547
+ this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1);
548
+ }
549
+
550
+ // Otherwise, draw an arc!
551
+ else {
552
+ var x20 = x2 - x0,
553
+ y20 = y2 - y0,
554
+ l21_2 = x21 * x21 + y21 * y21,
555
+ l20_2 = x20 * x20 + y20 * y20,
556
+ l21 = Math.sqrt(l21_2),
557
+ l01 = Math.sqrt(l01_2),
558
+ l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2),
559
+ t01 = l / l01,
560
+ t21 = l / l21;
561
+
562
+ // If the start tangent is not coincident with (x0,y0), line to.
563
+ if (Math.abs(t01 - 1) > epsilon) {
564
+ this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01);
565
+ }
566
+
567
+ this._ += "A" + r + "," + r + ",0,0," + (+(y01 * x20 > x01 * y20)) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
568
+ }
569
+ },
570
+ arc: function(x, y, r, a0, a1, ccw) {
571
+ x = +x, y = +y, r = +r, ccw = !!ccw;
572
+ var dx = r * Math.cos(a0),
573
+ dy = r * Math.sin(a0),
574
+ x0 = x + dx,
575
+ y0 = y + dy,
576
+ cw = 1 ^ ccw,
577
+ da = ccw ? a0 - a1 : a1 - a0;
578
+
579
+ // Is the radius negative? Error.
580
+ if (r < 0) throw new Error("negative radius: " + r);
581
+
582
+ // Is this path empty? Move to (x0,y0).
583
+ if (this._x1 === null) {
584
+ this._ += "M" + x0 + "," + y0;
585
+ }
586
+
587
+ // Or, is (x0,y0) not coincident with the previous point? Line to (x0,y0).
588
+ else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
589
+ this._ += "L" + x0 + "," + y0;
590
+ }
591
+
592
+ // Is this arc empty? We’re done.
593
+ if (!r) return;
594
+
595
+ // Does the angle go the wrong way? Flip the direction.
596
+ if (da < 0) da = da % tau + tau;
597
+
598
+ // Is this a complete circle? Draw two arcs to complete the circle.
599
+ if (da > tauEpsilon) {
600
+ this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0);
601
+ }
602
+
603
+ // Is this arc non-empty? Draw an arc!
604
+ else if (da > epsilon) {
605
+ this._ += "A" + r + "," + r + ",0," + (+(da >= pi)) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1));
606
+ }
607
+ },
608
+ rect: function(x, y, w, h) {
609
+ this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + (+w) + "v" + (+h) + "h" + (-w) + "Z";
610
+ },
611
+ toString: function() {
612
+ return this._;
613
+ }
614
+ };
615
+
616
+ /* harmony default export */ const src_path = (path);
617
+
618
+ ;// ./node_modules/d3-sankey/node_modules/d3-shape/src/array.js
619
+ var slice = Array.prototype.slice;
620
+
621
+ ;// ./node_modules/d3-sankey/node_modules/d3-shape/src/constant.js
622
+ /* harmony default export */ function src_constant(x) {
623
+ return function constant() {
624
+ return x;
625
+ };
626
+ }
627
+
628
+ ;// ./node_modules/d3-sankey/node_modules/d3-shape/src/point.js
629
+ function point_x(p) {
630
+ return p[0];
631
+ }
632
+
633
+ function point_y(p) {
634
+ return p[1];
635
+ }
636
+
637
+ ;// ./node_modules/d3-sankey/node_modules/d3-shape/src/link/index.js
638
+
639
+
640
+
641
+
642
+
643
+
644
+ function linkSource(d) {
645
+ return d.source;
646
+ }
647
+
648
+ function linkTarget(d) {
649
+ return d.target;
650
+ }
651
+
652
+ function link_link(curve) {
653
+ var source = linkSource,
654
+ target = linkTarget,
655
+ x = point_x,
656
+ y = point_y,
657
+ context = null;
658
+
659
+ function link() {
660
+ var buffer, argv = slice.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
661
+ if (!context) context = buffer = src_path();
662
+ curve(context, +x.apply(this, (argv[0] = s, argv)), +y.apply(this, argv), +x.apply(this, (argv[0] = t, argv)), +y.apply(this, argv));
663
+ if (buffer) return context = null, buffer + "" || null;
664
+ }
665
+
666
+ link.source = function(_) {
667
+ return arguments.length ? (source = _, link) : source;
668
+ };
669
+
670
+ link.target = function(_) {
671
+ return arguments.length ? (target = _, link) : target;
672
+ };
673
+
674
+ link.x = function(_) {
675
+ return arguments.length ? (x = typeof _ === "function" ? _ : src_constant(+_), link) : x;
676
+ };
677
+
678
+ link.y = function(_) {
679
+ return arguments.length ? (y = typeof _ === "function" ? _ : src_constant(+_), link) : y;
680
+ };
681
+
682
+ link.context = function(_) {
683
+ return arguments.length ? ((context = _ == null ? null : _), link) : context;
684
+ };
685
+
686
+ return link;
687
+ }
688
+
689
+ function curveHorizontal(context, x0, y0, x1, y1) {
690
+ context.moveTo(x0, y0);
691
+ context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
692
+ }
693
+
694
+ function curveVertical(context, x0, y0, x1, y1) {
695
+ context.moveTo(x0, y0);
696
+ context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
697
+ }
698
+
699
+ function curveRadial(context, x0, y0, x1, y1) {
700
+ var p0 = pointRadial(x0, y0),
701
+ p1 = pointRadial(x0, y0 = (y0 + y1) / 2),
702
+ p2 = pointRadial(x1, y0),
703
+ p3 = pointRadial(x1, y1);
704
+ context.moveTo(p0[0], p0[1]);
705
+ context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
706
+ }
707
+
708
+ function linkHorizontal() {
709
+ return link_link(curveHorizontal);
710
+ }
711
+
712
+ function linkVertical() {
713
+ return link_link(curveVertical);
714
+ }
715
+
716
+ function linkRadial() {
717
+ var l = link_link(curveRadial);
718
+ l.angle = l.x, delete l.x;
719
+ l.radius = l.y, delete l.y;
720
+ return l;
721
+ }
722
+
723
+ ;// ./node_modules/d3-sankey/src/sankeyLinkHorizontal.js
724
+
725
+
726
+ function horizontalSource(d) {
727
+ return [d.source.x1, d.y0];
728
+ }
729
+
730
+ function horizontalTarget(d) {
731
+ return [d.target.x0, d.y1];
732
+ }
733
+
734
+ /* harmony default export */ function sankeyLinkHorizontal() {
735
+ return linkHorizontal()
736
+ .source(horizontalSource)
737
+ .target(horizontalTarget);
738
+ }
739
+
740
+ ;// ./node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-ATFNWWW6.mjs
741
+
742
+
743
+ // src/diagrams/sankey/parser/sankey.jison
744
+ var parser = function() {
745
+ var o = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(k, v, o2, l) {
746
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v) ;
747
+ return o2;
748
+ }, "o"), $V0 = [1, 9], $V1 = [1, 10], $V2 = [1, 5, 10, 12];
749
+ var parser2 = {
750
+ trace: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function trace() {
751
+ }, "trace"),
752
+ yy: {},
753
+ 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 },
754
+ 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" },
755
+ productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
756
+ performAction: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
757
+ var $0 = $$.length - 1;
758
+ switch (yystate) {
759
+ case 7:
760
+ const source = yy.findOrCreateNode($$[$0 - 4].trim().replaceAll('""', '"'));
761
+ const target = yy.findOrCreateNode($$[$0 - 2].trim().replaceAll('""', '"'));
762
+ const value = parseFloat($$[$0].trim());
763
+ yy.addLink(source, target, value);
764
+ break;
765
+ case 8:
766
+ case 9:
767
+ case 11:
768
+ this.$ = $$[$0];
769
+ break;
770
+ case 10:
771
+ this.$ = $$[$0 - 1];
772
+ break;
773
+ }
774
+ }, "anonymous"),
775
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 1: [2, 6], 7: 11, 10: [1, 12] }, o($V1, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, o($V2, [2, 8]), o($V2, [2, 9]), { 19: [1, 16] }, o($V2, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, o($V1, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 15: 18, 16: 7, 17: 8, 18: $V0, 20: $V1 }, { 18: [1, 19] }, o($V1, [2, 3]), { 12: [1, 20] }, o($V2, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: $V0, 20: $V1 }, o([1, 5, 10], [2, 7])],
776
+ defaultActions: { 11: [2, 1], 12: [2, 5] },
777
+ parseError: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function parseError(str, hash) {
778
+ if (hash.recoverable) {
779
+ this.trace(str);
780
+ } else {
781
+ var error = new Error(str);
782
+ error.hash = hash;
783
+ throw error;
784
+ }
785
+ }, "parseError"),
786
+ parse: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function parse(input) {
787
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1;
788
+ var args = lstack.slice.call(arguments, 1);
789
+ var lexer2 = Object.create(this.lexer);
790
+ var sharedState = { yy: {} };
791
+ for (var k in this.yy) {
792
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
793
+ sharedState.yy[k] = this.yy[k];
794
+ }
795
+ }
796
+ lexer2.setInput(input, sharedState.yy);
797
+ sharedState.yy.lexer = lexer2;
798
+ sharedState.yy.parser = this;
799
+ if (typeof lexer2.yylloc == "undefined") {
800
+ lexer2.yylloc = {};
801
+ }
802
+ var yyloc = lexer2.yylloc;
803
+ lstack.push(yyloc);
804
+ var ranges = lexer2.options && lexer2.options.ranges;
805
+ if (typeof sharedState.yy.parseError === "function") {
806
+ this.parseError = sharedState.yy.parseError;
807
+ } else {
808
+ this.parseError = Object.getPrototypeOf(this).parseError;
809
+ }
810
+ function popStack(n) {
811
+ stack.length = stack.length - 2 * n;
812
+ vstack.length = vstack.length - n;
813
+ lstack.length = lstack.length - n;
814
+ }
815
+ (0,chunk_S24QXQKS/* __name */.K2)(popStack, "popStack");
816
+ function lex() {
817
+ var token;
818
+ token = tstack.pop() || lexer2.lex() || EOF;
819
+ if (typeof token !== "number") {
820
+ if (token instanceof Array) {
821
+ tstack = token;
822
+ token = tstack.pop();
823
+ }
824
+ token = self.symbols_[token] || token;
825
+ }
826
+ return token;
827
+ }
828
+ (0,chunk_S24QXQKS/* __name */.K2)(lex, "lex");
829
+ var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected;
830
+ while (true) {
831
+ state = stack[stack.length - 1];
832
+ if (this.defaultActions[state]) {
833
+ action = this.defaultActions[state];
834
+ } else {
835
+ if (symbol === null || typeof symbol == "undefined") {
836
+ symbol = lex();
837
+ }
838
+ action = table[state] && table[state][symbol];
839
+ }
840
+ if (typeof action === "undefined" || !action.length || !action[0]) {
841
+ var errStr = "";
842
+ expected = [];
843
+ for (p in table[state]) {
844
+ if (this.terminals_[p] && p > TERROR) {
845
+ expected.push("'" + this.terminals_[p] + "'");
846
+ }
847
+ }
848
+ if (lexer2.showPosition) {
849
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
850
+ } else {
851
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
852
+ }
853
+ this.parseError(errStr, {
854
+ text: lexer2.match,
855
+ token: this.terminals_[symbol] || symbol,
856
+ line: lexer2.yylineno,
857
+ loc: yyloc,
858
+ expected
859
+ });
860
+ }
861
+ if (action[0] instanceof Array && action.length > 1) {
862
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
863
+ }
864
+ switch (action[0]) {
865
+ case 1:
866
+ stack.push(symbol);
867
+ vstack.push(lexer2.yytext);
868
+ lstack.push(lexer2.yylloc);
869
+ stack.push(action[1]);
870
+ symbol = null;
871
+ if (!preErrorSymbol) {
872
+ yyleng = lexer2.yyleng;
873
+ yytext = lexer2.yytext;
874
+ yylineno = lexer2.yylineno;
875
+ yyloc = lexer2.yylloc;
876
+ if (recovering > 0) {
877
+ recovering--;
878
+ }
879
+ } else {
880
+ symbol = preErrorSymbol;
881
+ preErrorSymbol = null;
882
+ }
883
+ break;
884
+ case 2:
885
+ len = this.productions_[action[1]][1];
886
+ yyval.$ = vstack[vstack.length - len];
887
+ yyval._$ = {
888
+ first_line: lstack[lstack.length - (len || 1)].first_line,
889
+ last_line: lstack[lstack.length - 1].last_line,
890
+ first_column: lstack[lstack.length - (len || 1)].first_column,
891
+ last_column: lstack[lstack.length - 1].last_column
892
+ };
893
+ if (ranges) {
894
+ yyval._$.range = [
895
+ lstack[lstack.length - (len || 1)].range[0],
896
+ lstack[lstack.length - 1].range[1]
897
+ ];
898
+ }
899
+ r = this.performAction.apply(yyval, [
900
+ yytext,
901
+ yyleng,
902
+ yylineno,
903
+ sharedState.yy,
904
+ action[1],
905
+ vstack,
906
+ lstack
907
+ ].concat(args));
908
+ if (typeof r !== "undefined") {
909
+ return r;
910
+ }
911
+ if (len) {
912
+ stack = stack.slice(0, -1 * len * 2);
913
+ vstack = vstack.slice(0, -1 * len);
914
+ lstack = lstack.slice(0, -1 * len);
915
+ }
916
+ stack.push(this.productions_[action[1]][0]);
917
+ vstack.push(yyval.$);
918
+ lstack.push(yyval._$);
919
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
920
+ stack.push(newState);
921
+ break;
922
+ case 3:
923
+ return true;
924
+ }
925
+ }
926
+ return true;
927
+ }, "parse")
928
+ };
929
+ var lexer = /* @__PURE__ */ function() {
930
+ var lexer2 = {
931
+ EOF: 1,
932
+ parseError: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function parseError(str, hash) {
933
+ if (this.yy.parser) {
934
+ this.yy.parser.parseError(str, hash);
935
+ } else {
936
+ throw new Error(str);
937
+ }
938
+ }, "parseError"),
939
+ // resets the lexer, sets new input
940
+ setInput: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(input, yy) {
941
+ this.yy = yy || this.yy || {};
942
+ this._input = input;
943
+ this._more = this._backtrack = this.done = false;
944
+ this.yylineno = this.yyleng = 0;
945
+ this.yytext = this.matched = this.match = "";
946
+ this.conditionStack = ["INITIAL"];
947
+ this.yylloc = {
948
+ first_line: 1,
949
+ first_column: 0,
950
+ last_line: 1,
951
+ last_column: 0
952
+ };
953
+ if (this.options.ranges) {
954
+ this.yylloc.range = [0, 0];
955
+ }
956
+ this.offset = 0;
957
+ return this;
958
+ }, "setInput"),
959
+ // consumes and returns one char from the input
960
+ input: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
961
+ var ch = this._input[0];
962
+ this.yytext += ch;
963
+ this.yyleng++;
964
+ this.offset++;
965
+ this.match += ch;
966
+ this.matched += ch;
967
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
968
+ if (lines) {
969
+ this.yylineno++;
970
+ this.yylloc.last_line++;
971
+ } else {
972
+ this.yylloc.last_column++;
973
+ }
974
+ if (this.options.ranges) {
975
+ this.yylloc.range[1]++;
976
+ }
977
+ this._input = this._input.slice(1);
978
+ return ch;
979
+ }, "input"),
980
+ // unshifts one char (or a string) into the input
981
+ unput: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(ch) {
982
+ var len = ch.length;
983
+ var lines = ch.split(/(?:\r\n?|\n)/g);
984
+ this._input = ch + this._input;
985
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
986
+ this.offset -= len;
987
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
988
+ this.match = this.match.substr(0, this.match.length - 1);
989
+ this.matched = this.matched.substr(0, this.matched.length - 1);
990
+ if (lines.length - 1) {
991
+ this.yylineno -= lines.length - 1;
992
+ }
993
+ var r = this.yylloc.range;
994
+ this.yylloc = {
995
+ first_line: this.yylloc.first_line,
996
+ last_line: this.yylineno + 1,
997
+ first_column: this.yylloc.first_column,
998
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
999
+ };
1000
+ if (this.options.ranges) {
1001
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
1002
+ }
1003
+ this.yyleng = this.yytext.length;
1004
+ return this;
1005
+ }, "unput"),
1006
+ // When called from action, caches matched text and appends it on next action
1007
+ more: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1008
+ this._more = true;
1009
+ return this;
1010
+ }, "more"),
1011
+ // 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.
1012
+ reject: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1013
+ if (this.options.backtrack_lexer) {
1014
+ this._backtrack = true;
1015
+ } else {
1016
+ 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).\n" + this.showPosition(), {
1017
+ text: "",
1018
+ token: null,
1019
+ line: this.yylineno
1020
+ });
1021
+ }
1022
+ return this;
1023
+ }, "reject"),
1024
+ // retain first n characters of the match
1025
+ less: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(n) {
1026
+ this.unput(this.match.slice(n));
1027
+ }, "less"),
1028
+ // displays already matched input, i.e. for error messages
1029
+ pastInput: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1030
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
1031
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
1032
+ }, "pastInput"),
1033
+ // displays upcoming input, i.e. for error messages
1034
+ upcomingInput: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1035
+ var next = this.match;
1036
+ if (next.length < 20) {
1037
+ next += this._input.substr(0, 20 - next.length);
1038
+ }
1039
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
1040
+ }, "upcomingInput"),
1041
+ // displays the character position where the lexing error occurred, i.e. for error messages
1042
+ showPosition: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1043
+ var pre = this.pastInput();
1044
+ var c = new Array(pre.length + 1).join("-");
1045
+ return pre + this.upcomingInput() + "\n" + c + "^";
1046
+ }, "showPosition"),
1047
+ // test the lexed token: return FALSE when not a match, otherwise return token
1048
+ test_match: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(match, indexed_rule) {
1049
+ var token, lines, backup;
1050
+ if (this.options.backtrack_lexer) {
1051
+ backup = {
1052
+ yylineno: this.yylineno,
1053
+ yylloc: {
1054
+ first_line: this.yylloc.first_line,
1055
+ last_line: this.last_line,
1056
+ first_column: this.yylloc.first_column,
1057
+ last_column: this.yylloc.last_column
1058
+ },
1059
+ yytext: this.yytext,
1060
+ match: this.match,
1061
+ matches: this.matches,
1062
+ matched: this.matched,
1063
+ yyleng: this.yyleng,
1064
+ offset: this.offset,
1065
+ _more: this._more,
1066
+ _input: this._input,
1067
+ yy: this.yy,
1068
+ conditionStack: this.conditionStack.slice(0),
1069
+ done: this.done
1070
+ };
1071
+ if (this.options.ranges) {
1072
+ backup.yylloc.range = this.yylloc.range.slice(0);
1073
+ }
1074
+ }
1075
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
1076
+ if (lines) {
1077
+ this.yylineno += lines.length;
1078
+ }
1079
+ this.yylloc = {
1080
+ first_line: this.yylloc.last_line,
1081
+ last_line: this.yylineno + 1,
1082
+ first_column: this.yylloc.last_column,
1083
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
1084
+ };
1085
+ this.yytext += match[0];
1086
+ this.match += match[0];
1087
+ this.matches = match;
1088
+ this.yyleng = this.yytext.length;
1089
+ if (this.options.ranges) {
1090
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
1091
+ }
1092
+ this._more = false;
1093
+ this._backtrack = false;
1094
+ this._input = this._input.slice(match[0].length);
1095
+ this.matched += match[0];
1096
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
1097
+ if (this.done && this._input) {
1098
+ this.done = false;
1099
+ }
1100
+ if (token) {
1101
+ return token;
1102
+ } else if (this._backtrack) {
1103
+ for (var k in backup) {
1104
+ this[k] = backup[k];
1105
+ }
1106
+ return false;
1107
+ }
1108
+ return false;
1109
+ }, "test_match"),
1110
+ // return next match in input
1111
+ next: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function() {
1112
+ if (this.done) {
1113
+ return this.EOF;
1114
+ }
1115
+ if (!this._input) {
1116
+ this.done = true;
1117
+ }
1118
+ var token, match, tempMatch, index;
1119
+ if (!this._more) {
1120
+ this.yytext = "";
1121
+ this.match = "";
1122
+ }
1123
+ var rules = this._currentRules();
1124
+ for (var i = 0; i < rules.length; i++) {
1125
+ tempMatch = this._input.match(this.rules[rules[i]]);
1126
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
1127
+ match = tempMatch;
1128
+ index = i;
1129
+ if (this.options.backtrack_lexer) {
1130
+ token = this.test_match(tempMatch, rules[i]);
1131
+ if (token !== false) {
1132
+ return token;
1133
+ } else if (this._backtrack) {
1134
+ match = false;
1135
+ continue;
1136
+ } else {
1137
+ return false;
1138
+ }
1139
+ } else if (!this.options.flex) {
1140
+ break;
1141
+ }
1142
+ }
1143
+ }
1144
+ if (match) {
1145
+ token = this.test_match(match, rules[index]);
1146
+ if (token !== false) {
1147
+ return token;
1148
+ }
1149
+ return false;
1150
+ }
1151
+ if (this._input === "") {
1152
+ return this.EOF;
1153
+ } else {
1154
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
1155
+ text: "",
1156
+ token: null,
1157
+ line: this.yylineno
1158
+ });
1159
+ }
1160
+ }, "next"),
1161
+ // return next match that has a token
1162
+ lex: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function lex() {
1163
+ var r = this.next();
1164
+ if (r) {
1165
+ return r;
1166
+ } else {
1167
+ return this.lex();
1168
+ }
1169
+ }, "lex"),
1170
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1171
+ begin: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function begin(condition) {
1172
+ this.conditionStack.push(condition);
1173
+ }, "begin"),
1174
+ // pop the previously active lexer condition state off the condition stack
1175
+ popState: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function popState() {
1176
+ var n = this.conditionStack.length - 1;
1177
+ if (n > 0) {
1178
+ return this.conditionStack.pop();
1179
+ } else {
1180
+ return this.conditionStack[0];
1181
+ }
1182
+ }, "popState"),
1183
+ // produce the lexer rule set which is active for the currently active lexer condition state
1184
+ _currentRules: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function _currentRules() {
1185
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
1186
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
1187
+ } else {
1188
+ return this.conditions["INITIAL"].rules;
1189
+ }
1190
+ }, "_currentRules"),
1191
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
1192
+ topState: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function topState(n) {
1193
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
1194
+ if (n >= 0) {
1195
+ return this.conditionStack[n];
1196
+ } else {
1197
+ return "INITIAL";
1198
+ }
1199
+ }, "topState"),
1200
+ // alias for begin(condition)
1201
+ pushState: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function pushState(condition) {
1202
+ this.begin(condition);
1203
+ }, "pushState"),
1204
+ // return the number of states currently on the stack
1205
+ stateStackSize: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function stateStackSize() {
1206
+ return this.conditionStack.length;
1207
+ }, "stateStackSize"),
1208
+ options: { "case-insensitive": true },
1209
+ performAction: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
1210
+ var YYSTATE = YY_START;
1211
+ switch ($avoiding_name_collisions) {
1212
+ case 0:
1213
+ this.pushState("csv");
1214
+ return 4;
1215
+ break;
1216
+ case 1:
1217
+ return 10;
1218
+ break;
1219
+ case 2:
1220
+ return 5;
1221
+ break;
1222
+ case 3:
1223
+ return 12;
1224
+ break;
1225
+ case 4:
1226
+ this.pushState("escaped_text");
1227
+ return 18;
1228
+ break;
1229
+ case 5:
1230
+ return 20;
1231
+ break;
1232
+ case 6:
1233
+ this.popState("escaped_text");
1234
+ return 18;
1235
+ break;
1236
+ case 7:
1237
+ return 19;
1238
+ break;
1239
+ }
1240
+ }, "anonymous"),
1241
+ rules: [/^(?:sankey-beta\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],
1242
+ conditions: { "csv": { "rules": [1, 2, 3, 4, 5, 6, 7], "inclusive": false }, "escaped_text": { "rules": [6, 7], "inclusive": false }, "INITIAL": { "rules": [0, 1, 2, 3, 4, 5, 6, 7], "inclusive": true } }
1243
+ };
1244
+ return lexer2;
1245
+ }();
1246
+ parser2.lexer = lexer;
1247
+ function Parser() {
1248
+ this.yy = {};
1249
+ }
1250
+ (0,chunk_S24QXQKS/* __name */.K2)(Parser, "Parser");
1251
+ Parser.prototype = parser2;
1252
+ parser2.Parser = Parser;
1253
+ return new Parser();
1254
+ }();
1255
+ parser.parser = parser;
1256
+ var sankey_default = parser;
1257
+
1258
+ // src/diagrams/sankey/sankeyDB.ts
1259
+ var links = [];
1260
+ var nodes = [];
1261
+ var nodesMap = /* @__PURE__ */ new Map();
1262
+ var clear2 = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(() => {
1263
+ links = [];
1264
+ nodes = [];
1265
+ nodesMap = /* @__PURE__ */ new Map();
1266
+ (0,chunk_S24QXQKS/* clear */.IU)();
1267
+ }, "clear");
1268
+ var SankeyLink = class {
1269
+ constructor(source, target, value = 0) {
1270
+ this.source = source;
1271
+ this.target = target;
1272
+ this.value = value;
1273
+ }
1274
+ static {
1275
+ (0,chunk_S24QXQKS/* __name */.K2)(this, "SankeyLink");
1276
+ }
1277
+ };
1278
+ var addLink = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((source, target, value) => {
1279
+ links.push(new SankeyLink(source, target, value));
1280
+ }, "addLink");
1281
+ var SankeyNode = class {
1282
+ constructor(ID) {
1283
+ this.ID = ID;
1284
+ }
1285
+ static {
1286
+ (0,chunk_S24QXQKS/* __name */.K2)(this, "SankeyNode");
1287
+ }
1288
+ };
1289
+ var findOrCreateNode = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((ID) => {
1290
+ ID = chunk_S24QXQKS/* common_default */.Y2.sanitizeText(ID, (0,chunk_S24QXQKS/* getConfig2 */.D7)());
1291
+ let node = nodesMap.get(ID);
1292
+ if (node === void 0) {
1293
+ node = new SankeyNode(ID);
1294
+ nodesMap.set(ID, node);
1295
+ nodes.push(node);
1296
+ }
1297
+ return node;
1298
+ }, "findOrCreateNode");
1299
+ var getNodes = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(() => nodes, "getNodes");
1300
+ var getLinks = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(() => links, "getLinks");
1301
+ var getGraph = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(() => ({
1302
+ nodes: nodes.map((node) => ({ id: node.ID })),
1303
+ links: links.map((link) => ({
1304
+ source: link.source.ID,
1305
+ target: link.target.ID,
1306
+ value: link.value
1307
+ }))
1308
+ }), "getGraph");
1309
+ var sankeyDB_default = {
1310
+ nodesMap,
1311
+ getConfig: /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(() => (0,chunk_S24QXQKS/* getConfig2 */.D7)().sankey, "getConfig"),
1312
+ getNodes,
1313
+ getLinks,
1314
+ getGraph,
1315
+ addLink,
1316
+ findOrCreateNode,
1317
+ getAccTitle: chunk_S24QXQKS/* getAccTitle */.iN,
1318
+ setAccTitle: chunk_S24QXQKS/* setAccTitle */.SV,
1319
+ getAccDescription: chunk_S24QXQKS/* getAccDescription */.m7,
1320
+ setAccDescription: chunk_S24QXQKS/* setAccDescription */.EI,
1321
+ getDiagramTitle: chunk_S24QXQKS/* getDiagramTitle */.ab,
1322
+ setDiagramTitle: chunk_S24QXQKS/* setDiagramTitle */.ke,
1323
+ clear: clear2
1324
+ };
1325
+
1326
+ // src/diagrams/sankey/sankeyRenderer.ts
1327
+
1328
+
1329
+
1330
+ // src/rendering-util/uid.ts
1331
+ var Uid = class _Uid {
1332
+ static {
1333
+ (0,chunk_S24QXQKS/* __name */.K2)(this, "Uid");
1334
+ }
1335
+ static {
1336
+ this.count = 0;
1337
+ }
1338
+ static next(name) {
1339
+ return new _Uid(name + ++_Uid.count);
1340
+ }
1341
+ constructor(id) {
1342
+ this.id = id;
1343
+ this.href = `#${id}`;
1344
+ }
1345
+ toString() {
1346
+ return "url(" + this.href + ")";
1347
+ }
1348
+ };
1349
+
1350
+ // src/diagrams/sankey/sankeyRenderer.ts
1351
+ var alignmentsMap = {
1352
+ left: left,
1353
+ right: right,
1354
+ center: center,
1355
+ justify: justify
1356
+ };
1357
+ var draw = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(function(text, id, _version, diagObj) {
1358
+ const { securityLevel, sankey: conf } = (0,chunk_S24QXQKS/* getConfig2 */.D7)();
1359
+ const defaultSankeyConfig = chunk_S24QXQKS/* defaultConfig2 */.ME.sankey;
1360
+ let sandboxElement;
1361
+ if (securityLevel === "sandbox") {
1362
+ sandboxElement = (0,src/* select */.Ltv)("#i" + id);
1363
+ }
1364
+ const root = securityLevel === "sandbox" ? (0,src/* select */.Ltv)(sandboxElement.nodes()[0].contentDocument.body) : (0,src/* select */.Ltv)("body");
1365
+ const svg = securityLevel === "sandbox" ? root.select(`[id="${id}"]`) : (0,src/* select */.Ltv)(`[id="${id}"]`);
1366
+ const width = conf?.width ?? defaultSankeyConfig.width;
1367
+ const height = conf?.height ?? defaultSankeyConfig.width;
1368
+ const useMaxWidth = conf?.useMaxWidth ?? defaultSankeyConfig.useMaxWidth;
1369
+ const nodeAlignment = conf?.nodeAlignment ?? defaultSankeyConfig.nodeAlignment;
1370
+ const prefix = conf?.prefix ?? defaultSankeyConfig.prefix;
1371
+ const suffix = conf?.suffix ?? defaultSankeyConfig.suffix;
1372
+ const showValues = conf?.showValues ?? defaultSankeyConfig.showValues;
1373
+ const graph = diagObj.db.getGraph();
1374
+ const nodeAlign = alignmentsMap[nodeAlignment];
1375
+ const nodeWidth = 10;
1376
+ const sankey = Sankey().nodeId((d) => d.id).nodeWidth(nodeWidth).nodePadding(10 + (showValues ? 15 : 0)).nodeAlign(nodeAlign).extent([
1377
+ [0, 0],
1378
+ [width, height]
1379
+ ]);
1380
+ sankey(graph);
1381
+ const colorScheme = (0,src/* scaleOrdinal */.UMr)(src/* schemeTableau10 */.zt);
1382
+ svg.append("g").attr("class", "nodes").selectAll(".node").data(graph.nodes).join("g").attr("class", "node").attr("id", (d) => (d.uid = Uid.next("node-")).id).attr("transform", function(d) {
1383
+ return "translate(" + d.x0 + "," + d.y0 + ")";
1384
+ }).attr("x", (d) => d.x0).attr("y", (d) => d.y0).append("rect").attr("height", (d) => {
1385
+ return d.y1 - d.y0;
1386
+ }).attr("width", (d) => d.x1 - d.x0).attr("fill", (d) => colorScheme(d.id));
1387
+ const getText = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)(({ id: id2, value }) => {
1388
+ if (!showValues) {
1389
+ return id2;
1390
+ }
1391
+ return `${id2}
1392
+ ${prefix}${Math.round(value * 100) / 100}${suffix}`;
1393
+ }, "getText");
1394
+ svg.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(graph.nodes).join("text").attr("x", (d) => d.x0 < width / 2 ? d.x1 + 6 : d.x0 - 6).attr("y", (d) => (d.y1 + d.y0) / 2).attr("dy", `${showValues ? "0" : "0.35"}em`).attr("text-anchor", (d) => d.x0 < width / 2 ? "start" : "end").text(getText);
1395
+ const link = svg.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(graph.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply");
1396
+ const linkColor = conf?.linkColor ?? "gradient";
1397
+ if (linkColor === "gradient") {
1398
+ const gradient = link.append("linearGradient").attr("id", (d) => (d.uid = Uid.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (d) => d.source.x1).attr("x2", (d) => d.target.x0);
1399
+ gradient.append("stop").attr("offset", "0%").attr("stop-color", (d) => colorScheme(d.source.id));
1400
+ gradient.append("stop").attr("offset", "100%").attr("stop-color", (d) => colorScheme(d.target.id));
1401
+ }
1402
+ let coloring;
1403
+ switch (linkColor) {
1404
+ case "gradient":
1405
+ coloring = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((d) => d.uid, "coloring");
1406
+ break;
1407
+ case "source":
1408
+ coloring = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((d) => colorScheme(d.source.id), "coloring");
1409
+ break;
1410
+ case "target":
1411
+ coloring = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((d) => colorScheme(d.target.id), "coloring");
1412
+ break;
1413
+ default:
1414
+ coloring = linkColor;
1415
+ }
1416
+ link.append("path").attr("d", sankeyLinkHorizontal()).attr("stroke", coloring).attr("stroke-width", (d) => Math.max(1, d.width));
1417
+ (0,chunk_S24QXQKS/* setupGraphViewbox */.ot)(void 0, svg, 0, useMaxWidth);
1418
+ }, "draw");
1419
+ var sankeyRenderer_default = {
1420
+ draw
1421
+ };
1422
+
1423
+ // src/diagrams/sankey/sankeyUtils.ts
1424
+ var prepareTextForParsing = /* @__PURE__ */ (0,chunk_S24QXQKS/* __name */.K2)((text) => {
1425
+ const textToParse = text.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, "\n").trim();
1426
+ return textToParse;
1427
+ }, "prepareTextForParsing");
1428
+
1429
+ // src/diagrams/sankey/sankeyDiagram.ts
1430
+ var originalParse = sankey_default.parse.bind(sankey_default);
1431
+ sankey_default.parse = (text) => originalParse(prepareTextForParsing(text));
1432
+ var diagram = {
1433
+ parser: sankey_default,
1434
+ db: sankeyDB_default,
1435
+ renderer: sankeyRenderer_default
1436
+ };
1437
+
1438
+
1439
+
1440
+ /***/ })
1441
+
1442
+ };
1443
+ ;