vue-data-ui 3.9.3 → 3.9.5
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.
- package/README.md +1 -1
- package/dist/{PackageVersion-Cx3U3jgV.js → PackageVersion-BuFi5-eQ.js} +1 -1
- package/dist/{Title-Bf2WqM40.js → Title-BMp0dt6A.js} +1 -1
- package/dist/components/vue-ui-3d-bar.js +1 -1
- package/dist/components/vue-ui-accordion.js +1 -1
- package/dist/components/vue-ui-age-pyramid.js +1 -1
- package/dist/components/vue-ui-annotator.js +1 -1
- package/dist/components/vue-ui-bullet.js +1 -1
- package/dist/components/vue-ui-candlestick.js +1 -1
- package/dist/components/vue-ui-carousel-table.js +1 -1
- package/dist/components/vue-ui-chestnut.js +1 -1
- package/dist/components/vue-ui-chord.js +1 -1
- package/dist/components/vue-ui-circle-pack.js +1 -1
- package/dist/components/vue-ui-cursor.js +1 -1
- package/dist/components/vue-ui-dag.js +1 -1
- package/dist/components/vue-ui-dashboard.js +1 -1
- package/dist/components/vue-ui-digits.js +1 -1
- package/dist/components/vue-ui-donut-evolution.js +1 -1
- package/dist/components/vue-ui-donut.js +1 -1
- package/dist/components/vue-ui-dumbbell.js +1 -1
- package/dist/components/vue-ui-flow.js +1 -1
- package/dist/components/vue-ui-funnel.js +1 -1
- package/dist/components/vue-ui-galaxy.js +1 -1
- package/dist/components/vue-ui-gauge.js +1 -1
- package/dist/components/vue-ui-geo.js +1 -1
- package/dist/components/vue-ui-gizmo.js +1 -1
- package/dist/components/vue-ui-heatmap.js +1 -1
- package/dist/components/vue-ui-history-plot.js +1 -1
- package/dist/components/vue-ui-horizontal-bar.js +1 -1
- package/dist/components/vue-ui-kpi.js +1 -1
- package/dist/components/vue-ui-mini-loader.js +1 -1
- package/dist/components/vue-ui-molecule.js +1 -1
- package/dist/components/vue-ui-mood-radar.js +1 -1
- package/dist/components/vue-ui-nested-donuts.js +1 -1
- package/dist/components/vue-ui-onion.js +1 -1
- package/dist/components/vue-ui-parallel-coordinate-plot.js +1 -1
- package/dist/components/vue-ui-quadrant.js +1 -1
- package/dist/components/vue-ui-quick-chart.js +1 -1
- package/dist/components/vue-ui-radar.js +1 -1
- package/dist/components/vue-ui-rating.js +1 -1
- package/dist/components/vue-ui-relation-circle.js +1 -1
- package/dist/components/vue-ui-ridgeline.js +1 -1
- package/dist/components/vue-ui-rings.js +1 -1
- package/dist/components/vue-ui-scatter.js +1 -1
- package/dist/components/vue-ui-skeleton.js +1 -1
- package/dist/components/vue-ui-smiley.js +1 -1
- package/dist/components/vue-ui-spark-trend.js +1 -1
- package/dist/components/vue-ui-sparkbar.js +1 -1
- package/dist/components/vue-ui-sparkgauge.js +1 -1
- package/dist/components/vue-ui-sparkhistogram.js +1 -1
- package/dist/components/vue-ui-sparkline.js +1 -1
- package/dist/components/vue-ui-sparkstackbar.js +1 -1
- package/dist/components/vue-ui-stackbar.js +1 -1
- package/dist/components/vue-ui-stackline.js +1 -1
- package/dist/components/vue-ui-strip-plot.js +1 -1
- package/dist/components/vue-ui-table-heatmap.js +1 -1
- package/dist/components/vue-ui-table-sparkline.js +1 -1
- package/dist/components/vue-ui-table.js +1 -1
- package/dist/components/vue-ui-thermometer.js +1 -1
- package/dist/components/vue-ui-timer.js +1 -1
- package/dist/components/vue-ui-tiremarks.js +1 -1
- package/dist/components/vue-ui-treemap.js +1 -1
- package/dist/components/vue-ui-vertical-bar.js +1 -1
- package/dist/components/vue-ui-waffle.js +1 -1
- package/dist/components/vue-ui-wheel.js +1 -1
- package/dist/components/vue-ui-word-cloud.js +1 -1
- package/dist/components/vue-ui-world.js +1 -1
- package/dist/components/vue-ui-xy-canvas.js +1 -1
- package/dist/components/vue-ui-xy.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/vue-data-ui.d.ts +17 -0
- package/dist/{useNestedProp-DjZhR3_5.js → useNestedProp-QQOzuoZs.js} +12 -1
- package/dist/{vue-data-ui-B7Axn7yb.js → vue-data-ui-CC8h6-5j.js} +66 -66
- package/dist/vue-data-ui.js +68 -68
- package/dist/{vue-ui-3d-bar-BW-lnKGl.js → vue-ui-3d-bar-BqtUIpkf.js} +3 -3
- package/dist/{vue-ui-accordion-BbkkniuF.js → vue-ui-accordion-BoVGnqPH.js} +1 -1
- package/dist/{vue-ui-age-pyramid-D3wuUYw9.js → vue-ui-age-pyramid-D9hs8ZQK.js} +3 -3
- package/dist/{vue-ui-annotator-BNTBBxok.js → vue-ui-annotator-C9VXlkjo.js} +2 -2
- package/dist/{vue-ui-bullet-D6eDCcCM.js → vue-ui-bullet-C0kz8F_R.js} +119 -119
- package/dist/{vue-ui-candlestick-DnDsrru6.js → vue-ui-candlestick-2CyhDt9g.js} +3 -3
- package/dist/{vue-ui-carousel-table-CSnQrLGZ.js → vue-ui-carousel-table-CA3ANfSk.js} +2 -2
- package/dist/{vue-ui-chestnut-CNeF97-x.js → vue-ui-chestnut-C4ooqhXs.js} +2 -2
- package/dist/{vue-ui-chord-IHMYgU6P.js → vue-ui-chord-DpIBRX8P.js} +3 -3
- package/dist/{vue-ui-circle-pack-CX-PKwMX.js → vue-ui-circle-pack-BA8WoFCi.js} +3 -3
- package/dist/{vue-ui-cursor-DttTxd7y.js → vue-ui-cursor-C1l2fB5p.js} +2 -2
- package/dist/vue-ui-dag-KU8FP5pZ.js +2796 -0
- package/dist/{vue-ui-dashboard-Diw4ce8Q.js → vue-ui-dashboard-7x6OpPrj.js} +64 -64
- package/dist/{vue-ui-digits-SXDDgXdv.js → vue-ui-digits-DSLZBEPr.js} +1 -1
- package/dist/{vue-ui-donut-C5YmHwzL.js → vue-ui-donut-CZwS1QdB.js} +3 -3
- package/dist/{vue-ui-donut-evolution-DDj2bBEY.js → vue-ui-donut-evolution-ZcADRKLf.js} +3 -3
- package/dist/{vue-ui-dumbbell-CL2zfaa9.js → vue-ui-dumbbell-D31jdjR7.js} +3 -3
- package/dist/{vue-ui-flow-B9AhZW00.js → vue-ui-flow-D6FXUjgo.js} +3 -3
- package/dist/{vue-ui-funnel-BfEAIZTb.js → vue-ui-funnel-_UBqcaw8.js} +3 -3
- package/dist/{vue-ui-galaxy-YKJJZuMK.js → vue-ui-galaxy-DPjq9BU4.js} +3 -3
- package/dist/{vue-ui-gauge-CZq9JsEo.js → vue-ui-gauge-DBLXhBf4.js} +3 -3
- package/dist/{vue-ui-geo-B6PyEQr0.js → vue-ui-geo-DQMaNUyA.js} +3 -3
- package/dist/{vue-ui-gizmo-HUo5_TOP.js → vue-ui-gizmo-BQ0V962i.js} +2 -2
- package/dist/{vue-ui-heatmap-J8KhjPqj.js → vue-ui-heatmap-vQvgO3Jd.js} +4 -4
- package/dist/{vue-ui-history-plot-C5kQV6LA.js → vue-ui-history-plot-BqxtOo3I.js} +3 -3
- package/dist/{vue-ui-horizontal-bar-B7xXn1ex.js → vue-ui-horizontal-bar-B-Xv-e_t.js} +4 -4
- package/dist/{vue-ui-kpi-P-XmbJWS.js → vue-ui-kpi-PnKb1U7i.js} +2 -2
- package/dist/{vue-ui-mini-loader-Ba1L_dXD.js → vue-ui-mini-loader-BEhetSQy.js} +1 -1
- package/dist/{vue-ui-molecule-CZmwGy3H.js → vue-ui-molecule-Cj25eSBt.js} +2 -2
- package/dist/{vue-ui-mood-radar-BHuAyycM.js → vue-ui-mood-radar-DSOjVYUj.js} +3 -3
- package/dist/{vue-ui-nested-donuts-nNoaEbow.js → vue-ui-nested-donuts-DN5leHW-.js} +3 -3
- package/dist/{vue-ui-onion-BshL66Mw.js → vue-ui-onion-CEJpwyyw.js} +3 -3
- package/dist/{vue-ui-parallel-coordinate-plot-CJ3kM13A.js → vue-ui-parallel-coordinate-plot-DugOv0JC.js} +3 -3
- package/dist/{vue-ui-quadrant-Dy1Jv-kw.js → vue-ui-quadrant-DuDyJMpD.js} +3 -3
- package/dist/{vue-ui-quick-chart-BbboXq-a.js → vue-ui-quick-chart-BV4tJOaV.js} +2 -2
- package/dist/{vue-ui-radar-B5hEh8N4.js → vue-ui-radar-DCOxntLw.js} +3 -3
- package/dist/{vue-ui-rating-Dz4fQoXn.js → vue-ui-rating-B4fQmjIS.js} +1 -1
- package/dist/{vue-ui-relation-circle-B0_y669X.js → vue-ui-relation-circle-C8FlmFhP.js} +3 -3
- package/dist/{vue-ui-ridgeline-BI0y8eXQ.js → vue-ui-ridgeline-Cc4NpIdn.js} +3 -3
- package/dist/{vue-ui-rings-DrUtCdK6.js → vue-ui-rings-thRs8cAb.js} +3 -3
- package/dist/{vue-ui-scatter-RNbQn_9g.js → vue-ui-scatter-DT0OYCnc.js} +3 -3
- package/dist/{vue-ui-skeleton-CC8Hpc0I.js → vue-ui-skeleton-BscRFRSG.js} +2 -2
- package/dist/{vue-ui-smiley-sVz4LzSA.js → vue-ui-smiley-CFNQSDEF.js} +1 -1
- package/dist/{vue-ui-spark-trend-rmjin0iU.js → vue-ui-spark-trend-BwEXIKf4.js} +2 -2
- package/dist/{vue-ui-sparkbar-CLH2uuJe.js → vue-ui-sparkbar-C-L4ZLQI.js} +2 -2
- package/dist/{vue-ui-sparkgauge-CoJpHwni.js → vue-ui-sparkgauge-CY9kWxnz.js} +2 -2
- package/dist/{vue-ui-sparkhistogram-Q3jR_iUb.js → vue-ui-sparkhistogram-D13VzeeT.js} +2 -2
- package/dist/{vue-ui-sparkline-cvuMrbcv.js → vue-ui-sparkline-BuHRSYbt.js} +2 -2
- package/dist/{vue-ui-sparkstackbar-DPJL9KSc.js → vue-ui-sparkstackbar-CnQCbwMB.js} +2 -2
- package/dist/{vue-ui-stackbar-CFXVCz6S.js → vue-ui-stackbar-Cl5BKYmC.js} +3 -3
- package/dist/{vue-ui-stackline-DK7j5aaa.js → vue-ui-stackline-BR8H9SOw.js} +3 -3
- package/dist/{vue-ui-strip-plot-DTpf71XO.js → vue-ui-strip-plot-CukKW4RC.js} +3 -3
- package/dist/{vue-ui-table-C3f-J0L6.js → vue-ui-table-BRiGet5p.js} +3 -3
- package/dist/{vue-ui-table-heatmap-7lER15Z2.js → vue-ui-table-heatmap-DNfOy5vg.js} +1 -1
- package/dist/{vue-ui-table-sparkline-CLNhjUOy.js → vue-ui-table-sparkline-BPW0z_z_.js} +2 -2
- package/dist/{vue-ui-thermometer-rEu0nnWc.js → vue-ui-thermometer-DLUyiRGK.js} +3 -3
- package/dist/{vue-ui-timer-CTuT13zQ.js → vue-ui-timer-CKJbLkNv.js} +3 -3
- package/dist/{vue-ui-tiremarks-CxfGnFGL.js → vue-ui-tiremarks-F0mqJsmF.js} +3 -3
- package/dist/{vue-ui-treemap-DU8_UnvP.js → vue-ui-treemap-BLvGu7lx.js} +3 -3
- package/dist/{vue-ui-waffle-CCTw3K5R.js → vue-ui-waffle-B5FH0bcJ.js} +3 -3
- package/dist/{vue-ui-wheel-DwmBHPVq.js → vue-ui-wheel-zam8y1UD.js} +3 -3
- package/dist/{vue-ui-word-cloud-ByIMPclD.js → vue-ui-word-cloud-CZTtw4xK.js} +3 -3
- package/dist/{vue-ui-world-Cvrw9DCl.js → vue-ui-world--ONnm3rc.js} +2 -2
- package/dist/{vue-ui-xy-canvas-C1ZHlQ3Y.js → vue-ui-xy-canvas-B3oRqTH1.js} +3 -3
- package/dist/{vue-ui-xy-CMBkDzNs.js → vue-ui-xy-cv9Kh3M3.js} +4 -4
- package/package.json +1 -1
- package/dist/vue-ui-dag-BMXgf925.js +0 -2687
|
@@ -0,0 +1,2796 @@
|
|
|
1
|
+
import { ref as y, watchEffect as rn, unref as v, defineAsyncComponent as et, toRefs as an, computed as H, onMounted as It, nextTick as Ne, watch as Ae, onBeforeUnmount as Gt, createElementBlock as x, openBlock as C, normalizeStyle as le, normalizeClass as jt, createCommentVNode as L, createBlock as te, createVNode as tt, toDisplayString as Se, withCtx as $, renderSlot as M, normalizeProps as z, guardReactiveProps as V, createSlots as ln, createElementVNode as K, Fragment as me, renderList as Be, withModifiers as cn, mergeProps as ot, createTextVNode as un, Transition as Wt, Teleport as Yt } from "vue";
|
|
2
|
+
import { c as ut, az as dn, t as fn, o as hn, g as Ht, l as Ut, X as mn, a9 as gn } from "./lib-_nVZfi2t.js";
|
|
3
|
+
import { t as vn, u as pn } from "./useResponsive-DfdjqQps.js";
|
|
4
|
+
import { u as bn } from "./usePanZoom-CDF7rb3o.js";
|
|
5
|
+
import { u as wn, a as nt } from "./useNestedProp-QQOzuoZs.js";
|
|
6
|
+
import { u as yn, B as kn } from "./BaseScanner-BMpwQAfz.js";
|
|
7
|
+
import { u as En } from "./usePrinter-DXIMGR61.js";
|
|
8
|
+
import { u as Cn } from "./useSvgExport-DrjCWun4.js";
|
|
9
|
+
import { u as _n } from "./useThemeCheck-DGJ31Vi5.js";
|
|
10
|
+
import { u as xn } from "./useUserOptionState-BIvW1Kz7.js";
|
|
11
|
+
import { u as Nn } from "./useChartAccessibility-9icAAmYg.js";
|
|
12
|
+
import An from "./Title-BMp0dt6A.js";
|
|
13
|
+
import { B as Zt } from "./BaseZoomControls-gNf811C7.js";
|
|
14
|
+
import Sn from "./img-C5q4A7ke.js";
|
|
15
|
+
import { _ as Ln } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
16
|
+
const Mn = "\0", ce = "\0", Xt = "";
|
|
17
|
+
class oe {
|
|
18
|
+
_isDirected = !0;
|
|
19
|
+
_isMultigraph = !1;
|
|
20
|
+
_isCompound = !1;
|
|
21
|
+
// Label for the graph itself
|
|
22
|
+
_label;
|
|
23
|
+
// Defaults to be set when creating a new node
|
|
24
|
+
_defaultNodeLabelFn = () => {
|
|
25
|
+
};
|
|
26
|
+
// Defaults to be set when creating a new edge
|
|
27
|
+
_defaultEdgeLabelFn = () => {
|
|
28
|
+
};
|
|
29
|
+
// v -> label
|
|
30
|
+
_nodes = {};
|
|
31
|
+
// v -> edgeObj
|
|
32
|
+
_in = {};
|
|
33
|
+
// u -> v -> Number
|
|
34
|
+
_preds = {};
|
|
35
|
+
// v -> edgeObj
|
|
36
|
+
_out = {};
|
|
37
|
+
// v -> w -> Number
|
|
38
|
+
_sucs = {};
|
|
39
|
+
// e -> edgeObj
|
|
40
|
+
_edgeObjs = {};
|
|
41
|
+
// e -> label
|
|
42
|
+
_edgeLabels = {};
|
|
43
|
+
/* Number of nodes in the graph. Should only be changed by the implementation. */
|
|
44
|
+
_nodeCount = 0;
|
|
45
|
+
/* Number of edges in the graph. Should only be changed by the implementation. */
|
|
46
|
+
_edgeCount = 0;
|
|
47
|
+
_parent;
|
|
48
|
+
_children;
|
|
49
|
+
constructor(t) {
|
|
50
|
+
t && (this._isDirected = Object.hasOwn(t, "directed") ? t.directed : !0, this._isMultigraph = Object.hasOwn(t, "multigraph") ? t.multigraph : !1, this._isCompound = Object.hasOwn(t, "compound") ? t.compound : !1), this._isCompound && (this._parent = {}, this._children = {}, this._children[ce] = {});
|
|
51
|
+
}
|
|
52
|
+
/* === Graph functions ========= */
|
|
53
|
+
/**
|
|
54
|
+
* Whether graph was created with 'directed' flag set to true or not.
|
|
55
|
+
*/
|
|
56
|
+
isDirected() {
|
|
57
|
+
return this._isDirected;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether graph was created with 'multigraph' flag set to true or not.
|
|
61
|
+
*/
|
|
62
|
+
isMultigraph() {
|
|
63
|
+
return this._isMultigraph;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Whether graph was created with 'compound' flag set to true or not.
|
|
67
|
+
*/
|
|
68
|
+
isCompound() {
|
|
69
|
+
return this._isCompound;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets the label of the graph.
|
|
73
|
+
*/
|
|
74
|
+
setGraph(t) {
|
|
75
|
+
return this._label = t, this;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets the graph label.
|
|
79
|
+
*/
|
|
80
|
+
graph() {
|
|
81
|
+
return this._label;
|
|
82
|
+
}
|
|
83
|
+
/* === Node functions ========== */
|
|
84
|
+
/**
|
|
85
|
+
* Sets the default node label. If newDefault is a function, it will be
|
|
86
|
+
* invoked each time when setting a label for a node. Otherwise, this label
|
|
87
|
+
* will be assigned as default label in case if no label was specified while
|
|
88
|
+
* setting a node.
|
|
89
|
+
* Complexity: O(1).
|
|
90
|
+
*/
|
|
91
|
+
setDefaultNodeLabel(t) {
|
|
92
|
+
return this._defaultNodeLabelFn = t, typeof t != "function" && (this._defaultNodeLabelFn = () => t), this;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Gets the number of nodes in the graph.
|
|
96
|
+
* Complexity: O(1).
|
|
97
|
+
*/
|
|
98
|
+
nodeCount() {
|
|
99
|
+
return this._nodeCount;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Gets all nodes of the graph. Note, the in case of compound graph subnodes are
|
|
103
|
+
* not included in list.
|
|
104
|
+
* Complexity: O(1).
|
|
105
|
+
*/
|
|
106
|
+
nodes() {
|
|
107
|
+
return Object.keys(this._nodes);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Gets list of nodes without in-edges.
|
|
111
|
+
* Complexity: O(|V|).
|
|
112
|
+
*/
|
|
113
|
+
sources() {
|
|
114
|
+
const t = this;
|
|
115
|
+
return this.nodes().filter((o) => Object.keys(t._in[o]).length === 0);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets list of nodes without out-edges.
|
|
119
|
+
* Complexity: O(|V|).
|
|
120
|
+
*/
|
|
121
|
+
sinks() {
|
|
122
|
+
const t = this;
|
|
123
|
+
return this.nodes().filter((o) => Object.keys(t._out[o]).length === 0);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Invokes setNode method for each node in names list.
|
|
127
|
+
* Complexity: O(|names|).
|
|
128
|
+
*/
|
|
129
|
+
setNodes(t, o) {
|
|
130
|
+
const n = arguments, s = this;
|
|
131
|
+
return t.forEach((i) => {
|
|
132
|
+
n.length > 1 ? s.setNode(i, o) : s.setNode(i);
|
|
133
|
+
}), this;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Creates or updates the value for the node v in the graph. If value is supplied
|
|
137
|
+
* it is set as the value for the node. If value is not supplied and the node was
|
|
138
|
+
* created by this call then the default node label will be assigned.
|
|
139
|
+
* Complexity: O(1).
|
|
140
|
+
*/
|
|
141
|
+
setNode(t, o) {
|
|
142
|
+
return Object.hasOwn(this._nodes, t) ? (arguments.length > 1 && (this._nodes[t] = o), this) : (this._nodes[t] = arguments.length > 1 ? o : this._defaultNodeLabelFn(t), this._isCompound && (this._parent[t] = ce, this._children[t] = {}, this._children[ce][t] = !0), this._in[t] = {}, this._preds[t] = {}, this._out[t] = {}, this._sucs[t] = {}, ++this._nodeCount, this);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Gets the label of node with specified name.
|
|
146
|
+
* Complexity: O(1).
|
|
147
|
+
*/
|
|
148
|
+
node(t) {
|
|
149
|
+
return this._nodes[t];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Detects whether graph has a node with specified name or not.
|
|
153
|
+
*/
|
|
154
|
+
hasNode(t) {
|
|
155
|
+
return Object.hasOwn(this._nodes, t);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Remove the node with the name from the graph or do nothing if the node is not in
|
|
159
|
+
* the graph. If the node was removed this function also removes any incident
|
|
160
|
+
* edges.
|
|
161
|
+
* Complexity: O(1).
|
|
162
|
+
*/
|
|
163
|
+
removeNode(t) {
|
|
164
|
+
const o = this;
|
|
165
|
+
if (Object.hasOwn(this._nodes, t)) {
|
|
166
|
+
const n = (s) => o.removeEdge(o._edgeObjs[s]);
|
|
167
|
+
delete this._nodes[t], this._isCompound && (this._removeFromParentsChildList(t), delete this._parent[t], this.children(t).forEach((s) => {
|
|
168
|
+
o.setParent(s);
|
|
169
|
+
}), delete this._children[t]), Object.keys(this._in[t]).forEach(n), delete this._in[t], delete this._preds[t], Object.keys(this._out[t]).forEach(n), delete this._out[t], delete this._sucs[t], --this._nodeCount;
|
|
170
|
+
}
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Sets node parentId as a parent for node nodeId if it is defined, or removes the
|
|
175
|
+
* parent for nodeId if parentId is undefined. Method throws an exception in case of
|
|
176
|
+
* invoking it in context of noncompound graph.
|
|
177
|
+
* Average-case complexity: O(1).
|
|
178
|
+
*/
|
|
179
|
+
setParent(t, o) {
|
|
180
|
+
if (!this._isCompound)
|
|
181
|
+
throw new Error("Cannot set parent in a non-compound graph");
|
|
182
|
+
if (o === void 0)
|
|
183
|
+
o = ce;
|
|
184
|
+
else {
|
|
185
|
+
o += "";
|
|
186
|
+
for (let n = o; n !== void 0; n = this.parent(n))
|
|
187
|
+
if (n === t)
|
|
188
|
+
throw new Error(
|
|
189
|
+
"Setting " + o + " as parent of " + t + " would create a cycle"
|
|
190
|
+
);
|
|
191
|
+
this.setNode(o);
|
|
192
|
+
}
|
|
193
|
+
return this.setNode(t), this._removeFromParentsChildList(t), this._parent[t] = o, this._children[o][t] = !0, this;
|
|
194
|
+
}
|
|
195
|
+
_removeFromParentsChildList(t) {
|
|
196
|
+
delete this._children[this._parent[t]][t];
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Gets parent node for node nodeId.
|
|
200
|
+
* Complexity: O(1).
|
|
201
|
+
*/
|
|
202
|
+
parent(t) {
|
|
203
|
+
if (this._isCompound) {
|
|
204
|
+
const o = this._parent[t];
|
|
205
|
+
if (o !== ce)
|
|
206
|
+
return o;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Gets list of direct children of node nodeId.
|
|
211
|
+
* Complexity: O(1).
|
|
212
|
+
*/
|
|
213
|
+
children(t = ce) {
|
|
214
|
+
if (this._isCompound) {
|
|
215
|
+
const o = this._children[t];
|
|
216
|
+
if (o)
|
|
217
|
+
return Object.keys(o);
|
|
218
|
+
} else {
|
|
219
|
+
if (t === ce)
|
|
220
|
+
return this.nodes();
|
|
221
|
+
if (this.hasNode(t))
|
|
222
|
+
return [];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Return all nodes that are predecessors of the specified node or undefined if nodeId is not in
|
|
227
|
+
* the graph. Behavior is undefined for undirected graphs - use neighbors instead.
|
|
228
|
+
* Complexity: O(|V|).
|
|
229
|
+
*/
|
|
230
|
+
predecessors(t) {
|
|
231
|
+
const o = this._preds[t];
|
|
232
|
+
if (o)
|
|
233
|
+
return Object.keys(o);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Return all nodes that are successors of the specified node or undefined if nodeId is not in
|
|
237
|
+
* the graph. Behavior is undefined for undirected graphs - use neighbors instead.
|
|
238
|
+
* Complexity: O(|V|).
|
|
239
|
+
*/
|
|
240
|
+
successors(t) {
|
|
241
|
+
const o = this._sucs[t];
|
|
242
|
+
if (o)
|
|
243
|
+
return Object.keys(o);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Return all nodes that are predecessors or successors of the specified node or undefined if
|
|
247
|
+
* nodeId is not in the graph.
|
|
248
|
+
* Complexity: O(|V|).
|
|
249
|
+
*/
|
|
250
|
+
neighbors(t) {
|
|
251
|
+
const o = this.predecessors(t);
|
|
252
|
+
if (o) {
|
|
253
|
+
const n = new Set(o);
|
|
254
|
+
for (const s of this.successors(t))
|
|
255
|
+
n.add(s);
|
|
256
|
+
return Array.from(n.values());
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
isLeaf(t) {
|
|
260
|
+
let o;
|
|
261
|
+
return this.isDirected() ? o = this.successors(t) : o = this.neighbors(t), o.length === 0;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Creates new graph with nodes filtered via filter. Edges incident to rejected node
|
|
265
|
+
* are also removed. In case of compound graph, if parent is rejected by filter,
|
|
266
|
+
* then all its children are rejected too.
|
|
267
|
+
* Average-case complexity: O(|E|+|V|).
|
|
268
|
+
*/
|
|
269
|
+
filterNodes(t) {
|
|
270
|
+
const o = new this.constructor({
|
|
271
|
+
directed: this._isDirected,
|
|
272
|
+
multigraph: this._isMultigraph,
|
|
273
|
+
compound: this._isCompound
|
|
274
|
+
});
|
|
275
|
+
o.setGraph(this.graph());
|
|
276
|
+
const n = this;
|
|
277
|
+
Object.entries(this._nodes).forEach(([r, a]) => {
|
|
278
|
+
t(r) && o.setNode(r, a);
|
|
279
|
+
}), Object.values(this._edgeObjs).forEach((r) => {
|
|
280
|
+
o.hasNode(r.v) && o.hasNode(r.w) && o.setEdge(r, n.edge(r));
|
|
281
|
+
});
|
|
282
|
+
const s = {};
|
|
283
|
+
function i(r) {
|
|
284
|
+
const a = n.parent(r);
|
|
285
|
+
return a === void 0 || o.hasNode(a) ? (s[r] = a, a) : a in s ? s[a] : i(a);
|
|
286
|
+
}
|
|
287
|
+
return this._isCompound && o.nodes().forEach((r) => o.setParent(r, i(r))), o;
|
|
288
|
+
}
|
|
289
|
+
/* === Edge functions ========== */
|
|
290
|
+
/**
|
|
291
|
+
* Sets the default edge label or factory function. This label will be
|
|
292
|
+
* assigned as default label in case if no label was specified while setting
|
|
293
|
+
* an edge or this function will be invoked each time when setting an edge
|
|
294
|
+
* with no label specified and returned value will be used as a label for edge.
|
|
295
|
+
* Complexity: O(1).
|
|
296
|
+
*/
|
|
297
|
+
setDefaultEdgeLabel(t) {
|
|
298
|
+
return this._defaultEdgeLabelFn = t, typeof t != "function" && (this._defaultEdgeLabelFn = () => t), this;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Gets the number of edges in the graph.
|
|
302
|
+
* Complexity: O(1).
|
|
303
|
+
*/
|
|
304
|
+
edgeCount() {
|
|
305
|
+
return this._edgeCount;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Gets edges of the graph. In case of compound graph subgraphs are not considered.
|
|
309
|
+
* Complexity: O(|E|).
|
|
310
|
+
*/
|
|
311
|
+
edges() {
|
|
312
|
+
return Object.values(this._edgeObjs);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Establish an edges path over the nodes in nodeIds list. If some edge already
|
|
316
|
+
* exists, it will update its label, otherwise it will create an edge between pair
|
|
317
|
+
* of nodes with label provided or default label if no label provided.
|
|
318
|
+
* Complexity: O(|nodeIds|).
|
|
319
|
+
*/
|
|
320
|
+
setPath(t, o) {
|
|
321
|
+
const n = this, s = arguments;
|
|
322
|
+
return t.reduce((i, r) => (s.length > 1 ? n.setEdge(i, r, o) : n.setEdge(i, r), r)), this;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Creates or updates the label for the edge (v, w) with the optionally supplied
|
|
326
|
+
* name. If value is supplied it is set as the value for the edge. If value is not
|
|
327
|
+
* supplied and the edge was created by this call then the default edge label will
|
|
328
|
+
* be assigned. The name parameter is only useful with multigraphs.
|
|
329
|
+
*/
|
|
330
|
+
setEdge() {
|
|
331
|
+
let t, o, n, s, i = !1;
|
|
332
|
+
const r = arguments[0];
|
|
333
|
+
typeof r == "object" && r !== null && "v" in r ? (t = r.v, o = r.w, n = r.name, arguments.length === 2 && (s = arguments[1], i = !0)) : (t = r, o = arguments[1], n = arguments[3], arguments.length > 2 && (s = arguments[2], i = !0)), t = "" + t, o = "" + o, n !== void 0 && (n = "" + n);
|
|
334
|
+
let a = Le(this._isDirected, t, o, n);
|
|
335
|
+
if (Object.hasOwn(this._edgeLabels, a))
|
|
336
|
+
return i && (this._edgeLabels[a] = s), this;
|
|
337
|
+
if (n !== void 0 && !this._isMultigraph)
|
|
338
|
+
throw new Error("Cannot set a named edge when isMultigraph = false");
|
|
339
|
+
this.setNode(t), this.setNode(o), this._edgeLabels[a] = i ? s : this._defaultEdgeLabelFn(t, o, n);
|
|
340
|
+
const l = On(this._isDirected, t, o, n);
|
|
341
|
+
return t = l.v, o = l.w, Object.freeze(l), this._edgeObjs[a] = l, qt(this._preds[o], t), qt(this._sucs[t], o), this._in[o][a] = l, this._out[t][a] = l, this._edgeCount++, this;
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Gets the label for the specified edge.
|
|
345
|
+
* Complexity: O(1).
|
|
346
|
+
*/
|
|
347
|
+
edge(t, o, n) {
|
|
348
|
+
const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Le(this._isDirected, t, o, n);
|
|
349
|
+
return this._edgeLabels[s];
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Gets the label for the specified edge and converts it to an object.
|
|
353
|
+
* Complexity: O(1)
|
|
354
|
+
*/
|
|
355
|
+
edgeAsObj() {
|
|
356
|
+
const t = this.edge(...arguments);
|
|
357
|
+
return typeof t != "object" ? { label: t } : t;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Detects whether the graph contains specified edge or not. No subgraphs are considered.
|
|
361
|
+
* Complexity: O(1).
|
|
362
|
+
*/
|
|
363
|
+
hasEdge(t, o, n) {
|
|
364
|
+
const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Le(this._isDirected, t, o, n);
|
|
365
|
+
return Object.hasOwn(this._edgeLabels, s);
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Removes the specified edge from the graph. No subgraphs are considered.
|
|
369
|
+
* Complexity: O(1).
|
|
370
|
+
*/
|
|
371
|
+
removeEdge(t, o, n) {
|
|
372
|
+
const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Le(this._isDirected, t, o, n), i = this._edgeObjs[s];
|
|
373
|
+
return i && (t = i.v, o = i.w, delete this._edgeLabels[s], delete this._edgeObjs[s], Kt(this._preds[o], t), Kt(this._sucs[t], o), delete this._in[o][s], delete this._out[t][s], this._edgeCount--), this;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Return all edges that point to the node v. Optionally filters those edges down to just those
|
|
377
|
+
* coming from node u. Behavior is undefined for undirected graphs - use nodeEdges instead.
|
|
378
|
+
* Complexity: O(|E|).
|
|
379
|
+
*/
|
|
380
|
+
inEdges(t, o) {
|
|
381
|
+
const n = this._in[t];
|
|
382
|
+
if (n) {
|
|
383
|
+
const s = Object.values(n);
|
|
384
|
+
return o ? s.filter((i) => i.v === o) : s;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Return all edges that are pointed at by node v. Optionally filters those edges down to just
|
|
389
|
+
* those pointing to w. Behavior is undefined for undirected graphs - use nodeEdges instead.
|
|
390
|
+
* Complexity: O(|E|).
|
|
391
|
+
*/
|
|
392
|
+
outEdges(t, o) {
|
|
393
|
+
const n = this._out[t];
|
|
394
|
+
if (n) {
|
|
395
|
+
const s = Object.values(n);
|
|
396
|
+
return o ? s.filter((i) => i.w === o) : s;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Returns all edges to or from node v regardless of direction. Optionally filters those edges
|
|
401
|
+
* down to just those between nodes v and w regardless of direction.
|
|
402
|
+
* Complexity: O(|E|).
|
|
403
|
+
*/
|
|
404
|
+
nodeEdges(t, o) {
|
|
405
|
+
const n = this.inEdges(t, o);
|
|
406
|
+
if (n)
|
|
407
|
+
return n.concat(this.outEdges(t, o));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function qt(e, t) {
|
|
411
|
+
e[t] ? e[t]++ : e[t] = 1;
|
|
412
|
+
}
|
|
413
|
+
function Kt(e, t) {
|
|
414
|
+
--e[t] || delete e[t];
|
|
415
|
+
}
|
|
416
|
+
function Le(e, t, o, n) {
|
|
417
|
+
let s = "" + t, i = "" + o;
|
|
418
|
+
if (!e && s > i) {
|
|
419
|
+
const r = s;
|
|
420
|
+
s = i, i = r;
|
|
421
|
+
}
|
|
422
|
+
return s + Xt + i + Xt + (n === void 0 ? Mn : n);
|
|
423
|
+
}
|
|
424
|
+
function On(e, t, o, n) {
|
|
425
|
+
let s = "" + t, i = "" + o;
|
|
426
|
+
if (!e && s > i) {
|
|
427
|
+
const a = s;
|
|
428
|
+
s = i, i = a;
|
|
429
|
+
}
|
|
430
|
+
const r = { v: s, w: i };
|
|
431
|
+
return n && (r.name = n), r;
|
|
432
|
+
}
|
|
433
|
+
function st(e, t) {
|
|
434
|
+
return Le(e, t.v, t.w, t.name);
|
|
435
|
+
}
|
|
436
|
+
class Dn {
|
|
437
|
+
constructor() {
|
|
438
|
+
const t = {};
|
|
439
|
+
t._next = t._prev = t, this._sentinel = t;
|
|
440
|
+
}
|
|
441
|
+
dequeue() {
|
|
442
|
+
const t = this._sentinel, o = t._prev;
|
|
443
|
+
if (o !== t)
|
|
444
|
+
return Jt(o), o;
|
|
445
|
+
}
|
|
446
|
+
enqueue(t) {
|
|
447
|
+
const o = this._sentinel;
|
|
448
|
+
t._prev && t._next && Jt(t), t._next = o._next, o._next._prev = t, o._next = t, t._prev = o;
|
|
449
|
+
}
|
|
450
|
+
toString() {
|
|
451
|
+
const t = [], o = this._sentinel;
|
|
452
|
+
let n = o._prev;
|
|
453
|
+
for (; n !== o; )
|
|
454
|
+
t.push(JSON.stringify(n, Rn)), n = n._prev;
|
|
455
|
+
return "[" + t.join(", ") + "]";
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
function Jt(e) {
|
|
459
|
+
e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
|
|
460
|
+
}
|
|
461
|
+
function Rn(e, t) {
|
|
462
|
+
if (e !== "_next" && e !== "_prev")
|
|
463
|
+
return t;
|
|
464
|
+
}
|
|
465
|
+
const Tn = () => 1;
|
|
466
|
+
function Pn(e, t) {
|
|
467
|
+
if (e.nodeCount() <= 1)
|
|
468
|
+
return [];
|
|
469
|
+
const o = $n(e, t || Tn);
|
|
470
|
+
return Fn(o.graph, o.buckets, o.zeroIndex).flatMap((s) => e.outEdges(s.v, s.w));
|
|
471
|
+
}
|
|
472
|
+
function Fn(e, t, o) {
|
|
473
|
+
let n = [];
|
|
474
|
+
const s = t[t.length - 1], i = t[0];
|
|
475
|
+
let r;
|
|
476
|
+
for (; e.nodeCount(); ) {
|
|
477
|
+
for (; r = i.dequeue(); )
|
|
478
|
+
rt(e, t, o, r);
|
|
479
|
+
for (; r = s.dequeue(); )
|
|
480
|
+
rt(e, t, o, r);
|
|
481
|
+
if (e.nodeCount()) {
|
|
482
|
+
for (let a = t.length - 2; a > 0; --a)
|
|
483
|
+
if (r = t[a].dequeue(), r) {
|
|
484
|
+
n = n.concat(rt(e, t, o, r, !0));
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return n;
|
|
490
|
+
}
|
|
491
|
+
function rt(e, t, o, n, s) {
|
|
492
|
+
const i = s ? [] : void 0;
|
|
493
|
+
return e.inEdges(n.v).forEach((r) => {
|
|
494
|
+
const a = e.edge(r), l = e.node(r.v);
|
|
495
|
+
s && i.push({ v: r.v, w: r.w }), l.out -= a, dt(t, o, l);
|
|
496
|
+
}), e.outEdges(n.v).forEach((r) => {
|
|
497
|
+
const a = e.edge(r), l = e.node(r.w);
|
|
498
|
+
l.in -= a, dt(t, o, l);
|
|
499
|
+
}), e.removeNode(n.v), i;
|
|
500
|
+
}
|
|
501
|
+
function $n(e, t) {
|
|
502
|
+
const o = new oe();
|
|
503
|
+
let n = 0, s = 0;
|
|
504
|
+
e.nodes().forEach((a) => {
|
|
505
|
+
o.setNode(a, { v: a, in: 0, out: 0 });
|
|
506
|
+
}), e.edges().forEach((a) => {
|
|
507
|
+
const l = o.edge(a.v, a.w) || 0, c = t(a), d = l + c;
|
|
508
|
+
o.setEdge(a.v, a.w, d), s = Math.max(s, o.node(a.v).out += c), n = Math.max(n, o.node(a.w).in += c);
|
|
509
|
+
});
|
|
510
|
+
const i = Bn(s + n + 3).map(() => new Dn()), r = n + 1;
|
|
511
|
+
return o.nodes().forEach((a) => {
|
|
512
|
+
dt(i, r, o.node(a));
|
|
513
|
+
}), {
|
|
514
|
+
graph: o,
|
|
515
|
+
buckets: i,
|
|
516
|
+
zeroIndex: r
|
|
517
|
+
};
|
|
518
|
+
}
|
|
519
|
+
function dt(e, t, o) {
|
|
520
|
+
o.out ? o.in ? e[o.out - o.in + t].enqueue(o) : e[e.length - 1].enqueue(o) : e[0].enqueue(o);
|
|
521
|
+
}
|
|
522
|
+
function Bn(e) {
|
|
523
|
+
const t = [];
|
|
524
|
+
for (let o = 0; o < e; o++)
|
|
525
|
+
t.push(o);
|
|
526
|
+
return t;
|
|
527
|
+
}
|
|
528
|
+
function ve(e, t, o, n) {
|
|
529
|
+
let s = n;
|
|
530
|
+
for (; e.hasNode(s); )
|
|
531
|
+
s = Ve(n);
|
|
532
|
+
return o.dummy = t, e.setNode(s, o), s;
|
|
533
|
+
}
|
|
534
|
+
function co(e) {
|
|
535
|
+
const t = new oe().setGraph(e.graph());
|
|
536
|
+
return e.nodes().forEach((o) => {
|
|
537
|
+
t.setNode(o, e.node(o));
|
|
538
|
+
}), e.edges().forEach((o) => {
|
|
539
|
+
const n = t.edge(o.v, o.w) || { weight: 0, minlen: 1 }, s = e.edge(o);
|
|
540
|
+
t.setEdge(o.v, o.w, {
|
|
541
|
+
weight: n.weight + s.weight,
|
|
542
|
+
minlen: Math.max(n.minlen, s.minlen)
|
|
543
|
+
});
|
|
544
|
+
}), t;
|
|
545
|
+
}
|
|
546
|
+
function ht(e) {
|
|
547
|
+
const t = new oe({ multigraph: e.isMultigraph() }).setGraph(e.graph());
|
|
548
|
+
return e.nodes().forEach((o) => {
|
|
549
|
+
e.children(o).length || t.setNode(o, e.node(o));
|
|
550
|
+
}), e.edges().forEach((o) => {
|
|
551
|
+
t.setEdge(o, e.edge(o));
|
|
552
|
+
}), t;
|
|
553
|
+
}
|
|
554
|
+
function zn(e) {
|
|
555
|
+
const t = e.nodes().map((o) => {
|
|
556
|
+
const n = {};
|
|
557
|
+
return e.outEdges(o).forEach((s) => {
|
|
558
|
+
n[s.w] = (n[s.w] || 0) + e.edge(s).weight;
|
|
559
|
+
}), n;
|
|
560
|
+
});
|
|
561
|
+
return Ie(e.nodes(), t);
|
|
562
|
+
}
|
|
563
|
+
function Vn(e) {
|
|
564
|
+
const t = e.nodes().map((o) => {
|
|
565
|
+
const n = {};
|
|
566
|
+
return e.inEdges(o).forEach((s) => {
|
|
567
|
+
n[s.v] = (n[s.v] || 0) + e.edge(s).weight;
|
|
568
|
+
}), n;
|
|
569
|
+
});
|
|
570
|
+
return Ie(e.nodes(), t);
|
|
571
|
+
}
|
|
572
|
+
function ft(e, t) {
|
|
573
|
+
let o = e.x, n = e.y;
|
|
574
|
+
const s = t.x - o, i = t.y - n;
|
|
575
|
+
let r = e.width / 2, a = e.height / 2;
|
|
576
|
+
if (!s && !i)
|
|
577
|
+
throw new Error("Not possible to find intersection inside of the rectangle");
|
|
578
|
+
let l, c;
|
|
579
|
+
return Math.abs(i) * r > Math.abs(s) * a ? (i < 0 && (a = -a), l = a * s / i, c = a) : (s < 0 && (r = -r), l = r, c = r * i / s), { x: o + l, y: n + c };
|
|
580
|
+
}
|
|
581
|
+
function Oe(e) {
|
|
582
|
+
const t = ge(mt(e) + 1).map(() => []);
|
|
583
|
+
return e.nodes().forEach((o) => {
|
|
584
|
+
const n = e.node(o), s = n.rank;
|
|
585
|
+
s !== void 0 && (t[s][n.order] = o);
|
|
586
|
+
}), t;
|
|
587
|
+
}
|
|
588
|
+
function uo(e) {
|
|
589
|
+
const t = e.nodes().map((n) => {
|
|
590
|
+
const s = e.node(n).rank;
|
|
591
|
+
return s === void 0 ? Number.MAX_VALUE : s;
|
|
592
|
+
}), o = X(Math.min, t);
|
|
593
|
+
e.nodes().forEach((n) => {
|
|
594
|
+
const s = e.node(n);
|
|
595
|
+
Object.hasOwn(s, "rank") && (s.rank -= o);
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
function fo(e) {
|
|
599
|
+
const t = e.nodes().map((r) => e.node(r).rank).filter((r) => r !== void 0), o = X(Math.min, t), n = [];
|
|
600
|
+
e.nodes().forEach((r) => {
|
|
601
|
+
const a = e.node(r).rank - o;
|
|
602
|
+
n[a] || (n[a] = []), n[a].push(r);
|
|
603
|
+
});
|
|
604
|
+
let s = 0;
|
|
605
|
+
const i = e.graph().nodeRankFactor;
|
|
606
|
+
Array.from(n).forEach((r, a) => {
|
|
607
|
+
r === void 0 && a % i !== 0 ? --s : r !== void 0 && s && r.forEach((l) => {
|
|
608
|
+
e.node(l).rank += s;
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
function In(e, t, o, n) {
|
|
613
|
+
const s = {
|
|
614
|
+
width: 0,
|
|
615
|
+
height: 0
|
|
616
|
+
};
|
|
617
|
+
return arguments.length >= 4 && (s.rank = o, s.order = n), ve(e, "border", s, t);
|
|
618
|
+
}
|
|
619
|
+
const ho = 65535;
|
|
620
|
+
function Gn(e, t = ho) {
|
|
621
|
+
const o = [];
|
|
622
|
+
for (let n = 0; n < e.length; n += t) {
|
|
623
|
+
const s = e.slice(n, n + t);
|
|
624
|
+
o.push(s);
|
|
625
|
+
}
|
|
626
|
+
return o;
|
|
627
|
+
}
|
|
628
|
+
function X(e, t) {
|
|
629
|
+
if (t.length > ho) {
|
|
630
|
+
const o = Gn(t);
|
|
631
|
+
return e.apply(
|
|
632
|
+
null,
|
|
633
|
+
o.map((n) => e.apply(null, n))
|
|
634
|
+
);
|
|
635
|
+
} else
|
|
636
|
+
return e.apply(null, t);
|
|
637
|
+
}
|
|
638
|
+
function mt(e) {
|
|
639
|
+
const o = e.nodes().map((n) => {
|
|
640
|
+
const s = e.node(n).rank;
|
|
641
|
+
return s === void 0 ? Number.MIN_VALUE : s;
|
|
642
|
+
});
|
|
643
|
+
return X(Math.max, o);
|
|
644
|
+
}
|
|
645
|
+
function mo(e, t) {
|
|
646
|
+
const o = { lhs: [], rhs: [] };
|
|
647
|
+
return e.forEach((n) => {
|
|
648
|
+
t(n) ? o.lhs.push(n) : o.rhs.push(n);
|
|
649
|
+
}), o;
|
|
650
|
+
}
|
|
651
|
+
function go(e, t) {
|
|
652
|
+
const o = Date.now();
|
|
653
|
+
try {
|
|
654
|
+
return t();
|
|
655
|
+
} finally {
|
|
656
|
+
console.log(e + " time: " + (Date.now() - o) + "ms");
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
function vo(e, t) {
|
|
660
|
+
return t();
|
|
661
|
+
}
|
|
662
|
+
let jn = 0;
|
|
663
|
+
function Ve(e) {
|
|
664
|
+
const t = ++jn;
|
|
665
|
+
return e + String(t);
|
|
666
|
+
}
|
|
667
|
+
function ge(e, t, o = 1) {
|
|
668
|
+
t == null && (t = e, e = 0);
|
|
669
|
+
let n = (i) => i < t;
|
|
670
|
+
o < 0 && (n = (i) => t < i);
|
|
671
|
+
const s = [];
|
|
672
|
+
for (let i = e; n(i); i += o)
|
|
673
|
+
s.push(i);
|
|
674
|
+
return s;
|
|
675
|
+
}
|
|
676
|
+
function Me(e, t) {
|
|
677
|
+
const o = {};
|
|
678
|
+
for (const n of t)
|
|
679
|
+
e[n] !== void 0 && (o[n] = e[n]);
|
|
680
|
+
return o;
|
|
681
|
+
}
|
|
682
|
+
function De(e, t) {
|
|
683
|
+
let o = t;
|
|
684
|
+
if (typeof t == "string") {
|
|
685
|
+
const n = t;
|
|
686
|
+
o = (s) => s[n];
|
|
687
|
+
}
|
|
688
|
+
return Object.entries(e).reduce((n, [s, i]) => (n[s] = o(i, s), n), {});
|
|
689
|
+
}
|
|
690
|
+
function Ie(e, t) {
|
|
691
|
+
return e.reduce((o, n, s) => (o[n] = t[s], o), {});
|
|
692
|
+
}
|
|
693
|
+
const ze = {
|
|
694
|
+
addBorderNode: In,
|
|
695
|
+
addDummyNode: ve,
|
|
696
|
+
applyWithChunking: X,
|
|
697
|
+
asNonCompoundGraph: ht,
|
|
698
|
+
buildLayerMatrix: Oe,
|
|
699
|
+
intersectRect: ft,
|
|
700
|
+
mapValues: De,
|
|
701
|
+
maxRank: mt,
|
|
702
|
+
normalizeRanks: uo,
|
|
703
|
+
notime: vo,
|
|
704
|
+
partition: mo,
|
|
705
|
+
pick: Me,
|
|
706
|
+
predecessorWeights: Vn,
|
|
707
|
+
range: ge,
|
|
708
|
+
removeEmptyRanks: fo,
|
|
709
|
+
simplify: co,
|
|
710
|
+
successorWeights: zn,
|
|
711
|
+
time: go,
|
|
712
|
+
uniqueId: Ve,
|
|
713
|
+
zipObject: Ie
|
|
714
|
+
};
|
|
715
|
+
function Wn(e) {
|
|
716
|
+
(e.graph().acyclicer === "greedy" ? Pn(e, o(e)) : Hn(e)).forEach((n) => {
|
|
717
|
+
const s = e.edge(n);
|
|
718
|
+
e.removeEdge(n), s.forwardName = n.name, s.reversed = !0, e.setEdge(n.w, n.v, s, Ve("rev"));
|
|
719
|
+
});
|
|
720
|
+
function o(n) {
|
|
721
|
+
return (s) => n.edge(s).weight;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
function Yn(e) {
|
|
725
|
+
e.edges().forEach((t) => {
|
|
726
|
+
const o = e.edge(t);
|
|
727
|
+
if (o.reversed) {
|
|
728
|
+
e.removeEdge(t);
|
|
729
|
+
const n = o.forwardName;
|
|
730
|
+
delete o.reversed, delete o.forwardName, e.setEdge(t.w, t.v, o, n);
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
function Hn(e) {
|
|
735
|
+
const t = [], o = {}, n = {};
|
|
736
|
+
function s(i) {
|
|
737
|
+
Object.hasOwn(n, i) || (n[i] = !0, o[i] = !0, e.outEdges(i).forEach((r) => {
|
|
738
|
+
Object.hasOwn(o, r.w) ? t.push(r) : s(r.w);
|
|
739
|
+
}), delete o[i]);
|
|
740
|
+
}
|
|
741
|
+
return e.nodes().forEach(s), t;
|
|
742
|
+
}
|
|
743
|
+
function Un(e) {
|
|
744
|
+
e.graph().dummyChains = [], e.edges().forEach((t) => Zn(e, t));
|
|
745
|
+
}
|
|
746
|
+
function Zn(e, t) {
|
|
747
|
+
let o = t.v, n = e.node(o).rank;
|
|
748
|
+
const s = t.w, i = e.node(s).rank, r = t.name, a = e.edge(t), l = a.labelRank;
|
|
749
|
+
if (i === n + 1)
|
|
750
|
+
return;
|
|
751
|
+
e.removeEdge(t);
|
|
752
|
+
let c, d, m;
|
|
753
|
+
for (m = 0, ++n; n < i; ++m, ++n)
|
|
754
|
+
a.points = [], d = {
|
|
755
|
+
width: 0,
|
|
756
|
+
height: 0,
|
|
757
|
+
edgeLabel: a,
|
|
758
|
+
edgeObj: t,
|
|
759
|
+
rank: n
|
|
760
|
+
}, c = ve(e, "edge", d, "_d"), n === l && (d.width = a.width, d.height = a.height, d.dummy = "edge-label", d.labelpos = a.labelpos), e.setEdge(o, c, { weight: a.weight }, r), m === 0 && e.graph().dummyChains.push(c), o = c;
|
|
761
|
+
e.setEdge(o, s, { weight: a.weight }, r);
|
|
762
|
+
}
|
|
763
|
+
function Xn(e) {
|
|
764
|
+
e.graph().dummyChains.forEach((t) => {
|
|
765
|
+
let o = e.node(t);
|
|
766
|
+
const n = o.edgeLabel;
|
|
767
|
+
e.setEdge(o.edgeObj, n);
|
|
768
|
+
let s;
|
|
769
|
+
for (; o.dummy; )
|
|
770
|
+
s = e.successors(t)[0], e.removeNode(t), n.points.push({ x: o.x, y: o.y }), o.dummy === "edge-label" && (n.x = o.x, n.y = o.y, n.width = o.width, n.height = o.height), t = s, o = e.node(t);
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
function po(e) {
|
|
774
|
+
function t(o) {
|
|
775
|
+
const n = e.node(o);
|
|
776
|
+
if (n && Object.prototype.hasOwnProperty.call(n, "rank"))
|
|
777
|
+
return n.rank;
|
|
778
|
+
const s = e.outEdges(o) || [];
|
|
779
|
+
if (!s.length)
|
|
780
|
+
return n && (n.rank = 0), 0;
|
|
781
|
+
const i = s.map((a) => {
|
|
782
|
+
if (!e.node(a.w))
|
|
783
|
+
return Number.POSITIVE_INFINITY;
|
|
784
|
+
const c = t(a.w), d = e.edge(a).minlen;
|
|
785
|
+
return c - d;
|
|
786
|
+
});
|
|
787
|
+
let r = X(Math.min, i);
|
|
788
|
+
return r === Number.POSITIVE_INFINITY && (r = 0), n && (n.rank = r), r;
|
|
789
|
+
}
|
|
790
|
+
(e.sources() || []).forEach(t);
|
|
791
|
+
}
|
|
792
|
+
function qn(e, t) {
|
|
793
|
+
return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
|
|
794
|
+
}
|
|
795
|
+
function Kn(e) {
|
|
796
|
+
Jn(e);
|
|
797
|
+
const t = new oe();
|
|
798
|
+
e.nodes().forEach((i) => {
|
|
799
|
+
t.setNode(i, {});
|
|
800
|
+
});
|
|
801
|
+
const o = e.nodes();
|
|
802
|
+
if (!o.length)
|
|
803
|
+
return t;
|
|
804
|
+
const n = o[0], s = /* @__PURE__ */ new Set([n]);
|
|
805
|
+
for (; s.size < o.length; ) {
|
|
806
|
+
const i = Qn(e, s);
|
|
807
|
+
if (!i) {
|
|
808
|
+
const d = o.find((m) => !s.has(m));
|
|
809
|
+
s.add(d), t.setNode(d, {});
|
|
810
|
+
continue;
|
|
811
|
+
}
|
|
812
|
+
const { edgeObject: r, delta: a, attachFrom: l, attachTo: c } = i;
|
|
813
|
+
es(e, s, l, a), t.setEdge(r.v, r.w, {}), s.add(c);
|
|
814
|
+
}
|
|
815
|
+
return t;
|
|
816
|
+
}
|
|
817
|
+
function Jn(e) {
|
|
818
|
+
e.nodes().forEach((t) => {
|
|
819
|
+
const o = e.node(t) || {};
|
|
820
|
+
Object.prototype.hasOwnProperty.call(o, "rank") || (o.rank = 0, e.setNode(t, o));
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
function Qn(e, t) {
|
|
824
|
+
let o = null;
|
|
825
|
+
return e.edges().forEach((n) => {
|
|
826
|
+
const s = t.has(n.v), i = t.has(n.w);
|
|
827
|
+
if (s === i)
|
|
828
|
+
return;
|
|
829
|
+
const r = qn(e, n), a = Math.abs(r);
|
|
830
|
+
if (!o || a < o.absoluteSlack) {
|
|
831
|
+
const l = s ? n.v : n.w, c = s ? n.w : n.v, d = s ? r : -r;
|
|
832
|
+
o = {
|
|
833
|
+
edgeObject: n,
|
|
834
|
+
delta: d,
|
|
835
|
+
attachFrom: l,
|
|
836
|
+
attachTo: c,
|
|
837
|
+
absoluteSlack: a
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
}), o;
|
|
841
|
+
}
|
|
842
|
+
function es(e, t, o, n) {
|
|
843
|
+
n && e.nodes().forEach((s) => {
|
|
844
|
+
if (!t.has(s)) {
|
|
845
|
+
const i = e.node(s);
|
|
846
|
+
i.rank += n;
|
|
847
|
+
}
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
function pe(e) {
|
|
851
|
+
const t = co(e);
|
|
852
|
+
return po(t), t.nodes().forEach((o) => {
|
|
853
|
+
const n = t.node(o), s = e.node(o) || {};
|
|
854
|
+
s.rank = n.rank, e.setNode(o, s);
|
|
855
|
+
}), e;
|
|
856
|
+
}
|
|
857
|
+
function ts(e, t) {
|
|
858
|
+
}
|
|
859
|
+
function os(e, t) {
|
|
860
|
+
}
|
|
861
|
+
function ns(e, t, o) {
|
|
862
|
+
return 0;
|
|
863
|
+
}
|
|
864
|
+
function ss(e) {
|
|
865
|
+
return null;
|
|
866
|
+
}
|
|
867
|
+
function rs(e, t) {
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
pe.initLowLimValues = ts;
|
|
871
|
+
pe.initCutValues = os;
|
|
872
|
+
pe.calcCutValue = ns;
|
|
873
|
+
pe.leaveEdge = ss;
|
|
874
|
+
pe.enterEdge = rs;
|
|
875
|
+
const bo = po;
|
|
876
|
+
function is(e) {
|
|
877
|
+
const t = e.graph().ranker;
|
|
878
|
+
if (t instanceof Function)
|
|
879
|
+
return t(e);
|
|
880
|
+
switch (e.graph().ranker) {
|
|
881
|
+
case "network-simplex":
|
|
882
|
+
Qt(e);
|
|
883
|
+
break;
|
|
884
|
+
case "tight-tree":
|
|
885
|
+
ls(e);
|
|
886
|
+
break;
|
|
887
|
+
case "longest-path":
|
|
888
|
+
as(e);
|
|
889
|
+
break;
|
|
890
|
+
case "none":
|
|
891
|
+
break;
|
|
892
|
+
default:
|
|
893
|
+
Qt(e);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
const as = bo;
|
|
897
|
+
function ls(e) {
|
|
898
|
+
bo(e), Kn(e);
|
|
899
|
+
}
|
|
900
|
+
function Qt(e) {
|
|
901
|
+
pe(e);
|
|
902
|
+
}
|
|
903
|
+
function cs(e) {
|
|
904
|
+
const t = ds(e);
|
|
905
|
+
e.graph().dummyChains.forEach((o) => {
|
|
906
|
+
let n = e.node(o);
|
|
907
|
+
const s = n.edgeObj, i = us(e, t, s.v, s.w), r = i.path, a = i.lca;
|
|
908
|
+
let l = 0, c = r[l], d = !0, m = o;
|
|
909
|
+
for (; m !== s.w; ) {
|
|
910
|
+
if (n = e.node(m), d) {
|
|
911
|
+
for (; (c = r[l]) !== a && e.node(c).maxRank < n.rank; )
|
|
912
|
+
l++;
|
|
913
|
+
c === a && (d = !1);
|
|
914
|
+
}
|
|
915
|
+
if (!d) {
|
|
916
|
+
for (; l < r.length - 1 && e.node(c = r[l + 1]).minRank <= n.rank; )
|
|
917
|
+
l++;
|
|
918
|
+
c = r[l];
|
|
919
|
+
}
|
|
920
|
+
e.setParent(m, c), m = e.successors(m)[0];
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
function us(e, t, o, n) {
|
|
925
|
+
const s = [], i = [], r = Math.min(t[o].low, t[n].low), a = Math.max(t[o].lim, t[n].lim);
|
|
926
|
+
let l, c;
|
|
927
|
+
l = o;
|
|
928
|
+
do
|
|
929
|
+
l = e.parent(l), s.push(l);
|
|
930
|
+
while (l && (t[l].low > r || a > t[l].lim));
|
|
931
|
+
for (c = l, l = n; (l = e.parent(l)) !== c; )
|
|
932
|
+
i.push(l);
|
|
933
|
+
return {
|
|
934
|
+
path: s.concat(i.reverse()),
|
|
935
|
+
lca: c
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
function ds(e) {
|
|
939
|
+
const t = {};
|
|
940
|
+
let o = 0;
|
|
941
|
+
function n(s) {
|
|
942
|
+
const i = o;
|
|
943
|
+
e.children(s).forEach(n), t[s] = { low: i, lim: o++ };
|
|
944
|
+
}
|
|
945
|
+
return e.children().forEach(n), t;
|
|
946
|
+
}
|
|
947
|
+
function fs(e) {
|
|
948
|
+
const t = ze.addDummyNode(e, "root", {}, "_root"), o = hs(e), n = Object.values(o), s = ze.applyWithChunking(Math.max, n) - 1, i = 2 * s + 1;
|
|
949
|
+
e.graph().nestingRoot = t, e.edges().forEach((a) => {
|
|
950
|
+
e.edge(a).minlen *= i;
|
|
951
|
+
});
|
|
952
|
+
const r = ms(e) + 1;
|
|
953
|
+
e.children().forEach((a) => {
|
|
954
|
+
wo(e, t, i, r, s, o, a);
|
|
955
|
+
}), e.graph().nodeRankFactor = i;
|
|
956
|
+
}
|
|
957
|
+
function wo(e, t, o, n, s, i, r) {
|
|
958
|
+
const a = e.children(r);
|
|
959
|
+
if (!a.length) {
|
|
960
|
+
r !== t && e.setEdge(t, r, { weight: 0, minlen: o });
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
963
|
+
const l = ze.addBorderNode(e, "_bt"), c = ze.addBorderNode(e, "_bb"), d = e.node(r);
|
|
964
|
+
e.setParent(l, r), d.borderTop = l, e.setParent(c, r), d.borderBottom = c, a.forEach((m) => {
|
|
965
|
+
wo(e, t, o, n, s, i, m);
|
|
966
|
+
const g = e.node(m), b = g.borderTop ? g.borderTop : m, N = g.borderBottom ? g.borderBottom : m, _ = g.borderTop ? n : 2 * n, P = b !== N ? 1 : s - i[r] + 1;
|
|
967
|
+
e.setEdge(l, b, {
|
|
968
|
+
weight: _,
|
|
969
|
+
minlen: P,
|
|
970
|
+
nestingEdge: !0
|
|
971
|
+
}), e.setEdge(N, c, {
|
|
972
|
+
weight: _,
|
|
973
|
+
minlen: P,
|
|
974
|
+
nestingEdge: !0
|
|
975
|
+
});
|
|
976
|
+
}), e.parent(r) || e.setEdge(t, l, {
|
|
977
|
+
weight: 0,
|
|
978
|
+
minlen: s + i[r]
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function hs(e) {
|
|
982
|
+
const t = {};
|
|
983
|
+
function o(n, s) {
|
|
984
|
+
const i = e.children(n);
|
|
985
|
+
i && i.length && i.forEach((r) => o(r, s + 1)), t[n] = s;
|
|
986
|
+
}
|
|
987
|
+
return e.children().forEach((n) => o(n, 1)), t;
|
|
988
|
+
}
|
|
989
|
+
function ms(e) {
|
|
990
|
+
return e.edges().reduce((t, o) => t + e.edge(o).weight, 0);
|
|
991
|
+
}
|
|
992
|
+
function gs(e) {
|
|
993
|
+
const t = e.graph();
|
|
994
|
+
e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((o) => {
|
|
995
|
+
e.edge(o).nestingEdge && e.removeEdge(o);
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
function vs(e) {
|
|
999
|
+
function t(o) {
|
|
1000
|
+
const n = e.children(o), s = e.node(o);
|
|
1001
|
+
if (n.length && n.forEach(t), Object.hasOwn(s, "minRank")) {
|
|
1002
|
+
s.borderLeft = [], s.borderRight = [];
|
|
1003
|
+
for (let i = s.minRank, r = s.maxRank + 1; i < r; ++i)
|
|
1004
|
+
eo(e, "borderLeft", "_bl", o, s, i), eo(e, "borderRight", "_br", o, s, i);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
e.children().forEach(t);
|
|
1008
|
+
}
|
|
1009
|
+
function eo(e, t, o, n, s, i) {
|
|
1010
|
+
const r = {
|
|
1011
|
+
width: 0,
|
|
1012
|
+
height: 0,
|
|
1013
|
+
rank: i,
|
|
1014
|
+
borderType: t
|
|
1015
|
+
}, a = s[t][i - 1], l = ve(e, "border", r, o);
|
|
1016
|
+
s[t][i] = l, e.setParent(l, n), a && e.setEdge(a, l, { weight: 1 });
|
|
1017
|
+
}
|
|
1018
|
+
function ps(e) {
|
|
1019
|
+
const t = e.graph().rankdir.toLowerCase();
|
|
1020
|
+
(t === "lr" || t === "rl") && yo(e);
|
|
1021
|
+
}
|
|
1022
|
+
function bs(e) {
|
|
1023
|
+
const t = e.graph().rankdir.toLowerCase();
|
|
1024
|
+
(t === "bt" || t === "rl") && ws(e), (t === "lr" || t === "rl") && (ys(e), yo(e));
|
|
1025
|
+
}
|
|
1026
|
+
function yo(e) {
|
|
1027
|
+
e.nodes().forEach((t) => {
|
|
1028
|
+
to(e.node(t));
|
|
1029
|
+
}), e.edges().forEach((t) => {
|
|
1030
|
+
to(e.edge(t));
|
|
1031
|
+
});
|
|
1032
|
+
}
|
|
1033
|
+
function to(e) {
|
|
1034
|
+
const t = e.width;
|
|
1035
|
+
e.width = e.height, e.height = t;
|
|
1036
|
+
}
|
|
1037
|
+
function ws(e) {
|
|
1038
|
+
e.nodes().forEach((t) => {
|
|
1039
|
+
it(e.node(t));
|
|
1040
|
+
}), e.edges().forEach((t) => {
|
|
1041
|
+
const o = e.edge(t);
|
|
1042
|
+
o.points.forEach(it), Object.hasOwn(o, "y") && it(o);
|
|
1043
|
+
});
|
|
1044
|
+
}
|
|
1045
|
+
function it(e) {
|
|
1046
|
+
e.y = -e.y;
|
|
1047
|
+
}
|
|
1048
|
+
function ys(e) {
|
|
1049
|
+
e.nodes().forEach((t) => {
|
|
1050
|
+
at(e.node(t));
|
|
1051
|
+
}), e.edges().forEach((t) => {
|
|
1052
|
+
const o = e.edge(t);
|
|
1053
|
+
o.points.forEach(at), Object.hasOwn(o, "x") && at(o);
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
function at(e) {
|
|
1057
|
+
const t = e.x;
|
|
1058
|
+
e.x = e.y, e.y = t;
|
|
1059
|
+
}
|
|
1060
|
+
const oo = {
|
|
1061
|
+
adjust: ps,
|
|
1062
|
+
undo: bs
|
|
1063
|
+
};
|
|
1064
|
+
function ks(e) {
|
|
1065
|
+
const t = {}, o = e.nodes().filter((l) => e.children(l).length === 0), n = o.map((l) => e.node(l).rank), s = X(Math.max, n), i = ge(s + 1).map(() => []);
|
|
1066
|
+
function r(l) {
|
|
1067
|
+
if (t[l]) return;
|
|
1068
|
+
t[l] = !0;
|
|
1069
|
+
const c = e.node(l);
|
|
1070
|
+
i[c.rank].push(l), e.successors(l).forEach(r);
|
|
1071
|
+
}
|
|
1072
|
+
return o.sort(
|
|
1073
|
+
(l, c) => e.node(l).rank - e.node(c).rank
|
|
1074
|
+
).forEach(r), i;
|
|
1075
|
+
}
|
|
1076
|
+
function Es(e, t) {
|
|
1077
|
+
let o = 0;
|
|
1078
|
+
for (let n = 1; n < t.length; ++n)
|
|
1079
|
+
o += Cs(e, t[n - 1], t[n]);
|
|
1080
|
+
return o;
|
|
1081
|
+
}
|
|
1082
|
+
function Cs(e, t, o) {
|
|
1083
|
+
const n = Ie(
|
|
1084
|
+
o,
|
|
1085
|
+
o.map((c, d) => d)
|
|
1086
|
+
), s = t.flatMap((c) => e.outEdges(c).map((d) => ({
|
|
1087
|
+
pos: n[d.w],
|
|
1088
|
+
weight: e.edge(d).weight
|
|
1089
|
+
})).sort((d, m) => d.pos - m.pos));
|
|
1090
|
+
let i = 1;
|
|
1091
|
+
for (; i < o.length; ) i <<= 1;
|
|
1092
|
+
const r = 2 * i - 1;
|
|
1093
|
+
i -= 1;
|
|
1094
|
+
const a = new Array(r).fill(0);
|
|
1095
|
+
let l = 0;
|
|
1096
|
+
return s.forEach((c) => {
|
|
1097
|
+
let d = c.pos + i;
|
|
1098
|
+
a[d] += c.weight;
|
|
1099
|
+
let m = 0;
|
|
1100
|
+
for (; d > 0; )
|
|
1101
|
+
d % 2 && (m += a[d + 1]), d = d - 1 >> 1, a[d] += c.weight;
|
|
1102
|
+
l += c.weight * m;
|
|
1103
|
+
}), l;
|
|
1104
|
+
}
|
|
1105
|
+
function _s(e, t = []) {
|
|
1106
|
+
return t.map((o) => {
|
|
1107
|
+
const n = e.inEdges(o);
|
|
1108
|
+
if (!n.length)
|
|
1109
|
+
return { v: o };
|
|
1110
|
+
const s = n.reduce(
|
|
1111
|
+
(i, r) => {
|
|
1112
|
+
const a = e.edge(r), l = e.node(r.v);
|
|
1113
|
+
return {
|
|
1114
|
+
sum: i.sum + a.weight * l.order,
|
|
1115
|
+
weight: i.weight + a.weight
|
|
1116
|
+
};
|
|
1117
|
+
},
|
|
1118
|
+
{ sum: 0, weight: 0 }
|
|
1119
|
+
);
|
|
1120
|
+
return {
|
|
1121
|
+
v: o,
|
|
1122
|
+
barycenter: s.sum / s.weight,
|
|
1123
|
+
weight: s.weight
|
|
1124
|
+
};
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
function xs(e, t) {
|
|
1128
|
+
const o = {};
|
|
1129
|
+
e.forEach((s, i) => {
|
|
1130
|
+
const r = o[s.v] = {
|
|
1131
|
+
indegree: 0,
|
|
1132
|
+
in: [],
|
|
1133
|
+
out: [],
|
|
1134
|
+
vs: [s.v],
|
|
1135
|
+
i
|
|
1136
|
+
};
|
|
1137
|
+
s.barycenter !== void 0 && (r.barycenter = s.barycenter, r.weight = s.weight);
|
|
1138
|
+
}), t.edges().forEach((s) => {
|
|
1139
|
+
const i = o[s.v], r = o[s.w];
|
|
1140
|
+
i !== void 0 && r !== void 0 && (r.indegree++, i.out.push(r));
|
|
1141
|
+
});
|
|
1142
|
+
const n = Object.values(o).filter((s) => !s.indegree);
|
|
1143
|
+
return Ns(n);
|
|
1144
|
+
}
|
|
1145
|
+
function Ns(e) {
|
|
1146
|
+
const t = [];
|
|
1147
|
+
function o(s) {
|
|
1148
|
+
return (i) => {
|
|
1149
|
+
i.merged || (i.barycenter === void 0 || s.barycenter === void 0 || i.barycenter >= s.barycenter) && As(s, i);
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
function n(s) {
|
|
1153
|
+
return (i) => {
|
|
1154
|
+
i.in.push(s), --i.indegree === 0 && e.push(i);
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
for (; e.length; ) {
|
|
1158
|
+
const s = e.pop();
|
|
1159
|
+
t.push(s), s.in.reverse().forEach(o(s)), s.out.forEach(n(s));
|
|
1160
|
+
}
|
|
1161
|
+
return t.filter((s) => !s.merged).map((s) => Me(s, ["vs", "i", "barycenter", "weight"]));
|
|
1162
|
+
}
|
|
1163
|
+
function As(e, t) {
|
|
1164
|
+
let o = 0, n = 0;
|
|
1165
|
+
e.weight && (o += e.barycenter * e.weight, n += e.weight), t.weight && (o += t.barycenter * t.weight, n += t.weight), e.vs = t.vs.concat(e.vs), e.barycenter = o / n, e.weight = n, e.i = Math.min(t.i, e.i), t.merged = !0;
|
|
1166
|
+
}
|
|
1167
|
+
function Ss(e, t) {
|
|
1168
|
+
const o = mo(e, (d) => Object.hasOwn(d, "barycenter")), n = o.lhs, s = o.rhs.sort((d, m) => m.i - d.i), i = [];
|
|
1169
|
+
let r = 0, a = 0, l = 0;
|
|
1170
|
+
n.sort(Ls(!!t)), l = no(i, s, l), n.forEach((d) => {
|
|
1171
|
+
l += d.vs.length, i.push(d.vs), r += d.barycenter * d.weight, a += d.weight, l = no(i, s, l);
|
|
1172
|
+
});
|
|
1173
|
+
const c = { vs: i.flat(!0) };
|
|
1174
|
+
return a && (c.barycenter = r / a, c.weight = a), c;
|
|
1175
|
+
}
|
|
1176
|
+
function no(e, t, o) {
|
|
1177
|
+
let n;
|
|
1178
|
+
for (; t.length && (n = t[t.length - 1]).i <= o; )
|
|
1179
|
+
t.pop(), e.push(n.vs), o++;
|
|
1180
|
+
return o;
|
|
1181
|
+
}
|
|
1182
|
+
function Ls(e) {
|
|
1183
|
+
return (t, o) => t.barycenter < o.barycenter ? -1 : t.barycenter > o.barycenter ? 1 : e ? o.i - t.i : t.i - o.i;
|
|
1184
|
+
}
|
|
1185
|
+
function ko(e, t, o, n) {
|
|
1186
|
+
let s = e.children(t);
|
|
1187
|
+
const i = e.node(t), r = i ? i.borderLeft : void 0, a = i ? i.borderRight : void 0, l = {};
|
|
1188
|
+
r && (s = s.filter((g) => g !== r && g !== a));
|
|
1189
|
+
const c = _s(e, s);
|
|
1190
|
+
c.forEach((g) => {
|
|
1191
|
+
if (e.children(g.v).length) {
|
|
1192
|
+
const b = ko(e, g.v, o, n);
|
|
1193
|
+
l[g.v] = b, Object.hasOwn(b, "barycenter") && Os(g, b);
|
|
1194
|
+
}
|
|
1195
|
+
});
|
|
1196
|
+
let d = xs(c, o);
|
|
1197
|
+
Ms(d, l);
|
|
1198
|
+
const m = Ss(d, n);
|
|
1199
|
+
if (r && (m.vs = [r, m.vs, a].flat(!0), e.predecessors(r).length)) {
|
|
1200
|
+
const g = e.node(e.predecessors(r)[0]), b = e.node(e.predecessors(a)[0]);
|
|
1201
|
+
Object.hasOwn(m, "barycenter") || (m.barycenter = 0, m.weight = 0), m.barycenter = (m.barycenter * m.weight + g.order + b.order) / (m.weight + 2), m.weight += 2;
|
|
1202
|
+
}
|
|
1203
|
+
return m;
|
|
1204
|
+
}
|
|
1205
|
+
function Ms(e, t) {
|
|
1206
|
+
e.forEach((o) => {
|
|
1207
|
+
o.vs = o.vs.flatMap((n) => t[n] ? t[n].vs : n);
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
function Os(e, t) {
|
|
1211
|
+
e.barycenter !== void 0 ? (e.barycenter = (e.barycenter * e.weight + t.barycenter * t.weight) / (e.weight + t.weight), e.weight += t.weight) : (e.barycenter = t.barycenter, e.weight = t.weight);
|
|
1212
|
+
}
|
|
1213
|
+
function Ds(e, t, o, n) {
|
|
1214
|
+
n || (n = e.nodes());
|
|
1215
|
+
const s = Rs(e), i = new oe({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel((r) => e.node(r));
|
|
1216
|
+
return n.forEach((r) => {
|
|
1217
|
+
const a = e.node(r), l = e.parent(r);
|
|
1218
|
+
(a.rank === t || a.minRank <= t && t <= a.maxRank) && (i.setNode(r), i.setParent(r, l || s), e[o](r).forEach((d) => {
|
|
1219
|
+
const m = d.v === r ? d.w : d.v, g = i.edge(m, r), b = g ? g.weight : 0;
|
|
1220
|
+
i.setEdge(m, r, {
|
|
1221
|
+
weight: e.edge(d).weight + b
|
|
1222
|
+
});
|
|
1223
|
+
}), Object.hasOwn(a, "minRank") && i.setNode(r, {
|
|
1224
|
+
borderLeft: a.borderLeft[t],
|
|
1225
|
+
borderRight: a.borderRight[t]
|
|
1226
|
+
}));
|
|
1227
|
+
}), i;
|
|
1228
|
+
}
|
|
1229
|
+
function Rs(e) {
|
|
1230
|
+
let t;
|
|
1231
|
+
for (; e.hasNode(t = Ve("_root")); ) ;
|
|
1232
|
+
return t;
|
|
1233
|
+
}
|
|
1234
|
+
function Ts(e, t, o) {
|
|
1235
|
+
let n = {}, s;
|
|
1236
|
+
o.forEach((i) => {
|
|
1237
|
+
let r = e.parent(i), a, l;
|
|
1238
|
+
for (; r; ) {
|
|
1239
|
+
if (a = e.parent(r), a ? (l = n[a], n[a] = r) : (l = s, s = r), l && l !== r) {
|
|
1240
|
+
t.setEdge(l, r);
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
r = a;
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
}
|
|
1247
|
+
function Eo(e, t = {}) {
|
|
1248
|
+
if (typeof t.customOrder == "function") {
|
|
1249
|
+
t.customOrder(e, Eo);
|
|
1250
|
+
return;
|
|
1251
|
+
}
|
|
1252
|
+
const o = mt(e), n = so(
|
|
1253
|
+
e,
|
|
1254
|
+
ge(1, o + 1),
|
|
1255
|
+
"inEdges"
|
|
1256
|
+
), s = so(
|
|
1257
|
+
e,
|
|
1258
|
+
ge(o - 1, -1, -1),
|
|
1259
|
+
"outEdges"
|
|
1260
|
+
);
|
|
1261
|
+
let i = ks(e);
|
|
1262
|
+
if (ro(e, i), t.disableOptimalOrderHeuristic)
|
|
1263
|
+
return;
|
|
1264
|
+
let r = Number.POSITIVE_INFINITY, a;
|
|
1265
|
+
const l = t.constraints || [];
|
|
1266
|
+
for (let c = 0, d = 0; d < 4; ++c, ++d) {
|
|
1267
|
+
const m = c % 2 === 0 ? n : s, g = c % 4 >= 2;
|
|
1268
|
+
Ps(m, g, l), i = Oe(e);
|
|
1269
|
+
const b = Es(e, i);
|
|
1270
|
+
b < r ? (r = b, d = 0, a = structuredClone(i)) : b === r && (a = structuredClone(i));
|
|
1271
|
+
}
|
|
1272
|
+
ro(e, a);
|
|
1273
|
+
}
|
|
1274
|
+
function so(e, t, o) {
|
|
1275
|
+
const n = /* @__PURE__ */ new Map();
|
|
1276
|
+
function s(i, r) {
|
|
1277
|
+
n.has(i) || n.set(i, []), n.get(i).push(r);
|
|
1278
|
+
}
|
|
1279
|
+
for (const i of e.nodes()) {
|
|
1280
|
+
const r = e.node(i);
|
|
1281
|
+
if (typeof r.rank == "number" && s(r.rank, i), typeof r.minRank == "number" && typeof r.maxRank == "number")
|
|
1282
|
+
for (let a = r.minRank; a <= r.maxRank; a++)
|
|
1283
|
+
a !== r.rank && s(a, i);
|
|
1284
|
+
}
|
|
1285
|
+
return t.map(
|
|
1286
|
+
(i) => Ds(
|
|
1287
|
+
e,
|
|
1288
|
+
i,
|
|
1289
|
+
o,
|
|
1290
|
+
n.get(i) || []
|
|
1291
|
+
)
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
function Ps(e, t, o) {
|
|
1295
|
+
const n = new oe();
|
|
1296
|
+
e.forEach((s) => {
|
|
1297
|
+
o.forEach((a) => n.setEdge(a.left, a.right));
|
|
1298
|
+
const i = s.graph().root, r = ko(s, i, n, t);
|
|
1299
|
+
r.vs.forEach((a, l) => {
|
|
1300
|
+
s.node(a).order = l;
|
|
1301
|
+
}), Ts(s, n, r.vs);
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1304
|
+
function ro(e, t) {
|
|
1305
|
+
Object.values(t).forEach((o) => {
|
|
1306
|
+
o.forEach((n, s) => {
|
|
1307
|
+
e.node(n).order = s;
|
|
1308
|
+
});
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
function Fs(e, t) {
|
|
1312
|
+
const o = {};
|
|
1313
|
+
function n(s, i) {
|
|
1314
|
+
let r = 0, a = 0;
|
|
1315
|
+
const l = s.length, c = i[i.length - 1];
|
|
1316
|
+
return i.forEach((d, m) => {
|
|
1317
|
+
const g = Bs(e, d), b = g ? e.node(g).order : l;
|
|
1318
|
+
(g || d === c) && (i.slice(a, m + 1).forEach((N) => {
|
|
1319
|
+
e.predecessors(N).forEach((_) => {
|
|
1320
|
+
const P = e.node(_), J = P.order;
|
|
1321
|
+
(J < r || b < J) && !(P.dummy && e.node(N).dummy) && Co(o, _, N);
|
|
1322
|
+
});
|
|
1323
|
+
}), a = m + 1, r = b);
|
|
1324
|
+
}), i;
|
|
1325
|
+
}
|
|
1326
|
+
return t.length && t.reduce(n), o;
|
|
1327
|
+
}
|
|
1328
|
+
function $s(e, t) {
|
|
1329
|
+
const o = {};
|
|
1330
|
+
function n(i, r, a, l, c) {
|
|
1331
|
+
let d;
|
|
1332
|
+
ge(r, a).forEach((m) => {
|
|
1333
|
+
d = i[m], e.node(d).dummy && e.predecessors(d).forEach((g) => {
|
|
1334
|
+
const b = e.node(g);
|
|
1335
|
+
b.dummy && (b.order < l || b.order > c) && Co(o, g, d);
|
|
1336
|
+
});
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
function s(i, r) {
|
|
1340
|
+
let a = -1, l, c = 0;
|
|
1341
|
+
return r.forEach((d, m) => {
|
|
1342
|
+
if (e.node(d).dummy === "border") {
|
|
1343
|
+
const g = e.predecessors(d);
|
|
1344
|
+
g.length && (l = e.node(g[0]).order, n(r, c, m, a, l), c = m, a = l);
|
|
1345
|
+
}
|
|
1346
|
+
n(r, c, r.length, l, i.length);
|
|
1347
|
+
}), r;
|
|
1348
|
+
}
|
|
1349
|
+
return t.length && t.reduce(s), o;
|
|
1350
|
+
}
|
|
1351
|
+
function Bs(e, t) {
|
|
1352
|
+
if (e.node(t).dummy)
|
|
1353
|
+
return e.predecessors(t).find((o) => e.node(o).dummy);
|
|
1354
|
+
}
|
|
1355
|
+
function Co(e, t, o) {
|
|
1356
|
+
if (t > o) {
|
|
1357
|
+
const s = t;
|
|
1358
|
+
t = o, o = s;
|
|
1359
|
+
}
|
|
1360
|
+
let n = e[t];
|
|
1361
|
+
n || (e[t] = n = {}), n[o] = !0;
|
|
1362
|
+
}
|
|
1363
|
+
function zs(e, t, o) {
|
|
1364
|
+
if (t > o) {
|
|
1365
|
+
const n = t;
|
|
1366
|
+
t = o, o = n;
|
|
1367
|
+
}
|
|
1368
|
+
return !!e[t] && Object.hasOwn(e[t], o);
|
|
1369
|
+
}
|
|
1370
|
+
function Vs(e, t, o, n) {
|
|
1371
|
+
const s = {}, i = {}, r = {};
|
|
1372
|
+
return t.forEach((a) => {
|
|
1373
|
+
a.forEach((l, c) => {
|
|
1374
|
+
s[l] = l, i[l] = l, r[l] = c;
|
|
1375
|
+
});
|
|
1376
|
+
}), t.forEach((a) => {
|
|
1377
|
+
let l = -1;
|
|
1378
|
+
a.forEach((c) => {
|
|
1379
|
+
let d = n(c);
|
|
1380
|
+
if (d.length) {
|
|
1381
|
+
d = d.sort((g, b) => r[g] - r[b]);
|
|
1382
|
+
const m = (d.length - 1) / 2;
|
|
1383
|
+
for (let g = Math.floor(m), b = Math.ceil(m); g <= b; ++g) {
|
|
1384
|
+
const N = d[g];
|
|
1385
|
+
i[c] === c && l < r[N] && !zs(o, c, N) && (i[N] = c, i[c] = s[c] = s[N], l = r[N]);
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
}), { root: s, align: i };
|
|
1390
|
+
}
|
|
1391
|
+
function Is(e, t, o, n, s) {
|
|
1392
|
+
const i = {}, r = Gs(e, t, o, s), a = s ? "borderLeft" : "borderRight";
|
|
1393
|
+
function l(m, g) {
|
|
1394
|
+
const b = r.nodes().slice(), N = {};
|
|
1395
|
+
let _ = b.pop();
|
|
1396
|
+
for (; _; ) {
|
|
1397
|
+
if (N[_])
|
|
1398
|
+
m(_);
|
|
1399
|
+
else {
|
|
1400
|
+
N[_] = !0, b.push(_);
|
|
1401
|
+
for (const P of g(_))
|
|
1402
|
+
b.push(P);
|
|
1403
|
+
}
|
|
1404
|
+
_ = b.pop();
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
function c(m) {
|
|
1408
|
+
i[m] = r.inEdges(m).reduce((g, b) => Math.max(g, i[b.v] + r.edge(b)), 0);
|
|
1409
|
+
}
|
|
1410
|
+
function d(m) {
|
|
1411
|
+
const g = r.outEdges(m).reduce((N, _) => Math.min(N, i[_.w] - r.edge(_)), Number.POSITIVE_INFINITY), b = e.node(m);
|
|
1412
|
+
g !== Number.POSITIVE_INFINITY && b.borderType !== a && (i[m] = Math.max(i[m], g));
|
|
1413
|
+
}
|
|
1414
|
+
return l(c, r.predecessors.bind(r)), l(d, r.successors.bind(r)), Object.keys(n).forEach((m) => {
|
|
1415
|
+
i[m] = i[o[m]];
|
|
1416
|
+
}), i;
|
|
1417
|
+
}
|
|
1418
|
+
function Gs(e, t, o, n) {
|
|
1419
|
+
const s = new e.constructor(), i = e.graph(), r = Us(i.nodesep, i.edgesep, n);
|
|
1420
|
+
return t.forEach((a) => {
|
|
1421
|
+
let l;
|
|
1422
|
+
a.forEach((c) => {
|
|
1423
|
+
const d = o[c];
|
|
1424
|
+
if (s.setNode(d), l) {
|
|
1425
|
+
const m = o[l], g = s.edge(m, d);
|
|
1426
|
+
s.setEdge(
|
|
1427
|
+
m,
|
|
1428
|
+
d,
|
|
1429
|
+
Math.max(r(e, c, l), g || 0)
|
|
1430
|
+
);
|
|
1431
|
+
}
|
|
1432
|
+
l = c;
|
|
1433
|
+
});
|
|
1434
|
+
}), s;
|
|
1435
|
+
}
|
|
1436
|
+
function js(e, t) {
|
|
1437
|
+
return Object.values(t).reduce(
|
|
1438
|
+
(o, n) => {
|
|
1439
|
+
let s = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
|
|
1440
|
+
Object.entries(n).forEach(([a, l]) => {
|
|
1441
|
+
const c = Zs(e, a) / 2;
|
|
1442
|
+
s = Math.max(l + c, s), i = Math.min(l - c, i);
|
|
1443
|
+
});
|
|
1444
|
+
const r = s - i;
|
|
1445
|
+
return r < o[0] && (o = [r, n]), o;
|
|
1446
|
+
},
|
|
1447
|
+
[Number.POSITIVE_INFINITY, null]
|
|
1448
|
+
)[1];
|
|
1449
|
+
}
|
|
1450
|
+
function Ws(e, t) {
|
|
1451
|
+
const o = Object.values(t), n = X(Math.min, o), s = X(Math.max, o);
|
|
1452
|
+
["u", "d"].forEach((i) => {
|
|
1453
|
+
["l", "r"].forEach((r) => {
|
|
1454
|
+
const a = i + r;
|
|
1455
|
+
let l = e[a];
|
|
1456
|
+
if (l === t) return;
|
|
1457
|
+
const c = Object.values(l);
|
|
1458
|
+
let d = n - X(Math.min, c);
|
|
1459
|
+
r !== "l" && (d = s - X(Math.max, c)), d && (l = De(l, (m) => m + d), e[a] = l);
|
|
1460
|
+
});
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
function Ys(e, t) {
|
|
1464
|
+
return De(e.ul, (o, n) => {
|
|
1465
|
+
if (t)
|
|
1466
|
+
return e[t.toLowerCase()][n];
|
|
1467
|
+
const s = Object.values(e).map((i) => i[n]).sort((i, r) => i - r);
|
|
1468
|
+
return (s[1] + s[2]) / 2;
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
function Hs(e) {
|
|
1472
|
+
const t = Oe(e), o = Object.assign(
|
|
1473
|
+
Fs(e, t),
|
|
1474
|
+
$s(e, t)
|
|
1475
|
+
), n = {};
|
|
1476
|
+
let s;
|
|
1477
|
+
["u", "d"].forEach((r) => {
|
|
1478
|
+
s = r === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((a) => {
|
|
1479
|
+
let l = s;
|
|
1480
|
+
a === "r" && (l = l.map(
|
|
1481
|
+
(g) => Object.values(g).reverse()
|
|
1482
|
+
));
|
|
1483
|
+
const c = (r === "u" ? e.predecessors : e.successors).bind(e), d = Vs(
|
|
1484
|
+
e,
|
|
1485
|
+
l,
|
|
1486
|
+
o,
|
|
1487
|
+
c
|
|
1488
|
+
);
|
|
1489
|
+
let m = Is(
|
|
1490
|
+
e,
|
|
1491
|
+
l,
|
|
1492
|
+
d.root,
|
|
1493
|
+
d.align,
|
|
1494
|
+
a === "r"
|
|
1495
|
+
);
|
|
1496
|
+
a === "r" && (m = De(m, (g) => -g)), n[r + a] = m;
|
|
1497
|
+
});
|
|
1498
|
+
});
|
|
1499
|
+
const i = js(e, n);
|
|
1500
|
+
return Ws(n, i), Ys(n, e.graph().align);
|
|
1501
|
+
}
|
|
1502
|
+
function Us(e, t, o) {
|
|
1503
|
+
return (n, s, i) => {
|
|
1504
|
+
const r = n.node(s), a = n.node(i);
|
|
1505
|
+
let l = 0, c;
|
|
1506
|
+
if (l += r.width / 2, Object.hasOwn(r, "labelpos"))
|
|
1507
|
+
switch (r.labelpos.toLowerCase()) {
|
|
1508
|
+
case "l":
|
|
1509
|
+
c = -r.width / 2;
|
|
1510
|
+
break;
|
|
1511
|
+
case "r":
|
|
1512
|
+
c = r.width / 2;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
if (c && (l += o ? c : -c), c = 0, l += (r.dummy ? t : e) / 2, l += (a.dummy ? t : e) / 2, l += a.width / 2, Object.hasOwn(a, "labelpos"))
|
|
1516
|
+
switch (a.labelpos.toLowerCase()) {
|
|
1517
|
+
case "l":
|
|
1518
|
+
c = a.width / 2;
|
|
1519
|
+
break;
|
|
1520
|
+
case "r":
|
|
1521
|
+
c = -a.width / 2;
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
return c && (l += o ? c : -c), c = 0, l;
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
function Zs(e, t) {
|
|
1528
|
+
return e.node(t).width;
|
|
1529
|
+
}
|
|
1530
|
+
function Xs(e) {
|
|
1531
|
+
const t = ht(e);
|
|
1532
|
+
qs(t);
|
|
1533
|
+
const o = Hs(t);
|
|
1534
|
+
Object.entries(o).forEach(([n, s]) => {
|
|
1535
|
+
e.node(n).x = s;
|
|
1536
|
+
});
|
|
1537
|
+
}
|
|
1538
|
+
function qs(e) {
|
|
1539
|
+
const t = Oe(e), o = e.graph().ranksep;
|
|
1540
|
+
let n = 0;
|
|
1541
|
+
t.forEach((s) => {
|
|
1542
|
+
const i = s.reduce((r, a) => {
|
|
1543
|
+
const l = e.node(a).height;
|
|
1544
|
+
return r > l ? r : l;
|
|
1545
|
+
}, 0);
|
|
1546
|
+
s.forEach((r) => {
|
|
1547
|
+
e.node(r).y = n + i / 2;
|
|
1548
|
+
}), n += i + o;
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
function Ks(e, t = {}) {
|
|
1552
|
+
const o = t.debugTiming ? go : vo;
|
|
1553
|
+
return o("layout", () => {
|
|
1554
|
+
const n = o(" buildLayoutGraph", () => ar(e));
|
|
1555
|
+
return o(" runLayout", () => Js(n, o, t)), o(" updateInputGraph", () => Qs(e, n)), n;
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
function Js(e, t, o) {
|
|
1559
|
+
t(" makeSpaceForEdgeLabels", () => lr(e)), t(" removeSelfEdges", () => pr(e)), t(" acyclic", () => Wn(e)), t(" nestingGraph.run", () => fs(e)), t(" rank", () => is(ht(e))), t(" injectEdgeLabelProxies", () => cr(e)), t(" removeEmptyRanks", () => fo(e)), t(" nestingGraph.cleanup", () => gs(e)), t(" normalizeRanks", () => uo(e)), t(" assignRankMinMax", () => ur(e)), t(" removeEdgeLabelProxies", () => dr(e)), t(" normalize.run", () => Un(e)), t(" parentDummyChains", () => cs(e)), t(" addBorderSegments", () => vs(e)), t(" order", () => Eo(e, o)), t(" insertSelfEdges", () => br(e)), t(" adjustCoordinateSystem", () => oo.adjust(e)), t(" position", () => Xs(e)), t(" positionSelfEdges", () => wr(e)), t(" removeBorderNodes", () => vr(e)), t(" normalize.undo", () => Xn(e)), t(" fixupEdgeLabelCoords", () => mr(e)), t(" undoCoordinateSystem", () => oo.undo(e)), t(" translateGraph", () => fr(e)), t(" assignNodeIntersects", () => hr(e)), t(" reversePoints", () => gr(e)), t(" acyclic.undo", () => Yn(e));
|
|
1560
|
+
}
|
|
1561
|
+
function Qs(e, t) {
|
|
1562
|
+
e.nodes().forEach((s) => {
|
|
1563
|
+
const i = e.node(s), r = t.node(s);
|
|
1564
|
+
i && (i.x = r.x, i.y = r.y, i.order = r.order, i.rank = r.rank, t.children(s).length && (i.width = r.width, i.height = r.height));
|
|
1565
|
+
}), e.edges().forEach((s) => {
|
|
1566
|
+
const i = e.edge(s), r = t.edge(s);
|
|
1567
|
+
i.points = r.points, Object.hasOwn(r, "x") && (i.x = r.x, i.y = r.y);
|
|
1568
|
+
});
|
|
1569
|
+
const o = t.graph(), n = e.graph();
|
|
1570
|
+
n.width = o.width, n.height = o.height;
|
|
1571
|
+
}
|
|
1572
|
+
const er = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], tr = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, or = ["acyclicer", "ranker", "rankdir", "align"], nr = ["width", "height", "rank"], io = { width: 0, height: 0 }, sr = ["minlen", "weight", "width", "height", "labeloffset"], rr = {
|
|
1573
|
+
minlen: 1,
|
|
1574
|
+
weight: 1,
|
|
1575
|
+
width: 0,
|
|
1576
|
+
height: 0,
|
|
1577
|
+
labeloffset: 10,
|
|
1578
|
+
labelpos: "r"
|
|
1579
|
+
}, ir = ["labelpos", "arrowshape"];
|
|
1580
|
+
function ar(e) {
|
|
1581
|
+
const t = ct(e.graph()), o = {
|
|
1582
|
+
...tr,
|
|
1583
|
+
...lt(t, er),
|
|
1584
|
+
...Me(t, or)
|
|
1585
|
+
}, n = new oe({ multigraph: !0, compound: !0 });
|
|
1586
|
+
return n.setGraph(o), e.nodes().forEach((s) => {
|
|
1587
|
+
const i = ct(e.node(s)), r = lt(i, nr);
|
|
1588
|
+
Object.keys(io).forEach((a) => {
|
|
1589
|
+
r[a] === void 0 && (r[a] = io[a]);
|
|
1590
|
+
}), n.setNode(s, r), n.setParent(s, e.parent(s));
|
|
1591
|
+
}), e.edges().forEach((s) => {
|
|
1592
|
+
const i = ct(e.edge(s));
|
|
1593
|
+
n.setEdge(
|
|
1594
|
+
s,
|
|
1595
|
+
{
|
|
1596
|
+
...rr,
|
|
1597
|
+
...lt(i, sr),
|
|
1598
|
+
...Me(i, ir)
|
|
1599
|
+
}
|
|
1600
|
+
);
|
|
1601
|
+
}), n;
|
|
1602
|
+
}
|
|
1603
|
+
function lr(e) {
|
|
1604
|
+
const t = e.graph();
|
|
1605
|
+
t.ranksep /= 2, e.edges().forEach((o) => {
|
|
1606
|
+
const n = e.edge(o);
|
|
1607
|
+
n.minlen *= 2, n.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? n.width += n.labeloffset : n.height += n.labeloffset);
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
function cr(e) {
|
|
1611
|
+
e.edges().forEach((t) => {
|
|
1612
|
+
const o = e.edge(t);
|
|
1613
|
+
if (o.width && o.height) {
|
|
1614
|
+
const n = e.node(t.v), i = { rank: (e.node(t.w).rank - n.rank) / 2 + n.rank, e: t };
|
|
1615
|
+
ve(e, "edge-proxy", i, "_ep");
|
|
1616
|
+
}
|
|
1617
|
+
});
|
|
1618
|
+
}
|
|
1619
|
+
function ur(e) {
|
|
1620
|
+
let t = 0;
|
|
1621
|
+
e.nodes().forEach((o) => {
|
|
1622
|
+
const n = e.node(o);
|
|
1623
|
+
n.borderTop && (n.minRank = e.node(n.borderTop).rank, n.maxRank = e.node(n.borderBottom).rank, t = Math.max(t, n.maxRank));
|
|
1624
|
+
}), e.graph().maxRank = t;
|
|
1625
|
+
}
|
|
1626
|
+
function dr(e) {
|
|
1627
|
+
e.nodes().forEach((t) => {
|
|
1628
|
+
const o = e.node(t);
|
|
1629
|
+
o.dummy === "edge-proxy" && (e.edge(o.e).labelRank = o.rank, e.removeNode(t));
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1632
|
+
function fr(e) {
|
|
1633
|
+
let t = Number.POSITIVE_INFINITY, o = 0, n = Number.POSITIVE_INFINITY, s = 0;
|
|
1634
|
+
const i = e.graph(), r = i.marginx || 0, a = i.marginy || 0;
|
|
1635
|
+
function l(c) {
|
|
1636
|
+
const d = c.x, m = c.y, g = c.width, b = c.height;
|
|
1637
|
+
t = Math.min(t, d - g / 2), o = Math.max(o, d + g / 2), n = Math.min(n, m - b / 2), s = Math.max(s, m + b / 2);
|
|
1638
|
+
}
|
|
1639
|
+
e.nodes().forEach((c) => l(e.node(c))), e.edges().forEach((c) => {
|
|
1640
|
+
const d = e.edge(c);
|
|
1641
|
+
Object.hasOwn(d, "x") && l(d);
|
|
1642
|
+
}), t -= r, n -= a, e.nodes().forEach((c) => {
|
|
1643
|
+
const d = e.node(c);
|
|
1644
|
+
d.x -= t, d.y -= n;
|
|
1645
|
+
}), e.edges().forEach((c) => {
|
|
1646
|
+
const d = e.edge(c);
|
|
1647
|
+
d.points.forEach((m) => {
|
|
1648
|
+
m.x -= t, m.y -= n;
|
|
1649
|
+
}), Object.hasOwn(d, "x") && (d.x -= t), Object.hasOwn(d, "y") && (d.y -= n);
|
|
1650
|
+
}), i.width = o - t + r, i.height = s - n + a;
|
|
1651
|
+
}
|
|
1652
|
+
function ao(e, t, o) {
|
|
1653
|
+
if (!t)
|
|
1654
|
+
return e;
|
|
1655
|
+
const n = t.x - e.x, s = t.y - e.y, i = Math.sqrt(n * n + s * s);
|
|
1656
|
+
if (!i || i <= o)
|
|
1657
|
+
return e;
|
|
1658
|
+
const r = o / i;
|
|
1659
|
+
return {
|
|
1660
|
+
x: e.x + n * r,
|
|
1661
|
+
y: e.y + s * r
|
|
1662
|
+
};
|
|
1663
|
+
}
|
|
1664
|
+
function hr(e) {
|
|
1665
|
+
e.edges().forEach((o) => {
|
|
1666
|
+
const n = e.edge(o), s = e.node(o.v), i = e.node(o.w);
|
|
1667
|
+
let r, a;
|
|
1668
|
+
!n.points || !n.points.length ? (n.points = [], r = i, a = s) : (r = n.points[0], a = n.points[n.points.length - 1]);
|
|
1669
|
+
const l = ft(s, r), c = ft(i, a), d = n.points.length ? n.points[0] : r, m = n.points.length ? n.points[n.points.length - 1] : a, g = n.arrowshape, b = g === "normal" || g === "vee", N = !!n.reversed;
|
|
1670
|
+
let _ = l, P = c;
|
|
1671
|
+
b && (N ? _ = ao(l, d, 4) : P = ao(c, m, 4)), n.points.unshift(_), n.points.push(P);
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
function mr(e) {
|
|
1675
|
+
e.edges().forEach((t) => {
|
|
1676
|
+
const o = e.edge(t);
|
|
1677
|
+
if (Object.hasOwn(o, "x"))
|
|
1678
|
+
switch ((o.labelpos === "l" || o.labelpos === "r") && (o.width -= o.labeloffset), o.labelpos) {
|
|
1679
|
+
case "l":
|
|
1680
|
+
o.x -= o.width / 2 + o.labeloffset;
|
|
1681
|
+
break;
|
|
1682
|
+
case "r":
|
|
1683
|
+
o.x += o.width / 2 + o.labeloffset;
|
|
1684
|
+
break;
|
|
1685
|
+
}
|
|
1686
|
+
});
|
|
1687
|
+
}
|
|
1688
|
+
function gr(e) {
|
|
1689
|
+
e.edges().forEach((t) => {
|
|
1690
|
+
const o = e.edge(t);
|
|
1691
|
+
o.reversed && o.points.reverse();
|
|
1692
|
+
});
|
|
1693
|
+
}
|
|
1694
|
+
function vr(e) {
|
|
1695
|
+
e.nodes().forEach((t) => {
|
|
1696
|
+
if (e.children(t).length) {
|
|
1697
|
+
const o = e.node(t), n = e.node(o.borderTop), s = e.node(o.borderBottom), i = e.node(o.borderLeft[o.borderLeft.length - 1]), r = e.node(o.borderRight[o.borderRight.length - 1]);
|
|
1698
|
+
o.width = Math.abs(r.x - i.x), o.height = Math.abs(s.y - n.y), o.x = i.x + o.width / 2, o.y = n.y + o.height / 2;
|
|
1699
|
+
}
|
|
1700
|
+
}), e.nodes().forEach((t) => {
|
|
1701
|
+
e.node(t).dummy === "border" && e.removeNode(t);
|
|
1702
|
+
});
|
|
1703
|
+
}
|
|
1704
|
+
function pr(e) {
|
|
1705
|
+
e.edges().forEach((t) => {
|
|
1706
|
+
if (t.v === t.w) {
|
|
1707
|
+
const o = e.node(t.v);
|
|
1708
|
+
o.selfEdges || (o.selfEdges = []), o.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
|
|
1709
|
+
}
|
|
1710
|
+
});
|
|
1711
|
+
}
|
|
1712
|
+
function br(e) {
|
|
1713
|
+
Oe(e).forEach((o) => {
|
|
1714
|
+
let n = 0;
|
|
1715
|
+
o.forEach((s, i) => {
|
|
1716
|
+
const r = e.node(s);
|
|
1717
|
+
r.order = i + n, (r.selfEdges || []).forEach((a) => {
|
|
1718
|
+
ve(e, "selfedge", {
|
|
1719
|
+
width: a.label.width,
|
|
1720
|
+
height: a.label.height,
|
|
1721
|
+
rank: r.rank,
|
|
1722
|
+
order: i + ++n,
|
|
1723
|
+
e: a.e,
|
|
1724
|
+
label: a.label
|
|
1725
|
+
}, "_se");
|
|
1726
|
+
}), delete r.selfEdges;
|
|
1727
|
+
});
|
|
1728
|
+
});
|
|
1729
|
+
}
|
|
1730
|
+
function wr(e) {
|
|
1731
|
+
e.nodes().forEach((t) => {
|
|
1732
|
+
const o = e.node(t);
|
|
1733
|
+
if (o.dummy === "selfedge") {
|
|
1734
|
+
const n = e.node(o.e.v), s = n.x + n.width / 2, i = n.y, r = o.x - s, a = n.height / 2;
|
|
1735
|
+
e.setEdge(o.e, o.label), e.removeNode(t), o.label.points = [
|
|
1736
|
+
{ x: s + 2 * r / 3, y: i - a },
|
|
1737
|
+
{ x: s + 5 * r / 6, y: i - a },
|
|
1738
|
+
{ x: s + r, y: i },
|
|
1739
|
+
{ x: s + 5 * r / 6, y: i + a },
|
|
1740
|
+
{ x: s + 2 * r / 3, y: i + a }
|
|
1741
|
+
], o.label.x = o.x, o.label.y = o.y;
|
|
1742
|
+
}
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
function lt(e, t) {
|
|
1746
|
+
return De(Me(e, t), Number);
|
|
1747
|
+
}
|
|
1748
|
+
function ct(e) {
|
|
1749
|
+
const t = {};
|
|
1750
|
+
return e && Object.entries(e).forEach(([o, n]) => {
|
|
1751
|
+
let s = o;
|
|
1752
|
+
typeof s == "string" && (s = s.toLowerCase()), t[s] = n;
|
|
1753
|
+
}), t;
|
|
1754
|
+
}
|
|
1755
|
+
const yr = {
|
|
1756
|
+
rankDirection: "TB",
|
|
1757
|
+
// "TB", "BT", "LR", "RL"
|
|
1758
|
+
nodeSeparation: 50,
|
|
1759
|
+
rankSeparation: 50,
|
|
1760
|
+
edgeSeparation: 10,
|
|
1761
|
+
// "UL", "UR", "DL", "DR" or undefined force one of four extreme alignment strategies (Up/Down × Left/Right).
|
|
1762
|
+
align: void 0,
|
|
1763
|
+
nodeWidth: 100,
|
|
1764
|
+
nodeHeight: 40,
|
|
1765
|
+
curvedEdges: !1,
|
|
1766
|
+
padding: 20,
|
|
1767
|
+
// "undirected" | "normal" | "vee"
|
|
1768
|
+
arrowShape: "normal",
|
|
1769
|
+
arrowSize: 10
|
|
1770
|
+
};
|
|
1771
|
+
function kr(e) {
|
|
1772
|
+
return e.length ? e.map(
|
|
1773
|
+
(t, o) => `${o === 0 ? "M" : "L"} ${t.x} ${t.y}`
|
|
1774
|
+
).join(" ") : "";
|
|
1775
|
+
}
|
|
1776
|
+
function Er(e) {
|
|
1777
|
+
if (!e.length) return "";
|
|
1778
|
+
if (e.length === 1) {
|
|
1779
|
+
const s = e[0];
|
|
1780
|
+
return `M ${s.x} ${s.y}`;
|
|
1781
|
+
}
|
|
1782
|
+
if (e.length === 2)
|
|
1783
|
+
return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
|
|
1784
|
+
const [t] = e;
|
|
1785
|
+
let o = `M ${t.x} ${t.y}`;
|
|
1786
|
+
for (let s = 1; s < e.length - 1; s += 1) {
|
|
1787
|
+
e[s - 1];
|
|
1788
|
+
const i = e[s], r = e[s + 1], a = i.x, l = i.y, c = (i.x + r.x) / 2, d = (i.y + r.y) / 2;
|
|
1789
|
+
o += ` Q ${a} ${l} ${c} ${d}`;
|
|
1790
|
+
}
|
|
1791
|
+
const n = e[e.length - 1];
|
|
1792
|
+
return o += ` L ${n.x} ${n.y}`, o;
|
|
1793
|
+
}
|
|
1794
|
+
function Cr(e) {
|
|
1795
|
+
const { nodes: t, edges: o, configuration: n } = e, s = y(null), i = y(null), r = `dag-arrow-${ut()}`;
|
|
1796
|
+
function a(l, c, d) {
|
|
1797
|
+
i.value = null, s.value = null;
|
|
1798
|
+
const m = {
|
|
1799
|
+
...yr,
|
|
1800
|
+
...d
|
|
1801
|
+
}, g = new oe({ multigraph: !0, compound: !0 });
|
|
1802
|
+
g.setGraph({
|
|
1803
|
+
rankdir: m.rankDirection,
|
|
1804
|
+
nodesep: m.nodeSeparation,
|
|
1805
|
+
ranksep: m.rankSeparation,
|
|
1806
|
+
edgesep: m.edgeSeparation,
|
|
1807
|
+
align: m.align
|
|
1808
|
+
}), l.forEach((u) => {
|
|
1809
|
+
g.setNode(u.id, {
|
|
1810
|
+
label: u.label,
|
|
1811
|
+
width: u.width ?? m.nodeWidth,
|
|
1812
|
+
height: u.height ?? m.nodeHeight
|
|
1813
|
+
});
|
|
1814
|
+
}), c.forEach((u) => {
|
|
1815
|
+
g.setEdge(u.from, u.to, {
|
|
1816
|
+
weight: u.weight ?? 1,
|
|
1817
|
+
minlen: u.minLength ?? 1,
|
|
1818
|
+
arrowShape: m.arrowShape ?? "normal"
|
|
1819
|
+
});
|
|
1820
|
+
}), Ks(g);
|
|
1821
|
+
const b = l.map((u) => {
|
|
1822
|
+
const j = g.node(u.id);
|
|
1823
|
+
return {
|
|
1824
|
+
id: u.id,
|
|
1825
|
+
label: u.label,
|
|
1826
|
+
x: j.x,
|
|
1827
|
+
y: j.y,
|
|
1828
|
+
width: j.width,
|
|
1829
|
+
height: j.height,
|
|
1830
|
+
original: u
|
|
1831
|
+
};
|
|
1832
|
+
}), N = g.edges().map((u) => {
|
|
1833
|
+
const j = g.edge(u), Q = j.points || [];
|
|
1834
|
+
if (!Q.length)
|
|
1835
|
+
return null;
|
|
1836
|
+
const Re = m.curvedEdges ? Er(Q) : kr(Q), Te = m.arrowShape !== "undirected" ? `url(#${r})` : null, Pe = c.find((we) => we?.from === u.v && we?.to === u.w);
|
|
1837
|
+
return {
|
|
1838
|
+
id: `${u.v}->${u.w}->${ut()}`,
|
|
1839
|
+
from: u.v,
|
|
1840
|
+
to: u.w,
|
|
1841
|
+
points: Q,
|
|
1842
|
+
pathData: Re,
|
|
1843
|
+
markerEnd: Te,
|
|
1844
|
+
original: {
|
|
1845
|
+
...Pe,
|
|
1846
|
+
...j
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
}).filter(Boolean), _ = m.padding;
|
|
1850
|
+
if (!b.length) {
|
|
1851
|
+
s.value = {
|
|
1852
|
+
nodes: [],
|
|
1853
|
+
edges: N,
|
|
1854
|
+
viewBox: "0 0 0 0",
|
|
1855
|
+
arrowShape: m.arrowShape,
|
|
1856
|
+
arrowSize: m.arrowSize
|
|
1857
|
+
};
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
const P = b.flatMap((u) => [
|
|
1861
|
+
u.x - u.width / 2,
|
|
1862
|
+
u.x + u.width / 2
|
|
1863
|
+
]), J = b.flatMap((u) => [
|
|
1864
|
+
u.y - u.height / 2,
|
|
1865
|
+
u.y + u.height / 2
|
|
1866
|
+
]), be = Math.min(...P) - _, ue = Math.max(...P) + _, F = Math.min(...J) - _, I = Math.max(...J) + _;
|
|
1867
|
+
s.value = {
|
|
1868
|
+
nodes: b,
|
|
1869
|
+
edges: N.map((u) => ({
|
|
1870
|
+
...u,
|
|
1871
|
+
midpoint: u.pathData ? dn(u.pathData) : { x: 0, y: 0 }
|
|
1872
|
+
})),
|
|
1873
|
+
viewBox: `${be} ${F} ${ue - be} ${I - F}`,
|
|
1874
|
+
arrowShape: m.arrowShape,
|
|
1875
|
+
arrowSize: m.arrowSize
|
|
1876
|
+
};
|
|
1877
|
+
}
|
|
1878
|
+
return rn(() => {
|
|
1879
|
+
try {
|
|
1880
|
+
const l = v(t) || [], c = v(o) || [], d = v(n) || {};
|
|
1881
|
+
a(l, c, d);
|
|
1882
|
+
} catch (l) {
|
|
1883
|
+
console.error("[useDag] layout error:", l), i.value = l, s.value = null;
|
|
1884
|
+
}
|
|
1885
|
+
}), {
|
|
1886
|
+
layoutData: s,
|
|
1887
|
+
lastError: i,
|
|
1888
|
+
arrowMarkerIdentifier: r,
|
|
1889
|
+
recomputeLayout: () => {
|
|
1890
|
+
const l = v(t) || [], c = v(o) || [], d = v(n) || {};
|
|
1891
|
+
a(l, c, d);
|
|
1892
|
+
}
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
const _o = { style: { chart: { backgroundColor: "#1A1A1A", color: "#CCCCCC", backgroundPattern: { dotColor: "#3A3A3A" }, nodes: { stroke: "#6A6A6A", backgroundColor: "#2A2A2A", labels: { color: "#CCCCCC" }, tooltip: { backgroundColor: "#3A3A3A", color: "#CCCCCC" } }, edges: { stroke: "#6A6A6A" }, midpoints: { stroke: "#6A6A6A", fill: "#1A1A1A", tooltip: { backgroundColor: "#3A3A3A", color: "#CCCCCC" } }, controls: { backgroundColor: "#2A2A2A", buttonColor: "#2A2A2A", color: "#CCCCCC", border: "1px solid #4A4A4A" }, title: { color: "#CCCCCC", subtitle: { color: "#757575" } } } } }, xo = { style: { chart: { backgroundColor: "#FFF8E1", color: "#424242", backgroundPattern: { dotColor: "#edc7bb" }, nodes: { stroke: "#5D4037", backgroundColor: "#fcf9f0", labels: { color: "#424242" }, tooltip: { backgroundColor: "#5D4037", color: "#FFF8E1" } }, edges: { stroke: "#5D4037" }, midpoints: { stroke: "#5D4037", fill: "#FFF8E1", tooltip: { backgroundColor: "#5D4037", color: "#FFF8E1" } }, controls: { backgroundColor: "#FFF8E1", buttonColor: "#FFF8E1", color: "#424242", border: "1px solid #d9bbb2" }, title: { color: "#424242", subtitle: { color: "#757575" } } } } }, No = { style: { chart: { backgroundColor: "#1E1E1E", color: "#BDBDBD", backgroundPattern: { dotColor: "#3E3E3E" }, nodes: { stroke: "#965039", backgroundColor: "#2A2A2A", labels: { color: "#BDBDBD" }, tooltip: { backgroundColor: "#3A3A3A", color: "#FFF8E1" } }, edges: { stroke: "#965039" }, midpoints: { stroke: "#965039", fill: "#1E1E1E", tooltip: { backgroundColor: "#3A3A3A", color: "#FFF8E1" } }, controls: { backgroundColor: "#1E1E1E", buttonColor: "#1E1E1E", color: "#BDBDBD", border: "1px solid #3A3A3A" }, title: { color: "#FFF8E1", subtitle: { color: "#BDBDBD" } } } } }, Ao = { style: { chart: { backgroundColor: "#1A1A1A", color: "#99AA99", backgroundPattern: { dotColor: "#2f3d2f" }, nodes: { stroke: "#66CC66", backgroundColor: "#2A2A2A", labels: { color: "#99AA99" }, tooltip: { backgroundColor: "#3A3A3A", color: "#99AA99" } }, edges: { stroke: "#66CC66" }, midpoints: { stroke: "#66CC66", fill: "#1A1A1A", tooltip: { backgroundColor: "#3A3A3A", color: "#99AA99" } }, controls: { backgroundColor: "#1A1A1A", buttonColor: "#1A1A1A", color: "#99AA99", border: "1px solid #1e361e" }, title: { color: "#66CC66", subtitle: { color: "#99AA99" } } } } }, So = { style: { chart: { backgroundColor: "#fbfafa", color: "#8A9892", backgroundPattern: { dotColor: "#dbcfc5" }, nodes: { stroke: "#8F837A", backgroundColor: "#ffffff", labels: { color: "#8A9892" }, tooltip: { backgroundColor: "#8F837A", color: "#fbfafa" } }, edges: { stroke: "#8F837A" }, midpoints: { stroke: "#8F837A", fill: "#fbfafa", tooltip: { backgroundColor: "#8F837A", color: "#fbfafa" } }, controls: { backgroundColor: "#fbfafa", buttonColor: "#fbfafa", color: "#99AA99", border: "1px solid #ebded3" }, title: { color: "#8A9892", subtitle: { color: "#99AA99" } } } } }, Lo = { style: { chart: { backgroundColor: "#f6f6fb", color: "#50606C", backgroundPattern: { dotColor: "#c3cfd9" }, layout: { arrowShape: "normal", curvedEdges: !1 }, nodes: { stroke: "#50606C", backgroundColor: "#ffffff", borderRadius: 0, labels: { color: "#50606C" }, tooltip: { backgroundColor: "#50606C", color: "#f6f6fb" } }, edges: { stroke: "#50606C" }, midpoints: { stroke: "#50606C", fill: "#fbfafa", tooltip: { backgroundColor: "#50606C", color: "#f6f6fb" } }, controls: { backgroundColor: "#f6f6fb", buttonColor: "#f6f6fb", color: "#50606C", border: "1px solid #98aab8", borderRadius: "0" }, title: { color: "#50606C", subtitle: { color: "#718890" } } } } }, Mo = {
|
|
1896
|
+
default: {},
|
|
1897
|
+
dark: _o,
|
|
1898
|
+
celebration: xo,
|
|
1899
|
+
celebrationNight: No,
|
|
1900
|
+
hack: Ao,
|
|
1901
|
+
zen: So,
|
|
1902
|
+
concrete: Lo
|
|
1903
|
+
}, vi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1904
|
+
__proto__: null,
|
|
1905
|
+
celebration: xo,
|
|
1906
|
+
celebrationNight: No,
|
|
1907
|
+
concrete: Lo,
|
|
1908
|
+
dark: _o,
|
|
1909
|
+
default: Mo,
|
|
1910
|
+
hack: Ao,
|
|
1911
|
+
zen: So
|
|
1912
|
+
}, Symbol.toStringTag, { value: "Module" })), _r = ["id"], xr = {
|
|
1913
|
+
key: 0,
|
|
1914
|
+
class: "dag-chart-error"
|
|
1915
|
+
}, Nr = ["viewBox", "xmlns"], Ar = { key: 0 }, Sr = ["id", "width", "height"], Lr = ["cx", "cy", "r", "fill"], Mr = ["x", "y", "width", "height", "fill"], Or = { key: 2 }, Dr = ["id", "markerWidth", "markerHeight", "refX", "refY"], Rr = ["d", "fill", "stroke"], Tr = ["d", "fill", "stroke"], Pr = { class: "vue-ui-dag-edges" }, Fr = ["d", "stroke", "stroke-width"], $r = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseenter"], Br = { class: "vue-ui-dag-nodes" }, zr = ["onClick", "onMouseenter"], Vr = ["x", "y", "width", "height", "rx", "fill", "stroke", "stroke-width"], Ir = ["x", "y", "font-size", "fill", "font-weight"], Gr = ["x", "y", "font-size", "fill", "font-weight", "innerHTML"], jr = { key: 1 }, Wr = ["x", "y", "width", "height"], Yr = { class: "vue-ui-dag-edges" }, Hr = ["d", "stroke-width", "marker-end"], Ur = {
|
|
1916
|
+
key: 6,
|
|
1917
|
+
class: "vue-data-ui-watermark"
|
|
1918
|
+
}, Zr = ["data-position"], Xr = { key: 0 }, qr = ["data-position"], Kr = { key: 0 }, lo = 1.5, Jr = {
|
|
1919
|
+
__name: "vue-ui-dag",
|
|
1920
|
+
props: {
|
|
1921
|
+
dataset: {
|
|
1922
|
+
type: Object,
|
|
1923
|
+
default() {
|
|
1924
|
+
return {
|
|
1925
|
+
nodes: [],
|
|
1926
|
+
edges: []
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
config: {
|
|
1931
|
+
type: Object,
|
|
1932
|
+
default() {
|
|
1933
|
+
return {};
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
},
|
|
1937
|
+
emits: ["onNodeClick", "onMidpointEnter", "onMidpointLeave"],
|
|
1938
|
+
setup(e, { expose: t, emit: o }) {
|
|
1939
|
+
const n = et(() => import("./PenAndPaper-Cjiyv0O9.js")), s = et(() => import("./UserOptions-DKK-Opvk.js")), i = et(() => import("./PackageVersion-BuFi5-eQ.js")), { vue_ui_dag: r } = wn(), { isThemeValid: a, warnInvalidTheme: l } = _n(), c = e, d = o, m = y(null), g = y(ut()), b = y(null), N = y(null), _ = y(null), P = y(0), J = y(0), be = y(!1), ue = y(!1), F = y(null), I = y(null), u = y(Ye()), j = y(u.value.style.chart.width), Q = y(u.value.style.chart.height), Re = y({ x: 0, y: 0 }), G = y(null), Te = y(null), Pe = y({ left: "0px", top: "0px" }), we = y("top"), ne = y(!1), gt = y({ x: 0, y: 0 }), vt = y({ x: 0, y: 0 }), ye = y(null), Ge = y(null), je = y({ left: "0px", top: "0px" }), pt = y("top"), Fe = y(!1), ke = y(!1), { svgRef: se } = Nn({ config: u.value.style.chart.title }), { userOptionsVisible: We, setUserOptionsVisibility: bt, keepUserOptionState: wt } = xn({ config: u.value }), ee = y(u.value.style.chart.layout.rankDirection), { loading: Ee, FINAL_DATASET: yt, manualLoading: kt } = yn({
|
|
1940
|
+
...an(c),
|
|
1941
|
+
FINAL_CONFIG: u,
|
|
1942
|
+
prepareConfig: Ye,
|
|
1943
|
+
skeletonDataset: {
|
|
1944
|
+
nodes: [
|
|
1945
|
+
{ id: "A", label: "" },
|
|
1946
|
+
{ id: "B", label: "" },
|
|
1947
|
+
{ id: "C", label: "" }
|
|
1948
|
+
],
|
|
1949
|
+
edges: [
|
|
1950
|
+
{ from: "A", to: "B" },
|
|
1951
|
+
{ from: "A", to: "C" }
|
|
1952
|
+
]
|
|
1953
|
+
},
|
|
1954
|
+
skeletonConfig: fn({
|
|
1955
|
+
defaultConfig: u.value,
|
|
1956
|
+
userConfig: {
|
|
1957
|
+
userOptions: { show: !1 },
|
|
1958
|
+
style: {
|
|
1959
|
+
chart: {
|
|
1960
|
+
backgroundColor: "#99999930",
|
|
1961
|
+
nodes: {
|
|
1962
|
+
stroke: "#CCCCCC",
|
|
1963
|
+
backgroundColor: "#DDDDDD50"
|
|
1964
|
+
},
|
|
1965
|
+
edges: {
|
|
1966
|
+
stroke: "#CCCCCC"
|
|
1967
|
+
},
|
|
1968
|
+
midpoints: {
|
|
1969
|
+
stroke: "#CCCCCC",
|
|
1970
|
+
fill: "#CCCCCC"
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
})
|
|
1976
|
+
});
|
|
1977
|
+
function Ye() {
|
|
1978
|
+
const f = nt({
|
|
1979
|
+
userConfig: c.config,
|
|
1980
|
+
defaultConfig: r
|
|
1981
|
+
}), p = f.theme;
|
|
1982
|
+
if (!p) return f;
|
|
1983
|
+
if (!a.value(f))
|
|
1984
|
+
return l(f), f;
|
|
1985
|
+
const h = nt({
|
|
1986
|
+
userConfig: Mo[p] || c.config,
|
|
1987
|
+
defaultConfig: f
|
|
1988
|
+
});
|
|
1989
|
+
return nt({
|
|
1990
|
+
userConfig: c.config,
|
|
1991
|
+
defaultConfig: h
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
const He = H(() => !!u.value.debug);
|
|
1995
|
+
It(async () => {
|
|
1996
|
+
hn(c.dataset) && (Ht({
|
|
1997
|
+
componentName: "VueUiDag",
|
|
1998
|
+
type: "dataset",
|
|
1999
|
+
debug: He.value
|
|
2000
|
+
}), ue.value = !1, kt.value = !0), c.dataset.nodes || (Ht({
|
|
2001
|
+
componentName: "VueUiDag",
|
|
2002
|
+
type: "datasetAttributeEmpty",
|
|
2003
|
+
property: "nodes",
|
|
2004
|
+
index: 0,
|
|
2005
|
+
debug: He.value
|
|
2006
|
+
}), ue.value = !1, kt.value = !0), ue.value = !0, await Ne(), zt();
|
|
2007
|
+
}), Ae(() => c.config, async (f) => {
|
|
2008
|
+
Ee.value || (u.value = Ye()), We.value = !u.value.userOptions.showOnChartHover, P.value += 1, ee.value = u.value.style.chart.layout.rankDirection, j.value = u.value.style.chart.width, Q.value = u.value.style.chart.height, de.value = u.value.style.chart.zoom.active, await Ne(), zt();
|
|
2009
|
+
}, { deep: !0 });
|
|
2010
|
+
const { isPrinting: Et, isImaging: Ct, generatePdf: _t, generateImage: xt } = En({
|
|
2011
|
+
elementId: `dag_${g.value}`,
|
|
2012
|
+
fileName: u.value.style.chart.title.text || "vue-ui-dag",
|
|
2013
|
+
options: u.value.userOptions.print
|
|
2014
|
+
}), Oo = H(() => u.value.style.chart.backgroundColor), Do = H(() => u.value.style.chart.title), { exportSvg: Ro, getSvg: To } = Cn({
|
|
2015
|
+
svg: se,
|
|
2016
|
+
title: Do,
|
|
2017
|
+
legend: void 0,
|
|
2018
|
+
legendItems: void 0,
|
|
2019
|
+
backgroundColor: Oo
|
|
2020
|
+
});
|
|
2021
|
+
async function Nt({ isCb: f }) {
|
|
2022
|
+
if (f) {
|
|
2023
|
+
const { blob: p, url: h, text: w, dataUrl: O } = await To();
|
|
2024
|
+
u.value.userOptions.callbacks.svg({ blob: p, url: h, text: w, dataUrl: O });
|
|
2025
|
+
} else
|
|
2026
|
+
Ro();
|
|
2027
|
+
}
|
|
2028
|
+
function Po() {
|
|
2029
|
+
be.value = !0, bt(!0);
|
|
2030
|
+
}
|
|
2031
|
+
function Fo() {
|
|
2032
|
+
bt(!1), be.value = !1;
|
|
2033
|
+
}
|
|
2034
|
+
function At({
|
|
2035
|
+
tooltipRef: f,
|
|
2036
|
+
isVisibleRef: p,
|
|
2037
|
+
anchorRef: h,
|
|
2038
|
+
styleRef: w,
|
|
2039
|
+
placementRef: O,
|
|
2040
|
+
offsetRef: A,
|
|
2041
|
+
margin: E = 24
|
|
2042
|
+
}) {
|
|
2043
|
+
return function() {
|
|
2044
|
+
const W = f.value;
|
|
2045
|
+
if (!W || !p.value) return;
|
|
2046
|
+
const S = W.getBoundingClientRect(), T = window.innerWidth, B = window.innerHeight, Y = h.value.x, q = h.value.y, U = A?.value?.x ?? 0, ae = A?.value?.y ?? 0;
|
|
2047
|
+
let D = q - ae - S.height - E, Z = Y - S.width / 2, _e = "top";
|
|
2048
|
+
if (D < E) {
|
|
2049
|
+
const he = q + ae + E;
|
|
2050
|
+
he + S.height <= B - E ? (D = he, _e = "bottom") : (D = q - S.height / 2, D < E && (D = E), D + S.height > B - E && (D = B - S.height - E), _e = "center");
|
|
2051
|
+
}
|
|
2052
|
+
Z < E && (Z = E), Z + S.width > T - E && (Z = T - S.width - E);
|
|
2053
|
+
const on = Z <= E, nn = Z + S.width >= T - E;
|
|
2054
|
+
if ((on || nn) && _e !== "center") {
|
|
2055
|
+
let he, xe;
|
|
2056
|
+
const sn = Y - U - E;
|
|
2057
|
+
T - (Y + U) - E >= sn ? (he = "right", xe = Y + U + E) : (he = "left", xe = Y - U - E - S.width), xe >= E && xe + S.width <= T - E && (Z = xe, D = q - S.height / 2, D < E && (D = E), D + S.height > B - E && (D = B - S.height - E), _e = he);
|
|
2058
|
+
}
|
|
2059
|
+
O.value = _e, w.value = {
|
|
2060
|
+
left: `${Z}px`,
|
|
2061
|
+
top: `${D}px`
|
|
2062
|
+
};
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
2065
|
+
const $o = H(() => yt.value.nodes.map((f) => ({
|
|
2066
|
+
...f,
|
|
2067
|
+
backgroundColor: f.backgroundColor ? Ut(f.backgroundColor) : u.value.style.chart.nodes.backgroundColor,
|
|
2068
|
+
color: f.color ? Ut(f.color) : u.value.style.chart.nodes.labels.color
|
|
2069
|
+
}))), Bo = H(() => yt.value.edges), zo = H(() => ({
|
|
2070
|
+
...u.value.style.chart.layout,
|
|
2071
|
+
rankDirection: ee.value
|
|
2072
|
+
})), { layoutData: k, lastError: St, arrowMarkerIdentifier: Vo } = Cr({
|
|
2073
|
+
nodes: $o,
|
|
2074
|
+
edges: Bo,
|
|
2075
|
+
configuration: zo
|
|
2076
|
+
});
|
|
2077
|
+
function Lt(f) {
|
|
2078
|
+
return k.value ? k.value.nodes.find((p) => p.id === f) : null;
|
|
2079
|
+
}
|
|
2080
|
+
const Io = H(() => {
|
|
2081
|
+
if (!k.value) return [];
|
|
2082
|
+
const f = u.value.style.chart.edges.stroke, p = /* @__PURE__ */ new Set();
|
|
2083
|
+
return k.value.edges.forEach((h) => {
|
|
2084
|
+
p.add(h.original?.color || f);
|
|
2085
|
+
}), Array.from(p);
|
|
2086
|
+
});
|
|
2087
|
+
function Mt(f) {
|
|
2088
|
+
return `${Vo}-${String(f).replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
2089
|
+
}
|
|
2090
|
+
const Ot = H(() => {
|
|
2091
|
+
const f = j.value, p = Q.value, h = Number(f), w = Number(p), O = Number.isFinite(h) && h > 0, A = Number.isFinite(w) && w > 0;
|
|
2092
|
+
return !O && !A ? null : {
|
|
2093
|
+
width: O ? h : null,
|
|
2094
|
+
height: A ? w : null
|
|
2095
|
+
};
|
|
2096
|
+
}), Ce = y(null), de = y(u.value.style.chart.zoom.active), {
|
|
2097
|
+
viewBox: fe,
|
|
2098
|
+
resetZoom: $e,
|
|
2099
|
+
setInitialViewBox: Go,
|
|
2100
|
+
scale: Dt,
|
|
2101
|
+
zoomByFactor: Rt
|
|
2102
|
+
} = bn(
|
|
2103
|
+
se,
|
|
2104
|
+
{ x: 0, y: 0, width: 100, height: 100 },
|
|
2105
|
+
1,
|
|
2106
|
+
de,
|
|
2107
|
+
() => {
|
|
2108
|
+
ne.value = !1;
|
|
2109
|
+
}
|
|
2110
|
+
);
|
|
2111
|
+
function jo() {
|
|
2112
|
+
de.value = !de.value;
|
|
2113
|
+
}
|
|
2114
|
+
function Tt() {
|
|
2115
|
+
const f = k.value && k.value.viewBox;
|
|
2116
|
+
if (!f) return;
|
|
2117
|
+
const p = String(f).split(" ").map(Number);
|
|
2118
|
+
if (p.length !== 4) return;
|
|
2119
|
+
const [h, w, O, A] = p;
|
|
2120
|
+
if (!Number.isFinite(h) || !Number.isFinite(w) || !Number.isFinite(O) || !Number.isFinite(A))
|
|
2121
|
+
return;
|
|
2122
|
+
let E = O, R = A, W = h, S = w;
|
|
2123
|
+
const T = Ot.value;
|
|
2124
|
+
T && (T.width !== null && (E = T.width), T.height !== null && (R = T.height), W = h - (E - O) / 2, S = w - (R - A) / 2), Go(
|
|
2125
|
+
{ x: W, y: S, width: E, height: R },
|
|
2126
|
+
{ overwriteCurrentIfNotZoomed: !0 }
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2129
|
+
Ae(
|
|
2130
|
+
() => k.value && k.value.viewBox,
|
|
2131
|
+
() => {
|
|
2132
|
+
Tt();
|
|
2133
|
+
},
|
|
2134
|
+
{ immediate: !0 }
|
|
2135
|
+
), Ae(
|
|
2136
|
+
() => Ot.value,
|
|
2137
|
+
() => {
|
|
2138
|
+
Tt();
|
|
2139
|
+
}
|
|
2140
|
+
), Ae(() => ke.value, (f) => {
|
|
2141
|
+
de.value = !f;
|
|
2142
|
+
});
|
|
2143
|
+
const Wo = H(() => {
|
|
2144
|
+
const f = fe.value;
|
|
2145
|
+
return f ? `${f.x} ${f.y} ${f.width} ${f.height}` : "0 0 0 0";
|
|
2146
|
+
}), re = y(!1);
|
|
2147
|
+
function Pt(f) {
|
|
2148
|
+
re.value = f, J.value += 1;
|
|
2149
|
+
}
|
|
2150
|
+
function Ue() {
|
|
2151
|
+
ke.value = !ke.value;
|
|
2152
|
+
}
|
|
2153
|
+
function Ze() {
|
|
2154
|
+
Rt(lo, !0);
|
|
2155
|
+
}
|
|
2156
|
+
function Xe() {
|
|
2157
|
+
Rt(1 / lo, !0);
|
|
2158
|
+
}
|
|
2159
|
+
const qe = ["TB", "RL", "BT", "LR"];
|
|
2160
|
+
function Ke() {
|
|
2161
|
+
ee.value = qe[(qe.indexOf(ee.value) + 1) % qe.length], $e();
|
|
2162
|
+
}
|
|
2163
|
+
const Yo = At({
|
|
2164
|
+
tooltipRef: Te,
|
|
2165
|
+
isVisibleRef: Fe,
|
|
2166
|
+
anchorRef: Re,
|
|
2167
|
+
styleRef: Pe,
|
|
2168
|
+
placementRef: we
|
|
2169
|
+
}), Ho = At({
|
|
2170
|
+
tooltipRef: Ge,
|
|
2171
|
+
isVisibleRef: ne,
|
|
2172
|
+
anchorRef: gt,
|
|
2173
|
+
styleRef: je,
|
|
2174
|
+
placementRef: pt,
|
|
2175
|
+
offsetRef: vt
|
|
2176
|
+
});
|
|
2177
|
+
async function Uo(f) {
|
|
2178
|
+
d("onMidpointEnter", f);
|
|
2179
|
+
const p = se.value;
|
|
2180
|
+
if (!p || !f?.midpoint) return;
|
|
2181
|
+
const h = p.createSVGPoint();
|
|
2182
|
+
h.x = f.midpoint.x, h.y = f.midpoint.y;
|
|
2183
|
+
const w = p.getScreenCTM();
|
|
2184
|
+
if (!w) return;
|
|
2185
|
+
const O = h.matrixTransform(w);
|
|
2186
|
+
Re.value = {
|
|
2187
|
+
x: O.x,
|
|
2188
|
+
y: O.y
|
|
2189
|
+
}, G.value = f, Fe.value = !0, await Ne(), Yo();
|
|
2190
|
+
}
|
|
2191
|
+
function Zo() {
|
|
2192
|
+
Fe.value = !1, G.value = null, d("onMidpointLeave");
|
|
2193
|
+
}
|
|
2194
|
+
async function Xo(f) {
|
|
2195
|
+
if (d("onNodeClick", f), !u.value.style.chart.nodes.tooltip.showOnClick) return;
|
|
2196
|
+
const p = se.value;
|
|
2197
|
+
if (!p) return;
|
|
2198
|
+
const h = p.createSVGPoint();
|
|
2199
|
+
h.x = f.x, h.y = f.y;
|
|
2200
|
+
const w = p.getScreenCTM();
|
|
2201
|
+
if (!w) return;
|
|
2202
|
+
const O = h.matrixTransform(w), A = u.value.style.chart.layout.nodeWidth, E = u.value.style.chart.layout.nodeHeight, R = w.a, W = w.d, S = A * R, T = E * W;
|
|
2203
|
+
vt.value = {
|
|
2204
|
+
x: S / 2,
|
|
2205
|
+
y: T / 2
|
|
2206
|
+
}, gt.value = {
|
|
2207
|
+
x: O.x,
|
|
2208
|
+
y: O.y
|
|
2209
|
+
}, ye.value = f, ne.value = !0, await Ne(), Ho();
|
|
2210
|
+
}
|
|
2211
|
+
function Ft() {
|
|
2212
|
+
ne.value = !1, ye.value = null;
|
|
2213
|
+
}
|
|
2214
|
+
function $t(f) {
|
|
2215
|
+
if (!ne.value) return;
|
|
2216
|
+
const p = Ge.value;
|
|
2217
|
+
if (p && p.contains(f.target))
|
|
2218
|
+
return;
|
|
2219
|
+
const h = se.value;
|
|
2220
|
+
h && h.contains(f.target) && f.target.closest(".vue-ui-dag-node") || Ft();
|
|
2221
|
+
}
|
|
2222
|
+
function Bt(f) {
|
|
2223
|
+
f.key === "Escape" && ne.value && Ft();
|
|
2224
|
+
}
|
|
2225
|
+
It(() => {
|
|
2226
|
+
document.addEventListener("mousedown", $t), document.addEventListener("keydown", Bt);
|
|
2227
|
+
}), Gt(() => {
|
|
2228
|
+
document.removeEventListener("mousedown", $t), document.removeEventListener("keydown", Bt), F.value && (I.value && F.value.unobserve(I.value), F.value.disconnect());
|
|
2229
|
+
});
|
|
2230
|
+
function zt() {
|
|
2231
|
+
if (!u.value.responsive) {
|
|
2232
|
+
F.value && (I.value && F.value.unobserve(I.value), F.value.disconnect(), F.value = null, I.value = null);
|
|
2233
|
+
return;
|
|
2234
|
+
}
|
|
2235
|
+
const f = vn(() => {
|
|
2236
|
+
if (!m.value) return;
|
|
2237
|
+
const { width: p, height: h } = pn({
|
|
2238
|
+
chart: m.value,
|
|
2239
|
+
title: u.value.style.chart.title.text ? b.value : null,
|
|
2240
|
+
legend: u.value.style.chart.controls.show ? _.value?.$el : null,
|
|
2241
|
+
source: N.value
|
|
2242
|
+
});
|
|
2243
|
+
requestAnimationFrame(() => {
|
|
2244
|
+
j.value = Math.max(0.1, p), Q.value = Math.max(0.1, h - 12);
|
|
2245
|
+
});
|
|
2246
|
+
});
|
|
2247
|
+
F.value && (I.value && F.value.unobserve(I.value), F.value.disconnect()), F.value = new ResizeObserver(f), I.value = m.value ? m.value.parentNode : null, I.value && F.value.observe(I.value), f();
|
|
2248
|
+
}
|
|
2249
|
+
function qo(f, p = {}) {
|
|
2250
|
+
const {
|
|
2251
|
+
direction: h = -1,
|
|
2252
|
+
mode: w = "oneLapNearest",
|
|
2253
|
+
dasharray: O = null
|
|
2254
|
+
} = p;
|
|
2255
|
+
if (!f || typeof f.getTotalLength != "function")
|
|
2256
|
+
return He.value && console.warn(
|
|
2257
|
+
"VueUiDag @getIdealDashoffsetDelta: invalid path element",
|
|
2258
|
+
f
|
|
2259
|
+
), 0;
|
|
2260
|
+
const A = f.getTotalLength(), E = O ?? f.getAttribute("stroke-dasharray") ?? (typeof getComputedStyle == "function" ? getComputedStyle(f).strokeDasharray : ""), R = Y(E);
|
|
2261
|
+
if (!Number.isFinite(R) || R <= 0)
|
|
2262
|
+
return h * A;
|
|
2263
|
+
const W = Math.max(1, Math.round(A / R)), S = Math.max(1, Math.ceil(A / R)), T = Math.max(1, Math.floor(A / R));
|
|
2264
|
+
let B;
|
|
2265
|
+
return w === "pattern" ? B = R : w === "oneLapCeil" ? B = S * R : w === "oneLapFloor" ? B = T * R : B = W * R, h * B;
|
|
2266
|
+
function Y(q) {
|
|
2267
|
+
if (!q || q === "none") return NaN;
|
|
2268
|
+
const U = String(q).replace(/,/g, " ").trim().split(/\s+/).map((D) => Number.parseFloat(D)).filter((D) => Number.isFinite(D));
|
|
2269
|
+
if (!U.length) return NaN;
|
|
2270
|
+
const ae = U.reduce((D, Z) => D + Z, 0);
|
|
2271
|
+
return U.length % 2 === 1 ? ae * 2 : ae;
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
const Je = y(/* @__PURE__ */ new Map()), Qe = y(/* @__PURE__ */ new Map());
|
|
2275
|
+
function Ko(f) {
|
|
2276
|
+
return function(h) {
|
|
2277
|
+
h ? Je.value.set(f, h) : Je.value.delete(f);
|
|
2278
|
+
};
|
|
2279
|
+
}
|
|
2280
|
+
function Vt() {
|
|
2281
|
+
Qe.value.forEach((f) => {
|
|
2282
|
+
try {
|
|
2283
|
+
f.cancel();
|
|
2284
|
+
} catch {
|
|
2285
|
+
}
|
|
2286
|
+
}), Qe.value.clear();
|
|
2287
|
+
}
|
|
2288
|
+
function Jo() {
|
|
2289
|
+
Vt();
|
|
2290
|
+
const f = k.value?.edges ?? [];
|
|
2291
|
+
if (!f.length) return;
|
|
2292
|
+
const p = u.value.style.chart.edges.animations, h = Number(p.referenceDistance) > 0 ? Number(p.referenceDistance) : 24;
|
|
2293
|
+
f.forEach((w) => {
|
|
2294
|
+
if (!!!w?.original?.animated) return;
|
|
2295
|
+
const A = Je.value.get(w.id);
|
|
2296
|
+
if (!A) return;
|
|
2297
|
+
const E = w?.original?.dasharray ?? p.dasharray;
|
|
2298
|
+
A.style.strokeDasharray = String(E), A.style.strokeDashoffset = "0";
|
|
2299
|
+
const R = ![void 0, null].includes(w?.original?.animationDirection), W = ![void 0, null].includes(p.animationDirection), S = R ? Number(w.original.animationDirection) : W ? Number(p.animationDirection) : -1, T = qo(A, {
|
|
2300
|
+
direction: S,
|
|
2301
|
+
mode: "oneLapNearest",
|
|
2302
|
+
dasharray: String(E)
|
|
2303
|
+
}), B = w?.original?.animationDurationMs ?? p.animationDurationMs ?? 1e3, Y = Number(B), U = Number.isFinite(Y) && Y > 0 ? h / Y : h / 1e3, ae = Math.max(1, Math.round(Math.abs(T) / Math.max(1e-9, U))), D = A.animate(
|
|
2304
|
+
[{ strokeDashoffset: 0 }, { strokeDashoffset: T }],
|
|
2305
|
+
{ duration: ae, iterations: 1 / 0, easing: "linear" }
|
|
2306
|
+
);
|
|
2307
|
+
Qe.value.set(w.id, D);
|
|
2308
|
+
});
|
|
2309
|
+
}
|
|
2310
|
+
Ae(
|
|
2311
|
+
() => k.value && k.value.edges,
|
|
2312
|
+
async () => {
|
|
2313
|
+
await Ne(), Jo();
|
|
2314
|
+
},
|
|
2315
|
+
{ deep: !0, immediate: !0 }
|
|
2316
|
+
), Gt(() => {
|
|
2317
|
+
Vt();
|
|
2318
|
+
});
|
|
2319
|
+
async function Qo({ scale: f = 2 } = {}) {
|
|
2320
|
+
if (!m.value) return;
|
|
2321
|
+
const { width: p, height: h } = m.value.getBoundingClientRect(), w = p / h, { imageUri: O, base64: A } = await Sn({ domElement: m.value, base64: !0, img: !0, scale: f });
|
|
2322
|
+
return {
|
|
2323
|
+
imageUri: O,
|
|
2324
|
+
base64: A,
|
|
2325
|
+
title: u.value.style.chart.title.text ?? "vue-ui-dag",
|
|
2326
|
+
width: p,
|
|
2327
|
+
height: h,
|
|
2328
|
+
aspectRatio: w
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
2331
|
+
const ie = H(() => {
|
|
2332
|
+
const f = Number(u.value.style.chart.layout.nodeHeight);
|
|
2333
|
+
return Number.isFinite(f) && f > 0 ? f / u.value.style.chart.backgroundPattern.spacingRatio : 12;
|
|
2334
|
+
}), en = H(() => ie.value * (u.value.style.chart.backgroundPattern.dotRadiusRatio / 100));
|
|
2335
|
+
function tn() {
|
|
2336
|
+
return k.value;
|
|
2337
|
+
}
|
|
2338
|
+
return t({
|
|
2339
|
+
getData: tn,
|
|
2340
|
+
getImage: Qo,
|
|
2341
|
+
generatePdf: _t,
|
|
2342
|
+
generateSvg: Nt,
|
|
2343
|
+
generateImage: xt,
|
|
2344
|
+
toggleAnnotator: Ue,
|
|
2345
|
+
toggleFullscreen: Pt,
|
|
2346
|
+
zoomIn: Ze,
|
|
2347
|
+
zoomOut: Xe,
|
|
2348
|
+
resetZoom: $e,
|
|
2349
|
+
switchDirection: Ke
|
|
2350
|
+
}), (f, p) => (C(), x("div", {
|
|
2351
|
+
class: jt(`vue-data-ui-component vue-ui-dag ${re.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${u.value.responsive ? "vue-ui-dag-responsive" : ""}`),
|
|
2352
|
+
id: `dag_${g.value}`,
|
|
2353
|
+
ref_key: "dagChart",
|
|
2354
|
+
ref: m,
|
|
2355
|
+
style: le({
|
|
2356
|
+
fontFamily: u.value.style.fontFamily,
|
|
2357
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2358
|
+
padding: "0.5rem"
|
|
2359
|
+
}),
|
|
2360
|
+
onMouseenter: Po,
|
|
2361
|
+
onMouseleave: Fo
|
|
2362
|
+
}, [
|
|
2363
|
+
v(St) ? (C(), x("div", xr, Se(String(v(St))), 1)) : L("", !0),
|
|
2364
|
+
u.value.userOptions.buttons.annotator ? (C(), te(v(n), {
|
|
2365
|
+
key: 1,
|
|
2366
|
+
svgRef: v(se),
|
|
2367
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2368
|
+
color: u.value.style.chart.color,
|
|
2369
|
+
active: ke.value,
|
|
2370
|
+
onClose: Ue
|
|
2371
|
+
}, {
|
|
2372
|
+
"annotator-action-close": $(() => [
|
|
2373
|
+
M(f.$slots, "annotator-action-close", {}, void 0, !0)
|
|
2374
|
+
]),
|
|
2375
|
+
"annotator-action-color": $(({ color: h }) => [
|
|
2376
|
+
M(f.$slots, "annotator-action-color", z(V({ color: h })), void 0, !0)
|
|
2377
|
+
]),
|
|
2378
|
+
"annotator-action-draw": $(({ mode: h }) => [
|
|
2379
|
+
M(f.$slots, "annotator-action-draw", z(V({ mode: h })), void 0, !0)
|
|
2380
|
+
]),
|
|
2381
|
+
"annotator-action-undo": $(({ disabled: h }) => [
|
|
2382
|
+
M(f.$slots, "annotator-action-undo", z(V({ disabled: h })), void 0, !0)
|
|
2383
|
+
]),
|
|
2384
|
+
"annotator-action-redo": $(({ disabled: h }) => [
|
|
2385
|
+
M(f.$slots, "annotator-action-redo", z(V({ disabled: h })), void 0, !0)
|
|
2386
|
+
]),
|
|
2387
|
+
"annotator-action-delete": $(({ disabled: h }) => [
|
|
2388
|
+
M(f.$slots, "annotator-action-delete", z(V({ disabled: h })), void 0, !0)
|
|
2389
|
+
]),
|
|
2390
|
+
_: 3
|
|
2391
|
+
}, 8, ["svgRef", "backgroundColor", "color", "active"])) : L("", !0),
|
|
2392
|
+
u.value.userOptions.show && ue.value && (v(wt) || v(We)) ? (C(), te(v(s), {
|
|
2393
|
+
ref: "userOptionsRef",
|
|
2394
|
+
key: `user_option_${J.value}`,
|
|
2395
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2396
|
+
color: u.value.style.chart.color,
|
|
2397
|
+
isPrinting: v(Et),
|
|
2398
|
+
isImaging: v(Ct),
|
|
2399
|
+
uid: g.value,
|
|
2400
|
+
hasTooltip: !1,
|
|
2401
|
+
hasTable: !1,
|
|
2402
|
+
hasXls: !1,
|
|
2403
|
+
hasLabel: !1,
|
|
2404
|
+
hasPdf: u.value.userOptions.buttons.pdf,
|
|
2405
|
+
hasImg: u.value.userOptions.buttons.img,
|
|
2406
|
+
hasSvg: u.value.userOptions.buttons.svg,
|
|
2407
|
+
hasFullscreen: u.value.userOptions.buttons.fullscreen,
|
|
2408
|
+
isFullscreen: re.value,
|
|
2409
|
+
chartElement: m.value,
|
|
2410
|
+
position: u.value.userOptions.position,
|
|
2411
|
+
titles: { ...u.value.userOptions.buttonTitles },
|
|
2412
|
+
hasAnnotator: u.value.userOptions.buttons.annotator,
|
|
2413
|
+
isAnnotation: ke.value,
|
|
2414
|
+
callbacks: u.value.userOptions.callbacks,
|
|
2415
|
+
printScale: u.value.userOptions.print.scale,
|
|
2416
|
+
hasZoom: u.value.userOptions.buttons.zoom,
|
|
2417
|
+
isZoom: de.value,
|
|
2418
|
+
onToggleFullscreen: Pt,
|
|
2419
|
+
onGeneratePdf: v(_t),
|
|
2420
|
+
onGenerateImage: v(xt),
|
|
2421
|
+
onGenerateSvg: Nt,
|
|
2422
|
+
onToggleAnnotator: Ue,
|
|
2423
|
+
onToggleZoom: jo,
|
|
2424
|
+
style: le({
|
|
2425
|
+
visibility: v(wt) ? v(We) ? "visible" : "hidden" : "visible"
|
|
2426
|
+
})
|
|
2427
|
+
}, ln({ _: 2 }, [
|
|
2428
|
+
f.$slots.menuIcon ? {
|
|
2429
|
+
name: "menuIcon",
|
|
2430
|
+
fn: $(({ isOpen: h, color: w }) => [
|
|
2431
|
+
M(f.$slots, "menuIcon", z(V({ isOpen: h, color: w })), void 0, !0)
|
|
2432
|
+
]),
|
|
2433
|
+
key: "0"
|
|
2434
|
+
} : void 0,
|
|
2435
|
+
f.$slots.optionPdf ? {
|
|
2436
|
+
name: "optionPdf",
|
|
2437
|
+
fn: $(() => [
|
|
2438
|
+
M(f.$slots, "optionPdf", {}, void 0, !0)
|
|
2439
|
+
]),
|
|
2440
|
+
key: "1"
|
|
2441
|
+
} : void 0,
|
|
2442
|
+
f.$slots.optionImg ? {
|
|
2443
|
+
name: "optionImg",
|
|
2444
|
+
fn: $(() => [
|
|
2445
|
+
M(f.$slots, "optionImg", {}, void 0, !0)
|
|
2446
|
+
]),
|
|
2447
|
+
key: "2"
|
|
2448
|
+
} : void 0,
|
|
2449
|
+
f.$slots.optionSvg ? {
|
|
2450
|
+
name: "optionSvg",
|
|
2451
|
+
fn: $(() => [
|
|
2452
|
+
M(f.$slots, "optionSvg", {}, void 0, !0)
|
|
2453
|
+
]),
|
|
2454
|
+
key: "3"
|
|
2455
|
+
} : void 0,
|
|
2456
|
+
f.$slots.optionFullscreen ? {
|
|
2457
|
+
name: "optionFullscreen",
|
|
2458
|
+
fn: $(({ toggleFullscreen: h, isFullscreen: w }) => [
|
|
2459
|
+
M(f.$slots, "optionFullscreen", z(V({ toggleFullscreen: h, isFullscreen: w })), void 0, !0)
|
|
2460
|
+
]),
|
|
2461
|
+
key: "4"
|
|
2462
|
+
} : void 0,
|
|
2463
|
+
f.$slots.optionAnnotator ? {
|
|
2464
|
+
name: "optionAnnotator",
|
|
2465
|
+
fn: $(({ toggleAnnotator: h, isAnnotator: w }) => [
|
|
2466
|
+
M(f.$slots, "optionAnnotator", z(V({ toggleAnnotator: h, isAnnotator: w })), void 0, !0)
|
|
2467
|
+
]),
|
|
2468
|
+
key: "5"
|
|
2469
|
+
} : void 0,
|
|
2470
|
+
f.$slots.optionZoom ? {
|
|
2471
|
+
name: "optionZoom",
|
|
2472
|
+
fn: $(({ toggleZoom: h, isZoomLocked: w }) => [
|
|
2473
|
+
M(f.$slots, "optionZoom", z(V({ toggleZoom: h, isZoomLocked: w })), void 0, !0)
|
|
2474
|
+
]),
|
|
2475
|
+
key: "6"
|
|
2476
|
+
} : void 0
|
|
2477
|
+
]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasSvg", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "hasZoom", "isZoom", "onGeneratePdf", "onGenerateImage", "style"])) : L("", !0),
|
|
2478
|
+
u.value.style.chart.title.text ? (C(), x("div", {
|
|
2479
|
+
key: 3,
|
|
2480
|
+
ref_key: "chartTitle",
|
|
2481
|
+
ref: b,
|
|
2482
|
+
style: "width:100%;background:transparent;"
|
|
2483
|
+
}, [
|
|
2484
|
+
(C(), te(An, {
|
|
2485
|
+
key: `title_${P.value}`,
|
|
2486
|
+
config: {
|
|
2487
|
+
title: {
|
|
2488
|
+
cy: "dag-title",
|
|
2489
|
+
...u.value.style.chart.title
|
|
2490
|
+
},
|
|
2491
|
+
subtitle: {
|
|
2492
|
+
cy: "dag-subtitle",
|
|
2493
|
+
...u.value.style.chart.title.subtitle
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
}, null, 8, ["config"]))
|
|
2497
|
+
], 512)) : L("", !0),
|
|
2498
|
+
u.value.style.chart.controls.position === "top" && !v(Ee) && u.value.style.chart.controls.show ? (C(), te(Zt, {
|
|
2499
|
+
key: 4,
|
|
2500
|
+
ref_key: "zoomControls",
|
|
2501
|
+
ref: _,
|
|
2502
|
+
config: u.value,
|
|
2503
|
+
scale: v(Dt),
|
|
2504
|
+
isFullscreen: re.value,
|
|
2505
|
+
withDirection: "",
|
|
2506
|
+
onZoomIn: Ze,
|
|
2507
|
+
onZoomOut: Xe,
|
|
2508
|
+
onResetZoom: p[0] || (p[0] = () => v($e)(!0)),
|
|
2509
|
+
onSwitchDirection: Ke
|
|
2510
|
+
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2511
|
+
v(k) ? (C(), x("svg", {
|
|
2512
|
+
key: 5,
|
|
2513
|
+
ref_key: "svgRef",
|
|
2514
|
+
ref: se,
|
|
2515
|
+
class: jt({ "vue-ui-dag-svg": !0, "vue-data-ui-loading": v(Ee) }),
|
|
2516
|
+
viewBox: Wo.value,
|
|
2517
|
+
xmlns: v(mn),
|
|
2518
|
+
style: le({
|
|
2519
|
+
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2520
|
+
height: "100%",
|
|
2521
|
+
width: "100%"
|
|
2522
|
+
})
|
|
2523
|
+
}, [
|
|
2524
|
+
tt(v(i)),
|
|
2525
|
+
u.value.style.chart.backgroundPattern.show ? (C(), x("defs", Ar, [
|
|
2526
|
+
K("pattern", {
|
|
2527
|
+
id: `dag_bg_pattern_${g.value}`,
|
|
2528
|
+
patternUnits: "userSpaceOnUse",
|
|
2529
|
+
width: ie.value,
|
|
2530
|
+
height: ie.value
|
|
2531
|
+
}, [
|
|
2532
|
+
M(f.$slots, "background-pattern", z(V({
|
|
2533
|
+
x: ie.value / 2,
|
|
2534
|
+
y: ie.value / 2,
|
|
2535
|
+
color: u.value.style.chart.backgroundPattern.dotColor
|
|
2536
|
+
})), () => [
|
|
2537
|
+
K("circle", {
|
|
2538
|
+
cx: ie.value / 2,
|
|
2539
|
+
cy: ie.value / 2,
|
|
2540
|
+
r: en.value,
|
|
2541
|
+
fill: u.value.style.chart.backgroundPattern.dotColor
|
|
2542
|
+
}, null, 8, Lr)
|
|
2543
|
+
], !0)
|
|
2544
|
+
], 8, Sr)
|
|
2545
|
+
])) : L("", !0),
|
|
2546
|
+
u.value.style.chart.backgroundPattern.show ? (C(), x("rect", {
|
|
2547
|
+
key: 1,
|
|
2548
|
+
x: v(fe)?.x ?? 0,
|
|
2549
|
+
y: v(fe)?.y ?? 0,
|
|
2550
|
+
width: v(fe)?.width ?? 0,
|
|
2551
|
+
height: v(fe)?.height ?? 0,
|
|
2552
|
+
fill: `url(#dag_bg_pattern_${g.value})`,
|
|
2553
|
+
style: le({
|
|
2554
|
+
pointerEvents: "none",
|
|
2555
|
+
opacity: u.value.style.chart.backgroundPattern.opacity
|
|
2556
|
+
})
|
|
2557
|
+
}, null, 12, Mr)) : L("", !0),
|
|
2558
|
+
v(k).arrowShape !== "undirected" ? (C(), x("defs", Or, [
|
|
2559
|
+
(C(!0), x(me, null, Be(Io.value, (h) => (C(), x("marker", {
|
|
2560
|
+
key: h,
|
|
2561
|
+
id: Mt(h),
|
|
2562
|
+
markerWidth: v(k).arrowSize,
|
|
2563
|
+
markerHeight: v(k).arrowSize,
|
|
2564
|
+
refX: v(k).arrowSize - 3,
|
|
2565
|
+
refY: v(k).arrowSize / 2,
|
|
2566
|
+
orient: "auto",
|
|
2567
|
+
markerUnits: "strokeWidth"
|
|
2568
|
+
}, [
|
|
2569
|
+
v(k).arrowShape === "normal" ? (C(), x("path", {
|
|
2570
|
+
key: 0,
|
|
2571
|
+
d: `M 0 0 L ${v(k).arrowSize} ${v(k).arrowSize / 2} L 0 ${v(k).arrowSize} Z`,
|
|
2572
|
+
fill: h,
|
|
2573
|
+
stroke: h,
|
|
2574
|
+
"stroke-width": "0"
|
|
2575
|
+
}, null, 8, Rr)) : (C(), x("path", {
|
|
2576
|
+
key: 1,
|
|
2577
|
+
d: `M 0 0 L ${v(k).arrowSize} ${v(k).arrowSize / 2} L 0 ${v(k).arrowSize} L ${v(k).arrowSize / 3} ${v(k).arrowSize / 2} Z`,
|
|
2578
|
+
fill: h,
|
|
2579
|
+
stroke: h,
|
|
2580
|
+
"stroke-width": "0"
|
|
2581
|
+
}, null, 8, Tr))
|
|
2582
|
+
], 8, Dr))), 128))
|
|
2583
|
+
])) : L("", !0),
|
|
2584
|
+
K("g", Pr, [
|
|
2585
|
+
(C(!0), x(me, null, Be(v(k).edges, (h) => (C(), x(me, {
|
|
2586
|
+
key: h.id
|
|
2587
|
+
}, [
|
|
2588
|
+
K("path", {
|
|
2589
|
+
"data-cy-edge": "",
|
|
2590
|
+
ref_for: !0,
|
|
2591
|
+
ref: Ko(h.id),
|
|
2592
|
+
d: h.pathData,
|
|
2593
|
+
fill: "none",
|
|
2594
|
+
stroke: h.original.color ?? u.value.style.chart.edges.stroke,
|
|
2595
|
+
"stroke-width": u.value.style.chart.edges.strokeWidth * (h.from === Ce.value || h.id === G.value?.id ? 2 : 1),
|
|
2596
|
+
"stroke-linecap": "round",
|
|
2597
|
+
"stroke-linejoin": "round",
|
|
2598
|
+
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2599
|
+
}, null, 8, Fr),
|
|
2600
|
+
u.value.style.chart.midpoints.show ? (C(), x("circle", {
|
|
2601
|
+
key: 0,
|
|
2602
|
+
"data-cy-midpoint": "",
|
|
2603
|
+
class: "vue-ui-dag-edge-midpoint",
|
|
2604
|
+
cx: h.midpoint.x,
|
|
2605
|
+
cy: h.midpoint.y,
|
|
2606
|
+
r: u.value.style.chart.midpoints.radius,
|
|
2607
|
+
fill: u.value.style.chart.midpoints.fill,
|
|
2608
|
+
stroke: h.original.color ?? u.value.style.chart.midpoints.stroke,
|
|
2609
|
+
"stroke-width": u.value.style.chart.midpoints.strokeWidth * (h.from === Ce.value || h.id === G.value?.id ? 2 : 1),
|
|
2610
|
+
style: { transition: "stroke-width 0.2s ease-in-out" },
|
|
2611
|
+
onMouseenter: (w) => Uo(h),
|
|
2612
|
+
onMouseleave: Zo
|
|
2613
|
+
}, null, 40, $r)) : L("", !0)
|
|
2614
|
+
], 64))), 128))
|
|
2615
|
+
]),
|
|
2616
|
+
K("g", Br, [
|
|
2617
|
+
(C(!0), x(me, null, Be(v(k).nodes, (h) => (C(), x("g", {
|
|
2618
|
+
key: h.id,
|
|
2619
|
+
class: "vue-ui-dag-node",
|
|
2620
|
+
onClick: cn((w) => u.value.style.chart.nodes.tooltip.showOnClick && Xo(h), ["stop"]),
|
|
2621
|
+
onMouseenter: (w) => Ce.value = h.id,
|
|
2622
|
+
onMouseleave: p[1] || (p[1] = (w) => Ce.value = null)
|
|
2623
|
+
}, [
|
|
2624
|
+
f.$slots.node ? L("", !0) : (C(), x(me, { key: 0 }, [
|
|
2625
|
+
K("rect", {
|
|
2626
|
+
"data-cy-node": "",
|
|
2627
|
+
x: h.x - h.width / 2,
|
|
2628
|
+
y: h.y - h.height / 2,
|
|
2629
|
+
width: h.width,
|
|
2630
|
+
height: h.height,
|
|
2631
|
+
rx: u.value.style.chart.nodes.borderRadius,
|
|
2632
|
+
fill: h.original.backgroundColor,
|
|
2633
|
+
stroke: u.value.style.chart.nodes.stroke,
|
|
2634
|
+
"stroke-width": u.value.style.chart.nodes.strokeWidth,
|
|
2635
|
+
style: le({
|
|
2636
|
+
cursor: u.value.style.chart.nodes.tooltip.showOnClick ? "pointer" : "default"
|
|
2637
|
+
})
|
|
2638
|
+
}, null, 12, Vr),
|
|
2639
|
+
f.$slots["node-label"] ? (C(), x("text", {
|
|
2640
|
+
key: 0,
|
|
2641
|
+
x: h.x,
|
|
2642
|
+
y: h.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2643
|
+
"text-anchor": "middle",
|
|
2644
|
+
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2645
|
+
fill: h.original.color,
|
|
2646
|
+
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal"
|
|
2647
|
+
}, [
|
|
2648
|
+
M(f.$slots, "node-label", ot({ ref_for: !0 }, { node: h, orientation: ee.value }), () => [
|
|
2649
|
+
un(Se(h.label), 1)
|
|
2650
|
+
], !0)
|
|
2651
|
+
], 8, Ir)) : f.$slots["free-node-label"] ? L("", !0) : (C(), x("text", {
|
|
2652
|
+
key: 1,
|
|
2653
|
+
"data-cy-node-label": "",
|
|
2654
|
+
x: h.x,
|
|
2655
|
+
y: h.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2656
|
+
"text-anchor": "middle",
|
|
2657
|
+
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2658
|
+
fill: h.original.color,
|
|
2659
|
+
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2660
|
+
innerHTML: v(gn)({
|
|
2661
|
+
content: h.label,
|
|
2662
|
+
fontSize: u.value.style.chart.nodes.labels.fontSize,
|
|
2663
|
+
fontWeight: u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2664
|
+
fill: h.original.color,
|
|
2665
|
+
x: h.x,
|
|
2666
|
+
y: h.y,
|
|
2667
|
+
autoOffset: !0
|
|
2668
|
+
})
|
|
2669
|
+
}, null, 8, Gr))
|
|
2670
|
+
], 64)),
|
|
2671
|
+
f.$slots["free-node-label"] ? (C(), x("g", jr, [
|
|
2672
|
+
M(f.$slots, "free-node-label", ot({ ref_for: !0 }, { node: h, layoutData: v(k), orientation: ee.value }), void 0, !0)
|
|
2673
|
+
])) : L("", !0),
|
|
2674
|
+
f.$slots.node ? (C(), x("foreignObject", {
|
|
2675
|
+
key: 2,
|
|
2676
|
+
x: h.x - h.width / 2,
|
|
2677
|
+
y: h.y - h.height / 2,
|
|
2678
|
+
width: h.width,
|
|
2679
|
+
height: h.height
|
|
2680
|
+
}, [
|
|
2681
|
+
M(f.$slots, "node", ot({ ref_for: !0 }, { node: h, orientation: ee.value }), void 0, !0)
|
|
2682
|
+
], 8, Wr)) : L("", !0)
|
|
2683
|
+
], 40, zr))), 128))
|
|
2684
|
+
]),
|
|
2685
|
+
K("g", Yr, [
|
|
2686
|
+
(C(!0), x(me, null, Be(v(k).edges, (h) => (C(), x("path", {
|
|
2687
|
+
key: h.id,
|
|
2688
|
+
d: h.pathData,
|
|
2689
|
+
fill: "none",
|
|
2690
|
+
stroke: "transparent",
|
|
2691
|
+
"stroke-width": u.value.style.chart.edges.strokeWidth * (h.from === Ce.value || h.id === G.value?.id ? 1.3 : 1),
|
|
2692
|
+
"stroke-linecap": "round",
|
|
2693
|
+
"stroke-linejoin": "round",
|
|
2694
|
+
"marker-end": v(k).arrowShape === "undirected" ? null : `url(#${Mt(h.original?.color || u.value.style.chart.edges.stroke)})`,
|
|
2695
|
+
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2696
|
+
}, null, 8, Hr))), 128))
|
|
2697
|
+
]),
|
|
2698
|
+
M(f.$slots, "svg", {
|
|
2699
|
+
svg: {
|
|
2700
|
+
drawingArea: v(fe),
|
|
2701
|
+
data: v(k),
|
|
2702
|
+
orientation: ee.value
|
|
2703
|
+
}
|
|
2704
|
+
}, void 0, !0)
|
|
2705
|
+
], 14, Nr)) : L("", !0),
|
|
2706
|
+
f.$slots.watermark ? (C(), x("div", Ur, [
|
|
2707
|
+
M(f.$slots, "watermark", z(V({ isPrinting: v(Et) || v(Ct) })), void 0, !0)
|
|
2708
|
+
])) : L("", !0),
|
|
2709
|
+
tt(Wt, { name: "fade" }, {
|
|
2710
|
+
default: $(() => [
|
|
2711
|
+
Fe.value ? (C(), te(Yt, {
|
|
2712
|
+
key: 0,
|
|
2713
|
+
to: re.value ? m.value : "body"
|
|
2714
|
+
}, [
|
|
2715
|
+
K("div", {
|
|
2716
|
+
"data-cy-tooltip-midpoint": "",
|
|
2717
|
+
ref_key: "tooltipRef",
|
|
2718
|
+
ref: Te,
|
|
2719
|
+
class: "vue-ui-dag-tooltip",
|
|
2720
|
+
style: le({
|
|
2721
|
+
...Pe.value,
|
|
2722
|
+
maxWidth: u.value.style.chart.midpoints.tooltip.maxWidth,
|
|
2723
|
+
"--vue-data-ui-dag-tooltip-background": u.value.style.chart.midpoints.tooltip.backgroundColor,
|
|
2724
|
+
"--vue-data-ui-dag-tooltip-color": u.value.style.chart.midpoints.tooltip.color
|
|
2725
|
+
}),
|
|
2726
|
+
"data-position": we.value
|
|
2727
|
+
}, [
|
|
2728
|
+
M(f.$slots, "tooltip-midpoint", z(V({ edge: G.value, layoutData: v(k) })), () => [
|
|
2729
|
+
G.value ? (C(), x("div", Xr, Se(Lt(G.value.from)?.label ?? G.value.from) + " → " + Se(Lt(G.value.to)?.label ?? G.value.to), 1)) : L("", !0)
|
|
2730
|
+
], !0)
|
|
2731
|
+
], 12, Zr)
|
|
2732
|
+
], 8, ["to"])) : L("", !0)
|
|
2733
|
+
]),
|
|
2734
|
+
_: 3
|
|
2735
|
+
}),
|
|
2736
|
+
tt(Wt, { name: "fade" }, {
|
|
2737
|
+
default: $(() => [
|
|
2738
|
+
ne.value ? (C(), te(Yt, {
|
|
2739
|
+
key: 0,
|
|
2740
|
+
to: re.value ? m.value : "body"
|
|
2741
|
+
}, [
|
|
2742
|
+
K("div", {
|
|
2743
|
+
"data-cy-tooltip-node": "",
|
|
2744
|
+
ref_key: "nodeTooltipRef",
|
|
2745
|
+
ref: Ge,
|
|
2746
|
+
class: "vue-ui-dag-node-tooltip",
|
|
2747
|
+
style: le({
|
|
2748
|
+
maxWidth: u.value.style.chart.nodes.tooltip.maxWidth,
|
|
2749
|
+
left: je.value.left,
|
|
2750
|
+
top: je.value.top,
|
|
2751
|
+
"--vue-data-ui-dag-node-tooltip-background": u.value.style.chart.nodes.tooltip.backgroundColor,
|
|
2752
|
+
"--vue-data-ui-dag-node-tooltip-color": u.value.style.chart.nodes.tooltip.color
|
|
2753
|
+
}),
|
|
2754
|
+
"data-position": pt.value
|
|
2755
|
+
}, [
|
|
2756
|
+
M(f.$slots, "tooltip-node", z(V({ node: ye.value, layoutData: v(k) })), () => [
|
|
2757
|
+
ye.value ? (C(), x("div", Kr, Se(ye.value.label), 1)) : L("", !0)
|
|
2758
|
+
], !0)
|
|
2759
|
+
], 12, qr)
|
|
2760
|
+
], 8, ["to"])) : L("", !0)
|
|
2761
|
+
]),
|
|
2762
|
+
_: 3
|
|
2763
|
+
}),
|
|
2764
|
+
u.value.style.chart.controls.position === "bottom" && !v(Ee) && u.value.style.chart.controls.show ? (C(), te(Zt, {
|
|
2765
|
+
key: 7,
|
|
2766
|
+
ref_key: "zoomControls",
|
|
2767
|
+
ref: _,
|
|
2768
|
+
config: u.value,
|
|
2769
|
+
scale: v(Dt),
|
|
2770
|
+
isFullscreen: re.value,
|
|
2771
|
+
withDirection: "",
|
|
2772
|
+
onZoomIn: Ze,
|
|
2773
|
+
onZoomOut: Xe,
|
|
2774
|
+
onResetZoom: p[2] || (p[2] = () => v($e)(!0)),
|
|
2775
|
+
onSwitchDirection: Ke
|
|
2776
|
+
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2777
|
+
f.$slots.source ? (C(), x("div", {
|
|
2778
|
+
key: 8,
|
|
2779
|
+
ref_key: "source",
|
|
2780
|
+
ref: N,
|
|
2781
|
+
dir: "auto"
|
|
2782
|
+
}, [
|
|
2783
|
+
M(f.$slots, "source", {}, void 0, !0)
|
|
2784
|
+
], 512)) : L("", !0),
|
|
2785
|
+
v(Ee) ? (C(), te(kn, { key: 9 })) : L("", !0)
|
|
2786
|
+
], 46, _r));
|
|
2787
|
+
}
|
|
2788
|
+
}, Qr = /* @__PURE__ */ Ln(Jr, [["__scopeId", "data-v-1a06cb38"]]), pi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2789
|
+
__proto__: null,
|
|
2790
|
+
default: Qr
|
|
2791
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2792
|
+
export {
|
|
2793
|
+
vi as a,
|
|
2794
|
+
pi as b,
|
|
2795
|
+
Qr as v
|
|
2796
|
+
};
|