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