@dagrejs/dagre 2.0.0 → 2.0.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/dist/dagre.cjs.js +1 -1
- package/dist/dagre.cjs.js.map +3 -3
- package/dist/dagre.d.ts +104 -0
- package/dist/dagre.esm.js +1 -1
- package/dist/dagre.esm.js.map +3 -3
- package/dist/dagre.js +41 -1260
- package/dist/dagre.js.map +4 -4
- package/dist/dagre.min.js +1 -1
- package/dist/dagre.min.js.map +4 -4
- package/package.json +3 -2
package/dist/dagre.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Graph as ImportedGraph, Node as GraphNode, Edge as GraphEdge } from '@dagrejs/graphlib';
|
|
2
|
+
|
|
3
|
+
// --- Graphlib Exports (Public API of dagre.graphlib) ---
|
|
4
|
+
|
|
5
|
+
export namespace graphlib {
|
|
6
|
+
export class Graph<T = {}> extends ImportedGraph<T> {}
|
|
7
|
+
|
|
8
|
+
export namespace json {
|
|
9
|
+
function read(graph: any): Graph;
|
|
10
|
+
function write(graph: Graph): any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export namespace alg {
|
|
14
|
+
function components(graph: Graph): string[][];
|
|
15
|
+
function dijkstra(graph: Graph, source: string, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
|
|
16
|
+
function dijkstraAll(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
|
|
17
|
+
function findCycles(graph: Graph): string[][];
|
|
18
|
+
function floydWarshall(graph: Graph, weightFn?: WeightFn, edgeFn?: EdgeFn): any;
|
|
19
|
+
function isAcyclic(graph: Graph): boolean;
|
|
20
|
+
function postorder(graph: Graph, nodeNames: string | string[]): string[];
|
|
21
|
+
function preorder(graph: Graph, nodeNames: string | string[]): string[];
|
|
22
|
+
function prim<T>(graph: Graph<T>, weightFn?: WeightFn): Graph<T>;
|
|
23
|
+
function tarjam(graph: Graph): string[][];
|
|
24
|
+
function topsort(graph: Graph): string[];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface Label {
|
|
29
|
+
label?: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
minRank?: number;
|
|
33
|
+
maxRank?: number;
|
|
34
|
+
borderLeft?: string[];
|
|
35
|
+
borderRight?: string[];
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
export type WeightFn = (edge: Edge) => number;
|
|
39
|
+
export type EdgeFn = (outNodeName: string) => GraphEdge[];
|
|
40
|
+
|
|
41
|
+
export interface GraphLabel {
|
|
42
|
+
width?: number | undefined;
|
|
43
|
+
height?: number | undefined;
|
|
44
|
+
compound?: boolean | undefined;
|
|
45
|
+
rankdir?: string | undefined;
|
|
46
|
+
align?: string | undefined;
|
|
47
|
+
nodesep?: number | undefined;
|
|
48
|
+
edgesep?: number | undefined;
|
|
49
|
+
ranksep?: number | undefined;
|
|
50
|
+
marginx?: number | undefined;
|
|
51
|
+
marginy?: number | undefined;
|
|
52
|
+
acyclicer?: string | undefined;
|
|
53
|
+
ranker?: string | undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface NodeConfig {
|
|
57
|
+
width?: number | undefined;
|
|
58
|
+
height?: number | undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EdgeConfig {
|
|
62
|
+
minlen?: number | undefined;
|
|
63
|
+
weight?: number | undefined;
|
|
64
|
+
width?: number | undefined;
|
|
65
|
+
height?: number | undefined;
|
|
66
|
+
labelpos?: 'l' | 'c' | 'r' | undefined;
|
|
67
|
+
labeloffest?: number | undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface LayoutConfig {
|
|
71
|
+
customOrder?: (graph: graphlib.Graph, order: (graph: graphlib.Graph, opts: configUnion) => void) => void;
|
|
72
|
+
disableOptimalOrderHeuristic?: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type configUnion = GraphLabel & NodeConfig & EdgeConfig & LayoutConfig;
|
|
76
|
+
|
|
77
|
+
export function layout(graph: graphlib.Graph, layout?: configUnion): void;
|
|
78
|
+
|
|
79
|
+
export interface Edge {
|
|
80
|
+
v: string;
|
|
81
|
+
w: string;
|
|
82
|
+
name?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export interface GraphEdge {
|
|
86
|
+
points: Array<{ x: number; y: number }>;
|
|
87
|
+
[key: string]: any;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type Node<T = {}> = T & {
|
|
91
|
+
x: number;
|
|
92
|
+
y: number;
|
|
93
|
+
width: number;
|
|
94
|
+
height: number;
|
|
95
|
+
class?: string | undefined;
|
|
96
|
+
label?: string | undefined;
|
|
97
|
+
padding?: number | undefined;
|
|
98
|
+
paddingX?: number | undefined;
|
|
99
|
+
paddingY?: number | undefined;
|
|
100
|
+
rank?: number | undefined;
|
|
101
|
+
rx?: number | undefined;
|
|
102
|
+
ry?: number | undefined;
|
|
103
|
+
shape?: string | undefined;
|
|
104
|
+
};
|
package/dist/dagre.esm.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var g=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=p((ai,Y)=>{var L=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return D(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&D(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){let t=[],r=this._sentinel,n=r._prev;for(;n!==r;)t.push(JSON.stringify(n,Ot)),n=n._prev;return"["+t.join(", ")+"]"}};function D(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ot(e,t){if(e!=="_next"&&e!=="_prev")return t}Y.exports=L});var z=p((li,W)=>{var It=g("@dagrejs/graphlib").Graph,qt=A();W.exports=Rt;var Lt=()=>1;function Rt(e,t){if(e.nodeCount()<=1)return[];let r=Mt(e,t||Lt);return Ct(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function Ct(e,t,r){let n=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)R(e,t,r,o);for(;o=i.dequeue();)R(e,t,r,o);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(o=t[l].dequeue(),o){n=n.concat(R(e,t,r,o,!0));break}}}return n}function R(e,t,r,n,i){let a=i?[]:void 0;return e.inEdges(n.v).forEach(o=>{let l=e.edge(o),d=e.node(o.v);i&&a.push({v:o.v,w:o.w}),d.out-=l,C(t,r,d)}),e.outEdges(n.v).forEach(o=>{let l=e.edge(o),d=o.w,s=e.node(d);s.in-=l,C(t,r,s)}),e.removeNode(n.v),a}function Mt(e,t){let r=new It,n=0,i=0;e.nodes().forEach(l=>{r.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let d=r.edge(l.v,l.w)||0,s=t(l),u=d+s;r.setEdge(l.v,l.w,u),i=Math.max(i,r.node(l.v).out+=s),n=Math.max(n,r.node(l.w).in+=s)});let a=Tt(i+n+3).map(()=>new qt),o=n+1;return r.nodes().forEach(l=>{C(a,o,r.node(l))}),{graph:r,buckets:a,zeroIdx:o}}function C(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Tt(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}});var b=p((di,Z)=>{"use strict";var X=g("@dagrejs/graphlib").Graph;Z.exports={addBorderNode:Dt,addDummyNode:H,applyWithChunking:N,asNonCompoundGraph:_t,buildLayerMatrix:Vt,intersectRect:Gt,mapValues:Ut,maxRank:J,normalizeRanks:Ft,notime:zt,partition:At,pick:Ht,predecessorWeights:Pt,range:Q,removeEmptyRanks:Bt,simplify:jt,successorWeights:St,time:Wt,uniqueId:K,zipObject:M};function H(e,t,r,n){for(var i=n;e.hasNode(i);)i=K(n);return r.dummy=t,e.setNode(i,r),i}function jt(e){let t=new X().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function _t(e){let t=new X({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function St(e){let t=e.nodes().map(r=>{let n={};return e.outEdges(r).forEach(i=>{n[i.w]=(n[i.w]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Pt(e){let t=e.nodes().map(r=>{let n={};return e.inEdges(r).forEach(i=>{n[i.v]=(n[i.v]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Gt(e,t){let r=e.x,n=e.y,i=t.x-r,a=t.y-n,o=e.width/2,l=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let d,s;return Math.abs(a)*o>Math.abs(i)*l?(a<0&&(l=-l),d=l*i/a,s=l):(i<0&&(o=-o),d=o,s=o*a/i),{x:r+d,y:n+s}}function Vt(e){let t=Q(J(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),i=n.rank;i!==void 0&&(t[i][n.order]=r)}),t}function Ft(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=N(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function Bt(e){let t=e.nodes().map(o=>e.node(o).rank),r=N(Math.min,t),n=[];e.nodes().forEach(o=>{let l=e.node(o).rank-r;n[l]||(n[l]=[]),n[l].push(o)});let i=0,a=e.graph().nodeRankFactor;Array.from(n).forEach((o,l)=>{o===void 0&&l%a!==0?--i:o!==void 0&&i&&o.forEach(d=>e.node(d).rank+=i)})}function Dt(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),H(e,"border",i,t)}function Yt(e,t=U){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var U=65535;function N(e,t){if(t.length>U){let r=Yt(t);return e.apply(null,r.map(n=>e.apply(null,n)))}else return e.apply(null,t)}function J(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return N(Math.max,r)}function At(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Wt(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function zt(e,t){return t()}var Xt=0;function K(e){var t=++Xt;return e+(""+t)}function Q(e,t,r=1){t==null&&(t=e,e=0);let n=a=>a<t;r<0&&(n=a=>t<a);let i=[];for(let a=e;n(a);a+=r)i.push(a);return i}function Ht(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function Ut(e,t){let r=t;return typeof t=="string"&&(r=n=>n[t]),Object.entries(e).reduce((n,[i,a])=>(n[i]=r(a,i),n),{})}function M(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var ee=p((si,$)=>{"use strict";var Jt=z(),Kt=b().uniqueId;$.exports={run:Qt,undo:$t};function Qt(e){(e.graph().acyclicer==="greedy"?Jt(e,r(e)):Zt(e)).forEach(n=>{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,Kt("rev"))});function r(n){return i=>n.edge(i).weight}}function Zt(e){let t=[],r={},n={};function i(a){Object.hasOwn(n,a)||(n[a]=!0,r[a]=!0,e.outEdges(a).forEach(o=>{Object.hasOwn(r,o.w)?t.push(o):i(o.w)}),delete r[a])}return e.nodes().forEach(i),t}function $t(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}});var re=p((ui,te)=>{"use strict";var er=b();te.exports={run:tr,undo:nr};function tr(e){e.graph().dummyChains=[],e.edges().forEach(t=>rr(e,t))}function rr(e,t){let r=t.v,n=e.node(r).rank,i=t.w,a=e.node(i).rank,o=t.name,l=e.edge(t),d=l.labelRank;if(a===n+1)return;e.removeEdge(t);let s,u,h;for(h=0,++n;n<a;++h,++n)l.points=[],u={width:0,height:0,edgeLabel:l,edgeObj:t,rank:n},s=er.addDummyNode(e,"edge",u,"_d"),n===d&&(u.width=l.width,u.height=l.height,u.dummy="edge-label",u.labelpos=l.labelpos),e.setEdge(r,s,{weight:l.weight},o),h===0&&e.graph().dummyChains.push(s),r=s;e.setEdge(r,i,{weight:l.weight},o)}function nr(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,i;for(e.setEdge(r.edgeObj,n);r.dummy;)i=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=i,r=e.node(t)})}});var v=p((hi,ne)=>{"use strict";var{applyWithChunking:ir}=b();ne.exports={longestPath:or,slack:ar};function or(e){var t={};function r(n){var i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let a=e.outEdges(n).map(l=>l==null?Number.POSITIVE_INFINITY:r(l.w)-e.edge(l).minlen);var o=ir(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),i.rank=o}e.sources().forEach(r)}function ar(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var T=p((fi,ie)=>{"use strict";var lr=g("@dagrejs/graphlib").Graph,O=v().slack;ie.exports=dr;function dr(e){var t=new lr({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;sr(t,e)<n;)i=ur(t,e),a=t.hasNode(i.v)?O(e,i):-O(e,i),hr(t,e,a);return t}function sr(e,t){function r(n){t.nodeEdges(n).forEach(i=>{var a=i.v,o=n===a?i.w:a;!e.hasNode(o)&&!O(t,i)&&(e.setNode(o,{}),e.setEdge(n,o,{}),r(o))})}return e.nodes().forEach(r),e.nodeCount()}function ur(e,t){return t.edges().reduce((n,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=O(t,i)),a<n[0]?[a,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function hr(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}});var ce=p((ci,fe)=>{"use strict";var fr=T(),oe=v().slack,cr=v().longestPath,pr=g("@dagrejs/graphlib").alg.preorder,mr=g("@dagrejs/graphlib").alg.postorder,br=b().simplify;fe.exports=x;x.initLowLimValues=_;x.initCutValues=j;x.calcCutValue=le;x.leaveEdge=se;x.enterEdge=ue;x.exchangeEdges=he;function x(e){e=br(e),cr(e);var t=fr(e);_(t),j(t,e);for(var r,n;r=se(t);)n=ue(t,e,r),he(t,e,r,n)}function j(e,t){var r=mr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>wr(e,t,n))}function wr(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=le(e,t,r)}function le(e,t,r){var n=e.node(r),i=n.parent,a=!0,o=t.edge(r,i),l=0;return o||(a=!1,o=t.edge(i,r)),l=o.weight,t.nodeEdges(r).forEach(d=>{var s=d.v===r,u=s?d.w:d.v;if(u!==i){var h=s===a,f=t.edge(d).weight;if(l+=h?f:-f,gr(e,r,u)){var c=e.edge(r,u).cutvalue;l+=h?-c:c}}}),l}function _(e,t){arguments.length<2&&(t=e.nodes()[0]),de(e,{},1,t)}function de(e,t,r,n,i){var a=r,o=e.node(n);return t[n]=!0,e.neighbors(n).forEach(l=>{Object.hasOwn(t,l)||(r=de(e,t,r,l,n))}),o.low=a,o.lim=r++,i?o.parent=i:delete o.parent,r}function se(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ue(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),o=e.node(i),l=a,d=!1;a.lim>o.lim&&(l=o,d=!0);var s=t.edges().filter(u=>d===ae(e,e.node(u.v),l)&&d!==ae(e,e.node(u.w),l));return s.reduce((u,h)=>oe(t,h)<oe(t,u)?h:u)}function he(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),_(e),j(e,t),Er(e,t)}function Er(e,t){var r=e.nodes().find(i=>!t.node(i).parent),n=pr(e,r);n=n.slice(1),n.forEach(i=>{var a=e.node(i).parent,o=t.edge(i,a),l=!1;o||(o=t.edge(a,i),l=!0),t.node(i).rank=t.node(a).rank+(l?o.minlen:-o.minlen)})}function gr(e,t,r){return e.hasEdge(t,r)}function ae(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var we=p((pi,be)=>{"use strict";var kr=v(),me=kr.longestPath,xr=T(),yr=ce();be.exports=vr;function vr(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":pe(e);break;case"tight-tree":Or(e);break;case"longest-path":Nr(e);break;case"none":break;default:pe(e)}}var Nr=me;function Or(e){me(e),xr(e)}function pe(e){yr(e)}});var ge=p((mi,Ee)=>{Ee.exports=Ir;function Ir(e){let t=Lr(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,a=qr(e,t,i.v,i.w),o=a.path,l=a.lca,d=0,s=o[d],u=!0;for(;r!==i.w;){if(n=e.node(r),u){for(;(s=o[d])!==l&&e.node(s).maxRank<n.rank;)d++;s===l&&(u=!1)}if(!u){for(;d<o.length-1&&e.node(s=o[d+1]).minRank<=n.rank;)d++;s=o[d]}e.setParent(r,s),r=e.successors(r)[0]}})}function qr(e,t,r,n){let i=[],a=[],o=Math.min(t[r].low,t[n].low),l=Math.max(t[r].lim,t[n].lim),d,s;d=r;do d=e.parent(d),i.push(d);while(d&&(t[d].low>o||l>t[d].lim));for(s=d,d=n;(d=e.parent(d))!==s;)a.push(d);return{path:i.concat(a.reverse()),lca:s}}function Lr(e){let t={},r=0;function n(i){let a=r;e.children(i).forEach(n),t[i]={low:a,lim:r++}}return e.children().forEach(n),t}});var ye=p((bi,xe)=>{var I=b();xe.exports={run:Rr,cleanup:Tr};function Rr(e){let t=I.addDummyNode(e,"root",{},"_root"),r=Cr(e),n=Object.values(r),i=I.applyWithChunking(Math.max,n)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=a);let o=Mr(e)+1;e.children().forEach(l=>ke(e,t,a,o,i,r,l)),e.graph().nodeRankFactor=a}function ke(e,t,r,n,i,a,o){let l=e.children(o);if(!l.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:r});return}let d=I.addBorderNode(e,"_bt"),s=I.addBorderNode(e,"_bb"),u=e.node(o);e.setParent(d,o),u.borderTop=d,e.setParent(s,o),u.borderBottom=s,l.forEach(h=>{ke(e,t,r,n,i,a,h);let f=e.node(h),c=f.borderTop?f.borderTop:h,m=f.borderBottom?f.borderBottom:h,E=f.borderTop?n:2*n,y=c!==m?1:i-a[o]+1;e.setEdge(d,c,{weight:E,minlen:y,nestingEdge:!0}),e.setEdge(m,s,{weight:E,minlen:y,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,d,{weight:0,minlen:i+a[o]})}function Cr(e){var t={};function r(n,i){var a=e.children(n);a&&a.length&&a.forEach(o=>r(o,i+1)),t[n]=i}return e.children().forEach(n=>r(n,1)),t}function Mr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function Tr(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}});var Oe=p((wi,Ne)=>{var jr=b();Ne.exports=_r;function _r(e){function t(r){let n=e.children(r),i=e.node(r);if(n.length&&n.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let a=i.minRank,o=i.maxRank+1;a<o;++a)ve(e,"borderLeft","_bl",r,i,a),ve(e,"borderRight","_br",r,i,a)}}e.children().forEach(t)}function ve(e,t,r,n,i,a){let o={width:0,height:0,rank:a,borderType:t},l=i[t][a-1],d=jr.addDummyNode(e,"border",o,r);i[t][a]=d,e.setParent(d,n),l&&e.setEdge(l,d,{weight:1})}});var Re=p((Ei,Le)=>{"use strict";Le.exports={adjust:Sr,undo:Pr};function Sr(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&qe(e)}function Pr(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Gr(e),(t==="lr"||t==="rl")&&(Vr(e),qe(e))}function qe(e){e.nodes().forEach(t=>Ie(e.node(t))),e.edges().forEach(t=>Ie(e.edge(t)))}function Ie(e){let t=e.width;e.width=e.height,e.height=t}function Gr(e){e.nodes().forEach(t=>S(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(S),Object.hasOwn(r,"y")&&S(r)})}function S(e){e.y=-e.y}function Vr(e){e.nodes().forEach(t=>P(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(P),Object.hasOwn(r,"x")&&P(r)})}function P(e){let t=e.x;e.x=e.y,e.y=t}});var Te=p((gi,Me)=>{"use strict";var Ce=b();Me.exports=Fr;function Fr(e){let t={},r=e.nodes().filter(d=>!e.children(d).length),n=r.map(d=>e.node(d).rank),i=Ce.applyWithChunking(Math.max,n),a=Ce.range(i+1).map(()=>[]);function o(d){if(t[d])return;t[d]=!0;let s=e.node(d);a[s.rank].push(d),e.successors(d).forEach(o)}return r.sort((d,s)=>e.node(d).rank-e.node(s).rank).forEach(o),a}});var _e=p((ki,je)=>{"use strict";var Br=b().zipObject;je.exports=Dr;function Dr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=Yr(e,t[n-1],t[n]);return r}function Yr(e,t,r){let n=Br(r,r.map((s,u)=>u)),i=t.flatMap(s=>e.outEdges(s).map(u=>({pos:n[u.w],weight:e.edge(u).weight})).sort((u,h)=>u.pos-h.pos)),a=1;for(;a<r.length;)a<<=1;let o=2*a-1;a-=1;let l=new Array(o).fill(0),d=0;return i.forEach(s=>{let u=s.pos+a;l[u]+=s.weight;let h=0;for(;u>0;)u%2&&(h+=l[u+1]),u=u-1>>1,l[u]+=s.weight;d+=s.weight*h}),d}});var Pe=p((xi,Se)=>{Se.exports=Ar;function Ar(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(n.length){let i=n.reduce((a,o)=>{let l=e.edge(o),d=e.node(o.v);return{sum:a.sum+l.weight*d.order,weight:a.weight+l.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}});var Ve=p((yi,Ge)=>{"use strict";var Wr=b();Ge.exports=zr;function zr(e,t){let r={};e.forEach((i,a)=>{let o=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(o.barycenter=i.barycenter,o.weight=i.weight)}),t.edges().forEach(i=>{let a=r[i.v],o=r[i.w];a!==void 0&&o!==void 0&&(o.indegree++,a.out.push(r[i.w]))});let n=Object.values(r).filter(i=>!i.indegree);return Xr(n)}function Xr(e){let t=[];function r(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&Hr(i,a)}}function n(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(r(i)),i.out.forEach(n(i))}return t.filter(i=>!i.merged).map(i=>Wr.pick(i,["vs","i","barycenter","weight"]))}function Hr(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}});var De=p((vi,Be)=>{var Ur=b();Be.exports=Jr;function Jr(e,t){let r=Ur.partition(e,u=>Object.hasOwn(u,"barycenter")),n=r.lhs,i=r.rhs.sort((u,h)=>h.i-u.i),a=[],o=0,l=0,d=0;n.sort(Kr(!!t)),d=Fe(a,i,d),n.forEach(u=>{d+=u.vs.length,a.push(u.vs),o+=u.barycenter*u.weight,l+=u.weight,d=Fe(a,i,d)});let s={vs:a.flat(!0)};return l&&(s.barycenter=o/l,s.weight=l),s}function Fe(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function Kr(e){return(t,r)=>t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}});var We=p((Ni,Ae)=>{var Qr=Pe(),Zr=Ve(),$r=De();Ae.exports=Ye;function Ye(e,t,r,n){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,d={};o&&(i=i.filter(f=>f!==o&&f!==l));let s=Qr(e,i);s.forEach(f=>{if(e.children(f.v).length){let c=Ye(e,f.v,r,n);d[f.v]=c,Object.hasOwn(c,"barycenter")&&tn(f,c)}});let u=Zr(s,r);en(u,d);let h=$r(u,n);if(o&&(h.vs=[o,h.vs,l].flat(!0),e.predecessors(o).length)){let f=e.node(e.predecessors(o)[0]),c=e.node(e.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+f.order+c.order)/(h.weight+2),h.weight+=2}return h}function en(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function tn(e,t){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)}});var Xe=p((Oi,ze)=>{var rn=g("@dagrejs/graphlib").Graph,nn=b();ze.exports=on;function on(e,t,r,n){n||(n=e.nodes());let i=an(e),a=new rn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(o=>e.node(o));return n.forEach(o=>{let l=e.node(o),d=e.parent(o);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(a.setNode(o),a.setParent(o,d||i),e[r](o).forEach(s=>{let u=s.v===o?s.w:s.v,h=a.edge(u,o),f=h!==void 0?h.weight:0;a.setEdge(u,o,{weight:e.edge(s).weight+f})}),Object.hasOwn(l,"minRank")&&a.setNode(o,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),a}function an(e){for(var t;e.hasNode(t=nn.uniqueId("_root")););return t}});var Ue=p((Ii,He)=>{He.exports=ln;function ln(e,t,r){let n={},i;r.forEach(a=>{let o=e.parent(a),l,d;for(;o;){if(l=e.parent(o),l?(d=n[l],n[l]=o):(d=i,i=o),d&&d!==o){t.setEdge(d,o);return}o=l}})}});var $e=p((qi,Ze)=>{"use strict";var dn=Te(),sn=_e(),un=We(),hn=Xe(),fn=Ue(),cn=g("@dagrejs/graphlib").Graph,q=b();Ze.exports=Qe;function Qe(e,t){if(t&&typeof t.customOrder=="function"){t.customOrder(e,Qe);return}let r=q.maxRank(e),n=Je(e,q.range(1,r+1),"inEdges"),i=Je(e,q.range(r-1,-1,-1),"outEdges"),a=dn(e);if(Ke(e,a),t&&t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l;for(let d=0,s=0;s<4;++d,++s){pn(d%2?n:i,d%4>=2),a=q.buildLayerMatrix(e);let u=sn(e,a);u<o&&(s=0,l=Object.assign({},a),o=u)}Ke(e,l)}function Je(e,t,r){let n=new Map,i=(a,o)=>{n.has(a)||n.set(a,[]),n.get(a).push(o)};for(let a of e.nodes()){let o=e.node(a);if(typeof o.rank=="number"&&i(o.rank,a),typeof o.minRank=="number"&&typeof o.maxRank=="number")for(let l=o.minRank;l<=o.maxRank;l++)l!==o.rank&&i(l,a)}return t.map(function(a){return hn(e,a,r,n.get(a)||[])})}function pn(e,t){let r=new cn;e.forEach(function(n){let i=n.graph().root,a=un(n,i,r,t);a.vs.forEach((o,l)=>n.node(o).order=l),fn(n,r,a.vs)})}function Ke(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var st=p((Li,dt)=>{"use strict";var mn=g("@dagrejs/graphlib").Graph,k=b();dt.exports={positionX:En,findType1Conflicts:et,findType2Conflicts:tt,addConflict:G,hasConflict:rt,verticalAlignment:nt,horizontalCompaction:it,alignCoordinates:at,findSmallestWidthAlignment:ot,balance:lt};function et(e,t){let r={};function n(i,a){let o=0,l=0,d=i.length,s=a[a.length-1];return a.forEach((u,h)=>{let f=bn(e,u),c=f?e.node(f).order:d;(f||u===s)&&(a.slice(l,h+1).forEach(m=>{e.predecessors(m).forEach(E=>{let y=e.node(E),B=y.order;(B<o||c<B)&&!(y.dummy&&e.node(m).dummy)&&G(r,E,m)})}),l=h+1,o=c)}),a}return t.length&&t.reduce(n),r}function tt(e,t){let r={};function n(a,o,l,d,s){let u;k.range(o,l).forEach(h=>{u=a[h],e.node(u).dummy&&e.predecessors(u).forEach(f=>{let c=e.node(f);c.dummy&&(c.order<d||c.order>s)&&G(r,f,u)})})}function i(a,o){let l=-1,d,s=0;return o.forEach((u,h)=>{if(e.node(u).dummy==="border"){let f=e.predecessors(u);f.length&&(d=e.node(f[0]).order,n(o,s,h,l,d),s=h,l=d)}n(o,s,o.length,d,a.length)}),o}return t.length&&t.reduce(i),r}function bn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function G(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];n||(e[t]=n={}),n[r]=!0}function rt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function nt(e,t,r,n){let i={},a={},o={};return t.forEach(l=>{l.forEach((d,s)=>{i[d]=d,a[d]=d,o[d]=s})}),t.forEach(l=>{let d=-1;l.forEach(s=>{let u=n(s);if(u.length){u=u.sort((f,c)=>o[f]-o[c]);let h=(u.length-1)/2;for(let f=Math.floor(h),c=Math.ceil(h);f<=c;++f){let m=u[f];a[s]===s&&d<o[m]&&!rt(r,s,m)&&(a[m]=s,a[s]=i[s]=i[m],d=o[m])}}})}),{root:i,align:a}}function it(e,t,r,n,i){let a={},o=wn(e,t,r,i),l=i?"borderLeft":"borderRight";function d(h,f){let c=o.nodes(),m=c.pop(),E={};for(;m;)E[m]?h(m):(E[m]=!0,c.push(m),c=c.concat(f(m))),m=c.pop()}function s(h){a[h]=o.inEdges(h).reduce((f,c)=>Math.max(f,a[c.v]+o.edge(c)),0)}function u(h){let f=o.outEdges(h).reduce((m,E)=>Math.min(m,a[E.w]-o.edge(E)),Number.POSITIVE_INFINITY),c=e.node(h);f!==Number.POSITIVE_INFINITY&&c.borderType!==l&&(a[h]=Math.max(a[h],f))}return d(s,o.predecessors.bind(o)),d(u,o.successors.bind(o)),Object.keys(n).forEach(h=>a[h]=a[r[h]]),a}function wn(e,t,r,n){let i=new mn,a=e.graph(),o=gn(a.nodesep,a.edgesep,n);return t.forEach(l=>{let d;l.forEach(s=>{let u=r[s];if(i.setNode(u),d){var h=r[d],f=i.edge(h,u);i.setEdge(h,u,Math.max(o(e,s,d),f||0))}d=s})}),i}function ot(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([l,d])=>{let s=kn(e,l)/2;i=Math.max(d+s,i),a=Math.min(d-s,a)});let o=i-a;return o<r[0]&&(r=[o,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function at(e,t){let r=Object.values(t),n=k.applyWithChunking(Math.min,r),i=k.applyWithChunking(Math.max,r);["u","d"].forEach(a=>{["l","r"].forEach(o=>{let l=a+o,d=e[l];if(d===t)return;let s=Object.values(d),u=n-k.applyWithChunking(Math.min,s);o!=="l"&&(u=i-k.applyWithChunking(Math.max,s)),u&&(e[l]=k.mapValues(d,h=>h+u))})})}function lt(e,t){return k.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let i=Object.values(e).map(a=>a[n]).sort((a,o)=>a-o);return(i[1]+i[2])/2}})}function En(e){let t=k.buildLayerMatrix(e),r=Object.assign(et(e,t),tt(e,t)),n={},i;["u","d"].forEach(o=>{i=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(h=>Object.values(h).reverse()));let d=(o==="u"?e.predecessors:e.successors).bind(e),s=nt(e,i,r,d),u=it(e,i,s.root,s.align,l==="r");l==="r"&&(u=k.mapValues(u,h=>-h)),n[o+l]=u})});let a=ot(e,n);return at(n,a),lt(n,e.graph().align)}function gn(e,t,r){return(n,i,a)=>{let o=n.node(i),l=n.node(a),d=0,s;if(d+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":s=-o.width/2;break;case"r":s=o.width/2;break}if(s&&(d+=r?s:-s),s=0,d+=(o.dummy?t:e)/2,d+=(l.dummy?t:e)/2,d+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":s=l.width/2;break;case"r":s=-l.width/2;break}return s&&(d+=r?s:-s),s=0,d}}function kn(e,t){return e.node(t).width}});var ft=p((Ri,ht)=>{"use strict";var ut=b(),xn=st().positionX;ht.exports=yn;function yn(e){e=ut.asNonCompoundGraph(e),vn(e),Object.entries(xn(e)).forEach(([t,r])=>e.node(t).x=r)}function vn(e){let t=ut.buildLayerMatrix(e),r=e.graph().ranksep,n=0;t.forEach(i=>{let a=i.reduce((o,l)=>{let d=e.node(l).height;return o>d?o:d},0);i.forEach(o=>e.node(o).y=n+a/2),n+=a+r})}});var gt=p((Ci,Et)=>{"use strict";var ct=ee(),pt=re(),Nn=we(),On=b().normalizeRanks,In=ge(),qn=b().removeEmptyRanks,mt=ye(),Ln=Oe(),bt=Re(),Rn=$e(),Cn=ft(),w=b(),Mn=g("@dagrejs/graphlib").Graph;Et.exports=Tn;function Tn(e,t){let r=t&&t.debugTiming?w.time:w.notime;r("layout",()=>{let n=r(" buildLayoutGraph",()=>Yn(e));r(" runLayout",()=>jn(n,r,t)),r(" updateInputGraph",()=>_n(e,n))})}function jn(e,t,r){t(" makeSpaceForEdgeLabels",()=>An(e)),t(" removeSelfEdges",()=>Zn(e)),t(" acyclic",()=>ct.run(e)),t(" nestingGraph.run",()=>mt.run(e)),t(" rank",()=>Nn(w.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>Wn(e)),t(" removeEmptyRanks",()=>qn(e)),t(" nestingGraph.cleanup",()=>mt.cleanup(e)),t(" normalizeRanks",()=>On(e)),t(" assignRankMinMax",()=>zn(e)),t(" removeEdgeLabelProxies",()=>Xn(e)),t(" normalize.run",()=>pt.run(e)),t(" parentDummyChains",()=>In(e)),t(" addBorderSegments",()=>Ln(e)),t(" order",()=>Rn(e,r)),t(" insertSelfEdges",()=>$n(e)),t(" adjustCoordinateSystem",()=>bt.adjust(e)),t(" position",()=>Cn(e)),t(" positionSelfEdges",()=>ei(e)),t(" removeBorderNodes",()=>Qn(e)),t(" normalize.undo",()=>pt.undo(e)),t(" fixupEdgeLabelCoords",()=>Jn(e)),t(" undoCoordinateSystem",()=>bt.undo(e)),t(" translateGraph",()=>Hn(e)),t(" assignNodeIntersects",()=>Un(e)),t(" reversePoints",()=>Kn(e)),t(" acyclic.undo",()=>ct.undo(e))}function _n(e,t){e.nodes().forEach(r=>{let n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,n.rank=i.rank,t.children(r).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(r=>{let n=e.edge(r),i=t.edge(r);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Sn=["nodesep","edgesep","ranksep","marginx","marginy"],Pn={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gn=["acyclicer","ranker","rankdir","align"],Vn=["width","height","rank"],wt={width:0,height:0},Fn=["minlen","weight","width","height","labeloffset"],Bn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Dn=["labelpos"];function Yn(e){let t=new Mn({multigraph:!0,compound:!0}),r=F(e.graph());return t.setGraph(Object.assign({},Pn,V(r,Sn),w.pick(r,Gn))),e.nodes().forEach(n=>{let i=F(e.node(n)),a=V(i,Vn);Object.keys(wt).forEach(o=>{a[o]===void 0&&(a[o]=wt[o])}),t.setNode(n,a),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=F(e.edge(n));t.setEdge(n,Object.assign({},Bn,V(i,Fn),w.pick(i,Dn)))}),t}function An(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{let n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function Wn(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),a={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};w.addDummyNode(e,"edge-proxy",a,"_ep")}})}function zn(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function Xn(e){e.nodes().forEach(t=>{let r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function Hn(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),o=a.marginx||0,l=a.marginy||0;function d(s){let u=s.x,h=s.y,f=s.width,c=s.height;t=Math.min(t,u-f/2),r=Math.max(r,u+f/2),n=Math.min(n,h-c/2),i=Math.max(i,h+c/2)}e.nodes().forEach(s=>d(e.node(s))),e.edges().forEach(s=>{let u=e.edge(s);Object.hasOwn(u,"x")&&d(u)}),t-=o,n-=l,e.nodes().forEach(s=>{let u=e.node(s);u.x-=t,u.y-=n}),e.edges().forEach(s=>{let u=e.edge(s);u.points.forEach(h=>{h.x-=t,h.y-=n}),Object.hasOwn(u,"x")&&(u.x-=t),Object.hasOwn(u,"y")&&(u.y-=n)}),a.width=r-t+o,a.height=i-n+l}function Un(e){e.edges().forEach(t=>{let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),a,o;r.points?(a=r.points[0],o=r.points[r.points.length-1]):(r.points=[],a=i,o=n),r.points.unshift(w.intersectRect(n,a)),r.points.push(w.intersectRect(i,o))})}function Jn(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Kn(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function Qn(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),a=e.node(r.borderLeft[r.borderLeft.length-1]),o=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(o.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Zn(e){e.edges().forEach(t=>{if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $n(e){var t=w.buildLayerMatrix(e);t.forEach(r=>{var n=0;r.forEach((i,a)=>{var o=e.node(i);o.order=a+n,(o.selfEdges||[]).forEach(l=>{w.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:o.rank,order:a+ ++n,e:l.e,label:l.label},"_se")}),delete o.selfEdges})})}function ei(e){e.nodes().forEach(t=>{var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,a=n.y,o=r.x-i,l=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-l},{x:i+5*o/6,y:a-l},{x:i+o,y:a},{x:i+5*o/6,y:a+l},{x:i+2*o/3,y:a+l}],r.label.x=r.x,r.label.y=r.y}})}function V(e,t){return w.mapValues(w.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var xt=p((Mi,kt)=>{var ti=b(),ri=g("@dagrejs/graphlib").Graph;kt.exports={debugOrdering:ni};function ni(e){let t=ti.buildLayerMatrix(e),r=new ri({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(n=>{r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)}),e.edges().forEach(n=>r.setEdge(n.v,n.w,{},n.name)),t.forEach((n,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),n.reduce((o,l)=>(r.setEdge(o,l,{style:"invis"}),l))}),r}});var vt=p((Ti,yt)=>{yt.exports="2.0.0"});var ii=p((ji,Nt)=>{Nt.exports={graphlib:g("@dagrejs/graphlib"),layout:gt(),debug:xt(),util:{time:b().time,notime:b().notime},version:vt()}});export default ii();
|
|
1
|
+
var g=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=p((ai,Y)=>{var L=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return D(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&D(t),t._next=r._next,r._next._prev=t,r._next=t,t._prev=r}toString(){let t=[],r=this._sentinel,n=r._prev;for(;n!==r;)t.push(JSON.stringify(n,Ot)),n=n._prev;return"["+t.join(", ")+"]"}};function D(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ot(e,t){if(e!=="_next"&&e!=="_prev")return t}Y.exports=L});var z=p((li,W)=>{var It=g("@dagrejs/graphlib").Graph,qt=A();W.exports=Rt;var Lt=()=>1;function Rt(e,t){if(e.nodeCount()<=1)return[];let r=Mt(e,t||Lt);return Ct(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function Ct(e,t,r){let n=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)R(e,t,r,o);for(;o=i.dequeue();)R(e,t,r,o);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(o=t[l].dequeue(),o){n=n.concat(R(e,t,r,o,!0));break}}}return n}function R(e,t,r,n,i){let a=i?[]:void 0;return e.inEdges(n.v).forEach(o=>{let l=e.edge(o),s=e.node(o.v);i&&a.push({v:o.v,w:o.w}),s.out-=l,C(t,r,s)}),e.outEdges(n.v).forEach(o=>{let l=e.edge(o),s=o.w,d=e.node(s);d.in-=l,C(t,r,d)}),e.removeNode(n.v),a}function Mt(e,t){let r=new It,n=0,i=0;e.nodes().forEach(l=>{r.setNode(l,{v:l,in:0,out:0})}),e.edges().forEach(l=>{let s=r.edge(l.v,l.w)||0,d=t(l),u=s+d;r.setEdge(l.v,l.w,u),i=Math.max(i,r.node(l.v).out+=d),n=Math.max(n,r.node(l.w).in+=d)});let a=Tt(i+n+3).map(()=>new qt),o=n+1;return r.nodes().forEach(l=>{C(a,o,r.node(l))}),{graph:r,buckets:a,zeroIdx:o}}function C(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Tt(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}});var m=p((si,Z)=>{"use strict";var X=g("@dagrejs/graphlib").Graph;Z.exports={addBorderNode:Dt,addDummyNode:H,applyWithChunking:N,asNonCompoundGraph:_t,buildLayerMatrix:Vt,intersectRect:Gt,mapValues:Ut,maxRank:J,normalizeRanks:Ft,notime:zt,partition:At,pick:Ht,predecessorWeights:Pt,range:Q,removeEmptyRanks:Bt,simplify:jt,successorWeights:St,time:Wt,uniqueId:K,zipObject:M};function H(e,t,r,n){for(var i=n;e.hasNode(i);)i=K(n);return r.dummy=t,e.setNode(i,r),i}function jt(e){let t=new X().setGraph(e.graph());return e.nodes().forEach(r=>t.setNode(r,e.node(r))),e.edges().forEach(r=>{let n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function _t(e){let t=new X({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(r=>{e.children(r).length||t.setNode(r,e.node(r))}),e.edges().forEach(r=>{t.setEdge(r,e.edge(r))}),t}function St(e){let t=e.nodes().map(r=>{let n={};return e.outEdges(r).forEach(i=>{n[i.w]=(n[i.w]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Pt(e){let t=e.nodes().map(r=>{let n={};return e.inEdges(r).forEach(i=>{n[i.v]=(n[i.v]||0)+e.edge(i).weight}),n});return M(e.nodes(),t)}function Gt(e,t){let r=e.x,n=e.y,i=t.x-r,a=t.y-n,o=e.width/2,l=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let s,d;return Math.abs(a)*o>Math.abs(i)*l?(a<0&&(l=-l),s=l*i/a,d=l):(i<0&&(o=-o),s=o,d=o*a/i),{x:r+s,y:n+d}}function Vt(e){let t=Q(J(e)+1).map(()=>[]);return e.nodes().forEach(r=>{let n=e.node(r),i=n.rank;i!==void 0&&(t[i][n.order]=r)}),t}function Ft(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=N(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function Bt(e){let t=e.nodes().map(o=>e.node(o).rank).filter(o=>o!==void 0),r=N(Math.min,t),n=[];e.nodes().forEach(o=>{let l=e.node(o).rank-r;n[l]||(n[l]=[]),n[l].push(o)});let i=0,a=e.graph().nodeRankFactor;Array.from(n).forEach((o,l)=>{o===void 0&&l%a!==0?--i:o!==void 0&&i&&o.forEach(s=>e.node(s).rank+=i)})}function Dt(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),H(e,"border",i,t)}function Yt(e,t=U){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var U=65535;function N(e,t){if(t.length>U){let r=Yt(t);return e.apply(null,r.map(n=>e.apply(null,n)))}else return e.apply(null,t)}function J(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return N(Math.max,r)}function At(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function Wt(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function zt(e,t){return t()}var Xt=0;function K(e){var t=++Xt;return e+(""+t)}function Q(e,t,r=1){t==null&&(t=e,e=0);let n=a=>a<t;r<0&&(n=a=>t<a);let i=[];for(let a=e;n(a);a+=r)i.push(a);return i}function Ht(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function Ut(e,t){let r=t;return typeof t=="string"&&(r=n=>n[t]),Object.entries(e).reduce((n,[i,a])=>(n[i]=r(a,i),n),{})}function M(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var ee=p((di,$)=>{"use strict";var Jt=z(),Kt=m().uniqueId;$.exports={run:Qt,undo:$t};function Qt(e){(e.graph().acyclicer==="greedy"?Jt(e,r(e)):Zt(e)).forEach(n=>{let i=e.edge(n);e.removeEdge(n),i.forwardName=n.name,i.reversed=!0,e.setEdge(n.w,n.v,i,Kt("rev"))});function r(n){return i=>n.edge(i).weight}}function Zt(e){let t=[],r={},n={};function i(a){Object.hasOwn(n,a)||(n[a]=!0,r[a]=!0,e.outEdges(a).forEach(o=>{Object.hasOwn(r,o.w)?t.push(o):i(o.w)}),delete r[a])}return e.nodes().forEach(i),t}function $t(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.reversed){e.removeEdge(t);let n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}});var re=p((ui,te)=>{"use strict";var er=m();te.exports={run:tr,undo:nr};function tr(e){e.graph().dummyChains=[],e.edges().forEach(t=>rr(e,t))}function rr(e,t){let r=t.v,n=e.node(r).rank,i=t.w,a=e.node(i).rank,o=t.name,l=e.edge(t),s=l.labelRank;if(a===n+1)return;e.removeEdge(t);let d,u,h;for(h=0,++n;n<a;++h,++n)l.points=[],u={width:0,height:0,edgeLabel:l,edgeObj:t,rank:n},d=er.addDummyNode(e,"edge",u,"_d"),n===s&&(u.width=l.width,u.height=l.height,u.dummy="edge-label",u.labelpos=l.labelpos),e.setEdge(r,d,{weight:l.weight},o),h===0&&e.graph().dummyChains.push(d),r=d;e.setEdge(r,i,{weight:l.weight},o)}function nr(e){e.graph().dummyChains.forEach(t=>{let r=e.node(t),n=r.edgeLabel,i;for(e.setEdge(r.edgeObj,n);r.dummy;)i=e.successors(t)[0],e.removeNode(t),n.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(n.x=r.x,n.y=r.y,n.width=r.width,n.height=r.height),t=i,r=e.node(t)})}});var v=p((hi,ne)=>{"use strict";var{applyWithChunking:ir}=m();ne.exports={longestPath:or,slack:ar};function or(e){var t={};function r(n){var i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let a=e.outEdges(n).map(l=>l==null?Number.POSITIVE_INFINITY:r(l.w)-e.edge(l).minlen);var o=ir(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),i.rank=o}e.sources().forEach(r)}function ar(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var T=p((fi,ie)=>{"use strict";var lr=g("@dagrejs/graphlib").Graph,O=v().slack;ie.exports=sr;function sr(e){var t=new lr({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;dr(t,e)<n;)i=ur(t,e),a=t.hasNode(i.v)?O(e,i):-O(e,i),hr(t,e,a);return t}function dr(e,t){function r(n){t.nodeEdges(n).forEach(i=>{var a=i.v,o=n===a?i.w:a;!e.hasNode(o)&&!O(t,i)&&(e.setNode(o,{}),e.setEdge(n,o,{}),r(o))})}return e.nodes().forEach(r),e.nodeCount()}function ur(e,t){return t.edges().reduce((n,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=O(t,i)),a<n[0]?[a,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function hr(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}});var ce=p((ci,fe)=>{"use strict";var fr=T(),oe=v().slack,cr=v().longestPath,pr=g("@dagrejs/graphlib").alg.preorder,mr=g("@dagrejs/graphlib").alg.postorder,br=m().simplify;fe.exports=y;y.initLowLimValues=_;y.initCutValues=j;y.calcCutValue=le;y.leaveEdge=de;y.enterEdge=ue;y.exchangeEdges=he;function y(e){e=br(e),cr(e);var t=fr(e);_(t),j(t,e);for(var r,n;r=de(t);)n=ue(t,e,r),he(t,e,r,n)}function j(e,t){var r=mr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>wr(e,t,n))}function wr(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=le(e,t,r)}function le(e,t,r){var n=e.node(r),i=n.parent,a=!0,o=t.edge(r,i),l=0;return o||(a=!1,o=t.edge(i,r)),l=o.weight,t.nodeEdges(r).forEach(s=>{var d=s.v===r,u=d?s.w:s.v;if(u!==i){var h=d===a,f=t.edge(s).weight;if(l+=h?f:-f,gr(e,r,u)){var c=e.edge(r,u).cutvalue;l+=h?-c:c}}}),l}function _(e,t){arguments.length<2&&(t=e.nodes()[0]),se(e,{},1,t)}function se(e,t,r,n,i){var a=r,o=e.node(n);return t[n]=!0,e.neighbors(n).forEach(l=>{Object.hasOwn(t,l)||(r=se(e,t,r,l,n))}),o.low=a,o.lim=r++,i?o.parent=i:delete o.parent,r}function de(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ue(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var a=e.node(n),o=e.node(i),l=a,s=!1;a.lim>o.lim&&(l=o,s=!0);var d=t.edges().filter(u=>s===ae(e,e.node(u.v),l)&&s!==ae(e,e.node(u.w),l));return d.reduce((u,h)=>oe(t,h)<oe(t,u)?h:u)}function he(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),_(e),j(e,t),Er(e,t)}function Er(e,t){var r=e.nodes().find(i=>!t.node(i).parent),n=pr(e,r);n=n.slice(1),n.forEach(i=>{var a=e.node(i).parent,o=t.edge(i,a),l=!1;o||(o=t.edge(a,i),l=!0),t.node(i).rank=t.node(a).rank+(l?o.minlen:-o.minlen)})}function gr(e,t,r){return e.hasEdge(t,r)}function ae(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var we=p((pi,be)=>{"use strict";var kr=v(),me=kr.longestPath,xr=T(),yr=ce();be.exports=vr;function vr(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":pe(e);break;case"tight-tree":Or(e);break;case"longest-path":Nr(e);break;case"none":break;default:pe(e)}}var Nr=me;function Or(e){me(e),xr(e)}function pe(e){yr(e)}});var ge=p((mi,Ee)=>{Ee.exports=Ir;function Ir(e){let t=Lr(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,a=qr(e,t,i.v,i.w),o=a.path,l=a.lca,s=0,d=o[s],u=!0;for(;r!==i.w;){if(n=e.node(r),u){for(;(d=o[s])!==l&&e.node(d).maxRank<n.rank;)s++;d===l&&(u=!1)}if(!u){for(;s<o.length-1&&e.node(d=o[s+1]).minRank<=n.rank;)s++;d=o[s]}e.setParent(r,d),r=e.successors(r)[0]}})}function qr(e,t,r,n){let i=[],a=[],o=Math.min(t[r].low,t[n].low),l=Math.max(t[r].lim,t[n].lim),s,d;s=r;do s=e.parent(s),i.push(s);while(s&&(t[s].low>o||l>t[s].lim));for(d=s,s=n;(s=e.parent(s))!==d;)a.push(s);return{path:i.concat(a.reverse()),lca:d}}function Lr(e){let t={},r=0;function n(i){let a=r;e.children(i).forEach(n),t[i]={low:a,lim:r++}}return e.children().forEach(n),t}});var ye=p((bi,xe)=>{var I=m();xe.exports={run:Rr,cleanup:Tr};function Rr(e){let t=I.addDummyNode(e,"root",{},"_root"),r=Cr(e),n=Object.values(r),i=I.applyWithChunking(Math.max,n)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=a);let o=Mr(e)+1;e.children().forEach(l=>ke(e,t,a,o,i,r,l)),e.graph().nodeRankFactor=a}function ke(e,t,r,n,i,a,o){let l=e.children(o);if(!l.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:r});return}let s=I.addBorderNode(e,"_bt"),d=I.addBorderNode(e,"_bb"),u=e.node(o);e.setParent(s,o),u.borderTop=s,e.setParent(d,o),u.borderBottom=d,l.forEach(h=>{ke(e,t,r,n,i,a,h);let f=e.node(h),c=f.borderTop?f.borderTop:h,b=f.borderBottom?f.borderBottom:h,w=f.borderTop?n:2*n,x=c!==b?1:i-a[o]+1;e.setEdge(s,c,{weight:w,minlen:x,nestingEdge:!0}),e.setEdge(b,d,{weight:w,minlen:x,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,s,{weight:0,minlen:i+a[o]})}function Cr(e){var t={};function r(n,i){var a=e.children(n);a&&a.length&&a.forEach(o=>r(o,i+1)),t[n]=i}return e.children().forEach(n=>r(n,1)),t}function Mr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function Tr(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(r=>{var n=e.edge(r);n.nestingEdge&&e.removeEdge(r)})}});var Oe=p((wi,Ne)=>{var jr=m();Ne.exports=_r;function _r(e){function t(r){let n=e.children(r),i=e.node(r);if(n.length&&n.forEach(t),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let a=i.minRank,o=i.maxRank+1;a<o;++a)ve(e,"borderLeft","_bl",r,i,a),ve(e,"borderRight","_br",r,i,a)}}e.children().forEach(t)}function ve(e,t,r,n,i,a){let o={width:0,height:0,rank:a,borderType:t},l=i[t][a-1],s=jr.addDummyNode(e,"border",o,r);i[t][a]=s,e.setParent(s,n),l&&e.setEdge(l,s,{weight:1})}});var Re=p((Ei,Le)=>{"use strict";Le.exports={adjust:Sr,undo:Pr};function Sr(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&qe(e)}function Pr(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Gr(e),(t==="lr"||t==="rl")&&(Vr(e),qe(e))}function qe(e){e.nodes().forEach(t=>Ie(e.node(t))),e.edges().forEach(t=>Ie(e.edge(t)))}function Ie(e){let t=e.width;e.width=e.height,e.height=t}function Gr(e){e.nodes().forEach(t=>S(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(S),Object.hasOwn(r,"y")&&S(r)})}function S(e){e.y=-e.y}function Vr(e){e.nodes().forEach(t=>P(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(P),Object.hasOwn(r,"x")&&P(r)})}function P(e){let t=e.x;e.x=e.y,e.y=t}});var Te=p((gi,Me)=>{"use strict";var Ce=m();Me.exports=Fr;function Fr(e){let t={},r=e.nodes().filter(s=>!e.children(s).length),n=r.map(s=>e.node(s).rank),i=Ce.applyWithChunking(Math.max,n),a=Ce.range(i+1).map(()=>[]);function o(s){if(t[s])return;t[s]=!0;let d=e.node(s);a[d.rank].push(s),e.successors(s).forEach(o)}return r.sort((s,d)=>e.node(s).rank-e.node(d).rank).forEach(o),a}});var _e=p((ki,je)=>{"use strict";var Br=m().zipObject;je.exports=Dr;function Dr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=Yr(e,t[n-1],t[n]);return r}function Yr(e,t,r){let n=Br(r,r.map((d,u)=>u)),i=t.flatMap(d=>e.outEdges(d).map(u=>({pos:n[u.w],weight:e.edge(u).weight})).sort((u,h)=>u.pos-h.pos)),a=1;for(;a<r.length;)a<<=1;let o=2*a-1;a-=1;let l=new Array(o).fill(0),s=0;return i.forEach(d=>{let u=d.pos+a;l[u]+=d.weight;let h=0;for(;u>0;)u%2&&(h+=l[u+1]),u=u-1>>1,l[u]+=d.weight;s+=d.weight*h}),s}});var Pe=p((xi,Se)=>{Se.exports=Ar;function Ar(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(n.length){let i=n.reduce((a,o)=>{let l=e.edge(o),s=e.node(o.v);return{sum:a.sum+l.weight*s.order,weight:a.weight+l.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}});var Ve=p((yi,Ge)=>{"use strict";var Wr=m();Ge.exports=zr;function zr(e,t){let r={};e.forEach((i,a)=>{let o=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(o.barycenter=i.barycenter,o.weight=i.weight)}),t.edges().forEach(i=>{let a=r[i.v],o=r[i.w];a!==void 0&&o!==void 0&&(o.indegree++,a.out.push(r[i.w]))});let n=Object.values(r).filter(i=>!i.indegree);return Xr(n)}function Xr(e){let t=[];function r(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&Hr(i,a)}}function n(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(r(i)),i.out.forEach(n(i))}return t.filter(i=>!i.merged).map(i=>Wr.pick(i,["vs","i","barycenter","weight"]))}function Hr(e,t){let r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}});var De=p((vi,Be)=>{var Ur=m();Be.exports=Jr;function Jr(e,t){let r=Ur.partition(e,u=>Object.hasOwn(u,"barycenter")),n=r.lhs,i=r.rhs.sort((u,h)=>h.i-u.i),a=[],o=0,l=0,s=0;n.sort(Kr(!!t)),s=Fe(a,i,s),n.forEach(u=>{s+=u.vs.length,a.push(u.vs),o+=u.barycenter*u.weight,l+=u.weight,s=Fe(a,i,s)});let d={vs:a.flat(!0)};return l&&(d.barycenter=o/l,d.weight=l),d}function Fe(e,t,r){let n;for(;t.length&&(n=t[t.length-1]).i<=r;)t.pop(),e.push(n.vs),r++;return r}function Kr(e){return(t,r)=>t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}});var We=p((Ni,Ae)=>{var Qr=Pe(),Zr=Ve(),$r=De();Ae.exports=Ye;function Ye(e,t,r,n){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,s={};o&&(i=i.filter(f=>f!==o&&f!==l));let d=Qr(e,i);d.forEach(f=>{if(e.children(f.v).length){let c=Ye(e,f.v,r,n);s[f.v]=c,Object.hasOwn(c,"barycenter")&&tn(f,c)}});let u=Zr(d,r);en(u,s);let h=$r(u,n);if(o&&(h.vs=[o,h.vs,l].flat(!0),e.predecessors(o).length)){let f=e.node(e.predecessors(o)[0]),c=e.node(e.predecessors(l)[0]);Object.hasOwn(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+f.order+c.order)/(h.weight+2),h.weight+=2}return h}function en(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function tn(e,t){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)}});var Xe=p((Oi,ze)=>{var rn=g("@dagrejs/graphlib").Graph,nn=m();ze.exports=on;function on(e,t,r,n){n||(n=e.nodes());let i=an(e),a=new rn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(o=>e.node(o));return n.forEach(o=>{let l=e.node(o),s=e.parent(o);(l.rank===t||l.minRank<=t&&t<=l.maxRank)&&(a.setNode(o),a.setParent(o,s||i),e[r](o).forEach(d=>{let u=d.v===o?d.w:d.v,h=a.edge(u,o),f=h!==void 0?h.weight:0;a.setEdge(u,o,{weight:e.edge(d).weight+f})}),Object.hasOwn(l,"minRank")&&a.setNode(o,{borderLeft:l.borderLeft[t],borderRight:l.borderRight[t]}))}),a}function an(e){for(var t;e.hasNode(t=nn.uniqueId("_root")););return t}});var Ue=p((Ii,He)=>{He.exports=ln;function ln(e,t,r){let n={},i;r.forEach(a=>{let o=e.parent(a),l,s;for(;o;){if(l=e.parent(o),l?(s=n[l],n[l]=o):(s=i,i=o),s&&s!==o){t.setEdge(s,o);return}o=l}})}});var $e=p((qi,Ze)=>{"use strict";var sn=Te(),dn=_e(),un=We(),hn=Xe(),fn=Ue(),cn=g("@dagrejs/graphlib").Graph,q=m();Ze.exports=Qe;function Qe(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Qe);return}let r=q.maxRank(e),n=Je(e,q.range(1,r+1),"inEdges"),i=Je(e,q.range(r-1,-1,-1),"outEdges"),a=sn(e);if(Ke(e,a),t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l,s=t.constraints||[];for(let d=0,u=0;u<4;++d,++u){pn(d%2?n:i,d%4>=2,s),a=q.buildLayerMatrix(e);let h=dn(e,a);h<o?(u=0,l=Object.assign({},a),o=h):h===o&&(l=structuredClone(a))}Ke(e,l)}function Je(e,t,r){let n=new Map,i=(a,o)=>{n.has(a)||n.set(a,[]),n.get(a).push(o)};for(let a of e.nodes()){let o=e.node(a);if(typeof o.rank=="number"&&i(o.rank,a),typeof o.minRank=="number"&&typeof o.maxRank=="number")for(let l=o.minRank;l<=o.maxRank;l++)l!==o.rank&&i(l,a)}return t.map(function(a){return hn(e,a,r,n.get(a)||[])})}function pn(e,t,r){let n=new cn;e.forEach(function(i){r.forEach(l=>n.setEdge(l.left,l.right));let a=i.graph().root,o=un(i,a,n,t);o.vs.forEach((l,s)=>i.node(l).order=s),fn(i,n,o.vs)})}function Ke(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var dt=p((Li,st)=>{"use strict";var mn=g("@dagrejs/graphlib").Graph,k=m();st.exports={positionX:En,findType1Conflicts:et,findType2Conflicts:tt,addConflict:G,hasConflict:rt,verticalAlignment:nt,horizontalCompaction:it,alignCoordinates:at,findSmallestWidthAlignment:ot,balance:lt};function et(e,t){let r={};function n(i,a){let o=0,l=0,s=i.length,d=a[a.length-1];return a.forEach((u,h)=>{let f=bn(e,u),c=f?e.node(f).order:s;(f||u===d)&&(a.slice(l,h+1).forEach(b=>{e.predecessors(b).forEach(w=>{let x=e.node(w),B=x.order;(B<o||c<B)&&!(x.dummy&&e.node(b).dummy)&&G(r,w,b)})}),l=h+1,o=c)}),a}return t.length&&t.reduce(n),r}function tt(e,t){let r={};function n(a,o,l,s,d){let u;k.range(o,l).forEach(h=>{u=a[h],e.node(u).dummy&&e.predecessors(u).forEach(f=>{let c=e.node(f);c.dummy&&(c.order<s||c.order>d)&&G(r,f,u)})})}function i(a,o){let l=-1,s,d=0;return o.forEach((u,h)=>{if(e.node(u).dummy==="border"){let f=e.predecessors(u);f.length&&(s=e.node(f[0]).order,n(o,d,h,l,s),d=h,l=s)}n(o,d,o.length,s,a.length)}),o}return t.length&&t.reduce(i),r}function bn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function G(e,t,r){if(t>r){let i=t;t=r,r=i}let n=e[t];n||(e[t]=n={}),n[r]=!0}function rt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function nt(e,t,r,n){let i={},a={},o={};return t.forEach(l=>{l.forEach((s,d)=>{i[s]=s,a[s]=s,o[s]=d})}),t.forEach(l=>{let s=-1;l.forEach(d=>{let u=n(d);if(u.length){u=u.sort((f,c)=>o[f]-o[c]);let h=(u.length-1)/2;for(let f=Math.floor(h),c=Math.ceil(h);f<=c;++f){let b=u[f];a[d]===d&&s<o[b]&&!rt(r,d,b)&&(a[b]=d,a[d]=i[d]=i[b],s=o[b])}}})}),{root:i,align:a}}function it(e,t,r,n,i){let a={},o=wn(e,t,r,i),l=i?"borderLeft":"borderRight";function s(h,f){let c=o.nodes().slice(),b={},w=c.pop();for(;w;){if(b[w])h(w);else{b[w]=!0,c.push(w);for(let x of f(w))c.push(x)}w=c.pop()}}function d(h){a[h]=o.inEdges(h).reduce((f,c)=>Math.max(f,a[c.v]+o.edge(c)),0)}function u(h){let f=o.outEdges(h).reduce((b,w)=>Math.min(b,a[w.w]-o.edge(w)),Number.POSITIVE_INFINITY),c=e.node(h);f!==Number.POSITIVE_INFINITY&&c.borderType!==l&&(a[h]=Math.max(a[h],f))}return s(d,o.predecessors.bind(o)),s(u,o.successors.bind(o)),Object.keys(n).forEach(h=>a[h]=a[r[h]]),a}function wn(e,t,r,n){let i=new mn,a=e.graph(),o=gn(a.nodesep,a.edgesep,n);return t.forEach(l=>{let s;l.forEach(d=>{let u=r[d];if(i.setNode(u),s){var h=r[s],f=i.edge(h,u);i.setEdge(h,u,Math.max(o(e,d,s),f||0))}s=d})}),i}function ot(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([l,s])=>{let d=kn(e,l)/2;i=Math.max(s+d,i),a=Math.min(s-d,a)});let o=i-a;return o<r[0]&&(r=[o,n]),r},[Number.POSITIVE_INFINITY,null])[1]}function at(e,t){let r=Object.values(t),n=k.applyWithChunking(Math.min,r),i=k.applyWithChunking(Math.max,r);["u","d"].forEach(a=>{["l","r"].forEach(o=>{let l=a+o,s=e[l];if(s===t)return;let d=Object.values(s),u=n-k.applyWithChunking(Math.min,d);o!=="l"&&(u=i-k.applyWithChunking(Math.max,d)),u&&(e[l]=k.mapValues(s,h=>h+u))})})}function lt(e,t){return k.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let i=Object.values(e).map(a=>a[n]).sort((a,o)=>a-o);return(i[1]+i[2])/2}})}function En(e){let t=k.buildLayerMatrix(e),r=Object.assign(et(e,t),tt(e,t)),n={},i;["u","d"].forEach(o=>{i=o==="u"?t:Object.values(t).reverse(),["l","r"].forEach(l=>{l==="r"&&(i=i.map(h=>Object.values(h).reverse()));let s=(o==="u"?e.predecessors:e.successors).bind(e),d=nt(e,i,r,s),u=it(e,i,d.root,d.align,l==="r");l==="r"&&(u=k.mapValues(u,h=>-h)),n[o+l]=u})});let a=ot(e,n);return at(n,a),lt(n,e.graph().align)}function gn(e,t,r){return(n,i,a)=>{let o=n.node(i),l=n.node(a),s=0,d;if(s+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":d=-o.width/2;break;case"r":d=o.width/2;break}if(d&&(s+=r?d:-d),d=0,s+=(o.dummy?t:e)/2,s+=(l.dummy?t:e)/2,s+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":d=l.width/2;break;case"r":d=-l.width/2;break}return d&&(s+=r?d:-d),d=0,s}}function kn(e,t){return e.node(t).width}});var ft=p((Ri,ht)=>{"use strict";var ut=m(),xn=dt().positionX;ht.exports=yn;function yn(e){e=ut.asNonCompoundGraph(e),vn(e),Object.entries(xn(e)).forEach(([t,r])=>e.node(t).x=r)}function vn(e){let t=ut.buildLayerMatrix(e),r=e.graph().ranksep,n=0;t.forEach(i=>{let a=i.reduce((o,l)=>{let s=e.node(l).height;return o>s?o:s},0);i.forEach(o=>e.node(o).y=n+a/2),n+=a+r})}});var gt=p((Ci,Et)=>{"use strict";var ct=ee(),pt=re(),Nn=we(),On=m().normalizeRanks,In=ge(),qn=m().removeEmptyRanks,mt=ye(),Ln=Oe(),bt=Re(),Rn=$e(),Cn=ft(),E=m(),Mn=g("@dagrejs/graphlib").Graph;Et.exports=Tn;function Tn(e,t={}){let r=t.debugTiming?E.time:E.notime;return r("layout",()=>{let n=r(" buildLayoutGraph",()=>Yn(e));return r(" runLayout",()=>jn(n,r,t)),r(" updateInputGraph",()=>_n(e,n)),n})}function jn(e,t,r){t(" makeSpaceForEdgeLabels",()=>An(e)),t(" removeSelfEdges",()=>Zn(e)),t(" acyclic",()=>ct.run(e)),t(" nestingGraph.run",()=>mt.run(e)),t(" rank",()=>Nn(E.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>Wn(e)),t(" removeEmptyRanks",()=>qn(e)),t(" nestingGraph.cleanup",()=>mt.cleanup(e)),t(" normalizeRanks",()=>On(e)),t(" assignRankMinMax",()=>zn(e)),t(" removeEdgeLabelProxies",()=>Xn(e)),t(" normalize.run",()=>pt.run(e)),t(" parentDummyChains",()=>In(e)),t(" addBorderSegments",()=>Ln(e)),t(" order",()=>Rn(e,r)),t(" insertSelfEdges",()=>$n(e)),t(" adjustCoordinateSystem",()=>bt.adjust(e)),t(" position",()=>Cn(e)),t(" positionSelfEdges",()=>ei(e)),t(" removeBorderNodes",()=>Qn(e)),t(" normalize.undo",()=>pt.undo(e)),t(" fixupEdgeLabelCoords",()=>Jn(e)),t(" undoCoordinateSystem",()=>bt.undo(e)),t(" translateGraph",()=>Hn(e)),t(" assignNodeIntersects",()=>Un(e)),t(" reversePoints",()=>Kn(e)),t(" acyclic.undo",()=>ct.undo(e))}function _n(e,t){e.nodes().forEach(r=>{let n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,n.order=i.order,n.rank=i.rank,t.children(r).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(r=>{let n=e.edge(r),i=t.edge(r);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Sn=["nodesep","edgesep","ranksep","marginx","marginy"],Pn={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gn=["acyclicer","ranker","rankdir","align"],Vn=["width","height","rank"],wt={width:0,height:0},Fn=["minlen","weight","width","height","labeloffset"],Bn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Dn=["labelpos"];function Yn(e){let t=new Mn({multigraph:!0,compound:!0}),r=F(e.graph());return t.setGraph(Object.assign({},Pn,V(r,Sn),E.pick(r,Gn))),e.nodes().forEach(n=>{let i=F(e.node(n)),a=V(i,Vn);Object.keys(wt).forEach(o=>{a[o]===void 0&&(a[o]=wt[o])}),t.setNode(n,a),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=F(e.edge(n));t.setEdge(n,Object.assign({},Bn,V(i,Fn),E.pick(i,Dn)))}),t}function An(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(r=>{let n=e.edge(r);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function Wn(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),a={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};E.addDummyNode(e,"edge-proxy",a,"_ep")}})}function zn(e){let t=0;e.nodes().forEach(r=>{let n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=Math.max(t,n.maxRank))}),e.graph().maxRank=t}function Xn(e){e.nodes().forEach(t=>{let r=e.node(t);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function Hn(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),o=a.marginx||0,l=a.marginy||0;function s(d){let u=d.x,h=d.y,f=d.width,c=d.height;t=Math.min(t,u-f/2),r=Math.max(r,u+f/2),n=Math.min(n,h-c/2),i=Math.max(i,h+c/2)}e.nodes().forEach(d=>s(e.node(d))),e.edges().forEach(d=>{let u=e.edge(d);Object.hasOwn(u,"x")&&s(u)}),t-=o,n-=l,e.nodes().forEach(d=>{let u=e.node(d);u.x-=t,u.y-=n}),e.edges().forEach(d=>{let u=e.edge(d);u.points.forEach(h=>{h.x-=t,h.y-=n}),Object.hasOwn(u,"x")&&(u.x-=t),Object.hasOwn(u,"y")&&(u.y-=n)}),a.width=r-t+o,a.height=i-n+l}function Un(e){e.edges().forEach(t=>{let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),a,o;r.points?(a=r.points[0],o=r.points[r.points.length-1]):(r.points=[],a=i,o=n),r.points.unshift(E.intersectRect(n,a)),r.points.push(E.intersectRect(i,o))})}function Jn(e){e.edges().forEach(t=>{let r=e.edge(t);if(Object.hasOwn(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function Kn(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function Qn(e){e.nodes().forEach(t=>{if(e.children(t).length){let r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),a=e.node(r.borderLeft[r.borderLeft.length-1]),o=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(o.x-a.x),r.height=Math.abs(i.y-n.y),r.x=a.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Zn(e){e.edges().forEach(t=>{if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function $n(e){var t=E.buildLayerMatrix(e);t.forEach(r=>{var n=0;r.forEach((i,a)=>{var o=e.node(i);o.order=a+n,(o.selfEdges||[]).forEach(l=>{E.addDummyNode(e,"selfedge",{width:l.label.width,height:l.label.height,rank:o.rank,order:a+ ++n,e:l.e,label:l.label},"_se")}),delete o.selfEdges})})}function ei(e){e.nodes().forEach(t=>{var r=e.node(t);if(r.dummy==="selfedge"){var n=e.node(r.e.v),i=n.x+n.width/2,a=n.y,o=r.x-i,l=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*o/3,y:a-l},{x:i+5*o/6,y:a-l},{x:i+o,y:a},{x:i+5*o/6,y:a+l},{x:i+2*o/3,y:a+l}],r.label.x=r.x,r.label.y=r.y}})}function V(e,t){return E.mapValues(E.pick(e,t),Number)}function F(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var xt=p((Mi,kt)=>{var ti=m(),ri=g("@dagrejs/graphlib").Graph;kt.exports={debugOrdering:ni};function ni(e){let t=ti.buildLayerMatrix(e),r=new ri({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(n=>{r.setNode(n,{label:n}),r.setParent(n,"layer"+e.node(n).rank)}),e.edges().forEach(n=>r.setEdge(n.v,n.w,{},n.name)),t.forEach((n,i)=>{let a="layer"+i;r.setNode(a,{rank:"same"}),n.reduce((o,l)=>(r.setEdge(o,l,{style:"invis"}),l))}),r}});var vt=p((Ti,yt)=>{yt.exports="2.0.1"});var ii=p((ji,Nt)=>{Nt.exports={graphlib:g("@dagrejs/graphlib"),layout:gt(),debug:xt(),util:{time:m().time,notime:m().notime},version:vt()}});export default ii();
|
|
2
2
|
/*! For license information please see dagre.esm.js.LEGAL.txt */
|
|
3
3
|
//# sourceMappingURL=dagre.esm.js.map
|