Files
mermaid-live-editor/_app/immutable/chunks/layout.pq477YeB.js
T
2024-01-23 08:17:34 +00:00

2 lines
45 KiB
JavaScript

import{aF as O,aG as x,aH as M,aI as sr,aJ as fn,aK as fr,aL as dr,aM as cr,aN as xe,aO as hr,aP as lr,aQ as dn,aR as W,aS as vr,aT as Te,aU as gr,aV as rn,aW as U,aX as tn,aY as Cn,aZ as an,a_ as pr,a$ as Ln,b0 as br,b1 as wr,b2 as Y,b3 as In,b4 as mr,b5 as Le,b6 as Kn,b7 as _r,b8 as Er,b9 as Ae,ba as K,bb as Ne,bc as Pn,bd as un,be as yr,bf as bn,bg as xr,bh as G,ai as Xn,bi as Vn,bj as Zn,bk as An}from"./state.5snnNpKv.js";function R(n,e){for(var r=-1,t=n==null?0:n.length,i=Array(t);++r<t;)i[r]=e(n[r],r,n);return i}var Tr=1/0,Jn=O?O.prototype:void 0,Qn=Jn?Jn.toString:void 0;function Oe(n){if(typeof n=="string")return n;if(x(n))return R(n,Oe)+"";if(M(n))return Qn?Qn.call(n):"";var e=n+"";return e=="0"&&1/n==-Tr?"-0":e}var zn=1/0,Lr=17976931348623157e292;function nn(n){if(!n)return n===0?n:0;if(n=sr(n),n===zn||n===-zn){var e=n<0?-1:1;return e*Lr}return n===n?n:0}function Ar(n){var e=nn(n),r=e%1;return e===e?r?e-r:e:0}function Nr(){}function Ce(n,e){for(var r=-1,t=n==null?0:n.length;++r<t&&e(n[r],r,n)!==!1;);return n}function Ie(n,e,r,t){for(var i=n.length,a=r+(t?1:-1);t?a--:++a<i;)if(e(n[a],a,n))return a;return-1}function Or(n){return n!==n}function Cr(n,e,r){for(var t=r-1,i=n.length;++t<i;)if(n[t]===e)return t;return-1}function Ir(n,e,r){return e===e?Cr(n,e,r):Ie(n,Or,r)}function Pr(n,e){var r=n==null?0:n.length;return!!r&&Ir(n,e,0)>-1}function T(n){return fn(n)?fr(n):dr(n)}var Sr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$r=/^\w*$/;function Sn(n,e){if(x(n))return!1;var r=typeof n;return r=="number"||r=="symbol"||r=="boolean"||n==null||M(n)?!0:$r.test(n)||!Sr.test(n)||e!=null&&n in Object(e)}var Rr=500;function Mr(n){var e=cr(n,function(t){return r.size===Rr&&r.clear(),t}),r=e.cache;return e}var Fr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Dr=/\\(\\)?/g,kr=Mr(function(n){var e=[];return n.charCodeAt(0)===46&&e.push(""),n.replace(Fr,function(r,t,i,a){e.push(i?a.replace(Dr,"$1"):t||r)}),e});function Pe(n){return n==null?"":Oe(n)}function cn(n,e){return x(n)?n:Sn(n,e)?[n]:kr(Pe(n))}var Gr=1/0;function X(n){if(typeof n=="string"||M(n))return n;var e=n+"";return e=="0"&&1/n==-Gr?"-0":e}function hn(n,e){e=cn(e,n);for(var r=0,t=e.length;n!=null&&r<t;)n=n[X(e[r++])];return r&&r==t?n:void 0}function Br(n,e,r){var t=n==null?void 0:hn(n,e);return t===void 0?r:t}function $n(n,e){for(var r=-1,t=e.length,i=n.length;++r<t;)n[i+r]=e[r];return n}var ne=O?O.isConcatSpreadable:void 0;function Yr(n){return x(n)||xe(n)||!!(ne&&n&&n[ne])}function ln(n,e,r,t,i){var a=-1,u=n.length;for(r||(r=Yr),i||(i=[]);++a<u;){var o=n[a];e>0&&r(o)?e>1?ln(o,e-1,r,t,i):$n(i,o):t||(i[i.length]=o)}return i}function D(n){var e=n==null?0:n.length;return e?ln(n,1):[]}function Ur(n){return hr(lr(n,void 0,D),n+"")}function qr(n,e,r,t){var i=-1,a=n==null?0:n.length;for(t&&a&&(r=n[++i]);++i<a;)r=e(r,n[i],i,n);return r}function Hr(n,e){return n&&dn(e,T(e),n)}function jr(n,e){return n&&dn(e,W(e),n)}function Se(n,e){for(var r=-1,t=n==null?0:n.length,i=0,a=[];++r<t;){var u=n[r];e(u,r,n)&&(a[i++]=u)}return a}function $e(){return[]}var Wr=Object.prototype,Kr=Wr.propertyIsEnumerable,ee=Object.getOwnPropertySymbols,Rn=ee?function(n){return n==null?[]:(n=Object(n),Se(ee(n),function(e){return Kr.call(n,e)}))}:$e;function Xr(n,e){return dn(n,Rn(n),e)}var Vr=Object.getOwnPropertySymbols,Re=Vr?function(n){for(var e=[];n;)$n(e,Rn(n)),n=vr(n);return e}:$e;function Zr(n,e){return dn(n,Re(n),e)}function Me(n,e,r){var t=e(n);return x(n)?t:$n(t,r(n))}function Nn(n){return Me(n,T,Rn)}function Jr(n){return Me(n,W,Re)}var Qr=Object.prototype,zr=Qr.hasOwnProperty;function nt(n){var e=n.length,r=new n.constructor(e);return e&&typeof n[0]=="string"&&zr.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function et(n,e){var r=e?Te(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}var rt=/\w*$/;function tt(n){var e=new n.constructor(n.source,rt.exec(n));return e.lastIndex=n.lastIndex,e}var re=O?O.prototype:void 0,te=re?re.valueOf:void 0;function it(n){return te?Object(te.call(n)):{}}var at="[object Boolean]",ut="[object Date]",ot="[object Map]",st="[object Number]",ft="[object RegExp]",dt="[object Set]",ct="[object String]",ht="[object Symbol]",lt="[object ArrayBuffer]",vt="[object DataView]",gt="[object Float32Array]",pt="[object Float64Array]",bt="[object Int8Array]",wt="[object Int16Array]",mt="[object Int32Array]",_t="[object Uint8Array]",Et="[object Uint8ClampedArray]",yt="[object Uint16Array]",xt="[object Uint32Array]";function Tt(n,e,r){var t=n.constructor;switch(e){case lt:return Te(n);case at:case ut:return new t(+n);case vt:return et(n,r);case gt:case pt:case bt:case wt:case mt:case _t:case Et:case yt:case xt:return gr(n,r);case ot:return new t;case st:case ct:return new t(n);case ft:return tt(n);case dt:return new t;case ht:return it(n)}}var Lt="[object Map]";function At(n){return rn(n)&&U(n)==Lt}var ie=tn&&tn.isMap,Nt=ie?Cn(ie):At,Ot="[object Set]";function Ct(n){return rn(n)&&U(n)==Ot}var ae=tn&&tn.isSet,It=ae?Cn(ae):Ct,Pt=1,St=2,$t=4,Fe="[object Arguments]",Rt="[object Array]",Mt="[object Boolean]",Ft="[object Date]",Dt="[object Error]",De="[object Function]",kt="[object GeneratorFunction]",Gt="[object Map]",Bt="[object Number]",ke="[object Object]",Yt="[object RegExp]",Ut="[object Set]",qt="[object String]",Ht="[object Symbol]",jt="[object WeakMap]",Wt="[object ArrayBuffer]",Kt="[object DataView]",Xt="[object Float32Array]",Vt="[object Float64Array]",Zt="[object Int8Array]",Jt="[object Int16Array]",Qt="[object Int32Array]",zt="[object Uint8Array]",ni="[object Uint8ClampedArray]",ei="[object Uint16Array]",ri="[object Uint32Array]",w={};w[Fe]=w[Rt]=w[Wt]=w[Kt]=w[Mt]=w[Ft]=w[Xt]=w[Vt]=w[Zt]=w[Jt]=w[Qt]=w[Gt]=w[Bt]=w[ke]=w[Yt]=w[Ut]=w[qt]=w[Ht]=w[zt]=w[ni]=w[ei]=w[ri]=!0;w[Dt]=w[De]=w[jt]=!1;function en(n,e,r,t,i,a){var u,o=e&Pt,s=e&St,f=e&$t;if(r&&(u=i?r(n,t,i,a):r(n)),u!==void 0)return u;if(!an(n))return n;var d=x(n);if(d){if(u=nt(n),!o)return pr(n,u)}else{var h=U(n),l=h==De||h==kt;if(Ln(n))return br(n,o);if(h==ke||h==Fe||l&&!i){if(u=s||l?{}:wr(n),!o)return s?Zr(n,jr(u,n)):Xr(n,Hr(u,n))}else{if(!w[h])return i?n:{};u=Tt(n,h,o)}}a||(a=new Y);var g=a.get(n);if(g)return g;a.set(n,u),It(n)?n.forEach(function(m){u.add(en(m,e,r,m,n,a))}):Nt(n)&&n.forEach(function(m,_){u.set(_,en(m,e,r,_,n,a))});var v=f?s?Jr:Nn:s?W:T,p=d?void 0:v(n);return Ce(p||n,function(m,_){p&&(_=m,m=n[_]),In(u,_,en(m,e,r,_,n,a))}),u}var ti=1,ii=4;function ai(n){return en(n,ti|ii)}var ui="__lodash_hash_undefined__";function oi(n){return this.__data__.set(n,ui),this}function si(n){return this.__data__.has(n)}function q(n){var e=-1,r=n==null?0:n.length;for(this.__data__=new mr;++e<r;)this.add(n[e])}q.prototype.add=q.prototype.push=oi;q.prototype.has=si;function fi(n,e){for(var r=-1,t=n==null?0:n.length;++r<t;)if(e(n[r],r,n))return!0;return!1}function Ge(n,e){return n.has(e)}var di=1,ci=2;function Be(n,e,r,t,i,a){var u=r&di,o=n.length,s=e.length;if(o!=s&&!(u&&s>o))return!1;var f=a.get(n),d=a.get(e);if(f&&d)return f==e&&d==n;var h=-1,l=!0,g=r&ci?new q:void 0;for(a.set(n,e),a.set(e,n);++h<o;){var v=n[h],p=e[h];if(t)var m=u?t(p,v,h,e,n,a):t(v,p,h,n,e,a);if(m!==void 0){if(m)continue;l=!1;break}if(g){if(!fi(e,function(_,I){if(!Ge(g,I)&&(v===_||i(v,_,r,t,a)))return g.push(I)})){l=!1;break}}else if(!(v===p||i(v,p,r,t,a))){l=!1;break}}return a.delete(n),a.delete(e),l}function hi(n){var e=-1,r=Array(n.size);return n.forEach(function(t,i){r[++e]=[i,t]}),r}function Mn(n){var e=-1,r=Array(n.size);return n.forEach(function(t){r[++e]=t}),r}var li=1,vi=2,gi="[object Boolean]",pi="[object Date]",bi="[object Error]",wi="[object Map]",mi="[object Number]",_i="[object RegExp]",Ei="[object Set]",yi="[object String]",xi="[object Symbol]",Ti="[object ArrayBuffer]",Li="[object DataView]",ue=O?O.prototype:void 0,wn=ue?ue.valueOf:void 0;function Ai(n,e,r,t,i,a,u){switch(r){case Li:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case Ti:return!(n.byteLength!=e.byteLength||!a(new Kn(n),new Kn(e)));case gi:case pi:case mi:return Le(+n,+e);case bi:return n.name==e.name&&n.message==e.message;case _i:case yi:return n==e+"";case wi:var o=hi;case Ei:var s=t&li;if(o||(o=Mn),n.size!=e.size&&!s)return!1;var f=u.get(n);if(f)return f==e;t|=vi,u.set(n,e);var d=Be(o(n),o(e),t,i,a,u);return u.delete(n),d;case xi:if(wn)return wn.call(n)==wn.call(e)}return!1}var Ni=1,Oi=Object.prototype,Ci=Oi.hasOwnProperty;function Ii(n,e,r,t,i,a){var u=r&Ni,o=Nn(n),s=o.length,f=Nn(e),d=f.length;if(s!=d&&!u)return!1;for(var h=s;h--;){var l=o[h];if(!(u?l in e:Ci.call(e,l)))return!1}var g=a.get(n),v=a.get(e);if(g&&v)return g==e&&v==n;var p=!0;a.set(n,e),a.set(e,n);for(var m=u;++h<s;){l=o[h];var _=n[l],I=e[l];if(t)var Wn=u?t(I,_,l,e,n,a):t(_,I,l,n,e,a);if(!(Wn===void 0?_===I||i(_,I,r,t,a):Wn)){p=!1;break}m||(m=l=="constructor")}if(p&&!m){var J=n.constructor,Q=e.constructor;J!=Q&&"constructor"in n&&"constructor"in e&&!(typeof J=="function"&&J instanceof J&&typeof Q=="function"&&Q instanceof Q)&&(p=!1)}return a.delete(n),a.delete(e),p}var Pi=1,oe="[object Arguments]",se="[object Array]",z="[object Object]",Si=Object.prototype,fe=Si.hasOwnProperty;function $i(n,e,r,t,i,a){var u=x(n),o=x(e),s=u?se:U(n),f=o?se:U(e);s=s==oe?z:s,f=f==oe?z:f;var d=s==z,h=f==z,l=s==f;if(l&&Ln(n)){if(!Ln(e))return!1;u=!0,d=!1}if(l&&!d)return a||(a=new Y),u||_r(n)?Be(n,e,r,t,i,a):Ai(n,e,s,r,t,i,a);if(!(r&Pi)){var g=d&&fe.call(n,"__wrapped__"),v=h&&fe.call(e,"__wrapped__");if(g||v){var p=g?n.value():n,m=v?e.value():e;return a||(a=new Y),i(p,m,r,t,a)}}return l?(a||(a=new Y),Ii(n,e,r,t,i,a)):!1}function Fn(n,e,r,t,i){return n===e?!0:n==null||e==null||!rn(n)&&!rn(e)?n!==n&&e!==e:$i(n,e,r,t,Fn,i)}var Ri=1,Mi=2;function Fi(n,e,r,t){var i=r.length,a=i,u=!t;if(n==null)return!a;for(n=Object(n);i--;){var o=r[i];if(u&&o[2]?o[1]!==n[o[0]]:!(o[0]in n))return!1}for(;++i<a;){o=r[i];var s=o[0],f=n[s],d=o[1];if(u&&o[2]){if(f===void 0&&!(s in n))return!1}else{var h=new Y;if(t)var l=t(f,d,s,n,e,h);if(!(l===void 0?Fn(d,f,Ri|Mi,t,h):l))return!1}}return!0}function Ye(n){return n===n&&!an(n)}function Di(n){for(var e=T(n),r=e.length;r--;){var t=e[r],i=n[t];e[r]=[t,i,Ye(i)]}return e}function Ue(n,e){return function(r){return r==null?!1:r[n]===e&&(e!==void 0||n in Object(r))}}function ki(n){var e=Di(n);return e.length==1&&e[0][2]?Ue(e[0][0],e[0][1]):function(r){return r===n||Fi(r,n,e)}}function Gi(n,e){return n!=null&&e in Object(n)}function qe(n,e,r){e=cn(e,n);for(var t=-1,i=e.length,a=!1;++t<i;){var u=X(e[t]);if(!(a=n!=null&&r(n,u)))break;n=n[u]}return a||++t!=i?a:(i=n==null?0:n.length,!!i&&Er(i)&&Ae(u,i)&&(x(n)||xe(n)))}function He(n,e){return n!=null&&qe(n,e,Gi)}var Bi=1,Yi=2;function Ui(n,e){return Sn(n)&&Ye(e)?Ue(X(n),e):function(r){var t=Br(r,n);return t===void 0&&t===e?He(r,n):Fn(e,t,Bi|Yi)}}function qi(n){return function(e){return e==null?void 0:e[n]}}function Hi(n){return function(e){return hn(e,n)}}function ji(n){return Sn(n)?qi(X(n)):Hi(n)}function C(n){return typeof n=="function"?n:n==null?K:typeof n=="object"?x(n)?Ui(n[0],n[1]):ki(n):ji(n)}function Dn(n,e){return n&&Ne(n,e,T)}function Wi(n,e){return function(r,t){if(r==null)return r;if(!fn(r))return n(r,t);for(var i=r.length,a=e?i:-1,u=Object(r);(e?a--:++a<i)&&t(u[a],a,u)!==!1;);return r}}var Ki=Wi(Dn);const vn=Ki;var je=Object.prototype,Xi=je.hasOwnProperty,Vi=Pn(function(n,e){n=Object(n);var r=-1,t=e.length,i=t>2?e[2]:void 0;for(i&&un(e[0],e[1],i)&&(t=1);++r<t;)for(var a=e[r],u=W(a),o=-1,s=u.length;++o<s;){var f=u[o],d=n[f];(d===void 0||Le(d,je[f])&&!Xi.call(n,f))&&(n[f]=a[f])}return n});const Zi=Vi;function Ji(n,e,r){for(var t=-1,i=n==null?0:n.length;++t<i;)if(r(e,n[t]))return!0;return!1}function on(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function kn(n){return typeof n=="function"?n:K}function c(n,e){var r=x(n)?Ce:vn;return r(n,kn(e))}function Qi(n,e){var r=[];return vn(n,function(t,i,a){e(t,i,a)&&r.push(t)}),r}function A(n,e){var r=x(n)?Se:Qi;return r(n,C(e))}function zi(n){return function(e,r,t){var i=Object(e);if(!fn(e)){var a=C(r);e=T(e),r=function(o){return a(i[o],o,i)}}var u=n(e,r,t);return u>-1?i[a?e[u]:u]:void 0}}var na=Math.max;function ea(n,e,r){var t=n==null?0:n.length;if(!t)return-1;var i=r==null?0:Ar(r);return i<0&&(i=na(t+i,0)),Ie(n,C(e),i)}var Gn=zi(ea);function We(n,e){var r=-1,t=fn(n)?Array(n.length):[];return vn(n,function(i,a,u){t[++r]=e(i,a,u)}),t}function E(n,e){var r=x(n)?R:We;return r(n,C(e))}function ra(n,e){return n==null?n:Ne(n,kn(e),W)}function ta(n,e){return n&&Dn(n,kn(e))}function ia(n,e){return n>e}var aa=Object.prototype,ua=aa.hasOwnProperty;function oa(n,e){return n!=null&&ua.call(n,e)}function b(n,e){return n!=null&&qe(n,e,oa)}function sa(n,e){return R(e,function(r){return n[r]})}function N(n){return n==null?[]:sa(n,T(n))}function y(n){return n===void 0}function Ke(n,e){return n<e}function gn(n,e){var r={};return e=C(e),Dn(n,function(t,i,a){yr(r,i,e(t,i,a))}),r}function Bn(n,e,r){for(var t=-1,i=n.length;++t<i;){var a=n[t],u=e(a);if(u!=null&&(o===void 0?u===u&&!M(u):r(u,o)))var o=u,s=a}return s}function S(n){return n&&n.length?Bn(n,K,ia):void 0}function H(n){return n&&n.length?Bn(n,K,Ke):void 0}function Yn(n,e){return n&&n.length?Bn(n,C(e),Ke):void 0}function fa(n,e,r,t){if(!an(n))return n;e=cn(e,n);for(var i=-1,a=e.length,u=a-1,o=n;o!=null&&++i<a;){var s=X(e[i]),f=r;if(s==="__proto__"||s==="constructor"||s==="prototype")return n;if(i!=u){var d=o[s];f=t?t(d,s,o):void 0,f===void 0&&(f=an(d)?d:Ae(e[i+1])?[]:{})}In(o,s,f),o=o[s]}return n}function da(n,e,r){for(var t=-1,i=e.length,a={};++t<i;){var u=e[t],o=hn(n,u);r(o,u)&&fa(a,cn(u,n),o)}return a}function ca(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function ha(n,e){if(n!==e){var r=n!==void 0,t=n===null,i=n===n,a=M(n),u=e!==void 0,o=e===null,s=e===e,f=M(e);if(!o&&!f&&!a&&n>e||a&&u&&s&&!o&&!f||t&&u&&s||!r&&s||!i)return 1;if(!t&&!a&&!f&&n<e||f&&r&&i&&!t&&!a||o&&r&&i||!u&&i||!s)return-1}return 0}function la(n,e,r){for(var t=-1,i=n.criteria,a=e.criteria,u=i.length,o=r.length;++t<u;){var s=ha(i[t],a[t]);if(s){if(t>=o)return s;var f=r[t];return s*(f=="desc"?-1:1)}}return n.index-e.index}function va(n,e,r){e.length?e=R(e,function(a){return x(a)?function(u){return hn(u,a.length===1?a[0]:a)}:a}):e=[K];var t=-1;e=R(e,Cn(C));var i=We(n,function(a,u,o){var s=R(e,function(f){return f(a)});return{criteria:s,index:++t,value:a}});return ca(i,function(a,u){return la(a,u,r)})}function ga(n,e){return da(n,e,function(r,t){return He(n,t)})}var sn=Ur(function(n,e){return n==null?{}:ga(n,e)}),pa=Math.ceil,ba=Math.max;function wa(n,e,r,t){for(var i=-1,a=ba(pa((e-n)/(r||1)),0),u=Array(a);a--;)u[t?a:++i]=n,n+=r;return u}function ma(n){return function(e,r,t){return t&&typeof t!="number"&&un(e,r,t)&&(r=t=void 0),e=nn(e),r===void 0?(r=e,e=0):r=nn(r),t=t===void 0?e<r?1:-1:nn(t),wa(e,r,t,n)}}var F=ma();function _a(n,e,r,t,i){return i(n,function(a,u,o){r=t?(t=!1,a):e(r,a,u,o)}),r}function V(n,e,r){var t=x(n)?qr:_a,i=arguments.length<3;return t(n,C(e),r,i,vn)}var Z=Pn(function(n,e){if(n==null)return[];var r=e.length;return r>1&&un(n,e[0],e[1])?e=[]:r>2&&un(e[0],e[1],e[2])&&(e=[e[0]]),va(n,ln(e,1),[])}),Ea=1/0,ya=bn&&1/Mn(new bn([,-0]))[1]==Ea?function(n){return new bn(n)}:Nr,xa=200;function Ta(n,e,r){var t=-1,i=Pr,a=n.length,u=!0,o=[],s=o;if(r)u=!1,i=Ji;else if(a>=xa){var f=e?null:ya(n);if(f)return Mn(f);u=!1,i=Ge,s=new q}else s=e?[]:o;n:for(;++t<a;){var d=n[t],h=e?e(d):d;if(d=r||d!==0?d:0,u&&h===h){for(var l=s.length;l--;)if(s[l]===h)continue n;e&&s.push(h),o.push(d)}else i(s,h,r)||(s!==o&&s.push(h),o.push(d))}return o}var La=Pn(function(n){return Ta(ln(n,1,xr,!0))}),Aa=0;function Un(n){var e=++Aa;return Pe(n)+e}function Na(n,e,r){for(var t=-1,i=n.length,a=e.length,u={};++t<i;){var o=t<a?e[t]:void 0;r(u,n[t],o)}return u}function Oa(n,e){return Na(n||[],e||[],In)}var Ca="\0",P="\0",de="";class L{constructor(e={}){this._isDirected=b(e,"directed")?e.directed:!0,this._isMultigraph=b(e,"multigraph")?e.multigraph:!1,this._isCompound=b(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=G(void 0),this._defaultEdgeLabelFn=G(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[P]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return Xn(e)||(e=G(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return T(this._nodes)}sources(){var e=this;return A(this.nodes(),function(r){return Vn(e._in[r])})}sinks(){var e=this;return A(this.nodes(),function(r){return Vn(e._out[r])})}setNodes(e,r){var t=arguments,i=this;return c(e,function(a){t.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return b(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=r),this):(this._nodes[e]=arguments.length>1?r:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=P,this._children[e]={},this._children[P][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return b(this._nodes,e)}removeNode(e){var r=this;if(b(this._nodes,e)){var t=function(i){r.removeEdge(r._edgeObjs[i])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],c(this.children(e),function(i){r.setParent(i)}),delete this._children[e]),c(T(this._in[e]),t),delete this._in[e],delete this._preds[e],c(T(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(y(r))r=P;else{r+="";for(var t=r;!y(t);t=this.parent(t))if(t===e)throw new Error("Setting "+r+" as parent of "+e+" would create a cycle");this.setNode(r)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=r,this._children[r][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var r=this._parent[e];if(r!==P)return r}}children(e){if(y(e)&&(e=P),this._isCompound){var r=this._children[e];if(r)return T(r)}else{if(e===P)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return T(r)}successors(e){var r=this._sucs[e];if(r)return T(r)}neighbors(e){var r=this.predecessors(e);if(r)return La(r,this.successors(e))}isLeaf(e){var r;return this.isDirected()?r=this.successors(e):r=this.neighbors(e),r.length===0}filterNodes(e){var r=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});r.setGraph(this.graph());var t=this;c(this._nodes,function(u,o){e(o)&&r.setNode(o,u)}),c(this._edgeObjs,function(u){r.hasNode(u.v)&&r.hasNode(u.w)&&r.setEdge(u,t.edge(u))});var i={};function a(u){var o=t.parent(u);return o===void 0||r.hasNode(o)?(i[u]=o,o):o in i?i[o]:a(o)}return this._isCompound&&c(r.nodes(),function(u){r.setParent(u,a(u))}),r}setDefaultEdgeLabel(e){return Xn(e)||(e=G(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return N(this._edgeObjs)}setPath(e,r){var t=this,i=arguments;return V(e,function(a,u){return i.length>1?t.setEdge(a,u,r):t.setEdge(a,u),u}),this}setEdge(){var e,r,t,i,a=!1,u=arguments[0];typeof u=="object"&&u!==null&&"v"in u?(e=u.v,r=u.w,t=u.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=u,r=arguments[1],t=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,r=""+r,y(t)||(t=""+t);var o=B(this._isDirected,e,r,t);if(b(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!y(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(r),this._edgeLabels[o]=a?i:this._defaultEdgeLabelFn(e,r,t);var s=Ia(this._isDirected,e,r,t);return e=s.v,r=s.w,Object.freeze(s),this._edgeObjs[o]=s,ce(this._preds[r],e),ce(this._sucs[e],r),this._in[r][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,r,t){var i=arguments.length===1?mn(this._isDirected,arguments[0]):B(this._isDirected,e,r,t);return this._edgeLabels[i]}hasEdge(e,r,t){var i=arguments.length===1?mn(this._isDirected,arguments[0]):B(this._isDirected,e,r,t);return b(this._edgeLabels,i)}removeEdge(e,r,t){var i=arguments.length===1?mn(this._isDirected,arguments[0]):B(this._isDirected,e,r,t),a=this._edgeObjs[i];return a&&(e=a.v,r=a.w,delete this._edgeLabels[i],delete this._edgeObjs[i],he(this._preds[r],e),he(this._sucs[e],r),delete this._in[r][i],delete this._out[e][i],this._edgeCount--),this}inEdges(e,r){var t=this._in[e];if(t){var i=N(t);return r?A(i,function(a){return a.v===r}):i}}outEdges(e,r){var t=this._out[e];if(t){var i=N(t);return r?A(i,function(a){return a.w===r}):i}}nodeEdges(e,r){var t=this.inEdges(e,r);if(t)return t.concat(this.outEdges(e,r))}}L.prototype._nodeCount=0;L.prototype._edgeCount=0;function ce(n,e){n[e]?n[e]++:n[e]=1}function he(n,e){--n[e]||delete n[e]}function B(n,e,r,t){var i=""+e,a=""+r;if(!n&&i>a){var u=i;i=a,a=u}return i+de+a+de+(y(t)?Ca:t)}function Ia(n,e,r,t){var i=""+e,a=""+r;if(!n&&i>a){var u=i;i=a,a=u}var o={v:i,w:a};return t&&(o.name=t),o}function mn(n,e){return B(n,e.v,e.w,e.name)}class Pa{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return le(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&le(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,t=r._prev;t!==r;)e.push(JSON.stringify(t,Sa)),t=t._prev;return"["+e.join(", ")+"]"}}function le(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function Sa(n,e){if(n!=="_next"&&n!=="_prev")return e}var $a=G(1);function Ra(n,e){if(n.nodeCount()<=1)return[];var r=Fa(n,e||$a),t=Ma(r.graph,r.buckets,r.zeroIdx);return D(E(t,function(i){return n.outEdges(i.v,i.w)}))}function Ma(n,e,r){for(var t=[],i=e[e.length-1],a=e[0],u;n.nodeCount();){for(;u=a.dequeue();)_n(n,e,r,u);for(;u=i.dequeue();)_n(n,e,r,u);if(n.nodeCount()){for(var o=e.length-2;o>0;--o)if(u=e[o].dequeue(),u){t=t.concat(_n(n,e,r,u,!0));break}}}return t}function _n(n,e,r,t,i){var a=i?[]:void 0;return c(n.inEdges(t.v),function(u){var o=n.edge(u),s=n.node(u.v);i&&a.push({v:u.v,w:u.w}),s.out-=o,On(e,r,s)}),c(n.outEdges(t.v),function(u){var o=n.edge(u),s=u.w,f=n.node(s);f.in-=o,On(e,r,f)}),n.removeNode(t.v),a}function Fa(n,e){var r=new L,t=0,i=0;c(n.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),c(n.edges(),function(o){var s=r.edge(o.v,o.w)||0,f=e(o),d=s+f;r.setEdge(o.v,o.w,d),i=Math.max(i,r.node(o.v).out+=f),t=Math.max(t,r.node(o.w).in+=f)});var a=F(i+t+3).map(function(){return new Pa}),u=t+1;return c(r.nodes(),function(o){On(a,u,r.node(o))}),{graph:r,buckets:a,zeroIdx:u}}function On(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 Da(n){var e=n.graph().acyclicer==="greedy"?Ra(n,r(n)):ka(n);c(e,function(t){var i=n.edge(t);n.removeEdge(t),i.forwardName=t.name,i.reversed=!0,n.setEdge(t.w,t.v,i,Un("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function ka(n){var e=[],r={},t={};function i(a){b(t,a)||(t[a]=!0,r[a]=!0,c(n.outEdges(a),function(u){b(r,u.w)?e.push(u):i(u.w)}),delete r[a])}return c(n.nodes(),i),e}function Ga(n){c(n.edges(),function(e){var r=n.edge(e);if(r.reversed){n.removeEdge(e);var t=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(e.w,e.v,r,t)}})}function k(n,e,r,t){var i;do i=Un(t);while(n.hasNode(i));return r.dummy=e,n.setNode(i,r),i}function Ba(n){var e=new L().setGraph(n.graph());return c(n.nodes(),function(r){e.setNode(r,n.node(r))}),c(n.edges(),function(r){var t=e.edge(r.v,r.w)||{weight:0,minlen:1},i=n.edge(r);e.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),e}function Xe(n){var e=new L({multigraph:n.isMultigraph()}).setGraph(n.graph());return c(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),c(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function ve(n,e){var r=n.x,t=n.y,i=e.x-r,a=e.y-t,u=n.width/2,o=n.height/2;if(!i&&!a)throw new Error("Not possible to find intersection inside of the rectangle");var s,f;return Math.abs(a)*u>Math.abs(i)*o?(a<0&&(o=-o),s=o*i/a,f=o):(i<0&&(u=-u),s=u,f=u*a/i),{x:r+s,y:t+f}}function pn(n){var e=E(F(Ve(n)+1),function(){return[]});return c(n.nodes(),function(r){var t=n.node(r),i=t.rank;y(i)||(e[i][t.order]=r)}),e}function Ya(n){var e=H(E(n.nodes(),function(r){return n.node(r).rank}));c(n.nodes(),function(r){var t=n.node(r);b(t,"rank")&&(t.rank-=e)})}function Ua(n){var e=H(E(n.nodes(),function(a){return n.node(a).rank})),r=[];c(n.nodes(),function(a){var u=n.node(a).rank-e;r[u]||(r[u]=[]),r[u].push(a)});var t=0,i=n.graph().nodeRankFactor;c(r,function(a,u){y(a)&&u%i!==0?--t:t&&c(a,function(o){n.node(o).rank+=t})})}function ge(n,e,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),k(n,"border",i,e)}function Ve(n){return S(E(n.nodes(),function(e){var r=n.node(e).rank;if(!y(r))return r}))}function qa(n,e){var r={lhs:[],rhs:[]};return c(n,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ha(n,e){var r=Zn();try{return e()}finally{console.log(n+" time: "+(Zn()-r)+"ms")}}function ja(n,e){return e()}function Wa(n){function e(r){var t=n.children(r),i=n.node(r);if(t.length&&c(t,e),b(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,u=i.maxRank+1;a<u;++a)pe(n,"borderLeft","_bl",r,i,a),pe(n,"borderRight","_br",r,i,a)}}c(n.children(),e)}function pe(n,e,r,t,i,a){var u={width:0,height:0,rank:a,borderType:e},o=i[e][a-1],s=k(n,"border",u,r);i[e][a]=s,n.setParent(s,t),o&&n.setEdge(o,s,{weight:1})}function Ka(n){var e=n.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Ze(n)}function Xa(n){var e=n.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&Va(n),(e==="lr"||e==="rl")&&(Za(n),Ze(n))}function Ze(n){c(n.nodes(),function(e){be(n.node(e))}),c(n.edges(),function(e){be(n.edge(e))})}function be(n){var e=n.width;n.width=n.height,n.height=e}function Va(n){c(n.nodes(),function(e){En(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,En),b(r,"y")&&En(r)})}function En(n){n.y=-n.y}function Za(n){c(n.nodes(),function(e){yn(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,yn),b(r,"x")&&yn(r)})}function yn(n){var e=n.x;n.x=n.y,n.y=e}function Ja(n){n.graph().dummyChains=[],c(n.edges(),function(e){Qa(n,e)})}function Qa(n,e){var r=e.v,t=n.node(r).rank,i=e.w,a=n.node(i).rank,u=e.name,o=n.edge(e),s=o.labelRank;if(a!==t+1){n.removeEdge(e);var f,d,h;for(h=0,++t;t<a;++h,++t)o.points=[],d={width:0,height:0,edgeLabel:o,edgeObj:e,rank:t},f=k(n,"edge",d,"_d"),t===s&&(d.width=o.width,d.height=o.height,d.dummy="edge-label",d.labelpos=o.labelpos),n.setEdge(r,f,{weight:o.weight},u),h===0&&n.graph().dummyChains.push(f),r=f;n.setEdge(r,i,{weight:o.weight},u)}}function za(n){c(n.graph().dummyChains,function(e){var r=n.node(e),t=r.edgeLabel,i;for(n.setEdge(r.edgeObj,t);r.dummy;)i=n.successors(e)[0],n.removeNode(e),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),e=i,r=n.node(e)})}function qn(n){var e={};function r(t){var i=n.node(t);if(b(e,t))return i.rank;e[t]=!0;var a=H(E(n.outEdges(t),function(u){return r(u.w)-n.edge(u).minlen}));return(a===Number.POSITIVE_INFINITY||a===void 0||a===null)&&(a=0),i.rank=a}c(n.sources(),r)}function j(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen}function Je(n){var e=new L({directed:!1}),r=n.nodes()[0],t=n.nodeCount();e.setNode(r,{});for(var i,a;nu(e,n)<t;)i=eu(e,n),a=e.hasNode(i.v)?j(n,i):-j(n,i),ru(e,n,a);return e}function nu(n,e){function r(t){c(e.nodeEdges(t),function(i){var a=i.v,u=t===a?i.w:a;!n.hasNode(u)&&!j(e,i)&&(n.setNode(u,{}),n.setEdge(t,u,{}),r(u))})}return c(n.nodes(),r),n.nodeCount()}function eu(n,e){return Yn(e.edges(),function(r){if(n.hasNode(r.v)!==n.hasNode(r.w))return j(e,r)})}function ru(n,e,r){c(n.nodes(),function(t){e.node(t).rank+=r})}function tu(){}tu.prototype=new Error;function Qe(n,e,r){x(e)||(e=[e]);var t=(n.isDirected()?n.successors:n.neighbors).bind(n),i=[],a={};return c(e,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);ze(n,u,r==="post",a,t,i)}),i}function ze(n,e,r,t,i,a){b(t,e)||(t[e]=!0,r||a.push(e),c(i(e),function(u){ze(n,u,r,t,i,a)}),r&&a.push(e))}function iu(n,e){return Qe(n,e,"post")}function au(n,e){return Qe(n,e,"pre")}$.initLowLimValues=jn;$.initCutValues=Hn;$.calcCutValue=nr;$.leaveEdge=rr;$.enterEdge=tr;$.exchangeEdges=ir;function $(n){n=Ba(n),qn(n);var e=Je(n);jn(e),Hn(e,n);for(var r,t;r=rr(e);)t=tr(e,n,r),ir(e,n,r,t)}function Hn(n,e){var r=iu(n,n.nodes());r=r.slice(0,r.length-1),c(r,function(t){uu(n,e,t)})}function uu(n,e,r){var t=n.node(r),i=t.parent;n.edge(r,i).cutvalue=nr(n,e,r)}function nr(n,e,r){var t=n.node(r),i=t.parent,a=!0,u=e.edge(r,i),o=0;return u||(a=!1,u=e.edge(i,r)),o=u.weight,c(e.nodeEdges(r),function(s){var f=s.v===r,d=f?s.w:s.v;if(d!==i){var h=f===a,l=e.edge(s).weight;if(o+=h?l:-l,su(n,r,d)){var g=n.edge(r,d).cutvalue;o+=h?-g:g}}}),o}function jn(n,e){arguments.length<2&&(e=n.nodes()[0]),er(n,{},1,e)}function er(n,e,r,t,i){var a=r,u=n.node(t);return e[t]=!0,c(n.neighbors(t),function(o){b(e,o)||(r=er(n,e,r,o,t))}),u.low=a,u.lim=r++,i?u.parent=i:delete u.parent,r}function rr(n){return Gn(n.edges(),function(e){return n.edge(e).cutvalue<0})}function tr(n,e,r){var t=r.v,i=r.w;e.hasEdge(t,i)||(t=r.w,i=r.v);var a=n.node(t),u=n.node(i),o=a,s=!1;a.lim>u.lim&&(o=u,s=!0);var f=A(e.edges(),function(d){return s===we(n,n.node(d.v),o)&&s!==we(n,n.node(d.w),o)});return Yn(f,function(d){return j(e,d)})}function ir(n,e,r,t){var i=r.v,a=r.w;n.removeEdge(i,a),n.setEdge(t.v,t.w,{}),jn(n),Hn(n,e),ou(n,e)}function ou(n,e){var r=Gn(n.nodes(),function(i){return!e.node(i).parent}),t=au(n,r);t=t.slice(1),c(t,function(i){var a=n.node(i).parent,u=e.edge(i,a),o=!1;u||(u=e.edge(a,i),o=!0),e.node(i).rank=e.node(a).rank+(o?u.minlen:-u.minlen)})}function su(n,e,r){return n.hasEdge(e,r)}function we(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function fu(n){switch(n.graph().ranker){case"network-simplex":me(n);break;case"tight-tree":cu(n);break;case"longest-path":du(n);break;default:me(n)}}var du=qn;function cu(n){qn(n),Je(n)}function me(n){$(n)}function hu(n){var e=k(n,"root",{},"_root"),r=lu(n),t=S(N(r))-1,i=2*t+1;n.graph().nestingRoot=e,c(n.edges(),function(u){n.edge(u).minlen*=i});var a=vu(n)+1;c(n.children(),function(u){ar(n,e,i,a,t,r,u)}),n.graph().nodeRankFactor=i}function ar(n,e,r,t,i,a,u){var o=n.children(u);if(!o.length){u!==e&&n.setEdge(e,u,{weight:0,minlen:r});return}var s=ge(n,"_bt"),f=ge(n,"_bb"),d=n.node(u);n.setParent(s,u),d.borderTop=s,n.setParent(f,u),d.borderBottom=f,c(o,function(h){ar(n,e,r,t,i,a,h);var l=n.node(h),g=l.borderTop?l.borderTop:h,v=l.borderBottom?l.borderBottom:h,p=l.borderTop?t:2*t,m=g!==v?1:i-a[u]+1;n.setEdge(s,g,{weight:p,minlen:m,nestingEdge:!0}),n.setEdge(v,f,{weight:p,minlen:m,nestingEdge:!0})}),n.parent(u)||n.setEdge(e,s,{weight:0,minlen:i+a[u]})}function lu(n){var e={};function r(t,i){var a=n.children(t);a&&a.length&&c(a,function(u){r(u,i+1)}),e[t]=i}return c(n.children(),function(t){r(t,1)}),e}function vu(n){return V(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function gu(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,c(n.edges(),function(r){var t=n.edge(r);t.nestingEdge&&n.removeEdge(r)})}function pu(n,e,r){var t={},i;c(r,function(a){for(var u=n.parent(a),o,s;u;){if(o=n.parent(u),o?(s=t[o],t[o]=u):(s=i,i=u),s&&s!==u){e.setEdge(s,u);return}u=o}})}function bu(n,e,r){var t=wu(n),i=new L({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(a){return n.node(a)});return c(n.nodes(),function(a){var u=n.node(a),o=n.parent(a);(u.rank===e||u.minRank<=e&&e<=u.maxRank)&&(i.setNode(a),i.setParent(a,o||t),c(n[r](a),function(s){var f=s.v===a?s.w:s.v,d=i.edge(f,a),h=y(d)?0:d.weight;i.setEdge(f,a,{weight:n.edge(s).weight+h})}),b(u,"minRank")&&i.setNode(a,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]}))}),i}function wu(n){for(var e;n.hasNode(e=Un("_root")););return e}function mu(n,e){for(var r=0,t=1;t<e.length;++t)r+=_u(n,e[t-1],e[t]);return r}function _u(n,e,r){for(var t=Oa(r,E(r,function(f,d){return d})),i=D(E(e,function(f){return Z(E(n.outEdges(f),function(d){return{pos:t[d.w],weight:n.edge(d).weight}}),"pos")})),a=1;a<r.length;)a<<=1;var u=2*a-1;a-=1;var o=E(new Array(u),function(){return 0}),s=0;return c(i.forEach(function(f){var d=f.pos+a;o[d]+=f.weight;for(var h=0;d>0;)d%2&&(h+=o[d+1]),d=d-1>>1,o[d]+=f.weight;s+=f.weight*h})),s}function Eu(n){var e={},r=A(n.nodes(),function(o){return!n.children(o).length}),t=S(E(r,function(o){return n.node(o).rank})),i=E(F(t+1),function(){return[]});function a(o){if(!b(e,o)){e[o]=!0;var s=n.node(o);i[s.rank].push(o),c(n.successors(o),a)}}var u=Z(r,function(o){return n.node(o).rank});return c(u,a),i}function yu(n,e){return E(e,function(r){var t=n.inEdges(r);if(t.length){var i=V(t,function(a,u){var o=n.edge(u),s=n.node(u.v);return{sum:a.sum+o.weight*s.order,weight:a.weight+o.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function xu(n,e){var r={};c(n,function(i,a){var u=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};y(i.barycenter)||(u.barycenter=i.barycenter,u.weight=i.weight)}),c(e.edges(),function(i){var a=r[i.v],u=r[i.w];!y(a)&&!y(u)&&(u.indegree++,a.out.push(r[i.w]))});var t=A(r,function(i){return!i.indegree});return Tu(t)}function Tu(n){var e=[];function r(a){return function(u){u.merged||(y(u.barycenter)||y(a.barycenter)||u.barycenter>=a.barycenter)&&Lu(a,u)}}function t(a){return function(u){u.in.push(a),--u.indegree===0&&n.push(u)}}for(;n.length;){var i=n.pop();e.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return E(A(e,function(a){return!a.merged}),function(a){return sn(a,["vs","i","barycenter","weight"])})}function Lu(n,e){var r=0,t=0;n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=r/t,n.weight=t,n.i=Math.min(e.i,n.i),e.merged=!0}function Au(n,e){var r=qa(n,function(d){return b(d,"barycenter")}),t=r.lhs,i=Z(r.rhs,function(d){return-d.i}),a=[],u=0,o=0,s=0;t.sort(Nu(!!e)),s=_e(a,i,s),c(t,function(d){s+=d.vs.length,a.push(d.vs),u+=d.barycenter*d.weight,o+=d.weight,s=_e(a,i,s)});var f={vs:D(a)};return o&&(f.barycenter=u/o,f.weight=o),f}function _e(n,e,r){for(var t;e.length&&(t=on(e)).i<=r;)e.pop(),n.push(t.vs),r++;return r}function Nu(n){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:n?r.i-e.i:e.i-r.i}}function ur(n,e,r,t){var i=n.children(e),a=n.node(e),u=a?a.borderLeft:void 0,o=a?a.borderRight:void 0,s={};u&&(i=A(i,function(v){return v!==u&&v!==o}));var f=yu(n,i);c(f,function(v){if(n.children(v.v).length){var p=ur(n,v.v,r,t);s[v.v]=p,b(p,"barycenter")&&Cu(v,p)}});var d=xu(f,r);Ou(d,s);var h=Au(d,t);if(u&&(h.vs=D([u,h.vs,o]),n.predecessors(u).length)){var l=n.node(n.predecessors(u)[0]),g=n.node(n.predecessors(o)[0]);b(h,"barycenter")||(h.barycenter=0,h.weight=0),h.barycenter=(h.barycenter*h.weight+l.order+g.order)/(h.weight+2),h.weight+=2}return h}function Ou(n,e){c(n,function(r){r.vs=D(r.vs.map(function(t){return e[t]?e[t].vs:t}))})}function Cu(n,e){y(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 Iu(n){var e=Ve(n),r=Ee(n,F(1,e+1),"inEdges"),t=Ee(n,F(e-1,-1,-1),"outEdges"),i=Eu(n);ye(n,i);for(var a=Number.POSITIVE_INFINITY,u,o=0,s=0;s<4;++o,++s){Pu(o%2?r:t,o%4>=2),i=pn(n);var f=mu(n,i);f<a&&(s=0,u=ai(i),a=f)}ye(n,u)}function Ee(n,e,r){return E(e,function(t){return bu(n,t,r)})}function Pu(n,e){var r=new L;c(n,function(t){var i=t.graph().root,a=ur(t,i,r,e);c(a.vs,function(u,o){t.node(u).order=o}),pu(t,r,a.vs)})}function ye(n,e){c(e,function(r){c(r,function(t,i){n.node(t).order=i})})}function Su(n){var e=Ru(n);c(n.graph().dummyChains,function(r){for(var t=n.node(r),i=t.edgeObj,a=$u(n,e,i.v,i.w),u=a.path,o=a.lca,s=0,f=u[s],d=!0;r!==i.w;){if(t=n.node(r),d){for(;(f=u[s])!==o&&n.node(f).maxRank<t.rank;)s++;f===o&&(d=!1)}if(!d){for(;s<u.length-1&&n.node(f=u[s+1]).minRank<=t.rank;)s++;f=u[s]}n.setParent(r,f),r=n.successors(r)[0]}})}function $u(n,e,r,t){var i=[],a=[],u=Math.min(e[r].low,e[t].low),o=Math.max(e[r].lim,e[t].lim),s,f;s=r;do s=n.parent(s),i.push(s);while(s&&(e[s].low>u||o>e[s].lim));for(f=s,s=t;(s=n.parent(s))!==f;)a.push(s);return{path:i.concat(a.reverse()),lca:f}}function Ru(n){var e={},r=0;function t(i){var a=r;c(n.children(i),t),e[i]={low:a,lim:r++}}return c(n.children(),t),e}function Mu(n,e){var r={};function t(i,a){var u=0,o=0,s=i.length,f=on(a);return c(a,function(d,h){var l=Du(n,d),g=l?n.node(l).order:s;(l||d===f)&&(c(a.slice(o,h+1),function(v){c(n.predecessors(v),function(p){var m=n.node(p),_=m.order;(_<u||g<_)&&!(m.dummy&&n.node(v).dummy)&&or(r,p,v)})}),o=h+1,u=g)}),a}return V(e,t),r}function Fu(n,e){var r={};function t(a,u,o,s,f){var d;c(F(u,o),function(h){d=a[h],n.node(d).dummy&&c(n.predecessors(d),function(l){var g=n.node(l);g.dummy&&(g.order<s||g.order>f)&&or(r,l,d)})})}function i(a,u){var o=-1,s,f=0;return c(u,function(d,h){if(n.node(d).dummy==="border"){var l=n.predecessors(d);l.length&&(s=n.node(l[0]).order,t(u,f,h,o,s),f=h,o=s)}t(u,f,u.length,s,a.length)}),u}return V(e,i),r}function Du(n,e){if(n.node(e).dummy)return Gn(n.predecessors(e),function(r){return n.node(r).dummy})}function or(n,e,r){if(e>r){var t=e;e=r,r=t}var i=n[e];i||(n[e]=i={}),i[r]=!0}function ku(n,e,r){if(e>r){var t=e;e=r,r=t}return b(n[e],r)}function Gu(n,e,r,t){var i={},a={},u={};return c(e,function(o){c(o,function(s,f){i[s]=s,a[s]=s,u[s]=f})}),c(e,function(o){var s=-1;c(o,function(f){var d=t(f);if(d.length){d=Z(d,function(p){return u[p]});for(var h=(d.length-1)/2,l=Math.floor(h),g=Math.ceil(h);l<=g;++l){var v=d[l];a[f]===f&&s<u[v]&&!ku(r,f,v)&&(a[v]=f,a[f]=i[f]=i[v],s=u[v])}}})}),{root:i,align:a}}function Bu(n,e,r,t,i){var a={},u=Yu(n,e,r,i),o=i?"borderLeft":"borderRight";function s(h,l){for(var g=u.nodes(),v=g.pop(),p={};v;)p[v]?h(v):(p[v]=!0,g.push(v),g=g.concat(l(v))),v=g.pop()}function f(h){a[h]=u.inEdges(h).reduce(function(l,g){return Math.max(l,a[g.v]+u.edge(g))},0)}function d(h){var l=u.outEdges(h).reduce(function(v,p){return Math.min(v,a[p.w]-u.edge(p))},Number.POSITIVE_INFINITY),g=n.node(h);l!==Number.POSITIVE_INFINITY&&g.borderType!==o&&(a[h]=Math.max(a[h],l))}return s(f,u.predecessors.bind(u)),s(d,u.successors.bind(u)),c(t,function(h){a[h]=a[r[h]]}),a}function Yu(n,e,r,t){var i=new L,a=n.graph(),u=Wu(a.nodesep,a.edgesep,t);return c(e,function(o){var s;c(o,function(f){var d=r[f];if(i.setNode(d),s){var h=r[s],l=i.edge(h,d);i.setEdge(h,d,Math.max(u(n,f,s),l||0))}s=f})}),i}function Uu(n,e){return Yn(N(e),function(r){var t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return ra(r,function(a,u){var o=Ku(n,u)/2;t=Math.max(a+o,t),i=Math.min(a-o,i)}),t-i})}function qu(n,e){var r=N(e),t=H(r),i=S(r);c(["u","d"],function(a){c(["l","r"],function(u){var o=a+u,s=n[o],f;if(s!==e){var d=N(s);f=u==="l"?t-H(d):i-S(d),f&&(n[o]=gn(s,function(h){return h+f}))}})})}function Hu(n,e){return gn(n.ul,function(r,t){if(e)return n[e.toLowerCase()][t];var i=Z(E(n,t));return(i[1]+i[2])/2})}function ju(n){var e=pn(n),r=An(Mu(n,e),Fu(n,e)),t={},i;c(["u","d"],function(u){i=u==="u"?e:N(e).reverse(),c(["l","r"],function(o){o==="r"&&(i=E(i,function(h){return N(h).reverse()}));var s=(u==="u"?n.predecessors:n.successors).bind(n),f=Gu(n,i,r,s),d=Bu(n,i,f.root,f.align,o==="r");o==="r"&&(d=gn(d,function(h){return-h})),t[u+o]=d})});var a=Uu(n,t);return qu(t,a),Hu(t,n.graph().align)}function Wu(n,e,r){return function(t,i,a){var u=t.node(i),o=t.node(a),s=0,f;if(s+=u.width/2,b(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":f=-u.width/2;break;case"r":f=u.width/2;break}if(f&&(s+=r?f:-f),f=0,s+=(u.dummy?e:n)/2,s+=(o.dummy?e:n)/2,s+=o.width/2,b(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":f=o.width/2;break;case"r":f=-o.width/2;break}return f&&(s+=r?f:-f),f=0,s}}function Ku(n,e){return n.node(e).width}function Xu(n){n=Xe(n),Vu(n),ta(ju(n),function(e,r){n.node(r).x=e})}function Vu(n){var e=pn(n),r=n.graph().ranksep,t=0;c(e,function(i){var a=S(E(i,function(u){return n.node(u).height}));c(i,function(u){n.node(u).y=t+a/2}),t+=a+r})}function Eo(n,e){var r=e&&e.debugTiming?Ha:ja;r("layout",function(){var t=r(" buildLayoutGraph",function(){return uo(n)});r(" runLayout",function(){Zu(t,r)}),r(" updateInputGraph",function(){Ju(n,t)})})}function Zu(n,e){e(" makeSpaceForEdgeLabels",function(){oo(n)}),e(" removeSelfEdges",function(){bo(n)}),e(" acyclic",function(){Da(n)}),e(" nestingGraph.run",function(){hu(n)}),e(" rank",function(){fu(Xe(n))}),e(" injectEdgeLabelProxies",function(){so(n)}),e(" removeEmptyRanks",function(){Ua(n)}),e(" nestingGraph.cleanup",function(){gu(n)}),e(" normalizeRanks",function(){Ya(n)}),e(" assignRankMinMax",function(){fo(n)}),e(" removeEdgeLabelProxies",function(){co(n)}),e(" normalize.run",function(){Ja(n)}),e(" parentDummyChains",function(){Su(n)}),e(" addBorderSegments",function(){Wa(n)}),e(" order",function(){Iu(n)}),e(" insertSelfEdges",function(){wo(n)}),e(" adjustCoordinateSystem",function(){Ka(n)}),e(" position",function(){Xu(n)}),e(" positionSelfEdges",function(){mo(n)}),e(" removeBorderNodes",function(){po(n)}),e(" normalize.undo",function(){za(n)}),e(" fixupEdgeLabelCoords",function(){vo(n)}),e(" undoCoordinateSystem",function(){Xa(n)}),e(" translateGraph",function(){ho(n)}),e(" assignNodeIntersects",function(){lo(n)}),e(" reversePoints",function(){go(n)}),e(" acyclic.undo",function(){Ga(n)})}function Ju(n,e){c(n.nodes(),function(r){var t=n.node(r),i=e.node(r);t&&(t.x=i.x,t.y=i.y,e.children(r).length&&(t.width=i.width,t.height=i.height))}),c(n.edges(),function(r){var t=n.edge(r),i=e.edge(r);t.points=i.points,b(i,"x")&&(t.x=i.x,t.y=i.y)}),n.graph().width=e.graph().width,n.graph().height=e.graph().height}var Qu=["nodesep","edgesep","ranksep","marginx","marginy"],zu={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},no=["acyclicer","ranker","rankdir","align"],eo=["width","height"],ro={width:0,height:0},to=["minlen","weight","width","height","labeloffset"],io={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ao=["labelpos"];function uo(n){var e=new L({multigraph:!0,compound:!0}),r=Tn(n.graph());return e.setGraph(An({},zu,xn(r,Qu),sn(r,no))),c(n.nodes(),function(t){var i=Tn(n.node(t));e.setNode(t,Zi(xn(i,eo),ro)),e.setParent(t,n.parent(t))}),c(n.edges(),function(t){var i=Tn(n.edge(t));e.setEdge(t,An({},io,xn(i,to),sn(i,ao)))}),e}function oo(n){var e=n.graph();e.ranksep/=2,c(n.edges(),function(r){var t=n.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function so(n){c(n.edges(),function(e){var r=n.edge(e);if(r.width&&r.height){var t=n.node(e.v),i=n.node(e.w),a={rank:(i.rank-t.rank)/2+t.rank,e};k(n,"edge-proxy",a,"_ep")}})}function fo(n){var e=0;c(n.nodes(),function(r){var t=n.node(r);t.borderTop&&(t.minRank=n.node(t.borderTop).rank,t.maxRank=n.node(t.borderBottom).rank,e=S(e,t.maxRank))}),n.graph().maxRank=e}function co(n){c(n.nodes(),function(e){var r=n.node(e);r.dummy==="edge-proxy"&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}function ho(n){var e=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,a=n.graph(),u=a.marginx||0,o=a.marginy||0;function s(f){var d=f.x,h=f.y,l=f.width,g=f.height;e=Math.min(e,d-l/2),r=Math.max(r,d+l/2),t=Math.min(t,h-g/2),i=Math.max(i,h+g/2)}c(n.nodes(),function(f){s(n.node(f))}),c(n.edges(),function(f){var d=n.edge(f);b(d,"x")&&s(d)}),e-=u,t-=o,c(n.nodes(),function(f){var d=n.node(f);d.x-=e,d.y-=t}),c(n.edges(),function(f){var d=n.edge(f);c(d.points,function(h){h.x-=e,h.y-=t}),b(d,"x")&&(d.x-=e),b(d,"y")&&(d.y-=t)}),a.width=r-e+u,a.height=i-t+o}function lo(n){c(n.edges(),function(e){var r=n.edge(e),t=n.node(e.v),i=n.node(e.w),a,u;r.points?(a=r.points[0],u=r.points[r.points.length-1]):(r.points=[],a=i,u=t),r.points.unshift(ve(t,a)),r.points.push(ve(i,u))})}function vo(n){c(n.edges(),function(e){var r=n.edge(e);if(b(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 go(n){c(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}function po(n){c(n.nodes(),function(e){if(n.children(e).length){var r=n.node(e),t=n.node(r.borderTop),i=n.node(r.borderBottom),a=n.node(on(r.borderLeft)),u=n.node(on(r.borderRight));r.width=Math.abs(u.x-a.x),r.height=Math.abs(i.y-t.y),r.x=a.x+r.width/2,r.y=t.y+r.height/2}}),c(n.nodes(),function(e){n.node(e).dummy==="border"&&n.removeNode(e)})}function bo(n){c(n.edges(),function(e){if(e.v===e.w){var r=n.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:n.edge(e)}),n.removeEdge(e)}})}function wo(n){var e=pn(n);c(e,function(r){var t=0;c(r,function(i,a){var u=n.node(i);u.order=a+t,c(u.selfEdges,function(o){k(n,"selfedge",{width:o.label.width,height:o.label.height,rank:u.rank,order:a+ ++t,e:o.e,label:o.label},"_se")}),delete u.selfEdges})})}function mo(n){c(n.nodes(),function(e){var r=n.node(e);if(r.dummy==="selfedge"){var t=n.node(r.e.v),i=t.x+t.width/2,a=t.y,u=r.x-i,o=t.height/2;n.setEdge(r.e,r.label),n.removeNode(e),r.label.points=[{x:i+2*u/3,y:a-o},{x:i+5*u/6,y:a-o},{x:i+u,y:a},{x:i+5*u/6,y:a+o},{x:i+2*u/3,y:a+o}],r.label.x=r.x,r.label.y=r.y}})}function xn(n,e){return gn(sn(n,e),Number)}function Tn(n){var e={};return c(n,function(r,t){e[t.toLowerCase()]=r}),e}export{L as G,en as b,Zi as d,c as f,b as h,y as i,Eo as l,E as m,sn as p,F as r,Un as u};