diff --git a/tinygrad/viz/assets/dagrejs.github.io/project/dagre/latest/dagre.min.js b/tinygrad/viz/assets/dagrejs.github.io/project/dagre/latest/dagre.min.js index df5c90c1c3..90e52a0bcf 100644 --- a/tinygrad/viz/assets/dagrejs.github.io/project/dagre/latest/dagre.min.js +++ b/tinygrad/viz/assets/dagrejs.github.io/project/dagre/latest/dagre.min.js @@ -1,3 +1,3 @@ -var dagre=(()=>{var v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var y=v((Si,ee)=>{var Gt=Object.defineProperty,Vt=(e,t,r)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,E=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),k=(e,t,r)=>Vt(e,typeof t!="symbol"?t+"":t,r),R=E((e,t)=>{"use strict";var r="\0",n="\0",i="",o=class{constructor(d){k(this,"_isDirected",!0),k(this,"_isMultigraph",!1),k(this,"_isCompound",!1),k(this,"_label"),k(this,"_defaultNodeLabelFn",()=>{}),k(this,"_defaultEdgeLabelFn",()=>{}),k(this,"_nodes",{}),k(this,"_in",{}),k(this,"_preds",{}),k(this,"_out",{}),k(this,"_sucs",{}),k(this,"_edgeObjs",{}),k(this,"_edgeLabels",{}),k(this,"_nodeCount",0),k(this,"_edgeCount",0),k(this,"_parent"),k(this,"_children"),d&&(this._isDirected=Object.hasOwn(d,"directed")?d.directed:!0,this._isMultigraph=Object.hasOwn(d,"multigraph")?d.multigraph:!1,this._isCompound=Object.hasOwn(d,"compound")?d.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[n]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(d){return this._label=d,this}graph(){return this._label}setDefaultNodeLabel(d){return this._defaultNodeLabelFn=d,typeof d!="function"&&(this._defaultNodeLabelFn=()=>d),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var d=this;return this.nodes().filter(h=>Object.keys(d._in[h]).length===0)}sinks(){var d=this;return this.nodes().filter(h=>Object.keys(d._out[h]).length===0)}setNodes(d,h){var f=arguments,m=this;return d.forEach(function(p){f.length>1?m.setNode(p,h):m.setNode(p)}),this}setNode(d,h){return Object.hasOwn(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=h),this):(this._nodes[d]=arguments.length>1?h:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=n,this._children[d]={},this._children[n][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)}node(d){return this._nodes[d]}hasNode(d){return Object.hasOwn(this._nodes,d)}removeNode(d){var h=this;if(Object.hasOwn(this._nodes,d)){var f=m=>h.removeEdge(h._edgeObjs[m]);delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],this.children(d).forEach(function(m){h.setParent(m)}),delete this._children[d]),Object.keys(this._in[d]).forEach(f),delete this._in[d],delete this._preds[d],Object.keys(this._out[d]).forEach(f),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this}setParent(d,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(h===void 0)h=n;else{h+="";for(var f=h;f!==void 0;f=this.parent(f))if(f===d)throw new Error("Setting "+h+" as parent of "+d+" would create a cycle");this.setNode(h)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=h,this._children[h][d]=!0,this}_removeFromParentsChildList(d){delete this._children[this._parent[d]][d]}parent(d){if(this._isCompound){var h=this._parent[d];if(h!==n)return h}}children(d=n){if(this._isCompound){var h=this._children[d];if(h)return Object.keys(h)}else{if(d===n)return this.nodes();if(this.hasNode(d))return[]}}predecessors(d){var h=this._preds[d];if(h)return Object.keys(h)}successors(d){var h=this._sucs[d];if(h)return Object.keys(h)}neighbors(d){var h=this.predecessors(d);if(h){let m=new Set(h);for(var f of this.successors(d))m.add(f);return Array.from(m.values())}}isLeaf(d){var h;return this.isDirected()?h=this.successors(d):h=this.neighbors(d),h.length===0}filterNodes(d){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var f=this;Object.entries(this._nodes).forEach(function([w,b]){d(w)&&h.setNode(w,b)}),Object.values(this._edgeObjs).forEach(function(w){h.hasNode(w.v)&&h.hasNode(w.w)&&h.setEdge(w,f.edge(w))});var m={};function p(w){var b=f.parent(w);return b===void 0||h.hasNode(b)?(m[w]=b,b):b in m?m[b]:p(b)}return this._isCompound&&h.nodes().forEach(w=>h.setParent(w,p(w))),h}setDefaultEdgeLabel(d){return this._defaultEdgeLabelFn=d,typeof d!="function"&&(this._defaultEdgeLabelFn=()=>d),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(d,h){var f=this,m=arguments;return d.reduce(function(p,w){return m.length>1?f.setEdge(p,w,h):f.setEdge(p,w),w}),this}setEdge(){var d,h,f,m,p=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(d=w.v,h=w.w,f=w.name,arguments.length===2&&(m=arguments[1],p=!0)):(d=w,h=arguments[1],f=arguments[3],arguments.length>2&&(m=arguments[2],p=!0)),d=""+d,h=""+h,f!==void 0&&(f=""+f);var b=l(this._isDirected,d,h,f);if(Object.hasOwn(this._edgeLabels,b))return p&&(this._edgeLabels[b]=m),this;if(f!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(h),this._edgeLabels[b]=p?m:this._defaultEdgeLabelFn(d,h,f);var g=u(this._isDirected,d,h,f);return d=g.v,h=g.w,Object.freeze(g),this._edgeObjs[b]=g,s(this._preds[h],d),s(this._sucs[d],h),this._in[h][b]=g,this._out[d][b]=g,this._edgeCount++,this}edge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f);return this._edgeLabels[m]}edgeAsObj(){let d=this.edge(...arguments);return typeof d!="object"?{label:d}:d}hasEdge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f);return Object.hasOwn(this._edgeLabels,m)}removeEdge(d,h,f){var m=arguments.length===1?c(this._isDirected,arguments[0]):l(this._isDirected,d,h,f),p=this._edgeObjs[m];return p&&(d=p.v,h=p.w,delete this._edgeLabels[m],delete this._edgeObjs[m],a(this._preds[h],d),a(this._sucs[d],h),delete this._in[h][m],delete this._out[d][m],this._edgeCount--),this}inEdges(d,h){return this.isDirected()?this.filterEdges(this._in[d],d,h):this.nodeEdges(d,h)}outEdges(d,h){return this.isDirected()?this.filterEdges(this._out[d],d,h):this.nodeEdges(d,h)}nodeEdges(d,h){if(d in this._nodes)return this.filterEdges({...this._in[d],...this._out[d]},d,h)}filterEdges(d,h,f){if(d){var m=Object.values(d);return f?m.filter(function(p){return p.v===h&&p.w===f||p.v===f&&p.w===h}):m}}};function s(d,h){d[h]?d[h]++:d[h]=1}function a(d,h){--d[h]||delete d[h]}function l(d,h,f,m){var p=""+h,w=""+f;if(!d&&p>w){var b=p;p=w,w=b}return p+i+w+i+(m===void 0?r:m)}function u(d,h,f,m){var p=""+h,w=""+f;if(!d&&p>w){var b=p;p=w,w=b}var g={v:p,w};return m&&(g.name=m),g}function c(d,h){return l(d,h.v,h.w,h.name)}t.exports=o}),At=E((e,t)=>{t.exports="3.0.4"}),Yt=E((e,t)=>{t.exports={Graph:R(),version:At()}}),Bt=E((e,t)=>{var r=R();t.exports={write:n,read:s};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:i(a),edges:o(a)};return a.graph()!==void 0&&(l.value=structuredClone(a.graph())),l}function i(a){return a.nodes().map(function(l){var u=a.node(l),c=a.parent(l),d={v:l};return u!==void 0&&(d.value=u),c!==void 0&&(d.parent=c),d})}function o(a){return a.edges().map(function(l){var u=a.edge(l),c={v:l.v,w:l.w};return l.name!==void 0&&(c.name=l.name),u!==void 0&&(c.value=u),c})}function s(a){var l=new r(a.options).setGraph(a.value);return a.nodes.forEach(function(u){l.setNode(u.v,u.value),u.parent&&l.setParent(u.v,u.parent)}),a.edges.forEach(function(u){l.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),l}}),H=E((e,t)=>{t.exports=n;var r=()=>1;function n(o,s,a,l){return i(o,String(s),a||r,l||function(u){return o.outEdges(u)})}function i(o,s,a,l){var u={},c=!0,d=0,h=o.nodes(),f=function(b){var g=a(b);u[b.v].distance+g{t.exports=r;function r(n){var i={},o=[],s;function a(l){Object.hasOwn(i,l)||(i[l]=!0,s.push(l),n.successors(l).forEach(a),n.predecessors(l).forEach(a))}return n.nodes().forEach(function(l){s=[],a(l),s.length&&o.push(s)}),o}}),Q=E((e,t)=>{var r=class{constructor(){k(this,"_arr",[]),k(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var i=this._keyIndices[n];if(i!==void 0)return this._arr[i].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,i){var o=this._keyIndices;if(n=String(n),!Object.hasOwn(o,n)){var s=this._arr,a=s.length;return o[n]=a,s.push({key:n,priority:i}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,i){var o=this._keyIndices[n];if(i>this._arr[o].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[o].priority+" New: "+i);this._arr[o].priority=i,this._decrease(o)}_heapify(n){var i=this._arr,o=2*n,s=o+1,a=n;o>1,!(i[s].priority{var r=Q();t.exports=i;var n=()=>1;function i(s,a,l,u){var c=function(d){return s.outEdges(d)};return o(s,String(a),l||n,u||c)}function o(s,a,l,u){var c={},d=new r,h,f,m=function(p){var w=p.v!==h?p.v:p.w,b=c[w],g=l(p),I=f.distance+g;if(g<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+p+" Weight: "+g);I0&&(h=d.removeMin(),f=c[h],f.distance!==Number.POSITIVE_INFINITY);)u(h).forEach(m);return c}}),zt=E((e,t)=>{var r=T();t.exports=n;function n(i,o,s){return i.nodes().reduce(function(a,l){return a[l]=r(i,l,o,s),a},{})}}),Xt=E((e,t)=>{t.exports=r;function r(i,o,s){if(i[o].predecessor!==void 0)throw new Error("Invalid source vertex");if(i[s].predecessor===void 0&&s!==o)throw new Error("Invalid destination vertex");return{weight:i[s].distance,path:n(i,o,s)}}function n(i,o,s){for(var a=[],l=s;l!==o;)a.push(l),l=i[l].predecessor;return a.push(o),a.reverse()}}),J=E((e,t)=>{t.exports=r;function r(n){var i=0,o=[],s={},a=[];function l(u){var c=s[u]={onStack:!0,lowlink:i,index:i++};if(o.push(u),n.successors(u).forEach(function(f){Object.hasOwn(s,f)?s[f].onStack&&(c.lowlink=Math.min(c.lowlink,s[f].index)):(l(f),c.lowlink=Math.min(c.lowlink,s[f].lowlink))}),c.lowlink===c.index){var d=[],h;do h=o.pop(),s[h].onStack=!1,d.push(h);while(u!==h);a.push(d)}}return n.nodes().forEach(function(u){Object.hasOwn(s,u)||l(u)}),a}}),Ut=E((e,t)=>{var r=J();t.exports=n;function n(i){return r(i).filter(function(o){return o.length>1||o.length===1&&i.hasEdge(o[0],o[0])})}}),Ht=E((e,t)=>{t.exports=n;var r=()=>1;function n(o,s,a){return i(o,s||r,a||function(l){return o.outEdges(l)})}function i(o,s,a){var l={},u=o.nodes();return u.forEach(function(c){l[c]={},l[c][c]={distance:0},u.forEach(function(d){c!==d&&(l[c][d]={distance:Number.POSITIVE_INFINITY})}),a(c).forEach(function(d){var h=d.v===c?d.w:d.v,f=s(d);l[c][h]={distance:f,predecessor:c}})}),u.forEach(function(c){var d=l[c];u.forEach(function(h){var f=l[h];u.forEach(function(m){var p=f[c],w=d[m],b=f[m],g=p.distance+w.distance;g{function r(i){var o={},s={},a=[];function l(u){if(Object.hasOwn(s,u))throw new n;Object.hasOwn(o,u)||(s[u]=!0,o[u]=!0,i.predecessors(u).forEach(l),delete s[u],a.push(u))}if(i.sinks().forEach(l),Object.keys(o).length!==i.nodeCount())throw new n;return a}var n=class extends Error{constructor(){super(...arguments)}};t.exports=r,r.CycleException=n}),Qt=E((e,t)=>{var r=K();t.exports=n;function n(i){try{r(i)}catch(o){if(o instanceof r.CycleException)return!1;throw o}return!0}}),Z=E((e,t)=>{t.exports=r;function r(i,o,s,a,l){Array.isArray(o)||(o=[o]);var u=(i.isDirected()?i.successors:i.neighbors).bind(i),c={};return o.forEach(function(d){if(!i.hasNode(d))throw new Error("Graph does not have node: "+d);l=n(i,d,s==="post",c,u,a,l)}),l}function n(i,o,s,a,l,u,c){if(Object.hasOwn(a,o))return c;var d=l(o),h=[{v:o,nb:d,childIdx:0}];for(a[o]=!0,s||(c=u(c,o));h.length>0;){for(var f=h[h.length-1],m=!1;f.childIdx{var r=Z();t.exports=n;function n(i,o,s){return r(i,o,s,function(a,l){return a.push(l),a},[])}}),Jt=E((e,t)=>{var r=$();t.exports=n;function n(i,o){return r(i,o,"post")}}),Kt=E((e,t)=>{var r=$();t.exports=n;function n(i,o){return r(i,o,"pre")}}),Zt=E((e,t)=>{var r=R(),n=Q();t.exports=i;function i(o,s){var a=new r,l={},u=new n,c;function d(f){var m=f.v===c?f.w:f.v,p=u.priority(m);if(p!==void 0){var w=s(f);w0;){if(c=u.removeMin(),Object.hasOwn(l,c))a.setEdge(c,l[c]);else{if(h)throw new Error("Input graph is not connected: "+o);h=!0}o.nodeEdges(c).forEach(d)}return a}}),$t=E((e,t)=>{var r=T(),n=H();t.exports=i;function i(s,a,l,u){return o(s,a,l,u||function(c){return s.outEdges(c)})}function o(s,a,l,u){if(l===void 0)return r(s,a,l,u);for(var c=!1,d=s.nodes(),h=0;h{t.exports={bellmanFord:H(),components:Wt(),dijkstra:T(),dijkstraAll:zt(),extractPath:Xt(),findCycles:Ut(),floydWarshall:Ht(),isAcyclic:Qt(),postorder:Jt(),preorder:Kt(),prim:Zt(),shortestPaths:$t(),reduce:Z(),tarjan:J(),topsort:K()}}),U=Yt();ee.exports={Graph:U.Graph,json:Bt(),alg:er(),version:U.version}});var ne=v((Gi,re)=>{var S=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,r=t._prev;if(r!==t)return te(r),r}enqueue(t){let r=this._sentinel;t._prev&&t._next&&te(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,tr)),n=n._prev;return"["+t.join(", ")+"]"}};function te(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function tr(e,t){if(e!=="_next"&&e!=="_prev")return t}re.exports=S});var oe=v((Vi,ie)=>{var rr=y().Graph,nr=ne();ie.exports=or;var ir=()=>1;function or(e,t){if(e.nodeCount()<=1)return[];let r=ar(e,t||ir);return sr(r.graph,r.buckets,r.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function sr(e,t,r){let n=[],i=t[t.length-1],o=t[0],s;for(;e.nodeCount();){for(;s=o.dequeue();)P(e,t,r,s);for(;s=i.dequeue();)P(e,t,r,s);if(e.nodeCount()){for(let a=t.length-2;a>0;--a)if(s=t[a].dequeue(),s){n=n.concat(P(e,t,r,s,!0));break}}}return n}function P(e,t,r,n,i){let o=i?[]:void 0;return e.inEdges(n.v).forEach(s=>{let a=e.edge(s),l=e.node(s.v);i&&o.push({v:s.v,w:s.w}),l.out-=a,F(t,r,l)}),e.outEdges(n.v).forEach(s=>{let a=e.edge(s),l=s.w,u=e.node(l);u.in-=a,F(t,r,u)}),e.removeNode(n.v),o}function ar(e,t){let r=new rr,n=0,i=0;e.nodes().forEach(a=>{r.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let l=r.edge(a.v,a.w)||0,u=t(a),c=l+u;r.setEdge(a.v,a.w,c),i=Math.max(i,r.node(a.v).out+=u),n=Math.max(n,r.node(a.w).in+=u)});let o=dr(i+n+3).map(()=>new nr),s=n+1;return r.nodes().forEach(a=>{F(o,s,r.node(a))}),{graph:r,buckets:o,zeroIdx:s}}function F(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 dr(e){let t=[];for(let r=0;r{"use strict";var se=y().Graph;he.exports={addBorderNode:br,addDummyNode:ae,applyWithChunking:C,asNonCompoundGraph:ur,buildLayerMatrix:pr,intersectRect:fr,mapValues:yr,maxRank:de,normalizeRanks:mr,notime:Er,partition:vr,pick:kr,predecessorWeights:cr,range:ue,removeEmptyRanks:wr,simplify:lr,successorWeights:hr,time:gr,uniqueId:le,zipObject:D};function ae(e,t,r,n){for(var i=n;e.hasNode(i);)i=le(n);return r.dummy=t,e.setNode(i,r),i}function lr(e){let t=new se().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 ur(e){let t=new se({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 hr(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 D(e.nodes(),t)}function cr(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 D(e.nodes(),t)}function fr(e,t){let r=e.x,n=e.y,i=t.x-r,o=t.y-n,s=e.width/2,a=e.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");let l,u;return Math.abs(o)*s>Math.abs(i)*a?(o<0&&(a=-a),l=a*i/o,u=a):(i<0&&(s=-s),l=s,u=s*o/i),{x:r+l,y:n+u}}function pr(e){let t=ue(de(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 mr(e){let t=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),r=C(Math.min,t);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=r)})}function wr(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),r=C(Math.min,t),n=[];e.nodes().forEach(s=>{let a=e.node(s).rank-r;n[a]||(n[a]=[]),n[a].push(s)});let i=0,o=e.graph().nodeRankFactor;Array.from(n).forEach((s,a)=>{s===void 0&&a%o!==0?--i:s!==void 0&&i&&s.forEach(l=>e.node(l).rank+=i)})}function br(e,t,r,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=n),ae(e,"border",i,t)}function C(e,t){if(t.length===0)return e();let r=t[0];for(let n=1;n{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return C(Math.max,r)}function vr(e,t){let r={lhs:[],rhs:[]};return e.forEach(n=>{t(n)?r.lhs.push(n):r.rhs.push(n)}),r}function gr(e,t){let r=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-r)+"ms")}}function Er(e,t){return t()}var _r=0;function le(e){var t=++_r;return e+(""+t)}function ue(e,t,r=1){t==null&&(t=e,e=0);let n=o=>otn[t]),Object.entries(e).reduce((n,[i,o])=>(n[i]=r(o,i),n),{})}function D(e,t){return e.reduce((r,n,i)=>(r[n]=t[i],r),{})}});var fe=v((Yi,ce)=>{"use strict";var xr=oe(),Or=_().uniqueId;ce.exports={run:Nr,undo:jr};function Nr(e){(e.graph().acyclicer==="greedy"?xr(e,r(e)):Ir(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,Or("rev"))});function r(n){return i=>n.edge(i).weight}}function Ir(e){let t=[],r={},n={};function i(o){Object.hasOwn(n,o)||(n[o]=!0,r[o]=!0,e.outEdges(o).forEach(s=>{Object.hasOwn(r,s.w)?t.push(s):i(s.w)}),delete r[o])}return e.nodes().forEach(i),t}function jr(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 me=v((Bi,pe)=>{"use strict";var Cr=_();pe.exports={run:Lr,undo:Mr};function Lr(e){e.graph().dummyChains=[],e.edges().forEach(t=>qr(e,t))}function qr(e,t){let r=t.v,n=e.node(r).rank,i=t.w,o=e.node(i).rank,s=t.name,a=e.edge(t),l=a.labelRank;if(o===n+1)return;e.removeEdge(t);let u,c,d;for(d=0,++n;n{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 j=v((Wi,we)=>{"use strict";var{applyWithChunking:Rr}=_();we.exports={longestPath:Tr,slack:Sr};function Tr(e){var t={};function r(n){var i=e.node(n);if(Object.hasOwn(t,n))return i.rank;t[n]=!0;let o=e.outEdges(n).map(a=>a==null?Number.POSITIVE_INFINITY:r(a.w)-e.edge(a).minlen);var s=Rr(Math.min,o);return s===Number.POSITIVE_INFINITY&&(s=0),i.rank=s}e.sources().forEach(r)}function Sr(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}});var G=v((zi,be)=>{"use strict";var Pr=y().Graph,L=j().slack;be.exports=Fr;function Fr(e){var t=new Pr({directed:!1}),r=e.nodes()[0],n=e.nodeCount();t.setNode(r,{});for(var i,o;Dr(t,e){var o=i.v,s=n===o?i.w:o;!e.hasNode(s)&&!L(t,i)&&(e.setNode(s,{}),e.setEdge(n,s,{}),r(s))})}return e.nodes().forEach(r),e.nodeCount()}function Gr(e,t){return t.edges().reduce((n,i)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(o=L(t,i)),ot.node(n).rank+=r)}});var Ne=v((Xi,Oe)=>{"use strict";var Ar=G(),ve=j().slack,Yr=j().longestPath,Br=y().alg.preorder,Wr=y().alg.postorder,zr=_().simplify;Oe.exports=N;N.initLowLimValues=A;N.initCutValues=V;N.calcCutValue=Ee;N.leaveEdge=ke;N.enterEdge=ye;N.exchangeEdges=xe;function N(e){e=zr(e),Yr(e);var t=Ar(e);A(t),V(t,e);for(var r,n;r=ke(t);)n=ye(t,e,r),xe(t,e,r,n)}function V(e,t){var r=Wr(e,e.nodes());r=r.slice(0,r.length-1),r.forEach(n=>Xr(e,t,n))}function Xr(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=Ee(e,t,r)}function Ee(e,t,r){var n=e.node(r),i=n.parent,o=!0,s=t.edge(r,i),a=0;return s||(o=!1,s=t.edge(i,r)),a=s.weight,t.nodeEdges(r).forEach(l=>{var u=l.v===r,c=u?l.w:l.v;if(c!==i){var d=u===o,h=t.edge(l).weight;if(a+=d?h:-h,Hr(e,r,c)){var f=e.edge(r,c).cutvalue;a+=d?-f:f}}}),a}function A(e,t){arguments.length<2&&(t=e.nodes()[0]),_e(e,{},1,t)}function _e(e,t,r,n,i){var o=r,s=e.node(n);return t[n]=!0,e.neighbors(n).forEach(a=>{Object.hasOwn(t,a)||(r=_e(e,t,r,a,n))}),s.low=o,s.lim=r++,i?s.parent=i:delete s.parent,r}function ke(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ye(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var o=e.node(n),s=e.node(i),a=o,l=!1;o.lim>s.lim&&(a=s,l=!0);var u=t.edges().filter(c=>l===ge(e,e.node(c.v),a)&&l!==ge(e,e.node(c.w),a));return u.reduce((c,d)=>ve(t,d)!t.node(i).parent),n=Br(e,r);n=n.slice(1),n.forEach(i=>{var o=e.node(i).parent,s=t.edge(i,o),a=!1;s||(s=t.edge(o,i),a=!0),t.node(i).rank=t.node(o).rank+(a?s.minlen:-s.minlen)})}function Hr(e,t,r){return e.hasEdge(t,r)}function ge(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}});var Le=v((Ui,Ce)=>{"use strict";var Qr=j(),je=Qr.longestPath,Jr=G(),Kr=Ne();Ce.exports=Zr;function Zr(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case"network-simplex":Ie(e);break;case"tight-tree":en(e);break;case"longest-path":$r(e);break;case"none":break;default:Ie(e)}}var $r=je;function en(e){je(e),Jr(e)}function Ie(e){Kr(e)}});var Me=v((Hi,qe)=>{qe.exports=tn;function tn(e){let t=nn(e);e.graph().dummyChains.forEach(r=>{let n=e.node(r),i=n.edgeObj,o=rn(e,t,i.v,i.w),s=o.path,a=o.lca,l=0,u=s[l],c=!0;for(;r!==i.w;){if(n=e.node(r),c){for(;(u=s[l])!==a&&e.node(u).maxRanks||a>t[l].lim));for(u=l,l=n;(l=e.parent(l))!==u;)o.push(l);return{path:i.concat(o.reverse()),lca:u}}function nn(e){let t={},r=0;function n(i){let o=r;e.children(i).forEach(n),t[i]={low:o,lim:r++}}return e.children().forEach(n),t}});var Se=v((Qi,Te)=>{var q=_();Te.exports={run:on,cleanup:dn};function on(e){let t=q.addDummyNode(e,"root",{},"_root"),r=sn(e),n=Object.values(r),i=q.applyWithChunking(Math.max,n)-1,o=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=o);let s=an(e)+1;e.children().forEach(a=>Re(e,t,o,s,i,r,a)),e.graph().nodeRankFactor=o}function Re(e,t,r,n,i,o,s){let a=e.children(s);if(!a.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:r});return}let l=q.addBorderNode(e,"_bt"),u=q.addBorderNode(e,"_bb"),c=e.node(s);e.setParent(l,s),c.borderTop=l,e.setParent(u,s),c.borderBottom=u,a.forEach(d=>{Re(e,t,r,n,i,o,d);let h=e.node(d),f=h.borderTop?h.borderTop:d,m=h.borderBottom?h.borderBottom:d,p=h.borderTop?n:2*n,w=f!==m?1:i-o[s]+1;e.setEdge(l,f,{weight:p,minlen:w,nestingEdge:!0}),e.setEdge(m,u,{weight:p,minlen:w,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,l,{weight:0,minlen:i+o[s]})}function sn(e){var t={};function r(n,i){var o=e.children(n);o&&o.length&&o.forEach(s=>r(s,i+1)),t[n]=i}return e.children().forEach(n=>r(n,1)),t}function an(e){return e.edges().reduce((t,r)=>t+e.edge(r).weight,0)}function dn(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 De=v((Ji,Fe)=>{var ln=_();Fe.exports=un;function un(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 o=i.minRank,s=i.maxRank+1;o{"use strict";Ae.exports={adjust:hn,undo:cn};function hn(e){let t=e.graph().rankdir.toLowerCase();(t==="lr"||t==="rl")&&Ve(e)}function cn(e){let t=e.graph().rankdir.toLowerCase();(t==="bt"||t==="rl")&&fn(e),(t==="lr"||t==="rl")&&(pn(e),Ve(e))}function Ve(e){e.nodes().forEach(t=>Ge(e.node(t))),e.edges().forEach(t=>Ge(e.edge(t)))}function Ge(e){let t=e.width;e.width=e.height,e.height=t}function fn(e){e.nodes().forEach(t=>Y(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(Y),Object.hasOwn(r,"y")&&Y(r)})}function Y(e){e.y=-e.y}function pn(e){e.nodes().forEach(t=>B(e.node(t))),e.edges().forEach(t=>{let r=e.edge(t);r.points.forEach(B),Object.hasOwn(r,"x")&&B(r)})}function B(e){let t=e.x;e.x=e.y,e.y=t}});var ze=v((Zi,We)=>{"use strict";var Be=_();We.exports=mn;function mn(e){let t={},r=e.nodes().filter(l=>!e.children(l).length),n=r.map(l=>e.node(l).rank),i=Be.applyWithChunking(Math.max,n),o=Be.range(i+1).map(()=>[]);function s(l){if(t[l])return;t[l]=!0;let u=e.node(l);o[u.rank].push(l),e.successors(l).forEach(s)}return r.sort((l,u)=>e.node(l).rank-e.node(u).rank).forEach(s),o}});var Ue=v(($i,Xe)=>{"use strict";var wn=_().zipObject;Xe.exports=bn;function bn(e,t){let r=0;for(let n=1;nc)),i=t.flatMap(u=>e.outEdges(u).map(c=>({pos:n[c.w],weight:e.edge(c).weight})).sort((c,d)=>c.pos-d.pos)),o=1;for(;o{let c=u.pos+o;a[c]+=u.weight;let d=0;for(;c>0;)c%2&&(d+=a[c+1]),c=c-1>>1,a[c]+=u.weight;l+=u.weight*d}),l}});var Qe=v((eo,He)=>{He.exports=gn;function gn(e,t=[]){return t.map(r=>{let n=e.inEdges(r);if(n.length){let i=n.reduce((o,s)=>{let a=e.edge(s),l=e.node(s.v);return{sum:o.sum+a.weight*l.order,weight:o.weight+a.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}});var Ke=v((to,Je)=>{"use strict";var En=_();Je.exports=_n;function _n(e,t){let r={};e.forEach((i,o)=>{let s=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};i.barycenter!==void 0&&(s.barycenter=i.barycenter,s.weight=i.weight)}),t.edges().forEach(i=>{let o=r[i.v],s=r[i.w];o!==void 0&&s!==void 0&&(s.indegree++,o.out.push(r[i.w]))});let n=Object.values(r).filter(i=>!i.indegree);return kn(n)}function kn(e){let t=[];function r(i){return o=>{o.merged||(o.barycenter===void 0||i.barycenter===void 0||o.barycenter>=i.barycenter)&&yn(i,o)}}function n(i){return o=>{o.in.push(i),--o.indegree===0&&e.push(o)}}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=>En.pick(i,["vs","i","barycenter","weight"]))}function yn(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 et=v((ro,$e)=>{var xn=_();$e.exports=On;function On(e,t){let r=xn.partition(e,c=>Object.hasOwn(c,"barycenter")),n=r.lhs,i=r.rhs.sort((c,d)=>d.i-c.i),o=[],s=0,a=0,l=0;n.sort(Nn(!!t)),l=Ze(o,i,l),n.forEach(c=>{l+=c.vs.length,o.push(c.vs),s+=c.barycenter*c.weight,a+=c.weight,l=Ze(o,i,l)});let u={vs:o.flat(!0)};return a&&(u.barycenter=s/a,u.weight=a),u}function Ze(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 Nn(e){return(t,r)=>t.barycenterr.barycenter?1:e?r.i-t.i:t.i-r.i}});var nt=v((no,rt)=>{var In=Qe(),jn=Ke(),Cn=et();rt.exports=tt;function tt(e,t,r,n){let i=e.children(t),o=e.node(t),s=o?o.borderLeft:void 0,a=o?o.borderRight:void 0,l={};s&&(i=i.filter(h=>h!==s&&h!==a));let u=In(e,i);u.forEach(h=>{if(e.children(h.v).length){let f=tt(e,h.v,r,n);l[h.v]=f,Object.hasOwn(f,"barycenter")&&qn(h,f)}});let c=jn(u,r);Ln(c,l);let d=Cn(c,n);if(s&&(d.vs=[s,d.vs,a].flat(!0),e.predecessors(s).length)){let h=e.node(e.predecessors(s)[0]),f=e.node(e.predecessors(a)[0]);Object.hasOwn(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+f.order)/(d.weight+2),d.weight+=2}return d}function Ln(e,t){e.forEach(r=>{r.vs=r.vs.flatMap(n=>t[n]?t[n].vs:n)})}function qn(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 ot=v((io,it)=>{var Mn=y().Graph,Rn=_();it.exports=Tn;function Tn(e,t,r,n){n||(n=e.nodes());let i=Sn(e),o=new Mn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(s=>e.node(s));return n.forEach(s=>{let a=e.node(s),l=e.parent(s);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(s),o.setParent(s,l||i),e[r](s).forEach(u=>{let c=u.v===s?u.w:u.v,d=o.edge(c,s),h=d!==void 0?d.weight:0;o.setEdge(c,s,{weight:e.edge(u).weight+h})}),Object.hasOwn(a,"minRank")&&o.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function Sn(e){for(var t;e.hasNode(t=Rn.uniqueId("_root")););return t}});var at=v((oo,st)=>{st.exports=Pn;function Pn(e,t,r){let n={},i;r.forEach(o=>{let s=e.parent(o),a,l;for(;s;){if(a=e.parent(s),a?(l=n[a],n[a]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=a}})}});var ct=v((so,ht)=>{"use strict";var Fn=ze(),Dn=Ue(),Gn=nt(),Vn=ot(),An=at(),Yn=y().Graph,M=_();ht.exports=ut;function ut(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,ut);return}let r=M.maxRank(e),n=dt(e,M.range(1,r+1),"inEdges"),i=dt(e,M.range(r-1,-1,-1),"outEdges"),o=Fn(e);if(lt(e,o),t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,a,l=t.constraints||[];for(let u=0,c=0;c<4;++u,++c){Bn(u%2?n:i,u%4>=2,l),o=M.buildLayerMatrix(e);let d=Dn(e,o);d{n.has(o)||n.set(o,[]),n.get(o).push(s)};for(let o of e.nodes()){let s=e.node(o);if(typeof s.rank=="number"&&i(s.rank,o),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&i(a,o)}return t.map(function(o){return Vn(e,o,r,n.get(o)||[])})}function Bn(e,t,r){let n=new Yn;e.forEach(function(i){r.forEach(a=>n.setEdge(a.left,a.right));let o=i.graph().root,s=Gn(i,o,n,t);s.vs.forEach((a,l)=>i.node(a).order=l),An(i,n,s.vs)})}function lt(e,t){Object.values(t).forEach(r=>r.forEach((n,i)=>e.node(n).order=i))}});var kt=v((ao,_t)=>{"use strict";var Wn=y().Graph,O=_();_t.exports={positionX:Un,findType1Conflicts:ft,findType2Conflicts:pt,addConflict:W,hasConflict:mt,verticalAlignment:wt,horizontalCompaction:bt,alignCoordinates:gt,findSmallestWidthAlignment:vt,balance:Et};function ft(e,t){let r={};function n(i,o){let s=0,a=0,l=i.length,u=o[o.length-1];return o.forEach((c,d)=>{let h=zn(e,c),f=h?e.node(h).order:l;(h||c===u)&&(o.slice(a,d+1).forEach(m=>{e.predecessors(m).forEach(p=>{let w=e.node(p),b=w.order;(b{c=o[d],e.node(c).dummy&&e.predecessors(c).forEach(h=>{let f=e.node(h);f.dummy&&(f.orderu)&&W(r,h,c)})})}function i(o,s){let a=-1,l,u=0;return s.forEach((c,d)=>{if(e.node(c).dummy==="border"){let h=e.predecessors(c);h.length&&(l=e.node(h[0]).order,n(s,u,d,a,l),u=d,a=l)}n(s,u,s.length,l,o.length)}),s}return t.length&&t.reduce(i),r}function zn(e,t){if(e.node(t).dummy)return e.predecessors(t).find(r=>e.node(r).dummy)}function W(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 mt(e,t,r){if(t>r){let n=t;t=r,r=n}return!!e[t]&&Object.hasOwn(e[t],r)}function wt(e,t,r,n){let i={},o={},s={};return t.forEach(a=>{a.forEach((l,u)=>{i[l]=l,o[l]=l,s[l]=u})}),t.forEach(a=>{let l=-1;a.forEach(u=>{let c=n(u);if(c.length){c=c.sort((h,f)=>s[h]-s[f]);let d=(c.length-1)/2;for(let h=Math.floor(d),f=Math.ceil(d);h<=f;++h){let m=c[h];o[u]===u&&lMath.max(h,o[f.v]+s.edge(f)),0)}function c(d){let h=s.outEdges(d).reduce((m,p)=>Math.min(m,o[p.w]-s.edge(p)),Number.POSITIVE_INFINITY),f=e.node(d);h!==Number.POSITIVE_INFINITY&&f.borderType!==a&&(o[d]=Math.max(o[d],h))}return l(u,s.predecessors.bind(s)),l(c,s.successors.bind(s)),Object.keys(n).forEach(d=>o[d]=o[r[d]]),o}function Xn(e,t,r,n){let i=new Wn,o=e.graph(),s=Hn(o.nodesep,o.edgesep,n);return t.forEach(a=>{let l;a.forEach(u=>{let c=r[u];if(i.setNode(c),l){var d=r[l],h=i.edge(d,c);i.setEdge(d,c,Math.max(s(e,u,l),h||0))}l=u})}),i}function vt(e,t){return Object.values(t).reduce((r,n)=>{let i=Number.NEGATIVE_INFINITY,o=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([a,l])=>{let u=Qn(e,a)/2;i=Math.max(l+u,i),o=Math.min(l-u,o)});let s=i-o;return s{["l","r"].forEach(s=>{let a=o+s,l=e[a];if(l===t)return;let u=Object.values(l),c=n-O.applyWithChunking(Math.min,u);s!=="l"&&(c=i-O.applyWithChunking(Math.max,u)),c&&(e[a]=O.mapValues(l,d=>d+c))})})}function Et(e,t){return O.mapValues(e.ul,(r,n)=>{if(t)return e[t.toLowerCase()][n];{let i=Object.values(e).map(o=>o[n]).sort((o,s)=>o-s);return(i[1]+i[2])/2}})}function Un(e){let t=O.buildLayerMatrix(e),r=Object.assign(ft(e,t),pt(e,t)),n={},i;["u","d"].forEach(s=>{i=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(a=>{a==="r"&&(i=i.map(d=>Object.values(d).reverse()));let l=(s==="u"?e.predecessors:e.successors).bind(e),u=wt(e,i,r,l),c=bt(e,i,u.root,u.align,a==="r");a==="r"&&(c=O.mapValues(c,d=>-d)),n[s+a]=c})});let o=vt(e,n);return gt(n,o),Et(n,e.graph().align)}function Hn(e,t,r){return(n,i,o)=>{let s=n.node(i),a=n.node(o),l=0,u;if(l+=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&&(l+=r?u:-u),u=0,l+=(s.dummy?t:e)/2,l+=(a.dummy?t:e)/2,l+=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&&(l+=r?u:-u),u=0,l}}function Qn(e,t){return e.node(t).width}});var Ot=v((lo,xt)=>{"use strict";var yt=_(),Jn=kt().positionX;xt.exports=Kn;function Kn(e){e=yt.asNonCompoundGraph(e),Zn(e),Object.entries(Jn(e)).forEach(([t,r])=>e.node(t).x=r)}function Zn(e){let t=yt.buildLayerMatrix(e),r=e.graph().ranksep,n=e.graph().rankalign,i=0;t.forEach(o=>{let s=o.reduce((a,l)=>{let u=e.node(l).height;return a>u?a:u},0);o.forEach(a=>{let l=e.node(a);n==="top"?l.y=i+l.height/2:n==="bottom"?l.y=i+s-l.height/2:l.y=i+s/2}),i+=s+r})}});var Mt=v((uo,qt)=>{"use strict";var Nt=fe(),It=me(),$n=Le(),ei=_().normalizeRanks,ti=Me(),ri=_().removeEmptyRanks,jt=Se(),ni=De(),Ct=Ye(),ii=ct(),oi=Ot(),x=_(),si=y().Graph;qt.exports=ai;function ai(e,t={}){let r=t.debugTiming?x.time:x.notime;return r("layout",()=>{let n=r(" buildLayoutGraph",()=>bi(e));return r(" runLayout",()=>di(n,r,t)),r(" updateInputGraph",()=>li(e,n)),n})}function di(e,t,r){t(" makeSpaceForEdgeLabels",()=>vi(e)),t(" removeSelfEdges",()=>Ii(e)),t(" acyclic",()=>Nt.run(e)),t(" nestingGraph.run",()=>jt.run(e)),t(" rank",()=>$n(x.asNonCompoundGraph(e))),t(" injectEdgeLabelProxies",()=>gi(e)),t(" removeEmptyRanks",()=>ri(e)),t(" nestingGraph.cleanup",()=>jt.cleanup(e)),t(" normalizeRanks",()=>ei(e)),t(" assignRankMinMax",()=>Ei(e)),t(" removeEdgeLabelProxies",()=>_i(e)),t(" normalize.run",()=>It.run(e)),t(" parentDummyChains",()=>ti(e)),t(" addBorderSegments",()=>ni(e)),t(" order",()=>ii(e,r)),t(" insertSelfEdges",()=>ji(e)),t(" adjustCoordinateSystem",()=>Ct.adjust(e)),t(" position",()=>oi(e)),t(" positionSelfEdges",()=>Ci(e)),t(" removeBorderNodes",()=>Ni(e)),t(" normalize.undo",()=>It.undo(e)),t(" fixupEdgeLabelCoords",()=>xi(e)),t(" undoCoordinateSystem",()=>Ct.undo(e)),t(" translateGraph",()=>ki(e)),t(" assignNodeIntersects",()=>yi(e)),t(" reversePoints",()=>Oi(e)),t(" acyclic.undo",()=>Nt.undo(e))}function li(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 ui=["nodesep","edgesep","ranksep","marginx","marginy"],hi={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},ci=["acyclicer","ranker","rankdir","align","rankalign"],fi=["width","height","rank"],Lt={width:0,height:0},pi=["minlen","weight","width","height","labeloffset"],mi={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},wi=["labelpos"];function bi(e){let t=new si({multigraph:!0,compound:!0}),r=X(e.graph());return t.setGraph(Object.assign({},hi,z(r,ui),x.pick(r,ci))),e.nodes().forEach(n=>{let i=X(e.node(n)),o=z(i,fi);Object.keys(Lt).forEach(s=>{o[s]===void 0&&(o[s]=Lt[s])}),t.setNode(n,o),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=X(e.edge(n));t.setEdge(n,Object.assign({},mi,z(i,pi),x.pick(i,wi)))}),t}function vi(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 gi(e){e.edges().forEach(t=>{let r=e.edge(t);if(r.width&&r.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};x.addDummyNode(e,"edge-proxy",o,"_ep")}})}function Ei(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 _i(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 ki(e){let t=Number.POSITIVE_INFINITY,r=0,n=Number.POSITIVE_INFINITY,i=0,o=e.graph(),s=o.marginx||0,a=o.marginy||0;function l(u){let c=u.x,d=u.y,h=u.width,f=u.height;t=Math.min(t,c-h/2),r=Math.max(r,c+h/2),n=Math.min(n,d-f/2),i=Math.max(i,d+f/2)}e.nodes().forEach(u=>l(e.node(u))),e.edges().forEach(u=>{let c=e.edge(u);Object.hasOwn(c,"x")&&l(c)}),t-=s,n-=a,e.nodes().forEach(u=>{let c=e.node(u);c.x-=t,c.y-=n}),e.edges().forEach(u=>{let c=e.edge(u);c.points.forEach(d=>{d.x-=t,d.y-=n}),Object.hasOwn(c,"x")&&(c.x-=t),Object.hasOwn(c,"y")&&(c.y-=n)}),o.width=r-t+s,o.height=i-n+a}function yi(e){e.edges().forEach(t=>{let r=e.edge(t),n=e.node(t.v),i=e.node(t.w),o,s;r.points?(o=r.points[0],s=r.points[r.points.length-1]):(r.points=[],o=i,s=n),r.points.unshift(x.intersectRect(n,o)),r.points.push(x.intersectRect(i,s))})}function xi(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 Oi(e){e.edges().forEach(t=>{let r=e.edge(t);r.reversed&&r.points.reverse()})}function Ni(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),o=e.node(r.borderLeft[r.borderLeft.length-1]),s=e.node(r.borderRight[r.borderRight.length-1]);r.width=Math.abs(s.x-o.x),r.height=Math.abs(i.y-n.y),r.x=o.x+r.width/2,r.y=n.y+r.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function Ii(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 ji(e){var t=x.buildLayerMatrix(e);t.forEach(r=>{var n=0;r.forEach((i,o)=>{var s=e.node(i);s.order=o+n,(s.selfEdges||[]).forEach(a=>{x.addDummyNode(e,"selfedge",{width:a.label.width,height:a.label.height,rank:s.rank,order:o+ ++n,e:a.e,label:a.label},"_se")}),delete s.selfEdges})})}function Ci(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,o=n.y,s=r.x-i,a=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*s/3,y:o-a},{x:i+5*s/6,y:o-a},{x:i+s,y:o},{x:i+5*s/6,y:o+a},{x:i+2*s/3,y:o+a}],r.label.x=r.x,r.label.y=r.y}})}function z(e,t){return x.mapValues(x.pick(e,t),Number)}function X(e){var t={};return e&&Object.entries(e).forEach(([r,n])=>{typeof r=="string"&&(r=r.toLowerCase()),t[r]=n}),t}});var Tt=v((ho,Rt)=>{var Li=_(),qi=y().Graph;Rt.exports={debugOrdering:Mi};function Mi(e){let t=Li.buildLayerMatrix(e),r=new qi({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 o="layer"+i;r.setNode(o,{rank:"same"}),n.reduce((s,a)=>(r.setEdge(s,a,{style:"invis"}),a))}),r}});var Pt=v((co,St)=>{St.exports="2.0.5-pre"});var Ri=v((fo,Ft)=>{Ft.exports={graphlib:y(),layout:Mt(),debug:Tt(),util:{time:_().time,notime:_().notime},version:Pt()}});return Ri();})(); +var dagre=(()=>{var R=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var A=R((Di,pe)=>{var tt=(()=>{var e=Object.defineProperty,r=Object.getOwnPropertyNames,t=(T,j,q)=>j in T?e(T,j,{enumerable:!0,configurable:!0,writable:!0,value:q}):T[j]=q,n=(T,j)=>function(){return j||(0,T[r(T)[0]])((j={exports:{}}).exports,j),j.exports},i=(T,j,q)=>t(T,typeof j!="symbol"?j+"":j,q),a=n({"lib/graph.js"(T,j){"use strict";var q="\0",w="\0",_="",p=class{constructor(l){i(this,"_isDirected",!0),i(this,"_isMultigraph",!1),i(this,"_isCompound",!1),i(this,"_label"),i(this,"_defaultNodeLabelFn",()=>{}),i(this,"_defaultEdgeLabelFn",()=>{}),i(this,"_nodes",{}),i(this,"_in",{}),i(this,"_preds",{}),i(this,"_out",{}),i(this,"_sucs",{}),i(this,"_edgeObjs",{}),i(this,"_edgeLabels",{}),i(this,"_nodeCount",0),i(this,"_edgeCount",0),i(this,"_parent"),i(this,"_children"),l&&(this._isDirected=Object.hasOwn(l,"directed")?l.directed:!0,this._isMultigraph=Object.hasOwn(l,"multigraph")?l.multigraph:!1,this._isCompound=Object.hasOwn(l,"compound")?l.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[w]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(l){return this._label=l,this}graph(){return this._label}setDefaultNodeLabel(l){return this._defaultNodeLabelFn=l,typeof l!="function"&&(this._defaultNodeLabelFn=()=>l),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var l=this;return this.nodes().filter(h=>Object.keys(l._in[h]).length===0)}sinks(){var l=this;return this.nodes().filter(h=>Object.keys(l._out[h]).length===0)}setNodes(l,h){var E=arguments,k=this;return l.forEach(function(y){E.length>1?k.setNode(y,h):k.setNode(y)}),this}setNode(l,h){return Object.hasOwn(this._nodes,l)?(arguments.length>1&&(this._nodes[l]=h),this):(this._nodes[l]=arguments.length>1?h:this._defaultNodeLabelFn(l),this._isCompound&&(this._parent[l]=w,this._children[l]={},this._children[w][l]=!0),this._in[l]={},this._preds[l]={},this._out[l]={},this._sucs[l]={},++this._nodeCount,this)}node(l){return this._nodes[l]}hasNode(l){return Object.hasOwn(this._nodes,l)}removeNode(l){var h=this;if(Object.hasOwn(this._nodes,l)){var E=k=>h.removeEdge(h._edgeObjs[k]);delete this._nodes[l],this._isCompound&&(this._removeFromParentsChildList(l),delete this._parent[l],this.children(l).forEach(function(k){h.setParent(k)}),delete this._children[l]),Object.keys(this._in[l]).forEach(E),delete this._in[l],delete this._preds[l],Object.keys(this._out[l]).forEach(E),delete this._out[l],delete this._sucs[l],--this._nodeCount}return this}setParent(l,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(h===void 0)h=w;else{h+="";for(var E=h;E!==void 0;E=this.parent(E))if(E===l)throw new Error("Setting "+h+" as parent of "+l+" would create a cycle");this.setNode(h)}return this.setNode(l),this._removeFromParentsChildList(l),this._parent[l]=h,this._children[h][l]=!0,this}_removeFromParentsChildList(l){delete this._children[this._parent[l]][l]}parent(l){if(this._isCompound){var h=this._parent[l];if(h!==w)return h}}children(l=w){if(this._isCompound){var h=this._children[l];if(h)return Object.keys(h)}else{if(l===w)return this.nodes();if(this.hasNode(l))return[]}}predecessors(l){var h=this._preds[l];if(h)return Object.keys(h)}successors(l){var h=this._sucs[l];if(h)return Object.keys(h)}neighbors(l){var h=this.predecessors(l);if(h){let k=new Set(h);for(var E of this.successors(l))k.add(E);return Array.from(k.values())}}isLeaf(l){var h;return this.isDirected()?h=this.successors(l):h=this.neighbors(l),h.length===0}filterNodes(l){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var E=this;Object.entries(this._nodes).forEach(function([O,I]){l(O)&&h.setNode(O,I)}),Object.values(this._edgeObjs).forEach(function(O){h.hasNode(O.v)&&h.hasNode(O.w)&&h.setEdge(O,E.edge(O))});var k={};function y(O){var I=E.parent(O);if(I===void 0||h.hasNode(I))return k[O]=I,I;if(I in k)return k[I];for(var L=[O,I],F=I;;){if(F=E.parent(F),F===void 0||h.hasNode(F)){for(var U=0;Uh.setParent(O,y(O))),h}setDefaultEdgeLabel(l){return this._defaultEdgeLabelFn=l,typeof l!="function"&&(this._defaultEdgeLabelFn=()=>l),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(l,h){var E=this,k=arguments;return l.reduce(function(y,O){return k.length>1?E.setEdge(y,O,h):E.setEdge(y,O),O}),this}setEdge(){var l,h,E,k,y=!1,O=arguments[0];typeof O=="object"&&O!==null&&"v"in O?(l=O.v,h=O.w,E=O.name,arguments.length===2&&(k=arguments[1],y=!0)):(l=O,h=arguments[1],E=arguments[3],arguments.length>2&&(k=arguments[2],y=!0)),l=""+l,h=""+h,E!==void 0&&(E=""+E);var I=g(this._isDirected,l,h,E);if(Object.hasOwn(this._edgeLabels,I))return y&&(this._edgeLabels[I]=k),this;if(E!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(l),this.setNode(h),this._edgeLabels[I]=y?k:this._defaultEdgeLabelFn(l,h,E);var L=x(this._isDirected,l,h,E);return l=L.v,h=L.w,Object.freeze(L),this._edgeObjs[I]=L,m(this._preds[h],l),m(this._sucs[l],h),this._in[h][I]=L,this._out[l][I]=L,this._edgeCount++,this}edge(l,h,E){var k=arguments.length===1?v(this._isDirected,arguments[0]):g(this._isDirected,l,h,E);return this._edgeLabels[k]}edgeAsObj(){let l=this.edge(...arguments);return typeof l!="object"?{label:l}:l}hasEdge(l,h,E){var k=arguments.length===1?v(this._isDirected,arguments[0]):g(this._isDirected,l,h,E);return Object.hasOwn(this._edgeLabels,k)}removeEdge(l,h,E){var k=arguments.length===1?v(this._isDirected,arguments[0]):g(this._isDirected,l,h,E),y=this._edgeObjs[k];return y&&(l=y.v,h=y.w,delete this._edgeLabels[k],delete this._edgeObjs[k],b(this._preds[h],l),b(this._sucs[l],h),delete this._in[h][k],delete this._out[l][k],this._edgeCount--),this}inEdges(l,h){return this.isDirected()?this.filterEdges(this._in[l],l,h):this.nodeEdges(l,h)}outEdges(l,h){return this.isDirected()?this.filterEdges(this._out[l],l,h):this.nodeEdges(l,h)}nodeEdges(l,h){if(l in this._nodes)return this.filterEdges({...this._in[l],...this._out[l]},l,h)}filterEdges(l,h,E){if(l){var k=Object.values(l);return E?k.filter(function(y){return y.v===h&&y.w===E||y.v===E&&y.w===h}):k}}};function m(l,h){l[h]?l[h]++:l[h]=1}function b(l,h){--l[h]||delete l[h]}function g(l,h,E,k){var y=""+h,O=""+E;if(!l&&y>O){var I=y;y=O,O=I}return y+_+O+_+(k===void 0?q:k)}function x(l,h,E,k){var y=""+h,O=""+E;if(!l&&y>O){var I=y;y=O,O=I}var L={v:y,w:O};return k&&(L.name=k),L}function v(l,h){return g(l,h.v,h.w,h.name)}j.exports=p}}),s=n({"lib/version.js"(T,j){j.exports="3.0.4"}}),o=n({"lib/index.js"(T,j){j.exports={Graph:a(),version:s()}}}),d=n({"lib/json.js"(T,j){var q=a();j.exports={write:w,read:m};function w(b){var g={options:{directed:b.isDirected(),multigraph:b.isMultigraph(),compound:b.isCompound()},nodes:_(b),edges:p(b)};return b.graph()!==void 0&&(g.value=structuredClone(b.graph())),g}function _(b){return b.nodes().map(function(g){var x=b.node(g),v=b.parent(g),l={v:g};return x!==void 0&&(l.value=x),v!==void 0&&(l.parent=v),l})}function p(b){return b.edges().map(function(g){var x=b.edge(g),v={v:g.v,w:g.w};return g.name!==void 0&&(v.name=g.name),x!==void 0&&(v.value=x),v})}function m(b){var g=new q(b.options).setGraph(b.value);return b.nodes.forEach(function(x){g.setNode(x.v,x.value),x.parent&&g.setParent(x.v,x.parent)}),b.edges.forEach(function(x){g.setEdge({v:x.v,w:x.w,name:x.name},x.value)}),g}}}),u=n({"lib/alg/bellman-ford.js"(T,j){j.exports=w;var q=()=>1;function w(p,m,b,g){return _(p,String(m),b||q,g||function(x){return p.outEdges(x)})}function _(p,m,b,g){var x={},v=!0,l=0,h=p.nodes(),E=function(I){var L=b(I);x[I.v].distance+L0;){var v=x.pop();if(!Object.hasOwn(_,v)){_[v]=!0,m.push(v);var l=w.successors(v);if(l)for(var h=l.length-1;h>=0;h--)x.push(l[h]);var E=w.predecessors(v);if(E)for(var k=E.length-1;k>=0;k--)x.push(E[k])}}}return w.nodes().forEach(function(g){m=[],b(g),m.length&&p.push(m)}),p}}}),c=n({"lib/data/priority-queue.js"(T,j){var q=class{constructor(){i(this,"_arr",[]),i(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(w){return w.key})}has(w){return Object.hasOwn(this._keyIndices,w)}priority(w){var _=this._keyIndices[w];if(_!==void 0)return this._arr[_].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(w,_){var p=this._keyIndices;if(w=String(w),!Object.hasOwn(p,w)){var m=this._arr,b=m.length;return p[w]=b,m.push({key:w,priority:_}),this._decrease(b),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var w=this._arr.pop();return delete this._keyIndices[w.key],this._heapify(0),w.key}decrease(w,_){var p=this._keyIndices[w];if(_>this._arr[p].priority)throw new Error("New priority is greater than current priority. Key: "+w+" Old: "+this._arr[p].priority+" New: "+_);this._arr[p].priority=_,this._decrease(p)}_heapify(w){for(var _=this._arr;;){var p=2*w,m=p+1,b=w;if(p<_.length)if(b=_[p].priority<_[b].priority?p:b,m<_.length&&(b=_[m].priority<_[b].priority?m:b),b!==w)this._swap(w,b),w=b;else break;else break}}_decrease(w){for(var _=this._arr,p=_[w].priority,m;w!==0&&(m=w>>1,!(_[m].priority1;function _(m,b,g,x){var v=function(l){return m.outEdges(l)};return p(m,String(b),g||w,x||v)}function p(m,b,g,x){var v={},l=new q,h,E,k=function(y){var O=y.v!==h?y.v:y.w,I=v[O],L=g(y),F=E.distance+L;if(L<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+y+" Weight: "+L);F0&&(h=l.removeMin(),E=v[h],E.distance!==Number.POSITIVE_INFINITY);)x(h).forEach(k);return v}}}),C=n({"lib/alg/dijkstra-all.js"(T,j){var q=N();j.exports=w;function w(_,p,m){return _.nodes().reduce(function(b,g){return b[g]=q(_,g,p,m),b},{})}}}),S=n({"lib/alg/extract-path.js"(T,j){j.exports=q;function q(_,p,m){if(_[p].predecessor!==void 0)throw new Error("Invalid source vertex");if(_[m].predecessor===void 0&&m!==p)throw new Error("Invalid destination vertex");return{weight:_[m].distance,path:w(_,p,m)}}function w(_,p,m){for(var b=[],g=m;g!==p;)b.push(g),g=_[g].predecessor;return b.push(p),b.reverse()}}}),M=n({"lib/alg/tarjan.js"(T,j){j.exports=q;function q(w){var _=0,p=[],m={},b=[];function g(x){var v=[[x,0]];for(m[x]={onStack:!0,lowlink:_,index:_++},p.push(x);v.length>0;){var l=v[v.length-1],h=l[0],E=w.successors(h),k=l[1];if(k0){var I=v[v.length-1][0];m[I].lowlink=Math.min(m[I].lowlink,O.lowlink)}if(O.lowlink===O.index){var L=[],F;do F=p.pop(),m[F].onStack=!1,L.push(F);while(h!==F);b.push(L)}}}}return w.nodes().forEach(function(x){Object.hasOwn(m,x)||g(x)}),b}}}),P=n({"lib/alg/find-cycles.js"(T,j){var q=M();j.exports=w;function w(_){return q(_).filter(function(p){return p.length>1||p.length===1&&_.hasEdge(p[0],p[0])})}}}),D=n({"lib/alg/floyd-warshall.js"(T,j){j.exports=w;var q=()=>1;function w(p,m,b){return _(p,m||q,b||function(g){return p.outEdges(g)})}function _(p,m,b){var g={},x=p.nodes();return x.forEach(function(v){g[v]={},g[v][v]={distance:0},x.forEach(function(l){v!==l&&(g[v][l]={distance:Number.POSITIVE_INFINITY})}),b(v).forEach(function(l){var h=l.v===v?l.w:l.v,E=m(l);g[v][h]={distance:E,predecessor:v}})}),x.forEach(function(v){var l=g[v];x.forEach(function(h){var E=g[h];x.forEach(function(k){var y=E[v],O=l[k],I=E[k],L=y.distance+O.distance;L0;){var l=v[v.length-1],h=l[0],E=l[1];if(E===0){if(Object.hasOwn(m,h))throw new w;if(Object.hasOwn(p,h)){v.pop();continue}m[h]=!0,p[h]=!0}var k=_.predecessors(h);E0;){for(var h=l[l.length-1],E=h[0],k=g(E),y=h[1],O=!1,I=y;I0;){if(v=x.removeMin(),Object.hasOwn(g,v))b.setEdge(v,g[v]);else{if(h)throw new Error("Input graph is not connected: "+p);h=!0}p.nodeEdges(v).forEach(l)}return b}}}),$r=n({"lib/alg/shortest-paths.js"(T,j){var q=N(),w=u();j.exports=_;function _(m,b,g,x){return p(m,b,g,x||function(v){return m.outEdges(v)})}function p(m,b,g,x){if(g===void 0)return q(m,b,g,x);for(var v=!1,l=m.nodes(),h=0;h{var ee=class{constructor(){let r={};r._next=r._prev=r,this._sentinel=r}dequeue(){let r=this._sentinel,t=r._prev;if(t!==r)return be(t),t}enqueue(r){let t=this._sentinel;r._prev&&r._next&&be(r),r._next=t._next,t._next._prev=r,t._next=r,r._prev=t}toString(){let r=[],t=this._sentinel,n=t._prev;for(;n!==t;)r.push(JSON.stringify(n,nt)),n=n._prev;return"["+r.join(", ")+"]"}};function be(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function nt(e,r){if(e!=="_next"&&e!=="_prev")return r}ve.exports=ee});var ge=R((Wi,we)=>{var it=A().Graph,st=me();we.exports=ot;var at=()=>1;function ot(e,r){if(e.nodeCount()<=1)return[];let t=dt(e,r||at);return lt(t.graph,t.buckets,t.zeroIdx).flatMap(i=>e.outEdges(i.v,i.w))}function lt(e,r,t){let n=[],i=r[r.length-1],a=r[0],s;for(;e.nodeCount();){for(;s=a.dequeue();)re(e,r,t,s);for(;s=i.dequeue();)re(e,r,t,s);if(e.nodeCount()){for(let o=r.length-2;o>0;--o)if(s=r[o].dequeue(),s){n=n.concat(re(e,r,t,s,!0));break}}}return n}function re(e,r,t,n,i){let a=i?[]:void 0;return e.inEdges(n.v).forEach(s=>{let o=e.edge(s),d=e.node(s.v);i&&a.push({v:s.v,w:s.w}),d.out-=o,te(r,t,d)}),e.outEdges(n.v).forEach(s=>{let o=e.edge(s),d=s.w,u=e.node(d);u.in-=o,te(r,t,u)}),e.removeNode(n.v),a}function dt(e,r){let t=new it,n=0,i=0;e.nodes().forEach(o=>{t.setNode(o,{v:o,in:0,out:0})}),e.edges().forEach(o=>{let d=t.edge(o.v,o.w)||0,u=r(o),f=d+u;t.setEdge(o.v,o.w,f),i=Math.max(i,t.node(o.v).out+=u),n=Math.max(n,t.node(o.w).in+=u)});let a=ut(i+n+3).map(()=>new st),s=n+1;return t.nodes().forEach(o=>{te(a,s,t.node(o))}),{graph:t,buckets:a,zeroIdx:s}}function te(e,r,t){t.out?t.in?e[t.out-t.in+r].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}function ut(e){let r=[];for(let t=0;t{"use strict";var Ee=A().Graph;Oe.exports={addBorderNode:gt,addDummyNode:_e,applyWithChunking:Q,asNonCompoundGraph:ft,buildLayerMatrix:vt,intersectRect:bt,mapValues:Ot,maxRank:ke,normalizeRanks:mt,notime:kt,partition:Et,pick:yt,predecessorWeights:pt,range:ye,removeEmptyRanks:wt,simplify:ht,successorWeights:ct,time:_t,uniqueId:xe,zipObject:ne};function _e(e,r,t,n){for(var i=n;e.hasNode(i);)i=xe(n);return t.dummy=r,e.setNode(i,t),i}function ht(e){let r=new Ee().setGraph(e.graph());return e.nodes().forEach(t=>r.setNode(t,e.node(t))),e.edges().forEach(t=>{let n=r.edge(t.v,t.w)||{weight:0,minlen:1},i=e.edge(t);r.setEdge(t.v,t.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),r}function ft(e){let r=new Ee({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(t=>{e.children(t).length||r.setNode(t,e.node(t))}),e.edges().forEach(t=>{r.setEdge(t,e.edge(t))}),r}function ct(e){let r=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(i=>{n[i.w]=(n[i.w]||0)+e.edge(i).weight}),n});return ne(e.nodes(),r)}function pt(e){let r=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(i=>{n[i.v]=(n[i.v]||0)+e.edge(i).weight}),n});return ne(e.nodes(),r)}function bt(e,r){let t=e.x,n=e.y,i=r.x-t,a=r.y-n,s=e.width/2,o=e.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let d,u;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),d=o*i/a,u=o):(i<0&&(s=-s),d=s,u=s*a/i),{x:t+d,y:n+u}}function vt(e){let r=ye(ke(e)+1).map(()=>[]);return e.nodes().forEach(t=>{let n=e.node(t),i=n.rank;i!==void 0&&(r[i][n.order]=t)}),r}function mt(e){let r=e.nodes().map(n=>{let i=e.node(n).rank;return i===void 0?Number.MAX_VALUE:i}),t=Q(Math.min,r);e.nodes().forEach(n=>{let i=e.node(n);Object.hasOwn(i,"rank")&&(i.rank-=t)})}function wt(e){let r=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),t=Q(Math.min,r),n=[];e.nodes().forEach(s=>{let o=e.node(s).rank-t;n[o]||(n[o]=[]),n[o].push(s)});let i=0,a=e.graph().nodeRankFactor;Array.from(n).forEach((s,o)=>{s===void 0&&o%a!==0?--i:s!==void 0&&i&&s.forEach(d=>e.node(d).rank+=i)})}function gt(e,r,t,n){let i={width:0,height:0};return arguments.length>=4&&(i.rank=t,i.order=n),_e(e,"border",i,r)}function Q(e,r){if(r.length===0)return e();let t=r[0];for(let n=1;n{let i=e.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return Q(Math.max,t)}function Et(e,r){let t={lhs:[],rhs:[]};return e.forEach(n=>{r(n)?t.lhs.push(n):t.rhs.push(n)}),t}function _t(e,r){let t=Date.now();try{return r()}finally{console.log(e+" time: "+(Date.now()-t)+"ms")}}function kt(e,r){return r()}var xt=0;function xe(e){var r=++xt;return e+(""+r)}function ye(e,r,t=1){r==null&&(r=e,e=0);let n=a=>arn[r]),Object.entries(e).reduce((n,[i,a])=>(n[i]=t(a,i),n),{})}function ne(e,r){return e.reduce((t,n,i)=>(t[n]=r[i],t),{})}});var je=R((Ui,Ne)=>{"use strict";var Nt=ge(),jt=G().uniqueId;Ne.exports={run:It,undo:qt};function It(e){(e.graph().acyclicer==="greedy"?Nt(e,t(e)):Ct(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,jt("rev"))});function t(n){return i=>n.edge(i).weight}}function Ct(e){let r=[],t={},n={};function i(a){let s=[[a,0]];for(;s.length>0;){let[o,d]=s[s.length-1];if(d===0){if(Object.hasOwn(n,o)){s.pop();continue}n[o]=!0,t[o]=!0}let u=e.outEdges(o);if(d{let t=e.edge(r);if(t.reversed){e.removeEdge(r);let n=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(r.w,r.v,t,n)}})}});var Ce=R((Hi,Ie)=>{"use strict";var Lt=G();Ie.exports={run:Tt,undo:Mt};function Tt(e){e.graph().dummyChains=[],e.edges().forEach(r=>Rt(e,r))}function Rt(e,r){let t=r.v,n=e.node(t).rank,i=r.w,a=e.node(i).rank,s=r.name,o=e.edge(r),d=o.labelRank;if(a===n+1)return;e.removeEdge(r);let u,f,c;for(c=0,++n;n{let t=e.node(r),n=t.edgeLabel,i;for(e.setEdge(t.edgeObj,n);t.dummy;)i=e.successors(r)[0],e.removeNode(r),n.points.push({x:t.x,y:t.y}),t.dummy==="edge-label"&&(n.x=t.x,n.y=t.y,n.width=t.width,n.height=t.height),r=i,t=e.node(r)})}});var H=R((Xi,qe)=>{"use strict";var{applyWithChunking:St}=G();qe.exports={longestPath:Pt,slack:Ft};function Pt(e){var r={};function t(n){let i=[[n,!1]];for(;i.length>0;){let[o,d]=i[i.length-1];if(Object.hasOwn(r,o)){i.pop();continue}if(d){i.pop(),r[o]=!0;var a=e.node(o);let u=e.outEdges(o).map(f=>f==null?Number.POSITIVE_INFINITY:e.node(f.w).rank-e.edge(f).minlen);var s=St(Math.min,u);s===Number.POSITIVE_INFINITY&&(s=0),a.rank=s}else{i[i.length-1][1]=!0;let u=e.outEdges(o);for(let f=u.length-1;f>=0;f--){let c=u[f];c!=null&&!Object.hasOwn(r,c.w)&&i.push([c.w,!1])}}}}e.sources().forEach(t)}function Ft(e,r){return e.node(r.w).rank-e.node(r.v).rank-e.edge(r).minlen}});var ie=R((Qi,Le)=>{"use strict";var Gt=A().Graph,J=H().slack;Le.exports=Dt;function Dt(e){var r=new Gt({directed:!1}),t=e.nodes()[0],n=e.nodeCount();r.setNode(t,{});for(var i,a;At(r,e)0;){let a=i.pop();r.nodeEdges(a).forEach(s=>{var o=s.v,d=a===o?s.w:o;!e.hasNode(d)&&!J(r,s)&&(e.setNode(d,{}),e.setEdge(a,d,{}),i.push(d))})}}return e.nodes().forEach(t),e.nodeCount()}function Vt(e,r){return r.edges().reduce((n,i)=>{let a=Number.POSITIVE_INFINITY;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=J(r,i)),ar.node(n).rank+=t)}});var De=R((Ji,Ge)=>{"use strict";var Bt=ie(),Te=H().slack,Wt=H().longestPath,zt=A().alg.preorder,Ut=A().alg.postorder,Ht=G().simplify;Ge.exports=W;W.initLowLimValues=ae;W.initCutValues=se;W.calcCutValue=Me;W.leaveEdge=Se;W.enterEdge=Pe;W.exchangeEdges=Fe;function W(e){e=Ht(e),Wt(e);var r=Bt(e);ae(r),se(r,e);for(var t,n;t=Se(r);)n=Pe(r,e,t),Fe(r,e,t,n)}function se(e,r){var t=Ut(e,e.nodes());t=t.slice(0,t.length-1),t.forEach(n=>Xt(e,r,n))}function Xt(e,r,t){var n=e.node(t),i=n.parent;e.edge(t,i).cutvalue=Me(e,r,t)}function Me(e,r,t){var n=e.node(t),i=n.parent,a=!0,s=r.edge(t,i),o=0;return s||(a=!1,s=r.edge(i,t)),o=s.weight,r.nodeEdges(t).forEach(d=>{var u=d.v===t,f=u?d.w:d.v;if(f!==i){var c=u===a,N=r.edge(d).weight;if(o+=c?N:-N,Kt(e,t,f)){var C=e.edge(t,f).cutvalue;o+=c?-C:C}}}),o}function ae(e,r){arguments.length<2&&(r=e.nodes()[0]),Qt(e,{},1,r)}function Qt(e,r,t,n,i){let a=[[n,i,0,t]];for(;a.length>0;){let s=a[a.length-1],[o,d,u,f]=s;u===0&&(r[o]=!0);let c=e.neighbors(o),N=!1;for(let C=u;Ce.edge(r).cutvalue<0)}function Pe(e,r,t){var n=t.v,i=t.w;r.hasEdge(n,i)||(n=t.w,i=t.v);var a=e.node(n),s=e.node(i),o=a,d=!1;a.lim>s.lim&&(o=s,d=!0);var u=r.edges().filter(f=>d===Re(e,e.node(f.v),o)&&d!==Re(e,e.node(f.w),o));return u.reduce((f,c)=>Te(r,c)!r.node(i).parent),n=zt(e,t);n=n.slice(1),n.forEach(i=>{var a=e.node(i).parent,s=r.edge(i,a),o=!1;s||(s=r.edge(a,i),o=!0),r.node(i).rank=r.node(a).rank+(o?s.minlen:-s.minlen)})}function Kt(e,r,t){return e.hasEdge(r,t)}function Re(e,r,t){return t.low<=r.lim&&r.lim<=t.lim}});var Be=R((Ki,Ye)=>{"use strict";var Zt=H(),Ve=Zt.longestPath,$t=ie(),en=De();Ye.exports=rn;function rn(e){var r=e.graph().ranker;if(r instanceof Function)return r(e);switch(e.graph().ranker){case"network-simplex":Ae(e);break;case"tight-tree":nn(e);break;case"longest-path":tn(e);break;case"none":break;default:Ae(e)}}var tn=Ve;function nn(e){Ve(e),$t(e)}function Ae(e){en(e)}});var ze=R((Zi,We)=>{We.exports=sn;function sn(e){let r=on(e);e.graph().dummyChains.forEach(t=>{let n=e.node(t),i=n.edgeObj,a=an(e,r,i.v,i.w),s=a.path,o=a.lca,d=0,u=s[d],f=!0;for(;t!==i.w;){if(n=e.node(t),f){for(;(u=s[d])!==o&&e.node(u).maxRanks||o>r[d].lim));for(u=d,d=n;(d=e.parent(d))!==u;)a.push(d);return{path:i.concat(a.reverse()),lca:u}}function on(e){let r={},t=0,n=[];for(e.children().forEach(i=>n.push([i,!1,0]));n.length>0;){let i=n[n.length-1],[a,s]=i;if(s)n.pop(),r[a]={low:i[2],lim:t++};else{i[1]=!0,i[2]=t;let o=e.children(a);for(let d=o.length-1;d>=0;d--)n.push([o[d],!1,0])}}return r}});var He=R(($i,Ue)=>{var K=G();Ue.exports={run:ln,cleanup:fn};function ln(e){let r=K.addDummyNode(e,"root",{},"_root"),t=un(e),n=Object.values(t),i=K.applyWithChunking(Math.max,n)-1,a=2*i+1;e.graph().nestingRoot=r,e.edges().forEach(o=>e.edge(o).minlen*=a);let s=hn(e)+1;e.children().forEach(o=>dn(e,r,a,s,i,t,o)),e.graph().nodeRankFactor=a}function dn(e,r,t,n,i,a,s){let o=[[s,!1]];for(;o.length>0;){let d=o[o.length-1],[u,f]=d,c=e.children(u);if(!c.length){o.pop(),u!==r&&e.setEdge(r,u,{weight:0,minlen:t});continue}if(!f){d[1]=!0;for(let M=c.length-1;M>=0;M--)o.push([c[M],!1]);continue}o.pop();let N=K.addBorderNode(e,"_bt"),C=K.addBorderNode(e,"_bb"),S=e.node(u);e.setParent(N,u),S.borderTop=N,e.setParent(C,u),S.borderBottom=C,c.forEach(M=>{let P=e.node(M),D=P.borderTop?P.borderTop:M,Y=P.borderBottom?P.borderBottom:M,X=P.borderTop?n:2*n,z=D!==Y?1:i-a[u]+1;e.setEdge(N,D,{weight:X,minlen:z,nestingEdge:!0}),e.setEdge(Y,C,{weight:X,minlen:z,nestingEdge:!0})}),e.parent(u)||e.setEdge(r,N,{weight:0,minlen:i+a[u]})}}function un(e){var r={};let t=[];for(e.children().forEach(i=>t.push([i,1]));t.length>0;){let[i,a]=t.pop();var n=e.children(i);n&&n.length&&n.forEach(s=>t.push([s,a+1])),r[i]=a}return r}function hn(e){return e.edges().reduce((r,t)=>r+e.edge(t).weight,0)}function fn(e){var r=e.graph();e.removeNode(r.nestingRoot),delete r.nestingRoot,e.edges().forEach(t=>{var n=e.edge(t);n.nestingEdge&&e.removeEdge(t)})}});var Je=R((es,Qe)=>{var cn=G();Qe.exports=pn;function pn(e){let r=[];for(e.children().forEach(t=>r.push([t,!1]));r.length>0;){let t=r[r.length-1],[n,i]=t,a=e.children(n);if(a.length&&!i){t[1]=!0;for(let o=a.length-1;o>=0;o--)r.push([a[o],!1]);continue}r.pop();let s=e.node(n);if(Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let o=s.minRank,d=s.maxRank+1;o{"use strict";$e.exports={adjust:bn,undo:vn};function bn(e){let r=e.graph().rankdir.toLowerCase();(r==="lr"||r==="rl")&&Ze(e)}function vn(e){let r=e.graph().rankdir.toLowerCase();(r==="bt"||r==="rl")&&mn(e),(r==="lr"||r==="rl")&&(wn(e),Ze(e))}function Ze(e){e.nodes().forEach(r=>Ke(e.node(r))),e.edges().forEach(r=>Ke(e.edge(r)))}function Ke(e){let r=e.width;e.width=e.height,e.height=r}function mn(e){e.nodes().forEach(r=>oe(e.node(r))),e.edges().forEach(r=>{let t=e.edge(r);t.points.forEach(oe),Object.hasOwn(t,"y")&&oe(t)})}function oe(e){e.y=-e.y}function wn(e){e.nodes().forEach(r=>le(e.node(r))),e.edges().forEach(r=>{let t=e.edge(r);t.points.forEach(le),Object.hasOwn(t,"x")&&le(t)})}function le(e){let r=e.x;e.x=e.y,e.y=r}});var nr=R((ts,tr)=>{"use strict";var rr=G();tr.exports=gn;function gn(e){let r={},t=e.nodes().filter(d=>!e.children(d).length),n=t.map(d=>e.node(d).rank),i=rr.applyWithChunking(Math.max,n),a=rr.range(i+1).map(()=>[]);function s(d){let u=[d];for(;u.length>0;){let f=u.pop();if(r[f])continue;r[f]=!0;let c=e.node(f);a[c.rank].push(f);let N=e.successors(f);for(let C=N.length-1;C>=0;C--)u.push(N[C])}}return t.sort((d,u)=>e.node(d).rank-e.node(u).rank).forEach(s),a}});var sr=R((ns,ir)=>{"use strict";var En=G().zipObject;ir.exports=_n;function _n(e,r){let t=0;for(let n=1;nf)),i=r.flatMap(u=>e.outEdges(u).map(f=>({pos:n[f.w],weight:e.edge(f).weight})).sort((f,c)=>f.pos-c.pos)),a=1;for(;a{let f=u.pos+a;o[f]+=u.weight;let c=0;for(;f>0;)f%2&&(c+=o[f+1]),f=f-1>>1,o[f]+=u.weight;d+=u.weight*c}),d}});var or=R((is,ar)=>{ar.exports=xn;function xn(e,r=[]){return r.map(t=>{let n=e.inEdges(t);if(n.length){let i=n.reduce((a,s)=>{let o=e.edge(s),d=e.node(s.v);return{sum:a.sum+o.weight*d.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:t}})}});var dr=R((ss,lr)=>{"use strict";var yn=G();lr.exports=On;function On(e,r){let t={};e.forEach((i,a)=>{let s=t[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};i.barycenter!==void 0&&(s.barycenter=i.barycenter,s.weight=i.weight)}),r.edges().forEach(i=>{let a=t[i.v],s=t[i.w];a!==void 0&&s!==void 0&&(s.indegree++,a.out.push(t[i.w]))});let n=Object.values(t).filter(i=>!i.indegree);return Nn(n)}function Nn(e){let r=[];function t(i){return a=>{a.merged||(a.barycenter===void 0||i.barycenter===void 0||a.barycenter>=i.barycenter)&&jn(i,a)}}function n(i){return a=>{a.in.push(i),--a.indegree===0&&e.push(a)}}for(;e.length;){let i=e.pop();r.push(i),i.in.reverse().forEach(t(i)),i.out.forEach(n(i))}return r.filter(i=>!i.merged).map(i=>yn.pick(i,["vs","i","barycenter","weight"]))}function jn(e,r){let t=0,n=0;e.weight&&(t+=e.barycenter*e.weight,n+=e.weight),r.weight&&(t+=r.barycenter*r.weight,n+=r.weight),e.vs=r.vs.concat(e.vs),e.barycenter=t/n,e.weight=n,e.i=Math.min(r.i,e.i),r.merged=!0}});var fr=R((as,hr)=>{var In=G();hr.exports=Cn;function Cn(e,r){let t=In.partition(e,f=>Object.hasOwn(f,"barycenter")),n=t.lhs,i=t.rhs.sort((f,c)=>c.i-f.i),a=[],s=0,o=0,d=0;n.sort(qn(!!r)),d=ur(a,i,d),n.forEach(f=>{d+=f.vs.length,a.push(f.vs),s+=f.barycenter*f.weight,o+=f.weight,d=ur(a,i,d)});let u={vs:a.flat(!0)};return o&&(u.barycenter=s/o,u.weight=o),u}function ur(e,r,t){let n;for(;r.length&&(n=r[r.length-1]).i<=t;)r.pop(),e.push(n.vs),t++;return t}function qn(e){return(r,t)=>r.barycentert.barycenter?1:e?t.i-r.i:r.i-t.i}});var br=R((os,pr)=>{var cr=or(),Ln=dr(),Tn=fr();pr.exports=Rn;function Rn(e,r,t,n){let i=[],a=[r];for(;a.length>0;){let o=a.pop();i.push(o);let d=e.children(o),u=e.node(o),f=u?u.borderLeft:void 0;f&&(d=d.filter(N=>N!==f&&N!==u.borderRight));let c=cr(e,d);for(let N=c.length-1;N>=0;N--)e.children(c[N].v).length&&a.push(c[N].v)}let s={};for(let o=i.length-1;o>=0;o--){let d=i[o],u=e.children(d),f=e.node(d),c=f?f.borderLeft:void 0,N=f?f.borderRight:void 0,C={};c&&(u=u.filter(D=>D!==c&&D!==N));let S=cr(e,u);S.forEach(D=>{if(e.children(D.v).length){let Y=s[D.v];C[D.v]=Y,Object.hasOwn(Y,"barycenter")&&Sn(D,Y)}});let M=Ln(S,t);Mn(M,C);let P=Tn(M,n);if(c&&(P.vs=[c,P.vs,N].flat(!0),e.predecessors(c).length)){let D=e.node(e.predecessors(c)[0]),Y=e.node(e.predecessors(N)[0]);Object.hasOwn(P,"barycenter")||(P.barycenter=0,P.weight=0),P.barycenter=(P.barycenter*P.weight+D.order+Y.order)/(P.weight+2),P.weight+=2}s[d]=P}return s[r]}function Mn(e,r){e.forEach(t=>{t.vs=t.vs.flatMap(n=>r[n]?r[n].vs:n)})}function Sn(e,r){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+r.barycenter*r.weight)/(e.weight+r.weight),e.weight+=r.weight):(e.barycenter=r.barycenter,e.weight=r.weight)}});var mr=R((ls,vr)=>{var Pn=A().Graph,Fn=G();vr.exports=Gn;function Gn(e,r,t,n){n||(n=e.nodes());let i=Dn(e),a=new Pn({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(s=>e.node(s));return n.forEach(s=>{let o=e.node(s),d=e.parent(s);(o.rank===r||o.minRank<=r&&r<=o.maxRank)&&(a.setNode(s),a.setParent(s,d||i),e[t](s).forEach(u=>{let f=u.v===s?u.w:u.v,c=a.edge(f,s),N=c!==void 0?c.weight:0;a.setEdge(f,s,{weight:e.edge(u).weight+N})}),Object.hasOwn(o,"minRank")&&a.setNode(s,{borderLeft:o.borderLeft[r],borderRight:o.borderRight[r]}))}),a}function Dn(e){for(var r;e.hasNode(r=Fn.uniqueId("_root")););return r}});var gr=R((ds,wr)=>{wr.exports=An;function An(e,r,t){let n={},i;t.forEach(a=>{let s=e.parent(a),o,d;for(;s;){if(o=e.parent(s),o?(d=n[o],n[o]=s):(d=i,i=s),d&&d!==s){r.setEdge(d,s);return}s=o}})}});var yr=R((us,xr)=>{"use strict";var Vn=nr(),Yn=sr(),Bn=br(),Wn=mr(),zn=gr(),Un=A().Graph,Z=G();xr.exports=kr;function kr(e,r={}){if(typeof r.customOrder=="function"){r.customOrder(e,kr);return}let t=Z.maxRank(e),n=Er(e,Z.range(1,t+1),"inEdges"),i=Er(e,Z.range(t-1,-1,-1),"outEdges"),a=Vn(e);if(_r(e,a),r.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,o,d=r.constraints||[];for(let u=0,f=0;f<4;++u,++f){Hn(u%2?n:i,u%4>=2,d),a=Z.buildLayerMatrix(e);let c=Yn(e,a);c{n.has(a)||n.set(a,[]),n.get(a).push(s)};for(let a of e.nodes()){let s=e.node(a);if(typeof s.rank=="number"&&i(s.rank,a),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let o=s.minRank;o<=s.maxRank;o++)o!==s.rank&&i(o,a)}return r.map(function(a){return Wn(e,a,t,n.get(a)||[])})}function Hn(e,r,t){let n=new Un;e.forEach(function(i){t.forEach(o=>n.setEdge(o.left,o.right));let a=i.graph().root,s=Bn(i,a,n,r);s.vs.forEach((o,d)=>i.node(o).order=d),zn(i,n,s.vs)})}function _r(e,r){Object.values(r).forEach(t=>t.forEach((n,i)=>e.node(n).order=i))}});var Mr=R((hs,Rr)=>{"use strict";var Xn=A().Graph,B=G();Rr.exports={positionX:Kn,findType1Conflicts:Or,findType2Conflicts:Nr,addConflict:de,hasConflict:jr,verticalAlignment:Ir,horizontalCompaction:Cr,alignCoordinates:Lr,findSmallestWidthAlignment:qr,balance:Tr};function Or(e,r){let t={};function n(i,a){let s=0,o=0,d=i.length,u=a[a.length-1];return a.forEach((f,c)=>{let N=Qn(e,f),C=N?e.node(N).order:d;(N||f===u)&&(a.slice(o,c+1).forEach(S=>{e.predecessors(S).forEach(M=>{let P=e.node(M),D=P.order;(D{f=a[c],e.node(f).dummy&&e.predecessors(f).forEach(N=>{let C=e.node(N);C.dummy&&(C.orderu)&&de(t,N,f)})})}function i(a,s){let o=-1,d,u=0;return s.forEach((f,c)=>{if(e.node(f).dummy==="border"){let N=e.predecessors(f);N.length&&(d=e.node(N[0]).order,n(s,u,c,o,d),u=c,o=d)}n(s,u,s.length,d,a.length)}),s}return r.length&&r.reduce(i),t}function Qn(e,r){if(e.node(r).dummy)return e.predecessors(r).find(t=>e.node(t).dummy)}function de(e,r,t){if(r>t){let i=r;r=t,t=i}let n=e[r];n||(e[r]=n={}),n[t]=!0}function jr(e,r,t){if(r>t){let n=r;r=t,t=n}return!!e[r]&&Object.hasOwn(e[r],t)}function Ir(e,r,t,n){let i={},a={},s={};return r.forEach(o=>{o.forEach((d,u)=>{i[d]=d,a[d]=d,s[d]=u})}),r.forEach(o=>{let d=-1;o.forEach(u=>{let f=n(u);if(f.length){f=f.sort((N,C)=>s[N]-s[C]);let c=(f.length-1)/2;for(let N=Math.floor(c),C=Math.ceil(c);N<=C;++N){let S=f[N];a[u]===u&&dMath.max(N,a[C.v]+s.edge(C)),0)}function f(c){let N=s.outEdges(c).reduce((S,M)=>Math.min(S,a[M.w]-s.edge(M)),Number.POSITIVE_INFINITY),C=e.node(c);N!==Number.POSITIVE_INFINITY&&C.borderType!==o&&(a[c]=Math.max(a[c],N))}return d(u,s.predecessors.bind(s)),d(f,s.successors.bind(s)),Object.keys(n).forEach(c=>a[c]=a[t[c]]),a}function Jn(e,r,t,n){let i=new Xn,a=e.graph(),s=Zn(a.nodesep,a.edgesep,n);return r.forEach(o=>{let d;o.forEach(u=>{let f=t[u];if(i.setNode(f),d){var c=t[d],N=i.edge(c,f);i.setEdge(c,f,Math.max(s(e,u,d),N||0))}d=u})}),i}function qr(e,r){return Object.values(r).reduce((t,n)=>{let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([o,d])=>{let u=$n(e,o)/2;i=Math.max(d+u,i),a=Math.min(d-u,a)});let s=i-a;return s{["l","r"].forEach(s=>{let o=a+s,d=e[o];if(d===r)return;let u=Object.values(d),f=n-B.applyWithChunking(Math.min,u);s!=="l"&&(f=i-B.applyWithChunking(Math.max,u)),f&&(e[o]=B.mapValues(d,c=>c+f))})})}function Tr(e,r){return B.mapValues(e.ul,(t,n)=>{if(r)return e[r.toLowerCase()][n];{let i=Object.values(e).map(a=>a[n]).sort((a,s)=>a-s);return(i[1]+i[2])/2}})}function Kn(e){let r=B.buildLayerMatrix(e),t=Object.assign(Or(e,r),Nr(e,r)),n={},i;["u","d"].forEach(s=>{i=s==="u"?r:Object.values(r).reverse(),["l","r"].forEach(o=>{o==="r"&&(i=i.map(c=>Object.values(c).reverse()));let d=(s==="u"?e.predecessors:e.successors).bind(e),u=Ir(e,i,t,d),f=Cr(e,i,u.root,u.align,o==="r");o==="r"&&(f=B.mapValues(f,c=>-c)),n[s+o]=f})});let a=qr(e,n);return Lr(n,a),Tr(n,e.graph().align)}function Zn(e,r,t){return(n,i,a)=>{let s=n.node(i),o=n.node(a),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=0,d+=(s.dummy?r:e)/2,d+=(o.dummy?r:e)/2,d+=o.width/2,Object.hasOwn(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=o.width/2;break;case"r":u=-o.width/2;break}return u&&(d+=t?u:-u),u=0,d}}function $n(e,r){return e.node(r).width}});var Fr=R((fs,Pr)=>{"use strict";var Sr=G(),ei=Mr().positionX;Pr.exports=ri;function ri(e){e=Sr.asNonCompoundGraph(e),ti(e),Object.entries(ei(e)).forEach(([r,t])=>e.node(r).x=t)}function ti(e){let r=Sr.buildLayerMatrix(e),t=e.graph().ranksep,n=e.graph().rankalign,i=0;r.forEach(a=>{let s=a.reduce((o,d)=>{let u=e.node(d).height;return o>u?o:u},0);a.forEach(o=>{let d=e.node(o);n==="top"?d.y=i+d.height/2:n==="bottom"?d.y=i+s-d.height/2:d.y=i+s/2}),i+=s+t})}});var Wr=R((cs,Br)=>{"use strict";var Gr=je(),Dr=Ce(),ni=Be(),ii=G().normalizeRanks,si=ze(),ai=G().removeEmptyRanks,Ar=He(),oi=Je(),Vr=er(),li=yr(),di=Fr(),V=G(),ui=A().Graph;Br.exports=hi;function hi(e,r={}){let t=r.debugTiming?V.time:V.notime;return t("layout",()=>{let n=t(" buildLayoutGraph",()=>_i(e));return t(" runLayout",()=>fi(n,t,r)),t(" updateInputGraph",()=>ci(e,n)),n})}function fi(e,r,t){r(" makeSpaceForEdgeLabels",()=>ki(e)),r(" removeSelfEdges",()=>Li(e)),r(" acyclic",()=>Gr.run(e)),r(" nestingGraph.run",()=>Ar.run(e)),r(" rank",()=>ni(V.asNonCompoundGraph(e))),r(" injectEdgeLabelProxies",()=>xi(e)),r(" removeEmptyRanks",()=>ai(e)),r(" nestingGraph.cleanup",()=>Ar.cleanup(e)),r(" normalizeRanks",()=>ii(e)),r(" assignRankMinMax",()=>yi(e)),r(" removeEdgeLabelProxies",()=>Oi(e)),r(" normalize.run",()=>Dr.run(e)),r(" parentDummyChains",()=>si(e)),r(" addBorderSegments",()=>oi(e)),r(" order",()=>li(e,t)),r(" insertSelfEdges",()=>Ti(e)),r(" adjustCoordinateSystem",()=>Vr.adjust(e)),r(" position",()=>di(e)),r(" positionSelfEdges",()=>Ri(e)),r(" removeBorderNodes",()=>qi(e)),r(" normalize.undo",()=>Dr.undo(e)),r(" fixupEdgeLabelCoords",()=>Ii(e)),r(" undoCoordinateSystem",()=>Vr.undo(e)),r(" translateGraph",()=>Ni(e)),r(" assignNodeIntersects",()=>ji(e)),r(" reversePoints",()=>Ci(e)),r(" acyclic.undo",()=>Gr.undo(e))}function ci(e,r){e.nodes().forEach(t=>{let n=e.node(t),i=r.node(t);n&&(n.x=i.x,n.y=i.y,n.order=i.order,n.rank=i.rank,r.children(t).length&&(n.width=i.width,n.height=i.height))}),e.edges().forEach(t=>{let n=e.edge(t),i=r.edge(t);n.points=i.points,Object.hasOwn(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=r.graph().width,e.graph().height=r.graph().height}var pi=["nodesep","edgesep","ranksep","marginx","marginy"],bi={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb",rankalign:"center"},vi=["acyclicer","ranker","rankdir","align","rankalign"],mi=["width","height","rank"],Yr={width:0,height:0},wi=["minlen","weight","width","height","labeloffset"],gi={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ei=["labelpos"];function _i(e){let r=new ui({multigraph:!0,compound:!0}),t=he(e.graph());return r.setGraph(Object.assign({},bi,ue(t,pi),V.pick(t,vi))),e.nodes().forEach(n=>{let i=he(e.node(n)),a=ue(i,mi);Object.keys(Yr).forEach(s=>{a[s]===void 0&&(a[s]=Yr[s])}),r.setNode(n,a),r.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let i=he(e.edge(n));r.setEdge(n,Object.assign({},gi,ue(i,wi),V.pick(i,Ei)))}),r}function ki(e){let r=e.graph();r.ranksep/=2,e.edges().forEach(t=>{let n=e.edge(t);n.minlen*=2,n.labelpos.toLowerCase()!=="c"&&(r.rankdir==="TB"||r.rankdir==="BT"?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function xi(e){e.edges().forEach(r=>{let t=e.edge(r);if(t.width&&t.height){let n=e.node(r.v),a={rank:(e.node(r.w).rank-n.rank)/2+n.rank,e:r};V.addDummyNode(e,"edge-proxy",a,"_ep")}})}function yi(e){let r=0;e.nodes().forEach(t=>{let n=e.node(t);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,r=Math.max(r,n.maxRank))}),e.graph().maxRank=r}function Oi(e){e.nodes().forEach(r=>{let t=e.node(r);t.dummy==="edge-proxy"&&(e.edge(t.e).labelRank=t.rank,e.removeNode(r))})}function Ni(e){let r=Number.POSITIVE_INFINITY,t=0,n=Number.POSITIVE_INFINITY,i=0,a=e.graph(),s=a.marginx||0,o=a.marginy||0;function d(u){let f=u.x,c=u.y,N=u.width,C=u.height;r=Math.min(r,f-N/2),t=Math.max(t,f+N/2),n=Math.min(n,c-C/2),i=Math.max(i,c+C/2)}e.nodes().forEach(u=>d(e.node(u))),e.edges().forEach(u=>{let f=e.edge(u);Object.hasOwn(f,"x")&&d(f)}),r-=s,n-=o,e.nodes().forEach(u=>{let f=e.node(u);f.x-=r,f.y-=n}),e.edges().forEach(u=>{let f=e.edge(u);f.points.forEach(c=>{c.x-=r,c.y-=n}),Object.hasOwn(f,"x")&&(f.x-=r),Object.hasOwn(f,"y")&&(f.y-=n)}),a.width=t-r+s,a.height=i-n+o}function ji(e){e.edges().forEach(r=>{let t=e.edge(r),n=e.node(r.v),i=e.node(r.w),a,s;t.points?(a=t.points[0],s=t.points[t.points.length-1]):(t.points=[],a=i,s=n),t.points.unshift(V.intersectRect(n,a)),t.points.push(V.intersectRect(i,s))})}function Ii(e){e.edges().forEach(r=>{let t=e.edge(r);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 Ci(e){e.edges().forEach(r=>{let t=e.edge(r);t.reversed&&t.points.reverse()})}function qi(e){e.nodes().forEach(r=>{if(e.children(r).length){let t=e.node(r),n=e.node(t.borderTop),i=e.node(t.borderBottom),a=e.node(t.borderLeft[t.borderLeft.length-1]),s=e.node(t.borderRight[t.borderRight.length-1]);t.width=Math.abs(s.x-a.x),t.height=Math.abs(i.y-n.y),t.x=a.x+t.width/2,t.y=n.y+t.height/2}}),e.nodes().forEach(r=>{e.node(r).dummy==="border"&&e.removeNode(r)})}function Li(e){e.edges().forEach(r=>{if(r.v===r.w){var t=e.node(r.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:r,label:e.edge(r)}),e.removeEdge(r)}})}function Ti(e){var r=V.buildLayerMatrix(e);r.forEach(t=>{var n=0;t.forEach((i,a)=>{var s=e.node(i);s.order=a+n,(s.selfEdges||[]).forEach(o=>{V.addDummyNode(e,"selfedge",{width:o.label.width,height:o.label.height,rank:s.rank,order:a+ ++n,e:o.e,label:o.label},"_se")}),delete s.selfEdges})})}function Ri(e){e.nodes().forEach(r=>{var t=e.node(r);if(t.dummy==="selfedge"){var n=e.node(t.e.v),i=n.x+n.width/2,a=n.y,s=t.x-i,o=n.height/2;e.setEdge(t.e,t.label),e.removeNode(r),t.label.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{x:i+s,y:a},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],t.label.x=t.x,t.label.y=t.y}})}function ue(e,r){return V.mapValues(V.pick(e,r),Number)}function he(e){var r={};return e&&Object.entries(e).forEach(([t,n])=>{typeof t=="string"&&(t=t.toLowerCase()),r[t]=n}),r}});var Ur=R((ps,zr)=>{var Mi=G(),Si=A().Graph;zr.exports={debugOrdering:Pi};function Pi(e){let r=Mi.buildLayerMatrix(e),t=new Si({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(n=>{t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)}),e.edges().forEach(n=>t.setEdge(n.v,n.w,{},n.name)),r.forEach((n,i)=>{let a="layer"+i;t.setNode(a,{rank:"same"}),n.reduce((s,o)=>(t.setEdge(s,o,{style:"invis"}),o))}),t}});var Xr=R((bs,Hr)=>{Hr.exports="2.0.5-pre"});var Fi=R((vs,Qr)=>{Qr.exports={graphlib:A(),layout:Wr(),debug:Ur(),util:{time:G().time,notime:G().notime},version:Xr()}});return Fi();})(); /*! For license information please see dagre.min.js.LEGAL.txt */ //# sourceMappingURL=dagre.min.js.map