UNPKG

dagre-compound

Version:

A multi-level compound graph layout library based on dagre

1 lines 86.4 kB
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).dagreCompound={})}(this,(function(e){"use strict";const n={graph:{meta:{rankDir:"TB",nodeSep:50,rankSep:50,edgeSep:5,align:void 0}},subScene:{meta:{paddingTop:20,paddingBottom:20,paddingLeft:20,paddingRight:20,labelHeight:20}},nodeSize:{meta:{width:100,maxLabelWidth:0,height:20},node:{width:80,height:20,labelOffset:10,maxLabelWidth:40},bridge:{width:5,height:5,radius:2,labelOffset:0}}};function t(e={},t=n){var r,o,i,a;const u=JSON.parse(JSON.stringify(t)),c=(null===(r=null==e?void 0:e.graph)||void 0===r?void 0:r.meta)||{},s=(null===(o=null==e?void 0:e.subScene)||void 0===o?void 0:o.meta)||{},d=(null===(i=null==e?void 0:e.nodeSize)||void 0===i?void 0:i.meta)||{},f=(null===(a=null==e?void 0:e.nodeSize)||void 0===a?void 0:a.node)||{},h=u.nodeSize.bridge;return{graph:{meta:Object.assign(u.graph.meta,c)},subScene:{meta:Object.assign(u.subScene.meta,s)},nodeSize:{meta:Object.assign(u.nodeSize.meta,d),node:Object.assign(u.nodeSize.node,f),bridge:h}}}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e,n){return e(n={exports:{}},n.exports),n.exports}var i=function(){this.__data__=[],this.size=0};var a=function(e,n){return e===n||e!=e&&n!=n};var u=function(e,n){for(var t=e.length;t--;)if(a(e[t][0],n))return t;return-1},c=Array.prototype.splice;var s=function(e){var n=this.__data__,t=u(n,e);return!(t<0)&&(t==n.length-1?n.pop():c.call(n,t,1),--this.size,!0)};var d=function(e){var n=this.__data__,t=u(n,e);return t<0?void 0:n[t][1]};var f=function(e){return u(this.__data__,e)>-1};var h=function(e,n){var t=this.__data__,r=u(t,e);return r<0?(++this.size,t.push([e,n])):t[r][1]=n,this};function l(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}l.prototype.clear=i,l.prototype.delete=s,l.prototype.get=d,l.prototype.has=f,l.prototype.set=h;var p=l;var v=function(){this.__data__=new p,this.size=0};var g=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t};var y=function(e){return this.__data__.get(e)};var b=function(e){return this.__data__.has(e)},m="object"==typeof r&&r&&r.Object===Object&&r,w="object"==typeof self&&self&&self.Object===Object&&self,E=m||w||Function("return this")(),_=E.Symbol,j=Object.prototype,x=j.hasOwnProperty,N=j.toString,O=_?_.toStringTag:void 0;var k=function(e){var n=x.call(e,O),t=e[O];try{e[O]=void 0;var r=!0}catch(e){}var o=N.call(e);return r&&(n?e[O]=t:delete e[O]),o},I=Object.prototype.toString;var S=function(e){return I.call(e)},T=_?_.toStringTag:void 0;var G=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":T&&T in Object(e)?k(e):S(e)};var M=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)};var C,A=function(e){if(!M(e))return!1;var n=G(e);return"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n},B=E["__core-js_shared__"],L=(C=/[^.]+$/.exec(B&&B.keys&&B.keys.IE_PROTO||""))?"Symbol(src)_1."+C:"";var R=function(e){return!!L&&L in e},D=Function.prototype.toString;var P=function(e){if(null!=e){try{return D.call(e)}catch(e){}try{return e+""}catch(e){}}return""},z=/^\[object .+?Constructor\]$/,F=Function.prototype,U=Object.prototype,V=F.toString,$=U.hasOwnProperty,H=RegExp("^"+V.call($).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var W=function(e){return!(!M(e)||R(e))&&(A(e)?H:z).test(P(e))};var q=function(e,n){return null==e?void 0:e[n]};var Y=function(e,n){var t=q(e,n);return W(t)?t:void 0},J=Y(E,"Map"),X=Y(Object,"create");var K=function(){this.__data__=X?X(null):{},this.size=0};var Q=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n},Z=Object.prototype.hasOwnProperty;var ee=function(e){var n=this.__data__;if(X){var t=n[e];return"__lodash_hash_undefined__"===t?void 0:t}return Z.call(n,e)?n[e]:void 0},ne=Object.prototype.hasOwnProperty;var te=function(e){var n=this.__data__;return X?void 0!==n[e]:ne.call(n,e)};var re=function(e,n){var t=this.__data__;return this.size+=this.has(e)?0:1,t[e]=X&&void 0===n?"__lodash_hash_undefined__":n,this};function oe(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}oe.prototype.clear=K,oe.prototype.delete=Q,oe.prototype.get=ee,oe.prototype.has=te,oe.prototype.set=re;var ie=oe;var ae=function(){this.size=0,this.__data__={hash:new ie,map:new(J||p),string:new ie}};var ue=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e};var ce=function(e,n){var t=e.__data__;return ue(n)?t["string"==typeof n?"string":"hash"]:t.map};var se=function(e){var n=ce(this,e).delete(e);return this.size-=n?1:0,n};var de=function(e){return ce(this,e).get(e)};var fe=function(e){return ce(this,e).has(e)};var he=function(e,n){var t=ce(this,e),r=t.size;return t.set(e,n),this.size+=t.size==r?0:1,this};function le(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}le.prototype.clear=ae,le.prototype.delete=se,le.prototype.get=de,le.prototype.has=fe,le.prototype.set=he;var pe=le;var ve=function(e,n){var t=this.__data__;if(t instanceof p){var r=t.__data__;if(!J||r.length<199)return r.push([e,n]),this.size=++t.size,this;t=this.__data__=new pe(r)}return t.set(e,n),this.size=t.size,this};function ge(e){var n=this.__data__=new p(e);this.size=n.size}ge.prototype.clear=v,ge.prototype.delete=g,ge.prototype.get=y,ge.prototype.has=b,ge.prototype.set=ve;var ye=ge;var be=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e},me=function(){try{var e=Y(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();var we=function(e,n,t){"__proto__"==n&&me?me(e,n,{configurable:!0,enumerable:!0,value:t,writable:!0}):e[n]=t},Ee=Object.prototype.hasOwnProperty;var _e=function(e,n,t){var r=e[n];Ee.call(e,n)&&a(r,t)&&(void 0!==t||n in e)||we(e,n,t)};var je=function(e,n,t,r){var o=!t;t||(t={});for(var i=-1,a=n.length;++i<a;){var u=n[i],c=r?r(t[u],e[u],u,t,e):void 0;void 0===c&&(c=e[u]),o?we(t,u,c):_e(t,u,c)}return t};var xe=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r};var Ne=function(e){return null!=e&&"object"==typeof e};var Oe=function(e){return Ne(e)&&"[object Arguments]"==G(e)},ke=Object.prototype,Ie=ke.hasOwnProperty,Se=ke.propertyIsEnumerable,Te=Oe(function(){return arguments}())?Oe:function(e){return Ne(e)&&Ie.call(e,"callee")&&!Se.call(e,"callee")},Ge=Te,Me=Array.isArray;var Ce=function(){return!1},Ae=o((function(e,n){var t=n&&!n.nodeType&&n,r=t&&e&&!e.nodeType&&e,o=r&&r.exports===t?E.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ce;e.exports=i})),Be=/^(?:0|[1-9]\d*)$/;var Le=function(e,n){var t=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==t||"symbol"!=t&&Be.test(e))&&e>-1&&e%1==0&&e<n};var Re=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},De={};De["[object Float32Array]"]=De["[object Float64Array]"]=De["[object Int8Array]"]=De["[object Int16Array]"]=De["[object Int32Array]"]=De["[object Uint8Array]"]=De["[object Uint8ClampedArray]"]=De["[object Uint16Array]"]=De["[object Uint32Array]"]=!0,De["[object Arguments]"]=De["[object Array]"]=De["[object ArrayBuffer]"]=De["[object Boolean]"]=De["[object DataView]"]=De["[object Date]"]=De["[object Error]"]=De["[object Function]"]=De["[object Map]"]=De["[object Number]"]=De["[object Object]"]=De["[object RegExp]"]=De["[object Set]"]=De["[object String]"]=De["[object WeakMap]"]=!1;var Pe=function(e){return Ne(e)&&Re(e.length)&&!!De[G(e)]};var ze=function(e){return function(n){return e(n)}},Fe=o((function(e,n){var t=n&&!n.nodeType&&n,r=t&&e&&!e.nodeType&&e,o=r&&r.exports===t&&m.process,i=function(){try{var e=r&&r.require&&r.require("util").types;return e||o&&o.binding&&o.binding("util")}catch(e){}}();e.exports=i})),Ue=Fe&&Fe.isTypedArray,Ve=Ue?ze(Ue):Pe,$e=Object.prototype.hasOwnProperty;var He=function(e,n){var t=Me(e),r=!t&&Ge(e),o=!t&&!r&&Ae(e),i=!t&&!r&&!o&&Ve(e),a=t||r||o||i,u=a?xe(e.length,String):[],c=u.length;for(var s in e)!n&&!$e.call(e,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Le(s,c))||u.push(s);return u},We=Object.prototype;var qe=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||We)};var Ye=function(e,n){return function(t){return e(n(t))}},Je=Ye(Object.keys,Object),Xe=Object.prototype.hasOwnProperty;var Ke=function(e){if(!qe(e))return Je(e);var n=[];for(var t in Object(e))Xe.call(e,t)&&"constructor"!=t&&n.push(t);return n};var Qe=function(e){return null!=e&&Re(e.length)&&!A(e)};var Ze=function(e){return Qe(e)?He(e):Ke(e)};var en=function(e,n){return e&&je(n,Ze(n),e)};var nn=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n},tn=Object.prototype.hasOwnProperty;var rn=function(e){if(!M(e))return nn(e);var n=qe(e),t=[];for(var r in e)("constructor"!=r||!n&&tn.call(e,r))&&t.push(r);return t};var on=function(e){return Qe(e)?He(e,!0):rn(e)};var an=function(e,n){return e&&je(n,on(n),e)},un=o((function(e,n){var t=n&&!n.nodeType&&n,r=t&&e&&!e.nodeType&&e,o=r&&r.exports===t?E.Buffer:void 0,i=o?o.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=i?i(t):new e.constructor(t);return e.copy(r),r}}));var cn=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n};var sn=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i};var dn=function(){return[]},fn=Object.prototype.propertyIsEnumerable,hn=Object.getOwnPropertySymbols,ln=hn?function(e){return null==e?[]:(e=Object(e),sn(hn(e),(function(n){return fn.call(e,n)})))}:dn;var pn=function(e,n){return je(e,ln(e),n)};var vn=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e},gn=Ye(Object.getPrototypeOf,Object),yn=Object.getOwnPropertySymbols?function(e){for(var n=[];e;)vn(n,ln(e)),e=gn(e);return n}:dn;var bn=function(e,n){return je(e,yn(e),n)};var mn=function(e,n,t){var r=n(e);return Me(e)?r:vn(r,t(e))};var wn=function(e){return mn(e,Ze,ln)};var En=function(e){return mn(e,on,yn)},_n=Y(E,"DataView"),jn=Y(E,"Promise"),xn=Y(E,"Set"),Nn=Y(E,"WeakMap"),On="[object Map]",kn="[object Promise]",In="[object Set]",Sn="[object WeakMap]",Tn="[object DataView]",Gn=P(_n),Mn=P(J),Cn=P(jn),An=P(xn),Bn=P(Nn),Ln=G;(_n&&Ln(new _n(new ArrayBuffer(1)))!=Tn||J&&Ln(new J)!=On||jn&&Ln(jn.resolve())!=kn||xn&&Ln(new xn)!=In||Nn&&Ln(new Nn)!=Sn)&&(Ln=function(e){var n=G(e),t="[object Object]"==n?e.constructor:void 0,r=t?P(t):"";if(r)switch(r){case Gn:return Tn;case Mn:return On;case Cn:return kn;case An:return In;case Bn:return Sn}return n});var Rn=Ln,Dn=Object.prototype.hasOwnProperty;var Pn=function(e){var n=e.length,t=new e.constructor(n);return n&&"string"==typeof e[0]&&Dn.call(e,"index")&&(t.index=e.index,t.input=e.input),t},zn=E.Uint8Array;var Fn=function(e){var n=new e.constructor(e.byteLength);return new zn(n).set(new zn(e)),n};var Un=function(e,n){var t=n?Fn(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.byteLength)},Vn=/\w*$/;var $n=function(e){var n=new e.constructor(e.source,Vn.exec(e));return n.lastIndex=e.lastIndex,n},Hn=_?_.prototype:void 0,Wn=Hn?Hn.valueOf:void 0;var qn=function(e){return Wn?Object(Wn.call(e)):{}};var Yn=function(e,n){var t=n?Fn(e.buffer):e.buffer;return new e.constructor(t,e.byteOffset,e.length)};var Jn=function(e,n,t){var r=e.constructor;switch(n){case"[object ArrayBuffer]":return Fn(e);case"[object Boolean]":case"[object Date]":return new r(+e);case"[object DataView]":return Un(e,t);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return Yn(e,t);case"[object Map]":case"[object Set]":return new r;case"[object Number]":case"[object String]":return new r(e);case"[object RegExp]":return $n(e);case"[object Symbol]":return qn(e)}},Xn=Object.create,Kn=function(){function e(){}return function(n){if(!M(n))return{};if(Xn)return Xn(n);e.prototype=n;var t=new e;return e.prototype=void 0,t}}();var Qn=function(e){return"function"!=typeof e.constructor||qe(e)?{}:Kn(gn(e))};var Zn=function(e){return Ne(e)&&"[object Map]"==Rn(e)},et=Fe&&Fe.isMap,nt=et?ze(et):Zn;var tt=function(e){return Ne(e)&&"[object Set]"==Rn(e)},rt=Fe&&Fe.isSet,ot=rt?ze(rt):tt,it="[object Arguments]",at="[object Function]",ut="[object Object]",ct={};ct[it]=ct["[object Array]"]=ct["[object ArrayBuffer]"]=ct["[object DataView]"]=ct["[object Boolean]"]=ct["[object Date]"]=ct["[object Float32Array]"]=ct["[object Float64Array]"]=ct["[object Int8Array]"]=ct["[object Int16Array]"]=ct["[object Int32Array]"]=ct["[object Map]"]=ct["[object Number]"]=ct[ut]=ct["[object RegExp]"]=ct["[object Set]"]=ct["[object String]"]=ct["[object Symbol]"]=ct["[object Uint8Array]"]=ct["[object Uint8ClampedArray]"]=ct["[object Uint16Array]"]=ct["[object Uint32Array]"]=!0,ct["[object Error]"]=ct[at]=ct["[object WeakMap]"]=!1;var st=function e(n,t,r,o,i,a){var u,c=1&t,s=2&t,d=4&t;if(r&&(u=i?r(n,o,i,a):r(n)),void 0!==u)return u;if(!M(n))return n;var f=Me(n);if(f){if(u=Pn(n),!c)return cn(n,u)}else{var h=Rn(n),l=h==at||"[object GeneratorFunction]"==h;if(Ae(n))return un(n,c);if(h==ut||h==it||l&&!i){if(u=s||l?{}:Qn(n),!c)return s?bn(n,an(u,n)):pn(n,en(u,n))}else{if(!ct[h])return i?n:{};u=Jn(n,h,c)}}a||(a=new ye);var p=a.get(n);if(p)return p;a.set(n,u),ot(n)?n.forEach((function(o){u.add(e(o,t,r,o,n,a))})):nt(n)&&n.forEach((function(o,i){u.set(i,e(o,t,r,i,n,a))}));var v=f?void 0:(d?s?En:wn:s?on:Ze)(n);return be(v||n,(function(o,i){v&&(o=n[i=o]),_e(u,i,e(o,t,r,i,n,a))})),u};var dt=function(e){return st(e,4)};var ft=function(e){return function(){return e}};var ht=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}();var lt=function(e,n){return e&&ht(e,n,Ze)};var pt=function(e,n){return function(t,r){if(null==t)return t;if(!Qe(t))return e(t,r);for(var o=t.length,i=n?o:-1,a=Object(t);(n?i--:++i<o)&&!1!==r(a[i],i,a););return t}}(lt);var vt=function(e){return e};var gt=function(e){return"function"==typeof e?e:vt};var yt=function(e,n){return(Me(e)?be:pt)(e,gt(n))},bt=yt;var mt=function(e,n){var t=[];return pt(e,(function(e,r,o){n(e,r,o)&&t.push(e)})),t};var wt=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this};var Et=function(e){return this.__data__.has(e)};function _t(e){var n=-1,t=null==e?0:e.length;for(this.__data__=new pe;++n<t;)this.add(e[n])}_t.prototype.add=_t.prototype.push=wt,_t.prototype.has=Et;var jt=_t;var xt=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1};var Nt=function(e,n){return e.has(n)};var Ot=function(e,n,t,r,o,i){var a=1&t,u=e.length,c=n.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(e),d=i.get(n);if(s&&d)return s==n&&d==e;var f=-1,h=!0,l=2&t?new jt:void 0;for(i.set(e,n),i.set(n,e);++f<u;){var p=e[f],v=n[f];if(r)var g=a?r(v,p,f,n,e,i):r(p,v,f,e,n,i);if(void 0!==g){if(g)continue;h=!1;break}if(l){if(!xt(n,(function(e,n){if(!Nt(l,n)&&(p===e||o(p,e,t,r,i)))return l.push(n)}))){h=!1;break}}else if(p!==v&&!o(p,v,t,r,i)){h=!1;break}}return i.delete(e),i.delete(n),h};var kt=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t};var It=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t},St=_?_.prototype:void 0,Tt=St?St.valueOf:void 0;var Gt=function(e,n,t,r,o,i,u){switch(t){case"[object DataView]":if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=n.byteLength||!i(new zn(e),new zn(n)));case"[object Boolean]":case"[object Date]":case"[object Number]":return a(+e,+n);case"[object Error]":return e.name==n.name&&e.message==n.message;case"[object RegExp]":case"[object String]":return e==n+"";case"[object Map]":var c=kt;case"[object Set]":var s=1&r;if(c||(c=It),e.size!=n.size&&!s)return!1;var d=u.get(e);if(d)return d==n;r|=2,u.set(e,n);var f=Ot(c(e),c(n),r,o,i,u);return u.delete(e),f;case"[object Symbol]":if(Tt)return Tt.call(e)==Tt.call(n)}return!1},Mt=Object.prototype.hasOwnProperty;var Ct=function(e,n,t,r,o,i){var a=1&t,u=wn(e),c=u.length;if(c!=wn(n).length&&!a)return!1;for(var s=c;s--;){var d=u[s];if(!(a?d in n:Mt.call(n,d)))return!1}var f=i.get(e),h=i.get(n);if(f&&h)return f==n&&h==e;var l=!0;i.set(e,n),i.set(n,e);for(var p=a;++s<c;){var v=e[d=u[s]],g=n[d];if(r)var y=a?r(g,v,d,n,e,i):r(v,g,d,e,n,i);if(!(void 0===y?v===g||o(v,g,t,r,i):y)){l=!1;break}p||(p="constructor"==d)}if(l&&!p){var b=e.constructor,m=n.constructor;b==m||!("constructor"in e)||!("constructor"in n)||"function"==typeof b&&b instanceof b&&"function"==typeof m&&m instanceof m||(l=!1)}return i.delete(e),i.delete(n),l},At="[object Arguments]",Bt="[object Array]",Lt="[object Object]",Rt=Object.prototype.hasOwnProperty;var Dt=function(e,n,t,r,o,i){var a=Me(e),u=Me(n),c=a?Bt:Rn(e),s=u?Bt:Rn(n),d=(c=c==At?Lt:c)==Lt,f=(s=s==At?Lt:s)==Lt,h=c==s;if(h&&Ae(e)){if(!Ae(n))return!1;a=!0,d=!1}if(h&&!d)return i||(i=new ye),a||Ve(e)?Ot(e,n,t,r,o,i):Gt(e,n,c,t,r,o,i);if(!(1&t)){var l=d&&Rt.call(e,"__wrapped__"),p=f&&Rt.call(n,"__wrapped__");if(l||p){var v=l?e.value():e,g=p?n.value():n;return i||(i=new ye),o(v,g,t,r,i)}}return!!h&&(i||(i=new ye),Ct(e,n,t,r,o,i))};var Pt=function e(n,t,r,o,i){return n===t||(null==n||null==t||!Ne(n)&&!Ne(t)?n!=n&&t!=t:Dt(n,t,r,o,e,i))};var zt=function(e,n,t,r){var o=t.length,i=o,a=!r;if(null==e)return!i;for(e=Object(e);o--;){var u=t[o];if(a&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<i;){var c=(u=t[o])[0],s=e[c],d=u[1];if(a&&u[2]){if(void 0===s&&!(c in e))return!1}else{var f=new ye;if(r)var h=r(s,d,c,e,n,f);if(!(void 0===h?Pt(d,s,3,r,f):h))return!1}}return!0};var Ft=function(e){return e==e&&!M(e)};var Ut=function(e){for(var n=Ze(e),t=n.length;t--;){var r=n[t],o=e[r];n[t]=[r,o,Ft(o)]}return n};var Vt=function(e,n){return function(t){return null!=t&&(t[e]===n&&(void 0!==n||e in Object(t)))}};var $t=function(e){var n=Ut(e);return 1==n.length&&n[0][2]?Vt(n[0][0],n[0][1]):function(t){return t===e||zt(t,e,n)}};var Ht=function(e){return"symbol"==typeof e||Ne(e)&&"[object Symbol]"==G(e)},Wt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,qt=/^\w*$/;var Yt=function(e,n){if(Me(e))return!1;var t=typeof e;return!("number"!=t&&"symbol"!=t&&"boolean"!=t&&null!=e&&!Ht(e))||(qt.test(e)||!Wt.test(e)||null!=n&&e in Object(n))};function Jt(e,n){if("function"!=typeof e||null!=n&&"function"!=typeof n)throw new TypeError("Expected a function");var t=function(){var r=arguments,o=n?n.apply(this,r):r[0],i=t.cache;if(i.has(o))return i.get(o);var a=e.apply(this,r);return t.cache=i.set(o,a)||i,a};return t.cache=new(Jt.Cache||pe),t}Jt.Cache=pe;var Xt=Jt;var Kt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/\\(\\)?/g,Zt=function(e){var n=Xt(e,(function(e){return 500===t.size&&t.clear(),e})),t=n.cache;return n}((function(e){var n=[];return 46===e.charCodeAt(0)&&n.push(""),e.replace(Kt,(function(e,t,r,o){n.push(r?o.replace(Qt,"$1"):t||e)})),n}));var er=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o},nr=_?_.prototype:void 0,tr=nr?nr.toString:void 0;var rr=function e(n){if("string"==typeof n)return n;if(Me(n))return er(n,e)+"";if(Ht(n))return tr?tr.call(n):"";var t=n+"";return"0"==t&&1/n==-Infinity?"-0":t};var or=function(e){return null==e?"":rr(e)};var ir=function(e,n){return Me(e)?e:Yt(e,n)?[e]:Zt(or(e))};var ar=function(e){if("string"==typeof e||Ht(e))return e;var n=e+"";return"0"==n&&1/e==-Infinity?"-0":n};var ur=function(e,n){for(var t=0,r=(n=ir(n,e)).length;null!=e&&t<r;)e=e[ar(n[t++])];return t&&t==r?e:void 0};var cr=function(e,n,t){var r=null==e?void 0:ur(e,n);return void 0===r?t:r};var sr=function(e,n){return null!=e&&n in Object(e)};var dr=function(e,n,t){for(var r=-1,o=(n=ir(n,e)).length,i=!1;++r<o;){var a=ar(n[r]);if(!(i=null!=e&&t(e,a)))break;e=e[a]}return i||++r!=o?i:!!(o=null==e?0:e.length)&&Re(o)&&Le(a,o)&&(Me(e)||Ge(e))};var fr=function(e,n){return null!=e&&dr(e,n,sr)};var hr=function(e,n){return Yt(e)&&Ft(n)?Vt(ar(e),n):function(t){var r=cr(t,e);return void 0===r&&r===n?fr(t,e):Pt(n,r,3)}};var lr=function(e){return function(n){return null==n?void 0:n[e]}};var pr=function(e){return function(n){return ur(n,e)}};var vr=function(e){return Yt(e)?lr(ar(e)):pr(e)};var gr=function(e){return"function"==typeof e?e:null==e?vt:"object"==typeof e?Me(e)?hr(e[0],e[1]):$t(e):vr(e)};var yr=function(e,n){return(Me(e)?sn:mt)(e,gr(n))},br=Object.prototype.hasOwnProperty;var mr=function(e,n){return null!=e&&br.call(e,n)};var wr=function(e,n){return null!=e&&dr(e,n,mr)},Er=Object.prototype.hasOwnProperty;var _r=function(e){if(null==e)return!0;if(Qe(e)&&(Me(e)||"string"==typeof e||"function"==typeof e.splice||Ae(e)||Ve(e)||Ge(e)))return!e.length;var n=Rn(e);if("[object Map]"==n||"[object Set]"==n)return!e.size;if(qe(e))return!Ke(e).length;for(var t in e)if(Er.call(e,t))return!1;return!0};var jr=function(e){return void 0===e};var xr=function(e,n){var t=-1,r=Qe(e)?Array(e.length):[];return pt(e,(function(e,o,i){r[++t]=n(e,o,i)})),r};var Nr=function(e,n){return(Me(e)?er:xr)(e,gr(n))};var Or=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t};var kr=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t};var Ir=function(e,n,t){var r=Me(e)?Or:kr,o=arguments.length<3;return r(e,gr(n),t,o,pt)};var Sr=function(e){return"string"==typeof e||!Me(e)&&Ne(e)&&"[object String]"==G(e)},Tr=lr("length"),Gr=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Mr=function(e){return Gr.test(e)},Cr="[\\ud800-\\udfff]",Ar="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Br="\\ud83c[\\udffb-\\udfff]",Lr="[^\\ud800-\\udfff]",Rr="(?:\\ud83c[\\udde6-\\uddff]){2}",Dr="[\\ud800-\\udbff][\\udc00-\\udfff]",Pr="(?:"+Ar+"|"+Br+")"+"?",zr="[\\ufe0e\\ufe0f]?",Fr=zr+Pr+("(?:\\u200d(?:"+[Lr,Rr,Dr].join("|")+")"+zr+Pr+")*"),Ur="(?:"+[Lr+Ar+"?",Ar,Rr,Dr,Cr].join("|")+")",Vr=RegExp(Br+"(?="+Br+")|"+Ur+Fr,"g");var $r=function(e){for(var n=Vr.lastIndex=0;Vr.test(e);)++n;return n};var Hr=function(e){return Mr(e)?$r(e):Tr(e)};var Wr=function(e){if(null==e)return 0;if(Qe(e))return Sr(e)?Hr(e):e.length;var n=Rn(e);return"[object Map]"==n||"[object Set]"==n?e.size:Ke(e).length};var qr=function(e,n,t){var r=Me(e),o=r||Ae(e)||Ve(e);if(n=gr(n),null==t){var i=e&&e.constructor;t=o?r?new i:[]:M(e)&&A(i)?Kn(gn(e)):{}}return(o?be:lt)(e,(function(e,r,o){return n(t,e,r,o)})),t},Yr=_?_.isConcatSpreadable:void 0;var Jr=function(e){return Me(e)||Ge(e)||!!(Yr&&e&&e[Yr])};var Xr=function e(n,t,r,o,i){var a=-1,u=n.length;for(r||(r=Jr),i||(i=[]);++a<u;){var c=n[a];t>0&&r(c)?t>1?e(c,t-1,r,o,i):vn(i,c):o||(i[i.length]=c)}return i};var Kr=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)},Qr=Math.max;var Zr=function(e,n,t){return n=Qr(void 0===n?e.length-1:n,0),function(){for(var r=arguments,o=-1,i=Qr(r.length-n,0),a=Array(i);++o<i;)a[o]=r[n+o];o=-1;for(var u=Array(n+1);++o<n;)u[o]=r[o];return u[n]=t(a),Kr(e,this,u)}},eo=me?function(e,n){return me(e,"toString",{configurable:!0,enumerable:!1,value:ft(n),writable:!0})}:vt,no=Date.now;var to=function(e){var n=0,t=0;return function(){var r=no(),o=16-(r-t);if(t=r,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}},ro=to(eo);var oo=function(e,n){return ro(Zr(e,n,vt),e+"")};var io=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1};var ao=function(e){return e!=e};var uo=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1};var co=function(e,n,t){return n==n?uo(e,n,t):io(e,ao,t)};var so=function(e,n){return!!(null==e?0:e.length)&&co(e,n,0)>-1};var fo=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1};var ho=function(){},lo=xn&&1/It(new xn([,-0]))[1]==1/0?function(e){return new xn(e)}:ho,po=lo;var vo=function(e,n,t){var r=-1,o=so,i=e.length,a=!0,u=[],c=u;if(t)a=!1,o=fo;else if(i>=200){var s=n?null:po(e);if(s)return It(s);a=!1,o=Nt,c=new jt}else c=n?[]:u;e:for(;++r<i;){var d=e[r],f=n?n(d):d;if(d=t||0!==d?d:0,a&&f==f){for(var h=c.length;h--;)if(c[h]===f)continue e;n&&c.push(f),u.push(d)}else o(c,f,t)||(c!==u&&c.push(f),u.push(d))}return u};var go=function(e){return Ne(e)&&Qe(e)},yo=oo((function(e){return vo(Xr(e,1,go,!0))}));var bo=function(e,n){return er(n,(function(n){return e[n]}))};var mo,wo=function(e){return null==e?[]:bo(e,Ze(e))};try{mo={clone:dt,constant:ft,each:bt,filter:yr,has:wr,isArray:Me,isEmpty:_r,isFunction:A,isUndefined:jr,keys:Ze,map:Nr,reduce:Ir,size:Wr,transform:qr,union:yo,values:wo}}catch(e){}mo||(mo=window._);var Eo=mo,_o=xo,jo="\0";function xo(e){this._isDirected=!Eo.has(e,"directed")||e.directed,this._isMultigraph=!!Eo.has(e,"multigraph")&&e.multigraph,this._isCompound=!!Eo.has(e,"compound")&&e.compound,this._label=void 0,this._defaultNodeLabelFn=Eo.constant(void 0),this._defaultEdgeLabelFn=Eo.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children["\0"]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function No(e,n){e[n]?e[n]++:e[n]=1}function Oo(e,n){--e[n]||delete e[n]}function ko(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}return o+""+i+""+(Eo.isUndefined(r)?"\0":r)}function Io(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}function So(e,n){return ko(e,n.v,n.w,n.name)}xo.prototype._nodeCount=0,xo.prototype._edgeCount=0,xo.prototype.isDirected=function(){return this._isDirected},xo.prototype.isMultigraph=function(){return this._isMultigraph},xo.prototype.isCompound=function(){return this._isCompound},xo.prototype.setGraph=function(e){return this._label=e,this},xo.prototype.graph=function(){return this._label},xo.prototype.setDefaultNodeLabel=function(e){return Eo.isFunction(e)||(e=Eo.constant(e)),this._defaultNodeLabelFn=e,this},xo.prototype.nodeCount=function(){return this._nodeCount},xo.prototype.nodes=function(){return Eo.keys(this._nodes)},xo.prototype.sources=function(){var e=this;return Eo.filter(this.nodes(),(function(n){return Eo.isEmpty(e._in[n])}))},xo.prototype.sinks=function(){var e=this;return Eo.filter(this.nodes(),(function(n){return Eo.isEmpty(e._out[n])}))},xo.prototype.setNodes=function(e,n){var t=arguments,r=this;return Eo.each(e,(function(e){t.length>1?r.setNode(e,n):r.setNode(e)})),this},xo.prototype.setNode=function(e,n){return Eo.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=n),this):(this._nodes[e]=arguments.length>1?n:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=jo,this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},xo.prototype.node=function(e){return this._nodes[e]},xo.prototype.hasNode=function(e){return Eo.has(this._nodes,e)},xo.prototype.removeNode=function(e){var n=this;if(Eo.has(this._nodes,e)){var t=function(e){n.removeEdge(n._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],Eo.each(this.children(e),(function(e){n.setParent(e)})),delete this._children[e]),Eo.each(Eo.keys(this._in[e]),t),delete this._in[e],delete this._preds[e],Eo.each(Eo.keys(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},xo.prototype.setParent=function(e,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(Eo.isUndefined(n))n=jo;else{for(var t=n+="";!Eo.isUndefined(t);t=this.parent(t))if(t===e)throw new Error("Setting "+n+" as parent of "+e+" would create a cycle");this.setNode(n)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=n,this._children[n][e]=!0,this},xo.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},xo.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==jo)return n}},xo.prototype.children=function(e){if(Eo.isUndefined(e)&&(e=jo),this._isCompound){var n=this._children[e];if(n)return Eo.keys(n)}else{if(e===jo)return this.nodes();if(this.hasNode(e))return[]}},xo.prototype.predecessors=function(e){var n=this._preds[e];if(n)return Eo.keys(n)},xo.prototype.successors=function(e){var n=this._sucs[e];if(n)return Eo.keys(n)},xo.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return Eo.union(n,this.successors(e))},xo.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},xo.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var t=this;Eo.each(this._nodes,(function(t,r){e(r)&&n.setNode(r,t)})),Eo.each(this._edgeObjs,(function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,t.edge(e))}));var r={};function o(e){var i=t.parent(e);return void 0===i||n.hasNode(i)?(r[e]=i,i):i in r?r[i]:o(i)}return this._isCompound&&Eo.each(n.nodes(),(function(e){n.setParent(e,o(e))})),n},xo.prototype.setDefaultEdgeLabel=function(e){return Eo.isFunction(e)||(e=Eo.constant(e)),this._defaultEdgeLabelFn=e,this},xo.prototype.edgeCount=function(){return this._edgeCount},xo.prototype.edges=function(){return Eo.values(this._edgeObjs)},xo.prototype.setPath=function(e,n){var t=this,r=arguments;return Eo.reduce(e,(function(e,o){return r.length>1?t.setEdge(e,o,n):t.setEdge(e,o),o})),this},xo.prototype.setEdge=function(){var e,n,t,r,o=!1,i=arguments[0];"object"==typeof i&&null!==i&&"v"in i?(e=i.v,n=i.w,t=i.name,2===arguments.length&&(r=arguments[1],o=!0)):(e=i,n=arguments[1],t=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),e=""+e,n=""+n,Eo.isUndefined(t)||(t=""+t);var a=ko(this._isDirected,e,n,t);if(Eo.has(this._edgeLabels,a))return o&&(this._edgeLabels[a]=r),this;if(!Eo.isUndefined(t)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[a]=o?r:this._defaultEdgeLabelFn(e,n,t);var u=Io(this._isDirected,e,n,t);return e=u.v,n=u.w,Object.freeze(u),this._edgeObjs[a]=u,No(this._preds[n],e),No(this._sucs[e],n),this._in[n][a]=u,this._out[e][a]=u,this._edgeCount++,this},xo.prototype.edge=function(e,n,t){var r=1===arguments.length?So(this._isDirected,arguments[0]):ko(this._isDirected,e,n,t);return this._edgeLabels[r]},xo.prototype.hasEdge=function(e,n,t){var r=1===arguments.length?So(this._isDirected,arguments[0]):ko(this._isDirected,e,n,t);return Eo.has(this._edgeLabels,r)},xo.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?So(this._isDirected,arguments[0]):ko(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],Oo(this._preds[n],e),Oo(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},xo.prototype.inEdges=function(e,n){var t=this._in[e];if(t){var r=Eo.values(t);return n?Eo.filter(r,(function(e){return e.v===n})):r}},xo.prototype.outEdges=function(e,n){var t=this._out[e];if(t){var r=Eo.values(t);return n?Eo.filter(r,(function(e){return e.w===n})):r}},xo.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))};var To={Graph:_o,version:"2.1.8"},Go={write:function(e){var n={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Mo(e),edges:Co(e)};Eo.isUndefined(e.graph())||(n.value=Eo.clone(e.graph()));return n},read:function(e){var n=new _o(e.options).setGraph(e.value);return Eo.each(e.nodes,(function(e){n.setNode(e.v,e.value),e.parent&&n.setParent(e.v,e.parent)})),Eo.each(e.edges,(function(e){n.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),n}};function Mo(e){return Eo.map(e.nodes(),(function(n){var t=e.node(n),r=e.parent(n),o={v:n};return Eo.isUndefined(t)||(o.value=t),Eo.isUndefined(r)||(o.parent=r),o}))}function Co(e){return Eo.map(e.edges(),(function(n){var t=e.edge(n),r={v:n.v,w:n.w};return Eo.isUndefined(n.name)||(r.name=n.name),Eo.isUndefined(t)||(r.value=t),r}))}var Ao=function(e){var n,t={},r=[];function o(r){Eo.has(t,r)||(t[r]=!0,n.push(r),Eo.each(e.successors(r),o),Eo.each(e.predecessors(r),o))}return Eo.each(e.nodes(),(function(e){n=[],o(e),n.length&&r.push(n)})),r};var Bo=Lo;function Lo(){this._arr=[],this._keyIndices={}}Lo.prototype.size=function(){return this._arr.length},Lo.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},Lo.prototype.has=function(e){return Eo.has(this._keyIndices,e)},Lo.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},Lo.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},Lo.prototype.add=function(e,n){var t=this._keyIndices;if(e=String(e),!Eo.has(t,e)){var r=this._arr,o=r.length;return t[e]=o,r.push({key:e,priority:n}),this._decrease(o),!0}return!1},Lo.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},Lo.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},Lo.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},Lo.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},Lo.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n};var Ro=function(e,n,t,r){return function(e,n,t,r){var o,i,a={},u=new Bo,c=function(e){var n=e.v!==o?e.v:e.w,r=a[n],c=t(e),s=i.distance+c;if(c<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+c);s<r.distance&&(r.distance=s,r.predecessor=o,u.decrease(n,s))};e.nodes().forEach((function(e){var t=e===n?0:Number.POSITIVE_INFINITY;a[e]={distance:t},u.add(e,t)}));for(;u.size()>0&&(o=u.removeMin(),(i=a[o]).distance!==Number.POSITIVE_INFINITY);)r(o).forEach(c);return a}(e,String(n),t||Do,r||function(n){return e.outEdges(n)})},Do=Eo.constant(1);var Po=function(e,n,t){return Eo.transform(e.nodes(),(function(r,o){r[o]=Ro(e,o,n,t)}),{})};var zo=function(e){var n=0,t=[],r={},o=[];function i(a){var u=r[a]={onStack:!0,lowlink:n,index:n++};if(t.push(a),e.successors(a).forEach((function(e){Eo.has(r,e)?r[e].onStack&&(u.lowlink=Math.min(u.lowlink,r[e].index)):(i(e),u.lowlink=Math.min(u.lowlink,r[e].lowlink))})),u.lowlink===u.index){var c,s=[];do{c=t.pop(),r[c].onStack=!1,s.push(c)}while(a!==c);o.push(s)}}return e.nodes().forEach((function(e){Eo.has(r,e)||i(e)})),o};var Fo=function(e){return Eo.filter(zo(e),(function(n){return n.length>1||1===n.length&&e.hasEdge(n[0],n[0])}))};var Uo=function(e,n,t){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,n||Vo,t||function(n){return e.outEdges(n)})},Vo=Eo.constant(1);var $o=Ho;function Ho(e){var n={},t={},r=[];if(Eo.each(e.sinks(),(function o(i){if(Eo.has(t,i))throw new Wo;Eo.has(n,i)||(t[i]=!0,n[i]=!0,Eo.each(e.predecessors(i),o),delete t[i],r.push(i))})),Eo.size(n)!==e.nodeCount())throw new Wo;return r}function Wo(){}Ho.CycleException=Wo,Wo.prototype=new Error;var qo=function(e,n,t){Eo.isArray(n)||(n=[n]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),o=[],i={};return Eo.each(n,(function(n){if(!e.hasNode(n))throw new Error("Graph does not have node: "+n);Yo(e,n,"post"===t,i,r,o)})),o};function Yo(e,n,t,r,o,i){Eo.has(r,n)||(r[n]=!0,t||i.push(n),Eo.each(o(n),(function(n){Yo(e,n,t,r,o,i)})),t&&i.push(n))}var Jo,Xo={components:Ao,dijkstra:Ro,dijkstraAll:Po,findCycles:Fo,floydWarshall:Uo,isAcyclic:function(e){try{$o(e)}catch(e){if(e instanceof $o.CycleException)return!1;throw e}return!0},postorder:function(e,n){return qo(e,n,"post")},preorder:function(e,n){return qo(e,n,"pre")},prim:function(e,n){var t,r=new _o,o={},i=new Bo;function a(e){var r=e.v===t?e.w:e.v,a=i.priority(r);if(void 0!==a){var u=n(e);u<a&&(o[r]=t,i.decrease(r,u))}}if(0===e.nodeCount())return r;Eo.each(e.nodes(),(function(e){i.add(e,Number.POSITIVE_INFINITY),r.setNode(e)})),i.decrease(e.nodes()[0],0);var u=!1;for(;i.size()>0;){if(t=i.removeMin(),Eo.has(o,t))r.setEdge(t,o[t]);else{if(u)throw new Error("Input graph is not connected: "+e);u=!0}e.nodeEdges(t).forEach(a)}return r},tarjan:zo,topsort:$o},Ko={Graph:To.Graph,json:Go,alg:Xo,version:To.version};try{Jo=Ko}catch(e){}Jo||(Jo=window.graphlib);var Qo=Jo;var Zo=function(e){return st(e,5)};var ei=function(e,n,t){if(!M(t))return!1;var r=typeof n;return!!("number"==r?Qe(t)&&Le(n,t.length):"string"==r&&n in t)&&a(t[n],e)},ni=Object.prototype,ti=ni.hasOwnProperty,ri=oo((function(e,n){e=Object(e);var t=-1,r=n.length,o=r>2?n[2]:void 0;for(o&&ei(n[0],n[1],o)&&(r=1);++t<r;)for(var i=n[t],u=on(i),c=-1,s=u.length;++c<s;){var d=u[c],f=e[d];(void 0===f||a(f,ni[d])&&!ti.call(e,d))&&(e[d]=i[d])}return e}));var oi=function(e){return function(n,t,r){var o=Object(n);if(!Qe(n)){var i=gr(t);n=Ze(n),t=function(e){return i(o[e],e,o)}}var a=e(n,t,r);return a>-1?o[i?n[a]:a]:void 0}},ii=/\s/;var ai=function(e){for(var n=e.length;n--&&ii.test(e.charAt(n)););return n},ui=/^\s+/;var ci=function(e){return e?e.slice(0,ai(e)+1).replace(ui,""):e},si=/^[-+]0x[0-9a-f]+$/i,di=/^0b[01]+$/i,fi=/^0o[0-7]+$/i,hi=parseInt;var li=function(e){if("number"==typeof e)return e;if(Ht(e))return NaN;if(M(e)){var n="function"==typeof e.valueOf?e.valueOf():e;e=M(n)?n+"":n}if("string"!=typeof e)return 0===e?e:+e;e=ci(e);var t=di.test(e);return t||fi.test(e)?hi(e.slice(2),t?2:8):si.test(e)?NaN:+e},pi=1/0;var vi=function(e){return e?(e=li(e))===pi||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0};var gi=function(e){var n=vi(e),t=n%1;return n==n?t?n-t:n:0},yi=Math.max;var bi=oi((function(e,n,t){var r=null==e?0:e.length;if(!r)return-1;var o=null==t?0:gi(t);return o<0&&(o=yi(r+o,0)),io(e,gr(n),o)}));var mi=function(e){return(null==e?0:e.length)?Xr(e,1):[]};var wi=function(e,n){return null==e?e:ht(e,gt(n),on)};var Ei=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0};var _i=function(e,n){var t={};return n=gr(n),lt(e,(function(e,r,o){we(t,r,n(e,r,o))})),t};var ji=function(e,n,t){for(var r=-1,o=e.length;++r<o;){var i=e[r],a=n(i);if(null!=a&&(void 0===u?a==a&&!Ht(a):t(a,u)))var u=a,c=i}return c};var xi=function(e,n){return e>n};var Ni=function(e){return e&&e.length?ji(e,vt,xi):void 0};var Oi=function(e,n,t){(void 0!==t&&!a(e[n],t)||void 0===t&&!(n in e))&&we(e,n,t)},ki=Function.prototype,Ii=Object.prototype,Si=ki.toString,Ti=Ii.hasOwnProperty,Gi=Si.call(Object);var Mi=function(e){if(!Ne(e)||"[object Object]"!=G(e))return!1;var n=gn(e);if(null===n)return!0;var t=Ti.call(n,"constructor")&&n.constructor;return"function"==typeof t&&t instanceof t&&Si.call(t)==Gi};var Ci=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]};var Ai=function(e){return je(e,on(e))};var Bi=function(e,n,t,r,o,i,a){var u=Ci(e,t),c=Ci(n,t),s=a.get(c);if(s)Oi(e,t,s);else{var d=i?i(u,c,t+"",e,n,a):void 0,f=void 0===d;if(f){var h=Me(c),l=!h&&Ae(c),p=!h&&!l&&Ve(c);d=c,h||l||p?Me(u)?d=u:go(u)?d=cn(u):l?(f=!1,d=un(c,!0)):p?(f=!1,d=Yn(c,!0)):d=[]:Mi(c)||Ge(c)?(d=u,Ge(u)?d=Ai(u):M(u)&&!A(u)||(d=Qn(c))):f=!1}f&&(a.set(c,d),o(d,c,r,i,a),a.delete(c)),Oi(e,t,d)}};var Li=function e(n,t,r,o,i){n!==t&&ht(t,(function(a,u){if(i||(i=new ye),M(a))Bi(n,t,u,r,e,o,i);else{var c=o?o(Ci(n,u),a,u+"",n,t,i):void 0;void 0===c&&(c=a),Oi(n,u,c)}}),on)};var Ri=function(e){return oo((function(n,t){var r=-1,o=t.length,i=o>1?t[o-1]:void 0,a=o>2?t[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,a&&ei(t[0],t[1],a)&&(i=o<3?void 0:i,o=1),n=Object(n);++r<o;){var u=t[r];u&&e(n,u,r,i)}return n}))}((function(e,n,t){Li(e,n,t)}));var Di=function(e,n){return e<n};var Pi=function(e){return e&&e.length?ji(e,vt,Di):void 0};var zi=function(e,n){return e&&e.length?ji(e,gr(n),Di):void 0},Fi=function(){return E.Date.now()};var Ui=function(e,n,t,r){if(!M(e))return e;for(var o=-1,i=(n=ir(n,e)).length,a=i-1,u=e;null!=u&&++o<i;){var c=ar(n[o]),s=t;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=a){var d=u[c];void 0===(s=r?r(d,c,u):void 0)&&(s=M(d)?d:Le(n[o+1])?[]:{})}_e(u,c,s),u=u[c]}return e};var Vi=function(e,n,t){for(var r=-1,o=n.length,i={};++r<o;){var a=n[r],u=ur(e,a);t(u,a)&&Ui(i,ir(a,e),u)}return i};var $i=function(e,n){return Vi(e,n,(function(n,t){return fr(e,t)}))};var Hi=function(e){return ro(Zr(e,void 0,mi),e+"")}((function(e,n){return null==e?{}:$i(e,n)})),Wi=Math.ceil,qi=Math.max;var Yi=function(e,n,t,r){for(var o=-1,i=qi(Wi((n-e)/(t||1)),0),a=Array(i);i--;)a[r?i:++o]=e,e+=t;return a};var Ji=function(e){return function(n,t,r){return r&&"number"!=typeof r&&ei(n,t,r)&&(t=r=void 0),n=vi(n),void 0===t?(t=n,n=0):t=vi(t),r=void 0===r?n<t?1:-1:vi(r),Yi(n,t,r,e)}}();var Xi=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e};var Ki=function(e,n){if(e!==n){var t=void 0!==e,r=null===e,o=e==e,i=Ht(e),a=void 0!==n,u=null===n,c=n==n,s=Ht(n);if(!u&&!s&&!i&&e>n||i&&a&&c&&!u&&!s||r&&a&&c||!t&&c||!o)return 1;if(!r&&!i&&!s&&e<n||s&&t&&o&&!r&&!i||u&&t&&o||!a&&o||!c)return-1}return 0};var Qi=function(e,n,t){for(var r=-1,o=e.criteria,i=n.criteria,a=o.length,u=t.length;++r<a;){var c=Ki(o[r],i[r]);if(c)return r>=u?c:c*("desc"==t[r]?-1:1)}return e.index-n.index};var Zi=function(e,n,t){n=n.length?er(n,(function(e){return Me(e)?function(n){return ur(n,1===e.length?e[0]:e)}:e})):[vt];var r=-1;n=er(n,ze(gr));var o=xr(e,(function(e,t,o){return{criteria:er(n,(function(n){return n(e)})),index:++r,value:e}}));return Xi(o,(function(e,n){return Qi(e,n,t)}))},ea=oo((function(e,n){if(null==e)return[];var t=n.length;return t>1&&ei(e,n[0],n[1])?n=[]:t>2&&ei(n[0],n[1],n[2])&&(n=[n[0]]),Zi(e,Xr(n,1),[])})),na=0;var ta=function(e){var n=++na;return or(e)+n};var ra=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a};var oa,ia=function(e,n){return ra(e||[],n||[],_e)};try{oa={cloneDeep:Zo,constant:ft,defaults:ri,each:bt,filter:yr,find:bi,flatten:mi,forEach:yt,forIn:wi,has:wr,isUndefined:jr,last:Ei,map:Nr,mapValues:_i,max:Ni,merge:Ri,min:Pi,minBy:zi,now:Fi,pick:Hi,range:Ji,reduce:Ir,sortBy:ea,uniqueId:ta,values:wo,zipObject:ia}}catch(e){}oa||(oa=window._);var aa=oa,ua=ca;function ca(){var e={};e._next=e._prev=e,this._sentinel=e}function sa(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function da(e,n){if("_next"!==e&&"_prev"!==e)return n}ca.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return sa(n),n},ca.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&sa(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},ca.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,da)),t=t._prev;return"["+e.join(", ")+"]"};var fa=Qo.Graph,ha=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new fa,r=0,o=0;aa.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),aa.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=aa.range(o+r+3).map((function(){return new ua})),a=r+1;return aa.forEach(t.nodes(),(function(e){va(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||la),r=function(e,n,t){var r,o=[],i=n[n.length-1],a=n[0];for(;e.nodeCount();){for(;r=a.dequeue();)pa(e,n,t,r);for(;r=i.dequeue();)pa(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(pa(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return aa.flatten(aa.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},la=aa.constant(1);function pa(e,n,t,r,o){var i=o?[]:void 0;return aa.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,va(n,t,u)})),aa.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,va(n,t,a)})),e.removeNode(r.v),i}function va(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var ga={run:function(e){var n="greedy"===e.graph().acyclicer?ha(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};function o(i){aa.has(r,i)||(r[i]=!0,t[i]=!0,aa.forEach(e.outEdges(i),(function(e){aa.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])}return aa.forEach(e.nodes(),o),n}(e);aa.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,aa.uniqueId("rev"))}))},undo:function(e){aa.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}};var ya=Qo.Graph,ba={addDummyNode:ma,simplify:function(e){var n=(new ya).setGraph(e.graph());return aa.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),aa.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new ya({multigraph:e.isMultigraph()}).setGraph(e.graph());return aa.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),aa.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=aa.map(e.nodes(),(function(n){var t={};return aa.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return aa.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=aa.map(e.nodes(),(function(n){var t={};return aa.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return aa.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a);return{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=aa.map(aa.range(wa(e)+1),(function(){return[]}));return aa.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;aa.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=aa.min(aa.map(e.nodes(),(function(n){return e.node(n).rank})));aa.forEach(e.nodes(),(function(t){var r=e.node(t);aa.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=aa.min(aa.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];aa.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;aa.forEach(t,(function(n,t){aa.isUndefined(n)&&t%o!=0?--r:r&&aa.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};arguments.length>=4&&(o.rank=t,o.order=r);return ma(e,"border",o,n)},maxRank:wa,partition:function(e,n){var t={lhs:[],rhs:[]};return aa.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=aa.now();try{return n()}finally{console.log(e+" time: "+(aa.now()-t)+"ms")}},notime:function(e,n){return n()}};function ma(e,n,t,r){var o;do{o=aa.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function wa(e){return aa.max(aa.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!aa.isUndefined(t))return t})))}var Ea={run:function(e){e.graph().dummyChains=[],aa.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,d=e.edge(n),f=d.labelRank;if(c===a+1)return;for(e.removeEdge(n),o=0,++a;a<c;++o,++a)d.points=[],r={width:0,height:0,edgeLabel:d,edgeObj:n,rank:a},t=ba.addDummyNode(e,"edge",r,"_d"),a===f&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),e.setEdge(i,t,{weight:d.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:d.weight},s)}(e,n)}))},undo:function(e){aa.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}};var _a=function(e){var n={};aa.forEach(e.sources(),(function t(r){var o=e.node(r);if(aa.has(n,r))return o.rank;n[r]=!0;var i=aa.min(aa.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},ja=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen};var xa=Qo.Graph,Na=ja,Oa=function(e){var n,t,r=new xa({directed:!1}),o=e.nodes()[0],i=e.nodeCount();r.setNode(o,{});for(;ka(r,e)<i;)n=Ia(r,e),t=r.hasNode(n.v)?Na(e,n):-Na(e,n),Sa(r,e,t);return r};function ka(e,n){return aa.forEach(e.nodes(