import{b as bn,a as Wn,c as L,k as zn,d as Xn,e as Un,g as O,j as gn,l as xn,m as En,t as Hn,n as kn,o as Jn,p as Kn,f as s,G as x,h as w,i as g,q as M,v as y,r as G}from"./graph-Bqo8LFRO.js";import{B as jn,C as Qn,D as Zn,E as yn,F as S,G as Nn,H as ne,e as Ln,f as J,I as ee,J as re,K as X,L as K,N as on,O as ie,P as _n,Q as te,R as ae,n as U}from"./index-DFpvp1rn.js";var un=1/0,oe=17976931348623157e292;function F(n){if(!n)return n===0?n:0;if(n=jn(n),n===un||n===-un){var e=n<0?-1:1;return e*oe}return n===n?n:0}function ue(n){var e=F(n),r=e%1;return e===e?r?e-r:e:0}function _(n){var e=n==null?0:n.length;return e?bn(n):[]}function de(n){return Qn(Zn(n,void 0,_),n+"")}var fe=1,se=4;function ce(n){return Wn(n,fe|se)}var Cn=Object.prototype,he=Cn.hasOwnProperty,le=yn(function(n,e){n=Object(n);var r=-1,i=e.length,t=i>2?e[2]:void 0;for(t&&S(e[0],e[1],t)&&(i=1);++r-1?t[o?e[a]:a]:void 0}}var pe=Math.max;function we(n,e,r){var i=n==null?0:n.length;if(!i)return-1;var t=r==null?0:ue(r);return t<0&&(t=pe(i+t,0)),Xn(n,L(e),t)}var j=ve(we);function Rn(n,e){var r=-1,i=Ln(n)?Array(n.length):[];return Un(n,function(t,o,a){i[++r]=e(t,o,a)}),i}function m(n,e){var r=J(n)?O:Rn;return r(n,L(e))}function me(n,e){return n==null?n:ee(n,gn(e),Nn)}function be(n,e){return n&&xn(n,gn(e))}function ge(n,e){return n>e}function In(n,e){return ne||o&&a&&d&&!u&&!f||i&&a&&d||!r&&d||!t)return 1;if(!i&&!o&&!f&&n=u)return d;var f=r[i];return d*(f=="desc"?-1:1)}}return n.index-e.index}function Le(n,e,r){e.length?e=O(e,function(o){return J(o)?function(a){return kn(a,o.length===1?o[0]:o)}:o}):e=[K];var i=-1;e=O(e,te(L));var t=Rn(n,function(o,a,u){var d=O(e,function(f){return f(o)});return{criteria:d,index:++i,value:o}});return ke(t,function(o,a){return Ne(o,a,r)})}function _e(n,e){return Ee(n,e,function(r,i){return Jn(n,i)})}var B=de(function(n,e){return n==null?{}:_e(n,e)}),Ce=Math.ceil,Re=Math.max;function Ie(n,e,r,i){for(var t=-1,o=Re(Ce((e-n)/(r||1)),0),a=Array(o);o--;)a[++t]=n,n+=r;return a}function Te(n){return function(e,r,i){return i&&typeof i!="number"&&S(e,r,i)&&(r=i=void 0),e=F(e),r===void 0?(r=e,e=0):r=F(r),i=i===void 0?e1&&S(n,e[0],e[1])?e=[]:r>2&&S(e[0],e[1],e[2])&&(e=[e[0]]),Le(n,bn(e),[])}),Me=0;function nn(n){var e=++Me;return Kn(n)+e}function Pe(n,e,r){for(var i=-1,t=n.length,o=e.length,a={};++i0;--u)if(a=e[u].dequeue(),a){i=i.concat(D(n,e,r,a,!0));break}}}return i}function D(n,e,r,i,t){var o=t?[]:void 0;return s(n.inEdges(i.v),function(a){var u=n.edge(a),d=n.node(a.v);t&&o.push({v:a.v,w:a.w}),d.out-=u,H(e,r,d)}),s(n.outEdges(i.v),function(a){var u=n.edge(a),d=a.w,f=n.node(d);f.in-=u,H(e,r,f)}),n.removeNode(i.v),o}function Ve(n,e){var r=new x,i=0,t=0;s(n.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),s(n.edges(),function(u){var d=r.edge(u.v,u.w)||0,f=e(u),c=d+f;r.setEdge(u.v,u.w,c),t=Math.max(t,r.node(u.v).out+=f),i=Math.max(i,r.node(u.w).in+=f)});var o=N(t+i+3).map(function(){return new Fe}),a=i+1;return s(r.nodes(),function(u){H(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function H(n,e,r){r.out?r.in?n[r.out-r.in+e].enqueue(r):n[n.length-1].enqueue(r):n[0].enqueue(r)}function Ye(n){var e=n.graph().acyclicer==="greedy"?Be(n,r(n)):De(n);s(e,function(i){var t=n.edge(i);n.removeEdge(i),t.forwardName=i.name,t.reversed=!0,n.setEdge(i.w,i.v,t,nn("rev"))});function r(i){return function(t){return i.edge(t).weight}}}function De(n){var e=[],r={},i={};function t(o){w(i,o)||(i[o]=!0,r[o]=!0,s(n.outEdges(o),function(a){w(r,a.w)?e.push(a):t(a.w)}),delete r[o])}return s(n.nodes(),t),e}function qe(n){s(n.edges(),function(e){var r=n.edge(e);if(r.reversed){n.removeEdge(e);var i=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(e.w,e.v,r,i)}})}function C(n,e,r,i){var t;do t=nn(i);while(n.hasNode(t));return r.dummy=e,n.setNode(t,r),t}function $e(n){var e=new x().setGraph(n.graph());return s(n.nodes(),function(r){e.setNode(r,n.node(r))}),s(n.edges(),function(r){var i=e.edge(r.v,r.w)||{weight:0,minlen:1},t=n.edge(r);e.setEdge(r.v,r.w,{weight:i.weight+t.weight,minlen:Math.max(i.minlen,t.minlen)})}),e}function Tn(n){var e=new x({multigraph:n.isMultigraph()}).setGraph(n.graph());return s(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),s(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function fn(n,e){var r=n.x,i=n.y,t=e.x-r,o=e.y-i,a=n.width/2,u=n.height/2;if(!t&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,f;return Math.abs(o)*a>Math.abs(t)*u?(o<0&&(u=-u),d=u*t/o,f=u):(t<0&&(a=-a),d=a,f=a*o/t),{x:r+d,y:i+f}}function Y(n){var e=m(N(Mn(n)+1),function(){return[]});return s(n.nodes(),function(r){var i=n.node(r),t=i.rank;g(t)||(e[t][i.order]=r)}),e}function We(n){var e=I(m(n.nodes(),function(r){return n.node(r).rank}));s(n.nodes(),function(r){var i=n.node(r);w(i,"rank")&&(i.rank-=e)})}function ze(n){var e=I(m(n.nodes(),function(o){return n.node(o).rank})),r=[];s(n.nodes(),function(o){var a=n.node(o).rank-e;r[a]||(r[a]=[]),r[a].push(o)});var i=0,t=n.graph().nodeRankFactor;s(r,function(o,a){g(o)&&a%t!==0?--i:i&&s(o,function(u){n.node(u).rank+=i})})}function sn(n,e,r,i){var t={width:0,height:0};return arguments.length>=4&&(t.rank=r,t.order=i),C(n,"border",t,e)}function Mn(n){return E(m(n.nodes(),function(e){var r=n.node(e).rank;if(!g(r))return r}))}function Xe(n,e){var r={lhs:[],rhs:[]};return s(n,function(i){e(i)?r.lhs.push(i):r.rhs.push(i)}),r}function Ue(n,e){return e()}function He(n){function e(r){var i=n.children(r),t=n.node(r);if(i.length&&s(i,e),w(t,"minRank")){t.borderLeft=[],t.borderRight=[];for(var o=t.minRank,a=t.maxRank+1;oa.lim&&(u=a,d=!0);var f=M(e.edges(),function(c){return d===ln(n,n.node(c.v),u)&&d!==ln(n,n.node(c.w),u)});return Z(f,function(c){return T(e,c)})}function Yn(n,e,r,i){var t=r.v,o=r.w;n.removeEdge(t,o),n.setEdge(i.v,i.w,{}),tn(n),rn(n,e),fr(n,e)}function fr(n,e){var r=j(n.nodes(),function(t){return!e.node(t).parent}),i=ur(n,r);i=i.slice(1),s(i,function(t){var o=n.node(t).parent,a=e.edge(t,o),u=!1;a||(a=e.edge(o,t),u=!0),e.node(t).rank=e.node(o).rank+(u?a.minlen:-a.minlen)})}function sr(n,e,r){return n.hasEdge(e,r)}function ln(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function cr(n){switch(n.graph().ranker){case"network-simplex":vn(n);break;case"tight-tree":lr(n);break;case"longest-path":hr(n);break;default:vn(n)}}var hr=en;function lr(n){en(n),On(n)}function vn(n){k(n)}function vr(n){var e=C(n,"root",{},"_root"),r=pr(n),i=E(y(r))-1,t=2*i+1;n.graph().nestingRoot=e,s(n.edges(),function(a){n.edge(a).minlen*=t});var o=wr(n)+1;s(n.children(),function(a){Dn(n,e,t,o,i,r,a)}),n.graph().nodeRankFactor=t}function Dn(n,e,r,i,t,o,a){var u=n.children(a);if(!u.length){a!==e&&n.setEdge(e,a,{weight:0,minlen:r});return}var d=sn(n,"_bt"),f=sn(n,"_bb"),c=n.node(a);n.setParent(d,a),c.borderTop=d,n.setParent(f,a),c.borderBottom=f,s(u,function(h){Dn(n,e,r,i,t,o,h);var l=n.node(h),v=l.borderTop?l.borderTop:h,p=l.borderBottom?l.borderBottom:h,b=l.borderTop?i:2*i,R=v!==p?1:t-o[a]+1;n.setEdge(d,v,{weight:b,minlen:R,nestingEdge:!0}),n.setEdge(p,f,{weight:b,minlen:R,nestingEdge:!0})}),n.parent(a)||n.setEdge(e,d,{weight:0,minlen:t+o[a]})}function pr(n){var e={};function r(i,t){var o=n.children(i);o&&o.length&&s(o,function(a){r(a,t+1)}),e[i]=t}return s(n.children(),function(i){r(i,1)}),e}function wr(n){return G(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function mr(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,s(n.edges(),function(r){var i=n.edge(r);i.nestingEdge&&n.removeEdge(r)})}function br(n,e,r){var i={},t;s(r,function(o){for(var a=n.parent(o),u,d;a;){if(u=n.parent(a),u?(d=i[u],i[u]=a):(d=t,t=a),d&&d!==a){e.setEdge(d,a);return}a=u}})}function gr(n,e,r){var i=xr(n),t=new x({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(function(o){return n.node(o)});return s(n.nodes(),function(o){var a=n.node(o),u=n.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(t.setNode(o),t.setParent(o,u||i),s(n[r](o),function(d){var f=d.v===o?d.w:d.v,c=t.edge(f,o),h=g(c)?0:c.weight;t.setEdge(f,o,{weight:n.edge(d).weight+h})}),w(a,"minRank")&&t.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),t}function xr(n){for(var e;n.hasNode(e=nn("_root")););return e}function Er(n,e){for(var r=0,i=1;i0;)c%2&&(h+=u[c+1]),c=c-1>>1,u[c]+=f.weight;d+=f.weight*h})),d}function yr(n){var e={},r=M(n.nodes(),function(u){return!n.children(u).length}),i=E(m(r,function(u){return n.node(u).rank})),t=m(N(i+1),function(){return[]});function o(u){if(!w(e,u)){e[u]=!0;var d=n.node(u);t[d.rank].push(u),s(n.successors(u),o)}}var a=P(r,function(u){return n.node(u).rank});return s(a,o),t}function Nr(n,e){return m(e,function(r){var i=n.inEdges(r);if(i.length){var t=G(i,function(o,a){var u=n.edge(a),d=n.node(a.v);return{sum:o.sum+u.weight*d.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:t.sum/t.weight,weight:t.weight}}else return{v:r}})}function Lr(n,e){var r={};s(n,function(t,o){var a=r[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:o};g(t.barycenter)||(a.barycenter=t.barycenter,a.weight=t.weight)}),s(e.edges(),function(t){var o=r[t.v],a=r[t.w];!g(o)&&!g(a)&&(a.indegree++,o.out.push(r[t.w]))});var i=M(r,function(t){return!t.indegree});return _r(i)}function _r(n){var e=[];function r(o){return function(a){a.merged||(g(a.barycenter)||g(o.barycenter)||a.barycenter>=o.barycenter)&&Cr(o,a)}}function i(o){return function(a){a.in.push(o),--a.indegree===0&&n.push(a)}}for(;n.length;){var t=n.pop();e.push(t),s(t.in.reverse(),r(t)),s(t.out,i(t))}return m(M(e,function(o){return!o.merged}),function(o){return B(o,["vs","i","barycenter","weight"])})}function Cr(n,e){var r=0,i=0;n.weight&&(r+=n.barycenter*n.weight,i+=n.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=r/i,n.weight=i,n.i=Math.min(e.i,n.i),e.merged=!0}function Rr(n,e){var r=Xe(n,function(c){return w(c,"barycenter")}),i=r.lhs,t=P(r.rhs,function(c){return-c.i}),o=[],a=0,u=0,d=0;i.sort(Ir(!!e)),d=pn(o,t,d),s(i,function(c){d+=c.vs.length,o.push(c.vs),a+=c.barycenter*c.weight,u+=c.weight,d=pn(o,t,d)});var f={vs:_(o)};return u&&(f.barycenter=a/u,f.weight=u),f}function pn(n,e,r){for(var i;e.length&&(i=A(e)).i<=r;)e.pop(),n.push(i.vs),r++;return r}function Ir(n){return function(e,r){return e.barycenterr.barycenter?1:n?r.i-e.i:e.i-r.i}}function qn(n,e,r,i){var t=n.children(e),o=n.node(e),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,d={};a&&(t=M(t,function(p){return p!==a&&p!==u}));var f=Nr(n,t);s(f,function(p){if(n.children(p.v).length){var b=qn(n,p.v,r,i);d[p.v]=b,w(b,"barycenter")&&Mr(p,b)}});var c=Lr(f,r);Tr(c,d);var h=Rr(c,i);if(a&&(h.vs=_([a,h.vs,u]),n.predecessors(a).length)){var l=n.node(n.predecessors(a)[0]),v=n.node(n.predecessors(u)[0]);w(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+l.order+v.order)/(h.weight+2),h.weight+=2}return h}function Tr(n,e){s(n,function(r){r.vs=_(r.vs.map(function(i){return e[i]?e[i].vs:i}))})}function Mr(n,e){g(n.barycenter)?(n.barycenter=e.barycenter,n.weight=e.weight):(n.barycenter=(n.barycenter*n.weight+e.barycenter*e.weight)/(n.weight+e.weight),n.weight+=e.weight)}function Pr(n){var e=Mn(n),r=wn(n,N(1,e+1),"inEdges"),i=wn(n,N(e-1,-1,-1),"outEdges"),t=yr(n);mn(n,t);for(var o=Number.POSITIVE_INFINITY,a,u=0,d=0;d<4;++u,++d){Or(u%2?r:i,u%4>=2),t=Y(n);var f=Er(n,t);fa||u>e[d].lim));for(f=d,d=i;(d=n.parent(d))!==f;)o.push(d);return{path:t.concat(o.reverse()),lca:f}}function Ar(n){var e={},r=0;function i(t){var o=r;s(n.children(t),i),e[t]={low:o,lim:r++}}return s(n.children(),i),e}function Br(n,e){var r={};function i(t,o){var a=0,u=0,d=t.length,f=A(o);return s(o,function(c,h){var l=Vr(n,c),v=l?n.node(l).order:d;(l||c===f)&&(s(o.slice(u,h+1),function(p){s(n.predecessors(p),function(b){var R=n.node(b),an=R.order;(anf)&&$n(r,l,c)})})}function t(o,a){var u=-1,d,f=0;return s(a,function(c,h){if(n.node(c).dummy==="border"){var l=n.predecessors(c);l.length&&(d=n.node(l[0]).order,i(a,f,h,u,d),f=h,u=d)}i(a,f,a.length,d,o.length)}),a}return G(e,t),r}function Vr(n,e){if(n.node(e).dummy)return j(n.predecessors(e),function(r){return n.node(r).dummy})}function $n(n,e,r){if(e>r){var i=e;e=r,r=i}var t=n[e];t||(n[e]=t={}),t[r]=!0}function Yr(n,e,r){if(e>r){var i=e;e=r,r=i}return w(n[e],r)}function Dr(n,e,r,i){var t={},o={},a={};return s(e,function(u){s(u,function(d,f){t[d]=d,o[d]=d,a[d]=f})}),s(e,function(u){var d=-1;s(u,function(f){var c=i(f);if(c.length){c=P(c,function(b){return a[b]});for(var h=(c.length-1)/2,l=Math.floor(h),v=Math.ceil(h);l<=v;++l){var p=c[l];o[f]===f&&d