@dagrejs/dagre 2.0.4 → 3.0.0
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 +4 -4
- package/dist/dagre.d.ts +1 -0
- package/dist/dagre.esm.js +1 -1
- package/dist/dagre.esm.js.map +4 -4
- package/dist/dagre.js +2629 -2188
- package/dist/dagre.js.map +4 -4
- package/dist/dagre.min.js +1 -1
- package/dist/dagre.min.js.map +4 -4
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/acyclic.d.ts +6 -0
- package/dist/types/lib/acyclic.d.ts.map +1 -0
- package/dist/types/lib/add-border-segments.d.ts +4 -0
- package/dist/types/lib/add-border-segments.d.ts.map +1 -0
- package/dist/types/lib/coordinate-system.d.ts +4 -0
- package/dist/types/lib/coordinate-system.d.ts.map +1 -0
- package/dist/types/lib/data/list.d.ts +14 -0
- package/dist/types/lib/data/list.d.ts.map +1 -0
- package/dist/types/lib/debug.d.ts +3 -0
- package/dist/types/lib/debug.d.ts.map +1 -0
- package/dist/types/lib/graph-lib.d.ts +3 -0
- package/dist/types/lib/graph-lib.d.ts.map +1 -0
- package/dist/types/lib/greedy-fas.d.ts +4 -0
- package/dist/types/lib/greedy-fas.d.ts.map +1 -0
- package/dist/types/lib/layout.d.ts +4 -0
- package/dist/types/lib/layout.d.ts.map +1 -0
- package/dist/types/lib/nesting-graph.d.ts +5 -0
- package/dist/types/lib/nesting-graph.d.ts.map +1 -0
- package/dist/types/lib/normalize.d.ts +5 -0
- package/dist/types/lib/normalize.d.ts.map +1 -0
- package/dist/types/lib/order/add-subgraph-constraints.d.ts +3 -0
- package/dist/types/lib/order/add-subgraph-constraints.d.ts.map +1 -0
- package/dist/types/lib/order/barycenter.d.ts +9 -0
- package/dist/types/lib/order/barycenter.d.ts.map +1 -0
- package/dist/types/lib/order/build-layer-graph.d.ts +3 -0
- package/dist/types/lib/order/build-layer-graph.d.ts.map +1 -0
- package/dist/types/lib/order/cross-count.d.ts +3 -0
- package/dist/types/lib/order/cross-count.d.ts.map +1 -0
- package/dist/types/lib/order/index.d.ts +9 -0
- package/dist/types/lib/order/index.d.ts.map +1 -0
- package/dist/types/lib/order/init-order.d.ts +3 -0
- package/dist/types/lib/order/init-order.d.ts.map +1 -0
- package/dist/types/lib/order/resolve-conflicts.d.ts +15 -0
- package/dist/types/lib/order/resolve-conflicts.d.ts.map +1 -0
- package/dist/types/lib/order/sort-subgraph.d.ts +9 -0
- package/dist/types/lib/order/sort-subgraph.d.ts.map +1 -0
- package/dist/types/lib/order/sort.d.ts +14 -0
- package/dist/types/lib/order/sort.d.ts.map +1 -0
- package/dist/types/lib/parent-dummy-chains.d.ts +4 -0
- package/dist/types/lib/parent-dummy-chains.d.ts.map +1 -0
- package/dist/types/lib/position/bk.d.ts +37 -0
- package/dist/types/lib/position/bk.d.ts.map +1 -0
- package/dist/types/lib/position/index.d.ts +5 -0
- package/dist/types/lib/position/index.d.ts.map +1 -0
- package/dist/types/lib/rank/feasible-tree.d.ts +14 -0
- package/dist/types/lib/rank/feasible-tree.d.ts.map +1 -0
- package/dist/types/lib/rank/index.d.ts +4 -0
- package/dist/types/lib/rank/index.d.ts.map +1 -0
- package/dist/types/lib/rank/network-simplex.d.ts +13 -0
- package/dist/types/lib/rank/network-simplex.d.ts.map +1 -0
- package/dist/types/lib/rank/util.d.ts +5 -0
- package/dist/types/lib/rank/util.d.ts.map +1 -0
- package/dist/types/lib/type.d.ts +2 -0
- package/dist/types/lib/type.d.ts.map +1 -0
- package/dist/types/lib/types.d.ts +124 -0
- package/dist/types/lib/types.d.ts.map +1 -0
- package/dist/types/lib/util.d.ts +39 -0
- package/dist/types/lib/util.d.ts.map +1 -0
- package/dist/types/lib/version.d.ts +2 -0
- package/dist/types/lib/version.d.ts.map +1 -0
- package/package.json +32 -11
package/dist/dagre.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=p((ni,D)=>{var q=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return B(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&B(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,vt)),n=n._prev;return"["+t.join(", ")+"]"}};function B(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function vt(e,t){if(e!=="_next"&&e!=="_prev")return t}D.exports=q});var W=p((ii,Y)=>{var Nt=require("@dagrejs/graphlib").Graph,Ot=A();Y.exports=qt;var It=()=>1;function qt(e,t){if(e.nodeCount()<=1)return[];let r=Rt(e,t||It);return Lt(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function Lt(e,t,r){let n=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)L(e,t,r,o);for(;o=i.dequeue();)L(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(L(e,t,r,o,!0));break}}}return n}function L(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,R(t,r,s)}),e.outEdges(n.v).forEach(o=>{let l=e.edge(o),s=o.w,d=e.node(s);d.in-=l,R(t,r,d)}),e.removeNode(n.v),a}function Rt(e,t){let r=new Nt,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=Ct(i+n+3).map(()=>new Ot),o=n+1;return r.nodes().forEach(l=>{R(a,o,r.node(l))}),{graph:r,buckets:a,zeroIdx:o}}function R(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 Ct(e){let t=[];for(let r=0;r<e;r++)t.push(r);return t}});var m=p((oi,Q)=>{"use strict";var z=require("@dagrejs/graphlib").Graph;Q.exports={addBorderNode:Ft,addDummyNode:X,applyWithChunking:v,asNonCompoundGraph:Tt,buildLayerMatrix:Pt,intersectRect:St,mapValues:Xt,maxRank:U,normalizeRanks:Gt,notime:Yt,partition:Dt,pick:zt,predecessorWeights:_t,range:K,removeEmptyRanks:Vt,simplify:Mt,successorWeights:jt,time:At,uniqueId:J,zipObject:C};function X(e,t,r,n){for(var i=n;e.hasNode(i);)i=J(n);return r.dummy=t,e.setNode(i,r),i}function Mt(e){let t=new z().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 Tt(e){let t=new z({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 jt(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 C(e.nodes(),t)}function _t(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 C(e.nodes(),t)}function St(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 Pt(e){let t=K(U(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 Gt(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=v(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function Vt(e){let t=e.nodes().map(o=>e.node(o).rank).filter(o=>o!==void 0),r=v(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 Ft(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),X(e,"border",i,t)}function Bt(e,t=H){let r=[];for(let n=0;n<e.length;n+=t){let i=e.slice(n,n+t);r.push(i)}return r}var H=65535;function v(e,t){if(t.length>H){let r=Bt(t);return e.apply(null,r.map(n=>e.apply(null,n)))}else return e.apply(null,t)}function U(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return v(Math.max,r)}function Dt(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function At(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function Yt(e,t){return t()}var Wt=0;function J(e){var t=++Wt;return e+(""+t)}function K(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 zt(e,t){let r={};for(let n of t)e[n]!==void 0&&(r[n]=e[n]);return r}function Xt(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 C(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var $=p((ai,Z)=>{"use strict";var Ht=W(),Ut=m().uniqueId;Z.exports={run:Jt,undo:Qt};function Jt(e){(e.graph().acyclicer==="greedy"?Ht(e,r(e)):Kt(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,Ut("rev"))});function r(n){return i=>n.edge(i).weight}}function Kt(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 Qt(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 te=p((li,ee)=>{"use strict";var Zt=m();ee.exports={run:$t,undo:tr};function $t(e){e.graph().dummyChains=[],e.edges().forEach(t=>er(e,t))}function er(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=Zt.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 tr(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 y=p((si,re)=>{"use strict";var{applyWithChunking:rr}=m();re.exports={longestPath:nr,slack:ir};function nr(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=rr(Math.min,a);return o===Number.POSITIVE_INFINITY&&(o=0),i.rank=o}e.sources().forEach(r)}function ir(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var M=p((di,ne)=>{"use strict";var or=require("@dagrejs/graphlib").Graph,N=y().slack;ne.exports=ar;function ar(e){var t=new or({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,a;lr(t,e)<n;)i=sr(t,e),a=t.hasNode(i.v)?N(e,i):-N(e,i),dr(t,e,a);return t}function lr(e,t){function r(n){t.nodeEdges(n).forEach(i=>{var a=i.v,o=n===a?i.w:a;!e.hasNode(o)&&!N(t,i)&&(e.setNode(o,{}),e.setEdge(n,o,{}),r(o))})}return e.nodes().forEach(r),e.nodeCount()}function sr(e,t){return t.edges().reduce((n,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=N(t,i)),a<n[0]?[a,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function dr(e,t,r){e.nodes().forEach(n=>t.node(n).rank+=r)}});var fe=p((ui,he)=>{"use strict";var ur=M(),ie=y().slack,hr=y().longestPath,fr=require("@dagrejs/graphlib").alg.preorder,cr=require("@dagrejs/graphlib").alg.postorder,pr=m().simplify;he.exports=x;x.initLowLimValues=j;x.initCutValues=T;x.calcCutValue=ae;x.leaveEdge=se;x.enterEdge=de;x.exchangeEdges=ue;function x(e){e=pr(e),hr(e);var t=ur(e);j(t),T(t,e);for(var r,n;r=se(t);)n=de(t,e,r),ue(t,e,r,n)}function T(e,t){var r=cr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>mr(e,t,n))}function mr(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=ae(e,t,r)}function ae(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,wr(e,r,u)){var c=e.edge(r,u).cutvalue;l+=h?-c:c}}}),l}function j(e,t){arguments.length<2&&(t=e.nodes()[0]),le(e,{},1,t)}function le(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=le(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 de(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===oe(e,e.node(u.v),l)&&s!==oe(e,e.node(u.w),l));return d.reduce((u,h)=>ie(t,h)<ie(t,u)?h:u)}function ue(e,t,r,n){var i=r.v,a=r.w;e.removeEdge(i,a),e.setEdge(n.v,n.w,{}),j(e),T(e,t),br(e,t)}function br(e,t){var r=e.nodes().find(i=>!t.node(i).parent),n=fr(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 wr(e,t,r){return e.hasEdge(t,r)}function oe(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var be=p((hi,me)=>{"use strict";var Er=y(),pe=Er.longestPath,gr=M(),kr=fe();me.exports=xr;function xr(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":ce(e);break;case"tight-tree":vr(e);break;case"longest-path":yr(e);break;case"none":break;default:ce(e)}}var yr=pe;function vr(e){pe(e),gr(e)}function ce(e){kr(e)}});var Ee=p((fi,we)=>{we.exports=Nr;function Nr(e){let t=Ir(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,a=Or(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 Or(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 Ir(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 xe=p((ci,ke)=>{var O=m();ke.exports={run:qr,cleanup:Cr};function qr(e){let t=O.addDummyNode(e,"root",{},"_root"),r=Lr(e),n=Object.values(r),i=O.applyWithChunking(Math.max,n)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(l=>e.edge(l).minlen*=a);let o=Rr(e)+1;e.children().forEach(l=>ge(e,t,a,o,i,r,l)),e.graph().nodeRankFactor=a}function ge(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=O.addBorderNode(e,"_bt"),d=O.addBorderNode(e,"_bb"),u=e.node(o);e.setParent(s,o),u.borderTop=s,e.setParent(d,o),u.borderBottom=d,l.forEach(h=>{ge(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,k=c!==b?1:i-a[o]+1;e.setEdge(s,c,{weight:w,minlen:k,nestingEdge:!0}),e.setEdge(b,d,{weight:w,minlen:k,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,s,{weight:0,minlen:i+a[o]})}function Lr(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 Rr(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function Cr(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 Ne=p((pi,ve)=>{var Mr=m();ve.exports=Tr;function Tr(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)ye(e,"borderLeft","_bl",r,i,a),ye(e,"borderRight","_br",r,i,a)}}e.children().forEach(t)}function ye(e,t,r,n,i,a){let o={width:0,height:0,rank:a,borderType:t},l=i[t][a-1],s=Mr.addDummyNode(e,"border",o,r);i[t][a]=s,e.setParent(s,n),l&&e.setEdge(l,s,{weight:1})}});var Le=p((mi,qe)=>{"use strict";qe.exports={adjust:jr,undo:_r};function jr(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Ie(e)}function _r(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&Sr(e),(t==="lr"||t==="rl")&&(Pr(e),Ie(e))}function Ie(e){e.nodes().forEach(t=>Oe(e.node(t))),e.edges().forEach(t=>Oe(e.edge(t)))}function Oe(e){let t=e.width;e.width=e.height,e.height=t}function Sr(e){e.nodes().forEach(t=>_(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(_),Object.hasOwn(r,"y")&&_(r)})}function _(e){e.y=-e.y}function Pr(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,"x")&&S(r)})}function S(e){let t=e.x;e.x=e.y,e.y=t}});var Me=p((bi,Ce)=>{"use strict";var Re=m();Ce.exports=Gr;function Gr(e){let t={},r=e.nodes().filter(s=>!e.children(s).length),n=r.map(s=>e.node(s).rank),i=Re.applyWithChunking(Math.max,n),a=Re.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 je=p((wi,Te)=>{"use strict";var Vr=m().zipObject;Te.exports=Fr;function Fr(e,t){let r=0;for(let n=1;n<t.length;++n)r+=Br(e,t[n-1],t[n]);return r}function Br(e,t,r){let n=Vr(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 Se=p((Ei,_e)=>{_e.exports=Dr;function Dr(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 Ge=p((gi,Pe)=>{"use strict";var Ar=m();Pe.exports=Yr;function Yr(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 Wr(n)}function Wr(e){let t=[];function r(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&zr(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=>Ar.pick(i,["vs","i","barycenter","weight"]))}function zr(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 Be=p((ki,Fe)=>{var Xr=m();Fe.exports=Hr;function Hr(e,t){let r=Xr.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(Ur(!!t)),s=Ve(a,i,s),n.forEach(u=>{s+=u.vs.length,a.push(u.vs),o+=u.barycenter*u.weight,l+=u.weight,s=Ve(a,i,s)});let d={vs:a.flat(!0)};return l&&(d.barycenter=o/l,d.weight=l),d}function Ve(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 Ur(e){return(t,r)=>t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}});var Ye=p((xi,Ae)=>{var Jr=Se(),Kr=Ge(),Qr=Be();Ae.exports=De;function De(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=Jr(e,i);d.forEach(f=>{if(e.children(f.v).length){let c=De(e,f.v,r,n);s[f.v]=c,Object.hasOwn(c,"barycenter")&&$r(f,c)}});let u=Kr(d,r);Zr(u,s);let h=Qr(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 Zr(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function $r(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 ze=p((yi,We)=>{var en=require("@dagrejs/graphlib").Graph,tn=m();We.exports=rn;function rn(e,t,r,n){n||(n=e.nodes());let i=nn(e),a=new en({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 nn(e){for(var t;e.hasNode(t=tn.uniqueId("_root")););return t}});var He=p((vi,Xe)=>{Xe.exports=on;function on(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 Ze=p((Ni,Qe)=>{"use strict";var an=Me(),ln=je(),sn=Ye(),dn=ze(),un=He(),hn=require("@dagrejs/graphlib").Graph,I=m();Qe.exports=Ke;function Ke(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Ke);return}let r=I.maxRank(e),n=Ue(e,I.range(1,r+1),"inEdges"),i=Ue(e,I.range(r-1,-1,-1),"outEdges"),a=an(e);if(Je(e,a),t.disableOptimalOrderHeuristic)return;let o=Number.POSITIVE_INFINITY,l,s=t.constraints||[];for(let d=0,u=0;u<4;++d,++u){fn(d%2?n:i,d%4>=2,s),a=I.buildLayerMatrix(e);let h=ln(e,a);h<o?(u=0,l=Object.assign({},a),o=h):h===o&&(l=structuredClone(a))}Je(e,l)}function Ue(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 dn(e,a,r,n.get(a)||[])})}function fn(e,t,r){let n=new hn;e.forEach(function(i){r.forEach(l=>n.setEdge(l.left,l.right));let a=i.graph().root,o=sn(i,a,n,t);o.vs.forEach((l,s)=>i.node(l).order=s),un(i,n,o.vs)})}function Je(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var st=p((Oi,lt)=>{"use strict";var cn=require("@dagrejs/graphlib").Graph,g=m();lt.exports={positionX:bn,findType1Conflicts:$e,findType2Conflicts:et,addConflict:P,hasConflict:tt,verticalAlignment:rt,horizontalCompaction:nt,alignCoordinates:ot,findSmallestWidthAlignment:it,balance:at};function $e(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=pn(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 k=e.node(w),F=k.order;(F<o||c<F)&&!(k.dummy&&e.node(b).dummy)&&P(r,w,b)})}),l=h+1,o=c)}),a}return t.length&&t.reduce(n),r}function et(e,t){let r={};function n(a,o,l,s,d){let u;g.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)&&P(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 pn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function P(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 tt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function rt(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]&&!tt(r,d,b)&&(a[b]=d,a[d]=i[d]=i[b],s=o[b])}}})}),{root:i,align:a}}function nt(e,t,r,n,i){let a={},o=mn(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 k of f(w))c.push(k)}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 mn(e,t,r,n){let i=new cn,a=e.graph(),o=wn(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 it(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=En(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 ot(e,t){let r=Object.values(t),n=g.applyWithChunking(Math.min,r),i=g.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-g.applyWithChunking(Math.min,d);o!=="l"&&(u=i-g.applyWithChunking(Math.max,d)),u&&(e[l]=g.mapValues(s,h=>h+u))})})}function at(e,t){return g.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 bn(e){let t=g.buildLayerMatrix(e),r=Object.assign($e(e,t),et(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=rt(e,i,r,s),u=nt(e,i,d.root,d.align,l==="r");l==="r"&&(u=g.mapValues(u,h=>-h)),n[o+l]=u})});let a=it(e,n);return ot(n,a),at(n,e.graph().align)}function wn(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 En(e,t){return e.node(t).width}});var ht=p((Ii,ut)=>{"use strict";var dt=m(),gn=st().positionX;ut.exports=kn;function kn(e){e=dt.asNonCompoundGraph(e),xn(e),Object.entries(gn(e)).forEach(([t,r])=>e.node(t).x=r)}function xn(e){let t=dt.buildLayerMatrix(e),r=e.graph().ranksep,n=e.graph().rankalign,i=0;t.forEach(a=>{let o=a.reduce((l,s)=>{let d=e.node(s).height;return l>d?l:d},0);a.forEach(l=>{let s=e.node(l);n==="top"?s.y=i+s.height/2:n==="bottom"?s.y=i+o-s.height/2:s.y=i+o/2}),i+=o+r})}});var Et=p((qi,wt)=>{"use strict";var ft=$(),ct=te(),yn=be(),vn=m().normalizeRanks,Nn=Ee(),On=m().removeEmptyRanks,pt=xe(),In=Ne(),mt=Le(),qn=Ze(),Ln=ht(),E=m(),Rn=require("@dagrejs/graphlib").Graph;wt.exports=Cn;function Cn(e,t={}){let r=t.debugTiming?E.time:E.notime;return r("layout",()=>{let n=r(" buildLayoutGraph",()=>Bn(e));return r(" runLayout",()=>Mn(n,r,t)),r(" updateInputGraph",()=>Tn(e,n)),n})}function Mn(e,t,r){t(" makeSpaceForEdgeLabels",()=>Dn(e)),t(" removeSelfEdges",()=>Kn(e)),t(" acyclic",()=>ft.run(e)),t(" nestingGraph.run",()=>pt.run(e)),t(" rank",()=>yn(E.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>An(e)),t(" removeEmptyRanks",()=>On(e)),t(" nestingGraph.cleanup",()=>pt.cleanup(e)),t(" normalizeRanks",()=>vn(e)),t(" assignRankMinMax",()=>Yn(e)),t(" removeEdgeLabelProxies",()=>Wn(e)),t(" normalize.run",()=>ct.run(e)),t(" parentDummyChains",()=>Nn(e)),t(" addBorderSegments",()=>In(e)),t(" order",()=>qn(e,r)),t(" insertSelfEdges",()=>Qn(e)),t(" adjustCoordinateSystem",()=>mt.adjust(e)),t(" position",()=>Ln(e)),t(" positionSelfEdges",()=>Zn(e)),t(" removeBorderNodes",()=>Jn(e)),t(" normalize.undo",()=>ct.undo(e)),t(" fixupEdgeLabelCoords",()=>Hn(e)),t(" undoCoordinateSystem",()=>mt.undo(e)),t(" translateGraph",()=>zn(e)),t(" assignNodeIntersects",()=>Xn(e)),t(" reversePoints",()=>Un(e)),t(" acyclic.undo",()=>ft.undo(e))}function Tn(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 jn=["nodesep","edgesep","ranksep","marginx","marginy"],_n={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},Sn=["acyclicer","ranker","rankdir","align","rankalign"],Pn=["width","height","rank"],bt={width:0,height:0},Gn=["minlen","weight","width","height","labeloffset"],Vn={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Fn=["labelpos"];function Bn(e){let t=new Rn({multigraph:!0,compound:!0}),r=V(e.graph());return t.setGraph(Object.assign({},_n,G(r,jn),E.pick(r,Sn))),e.nodes().forEach(n=>{let i=V(e.node(n)),a=G(i,Pn);Object.keys(bt).forEach(o=>{a[o]===void 0&&(a[o]=bt[o])}),t.setNode(n,a),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=V(e.edge(n));t.setEdge(n,Object.assign({},Vn,G(i,Gn),E.pick(i,Fn)))}),t}function Dn(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 An(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 Yn(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 Wn(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 zn(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 Xn(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 Hn(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 Un(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function Jn(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 Kn(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 Qn(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 Zn(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 G(e,t){return E.mapValues(E.pick(e,t),Number)}function V(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var kt=p((Li,gt)=>{var $n=m(),ei=require("@dagrejs/graphlib").Graph;gt.exports={debugOrdering:ti};function ti(e){let t=$n.buildLayerMatrix(e),r=new ei({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 yt=p((Ri,xt)=>{xt.exports="2.0.4"});module.exports={graphlib:require("@dagrejs/graphlib"),layout:Et(),debug:kt(),util:{time:m().time,notime:m().notime},version:yt()};
|
|
1
|
+
"use strict";var Ze=Object.create;var M=Object.defineProperty;var $e=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var nn=Object.getPrototypeOf,tn=Object.prototype.hasOwnProperty;var rn=(e,n,t)=>n in e?M(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var on=(e,n)=>{for(var t in n)M(e,t,{get:n[t],enumerable:!0})},ue=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of en(n))!tn.call(e,o)&&o!==t&&M(e,o,{get:()=>n[o],enumerable:!(r=$e(n,o))||r.enumerable});return e};var an=(e,n,t)=>(t=e!=null?Ze(nn(e)):{},ue(n||!e||!e.__esModule?M(t,"default",{value:e,enumerable:!0}):t,e)),sn=e=>ue(M({},"__esModule",{value:!0}),e);var ce=(e,n,t)=>rn(e,typeof n!="symbol"?n+"":n,t);var It={};on(It,{Graph:()=>Qe.Graph,debug:()=>D,default:()=>St,graphlib:()=>Je,layout:()=>B,util:()=>Pt,version:()=>F});module.exports=sn(It);var Je=an(require("@dagrejs/graphlib"));var p=require("@dagrejs/graphlib");function N(e,n,t,r){let o=r;for(;e.hasNode(o);)o=C(r);return t.dummy=n,e.setNode(o,t),o}function be(e){let n=new p.Graph().setGraph(e.graph());return e.nodes().forEach(t=>n.setNode(t,e.node(t))),e.edges().forEach(t=>{let r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),n}function _(e){let n=new p.Graph({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(t=>{e.children(t).length||n.setNode(t,e.node(t))}),e.edges().forEach(t=>{n.setEdge(t,e.edge(t))}),n}function Y(e,n){let t=e.x,r=e.y,o=n.x-t,i=n.y-r,a=e.width/2,s=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let d,l;return Math.abs(i)*a>Math.abs(o)*s?(i<0&&(s=-s),d=s*o/i,l=s):(o<0&&(a=-a),d=a,l=a*i/o),{x:t+d,y:r+l}}function G(e){let n=k(q(e)+1).map(()=>[]);return e.nodes().forEach(t=>{let r=e.node(t),o=r.rank;o!==void 0&&(n[o]||(n[o]=[]),n[o][r.order]=t)}),n}function fe(e){let n=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),t=E(Math.min,n);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=t)})}function he(e){let n=e.nodes().map(a=>e.node(a).rank).filter(a=>a!==void 0),t=E(Math.min,n),r=[];e.nodes().forEach(a=>{let s=e.node(a).rank-t;r[s]||(r[s]=[]),r[s].push(a)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((a,s)=>{a===void 0&&s%i!==0?--o:a!==void 0&&o&&a.forEach(d=>e.node(d).rank+=o)})}function H(e,n,t,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),N(e,"border",o,n)}function dn(e,n=ge){let t=[];for(let r=0;r<e.length;r+=n){let o=e.slice(r,r+n);t.push(o)}return t}var ge=65535;function E(e,n){if(n.length>ge){let t=dn(n);return e(...t.map(r=>e(...r)))}else return e(...n)}function q(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MIN_VALUE:o});return E(Math.max,t)}function pe(e,n){let t={lhs:[],rhs:[]};return e.forEach(r=>{n(r)?t.lhs.push(r):t.rhs.push(r)}),t}function S(e,n){let t=Date.now();try{return n()}finally{console.log(e+" time: "+(Date.now()-t)+"ms")}}function I(e,n){return n()}var ln=0;function C(e){let n=++ln;return e+(""+n)}function k(e,n,t=1){n==null&&(n=e,e=0);let r=i=>i<n;t<0&&(r=i=>n<i);let o=[];for(let i=e;r(i);i+=t)o.push(i);return o}function O(e,n){let t={};for(let r of n)e[r]!==void 0&&(t[r]=e[r]);return t}function R(e,n){let t;return typeof n=="string"?t=r=>r[n]:t=n,Object.entries(e).reduce((r,[o,i])=>(r[o]=t(i,o),r),{})}function me(e,n){return e.reduce((t,r,o)=>(t[r]=n[o],t),{})}var v="\0";var F="3.0.0";var z=class{constructor(){ce(this,"_sentinel");let n={};n._next=n._prev=n,this._sentinel=n}dequeue(){let n=this._sentinel,t=n._prev;if(t!==n)return Le(t),t}enqueue(n){let t=this._sentinel;n._prev&&n._next&&Le(n),n._next=t._next,t._next._prev=n,t._next=n,n._prev=t}toString(){let n=[],t=this._sentinel,r=t._prev;for(;r!==t;)n.push(JSON.stringify(r,un)),r=r._prev;return"["+n.join(", ")+"]"}};function Le(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function un(e,n){if(e!=="_next"&&e!=="_prev")return n}var Ee=z;var cn=()=>1;function K(e,n){if(e.nodeCount()<=1)return[];let t=fn(e,n||cn);return bn(t.graph,t.buckets,t.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w)||[])}function bn(e,n,t){var s;let r=[],o=n[n.length-1],i=n[0],a;for(;e.nodeCount();){for(;a=i.dequeue();)X(e,n,t,a);for(;a=o.dequeue();)X(e,n,t,a);if(e.nodeCount()){for(let d=n.length-2;d>0;--d)if(a=(s=n[d])==null?void 0:s.dequeue(),a){r=r.concat(X(e,n,t,a,!0)||[]);break}}}return r}function X(e,n,t,r,o){let i=[],a=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(s=>{let d=e.edge(s),l=e.node(s.v);o&&i.push({v:s.v,w:s.w}),l.out-=d,U(n,t,l)}),(e.outEdges(r.v)||[]).forEach(s=>{let d=e.edge(s),l=s.w,u=e.node(l);u.in-=d,U(n,t,u)}),e.removeNode(r.v),a}function fn(e,n){let t=new p.Graph,r=0,o=0;e.nodes().forEach(s=>{t.setNode(s,{v:s,in:0,out:0})}),e.edges().forEach(s=>{let d=t.edge(s.v,s.w)||0,l=n(s),u=d+l;t.setEdge(s.v,s.w,u);let c=t.node(s.v),f=t.node(s.w);o=Math.max(o,c.out+=l),r=Math.max(r,f.in+=l)});let i=hn(o+r+3).map(()=>new Ee),a=r+1;return t.nodes().forEach(s=>{U(i,a,t.node(s))}),{graph:t,buckets:i,zeroIdx:a}}function U(e,n,t){var r,o,i;t.out?t.in?(i=e[t.out-t.in+n])==null||i.enqueue(t):(o=e[e.length-1])==null||o.enqueue(t):(r=e[0])==null||r.enqueue(t)}function hn(e){let n=[];for(let t=0;t<e;t++)n.push(t);return n}function ye(e){(e.graph().acyclicer==="greedy"?K(e,t(e)):gn(e)).forEach(r=>{let o=e.edge(r);e.removeEdge(r),o.forwardName=r.name,o.reversed=!0,e.setEdge(r.w,r.v,o,C("rev"))});function t(r){return o=>r.edge(o).weight}}function gn(e){let n=[],t={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,t[i]=!0,e.outEdges(i).forEach(a=>{Object.hasOwn(t,a.w)?n.push(a):o(a.w)}),delete t[i])}return e.nodes().forEach(o),n}function Ne(e){e.edges().forEach(n=>{let t=e.edge(n);if(t.reversed){e.removeEdge(n);let r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}})}function Ge(e){e.graph().dummyChains=[],e.edges().forEach(n=>mn(e,n))}function mn(e,n){let t=n.v,r=e.node(t).rank,o=n.w,i=e.node(o).rank,a=n.name,s=e.edge(n),d=s.labelRank;if(i===r+1)return;e.removeEdge(n);let l,u,c;for(c=0,++r;r<i;++c,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:r},l=N(e,"edge",u,"_d"),r===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(t,l,{weight:s.weight},a),c===0&&e.graph().dummyChains.push(l),t=l;e.setEdge(t,o,{weight:s.weight},a)}function we(e){e.graph().dummyChains.forEach(n=>{let t=e.node(n),r=t.edgeLabel,o;for(e.setEdge(t.edgeObj,r);t.dummy;)o=e.successors(n)[0],e.removeNode(n),r.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(r.x=t.x,r.y=t.y,r.width=t.width,r.height=t.height),n=o,t=e.node(n)})}function j(e){let n={};function t(r){let o=e.node(r);if(Object.hasOwn(n,r))return o.rank;n[r]=!0;let i=e.outEdges(r),a=i?i.map(d=>d==null?Number.POSITIVE_INFINITY:t(d.w)-e.edge(d).minlen):[],s=E(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}e.sources().forEach(t)}function x(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}var A=En;function En(e){let n=new p.Graph({directed:!1}),t=e.nodes();if(t.length===0)throw new Error("Graph must have at least one node");let r=t[0],o=e.nodeCount();n.setNode(r,{});let i,a;for(;yn(n,e)<o&&(i=Nn(n,e),!!i);)a=n.hasNode(i.v)?x(e,i):-x(e,i),Gn(n,e,a);return n}function yn(e,n){function t(r){let o=n.nodeEdges(r);o&&o.forEach(i=>{let a=i.v,s=r===a?i.w:a;!e.hasNode(s)&&!x(n,i)&&(e.setNode(s,{}),e.setEdge(r,s,{}),t(s))})}return e.nodes().forEach(t),e.nodeCount()}function Nn(e,n){return n.edges().reduce((r,o)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(i=x(n,o)),i<r[0]?[i,o]:r},[Number.POSITIVE_INFINITY,null])[1]}function Gn(e,n,t){e.nodes().forEach(r=>n.node(r).rank+=t)}var{preorder:wn,postorder:kn}=p.alg,xe=T;T.initLowLimValues=Q;T.initCutValues=J;T.calcCutValue=ve;T.leaveEdge=Oe;T.enterEdge=Re;T.exchangeEdges=Pe;function T(e){e=be(e),j(e);let n=A(e);Q(n),J(n,e);let t,r;for(;t=Oe(n);)r=Re(n,e,t),Pe(n,e,t,r)}function J(e,n){let t=kn(e,e.nodes());t=t.slice(0,t.length-1),t.forEach(r=>xn(e,n,r))}function xn(e,n,t){let o=e.node(t).parent,i=e.edge(t,o);i.cutvalue=ve(e,n,t)}function ve(e,n,t){let o=e.node(t).parent,i=!0,a=n.edge(t,o),s=0;a||(i=!1,a=n.edge(o,t)),s=a.weight;let d=n.nodeEdges(t);return d&&d.forEach(l=>{let u=l.v===t,c=u?l.w:l.v;if(c!==o){let f=u===i,b=n.edge(l).weight;if(s+=f?b:-b,Tn(e,t,c)){let h=e.edge(t,c).cutvalue;s+=f?-h:h}}}),s}function Q(e,n){arguments.length<2&&(n=e.nodes()[0]),Te(e,{},1,n)}function Te(e,n,t,r,o){let i=t,a=e.node(r);n[r]=!0;let s=e.neighbors(r);return s&&s.forEach(d=>{Object.hasOwn(n,d)||(t=Te(e,n,t,d,r))}),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Oe(e){return e.edges().find(n=>e.edge(n).cutvalue<0)}function Re(e,n,t){let r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);let i=e.node(r),a=e.node(o),s=i,d=!1;return i.lim>a.lim&&(s=a,d=!0),n.edges().filter(u=>d===ke(e,e.node(u.v),s)&&d!==ke(e,e.node(u.w),s)).reduce((u,c)=>x(n,c)<x(n,u)?c:u)}function Pe(e,n,t,r){let o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Q(e),J(e,n),vn(e,n)}function vn(e,n){let t=e.nodes().find(o=>!e.node(o).parent);if(!t)return;let r=wn(e,[t]);r=r.slice(1),r.forEach(o=>{let a=e.node(o).parent,s=n.edge(o,a),d=!1;s||(s=n.edge(a,o),d=!0),n.node(o).rank=n.node(a).rank+(d?s.minlen:-s.minlen)})}function Tn(e,n,t){return e.hasEdge(n,t)}function ke(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}var Se=On;function On(e){let n=e.graph().ranker;if(typeof n=="function")return n(e);switch(n){case"network-simplex":Me(e);break;case"tight-tree":Pn(e);break;case"longest-path":Rn(e);break;case"none":break;default:Me(e)}}var Rn=j;function Pn(e){j(e),A(e)}function Me(e){xe(e)}var Ie=Mn;function Mn(e){let n=In(e);e.graph().dummyChains.forEach(t=>{let r=e.node(t),o=r.edgeObj,i=Sn(e,n,o.v,o.w),a=i.path,s=i.lca,d=0,l=a[d],u=!0;for(;t!==o.w;){if(r=e.node(t),u){for(;(l=a[d])!==s&&e.node(l).maxRank<r.rank;)d++;l===s&&(u=!1)}if(!u){for(;d<a.length-1&&e.node(a[d+1]).minRank<=r.rank;)d++;l=a[d]}l!==void 0&&e.setParent(t,l),t=e.successors(t)[0]}})}function Sn(e,n,t,r){let o=[],i=[],a=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim),d;d=t;do d=e.parent(d),o.push(d);while(d&&(n[d].low>a||s>n[d].lim));let l=d,u=r;for(;(u=e.parent(u))!==l;)i.push(u);return{path:o.concat(i.reverse()),lca:l}}function In(e){let n={},t=0;function r(o){let i=t;e.children(o).forEach(r),n[o]={low:i,lim:t++}}return e.children(v).forEach(r),n}function Ce(e){let n=N(e,"root",{},"_root"),t=Cn(e),r=Object.values(t),o=E(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=n,e.edges().forEach(s=>e.edge(s).minlen*=i);let a=jn(e)+1;e.children(v).forEach(s=>je(e,n,i,a,o,t,s)),e.graph().nodeRankFactor=i}function je(e,n,t,r,o,i,a){var c;let s=e.children(a);if(!s.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:t});return}let d=H(e,"_bt"),l=H(e,"_bb"),u=e.node(a);e.setParent(d,a),u.borderTop=d,e.setParent(l,a),u.borderBottom=l,s.forEach(f=>{var y;je(e,n,t,r,o,i,f);let b=e.node(f),g=b.borderTop?b.borderTop:f,h=b.borderBottom?b.borderBottom:f,m=b.borderTop?r:2*r,L=g!==h?1:o-((y=i[a])!=null?y:0)+1;e.setEdge(d,g,{weight:m,minlen:L,nestingEdge:!0}),e.setEdge(h,l,{weight:m,minlen:L,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,d,{weight:0,minlen:o+((c=i[a])!=null?c:0)})}function Cn(e){let n={};function t(r,o){let i=e.children(r);i&&i.length&&i.forEach(a=>t(a,o+1)),n[r]=o}return e.children(v).forEach(r=>t(r,1)),n}function jn(e){return e.edges().reduce((n,t)=>n+e.edge(t).weight,0)}function _e(e){let n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Ae=Fn;function Fn(e){function n(t){let r=e.children(t),o=e.node(t);if(r.length&&r.forEach(n),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,a=o.maxRank+1;i<a;++i)Fe(e,"borderLeft","_bl",t,o,i),Fe(e,"borderRight","_br",t,o,i)}}e.children(v).forEach(n)}function Fe(e,n,t,r,o,i){let a={width:0,height:0,rank:i,borderType:n},s=o[n][i-1],d=N(e,"border",a,t);o[n][i]=d,e.setParent(d,r),s&&e.setEdge(s,d,{weight:1})}function We(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&De(e)}function Be(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&An(e),(n==="lr"||n==="rl")&&(Vn(e),De(e))}function De(e){e.nodes().forEach(n=>Ve(e.node(n))),e.edges().forEach(n=>Ve(e.edge(n)))}function Ve(e){let n=e.width;e.width=e.height,e.height=n}function An(e){e.nodes().forEach(n=>Z(e.node(n))),e.edges().forEach(n=>{var r;let t=e.edge(n);(r=t.points)==null||r.forEach(Z),Object.hasOwn(t,"y")&&Z(t)})}function Z(e){e.y=-e.y}function Vn(e){e.nodes().forEach(n=>$(e.node(n))),e.edges().forEach(n=>{var r;let t=e.edge(n);(r=t.points)==null||r.forEach($),Object.hasOwn(t,"x")&&$(t)})}function $(e){let n=e.x;e.x=e.y,e.y=n}function ee(e){let n={},t=e.nodes().filter(d=>!e.children(d).length),r=t.map(d=>e.node(d).rank),o=E(Math.max,r),i=k(o+1).map(()=>[]);function a(d){if(n[d])return;n[d]=!0;let l=e.node(d);i[l.rank].push(d);let u=e.successors(d);u&&u.forEach(a)}return t.sort((d,l)=>e.node(d).rank-e.node(l).rank).forEach(a),i}function ne(e,n){let t=0;for(let r=1;r<n.length;++r)t+=Bn(e,n[r-1],n[r]);return t}function Bn(e,n,t){let r=me(t,t.map((l,u)=>u)),o=n.flatMap(l=>{let u=e.outEdges(l);return u?u.map(c=>({pos:r[c.w],weight:e.edge(c).weight})).sort((c,f)=>c.pos-f.pos):[]}),i=1;for(;i<t.length;)i<<=1;let a=2*i-1;i-=1;let s=new Array(a).fill(0),d=0;return o.forEach(l=>{let u=l.pos+i;s[u]+=l.weight;let c=0;for(;u>0;)u%2&&(c+=s[u+1]),u=u-1>>1,s[u]+=l.weight;d+=l.weight*c}),d}function te(e,n=[]){return n.map(t=>{let r=e.inEdges(t);if(!r||!r.length)return{v:t};{let o=r.reduce((i,a)=>{let s=e.edge(a),d=e.node(a.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}})}function re(e,n){let t={};e.forEach((o,i)=>{let a={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(a.barycenter=o.barycenter,a.weight=o.weight),t[o.v]=a}),n.edges().forEach(o=>{let i=t[o.v],a=t[o.w];i!==void 0&&a!==void 0&&(a.indegree++,i.out.push(a))});let r=Object.values(t).filter(o=>!o.indegree);return Dn(r)}function Dn(e){let n=[];function t(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&Yn(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();n.push(o),o.in.reverse().forEach(t(o)),o.out.forEach(r(o))}return n.filter(o=>!o.merged).map(o=>O(o,["vs","i","barycenter","weight"]))}function Yn(e,n){let t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}function oe(e,n){let t=pe(e,u=>Object.hasOwn(u,"barycenter")),r=t.lhs,o=t.rhs.sort((u,c)=>c.i-u.i),i=[],a=0,s=0,d=0;r.sort(Hn(!!n)),d=Ye(i,o,d),r.forEach(u=>{d+=u.vs.length,i.push(u.vs),a+=u.barycenter*u.weight,s+=u.weight,d=Ye(i,o,d)});let l={vs:i.flat(1)};return s&&(l.barycenter=a/s,l.weight=s),l}function Ye(e,n,t){let r;for(;n.length&&(r=n[n.length-1]).i<=t;)n.pop(),e.push(r.vs),t++;return t}function Hn(e){return(n,t)=>n.barycenter<t.barycenter?-1:n.barycenter>t.barycenter?1:e?t.i-n.i:n.i-t.i}function V(e,n,t,r){let o=e.children(n),i=e.node(n),a=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};a&&(o=o.filter(f=>f!==a&&f!==s));let l=te(e,o);l.forEach(f=>{if(e.children(f.v).length){let b=V(e,f.v,t,r);d[f.v]=b,Object.hasOwn(b,"barycenter")&&zn(f,b)}});let u=re(l,t);qn(u,d);let c=oe(u,r);if(a&&s){c.vs=[a,c.vs,s].flat(1);let f=e.predecessors(a);if(f&&f.length){let b=e.node(f[0]),g=e.predecessors(s),h=e.node(g[0]);Object.hasOwn(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+b.order+h.order)/(c.weight+2),c.weight+=2}}return c}function qn(e,n){e.forEach(t=>{t.vs=t.vs.flatMap(r=>n[r]?n[r].vs:r)})}function zn(e,n){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight):(e.barycenter=n.barycenter,e.weight=n.weight)}function ie(e,n,t,r){r||(r=e.nodes());let o=Xn(e),i=new p.Graph({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(a=>e.node(a));return r.forEach(a=>{let s=e.node(a),d=e.parent(a);if(s.rank===n||s.minRank<=n&&n<=s.maxRank){i.setNode(a),i.setParent(a,d||o);let l=e[t](a);l&&l.forEach(u=>{let c=u.v===a?u.w:u.v,f=i.edge(c,a),b=f!==void 0?f.weight:0;i.setEdge(c,a,{weight:e.edge(u).weight+b})}),Object.hasOwn(s,"minRank")&&i.setNode(a,{borderLeft:s.borderLeft[n],borderRight:s.borderRight[n]})}}),i}function Xn(e){let n;for(;e.hasNode(n=C("_root")););return n}function ae(e,n,t){let r={},o;t.forEach(i=>{let a=e.parent(i),s,d;for(;a;){if(s=e.parent(a),s?(d=r[s],r[s]=a):(d=o,o=a),d&&d!==a){n.setEdge(d,a);return}a=s}})}function W(e,n={}){if(typeof n.customOrder=="function"){n.customOrder(e,W);return}let t=q(e),r=He(e,k(1,t+1),"inEdges"),o=He(e,k(t-1,-1,-1),"outEdges"),i=ee(e);if(qe(e,i),n.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,s,d=n.constraints||[];for(let l=0,u=0;u<4;++l,++u){Un(l%2?r:o,l%4>=2,d),i=G(e);let c=ne(e,i);c<a?(u=0,s=Object.assign({},i),a=c):c===a&&(s=structuredClone(i))}qe(e,s)}function He(e,n,t){let r=new Map,o=(i,a)=>{r.has(i)||r.set(i,[]),r.get(i).push(a)};for(let i of e.nodes()){let a=e.node(i);if(typeof a.rank=="number"&&o(a.rank,i),typeof a.minRank=="number"&&typeof a.maxRank=="number")for(let s=a.minRank;s<=a.maxRank;s++)s!==a.rank&&o(s,i)}return n.map(function(i){return ie(e,i,t,r.get(i)||[])})}function Un(e,n,t){let r=new p.Graph;e.forEach(function(o){t.forEach(s=>r.setEdge(s.left,s.right));let i=o.graph().root,a=V(o,i,r,n);a.vs.forEach((s,d)=>o.node(s).order=d),ae(o,r,a.vs)})}function qe(e,n){Object.values(n).forEach(t=>t.forEach((r,o)=>e.node(r).order=o))}function Kn(e,n){let t={};function r(o,i){let a=0,s=0,d=o.length,l=i[i.length-1];return i.forEach((u,c)=>{let f=Qn(e,u),b=f?e.node(f).order:d;(f||u===l)&&(i.slice(s,c+1).forEach(g=>{let h=e.predecessors(g);h&&h.forEach(m=>{let L=e.node(m),y=L.order;(y<a||b<y)&&!(L.dummy&&e.node(g).dummy)&&ze(t,m,g)})}),s=c+1,a=b)}),i}return n.length&&n.reduce(r),t}function Jn(e,n){let t={};function r(i,a,s,d,l){k(a,s).forEach(u=>{let c=i[u];if(c!==void 0&&e.node(c).dummy){let f=e.predecessors(c);f&&f.forEach(b=>{if(b===void 0)return;let g=e.node(b);g.dummy&&(g.order<d||g.order>l)&&ze(t,b,c)})}})}function o(i,a){let s=-1,d=-1,l=0;return a.forEach((u,c)=>{if(e.node(u).dummy==="border"){let f=e.predecessors(u);if(f&&f.length){let b=f[0];if(b===void 0)return;d=e.node(b).order,r(a,l,c,s,d),l=c,s=d}}r(a,l,a.length,d,i.length)}),a}return n.length&&n.reduce(o),t}function Qn(e,n){if(e.node(n).dummy){let t=e.predecessors(n);if(t)return t.find(r=>e.node(r).dummy)}}function ze(e,n,t){if(n>t){let o=n;n=t,t=o}let r=e[n];r||(e[n]=r={}),r[t]=!0}function Zn(e,n,t){if(n>t){let o=n;n=t,t=o}let r=e[n];return r!==void 0&&Object.hasOwn(r,t)}function $n(e,n,t,r){let o={},i={},a={};return n.forEach(s=>{s.forEach((d,l)=>{o[d]=d,i[d]=d,a[d]=l})}),n.forEach(s=>{let d=-1;s.forEach(l=>{let u=r(l);if(u&&u.length){let c=u.sort((b,g)=>{let h=a[b],m=a[g];return(h!==void 0?h:0)-(m!==void 0?m:0)}),f=(c.length-1)/2;for(let b=Math.floor(f),g=Math.ceil(f);b<=g;++b){let h=c[b];if(h===void 0)continue;let m=a[h];if(m!==void 0&&i[l]===l&&d<m&&!Zn(t,l,h)){let L=o[h];L!==void 0&&(i[h]=l,i[l]=o[l]=L,d=m)}}}})}),{root:o,align:i}}function et(e,n,t,r,o=!1){let i={},a=nt(e,n,t,o),s=o?"borderLeft":"borderRight";function d(b,g){let h=a.nodes().slice(),m={},L=h.pop();for(;L;){if(m[L])b(L);else{m[L]=!0,h.push(L);for(let y of g(L))h.push(y)}L=h.pop()}}function l(b){let g=a.inEdges(b);g?i[b]=g.reduce((h,m)=>{var P;let L=(P=i[m.v])!=null?P:0,y=a.edge(m);return Math.max(h,L+(y!==void 0?y:0))},0):i[b]=0}function u(b){let g=a.outEdges(b),h=Number.POSITIVE_INFINITY;g&&(h=g.reduce((L,y)=>{let P=i[y.w],le=a.edge(y);return Math.min(L,(P!==void 0?P:0)-(le!==void 0?le:0))},Number.POSITIVE_INFINITY));let m=e.node(b);h!==Number.POSITIVE_INFINITY&&m.borderType!==s&&(i[b]=Math.max(i[b]!==void 0?i[b]:0,h))}function c(b){return a.predecessors(b)||[]}function f(b){return a.successors(b)||[]}return d(l,c),d(u,f),Object.keys(r).forEach(b=>{var h;let g=t[b];g!==void 0&&(i[b]=(h=i[g])!=null?h:0)}),i}function nt(e,n,t,r){let o=new p.Graph,i=e.graph(),a=it(i.nodesep,i.edgesep,r);return n.forEach(s=>{let d;s.forEach(l=>{let u=t[l];if(u!==void 0){if(o.setNode(u),d!==void 0){let c=t[d];if(c!==void 0){let f=o.edge(c,u);o.setEdge(c,u,Math.max(a(e,l,d),f||0))}}d=l}})}),o}function tt(e,n){return Object.values(n).reduce((t,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,d])=>{let l=at(e,s)/2;o=Math.max(d+l,o),i=Math.min(d-l,i)});let a=o-i;return a<t[0]&&(t=[a,r]),t},[Number.POSITIVE_INFINITY,null])[1]}function rt(e,n){let t=Object.values(n),r=E(Math.min,t),o=E(Math.max,t);["u","d"].forEach(i=>{["l","r"].forEach(a=>{let s=i+a,d=e[s];if(!d||d===n)return;let l=Object.values(d),u=r-E(Math.min,l);a!=="l"&&(u=o-E(Math.max,l)),u&&(e[s]=R(d,c=>c+u))})})}function ot(e,n=void 0){let t=e.ul;return t?R(t,(r,o)=>{var a,s;if(n){let d=n.toLowerCase(),l=e[d];if(l&&l[o]!==void 0)return l[o]}let i=Object.values(e).map(d=>{let l=d[o];return l!==void 0?l:0}).sort((d,l)=>d-l);return(((a=i[1])!=null?a:0)+((s=i[2])!=null?s:0))/2}):{}}function Xe(e){let n=G(e),t=Object.assign(Kn(e,n),Jn(e,n)),r={},o;["u","d"].forEach(a=>{o=a==="u"?n:Object.values(n).reverse(),["l","r"].forEach(s=>{s==="r"&&(o=o.map(c=>Object.values(c).reverse()));let l=$n(e,o,t,c=>(a==="u"?e.predecessors(c):e.successors(c))||[]),u=et(e,o,l.root,l.align,s==="r");s==="r"&&(u=R(u,c=>-c)),r[a+s]=u})});let i=tt(e,r);return rt(r,i),ot(r,e.graph().align)}function it(e,n,t){return(r,o,i)=>{let a=r.node(o),s=r.node(i),d=0,l;if(d+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":l=-a.width/2;break;case"r":l=a.width/2;break}if(l&&(d+=t?l:-l),l=void 0,d+=(a.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":l=s.width/2;break;case"r":l=-s.width/2;break}return l&&(d+=t?l:-l),d}}function at(e,n){return e.node(n).width}function Ue(e){e=_(e),st(e),Object.entries(Xe(e)).forEach(([n,t])=>e.node(n).x=t)}function st(e){let n=G(e),t=e.graph(),r=t.ranksep,o=t.rankalign,i=0;n.forEach(a=>{let s=a.reduce((d,l)=>{var c;let u=(c=e.node(l).height)!=null?c:0;return d>u?d:u},0);a.forEach(d=>{let l=e.node(d);o==="top"?l.y=i+l.height/2:o==="bottom"?l.y=i+s-l.height/2:l.y=i+s/2}),i+=s+r})}function B(e,n={}){let t=n.debugTiming?S:I;return t("layout",()=>{let r=t(" buildLayoutGraph",()=>mt(e));return t(" runLayout",()=>dt(r,t,n)),t(" updateInputGraph",()=>lt(e,r)),r})}function dt(e,n,t){n(" makeSpaceForEdgeLabels",()=>Lt(e)),n(" removeSelfEdges",()=>Tt(e)),n(" acyclic",()=>ye(e)),n(" nestingGraph.run",()=>Ce(e)),n(" rank",()=>Se(_(e))),n(" injectEdgeLabelProxies",()=>Et(e)),n(" removeEmptyRanks",()=>he(e)),n(" nestingGraph.cleanup",()=>_e(e)),n(" normalizeRanks",()=>fe(e)),n(" assignRankMinMax",()=>yt(e)),n(" removeEdgeLabelProxies",()=>Nt(e)),n(" normalize.run",()=>Ge(e)),n(" parentDummyChains",()=>Ie(e)),n(" addBorderSegments",()=>Ae(e)),n(" order",()=>W(e,t)),n(" insertSelfEdges",()=>Ot(e)),n(" adjustCoordinateSystem",()=>We(e)),n(" position",()=>Ue(e)),n(" positionSelfEdges",()=>Rt(e)),n(" removeBorderNodes",()=>vt(e)),n(" normalize.undo",()=>we(e)),n(" fixupEdgeLabelCoords",()=>kt(e)),n(" undoCoordinateSystem",()=>Be(e)),n(" translateGraph",()=>Gt(e)),n(" assignNodeIntersects",()=>wt(e)),n(" reversePoints",()=>xt(e)),n(" acyclic.undo",()=>Ne(e))}function lt(e,n){e.nodes().forEach(t=>{let r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,n.children(t).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(t=>{let r=e.edge(t),o=n.edge(t);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var ut=["nodesep","edgesep","ranksep","marginx","marginy"],ct={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},bt=["acyclicer","ranker","rankdir","align","rankalign"],ft=["width","height","rank"],Ke={width:0,height:0},ht=["minlen","weight","width","height","labeloffset"],gt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},pt=["labelpos"];function mt(e){let n=new p.Graph({multigraph:!0,compound:!0}),t=de(e.graph());return n.setGraph(Object.assign({},ct,se(t,ut),O(t,bt))),e.nodes().forEach(r=>{let o=de(e.node(r)),i=se(o,ft);Object.keys(Ke).forEach(s=>{i[s]===void 0&&(i[s]=Ke[s])}),n.setNode(r,i);let a=e.parent(r);a!==void 0&&n.setParent(r,a)}),e.edges().forEach(r=>{let o=de(e.edge(r));n.setEdge(r,Object.assign({},gt,se(o,ht),O(o,pt)))}),n}function Lt(e){let n=e.graph();n.ranksep/=2,e.edges().forEach(t=>{let r=e.edge(t);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Et(e){e.edges().forEach(n=>{let t=e.edge(n);if(t.width&&t.height){let r=e.node(n.v),i={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};N(e,"edge-proxy",i,"_ep")}})}function yt(e){let n=0;e.nodes().forEach(t=>{let r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Math.max(n,r.maxRank))}),e.graph().maxRank=n}function Nt(e){e.nodes().forEach(n=>{let t=e.node(n);if(t.dummy==="edge-proxy"){let r=t;e.edge(r.e).labelRank=t.rank,e.removeNode(n)}})}function Gt(e){let n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,s=i.marginy||0;function d(l){let u=l.x,c=l.y,f=l.width,b=l.height;n=Math.min(n,u-f/2),t=Math.max(t,u+f/2),r=Math.min(r,c-b/2),o=Math.max(o,c+b/2)}e.nodes().forEach(l=>d(e.node(l))),e.edges().forEach(l=>{let u=e.edge(l);Object.hasOwn(u,"x")&&d(u)}),n-=a,r-=s,e.nodes().forEach(l=>{let u=e.node(l);u.x-=n,u.y-=r}),e.edges().forEach(l=>{let u=e.edge(l);u.points.forEach(c=>{c.x-=n,c.y-=r}),Object.hasOwn(u,"x")&&(u.x-=n),Object.hasOwn(u,"y")&&(u.y-=r)}),i.width=t-n+a,i.height=o-r+s}function wt(e){e.edges().forEach(n=>{let t=e.edge(n),r=e.node(n.v),o=e.node(n.w),i,a;t.points?(i=t.points[0],a=t.points[t.points.length-1]):(t.points=[],i=o,a=r),t.points.unshift(Y(r,i)),t.points.push(Y(o,a))})}function kt(e){e.edges().forEach(n=>{let t=e.edge(n);if(Object.hasOwn(t,"x"))switch((t.labelpos==="l"||t.labelpos==="r")&&(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset;break}})}function xt(e){e.edges().forEach(n=>{let t=e.edge(n);t.reversed&&t.points.reverse()})}function vt(e){e.nodes().forEach(n=>{if(e.children(n).length){let t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(t.borderLeft[t.borderLeft.length-1]),a=e.node(t.borderRight[t.borderRight.length-1]);t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}}),e.nodes().forEach(n=>{e.node(n).dummy==="border"&&e.removeNode(n)})}function Tt(e){e.edges().forEach(n=>{if(n.v===n.w){let t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function Ot(e){G(e).forEach(t=>{let r=0;t.forEach((o,i)=>{let a=e.node(o);a.order=i+r,(a.selfEdges||[]).forEach(s=>{N(e,"selfedge",{width:s.label.width,height:s.label.height,rank:a.rank,order:i+ ++r,e:s.e,label:s.label},"_se")}),delete a.selfEdges})})}function Rt(e){e.nodes().forEach(n=>{let t=e.node(n);if(t.dummy==="selfedge"){let r=t,o=e.node(r.e.v),i=o.x+o.width/2,a=o.y,s=t.x-i,d=o.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:i+2*s/3,y:a-d},{x:i+5*s/6,y:a-d},{x:i+s,y:a},{x:i+5*s/6,y:a+d},{x:i+2*s/3,y:a+d}],r.label.x=t.x,r.label.y=t.y}})}function se(e,n){return R(O(e,n),Number)}function de(e){let n={};return e&&Object.entries(e).forEach(([t,r])=>{typeof t=="string"&&(t=t.toLowerCase()),n[t]=r}),n}function D(e){let n=G(e),t=new p.Graph({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{t.setNode(r,{label:r}),t.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>t.setEdge(r.v,r.w,{},r.name)),n.forEach((r,o)=>{let i="layer"+o;t.setNode(i,{rank:"same"}),r.reduce((a,s)=>(t.setEdge(a,s,{style:"invis"}),s))}),t}var Qe=require("@dagrejs/graphlib");var Pt={time:S,notime:I},Mt={graphlib:Je,version:F,layout:B,debug:D,util:{time:S,notime:I}},St=Mt;0&&(module.exports={Graph,debug,graphlib,layout,util,version});
|
|
2
2
|
/*! For license information please see dagre.cjs.js.LEGAL.txt */
|
|
3
3
|
//# sourceMappingURL=dagre.cjs.js.map
|