blob: f6ecd7537b0d64c5449cd77483fec3d80ff5a337 [file] [log] [blame]
import{b as Xi}from"./chunk-EA6H37XC.min.js";import{Ga as zt,Ia as Hr,J as ph,M as Yi,N as Hi,O as $i,Qa as $r,_a as _i,b as dh,c as gh,eb as Wi,h as Ui,nb as ka,rb as Ki}from"./chunk-VMREMWJS.min.js";import{b as ne,d as Yr}from"./chunk-P42HNYSU.min.js";var gr=ne((E1,Zi)=>{function yh(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}Zi.exports=yh});var Ji=ne((w1,Qi)=>{var mh=typeof global=="object"&&global&&global.Object===Object&&global;Qi.exports=mh});var Xr=ne((x1,ji)=>{var bh=Ji(),Eh=typeof self=="object"&&self&&self.Object===Object&&self,wh=bh||Eh||Function("return this")();ji.exports=wh});var ts=ne((T1,es)=>{var xh=Xr(),Th=function(){return xh.Date.now()};es.exports=Th});var as=ne((C1,rs)=>{var Ch=/\s/;function Dh(t){for(var e=t.length;e--&&Ch.test(t.charAt(e)););return e}rs.exports=Dh});var is=ne((D1,ns)=>{var Sh=as(),Lh=/^\s+/;function Ah(t){return t&&t.slice(0,Sh(t)+1).replace(Lh,"")}ns.exports=Ah});var Pa=ne((S1,ss)=>{var Oh=Xr(),Nh=Oh.Symbol;ss.exports=Nh});var fs=ne((L1,ls)=>{var os=Pa(),us=Object.prototype,Ih=us.hasOwnProperty,Mh=us.toString,_r=os?os.toStringTag:void 0;function Rh(t){var e=Ih.call(t,_r),r=t[_r];try{t[_r]=void 0;var a=!0}catch{}var n=Mh.call(t);return a&&(e?t[_r]=r:delete t[_r]),n}ls.exports=Rh});var cs=ne((A1,hs)=>{var kh=Object.prototype,Ph=kh.toString;function Bh(t){return Ph.call(t)}hs.exports=Bh});var In=ne((O1,gs)=>{var vs=Pa(),Fh=fs(),Gh=cs(),zh="[object Null]",qh="[object Undefined]",ds=vs?vs.toStringTag:void 0;function Vh(t){return t==null?t===void 0?qh:zh:ds&&ds in Object(t)?Fh(t):Gh(t)}gs.exports=Vh});var ys=ne((N1,ps)=>{function Uh(t){return t!=null&&typeof t=="object"}ps.exports=Uh});var pr=ne((I1,ms)=>{var Yh=In(),Hh=ys(),$h="[object Symbol]";function Xh(t){return typeof t=="symbol"||Hh(t)&&Yh(t)==$h}ms.exports=Xh});var xs=ne((M1,ws)=>{var _h=is(),bs=gr(),Wh=pr(),Es=NaN,Kh=/^[-+]0x[0-9a-f]+$/i,Zh=/^0b[01]+$/i,Qh=/^0o[0-7]+$/i,Jh=parseInt;function jh(t){if(typeof t=="number")return t;if(Wh(t))return Es;if(bs(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=bs(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=_h(t);var r=Zh.test(t);return r||Qh.test(t)?Jh(t.slice(2),r?2:8):Kh.test(t)?Es:+t}ws.exports=jh});var Ds=ne((R1,Cs)=>{var ec=gr(),Mn=ts(),Ts=xs(),tc="Expected a function",rc=Math.max,ac=Math.min;function nc(t,e,r){var a,n,i,s,o,l,u=0,f=!1,h=!1,c=!0;if(typeof t!="function")throw new TypeError(tc);e=Ts(e)||0,ec(r)&&(f=!!r.leading,h="maxWait"in r,i=h?rc(Ts(r.maxWait)||0,e):i,c="trailing"in r?!!r.trailing:c);function v(x){var E=a,C=n;return a=n=void 0,u=x,s=t.apply(C,E),s}function d(x){return u=x,o=setTimeout(y,e),f?v(x):s}function g(x){var E=x-l,C=x-u,T=e-E;return h?ac(T,i-C):T}function p(x){var E=x-l,C=x-u;return l===void 0||E>=e||E<0||h&&C>=i}function y(){var x=Mn();if(p(x))return b(x);o=setTimeout(y,g(x))}function b(x){return o=void 0,c&&a?v(x):(a=n=void 0,s)}function w(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function D(){return o===void 0?s:b(Mn())}function m(){var x=Mn(),E=p(x);if(a=arguments,n=this,l=x,E){if(o===void 0)return d(l);if(h)return clearTimeout(o),o=setTimeout(y,e),v(l)}return o===void 0&&(o=setTimeout(y,e)),s}return m.cancel=w,m.flush=D,m}Cs.exports=nc});var Ls=ne((Rn,Ss)=>{(function(){var t,e,r,a,n,i,s,o,l,u,f,h,c,v,d;r=Math.floor,u=Math.min,e=function(g,p){return g<p?-1:g>p?1:0},l=function(g,p,y,b,w){var D;if(y==null&&(y=0),w==null&&(w=e),y<0)throw new Error("lo must be non-negative");for(b==null&&(b=g.length);y<b;)D=r((y+b)/2),w(p,g[D])<0?b=D:y=D+1;return[].splice.apply(g,[y,y-y].concat(p)),p},i=function(g,p,y){return y==null&&(y=e),g.push(p),v(g,0,g.length-1,y)},n=function(g,p){var y,b;return p==null&&(p=e),y=g.pop(),g.length?(b=g[0],g[0]=y,d(g,0,p)):b=y,b},o=function(g,p,y){var b;return y==null&&(y=e),b=g[0],g[0]=p,d(g,0,y),b},s=function(g,p,y){var b;return y==null&&(y=e),g.length&&y(g[0],p)<0&&(b=[g[0],p],p=b[0],g[0]=b[1],d(g,0,y)),p},a=function(g,p){var y,b,w,D,m,x,E,C;for(p==null&&(p=e),x=function(){C=[];for(var T=0,L=r(g.length/2);0<=L?T<L:T>L;0<=L?T++:T--)C.push(T);return C}.apply(this).reverse(),E=[],b=0,D=x.length;b<D;b++)y=x[b],E.push(d(g,y,p));return E},c=function(g,p,y){var b;if(y==null&&(y=e),b=g.indexOf(p),b!==-1)return v(g,0,b,y),d(g,b,y)},f=function(g,p,y){var b,w,D,m,x;if(y==null&&(y=e),w=g.slice(0,p),!w.length)return w;for(a(w,y),x=g.slice(p),D=0,m=x.length;D<m;D++)b=x[D],s(w,b,y);return w.sort(y).reverse()},h=function(g,p,y){var b,w,D,m,x,E,C,T,L,A;if(y==null&&(y=e),p*10<=g.length){if(m=g.slice(0,p).sort(y),!m.length)return m;for(D=m[m.length-1],T=g.slice(p),x=0,C=T.length;x<C;x++)b=T[x],y(b,D)<0&&(l(m,b,0,null,y),m.pop(),D=m[m.length-1]);return m}for(a(g,y),A=[],w=E=0,L=u(p,g.length);0<=L?E<L:E>L;w=0<=L?++E:--E)A.push(n(g,y));return A},v=function(g,p,y,b){var w,D,m;for(b==null&&(b=e),w=g[y];y>p;){if(m=y-1>>1,D=g[m],b(w,D)<0){g[y]=D,y=m;continue}break}return g[y]=w},d=function(g,p,y){var b,w,D,m,x;for(y==null&&(y=e),w=g.length,x=p,D=g[p],b=2*p+1;b<w;)m=b+1,m<w&&!(y(g[b],g[m])<0)&&(b=m),g[p]=g[b],p=b,b=2*p+1;return g[p]=D,v(g,x,p,y)},t=function(){g.push=i,g.pop=n,g.replace=o,g.pushpop=s,g.heapify=a,g.updateItem=c,g.nlargest=f,g.nsmallest=h;function g(p){this.cmp=p??e,this.nodes=[]}return g.prototype.push=function(p){return i(this.nodes,p,this.cmp)},g.prototype.pop=function(){return n(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(p){return this.nodes.indexOf(p)!==-1},g.prototype.replace=function(p){return o(this.nodes,p,this.cmp)},g.prototype.pushpop=function(p){return s(this.nodes,p,this.cmp)},g.prototype.heapify=function(){return a(this.nodes,this.cmp)},g.prototype.updateItem=function(p){return c(this.nodes,p,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var p;return p=new g,p.nodes=this.nodes.slice(0),p},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),function(g,p){return typeof define=="function"&&define.amd?define([],p):typeof Rn=="object"?Ss.exports=p():g.Heap=p()}(this,function(){return t})}).call(Rn)});var Os=ne((k1,As)=>{As.exports=Ls()});var Wr=ne((P1,Ns)=>{var ic=Array.isArray;Ns.exports=ic});var Ms=ne((B1,Is)=>{var sc=Wr(),oc=pr(),uc=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,lc=/^\w*$/;function fc(t,e){if(sc(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||oc(t)?!0:lc.test(t)||!uc.test(t)||e!=null&&t in Object(e)}Is.exports=fc});var ks=ne((F1,Rs)=>{var hc=In(),cc=gr(),vc="[object AsyncFunction]",dc="[object Function]",gc="[object GeneratorFunction]",pc="[object Proxy]";function yc(t){if(!cc(t))return!1;var e=hc(t);return e==dc||e==gc||e==vc||e==pc}Rs.exports=yc});var Bs=ne((G1,Ps)=>{var mc=Xr(),bc=mc["__core-js_shared__"];Ps.exports=bc});var zs=ne((z1,Gs)=>{var kn=Bs(),Fs=function(){var t=/[^.]+$/.exec(kn&&kn.keys&&kn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ec(t){return!!Fs&&Fs in t}Gs.exports=Ec});var Vs=ne((q1,qs)=>{var wc=Function.prototype,xc=wc.toString;function Tc(t){if(t!=null){try{return xc.call(t)}catch{}try{return t+""}catch{}}return""}qs.exports=Tc});var Ys=ne((V1,Us)=>{var Cc=ks(),Dc=zs(),Sc=gr(),Lc=Vs(),Ac=/[\\^$.*+?()[\]{}|]/g,Oc=/^\[object .+?Constructor\]$/,Nc=Function.prototype,Ic=Object.prototype,Mc=Nc.toString,Rc=Ic.hasOwnProperty,kc=RegExp("^"+Mc.call(Rc).replace(Ac,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Pc(t){if(!Sc(t)||Dc(t))return!1;var e=Cc(t)?kc:Oc;return e.test(Lc(t))}Us.exports=Pc});var $s=ne((U1,Hs)=>{function Bc(t,e){return t?.[e]}Hs.exports=Bc});var Ba=ne((Y1,Xs)=>{var Fc=Ys(),Gc=$s();function zc(t,e){var r=Gc(t,e);return Fc(r)?r:void 0}Xs.exports=zc});var Kr=ne((H1,_s)=>{var qc=Ba(),Vc=qc(Object,"create");_s.exports=Vc});var Zs=ne(($1,Ks)=>{var Ws=Kr();function Uc(){this.__data__=Ws?Ws(null):{},this.size=0}Ks.exports=Uc});var Js=ne((X1,Qs)=>{function Yc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}Qs.exports=Yc});var eo=ne((_1,js)=>{var Hc=Kr(),$c="__lodash_hash_undefined__",Xc=Object.prototype,_c=Xc.hasOwnProperty;function Wc(t){var e=this.__data__;if(Hc){var r=e[t];return r===$c?void 0:r}return _c.call(e,t)?e[t]:void 0}js.exports=Wc});var ro=ne((W1,to)=>{var Kc=Kr(),Zc=Object.prototype,Qc=Zc.hasOwnProperty;function Jc(t){var e=this.__data__;return Kc?e[t]!==void 0:Qc.call(e,t)}to.exports=Jc});var no=ne((K1,ao)=>{var jc=Kr(),ev="__lodash_hash_undefined__";function tv(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=jc&&e===void 0?ev:e,this}ao.exports=tv});var so=ne((Z1,io)=>{var rv=Zs(),av=Js(),nv=eo(),iv=ro(),sv=no();function yr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}yr.prototype.clear=rv;yr.prototype.delete=av;yr.prototype.get=nv;yr.prototype.has=iv;yr.prototype.set=sv;io.exports=yr});var uo=ne((Q1,oo)=>{function ov(){this.__data__=[],this.size=0}oo.exports=ov});var Pn=ne((J1,lo)=>{function uv(t,e){return t===e||t!==t&&e!==e}lo.exports=uv});var Zr=ne((j1,fo)=>{var lv=Pn();function fv(t,e){for(var r=t.length;r--;)if(lv(t[r][0],e))return r;return-1}fo.exports=fv});var co=ne((eb,ho)=>{var hv=Zr(),cv=Array.prototype,vv=cv.splice;function dv(t){var e=this.__data__,r=hv(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():vv.call(e,r,1),--this.size,!0}ho.exports=dv});var go=ne((tb,vo)=>{var gv=Zr();function pv(t){var e=this.__data__,r=gv(e,t);return r<0?void 0:e[r][1]}vo.exports=pv});var yo=ne((rb,po)=>{var yv=Zr();function mv(t){return yv(this.__data__,t)>-1}po.exports=mv});var bo=ne((ab,mo)=>{var bv=Zr();function Ev(t,e){var r=this.__data__,a=bv(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}mo.exports=Ev});var wo=ne((nb,Eo)=>{var wv=uo(),xv=co(),Tv=go(),Cv=yo(),Dv=bo();function mr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}mr.prototype.clear=wv;mr.prototype.delete=xv;mr.prototype.get=Tv;mr.prototype.has=Cv;mr.prototype.set=Dv;Eo.exports=mr});var To=ne((ib,xo)=>{var Sv=Ba(),Lv=Xr(),Av=Sv(Lv,"Map");xo.exports=Av});var So=ne((sb,Do)=>{var Co=so(),Ov=wo(),Nv=To();function Iv(){this.size=0,this.__data__={hash:new Co,map:new(Nv||Ov),string:new Co}}Do.exports=Iv});var Ao=ne((ob,Lo)=>{function Mv(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}Lo.exports=Mv});var Qr=ne((ub,Oo)=>{var Rv=Ao();function kv(t,e){var r=t.__data__;return Rv(e)?r[typeof e=="string"?"string":"hash"]:r.map}Oo.exports=kv});var Io=ne((lb,No)=>{var Pv=Qr();function Bv(t){var e=Pv(this,t).delete(t);return this.size-=e?1:0,e}No.exports=Bv});var Ro=ne((fb,Mo)=>{var Fv=Qr();function Gv(t){return Fv(this,t).get(t)}Mo.exports=Gv});var Po=ne((hb,ko)=>{var zv=Qr();function qv(t){return zv(this,t).has(t)}ko.exports=qv});var Fo=ne((cb,Bo)=>{var Vv=Qr();function Uv(t,e){var r=Vv(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}Bo.exports=Uv});var zo=ne((vb,Go)=>{var Yv=So(),Hv=Io(),$v=Ro(),Xv=Po(),_v=Fo();function br(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}br.prototype.clear=Yv;br.prototype.delete=Hv;br.prototype.get=$v;br.prototype.has=Xv;br.prototype.set=_v;Go.exports=br});var Uo=ne((db,Vo)=>{var qo=zo(),Wv="Expected a function";function Bn(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Wv);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],i=r.cache;if(i.has(n))return i.get(n);var s=t.apply(this,a);return r.cache=i.set(n,s)||i,s};return r.cache=new(Bn.Cache||qo),r}Bn.Cache=qo;Vo.exports=Bn});var Ho=ne((gb,Yo)=>{var Kv=Uo(),Zv=500;function Qv(t){var e=Kv(t,function(a){return r.size===Zv&&r.clear(),a}),r=e.cache;return e}Yo.exports=Qv});var Fn=ne((pb,$o)=>{var Jv=Ho(),jv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ed=/\\(\\)?/g,td=Jv(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(jv,function(r,a,n,i){e.push(n?i.replace(ed,"$1"):a||r)}),e});$o.exports=td});var Gn=ne((yb,Xo)=>{function rd(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}Xo.exports=rd});var Jo=ne((mb,Qo)=>{var _o=Pa(),ad=Gn(),nd=Wr(),id=pr(),sd=1/0,Wo=_o?_o.prototype:void 0,Ko=Wo?Wo.toString:void 0;function Zo(t){if(typeof t=="string")return t;if(nd(t))return ad(t,Zo)+"";if(id(t))return Ko?Ko.call(t):"";var e=t+"";return e=="0"&&1/t==-sd?"-0":e}Qo.exports=Zo});var zn=ne((bb,jo)=>{var od=Jo();function ud(t){return t==null?"":od(t)}jo.exports=ud});var qn=ne((Eb,eu)=>{var ld=Wr(),fd=Ms(),hd=Fn(),cd=zn();function vd(t,e){return ld(t)?t:fd(t,e)?[t]:hd(cd(t))}eu.exports=vd});var Fa=ne((wb,tu)=>{var dd=pr(),gd=1/0;function pd(t){if(typeof t=="string"||dd(t))return t;var e=t+"";return e=="0"&&1/t==-gd?"-0":e}tu.exports=pd});var au=ne((xb,ru)=>{var yd=qn(),md=Fa();function bd(t,e){e=yd(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[md(e[r++])];return r&&r==a?t:void 0}ru.exports=bd});var iu=ne((Tb,nu)=>{var Ed=au();function wd(t,e,r){var a=t==null?void 0:Ed(t,e);return a===void 0?r:a}nu.exports=wd});var ou=ne((Cb,su)=>{var xd=Ba(),Td=function(){try{var t=xd(Object,"defineProperty");return t({},"",{}),t}catch{}}();su.exports=Td});var fu=ne((Db,lu)=>{var uu=ou();function Cd(t,e,r){e=="__proto__"&&uu?uu(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}lu.exports=Cd});var cu=ne((Sb,hu)=>{var Dd=fu(),Sd=Pn(),Ld=Object.prototype,Ad=Ld.hasOwnProperty;function Od(t,e,r){var a=t[e];(!(Ad.call(t,e)&&Sd(a,r))||r===void 0&&!(e in t))&&Dd(t,e,r)}hu.exports=Od});var du=ne((Lb,vu)=>{var Nd=9007199254740991,Id=/^(?:0|[1-9]\d*)$/;function Md(t,e){var r=typeof t;return e=e??Nd,!!e&&(r=="number"||r!="symbol"&&Id.test(t))&&t>-1&&t%1==0&&t<e}vu.exports=Md});var yu=ne((Ab,pu)=>{var Rd=cu(),kd=qn(),Pd=du(),gu=gr(),Bd=Fa();function Fd(t,e,r,a){if(!gu(t))return t;e=kd(e,t);for(var n=-1,i=e.length,s=i-1,o=t;o!=null&&++n<i;){var l=Bd(e[n]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(n!=s){var f=o[l];u=a?a(f,l,o):void 0,u===void 0&&(u=gu(f)?f:Pd(e[n+1])?[]:{})}Rd(o,l,u),o=o[l]}return t}pu.exports=Fd});var bu=ne((Ob,mu)=>{var Gd=yu();function zd(t,e,r){return t==null?t:Gd(t,e,r)}mu.exports=zd});var wu=ne((Nb,Eu)=>{function qd(t,e){var r=-1,a=t.length;for(e||(e=Array(a));++r<a;)e[r]=t[r];return e}Eu.exports=qd});var Tu=ne((Ib,xu)=>{var Vd=Gn(),Ud=wu(),Yd=Wr(),Hd=pr(),$d=Fn(),Xd=Fa(),_d=zn();function Wd(t){return Yd(t)?Vd(t,Xd):Hd(t)?[t]:Ud($d(_d(t)))}xu.exports=Wd});var jf=ne((Mb,Jf)=>{"use strict";var Kd=Ds(),Zd=Os(),Qd=iu(),Jd=bu(),jd=Tu();function ma(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var gn=ma(Kd),ba=ma(Zd),eg=ma(Qd),tg=ma(Jd),rg=ma(jd);function Ye(t){"@babel/helpers - typeof";return Ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ye(t)}function fi(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Cu(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function hi(t,e,r){return e&&Cu(t.prototype,e),r&&Cu(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Sl(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wt(t,e){return ag(t)||ng(t,e)||ig(t,e)||sg()}function ag(t){if(Array.isArray(t))return t}function ng(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a=[],n=!0,i=!1,s,o;try{for(r=r.call(t);!(n=(s=r.next()).done)&&(a.push(s.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,o=l}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw o}}return a}}function ig(t,e){if(t){if(typeof t=="string")return Du(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Du(t,e)}}function Du(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function sg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var Ve=typeof window>"u"?null:window,Su=Ve?Ve.navigator:null;Ve&&Ve.document;var og=Ye(""),Ll=Ye({}),ug=Ye(function(){}),lg=typeof HTMLElement>"u"?"undefined":Ye(HTMLElement),Ea=function(e){return e&&e.instanceString&&Fe(e.instanceString)?e.instanceString():null},ve=function(e){return e!=null&&Ye(e)==og},Fe=function(e){return e!=null&&Ye(e)===ug},Re=function(e){return!ct(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Se=function(e){return e!=null&&Ye(e)===Ll&&!Re(e)&&e.constructor===Object},fg=function(e){return e!=null&&Ye(e)===Ll},ae=function(e){return e!=null&&Ye(e)===Ye(1)&&!isNaN(e)},hg=function(e){return ae(e)&&Math.floor(e)===e},an=function(e){if(lg!=="undefined")return e!=null&&e instanceof HTMLElement},ct=function(e){return wa(e)||Al(e)},wa=function(e){return Ea(e)==="collection"&&e._private.single},Al=function(e){return Ea(e)==="collection"&&!e._private.single},ci=function(e){return Ea(e)==="core"},Ol=function(e){return Ea(e)==="stylesheet"},cg=function(e){return Ea(e)==="event"},Xt=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},vg=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},dg=function(e){return Se(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},gg=function(e){return fg(e)&&Fe(e.then)},pg=function(){return Su&&Su.userAgent.match(/msie|trident|edge/i)},ua=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function n(){var i=this,s=arguments,o,l=r.apply(i,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},vi=ua(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),pn=ua(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),Nl=ua(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),Lu=function(e){return Xt(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},Ue="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",yg="rgb[a]?\\(("+Ue+"[%]?)\\s*,\\s*("+Ue+"[%]?)\\s*,\\s*("+Ue+"[%]?)(?:\\s*,\\s*("+Ue+"))?\\)",mg="rgb[a]?\\((?:"+Ue+"[%]?)\\s*,\\s*(?:"+Ue+"[%]?)\\s*,\\s*(?:"+Ue+"[%]?)(?:\\s*,\\s*(?:"+Ue+"))?\\)",bg="hsl[a]?\\(("+Ue+")\\s*,\\s*("+Ue+"[%])\\s*,\\s*("+Ue+"[%])(?:\\s*,\\s*("+Ue+"))?\\)",Eg="hsl[a]?\\((?:"+Ue+")\\s*,\\s*(?:"+Ue+"[%])\\s*,\\s*(?:"+Ue+"[%])(?:\\s*,\\s*(?:"+Ue+"))?\\)",wg="\\#[0-9a-fA-F]{3}",xg="\\#[0-9a-fA-F]{6}",Il=function(e,r){return e<r?-1:e>r?1:0},Tg=function(e,r){return-1*Il(e,r)},ge=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];t[s]=a[s]}}return t},Cg=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,s=16;return r?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},Dg=function(e){var r,a,n,i,s,o,l,u;function f(d,g,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(g-d)*6*p:p<1/2?g:p<2/3?d+(g-d)*(2/3-p)*6:d}var h=new RegExp("^"+bg+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,v=2*i-c;o=Math.round(255*f(v,c,a+1/3)),l=Math.round(255*f(v,c,a)),u=Math.round(255*f(v,c,a-1/3))}r=[o,l,u,s]}return r},Sg=function(e){var r,a=new RegExp("^"+yg+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},Lg=function(e){return Og[e.toLowerCase()]},Ag=function(e){return(Re(e)?e:null)||Lg(e)||Cg(e)||Sg(e)||Dg(e)},Og={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]},Ml=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Se(s))throw Error("Tried to set map with object key");i<a.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},Rl=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Se(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r},Vn=Ve?Ve.performance:null,kl=Vn&&Vn.now?function(){return Vn.now()}:function(){return Date.now()},Ng=function(){if(Ve){if(Ve.requestAnimationFrame)return function(t){Ve.requestAnimationFrame(t)};if(Ve.mozRequestAnimationFrame)return function(t){Ve.mozRequestAnimationFrame(t)};if(Ve.webkitRequestAnimationFrame)return function(t){Ve.webkitRequestAnimationFrame(t)};if(Ve.msRequestAnimationFrame)return function(t){Ve.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(kl())},1e3/60)}}(),nn=function(e){return Ng(e)},Rt=kl,Cr=9261,Pl=65599,ra=5381,Bl=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cr,a=r,n;n=e.next(),!n.done;)a=a*Pl+n.value|0;return a},la=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Cr;return r*Pl+e|0},fa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ra;return(r<<5)+r+e|0},Ig=function(e,r){return e*2097152+r},qt=function(e){return e[0]*2097152+e[1]},Ga=function(e,r){return[la(e[0],r[0]),fa(e[1],r[1])]},Mg=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Bl(s,r)},ir=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Bl(s,r)},Fl=function(){return Rg(arguments)},Rg=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=ir(n):r=ir(n,r)}return r},Au=!0,kg=console.warn!=null,Pg=console.trace!=null,di=Number.MAX_SAFE_INTEGER||9007199254740991,Gl=function(){return!0},sn=function(){return!1},Ou=function(){return 0},gi=function(){},ze=function(e){throw new Error(e)},zl=function(e){if(e!==void 0)Au=!!e;else return Au},Ie=function(e){zl()&&(kg?console.warn(e):(console.log(e),Pg&&console.trace()))},Bg=function(e){return ge({},e)},Lt=function(e){return e==null?e:Re(e)?e.slice():Se(e)?Bg(e):e},Fg=function(e){return e.slice()},ql=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},Gg={},Vl=function(){return Gg},Je=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var s=r[i],o=a?.[s];n[s]=o===void 0?e[s]:o}return n}},_t=function(e,r,a){for(var n=e.length-1;n>=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},pi=function(e){e.splice(0,e.length)},zg=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},Tt=function(e,r,a){return a&&(r=Nl(a,r)),e[r]},Ut=function(e,r,a,n){a&&(r=Nl(a,r)),e[r]=n},qg=function(){function t(){fi(this,t),this._obj={}}return hi(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}]),t}(),At=typeof Map<"u"?Map:qg,Vg="undefined",Ug=function(){function t(e){if(fi(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return hi(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}]),t}(),kr=(typeof Set>"u"?"undefined":Ye(Set))!==Vg?Set:Ug,yn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!ci(e)){ze("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){ze("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new kr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.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),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Re(r.classes)?u=r.classes:ve(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,h=u.length;f<h;f++){var c=u[f];!c||c===""||i.classes.add(c)}this.createEmitter();var v=r.style||r.css;v&&(Ie("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(v)),(a===void 0||a)&&this.restore()},Nu=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;Se(a)&&!ct(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!Fe(n)?n:i,n=Fe(n)?n:function(){};for(var o=this._private.cy,l=a=ve(a)?this.filter(a):a,u=[],f=[],h={},c={},v={},d=0,g,p=this.byGroup(),y=p.nodes,b=p.edges,w=0;w<l.length;w++){var D=l[w],m=D.id();D.isNode()&&(u.unshift(D),e.bfs&&(v[m]=!0,f.push(D)),c[m]=0)}for(var x=function(){var M=e.bfs?u.shift():u.pop(),N=M.id();if(e.dfs){if(v[N])return"continue";v[N]=!0,f.push(M)}var P=c[N],R=h[N],I=R!=null?R.source():null,k=R!=null?R.target():null,F=R==null?void 0:M.same(I)?k[0]:I[0],z=void 0;if(z=n(M,R,F,d++,P),z===!0)return g=M,"break";if(z===!1)return"break";for(var B=M.connectedEdges().filter(function(_){return(!i||_.source().same(M))&&b.has(_)}),G=0;G<B.length;G++){var $=B[G],X=$.connectedNodes().filter(function(_){return!_.same(M)&&y.has(_)}),Y=X.id();X.length!==0&&!v[Y]&&(X=X[0],u.push(X),e.bfs&&(v[Y]=!0,f.push(X)),h[Y]=$,c[Y]=c[N]+1)}};u.length!==0;){var E=x();if(E!=="continue"&&E==="break")break}for(var C=o.collection(),T=0;T<f.length;T++){var L=f[T],A=h[L.id()];A!=null&&C.push(A),C.push(L)}return{path:o.collection(C),found:o.collection(g)}}},ha={breadthFirstSearch:Nu({bfs:!0}),depthFirstSearch:Nu({dfs:!0})};ha.bfs=ha.breadthFirstSearch;ha.dfs=ha.depthFirstSearch;var Yg=Je({root:null,weight:function(e){return 1},directed:!1}),Hg={dijkstra:function(e){if(!Se(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=Yg(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ve(n)?this.filter(n)[0]:n[0],f={},h={},c={},v=this.byGroup(),d=v.nodes,g=v.edges;g.unmergeBy(function(P){return P.isLoop()});for(var p=function(R){return f[R.id()]},y=function(R,I){f[R.id()]=I,b.updateItem(R)},b=new ba.default(function(P,R){return p(P)-p(R)}),w=0;w<d.length;w++){var D=d[w];f[D.id()]=D.same(u)?0:1/0,b.push(D)}for(var m=function(R,I){for(var k=(s?R.edgesTo(I):R.edgesWith(I)).intersect(g),F=1/0,z,B=0;B<k.length;B++){var G=k[B],$=l(G);($<F||!z)&&(F=$,z=G)}return{edge:z,dist:F}};b.size()>0;){var x=b.pop(),E=p(x),C=x.id();if(c[C]=E,E!==1/0)for(var T=x.neighborhood().intersect(d),L=0;L<T.length;L++){var A=T[L],S=A.id(),M=m(x,A),N=E+M.dist;N<p(A)&&(y(A,N),h[S]={node:x,edge:M.edge})}}return{distanceTo:function(R){var I=ve(R)?d.filter(R)[0]:R[0];return c[I.id()]},pathTo:function(R){var I=ve(R)?d.filter(R)[0]:R[0],k=[],F=I,z=F.id();if(I.length>0)for(k.unshift(I);h[z];){var B=h[z];k.unshift(B.edge),k.unshift(B.node),F=B.node,z=F.id()}return o.spawn(k)}}}},$g={kruskal:function(e){e=e||function(w){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(D){for(var m=0;m<s.length;m++){var x=s[m];if(x.has(D))return m}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var f=n.sort(function(w,D){return e(w)-e(D)}),h=0;h<f.length;h++){var c=f[h],v=c.source()[0],d=c.target()[0],g=l(v),p=l(d),y=s[g],b=s[p];g!==p&&(o.merge(c),y.merge(b),s.splice(p,1))}return o}},Xg=Je({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),_g={aStar:function(e){var r=this.cy(),a=Xg(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var u=n.id(),f=i.id(),h={},c={},v={},d=new ba.default(function(z,B){return c[z.id()]-c[B.id()]}),g=new kr,p={},y={},b=function(B,G){d.push(B),g.add(G)},w,D,m=function(){w=d.pop(),D=w.id(),g.delete(D)},x=function(B){return g.has(B)};b(n,u),h[u]=0,c[u]=s(n);for(var E=0;d.size()>0;){if(m(),E++,D===f){for(var C=[],T=i,L=f,A=y[L];C.unshift(T),A!=null&&C.unshift(A),T=p[L],T!=null;)L=T.id(),A=y[L];return{found:!0,distance:h[D],path:this.spawn(C),steps:E}}v[D]=!0;for(var S=w._private.edges,M=0;M<S.length;M++){var N=S[M];if(this.hasElementWithId(N.id())&&!(o&&N.data("source")!==D)){var P=N.source(),R=N.target(),I=P.id()!==D?P:R,k=I.id();if(this.hasElementWithId(k)&&!v[k]){var F=h[D]+l(N);if(!x(k)){h[k]=F,c[k]=F+s(I),b(I,k),p[k]=w,y[k]=N;continue}F<h[k]&&(h[k]=F,c[k]=F+s(I),p[k]=w,y[k]=N)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},Wg=Je({weight:function(e){return 1},directed:!1}),Kg={floydWarshall:function(e){for(var r=this.cy(),a=Wg(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,f=l.length,h=f*f,c=function($){return l.indexOf($)},v=function($){return l[$]},d=new Array(h),g=0;g<h;g++){var p=g%f,y=(g-p)/f;y===p?d[g]=0:d[g]=1/0}for(var b=new Array(h),w=new Array(h),D=0;D<u.length;D++){var m=u[D],x=m.source()[0],E=m.target()[0];if(x!==E){var C=c(x),T=c(E),L=C*f+T,A=s(m);if(d[L]>A&&(d[L]=A,b[L]=T,w[L]=m),!i){var S=T*f+C;!i&&d[S]>A&&(d[S]=A,b[S]=C,w[S]=m)}}}for(var M=0;M<f;M++)for(var N=0;N<f;N++)for(var P=N*f+M,R=0;R<f;R++){var I=N*f+R,k=M*f+R;d[P]+d[k]<d[I]&&(d[I]=d[P]+d[k],b[I]=b[P])}var F=function($){return(ve($)?r.filter($):$)[0]},z=function($){return c(F($))},B={distance:function($,X){var Y=z($),_=z(X);return d[Y*f+_]},path:function($,X){var Y=z($),_=z(X),q=v(Y);if(Y===_)return q.collection();if(b[Y*f+_]==null)return r.collection();var K=r.collection(),j=Y,Q;for(K.merge(q);Y!==_;)j=Y,Y=b[Y*f+_],Q=w[j*f+Y],K.merge(Q),K.merge(v(Y));return K}};return B}},Zg=Je({weight:function(e){return 1},directed:!1,root:null}),Qg={bellmanFord:function(e){var r=this,a=Zg(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),f=this.byGroup(),h=f.edges,c=f.nodes,v=c.length,d=new At,g=!1,p=[];s=u.collection(s)[0],h.unmergeBy(function(le){return le.isLoop()});for(var y=h.length,b=function(oe){var he=d.get(oe.id());return he||(he={},d.set(oe.id(),he)),he},w=function(oe){return(ve(oe)?u.$(oe):oe)[0]},D=function(oe){return b(w(oe)).dist},m=function(oe){for(var he=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,Te=w(oe),we=[],pe=Te;;){if(pe==null)return r.spawn();var xe=b(pe),U=xe.edge,O=xe.pred;if(we.unshift(pe[0]),pe.same(he)&&we.length>0)break;U!=null&&we.unshift(U),pe=O}return l.spawn(we)},x=0;x<v;x++){var E=c[x],C=b(E);E.same(s)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var T=!1,L=function(oe,he,Te,we,pe,xe){var U=we.dist+xe;U<pe.dist&&!Te.same(we.edge)&&(pe.dist=U,pe.pred=oe,pe.edge=Te,T=!0)},A=1;A<v;A++){T=!1;for(var S=0;S<y;S++){var M=h[S],N=M.source(),P=M.target(),R=o(M),I=b(N),k=b(P);L(N,P,M,I,k,R),i||L(P,N,M,k,I,R)}if(!T)break}if(T)for(var F=[],z=0;z<y;z++){var B=h[z],G=B.source(),$=B.target(),X=o(B),Y=b(G).dist,_=b($).dist;if(Y+X<_||!i&&_+X<Y)if(g||(Ie("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),e.findNegativeWeightCycles!==!1){var q=[];Y+X<_&&q.push(G),!i&&_+X<Y&&q.push($);for(var K=q.length,j=0;j<K;j++){var Q=q[j],ee=[Q];ee.push(b(Q).edge);for(var ie=b(Q).pred;ee.indexOf(ie)===-1;)ee.push(ie),ee.push(b(ie).edge),ie=b(ie).pred;ee=ee.slice(ee.indexOf(ie));for(var de=ee[0].id(),te=0,re=2;re<ee.length;re+=2)ee[re].id()<de&&(de=ee[re].id(),te=re);ee=ee.slice(te).concat(ee.slice(0,te)),ee.push(ee[0]);var fe=ee.map(function(le){return le.id()}).join(",");F.indexOf(fe)===-1&&(p.push(l.spawn(ee)),F.push(fe))}}else break}return{distanceTo:D,pathTo:m,hasNegativeWeightCycle:g,negativeWeightCycles:p}}},Jg=Math.sqrt(2),jg=function(e,r,a){a.length===0&&ze("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=r[i],l=r[s],u=a,f=u.length-1;f>=0;f--){var h=u[f],c=h[1],v=h[2];(r[c]===o&&r[v]===l||r[c]===l&&r[v]===o)&&u.splice(f,1)}for(var d=0;d<u.length;d++){var g=u[d];g[1]===l?(u[d]=g.slice(),u[d][1]=o):g[2]===l&&(u[d]=g.slice(),u[d][2]=o)}for(var p=0;p<r.length;p++)r[p]===l&&(r[p]=o);return u},Un=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=jg(i,e,r),a--}return r},ep={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(k){return k.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/Jg);if(i<2){ze("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f<s;f++){var h=n[f];u.push([f,a.indexOf(h.source()),a.indexOf(h.target())])}for(var c=1/0,v=[],d=new Array(i),g=new Array(i),p=new Array(i),y=function(F,z){for(var B=0;B<i;B++)z[B]=F[B]},b=0;b<=o;b++){for(var w=0;w<i;w++)g[w]=w;var D=Un(g,u.slice(),i,l),m=D.slice();y(g,p);var x=Un(g,D,l,2),E=Un(p,m,l,2);x.length<=E.length&&x.length<c?(c=x.length,v=x,y(g,d)):E.length<=x.length&&E.length<c&&(c=E.length,v=E,y(p,d))}for(var C=this.spawn(v.map(function(k){return n[k[0]]})),T=this.spawn(),L=this.spawn(),A=d[0],S=0;S<d.length;S++){var M=d[S],N=a[S];M===A?T.merge(N):L.merge(N)}var P=function(F){var z=e.spawn();return F.forEach(function(B){z.merge(B),B.connectedEdges().forEach(function(G){e.contains(G)&&!C.contains(G)&&z.merge(G)})}),z},R=[P(T),P(L)],I={cut:C,components:R,partition1:T,partition2:L};return I}},tp=function(e){return{x:e.x,y:e.y}},mn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},Ul=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},Dr=function(e){return{x:e[0],y:e[1]}},rp=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},ap=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},np=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},ip=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,v){return c-v});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},sp=function(e){return Math.PI*e/180},za=function(e,r){return Math.atan2(r,e)-Math.PI/2},yi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Yl=function(e){return e>0?1:e<0?-1:0},sr=function(e,r){return Math.sqrt(rr(e,r))},rr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},op=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},Xe=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Lr=function(e,r,a,n){return{x:Xe(e.x,r.x,a.x,n),y:Xe(e.y,r.y,a.y,n)}},up=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},s=sr(e,r),o={x:i.x/s,y:i.y/s};return a=a??0,n=n??a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},ca=function(e,r,a){return Math.max(e,Math.min(a,r))},ht=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}}},lp=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},fp=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},hp=function(e,r,a){return{x1:e.x1+r,x2:e.x2+r,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},Hl=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},cp=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Ka=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Za=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=wt(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Iu=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},mi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Ir=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},vp=function(e,r){return Ir(e,r.x,r.y)},$l=function(e,r){return Ir(e,r.x1,r.y1)&&Ir(e,r.x2,r.y2)},Xl=function(e,r,a,n,i,s,o){var l=xa(i,s),u=i/2,f=s/2,h;{var c=a-u+l-o,v=n-f-o,d=a+u-l+o,g=v;if(h=Yt(e,r,a,n,c,v,d,g,!1),h.length>0)return h}{var p=a+u+o,y=n-f+l-o,b=p,w=n+f-l+o;if(h=Yt(e,r,a,n,p,y,b,w,!1),h.length>0)return h}{var D=a-u+l-o,m=n+f+o,x=a+u-l+o,E=m;if(h=Yt(e,r,a,n,D,m,x,E,!1),h.length>0)return h}{var C=a-u-o,T=n-f+l-o,L=C,A=n+f-l+o;if(h=Yt(e,r,a,n,C,T,L,A,!1),h.length>0)return h}var S;{var M=a-u+l,N=n-f+l;if(S=aa(e,r,a,n,M,N,l+o),S.length>0&&S[0]<=M&&S[1]<=N)return[S[0],S[1]]}{var P=a+u-l,R=n-f+l;if(S=aa(e,r,a,n,P,R,l+o),S.length>0&&S[0]>=P&&S[1]<=R)return[S[0],S[1]]}{var I=a+u-l,k=n+f-l;if(S=aa(e,r,a,n,I,k,l+o),S.length>0&&S[0]>=I&&S[1]>=k)return[S[0],S[1]]}{var F=a-u+l,z=n+f-l;if(S=aa(e,r,a,n,F,z,l+o),S.length>0&&S[0]<=F&&S[1]>=z)return[S[0],S[1]]}return[]},dp=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=f+l&&h-l<=r&&r<=c+l},gp=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},pp=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},yp=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,h,c,v,d;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,v=r/3,o>0){h=u+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-v+h+c,v+=(h+c)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-c+h)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),d=2*Math.sqrt(l),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},mp=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,v=[];yp(u,f,h,c,v);for(var d=1e-7,g=[],p=0;p<6;p+=2)Math.abs(v[p+1])<d&&v[p]>=0&&v[p]<=1&&g.push(v[p]);g.push(1),g.push(0);for(var y=-1,b,w,D,m=0;m<g.length;m++)b=Math.pow(1-g[m],2)*a+2*(1-g[m])*g[m]*i+g[m]*g[m]*o,w=Math.pow(1-g[m],2)*n+2*(1-g[m])*g[m]*s+g[m]*g[m]*l,D=Math.pow(b-e,2)+Math.pow(w-r,2),y>=0?D<y&&(y=D):y=D;return y},bp=function(e,r,a,n,i,s){var o=[e-a,r-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],f=o[0]*o[0]+o[1]*o[1],h=o[0]*l[0]+o[1]*l[1],c=h*h/u;return h<0?f:c>u?(e-i)*(e-i)+(r-s)*(r-s):f-c},ft=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},kt=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var c=Math.cos(-h),v=Math.sin(-h),d=0;d<f.length/2;d++)f[d*2]=s/2*(a[d*2]*c-a[d*2+1]*v),f[d*2+1]=o/2*(a[d*2+1]*c+a[d*2]*v),f[d*2]+=n,f[d*2+1]+=i;var g;if(u>0){var p=un(f,-u);g=on(p)}else g=f;return ft(e,r,g)},Ep=function(e,r,a,n,i,s,o){for(var l=new Array(a.length),u=s/2,f=o/2,h=bi(s,o),c=h*h,v=0;v<a.length/4;v++){var d=void 0,g=void 0;v===0?d=a.length-2:d=v*4-2,g=v*4+2;var p=n+u*a[v*4],y=i+f*a[v*4+1],b=-a[d]*a[g]-a[d+1]*a[g+1],w=h/Math.tan(Math.acos(b)/2),D=p-w*a[d],m=y-w*a[d+1],x=p+w*a[g],E=y+w*a[g+1];l[v*4]=D,l[v*4+1]=m,l[v*4+2]=x,l[v*4+3]=E;var C=a[d+1],T=-a[d],L=C*a[g]+T*a[g+1];L<0&&(C*=-1,T*=-1);var A=D+C*h,S=m+T*h,M=Math.pow(A-e,2)+Math.pow(S-r,2);if(M<=c)return!0}return ft(e,r,l)},on=function(e){for(var r=new Array(e.length/2),a,n,i,s,o,l,u,f,h=0;h<e.length/4;h++){a=e[h*4],n=e[h*4+1],i=e[h*4+2],s=e[h*4+3],h<e.length/4-1?(o=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],f=e[(h+1)*4+3]):(o=e[0],l=e[1],u=e[2],f=e[3]);var c=Yt(a,n,i,s,o,l,u,f,!0);r[h*2]=c[0],r[h*2+1]=c[1]}return r},un=function(e,r){for(var a=new Array(e.length*2),n,i,s,o,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,f=-(s-n),h=Math.sqrt(u*u+f*f),c=u/h,v=f/h;a[l*4]=n+c*r,a[l*4+1]=i+v*r,a[l*4+2]=s+c*r,a[l*4+3]=o+v*r}return a},wp=function(e,r,a,n,i,s){var o=a-e,l=n-r;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),f=u-1;if(f<0)return[];var h=f/u;return[(a-e)*h+e,(n-r)*h+r]},nr=function(e,r,a,n,i,s,o){return e-=i,r-=s,e/=a/2+o,r/=n/2+o,e*e+r*r<=1},aa=function(e,r,a,n,i,s,o){var l=[a-e,n-r],u=[e-i,r-s],f=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-o*o,v=h*h-4*f*c;if(v<0)return[];var d=(-h+Math.sqrt(v))/(2*f),g=(-h-Math.sqrt(v))/(2*f),p=Math.min(d,g),y=Math.max(d,g),b=[];if(p>=0&&p<=1&&b.push(p),y>=0&&y<=1&&b.push(y),b.length===0)return[];var w=b[0]*l[0]+e,D=b[0]*l[1]+r;if(b.length>1){if(b[0]==b[1])return[w,D];var m=b[1]*l[0]+e,x=b[1]*l[1]+r;return[w,D,m,x]}else return[w,D]},Yn=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Yt=function(e,r,a,n,i,s,o,l,u){var f=e-i,h=a-e,c=o-i,v=r-s,d=n-r,g=l-s,p=c*v-g*f,y=h*v-d*f,b=g*h-c*d;if(b!==0){var w=p/b,D=y/b,m=.001,x=0-m,E=1+m;return x<=w&&w<=E&&x<=D&&D<=E?[e+w*h,r+w*d]:u?[e+w*h,r+w*d]:[]}else return p===0||y===0?Yn(e,a,o)===o?[o,l]:Yn(e,a,i)===i?[i,s]:Yn(i,o,a)===a?[a,n]:[]:[]},va=function(e,r,a,n,i,s,o,l){var u=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var v;if(c){for(var d=0;d<h.length/2;d++)h[d*2]=a[d*2]*s+n,h[d*2+1]=a[d*2+1]*o+i;if(l>0){var g=un(h,-l);v=on(g)}else v=h}else v=a;for(var p,y,b,w,D=0;D<v.length/2;D++)p=v[D*2],y=v[D*2+1],D<v.length/2-1?(b=v[(D+1)*2],w=v[(D+1)*2+1]):(b=v[0],w=v[1]),f=Yt(e,r,n,i,p,y,b,w),f.length!==0&&u.push(f[0],f[1]);return u},xp=function(e,r,a,n,i,s,o,l){for(var u=[],f,h=new Array(a.length),c=s/2,v=o/2,d=bi(s,o),g=0;g<a.length/4;g++){var p=void 0,y=void 0;g===0?p=a.length-2:p=g*4-2,y=g*4+2;var b=n+c*a[g*4],w=i+v*a[g*4+1],D=-a[p]*a[y]-a[p+1]*a[y+1],m=d/Math.tan(Math.acos(D)/2),x=b-m*a[p],E=w-m*a[p+1],C=b+m*a[y],T=w+m*a[y+1];g===0?(h[a.length-2]=x,h[a.length-1]=E):(h[g*4-2]=x,h[g*4-1]=E),h[g*4]=C,h[g*4+1]=T;var L=a[p+1],A=-a[p],S=L*a[y]+A*a[y+1];S<0&&(L*=-1,A*=-1);var M=x+L*d,N=E+A*d;f=aa(e,r,n,i,M,N,d),f.length!==0&&u.push(f[0],f[1])}for(var P=0;P<h.length/4;P++)f=Yt(e,r,n,i,h[P*4],h[P*4+1],h[P*4+2],h[P*4+3],!1),f.length!==0&&u.push(f[0],f[1]);if(u.length>2){for(var R=[u[0],u[1]],I=Math.pow(R[0]-e,2)+Math.pow(R[1]-r,2),k=1;k<u.length/2;k++){var F=Math.pow(u[k*2]-e,2)+Math.pow(u[k*2+1]-r,2);F<=I&&(R[0]=u[k*2],R[1]=u[k*2+1],I=F)}return R}return u},qa=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[r[0]+s*n[0],r[1]+s*n[1]]},ot=function(e,r){var a=Jn(e,r);return a=_l(a),a},_l=function(e){for(var r,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)r=e[2*u],a=e[2*u+1],i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);for(var f=2/(o-i),h=2/(l-s),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*h,i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var v=0;v<n;v++)a=e[2*v+1]=e[2*v+1]+(-1-s);return e},Jn=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},xa=function(e,r){return Math.min(e/4,r/4,8)},bi=function(e,r){return Math.min(e/10,r/10,8)},Wl=function(){return 8},Tp=function(e,r,a){return[e-2*r+a,2*(r-e),e]},jn=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Cp=Je({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Dp={pageRank:function(e){for(var r=Cp(e),a=r.dampingFactor,n=r.precision,i=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,f=l.edges,h=u.length,c=h*h,v=f.length,d=new Array(c),g=new Array(h),p=(1-a)/h,y=0;y<h;y++){for(var b=0;b<h;b++){var w=y*h+b;d[w]=0}g[y]=0}for(var D=0;D<v;D++){var m=f[D],x=m.data("source"),E=m.data("target");if(x!==E){var C=u.indexOfId(x),T=u.indexOfId(E),L=s(m),A=T*h+C;d[A]+=L,g[C]+=L}}for(var S=1/h+p,M=0;M<h;M++)if(g[M]===0)for(var N=0;N<h;N++){var P=N*h+M;d[P]=S}else for(var R=0;R<h;R++){var I=R*h+M;d[I]=d[I]/g[M]+p}for(var k=new Array(h),F=new Array(h),z,B=0;B<h;B++)k[B]=1;for(var G=0;G<i;G++){for(var $=0;$<h;$++)F[$]=0;for(var X=0;X<h;X++)for(var Y=0;Y<h;Y++){var _=X*h+Y;F[X]+=d[_]*k[Y]}op(F),z=k,k=F,F=z;for(var q=0,K=0;K<h;K++){var j=z[K]-k[K];q+=j*j}if(q<n)break}var Q={rank:function(ie){return ie=o.collection(ie)[0],k[u.indexOf(ie)]}};return Q}},Mu=Je({root:null,weight:function(e){return 1},directed:!1,alpha:0}),Ar={degreeCentralityNormalized:function(e){e=Mu(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},h={},c=0,v=0,d=0;d<n;d++){var g=a[d],p=g.id();e.root=g;var y=this.degreeCentrality(e);c<y.indegree&&(c=y.indegree),v<y.outdegree&&(v=y.outdegree),f[p]=y.indegree,h[p]=y.outdegree}return{indegree:function(w){return c==0?0:(ve(w)&&(w=r.filter(w)),f[w.id()]/c)},outdegree:function(w){return v===0?0:(ve(w)&&(w=r.filter(w)),h[w.id()]/v)}}}else{for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(w){return s===0?0:(ve(w)&&(w=r.filter(w)),i[w.id()]/s)}}}},degreeCentrality:function(e){e=Mu(e);var r=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=r.collection(i)[0],o){for(var v=i.connectedEdges(),d=v.filter(function(x){return x.target().same(i)&&a.has(x)}),g=v.filter(function(x){return x.source().same(i)&&a.has(x)}),p=d.length,y=g.length,b=0,w=0,D=0;D<d.length;D++)b+=s(d[D]);for(var m=0;m<g.length;m++)w+=s(g[m]);return{indegree:Math.pow(p,1-l)*Math.pow(b,l),outdegree:Math.pow(y,1-l)*Math.pow(w,l)}}else{for(var u=i.connectedEdges().intersection(a),f=u.length,h=0,c=0;c<u.length;c++)h+=s(u[c]);return{degree:Math.pow(f,1-l)*Math.pow(h,l)}}}};Ar.dc=Ar.degreeCentrality;Ar.dcn=Ar.degreeCentralityNormalised=Ar.degreeCentralityNormalized;var Ru=Je({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Or={closenessCentralityNormalized:function(e){for(var r=Ru(e),a=r.harmonic,n=r.weight,i=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),h=0;h<u.length;h++){for(var c=0,v=u[h],d=0;d<u.length;d++)if(h!==d){var g=f.distance(v,u[d]);a?c+=1/g:c+=g}a||(c=1/c),l<c&&(l=c),o[v.id()]=c}return{closeness:function(y){return l==0?0:(ve(y)?y=s.filter(y)[0].id():y=y.id(),o[y]/l)}}},closenessCentrality:function(e){var r=Ru(e),a=r.root,n=r.weight,i=r.directed,s=r.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),f=0;f<u.length;f++){var h=u[f];if(!h.same(a)){var c=o.distanceTo(h);s?l+=1/c:l+=c}}return s?l:1/l}};Or.cc=Or.closenessCentrality;Or.ccn=Or.closenessCentralityNormalised=Or.closenessCentralityNormalized;var Sp=Je({weight:null,directed:!1}),ei={betweennessCentrality:function(e){for(var r=Sp(e),a=r.directed,n=r.weight,i=n!=null,s=this.cy(),o=this.nodes(),l={},u={},f=0,h={set:function(w,D){u[w]=D,D>f&&(f=D)},get:function(w){return u[w]}},c=0;c<o.length;c++){var v=o[c],d=v.id();a?l[d]=v.outgoers().nodes():l[d]=v.openNeighborhood().nodes(),h.set(d,0)}for(var g=function(w){for(var D=o[w].id(),m=[],x={},E={},C={},T=new ba.default(function(Y,_){return C[Y]-C[_]}),L=0;L<o.length;L++){var A=o[L].id();x[A]=[],E[A]=0,C[A]=1/0}for(E[D]=1,C[D]=0,T.push(D);!T.empty();){var S=T.pop();if(m.push(S),i)for(var M=0;M<l[S].length;M++){var N=l[S][M],P=s.getElementById(S),R=void 0;P.edgesTo(N).length>0?R=P.edgesTo(N)[0]:R=N.edgesTo(P)[0];var I=n(R);N=N.id(),C[N]>C[S]+I&&(C[N]=C[S]+I,T.nodes.indexOf(N)<0?T.push(N):T.updateItem(N),E[N]=0,x[N]=[]),C[N]==C[S]+I&&(E[N]=E[N]+E[S],x[N].push(S))}else for(var k=0;k<l[S].length;k++){var F=l[S][k].id();C[F]==1/0&&(T.push(F),C[F]=C[S]+1),C[F]==C[S]+1&&(E[F]=E[F]+E[S],x[F].push(S))}}for(var z={},B=0;B<o.length;B++)z[o[B].id()]=0;for(;m.length>0;){for(var G=m.pop(),$=0;$<x[G].length;$++){var X=x[G][$];z[X]=z[X]+E[X]/E[G]*(1+z[G])}G!=o[w].id()&&h.set(G,h.get(G)+z[G])}},p=0;p<o.length;p++)g(p);var y={betweenness:function(w){var D=s.collection(w).id();return h.get(D)},betweennessNormalized:function(w){if(f==0)return 0;var D=s.collection(w).id();return h.get(D)/f}};return y.betweennessNormalised=y.betweennessNormalized,y}};ei.bc=ei.betweennessCentrality;var Lp=Je({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),Ap=function(e){return Lp(e)},Op=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},Np=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},Kl=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var s=0;s<r;s++)e[s*r+n]=e[s*r+n]/a}},Ip=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*r[o*a+l]}return n},Mp=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=Ip(e,n,r);return e},Rp=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return Kl(n,r),n},kp=function(e,r,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},Pp=function(e,r,a,n){for(var i=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},Bp=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},Fp=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&Bp(e[r],e[a])&&e.splice(a,1);return e},ku=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=Ap(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,f=new Array(u),h,c=0;c<u;c++)f[c]=0;for(var v=0;v<a.length;v++){var d=a[v],g=s[d.source().id()],p=s[d.target().id()],y=Op(d,i.attributes);f[g*l+p]+=y,f[p*l+g]+=y}Np(f,l,i.multFactor),Kl(f,l);for(var b=!0,w=0;b&&w<i.maxIterations;)b=!1,h=Mp(f,l,i.expandFactor),f=Rp(h,l,i.inflateFactor),kp(f,h,u,4)||(b=!0),w++;var D=Pp(f,l,r,n);return D=Fp(D),D},Gp={markovClustering:ku,mcl:ku},zp=function(e){return e},Zl=function(e,r){return Math.abs(r-e)},Pu=function(e,r,a){return e+Zl(r,a)},Bu=function(e,r,a){return e+Math.pow(a-r,2)},qp=function(e){return Math.sqrt(e)},Vp=function(e,r,a){return Math.max(e,Zl(r,a))},Jr=function(e,r,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:zp,o=n,l,u,f=0;f<e;f++)l=r(f),u=a(f),o=i(o,l,u);return s(o)},Mr={euclidean:function(e,r,a){return e>=2?Jr(e,r,a,0,Bu,qp):Jr(e,r,a,0,Pu)},squaredEuclidean:function(e,r,a){return Jr(e,r,a,0,Bu)},manhattan:function(e,r,a){return Jr(e,r,a,0,Pu)},max:function(e,r,a){return Jr(e,r,a,-1/0,Vp)}};Mr["squared-euclidean"]=Mr.squaredEuclidean;Mr.squaredeuclidean=Mr.squaredEuclidean;function bn(t,e,r,a,n,i){var s;return Fe(t)?s=t:s=Mr[t]||Mr.euclidean,e===0&&Fe(t)?s(n,i):s(e,r,a,n,i)}var Up=Je({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Ei=function(e){return Up(e)},ln=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},l=function(c){return n[c](r)},u=a,f=r;return bn(e,n.length,o,l,u,f)},Hn=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var f=0;f<r;f++){l=[];for(var h=0;h<n;h++)l[h]=Math.random()*(s[h]-i[h])+i[h];o[f]=l}return o},Ql=function(e,r,a,n,i){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=ln(a,e,r[l],n,i);u<s&&(s=u,o=l)}return o},Jl=function(e,r,a){for(var n=[],i=null,s=0;s<r.length;s++)i=r[s],a[i.id()]===e&&n.push(i);return n},Yp=function(e,r,a){return Math.abs(r-e)<=a},Hp=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-r[n][i]);if(s>a)return!1}return!0},$p=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},Fu=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];$p(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<r;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},Gu=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=ln("manhattan",r[i],e,a,"kMedoids");return n},Xp=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Ei(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=Hn(a,i.k,i.attributes)):Ye(i.testCentroids)==="object"?l=i.testCentroids:l=Hn(a,i.k,i.attributes):l=Hn(a,i.k,i.attributes);for(var u=!0,f=0;u&&f<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],o[n.id()]=Ql(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var v=Jl(c,a,o);if(v.length!==0){for(var d=i.attributes.length,g=l[c],p=new Array(d),y=new Array(d),b=0;b<d;b++){y[b]=0;for(var w=0;w<v.length;w++)n=v[w],y[b]+=i.attributes[b](n);p[b]=y[b]/v.length,Yp(p[b],g[b],i.sensitivityThreshold)||(u=!0)}l[c]=p,s[c]=r.collection(v)}}f++}return s},_p=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Ei(e),s=new Array(i.k),o,l={},u,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(Ye(i.testCentroids)==="object"?o=i.testCentroids:o=Fu(a,i.k)):o=Fu(a,i.k);for(var h=!0,c=0;h&&c<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],l[n.id()]=Ql(n,o,i.distance,i.attributes,"kMedoids");h=!1;for(var d=0;d<o.length;d++){var g=Jl(d,a,l);if(g.length!==0){f[d]=Gu(o[d],g,i.attributes);for(var p=0;p<g.length;p++)u=Gu(g[p],g,i.attributes),u<f[d]&&(f[d]=u,o[d]=g[p],h=!0);s[d]=r.collection(g)}}c++}return s},Wp=function(e,r,a,n,i){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var f=0;f<e.length;f++)for(var h=0;h<i.attributes.length;h++){s=0,o=0;for(var c=0;c<r.length;c++)s+=n[c][f]*i.attributes[h](r[c]),o+=n[c][f];e[f][h]=s/o}},Kp=function(e,r,a,n,i){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,f=2/(i.m-1),h=0;h<a.length;h++)for(var c=0;c<n.length;c++){o=0;for(var v=0;v<a.length;v++)l=ln(i.distance,n[c],a[h],i.attributes,"cmeans"),u=ln(i.distance,n[c],a[v],i.attributes,"cmeans"),o+=Math.pow(l/u,f);e[c][h]=1/o}},Zp=function(e,r,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var f=0;f<r[0].length;f++)r[u][f]>o&&(o=r[u][f],l=f);i[l].push(e[u])}for(var h=0;h<i.length;h++)i[h]=n.collection(i[h]);return i},zu=function(e){var r=this.cy(),a=this.nodes(),n=Ei(e),i,s,o,l,u;l=new Array(a.length);for(var f=0;f<a.length;f++)l[f]=new Array(n.k);o=new Array(a.length);for(var h=0;h<a.length;h++)o[h]=new Array(n.k);for(var c=0;c<a.length;c++){for(var v=0,d=0;d<n.k;d++)o[c][d]=Math.random(),v+=o[c][d];for(var g=0;g<n.k;g++)o[c][g]=o[c][g]/v}s=new Array(n.k);for(var p=0;p<n.k;p++)s[p]=new Array(n.attributes.length);u=new Array(a.length);for(var y=0;y<a.length;y++)u[y]=new Array(n.k);for(var b=!0,w=0;b&&w<n.maxIterations;)b=!1,Wp(s,a,o,u,n),Kp(o,l,s,a,n),Hp(o,l,n.sensitivityThreshold)||(b=!0),w++;return i=Zp(a,o,n,r),{clusters:i,degreeOfMembership:o}},Qp={kMeans:Xp,kMedoids:_p,fuzzyCMeans:zu,fcm:zu},Jp=Je({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),jp={single:"min",complete:"max"},ey=function(e){var r=Jp(e),a=jp[r.linkage];return a!=null&&(r.linkage=a),r},qu=function(e,r,a,n,i){for(var s=0,o=1/0,l,u=i.attributes,f=function(T,L){return bn(i.distance,u.length,function(A){return u[A](T)},function(A){return u[A](L)},T,L)},h=0;h<e.length;h++){var c=e[h].key,v=a[c][n[c]];v<o&&(s=c,o=v)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[s],g=r[n[s]],p;i.mode==="dendrogram"?p={left:d,right:g,key:d.key}:p={value:d.value.concat(g.value),key:d.key},e[d.index]=p,e.splice(g.index,1),r[d.key]=p;for(var y=0;y<e.length;y++){var b=e[y];d.key===b.key?l=1/0:i.linkage==="min"?(l=a[d.key][b.key],a[d.key][b.key]>a[g.key][b.key]&&(l=a[g.key][b.key])):i.linkage==="max"?(l=a[d.key][b.key],a[d.key][b.key]<a[g.key][b.key]&&(l=a[g.key][b.key])):i.linkage==="mean"?l=(a[d.key][b.key]*d.size+a[g.key][b.key]*g.size)/(d.size+g.size):i.mode==="dendrogram"?l=f(b.value,d.value):l=f(b.value[0],d.value[0]),a[d.key][b.key]=a[b.key][d.key]=l}for(var w=0;w<e.length;w++){var D=e[w].key;if(n[D]===d.key||n[D]===g.key){for(var m=D,x=0;x<e.length;x++){var E=e[x].key;a[D][E]<a[D][m]&&(m=E)}n[D]=m}e[w].index=w}return d.key=g.key=d.index=g.index=null,!0},Va=function t(e,r,a){e&&(e.value?r.push(e.value):(e.left&&t(e.left,r),e.right&&t(e.right,r)))},ty=function t(e,r){if(!e)return"";if(e.left&&e.right){var a=t(e.left,r),n=t(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},ry=function t(e,r,a){if(!e)return[];var n=[],i=[],s=[];return r===0?(e.left&&Va(e.left,n),e.right&&Va(e.right,i),s=n.concat(i),[a.collection(s)]):r===1?e.value?[a.collection(e.value)]:(e.left&&Va(e.left,n),e.right&&Va(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=t(e.left,r-1,a)),e.right&&(i=t(e.right,r-1,a)),n.concat(i))},Vu=function(e){for(var r=this.cy(),a=this.nodes(),n=ey(e),i=n.attributes,s=function(w,D){return bn(n.distance,i.length,function(m){return i[m](w)},function(m){return i[m](D)},w,D)},o=[],l=[],u=[],f=[],h=0;h<a.length;h++){var c={value:n.mode==="dendrogram"?a[h]:[a[h]],key:h,index:h};o[h]=c,f[h]=c,l[h]=[],u[h]=0}for(var v=0;v<o.length;v++)for(var d=0;d<=v;d++){var g=void 0;n.mode==="dendrogram"?g=v===d?1/0:s(o[v].value,o[d].value):g=v===d?1/0:s(o[v].value[0],o[d].value[0]),l[v][d]=g,l[d][v]=g,g<l[v][u[v]]&&(u[v]=d)}for(var p=qu(o,f,l,u,n);p;)p=qu(o,f,l,u,n);var y;return n.mode==="dendrogram"?(y=ry(o[0],n.dendrogramDepth,r),n.addDendrogram&&ty(o[0],r)):(y=new Array(o.length),o.forEach(function(b,w){b.key=b.index=null,y[w]=r.collection(b.value)})),y},ay={hierarchicalClustering:Vu,hca:Vu},ny=Je({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),iy=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||ze("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ae(a)||ze("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),ny(e)},sy=function(e,r,a,n){var i=function(o,l){return n[l](o)};return-bn(e,n.length,function(s){return i(r,s)},function(s){return i(a,s)},r,a)},oy=function(e,r){var a=null;return r==="median"?a=ip(e):r==="mean"?a=np(e):r==="min"?a=rp(e):r==="max"?a=ap(e):a=r,a},uy=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},Uu=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];r[i*e+u]>o&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},ly=function(e,r,a){for(var n=Uu(e,r,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,f=0;f<s.length;f++){for(var h=0,c=0;c<s.length;c++)h+=r[s[c]*e+s[f]];h>u&&(l=f,u=h)}a[i]=s[l]}return n=Uu(e,r,a),n},Yu=function(e){for(var r=this.cy(),a=this.nodes(),n=iy(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,f,h,c;o=a.length,l=o*o,u=new Array(l);for(var v=0;v<l;v++)u[v]=-1/0;for(var d=0;d<o;d++)for(var g=0;g<o;g++)d!==g&&(u[d*o+g]=sy(n.distance,a[d],a[g],n.attributes));f=oy(u,n.preference);for(var p=0;p<o;p++)u[p*o+p]=f;h=new Array(l);for(var y=0;y<l;y++)h[y]=0;c=new Array(l);for(var b=0;b<l;b++)c[b]=0;for(var w=new Array(o),D=new Array(o),m=new Array(o),x=0;x<o;x++)w[x]=0,D[x]=0,m[x]=0;for(var E=new Array(o*n.minIterations),C=0;C<E.length;C++)E[C]=0;var T;for(T=0;T<n.maxIterations;T++){for(var L=0;L<o;L++){for(var A=-1/0,S=-1/0,M=-1,N=0,P=0;P<o;P++)w[P]=h[L*o+P],N=c[L*o+P]+u[L*o+P],N>=A?(S=A,A=N,M=P):N>S&&(S=N);for(var R=0;R<o;R++)h[L*o+R]=(1-n.damping)*(u[L*o+R]-A)+n.damping*w[R];h[L*o+M]=(1-n.damping)*(u[L*o+M]-S)+n.damping*w[M]}for(var I=0;I<o;I++){for(var k=0,F=0;F<o;F++)w[F]=c[F*o+I],D[F]=Math.max(0,h[F*o+I]),k+=D[F];k-=D[I],D[I]=h[I*o+I],k+=D[I];for(var z=0;z<o;z++)c[z*o+I]=(1-n.damping)*Math.min(0,k-D[z])+n.damping*w[z];c[I*o+I]=(1-n.damping)*(k-D[I])+n.damping*w[I]}for(var B=0,G=0;G<o;G++){var $=c[G*o+G]+h[G*o+G]>0?1:0;E[T%n.minIterations*o+G]=$,B+=$}if(B>0&&(T>=n.minIterations-1||T==n.maxIterations-1)){for(var X=0,Y=0;Y<o;Y++){m[Y]=0;for(var _=0;_<n.minIterations;_++)m[Y]+=E[_*o+Y];(m[Y]===0||m[Y]===n.minIterations)&&X++}if(X===o)break}}for(var q=uy(o,h,c),K=ly(o,u,q),j={},Q=0;Q<q.length;Q++)j[q[Q]]=[];for(var ee=0;ee<a.length;ee++){var ie=i[a[ee].id()],de=K[ie];de!=null&&j[de].push(a[ee])}for(var te=new Array(q.length),re=0;re<q.length;re++)te[re]=r.collection(j[q[re]]);return te},fy={affinityPropagation:Yu,ap:Yu},hy=Je({root:void 0,directed:!1}),cy={hierholzer:function(e){if(!Se(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=hy(e),n=a.root,i=a.directed,s=this,o=!1,l,u,f;n&&(f=ve(n)?this.filter(n)[0].id():n[0].id());var h={},c={};i?s.forEach(function(b){var w=b.id();if(b.isNode()){var D=b.indegree(!0),m=b.outdegree(!0),x=D-m,E=m-D;x==1?l?o=!0:l=w:E==1?u?o=!0:u=w:(E>1||x>1)&&(o=!0),h[w]=[],b.outgoers().forEach(function(C){C.isEdge()&&h[w].push(C.id())})}else c[w]=[void 0,b.target().id()]}):s.forEach(function(b){var w=b.id();if(b.isNode()){var D=b.degree(!0);D%2&&(l?u?o=!0:u=w:l=w),h[w]=[],b.connectedEdges().forEach(function(m){return h[w].push(m.id())})}else c[w]=[b.source().id(),b.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(f&&u!=f)return v;f=u}else{if(f&&u!=f&&l!=f)return v;f||(f=u)}else f||(f=s[0].id());var d=function(w){for(var D=w,m=[w],x,E,C;h[D].length;)x=h[D].shift(),E=c[x][0],C=c[x][1],D!=C?(h[C]=h[C].filter(function(T){return T!=x}),D=C):!i&&D!=E&&(h[E]=h[E].filter(function(T){return T!=x}),D=E),m.unshift(x),m.unshift(D);return m},g=[],p=[];for(p=d(f);p.length!=1;)h[p[0]].length==0?(g.unshift(s.getElementById(p.shift())),g.unshift(s.getElementById(p.shift()))):p=d(p.shift()).concat(p);g.unshift(s.getElementById(p.shift()));for(var y in h)if(h[y].length)return v;return v.found=!0,v.trail=this.spawn(g,!0),v}},Ua=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(c,v){for(var d=s.length-1,g=[],p=e.spawn();s[d].x!=c||s[d].y!=v;)g.push(s.pop().edge),d--;g.push(s.pop().edge),g.forEach(function(y){var b=y.connectedNodes().intersection(e);p.merge(y),b.forEach(function(w){var D=w.id(),m=w.connectedEdges().intersection(e);p.merge(w),r[D].cutVertex?p.merge(m.filter(function(x){return x.isLoop()})):p.merge(m)})}),i.push(p)},u=function h(c,v,d){c===d&&(n+=1),r[v]={id:a,low:a++,cutVertex:!1};var g=e.getElementById(v).connectedEdges().intersection(e);if(g.size()===0)i.push(e.spawn(e.getElementById(v)));else{var p,y,b,w;g.forEach(function(D){p=D.source().id(),y=D.target().id(),b=p===v?y:p,b!==d&&(w=D.id(),o[w]||(o[w]=!0,s.push({x:v,y:b,edge:D})),b in r?r[v].low=Math.min(r[v].low,r[b].id):(h(c,b,v),r[v].low=Math.min(r[v].low,r[b].low),r[v].id<=r[b].low&&(r[v].cutVertex=!0,l(v,b))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,u(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},vy={hopcroftTarjanBiconnected:Ua,htbc:Ua,htb:Ua,hopcroftTarjanBiconnectedComponents:Ua},Ya=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(g){var p=g.target().id();p!==u&&(p in r||l(p),r[p].explored||(r[u].low=Math.min(r[u].low,r[p].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[u].index,r[c].explored=!0,c===u)break}var v=h.edgesWith(h),d=h.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},dy={tarjanStronglyConnected:Ya,tsc:Ya,tscc:Ya,tarjanStronglyConnectedComponents:Ya},jl={};[ha,Hg,$g,_g,Kg,Qg,ep,Dp,Ar,Or,ei,Gp,Qp,ay,fy,cy,vy,dy].forEach(function(t){ge(jl,t)});var ef=0,tf=1,rf=2,Pt=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=ef,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Pt.prototype={fulfill:function(e){return Hu(this,tf,"fulfillValue",e)},reject:function(e){return Hu(this,rf,"rejectReason",e)},then:function(e,r){var a=this,n=new Pt;return a.onFulfilled.push(Xu(e,n,"fulfill")),a.onRejected.push(Xu(r,n,"reject")),af(a),n.proxy}};var Hu=function(e,r,a,n){return e.state===ef&&(e.state=r,e[a]=n,af(e)),e},af=function(e){e.state===tf?$u(e,"onFulfilled",e.fulfillValue):e.state===rf&&$u(e,"onRejected",e.rejectReason)},$u=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},Xu=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(s){r.reject(s);return}gy(r,i)}}},gy=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(Ye(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):t(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};Pt.all=function(t){return new Pt(function(e,r){for(var a=new Array(t.length),n=0,i=function(l,u){a[l]=u,n++,n===t.length&&e(a)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(h){i(o,h)},function(h){r(h)});else{var f=l;i(o,f)}})(s)})};Pt.resolve=function(t){return new Pt(function(e,r){e(t)})};Pt.reject=function(t){return new Pt(function(e,r){r(t)})};var Pr=typeof Promise<"u"?Promise:Pt,ti=function(e,r,a){var n=ci(e),i=!n,s=this._private=ge({duration:1e3},r,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Fe(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},or=ti.prototype;ge(or,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),ct(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 r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(u,f){var h=e[u];h!=null&&(e[u]=e[f],e[f]=h)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new Pr(function(n,i){a.push(function(){n()})})}});or.complete=or.completed;or.run=or.play;or.running=or.playing;var py={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var f=o.style();r=ge({},r,a);var h=Object.keys(r).length===0;if(h)return new ti(s[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(u&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var c=r.renderedPosition,v=o.pan(),d=o.zoom();r.position=Ul(c,d,v)}if(l&&r.panBy!=null){var g=r.panBy,p=o.pan();r.pan={x:p.x+g.x,y:p.y+g.y}}var y=r.center||r.centre;if(l&&y!=null){var b=o.getCenterPan(y.eles,r.zoom);b!=null&&(r.pan=b)}if(l&&r.fit!=null){var w=r.fit,D=o.getFitViewport(w.eles||w.boundingBox,w.padding);D!=null&&(r.pan=D.pan,r.zoom=D.zoom)}if(l&&Se(r.zoom)){var m=o.getZoomedViewport(r.zoom);m!=null?(m.zoomed&&(r.zoom=m.zoom),m.panned&&(r.pan=m.pan)):r.zoom=null}return new ti(s[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(r=ge({},r,a));for(var l=0;l<s.length;l++){var u=s[l],f=u.animated()&&(r.queue===void 0||r.queue),h=u.animation(r,f?{queue:!0}:void 0);h.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],f=u._private,h=f.animation.current,c=0;c<h.length;c++){var v=h[c],d=v._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this}}},yy={data:function(e){var r={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,i){},onSet:function(n){},canSet:function(n){return!0}};return e=ge({},r,e),function(n,i){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],f=l?o[0]:o;if(ve(n)){var h=n.indexOf(".")!==-1,c=h&&rg.default(n);if(s.allowGetting&&i===void 0){var v;return f&&(s.beforeGet(f),c&&f._private[s.field][n]===void 0?v=eg.default(f._private[s.field],c):v=f._private[s.field][n]),v}else if(s.allowSetting&&i!==void 0){var d=!s.immutableKeys[n];if(d){var g=Sl({},n,i);s.beforeSet(o,g);for(var p=0,y=u.length;p<y;p++){var b=u[p];s.canSet(b)&&(c&&f._private[s.field][n]===void 0?tg.default(b._private[s.field],c,i):b._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Se(n)){var w=n,D,m,x=Object.keys(w);s.beforeSet(o,w);for(var E=0;E<x.length;E++){D=x[E],m=w[D];var C=!s.immutableKeys[D];if(C)for(var T=0;T<u.length;T++){var L=u[T];s.canSet(L)&&(L._private[s.field][D]=m)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Fe(n)){var A=n;o.on(s.bindingEvent,A)}else if(s.allowGetting&&n===void 0){var S;return f&&(s.beforeGet(f),S=f._private[s.field]),S}return o}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=ge({},r,e),function(n){var i=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ve(n)){for(var u=n.split(/\s+/),f=u.length,h=0;h<f;h++){var c=u[h];if(!Xt(c)){var v=!i.immutableKeys[c];if(v)for(var d=0,g=l.length;d<g;d++)l[d]._private[i.field][c]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var p=0,y=l.length;p<y;p++)for(var b=l[p]._private[i.field],w=Object.keys(b),D=0;D<w.length;D++){var m=w[D],x=!i.immutableKeys[m];x&&(b[m]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},my={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new Pr(function(o,l){var u=function(v){i.off.apply(i,h),o(v)},f=s.concat([u]),h=f.concat([]);i.on.apply(i,f)})}}},Ne={};[py,yy,my].forEach(function(t){ge(Ne,t)});var by={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop()},Qa={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else Re(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new kr(e),s=0;s<r.length;s++){for(var o=r[s],l=o._private,u=l.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c);if(!v){f=!0;break}}f||(f=u.size!==e.length),f&&(l.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Re(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s<o;s++)for(var l=a[s],u=l._private.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c),d=!1;r||n&&!v?(u.add(c),d=!0):(!r||n&&v)&&(u.delete(c),d=!0),!f&&d&&(i.push(l),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Qa.className=Qa.classNames=Qa.classes;var De={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ue,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};De.variable="(?:[\\w-.]|(?:\\\\"+De.metaChar+"))+";De.className="(?:[\\w-]|(?:\\\\"+De.metaChar+"))+";De.value=De.string+"|"+De.number;De.id=De.variable;(function(){var t,e,r;for(t=De.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],De.comparatorOp+="|@"+e;for(t=De.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(De.comparatorOp+="|\\!"+e)})();var Me=function(){return{checks:[]}},se={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},ri=[{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(t,e){return Tg(t.selector,e.selector)}),Ey=function(){for(var t={},e,r=0;r<ri.length;r++)e=ri[r],t[e.selector]=e.matches;return t}(),wy=function(e,r){return Ey[e](r)},xy="("+ri.map(function(t){return t.selector}).join("|")+")",Er=function(e){return e.replace(new RegExp("\\\\("+De.metaChar+")","g"),function(r,a){return a})},Vt=function(e,r,a){e[e.length-1]=a},ai=[{name:"group",query:!0,regex:"("+De.group+")",populate:function(e,r,a){var n=wt(a,1),i=n[0];r.checks.push({type:se.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:xy,populate:function(e,r,a){var n=wt(a,1),i=n[0];r.checks.push({type:se.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+De.id+")",populate:function(e,r,a){var n=wt(a,1),i=n[0];r.checks.push({type:se.ID,value:Er(i)})}},{name:"className",query:!0,regex:"\\.("+De.className+")",populate:function(e,r,a){var n=wt(a,1),i=n[0];r.checks.push({type:se.CLASS,value:Er(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+De.variable+")\\s*\\]",populate:function(e,r,a){var n=wt(a,1),i=n[0];r.checks.push({type:se.DATA_EXIST,field:Er(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+De.variable+")\\s*("+De.comparatorOp+")\\s*("+De.value+")\\s*\\]",populate:function(e,r,a){var n=wt(a,3),i=n[0],s=n[1],o=n[2],l=new RegExp("^"+De.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),r.checks.push({type:se.DATA_COMPARE,field:Er(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+De.boolOp+")\\s*("+De.variable+")\\s*\\]",populate:function(e,r,a){var n=wt(a,2),i=n[0],s=n[1];r.checks.push({type:se.DATA_BOOL,field:Er(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+De.meta+")\\s*("+De.comparatorOp+")\\s*("+De.number+")\\s*\\]\\]",populate:function(e,r,a){var n=wt(a,3),i=n[0],s=n[1],o=n[2];r.checks.push({type:se.META_COMPARE,field:Er(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:De.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Me();return o}},{name:"directedEdge",separator:!0,regex:De.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=r,i=Me();return a.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),Vt(e,r,a),e.edgeCount++,i}else{var s=Me(),o=r,l=Me();return s.checks.push({type:se.NODE_SOURCE,source:o,target:l}),Vt(e,r,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:De.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=r,i=Me();return a.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),Vt(e,r,a),e.edgeCount++,i}else{var s=Me(),o=r,l=Me();return s.checks.push({type:se.NODE_NEIGHBOR,node:o,neighbor:l}),Vt(e,r,s),l}}},{name:"child",separator:!0,regex:De.child,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:se.CHILD,parent:i,child:n}),Vt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Me(),o=e[e.length-1],l=Me(),u=Me(),f=Me(),h=Me();return s.checks.push({type:se.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:se.TRUE}],h.checks.push({type:se.TRUE}),l.checks.push({type:se.PARENT,parent:h,child:f}),Vt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=Me(),v=Me(),d=[{type:se.PARENT,parent:c,child:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:De.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Me(),n=Me(),i=e[e.length-1];return a.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),Vt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Me(),o=e[e.length-1],l=Me(),u=Me(),f=Me(),h=Me();return s.checks.push({type:se.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:se.TRUE}],h.checks.push({type:se.TRUE}),l.checks.push({type:se.ANCESTOR,ancestor:h,descendant:f}),Vt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=Me(),v=Me(),d=[{type:se.ANCESTOR,ancestor:c,descendant:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:De.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ie("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===se.DIRECTED_EDGE?n.type=se.NODE_TARGET:i===se.UNDIRECTED_EDGE&&(n.type=se.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];ai.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Ty=function(e){for(var r,a,n,i=0;i<ai.length;i++){var s=ai[i],o=s.name,l=e.match(s.regexObj);if(l!=null){a=l,r=s,n=o;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:a,name:n,remaining:e}},Cy=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},Dy=function(e){var r=this,a=r.inputText=e,n=r[0]=Me();for(r.length=1,a=Cy(a);;){var i=Ty(a);if(i.expr==null)return Ie("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(r,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var f=r[u];if(f.compoundCount>0&&f.edgeCount>0)return Ie("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Ie("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Ie("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},Sy=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return ve(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,v=f.value;switch(c){case se.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case se.DATA_COMPARE:{var g=f.field,p=f.operator;return"["+g+a(e(p))+r(v)+"]"}case se.DATA_BOOL:{var y=f.operator,b=f.field;return"["+e(y)+b+"]"}case se.DATA_EXIST:{var w=f.field;return"["+w+"]"}case se.META_COMPARE:{var D=f.operator,m=f.field;return"[["+m+a(e(D))+r(v)+"]]"}case se.STATE:return v;case se.ID:return"#"+v;case se.CLASS:return"."+v;case se.PARENT:case se.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case se.ANCESTOR:case se.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case se.COMPOUND_SPLIT:{var x=i(f.left,h),E=i(f.subject,h),C=i(f.right,h);return x+(x.length>0?" ":"")+E+C}case se.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,v,d){return c+(h===f&&d===0?"$":"")+n(v,h)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},Ly={parse:Dy,toString:Sy},nf=function(e,r,a){var n,i=ve(e),s=ae(e),o=ve(a),l,u,f=!1,h=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return h&&(e!=null||!c)&&(n=!n),n},Ay=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},Oy=function(e){return e!==void 0},wi=function(e,r){return e.data(r)},Ny=function(e,r){return e[r]()},qe=[],Be=function(e,r){return e.checks.every(function(a){return qe[a.type](a,r)})};qe[se.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};qe[se.STATE]=function(t,e){var r=t.value;return wy(r,e)};qe[se.ID]=function(t,e){var r=t.value;return e.id()===r};qe[se.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};qe[se.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return nf(Ny(e,r),a,n)};qe[se.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return nf(wi(e,r),a,n)};qe[se.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return Ay(wi(e,r),a)};qe[se.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,Oy(wi(e,r))};qe[se.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return Be(r,n)&&Be(a,i)||Be(a,n)&&Be(r,i)};qe[se.NODE_NEIGHBOR]=function(t,e){return Be(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Be(t.neighbor,r)})};qe[se.DIRECTED_EDGE]=function(t,e){return Be(t.source,e.source())&&Be(t.target,e.target())};qe[se.NODE_SOURCE]=function(t,e){return Be(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Be(t.target,r)})};qe[se.NODE_TARGET]=function(t,e){return Be(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Be(t.source,r)})};qe[se.CHILD]=function(t,e){return Be(t.child,e)&&Be(t.parent,e.parent())};qe[se.PARENT]=function(t,e){return Be(t.parent,e)&&e.children().some(function(r){return Be(t.child,r)})};qe[se.DESCENDANT]=function(t,e){return Be(t.descendant,e)&&e.ancestors().some(function(r){return Be(t.ancestor,r)})};qe[se.ANCESTOR]=function(t,e){return Be(t.ancestor,e)&&e.descendants().some(function(r){return Be(t.descendant,r)})};qe[se.COMPOUND_SPLIT]=function(t,e){return Be(t.subject,e)&&Be(t.left,e)&&Be(t.right,e)};qe[se.TRUE]=function(){return!0};qe[se.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};qe[se.FILTER]=function(t,e){var r=t.value;return r(e)};var Iy=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===se.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var s=0;s<r.length;s++){var o=r[s];if(Be(o,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},My=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(Be(n,e))return!0}return!1},Ry={matches:My,filter:Iy},Wt=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ve(e)&&e.match(/^\s*$/)||(ct(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):Fe(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):ve(e)?this.parse(e)||(this.invalid=!0):ze("A selector must be created from a string; found "))},Kt=Wt.prototype;[Ly,Ry].forEach(function(t){return ge(Kt,t)});Kt.text=function(){return this.inputText};Kt.size=function(){return this.length};Kt.eq=function(t){return this[t]};Kt.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};Kt.addQuery=function(t){this[this.length++]=t};Kt.selector=Kt.toString;var Ht={allAre:function(e){var r=new Wt(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new Wt(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};Ht.allAreNeighbours=Ht.allAreNeighbors;Ht.has=Ht.contains;Ht.equal=Ht.equals=Ht.same;var pt=function(e,r){return function(n,i,s,o){var l=n,u=this,f;if(l==null?f="":ct(l)&&l.length===1&&(f=l.id()),u.length===1&&f){var h=u[0]._private,c=h.traversalCache=h.traversalCache||{},v=c[r]=c[r]||[],d=ir(f),g=v[d];return g||(v[d]=e.call(u,n,i,s,o))}else return e.call(u,n,i,s,o)}},Rr={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],s=i._private.parent;s&&r.push(s)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:pt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"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 r=[];function a(n){for(var i=0;i<n.length;i++){var s=n[i];r.push(s),s.children().nonempty()&&a(s.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function xi(t,e,r,a){for(var n=[],i=new kr,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function sf(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}Rr.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return xi(this,t,e,sf)};function of(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Rr.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return xi(this,t,e,of)};function ky(t,e,r){of(t,e,r),sf(t,e,r)}Rr.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return xi(this,t,e,ky)};Rr.ancestors=Rr.parents;var da,uf;da=uf={data:Ne.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:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ne.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ne.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};da.attr=da.data;da.removeAttr=da.removeData;var Py=uf,En={};function $n(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=t(n,o))}return a}else return}}ge(En,{degree:$n(function(t,e){return e.source().same(e.target())?2:1}),indegree:$n(function(t,e){return e.target().same(t)?1:0}),outdegree:$n(function(t,e){return e.source().same(t)?1:0})});function wr(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[t](r);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}ge(En,{minDegree:wr("degree",function(t,e){return t<e}),maxDegree:wr("degree",function(t,e){return t>e}),minIndegree:wr("indegree",function(t,e){return t<e}),maxIndegree:wr("indegree",function(t,e){return t>e}),minOutdegree:wr("outdegree",function(t,e){return t<e}),maxOutdegree:wr("outdegree",function(t,e){return t>e})});ge(En,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Ct,lf,ff=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},_u={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,r){ff(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ct=lf={position:Ne.data(_u),silentPosition:Ne.data(ge({},_u,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){ff(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Se(e))r?this.silentPosition(e):this.position(e);else if(Fe(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(r?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Se(e)?(n={x:ae(e.x)?e.x:0,y:ae(e.y)?e.y:0},a=r):ve(e)&&ae(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+n.x,y:l.y+n.y};a?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,r){return Se(e)?this.shift(e,!0):ve(e)&&ae(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=Se(e)?e:void 0,l=o!==void 0||r!==void 0&&ve(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var f=this[u];r!==void 0?f.position(e,(r-s[e])/i):o!==void 0&&f.position(Ul(o,i,s))}else{var h=a.position();return o=mn(h,i,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Se(e)?e:void 0,s=i!==void 0||r!==void 0&&ve(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],f=o?u.parent():null,h=f&&f.length>0,c=h;h&&(f=f[0]);var v=c?f.position():{x:0,y:0};r!==void 0?u.position(e,r+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),g=o?a.parent():null,p=g&&g.length>0,y=p;p&&(g=g[0]);var b=y?g.position():{x:0,y:0};return i={x:d.x-b.x,y:d.y-b.y},e===void 0?i:i[e]}else if(!s)return;return this}};Ct.modelPosition=Ct.point=Ct.position;Ct.modelPositions=Ct.points=Ct.positions;Ct.renderedPoint=Ct.renderedPosition;Ct.relativePoint=Ct.relativePosition;var By=lf,Nr,Qt;Nr=Qt={};Qt.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};Qt.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};Qt.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function v(T,L,A){var S=0,M=0,N=L+A;return T>0&&N>0&&(S=L/N*T,M=A/N*T),{biasDiff:S,biasComplementDiff:M}}function d(T,L,A,S){if(A.units==="%")switch(S){case"width":return T>0?A.pfValue*T:0;case"height":return L>0?A.pfValue*L:0;case"average":return T>0&&L>0?A.pfValue*(T+L)/2:0;case"min":return T>0&&L>0?T>L?A.pfValue*L:A.pfValue*T:0;case"max":return T>0&&L>0?T>L?A.pfValue*T:A.pfValue*L:0;default:return 0}else return A.units==="px"?A.pfValue:0}var g=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(g=g*100/f.width.val);var p=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var y=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(y=y*100/f.height.val);var b=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(b=b*100/f.height.val);var w=v(f.width.val-h.w,g,p),D=w.biasDiff,m=w.biasComplementDiff,x=v(f.height.val-h.h,y,b),E=x.biasDiff,C=x.biasComplementDiff;o.autoPadding=d(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-D+h.x1+h.x2+m)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-E+h.y1+h.y2+C)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var gt=function(e){return e===1/0||e===-1/0?0:e},xt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ar=function(e,r){return r==null?e:xt(e,r.x1,r.y1,r.x2,r.y2)},jr=function(e,r,a){return Tt(e,r,a)},Ha=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=l-s,h.y1=u-s,h.x2=l+s,h.y2=u+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,Ka(h,1),xt(e,h.x1,h.y1,h.x2,h.y2)}}},Xn=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),f=jr(s,"labelWidth",a),h=jr(s,"labelHeight",a),c=jr(s,"labelX",a),v=jr(s,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,g=r.pstyle(n+"text-margin-y").pfValue,p=r.isEdge(),y=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,w=r.pstyle("text-border-width").pfValue,D=w/2,m=r.pstyle("text-background-padding").pfValue,x=2,E=h,C=f,T=C/2,L=E/2,A,S,M,N;if(p)A=c-T,S=c+T,M=v-L,N=v+L;else{switch(l.value){case"left":A=c-C,S=c;break;case"center":A=c-T,S=c+T;break;case"right":A=c,S=c+C;break}switch(u.value){case"top":M=v-E,N=v;break;case"center":M=v-L,N=v+L;break;case"bottom":M=v,N=v+E;break}}A+=d-Math.max(b,D)-m-x,S+=d+Math.max(b,D)+m+x,M+=g-Math.max(b,D)-m-x,N+=g+Math.max(b,D)+m+x;var P=a||"main",R=i.labelBounds,I=R[P]=R[P]||{};I.x1=A,I.y1=M,I.x2=S,I.y2=N,I.w=S-A,I.h=N-M;var k=p&&y.strValue==="autorotate",F=y.pfValue!=null&&y.pfValue!==0;if(k||F){var z=k?jr(i.rstyle,"labelAngle",a):y.pfValue,B=Math.cos(z),G=Math.sin(z),$=(A+S)/2,X=(M+N)/2;if(!p){switch(l.value){case"left":$=S;break;case"right":$=A;break}switch(u.value){case"top":X=N;break;case"bottom":X=M;break}}var Y=function(de,te){return de=de-$,te=te-X,{x:de*B-te*G+$,y:de*G+te*B+X}},_=Y(A,M),q=Y(A,N),K=Y(S,M),j=Y(S,N);A=Math.min(_.x,q.x,K.x,j.x),S=Math.max(_.x,q.x,K.x,j.x),M=Math.min(_.y,q.y,K.y,j.y),N=Math.max(_.y,q.y,K.y,j.y)}var Q=P+"Rot",ee=R[Q]=R[Q]||{};ee.x1=A,ee.y1=M,ee.x2=S,ee.y2=N,ee.w=S-A,ee.h=N-M,xt(e,A,M,S,N),xt(i.labelBounds.all,A,M,S,N)}return e}},Fy=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value;if(a>0&&n>0){var i=r.pstyle("outline-offset").value,s=r.pstyle("shape").value,o=n+i,l=(e.w+o*2)/e.w,u=(e.h+o*2)/e.h,f=0,h=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+o*2.4)/e.w,h=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+o*2.4)/e.w:s==="star"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.6)/e.h,h=-o/3.8):s==="triangle"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.4)/e.h,h=-o/1.4):s==="vee"&&(l=(e.w+o*4.4)/e.w,u=(e.h+o*3.8)/e.h,h=-o*.5);var c=e.h*u-e.h,v=e.w*l-e.w;if(Za(e,[Math.ceil(c/2),Math.ceil(v/2)]),f!=0||h!==0){var d=hp(e,f,h);Hl(e,d)}}}},Gy=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=ht(),o=e._private,l=e.isNode(),u=e.isEdge(),f,h,c,v,d,g,p=o.rstyle,y=l&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(fe){return fe.pstyle("display").value!=="none"},w=!n||b(e)&&(!u||b(e.source())&&b(e.target()));if(w){var D=0,m=0;n&&r.includeOverlays&&(D=e.pstyle("overlay-opacity").value,D!==0&&(m=e.pstyle("overlay-padding").value));var x=0,E=0;n&&r.includeUnderlays&&(x=e.pstyle("underlay-opacity").value,x!==0&&(E=e.pstyle("underlay-padding").value));var C=Math.max(m,E),T=0,L=0;if(n&&(T=e.pstyle("width").pfValue,L=T/2),l&&r.includeNodes){var A=e.position();d=A.x,g=A.y;var S=e.outerWidth(),M=S/2,N=e.outerHeight(),P=N/2;f=d-M,h=d+M,c=g-P,v=g+P,xt(s,f,c,h,v),n&&r.includeOutlines&&Fy(s,e)}else if(u&&r.includeEdges)if(n&&!i){var R=e.pstyle("curve-style").strValue;if(f=Math.min(p.srcX,p.midX,p.tgtX),h=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),v=Math.max(p.srcY,p.midY,p.tgtY),f-=L,h+=L,c-=L,v+=L,xt(s,f,c,h,v),R==="haystack"){var I=p.haystackPts;if(I&&I.length===2){if(f=I[0].x,c=I[0].y,h=I[1].x,v=I[1].y,f>h){var k=f;f=h,h=k}if(c>v){var F=c;c=v,v=F}xt(s,f-L,c-L,h+L,v+L)}}else if(R==="bezier"||R==="unbundled-bezier"||R==="segments"||R==="taxi"){var z;switch(R){case"bezier":case"unbundled-bezier":z=p.bezierPts;break;case"segments":case"taxi":z=p.linePts;break}if(z!=null)for(var B=0;B<z.length;B++){var G=z[B];f=G.x-L,h=G.x+L,c=G.y-L,v=G.y+L,xt(s,f,c,h,v)}}}else{var $=e.source(),X=$.position(),Y=e.target(),_=Y.position();if(f=X.x,h=_.x,c=X.y,v=_.y,f>h){var q=f;f=h,h=q}if(c>v){var K=c;c=v,v=K}f-=L,h+=L,c-=L,v+=L,xt(s,f,c,h,v)}if(n&&r.includeEdges&&u&&(Ha(s,e,"mid-source"),Ha(s,e,"mid-target"),Ha(s,e,"source"),Ha(s,e,"target")),n){var j=e.pstyle("ghost").value==="yes";if(j){var Q=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue;xt(s,s.x1+Q,s.y1+ee,s.x2+Q,s.y2+ee)}}var ie=o.bodyBounds=o.bodyBounds||{};Iu(ie,s),Za(ie,y),Ka(ie,1),n&&(f=s.x1,h=s.x2,c=s.y1,v=s.y2,xt(s,f-C,c-C,h+C,v+C));var de=o.overlayBounds=o.overlayBounds||{};Iu(de,s),Za(de,y),Ka(de,1);var te=o.labelBounds=o.labelBounds||{};te.all!=null?fp(te.all):te.all=ht(),n&&r.includeLabels&&(r.includeMainLabels&&Xn(s,e,null),u&&(r.includeSourceLabels&&Xn(s,e,"source"),r.includeTargetLabels&&Xn(s,e,"target")))}return s.x1=gt(s.x1),s.y1=gt(s.y1),s.x2=gt(s.x2),s.y2=gt(s.y2),s.w=gt(s.x2-s.x1),s.h=gt(s.y2-s.y1),s.w>0&&s.h>0&&w&&(Za(s,y),Ka(s,1)),s},hf=function(e){var r=0,a=function(s){return(s?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},cf=function(e){if(e.isEdge()){var r=e.source().position(),a=e.target().position(),n=function(s){return Math.round(s)};return Mg([n(r.x),n(r.y),n(a.x),n(a.y)])}else return 0},Wu=function(e,r){var a=e._private,n,i=e.isEdge(),s=r==null?Ku:hf(r),o=s===Ku,l=cf(e),u=a.bbCachePosKey===l,f=r.useCache&&u,h=function(g){return g._private.bbCache==null||g._private.styleDirty},c=!f||h(e)||i&&h(e.source())||h(e.target());if(c?(u||e.recalculateRenderedStyle(f),n=Gy(e,ga),a.bbCache=n,a.bbCachePosKey=l):n=a.bbCache,!o){var v=e.isNode();n=ht(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?ar(n,a.overlayBounds):ar(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?ar(n,a.labelBounds.all):(r.includeMainLabels&&ar(n,a.labelBounds.mainRot),r.includeSourceLabels&&ar(n,a.labelBounds.sourceRot),r.includeTargetLabels&&ar(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},ga={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Ku=hf(ga),Zu=Je(ga);Qt.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=ga:t=Zu(t),e=Wu(this[0],t);else{e=ht(),t=t||ga;var r=Zu(t),a=this,n=a.cy(),i=n.styleEnabled();if(i)for(var s=0;s<a.length;s++){var o=a[s],l=o._private,u=cf(o),f=l.bbCachePosKey===u,h=r.useCache&&f&&!l.styleDirty;o.recalculateRenderedStyle(h)}this.updateCompoundBounds(!t.useCache);for(var c=0;c<a.length;c++){var v=a[c];ar(e,Wu(v,r))}}return e.x1=gt(e.x1),e.y1=gt(e.y1),e.x2=gt(e.x2),e.y2=gt(e.y2),e.w=gt(e.x2-e.x1),e.h=gt(e.y2-e.y1),e};Qt.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};Qt.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),Se(t)){var i=t;t=function(){return i}}var s=function(f,h){return f._private.bbAtOldPos=t(f,h)},o=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=lp(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),l};Nr.boundingbox=Nr.bb=Nr.boundingBox;Nr.renderedBoundingbox=Nr.renderedBoundingBox;var zy=Qt,na,Ta;na=Ta={};var vf=function(e){e.uppercaseName=Lu(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=Lu(e.outerName),na[e.name]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},na["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return o+l+u}else return 1},na["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},na["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};vf({name:"width"});vf({name:"height"});Ta.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};Ta.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Ta.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var qy=Ta,Vy=function(e,r){if(e.isEdge())return r(e)},Uy=function(e,r){if(e.isEdge()){var a=e.cy();return mn(r(e),a.zoom(),a.pan())}},Yy=function(e,r){if(e.isEdge()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(s){return mn(s,i,n)})}},Hy=function(e){return e.renderer().getControlPoints(e)},$y=function(e){return e.renderer().getSegmentPoints(e)},Xy=function(e){return e.renderer().getSourceEndpoint(e)},_y=function(e){return e.renderer().getTargetEndpoint(e)},Wy=function(e){return e.renderer().getEdgeMidpoint(e)},Qu={controlPoints:{get:Hy,mult:!0},segmentPoints:{get:$y,mult:!0},sourceEndpoint:{get:Xy},targetEndpoint:{get:_y},midpoint:{get:Wy}},Ky=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},Zy=Object.keys(Qu).reduce(function(t,e){var r=Qu[e],a=Ky(e);return t[e]=function(){return Vy(this,r.get)},r.mult?t[a]=function(){return Yy(this,r.get)}:t[a]=function(){return Uy(this,r.get)},t},{}),Qy=ge({},By,zy,qy,Zy);var df=function(e,r){this.recycle(e,r)};function ea(){return!1}function $a(){return!0}df.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=ea,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?$a:ea):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=$a;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=$a;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=$a,this.stopPropagation()},isDefaultPrevented:ea,isPropagationStopped:ea,isImmediatePropagationStopped:ea};var gf=/^([^.]+)(\.(?:[^.]+))?$/,Jy=".*",pf={qualifierCompare:function(e,r){return e===r},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},Ju=Object.keys(pf),jy={};function wn(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:jy,e=arguments.length>1?arguments[1]:void 0,r=0;r<Ju.length;r++){var a=Ju[r];this[a]=t[a]||pf[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var Zt=wn.prototype,yf=function(e,r,a,n,i,s,o){Fe(n)&&(i=n,n=null),o&&(s==null?s=o:s=ge({},s,o));for(var l=Re(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var f=l[u];if(!Xt(f)){var h=f.match(gf);if(h){var c=h[1],v=h[2]?h[2]:null,d=r(e,f,c,v,n,i,s);if(d===!1)break}}}},ju=function(e,r){return e.addEventFields(e.context,r),new df(r.type,r)},em=function(e,r,a){if(cg(a)){r(e,a);return}else if(Se(a)){r(e,ju(e,a));return}for(var n=Re(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!Xt(s)){var o=s.match(gf);if(o){var l=o[1],u=o[2]?o[2]:null,f=ju(e,{type:l,namespace:u,target:e.context});r(e,f)}}}};Zt.on=Zt.addListener=function(t,e,r,a,n){return yf(this,function(i,s,o,l,u,f,h){Fe(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:l,qualifier:u,conf:h})},t,e,r,a,n),this};Zt.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};Zt.removeListener=Zt.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=Fg(this.listeners));for(var i=this.listeners,s=function(u){var f=i[u];yf(n,function(h,c,v,d,g,p){if((f.type===v||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!g||h.qualifierCompare(f.qualifier,g))&&(!p||f.callback===p))return i.splice(u,1),!1},t,e,r,a)},o=i.length-1;o>=0;o--)s(o);return this};Zt.removeAllListeners=function(){return this.removeListener("*")};Zt.emit=Zt.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Re(e)||(e=[e]),em(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===Jy)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&zg(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(g){return g!==h}));var v=i.callbackContext(i.context,h,s),d=h.callback.apply(v,c);i.afterEmit(i.context,h,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<n;l++)o(l);i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},t),this.emitting--,this};var tm={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},Xa=function(e){return ve(e)?new Wt(e):e},mf={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new wn(tm,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=Xa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=Xa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=Xa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=Xa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Ne.eventAliasesOn(mf);var bf={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(ve(e)||ct(e))return new Wt(e).filter(this);if(Fe(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ve(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ve(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,l=s?i:n,u=0;u<o.length;u++){var f=o[u];l.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;ve(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,s=function(l,u){for(var f=0;f<l.length;f++){var h=l[f],c=h._private.data.id,v=u.hasElementWithId(c);v||a.push(h)}};return s(n,i),s(i,n),a},diff:function(e){var r=this._private.cy;ve(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,l=function(f,h,c){for(var v=0;v<f.length;v++){var d=f[v],g=d._private.data.id,p=h.hasElementWithId(g);p?i.merge(d):c.push(d)}};return l(s,o,a),l(o,s,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(ve(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&ve(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!i.has(l);if(u){var f=this.length++;this[f]=o,i.set(l,{ele:o,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ve(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);a.push(o)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l>a&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l<a&&(a=l,n=o)}return{value:a,ele:n}}},Oe=bf;Oe.u=Oe["|"]=Oe["+"]=Oe.union=Oe.or=Oe.add;Oe["\\"]=Oe["!"]=Oe["-"]=Oe.difference=Oe.relativeComplement=Oe.subtract=Oe.not;Oe.n=Oe["&"]=Oe["."]=Oe.and=Oe.intersection=Oe.intersect;Oe["^"]=Oe["(+)"]=Oe["(-)"]=Oe.symmetricDifference=Oe.symdiff=Oe.xor;Oe.fnFilter=Oe.filterFn=Oe.stdFilter=Oe.filter;Oe.complement=Oe.abscomp=Oe.absoluteComplement;var rm={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}},Ef=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var h=f.pstyle("z-compound-depth");return h.value==="auto"?n?f.zDepth():0:h.value==="bottom"?-1:h.value==="top"?di:0}var s=i(e)-i(r);if(s!==0)return s;function o(f){var h=f.pstyle("z-index-compare");return h.value==="auto"&&f.isNode()?1:0}var l=o(e)-o(r);if(l!==0)return l;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},fn={forEach:function(e,r){if(Fe(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=r?e.apply(r,[i,n,this]):e(i,n,this);if(s===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},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(!Fe(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(Ef)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:di-1}else{var i=r.source,s=r.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};fn.each=fn.forEach;var am=function(){var e="undefined",r=(typeof Symbol>"u"?"undefined":Ye(Symbol))!=e&&Ye(Symbol.iterator)!=e;r&&(fn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return Sl({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};am();var nm=Je({nodeDimensionsIncludeLabels:!1}),Ja={layoutDimensions:function(e){e=nm(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(m){return!m.isParent()}),i=this.cy(),s=r.eles,o=function(x){return x.id()},l=ua(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(x,E,C){var T={x:E.x1+E.w/2,y:E.y1+E.h/2},L={x:(C.x-T.x)*x,y:(C.y-T.y)*x};return{x:T.x+L.x,y:T.y+L.y}},f=r.spacingFactor&&r.spacingFactor!==1,h=function(){if(!f)return null;for(var x=ht(),E=0;E<n.length;E++){var C=n[E],T=l(C,E);cp(x,T.x,T.y)}return x},c=h(),v=ua(function(m,x){var E=l(m,x);if(f){var C=Math.abs(r.spacingFactor);E=u(C,c,E)}return r.transform!=null&&(E=r.transform(m,E)),E},o);if(r.animate){for(var d=0;d<n.length;d++){var g=n[d],p=v(g,d),y=r.animateFilter==null||r.animateFilter(g,d);if(y){var b=g.animation({position:p,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(b)}else g.position(p)}if(r.fit){var w=i.animation({fit:{boundingBox:s.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(w)}else if(r.zoom!==void 0&&r.pan!==void 0){var D=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(D)}e.animations.forEach(function(m){return m.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),Pr.all(e.animations.map(function(m){return m.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(v),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(ge({},e,{eles:this}))}};Ja.createLayout=Ja.makeLayout=Ja.layout;function wf(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function xn(t,e){return t=ir(t),function(a){return wf(t,e,a)}}function Tn(t,e){t=ir(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return wf(t,r,n)}}var Ze={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Se(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ve(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,a)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,e,a)}}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 r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function _n(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Ti(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||_n(i,a);var l=o.source,u=o.target;return r(l)&&(!s||_n(l,r))&&(l===u||r(u)&&(!s||_n(u,r)))}}}var Br=xn("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});Ze.takesUpSpace=Tn("takesUpSpace",Ti({ok:Br}));var im=xn("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Br(t)}),sm=xn("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Br(t)});Ze.interactive=Tn("interactive",Ti({ok:im,parentOk:sm,edgeOkViaNode:Br}));Ze.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var om=xn("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Br(t)}),um=Br;Ze.visible=Tn("visible",Ti({ok:om,edgeOkViaNode:um}));Ze.hidden=function(){var t=this[0];if(t)return!t.visible()};Ze.isBundledBezier=Tn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});Ze.bypass=Ze.css=Ze.style;Ze.renderedCss=Ze.renderedStyle;Ze.removeBypass=Ze.removeCss=Ze.removeStyle;Ze.pstyle=Ze.parsedStyle;var $t={};function el(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&Fe(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&Re(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],f=l._private[t.field]!=t.value;if(t.overrideAble){var h=t.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[t.field]=t.value,f&&r.push(l))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),s&&c.emit(s)}return this}}function Fr(t){$t[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},$t[t.on]=el({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),$t[t.off]=el({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}Fr({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});Fr({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});Fr({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});Fr({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});$t.deselect=$t.unselect;$t.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};Fr({field:"active",on:"activate",off:"unactivate"});Fr({field:"pannable",on:"panify",off:"unpanify"});$t.inactive=function(){var t=this[0];if(t)return!t._private.active};var rt={},tl=function(e){return function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),f=0;f<u.length;f++){var h=u[f],c=h.source(),v=h.target();if(e.noIncomingEdges&&v===o&&c!==o||e.noOutgoingEdges&&c===o&&v!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(a)}},rl=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],f=u.source(),h=u.target();e.outgoing&&f===s?(n.push(u),n.push(h)):e.incoming&&h===s&&(n.push(u),n.push(f))}}return this.spawn(n,!0).filter(r)}},al=function(e){return function(r){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],f=u.id();i[f]||(i[f]=!0,n.push(u),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(r)}};rt.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};ge(rt,{roots:tl({noIncomingEdges:!0}),leaves:tl({noOutgoingEdges:!0}),outgoers:pt(rl({outgoing:!0}),"outgoers"),successors:al({outgoing:!0}),incomers:pt(rl({incoming:!0}),"incomers"),predecessors:al({incoming:!0})});ge(rt,{neighborhood:pt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),f=n===l?u:l;f.length>0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});rt.neighbourhood=rt.neighborhood;rt.closedNeighbourhood=rt.closedNeighborhood;rt.openNeighbourhood=rt.openNeighborhood;ge(rt,{source:pt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:pt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:nl({attr:"source"}),targets:nl({attr:"target"})});function nl(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[t.attr];s&&a.push(s)}return this.spawn(a,!0).filter(r)}}ge(rt,{edgesWith:pt(il(),"edgesWith"),edgesTo:pt(il({thisIsSrc:!0}),"edgesTo")});function il(t){return function(r){var a=[],n=this._private.cy,i=t||{};ve(r)&&(r=n.$(r));for(var s=0;s<r.length;s++)for(var o=r[s]._private.edges,l=0;l<o.length;l++){var u=o[l],f=u._private.data,h=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),v=h||c;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!h||i.thisIsTgt&&!c)||a.push(u))}return this.spawn(a,!0)}}ge(rt,{connectedEdges:pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:pt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:pt(sl(),"parallelEdges"),codirectedEdges:pt(sl({codirected:!0}),"codirectedEdges")});function sl(t){var e={codirected:!1};return t=ge({},e,t),function(a){for(var n=[],i=this.edges(),s=t,o=0;o<i.length;o++)for(var l=i[o],u=l._private,f=u.source,h=f._private.data.id,c=u.data.target,v=f._private.edges,d=0;d<v.length;d++){var g=v[d],p=g._private.data,y=p.target,b=p.source,w=y===c&&b===h,D=h===y&&c===b;(s.codirected&&w||!s.codirected&&(w||D))&&n.push(g)}return this.spawn(n,!0).filter(a)}}ge(rt,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(f,h){n.merge(f),i.unmerge(f),h.merge(f)};if(i.empty())return r.spawn();var l=function(){var f=a.collection();s.push(f);var h=i[0];o(h,f),r.bfs({directed:!1,roots:h,visit:function(v){return o(v,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(v){r.has(v)&&f.has(v.source())&&f.has(v.target())&&f.merge(v)})})};do l();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});rt.componentsOf=rt.components;var Qe=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){ze("A collection must have a reference to the core");return}var i=new At,s=!1;if(!r)r=[];else if(r.length>0&&Se(r[0])&&!wa(r[0])){s=!0;for(var o=[],l=new kr,u=0,f=r.length;u<f;u++){var h=r[u];h.data==null&&(h.data={});var c=h.data;if(c.id==null)c.id=ql();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var v=new yn(e,h,!1);o.push(v),l.add(c.id)}r=o}this.length=0;for(var d=0,g=r.length;d<g;d++){var p=r[d][0];if(p!=null){var y=p._private.data.id;(!a||!i.has(y))&&(a&&i.set(y,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(b){this.lazyMap=b},rebuildMap:function(){for(var w=this.lazyMap=new At,D=this.eles,m=0;m<D.length;m++){var x=D[m];w.set(x.id(),{index:m,ele:x})}}},a&&(this._private.map=i),s&&!n&&this.restore()},Pe=yn.prototype=Qe.prototype=Object.create(Array.prototype);Pe.instanceString=function(){return"collection"};Pe.spawn=function(t,e){return new Qe(this.cy(),t,e)};Pe.spawnSelf=function(){return this.spawn(this)};Pe.cy=function(){return this._private.cy};Pe.renderer=function(){return this._private.cy.renderer()};Pe.element=function(){return this[0]};Pe.collection=function(){return Al(this)?this:new Qe(this._private.cy,[this])};Pe.unique=function(){return new Qe(this._private.cy,this,!0)};Pe.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Pe.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new Qe(e)};Pe.$id=Pe.getElementById;Pe.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Pe.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Pe.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Pe.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Se(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),l!=null&&l!=n.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in t.data,f=t.data.parent;u&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var h=function(g,p,y){var b=t[g];b!=null&&b!==a[g]&&(b?e[p]():e[y]())};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"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:Lt(a.data),position:Lt(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var v=0;return a.classes.forEach(function(d){return c.classes+=v++===0?d:" "+d}),c}}};Pe.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};Pe.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new yn(t,n,!1);e.push(i)}return new Qe(t,e)};Pe.copy=Pe.clone;Pe.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],s=[],o,l=0,u=r.length;l<u;l++){var f=r[l];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var h,c=function(){o.splice(h,1),h--};for(h=0;h<o.length;h++){var v=o[h],d=v._private,g=d.data;if(v.clearTraversalCache(),!(!e&&!d.removed)){if(g.id===void 0)g.id=ql();else if(ae(g.id))g.id=""+g.id;else if(Xt(g.id)||!ve(g.id)){ze("Can not create element with invalid string ID `"+g.id+"`"),c();continue}else if(a.hasElementWithId(g.id)){ze("Can not create second element with ID `"+g.id+"`"),c();continue}}var p=g.id;if(v.isNode()){var y=d.position;y.x==null&&(y.x=0),y.y==null&&(y.y=0)}if(v.isEdge()){for(var b=v,w=["source","target"],D=w.length,m=!1,x=0;x<D;x++){var E=w[x],C=g[E];ae(C)&&(C=g[E]=""+g[E]),C==null||C===""?(ze("Can not create edge `"+p+"` with unspecified "+E),m=!0):a.hasElementWithId(C)||(ze("Can not create edge `"+p+"` with nonexistant "+E+" `"+C+"`"),m=!0)}if(m){c();continue}var T=a.getElementById(g.source),L=a.getElementById(g.target);T.same(L)?T._private.edges.push(b):(T._private.edges.push(b),L._private.edges.push(b)),b._private.source=T,b._private.target=L}d.map=new At,d.map.set(p,{ele:v,index:0}),d.removed=!1,e&&a.addToPool(v)}for(var A=0;A<i.length;A++){var S=i[A],M=S._private.data;ae(M.parent)&&(M.parent=""+M.parent);var N=M.parent,P=N!=null;if(P||S._private.parent){var R=S._private.parent?a.collection().merge(S._private.parent):a.getElementById(N);if(R.empty())M.parent=void 0;else if(R[0].removed())Ie("Node added with missing parent, reference to parent removed"),M.parent=void 0,S._private.parent=null;else{for(var I=!1,k=R;!k.empty();){if(S.same(k)){I=!0,M.parent=void 0;break}k=k.parent()}I||(R[0]._private.children.push(S),S._private.parent=R[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var F=o.length===r.length?r:new Qe(a,o),z=0;z<F.length;z++){var B=F[z];B.isNode()||(B.parallelEdges().clearTraversalCache(),B.source().clearTraversalCache(),B.target().clearTraversalCache())}var G;n.hasCompoundNodes?G=a.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):G=F,G.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};Pe.removed=function(){var t=this[0];return t&&t._private.removed};Pe.inside=function(){var t=this[0];return t&&!t._private.removed};Pe.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function s(N){for(var P=N._private.edges,R=0;R<P.length;R++)l(P[R])}function o(N){for(var P=N._private.children,R=0;R<P.length;R++)l(P[R])}function l(N){var P=n[N.id()];e&&N.removed()||P||(n[N.id()]=!0,N.isNode()?(a.push(N),s(N),o(N)):a.unshift(N))}for(var u=0,f=r.length;u<f;u++){var h=r[u];l(h)}function c(N,P){var R=N._private.edges;_t(R,P),N.clearTraversalCache()}function v(N){N.clearTraversalCache()}var d=[];d.ids={};function g(N,P){P=P[0],N=N[0];var R=N._private.children,I=N.id();_t(R,P),P._private.parent=null,d.ids[I]||(d.ids[I]=!0,d.push(N))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var p=0;p<a.length;p++){var y=a[p];if(y.isEdge()){var b=y.source()[0],w=y.target()[0];c(b,y),c(w,y);for(var D=y.parallelEdges(),m=0;m<D.length;m++){var x=D[m];v(x),x.isBundledBezier()&&x.dirtyBoundingBoxCache()}}else{var E=y.parent();E.length!==0&&g(E,y)}e&&(y._private.removed=!0)}var C=i._private.elements;i._private.hasCompoundNodes=!1;for(var T=0;T<C.length;T++){var L=C[T];if(L.isParent()){i._private.hasCompoundNodes=!0;break}}var A=new Qe(this.cy(),a);A.size()>0&&(t?A.emitAndNotify("remove"):e&&A.emit("remove"));for(var S=0;S<d.length;S++){var M=d[S];(!e||!M.removed())&&M.updateStyle()}return A};Pe.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var s=i(t.source),o=i(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var d=r[v],g=d._private.data;d.isEdge()&&(l&&(g.source=s),u&&(g.target=o))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),h=f===null||e.hasElementWithId(f);if(h){var c=f===null?void 0:f;e.batch(function(){var v=r.remove(a,n);v.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var g=r[d],p=g._private.data;g.isNode()&&(p.parent=c)}v.restore(a,n)}),r.emitAndNotify("move")}}return this};[jl,by,Qa,Ht,Rr,Py,En,Qy,mf,bf,rm,fn,Ja,Ze,$t,rt].forEach(function(t){ge(Pe,t)});var lm={add:function(e){var r,a=this;if(ct(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}r=new Qe(a,i)}}else if(Re(e)){var l=e;r=new Qe(a,l)}else if(Se(e)&&(Re(e.nodes)||Re(e.edges))){for(var u=e,f=[],h=["nodes","edges"],c=0,v=h.length;c<v;c++){var d=h[c],g=u[d];if(Re(g))for(var p=0,y=g.length;p<y;p++){var b=ge({group:d},g[p]);f.push(b)}}r=new Qe(a,f)}else{var w=e;r=new yn(a,w).collection()}return r},remove:function(e){if(!ct(e)){if(ve(e)){var r=e;e=this.$(r)}}return e.remove()}};function fm(t,e,r,a){var n=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),f=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;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(l):new Array(l);function v(L,A){return 1-3*A+3*L}function d(L,A){return 3*A-6*L}function g(L){return 3*L}function p(L,A,S){return((v(A,S)*L+d(A,S))*L+g(A))*L}function y(L,A,S){return 3*v(A,S)*L*L+2*d(A,S)*L+g(A)}function b(L,A){for(var S=0;S<n;++S){var M=y(A,t,r);if(M===0)return A;var N=p(A,t,r)-L;A-=N/M}return A}function w(){for(var L=0;L<l;++L)c[L]=p(L*u,t,r)}function D(L,A,S){var M,N,P=0;do N=A+(S-A)/2,M=p(N,t,r)-L,M>0?S=N:A=N;while(Math.abs(M)>s&&++P<o);return N}function m(L){for(var A=0,S=1,M=l-1;S!==M&&c[S]<=L;++S)A+=u;--S;var N=(L-c[S])/(c[S+1]-c[S]),P=A+N*u,R=y(P,t,r);return R>=i?b(L,P):R===0?P:D(L,A,A+u)}var x=!1;function E(){x=!0,(t!==e||r!==a)&&w()}var C=function(A){return x||E(),t===e&&r===a?A:A===0?0:A===1?1:p(m(A),e,a)};C.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var T="generateBezier("+[t,e,r,a]+")";return C.toString=function(){return T},C}var hm=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,h=16/1e3,c,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(u=a(n,i),v=u/s*h):v=h;d=r(d||o,v),l.push(1+d.x),u+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(g){return l[g*(l.length-1)|0]}:u}}(),ke=function(e,r,a,n){var i=fm(e,r,a,n);return function(s,o,l){return s+(o-s)*i(l)}},ja={linear:function(e,r,a){return e+(r-e)*a},ease:ke(.25,.1,.25,1),"ease-in":ke(.42,0,1,1),"ease-out":ke(0,0,.58,1),"ease-in-out":ke(.42,0,.58,1),"ease-in-sine":ke(.47,0,.745,.715),"ease-out-sine":ke(.39,.575,.565,1),"ease-in-out-sine":ke(.445,.05,.55,.95),"ease-in-quad":ke(.55,.085,.68,.53),"ease-out-quad":ke(.25,.46,.45,.94),"ease-in-out-quad":ke(.455,.03,.515,.955),"ease-in-cubic":ke(.55,.055,.675,.19),"ease-out-cubic":ke(.215,.61,.355,1),"ease-in-out-cubic":ke(.645,.045,.355,1),"ease-in-quart":ke(.895,.03,.685,.22),"ease-out-quart":ke(.165,.84,.44,1),"ease-in-out-quart":ke(.77,0,.175,1),"ease-in-quint":ke(.755,.05,.855,.06),"ease-out-quint":ke(.23,1,.32,1),"ease-in-out-quint":ke(.86,0,.07,1),"ease-in-expo":ke(.95,.05,.795,.035),"ease-out-expo":ke(.19,1,.22,1),"ease-in-out-expo":ke(1,0,0,1),"ease-in-circ":ke(.6,.04,.98,.335),"ease-out-circ":ke(.075,.82,.165,1),"ease-in-out-circ":ke(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return ja.linear;var n=hm(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":ke};function ol(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function ul(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function xr(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=ul(t,n),o=ul(e,n);if(ae(s)&&ae(o))return ol(i,s,o,r,a);if(Re(s)&&Re(o)){for(var l=[],u=0;u<o.length;u++){var f=s[u],h=o[u];if(f!=null&&h!=null){var c=ol(i,f,h,r,a);l.push(c)}else l.push(h)}return l}}function cm(t,e,r,a){var n=!a,i=t._private,s=e._private,o=s.easing,l=s.startTime,u=a?t:t.cy(),f=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=ja.linear;else{var h;if(ve(o)){var c=f.parse("transition-timing-function",o);h=c.value}else h=o;var v,d;ve(h)?(v=h,d=[]):(v=h[1],d=h.slice(2).map(function(F){return+F})),d.length>0?(v==="spring"&&d.push(s.duration),s.easingImpl=ja[v].apply(null,d)):s.easingImpl=ja[v]}var g=s.easingImpl,p;if(s.duration===0?p=1:p=(r-l)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),s.delay==null){var y=s.startPosition,b=s.position;if(b&&n&&!t.locked()){var w={};ta(y.x,b.x)&&(w.x=xr(y.x,b.x,p,g)),ta(y.y,b.y)&&(w.y=xr(y.y,b.y,p,g)),t.position(w)}var D=s.startPan,m=s.pan,x=i.pan,E=m!=null&&a;E&&(ta(D.x,m.x)&&(x.x=xr(D.x,m.x,p,g)),ta(D.y,m.y)&&(x.y=xr(D.y,m.y,p,g)),t.emit("pan"));var C=s.startZoom,T=s.zoom,L=T!=null&&a;L&&(ta(C,T)&&(i.zoom=ca(i.minZoom,xr(C,T,p,g),i.maxZoom)),t.emit("zoom")),(E||L)&&t.emit("viewport");var A=s.style;if(A&&A.length>0&&n){for(var S=0;S<A.length;S++){var M=A[S],N=M.name,P=M,R=s.startStyle[N],I=f.properties[R.name],k=xr(R,P,p,g,I);f.overrideBypass(t,N,k)}t.emit("style")}}return s.progress=p,p}function ta(t,e){return t==null||e==null?!1:ae(t)&&ae(e)?!0:!!(t&&e)}function vm(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function ll(t,e){var r=e._private.aniEles,a=[];function n(f,h){var c=f._private,v=c.animation.current,d=c.animation.queue,g=!1;if(v.length===0){var p=d.shift();p&&v.push(p)}for(var y=function(x){for(var E=x.length-1;E>=0;E--){var C=x[E];C()}x.splice(0,x.length)},b=v.length-1;b>=0;b--){var w=v[b],D=w._private;if(D.stopped){v.splice(b,1),D.hooked=!1,D.playing=!1,D.started=!1,y(D.frames);continue}!D.playing&&!D.applying||(D.playing&&D.applying&&(D.applying=!1),D.started||vm(f,w,t),cm(f,w,t,h),D.applying&&(D.applying=!1),y(D.frames),D.step!=null&&D.step(t),w.completed()&&(v.splice(b,1),D.hooked=!1,D.playing=!1,D.started=!1,y(D.completes)),g=!0)}return!h&&v.length===0&&d.length===0&&a.push(f),g}for(var i=!1,s=0;s<r.length;s++){var o=r[s],l=n(o);i=i||l}var u=n(e,!0);(i||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var dm={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&nn(function(i){ll(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){ll(s,e)},a.beforeRenderPriorities.animations):r()}},gm={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},_a=function(e){return ve(e)?new Wt(e):e},xf={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new wn(gm,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,_a(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,_a(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,_a(r),a),this},once:function(e,r,a){return this.emitter().one(e,_a(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ne.eventAliasesOn(xf);var ni={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};ni.jpeg=ni.jpg;var en={layout:function(e){var r=this;if(e==null){ze("Layout options must be specified to make a layout");return}if(e.name==null){ze("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){ze("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ve(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n(ge({},e,{cy:r,eles:i}));return s}};en.createLayout=en.makeLayout=en.layout;var pm={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.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 r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i],o=r.getElementById(i);o.data(s)}})}},ym=Je({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),ii={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),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 r=this,a=r.extension("renderer",e.name);if(a==null){ze("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&&Ie("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 n=ym(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ii.invalidateDimensions=ii.resize;var tn={collection:function(e,r){return ve(e)?this.$(e):ct(e)?e.collection():Re(e)?(r||(r={}),new Qe(this,e,r.unique,r.removed)):new Qe(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};tn.elements=tn.filter=tn.$;var nt={},sa="t",mm="f";nt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var s=t[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n};nt.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},l=0;l<r.length;l++){var u=r[l],f=t[l]===sa,h=e[l]===sa,c=f!==h,v=u.mappedProperties.length>0;if(c||h&&v){var d=void 0;c&&v||c?d=u.properties:v&&(d=u.mappedProperties);for(var g=0;g<d.length;g++){for(var p=d[g],y=p.name,b=!1,w=l+1;w<r.length;w++){var D=r[w],m=e[w]===sa;if(m&&(b=D.properties[p.name]!=null,b))break}!o[y]&&!b&&(o[y]=!0,s.push(y))}}}return a[n]=s,s};nt.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(t);o?r+=sa:r+=mm}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};nt.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var s=r[i],o=e[i]===sa;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];n[u.name]=u}}return a[e]=n,n};nt.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var l=n[o],u=e[l],f=r.pstyle(l);if(!u)if(f)f.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(f!==u){if(u.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===u.value){var h=f.mapping,c=h.fnValue=u.value(r);if(c===h.prevFnValue)continue}var v=i[l]={prev:f};a.applyParsedProperty(r,u),v.next=r.pstyle(l),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}};nt.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(ee,ie,de){return r.getPropertiesHash(ee,ie,de)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var f=n[u];e.styleKeys[f]=[Cr,ra]}for(var h=function(ee,ie){return e.styleKeys[ie][0]=la(ee,e.styleKeys[ie][0])},c=function(ee,ie){return e.styleKeys[ie][1]=fa(ee,e.styleKeys[ie][1])},v=function(ee,ie){h(ee,ie),c(ee,ie)},d=function(ee,ie){for(var de=0;de<ee.length;de++){var te=ee.charCodeAt(de);h(te,ie),c(te,ie)}},g=2e9,p=function(ee){return-128<ee&&ee<128&&Math.floor(ee)!==ee?g-(ee*1024|0):ee},y=0;y<a.length;y++){var b=a[y],w=l[b];if(w!=null){var D=this.properties[b],m=D.type,x=D.groupKey,E=void 0;D.hashOverride!=null?E=D.hashOverride(t,w):w.pfValue!=null&&(E=w.pfValue);var C=D.enums==null?w.value:null,T=E!=null,L=C!=null,A=T||L,S=w.units;if(m.number&&A&&!m.multiple){var M=T?E:C;v(p(M),x),!T&&S!=null&&d(S,x)}else d(w.strValue,x)}}for(var N=[Cr,ra],P=0;P<n.length;P++){var R=n[P],I=e.styleKeys[R];N[0]=la(I[0],N[0]),N[1]=fa(I[1],N[1])}e.styleKey=Ig(N[0],N[1]);var k=e.styleKeys;e.labelDimsKey=qt(k.labelDimensions);var F=i(t,["label"],k.labelDimensions);if(e.labelKey=qt(F),e.labelStyleKey=qt(Ga(k.commonLabel,F)),!o){var z=i(t,["source-label"],k.labelDimensions);e.sourceLabelKey=qt(z),e.sourceLabelStyleKey=qt(Ga(k.commonLabel,z));var B=i(t,["target-label"],k.labelDimensions);e.targetLabelKey=qt(B),e.targetLabelStyleKey=qt(Ga(k.commonLabel,B))}if(o){var G=e.styleKeys,$=G.nodeBody,X=G.nodeBorder,Y=G.nodeOutline,_=G.backgroundImage,q=G.compound,K=G.pie,j=[$,X,Y,_,q,K].filter(function(Q){return Q!=null}).reduce(Ga,[Cr,ra]);e.nodeKey=qt(j),e.hasPie=K!=null&&K[0]!==Cr&&K[1]!==ra}return s!==e.styleKey};nt.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null};nt.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,s=r.types,o=r.properties[a.name].type,l=a.bypass,u=n[a.name],f=u&&u.bypass,h=t._private,c="mapping",v=function($){return $==null?null:$.pfValue!=null?$.pfValue:$.value},d=function(){var $=v(u),X=v(a);r.checkTriggers(t,a.name,$,X)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",l)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return u?u.bypass?(n[a.name]=u.bypassed,d(),!0):!1:(d(),!0);var g=function(){Ie("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case s.mapData:{for(var p=a.field.split("."),y=h.data,b=0;b<p.length&&y;b++){var w=p[b];y=y[w]}if(y==null)return g(),!1;var D;if(ae(y)){var m=a.fieldMax-a.fieldMin;m===0?D=0:D=(y-a.fieldMin)/m}else return Ie("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+y+"` for `"+t.id()+"` is non-numeric)"),!1;if(D<0?D=0:D>1&&(D=1),o.color){var x=a.valueMin[0],E=a.valueMax[0],C=a.valueMin[1],T=a.valueMax[1],L=a.valueMin[2],A=a.valueMax[2],S=a.valueMin[3]==null?1:a.valueMin[3],M=a.valueMax[3]==null?1:a.valueMax[3],N=[Math.round(x+(E-x)*D),Math.round(C+(T-C)*D),Math.round(L+(A-L)*D),Math.round(S+(M-S)*D)];i={bypass:a.bypass,name:a.name,value:N,strValue:"rgb("+N[0]+", "+N[1]+", "+N[2]+")"}}else if(o.number){var P=a.valueMin+(a.valueMax-a.valueMin)*D;i=this.parse(a.name,P,a.bypass,c)}else return!1;if(!i)return g(),!1;i.mapping=a,a=i;break}case s.data:{for(var R=a.field.split("."),I=h.data,k=0;k<R.length&&I;k++){var F=R[k];I=I[F]}if(I!=null&&(i=this.parse(a.name,I,a.bypass,c)),!i)return g(),!1;i.mapping=a,a=i;break}case s.fn:{var z=a.value,B=a.fnValue!=null?a.fnValue:z(t);if(a.prevFnValue=B,B==null)return Ie("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,B,a.bypass,c),!i)return Ie("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=Lt(a),a=i;break}case void 0:break;default:return!1}return l?(f?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):f?u.bypassed=a:n[a.name]=a,d(),!0};nt.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],l=n[o];l!=null&&(l.bypass?l.bypassed=null:n[o]=null)}}};nt.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};nt.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},l=!1,u=0;u<n.length;u++){var f=n[u],h=t.pstyle(f),c=e[f];if(c){var v=c.prev,d=v,g=c.next!=null?c.next:h,p=!1,y=void 0,b=1e-6;d&&(ae(d.pfValue)&&ae(g.pfValue)?(p=g.pfValue-d.pfValue,y=d.pfValue+b*p):ae(d.value)&&ae(g.value)?(p=g.value-d.value,y=d.value+b*p):Re(d.value)&&Re(g.value)&&(p=d.value[0]!==g.value[0]||d.value[1]!==g.value[1]||d.value[2]!==g.value[2],y=d.strValue),p&&(o[f]=g.strValue,this.applyBypass(t,f,y),l=!0))}}if(!l)return;a.transitioning=!0,new Pr(function(w){s>0?t.delayAnimation(s).play().promise().then(w):w()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};nt.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)};nt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};nt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||a==="bezier")&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||a==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};nt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Ca={};Ca.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;o<n.properties.length;o++){var l=n.properties[o],u=l.name,f=this.parse(u,r,!0);f&&i.push(f)}}else if(ve(e)){var h=this.parse(e,r,!0);h&&i.push(h)}else if(Se(e)){var c=e;a=r;for(var v=Object.keys(c),d=0;d<v.length;d++){var g=v[d],p=c[g];if(p===void 0&&(p=c[pn(g)]),p!==void 0){var y=this.parse(g,p,!0);y&&i.push(y)}}}else return!1;if(i.length===0)return!1;for(var b=!1,w=0;w<t.length;w++){for(var D=t[w],m={},x=void 0,E=0;E<i.length;E++){var C=i[E];if(a){var T=D.pstyle(C.name);x=m[C.name]={prev:T}}b=this.applyParsedProperty(D,Lt(C))||b,a&&(x.next=D.pstyle(C.name))}b&&this.updateStyleHints(D),a&&this.updateTransitions(D,m,s)}return b};Ca.overrideBypass=function(t,e,r){e=vi(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),o?i.strValue="rgb("+r.join(",")+")":l?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,u,r)}};Ca.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Ca.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],f=i.pstyle(u.name);if(!(!f||!f.bypass)){var h="",c=this.parse(l,h,!0),v=s[u.name]={prev:f};this.applyParsedProperty(i,c),v.next=i.pstyle(u.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,s,a)}};var Ci={};Ci.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};Ci.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var Ot={};Ot.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};Ot.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],s=r.getStylePropertyValue(t,i.name,e);s!=null&&(a[i.name]=s,a[pn(i.name)]=s)}return a}};Ot.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n??t.cy().style().getDefaultProperty(e)[r][0]};Ot.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=t.pstyle(n.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(r&&i.number&&o!=null&&ae(o)){var f=t.cy().zoom(),h=function(p){return p*f},c=function(p,y){return h(p)+y},v=Re(o),d=v?l.every(function(g){return g!=null}):l!=null;return d?v?o.map(function(g,p){return c(g,l[p])}).join(" "):c(o,l):v?o.map(function(g){return ve(g)?g:""+h(g)}).join(" "):""+h(o)}else if(u!=null)return u}return null}};Ot.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=t.pstyle(i);s!==void 0&&(Se(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(r[i]=s)}return r};Ot.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o],u=n[o]||n[vi(o)],f=this.parse(u.name,l);f&&r.push(f)}return r};Ot.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,s,o,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=la(o,a[0]),a[1]=fa(o,a[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),a[0]=la(o,a[0]),a[1]=fa(o,a[1]);return a};Ot.getPropertiesHash=Ot.getNonDefaultPropertiesHash;var Cn={};Cn.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e};Cn.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};Cn.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var Di={};Di.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Ie("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new Wt(h);if(c.invalid){Ie("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var v=f[2],d=!1;i=v;for(var g=[];;){var p=i.match(/^\s*$/);if(p)break;var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Ie("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=y[0];var b=y[1],w=y[2],D=e.properties[b];if(!D){Ie("Skipping property: Invalid property name in: "+s),l();continue}var m=r.parse(b,w);if(!m){Ie("Skipping property: Invalid property definition in: "+s),l();continue}g.push({name:b,val:w}),l()}if(d){o();break}r.selector(h);for(var x=0;x<g.length;x++){var E=g[x];r.css(E.name,E.val)}o()}return r};Di.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Ke={};(function(){var t=Ue,e=mg,r=Eg,a=wg,n=xg,i=function(j){return"^"+j+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(j){var Q=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+j+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+Q+")\\s*\\,\\s*("+Q+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Ke.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:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,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(j,Q){switch(j.length){case 2:return Q[0]!=="deg"&&Q[0]!=="rad"&&Q[1]!=="deg"&&Q[1]!=="rad";case 1:return ve(j[0])||Q[0]==="deg"||Q[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\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(j){var Q=j.length;return Q===1||Q===2||Q===4}}};var l={zeroNonZero:function(j,Q){return(j==null||Q==null)&&j!==Q||j==0&&Q!=0?!0:j!=0&&Q==0},any:function(j,Q){return j!=Q},emptyNonEmpty:function(j,Q){var ee=Xt(j),ie=Xt(Q);return ee&&!ie||!ee&&ie}},u=Ke.types,f=[{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}],c=[{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}],v=[{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}],d=[{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}],g=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],p=[{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}],y=[{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}],b=[{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}],w=[{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}],D=function(j,Q){return Q.value==="label"?-j.poolIndex():Q.pfValue},m=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:D},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:D},{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}],x=[{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}],E=[{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}],C=[{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}],T=[{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}],L=[{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}],S=[{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}],M=[];Ke.pieBackgroundN=16,M.push({name:"pie-size",type:u.sizeMaybePercent});for(var N=1;N<=Ke.pieBackgroundN;N++)M.push({name:"pie-"+N+"-background-color",type:u.color}),M.push({name:"pie-"+N+"-background-size",type:u.percent}),M.push({name:"pie-"+N+"-background-opacity",type:u.zeroOneNumber});var P=[],R=Ke.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(K){R.forEach(function(j){var Q=j+"-"+K.name,ee=K.type,ie=K.triggersBounds;P.push({name:Q,type:ee,triggersBounds:ie})})},{});var I=Ke.properties=[].concat(g,w,p,y,b,A,d,v,f,h,c,m,x,E,C,M,T,L,P,S),k=Ke.propertyGroups={behavior:g,transition:w,visibility:p,overlay:y,underlay:b,ghost:A,commonLabel:d,labelDimensions:v,mainLabel:f,sourceLabel:h,targetLabel:c,nodeBody:m,nodeBorder:x,nodeOutline:E,backgroundImage:C,pie:M,compound:T,edgeLine:L,edgeArrow:P,core:S},F=Ke.propertyGroupNames={},z=Ke.propertyGroupKeys=Object.keys(k);z.forEach(function(K){F[K]=k[K].map(function(j){return j.name}),k[K].forEach(function(j){return j.groupKey=K})});var B=Ke.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"}];Ke.propertyNames=I.map(function(K){return K.name});for(var G=0;G<I.length;G++){var $=I[G];I[$.name]=$}for(var X=0;X<B.length;X++){var Y=B[X],_=I[Y.pointsTo],q={name:Y.name,alias:!0,pointsTo:_};I.push(q),I[Y.name]=q}})();Ke.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Ke.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=ge({"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 f=1;f<=Ke.pieBackgroundN;f++){var h=u.name.replace("{{i}}",f),c=u.value;l[h]=c}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 Ke.arrowPrefixes.forEach(function(f){var h=f+"-"+u.name,c=u.value;l[h]=c}),l},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);r[i]=o}}return t.defaultProperties=r,t.defaultProperties};Ke.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 Dn={};Dn.parse=function(t,e,r,a){var n=this;if(Fe(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=r?"t":"f",o=""+e,l=Fl(t,o,s,i),u=n.propCache=n.propCache||[],f;return(f=u[l])||(f=u[l]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=Lt(f),f&&(f.value=Lt(f.value))),f};Dn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Ie("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Ie("The style value of `label` is deprecated for `"+n.name+"`"),n};Dn.parseImpl=function(t,e,r,a){var n=this;t=vi(t);var i=n.properties[t],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var l=ve(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Fe(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:r};var f,h;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var c=o.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(t,h[4]);if(!d||d.mapped)return!1;var g=this.parse(t,h[5]);if(!g||g.mapped)return!1;if(d.pfValue===g.pfValue||d.strValue===g.strValue)return Ie("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(u.color){var p=d.value,y=g.value,b=p[0]===y[0]&&p[1]===y[1]&&p[2]===y[2]&&(p[3]===y[3]||(p[3]==null||p[3]===1)&&(y[3]==null||y[3]===1));if(b)return!1}return{name:t,value:h,strValue:""+e,mapped:v,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:d.value,valueMax:g.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var w;if(l?w=e.split(/\s+/):Re(e)?w=e:w=[e],u.evenMultiple&&w.length%2!==0)return null;for(var D=[],m=[],x=[],E="",C=!1,T=0;T<w.length;T++){var L=n.parse(t,w[T],r,"multiple");C=C||ve(L.value),D.push(L.value),x.push(L.pfValue!=null?L.pfValue:L.value),m.push(L.units),E+=(T>0?" ":"")+L.strValue}return u.validate&&!u.validate(D,m)?null:u.singleEnum&&C?D.length===1&&ve(D[0])?{name:t,value:D[0],strValue:D[0],bypass:r}:null:{name:t,value:D,pfValue:x,strValue:E,bypass:r,units:m}}var A=function(){for(var j=0;j<u.enums.length;j++){var Q=u.enums[j];if(Q===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var S,M="px";if(u.units&&(S=u.units),u.implicitUnits&&(M=u.implicitUnits),!u.unitless)if(l){var N="px|em"+(u.allowPercent?"|\\%":"");S&&(N=S);var P=e.match("^("+Ue+")("+N+")?$");P&&(e=P[1],S=P[2]||M)}else(!S||u.implicitUnits)&&(S=M);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,A();if(u.integer&&!hg(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var R={name:t,value:e,strValue:""+e+(S||""),units:S,bypass:r};return u.unitless||S!=="px"&&S!=="em"?R.pfValue=e:R.pfValue=S==="px"||!S?e:this.getEmSizeInPixels()*e,(S==="ms"||S==="s")&&(R.pfValue=S==="ms"?e:1e3*e),(S==="deg"||S==="rad")&&(R.pfValue=S==="rad"?e:sp(e)),S==="%"&&(R.pfValue=e/100),R}else if(u.propList){var I=[],k=""+e;if(k!=="none"){for(var F=k.split(/\s*,\s*|\s+/),z=0;z<F.length;z++){var B=F[z].trim();n.properties[B]?I.push(B):Ie("`"+B+"` is not a valid property name")}if(I.length===0)return null}return{name:t,value:I,strValue:I.length===0?"none":I.join(" "),bypass:r}}else if(u.color){var G=Ag(e);return G?{name:t,value:G,pfValue:G,strValue:"rgb("+G[0]+","+G[1]+","+G[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var $=A();if($)return $}for(var X=u.regexes?u.regexes:[u.regex],Y=0;Y<X.length;Y++){var _=new RegExp(X[Y]),q=_.exec(e);if(q)return{name:t,value:u.singleRegexMatchValue?q[1]:q,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?A():null};var tt=function t(e){if(!(this instanceof t))return new t(e);if(!ci(e)){ze("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},at=tt.prototype;at.instanceString=function(){return"style"};at.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};at.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};at.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};at.selector=function(t){var e=t==="core"?null:new Wt(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};at.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[pn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};at.style=at.css;at.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};at.append=function(t){return Ol(t)?t.appendToStyle(this):Re(t)?this.appendFromJson(t):ve(t)&&this.appendFromString(t),this};tt.fromJson=function(t,e){var r=new tt(t);return r.fromJson(e),r};tt.fromString=function(t,e){return new tt(t).fromString(e)};[nt,Ca,Ci,Ot,Cn,Di,Ke,Dn].forEach(function(t){ge(at,t)});tt.types=at.types;tt.properties=at.properties;tt.propertyGroups=at.propertyGroups;tt.propertyGroupNames=at.propertyGroupNames;tt.propertyGroupKeys=at.propertyGroupKeys;var bm={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return Ol(e)?r.style=e.generateStyle(this):Re(e)?r.style=tt.fromJson(this,e):ve(e)?r.style=tt.fromString(this,e):r.style=tt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Em="single",ur={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 r=this._private;if(r.selectionType==null&&(r.selectionType=Em),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.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,r=this._private.pan,a,n,i,s,o;switch(e.length){case 0:return r;case 1:if(ve(e[0]))return a=e[0],r[a];if(Se(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,ae(s)&&(r.x=s),ae(o)&&(r.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ae(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,s,o,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Se(e)&&(o=a[0],l=o.x,u=o.y,ae(l)&&(n.x+=l),ae(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,s=r,(i==="x"||i==="y")&&ae(s)&&(n[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(ae(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(ve(e)){var n=e;e=this.$(n)}else if(dg(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else ct(e)||(e=this.mutableElements());if(!(ct(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),l;if(r=ae(r)?r:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*r)/a.w,(o-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(s-l*(a.x1+a.x2))/2,y:(o-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return ae(e)&&ae(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):ae(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:ae(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),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 r=this._private,a=r.pan,n=r.zoom,i,s,o=!1;if(r.zoomingEnabled||(o=!0),ae(e)?s=e:Se(e)&&(s=e.level,e.position!=null?i=mn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,o||!ae(s)||s===n||i!=null&&(!ae(i.x)||!ae(i.y)))return null;if(i!=null){var l=a,u=n,f=s,h={x:-f/u*(i.x-l.x)+i.x,y:-f/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:h}}else return{zoomed:!0,panned:!1,zoom:s,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(ae(e.zoom)||(a=!1),Se(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;ae(u.x)&&(r.pan.x=u.x,o=!1),ae(u.y)&&(r.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ve(e)){var a=e;e=this.mutableElements().filter(a)}else ct(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},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,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.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,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};ur.centre=ur.center;ur.autolockNodes=ur.autolock;ur.autoungrabifyNodes=ur.autoungrabify;var pa={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};pa.attr=pa.data;pa.removeAttr=pa.removeData;var ya=function(e){var r=this;e=ge({},e);var a=e.container;a&&!an(a)&&an(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var s=Ve!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=ge({name:s?"grid":"null"},o.layout),o.renderer=ge({name:s?"canvas":"null"},o.renderer);var l=function(d,g,p){return g!==void 0?g:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:o,elements:new Qe(this),listeners:[],aniEles:new Qe(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:Se(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:Se(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,g){var p=d.some(gg);if(p)return Pr.all(d).then(g);g(d)};u.styleEnabled&&r.setStyle([]);var h=ge({},o,o.renderer);r.initRenderer(h);var c=function(d,g,p){r.notifications(!1);var y=r.mutableElements();y.length>0&&y.remove(),d!=null&&(Se(d)||Re(d))&&r.add(d),r.one("layoutready",function(w){r.notifications(!0),r.emit(w),r.one("load",g),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",p),r.emit("done")});var b=ge({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};f([o.style,o.elements],function(v){var d=v[0],g=v[1];u.styleEnabled&&r.style().append(d),c(g,function(){r.startAnimationLoop(),u.ready=!0,Fe(o.ready)&&r.on("ready",o.ready);for(var p=0;p<i.length;p++){var y=i[p];r.on("ready",y)}n&&(n.readies=[]),r.emit("ready")},o.done)})},hn=ya.prototype;ge(hn,{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 Ve;var r=this._private.container.ownerDocument;return r===void 0||r==null?Ve:r.defaultView||Ve},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!an(e)&&an(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(ge({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Lt(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(D){return r.getElementById(D.id())};if(Se(e)){if(r.startBatch(),e.elements){var s={},o=function(D,m){for(var x=[],E=[],C=0;C<D.length;C++){var T=D[C];if(!T.data.id){Ie("cy.json() cannot handle elements without an ID attribute");continue}var L=""+T.data.id,A=r.getElementById(L);s[L]=!0,A.length!==0?E.push({ele:A,json:T}):(m&&(T.group=m),x.push(T))}r.add(x);for(var S=0;S<E.length;S++){var M=E[S],N=M.ele,P=M.json;N.json(P)}};if(Re(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var f=l[u],h=e.elements[f];Re(h)&&o(h,f)}var c=r.collection();n.filter(function(w){return!s[w.id()]}).forEach(function(w){w.isParent()?c.merge(w):w.remove()}),c.forEach(function(w){return w.children().move({parent:null})}),c.forEach(function(w){return i(w).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<v.length;d++){var g=v[d];e[g]!=null&&r[g](e[g])}return r.endBatch(),this}else{var p=!!e,y={};p?y.elements=this.elements().map(function(w){return w.json()}):(y.elements={},n.forEach(function(w){var D=w.group();y.elements[D]||(y.elements[D]=[]),y.elements[D].push(w.json())})),this._private.styleEnabled&&(y.style=r.style().json()),y.data=Lt(r.data());var b=a.options;return y.zoomingEnabled=a.zoomingEnabled,y.userZoomingEnabled=a.userZoomingEnabled,y.zoom=a.zoom,y.minZoom=a.minZoom,y.maxZoom=a.maxZoom,y.panningEnabled=a.panningEnabled,y.userPanningEnabled=a.userPanningEnabled,y.pan=Lt(a.pan),y.boxSelectionEnabled=a.boxSelectionEnabled,y.renderer=Lt(b.renderer),y.hideEdgesOnViewport=b.hideEdgesOnViewport,y.textureOnViewport=b.textureOnViewport,y.wheelSensitivity=b.wheelSensitivity,y.motionBlur=b.motionBlur,y.multiClickDebounceTime=b.multiClickDebounceTime,y}}});hn.$id=hn.getElementById;[lm,dm,xf,ni,en,pm,ii,tn,bm,ur,pa].forEach(function(t){ge(hn,t)});var wm={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},xm={maximal:!1,acyclic:!1},Tr=function(e){return e.scratch("breadthfirst")},fl=function(e,r){return e.scratch("breadthfirst",r)};function Tf(t){this.options=ge({},wm,xm,t)}Tf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().filter(function(te){return!te.isParent()}),i=a,s=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,l=ht(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(ct(e.roots))u=e.roots;else if(Re(e.roots)){for(var f=[],h=0;h<e.roots.length;h++){var c=e.roots[h],v=r.getElementById(c);f.push(v)}u=r.collection(f)}else if(ve(e.roots))u=r.$(e.roots);else if(s)u=n.roots();else{var d=a.components();u=r.collection();for(var g=function(re){var fe=d[re],le=fe.maxDegree(!1),oe=fe.filter(function(he){return he.degree(!1)===le});u=u.add(oe)},p=0;p<d.length;p++)g(p)}var y=[],b={},w=function(re,fe){y[fe]==null&&(y[fe]=[]);var le=y[fe].length;y[fe].push(re),fl(re,{index:le,depth:fe})},D=function(re,fe){var le=Tr(re),oe=le.depth,he=le.index;y[oe][he]=null,w(re,fe)};i.bfs({roots:u,directed:e.directed,visit:function(re,fe,le,oe,he){var Te=re[0],we=Te.id();w(Te,he),b[we]=!0}});for(var m=[],x=0;x<n.length;x++){var E=n[x];b[E.id()]||m.push(E)}var C=function(re){for(var fe=y[re],le=0;le<fe.length;le++){var oe=fe[le];if(oe==null){fe.splice(le,1),le--;continue}fl(oe,{depth:re,index:le})}},T=function(){for(var re=0;re<y.length;re++)C(re)},L=function(re,fe){for(var le=Tr(re),oe=re.incomers().filter(function(O){return O.isNode()&&a.has(O)}),he=-1,Te=re.id(),we=0;we<oe.length;we++){var pe=oe[we],xe=Tr(pe);he=Math.max(he,xe.depth)}if(le.depth<=he){if(!e.acyclic&&fe[Te])return null;var U=he+1;return D(re,U),fe[Te]=U,!0}return!1};if(s&&o){var A=[],S={},M=function(re){return A.push(re)},N=function(){return A.shift()};for(n.forEach(function(te){return A.push(te)});A.length>0;){var P=N(),R=L(P,S);if(R)P.outgoers().filter(function(te){return te.isNode()&&a.has(te)}).forEach(M);else if(R===null){Ie("Detected double maximal shift for node `"+P.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}T();var I=0;if(e.avoidOverlap)for(var k=0;k<n.length;k++){var F=n[k],z=F.layoutDimensions(e),B=z.w,G=z.h;I=Math.max(I,B,G)}var $={},X=function(re){if($[re.id()])return $[re.id()];for(var fe=Tr(re).depth,le=re.neighborhood(),oe=0,he=0,Te=0;Te<le.length;Te++){var we=le[Te];if(!(we.isEdge()||we.isParent()||!n.has(we))){var pe=Tr(we);if(pe!=null){var xe=pe.index,U=pe.depth;if(!(xe==null||U==null)){var O=y[U].length;U<fe&&(oe+=xe/O,he++)}}}}return he=Math.max(1,he),oe=oe/he,he===0&&(oe=0),$[re.id()]=oe,oe},Y=function(re,fe){var le=X(re),oe=X(fe),he=le-oe;return he===0?Il(re.id(),fe.id()):he};e.depthSort!==void 0&&(Y=e.depthSort);for(var _=0;_<y.length;_++)y[_].sort(Y),C(_);for(var q=[],K=0;K<m.length;K++)q.push(m[K]);y.unshift(q),T();for(var j=0,Q=0;Q<y.length;Q++)j=Math.max(y[Q].length,j);var ee={x:l.x1+l.w/2,y:l.x1+l.h/2},ie=y.reduce(function(te,re){return Math.max(te,re.length)},0),de=function(re){var fe=Tr(re),le=fe.depth,oe=fe.index,he=y[le].length,Te=Math.max(l.w/((e.grid?ie:he)+1),I),we=Math.max(l.h/(y.length+1),I),pe=Math.min(l.w/2/y.length,l.h/2/y.length);if(pe=Math.max(pe,I),e.circle){var U=pe*le+pe-(y.length>0&&y[0].length<=3?pe/2:0),O=2*Math.PI/y[le].length*oe;return le===0&&y[0].length===1&&(U=1),{x:ee.x+U*Math.cos(O),y:ee.y+U*Math.sin(O)}}else{var xe={x:ee.x+(oe+1-(he+1)/2)*Te,y:(le+1)*we};return xe}};return a.nodes().layoutPositions(this,e,de),this};var Tm={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Cf(t){this.options=ge({},Tm,t)}Cf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=ht(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,h=0,c=0;c<i.length;c++){var v=i[c],d=v.layoutDimensions(e),g=d.w,p=d.h;h=Math.max(h,g,p)}if(ae(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-h,i.length>1&&e.avoidOverlap){h*=1.75;var y=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),w=Math.sqrt(h*h/(y*y+b*b));f=Math.max(w,f)}var D=function(x,E){var C=e.startAngle+E*u*(n?1:-1),T=f*Math.cos(C),L=f*Math.sin(C),A={x:o.x+T,y:o.y+L};return A};return a.nodes().layoutPositions(this,e,D),this};var Cm={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Df(t){this.options=ge({},Cm,t)}Df.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),s=ht(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f<i.length;f++){var h=i[f],c=void 0;c=e.concentric(h),l.push({value:c,node:h}),h._private.scratch.concentric=c}i.updateStyle();for(var v=0;v<i.length;v++){var d=i[v],g=d.layoutDimensions(e);u=Math.max(u,g.w,g.h)}l.sort(function(te,re){return re.value-te.value});for(var p=e.levelWidth(i),y=[[]],b=y[0],w=0;w<l.length;w++){var D=l[w];if(b.length>0){var m=Math.abs(b[0].value-D.value);m>=p&&(b=[],y.push(b))}b.push(D)}var x=u+e.minNodeSpacing;if(!e.avoidOverlap){var E=y.length>0&&y[0].length>1,C=Math.min(s.w,s.h)/2-x,T=C/(y.length+E?1:0);x=Math.min(x,T)}for(var L=0,A=0;A<y.length;A++){var S=y[A],M=e.sweep===void 0?2*Math.PI-2*Math.PI/S.length:e.sweep,N=S.dTheta=M/Math.max(1,S.length-1);if(S.length>1&&e.avoidOverlap){var P=Math.cos(N)-Math.cos(0),R=Math.sin(N)-Math.sin(0),I=Math.sqrt(x*x/(P*P+R*R));L=Math.max(I,L)}S.r=L,L+=x}if(e.equidistant){for(var k=0,F=0,z=0;z<y.length;z++){var B=y[z],G=B.r-F;k=Math.max(k,G)}F=0;for(var $=0;$<y.length;$++){var X=y[$];$===0&&(F=X.r),X.r=F,F+=k}}for(var Y={},_=0;_<y.length;_++)for(var q=y[_],K=q.dTheta,j=q.r,Q=0;Q<q.length;Q++){var ee=q[Q],ie=e.startAngle+(r?1:-1)*K*Q,de={x:o.x+j*Math.cos(ie),y:o.y+j*Math.sin(ie)};Y[ee.node.id()]=de}return n.nodes().layoutPositions(this,e,function(te){var re=te.id();return Y[re]}),this};var Wn,Dm={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){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 Sn(t){this.options=ge({},Dm,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(a)}Sn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?Wn=!0:Wn=!1;var a=Sm(e,r,t);Wn&&Om(a),t.randomize&&Nm(a);var n=Rt(),i=function(){Im(a,e,t),t.fit===!0&&e.fit(t.padding)},s=function(c){return!(r.stopped||c>=t.numIter||(Mm(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),v=Sf(a,t,c);c.layoutPositions(r,t,v)}},l=0,u=!0;if(t.animate===!0){var f=function h(){for(var c=0;u&&c<t.refresh;)u=s(l),l++,c++;if(!u)cl(a,t),o();else{var v=Rt();v-n>=t.animationThreshold&&i(),nn(h)}};f()}else{for(;u;)u=s(l),l++;cl(a,t),o()}return this};Sn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Sn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Sm=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=ht(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},f=0;f<l.length;f++)for(var h=l[f],c=0;c<h.length;c++){var v=h[c];u[v.id()]=f}for(var f=0;f<o.nodeSize;f++){var d=i[f],g=d.layoutDimensions(a),p={};p.isLocked=d.locked(),p.id=d.data("id"),p.parentId=d.data("parent"),p.cmptId=u[d.id()],p.children=[],p.positionX=d.position("x"),p.positionY=d.position("y"),p.offsetX=0,p.offsetY=0,p.height=g.w,p.width=g.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(d.style("padding")),p.padRight=parseFloat(d.style("padding")),p.padTop=parseFloat(d.style("padding")),p.padBottom=parseFloat(d.style("padding")),p.nodeRepulsion=Fe(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=f}for(var y=[],b=0,w=-1,D=[],f=0;f<o.nodeSize;f++){var d=o.layoutNodes[f],m=d.parentId;m!=null?o.layoutNodes[o.idToIndex[m]].children.push(d.id):(y[++w]=d.id,D.push(d.id))}for(o.graphSet.push(D);b<=w;){var x=y[b++],E=o.idToIndex[x],v=o.layoutNodes[E],C=v.children;if(C.length>0){o.graphSet.push(C);for(var f=0;f<C.length;f++)y[++w]=C[f]}}for(var f=0;f<o.graphSet.length;f++)for(var T=o.graphSet[f],c=0;c<T.length;c++){var L=o.idToIndex[T[c]];o.indexToGraph[L]=f}for(var f=0;f<o.edgeSize;f++){var A=n[f],S={};S.id=A.data("id"),S.sourceId=A.data("source"),S.targetId=A.data("target");var M=Fe(a.idealEdgeLength)?a.idealEdgeLength(A):a.idealEdgeLength,N=Fe(a.edgeElasticity)?a.edgeElasticity(A):a.edgeElasticity,P=o.idToIndex[S.sourceId],R=o.idToIndex[S.targetId],I=o.indexToGraph[P],k=o.indexToGraph[R];if(I!=k){for(var F=Lm(S.sourceId,S.targetId,o),z=o.graphSet[F],B=0,p=o.layoutNodes[P];z.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;for(p=o.layoutNodes[R];z.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],B++;M*=B*a.nestingFactor}S.idealLength=M,S.elasticity=N,o.layoutEdges.push(S)}return o},Lm=function(e,r,a){var n=Am(e,r,0,a);return 2>n.count?0:n.graph},Am=function t(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var l=i[o],u=n.idToIndex[l],f=n.layoutNodes[u].children;if(f.length!==0){var h=n.indexToGraph[n.idToIndex[f[0]]],c=t(e,r,h,n);if(c.count!==0)if(c.count===1){if(s++,s===2)break}else return c}}return{count:s,graph:a}},Om,Nm=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},Sf=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var u=(l.positionX-i.x1)/i.w,f=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+f*n.h}}else return{x:l.positionX,y:l.positionY}}},Im=function(e,r,a){var n=a.layout,i=a.eles.nodes(),s=Sf(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Mm=function(e,r,a){Rm(e,r),Bm(e),Fm(e,r),Gm(e),zm(e)},Rm=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];km(o,u,e,r)}},hl=function(e){return-e+2*e*Math.random()},km=function(e,r,a,n){var i=e.cmptId,s=r.cmptId;if(!(i!==s&&!a.isCompound)){var o=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;o===0&&l===0&&(o=hl(u),l=hl(u));var f=Pm(e,r,o,l);if(f>0)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+l*l),v=h*o/c,d=h*l/c;else var g=cn(e,o,l),p=cn(r,-1*o,-1*l),y=p.x-g.x,b=p.y-g.y,w=y*y+b*b,c=Math.sqrt(w),h=(e.nodeRepulsion+r.nodeRepulsion)/w,v=h*y/c,d=h*b/c;e.isLocked||(e.offsetX-=v,e.offsetY-=d),r.isLocked||(r.offsetX+=v,r.offsetY+=d)}},Pm=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},cn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/r,u=s/o,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+s/2,f):0<r&&-1*u<=l&&l<=u?(f.x=n+o/2,f.y=i+o*a/2/r,f):0>r&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/r,f):0<a&&(l<=-1*u||l>=u)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},Bm=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,f=l.positionY-s.positionY;if(!(u===0&&f===0)){var h=cn(s,u,f),c=cn(l,-1*u,-1*f),v=c.x-h.x,d=c.y-h.y,g=Math.sqrt(v*v+d*d),p=Math.pow(n.idealLength-g,2)/n.elasticity;if(g!==0)var y=p*v/g,b=p*d/g;else var y=0,b=0;s.isLocked||(s.offsetX+=y,s.offsetY+=b),l.isLocked||(l.offsetX-=y,l.offsetY-=b)}}},Fm=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[u.parentId]],o=f.positionX,l=f.positionY;for(var h=0;h<s;h++){var c=e.layoutNodes[e.idToIndex[i[h]]];if(!c.isLocked){var v=o-c.positionX,d=l-c.positionY,g=Math.sqrt(v*v+d*d);if(g>a){var p=r.gravity*v/g,y=r.gravity*d/g;c.offsetX+=p,c.offsetY+=y}}}}},Gm=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var f=l.offsetX,h=l.offsetY,c=0;c<u.length;c++){var v=e.layoutNodes[e.idToIndex[u[c]]];v.offsetX+=f,v.offsetY+=h,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},zm=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=qm(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,Vm(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},qm=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},Vm=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return t(n,r)}},cl=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,l=n[o]=n[o]||[];l.push(s)}for(var u=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var h=0;h<f.length;h++){var c=f[h];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,u+=f.w*f.h}}n.sort(function(b,w){return w.w*w.h-b.w*b.h});for(var v=0,d=0,g=0,p=0,y=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var h=0;h<f.length;h++){var c=f[h];c.isLocked||(c.positionX+=v-f.x1,c.positionY+=d-f.y1)}v+=f.w+r.componentSpacing,g+=f.w+r.componentSpacing,p=Math.max(p,f.h),g>y&&(d+=p+r.componentSpacing,v=0,g=0,p=0)}}},Um={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Lf(t){this.options=ge({},Um,t)}Lf.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=ht(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function($){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),f=function(X){if(X==null)return Math.min(l,u);var Y=Math.min(l,u);Y==l?l=X:u=X},h=function(X){if(X==null)return Math.max(l,u);var Y=Math.max(l,u);Y==l?l=X:u=X},c=e.rows,v=e.cols!=null?e.cols:e.columns;if(c!=null&&v!=null)l=c,u=v;else if(c!=null&&v==null)l=c,u=Math.ceil(s/l);else if(c==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var d=f(),g=h();(d-1)*g>=s?f(d-1):(g-1)*d>=s&&h(g-1)}else for(;u*l<s;){var p=f(),y=h();(y+1)*p>=s?h(y+1):f(p+1)}var b=i.w/u,w=i.h/l;if(e.condense&&(b=0,w=0),e.avoidOverlap)for(var D=0;D<n.length;D++){var m=n[D],x=m._private.position;(x.x==null||x.y==null)&&(x.x=0,x.y=0);var E=m.layoutDimensions(e),C=e.avoidOverlapPadding,T=E.w+C,L=E.h+C;b=Math.max(b,T),w=Math.max(w,L)}for(var A={},S=function(X,Y){return!!A["c-"+X+"-"+Y]},M=function(X,Y){A["c-"+X+"-"+Y]=!0},N=0,P=0,R=function(){P++,P>=u&&(P=0,N++)},I={},k=0;k<n.length;k++){var F=n[k],z=e.position(F);if(z&&(z.row!==void 0||z.col!==void 0)){var B={row:z.row,col:z.col};if(B.col===void 0)for(B.col=0;S(B.row,B.col);)B.col++;else if(B.row===void 0)for(B.row=0;S(B.row,B.col);)B.row++;I[F.id()]=B,M(B.row,B.col)}}var G=function(X,Y){var _,q;if(X.locked()||X.isParent())return!1;var K=I[X.id()];if(K)_=K.col*b+b/2+i.x1,q=K.row*w+w/2+i.y1;else{for(;S(N,P);)R();_=P*b+b/2+i.x1,q=N*w+w/2+i.y1,M(N,P),R()}return{x:_,y:q}};n.layoutPositions(this,e,G)}return this};var Ym={ready:function(){},stop:function(){}};function Si(t){this.options=ge({},Ym,t)}Si.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};Si.prototype.stop=function(){return this};var Hm={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,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Af(t){this.options=ge({},Hm,t)}Af.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Fe(t.positions);function n(i){if(t.positions==null)return tp(i.position());if(a)return t.positions(i);var s=t.positions[i._private.data.id];return s??null}return r.layoutPositions(this,t,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var $m={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Of(t){this.options=ge({},$m,t)}Of.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var Xm=[{name:"breadthfirst",impl:Tf},{name:"circle",impl:Cf},{name:"concentric",impl:Df},{name:"cose",impl:Sn},{name:"grid",impl:Lf},{name:"null",impl:Si},{name:"preset",impl:Af},{name:"random",impl:Of}];function Nf(t){this.options=t,this.notifications=0}var vl=function(){},dl=function(){throw new Error("A headless instance can not render images")};Nf.prototype={recalculateRenderedStyle:vl,notify:function(){this.notifications++},init:vl,isHeadless:function(){return!0},png:dl,jpg:dl};var Li={};Li.arrowShapeWidth=.3;Li.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,f,h,c,v,d,g){var p=v.x-h/2-g,y=v.x+h/2+g,b=v.y-h/2-g,w=v.y+h/2+g,D=p<=u&&u<=y&&b<=f&&f<=w;return D},a=function(u,f,h,c,v){var d=u*Math.cos(c)-f*Math.sin(c),g=u*Math.sin(c)+f*Math.cos(c),p=d*h,y=g*h,b=p+v.x,w=y+v.y;return{x:b,y:w}},n=function(u,f,h,c){for(var v=[],d=0;d<u.length;d+=2){var g=u[d],p=u[d+1];v.push(a(g,p,f,h,c))}return v},i=function(u){for(var f=[],h=0;h<u.length;h++){var c=u[h];f.push(c.x,c.y)}return f},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,f){ve(f)&&(f=t[f]),t[u]=ge({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,v,d,g,p,y){var b=i(n(this.points,d+2*y,g,p)),w=ft(c,v,b);return w},roughCollide:r,draw:function(c,v,d,g){var p=n(this.points,v,d,g);e.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:s},f)};o("none",{collide:sn,roughCollide:sn,draw:gi,spacing:Ou,gap:Ou}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=this.controlPoint,p=a(g[0],g[1],f,h,c);e.arrowShapeImpl(this.name)(u,d,p)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,f,h,c,v,d,g){var p=i(n(this.points,h+2*g,c,v)),y=i(n(this.pointsTee,h+2*g,c,v)),b=ft(u,f,p)||ft(u,f,y);return b},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=n(this.pointsTee,f,h,c);e.arrowShapeImpl(this.name)(u,d,g)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,f,h,c,v,d,g){var p=v,y=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((h+2*g)*this.radius,2),b=i(n(this.points,h+2*g,c,v));return ft(u,f,b)||y},draw:function(u,f,h,c,v){var d=n(this.pointsTr,f,h,c);e.arrowShapeImpl(this.name)(u,d,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,f){var h=this.baseCrossLinePts.slice(),c=f/u,v=3,d=5;return h[v]=h[v]-c,h[d]=h[d]-c,h},collide:function(u,f,h,c,v,d,g){var p=i(n(this.points,h+2*g,c,v)),y=i(n(this.crossLinePts(h,d),h+2*g,c,v)),b=ft(u,f,p)||ft(u,f,y);return b},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),g=n(this.crossLinePts(f,v),f,h,c);e.arrowShapeImpl(this.name)(u,d,g)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,f,h,c,v,d,g){var p=v,y=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((h+2*g)*this.radius,2);return y},draw:function(u,f,h,c,v){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var hr={};hr.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=r.pan(),l=r.zoom(),u=((t-n)/s-o.x)/l,f=((e-i)/s-o.y)/l;return[u,f]};hr.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(y){return parseFloat(r.getPropertyValue(y))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},s=t.clientWidth,o=t.clientHeight,l=n.left+n.right,u=n.top+n.bottom,f=i.left+i.right,h=e.width/(s+f),c=s-l,v=o-u,d=e.left+n.left+i.left,g=e.top+n.top+i.top;return this.containerBB=[d,g,c,v,h]};hr.invalidateContainerClientCoordsCache=function(){this.containerBB=null};hr.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};hr.findNearestElements=function(t,e,r,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),f=(a?24:8)/l,h=(a?8:2)/l,c=(a?8:2)/l,v=1/0,d,g;r&&(s=s.interactive);function p(E,C){if(E.isNode()){if(g)return;g=E,o.push(E)}if(E.isEdge()&&(C==null||C<v))if(d){if(d.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===E.pstyle("z-compound-depth").value){for(var T=0;T<o.length;T++)if(o[T].isEdge()){o[T]=E,d=E,v=C??v;break}}}else o.push(E),d=E,v=C??v}function y(E){var C=E.outerWidth()+2*h,T=E.outerHeight()+2*h,L=C/2,A=T/2,S=E.position();if(S.x-L<=t&&t<=S.x+L&&S.y-A<=e&&e<=S.y+A){var M=i.nodeShapes[n.getNodeShape(E)];if(M.checkPoint(t,e,0,C,T,S.x,S.y))return p(E,0),!0}}function b(E){var C=E._private,T=C.rscratch,L=E.pstyle("width").pfValue,A=E.pstyle("arrow-scale").value,S=L/2+f,M=S*S,N=S*2,k=C.source,F=C.target,P;if(T.edgeType==="segments"||T.edgeType==="straight"||T.edgeType==="haystack"){for(var R=T.allpts,I=0;I+3<R.length;I+=2)if(dp(t,e,R[I],R[I+1],R[I+2],R[I+3],N)&&M>(P=bp(t,e,R[I],R[I+1],R[I+2],R[I+3])))return p(E,P),!0}else if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"){for(var R=T.allpts,I=0;I+5<T.allpts.length;I+=4)if(gp(t,e,R[I],R[I+1],R[I+2],R[I+3],R[I+4],R[I+5],N)&&M>(P=mp(t,e,R[I],R[I+1],R[I+2],R[I+3],R[I+4],R[I+5])))return p(E,P),!0}for(var k=k||C.source,F=F||C.target,z=n.getArrowWidth(L,A),B=[{name:"source",x:T.arrowStartX,y:T.arrowStartY,angle:T.srcArrowAngle},{name:"target",x:T.arrowEndX,y:T.arrowEndY,angle:T.tgtArrowAngle},{name:"mid-source",x:T.midX,y:T.midY,angle:T.midsrcArrowAngle},{name:"mid-target",x:T.midX,y:T.midY,angle:T.midtgtArrowAngle}],I=0;I<B.length;I++){var G=B[I],$=i.arrowShapes[E.pstyle(G.name+"-arrow-shape").value],X=E.pstyle("width").pfValue;if($.roughCollide(t,e,z,G.angle,{x:G.x,y:G.y},X,f)&&$.collide(t,e,z,G.angle,{x:G.x,y:G.y},X,f))return p(E),!0}u&&o.length>0&&(y(k),y(F))}function w(E,C,T){return Tt(E,C,T)}function D(E,C){var T=E._private,L=c,A;C?A=C+"-":A="",E.boundingBox();var S=T.labelBounds[C||"main"],M=E.pstyle(A+"label").value,N=E.pstyle("text-events").strValue==="yes";if(!(!N||!M)){var P=w(T.rscratch,"labelX",C),R=w(T.rscratch,"labelY",C),I=w(T.rscratch,"labelAngle",C),k=E.pstyle(A+"text-margin-x").pfValue,F=E.pstyle(A+"text-margin-y").pfValue,z=S.x1-L-k,B=S.x2+L-k,G=S.y1-L-F,$=S.y2+L-F;if(I){var X=Math.cos(I),Y=Math.sin(I),_=function(de,te){return de=de-P,te=te-R,{x:de*X-te*Y+P,y:de*Y+te*X+R}},q=_(z,G),K=_(z,$),j=_(B,G),Q=_(B,$),ee=[q.x+k,q.y+F,j.x+k,j.y+F,Q.x+k,Q.y+F,K.x+k,K.y+F];if(ft(t,e,ee))return p(E),!0}else if(Ir(S,t,e))return p(E),!0}}for(var m=s.length-1;m>=0;m--){var x=s[m];x.isNode()?y(x)||D(x):b(x)||D(x)||D(x,"source")||D(x,"target")}return o};hr.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=s,r=o,e=l,a=u;for(var f=ht({x1:t,y1:e,x2:r,y2:a}),h=0;h<n.length;h++){var c=n[h];if(c.isNode()){var v=c,d=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});mi(f,d)&&!$l(d,f)&&i.push(v)}else{var g=c,p=g._private,y=p.rscratch;if(y.startX!=null&&y.startY!=null&&!Ir(f,y.startX,y.startY)||y.endX!=null&&y.endY!=null&&!Ir(f,y.endX,y.endY))continue;if(y.edgeType==="bezier"||y.edgeType==="multibezier"||y.edgeType==="self"||y.edgeType==="compound"||y.edgeType==="segments"||y.edgeType==="haystack"){for(var b=p.rstyle.bezierPts||p.rstyle.linePts||p.rstyle.haystackPts,w=!0,D=0;D<b.length;D++)if(!vp(f,b[D])){w=!1;break}w&&i.push(g)}else(y.edgeType==="haystack"||y.edgeType==="straight")&&i.push(g)}}return i};var vn={};vn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,f,h,c,v,y,b;if(r?(f=e.haystackPts[0],h=e.haystackPts[1],c=e.haystackPts[2],v=e.haystackPts[3]):(f=e.arrowStartX,h=e.arrowStartY,c=e.arrowEndX,v=e.arrowEndY),y=e.midX,b=e.midY,i)l=f-e.segpts[0],u=h-e.segpts[1];else if(n||s||o||a){var d=e.allpts,g=Xe(d[0],d[2],d[4],.1),p=Xe(d[1],d[3],d[5],.1);l=f-g,u=h-p}else l=f-y,u=h-b;e.srcArrowAngle=za(l,u);var y=e.midX,b=e.midY;if(r&&(y=(f+c)/2,b=(h+v)/2),l=c-f,u=v-h,i){var d=e.allpts;if(d.length/2%2===0){var w=d.length/2,D=w-2;l=d[w]-d[D],u=d[w+1]-d[D+1]}else{var w=d.length/2-1,D=w-2,m=w+2;l=d[w]-d[D],u=d[w+1]-d[D+1]}}else if(n||s||o){var d=e.allpts,x=e.ctrlpts,E,C,T,L;if(x.length/2%2===0){var A=d.length/2-1,S=A+2,M=S+2;E=Xe(d[A],d[S],d[M],0),C=Xe(d[A+1],d[S+1],d[M+1],0),T=Xe(d[A],d[S],d[M],1e-4),L=Xe(d[A+1],d[S+1],d[M+1],1e-4)}else{var S=d.length/2-1,A=S-2,M=S+2;E=Xe(d[A],d[S],d[M],.4999),C=Xe(d[A+1],d[S+1],d[M+1],.4999),T=Xe(d[A],d[S],d[M],.5),L=Xe(d[A+1],d[S+1],d[M+1],.5)}l=T-E,u=L-C}if(e.midtgtArrowAngle=za(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var d=e.allpts;if(d.length/2%2!==0){var w=d.length/2-1,m=w+2;l=-(d[m]-d[w]),u=-(d[m+1]-d[w+1])}}if(e.midsrcArrowAngle=za(l,u),i)l=c-e.segpts[e.segpts.length-2],u=v-e.segpts[e.segpts.length-1];else if(n||s||o||a){var d=e.allpts,N=d.length,g=Xe(d[N-6],d[N-4],d[N-2],.9),p=Xe(d[N-5],d[N-3],d[N-1],.9);l=c-g,u=v-p}else l=c-y,u=v-b;e.tgtArrowAngle=za(l,u)};vn.getArrowWidth=vn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var it={};it.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(m,x,E,C){var T=C-x,L=E-m,A=Math.sqrt(L*L+T*T);return{x:-T/A,y:L/A}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(l){var h=this.manualEndptToPx(t.source()[0],s),c=wt(h,2),v=c[0],d=c[1],g=this.manualEndptToPx(t.target()[0],o),p=wt(g,2),y=p[0],b=p[1],w={x1:v,y1:d,x2:y,y2:b};n=u(v,d,y,b),i=w}else Ie("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};it.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var s=a.source,o=a.target,l=s.position(),u=o.position(),f=s.width(),h=o.width(),c=s.height(),v=o.height(),d=r.pstyle("haystack-radius").value,g=d/2;n.haystackPts=n.allpts=[n.source.x*f*g+l.x,n.source.y*c*g+l.y,n.target.x*h*g+u.x,n.target.y*v*g+u.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};it.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=Math.min(a.pfValue.length,n.pfValue.length);r.edgeType="segments",r.segpts=[];for(var s=0;s<i;s++){var o=a.pfValue[s],l=n.pfValue[s],u=1-o,f=o,h=this.findMidptPtsEtc(t,e),c=h.midptPts,v=h.vectorNormInverse,d={x:c.x1*u+c.x2*f,y:c.y1*u+c.y2*f};r.segpts.push(d.x+v.x*l,d.y+v.y*l)}};it.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,h=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,v=h;a&&(c=0,v=l);var d=u-Math.PI/2,g=d-f/2,p=d+f/2,y=u+"_"+f;c=i[y]===void 0?i[y]=0:++i[y],n.ctrlpts=[s.x+Math.cos(g)*1.4*v*(c/3+1),s.y+Math.sin(g)*1.4*v*(c/3+1),s.x+Math.cos(p)*1.4*v*(c/3+1),s.y+Math.sin(p)*1.4*v*(c/3+1)]};it.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,f=e.tgtH,h=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),v=c?c.pfValue[0]:void 0,d=r,g=h;a&&(d=0,g=v);var p=50,y={x:i.x-o/2,y:i.y-l/2},b={x:s.x-u/2,y:s.y-f/2},w={x:Math.min(y.x,b.x),y:Math.min(y.y,b.y)},D=.5,m=Math.max(D,Math.log(o*.01)),x=Math.max(D,Math.log(u*.01));n.ctrlpts=[w.x,w.y-(1+Math.pow(p,1.12)/100)*g*(d/3+1)*m,w.x-(1+Math.pow(p,1.12)/100)*g*(d/3+1)*x,w.y]};it.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};it.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,o=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,f=o?o.pfValue[0]:void 0,h=l.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<u;v++){var d=(.5-e.eles.length/2+r)*s*(n?-1:1),g=void 0,p=Yl(d);c&&(f=o?o.pfValue[v]:s,h=l.value[v]),a?g=f:g=f!==void 0?p*f:void 0;var y=g!==void 0?g:d,b=1-h,w=h,D=this.findMidptPtsEtc(t,e),m=D.midptPts,x=D.vectorNormInverse,E={x:m.x1*b+m.x2*w,y:m.y1*b+m.y2*w};i.ctrlpts.push(E.x+x.x*y,E.y+x.y*y)}};it.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",l="upward",u="auto",f=e.posPts,h=e.srcW,c=e.srcH,v=e.tgtW,d=e.tgtH,g=t.pstyle("edge-distances").value,p=g!=="node-position",y=t.pstyle("taxi-direction").value,b=y,w=t.pstyle("taxi-turn"),D=w.units==="%",m=w.pfValue,x=m<0,E=t.pstyle("taxi-turn-min-distance").pfValue,C=p?(h+v)/2:0,T=p?(c+d)/2:0,L=f.x2-f.x1,A=f.y2-f.y1,S=function(Z,ue){return Z>0?Math.max(Z-ue,0):Math.min(Z+ue,0)},M=S(L,C),N=S(A,T),P=!1;b===u?y=Math.abs(M)>Math.abs(N)?n:a:b===l||b===o?(y=a,P=!0):(b===i||b===s)&&(y=n,P=!0);var R=y===a,I=R?N:M,k=R?A:L,F=Yl(k),z=!1;!(P&&(D||x))&&(b===o&&k<0||b===l&&k>0||b===i&&k>0||b===s&&k<0)&&(F*=-1,I=F*Math.abs(I),z=!0);var B;if(D){var G=m<0?1+m:m;B=G*I}else{var $=m<0?I:0;B=$+m*F}var X=function(Z){return Math.abs(Z)<E||Math.abs(Z)>=Math.abs(I)},Y=X(B),_=X(Math.abs(I)-Math.abs(B)),q=Y||_;if(q&&!z)if(R){var K=Math.abs(k)<=c/2,j=Math.abs(L)<=v/2;if(K){var Q=(f.x1+f.x2)/2,ee=f.y1,ie=f.y2;r.segpts=[Q,ee,Q,ie]}else if(j){var de=(f.y1+f.y2)/2,te=f.x1,re=f.x2;r.segpts=[te,de,re,de]}else r.segpts=[f.x1,f.y2]}else{var fe=Math.abs(k)<=h/2,le=Math.abs(A)<=d/2;if(fe){var oe=(f.y1+f.y2)/2,he=f.x1,Te=f.x2;r.segpts=[he,oe,Te,oe]}else if(le){var we=(f.x1+f.x2)/2,pe=f.y1,xe=f.y2;r.segpts=[we,pe,we,xe]}else r.segpts=[f.x2,f.y1]}else if(R){var U=f.y1+B+(p?c/2*F:0),O=f.x1,V=f.x2;r.segpts=[O,U,V,U]}else{var J=f.x1+B+(p?h/2*F:0),H=f.y1,W=f.y2;r.segpts=[J,H,J,W]}};it.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,f=e.tgtShape,h=!ae(r.startX)||!ae(r.startY),c=!ae(r.arrowStartX)||!ae(r.arrowStartY),v=!ae(r.endX)||!ae(r.endY),d=!ae(r.arrowEndX)||!ae(r.arrowEndY),g=3,p=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,y=g*p,b=sr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),w=b<y,D=sr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),m=D<y,x=!1;if(h||c||w){x=!0;var E={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},C=Math.sqrt(E.x*E.x+E.y*E.y),T={x:E.x/C,y:E.y/C},L=Math.max(i,s),A={x:r.ctrlpts[0]+T.x*2*L,y:r.ctrlpts[1]+T.y*2*L},S=u.intersectLine(a.x,a.y,i,s,A.x,A.y,0);w?(r.ctrlpts[0]=r.ctrlpts[0]+T.x*(y-b),r.ctrlpts[1]=r.ctrlpts[1]+T.y*(y-b)):(r.ctrlpts[0]=S[0]+T.x*y,r.ctrlpts[1]=S[1]+T.y*y)}if(v||d||m){x=!0;var M={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},N=Math.sqrt(M.x*M.x+M.y*M.y),P={x:M.x/N,y:M.y/N},R=Math.max(i,s),I={x:r.ctrlpts[0]+P.x*2*R,y:r.ctrlpts[1]+P.y*2*R},k=f.intersectLine(n.x,n.y,o,l,I.x,I.y,0);m?(r.ctrlpts[0]=r.ctrlpts[0]+P.x*(y-D),r.ctrlpts[1]=r.ctrlpts[1]+P.y*(y-D)):(r.ctrlpts[0]=k[0]+P.x*y,r.ctrlpts[1]=k[1]+P.y*y)}x&&this.findEndpoints(t)}};it.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=Xe(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Xe(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments")if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.segpts.length%4===0){var i=e.segpts.length/2,s=i-2;e.midX=(e.segpts[s]+e.segpts[i])/2,e.midY=(e.segpts[s+1]+e.segpts[i+1])/2}else{var o=e.segpts.length/2-1;e.midX=e.segpts[o],e.midY=e.segpts[o+1]}};it.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||ae(e.startX)&&ae(e.startY)&&ae(e.endX)&&ae(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ie("Edge `"+t.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."))};it.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i={map:new At,get:function(E){var C=this.map.get(E[0]);return C!=null?C.get(E[1]):null},set:function(E,C){var T=this.map.get(E[0]);T==null&&(T=new At,this.map.set(E[0],T)),T.set(E[1],C)}},s=[],o=[],l=0;l<t.length;l++){var u=t[l],f=u._private,h=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(h==="haystack"){o.push(u);continue}var c=h==="unbundled-bezier"||h==="segments"||h==="straight"||h==="straight-triangle"||h==="taxi",v=h==="unbundled-bezier"||h==="bezier",d=f.source,g=f.target,p=d.poolIndex(),y=g.poolIndex(),b=[p,y].sort(),w=i.get(b);w==null&&(w={eles:[]},i.set(b,w),s.push(b)),w.eles.push(u),c&&(w.hasUnbundled=!0),v&&(w.hasBezier=!0)}}for(var D=function(E){var C=s[E],T=i.get(C),L=void 0;if(!T.hasUnbundled){var A=T.eles[0].parallelEdges().filter(function(xe){return xe.isBundledBezier()});pi(T.eles),A.forEach(function(xe){return T.eles.push(xe)}),T.eles.sort(function(xe,U){return xe.poolIndex()-U.poolIndex()})}var S=T.eles[0],M=S.source(),N=S.target();if(M.poolIndex()>N.poolIndex()){var P=M;M=N,N=P}var R=T.srcPos=M.position(),I=T.tgtPos=N.position(),k=T.srcW=M.outerWidth(),F=T.srcH=M.outerHeight(),z=T.tgtW=N.outerWidth(),B=T.tgtH=N.outerHeight(),G=T.srcShape=r.nodeShapes[e.getNodeShape(M)],$=T.tgtShape=r.nodeShapes[e.getNodeShape(N)];T.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var X=0;X<T.eles.length;X++){var Y=T.eles[X],_=Y[0]._private.rscratch,q=Y.pstyle("curve-style").value,K=q==="unbundled-bezier"||q==="segments"||q==="taxi",j=!M.same(Y.source());if(!T.calculatedIntersection&&M!==N&&(T.hasBezier||T.hasUnbundled)){T.calculatedIntersection=!0;var Q=G.intersectLine(R.x,R.y,k,F,I.x,I.y,0),ee=T.srcIntn=Q,ie=$.intersectLine(I.x,I.y,z,B,R.x,R.y,0),de=T.tgtIntn=ie,te=T.intersectionPts={x1:Q[0],x2:ie[0],y1:Q[1],y2:ie[1]},re=T.posPts={x1:R.x,x2:I.x,y1:R.y,y2:I.y},fe=ie[1]-Q[1],le=ie[0]-Q[0],oe=Math.sqrt(le*le+fe*fe),he=T.vector={x:le,y:fe},Te=T.vectorNorm={x:he.x/oe,y:he.y/oe},we={x:-Te.y,y:Te.x};T.nodesOverlap=!ae(oe)||$.checkPoint(Q[0],Q[1],0,z,B,I.x,I.y)||G.checkPoint(ie[0],ie[1],0,k,F,R.x,R.y),T.vectorNormInverse=we,L={nodesOverlap:T.nodesOverlap,dirCounts:T.dirCounts,calculatedIntersection:!0,hasBezier:T.hasBezier,hasUnbundled:T.hasUnbundled,eles:T.eles,srcPos:I,tgtPos:R,srcW:z,srcH:B,tgtW:k,tgtH:F,srcIntn:de,tgtIntn:ee,srcShape:$,tgtShape:G,posPts:{x1:re.x2,y1:re.y2,x2:re.x1,y2:re.y1},intersectionPts:{x1:te.x2,y1:te.y2,x2:te.x1,y2:te.y1},vector:{x:-he.x,y:-he.y},vectorNorm:{x:-Te.x,y:-Te.y},vectorNormInverse:{x:-we.x,y:-we.y}}}var pe=j?L:T;_.nodesOverlap=pe.nodesOverlap,_.srcIntn=pe.srcIntn,_.tgtIntn=pe.tgtIntn,n&&(M.isParent()||M.isChild()||N.isParent()||N.isChild())&&(M.parents().anySame(N)||N.parents().anySame(M)||M.same(N)&&M.isParent())?e.findCompoundLoopPoints(Y,pe,X,K):M===N?e.findLoopPoints(Y,pe,X,K):q==="segments"?e.findSegmentsPoints(Y,pe):q==="taxi"?e.findTaxiPoints(Y,pe):q==="straight"||!K&&T.eles.length%2===1&&X===Math.floor(T.eles.length/2)?e.findStraightEdgePoints(Y):e.findBezierPoints(Y,pe,X,K,j),e.findEndpoints(Y),e.tryToCorrectInvalidPoints(Y,pe),e.checkForInvalidEdgeWarning(Y),e.storeAllpts(Y),e.storeEdgeProjections(Y),e.calculateArrowAngles(Y),e.recalculateEdgeLabelProjections(Y),e.calculateLabelAngles(Y)}},m=0;m<s.length;m++)D(m);this.findHaystackPoints(o)}};function If(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}it.getSegmentPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="segments")return this.recalculateRenderedStyle(t),If(e.segpts)};it.getControlPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return this.recalculateRenderedStyle(t),If(e.ctrlpts)};it.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Da={};Da.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight();if(e.value.length===2){var s=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(s[0]=s[0]*n),e.units[1]==="%"&&(s[1]=s[1]*i),s[0]+=a.x,s[1]+=a.y,s}else{var o=e.pfValue[0];o=-Math.PI/2+o;var l=2*Math.max(n,i),u=[a.x+Math.cos(o)*l,a.y+Math.sin(o)*l];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,u[0],u[1],0)}};Da.findEndpoints=function(t){var e=this,r,a=t.source()[0],n=t.target()[0],i=a.position(),s=n.position(),o=t.pstyle("target-arrow-shape").value,l=t.pstyle("source-arrow-shape").value,u=t.pstyle("target-distance-from-node").pfValue,f=t.pstyle("source-distance-from-node").pfValue,h=t.pstyle("curve-style").value,c=t._private.rscratch,v=c.edgeType,d=h==="taxi",g=v==="self"||v==="compound",p=v==="bezier"||v==="multibezier"||g,y=v!=="bezier",b=v==="straight"||v==="segments",w=v==="segments",D=p||y||b,m=g||d,x=t.pstyle("source-endpoint"),E=m?"outside-to-node":x.value,C=t.pstyle("target-endpoint"),T=m?"outside-to-node":C.value;c.srcManEndpt=x,c.tgtManEndpt=C;var L,A,S,M;if(p){var N=[c.ctrlpts[0],c.ctrlpts[1]],P=y?[c.ctrlpts[c.ctrlpts.length-2],c.ctrlpts[c.ctrlpts.length-1]]:N;L=P,A=N}else if(b){var R=w?c.segpts.slice(0,2):[s.x,s.y],I=w?c.segpts.slice(c.segpts.length-2):[i.x,i.y];L=I,A=R}if(T==="inside-to-node")r=[s.x,s.y];else if(C.units)r=this.manualEndptToPx(n,C);else if(T==="outside-to-line")r=c.tgtIntn;else if(T==="outside-to-node"||T==="outside-to-node-or-label"?S=L:(T==="outside-to-line"||T==="outside-to-line-or-label")&&(S=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),S[0],S[1],0),T==="outside-to-node-or-label"||T==="outside-to-line-or-label"){var k=n._private.rscratch,F=k.labelWidth,z=k.labelHeight,B=k.labelX,G=k.labelY,$=F/2,X=z/2,Y=n.pstyle("text-valign").value;Y==="top"?G-=X:Y==="bottom"&&(G+=X);var _=n.pstyle("text-halign").value;_==="left"?B-=$:_==="right"&&(B+=$);var q=va(S[0],S[1],[B-$,G-X,B+$,G-X,B+$,G+X,B-$,G+X],s.x,s.y);if(q.length>0){var K=i,j=rr(K,Dr(r)),Q=rr(K,Dr(q)),ee=j;if(Q<j&&(r=q,ee=Q),q.length>2){var ie=rr(K,{x:q[2],y:q[3]});ie<ee&&(r=[q[2],q[3]])}}}var de=qa(r,L,e.arrowShapes[o].spacing(t)+u),te=qa(r,L,e.arrowShapes[o].gap(t)+u);if(c.endX=te[0],c.endY=te[1],c.arrowEndX=de[0],c.arrowEndY=de[1],E==="inside-to-node")r=[i.x,i.y];else if(x.units)r=this.manualEndptToPx(a,x);else if(E==="outside-to-line")r=c.srcIntn;else if(E==="outside-to-node"||E==="outside-to-node-or-label"?M=A:(E==="outside-to-line"||E==="outside-to-line-or-label")&&(M=[s.x,s.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),M[0],M[1],0),E==="outside-to-node-or-label"||E==="outside-to-line-or-label"){var re=a._private.rscratch,fe=re.labelWidth,le=re.labelHeight,oe=re.labelX,he=re.labelY,Te=fe/2,we=le/2,pe=a.pstyle("text-valign").value;pe==="top"?he-=we:pe==="bottom"&&(he+=we);var xe=a.pstyle("text-halign").value;xe==="left"?oe-=Te:xe==="right"&&(oe+=Te);var U=va(M[0],M[1],[oe-Te,he-we,oe+Te,he-we,oe+Te,he+we,oe-Te,he+we],i.x,i.y);if(U.length>0){var O=s,V=rr(O,Dr(r)),J=rr(O,Dr(U)),H=V;if(J<V&&(r=[U[0],U[1]],H=J),U.length>2){var W=rr(O,{x:U[2],y:U[3]});W<H&&(r=[U[2],U[3]])}}}var ce=qa(r,A,e.arrowShapes[l].spacing(t)+f),Z=qa(r,A,e.arrowShapes[l].gap(t)+f);c.startX=Z[0],c.startY=Z[1],c.arrowStartX=ce[0],c.arrowStartY=ce[1],D&&(!ae(c.startX)||!ae(c.startY)||!ae(c.endX)||!ae(c.endY)?c.badLine=!0:c.badLine=!1)};Da.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Da.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Ai={};function _m(t,e,r){for(var a=function(u,f,h,c){return Xe(u,f,h,c)},n=e._private,i=n.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];i.push({x:a(r[0],r[2],r[4],o),y:a(r[1],r[3],r[5],o)})}}Ai.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)_m(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};Ai.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Nt={};Nt.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!Xt(e)){var r,a,n=t._private,i=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,h=n.rscratch,c=n.rstyle;switch(u){case"left":r=l.x-i/2-o;break;case"right":r=l.x+i/2+o;break;default:r=l.x}switch(f){case"top":a=l.y-s/2-o;break;case"bottom":a=l.y+s/2+o;break;default:a=l.y}h.labelX=r,h.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Mf=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},Rf=function(e,r){var a=r.x-e.x,n=r.y-e.y;return Mf(a,n)},Wm=function(e,r,a,n){var i=ca(0,n-.001,1),s=ca(0,n+.001,1),o=Lr(e,r,a,i),l=Lr(e,r,a,s);return Rf(o,l)};Nt.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=function(h,c,v){Ut(r.rscratch,h,c,v),Ut(r.rstyle,h,c,v)};s("labelX",null,e.x),s("labelY",null,e.y);var o=Mf(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var l=function f(){if(f.cache)return f.cache;for(var h=[],c=0;c+5<a.allpts.length;c+=4){var v={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},g={x:a.allpts[c+4],y:a.allpts[c+5]};h.push({p0:v,p1:d,p2:g,startDist:0,length:0,segments:[]})}var p=r.rstyle.bezierPts,y=n.bezierProjPcts.length;function b(E,C,T,L,A){var S=sr(C,T),M=E.segments[E.segments.length-1],N={p0:C,p1:T,t0:L,t1:A,startDist:M?M.startDist+M.length:0,length:S};E.segments.push(N),E.length+=S}for(var w=0;w<h.length;w++){var D=h[w],m=h[w-1];m&&(D.startDist=m.startDist+m.length),b(D,D.p0,p[w*y],0,n.bezierProjPcts[0]);for(var x=0;x<y-1;x++)b(D,p[w*y+x],p[w*y+x+1],n.bezierProjPcts[x],n.bezierProjPcts[x+1]);b(D,p[w*y+y-1],D.p2,n.bezierProjPcts[y-1],1)}return f.cache=h},u=function(h){var c,v=h==="source";if(i[h]){var d=t.pstyle(h+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var g=l(),p,y=0,b=0,w=0;w<g.length;w++){for(var D=g[v?w:g.length-1-w],m=0;m<D.segments.length;m++){var x=D.segments[v?m:D.segments.length-1-m],E=w===g.length-1&&m===D.segments.length-1;if(y=b,b+=x.length,b>=d||E){p={cp:D,segment:x};break}}if(p)break}var C=p.cp,T=p.segment,L=(d-y)/T.length,A=T.t1-T.t0,S=v?T.t0+A*L:T.t1-A*L;S=ca(0,S,1),e=Lr(C.p0,C.p1,C.p2,S),c=Wm(C.p0,C.p1,C.p2,S);break}case"straight":case"segments":case"haystack":{for(var M=0,N,P,R,I,k=a.allpts.length,F=0;F+3<k&&(v?(R={x:a.allpts[F],y:a.allpts[F+1]},I={x:a.allpts[F+2],y:a.allpts[F+3]}):(R={x:a.allpts[k-2-F],y:a.allpts[k-1-F]},I={x:a.allpts[k-4-F],y:a.allpts[k-3-F]}),N=sr(R,I),P=M,M+=N,!(M>=d));F+=2);var z=d-P,B=z/N;B=ca(0,B,1),e=up(R,I,B),c=Rf(R,I);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};u("source"),u("target"),this.applyLabelDimensions(t)}};Nt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Nt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=Tt(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,h=n.width,c=n.height+(l-1)*(i-1)*u;Ut(r.rstyle,"labelWidth",e,h),Ut(r.rscratch,"labelWidth",e,h),Ut(r.rstyle,"labelHeight",e,c),Ut(r.rscratch,"labelHeight",e,c),Ut(r.rscratch,"labelLineHeight",e,f)};Nt.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(z,B){return B?(Ut(r.rscratch,z,e,B),B):Tt(r.rscratch,z,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",f=n.split(`
`),h=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,v=c==="anywhere",d=[],g=/[\s\u200b]+/,p=v?"":" ",y=0;y<f.length;y++){var b=f[y],w=this.calculateLabelDimensions(t,b),D=w.width;if(v){var m=b.split("").join(u);b=m}if(D>h){for(var x=b.split(g),E="",C=0;C<x.length;C++){var T=x[C],L=E.length===0?T:E+p+T,A=this.calculateLabelDimensions(t,L),S=A.width;S<=h?E+=T+p:(E&&d.push(E),E=T+p)}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(b)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var M=t.pstyle("text-max-width").pfValue,N="",P="\u2026",R=!1;if(this.calculateLabelDimensions(t,n).width<M)return n;for(var I=0;I<n.length;I++){var k=this.calculateLabelDimensions(t,N+n[I]+P).width;if(k>M)break;N+=n[I],I===n.length-1&&(R=!0)}return R||(N+=P),N}return n};Nt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Nt.calculateLabelDimensions=function(t,e){var r=this,a=ir(e,t._private.labelDimsKey),n=r.labelDimCache||(r.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=t.pstyle("font-style").strValue,l=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var v=h.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(l,"px ").concat(u);for(var d=0,g=0,p=e.split(`
`),y=0;y<p.length;y++){var b=p[y],w=c.measureText(b),D=Math.ceil(w.width),m=l;d=Math.max(D,d),g+=m}return d+=s,g+=s,n[a]={width:d,height:g}};Nt.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue};Nt.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var kf={},gl=28,pl=!1;kf.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<gl||t.height()<gl))return pl||(Ie("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),pl=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var Ln={};Ln.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],f=u._private,h=f.rstyle;h.clean=!1,h.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],f=u._private.rstyle;u.isNode()&&!f.cleanConnected&&(a(u.connectedEdges()),f.cleanConnected=!0)}if(o)for(var h=0;h<o.length;h++){var c=o[h];c(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};Ln.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};Ln.recalculateRenderedStyle=function(t,e){var r=function(D){return D._private.rstyle.cleanConnected},a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var s=t[i],o=s._private,l=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),l.clean=!0)}for(var u=0;u<n.length;u++){var f=n[u],h=f._private,c=h.rstyle,v=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=v.x,c.nodeY=v.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var g=a[d],p=g._private,y=p.rstyle,b=p.rscratch;y.srcX=b.arrowStartX,y.srcY=b.arrowStartY,y.tgtX=b.arrowEndX,y.tgtY=b.arrowEndY,y.midX=b.midX,y.midY=b.midY,y.labelAngle=b.labelAngle,y.sourceLabelAngle=b.sourceLabelAngle,y.targetLabelAngle=b.targetLabelAngle}}};var An={};An.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};An.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};An.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(Ef),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var Pf={};[hr,vn,it,Da,Ai,Nt,kf,Ln,An].forEach(function(t){ge(Pf,t)});var Bf={};Bf.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var s=i.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var Gr={};Gr.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]),i=this.binder(t);return i.on.apply(i,n)};Gr.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||vg(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch{}e.supportsPassiveEvents=n}var s=function(l,u,f){var h=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(h[2]={capture:f??!1,passive:!1,once:!1}),e.bindings.push({target:t,args:h}),(t.addEventListener||t.on).apply(t,h),this};return{on:s,addEventListener:s,addListener:s,bind:s}};Gr.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Gr.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Gr.load=function(){var t=this,e=t.cy.window(),r=function(O){return O.selected()},a=function(O,V,J,H){O==null&&(O=t.cy);for(var W=0;W<V.length;W++){var ce=V[W];O.emit({originalEvent:J,type:ce,position:H})}},n=function(O){return O.shiftKey||O.metaKey||O.ctrlKey},i=function(O,V){var J=!0;if(t.cy.hasCompoundNodes()&&O&&O.pannable())for(var H=0;V&&H<V.length;H++){var O=V[H];if(O.isNode()&&O.isParent()&&!O.pannable()){J=!1;break}}else J=!0;return J},s=function(O){O[0]._private.grabbed=!0},o=function(O){O[0]._private.grabbed=!1},l=function(O){O[0]._private.rscratch.inDragLayer=!0},u=function(O){O[0]._private.rscratch.inDragLayer=!1},f=function(O){O[0]._private.rscratch.isGrabTarget=!0},h=function(O){O[0]._private.rscratch.isGrabTarget=!1},c=function(O,V){var J=V.addToList,H=J.has(O);!H&&O.grabbable()&&!O.locked()&&(J.merge(O),s(O))},v=function(O,V){if(O.cy().hasCompoundNodes()&&!(V.inDragLayer==null&&V.addToList==null)){var J=O.descendants();V.inDragLayer&&(J.forEach(l),J.connectedEdges().forEach(l)),V.addToList&&c(J,V)}},d=function(O,V){V=V||{};var J=O.cy().hasCompoundNodes();V.inDragLayer&&(O.forEach(l),O.neighborhood().stdFilter(function(H){return!J||H.isEdge()}).forEach(l)),V.addToList&&O.forEach(function(H){c(H,V)}),v(O,V),y(O,{inDragLayer:V.inDragLayer}),t.updateCachedGrabbedEles()},g=d,p=function(O){O&&(t.getCachedZSortedEles().forEach(function(V){o(V),u(V),h(V)}),t.updateCachedGrabbedEles())},y=function(O,V){if(!(V.inDragLayer==null&&V.addToList==null)&&O.cy().hasCompoundNodes()){var J=O.ancestors().orphans();if(!J.same(O)){var H=J.descendants().spawnSelf().merge(J).unmerge(O).unmerge(O.descendants()),W=H.connectedEdges();V.inDragLayer&&(W.forEach(l),H.forEach(l)),V.addToList&&H.forEach(function(ce){c(ce,V)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",D=typeof ResizeObserver<"u";w?(t.removeObserver=new MutationObserver(function(U){for(var O=0;O<U.length;O++){var V=U[O],J=V.removedNodes;if(J)for(var H=0;H<J.length;H++){var W=J[H];if(W===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(U){t.destroy()});var m=gn.default(function(){t.cy.resize()},100);w&&(t.styleObserver=new MutationObserver(m),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",m),D&&(t.resizeObserver=new ResizeObserver(m),t.resizeObserver.observe(t.container));var x=function(O,V){for(;O!=null;)V(O),O=O.parentNode},E=function(){t.invalidateContainerClientCoordsCache()};x(t.container,function(U){t.registerBinding(U,"transitionend",E),t.registerBinding(U,"animationend",E),t.registerBinding(U,"scroll",E)}),t.registerBinding(t.container,"contextmenu",function(U){U.preventDefault()});var C=function(){return t.selection[4]!==0},T=function(O){for(var V=t.findContainerClientCoords(),J=V[0],H=V[1],W=V[2],ce=V[3],Z=O.touches?O.touches:[O],ue=!1,be=0;be<Z.length;be++){var Le=Z[be];if(J<=Le.clientX&&Le.clientX<=J+W&&H<=Le.clientY&&Le.clientY<=H+ce){ue=!0;break}}if(!ue)return!1;for(var ye=t.container,Ce=O.target,me=Ce.parentNode,Ee=!1;me;){if(me===ye){Ee=!0;break}me=me.parentNode}return!!Ee};t.registerBinding(t.container,"mousedown",function(O){if(T(O)){O.preventDefault(),b(),t.hoverData.capture=!0,t.hoverData.which=O.which;var V=t.cy,J=[O.clientX,O.clientY],H=t.projectIntoViewport(J[0],J[1]),W=t.selection,ce=t.findNearestElements(H[0],H[1],!0,!1),Z=ce[0],ue=t.dragData.possibleDragElements;t.hoverData.mdownPos=H,t.hoverData.mdownGPos=J;var be=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Ge=t.hoverData.down;Ge?Ge.emit({originalEvent:O,type:"taphold",position:{x:H[0],y:H[1]}}):V.emit({originalEvent:O,type:"taphold",position:{x:H[0],y:H[1]}})}},t.tapholdDuration)};if(O.which==3){t.hoverData.cxtStarted=!0;var Le={originalEvent:O,type:"cxttapstart",position:{x:H[0],y:H[1]}};Z?(Z.activate(),Z.emit(Le),t.hoverData.down=Z):V.emit(Le),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(O.which==1){Z&&Z.activate();{if(Z!=null&&t.nodeIsGrabbable(Z)){var ye=function(Ge){return{originalEvent:O,type:Ge,position:{x:H[0],y:H[1]}}},Ce=function(Ge){Ge.emit(ye("grab"))};if(f(Z),!Z.selected())ue=t.dragData.possibleDragElements=V.collection(),g(Z,{addToList:ue}),Z.emit(ye("grabon")).emit(ye("grab"));else{ue=t.dragData.possibleDragElements=V.collection();var me=V.$(function(Ee){return Ee.isNode()&&Ee.selected()&&t.nodeIsGrabbable(Ee)});d(me,{addToList:ue}),Z.emit(ye("grabon")),me.forEach(Ce)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=Z,t.hoverData.downs=ce,t.hoverData.downTime=new Date().getTime()}a(Z,["mousedown","tapstart","vmousedown"],O,{x:H[0],y:H[1]}),Z==null?(W[4]=1,t.data.bgActivePosistion={x:H[0],y:H[1]},t.redrawHint("select",!0),t.redraw()):Z.pannable()&&(W[4]=1),be()}W[0]=W[2]=H[0],W[1]=W[3]=H[1]}},!1),t.registerBinding(e,"mousemove",function(O){var V=t.hoverData.capture;if(!(!V&&!T(O))){var J=!1,H=t.cy,W=H.zoom(),ce=[O.clientX,O.clientY],Z=t.projectIntoViewport(ce[0],ce[1]),ue=t.hoverData.mdownPos,be=t.hoverData.mdownGPos,Le=t.selection,ye=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(ye=t.findNearestElement(Z[0],Z[1],!0,!1));var Ce=t.hoverData.last,me=t.hoverData.down,Ee=[Z[0]-Le[2],Z[1]-Le[3]],Ge=t.dragData.possibleDragElements,_e;if(be){var yt=ce[0]-be[0],mt=yt*yt,We=ce[1]-be[1],dt=We*We,st=mt+dt;t.hoverData.isOverThresholdDrag=_e=st>=t.desktopTapThreshold2}var Mt=n(O);_e&&(t.hoverData.tapholdCancelled=!0);var Gt=function(){var St=t.hoverData.dragDelta=t.hoverData.dragDelta||[];St.length===0?(St.push(Ee[0]),St.push(Ee[1])):(St[0]+=Ee[0],St[1]+=Ee[1])};J=!0,a(ye,["mousemove","vmousemove","tapdrag"],O,{x:Z[0],y:Z[1]});var vr=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||H.emit({originalEvent:O,type:"boxstart",position:{x:Z[0],y:Z[1]}}),Le[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(_e){var jt={originalEvent:O,type:"cxtdrag",position:{x:Z[0],y:Z[1]}};me?me.emit(jt):H.emit(jt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||ye!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:Z[0],y:Z[1]}}),t.hoverData.cxtOver=ye,ye&&ye.emit({originalEvent:O,type:"cxtdragover",position:{x:Z[0],y:Z[1]}}))}}else if(t.hoverData.dragging){if(J=!0,H.panningEnabled()&&H.userPanningEnabled()){var dr;if(t.hoverData.justStartedPan){var Ia=t.hoverData.mdownPos;dr={x:(Z[0]-Ia[0])*W,y:(Z[1]-Ia[1])*W},t.hoverData.justStartedPan=!1}else dr={x:Ee[0]*W,y:Ee[1]*W};H.panBy(dr),H.emit("dragpan"),t.hoverData.dragged=!0}Z=t.projectIntoViewport(O.clientX,O.clientY)}else if(Le[4]==1&&(me==null||me.pannable())){if(_e){if(!t.hoverData.dragging&&H.boxSelectionEnabled()&&(Mt||!H.panningEnabled()||!H.userPanningEnabled()))vr();else if(!t.hoverData.selecting&&H.panningEnabled()&&H.userPanningEnabled()){var er=i(me,t.hoverData.downs);er&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,Le[4]=0,t.data.bgActivePosistion=Dr(ue),t.redrawHint("select",!0),t.redraw())}me&&me.pannable()&&me.active()&&me.unactivate()}}else{if(me&&me.pannable()&&me.active()&&me.unactivate(),(!me||!me.grabbed())&&ye!=Ce&&(Ce&&a(Ce,["mouseout","tapdragout"],O,{x:Z[0],y:Z[1]}),ye&&a(ye,["mouseover","tapdragover"],O,{x:Z[0],y:Z[1]}),t.hoverData.last=ye),me)if(_e){if(H.boxSelectionEnabled()&&Mt)me&&me.grabbed()&&(p(Ge),me.emit("freeon"),Ge.emit("free"),t.dragData.didDrag&&(me.emit("dragfreeon"),Ge.emit("dragfree"))),vr();else if(me&&me.grabbed()&&t.nodeIsDraggable(me)){var ut=!t.dragData.didDrag;ut&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(Ge,{inDragLayer:!0});var et={x:0,y:0};if(ae(Ee[0])&&ae(Ee[1])&&(et.x+=Ee[0],et.y+=Ee[1],ut)){var lt=t.hoverData.dragDelta;lt&&ae(lt[0])&&ae(lt[1])&&(et.x+=lt[0],et.y+=lt[1])}t.hoverData.draggingEles=!0,Ge.silentShift(et).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Gt();J=!0}if(Le[2]=Z[0],Le[3]=Z[1],J)return O.stopPropagation&&O.stopPropagation(),O.preventDefault&&O.preventDefault(),!1}},!1);var L,A,S;t.registerBinding(e,"mouseup",function(O){var V=t.hoverData.capture;if(V){t.hoverData.capture=!1;var J=t.cy,H=t.projectIntoViewport(O.clientX,O.clientY),W=t.selection,ce=t.findNearestElement(H[0],H[1],!0,!1),Z=t.dragData.possibleDragElements,ue=t.hoverData.down,be=n(O);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,ue&&ue.unactivate(),t.hoverData.which===3){var Le={originalEvent:O,type:"cxttapend",position:{x:H[0],y:H[1]}};if(ue?ue.emit(Le):J.emit(Le),!t.hoverData.cxtDragged){var ye={originalEvent:O,type:"cxttap",position:{x:H[0],y:H[1]}};ue?ue.emit(ye):J.emit(ye)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(a(ce,["mouseup","tapend","vmouseup"],O,{x:H[0],y:H[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(a(ue,["click","tap","vclick"],O,{x:H[0],y:H[1]}),A=!1,O.timeStamp-S<=J.multiClickDebounceTime()?(L&&clearTimeout(L),A=!0,S=null,a(ue,["dblclick","dbltap","vdblclick"],O,{x:H[0],y:H[1]})):(L=setTimeout(function(){A||a(ue,["oneclick","onetap","voneclick"],O,{x:H[0],y:H[1]})},J.multiClickDebounceTime()),S=O.timeStamp)),ue==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!n(O)&&(J.$(r).unselect(["tapunselect"]),Z.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Z=J.collection()),ce==ue&&!t.dragData.didDrag&&!t.hoverData.selecting&&ce!=null&&ce._private.selectable&&(t.hoverData.dragging||(J.selectionType()==="additive"||be?ce.selected()?ce.unselect(["tapunselect"]):ce.select(["tapselect"]):be||(J.$(r).unmerge(ce).unselect(["tapunselect"]),ce.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ce=J.collection(t.getAllInBox(W[0],W[1],W[2],W[3]));t.redrawHint("select",!0),Ce.length>0&&t.redrawHint("eles",!0),J.emit({type:"boxend",originalEvent:O,position:{x:H[0],y:H[1]}});var me=function(_e){return _e.selectable()&&!_e.selected()};J.selectionType()==="additive"||be||J.$(r).unmerge(Ce).unselect(),Ce.emit("box").stdFilter(me).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!W[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Ee=ue&&ue.grabbed();p(Z),Ee&&(ue.emit("freeon"),Z.emit("free"),t.dragData.didDrag&&(ue.emit("dragfreeon"),Z.emit("dragfree")))}}W[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var M=function(O){if(!t.scrollingPage){var V=t.cy,J=V.zoom(),H=V.pan(),W=t.projectIntoViewport(O.clientX,O.clientY),ce=[W[0]*J+H.x,W[1]*J+H.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||C()){O.preventDefault();return}if(V.panningEnabled()&&V.userPanningEnabled()&&V.zoomingEnabled()&&V.userZoomingEnabled()){O.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var Z;O.deltaY!=null?Z=O.deltaY/-250:O.wheelDeltaY!=null?Z=O.wheelDeltaY/1e3:Z=O.wheelDelta/1e3,Z=Z*t.wheelSensitivity;var ue=O.deltaMode===1;ue&&(Z*=33);var be=V.zoom()*Math.pow(10,Z);O.type==="gesturechange"&&(be=t.gestureStartZoom*O.scale),V.zoom({level:be,renderedPosition:{x:ce[0],y:ce[1]}}),V.emit(O.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",M,!0),t.registerBinding(e,"scroll",function(O){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(O){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||O.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(U){t.hasTouchStarted||M(U)},!0),t.registerBinding(t.container,"mouseout",function(O){var V=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseout",position:{x:V[0],y:V[1]}})},!1),t.registerBinding(t.container,"mouseover",function(O){var V=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseover",position:{x:V[0],y:V[1]}})},!1);var N,P,R,I,k,F,z,B,G,$,X,Y,_,q=function(O,V,J,H){return Math.sqrt((J-O)*(J-O)+(H-V)*(H-V))},K=function(O,V,J,H){return(J-O)*(J-O)+(H-V)*(H-V)},j;t.registerBinding(t.container,"touchstart",j=function(O){if(t.hasTouchStarted=!0,!!T(O)){b(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var V=t.cy,J=t.touchData.now,H=t.touchData.earlier;if(O.touches[0]){var W=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);J[0]=W[0],J[1]=W[1]}if(O.touches[1]){var W=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);J[2]=W[0],J[3]=W[1]}if(O.touches[2]){var W=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);J[4]=W[0],J[5]=W[1]}if(O.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var ce=t.findContainerClientCoords();G=ce[0],$=ce[1],X=ce[2],Y=ce[3],N=O.touches[0].clientX-G,P=O.touches[0].clientY-$,R=O.touches[1].clientX-G,I=O.touches[1].clientY-$,_=0<=N&&N<=X&&0<=R&&R<=X&&0<=P&&P<=Y&&0<=I&&I<=Y;var Z=V.pan(),ue=V.zoom();k=q(N,P,R,I),F=K(N,P,R,I),z=[(N+R)/2,(P+I)/2],B=[(z[0]-Z.x)/ue,(z[1]-Z.y)/ue];var be=200,Le=be*be;if(F<Le&&!O.touches[2]){var ye=t.findNearestElement(J[0],J[1],!0,!0),Ce=t.findNearestElement(J[2],J[3],!0,!0);ye&&ye.isNode()?(ye.activate().emit({originalEvent:O,type:"cxttapstart",position:{x:J[0],y:J[1]}}),t.touchData.start=ye):Ce&&Ce.isNode()?(Ce.activate().emit({originalEvent:O,type:"cxttapstart",position:{x:J[0],y:J[1]}}),t.touchData.start=Ce):V.emit({originalEvent:O,type:"cxttapstart",position:{x:J[0],y:J[1]}}),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(O.touches[2])V.boxSelectionEnabled()&&O.preventDefault();else if(!O.touches[1]){if(O.touches[0]){var me=t.findNearestElements(J[0],J[1],!0,!0),Ee=me[0];if(Ee!=null&&(Ee.activate(),t.touchData.start=Ee,t.touchData.starts=me,t.nodeIsGrabbable(Ee))){var Ge=t.dragData.touchDragEles=V.collection(),_e=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),Ee.selected()?(_e=V.$(function(st){return st.selected()&&t.nodeIsGrabbable(st)}),d(_e,{addToList:Ge})):g(Ee,{addToList:Ge}),f(Ee);var yt=function(Mt){return{originalEvent:O,type:Mt,position:{x:J[0],y:J[1]}}};Ee.emit(yt("grabon")),_e?_e.forEach(function(st){st.emit(yt("grab"))}):Ee.emit(yt("grab"))}a(Ee,["touchstart","tapstart","vmousedown"],O,{x:J[0],y:J[1]}),Ee==null&&(t.data.bgActivePosistion={x:W[0],y:W[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&a(t.touchData.start,["taphold"],O,{x:J[0],y:J[1]})},t.tapholdDuration)}}if(O.touches.length>=1){for(var mt=t.touchData.startPosition=[null,null,null,null,null,null],We=0;We<J.length;We++)mt[We]=H[We]=J[We];var dt=O.touches[0];t.touchData.startGPosition=[dt.clientX,dt.clientY]}}},!1);var Q;t.registerBinding(window,"touchmove",Q=function(O){var V=t.touchData.capture;if(!(!V&&!T(O))){var J=t.selection,H=t.cy,W=t.touchData.now,ce=t.touchData.earlier,Z=H.zoom();if(O.touches[0]){var ue=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);W[0]=ue[0],W[1]=ue[1]}if(O.touches[1]){var ue=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);W[2]=ue[0],W[3]=ue[1]}if(O.touches[2]){var ue=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);W[4]=ue[0],W[5]=ue[1]}var be=t.touchData.startGPosition,Le;if(V&&O.touches[0]&&be){for(var ye=[],Ce=0;Ce<W.length;Ce++)ye[Ce]=W[Ce]-ce[Ce];var me=O.touches[0].clientX-be[0],Ee=me*me,Ge=O.touches[0].clientY-be[1],_e=Ge*Ge,yt=Ee+_e;Le=yt>=t.touchTapThreshold2}if(V&&t.touchData.cxt){O.preventDefault();var mt=O.touches[0].clientX-G,We=O.touches[0].clientY-$,dt=O.touches[1].clientX-G,st=O.touches[1].clientY-$,Mt=K(mt,We,dt,st),Gt=Mt/F,vr=150,jt=vr*vr,dr=1.5,Ia=dr*dr;if(Gt>=Ia||Mt>=jt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var er={originalEvent:O,type:"cxttapend",position:{x:W[0],y:W[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(er),t.touchData.start=null):H.emit(er)}}if(V&&t.touchData.cxt){var er={originalEvent:O,type:"cxtdrag",position:{x:W[0],y:W[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(er):H.emit(er),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var ut=t.findNearestElement(W[0],W[1],!0,!0);(!t.touchData.cxtOver||ut!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:W[0],y:W[1]}}),t.touchData.cxtOver=ut,ut&&ut.emit({originalEvent:O,type:"cxtdragover",position:{x:W[0],y:W[1]}}))}else if(V&&O.touches[2]&&H.boxSelectionEnabled())O.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||H.emit({originalEvent:O,type:"boxstart",position:{x:W[0],y:W[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,J[4]=1,!J||J.length===0||J[0]===void 0?(J[0]=(W[0]+W[2]+W[4])/3,J[1]=(W[1]+W[3]+W[5])/3,J[2]=(W[0]+W[2]+W[4])/3+1,J[3]=(W[1]+W[3]+W[5])/3+1):(J[2]=(W[0]+W[2]+W[4])/3,J[3]=(W[1]+W[3]+W[5])/3),t.redrawHint("select",!0),t.redraw();else if(V&&O.touches[1]&&!t.touchData.didSelect&&H.zoomingEnabled()&&H.panningEnabled()&&H.userZoomingEnabled()&&H.userPanningEnabled()){O.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var et=t.dragData.touchDragEles;if(et){t.redrawHint("drag",!0);for(var lt=0;lt<et.length;lt++){var Ma=et[lt]._private;Ma.grabbed=!1,Ma.rscratch.inDragLayer=!1}}var St=t.touchData.start,mt=O.touches[0].clientX-G,We=O.touches[0].clientY-$,dt=O.touches[1].clientX-G,st=O.touches[1].clientY-$,Gi=q(mt,We,dt,st),ih=Gi/k;if(_){var sh=mt-N,oh=We-P,uh=dt-R,lh=st-I,fh=(sh+uh)/2,hh=(oh+lh)/2,Vr=H.zoom(),On=Vr*ih,Ra=H.pan(),zi=B[0]*Vr+Ra.x,qi=B[1]*Vr+Ra.y,ch={x:-On/Vr*(zi-Ra.x-fh)+zi,y:-On/Vr*(qi-Ra.y-hh)+qi};if(St&&St.active()){var et=t.dragData.touchDragEles;p(et),t.redrawHint("drag",!0),t.redrawHint("eles",!0),St.unactivate().emit("freeon"),et.emit("free"),t.dragData.didDrag&&(St.emit("dragfreeon"),et.emit("dragfree"))}H.viewport({zoom:On,pan:ch,cancelOnFailedZoom:!0}),H.emit("pinchzoom"),k=Gi,N=mt,P=We,R=dt,I=st,t.pinching=!0}if(O.touches[0]){var ue=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);W[0]=ue[0],W[1]=ue[1]}if(O.touches[1]){var ue=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);W[2]=ue[0],W[3]=ue[1]}if(O.touches[2]){var ue=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);W[4]=ue[0],W[5]=ue[1]}}else if(O.touches[0]&&!t.touchData.didSelect){var bt=t.touchData.start,Nn=t.touchData.last,ut;if(!t.hoverData.draggingEles&&!t.swipePanning&&(ut=t.findNearestElement(W[0],W[1],!0,!0)),V&&bt!=null&&O.preventDefault(),V&&bt!=null&&t.nodeIsDraggable(bt))if(Le){var et=t.dragData.touchDragEles,Vi=!t.dragData.didDrag;Vi&&d(et,{inDragLayer:!0}),t.dragData.didDrag=!0;var Ur={x:0,y:0};if(ae(ye[0])&&ae(ye[1])&&(Ur.x+=ye[0],Ur.y+=ye[1],Vi)){t.redrawHint("eles",!0);var Et=t.touchData.dragDelta;Et&&ae(Et[0])&&ae(Et[1])&&(Ur.x+=Et[0],Ur.y+=Et[1])}t.hoverData.draggingEles=!0,et.silentShift(Ur).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ce[0]&&t.touchData.startPosition[1]==ce[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Et=t.touchData.dragDelta=t.touchData.dragDelta||[];Et.length===0?(Et.push(ye[0]),Et.push(ye[1])):(Et[0]+=ye[0],Et[1]+=ye[1])}if(a(bt||ut,["touchmove","tapdrag","vmousemove"],O,{x:W[0],y:W[1]}),(!bt||!bt.grabbed())&&ut!=Nn&&(Nn&&Nn.emit({originalEvent:O,type:"tapdragout",position:{x:W[0],y:W[1]}}),ut&&ut.emit({originalEvent:O,type:"tapdragover",position:{x:W[0],y:W[1]}})),t.touchData.last=ut,V)for(var lt=0;lt<W.length;lt++)W[lt]&&t.touchData.startPosition[lt]&&Le&&(t.touchData.singleTouchMoved=!0);if(V&&(bt==null||bt.pannable())&&H.panningEnabled()&&H.userPanningEnabled()){var vh=i(bt,t.touchData.starts);vh&&(O.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Dr(t.touchData.startPosition)),t.swipePanning?(H.panBy({x:ye[0]*Z,y:ye[1]*Z}),H.emit("dragpan")):Le&&(t.swipePanning=!0,H.panBy({x:me*Z,y:Ge*Z}),H.emit("dragpan"),bt&&(bt.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var ue=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);W[0]=ue[0],W[1]=ue[1]}}for(var Ce=0;Ce<W.length;Ce++)ce[Ce]=W[Ce];V&&O.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var ee;t.registerBinding(e,"touchcancel",ee=function(O){var V=t.touchData.start;t.touchData.capture=!1,V&&V.unactivate()});var ie,de,te,re;if(t.registerBinding(e,"touchend",ie=function(O){var V=t.touchData.start,J=t.touchData.capture;if(J)O.touches.length===0&&(t.touchData.capture=!1),O.preventDefault();else return;var H=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var W=t.cy,ce=W.zoom(),Z=t.touchData.now,ue=t.touchData.earlier;if(O.touches[0]){var be=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Z[0]=be[0],Z[1]=be[1]}if(O.touches[1]){var be=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Z[2]=be[0],Z[3]=be[1]}if(O.touches[2]){var be=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Z[4]=be[0],Z[5]=be[1]}V&&V.unactivate();var Le;if(t.touchData.cxt){if(Le={originalEvent:O,type:"cxttapend",position:{x:Z[0],y:Z[1]}},V?V.emit(Le):W.emit(Le),!t.touchData.cxtDragged){var ye={originalEvent:O,type:"cxttap",position:{x:Z[0],y:Z[1]}};V?V.emit(ye):W.emit(ye)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!O.touches[2]&&W.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ce=W.collection(t.getAllInBox(H[0],H[1],H[2],H[3]));H[0]=void 0,H[1]=void 0,H[2]=void 0,H[3]=void 0,H[4]=0,t.redrawHint("select",!0),W.emit({type:"boxend",originalEvent:O,position:{x:Z[0],y:Z[1]}});var me=function(jt){return jt.selectable()&&!jt.selected()};Ce.emit("box").stdFilter(me).select().emit("boxselect"),Ce.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(V?.unactivate(),O.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!O.touches[1]){if(!O.touches[0]){if(!O.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ee=t.dragData.touchDragEles;if(V!=null){var Ge=V._private.grabbed;p(Ee),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ge&&(V.emit("freeon"),Ee.emit("free"),t.dragData.didDrag&&(V.emit("dragfreeon"),Ee.emit("dragfree"))),a(V,["touchend","tapend","vmouseup","tapdragout"],O,{x:Z[0],y:Z[1]}),V.unactivate(),t.touchData.start=null}else{var _e=t.findNearestElement(Z[0],Z[1],!0,!0);a(_e,["touchend","tapend","vmouseup","tapdragout"],O,{x:Z[0],y:Z[1]})}var yt=t.touchData.startPosition[0]-Z[0],mt=yt*yt,We=t.touchData.startPosition[1]-Z[1],dt=We*We,st=mt+dt,Mt=st*ce*ce;t.touchData.singleTouchMoved||(V||W.$(":selected").unselect(["tapunselect"]),a(V,["tap","vclick"],O,{x:Z[0],y:Z[1]}),de=!1,O.timeStamp-re<=W.multiClickDebounceTime()?(te&&clearTimeout(te),de=!0,re=null,a(V,["dbltap","vdblclick"],O,{x:Z[0],y:Z[1]})):(te=setTimeout(function(){de||a(V,["onetap","voneclick"],O,{x:Z[0],y:Z[1]})},W.multiClickDebounceTime()),re=O.timeStamp)),V!=null&&!t.dragData.didDrag&&V._private.selectable&&Mt<t.touchTapThreshold2&&!t.pinching&&(W.selectionType()==="single"?(W.$(r).unmerge(V).unselect(["tapunselect"]),V.select(["tapselect"])):V.selected()?V.unselect(["tapunselect"]):V.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var Gt=0;Gt<Z.length;Gt++)ue[Gt]=Z[Gt];t.dragData.didDrag=!1,O.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),O.touches.length<2&&(O.touches.length===1&&(t.touchData.startGPosition=[O.touches[0].clientX,O.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent>"u"){var fe=[],le=function(O){return{clientX:O.clientX,clientY:O.clientY,force:1,identifier:O.pointerId,pageX:O.pageX,pageY:O.pageY,radiusX:O.width/2,radiusY:O.height/2,screenX:O.screenX,screenY:O.screenY,target:O.target}},oe=function(O){return{event:O,touch:le(O)}},he=function(O){fe.push(oe(O))},Te=function(O){for(var V=0;V<fe.length;V++){var J=fe[V];if(J.event.pointerId===O.pointerId){fe.splice(V,1);return}}},we=function(O){var V=fe.filter(function(J){return J.event.pointerId===O.pointerId})[0];V.event=O,V.touch=le(O)},pe=function(O){O.touches=fe.map(function(V){return V.touch})},xe=function(O){return O.pointerType==="mouse"||O.pointerType===4};t.registerBinding(t.container,"pointerdown",function(U){xe(U)||(U.preventDefault(),he(U),pe(U),j(U))}),t.registerBinding(t.container,"pointerup",function(U){xe(U)||(Te(U),pe(U),ie(U))}),t.registerBinding(t.container,"pointercancel",function(U){xe(U)||(Te(U),pe(U),ee(U))}),t.registerBinding(t.container,"pointermove",function(U){xe(U)||(U.preventDefault(),we(U),pe(U),Q(U))})}};var Bt={};Bt.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,s,o){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,l,u){return va(o,l,this.points,a,n,i/2,s/2,u)},checkPoint:function(a,n,i,s,o,l,u){return kt(a,n,this.points,l,u,s,o,[0,-1],i)}}};Bt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){return wp(i,s,e,r,a/2+o,n/2+o)},checkPoint:function(e,r,a,n,i,s,o){return nr(e,r,n,i,s,o,a)}}};Bt.generateRoundPolygon=function(t,e){for(var r=new Array(e.length*2),a=0;a<e.length/2;a++){var n=a*2,i=void 0;a<e.length/2-1?i=(a+1)*2:i=0,r[a*4]=e[n],r[a*4+1]=e[n+1];var s=e[i]-e[n],o=e[i+1]-e[n+1],l=Math.sqrt(s*s+o*o);r[a*4+2]=s/l,r[a*4+3]=o/l}return this.nodeShapes[t]={renderer:this,name:t,points:r,draw:function(f,h,c,v,d){this.renderer.nodeShapeImpl("round-polygon",f,h,c,v,d,this.points)},intersectLine:function(f,h,c,v,d,g,p){return xp(d,g,this.points,f,h,c,v)},checkPoint:function(f,h,c,v,d,g,p){return Ep(f,h,this.points,g,p,v,d)}}};Bt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ot(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){return Xl(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var l=xa(n,i),u=l*2;return!!(kt(e,r,this.points,s,o,n,i-u,[0,-1],a)||kt(e,r,this.points,s,o,n-u,i,[0,-1],a)||nr(e,r,u,u,s-n/2+l,o-i/2+l,a)||nr(e,r,u,u,s+n/2-l,o-i/2+l,a)||nr(e,r,u,u,s+n/2-l,o+i/2-l,a)||nr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}};Bt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Wl(),points:ot(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},generateCutTrianglePts:function(e,r,a,n){var i=this.cornerLength,s=r/2,o=e/2,l=a-o,u=a+o,f=n-s,h=n+s;return{topLeft:[l,f+i,l+i,f,l+i,f+i],topRight:[u-i,f,u,f+i,u-i,f+i],bottomRight:[u,h-i,u-i,h,u-i,h-i],bottomLeft:[l+i,h,l,h-i,l+i,h-i]}},intersectLine:function(e,r,a,n,i,s,o){var l=this.generateCutTrianglePts(a+2*o,n+2*o,e,r),u=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return va(i,s,u,e,r)},checkPoint:function(e,r,a,n,i,s,o){if(kt(e,r,this.points,s,o,n,i-2*this.cornerLength,[0,-1],a)||kt(e,r,this.points,s,o,n-2*this.cornerLength,i,[0,-1],a))return!0;var l=this.generateCutTrianglePts(n,i,s,o);return ft(e,r,l.topLeft)||ft(e,r,l.topRight)||ft(e,r,l.bottomRight)||ft(e,r,l.bottomLeft)}}};Bt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ot(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){var l=.15,u=.5,f=.85,h=this.generateBarrelBezierPts(a+2*o,n+2*o,e,r),c=function(g){var p=Lr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},l),y=Lr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},u),b=Lr({x:g[0],y:g[1]},{x:g[2],y:g[3]},{x:g[4],y:g[5]},f);return[g[0],g[1],p.x,p.y,y.x,y.y,b.x,b.y,g[4],g[5]]},v=[].concat(c(h.topLeft),c(h.topRight),c(h.bottomRight),c(h.bottomLeft));return va(i,s,v,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,s=e/2,o=a-s,l=a+s,u=n-i,f=n+i,h=jn(e,r),c=h.heightOffset,v=h.widthOffset,d=h.ctrlPtOffsetPct*e,g={topLeft:[o,u+c,o+d,u,o+v,u],topRight:[l-v,u,l-d,u,l,u+c],bottomRight:[l,f-c,l-d,f,l-v,f],bottomLeft:[o+v,f,o+d,f,o,f-c]};return g.topLeft.isTop=!0,g.topRight.isTop=!0,g.bottomLeft.isBottom=!0,g.bottomRight.isBottom=!0,g},checkPoint:function(e,r,a,n,i,s,o){var l=jn(n,i),u=l.heightOffset,f=l.widthOffset;if(kt(e,r,this.points,s,o,n,i-2*u,[0,-1],a)||kt(e,r,this.points,s,o,n-2*f,i,[0,-1],a))return!0;for(var h=this.generateBarrelBezierPts(n,i,s,o),c=function(E,C,T){var L=T[4],A=T[2],S=T[0],M=T[5],N=T[1],P=Math.min(L,S),R=Math.max(L,S),I=Math.min(M,N),k=Math.max(M,N);if(P<=E&&E<=R&&I<=C&&C<=k){var F=Tp(L,A,S),z=pp(F[0],F[1],F[2],E),B=z.filter(function(G){return 0<=G&&G<=1});if(B.length>0)return B[0]}return null},v=Object.keys(h),d=0;d<v.length;d++){var g=v[d],p=h[g],y=c(e,r,p);if(y!=null){var b=p[5],w=p[3],D=p[1],m=Xe(b,w,D,y);if(p.isTop&&m<=r||p.isBottom&&r<=m)return!0}}return!1}}};Bt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ot(4,0),draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){var l=e-(a/2+o),u=r-(n/2+o),f=u,h=e+(a/2+o),c=Yt(i,s,e,r,l,u,h,f,!1);return c.length>0?c:Xl(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var l=xa(n,i),u=2*l;if(kt(e,r,this.points,s,o,n,i-u,[0,-1],a)||kt(e,r,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(ft(e,r,c)||nr(e,r,u,u,s+n/2-l,o+i/2-l,a)||nr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}};Bt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ot(3,0)),this.generateRoundPolygon("round-triangle",ot(3,0)),this.generatePolygon("rectangle",ot(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",ot(5,0)),this.generateRoundPolygon("round-pentagon",ot(5,0)),this.generatePolygon("hexagon",ot(6,0)),this.generateRoundPolygon("round-hexagon",ot(6,0)),this.generatePolygon("heptagon",ot(7,0)),this.generateRoundPolygon("round-heptagon",ot(7,0)),this.generatePolygon("octagon",ot(8,0)),this.generateRoundPolygon("round-octagon",ot(8,0));var a=new Array(20);{var n=Jn(5,0),i=Jn(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=_l(a),this.generatePolygon("star",a),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)}t.makePolygon=function(u){var f=u.join("$"),h="polygon-"+f,c;return(c=this[h])?c:e.generatePolygon(h,u)}};var Sa={};Sa.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Sa.redraw=function(t){t=t||Vl();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Sa.beforeRender=function(t,e){if(!this.destroyed){e==null&&ze("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var yl=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Sa.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function a(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){yl(t,!0,n);var i=Rt();t.render(t.renderOptions);var s=t.lastDrawTime=Rt();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-i;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else yl(t,!1,n);t.skipFrame=!1,nn(a)}};nn(r)}};var Km=function(e){this.init(e)},Ff=Km,zr=Ff.prototype;zr.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];zr.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=n.getElementById(s)!=null;if(r.className.indexOf(o)<0&&(r.className=(r.className||"")+" "+o),!l){var u=n.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}var f=a.getComputedStyle(r),h=f.getPropertyValue("position");h==="static"&&Ie("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=ae(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};zr.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};zr.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch{}};zr.isHeadless=function(){return!1};[Li,Pf,Bf,Gr,Bt,Sa].forEach(function(t){ge(zr,t)});var Kn=1e3/60,Gf={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=gn.default(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),s=function(u,f){var h=Rt(),c=n.averageRedrawTime,v=n.lastRedrawTime,d=[],g=n.cy.extent(),p=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var y=Rt(),b=y-h,w=y-f;if(v<Kn){var D=Kn-(u?c:0);if(w>=e.deqFastCost*D)break}else if(u){if(b>=e.deqCost*v||b>=e.deqAvgCost*c)break}else if(w>=e.deqNoDrawCost*Kn)break;var m=e.deq(a,p,g);if(m.length>0)for(var x=0;x<m.length;x++)d.push(m[x]);else break}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,g)&&i())},o=e.priority||gi;n.beforeRender(s,o(a))}}}},Zm=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:sn;fi(this,t),this.idsByKey=new At,this.keyForId=new At,this.cachesByLvl=new At,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return hi(t,[{key:"getIdsFor",value:function(r){r==null&&ze("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new kr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new At,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),t}(),ml=25,Wa=50,rn=-4,si=3,Qm=7.99,Jm=8,jm=1024,e0=1024,t0=1024,r0=.2,a0=.8,n0=10,i0=.15,s0=.1,o0=.9,u0=.9,l0=100,f0=1,Sr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},h0=Je({getKey:null,doesEleInvalidateKey:sn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Gl,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ia=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=h0(r);ge(a,n),a.lookup=new Zm(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},He=ia.prototype;He.reasons=Sr;He.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};He.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};He.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new ba.default(function(r,a){return a.reqs-r.reqs});return e};He.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};He.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(yi(o*r))),a<rn)a=rn;else if(o>=Qm||a>si)return null;var u=Math.pow(2,a),f=e.h*u,h=e.w*u,c=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,c))return null;var v=l.get(t,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=ml?d=ml:f<=Wa?d=Wa:d=Math.ceil(f/Wa)*Wa,f>t0||h>e0)return null;var g=i.getTextureQueue(d),p=g[g.length-2],y=function(){return i.recycleTexture(d,h)||i.addTexture(d,h)};p||(p=g[g.length-1]),p||(p=y()),p.width-p.usedWidth<h&&(p=y());for(var b=function(R){return R&&R.scaledLabelShown===c},w=n&&n===Sr.dequeue,D=n&&n===Sr.highQuality,m=n&&n===Sr.downscale,x,E=a+1;E<=si;E++){var C=l.get(t,E);if(C){x=C;break}}var T=x&&x.level===a+1?x:null,L=function(){p.context.drawImage(T.texture.canvas,T.x,0,T.width,T.height,p.usedWidth,0,h,f)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,h,d),b(T))L();else if(b(x))if(D){for(var A=x.level;A>a;A--)T=i.getElement(t,e,r,A,Sr.downscale);L()}else return i.queueElement(t,x.level-1),x;else{var S;if(!w&&!D&&!m)for(var M=a-1;M>=rn;M--){var N=l.get(t,M);if(N){S=N;break}}if(b(S))return i.queueElement(t,a),S;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,t,e,c,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return v={x:p.usedWidth,texture:p,level:a,scale:u,width:h,height:f,scaledLabelShown:c},p.usedWidth+=Math.ceil(h+Jm),p.eleCaches.push(v),l.set(t,a,v),i.checkTextureFullness(p),v};He.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};He.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=rn;i<=si;i++){var s=r.getForCachedKey(t,i);s&&a.push(s)}var o=r.invalidate(t);if(o)for(var l=0;l<a.length;l++){var u=a[l],f=u.texture;f.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};He.checkTextureUtility=function(t){t.invalidatedWidth>=r0*t.width&&this.retireTexture(t)};He.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>a0&&t.fullnessChecks>=n0?_t(r,t):t.fullnessChecks++};He.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;_t(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}pi(i);var l=e.getRetiredTextureQueue(r);l.push(t)};He.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(jm,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};He.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,pi(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),_t(n,s),a.push(s),s}};He.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}};He.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<f0&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var h=e.getBoundingBox(u);e.getElement(u,h,t,o.level,Sr.dequeue)}return n};He.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=di,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};He.onDequeue=function(t){this.onDequeues.push(t)};He.offDequeue=function(t){_t(this.onDequeues,t)};He.setupDequeueing=Gf.setupDequeueing({deqRedrawThreshold:l0,deqCost:i0,deqAvgCost:s0,deqNoDrawCost:o0,deqFastCost:u0,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var s=r[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(mi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var c0=1,oa=-4,dn=2,v0=3.99,d0=50,g0=50,p0=.15,y0=.1,m0=.9,b0=.9,E0=1,bl=250,w0=4e3*4e3,x0=!0,zf=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=Rt()-2*bl,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=gn.default(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},g0),a.beforeRender(function(s,o){o-r.lastInvalidationTime<=bl?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(o,l){return l.reqs-o.reqs};r.layersQueue=new ba.default(i),r.setupDequeueing()},je=zf.prototype,El=0,T0=Math.pow(2,53)-1;je.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),s={id:El=++El%T0,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(r,r),o.translate(l,u),s};je.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(yi(s*e)),r<oa)r=oa;else if(s>=v0||r>dn)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),f=l[r]=l[r]||[],h,c=a.levelIsComplete(r,t),v,d=function(){var L=function(P){if(a.validateLayersElesOrdering(P,t),a.levelIsComplete(P,t))return v=l[P],!0},A=function(P){if(!v)for(var R=r+P;oa<=R&&R<=dn&&!L(R);R+=P);};A(1),A(-1);for(var S=f.length-1;S>=0;S--){var M=f[S];M.invalid&&_t(f,M)}};if(!c)d();else return f;var g=function(){if(!h){h=ht();for(var L=0;L<t.length;L++)Hl(h,t[L].boundingBox())}return h},p=function(L){L=L||{};var A=L.after;g();var S=h.w*u*(h.h*u);if(S>w0)return null;var M=a.makeLayer(h,r);if(A!=null){var N=f.indexOf(A)+1;f.splice(N,0,M)}else(L.insert===void 0||L.insert)&&f.unshift(M);return M};if(a.skipping&&!o)return null;for(var y=null,b=t.length/c0,w=!o,D=0;D<t.length;D++){var m=t[D],x=m._private.rscratch,E=x.imgLayerCaches=x.imgLayerCaches||{},C=E[r];if(C){y=C;continue}if((!y||y.eles.length>=b||!$l(y.bb,m.boundingBox()))&&(y=p({insert:!0,after:y}),!y))return null;v||w?a.queueLayer(y,m):a.drawEleInLayer(y,m,r,e),y.eles.push(m),E[r]=y}return v||(w?null:f)};je.getEleLevelForLayerLevel=function(t,e){return t};je.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,x0),i.setImgSmoothing(s,!0))};je.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length};je.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}};je.updateElementsInLayers=function(t,e){for(var r=this,a=wa(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],s=a?t[n]:t[n].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=oa;u<=dn;u++){var f=l[u];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}};je.haveLayers=function(){for(var t=this,e=!1,r=oa;r<=dn;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};je.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=Rt(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};je.invalidateLayer=function(t){if(this.lastInvalidationTime=Rt(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];_t(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};je.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};je.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};je.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};je.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<E0&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};je.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var s=t.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}};je.requestRedraw=gn.default(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);je.setupDequeueing=Gf.setupDequeueing({deqRedrawThreshold:d0,deqCost:p0,deqAvgCost:y0,deqNoDrawCost:m0,deqFastCost:b0,deq:function(e,r){return e.dequeue(r)},onDeqd:gi,shouldRedraw:Gl,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var qf={},wl;function C0(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function D0(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function xl(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var s=r,o=r[0];t.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function S0(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,s=i[0];t.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function L0(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}qf.arrowShapeImpl=function(t){return(wl||(wl={polygon:C0,"triangle-backcurve":D0,"triangle-tee":xl,"circle-triangle":S0,"triangle-cross":xl,circle:L0}))[t]};var It={};It.drawElement=function(t,e,r,a,n,i){var s=this;e.isNode()?s.drawNode(t,e,r,a,n,i):s.drawEdge(t,e,r,a,n,i)};It.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};It.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};It.drawCachedElementPortion=function(t,e,r,a,n,i,s,o){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var f=r.getElement(e,u,a,n,i);if(f!=null){var h=o(l,e);if(h===0)return;var c=s(l,e),v=u.x1,d=u.y1,g=u.w,p=u.h,y,b,w,D,m;if(c!==0){var x=r.getRotationPoint(e);w=x.x,D=x.y,t.translate(w,D),t.rotate(c),m=l.getImgSmoothing(t),m||l.setImgSmoothing(t,!0);var E=r.getRotationOffset(e);y=E.x,b=E.y}else y=v,b=d;var C;h!==1&&(C=t.globalAlpha,t.globalAlpha=C*h),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,y,b,g,p),h!==1&&(t.globalAlpha=C),c!==0&&(t.rotate(-c),t.translate(-w,-D),m||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var A0=function(){return 0},O0=function(e,r){return e.getTextAngle(r,null)},N0=function(e,r){return e.getTextAngle(r,"source")},I0=function(e,r){return e.getTextAngle(r,"target")},M0=function(e,r){return r.effectiveOpacity()},Zn=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};It.drawCachedElement=function(t,e,r,a,n,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,f=o.slbTxrCache,h=o.tlbTxrCache,c=e.boundingBox(),v=i===!0?l.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||mi(c,a))){var d=e.isEdge(),g=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,r,n,v,A0,M0),(!d||!g)&&s.drawCachedElementPortion(t,e,u,r,n,v,O0,Zn),d&&!g&&(s.drawCachedElementPortion(t,e,f,r,n,v,N0,Zn),s.drawCachedElementPortion(t,e,h,r,n,v,I0,Zn)),s.drawElementOverlay(t,e)}};It.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};It.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(t,s,r,a)}};It.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(t,s,r,a)}};It.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(t,e,r,a)};var Ft={};Ft.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,g=u*f,p=u*f,y=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;h==="straight-triangle"?(s.eleStrokeStyle(t,e,S),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=d,s.eleStrokeStyle(t,e,S),s.drawEdgePath(e,t,o.allpts,c),t.lineCap="butt")},b=function(){n&&s.drawEdgeOverlay(t,e)},w=function(){n&&s.drawEdgeUnderlay(t,e)},D=function(){var S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;s.drawArrowheads(t,e,S)},m=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var x=e.pstyle("ghost").value==="yes";if(x){var E=e.pstyle("ghost-offset-x").pfValue,C=e.pstyle("ghost-offset-y").pfValue,T=e.pstyle("ghost-opacity").value,L=g*T;t.translate(E,C),y(L),D(L),t.translate(-E,-C)}w(),y(),D(),b(),m(),r&&t.translate(l.x1,l.y1)}};var Vf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};Ft.drawEdgeOverlay=Vf("overlay");Ft.drawEdgeUnderlay=Vf("underlay");Ft.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+3]);break;case"straight":case"segments":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};Ft.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(r[n]-l[0],r[n+1]-l[1]),e.lineTo(r[n]+l[0],r[n+1]+l[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};Ft.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};Ft.drawArrowhead=function(t,e,r,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,h=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),v=c.value==="match-line"?h:c.pfValue;c.units==="%"&&(v*=h);var d=e.pstyle("opacity").value;s===void 0&&(s=d);var g=t.globalCompositeOperation;(s!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,h,l,v,a,n,i),t.globalCompositeOperation=g);var p=e.pstyle(r+"-arrow-color").value;o.colorFillStyle(t,p[0],p[1],p[2],s),o.colorStrokeStyle(t,p[0],p[1],p[2],s),o.drawArrowShape(e,t,f,h,l,v,a,n,i)}}};Ft.drawArrowShape=function(t,e,r,a,n,i,s,o,l){var u=this,f=this.usePaths()&&n!=="triangle-cross",h=!1,c,v=e,d={x:s,y:o},g=t.pstyle("arrow-scale").value,p=this.getArrowWidth(a,g),y=u.arrowShapes[n];if(f){var b=u.arrowPathCache=u.arrowPathCache||[],w=ir(n),D=b[w];D!=null?(c=e=D,h=!0):(c=e=new Path2D,b[w]=c)}h||(e.beginPath&&e.beginPath(),f?y.draw(e,1,0,{x:0,y:0},1):y.draw(e,p,l,d,a),e.closePath&&e.closePath()),e=v,f&&(e.translate(s,o),e.rotate(l),e.scale(p,p)),(r==="filled"||r==="both")&&(f?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?p:1),e.lineJoin="miter",f?e.stroke(c):e.stroke()),f&&(e.scale(1/p,1/p),e.rotate(-l),e.translate(-s,-o))};var Oi={};Oi.safeDrawImage=function(t,e,r,a,n,i,s,o,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{t.drawImage(e,r,a,n,i,s,o,l,u)}catch(f){Ie(f)}};Oi.drawInscribedImage=function(t,e,r,a,n){var i=this,s=r.position(),o=s.x,l=s.y,u=r.cy().style(),f=u.getIndexedStyle.bind(u),h=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),v=r.width(),d=r.height(),g=r.padding()*2,p=v+(f(r,"background-width-relative-to","value",a)==="inner"?0:g),y=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:g),b=r._private.rscratch,w=f(r,"background-clip","value",a),D=w==="node",m=f(r,"background-image-opacity","value",a)*n,x=f(r,"background-image-smoothing","value",a),E=e.width||e.cachedW,C=e.height||e.cachedH;(E==null||C==null)&&(document.body.appendChild(e),E=e.cachedW=e.width||e.offsetWidth,C=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var T=E,L=C;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?T=f(r,"background-width","pfValue",a)*p:T=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?L=f(r,"background-height","pfValue",a)*y:L=f(r,"background-height","pfValue",a)),!(T===0||L===0)){if(h==="contain"){var A=Math.min(p/T,y/L);T*=A,L*=A}else if(h==="cover"){var A=Math.max(p/T,y/L);T*=A,L*=A}var S=o-p/2,M=f(r,"background-position-x","units",a),N=f(r,"background-position-x","pfValue",a);M==="%"?S+=(p-T)*N:S+=N;var P=f(r,"background-offset-x","units",a),R=f(r,"background-offset-x","pfValue",a);P==="%"?S+=(p-T)*R:S+=R;var I=l-y/2,k=f(r,"background-position-y","units",a),F=f(r,"background-position-y","pfValue",a);k==="%"?I+=(y-L)*F:I+=F;var z=f(r,"background-offset-y","units",a),B=f(r,"background-offset-y","pfValue",a);z==="%"?I+=(y-L)*B:I+=B,b.pathCache&&(S-=o,I-=l,o=0,l=0);var G=t.globalAlpha;t.globalAlpha=m;var $=i.getImgSmoothing(t),X=!1;if(x==="no"&&$?(i.setImgSmoothing(t,!1),X=!0):x==="yes"&&!$&&(i.setImgSmoothing(t,!0),X=!0),c==="no-repeat")D&&(t.save(),b.pathCache?t.clip(b.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,y),t.clip())),i.safeDrawImage(t,e,0,0,E,C,S,I,T,L),D&&t.restore();else{var Y=t.createPattern(e,c);t.fillStyle=Y,i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,y),t.translate(S,I),t.fill(),t.translate(-S,-I)}t.globalAlpha=G,X&&i.setImgSmoothing(t,$)}};var cr={};cr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(yi(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};cr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(s.drawText(t,e,null,v,i),e.isEdge()&&(s.drawText(t,e,"source",v,i),s.drawText(t,e,"target",v,i))):s.drawText(t,e,n,v,i),r&&t.translate(d.x1,d.y1)};cr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};cr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],l)};function Qn(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),s?t.stroke():t.fill()}cr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=Tt(n,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r};cr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=Tt(s,"labelX",r),u=Tt(s,"labelY",r),f,h,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var v=r?r+"-":"",d=Tt(s,"labelWidth",r),g=Tt(s,"labelHeight",r),p=e.pstyle(v+"text-margin-x").pfValue,y=e.pstyle(v+"text-margin-y").pfValue,b=e.isEdge(),w=e.pstyle("text-halign").value,D=e.pstyle("text-valign").value;b&&(w="center",D="center"),l+=p,u+=y;var m;switch(a?m=this.getTextAngle(e,r):m=0,m!==0&&(f=l,h=u,t.translate(f,h),t.rotate(m),l=0,u=0),D){case"top":break;case"center":u+=g/2;break;case"bottom":u+=g;break}var x=e.pstyle("text-background-opacity").value,E=e.pstyle("text-border-opacity").value,C=e.pstyle("text-border-width").pfValue,T=e.pstyle("text-background-padding").pfValue,L=e.pstyle("text-background-shape").strValue,A=L.indexOf("round")===0,S=2;if(x>0||C>0&&E>0){var M=l-T;switch(w){case"left":M-=d;break;case"center":M-=d/2;break}var N=u-g-T,P=d+2*T,R=g+2*T;if(x>0){var I=t.fillStyle,k=e.pstyle("text-background-color").value;t.fillStyle="rgba("+k[0]+","+k[1]+","+k[2]+","+x*o+")",A?Qn(t,M,N,P,R,S):t.fillRect(M,N,P,R),t.fillStyle=I}if(C>0&&E>0){var F=t.strokeStyle,z=t.lineWidth,B=e.pstyle("text-border-color").value,G=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+B[0]+","+B[1]+","+B[2]+","+E*o+")",t.lineWidth=C,t.setLineDash)switch(G){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=C/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(A?Qn(t,M,N,P,R,S,"stroke"):t.strokeRect(M,N,P,R),G==="double"){var $=C/2;A?Qn(t,M+$,N+$,P-$*2,R-$*2,S,"stroke"):t.strokeRect(M+$,N+$,P-$*2,R-$*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=z,t.strokeStyle=F}}var X=2*e.pstyle("text-outline-width").pfValue;if(X>0&&(t.lineWidth=X),e.pstyle("text-wrap").value==="wrap"){var Y=Tt(s,"labelWrapCachedLines",r),_=Tt(s,"labelLineHeight",r),q=d/2,K=this.getLabelJustification(e);switch(K==="auto"||(w==="left"?K==="left"?l+=-d:K==="center"&&(l+=-q):w==="center"?K==="left"?l+=-q:K==="right"&&(l+=q):w==="right"&&(K==="center"?l+=q:K==="right"&&(l+=d))),D){case"top":u-=(Y.length-1)*_;break;case"center":case"bottom":u-=(Y.length-1)*_;break}for(var j=0;j<Y.length;j++)X>0&&t.strokeText(Y[j],l,u),t.fillText(Y[j],l,u),u+=_}else X>0&&t.strokeText(c,l,u),t.fillText(c,l,u);m!==0&&(t.rotate(-m),t.translate(-f,-h))}}};var qr={};qr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,f=u.rscratch,h=e.position();if(!(!ae(h.x)||!ae(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,v=s.usePaths(),d,g=!1,p=e.padding();o=e.width()+2*p,l=e.height()+2*p;var y;r&&(y=r,t.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image"),w=b.value,D=new Array(w.length),m=new Array(w.length),x=0,E=0;E<w.length;E++){var C=w[E],T=D[E]=C!=null&&C!=="none";if(T){var L=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",E);x++,m[E]=s.getCachedImage(C,L,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var A=e.pstyle("background-blacken").value,S=e.pstyle("border-width").pfValue,M=e.pstyle("background-opacity").value*c,N=e.pstyle("border-color").value,P=e.pstyle("border-style").value,R=e.pstyle("border-opacity").value*c,I=e.pstyle("outline-width").pfValue,k=e.pstyle("outline-color").value,F=e.pstyle("outline-style").value,z=e.pstyle("outline-opacity").value*c,B=e.pstyle("outline-offset").value;t.lineJoin="miter";var G=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M;s.eleFillStyle(t,e,U)},$=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:R;s.colorStrokeStyle(t,N[0],N[1],N[2],U)},X=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;s.colorStrokeStyle(t,k[0],k[1],k[2],U)},Y=function(U,O,V,J){var H=s.nodePathCache=s.nodePathCache||[],W=Fl(V==="polygon"?V+","+J.join(","):V,""+O,""+U),ce=H[W],Z,ue=!1;return ce!=null?(Z=ce,ue=!0,f.pathCache=Z):(Z=new Path2D,H[W]=f.pathCache=Z),{path:Z,cacheHit:ue}},_=e.pstyle("shape").strValue,q=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(h.x,h.y);var K=Y(o,l,_,q);d=K.path,g=K.cacheHit}var j=function(){if(!g){var U=h;v&&(U={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||t,U.x,U.y,o,l)}v?t.fill(d):t.fill()},Q=function(){for(var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,V=u.backgrounding,J=0,H=0;H<m.length;H++){var W=e.cy().style().getIndexedStyle(e,"background-image-containment","value",H);if(O&&W==="over"||!O&&W==="inside"){J++;continue}D[H]&&m[H].complete&&!m[H].error&&(J++,s.drawInscribedImage(t,m[H],e,H,U))}u.backgrounding=J!==x,V!==u.backgrounding&&e.updateStyle(!1)},ee=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(t,e,O),U&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,h.x,h.y,o,l)))},ie=function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,O=(A>0?A:-A)*U,V=A>0?0:255;A!==0&&(s.colorFillStyle(t,V,V,V,O),v?t.fill(d):t.fill())},de=function(){if(S>0){if(t.lineWidth=S,t.lineCap="butt",t.setLineDash)switch(P){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}if(v?t.stroke(d):t.stroke(),P==="double"){t.lineWidth=S/3;var U=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(d):t.stroke(),t.globalCompositeOperation=U}t.setLineDash&&t.setLineDash([])}},te=function(){if(I>0){if(t.lineWidth=I,t.lineCap="butt",t.setLineDash)switch(F){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var U=h;v&&(U={x:0,y:0});var O=s.getNodeShape(e),V=(o+S+(I+B))/o,J=(l+S+(I+B))/l,H=o*V,W=l*J,ce=s.nodeShapes[O].points,Z;if(v){var ue=Y(H,W,O,ce);Z=ue.path}if(O==="ellipse")s.drawEllipsePath(Z||t,U.x,U.y,H,W);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(O)){var be=0,Le=0,ye=0;O==="round-diamond"?be=(S+B+I)*1.4:O==="round-heptagon"?(be=(S+B+I)*1.075,ye=-(S/2+B+I)/35):O==="round-hexagon"?be=(S+B+I)*1.12:O==="round-pentagon"?(be=(S+B+I)*1.13,ye=-(S/2+B+I)/15):O==="round-tag"?(be=(S+B+I)*1.12,Le=(S/2+I+B)*.07):O==="round-triangle"&&(be=(S+B+I)*(Math.PI/2),ye=-(S+B/2+I)/Math.PI),be!==0&&(V=(o+be)/o,J=(l+be)/l),s.drawRoundPolygonPath(Z||t,U.x+Le,U.y+ye,o*V,l*J,ce)}else if(["roundrectangle","round-rectangle"].includes(O))s.drawRoundRectanglePath(Z||t,U.x,U.y,H,W);else if(["cutrectangle","cut-rectangle"].includes(O))s.drawCutRectanglePath(Z||t,U.x,U.y,H,W);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(O))s.drawBottomRoundRectanglePath(Z||t,U.x,U.y,H,W);else if(O==="barrel")s.drawBarrelPath(Z||t,U.x,U.y,H,W);else if(O.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(O)){var Ce=(S+I+B)/o;ce=on(un(ce,Ce)),s.drawPolygonPath(Z||t,U.x,U.y,o,l,ce)}else{var me=(S+I+B)/o;ce=on(un(ce,-me)),s.drawPolygonPath(Z||t,U.x,U.y,o,l,ce)}if(v?t.stroke(Z):t.stroke(),F==="double"){t.lineWidth=S/3;var Ee=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(Z):t.stroke(),t.globalCompositeOperation=Ee}t.setLineDash&&t.setLineDash([])}},re=function(){n&&s.drawNodeOverlay(t,e,h,o,l)},fe=function(){n&&s.drawNodeUnderlay(t,e,h,o,l)},le=function(){s.drawElementText(t,e,null,a)},oe=e.pstyle("ghost").value==="yes";if(oe){var he=e.pstyle("ghost-offset-x").pfValue,Te=e.pstyle("ghost-offset-y").pfValue,we=e.pstyle("ghost-opacity").value,pe=we*c;t.translate(he,Te),X(),te(),G(we*M),j(),Q(pe,!0),$(we*R),de(),ee(A!==0||S!==0),Q(pe,!1),ie(pe),t.translate(-he,-Te)}v&&t.translate(-h.x,-h.y),fe(),v&&t.translate(h.x,h.y),X(),te(),G(),j(),Q(c,!0),$(),de(),ee(A!==0||S!==0),Q(c,!1),ie(),v&&t.translate(-h.x,-h.y),le(),re(),r&&t.translate(y.x1,y.y1)}};var Uf=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value;if(u>0){if(n=n||a.position(),i==null||s==null){var c=a.padding();i=a.width()+2*c,s=a.height()+2*c}o.colorFillStyle(r,f[0],f[1],f[2],u),o.nodeShapes[h].draw(r,n.x,n.y,i+l*2,s+l*2),r.fill()}}}};qr.drawNodeOverlay=Uf("overlay");qr.drawNodeUnderlay=Uf("underlay");qr.hasPie=function(t){return t=t[0],t._private.hasPie};qr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,g=e.pstyle("pie-"+v+"-background-color").value,p=e.pstyle("pie-"+v+"-background-opacity").value*r,y=d/100;y+h>1&&(y=1-h);var b=1.5*Math.PI+2*Math.PI*h,w=2*Math.PI*y,D=b+w;d===0||h>=1||h+y>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,b,D),t.closePath(),this.colorFillStyle(t,g[0],g[1],g[2],p),t.fill(),h+=y)}};var vt={},R0=100;vt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e};vt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};vt.createGradientStyleFor=function(t,e,r,a,n){var i,s=this.usePaths(),o=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),f=r.targetEndpoint(),h=r.midpoint(),c=sr(u,h),v=sr(f,h);i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(c,v))}else{var d=s?{x:0,y:0}:r.position(),g=r.paddedWidth(),p=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(g,p))}else if(r.isEdge()){var y=r.sourceEndpoint(),b=r.targetEndpoint();i=t.createLinearGradient(y.x,y.y,b.x,b.y)}else{var w=s?{x:0,y:0}:r.position(),D=r.paddedWidth(),m=r.paddedHeight(),x=D/2,E=m/2,C=r.pstyle("background-gradient-direction").value;switch(C){case"to-bottom":i=t.createLinearGradient(w.x,w.y-E,w.x,w.y+E);break;case"to-top":i=t.createLinearGradient(w.x,w.y+E,w.x,w.y-E);break;case"to-left":i=t.createLinearGradient(w.x+x,w.y,w.x-x,w.y);break;case"to-right":i=t.createLinearGradient(w.x-x,w.y,w.x+x,w.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(w.x-x,w.y-E,w.x+x,w.y+E);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(w.x-x,w.y+E,w.x+x,w.y-E);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(w.x+x,w.y-E,w.x-x,w.y+E);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(w.x+x,w.y+E,w.x-x,w.y-E);break}}if(!i)return null;for(var T=l.length===o.length,L=o.length,A=0;A<L;A++)i.addColorStop(T?l[A]:A/(L-1),"rgba("+o[A][0]+","+o[A][1]+","+o[A][2]+","+n+")");return i};vt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};vt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};vt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};vt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};vt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};vt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};vt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=n*s,u=i*s,f;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var h=r.canvasContainer;h.style.width=n+"px",h.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=l*e.textureMult,f.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u}};vt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};vt.render=function(t){t=t||Vl();var e=t.forcedContext,r=t.drawAllLayers,a=t.drawOnlyNodeLayer,n=t.forcedZoom,i=t.forcedPan,s=this,o=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=s.cy,u=s.data,f=u.canvasNeedsRedraw,h=s.textureOnViewport&&!e&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:s.motionBlur,v=s.motionBlurPxRatio,d=l.hasCompoundNodes(),g=s.hoverData.draggingEles,p=!!(s.hoverData.selecting||s.touchData.selecting);c=c&&!e&&s.motionBlurEnabled&&!p;var y=c;e||(s.prevPxRatio!==o&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=o),!e&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),c&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(y=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var b=l.style(),w=l.zoom(),D=n!==void 0?n:w,m=l.pan(),x={x:m.x,y:m.y},E={zoom:w,pan:{x:m.x,y:m.y}},C=s.prevViewport,T=C===void 0||E.zoom!==C.zoom||E.pan.x!==C.pan.x||E.pan.y!==C.pan.y;!T&&!(g&&!d)&&(s.motionBlurPxRatio=1),i&&(x=i),D*=o,x.x*=o,x.y*=o;var L=s.getCachedZSortedEles();function A(te,re,fe,le,oe){var he=te.globalCompositeOperation;te.globalCompositeOperation="destination-out",s.colorFillStyle(te,255,255,255,s.motionBlurTransparency),te.fillRect(re,fe,le,oe),te.globalCompositeOperation=he}function S(te,re){var fe,le,oe,he;!s.clearingMotionBlur&&(te===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||te===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(fe={x:m.x*v,y:m.y*v},le=w*v,oe=s.canvasWidth*v,he=s.canvasHeight*v):(fe=x,le=D,oe=s.canvasWidth,he=s.canvasHeight),te.setTransform(1,0,0,1,0,0),re==="motionBlur"?A(te,0,0,oe,he):!e&&(re===void 0||re)&&te.clearRect(0,0,oe,he),r||(te.translate(fe.x,fe.y),te.scale(le,le)),i&&te.translate(i.x,i.y),n&&te.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var M=s.data.bufferContexts[s.TEXTURE_BUFFER];M.setTransform(1,0,0,1,0,0),M.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:M,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var E=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var N=u.contexts[s.NODE],P=s.textureCache.texture,E=s.textureCache.viewport;N.setTransform(1,0,0,1,0,0),c?A(N,0,0,E.width,E.height):N.clearRect(0,0,E.width,E.height);var R=b.core("outside-texture-bg-color").value,I=b.core("outside-texture-bg-opacity").value;s.colorFillStyle(N,R[0],R[1],R[2],I),N.fillRect(0,0,E.width,E.height);var w=l.zoom();S(N,!1),N.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/o,E.height/E.zoom/o),N.drawImage(P,E.mpan.x,E.mpan.y,E.width/E.zoom/o,E.height/E.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var k=l.extent(),F=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),z=s.hideEdgesOnViewport&&F,B=[];if(B[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,B[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),B[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,B[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||a||B[s.NODE]){var G=c&&!B[s.NODE]&&v!==1,N=e||(G?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),$=c&&!G?"motionBlur":void 0;S(N,$),z?s.drawCachedNodes(N,L.nondrag,o,k):s.drawLayeredElements(N,L.nondrag,o,k),s.debug&&s.drawDebugPoints(N,L.nondrag),!r&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||r||B[s.DRAG])){var G=c&&!B[s.DRAG]&&v!==1,N=e||(G?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);S(N,c&&!G?"motionBlur":void 0),z?s.drawCachedNodes(N,L.drag,o,k):s.drawCachedElements(N,L.drag,o,k),s.debug&&s.drawDebugPoints(N,L.drag),!r&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!r){var N=e||u.contexts[s.SELECT_BOX];if(S(N),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var w=s.cy.zoom(),X=b.core("selection-box-border-width").value/w;N.lineWidth=X,N.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",N.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),X>0&&(N.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",N.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var w=s.cy.zoom(),Y=u.bgActivePosistion;N.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",N.beginPath(),N.arc(Y.x,Y.y,b.core("active-bg-size").pfValue/w,0,2*Math.PI),N.fill()}var _=s.lastRedrawTime;if(s.showFps&&_){_=Math.round(_);var q=Math.round(1e3/_);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 = "+_+" ms = "+q+" fps",0,20);var K=60;N.strokeRect(0,30,250,20),N.fillRect(0,30,250*Math.min(q/K,1),20)}r||(f[s.SELECT_BOX]=!1)}if(c&&v!==1){var j=u.contexts[s.NODE],Q=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],ee=u.contexts[s.DRAG],ie=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],de=function(re,fe,le){re.setTransform(1,0,0,1,0,0),le||!y?re.clearRect(0,0,s.canvasWidth,s.canvasHeight):A(re,0,0,s.canvasWidth,s.canvasHeight);var oe=v;re.drawImage(fe,0,0,s.canvasWidth*oe,s.canvasHeight*oe,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||B[s.NODE])&&(de(j,Q,B[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||B[s.DRAG])&&(de(ee,ie,B[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=E,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},R0)),e||l.emit("render")};var Jt={};Jt.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var l=1;l<i.length/2;l++)t.lineTo(e+s*i[l*2],r+o*i[l*2+1]);t.closePath()};Jt.drawRoundPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=bi(a,n);t.beginPath&&t.beginPath();for(var u=0;u<i.length/4;u++){var f=void 0,h=void 0;u===0?f=i.length-2:f=u*4-2,h=u*4+2;var c=e+s*i[u*4],v=r+o*i[u*4+1],d=-i[f]*i[h]-i[f+1]*i[h+1],g=l/Math.tan(Math.acos(d)/2),p=c-g*i[f],y=v-g*i[f+1],b=c+g*i[h],w=v+g*i[h+1];u===0?t.moveTo(p,y):t.lineTo(p,y),t.arcTo(c,v,b,w,l)}t.closePath()};Jt.drawRoundRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=xa(a,n);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.arcTo(e+i,r-s,e+i,r,o),t.arcTo(e+i,r+s,e,r+s,o),t.arcTo(e-i,r+s,e-i,r,o),t.arcTo(e-i,r-s,e,r-s,o),t.lineTo(e,r-s),t.closePath()};Jt.drawBottomRoundRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=xa(a,n);t.beginPath&&t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+i,r-s),t.lineTo(e+i,r),t.arcTo(e+i,r+s,e,r+s,o),t.arcTo(e-i,r+s,e-i,r,o),t.lineTo(e-i,r-s),t.lineTo(e,r-s),t.closePath()};Jt.drawCutRectanglePath=function(t,e,r,a,n){var i=a/2,s=n/2,o=Wl();t.beginPath&&t.beginPath(),t.moveTo(e-i+o,r-s),t.lineTo(e+i-o,r-s),t.lineTo(e+i,r-s+o),t.lineTo(e+i,r+s-o),t.lineTo(e+i-o,r+s),t.lineTo(e-i+o,r+s),t.lineTo(e-i,r+s-o),t.lineTo(e-i,r-s+o),t.closePath()};Jt.drawBarrelPath=function(t,e,r,a,n){var i=a/2,s=n/2,o=e-i,l=e+i,u=r-s,f=r+s,h=jn(a,n),c=h.widthOffset,v=h.heightOffset,d=h.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(o,u+v),t.lineTo(o,f-v),t.quadraticCurveTo(o+d,f,o+c,f),t.lineTo(l-c,f),t.quadraticCurveTo(l-d,f,l,f-v),t.lineTo(l,u+v),t.quadraticCurveTo(l-d,u,l-c,u),t.lineTo(o+c,u),t.quadraticCurveTo(o+d,u,o,u+v),t.closePath()};var Tl=Math.sin(0),Cl=Math.cos(0),oi={},ui={},Yf=Math.PI/40;for(tr=0*Math.PI;tr<2*Math.PI;tr+=Yf)oi[tr]=Math.sin(tr),ui[tr]=Math.cos(tr);var tr;Jt.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=Yf)i=e-o*oi[u]*Tl+o*ui[u]*Cl,s=r+l*ui[u]*Tl+l*oi[u]*Cl,u===0?t.moveTo(i,s):t.lineTo(i,s);t.closePath()};var La={};La.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};La.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],s=t.full?Math.ceil(a.h):n[3],o=ae(t.maxWidth)||ae(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)i*=t.scale,s*=t.scale,u=t.scale;else if(o){var f=1/0,h=1/0;ae(t.maxWidth)&&(f=u*t.maxWidth/i),ae(t.maxHeight)&&(h=u*t.maxHeight/s),u=Math.min(f,h),i*=u,s*=u}o||(i*=l,s*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=s,c.style.width=i+"px",c.style.height=s+"px";var v=c.getContext("2d");if(i>0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)v.translate(-a.x1*u,-a.y1*u),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(a.x1*u,a.y1*u);else{var g=e.pan(),p={x:g.x*u,y:g.y*u};u*=e.zoom(),v.translate(p.x,p.y),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(-p.x,-p.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return c};function k0(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function Dl(t){var e=t.indexOf(",");return t.substr(e+1)}function Hf(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new Pr(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){i(s)}});case"blob":return k0(Dl(a()),r);case"base64":return Dl(a());case"base64uri":default:return a()}}La.png=function(t){return Hf(t,this.bufferCanvasImage(t),"image/png")};La.jpg=function(t){return Hf(t,this.bufferCanvasImage(t),"image/jpeg")};var $f={};$f.nodeShapeImpl=function(t,e,r,a,n,i,s){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var P0=Xf,Ae=Xf.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 Xf(t){var e=this;e.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 r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";e.data.canvasContainer=document.createElement("div");var n=e.data.canvasContainer.style;e.data.canvasContainer.style[r]=a,n.position="relative",n.zIndex="0",n.overflow="hidden";var i=t.cy.container();i.appendChild(e.data.canvasContainer),i.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};pg()&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var o=0;o<Ae.CANVAS_LAYERS;o++){var l=e.data.canvases[o]=document.createElement("canvas");e.data.contexts[o]=l.getContext("2d"),Object.keys(s).forEach(function(_){l.style[_]=s[_]}),l.style.position="absolute",l.setAttribute("data-id","layer"+o),l.style.zIndex=String(Ae.CANVAS_LAYERS-o),e.data.canvasContainer.appendChild(l),e.data.canvasNeedsRedraw[o]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Ae.NODE].setAttribute("data-id","layer"+Ae.NODE+"-node"),e.data.canvases[Ae.SELECT_BOX].setAttribute("data-id","layer"+Ae.SELECT_BOX+"-selectbox"),e.data.canvases[Ae.DRAG].setAttribute("data-id","layer"+Ae.DRAG+"-drag");for(var o=0;o<Ae.BUFFER_COUNT;o++)e.data.bufferCanvases[o]=document.createElement("canvas"),e.data.bufferContexts[o]=e.data.bufferCanvases[o].getContext("2d"),e.data.bufferCanvases[o].style.position="absolute",e.data.bufferCanvases[o].setAttribute("data-id","buffer"+o),e.data.bufferCanvases[o].style.zIndex=String(-o-1),e.data.bufferCanvases[o].style.visibility="hidden";e.pathsEnabled=!0;var u=ht(),f=function(q){return{x:(q.x1+q.x2)/2,y:(q.y1+q.y2)/2}},h=function(q){return{x:-q.w/2,y:-q.h/2}},c=function(q){var K=q[0]._private,j=K.oldBackgroundTimestamp===K.backgroundTimestamp;return!j},v=function(q){return q[0]._private.nodeKey},d=function(q){return q[0]._private.labelStyleKey},g=function(q){return q[0]._private.sourceLabelStyleKey},p=function(q){return q[0]._private.targetLabelStyleKey},y=function(q,K,j,Q,ee){return e.drawElement(q,K,j,!1,!1,ee)},b=function(q,K,j,Q,ee){return e.drawElementText(q,K,j,Q,"main",ee)},w=function(q,K,j,Q,ee){return e.drawElementText(q,K,j,Q,"source",ee)},D=function(q,K,j,Q,ee){return e.drawElementText(q,K,j,Q,"target",ee)},m=function(q){return q.boundingBox(),q[0]._private.bodyBounds},x=function(q){return q.boundingBox(),q[0]._private.labelBounds.main||u},E=function(q){return q.boundingBox(),q[0]._private.labelBounds.source||u},C=function(q){return q.boundingBox(),q[0]._private.labelBounds.target||u},T=function(q,K){return K},L=function(q){return f(m(q))},A=function(q,K,j){var Q=q?q+"-":"";return{x:K.x+j.pstyle(Q+"text-margin-x").pfValue,y:K.y+j.pstyle(Q+"text-margin-y").pfValue}},S=function(q,K,j){var Q=q[0]._private.rscratch;return{x:Q[K],y:Q[j]}},M=function(q){return A("",S(q,"labelX","labelY"),q)},N=function(q){return A("source",S(q,"sourceLabelX","sourceLabelY"),q)},P=function(q){return A("target",S(q,"targetLabelX","targetLabelY"),q)},R=function(q){return h(m(q))},I=function(q){return h(E(q))},k=function(q){return h(C(q))},F=function(q){var K=x(q),j=h(x(q));if(q.isNode()){switch(q.pstyle("text-halign").value){case"left":j.x=-K.w;break;case"right":j.x=0;break}switch(q.pstyle("text-valign").value){case"top":j.y=-K.h;break;case"bottom":j.y=0;break}}return j},z=e.data.eleTxrCache=new ia(e,{getKey:v,doesEleInvalidateKey:c,drawElement:y,getBoundingBox:m,getRotationPoint:L,getRotationOffset:R,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),B=e.data.lblTxrCache=new ia(e,{getKey:d,drawElement:b,getBoundingBox:x,getRotationPoint:M,getRotationOffset:F,isVisible:T}),G=e.data.slbTxrCache=new ia(e,{getKey:g,drawElement:w,getBoundingBox:E,getRotationPoint:N,getRotationOffset:I,isVisible:T}),$=e.data.tlbTxrCache=new ia(e,{getKey:p,drawElement:D,getBoundingBox:C,getRotationPoint:P,getRotationOffset:k,isVisible:T}),X=e.data.lyrTxrCache=new zf(e);e.onUpdateEleCalcs(function(q,K){z.invalidateElements(K),B.invalidateElements(K),G.invalidateElements(K),$.invalidateElements(K),X.invalidateElements(K);for(var j=0;j<K.length;j++){var Q=K[j]._private;Q.oldBackgroundTimestamp=Q.backgroundTimestamp}});var Y=function(q){for(var K=0;K<q.length;K++)X.enqueueElementRefinement(q[K].ele)};z.onDequeue(Y),B.onDequeue(Y),G.onDequeue(Y),$.onDequeue(Y)}Ae.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Ae.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Ae.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Ae.SELECT_BOX]=e;break}};var B0=typeof Path2D<"u";Ae.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Ae.usePaths=function(){return B0&&this.pathsEnabled};Ae.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Ae.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Ae.makeOffscreenCanvas=function(t,e){var r;return(typeof OffscreenCanvas>"u"?"undefined":Ye(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=document.createElement("canvas"),r.width=t,r.height=e),r};[qf,It,Ft,Oi,cr,qr,vt,Jt,La,$f].forEach(function(t){ge(Ae,t)});var F0=[{name:"null",impl:Nf},{name:"base",impl:Ff},{name:"canvas",impl:P0}],G0=[{type:"layout",extensions:Xm},{type:"renderer",extensions:F0}],_f={},Wf={};function Kf(t,e,r){var a=r,n=function(C){Ie("Can not register `"+e+"` for `"+t+"` since `"+C+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(ya.prototype[e])return n(e);ya.prototype[e]=r}else if(t==="collection"){if(Qe.prototype[e])return n(e);Qe.prototype[e]=r}else if(t==="layout"){for(var i=function(C){this.options=C,r.call(this,C),Se(this._private)||(this._private={}),this._private.cy=C.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(r.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=r.prototype.stop;s.stop=function(){var E=this.options;if(E&&E.animate){var C=this.animations;if(C)for(var T=0;T<C.length;T++)C[T].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var h=function(C){return C._private.cy},c={addEventFields:function(C,T){T.layout=C,T.cy=h(C),T.target=C},bubble:function(){return!0},parent:function(C){return h(C)}};ge(s,{createEmitter:function(){return this._private.emitter=new wn(c,this),this},emitter:function(){return this._private.emitter},on:function(C,T){return this.emitter().on(C,T),this},one:function(C,T){return this.emitter().one(C,T),this},once:function(C,T){return this.emitter().one(C,T),this},removeListener:function(C,T){return this.emitter().removeListener(C,T),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(C,T){return this.emitter().emit(C,T),this}}),Ne.eventAliasesOn(s),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=Zf("renderer","base"),d=v.prototype,g=r,p=r.prototype,y=function(){v.apply(this,arguments),g.apply(this,arguments)},b=y.prototype;for(var w in d){var D=d[w],m=p[w]!=null;if(m)return n(w);b[w]=D}for(var x in p)b[x]=p[x];d.clientFunctions.forEach(function(E){b[E]=b[E]||function(){ze("Renderer does not implement `renderer."+E+"()` on its prototype")}}),a=y}else if(t==="__proto__"||t==="constructor"||t==="prototype")return ze(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Ml({map:_f,keys:[t,e],value:a})}function Zf(t,e){return Rl({map:_f,keys:[t,e]})}function z0(t,e,r,a,n){return Ml({map:Wf,keys:[t,e,r,a],value:n})}function q0(t,e,r,a){return Rl({map:Wf,keys:[t,e,r,a]})}var li=function(){if(arguments.length===2)return Zf.apply(null,arguments);if(arguments.length===3)return Kf.apply(null,arguments);if(arguments.length===4)return q0.apply(null,arguments);if(arguments.length===5)return z0.apply(null,arguments);ze("Invalid extension access syntax")};ya.prototype.extension=li;G0.forEach(function(t){t.extensions.forEach(function(e){Kf(t.type,e.name,e.impl)})});var Qf=function t(){if(!(this instanceof t))return new t;this.length=0},lr=Qf.prototype;lr.instanceString=function(){return"stylesheet"};lr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};lr.css=function(t,e){var r=this.length-1;if(ve(t))this[r].properties.push({name:t,value:e});else if(Se(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var l=tt.properties[s]||tt.properties[pn(s)];if(l!=null){var u=l.name,f=o;this[r].properties.push({name:u,value:f})}}}return this};lr.style=lr.css;lr.generateStyle=function(t){var e=new tt(t);return this.appendToStyle(e)};lr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var s=n[i];t.css(s.name,s.value)}}return t};var V0="3.28.1",fr=function(e){if(e===void 0&&(e={}),Se(e))return new ya(e);if(ve(e))return li.apply(li,arguments)};fr.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(fr),t.apply(null,e),this};fr.warnings=function(t){return zl(t)};fr.version=V0;fr.stylesheet=fr.Stylesheet=Qf;Jf.exports=fr});var Ii=ne((Aa,Ni)=>{(function(e,r){typeof Aa=="object"&&typeof Ni=="object"?Ni.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Aa=="object"?Aa.layoutBase=r():e.layoutBase=r()})(Aa,function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.i=function(a){return a},r.d=function(a,n,i){r.o(a,n)||Object.defineProperty(a,n,{configurable:!1,enumerable:!0,get:i})},r.n=function(a){var n=a&&a.__esModule?function(){return a.default}:function(){return a};return r.d(n,"a",n),n},r.o=function(a,n){return Object.prototype.hasOwnProperty.call(a,n)},r.p="",r(r.s=26)}([function(t,e,r){"use strict";function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1e3,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(8),i=r(9);function s(l,u,f){a.call(this,f),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=f,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(a.prototype);for(var o in a)s[o]=a[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var f=this.getOtherEnd(l),h=u.getGraphManager().getRoot();;){if(f.getOwner()==u)return f;if(f.getOwner()==h)break;f=f.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.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=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,r){"use strict";function a(n){this.vGraphObject=n}t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(13),s=r(0),o=r(16),l=r(4);function u(h,c,v,d){v==null&&d==null&&(d=c),a.call(this,d),h.graphManager!=null&&(h=h.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=d,this.edges=[],this.graphManager=h,v!=null&&c!=null?this.rect=new i(c.x,c.y,v.width,v.height):this.rect=new i}u.prototype=Object.create(a.prototype);for(var f in a)u[f]=a[f];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(h){this.rect.width=h},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(h){this.rect.height=h},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(h,c){this.rect.x=h.x,this.rect.y=h.y,this.rect.width=c.width,this.rect.height=c.height},u.prototype.setCenter=function(h,c){this.rect.x=h-this.rect.width/2,this.rect.y=c-this.rect.height/2},u.prototype.setLocation=function(h,c){this.rect.x=h,this.rect.y=c},u.prototype.moveBy=function(h,c){this.rect.x+=h,this.rect.y+=c},u.prototype.getEdgeListToNode=function(h){var c=[],v,d=this;return d.edges.forEach(function(g){if(g.target==h){if(g.source!=d)throw"Incorrect edge source!";c.push(g)}}),c},u.prototype.getEdgesBetween=function(h){var c=[],v,d=this;return d.edges.forEach(function(g){if(!(g.source==d||g.target==d))throw"Incorrect edge source and/or target";(g.target==h||g.source==h)&&c.push(g)}),c},u.prototype.getNeighborsList=function(){var h=new Set,c=this;return c.edges.forEach(function(v){if(v.source==c)h.add(v.target);else{if(v.target!=c)throw"Incorrect incidency!";h.add(v.source)}}),h},u.prototype.withChildren=function(){var h=new Set,c,v;if(h.add(this),this.child!=null)for(var d=this.child.getNodes(),g=0;g<d.length;g++)c=d[g],v=c.withChildren(),v.forEach(function(p){h.add(p)});return h},u.prototype.getNoOfChildren=function(){var h=0,c;if(this.child==null)h=1;else for(var v=this.child.getNodes(),d=0;d<v.length;d++)c=v[d],h+=c.getNoOfChildren();return h==0&&(h=1),h},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.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)},u.prototype.scatter=function(){var h,c,v=-s.INITIAL_WORLD_BOUNDARY,d=s.INITIAL_WORLD_BOUNDARY;h=s.WORLD_CENTER_X+o.nextDouble()*(d-v)+v;var g=-s.INITIAL_WORLD_BOUNDARY,p=s.INITIAL_WORLD_BOUNDARY;c=s.WORLD_CENTER_Y+o.nextDouble()*(p-g)+g,this.rect.x=h,this.rect.y=c},u.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var h=this.getChild();if(h.updateBounds(!0),this.rect.x=h.getLeft(),this.rect.y=h.getTop(),this.setWidth(h.getRight()-h.getLeft()),this.setHeight(h.getBottom()-h.getTop()),s.NODE_DIMENSIONS_INCLUDE_LABELS){var c=h.getRight()-h.getLeft(),v=h.getBottom()-h.getTop();this.labelWidth>c&&(this.rect.x-=(this.labelWidth-c)/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))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(h){var c=this.rect.x;c>s.WORLD_BOUNDARY?c=s.WORLD_BOUNDARY:c<-s.WORLD_BOUNDARY&&(c=-s.WORLD_BOUNDARY);var v=this.rect.y;v>s.WORLD_BOUNDARY?v=s.WORLD_BOUNDARY:v<-s.WORLD_BOUNDARY&&(v=-s.WORLD_BOUNDARY);var d=new l(c,v),g=h.inverseTransformPoint(d);this.setLocation(g.x,g.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},t.exports=u},function(t,e,r){"use strict";function a(n,i){n==null&&i==null?(this.x=0,this.y=0):(this.x=n,this.y=i)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(n){this.x=n},a.prototype.setY=function(n){this.y=n},a.prototype.getDifference=function(n){return new DimensionD(this.x-n.x,this.y-n.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(n){return this.x+=n.width,this.y+=n.height,this},t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(0),s=r(6),o=r(3),l=r(1),u=r(13),f=r(12),h=r(11);function c(d,g,p){a.call(this,p),this.estimatedSize=n.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=d,g!=null&&g instanceof s?this.graphManager=g:g!=null&&g instanceof Layout&&(this.graphManager=g.graphManager)}c.prototype=Object.create(a.prototype);for(var v in a)c[v]=a[v];c.prototype.getNodes=function(){return this.nodes},c.prototype.getEdges=function(){return this.edges},c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getParent=function(){return this.parent},c.prototype.getLeft=function(){return this.left},c.prototype.getRight=function(){return this.right},c.prototype.getTop=function(){return this.top},c.prototype.getBottom=function(){return this.bottom},c.prototype.isConnected=function(){return this.isConnected},c.prototype.add=function(d,g,p){if(g==null&&p==null){var y=d;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(y)>-1)throw"Node already in graph!";return y.owner=this,this.getNodes().push(y),y}else{var b=d;if(!(this.getNodes().indexOf(g)>-1&&this.getNodes().indexOf(p)>-1))throw"Source or target not in graph!";if(!(g.owner==p.owner&&g.owner==this))throw"Both owners must be this graph!";return g.owner!=p.owner?null:(b.source=g,b.target=p,b.isInterGraph=!1,this.getEdges().push(b),g.edges.push(b),p!=g&&p.edges.push(b),b)}},c.prototype.remove=function(d){var g=d;if(d instanceof o){if(g==null)throw"Node is null!";if(!(g.owner!=null&&g.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var p=g.edges.slice(),y,b=p.length,w=0;w<b;w++)y=p[w],y.isInterGraph?this.graphManager.remove(y):y.source.owner.remove(y);var D=this.nodes.indexOf(g);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(d instanceof l){var y=d;if(y==null)throw"Edge is null!";if(!(y.source!=null&&y.target!=null))throw"Source and/or target is null!";if(!(y.source.owner!=null&&y.target.owner!=null&&y.source.owner==this&&y.target.owner==this))throw"Source and/or target owner is invalid!";var m=y.source.edges.indexOf(y),x=y.target.edges.indexOf(y);if(!(m>-1&&x>-1))throw"Source and/or target doesn't know this edge!";y.source.edges.splice(m,1),y.target!=y.source&&y.target.edges.splice(x,1);var D=y.source.owner.getEdges().indexOf(y);if(D==-1)throw"Not in owner's edge list!";y.source.owner.getEdges().splice(D,1)}},c.prototype.updateLeftTop=function(){for(var d=n.MAX_VALUE,g=n.MAX_VALUE,p,y,b,w=this.getNodes(),D=w.length,m=0;m<D;m++){var x=w[m];p=x.getTop(),y=x.getLeft(),d>p&&(d=p),g>y&&(g=y)}return d==n.MAX_VALUE?null:(w[0].getParent().paddingLeft!=null?b=w[0].getParent().paddingLeft:b=this.margin,this.left=g-b,this.top=d-b,new f(this.left,this.top))},c.prototype.updateBounds=function(d){for(var g=n.MAX_VALUE,p=-n.MAX_VALUE,y=n.MAX_VALUE,b=-n.MAX_VALUE,w,D,m,x,E,C=this.nodes,T=C.length,L=0;L<T;L++){var A=C[L];d&&A.child!=null&&A.updateBounds(),w=A.getLeft(),D=A.getRight(),m=A.getTop(),x=A.getBottom(),g>w&&(g=w),p<D&&(p=D),y>m&&(y=m),b<x&&(b=x)}var S=new u(g,y,p-g,b-y);g==n.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?E=C[0].getParent().paddingLeft:E=this.margin,this.left=S.x-E,this.right=S.x+S.width+E,this.top=S.y-E,this.bottom=S.y+S.height+E},c.calculateBounds=function(d){for(var g=n.MAX_VALUE,p=-n.MAX_VALUE,y=n.MAX_VALUE,b=-n.MAX_VALUE,w,D,m,x,E=d.length,C=0;C<E;C++){var T=d[C];w=T.getLeft(),D=T.getRight(),m=T.getTop(),x=T.getBottom(),g>w&&(g=w),p<D&&(p=D),y>m&&(y=m),b<x&&(b=x)}var L=new u(g,y,p-g,b-y);return L},c.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){for(var d=0,g=this.nodes,p=g.length,y=0;y<p;y++){var b=g[y];d+=b.calcEstimatedSize()}return d==0?this.estimatedSize=i.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=d/Math.sqrt(this.nodes.length),this.estimatedSize},c.prototype.updateConnected=function(){var d=this;if(this.nodes.length==0){this.isConnected=!0;return}var g=new h,p=new Set,y=this.nodes[0],b,w,D=y.withChildren();for(D.forEach(function(L){g.push(L),p.add(L)});g.length!==0;){y=g.shift(),b=y.getEdges();for(var m=b.length,x=0;x<m;x++){var E=b[x];if(w=E.getOtherEndInGraph(y,this),w!=null&&!p.has(w)){var C=w.withChildren();C.forEach(function(L){g.push(L),p.add(L)})}}}if(this.isConnected=!1,p.size>=this.nodes.length){var T=0;p.forEach(function(L){L.owner==d&&T++}),T==this.nodes.length&&(this.isConnected=!0)}},t.exports=c},function(t,e,r){"use strict";var a,n=r(1);function i(s){a=r(5),this.layout=s,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},i.prototype.add=function(s,o,l,u,f){if(l==null&&u==null&&f==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{f=l,u=o,l=s;var h=u.getOwner(),c=f.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(c!=null&&c.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==c)return l.isInterGraph=!1,h.add(l,u,f);if(l.isInterGraph=!0,l.source=u,l.target=f,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},i.prototype.remove=function(s){if(s instanceof a){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,f=l.length,h=0;h<f;h++)u=l[h],o.remove(u);var c=[];c=c.concat(o.getNodes());var v;f=c.length;for(var h=0;h<f;h++)v=c[h],o.remove(v);o==this.rootGraph&&this.setRootGraph(null);var d=this.graphs.indexOf(o);this.graphs.splice(d,1),o.parent=null}else if(s instanceof n){if(u=s,u==null)throw"Edge is null!";if(!u.isInterGraph)throw"Not an inter-graph edge!";if(!(u.source!=null&&u.target!=null))throw"Source and/or target is null!";if(!(u.source.edges.indexOf(u)!=-1&&u.target.edges.indexOf(u)!=-1))throw"Source and/or target doesn't know this edge!";var d=u.source.edges.indexOf(u);if(u.source.edges.splice(d,1),d=u.target.edges.indexOf(u),u.target.edges.splice(d,1),!(u.source.owner!=null&&u.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(u.source.owner.getGraphManager().edges.indexOf(u)==-1)throw"Not in owner graph manager's edge list!";var d=u.source.owner.getGraphManager().edges.indexOf(u);u.source.owner.getGraphManager().edges.splice(d,1)}},i.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},i.prototype.getGraphs=function(){return this.graphs},i.prototype.getAllNodes=function(){if(this.allNodes==null){for(var s=[],o=this.getGraphs(),l=o.length,u=0;u<l;u++)s=s.concat(o[u].getNodes());this.allNodes=s}return this.allNodes},i.prototype.resetAllNodes=function(){this.allNodes=null},i.prototype.resetAllEdges=function(){this.allEdges=null},i.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},i.prototype.getAllEdges=function(){if(this.allEdges==null){for(var s=[],o=this.getGraphs(),l=o.length,u=0;u<o.length;u++)s=s.concat(o[u].getEdges());s=s.concat(this.edges),this.allEdges=s}return this.allEdges},i.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},i.prototype.setAllNodesToApplyGravitation=function(s){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=s},i.prototype.getRoot=function(){return this.rootGraph},i.prototype.setRootGraph=function(s){if(s.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=s,s.parent==null&&(s.parent=this.layout.newNode("Root node"))},i.prototype.getLayout=function(){return this.layout},i.prototype.isOneAncestorOfOther=function(s,o){if(!(s!=null&&o!=null))throw"assert failed";if(s==o)return!0;var l=s.getOwner(),u;do{if(u=l.getParent(),u==null)break;if(u==o)return!0;if(l=u.getOwner(),l==null)break}while(!0);l=o.getOwner();do{if(u=l.getParent(),u==null)break;if(u==s)return!0;if(l=u.getOwner(),l==null)break}while(!0);return!1},i.prototype.calcLowestCommonAncestors=function(){for(var s,o,l,u,f,h=this.getAllEdges(),c=h.length,v=0;v<c;v++){if(s=h[v],o=s.source,l=s.target,s.lca=null,s.sourceInLca=o,s.targetInLca=l,o==l){s.lca=o.getOwner();continue}for(u=o.getOwner();s.lca==null;){for(s.targetInLca=l,f=l.getOwner();s.lca==null;){if(f==u){s.lca=f;break}if(f==this.rootGraph)break;if(s.lca!=null)throw"assert failed";s.targetInLca=f.getParent(),f=s.targetInLca.getOwner()}if(u==this.rootGraph)break;s.lca==null&&(s.sourceInLca=u.getParent(),u=s.sourceInLca.getOwner())}if(s.lca==null)throw"assert failed"}},i.prototype.calcLowestCommonAncestor=function(s,o){if(s==o)return s.getOwner();var l=s.getOwner();do{if(l==null)break;var u=o.getOwner();do{if(u==null)break;if(u==l)return u;u=u.getParent().getOwner()}while(!0);l=l.getParent().getOwner()}while(!0);return l},i.prototype.calcInclusionTreeDepths=function(s,o){s==null&&o==null&&(s=this.rootGraph,o=1);for(var l,u=s.getNodes(),f=u.length,h=0;h<f;h++)l=u[h],l.inclusionTreeDepth=o,l.child!=null&&this.calcInclusionTreeDepths(l.child,o+1)},i.prototype.includesInvalidEdge=function(){for(var s,o=this.edges.length,l=0;l<o;l++)if(s=this.edges[l],this.isOneAncestorOfOther(s.source,s.target))return!0;return!1},t.exports=i},function(t,e,r){"use strict";var a=r(0);function n(){}for(var i in a)n[i]=a[i];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=n.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=n},function(t,e,r){"use strict";var a=r(12);function n(){}n.calcSeparationAmount=function(i,s,o,l){if(!i.intersects(s))throw"assert failed";var u=new Array(2);this.decideDirectionsForOverlappingNodes(i,s,u),o[0]=Math.min(i.getRight(),s.getRight())-Math.max(i.x,s.x),o[1]=Math.min(i.getBottom(),s.getBottom())-Math.max(i.y,s.y),i.getX()<=s.getX()&&i.getRight()>=s.getRight()?o[0]+=Math.min(s.getX()-i.getX(),i.getRight()-s.getRight()):s.getX()<=i.getX()&&s.getRight()>=i.getRight()&&(o[0]+=Math.min(i.getX()-s.getX(),s.getRight()-i.getRight())),i.getY()<=s.getY()&&i.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-i.getY(),i.getBottom()-s.getBottom()):s.getY()<=i.getY()&&s.getBottom()>=i.getBottom()&&(o[1]+=Math.min(i.getY()-s.getY(),s.getBottom()-i.getBottom()));var f=Math.abs((s.getCenterY()-i.getCenterY())/(s.getCenterX()-i.getCenterX()));s.getCenterY()===i.getCenterY()&&s.getCenterX()===i.getCenterX()&&(f=1);var h=f*o[0],c=o[1]/f;o[0]<c?c=o[0]:h=o[1],o[0]=-1*u[0]*(c/2+l),o[1]=-1*u[1]*(h/2+l)},n.decideDirectionsForOverlappingNodes=function(i,s,o){i.getCenterX()<s.getCenterX()?o[0]=-1:o[0]=1,i.getCenterY()<s.getCenterY()?o[1]=-1:o[1]=1},n.getIntersection2=function(i,s,o){var l=i.getCenterX(),u=i.getCenterY(),f=s.getCenterX(),h=s.getCenterY();if(i.intersects(s))return o[0]=l,o[1]=u,o[2]=f,o[3]=h,!0;var c=i.getX(),v=i.getY(),d=i.getRight(),g=i.getX(),p=i.getBottom(),y=i.getRight(),b=i.getWidthHalf(),w=i.getHeightHalf(),D=s.getX(),m=s.getY(),x=s.getRight(),E=s.getX(),C=s.getBottom(),T=s.getRight(),L=s.getWidthHalf(),A=s.getHeightHalf(),S=!1,M=!1;if(l===f){if(u>h)return o[0]=l,o[1]=v,o[2]=f,o[3]=C,!1;if(u<h)return o[0]=l,o[1]=p,o[2]=f,o[3]=m,!1}else if(u===h){if(l>f)return o[0]=c,o[1]=u,o[2]=x,o[3]=h,!1;if(l<f)return o[0]=d,o[1]=u,o[2]=D,o[3]=h,!1}else{var N=i.height/i.width,P=s.height/s.width,R=(h-u)/(f-l),I=void 0,k=void 0,F=void 0,z=void 0,B=void 0,G=void 0;if(-N===R?l>f?(o[0]=g,o[1]=p,S=!0):(o[0]=d,o[1]=v,S=!0):N===R&&(l>f?(o[0]=c,o[1]=v,S=!0):(o[0]=y,o[1]=p,S=!0)),-P===R?f>l?(o[2]=E,o[3]=C,M=!0):(o[2]=x,o[3]=m,M=!0):P===R&&(f>l?(o[2]=D,o[3]=m,M=!0):(o[2]=T,o[3]=C,M=!0)),S&&M)return!1;if(l>f?u>h?(I=this.getCardinalDirection(N,R,4),k=this.getCardinalDirection(P,R,2)):(I=this.getCardinalDirection(-N,R,3),k=this.getCardinalDirection(-P,R,1)):u>h?(I=this.getCardinalDirection(-N,R,1),k=this.getCardinalDirection(-P,R,3)):(I=this.getCardinalDirection(N,R,2),k=this.getCardinalDirection(P,R,4)),!S)switch(I){case 1:z=v,F=l+-w/R,o[0]=F,o[1]=z;break;case 2:F=y,z=u+b*R,o[0]=F,o[1]=z;break;case 3:z=p,F=l+w/R,o[0]=F,o[1]=z;break;case 4:F=g,z=u+-b*R,o[0]=F,o[1]=z;break}if(!M)switch(k){case 1:G=m,B=f+-A/R,o[2]=B,o[3]=G;break;case 2:B=T,G=h+L*R,o[2]=B,o[3]=G;break;case 3:G=C,B=f+A/R,o[2]=B,o[3]=G;break;case 4:B=E,G=h+-L*R,o[2]=B,o[3]=G;break}}return!1},n.getCardinalDirection=function(i,s,o){return i>s?o:1+o%4},n.getIntersection=function(i,s,o,l){if(l==null)return this.getIntersection2(i,s,o);var u=i.x,f=i.y,h=s.x,c=s.y,v=o.x,d=o.y,g=l.x,p=l.y,y=void 0,b=void 0,w=void 0,D=void 0,m=void 0,x=void 0,E=void 0,C=void 0,T=void 0;return w=c-f,m=u-h,E=h*f-u*c,D=p-d,x=v-g,C=g*d-v*p,T=w*x-D*m,T===0?null:(y=(m*C-x*E)/T,b=(D*E-w*C)/T,new a(y,b))},n.angleOfVector=function(i,s,o,l){var u=void 0;return i!==o?(u=Math.atan((l-s)/(o-i)),o<i?u+=Math.PI:l<s&&(u+=this.TWO_PI)):l<s?u=this.ONE_AND_HALF_PI:u=this.HALF_PI,u},n.doIntersect=function(i,s,o,l){var u=i.x,f=i.y,h=s.x,c=s.y,v=o.x,d=o.y,g=l.x,p=l.y,y=(h-u)*(p-d)-(g-v)*(c-f);if(y===0)return!1;var b=((p-d)*(g-u)+(v-g)*(p-f))/y,w=((f-c)*(g-u)+(h-u)*(p-f))/y;return 0<b&&b<1&&0<w&&w<1},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,t.exports=n},function(t,e,r){"use strict";function a(){}a.sign=function(n){return n>0?1:n<0?-1:0},a.floor=function(n){return n<0?Math.ceil(n):Math.floor(n)},a.ceil=function(n){return n<0?Math.floor(n):Math.ceil(n)},t.exports=a},function(t,e,r){"use strict";function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,t.exports=a},function(t,e,r){"use strict";var a=function(){function u(f,h){for(var c=0;c<h.length;c++){var v=h[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,h,c){return h&&u(f.prototype,h),c&&u(f,c),f}}();function n(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}var i=function(f){return{value:f,next:null,prev:null}},s=function(f,h,c,v){return f!==null?f.next=h:v.head=h,c!==null?c.prev=h:v.tail=h,h.prev=f,h.next=c,v.length++,h},o=function(f,h){var c=f.prev,v=f.next;return c!==null?c.next=v:h.head=v,v!==null?v.prev=c:h.tail=c,f.prev=f.next=null,h.length--,f},l=function(){function u(f){var h=this;n(this,u),this.length=0,this.head=null,this.tail=null,f?.forEach(function(c){return h.push(c)})}return a(u,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(h,c){return s(c.prev,i(h),c,this)}},{key:"insertAfter",value:function(h,c){return s(c,i(h),c.next,this)}},{key:"insertNodeBefore",value:function(h,c){return s(c.prev,h,c,this)}},{key:"insertNodeAfter",value:function(h,c){return s(c,h,c.next,this)}},{key:"push",value:function(h){return s(this.tail,i(h),null,this)}},{key:"unshift",value:function(h){return s(null,i(h),this.head,this)}},{key:"remove",value:function(h){return o(h,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(h){if(h<=this.length()){for(var c=1,v=this.head;c<h;)v=v.next,c++;return v.value}}},{key:"set_object_at",value:function(h,c){if(h<=this.length()){for(var v=1,d=this.head;v<h;)d=d.next,v++;d.value=c}}}]),u}();t.exports=l},function(t,e,r){"use strict";function a(n,i,s){this.x=null,this.y=null,n==null&&i==null&&s==null?(this.x=0,this.y=0):typeof n=="number"&&typeof i=="number"&&s==null?(this.x=n,this.y=i):n.constructor.name=="Point"&&i==null&&s==null&&(s=n,this.x=s.x,this.y=s.y)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(n,i,s){n.constructor.name=="Point"&&i==null&&s==null?(s=n,this.setLocation(s.x,s.y)):typeof n=="number"&&typeof i=="number"&&s==null&&(parseInt(n)==n&&parseInt(i)==i?this.move(n,i):(this.x=Math.floor(n+.5),this.y=Math.floor(i+.5)))},a.prototype.move=function(n,i){this.x=n,this.y=i},a.prototype.translate=function(n,i){this.x+=n,this.y+=i},a.prototype.equals=function(n){if(n.constructor.name=="Point"){var i=n;return this.x==i.x&&this.y==i.y}return this==n},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=a},function(t,e,r){"use strict";function a(n,i,s,o){this.x=0,this.y=0,this.width=0,this.height=0,n!=null&&i!=null&&s!=null&&o!=null&&(this.x=n,this.y=i,this.width=s,this.height=o)}a.prototype.getX=function(){return this.x},a.prototype.setX=function(n){this.x=n},a.prototype.getY=function(){return this.y},a.prototype.setY=function(n){this.y=n},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(n){return!(this.getRight()<n.x||this.getBottom()<n.y||n.getRight()<this.x||n.getBottom()<this.y)},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},t.exports=a},function(t,e,r){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i};function n(){}n.lastID=0,n.createID=function(i){return n.isPrimitive(i)?i:(i.uniqueID!=null||(i.uniqueID=n.getString(),n.lastID++),i.uniqueID)},n.getString=function(i){return i==null&&(i=n.lastID),"Object#"+i},n.isPrimitive=function(i){var s=typeof i>"u"?"undefined":a(i);return i==null||s!="object"&&s!="function"},t.exports=n},function(t,e,r){"use strict";function a(v){if(Array.isArray(v)){for(var d=0,g=Array(v.length);d<v.length;d++)g[d]=v[d];return g}else return Array.from(v)}var n=r(0),i=r(6),s=r(3),o=r(1),l=r(5),u=r(4),f=r(17),h=r(27);function c(v){h.call(this),this.layoutQuality=n.QUALITY,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=n.DEFAULT_INCREMENTAL,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new i(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,v!=null&&(this.isRemoteUse=v)}c.RANDOM_SEED=1,c.prototype=Object.create(h.prototype),c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},c.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},c.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},c.prototype.newGraphManager=function(){var v=new i(this);return this.graphManager=v,v},c.prototype.newGraph=function(v){return new l(null,this.graphManager,v)},c.prototype.newNode=function(v){return new s(this.graphManager,v)},c.prototype.newEdge=function(v){return new o(null,null,v)},c.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},c.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var v;return this.checkLayoutSuccess()?v=!1:v=this.layout(),n.ANIMATE==="during"?!1:(v&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,v)},c.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},c.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var v,d=this.graphManager.getAllEdges(),g=0;g<d.length;g++)v=d[g];for(var p,y=this.graphManager.getRoot().getNodes(),g=0;g<y.length;g++)p=y[g];this.update(this.graphManager.getRoot())}},c.prototype.update=function(v){if(v==null)this.update2();else if(v instanceof s){var d=v;if(d.getChild()!=null)for(var g=d.getChild().getNodes(),p=0;p<g.length;p++)update(g[p]);if(d.vGraphObject!=null){var y=d.vGraphObject;y.update(d)}}else if(v instanceof o){var b=v;if(b.vGraphObject!=null){var w=b.vGraphObject;w.update(b)}}else if(v instanceof l){var D=v;if(D.vGraphObject!=null){var m=D.vGraphObject;m.update(D)}}},c.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=n.QUALITY,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=n.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},c.prototype.transform=function(v){if(v==null)this.transform(new u(0,0));else{var d=new f,g=this.graphManager.getRoot().updateLeftTop();if(g!=null){d.setWorldOrgX(v.x),d.setWorldOrgY(v.y),d.setDeviceOrgX(g.x),d.setDeviceOrgY(g.y);for(var p=this.getAllNodes(),y,b=0;b<p.length;b++)y=p[b],y.transform(d)}}},c.prototype.positionNodesRandomly=function(v){if(v==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var d,g,p=v.getNodes(),y=0;y<p.length;y++)d=p[y],g=d.getChild(),g==null||g.getNodes().length==0?d.scatter():(this.positionNodesRandomly(g),d.updateBounds())},c.prototype.getFlatForest=function(){for(var v=[],d=!0,g=this.graphManager.getRoot().getNodes(),p=!0,y=0;y<g.length;y++)g[y].getChild()!=null&&(p=!1);if(!p)return v;var b=new Set,w=[],D=new Map,m=[];for(m=m.concat(g);m.length>0&&d;){for(w.push(m[0]);w.length>0&&d;){var x=w[0];w.splice(0,1),b.add(x);for(var E=x.getEdges(),y=0;y<E.length;y++){var C=E[y].getOtherEnd(x);if(D.get(x)!=C)if(!b.has(C))w.push(C),D.set(C,x);else{d=!1;break}}}if(!d)v=[];else{var T=[].concat(a(b));v.push(T);for(var y=0;y<T.length;y++){var L=T[y],A=m.indexOf(L);A>-1&&m.splice(A,1)}b=new Set,D=new Map}}return v},c.prototype.createDummyNodesForBendpoints=function(v){for(var d=[],g=v.source,p=this.graphManager.calcLowestCommonAncestor(v.source,v.target),y=0;y<v.bendpoints.length;y++){var b=this.newNode(null);b.setRect(new Point(0,0),new Dimension(1,1)),p.add(b);var w=this.newEdge(null);this.graphManager.add(w,g,b),d.add(b),g=b}var w=this.newEdge(null);return this.graphManager.add(w,g,v.target),this.edgeToDummyNodes.set(v,d),v.isInterGraph()?this.graphManager.remove(v):p.remove(v),d},c.prototype.createBendpointsFromDummyNodes=function(){var v=[];v=v.concat(this.graphManager.getAllEdges()),v=[].concat(a(this.edgeToDummyNodes.keys())).concat(v);for(var d=0;d<v.length;d++){var g=v[d];if(g.bendpoints.length>0){for(var p=this.edgeToDummyNodes.get(g),y=0;y<p.length;y++){var b=p[y],w=new u(b.getCenterX(),b.getCenterY()),D=g.bendpoints.get(y);D.x=w.x,D.y=w.y,b.getOwner().remove(b)}this.graphManager.add(g,g.source,g.target)}}},c.transform=function(v,d,g,p){if(g!=null&&p!=null){var y=d;if(v<=50){var b=d/g;y-=(d-b)/50*(50-v)}else{var w=d*p;y+=(w-d)/50*(v-50)}return y}else{var D,m;return v<=50?(D=9*d/500,m=d/10):(D=9*d/50,m=-8*d),D*v+m}},c.findCenterOfTree=function(v){var d=[];d=d.concat(v);var g=[],p=new Map,y=!1,b=null;(d.length==1||d.length==2)&&(y=!0,b=d[0]);for(var w=0;w<d.length;w++){var D=d[w],m=D.getNeighborsList().size;p.set(D,D.getNeighborsList().size),m==1&&g.push(D)}var x=[];for(x=x.concat(g);!y;){var E=[];E=E.concat(x),x=[];for(var w=0;w<d.length;w++){var D=d[w],C=d.indexOf(D);C>=0&&d.splice(C,1);var T=D.getNeighborsList();T.forEach(function(S){if(g.indexOf(S)<0){var M=p.get(S),N=M-1;N==1&&x.push(S),p.set(S,N)}})}g=g.concat(x),(d.length==1||d.length==2)&&(y=!0,b=d[0])}return b},c.prototype.setGraphManager=function(v){this.graphManager=v},t.exports=c},function(t,e,r){"use strict";function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},t.exports=a},function(t,e,r){"use strict";var a=r(4);function n(i,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(i){this.lworldExtX=i},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(i){this.lworldExtY=i},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},n.prototype.transformX=function(i){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/o),s},n.prototype.transformY=function(i){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/o),s},n.prototype.inverseTransformX=function(i){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/o),s},n.prototype.inverseTransformY=function(i){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/o),s},n.prototype.inverseTransformPoint=function(i){var s=new a(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return s},t.exports=n},function(t,e,r){"use strict";function a(h){if(Array.isArray(h)){for(var c=0,v=Array(h.length);c<h.length;c++)v[c]=h[c];return v}else return Array.from(h)}var n=r(15),i=r(7),s=r(0),o=r(8),l=r(9);function u(){n.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=i.DEFAULT_EDGE_LENGTH,this.springConstant=i.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=i.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}u.prototype=Object.create(n.prototype);for(var f in n)u[f]=n[f];u.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},u.prototype.calcIdealEdgeLengths=function(){for(var h,c,v,d,g,p,y=this.getGraphManager().getAllEdges(),b=0;b<y.length;b++)h=y[b],h.idealLength=this.idealEdgeLength,h.isInterGraph&&(v=h.getSource(),d=h.getTarget(),g=h.getSourceInLca().getEstimatedSize(),p=h.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(h.idealLength+=g+p-2*s.SIMPLE_NODE_SIZE),c=h.getLca().getInclusionTreeDepth(),h.idealLength+=i.DEFAULT_EDGE_LENGTH*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+d.getInclusionTreeDepth()-2*c))},u.prototype.initSpringEmbedder=function(){var h=this.getAllNodes().length;this.incremental?(h>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(h-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),c,v=0;v<h.length;v++)c=h[v],this.calcSpringForce(c,c.idealLength)},u.prototype.calcRepulsionForces=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v,d,g,p,y=this.getAllNodes(),b;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),b=new Set,v=0;v<y.length;v++)g=y[v],this.calculateRepulsionForceOfANode(g,b,h,c),b.add(g);else for(v=0;v<y.length;v++)for(g=y[v],d=v+1;d<y.length;d++)p=y[d],g.getOwner()==p.getOwner()&&this.calcRepulsionForce(g,p)},u.prototype.calcGravitationalForces=function(){for(var h,c=this.getAllNodesToApplyGravitation(),v=0;v<c.length;v++)h=c[v],this.calcGravitationalForce(h)},u.prototype.moveNodes=function(){for(var h=this.getAllNodes(),c,v=0;v<h.length;v++)c=h[v],c.move()},u.prototype.calcSpringForce=function(h,c){var v=h.getSource(),d=h.getTarget(),g,p,y,b;if(this.uniformLeafNodeSizes&&v.getChild()==null&&d.getChild()==null)h.updateLengthSimple();else if(h.updateLength(),h.isOverlapingSourceAndTarget)return;g=h.getLength(),g!=0&&(p=this.springConstant*(g-c),y=p*(h.lengthX/g),b=p*(h.lengthY/g),v.springForceX+=y,v.springForceY+=b,d.springForceX-=y,d.springForceY-=b)},u.prototype.calcRepulsionForce=function(h,c){var v=h.getRect(),d=c.getRect(),g=new Array(2),p=new Array(4),y,b,w,D,m,x,E;if(v.intersects(d)){o.calcSeparationAmount(v,d,g,i.DEFAULT_EDGE_LENGTH/2),x=2*g[0],E=2*g[1];var C=h.noOfChildren*c.noOfChildren/(h.noOfChildren+c.noOfChildren);h.repulsionForceX-=C*x,h.repulsionForceY-=C*E,c.repulsionForceX+=C*x,c.repulsionForceY+=C*E}else this.uniformLeafNodeSizes&&h.getChild()==null&&c.getChild()==null?(y=d.getCenterX()-v.getCenterX(),b=d.getCenterY()-v.getCenterY()):(o.getIntersection(v,d,p),y=p[2]-p[0],b=p[3]-p[1]),Math.abs(y)<i.MIN_REPULSION_DIST&&(y=l.sign(y)*i.MIN_REPULSION_DIST),Math.abs(b)<i.MIN_REPULSION_DIST&&(b=l.sign(b)*i.MIN_REPULSION_DIST),w=y*y+b*b,D=Math.sqrt(w),m=this.repulsionConstant*h.noOfChildren*c.noOfChildren/w,x=m*y/D,E=m*b/D,h.repulsionForceX-=x,h.repulsionForceY-=E,c.repulsionForceX+=x,c.repulsionForceY+=E},u.prototype.calcGravitationalForce=function(h){var c,v,d,g,p,y,b,w;c=h.getOwner(),v=(c.getRight()+c.getLeft())/2,d=(c.getTop()+c.getBottom())/2,g=h.getCenterX()-v,p=h.getCenterY()-d,y=Math.abs(g)+h.getWidth()/2,b=Math.abs(p)+h.getHeight()/2,h.getOwner()==this.graphManager.getRoot()?(w=c.getEstimatedSize()*this.gravityRangeFactor,(y>w||b>w)&&(h.gravitationForceX=-this.gravityConstant*g,h.gravitationForceY=-this.gravityConstant*p)):(w=c.getEstimatedSize()*this.compoundGravityRangeFactor,(y>w||b>w)&&(h.gravitationForceX=-this.gravityConstant*g*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*p*this.compoundGravityConstant))},u.prototype.isConverged=function(){var h,c=!1;return this.totalIterations>this.maxIterations/3&&(c=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,h||c},u.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},u.prototype.calcNoOfChildrenForAllNodes=function(){for(var h,c=this.graphManager.getAllNodes(),v=0;v<c.length;v++)h=c[v],h.noOfChildren=h.getNoOfChildren()},u.prototype.calcGrid=function(h){var c=0,v=0;c=parseInt(Math.ceil((h.getRight()-h.getLeft())/this.repulsionRange)),v=parseInt(Math.ceil((h.getBottom()-h.getTop())/this.repulsionRange));for(var d=new Array(c),g=0;g<c;g++)d[g]=new Array(v);for(var g=0;g<c;g++)for(var p=0;p<v;p++)d[g][p]=new Array;return d},u.prototype.addNodeToGrid=function(h,c,v){var d=0,g=0,p=0,y=0;d=parseInt(Math.floor((h.getRect().x-c)/this.repulsionRange)),g=parseInt(Math.floor((h.getRect().width+h.getRect().x-c)/this.repulsionRange)),p=parseInt(Math.floor((h.getRect().y-v)/this.repulsionRange)),y=parseInt(Math.floor((h.getRect().height+h.getRect().y-v)/this.repulsionRange));for(var b=d;b<=g;b++)for(var w=p;w<=y;w++)this.grid[b][w].push(h),h.setGridCoordinates(d,g,p,y)},u.prototype.updateGrid=function(){var h,c,v=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),h=0;h<v.length;h++)c=v[h],this.addNodeToGrid(c,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},u.prototype.calculateRepulsionForceOfANode=function(h,c,v,d){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&v||d){var g=new Set;h.surrounding=new Array;for(var p,y=this.grid,b=h.startX-1;b<h.finishX+2;b++)for(var w=h.startY-1;w<h.finishY+2;w++)if(!(b<0||w<0||b>=y.length||w>=y[0].length)){for(var D=0;D<y[b][w].length;D++)if(p=y[b][w][D],!(h.getOwner()!=p.getOwner()||h==p)&&!c.has(p)&&!g.has(p)){var m=Math.abs(h.getCenterX()-p.getCenterX())-(h.getWidth()/2+p.getWidth()/2),x=Math.abs(h.getCenterY()-p.getCenterY())-(h.getHeight()/2+p.getHeight()/2);m<=this.repulsionRange&&x<=this.repulsionRange&&g.add(p)}}h.surrounding=[].concat(a(g))}for(b=0;b<h.surrounding.length;b++)this.calcRepulsionForce(h,h.surrounding[b])},u.prototype.calcRepulsionRange=function(){return 0},t.exports=u},function(t,e,r){"use strict";var a=r(1),n=r(7);function i(o,l,u){a.call(this,o,l,u),this.idealLength=n.DEFAULT_EDGE_LENGTH}i.prototype=Object.create(a.prototype);for(var s in a)i[s]=a[s];t.exports=i},function(t,e,r){"use strict";var a=r(3);function n(s,o,l,u){a.call(this,s,o,l,u),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=[]}n.prototype=Object.create(a.prototype);for(var i in a)n[i]=a[i];n.prototype.setGridCoordinates=function(s,o,l,u){this.startX=s,this.finishX=o,this.startY=l,this.finishY=u},t.exports=n},function(t,e,r){"use strict";function a(n,i){this.width=0,this.height=0,n!==null&&i!==null&&(this.height=i,this.width=n)}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},t.exports=a},function(t,e,r){"use strict";var a=r(14);function n(){this.map={},this.keys=[]}n.prototype.put=function(i,s){var o=a.createID(i);this.contains(o)||(this.map[o]=s,this.keys.push(i))},n.prototype.contains=function(i){var s=a.createID(i);return this.map[i]!=null},n.prototype.get=function(i){var s=a.createID(i);return this.map[s]},n.prototype.keySet=function(){return this.keys},t.exports=n},function(t,e,r){"use strict";var a=r(14);function n(){this.set={}}n.prototype.add=function(i){var s=a.createID(i);this.contains(s)||(this.set[s]=i)},n.prototype.remove=function(i){delete this.set[a.createID(i)]},n.prototype.clear=function(){this.set={}},n.prototype.contains=function(i){return this.set[a.createID(i)]==i},n.prototype.isEmpty=function(){return this.size()===0},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAllTo=function(i){for(var s=Object.keys(this.set),o=s.length,l=0;l<o;l++)i.push(this.set[s[l]])},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAll=function(i){for(var s=i.length,o=0;o<s;o++){var l=i[o];this.add(l)}},t.exports=n},function(t,e,r){"use strict";var a=function(){function o(l,u){for(var f=0;f<u.length;f++){var h=u[f];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}return function(l,u,f){return u&&o(l.prototype,u),f&&o(l,f),l}}();function n(o,l){if(!(o instanceof l))throw new TypeError("Cannot call a class as a function")}var i=r(11),s=function(){function o(l,u){n(this,o),(u!==null||u!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var f=void 0;l instanceof i?f=l.size():f=l.length,this._quicksort(l,0,f-1)}return a(o,[{key:"_quicksort",value:function(u,f,h){if(f<h){var c=this._partition(u,f,h);this._quicksort(u,f,c),this._quicksort(u,c+1,h)}}},{key:"_partition",value:function(u,f,h){for(var c=this._get(u,f),v=f,d=h;;){for(;this.compareFunction(c,this._get(u,d));)d--;for(;this.compareFunction(this._get(u,v),c);)v++;if(v<d)this._swap(u,v,d),v++,d--;else return d}}},{key:"_get",value:function(u,f){return u instanceof i?u.get_object_at(f):u[f]}},{key:"_set",value:function(u,f,h){u instanceof i?u.set_object_at(f,h):u[f]=h}},{key:"_swap",value:function(u,f,h){var c=this._get(u,f);this._set(u,f,this._get(u,h)),this._set(u,h,c)}},{key:"_defaultCompareFunction",value:function(u,f){return f>u}}]),o}();t.exports=s},function(t,e,r){"use strict";var a=function(){function s(o,l){for(var u=0;u<l.length;u++){var f=l[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(o,f.key,f)}}return function(o,l,u){return l&&s(o.prototype,l),u&&s(o,u),o}}();function n(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function")}var i=function(){function s(o,l){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;n(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=f,this.gap_penalty=h,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var c=0;c<this.iMax;c++){this.grid[c]=new Array(this.jMax);for(var v=0;v<this.jMax;v++)this.grid[c][v]=0}this.tracebackGrid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.tracebackGrid[d]=new Array(this.jMax);for(var g=0;g<this.jMax;g++)this.tracebackGrid[d][g]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(s,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var l=1;l<this.jMax;l++)this.grid[0][l]=this.grid[0][l-1]+this.gap_penalty,this.tracebackGrid[0][l]=[!1,!1,!0];for(var u=1;u<this.iMax;u++)this.grid[u][0]=this.grid[u-1][0]+this.gap_penalty,this.tracebackGrid[u][0]=[!1,!0,!1];for(var f=1;f<this.iMax;f++)for(var h=1;h<this.jMax;h++){var c=void 0;this.sequence1[f-1]===this.sequence2[h-1]?c=this.grid[f-1][h-1]+this.match_score:c=this.grid[f-1][h-1]+this.mismatch_penalty;var v=this.grid[f-1][h]+this.gap_penalty,d=this.grid[f][h-1]+this.gap_penalty,g=[c,v,d],p=this.arrayAllMaxIndexes(g);this.grid[f][h]=g[p[0]],this.tracebackGrid[f][h]=[p.includes(0),p.includes(1),p.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var l=[];for(l.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});l[0];){var u=l[0],f=this.tracebackGrid[u.pos[0]][u.pos[1]];f[0]&&l.push({pos:[u.pos[0]-1,u.pos[1]-1],seq1:this.sequence1[u.pos[0]-1]+u.seq1,seq2:this.sequence2[u.pos[1]-1]+u.seq2}),f[1]&&l.push({pos:[u.pos[0]-1,u.pos[1]],seq1:this.sequence1[u.pos[0]-1]+u.seq1,seq2:"-"+u.seq2}),f[2]&&l.push({pos:[u.pos[0],u.pos[1]-1],seq1:"-"+u.seq1,seq2:this.sequence2[u.pos[1]-1]+u.seq2}),u.pos[0]===0&&u.pos[1]===0&&this.alignments.push({sequence1:u.seq1,sequence2:u.seq2}),l.shift()}return this.alignments}},{key:"getAllIndexes",value:function(l,u){for(var f=[],h=-1;(h=l.indexOf(u,h+1))!==-1;)f.push(h);return f}},{key:"arrayAllMaxIndexes",value:function(l){return this.getAllIndexes(l,Math.max.apply(null,l))}}]),s}();t.exports=i},function(t,e,r){"use strict";var a=function(){};a.FDLayout=r(18),a.FDLayoutConstants=r(7),a.FDLayoutEdge=r(19),a.FDLayoutNode=r(20),a.DimensionD=r(21),a.HashMap=r(22),a.HashSet=r(23),a.IGeometry=r(8),a.IMath=r(9),a.Integer=r(10),a.Point=r(12),a.PointD=r(4),a.RandomSeed=r(16),a.RectangleD=r(13),a.Transform=r(17),a.UniqueIDGeneretor=r(14),a.Quicksort=r(24),a.LinkedList=r(11),a.LGraphObject=r(2),a.LGraph=r(5),a.LEdge=r(1),a.LGraphManager=r(6),a.LNode=r(3),a.Layout=r(15),a.LayoutConstants=r(0),a.NeedlemanWunsch=r(25),t.exports=a},function(t,e,r){"use strict";function a(){this.listeners=[]}var n=a.prototype;n.addListener=function(i,s){this.listeners.push({event:i,callback:s})},n.removeListener=function(i,s){for(var o=this.listeners.length;o>=0;o--){var l=this.listeners[o];l.event===i&&l.callback===s&&this.listeners.splice(o,1)}},n.emit=function(i,s){for(var o=0;o<this.listeners.length;o++){var l=this.listeners[o];i===l.event&&l.callback(s)}},t.exports=a}])})});var Ri=ne((Oa,Mi)=>{(function(e,r){typeof Oa=="object"&&typeof Mi=="object"?Mi.exports=r(Ii()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof Oa=="object"?Oa.coseBase=r(Ii()):e.coseBase=r(e.layoutBase)})(Oa,function(t){return function(e){var r={};function a(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=r,a.i=function(n){return n},a.d=function(n,i,s){a.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:s})},a.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(i,"a",i),i},a.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},a.p="",a(a.s=7)}([function(e,r){e.exports=t},function(e,r,a){"use strict";var n=a(0).FDLayoutConstants;function i(){}for(var s in n)i[s]=n[s];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,r,a){"use strict";var n=a(0).FDLayoutEdge;function i(o,l,u){n.call(this,o,l,u)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).LGraph;function i(o,l,u){n.call(this,o,l,u)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).LGraphManager;function i(o){n.call(this,o)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).FDLayoutNode,i=a(0).IMath;function s(l,u,f,h){n.call(this,l,u,f,h)}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.move=function(){var l=this.graphManager.getLayout();this.displacementX=l.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=l.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementX=l.coolingFactor*l.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementY=l.coolingFactor*l.maxNodeDisplacement*i.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),l.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},s.prototype.propogateDisplacementToChildren=function(l,u){for(var f=this.getChild().getNodes(),h,c=0;c<f.length;c++)h=f[c],h.getChild()==null?(h.moveBy(l,u),h.displacementX+=l,h.displacementY+=u):h.propogateDisplacementToChildren(l,u)},s.prototype.setPred1=function(l){this.pred1=l},s.prototype.getPred1=function(){return pred1},s.prototype.getPred2=function(){return pred2},s.prototype.setNext=function(l){this.next=l},s.prototype.getNext=function(){return next},s.prototype.setProcessed=function(l){this.processed=l},s.prototype.isProcessed=function(){return processed},e.exports=s},function(e,r,a){"use strict";var n=a(0).FDLayout,i=a(4),s=a(3),o=a(5),l=a(2),u=a(1),f=a(0).FDLayoutConstants,h=a(0).LayoutConstants,c=a(0).Point,v=a(0).PointD,d=a(0).Layout,g=a(0).Integer,p=a(0).IGeometry,y=a(0).LGraph,b=a(0).Transform;function w(){n.call(this),this.toBeTiled={}}w.prototype=Object.create(n.prototype);for(var D in n)w[D]=n[D];w.prototype.newGraphManager=function(){var m=new i(this);return this.graphManager=m,m},w.prototype.newGraph=function(m){return new s(null,this.graphManager,m)},w.prototype.newNode=function(m){return new o(this.graphManager,m)},w.prototype.newEdge=function(m){return new l(null,null,m)},w.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.isSubLayout||(u.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=u.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=u.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=f.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=f.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=f.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=f.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=f.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/f.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=f.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},w.prototype.layout=function(){var m=h.DEFAULT_CREATE_BENDS_AS_NEEDED;return m&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},w.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(u.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(L){return x.has(L)});this.graphManager.setAllNodesToApplyGravitation(E)}}else{var m=this.getFlatForest();if(m.length>0)this.positionNodesRadially(m);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(C){return x.has(C)});this.graphManager.setAllNodesToApplyGravitation(E),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},w.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%f.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 m=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(T){return m.has(T)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=f.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=f.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var E=!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(E,C),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},w.prototype.getPositionsData=function(){for(var m=this.graphManager.getAllNodes(),x={},E=0;E<m.length;E++){var C=m[E].rect,T=m[E].id;x[T]={id:T,x:C.getCenterX(),y:C.getCenterY(),w:C.width,h:C.height}}return x},w.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var m=!1;if(f.ANIMATE==="during")this.emit("layoutstarted");else{for(;!m;)m=this.tick();this.graphManager.updateBounds()}},w.prototype.calculateNodesToApplyGravitationTo=function(){var m=[],x,E=this.graphManager.getGraphs(),C=E.length,T;for(T=0;T<C;T++)x=E[T],x.updateConnected(),x.isConnected||(m=m.concat(x.getNodes()));return m},w.prototype.createBendpoints=function(){var m=[];m=m.concat(this.graphManager.getAllEdges());var x=new Set,E;for(E=0;E<m.length;E++){var C=m[E];if(!x.has(C)){var T=C.getSource(),L=C.getTarget();if(T==L)C.getBendpoints().push(new v),C.getBendpoints().push(new v),this.createDummyNodesForBendpoints(C),x.add(C);else{var A=[];if(A=A.concat(T.getEdgeListToNode(L)),A=A.concat(L.getEdgeListToNode(T)),!x.has(A[0])){if(A.length>1){var S;for(S=0;S<A.length;S++){var M=A[S];M.getBendpoints().push(new v),this.createDummyNodesForBendpoints(M)}}A.forEach(function(N){x.add(N)})}}}if(x.size==m.length)break}},w.prototype.positionNodesRadially=function(m){for(var x=new c(0,0),E=Math.ceil(Math.sqrt(m.length)),C=0,T=0,L=0,A=new v(0,0),S=0;S<m.length;S++){S%E==0&&(L=0,T=C,S!=0&&(T+=u.DEFAULT_COMPONENT_SEPERATION),C=0);var M=m[S],N=d.findCenterOfTree(M);x.x=L,x.y=T,A=w.radialLayout(M,N,x),A.y>C&&(C=Math.floor(A.y)),L=Math.floor(A.x+u.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(h.WORLD_CENTER_X-A.x/2,h.WORLD_CENTER_Y-A.y/2))},w.radialLayout=function(m,x,E){var C=Math.max(this.maxDiagonalInTree(m),u.DEFAULT_RADIAL_SEPARATION);w.branchRadialLayout(x,null,0,359,0,C);var T=y.calculateBounds(m),L=new b;L.setDeviceOrgX(T.getMinX()),L.setDeviceOrgY(T.getMinY()),L.setWorldOrgX(E.x),L.setWorldOrgY(E.y);for(var A=0;A<m.length;A++){var S=m[A];S.transform(L)}var M=new v(T.getMaxX(),T.getMaxY());return L.inverseTransformPoint(M)},w.branchRadialLayout=function(m,x,E,C,T,L){var A=(C-E+1)/2;A<0&&(A+=180);var S=(A+E)%360,M=S*p.TWO_PI/360,N=Math.cos(M),P=T*Math.cos(M),R=T*Math.sin(M);m.setCenter(P,R);var I=[];I=I.concat(m.getEdges());var k=I.length;x!=null&&k--;for(var F=0,z=I.length,B,G=m.getEdgesBetween(x);G.length>1;){var $=G[0];G.splice(0,1);var X=I.indexOf($);X>=0&&I.splice(X,1),z--,k--}x!=null?B=(I.indexOf(G[0])+1)%z:B=0;for(var Y=Math.abs(C-E)/k,_=B;F!=k;_=++_%z){var q=I[_].getOtherEnd(m);if(q!=x){var K=(E+F*Y)%360,j=(K+Y)%360;w.branchRadialLayout(q,m,K,j,T+L,L),F++}}},w.maxDiagonalInTree=function(m){for(var x=g.MIN_VALUE,E=0;E<m.length;E++){var C=m[E],T=C.getDiagonal();T>x&&(x=T)}return x},w.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},w.prototype.groupZeroDegreeMembers=function(){var m=this,x={};this.memberGroups={},this.idToDummyNode={};for(var E=[],C=this.graphManager.getAllNodes(),T=0;T<C.length;T++){var L=C[T],A=L.getParent();this.getNodeDegreeWithChildren(L)===0&&(A.id==null||!this.getToBeTiled(A))&&E.push(L)}for(var T=0;T<E.length;T++){var L=E[T],S=L.getParent().id;typeof x[S]>"u"&&(x[S]=[]),x[S]=x[S].concat(L)}Object.keys(x).forEach(function(M){if(x[M].length>1){var N="DummyCompound_"+M;m.memberGroups[N]=x[M];var P=x[M][0].getParent(),R=new o(m.graphManager);R.id=N,R.paddingLeft=P.paddingLeft||0,R.paddingRight=P.paddingRight||0,R.paddingBottom=P.paddingBottom||0,R.paddingTop=P.paddingTop||0,m.idToDummyNode[N]=R;var I=m.getGraphManager().add(m.newGraph(),R),k=P.getChild();k.add(R);for(var F=0;F<x[M].length;F++){var z=x[M][F];k.remove(z),I.add(z)}}})},w.prototype.clearCompounds=function(){var m={},x={};this.performDFSOnCompounds();for(var E=0;E<this.compoundOrder.length;E++)x[this.compoundOrder[E].id]=this.compoundOrder[E],m[this.compoundOrder[E].id]=[].concat(this.compoundOrder[E].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[E].getChild()),this.compoundOrder[E].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(m,x)},w.prototype.clearZeroDegreeMembers=function(){var m=this,x=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(E){var C=m.idToDummyNode[E];x[E]=m.tileNodes(m.memberGroups[E],C.paddingLeft+C.paddingRight),C.rect.width=x[E].width,C.rect.height=x[E].height})},w.prototype.repopulateCompounds=function(){for(var m=this.compoundOrder.length-1;m>=0;m--){var x=this.compoundOrder[m],E=x.id,C=x.paddingLeft,T=x.paddingTop;this.adjustLocations(this.tiledMemberPack[E],x.rect.x,x.rect.y,C,T)}},w.prototype.repopulateZeroDegreeMembers=function(){var m=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(E){var C=m.idToDummyNode[E],T=C.paddingLeft,L=C.paddingTop;m.adjustLocations(x[E],C.rect.x,C.rect.y,T,L)})},w.prototype.getToBeTiled=function(m){var x=m.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var E=m.getChild();if(E==null)return this.toBeTiled[x]=!1,!1;for(var C=E.getNodes(),T=0;T<C.length;T++){var L=C[T];if(this.getNodeDegree(L)>0)return this.toBeTiled[x]=!1,!1;if(L.getChild()==null){this.toBeTiled[L.id]=!1;continue}if(!this.getToBeTiled(L))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},w.prototype.getNodeDegree=function(m){for(var x=m.id,E=m.getEdges(),C=0,T=0;T<E.length;T++){var L=E[T];L.getSource().id!==L.getTarget().id&&(C=C+1)}return C},w.prototype.getNodeDegreeWithChildren=function(m){var x=this.getNodeDegree(m);if(m.getChild()==null)return x;for(var E=m.getChild().getNodes(),C=0;C<E.length;C++){var T=E[C];x+=this.getNodeDegreeWithChildren(T)}return x},w.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},w.prototype.fillCompexOrderByDFS=function(m){for(var x=0;x<m.length;x++){var E=m[x];E.getChild()!=null&&this.fillCompexOrderByDFS(E.getChild().getNodes()),this.getToBeTiled(E)&&this.compoundOrder.push(E)}},w.prototype.adjustLocations=function(m,x,E,C,T){x+=C,E+=T;for(var L=x,A=0;A<m.rows.length;A++){var S=m.rows[A];x=L;for(var M=0,N=0;N<S.length;N++){var P=S[N];P.rect.x=x,P.rect.y=E,x+=P.rect.width+m.horizontalPadding,P.rect.height>M&&(M=P.rect.height)}E+=M+m.verticalPadding}},w.prototype.tileCompoundMembers=function(m,x){var E=this;this.tiledMemberPack=[],Object.keys(m).forEach(function(C){var T=x[C];E.tiledMemberPack[C]=E.tileNodes(m[C],T.paddingLeft+T.paddingRight),T.rect.width=E.tiledMemberPack[C].width,T.rect.height=E.tiledMemberPack[C].height})},w.prototype.tileNodes=function(m,x){var E=u.TILING_PADDING_VERTICAL,C=u.TILING_PADDING_HORIZONTAL,T={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:E,horizontalPadding:C};m.sort(function(S,M){return S.rect.width*S.rect.height>M.rect.width*M.rect.height?-1:S.rect.width*S.rect.height<M.rect.width*M.rect.height?1:0});for(var L=0;L<m.length;L++){var A=m[L];T.rows.length==0?this.insertNodeToRow(T,A,0,x):this.canAddHorizontal(T,A.rect.width,A.rect.height)?this.insertNodeToRow(T,A,this.getShortestRowIndex(T),x):this.insertNodeToRow(T,A,T.rows.length,x),this.shiftToLastRow(T)}return T},w.prototype.insertNodeToRow=function(m,x,E,C){var T=C;if(E==m.rows.length){var L=[];m.rows.push(L),m.rowWidth.push(T),m.rowHeight.push(0)}var A=m.rowWidth[E]+x.rect.width;m.rows[E].length>0&&(A+=m.horizontalPadding),m.rowWidth[E]=A,m.width<A&&(m.width=A);var S=x.rect.height;E>0&&(S+=m.verticalPadding);var M=0;S>m.rowHeight[E]&&(M=m.rowHeight[E],m.rowHeight[E]=S,M=m.rowHeight[E]-M),m.height+=M,m.rows[E].push(x)},w.prototype.getShortestRowIndex=function(m){for(var x=-1,E=Number.MAX_VALUE,C=0;C<m.rows.length;C++)m.rowWidth[C]<E&&(x=C,E=m.rowWidth[C]);return x},w.prototype.getLongestRowIndex=function(m){for(var x=-1,E=Number.MIN_VALUE,C=0;C<m.rows.length;C++)m.rowWidth[C]>E&&(x=C,E=m.rowWidth[C]);return x},w.prototype.canAddHorizontal=function(m,x,E){var C=this.getShortestRowIndex(m);if(C<0)return!0;var T=m.rowWidth[C];if(T+m.horizontalPadding+x<=m.width)return!0;var L=0;m.rowHeight[C]<E&&C>0&&(L=E+m.verticalPadding-m.rowHeight[C]);var A;m.width-T>=x+m.horizontalPadding?A=(m.height+L)/(T+x+m.horizontalPadding):A=(m.height+L)/m.width,L=E+m.verticalPadding;var S;return m.width<x?S=(m.height+L)/x:S=(m.height+L)/m.width,S<1&&(S=1/S),A<1&&(A=1/A),A<S},w.prototype.shiftToLastRow=function(m){var x=this.getLongestRowIndex(m),E=m.rowWidth.length-1,C=m.rows[x],T=C[C.length-1],L=T.width+m.horizontalPadding;if(m.width-m.rowWidth[E]>L&&x!=E){C.splice(-1,1),m.rows[E].push(T),m.rowWidth[x]=m.rowWidth[x]-L,m.rowWidth[E]=m.rowWidth[E]+L,m.width=m.rowWidth[instance.getLongestRowIndex(m)];for(var A=Number.MIN_VALUE,S=0;S<C.length;S++)C[S].height>A&&(A=C[S].height);x>0&&(A+=m.verticalPadding);var M=m.rowHeight[x]+m.rowHeight[E];m.rowHeight[x]=A,m.rowHeight[E]<T.height+m.verticalPadding&&(m.rowHeight[E]=T.height+m.verticalPadding);var N=m.rowHeight[x]+m.rowHeight[E];m.height+=N-M,this.shiftToLastRow(m)}},w.prototype.tilingPreLayout=function(){u.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},w.prototype.tilingPostLayout=function(){u.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},w.prototype.reduceTrees=function(){for(var m=[],x=!0,E;x;){var C=this.graphManager.getAllNodes(),T=[];x=!1;for(var L=0;L<C.length;L++)E=C[L],E.getEdges().length==1&&!E.getEdges()[0].isInterGraph&&E.getChild()==null&&(T.push([E,E.getEdges()[0],E.getOwner()]),x=!0);if(x==!0){for(var A=[],S=0;S<T.length;S++)T[S][0].getEdges().length==1&&(A.push(T[S]),T[S][0].getOwner().remove(T[S][0]));m.push(A),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=m},w.prototype.growTree=function(m){for(var x=m.length,E=m[x-1],C,T=0;T<E.length;T++)C=E[T],this.findPlaceforPrunedNode(C),C[2].add(C[0]),C[2].add(C[1],C[1].source,C[1].target);m.splice(m.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},w.prototype.findPlaceforPrunedNode=function(m){var x,E,C=m[0];C==m[1].source?E=m[1].target:E=m[1].source;var T=E.startX,L=E.finishX,A=E.startY,S=E.finishY,M=0,N=0,P=0,R=0,I=[M,P,N,R];if(A>0)for(var k=T;k<=L;k++)I[0]+=this.grid[k][A-1].length+this.grid[k][A].length-1;if(L<this.grid.length-1)for(var k=A;k<=S;k++)I[1]+=this.grid[L+1][k].length+this.grid[L][k].length-1;if(S<this.grid[0].length-1)for(var k=T;k<=L;k++)I[2]+=this.grid[k][S+1].length+this.grid[k][S].length-1;if(T>0)for(var k=A;k<=S;k++)I[3]+=this.grid[T-1][k].length+this.grid[T][k].length-1;for(var F=g.MAX_VALUE,z,B,G=0;G<I.length;G++)I[G]<F?(F=I[G],z=1,B=G):I[G]==F&&z++;if(z==3&&F==0)I[0]==0&&I[1]==0&&I[2]==0?x=1:I[0]==0&&I[1]==0&&I[3]==0?x=0:I[0]==0&&I[2]==0&&I[3]==0?x=3:I[1]==0&&I[2]==0&&I[3]==0&&(x=2);else if(z==2&&F==0){var $=Math.floor(Math.random()*2);I[0]==0&&I[1]==0?$==0?x=0:x=1:I[0]==0&&I[2]==0?$==0?x=0:x=2:I[0]==0&&I[3]==0?$==0?x=0:x=3:I[1]==0&&I[2]==0?$==0?x=1:x=2:I[1]==0&&I[3]==0?$==0?x=1:x=3:$==0?x=2:x=3}else if(z==4&&F==0){var $=Math.floor(Math.random()*4);x=$}else x=B;x==0?C.setCenter(E.getCenterX(),E.getCenterY()-E.getHeight()/2-f.DEFAULT_EDGE_LENGTH-C.getHeight()/2):x==1?C.setCenter(E.getCenterX()+E.getWidth()/2+f.DEFAULT_EDGE_LENGTH+C.getWidth()/2,E.getCenterY()):x==2?C.setCenter(E.getCenterX(),E.getCenterY()+E.getHeight()/2+f.DEFAULT_EDGE_LENGTH+C.getHeight()/2):C.setCenter(E.getCenterX()-E.getWidth()/2-f.DEFAULT_EDGE_LENGTH-C.getWidth()/2,E.getCenterY())},e.exports=w},function(e,r,a){"use strict";var n={};n.layoutBase=a(0),n.CoSEConstants=a(1),n.CoSEEdge=a(2),n.CoSEGraph=a(3),n.CoSEGraphManager=a(4),n.CoSELayout=a(6),n.CoSENode=a(5),e.exports=n}])})});var eh=ne((Na,ki)=>{(function(e,r){typeof Na=="object"&&typeof ki=="object"?ki.exports=r(Ri()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof Na=="object"?Na.cytoscapeCoseBilkent=r(Ri()):e.cytoscapeCoseBilkent=r(e.coseBase)})(Na,function(t){return function(e){var r={};function a(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=r,a.i=function(n){return n},a.d=function(n,i,s){a.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:s})},a.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(i,"a",i),i},a.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},a.p="",a(a.s=1)}([function(e,r){e.exports=t},function(e,r,a){"use strict";var n=a(0).layoutBase.LayoutConstants,i=a(0).layoutBase.FDLayoutConstants,s=a(0).CoSEConstants,o=a(0).CoSELayout,l=a(0).CoSENode,u=a(0).layoutBase.PointD,f=a(0).layoutBase.DimensionD,h={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 c(p,y){var b={};for(var w in p)b[w]=p[w];for(var w in y)b[w]=y[w];return b}function v(p){this.options=c(h,p),d(this.options)}var d=function(y){y.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=y.nodeRepulsion),y.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=y.idealEdgeLength),y.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=y.edgeElasticity),y.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=y.nestingFactor),y.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=y.gravity),y.numIter!=null&&(s.MAX_ITERATIONS=i.MAX_ITERATIONS=y.numIter),y.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=y.gravityRange),y.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=y.gravityCompound),y.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=y.gravityRangeCompound),y.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=y.initialEnergyOnIncremental),y.quality=="draft"?n.QUALITY=0:y.quality=="proof"?n.QUALITY=2:n.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=y.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!y.randomize,s.ANIMATE=i.ANIMATE=n.ANIMATE=y.animate,s.TILE=y.tile,s.TILING_PADDING_VERTICAL=typeof y.tilingPaddingVertical=="function"?y.tilingPaddingVertical.call():y.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof y.tilingPaddingHorizontal=="function"?y.tilingPaddingHorizontal.call():y.tilingPaddingHorizontal};v.prototype.run=function(){var p,y,b=this.options,w=this.idToLNode={},D=this.layout=new o,m=this;m.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var x=D.newGraphManager();this.gm=x;var E=this.options.eles.nodes(),C=this.options.eles.edges();this.root=x.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(E),D);for(var T=0;T<C.length;T++){var L=C[T],A=this.idToLNode[L.data("source")],S=this.idToLNode[L.data("target")];if(A!==S&&A.getEdgesBetween(S).length==0){var M=x.add(D.newEdge(),A,S);M.id=L.id()}}var N=function(I,k){typeof I=="number"&&(I=k);var F=I.data("id"),z=m.idToLNode[F];return{x:z.getRect().getCenterX(),y:z.getRect().getCenterY()}},P=function R(){for(var I=function(){b.fit&&b.cy.fit(b.eles,b.padding),p||(p=!0,m.cy.one("layoutready",b.ready),m.cy.trigger({type:"layoutready",layout:m}))},k=m.options.refresh,F,z=0;z<k&&!F;z++)F=m.stopped||m.layout.tick();if(F){D.checkLayoutSuccess()&&!D.isSubLayout&&D.doPostLayout(),D.tilingPostLayout&&D.tilingPostLayout(),D.isLayoutFinished=!0,m.options.eles.nodes().positions(N),I(),m.cy.one("layoutstop",m.options.stop),m.cy.trigger({type:"layoutstop",layout:m}),y&&cancelAnimationFrame(y),p=!1;return}var B=m.layout.getPositionsData();b.eles.nodes().positions(function(G,$){if(typeof G=="number"&&(G=$),!G.isParent()){for(var X=G.id(),Y=B[X],_=G;Y==null&&(Y=B[_.data("parent")]||B["DummyCompound_"+_.data("parent")],B[X]=Y,_=_.parent()[0],_!=null););return Y!=null?{x:Y.x,y:Y.y}:{x:G.position("x"),y:G.position("y")}}}),I(),y=requestAnimationFrame(R)};return D.addListener("layoutstarted",function(){m.options.animate==="during"&&(y=requestAnimationFrame(P))}),D.runLayout(),this.options.animate!=="during"&&(m.options.eles.nodes().not(":parent").layoutPositions(m,m.options,N),p=!1),this},v.prototype.getTopMostNodes=function(p){for(var y={},b=0;b<p.length;b++)y[p[b].id()]=!0;var w=p.filter(function(D,m){typeof D=="number"&&(D=m);for(var x=D.parent()[0];x!=null;){if(y[x.id()])return!1;x=x.parent()[0]}return!0});return w},v.prototype.processChildrenList=function(p,y,b){for(var w=y.length,D=0;D<w;D++){var m=y[D],x=m.children(),E,C=m.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(m.outerWidth()!=null&&m.outerHeight()!=null?E=p.add(new l(b.graphManager,new u(m.position("x")-C.w/2,m.position("y")-C.h/2),new f(parseFloat(C.w),parseFloat(C.h)))):E=p.add(new l(this.graphManager)),E.id=m.data("id"),E.paddingLeft=parseInt(m.css("padding")),E.paddingTop=parseInt(m.css("padding")),E.paddingRight=parseInt(m.css("padding")),E.paddingBottom=parseInt(m.css("padding")),this.options.nodeDimensionsIncludeLabels&&m.isParent()){var T=m.boundingBox({includeLabels:!0,includeNodes:!1}).w,L=m.boundingBox({includeLabels:!0,includeNodes:!1}).h,A=m.css("text-halign");E.labelWidth=T,E.labelHeight=L,E.labelPos=A}if(this.idToLNode[m.data("id")]=E,isNaN(E.rect.x)&&(E.rect.x=0),isNaN(E.rect.y)&&(E.rect.y=0),x!=null&&x.length>0){var S;S=b.getGraphManager().add(b.newGraph(),E),this.processChildrenList(S,x,b)}}},v.prototype.stop=function(){return this.stopped=!0,this};var g=function(y){y("layout","cose-bilkent",v)};typeof cytoscape<"u"&&g(cytoscape),e.exports=g}])})});var Bi=Yr(jf(),1),th=Yr(eh(),1);var Gb=Yr(dh(),1),zb=Yr(gh(),1),qb=Yr(ph(),1);var Pi=function(){var t=function(D,m,x,E){for(x=x||{},E=D.length;E--;x[D[E]]=m);return x},e=[1,4],r=[1,13],a=[1,12],n=[1,15],i=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],f=[1,24],h=[1,25],c=[6,7,11],v=[1,6,13,15,16,19,22],d=[1,33],g=[1,34],p=[1,6,7,11,13,15,16,19,22],y={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(m,x,E,C,T,L,A){var S=L.length-1;switch(T){case 6:case 7:return C;case 8:C.getLogger().trace("Stop NL ");break;case 9:C.getLogger().trace("Stop EOF ");break;case 11:C.getLogger().trace("Stop NL2 ");break;case 12:C.getLogger().trace("Stop EOF2 ");break;case 15:C.getLogger().info("Node: ",L[S].id),C.addNode(L[S-1].length,L[S].id,L[S].descr,L[S].type);break;case 16:C.getLogger().trace("Icon: ",L[S]),C.decorateNode({icon:L[S]});break;case 17:case 21:C.decorateNode({class:L[S]});break;case 18:C.getLogger().trace("SPACELIST");break;case 19:C.getLogger().trace("Node: ",L[S].id),C.addNode(0,L[S].id,L[S].descr,L[S].type);break;case 20:C.decorateNode({icon:L[S]});break;case 25:C.getLogger().trace("node found ..",L[S-2]),this.$={id:L[S-1],descr:L[S-1],type:C.getType(L[S-2],L[S])};break;case 26:this.$={id:L[S],descr:L[S],type:C.nodeType.DEFAULT};break;case 27:C.getLogger().trace("node found ..",L[S-3]),this.$={id:L[S-3],descr:L[S-1],type:C.getType(L[S-2],L[S])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:u,7:f,10:23,11:h},t(c,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),t(c,[2,18]),t(c,[2,19]),t(c,[2,20]),t(c,[2,21]),t(c,[2,23]),t(c,[2,24]),t(c,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:f,10:32,11:h},{1:[2,7],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(v,[2,14],{7:d,11:g}),t(p,[2,8]),t(p,[2,9]),t(p,[2,10]),t(c,[2,15]),t(c,[2,16]),t(c,[2,17]),{20:[1,35]},{21:[1,36]},t(v,[2,13],{7:d,11:g}),t(p,[2,11]),t(p,[2,12]),{21:[1,37]},t(c,[2,25]),t(c,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(m,x){if(x.recoverable)this.trace(m);else{var E=new Error(m);throw E.hash=x,E}},parse:function(m){var x=this,E=[0],C=[],T=[null],L=[],A=this.table,S="",M=0,N=0,P=2,R=1,I=L.slice.call(arguments,1),k=Object.create(this.lexer),F={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(F.yy[z]=this.yy[z]);k.setInput(m,F.yy),F.yy.lexer=k,F.yy.parser=this,typeof k.yylloc>"u"&&(k.yylloc={});var B=k.yylloc;L.push(B);var G=k.options&&k.options.ranges;typeof F.yy.parseError=="function"?this.parseError=F.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function $(){var te;return te=C.pop()||k.lex()||R,typeof te!="number"&&(te instanceof Array&&(C=te,te=C.pop()),te=x.symbols_[te]||te),te}for(var X,Y,_,q,K={},j,Q,ee,ie;;){if(Y=E[E.length-1],this.defaultActions[Y]?_=this.defaultActions[Y]:((X===null||typeof X>"u")&&(X=$()),_=A[Y]&&A[Y][X]),typeof _>"u"||!_.length||!_[0]){var de="";ie=[];for(j in A[Y])this.terminals_[j]&&j>P&&ie.push("'"+this.terminals_[j]+"'");k.showPosition?de="Parse error on line "+(M+1)+`:
`+k.showPosition()+`
Expecting `+ie.join(", ")+", got '"+(this.terminals_[X]||X)+"'":de="Parse error on line "+(M+1)+": Unexpected "+(X==R?"end of input":"'"+(this.terminals_[X]||X)+"'"),this.parseError(de,{text:k.match,token:this.terminals_[X]||X,line:k.yylineno,loc:B,expected:ie})}if(_[0]instanceof Array&&_.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Y+", token: "+X);switch(_[0]){case 1:E.push(X),T.push(k.yytext),L.push(k.yylloc),E.push(_[1]),X=null,N=k.yyleng,S=k.yytext,M=k.yylineno,B=k.yylloc;break;case 2:if(Q=this.productions_[_[1]][1],K.$=T[T.length-Q],K._$={first_line:L[L.length-(Q||1)].first_line,last_line:L[L.length-1].last_line,first_column:L[L.length-(Q||1)].first_column,last_column:L[L.length-1].last_column},G&&(K._$.range=[L[L.length-(Q||1)].range[0],L[L.length-1].range[1]]),q=this.performAction.apply(K,[S,N,M,F.yy,_[1],T,L].concat(I)),typeof q<"u")return q;Q&&(E=E.slice(0,-1*Q*2),T=T.slice(0,-1*Q),L=L.slice(0,-1*Q)),E.push(this.productions_[_[1]][0]),T.push(K.$),L.push(K._$),ee=A[E[E.length-2]][E[E.length-1]],E.push(ee);break;case 3:return!0}}return!0}},b=function(){var D={EOF:1,parseError:function(x,E){if(this.yy.parser)this.yy.parser.parseError(x,E);else throw new Error(x)},setInput:function(m,x){return this.yy=x||this.yy||{},this._input=m,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 m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var x=m.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},unput:function(m){var x=m.length,E=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var C=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),E.length-1&&(this.yylineno-=E.length-1);var T=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:E?(E.length===C.length?this.yylloc.first_column:0)+C[C.length-E.length].length-E[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[T[0],T[0]+this.yyleng-x]),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).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(m){this.unput(this.match.slice(m))},pastInput:function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var m=this.pastInput(),x=new Array(m.length+1).join("-");return m+this.upcomingInput()+`
`+x+"^"},test_match:function(m,x){var E,C,T;if(this.options.backtrack_lexer&&(T={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&&(T.yylloc.range=this.yylloc.range.slice(0))),C=m[0].match(/(?:\r\n?|\n).*/g),C&&(this.yylineno+=C.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:C?C[C.length-1].length-C[C.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+m[0].length},this.yytext+=m[0],this.match+=m[0],this.matches=m,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(m[0].length),this.matched+=m[0],E=this.performAction.call(this,this.yy,this,x,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var L in T)this[L]=T[L];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var m,x,E,C;this._more||(this.yytext="",this.match="");for(var T=this._currentRules(),L=0;L<T.length;L++)if(E=this._input.match(this.rules[T[L]]),E&&(!x||E[0].length>x[0].length)){if(x=E,C=L,this.options.backtrack_lexer){if(m=this.test_match(E,T[L]),m!==!1)return m;if(this._backtrack){x=!1;continue}else return!1}else if(!this.options.flex)break}return x?(m=this.test_match(x,T[C]),m!==!1?m:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var x=this.next();return x||this.lex()},begin:function(x){this.conditionStack.push(x)},popState:function(){var x=this.conditionStack.length-1;return x>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(x){return x=this.conditionStack.length-1-Math.abs(x||0),x>=0?this.conditionStack[x]:"INITIAL"},pushState:function(x){this.begin(x)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(x,E,C,T){switch(C){case 0:return x.getLogger().trace("Found comment",E.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:x.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return x.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:x.getLogger().trace("end icon"),this.popState();break;case 10:return x.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return x.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return x.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return x.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:x.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return x.getLogger().trace("description:",E.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),x.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),x.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),x.getLogger().trace("node end ...",E.yytext),"NODE_DEND";case 30:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),x.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),x.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 35:return x.getLogger().trace("Long description:",E.yytext),20;case 36:return x.getLogger().trace("Long description:",E.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 D}();y.lexer=b;function w(){this.yy={}}return w.prototype=y,y.Parser=w,new w}();Pi.parser=Pi;var U0=Pi,Dt=[],rh=0,Fi={},Y0=()=>{Dt=[],rh=0,Fi={}},H0=function(t){for(let e=Dt.length-1;e>=0;e--)if(Dt[e].level<t)return Dt[e];return null},$0=()=>Dt.length>0?Dt[0]:null,X0=(t,e,r,a)=>{var n,i;zt.info("addNode",t,e,r,a);let s=ka(),o=((n=s.mindmap)==null?void 0:n.padding)??$r.mindmap.padding;switch(a){case $e.ROUNDED_RECT:case $e.RECT:case $e.HEXAGON:o*=2}let l={id:rh++,nodeId:Hr(e,s),level:t,descr:Hr(r,s),type:a,children:[],width:((i=s.mindmap)==null?void 0:i.maxNodeWidth)??$r.mindmap.maxNodeWidth,padding:o},u=H0(t);if(u)u.children.push(l),Dt.push(l);else if(Dt.length===0)Dt.push(l);else throw new Error('There can be only one root. No parent could be found for ("'+l.descr+'")')},$e={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},_0=(t,e)=>{switch(zt.debug("In get type",t,e),t){case"[":return $e.RECT;case"(":return e===")"?$e.ROUNDED_RECT:$e.CLOUD;case"((":return $e.CIRCLE;case")":return $e.CLOUD;case"))":return $e.BANG;case"{{":return $e.HEXAGON;default:return $e.DEFAULT}},W0=(t,e)=>{Fi[t]=e},K0=t=>{if(!t)return;let e=ka(),r=Dt[Dt.length-1];t.icon&&(r.icon=Hr(t.icon,e)),t.class&&(r.class=Hr(t.class,e))},Z0=t=>{switch(t){case $e.DEFAULT:return"no-border";case $e.RECT:return"rect";case $e.ROUNDED_RECT:return"rounded-rect";case $e.CIRCLE:return"circle";case $e.CLOUD:return"cloud";case $e.BANG:return"bang";case $e.HEXAGON:return"hexgon";default:return"no-border"}},Q0=()=>zt,J0=t=>Fi[t],j0={clear:Y0,addNode:X0,getMindmap:$0,nodeType:$e,getType:_0,setElementForId:W0,decorateNode:K0,type2Str:Z0,getLogger:Q0,getElementById:J0},e1=j0,t1=12,r1=function(t,e,r,a){e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+2*5} q0,-5 5,-5 h${r.width-2*5} q5,0 5,5 v${r.height-5} H0 Z`),e.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},a1=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},n1=function(t,e,r){let a=r.width,n=r.height,i=.15*a,s=.25*a,o=.35*a,l=.2*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${a*.25},${-1*a*.1}
a${o},${o} 1 0,1 ${a*.4},${-1*a*.1}
a${s},${s} 1 0,1 ${a*.35},${1*a*.2}
a${i},${i} 1 0,1 ${a*.15},${1*n*.35}
a${l},${l} 1 0,1 ${-1*a*.15},${1*n*.65}
a${s},${i} 1 0,1 ${-1*a*.25},${a*.15}
a${o},${o} 1 0,1 ${-1*a*.5},0
a${i},${i} 1 0,1 ${-1*a*.25},${-1*a*.15}
a${i},${i} 1 0,1 ${-1*a*.1},${-1*n*.35}
a${l},${l} 1 0,1 ${a*.1},${-1*n*.65}
H0 V0 Z`)},i1=function(t,e,r){let a=r.width,n=r.height,i=.15*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${a*.25},${-1*n*.1}
a${i},${i} 1 0,0 ${a*.25},0
a${i},${i} 1 0,0 ${a*.25},0
a${i},${i} 1 0,0 ${a*.25},${1*n*.1}
a${i},${i} 1 0,0 ${a*.15},${1*n*.33}
a${i*.8},${i*.8} 1 0,0 0,${1*n*.34}
a${i},${i} 1 0,0 ${-1*a*.15},${1*n*.33}
a${i},${i} 1 0,0 ${-1*a*.25},${n*.15}
a${i},${i} 1 0,0 ${-1*a*.25},0
a${i},${i} 1 0,0 ${-1*a*.25},0
a${i},${i} 1 0,0 ${-1*a*.25},${-1*n*.15}
a${i},${i} 1 0,0 ${-1*a*.1},${-1*n*.33}
a${i*.8},${i*.8} 1 0,0 0,${-1*n*.34}
a${i},${i} 1 0,0 ${a*.1},${-1*n*.33}
H0 V0 Z`)},s1=function(t,e,r){e.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("r",r.width/2)};function o1(t,e,r,a,n){return t.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+r+")")}var u1=function(t,e,r){let a=r.height,i=a/4,s=r.width-r.padding+2*i,o=[{x:i,y:0},{x:s-i,y:0},{x:s,y:-a/2},{x:s-i,y:-a},{x:i,y:-a},{x:0,y:-a/2}];o1(e,s,a,o,r)},l1=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},f1=function(t,e,r,a,n){let i=n.htmlLabels,s=a%(t1-1),o=e.append("g");r.section=s;let l="section-"+s;s<0&&(l+=" section-root"),o.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+l);let u=o.append("g"),f=o.append("g"),h=r.descr.replace(/(<br\/*>)/g,`
`);Xi(f,h,{useHtmlLabels:i,width:r.width,classes:"mindmap-node-label"}),i||f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let c=f.node().getBBox(),[v]=_i(n.fontSize);if(r.height=c.height+v*1.1*.5+r.padding,r.width=c.width+2*r.padding,r.icon)if(r.type===t.nodeType.CIRCLE)r.height+=50,r.width+=50,o.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;let d=r.height;r.height=Math.max(d,60);let g=Math.abs(r.height-d);o.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+g/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+(25+r.width/2)+", "+(g/2+r.padding/2)+")")}else if(i){let d=(r.width-c.width)/2,g=(r.height-c.height)/2;f.attr("transform","translate("+d+", "+g+")")}else{let d=r.width/2,g=r.padding/2;f.attr("transform","translate("+d+", "+g+")")}switch(r.type){case t.nodeType.DEFAULT:r1(t,u,r,s);break;case t.nodeType.ROUNDED_RECT:l1(t,u,r);break;case t.nodeType.RECT:a1(t,u,r);break;case t.nodeType.CIRCLE:u.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),s1(t,u,r);break;case t.nodeType.CLOUD:n1(t,u,r);break;case t.nodeType.BANG:i1(t,u,r);break;case t.nodeType.HEXAGON:u1(t,u,r);break}return t.setElementForId(r.id,o),r.height},h1=function(t,e){let r=t.getElementById(e.id),a=e.x||0,n=e.y||0;r.attr("transform","translate("+a+","+n+")")};Bi.default.use(th.default);function ah(t,e,r,a,n){f1(t,e,r,a,n),r.children&&r.children.forEach((i,s)=>{ah(t,e,i,a<0?s:a,n)})}function c1(t,e){e.edges().map((r,a)=>{let n=r.data();if(r[0]._private.bodyBounds){let i=r[0]._private.rscratch;zt.trace("Edge: ",a,n),t.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}function nh(t,e,r,a){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:a,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(n=>{nh(n,e,r,a+1),e.add({group:"edges",data:{id:`${t.id}_${n.id}`,source:t.id,target:n.id,depth:a,section:n.section}})})}function v1(t,e){return new Promise(r=>{let a=Ui("body").append("div").attr("id","cy").attr("style","display:none"),n=(0,Bi.default)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),nh(t,n,e,0),n.nodes().forEach(function(i){i.layoutDimensions=()=>{let s=i.data();return{w:s.width,h:s.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(i=>{zt.info("Ready",i),r(n)})})}function d1(t,e){e.nodes().map((r,a)=>{let n=r.data();n.x=r.position().x,n.y=r.position().y,h1(t,n);let i=t.getElementById(n.nodeId);zt.info("Id:",a,"Position: (",r.position().x,", ",r.position().y,")",n),i.attr("transform",`translate(${r.position().x-n.width/2}, ${r.position().y-n.height/2})`),i.attr("attr",`apa-${a})`)})}var g1=async(t,e,r,a)=>{var n,i;zt.debug(`Rendering mindmap diagram
`+t);let s=a.db,o=s.getMindmap();if(!o)return;let l=ka();l.htmlLabels=!1;let u=Ki(e),f=u.append("g");f.attr("class","mindmap-edges");let h=u.append("g");h.attr("class","mindmap-nodes"),ah(s,h,o,-1,l);let c=await v1(o,l);c1(f,c),d1(s,c),Wi(void 0,u,((n=l.mindmap)==null?void 0:n.padding)??$r.mindmap.padding,((i=l.mindmap)==null?void 0:i.useMaxWidth)??$r.mindmap.useMaxWidth)},p1={draw:g1},y1=t=>{let e="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++)t["lineColor"+r]=t["lineColor"+r]||t["cScaleInv"+r],Yi(t["lineColor"+r])?t["lineColor"+r]=Hi(t["lineColor"+r],20):t["lineColor"+r]=$i(t["lineColor"+r],20);for(let r=0;r<t.THEME_COLOR_LIMIT;r++){let a=""+(17-3*r);e+=`
.section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
fill: ${t["cScale"+r]};
}
.section-${r-1} text {
fill: ${t["cScaleLabel"+r]};
}
.node-icon-${r-1} {
font-size: 40px;
color: ${t["cScaleLabel"+r]};
}
.section-edge-${r-1}{
stroke: ${t["cScale"+r]};
}
.edge-depth-${r-1}{
stroke-width: ${a};
}
.section-${r-1} line {
stroke: ${t["cScaleInv"+r]} ;
stroke-width: 3;
}
.disabled, .disabled circle, .disabled text {
fill: lightgray;
}
.disabled text {
fill: #efefef;
}
`}return e},m1=t=>`
.edge {
stroke-width: 3;
}
${y1(t)}
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
fill: ${t.git0};
}
.section-root text {
fill: ${t.gitBranchLabel0};
}
.icon-container {
height:100%;
display: flex;
justify-content: center;
align-items: center;
}
.edge {
fill: none;
}
.mindmap-node-label {
dy: 1em;
alignment-baseline: middle;
text-anchor: middle;
dominant-baseline: middle;
text-align: center;
}
`,b1=m1,Vb={db:e1,renderer:p1,parser:U0,styles:b1};export{Vb as diagram};
/*! Bundled license information:
cytoscape/dist/cytoscape.cjs.js:
(*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*)
(*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*)
(*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
(*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
*/
//# sourceMappingURL=mindmap-definition-f354de21-HIP27OGE.min.js.map