import{m as y}from"./chunk-EYG76IYJ-CzHb7yUm.js";import{Z as f,T as Y,N as ot,b as x,D,d as q,l as ie,J as m,a as O,s as b,y as _,f as Ne,c as Ee,Q as R,O as ae,t as rt,K as ue,e as T,X as I,R as z,g as it,n as S,h as at,i as ut,j as dt}from"./chunk-OMTJKCYW-Dj_8N2cP.js";import{m as d,b3 as X,b4 as st,T as ct}from"./mermaid.esm.min-DdZd6KOl.js";function E(e,n,t,o){var r;do r=ie(o);while(e.hasNode(r));return t.dummy=n,e.setNode(r,t),r}d(E,"addDummyNode");function Oe(e){var n=new y().setGraph(e.graph());return f(e.nodes(),function(t){n.setNode(t,e.node(t))}),f(e.edges(),function(t){var o=n.edge(t.v,t.w)||{weight:0,minlen:1},r=e.edge(t);n.setEdge(t.v,t.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})}),n}d(Oe,"simplify");function de(e){var n=new y({multigraph:e.isMultigraph()}).setGraph(e.graph());return f(e.nodes(),function(t){e.children(t).length||n.setNode(t,e.node(t))}),f(e.edges(),function(t){n.setEdge(t,e.edge(t))}),n}d(de,"asNonCompoundGraph");function H(e,n){var t=e.x,o=e.y,r=n.x-t,i=n.y-o,a=e.width/2,u=e.height/2;if(!r&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var s,c;return Math.abs(i)*a>Math.abs(r)*u?(i<0&&(u=-u),s=u*r/i,c=u):(r<0&&(a=-a),s=a,c=a*i/r),{x:t+s,y:o+c}}d(H,"intersectRect");function j(e){var n=m(O(se(e)+1),function(){return[]});return f(e.nodes(),function(t){var o=e.node(t),r=o.rank;b(r)||(n[r][o.order]=t)}),n}d(j,"buildLayerMatrix");function Ie(e){var n=_(m(e.nodes(),function(t){return e.node(t).rank}));f(e.nodes(),function(t){var o=e.node(t);Ne(o,"rank")&&(o.rank-=n)})}d(Ie,"normalizeRanks");function Ce(e){var n=_(m(e.nodes(),function(i){return e.node(i).rank})),t=[];f(e.nodes(),function(i){var a=e.node(i).rank-n;t[a]||(t[a]=[]),t[a].push(i)});var o=0,r=e.graph().nodeRankFactor;f(t,function(i,a){b(i)&&a%r!==0?--o:o&&f(i,function(u){e.node(u).rank+=o})})}d(Ce,"removeEmptyRanks");function K(e,n,t,o){var r={width:0,height:0};return arguments.length>=4&&(r.rank=t,r.order=o),E(e,"border",r,n)}d(K,"addBorderNode");function se(e){return x(m(e.nodes(),function(n){var t=e.node(n).rank;if(!b(t))return t}))}d(se,"maxRank");function Le(e,n){var t={lhs:[],rhs:[]};return f(e,function(o){n(o)?t.lhs.push(o):t.rhs.push(o)}),t}d(Le,"partition");function _e(e,n){var t=Ee();try{return n()}finally{console.log(e+" time: "+(Ee()-t)+"ms")}}d(_e,"time");function Pe(e,n){return n()}d(Pe,"notime");function Re(e){function n(t){var o=e.children(t),r=e.node(t);if(o.length&&f(o,n),Object.prototype.hasOwnProperty.call(r,"minRank")){r.borderLeft=[],r.borderRight=[];for(var i=r.minRank,a=r.maxRank+1;i0;--u)if(a=n[u].dequeue(),a){o=o.concat(B(e,n,t,a,!0));break}}}return o}d(Fe,"doGreedyFAS");function B(e,n,t,o,r){var i=r?[]:void 0;return f(e.inEdges(o.v),function(a){var u=e.edge(a),s=e.node(a.v);r&&i.push({v:a.v,w:a.w}),s.out-=u,$(n,t,s)}),f(e.outEdges(o.v),function(a){var u=e.edge(a),s=a.w,c=e.node(s);c.in-=u,$(n,t,c)}),e.removeNode(o.v),i}d(B,"removeNode");function Ve(e,n){var t=new y,o=0,r=0;f(e.nodes(),function(u){t.setNode(u,{v:u,in:0,out:0})}),f(e.edges(),function(u){var s=t.edge(u.v,u.w)||0,c=n(u),h=s+c;t.setEdge(u.v,u.w,h),r=Math.max(r,t.node(u.v).out+=c),o=Math.max(o,t.node(u.w).in+=c)});var i=O(r+o+3).map(function(){return new ft}),a=o+1;return f(t.nodes(),function(u){$(i,a,t.node(u))}),{graph:t,buckets:i,zeroIdx:a}}d(Ve,"buildState");function $(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}d($,"assignBucket");function Ye(e){var n=e.graph().acyclicer==="greedy"?Be(e,t(e)):De(e);f(n,function(o){var r=e.edge(o);e.removeEdge(o),r.forwardName=o.name,r.reversed=!0,e.setEdge(o.w,o.v,r,ie("rev"))});function t(o){return function(r){return o.edge(r).weight}}d(t,"weightFn")}d(Ye,"run");function De(e){var n=[],t={},o={};function r(i){Object.prototype.hasOwnProperty.call(o,i)||(o[i]=!0,t[i]=!0,f(e.outEdges(i),function(a){Object.prototype.hasOwnProperty.call(t,a.w)?n.push(a):r(a.w)}),delete t[i])}return d(r,"dfs"),f(e.nodes(),r),n}d(De,"dfsFAS");function $e(e){f(e.edges(),function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var o=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,o)}})}d($e,"undo");function qe(e){e.graph().dummyChains=[],f(e.edges(),function(n){ze(e,n)})}d(qe,"run");function ze(e,n){var t=n.v,o=e.node(t).rank,r=n.w,i=e.node(r).rank,a=n.name,u=e.edge(n),s=u.labelRank;if(i!==o+1){e.removeEdge(n);var c=void 0,h,g;for(g=0,++o;oa.lim&&(u=a,s=!0);var c=T(n.edges(),function(h){return s===ee(e,e.node(h.v),u)&&s!==ee(e,e.node(h.w),u)});return ae(c,function(h){return C(n,h)})}d(me,"enterEdge");function we(e,n,t,o){var r=t.v,i=t.w;e.removeEdge(r,i),e.setEdge(o.v,o.w,{}),W(e),J(e,n),Ue(e,n)}d(we,"exchangeEdges");function Ue(e,n){var t=ue(e.nodes(),function(r){return!n.node(r).parent}),o=Ze(e,t);o=o.slice(1),f(o,function(r){var i=e.node(r).parent,a=n.edge(r,i),u=!1;a||(a=n.edge(i,r),u=!0),n.node(r).rank=n.node(i).rank+(u?a.minlen:-a.minlen)})}d(Ue,"updateRanks");function en(e,n,t){return e.hasEdge(n,t)}d(en,"isTreeEdge");function ee(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}d(ee,"isDescendant");function nn(e){switch(e.graph().ranker){case"network-simplex":ne(e);break;case"tight-tree":tn(e);break;case"longest-path":gt(e);break;default:ne(e)}}d(nn,"rank");var gt=A;function tn(e){A(e),fe(e)}d(tn,"tightTreeRanker");function ne(e){k(e)}d(ne,"networkSimplexRanker");function on(e){var n=E(e,"root",{},"_root"),t=rn(e),o=x(I(t))-1,r=2*o+1;e.graph().nestingRoot=n,f(e.edges(),function(a){e.edge(a).minlen*=r});var i=an(e)+1;f(e.children(),function(a){be(e,n,r,i,o,t,a)}),e.graph().nodeRankFactor=r}d(on,"run");function be(e,n,t,o,r,i,a){var u=e.children(a);if(!u.length){a!==n&&e.setEdge(n,a,{weight:0,minlen:t});return}var s=K(e,"_bt"),c=K(e,"_bb"),h=e.node(a);e.setParent(s,a),h.borderTop=s,e.setParent(c,a),h.borderBottom=c,f(u,function(g){be(e,n,t,o,r,i,g);var l=e.node(g),p=l.borderTop?l.borderTop:g,v=l.borderBottom?l.borderBottom:g,w=l.borderTop?o:2*o,L=p!==v?1:r-i[a]+1;e.setEdge(s,p,{weight:w,minlen:L,nestingEdge:!0}),e.setEdge(v,c,{weight:w,minlen:L,nestingEdge:!0})}),e.parent(a)||e.setEdge(n,s,{weight:0,minlen:r+i[a]})}d(be,"dfs");function rn(e){var n={};function t(o,r){var i=e.children(o);i&&i.length&&f(i,function(a){t(a,r+1)}),n[o]=r}return d(t,"dfs"),f(e.children(),function(o){t(o,1)}),n}d(rn,"treeDepths");function an(e){return z(e.edges(),function(n,t){return n+e.edge(t).weight},0)}d(an,"sumWeights");function un(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,f(e.edges(),function(t){var o=e.edge(t);o.nestingEdge&&e.removeEdge(t)})}d(un,"cleanup");function dn(e,n,t){var o={},r;f(t,function(i){for(var a=e.parent(i),u,s;a;){if(u=e.parent(a),u?(s=o[u],o[u]=a):(s=r,r=a),s&&s!==a){n.setEdge(s,a);return}a=u}})}d(dn,"addSubgraphConstraints");function sn(e,n,t){var o=cn(e),r=new y({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(i){return e.node(i)});return f(e.nodes(),function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(r.setNode(i),r.setParent(i,u||o),f(e[t](i),function(s){var c=s.v===i?s.w:s.v,h=r.edge(c,i),g=b(h)?0:h.weight;r.setEdge(c,i,{weight:e.edge(s).weight+g})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&r.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))}),r}d(sn,"buildLayerGraph");function cn(e){for(var n;e.hasNode(n=ie("_root")););return n}d(cn,"createRootNode");function fn(e,n){for(var t=0,o=1;o0;)h%2&&(g+=u[h+1]),h=h-1>>1,u[h]+=c.weight;s+=c.weight*g})),s}d(hn,"twoLayerCrossCount");function gn(e){var n={},t=T(e.nodes(),function(u){return!e.children(u).length}),o=x(m(t,function(u){return e.node(u).rank})),r=m(O(o+1),function(){return[]});function i(u){if(!Ne(n,u)){n[u]=!0;var s=e.node(u);r[s.rank].push(u),f(e.successors(u),i)}}d(i,"dfs");var a=S(t,function(u){return e.node(u).rank});return f(a,i),r}d(gn,"initOrder");function ln(e,n){return m(n,function(t){var o=e.inEdges(t);if(o.length){var r=z(o,function(i,a){var u=e.edge(a),s=e.node(a.v);return{sum:i.sum+u.weight*s.order,weight:i.weight+u.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}d(ln,"barycenter");function pn(e,n){var t={};f(e,function(r,i){var a=t[r.v]={indegree:0,in:[],out:[],vs:[r.v],i};b(r.barycenter)||(a.barycenter=r.barycenter,a.weight=r.weight)}),f(n.edges(),function(r){var i=t[r.v],a=t[r.w];!b(i)&&!b(a)&&(a.indegree++,i.out.push(t[r.w]))});var o=T(t,function(r){return!r.indegree});return vn(o)}d(pn,"resolveConflicts");function vn(e){var n=[];function t(i){return function(a){a.merged||(b(a.barycenter)||b(i.barycenter)||a.barycenter>=i.barycenter)&&mn(i,a)}}d(t,"handleIn");function o(i){return function(a){a.in.push(i),--a.indegree===0&&e.push(a)}}for(d(o,"handleOut");e.length;){var r=e.pop();n.push(r),f(r.in.reverse(),t(r)),f(r.out,o(r))}return m(T(n,function(i){return!i.merged}),function(i){return Y(i,["vs","i","barycenter","weight"])})}d(vn,"doResolveConflicts");function mn(e,n){var t=0,o=0;e.weight&&(t+=e.barycenter*e.weight,o+=e.weight),n.weight&&(t+=n.barycenter*n.weight,o+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/o,e.weight=o,e.i=Math.min(n.i,e.i),n.merged=!0}d(mn,"mergeEntries");function wn(e,n){var t=Le(e,function(h){return Object.prototype.hasOwnProperty.call(h,"barycenter")}),o=t.lhs,r=S(t.rhs,function(h){return-h.i}),i=[],a=0,u=0,s=0;o.sort(bn(!!n)),s=te(i,r,s),f(o,function(h){s+=h.vs.length,i.push(h.vs),a+=h.barycenter*h.weight,u+=h.weight,s=te(i,r,s)});var c={vs:R(i)};return u&&(c.barycenter=a/u,c.weight=u),c}d(wn,"sort");function te(e,n,t){for(var o;n.length&&(o=D(n)).i<=t;)n.pop(),e.push(o.vs),t++;return t}d(te,"consumeUnsortable");function bn(e){return function(n,t){return n.barycentert.barycenter?1:e?t.i-n.i:n.i-t.i}}d(bn,"compareWithBias");function ye(e,n,t,o){var r=e.children(n),i=e.node(n),a=i?i.borderLeft:void 0,u=i?i.borderRight:void 0,s={};a&&(r=T(r,function(v){return v!==a&&v!==u}));var c=ln(e,r);f(c,function(v){if(e.children(v.v).length){var w=ye(e,v.v,t,o);s[v.v]=w,Object.prototype.hasOwnProperty.call(w,"barycenter")&&kn(v,w)}});var h=pn(c,t);yn(h,s);var g=wn(h,o);if(a&&(g.vs=R([a,g.vs,u]),e.predecessors(a).length)){var l=e.node(e.predecessors(a)[0]),p=e.node(e.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+l.order+p.order)/(g.weight+2),g.weight+=2}return g}d(ye,"sortSubgraph");function yn(e,n){f(e,function(t){t.vs=R(t.vs.map(function(o){return n[o]?n[o].vs:o}))})}d(yn,"expandSubgraphs");function kn(e,n){b(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}d(kn,"mergeBarycenters");function xn(e){var n=se(e),t=oe(e,O(1,n+1),"inEdges"),o=oe(e,O(n-1,-1,-1),"outEdges"),r=gn(e);re(e,r);for(var i=Number.POSITIVE_INFINITY,a,u=0,s=0;s<4;++u,++s){En(u%2?t:o,u%4>=2),r=j(e);var c=fn(e,r);ca||u>n[s].lim));for(c=s,s=o;(s=e.parent(s))!==c;)i.push(s);return{path:r.concat(i.reverse()),lca:c}}d(On,"findPath");function In(e){var n={},t=0;function o(r){var i=t;f(e.children(r),o),n[r]={low:i,lim:t++}}return d(o,"dfs"),f(e.children(),o),n}d(In,"postorder");function Cn(e,n){var t={};function o(r,i){var a=0,u=0,s=r.length,c=D(i);return f(i,function(h,g){var l=_n(e,h),p=l?e.node(l).order:s;(l||h===c)&&(f(i.slice(u,g+1),function(v){f(e.predecessors(v),function(w){var L=e.node(w),xe=L.order;(xec)&&ke(t,l,h)})})}d(o,"scan");function r(i,a){var u=-1,s,c=0;return f(a,function(h,g){if(e.node(h).dummy==="border"){var l=e.predecessors(h);l.length&&(s=e.node(l[0]).order,o(a,c,g,u,s),c=g,u=s)}o(a,c,a.length,s,i.length)}),a}return d(r,"visitLayer"),z(n,r),t}d(Ln,"findType2Conflicts");function _n(e,n){if(e.node(n).dummy)return ue(e.predecessors(n),function(t){return e.node(t).dummy})}d(_n,"findOtherInnerSegmentNode");function ke(e,n,t){if(n>t){var o=n;n=t,t=o}var r=e[n];r||(e[n]=r={}),r[t]=!0}d(ke,"addConflict");function Pn(e,n,t){if(n>t){var o=n;n=t,t=o}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],t)}d(Pn,"hasConflict");function Rn(e,n,t,o){var r={},i={},a={};return f(n,function(u){f(u,function(s,c){r[s]=s,i[s]=s,a[s]=c})}),f(n,function(u){var s=-1;f(u,function(c){var h=o(c);if(h.length){h=S(h,function(w){return a[w]});for(var g=(h.length-1)/2,l=Math.floor(g),p=Math.ceil(g);l<=p;++l){var v=h[l];i[c]===c&&s{var o=t(" buildLayoutGraph",()=>zn(e));t(" runLayout",()=>$n(o,t)),t(" updateInputGraph",()=>qn(e,o))})}d(lt,"layout");function $n(e,n){n(" makeSpaceForEdgeLabels",()=>An(e)),n(" removeSelfEdges",()=>et(e)),n(" acyclic",()=>Ye(e)),n(" nestingGraph.run",()=>on(e)),n(" rank",()=>nn(de(e))),n(" injectEdgeLabelProxies",()=>Jn(e)),n(" removeEmptyRanks",()=>Ce(e)),n(" nestingGraph.cleanup",()=>un(e)),n(" normalizeRanks",()=>Ie(e)),n(" assignRankMinMax",()=>Wn(e)),n(" removeEdgeLabelProxies",()=>Xn(e)),n(" normalize.run",()=>qe(e)),n(" parentDummyChains",()=>Nn(e)),n(" addBorderSegments",()=>Re(e)),n(" order",()=>xn(e)),n(" insertSelfEdges",()=>nt(e)),n(" adjustCoordinateSystem",()=>Te(e)),n(" position",()=>Yn(e)),n(" positionSelfEdges",()=>tt(e)),n(" removeBorderNodes",()=>Un(e)),n(" normalize.undo",()=>Ae(e)),n(" fixupEdgeLabelCoords",()=>Zn(e)),n(" undoCoordinateSystem",()=>Se(e)),n(" translateGraph",()=>Hn(e)),n(" assignNodeIntersects",()=>Kn(e)),n(" reversePoints",()=>Qn(e)),n(" acyclic.undo",()=>$e(e))}d($n,"runLayout");function qn(e,n){f(e.nodes(),function(t){var o=e.node(t),r=n.node(t);o&&(o.x=r.x,o.y=r.y,n.children(t).length&&(o.width=r.width,o.height=r.height))}),f(e.edges(),function(t){var o=e.edge(t),r=n.edge(t);o.points=r.points,Object.prototype.hasOwnProperty.call(r,"x")&&(o.x=r.x,o.y=r.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}d(qn,"updateInputGraph");var pt=["nodesep","edgesep","ranksep","marginx","marginy"],vt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},mt=["acyclicer","ranker","rankdir","align"],wt=["width","height"],bt={width:0,height:0},yt=["minlen","weight","width","height","labeloffset"],kt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},xt=["labelpos"];function zn(e){var n=new y({multigraph:!0,compound:!0}),t=V(e.graph());return n.setGraph(X({},vt,F(t,pt),Y(t,mt))),f(e.nodes(),function(o){var r=V(e.node(o));n.setNode(o,ot(F(r,wt),bt)),n.setParent(o,e.parent(o))}),f(e.edges(),function(o){var r=V(e.edge(o));n.setEdge(o,X({},kt,F(r,yt),Y(r,xt)))}),n}d(zn,"buildLayoutGraph");function An(e){var n=e.graph();n.ranksep/=2,f(e.edges(),function(t){var o=e.edge(t);o.minlen*=2,o.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?o.width+=o.labeloffset:o.height+=o.labeloffset)})}d(An,"makeSpaceForEdgeLabels");function Jn(e){f(e.edges(),function(n){var t=e.edge(n);if(t.width&&t.height){var o=e.node(n.v),r=e.node(n.w),i={rank:(r.rank-o.rank)/2+o.rank,e:n};E(e,"edge-proxy",i,"_ep")}})}d(Jn,"injectEdgeLabelProxies");function Wn(e){var n=0;f(e.nodes(),function(t){var o=e.node(t);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,n=x(n,o.maxRank))}),e.graph().maxRank=n}d(Wn,"assignRankMinMax");function Xn(e){f(e.nodes(),function(n){var t=e.node(n);t.dummy==="edge-proxy"&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))})}d(Xn,"removeEdgeLabelProxies");function Hn(e){var n=Number.POSITIVE_INFINITY,t=0,o=Number.POSITIVE_INFINITY,r=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function s(c){var h=c.x,g=c.y,l=c.width,p=c.height;n=Math.min(n,h-l/2),t=Math.max(t,h+l/2),o=Math.min(o,g-p/2),r=Math.max(r,g+p/2)}d(s,"getExtremes"),f(e.nodes(),function(c){s(e.node(c))}),f(e.edges(),function(c){var h=e.edge(c);Object.prototype.hasOwnProperty.call(h,"x")&&s(h)}),n-=a,o-=u,f(e.nodes(),function(c){var h=e.node(c);h.x-=n,h.y-=o}),f(e.edges(),function(c){var h=e.edge(c);f(h.points,function(g){g.x-=n,g.y-=o}),Object.prototype.hasOwnProperty.call(h,"x")&&(h.x-=n),Object.prototype.hasOwnProperty.call(h,"y")&&(h.y-=o)}),i.width=t-n+a,i.height=r-o+u}d(Hn,"translateGraph");function Kn(e){f(e.edges(),function(n){var t=e.edge(n),o=e.node(n.v),r=e.node(n.w),i,a;t.points?(i=t.points[0],a=t.points[t.points.length-1]):(t.points=[],i=r,a=o),t.points.unshift(H(o,i)),t.points.push(H(r,a))})}d(Kn,"assignNodeIntersects");function Zn(e){f(e.edges(),function(n){var t=e.edge(n);if(Object.prototype.hasOwnProperty.call(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}})}d(Zn,"fixupEdgeLabelCoords");function Qn(e){f(e.edges(),function(n){var t=e.edge(n);t.reversed&&t.points.reverse()})}d(Qn,"reversePointsForReversedEdges");function Un(e){f(e.nodes(),function(n){if(e.children(n).length){var t=e.node(n),o=e.node(t.borderTop),r=e.node(t.borderBottom),i=e.node(D(t.borderLeft)),a=e.node(D(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(r.y-o.y),t.x=i.x+t.width/2,t.y=o.y+t.height/2}}),f(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}d(Un,"removeBorderNodes");function et(e){f(e.edges(),function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}d(et,"removeSelfEdges");function nt(e){var n=j(e);f(n,function(t){var o=0;f(t,function(r,i){var a=e.node(r);a.order=i+o,f(a.selfEdges,function(u){E(e,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:i+ ++o,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}d(nt,"insertSelfEdges");function tt(e){f(e.nodes(),function(n){var t=e.node(n);if(t.dummy==="selfedge"){var o=e.node(t.e.v),r=o.x+o.width/2,i=o.y,a=t.x-r,u=o.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:r+2*a/3,y:i-u},{x:r+5*a/6,y:i-u},{x:r+a,y:i},{x:r+5*a/6,y:i+u},{x:r+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}})}d(tt,"positionSelfEdges");function F(e,n){return q(Y(e,n),Number)}d(F,"selectNumberAttrs");function V(e){var n={};return f(e,function(t,o){n[o.toLowerCase()]=t}),n}d(V,"canonicalize");export{lt as f};