@dagrejs/dagre 2.0.4 → 3.1.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 +3049 -2176
- 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 +26 -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 +3 -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 +12 -0
- package/dist/types/lib/order/sort-subgraph.d.ts.map +1 -0
- package/dist/types/lib/order/sort.d.ts +16 -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 +142 -0
- package/dist/types/lib/types.d.ts.map +1 -0
- package/dist/types/lib/util.d.ts +40 -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 Nn=Object.create;var D=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var Gn=Object.getOwnPropertyNames;var xn=Object.getPrototypeOf,kn=Object.prototype.hasOwnProperty;var vn=(e,n,t)=>n in e?D(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var On=(e,n)=>{for(var t in n)D(e,t,{get:n[t],enumerable:!0})},ve=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of Gn(n))!kn.call(e,o)&&o!==t&&D(e,o,{get:()=>n[o],enumerable:!(r=wn(n,o))||r.enumerable});return e};var Tn=(e,n,t)=>(t=e!=null?Nn(xn(e)):{},ve(n||!e||!e.__esModule?D(t,"default",{value:e,enumerable:!0}):t,e)),Rn=e=>ve(D({},"__esModule",{value:!0}),e);var Oe=(e,n,t)=>vn(e,typeof n!="symbol"?n+"":n,t);var Zt={};On(Zt,{Graph:()=>yn.Graph,debug:()=>ne,default:()=>Qt,graphlib:()=>En,layout:()=>ee,util:()=>$t,version:()=>$});module.exports=Rn(Zt);var En=Tn(require("@dagrejs/graphlib"));var v=require("@dagrejs/graphlib");function j(e,n,t,r){let o=r;for(;e.hasNode(o);)o=H(r);return t.dummy=n,e.setNode(o,t),o}function Te(e){let n=new v.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 U(e){let n=new v.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 re(e,n){let t=e.x,r=e.y,o=n.x-t,i=n.y-r,s=e.width/2,a=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let d,u;return Math.abs(i)*s>Math.abs(o)*a?(i<0&&(a=-a),d=a*o/i,u=a):(o<0&&(s=-s),d=s,u=s*i/o),{x:t+d,y:r+u}}function I(e){let n=_(ie(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 Re(e){let n=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),t=T(Math.min,n);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=t)})}function Ce(e){let n=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),t=T(Math.min,n),r=[];e.nodes().forEach(s=>{let a=e.node(s).rank-t;r[a]||(r[a]=[]),r[a].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,a)=>{s===void 0&&a%i!==0?--o:s!==void 0&&o&&s.forEach(d=>e.node(d).rank+=o)})}function oe(e,n,t,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),j(e,"border",o,n)}function Cn(e,n=Se){let t=[];for(let r=0;r<e.length;r+=n){let o=e.slice(r,r+n);t.push(o)}return t}var Se=65535;function T(e,n){if(n.length>Se){let t=Cn(n);return e(...t.map(r=>e(...r)))}else return e(...n)}function ie(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MIN_VALUE:o});return T(Math.max,t)}function Me(e,n){let t={lhs:[],rhs:[]};return e.forEach(r=>{n(r)?t.lhs.push(r):t.rhs.push(r)}),t}function se(e,n){let t=Date.now();try{return n()}finally{console.log(e+" time: "+(Date.now()-t)+"ms")}}function X(e,n){return n()}var Sn=0;function H(e){let n=++Sn;return e+(""+n)}function _(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 B(e,n){let t={};for(let r of n)e[r]!==void 0&&(t[r]=e[r]);return t}function W(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 je(e,n){return e.reduce((t,r,o)=>(t[r]=n[o],t),{})}var V="\0";function J(e,n,t){var u,l,c,g,f,p;if(!(e&&n&&t&&n.dummy==="edge"&&t.dummy==="edge"&&n.edgeObj&&t.edgeObj&&e[n.edgeObj.v]&&e[t.edgeObj.v]&&e[n.edgeObj.w]&&e[t.edgeObj.w]))return 0;let r=!0;n.edgeObj.w===t.edgeObj.w&&(r=!1);let o=r?(l=(u=e[n.edgeObj.v])==null?void 0:u.rank)!=null?l:NaN+1:(g=(c=e[n.edgeObj.w])==null?void 0:c.rank)!=null?g:NaN-1,i=Object.entries(e).find(L=>{var b,h;return((b=L[1].edgeObj)==null?void 0:b.v)===n.edgeObj.v&&((h=L[1].edgeObj)==null?void 0:h.w)===n.edgeObj.w&&L[1].rank===o}),s=Object.entries(e).find(L=>{var b,h;return((b=L[1].edgeObj)==null?void 0:b.v)===t.edgeObj.v&&((h=L[1].edgeObj)==null?void 0:h.w)===t.edgeObj.w&&L[1].rank===o});if(!i||!s)return 0;let a=(f=i[1].order)!=null?f:NaN,d=(p=s[1].order)!=null?p:NaN;return isNaN(a-d)?0:a-d}var $="3.1.0";var ae=class{constructor(){Oe(this,"_sentinel");let n={};n._next=n._prev=n,this._sentinel=n}dequeue(){let n=this._sentinel,t=n._prev;if(t!==n)return Ie(t),t}enqueue(n){let t=this._sentinel;n._prev&&n._next&&Ie(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,Mn)),r=r._prev;return"["+n.join(", ")+"]"}};function Ie(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Mn(e,n){if(e!=="_next"&&e!=="_prev")return n}var Pe=ae;var jn=()=>1;function ue(e,n){if(e.nodeCount()<=1)return[];let t=Pn(e,n||jn);return In(t.graph,t.buckets,t.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w)||[])}function In(e,n,t){var a;let r=[],o=n[n.length-1],i=n[0],s;for(;e.nodeCount();){for(;s=i.dequeue();)de(e,n,t,s);for(;s=o.dequeue();)de(e,n,t,s);if(e.nodeCount()){for(let d=n.length-2;d>0;--d)if(s=(a=n[d])==null?void 0:a.dequeue(),s){r=r.concat(de(e,n,t,s,!0)||[]);break}}}return r}function de(e,n,t,r,o){let i=[],s=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(a=>{let d=e.edge(a),u=e.node(a.v);o&&i.push({v:a.v,w:a.w}),u.out-=d,le(n,t,u)}),(e.outEdges(r.v)||[]).forEach(a=>{let d=e.edge(a),u=a.w,l=e.node(u);l.in-=d,le(n,t,l)}),e.removeNode(r.v),s}function Pn(e,n){let t=new v.Graph,r=0,o=0;e.nodes().forEach(a=>{t.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let d=t.edge(a.v,a.w)||0,u=n(a),l=d+u;t.setEdge(a.v,a.w,l);let c=t.node(a.v),g=t.node(a.w);o=Math.max(o,c.out+=u),r=Math.max(r,g.in+=u)});let i=_n(o+r+3).map(()=>new Pe),s=r+1;return t.nodes().forEach(a=>{le(i,s,t.node(a))}),{graph:t,buckets:i,zeroIdx:s}}function le(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 _n(e){let n=[];for(let t=0;t<e;t++)n.push(t);return n}function _e(e,n){(e.graph().acyclicer==="greedy"?ue(e,r(e)):Fn(e,n!=null?n:null)).forEach(o=>{let i=e.edge(o);e.removeEdge(o),i.forwardName=o.name,i.reversed=!0,e.setEdge(o.w,o.v,i,H("rev"))});function r(o){return i=>o.edge(i).weight}}function Fn(e,n){let t=[],r={},o={};function i(d){Object.hasOwn(o,d)||(o[d]=!0,r[d]=!0,e.outEdges(d).forEach(u=>{Object.hasOwn(r,u.w)?t.push(u):i(u.w)}),delete r[d])}function s(d){var u;Object.hasOwn(o,d)||(o[d]=!0,r[d]=!0,(u=e.outEdges(d))==null||u.forEach(l=>{var c,g;Object.hasOwn(r,l.w)||((c=n.node(d))==null?void 0:c.rank)>((g=n.node(l.w))==null?void 0:g.rank)&&An(e,l.w,l)?t.push(l):s(l.w)}),delete r[d])}let a=i;return n&&typeof n.node=="function"&&(a=s),e.sources().forEach(a),e.nodes().forEach(a),t}function Fe(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 An(e,n,t){let r=new Set;function o(i){var s;if(e.sources().includes(i))return!0;r.add(i);for(let a of(s=e.inEdges(i))!=null?s:[])if(!(a.v===t.v&&a.w===t.w)&&!r.has(a.v)&&o(a.v))return!0;return!1}return o(n)}function Ae(e){e.graph().dummyChains=[],e.edges().forEach(n=>Yn(e,n))}function Yn(e,n){let t=n.v,r=e.node(t).rank,o=n.w,i=e.node(o).rank,s=n.name,a=e.edge(n),d=a.labelRank;if(i===r+1)return;e.removeEdge(n);let u,l,c;for(c=0,++r;r<i;++c,++r)a.points=[],l={width:0,height:0,edgeLabel:a,edgeObj:n,rank:r},u=j(e,"edge",l,"_d"),r===d&&(l.width=a.width,l.height=a.height,l.dummy="edge-label",l.labelpos=a.labelpos),e.setEdge(t,u,{weight:a.weight},s),c===0&&e.graph().dummyChains.push(u),t=u;e.setEdge(t,o,{weight:a.weight},s)}function Ve(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 q(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),s=i?i.map(d=>d==null?Number.POSITIVE_INFINITY:t(d.w)-e.edge(d).minlen):[],a=T(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),o.rank=a}e.sources().forEach(t)}function F(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}var K=Wn;function Wn(e){let n=new v.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,s;for(;Dn(n,e)<o&&(i=Xn(n,e),!!i);)s=n.hasNode(i.v)?F(e,i):-F(e,i),Hn(n,e,s);return n}function Dn(e,n){function t(r){let o=n.nodeEdges(r);o&&o.forEach(i=>{let s=i.v,a=r===s?i.w:s;!e.hasNode(a)&&!F(n,i)&&(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))})}return e.nodes().forEach(t),e.nodeCount()}function Xn(e,n){return n.edges().reduce((r,o)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(i=F(n,o)),i<r[0]?[i,o]:r},[Number.POSITIVE_INFINITY,null])[1]}function Hn(e,n,t){e.nodes().forEach(r=>n.node(r).rank+=t)}var{preorder:qn,postorder:zn}=v.alg,Be=Y;Y.initLowLimValues=be;Y.initCutValues=ce;Y.calcCutValue=We;Y.leaveEdge=Xe;Y.enterEdge=He;Y.exchangeEdges=qe;function Y(e){e=Te(e),q(e);let n=K(e);be(n),ce(n,e);let t,r;for(;t=Xe(n);)r=He(n,e,t),qe(n,e,t,r)}function ce(e,n){let t=zn(e,e.nodes());t=t.slice(0,t.length-1),t.forEach(r=>Un(e,n,r))}function Un(e,n,t){let o=e.node(t).parent,i=e.edge(t,o);i.cutvalue=We(e,n,t)}function We(e,n,t){let o=e.node(t).parent,i=!0,s=n.edge(t,o),a=0;s||(i=!1,s=n.edge(o,t)),a=s.weight;let d=n.nodeEdges(t);return d&&d.forEach(u=>{let l=u.v===t,c=l?u.w:u.v;if(c!==o){let g=l===i,f=n.edge(u).weight;if(a+=g?f:-f,$n(e,t,c)){let L=e.edge(t,c).cutvalue;a+=g?-L:L}}}),a}function be(e,n){arguments.length<2&&(n=e.nodes()[0]),De(e,{},1,n)}function De(e,n,t,r,o){let i=t,s=e.node(r);n[r]=!0;let a=e.neighbors(r);return a&&a.forEach(d=>{Object.hasOwn(n,d)||(t=De(e,n,t,d,r))}),s.low=i,s.lim=t++,o?s.parent=o:delete s.parent,t}function Xe(e){return e.edges().find(n=>e.edge(n).cutvalue<0)}function He(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),s=e.node(o),a=i,d=!1;return i.lim>s.lim&&(a=s,d=!0),n.edges().filter(l=>d===Ye(e,e.node(l.v),a)&&d!==Ye(e,e.node(l.w),a)).reduce((l,c)=>F(n,c)<F(n,l)?c:l)}function qe(e,n,t,r){let o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),be(e),ce(e,n),Jn(e,n)}function Jn(e,n){let t=e.nodes().find(o=>!e.node(o).parent);if(!t)return;let r=qn(e,[t]);r=r.slice(1),r.forEach(o=>{let s=e.node(o).parent,a=n.edge(o,s),d=!1;a||(a=n.edge(s,o),d=!0),n.node(o).rank=n.node(s).rank+(d?a.minlen:-a.minlen)})}function $n(e,n,t){return e.hasEdge(n,t)}function Ye(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}var Ue=Kn;function Kn(e){let n=e.graph().ranker;if(typeof n=="function")return n(e);switch(n){case"network-simplex":ze(e);break;case"tight-tree":Zn(e);break;case"longest-path":Qn(e);break;case"none":break;default:ze(e)}}var Qn=q;function Zn(e){q(e),K(e)}function ze(e){Be(e)}var Je=et;function et(e){let n=tt(e),t=e.graph();if(!Array.isArray(t.dummyChains))return;t.dummyChains.forEach(o=>{let i=e.node(o),s=i.edgeObj,a=nt(e,n,s.v,s.w),d=a.path,u=a.lca,l=0,c=d[l],g=!0;for(;o!==s.w;){if(i=e.node(o),g){for(;(c=d[l])!==u&&e.node(c).maxRank<i.rank;)l++;c===u&&(g=!1)}if(!g){for(;l<d.length-1&&e.node(d[l+1]).minRank<=i.rank;)l++;c=d[l]}c!==void 0&&e.setParent(o,c),o=e.successors(o)[0]}})}function nt(e,n,t,r){let o=[],i=[],s=Math.min(n[t].low,n[r].low),a=Math.max(n[t].lim,n[r].lim),d;d=t;do d=e.parent(d),o.push(d);while(d&&(n[d].low>s||a>n[d].lim));let u=d,l=r;for(;(l=e.parent(l))!==u;)i.push(l);return{path:o.concat(i.reverse()),lca:u}}function tt(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 $e(e){let n=j(e,"root",{},"_root"),t=rt(e),r=Object.values(t),o=T(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=n,e.edges().forEach(a=>e.edge(a).minlen*=i);let s=ot(e)+1;e.children(V).forEach(a=>{Ke(e,n,i,s,o,t,a)}),e.graph().nodeRankFactor=i}function Ke(e,n,t,r,o,i,s){var c;let a=e.children(s);if(!a.length){s!==n&&e.setEdge(n,s,{weight:0,minlen:t});return}let d=oe(e,"_bt"),u=oe(e,"_bb"),l=e.node(s);e.setParent(d,s),l.borderTop=d,e.setParent(u,s),l.borderBottom=u,a.forEach(g=>{var m;Ke(e,n,t,r,o,i,g);let f=e.node(g),p=f.borderTop?f.borderTop:g,L=f.borderBottom?f.borderBottom:g,b=f.borderTop?r:2*r,h=p!==L?1:o-((m=i[s])!=null?m:0)+1;e.setEdge(d,p,{weight:b,minlen:h,nestingEdge:!0}),e.setEdge(L,u,{weight:b,minlen:h,nestingEdge:!0})}),e.parent(s)||e.setEdge(n,d,{weight:0,minlen:o+((c=i[s])!=null?c:0)})}function rt(e){let n={};function t(r,o){let i=e.children(r);i&&i.length&&i.forEach(s=>t(s,o+1)),n[r]=o}return e.children(V).forEach(r=>t(r,1)),n}function ot(e){return e.edges().reduce((n,t)=>n+e.edge(t).weight,0)}function Qe(e){let n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var en=st;function st(e){function n(t){let r=e.children(t),o=e.node(t);if(r.length&&r.forEach(n),o&&Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)Ze(e,"borderLeft","_bl",t,o,i),Ze(e,"borderRight","_br",t,o,i)}}e.children(V).forEach(n)}function Ze(e,n,t,r,o,i){let s={width:0,height:0,rank:i,borderType:n},a=o[n][i-1],d=j(e,"border",s,t);o[n][i]=d,e.setParent(d,r),a&&e.setEdge(a,d,{weight:1})}function tn(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&on(e)}function rn(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&at(e),(n==="lr"||n==="rl")&&(dt(e),on(e))}function on(e){e.nodes().forEach(n=>nn(e.node(n))),e.edges().forEach(n=>nn(e.edge(n)))}function nn(e){let n=e.width;e.width=e.height,e.height=n}function at(e){e.nodes().forEach(n=>fe(e.node(n))),e.edges().forEach(n=>{var r;let t=e.edge(n);(r=t.points)==null||r.forEach(fe),Object.hasOwn(t,"y")&&fe(t)})}function fe(e){e.y=-e.y}function dt(e){e.nodes().forEach(n=>he(e.node(n))),e.edges().forEach(n=>{var r;let t=e.edge(n);(r=t.points)==null||r.forEach(he),Object.hasOwn(t,"x")&&he(t)})}function he(e){let n=e.x;e.x=e.y,e.y=n}function ge(e,n=null){let t={},r=e.nodes().filter(l=>!e.children(l).length),o=r.map(l=>e.node(l).rank),i=T(Math.max,o),s=_(i+1).map(()=>[]);function a(l){if(t[l])return;t[l]=!0;let c=e.node(l);s[c.rank].push(l);let g=e.successors(l);g&&[...g].sort((p,L)=>u(p,L)).forEach(a)}r.sort((l,c)=>e.node(l).rank-e.node(c).rank).forEach(a);function u(l,c){let g=e.node(l),f=e.node(c);return J(n,g,f)}return s}function me(e,n){let t=0;for(let r=1;r<n.length;++r)t+=ut(e,n[r-1],n[r]);return t}function ut(e,n,t){let r=je(t,t.map((u,l)=>l)),o=n.flatMap(u=>{let l=e.outEdges(u);return l?l.map(c=>({pos:r[c.w],weight:e.edge(c).weight})).sort((c,g)=>c.pos-g.pos):[]}),i=1;for(;i<t.length;)i<<=1;let s=2*i-1;i-=1;let a=new Array(s).fill(0),d=0;return o.forEach(u=>{let l=u.pos+i;a[l]+=u.weight;let c=0;for(;l>0;)l%2&&(c+=a[l+1]),l=l-1>>1,a[l]+=u.weight;d+=u.weight*c}),d}function pe(e,n=[]){return n.map(t=>{let r=e.inEdges(t);if(!r||!r.length)return{v:t};{let o=r.reduce((i,s)=>{let a=e.edge(s),d=e.node(s.v);return{sum:i.sum+a.weight*d.order,weight:i.weight+a.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}})}function Le(e,n){let t={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),t[o.v]=s}),n.edges().forEach(o=>{let i=t[o.v],s=t[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let r=Object.values(t).filter(o=>!o.indegree);return ct(r)}function ct(e){let n=[];function t(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&bt(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=>B(o,["vs","i","barycenter","weight"]))}function bt(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 Ee(e,n,t,r,o){let i={},s=null,a=null,d=o;typeof n=="boolean"?(d=n,i={}):n&&(i=n,s=t!=null?t:null,a=r!=null?r:null);let u=Me(e,h=>Object.hasOwn(h,"barycenter")),l=u.lhs,c=u.rhs.sort((h,m)=>m.i-h.i),g=[],f=0,p=0,L=0;l.sort(ft(a,s,!!d));for(let[h,m]of Object.entries(i)){let N=l.findIndex(x=>x.vs[0]===h);l.splice(N+1,0,m)}L=sn(g,c,L),l.forEach(h=>{L+=h.vs.length,g.push(h.vs),f+=h.barycenter*h.weight,p+=h.weight,L=sn(g,c,L)});let b={vs:g.flat(1)};return p&&(b.barycenter=f/p,b.weight=p),b}function sn(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 ft(e,n,t){return(r,o)=>{if(r.barycenter<o.barycenter)return-1;if(r.barycenter>o.barycenter)return 1;if(e&&(typeof r.vs[0]=="string"||typeof o.vs[0]=="string")){let i=e.node(r.vs[0]),s=e.node(o.vs[0]),a=J(n,i,s);if(a!==0)return a}return t?o.i-r.i:r.i-o.i}}function Q(e,n,t,r,o){var h,m,N,x,w,G,O,R,C,M,S;let i=null,s=o;typeof r=="boolean"?(s=r,i=null):r!==void 0&&(i=r);let a=e.children(n),d=e.node(n),u=d?d.borderLeft:void 0,l=d?d.borderRight:void 0,c={};u&&(a=a.filter(y=>y!==u&&y!==l));let g=pe(e,a);g.forEach(y=>{if(e.children(y.v).length){let{result:E}=Q(e,y.v,t,i,s);c[y.v]=E,Object.hasOwn(E,"barycenter")&>(y,E)}});let f=Le(g,t);ht(f,c);let p={},L=!1;for(let y=0;y<f.length;y++)for(let E=y+1;E<f.length;E++)if(!(!f[y]||!f[E]||!((h=f[y])!=null&&h.barycenter)||!((m=f[E])!=null&&m.barycenter))&&((N=f[y])==null?void 0:N.barycenter)===f[E].barycenter){let k=(w=(x=f[y])==null?void 0:x.vs[0])!=null?w:"",A=(O=(G=f[E])==null?void 0:G.vs[0])!=null?O:"",z=e.node(k),te=e.node(A);if(z.dummy==="edge"&&te.dummy==="edge"&&((R=z.edgeObj)==null?void 0:R.v)===((C=te.edgeObj)==null?void 0:C.v)&&((M=z.edgeObj)==null?void 0:M.w)===((S=te.edgeObj)==null?void 0:S.w))if(z.edgeLabel.reversed){p[A]=f[y],f.splice(y,1),y--;break}else p[k]=f[E],f.splice(E,1),E--;else L=!0}let b=Ee(f,p,i,e,s);if(u&&l){b.vs=[u,b.vs,l].flat(1);let y=e.predecessors(u);if(y&&y.length){let E=e.node(y[0]),k=e.predecessors(l),A=e.node(k[0]);Object.hasOwn(b,"barycenter")||(b.barycenter=0,b.weight=0),b.barycenter=(b.barycenter*b.weight+E.order+A.order)/(b.weight+2),b.weight+=2}}return Object.defineProperty(b,"result",{value:b,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(b,"usedBias",{value:L,enumerable:!1,configurable:!0,writable:!0}),b}function ht(e,n){e.forEach(t=>{t.vs=t.vs.flatMap(r=>n[r]?n[r].vs:r)})}function gt(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 ye(e,n,t,r){r||(r=e.nodes());let o=mt(e),i=new v.Graph({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let a=e.node(s),d=e.parent(s);if(a.rank===n||a.minRank<=n&&n<=a.maxRank){i.setNode(s),i.setParent(s,d||o);let u=e[t](s);u&&u.forEach(l=>{let c=l.v===s?l.w:l.v,g=i.edge(c,s),f=g!==void 0?g.weight:0;i.setEdge(c,s,{weight:e.edge(l).weight+f})}),Object.hasOwn(a,"minRank")&&i.setNode(s,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]})}}),i}function mt(e){let n;for(;e.hasNode(n=H("_root")););return n}function Ne(e,n,t){let r={},o;t.forEach(i=>{let s=e.parent(i),a,d;for(;s;){if(a=e.parent(s),a?(d=r[a],r[a]=s):(d=o,o=s),d&&d!==s){n.setEdge(d,s);return}s=a}})}function Z(e,n={},t=null){if(typeof n.customOrder=="function"){n.customOrder(e,Z);return}let r=ie(e),o=an(e,_(1,r+1),"inEdges"),i=an(e,_(r-1,-1,-1),"outEdges"),s=ge(e,t);if(dn(e,s),n.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,d,u=n.constraints||[];for(let l=0,c=0;c<4;++l,++c){pt(l%2?o:i,l%4>=2,u,t),s=I(e);let g=me(e,s);g<a?(c=0,d=Object.assign({},s),a=g):g===a&&(d=structuredClone(s))}dn(e,d)}function an(e,n,t){let r=new Map,o=(i,s)=>{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&o(a,i)}return n.map(function(i){return ye(e,i,t,r.get(i)||[])})}function pt(e,n,t,r){let o=!0,i=new v.Graph;e.forEach(function(s){t.forEach(l=>i.setEdge(l.left,l.right));let a=s.graph().root,{result:d,usedBias:u}=Q(s,a,i,r,o);n&&u&&(o=!o),d.vs.forEach((l,c)=>s.node(l).order=c),Ne(s,i,d.vs)})}function dn(e,n){Object.values(n).forEach(t=>t.forEach((r,o)=>e.node(r).order=o))}function Lt(e,n){let t={};function r(o,i){let s=0,a=0,d=o.length,u=i[i.length-1];return i.forEach((l,c)=>{let g=yt(e,l),f=g?e.node(g).order:d;(g||l===u)&&(i.slice(a,c+1).forEach(p=>{let L=e.predecessors(p);L&&L.forEach(b=>{let h=e.node(b),m=h.order;(m<s||f<m)&&!(h.dummy&&e.node(p).dummy)&&un(t,b,p)})}),a=c+1,s=f)}),i}return n.length&&n.reduce(r),t}function Et(e,n){let t={};function r(i,s,a,d,u){_(s,a).forEach(l=>{let c=i[l];if(c!==void 0&&e.node(c).dummy){let g=e.predecessors(c);g&&g.forEach(f=>{if(f===void 0)return;let p=e.node(f);p.dummy&&(p.order<d||p.order>u)&&un(t,f,c)})}})}function o(i,s){let a=-1,d=-1,u=0;return s.forEach((l,c)=>{if(e.node(l).dummy==="border"){let g=e.predecessors(l);if(g&&g.length){let f=g[0];if(f===void 0)return;d=e.node(f).order,r(s,u,c,a,d),u=c,a=d}}r(s,u,s.length,d,i.length)}),s}return n.length&&n.reduce(o),t}function yt(e,n){if(e.node(n).dummy){let t=e.predecessors(n);if(t)return t.find(r=>e.node(r).dummy)}}function un(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 Nt(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 wt(e,n,t,r,o){let i={},s={},a={};return n.forEach(d=>{d.forEach((u,l)=>{i[u]=u,s[u]=u,a[u]=l})}),n.forEach(d=>{let u=-1,l=-1,c=!1,g=d,f=d.findIndex(p=>(o==null?void 0:o.includes(p))||ln(p,e,o));f>0&&(g=[d[f],...d.slice(0,f),...d.slice(f+1)],c=!0),g.forEach(p=>{var b;let L=r(p);if(L&&L.length){o!=null&&o.includes(p)&&(L=L.filter(N=>ln(N,e,o)));let h=L.sort((N,x)=>{let w=a[N],G=a[x];return(w!==void 0?w:0)-(G!==void 0?G:0)}),m=(h.length-1)/2;for(let N=Math.floor(m),x=Math.ceil(m);N<=x;++N){let w=h[N];if(w===void 0)continue;let G=a[w];if(G!==void 0&&s[p]===p&&u<G&&a[w]!==l&&!Nt(t,p,w)){let O=i[w];O!==void 0&&(s[w]=p,s[p]=i[p]=O,u=G,c&&(u=-1,l=(b=a[w])!=null?b:-1,c=!1))}}}})}),{root:i,align:s}}function Gt(e,n,t,r,o=!1){let i={},s=xt(e,n,t,o),a=o?"borderLeft":"borderRight";function d(f,p){let L=s.nodes().slice(),b={},h=L.pop();for(;h;){if(b[h])f(h);else{b[h]=!0,L.push(h);for(let m of p(h))L.push(m)}h=L.pop()}}function u(f){let p=s.inEdges(f);p?i[f]=p.reduce((L,b)=>{var N;let h=(N=i[b.v])!=null?N:0,m=s.edge(b);return Math.max(L,h+(m!==void 0?m:0))},0):i[f]=0}function l(f){let p=s.outEdges(f),L=Number.POSITIVE_INFINITY;p&&(L=p.reduce((h,m)=>{let N=i[m.w],x=s.edge(m);return Math.min(h,(N!==void 0?N:0)-(x!==void 0?x:0))},Number.POSITIVE_INFINITY));let b=e.node(f);L!==Number.POSITIVE_INFINITY&&b.borderType!==a&&(i[f]=Math.max(i[f]!==void 0?i[f]:0,L))}function c(f){return s.predecessors(f)||[]}function g(f){return s.successors(f)||[]}return d(u,c),d(l,g),Object.keys(r).forEach(f=>{var L;let p=t[f];p!==void 0&&(i[f]=(L=i[p])!=null?L:0)}),i}function xt(e,n,t,r){let o=new v.Graph,i=e.graph(),s=Tt(i.nodesep,i.edgesep,r);return n.forEach(a=>{let d;a.forEach(u=>{let l=t[u];if(l!==void 0){if(o.setNode(l),d!==void 0){let c=t[d];if(c!==void 0){let g=o.edge(c,l);o.setEdge(c,l,Math.max(s(e,u,d),g||0))}}d=u}})}),o}function kt(e,n){return Object.values(n).reduce((t,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([a,d])=>{let u=Rt(e,a)/2;o=Math.max(d+u,o),i=Math.min(d-u,i)});let s=o-i;return s<t[0]&&(t=[s,r]),t},[Number.POSITIVE_INFINITY,null])[1]}function vt(e,n){let t=Object.values(n),r=T(Math.min,t),o=T(Math.max,t);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let a=i+s,d=e[a];if(!d||d===n)return;let u=Object.values(d),l=r-T(Math.min,u);s!=="l"&&(l=o-T(Math.max,u)),l&&(e[a]=W(d,c=>c+l))})})}function Ot(e,n=void 0){let t=e.ul;return t?W(t,(r,o)=>{var s,a;if(n){let d=n.toLowerCase(),u=e[d];if(u&&u[o]!==void 0)return u[o]}let i=Object.values(e).map(d=>{let u=d[o];return u!==void 0?u:0}).sort((d,u)=>d-u);return(((s=i[1])!=null?s:0)+((a=i[2])!=null?a:0))/2}):{}}function cn(e,n){let t=I(e),r=Object.assign(Lt(e,t),Et(e,t)),o={},i;["u","d"].forEach(a=>{i=a==="u"?t:Object.values(t).reverse(),["l","r"].forEach(d=>{d==="r"&&(i=i.map(g=>Object.values(g).reverse()));let l=wt(e,i,r,g=>(a==="u"?e.predecessors(g):e.successors(g))||[],n),c=Gt(e,i,l.root,l.align,d==="r");d==="r"&&(c=W(c,g=>-g)),o[a+d]=c})});let s=kt(e,o);return vt(o,s),Ot(o,e.graph().align)}function Tt(e,n,t){return(r,o,i)=>{let s=r.node(o),a=r.node(i),d=0,u;if(d+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(d+=t?u:-u),u=void 0,d+=(s.dummy?n:e)/2,d+=(a.dummy?n:e)/2,d+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=a.width/2;break;case"r":u=-a.width/2;break}return u&&(d+=t?u:-u),d}}function Rt(e,n){return e.node(n).width}function ln(e,n,t){var s;if(!t)return!1;let r=(s=n.node(e))==null?void 0:s.edgeObj;if(!r||n.node(e).edgeLabel.reversed)return!1;let o=t.indexOf(r==null?void 0:r.v),i=t.indexOf(r==null?void 0:r.w);return o!==-1&&i!==-1&&o===(i+1)%t.length||o===(i-1)%t.length}function bn(e,n){e=U(e),Ct(e),Object.entries(cn(e,n)).forEach(([t,r])=>e.node(t).x=r)}function Ct(e){let n=I(e),t=e.graph(),r=t.ranksep,o=t.rankalign,i=0;n.forEach(s=>{let a=s.reduce((d,u)=>{var c;let l=(c=e.node(u).height)!=null?c:0;return d>l?d:l},0);s.forEach(d=>{let u=e.node(d);o==="top"?u.y=i+u.height/2:o==="bottom"?u.y=i+a-u.height/2:u.y=i+a/2}),i+=a+r})}var we=null,Ge=null;function ee(e,n={}){return Ln(e,X,n),e}function fn(e,n,t){let r=n;for(;r!==void 0;){let o=e.parent(r);if(o===t)return r;r=o}}function Ln(e,n,t){let r=e.nodes().filter(b=>e.children(b).length),o={};r.forEach(b=>{let h=e.node(b);if(h&&h.rankdir){let m=new v.Graph({multigraph:!0,compound:!0});m.setGraph({rankdir:h.rankdir});let N=e.children(b);N.forEach(y=>{let E={...e.node(y)};m.setNode(y,E);let k=e.parent(y);k&&k!==b&&N.includes(k)&&m.setParent(y,k)});let x=new Set;e.edges().forEach(y=>{let E=fn(e,y.v,b),k=fn(e,y.w,b);if(E&&k&&E!==k){let A=`${E}\0${k}`;x.has(A)||(x.add(A),m.setEdge(E,k,{...e.edge(y)}))}}),Ln(m,n,t);let w=pn(m);hn(w,n,t),gn(m,w);let G=1/0,O=1/0,R=-1/0,C=-1/0;m.nodes().forEach(y=>{if(y===b)return;let E=m.node(y);E&&typeof E.x=="number"&&typeof E.y=="number"&&typeof E.width=="number"&&typeof E.height=="number"&&(G=Math.min(G,E.x-E.width/2),R=Math.max(R,E.x+E.width/2),O=Math.min(O,E.y-E.height/2),C=Math.max(C,E.y+E.height/2))}),(!isFinite(G)||!isFinite(O)||!isFinite(R)||!isFinite(C))&&(G=O=0,R=C=0);let M=R-G,S=C-O;o[b]={minX:G,minY:O,maxX:R,maxY:C,width:M,height:S,offsetX:G,offsetY:O},h._dagreClusterSubgraph=m}});let i=[],s=b=>{let h=[],m=(e.children(b)||[]).filter(N=>N!==b);for(;m.length>0;){let N=m.shift();h.push(N),(e.children(N)||[]).filter(x=>x!==N).forEach(x=>m.push(x))}return h},a=new Map;r.forEach(b=>{let h=e.node(b);h&&h.rankdir&&o[b]&&a.set(b,(e.children(b)||[]).filter(m=>m!==b))});let d=new Set([...a.values()].flat()),u=new Map;a.forEach((b,h)=>{d.has(h)||u.set(h,s(h))});let l=new Set([...u.values()].flat()),c=b=>{for(let[h,m]of u)if(m.includes(b))return h;return b},g=[];e.edges().forEach(b=>{(l.has(b.v)||l.has(b.w))&&g.push({edge:b,label:e.edge(b)})});let f=new Map;l.forEach(b=>{let h=e.parent(b);f.set(b,typeof h=="string"?h:void 0)}),u.forEach((b,h)=>{let m=e.node(h),N=[];b.forEach(G=>{let O=e.node(G);O&&(N.push({id:G,node:O,parent:f.get(G)}),e.removeNode(G))});let x=g.filter(({edge:G})=>b.includes(G.v)||b.includes(G.w)),w=o[h];m&&(i.push({clusterId:h,subgraph:m._dagreClusterSubgraph,bounds:w,children:b,removedNodes:N,removedEdges:x}),m.width=w.width,m.height=w.height)});let p=new Set;g.forEach(({edge:b,label:h})=>{let m=c(b.v),N=c(b.w);if(m!==N&&e.hasNode(m)&&e.hasNode(N)){let x=`${m}\0${N}`;p.has(x)||(p.add(x),e.setEdge(m,N,{...h,width:0,height:0}))}});let L=pn(e);hn(L,n,t),gn(e,L),p.forEach(b=>{let h=b.indexOf("\0"),m=b.slice(0,h),N=b.slice(h+1);e.hasEdge(m,N)&&e.removeEdge(m,N)}),i.forEach(({clusterId:b,subgraph:h,bounds:m,removedNodes:N,removedEdges:x})=>{var M,S;let w=e.node(b),G=(M=w==null?void 0:w.x)!=null?M:0,O=(S=w==null?void 0:w.y)!=null?S:0,R=(m.minX+m.maxX)/2,C=(m.minY+m.maxY)/2;N.forEach(({id:y,node:E,parent:k})=>{e.setNode(y,E),k!==void 0&&e.setParent(y,k)}),x.forEach(({edge:y,label:E})=>{e.setEdge(y,E)}),h.nodes().forEach(y=>{if(y===b)return;let E=h.node(y),k=e.node(y);k&&E&&typeof E.x=="number"&&typeof E.y=="number"&&(k.x=G+(E.x-R),k.y=O+(E.y-C))}),delete w._dagreClusterSubgraph}),r.forEach(b=>{var N,x;let h=e.node(b),m=o[b];if(h&&h.rankdir&&h._dagreClusterSubgraph&&m){let w=h._dagreClusterSubgraph,G=(N=h.x)!=null?N:0,O=(x=h.y)!=null?x:0,R=(m.minX+m.maxX)/2,C=(m.minY+m.maxY)/2;w.nodes().forEach(M=>{if(M===b)return;let S=w.node(M),y=e.node(M);if(y&&S&&typeof S.x=="number"&&typeof S.y=="number"){let E=S.x-R,k=S.y-C;y.x=G+E,y.y=O+k}}),delete h._dagreClusterSubgraph}})}function hn(e,n,t){(t==null?void 0:t.useDynamic)===!1&&(we=null,Ge=null),n(" makeSpaceForEdgeLabels",()=>At(e)),n(" removeSelfEdges",()=>zt(e)),n(" acyclic",()=>_e(e,we)),n(" nestingGraph.run",()=>$e(e)),n(" rank",()=>Ue(U(e))),n(" injectEdgeLabelProxies",()=>Vt(e)),n(" removeEmptyRanks",()=>Ce(e)),n(" nestingGraph.cleanup",()=>Qe(e)),n(" normalizeRanks",()=>Re(e)),n(" assignRankMinMax",()=>Yt(e)),n(" removeEdgeLabelProxies",()=>Bt(e)),n(" normalize.run",()=>Ae(e)),n(" parentDummyChains",()=>Je(e)),n(" addBorderSegments",()=>en(e)),n(" order",()=>Z(e,t,Ge)),n(" insertSelfEdges",()=>Ut(e)),n(" adjustCoordinateSystem",()=>tn(e)),n(" position",()=>bn(e,t.corePath)),n(" positionSelfEdges",()=>Jt(e)),Ge=JSON.parse(JSON.stringify(e._nodes)),n(" removeBorderNodes",()=>qt(e)),n(" normalize.undo",()=>Ve(e)),n(" fixupEdgeLabelCoords",()=>Xt(e)),n(" undoCoordinateSystem",()=>rn(e)),n(" translateGraph",()=>Wt(e)),n(" assignNodeIntersects",()=>Dt(e)),n(" reversePoints",()=>Ht(e)),n(" acyclic.undo",()=>Fe(e)),we=e}function gn(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 St=["nodesep","edgesep","ranksep","marginx","marginy"],Mt={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},jt=["acyclicer","ranker","rankdir","align","rankalign"],It=["width","height","rank"],mn={width:0,height:0},Pt=["minlen","weight","width","height","labeloffset"],_t={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ft=["labelpos"];function pn(e){let n=new v.Graph({multigraph:!0,compound:!0}),t=ke(e.graph());return n.setGraph(Object.assign({},Mt,xe(t,St),B(t,jt))),e.nodes().forEach(r=>{let o=ke(e.node(r)),i=xe(o,It);Object.keys(mn).forEach(a=>{i[a]===void 0&&(i[a]=mn[a])}),n.setNode(r,i);let s=e.parent(r);s!==void 0&&n.setParent(r,s)}),e.edges().forEach(r=>{let o=ke(e.edge(r));n.setEdge(r,Object.assign({},_t,xe(o,Pt),B(o,Ft)))}),n}function At(e){let n=e.graph();n.ranksep/=2,e.edges().forEach(t=>{var o;let r=e.edge(t);r.minlen*=2,((o=r.labelpos)!=null?o:"r").toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Vt(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};j(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 Bt(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 Wt(e){let n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,a=i.marginy||0;function d(u){let l=u.x,c=u.y,g=u.width,f=u.height;n=Math.min(n,l-g/2),t=Math.max(t,l+g/2),r=Math.min(r,c-f/2),o=Math.max(o,c+f/2)}e.nodes().forEach(u=>d(e.node(u))),e.edges().forEach(u=>{let l=e.edge(u);Object.hasOwn(l,"x")&&d(l)}),n-=s,r-=a,e.nodes().forEach(u=>{let l=e.node(u);l.x-=n,l.y-=r}),e.edges().forEach(u=>{let l=e.edge(u);l.points.forEach(c=>{c.x-=n,c.y-=r}),Object.hasOwn(l,"x")&&(l.x-=n),Object.hasOwn(l,"y")&&(l.y-=r)}),i.width=t-n+s,i.height=o-r+a}function Dt(e){e.edges().forEach(n=>{if(n.v===n.w)return;let t=e.edge(n),r=e.node(n.v),o=e.node(n.w),i,s;t.points?(i=t.points[0],s=t.points[t.points.length-1]):(t.points=[],i=o,s=r),t.points.unshift(re(r,i)),t.points.push(re(o,s))})}function Xt(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 Ht(e){e.edges().forEach(n=>{let t=e.edge(n);t.reversed&&t.points.reverse()})}function qt(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]),s=e.node(t.borderRight[t.borderRight.length-1]);t.width=Math.abs(s.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 zt(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 Ut(e){I(e).forEach(t=>{let r=0;t.forEach((o,i)=>{let s=e.node(o);typeof s.rank!="number"&&(s.rank=0),s.order=i+r,(s.selfEdges||[]).forEach(a=>{j(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:i+ ++r,e:a.e,edgeLabel:a.label},"_se"),(!Array.isArray(a.label.points)||a.label.points.length!==7)&&(a.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete s.selfEdges})})}function Jt(e){e.nodes().forEach(n=>{let t=e.node(n),r=o=>typeof o=="number"&&isFinite(o);if(t.dummy==="selfedge"){let o=t,i=e.node(o.e.v),s=r(i==null?void 0:i.x)?i.x:0,a=r(i==null?void 0:i.y)?i.y:0,d=r(i==null?void 0:i.width)?i.width:0,u=r(i==null?void 0:i.height)?i.height:0,l=r(t.x)?t.x:s,c=r(t.y)?t.y:a,g=d/2,f=u/2;o.edgeLabel.points=[{x:l+g,y:c-f},{x:l+g,y:c-f},{x:l,y:c},{x:l-g,y:c+f},{x:l-g,y:c+f},{x:l,y:c},{x:l,y:c}],o.edgeLabel.x=l,o.edgeLabel.y=c,e.setEdge(o.e,o.edgeLabel),e.removeNode(n)}else t&&Array.isArray(t.selfEdges)&&t.selfEdges.forEach(o=>{if(!Array.isArray(o.label.points)||o.label.points.length!==7){let i=r(t.x)?t.x:0,s=r(t.y)?t.y:0,a=r(t.width)?t.width:0,d=r(t.height)?t.height:0,u=a/2,l=d/2;o.label.points=[{x:i+u,y:s-l},{x:i+u,y:s-l},{x:i,y:s},{x:i-u,y:s+l},{x:i-u,y:s+l},{x:i,y:s},{x:i,y:s}]}})})}function xe(e,n){return W(B(e,n),Number)}function ke(e){let n={};return e&&Object.entries(e).forEach(([t,r])=>{typeof t=="string"&&(t=t.toLowerCase()),n[t]=r}),n}function ne(e){let n=I(e),t=new v.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((s,a)=>(t.setEdge(s,a,{style:"invis"}),a))}),t}var yn=require("@dagrejs/graphlib");var $t={time:se,notime:X},Kt={graphlib:En,version:$,layout:ee,debug:ne,util:{time:se,notime:X}},Qt=Kt;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
|