UNPKG

dagre-compound

Version:

A multi-level compound graph layout library based on dagre

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