vue-data-ui 3.10.3 → 3.10.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/dist/{BaseDraggableDialog-BQYfVNu8.js → BaseDraggableDialog-BY2cU9MA.js} +1 -1
- package/dist/{BaseIcon-4uOct8re.js → BaseIcon-OrBtj3Mf.js} +40 -27
- package/dist/{BaseZoomControls-Cb-Qq9_R.js → BaseZoomControls-vclc8z8d.js} +1 -1
- package/dist/{ColorPicker-Culsjrcr.js → ColorPicker-KHEkeGjG.js} +1 -1
- package/dist/{DataTable-DyoDzNNY.js → DataTable-tQHYiviu.js} +1 -1
- package/dist/{NonSvgPenAndPaper-CNMLfAk3.js → NonSvgPenAndPaper-wmEv8nAJ.js} +2 -2
- package/dist/{PackageVersion-P4S5Z27M.js → PackageVersion-CKte9SJp.js} +1 -1
- package/dist/{PenAndPaper-LTuSTmWE.js → PenAndPaper-v4Uz9Ltu.js} +2 -2
- package/dist/{Slicer-DckZxvyx.js → Slicer-D_WE8Lxw.js} +1 -1
- package/dist/{SlicerPreview-CSc_cazO.js → SlicerPreview-Cxq4nls2.js} +12 -12
- package/dist/{Title-NgeRXqRA.js → Title-I3MXGnNV.js} +1 -1
- package/dist/{UserOptions-CX7Xsusk.js → UserOptions-BLbi1l3N.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-bump.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-icon.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 +31 -0
- package/dist/{useNestedProp-Ckf_2P_V.js → useNestedProp-B2E1V8tM.js} +18 -0
- package/dist/{vue-data-ui-CYR8RBUy.js → vue-data-ui-aV-APR48.js} +68 -68
- package/dist/vue-data-ui.js +71 -71
- package/dist/{vue-ui-3d-bar-gMhVye6x.js → vue-ui-3d-bar-BjS_WVZs.js} +3 -3
- package/dist/{vue-ui-accordion-DFKaB_05.js → vue-ui-accordion-0e2hESwi.js} +2 -2
- package/dist/{vue-ui-age-pyramid-O-NBUNAm.js → vue-ui-age-pyramid-2kTXpOdP.js} +3 -3
- package/dist/{vue-ui-annotator-CNkhGqqn.js → vue-ui-annotator-DF5PBP12.js} +4 -4
- package/dist/{vue-ui-bullet-DoV7GQEw.js → vue-ui-bullet-WP_XT9fO.js} +3 -3
- package/dist/{vue-ui-bump-TEZ5ReEF.js → vue-ui-bump-CuIbF2l9.js} +4 -4
- package/dist/{vue-ui-candlestick-DV2sokr1.js → vue-ui-candlestick-YW2l-GP_.js} +4 -4
- package/dist/{vue-ui-carousel-table-D7V2hBua.js → vue-ui-carousel-table-B5ErNV3r.js} +2 -2
- package/dist/{vue-ui-chestnut-oM6RXUAj.js → vue-ui-chestnut-kXqyi42f.js} +2 -2
- package/dist/{vue-ui-chord-jvxLpCkC.js → vue-ui-chord-8DcLEfMJ.js} +3 -3
- package/dist/{vue-ui-circle-pack-Du-ByuxU.js → vue-ui-circle-pack-DINvAv8d.js} +3 -3
- package/dist/{vue-ui-cursor-D12C-n8E.js → vue-ui-cursor-dyQxktBa.js} +2 -2
- package/dist/vue-ui-dag-B_jLyZIG.js +2861 -0
- package/dist/{vue-ui-dashboard-C_mAqH3E.js → vue-ui-dashboard-BNZuF_Y6.js} +66 -66
- package/dist/{vue-ui-digits-DnsDASGD.js → vue-ui-digits-HQ-G65FF.js} +1 -1
- package/dist/{vue-ui-donut-f1dyw0fn.js → vue-ui-donut-DTaPCOD2.js} +3 -3
- package/dist/{vue-ui-donut-evolution-C1cVRUEy.js → vue-ui-donut-evolution-8PFPP79C.js} +4 -4
- package/dist/{vue-ui-dumbbell-BFjSAmaz.js → vue-ui-dumbbell-C615o0Ny.js} +3 -3
- package/dist/{vue-ui-flow-Bw2MGPdH.js → vue-ui-flow-CP7LYm9E.js} +3 -3
- package/dist/{vue-ui-funnel-CZT2u6CT.js → vue-ui-funnel-Alssi2NT.js} +3 -3
- package/dist/{vue-ui-galaxy-DVnV7fer.js → vue-ui-galaxy-B0AT6saj.js} +3 -3
- package/dist/{vue-ui-gauge-68nXW4d4.js → vue-ui-gauge-CALXou3R.js} +3 -3
- package/dist/{vue-ui-geo-CfKG2WF2.js → vue-ui-geo-DS_0k2_6.js} +4 -4
- package/dist/{vue-ui-gizmo-4gcSQzSQ.js → vue-ui-gizmo-CCB9ZI9L.js} +2 -2
- package/dist/{vue-ui-heatmap-Dy3AEJ6w.js → vue-ui-heatmap-B02GzSNx.js} +4 -4
- package/dist/{vue-ui-history-plot-DKUqSDWQ.js → vue-ui-history-plot-hY28zMGM.js} +3 -3
- package/dist/{vue-ui-horizontal-bar-p26DrbGM.js → vue-ui-horizontal-bar-BMbJVk_r.js} +8 -8
- package/dist/{vue-ui-kpi-DgSmfw2q.js → vue-ui-kpi-KovdGbo0.js} +2 -2
- package/dist/{vue-ui-mini-loader-D8z1PwRZ.js → vue-ui-mini-loader-DHwgAVTI.js} +1 -1
- package/dist/{vue-ui-molecule-FobCQFFt.js → vue-ui-molecule-CSohfYTk.js} +2 -2
- package/dist/{vue-ui-mood-radar-CS-ICKCK.js → vue-ui-mood-radar-CbDsyrPq.js} +3 -3
- package/dist/{vue-ui-nested-donuts-ChSJX0h8.js → vue-ui-nested-donuts-DhixFIgI.js} +3 -3
- package/dist/{vue-ui-onion-B8UF-hki.js → vue-ui-onion-Cz9ybYji.js} +3 -3
- package/dist/{vue-ui-parallel-coordinate-plot-BtPxj-P8.js → vue-ui-parallel-coordinate-plot-Dqy9Lcrb.js} +3 -3
- package/dist/{vue-ui-quadrant-Q9TBimzW.js → vue-ui-quadrant-SZwpYzey.js} +3 -3
- package/dist/{vue-ui-quick-chart-BY9S-YBa.js → vue-ui-quick-chart-BjXHaDXD.js} +3 -3
- package/dist/{vue-ui-radar-CswjRIF_.js → vue-ui-radar-CQUlTKO-.js} +3 -3
- package/dist/{vue-ui-rating-W6I6pacT.js → vue-ui-rating-BHn34zul.js} +1 -1
- package/dist/{vue-ui-relation-circle-CAtxVLVz.js → vue-ui-relation-circle-DWazrtck.js} +3 -3
- package/dist/{vue-ui-ridgeline-qvflk847.js → vue-ui-ridgeline-BI188NqF.js} +3 -3
- package/dist/{vue-ui-rings-CyiISTOF.js → vue-ui-rings-BW092-BK.js} +3 -3
- package/dist/{vue-ui-scatter-DIgqcagP.js → vue-ui-scatter-LUmeNEQq.js} +3 -3
- package/dist/{vue-ui-skeleton-DkClk1C1.js → vue-ui-skeleton-DHvd3AX5.js} +2 -2
- package/dist/{vue-ui-smiley-B23r7AWp.js → vue-ui-smiley-C67CEdAZ.js} +1 -1
- package/dist/{vue-ui-spark-trend-BAalLLmt.js → vue-ui-spark-trend-X1htmT_A.js} +2 -2
- package/dist/{vue-ui-sparkbar-DAiByg6i.js → vue-ui-sparkbar-DZIXcWGc.js} +2 -2
- package/dist/{vue-ui-sparkgauge-DFDsfra7.js → vue-ui-sparkgauge-BEMSmlGu.js} +2 -2
- package/dist/{vue-ui-sparkhistogram-BjPIf-WY.js → vue-ui-sparkhistogram-BmmctwYO.js} +2 -2
- package/dist/{vue-ui-sparkline-Bdn5nh7q.js → vue-ui-sparkline-TOwxvUuT.js} +2 -2
- package/dist/{vue-ui-sparkstackbar-CFGsSf1p.js → vue-ui-sparkstackbar-BeE3lwCk.js} +2 -2
- package/dist/{vue-ui-stackbar-CbEpDijK.js → vue-ui-stackbar-CngSfqJZ.js} +4 -4
- package/dist/{vue-ui-stackline-sSqBRjIV.js → vue-ui-stackline-B8jzm_bo.js} +4 -4
- package/dist/{vue-ui-strip-plot-DNcf1Rbi.js → vue-ui-strip-plot-CD_Eb_P0.js} +3 -3
- package/dist/{vue-ui-table-CMjodRzP.js → vue-ui-table-DZYTO3H9.js} +4 -4
- package/dist/{vue-ui-table-heatmap-8kBdXO2V.js → vue-ui-table-heatmap-D6NO6NZz.js} +2 -2
- package/dist/{vue-ui-table-sparkline-qcwN58Dc.js → vue-ui-table-sparkline-ByNAx7h-.js} +2 -2
- package/dist/{vue-ui-thermometer-BCjkXz1F.js → vue-ui-thermometer-DUN_5Lt5.js} +3 -3
- package/dist/{vue-ui-timer-CAf7Dc61.js → vue-ui-timer-w1_uZgQ2.js} +4 -4
- package/dist/{vue-ui-tiremarks-DYAAjWRA.js → vue-ui-tiremarks-irWojm2N.js} +3 -3
- package/dist/{vue-ui-treemap-Bfe4p4wX.js → vue-ui-treemap-CGpo4rix.js} +4 -4
- package/dist/{vue-ui-waffle-uk7WQn8e.js → vue-ui-waffle-Cukn6oPE.js} +3 -3
- package/dist/{vue-ui-wheel-O68mMezM.js → vue-ui-wheel-CdLHd_3r.js} +3 -3
- package/dist/{vue-ui-word-cloud-CcgyYxsA.js → vue-ui-word-cloud-DGBO_MCa.js} +4 -4
- package/dist/{vue-ui-world-BpJd04wd.js → vue-ui-world-CHCHjsWp.js} +2 -2
- package/dist/{vue-ui-xy-BoeLTTX6.js → vue-ui-xy-B0_cRcAx.js} +5 -5
- package/dist/{vue-ui-xy-canvas-eHl--9m7.js → vue-ui-xy-canvas-bE_Qe7Wa.js} +6 -6
- package/package.json +2 -2
- package/dist/vue-ui-dag-DKdh56hV.js +0 -2810
|
@@ -1,2810 +0,0 @@
|
|
|
1
|
-
import { ref as C, watchEffect as cn, unref as v, defineAsyncComponent as et, toRefs as un, computed as H, onMounted as Gt, nextTick as Ae, watch as Ne, onBeforeUnmount as jt, createElementBlock as _, openBlock as y, normalizeStyle as ce, normalizeClass as Wt, createCommentVNode as L, createBlock as te, createVNode as tt, toDisplayString as Se, withCtx as F, renderSlot as M, normalizeProps as z, guardReactiveProps as V, createSlots as dn, createElementVNode as K, Fragment as ue, renderList as Le, withModifiers as Yt, mergeProps as ot, createTextVNode as fn, Transition as Ht, Teleport as Ut } from "vue";
|
|
2
|
-
import { c as ut, aB as hn, t as mn, o as gn, g as Zt, m as Xt, X as vn, as as bn } from "./lib-CVHM9FhP.js";
|
|
3
|
-
import { t as pn, u as wn } from "./useResponsive-DfdjqQps.js";
|
|
4
|
-
import { u as yn } from "./usePanZoom-CDF7rb3o.js";
|
|
5
|
-
import { u as kn, a as nt } from "./useNestedProp-Ckf_2P_V.js";
|
|
6
|
-
import { u as Cn, B as En } from "./BaseScanner-BMpwQAfz.js";
|
|
7
|
-
import { u as _n } from "./usePrinter-1NmjuP-i.js";
|
|
8
|
-
import { u as xn } from "./useSvgExport-ByUukOZt.js";
|
|
9
|
-
import { u as An } from "./useThemeCheck-D1ZYXUwG.js";
|
|
10
|
-
import { u as Nn } from "./useUserOptionState-BIvW1Kz7.js";
|
|
11
|
-
import { u as Sn } from "./useChartAccessibility-9icAAmYg.js";
|
|
12
|
-
import Ln from "./Title-NgeRXqRA.js";
|
|
13
|
-
import { B as qt } from "./BaseZoomControls-Cb-Qq9_R.js";
|
|
14
|
-
import Mn from "./img-6fNF_rG0.js";
|
|
15
|
-
import { _ as On } from "./_plugin-vue_export-helper-CHgC5LLL.js";
|
|
16
|
-
const Dn = "\0", de = "\0", Kt = "";
|
|
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[de] = {});
|
|
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] = de, this._children[t] = {}, this._children[de][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 = de;
|
|
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 !== de)
|
|
206
|
-
return o;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Gets list of direct children of node nodeId.
|
|
211
|
-
* Complexity: O(1).
|
|
212
|
-
*/
|
|
213
|
-
children(t = de) {
|
|
214
|
-
if (this._isCompound) {
|
|
215
|
-
const o = this._children[t];
|
|
216
|
-
if (o)
|
|
217
|
-
return Object.keys(o);
|
|
218
|
-
} else {
|
|
219
|
-
if (t === de)
|
|
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 = Me(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 = Rn(this._isDirected, t, o, n);
|
|
341
|
-
return t = l.v, o = l.w, Object.freeze(l), this._edgeObjs[a] = l, Jt(this._preds[o], t), Jt(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]) : Me(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]) : Me(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]) : Me(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], Qt(this._preds[o], t), Qt(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 Jt(e, t) {
|
|
411
|
-
e[t] ? e[t]++ : e[t] = 1;
|
|
412
|
-
}
|
|
413
|
-
function Qt(e, t) {
|
|
414
|
-
--e[t] || delete e[t];
|
|
415
|
-
}
|
|
416
|
-
function Me(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 + Kt + i + Kt + (n === void 0 ? Dn : n);
|
|
423
|
-
}
|
|
424
|
-
function Rn(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 Me(e, t.v, t.w, t.name);
|
|
435
|
-
}
|
|
436
|
-
class Tn {
|
|
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 eo(o), o;
|
|
445
|
-
}
|
|
446
|
-
enqueue(t) {
|
|
447
|
-
const o = this._sentinel;
|
|
448
|
-
t._prev && t._next && eo(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, Pn)), n = n._prev;
|
|
455
|
-
return "[" + t.join(", ") + "]";
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
function eo(e) {
|
|
459
|
-
e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
|
|
460
|
-
}
|
|
461
|
-
function Pn(e, t) {
|
|
462
|
-
if (e !== "_next" && e !== "_prev")
|
|
463
|
-
return t;
|
|
464
|
-
}
|
|
465
|
-
const $n = () => 1;
|
|
466
|
-
function Fn(e, t) {
|
|
467
|
-
if (e.nodeCount() <= 1)
|
|
468
|
-
return [];
|
|
469
|
-
const o = zn(e, t || $n);
|
|
470
|
-
return Bn(o.graph, o.buckets, o.zeroIndex).flatMap((s) => e.outEdges(s.v, s.w));
|
|
471
|
-
}
|
|
472
|
-
function Bn(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 zn(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), f = l + c;
|
|
508
|
-
o.setEdge(a.v, a.w, f), s = Math.max(s, o.node(a.v).out += c), n = Math.max(n, o.node(a.w).in += c);
|
|
509
|
-
});
|
|
510
|
-
const i = Vn(s + n + 3).map(() => new Tn()), 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 Vn(e) {
|
|
523
|
-
const t = [];
|
|
524
|
-
for (let o = 0; o < e; o++)
|
|
525
|
-
t.push(o);
|
|
526
|
-
return t;
|
|
527
|
-
}
|
|
528
|
-
function be(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 fo(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 In(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 Gn(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 De(e) {
|
|
582
|
-
const t = ve(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 ho(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 mo(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 jn(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), be(e, "border", s, t);
|
|
618
|
-
}
|
|
619
|
-
const go = 65535;
|
|
620
|
-
function Wn(e, t = go) {
|
|
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 > go) {
|
|
630
|
-
const o = Wn(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 vo(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 bo(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 po(e, t) {
|
|
660
|
-
return t();
|
|
661
|
-
}
|
|
662
|
-
let Yn = 0;
|
|
663
|
-
function Ve(e) {
|
|
664
|
-
const t = ++Yn;
|
|
665
|
-
return e + String(t);
|
|
666
|
-
}
|
|
667
|
-
function ve(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 Oe(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 Re(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: jn,
|
|
695
|
-
addDummyNode: be,
|
|
696
|
-
applyWithChunking: X,
|
|
697
|
-
asNonCompoundGraph: ht,
|
|
698
|
-
buildLayerMatrix: De,
|
|
699
|
-
intersectRect: ft,
|
|
700
|
-
mapValues: Re,
|
|
701
|
-
maxRank: mt,
|
|
702
|
-
normalizeRanks: ho,
|
|
703
|
-
notime: po,
|
|
704
|
-
partition: vo,
|
|
705
|
-
pick: Oe,
|
|
706
|
-
predecessorWeights: Gn,
|
|
707
|
-
range: ve,
|
|
708
|
-
removeEmptyRanks: mo,
|
|
709
|
-
simplify: fo,
|
|
710
|
-
successorWeights: In,
|
|
711
|
-
time: bo,
|
|
712
|
-
uniqueId: Ve,
|
|
713
|
-
zipObject: Ie
|
|
714
|
-
};
|
|
715
|
-
function Hn(e) {
|
|
716
|
-
(e.graph().acyclicer === "greedy" ? Fn(e, o(e)) : Zn(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 Un(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 Zn(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 Xn(e) {
|
|
744
|
-
e.graph().dummyChains = [], e.edges().forEach((t) => qn(e, t));
|
|
745
|
-
}
|
|
746
|
-
function qn(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, f, m;
|
|
753
|
-
for (m = 0, ++n; n < i; ++m, ++n)
|
|
754
|
-
a.points = [], f = {
|
|
755
|
-
width: 0,
|
|
756
|
-
height: 0,
|
|
757
|
-
edgeLabel: a,
|
|
758
|
-
edgeObj: t,
|
|
759
|
-
rank: n
|
|
760
|
-
}, c = be(e, "edge", f, "_d"), n === l && (f.width = a.width, f.height = a.height, f.dummy = "edge-label", f.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 Kn(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 wo(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), f = e.edge(a).minlen;
|
|
785
|
-
return c - f;
|
|
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 Jn(e, t) {
|
|
793
|
-
return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
|
|
794
|
-
}
|
|
795
|
-
function Qn(e) {
|
|
796
|
-
es(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 = ts(e, s);
|
|
807
|
-
if (!i) {
|
|
808
|
-
const f = o.find((m) => !s.has(m));
|
|
809
|
-
s.add(f), t.setNode(f, {});
|
|
810
|
-
continue;
|
|
811
|
-
}
|
|
812
|
-
const { edgeObject: r, delta: a, attachFrom: l, attachTo: c } = i;
|
|
813
|
-
os(e, s, l, a), t.setEdge(r.v, r.w, {}), s.add(c);
|
|
814
|
-
}
|
|
815
|
-
return t;
|
|
816
|
-
}
|
|
817
|
-
function es(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 ts(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 = Jn(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, f = s ? r : -r;
|
|
832
|
-
o = {
|
|
833
|
-
edgeObject: n,
|
|
834
|
-
delta: f,
|
|
835
|
-
attachFrom: l,
|
|
836
|
-
attachTo: c,
|
|
837
|
-
absoluteSlack: a
|
|
838
|
-
};
|
|
839
|
-
}
|
|
840
|
-
}), o;
|
|
841
|
-
}
|
|
842
|
-
function os(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 = fo(e);
|
|
852
|
-
return wo(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 ns(e, t) {
|
|
858
|
-
}
|
|
859
|
-
function ss(e, t) {
|
|
860
|
-
}
|
|
861
|
-
function rs(e, t, o) {
|
|
862
|
-
return 0;
|
|
863
|
-
}
|
|
864
|
-
function is(e) {
|
|
865
|
-
return null;
|
|
866
|
-
}
|
|
867
|
-
function as(e, t) {
|
|
868
|
-
return null;
|
|
869
|
-
}
|
|
870
|
-
pe.initLowLimValues = ns;
|
|
871
|
-
pe.initCutValues = ss;
|
|
872
|
-
pe.calcCutValue = rs;
|
|
873
|
-
pe.leaveEdge = is;
|
|
874
|
-
pe.enterEdge = as;
|
|
875
|
-
const yo = wo;
|
|
876
|
-
function ls(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
|
-
to(e);
|
|
883
|
-
break;
|
|
884
|
-
case "tight-tree":
|
|
885
|
-
us(e);
|
|
886
|
-
break;
|
|
887
|
-
case "longest-path":
|
|
888
|
-
cs(e);
|
|
889
|
-
break;
|
|
890
|
-
case "none":
|
|
891
|
-
break;
|
|
892
|
-
default:
|
|
893
|
-
to(e);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
const cs = yo;
|
|
897
|
-
function us(e) {
|
|
898
|
-
yo(e), Qn(e);
|
|
899
|
-
}
|
|
900
|
-
function to(e) {
|
|
901
|
-
pe(e);
|
|
902
|
-
}
|
|
903
|
-
function ds(e) {
|
|
904
|
-
const t = hs(e);
|
|
905
|
-
e.graph().dummyChains.forEach((o) => {
|
|
906
|
-
let n = e.node(o);
|
|
907
|
-
const s = n.edgeObj, i = fs(e, t, s.v, s.w), r = i.path, a = i.lca;
|
|
908
|
-
let l = 0, c = r[l], f = !0, m = o;
|
|
909
|
-
for (; m !== s.w; ) {
|
|
910
|
-
if (n = e.node(m), f) {
|
|
911
|
-
for (; (c = r[l]) !== a && e.node(c).maxRank < n.rank; )
|
|
912
|
-
l++;
|
|
913
|
-
c === a && (f = !1);
|
|
914
|
-
}
|
|
915
|
-
if (!f) {
|
|
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 fs(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 hs(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 ms(e) {
|
|
948
|
-
const t = ze.addDummyNode(e, "root", {}, "_root"), o = gs(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 = vs(e) + 1;
|
|
953
|
-
e.children().forEach((a) => {
|
|
954
|
-
ko(e, t, i, r, s, o, a);
|
|
955
|
-
}), e.graph().nodeRankFactor = i;
|
|
956
|
-
}
|
|
957
|
-
function ko(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"), f = e.node(r);
|
|
964
|
-
e.setParent(l, r), f.borderTop = l, e.setParent(c, r), f.borderBottom = c, a.forEach((m) => {
|
|
965
|
-
ko(e, t, o, n, s, i, m);
|
|
966
|
-
const g = e.node(m), w = g.borderTop ? g.borderTop : m, A = g.borderBottom ? g.borderBottom : m, x = g.borderTop ? n : 2 * n, P = w !== A ? 1 : s - i[r] + 1;
|
|
967
|
-
e.setEdge(l, w, {
|
|
968
|
-
weight: x,
|
|
969
|
-
minlen: P,
|
|
970
|
-
nestingEdge: !0
|
|
971
|
-
}), e.setEdge(A, c, {
|
|
972
|
-
weight: x,
|
|
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 gs(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 vs(e) {
|
|
990
|
-
return e.edges().reduce((t, o) => t + e.edge(o).weight, 0);
|
|
991
|
-
}
|
|
992
|
-
function bs(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 ps(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
|
-
oo(e, "borderLeft", "_bl", o, s, i), oo(e, "borderRight", "_br", o, s, i);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
e.children().forEach(t);
|
|
1008
|
-
}
|
|
1009
|
-
function oo(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 = be(e, "border", r, o);
|
|
1016
|
-
s[t][i] = l, e.setParent(l, n), a && e.setEdge(a, l, { weight: 1 });
|
|
1017
|
-
}
|
|
1018
|
-
function ws(e) {
|
|
1019
|
-
const t = e.graph().rankdir.toLowerCase();
|
|
1020
|
-
(t === "lr" || t === "rl") && Co(e);
|
|
1021
|
-
}
|
|
1022
|
-
function ys(e) {
|
|
1023
|
-
const t = e.graph().rankdir.toLowerCase();
|
|
1024
|
-
(t === "bt" || t === "rl") && ks(e), (t === "lr" || t === "rl") && (Cs(e), Co(e));
|
|
1025
|
-
}
|
|
1026
|
-
function Co(e) {
|
|
1027
|
-
e.nodes().forEach((t) => {
|
|
1028
|
-
no(e.node(t));
|
|
1029
|
-
}), e.edges().forEach((t) => {
|
|
1030
|
-
no(e.edge(t));
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
function no(e) {
|
|
1034
|
-
const t = e.width;
|
|
1035
|
-
e.width = e.height, e.height = t;
|
|
1036
|
-
}
|
|
1037
|
-
function ks(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 Cs(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 so = {
|
|
1061
|
-
adjust: ws,
|
|
1062
|
-
undo: ys
|
|
1063
|
-
};
|
|
1064
|
-
function Es(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 = ve(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 _s(e, t) {
|
|
1077
|
-
let o = 0;
|
|
1078
|
-
for (let n = 1; n < t.length; ++n)
|
|
1079
|
-
o += xs(e, t[n - 1], t[n]);
|
|
1080
|
-
return o;
|
|
1081
|
-
}
|
|
1082
|
-
function xs(e, t, o) {
|
|
1083
|
-
const n = Ie(
|
|
1084
|
-
o,
|
|
1085
|
-
o.map((c, f) => f)
|
|
1086
|
-
), s = t.flatMap((c) => e.outEdges(c).map((f) => ({
|
|
1087
|
-
pos: n[f.w],
|
|
1088
|
-
weight: e.edge(f).weight
|
|
1089
|
-
})).sort((f, m) => f.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 f = c.pos + i;
|
|
1098
|
-
a[f] += c.weight;
|
|
1099
|
-
let m = 0;
|
|
1100
|
-
for (; f > 0; )
|
|
1101
|
-
f % 2 && (m += a[f + 1]), f = f - 1 >> 1, a[f] += c.weight;
|
|
1102
|
-
l += c.weight * m;
|
|
1103
|
-
}), l;
|
|
1104
|
-
}
|
|
1105
|
-
function As(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 Ns(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 Ss(n);
|
|
1144
|
-
}
|
|
1145
|
-
function Ss(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) && Ls(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) => Oe(s, ["vs", "i", "barycenter", "weight"]));
|
|
1162
|
-
}
|
|
1163
|
-
function Ls(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 Ms(e, t) {
|
|
1168
|
-
const o = vo(e, (f) => Object.hasOwn(f, "barycenter")), n = o.lhs, s = o.rhs.sort((f, m) => m.i - f.i), i = [];
|
|
1169
|
-
let r = 0, a = 0, l = 0;
|
|
1170
|
-
n.sort(Os(!!t)), l = ro(i, s, l), n.forEach((f) => {
|
|
1171
|
-
l += f.vs.length, i.push(f.vs), r += f.barycenter * f.weight, a += f.weight, l = ro(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 ro(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 Os(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 Eo(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 = As(e, s);
|
|
1190
|
-
c.forEach((g) => {
|
|
1191
|
-
if (e.children(g.v).length) {
|
|
1192
|
-
const w = Eo(e, g.v, o, n);
|
|
1193
|
-
l[g.v] = w, Object.hasOwn(w, "barycenter") && Rs(g, w);
|
|
1194
|
-
}
|
|
1195
|
-
});
|
|
1196
|
-
let f = Ns(c, o);
|
|
1197
|
-
Ds(f, l);
|
|
1198
|
-
const m = Ms(f, 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]), w = 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 + w.order) / (m.weight + 2), m.weight += 2;
|
|
1202
|
-
}
|
|
1203
|
-
return m;
|
|
1204
|
-
}
|
|
1205
|
-
function Ds(e, t) {
|
|
1206
|
-
e.forEach((o) => {
|
|
1207
|
-
o.vs = o.vs.flatMap((n) => t[n] ? t[n].vs : n);
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
function Rs(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 Ts(e, t, o, n) {
|
|
1214
|
-
n || (n = e.nodes());
|
|
1215
|
-
const s = Ps(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((f) => {
|
|
1219
|
-
const m = f.v === r ? f.w : f.v, g = i.edge(m, r), w = g ? g.weight : 0;
|
|
1220
|
-
i.setEdge(m, r, {
|
|
1221
|
-
weight: e.edge(f).weight + w
|
|
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 Ps(e) {
|
|
1230
|
-
let t;
|
|
1231
|
-
for (; e.hasNode(t = Ve("_root")); ) ;
|
|
1232
|
-
return t;
|
|
1233
|
-
}
|
|
1234
|
-
function $s(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 _o(e, t = {}) {
|
|
1248
|
-
if (typeof t.customOrder == "function") {
|
|
1249
|
-
t.customOrder(e, _o);
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
const o = mt(e), n = io(
|
|
1253
|
-
e,
|
|
1254
|
-
ve(1, o + 1),
|
|
1255
|
-
"inEdges"
|
|
1256
|
-
), s = io(
|
|
1257
|
-
e,
|
|
1258
|
-
ve(o - 1, -1, -1),
|
|
1259
|
-
"outEdges"
|
|
1260
|
-
);
|
|
1261
|
-
let i = Es(e);
|
|
1262
|
-
if (ao(e, i), t.disableOptimalOrderHeuristic)
|
|
1263
|
-
return;
|
|
1264
|
-
let r = Number.POSITIVE_INFINITY, a;
|
|
1265
|
-
const l = t.constraints || [];
|
|
1266
|
-
for (let c = 0, f = 0; f < 4; ++c, ++f) {
|
|
1267
|
-
const m = c % 2 === 0 ? n : s, g = c % 4 >= 2;
|
|
1268
|
-
Fs(m, g, l), i = De(e);
|
|
1269
|
-
const w = _s(e, i);
|
|
1270
|
-
w < r ? (r = w, f = 0, a = structuredClone(i)) : w === r && (a = structuredClone(i));
|
|
1271
|
-
}
|
|
1272
|
-
ao(e, a);
|
|
1273
|
-
}
|
|
1274
|
-
function io(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) => Ts(
|
|
1287
|
-
e,
|
|
1288
|
-
i,
|
|
1289
|
-
o,
|
|
1290
|
-
n.get(i) || []
|
|
1291
|
-
)
|
|
1292
|
-
);
|
|
1293
|
-
}
|
|
1294
|
-
function Fs(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 = Eo(s, i, n, t);
|
|
1299
|
-
r.vs.forEach((a, l) => {
|
|
1300
|
-
s.node(a).order = l;
|
|
1301
|
-
}), $s(s, n, r.vs);
|
|
1302
|
-
});
|
|
1303
|
-
}
|
|
1304
|
-
function ao(e, t) {
|
|
1305
|
-
Object.values(t).forEach((o) => {
|
|
1306
|
-
o.forEach((n, s) => {
|
|
1307
|
-
e.node(n).order = s;
|
|
1308
|
-
});
|
|
1309
|
-
});
|
|
1310
|
-
}
|
|
1311
|
-
function Bs(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((f, m) => {
|
|
1317
|
-
const g = Vs(e, f), w = g ? e.node(g).order : l;
|
|
1318
|
-
(g || f === c) && (i.slice(a, m + 1).forEach((A) => {
|
|
1319
|
-
e.predecessors(A).forEach((x) => {
|
|
1320
|
-
const P = e.node(x), J = P.order;
|
|
1321
|
-
(J < r || w < J) && !(P.dummy && e.node(A).dummy) && xo(o, x, A);
|
|
1322
|
-
});
|
|
1323
|
-
}), a = m + 1, r = w);
|
|
1324
|
-
}), i;
|
|
1325
|
-
}
|
|
1326
|
-
return t.length && t.reduce(n), o;
|
|
1327
|
-
}
|
|
1328
|
-
function zs(e, t) {
|
|
1329
|
-
const o = {};
|
|
1330
|
-
function n(i, r, a, l, c) {
|
|
1331
|
-
let f;
|
|
1332
|
-
ve(r, a).forEach((m) => {
|
|
1333
|
-
f = i[m], e.node(f).dummy && e.predecessors(f).forEach((g) => {
|
|
1334
|
-
const w = e.node(g);
|
|
1335
|
-
w.dummy && (w.order < l || w.order > c) && xo(o, g, f);
|
|
1336
|
-
});
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
function s(i, r) {
|
|
1340
|
-
let a = -1, l, c = 0;
|
|
1341
|
-
return r.forEach((f, m) => {
|
|
1342
|
-
if (e.node(f).dummy === "border") {
|
|
1343
|
-
const g = e.predecessors(f);
|
|
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 Vs(e, t) {
|
|
1352
|
-
if (e.node(t).dummy)
|
|
1353
|
-
return e.predecessors(t).find((o) => e.node(o).dummy);
|
|
1354
|
-
}
|
|
1355
|
-
function xo(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 Is(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 Gs(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 f = n(c);
|
|
1380
|
-
if (f.length) {
|
|
1381
|
-
f = f.sort((g, w) => r[g] - r[w]);
|
|
1382
|
-
const m = (f.length - 1) / 2;
|
|
1383
|
-
for (let g = Math.floor(m), w = Math.ceil(m); g <= w; ++g) {
|
|
1384
|
-
const A = f[g];
|
|
1385
|
-
i[c] === c && l < r[A] && !Is(o, c, A) && (i[A] = c, i[c] = s[c] = s[A], l = r[A]);
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
});
|
|
1389
|
-
}), { root: s, align: i };
|
|
1390
|
-
}
|
|
1391
|
-
function js(e, t, o, n, s) {
|
|
1392
|
-
const i = {}, r = Ws(e, t, o, s), a = s ? "borderLeft" : "borderRight";
|
|
1393
|
-
function l(m, g) {
|
|
1394
|
-
const w = r.nodes().slice(), A = {};
|
|
1395
|
-
let x = w.pop();
|
|
1396
|
-
for (; x; ) {
|
|
1397
|
-
if (A[x])
|
|
1398
|
-
m(x);
|
|
1399
|
-
else {
|
|
1400
|
-
A[x] = !0, w.push(x);
|
|
1401
|
-
for (const P of g(x))
|
|
1402
|
-
w.push(P);
|
|
1403
|
-
}
|
|
1404
|
-
x = w.pop();
|
|
1405
|
-
}
|
|
1406
|
-
}
|
|
1407
|
-
function c(m) {
|
|
1408
|
-
i[m] = r.inEdges(m).reduce((g, w) => Math.max(g, i[w.v] + r.edge(w)), 0);
|
|
1409
|
-
}
|
|
1410
|
-
function f(m) {
|
|
1411
|
-
const g = r.outEdges(m).reduce((A, x) => Math.min(A, i[x.w] - r.edge(x)), Number.POSITIVE_INFINITY), w = e.node(m);
|
|
1412
|
-
g !== Number.POSITIVE_INFINITY && w.borderType !== a && (i[m] = Math.max(i[m], g));
|
|
1413
|
-
}
|
|
1414
|
-
return l(c, r.predecessors.bind(r)), l(f, r.successors.bind(r)), Object.keys(n).forEach((m) => {
|
|
1415
|
-
i[m] = i[o[m]];
|
|
1416
|
-
}), i;
|
|
1417
|
-
}
|
|
1418
|
-
function Ws(e, t, o, n) {
|
|
1419
|
-
const s = new e.constructor(), i = e.graph(), r = Xs(i.nodesep, i.edgesep, n);
|
|
1420
|
-
return t.forEach((a) => {
|
|
1421
|
-
let l;
|
|
1422
|
-
a.forEach((c) => {
|
|
1423
|
-
const f = o[c];
|
|
1424
|
-
if (s.setNode(f), l) {
|
|
1425
|
-
const m = o[l], g = s.edge(m, f);
|
|
1426
|
-
s.setEdge(
|
|
1427
|
-
m,
|
|
1428
|
-
f,
|
|
1429
|
-
Math.max(r(e, c, l), g || 0)
|
|
1430
|
-
);
|
|
1431
|
-
}
|
|
1432
|
-
l = c;
|
|
1433
|
-
});
|
|
1434
|
-
}), s;
|
|
1435
|
-
}
|
|
1436
|
-
function Ys(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 = qs(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 Hs(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 f = n - X(Math.min, c);
|
|
1459
|
-
r !== "l" && (f = s - X(Math.max, c)), f && (l = Re(l, (m) => m + f), e[a] = l);
|
|
1460
|
-
});
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
function Us(e, t) {
|
|
1464
|
-
return Re(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 Zs(e) {
|
|
1472
|
-
const t = De(e), o = Object.assign(
|
|
1473
|
-
Bs(e, t),
|
|
1474
|
-
zs(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), f = Gs(
|
|
1484
|
-
e,
|
|
1485
|
-
l,
|
|
1486
|
-
o,
|
|
1487
|
-
c
|
|
1488
|
-
);
|
|
1489
|
-
let m = js(
|
|
1490
|
-
e,
|
|
1491
|
-
l,
|
|
1492
|
-
f.root,
|
|
1493
|
-
f.align,
|
|
1494
|
-
a === "r"
|
|
1495
|
-
);
|
|
1496
|
-
a === "r" && (m = Re(m, (g) => -g)), n[r + a] = m;
|
|
1497
|
-
});
|
|
1498
|
-
});
|
|
1499
|
-
const i = Ys(e, n);
|
|
1500
|
-
return Hs(n, i), Us(n, e.graph().align);
|
|
1501
|
-
}
|
|
1502
|
-
function Xs(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 qs(e, t) {
|
|
1528
|
-
return e.node(t).width;
|
|
1529
|
-
}
|
|
1530
|
-
function Ks(e) {
|
|
1531
|
-
const t = ht(e);
|
|
1532
|
-
Js(t);
|
|
1533
|
-
const o = Zs(t);
|
|
1534
|
-
Object.entries(o).forEach(([n, s]) => {
|
|
1535
|
-
e.node(n).x = s;
|
|
1536
|
-
});
|
|
1537
|
-
}
|
|
1538
|
-
function Js(e) {
|
|
1539
|
-
const t = De(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 Qs(e, t = {}) {
|
|
1552
|
-
const o = t.debugTiming ? bo : po;
|
|
1553
|
-
return o("layout", () => {
|
|
1554
|
-
const n = o(" buildLayoutGraph", () => cr(e));
|
|
1555
|
-
return o(" runLayout", () => er(n, o, t)), o(" updateInputGraph", () => tr(e, n)), n;
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
function er(e, t, o) {
|
|
1559
|
-
t(" makeSpaceForEdgeLabels", () => ur(e)), t(" removeSelfEdges", () => wr(e)), t(" acyclic", () => Hn(e)), t(" nestingGraph.run", () => ms(e)), t(" rank", () => ls(ht(e))), t(" injectEdgeLabelProxies", () => dr(e)), t(" removeEmptyRanks", () => mo(e)), t(" nestingGraph.cleanup", () => bs(e)), t(" normalizeRanks", () => ho(e)), t(" assignRankMinMax", () => fr(e)), t(" removeEdgeLabelProxies", () => hr(e)), t(" normalize.run", () => Xn(e)), t(" parentDummyChains", () => ds(e)), t(" addBorderSegments", () => ps(e)), t(" order", () => _o(e, o)), t(" insertSelfEdges", () => yr(e)), t(" adjustCoordinateSystem", () => so.adjust(e)), t(" position", () => Ks(e)), t(" positionSelfEdges", () => kr(e)), t(" removeBorderNodes", () => pr(e)), t(" normalize.undo", () => Kn(e)), t(" fixupEdgeLabelCoords", () => vr(e)), t(" undoCoordinateSystem", () => so.undo(e)), t(" translateGraph", () => mr(e)), t(" assignNodeIntersects", () => gr(e)), t(" reversePoints", () => br(e)), t(" acyclic.undo", () => Un(e));
|
|
1560
|
-
}
|
|
1561
|
-
function tr(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 or = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], nr = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, sr = ["acyclicer", "ranker", "rankdir", "align"], rr = ["width", "height", "rank"], lo = { width: 0, height: 0 }, ir = ["minlen", "weight", "width", "height", "labeloffset"], ar = {
|
|
1573
|
-
minlen: 1,
|
|
1574
|
-
weight: 1,
|
|
1575
|
-
width: 0,
|
|
1576
|
-
height: 0,
|
|
1577
|
-
labeloffset: 10,
|
|
1578
|
-
labelpos: "r"
|
|
1579
|
-
}, lr = ["labelpos", "arrowshape"];
|
|
1580
|
-
function cr(e) {
|
|
1581
|
-
const t = ct(e.graph()), o = {
|
|
1582
|
-
...nr,
|
|
1583
|
-
...lt(t, or),
|
|
1584
|
-
...Oe(t, sr)
|
|
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, rr);
|
|
1588
|
-
Object.keys(lo).forEach((a) => {
|
|
1589
|
-
r[a] === void 0 && (r[a] = lo[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
|
-
...ar,
|
|
1597
|
-
...lt(i, ir),
|
|
1598
|
-
...Oe(i, lr)
|
|
1599
|
-
}
|
|
1600
|
-
);
|
|
1601
|
-
}), n;
|
|
1602
|
-
}
|
|
1603
|
-
function ur(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 dr(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
|
-
be(e, "edge-proxy", i, "_ep");
|
|
1616
|
-
}
|
|
1617
|
-
});
|
|
1618
|
-
}
|
|
1619
|
-
function fr(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 hr(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 mr(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 f = c.x, m = c.y, g = c.width, w = c.height;
|
|
1637
|
-
t = Math.min(t, f - g / 2), o = Math.max(o, f + g / 2), n = Math.min(n, m - w / 2), s = Math.max(s, m + w / 2);
|
|
1638
|
-
}
|
|
1639
|
-
e.nodes().forEach((c) => l(e.node(c))), e.edges().forEach((c) => {
|
|
1640
|
-
const f = e.edge(c);
|
|
1641
|
-
Object.hasOwn(f, "x") && l(f);
|
|
1642
|
-
}), t -= r, n -= a, e.nodes().forEach((c) => {
|
|
1643
|
-
const f = e.node(c);
|
|
1644
|
-
f.x -= t, f.y -= n;
|
|
1645
|
-
}), e.edges().forEach((c) => {
|
|
1646
|
-
const f = e.edge(c);
|
|
1647
|
-
f.points.forEach((m) => {
|
|
1648
|
-
m.x -= t, m.y -= n;
|
|
1649
|
-
}), Object.hasOwn(f, "x") && (f.x -= t), Object.hasOwn(f, "y") && (f.y -= n);
|
|
1650
|
-
}), i.width = o - t + r, i.height = s - n + a;
|
|
1651
|
-
}
|
|
1652
|
-
function co(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 gr(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), f = n.points.length ? n.points[0] : r, m = n.points.length ? n.points[n.points.length - 1] : a, g = n.arrowshape, w = g === "normal" || g === "vee", A = !!n.reversed;
|
|
1670
|
-
let x = l, P = c;
|
|
1671
|
-
w && (A ? x = co(l, f, 4) : P = co(c, m, 4)), n.points.unshift(x), n.points.push(P);
|
|
1672
|
-
});
|
|
1673
|
-
}
|
|
1674
|
-
function vr(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 br(e) {
|
|
1689
|
-
e.edges().forEach((t) => {
|
|
1690
|
-
const o = e.edge(t);
|
|
1691
|
-
o.reversed && o.points.reverse();
|
|
1692
|
-
});
|
|
1693
|
-
}
|
|
1694
|
-
function pr(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 wr(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 yr(e) {
|
|
1713
|
-
De(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
|
-
be(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 kr(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 Re(Oe(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 Cr = {
|
|
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 Er(e) {
|
|
1772
|
-
return e.length ? e.map(
|
|
1773
|
-
(t, o) => `${o === 0 ? "M" : "L"} ${t.x} ${t.y}`
|
|
1774
|
-
).join(" ") : "";
|
|
1775
|
-
}
|
|
1776
|
-
function _r(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, f = (i.y + r.y) / 2;
|
|
1789
|
-
o += ` Q ${a} ${l} ${c} ${f}`;
|
|
1790
|
-
}
|
|
1791
|
-
const n = e[e.length - 1];
|
|
1792
|
-
return o += ` L ${n.x} ${n.y}`, o;
|
|
1793
|
-
}
|
|
1794
|
-
function xr(e) {
|
|
1795
|
-
const { nodes: t, edges: o, configuration: n } = e, s = C(null), i = C(null), r = `dag-arrow-${ut()}`;
|
|
1796
|
-
function a(l, c, f) {
|
|
1797
|
-
i.value = null, s.value = null;
|
|
1798
|
-
const m = {
|
|
1799
|
-
...Cr,
|
|
1800
|
-
...f
|
|
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
|
-
}), Qs(g);
|
|
1821
|
-
const w = 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
|
-
}), A = g.edges().map((u) => {
|
|
1833
|
-
const j = g.edge(u), Q = j.points || [];
|
|
1834
|
-
if (!Q.length)
|
|
1835
|
-
return null;
|
|
1836
|
-
const Te = m.curvedEdges ? _r(Q) : Er(Q), Pe = m.arrowShape !== "undirected" ? `url(#${r})` : null, $e = c.find((ye) => ye?.from === u.v && ye?.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: Te,
|
|
1843
|
-
markerEnd: Pe,
|
|
1844
|
-
original: {
|
|
1845
|
-
...$e,
|
|
1846
|
-
...j
|
|
1847
|
-
}
|
|
1848
|
-
};
|
|
1849
|
-
}).filter(Boolean), x = m.padding;
|
|
1850
|
-
if (!w.length) {
|
|
1851
|
-
s.value = {
|
|
1852
|
-
nodes: [],
|
|
1853
|
-
edges: A,
|
|
1854
|
-
viewBox: "0 0 0 0",
|
|
1855
|
-
arrowShape: m.arrowShape,
|
|
1856
|
-
arrowSize: m.arrowSize
|
|
1857
|
-
};
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
const P = w.flatMap((u) => [
|
|
1861
|
-
u.x - u.width / 2,
|
|
1862
|
-
u.x + u.width / 2
|
|
1863
|
-
]), J = w.flatMap((u) => [
|
|
1864
|
-
u.y - u.height / 2,
|
|
1865
|
-
u.y + u.height / 2
|
|
1866
|
-
]), we = Math.min(...P) - x, fe = Math.max(...P) + x, $ = Math.min(...J) - x, I = Math.max(...J) + x;
|
|
1867
|
-
s.value = {
|
|
1868
|
-
nodes: w,
|
|
1869
|
-
edges: A.map((u) => ({
|
|
1870
|
-
...u,
|
|
1871
|
-
midpoint: u.pathData ? hn(u.pathData) : { x: 0, y: 0 }
|
|
1872
|
-
})),
|
|
1873
|
-
viewBox: `${we} ${$} ${fe - we} ${I - $}`,
|
|
1874
|
-
arrowShape: m.arrowShape,
|
|
1875
|
-
arrowSize: m.arrowSize
|
|
1876
|
-
};
|
|
1877
|
-
}
|
|
1878
|
-
return cn(() => {
|
|
1879
|
-
try {
|
|
1880
|
-
const l = v(t) || [], c = v(o) || [], f = v(n) || {};
|
|
1881
|
-
a(l, c, f);
|
|
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) || [], f = v(n) || {};
|
|
1891
|
-
a(l, c, f);
|
|
1892
|
-
}
|
|
1893
|
-
};
|
|
1894
|
-
}
|
|
1895
|
-
const Ao = { userOptions: { show: !1 } }, No = { userOptions: { show: !1 }, 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" } } } } }, So = { 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" } } } } }, Lo = { 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" } } } } }, Mo = { 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" } } } } }, Oo = { 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" } } } } }, Do = { 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" } } } } }, Ro = { 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" } } } } }, To = {
|
|
1896
|
-
default: {},
|
|
1897
|
-
minimal: Ao,
|
|
1898
|
-
minimalDark: No,
|
|
1899
|
-
dark: So,
|
|
1900
|
-
celebration: Lo,
|
|
1901
|
-
celebrationNight: Mo,
|
|
1902
|
-
hack: Oo,
|
|
1903
|
-
zen: Do,
|
|
1904
|
-
concrete: Ro
|
|
1905
|
-
}, yi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1906
|
-
__proto__: null,
|
|
1907
|
-
celebration: Lo,
|
|
1908
|
-
celebrationNight: Mo,
|
|
1909
|
-
concrete: Ro,
|
|
1910
|
-
dark: So,
|
|
1911
|
-
default: To,
|
|
1912
|
-
hack: Oo,
|
|
1913
|
-
minimal: Ao,
|
|
1914
|
-
minimalDark: No,
|
|
1915
|
-
zen: Do
|
|
1916
|
-
}, Symbol.toStringTag, { value: "Module" })), Ar = ["id"], Nr = {
|
|
1917
|
-
key: 0,
|
|
1918
|
-
class: "dag-chart-error"
|
|
1919
|
-
}, Sr = ["viewBox", "xmlns"], Lr = { key: 0 }, Mr = ["id", "width", "height"], Or = ["cx", "cy", "r", "fill"], Dr = ["x", "y", "width", "height", "fill"], Rr = { key: 2 }, Tr = ["id", "markerWidth", "markerHeight", "refX", "refY"], Pr = ["d", "fill", "stroke"], $r = ["d", "fill", "stroke"], Fr = { class: "vue-ui-dag-edges" }, Br = ["d", "stroke", "stroke-width"], zr = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseenter"], Vr = { class: "vue-ui-dag-nodes" }, Ir = ["onClick", "onMouseenter"], Gr = ["x", "y", "width", "height", "rx", "fill", "stroke", "stroke-width"], jr = ["x", "y", "width", "height"], Wr = { class: "vue-ui-dag-edges" }, Yr = ["d", "stroke-width", "marker-end"], Hr = { class: "vue-ui-dag-node-labels" }, Ur = ["onClick", "onMouseenter"], Zr = ["x", "y", "font-size", "fill", "font-weight"], Xr = ["x", "y", "font-size", "fill", "font-weight", "innerHTML"], qr = { key: 1 }, Kr = {
|
|
1920
|
-
key: 6,
|
|
1921
|
-
class: "vue-data-ui-watermark"
|
|
1922
|
-
}, Jr = ["data-position"], Qr = { key: 0 }, ei = ["data-position"], ti = { key: 0 }, uo = 1.5, oi = {
|
|
1923
|
-
__name: "vue-ui-dag",
|
|
1924
|
-
props: {
|
|
1925
|
-
dataset: {
|
|
1926
|
-
type: Object,
|
|
1927
|
-
default() {
|
|
1928
|
-
return {
|
|
1929
|
-
nodes: [],
|
|
1930
|
-
edges: []
|
|
1931
|
-
};
|
|
1932
|
-
}
|
|
1933
|
-
},
|
|
1934
|
-
config: {
|
|
1935
|
-
type: Object,
|
|
1936
|
-
default() {
|
|
1937
|
-
return {};
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
},
|
|
1941
|
-
emits: ["onNodeClick", "onMidpointEnter", "onMidpointLeave"],
|
|
1942
|
-
setup(e, { expose: t, emit: o }) {
|
|
1943
|
-
const n = et(() => import("./PenAndPaper-LTuSTmWE.js")), s = et(() => import("./UserOptions-CX7Xsusk.js")), i = et(() => import("./PackageVersion-P4S5Z27M.js")), { vue_ui_dag: r } = kn(), { isThemeValid: a, warnInvalidTheme: l } = An(), c = e, f = o, m = C(null), g = C(ut()), w = C(null), A = C(null), x = C(null), P = C(0), J = C(0), we = C(!1), fe = C(!1), $ = C(null), I = C(null), u = C(Ye()), j = C(u.value.style.chart.width), Q = C(u.value.style.chart.height), Te = C({ x: 0, y: 0 }), G = C(null), Pe = C(null), $e = C({ left: "0px", top: "0px" }), ye = C("top"), ne = C(!1), gt = C({ x: 0, y: 0 }), vt = C({ x: 0, y: 0 }), ke = C(null), Ge = C(null), je = C({ left: "0px", top: "0px" }), bt = C("top"), Fe = C(!1), Ce = C(!1), { svgRef: se } = Sn({ config: u.value.style.chart.title }), { userOptionsVisible: We, setUserOptionsVisibility: pt, keepUserOptionState: wt } = Nn({ config: u.value }), ee = C(u.value.style.chart.layout.rankDirection), { loading: Ee, FINAL_DATASET: yt, manualLoading: kt } = Cn({
|
|
1944
|
-
...un(c),
|
|
1945
|
-
FINAL_CONFIG: u,
|
|
1946
|
-
prepareConfig: Ye,
|
|
1947
|
-
skeletonDataset: {
|
|
1948
|
-
nodes: [
|
|
1949
|
-
{ id: "A", label: "" },
|
|
1950
|
-
{ id: "B", label: "" },
|
|
1951
|
-
{ id: "C", label: "" }
|
|
1952
|
-
],
|
|
1953
|
-
edges: [
|
|
1954
|
-
{ from: "A", to: "B" },
|
|
1955
|
-
{ from: "A", to: "C" }
|
|
1956
|
-
]
|
|
1957
|
-
},
|
|
1958
|
-
skeletonConfig: mn({
|
|
1959
|
-
defaultConfig: u.value,
|
|
1960
|
-
userConfig: {
|
|
1961
|
-
userOptions: { show: !1 },
|
|
1962
|
-
style: {
|
|
1963
|
-
chart: {
|
|
1964
|
-
backgroundColor: "#99999930",
|
|
1965
|
-
nodes: {
|
|
1966
|
-
stroke: "#CCCCCC",
|
|
1967
|
-
backgroundColor: "#DDDDDD50"
|
|
1968
|
-
},
|
|
1969
|
-
edges: {
|
|
1970
|
-
stroke: "#CCCCCC"
|
|
1971
|
-
},
|
|
1972
|
-
midpoints: {
|
|
1973
|
-
stroke: "#CCCCCC",
|
|
1974
|
-
fill: "#CCCCCC"
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
})
|
|
1980
|
-
});
|
|
1981
|
-
function Ye() {
|
|
1982
|
-
const h = nt({
|
|
1983
|
-
userConfig: c.config,
|
|
1984
|
-
defaultConfig: r
|
|
1985
|
-
}), b = h.theme;
|
|
1986
|
-
if (!b) return h;
|
|
1987
|
-
if (!a.value(h))
|
|
1988
|
-
return l(h), h;
|
|
1989
|
-
const d = nt({
|
|
1990
|
-
userConfig: To[b] || c.config,
|
|
1991
|
-
defaultConfig: h
|
|
1992
|
-
});
|
|
1993
|
-
return nt({
|
|
1994
|
-
userConfig: c.config,
|
|
1995
|
-
defaultConfig: d
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
const He = H(() => !!u.value.debug);
|
|
1999
|
-
Gt(async () => {
|
|
2000
|
-
gn(c.dataset) && (Zt({
|
|
2001
|
-
componentName: "VueUiDag",
|
|
2002
|
-
type: "dataset",
|
|
2003
|
-
debug: He.value
|
|
2004
|
-
}), fe.value = !1, kt.value = !0), c.dataset.nodes || (Zt({
|
|
2005
|
-
componentName: "VueUiDag",
|
|
2006
|
-
type: "datasetAttributeEmpty",
|
|
2007
|
-
property: "nodes",
|
|
2008
|
-
index: 0,
|
|
2009
|
-
debug: He.value
|
|
2010
|
-
}), fe.value = !1, kt.value = !0), fe.value = !0, await Ae(), Vt();
|
|
2011
|
-
}), Ne(() => c.config, async (h) => {
|
|
2012
|
-
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, he.value = u.value.style.chart.zoom.active, await Ae(), Vt();
|
|
2013
|
-
}, { deep: !0 });
|
|
2014
|
-
const { isPrinting: Ct, isImaging: Et, generatePdf: _t, generateImage: xt } = _n({
|
|
2015
|
-
elementId: `dag_${g.value}`,
|
|
2016
|
-
fileName: u.value.style.chart.title.text || "vue-ui-dag",
|
|
2017
|
-
options: u.value.userOptions.print
|
|
2018
|
-
}), Po = H(() => u.value.style.chart.backgroundColor), $o = H(() => u.value.style.chart.title), { exportSvg: Fo, getSvg: Bo } = xn({
|
|
2019
|
-
svg: se,
|
|
2020
|
-
title: $o,
|
|
2021
|
-
legend: void 0,
|
|
2022
|
-
legendItems: void 0,
|
|
2023
|
-
backgroundColor: Po
|
|
2024
|
-
});
|
|
2025
|
-
async function At({ isCb: h }) {
|
|
2026
|
-
if (h) {
|
|
2027
|
-
const { blob: b, url: d, text: p, dataUrl: O } = await Bo();
|
|
2028
|
-
u.value.userOptions.callbacks.svg({ blob: b, url: d, text: p, dataUrl: O });
|
|
2029
|
-
} else
|
|
2030
|
-
Fo();
|
|
2031
|
-
}
|
|
2032
|
-
function zo() {
|
|
2033
|
-
we.value = !0, pt(!0);
|
|
2034
|
-
}
|
|
2035
|
-
function Vo() {
|
|
2036
|
-
pt(!1), we.value = !1;
|
|
2037
|
-
}
|
|
2038
|
-
function Nt({
|
|
2039
|
-
tooltipRef: h,
|
|
2040
|
-
isVisibleRef: b,
|
|
2041
|
-
anchorRef: d,
|
|
2042
|
-
styleRef: p,
|
|
2043
|
-
placementRef: O,
|
|
2044
|
-
offsetRef: N,
|
|
2045
|
-
margin: E = 24
|
|
2046
|
-
}) {
|
|
2047
|
-
return function() {
|
|
2048
|
-
const W = h.value;
|
|
2049
|
-
if (!W || !b.value) return;
|
|
2050
|
-
const S = W.getBoundingClientRect(), T = window.innerWidth, B = window.innerHeight, Y = d.value.x, q = d.value.y, U = N?.value?.x ?? 0, le = N?.value?.y ?? 0;
|
|
2051
|
-
let D = q - le - S.height - E, Z = Y - S.width / 2, _e = "top";
|
|
2052
|
-
if (D < E) {
|
|
2053
|
-
const ge = q + le + E;
|
|
2054
|
-
ge + S.height <= B - E ? (D = ge, _e = "bottom") : (D = q - S.height / 2, D < E && (D = E), D + S.height > B - E && (D = B - S.height - E), _e = "center");
|
|
2055
|
-
}
|
|
2056
|
-
Z < E && (Z = E), Z + S.width > T - E && (Z = T - S.width - E);
|
|
2057
|
-
const rn = Z <= E, an = Z + S.width >= T - E;
|
|
2058
|
-
if ((rn || an) && _e !== "center") {
|
|
2059
|
-
let ge, xe;
|
|
2060
|
-
const ln = Y - U - E;
|
|
2061
|
-
T - (Y + U) - E >= ln ? (ge = "right", xe = Y + U + E) : (ge = "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 = ge);
|
|
2062
|
-
}
|
|
2063
|
-
O.value = _e, p.value = {
|
|
2064
|
-
left: `${Z}px`,
|
|
2065
|
-
top: `${D}px`
|
|
2066
|
-
};
|
|
2067
|
-
};
|
|
2068
|
-
}
|
|
2069
|
-
const Io = H(() => yt.value.nodes.map((h) => ({
|
|
2070
|
-
...h,
|
|
2071
|
-
backgroundColor: h.backgroundColor ? Xt(h.backgroundColor) : u.value.style.chart.nodes.backgroundColor,
|
|
2072
|
-
color: h.color ? Xt(h.color) : u.value.style.chart.nodes.labels.color
|
|
2073
|
-
}))), Go = H(() => yt.value.edges), jo = H(() => ({
|
|
2074
|
-
...u.value.style.chart.layout,
|
|
2075
|
-
rankDirection: ee.value
|
|
2076
|
-
})), { layoutData: k, lastError: St, arrowMarkerIdentifier: Wo } = xr({
|
|
2077
|
-
nodes: Io,
|
|
2078
|
-
edges: Go,
|
|
2079
|
-
configuration: jo
|
|
2080
|
-
});
|
|
2081
|
-
function Lt(h) {
|
|
2082
|
-
return k.value ? k.value.nodes.find((b) => b.id === h) : null;
|
|
2083
|
-
}
|
|
2084
|
-
const Yo = H(() => {
|
|
2085
|
-
if (!k.value) return [];
|
|
2086
|
-
const h = u.value.style.chart.edges.stroke, b = /* @__PURE__ */ new Set();
|
|
2087
|
-
return k.value.edges.forEach((d) => {
|
|
2088
|
-
b.add(d.original?.color || h);
|
|
2089
|
-
}), Array.from(b);
|
|
2090
|
-
});
|
|
2091
|
-
function Mt(h) {
|
|
2092
|
-
return `${Wo}-${String(h).replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
2093
|
-
}
|
|
2094
|
-
const Ot = H(() => {
|
|
2095
|
-
const h = j.value, b = Q.value, d = Number(h), p = Number(b), O = Number.isFinite(d) && d > 0, N = Number.isFinite(p) && p > 0;
|
|
2096
|
-
return !O && !N ? null : {
|
|
2097
|
-
width: O ? d : null,
|
|
2098
|
-
height: N ? p : null
|
|
2099
|
-
};
|
|
2100
|
-
}), re = C(null), he = C(u.value.style.chart.zoom.active), {
|
|
2101
|
-
viewBox: me,
|
|
2102
|
-
resetZoom: Be,
|
|
2103
|
-
setInitialViewBox: Ho,
|
|
2104
|
-
scale: Dt,
|
|
2105
|
-
zoomByFactor: Rt
|
|
2106
|
-
} = yn(
|
|
2107
|
-
se,
|
|
2108
|
-
{ x: 0, y: 0, width: 100, height: 100 },
|
|
2109
|
-
1,
|
|
2110
|
-
he,
|
|
2111
|
-
() => {
|
|
2112
|
-
ne.value = !1;
|
|
2113
|
-
}
|
|
2114
|
-
);
|
|
2115
|
-
function Uo() {
|
|
2116
|
-
he.value = !he.value;
|
|
2117
|
-
}
|
|
2118
|
-
function Tt() {
|
|
2119
|
-
const h = k.value && k.value.viewBox;
|
|
2120
|
-
if (!h) return;
|
|
2121
|
-
const b = String(h).split(" ").map(Number);
|
|
2122
|
-
if (b.length !== 4) return;
|
|
2123
|
-
const [d, p, O, N] = b;
|
|
2124
|
-
if (!Number.isFinite(d) || !Number.isFinite(p) || !Number.isFinite(O) || !Number.isFinite(N))
|
|
2125
|
-
return;
|
|
2126
|
-
let E = O, R = N, W = d, S = p;
|
|
2127
|
-
const T = Ot.value;
|
|
2128
|
-
T && (T.width !== null && (E = T.width), T.height !== null && (R = T.height), W = d - (E - O) / 2, S = p - (R - N) / 2), Ho(
|
|
2129
|
-
{ x: W, y: S, width: E, height: R },
|
|
2130
|
-
{ overwriteCurrentIfNotZoomed: !0 }
|
|
2131
|
-
);
|
|
2132
|
-
}
|
|
2133
|
-
Ne(
|
|
2134
|
-
() => k.value && k.value.viewBox,
|
|
2135
|
-
() => {
|
|
2136
|
-
Tt();
|
|
2137
|
-
},
|
|
2138
|
-
{ immediate: !0 }
|
|
2139
|
-
), Ne(
|
|
2140
|
-
() => Ot.value,
|
|
2141
|
-
() => {
|
|
2142
|
-
Tt();
|
|
2143
|
-
}
|
|
2144
|
-
), Ne(() => Ce.value, (h) => {
|
|
2145
|
-
he.value = !h;
|
|
2146
|
-
});
|
|
2147
|
-
const Zo = H(() => {
|
|
2148
|
-
const h = me.value;
|
|
2149
|
-
return h ? `${h.x} ${h.y} ${h.width} ${h.height}` : "0 0 0 0";
|
|
2150
|
-
}), ie = C(!1);
|
|
2151
|
-
function Pt(h) {
|
|
2152
|
-
ie.value = h, J.value += 1;
|
|
2153
|
-
}
|
|
2154
|
-
function Ue() {
|
|
2155
|
-
Ce.value = !Ce.value;
|
|
2156
|
-
}
|
|
2157
|
-
function Ze() {
|
|
2158
|
-
Rt(uo, !0);
|
|
2159
|
-
}
|
|
2160
|
-
function Xe() {
|
|
2161
|
-
Rt(1 / uo, !0);
|
|
2162
|
-
}
|
|
2163
|
-
const qe = ["TB", "RL", "BT", "LR"];
|
|
2164
|
-
function Ke() {
|
|
2165
|
-
ee.value = qe[(qe.indexOf(ee.value) + 1) % qe.length], Be();
|
|
2166
|
-
}
|
|
2167
|
-
const Xo = Nt({
|
|
2168
|
-
tooltipRef: Pe,
|
|
2169
|
-
isVisibleRef: Fe,
|
|
2170
|
-
anchorRef: Te,
|
|
2171
|
-
styleRef: $e,
|
|
2172
|
-
placementRef: ye
|
|
2173
|
-
}), qo = Nt({
|
|
2174
|
-
tooltipRef: Ge,
|
|
2175
|
-
isVisibleRef: ne,
|
|
2176
|
-
anchorRef: gt,
|
|
2177
|
-
styleRef: je,
|
|
2178
|
-
placementRef: bt,
|
|
2179
|
-
offsetRef: vt
|
|
2180
|
-
});
|
|
2181
|
-
async function Ko(h) {
|
|
2182
|
-
f("onMidpointEnter", h);
|
|
2183
|
-
const b = se.value;
|
|
2184
|
-
if (!b || !h?.midpoint) return;
|
|
2185
|
-
const d = b.createSVGPoint();
|
|
2186
|
-
d.x = h.midpoint.x, d.y = h.midpoint.y;
|
|
2187
|
-
const p = b.getScreenCTM();
|
|
2188
|
-
if (!p) return;
|
|
2189
|
-
const O = d.matrixTransform(p);
|
|
2190
|
-
Te.value = {
|
|
2191
|
-
x: O.x,
|
|
2192
|
-
y: O.y
|
|
2193
|
-
}, G.value = h, Fe.value = !0, await Ae(), Xo();
|
|
2194
|
-
}
|
|
2195
|
-
function Jo() {
|
|
2196
|
-
Fe.value = !1, G.value = null, f("onMidpointLeave");
|
|
2197
|
-
}
|
|
2198
|
-
async function $t(h) {
|
|
2199
|
-
if (f("onNodeClick", h), !u.value.style.chart.nodes.tooltip.showOnClick) return;
|
|
2200
|
-
const b = se.value;
|
|
2201
|
-
if (!b) return;
|
|
2202
|
-
const d = b.createSVGPoint();
|
|
2203
|
-
d.x = h.x, d.y = h.y;
|
|
2204
|
-
const p = b.getScreenCTM();
|
|
2205
|
-
if (!p) return;
|
|
2206
|
-
const O = d.matrixTransform(p), N = u.value.style.chart.layout.nodeWidth, E = u.value.style.chart.layout.nodeHeight, R = p.a, W = p.d, S = N * R, T = E * W;
|
|
2207
|
-
vt.value = {
|
|
2208
|
-
x: S / 2,
|
|
2209
|
-
y: T / 2
|
|
2210
|
-
}, gt.value = {
|
|
2211
|
-
x: O.x,
|
|
2212
|
-
y: O.y
|
|
2213
|
-
}, ke.value = h, ne.value = !0, await Ae(), qo();
|
|
2214
|
-
}
|
|
2215
|
-
function Ft() {
|
|
2216
|
-
ne.value = !1, ke.value = null;
|
|
2217
|
-
}
|
|
2218
|
-
function Bt(h) {
|
|
2219
|
-
if (!ne.value) return;
|
|
2220
|
-
const b = Ge.value;
|
|
2221
|
-
if (b && b.contains(h.target))
|
|
2222
|
-
return;
|
|
2223
|
-
const d = se.value;
|
|
2224
|
-
d && d.contains(h.target) && h.target.closest(".vue-ui-dag-node") || Ft();
|
|
2225
|
-
}
|
|
2226
|
-
function zt(h) {
|
|
2227
|
-
h.key === "Escape" && ne.value && Ft();
|
|
2228
|
-
}
|
|
2229
|
-
Gt(() => {
|
|
2230
|
-
document.addEventListener("mousedown", Bt), document.addEventListener("keydown", zt);
|
|
2231
|
-
}), jt(() => {
|
|
2232
|
-
document.removeEventListener("mousedown", Bt), document.removeEventListener("keydown", zt), $.value && (I.value && $.value.unobserve(I.value), $.value.disconnect());
|
|
2233
|
-
});
|
|
2234
|
-
function Vt() {
|
|
2235
|
-
if (!u.value.responsive) {
|
|
2236
|
-
$.value && (I.value && $.value.unobserve(I.value), $.value.disconnect(), $.value = null, I.value = null);
|
|
2237
|
-
return;
|
|
2238
|
-
}
|
|
2239
|
-
const h = pn(() => {
|
|
2240
|
-
if (!m.value) return;
|
|
2241
|
-
const { width: b, height: d } = wn({
|
|
2242
|
-
chart: m.value,
|
|
2243
|
-
title: u.value.style.chart.title.text ? w.value : null,
|
|
2244
|
-
legend: u.value.style.chart.controls.show ? x.value?.$el : null,
|
|
2245
|
-
source: A.value
|
|
2246
|
-
});
|
|
2247
|
-
requestAnimationFrame(() => {
|
|
2248
|
-
j.value = Math.max(0.1, b), Q.value = Math.max(0.1, d - 12);
|
|
2249
|
-
});
|
|
2250
|
-
});
|
|
2251
|
-
$.value && (I.value && $.value.unobserve(I.value), $.value.disconnect()), $.value = new ResizeObserver(h), I.value = m.value ? m.value.parentNode : null, I.value && $.value.observe(I.value), h();
|
|
2252
|
-
}
|
|
2253
|
-
function Qo(h, b = {}) {
|
|
2254
|
-
const {
|
|
2255
|
-
direction: d = -1,
|
|
2256
|
-
mode: p = "oneLapNearest",
|
|
2257
|
-
dasharray: O = null
|
|
2258
|
-
} = b;
|
|
2259
|
-
if (!h || typeof h.getTotalLength != "function")
|
|
2260
|
-
return He.value && console.warn(
|
|
2261
|
-
"VueUiDag @getIdealDashoffsetDelta: invalid path element",
|
|
2262
|
-
h
|
|
2263
|
-
), 0;
|
|
2264
|
-
const N = h.getTotalLength(), E = O ?? h.getAttribute("stroke-dasharray") ?? (typeof getComputedStyle == "function" ? getComputedStyle(h).strokeDasharray : ""), R = Y(E);
|
|
2265
|
-
if (!Number.isFinite(R) || R <= 0)
|
|
2266
|
-
return d * N;
|
|
2267
|
-
const W = Math.max(1, Math.round(N / R)), S = Math.max(1, Math.ceil(N / R)), T = Math.max(1, Math.floor(N / R));
|
|
2268
|
-
let B;
|
|
2269
|
-
return p === "pattern" ? B = R : p === "oneLapCeil" ? B = S * R : p === "oneLapFloor" ? B = T * R : B = W * R, d * B;
|
|
2270
|
-
function Y(q) {
|
|
2271
|
-
if (!q || q === "none") return NaN;
|
|
2272
|
-
const U = String(q).replace(/,/g, " ").trim().split(/\s+/).map((D) => Number.parseFloat(D)).filter((D) => Number.isFinite(D));
|
|
2273
|
-
if (!U.length) return NaN;
|
|
2274
|
-
const le = U.reduce((D, Z) => D + Z, 0);
|
|
2275
|
-
return U.length % 2 === 1 ? le * 2 : le;
|
|
2276
|
-
}
|
|
2277
|
-
}
|
|
2278
|
-
const Je = C(/* @__PURE__ */ new Map()), Qe = C(/* @__PURE__ */ new Map());
|
|
2279
|
-
function en(h) {
|
|
2280
|
-
return function(d) {
|
|
2281
|
-
d ? Je.value.set(h, d) : Je.value.delete(h);
|
|
2282
|
-
};
|
|
2283
|
-
}
|
|
2284
|
-
function It() {
|
|
2285
|
-
Qe.value.forEach((h) => {
|
|
2286
|
-
try {
|
|
2287
|
-
h.cancel();
|
|
2288
|
-
} catch {
|
|
2289
|
-
}
|
|
2290
|
-
}), Qe.value.clear();
|
|
2291
|
-
}
|
|
2292
|
-
function tn() {
|
|
2293
|
-
It();
|
|
2294
|
-
const h = k.value?.edges ?? [];
|
|
2295
|
-
if (!h.length) return;
|
|
2296
|
-
const b = u.value.style.chart.edges.animations, d = Number(b.referenceDistance) > 0 ? Number(b.referenceDistance) : 24;
|
|
2297
|
-
h.forEach((p) => {
|
|
2298
|
-
if (!!!p?.original?.animated) return;
|
|
2299
|
-
const N = Je.value.get(p.id);
|
|
2300
|
-
if (!N) return;
|
|
2301
|
-
const E = p?.original?.dasharray ?? b.dasharray;
|
|
2302
|
-
N.style.strokeDasharray = String(E), N.style.strokeDashoffset = "0";
|
|
2303
|
-
const R = ![void 0, null].includes(p?.original?.animationDirection), W = ![void 0, null].includes(b.animationDirection), S = R ? Number(p.original.animationDirection) : W ? Number(b.animationDirection) : -1, T = Qo(N, {
|
|
2304
|
-
direction: S,
|
|
2305
|
-
mode: "oneLapNearest",
|
|
2306
|
-
dasharray: String(E)
|
|
2307
|
-
}), B = p?.original?.animationDurationMs ?? b.animationDurationMs ?? 1e3, Y = Number(B), U = Number.isFinite(Y) && Y > 0 ? d / Y : d / 1e3, le = Math.max(1, Math.round(Math.abs(T) / Math.max(1e-9, U))), D = N.animate(
|
|
2308
|
-
[{ strokeDashoffset: 0 }, { strokeDashoffset: T }],
|
|
2309
|
-
{ duration: le, iterations: 1 / 0, easing: "linear" }
|
|
2310
|
-
);
|
|
2311
|
-
Qe.value.set(p.id, D);
|
|
2312
|
-
});
|
|
2313
|
-
}
|
|
2314
|
-
Ne(
|
|
2315
|
-
() => k.value && k.value.edges,
|
|
2316
|
-
async () => {
|
|
2317
|
-
await Ae(), tn();
|
|
2318
|
-
},
|
|
2319
|
-
{ deep: !0, immediate: !0 }
|
|
2320
|
-
), jt(() => {
|
|
2321
|
-
It();
|
|
2322
|
-
});
|
|
2323
|
-
async function on({ scale: h = 2 } = {}) {
|
|
2324
|
-
if (!m.value) return;
|
|
2325
|
-
const { width: b, height: d } = m.value.getBoundingClientRect(), p = b / d, { imageUri: O, base64: N } = await Mn({ domElement: m.value, base64: !0, img: !0, scale: h });
|
|
2326
|
-
return {
|
|
2327
|
-
imageUri: O,
|
|
2328
|
-
base64: N,
|
|
2329
|
-
title: u.value.style.chart.title.text ?? "vue-ui-dag",
|
|
2330
|
-
width: b,
|
|
2331
|
-
height: d,
|
|
2332
|
-
aspectRatio: p
|
|
2333
|
-
};
|
|
2334
|
-
}
|
|
2335
|
-
const ae = H(() => {
|
|
2336
|
-
const h = Number(u.value.style.chart.layout.nodeHeight);
|
|
2337
|
-
return Number.isFinite(h) && h > 0 ? h / u.value.style.chart.backgroundPattern.spacingRatio : 12;
|
|
2338
|
-
}), nn = H(() => ae.value * (u.value.style.chart.backgroundPattern.dotRadiusRatio / 100));
|
|
2339
|
-
function sn() {
|
|
2340
|
-
return k.value;
|
|
2341
|
-
}
|
|
2342
|
-
return t({
|
|
2343
|
-
getData: sn,
|
|
2344
|
-
getImage: on,
|
|
2345
|
-
generatePdf: _t,
|
|
2346
|
-
generateSvg: At,
|
|
2347
|
-
generateImage: xt,
|
|
2348
|
-
toggleAnnotator: Ue,
|
|
2349
|
-
toggleFullscreen: Pt,
|
|
2350
|
-
zoomIn: Ze,
|
|
2351
|
-
zoomOut: Xe,
|
|
2352
|
-
resetZoom: Be,
|
|
2353
|
-
switchDirection: Ke
|
|
2354
|
-
}), (h, b) => (y(), _("div", {
|
|
2355
|
-
class: Wt(`vue-data-ui-component vue-ui-dag ${ie.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${u.value.responsive ? "vue-ui-dag-responsive" : ""}`),
|
|
2356
|
-
id: `dag_${g.value}`,
|
|
2357
|
-
ref_key: "dagChart",
|
|
2358
|
-
ref: m,
|
|
2359
|
-
style: ce({
|
|
2360
|
-
fontFamily: u.value.style.fontFamily,
|
|
2361
|
-
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2362
|
-
padding: "0.5rem"
|
|
2363
|
-
}),
|
|
2364
|
-
onMouseenter: zo,
|
|
2365
|
-
onMouseleave: Vo
|
|
2366
|
-
}, [
|
|
2367
|
-
v(St) ? (y(), _("div", Nr, Se(String(v(St))), 1)) : L("", !0),
|
|
2368
|
-
u.value.userOptions.buttons.annotator ? (y(), te(v(n), {
|
|
2369
|
-
key: 1,
|
|
2370
|
-
svgRef: v(se),
|
|
2371
|
-
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2372
|
-
color: u.value.style.chart.color,
|
|
2373
|
-
active: Ce.value,
|
|
2374
|
-
onClose: Ue
|
|
2375
|
-
}, {
|
|
2376
|
-
"annotator-action-close": F(() => [
|
|
2377
|
-
M(h.$slots, "annotator-action-close", {}, void 0, !0)
|
|
2378
|
-
]),
|
|
2379
|
-
"annotator-action-color": F(({ color: d }) => [
|
|
2380
|
-
M(h.$slots, "annotator-action-color", z(V({ color: d })), void 0, !0)
|
|
2381
|
-
]),
|
|
2382
|
-
"annotator-action-draw": F(({ mode: d }) => [
|
|
2383
|
-
M(h.$slots, "annotator-action-draw", z(V({ mode: d })), void 0, !0)
|
|
2384
|
-
]),
|
|
2385
|
-
"annotator-action-undo": F(({ disabled: d }) => [
|
|
2386
|
-
M(h.$slots, "annotator-action-undo", z(V({ disabled: d })), void 0, !0)
|
|
2387
|
-
]),
|
|
2388
|
-
"annotator-action-redo": F(({ disabled: d }) => [
|
|
2389
|
-
M(h.$slots, "annotator-action-redo", z(V({ disabled: d })), void 0, !0)
|
|
2390
|
-
]),
|
|
2391
|
-
"annotator-action-delete": F(({ disabled: d }) => [
|
|
2392
|
-
M(h.$slots, "annotator-action-delete", z(V({ disabled: d })), void 0, !0)
|
|
2393
|
-
]),
|
|
2394
|
-
_: 3
|
|
2395
|
-
}, 8, ["svgRef", "backgroundColor", "color", "active"])) : L("", !0),
|
|
2396
|
-
u.value.userOptions.show && fe.value && (v(wt) || v(We)) ? (y(), te(v(s), {
|
|
2397
|
-
ref: "userOptionsRef",
|
|
2398
|
-
key: `user_option_${J.value}`,
|
|
2399
|
-
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2400
|
-
color: u.value.style.chart.color,
|
|
2401
|
-
isPrinting: v(Ct),
|
|
2402
|
-
isImaging: v(Et),
|
|
2403
|
-
uid: g.value,
|
|
2404
|
-
hasTooltip: !1,
|
|
2405
|
-
hasTable: !1,
|
|
2406
|
-
hasXls: !1,
|
|
2407
|
-
hasLabel: !1,
|
|
2408
|
-
hasPdf: u.value.userOptions.buttons.pdf,
|
|
2409
|
-
hasImg: u.value.userOptions.buttons.img,
|
|
2410
|
-
hasSvg: u.value.userOptions.buttons.svg,
|
|
2411
|
-
hasFullscreen: u.value.userOptions.buttons.fullscreen,
|
|
2412
|
-
isFullscreen: ie.value,
|
|
2413
|
-
chartElement: m.value,
|
|
2414
|
-
position: u.value.userOptions.position,
|
|
2415
|
-
titles: { ...u.value.userOptions.buttonTitles },
|
|
2416
|
-
hasAnnotator: u.value.userOptions.buttons.annotator,
|
|
2417
|
-
isAnnotation: Ce.value,
|
|
2418
|
-
callbacks: u.value.userOptions.callbacks,
|
|
2419
|
-
printScale: u.value.userOptions.print.scale,
|
|
2420
|
-
hasZoom: u.value.userOptions.buttons.zoom,
|
|
2421
|
-
isZoom: he.value,
|
|
2422
|
-
onToggleFullscreen: Pt,
|
|
2423
|
-
onGeneratePdf: v(_t),
|
|
2424
|
-
onGenerateImage: v(xt),
|
|
2425
|
-
onGenerateSvg: At,
|
|
2426
|
-
onToggleAnnotator: Ue,
|
|
2427
|
-
onToggleZoom: Uo,
|
|
2428
|
-
style: ce({
|
|
2429
|
-
visibility: v(wt) ? v(We) ? "visible" : "hidden" : "visible"
|
|
2430
|
-
})
|
|
2431
|
-
}, dn({ _: 2 }, [
|
|
2432
|
-
h.$slots.menuIcon ? {
|
|
2433
|
-
name: "menuIcon",
|
|
2434
|
-
fn: F(({ isOpen: d, color: p }) => [
|
|
2435
|
-
M(h.$slots, "menuIcon", z(V({ isOpen: d, color: p })), void 0, !0)
|
|
2436
|
-
]),
|
|
2437
|
-
key: "0"
|
|
2438
|
-
} : void 0,
|
|
2439
|
-
h.$slots.optionPdf ? {
|
|
2440
|
-
name: "optionPdf",
|
|
2441
|
-
fn: F(() => [
|
|
2442
|
-
M(h.$slots, "optionPdf", {}, void 0, !0)
|
|
2443
|
-
]),
|
|
2444
|
-
key: "1"
|
|
2445
|
-
} : void 0,
|
|
2446
|
-
h.$slots.optionImg ? {
|
|
2447
|
-
name: "optionImg",
|
|
2448
|
-
fn: F(() => [
|
|
2449
|
-
M(h.$slots, "optionImg", {}, void 0, !0)
|
|
2450
|
-
]),
|
|
2451
|
-
key: "2"
|
|
2452
|
-
} : void 0,
|
|
2453
|
-
h.$slots.optionSvg ? {
|
|
2454
|
-
name: "optionSvg",
|
|
2455
|
-
fn: F(() => [
|
|
2456
|
-
M(h.$slots, "optionSvg", {}, void 0, !0)
|
|
2457
|
-
]),
|
|
2458
|
-
key: "3"
|
|
2459
|
-
} : void 0,
|
|
2460
|
-
h.$slots.optionFullscreen ? {
|
|
2461
|
-
name: "optionFullscreen",
|
|
2462
|
-
fn: F(({ toggleFullscreen: d, isFullscreen: p }) => [
|
|
2463
|
-
M(h.$slots, "optionFullscreen", z(V({ toggleFullscreen: d, isFullscreen: p })), void 0, !0)
|
|
2464
|
-
]),
|
|
2465
|
-
key: "4"
|
|
2466
|
-
} : void 0,
|
|
2467
|
-
h.$slots.optionAnnotator ? {
|
|
2468
|
-
name: "optionAnnotator",
|
|
2469
|
-
fn: F(({ toggleAnnotator: d, isAnnotator: p }) => [
|
|
2470
|
-
M(h.$slots, "optionAnnotator", z(V({ toggleAnnotator: d, isAnnotator: p })), void 0, !0)
|
|
2471
|
-
]),
|
|
2472
|
-
key: "5"
|
|
2473
|
-
} : void 0,
|
|
2474
|
-
h.$slots.optionZoom ? {
|
|
2475
|
-
name: "optionZoom",
|
|
2476
|
-
fn: F(({ toggleZoom: d, isZoomLocked: p }) => [
|
|
2477
|
-
M(h.$slots, "optionZoom", z(V({ toggleZoom: d, isZoomLocked: p })), void 0, !0)
|
|
2478
|
-
]),
|
|
2479
|
-
key: "6"
|
|
2480
|
-
} : void 0
|
|
2481
|
-
]), 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),
|
|
2482
|
-
u.value.style.chart.title.text ? (y(), _("div", {
|
|
2483
|
-
key: 3,
|
|
2484
|
-
ref_key: "chartTitle",
|
|
2485
|
-
ref: w,
|
|
2486
|
-
style: "width:100%;background:transparent;"
|
|
2487
|
-
}, [
|
|
2488
|
-
(y(), te(Ln, {
|
|
2489
|
-
key: `title_${P.value}`,
|
|
2490
|
-
config: {
|
|
2491
|
-
title: {
|
|
2492
|
-
cy: "dag-title",
|
|
2493
|
-
...u.value.style.chart.title
|
|
2494
|
-
},
|
|
2495
|
-
subtitle: {
|
|
2496
|
-
cy: "dag-subtitle",
|
|
2497
|
-
...u.value.style.chart.title.subtitle
|
|
2498
|
-
}
|
|
2499
|
-
}
|
|
2500
|
-
}, null, 8, ["config"]))
|
|
2501
|
-
], 512)) : L("", !0),
|
|
2502
|
-
u.value.style.chart.controls.position === "top" && !v(Ee) && u.value.style.chart.controls.show ? (y(), te(qt, {
|
|
2503
|
-
key: 4,
|
|
2504
|
-
ref_key: "zoomControls",
|
|
2505
|
-
ref: x,
|
|
2506
|
-
config: u.value,
|
|
2507
|
-
scale: v(Dt),
|
|
2508
|
-
isFullscreen: ie.value,
|
|
2509
|
-
withDirection: "",
|
|
2510
|
-
onZoomIn: Ze,
|
|
2511
|
-
onZoomOut: Xe,
|
|
2512
|
-
onResetZoom: b[0] || (b[0] = () => v(Be)(!0)),
|
|
2513
|
-
onSwitchDirection: Ke
|
|
2514
|
-
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2515
|
-
v(k) ? (y(), _("svg", {
|
|
2516
|
-
key: 5,
|
|
2517
|
-
ref_key: "svgRef",
|
|
2518
|
-
ref: se,
|
|
2519
|
-
class: Wt({ "vue-ui-dag-svg": !0, "vue-data-ui-loading": v(Ee) }),
|
|
2520
|
-
viewBox: Zo.value,
|
|
2521
|
-
xmlns: v(vn),
|
|
2522
|
-
style: ce({
|
|
2523
|
-
backgroundColor: u.value.style.chart.backgroundColor,
|
|
2524
|
-
height: "100%",
|
|
2525
|
-
width: "100%"
|
|
2526
|
-
})
|
|
2527
|
-
}, [
|
|
2528
|
-
tt(v(i)),
|
|
2529
|
-
u.value.style.chart.backgroundPattern.show ? (y(), _("defs", Lr, [
|
|
2530
|
-
K("pattern", {
|
|
2531
|
-
id: `dag_bg_pattern_${g.value}`,
|
|
2532
|
-
patternUnits: "userSpaceOnUse",
|
|
2533
|
-
width: ae.value,
|
|
2534
|
-
height: ae.value
|
|
2535
|
-
}, [
|
|
2536
|
-
M(h.$slots, "background-pattern", z(V({
|
|
2537
|
-
x: ae.value / 2,
|
|
2538
|
-
y: ae.value / 2,
|
|
2539
|
-
color: u.value.style.chart.backgroundPattern.dotColor
|
|
2540
|
-
})), () => [
|
|
2541
|
-
K("circle", {
|
|
2542
|
-
cx: ae.value / 2,
|
|
2543
|
-
cy: ae.value / 2,
|
|
2544
|
-
r: nn.value,
|
|
2545
|
-
fill: u.value.style.chart.backgroundPattern.dotColor
|
|
2546
|
-
}, null, 8, Or)
|
|
2547
|
-
], !0)
|
|
2548
|
-
], 8, Mr)
|
|
2549
|
-
])) : L("", !0),
|
|
2550
|
-
u.value.style.chart.backgroundPattern.show ? (y(), _("rect", {
|
|
2551
|
-
key: 1,
|
|
2552
|
-
x: v(me)?.x ?? 0,
|
|
2553
|
-
y: v(me)?.y ?? 0,
|
|
2554
|
-
width: v(me)?.width ?? 0,
|
|
2555
|
-
height: v(me)?.height ?? 0,
|
|
2556
|
-
fill: `url(#dag_bg_pattern_${g.value})`,
|
|
2557
|
-
style: ce({
|
|
2558
|
-
pointerEvents: "none",
|
|
2559
|
-
opacity: u.value.style.chart.backgroundPattern.opacity
|
|
2560
|
-
})
|
|
2561
|
-
}, null, 12, Dr)) : L("", !0),
|
|
2562
|
-
v(k).arrowShape !== "undirected" ? (y(), _("defs", Rr, [
|
|
2563
|
-
(y(!0), _(ue, null, Le(Yo.value, (d) => (y(), _("marker", {
|
|
2564
|
-
key: d,
|
|
2565
|
-
id: Mt(d),
|
|
2566
|
-
markerWidth: v(k).arrowSize,
|
|
2567
|
-
markerHeight: v(k).arrowSize,
|
|
2568
|
-
refX: v(k).arrowSize - 3,
|
|
2569
|
-
refY: v(k).arrowSize / 2,
|
|
2570
|
-
orient: "auto",
|
|
2571
|
-
markerUnits: "strokeWidth"
|
|
2572
|
-
}, [
|
|
2573
|
-
v(k).arrowShape === "normal" ? (y(), _("path", {
|
|
2574
|
-
key: 0,
|
|
2575
|
-
d: `M 0 0 L ${v(k).arrowSize} ${v(k).arrowSize / 2} L 0 ${v(k).arrowSize} Z`,
|
|
2576
|
-
fill: d,
|
|
2577
|
-
stroke: d,
|
|
2578
|
-
"stroke-width": "0"
|
|
2579
|
-
}, null, 8, Pr)) : (y(), _("path", {
|
|
2580
|
-
key: 1,
|
|
2581
|
-
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`,
|
|
2582
|
-
fill: d,
|
|
2583
|
-
stroke: d,
|
|
2584
|
-
"stroke-width": "0"
|
|
2585
|
-
}, null, 8, $r))
|
|
2586
|
-
], 8, Tr))), 128))
|
|
2587
|
-
])) : L("", !0),
|
|
2588
|
-
K("g", Fr, [
|
|
2589
|
-
(y(!0), _(ue, null, Le(v(k).edges, (d) => (y(), _(ue, {
|
|
2590
|
-
key: d.id
|
|
2591
|
-
}, [
|
|
2592
|
-
K("path", {
|
|
2593
|
-
"data-cy-edge": "",
|
|
2594
|
-
ref_for: !0,
|
|
2595
|
-
ref: en(d.id),
|
|
2596
|
-
d: d.pathData,
|
|
2597
|
-
fill: "none",
|
|
2598
|
-
stroke: d.original.color ?? u.value.style.chart.edges.stroke,
|
|
2599
|
-
"stroke-width": u.value.style.chart.edges.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 2 : 1),
|
|
2600
|
-
"stroke-linecap": "round",
|
|
2601
|
-
"stroke-linejoin": "round",
|
|
2602
|
-
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2603
|
-
}, null, 8, Br),
|
|
2604
|
-
u.value.style.chart.midpoints.show ? (y(), _("circle", {
|
|
2605
|
-
key: 0,
|
|
2606
|
-
"data-cy-midpoint": "",
|
|
2607
|
-
class: "vue-ui-dag-edge-midpoint",
|
|
2608
|
-
cx: d.midpoint.x,
|
|
2609
|
-
cy: d.midpoint.y,
|
|
2610
|
-
r: u.value.style.chart.midpoints.radius,
|
|
2611
|
-
fill: u.value.style.chart.midpoints.fill,
|
|
2612
|
-
stroke: d.original.color ?? u.value.style.chart.midpoints.stroke,
|
|
2613
|
-
"stroke-width": u.value.style.chart.midpoints.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 2 : 1),
|
|
2614
|
-
style: { transition: "stroke-width 0.2s ease-in-out" },
|
|
2615
|
-
onMouseenter: (p) => Ko(d),
|
|
2616
|
-
onMouseleave: Jo
|
|
2617
|
-
}, null, 40, zr)) : L("", !0)
|
|
2618
|
-
], 64))), 128))
|
|
2619
|
-
]),
|
|
2620
|
-
K("g", Vr, [
|
|
2621
|
-
(y(!0), _(ue, null, Le(v(k).nodes, (d) => (y(), _("g", {
|
|
2622
|
-
key: d.id,
|
|
2623
|
-
class: "vue-ui-dag-node",
|
|
2624
|
-
onClick: Yt((p) => u.value.style.chart.nodes.tooltip.showOnClick && $t(d), ["stop"]),
|
|
2625
|
-
onMouseenter: (p) => re.value = d.id,
|
|
2626
|
-
onMouseleave: b[1] || (b[1] = (p) => re.value = null)
|
|
2627
|
-
}, [
|
|
2628
|
-
h.$slots.node ? L("", !0) : (y(), _("rect", {
|
|
2629
|
-
key: 0,
|
|
2630
|
-
"data-cy-node": "",
|
|
2631
|
-
x: d.x - d.width / 2,
|
|
2632
|
-
y: d.y - d.height / 2,
|
|
2633
|
-
width: d.width,
|
|
2634
|
-
height: d.height,
|
|
2635
|
-
rx: u.value.style.chart.nodes.borderRadius,
|
|
2636
|
-
fill: d.original.backgroundColor,
|
|
2637
|
-
stroke: u.value.style.chart.nodes.stroke,
|
|
2638
|
-
"stroke-width": u.value.style.chart.nodes.strokeWidth,
|
|
2639
|
-
style: ce({
|
|
2640
|
-
cursor: u.value.style.chart.nodes.tooltip.showOnClick ? "pointer" : "default"
|
|
2641
|
-
})
|
|
2642
|
-
}, null, 12, Gr)),
|
|
2643
|
-
h.$slots.node ? (y(), _("foreignObject", {
|
|
2644
|
-
key: 1,
|
|
2645
|
-
x: d.x - d.width / 2,
|
|
2646
|
-
y: d.y - d.height / 2,
|
|
2647
|
-
width: d.width,
|
|
2648
|
-
height: d.height
|
|
2649
|
-
}, [
|
|
2650
|
-
M(h.$slots, "node", ot({ ref_for: !0 }, { node: d, orientation: ee.value }), void 0, !0)
|
|
2651
|
-
], 8, jr)) : L("", !0)
|
|
2652
|
-
], 40, Ir))), 128))
|
|
2653
|
-
]),
|
|
2654
|
-
K("g", Wr, [
|
|
2655
|
-
(y(!0), _(ue, null, Le(v(k).edges, (d) => (y(), _("path", {
|
|
2656
|
-
key: d.id,
|
|
2657
|
-
d: d.pathData,
|
|
2658
|
-
fill: "none",
|
|
2659
|
-
stroke: "transparent",
|
|
2660
|
-
"stroke-width": u.value.style.chart.edges.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 1.3 : 1),
|
|
2661
|
-
"stroke-linecap": "round",
|
|
2662
|
-
"stroke-linejoin": "round",
|
|
2663
|
-
"marker-end": v(k).arrowShape === "undirected" ? null : `url(#${Mt(d.original?.color || u.value.style.chart.edges.stroke)})`,
|
|
2664
|
-
style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
|
|
2665
|
-
}, null, 8, Yr))), 128))
|
|
2666
|
-
]),
|
|
2667
|
-
K("g", Hr, [
|
|
2668
|
-
(y(!0), _(ue, null, Le(v(k).nodes, (d) => (y(), _("g", {
|
|
2669
|
-
key: d.id,
|
|
2670
|
-
onClick: Yt((p) => u.value.style.chart.nodes.tooltip.showOnClick && $t(d), ["stop"]),
|
|
2671
|
-
onMouseenter: (p) => re.value = d.id,
|
|
2672
|
-
onMouseleave: b[2] || (b[2] = (p) => re.value = null)
|
|
2673
|
-
}, [
|
|
2674
|
-
h.$slots["free-node-label"] ? L("", !0) : (y(), _(ue, { key: 0 }, [
|
|
2675
|
-
h.$slots["node-label"] ? (y(), _("text", {
|
|
2676
|
-
key: 0,
|
|
2677
|
-
x: d.x,
|
|
2678
|
-
y: d.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2679
|
-
"text-anchor": "middle",
|
|
2680
|
-
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2681
|
-
fill: d.original.color,
|
|
2682
|
-
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal"
|
|
2683
|
-
}, [
|
|
2684
|
-
M(h.$slots, "node-label", ot({ ref_for: !0 }, { node: d, orientation: ee.value }), () => [
|
|
2685
|
-
fn(Se(d.label), 1)
|
|
2686
|
-
], !0)
|
|
2687
|
-
], 8, Zr)) : !h.$slots["free-node-label"] && !h.$slots.node ? (y(), _("text", {
|
|
2688
|
-
key: 1,
|
|
2689
|
-
"data-cy-node-label": "",
|
|
2690
|
-
x: d.x,
|
|
2691
|
-
y: d.y + u.value.style.chart.nodes.labels.fontSize / 3,
|
|
2692
|
-
"text-anchor": "middle",
|
|
2693
|
-
"font-size": u.value.style.chart.nodes.labels.fontSize,
|
|
2694
|
-
fill: d.original.color,
|
|
2695
|
-
"font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2696
|
-
innerHTML: v(bn)({
|
|
2697
|
-
content: d.label,
|
|
2698
|
-
fontSize: u.value.style.chart.nodes.labels.fontSize,
|
|
2699
|
-
fontWeight: u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
|
|
2700
|
-
fill: d.original.color,
|
|
2701
|
-
x: d.x,
|
|
2702
|
-
y: d.y,
|
|
2703
|
-
autoOffset: !0
|
|
2704
|
-
})
|
|
2705
|
-
}, null, 8, Xr)) : L("", !0)
|
|
2706
|
-
], 64)),
|
|
2707
|
-
h.$slots["free-node-label"] ? (y(), _("g", qr, [
|
|
2708
|
-
M(h.$slots, "free-node-label", ot({ ref_for: !0 }, { node: d, layoutData: v(k), orientation: ee.value }), void 0, !0)
|
|
2709
|
-
])) : L("", !0)
|
|
2710
|
-
], 40, Ur))), 128))
|
|
2711
|
-
]),
|
|
2712
|
-
M(h.$slots, "svg", {
|
|
2713
|
-
svg: {
|
|
2714
|
-
drawingArea: v(me),
|
|
2715
|
-
data: v(k),
|
|
2716
|
-
orientation: ee.value
|
|
2717
|
-
}
|
|
2718
|
-
}, void 0, !0)
|
|
2719
|
-
], 14, Sr)) : L("", !0),
|
|
2720
|
-
h.$slots.watermark ? (y(), _("div", Kr, [
|
|
2721
|
-
M(h.$slots, "watermark", z(V({ isPrinting: v(Ct) || v(Et) })), void 0, !0)
|
|
2722
|
-
])) : L("", !0),
|
|
2723
|
-
tt(Ht, { name: "fade" }, {
|
|
2724
|
-
default: F(() => [
|
|
2725
|
-
Fe.value ? (y(), te(Ut, {
|
|
2726
|
-
key: 0,
|
|
2727
|
-
to: ie.value ? m.value : "body"
|
|
2728
|
-
}, [
|
|
2729
|
-
K("div", {
|
|
2730
|
-
"data-cy-tooltip-midpoint": "",
|
|
2731
|
-
ref_key: "tooltipRef",
|
|
2732
|
-
ref: Pe,
|
|
2733
|
-
class: "vue-ui-dag-tooltip",
|
|
2734
|
-
style: ce({
|
|
2735
|
-
...$e.value,
|
|
2736
|
-
maxWidth: u.value.style.chart.midpoints.tooltip.maxWidth,
|
|
2737
|
-
"--vue-data-ui-dag-tooltip-background": u.value.style.chart.midpoints.tooltip.backgroundColor,
|
|
2738
|
-
"--vue-data-ui-dag-tooltip-color": u.value.style.chart.midpoints.tooltip.color
|
|
2739
|
-
}),
|
|
2740
|
-
"data-position": ye.value
|
|
2741
|
-
}, [
|
|
2742
|
-
M(h.$slots, "tooltip-midpoint", z(V({ edge: G.value, layoutData: v(k) })), () => [
|
|
2743
|
-
G.value ? (y(), _("div", Qr, Se(Lt(G.value.from)?.label ?? G.value.from) + " → " + Se(Lt(G.value.to)?.label ?? G.value.to), 1)) : L("", !0)
|
|
2744
|
-
], !0)
|
|
2745
|
-
], 12, Jr)
|
|
2746
|
-
], 8, ["to"])) : L("", !0)
|
|
2747
|
-
]),
|
|
2748
|
-
_: 3
|
|
2749
|
-
}),
|
|
2750
|
-
tt(Ht, { name: "fade" }, {
|
|
2751
|
-
default: F(() => [
|
|
2752
|
-
ne.value ? (y(), te(Ut, {
|
|
2753
|
-
key: 0,
|
|
2754
|
-
to: ie.value ? m.value : "body"
|
|
2755
|
-
}, [
|
|
2756
|
-
K("div", {
|
|
2757
|
-
"data-cy-tooltip-node": "",
|
|
2758
|
-
ref_key: "nodeTooltipRef",
|
|
2759
|
-
ref: Ge,
|
|
2760
|
-
class: "vue-ui-dag-node-tooltip",
|
|
2761
|
-
style: ce({
|
|
2762
|
-
maxWidth: u.value.style.chart.nodes.tooltip.maxWidth,
|
|
2763
|
-
left: je.value.left,
|
|
2764
|
-
top: je.value.top,
|
|
2765
|
-
"--vue-data-ui-dag-node-tooltip-background": u.value.style.chart.nodes.tooltip.backgroundColor,
|
|
2766
|
-
"--vue-data-ui-dag-node-tooltip-color": u.value.style.chart.nodes.tooltip.color
|
|
2767
|
-
}),
|
|
2768
|
-
"data-position": bt.value
|
|
2769
|
-
}, [
|
|
2770
|
-
M(h.$slots, "tooltip-node", z(V({ node: ke.value, layoutData: v(k) })), () => [
|
|
2771
|
-
ke.value ? (y(), _("div", ti, Se(ke.value.label), 1)) : L("", !0)
|
|
2772
|
-
], !0)
|
|
2773
|
-
], 12, ei)
|
|
2774
|
-
], 8, ["to"])) : L("", !0)
|
|
2775
|
-
]),
|
|
2776
|
-
_: 3
|
|
2777
|
-
}),
|
|
2778
|
-
u.value.style.chart.controls.position === "bottom" && !v(Ee) && u.value.style.chart.controls.show ? (y(), te(qt, {
|
|
2779
|
-
key: 7,
|
|
2780
|
-
ref_key: "zoomControls",
|
|
2781
|
-
ref: x,
|
|
2782
|
-
config: u.value,
|
|
2783
|
-
scale: v(Dt),
|
|
2784
|
-
isFullscreen: ie.value,
|
|
2785
|
-
withDirection: "",
|
|
2786
|
-
onZoomIn: Ze,
|
|
2787
|
-
onZoomOut: Xe,
|
|
2788
|
-
onResetZoom: b[3] || (b[3] = () => v(Be)(!0)),
|
|
2789
|
-
onSwitchDirection: Ke
|
|
2790
|
-
}, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
|
|
2791
|
-
h.$slots.source ? (y(), _("div", {
|
|
2792
|
-
key: 8,
|
|
2793
|
-
ref_key: "source",
|
|
2794
|
-
ref: A,
|
|
2795
|
-
dir: "auto"
|
|
2796
|
-
}, [
|
|
2797
|
-
M(h.$slots, "source", {}, void 0, !0)
|
|
2798
|
-
], 512)) : L("", !0),
|
|
2799
|
-
v(Ee) ? (y(), te(En, { key: 9 })) : L("", !0)
|
|
2800
|
-
], 46, Ar));
|
|
2801
|
-
}
|
|
2802
|
-
}, ni = /* @__PURE__ */ On(oi, [["__scopeId", "data-v-5cf3932e"]]), ki = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2803
|
-
__proto__: null,
|
|
2804
|
-
default: ni
|
|
2805
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
2806
|
-
export {
|
|
2807
|
-
yi as a,
|
|
2808
|
-
ki as b,
|
|
2809
|
-
ni as v
|
|
2810
|
-
};
|