2 lines
42 KiB
JavaScript
2 lines
42 KiB
JavaScript
import{d as Un,i as ve,e as Pn,t as rn,f as Xe,g as Ke,U as qn,h as Hn,S as D,k as y,j as ge,l as tn,m as pe,n as Ze,o as Je,p as Qe,q as ze,r as je,s as nr,u as er,a as rr,v as tr,c as ir}from"./_baseSet-db0c20a6.js";import{d as H,e as an,a as Q,j as ar,k as Vn,b as En,c as we,p as ur,i as xn,l as or,S as cn}from"./_getTag-edecb89a.js";import{i as E,a as G,t as sr}from"./toString-25ea340b.js";import{S as z,a as j,b as fr,i as yn}from"./isSymbol-50749e90.js";import{i as un}from"./isObject-32699ff3.js";import{a as dr}from"./parseCss-0603dd28.js";import{al as Wn}from"./intro.stories-11dbe3c4.js";import{t as hr,n as Xn}from"./now-bd49f550.js";var Kn=1/0,lr=17976931348623157e292;function J(n){if(!n)return n===0?n:0;if(n=hr(n),n===Kn||n===-Kn){var e=n<0?-1:1;return e*lr}return n===n?n:0}function cr(n){var e=J(n),r=e%1;return e===e?r?e-r:e:0}function R(n){return n}function vr(n,e,r){switch(r.length){case 0:return n.call(e);case 1:return n.call(e,r[0]);case 2:return n.call(e,r[0],r[1]);case 3:return n.call(e,r[0],r[1],r[2])}return n.apply(e,r)}function gr(){}var pr=800,wr=16,mr=Date.now;function br(n){var e=0,r=0;return function(){var t=mr(),i=wr-(t-r);if(r=t,i>0){if(++e>=pr)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function I(n){return function(){return n}}var _r=Un?function(n,e){return Un(n,"toString",{configurable:!0,enumerable:!1,value:I(e),writable:!0})}:R;const Er=_r;var xr=br(Er);const me=xr;function be(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 yr(n){return n!==n}function Lr(n,e,r){for(var t=r-1,i=n.length;++t<i;)if(n[t]===e)return t;return-1}function Nr(n,e,r){return e===e?Lr(n,e,r):be(n,yr,r)}function Or(n,e){var r=n==null?0:n.length;return!!r&&Nr(n,e,0)>-1}var Zn=Math.max;function _e(n,e,r){return e=Zn(e===void 0?n.length-1:e,0),function(){for(var t=arguments,i=-1,a=Zn(t.length-e,0),u=Array(a);++i<a;)u[i]=t[e+i];i=-1;for(var o=Array(e+1);++i<e;)o[i]=t[i];return o[e]=r(u),vr(n,this,o)}}function on(n,e){return me(_e(n,e,R),n+"")}function B(n,e,r){if(!un(r))return!1;var t=typeof e;return(t=="number"?H(r)&&ve(e,r.length):t=="string"&&e in r)?an(r[e],n):!1}function Cr(n){return on(function(e,r){var t=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=n.length>3&&typeof a=="function"?(i--,a):void 0,u&&B(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++t<i;){var o=r[t];o&&n(e,o,t,a)}return e})}function sn(n,e){e=Pn(e,n);for(var r=0,t=e.length;n!=null&&r<t;)n=n[rn(e[r++])];return r&&r==t?n:void 0}function Pr(n,e,r){var t=n==null?void 0:sn(n,e);return t===void 0?r:t}var Jn=z?z.isConcatSpreadable:void 0;function Tr(n){return E(n)||Q(n)||!!(Jn&&n&&n[Jn])}function fn(n,e,r,t,i){var a=-1,u=n.length;for(r||(r=Tr),i||(i=[]);++a<u;){var o=n[a];e>0&&r(o)?e>1?fn(o,e-1,r,t,i):Xe(i,o):t||(i[i.length]=o)}return i}function F(n){var e=n==null?0:n.length;return e?fn(n,1):[]}function Ar(n){return me(_e(n,void 0,F),n+"")}var Rr="[object Object]",Mr=Function.prototype,Ir=Object.prototype,Ee=Mr.toString,Sr=Ir.hasOwnProperty,Fr=Ee.call(Object);function kr(n){if(!j(n)||fr(n)!=Rr)return!1;var e=Ke(n);if(e===null)return!0;var r=Sr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Ee.call(r)==Fr}var $r="__lodash_hash_undefined__";function Dr(n){return this.__data__.set(n,$r),this}function Gr(n){return this.__data__.has(n)}function Y(n){var e=-1,r=n==null?0:n.length;for(this.__data__=new ar;++e<r;)this.add(n[e])}Y.prototype.add=Y.prototype.push=Dr;Y.prototype.has=Gr;function Br(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 xe(n,e){return n.has(e)}var Yr=1,Ur=2;function ye(n,e,r,t,i,a){var u=r&Yr,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 l=-1,c=!0,g=r&Ur?new Y:void 0;for(a.set(n,e),a.set(e,n);++l<o;){var v=n[l],w=e[l];if(t)var _=u?t(w,v,l,e,n,a):t(v,w,l,n,e,a);if(_!==void 0){if(_)continue;c=!1;break}if(g){if(!Br(e,function(x,P){if(!xe(g,P)&&(v===x||i(v,x,r,t,a)))return g.push(P)})){c=!1;break}}else if(!(v===w||i(v,w,r,t,a))){c=!1;break}}return a.delete(n),a.delete(e),c}function qr(n){var e=-1,r=Array(n.size);return n.forEach(function(t,i){r[++e]=[i,t]}),r}function Tn(n){var e=-1,r=Array(n.size);return n.forEach(function(t){r[++e]=t}),r}var Hr=1,Vr=2,Wr="[object Boolean]",Xr="[object Date]",Kr="[object Error]",Zr="[object Map]",Jr="[object Number]",Qr="[object RegExp]",zr="[object Set]",jr="[object String]",nt="[object Symbol]",et="[object ArrayBuffer]",rt="[object DataView]",Qn=z?z.prototype:void 0,vn=Qn?Qn.valueOf:void 0;function tt(n,e,r,t,i,a,u){switch(r){case rt:if(n.byteLength!=e.byteLength||n.byteOffset!=e.byteOffset)return!1;n=n.buffer,e=e.buffer;case et:return!(n.byteLength!=e.byteLength||!a(new qn(n),new qn(e)));case Wr:case Xr:case Jr:return an(+n,+e);case Kr:return n.name==e.name&&n.message==e.message;case Qr:case jr:return n==e+"";case Zr:var o=qr;case zr:var s=t&Hr;if(o||(o=Tn),n.size!=e.size&&!s)return!1;var f=u.get(n);if(f)return f==e;t|=Vr,u.set(n,e);var d=ye(o(n),o(e),t,i,a,u);return u.delete(n),d;case nt:if(vn)return vn.call(n)==vn.call(e)}return!1}var it=1,at=Object.prototype,ut=at.hasOwnProperty;function ot(n,e,r,t,i,a){var u=r&it,o=Hn(n),s=o.length,f=Hn(e),d=f.length;if(s!=d&&!u)return!1;for(var l=s;l--;){var c=o[l];if(!(u?c in e:ut.call(e,c)))return!1}var g=a.get(n),v=a.get(e);if(g&&v)return g==e&&v==n;var w=!0;a.set(n,e),a.set(e,n);for(var _=u;++l<s;){c=o[l];var x=n[c],P=e[c];if(t)var Yn=u?t(P,x,c,e,n,a):t(x,P,c,n,e,a);if(!(Yn===void 0?x===P||i(x,P,r,t,a):Yn)){w=!1;break}_||(_=c=="constructor")}if(w&&!_){var X=n.constructor,K=e.constructor;X!=K&&"constructor"in n&&"constructor"in e&&!(typeof X=="function"&&X instanceof X&&typeof K=="function"&&K instanceof K)&&(w=!1)}return a.delete(n),a.delete(e),w}var st=1,zn="[object Arguments]",jn="[object Array]",Z="[object Object]",ft=Object.prototype,ne=ft.hasOwnProperty;function dt(n,e,r,t,i,a){var u=E(n),o=E(e),s=u?jn:Vn(n),f=o?jn:Vn(e);s=s==zn?Z:s,f=f==zn?Z:f;var d=s==Z,l=f==Z,c=s==f;if(c&&En(n)){if(!En(e))return!1;u=!0,d=!1}if(c&&!d)return a||(a=new D),u||we(n)?ye(n,e,r,t,i,a):tt(n,e,s,r,t,i,a);if(!(r&st)){var g=d&&ne.call(n,"__wrapped__"),v=l&&ne.call(e,"__wrapped__");if(g||v){var w=g?n.value():n,_=v?e.value():e;return a||(a=new D),i(w,_,r,t,a)}}return c?(a||(a=new D),ot(n,e,r,t,i,a)):!1}function An(n,e,r,t,i){return n===e?!0:n==null||e==null||!j(n)&&!j(e)?n!==n&&e!==e:dt(n,e,r,t,An,i)}var ht=1,lt=2;function ct(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 l=new D;if(t)var c=t(f,d,s,n,e,l);if(!(c===void 0?An(d,f,ht|lt,t,l):c))return!1}}return!0}function Le(n){return n===n&&!un(n)}function vt(n){for(var e=y(n),r=e.length;r--;){var t=e[r],i=n[t];e[r]=[t,i,Le(i)]}return e}function Ne(n,e){return function(r){return r==null?!1:r[n]===e&&(e!==void 0||n in Object(r))}}function gt(n){var e=vt(n);return e.length==1&&e[0][2]?Ne(e[0][0],e[0][1]):function(r){return r===n||ct(r,n,e)}}function pt(n,e){return n!=null&&e in Object(n)}function Oe(n,e,r){e=Pn(e,n);for(var t=-1,i=e.length,a=!1;++t<i;){var u=rn(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&&ur(i)&&ve(u,i)&&(E(n)||Q(n)))}function Ce(n,e){return n!=null&&Oe(n,e,pt)}var wt=1,mt=2;function bt(n,e){return ge(n)&&Le(e)?Ne(rn(n),e):function(r){var t=Pr(r,n);return t===void 0&&t===e?Ce(r,n):An(e,t,wt|mt)}}function _t(n){return function(e){return e==null?void 0:e[n]}}function Et(n){return function(e){return sn(e,n)}}function xt(n){return ge(n)?_t(rn(n)):Et(n)}function C(n){return typeof n=="function"?n:n==null?R:typeof n=="object"?E(n)?bt(n[0],n[1]):gt(n):xt(n)}function yt(n){return function(e,r,t){for(var i=-1,a=Object(e),u=t(e),o=u.length;o--;){var s=u[n?o:++i];if(r(a[s],s,a)===!1)break}return e}}var Lt=yt();const Rn=Lt;function Mn(n,e){return n&&Rn(n,e,y)}function Nt(n,e){return function(r,t){if(r==null)return r;if(!H(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 Ot=Nt(Mn);const dn=Ot;var Pe=Object.prototype,Ct=Pe.hasOwnProperty,Pt=on(function(n,e){n=Object(n);var r=-1,t=e.length,i=t>2?e[2]:void 0;for(i&&B(e[0],e[1],i)&&(t=1);++r<t;)for(var a=e[r],u=tn(a),o=-1,s=u.length;++o<s;){var f=u[o],d=n[f];(d===void 0||an(d,Pe[f])&&!Ct.call(n,f))&&(n[f]=a[f])}return n});const Tt=Pt;function Ln(n,e,r){(r!==void 0&&!an(n[e],r)||r===void 0&&!(e in n))&&pe(n,e,r)}function Te(n){return j(n)&&H(n)}function Nn(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function At(n){return Ze(n,tn(n))}function Rt(n,e,r,t,i,a,u){var o=Nn(n,r),s=Nn(e,r),f=u.get(s);if(f){Ln(n,r,f);return}var d=a?a(o,s,r+"",n,e,u):void 0,l=d===void 0;if(l){var c=E(s),g=!c&&En(s),v=!c&&!g&&we(s);d=s,c||g||v?E(o)?d=o:Te(o)?d=Je(o):g?(l=!1,d=Qe(s,!0)):v?(l=!1,d=ze(s,!0)):d=[]:kr(s)||Q(s)?(d=o,Q(o)?d=At(o):(!un(o)||xn(o))&&(d=je(s))):l=!1}l&&(u.set(s,d),i(d,s,t,a,u),u.delete(s)),Ln(n,r,d)}function Ae(n,e,r,t,i){n!==e&&Rn(e,function(a,u){if(i||(i=new D),un(a))Rt(n,e,u,r,Ae,t,i);else{var o=t?t(Nn(n,u),a,u+"",n,e,i):void 0;o===void 0&&(o=a),Ln(n,u,o)}},tn)}function Mt(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 nn(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function In(n){return typeof n=="function"?n:R}function h(n,e){var r=E(n)?nr:dn;return r(n,In(e))}function It(n,e){var r=[];return dn(n,function(t,i,a){e(t,i,a)&&r.push(t)}),r}function N(n,e){var r=E(n)?er:It;return r(n,C(e))}function St(n){return function(e,r,t){var i=Object(e);if(!H(e)){var a=C(r);e=y(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 Ft=Math.max;function kt(n,e,r){var t=n==null?0:n.length;if(!t)return-1;var i=r==null?0:cr(r);return i<0&&(i=Ft(t+i,0)),be(n,C(e),i)}var $t=St(kt);const Sn=$t;function Re(n,e){var r=-1,t=H(n)?Array(n.length):[];return dn(n,function(i,a,u){t[++r]=e(i,a,u)}),t}function m(n,e){var r=E(n)?G:Re;return r(n,C(e))}function Dt(n,e){return n==null?n:Rn(n,In(e),tn)}function Gt(n,e){return n&&Mn(n,In(e))}function Bt(n,e){return n>e}var Yt=Object.prototype,Ut=Yt.hasOwnProperty;function qt(n,e){return n!=null&&Ut.call(n,e)}function p(n,e){return n!=null&&Oe(n,e,qt)}function Ht(n,e){return G(e,function(r){return n[r]})}function O(n){return n==null?[]:Ht(n,y(n))}function b(n){return n===void 0}function Me(n,e){return n<e}function hn(n,e){var r={};return e=C(e),Mn(n,function(t,i,a){pe(r,i,e(t,i,a))}),r}function Fn(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&&!yn(u):r(u,o)))var o=u,s=a}return s}function A(n){return n&&n.length?Fn(n,R,Bt):void 0}var Vt=Cr(function(n,e,r){Ae(n,e,r)});const On=Vt;function U(n){return n&&n.length?Fn(n,R,Me):void 0}function kn(n,e){return n&&n.length?Fn(n,C(e),Me):void 0}function Wt(n,e,r){for(var t=-1,i=e.length,a={};++t<i;){var u=e[t],o=sn(n,u);r(o,u)&&rr(a,Pn(u,n),o)}return a}function Xt(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function Kt(n,e){if(n!==e){var r=n!==void 0,t=n===null,i=n===n,a=yn(n),u=e!==void 0,o=e===null,s=e===e,f=yn(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 Zt(n,e,r){for(var t=-1,i=n.criteria,a=e.criteria,u=i.length,o=r.length;++t<u;){var s=Kt(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 Jt(n,e,r){e.length?e=G(e,function(a){return E(a)?function(u){return sn(u,a.length===1?a[0]:a)}:a}):e=[R];var t=-1;e=G(e,or(C));var i=Re(n,function(a,u,o){var s=G(e,function(f){return f(a)});return{criteria:s,index:++t,value:a}});return Xt(i,function(a,u){return Zt(a,u,r)})}function Qt(n,e){return Wt(n,e,function(r,t){return Ce(n,t)})}var zt=Ar(function(n,e){return n==null?{}:Qt(n,e)});const en=zt;var jt=Math.ceil,ni=Math.max;function ei(n,e,r,t){for(var i=-1,a=ni(jt((e-n)/(r||1)),0),u=Array(a);a--;)u[t?a:++i]=n,n+=r;return u}function ri(n){return function(e,r,t){return t&&typeof t!="number"&&B(e,r,t)&&(r=t=void 0),e=J(e),r===void 0?(r=e,e=0):r=J(r),t=t===void 0?e<r?1:-1:J(t),ei(e,r,t,n)}}var ti=ri();const S=ti;function ii(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=E(n)?dr:ii,i=arguments.length<3;return t(n,C(e),r,i,dn)}var ai=on(function(n,e){if(n==null)return[];var r=e.length;return r>1&&B(n,e[0],e[1])?e=[]:r>2&&B(e[0],e[1],e[2])&&(e=[e[0]]),Jt(n,fn(e,1),[])});const W=ai;var ui=1/0,oi=cn&&1/Tn(new cn([,-0]))[1]==ui?function(n){return new cn(n)}:gr;const si=oi;var fi=200;function di(n,e,r){var t=-1,i=Or,a=n.length,u=!0,o=[],s=o;if(r)u=!1,i=Mt;else if(a>=fi){var f=e?null:si(n);if(f)return Tn(f);u=!1,i=xe,s=new Y}else s=e?[]:o;n:for(;++t<a;){var d=n[t],l=e?e(d):d;if(d=r||d!==0?d:0,u&&l===l){for(var c=s.length;c--;)if(s[c]===l)continue n;e&&s.push(l),o.push(d)}else i(s,l,r)||(s!==o&&s.push(l),o.push(d))}return o}var hi=on(function(n){return di(fn(n,1,Te,!0))});const li=hi;var ci=0;function $n(n){var e=++ci;return sr(n)+e}function vi(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 gi(n,e){return vi(n||[],e||[],tr)}var pi="\0",T="\0",ee="";class L{constructor(e={}){this._isDirected=p(e,"directed")?e.directed:!0,this._isMultigraph=p(e,"multigraph")?e.multigraph:!1,this._isCompound=p(e,"compound")?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=I(void 0),this._defaultEdgeLabelFn=I(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[T]={}),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=I(e)),this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return y(this._nodes)}sources(){var e=this;return N(this.nodes(),function(r){return Wn(e._in[r])})}sinks(){var e=this;return N(this.nodes(),function(r){return Wn(e._out[r])})}setNodes(e,r){var t=arguments,i=this;return h(e,function(a){t.length>1?i.setNode(a,r):i.setNode(a)}),this}setNode(e,r){return p(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]=T,this._children[e]={},this._children[T][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 p(this._nodes,e)}removeNode(e){var r=this;if(p(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],h(this.children(e),function(i){r.setParent(i)}),delete this._children[e]),h(y(this._in[e]),t),delete this._in[e],delete this._preds[e],h(y(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(b(r))r=T;else{r+="";for(var t=r;!b(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!==T)return r}}children(e){if(b(e)&&(e=T),this._isCompound){var r=this._children[e];if(r)return y(r)}else{if(e===T)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var r=this._preds[e];if(r)return y(r)}successors(e){var r=this._sucs[e];if(r)return y(r)}neighbors(e){var r=this.predecessors(e);if(r)return li(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;h(this._nodes,function(u,o){e(o)&&r.setNode(o,u)}),h(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&&h(r.nodes(),function(u){r.setParent(u,a(u))}),r}setDefaultEdgeLabel(e){return xn(e)||(e=I(e)),this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return O(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,b(t)||(t=""+t);var o=$(this._isDirected,e,r,t);if(p(this._edgeLabels,o))return a&&(this._edgeLabels[o]=i),this;if(!b(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=wi(this._isDirected,e,r,t);return e=s.v,r=s.w,Object.freeze(s),this._edgeObjs[o]=s,re(this._preds[r],e),re(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?gn(this._isDirected,arguments[0]):$(this._isDirected,e,r,t);return this._edgeLabels[i]}hasEdge(e,r,t){var i=arguments.length===1?gn(this._isDirected,arguments[0]):$(this._isDirected,e,r,t);return p(this._edgeLabels,i)}removeEdge(e,r,t){var i=arguments.length===1?gn(this._isDirected,arguments[0]):$(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],te(this._preds[r],e),te(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=O(t);return r?N(i,function(a){return a.v===r}):i}}outEdges(e,r){var t=this._out[e];if(t){var i=O(t);return r?N(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 re(n,e){n[e]?n[e]++:n[e]=1}function te(n,e){--n[e]||delete n[e]}function $(n,e,r,t){var i=""+e,a=""+r;if(!n&&i>a){var u=i;i=a,a=u}return i+ee+a+ee+(b(t)?pi:t)}function wi(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 gn(n,e){return $(n,e.v,e.w,e.name)}class mi{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return ie(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&ie(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,bi)),t=t._prev;return"["+e.join(", ")+"]"}}function ie(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function bi(n,e){if(n!=="_next"&&n!=="_prev")return e}var _i=I(1);function Ei(n,e){if(n.nodeCount()<=1)return[];var r=yi(n,e||_i),t=xi(r.graph,r.buckets,r.zeroIdx);return F(m(t,function(i){return n.outEdges(i.v,i.w)}))}function xi(n,e,r){for(var t=[],i=e[e.length-1],a=e[0],u;n.nodeCount();){for(;u=a.dequeue();)pn(n,e,r,u);for(;u=i.dequeue();)pn(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(pn(n,e,r,u,!0));break}}}return t}function pn(n,e,r,t,i){var a=i?[]:void 0;return h(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,Cn(e,r,s)}),h(n.outEdges(t.v),function(u){var o=n.edge(u),s=u.w,f=n.node(s);f.in-=o,Cn(e,r,f)}),n.removeNode(t.v),a}function yi(n,e){var r=new L,t=0,i=0;h(n.nodes(),function(o){r.setNode(o,{v:o,in:0,out:0})}),h(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=S(i+t+3).map(function(){return new mi}),u=t+1;return h(r.nodes(),function(o){Cn(a,u,r.node(o))}),{graph:r,buckets:a,zeroIdx:u}}function Cn(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 Li(n){var e=n.graph().acyclicer==="greedy"?Ei(n,r(n)):Ni(n);h(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,$n("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function Ni(n){var e=[],r={},t={};function i(a){p(t,a)||(t[a]=!0,r[a]=!0,h(n.outEdges(a),function(u){p(r,u.w)?e.push(u):i(u.w)}),delete r[a])}return h(n.nodes(),i),e}function Oi(n){h(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=$n(t);while(n.hasNode(i));return r.dummy=e,n.setNode(i,r),i}function Ci(n){var e=new L().setGraph(n.graph());return h(n.nodes(),function(r){e.setNode(r,n.node(r))}),h(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 Ie(n){var e=new L({multigraph:n.isMultigraph()}).setGraph(n.graph());return h(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),h(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function ae(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 ln(n){var e=m(S(Se(n)+1),function(){return[]});return h(n.nodes(),function(r){var t=n.node(r),i=t.rank;b(i)||(e[i][t.order]=r)}),e}function Pi(n){var e=U(m(n.nodes(),function(r){return n.node(r).rank}));h(n.nodes(),function(r){var t=n.node(r);p(t,"rank")&&(t.rank-=e)})}function Ti(n){var e=U(m(n.nodes(),function(a){return n.node(a).rank})),r=[];h(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;h(r,function(a,u){b(a)&&u%i!==0?--t:t&&h(a,function(o){n.node(o).rank+=t})})}function ue(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 Se(n){return A(m(n.nodes(),function(e){var r=n.node(e).rank;if(!b(r))return r}))}function Ai(n,e){var r={lhs:[],rhs:[]};return h(n,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ri(n,e){var r=Xn();try{return e()}finally{console.log(n+" time: "+(Xn()-r)+"ms")}}function Mi(n,e){return e()}function Ii(n){function e(r){var t=n.children(r),i=n.node(r);if(t.length&&h(t,e),p(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,u=i.maxRank+1;a<u;++a)oe(n,"borderLeft","_bl",r,i,a),oe(n,"borderRight","_br",r,i,a)}}h(n.children(),e)}function oe(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 Si(n){var e=n.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Fe(n)}function Fi(n){var e=n.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&ki(n),(e==="lr"||e==="rl")&&($i(n),Fe(n))}function Fe(n){h(n.nodes(),function(e){se(n.node(e))}),h(n.edges(),function(e){se(n.edge(e))})}function se(n){var e=n.width;n.width=n.height,n.height=e}function ki(n){h(n.nodes(),function(e){wn(n.node(e))}),h(n.edges(),function(e){var r=n.edge(e);h(r.points,wn),p(r,"y")&&wn(r)})}function wn(n){n.y=-n.y}function $i(n){h(n.nodes(),function(e){mn(n.node(e))}),h(n.edges(),function(e){var r=n.edge(e);h(r.points,mn),p(r,"x")&&mn(r)})}function mn(n){var e=n.x;n.x=n.y,n.y=e}function Di(n){n.graph().dummyChains=[],h(n.edges(),function(e){Gi(n,e)})}function Gi(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,l;for(l=0,++t;t<a;++l,++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),l===0&&n.graph().dummyChains.push(f),r=f;n.setEdge(r,i,{weight:o.weight},u)}}function Bi(n){h(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 Dn(n){var e={};function r(t){var i=n.node(t);if(p(e,t))return i.rank;e[t]=!0;var a=U(m(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}h(n.sources(),r)}function q(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen}function ke(n){var e=new L({directed:!1}),r=n.nodes()[0],t=n.nodeCount();e.setNode(r,{});for(var i,a;Yi(e,n)<t;)i=Ui(e,n),a=e.hasNode(i.v)?q(n,i):-q(n,i),qi(e,n,a);return e}function Yi(n,e){function r(t){h(e.nodeEdges(t),function(i){var a=i.v,u=t===a?i.w:a;!n.hasNode(u)&&!q(e,i)&&(n.setNode(u,{}),n.setEdge(t,u,{}),r(u))})}return h(n.nodes(),r),n.nodeCount()}function Ui(n,e){return kn(e.edges(),function(r){if(n.hasNode(r.v)!==n.hasNode(r.w))return q(e,r)})}function qi(n,e,r){h(n.nodes(),function(t){e.node(t).rank+=r})}function Hi(){}Hi.prototype=new Error;function $e(n,e,r){E(e)||(e=[e]);var t=(n.isDirected()?n.successors:n.neighbors).bind(n),i=[],a={};return h(e,function(u){if(!n.hasNode(u))throw new Error("Graph does not have node: "+u);De(n,u,r==="post",a,t,i)}),i}function De(n,e,r,t,i,a){p(t,e)||(t[e]=!0,r||a.push(e),h(i(e),function(u){De(n,u,r,t,i,a)}),r&&a.push(e))}function Vi(n,e){return $e(n,e,"post")}function Wi(n,e){return $e(n,e,"pre")}M.initLowLimValues=Bn;M.initCutValues=Gn;M.calcCutValue=Ge;M.leaveEdge=Ye;M.enterEdge=Ue;M.exchangeEdges=qe;function M(n){n=Ci(n),Dn(n);var e=ke(n);Bn(e),Gn(e,n);for(var r,t;r=Ye(e);)t=Ue(e,n,r),qe(e,n,r,t)}function Gn(n,e){var r=Vi(n,n.nodes());r=r.slice(0,r.length-1),h(r,function(t){Xi(n,e,t)})}function Xi(n,e,r){var t=n.node(r),i=t.parent;n.edge(r,i).cutvalue=Ge(n,e,r)}function Ge(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,h(e.nodeEdges(r),function(s){var f=s.v===r,d=f?s.w:s.v;if(d!==i){var l=f===a,c=e.edge(s).weight;if(o+=l?c:-c,Zi(n,r,d)){var g=n.edge(r,d).cutvalue;o+=l?-g:g}}}),o}function Bn(n,e){arguments.length<2&&(e=n.nodes()[0]),Be(n,{},1,e)}function Be(n,e,r,t,i){var a=r,u=n.node(t);return e[t]=!0,h(n.neighbors(t),function(o){p(e,o)||(r=Be(n,e,r,o,t))}),u.low=a,u.lim=r++,i?u.parent=i:delete u.parent,r}function Ye(n){return Sn(n.edges(),function(e){return n.edge(e).cutvalue<0})}function Ue(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=N(e.edges(),function(d){return s===fe(n,n.node(d.v),o)&&s!==fe(n,n.node(d.w),o)});return kn(f,function(d){return q(e,d)})}function qe(n,e,r,t){var i=r.v,a=r.w;n.removeEdge(i,a),n.setEdge(t.v,t.w,{}),Bn(n),Gn(n,e),Ki(n,e)}function Ki(n,e){var r=Sn(n.nodes(),function(i){return!e.node(i).parent}),t=Wi(n,r);t=t.slice(1),h(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 Zi(n,e,r){return n.hasEdge(e,r)}function fe(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function Ji(n){switch(n.graph().ranker){case"network-simplex":de(n);break;case"tight-tree":zi(n);break;case"longest-path":Qi(n);break;default:de(n)}}var Qi=Dn;function zi(n){Dn(n),ke(n)}function de(n){M(n)}function ji(n){var e=k(n,"root",{},"_root"),r=na(n),t=A(O(r))-1,i=2*t+1;n.graph().nestingRoot=e,h(n.edges(),function(u){n.edge(u).minlen*=i});var a=ea(n)+1;h(n.children(),function(u){He(n,e,i,a,t,r,u)}),n.graph().nodeRankFactor=i}function He(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=ue(n,"_bt"),f=ue(n,"_bb"),d=n.node(u);n.setParent(s,u),d.borderTop=s,n.setParent(f,u),d.borderBottom=f,h(o,function(l){He(n,e,r,t,i,a,l);var c=n.node(l),g=c.borderTop?c.borderTop:l,v=c.borderBottom?c.borderBottom:l,w=c.borderTop?t:2*t,_=g!==v?1:i-a[u]+1;n.setEdge(s,g,{weight:w,minlen:_,nestingEdge:!0}),n.setEdge(v,f,{weight:w,minlen:_,nestingEdge:!0})}),n.parent(u)||n.setEdge(e,s,{weight:0,minlen:i+a[u]})}function na(n){var e={};function r(t,i){var a=n.children(t);a&&a.length&&h(a,function(u){r(u,i+1)}),e[t]=i}return h(n.children(),function(t){r(t,1)}),e}function ea(n){return V(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function ra(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,h(n.edges(),function(r){var t=n.edge(r);t.nestingEdge&&n.removeEdge(r)})}function ta(n,e,r){var t={},i;h(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 ia(n,e,r){var t=aa(n),i=new L({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(a){return n.node(a)});return h(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),h(n[r](a),function(s){var f=s.v===a?s.w:s.v,d=i.edge(f,a),l=b(d)?0:d.weight;i.setEdge(f,a,{weight:n.edge(s).weight+l})}),p(u,"minRank")&&i.setNode(a,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]}))}),i}function aa(n){for(var e;n.hasNode(e=$n("_root")););return e}function ua(n,e){for(var r=0,t=1;t<e.length;++t)r+=oa(n,e[t-1],e[t]);return r}function oa(n,e,r){for(var t=gi(r,m(r,function(f,d){return d})),i=F(m(e,function(f){return W(m(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=m(new Array(u),function(){return 0}),s=0;return h(i.forEach(function(f){var d=f.pos+a;o[d]+=f.weight;for(var l=0;d>0;)d%2&&(l+=o[d+1]),d=d-1>>1,o[d]+=f.weight;s+=f.weight*l})),s}function sa(n){var e={},r=N(n.nodes(),function(o){return!n.children(o).length}),t=A(m(r,function(o){return n.node(o).rank})),i=m(S(t+1),function(){return[]});function a(o){if(!p(e,o)){e[o]=!0;var s=n.node(o);i[s.rank].push(o),h(n.successors(o),a)}}var u=W(r,function(o){return n.node(o).rank});return h(u,a),i}function fa(n,e){return m(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 da(n,e){var r={};h(n,function(i,a){var u=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:a};b(i.barycenter)||(u.barycenter=i.barycenter,u.weight=i.weight)}),h(e.edges(),function(i){var a=r[i.v],u=r[i.w];!b(a)&&!b(u)&&(u.indegree++,a.out.push(r[i.w]))});var t=N(r,function(i){return!i.indegree});return ha(t)}function ha(n){var e=[];function r(a){return function(u){u.merged||(b(u.barycenter)||b(a.barycenter)||u.barycenter>=a.barycenter)&&la(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),h(i.in.reverse(),r(i)),h(i.out,t(i))}return m(N(e,function(a){return!a.merged}),function(a){return en(a,["vs","i","barycenter","weight"])})}function la(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 ca(n,e){var r=Ai(n,function(d){return p(d,"barycenter")}),t=r.lhs,i=W(r.rhs,function(d){return-d.i}),a=[],u=0,o=0,s=0;t.sort(va(!!e)),s=he(a,i,s),h(t,function(d){s+=d.vs.length,a.push(d.vs),u+=d.barycenter*d.weight,o+=d.weight,s=he(a,i,s)});var f={vs:F(a)};return o&&(f.barycenter=u/o,f.weight=o),f}function he(n,e,r){for(var t;e.length&&(t=nn(e)).i<=r;)e.pop(),n.push(t.vs),r++;return r}function va(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 Ve(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=N(i,function(v){return v!==u&&v!==o}));var f=fa(n,i);h(f,function(v){if(n.children(v.v).length){var w=Ve(n,v.v,r,t);s[v.v]=w,p(w,"barycenter")&&pa(v,w)}});var d=da(f,r);ga(d,s);var l=ca(d,t);if(u&&(l.vs=F([u,l.vs,o]),n.predecessors(u).length)){var c=n.node(n.predecessors(u)[0]),g=n.node(n.predecessors(o)[0]);p(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+c.order+g.order)/(l.weight+2),l.weight+=2}return l}function ga(n,e){h(n,function(r){r.vs=F(r.vs.map(function(t){return e[t]?e[t].vs:t}))})}function pa(n,e){b(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 wa(n){var e=Se(n),r=le(n,S(1,e+1),"inEdges"),t=le(n,S(e-1,-1,-1),"outEdges"),i=sa(n);ce(n,i);for(var a=Number.POSITIVE_INFINITY,u,o=0,s=0;s<4;++o,++s){ma(o%2?r:t,o%4>=2),i=ln(n);var f=ua(n,i);f<a&&(s=0,u=ir(i),a=f)}ce(n,u)}function le(n,e,r){return m(e,function(t){return ia(n,t,r)})}function ma(n,e){var r=new L;h(n,function(t){var i=t.graph().root,a=Ve(t,i,r,e);h(a.vs,function(u,o){t.node(u).order=o}),ta(t,r,a.vs)})}function ce(n,e){h(e,function(r){h(r,function(t,i){n.node(t).order=i})})}function ba(n){var e=Ea(n);h(n.graph().dummyChains,function(r){for(var t=n.node(r),i=t.edgeObj,a=_a(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 _a(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 Ea(n){var e={},r=0;function t(i){var a=r;h(n.children(i),t),e[i]={low:a,lim:r++}}return h(n.children(),t),e}function xa(n,e){var r={};function t(i,a){var u=0,o=0,s=i.length,f=nn(a);return h(a,function(d,l){var c=La(n,d),g=c?n.node(c).order:s;(c||d===f)&&(h(a.slice(o,l+1),function(v){h(n.predecessors(v),function(w){var _=n.node(w),x=_.order;(x<u||g<x)&&!(_.dummy&&n.node(v).dummy)&&We(r,w,v)})}),o=l+1,u=g)}),a}return V(e,t),r}function ya(n,e){var r={};function t(a,u,o,s,f){var d;h(S(u,o),function(l){d=a[l],n.node(d).dummy&&h(n.predecessors(d),function(c){var g=n.node(c);g.dummy&&(g.order<s||g.order>f)&&We(r,c,d)})})}function i(a,u){var o=-1,s,f=0;return h(u,function(d,l){if(n.node(d).dummy==="border"){var c=n.predecessors(d);c.length&&(s=n.node(c[0]).order,t(u,f,l,o,s),f=l,o=s)}t(u,f,u.length,s,a.length)}),u}return V(e,i),r}function La(n,e){if(n.node(e).dummy)return Sn(n.predecessors(e),function(r){return n.node(r).dummy})}function We(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 Na(n,e,r){if(e>r){var t=e;e=r,r=t}return p(n[e],r)}function Oa(n,e,r,t){var i={},a={},u={};return h(e,function(o){h(o,function(s,f){i[s]=s,a[s]=s,u[s]=f})}),h(e,function(o){var s=-1;h(o,function(f){var d=t(f);if(d.length){d=W(d,function(w){return u[w]});for(var l=(d.length-1)/2,c=Math.floor(l),g=Math.ceil(l);c<=g;++c){var v=d[c];a[f]===f&&s<u[v]&&!Na(r,f,v)&&(a[v]=f,a[f]=i[f]=i[v],s=u[v])}}})}),{root:i,align:a}}function Ca(n,e,r,t,i){var a={},u=Pa(n,e,r,i),o=i?"borderLeft":"borderRight";function s(l,c){for(var g=u.nodes(),v=g.pop(),w={};v;)w[v]?l(v):(w[v]=!0,g.push(v),g=g.concat(c(v))),v=g.pop()}function f(l){a[l]=u.inEdges(l).reduce(function(c,g){return Math.max(c,a[g.v]+u.edge(g))},0)}function d(l){var c=u.outEdges(l).reduce(function(v,w){return Math.min(v,a[w.w]-u.edge(w))},Number.POSITIVE_INFINITY),g=n.node(l);c!==Number.POSITIVE_INFINITY&&g.borderType!==o&&(a[l]=Math.max(a[l],c))}return s(f,u.predecessors.bind(u)),s(d,u.successors.bind(u)),h(t,function(l){a[l]=a[r[l]]}),a}function Pa(n,e,r,t){var i=new L,a=n.graph(),u=Ia(a.nodesep,a.edgesep,t);return h(e,function(o){var s;h(o,function(f){var d=r[f];if(i.setNode(d),s){var l=r[s],c=i.edge(l,d);i.setEdge(l,d,Math.max(u(n,f,s),c||0))}s=f})}),i}function Ta(n,e){return kn(O(e),function(r){var t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Dt(r,function(a,u){var o=Sa(n,u)/2;t=Math.max(a+o,t),i=Math.min(a-o,i)}),t-i})}function Aa(n,e){var r=O(e),t=U(r),i=A(r);h(["u","d"],function(a){h(["l","r"],function(u){var o=a+u,s=n[o],f;if(s!==e){var d=O(s);f=u==="l"?t-U(d):i-A(d),f&&(n[o]=hn(s,function(l){return l+f}))}})})}function Ra(n,e){return hn(n.ul,function(r,t){if(e)return n[e.toLowerCase()][t];var i=W(m(n,t));return(i[1]+i[2])/2})}function Ma(n){var e=ln(n),r=On(xa(n,e),ya(n,e)),t={},i;h(["u","d"],function(u){i=u==="u"?e:O(e).reverse(),h(["l","r"],function(o){o==="r"&&(i=m(i,function(l){return O(l).reverse()}));var s=(u==="u"?n.predecessors:n.successors).bind(n),f=Oa(n,i,r,s),d=Ca(n,i,f.root,f.align,o==="r");o==="r"&&(d=hn(d,function(l){return-l})),t[u+o]=d})});var a=Ta(n,t);return Aa(t,a),Ra(t,n.graph().align)}function Ia(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,p(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,p(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 Sa(n,e){return n.node(e).width}function Fa(n){n=Ie(n),ka(n),Gt(Ma(n),function(e,r){n.node(r).x=e})}function ka(n){var e=ln(n),r=n.graph().ranksep,t=0;h(e,function(i){var a=A(m(i,function(u){return n.node(u).height}));h(i,function(u){n.node(u).y=t+a/2}),t+=a+r})}function vu(n,e){var r=e&&e.debugTiming?Ri:Mi;r("layout",function(){var t=r(" buildLayoutGraph",function(){return Xa(n)});r(" runLayout",function(){$a(t,r)}),r(" updateInputGraph",function(){Da(n,t)})})}function $a(n,e){e(" makeSpaceForEdgeLabels",function(){Ka(n)}),e(" removeSelfEdges",function(){tu(n)}),e(" acyclic",function(){Li(n)}),e(" nestingGraph.run",function(){ji(n)}),e(" rank",function(){Ji(Ie(n))}),e(" injectEdgeLabelProxies",function(){Za(n)}),e(" removeEmptyRanks",function(){Ti(n)}),e(" nestingGraph.cleanup",function(){ra(n)}),e(" normalizeRanks",function(){Pi(n)}),e(" assignRankMinMax",function(){Ja(n)}),e(" removeEdgeLabelProxies",function(){Qa(n)}),e(" normalize.run",function(){Di(n)}),e(" parentDummyChains",function(){ba(n)}),e(" addBorderSegments",function(){Ii(n)}),e(" order",function(){wa(n)}),e(" insertSelfEdges",function(){iu(n)}),e(" adjustCoordinateSystem",function(){Si(n)}),e(" position",function(){Fa(n)}),e(" positionSelfEdges",function(){au(n)}),e(" removeBorderNodes",function(){ru(n)}),e(" normalize.undo",function(){Bi(n)}),e(" fixupEdgeLabelCoords",function(){nu(n)}),e(" undoCoordinateSystem",function(){Fi(n)}),e(" translateGraph",function(){za(n)}),e(" assignNodeIntersects",function(){ja(n)}),e(" reversePoints",function(){eu(n)}),e(" acyclic.undo",function(){Oi(n)})}function Da(n,e){h(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))}),h(n.edges(),function(r){var t=n.edge(r),i=e.edge(r);t.points=i.points,p(i,"x")&&(t.x=i.x,t.y=i.y)}),n.graph().width=e.graph().width,n.graph().height=e.graph().height}var Ga=["nodesep","edgesep","ranksep","marginx","marginy"],Ba={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Ya=["acyclicer","ranker","rankdir","align"],Ua=["width","height"],qa={width:0,height:0},Ha=["minlen","weight","width","height","labeloffset"],Va={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Wa=["labelpos"];function Xa(n){var e=new L({multigraph:!0,compound:!0}),r=_n(n.graph());return e.setGraph(On({},Ba,bn(r,Ga),en(r,Ya))),h(n.nodes(),function(t){var i=_n(n.node(t));e.setNode(t,Tt(bn(i,Ua),qa)),e.setParent(t,n.parent(t))}),h(n.edges(),function(t){var i=_n(n.edge(t));e.setEdge(t,On({},Va,bn(i,Ha),en(i,Wa)))}),e}function Ka(n){var e=n.graph();e.ranksep/=2,h(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 Za(n){h(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 Ja(n){var e=0;h(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=A(e,t.maxRank))}),n.graph().maxRank=e}function Qa(n){h(n.nodes(),function(e){var r=n.node(e);r.dummy==="edge-proxy"&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}function za(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,l=f.y,c=f.width,g=f.height;e=Math.min(e,d-c/2),r=Math.max(r,d+c/2),t=Math.min(t,l-g/2),i=Math.max(i,l+g/2)}h(n.nodes(),function(f){s(n.node(f))}),h(n.edges(),function(f){var d=n.edge(f);p(d,"x")&&s(d)}),e-=u,t-=o,h(n.nodes(),function(f){var d=n.node(f);d.x-=e,d.y-=t}),h(n.edges(),function(f){var d=n.edge(f);h(d.points,function(l){l.x-=e,l.y-=t}),p(d,"x")&&(d.x-=e),p(d,"y")&&(d.y-=t)}),a.width=r-e+u,a.height=i-t+o}function ja(n){h(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(ae(t,a)),r.points.push(ae(i,u))})}function nu(n){h(n.edges(),function(e){var r=n.edge(e);if(p(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 eu(n){h(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}function ru(n){h(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(nn(r.borderLeft)),u=n.node(nn(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}}),h(n.nodes(),function(e){n.node(e).dummy==="border"&&n.removeNode(e)})}function tu(n){h(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 iu(n){var e=ln(n);h(e,function(r){var t=0;h(r,function(i,a){var u=n.node(i);u.order=a+t,h(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 au(n){h(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 bn(n,e){return hn(en(n,e),Number)}function _n(n){var e={};return h(n,function(r,t){e[t.toLowerCase()]=r}),e}export{L as G,kr as a,Tt as d,h as f,p as h,b as i,vu as l,m,en as p,S as r,$n as u};
|
||
//# sourceMappingURL=layout-73a30383.js.map
|