%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/nextcloud.varak.net/apps/text/js/
Upload File :
Create Path :
Current File : //www/varak.net/nextcloud.varak.net/apps/text/js/mindmap-definition-fc14e90a-Dmt9v0it.chunk.mjs

/*! third party licenses: js/vendor.LICENSE.txt */
import{l as hn,c as na,aH as Gl,u as Yl,aJ as Kr,d as Zr,h as Vl,b3 as Ul,b4 as Xl,b5 as jl,aL as Hl}from"./mermaid.core-ChD64xgE.chunk.mjs";import{c as Xt,g as Jo}from"./emoji-picker-SoWZqoso.chunk.mjs";import{c as Wl}from"./createText-2e5e7dd3-CGeVxhlf.chunk.mjs";import"./modulepreload-polyfill-DMTabKmO.chunk.mjs";import"./vue.runtime.esm-fZsuJKoo.chunk.mjs";function ql(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var pr=ql,$l=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt,Kl=$l,Zl=Kl,Ql=typeof self=="object"&&self&&self.Object===Object&&self,Jl=Zl||Ql||Function("return this")(),li=Jl,eu=li,tu=function(){return eu.Date.now()},nu=tu,ru=/\s/;function iu(e){for(var t=e.length;t--&&ru.test(e.charAt(t)););return t}var au=iu,ou=au,su=/^\s+/;function lu(e){return e&&e.slice(0,ou(e)+1).replace(su,"")}var uu=lu,cu=li,hu=cu.Symbol,ra=hu,Ta=ra,es=Object.prototype,du=es.hasOwnProperty,pu=es.toString,Gn=Ta?Ta.toStringTag:void 0;function gu(e){var t=du.call(e,Gn),n=e[Gn];try{e[Gn]=void 0;var r=!0}catch{}var i=pu.call(e);return r&&(t?e[Gn]=n:delete e[Gn]),i}var fu=gu,vu=Object.prototype,yu=vu.toString;function mu(e){return yu.call(e)}var bu=mu,Da=ra,xu=fu,wu=bu,Eu="[object Null]",_u="[object Undefined]",Ca=Da?Da.toStringTag:void 0;function Tu(e){return e==null?e===void 0?_u:Eu:Ca&&Ca in Object(e)?xu(e):wu(e)}var ts=Tu;function Du(e){return e!=null&&typeof e=="object"}var Cu=Du,Au=ts,ku=Cu,Lu="[object Symbol]";function Nu(e){return typeof e=="symbol"||ku(e)&&Au(e)==Lu}var gr=Nu,Su=uu,Aa=pr,Iu=gr,ka=NaN,Pu=/^[-+]0x[0-9a-f]+$/i,Ou=/^0b[01]+$/i,Mu=/^0o[0-7]+$/i,Ru=parseInt;function Bu(e){if(typeof e=="number")return e;if(Iu(e))return ka;if(Aa(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Aa(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Su(e);var n=Ou.test(e);return n||Mu.test(e)?Ru(e.slice(2),n?2:8):Pu.test(e)?ka:+e}var Fu=Bu,zu=pr,Ei=nu,La=Fu,Gu="Expected a function",Yu=Math.max,Vu=Math.min;function Uu(e,t,n){var r,i,o,a,s,l,u=0,c=!1,h=!1,p=!0;if(typeof e!="function")throw new TypeError(Gu);t=La(t)||0,zu(n)&&(c=!!n.leading,h="maxWait"in n,o=h?Yu(La(n.maxWait)||0,t):o,p="trailing"in n?!!n.trailing:p);function d(D){var y=r,E=i;return r=i=void 0,u=D,a=e.apply(E,y),a}function g(D){return u=D,s=setTimeout(f,t),c?d(D):a}function v(D){var y=D-l,E=D-u,w=t-y;return h?Vu(w,o-E):w}function b(D){var y=D-l,E=D-u;return l===void 0||y>=t||y<0||h&&E>=o}function f(){var D=Ei();if(b(D))return m(D);s=setTimeout(f,v(D))}function m(D){return s=void 0,p&&r?d(D):(r=i=void 0,a)}function x(){s!==void 0&&clearTimeout(s),u=0,r=l=i=s=void 0}function T(){return s===void 0?a:m(Ei())}function _(){var D=Ei(),y=b(D);if(r=arguments,i=this,l=D,y){if(s===void 0)return g(l);if(h)return clearTimeout(s),s=setTimeout(f,t),d(l)}return s===void 0&&(s=setTimeout(f,t)),a}return _.cancel=x,_.flush=T,_}var Xu=Uu,ns={exports:{}};(function(e,t){(function(){var n,r,i,o,a,s,l,u,c,h,p,d,g,v,b;i=Math.floor,h=Math.min,r=function(f,m){return f<m?-1:f>m?1:0},c=function(f,m,x,T,_){var D;if(x==null&&(x=0),_==null&&(_=r),x<0)throw new Error("lo must be non-negative");for(T==null&&(T=f.length);x<T;)D=i((x+T)/2),_(m,f[D])<0?T=D:x=D+1;return[].splice.apply(f,[x,x-x].concat(m)),m},s=function(f,m,x){return x==null&&(x=r),f.push(m),v(f,0,f.length-1,x)},a=function(f,m){var x,T;return m==null&&(m=r),x=f.pop(),f.length?(T=f[0],f[0]=x,b(f,0,m)):T=x,T},u=function(f,m,x){var T;return x==null&&(x=r),T=f[0],f[0]=m,b(f,0,x),T},l=function(f,m,x){var T;return x==null&&(x=r),f.length&&x(f[0],m)<0&&(T=[f[0],m],m=T[0],f[0]=T[1],b(f,0,x)),m},o=function(f,m){var x,T,_,D,y,E;for(m==null&&(m=r),D=(function(){E=[];for(var w=0,C=i(f.length/2);0<=C?w<C:w>C;0<=C?w++:w--)E.push(w);return E}).apply(this).reverse(),y=[],T=0,_=D.length;T<_;T++)x=D[T],y.push(b(f,x,m));return y},g=function(f,m,x){var T;if(x==null&&(x=r),T=f.indexOf(m),T!==-1)return v(f,0,T,x),b(f,T,x)},p=function(f,m,x){var T,_,D,y,E;if(x==null&&(x=r),_=f.slice(0,m),!_.length)return _;for(o(_,x),E=f.slice(m),D=0,y=E.length;D<y;D++)T=E[D],l(_,T,x);return _.sort(x).reverse()},d=function(f,m,x){var T,_,D,y,E,w,C,A,k;if(x==null&&(x=r),m*10<=f.length){if(D=f.slice(0,m).sort(x),!D.length)return D;for(_=D[D.length-1],C=f.slice(m),y=0,w=C.length;y<w;y++)T=C[y],x(T,_)<0&&(c(D,T,0,null,x),D.pop(),_=D[D.length-1]);return D}for(o(f,x),k=[],E=0,A=h(m,f.length);0<=A?E<A:E>A;0<=A?++E:--E)k.push(a(f,x));return k},v=function(f,m,x,T){var _,D,y;for(T==null&&(T=r),_=f[x];x>m;){if(y=x-1>>1,D=f[y],T(_,D)<0){f[x]=D,x=y;continue}break}return f[x]=_},b=function(f,m,x){var T,_,D,y,E;for(x==null&&(x=r),_=f.length,E=m,D=f[m],T=2*m+1;T<_;)y=T+1,y<_&&!(x(f[T],f[y])<0)&&(T=y),f[m]=f[T],m=T,T=2*m+1;return f[m]=D,v(f,E,m,x)},n=function(){f.push=s,f.pop=a,f.replace=u,f.pushpop=l,f.heapify=o,f.updateItem=g,f.nlargest=p,f.nsmallest=d;function f(m){this.cmp=m!=null?m:r,this.nodes=[]}return f.prototype.push=function(m){return s(this.nodes,m,this.cmp)},f.prototype.pop=function(){return a(this.nodes,this.cmp)},f.prototype.peek=function(){return this.nodes[0]},f.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},f.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},f.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},f.prototype.heapify=function(){return o(this.nodes,this.cmp)},f.prototype.updateItem=function(m){return g(this.nodes,m,this.cmp)},f.prototype.clear=function(){return this.nodes=[]},f.prototype.empty=function(){return this.nodes.length===0},f.prototype.size=function(){return this.nodes.length},f.prototype.clone=function(){var m;return m=new f,m.nodes=this.nodes.slice(0),m},f.prototype.toArray=function(){return this.nodes.slice(0)},f.prototype.insert=f.prototype.push,f.prototype.top=f.prototype.peek,f.prototype.front=f.prototype.peek,f.prototype.has=f.prototype.contains,f.prototype.copy=f.prototype.clone,f}(),function(f,m){return e.exports=m()}(this,function(){return n})}).call(Xt)})(ns);var ju=ns.exports,Hu=ju,Wu=Array.isArray,ui=Wu,qu=ui,$u=gr,Ku=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zu=/^\w*$/;function Qu(e,t){if(qu(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||$u(e)?!0:Zu.test(e)||!Ku.test(e)||t!=null&&e in Object(t)}var Ju=Qu,ec=ts,tc=pr,nc="[object AsyncFunction]",rc="[object Function]",ic="[object GeneratorFunction]",ac="[object Proxy]";function oc(e){if(!tc(e))return!1;var t=ec(e);return t==rc||t==ic||t==nc||t==ac}var sc=oc,lc=li,uc=lc["__core-js_shared__"],cc=uc,_i=cc,Na=function(){var e=/[^.]+$/.exec(_i&&_i.keys&&_i.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function hc(e){return!!Na&&Na in e}var dc=hc,pc=Function.prototype,gc=pc.toString;function fc(e){if(e!=null){try{return gc.call(e)}catch{}try{return e+""}catch{}}return""}var vc=fc,yc=sc,mc=dc,bc=pr,xc=vc,wc=/[\\^$.*+?()[\]{}|]/g,Ec=/^\[object .+?Constructor\]$/,_c=Function.prototype,Tc=Object.prototype,Dc=_c.toString,Cc=Tc.hasOwnProperty,Ac=RegExp("^"+Dc.call(Cc).replace(wc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function kc(e){if(!bc(e)||mc(e))return!1;var t=yc(e)?Ac:Ec;return t.test(xc(e))}var Lc=kc;function Nc(e,t){return e==null?void 0:e[t]}var Sc=Nc,Ic=Lc,Pc=Sc;function Oc(e,t){var n=Pc(e,t);return Ic(n)?n:void 0}var ia=Oc,Mc=ia,Rc=Mc(Object,"create"),ci=Rc,Sa=ci;function Bc(){this.__data__=Sa?Sa(null):{},this.size=0}var Fc=Bc;function zc(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Gc=zc,Yc=ci,Vc="__lodash_hash_undefined__",Uc=Object.prototype,Xc=Uc.hasOwnProperty;function jc(e){var t=this.__data__;if(Yc){var n=t[e];return n===Vc?void 0:n}return Xc.call(t,e)?t[e]:void 0}var Hc=jc,Wc=ci,qc=Object.prototype,$c=qc.hasOwnProperty;function Kc(e){var t=this.__data__;return Wc?t[e]!==void 0:$c.call(t,e)}var Zc=Kc,Qc=ci,Jc="__lodash_hash_undefined__";function eh(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Qc&&t===void 0?Jc:t,this}var th=eh,nh=Fc,rh=Gc,ih=Hc,ah=Zc,oh=th;function wn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}wn.prototype.clear=nh,wn.prototype.delete=rh,wn.prototype.get=ih,wn.prototype.has=ah,wn.prototype.set=oh;var sh=wn;function lh(){this.__data__=[],this.size=0}var uh=lh;function ch(e,t){return e===t||e!==e&&t!==t}var rs=ch,hh=rs;function dh(e,t){for(var n=e.length;n--;)if(hh(e[n][0],t))return n;return-1}var hi=dh,ph=hi,gh=Array.prototype,fh=gh.splice;function vh(e){var t=this.__data__,n=ph(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():fh.call(t,n,1),--this.size,!0}var yh=vh,mh=hi;function bh(e){var t=this.__data__,n=mh(t,e);return n<0?void 0:t[n][1]}var xh=bh,wh=hi;function Eh(e){return wh(this.__data__,e)>-1}var _h=Eh,Th=hi;function Dh(e,t){var n=this.__data__,r=Th(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Ch=Dh,Ah=uh,kh=yh,Lh=xh,Nh=_h,Sh=Ch;function En(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}En.prototype.clear=Ah,En.prototype.delete=kh,En.prototype.get=Lh,En.prototype.has=Nh,En.prototype.set=Sh;var Ih=En,Ph=ia,Oh=li,Mh=Ph(Oh,"Map"),Rh=Mh,Ia=sh,Bh=Ih,Fh=Rh;function zh(){this.size=0,this.__data__={hash:new Ia,map:new(Fh||Bh),string:new Ia}}var Gh=zh;function Yh(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var Vh=Yh,Uh=Vh;function Xh(e,t){var n=e.__data__;return Uh(t)?n[typeof t=="string"?"string":"hash"]:n.map}var di=Xh,jh=di;function Hh(e){var t=jh(this,e).delete(e);return this.size-=t?1:0,t}var Wh=Hh,qh=di;function $h(e){return qh(this,e).get(e)}var Kh=$h,Zh=di;function Qh(e){return Zh(this,e).has(e)}var Jh=Qh,ed=di;function td(e,t){var n=ed(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var nd=td,rd=Gh,id=Wh,ad=Kh,od=Jh,sd=nd;function _n(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}_n.prototype.clear=rd,_n.prototype.delete=id,_n.prototype.get=ad,_n.prototype.has=od,_n.prototype.set=sd;var ld=_n,is=ld,ud="Expected a function";function aa(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(ud);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(aa.Cache||is),n}aa.Cache=is;var cd=aa,hd=cd,dd=500;function pd(e){var t=hd(e,function(r){return n.size===dd&&n.clear(),r}),n=t.cache;return t}var gd=pd,fd=gd,vd=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,yd=/\\(\\)?/g,md=fd(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(vd,function(n,r,i,o){t.push(i?o.replace(yd,"$1"):r||n)}),t}),as=md;function bd(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var os=bd,Pa=ra,xd=os,wd=ui,Ed=gr,_d=1/0,Oa=Pa?Pa.prototype:void 0,Ma=Oa?Oa.toString:void 0;function ss(e){if(typeof e=="string")return e;if(wd(e))return xd(e,ss)+"";if(Ed(e))return Ma?Ma.call(e):"";var t=e+"";return t=="0"&&1/e==-_d?"-0":t}var Td=ss,Dd=Td;function Cd(e){return e==null?"":Dd(e)}var ls=Cd,Ad=ui,kd=Ju,Ld=as,Nd=ls;function Sd(e,t){return Ad(e)?e:kd(e,t)?[e]:Ld(Nd(e))}var us=Sd,Id=gr,Pd=1/0;function Od(e){if(typeof e=="string"||Id(e))return e;var t=e+"";return t=="0"&&1/e==-Pd?"-0":t}var oa=Od,Md=us,Rd=oa;function Bd(e,t){t=Md(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Rd(t[n++])];return n&&n==r?e:void 0}var Fd=Bd,zd=Fd;function Gd(e,t,n){var r=e==null?void 0:zd(e,t);return r===void 0?n:r}var Yd=Gd,Vd=ia,Ud=function(){try{var e=Vd(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Xd=Ud,Ra=Xd;function jd(e,t,n){t=="__proto__"&&Ra?Ra(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Hd=jd,Wd=Hd,qd=rs,$d=Object.prototype,Kd=$d.hasOwnProperty;function Zd(e,t,n){var r=e[t];(!(Kd.call(e,t)&&qd(r,n))||n===void 0&&!(t in e))&&Wd(e,t,n)}var Qd=Zd,Jd=9007199254740991,ep=/^(?:0|[1-9]\d*)$/;function tp(e,t){var n=typeof e;return t=t!=null?t:Jd,!!t&&(n=="number"||n!="symbol"&&ep.test(e))&&e>-1&&e%1==0&&e<t}var np=tp,rp=Qd,ip=us,ap=np,Ba=pr,op=oa;function sp(e,t,n,r){if(!Ba(e))return e;t=ip(t,e);for(var i=-1,o=t.length,a=o-1,s=e;s!=null&&++i<o;){var l=op(t[i]),u=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(i!=a){var c=s[l];u=r?r(c,l,s):void 0,u===void 0&&(u=Ba(c)?c:ap(t[i+1])?[]:{})}rp(s,l,u),s=s[l]}return e}var lp=sp,up=lp;function cp(e,t,n){return e==null?e:up(e,t,n)}var hp=cp;function dp(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var pp=dp,gp=os,fp=pp,vp=ui,yp=gr,mp=as,bp=oa,xp=ls;function wp(e){return vp(e)?gp(e,bp):yp(e)?[e]:fp(mp(xp(e)))}var Ep=wp,_p=Xu,Tp=Hu,Dp=Yd,Cp=hp,Ap=Ep;function fr(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var pi=fr(_p),vr=fr(Tp),kp=fr(Dp),Lp=fr(Cp),Np=fr(Ap);function Ve(e){"@babel/helpers - typeof";return Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ve(e)}function sa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Sp(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function la(e,t,n){return t&&Sp(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function cs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function xt(e,t){return Ip(e)||Pp(e,t)||Op(e,t)||Mp()}function Ip(e){if(Array.isArray(e))return e}function Pp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,s;try{for(n=n.call(e);!(i=(a=n.next()).done)&&(r.push(a.value),!(t&&r.length===t));i=!0);}catch(l){o=!0,s=l}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw s}}return r}}function Op(e,t){if(e){if(typeof e=="string")return Fa(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fa(e,t)}}function Fa(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Mp(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var ze=typeof window>"u"?null:window,za=ze?ze.navigator:null;ze&&ze.document;var Rp=Ve(""),hs=Ve({}),Bp=Ve(function(){}),Fp=typeof HTMLElement>"u"?"undefined":Ve(HTMLElement),yr=function(e){return e&&e.instanceString&&Me(e.instanceString)?e.instanceString():null},le=function(e){return e!=null&&Ve(e)==Rp},Me=function(e){return e!=null&&Ve(e)===Bp},Se=function(e){return!ht(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},_e=function(e){return e!=null&&Ve(e)===hs&&!Se(e)&&e.constructor===Object},zp=function(e){return e!=null&&Ve(e)===hs},ee=function(e){return e!=null&&Ve(e)===Ve(1)&&!isNaN(e)},Gp=function(e){return ee(e)&&Math.floor(e)===e},Qr=function(e){if(Fp!=="undefined")return e!=null&&e instanceof HTMLElement},ht=function(e){return mr(e)||ds(e)},mr=function(e){return yr(e)==="collection"&&e._private.single},ds=function(e){return yr(e)==="collection"&&!e._private.single},ua=function(e){return yr(e)==="core"},ps=function(e){return yr(e)==="stylesheet"},Yp=function(e){return yr(e)==="event"},$t=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Vp=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Up=function(e){return _e(e)&&ee(e.x1)&&ee(e.x2)&&ee(e.y1)&&ee(e.y2)},Xp=function(e){return zp(e)&&Me(e.then)},jp=function(){return za&&za.userAgent.match(/msie|trident|edge/i)},ar=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],i=0;i<arguments.length;i++)r.push(arguments[i]);return r.join("$")});var n=function r(){var i=this,o=arguments,a,s=t.apply(i,o),l=r.cache;return(a=l[s])||(a=l[s]=e.apply(i,o)),a};return n.cache={},n},ca=ar(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),gi=ar(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),gs=ar(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),Ga=function(e){return $t(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ye="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Hp="rgb[a]?\\(("+Ye+"[%]?)\\s*,\\s*("+Ye+"[%]?)\\s*,\\s*("+Ye+"[%]?)(?:\\s*,\\s*("+Ye+"))?\\)",Wp="rgb[a]?\\((?:"+Ye+"[%]?)\\s*,\\s*(?:"+Ye+"[%]?)\\s*,\\s*(?:"+Ye+"[%]?)(?:\\s*,\\s*(?:"+Ye+"))?\\)",qp="hsl[a]?\\(("+Ye+")\\s*,\\s*("+Ye+"[%])\\s*,\\s*("+Ye+"[%])(?:\\s*,\\s*("+Ye+"))?\\)",$p="hsl[a]?\\((?:"+Ye+")\\s*,\\s*(?:"+Ye+"[%])\\s*,\\s*(?:"+Ye+"[%])(?:\\s*,\\s*(?:"+Ye+"))?\\)",Kp="\\#[0-9a-fA-F]{3}",Zp="\\#[0-9a-fA-F]{6}",fs=function(e,t){return e<t?-1:e>t?1:0},Qp=function(e,t){return-1*fs(e,t)},de=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),o=0;o<i.length;o++){var a=i[o];e[a]=r[a]}}return e},Jp=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var t=e.length===4,n,r,i,o=16;return t?(n=parseInt(e[1]+e[1],o),r=parseInt(e[2]+e[2],o),i=parseInt(e[3]+e[3],o)):(n=parseInt(e[1]+e[2],o),r=parseInt(e[3]+e[4],o),i=parseInt(e[5]+e[6],o)),[n,r,i]}},eg=function(e){var t,n,r,i,o,a,s,l;function u(d,g,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?d+(g-d)*6*v:v<1/2?g:v<2/3?d+(g-d)*(2/3-v)*6:d}var c=new RegExp("^"+qp+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,r=parseFloat(c[2]),r<0||r>100||(r=r/100,i=parseFloat(c[3]),i<0||i>100)||(i=i/100,o=c[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(r===0)a=s=l=Math.round(i*255);else{var h=i<.5?i*(1+r):i+r-i*r,p=2*i-h;a=Math.round(255*u(p,h,n+1/3)),s=Math.round(255*u(p,h,n)),l=Math.round(255*u(p,h,n-1/3))}t=[a,s,l,o]}return t},tg=function(e){var t,n=new RegExp("^"+Hp+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var o=n[i];if(o[o.length-1]==="%"&&(r[i]=!0),o=parseFloat(o),r[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var a=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(a&&!s)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},ng=function(e){return ig[e.toLowerCase()]},rg=function(e){return(Se(e)?e:null)||ng(e)||Jp(e)||tg(e)||eg(e)},ig={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},vs=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var o=n[i];if(_e(o))throw Error("Tried to set map with object key");i<n.length-1?(t[o]==null&&(t[o]={}),t=t[o]):t[o]=e.value}},ys=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i<r;i++){var o=n[i];if(_e(o))throw Error("Tried to get map with object key");if(t=t[o],t==null)return t}return t},Ti=ze?ze.performance:null,ms=Ti&&Ti.now?function(){return Ti.now()}:function(){return Date.now()},ag=function(){if(ze){if(ze.requestAnimationFrame)return function(e){ze.requestAnimationFrame(e)};if(ze.mozRequestAnimationFrame)return function(e){ze.mozRequestAnimationFrame(e)};if(ze.webkitRequestAnimationFrame)return function(e){ze.webkitRequestAnimationFrame(e)};if(ze.msRequestAnimationFrame)return function(e){ze.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(ms())},1e3/60)}}(),Jr=function(e){return ag(e)},Pt=ms,kn=9261,bs=65599,qn=5381,xs=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kn,n=t,r;r=e.next(),!r.done;)n=n*bs+r.value|0;return n},or=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:kn;return t*bs+e|0},sr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qn;return(t<<5)+t+e|0},og=function(e,t){return e*2097152+t},Bt=function(e){return e[0]*2097152+e[1]},_r=function(e,t){return[or(e[0],t[0]),sr(e[1],t[1])]},sg=function(e,t){var n={value:0,done:!1},r=0,i=e.length,o={next:function(){return r<i?n.value=e[r++]:n.done=!0,n}};return xs(o,t)},un=function(e,t){var n={value:0,done:!1},r=0,i=e.length,o={next:function(){return r<i?n.value=e.charCodeAt(r++):n.done=!0,n}};return xs(o,t)},ws=function(){return lg(arguments)},lg=function(e){for(var t,n=0;n<e.length;n++){var r=e[n];n===0?t=un(r):t=un(r,t)}return t},Ya=!0,ug=console.warn!=null,cg=console.trace!=null,ha=Number.MAX_SAFE_INTEGER||9007199254740991,Es=function(){return!0},ei=function(){return!1},Va=function(){return 0},da=function(){},Be=function(e){throw new Error(e)},_s=function(e){if(e!==void 0)Ya=!!e;else return Ya},Le=function(e){_s()&&(ug?console.warn(e):(console.log(e),cg&&console.trace()))},hg=function(e){return de({},e)},At=function(e){return e==null?e:Se(e)?e.slice():_e(e)?hg(e):e},dg=function(e){return e.slice()},Ts=function(e,t){for(t=e="";e++<36;t+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return t},pg={},Ds=function(){return pg},Ke=function(e){var t=Object.keys(e);return function(n){for(var r={},i=0;i<t.length;i++){var o=t[i],a=n==null?void 0:n[o];r[o]=a===void 0?e[o]:a}return r}},jt=function(e,t,n){for(var r=e.length-1;r>=0;r--)e[r]===t&&e.splice(r,1)},Bi=function(e){e.splice(0,e.length)},gg=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.push(r)}},wt=function(e,t,n){return n&&(t=gs(n,t)),e[t]},Ft=function(e,t,n,r){n&&(t=gs(n,t)),e[t]=r},fg=function(){function e(){sa(this,e),this._obj={}}return la(e,[{key:"set",value:function(t,n){return this._obj[t]=n,this}},{key:"delete",value:function(t){return this._obj[t]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(t){return this._obj[t]!==void 0}},{key:"get",value:function(t){return this._obj[t]}}]),e}(),kt=typeof Map<"u"?Map:fg,vg="undefined",yg=function(){function e(t){if(sa(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return la(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(t){var n=this._obj;n[t]!==1&&(n[t]=1,this.size++)}},{key:"delete",value:function(t){var n=this._obj;n[t]===1&&(n[t]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(t){return this._obj[t]===1}},{key:"toArray",value:function(){var t=this;return Object.keys(this._obj).filter(function(n){return t.has(n)})}},{key:"forEach",value:function(t,n){return this.toArray().forEach(t,n)}}]),e}(),Mn=(typeof Set>"u"?"undefined":Ve(Set))!==vg?Set:yg,fi=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!ua(e)){Be("An element must have a core reference and parameters set");return}var r=t.group;if(r==null&&(t.data&&t.data.source!=null&&t.data.target!=null?r="edges":r="nodes"),r!=="nodes"&&r!=="edges"){Be("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r==="edges":!!t.pannable,active:!1,classes:new Mn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,a=e.pan(),s=e.zoom();i.position={x:(o.x-a.x)/s,y:(o.y-a.y)/s}}var l=[];Se(t.classes)?l=t.classes:le(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;u<c;u++){var h=l[u];!h||h===""||i.classes.add(h)}this.createEmitter();var p=t.style||t.css;p&&(Le("Setting a `style` bypass at element creation should be done only when absolutely necessary.  Try to use the stylesheet instead."),this.style(p)),(n===void 0||n)&&this.restore()},Ua=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,r){var i;_e(t)&&!ht(t)&&(i=t,t=i.roots||i.root,n=i.visit,r=i.directed),r=arguments.length===2&&!Me(n)?n:r,n=Me(n)?n:function(){};for(var o=this._private.cy,a=t=le(t)?this.filter(t):t,s=[],l=[],u={},c={},h={},p=0,d,g=this.byGroup(),v=g.nodes,b=g.edges,f=0;f<a.length;f++){var m=a[f],x=m.id();m.isNode()&&(s.unshift(m),e.bfs&&(h[x]=!0,l.push(m)),c[x]=0)}for(var T=function(){var C=e.bfs?s.shift():s.pop(),A=C.id();if(e.dfs){if(h[A])return"continue";h[A]=!0,l.push(C)}var k=c[A],S=u[A],N=S!=null?S.source():null,P=S!=null?S.target():null,R=S==null?void 0:C.same(N)?P[0]:N[0],I=void 0;if(I=n(C,S,R,p++,k),I===!0)return d=C,"break";if(I===!1)return"break";for(var O=C.connectedEdges().filter(function(F){return(!r||F.source().same(C))&&b.has(F)}),M=0;M<O.length;M++){var G=O[M],B=G.connectedNodes().filter(function(F){return!F.same(C)&&v.has(F)}),V=B.id();B.length!==0&&!h[V]&&(B=B[0],s.push(B),e.bfs&&(h[V]=!0,l.push(B)),u[V]=G,c[V]=c[A]+1)}};s.length!==0;){var _=T();if(_!=="continue"&&_==="break")break}for(var D=o.collection(),y=0;y<l.length;y++){var E=l[y],w=u[E.id()];w!=null&&D.push(w),D.push(E)}return{path:o.collection(D),found:o.collection(d)}}},$n={breadthFirstSearch:Ua({bfs:!0}),depthFirstSearch:Ua({dfs:!0})};$n.bfs=$n.breadthFirstSearch,$n.dfs=$n.depthFirstSearch;var mg=Ke({root:null,weight:function(e){return 1},directed:!1}),bg={dijkstra:function(e){if(!_e(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=mg(e),r=n.root,i=n.weight,o=n.directed,a=this,s=i,l=le(r)?this.filter(r)[0]:r[0],u={},c={},h={},p=this.byGroup(),d=p.nodes,g=p.edges;g.unmergeBy(function(N){return N.isLoop()});for(var v=function(N){return u[N.id()]},b=function(N,P){u[N.id()]=P,f.updateItem(N)},f=new vr.default(function(N,P){return v(N)-v(P)}),m=0;m<d.length;m++){var x=d[m];u[x.id()]=x.same(l)?0:1/0,f.push(x)}for(var T=function(N,P){for(var R=(o?N.edgesTo(P):N.edgesWith(P)).intersect(g),I=1/0,O,M=0;M<R.length;M++){var G=R[M],B=s(G);(B<I||!O)&&(I=B,O=G)}return{edge:O,dist:I}};f.size()>0;){var _=f.pop(),D=v(_),y=_.id();if(h[y]=D,D!==1/0)for(var E=_.neighborhood().intersect(d),w=0;w<E.length;w++){var C=E[w],A=C.id(),k=T(_,C),S=D+k.dist;S<v(C)&&(b(C,S),c[A]={node:_,edge:k.edge})}}return{distanceTo:function(N){var P=le(N)?d.filter(N)[0]:N[0];return h[P.id()]},pathTo:function(N){var P=le(N)?d.filter(N)[0]:N[0],R=[],I=P,O=I.id();if(P.length>0)for(R.unshift(P);c[O];){var M=c[O];R.unshift(M.edge),R.unshift(M.node),I=M.node,O=I.id()}return a.spawn(R)}}}},xg={kruskal:function(e){e=e||function(m){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,o=new Array(i),a=n,s=function(m){for(var x=0;x<o.length;x++){var T=o[x];if(T.has(m))return x}},l=0;l<i;l++)o[l]=this.spawn(n[l]);for(var u=r.sort(function(m,x){return e(m)-e(x)}),c=0;c<u.length;c++){var h=u[c],p=h.source()[0],d=h.target()[0],g=s(p),v=s(d),b=o[g],f=o[v];g!==v&&(a.merge(h),b.merge(f),o.splice(v,1))}return a}},wg=Ke({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Eg={aStar:function(e){var t=this.cy(),n=wg(e),r=n.root,i=n.goal,o=n.heuristic,a=n.directed,s=n.weight;r=t.collection(r)[0],i=t.collection(i)[0];var l=r.id(),u=i.id(),c={},h={},p={},d=new vr.default(function(M,G){return h[M.id()]-h[G.id()]}),g=new Mn,v={},b={},f=function(M,G){d.push(M),g.add(G)},m,x,T=function(){m=d.pop(),x=m.id(),g.delete(x)},_=function(M){return g.has(M)};f(r,l),c[l]=0,h[l]=o(r);for(var D=0;d.size()>0;){if(T(),D++,x===u){for(var y=[],E=i,w=u,C=b[w];y.unshift(E),C!=null&&y.unshift(C),E=v[w],E!=null;)w=E.id(),C=b[w];return{found:!0,distance:c[x],path:this.spawn(y),steps:D}}p[x]=!0;for(var A=m._private.edges,k=0;k<A.length;k++){var S=A[k];if(this.hasElementWithId(S.id())&&!(a&&S.data("source")!==x)){var N=S.source(),P=S.target(),R=N.id()!==x?N:P,I=R.id();if(this.hasElementWithId(I)&&!p[I]){var O=c[x]+s(S);if(!_(I)){c[I]=O,h[I]=O+o(R),f(R,I),v[I]=m,b[I]=S;continue}O<c[I]&&(c[I]=O,h[I]=O+o(R),v[I]=m,b[I]=S)}}}}return{found:!1,distance:void 0,path:void 0,steps:D}}},_g=Ke({weight:function(e){return 1},directed:!1}),Tg={floydWarshall:function(e){for(var t=this.cy(),n=_g(e),r=n.weight,i=n.directed,o=r,a=this.byGroup(),s=a.nodes,l=a.edges,u=s.length,c=u*u,h=function(B){return s.indexOf(B)},p=function(B){return s[B]},d=new Array(c),g=0;g<c;g++){var v=g%u,b=(g-v)/u;b===v?d[g]=0:d[g]=1/0}for(var f=new Array(c),m=new Array(c),x=0;x<l.length;x++){var T=l[x],_=T.source()[0],D=T.target()[0];if(_!==D){var y=h(_),E=h(D),w=y*u+E,C=o(T);if(d[w]>C&&(d[w]=C,f[w]=E,m[w]=T),!i){var A=E*u+y;!i&&d[A]>C&&(d[A]=C,f[A]=y,m[A]=T)}}}for(var k=0;k<u;k++)for(var S=0;S<u;S++)for(var N=S*u+k,P=0;P<u;P++){var R=S*u+P,I=k*u+P;d[N]+d[I]<d[R]&&(d[R]=d[N]+d[I],f[R]=f[N])}var O=function(B){return(le(B)?t.filter(B):B)[0]},M=function(B){return h(O(B))},G={distance:function(B,V){var F=M(B),U=M(V);return d[F*u+U]},path:function(B,V){var F=M(B),U=M(V),Q=p(F);if(F===U)return Q.collection();if(f[F*u+U]==null)return t.collection();var z=t.collection(),q=F,H;for(z.merge(Q);F!==U;)q=F,F=f[F*u+U],H=m[q*u+F],z.merge(H),z.merge(p(F));return z}};return G}},Dg=Ke({weight:function(e){return 1},directed:!1,root:null}),Cg={bellmanFord:function(e){var t=this,n=Dg(e),r=n.weight,i=n.directed,o=n.root,a=r,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,h=u.nodes,p=h.length,d=new kt,g=!1,v=[];o=l.collection(o)[0],c.unmergeBy(function(ne){return ne.isLoop()});for(var b=c.length,f=function(ne){var ce=d.get(ne.id());return ce||(ce={},d.set(ne.id(),ce)),ce},m=function(ne){return(le(ne)?l.$(ne):ne)[0]},x=function(ne){return f(m(ne)).dist},T=function(ne){for(var ce=arguments.length>1&&arguments[1]!==void 0?arguments[1]:o,he=m(ne),fe=[],me=he;;){if(me==null)return t.spawn();var be=f(me),we=be.edge,ae=be.pred;if(fe.unshift(me[0]),me.same(ce)&&fe.length>0)break;we!=null&&fe.unshift(we),me=ae}return s.spawn(fe)},_=0;_<p;_++){var D=h[_],y=f(D);D.same(o)?y.dist=0:y.dist=1/0,y.pred=null,y.edge=null}for(var E=!1,w=function(ne,ce,he,fe,me,be){var we=fe.dist+be;we<me.dist&&!he.same(fe.edge)&&(me.dist=we,me.pred=ne,me.edge=he,E=!0)},C=1;C<p;C++){E=!1;for(var A=0;A<b;A++){var k=c[A],S=k.source(),N=k.target(),P=a(k),R=f(S),I=f(N);w(S,N,k,R,I,P),i||w(N,S,k,I,R,P)}if(!E)break}if(E)for(var O=[],M=0;M<b;M++){var G=c[M],B=G.source(),V=G.target(),F=a(G),U=f(B).dist,Q=f(V).dist;if(U+F<Q||!i&&Q+F<U)if(g||(Le("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var z=[];U+F<Q&&z.push(B),!i&&Q+F<U&&z.push(V);for(var q=z.length,H=0;H<q;H++){var $=z[H],Z=[$];Z.push(f($).edge);for(var te=f($).pred;Z.indexOf(te)===-1;)Z.push(te),Z.push(f(te).edge),te=f(te).pred;Z=Z.slice(Z.indexOf(te));for(var pe=Z[0].id(),ue=0,J=2;J<Z.length;J+=2)Z[J].id()<pe&&(pe=Z[J].id(),ue=J);Z=Z.slice(ue).concat(Z.slice(0,ue)),Z.push(Z[0]);var oe=Z.map(function(ne){return ne.id()}).join(",");O.indexOf(oe)===-1&&(v.push(s.spawn(Z)),O.push(oe))}}else break}return{distanceTo:x,pathTo:T,hasNegativeWeightCycle:g,negativeWeightCycles:v}}},Ag=Math.sqrt(2),kg=function(e,t,n){n.length===0&&Be("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],o=r[2],a=t[i],s=t[o],l=n,u=l.length-1;u>=0;u--){var c=l[u],h=c[1],p=c[2];(t[h]===a&&t[p]===s||t[h]===s&&t[p]===a)&&l.splice(u,1)}for(var d=0;d<l.length;d++){var g=l[d];g[1]===s?(l[d]=g.slice(),l[d][1]=a):g[2]===s&&(l[d]=g.slice(),l[d][2]=a)}for(var v=0;v<t.length;v++)t[v]===s&&(t[v]=a);return l},Di=function(e,t,n,r){for(;n>r;){var i=Math.floor(Math.random()*t.length);t=kg(i,e,t),n--}return t},Lg={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(I){return I.isLoop()});var i=n.length,o=r.length,a=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Ag);if(i<2){Be("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],u=0;u<o;u++){var c=r[u];l.push([u,n.indexOf(c.source()),n.indexOf(c.target())])}for(var h=1/0,p=[],d=new Array(i),g=new Array(i),v=new Array(i),b=function(I,O){for(var M=0;M<i;M++)O[M]=I[M]},f=0;f<=a;f++){for(var m=0;m<i;m++)g[m]=m;var x=Di(g,l.slice(),i,s),T=x.slice();b(g,v);var _=Di(g,x,s,2),D=Di(v,T,s,2);_.length<=D.length&&_.length<h?(h=_.length,p=_,b(g,d)):D.length<=_.length&&D.length<h&&(h=D.length,p=D,b(v,d))}for(var y=this.spawn(p.map(function(I){return r[I[0]]})),E=this.spawn(),w=this.spawn(),C=d[0],A=0;A<d.length;A++){var k=d[A],S=n[A];k===C?E.merge(S):w.merge(S)}var N=function(I){var O=e.spawn();return I.forEach(function(M){O.merge(M),M.connectedEdges().forEach(function(G){e.contains(G)&&!y.contains(G)&&O.merge(G)})}),O},P=[N(E),N(w)],R={cut:y,components:P,partition1:E,partition2:w};return R}},Ng=function(e){return{x:e.x,y:e.y}},vi=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},Cs=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},Ln=function(e){return{x:e[0],y:e[1]}},Sg=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(r=Math.min(o,r))}return r},Ig=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,i=t;i<n;i++){var o=e[i];isFinite(o)&&(r=Math.max(o,r))}return r},Pg=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,i=0,o=t;o<n;o++){var a=e[o];isFinite(a)&&(r+=a,i++)}return r/i},Og=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var a=0,s=e.length-1;s>=0;s--){var l=e[s];o?isFinite(l)||(e[s]=-1/0,a++):e.splice(s,1)}i&&e.sort(function(h,p){return h-p});var u=e.length,c=Math.floor(u/2);return u%2!==0?e[c+1+a]:(e[c-1+a]+e[c+a])/2},Mg=function(e){return Math.PI*e/180},Tr=function(e,t){return Math.atan2(t,e)-Math.PI/2},pa=Math.log2||function(e){return Math.log(e)/Math.log(2)},Xa=function(e){return e>0?1:e<0?-1:0},cn=function(e,t){return Math.sqrt(nn(e,t))},nn=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Rg=function(e){for(var t=e.length,n=0,r=0;r<t;r++)n+=e[r];for(var i=0;i<t;i++)e[i]=e[i]/n;return e},Ue=function(e,t,n,r){return(1-r)*(1-r)*e+2*(1-r)*r*t+r*r*n},In=function(e,t,n,r){return{x:Ue(e.x,t.x,n.x,r),y:Ue(e.y,t.y,n.y,r)}},Bg=function(e,t,n,r){var i={x:t.x-e.x,y:t.y-e.y},o=cn(e,t),a={x:i.x/o,y:i.y/o};return n=n!=null?n:0,r=r!=null?r:n*o,{x:e.x+a.x*r,y:e.y+a.y*r}},lr=function(e,t,n){return Math.max(e,Math.min(n,t))},ut=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Fg=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},zg=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Gg=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},As=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Yg=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Br=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Fr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,i,o;if(t.length===1)n=r=i=o=t[0];else if(t.length===2)n=i=t[0],o=r=t[1];else if(t.length===4){var a=xt(t,4);n=a[0],r=a[1],i=a[2],o=a[3]}return e.x1-=o,e.x2+=r,e.y1-=n,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ja=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ga=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2<t.x1||t.x2<e.x1||e.y2<t.y1||t.y2<e.y1||e.y1>t.y2||t.y1>e.y2)},Pn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Vg=function(e,t){return Pn(e,t.x,t.y)},ks=function(e,t){return Pn(e,t.x1,t.y1)&&Pn(e,t.x2,t.y2)},Ha=function(e,t,n,r,i,o,a){var s=ur(i,o),l=i/2,u=o/2,c;{var h=n-l+s-a,p=r-u-a,d=n+l-s+a,g=p;if(c=Ht(e,t,n,r,h,p,d,g,!1),c.length>0)return c}{var v=n+l+a,b=r-u+s-a,f=v,m=r+u-s+a;if(c=Ht(e,t,n,r,v,b,f,m,!1),c.length>0)return c}{var x=n-l+s-a,T=r+u+a,_=n+l-s+a,D=T;if(c=Ht(e,t,n,r,x,T,_,D,!1),c.length>0)return c}{var y=n-l-a,E=r-u+s-a,w=y,C=r+u-s+a;if(c=Ht(e,t,n,r,y,E,w,C,!1),c.length>0)return c}var A;{var k=n-l+s,S=r-u+s;if(A=Kn(e,t,n,r,k,S,s+a),A.length>0&&A[0]<=k&&A[1]<=S)return[A[0],A[1]]}{var N=n+l-s,P=r-u+s;if(A=Kn(e,t,n,r,N,P,s+a),A.length>0&&A[0]>=N&&A[1]<=P)return[A[0],A[1]]}{var R=n+l-s,I=r+u-s;if(A=Kn(e,t,n,r,R,I,s+a),A.length>0&&A[0]>=R&&A[1]>=I)return[A[0],A[1]]}{var O=n-l+s,M=r+u-s;if(A=Kn(e,t,n,r,O,M,s+a),A.length>0&&A[0]<=O&&A[1]>=M)return[A[0],A[1]]}return[]},Ug=function(e,t,n,r,i,o,a){var s=a,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,o),h=Math.max(r,o);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},Xg=function(e,t,n,r,i,o,a,s,l){var u={x1:Math.min(n,a,i)-l,x2:Math.max(n,a,i)+l,y1:Math.min(r,s,o)-l,y2:Math.max(r,s,o)+l};return!(e<u.x1||e>u.x2||t<u.y1||t>u.y2)},jg=function(e,t,n,r){n-=r;var i=t*t-4*e*n;if(i<0)return[];var o=Math.sqrt(i),a=2*e,s=(-t+o)/a,l=(-t-o)/a;return[s,l]},Hg=function(e,t,n,r,i){var o=1e-5;e===0&&(e=o),t/=e,n/=e,r/=e;var a,s,l,u,c,h,p,d;if(s=(3*n-t*t)/9,l=-(27*r)+t*(9*n-2*(t*t)),l/=54,a=s*s*s+l*l,i[1]=0,p=t/3,a>0){c=l+Math.sqrt(a),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),h=l-Math.sqrt(a),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-p+c+h,p+=(c+h)/2,i[4]=i[2]=-p,p=Math.sqrt(3)*(-h+c)/2,i[3]=p,i[5]=-p;return}if(i[5]=i[3]=0,a===0){d=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-p+2*d,i[4]=i[2]=-(d+p);return}s=-s,u=s*s*s,u=Math.acos(l/Math.sqrt(u)),d=2*Math.sqrt(s),i[0]=-p+d*Math.cos(u/3),i[2]=-p+d*Math.cos((u+2*Math.PI)/3),i[4]=-p+d*Math.cos((u+4*Math.PI)/3)},Wg=function(e,t,n,r,i,o,a,s){var l=1*n*n-4*n*i+2*n*a+4*i*i-4*i*a+a*a+r*r-4*r*o+2*r*s+4*o*o-4*o*s+s*s,u=1*9*n*i-3*n*n-3*n*a-6*i*i+3*i*a+9*r*o-3*r*r-3*r*s-6*o*o+3*o*s,c=1*3*n*n-6*n*i+n*a-n*e+2*i*i+2*i*e-a*e+3*r*r-6*r*o+r*s-r*t+2*o*o+2*o*t-s*t,h=1*n*i-n*n+n*e-i*e+r*o-r*r+r*t-o*t,p=[];Hg(l,u,c,h,p);for(var d=1e-7,g=[],v=0;v<6;v+=2)Math.abs(p[v+1])<d&&p[v]>=0&&p[v]<=1&&g.push(p[v]);g.push(1),g.push(0);for(var b=-1,f,m,x,T=0;T<g.length;T++)f=Math.pow(1-g[T],2)*n+2*(1-g[T])*g[T]*i+g[T]*g[T]*a,m=Math.pow(1-g[T],2)*r+2*(1-g[T])*g[T]*o+g[T]*g[T]*s,x=Math.pow(f-e,2)+Math.pow(m-t,2),b>=0?x<b&&(b=x):b=x;return b},qg=function(e,t,n,r,i,o){var a=[e-n,t-r],s=[i-n,o-r],l=s[0]*s[0]+s[1]*s[1],u=a[0]*a[0]+a[1]*a[1],c=a[0]*s[0]+a[1]*s[1],h=c*c/l;return c<0?u:h>l?(e-i)*(e-i)+(t-o)*(t-o):u-h},lt=function(e,t,n){for(var r,i,o,a,s,l=0,u=0;u<n.length/2;u++)if(r=n[u*2],i=n[u*2+1],u+1<n.length/2?(o=n[(u+1)*2],a=n[(u+1)*2+1]):(o=n[(u+1-n.length/2)*2],a=n[(u+1-n.length/2)*2+1]),!(r==e&&o==e))if(r>=e&&e>=o||r<=e&&e<=o)s=(e-r)/(o-r)*(a-i)+i,s>t&&l++;else continue;return l%2!==0},Lt=function(e,t,n,r,i,o,a,s,l){var u=new Array(n.length),c;s[0]!=null?(c=Math.atan(s[1]/s[0]),s[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=s;for(var h=Math.cos(-c),p=Math.sin(-c),d=0;d<u.length/2;d++)u[d*2]=o/2*(n[d*2]*h-n[d*2+1]*p),u[d*2+1]=a/2*(n[d*2+1]*h+n[d*2]*p),u[d*2]+=r,u[d*2+1]+=i;var g;if(l>0){var v=ni(u,-l);g=ti(v)}else g=u;return lt(e,t,g)},$g=function(e,t,n,r,i,o,a){for(var s=new Array(n.length),l=o/2,u=a/2,c=fa(o,a),h=c*c,p=0;p<n.length/4;p++){var d=void 0,g=void 0;p===0?d=n.length-2:d=p*4-2,g=p*4+2;var v=r+l*n[p*4],b=i+u*n[p*4+1],f=-n[d]*n[g]-n[d+1]*n[g+1],m=c/Math.tan(Math.acos(f)/2),x=v-m*n[d],T=b-m*n[d+1],_=v+m*n[g],D=b+m*n[g+1];s[p*4]=x,s[p*4+1]=T,s[p*4+2]=_,s[p*4+3]=D;var y=n[d+1],E=-n[d],w=y*n[g]+E*n[g+1];w<0&&(y*=-1,E*=-1);var C=x+y*c,A=T+E*c,k=Math.pow(C-e,2)+Math.pow(A-t,2);if(k<=h)return!0}return lt(e,t,s)},ti=function(e){for(var t=new Array(e.length/2),n,r,i,o,a,s,l,u,c=0;c<e.length/4;c++){n=e[c*4],r=e[c*4+1],i=e[c*4+2],o=e[c*4+3],c<e.length/4-1?(a=e[(c+1)*4],s=e[(c+1)*4+1],l=e[(c+1)*4+2],u=e[(c+1)*4+3]):(a=e[0],s=e[1],l=e[2],u=e[3]);var h=Ht(n,r,i,o,a,s,l,u,!0);t[c*2]=h[0],t[c*2+1]=h[1]}return t},ni=function(e,t){for(var n=new Array(e.length*2),r,i,o,a,s=0;s<e.length/2;s++){r=e[s*2],i=e[s*2+1],s<e.length/2-1?(o=e[(s+1)*2],a=e[(s+1)*2+1]):(o=e[0],a=e[1]);var l=a-i,u=-(o-r),c=Math.sqrt(l*l+u*u),h=l/c,p=u/c;n[s*4]=r+h*t,n[s*4+1]=i+p*t,n[s*4+2]=o+h*t,n[s*4+3]=a+p*t}return n},Kg=function(e,t,n,r,i,o){var a=n-e,s=r-t;a/=i,s/=o;var l=Math.sqrt(a*a+s*s),u=l-1;if(u<0)return[];var c=u/l;return[(n-e)*c+e,(r-t)*c+t]},Jt=function(e,t,n,r,i,o,a){return e-=i,t-=o,e/=n/2+a,t/=r/2+a,e*e+t*t<=1},Kn=function(e,t,n,r,i,o,a){var s=[n-e,r-t],l=[e-i,t-o],u=s[0]*s[0]+s[1]*s[1],c=2*(l[0]*s[0]+l[1]*s[1]),h=l[0]*l[0]+l[1]*l[1]-a*a,p=c*c-4*u*h;if(p<0)return[];var d=(-c+Math.sqrt(p))/(2*u),g=(-c-Math.sqrt(p))/(2*u),v=Math.min(d,g),b=Math.max(d,g),f=[];if(v>=0&&v<=1&&f.push(v),b>=0&&b<=1&&f.push(b),f.length===0)return[];var m=f[0]*s[0]+e,x=f[0]*s[1]+t;if(f.length>1){if(f[0]==f[1])return[m,x];var T=f[1]*s[0]+e,_=f[1]*s[1]+t;return[m,x,T,_]}else return[m,x]},Ci=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Ht=function(e,t,n,r,i,o,a,s,l){var u=e-i,c=n-e,h=a-i,p=t-o,d=r-t,g=s-o,v=h*p-g*u,b=c*p-d*u,f=g*c-h*d;if(f!==0){var m=v/f,x=b/f,T=.001,_=0-T,D=1+T;return _<=m&&m<=D&&_<=x&&x<=D?[e+m*c,t+m*d]:l?[e+m*c,t+m*d]:[]}else return v===0||b===0?Ci(e,n,a)===a?[a,s]:Ci(e,n,i)===i?[i,o]:Ci(i,a,n)===n?[n,r]:[]:[]},nr=function(e,t,n,r,i,o,a,s){var l=[],u,c=new Array(n.length),h=!0;o==null&&(h=!1);var p;if(h){for(var d=0;d<c.length/2;d++)c[d*2]=n[d*2]*o+r,c[d*2+1]=n[d*2+1]*a+i;if(s>0){var g=ni(c,-s);p=ti(g)}else p=c}else p=n;for(var v,b,f,m,x=0;x<p.length/2;x++)v=p[x*2],b=p[x*2+1],x<p.length/2-1?(f=p[(x+1)*2],m=p[(x+1)*2+1]):(f=p[0],m=p[1]),u=Ht(e,t,r,i,v,b,f,m),u.length!==0&&l.push(u[0],u[1]);return l},Zg=function(e,t,n,r,i,o,a,s){for(var l=[],u,c=new Array(n.length),h=o/2,p=a/2,d=fa(o,a),g=0;g<n.length/4;g++){var v=void 0,b=void 0;g===0?v=n.length-2:v=g*4-2,b=g*4+2;var f=r+h*n[g*4],m=i+p*n[g*4+1],x=-n[v]*n[b]-n[v+1]*n[b+1],T=d/Math.tan(Math.acos(x)/2),_=f-T*n[v],D=m-T*n[v+1],y=f+T*n[b],E=m+T*n[b+1];g===0?(c[n.length-2]=_,c[n.length-1]=D):(c[g*4-2]=_,c[g*4-1]=D),c[g*4]=y,c[g*4+1]=E;var w=n[v+1],C=-n[v],A=w*n[b]+C*n[b+1];A<0&&(w*=-1,C*=-1);var k=_+w*d,S=D+C*d;u=Kn(e,t,r,i,k,S,d),u.length!==0&&l.push(u[0],u[1])}for(var N=0;N<c.length/4;N++)u=Ht(e,t,r,i,c[N*4],c[N*4+1],c[N*4+2],c[N*4+3],!1),u.length!==0&&l.push(u[0],u[1]);if(l.length>2){for(var P=[l[0],l[1]],R=Math.pow(P[0]-e,2)+Math.pow(P[1]-t,2),I=1;I<l.length/2;I++){var O=Math.pow(l[I*2]-e,2)+Math.pow(l[I*2+1]-t,2);O<=R&&(P[0]=l[I*2],P[1]=l[I*2+1],R=O)}return P}return l},Dr=function(e,t,n){var r=[e[0]-t[0],e[1]-t[1]],i=Math.sqrt(r[0]*r[0]+r[1]*r[1]),o=(i-n)/i;return o<0&&(o=1e-5),[t[0]+o*r[0],t[1]+o*r[1]]},it=function(e,t){var n=Fi(e,t);return n=Ls(n),n},Ls=function(e){for(var t,n,r=e.length/2,i=1/0,o=1/0,a=-1/0,s=-1/0,l=0;l<r;l++)t=e[2*l],n=e[2*l+1],i=Math.min(i,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n);for(var u=2/(a-i),c=2/(s-o),h=0;h<r;h++)t=e[2*h]=e[2*h]*u,n=e[2*h+1]=e[2*h+1]*c,i=Math.min(i,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n);if(o<-1)for(var p=0;p<r;p++)n=e[2*p+1]=e[2*p+1]+(-1-o);return e},Fi=function(e,t){var n=1/e*2*Math.PI,r=e%2===0?Math.PI/2+n/2:Math.PI/2;r+=t;for(var i=new Array(e*2),o,a=0;a<e;a++)o=a*n+r,i[2*a]=Math.cos(o),i[2*a+1]=Math.sin(-o);return i},ur=function(e,t){return Math.min(e/4,t/4,8)},fa=function(e,t){return Math.min(e/10,t/10,8)},Ns=function(){return 8},Qg=function(e,t,n){return[e-2*t+n,2*(t-e),e]},zi=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Jg=Ke({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),ef={pageRank:function(e){for(var t=Jg(e),n=t.dampingFactor,r=t.precision,i=t.iterations,o=t.weight,a=this._private.cy,s=this.byGroup(),l=s.nodes,u=s.edges,c=l.length,h=c*c,p=u.length,d=new Array(h),g=new Array(c),v=(1-n)/c,b=0;b<c;b++){for(var f=0;f<c;f++){var m=b*c+f;d[m]=0}g[b]=0}for(var x=0;x<p;x++){var T=u[x],_=T.data("source"),D=T.data("target");if(_!==D){var y=l.indexOfId(_),E=l.indexOfId(D),w=o(T),C=E*c+y;d[C]+=w,g[y]+=w}}for(var A=1/c+v,k=0;k<c;k++)if(g[k]===0)for(var S=0;S<c;S++){var N=S*c+k;d[N]=A}else for(var P=0;P<c;P++){var R=P*c+k;d[R]=d[R]/g[k]+v}for(var I=new Array(c),O=new Array(c),M,G=0;G<c;G++)I[G]=1;for(var B=0;B<i;B++){for(var V=0;V<c;V++)O[V]=0;for(var F=0;F<c;F++)for(var U=0;U<c;U++){var Q=F*c+U;O[F]+=d[Q]*I[U]}Rg(O),M=I,I=O,O=M;for(var z=0,q=0;q<c;q++){var H=M[q]-I[q];z+=H*H}if(z<r)break}var $={rank:function(Z){return Z=a.collection(Z)[0],I[l.indexOf(Z)]}};return $}},Wa=Ke({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Tn={degreeCentralityNormalized:function(e){e=Wa(e);var t=this.cy(),n=this.nodes(),r=n.length;if(e.directed){for(var i={},o={},a=0,s=0,l=0;l<r;l++){var u=n[l],c=u.id();e.root=u;var h=this.degreeCentrality(e);a<h.indegree&&(a=h.indegree),s<h.outdegree&&(s=h.outdegree),i[c]=h.indegree,o[c]=h.outdegree}return{indegree:function(f){return a==0?0:(le(f)&&(f=t.filter(f)),i[f.id()]/a)},outdegree:function(f){return s===0?0:(le(f)&&(f=t.filter(f)),o[f.id()]/s)}}}else{for(var p={},d=0,g=0;g<r;g++){var v=n[g];e.root=v;var b=this.degreeCentrality(e);d<b.degree&&(d=b.degree),p[v.id()]=b.degree}return{degree:function(f){return d===0?0:(le(f)&&(f=t.filter(f)),p[f.id()]/d)}}}},degreeCentrality:function(e){e=Wa(e);var t=this.cy(),n=this,r=e,i=r.root,o=r.weight,a=r.directed,s=r.alpha;if(i=t.collection(i)[0],a){for(var l=i.connectedEdges(),u=l.filter(function(_){return _.target().same(i)&&n.has(_)}),c=l.filter(function(_){return _.source().same(i)&&n.has(_)}),h=u.length,p=c.length,d=0,g=0,v=0;v<u.length;v++)d+=o(u[v]);for(var b=0;b<c.length;b++)g+=o(c[b]);return{indegree:Math.pow(h,1-s)*Math.pow(d,s),outdegree:Math.pow(p,1-s)*Math.pow(g,s)}}else{for(var f=i.connectedEdges().intersection(n),m=f.length,x=0,T=0;T<f.length;T++)x+=o(f[T]);return{degree:Math.pow(m,1-s)*Math.pow(x,s)}}}};Tn.dc=Tn.degreeCentrality,Tn.dcn=Tn.degreeCentralityNormalised=Tn.degreeCentralityNormalized;var qa=Ke({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Dn={closenessCentralityNormalized:function(e){for(var t=qa(e),n=t.harmonic,r=t.weight,i=t.directed,o=this.cy(),a={},s=0,l=this.nodes(),u=this.floydWarshall({weight:r,directed:i}),c=0;c<l.length;c++){for(var h=0,p=l[c],d=0;d<l.length;d++)if(c!==d){var g=u.distance(p,l[d]);n?h+=1/g:h+=g}n||(h=1/h),s<h&&(s=h),a[p.id()]=h}return{closeness:function(v){return s==0?0:(le(v)?v=o.filter(v)[0].id():v=v.id(),a[v]/s)}}},closenessCentrality:function(e){var t=qa(e),n=t.root,r=t.weight,i=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var a=this.dijkstra({root:n,weight:r,directed:i}),s=0,l=this.nodes(),u=0;u<l.length;u++){var c=l[u];if(!c.same(n)){var h=a.distanceTo(c);o?s+=1/h:s+=h}}return o?s:1/s}};Dn.cc=Dn.closenessCentrality,Dn.ccn=Dn.closenessCentralityNormalised=Dn.closenessCentralityNormalized;var tf=Ke({weight:null,directed:!1}),Gi={betweennessCentrality:function(e){for(var t=tf(e),n=t.directed,r=t.weight,i=r!=null,o=this.cy(),a=this.nodes(),s={},l={},u=0,c={set:function(f,m){l[f]=m,m>u&&(u=m)},get:function(f){return l[f]}},h=0;h<a.length;h++){var p=a[h],d=p.id();n?s[d]=p.outgoers().nodes():s[d]=p.openNeighborhood().nodes(),c.set(d,0)}for(var g=function(f){for(var m=a[f].id(),x=[],T={},_={},D={},y=new vr.default(function(F,U){return D[F]-D[U]}),E=0;E<a.length;E++){var w=a[E].id();T[w]=[],_[w]=0,D[w]=1/0}for(_[m]=1,D[m]=0,y.push(m);!y.empty();){var C=y.pop();if(x.push(C),i)for(var A=0;A<s[C].length;A++){var k=s[C][A],S=o.getElementById(C),N=void 0;S.edgesTo(k).length>0?N=S.edgesTo(k)[0]:N=k.edgesTo(S)[0];var P=r(N);k=k.id(),D[k]>D[C]+P&&(D[k]=D[C]+P,y.nodes.indexOf(k)<0?y.push(k):y.updateItem(k),_[k]=0,T[k]=[]),D[k]==D[C]+P&&(_[k]=_[k]+_[C],T[k].push(C))}else for(var R=0;R<s[C].length;R++){var I=s[C][R].id();D[I]==1/0&&(y.push(I),D[I]=D[C]+1),D[I]==D[C]+1&&(_[I]=_[I]+_[C],T[I].push(C))}}for(var O={},M=0;M<a.length;M++)O[a[M].id()]=0;for(;x.length>0;){for(var G=x.pop(),B=0;B<T[G].length;B++){var V=T[G][B];O[V]=O[V]+_[V]/_[G]*(1+O[G])}G!=a[f].id()&&c.set(G,c.get(G)+O[G])}},v=0;v<a.length;v++)g(v);var b={betweenness:function(f){var m=o.collection(f).id();return c.get(m)},betweennessNormalized:function(f){if(u==0)return 0;var m=o.collection(f).id();return c.get(m)/u}};return b.betweennessNormalised=b.betweennessNormalized,b}};Gi.bc=Gi.betweennessCentrality;var nf=Ke({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),rf=function(e){return nf(e)},af=function(e,t){for(var n=0,r=0;r<t.length;r++)n+=t[r](e);return n},of=function(e,t,n){for(var r=0;r<t;r++)e[r*t+r]=n},Ss=function(e,t){for(var n,r=0;r<t;r++){n=0;for(var i=0;i<t;i++)n+=e[i*t+r];for(var o=0;o<t;o++)e[o*t+r]=e[o*t+r]/n}},sf=function(e,t,n){for(var r=new Array(n*n),i=0;i<n;i++){for(var o=0;o<n;o++)r[i*n+o]=0;for(var a=0;a<n;a++)for(var s=0;s<n;s++)r[i*n+s]+=e[i*n+a]*t[a*n+s]}return r},lf=function(e,t,n){for(var r=e.slice(0),i=1;i<n;i++)e=sf(e,r,t);return e},uf=function(e,t,n){for(var r=new Array(t*t),i=0;i<t*t;i++)r[i]=Math.pow(e[i],n);return Ss(r,t),r},cf=function(e,t,n,r){for(var i=0;i<n;i++){var o=Math.round(e[i]*Math.pow(10,r))/Math.pow(10,r),a=Math.round(t[i]*Math.pow(10,r))/Math.pow(10,r);if(o!==a)return!1}return!0},hf=function(e,t,n,r){for(var i=[],o=0;o<t;o++){for(var a=[],s=0;s<t;s++)Math.round(e[o*t+s]*1e3)/1e3>0&&a.push(n[s]);a.length!==0&&i.push(r.collection(a))}return i},df=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},pf=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&df(e[t],e[n])&&e.splice(n,1);return e},$a=function(e){for(var t=this.nodes(),n=this.edges(),r=this.cy(),i=rf(e),o={},a=0;a<t.length;a++)o[t[a].id()]=a;for(var s=t.length,l=s*s,u=new Array(l),c,h=0;h<l;h++)u[h]=0;for(var p=0;p<n.length;p++){var d=n[p],g=o[d.source().id()],v=o[d.target().id()],b=af(d,i.attributes);u[g*s+v]+=b,u[v*s+g]+=b}of(u,s,i.multFactor),Ss(u,s);for(var f=!0,m=0;f&&m<i.maxIterations;)f=!1,c=lf(u,s,i.expandFactor),u=uf(c,s,i.inflateFactor),cf(u,c,l,4)||(f=!0),m++;var x=hf(u,s,t,r);return x=pf(x),x},gf={markovClustering:$a,mcl:$a},ff=function(e){return e},Is=function(e,t){return Math.abs(t-e)},Ka=function(e,t,n){return e+Is(t,n)},Za=function(e,t,n){return e+Math.pow(n-t,2)},vf=function(e){return Math.sqrt(e)},yf=function(e,t,n){return Math.max(e,Is(t,n))},Yn=function(e,t,n,r,i){for(var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:ff,a=r,s,l,u=0;u<e;u++)s=t(u),l=n(u),a=i(a,s,l);return o(a)},Nn={euclidean:function(e,t,n){return e>=2?Yn(e,t,n,0,Za,vf):Yn(e,t,n,0,Ka)},squaredEuclidean:function(e,t,n){return Yn(e,t,n,0,Za)},manhattan:function(e,t,n){return Yn(e,t,n,0,Ka)},max:function(e,t,n){return Yn(e,t,n,-1/0,yf)}};Nn["squared-euclidean"]=Nn.squaredEuclidean,Nn.squaredeuclidean=Nn.squaredEuclidean;function yi(e,t,n,r,i,o){var a;return Me(e)?a=e:a=Nn[e]||Nn.euclidean,t===0&&Me(e)?a(i,o):a(t,n,r,i,o)}var mf=Ke({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),va=function(e){return mf(e)},ri=function(e,t,n,r,i){var o=i!=="kMedoids",a=o?function(c){return n[c]}:function(c){return r[c](n)},s=function(c){return r[c](t)},l=n,u=t;return yi(e,r.length,a,s,l,u)},Ai=function(e,t,n){for(var r=n.length,i=new Array(r),o=new Array(r),a=new Array(t),s=null,l=0;l<r;l++)i[l]=e.min(n[l]).value,o[l]=e.max(n[l]).value;for(var u=0;u<t;u++){s=[];for(var c=0;c<r;c++)s[c]=Math.random()*(o[c]-i[c])+i[c];a[u]=s}return a},Ps=function(e,t,n,r,i){for(var o=1/0,a=0,s=0;s<t.length;s++){var l=ri(n,e,t[s],r,i);l<o&&(o=l,a=s)}return a},Os=function(e,t,n){for(var r=[],i=null,o=0;o<t.length;o++)i=t[o],n[i.id()]===e&&r.push(i);return r},bf=function(e,t,n){return Math.abs(t-e)<=n},xf=function(e,t,n){for(var r=0;r<e.length;r++)for(var i=0;i<e[r].length;i++){var o=Math.abs(e[r][i]-t[r][i]);if(o>n)return!1}return!0},wf=function(e,t,n){for(var r=0;r<n;r++)if(e===t[r])return!0;return!1},Qa=function(e,t){var n=new Array(t);if(e.length<50)for(var r=0;r<t;r++){for(var i=e[Math.floor(Math.random()*e.length)];wf(i,n,r);)i=e[Math.floor(Math.random()*e.length)];n[r]=i}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},Ja=function(e,t,n){for(var r=0,i=0;i<t.length;i++)r+=ri("manhattan",t[i],e,n,"kMedoids");return r},Ef=function(e){var t=this.cy(),n=this.nodes(),r=null,i=va(e),o=new Array(i.k),a={},s;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,s=Ai(n,i.k,i.attributes)):Ve(i.testCentroids)==="object"?s=i.testCentroids:s=Ai(n,i.k,i.attributes):s=Ai(n,i.k,i.attributes);for(var l=!0,u=0;l&&u<i.maxIterations;){for(var c=0;c<n.length;c++)r=n[c],a[r.id()]=Ps(r,s,i.distance,i.attributes,"kMeans");l=!1;for(var h=0;h<i.k;h++){var p=Os(h,n,a);if(p.length!==0){for(var d=i.attributes.length,g=s[h],v=new Array(d),b=new Array(d),f=0;f<d;f++){b[f]=0;for(var m=0;m<p.length;m++)r=p[m],b[f]+=i.attributes[f](r);v[f]=b[f]/p.length,bf(v[f],g[f],i.sensitivityThreshold)||(l=!0)}s[h]=v,o[h]=t.collection(p)}}u++}return o},_f=function(e){var t=this.cy(),n=this.nodes(),r=null,i=va(e),o=new Array(i.k),a,s={},l,u=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(Ve(i.testCentroids)==="object"?a=i.testCentroids:a=Qa(n,i.k)):a=Qa(n,i.k);for(var c=!0,h=0;c&&h<i.maxIterations;){for(var p=0;p<n.length;p++)r=n[p],s[r.id()]=Ps(r,a,i.distance,i.attributes,"kMedoids");c=!1;for(var d=0;d<a.length;d++){var g=Os(d,n,s);if(g.length!==0){u[d]=Ja(a[d],g,i.attributes);for(var v=0;v<g.length;v++)l=Ja(g[v],g,i.attributes),l<u[d]&&(u[d]=l,a[d]=g[v],c=!0);o[d]=t.collection(g)}}h++}return o},Tf=function(e,t,n,r,i){for(var o,a,s=0;s<t.length;s++)for(var l=0;l<e.length;l++)r[s][l]=Math.pow(n[s][l],i.m);for(var u=0;u<e.length;u++)for(var c=0;c<i.attributes.length;c++){o=0,a=0;for(var h=0;h<t.length;h++)o+=r[h][u]*i.attributes[c](t[h]),a+=r[h][u];e[u][c]=o/a}},Df=function(e,t,n,r,i){for(var o=0;o<e.length;o++)t[o]=e[o].slice();for(var a,s,l,u=2/(i.m-1),c=0;c<n.length;c++)for(var h=0;h<r.length;h++){a=0;for(var p=0;p<n.length;p++)s=ri(i.distance,r[h],n[c],i.attributes,"cmeans"),l=ri(i.distance,r[h],n[p],i.attributes,"cmeans"),a+=Math.pow(s/l,u);e[h][c]=1/a}},Cf=function(e,t,n,r){for(var i=new Array(n.k),o=0;o<i.length;o++)i[o]=[];for(var a,s,l=0;l<t.length;l++){a=-1/0,s=-1;for(var u=0;u<t[0].length;u++)t[l][u]>a&&(a=t[l][u],s=u);i[s].push(e[l])}for(var c=0;c<i.length;c++)i[c]=r.collection(i[c]);return i},eo=function(e){var t=this.cy(),n=this.nodes(),r=va(e),i,o,a,s,l;s=new Array(n.length);for(var u=0;u<n.length;u++)s[u]=new Array(r.k);a=new Array(n.length);for(var c=0;c<n.length;c++)a[c]=new Array(r.k);for(var h=0;h<n.length;h++){for(var p=0,d=0;d<r.k;d++)a[h][d]=Math.random(),p+=a[h][d];for(var g=0;g<r.k;g++)a[h][g]=a[h][g]/p}o=new Array(r.k);for(var v=0;v<r.k;v++)o[v]=new Array(r.attributes.length);l=new Array(n.length);for(var b=0;b<n.length;b++)l[b]=new Array(r.k);for(var f=!0,m=0;f&&m<r.maxIterations;)f=!1,Tf(o,n,a,l,r),Df(a,s,o,n,r),xf(a,s,r.sensitivityThreshold)||(f=!0),m++;return i=Cf(n,a,r,t),{clusters:i,degreeOfMembership:a}},Af={kMeans:Ef,kMedoids:_f,fuzzyCMeans:eo,fcm:eo},kf=Ke({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),Lf={single:"min",complete:"max"},Nf=function(e){var t=kf(e),n=Lf[t.linkage];return n!=null&&(t.linkage=n),t},to=function(e,t,n,r,i){for(var o=0,a=1/0,s,l=i.attributes,u=function(y,E){return yi(i.distance,l.length,function(w){return l[w](y)},function(w){return l[w](E)},y,E)},c=0;c<e.length;c++){var h=e[c].key,p=n[h][r[h]];p<a&&(o=h,a=p)}if(i.mode==="threshold"&&a>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[o],g=t[r[o]],v;i.mode==="dendrogram"?v={left:d,right:g,key:d.key}:v={value:d.value.concat(g.value),key:d.key},e[d.index]=v,e.splice(g.index,1),t[d.key]=v;for(var b=0;b<e.length;b++){var f=e[b];d.key===f.key?s=1/0:i.linkage==="min"?(s=n[d.key][f.key],n[d.key][f.key]>n[g.key][f.key]&&(s=n[g.key][f.key])):i.linkage==="max"?(s=n[d.key][f.key],n[d.key][f.key]<n[g.key][f.key]&&(s=n[g.key][f.key])):i.linkage==="mean"?s=(n[d.key][f.key]*d.size+n[g.key][f.key]*g.size)/(d.size+g.size):i.mode==="dendrogram"?s=u(f.value,d.value):s=u(f.value[0],d.value[0]),n[d.key][f.key]=n[f.key][d.key]=s}for(var m=0;m<e.length;m++){var x=e[m].key;if(r[x]===d.key||r[x]===g.key){for(var T=x,_=0;_<e.length;_++){var D=e[_].key;n[x][D]<n[x][T]&&(T=D)}r[x]=T}e[m].index=m}return d.key=g.key=d.index=g.index=null,!0},Cr=function e(t,n,r){t&&(t.value?n.push(t.value):(t.left&&e(t.left,n),t.right&&e(t.right,n)))},Sf=function e(t,n){if(!t)return"";if(t.left&&t.right){var r=e(t.left,n),i=e(t.right,n),o=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:o.id()}}),n.add({group:"edges",data:{source:i,target:o.id()}}),o.id()}else if(t.value)return t.value.id()},If=function e(t,n,r){if(!t)return[];var i=[],o=[],a=[];return n===0?(t.left&&Cr(t.left,i),t.right&&Cr(t.right,o),a=i.concat(o),[r.collection(a)]):n===1?t.value?[r.collection(t.value)]:(t.left&&Cr(t.left,i),t.right&&Cr(t.right,o),[r.collection(i),r.collection(o)]):t.value?[r.collection(t.value)]:(t.left&&(i=e(t.left,n-1,r)),t.right&&(o=e(t.right,n-1,r)),i.concat(o))},no=function(e){for(var t=this.cy(),n=this.nodes(),r=Nf(e),i=r.attributes,o=function(f,m){return yi(r.distance,i.length,function(x){return i[x](f)},function(x){return i[x](m)},f,m)},a=[],s=[],l=[],u=[],c=0;c<n.length;c++){var h={value:r.mode==="dendrogram"?n[c]:[n[c]],key:c,index:c};a[c]=h,u[c]=h,s[c]=[],l[c]=0}for(var p=0;p<a.length;p++)for(var d=0;d<=p;d++){var g=void 0;r.mode==="dendrogram"?g=p===d?1/0:o(a[p].value,a[d].value):g=p===d?1/0:o(a[p].value[0],a[d].value[0]),s[p][d]=g,s[d][p]=g,g<s[p][l[p]]&&(l[p]=d)}for(var v=to(a,u,s,l,r);v;)v=to(a,u,s,l,r);var b;return r.mode==="dendrogram"?(b=If(a[0],r.dendrogramDepth,t),r.addDendrogram&&Sf(a[0],t)):(b=new Array(a.length),a.forEach(function(f,m){f.key=f.index=null,b[m]=t.collection(f.value)})),b},Pf={hierarchicalClustering:no,hca:no},Of=Ke({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),Mf=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||Be("Damping must range on [0.5, 1).  Got: ".concat(t));var r=["median","mean","min","max"];return r.some(function(i){return i===n})||ee(n)||Be("Preference must be one of [".concat(r.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number.  Got: ").concat(n)),Of(e)},Rf=function(e,t,n,r){var i=function(o,a){return r[a](o)};return-yi(e,r.length,function(o){return i(t,o)},function(o){return i(n,o)},t,n)},Bf=function(e,t){var n=null;return t==="median"?n=Og(e):t==="mean"?n=Pg(e):t==="min"?n=Sg(e):t==="max"?n=Ig(e):n=t,n},Ff=function(e,t,n){for(var r=[],i=0;i<e;i++)t[i*e+i]+n[i*e+i]>0&&r.push(i);return r},ro=function(e,t,n){for(var r=[],i=0;i<e;i++){for(var o=-1,a=-1/0,s=0;s<n.length;s++){var l=n[s];t[i*e+l]>a&&(o=l,a=t[i*e+l])}o>0&&r.push(o)}for(var u=0;u<n.length;u++)r[n[u]]=n[u];return r},zf=function(e,t,n){for(var r=ro(e,t,n),i=0;i<n.length;i++){for(var o=[],a=0;a<r.length;a++)r[a]===n[i]&&o.push(a);for(var s=-1,l=-1/0,u=0;u<o.length;u++){for(var c=0,h=0;h<o.length;h++)c+=t[o[h]*e+o[u]];c>l&&(s=u,l=c)}n[i]=o[s]}return r=ro(e,t,n),r},io=function(e){for(var t=this.cy(),n=this.nodes(),r=Mf(e),i={},o=0;o<n.length;o++)i[n[o].id()]=o;var a,s,l,u,c,h;a=n.length,s=a*a,l=new Array(s);for(var p=0;p<s;p++)l[p]=-1/0;for(var d=0;d<a;d++)for(var g=0;g<a;g++)d!==g&&(l[d*a+g]=Rf(r.distance,n[d],n[g],r.attributes));u=Bf(l,r.preference);for(var v=0;v<a;v++)l[v*a+v]=u;c=new Array(s);for(var b=0;b<s;b++)c[b]=0;h=new Array(s);for(var f=0;f<s;f++)h[f]=0;for(var m=new Array(a),x=new Array(a),T=new Array(a),_=0;_<a;_++)m[_]=0,x[_]=0,T[_]=0;for(var D=new Array(a*r.minIterations),y=0;y<D.length;y++)D[y]=0;var E;for(E=0;E<r.maxIterations;E++){for(var w=0;w<a;w++){for(var C=-1/0,A=-1/0,k=-1,S=0,N=0;N<a;N++)m[N]=c[w*a+N],S=h[w*a+N]+l[w*a+N],S>=C?(A=C,C=S,k=N):S>A&&(A=S);for(var P=0;P<a;P++)c[w*a+P]=(1-r.damping)*(l[w*a+P]-C)+r.damping*m[P];c[w*a+k]=(1-r.damping)*(l[w*a+k]-A)+r.damping*m[k]}for(var R=0;R<a;R++){for(var I=0,O=0;O<a;O++)m[O]=h[O*a+R],x[O]=Math.max(0,c[O*a+R]),I+=x[O];I-=x[R],x[R]=c[R*a+R],I+=x[R];for(var M=0;M<a;M++)h[M*a+R]=(1-r.damping)*Math.min(0,I-x[M])+r.damping*m[M];h[R*a+R]=(1-r.damping)*(I-x[R])+r.damping*m[R]}for(var G=0,B=0;B<a;B++){var V=h[B*a+B]+c[B*a+B]>0?1:0;D[E%r.minIterations*a+B]=V,G+=V}if(G>0&&(E>=r.minIterations-1||E==r.maxIterations-1)){for(var F=0,U=0;U<a;U++){T[U]=0;for(var Q=0;Q<r.minIterations;Q++)T[U]+=D[Q*a+U];(T[U]===0||T[U]===r.minIterations)&&F++}if(F===a)break}}for(var z=Ff(a,c,h),q=zf(a,l,z),H={},$=0;$<z.length;$++)H[z[$]]=[];for(var Z=0;Z<n.length;Z++){var te=i[n[Z].id()],pe=q[te];pe!=null&&H[pe].push(n[Z])}for(var ue=new Array(z.length),J=0;J<z.length;J++)ue[J]=t.collection(H[z[J]]);return ue},Gf={affinityPropagation:io,ap:io},Yf=Ke({root:void 0,directed:!1}),Vf={hierholzer:function(e){if(!_e(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n=Yf(e),r=n.root,i=n.directed,o=this,a=!1,s,l,u;r&&(u=le(r)?this.filter(r)[0].id():r[0].id());var c={},h={};i?o.forEach(function(f){var m=f.id();if(f.isNode()){var x=f.indegree(!0),T=f.outdegree(!0),_=x-T,D=T-x;_==1?s?a=!0:s=m:D==1?l?a=!0:l=m:(D>1||_>1)&&(a=!0),c[m]=[],f.outgoers().forEach(function(y){y.isEdge()&&c[m].push(y.id())})}else h[m]=[void 0,f.target().id()]}):o.forEach(function(f){var m=f.id();if(f.isNode()){var x=f.degree(!0);x%2&&(s?l?a=!0:l=m:s=m),c[m]=[],f.connectedEdges().forEach(function(T){return c[m].push(T.id())})}else h[m]=[f.source().id(),f.target().id()]});var p={found:!1,trail:void 0};if(a)return p;if(l&&s)if(i){if(u&&l!=u)return p;u=l}else{if(u&&l!=u&&s!=u)return p;u||(u=l)}else u||(u=o[0].id());var d=function(f){for(var m=f,x=[f],T,_,D;c[m].length;)T=c[m].shift(),_=h[T][0],D=h[T][1],m!=D?(c[D]=c[D].filter(function(y){return y!=T}),m=D):!i&&m!=_&&(c[_]=c[_].filter(function(y){return y!=T}),m=_),x.unshift(T),x.unshift(m);return x},g=[],v=[];for(v=d(u);v.length!=1;)c[v[0]].length==0?(g.unshift(o.getElementById(v.shift())),g.unshift(o.getElementById(v.shift()))):v=d(v.shift()).concat(v);g.unshift(o.getElementById(v.shift()));for(var b in c)if(c[b].length)return p;return p.found=!0,p.trail=this.spawn(g,!0),p}},Ar=function(){var e=this,t={},n=0,r=0,i=[],o=[],a={},s=function(c,h){for(var p=o.length-1,d=[],g=e.spawn();o[p].x!=c||o[p].y!=h;)d.push(o.pop().edge),p--;d.push(o.pop().edge),d.forEach(function(v){var b=v.connectedNodes().intersection(e);g.merge(v),b.forEach(function(f){var m=f.id(),x=f.connectedEdges().intersection(e);g.merge(f),t[m].cutVertex?g.merge(x.filter(function(T){return T.isLoop()})):g.merge(x)})}),i.push(g)},l=function c(h,p,d){h===d&&(r+=1),t[p]={id:n,low:n++,cutVertex:!1};var g=e.getElementById(p).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(p)));else{var v,b,f,m;g.forEach(function(x){v=x.source().id(),b=x.target().id(),f=v===p?b:v,f!==d&&(m=x.id(),a[m]||(a[m]=!0,o.push({x:p,y:f,edge:x})),f in t?t[p].low=Math.min(t[p].low,t[f].id):(c(h,f,p),t[p].low=Math.min(t[p].low,t[f].low),t[p].id<=t[f].low&&(t[p].cutVertex=!0,s(p,f))))})}};e.forEach(function(c){if(c.isNode()){var h=c.id();h in t||(r=0,l(h,h),t[h].cutVertex=r>1)}});var u=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(u),components:i}},Uf={hopcroftTarjanBiconnected:Ar,htbc:Ar,htb:Ar,hopcroftTarjanBiconnectedComponents:Ar},kr=function(){var e=this,t={},n=0,r=[],i=[],o=e.spawn(e),a=function s(l){i.push(l),t[l]={index:n,low:n++,explored:!1};var u=e.getElementById(l).connectedEdges().intersection(e);if(u.forEach(function(g){var v=g.target().id();v!==l&&(v in t||s(v),t[v].explored||(t[l].low=Math.min(t[l].low,t[v].low)))}),t[l].index===t[l].low){for(var c=e.spawn();;){var h=i.pop();if(c.merge(e.getElementById(h)),t[h].low=t[l].index,t[h].explored=!0,h===l)break}var p=c.edgesWith(c),d=c.merge(p);r.push(d),o=o.difference(d)}};return e.forEach(function(s){if(s.isNode()){var l=s.id();l in t||a(l)}}),{cut:o,components:r}},Xf={tarjanStronglyConnected:kr,tsc:kr,tscc:kr,tarjanStronglyConnectedComponents:kr},Ms={};[$n,bg,xg,Eg,Tg,Cg,Lg,ef,Tn,Dn,Gi,gf,Af,Pf,Gf,Vf,Uf,Xf].forEach(function(e){de(Ms,e)});var Rs=0,Bs=1,Fs=2,It=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=Rs,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};It.prototype={fulfill:function(e){return ao(this,Bs,"fulfillValue",e)},reject:function(e){return ao(this,Fs,"rejectReason",e)},then:function(e,t){var n=this,r=new It;return n.onFulfilled.push(so(e,r,"fulfill")),n.onRejected.push(so(t,r,"reject")),zs(n),r.proxy}};var ao=function(e,t,n,r){return e.state===Rs&&(e.state=t,e[n]=r,zs(e)),e},zs=function(e){e.state===Bs?oo(e,"onFulfilled",e.fulfillValue):e.state===Fs&&oo(e,"onRejected",e.rejectReason)},oo=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var i=function(){for(var o=0;o<r.length;o++)r[o](n)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},so=function(e,t,n){return function(r){if(typeof e!="function")t[n].call(t,r);else{var i;try{i=e(r)}catch(o){t.reject(o);return}jf(t,i)}}},jf=function e(t,n){if(t===n||t.proxy===n){t.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(Ve(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(o){t.reject(o);return}if(typeof r=="function"){var i=!1;try{r.call(n,function(o){i||(i=!0,o===n?t.reject(new TypeError("circular thenable chain")):e(t,o))},function(o){i||(i=!0,t.reject(o))})}catch(o){i||t.reject(o)}return}t.fulfill(n)};It.all=function(e){return new It(function(t,n){for(var r=new Array(e.length),i=0,o=function(s,l){r[s]=l,i++,i===e.length&&t(r)},a=0;a<e.length;a++)(function(s){var l=e[s],u=l!=null&&l.then!=null;if(u)l.then(function(h){o(s,h)},function(h){n(h)});else{var c=l;o(s,c)}})(a)})},It.resolve=function(e){return new It(function(t,n){t(e)})},It.reject=function(e){return new It(function(t,n){n(e)})};var Rn=typeof Promise<"u"?Promise:It,Yi=function(e,t,n){var r=ua(e),i=!r,o=this._private=de({duration:1e3},t,n);if(o.target=e,o.style=o.style||o.css,o.started=!1,o.playing=!1,o.hooked=!1,o.applying=!1,o.progress=0,o.completes=[],o.frames=[],o.complete&&Me(o.complete)&&o.completes.push(o.complete),i){var a=e.position();o.startPosition=o.startPosition||{x:a.x,y:a.y},o.startStyle=o.startStyle||e.cy().style().getAnimationStartStyle(e,o.style)}if(r){var s=e.pan();o.startPan={x:s.x,y:s.y},o.startZoom=e.zoom()}this.length=1,this[0]=this},en=Yi.prototype;de(en,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t,n=e.target._private.animation;e.queue?t=n.queue:t=n.current,t.push(this),ht(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var t=this._private;return e===void 0?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return e===void 0?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var n=function(s,l){var u=e[s];u!=null&&(e[s]=e[l],e[l]=u)};if(n("zoom","startZoom"),n("pan","startPan"),n("position","startPosition"),e.style)for(var r=0;r<e.style.length;r++){var i=e.style[r],o=i.name,a=e.startStyle[o];e.startStyle[o]=i,e.style[r]=a}return t&&this.play(),this},promise:function(e){var t=this._private,n;switch(e){case"frame":n=t.frames;break;default:case"complete":case"completed":n=t.completes}return new Rn(function(r,i){n.push(function(){r()})})}}),en.complete=en.completed,en.run=en.play,en.running=en.playing;var Hf={animated:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return!1;var i=n[0];if(i)return i._private.animation.current.length>0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var i=0;i<n.length;i++){var o=n[i];o._private.animation.queue=[]}return this}},delay:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],o=this._private.cy||this,a=!r,s=!a;if(!o.styleEnabled())return this;var l=o.style();e=de({},e,t);var u=Object.keys(e).length===0;if(u)return new Yi(i[0],e);switch(e.duration===void 0&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200;break}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&e.renderedPosition!=null){var c=e.renderedPosition,h=o.pan(),p=o.zoom();e.position=Cs(c,p,h)}if(a&&e.panBy!=null){var d=e.panBy,g=o.pan();e.pan={x:g.x+d.x,y:g.y+d.y}}var v=e.center||e.centre;if(a&&v!=null){var b=o.getCenterPan(v.eles,e.zoom);b!=null&&(e.pan=b)}if(a&&e.fit!=null){var f=e.fit,m=o.getFitViewport(f.eles||f.boundingBox,f.padding);m!=null&&(e.pan=m.pan,e.zoom=m.zoom)}if(a&&_e(e.zoom)){var x=o.getZoomedViewport(e.zoom);x!=null?(x.zoomed&&(e.zoom=x.zoom),x.panned&&(e.pan=x.pan)):e.zoom=null}return new Yi(i[0],e)}},animate:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;t&&(e=de({},e,t));for(var a=0;a<i.length;a++){var s=i[a],l=s.animated()&&(e.queue===void 0||e.queue),u=s.animation(e,l?{queue:!0}:void 0);u.play()}return this}},stop:function(){return function(e,t){var n=this,r=n.length!==void 0,i=r?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var a=0;a<i.length;a++){for(var s=i[a],l=s._private,u=l.animation.current,c=0;c<u.length;c++){var h=u[c],p=h._private;t&&(p.duration=0)}e&&(l.animation.queue=[]),t||(l.animation.current=[])}return o.notify("draw"),this}}},Wf={data:function(e){var t={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,r){},onSet:function(n){},canSet:function(n){return!0}};return e=de({},t,e),function(n,r){var i=e,o=this,a=o.length!==void 0,s=a?o:[o],l=a?o[0]:o;if(le(n)){var u=n.indexOf(".")!==-1,c=u&&Np.default(n);if(i.allowGetting&&r===void 0){var h;return l&&(i.beforeGet(l),c&&l._private[i.field][n]===void 0?h=kp.default(l._private[i.field],c):h=l._private[i.field][n]),h}else if(i.allowSetting&&r!==void 0){var p=!i.immutableKeys[n];if(p){var d=cs({},n,r);i.beforeSet(o,d);for(var g=0,v=s.length;g<v;g++){var b=s[g];i.canSet(b)&&(c&&l._private[i.field][n]===void 0?Lp.default(b._private[i.field],c,r):b._private[i.field][n]=r)}i.updateStyle&&o.updateStyle(),i.onSet(o),i.settingTriggersEvent&&o[i.triggerFnName](i.settingEvent)}}}else if(i.allowSetting&&_e(n)){var f=n,m,x,T=Object.keys(f);i.beforeSet(o,f);for(var _=0;_<T.length;_++){m=T[_],x=f[m];var D=!i.immutableKeys[m];if(D)for(var y=0;y<s.length;y++){var E=s[y];i.canSet(E)&&(E._private[i.field][m]=x)}}i.updateStyle&&o.updateStyle(),i.onSet(o),i.settingTriggersEvent&&o[i.triggerFnName](i.settingEvent)}else if(i.allowBinding&&Me(n)){var w=n;o.on(i.bindingEvent,w)}else if(i.allowGetting&&n===void 0){var C;return l&&(i.beforeGet(l),C=l._private[i.field]),C}return o}},removeData:function(e){var t={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=de({},t,e),function(n){var r=e,i=this,o=i.length!==void 0,a=o?i:[i];if(le(n)){for(var s=n.split(/\s+/),l=s.length,u=0;u<l;u++){var c=s[u];if(!$t(c)){var h=!r.immutableKeys[c];if(h)for(var p=0,d=a.length;p<d;p++)a[p]._private[r.field][c]=void 0}}r.triggerEvent&&i[r.triggerFnName](r.event)}else if(n===void 0){for(var g=0,v=a.length;g<v;g++)for(var b=a[g]._private[r.field],f=Object.keys(b),m=0;m<f.length;m++){var x=f[m],T=!r.immutableKeys[x];T&&(b[x]=void 0)}r.triggerEvent&&i[r.triggerFnName](r.event)}return i}}},qf={eventAliasesOn:function(e){var t=e;t.addListener=t.listen=t.bind=t.on,t.unlisten=t.unbind=t.off=t.removeListener,t.trigger=t.emit,t.pon=t.promiseOn=function(n,r){var i=this,o=Array.prototype.slice.call(arguments,0);return new Rn(function(a,s){var l=function(h){i.off.apply(i,c),a(h)},u=o.concat([l]),c=u.concat([]);i.on.apply(i,u)})}}},ke={};[Hf,Wf,qf].forEach(function(e){de(ke,e)});var $f={animate:ke.animate(),animation:ke.animation(),animated:ke.animated(),clearQueue:ke.clearQueue(),delay:ke.delay(),delayAnimation:ke.delayAnimation(),stop:ke.stop()},zr={classes:function(e){var t=this;if(e===void 0){var n=[];return t[0]._private.classes.forEach(function(d){return n.push(d)}),n}else Se(e)||(e=(e||"").match(/\S+/g)||[]);for(var r=[],i=new Mn(e),o=0;o<t.length;o++){for(var a=t[o],s=a._private,l=s.classes,u=!1,c=0;c<e.length;c++){var h=e[c],p=l.has(h);if(!p){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=i,r.push(a))}return r.length>0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Se(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,i=[],o=0,a=n.length;o<a;o++)for(var s=n[o],l=s._private.classes,u=!1,c=0;c<e.length;c++){var h=e[c],p=l.has(h),d=!1;t||r&&!p?(l.add(h),d=!0):(!t||r&&p)&&(l.delete(h),d=!0),!u&&d&&(i.push(s),u=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};zr.className=zr.classNames=zr.classes;var Ee={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:Ye,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ee.variable="(?:[\\w-.]|(?:\\\\"+Ee.metaChar+"))+",Ee.className="(?:[\\w-]|(?:\\\\"+Ee.metaChar+"))+",Ee.value=Ee.string+"|"+Ee.number,Ee.id=Ee.variable,function(){var e,t,n;for(e=Ee.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],Ee.comparatorOp+="|@"+t;for(e=Ee.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(Ee.comparatorOp+="|\\!"+t)}();var Ne=function(){return{checks:[]}},re={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Vi=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return Qp(e.selector,t.selector)}),Kf=function(){for(var e={},t,n=0;n<Vi.length;n++)t=Vi[n],e[t.selector]=t.matches;return e}(),Zf=function(e,t){return Kf[e](t)},Qf="("+Vi.map(function(e){return e.selector}).join("|")+")",pn=function(e){return e.replace(new RegExp("\\\\("+Ee.metaChar+")","g"),function(t,n){return n})},zt=function(e,t,n){e[e.length-1]=n},Ui=[{name:"group",query:!0,regex:"("+Ee.group+")",populate:function(e,t,n){var r=xt(n,1),i=r[0];t.checks.push({type:re.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Qf,populate:function(e,t,n){var r=xt(n,1),i=r[0];t.checks.push({type:re.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Ee.id+")",populate:function(e,t,n){var r=xt(n,1),i=r[0];t.checks.push({type:re.ID,value:pn(i)})}},{name:"className",query:!0,regex:"\\.("+Ee.className+")",populate:function(e,t,n){var r=xt(n,1),i=r[0];t.checks.push({type:re.CLASS,value:pn(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Ee.variable+")\\s*\\]",populate:function(e,t,n){var r=xt(n,1),i=r[0];t.checks.push({type:re.DATA_EXIST,field:pn(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Ee.variable+")\\s*("+Ee.comparatorOp+")\\s*("+Ee.value+")\\s*\\]",populate:function(e,t,n){var r=xt(n,3),i=r[0],o=r[1],a=r[2],s=new RegExp("^"+Ee.string+"$").exec(a)!=null;s?a=a.substring(1,a.length-1):a=parseFloat(a),t.checks.push({type:re.DATA_COMPARE,field:pn(i),operator:o,value:a})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Ee.boolOp+")\\s*("+Ee.variable+")\\s*\\]",populate:function(e,t,n){var r=xt(n,2),i=r[0],o=r[1];t.checks.push({type:re.DATA_BOOL,field:pn(o),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Ee.meta+")\\s*("+Ee.comparatorOp+")\\s*("+Ee.number+")\\s*\\]\\]",populate:function(e,t,n){var r=xt(n,3),i=r[0],o=r[1],a=r[2];t.checks.push({type:re.META_COMPARE,field:pn(i),operator:o,value:parseFloat(a)})}},{name:"nextQuery",separator:!0,regex:Ee.separator,populate:function(e,t){var n=e.currentSubject,r=e.edgeCount,i=e.compoundCount,o=e[e.length-1];n!=null&&(o.subject=n,e.currentSubject=null),o.edgeCount=r,o.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var a=e[e.length++]=Ne();return a}},{name:"directedEdge",separator:!0,regex:Ee.directedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Ne(),r=t,i=Ne();return n.checks.push({type:re.DIRECTED_EDGE,source:r,target:i}),zt(e,t,n),e.edgeCount++,i}else{var o=Ne(),a=t,s=Ne();return o.checks.push({type:re.NODE_SOURCE,source:a,target:s}),zt(e,t,o),e.edgeCount++,s}}},{name:"undirectedEdge",separator:!0,regex:Ee.undirectedEdge,populate:function(e,t){if(e.currentSubject==null){var n=Ne(),r=t,i=Ne();return n.checks.push({type:re.UNDIRECTED_EDGE,nodes:[r,i]}),zt(e,t,n),e.edgeCount++,i}else{var o=Ne(),a=t,s=Ne();return o.checks.push({type:re.NODE_NEIGHBOR,node:a,neighbor:s}),zt(e,t,o),s}}},{name:"child",separator:!0,regex:Ee.child,populate:function(e,t){if(e.currentSubject==null){var n=Ne(),r=Ne(),i=e[e.length-1];return n.checks.push({type:re.CHILD,parent:i,child:r}),zt(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var o=Ne(),a=e[e.length-1],s=Ne(),l=Ne(),u=Ne(),c=Ne();return o.checks.push({type:re.COMPOUND_SPLIT,left:a,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:re.TRUE}],c.checks.push({type:re.TRUE}),s.checks.push({type:re.PARENT,parent:c,child:u}),zt(e,a,o),e.currentSubject=l,e.compoundCount++,u}else{var h=Ne(),p=Ne(),d=[{type:re.PARENT,parent:h,child:p}];return h.checks=t.checks,t.checks=d,e.compoundCount++,p}}},{name:"descendant",separator:!0,regex:Ee.descendant,populate:function(e,t){if(e.currentSubject==null){var n=Ne(),r=Ne(),i=e[e.length-1];return n.checks.push({type:re.DESCENDANT,ancestor:i,descendant:r}),zt(e,t,n),e.compoundCount++,r}else if(e.currentSubject===t){var o=Ne(),a=e[e.length-1],s=Ne(),l=Ne(),u=Ne(),c=Ne();return o.checks.push({type:re.COMPOUND_SPLIT,left:a,right:s,subject:l}),l.checks=t.checks,t.checks=[{type:re.TRUE}],c.checks.push({type:re.TRUE}),s.checks.push({type:re.ANCESTOR,ancestor:c,descendant:u}),zt(e,a,o),e.currentSubject=l,e.compoundCount++,u}else{var h=Ne(),p=Ne(),d=[{type:re.ANCESTOR,ancestor:h,descendant:p}];return h.checks=t.checks,t.checks=d,e.compoundCount++,p}}},{name:"subject",modifier:!0,regex:Ee.subject,populate:function(e,t){if(e.currentSubject!=null&&e.currentSubject!==t)return Le("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1],r=n.checks[0],i=r==null?null:r.type;i===re.DIRECTED_EDGE?r.type=re.NODE_TARGET:i===re.UNDIRECTED_EDGE&&(r.type=re.NODE_NEIGHBOR,r.node=r.nodes[1],r.neighbor=r.nodes[0],r.nodes=null)}}];Ui.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var Jf=function(e){for(var t,n,r,i=0;i<Ui.length;i++){var o=Ui[i],a=o.name,s=e.match(o.regexObj);if(s!=null){n=s,t=o,r=a;var l=s[0];e=e.substring(l.length);break}}return{expr:t,match:n,name:r,remaining:e}},ev=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},tv=function(e){var t=this,n=t.inputText=e,r=t[0]=Ne();for(t.length=1,n=ev(n);;){var i=Jf(n);if(i.expr==null)return Le("The selector `"+e+"`is invalid"),!1;var o=i.match.slice(1),a=i.expr.populate(t,r,o);if(a===!1)return!1;if(a!=null&&(r=a),n=i.remaining,n.match(/^\s*$/))break}var s=t[t.length-1];t.currentSubject!=null&&(s.subject=t.currentSubject),s.edgeCount=t.edgeCount,s.compoundCount=t.compoundCount;for(var l=0;l<t.length;l++){var u=t[l];if(u.compoundCount>0&&u.edgeCount>0)return Le("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Le("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;u.edgeCount===1&&Le("The selector `"+e+"` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},nv=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l!=null?l:""},t=function(l){return le(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,u){var c=l.type,h=l.value;switch(c){case re.GROUP:{var p=e(h);return p.substring(0,p.length-1)}case re.DATA_COMPARE:{var d=l.field,g=l.operator;return"["+d+n(e(g))+t(h)+"]"}case re.DATA_BOOL:{var v=l.operator,b=l.field;return"["+e(v)+b+"]"}case re.DATA_EXIST:{var f=l.field;return"["+f+"]"}case re.META_COMPARE:{var m=l.operator,x=l.field;return"[["+x+n(e(m))+t(h)+"]]"}case re.STATE:return h;case re.ID:return"#"+h;case re.CLASS:return"."+h;case re.PARENT:case re.CHILD:return i(l.parent,u)+n(">")+i(l.child,u);case re.ANCESTOR:case re.DESCENDANT:return i(l.ancestor,u)+" "+i(l.descendant,u);case re.COMPOUND_SPLIT:{var T=i(l.left,u),_=i(l.subject,u),D=i(l.right,u);return T+(T.length>0?" ":"")+_+D}case re.TRUE:return""}},i=function(l,u){return l.checks.reduce(function(c,h,p){return c+(u===l&&p===0?"$":"")+r(h,u)},"")},o="",a=0;a<this.length;a++){var s=this[a];o+=i(s,s.subject),this.length>1&&a<this.length-1&&(o+=", ")}return this.toStringCache=o,o},rv={parse:tv,toString:nv},lo=function(e,t,n){var r,i=le(e),o=ee(e),a=le(n),s,l,u=!1,c=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(i||a||u)&&(s=!i&&!o?"":""+e,l=""+n),u&&(e=s=s.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":r=s.indexOf(l)>=0;break;case"$=":r=s.indexOf(l,s.length-l.length)>=0;break;case"^=":r=s.indexOf(l)===0;break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e<n;break;case"<=":h=!0,r=e<=n;break;default:r=!1;break}return c&&(e!=null||!h)&&(r=!r),r},iv=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},av=function(e){return e!==void 0},ki=function(e,t){return e.data(t)},ov=function(e,t){return e[t]()},Re=[],Oe=function(e,t){return e.checks.every(function(n){return Re[n.type](n,t)})};Re[re.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()},Re[re.STATE]=function(e,t){var n=e.value;return Zf(n,t)},Re[re.ID]=function(e,t){var n=e.value;return t.id()===n},Re[re.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},Re[re.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return lo(ov(t,n),r,i)},Re[re.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return lo(ki(t,n),r,i)},Re[re.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return iv(ki(t,n),r)},Re[re.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,av(ki(t,n))},Re[re.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),o=t.target();return Oe(n,i)&&Oe(r,o)||Oe(r,i)&&Oe(n,o)},Re[re.NODE_NEIGHBOR]=function(e,t){return Oe(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&Oe(e.neighbor,n)})},Re[re.DIRECTED_EDGE]=function(e,t){return Oe(e.source,t.source())&&Oe(e.target,t.target())},Re[re.NODE_SOURCE]=function(e,t){return Oe(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&Oe(e.target,n)})},Re[re.NODE_TARGET]=function(e,t){return Oe(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&Oe(e.source,n)})},Re[re.CHILD]=function(e,t){return Oe(e.child,t)&&Oe(e.parent,t.parent())},Re[re.PARENT]=function(e,t){return Oe(e.parent,t)&&t.children().some(function(n){return Oe(e.child,n)})},Re[re.DESCENDANT]=function(e,t){return Oe(e.descendant,t)&&t.ancestors().some(function(n){return Oe(e.ancestor,n)})},Re[re.ANCESTOR]=function(e,t){return Oe(e.ancestor,t)&&t.descendants().some(function(n){return Oe(e.descendant,n)})},Re[re.COMPOUND_SPLIT]=function(e,t){return Oe(e.subject,t)&&Oe(e.left,t)&&Oe(e.right,t)},Re[re.TRUE]=function(){return!0},Re[re.COLLECTION]=function(e,t){var n=e.value;return n.has(t)},Re[re.FILTER]=function(e,t){var n=e.value;return n(t)};var sv=function(e){var t=this;if(t.length===1&&t[0].checks.length===1&&t[0].checks[0].type===re.ID)return e.getElementById(t[0].checks[0].value).collection();var n=function(r){for(var i=0;i<t.length;i++){var o=t[i];if(Oe(o,r))return!0}return!1};return t.text()==null&&(n=function(){return!0}),e.filter(n)},lv=function(e){for(var t=this,n=0;n<t.length;n++){var r=t[n];if(Oe(r,e))return!0}return!1},uv={matches:lv,filter:sv},Kt=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||le(e)&&e.match(/^\s*$/)||(ht(e)?this.addQuery({checks:[{type:re.COLLECTION,value:e.collection()}]}):Me(e)?this.addQuery({checks:[{type:re.FILTER,value:e}]}):le(e)?this.parse(e)||(this.invalid=!0):Be("A selector must be created from a string; found "))},Gt=Kt.prototype;[rv,uv].forEach(function(e){return de(Gt,e)}),Gt.text=function(){return this.inputText},Gt.size=function(){return this.length},Gt.eq=function(e){return this[e]},Gt.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},Gt.addQuery=function(e){this[this.length++]=e},Gt.selector=Gt.toString;var Vt={allAre:function(e){var t=new Kt(e);return this.every(function(n){return t.matches(n)})},is:function(e){var t=new Kt(e);return this.some(function(n){return t.matches(n)})},some:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(r)return!0}return!1},every:function(e,t){for(var n=0;n<this.length;n++){var r=t?e.apply(t,[this[n],n,this]):e(this[n],n,this);if(!r)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length,n=e.length;return t!==n?!1:t===1?this[0]===e[0]:this.every(function(r){return e.hasElementWithId(r.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(n){return t.hasElementWithId(n.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(n){return t.hasElementWithId(n.id())})}};Vt.allAreNeighbours=Vt.allAreNeighbors,Vt.has=Vt.contains,Vt.equal=Vt.equals=Vt.same;var gt=function(e,t){return function(n,r,i,o){var a=n,s=this,l;if(a==null?l="":ht(a)&&a.length===1&&(l=a.id()),s.length===1&&l){var u=s[0]._private,c=u.traversalCache=u.traversalCache||{},h=c[t]=c[t]||[],p=un(l),d=h[p];return d||(h[p]=e.call(s,n,r,i,o))}else return e.call(s,n,r,i,o)}},On={parent:function(e){var t=[];if(this.length===1){var n=this[0]._private.parent;if(n)return n}for(var r=0;r<this.length;r++){var i=this[r],o=i._private.parent;o&&t.push(o)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var r=this[n],i=r.parents();t=t||i,t=t.intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(t){return t.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(t){return t.isChild()}).filter(e)},children:gt(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],i=r._private.children,o=0;o<i.length;o++)t.push(i[o]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var t=[];function n(r){for(var i=0;i<r.length;i++){var o=r[i];t.push(o),o.children().nonempty()&&n(o.children())}}return n(this.children()),this.spawn(t,!0).filter(e)}};function ya(e,t,n,r){for(var i=[],o=new Mn,a=e.cy(),s=a.hasCompoundNodes(),l=0;l<e.length;l++){var u=e[l];n?i.push(u):s&&r(i,o,u)}for(;i.length>0;){var c=i.shift();t(c),o.add(c.id()),s&&r(i,o,c)}return e}function Gs(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var o=r[i];t.has(o.id())||e.push(o)}}On.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ya(this,e,t,Gs)};function Ys(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}On.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ya(this,e,t,Ys)};function cv(e,t,n){Ys(e,t,n),Gs(e,t,n)}On.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ya(this,e,t,cv)},On.ancestors=On.parents;var Vn,Vs;Vn=Vs={data:ke.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:ke.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ke.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ke.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ke.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ke.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Vn.attr=Vn.data,Vn.removeAttr=Vn.removeData;var hv=Vs,ii={};function Li(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],o=i._private.edges,a=0;a<o.length;a++){var s=o[a];!t&&s.isLoop()||(r+=e(i,s))}return r}else return}}de(ii,{degree:Li(function(e,t){return t.source().same(t.target())?2:1}),indegree:Li(function(e,t){return t.target().same(e)?1:0}),outdegree:Li(function(e,t){return t.source().same(e)?1:0})});function gn(e,t){return function(n){for(var r,i=this.nodes(),o=0;o<i.length;o++){var a=i[o],s=a[e](n);s!==void 0&&(r===void 0||t(s,r))&&(r=s)}return r}}de(ii,{minDegree:gn("degree",function(e,t){return e<t}),maxDegree:gn("degree",function(e,t){return e>t}),minIndegree:gn("indegree",function(e,t){return e<t}),maxIndegree:gn("indegree",function(e,t){return e>t}),minOutdegree:gn("outdegree",function(e,t){return e<t}),maxOutdegree:gn("outdegree",function(e,t){return e>t})}),de(ii,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r<n.length;r++)t+=n[r].degree(e);return t}});var bt,Us,Xs=function(e,t,n){for(var r=0;r<e.length;r++){var i=e[r];if(!i.locked()){var o=i._private.position,a={x:t.x!=null?t.x-o.x:0,y:t.y!=null?t.y-o.y:0};i.isParent()&&!(a.x===0&&a.y===0)&&i.children().shift(a,n),i.dirtyBoundingBoxCache()}}},uo={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,t){Xs(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};bt=Us={position:ke.data(uo),silentPosition:ke.data(de({},uo,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){Xs(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(_e(e))t?this.silentPosition(e):this.position(e);else if(Me(e)){var n=e,r=this.cy();r.startBatch();for(var i=0;i<this.length;i++){var o=this[i],a=void 0;(a=n(o,i))&&(t?o.silentPosition(a):o.position(a))}r.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var r;if(_e(e)?(r={x:ee(e.x)?e.x:0,y:ee(e.y)?e.y:0},n=t):le(e)&&ee(t)&&(r={x:0,y:0},r[e]=t),r!=null){var i=this.cy();i.startBatch();for(var o=0;o<this.length;o++){var a=this[o];if(!(i.hasCompoundNodes()&&a.isChild()&&a.ancestors().anySame(this))){var s=a.position(),l={x:s.x+r.x,y:s.y+r.y};n?a.silentPosition(l):a.position(l)}}i.endBatch()}return this},silentShift:function(e,t){return _e(e)?this.shift(e,!0):le(e)&&ee(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],r=this.cy(),i=r.zoom(),o=r.pan(),a=_e(e)?e:void 0,s=a!==void 0||t!==void 0&&le(e);if(n&&n.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l];t!==void 0?u.position(e,(t-o[e])/i):a!==void 0&&u.position(Cs(a,i,o))}else{var c=n.position();return a=vi(c,i,o),e===void 0?a:a[e]}else if(!s)return;return this},relativePosition:function(e,t){var n=this[0],r=this.cy(),i=_e(e)?e:void 0,o=i!==void 0||t!==void 0&&le(e),a=r.hasCompoundNodes();if(n&&n.isNode())if(o)for(var s=0;s<this.length;s++){var l=this[s],u=a?l.parent():null,c=u&&u.length>0,h=c;c&&(u=u[0]);var p=h?u.position():{x:0,y:0};t!==void 0?l.position(e,t+p[e]):i!==void 0&&l.position({x:i.x+p.x,y:i.y+p.y})}else{var d=n.position(),g=a?n.parent():null,v=g&&g.length>0,b=v;v&&(g=g[0]);var f=b?g.position():{x:0,y:0};return i={x:d.x-f.x,y:d.y-f.y},e===void 0?i:i[e]}else if(!o)return;return this}},bt.modelPosition=bt.point=bt.position,bt.modelPositions=bt.points=bt.positions,bt.renderedPoint=bt.renderedPosition,bt.relativePoint=bt.relativePosition;var dv=Us,Cn,Wt;Cn=Wt={},Wt.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),o=t.x1*r+i.x,a=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:o,x2:a,y1:s,y2:l,w:a-o,h:l-s}},Wt.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)},Wt.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(a){if(!a.isParent())return;var s=a._private,l=a.children(),u=a.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:a.pstyle("min-width").pfValue,left:a.pstyle("min-width-bias-left"),right:a.pstyle("min-width-bias-right")},height:{val:a.pstyle("min-height").pfValue,top:a.pstyle("min-height-bias-top"),bottom:a.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),p=s.position;(h.w===0||h.h===0)&&(h={w:a.pstyle("width").pfValue,h:a.pstyle("height").pfValue},h.x1=p.x-h.w/2,h.x2=p.x+h.w/2,h.y1=p.y-h.h/2,h.y2=p.y+h.h/2);function d(w,C,A){var k=0,S=0,N=C+A;return w>0&&N>0&&(k=C/N*w,S=A/N*w),{biasDiff:k,biasComplementDiff:S}}function g(w,C,A,k){if(A.units==="%")switch(k){case"width":return w>0?A.pfValue*w:0;case"height":return C>0?A.pfValue*C:0;case"average":return w>0&&C>0?A.pfValue*(w+C)/2:0;case"min":return w>0&&C>0?w>C?A.pfValue*C:A.pfValue*w:0;case"max":return w>0&&C>0?w>C?A.pfValue*w:A.pfValue*C:0;default:return 0}else return A.units==="px"?A.pfValue:0}var v=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var b=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(b=b*100/c.width.val);var f=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(f=f*100/c.height.val);var m=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var x=d(c.width.val-h.w,v,b),T=x.biasDiff,_=x.biasComplementDiff,D=d(c.height.val-h.h,f,m),y=D.biasDiff,E=D.biasComplementDiff;s.autoPadding=g(h.w,h.h,a.pstyle("padding"),a.pstyle("padding-relative-to").value),s.autoWidth=Math.max(h.w,c.width.val),p.x=(-T+h.x1+h.x2+_)/2,s.autoHeight=Math.max(h.h,c.height.val),p.y=(-y+h.y1+h.y2+E)/2}for(var r=0;r<this.length;r++){var i=this[r],o=i._private;(!o.compoundBoundsClean||e)&&(n(i),t.batching()||(o.compoundBoundsClean=!0))}return this};var pt=function(e){return e===1/0||e===-1/0?0:e},Et=function(e,t,n,r,i){r-t===0||i-n===0||t==null||n==null||r==null||i==null||(e.x1=t<e.x1?t:e.x1,e.x2=r>e.x2?r:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},rn=function(e,t){return t==null?e:Et(e,t.x1,t.y1,t.x2,t.y2)},Un=function(e,t,n){return wt(e,t,n)},Lr=function(e,t,n){if(!t.cy().headless()){var r=t._private,i=r.rstyle,o=i.arrowWidth/2,a=t.pstyle(n+"-arrow-shape").value,s,l;if(a!=="none"){n==="source"?(s=i.srcX,l=i.srcY):n==="target"?(s=i.tgtX,l=i.tgtY):(s=i.midX,l=i.midY);var u=r.arrowBounds=r.arrowBounds||{},c=u[n]=u[n]||{};c.x1=s-o,c.y1=l-o,c.x2=s+o,c.y2=l+o,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Br(c,1),Et(e,c.x1,c.y1,c.x2,c.y2)}}},Ni=function(e,t,n){if(!t.cy().headless()){var r;n?r=n+"-":r="";var i=t._private,o=i.rstyle,a=t.pstyle(r+"label").strValue;if(a){var s=t.pstyle("text-halign"),l=t.pstyle("text-valign"),u=Un(o,"labelWidth",n),c=Un(o,"labelHeight",n),h=Un(o,"labelX",n),p=Un(o,"labelY",n),d=t.pstyle(r+"text-margin-x").pfValue,g=t.pstyle(r+"text-margin-y").pfValue,v=t.isEdge(),b=t.pstyle(r+"text-rotation"),f=t.pstyle("text-outline-width").pfValue,m=t.pstyle("text-border-width").pfValue,x=m/2,T=t.pstyle("text-background-padding").pfValue,_=2,D=c,y=u,E=y/2,w=D/2,C,A,k,S;if(v)C=h-E,A=h+E,k=p-w,S=p+w;else{switch(s.value){case"left":C=h-y,A=h;break;case"center":C=h-E,A=h+E;break;case"right":C=h,A=h+y;break}switch(l.value){case"top":k=p-D,S=p;break;case"center":k=p-w,S=p+w;break;case"bottom":k=p,S=p+D;break}}C+=d-Math.max(f,x)-T-_,A+=d+Math.max(f,x)+T+_,k+=g-Math.max(f,x)-T-_,S+=g+Math.max(f,x)+T+_;var N=n||"main",P=i.labelBounds,R=P[N]=P[N]||{};R.x1=C,R.y1=k,R.x2=A,R.y2=S,R.w=A-C,R.h=S-k;var I=v&&b.strValue==="autorotate",O=b.pfValue!=null&&b.pfValue!==0;if(I||O){var M=I?Un(i.rstyle,"labelAngle",n):b.pfValue,G=Math.cos(M),B=Math.sin(M),V=(C+A)/2,F=(k+S)/2;if(!v){switch(s.value){case"left":V=A;break;case"right":V=C;break}switch(l.value){case"top":F=S;break;case"bottom":F=k;break}}var U=function(te,pe){return te=te-V,pe=pe-F,{x:te*G-pe*B+V,y:te*B+pe*G+F}},Q=U(C,k),z=U(C,S),q=U(A,k),H=U(A,S);C=Math.min(Q.x,z.x,q.x,H.x),A=Math.max(Q.x,z.x,q.x,H.x),k=Math.min(Q.y,z.y,q.y,H.y),S=Math.max(Q.y,z.y,q.y,H.y)}var $=N+"Rot",Z=P[$]=P[$]||{};Z.x1=C,Z.y1=k,Z.x2=A,Z.y2=S,Z.w=A-C,Z.h=S-k,Et(e,C,k,A,S),Et(i.labelBounds.all,C,k,A,S)}return e}},pv=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,a=r+i,s=(e.w+a*2)/e.w,l=(e.h+a*2)/e.h,u=0,c=0;["diamond","pentagon","round-triangle"].includes(o)?(s=(e.w+a*2.4)/e.w,c=-a/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?s=(e.w+a*2.4)/e.w:o==="star"?(s=(e.w+a*2.8)/e.w,l=(e.h+a*2.6)/e.h,c=-a/3.8):o==="triangle"?(s=(e.w+a*2.8)/e.w,l=(e.h+a*2.4)/e.h,c=-a/1.4):o==="vee"&&(s=(e.w+a*4.4)/e.w,l=(e.h+a*3.8)/e.h,c=-a*.5);var h=e.h*l-e.h,p=e.w*s-e.w;if(Fr(e,[Math.ceil(h/2),Math.ceil(p/2)]),u!=0||c!==0){var d=Gg(e,u,c);As(e,d)}}}},gv=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),o=ut(),a=e._private,s=e.isNode(),l=e.isEdge(),u,c,h,p,d,g,v=a.rstyle,b=s&&r?e.pstyle("bounds-expansion").pfValue:[0],f=function(J){return J.pstyle("display").value!=="none"},m=!r||f(e)&&(!l||f(e.source())&&f(e.target()));if(m){var x=0,T=0;r&&t.includeOverlays&&(x=e.pstyle("overlay-opacity").value,x!==0&&(T=e.pstyle("overlay-padding").value));var _=0,D=0;r&&t.includeUnderlays&&(_=e.pstyle("underlay-opacity").value,_!==0&&(D=e.pstyle("underlay-padding").value));var y=Math.max(T,D),E=0,w=0;if(r&&(E=e.pstyle("width").pfValue,w=E/2),s&&t.includeNodes){var C=e.position();d=C.x,g=C.y;var A=e.outerWidth(),k=A/2,S=e.outerHeight(),N=S/2;u=d-k,c=d+k,h=g-N,p=g+N,Et(o,u,h,c,p),r&&t.includeOutlines&&pv(o,e)}else if(l&&t.includeEdges)if(r&&!i){var P=e.pstyle("curve-style").strValue;if(u=Math.min(v.srcX,v.midX,v.tgtX),c=Math.max(v.srcX,v.midX,v.tgtX),h=Math.min(v.srcY,v.midY,v.tgtY),p=Math.max(v.srcY,v.midY,v.tgtY),u-=w,c+=w,h-=w,p+=w,Et(o,u,h,c,p),P==="haystack"){var R=v.haystackPts;if(R&&R.length===2){if(u=R[0].x,h=R[0].y,c=R[1].x,p=R[1].y,u>c){var I=u;u=c,c=I}if(h>p){var O=h;h=p,p=O}Et(o,u-w,h-w,c+w,p+w)}}else if(P==="bezier"||P==="unbundled-bezier"||P==="segments"||P==="taxi"){var M;switch(P){case"bezier":case"unbundled-bezier":M=v.bezierPts;break;case"segments":case"taxi":M=v.linePts;break}if(M!=null)for(var G=0;G<M.length;G++){var B=M[G];u=B.x-w,c=B.x+w,h=B.y-w,p=B.y+w,Et(o,u,h,c,p)}}}else{var V=e.source(),F=V.position(),U=e.target(),Q=U.position();if(u=F.x,c=Q.x,h=F.y,p=Q.y,u>c){var z=u;u=c,c=z}if(h>p){var q=h;h=p,p=q}u-=w,c+=w,h-=w,p+=w,Et(o,u,h,c,p)}if(r&&t.includeEdges&&l&&(Lr(o,e,"mid-source"),Lr(o,e,"mid-target"),Lr(o,e,"source"),Lr(o,e,"target")),r){var H=e.pstyle("ghost").value==="yes";if(H){var $=e.pstyle("ghost-offset-x").pfValue,Z=e.pstyle("ghost-offset-y").pfValue;Et(o,o.x1+$,o.y1+Z,o.x2+$,o.y2+Z)}}var te=a.bodyBounds=a.bodyBounds||{};ja(te,o),Fr(te,b),Br(te,1),r&&(u=o.x1,c=o.x2,h=o.y1,p=o.y2,Et(o,u-y,h-y,c+y,p+y));var pe=a.overlayBounds=a.overlayBounds||{};ja(pe,o),Fr(pe,b),Br(pe,1);var ue=a.labelBounds=a.labelBounds||{};ue.all!=null?zg(ue.all):ue.all=ut(),r&&t.includeLabels&&(t.includeMainLabels&&Ni(o,e,null),l&&(t.includeSourceLabels&&Ni(o,e,"source"),t.includeTargetLabels&&Ni(o,e,"target")))}return o.x1=pt(o.x1),o.y1=pt(o.y1),o.x2=pt(o.x2),o.y2=pt(o.y2),o.w=pt(o.x2-o.x1),o.h=pt(o.y2-o.y1),o.w>0&&o.h>0&&m&&(Fr(o,b),Br(o,1)),o},js=function(e){var t=0,n=function(i){return(i?1:0)<<t++},r=0;return r+=n(e.incudeNodes),r+=n(e.includeEdges),r+=n(e.includeLabels),r+=n(e.includeMainLabels),r+=n(e.includeSourceLabels),r+=n(e.includeTargetLabels),r+=n(e.includeOverlays),r+=n(e.includeOutlines),r},Hs=function(e){if(e.isEdge()){var t=e.source().position(),n=e.target().position(),r=function(i){return Math.round(i)};return sg([r(t.x),r(t.y),r(n.x),r(n.y)])}else return 0},co=function(e,t){var n=e._private,r,i=e.isEdge(),o=t==null?ho:js(t),a=o===ho,s=Hs(e),l=n.bbCachePosKey===s,u=t.useCache&&l,c=function(d){return d._private.bbCache==null||d._private.styleDirty},h=!u||c(e)||i&&c(e.source())||c(e.target());if(h?(l||e.recalculateRenderedStyle(u),r=gv(e,cr),n.bbCache=r,n.bbCachePosKey=s):r=n.bbCache,!a){var p=e.isNode();r=ut(),(t.includeNodes&&p||t.includeEdges&&!p)&&(t.includeOverlays?rn(r,n.overlayBounds):rn(r,n.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?rn(r,n.labelBounds.all):(t.includeMainLabels&&rn(r,n.labelBounds.mainRot),t.includeSourceLabels&&rn(r,n.labelBounds.sourceRot),t.includeTargetLabels&&rn(r,n.labelBounds.targetRot))),r.w=r.x2-r.x1,r.h=r.y2-r.y1}return r},cr={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},ho=js(cr),po=Ke(cr);Wt.boundingBox=function(e){var t;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(e===void 0||e.useCache===void 0||e.useCache===!0))e===void 0?e=cr:e=po(e),t=co(this[0],e);else{t=ut(),e=e||cr;var n=po(e),r=this,i=r.cy(),o=i.styleEnabled();if(o)for(var a=0;a<r.length;a++){var s=r[a],l=s._private,u=Hs(s),c=l.bbCachePosKey===u,h=n.useCache&&c&&!l.styleDirty;s.recalculateRenderedStyle(h)}this.updateCompoundBounds(!e.useCache);for(var p=0;p<r.length;p++){var d=r[p];rn(t,co(d,n))}}return t.x1=pt(t.x1),t.y1=pt(t.y1),t.x2=pt(t.x2),t.y2=pt(t.y2),t.w=pt(t.x2-t.x1),t.h=pt(t.y2-t.y1),t},Wt.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},Wt.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(u){return u.isParent()}),t=t.not(i)),_e(e)){var o=e;e=function(){return o}}var a=function(u,c){return u._private.bbAtOldPos=e(u,c)},s=function(u){return u._private.bbAtOldPos};n.startBatch(),t.forEach(a).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var l=Fg(this.boundingBox({useCache:!1}));return t.silentPositions(s),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),l},Cn.boundingbox=Cn.bb=Cn.boundingBox,Cn.renderedBoundingbox=Cn.renderedBoundingBox;var fv=Wt,Zn,rr;Zn=rr={};var go=function(e){e.uppercaseName=Ga(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Ga(e.outerName),Zn[e.name]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t)if(i){if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var o=t.pstyle(e.name);switch(o.strValue){case"label":return t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},Zn["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private,r=n.cy,i=r._private.styleEnabled;if(t)if(i){var o=t[e.name](),a=t.pstyle("border-width").pfValue,s=2*t.padding();return o+a+s}else return 1},Zn["rendered"+e.uppercaseName]=function(){var t=this[0];if(t){var n=t[e.name]();return n*this.cy().zoom()}},Zn["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t){var n=t[e.outerName]();return n*this.cy().zoom()}}};go({name:"width"}),go({name:"height"}),rr.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},rr.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},rr.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var vv=rr,yv=function(e,t){if(e.isEdge())return t(e)},mv=function(e,t){if(e.isEdge()){var n=e.cy();return vi(t(e),n.zoom(),n.pan())}},bv=function(e,t){if(e.isEdge()){var n=e.cy(),r=n.pan(),i=n.zoom();return t(e).map(function(o){return vi(o,i,r)})}},xv=function(e){return e.renderer().getControlPoints(e)},wv=function(e){return e.renderer().getSegmentPoints(e)},Ev=function(e){return e.renderer().getSourceEndpoint(e)},_v=function(e){return e.renderer().getTargetEndpoint(e)},Tv=function(e){return e.renderer().getEdgeMidpoint(e)},fo={controlPoints:{get:xv,mult:!0},segmentPoints:{get:wv,mult:!0},sourceEndpoint:{get:Ev},targetEndpoint:{get:_v},midpoint:{get:Tv}},Dv=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Cv=Object.keys(fo).reduce(function(e,t){var n=fo[t],r=Dv(t);return e[t]=function(){return yv(this,n.get)},n.mult?e[r]=function(){return bv(this,n.get)}:e[r]=function(){return mv(this,n.get)},e},{}),Av=de({},dv,fv,vv,Cv),Ws=function(e,t){this.recycle(e,t)};function Xn(){return!1}function Nr(){return!0}Ws.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=Xn,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Nr:Xn):e!=null&&e.type?t=e:this.type=e,t!=null&&(this.originalEvent=t.originalEvent,this.type=t.type!=null?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var n=this.position,r=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:n.x*r+i.x,y:n.y*r+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Nr;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Nr;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Nr,this.stopPropagation()},isDefaultPrevented:Xn,isPropagationStopped:Xn,isImmediatePropagationStopped:Xn};var qs=/^([^.]+)(\.(?:[^.]+))?$/,kv=".*",$s={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},vo=Object.keys($s),Lv={};function mi(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Lv,t=arguments.length>1?arguments[1]:void 0,n=0;n<vo.length;n++){var r=vo[n];this[r]=e[r]||$s[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var Yt=mi.prototype,yo=function(e,t,n,r,i,o,a){Me(r)&&(i=r,r=null),a&&(o==null?o=a:o=de({},o,a));for(var s=Se(n)?n:n.split(/\s+/),l=0;l<s.length;l++){var u=s[l];if(!$t(u)){var c=u.match(qs);if(c){var h=c[1],p=c[2]?c[2]:null,d=t(e,u,h,p,r,i,o);if(d===!1)break}}}},mo=function(e,t){return e.addEventFields(e.context,t),new Ws(t.type,t)},Nv=function(e,t,n){if(Yp(n)){t(e,n);return}else if(_e(n)){t(e,mo(e,n));return}for(var r=Se(n)?n:n.split(/\s+/),i=0;i<r.length;i++){var o=r[i];if(!$t(o)){var a=o.match(qs);if(a){var s=a[1],l=a[2]?a[2]:null,u=mo(e,{type:s,namespace:l,target:e.context});t(e,u)}}}};Yt.on=Yt.addListener=function(e,t,n,r,i){return yo(this,function(o,a,s,l,u,c,h){Me(c)&&o.listeners.push({event:a,callback:c,type:s,namespace:l,qualifier:u,conf:h})},e,t,n,r,i),this},Yt.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},Yt.removeListener=Yt.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=dg(this.listeners));for(var o=this.listeners,a=function(l){var u=o[l];yo(i,function(c,h,p,d,g,v){if((u.type===p||e==="*")&&(!d&&u.namespace!==".*"||u.namespace===d)&&(!g||c.qualifierCompare(u.qualifier,g))&&(!v||u.callback===v))return o.splice(l,1),!1},e,t,n,r)},s=o.length-1;s>=0;s--)a(s);return this},Yt.removeAllListeners=function(){return this.removeListener("*")},Yt.emit=Yt.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,Se(t)||(t=[t]),Nv(this,function(o,a){n!=null&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var s=function(u){var c=r[u];if(c.type===a.type&&(!c.namespace||c.namespace===a.namespace||c.namespace===kv)&&o.eventMatches(o.context,c,a)){var h=[a];t!=null&&gg(h,t),o.beforeEmit(o.context,c,a),c.conf&&c.conf.one&&(o.listeners=o.listeners.filter(function(g){return g!==c}));var p=o.callbackContext(o.context,c,a),d=c.callback.apply(p,h);o.afterEmit(o.context,c,a),d===!1&&(a.stopPropagation(),a.preventDefault())}},l=0;l<i;l++)s(l);o.bubble(o.context)&&!a.isPropagationStopped()&&o.parent(o.context).emit(a,t)},e),this.emitting--,this};var Sv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&mr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Sr=function(e){return le(e)?new Kt(e):e},Ks={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new mi(Sv,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var r=Sr(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,r,n)}return this},removeListener:function(e,t,n){for(var r=Sr(t),i=0;i<this.length;i++){var o=this[i];o.emitter().removeListener(e,r,n)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var t=this[e];t.emitter().removeAllListeners()}return this},one:function(e,t,n){for(var r=Sr(t),i=0;i<this.length;i++){var o=this[i];o.emitter().one(e,r,n)}return this},once:function(e,t,n){for(var r=Sr(t),i=0;i<this.length;i++){var o=this[i];o.emitter().on(e,r,n,{once:!0,onceCollection:this})}},emit:function(e,t){for(var n=0;n<this.length;n++){var r=this[n];r.emitter().emit(e,t)}return this},emitAndNotify:function(e,t){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,t),this}};ke.eventAliasesOn(Ks);var Zs={nodes:function(e){return this.filter(function(t){return t.isNode()}).filter(e)},edges:function(e){return this.filter(function(t){return t.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var r=this[n];r.isNode()?e.push(r):t.push(r)}return{nodes:e,edges:t}},filter:function(e,t){if(e===void 0)return this;if(le(e)||ht(e))return new Kt(e).filter(this);if(Me(e)){for(var n=this.spawn(),r=this,i=0;i<r.length;i++){var o=r[i],a=t?e.apply(t,[o,i,r]):e(o,i,r);a&&n.push(o)}return n}return this.spawn()},not:function(e){if(e){le(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var r=this[n],i=e.has(r);i||t.push(r)}return t}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(le(e)){var t=e;return this.filter(t)}for(var n=this.spawn(),r=this,i=e,o=this.length<e.length,a=o?r:i,s=o?i:r,l=0;l<a.length;l++){var u=a[l];s.has(u)&&n.push(u)}return n},xor:function(e){var t=this._private.cy;le(e)&&(e=t.$(e));var n=this.spawn(),r=this,i=e,o=function(a,s){for(var l=0;l<a.length;l++){var u=a[l],c=u._private.data.id,h=s.hasElementWithId(c);h||n.push(u)}};return o(r,i),o(i,r),n},diff:function(e){var t=this._private.cy;le(e)&&(e=t.$(e));var n=this.spawn(),r=this.spawn(),i=this.spawn(),o=this,a=e,s=function(l,u,c){for(var h=0;h<l.length;h++){var p=l[h],d=p._private.data.id,g=u.hasElementWithId(d);g?i.merge(p):c.push(p)}};return s(o,a,n),s(a,o,r),{left:n,right:r,both:i}},add:function(e){var t=this._private.cy;if(!e)return this;if(le(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=this.spawnSelf(),i=0;i<e.length;i++){var o=e[i],a=!this.has(o);a&&r.push(o)}return r},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&le(e)){var r=e;e=n.mutableElements().filter(r)}for(var i=t.map,o=0;o<e.length;o++){var a=e[o],s=a._private.data.id,l=!i.has(s);if(l){var u=this.length++;this[u]=a,i.set(s,{ele:a,index:u})}}return this},unmergeAt:function(e){var t=this[e],n=t.id(),r=this._private,i=r.map;this[e]=void 0,i.delete(n);var o=e===this.length-1;if(this.length>1&&!o){var a=this.length-1,s=this[a],l=s._private.data.id;this[a]=void 0,this[e]=s,i.set(l,{ele:s,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,i=r.get(n);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&le(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r<e.length;r++)this.unmergeOne(e[r]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;i<r.length;i++){var o=r[i],a=t?e.apply(t,[o,i,r]):e(o,i,r);n.push(a)}return n},reduce:function(e,t){for(var n=t,r=this,i=0;i<r.length;i++)n=e(n,r[i],i,r);return n},max:function(e,t){for(var n=-1/0,r,i=this,o=0;o<i.length;o++){var a=i[o],s=t?e.apply(t,[a,o,i]):e(a,o,i);s>n&&(n=s,r=a)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,i=this,o=0;o<i.length;o++){var a=i[o],s=t?e.apply(t,[a,o,i]):e(a,o,i);s<n&&(n=s,r=a)}return{value:n,ele:r}}},Ce=Zs;Ce.u=Ce["|"]=Ce["+"]=Ce.union=Ce.or=Ce.add,Ce["\\"]=Ce["!"]=Ce["-"]=Ce.difference=Ce.relativeComplement=Ce.subtract=Ce.not,Ce.n=Ce["&"]=Ce["."]=Ce.and=Ce.intersection=Ce.intersect,Ce["^"]=Ce["(+)"]=Ce["(-)"]=Ce.symmetricDifference=Ce.symdiff=Ce.xor,Ce.fnFilter=Ce.filterFn=Ce.stdFilter=Ce.filter,Ce.complement=Ce.abscomp=Ce.absoluteComplement;var Iv={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},Qs=function(e,t){var n=e.cy(),r=n.hasCompoundNodes();function i(u){var c=u.pstyle("z-compound-depth");return c.value==="auto"?r?u.zDepth():0:c.value==="bottom"?-1:c.value==="top"?ha:0}var o=i(e)-i(t);if(o!==0)return o;function a(u){var c=u.pstyle("z-index-compare");return c.value==="auto"&&u.isNode()?1:0}var s=a(e)-a(t);if(s!==0)return s;var l=e.pstyle("z-index").value-t.pstyle("z-index").value;return l!==0?l:e.poolIndex()-t.poolIndex()},ai={forEach:function(e,t){if(Me(e))for(var n=this.length,r=0;r<n;r++){var i=this[r],o=t?e.apply(t,[i,r,this]):e(i,r,this);if(o===!1)break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],r=this.length;t==null&&(t=r),e==null&&(e=0),e<0&&(e=r+e),t<0&&(t=r+t);for(var i=e;i>=0&&i<t&&i<r;i++)n.push(this[i]);return this.spawn(n)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Me(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(Qs)},zDepth:function(){var e=this[0];if(e){var t=e._private,n=t.group;if(n==="nodes"){var r=t.data.parent?e.parents().size():0;return e.isParent()?r:ha-1}else{var i=t.source,o=t.target,a=i.zDepth(),s=o.zDepth();return Math.max(a,s,0)}}}};ai.each=ai.forEach;var Pv=function(){var e="undefined",t=(typeof Symbol>"u"?"undefined":Ve(Symbol))!=e&&Ve(Symbol.iterator)!=e;t&&(ai[Symbol.iterator]=function(){var n=this,r={value:void 0,done:!1},i=0,o=this.length;return cs({next:function(){return i<o?r.value=n[i++]:(r.value=void 0,r.done=!0),r}},Symbol.iterator,function(){return this})})};Pv();var Ov=Ke({nodeDimensionsIncludeLabels:!1}),Gr={layoutDimensions:function(e){e=Ov(e);var t;if(!this.takesUpSpace())t={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()};return(t.w===0||t.h===0)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var r=this.nodes().filter(function(T){return!T.isParent()}),i=this.cy(),o=t.eles,a=function(T){return T.id()},s=ar(n,a);e.emit({type:"layoutstart",layout:e}),e.animations=[];var l=function(T,_,D){var y={x:_.x1+_.w/2,y:_.y1+_.h/2},E={x:(D.x-y.x)*T,y:(D.y-y.y)*T};return{x:y.x+E.x,y:y.y+E.y}},u=t.spacingFactor&&t.spacingFactor!==1,c=function(){if(!u)return null;for(var T=ut(),_=0;_<r.length;_++){var D=r[_],y=s(D,_);Yg(T,y.x,y.y)}return T},h=c(),p=ar(function(T,_){var D=s(T,_);if(u){var y=Math.abs(t.spacingFactor);D=l(y,h,D)}return t.transform!=null&&(D=t.transform(T,D)),D},a);if(t.animate){for(var d=0;d<r.length;d++){var g=r[d],v=p(g,d),b=t.animateFilter==null||t.animateFilter(g,d);if(b){var f=g.animation({position:v,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(f)}else g.position(v)}if(t.fit){var m=i.animation({fit:{boundingBox:o.boundingBoxAt(p),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(m)}else if(t.zoom!==void 0&&t.pan!==void 0){var x=i.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(x)}e.animations.forEach(function(T){return T.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),Rn.all(e.animations.map(function(T){return T.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else r.positions(p),t.fit&&i.fit(t.eles,t.padding),t.zoom!=null&&i.zoom(t.zoom),t.pan&&i.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var t=this.cy();return t.makeLayout(de({},e,{eles:this}))}};Gr.createLayout=Gr.makeLayout=Gr.layout;function Js(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],o;return(o=i[e])!=null||(o=i[e]=t(n)),o}function bi(e,t){return e=un(e),function(n){return Js(e,t,n)}}function oi(e,t){e=un(e);var n=function(r){return t.call(r)};return function(){var r=this[0];if(r)return Js(e,n,r)}}var qe={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),r=t.styleEnabled();return n&&r&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),t=function(r){return r._private.styleCache=null};if(e.hasCompoundNodes()){var n;n=this.spawnSelf().merge(this.descendants()).merge(this.parents()),n.merge(n.connectedEdges()),n.forEach(t)}else this.forEach(function(r){t(r),r.connectedEdges().forEach(t)});return this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching()){var n=t._private.batchStyleEles;return n.merge(this),this}var r=t.hasCompoundNodes(),i=this;e=!!(e||e===void 0),r&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var o=i;return e?o.emitAndNotify("style"):o.emit("style"),i.forEach(function(a){return a._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return i!=null?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(_e(e)){var o=e;i.applyBypass(this,o,r),this.emitAndNotify("style")}else if(le(e))if(t===void 0){var a=this[0];return a?i.getStylePropertyValue(a,e):void 0}else i.applyBypass(this,e,t,r),this.emitAndNotify("style");else if(e===void 0){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(e===void 0)for(var o=0;o<i.length;o++){var a=i[o];r.removeAllBypasses(a,n)}else{e=e.split(/\s+/);for(var s=0;s<i.length;s++){var l=i[s];r.removeBypasses(l,e,n)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var t=e.hasCompoundNodes(),n=this[0];if(n){var r=n._private,i=n.pstyle("opacity").value;if(!t)return i;var o=r.data.parent?n.parents():null;if(o)for(var a=0;a<o.length;a++){var s=o[a],l=s.pstyle("opacity").value;i=l*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0],n=t.cy().hasCompoundNodes();if(t)return n?t.effectiveOpacity()===0:t.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var t=this[0];return!!t._private.backgrounding}};function Si(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var i=0;i<r.length;i++){var o=r[i];if(!t(o))return!1}return!0}function ma(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var o=this[0],a=i.hasCompoundNodes();if(o){var s=o._private;if(!t(o))return!1;if(o.isNode())return!a||Si(o,r);var l=s.source,u=s.target;return n(l)&&(!a||Si(l,n))&&(l===u||n(u)&&(!a||Si(u,n)))}}}var Bn=bi("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});qe.takesUpSpace=oi("takesUpSpace",ma({ok:Bn}));var Mv=bi("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&Bn(e)}),Rv=bi("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&Bn(e)});qe.interactive=oi("interactive",ma({ok:Mv,parentOk:Rv,edgeOkViaNode:Bn})),qe.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Bv=bi("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&Bn(e)}),Fv=Bn;qe.visible=oi("visible",ma({ok:Bv,edgeOkViaNode:Fv})),qe.hidden=function(){var e=this[0];if(e)return!e.visible()},qe.isBundledBezier=oi("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),qe.bypass=qe.css=qe.style,qe.renderedCss=qe.renderedStyle,qe.removeBypass=qe.removeCss=qe.removeStyle,qe.pstyle=qe.parsedStyle;var qt={};function bo(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&Me(t[0])){var o=t[0];this.on(e.event,o)}else if(t.length===0||t.length===1&&Se(t[0])){for(var a=t.length===1?t[0]:null,s=0;s<this.length;s++){var l=this[s],u=!e.ableField||l._private[e.ableField],c=l._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[e.field]=e.value,c&&n.push(l))}var p=this.spawn(n);p.updateStyle(),p.emit(e.event),a&&p.emit(a)}return this}}function fn(e){qt[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},qt[e.on]=bo({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),qt[e.off]=bo({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}fn({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),fn({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),fn({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),fn({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),qt.deselect=qt.unselect,qt.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},fn({field:"active",on:"activate",off:"unactivate"}),fn({field:"pannable",on:"panify",off:"unpanify"}),qt.inactive=function(){var e=this[0];if(e)return!e._private.active};var nt={},xo=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode()){for(var a=!1,s=o.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),h=u.target();if(e.noIncomingEdges&&h===o&&c!==o||e.noOutgoingEdges&&c===o&&h!==o){a=!0;break}}a||r.push(o)}}return this.spawn(r,!0).filter(t)}},wo=function(e){return function(t){for(var n=this,r=[],i=0;i<n.length;i++){var o=n[i];if(o.isNode())for(var a=o.connectedEdges(),s=0;s<a.length;s++){var l=a[s],u=l.source(),c=l.target();e.outgoing&&u===o?(r.push(l),r.push(c)):e.incoming&&c===o&&(r.push(l),r.push(u))}}return this.spawn(r,!0).filter(t)}},Eo=function(e){return function(t){for(var n=this,r=[],i={};;){var o=e.outgoing?n.outgoers():n.incomers();if(o.length===0)break;for(var a=!1,s=0;s<o.length;s++){var l=o[s],u=l.id();i[u]||(i[u]=!0,r.push(l),a=!0)}if(!a)break;n=o}return this.spawn(r,!0).filter(t)}};nt.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},de(nt,{roots:xo({noIncomingEdges:!0}),leaves:xo({noOutgoingEdges:!0}),outgoers:gt(wo({outgoing:!0}),"outgoers"),successors:Eo({outgoing:!0}),incomers:gt(wo({incoming:!0}),"incomers"),predecessors:Eo({incoming:!0})}),de(nt,{neighborhood:gt(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],o=i.connectedEdges(),a=0;a<o.length;a++){var s=o[a],l=s.source(),u=s.target(),c=i===l?u:l;c.length>0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),nt.neighbourhood=nt.neighborhood,nt.closedNeighbourhood=nt.closedNeighborhood,nt.openNeighbourhood=nt.openNeighborhood,de(nt,{source:gt(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:gt(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:_o({attr:"source"}),targets:_o({attr:"target"})});function _o(e){return function(t){for(var n=[],r=0;r<this.length;r++){var i=this[r],o=i._private[e.attr];o&&n.push(o)}return this.spawn(n,!0).filter(t)}}de(nt,{edgesWith:gt(To(),"edgesWith"),edgesTo:gt(To({thisIsSrc:!0}),"edgesTo")});function To(e){return function(t){var n=[],r=this._private.cy,i=e||{};le(t)&&(t=r.$(t));for(var o=0;o<t.length;o++)for(var a=t[o]._private.edges,s=0;s<a.length;s++){var l=a[s],u=l._private.data,c=this.hasElementWithId(u.source)&&t.hasElementWithId(u.target),h=t.hasElementWithId(u.source)&&this.hasElementWithId(u.target),p=c||h;p&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!c||i.thisIsTgt&&!h)||n.push(l))}return this.spawn(n,!0)}}de(nt,{connectedEdges:gt(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var o=i._private.edges,a=0;a<o.length;a++){var s=o[a];t.push(s)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:gt(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:gt(Do(),"parallelEdges"),codirectedEdges:gt(Do({codirected:!0}),"codirectedEdges")});function Do(e){var t={codirected:!1};return e=de({},t,e),function(n){for(var r=[],i=this.edges(),o=e,a=0;a<i.length;a++)for(var s=i[a],l=s._private,u=l.source,c=u._private.data.id,h=l.data.target,p=u._private.edges,d=0;d<p.length;d++){var g=p[d],v=g._private.data,b=v.target,f=v.source,m=b===h&&f===c,x=c===b&&h===f;(o.codirected&&m||!o.codirected&&(m||x))&&r.push(g)}return this.spawn(r,!0).filter(n)}}de(nt,{components:function(e){var t=this,n=t.cy(),r=n.collection(),i=e==null?t.nodes():e.nodes(),o=[];e!=null&&i.empty()&&(i=e.sources());var a=function(l,u){r.merge(l),i.unmerge(l),u.merge(l)};if(i.empty())return t.spawn();var s=function(){var l=n.collection();o.push(l);var u=i[0];a(u,l),t.bfs({directed:!1,roots:u,visit:function(c){return a(c,l)}}),l.forEach(function(c){c.connectedEdges().forEach(function(h){t.has(h)&&l.has(h.source())&&l.has(h.target())&&l.merge(h)})})};do s();while(i.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),nt.componentsOf=nt.components;var $e=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Be("A collection must have a reference to the core");return}var i=new kt,o=!1;if(!t)t=[];else if(t.length>0&&_e(t[0])&&!mr(t[0])){o=!0;for(var a=[],s=new Mn,l=0,u=t.length;l<u;l++){var c=t[l];c.data==null&&(c.data={});var h=c.data;if(h.id==null)h.id=Ts();else if(e.hasElementWithId(h.id)||s.has(h.id))continue;var p=new fi(e,c,!1);a.push(p),s.add(h.id)}t=a}this.length=0;for(var d=0,g=t.length;d<g;d++){var v=t[d][0];if(v!=null){var b=v._private.data.id;(!n||!i.has(b))&&(n&&i.set(b,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(f){this.lazyMap=f},rebuildMap:function(){for(var f=this.lazyMap=new kt,m=this.eles,x=0;x<m.length;x++){var T=m[x];f.set(T.id(),{index:x,ele:T})}}},n&&(this._private.map=i),o&&!r&&this.restore()},Ie=fi.prototype=$e.prototype=Object.create(Array.prototype);Ie.instanceString=function(){return"collection"},Ie.spawn=function(e,t){return new $e(this.cy(),e,t)},Ie.spawnSelf=function(){return this.spawn(this)},Ie.cy=function(){return this._private.cy},Ie.renderer=function(){return this._private.cy.renderer()},Ie.element=function(){return this[0]},Ie.collection=function(){return ds(this)?this:new $e(this._private.cy,[this])},Ie.unique=function(){return new $e(this._private.cy,this,!0)},Ie.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},Ie.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new $e(t)},Ie.$id=Ie.getElementById,Ie.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index},Ie.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},Ie.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},Ie.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(_e(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var o=!1,a={},s=e.data.source,l=e.data.target;s!=null&&s!=i.source&&(a.source=""+s,o=!0),l!=null&&l!=i.target&&(a.target=""+l,o=!0),o&&(t=t.move(a))}else{var u="parent"in e.data,c=e.data.parent;u&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var h=function(g,v,b){var f=e[g];f!=null&&f!==r[g]&&(f?t[v]():t[b]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var p={data:At(r.data),position:At(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};p.classes="";var d=0;return r.classes.forEach(function(g){return p.classes+=d++===0?g:" "+g}),p}}},Ie.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e},Ie.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],i=r.json(),o=new fi(e,i,!1);t.push(o)}return new $e(e,t)},Ie.copy=Ie.clone,Ie.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,o=[],a=[],s,l=0,u=n.length;l<u;l++){var c=n[l];t&&!c.removed()||(c.isNode()?o.push(c):a.push(c))}s=o.concat(a);var h,p=function(){s.splice(h,1),h--};for(h=0;h<s.length;h++){var d=s[h],g=d._private,v=g.data;if(d.clearTraversalCache(),!(!t&&!g.removed)){if(v.id===void 0)v.id=Ts();else if(ee(v.id))v.id=""+v.id;else if($t(v.id)||!le(v.id)){Be("Can not create element with invalid string ID `"+v.id+"`"),p();continue}else if(r.hasElementWithId(v.id)){Be("Can not create second element with ID `"+v.id+"`"),p();continue}}var b=v.id;if(d.isNode()){var f=g.position;f.x==null&&(f.x=0),f.y==null&&(f.y=0)}if(d.isEdge()){for(var m=d,x=["source","target"],T=x.length,_=!1,D=0;D<T;D++){var y=x[D],E=v[y];ee(E)&&(E=v[y]=""+v[y]),E==null||E===""?(Be("Can not create edge `"+b+"` with unspecified "+y),_=!0):r.hasElementWithId(E)||(Be("Can not create edge `"+b+"` with nonexistant "+y+" `"+E+"`"),_=!0)}if(_){p();continue}var w=r.getElementById(v.source),C=r.getElementById(v.target);w.same(C)?w._private.edges.push(m):(w._private.edges.push(m),C._private.edges.push(m)),m._private.source=w,m._private.target=C}g.map=new kt,g.map.set(b,{ele:d,index:0}),g.removed=!1,t&&r.addToPool(d)}for(var A=0;A<o.length;A++){var k=o[A],S=k._private.data;ee(S.parent)&&(S.parent=""+S.parent);var N=S.parent,P=N!=null;if(P||k._private.parent){var R=k._private.parent?r.collection().merge(k._private.parent):r.getElementById(N);if(R.empty())S.parent=void 0;else if(R[0].removed())Le("Node added with missing parent, reference to parent removed"),S.parent=void 0,k._private.parent=null;else{for(var I=!1,O=R;!O.empty();){if(k.same(O)){I=!0,S.parent=void 0;break}O=O.parent()}I||(R[0]._private.children.push(k),k._private.parent=R[0],i.hasCompoundNodes=!0)}}}if(s.length>0){for(var M=s.length===n.length?n:new $e(r,s),G=0;G<M.length;G++){var B=M[G];B.isNode()||(B.parallelEdges().clearTraversalCache(),B.source().clearTraversalCache(),B.target().clearTraversalCache())}var V;i.hasCompoundNodes?V=r.collection().merge(M).merge(M.connectedNodes()).merge(M.parent()):V=M,V.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?M.emitAndNotify("add"):t&&M.emit("add")}return n},Ie.removed=function(){var e=this[0];return e&&e._private.removed},Ie.inside=function(){var e=this[0];return e&&!e._private.removed},Ie.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},o=n._private.cy;function a(N){for(var P=N._private.edges,R=0;R<P.length;R++)l(P[R])}function s(N){for(var P=N._private.children,R=0;R<P.length;R++)l(P[R])}function l(N){var P=i[N.id()];t&&N.removed()||P||(i[N.id()]=!0,N.isNode()?(r.push(N),a(N),s(N)):r.unshift(N))}for(var u=0,c=n.length;u<c;u++){var h=n[u];l(h)}function p(N,P){var R=N._private.edges;jt(R,P),N.clearTraversalCache()}function d(N){N.clearTraversalCache()}var g=[];g.ids={};function v(N,P){P=P[0],N=N[0];var R=N._private.children,I=N.id();jt(R,P),P._private.parent=null,g.ids[I]||(g.ids[I]=!0,g.push(N))}n.dirtyCompoundBoundsCache(),t&&o.removeFromPool(r);for(var b=0;b<r.length;b++){var f=r[b];if(f.isEdge()){var m=f.source()[0],x=f.target()[0];p(m,f),p(x,f);for(var T=f.parallelEdges(),_=0;_<T.length;_++){var D=T[_];d(D),D.isBundledBezier()&&D.dirtyBoundingBoxCache()}}else{var y=f.parent();y.length!==0&&v(y,f)}t&&(f._private.removed=!0)}var E=o._private.elements;o._private.hasCompoundNodes=!1;for(var w=0;w<E.length;w++){var C=E[w];if(C.isParent()){o._private.hasCompoundNodes=!0;break}}var A=new $e(this.cy(),r);A.size()>0&&(e?A.emitAndNotify("remove"):t&&A.emit("remove"));for(var k=0;k<g.length;k++){var S=g[k];(!t||!S.removed())&&S.updateStyle()}return A},Ie.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,o=function(d){return d==null?d:""+d};if(e.source!==void 0||e.target!==void 0){var a=o(e.source),s=o(e.target),l=a!=null&&t.hasElementWithId(a),u=s!=null&&t.hasElementWithId(s);(l||u)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify("moveout");for(var d=0;d<n.length;d++){var g=n[d],v=g._private.data;g.isEdge()&&(l&&(v.source=a),u&&(v.target=s))}n.restore(r,i)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var c=o(e.parent),h=c===null||t.hasElementWithId(c);if(h){var p=c===null?void 0:c;t.batch(function(){var d=n.remove(r,i);d.emitAndNotify("moveout");for(var g=0;g<n.length;g++){var v=n[g],b=v._private.data;v.isNode()&&(b.parent=p)}d.restore(r,i)}),n.emitAndNotify("move")}}return this},[Ms,$f,zr,Vt,On,hv,ii,Av,Ks,Zs,Iv,ai,Gr,qe,qt,nt].forEach(function(e){de(Ie,e)});var zv={add:function(e){var t,n=this;if(ht(e)){var r=e;if(r._private.cy===n)t=r.restore();else{for(var i=[],o=0;o<r.length;o++){var a=r[o];i.push(a.json())}t=new $e(n,i)}}else if(Se(e)){var s=e;t=new $e(n,s)}else if(_e(e)&&(Se(e.nodes)||Se(e.edges))){for(var l=e,u=[],c=["nodes","edges"],h=0,p=c.length;h<p;h++){var d=c[h],g=l[d];if(Se(g))for(var v=0,b=g.length;v<b;v++){var f=de({group:d},g[v]);u.push(f)}}t=new $e(n,u)}else{var m=e;t=new fi(n,m).collection()}return t},remove:function(e){if(!ht(e)&&le(e)){var t=e;e=this.$(t)}return e.remove()}};function Gv(e,t,n,r){var i=4,o=.001,a=1e-7,s=10,l=11,u=1/(l-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var p=c?new Float32Array(l):new Array(l);function d(C,A){return 1-3*A+3*C}function g(C,A){return 3*A-6*C}function v(C){return 3*C}function b(C,A,k){return((d(A,k)*C+g(A,k))*C+v(A))*C}function f(C,A,k){return 3*d(A,k)*C*C+2*g(A,k)*C+v(A)}function m(C,A){for(var k=0;k<i;++k){var S=f(A,e,n);if(S===0)return A;var N=b(A,e,n)-C;A-=N/S}return A}function x(){for(var C=0;C<l;++C)p[C]=b(C*u,e,n)}function T(C,A,k){var S,N,P=0;do N=A+(k-A)/2,S=b(N,e,n)-C,S>0?k=N:A=N;while(Math.abs(S)>a&&++P<s);return N}function _(C){for(var A=0,k=1,S=l-1;k!==S&&p[k]<=C;++k)A+=u;--k;var N=(C-p[k])/(p[k+1]-p[k]),P=A+N*u,R=f(P,e,n);return R>=o?m(C,P):R===0?P:T(C,A,A+u)}var D=!1;function y(){D=!0,(e!==t||n!==r)&&x()}var E=function(C){return D||y(),e===t&&n===r?C:C===0?0:C===1?1:b(_(C),t,r)};E.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var w="generateBezier("+[e,t,n,r]+")";return E.toString=function(){return w},E}var Yv=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,i,o){var a={x:r.x+o.dx*i,v:r.v+o.dv*i,tension:r.tension,friction:r.friction};return{dx:a.v,dv:e(a)}}function n(r,i){var o={dx:r.v,dv:e(r)},a=t(r,i*.5,o),s=t(r,i*.5,a),l=t(r,i,s),u=1/6*(o.dx+2*(a.dx+s.dx)+l.dx),c=1/6*(o.dv+2*(a.dv+s.dv)+l.dv);return r.x=r.x+u*i,r.v=r.v+c*i,r}return function r(i,o,a){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,c=1/1e4,h=16/1e3,p,d,g;for(i=parseFloat(i)||500,o=parseFloat(o)||20,a=a||null,s.tension=i,s.friction=o,p=a!==null,p?(u=r(i,o),d=u/a*h):d=h;g=n(g||s,d),l.push(1+g.x),u+=16,Math.abs(g.x)>c&&Math.abs(g.v)>c;);return p?function(v){return l[v*(l.length-1)|0]}:u}}(),Pe=function(e,t,n,r){var i=Gv(e,t,n,r);return function(o,a,s){return o+(a-o)*i(s)}},Yr={linear:function(e,t,n){return e+(t-e)*n},ease:Pe(.25,.1,.25,1),"ease-in":Pe(.42,0,1,1),"ease-out":Pe(0,0,.58,1),"ease-in-out":Pe(.42,0,.58,1),"ease-in-sine":Pe(.47,0,.745,.715),"ease-out-sine":Pe(.39,.575,.565,1),"ease-in-out-sine":Pe(.445,.05,.55,.95),"ease-in-quad":Pe(.55,.085,.68,.53),"ease-out-quad":Pe(.25,.46,.45,.94),"ease-in-out-quad":Pe(.455,.03,.515,.955),"ease-in-cubic":Pe(.55,.055,.675,.19),"ease-out-cubic":Pe(.215,.61,.355,1),"ease-in-out-cubic":Pe(.645,.045,.355,1),"ease-in-quart":Pe(.895,.03,.685,.22),"ease-out-quart":Pe(.165,.84,.44,1),"ease-in-out-quart":Pe(.77,0,.175,1),"ease-in-quint":Pe(.755,.05,.855,.06),"ease-out-quint":Pe(.23,1,.32,1),"ease-in-out-quint":Pe(.86,0,.07,1),"ease-in-expo":Pe(.95,.05,.795,.035),"ease-out-expo":Pe(.19,1,.22,1),"ease-in-out-expo":Pe(1,0,0,1),"ease-in-circ":Pe(.6,.04,.98,.335),"ease-out-circ":Pe(.075,.82,.165,1),"ease-in-out-circ":Pe(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Yr.linear;var r=Yv(e,t,n);return function(i,o,a){return i+(o-i)*r(a)}},"cubic-bezier":Pe};function Co(e,t,n,r,i){if(r===1||t===n)return n;var o=i(t,n,r);return e==null||((e.roundValue||e.color)&&(o=Math.round(o)),e.min!==void 0&&(o=Math.max(o,e.min)),e.max!==void 0&&(o=Math.min(o,e.max))),o}function Ao(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function vn(e,t,n,r,i){var o=i!=null?i.type:null;n<0?n=0:n>1&&(n=1);var a=Ao(e,i),s=Ao(t,i);if(ee(a)&&ee(s))return Co(o,a,s,n,r);if(Se(a)&&Se(s)){for(var l=[],u=0;u<s.length;u++){var c=a[u],h=s[u];if(c!=null&&h!=null){var p=Co(o,c,h,n,r);l.push(p)}else l.push(h)}return l}}function Vv(e,t,n,r){var i=!r,o=e._private,a=t._private,s=a.easing,l=a.startTime,u=r?e:e.cy(),c=u.style();if(!a.easingImpl)if(s==null)a.easingImpl=Yr.linear;else{var h;if(le(s)){var p=c.parse("transition-timing-function",s);h=p.value}else h=s;var d,g;le(h)?(d=h,g=[]):(d=h[1],g=h.slice(2).map(function(M){return+M})),g.length>0?(d==="spring"&&g.push(a.duration),a.easingImpl=Yr[d].apply(null,g)):a.easingImpl=Yr[d]}var v=a.easingImpl,b;if(a.duration===0?b=1:b=(n-l)/a.duration,a.applying&&(b=a.progress),b<0?b=0:b>1&&(b=1),a.delay==null){var f=a.startPosition,m=a.position;if(m&&i&&!e.locked()){var x={};jn(f.x,m.x)&&(x.x=vn(f.x,m.x,b,v)),jn(f.y,m.y)&&(x.y=vn(f.y,m.y,b,v)),e.position(x)}var T=a.startPan,_=a.pan,D=o.pan,y=_!=null&&r;y&&(jn(T.x,_.x)&&(D.x=vn(T.x,_.x,b,v)),jn(T.y,_.y)&&(D.y=vn(T.y,_.y,b,v)),e.emit("pan"));var E=a.startZoom,w=a.zoom,C=w!=null&&r;C&&(jn(E,w)&&(o.zoom=lr(o.minZoom,vn(E,w,b,v),o.maxZoom)),e.emit("zoom")),(y||C)&&e.emit("viewport");var A=a.style;if(A&&A.length>0&&i){for(var k=0;k<A.length;k++){var S=A[k],N=S.name,P=S,R=a.startStyle[N],I=c.properties[R.name],O=vn(R,P,b,v,I);c.overrideBypass(e,N,O)}e.emit("style")}}return a.progress=b,b}function jn(e,t){return e==null||t==null?!1:ee(e)&&ee(t)?!0:!!(e&&t)}function Uv(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function ko(e,t){var n=t._private.aniEles,r=[];function i(c,h){var p=c._private,d=p.animation.current,g=p.animation.queue,v=!1;if(d.length===0){var b=g.shift();b&&d.push(b)}for(var f=function(_){for(var D=_.length-1;D>=0;D--){var y=_[D];y()}_.splice(0,_.length)},m=d.length-1;m>=0;m--){var x=d[m],T=x._private;if(T.stopped){d.splice(m,1),T.hooked=!1,T.playing=!1,T.started=!1,f(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||Uv(c,x,e),Vv(c,x,e,h),T.applying&&(T.applying=!1),f(T.frames),T.step!=null&&T.step(e),x.completed()&&(d.splice(m,1),T.hooked=!1,T.playing=!1,T.started=!1,f(T.completes)),v=!0)}return!h&&d.length===0&&g.length===0&&r.push(c),v}for(var o=!1,a=0;a<n.length;a++){var s=n[a],l=i(s);o=o||l}var u=i(t,!0);(o||u)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Xv={animate:ke.animate(),animation:ke.animation(),animated:ke.animated(),clearQueue:ke.clearQueue(),delay:ke.delay(),delayAnimation:ke.delayAnimation(),stop:ke.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&Jr(function(r){ko(r,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(r,i){ko(i,e)},n.beforeRenderPriorities.animations):t()}},jv={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&mr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Ir=function(e){return le(e)?new Kt(e):e},el={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new mi(jv,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ir(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ir(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ir(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ir(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ke.eventAliasesOn(el);var Xi={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Xi.jpeg=Xi.jpg;var Vr={layout:function(e){var t=this;if(e==null){Be("Layout options must be specified to make a layout");return}if(e.name==null){Be("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension("layout",n);if(r==null){Be("No such layout `"+n+"` found.  Did you forget to import it and `cytoscape.use()` it?");return}var i;le(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new r(de({},e,{cy:t,eles:i}));return o}};Vr.createLayout=Vr.makeLayout=Vr.layout;var Hv={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r<n.length;r++){var i=n[r],o=e[i],a=t.getElementById(i);a.data(o)}})}},Wv=Ke({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),ji={renderTo:function(e,t,n,r){var i=this._private.renderer;return i.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this,n=t.extension("renderer",e.name);if(n==null){Be("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Le("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var r=Wv(e);r.cy=t,t._private.renderer=new n(r),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var t=e.container();if(t)for(t._cyreg=null;t.childNodes.length>0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ji.invalidateDimensions=ji.resize;var Ur={collection:function(e,t){return le(e)?this.$(e):ht(e)?e.collection():Se(e)?(t||(t={}),new $e(this,e,t.unique,t.removed)):new $e(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ur.elements=Ur.filter=Ur.$;var et={},Hn="t",qv="f";et.apply=function(e){for(var t=this,n=t._private,r=n.cy,i=r.collection(),o=0;o<e.length;o++){var a=e[o],s=t.getContextMeta(a);if(!s.empty){var l=t.getContextStyle(s),u=t.applyContextStyle(s,l,a);a._private.appliedInitStyle?t.updateTransitions(a,u.diffProps):a._private.appliedInitStyle=!0;var c=t.updateStyleHints(a);c&&i.push(a)}}return i},et.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+"-"+t,o=r[i];if(o)return o;for(var a=[],s={},l=0;l<n.length;l++){var u=n[l],c=e[l]===Hn,h=t[l]===Hn,p=c!==h,d=u.mappedProperties.length>0;if(p||h&&d){var g=void 0;p&&d||p?g=u.properties:d&&(g=u.mappedProperties);for(var v=0;v<g.length;v++){for(var b=g[v],f=b.name,m=!1,x=l+1;x<n.length;x++){var T=n[x],_=t[x]===Hn;if(_&&(m=T.properties[b.name]!=null,m))break}!s[f]&&!m&&(s[f]=!0,a.push(f))}}}return r[i]=a,a},et.getContextMeta=function(e){for(var t=this,n="",r,i=e._private.styleCxtKey||"",o=0;o<t.length;o++){var a=t[o],s=a.selector&&a.selector.matches(e);s?n+=Hn:n+=qv}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},et.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},o=0;o<n.length;o++){var a=n[o],s=t[o]===Hn;if(s)for(var l=0;l<a.properties.length;l++){var u=a.properties[l];i[u.name]=u}}return r[t]=i,i},et.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,o={},a=r.types,s=0;s<i.length;s++){var l=i[s],u=t[l],c=n.pstyle(l);if(!u)if(c)c.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(c!==u){if(u.mapped===a.fn&&c!=null&&c.mapping!=null&&c.mapping.value===u.value){var h=c.mapping,p=h.fnValue=u.value(n);if(p===h.prevFnValue)continue}var d=o[l]={prev:c};r.applyParsedProperty(n,u),d.next=n.pstyle(l),d.next&&d.next.bypass&&(d.next=d.next.bypassed)}}return{diffProps:o}},et.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,o=function(Z,te,pe){return n.getPropertiesHash(Z,te,pe)},a=t.styleKey;if(e.removed())return!1;var s=t.group==="nodes",l=e._private.style;r=Object.keys(l);for(var u=0;u<i.length;u++){var c=i[u];t.styleKeys[c]=[kn,qn]}for(var h=function(Z,te){return t.styleKeys[te][0]=or(Z,t.styleKeys[te][0])},p=function(Z,te){return t.styleKeys[te][1]=sr(Z,t.styleKeys[te][1])},d=function(Z,te){h(Z,te),p(Z,te)},g=function(Z,te){for(var pe=0;pe<Z.length;pe++){var ue=Z.charCodeAt(pe);h(ue,te),p(ue,te)}},v=2e9,b=function(Z){return-128<Z&&Z<128&&Math.floor(Z)!==Z?v-(Z*1024|0):Z},f=0;f<r.length;f++){var m=r[f],x=l[m];if(x!=null){var T=this.properties[m],_=T.type,D=T.groupKey,y=void 0;T.hashOverride!=null?y=T.hashOverride(e,x):x.pfValue!=null&&(y=x.pfValue);var E=T.enums==null?x.value:null,w=y!=null,C=E!=null,A=w||C,k=x.units;if(_.number&&A&&!_.multiple){var S=w?y:E;d(b(S),D),!w&&k!=null&&g(k,D)}else g(x.strValue,D)}}for(var N=[kn,qn],P=0;P<i.length;P++){var R=i[P],I=t.styleKeys[R];N[0]=or(I[0],N[0]),N[1]=sr(I[1],N[1])}t.styleKey=og(N[0],N[1]);var O=t.styleKeys;t.labelDimsKey=Bt(O.labelDimensions);var M=o(e,["label"],O.labelDimensions);if(t.labelKey=Bt(M),t.labelStyleKey=Bt(_r(O.commonLabel,M)),!s){var G=o(e,["source-label"],O.labelDimensions);t.sourceLabelKey=Bt(G),t.sourceLabelStyleKey=Bt(_r(O.commonLabel,G));var B=o(e,["target-label"],O.labelDimensions);t.targetLabelKey=Bt(B),t.targetLabelStyleKey=Bt(_r(O.commonLabel,B))}if(s){var V=t.styleKeys,F=V.nodeBody,U=V.nodeBorder,Q=V.nodeOutline,z=V.backgroundImage,q=V.compound,H=V.pie,$=[F,U,Q,z,q,H].filter(function(Z){return Z!=null}).reduce(_r,[kn,qn]);t.nodeKey=Bt($),t.hasPie=H!=null&&H[0]!==kn&&H[1]!==qn}return a!==t.styleKey},et.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},et.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,o,a=n.types,s=n.properties[r.name].type,l=r.bypass,u=i[r.name],c=u&&u.bypass,h=e._private,p="mapping",d=function(V){return V==null?null:V.pfValue!=null?V.pfValue:V.value},g=function(){var V=d(u),F=d(r);n.checkTriggers(e,r.name,V,F)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",l)),r.delete)return i[r.name]=void 0,g(),!0;if(r.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,g(),!0):!1:(g(),!0);if(r.deleteBypass)return u?u.bypass?(i[r.name]=u.bypassed,g(),!0):!1:(g(),!0);var v=function(){Le("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case a.mapData:{for(var b=r.field.split("."),f=h.data,m=0;m<b.length&&f;m++){var x=b[m];f=f[x]}if(f==null)return v(),!1;var T;if(ee(f)){var _=r.fieldMax-r.fieldMin;_===0?T=0:T=(f-r.fieldMin)/_}else return Le("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+f+"` for `"+e.id()+"` is non-numeric)"),!1;if(T<0?T=0:T>1&&(T=1),s.color){var D=r.valueMin[0],y=r.valueMax[0],E=r.valueMin[1],w=r.valueMax[1],C=r.valueMin[2],A=r.valueMax[2],k=r.valueMin[3]==null?1:r.valueMin[3],S=r.valueMax[3]==null?1:r.valueMax[3],N=[Math.round(D+(y-D)*T),Math.round(E+(w-E)*T),Math.round(C+(A-C)*T),Math.round(k+(S-k)*T)];o={bypass:r.bypass,name:r.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(s.number){var P=r.valueMin+(r.valueMax-r.valueMin)*T;o=this.parse(r.name,P,r.bypass,p)}else return!1;if(!o)return v(),!1;o.mapping=r,r=o;break}case a.data:{for(var R=r.field.split("."),I=h.data,O=0;O<R.length&&I;O++){var M=R[O];I=I[M]}if(I!=null&&(o=this.parse(r.name,I,r.bypass,p)),!o)return v(),!1;o.mapping=r,r=o;break}case a.fn:{var G=r.value,B=r.fnValue!=null?r.fnValue:G(e);if(r.prevFnValue=B,B==null)return Le("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(o=this.parse(r.name,B,r.bypass,p),!o)return Le("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;o.mapping=At(r),r=o;break}case void 0:break;default:return!1}return l?(c?r.bypassed=u.bypassed:r.bypassed=u,i[r.name]=r):c?u.bypassed=r:i[r.name]=r,g(),!0},et.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,o=Object.keys(i),a=0;a<o.length;a++){var s=o[a],l=i[s];l!=null&&(l.bypass?l.bypassed=null:i[s]=null)}}},et.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()},et.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,o=e.pstyle("transition-duration").pfValue,a=e.pstyle("transition-delay").pfValue;if(i.length>0&&o>0){for(var s={},l=!1,u=0;u<i.length;u++){var c=i[u],h=e.pstyle(c),p=t[c];if(p){var d=p.prev,g=d,v=p.next!=null?p.next:h,b=!1,f=void 0,m=1e-6;g&&(ee(g.pfValue)&&ee(v.pfValue)?(b=v.pfValue-g.pfValue,f=g.pfValue+m*b):ee(g.value)&&ee(v.value)?(b=v.value-g.value,f=g.value+m*b):Se(g.value)&&Se(v.value)&&(b=g.value[0]!==v.value[0]||g.value[1]!==v.value[1]||g.value[2]!==v.value[2],f=g.strValue),b&&(s[c]=v.strValue,this.applyBypass(e,c,f),l=!0))}}if(!l)return;r.transitioning=!0,new Rn(function(x){a>0?e.delayAnimation(a).play().promise().then(x):x()}).then(function(){return e.animation({style:s,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},et.checkTrigger=function(e,t,n,r,i,o){var a=this.properties[t],s=i(a);s!=null&&s(n,r)&&o(a)},et.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(o){return o.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},et.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(i){return i.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&t==="curve-style"&&(n==="bezier"||r==="bezier")&&e.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&t==="display"&&(n==="none"||r==="none")&&e.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})},et.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Qn={};Qn.applyBypass=function(e,t,n,r){var i=this,o=[],a=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var s=0;s<i.properties.length;s++){var l=i.properties[s],u=l.name,c=this.parse(u,n,!0);c&&o.push(c)}}else if(le(t)){var h=this.parse(t,n,!0);h&&o.push(h)}else if(_e(t)){var p=t;r=n;for(var d=Object.keys(p),g=0;g<d.length;g++){var v=d[g],b=p[v];if(b===void 0&&(b=p[gi(v)]),b!==void 0){var f=this.parse(v,b,!0);f&&o.push(f)}}}else return!1;if(o.length===0)return!1;for(var m=!1,x=0;x<e.length;x++){for(var T=e[x],_={},D=void 0,y=0;y<o.length;y++){var E=o[y];if(r){var w=T.pstyle(E.name);D=_[E.name]={prev:w}}m=this.applyParsedProperty(T,At(E))||m,r&&(D.next=T.pstyle(E.name))}m&&this.updateStyleHints(T),r&&this.updateTransitions(T,_,a)}return m},Qn.overrideBypass=function(e,t,n){t=ca(t);for(var r=0;r<e.length;r++){var i=e[r],o=i._private.style[t],a=this.properties[t].type,s=a.color,l=a.mutiple,u=o?o.pfValue!=null?o.pfValue:o.value:null;!o||!o.bypass?this.applyBypass(i,t,n):(o.value=n,o.pfValue!=null&&(o.pfValue=n),s?o.strValue="rgb("+n.join(",")+")":l?o.strValue=n.join(" "):o.strValue=""+n,this.updateStyleHints(i)),this.checkTriggers(i,t,u,n)}},Qn.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},Qn.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var o=e[i],a={},s=0;s<t.length;s++){var l=t[s],u=this.properties[l],c=o.pstyle(u.name);if(!(!c||!c.bypass)){var h="",p=this.parse(l,h,!0),d=a[u.name]={prev:c};this.applyParsedProperty(o,p),d.next=o.pstyle(u.name)}}this.updateStyleHints(o),n&&this.updateTransitions(o,a,r)}};var Hi={};Hi.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1},Hi.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var Tt={};Tt.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},Tt.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var o=n.properties[i],a=n.getStylePropertyValue(e,o.name,t);a!=null&&(r[o.name]=a,r[gi(o.name)]=a)}return r}},Tt.getIndexedStyle=function(e,t,n,r){var i=e.pstyle(t)[n][r];return i!=null?i:e.cy().style().getDefaultProperty(t)[n][0]},Tt.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var o=i.type,a=e.pstyle(i.name);if(a){var s=a.value,l=a.units,u=a.strValue;if(n&&o.number&&s!=null&&ee(s)){var c=e.cy().zoom(),h=function(v){return v*c},p=function(v,b){return h(v)+b},d=Se(s),g=d?l.every(function(v){return v!=null}):l!=null;return g?d?s.map(function(v,b){return p(v,l[b])}).join(" "):p(s,l):d?s.map(function(v){return le(v)?v:""+h(v)}).join(" "):""+h(s)}else if(u!=null)return u}return null}},Tt.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],o=i.name,a=e.pstyle(o);a!==void 0&&(_e(a)?a=this.parse(o,a.strValue):a=this.parse(o,a)),a&&(n[o]=a)}return n},Tt.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var o=Object.keys(r),a=0;a<o.length;a++){var s=o[a],l=r[s],u=i[s]||i[ca(s)],c=this.parse(u.name,l);c&&n.push(c)}return n},Tt.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,o,a,s,l,u;for(l=0;l<t.length;l++)if(i=t[l],o=e.pstyle(i,!1),o!=null)if(o.pfValue!=null)r[0]=or(s,r[0]),r[1]=sr(s,r[1]);else for(a=o.strValue,u=0;u<a.length;u++)s=a.charCodeAt(u),r[0]=or(s,r[0]),r[1]=sr(s,r[1]);return r},Tt.getPropertiesHash=Tt.getNonDefaultPropertiesHash;var Xr={};Xr.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,o=r.style||r.css,a=Object.keys(o);t.selector(i);for(var s=0;s<a.length;s++){var l=a[s],u=o[l];t.css(l,u)}}return t},Xr.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},Xr.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,o={},a=0;a<i.length;a++){var s=i[a];o[s.name]=s.strValue}e.push({selector:r?r.toString():"core",style:o})}return e};var Wi={};Wi.appendFromString=function(e){var t=this,n=this,r=""+e,i,o,a;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function s(){r.length>i.length?r=r.substr(i.length):r=""}function l(){o.length>a.length?o=o.substr(a.length):o=""}for(;;){var u=r.match(/^\s*$/);if(u)break;var c=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Le("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}i=c[0];var h=c[1];if(h!=="core"){var p=new Kt(h);if(p.invalid){Le("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),s();continue}}var d=c[2],g=!1;o=d;for(var v=[];;){var b=o.match(/^\s*$/);if(b)break;var f=o.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!f){Le("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),g=!0;break}a=f[0];var m=f[1],x=f[2],T=t.properties[m];if(!T){Le("Skipping property: Invalid property name in: "+a),l();continue}var _=n.parse(m,x);if(!_){Le("Skipping property: Invalid property definition in: "+a),l();continue}v.push({name:m,val:x}),l()}if(g){s();break}n.selector(h);for(var D=0;D<v.length;D++){var y=v[D];n.css(y.name,y.val)}s()}return n},Wi.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var We={};(function(){var e=Ye,t=Wp,n=$p,r=Kp,i=Zp,o=function(H){return"^"+H+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},a=function(H){var $=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+i;return"^"+H+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+$+")\\s*\\,\\s*("+$+")\\)$"},s=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];We.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:o("data")},layoutData:{mapping:!0,regex:o("layoutData")},scratch:{mapping:!0,regex:o("scratch")},mapData:{mapping:!0,regex:a("mapData")},mapLayoutData:{mapping:!0,regex:a("mapLayoutData")},mapScratch:{mapping:!0,regex:a("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:s,singleRegexMatchValue:!0},urls:{regexes:s,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(H,$){switch(H.length){case 2:return $[0]!=="deg"&&$[0]!=="rad"&&$[1]!=="deg"&&$[1]!=="rad";case 1:return le(H[0])||$[0]==="deg"||$[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(H){var $=H.length;return $===1||$===2||$===4}}};var l={zeroNonZero:function(H,$){return(H==null||$==null)&&H!==$||H==0&&$!=0?!0:H!=0&&$==0},any:function(H,$){return H!=$},emptyNonEmpty:function(H,$){var Z=$t(H),te=$t($);return Z&&!te||!Z&&te}},u=We.types,c=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],p=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],d=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],g=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],v=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],b=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],f=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any}],x=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],T=function(H,$){return $.value==="label"?-H.poolIndex():$.pfValue},_=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:T},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:T},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],D=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle}],y=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],E=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],w=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],C=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],A=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],k=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],S=[];We.pieBackgroundN=16,S.push({name:"pie-size",type:u.sizeMaybePercent});for(var N=1;N<=We.pieBackgroundN;N++)S.push({name:"pie-"+N+"-background-color",type:u.color}),S.push({name:"pie-"+N+"-background-size",type:u.percent}),S.push({name:"pie-"+N+"-background-opacity",type:u.zeroOneNumber});var P=[],R=We.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(H){R.forEach(function($){var Z=$+"-"+H.name,te=H.type,pe=H.triggersBounds;P.push({name:Z,type:te,triggersBounds:pe})})},{});var I=We.properties=[].concat(v,x,b,f,m,A,g,d,c,h,p,_,D,y,E,S,w,C,P,k),O=We.propertyGroups={behavior:v,transition:x,visibility:b,overlay:f,underlay:m,ghost:A,commonLabel:g,labelDimensions:d,mainLabel:c,sourceLabel:h,targetLabel:p,nodeBody:_,nodeBorder:D,nodeOutline:y,backgroundImage:E,pie:S,compound:w,edgeLine:C,edgeArrow:P,core:k},M=We.propertyGroupNames={},G=We.propertyGroupKeys=Object.keys(O);G.forEach(function(H){M[H]=O[H].map(function($){return $.name}),O[H].forEach(function($){return $.groupKey=H})});var B=We.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];We.propertyNames=I.map(function(H){return H.name});for(var V=0;V<I.length;V++){var F=I[V];I[F.name]=F}for(var U=0;U<B.length;U++){var Q=B[U],z=I[Q.pointsTo],q={name:Q.name,alias:!0,pointsTo:z};I.push(q),I[Q.name]=q}})(),We.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},We.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=de({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1,   1, -1,   1, 1,   -1, 1","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var c=1;c<=We.pieBackgroundN;c++){var h=u.name.replace("{{i}}",c),p=u.value;l[h]=p}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"taxi-turn":"50%","taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(l,u){return We.arrowPrefixes.forEach(function(c){var h=c+"-"+u.name,p=u.value;l[h]=p}),l},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var o=i.name,a=t[o],s=this.parse(o,a);n[o]=s}}return e.defaultProperties=n,e.defaultProperties},We.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var jr={};jr.parse=function(e,t,n,r){var i=this;if(Me(t))return i.parseImplWarn(e,t,n,r);var o=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,a=n?"t":"f",s=""+t,l=ws(e,s,a,o),u=i.propCache=i.propCache||[],c;return(c=u[l])||(c=u[l]=i.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(c=At(c),c&&(c.value=At(c.value))),c},jr.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&Le("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&t==="label"&&Le("The style value of `label` is deprecated for `"+i.name+"`"),i},jr.parseImpl=function(e,t,n,r){var i=this;e=ca(e);var o=i.properties[e],a=t,s=i.types;if(!o||t===void 0)return null;o.alias&&(o=o.pointsTo,e=o.name);var l=le(t);l&&(t=t.trim());var u=o.type;if(!u)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Me(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};var c,h;if(!(!l||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(c=new RegExp(s.data.regex).exec(t))){if(n)return!1;var p=s.data;return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(h=new RegExp(s.mapData.regex).exec(t))){if(n||u.multiple)return!1;var d=s.mapData;if(!(u.color||u.number))return!1;var g=this.parse(e,h[4]);if(!g||g.mapped)return!1;var v=this.parse(e,h[5]);if(!v||v.mapped)return!1;if(g.pfValue===v.pfValue||g.strValue===v.strValue)return Le("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(u.color){var b=g.value,f=v.value,m=b[0]===f[0]&&b[1]===f[1]&&b[2]===f[2]&&(b[3]===f[3]||(b[3]==null||b[3]===1)&&(f[3]==null||f[3]===1));if(m)return!1}return{name:e,value:h,strValue:""+t,mapped:d,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:g.value,valueMax:v.value,bypass:n}}}if(u.multiple&&r!=="multiple"){var x;if(l?x=t.split(/\s+/):Se(t)?x=t:x=[t],u.evenMultiple&&x.length%2!==0)return null;for(var T=[],_=[],D=[],y="",E=!1,w=0;w<x.length;w++){var C=i.parse(e,x[w],n,"multiple");E=E||le(C.value),T.push(C.value),D.push(C.pfValue!=null?C.pfValue:C.value),_.push(C.units),y+=(w>0?" ":"")+C.strValue}return u.validate&&!u.validate(T,_)?null:u.singleEnum&&E?T.length===1&&le(T[0])?{name:e,value:T[0],strValue:T[0],bypass:n}:null:{name:e,value:T,pfValue:D,strValue:y,bypass:n,units:_}}var A=function(){for(var H=0;H<u.enums.length;H++){var $=u.enums[H];if($===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(u.number){var k,S="px";if(u.units&&(k=u.units),u.implicitUnits&&(S=u.implicitUnits),!u.unitless)if(l){var N="px|em"+(u.allowPercent?"|\\%":"");k&&(N=k);var P=t.match("^("+Ye+")("+N+")?$");P&&(t=P[1],k=P[2]||S)}else(!k||u.implicitUnits)&&(k=S);if(t=parseFloat(t),isNaN(t)&&u.enums===void 0)return null;if(isNaN(t)&&u.enums!==void 0)return t=a,A();if(u.integer&&!Gp(t)||u.min!==void 0&&(t<u.min||u.strictMin&&t===u.min)||u.max!==void 0&&(t>u.max||u.strictMax&&t===u.max))return null;var R={name:e,value:t,strValue:""+t+(k||""),units:k,bypass:n};return u.unitless||k!=="px"&&k!=="em"?R.pfValue=t:R.pfValue=k==="px"||!k?t:this.getEmSizeInPixels()*t,(k==="ms"||k==="s")&&(R.pfValue=k==="ms"?t:1e3*t),(k==="deg"||k==="rad")&&(R.pfValue=k==="rad"?t:Mg(t)),k==="%"&&(R.pfValue=t/100),R}else if(u.propList){var I=[],O=""+t;if(O!=="none"){for(var M=O.split(/\s*,\s*|\s+/),G=0;G<M.length;G++){var B=M[G].trim();i.properties[B]?I.push(B):Le("`"+B+"` is not a valid property name")}if(I.length===0)return null}return{name:e,value:I,strValue:I.length===0?"none":I.join(" "),bypass:n}}else if(u.color){var V=rg(t);return V?{name:e,value:V,pfValue:V,strValue:"rgb("+V[0]+","+V[1]+","+V[2]+")",bypass:n}:null}else if(u.regex||u.regexes){if(u.enums){var F=A();if(F)return F}for(var U=u.regexes?u.regexes:[u.regex],Q=0;Q<U.length;Q++){var z=new RegExp(U[Q]),q=z.exec(t);if(q)return{name:e,value:u.singleRegexMatchValue?q[1]:q,strValue:""+t,bypass:n}}return null}else return u.string?{name:e,value:""+t,strValue:""+t,bypass:n}:u.enums?A():null};var rt=function e(t){if(!(this instanceof e))return new e(t);if(!ua(t)){Be("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},Je=rt.prototype;Je.instanceString=function(){return"style"},Je.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(i){var o=i[0]._private;o.styleDirty=!0,o.appliedInitStyle=!1}),this},Je.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Je.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Je.selector=function(e){var t=e==="core"?null:new Kt(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Je.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],o=n[i.name];o===void 0&&(o=n[gi(i.name)]),o!==void 0&&this.cssRule(i.name,o)}else t.length===2&&this.cssRule(t[0],t[1]);return this},Je.style=Je.css,Je.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n);var i=!this[r].selector;i&&(this._private.coreStyle[n.name]=n)}return this},Je.append=function(e){return ps(e)?e.appendToStyle(this):Se(e)?this.appendFromJson(e):le(e)&&this.appendFromString(e),this},rt.fromJson=function(e,t){var n=new rt(e);return n.fromJson(t),n},rt.fromString=function(e,t){return new rt(e).fromString(t)},[et,Qn,Hi,Tt,Xr,Wi,We,jr].forEach(function(e){de(Je,e)}),rt.types=Je.types,rt.properties=Je.properties,rt.propertyGroups=Je.propertyGroups,rt.propertyGroupNames=Je.propertyGroupNames,rt.propertyGroupKeys=Je.propertyGroupKeys;var $v={style:function(e){if(e){var t=this.setStyle(e);t.update()}return this._private.style},setStyle:function(e){var t=this._private;return ps(e)?t.style=e.generateStyle(this):Se(e)?t.style=rt.fromJson(this,e):le(e)?t.style=rt.fromString(this,e):t.style=rt(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},Kv="single",an={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var t=this._private;if(t.selectionType==null&&(t.selectionType=Kv),e!==void 0)(e==="additive"||e==="single")&&(t.selectionType=e);else return t.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,t=this._private.pan,n,r,i,o,a;switch(e.length){case 0:return t;case 1:if(le(e[0]))return n=e[0],t[n];if(_e(e[0])){if(!this._private.panningEnabled)return this;i=e[0],o=i.x,a=i.y,ee(o)&&(t.x=o),ee(a)&&(t.y=a),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;n=e[0],r=e[1],(n==="x"||n==="y")&&ee(r)&&(t[n]=r),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,t){var n=arguments,r=this._private.pan,i,o,a,s,l;if(!this._private.panningEnabled)return this;switch(n.length){case 1:_e(e)&&(a=n[0],s=a.x,l=a.y,ee(s)&&(r.x+=s),ee(l)&&(r.y+=l),this.emit("pan viewport"));break;case 2:i=e,o=t,(i==="x"||i==="y")&&ee(o)&&(r[i]+=o),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ee(e)&&t===void 0&&(t=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var n;if(le(e)){var r=e;e=this.$(r)}else if(Up(e)){var i=e;n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},n.w=n.x2-n.x1,n.h=n.y2-n.y1}else ht(e)||(e=this.mutableElements());if(!(ht(e)&&e.empty())){n=n||e.boundingBox();var o=this.width(),a=this.height(),s;if(t=ee(t)?t:0,!isNaN(o)&&!isNaN(a)&&o>0&&a>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){s=Math.min((o-2*t)/n.w,(a-2*t)/n.h),s=s>this._private.maxZoom?this._private.maxZoom:s,s=s<this._private.minZoom?this._private.minZoom:s;var l={x:(o-s*(n.x1+n.x2))/2,y:(a-s*(n.y1+n.y2))/2};return{zoom:s,pan:l}}}}},zoomRange:function(e,t){var n=this._private;if(t==null){var r=e;e=r.min,t=r.max}return ee(e)&&ee(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):ee(e)&&t===void 0&&e<=n.maxZoom?n.minZoom=e:ee(t)&&e===void 0&&t>=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,i,o,a=!1;if(t.zoomingEnabled||(a=!0),ee(e)?o=e:_e(e)&&(o=e.level,e.position!=null?i=vi(e.position,r,n):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(a=!0)),o=o>t.maxZoom?t.maxZoom:o,o=o<t.minZoom?t.minZoom:o,a||!ee(o)||o===r||i!=null&&(!ee(i.x)||!ee(i.y)))return null;if(i!=null){var s=n,l=r,u=o,c={x:-u/l*(i.x-s.x)+i.x,y:-u/l*(i.y-s.y)+i.y};return{zoomed:!0,panned:!0,zoom:u,pan:c}}else return{zoomed:!0,panned:!1,zoom:o,pan:n}},zoom:function(e){if(e===void 0)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return t==null||!t.zoomed?this:(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var t=this._private,n=!0,r=!0,i=[],o=!1,a=!1;if(!e)return this;if(ee(e.zoom)||(n=!1),_e(e.pan)||(r=!1),!n&&!r)return this;if(n){var s=e.zoom;s<t.minZoom||s>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ee(l.x)&&(t.pan.x=l.x,a=!1),ee(l.y)&&(t.pan.y=l.y,a=!1),a||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(le(e)){var n=e;e=this.mutableElements().filter(n)}else ht(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var a={x:(i-t*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2};return a}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?function(){var r=n.window().getComputedStyle(t),i=function(o){return parseFloat(r.getPropertyValue(o))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};an.centre=an.center,an.autolockNodes=an.autolock,an.autoungrabifyNodes=an.autoungrabify;var Jn={data:ke.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ke.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ke.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ke.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Jn.attr=Jn.data,Jn.removeAttr=Jn.removeData;var hr=function(e){var t=this;e=de({},e);var n=e.container;n&&!Qr(n)&&Qr(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=ze!==void 0&&n!==void 0&&!e.headless,a=e;a.layout=de({name:o?"grid":"null"},a.layout),a.renderer=de({name:o?"canvas":"null"},a.renderer);var s=function(p,d,g){return d!==void 0?d:g!==void 0?g:p},l=this._private={container:n,ready:!1,options:a,elements:new $e(this),listeners:[],aniEles:new $e(this),data:a.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,a.zoomingEnabled),userZoomingEnabled:s(!0,a.userZoomingEnabled),panningEnabled:s(!0,a.panningEnabled),userPanningEnabled:s(!0,a.userPanningEnabled),boxSelectionEnabled:s(!0,a.boxSelectionEnabled),autolock:s(!1,a.autolock,a.autolockNodes),autoungrabify:s(!1,a.autoungrabify,a.autoungrabifyNodes),autounselectify:s(!1,a.autounselectify),styleEnabled:a.styleEnabled===void 0?o:a.styleEnabled,zoom:ee(a.zoom)?a.zoom:1,pan:{x:_e(a.pan)&&ee(a.pan.x)?a.pan.x:0,y:_e(a.pan)&&ee(a.pan.y)?a.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,a.multiClickDebounceTime)};this.createEmitter(),this.selectionType(a.selectionType),this.zoomRange({min:a.minZoom,max:a.maxZoom});var u=function(p,d){var g=p.some(Xp);if(g)return Rn.all(p).then(d);d(p)};l.styleEnabled&&t.setStyle([]);var c=de({},a,a.renderer);t.initRenderer(c);var h=function(p,d,g){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),p!=null&&(_e(p)||Se(p))&&t.add(p),t.one("layoutready",function(f){t.notifications(!0),t.emit(f),t.one("load",d),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",g),t.emit("done")});var b=de({},t._private.options.layout);b.eles=t.elements(),t.layout(b).run()};u([a.style,a.elements],function(p){var d=p[0],g=p[1];l.styleEnabled&&t.style().append(d),h(g,function(){t.startAnimationLoop(),l.ready=!0,Me(a.ready)&&t.on("ready",a.ready);for(var v=0;v<i.length;v++){var b=i[v];t.on("ready",b)}r&&(r.readies=[]),t.emit("ready")},a.done)})},Pr=hr.prototype;de(Pr,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return ze;var t=this._private.container.ownerDocument;return t===void 0||t==null?ze:t.defaultView||ze},mount:function(e){if(e!=null){var t=this,n=t._private,r=n.options;return!Qr(e)&&Qr(e[0])&&(e=e[0]),t.stopAnimationLoop(),t.destroyRenderer(),n.container=e,n.styleEnabled=!0,t.invalidateSize(),t.initRenderer(de({},r,r.renderer,{name:r.renderer.name==="null"?"canvas":r.renderer.name})),t.startAnimationLoop(),t.style(r.style),t.emit("mount"),t}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return At(this._private.options)},json:function(e){var t=this,n=t._private,r=t.mutableElements(),i=function(m){return t.getElementById(m.id())};if(_e(e)){if(t.startBatch(),e.elements){var o={},a=function(m,x){for(var T=[],_=[],D=0;D<m.length;D++){var y=m[D];if(!y.data.id){Le("cy.json() cannot handle elements without an ID attribute");continue}var E=""+y.data.id,w=t.getElementById(E);o[E]=!0,w.length!==0?_.push({ele:w,json:y}):(x&&(y.group=x),T.push(y))}t.add(T);for(var C=0;C<_.length;C++){var A=_[C],k=A.ele,S=A.json;k.json(S)}};if(Se(e.elements))a(e.elements);else for(var s=["nodes","edges"],l=0;l<s.length;l++){var u=s[l],c=e.elements[u];Se(c)&&a(c,u)}var h=t.collection();r.filter(function(m){return!o[m.id()]}).forEach(function(m){m.isParent()?h.merge(m):m.remove()}),h.forEach(function(m){return m.children().move({parent:null})}),h.forEach(function(m){return i(m).remove()})}e.style&&t.style(e.style),e.zoom!=null&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var p=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<p.length;d++){var g=p[d];e[g]!=null&&t[g](e[g])}return t.endBatch(),this}else{var v=!!e,b={};v?b.elements=this.elements().map(function(m){return m.json()}):(b.elements={},r.forEach(function(m){var x=m.group();b.elements[x]||(b.elements[x]=[]),b.elements[x].push(m.json())})),this._private.styleEnabled&&(b.style=t.style().json()),b.data=At(t.data());var f=n.options;return b.zoomingEnabled=n.zoomingEnabled,b.userZoomingEnabled=n.userZoomingEnabled,b.zoom=n.zoom,b.minZoom=n.minZoom,b.maxZoom=n.maxZoom,b.panningEnabled=n.panningEnabled,b.userPanningEnabled=n.userPanningEnabled,b.pan=At(n.pan),b.boxSelectionEnabled=n.boxSelectionEnabled,b.renderer=At(f.renderer),b.hideEdgesOnViewport=f.hideEdgesOnViewport,b.textureOnViewport=f.textureOnViewport,b.wheelSensitivity=f.wheelSensitivity,b.motionBlur=f.motionBlur,b.multiClickDebounceTime=f.multiClickDebounceTime,b}}}),Pr.$id=Pr.getElementById,[zv,Xv,el,Xi,Vr,Hv,ji,Ur,$v,an,Jn].forEach(function(e){de(Pr,e)});var Zv={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},Qv={maximal:!1,acyclic:!1},yn=function(e){return e.scratch("breadthfirst")},Lo=function(e,t){return e.scratch("breadthfirst",t)};function tl(e){this.options=de({},Zv,Qv,e)}tl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().filter(function(J){return!J.isParent()}),o=r,a=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=ut(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u;if(ht(t.roots))u=t.roots;else if(Se(t.roots)){for(var c=[],h=0;h<t.roots.length;h++){var p=t.roots[h],d=n.getElementById(p);c.push(d)}u=n.collection(c)}else if(le(t.roots))u=n.$(t.roots);else if(a)u=i.roots();else{var g=r.components();u=n.collection();for(var v=function(J){var oe=g[J],ne=oe.maxDegree(!1),ce=oe.filter(function(he){return he.degree(!1)===ne});u=u.add(ce)},b=0;b<g.length;b++)v(b)}var f=[],m={},x=function(J,oe){f[oe]==null&&(f[oe]=[]);var ne=f[oe].length;f[oe].push(J),Lo(J,{index:ne,depth:oe})},T=function(J,oe){var ne=yn(J),ce=ne.depth,he=ne.index;f[ce][he]=null,x(J,oe)};o.bfs({roots:u,directed:t.directed,visit:function(J,oe,ne,ce,he){var fe=J[0],me=fe.id();x(fe,he),m[me]=!0}});for(var _=[],D=0;D<i.length;D++){var y=i[D];m[y.id()]||_.push(y)}var E=function(J){for(var oe=f[J],ne=0;ne<oe.length;ne++){var ce=oe[ne];if(ce==null){oe.splice(ne,1),ne--;continue}Lo(ce,{depth:J,index:ne})}},w=function(){for(var J=0;J<f.length;J++)E(J)},C=function(J,oe){for(var ne=yn(J),ce=J.incomers().filter(function(L){return L.isNode()&&r.has(L)}),he=-1,fe=J.id(),me=0;me<ce.length;me++){var be=ce[me],we=yn(be);he=Math.max(he,we.depth)}if(ne.depth<=he){if(!t.acyclic&&oe[fe])return null;var ae=he+1;return T(J,ae),oe[fe]=ae,!0}return!1};if(a&&s){var A=[],k={},S=function(J){return A.push(J)},N=function(){return A.shift()};for(i.forEach(function(J){return A.push(J)});A.length>0;){var P=N(),R=C(P,k);if(R)P.outgoers().filter(function(J){return J.isNode()&&r.has(J)}).forEach(S);else if(R===null){Le("Detected double maximal shift for node `"+P.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}w();var I=0;if(t.avoidOverlap)for(var O=0;O<i.length;O++){var M=i[O],G=M.layoutDimensions(t),B=G.w,V=G.h;I=Math.max(I,B,V)}var F={},U=function(J){if(F[J.id()])return F[J.id()];for(var oe=yn(J).depth,ne=J.neighborhood(),ce=0,he=0,fe=0;fe<ne.length;fe++){var me=ne[fe];if(!(me.isEdge()||me.isParent()||!i.has(me))){var be=yn(me);if(be!=null){var we=be.index,ae=be.depth;if(!(we==null||ae==null)){var L=f[ae].length;ae<oe&&(ce+=we/L,he++)}}}}return he=Math.max(1,he),ce=ce/he,he===0&&(ce=0),F[J.id()]=ce,ce},Q=function(J,oe){var ne=U(J),ce=U(oe),he=ne-ce;return he===0?fs(J.id(),oe.id()):he};t.depthSort!==void 0&&(Q=t.depthSort);for(var z=0;z<f.length;z++)f[z].sort(Q),E(z);for(var q=[],H=0;H<_.length;H++)q.push(_[H]);f.unshift(q),w();for(var $=0,Z=0;Z<f.length;Z++)$=Math.max(f[Z].length,$);var te={x:l.x1+l.w/2,y:l.x1+l.h/2},pe=f.reduce(function(J,oe){return Math.max(J,oe.length)},0),ue=function(J){var oe=yn(J),ne=oe.depth,ce=oe.index,he=f[ne].length,fe=Math.max(l.w/((t.grid?pe:he)+1),I),me=Math.max(l.h/(f.length+1),I),be=Math.min(l.w/2/f.length,l.h/2/f.length);if(be=Math.max(be,I),t.circle){var we=be*ne+be-(f.length>0&&f[0].length<=3?be/2:0),ae=2*Math.PI/f[ne].length*ce;return ne===0&&f[0].length===1&&(we=1),{x:te.x+we*Math.cos(ae),y:te.y+we*Math.sin(ae)}}else{var L={x:te.x+(ce+1-(he+1)/2)*fe,y:(ne+1)*me};return L}};return r.nodes().layoutPositions(this,t,ue),this};var Jv={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function nl(e){this.options=de({},Jv,e)}nl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var a=ut(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:a.x1+a.w/2,y:a.y1+a.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/o.length:t.sweep,u=l/Math.max(1,o.length-1),c,h=0,p=0;p<o.length;p++){var d=o[p],g=d.layoutDimensions(t),v=g.w,b=g.h;h=Math.max(h,v,b)}if(ee(t.radius)?c=t.radius:o.length<=1?c=0:c=Math.min(a.h,a.w)/2-h,o.length>1&&t.avoidOverlap){h*=1.75;var f=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),x=Math.sqrt(h*h/(f*f+m*m));c=Math.max(x,c)}var T=function(_,D){var y=t.startAngle+D*u*(i?1:-1),E=c*Math.cos(y),w=c*Math.sin(y),C={x:s.x+E,y:s.y+w};return C};return r.nodes().layoutPositions(this,t,T),this};var ey={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function rl(e){this.options=de({},ey,e)}rl.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,o=i.nodes().not(":parent"),a=ut(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:a.x1+a.w/2,y:a.y1+a.h/2},l=[],u=0,c=0;c<o.length;c++){var h=o[c],p=void 0;p=t.concentric(h),l.push({value:p,node:h}),h._private.scratch.concentric=p}o.updateStyle();for(var d=0;d<o.length;d++){var g=o[d],v=g.layoutDimensions(t);u=Math.max(u,v.w,v.h)}l.sort(function(J,oe){return oe.value-J.value});for(var b=t.levelWidth(o),f=[[]],m=f[0],x=0;x<l.length;x++){var T=l[x];if(m.length>0){var _=Math.abs(m[0].value-T.value);_>=b&&(m=[],f.push(m))}m.push(T)}var D=u+t.minNodeSpacing;if(!t.avoidOverlap){var y=f.length>0&&f[0].length>1,E=Math.min(a.w,a.h)/2-D,w=E/(f.length+y?1:0);D=Math.min(D,w)}for(var C=0,A=0;A<f.length;A++){var k=f[A],S=t.sweep===void 0?2*Math.PI-2*Math.PI/k.length:t.sweep,N=k.dTheta=S/Math.max(1,k.length-1);if(k.length>1&&t.avoidOverlap){var P=Math.cos(N)-Math.cos(0),R=Math.sin(N)-Math.sin(0),I=Math.sqrt(D*D/(P*P+R*R));C=Math.max(I,C)}k.r=C,C+=D}if(t.equidistant){for(var O=0,M=0,G=0;G<f.length;G++){var B=f[G],V=B.r-M;O=Math.max(O,V)}M=0;for(var F=0;F<f.length;F++){var U=f[F];F===0&&(M=U.r),U.r=M,M+=O}}for(var Q={},z=0;z<f.length;z++)for(var q=f[z],H=q.dTheta,$=q.r,Z=0;Z<q.length;Z++){var te=q[Z],pe=t.startAngle+(n?1:-1)*H*Z,ue={x:s.x+$*Math.cos(pe),y:s.y+$*Math.sin(pe)};Q[te.node.id()]=ue}return i.nodes().layoutPositions(this,t,function(J){var oe=J.id();return Q[oe]}),this};var Ii,ty={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Hr(e){this.options=de({},ty,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(i){var o=i.source().data("id"),a=i.target().data("id"),s=t.some(function(u){return u.data("id")===o}),l=t.some(function(u){return u.data("id")===a});return!s||!l});this.options.eles=this.options.eles.not(r)}Hr.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?Ii=!0:Ii=!1;var r=ny(t,n,e);Ii&&ay(r),e.randomize&&oy(r);var i=Pt(),o=function(){sy(r,t,e),e.fit===!0&&t.fit(e.padding)},a=function(h){return!(n.stopped||h>=e.numIter||(ly(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},s=function(){if(e.animate===!0||e.animate===!1)o(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var h=e.eles.nodes(),p=il(r,e,h);h.layoutPositions(n,e,p)}},l=0,u=!0;if(e.animate===!0){var c=function h(){for(var p=0;u&&p<e.refresh;)u=a(l),l++,p++;if(!u)So(r,e),s();else{var d=Pt();d-i>=e.animationThreshold&&o(),Jr(h)}};c()}else{for(;u;)u=a(l),l++;So(r,e),s()}return this},Hr.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Hr.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ny=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),o=ut(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},s=n.eles.components(),l={},u=0;u<s.length;u++)for(var c=s[u],h=0;h<c.length;h++){var p=c[h];l[p.id()]=u}for(var u=0;u<a.nodeSize;u++){var d=i[u],g=d.layoutDimensions(n),v={};v.isLocked=d.locked(),v.id=d.data("id"),v.parentId=d.data("parent"),v.cmptId=l[d.id()],v.children=[],v.positionX=d.position("x"),v.positionY=d.position("y"),v.offsetX=0,v.offsetY=0,v.height=g.w,v.width=g.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(d.style("padding")),v.padRight=parseFloat(d.style("padding")),v.padTop=parseFloat(d.style("padding")),v.padBottom=parseFloat(d.style("padding")),v.nodeRepulsion=Me(n.nodeRepulsion)?n.nodeRepulsion(d):n.nodeRepulsion,a.layoutNodes.push(v),a.idToIndex[v.id]=u}for(var b=[],f=0,m=-1,x=[],u=0;u<a.nodeSize;u++){var d=a.layoutNodes[u],T=d.parentId;T!=null?a.layoutNodes[a.idToIndex[T]].children.push(d.id):(b[++m]=d.id,x.push(d.id))}for(a.graphSet.push(x);f<=m;){var _=b[f++],D=a.idToIndex[_],p=a.layoutNodes[D],y=p.children;if(y.length>0){a.graphSet.push(y);for(var u=0;u<y.length;u++)b[++m]=y[u]}}for(var u=0;u<a.graphSet.length;u++)for(var E=a.graphSet[u],h=0;h<E.length;h++){var w=a.idToIndex[E[h]];a.indexToGraph[w]=u}for(var u=0;u<a.edgeSize;u++){var C=r[u],A={};A.id=C.data("id"),A.sourceId=C.data("source"),A.targetId=C.data("target");var k=Me(n.idealEdgeLength)?n.idealEdgeLength(C):n.idealEdgeLength,S=Me(n.edgeElasticity)?n.edgeElasticity(C):n.edgeElasticity,N=a.idToIndex[A.sourceId],P=a.idToIndex[A.targetId],R=a.indexToGraph[N],I=a.indexToGraph[P];if(R!=I){for(var O=ry(A.sourceId,A.targetId,a),M=a.graphSet[O],G=0,v=a.layoutNodes[N];M.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],G++;for(v=a.layoutNodes[P];M.indexOf(v.id)===-1;)v=a.layoutNodes[a.idToIndex[v.parentId]],G++;k*=G*n.nestingFactor}A.idealLength=k,A.elasticity=S,a.layoutEdges.push(A)}return a},ry=function(e,t,n){var r=iy(e,t,0,n);return 2>r.count?0:r.graph},iy=function e(t,n,r,i){var o=i.graphSet[r];if(-1<o.indexOf(t)&&-1<o.indexOf(n))return{count:2,graph:r};for(var a=0,s=0;s<o.length;s++){var l=o[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(c.length!==0){var h=i.indexToGraph[i.idToIndex[c[0]]],p=e(t,n,h,i);if(p.count!==0)if(p.count===1){if(a++,a===2)break}else return p}}return{count:a,graph:r}},ay,oy=function(e,t){for(var n=e.clientWidth,r=e.clientHeight,i=0;i<e.nodeSize;i++){var o=e.layoutNodes[i];o.children.length===0&&!o.isLocked&&(o.positionX=Math.random()*n,o.positionY=Math.random()*r)}},il=function(e,t,n){var r=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return t.boundingBox&&(n.forEach(function(o){var a=e.layoutNodes[e.idToIndex[o.data("id")]];i.x1=Math.min(i.x1,a.positionX),i.x2=Math.max(i.x2,a.positionX),i.y1=Math.min(i.y1,a.positionY),i.y2=Math.max(i.y2,a.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(o,a){var s=e.layoutNodes[e.idToIndex[o.data("id")]];if(t.boundingBox){var l=(s.positionX-i.x1)/i.w,u=(s.positionY-i.y1)/i.h;return{x:r.x1+l*r.w,y:r.y1+u*r.h}}else return{x:s.positionX,y:s.positionY}}},sy=function(e,t,n){var r=n.layout,i=n.eles.nodes(),o=il(e,n,i);i.positions(o),e.ready!==!0&&(e.ready=!0,r.one("layoutready",n.ready),r.emit({type:"layoutready",layout:this}))},ly=function(e,t,n){uy(e,t),dy(e),py(e,t),gy(e),fy(e)},uy=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var r=e.graphSet[n],i=r.length,o=0;o<i;o++)for(var a=e.layoutNodes[e.idToIndex[r[o]]],s=o+1;s<i;s++){var l=e.layoutNodes[e.idToIndex[r[s]]];cy(a,l,e,t)}},No=function(e){return-e+2*e*Math.random()},cy=function(e,t,n,r){var i=e.cmptId,o=t.cmptId;if(!(i!==o&&!n.isCompound)){var a=t.positionX-e.positionX,s=t.positionY-e.positionY,l=1;a===0&&s===0&&(a=No(l),s=No(l));var u=hy(e,t,a,s);if(u>0)var b=r.nodeOverlap*u,v=Math.sqrt(a*a+s*s),f=b*a/v,m=b*s/v;else var c=si(e,a,s),h=si(t,-1*a,-1*s),p=h.x-c.x,d=h.y-c.y,g=p*p+d*d,v=Math.sqrt(g),b=(e.nodeRepulsion+t.nodeRepulsion)/g,f=b*p/v,m=b*d/v;e.isLocked||(e.offsetX-=f,e.offsetY-=m),t.isLocked||(t.offsetX+=f,t.offsetY+=m)}},hy=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},si=function(e,t,n){var r=e.positionX,i=e.positionY,o=e.height||1,a=e.width||1,s=n/t,l=o/a,u={};return t===0&&0<n||t===0&&0>n?(u.x=r,u.y=i+o/2,u):0<t&&-1*l<=s&&s<=l?(u.x=r+a/2,u.y=i+a*n/2/t,u):0>t&&-1*l<=s&&s<=l?(u.x=r-a/2,u.y=i-a*n/2/t,u):0<n&&(s<=-1*l||s>=l)?(u.x=r+o*t/2/n,u.y=i+o/2,u):(0>n&&(s<=-1*l||s>=l)&&(u.x=r-o*t/2/n,u.y=i-o/2),u)},dy=function(e,t){for(var n=0;n<e.edgeSize;n++){var r=e.layoutEdges[n],i=e.idToIndex[r.sourceId],o=e.layoutNodes[i],a=e.idToIndex[r.targetId],s=e.layoutNodes[a],l=s.positionX-o.positionX,u=s.positionY-o.positionY;if(!(l===0&&u===0)){var c=si(o,l,u),h=si(s,-1*l,-1*u),p=h.x-c.x,d=h.y-c.y,g=Math.sqrt(p*p+d*d),v=Math.pow(r.idealLength-g,2)/r.elasticity;if(g!==0)var b=v*p/g,f=v*d/g;else var b=0,f=0;o.isLocked||(o.offsetX+=b,o.offsetY+=f),s.isLocked||(s.offsetX-=b,s.offsetY-=f)}}},py=function(e,t){if(t.gravity!==0)for(var n=1,r=0;r<e.graphSet.length;r++){var i=e.graphSet[r],o=i.length;if(r===0)var l=e.clientHeight/2,u=e.clientWidth/2;else var a=e.layoutNodes[e.idToIndex[i[0]]],s=e.layoutNodes[e.idToIndex[a.parentId]],l=s.positionX,u=s.positionY;for(var c=0;c<o;c++){var h=e.layoutNodes[e.idToIndex[i[c]]];if(!h.isLocked){var p=l-h.positionX,d=u-h.positionY,g=Math.sqrt(p*p+d*d);if(g>n){var v=t.gravity*p/g,b=t.gravity*d/g;h.offsetX+=v,h.offsetY+=b}}}}},gy=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var o=n[r++],a=e.idToIndex[o],s=e.layoutNodes[a],l=s.children;if(0<l.length&&!s.isLocked){for(var u=s.offsetX,c=s.offsetY,h=0;h<l.length;h++){var p=e.layoutNodes[e.idToIndex[l[h]]];p.offsetX+=u,p.offsetY+=c,n[++i]=l[h]}s.offsetX=0,s.offsetY=0}}},fy=function(e,t){for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&(r.maxX=void 0,r.minX=void 0,r.maxY=void 0,r.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];if(!(0<r.children.length||r.isLocked)){var i=vy(r.offsetX,r.offsetY,e.temperature);r.positionX+=i.x,r.positionY+=i.y,r.offsetX=0,r.offsetY=0,r.minX=r.positionX-r.width,r.maxX=r.positionX+r.width,r.minY=r.positionY-r.height,r.maxY=r.positionY+r.height,yy(r,e)}}for(var n=0;n<e.nodeSize;n++){var r=e.layoutNodes[n];0<r.children.length&&!r.isLocked&&(r.positionX=(r.maxX+r.minX)/2,r.positionY=(r.maxY+r.minY)/2,r.width=r.maxX-r.minX,r.height=r.maxY-r.minY)}},vy=function(e,t,n){var r=Math.sqrt(e*e+t*t);if(r>n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},yy=function e(t,n){var r=t.parentId;if(r!=null){var i=n.layoutNodes[n.idToIndex[r]],o=!1;if((i.maxX==null||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,o=!0),(i.minX==null||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,o=!0),(i.maxY==null||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,o=!0),(i.minY==null||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,o=!0),o)return e(i,n)}},So=function(e,t){for(var n=e.layoutNodes,r=[],i=0;i<n.length;i++){var o=n[i],a=o.cmptId,s=r[a]=r[a]||[];s.push(o)}for(var l=0,i=0;i<r.length;i++){var u=r[i];if(u){u.x1=1/0,u.x2=-1/0,u.y1=1/0,u.y2=-1/0;for(var c=0;c<u.length;c++){var h=u[c];u.x1=Math.min(u.x1,h.positionX-h.width/2),u.x2=Math.max(u.x2,h.positionX+h.width/2),u.y1=Math.min(u.y1,h.positionY-h.height/2),u.y2=Math.max(u.y2,h.positionY+h.height/2)}u.w=u.x2-u.x1,u.h=u.y2-u.y1,l+=u.w*u.h}}r.sort(function(f,m){return m.w*m.h-f.w*f.h});for(var p=0,d=0,g=0,v=0,b=Math.sqrt(l)*e.clientWidth/e.clientHeight,i=0;i<r.length;i++){var u=r[i];if(u){for(var c=0;c<u.length;c++){var h=u[c];h.isLocked||(h.positionX+=p-u.x1,h.positionY+=d-u.y1)}p+=u.w+t.componentSpacing,g+=u.w+t.componentSpacing,v=Math.max(v,u.h),g>b&&(d+=v+t.componentSpacing,p=0,g=0,v=0)}}},my={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function al(e){this.options=de({},my,e)}al.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var o=ut(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(o.h===0||o.w===0)r.nodes().layoutPositions(this,t,function(F){return{x:o.x1,y:o.y1}});else{var a=i.size(),s=Math.sqrt(a*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),c=function(F){if(F==null)return Math.min(l,u);var U=Math.min(l,u);U==l?l=F:u=F},h=function(F){if(F==null)return Math.max(l,u);var U=Math.max(l,u);U==l?l=F:u=F},p=t.rows,d=t.cols!=null?t.cols:t.columns;if(p!=null&&d!=null)l=p,u=d;else if(p!=null&&d==null)l=p,u=Math.ceil(a/l);else if(p==null&&d!=null)u=d,l=Math.ceil(a/u);else if(u*l>a){var g=c(),v=h();(g-1)*v>=a?c(g-1):(v-1)*g>=a&&h(v-1)}else for(;u*l<a;){var b=c(),f=h();(f+1)*b>=a?h(f+1):c(b+1)}var m=o.w/u,x=o.h/l;if(t.condense&&(m=0,x=0),t.avoidOverlap)for(var T=0;T<i.length;T++){var _=i[T],D=_._private.position;(D.x==null||D.y==null)&&(D.x=0,D.y=0);var y=_.layoutDimensions(t),E=t.avoidOverlapPadding,w=y.w+E,C=y.h+E;m=Math.max(m,w),x=Math.max(x,C)}for(var A={},k=function(F,U){return!!A["c-"+F+"-"+U]},S=function(F,U){A["c-"+F+"-"+U]=!0},N=0,P=0,R=function(){P++,P>=u&&(P=0,N++)},I={},O=0;O<i.length;O++){var M=i[O],G=t.position(M);if(G&&(G.row!==void 0||G.col!==void 0)){var B={row:G.row,col:G.col};if(B.col===void 0)for(B.col=0;k(B.row,B.col);)B.col++;else if(B.row===void 0)for(B.row=0;k(B.row,B.col);)B.row++;I[M.id()]=B,S(B.row,B.col)}}var V=function(F,U){var Q,z;if(F.locked()||F.isParent())return!1;var q=I[F.id()];if(q)Q=q.col*m+m/2+o.x1,z=q.row*x+x/2+o.y1;else{for(;k(N,P);)R();Q=P*m+m/2+o.x1,z=N*x+x/2+o.y1,S(N,P),R()}return{x:Q,y:z}};i.layoutPositions(this,t,V)}return this};var by={ready:function(){},stop:function(){}};function qi(e){this.options=de({},by,e)}qi.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},qi.prototype.stop=function(){return this};var xy={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ol(e){this.options=de({},xy,e)}ol.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=Me(e.positions);function i(o){if(e.positions==null)return Ng(o.position());if(r)return e.positions(o);var a=e.positions[o._private.data.id];return a!=null?a:null}return n.layoutPositions(this,e,function(o,a){var s=i(o);return o.locked()||s==null?!1:s}),this};var wy={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function sl(e){this.options=de({},wy,e)}sl.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=ut(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(o,a){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,i),this};var Ey=[{name:"breadthfirst",impl:tl},{name:"circle",impl:nl},{name:"concentric",impl:rl},{name:"cose",impl:Hr},{name:"grid",impl:al},{name:"null",impl:qi},{name:"preset",impl:ol},{name:"random",impl:sl}];function ll(e){this.options=e,this.notifications=0}var Io=function(){},Po=function(){throw new Error("A headless instance can not render images")};ll.prototype={recalculateRenderedStyle:Io,notify:function(){this.notifications++},init:Io,isHeadless:function(){return!0},png:Po,jpg:Po};var $i={};$i.arrowShapeWidth=.3,$i.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(l,u,c,h,p,d,g){var v=p.x-c/2-g,b=p.x+c/2+g,f=p.y-c/2-g,m=p.y+c/2+g,x=v<=l&&l<=b&&f<=u&&u<=m;return x},r=function(l,u,c,h,p){var d=l*Math.cos(h)-u*Math.sin(h),g=l*Math.sin(h)+u*Math.cos(h),v=d*c,b=g*c,f=v+p.x,m=b+p.y;return{x:f,y:m}},i=function(l,u,c,h){for(var p=[],d=0;d<l.length;d+=2){var g=l[d],v=l[d+1];p.push(r(g,v,u,c,h))}return p},o=function(l){for(var u=[],c=0;c<l.length;c++){var h=l[c];u.push(h.x,h.y)}return u},a=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},s=function(l,u){le(u)&&(u=e[u]),e[l]=de({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,h,p,d,g,v){var b=o(i(this.points,p+2*v,d,g)),f=lt(c,h,b);return f},roughCollide:n,draw:function(c,h,p,d){var g=i(this.points,h,p,d);t.arrowShapeImpl("polygon")(c,g)},spacing:function(c){return 0},gap:a},u)};s("none",{collide:ei,roughCollide:ei,draw:da,spacing:Va,gap:Va}),s("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),s("arrow","triangle"),s("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(l,u,c,h,p){var d=i(this.points,u,c,h),g=this.controlPoint,v=r(g[0],g[1],u,c,h);t.arrowShapeImpl(this.name)(l,d,v)},gap:function(l){return a(l)*.8}}),s("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,u,c,h,p,d,g){var v=o(i(this.points,c+2*g,h,p)),b=o(i(this.pointsTee,c+2*g,h,p)),f=lt(l,u,v)||lt(l,u,b);return f},draw:function(l,u,c,h,p){var d=i(this.points,u,c,h),g=i(this.pointsTee,u,c,h);t.arrowShapeImpl(this.name)(l,d,g)}}),s("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,u,c,h,p,d,g){var v=p,b=Math.pow(v.x-l,2)+Math.pow(v.y-u,2)<=Math.pow((c+2*g)*this.radius,2),f=o(i(this.points,c+2*g,h,p));return lt(l,u,f)||b},draw:function(l,u,c,h,p){var d=i(this.pointsTr,u,c,h);t.arrowShapeImpl(this.name)(l,d,h.x,h.y,this.radius*u)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,u){var c=this.baseCrossLinePts.slice(),h=u/l,p=3,d=5;return c[p]=c[p]-h,c[d]=c[d]-h,c},collide:function(l,u,c,h,p,d,g){var v=o(i(this.points,c+2*g,h,p)),b=o(i(this.crossLinePts(c,d),c+2*g,h,p)),f=lt(l,u,v)||lt(l,u,b);return f},draw:function(l,u,c,h,p){var d=i(this.points,u,c,h),g=i(this.crossLinePts(u,p),u,c,h);t.arrowShapeImpl(this.name)(l,d,g)}}),s("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return a(l)*.525}}),s("circle",{radius:.15,collide:function(l,u,c,h,p,d,g){var v=p,b=Math.pow(v.x-l,2)+Math.pow(v.y-u,2)<=Math.pow((c+2*g)*this.radius,2);return b},draw:function(l,u,c,h,p){t.arrowShapeImpl(this.name)(l,h.x,h.y,this.radius*u)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),s("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),s("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),s("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),s("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var on={};on.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],o=r[1],a=r[4],s=n.pan(),l=n.zoom(),u=((e-i)/a-s.x)/l,c=((t-o)/a-s.y)/l;return[u,c]},on.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(b){return parseFloat(n.getPropertyValue(b))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},o={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},a=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=o.left+o.right,h=t.width/(a+c),p=a-l,d=s-u,g=t.left+i.left+o.left,v=t.top+i.top+o.top;return this.containerBB=[g,v,p,d,h]},on.invalidateContainerClientCoordsCache=function(){this.containerBB=null},on.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},on.findNearestElements=function(e,t,n,r){var i=this,o=this,a=o.getCachedZSortedEles(),s=[],l=o.cy.zoom(),u=o.cy.hasCompoundNodes(),c=(r?24:8)/l,h=(r?8:2)/l,p=(r?8:2)/l,d=1/0,g,v;n&&(a=a.interactive);function b(y,E){if(y.isNode()){if(v)return;v=y,s.push(y)}if(y.isEdge()&&(E==null||E<d))if(g){if(g.pstyle("z-compound-depth").value===y.pstyle("z-compound-depth").value&&g.pstyle("z-compound-depth").value===y.pstyle("z-compound-depth").value){for(var w=0;w<s.length;w++)if(s[w].isEdge()){s[w]=y,g=y,d=E!=null?E:d;break}}}else s.push(y),g=y,d=E!=null?E:d}function f(y){var E=y.outerWidth()+2*h,w=y.outerHeight()+2*h,C=E/2,A=w/2,k=y.position();if(k.x-C<=e&&e<=k.x+C&&k.y-A<=t&&t<=k.y+A){var S=o.nodeShapes[i.getNodeShape(y)];if(S.checkPoint(e,t,0,E,w,k.x,k.y))return b(y,0),!0}}function m(y){var E=y._private,w=E.rscratch,C=y.pstyle("width").pfValue,A=y.pstyle("arrow-scale").value,k=C/2+c,S=k*k,N=k*2,P=E.source,R=E.target,I;if(w.edgeType==="segments"||w.edgeType==="straight"||w.edgeType==="haystack"){for(var O=w.allpts,M=0;M+3<O.length;M+=2)if(Ug(e,t,O[M],O[M+1],O[M+2],O[M+3],N)&&S>(I=qg(e,t,O[M],O[M+1],O[M+2],O[M+3])))return b(y,I),!0}else if(w.edgeType==="bezier"||w.edgeType==="multibezier"||w.edgeType==="self"||w.edgeType==="compound"){for(var O=w.allpts,M=0;M+5<w.allpts.length;M+=4)if(Xg(e,t,O[M],O[M+1],O[M+2],O[M+3],O[M+4],O[M+5],N)&&S>(I=Wg(e,t,O[M],O[M+1],O[M+2],O[M+3],O[M+4],O[M+5])))return b(y,I),!0}for(var P=P||E.source,R=R||E.target,G=i.getArrowWidth(C,A),B=[{name:"source",x:w.arrowStartX,y:w.arrowStartY,angle:w.srcArrowAngle},{name:"target",x:w.arrowEndX,y:w.arrowEndY,angle:w.tgtArrowAngle},{name:"mid-source",x:w.midX,y:w.midY,angle:w.midsrcArrowAngle},{name:"mid-target",x:w.midX,y:w.midY,angle:w.midtgtArrowAngle}],M=0;M<B.length;M++){var V=B[M],F=o.arrowShapes[y.pstyle(V.name+"-arrow-shape").value],U=y.pstyle("width").pfValue;if(F.roughCollide(e,t,G,V.angle,{x:V.x,y:V.y},U,c)&&F.collide(e,t,G,V.angle,{x:V.x,y:V.y},U,c))return b(y),!0}u&&s.length>0&&(f(P),f(R))}function x(y,E,w){return wt(y,E,w)}function T(y,E){var w=y._private,C=p,A;E?A=E+"-":A="",y.boundingBox();var k=w.labelBounds[E||"main"],S=y.pstyle(A+"label").value,N=y.pstyle("text-events").strValue==="yes";if(!(!N||!S)){var P=x(w.rscratch,"labelX",E),R=x(w.rscratch,"labelY",E),I=x(w.rscratch,"labelAngle",E),O=y.pstyle(A+"text-margin-x").pfValue,M=y.pstyle(A+"text-margin-y").pfValue,G=k.x1-C-O,B=k.x2+C-O,V=k.y1-C-M,F=k.y2+C-M;if(I){var U=Math.cos(I),Q=Math.sin(I),z=function(pe,ue){return pe=pe-P,ue=ue-R,{x:pe*U-ue*Q+P,y:pe*Q+ue*U+R}},q=z(G,V),H=z(G,F),$=z(B,V),Z=z(B,F),te=[q.x+O,q.y+M,$.x+O,$.y+M,Z.x+O,Z.y+M,H.x+O,H.y+M];if(lt(e,t,te))return b(y),!0}else if(Pn(k,e,t))return b(y),!0}}for(var _=a.length-1;_>=0;_--){var D=a[_];D.isNode()?f(D)||T(D):m(D)||T(D)||T(D,"source")||T(D,"target")}return s},on.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,o=[],a=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=a,n=s,t=l,r=u;for(var c=ut({x1:e,y1:t,x2:n,y2:r}),h=0;h<i.length;h++){var p=i[h];if(p.isNode()){var d=p,g=d.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});ga(c,g)&&!ks(g,c)&&o.push(d)}else{var v=p,b=v._private,f=b.rscratch;if(f.startX!=null&&f.startY!=null&&!Pn(c,f.startX,f.startY)||f.endX!=null&&f.endY!=null&&!Pn(c,f.endX,f.endY))continue;if(f.edgeType==="bezier"||f.edgeType==="multibezier"||f.edgeType==="self"||f.edgeType==="compound"||f.edgeType==="segments"||f.edgeType==="haystack"){for(var m=b.rstyle.bezierPts||b.rstyle.linePts||b.rstyle.haystackPts,x=!0,T=0;T<m.length;T++)if(!Vg(c,m[T])){x=!1;break}x&&o.push(v)}else(f.edgeType==="haystack"||f.edgeType==="straight")&&o.push(v)}}return o};var Wr={};Wr.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",i=t.edgeType==="multibezier",o=t.edgeType==="segments",a=t.edgeType==="compound",s=t.edgeType==="self",l,u,c,h,p,d,f,m;if(n?(c=t.haystackPts[0],h=t.haystackPts[1],p=t.haystackPts[2],d=t.haystackPts[3]):(c=t.arrowStartX,h=t.arrowStartY,p=t.arrowEndX,d=t.arrowEndY),f=t.midX,m=t.midY,o)l=c-t.segpts[0],u=h-t.segpts[1];else if(i||a||s||r){var g=t.allpts,v=Ue(g[0],g[2],g[4],.1),b=Ue(g[1],g[3],g[5],.1);l=c-v,u=h-b}else l=c-f,u=h-m;t.srcArrowAngle=Tr(l,u);var f=t.midX,m=t.midY;if(n&&(f=(c+p)/2,m=(h+d)/2),l=p-c,u=d-h,o){var g=t.allpts;if(g.length/2%2===0){var x=g.length/2,T=x-2;l=g[x]-g[T],u=g[x+1]-g[T+1]}else{var x=g.length/2-1,T=x-2,_=x+2;l=g[x]-g[T],u=g[x+1]-g[T+1]}}else if(i||a||s){var g=t.allpts,D=t.ctrlpts,y,E,w,C;if(D.length/2%2===0){var A=g.length/2-1,k=A+2,S=k+2;y=Ue(g[A],g[k],g[S],0),E=Ue(g[A+1],g[k+1],g[S+1],0),w=Ue(g[A],g[k],g[S],1e-4),C=Ue(g[A+1],g[k+1],g[S+1],1e-4)}else{var k=g.length/2-1,A=k-2,S=k+2;y=Ue(g[A],g[k],g[S],.4999),E=Ue(g[A+1],g[k+1],g[S+1],.4999),w=Ue(g[A],g[k],g[S],.5),C=Ue(g[A+1],g[k+1],g[S+1],.5)}l=w-y,u=C-E}if(t.midtgtArrowAngle=Tr(l,u),t.midDispX=l,t.midDispY=u,l*=-1,u*=-1,o){var g=t.allpts;if(g.length/2%2!==0){var x=g.length/2-1,_=x+2;l=-(g[_]-g[x]),u=-(g[_+1]-g[x+1])}}if(t.midsrcArrowAngle=Tr(l,u),o)l=p-t.segpts[t.segpts.length-2],u=d-t.segpts[t.segpts.length-1];else if(i||a||s||r){var g=t.allpts,N=g.length,v=Ue(g[N-6],g[N-4],g[N-2],.9),b=Ue(g[N-5],g[N-3],g[N-1],.9);l=p-v,u=d-b}else l=p-f,u=d-m;t.tgtArrowAngle=Tr(l,u)},Wr.getArrowWidth=Wr.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var tt={};tt.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,o,a=e.pstyle("source-endpoint"),s=e.pstyle("target-endpoint"),l=a.units!=null&&s.units!=null,u=function(T,_,D,y){var E=y-_,w=D-T,C=Math.sqrt(w*w+E*E);return{x:-E/C,y:w/C}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":o=n;break;case"intersection":o=r;break;case"endpoints":{if(l){var h=this.manualEndptToPx(e.source()[0],a),p=xt(h,2),d=p[0],g=p[1],v=this.manualEndptToPx(e.target()[0],s),b=xt(v,2),f=b[0],m=b[1],x={x1:d,y1:g,x2:f,y2:m};i=u(d,g,f,m),o=x}else Le("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default).")),o=r;break}}return{midptPts:o,vectorNormInverse:i}},tt.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var o=Math.random()*2*Math.PI;i.source={x:Math.cos(o),y:Math.sin(o)},o=Math.random()*2*Math.PI,i.target={x:Math.cos(o),y:Math.sin(o)}}var a=r.source,s=r.target,l=a.position(),u=s.position(),c=a.width(),h=s.width(),p=a.height(),d=s.height(),g=n.pstyle("haystack-radius").value,v=g/2;i.haystackPts=i.allpts=[i.source.x*c*v+l.x,i.source.y*p*v+l.y,i.target.x*h*v+u.x,i.target.y*d*v+u.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},tt.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),o=Math.min(r.pfValue.length,i.pfValue.length);n.edgeType="segments",n.segpts=[];for(var a=0;a<o;a++){var s=r.pfValue[a],l=i.pfValue[a],u=1-s,c=s,h=this.findMidptPtsEtc(e,t),p=h.midptPts,d=h.vectorNormInverse,g={x:p.x1*u+p.x2*c,y:p.y1*u+p.y2*c};n.segpts.push(g.x+d.x*l,g.y+d.y*l)}},tt.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,o=t.dirCounts,a=t.srcPos,s=e.pstyle("control-point-distances"),l=s?s.pfValue[0]:void 0,u=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var p=n,d=h;r&&(p=0,d=l);var g=u-Math.PI/2,v=g-c/2,b=g+c/2,f=u+"_"+c;p=o[f]===void 0?o[f]=0:++o[f],i.ctrlpts=[a.x+Math.cos(v)*1.4*d*(p/3+1),a.y+Math.sin(v)*1.4*d*(p/3+1),a.x+Math.cos(b)*1.4*d*(p/3+1),a.y+Math.sin(b)*1.4*d*(p/3+1)]},tt.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var o=t.srcPos,a=t.tgtPos,s=t.srcW,l=t.srcH,u=t.tgtW,c=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,p=e.pstyle("control-point-distances"),d=p?p.pfValue[0]:void 0,g=n,v=h;r&&(g=0,v=d);var b=50,f={x:o.x-s/2,y:o.y-l/2},m={x:a.x-u/2,y:a.y-c/2},x={x:Math.min(f.x,m.x),y:Math.min(f.y,m.y)},T=.5,_=Math.max(T,Math.log(s*.01)),D=Math.max(T,Math.log(u*.01));i.ctrlpts=[x.x,x.y-(1+Math.pow(b,1.12)/100)*v*(g/3+1)*_,x.x-(1+Math.pow(b,1.12)/100)*v*(g/3+1)*D,x.y]},tt.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},tt.findBezierPoints=function(e,t,n,r,i){var o=e._private.rscratch,a=e.pstyle("control-point-step-size").pfValue,s=e.pstyle("control-point-distances"),l=e.pstyle("control-point-weights"),u=s&&l?Math.min(s.value.length,l.value.length):1,c=s?s.pfValue[0]:void 0,h=l.value[0],p=r;o.edgeType=p?"multibezier":"bezier",o.ctrlpts=[];for(var d=0;d<u;d++){var g=(.5-t.eles.length/2+n)*a*(i?-1:1),v=void 0,b=Xa(g);p&&(c=s?s.pfValue[d]:a,h=l.value[d]),r?v=c:v=c!==void 0?b*c:void 0;var f=v!==void 0?v:g,m=1-h,x=h,T=this.findMidptPtsEtc(e,t),_=T.midptPts,D=T.vectorNormInverse,y={x:_.x1*m+_.x2*x,y:_.y1*m+_.y2*x};o.ctrlpts.push(y.x+D.x*f,y.y+D.y*f)}},tt.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",i="horizontal",o="leftward",a="rightward",s="downward",l="upward",u="auto",c=t.posPts,h=t.srcW,p=t.srcH,d=t.tgtW,g=t.tgtH,v=e.pstyle("edge-distances").value,b=v!=="node-position",f=e.pstyle("taxi-direction").value,m=f,x=e.pstyle("taxi-turn"),T=x.units==="%",_=x.pfValue,D=_<0,y=e.pstyle("taxi-turn-min-distance").pfValue,E=b?(h+d)/2:0,w=b?(p+g)/2:0,C=c.x2-c.x1,A=c.y2-c.y1,k=function(W,ie){return W>0?Math.max(W-ie,0):Math.min(W+ie,0)},S=k(C,E),N=k(A,w),P=!1;m===u?f=Math.abs(S)>Math.abs(N)?i:r:m===l||m===s?(f=r,P=!0):(m===o||m===a)&&(f=i,P=!0);var R=f===r,I=R?N:S,O=R?A:C,M=Xa(O),G=!1;!(P&&(T||D))&&(m===s&&O<0||m===l&&O>0||m===o&&O>0||m===a&&O<0)&&(M*=-1,I=M*Math.abs(I),G=!0);var B;if(T){var V=_<0?1+_:_;B=V*I}else{var F=_<0?I:0;B=F+_*M}var U=function(W){return Math.abs(W)<y||Math.abs(W)>=Math.abs(I)},Q=U(B),z=U(Math.abs(I)-Math.abs(B)),q=Q||z;if(q&&!G)if(R){var H=Math.abs(O)<=p/2,$=Math.abs(C)<=d/2;if(H){var Z=(c.x1+c.x2)/2,te=c.y1,pe=c.y2;n.segpts=[Z,te,Z,pe]}else if($){var ue=(c.y1+c.y2)/2,J=c.x1,oe=c.x2;n.segpts=[J,ue,oe,ue]}else n.segpts=[c.x1,c.y2]}else{var ne=Math.abs(O)<=h/2,ce=Math.abs(A)<=g/2;if(ne){var he=(c.y1+c.y2)/2,fe=c.x1,me=c.x2;n.segpts=[fe,he,me,he]}else if(ce){var be=(c.x1+c.x2)/2,we=c.y1,ae=c.y2;n.segpts=[be,we,be,ae]}else n.segpts=[c.x2,c.y1]}else if(R){var L=c.y1+B+(b?p/2*M:0),Y=c.x1,K=c.x2;n.segpts=[Y,L,K,L]}else{var X=c.x1+B+(b?h/2*M:0),j=c.y1,se=c.y2;n.segpts=[X,j,X,se]}},tt.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,i=t.tgtPos,o=t.srcW,a=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=!ee(n.startX)||!ee(n.startY),p=!ee(n.arrowStartX)||!ee(n.arrowStartY),d=!ee(n.endX)||!ee(n.endY),g=!ee(n.arrowEndX)||!ee(n.arrowEndY),v=3,b=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,f=v*b,m=cn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=m<f,T=cn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),_=T<f,D=!1;if(h||p||x){D=!0;var y={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},E=Math.sqrt(y.x*y.x+y.y*y.y),w={x:y.x/E,y:y.y/E},C=Math.max(o,a),A={x:n.ctrlpts[0]+w.x*2*C,y:n.ctrlpts[1]+w.y*2*C},k=u.intersectLine(r.x,r.y,o,a,A.x,A.y,0);x?(n.ctrlpts[0]=n.ctrlpts[0]+w.x*(f-m),n.ctrlpts[1]=n.ctrlpts[1]+w.y*(f-m)):(n.ctrlpts[0]=k[0]+w.x*f,n.ctrlpts[1]=k[1]+w.y*f)}if(d||g||_){D=!0;var S={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},N=Math.sqrt(S.x*S.x+S.y*S.y),P={x:S.x/N,y:S.y/N},R=Math.max(o,a),I={x:n.ctrlpts[0]+P.x*2*R,y:n.ctrlpts[1]+P.y*2*R},O=c.intersectLine(i.x,i.y,s,l,I.x,I.y,0);_?(n.ctrlpts[0]=n.ctrlpts[0]+P.x*(f-T),n.ctrlpts[1]=n.ctrlpts[1]+P.y*(f-T)):(n.ctrlpts[0]=O[0]+P.x*f,n.ctrlpts[1]=O[1]+P.y*f)}D&&this.findEndpoints(e)}},tt.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=Ue(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=Ue(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments")if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4===0){var o=t.segpts.length/2,a=o-2;t.midX=(t.segpts[a]+t.segpts[o])/2,t.midY=(t.segpts[a+1]+t.segpts[o+1])/2}else{var s=t.segpts.length/2-1;t.midX=t.segpts[s],t.midY=t.segpts[s+1]}},tt.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ee(t.startX)&&ee(t.startY)&&ee(t.endX)&&ee(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,Le("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap."))},tt.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,i=r.hasCompoundNodes(),o={map:new kt,get:function(D){var y=this.map.get(D[0]);return y!=null?y.get(D[1]):null},set:function(D,y){var E=this.map.get(D[0]);E==null&&(E=new kt,this.map.set(D[0],E)),E.set(D[1],y)}},a=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,h=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(h==="haystack"){s.push(u);continue}var p=h==="unbundled-bezier"||h==="segments"||h==="straight"||h==="straight-triangle"||h==="taxi",d=h==="unbundled-bezier"||h==="bezier",g=c.source,v=c.target,b=g.poolIndex(),f=v.poolIndex(),m=[b,f].sort(),x=o.get(m);x==null&&(x={eles:[]},o.set(m,x),a.push(m)),x.eles.push(u),p&&(x.hasUnbundled=!0),d&&(x.hasBezier=!0)}}for(var T=function(D){var y=a[D],E=o.get(y),w=void 0;if(!E.hasUnbundled){var C=E.eles[0].parallelEdges().filter(function(we){return we.isBundledBezier()});Bi(E.eles),C.forEach(function(we){return E.eles.push(we)}),E.eles.sort(function(we,ae){return we.poolIndex()-ae.poolIndex()})}var A=E.eles[0],k=A.source(),S=A.target();if(k.poolIndex()>S.poolIndex()){var N=k;k=S,S=N}var P=E.srcPos=k.position(),R=E.tgtPos=S.position(),I=E.srcW=k.outerWidth(),O=E.srcH=k.outerHeight(),M=E.tgtW=S.outerWidth(),G=E.tgtH=S.outerHeight(),B=E.srcShape=n.nodeShapes[t.getNodeShape(k)],V=E.tgtShape=n.nodeShapes[t.getNodeShape(S)];E.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var F=0;F<E.eles.length;F++){var U=E.eles[F],Q=U[0]._private.rscratch,z=U.pstyle("curve-style").value,q=z==="unbundled-bezier"||z==="segments"||z==="taxi",H=!k.same(U.source());if(!E.calculatedIntersection&&k!==S&&(E.hasBezier||E.hasUnbundled)){E.calculatedIntersection=!0;var $=B.intersectLine(P.x,P.y,I,O,R.x,R.y,0),Z=E.srcIntn=$,te=V.intersectLine(R.x,R.y,M,G,P.x,P.y,0),pe=E.tgtIntn=te,ue=E.intersectionPts={x1:$[0],x2:te[0],y1:$[1],y2:te[1]},J=E.posPts={x1:P.x,x2:R.x,y1:P.y,y2:R.y},oe=te[1]-$[1],ne=te[0]-$[0],ce=Math.sqrt(ne*ne+oe*oe),he=E.vector={x:ne,y:oe},fe=E.vectorNorm={x:he.x/ce,y:he.y/ce},me={x:-fe.y,y:fe.x};E.nodesOverlap=!ee(ce)||V.checkPoint($[0],$[1],0,M,G,R.x,R.y)||B.checkPoint(te[0],te[1],0,I,O,P.x,P.y),E.vectorNormInverse=me,w={nodesOverlap:E.nodesOverlap,dirCounts:E.dirCounts,calculatedIntersection:!0,hasBezier:E.hasBezier,hasUnbundled:E.hasUnbundled,eles:E.eles,srcPos:R,tgtPos:P,srcW:M,srcH:G,tgtW:I,tgtH:O,srcIntn:pe,tgtIntn:Z,srcShape:V,tgtShape:B,posPts:{x1:J.x2,y1:J.y2,x2:J.x1,y2:J.y1},intersectionPts:{x1:ue.x2,y1:ue.y2,x2:ue.x1,y2:ue.y1},vector:{x:-he.x,y:-he.y},vectorNorm:{x:-fe.x,y:-fe.y},vectorNormInverse:{x:-me.x,y:-me.y}}}var be=H?w:E;Q.nodesOverlap=be.nodesOverlap,Q.srcIntn=be.srcIntn,Q.tgtIntn=be.tgtIntn,i&&(k.isParent()||k.isChild()||S.isParent()||S.isChild())&&(k.parents().anySame(S)||S.parents().anySame(k)||k.same(S)&&k.isParent())?t.findCompoundLoopPoints(U,be,F,q):k===S?t.findLoopPoints(U,be,F,q):z==="segments"?t.findSegmentsPoints(U,be):z==="taxi"?t.findTaxiPoints(U,be):z==="straight"||!q&&E.eles.length%2===1&&F===Math.floor(E.eles.length/2)?t.findStraightEdgePoints(U):t.findBezierPoints(U,be,F,q,H),t.findEndpoints(U),t.tryToCorrectInvalidPoints(U,be),t.checkForInvalidEdgeWarning(U),t.storeAllpts(U),t.storeEdgeProjections(U),t.calculateArrowAngles(U),t.recalculateEdgeLabelProjections(U),t.calculateLabelAngles(U)}},_=0;_<a.length;_++)T(_);this.findHaystackPoints(s)}};function Oo(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}tt.getSegmentPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="segments")return this.recalculateRenderedStyle(e),Oo(t.segpts)},tt.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return this.recalculateRenderedStyle(e),Oo(t.ctrlpts)},tt.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var er={};er.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),o=e.outerHeight();if(t.value.length===2){var a=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(a[0]=a[0]*i),t.units[1]==="%"&&(a[1]=a[1]*o),a[0]+=r.x,a[1]+=r.y,a}else{var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(i,o),u=[r.x+Math.cos(s)*l,r.y+Math.sin(s)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,o,u[0],u[1],0)}},er.findEndpoints=function(e){var t=this,n,r=e.source()[0],i=e.target()[0],o=r.position(),a=i.position(),s=e.pstyle("target-arrow-shape").value,l=e.pstyle("source-arrow-shape").value,u=e.pstyle("target-distance-from-node").pfValue,c=e.pstyle("source-distance-from-node").pfValue,h=e.pstyle("curve-style").value,p=e._private.rscratch,d=p.edgeType,g=h==="taxi",v=d==="self"||d==="compound",b=d==="bezier"||d==="multibezier"||v,f=d!=="bezier",m=d==="straight"||d==="segments",x=d==="segments",T=b||f||m,_=v||g,D=e.pstyle("source-endpoint"),y=_?"outside-to-node":D.value,E=e.pstyle("target-endpoint"),w=_?"outside-to-node":E.value;p.srcManEndpt=D,p.tgtManEndpt=E;var C,A,k,S;if(b){var N=[p.ctrlpts[0],p.ctrlpts[1]],P=f?[p.ctrlpts[p.ctrlpts.length-2],p.ctrlpts[p.ctrlpts.length-1]]:N;C=P,A=N}else if(m){var R=x?p.segpts.slice(0,2):[a.x,a.y],I=x?p.segpts.slice(p.segpts.length-2):[o.x,o.y];C=I,A=R}if(w==="inside-to-node")n=[a.x,a.y];else if(E.units)n=this.manualEndptToPx(i,E);else if(w==="outside-to-line")n=p.tgtIntn;else if(w==="outside-to-node"||w==="outside-to-node-or-label"?k=C:(w==="outside-to-line"||w==="outside-to-line-or-label")&&(k=[o.x,o.y]),n=t.nodeShapes[this.getNodeShape(i)].intersectLine(a.x,a.y,i.outerWidth(),i.outerHeight(),k[0],k[1],0),w==="outside-to-node-or-label"||w==="outside-to-line-or-label"){var O=i._private.rscratch,M=O.labelWidth,G=O.labelHeight,B=O.labelX,V=O.labelY,F=M/2,U=G/2,Q=i.pstyle("text-valign").value;Q==="top"?V-=U:Q==="bottom"&&(V+=U);var z=i.pstyle("text-halign").value;z==="left"?B-=F:z==="right"&&(B+=F);var q=nr(k[0],k[1],[B-F,V-U,B+F,V-U,B+F,V+U,B-F,V+U],a.x,a.y);if(q.length>0){var H=o,$=nn(H,Ln(n)),Z=nn(H,Ln(q)),te=$;if(Z<$&&(n=q,te=Z),q.length>2){var pe=nn(H,{x:q[2],y:q[3]});pe<te&&(n=[q[2],q[3]])}}}var ue=Dr(n,C,t.arrowShapes[s].spacing(e)+u),J=Dr(n,C,t.arrowShapes[s].gap(e)+u);if(p.endX=J[0],p.endY=J[1],p.arrowEndX=ue[0],p.arrowEndY=ue[1],y==="inside-to-node")n=[o.x,o.y];else if(D.units)n=this.manualEndptToPx(r,D);else if(y==="outside-to-line")n=p.srcIntn;else if(y==="outside-to-node"||y==="outside-to-node-or-label"?S=A:(y==="outside-to-line"||y==="outside-to-line-or-label")&&(S=[a.x,a.y]),n=t.nodeShapes[this.getNodeShape(r)].intersectLine(o.x,o.y,r.outerWidth(),r.outerHeight(),S[0],S[1],0),y==="outside-to-node-or-label"||y==="outside-to-line-or-label"){var oe=r._private.rscratch,ne=oe.labelWidth,ce=oe.labelHeight,he=oe.labelX,fe=oe.labelY,me=ne/2,be=ce/2,we=r.pstyle("text-valign").value;we==="top"?fe-=be:we==="bottom"&&(fe+=be);var ae=r.pstyle("text-halign").value;ae==="left"?he-=me:ae==="right"&&(he+=me);var L=nr(S[0],S[1],[he-me,fe-be,he+me,fe-be,he+me,fe+be,he-me,fe+be],o.x,o.y);if(L.length>0){var Y=a,K=nn(Y,Ln(n)),X=nn(Y,Ln(L)),j=K;if(X<K&&(n=[L[0],L[1]],j=X),L.length>2){var se=nn(Y,{x:L[2],y:L[3]});se<j&&(n=[L[2],L[3]])}}}var W=Dr(n,A,t.arrowShapes[l].spacing(e)+c),ie=Dr(n,A,t.arrowShapes[l].gap(e)+c);p.startX=ie[0],p.startY=ie[1],p.arrowStartX=W[0],p.arrowStartY=W[1],T&&(!ee(p.startX)||!ee(p.startY)||!ee(p.endX)||!ee(p.endY)?p.badLine=!0:p.badLine=!1)},er.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},er.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var Ki={};function _y(e,t,n){for(var r=function(l,u,c,h){return Ue(l,u,c,h)},i=t._private,o=i.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var s=e.bezierProjPcts[a];o.push({x:r(n[0],n[2],n[4],s),y:r(n[1],n[3],n[5],s)})}}Ki.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)_y(this,e,n.allpts.slice(i,i+6))}else if(r==="segments")for(var o=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)o.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r==="haystack"){var a=n.haystackPts;t.rstyle.haystackPts=[{x:a[0],y:a[1]},{x:a[2],y:a[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},Ki.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var Dt={};Dt.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!$t(t)){var n,r,i=e._private,o=e.width(),a=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,h=i.rscratch,p=i.rstyle;switch(u){case"left":n=l.x-o/2-s;break;case"right":n=l.x+o/2+s;break;default:n=l.x}switch(c){case"top":r=l.y-a/2-s;break;case"bottom":r=l.y+a/2+s;break;default:r=l.y}h.labelX=n,h.labelY=r,p.labelX=n,p.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var ul=function(e,t){var n=Math.atan(t/e);return e===0&&n<0&&(n=n*-1),n},cl=function(e,t){var n=t.x-e.x,r=t.y-e.y;return ul(n,r)},Ty=function(e,t,n,r){var i=lr(0,r-.001,1),o=lr(0,r+.001,1),a=In(e,t,n,i),s=In(e,t,n,o);return cl(a,s)};Dt.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,o={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(o.mid||o.source||o.target){t={x:r.midX,y:r.midY};var a=function(c,h,p){Ft(n.rscratch,c,h,p),Ft(n.rstyle,c,h,p)};a("labelX",null,t.x),a("labelY",null,t.y);var s=ul(r.midDispX,r.midDispY);a("labelAutoAngle",null,s);var l=function c(){if(c.cache)return c.cache;for(var h=[],p=0;p+5<r.allpts.length;p+=4){var d={x:r.allpts[p],y:r.allpts[p+1]},g={x:r.allpts[p+2],y:r.allpts[p+3]},v={x:r.allpts[p+4],y:r.allpts[p+5]};h.push({p0:d,p1:g,p2:v,startDist:0,length:0,segments:[]})}var b=n.rstyle.bezierPts,f=i.bezierProjPcts.length;function m(y,E,w,C,A){var k=cn(E,w),S=y.segments[y.segments.length-1],N={p0:E,p1:w,t0:C,t1:A,startDist:S?S.startDist+S.length:0,length:k};y.segments.push(N),y.length+=k}for(var x=0;x<h.length;x++){var T=h[x],_=h[x-1];_&&(T.startDist=_.startDist+_.length),m(T,T.p0,b[x*f],0,i.bezierProjPcts[0]);for(var D=0;D<f-1;D++)m(T,b[x*f+D],b[x*f+D+1],i.bezierProjPcts[D],i.bezierProjPcts[D+1]);m(T,b[x*f+f-1],T.p2,i.bezierProjPcts[f-1],1)}return c.cache=h},u=function(c){var h,p=c==="source";if(o[c]){var d=e.pstyle(c+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=l(),v,b=0,f=0,m=0;m<g.length;m++){for(var x=g[p?m:g.length-1-m],T=0;T<x.segments.length;T++){var _=x.segments[p?T:x.segments.length-1-T],D=m===g.length-1&&T===x.segments.length-1;if(b=f,f+=_.length,f>=d||D){v={cp:x,segment:_};break}}if(v)break}var y=v.cp,E=v.segment,w=(d-b)/E.length,C=E.t1-E.t0,A=p?E.t0+C*w:E.t1-C*w;A=lr(0,A,1),t=In(y.p0,y.p1,y.p2,A),h=Ty(y.p0,y.p1,y.p2,A);break}case"straight":case"segments":case"haystack":{for(var k=0,S,N,P,R,I=r.allpts.length,O=0;O+3<I&&(p?(P={x:r.allpts[O],y:r.allpts[O+1]},R={x:r.allpts[O+2],y:r.allpts[O+3]}):(P={x:r.allpts[I-2-O],y:r.allpts[I-1-O]},R={x:r.allpts[I-4-O],y:r.allpts[I-3-O]}),S=cn(P,R),N=k,k+=S,!(k>=d));O+=2);var M=d-N,G=M/S;G=lr(0,G,1),t=Bg(P,R,G),h=cl(P,R);break}}a("labelX",c,t.x),a("labelY",c,t.y),a("labelAutoAngle",c,h)}};u("source"),u("target"),this.applyLabelDimensions(e)}},Dt.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},Dt.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,a=e.pstyle("text-wrap").strValue,s=wt(n.rscratch,"labelWrapCachedLines",t)||[],l=a!=="wrap"?1:Math.max(s.length,1),u=i.height/l,c=u*o,h=i.width,p=i.height+(l-1)*(o-1)*u;Ft(n.rstyle,"labelWidth",t,h),Ft(n.rscratch,"labelWidth",t,h),Ft(n.rstyle,"labelHeight",t,p),Ft(n.rscratch,"labelHeight",t,p),Ft(n.rscratch,"labelLineHeight",t,c)},Dt.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,a=function(M,G){return G?(Ft(n.rscratch,M,t,G),G):wt(n.rscratch,M,t)};if(!i)return"";o=="none"||(o=="uppercase"?i=i.toUpperCase():o=="lowercase"&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if(s==="wrap"){var l=a("labelKey");if(l!=null&&a("labelWrapKey")===l)return a("labelWrapCachedText");for(var u="​",c=i.split("\n"),h=e.pstyle("text-max-width").pfValue,p=e.pstyle("text-overflow-wrap").value,d=p==="anywhere",g=[],v=/[\s\u200b]+/,b=d?"":" ",f=0;f<c.length;f++){var m=c[f],x=this.calculateLabelDimensions(e,m),T=x.width;if(d){var _=m.split("").join(u);m=_}if(T>h){for(var D=m.split(v),y="",E=0;E<D.length;E++){var w=D[E],C=y.length===0?w:y+b+w,A=this.calculateLabelDimensions(e,C),k=A.width;k<=h?y+=w+b:(y&&g.push(y),y=w+b)}y.match(/^[\s\u200b]+$/)||g.push(y)}else g.push(m)}a("labelWrapCachedLines",g),i=a("labelWrapCachedText",g.join("\n")),a("labelWrapKey",l)}else if(s==="ellipsis"){var S=e.pstyle("text-max-width").pfValue,N="",P="…",R=!1;if(this.calculateLabelDimensions(e,i).width<S)return i;for(var I=0;I<i.length;I++){var O=this.calculateLabelDimensions(e,N+i[I]+P).width;if(O>S)break;N+=i[I],I===i.length-1&&(R=!0)}return R||(N+=P),N}return i},Dt.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},Dt.calculateLabelDimensions=function(e,t){var n=this,r=un(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),o=i[r];if(o!=null)return o;var a=0,s=e.pstyle("font-style").strValue,l=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,c=e.pstyle("font-weight").strValue,h=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),p=this.labelCalcCanvasContext=h.getContext("2d");var d=h.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}p.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);for(var g=0,v=0,b=t.split("\n"),f=0;f<b.length;f++){var m=b[f],x=p.measureText(m),T=Math.ceil(x.width),_=l;g=Math.max(T,g),v+=_}return g+=a,v+=a,i[r]={width:g,height:v}},Dt.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,i=e.isEdge(),o=t?t+"-":"",a=e.pstyle(o+"text-rotation"),s=a.strValue;return s==="none"?0:i&&s==="autorotate"?r.labelAutoAngle:s==="autorotate"?0:a.pfValue},Dt.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,i=r.rscratch;i.labelAngle=t.calculateLabelAngle(e),n&&(i.sourceLabelAngle=t.calculateLabelAngle(e,"source"),i.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var hl={},Mo=28,Ro=!1;hl.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<Mo||e.height()<Mo))return Ro||(Le("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Ro=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var qr={};qr.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(o){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(o),a)for(var s=0;s<o.length;s++){var l=o[s],u=l._private,c=u.rstyle;c.clean=!1,c.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(o){var a=o.target;r(a)}).on("style.* background.*",function(o){var a=o.target;r(a,!1)});var i=function(o){if(o){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var s=0;s<t.length;s++){var l=t[s],u=l._private.rstyle;l.isNode()&&!u.cleanConnected&&(r(l.connectedEdges()),u.cleanConnected=!0)}if(a)for(var c=0;c<a.length;c++){var h=a[c];h(o,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},qr.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},qr.recalculateRenderedStyle=function(e,t){var n=function(x){return x._private.rstyle.cleanConnected},r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var o=0;o<e.length;o++){var a=e[o],s=a._private,l=s.rstyle;a.isEdge()&&(!n(a.source())||!n(a.target()))&&(l.clean=!1),!(t&&l.clean||a.removed())&&a.pstyle("display").value!=="none"&&(s.group==="nodes"?i.push(a):r.push(a),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],h=c._private,p=h.rstyle,d=c.position();this.recalculateNodeLabelProjection(c),p.nodeX=d.x,p.nodeY=d.y,p.nodeW=c.pstyle("width").pfValue,p.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var g=0;g<r.length;g++){var v=r[g],b=v._private,f=b.rstyle,m=b.rscratch;f.srcX=m.arrowStartX,f.srcY=m.arrowStartY,f.tgtX=m.arrowEndX,f.tgtY=m.arrowEndY,f.midX=m.midX,f.midY=m.midY,f.labelAngle=m.labelAngle,f.sourceLabelAngle=m.sourceLabelAngle,f.targetLabelAngle=m.targetLabelAngle}}};var $r={};$r.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},$r.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},$r.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(Qs),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var dl={};[on,Wr,tt,er,Ki,Dt,hl,qr,$r].forEach(function(e){de(dl,e)});var pl={};pl.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},o=i[e];if(o)return o.image.complete||o.image.addEventListener("load",n),o.image;o=i[e]=i[e]||{};var a=o.image=new Image;a.addEventListener("load",n),a.addEventListener("error",function(){a.error=!0});var s="data:",l=e.substring(0,s.length).toLowerCase()===s;return l||(t=t==="null"?null:t,a.crossOrigin=t),a.src=e,a};var An={};An.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]),o=this.binder(e);return o.on.apply(o,i)},An.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||Vp(e);if(t.supportsPassiveEvents==null){var i=!1;try{var o=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,o)}catch{}t.supportsPassiveEvents=i}var a=function(s,l,u){var c=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(c[2]={capture:u!=null?u:!1,passive:!1,once:!1}),t.bindings.push({target:e,args:c}),(e.addEventListener||e.on).apply(e,c),this};return{on:a,addEventListener:a,addListener:a,bind:a}},An.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},An.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},An.load=function(){var e=this,t=e.cy.window(),n=function(L){return L.selected()},r=function(L,Y,K,X){L==null&&(L=e.cy);for(var j=0;j<Y.length;j++){var se=Y[j];L.emit({originalEvent:K,type:se,position:X})}},i=function(L){return L.shiftKey||L.metaKey||L.ctrlKey},o=function(L,Y){var K=!0;if(e.cy.hasCompoundNodes()&&L&&L.pannable())for(var X=0;Y&&X<Y.length;X++){var L=Y[X];if(L.isNode()&&L.isParent()&&!L.pannable()){K=!1;break}}else K=!0;return K},a=function(L){L[0]._private.grabbed=!0},s=function(L){L[0]._private.grabbed=!1},l=function(L){L[0]._private.rscratch.inDragLayer=!0},u=function(L){L[0]._private.rscratch.inDragLayer=!1},c=function(L){L[0]._private.rscratch.isGrabTarget=!0},h=function(L){L[0]._private.rscratch.isGrabTarget=!1},p=function(L,Y){var K=Y.addToList,X=K.has(L);!X&&L.grabbable()&&!L.locked()&&(K.merge(L),a(L))},d=function(L,Y){if(L.cy().hasCompoundNodes()&&!(Y.inDragLayer==null&&Y.addToList==null)){var K=L.descendants();Y.inDragLayer&&(K.forEach(l),K.connectedEdges().forEach(l)),Y.addToList&&p(K,Y)}},g=function(L,Y){Y=Y||{};var K=L.cy().hasCompoundNodes();Y.inDragLayer&&(L.forEach(l),L.neighborhood().stdFilter(function(X){return!K||X.isEdge()}).forEach(l)),Y.addToList&&L.forEach(function(X){p(X,Y)}),d(L,Y),f(L,{inDragLayer:Y.inDragLayer}),e.updateCachedGrabbedEles()},v=g,b=function(L){L&&(e.getCachedZSortedEles().forEach(function(Y){s(Y),u(Y),h(Y)}),e.updateCachedGrabbedEles())},f=function(L,Y){if(!(Y.inDragLayer==null&&Y.addToList==null)&&L.cy().hasCompoundNodes()){var K=L.ancestors().orphans();if(!K.same(L)){var X=K.descendants().spawnSelf().merge(K).unmerge(L).unmerge(L.descendants()),j=X.connectedEdges();Y.inDragLayer&&(j.forEach(l),X.forEach(l)),Y.addToList&&X.forEach(function(se){p(se,Y)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},x=typeof MutationObserver<"u",T=typeof ResizeObserver<"u";x?(e.removeObserver=new MutationObserver(function(L){for(var Y=0;Y<L.length;Y++){var K=L[Y],X=K.removedNodes;if(X)for(var j=0;j<X.length;j++){var se=X[j];if(se===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(L){e.destroy()});var _=pi.default(function(){e.cy.resize()},100);x&&(e.styleObserver=new MutationObserver(_),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",_),T&&(e.resizeObserver=new ResizeObserver(_),e.resizeObserver.observe(e.container));var D=function(L,Y){for(;L!=null;)Y(L),L=L.parentNode},y=function(){e.invalidateContainerClientCoordsCache()};D(e.container,function(L){e.registerBinding(L,"transitionend",y),e.registerBinding(L,"animationend",y),e.registerBinding(L,"scroll",y)}),e.registerBinding(e.container,"contextmenu",function(L){L.preventDefault()});var E=function(){return e.selection[4]!==0},w=function(L){for(var Y=e.findContainerClientCoords(),K=Y[0],X=Y[1],j=Y[2],se=Y[3],W=L.touches?L.touches:[L],ie=!1,xe=0;xe<W.length;xe++){var Te=W[xe];if(K<=Te.clientX&&Te.clientX<=K+j&&X<=Te.clientY&&Te.clientY<=X+se){ie=!0;break}}if(!ie)return!1;for(var ve=e.container,De=L.target,ye=De.parentNode,ge=!1;ye;){if(ye===ve){ge=!0;break}ye=ye.parentNode}return!!ge};e.registerBinding(e.container,"mousedown",function(L){if(w(L)){L.preventDefault(),m(),e.hoverData.capture=!0,e.hoverData.which=L.which;var Y=e.cy,K=[L.clientX,L.clientY],X=e.projectIntoViewport(K[0],K[1]),j=e.selection,se=e.findNearestElements(X[0],X[1],!0,!1),W=se[0],ie=e.dragData.possibleDragElements;e.hoverData.mdownPos=X,e.hoverData.mdownGPos=K;var xe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var ge=e.hoverData.down;ge?ge.emit({originalEvent:L,type:"taphold",position:{x:X[0],y:X[1]}}):Y.emit({originalEvent:L,type:"taphold",position:{x:X[0],y:X[1]}})}},e.tapholdDuration)};if(L.which==3){e.hoverData.cxtStarted=!0;var Te={originalEvent:L,type:"cxttapstart",position:{x:X[0],y:X[1]}};W?(W.activate(),W.emit(Te),e.hoverData.down=W):Y.emit(Te),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(L.which==1){W&&W.activate();{if(W!=null&&e.nodeIsGrabbable(W)){var ve=function(ge){return{originalEvent:L,type:ge,position:{x:X[0],y:X[1]}}},De=function(ge){ge.emit(ve("grab"))};if(c(W),!W.selected())ie=e.dragData.possibleDragElements=Y.collection(),v(W,{addToList:ie}),W.emit(ve("grabon")).emit(ve("grab"));else{ie=e.dragData.possibleDragElements=Y.collection();var ye=Y.$(function(ge){return ge.isNode()&&ge.selected()&&e.nodeIsGrabbable(ge)});g(ye,{addToList:ie}),W.emit(ve("grabon")),ye.forEach(De)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=W,e.hoverData.downs=se,e.hoverData.downTime=new Date().getTime()}r(W,["mousedown","tapstart","vmousedown"],L,{x:X[0],y:X[1]}),W==null?(j[4]=1,e.data.bgActivePosistion={x:X[0],y:X[1]},e.redrawHint("select",!0),e.redraw()):W.pannable()&&(j[4]=1),xe()}j[0]=j[2]=X[0],j[1]=j[3]=X[1]}},!1),e.registerBinding(t,"mousemove",function(L){var Y=e.hoverData.capture;if(!(!Y&&!w(L))){var K=!1,X=e.cy,j=X.zoom(),se=[L.clientX,L.clientY],W=e.projectIntoViewport(se[0],se[1]),ie=e.hoverData.mdownPos,xe=e.hoverData.mdownGPos,Te=e.selection,ve=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(ve=e.findNearestElement(W[0],W[1],!0,!1));var De=e.hoverData.last,ye=e.hoverData.down,ge=[W[0]-Te[2],W[1]-Te[3]],Xe=e.dragData.possibleDragElements,at;if(xe){var ft=se[0]-xe[0],vt=ft*ft,je=se[1]-xe[1],dt=je*je,Ze=vt+dt;e.hoverData.isOverThresholdDrag=at=Ze>=e.desktopTapThreshold2}var Zt=i(L);at&&(e.hoverData.tapholdCancelled=!0);var Ot=function(){var Rt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Rt.length===0?(Rt.push(ge[0]),Rt.push(ge[1])):(Rt[0]+=ge[0],Rt[1]+=ge[1])};K=!0,r(ve,["mousemove","vmousemove","tapdrag"],L,{x:W[0],y:W[1]});var Mt=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||X.emit({originalEvent:L,type:"boxstart",position:{x:W[0],y:W[1]}}),Te[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(at){var br={originalEvent:L,type:"cxtdrag",position:{x:W[0],y:W[1]}};ye?ye.emit(br):X.emit(br),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||ve!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:L,type:"cxtdragout",position:{x:W[0],y:W[1]}}),e.hoverData.cxtOver=ve,ve&&ve.emit({originalEvent:L,type:"cxtdragover",position:{x:W[0],y:W[1]}}))}}else if(e.hoverData.dragging){if(K=!0,X.panningEnabled()&&X.userPanningEnabled()){var dn;if(e.hoverData.justStartedPan){var xr=e.hoverData.mdownPos;dn={x:(W[0]-xr[0])*j,y:(W[1]-xr[1])*j},e.hoverData.justStartedPan=!1}else dn={x:ge[0]*j,y:ge[1]*j};X.panBy(dn),X.emit("dragpan"),e.hoverData.dragged=!0}W=e.projectIntoViewport(L.clientX,L.clientY)}else if(Te[4]==1&&(ye==null||ye.pannable())){if(at){if(!e.hoverData.dragging&&X.boxSelectionEnabled()&&(Zt||!X.panningEnabled()||!X.userPanningEnabled()))Mt();else if(!e.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var Qt=o(ye,e.hoverData.downs);Qt&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Te[4]=0,e.data.bgActivePosistion=Ln(ie),e.redrawHint("select",!0),e.redraw())}ye&&ye.pannable()&&ye.active()&&ye.unactivate()}}else{if(ye&&ye.pannable()&&ye.active()&&ye.unactivate(),(!ye||!ye.grabbed())&&ve!=De&&(De&&r(De,["mouseout","tapdragout"],L,{x:W[0],y:W[1]}),ve&&r(ve,["mouseover","tapdragover"],L,{x:W[0],y:W[1]}),e.hoverData.last=ve),ye)if(at){if(X.boxSelectionEnabled()&&Zt)ye&&ye.grabbed()&&(b(Xe),ye.emit("freeon"),Xe.emit("free"),e.dragData.didDrag&&(ye.emit("dragfreeon"),Xe.emit("dragfree"))),Mt();else if(ye&&ye.grabbed()&&e.nodeIsDraggable(ye)){var ot=!e.dragData.didDrag;ot&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||g(Xe,{inDragLayer:!0});var Qe={x:0,y:0};if(ee(ge[0])&&ee(ge[1])&&(Qe.x+=ge[0],Qe.y+=ge[1],ot)){var st=e.hoverData.dragDelta;st&&ee(st[0])&&ee(st[1])&&(Qe.x+=st[0],Qe.y+=st[1])}e.hoverData.draggingEles=!0,Xe.silentShift(Qe).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else Ot();K=!0}if(Te[2]=W[0],Te[3]=W[1],K)return L.stopPropagation&&L.stopPropagation(),L.preventDefault&&L.preventDefault(),!1}},!1);var C,A,k;e.registerBinding(t,"mouseup",function(L){var Y=e.hoverData.capture;if(Y){e.hoverData.capture=!1;var K=e.cy,X=e.projectIntoViewport(L.clientX,L.clientY),j=e.selection,se=e.findNearestElement(X[0],X[1],!0,!1),W=e.dragData.possibleDragElements,ie=e.hoverData.down,xe=i(L);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ie&&ie.unactivate(),e.hoverData.which===3){var Te={originalEvent:L,type:"cxttapend",position:{x:X[0],y:X[1]}};if(ie?ie.emit(Te):K.emit(Te),!e.hoverData.cxtDragged){var ve={originalEvent:L,type:"cxttap",position:{x:X[0],y:X[1]}};ie?ie.emit(ve):K.emit(ve)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(se,["mouseup","tapend","vmouseup"],L,{x:X[0],y:X[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(r(ie,["click","tap","vclick"],L,{x:X[0],y:X[1]}),A=!1,L.timeStamp-k<=K.multiClickDebounceTime()?(C&&clearTimeout(C),A=!0,k=null,r(ie,["dblclick","dbltap","vdblclick"],L,{x:X[0],y:X[1]})):(C=setTimeout(function(){A||r(ie,["oneclick","onetap","voneclick"],L,{x:X[0],y:X[1]})},K.multiClickDebounceTime()),k=L.timeStamp)),ie==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!i(L)&&(K.$(n).unselect(["tapunselect"]),W.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=W=K.collection()),se==ie&&!e.dragData.didDrag&&!e.hoverData.selecting&&se!=null&&se._private.selectable&&(e.hoverData.dragging||(K.selectionType()==="additive"||xe?se.selected()?se.unselect(["tapunselect"]):se.select(["tapselect"]):xe||(K.$(n).unmerge(se).unselect(["tapunselect"]),se.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var De=K.collection(e.getAllInBox(j[0],j[1],j[2],j[3]));e.redrawHint("select",!0),De.length>0&&e.redrawHint("eles",!0),K.emit({type:"boxend",originalEvent:L,position:{x:X[0],y:X[1]}});var ye=function(Xe){return Xe.selectable()&&!Xe.selected()};K.selectionType()==="additive"||xe||K.$(n).unmerge(De).unselect(),De.emit("box").stdFilter(ye).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!j[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ge=ie&&ie.grabbed();b(W),ge&&(ie.emit("freeon"),W.emit("free"),e.dragData.didDrag&&(ie.emit("dragfreeon"),W.emit("dragfree")))}}j[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null}},!1);var S=function(L){if(!e.scrollingPage){var Y=e.cy,K=Y.zoom(),X=Y.pan(),j=e.projectIntoViewport(L.clientX,L.clientY),se=[j[0]*K+X.x,j[1]*K+X.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||E()){L.preventDefault();return}if(Y.panningEnabled()&&Y.userPanningEnabled()&&Y.zoomingEnabled()&&Y.userZoomingEnabled()){L.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var W;L.deltaY!=null?W=L.deltaY/-250:L.wheelDeltaY!=null?W=L.wheelDeltaY/1e3:W=L.wheelDelta/1e3,W=W*e.wheelSensitivity;var ie=L.deltaMode===1;ie&&(W*=33);var xe=Y.zoom()*Math.pow(10,W);L.type==="gesturechange"&&(xe=e.gestureStartZoom*L.scale),Y.zoom({level:xe,renderedPosition:{x:se[0],y:se[1]}}),Y.emit(L.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",S,!0),e.registerBinding(t,"scroll",function(L){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(L){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||L.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(L){e.hasTouchStarted||S(L)},!0),e.registerBinding(e.container,"mouseout",function(L){var Y=e.projectIntoViewport(L.clientX,L.clientY);e.cy.emit({originalEvent:L,type:"mouseout",position:{x:Y[0],y:Y[1]}})},!1),e.registerBinding(e.container,"mouseover",function(L){var Y=e.projectIntoViewport(L.clientX,L.clientY);e.cy.emit({originalEvent:L,type:"mouseover",position:{x:Y[0],y:Y[1]}})},!1);var N,P,R,I,O,M,G,B,V,F,U,Q,z,q=function(L,Y,K,X){return Math.sqrt((K-L)*(K-L)+(X-Y)*(X-Y))},H=function(L,Y,K,X){return(K-L)*(K-L)+(X-Y)*(X-Y)},$;e.registerBinding(e.container,"touchstart",$=function(L){if(e.hasTouchStarted=!0,!!w(L)){m(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var Y=e.cy,K=e.touchData.now,X=e.touchData.earlier;if(L.touches[0]){var j=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);K[0]=j[0],K[1]=j[1]}if(L.touches[1]){var j=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);K[2]=j[0],K[3]=j[1]}if(L.touches[2]){var j=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);K[4]=j[0],K[5]=j[1]}if(L.touches[1]){e.touchData.singleTouchMoved=!0,b(e.dragData.touchDragEles);var se=e.findContainerClientCoords();V=se[0],F=se[1],U=se[2],Q=se[3],N=L.touches[0].clientX-V,P=L.touches[0].clientY-F,R=L.touches[1].clientX-V,I=L.touches[1].clientY-F,z=0<=N&&N<=U&&0<=R&&R<=U&&0<=P&&P<=Q&&0<=I&&I<=Q;var W=Y.pan(),ie=Y.zoom();O=q(N,P,R,I),M=H(N,P,R,I),G=[(N+R)/2,(P+I)/2],B=[(G[0]-W.x)/ie,(G[1]-W.y)/ie];var xe=200,Te=xe*xe;if(M<Te&&!L.touches[2]){var ve=e.findNearestElement(K[0],K[1],!0,!0),De=e.findNearestElement(K[2],K[3],!0,!0);ve&&ve.isNode()?(ve.activate().emit({originalEvent:L,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start=ve):De&&De.isNode()?(De.activate().emit({originalEvent:L,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start=De):Y.emit({originalEvent:L,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(L.touches[2])Y.boxSelectionEnabled()&&L.preventDefault();else if(!L.touches[1]&&L.touches[0]){var ye=e.findNearestElements(K[0],K[1],!0,!0),ge=ye[0];if(ge!=null&&(ge.activate(),e.touchData.start=ge,e.touchData.starts=ye,e.nodeIsGrabbable(ge))){var Xe=e.dragData.touchDragEles=Y.collection(),at=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ge.selected()?(at=Y.$(function(Ze){return Ze.selected()&&e.nodeIsGrabbable(Ze)}),g(at,{addToList:Xe})):v(ge,{addToList:Xe}),c(ge);var ft=function(Ze){return{originalEvent:L,type:Ze,position:{x:K[0],y:K[1]}}};ge.emit(ft("grabon")),at?at.forEach(function(Ze){Ze.emit(ft("grab"))}):ge.emit(ft("grab"))}r(ge,["touchstart","tapstart","vmousedown"],L,{x:K[0],y:K[1]}),ge==null&&(e.data.bgActivePosistion={x:j[0],y:j[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&r(e.touchData.start,["taphold"],L,{x:K[0],y:K[1]})},e.tapholdDuration)}if(L.touches.length>=1){for(var vt=e.touchData.startPosition=[null,null,null,null,null,null],je=0;je<K.length;je++)vt[je]=X[je]=K[je];var dt=L.touches[0];e.touchData.startGPosition=[dt.clientX,dt.clientY]}}},!1);var Z;e.registerBinding(window,"touchmove",Z=function(L){var Y=e.touchData.capture;if(!(!Y&&!w(L))){var K=e.selection,X=e.cy,j=e.touchData.now,se=e.touchData.earlier,W=X.zoom();if(L.touches[0]){var ie=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);j[0]=ie[0],j[1]=ie[1]}if(L.touches[1]){var ie=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);j[2]=ie[0],j[3]=ie[1]}if(L.touches[2]){var ie=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);j[4]=ie[0],j[5]=ie[1]}var xe=e.touchData.startGPosition,Te;if(Y&&L.touches[0]&&xe){for(var ve=[],De=0;De<j.length;De++)ve[De]=j[De]-se[De];var ye=L.touches[0].clientX-xe[0],ge=ye*ye,Xe=L.touches[0].clientY-xe[1],at=Xe*Xe,ft=ge+at;Te=ft>=e.touchTapThreshold2}if(Y&&e.touchData.cxt){L.preventDefault();var vt=L.touches[0].clientX-V,je=L.touches[0].clientY-F,dt=L.touches[1].clientX-V,Ze=L.touches[1].clientY-F,Zt=H(vt,je,dt,Ze),Ot=Zt/M,Mt=150,br=Mt*Mt,dn=1.5,xr=dn*dn;if(Ot>=xr||Zt>=br){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Qt={originalEvent:L,type:"cxttapend",position:{x:j[0],y:j[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(Qt),e.touchData.start=null):X.emit(Qt)}}if(Y&&e.touchData.cxt){var Qt={originalEvent:L,type:"cxtdrag",position:{x:j[0],y:j[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(Qt):X.emit(Qt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var ot=e.findNearestElement(j[0],j[1],!0,!0);(!e.touchData.cxtOver||ot!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:L,type:"cxtdragout",position:{x:j[0],y:j[1]}}),e.touchData.cxtOver=ot,ot&&ot.emit({originalEvent:L,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}else if(Y&&L.touches[2]&&X.boxSelectionEnabled())L.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||X.emit({originalEvent:L,type:"boxstart",position:{x:j[0],y:j[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,K[4]=1,!K||K.length===0||K[0]===void 0?(K[0]=(j[0]+j[2]+j[4])/3,K[1]=(j[1]+j[3]+j[5])/3,K[2]=(j[0]+j[2]+j[4])/3+1,K[3]=(j[1]+j[3]+j[5])/3+1):(K[2]=(j[0]+j[2]+j[4])/3,K[3]=(j[1]+j[3]+j[5])/3),e.redrawHint("select",!0),e.redraw();else if(Y&&L.touches[1]&&!e.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){L.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Qe=e.dragData.touchDragEles;if(Qe){e.redrawHint("drag",!0);for(var st=0;st<Qe.length;st++){var Rt=Qe[st]._private;Rt.grabbed=!1,Rt.rscratch.inDragLayer=!1}}var wr=e.touchData.start,vt=L.touches[0].clientX-V,je=L.touches[0].clientY-F,dt=L.touches[1].clientX-V,Ze=L.touches[1].clientY-F,xa=q(vt,je,dt,Ze),Sl=xa/O;if(z){var Il=vt-N,Pl=je-P,Ol=dt-R,Ml=Ze-I,Rl=(Il+Ol)/2,Bl=(Pl+Ml)/2,Fn=X.zoom(),xi=Fn*Sl,Er=X.pan(),wa=B[0]*Fn+Er.x,Ea=B[1]*Fn+Er.y,Fl={x:-xi/Fn*(wa-Er.x-Rl)+wa,y:-xi/Fn*(Ea-Er.y-Bl)+Ea};if(wr&&wr.active()){var Qe=e.dragData.touchDragEles;b(Qe),e.redrawHint("drag",!0),e.redrawHint("eles",!0),wr.unactivate().emit("freeon"),Qe.emit("free"),e.dragData.didDrag&&(wr.emit("dragfreeon"),Qe.emit("dragfree"))}X.viewport({zoom:xi,pan:Fl,cancelOnFailedZoom:!0}),X.emit("pinchzoom"),O=xa,N=vt,P=je,R=dt,I=Ze,e.pinching=!0}if(L.touches[0]){var ie=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);j[0]=ie[0],j[1]=ie[1]}if(L.touches[1]){var ie=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);j[2]=ie[0],j[3]=ie[1]}if(L.touches[2]){var ie=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);j[4]=ie[0],j[5]=ie[1]}}else if(L.touches[0]&&!e.touchData.didSelect){var yt=e.touchData.start,wi=e.touchData.last,ot;if(!e.hoverData.draggingEles&&!e.swipePanning&&(ot=e.findNearestElement(j[0],j[1],!0,!0)),Y&&yt!=null&&L.preventDefault(),Y&&yt!=null&&e.nodeIsDraggable(yt))if(Te){var Qe=e.dragData.touchDragEles,_a=!e.dragData.didDrag;_a&&g(Qe,{inDragLayer:!0}),e.dragData.didDrag=!0;var zn={x:0,y:0};if(ee(ve[0])&&ee(ve[1])&&(zn.x+=ve[0],zn.y+=ve[1],_a)){e.redrawHint("eles",!0);var mt=e.touchData.dragDelta;mt&&ee(mt[0])&&ee(mt[1])&&(zn.x+=mt[0],zn.y+=mt[1])}e.hoverData.draggingEles=!0,Qe.silentShift(zn).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==se[0]&&e.touchData.startPosition[1]==se[1]&&e.redrawHint("eles",!0),e.redraw()}else{var mt=e.touchData.dragDelta=e.touchData.dragDelta||[];mt.length===0?(mt.push(ve[0]),mt.push(ve[1])):(mt[0]+=ve[0],mt[1]+=ve[1])}if(r(yt||ot,["touchmove","tapdrag","vmousemove"],L,{x:j[0],y:j[1]}),(!yt||!yt.grabbed())&&ot!=wi&&(wi&&wi.emit({originalEvent:L,type:"tapdragout",position:{x:j[0],y:j[1]}}),ot&&ot.emit({originalEvent:L,type:"tapdragover",position:{x:j[0],y:j[1]}})),e.touchData.last=ot,Y)for(var st=0;st<j.length;st++)j[st]&&e.touchData.startPosition[st]&&Te&&(e.touchData.singleTouchMoved=!0);if(Y&&(yt==null||yt.pannable())&&X.panningEnabled()&&X.userPanningEnabled()){var zl=o(yt,e.touchData.starts);zl&&(L.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Ln(e.touchData.startPosition)),e.swipePanning?(X.panBy({x:ve[0]*W,y:ve[1]*W}),X.emit("dragpan")):Te&&(e.swipePanning=!0,X.panBy({x:ye*W,y:Xe*W}),X.emit("dragpan"),yt&&(yt.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var ie=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);j[0]=ie[0],j[1]=ie[1]}}for(var De=0;De<j.length;De++)se[De]=j[De];Y&&L.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var te;e.registerBinding(t,"touchcancel",te=function(L){var Y=e.touchData.start;e.touchData.capture=!1,Y&&Y.unactivate()});var pe,ue,J,oe;if(e.registerBinding(t,"touchend",pe=function(L){var Y=e.touchData.start,K=e.touchData.capture;if(K)L.touches.length===0&&(e.touchData.capture=!1),L.preventDefault();else return;var X=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var j=e.cy,se=j.zoom(),W=e.touchData.now,ie=e.touchData.earlier;if(L.touches[0]){var xe=e.projectIntoViewport(L.touches[0].clientX,L.touches[0].clientY);W[0]=xe[0],W[1]=xe[1]}if(L.touches[1]){var xe=e.projectIntoViewport(L.touches[1].clientX,L.touches[1].clientY);W[2]=xe[0],W[3]=xe[1]}if(L.touches[2]){var xe=e.projectIntoViewport(L.touches[2].clientX,L.touches[2].clientY);W[4]=xe[0],W[5]=xe[1]}Y&&Y.unactivate();var Te;if(e.touchData.cxt){if(Te={originalEvent:L,type:"cxttapend",position:{x:W[0],y:W[1]}},Y?Y.emit(Te):j.emit(Te),!e.touchData.cxtDragged){var ve={originalEvent:L,type:"cxttap",position:{x:W[0],y:W[1]}};Y?Y.emit(ve):j.emit(ve)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!L.touches[2]&&j.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var De=j.collection(e.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,e.redrawHint("select",!0),j.emit({type:"boxend",originalEvent:L,position:{x:W[0],y:W[1]}});var ye=function(Mt){return Mt.selectable()&&!Mt.selected()};De.emit("box").stdFilter(ye).select().emit("boxselect"),De.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(Y==null||Y.unactivate(),L.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!L.touches[1]&&!L.touches[0]&&!L.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ge=e.dragData.touchDragEles;if(Y!=null){var Xe=Y._private.grabbed;b(ge),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Xe&&(Y.emit("freeon"),ge.emit("free"),e.dragData.didDrag&&(Y.emit("dragfreeon"),ge.emit("dragfree"))),r(Y,["touchend","tapend","vmouseup","tapdragout"],L,{x:W[0],y:W[1]}),Y.unactivate(),e.touchData.start=null}else{var at=e.findNearestElement(W[0],W[1],!0,!0);r(at,["touchend","tapend","vmouseup","tapdragout"],L,{x:W[0],y:W[1]})}var ft=e.touchData.startPosition[0]-W[0],vt=ft*ft,je=e.touchData.startPosition[1]-W[1],dt=je*je,Ze=vt+dt,Zt=Ze*se*se;e.touchData.singleTouchMoved||(Y||j.$(":selected").unselect(["tapunselect"]),r(Y,["tap","vclick"],L,{x:W[0],y:W[1]}),ue=!1,L.timeStamp-oe<=j.multiClickDebounceTime()?(J&&clearTimeout(J),ue=!0,oe=null,r(Y,["dbltap","vdblclick"],L,{x:W[0],y:W[1]})):(J=setTimeout(function(){ue||r(Y,["onetap","voneclick"],L,{x:W[0],y:W[1]})},j.multiClickDebounceTime()),oe=L.timeStamp)),Y!=null&&!e.dragData.didDrag&&Y._private.selectable&&Zt<e.touchTapThreshold2&&!e.pinching&&(j.selectionType()==="single"?(j.$(n).unmerge(Y).unselect(["tapunselect"]),Y.select(["tapselect"])):Y.selected()?Y.unselect(["tapunselect"]):Y.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}for(var Ot=0;Ot<W.length;Ot++)ie[Ot]=W[Ot];e.dragData.didDrag=!1,L.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),L.touches.length<2&&(L.touches.length===1&&(e.touchData.startGPosition=[L.touches[0].clientX,L.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var ne=[],ce=function(L){return{clientX:L.clientX,clientY:L.clientY,force:1,identifier:L.pointerId,pageX:L.pageX,pageY:L.pageY,radiusX:L.width/2,radiusY:L.height/2,screenX:L.screenX,screenY:L.screenY,target:L.target}},he=function(L){return{event:L,touch:ce(L)}},fe=function(L){ne.push(he(L))},me=function(L){for(var Y=0;Y<ne.length;Y++){var K=ne[Y];if(K.event.pointerId===L.pointerId){ne.splice(Y,1);return}}},be=function(L){var Y=ne.filter(function(K){return K.event.pointerId===L.pointerId})[0];Y.event=L,Y.touch=ce(L)},we=function(L){L.touches=ne.map(function(Y){return Y.touch})},ae=function(L){return L.pointerType==="mouse"||L.pointerType===4};e.registerBinding(e.container,"pointerdown",function(L){ae(L)||(L.preventDefault(),fe(L),we(L),$(L))}),e.registerBinding(e.container,"pointerup",function(L){ae(L)||(me(L),we(L),pe(L))}),e.registerBinding(e.container,"pointercancel",function(L){ae(L)||(me(L),we(L),te(L))}),e.registerBinding(e.container,"pointermove",function(L){ae(L)||(L.preventDefault(),be(L),we(L),Z(L))})}};var Nt={};Nt.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(n,r,i,o,a){this.renderer.nodeShapeImpl("polygon",n,r,i,o,a,this.points)},intersectLine:function(n,r,i,o,a,s,l){return nr(a,s,this.points,n,r,i/2,o/2,l)},checkPoint:function(n,r,i,o,a,s,l){return Lt(n,r,this.points,s,l,o,a,[0,-1],i)}}},Nt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,o,a){return Kg(i,o,e,t,n/2+a,r/2+a)},checkPoint:function(e,t,n,r,i,o,a){return Jt(e,t,r,i,o,a,n)}}},Nt.generateRoundPolygon=function(e,t){for(var n=new Array(t.length*2),r=0;r<t.length/2;r++){var i=r*2,o=void 0;r<t.length/2-1?o=(r+1)*2:o=0,n[r*4]=t[i],n[r*4+1]=t[i+1];var a=t[o]-t[i],s=t[o+1]-t[i+1],l=Math.sqrt(a*a+s*s);n[r*4+2]=a/l,n[r*4+3]=s/l}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(u,c,h,p,d){this.renderer.nodeShapeImpl("round-polygon",u,c,h,p,d,this.points)},intersectLine:function(u,c,h,p,d,g,v){return Zg(d,g,this.points,u,c,h,p)},checkPoint:function(u,c,h,p,d,g,v){return $g(u,c,this.points,g,v,p,d)}}},Nt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:it(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,o,a){return Ha(i,o,e,t,n,r,a)},checkPoint:function(e,t,n,r,i,o,a){var s=ur(r,i),l=s*2;return!!(Lt(e,t,this.points,o,a,r,i-l,[0,-1],n)||Lt(e,t,this.points,o,a,r-l,i,[0,-1],n)||Jt(e,t,l,l,o-r/2+s,a-i/2+s,n)||Jt(e,t,l,l,o+r/2-s,a-i/2+s,n)||Jt(e,t,l,l,o+r/2-s,a+i/2-s,n)||Jt(e,t,l,l,o-r/2+s,a+i/2-s,n))}}},Nt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Ns(),points:it(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},generateCutTrianglePts:function(e,t,n,r){var i=this.cornerLength,o=t/2,a=e/2,s=n-a,l=n+a,u=r-o,c=r+o;return{topLeft:[s,u+i,s+i,u,s+i,u+i],topRight:[l-i,u,l,u+i,l-i,u+i],bottomRight:[l,c-i,l-i,c,l-i,c-i],bottomLeft:[s+i,c,s,c-i,s+i,c-i]}},intersectLine:function(e,t,n,r,i,o,a){var s=this.generateCutTrianglePts(n+2*a,r+2*a,e,t),l=[].concat.apply([],[s.topLeft.splice(0,4),s.topRight.splice(0,4),s.bottomRight.splice(0,4),s.bottomLeft.splice(0,4)]);return nr(i,o,l,e,t)},checkPoint:function(e,t,n,r,i,o,a){if(Lt(e,t,this.points,o,a,r,i-2*this.cornerLength,[0,-1],n)||Lt(e,t,this.points,o,a,r-2*this.cornerLength,i,[0,-1],n))return!0;var s=this.generateCutTrianglePts(r,i,o,a);return lt(e,t,s.topLeft)||lt(e,t,s.topRight)||lt(e,t,s.bottomRight)||lt(e,t,s.bottomLeft)}}},Nt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:it(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,o,a){var s=.15,l=.5,u=.85,c=this.generateBarrelBezierPts(n+2*a,r+2*a,e,t),h=function(d){var g=In({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},s),v=In({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},l),b=In({x:d[0],y:d[1]},{x:d[2],y:d[3]},{x:d[4],y:d[5]},u);return[d[0],d[1],g.x,g.y,v.x,v.y,b.x,b.y,d[4],d[5]]},p=[].concat(h(c.topLeft),h(c.topRight),h(c.bottomRight),h(c.bottomLeft));return nr(i,o,p,e,t)},generateBarrelBezierPts:function(e,t,n,r){var i=t/2,o=e/2,a=n-o,s=n+o,l=r-i,u=r+i,c=zi(e,t),h=c.heightOffset,p=c.widthOffset,d=c.ctrlPtOffsetPct*e,g={topLeft:[a,l+h,a+d,l,a+p,l],topRight:[s-p,l,s-d,l,s,l+h],bottomRight:[s,u-h,s-d,u,s-p,u],bottomLeft:[a+p,u,a+d,u,a,u-h]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,t,n,r,i,o,a){var s=zi(r,i),l=s.heightOffset,u=s.widthOffset;if(Lt(e,t,this.points,o,a,r,i-2*l,[0,-1],n)||Lt(e,t,this.points,o,a,r-2*u,i,[0,-1],n))return!0;for(var c=this.generateBarrelBezierPts(r,i,o,a),h=function(_,D,y){var E=y[4],w=y[2],C=y[0],A=y[5],k=y[1],S=Math.min(E,C),N=Math.max(E,C),P=Math.min(A,k),R=Math.max(A,k);if(S<=_&&_<=N&&P<=D&&D<=R){var I=Qg(E,w,C),O=jg(I[0],I[1],I[2],_),M=O.filter(function(G){return 0<=G&&G<=1});if(M.length>0)return M[0]}return null},p=Object.keys(c),d=0;d<p.length;d++){var g=p[d],v=c[g],b=h(e,t,v);if(b!=null){var f=v[5],m=v[3],x=v[1],T=Ue(f,m,x,b);if(v.isTop&&T<=t||v.isBottom&&t<=T)return!0}}return!1}}},Nt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:it(4,0),draw:function(e,t,n,r,i){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,o,a){var s=e-(n/2+a),l=t-(r/2+a),u=l,c=e+(n/2+a),h=Ht(i,o,e,t,s,l,c,u,!1);return h.length>0?h:Ha(i,o,e,t,n,r,a)},checkPoint:function(e,t,n,r,i,o,a){var s=ur(r,i),l=2*s;if(Lt(e,t,this.points,o,a,r,i-l,[0,-1],n)||Lt(e,t,this.points,o,a,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n,h=[o-u,a-c,o-u,a,o+u,a,o+u,a-c];return!!(lt(e,t,h)||Jt(e,t,l,l,o+r/2-s,a+i/2-s,n)||Jt(e,t,l,l,o-r/2+s,a+i/2-s,n))}}},Nt.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",it(3,0)),this.generateRoundPolygon("round-triangle",it(3,0)),this.generatePolygon("rectangle",it(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",it(5,0)),this.generateRoundPolygon("round-pentagon",it(5,0)),this.generatePolygon("hexagon",it(6,0)),this.generateRoundPolygon("round-hexagon",it(6,0)),this.generatePolygon("heptagon",it(7,0)),this.generateRoundPolygon("round-heptagon",it(7,0)),this.generatePolygon("octagon",it(8,0)),this.generateRoundPolygon("round-octagon",it(8,0));var r=new Array(20);{var i=Fi(5,0),o=Fi(5,Math.PI/5),a=.5*(3-Math.sqrt(5));a*=1.57;for(var s=0;s<o.length/2;s++)o[s*2]*=a,o[s*2+1]*=a;for(var s=0;s<20/4;s++)r[s*4]=i[s*2],r[s*4+1]=i[s*2+1],r[s*4+2]=o[s*2],r[s*4+3]=o[s*2+1]}r=Ls(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}e.makePolygon=function(u){var c=u.join("$"),h="polygon-"+c,p;return(p=this[h])?p:t.generatePolygon(h,u)}};var ir={};ir.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},ir.redraw=function(e){e=e||Ds();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},ir.beforeRender=function(e,t){if(!this.destroyed){t==null&&Be("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,i){return i.priority-r.priority})}};var Bo=function(e,t,n){for(var r=e.beforeRenderCallbacks,i=0;i<r.length;i++)r[i].fn(t,n)};ir.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function r(i){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){Bo(e,!0,i);var o=Pt();e.render(e.renderOptions);var a=e.lastDrawTime=Pt();e.averageRedrawTime===void 0&&(e.averageRedrawTime=a-o),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var s=a-o;e.redrawTotalTime+=s,e.lastRedrawTime=s,e.averageRedrawTime=e.averageRedrawTime/2+s/2,e.requestedFrame=!1}else Bo(e,!1,i);e.skipFrame=!1,Jr(r)}};Jr(n)}};var Dy=function(e){this.init(e)},gl=Dy,mn=gl.prototype;mn.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],mn.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,o=i.head,a="__________cytoscape_stylesheet",s="__________cytoscape_container",l=i.getElementById(a)!=null;if(n.className.indexOf(s)<0&&(n.className=(n.className||"")+" "+s),!l){var u=i.createElement("style");u.id=a,u.textContent="."+s+" { position: relative; }",o.insertBefore(u,o.children[0])}var c=r.getComputedStyle(n),h=c.getPropertyValue("position");h==="static"&&Le("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ee(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},mn.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},mn.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,i=r.target;(i.off||i.removeEventListener).apply(i,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},mn.isHeadless=function(){return!1},[$i,dl,pl,An,Nt,ir].forEach(function(e){de(mn,e)});var Pi=1e3/60,fl={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var r=pi.default(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),i=function(a,s){var l=Pt(),u=n.averageRedrawTime,c=n.lastRedrawTime,h=[],p=n.cy.extent(),d=n.getPixelRatio();for(a||n.flushRenderedStyleQueue();;){var g=Pt(),v=g-l,b=g-s;if(c<Pi){var f=Pi-(a?u:0);if(b>=e.deqFastCost*f)break}else if(a){if(v>=e.deqCost*c||v>=e.deqAvgCost*u)break}else if(b>=e.deqNoDrawCost*Pi)break;var m=e.deq(t,d,p);if(m.length>0)for(var x=0;x<m.length;x++)h.push(m[x]);else break}h.length>0&&(e.onDeqd(t,h),!a&&e.shouldRedraw(t,h,d,p)&&r())},o=e.priority||da;n.beforeRender(i,o(t))}}}},Cy=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ei;sa(this,e),this.idsByKey=new kt,this.keyForId=new kt,this.cachesByLvl=new kt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return la(e,[{key:"getIdsFor",value:function(t){t==null&&Be("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new Mn,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),i=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(i,n),this.keyForId.set(n,i)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),i=this.getKey(t);return r!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,i=n.get(t);return i||(i=new kt,n.set(t,i),r.push(t)),i}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),i=this.getCache(r,n);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),i=this.getCache(r,n);return i}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var i=this.getKey(t);this.setCache(i,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(r),i||this.getNumberOfIdsForKey(r)===0}}]),e}(),Fo=25,Or=50,Mr=-4,Oi=3,Ay=7.99,ky=8,Ly=1024,Ny=1024,Sy=1024,Iy=.2,Py=.8,Oy=10,My=.15,Ry=.1,By=.9,Fy=.9,zy=100,Gy=1,bn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Yy=Ke({getKey:null,doesEleInvalidateKey:ei,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Es,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),tr=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Yy(t);de(n,r),n.lookup=new Cy(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},Fe=tr.prototype;Fe.reasons=bn,Fe.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},Fe.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},Fe.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new vr.default(function(n,r){return r.reqs-n.reqs});return t},Fe.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},Fe.getElement=function(e,t,n,r,i){var o=this,a=this.renderer,s=a.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(pa(s*n))),r<Mr)r=Mr;else if(s>=Ay||r>Oi)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,p=a.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,p))return null;var d=l.get(e,r);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var g;if(c<=Fo?g=Fo:c<=Or?g=Or:g=Math.ceil(c/Or)*Or,c>Sy||h>Ny)return null;var v=o.getTextureQueue(g),b=v[v.length-2],f=function(){return o.recycleTexture(g,h)||o.addTexture(g,h)};b||(b=v[v.length-1]),b||(b=f()),b.width-b.usedWidth<h&&(b=f());for(var m=function(P){return P&&P.scaledLabelShown===p},x=i&&i===bn.dequeue,T=i&&i===bn.highQuality,_=i&&i===bn.downscale,D,y=r+1;y<=Oi;y++){var E=l.get(e,y);if(E){D=E;break}}var w=D&&D.level===r+1?D:null,C=function(){b.context.drawImage(w.texture.canvas,w.x,0,w.width,w.height,b.usedWidth,0,h,c)};if(b.context.setTransform(1,0,0,1,0,0),b.context.clearRect(b.usedWidth,0,h,g),m(w))C();else if(m(D))if(T){for(var A=D.level;A>r;A--)w=o.getElement(e,t,n,A,bn.downscale);C()}else return o.queueElement(e,D.level-1),D;else{var k;if(!x&&!T&&!_)for(var S=r-1;S>=Mr;S--){var N=l.get(e,S);if(N){k=N;break}}if(m(k))return o.queueElement(e,r),k;b.context.translate(b.usedWidth,0),b.context.scale(u,u),this.drawElement(b.context,e,t,p,!1),b.context.scale(1/u,1/u),b.context.translate(-b.usedWidth,0)}return d={x:b.usedWidth,texture:b,level:r,scale:u,width:h,height:c,scaledLabelShown:p},b.usedWidth+=Math.ceil(h+ky),b.eleCaches.push(d),l.set(e,r,d),o.checkTextureFullness(b),d},Fe.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},Fe.invalidateElement=function(e){var t=this,n=t.lookup,r=[],i=n.isInvalid(e);if(i){for(var o=Mr;o<=Oi;o++){var a=n.getForCachedKey(e,o);a&&r.push(a)}var s=n.invalidate(e);if(s)for(var l=0;l<r.length;l++){var u=r[l],c=u.texture;c.invalidatedWidth+=u.width,u.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},Fe.checkTextureUtility=function(e){e.invalidatedWidth>=Iy*e.width&&this.retireTexture(e)},Fe.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Py&&e.fullnessChecks>=Oy?jt(n,e):e.fullnessChecks++},Fe.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;jt(r,e),e.retired=!0;for(var o=e.eleCaches,a=0;a<o.length;a++){var s=o[a];i.deleteCache(s.key,s.level)}Bi(o);var l=t.getRetiredTextureQueue(n);l.push(e)},Fe.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(Ly,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i},Fe.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),o=0;o<i.length;o++){var a=i[o];if(a.width>=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,Bi(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),jt(i,a),r.push(a),a}},Fe.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),o=this.getKey(e),a=i[o];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,r.updateItem(a);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:o};r.push(s),i[o]=s}},Fe.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],o=t.lookup,a=0;a<Gy&&n.size()>0;a++){var s=n.pop(),l=s.key,u=s.eles[0],c=o.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,bn.dequeue)}}return i},Fe.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),o=r[i];o!=null&&(o.eles.length===1?(o.reqs=ha,n.updateItem(o),n.pop(),r[i]=null):o.eles.unmerge(e))},Fe.onDequeue=function(e){this.onDequeues.push(e)},Fe.offDequeue=function(e){jt(this.onDequeues,e)},Fe.setupDequeueing=fl.setupDequeueing({deqRedrawThreshold:zy,deqCost:My,deqAvgCost:Ry,deqNoDrawCost:By,deqFastCost:Fy,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++){var r=e.onDequeues[n];r(t)}},shouldRedraw:function(e,t,n,r){for(var i=0;i<t.length;i++)for(var o=t[i].eles,a=0;a<o.length;a++){var s=o[a].boundingBox();if(ga(s,r))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Vy=1,Wn=-4,Rr=2,Uy=3.99,Xy=50,jy=50,Hy=.15,Wy=.1,qy=.9,$y=.9,Ky=1,zo=250,Zy=4e3*4e3,Qy=!0,vl=function(e){var t=this,n=t.renderer=e,r=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Pt()-2*zo,t.skipping=!1,t.eleTxrDeqs=r.collection(),t.scheduleElementRefinement=pi.default(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},jy),n.beforeRender(function(o,a){a-t.lastInvalidationTime<=zo?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip);var i=function(o,a){return a.reqs-o.reqs};t.layersQueue=new vr.default(i),t.setupDequeueing()},He=vl.prototype,Go=0,Jy=Math.pow(2,53)-1;He.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),o=this.renderer.makeOffscreenCanvas(r,i),a={id:Go=++Go%Jy,bb:e,level:t,width:r,height:i,canvas:o,context:o.getContext("2d"),eles:[],elesQueue:[],reqs:0},s=a.context,l=-a.bb.x1,u=-a.bb.y1;return s.scale(n,n),s.translate(l,u),a},He.getLayers=function(e,t,n){var r=this,i=r.renderer,o=i.cy,a=o.zoom(),s=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(pa(a*t)),n<Wn)n=Wn;else if(a>=Uy||n>Rr)return null}r.validateLayersElesOrdering(n,e);var l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[],h,p=r.levelIsComplete(n,e),d,g=function(){var w=function(S){if(r.validateLayersElesOrdering(S,e),r.levelIsComplete(S,e))return d=l[S],!0},C=function(S){if(!d)for(var N=n+S;Wn<=N&&N<=Rr&&!w(N);N+=S);};C(1),C(-1);for(var A=c.length-1;A>=0;A--){var k=c[A];k.invalid&&jt(c,k)}};if(!p)g();else return c;var v=function(){if(!h){h=ut();for(var w=0;w<e.length;w++)As(h,e[w].boundingBox())}return h},b=function(w){w=w||{};var C=w.after;v();var A=h.w*u*(h.h*u);if(A>Zy)return null;var k=r.makeLayer(h,n);if(C!=null){var S=c.indexOf(C)+1;c.splice(S,0,k)}else(w.insert===void 0||w.insert)&&c.unshift(k);return k};if(r.skipping&&!s)return null;for(var f=null,m=e.length/Vy,x=!s,T=0;T<e.length;T++){var _=e[T],D=_._private.rscratch,y=D.imgLayerCaches=D.imgLayerCaches||{},E=y[n];if(E){f=E;continue}if((!f||f.eles.length>=m||!ks(f.bb,_.boundingBox()))&&(f=b({insert:!0,after:f}),!f))return null;d||x?r.queueLayer(f,_):r.drawEleInLayer(f,_,n,t),f.eles.push(_),y[n]=f}return d||(x?null:c)},He.getEleLevelForLayerLevel=function(e,t){return e},He.drawEleInLayer=function(e,t,n,r){var i=this,o=this.renderer,a=e.context,s=t.boundingBox();s.w===0||s.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),o.setImgSmoothing(a,!1),o.drawCachedElement(a,t,null,null,n,Qy),o.setImgSmoothing(a,!0))},He.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var i=0,o=0;o<r.length;o++){var a=r[o];if(a.reqs>0||a.invalid)return!1;i+=a.eles.length}return i===t.length},He.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],o=-1,a=0;a<t.length;a++)if(i.eles[0]===t[a]){o=a;break}if(o<0){this.invalidateLayer(i);continue}for(var s=o,a=0;a<i.eles.length;a++)if(i.eles[a]!==t[s+a]){this.invalidateLayer(i);break}}},He.updateElementsInLayers=function(e,t){for(var n=this,r=mr(e[0]),i=0;i<e.length;i++)for(var o=r?null:e[i],a=r?e[i]:e[i].ele,s=a._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=Wn;u<=Rr;u++){var c=l[u];c&&(o&&n.getEleLevelForLayerLevel(c.level)!==o.level||t(c,a,o))}},He.haveLayers=function(){for(var e=this,t=!1,n=Wn;n<=Rr;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},He.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Pt(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,i){t.invalidateLayer(n)}))},He.invalidateLayer=function(e){if(this.lastInvalidationTime=Pt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];jt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var o=n[i]._private.rscratch.imgLayerCaches;o&&(o[t]=null)}}},He.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(n,r,i){var o=n.replacement;if(o||(o=n.replacement=t.makeLayer(n.bb,n.level),o.replaces=n,o.eles=n.eles),!o.reqs)for(var a=0;a<o.eles.length;a++)t.queueLayer(o,o.eles[a])})},He.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},He.queueLayer=function(e,t){var n=this,r=n.layersQueue,i=e.elesQueue,o=i.hasId=i.hasId||{};if(!e.replacement){if(t){if(o[t.id()])return;i.push(t),o[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},He.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<Ky&&n.size()!==0;){var o=n.peek();if(o.replacement){n.pop();continue}if(o.replaces&&o!==o.replaces.replacement){n.pop();continue}if(o.invalid){n.pop();continue}var a=o.elesQueue.shift();a&&(t.drawEleInLayer(o,a,o.level,e),i++),r.length===0&&r.push(!0),o.elesQueue.length===0&&(n.pop(),o.reqs=0,o.replaces&&t.applyLayerReplacement(o),t.requestRedraw())}return r},He.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var o=0;o<e.eles.length;o++){var a=e.eles[o]._private,s=a.imgLayerCaches=a.imgLayerCaches||{};s&&(s[e.level]=e)}t.requestRedraw()}},He.requestRedraw=pi.default(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),He.setupDequeueing=fl.setupDequeueing({deqRedrawThreshold:Xy,deqCost:Hy,deqAvgCost:Wy,deqNoDrawCost:qy,deqFastCost:$y,deq:function(e,t){return e.dequeue(t)},onDeqd:da,shouldRedraw:Es,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var yl={},Yo;function e0(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function t0(e,t,n){for(var r,i=0;i<t.length;i++){var o=t[i];i===0&&(r=o),e.lineTo(o.x,o.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function Vo(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var o=r[i];e.lineTo(o.x,o.y)}var a=n,s=n[0];e.moveTo(s.x,s.y);for(var i=1;i<a.length;i++){var o=a[i];e.lineTo(o.x,o.y)}e.closePath&&e.closePath()}function n0(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var o=t,a=o[0];e.moveTo(a.x,a.y);for(var s=0;s<o.length;s++){var l=o[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function r0(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}yl.arrowShapeImpl=function(e){return(Yo||(Yo={polygon:e0,"triangle-backcurve":t0,"triangle-tee":Vo,"circle-triangle":n0,"triangle-cross":Vo,circle:r0}))[e]};var Ct={};Ct.drawElement=function(e,t,n,r,i,o){var a=this;t.isNode()?a.drawNode(e,t,n,r,i,o):a.drawEdge(e,t,n,r,i,o)},Ct.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},Ct.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},Ct.drawCachedElementPortion=function(e,t,n,r,i,o,a,s){var l=this,u=n.getBoundingBox(t);if(!(u.w===0||u.h===0)){var c=n.getElement(t,u,r,i,o);if(c!=null){var h=s(l,t);if(h===0)return;var p=a(l,t),d=u.x1,g=u.y1,v=u.w,b=u.h,f,m,x,T,_;if(p!==0){var D=n.getRotationPoint(t);x=D.x,T=D.y,e.translate(x,T),e.rotate(p),_=l.getImgSmoothing(e),_||l.setImgSmoothing(e,!0);var y=n.getRotationOffset(t);f=y.x,m=y.y}else f=d,m=g;var E;h!==1&&(E=e.globalAlpha,e.globalAlpha=E*h),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,f,m,v,b),h!==1&&(e.globalAlpha=E),p!==0&&(e.rotate(-p),e.translate(-x,-T),_||l.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var i0=function(){return 0},a0=function(e,t){return e.getTextAngle(t,null)},o0=function(e,t){return e.getTextAngle(t,"source")},s0=function(e,t){return e.getTextAngle(t,"target")},l0=function(e,t){return t.effectiveOpacity()},Mi=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};Ct.drawCachedElement=function(e,t,n,r,i,o){var a=this,s=a.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,h=s.tlbTxrCache,p=t.boundingBox(),d=o===!0?l.reasons.highQuality:null;if(!(p.w===0||p.h===0||!t.visible())&&(!r||ga(p,r))){var g=t.isEdge(),v=t.element()._private.rscratch.badLine;a.drawElementUnderlay(e,t),a.drawCachedElementPortion(e,t,l,n,i,d,i0,l0),(!g||!v)&&a.drawCachedElementPortion(e,t,u,n,i,d,a0,Mi),g&&!v&&(a.drawCachedElementPortion(e,t,c,n,i,d,o0,Mi),a.drawCachedElementPortion(e,t,h,n,i,d,s0,Mi)),a.drawElementOverlay(e,t)}},Ct.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},Ct.drawCachedElements=function(e,t,n,r){for(var i=this,o=0;o<t.length;o++){var a=t[o];i.drawCachedElement(e,a,n,r)}},Ct.drawCachedNodes=function(e,t,n,r){for(var i=this,o=0;o<t.length;o++){var a=t[o];a.isNode()&&i.drawCachedElement(e,a,n,r)}},Ct.drawLayeredElements=function(e,t,n,r){var i=this,o=i.data.lyrTxrCache.getLayers(t,n);if(o)for(var a=0;a<o.length;a++){var s=o[a],l=s.bb;l.w===0||l.h===0||e.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else i.drawCachedElements(e,t,n,r)};var St={};St.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,a=this,s=t._private.rscratch;if(!(o&&!t.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,p=t.pstyle("line-style").value,d=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,v=u*c,b=u*c,f=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:v;h==="straight-triangle"?(a.eleStrokeStyle(e,t,A),a.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=d,e.lineCap=g,a.eleStrokeStyle(e,t,A),a.drawEdgePath(t,e,s.allpts,p),e.lineCap="butt")},m=function(){i&&a.drawEdgeOverlay(e,t)},x=function(){i&&a.drawEdgeUnderlay(e,t)},T=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;a.drawArrowheads(e,t,A)},_=function(){a.drawElementText(e,t,null,r)};e.lineJoin="round";var D=t.pstyle("ghost").value==="yes";if(D){var y=t.pstyle("ghost-offset-x").pfValue,E=t.pstyle("ghost-offset-y").pfValue,w=t.pstyle("ghost-opacity").value,C=v*w;e.translate(y,E),f(C),T(C),e.translate(-y,-E)}x(),f(),T(),m(),_(),n&&e.translate(l.x1,l.y1)}};var Uo=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var i=this,o=i.usePaths(),a=n._private.rscratch,s=n.pstyle("".concat(e,"-padding")).pfValue,l=2*s,u=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,a.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,u[0],u[1],u[2],r),i.drawEdgePath(n,t,a.allpts,"solid")}}}};St.drawEdgeOverlay=Uo("overlay"),St.drawEdgeUnderlay=Uo("underlay"),St.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,o=t,a,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var h=n.join("$"),p=i.pathCacheKey&&i.pathCacheKey===h;p?(a=t=i.pathCache,s=!0):(a=t=new Path2D,i.pathCacheKey=h,i.pathCache=a)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=c;break;case"solid":o.setLineDash([]);break}if(!s&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3<n.length;d+=4)t.quadraticCurveTo(n[d],n[d+1],n[d+2],n[d+3]);break;case"straight":case"segments":case"haystack":for(var g=2;g+1<n.length;g+=2)t.lineTo(n[g],n[g+1]);break}t=o,l?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},St.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var o=[n[i+2]-n[i],n[i+3]-n[i+1]],a=Math.sqrt(o[0]*o[0]+o[1]*o[1]),s=[o[1]/a,-o[0]/a],l=[s[0]*r/2,s[1]*r/2];t.beginPath(),t.moveTo(n[i]-l[0],n[i+1]-l[1]),t.lineTo(n[i]+l[0],n[i+1]+l[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},St.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType==="haystack";i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},St.drawArrowhead=function(e,t,n,r,i,o,a){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(o)||o==null)){var s=this,l=t.pstyle(n+"-arrow-shape").value;if(l!=="none"){var u=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,h=t.pstyle("width").pfValue,p=t.pstyle(n+"-arrow-width"),d=p.value==="match-line"?h:p.pfValue;p.units==="%"&&(d*=h);var g=t.pstyle("opacity").value;a===void 0&&(a=g);var v=e.globalCompositeOperation;(a!==1||c==="hollow")&&(e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,1),s.colorStrokeStyle(e,255,255,255,1),s.drawArrowShape(t,e,u,h,l,d,r,i,o),e.globalCompositeOperation=v);var b=t.pstyle(n+"-arrow-color").value;s.colorFillStyle(e,b[0],b[1],b[2],a),s.colorStrokeStyle(e,b[0],b[1],b[2],a),s.drawArrowShape(t,e,c,h,l,d,r,i,o)}}},St.drawArrowShape=function(e,t,n,r,i,o,a,s,l){var u=this,c=this.usePaths()&&i!=="triangle-cross",h=!1,p,d=t,g={x:a,y:s},v=e.pstyle("arrow-scale").value,b=this.getArrowWidth(r,v),f=u.arrowShapes[i];if(c){var m=u.arrowPathCache=u.arrowPathCache||[],x=un(i),T=m[x];T!=null?(p=t=T,h=!0):(p=t=new Path2D,m[x]=p)}h||(t.beginPath&&t.beginPath(),c?f.draw(t,1,0,{x:0,y:0},1):f.draw(t,b,l,g,r),t.closePath&&t.closePath()),t=d,c&&(t.translate(a,s),t.rotate(l),t.scale(b,b)),(n==="filled"||n==="both")&&(c?t.fill(p):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=o/(c?b:1),t.lineJoin="miter",c?t.stroke(p):t.stroke()),c&&(t.scale(1/b,1/b),t.rotate(-l),t.translate(-a,-s))};var Zi={};Zi.safeDrawImage=function(e,t,n,r,i,o,a,s,l,u){if(!(i<=0||o<=0||l<=0||u<=0))try{e.drawImage(t,n,r,i,o,a,s,l,u)}catch(c){Le(c)}},Zi.drawInscribedImage=function(e,t,n,r,i){var o=this,a=n.position(),s=a.x,l=a.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),h=c(n,"background-fit","value",r),p=c(n,"background-repeat","value",r),d=n.width(),g=n.height(),v=n.padding()*2,b=d+(c(n,"background-width-relative-to","value",r)==="inner"?0:v),f=g+(c(n,"background-height-relative-to","value",r)==="inner"?0:v),m=n._private.rscratch,x=c(n,"background-clip","value",r),T=x==="node",_=c(n,"background-image-opacity","value",r)*i,D=c(n,"background-image-smoothing","value",r),y=t.width||t.cachedW,E=t.height||t.cachedH;(y==null||E==null)&&(document.body.appendChild(t),y=t.cachedW=t.width||t.offsetWidth,E=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var w=y,C=E;if(c(n,"background-width","value",r)!=="auto"&&(c(n,"background-width","units",r)==="%"?w=c(n,"background-width","pfValue",r)*b:w=c(n,"background-width","pfValue",r)),c(n,"background-height","value",r)!=="auto"&&(c(n,"background-height","units",r)==="%"?C=c(n,"background-height","pfValue",r)*f:C=c(n,"background-height","pfValue",r)),!(w===0||C===0)){if(h==="contain"){var A=Math.min(b/w,f/C);w*=A,C*=A}else if(h==="cover"){var A=Math.max(b/w,f/C);w*=A,C*=A}var k=s-b/2,S=c(n,"background-position-x","units",r),N=c(n,"background-position-x","pfValue",r);S==="%"?k+=(b-w)*N:k+=N;var P=c(n,"background-offset-x","units",r),R=c(n,"background-offset-x","pfValue",r);P==="%"?k+=(b-w)*R:k+=R;var I=l-f/2,O=c(n,"background-position-y","units",r),M=c(n,"background-position-y","pfValue",r);O==="%"?I+=(f-C)*M:I+=M;var G=c(n,"background-offset-y","units",r),B=c(n,"background-offset-y","pfValue",r);G==="%"?I+=(f-C)*B:I+=B,m.pathCache&&(k-=s,I-=l,s=0,l=0);var V=e.globalAlpha;e.globalAlpha=_;var F=o.getImgSmoothing(e),U=!1;if(D==="no"&&F?(o.setImgSmoothing(e,!1),U=!0):D==="yes"&&!F&&(o.setImgSmoothing(e,!0),U=!0),p==="no-repeat")T&&(e.save(),m.pathCache?e.clip(m.pathCache):(o.nodeShapes[o.getNodeShape(n)].draw(e,s,l,b,f),e.clip())),o.safeDrawImage(e,t,0,0,y,E,k,I,w,C),T&&e.restore();else{var Q=e.createPattern(t,p);e.fillStyle=Q,o.nodeShapes[o.getNodeShape(n)].draw(e,s,l,b,f),e.translate(k,I),e.fill(),e.translate(-k,-I)}e.globalAlpha=V,U&&o.setImgSmoothing(e,F)}};var ln={};ln.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(pa(n*r));t=Math.pow(2,i)}var o=e.pstyle("font-size").pfValue*t,a=e.pstyle("min-zoomed-font-size").pfValue;return!(o<a)},ln.drawElementText=function(e,t,n,r,i){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,a=this;if(r==null){if(o&&!a.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=a.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),p=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!p||!p.value))return;e.textAlign="center",e.textBaseline="bottom"}var d=!n,g;n&&(g=n,e.translate(-g.x1,-g.y1)),i==null?(a.drawText(e,t,null,d,o),t.isEdge()&&(a.drawText(e,t,"source",d,o),a.drawText(e,t,"target",d,o))):a.drawText(e,t,i,d,o),n&&e.translate(g.x1,g.y1)},ln.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},ln.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,a=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+a+" "+i+" "+o,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)};function Ri(e,t,n,r,i){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,a=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),a?e.stroke():e.fill()}ln.getTextAngle=function(e,t){var n,r=e._private,i=r.rscratch,o=t?t+"-":"",a=e.pstyle(o+"text-rotation"),s=wt(i,"labelAngle",t);return a.strValue==="autorotate"?n=e.isEdge()?s:0:a.strValue==="none"?n=0:n=a.pfValue,n},ln.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=t._private,a=o.rscratch,s=i?t.effectiveOpacity():1;if(!(i&&(s===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var l=wt(a,"labelX",n),u=wt(a,"labelY",n),c,h,p=this.getLabelText(t,n);if(p!=null&&p!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(e,t,i);var d=n?n+"-":"",g=wt(a,"labelWidth",n),v=wt(a,"labelHeight",n),b=t.pstyle(d+"text-margin-x").pfValue,f=t.pstyle(d+"text-margin-y").pfValue,m=t.isEdge(),x=t.pstyle("text-halign").value,T=t.pstyle("text-valign").value;m&&(x="center",T="center"),l+=b,u+=f;var _;switch(r?_=this.getTextAngle(t,n):_=0,_!==0&&(c=l,h=u,e.translate(c,h),e.rotate(_),l=0,u=0),T){case"top":break;case"center":u+=v/2;break;case"bottom":u+=v;break}var D=t.pstyle("text-background-opacity").value,y=t.pstyle("text-border-opacity").value,E=t.pstyle("text-border-width").pfValue,w=t.pstyle("text-background-padding").pfValue,C=t.pstyle("text-background-shape").strValue,A=C.indexOf("round")===0,k=2;if(D>0||E>0&&y>0){var S=l-w;switch(x){case"left":S-=g;break;case"center":S-=g/2;break}var N=u-v-w,P=g+2*w,R=v+2*w;if(D>0){var I=e.fillStyle,O=t.pstyle("text-background-color").value;e.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+D*s+")",A?Ri(e,S,N,P,R,k):e.fillRect(S,N,P,R),e.fillStyle=I}if(E>0&&y>0){var M=e.strokeStyle,G=e.lineWidth,B=t.pstyle("text-border-color").value,V=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+y*s+")",e.lineWidth=E,e.setLineDash)switch(V){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=E/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(A?Ri(e,S,N,P,R,k,"stroke"):e.strokeRect(S,N,P,R),V==="double"){var F=E/2;A?Ri(e,S+F,N+F,P-F*2,R-F*2,k,"stroke"):e.strokeRect(S+F,N+F,P-F*2,R-F*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=G,e.strokeStyle=M}}var U=2*t.pstyle("text-outline-width").pfValue;if(U>0&&(e.lineWidth=U),t.pstyle("text-wrap").value==="wrap"){var Q=wt(a,"labelWrapCachedLines",n),z=wt(a,"labelLineHeight",n),q=g/2,H=this.getLabelJustification(t);switch(H==="auto"||(x==="left"?H==="left"?l+=-g:H==="center"&&(l+=-q):x==="center"?H==="left"?l+=-q:H==="right"&&(l+=q):x==="right"&&(H==="center"?l+=q:H==="right"&&(l+=g))),T){case"top":u-=(Q.length-1)*z;break;case"center":case"bottom":u-=(Q.length-1)*z;break}for(var $=0;$<Q.length;$++)U>0&&e.strokeText(Q[$],l,u),e.fillText(Q[$],l,u),u+=z}else U>0&&e.strokeText(p,l,u),e.fillText(p,l,u);_!==0&&(e.rotate(-_),e.translate(-c,-h))}}};var Sn={};Sn.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,a=this,s,l,u=t._private,c=u.rscratch,h=t.position();if(!(!ee(h.x)||!ee(h.y))&&!(o&&!t.visible())){var p=o?t.effectiveOpacity():1,d=a.usePaths(),g,v=!1,b=t.padding();s=t.width()+2*b,l=t.height()+2*b;var f;n&&(f=n,e.translate(-f.x1,-f.y1));for(var m=t.pstyle("background-image"),x=m.value,T=new Array(x.length),_=new Array(x.length),D=0,y=0;y<x.length;y++){var E=x[y],w=T[y]=E!=null&&E!=="none";if(w){var C=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",y);D++,_[y]=a.getCachedImage(E,C,function(){u.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var A=t.pstyle("background-blacken").value,k=t.pstyle("border-width").pfValue,S=t.pstyle("background-opacity").value*p,N=t.pstyle("border-color").value,P=t.pstyle("border-style").value,R=t.pstyle("border-opacity").value*p,I=t.pstyle("outline-width").pfValue,O=t.pstyle("outline-color").value,M=t.pstyle("outline-style").value,G=t.pstyle("outline-opacity").value*p,B=t.pstyle("outline-offset").value;e.lineJoin="miter";var V=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:S;a.eleFillStyle(e,t,ae)},F=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R;a.colorStrokeStyle(e,N[0],N[1],N[2],ae)},U=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;a.colorStrokeStyle(e,O[0],O[1],O[2],ae)},Q=function(ae,L,Y,K){var X=a.nodePathCache=a.nodePathCache||[],j=ws(Y==="polygon"?Y+","+K.join(","):Y,""+L,""+ae),se=X[j],W,ie=!1;return se!=null?(W=se,ie=!0,c.pathCache=W):(W=new Path2D,X[j]=c.pathCache=W),{path:W,cacheHit:ie}},z=t.pstyle("shape").strValue,q=t.pstyle("shape-polygon-points").pfValue;if(d){e.translate(h.x,h.y);var H=Q(s,l,z,q);g=H.path,v=H.cacheHit}var $=function(){if(!v){var ae=h;d&&(ae={x:0,y:0}),a.nodeShapes[a.getNodeShape(t)].draw(g||e,ae.x,ae.y,s,l)}d?e.fill(g):e.fill()},Z=function(){for(var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,Y=u.backgrounding,K=0,X=0;X<_.length;X++){var j=t.cy().style().getIndexedStyle(t,"background-image-containment","value",X);if(L&&j==="over"||!L&&j==="inside"){K++;continue}T[X]&&_[X].complete&&!_[X].error&&(K++,a.drawInscribedImage(e,_[X],t,X,ae))}u.backgrounding=K!==D,Y!==u.backgrounding&&t.updateStyle(!1)},te=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,L=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p;a.hasPie(t)&&(a.drawPie(e,t,L),ae&&(d||a.nodeShapes[a.getNodeShape(t)].draw(e,h.x,h.y,s,l)))},pe=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p,L=(A>0?A:-A)*ae,Y=A>0?0:255;A!==0&&(a.colorFillStyle(e,Y,Y,Y,L),d?e.fill(g):e.fill())},ue=function(){if(k>0){if(e.lineWidth=k,e.lineCap="butt",e.setLineDash)switch(P){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}if(d?e.stroke(g):e.stroke(),P==="double"){e.lineWidth=k/3;var ae=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",d?e.stroke(g):e.stroke(),e.globalCompositeOperation=ae}e.setLineDash&&e.setLineDash([])}},J=function(){if(I>0){if(e.lineWidth=I,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ae=h;d&&(ae={x:0,y:0});var L=a.getNodeShape(t),Y=(s+k+(I+B))/s,K=(l+k+(I+B))/l,X=s*Y,j=l*K,se=a.nodeShapes[L].points,W;if(d){var ie=Q(X,j,L,se);W=ie.path}if(L==="ellipse")a.drawEllipsePath(W||e,ae.x,ae.y,X,j);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(L)){var xe=0,Te=0,ve=0;L==="round-diamond"?xe=(k+B+I)*1.4:L==="round-heptagon"?(xe=(k+B+I)*1.075,ve=-(k/2+B+I)/35):L==="round-hexagon"?xe=(k+B+I)*1.12:L==="round-pentagon"?(xe=(k+B+I)*1.13,ve=-(k/2+B+I)/15):L==="round-tag"?(xe=(k+B+I)*1.12,Te=(k/2+I+B)*.07):L==="round-triangle"&&(xe=(k+B+I)*(Math.PI/2),ve=-(k+B/2+I)/Math.PI),xe!==0&&(Y=(s+xe)/s,K=(l+xe)/l),a.drawRoundPolygonPath(W||e,ae.x+Te,ae.y+ve,s*Y,l*K,se)}else if(["roundrectangle","round-rectangle"].includes(L))a.drawRoundRectanglePath(W||e,ae.x,ae.y,X,j);else if(["cutrectangle","cut-rectangle"].includes(L))a.drawCutRectanglePath(W||e,ae.x,ae.y,X,j);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(L))a.drawBottomRoundRectanglePath(W||e,ae.x,ae.y,X,j);else if(L==="barrel")a.drawBarrelPath(W||e,ae.x,ae.y,X,j);else if(L.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(L)){var De=(k+I+B)/s;se=ti(ni(se,De)),a.drawPolygonPath(W||e,ae.x,ae.y,s,l,se)}else{var ye=(k+I+B)/s;se=ti(ni(se,-ye)),a.drawPolygonPath(W||e,ae.x,ae.y,s,l,se)}if(d?e.stroke(W):e.stroke(),M==="double"){e.lineWidth=k/3;var ge=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",d?e.stroke(W):e.stroke(),e.globalCompositeOperation=ge}e.setLineDash&&e.setLineDash([])}},oe=function(){i&&a.drawNodeOverlay(e,t,h,s,l)},ne=function(){i&&a.drawNodeUnderlay(e,t,h,s,l)},ce=function(){a.drawElementText(e,t,null,r)},he=t.pstyle("ghost").value==="yes";if(he){var fe=t.pstyle("ghost-offset-x").pfValue,me=t.pstyle("ghost-offset-y").pfValue,be=t.pstyle("ghost-opacity").value,we=be*p;e.translate(fe,me),U(),J(),V(be*S),$(),Z(we,!0),F(be*R),ue(),te(A!==0||k!==0),Z(we,!1),pe(we),e.translate(-fe,-me)}d&&e.translate(-h.x,-h.y),ne(),d&&e.translate(h.x,h.y),U(),J(),V(),$(),Z(p,!0),F(),ue(),te(A!==0||k!==0),Z(p,!1),pe(),d&&e.translate(-h.x,-h.y),ce(),oe(),n&&e.translate(f.x1,f.y1)}};var Xo=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n,r,i,o){var a=this;if(n.visible()){var s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value;if(l>0){if(r=r||n.position(),i==null||o==null){var h=n.padding();i=n.width()+2*h,o=n.height()+2*h}a.colorFillStyle(t,u[0],u[1],u[2],l),a.nodeShapes[c].draw(t,r.x,r.y,i+s*2,o+s*2),t.fill()}}}};Sn.drawNodeOverlay=Xo("overlay"),Sn.drawNodeUnderlay=Xo("underlay"),Sn.hasPie=function(e){return e=e[0],e._private.hasPie},Sn.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),o=t.pstyle("pie-size"),a=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0,p=this.usePaths();p&&(a=0,s=0),o.units==="%"?c=c*o.pfValue:o.pfValue!==void 0&&(c=o.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var g=t.pstyle("pie-"+d+"-background-size").value,v=t.pstyle("pie-"+d+"-background-color").value,b=t.pstyle("pie-"+d+"-background-opacity").value*n,f=g/100;f+h>1&&(f=1-h);var m=1.5*Math.PI+2*Math.PI*h,x=2*Math.PI*f,T=m+x;g===0||h>=1||h+f>1||(e.beginPath(),e.moveTo(a,s),e.arc(a,s,c,m,T),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],b),e.fill(),h+=f)}};var ct={},u0=100;ct.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},ct.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},ct.createGradientStyleFor=function(e,t,n,r,i){var o,a=this.usePaths(),s=n.pstyle(t+"-gradient-stop-colors").value,l=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var u=n.sourceEndpoint(),c=n.targetEndpoint(),h=n.midpoint(),p=cn(u,h),d=cn(c,h);o=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(p,d))}else{var g=a?{x:0,y:0}:n.position(),v=n.paddedWidth(),b=n.paddedHeight();o=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(v,b))}else if(n.isEdge()){var f=n.sourceEndpoint(),m=n.targetEndpoint();o=e.createLinearGradient(f.x,f.y,m.x,m.y)}else{var x=a?{x:0,y:0}:n.position(),T=n.paddedWidth(),_=n.paddedHeight(),D=T/2,y=_/2,E=n.pstyle("background-gradient-direction").value;switch(E){case"to-bottom":o=e.createLinearGradient(x.x,x.y-y,x.x,x.y+y);break;case"to-top":o=e.createLinearGradient(x.x,x.y+y,x.x,x.y-y);break;case"to-left":o=e.createLinearGradient(x.x+D,x.y,x.x-D,x.y);break;case"to-right":o=e.createLinearGradient(x.x-D,x.y,x.x+D,x.y);break;case"to-bottom-right":case"to-right-bottom":o=e.createLinearGradient(x.x-D,x.y-y,x.x+D,x.y+y);break;case"to-top-right":case"to-right-top":o=e.createLinearGradient(x.x-D,x.y+y,x.x+D,x.y-y);break;case"to-bottom-left":case"to-left-bottom":o=e.createLinearGradient(x.x+D,x.y-y,x.x-D,x.y+y);break;case"to-top-left":case"to-left-top":o=e.createLinearGradient(x.x+D,x.y+y,x.x-D,x.y-y);break}}if(!o)return null;for(var w=l.length===s.length,C=s.length,A=0;A<C;A++)o.addColorStop(w?l[A]:A/(C-1),"rgba("+s[A][0]+","+s[A][1]+","+s[A][2]+","+i+")");return o},ct.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},ct.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},ct.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},ct.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},ct.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},ct.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},ct.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],o=r[3],a=t.getPixelRatio(),s=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(a=s);var l=i*a,u=o*a,c;if(!(l===t.canvasWidth&&u===t.canvasHeight)){t.fontCaches=null;var h=n.canvasContainer;h.style.width=i+"px",h.style.height=o+"px";for(var p=0;p<t.CANVAS_LAYERS;p++)c=n.canvases[p],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=o+"px";for(var p=0;p<t.BUFFER_COUNT;p++)c=n.bufferCanvases[p],c.width=l,c.height=u,c.style.width=i+"px",c.style.height=o+"px";t.textureMult=1,a<=1&&(c=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,c.width=l*t.textureMult,c.height=u*t.textureMult),t.canvasWidth=l,t.canvasHeight=u}},ct.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},ct.render=function(e){e=e||Ds();var t=e.forcedContext,n=e.drawAllLayers,r=e.drawOnlyNodeLayer,i=e.forcedZoom,o=e.forcedPan,a=this,s=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=a.cy,u=a.data,c=u.canvasNeedsRedraw,h=a.textureOnViewport&&!t&&(a.pinching||a.hoverData.dragging||a.swipePanning||a.data.wheelZooming),p=e.motionBlur!==void 0?e.motionBlur:a.motionBlur,d=a.motionBlurPxRatio,g=l.hasCompoundNodes(),v=a.hoverData.draggingEles,b=!!(a.hoverData.selecting||a.touchData.selecting);p=p&&!t&&a.motionBlurEnabled&&!b;var f=p;t||(a.prevPxRatio!==s&&(a.invalidateContainerClientCoordsCache(),a.matchCanvasSize(a.container),a.redrawHint("eles",!0),a.redrawHint("drag",!0)),a.prevPxRatio=s),!t&&a.motionBlurTimeout&&clearTimeout(a.motionBlurTimeout),p&&(a.mbFrames==null&&(a.mbFrames=0),a.mbFrames++,a.mbFrames<3&&(f=!1),a.mbFrames>a.minMbLowQualFrames&&(a.motionBlurPxRatio=a.mbPxRBlurry)),a.clearingMotionBlur&&(a.motionBlurPxRatio=1),a.textureDrawLastFrame&&!h&&(c[a.NODE]=!0,c[a.SELECT_BOX]=!0);var m=l.style(),x=l.zoom(),T=i!==void 0?i:x,_=l.pan(),D={x:_.x,y:_.y},y={zoom:x,pan:{x:_.x,y:_.y}},E=a.prevViewport,w=E===void 0||y.zoom!==E.zoom||y.pan.x!==E.pan.x||y.pan.y!==E.pan.y;!w&&!(v&&!g)&&(a.motionBlurPxRatio=1),o&&(D=o),T*=s,D.x*=s,D.y*=s;var C=a.getCachedZSortedEles();function A(J,oe,ne,ce,he){var fe=J.globalCompositeOperation;J.globalCompositeOperation="destination-out",a.colorFillStyle(J,255,255,255,a.motionBlurTransparency),J.fillRect(oe,ne,ce,he),J.globalCompositeOperation=fe}function k(J,oe){var ne,ce,he,fe;!a.clearingMotionBlur&&(J===u.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]||J===u.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG])?(ne={x:_.x*d,y:_.y*d},ce=x*d,he=a.canvasWidth*d,fe=a.canvasHeight*d):(ne=D,ce=T,he=a.canvasWidth,fe=a.canvasHeight),J.setTransform(1,0,0,1,0,0),oe==="motionBlur"?A(J,0,0,he,fe):!t&&(oe===void 0||oe)&&J.clearRect(0,0,he,fe),n||(J.translate(ne.x,ne.y),J.scale(ce,ce)),o&&J.translate(o.x,o.y),i&&J.scale(i,i)}if(h||(a.textureDrawLastFrame=!1),h){if(a.textureDrawLastFrame=!0,!a.textureCache){a.textureCache={},a.textureCache.bb=l.mutableElements().boundingBox(),a.textureCache.texture=a.data.bufferCanvases[a.TEXTURE_BUFFER];var S=a.data.bufferContexts[a.TEXTURE_BUFFER];S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,a.canvasWidth*a.textureMult,a.canvasHeight*a.textureMult),a.render({forcedContext:S,drawOnlyNodeLayer:!0,forcedPxRatio:s*a.textureMult});var y=a.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:a.canvasWidth,height:a.canvasHeight};y.mpan={x:(0-y.pan.x)/y.zoom,y:(0-y.pan.y)/y.zoom}}c[a.DRAG]=!1,c[a.NODE]=!1;var N=u.contexts[a.NODE],P=a.textureCache.texture,y=a.textureCache.viewport;N.setTransform(1,0,0,1,0,0),p?A(N,0,0,y.width,y.height):N.clearRect(0,0,y.width,y.height);var R=m.core("outside-texture-bg-color").value,I=m.core("outside-texture-bg-opacity").value;a.colorFillStyle(N,R[0],R[1],R[2],I),N.fillRect(0,0,y.width,y.height);var x=l.zoom();k(N,!1),N.clearRect(y.mpan.x,y.mpan.y,y.width/y.zoom/s,y.height/y.zoom/s),N.drawImage(P,y.mpan.x,y.mpan.y,y.width/y.zoom/s,y.height/y.zoom/s)}else a.textureOnViewport&&!t&&(a.textureCache=null);var O=l.extent(),M=a.pinching||a.hoverData.dragging||a.swipePanning||a.data.wheelZooming||a.hoverData.draggingEles||a.cy.animated(),G=a.hideEdgesOnViewport&&M,B=[];if(B[a.NODE]=!c[a.NODE]&&p&&!a.clearedForMotionBlur[a.NODE]||a.clearingMotionBlur,B[a.NODE]&&(a.clearedForMotionBlur[a.NODE]=!0),B[a.DRAG]=!c[a.DRAG]&&p&&!a.clearedForMotionBlur[a.DRAG]||a.clearingMotionBlur,B[a.DRAG]&&(a.clearedForMotionBlur[a.DRAG]=!0),c[a.NODE]||n||r||B[a.NODE]){var V=p&&!B[a.NODE]&&d!==1,N=t||(V?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_NODE]:u.contexts[a.NODE]),F=p&&!V?"motionBlur":void 0;k(N,F),G?a.drawCachedNodes(N,C.nondrag,s,O):a.drawLayeredElements(N,C.nondrag,s,O),a.debug&&a.drawDebugPoints(N,C.nondrag),!n&&!p&&(c[a.NODE]=!1)}if(!r&&(c[a.DRAG]||n||B[a.DRAG])){var V=p&&!B[a.DRAG]&&d!==1,N=t||(V?a.data.bufferContexts[a.MOTIONBLUR_BUFFER_DRAG]:u.contexts[a.DRAG]);k(N,p&&!V?"motionBlur":void 0),G?a.drawCachedNodes(N,C.drag,s,O):a.drawCachedElements(N,C.drag,s,O),a.debug&&a.drawDebugPoints(N,C.drag),!n&&!p&&(c[a.DRAG]=!1)}if(a.showFps||!r&&c[a.SELECT_BOX]&&!n){var N=t||u.contexts[a.SELECT_BOX];if(k(N),a.selection[4]==1&&(a.hoverData.selecting||a.touchData.selecting)){var x=a.cy.zoom(),U=m.core("selection-box-border-width").value/x;N.lineWidth=U,N.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",N.fillRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]),U>0&&(N.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",N.strokeRect(a.selection[0],a.selection[1],a.selection[2]-a.selection[0],a.selection[3]-a.selection[1]))}if(u.bgActivePosistion&&!a.hoverData.selecting){var x=a.cy.zoom(),Q=u.bgActivePosistion;N.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",N.beginPath(),N.arc(Q.x,Q.y,m.core("active-bg-size").pfValue/x,0,2*Math.PI),N.fill()}var z=a.lastRedrawTime;if(a.showFps&&z){z=Math.round(z);var q=Math.round(1e3/z);N.setTransform(1,0,0,1,0,0),N.fillStyle="rgba(255, 0, 0, 0.75)",N.strokeStyle="rgba(255, 0, 0, 0.75)",N.lineWidth=1,N.fillText("1 frame = "+z+" ms = "+q+" fps",0,20);var H=60;N.strokeRect(0,30,250,20),N.fillRect(0,30,250*Math.min(q/H,1),20)}n||(c[a.SELECT_BOX]=!1)}if(p&&d!==1){var $=u.contexts[a.NODE],Z=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_NODE],te=u.contexts[a.DRAG],pe=a.data.bufferCanvases[a.MOTIONBLUR_BUFFER_DRAG],ue=function(J,oe,ne){J.setTransform(1,0,0,1,0,0),ne||!f?J.clearRect(0,0,a.canvasWidth,a.canvasHeight):A(J,0,0,a.canvasWidth,a.canvasHeight);var ce=d;J.drawImage(oe,0,0,a.canvasWidth*ce,a.canvasHeight*ce,0,0,a.canvasWidth,a.canvasHeight)};(c[a.NODE]||B[a.NODE])&&(ue($,Z,B[a.NODE]),c[a.NODE]=!1),(c[a.DRAG]||B[a.DRAG])&&(ue(te,pe,B[a.DRAG]),c[a.DRAG]=!1)}a.prevViewport=y,a.clearingMotionBlur&&(a.clearingMotionBlur=!1,a.motionBlurCleared=!0,a.motionBlur=!0),p&&(a.motionBlurTimeout=setTimeout(function(){a.motionBlurTimeout=null,a.clearedForMotionBlur[a.NODE]=!1,a.clearedForMotionBlur[a.DRAG]=!1,a.motionBlur=!1,a.clearingMotionBlur=!h,a.mbFrames=0,c[a.NODE]=!0,c[a.DRAG]=!0,a.redraw()},u0)),t||l.emit("render")};var Ut={};Ut.drawPolygonPath=function(e,t,n,r,i,o){var a=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+a*o[0],n+s*o[1]);for(var l=1;l<o.length/2;l++)e.lineTo(t+a*o[l*2],n+s*o[l*2+1]);e.closePath()},Ut.drawRoundPolygonPath=function(e,t,n,r,i,o){var a=r/2,s=i/2,l=fa(r,i);e.beginPath&&e.beginPath();for(var u=0;u<o.length/4;u++){var c=void 0,h=void 0;u===0?c=o.length-2:c=u*4-2,h=u*4+2;var p=t+a*o[u*4],d=n+s*o[u*4+1],g=-o[c]*o[h]-o[c+1]*o[h+1],v=l/Math.tan(Math.acos(g)/2),b=p-v*o[c],f=d-v*o[c+1],m=p+v*o[h],x=d+v*o[h+1];u===0?e.moveTo(b,f):e.lineTo(b,f),e.arcTo(p,d,m,x,l)}e.closePath()},Ut.drawRoundRectanglePath=function(e,t,n,r,i){var o=r/2,a=i/2,s=ur(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-a),e.arcTo(t+o,n-a,t+o,n,s),e.arcTo(t+o,n+a,t,n+a,s),e.arcTo(t-o,n+a,t-o,n,s),e.arcTo(t-o,n-a,t,n-a,s),e.lineTo(t,n-a),e.closePath()},Ut.drawBottomRoundRectanglePath=function(e,t,n,r,i){var o=r/2,a=i/2,s=ur(r,i);e.beginPath&&e.beginPath(),e.moveTo(t,n-a),e.lineTo(t+o,n-a),e.lineTo(t+o,n),e.arcTo(t+o,n+a,t,n+a,s),e.arcTo(t-o,n+a,t-o,n,s),e.lineTo(t-o,n-a),e.lineTo(t,n-a),e.closePath()},Ut.drawCutRectanglePath=function(e,t,n,r,i){var o=r/2,a=i/2,s=Ns();e.beginPath&&e.beginPath(),e.moveTo(t-o+s,n-a),e.lineTo(t+o-s,n-a),e.lineTo(t+o,n-a+s),e.lineTo(t+o,n+a-s),e.lineTo(t+o-s,n+a),e.lineTo(t-o+s,n+a),e.lineTo(t-o,n+a-s),e.lineTo(t-o,n-a+s),e.closePath()},Ut.drawBarrelPath=function(e,t,n,r,i){var o=r/2,a=i/2,s=t-o,l=t+o,u=n-a,c=n+a,h=zi(r,i),p=h.widthOffset,d=h.heightOffset,g=h.ctrlPtOffsetPct*p;e.beginPath&&e.beginPath(),e.moveTo(s,u+d),e.lineTo(s,c-d),e.quadraticCurveTo(s+g,c,s+p,c),e.lineTo(l-p,c),e.quadraticCurveTo(l-g,c,l,c-d),e.lineTo(l,u+d),e.quadraticCurveTo(l-g,u,l-p,u),e.lineTo(s+p,u),e.quadraticCurveTo(s+g,u,s,u+d),e.closePath()};for(var jo=Math.sin(0),Ho=Math.cos(0),Qi={},Ji={},ml=Math.PI/40,xn=0*Math.PI;xn<2*Math.PI;xn+=ml)Qi[xn]=Math.sin(xn),Ji[xn]=Math.cos(xn);Ut.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var o,a,s=r/2,l=i/2,u=0*Math.PI;u<2*Math.PI;u+=ml)o=t-s*Qi[u]*jo+s*Ji[u]*Ho,a=n+l*Ji[u]*jo+l*Qi[u]*Ho,u===0?e.moveTo(o,a):e.lineTo(o,a);e.closePath()};var dr={};dr.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},dr.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),i=this.findContainerClientCoords(),o=e.full?Math.ceil(r.w):i[2],a=e.full?Math.ceil(r.h):i[3],s=ee(e.maxWidth)||ee(e.maxHeight),l=this.getPixelRatio(),u=1;if(e.scale!==void 0)o*=e.scale,a*=e.scale,u=e.scale;else if(s){var c=1/0,h=1/0;ee(e.maxWidth)&&(c=u*e.maxWidth/o),ee(e.maxHeight)&&(h=u*e.maxHeight/a),u=Math.min(c,h),o*=u,a*=u}s||(o*=l,a*=l,u*=l);var p=document.createElement("canvas");p.width=o,p.height=a,p.style.width=o+"px",p.style.height=a+"px";var d=p.getContext("2d");if(o>0&&a>0){d.clearRect(0,0,o,a),d.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)d.translate(-r.x1*u,-r.y1*u),d.scale(u,u),this.drawElements(d,g),d.scale(1/u,1/u),d.translate(r.x1*u,r.y1*u);else{var v=t.pan(),b={x:v.x*u,y:v.y*u};u*=t.zoom(),d.translate(b.x,b.y),d.scale(u,u),this.drawElements(d,g),d.scale(1/u,1/u),d.translate(-b.x,-b.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,o,a),d.fill())}return p};function c0(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),o=0;o<n.length;o++)i[o]=n.charCodeAt(o);return new Blob([r],{type:t})}function Wo(e){var t=e.indexOf(",");return e.substr(t+1)}function qo(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new Rn(function(i,o){try{t.toBlob(function(a){a!=null?i(a):o(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(a){o(a)}});case"blob":return c0(Wo(r()),n);case"base64":return Wo(r());case"base64uri":default:return r()}}dr.png=function(e){return qo(e,this.bufferCanvasImage(e),"image/png")},dr.jpg=function(e){return qo(e,this.bufferCanvasImage(e),"image/jpeg")};var bl={};bl.nodeShapeImpl=function(e,t,n,r,i,o,a){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,o);case"polygon":return this.drawPolygonPath(t,n,r,i,o,a);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,o,a);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,o);case"barrel":return this.drawBarrelPath(t,n,r,i,o)}};var h0=xl,Ae=xl.prototype;Ae.CANVAS_LAYERS=3,Ae.SELECT_BOX=0,Ae.DRAG=1,Ae.NODE=2,Ae.BUFFER_COUNT=3,Ae.TEXTURE_BUFFER=0,Ae.MOTIONBLUR_BUFFER_NODE=1,Ae.MOTIONBLUR_BUFFER_DRAG=2;function xl(e){var t=this;t.data={canvases:new Array(Ae.CANVAS_LAYERS),contexts:new Array(Ae.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Ae.CANVAS_LAYERS),bufferCanvases:new Array(Ae.BUFFER_COUNT),bufferContexts:new Array(Ae.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=r;var a={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};jp()&&(a["-ms-touch-action"]="none",a["touch-action"]="none");for(var s=0;s<Ae.CANVAS_LAYERS;s++){var l=t.data.canvases[s]=document.createElement("canvas");t.data.contexts[s]=l.getContext("2d"),Object.keys(a).forEach(function(z){l.style[z]=a[z]}),l.style.position="absolute",l.setAttribute("data-id","layer"+s),l.style.zIndex=String(Ae.CANVAS_LAYERS-s),t.data.canvasContainer.appendChild(l),t.data.canvasNeedsRedraw[s]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Ae.NODE].setAttribute("data-id","layer"+Ae.NODE+"-node"),t.data.canvases[Ae.SELECT_BOX].setAttribute("data-id","layer"+Ae.SELECT_BOX+"-selectbox"),t.data.canvases[Ae.DRAG].setAttribute("data-id","layer"+Ae.DRAG+"-drag");for(var s=0;s<Ae.BUFFER_COUNT;s++)t.data.bufferCanvases[s]=document.createElement("canvas"),t.data.bufferContexts[s]=t.data.bufferCanvases[s].getContext("2d"),t.data.bufferCanvases[s].style.position="absolute",t.data.bufferCanvases[s].setAttribute("data-id","buffer"+s),t.data.bufferCanvases[s].style.zIndex=String(-s-1),t.data.bufferCanvases[s].style.visibility="hidden";t.pathsEnabled=!0;var u=ut(),c=function(z){return{x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2}},h=function(z){return{x:-z.w/2,y:-z.h/2}},p=function(z){var q=z[0]._private,H=q.oldBackgroundTimestamp===q.backgroundTimestamp;return!H},d=function(z){return z[0]._private.nodeKey},g=function(z){return z[0]._private.labelStyleKey},v=function(z){return z[0]._private.sourceLabelStyleKey},b=function(z){return z[0]._private.targetLabelStyleKey},f=function(z,q,H,$,Z){return t.drawElement(z,q,H,!1,!1,Z)},m=function(z,q,H,$,Z){return t.drawElementText(z,q,H,$,"main",Z)},x=function(z,q,H,$,Z){return t.drawElementText(z,q,H,$,"source",Z)},T=function(z,q,H,$,Z){return t.drawElementText(z,q,H,$,"target",Z)},_=function(z){return z.boundingBox(),z[0]._private.bodyBounds},D=function(z){return z.boundingBox(),z[0]._private.labelBounds.main||u},y=function(z){return z.boundingBox(),z[0]._private.labelBounds.source||u},E=function(z){return z.boundingBox(),z[0]._private.labelBounds.target||u},w=function(z,q){return q},C=function(z){return c(_(z))},A=function(z,q,H){var $=z?z+"-":"";return{x:q.x+H.pstyle($+"text-margin-x").pfValue,y:q.y+H.pstyle($+"text-margin-y").pfValue}},k=function(z,q,H){var $=z[0]._private.rscratch;return{x:$[q],y:$[H]}},S=function(z){return A("",k(z,"labelX","labelY"),z)},N=function(z){return A("source",k(z,"sourceLabelX","sourceLabelY"),z)},P=function(z){return A("target",k(z,"targetLabelX","targetLabelY"),z)},R=function(z){return h(_(z))},I=function(z){return h(y(z))},O=function(z){return h(E(z))},M=function(z){var q=D(z),H=h(D(z));if(z.isNode()){switch(z.pstyle("text-halign").value){case"left":H.x=-q.w;break;case"right":H.x=0;break}switch(z.pstyle("text-valign").value){case"top":H.y=-q.h;break;case"bottom":H.y=0;break}}return H},G=t.data.eleTxrCache=new tr(t,{getKey:d,doesEleInvalidateKey:p,drawElement:f,getBoundingBox:_,getRotationPoint:C,getRotationOffset:R,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),B=t.data.lblTxrCache=new tr(t,{getKey:g,drawElement:m,getBoundingBox:D,getRotationPoint:S,getRotationOffset:M,isVisible:w}),V=t.data.slbTxrCache=new tr(t,{getKey:v,drawElement:x,getBoundingBox:y,getRotationPoint:N,getRotationOffset:I,isVisible:w}),F=t.data.tlbTxrCache=new tr(t,{getKey:b,drawElement:T,getBoundingBox:E,getRotationPoint:P,getRotationOffset:O,isVisible:w}),U=t.data.lyrTxrCache=new vl(t);t.onUpdateEleCalcs(function(z,q){G.invalidateElements(q),B.invalidateElements(q),V.invalidateElements(q),F.invalidateElements(q),U.invalidateElements(q);for(var H=0;H<q.length;H++){var $=q[H]._private;$.oldBackgroundTimestamp=$.backgroundTimestamp}});var Q=function(z){for(var q=0;q<z.length;q++)U.enqueueElementRefinement(z[q].ele)};G.onDequeue(Q),B.onDequeue(Q),V.onDequeue(Q),F.onDequeue(Q)}Ae.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Ae.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Ae.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Ae.SELECT_BOX]=t;break}};var d0=typeof Path2D<"u";Ae.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},Ae.usePaths=function(){return d0&&this.pathsEnabled},Ae.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Ae.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Ae.makeOffscreenCanvas=function(e,t){var n;return(typeof OffscreenCanvas>"u"?"undefined":Ve(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):(n=document.createElement("canvas"),n.width=e,n.height=t),n},[yl,Ct,St,Zi,ln,Sn,ct,Ut,dr,bl].forEach(function(e){de(Ae,e)});var p0=[{name:"null",impl:ll},{name:"base",impl:gl},{name:"canvas",impl:h0}],g0=[{type:"layout",extensions:Ey},{type:"renderer",extensions:p0}],wl={},El={};function _l(e,t,n){var r=n,i=function(y){Le("Can not register `"+t+"` for `"+e+"` since `"+y+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(hr.prototype[t])return i(t);hr.prototype[t]=n}else if(e==="collection"){if($e.prototype[t])return i(t);$e.prototype[t]=n}else if(e==="layout"){for(var o=function(y){this.options=y,n.call(this,y),_e(this._private)||(this._private={}),this._private.cy=y.cy,this._private.listeners=[],this.createEmitter()},a=o.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];a[u]=a[u]||function(){return this}}a.start&&!a.run?a.run=function(){return this.start(),this}:!a.start&&a.run&&(a.start=function(){return this.run(),this});var c=n.prototype.stop;a.stop=function(){var y=this.options;if(y&&y.animate){var E=this.animations;if(E)for(var w=0;w<E.length;w++)E[w].stop()}return c?c.call(this):this.emit("layoutstop"),this},a.destroy||(a.destroy=function(){return this}),a.cy=function(){return this._private.cy};var h=function(y){return y._private.cy},p={addEventFields:function(y,E){E.layout=y,E.cy=h(y),E.target=y},bubble:function(){return!0},parent:function(y){return h(y)}};de(a,{createEmitter:function(){return this._private.emitter=new mi(p,this),this},emitter:function(){return this._private.emitter},on:function(y,E){return this.emitter().on(y,E),this},one:function(y,E){return this.emitter().one(y,E),this},once:function(y,E){return this.emitter().one(y,E),this},removeListener:function(y,E){return this.emitter().removeListener(y,E),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(y,E){return this.emitter().emit(y,E),this}}),ke.eventAliasesOn(a),r=o}else if(e==="renderer"&&t!=="null"&&t!=="base"){var d=Tl("renderer","base"),g=d.prototype,v=n,b=n.prototype,f=function(){d.apply(this,arguments),v.apply(this,arguments)},m=f.prototype;for(var x in g){var T=g[x],_=b[x]!=null;if(_)return i(x);m[x]=T}for(var D in b)m[D]=b[D];g.clientFunctions.forEach(function(y){m[y]=m[y]||function(){Be("Renderer does not implement `renderer."+y+"()` on its prototype")}}),r=f}else if(e==="__proto__"||e==="constructor"||e==="prototype")return Be(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return vs({map:wl,keys:[e,t],value:r})}function Tl(e,t){return ys({map:wl,keys:[e,t]})}function f0(e,t,n,r,i){return vs({map:El,keys:[e,t,n,r],value:i})}function v0(e,t,n,r){return ys({map:El,keys:[e,t,n,r]})}var ea=function(){if(arguments.length===2)return Tl.apply(null,arguments);if(arguments.length===3)return _l.apply(null,arguments);if(arguments.length===4)return v0.apply(null,arguments);if(arguments.length===5)return f0.apply(null,arguments);Be("Invalid extension access syntax")};hr.prototype.extension=ea,g0.forEach(function(e){e.extensions.forEach(function(t){_l(e.type,t.name,t.impl)})});var Dl=function e(){if(!(this instanceof e))return new e;this.length=0},tn=Dl.prototype;tn.instanceString=function(){return"stylesheet"},tn.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},tn.css=function(e,t){var n=this.length-1;if(le(e))this[n].properties.push({name:e,value:t});else if(_e(e))for(var r=e,i=Object.keys(r),o=0;o<i.length;o++){var a=i[o],s=r[a];if(s!=null){var l=rt.properties[a]||rt.properties[gi(a)];if(l!=null){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},tn.style=tn.css,tn.generateStyle=function(e){var t=new rt(e);return this.appendToStyle(t)},tn.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var o=0;o<i.length;o++){var a=i[o];e.css(a.name,a.value)}}return e};var y0="3.28.1",sn=function(e){if(e===void 0&&(e={}),_e(e))return new hr(e);if(le(e))return ea.apply(ea,arguments)};sn.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(sn),e.apply(null,t),this},sn.warnings=function(e){return _s(e)},sn.version=y0,sn.stylesheet=sn.Stylesheet=Dl;var m0=sn;const Cl=Jo(m0);var Al={exports:{}},$o={exports:{}},Ko={exports:{}},Zo;function b0(){return Zo||(Zo=1,function(e,t){(function(n,r){e.exports=r()})(Xt,function(){return function(n){var r={};function i(o){if(r[o])return r[o].exports;var a=r[o]={i:o,l:!1,exports:{}};return n[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=n,i.c=r,i.i=function(o){return o},i.d=function(o,a,s){i.o(o,a)||Object.defineProperty(o,a,{configurable:!1,enumerable:!0,get:s})},i.n=function(o){var a=o&&o.__esModule?function(){return o.default}:function(){return o};return i.d(a,"a",a),a},i.o=function(o,a){return Object.prototype.hasOwnProperty.call(o,a)},i.p="",i(i.s=26)}([function(n,r,i){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,n.exports=o},function(n,r,i){var o=i(2),a=i(8),s=i(9);function l(c,h,p){o.call(this,p),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=p,this.bendpoints=[],this.source=c,this.target=h}l.prototype=Object.create(o.prototype);for(var u in o)l[u]=o[u];l.prototype.getSource=function(){return this.source},l.prototype.getTarget=function(){return this.target},l.prototype.isInterGraph=function(){return this.isInterGraph},l.prototype.getLength=function(){return this.length},l.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},l.prototype.getBendpoints=function(){return this.bendpoints},l.prototype.getLca=function(){return this.lca},l.prototype.getSourceInLca=function(){return this.sourceInLca},l.prototype.getTargetInLca=function(){return this.targetInLca},l.prototype.getOtherEnd=function(c){if(this.source===c)return this.target;if(this.target===c)return this.source;throw"Node is not incident with this edge"},l.prototype.getOtherEndInGraph=function(c,h){for(var p=this.getOtherEnd(c),d=h.getGraphManager().getRoot();;){if(p.getOwner()==h)return p;if(p.getOwner()==d)break;p=p.getOwner().getParent()}return null},l.prototype.updateLength=function(){var c=new Array(4);this.isOverlapingSourceAndTarget=a.getIntersection(this.target.getRect(),this.source.getRect(),c),this.isOverlapingSourceAndTarget||(this.lengthX=c[0]-c[2],this.lengthY=c[1]-c[3],Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},l.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=s.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=s.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},n.exports=l},function(n,r,i){function o(a){this.vGraphObject=a}n.exports=o},function(n,r,i){var o=i(2),a=i(10),s=i(13),l=i(0),u=i(16),c=i(4);function h(d,g,v,b){v==null&&b==null&&(b=g),o.call(this,b),d.graphManager!=null&&(d=d.graphManager),this.estimatedSize=a.MIN_VALUE,this.inclusionTreeDepth=a.MAX_VALUE,this.vGraphObject=b,this.edges=[],this.graphManager=d,v!=null&&g!=null?this.rect=new s(g.x,g.y,v.width,v.height):this.rect=new s}h.prototype=Object.create(o.prototype);for(var p in o)h[p]=o[p];h.prototype.getEdges=function(){return this.edges},h.prototype.getChild=function(){return this.child},h.prototype.getOwner=function(){return this.owner},h.prototype.getWidth=function(){return this.rect.width},h.prototype.setWidth=function(d){this.rect.width=d},h.prototype.getHeight=function(){return this.rect.height},h.prototype.setHeight=function(d){this.rect.height=d},h.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},h.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},h.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},h.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},h.prototype.getRect=function(){return this.rect},h.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},h.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},h.prototype.setRect=function(d,g){this.rect.x=d.x,this.rect.y=d.y,this.rect.width=g.width,this.rect.height=g.height},h.prototype.setCenter=function(d,g){this.rect.x=d-this.rect.width/2,this.rect.y=g-this.rect.height/2},h.prototype.setLocation=function(d,g){this.rect.x=d,this.rect.y=g},h.prototype.moveBy=function(d,g){this.rect.x+=d,this.rect.y+=g},h.prototype.getEdgeListToNode=function(d){var g=[],v=this;return v.edges.forEach(function(b){if(b.target==d){if(b.source!=v)throw"Incorrect edge source!";g.push(b)}}),g},h.prototype.getEdgesBetween=function(d){var g=[],v=this;return v.edges.forEach(function(b){if(!(b.source==v||b.target==v))throw"Incorrect edge source and/or target";(b.target==d||b.source==d)&&g.push(b)}),g},h.prototype.getNeighborsList=function(){var d=new Set,g=this;return g.edges.forEach(function(v){if(v.source==g)d.add(v.target);else{if(v.target!=g)throw"Incorrect incidency!";d.add(v.source)}}),d},h.prototype.withChildren=function(){var d=new Set,g,v;if(d.add(this),this.child!=null)for(var b=this.child.getNodes(),f=0;f<b.length;f++)g=b[f],v=g.withChildren(),v.forEach(function(m){d.add(m)});return d},h.prototype.getNoOfChildren=function(){var d=0,g;if(this.child==null)d=1;else for(var v=this.child.getNodes(),b=0;b<v.length;b++)g=v[b],d+=g.getNoOfChildren();return d==0&&(d=1),d},h.prototype.getEstimatedSize=function(){if(this.estimatedSize==a.MIN_VALUE)throw"assert failed";return this.estimatedSize},h.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},h.prototype.scatter=function(){var d,g,v=-l.INITIAL_WORLD_BOUNDARY,b=l.INITIAL_WORLD_BOUNDARY;d=l.WORLD_CENTER_X+u.nextDouble()*(b-v)+v;var f=-l.INITIAL_WORLD_BOUNDARY,m=l.INITIAL_WORLD_BOUNDARY;g=l.WORLD_CENTER_Y+u.nextDouble()*(m-f)+f,this.rect.x=d,this.rect.y=g},h.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var d=this.getChild();if(d.updateBounds(!0),this.rect.x=d.getLeft(),this.rect.y=d.getTop(),this.setWidth(d.getRight()-d.getLeft()),this.setHeight(d.getBottom()-d.getTop()),l.NODE_DIMENSIONS_INCLUDE_LABELS){var g=d.getRight()-d.getLeft(),v=d.getBottom()-d.getTop();this.labelWidth>g&&(this.rect.x-=(this.labelWidth-g)/2,this.setWidth(this.labelWidth)),this.labelHeight>v&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-v)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-v),this.setHeight(this.labelHeight))}}},h.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==a.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},h.prototype.transform=function(d){var g=this.rect.x;g>l.WORLD_BOUNDARY?g=l.WORLD_BOUNDARY:g<-l.WORLD_BOUNDARY&&(g=-l.WORLD_BOUNDARY);var v=this.rect.y;v>l.WORLD_BOUNDARY?v=l.WORLD_BOUNDARY:v<-l.WORLD_BOUNDARY&&(v=-l.WORLD_BOUNDARY);var b=new c(g,v),f=d.inverseTransformPoint(b);this.setLocation(f.x,f.y)},h.prototype.getLeft=function(){return this.rect.x},h.prototype.getRight=function(){return this.rect.x+this.rect.width},h.prototype.getTop=function(){return this.rect.y},h.prototype.getBottom=function(){return this.rect.y+this.rect.height},h.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},n.exports=h},function(n,r,i){function o(a,s){a==null&&s==null?(this.x=0,this.y=0):(this.x=a,this.y=s)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(a){this.x=a},o.prototype.setY=function(a){this.y=a},o.prototype.getDifference=function(a){return new DimensionD(this.x-a.x,this.y-a.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(a){return this.x+=a.width,this.y+=a.height,this},n.exports=o},function(n,r,i){var o=i(2),a=i(10),s=i(0),l=i(6),u=i(3),c=i(1),h=i(13),p=i(12),d=i(11);function g(b,f,m){o.call(this,m),this.estimatedSize=a.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=b,f!=null&&f instanceof l?this.graphManager=f:f!=null&&f instanceof Layout&&(this.graphManager=f.graphManager)}g.prototype=Object.create(o.prototype);for(var v in o)g[v]=o[v];g.prototype.getNodes=function(){return this.nodes},g.prototype.getEdges=function(){return this.edges},g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getParent=function(){return this.parent},g.prototype.getLeft=function(){return this.left},g.prototype.getRight=function(){return this.right},g.prototype.getTop=function(){return this.top},g.prototype.getBottom=function(){return this.bottom},g.prototype.isConnected=function(){return this.isConnected},g.prototype.add=function(b,f,m){if(f==null&&m==null){var x=b;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(x)>-1)throw"Node already in graph!";return x.owner=this,this.getNodes().push(x),x}else{var T=b;if(!(this.getNodes().indexOf(f)>-1&&this.getNodes().indexOf(m)>-1))throw"Source or target not in graph!";if(!(f.owner==m.owner&&f.owner==this))throw"Both owners must be this graph!";return f.owner!=m.owner?null:(T.source=f,T.target=m,T.isInterGraph=!1,this.getEdges().push(T),f.edges.push(T),m!=f&&m.edges.push(T),T)}},g.prototype.remove=function(b){var f=b;if(b instanceof u){if(f==null)throw"Node is null!";if(!(f.owner!=null&&f.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var m=f.edges.slice(),x,T=m.length,_=0;_<T;_++)x=m[_],x.isInterGraph?this.graphManager.remove(x):x.source.owner.remove(x);var D=this.nodes.indexOf(f);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(b instanceof c){var x=b;if(x==null)throw"Edge is null!";if(!(x.source!=null&&x.target!=null))throw"Source and/or target is null!";if(!(x.source.owner!=null&&x.target.owner!=null&&x.source.owner==this&&x.target.owner==this))throw"Source and/or target owner is invalid!";var y=x.source.edges.indexOf(x),E=x.target.edges.indexOf(x);if(!(y>-1&&E>-1))throw"Source and/or target doesn't know this edge!";x.source.edges.splice(y,1),x.target!=x.source&&x.target.edges.splice(E,1);var D=x.source.owner.getEdges().indexOf(x);if(D==-1)throw"Not in owner's edge list!";x.source.owner.getEdges().splice(D,1)}},g.prototype.updateLeftTop=function(){for(var b=a.MAX_VALUE,f=a.MAX_VALUE,m,x,T,_=this.getNodes(),D=_.length,y=0;y<D;y++){var E=_[y];m=E.getTop(),x=E.getLeft(),b>m&&(b=m),f>x&&(f=x)}return b==a.MAX_VALUE?null:(_[0].getParent().paddingLeft!=null?T=_[0].getParent().paddingLeft:T=this.margin,this.left=f-T,this.top=b-T,new p(this.left,this.top))},g.prototype.updateBounds=function(b){for(var f=a.MAX_VALUE,m=-a.MAX_VALUE,x=a.MAX_VALUE,T=-a.MAX_VALUE,_,D,y,E,w,C=this.nodes,A=C.length,k=0;k<A;k++){var S=C[k];b&&S.child!=null&&S.updateBounds(),_=S.getLeft(),D=S.getRight(),y=S.getTop(),E=S.getBottom(),f>_&&(f=_),m<D&&(m=D),x>y&&(x=y),T<E&&(T=E)}var N=new h(f,x,m-f,T-x);f==a.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),C[0].getParent().paddingLeft!=null?w=C[0].getParent().paddingLeft:w=this.margin,this.left=N.x-w,this.right=N.x+N.width+w,this.top=N.y-w,this.bottom=N.y+N.height+w},g.calculateBounds=function(b){for(var f=a.MAX_VALUE,m=-a.MAX_VALUE,x=a.MAX_VALUE,T=-a.MAX_VALUE,_,D,y,E,w=b.length,C=0;C<w;C++){var A=b[C];_=A.getLeft(),D=A.getRight(),y=A.getTop(),E=A.getBottom(),f>_&&(f=_),m<D&&(m=D),x>y&&(x=y),T<E&&(T=E)}var k=new h(f,x,m-f,T-x);return k},g.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},g.prototype.getEstimatedSize=function(){if(this.estimatedSize==a.MIN_VALUE)throw"assert failed";return this.estimatedSize},g.prototype.calcEstimatedSize=function(){for(var b=0,f=this.nodes,m=f.length,x=0;x<m;x++){var T=f[x];b+=T.calcEstimatedSize()}return b==0?this.estimatedSize=s.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=b/Math.sqrt(this.nodes.length),this.estimatedSize},g.prototype.updateConnected=function(){var b=this;if(this.nodes.length==0){this.isConnected=!0;return}var f=new d,m=new Set,x=this.nodes[0],T,_,D=x.withChildren();for(D.forEach(function(k){f.push(k),m.add(k)});f.length!==0;){x=f.shift(),T=x.getEdges();for(var y=T.length,E=0;E<y;E++){var w=T[E];if(_=w.getOtherEndInGraph(x,this),_!=null&&!m.has(_)){var C=_.withChildren();C.forEach(function(k){f.push(k),m.add(k)})}}}if(this.isConnected=!1,m.size>=this.nodes.length){var A=0;m.forEach(function(k){k.owner==b&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},n.exports=g},function(n,r,i){var o,a=i(1);function s(l){o=i(5),this.layout=l,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),c=this.add(l,u);return this.setRootGraph(c),this.rootGraph},s.prototype.add=function(l,u,c,h,p){if(c==null&&h==null&&p==null){if(l==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(l)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(l),l.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return l.parent=u,u.child=l,l}else{p=c,h=u,c=l;var d=h.getOwner(),g=p.getOwner();if(!(d!=null&&d.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(g!=null&&g.getGraphManager()==this))throw"Target not in this graph mgr!";if(d==g)return c.isInterGraph=!1,d.add(c,h,p);if(c.isInterGraph=!0,c.source=h,c.target=p,this.edges.indexOf(c)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(c),!(c.source!=null&&c.target!=null))throw"Edge source and/or target is null!";if(!(c.source.edges.indexOf(c)==-1&&c.target.edges.indexOf(c)==-1))throw"Edge already in source and/or target incidency list!";return c.source.edges.push(c),c.target.edges.push(c),c}},s.prototype.remove=function(l){if(l instanceof o){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var c=[];c=c.concat(u.getEdges());for(var h,p=c.length,d=0;d<p;d++)h=c[d],u.remove(h);var g=[];g=g.concat(u.getNodes());var v;p=g.length;for(var d=0;d<p;d++)v=g[d],u.remove(v);u==this.rootGraph&&this.setRootGraph(null);var b=this.graphs.indexOf(u);this.graphs.splice(b,1),u.parent=null}else if(l instanceof a){if(h=l,h==null)throw"Edge is null!";if(!h.isInterGraph)throw"Not an inter-graph edge!";if(!(h.source!=null&&h.target!=null))throw"Source and/or target is null!";if(!(h.source.edges.indexOf(h)!=-1&&h.target.edges.indexOf(h)!=-1))throw"Source and/or target doesn't know this edge!";var b=h.source.edges.indexOf(h);if(h.source.edges.splice(b,1),b=h.target.edges.indexOf(h),h.target.edges.splice(b,1),!(h.source.owner!=null&&h.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(h.source.owner.getGraphManager().edges.indexOf(h)==-1)throw"Not in owner graph manager's edge list!";var b=h.source.owner.getGraphManager().edges.indexOf(h);h.source.owner.getGraphManager().edges.splice(b,1)}},s.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},s.prototype.getGraphs=function(){return this.graphs},s.prototype.getAllNodes=function(){if(this.allNodes==null){for(var l=[],u=this.getGraphs(),c=u.length,h=0;h<c;h++)l=l.concat(u[h].getNodes());this.allNodes=l}return this.allNodes},s.prototype.resetAllNodes=function(){this.allNodes=null},s.prototype.resetAllEdges=function(){this.allEdges=null},s.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},s.prototype.getAllEdges=function(){if(this.allEdges==null){var l=[],u=this.getGraphs();u.length;for(var c=0;c<u.length;c++)l=l.concat(u[c].getEdges());l=l.concat(this.edges),this.allEdges=l}return this.allEdges},s.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},s.prototype.setAllNodesToApplyGravitation=function(l){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=l},s.prototype.getRoot=function(){return this.rootGraph},s.prototype.setRootGraph=function(l){if(l.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=l,l.parent==null&&(l.parent=this.layout.newNode("Root node"))},s.prototype.getLayout=function(){return this.layout},s.prototype.isOneAncestorOfOther=function(l,u){if(!(l!=null&&u!=null))throw"assert failed";if(l==u)return!0;var c=l.getOwner(),h;do{if(h=c.getParent(),h==null)break;if(h==u)return!0;if(c=h.getOwner(),c==null)break}while(!0);c=u.getOwner();do{if(h=c.getParent(),h==null)break;if(h==l)return!0;if(c=h.getOwner(),c==null)break}while(!0);return!1},s.prototype.calcLowestCommonAncestors=function(){for(var l,u,c,h,p,d=this.getAllEdges(),g=d.length,v=0;v<g;v++){if(l=d[v],u=l.source,c=l.target,l.lca=null,l.sourceInLca=u,l.targetInLca=c,u==c){l.lca=u.getOwner();continue}for(h=u.getOwner();l.lca==null;){for(l.targetInLca=c,p=c.getOwner();l.lca==null;){if(p==h){l.lca=p;break}if(p==this.rootGraph)break;if(l.lca!=null)throw"assert failed";l.targetInLca=p.getParent(),p=l.targetInLca.getOwner()}if(h==this.rootGraph)break;l.lca==null&&(l.sourceInLca=h.getParent(),h=l.sourceInLca.getOwner())}if(l.lca==null)throw"assert failed"}},s.prototype.calcLowestCommonAncestor=function(l,u){if(l==u)return l.getOwner();var c=l.getOwner();do{if(c==null)break;var h=u.getOwner();do{if(h==null)break;if(h==c)return h;h=h.getParent().getOwner()}while(!0);c=c.getParent().getOwner()}while(!0);return c},s.prototype.calcInclusionTreeDepths=function(l,u){l==null&&u==null&&(l=this.rootGraph,u=1);for(var c,h=l.getNodes(),p=h.length,d=0;d<p;d++)c=h[d],c.inclusionTreeDepth=u,c.child!=null&&this.calcInclusionTreeDepths(c.child,u+1)},s.prototype.includesInvalidEdge=function(){for(var l,u=this.edges.length,c=0;c<u;c++)if(l=this.edges[c],this.isOneAncestorOfOther(l.source,l.target))return!0;return!1},n.exports=s},function(n,r,i){var o=i(0);function a(){}for(var s in o)a[s]=o[s];a.MAX_ITERATIONS=2500,a.DEFAULT_EDGE_LENGTH=50,a.DEFAULT_SPRING_STRENGTH=.45,a.DEFAULT_REPULSION_STRENGTH=4500,a.DEFAULT_GRAVITY_STRENGTH=.4,a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,a.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,a.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,a.COOLING_ADAPTATION_FACTOR=.33,a.ADAPTATION_LOWER_NODE_LIMIT=1e3,a.ADAPTATION_UPPER_NODE_LIMIT=5e3,a.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,a.MAX_NODE_DISPLACEMENT=a.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,a.MIN_REPULSION_DIST=a.DEFAULT_EDGE_LENGTH/10,a.CONVERGENCE_CHECK_PERIOD=100,a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,a.MIN_EDGE_LENGTH=1,a.GRID_CALCULATION_CHECK_PERIOD=10,n.exports=a},function(n,r,i){var o=i(12);function a(){}a.calcSeparationAmount=function(s,l,u,c){if(!s.intersects(l))throw"assert failed";var h=new Array(2);this.decideDirectionsForOverlappingNodes(s,l,h),u[0]=Math.min(s.getRight(),l.getRight())-Math.max(s.x,l.x),u[1]=Math.min(s.getBottom(),l.getBottom())-Math.max(s.y,l.y),s.getX()<=l.getX()&&s.getRight()>=l.getRight()?u[0]+=Math.min(l.getX()-s.getX(),s.getRight()-l.getRight()):l.getX()<=s.getX()&&l.getRight()>=s.getRight()&&(u[0]+=Math.min(s.getX()-l.getX(),l.getRight()-s.getRight())),s.getY()<=l.getY()&&s.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-s.getY(),s.getBottom()-l.getBottom()):l.getY()<=s.getY()&&l.getBottom()>=s.getBottom()&&(u[1]+=Math.min(s.getY()-l.getY(),l.getBottom()-s.getBottom()));var p=Math.abs((l.getCenterY()-s.getCenterY())/(l.getCenterX()-s.getCenterX()));l.getCenterY()===s.getCenterY()&&l.getCenterX()===s.getCenterX()&&(p=1);var d=p*u[0],g=u[1]/p;u[0]<g?g=u[0]:d=u[1],u[0]=-1*h[0]*(g/2+c),u[1]=-1*h[1]*(d/2+c)},a.decideDirectionsForOverlappingNodes=function(s,l,u){s.getCenterX()<l.getCenterX()?u[0]=-1:u[0]=1,s.getCenterY()<l.getCenterY()?u[1]=-1:u[1]=1},a.getIntersection2=function(s,l,u){var c=s.getCenterX(),h=s.getCenterY(),p=l.getCenterX(),d=l.getCenterY();if(s.intersects(l))return u[0]=c,u[1]=h,u[2]=p,u[3]=d,!0;var g=s.getX(),v=s.getY(),b=s.getRight(),f=s.getX(),m=s.getBottom(),x=s.getRight(),T=s.getWidthHalf(),_=s.getHeightHalf(),D=l.getX(),y=l.getY(),E=l.getRight(),w=l.getX(),C=l.getBottom(),A=l.getRight(),k=l.getWidthHalf(),S=l.getHeightHalf(),N=!1,P=!1;if(c===p){if(h>d)return u[0]=c,u[1]=v,u[2]=p,u[3]=C,!1;if(h<d)return u[0]=c,u[1]=m,u[2]=p,u[3]=y,!1}else if(h===d){if(c>p)return u[0]=g,u[1]=h,u[2]=E,u[3]=d,!1;if(c<p)return u[0]=b,u[1]=h,u[2]=D,u[3]=d,!1}else{var R=s.height/s.width,I=l.height/l.width,O=(d-h)/(p-c),M=void 0,G=void 0,B=void 0,V=void 0,F=void 0,U=void 0;if(-R===O?c>p?(u[0]=f,u[1]=m,N=!0):(u[0]=b,u[1]=v,N=!0):R===O&&(c>p?(u[0]=g,u[1]=v,N=!0):(u[0]=x,u[1]=m,N=!0)),-I===O?p>c?(u[2]=w,u[3]=C,P=!0):(u[2]=E,u[3]=y,P=!0):I===O&&(p>c?(u[2]=D,u[3]=y,P=!0):(u[2]=A,u[3]=C,P=!0)),N&&P)return!1;if(c>p?h>d?(M=this.getCardinalDirection(R,O,4),G=this.getCardinalDirection(I,O,2)):(M=this.getCardinalDirection(-R,O,3),G=this.getCardinalDirection(-I,O,1)):h>d?(M=this.getCardinalDirection(-R,O,1),G=this.getCardinalDirection(-I,O,3)):(M=this.getCardinalDirection(R,O,2),G=this.getCardinalDirection(I,O,4)),!N)switch(M){case 1:V=v,B=c+-_/O,u[0]=B,u[1]=V;break;case 2:B=x,V=h+T*O,u[0]=B,u[1]=V;break;case 3:V=m,B=c+_/O,u[0]=B,u[1]=V;break;case 4:B=f,V=h+-T*O,u[0]=B,u[1]=V;break}if(!P)switch(G){case 1:U=y,F=p+-S/O,u[2]=F,u[3]=U;break;case 2:F=A,U=d+k*O,u[2]=F,u[3]=U;break;case 3:U=C,F=p+S/O,u[2]=F,u[3]=U;break;case 4:F=w,U=d+-k*O,u[2]=F,u[3]=U;break}}return!1},a.getCardinalDirection=function(s,l,u){return s>l?u:1+u%4},a.getIntersection=function(s,l,u,c){if(c==null)return this.getIntersection2(s,l,u);var h=s.x,p=s.y,d=l.x,g=l.y,v=u.x,b=u.y,f=c.x,m=c.y,x=void 0,T=void 0,_=void 0,D=void 0,y=void 0,E=void 0,w=void 0,C=void 0,A=void 0;return _=g-p,y=h-d,w=d*p-h*g,D=m-b,E=v-f,C=f*b-v*m,A=_*E-D*y,A===0?null:(x=(y*C-E*w)/A,T=(D*w-_*C)/A,new o(x,T))},a.angleOfVector=function(s,l,u,c){var h=void 0;return s!==u?(h=Math.atan((c-l)/(u-s)),u<s?h+=Math.PI:c<l&&(h+=this.TWO_PI)):c<l?h=this.ONE_AND_HALF_PI:h=this.HALF_PI,h},a.doIntersect=function(s,l,u,c){var h=s.x,p=s.y,d=l.x,g=l.y,v=u.x,b=u.y,f=c.x,m=c.y,x=(d-h)*(m-b)-(f-v)*(g-p);if(x===0)return!1;var T=((m-b)*(f-h)+(v-f)*(m-p))/x,_=((p-g)*(f-h)+(d-h)*(m-p))/x;return 0<T&&T<1&&0<_&&_<1},a.HALF_PI=.5*Math.PI,a.ONE_AND_HALF_PI=1.5*Math.PI,a.TWO_PI=2*Math.PI,a.THREE_PI=3*Math.PI,n.exports=a},function(n,r,i){function o(){}o.sign=function(a){return a>0?1:a<0?-1:0},o.floor=function(a){return a<0?Math.ceil(a):Math.floor(a)},o.ceil=function(a){return a<0?Math.floor(a):Math.ceil(a)},n.exports=o},function(n,r,i){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,n.exports=o},function(n,r,i){var o=function(){function h(p,d){for(var g=0;g<d.length;g++){var v=d[g];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(p,v.key,v)}}return function(p,d,g){return d&&h(p.prototype,d),g&&h(p,g),p}}();function a(h,p){if(!(h instanceof p))throw new TypeError("Cannot call a class as a function")}var s=function(h){return{value:h,next:null,prev:null}},l=function(h,p,d,g){return h!==null?h.next=p:g.head=p,d!==null?d.prev=p:g.tail=p,p.prev=h,p.next=d,g.length++,p},u=function(h,p){var d=h.prev,g=h.next;return d!==null?d.next=g:p.head=g,g!==null?g.prev=d:p.tail=d,h.prev=h.next=null,p.length--,h},c=function(){function h(p){var d=this;a(this,h),this.length=0,this.head=null,this.tail=null,p==null||p.forEach(function(g){return d.push(g)})}return o(h,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(p,d){return l(d.prev,s(p),d,this)}},{key:"insertAfter",value:function(p,d){return l(d,s(p),d.next,this)}},{key:"insertNodeBefore",value:function(p,d){return l(d.prev,p,d,this)}},{key:"insertNodeAfter",value:function(p,d){return l(d,p,d.next,this)}},{key:"push",value:function(p){return l(this.tail,s(p),null,this)}},{key:"unshift",value:function(p){return l(null,s(p),this.head,this)}},{key:"remove",value:function(p){return u(p,this)}},{key:"pop",value:function(){return u(this.tail,this).value}},{key:"popNode",value:function(){return u(this.tail,this)}},{key:"shift",value:function(){return u(this.head,this).value}},{key:"shiftNode",value:function(){return u(this.head,this)}},{key:"get_object_at",value:function(p){if(p<=this.length()){for(var d=1,g=this.head;d<p;)g=g.next,d++;return g.value}}},{key:"set_object_at",value:function(p,d){if(p<=this.length()){for(var g=1,v=this.head;g<p;)v=v.next,g++;v.value=d}}}]),h}();n.exports=c},function(n,r,i){function o(a,s,l){this.x=null,this.y=null,a==null&&s==null&&l==null?(this.x=0,this.y=0):typeof a=="number"&&typeof s=="number"&&l==null?(this.x=a,this.y=s):a.constructor.name=="Point"&&s==null&&l==null&&(l=a,this.x=l.x,this.y=l.y)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.getLocation=function(){return new o(this.x,this.y)},o.prototype.setLocation=function(a,s,l){a.constructor.name=="Point"&&s==null&&l==null?(l=a,this.setLocation(l.x,l.y)):typeof a=="number"&&typeof s=="number"&&l==null&&(parseInt(a)==a&&parseInt(s)==s?this.move(a,s):(this.x=Math.floor(a+.5),this.y=Math.floor(s+.5)))},o.prototype.move=function(a,s){this.x=a,this.y=s},o.prototype.translate=function(a,s){this.x+=a,this.y+=s},o.prototype.equals=function(a){if(a.constructor.name=="Point"){var s=a;return this.x==s.x&&this.y==s.y}return this==a},o.prototype.toString=function(){return new o().constructor.name+"[x="+this.x+",y="+this.y+"]"},n.exports=o},function(n,r,i){function o(a,s,l,u){this.x=0,this.y=0,this.width=0,this.height=0,a!=null&&s!=null&&l!=null&&u!=null&&(this.x=a,this.y=s,this.width=l,this.height=u)}o.prototype.getX=function(){return this.x},o.prototype.setX=function(a){this.x=a},o.prototype.getY=function(){return this.y},o.prototype.setY=function(a){this.y=a},o.prototype.getWidth=function(){return this.width},o.prototype.setWidth=function(a){this.width=a},o.prototype.getHeight=function(){return this.height},o.prototype.setHeight=function(a){this.height=a},o.prototype.getRight=function(){return this.x+this.width},o.prototype.getBottom=function(){return this.y+this.height},o.prototype.intersects=function(a){return!(this.getRight()<a.x||this.getBottom()<a.y||a.getRight()<this.x||a.getBottom()<this.y)},o.prototype.getCenterX=function(){return this.x+this.width/2},o.prototype.getMinX=function(){return this.getX()},o.prototype.getMaxX=function(){return this.getX()+this.width},o.prototype.getCenterY=function(){return this.y+this.height/2},o.prototype.getMinY=function(){return this.getY()},o.prototype.getMaxY=function(){return this.getY()+this.height},o.prototype.getWidthHalf=function(){return this.width/2},o.prototype.getHeightHalf=function(){return this.height/2},n.exports=o},function(n,r,i){var o=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s};function a(){}a.lastID=0,a.createID=function(s){return a.isPrimitive(s)?s:(s.uniqueID!=null||(s.uniqueID=a.getString(),a.lastID++),s.uniqueID)},a.getString=function(s){return s==null&&(s=a.lastID),"Object#"+s},a.isPrimitive=function(s){var l=typeof s>"u"?"undefined":o(s);return s==null||l!="object"&&l!="function"},n.exports=a},function(n,r,i){function o(v){if(Array.isArray(v)){for(var b=0,f=Array(v.length);b<v.length;b++)f[b]=v[b];return f}else return Array.from(v)}var a=i(0),s=i(6),l=i(3),u=i(1),c=i(5),h=i(4),p=i(17),d=i(27);function g(v){d.call(this),this.layoutQuality=a.QUALITY,this.createBendsAsNeeded=a.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=a.DEFAULT_INCREMENTAL,this.animationOnLayout=a.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=a.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=a.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=a.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new s(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,v!=null&&(this.isRemoteUse=v)}g.RANDOM_SEED=1,g.prototype=Object.create(d.prototype),g.prototype.getGraphManager=function(){return this.graphManager},g.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},g.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},g.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},g.prototype.newGraphManager=function(){var v=new s(this);return this.graphManager=v,v},g.prototype.newGraph=function(v){return new c(null,this.graphManager,v)},g.prototype.newNode=function(v){return new l(this.graphManager,v)},g.prototype.newEdge=function(v){return new u(null,null,v)},g.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},g.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var v;return this.checkLayoutSuccess()?v=!1:v=this.layout(),a.ANIMATE==="during"?!1:(v&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,v)},g.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},g.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var v=this.graphManager.getAllEdges(),b=0;b<v.length;b++)v[b];for(var f=this.graphManager.getRoot().getNodes(),b=0;b<f.length;b++)f[b];this.update(this.graphManager.getRoot())}},g.prototype.update=function(v){if(v==null)this.update2();else if(v instanceof l){var b=v;if(b.getChild()!=null)for(var f=b.getChild().getNodes(),m=0;m<f.length;m++)update(f[m]);if(b.vGraphObject!=null){var x=b.vGraphObject;x.update(b)}}else if(v instanceof u){var T=v;if(T.vGraphObject!=null){var _=T.vGraphObject;_.update(T)}}else if(v instanceof c){var D=v;if(D.vGraphObject!=null){var y=D.vGraphObject;y.update(D)}}},g.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=a.QUALITY,this.animationDuringLayout=a.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=a.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=a.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=a.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=a.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=a.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},g.prototype.transform=function(v){if(v==null)this.transform(new h(0,0));else{var b=new p,f=this.graphManager.getRoot().updateLeftTop();if(f!=null){b.setWorldOrgX(v.x),b.setWorldOrgY(v.y),b.setDeviceOrgX(f.x),b.setDeviceOrgY(f.y);for(var m=this.getAllNodes(),x,T=0;T<m.length;T++)x=m[T],x.transform(b)}}},g.prototype.positionNodesRandomly=function(v){if(v==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var b,f,m=v.getNodes(),x=0;x<m.length;x++)b=m[x],f=b.getChild(),f==null||f.getNodes().length==0?b.scatter():(this.positionNodesRandomly(f),b.updateBounds())},g.prototype.getFlatForest=function(){for(var v=[],b=!0,f=this.graphManager.getRoot().getNodes(),m=!0,x=0;x<f.length;x++)f[x].getChild()!=null&&(m=!1);if(!m)return v;var T=new Set,_=[],D=new Map,y=[];for(y=y.concat(f);y.length>0&&b;){for(_.push(y[0]);_.length>0&&b;){var E=_[0];_.splice(0,1),T.add(E);for(var w=E.getEdges(),x=0;x<w.length;x++){var C=w[x].getOtherEnd(E);if(D.get(E)!=C)if(!T.has(C))_.push(C),D.set(C,E);else{b=!1;break}}}if(!b)v=[];else{var A=[].concat(o(T));v.push(A);for(var x=0;x<A.length;x++){var k=A[x],S=y.indexOf(k);S>-1&&y.splice(S,1)}T=new Set,D=new Map}}return v},g.prototype.createDummyNodesForBendpoints=function(v){for(var b=[],f=v.source,m=this.graphManager.calcLowestCommonAncestor(v.source,v.target),x=0;x<v.bendpoints.length;x++){var T=this.newNode(null);T.setRect(new Point(0,0),new Dimension(1,1)),m.add(T);var _=this.newEdge(null);this.graphManager.add(_,f,T),b.add(T),f=T}var _=this.newEdge(null);return this.graphManager.add(_,f,v.target),this.edgeToDummyNodes.set(v,b),v.isInterGraph()?this.graphManager.remove(v):m.remove(v),b},g.prototype.createBendpointsFromDummyNodes=function(){var v=[];v=v.concat(this.graphManager.getAllEdges()),v=[].concat(o(this.edgeToDummyNodes.keys())).concat(v);for(var b=0;b<v.length;b++){var f=v[b];if(f.bendpoints.length>0){for(var m=this.edgeToDummyNodes.get(f),x=0;x<m.length;x++){var T=m[x],_=new h(T.getCenterX(),T.getCenterY()),D=f.bendpoints.get(x);D.x=_.x,D.y=_.y,T.getOwner().remove(T)}this.graphManager.add(f,f.source,f.target)}}},g.transform=function(v,b,f,m){if(f!=null&&m!=null){var x=b;if(v<=50){var T=b/f;x-=(b-T)/50*(50-v)}else{var _=b*m;x+=(_-b)/50*(v-50)}return x}else{var D,y;return v<=50?(D=9*b/500,y=b/10):(D=9*b/50,y=-8*b),D*v+y}},g.findCenterOfTree=function(v){var b=[];b=b.concat(v);var f=[],m=new Map,x=!1,T=null;(b.length==1||b.length==2)&&(x=!0,T=b[0]);for(var _=0;_<b.length;_++){var D=b[_],y=D.getNeighborsList().size;m.set(D,D.getNeighborsList().size),y==1&&f.push(D)}var E=[];for(E=E.concat(f);!x;){var w=[];w=w.concat(E),E=[];for(var _=0;_<b.length;_++){var D=b[_],C=b.indexOf(D);C>=0&&b.splice(C,1);var A=D.getNeighborsList();A.forEach(function(N){if(f.indexOf(N)<0){var P=m.get(N),R=P-1;R==1&&E.push(N),m.set(N,R)}})}f=f.concat(E),(b.length==1||b.length==2)&&(x=!0,T=b[0])}return T},g.prototype.setGraphManager=function(v){this.graphManager=v},n.exports=g},function(n,r,i){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},n.exports=o},function(n,r,i){var o=i(4);function a(s,l){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}a.prototype.getWorldOrgX=function(){return this.lworldOrgX},a.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},a.prototype.getWorldOrgY=function(){return this.lworldOrgY},a.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},a.prototype.getWorldExtX=function(){return this.lworldExtX},a.prototype.setWorldExtX=function(s){this.lworldExtX=s},a.prototype.getWorldExtY=function(){return this.lworldExtY},a.prototype.setWorldExtY=function(s){this.lworldExtY=s},a.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},a.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},a.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},a.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},a.prototype.getDeviceExtX=function(){return this.ldeviceExtX},a.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},a.prototype.getDeviceExtY=function(){return this.ldeviceExtY},a.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},a.prototype.transformX=function(s){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/u),l},a.prototype.transformY=function(s){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/u),l},a.prototype.inverseTransformX=function(s){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/u),l},a.prototype.inverseTransformY=function(s){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/u),l},a.prototype.inverseTransformPoint=function(s){var l=new o(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return l},n.exports=a},function(n,r,i){function o(d){if(Array.isArray(d)){for(var g=0,v=Array(d.length);g<d.length;g++)v[g]=d[g];return v}else return Array.from(d)}var a=i(15),s=i(7),l=i(0),u=i(8),c=i(9);function h(){a.call(this),this.useSmartIdealEdgeLengthCalculation=s.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=s.DEFAULT_EDGE_LENGTH,this.springConstant=s.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=s.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=s.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=s.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*s.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=s.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=s.MAX_ITERATIONS}h.prototype=Object.create(a.prototype);for(var p in a)h[p]=a[p];h.prototype.initParameters=function(){a.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=s.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},h.prototype.calcIdealEdgeLengths=function(){for(var d,g,v,b,f,m,x=this.getGraphManager().getAllEdges(),T=0;T<x.length;T++)d=x[T],d.idealLength=this.idealEdgeLength,d.isInterGraph&&(v=d.getSource(),b=d.getTarget(),f=d.getSourceInLca().getEstimatedSize(),m=d.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(d.idealLength+=f+m-2*l.SIMPLE_NODE_SIZE),g=d.getLca().getInclusionTreeDepth(),d.idealLength+=s.DEFAULT_EDGE_LENGTH*s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+b.getInclusionTreeDepth()-2*g))},h.prototype.initSpringEmbedder=function(){var d=this.getAllNodes().length;this.incremental?(d>s.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(d-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(d>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(d-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},h.prototype.calcSpringForces=function(){for(var d=this.getAllEdges(),g,v=0;v<d.length;v++)g=d[v],this.calcSpringForce(g,g.idealLength)},h.prototype.calcRepulsionForces=function(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v,b,f,m,x=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&d&&this.updateGrid(),T=new Set,v=0;v<x.length;v++)f=x[v],this.calculateRepulsionForceOfANode(f,T,d,g),T.add(f);else for(v=0;v<x.length;v++)for(f=x[v],b=v+1;b<x.length;b++)m=x[b],f.getOwner()==m.getOwner()&&this.calcRepulsionForce(f,m)},h.prototype.calcGravitationalForces=function(){for(var d,g=this.getAllNodesToApplyGravitation(),v=0;v<g.length;v++)d=g[v],this.calcGravitationalForce(d)},h.prototype.moveNodes=function(){for(var d=this.getAllNodes(),g,v=0;v<d.length;v++)g=d[v],g.move()},h.prototype.calcSpringForce=function(d,g){var v=d.getSource(),b=d.getTarget(),f,m,x,T;if(this.uniformLeafNodeSizes&&v.getChild()==null&&b.getChild()==null)d.updateLengthSimple();else if(d.updateLength(),d.isOverlapingSourceAndTarget)return;f=d.getLength(),f!=0&&(m=this.springConstant*(f-g),x=m*(d.lengthX/f),T=m*(d.lengthY/f),v.springForceX+=x,v.springForceY+=T,b.springForceX-=x,b.springForceY-=T)},h.prototype.calcRepulsionForce=function(d,g){var v=d.getRect(),b=g.getRect(),f=new Array(2),m=new Array(4),x,T,_,D,y,E,w;if(v.intersects(b)){u.calcSeparationAmount(v,b,f,s.DEFAULT_EDGE_LENGTH/2),E=2*f[0],w=2*f[1];var C=d.noOfChildren*g.noOfChildren/(d.noOfChildren+g.noOfChildren);d.repulsionForceX-=C*E,d.repulsionForceY-=C*w,g.repulsionForceX+=C*E,g.repulsionForceY+=C*w}else this.uniformLeafNodeSizes&&d.getChild()==null&&g.getChild()==null?(x=b.getCenterX()-v.getCenterX(),T=b.getCenterY()-v.getCenterY()):(u.getIntersection(v,b,m),x=m[2]-m[0],T=m[3]-m[1]),Math.abs(x)<s.MIN_REPULSION_DIST&&(x=c.sign(x)*s.MIN_REPULSION_DIST),Math.abs(T)<s.MIN_REPULSION_DIST&&(T=c.sign(T)*s.MIN_REPULSION_DIST),_=x*x+T*T,D=Math.sqrt(_),y=this.repulsionConstant*d.noOfChildren*g.noOfChildren/_,E=y*x/D,w=y*T/D,d.repulsionForceX-=E,d.repulsionForceY-=w,g.repulsionForceX+=E,g.repulsionForceY+=w},h.prototype.calcGravitationalForce=function(d){var g,v,b,f,m,x,T,_;g=d.getOwner(),v=(g.getRight()+g.getLeft())/2,b=(g.getTop()+g.getBottom())/2,f=d.getCenterX()-v,m=d.getCenterY()-b,x=Math.abs(f)+d.getWidth()/2,T=Math.abs(m)+d.getHeight()/2,d.getOwner()==this.graphManager.getRoot()?(_=g.getEstimatedSize()*this.gravityRangeFactor,(x>_||T>_)&&(d.gravitationForceX=-this.gravityConstant*f,d.gravitationForceY=-this.gravityConstant*m)):(_=g.getEstimatedSize()*this.compoundGravityRangeFactor,(x>_||T>_)&&(d.gravitationForceX=-this.gravityConstant*f*this.compoundGravityConstant,d.gravitationForceY=-this.gravityConstant*m*this.compoundGravityConstant))},h.prototype.isConverged=function(){var d,g=!1;return this.totalIterations>this.maxIterations/3&&(g=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),d=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,d||g},h.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},h.prototype.calcNoOfChildrenForAllNodes=function(){for(var d,g=this.graphManager.getAllNodes(),v=0;v<g.length;v++)d=g[v],d.noOfChildren=d.getNoOfChildren()},h.prototype.calcGrid=function(d){var g=0,v=0;g=parseInt(Math.ceil((d.getRight()-d.getLeft())/this.repulsionRange)),v=parseInt(Math.ceil((d.getBottom()-d.getTop())/this.repulsionRange));for(var b=new Array(g),f=0;f<g;f++)b[f]=new Array(v);for(var f=0;f<g;f++)for(var m=0;m<v;m++)b[f][m]=new Array;return b},h.prototype.addNodeToGrid=function(d,g,v){var b=0,f=0,m=0,x=0;b=parseInt(Math.floor((d.getRect().x-g)/this.repulsionRange)),f=parseInt(Math.floor((d.getRect().width+d.getRect().x-g)/this.repulsionRange)),m=parseInt(Math.floor((d.getRect().y-v)/this.repulsionRange)),x=parseInt(Math.floor((d.getRect().height+d.getRect().y-v)/this.repulsionRange));for(var T=b;T<=f;T++)for(var _=m;_<=x;_++)this.grid[T][_].push(d),d.setGridCoordinates(b,f,m,x)},h.prototype.updateGrid=function(){var d,g,v=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),d=0;d<v.length;d++)g=v[d],this.addNodeToGrid(g,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},h.prototype.calculateRepulsionForceOfANode=function(d,g,v,b){if(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&v||b){var f=new Set;d.surrounding=new Array;for(var m,x=this.grid,T=d.startX-1;T<d.finishX+2;T++)for(var _=d.startY-1;_<d.finishY+2;_++)if(!(T<0||_<0||T>=x.length||_>=x[0].length)){for(var D=0;D<x[T][_].length;D++)if(m=x[T][_][D],!(d.getOwner()!=m.getOwner()||d==m)&&!g.has(m)&&!f.has(m)){var y=Math.abs(d.getCenterX()-m.getCenterX())-(d.getWidth()/2+m.getWidth()/2),E=Math.abs(d.getCenterY()-m.getCenterY())-(d.getHeight()/2+m.getHeight()/2);y<=this.repulsionRange&&E<=this.repulsionRange&&f.add(m)}}d.surrounding=[].concat(o(f))}for(T=0;T<d.surrounding.length;T++)this.calcRepulsionForce(d,d.surrounding[T])},h.prototype.calcRepulsionRange=function(){return 0},n.exports=h},function(n,r,i){var o=i(1),a=i(7);function s(u,c,h){o.call(this,u,c,h),this.idealLength=a.DEFAULT_EDGE_LENGTH}s.prototype=Object.create(o.prototype);for(var l in o)s[l]=o[l];n.exports=s},function(n,r,i){var o=i(3);function a(l,u,c,h){o.call(this,l,u,c,h),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}a.prototype=Object.create(o.prototype);for(var s in o)a[s]=o[s];a.prototype.setGridCoordinates=function(l,u,c,h){this.startX=l,this.finishX=u,this.startY=c,this.finishY=h},n.exports=a},function(n,r,i){function o(a,s){this.width=0,this.height=0,a!==null&&s!==null&&(this.height=s,this.width=a)}o.prototype.getWidth=function(){return this.width},o.prototype.setWidth=function(a){this.width=a},o.prototype.getHeight=function(){return this.height},o.prototype.setHeight=function(a){this.height=a},n.exports=o},function(n,r,i){var o=i(14);function a(){this.map={},this.keys=[]}a.prototype.put=function(s,l){var u=o.createID(s);this.contains(u)||(this.map[u]=l,this.keys.push(s))},a.prototype.contains=function(s){return o.createID(s),this.map[s]!=null},a.prototype.get=function(s){var l=o.createID(s);return this.map[l]},a.prototype.keySet=function(){return this.keys},n.exports=a},function(n,r,i){var o=i(14);function a(){this.set={}}a.prototype.add=function(s){var l=o.createID(s);this.contains(l)||(this.set[l]=s)},a.prototype.remove=function(s){delete this.set[o.createID(s)]},a.prototype.clear=function(){this.set={}},a.prototype.contains=function(s){return this.set[o.createID(s)]==s},a.prototype.isEmpty=function(){return this.size()===0},a.prototype.size=function(){return Object.keys(this.set).length},a.prototype.addAllTo=function(s){for(var l=Object.keys(this.set),u=l.length,c=0;c<u;c++)s.push(this.set[l[c]])},a.prototype.size=function(){return Object.keys(this.set).length},a.prototype.addAll=function(s){for(var l=s.length,u=0;u<l;u++){var c=s[u];this.add(c)}},n.exports=a},function(n,r,i){var o=function(){function u(c,h){for(var p=0;p<h.length;p++){var d=h[p];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(c,d.key,d)}}return function(c,h,p){return h&&u(c.prototype,h),p&&u(c,p),c}}();function a(u,c){if(!(u instanceof c))throw new TypeError("Cannot call a class as a function")}var s=i(11),l=function(){function u(c,h){a(this,u),(h!==null||h!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var p=void 0;c instanceof s?p=c.size():p=c.length,this._quicksort(c,0,p-1)}return o(u,[{key:"_quicksort",value:function(c,h,p){if(h<p){var d=this._partition(c,h,p);this._quicksort(c,h,d),this._quicksort(c,d+1,p)}}},{key:"_partition",value:function(c,h,p){for(var d=this._get(c,h),g=h,v=p;;){for(;this.compareFunction(d,this._get(c,v));)v--;for(;this.compareFunction(this._get(c,g),d);)g++;if(g<v)this._swap(c,g,v),g++,v--;else return v}}},{key:"_get",value:function(c,h){return c instanceof s?c.get_object_at(h):c[h]}},{key:"_set",value:function(c,h,p){c instanceof s?c.set_object_at(h,p):c[h]=p}},{key:"_swap",value:function(c,h,p){var d=this._get(c,h);this._set(c,h,this._get(c,p)),this._set(c,p,d)}},{key:"_defaultCompareFunction",value:function(c,h){return h>c}}]),u}();n.exports=l},function(n,r,i){var o=function(){function l(u,c){for(var h=0;h<c.length;h++){var p=c[h];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}return function(u,c,h){return c&&l(u.prototype,c),h&&l(u,h),u}}();function a(l,u){if(!(l instanceof u))throw new TypeError("Cannot call a class as a function")}var s=function(){function l(u,c){var h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,d=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;a(this,l),this.sequence1=u,this.sequence2=c,this.match_score=h,this.mismatch_penalty=p,this.gap_penalty=d,this.iMax=u.length+1,this.jMax=c.length+1,this.grid=new Array(this.iMax);for(var g=0;g<this.iMax;g++){this.grid[g]=new Array(this.jMax);for(var v=0;v<this.jMax;v++)this.grid[g][v]=0}this.tracebackGrid=new Array(this.iMax);for(var b=0;b<this.iMax;b++){this.tracebackGrid[b]=new Array(this.jMax);for(var f=0;f<this.jMax;f++)this.tracebackGrid[b][f]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return o(l,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var u=1;u<this.jMax;u++)this.grid[0][u]=this.grid[0][u-1]+this.gap_penalty,this.tracebackGrid[0][u]=[!1,!1,!0];for(var c=1;c<this.iMax;c++)this.grid[c][0]=this.grid[c-1][0]+this.gap_penalty,this.tracebackGrid[c][0]=[!1,!0,!1];for(var h=1;h<this.iMax;h++)for(var p=1;p<this.jMax;p++){var d=void 0;this.sequence1[h-1]===this.sequence2[p-1]?d=this.grid[h-1][p-1]+this.match_score:d=this.grid[h-1][p-1]+this.mismatch_penalty;var g=this.grid[h-1][p]+this.gap_penalty,v=this.grid[h][p-1]+this.gap_penalty,b=[d,g,v],f=this.arrayAllMaxIndexes(b);this.grid[h][p]=b[f[0]],this.tracebackGrid[h][p]=[f.includes(0),f.includes(1),f.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var u=[];for(u.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});u[0];){var c=u[0],h=this.tracebackGrid[c.pos[0]][c.pos[1]];h[0]&&u.push({pos:[c.pos[0]-1,c.pos[1]-1],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),h[1]&&u.push({pos:[c.pos[0]-1,c.pos[1]],seq1:this.sequence1[c.pos[0]-1]+c.seq1,seq2:"-"+c.seq2}),h[2]&&u.push({pos:[c.pos[0],c.pos[1]-1],seq1:"-"+c.seq1,seq2:this.sequence2[c.pos[1]-1]+c.seq2}),c.pos[0]===0&&c.pos[1]===0&&this.alignments.push({sequence1:c.seq1,sequence2:c.seq2}),u.shift()}return this.alignments}},{key:"getAllIndexes",value:function(u,c){for(var h=[],p=-1;(p=u.indexOf(c,p+1))!==-1;)h.push(p);return h}},{key:"arrayAllMaxIndexes",value:function(u){return this.getAllIndexes(u,Math.max.apply(null,u))}}]),l}();n.exports=s},function(n,r,i){var o=function(){};o.FDLayout=i(18),o.FDLayoutConstants=i(7),o.FDLayoutEdge=i(19),o.FDLayoutNode=i(20),o.DimensionD=i(21),o.HashMap=i(22),o.HashSet=i(23),o.IGeometry=i(8),o.IMath=i(9),o.Integer=i(10),o.Point=i(12),o.PointD=i(4),o.RandomSeed=i(16),o.RectangleD=i(13),o.Transform=i(17),o.UniqueIDGeneretor=i(14),o.Quicksort=i(24),o.LinkedList=i(11),o.LGraphObject=i(2),o.LGraph=i(5),o.LEdge=i(1),o.LGraphManager=i(6),o.LNode=i(3),o.Layout=i(15),o.LayoutConstants=i(0),o.NeedlemanWunsch=i(25),n.exports=o},function(n,r,i){function o(){this.listeners=[]}var a=o.prototype;a.addListener=function(s,l){this.listeners.push({event:s,callback:l})},a.removeListener=function(s,l){for(var u=this.listeners.length;u>=0;u--){var c=this.listeners[u];c.event===s&&c.callback===l&&this.listeners.splice(u,1)}},a.emit=function(s,l){for(var u=0;u<this.listeners.length;u++){var c=this.listeners[u];s===c.event&&c.callback(l)}},n.exports=o}])})}(Ko)),Ko.exports}var Qo;function x0(){return Qo||(Qo=1,function(e,t){(function(n,r){e.exports=r(b0())})(Xt,function(n){return function(r){var i={};function o(a){if(i[a])return i[a].exports;var s=i[a]={i:a,l:!1,exports:{}};return r[a].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=r,o.c=i,o.i=function(a){return a},o.d=function(a,s,l){o.o(a,s)||Object.defineProperty(a,s,{configurable:!1,enumerable:!0,get:l})},o.n=function(a){var s=a&&a.__esModule?function(){return a.default}:function(){return a};return o.d(s,"a",s),s},o.o=function(a,s){return Object.prototype.hasOwnProperty.call(a,s)},o.p="",o(o.s=7)}([function(r,i){r.exports=n},function(r,i,o){var a=o(0).FDLayoutConstants;function s(){}for(var l in a)s[l]=a[l];s.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,s.DEFAULT_RADIAL_SEPARATION=a.DEFAULT_EDGE_LENGTH,s.DEFAULT_COMPONENT_SEPERATION=60,s.TILE=!0,s.TILING_PADDING_VERTICAL=10,s.TILING_PADDING_HORIZONTAL=10,s.TREE_REDUCTION_ON_INCREMENTAL=!1,r.exports=s},function(r,i,o){var a=o(0).FDLayoutEdge;function s(u,c,h){a.call(this,u,c,h)}s.prototype=Object.create(a.prototype);for(var l in a)s[l]=a[l];r.exports=s},function(r,i,o){var a=o(0).LGraph;function s(u,c,h){a.call(this,u,c,h)}s.prototype=Object.create(a.prototype);for(var l in a)s[l]=a[l];r.exports=s},function(r,i,o){var a=o(0).LGraphManager;function s(u){a.call(this,u)}s.prototype=Object.create(a.prototype);for(var l in a)s[l]=a[l];r.exports=s},function(r,i,o){var a=o(0).FDLayoutNode,s=o(0).IMath;function l(c,h,p,d){a.call(this,c,h,p,d)}l.prototype=Object.create(a.prototype);for(var u in a)l[u]=a[u];l.prototype.move=function(){var c=this.graphManager.getLayout();this.displacementX=c.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=c.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementX=c.coolingFactor*c.maxNodeDisplacement*s.sign(this.displacementX)),Math.abs(this.displacementY)>c.coolingFactor*c.maxNodeDisplacement&&(this.displacementY=c.coolingFactor*c.maxNodeDisplacement*s.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),c.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},l.prototype.propogateDisplacementToChildren=function(c,h){for(var p=this.getChild().getNodes(),d,g=0;g<p.length;g++)d=p[g],d.getChild()==null?(d.moveBy(c,h),d.displacementX+=c,d.displacementY+=h):d.propogateDisplacementToChildren(c,h)},l.prototype.setPred1=function(c){this.pred1=c},l.prototype.getPred1=function(){return pred1},l.prototype.getPred2=function(){return pred2},l.prototype.setNext=function(c){this.next=c},l.prototype.getNext=function(){return next},l.prototype.setProcessed=function(c){this.processed=c},l.prototype.isProcessed=function(){return processed},r.exports=l},function(r,i,o){var a=o(0).FDLayout,s=o(4),l=o(3),u=o(5),c=o(2),h=o(1),p=o(0).FDLayoutConstants,d=o(0).LayoutConstants,g=o(0).Point,v=o(0).PointD,b=o(0).Layout,f=o(0).Integer,m=o(0).IGeometry,x=o(0).LGraph,T=o(0).Transform;function _(){a.call(this),this.toBeTiled={}}_.prototype=Object.create(a.prototype);for(var D in a)_[D]=a[D];_.prototype.newGraphManager=function(){var y=new s(this);return this.graphManager=y,y},_.prototype.newGraph=function(y){return new l(null,this.graphManager,y)},_.prototype.newNode=function(y){return new u(this.graphManager,y)},_.prototype.newEdge=function(y){return new c(null,null,y)},_.prototype.initParameters=function(){a.prototype.initParameters.call(this,arguments),this.isSubLayout||(h.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=h.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=p.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=p.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=p.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=p.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=p.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=p.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/p.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=p.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},_.prototype.layout=function(){var y=d.DEFAULT_CREATE_BENDS_AS_NEEDED;return y&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},_.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(h.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var y=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(C){return y.has(C)});this.graphManager.setAllNodesToApplyGravitation(E)}}else{var w=this.getFlatForest();if(w.length>0)this.positionNodesRadially(w);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var y=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(k){return y.has(k)});this.graphManager.setAllNodesToApplyGravitation(E),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},_.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%p.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var y=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(A){return y.has(A)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=p.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=p.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var w=!this.isTreeGrowing&&!this.isGrowthFinished,C=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(w,C),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},_.prototype.getPositionsData=function(){for(var y=this.graphManager.getAllNodes(),E={},w=0;w<y.length;w++){var C=y[w].rect,A=y[w].id;E[A]={id:A,x:C.getCenterX(),y:C.getCenterY(),w:C.width,h:C.height}}return E},_.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var y=!1;if(p.ANIMATE==="during")this.emit("layoutstarted");else{for(;!y;)y=this.tick();this.graphManager.updateBounds()}},_.prototype.calculateNodesToApplyGravitationTo=function(){var y=[],E,w=this.graphManager.getGraphs(),C=w.length,A;for(A=0;A<C;A++)E=w[A],E.updateConnected(),E.isConnected||(y=y.concat(E.getNodes()));return y},_.prototype.createBendpoints=function(){var y=[];y=y.concat(this.graphManager.getAllEdges());var E=new Set,w;for(w=0;w<y.length;w++){var C=y[w];if(!E.has(C)){var A=C.getSource(),k=C.getTarget();if(A==k)C.getBendpoints().push(new v),C.getBendpoints().push(new v),this.createDummyNodesForBendpoints(C),E.add(C);else{var S=[];if(S=S.concat(A.getEdgeListToNode(k)),S=S.concat(k.getEdgeListToNode(A)),!E.has(S[0])){if(S.length>1){var N;for(N=0;N<S.length;N++){var P=S[N];P.getBendpoints().push(new v),this.createDummyNodesForBendpoints(P)}}S.forEach(function(R){E.add(R)})}}}if(E.size==y.length)break}},_.prototype.positionNodesRadially=function(y){for(var E=new g(0,0),w=Math.ceil(Math.sqrt(y.length)),C=0,A=0,k=0,S=new v(0,0),N=0;N<y.length;N++){N%w==0&&(k=0,A=C,N!=0&&(A+=h.DEFAULT_COMPONENT_SEPERATION),C=0);var P=y[N],R=b.findCenterOfTree(P);E.x=k,E.y=A,S=_.radialLayout(P,R,E),S.y>C&&(C=Math.floor(S.y)),k=Math.floor(S.x+h.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(d.WORLD_CENTER_X-S.x/2,d.WORLD_CENTER_Y-S.y/2))},_.radialLayout=function(y,E,w){var C=Math.max(this.maxDiagonalInTree(y),h.DEFAULT_RADIAL_SEPARATION);_.branchRadialLayout(E,null,0,359,0,C);var A=x.calculateBounds(y),k=new T;k.setDeviceOrgX(A.getMinX()),k.setDeviceOrgY(A.getMinY()),k.setWorldOrgX(w.x),k.setWorldOrgY(w.y);for(var S=0;S<y.length;S++){var N=y[S];N.transform(k)}var P=new v(A.getMaxX(),A.getMaxY());return k.inverseTransformPoint(P)},_.branchRadialLayout=function(y,E,w,C,A,k){var S=(C-w+1)/2;S<0&&(S+=180);var N=(S+w)%360,P=N*m.TWO_PI/360,R=A*Math.cos(P),I=A*Math.sin(P);y.setCenter(R,I);var O=[];O=O.concat(y.getEdges());var M=O.length;E!=null&&M--;for(var G=0,B=O.length,V,F=y.getEdgesBetween(E);F.length>1;){var U=F[0];F.splice(0,1);var Q=O.indexOf(U);Q>=0&&O.splice(Q,1),B--,M--}E!=null?V=(O.indexOf(F[0])+1)%B:V=0;for(var z=Math.abs(C-w)/M,q=V;G!=M;q=++q%B){var H=O[q].getOtherEnd(y);if(H!=E){var $=(w+G*z)%360,Z=($+z)%360;_.branchRadialLayout(H,y,$,Z,A+k,k),G++}}},_.maxDiagonalInTree=function(y){for(var E=f.MIN_VALUE,w=0;w<y.length;w++){var C=y[w],A=C.getDiagonal();A>E&&(E=A)}return E},_.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},_.prototype.groupZeroDegreeMembers=function(){var y=this,E={};this.memberGroups={},this.idToDummyNode={};for(var w=[],C=this.graphManager.getAllNodes(),A=0;A<C.length;A++){var k=C[A],S=k.getParent();this.getNodeDegreeWithChildren(k)===0&&(S.id==null||!this.getToBeTiled(S))&&w.push(k)}for(var A=0;A<w.length;A++){var k=w[A],N=k.getParent().id;typeof E[N]>"u"&&(E[N]=[]),E[N]=E[N].concat(k)}Object.keys(E).forEach(function(P){if(E[P].length>1){var R="DummyCompound_"+P;y.memberGroups[R]=E[P];var I=E[P][0].getParent(),O=new u(y.graphManager);O.id=R,O.paddingLeft=I.paddingLeft||0,O.paddingRight=I.paddingRight||0,O.paddingBottom=I.paddingBottom||0,O.paddingTop=I.paddingTop||0,y.idToDummyNode[R]=O;var M=y.getGraphManager().add(y.newGraph(),O),G=I.getChild();G.add(O);for(var B=0;B<E[P].length;B++){var V=E[P][B];G.remove(V),M.add(V)}}})},_.prototype.clearCompounds=function(){var y={},E={};this.performDFSOnCompounds();for(var w=0;w<this.compoundOrder.length;w++)E[this.compoundOrder[w].id]=this.compoundOrder[w],y[this.compoundOrder[w].id]=[].concat(this.compoundOrder[w].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[w].getChild()),this.compoundOrder[w].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(y,E)},_.prototype.clearZeroDegreeMembers=function(){var y=this,E=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(w){var C=y.idToDummyNode[w];E[w]=y.tileNodes(y.memberGroups[w],C.paddingLeft+C.paddingRight),C.rect.width=E[w].width,C.rect.height=E[w].height})},_.prototype.repopulateCompounds=function(){for(var y=this.compoundOrder.length-1;y>=0;y--){var E=this.compoundOrder[y],w=E.id,C=E.paddingLeft,A=E.paddingTop;this.adjustLocations(this.tiledMemberPack[w],E.rect.x,E.rect.y,C,A)}},_.prototype.repopulateZeroDegreeMembers=function(){var y=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(w){var C=y.idToDummyNode[w],A=C.paddingLeft,k=C.paddingTop;y.adjustLocations(E[w],C.rect.x,C.rect.y,A,k)})},_.prototype.getToBeTiled=function(y){var E=y.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var w=y.getChild();if(w==null)return this.toBeTiled[E]=!1,!1;for(var C=w.getNodes(),A=0;A<C.length;A++){var k=C[A];if(this.getNodeDegree(k)>0)return this.toBeTiled[E]=!1,!1;if(k.getChild()==null){this.toBeTiled[k.id]=!1;continue}if(!this.getToBeTiled(k))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},_.prototype.getNodeDegree=function(y){y.id;for(var E=y.getEdges(),w=0,C=0;C<E.length;C++){var A=E[C];A.getSource().id!==A.getTarget().id&&(w=w+1)}return w},_.prototype.getNodeDegreeWithChildren=function(y){var E=this.getNodeDegree(y);if(y.getChild()==null)return E;for(var w=y.getChild().getNodes(),C=0;C<w.length;C++){var A=w[C];E+=this.getNodeDegreeWithChildren(A)}return E},_.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},_.prototype.fillCompexOrderByDFS=function(y){for(var E=0;E<y.length;E++){var w=y[E];w.getChild()!=null&&this.fillCompexOrderByDFS(w.getChild().getNodes()),this.getToBeTiled(w)&&this.compoundOrder.push(w)}},_.prototype.adjustLocations=function(y,E,w,C,A){E+=C,w+=A;for(var k=E,S=0;S<y.rows.length;S++){var N=y.rows[S];E=k;for(var P=0,R=0;R<N.length;R++){var I=N[R];I.rect.x=E,I.rect.y=w,E+=I.rect.width+y.horizontalPadding,I.rect.height>P&&(P=I.rect.height)}w+=P+y.verticalPadding}},_.prototype.tileCompoundMembers=function(y,E){var w=this;this.tiledMemberPack=[],Object.keys(y).forEach(function(C){var A=E[C];w.tiledMemberPack[C]=w.tileNodes(y[C],A.paddingLeft+A.paddingRight),A.rect.width=w.tiledMemberPack[C].width,A.rect.height=w.tiledMemberPack[C].height})},_.prototype.tileNodes=function(y,E){var w=h.TILING_PADDING_VERTICAL,C=h.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:w,horizontalPadding:C};y.sort(function(N,P){return N.rect.width*N.rect.height>P.rect.width*P.rect.height?-1:N.rect.width*N.rect.height<P.rect.width*P.rect.height?1:0});for(var k=0;k<y.length;k++){var S=y[k];A.rows.length==0?this.insertNodeToRow(A,S,0,E):this.canAddHorizontal(A,S.rect.width,S.rect.height)?this.insertNodeToRow(A,S,this.getShortestRowIndex(A),E):this.insertNodeToRow(A,S,A.rows.length,E),this.shiftToLastRow(A)}return A},_.prototype.insertNodeToRow=function(y,E,w,C){var A=C;if(w==y.rows.length){var k=[];y.rows.push(k),y.rowWidth.push(A),y.rowHeight.push(0)}var S=y.rowWidth[w]+E.rect.width;y.rows[w].length>0&&(S+=y.horizontalPadding),y.rowWidth[w]=S,y.width<S&&(y.width=S);var N=E.rect.height;w>0&&(N+=y.verticalPadding);var P=0;N>y.rowHeight[w]&&(P=y.rowHeight[w],y.rowHeight[w]=N,P=y.rowHeight[w]-P),y.height+=P,y.rows[w].push(E)},_.prototype.getShortestRowIndex=function(y){for(var E=-1,w=Number.MAX_VALUE,C=0;C<y.rows.length;C++)y.rowWidth[C]<w&&(E=C,w=y.rowWidth[C]);return E},_.prototype.getLongestRowIndex=function(y){for(var E=-1,w=Number.MIN_VALUE,C=0;C<y.rows.length;C++)y.rowWidth[C]>w&&(E=C,w=y.rowWidth[C]);return E},_.prototype.canAddHorizontal=function(y,E,w){var C=this.getShortestRowIndex(y);if(C<0)return!0;var A=y.rowWidth[C];if(A+y.horizontalPadding+E<=y.width)return!0;var k=0;y.rowHeight[C]<w&&C>0&&(k=w+y.verticalPadding-y.rowHeight[C]);var S;y.width-A>=E+y.horizontalPadding?S=(y.height+k)/(A+E+y.horizontalPadding):S=(y.height+k)/y.width,k=w+y.verticalPadding;var N;return y.width<E?N=(y.height+k)/E:N=(y.height+k)/y.width,N<1&&(N=1/N),S<1&&(S=1/S),S<N},_.prototype.shiftToLastRow=function(y){var E=this.getLongestRowIndex(y),w=y.rowWidth.length-1,C=y.rows[E],A=C[C.length-1],k=A.width+y.horizontalPadding;if(y.width-y.rowWidth[w]>k&&E!=w){C.splice(-1,1),y.rows[w].push(A),y.rowWidth[E]=y.rowWidth[E]-k,y.rowWidth[w]=y.rowWidth[w]+k,y.width=y.rowWidth[instance.getLongestRowIndex(y)];for(var S=Number.MIN_VALUE,N=0;N<C.length;N++)C[N].height>S&&(S=C[N].height);E>0&&(S+=y.verticalPadding);var P=y.rowHeight[E]+y.rowHeight[w];y.rowHeight[E]=S,y.rowHeight[w]<A.height+y.verticalPadding&&(y.rowHeight[w]=A.height+y.verticalPadding);var R=y.rowHeight[E]+y.rowHeight[w];y.height+=R-P,this.shiftToLastRow(y)}},_.prototype.tilingPreLayout=function(){h.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},_.prototype.tilingPostLayout=function(){h.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},_.prototype.reduceTrees=function(){for(var y=[],E=!0,w;E;){var C=this.graphManager.getAllNodes(),A=[];E=!1;for(var k=0;k<C.length;k++)w=C[k],w.getEdges().length==1&&!w.getEdges()[0].isInterGraph&&w.getChild()==null&&(A.push([w,w.getEdges()[0],w.getOwner()]),E=!0);if(E==!0){for(var S=[],N=0;N<A.length;N++)A[N][0].getEdges().length==1&&(S.push(A[N]),A[N][0].getOwner().remove(A[N][0]));y.push(S),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=y},_.prototype.growTree=function(y){for(var E=y.length,w=y[E-1],C,A=0;A<w.length;A++)C=w[A],this.findPlaceforPrunedNode(C),C[2].add(C[0]),C[2].add(C[1],C[1].source,C[1].target);y.splice(y.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},_.prototype.findPlaceforPrunedNode=function(y){var E,w,C=y[0];C==y[1].source?w=y[1].target:w=y[1].source;var A=w.startX,k=w.finishX,S=w.startY,N=w.finishY,P=0,R=0,I=0,O=0,M=[P,I,R,O];if(S>0)for(var G=A;G<=k;G++)M[0]+=this.grid[G][S-1].length+this.grid[G][S].length-1;if(k<this.grid.length-1)for(var G=S;G<=N;G++)M[1]+=this.grid[k+1][G].length+this.grid[k][G].length-1;if(N<this.grid[0].length-1)for(var G=A;G<=k;G++)M[2]+=this.grid[G][N+1].length+this.grid[G][N].length-1;if(A>0)for(var G=S;G<=N;G++)M[3]+=this.grid[A-1][G].length+this.grid[A][G].length-1;for(var B=f.MAX_VALUE,V,F,U=0;U<M.length;U++)M[U]<B?(B=M[U],V=1,F=U):M[U]==B&&V++;if(V==3&&B==0)M[0]==0&&M[1]==0&&M[2]==0?E=1:M[0]==0&&M[1]==0&&M[3]==0?E=0:M[0]==0&&M[2]==0&&M[3]==0?E=3:M[1]==0&&M[2]==0&&M[3]==0&&(E=2);else if(V==2&&B==0){var Q=Math.floor(Math.random()*2);M[0]==0&&M[1]==0?Q==0?E=0:E=1:M[0]==0&&M[2]==0?Q==0?E=0:E=2:M[0]==0&&M[3]==0?Q==0?E=0:E=3:M[1]==0&&M[2]==0?Q==0?E=1:E=2:M[1]==0&&M[3]==0?Q==0?E=1:E=3:Q==0?E=2:E=3}else if(V==4&&B==0){var Q=Math.floor(Math.random()*4);E=Q}else E=F;E==0?C.setCenter(w.getCenterX(),w.getCenterY()-w.getHeight()/2-p.DEFAULT_EDGE_LENGTH-C.getHeight()/2):E==1?C.setCenter(w.getCenterX()+w.getWidth()/2+p.DEFAULT_EDGE_LENGTH+C.getWidth()/2,w.getCenterY()):E==2?C.setCenter(w.getCenterX(),w.getCenterY()+w.getHeight()/2+p.DEFAULT_EDGE_LENGTH+C.getHeight()/2):C.setCenter(w.getCenterX()-w.getWidth()/2-p.DEFAULT_EDGE_LENGTH-C.getWidth()/2,w.getCenterY())},r.exports=_},function(r,i,o){var a={};a.layoutBase=o(0),a.CoSEConstants=o(1),a.CoSEEdge=o(2),a.CoSEGraph=o(3),a.CoSEGraphManager=o(4),a.CoSELayout=o(6),a.CoSENode=o(5),r.exports=a}])})}($o)),$o.exports}(function(e,t){(function(n,r){e.exports=r(x0())})(Xt,function(n){return function(r){var i={};function o(a){if(i[a])return i[a].exports;var s=i[a]={i:a,l:!1,exports:{}};return r[a].call(s.exports,s,s.exports,o),s.l=!0,s.exports}return o.m=r,o.c=i,o.i=function(a){return a},o.d=function(a,s,l){o.o(a,s)||Object.defineProperty(a,s,{configurable:!1,enumerable:!0,get:l})},o.n=function(a){var s=a&&a.__esModule?function(){return a.default}:function(){return a};return o.d(s,"a",s),s},o.o=function(a,s){return Object.prototype.hasOwnProperty.call(a,s)},o.p="",o(o.s=1)}([function(r,i){r.exports=n},function(r,i,o){var a=o(0).layoutBase.LayoutConstants,s=o(0).layoutBase.FDLayoutConstants,l=o(0).CoSEConstants,u=o(0).CoSELayout,c=o(0).CoSENode,h=o(0).layoutBase.PointD,p=o(0).layoutBase.DimensionD,d={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function g(m,x){var T={};for(var _ in m)T[_]=m[_];for(var _ in x)T[_]=x[_];return T}function v(m){this.options=g(d,m),b(this.options)}var b=function(m){m.nodeRepulsion!=null&&(l.DEFAULT_REPULSION_STRENGTH=s.DEFAULT_REPULSION_STRENGTH=m.nodeRepulsion),m.idealEdgeLength!=null&&(l.DEFAULT_EDGE_LENGTH=s.DEFAULT_EDGE_LENGTH=m.idealEdgeLength),m.edgeElasticity!=null&&(l.DEFAULT_SPRING_STRENGTH=s.DEFAULT_SPRING_STRENGTH=m.edgeElasticity),m.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=m.nestingFactor),m.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=s.DEFAULT_GRAVITY_STRENGTH=m.gravity),m.numIter!=null&&(l.MAX_ITERATIONS=s.MAX_ITERATIONS=m.numIter),m.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=s.DEFAULT_GRAVITY_RANGE_FACTOR=m.gravityRange),m.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=m.gravityCompound),m.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=m.gravityRangeCompound),m.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=s.DEFAULT_COOLING_FACTOR_INCREMENTAL=m.initialEnergyOnIncremental),m.quality=="draft"?a.QUALITY=0:m.quality=="proof"?a.QUALITY=2:a.QUALITY=1,l.NODE_DIMENSIONS_INCLUDE_LABELS=s.NODE_DIMENSIONS_INCLUDE_LABELS=a.NODE_DIMENSIONS_INCLUDE_LABELS=m.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=s.DEFAULT_INCREMENTAL=a.DEFAULT_INCREMENTAL=!m.randomize,l.ANIMATE=s.ANIMATE=a.ANIMATE=m.animate,l.TILE=m.tile,l.TILING_PADDING_VERTICAL=typeof m.tilingPaddingVertical=="function"?m.tilingPaddingVertical.call():m.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof m.tilingPaddingHorizontal=="function"?m.tilingPaddingHorizontal.call():m.tilingPaddingHorizontal};v.prototype.run=function(){var m,x,T=this.options;this.idToLNode={};var _=this.layout=new u,D=this;D.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var y=_.newGraphManager();this.gm=y;var E=this.options.eles.nodes(),w=this.options.eles.edges();this.root=y.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(E),_);for(var C=0;C<w.length;C++){var A=w[C],k=this.idToLNode[A.data("source")],S=this.idToLNode[A.data("target")];if(k!==S&&k.getEdgesBetween(S).length==0){var N=y.add(_.newEdge(),k,S);N.id=A.id()}}var P=function(I,O){typeof I=="number"&&(I=O);var M=I.data("id"),G=D.idToLNode[M];return{x:G.getRect().getCenterX(),y:G.getRect().getCenterY()}},R=function I(){for(var O=function(){T.fit&&T.cy.fit(T.eles,T.padding),m||(m=!0,D.cy.one("layoutready",T.ready),D.cy.trigger({type:"layoutready",layout:D}))},M=D.options.refresh,G,B=0;B<M&&!G;B++)G=D.stopped||D.layout.tick();if(G){_.checkLayoutSuccess()&&!_.isSubLayout&&_.doPostLayout(),_.tilingPostLayout&&_.tilingPostLayout(),_.isLayoutFinished=!0,D.options.eles.nodes().positions(P),O(),D.cy.one("layoutstop",D.options.stop),D.cy.trigger({type:"layoutstop",layout:D}),x&&cancelAnimationFrame(x),m=!1;return}var V=D.layout.getPositionsData();T.eles.nodes().positions(function(F,U){if(typeof F=="number"&&(F=U),!F.isParent()){for(var Q=F.id(),z=V[Q],q=F;z==null&&(z=V[q.data("parent")]||V["DummyCompound_"+q.data("parent")],V[Q]=z,q=q.parent()[0],q!=null););return z!=null?{x:z.x,y:z.y}:{x:F.position("x"),y:F.position("y")}}}),O(),x=requestAnimationFrame(I)};return _.addListener("layoutstarted",function(){D.options.animate==="during"&&(x=requestAnimationFrame(R))}),_.runLayout(),this.options.animate!=="during"&&(D.options.eles.nodes().not(":parent").layoutPositions(D,D.options,P),m=!1),this},v.prototype.getTopMostNodes=function(m){for(var x={},T=0;T<m.length;T++)x[m[T].id()]=!0;var _=m.filter(function(D,y){typeof D=="number"&&(D=y);for(var E=D.parent()[0];E!=null;){if(x[E.id()])return!1;E=E.parent()[0]}return!0});return _},v.prototype.processChildrenList=function(m,x,T){for(var _=x.length,D=0;D<_;D++){var y=x[D],E=y.children(),w,C=y.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(y.outerWidth()!=null&&y.outerHeight()!=null?w=m.add(new c(T.graphManager,new h(y.position("x")-C.w/2,y.position("y")-C.h/2),new p(parseFloat(C.w),parseFloat(C.h)))):w=m.add(new c(this.graphManager)),w.id=y.data("id"),w.paddingLeft=parseInt(y.css("padding")),w.paddingTop=parseInt(y.css("padding")),w.paddingRight=parseInt(y.css("padding")),w.paddingBottom=parseInt(y.css("padding")),this.options.nodeDimensionsIncludeLabels&&y.isParent()){var A=y.boundingBox({includeLabels:!0,includeNodes:!1}).w,k=y.boundingBox({includeLabels:!0,includeNodes:!1}).h,S=y.css("text-halign");w.labelWidth=A,w.labelHeight=k,w.labelPos=S}if(this.idToLNode[y.data("id")]=w,isNaN(w.rect.x)&&(w.rect.x=0),isNaN(w.rect.y)&&(w.rect.y=0),E!=null&&E.length>0){var N;N=T.getGraphManager().add(T.newGraph(),w),this.processChildrenList(N,E,T)}}},v.prototype.stop=function(){return this.stopped=!0,this};var f=function(m){m("layout","cose-bilkent",v)};typeof cytoscape<"u"&&f(cytoscape),r.exports=f}])})})(Al);var w0=Al.exports;const E0=Jo(w0);var ta=function(){var e=function(T,_,D,y){for(D=D||{},y=T.length;y--;D[T[y]]=_);return D},t=[1,4],n=[1,13],r=[1,12],i=[1,15],o=[1,16],a=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],h=[1,25],p=[6,7,11],d=[1,6,13,15,16,19,22],g=[1,33],v=[1,34],b=[1,6,7,11,13,15,16,19,22],f={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(T,_,D,y,E,w,C){var A=w.length-1;switch(E){case 6:case 7:return y;case 8:y.getLogger().trace("Stop NL ");break;case 9:y.getLogger().trace("Stop EOF ");break;case 11:y.getLogger().trace("Stop NL2 ");break;case 12:y.getLogger().trace("Stop EOF2 ");break;case 15:y.getLogger().info("Node: ",w[A].id),y.addNode(w[A-1].length,w[A].id,w[A].descr,w[A].type);break;case 16:y.getLogger().trace("Icon: ",w[A]),y.decorateNode({icon:w[A]});break;case 17:case 21:y.decorateNode({class:w[A]});break;case 18:y.getLogger().trace("SPACELIST");break;case 19:y.getLogger().trace("Node: ",w[A].id),y.addNode(0,w[A].id,w[A].descr,w[A].type);break;case 20:y.decorateNode({icon:w[A]});break;case 25:y.getLogger().trace("node found ..",w[A-2]),this.$={id:w[A-1],descr:w[A-1],type:y.getType(w[A-2],w[A])};break;case 26:this.$={id:w[A],descr:w[A],type:y.nodeType.DEFAULT};break;case 27:y.getLogger().trace("node found ..",w[A-3]),this.$={id:w[A-3],descr:w[A-1],type:y.getType(w[A-2],w[A])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:o,17:17,18:18,19:a,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:o,17:17,18:18,19:a,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:o,17:17,18:18,19:a,22:s},{6:u,7:c,10:23,11:h},e(p,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:a,22:s}),e(p,[2,18]),e(p,[2,19]),e(p,[2,20]),e(p,[2,21]),e(p,[2,23]),e(p,[2,24]),e(p,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:h},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:o,17:17,18:18,19:a,22:s},e(d,[2,14],{7:g,11:v}),e(b,[2,8]),e(b,[2,9]),e(b,[2,10]),e(p,[2,15]),e(p,[2,16]),e(p,[2,17]),{20:[1,35]},{21:[1,36]},e(d,[2,13],{7:g,11:v}),e(b,[2,11]),e(b,[2,12]),{21:[1,37]},e(p,[2,25]),e(p,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(T,_){if(_.recoverable)this.trace(T);else{var D=new Error(T);throw D.hash=_,D}},parse:function(T){var _=this,D=[0],y=[],E=[null],w=[],C=this.table,A="",k=0,S=0,N=2,P=1,R=w.slice.call(arguments,1),I=Object.create(this.lexer),O={yy:{}};for(var M in this.yy)Object.prototype.hasOwnProperty.call(this.yy,M)&&(O.yy[M]=this.yy[M]);I.setInput(T,O.yy),O.yy.lexer=I,O.yy.parser=this,typeof I.yylloc>"u"&&(I.yylloc={});var G=I.yylloc;w.push(G);var B=I.options&&I.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function V(){var ue;return ue=y.pop()||I.lex()||P,typeof ue!="number"&&(ue instanceof Array&&(y=ue,ue=y.pop()),ue=_.symbols_[ue]||ue),ue}for(var F,U,Q,z,q={},H,$,Z,te;;){if(U=D[D.length-1],this.defaultActions[U]?Q=this.defaultActions[U]:((F===null||typeof F>"u")&&(F=V()),Q=C[U]&&C[U][F]),typeof Q>"u"||!Q.length||!Q[0]){var pe="";te=[];for(H in C[U])this.terminals_[H]&&H>N&&te.push("'"+this.terminals_[H]+"'");I.showPosition?pe="Parse error on line "+(k+1)+":\n"+I.showPosition()+"\nExpecting "+te.join(", ")+", got '"+(this.terminals_[F]||F)+"'":pe="Parse error on line "+(k+1)+": Unexpected "+(F==P?"end of input":"'"+(this.terminals_[F]||F)+"'"),this.parseError(pe,{text:I.match,token:this.terminals_[F]||F,line:I.yylineno,loc:G,expected:te})}if(Q[0]instanceof Array&&Q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+F);switch(Q[0]){case 1:D.push(F),E.push(I.yytext),w.push(I.yylloc),D.push(Q[1]),F=null,S=I.yyleng,A=I.yytext,k=I.yylineno,G=I.yylloc;break;case 2:if($=this.productions_[Q[1]][1],q.$=E[E.length-$],q._$={first_line:w[w.length-($||1)].first_line,last_line:w[w.length-1].last_line,first_column:w[w.length-($||1)].first_column,last_column:w[w.length-1].last_column},B&&(q._$.range=[w[w.length-($||1)].range[0],w[w.length-1].range[1]]),z=this.performAction.apply(q,[A,S,k,O.yy,Q[1],E,w].concat(R)),typeof z<"u")return z;$&&(D=D.slice(0,-1*$*2),E=E.slice(0,-1*$),w=w.slice(0,-1*$)),D.push(this.productions_[Q[1]][0]),E.push(q.$),w.push(q._$),Z=C[D[D.length-2]][D[D.length-1]],D.push(Z);break;case 3:return!0}}return!0}},m=function(){var T={EOF:1,parseError:function(_,D){if(this.yy.parser)this.yy.parser.parseError(_,D);else throw new Error(_)},setInput:function(_,D){return this.yy=D||this.yy||{},this._input=_,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var _=this._input[0];this.yytext+=_,this.yyleng++,this.offset++,this.match+=_,this.matched+=_;var D=_.match(/(?:\r\n?|\n).*/g);return D?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),_},unput:function(_){var D=_.length,y=_.split(/(?:\r\n?|\n)/g);this._input=_+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-D),this.offset-=D;var E=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),y.length-1&&(this.yylineno-=y.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:y?(y.length===E.length?this.yylloc.first_column:0)+E[E.length-y.length].length-y[0].length:this.yylloc.first_column-D},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-D]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(_){this.unput(this.match.slice(_))},pastInput:function(){var _=this.matched.substr(0,this.matched.length-this.match.length);return(_.length>20?"...":"")+_.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var _=this.match;return _.length<20&&(_+=this._input.substr(0,20-_.length)),(_.substr(0,20)+(_.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var _=this.pastInput(),D=new Array(_.length+1).join("-");return _+this.upcomingInput()+"\n"+D+"^"},test_match:function(_,D){var y,E,w;if(this.options.backtrack_lexer&&(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(w.yylloc.range=this.yylloc.range.slice(0))),E=_[0].match(/(?:\r\n?|\n).*/g),E&&(this.yylineno+=E.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:E?E[E.length-1].length-E[E.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+_[0].length},this.yytext+=_[0],this.match+=_[0],this.matches=_,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(_[0].length),this.matched+=_[0],y=this.performAction.call(this,this.yy,this,D,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),y)return y;if(this._backtrack){for(var C in w)this[C]=w[C];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var _,D,y,E;this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),C=0;C<w.length;C++)if(y=this._input.match(this.rules[w[C]]),y&&(!D||y[0].length>D[0].length)){if(D=y,E=C,this.options.backtrack_lexer){if(_=this.test_match(y,w[C]),_!==!1)return _;if(this._backtrack){D=!1;continue}else return!1}else if(!this.options.flex)break}return D?(_=this.test_match(D,w[E]),_!==!1?_:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var _=this.next();return _||this.lex()},begin:function(_){this.conditionStack.push(_)},popState:function(){var _=this.conditionStack.length-1;return _>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(_){return _=this.conditionStack.length-1-Math.abs(_||0),_>=0?this.conditionStack[_]:"INITIAL"},pushState:function(_){this.begin(_)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(_,D,y,E){switch(y){case 0:return _.getLogger().trace("Found comment",D.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:_.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return _.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:_.getLogger().trace("end icon"),this.popState();break;case 10:return _.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return _.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return _.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return _.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:_.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return _.getLogger().trace("description:",D.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),_.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),_.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),_.getLogger().trace("node end ...",D.yytext),"NODE_DEND";case 30:return this.popState(),_.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),_.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),_.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),_.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),_.getLogger().trace("node end (("),"NODE_DEND";case 35:return _.getLogger().trace("Long description:",D.yytext),20;case 36:return _.getLogger().trace("Long description:",D.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();f.lexer=m;function x(){this.yy={}}return x.prototype=f,f.Parser=x,new x}();ta.parser=ta;const _0=ta;let _t=[],kl=0,ba={};const T0=()=>{_t=[],kl=0,ba={}},D0=function(e){for(let t=_t.length-1;t>=0;t--)if(_t[t].level<e)return _t[t];return null},C0=()=>_t.length>0?_t[0]:null,A0=(e,t,n,r)=>{var c,h;var i,o;hn.info("addNode",e,t,n,r);const a=na();let s=(c=(i=a.mindmap)==null?void 0:i.padding)!=null?c:Kr.mindmap.padding;switch(r){case Ge.ROUNDED_RECT:case Ge.RECT:case Ge.HEXAGON:s*=2}const l={id:kl++,nodeId:Zr(t,a),level:e,descr:Zr(n,a),type:r,children:[],width:(h=(o=a.mindmap)==null?void 0:o.maxNodeWidth)!=null?h:Kr.mindmap.maxNodeWidth,padding:s},u=D0(e);if(u)u.children.push(l),_t.push(l);else if(_t.length===0)_t.push(l);else throw new Error('There can be only one root. No parent could be found for ("'+l.descr+'")')},Ge={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},k0=(e,t)=>{switch(hn.debug("In get type",e,t),e){case"[":return Ge.RECT;case"(":return t===")"?Ge.ROUNDED_RECT:Ge.CLOUD;case"((":return Ge.CIRCLE;case")":return Ge.CLOUD;case"))":return Ge.BANG;case"{{":return Ge.HEXAGON;default:return Ge.DEFAULT}},L0=(e,t)=>{ba[e]=t},N0=e=>{if(!e)return;const t=na(),n=_t[_t.length-1];e.icon&&(n.icon=Zr(e.icon,t)),e.class&&(n.class=Zr(e.class,t))},S0=e=>{switch(e){case Ge.DEFAULT:return"no-border";case Ge.RECT:return"rect";case Ge.ROUNDED_RECT:return"rounded-rect";case Ge.CIRCLE:return"circle";case Ge.CLOUD:return"cloud";case Ge.BANG:return"bang";case Ge.HEXAGON:return"hexgon";default:return"no-border"}},I0=()=>hn,P0=e=>ba[e],O0={clear:T0,addNode:A0,getMindmap:C0,nodeType:Ge,getType:k0,setElementForId:L0,decorateNode:N0,type2Str:S0,getLogger:I0,getElementById:P0},M0=O0,R0=12,B0=function(e,t,n,r){t.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("d","M0 ".concat(n.height-5," v").concat(-n.height+2*5," q0,-5 5,-5 h").concat(n.width-2*5," q5,0 5,5 v").concat(n.height-5," H0 Z")),t.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",n.height).attr("x2",n.width).attr("y2",n.height)},F0=function(e,t,n){t.append("rect").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("height",n.height).attr("width",n.width)},z0=function(e,t,n){const r=n.width,i=n.height,o=.15*r,a=.25*r,s=.35*r,l=.2*r;t.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("d","M0 0 a".concat(o,",").concat(o," 0 0,1 ").concat(r*.25,",").concat(-1*r*.1,"\n      a").concat(s,",").concat(s," 1 0,1 ").concat(r*.4,",").concat(-1*r*.1,"\n      a").concat(a,",").concat(a," 1 0,1 ").concat(r*.35,",").concat(1*r*.2,"\n\n      a").concat(o,",").concat(o," 1 0,1 ").concat(r*.15,",").concat(1*i*.35,"\n      a").concat(l,",").concat(l," 1 0,1 ").concat(-1*r*.15,",").concat(1*i*.65,"\n\n      a").concat(a,",").concat(o," 1 0,1 ").concat(-1*r*.25,",").concat(r*.15,"\n      a").concat(s,",").concat(s," 1 0,1 ").concat(-1*r*.5,",0\n      a").concat(o,",").concat(o," 1 0,1 ").concat(-1*r*.25,",").concat(-1*r*.15,"\n\n      a").concat(o,",").concat(o," 1 0,1 ").concat(-1*r*.1,",").concat(-1*i*.35,"\n      a").concat(l,",").concat(l," 1 0,1 ").concat(r*.1,",").concat(-1*i*.65,"\n\n    H0 V0 Z"))},G0=function(e,t,n){const r=n.width,i=n.height,o=.15*r;t.append("path").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("d","M0 0 a".concat(o,",").concat(o," 1 0,0 ").concat(r*.25,",").concat(-1*i*.1,"\n      a").concat(o,",").concat(o," 1 0,0 ").concat(r*.25,",0\n      a").concat(o,",").concat(o," 1 0,0 ").concat(r*.25,",0\n      a").concat(o,",").concat(o," 1 0,0 ").concat(r*.25,",").concat(1*i*.1,"\n\n      a").concat(o,",").concat(o," 1 0,0 ").concat(r*.15,",").concat(1*i*.33,"\n      a").concat(o*.8,",").concat(o*.8," 1 0,0 0,").concat(1*i*.34,"\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.15,",").concat(1*i*.33,"\n\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.25,",").concat(i*.15,"\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.25,",0\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.25,",0\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.25,",").concat(-1*i*.15,"\n\n      a").concat(o,",").concat(o," 1 0,0 ").concat(-1*r*.1,",").concat(-1*i*.33,"\n      a").concat(o*.8,",").concat(o*.8," 1 0,0 0,").concat(-1*i*.34,"\n      a").concat(o,",").concat(o," 1 0,0 ").concat(r*.1,",").concat(-1*i*.33,"\n\n    H0 V0 Z"))},Y0=function(e,t,n){t.append("circle").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("r",n.width/2)};function V0(e,t,n,r,i){return e.insert("polygon",":first-child").attr("points",r.map(function(o){return o.x+","+o.y}).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}const U0=function(e,t,n){const r=n.height,i=r/4,o=n.width-n.padding+2*i,a=[{x:i,y:0},{x:o-i,y:0},{x:o,y:-r/2},{x:o-i,y:-r},{x:i,y:-r},{x:0,y:-r/2}];V0(t,o,r,a,n)},X0=function(e,t,n){t.append("rect").attr("id","node-"+n.id).attr("class","node-bkg node-"+e.type2Str(n.type)).attr("height",n.height).attr("rx",n.padding).attr("ry",n.padding).attr("width",n.width)},j0=function(e,t,n,r,i){const o=i.htmlLabels,a=r%(R0-1),s=t.append("g");n.section=a;let l="section-"+a;a<0&&(l+=" section-root"),s.attr("class",(n.class?n.class+" ":"")+"mindmap-node "+l);const u=s.append("g"),c=s.append("g"),h=n.descr.replace(/(<br\/*>)/g,"\n");Wl(c,h,{useHtmlLabels:o,width:n.width,classes:"mindmap-node-label"}),o||c.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const p=c.node().getBBox(),[d]=Hl(i.fontSize);if(n.height=p.height+d*1.1*.5+n.padding,n.width=p.width+2*n.padding,n.icon)if(n.type===e.nodeType.CIRCLE)n.height+=50,n.width+=50,s.append("foreignObject").attr("height","50px").attr("width",n.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+a+" "+n.icon),c.attr("transform","translate("+n.width/2+", "+(n.height/2-1.5*n.padding)+")");else{n.width+=50;const g=n.height;n.height=Math.max(g,60);const v=Math.abs(n.height-g);s.append("foreignObject").attr("width","60px").attr("height",n.height).attr("style","text-align: center;margin-top:"+v/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+a+" "+n.icon),c.attr("transform","translate("+(25+n.width/2)+", "+(v/2+n.padding/2)+")")}else if(o){const g=(n.width-p.width)/2,v=(n.height-p.height)/2;c.attr("transform","translate("+g+", "+v+")")}else{const g=n.width/2,v=n.padding/2;c.attr("transform","translate("+g+", "+v+")")}switch(n.type){case e.nodeType.DEFAULT:B0(e,u,n,a);break;case e.nodeType.ROUNDED_RECT:X0(e,u,n);break;case e.nodeType.RECT:F0(e,u,n);break;case e.nodeType.CIRCLE:u.attr("transform","translate("+n.width/2+", "+ +n.height/2+")"),Y0(e,u,n);break;case e.nodeType.CLOUD:z0(e,u,n);break;case e.nodeType.BANG:G0(e,u,n);break;case e.nodeType.HEXAGON:U0(e,u,n);break}return e.setElementForId(n.id,s),n.height},H0=function(e,t){const n=e.getElementById(t.id),r=t.x||0,i=t.y||0;n.attr("transform","translate("+r+","+i+")")};Cl.use(E0);function Ll(e,t,n,r,i){j0(e,t,n,r,i),n.children&&n.children.forEach((o,a)=>{Ll(e,t,o,r<0?a:r,i)})}function W0(e,t){t.edges().map((n,r)=>{const i=n.data();if(n[0]._private.bodyBounds){const o=n[0]._private.rscratch;hn.trace("Edge: ",r,i),e.insert("path").attr("d","M ".concat(o.startX,",").concat(o.startY," L ").concat(o.midX,",").concat(o.midY," L").concat(o.endX,",").concat(o.endY," ")).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}})}function Nl(e,t,n,r){t.add({group:"nodes",data:{id:e.id.toString(),labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach(i=>{Nl(i,t,n,r+1),t.add({group:"edges",data:{id:"".concat(e.id,"_").concat(i.id),source:e.id,target:i.id,depth:r,section:i.section}})})}function q0(e,t){return new Promise(n=>{const r=Vl("body").append("div").attr("id","cy").attr("style","display:none"),i=Cl({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});r.remove(),Nl(e,i,t,0),i.nodes().forEach(function(o){o.layoutDimensions=()=>{const a=o.data();return{w:a.width,h:a.height}}}),i.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),i.ready(o=>{hn.info("Ready",o),n(i)})})}function $0(e,t){t.nodes().map((n,r)=>{const i=n.data();i.x=n.position().x,i.y=n.position().y,H0(e,i);const o=e.getElementById(i.nodeId);hn.info("Id:",r,"Position: (",n.position().x,", ",n.position().y,")",i),o.attr("transform","translate(".concat(n.position().x-i.width/2,", ").concat(n.position().y-i.height/2,")")),o.attr("attr","apa-".concat(r,")"))})}const K0=async(e,t,n,r)=>{var d,g;var i,o;hn.debug("Rendering mindmap diagram\n"+e);const a=r.db,s=a.getMindmap();if(!s)return;const l=na();l.htmlLabels=!1;const u=Gl(t),c=u.append("g");c.attr("class","mindmap-edges");const h=u.append("g");h.attr("class","mindmap-nodes"),Ll(a,h,s,-1,l);const p=await q0(s,l);W0(c,p),$0(a,p),Yl(void 0,u,(d=(i=l.mindmap)==null?void 0:i.padding)!=null?d:Kr.mindmap.padding,(g=(o=l.mindmap)==null?void 0:o.useMaxWidth)!=null?g:Kr.mindmap.useMaxWidth)},Z0={draw:K0},Q0=e=>{let t="";for(let n=0;n<e.THEME_COLOR_LIMIT;n++)e["lineColor"+n]=e["lineColor"+n]||e["cScaleInv"+n],Ul(e["lineColor"+n])?e["lineColor"+n]=Xl(e["lineColor"+n],20):e["lineColor"+n]=jl(e["lineColor"+n],20);for(let n=0;n<e.THEME_COLOR_LIMIT;n++){const r=""+(17-3*n);t+="\n    .section-".concat(n-1," rect, .section-").concat(n-1," path, .section-").concat(n-1," circle, .section-").concat(n-1," polygon, .section-").concat(n-1," path  {\n      fill: ").concat(e["cScale"+n],";\n    }\n    .section-").concat(n-1," text {\n     fill: ").concat(e["cScaleLabel"+n],";\n    }\n    .node-icon-").concat(n-1," {\n      font-size: 40px;\n      color: ").concat(e["cScaleLabel"+n],";\n    }\n    .section-edge-").concat(n-1,"{\n      stroke: ").concat(e["cScale"+n],";\n    }\n    .edge-depth-").concat(n-1,"{\n      stroke-width: ").concat(r,";\n    }\n    .section-").concat(n-1," line {\n      stroke: ").concat(e["cScaleInv"+n]," ;\n      stroke-width: 3;\n    }\n\n    .disabled, .disabled circle, .disabled text {\n      fill: lightgray;\n    }\n    .disabled text {\n      fill: #efefef;\n    }\n    ")}return t},J0=e=>"\n  .edge {\n    stroke-width: 3;\n  }\n  ".concat(Q0(e),"\n  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {\n    fill: ").concat(e.git0,";\n  }\n  .section-root text {\n    fill: ").concat(e.gitBranchLabel0,";\n  }\n  .icon-container {\n    height:100%;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n  }\n  .edge {\n    fill: none;\n  }\n  .mindmap-node-label {\n    dy: 1em;\n    alignment-baseline: middle;\n    text-anchor: middle;\n    dominant-baseline: middle;\n    text-align: center;\n  }\n"),em=J0,om={db:M0,renderer:Z0,parser:_0,styles:em};export{om as diagram};

Zerion Mini Shell 1.0