import{g as Ti}from"./vue.runtime.esm-fahCO3eG.chunk.mjs";function We(e){"@babel/helpers - typeof";return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},We(e)}function ci(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Vl(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(l){throw l},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,i=!1,u;return{s:function(){n=n.call(e)},n:function(){var l=n.next();return o=l.done,l},e:function(l){i=!0,u=l},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(i)throw u}}}}var Ye=typeof window>"u"?null:window,Oi=Ye?Ye.navigator:null;Ye&&Ye.document;var Yl=We(""),rs=We({}),Xl=We(function(){}),Wl=typeof HTMLElement>"u"?"undefined":We(HTMLElement),kr=function(e){return e&&e.instanceString&&ze(e.instanceString)?e.instanceString():null},he=function(e){return e!=null&&We(e)==Yl},ze=function(e){return e!=null&&We(e)===Xl},Be=function(e){return!gt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},ke=function(e){return e!=null&&We(e)===rs&&!Be(e)&&e.constructor===Object},Ul=function(e){return e!=null&&We(e)===rs},ne=function(e){return e!=null&&We(e)===We(1)&&!isNaN(e)},Hl=function(e){return ne(e)&&Math.floor(e)===e},aa=function(e){if(Wl!=="undefined")return e!=null&&e instanceof HTMLElement},gt=function(e){return Cr(e)||as(e)},Cr=function(e){return kr(e)==="collection"&&e._private.single},as=function(e){return kr(e)==="collection"&&!e._private.single},hi=function(e){return kr(e)==="core"},is=function(e){return kr(e)==="stylesheet"},Gl=function(e){return kr(e)==="event"},tn=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Kl=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},$l=function(e){return ke(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},Zl=function(e){return Ul(e)&&ze(e.then)},Ql=function(){return Oi&&Oi.userAgent.match(/msie|trident|edge/i)},gr=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var r=[],a=0;at?1:0},iu=function(e,t){return-1*ss(e,t)},ge=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n1&&(v-=1),v<1/6?p+(f-p)*6*v:v<1/2?f:v<2/3?p+(f-p)*(2/3-v)*6:p}var c=new RegExp("^"+tu+"$").exec(e);if(c){if(n=parseInt(c[1]),n<0?n=(360- -1*n%360)%360:n>360&&(n=n%360),n/=360,r=parseFloat(c[2]),r<0||r>100||(r=r/100,a=parseFloat(c[3]),a<0||a>100)||(a=a/100,o=c[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(r===0)i=u=l=Math.round(a*255);else{var d=a<.5?a*(1+r):a+r-a*r,h=2*a-d;i=Math.round(255*s(h,d,n+1/3)),u=Math.round(255*s(h,d,n)),l=Math.round(255*s(h,d,n-1/3))}t=[i,u,l,o]}return t},lu=function(e){var t,n=new RegExp("^"+Jl+"$").exec(e);if(n){t=[];for(var r=[],a=1;a<=3;a++){var o=n[a];if(o[o.length-1]==="%"&&(r[a]=!0),o=parseFloat(o),r[a]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var i=r[1]||r[2]||r[3],u=r[1]&&r[2]&&r[3];if(i&&!u)return;var l=n[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;t.push(l)}}return t},uu=function(e){return du[e.toLowerCase()]},cu=function(e){return(Be(e)?e:null)||uu(e)||ou(e)||lu(e)||su(e)},du={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]},ls=function(e){for(var t=e.map,n=e.keys,r=n.length,a=0;a=t||x<0||d&&C>=o}function g(){var k=_a();if(m(k))return y(k);u=setTimeout(g,v(k))}function y(k){return u=void 0,h&&r?p(k):(r=a=void 0,i)}function b(){u!==void 0&&clearTimeout(u),s=0,r=l=a=u=void 0}function w(){return u===void 0?i:y(_a())}function S(){var k=_a(),x=m(k);if(r=arguments,a=this,l=k,x){if(u===void 0)return f(l);if(d)return clearTimeout(u),u=setTimeout(g,t),p(l)}return u===void 0&&(u=setTimeout(g,t)),i}return S.cancel=b,S.flush=w,S}var va=Ku,Pa=Ye?Ye.performance:null,hs=Pa&&Pa.now?function(){return Pa.now()}:function(){return Date.now()},$u=(function(){if(Ye){if(Ye.requestAnimationFrame)return function(e){Ye.requestAnimationFrame(e)};if(Ye.mozRequestAnimationFrame)return function(e){Ye.mozRequestAnimationFrame(e)};if(Ye.webkitRequestAnimationFrame)return function(e){Ye.webkitRequestAnimationFrame(e)};if(Ye.msRequestAnimationFrame)return function(e){Ye.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(hs())},1e3/60)}})(),ia=function(e){return $u(e)},Yt=hs,zn=9261,ps=65599,ar=5381,fs=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zn,n=t,r;r=e.next(),!r.done;)n=n*ps+r.value|0;return n},vr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:zn;return t*ps+e|0},yr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ar;return(t<<5)+t+e|0},Zu=function(e,t){return e*2097152+t},Xt=function(e){return e[0]*2097152+e[1]},Mr=function(e,t){return[vr(e[0],t[0]),yr(e[1],t[1])]},Qu=function(e,t){var n={value:0,done:!1},r=0,a=e.length,o={next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},qa=function(e){e.splice(0,e.length)},ic=function(e,t){for(var n=0;n"u"?"undefined":We(Set))!==sc?Set:lc,ya=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!hi(e)){Le("An element must have a core reference and parameters set");return}var r=t.group;if(r==null&&(t.data&&t.data.source!=null&&t.data.target!=null?r="edges":r="nodes"),r!=="nodes"&&r!=="edges"){Le("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var a=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:t.selectable===void 0?!0:!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:t.grabbable===void 0?!0:!!t.grabbable,pannable:t.pannable===void 0?r==="edges":!!t.pannable,active:!1,classes:new Xn,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),t.renderedPosition){var o=t.renderedPosition,i=e.pan(),u=e.zoom();a.position={x:(o.x-i.x)/u,y:(o.y-i.y)/u}}var l=[];Be(t.classes)?l=t.classes:he(t.classes)&&(l=t.classes.split(/\s+/));for(var s=0,c=l.length;sy?1:0},c=function(g,y,b,w,S){var k;if(b==null&&(b=0),S==null&&(S=r),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);bP;0<=P?T++:T--)C.push(T);return C}.apply(this).reverse(),x=[],w=0,S=k.length;wM;0<=M?++C:--C)D.push(i(g,b));return D},v=function(g,y,b,w){var S,k,x;for(w==null&&(w=r),S=g[b];b>y;){if(x=b-1>>1,k=g[x],w(S,k)<0){g[b]=k,b=x;continue}break}return g[b]=S},m=function(g,y,b){var w,S,k,x,C;for(b==null&&(b=r),S=g.length,C=y,k=g[y],w=2*y+1;w0;){var S=g.pop(),k=v(S),x=S.id();if(d[x]=k,k!==1/0)for(var C=S.neighborhood().intersect(p),T=0;T0)for(A.unshift(N);c[O];){var R=c[O];A.unshift(R.edge),A.unshift(R.node),z=R.node,O=z.id()}return i.spawn(A)}}}},hc={kruskal:function(e){e=e||function(y){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,a=n.length,o=new Array(a),i=n,u=function(y){for(var b=0;b0;){if(w(),k++,b===s){for(var x=[],C=a,T=s,P=m[T];x.unshift(C),P!=null&&x.unshift(P),C=v[T],C!=null;)T=C.id(),P=m[T];return{found:!0,distance:c[b],path:this.spawn(x),steps:k}}h[b]=!0;for(var M=y._private.edges,D=0;DP&&(p[T]=P,g[T]=C,y[T]=w),!a){var M=C*s+x;!a&&p[M]>P&&(p[M]=P,g[M]=x,y[M]=w)}}}for(var D=0;D1&&arguments[1]!==void 0?arguments[1]:o,ve=y(ae),be=[],xe=ve;;){if(xe==null)return t.spawn();var Me=g(xe),we=Me.edge,Ce=Me.pred;if(be.unshift(xe[0]),xe.same(de)&&be.length>0)break;we!=null&&be.unshift(we),xe=Ce}return u.spawn(be)},S=0;S=0;s--){var c=l[s],d=c[1],h=c[2];(t[d]===i&&t[h]===u||t[d]===u&&t[h]===i)&&l.splice(s,1)}for(var p=0;pr;){var a=Math.floor(Math.random()*t.length);t=xc(a,e,t),n--}return t},wc={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(z){return z.isLoop()});var a=n.length,o=r.length,i=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),u=Math.floor(a/bc);if(a<2){Le("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],s=0;s1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=1/0,a=t;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=-1/0,a=t;a1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=0,a=0,o=t;o1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var i=0,u=e.length-1;u>=0;u--){var l=e[u];o?isFinite(l)||(e[u]=-1/0,i++):e.splice(u,1)}a&&e.sort(function(d,h){return d-h});var s=e.length,c=Math.floor(s/2);return s%2!==0?e[c+1+i]:(e[c-1+i]+e[c+i])/2},_c=function(e){return Math.PI*e/180},Tr=function(e,t){return Math.atan2(t,e)-Math.PI/2},vi=Math.log2||function(e){return Math.log(e)/Math.log(2)},Fi=function(e){return e>0?1:e<0?-1:0},yn=function(e,t){return Math.sqrt(ln(e,t))},ln=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Pc=function(e){for(var t=e.length,n=0,r=0;r=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}}},Tc=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Bc=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Oc=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},ws=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},Ic=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},Xr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Wr=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],n,r,a,o;if(t.length===1)n=r=a=o=t[0];else if(t.length===2)n=a=t[0],o=r=t[1];else if(t.length===4){var i=Dt(t,4);n=i[0],r=i[1],a=i[2],o=i[3]}return e.x1-=o,e.x2+=r,e.y1-=n,e.y2+=a,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ji=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},yi=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},jn=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Nc=function(e,t){return jn(e,t.x,t.y)},Es=function(e,t){return jn(e,t.x1,t.y1)&&jn(e,t.x2,t.y2)},qi=function(e,t,n,r,a,o,i){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?mn(a,o):u,s=a/2,c=o/2;l=Math.min(l,s,c);var d=l!==s,h=l!==c,p;if(d){var f=n-s+l-i,v=r-c-i,m=n+s-l+i,g=v;if(p=Qt(e,t,n,r,f,v,m,g,!1),p.length>0)return p}if(h){var y=n+s+i,b=r-c+l-i,w=y,S=r+c-l+i;if(p=Qt(e,t,n,r,y,b,w,S,!1),p.length>0)return p}if(d){var k=n-s+l-i,x=r+c+i,C=n+s-l+i,T=x;if(p=Qt(e,t,n,r,k,x,C,T,!1),p.length>0)return p}if(h){var P=n-s-i,M=r-c+l-i,D=P,B=r+c-l+i;if(p=Qt(e,t,n,r,P,M,D,B,!1),p.length>0)return p}var _;{var N=n-s+l,A=r-c+l;if(_=or(e,t,n,r,N,A,l+i),_.length>0&&_[0]<=N&&_[1]<=A)return[_[0],_[1]]}{var z=n+s-l,O=r-c+l;if(_=or(e,t,n,r,z,O,l+i),_.length>0&&_[0]>=z&&_[1]<=O)return[_[0],_[1]]}{var R=n+s-l,Y=r+c-l;if(_=or(e,t,n,r,R,Y,l+i),_.length>0&&_[0]>=R&&_[1]>=Y)return[_[0],_[1]]}{var V=n-s+l,F=r+c-l;if(_=or(e,t,n,r,V,F,l+i),_.length>0&&_[0]<=V&&_[1]>=F)return[_[0],_[1]]}return[]},Ac=function(e,t,n,r,a,o,i){var u=i,l=Math.min(n,a),s=Math.max(n,a),c=Math.min(r,o),d=Math.max(r,o);return l-u<=e&&e<=s+u&&c-u<=t&&t<=d+u},zc=function(e,t,n,r,a,o,i,u,l){var s={x1:Math.min(n,i,a)-l,x2:Math.max(n,i,a)+l,y1:Math.min(r,u,o)-l,y2:Math.max(r,u,o)+l};return!(es.x2||ts.y2)},Rc=function(e,t,n,r){n-=r;var a=t*t-4*e*n;if(a<0)return[];var o=Math.sqrt(a),i=2*e,u=(-t+o)/i,l=(-t-o)/i;return[u,l]},Lc=function(e,t,n,r,a){var o=1e-5;e===0&&(e=o),t/=e,n/=e,r/=e;var i,u,l,s,c,d,h,p;if(u=(3*n-t*t)/9,l=-(27*r)+t*(9*n-2*(t*t)),l/=54,i=u*u*u+l*l,a[1]=0,h=t/3,i>0){c=l+Math.sqrt(i),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=l-Math.sqrt(i),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+c+d,h+=(c+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+c)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,i===0){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*p,a[4]=a[2]=-(p+h);return}u=-u,s=u*u*u,s=Math.acos(l/Math.sqrt(s)),p=2*Math.sqrt(u),a[0]=-h+p*Math.cos(s/3),a[2]=-h+p*Math.cos((s+2*Math.PI)/3),a[4]=-h+p*Math.cos((s+4*Math.PI)/3)},Vc=function(e,t,n,r,a,o,i,u){var l=1*n*n-4*n*a+2*n*i+4*a*a-4*a*i+i*i+r*r-4*r*o+2*r*u+4*o*o-4*o*u+u*u,s=9*n*a-3*n*n-3*n*i-6*a*a+3*a*i+9*r*o-3*r*r-3*r*u-6*o*o+3*o*u,c=3*n*n-6*n*a+n*i-n*e+2*a*a+2*a*e-i*e+3*r*r-6*r*o+r*u-r*t+2*o*o+2*o*t-u*t,d=1*n*a-n*n+n*e-a*e+r*o-r*r+r*t-o*t,h=[];Lc(l,s,c,d,h);for(var p=1e-7,f=[],v=0;v<6;v+=2)Math.abs(h[v+1])=0&&h[v]<=1&&f.push(h[v]);f.push(1),f.push(0);for(var m=-1,g,y,b,w=0;w=0?bl?(e-a)*(e-a)+(t-o)*(t-o):s-d},dt=function(e,t,n){for(var r,a,o,i,u,l=0,s=0;s=e&&e>=o||r<=e&&e<=o)u=(e-r)/(o-r)*(i-a)+a,u>t&&l++;else continue;return l%2!==0},Lt=function(e,t,n,r,a,o,i,u,l){var s=new Array(n.length),c;u[0]!=null?(c=Math.atan(u[1]/u[0]),u[0]<0?c=c+Math.PI/2:c=-c-Math.PI/2):c=u;for(var d=Math.cos(-c),h=Math.sin(-c),p=0;p0){var v=la(s,-l);f=sa(v)}else f=s;return dt(e,t,f)},jc=function(e,t,n,r,a,o,i,u){for(var l=new Array(n.length*2),s=0;s=0&&v<=1&&g.push(v),m>=0&&m<=1&&g.push(m),g.length===0)return[];var y=g[0]*u[0]+e,b=g[0]*u[1]+t;if(g.length>1){if(g[0]==g[1])return[y,b];var w=g[1]*u[0]+e,S=g[1]*u[1]+t;return[y,b,w,S]}else return[y,b]},Ta=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},Qt=function(e,t,n,r,a,o,i,u,l){var s=e-a,c=n-e,d=i-a,h=t-o,p=r-t,f=u-o,v=d*h-f*s,m=c*h-p*s,g=f*c-d*p;if(g!==0){var y=v/g,b=m/g,w=.001,S=0-w,k=1+w;return S<=y&&y<=k&&S<=b&&b<=k?[e+y*c,t+y*p]:l?[e+y*c,t+y*p]:[]}else return v===0||m===0?Ta(e,n,i)===i?[i,u]:Ta(e,n,a)===a?[a,o]:Ta(a,i,n)===n?[n,r]:[]:[]},hr=function(e,t,n,r,a,o,i,u){var l=[],s,c=new Array(n.length),d=!0;o==null&&(d=!1);var h;if(d){for(var p=0;p0){var f=la(c,-u);h=sa(f)}else h=c}else h=n;for(var v,m,g,y,b=0;b2){for(var p=[s[0],s[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),v=1;vs&&(s=y)},get:function(g){return l[g]}},d=0;d0?_=B.edgesTo(D)[0]:_=D.edgesTo(B)[0];var N=r(_);D=D.id(),k[D]>k[P]+N&&(k[D]=k[P]+N,x.nodes.indexOf(D)<0?x.push(D):x.updateItem(D),S[D]=0,w[D]=[]),k[D]==k[P]+N&&(S[D]=S[D]+S[P],w[D].push(P))}else for(var A=0;A0;){for(var Y=b.pop(),V=0;V0&&i.push(n[u]);i.length!==0&&a.push(r.collection(i))}return a},rd=function(e,t){for(var n=0;n5&&arguments[5]!==void 0?arguments[5]:od,i=r,u,l,s=0;s=2?$n(e,t,n,0,Hi,sd):$n(e,t,n,0,Ui)},squaredEuclidean:function(e,t,n){return $n(e,t,n,0,Hi)},manhattan:function(e,t,n){return $n(e,t,n,0,Ui)},max:function(e,t,n){return $n(e,t,n,-1/0,ld)}};Ln["squared-euclidean"]=Ln.squaredEuclidean,Ln.squaredeuclidean=Ln.squaredEuclidean;function ba(e,t,n,r,a,o){var i;return ze(e)?i=e:i=Ln[e]||Ln.euclidean,t===0&&ze(e)?i(a,o):i(t,n,r,a,o)}var ud=et({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),bi=function(e){return ud(e)},ua=function(e,t,n,r,a){var o=a!=="kMedoids",i=o?function(c){return n[c]}:function(c){return r[c](n)},u=function(c){return r[c](t)},l=n,s=t;return ba(e,r.length,i,u,l,s)},Ba=function(e,t,n){for(var r=n.length,a=new Array(r),o=new Array(r),i=new Array(t),u=null,l=0;ln)return!1}return!0},hd=function(e,t,n){for(var r=0;ri&&(i=t[l][s],u=s);a[u].push(e[l])}for(var c=0;c=a.threshold||a.mode==="dendrogram"&&e.length===1)return!1;var p=t[o],f=t[r[o]],v;a.mode==="dendrogram"?v={left:p,right:f,key:p.key}:v={value:p.value.concat(f.value),key:p.key},e[p.index]=v,e.splice(f.index,1),t[p.key]=v;for(var m=0;mn[f.key][g.key]&&(u=n[f.key][g.key])):a.linkage==="max"?(u=n[p.key][g.key],n[p.key][g.key]0&&r.push(a);return r},Ji=function(e,t,n){for(var r=[],a=0;ai&&(o=l,i=t[a*e+l])}o>0&&r.push(o)}for(var s=0;sl&&(u=s,l=c)}n[a]=o[u]}return r=Ji(e,t,n),r},eo=function(e){for(var t=this.cy(),n=this.nodes(),r=Sd(e),a={},o=0;o=P?(M=P,P=B,D=_):B>M&&(M=B);for(var N=0;N0?1:0;k[C%r.minIterations*i+V]=F,Y+=F}if(Y>0&&(C>=r.minIterations-1||C==r.maxIterations-1)){for(var W=0,Q=0;Q1||S>1)&&(i=!0),c[y]=[],g.outgoers().forEach(function(x){x.isEdge()&&c[y].push(x.id())})}else d[y]=[void 0,g.target().id()]}):o.forEach(function(g){var y=g.id();if(g.isNode()){var b=g.degree(!0);b%2&&(u?l?i=!0:l=y:u=y),c[y]=[],g.connectedEdges().forEach(function(w){return c[y].push(w.id())})}else d[y]=[g.source().id(),g.target().id()]});var h={found:!1,trail:void 0};if(i)return h;if(l&&u)if(a){if(s&&l!=s)return h;s=l}else{if(s&&l!=s&&u!=s)return h;s||(s=l)}else s||(s=o[0].id());var p=function(g){for(var y=g,b=[g],w,S,k;c[y].length;)w=c[y].shift(),S=d[w][0],k=d[w][1],y!=k?(c[k]=c[k].filter(function(x){return x!=w}),y=k):!a&&y!=S&&(c[S]=c[S].filter(function(x){return x!=w}),y=S),b.unshift(w),b.unshift(y);return b},f=[],v=[];for(v=p(s);v.length!=1;)c[v[0]].length==0?(f.unshift(o.getElementById(v.shift())),f.unshift(o.getElementById(v.shift()))):v=p(v.shift()).concat(v);f.unshift(o.getElementById(v.shift()));for(var m in c)if(c[m].length)return h;return h.found=!0,h.trail=this.spawn(f,!0),h}},Ir=function(){var e=this,t={},n=0,r=0,a=[],o=[],i={},u=function(c,d){for(var h=o.length-1,p=[],f=e.spawn();o[h].x!=c||o[h].y!=d;)p.push(o.pop().edge),h--;p.push(o.pop().edge),p.forEach(function(v){var m=v.connectedNodes().intersection(e);f.merge(v),m.forEach(function(g){var y=g.id(),b=g.connectedEdges().intersection(e);f.merge(g),t[y].cutVertex?f.merge(b.filter(function(w){return w.isLoop()})):f.merge(b)})}),a.push(f)},l=function c(d,h,p){d===p&&(r+=1),t[h]={id:n,low:n++,cutVertex:!1};var f=e.getElementById(h).connectedEdges().intersection(e);if(f.size()===0)a.push(e.spawn(e.getElementById(h)));else{var v,m,g,y;f.forEach(function(b){v=b.source().id(),m=b.target().id(),g=v===h?m:v,g!==p&&(y=b.id(),i[y]||(i[y]=!0,o.push({x:h,y:g,edge:b})),g in t?t[h].low=Math.min(t[h].low,t[g].id):(c(d,g,h),t[h].low=Math.min(t[h].low,t[g].low),t[h].id<=t[g].low&&(t[h].cutVertex=!0,u(h,g))))})}};e.forEach(function(c){if(c.isNode()){var d=c.id();d in t||(r=0,l(d,d),t[d].cutVertex=r>1)}});var s=Object.keys(t).filter(function(c){return t[c].cutVertex}).map(function(c){return e.getElementById(c)});return{cut:e.spawn(s),components:a}},Nd={hopcroftTarjanBiconnected:Ir,htbc:Ir,htb:Ir,hopcroftTarjanBiconnectedComponents:Ir},Nr=function(){var e=this,t={},n=0,r=[],a=[],o=e.spawn(e),i=function u(l){a.push(l),t[l]={index:n,low:n++,explored:!1};var s=e.getElementById(l).connectedEdges().intersection(e);if(s.forEach(function(f){var v=f.target().id();v!==l&&(v in t||u(v),t[v].explored||(t[l].low=Math.min(t[l].low,t[v].low)))}),t[l].index===t[l].low){for(var c=e.spawn();;){var d=a.pop();if(c.merge(e.getElementById(d)),t[d].low=t[l].index,t[d].explored=!0,d===l)break}var h=c.edgesWith(c),p=c.merge(h);r.push(p),o=o.difference(p)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in t||i(l)}}),{cut:o,components:r}},Ad={tarjanStronglyConnected:Nr,tsc:Nr,tscc:Nr,tarjanStronglyConnectedComponents:Nr},Ms={};[ir,dc,hc,fc,vc,mc,wc,Uc,Mn,Tn,Wa,id,md,Cd,Bd,Id,Nd,Ad].forEach(function(e){ge(Ms,e)});var Ts=0,Bs=1,Os=2,qt=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=Ts,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};qt.prototype={fulfill:function(e){return to(this,Bs,"fulfillValue",e)},reject:function(e){return to(this,Os,"rejectReason",e)},then:function(e,t){var n=this,r=new qt;return n.onFulfilled.push(ro(e,r,"fulfill")),n.onRejected.push(ro(t,r,"reject")),Is(n),r.proxy}};var to=function(e,t,n,r){return e.state===Ts&&(e.state=t,e[n]=r,Is(e)),e},Is=function(e){e.state===Bs?no(e,"onFulfilled",e.fulfillValue):e.state===Os&&no(e,"onRejected",e.rejectReason)},no=function(e,t,n){if(e[t].length!==0){var r=e[t];e[t]=[];var a=function(){for(var o=0;o0}},clearQueue:function(){return function(){var e=this,t=e.length!==void 0,n=t?e:[e],r=this._private.cy||this;if(!r.styleEnabled())return this;for(var a=0;a-1}var qh=jh;function Yh(e,t){var n=this.__data__,r=wa(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Xh=Yh;function On(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1&&e%1==0&&e0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return t!=null&&t._private.classes.has(e)},toggleClass:function(e,t){Be(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=t===void 0,a=[],o=0,i=n.length;o0&&this.spawn(a).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(t==null)t=250;else if(t===0)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};Ur.className=Ur.classNames=Ur.classes;var Ee={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Xe,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ee.variable="(?:[\\w-.]|(?:\\\\"+Ee.metaChar+"))+",Ee.className="(?:[\\w-]|(?:\\\\"+Ee.metaChar+"))+",Ee.value=Ee.string+"|"+Ee.number,Ee.id=Ee.variable,(function(){var e,t,n;for(e=Ee.comparatorOp.split("|"),n=0;n=0)&&t!=="="&&(Ee.comparatorOp+="|\\!"+t)})();var Te=function(){return{checks:[]}},ie={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},Ha=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return iu(e.selector,t.selector)}),Up=(function(){for(var e={},t,n=0;n0&&s.edgeCount>0)return Pe("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(s.edgeCount>1)return Pe("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;s.edgeCount===1&&Pe("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},Qp=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(l){return l??""},t=function(l){return he(l)?'"'+l+'"':e(l)},n=function(l){return" "+l+" "},r=function(l,s){var c=l.type,d=l.value;switch(c){case ie.GROUP:{var h=e(d);return h.substring(0,h.length-1)}case ie.DATA_COMPARE:{var p=l.field,f=l.operator;return"["+p+n(e(f))+t(d)+"]"}case ie.DATA_BOOL:{var v=l.operator,m=l.field;return"["+e(v)+m+"]"}case ie.DATA_EXIST:{var g=l.field;return"["+g+"]"}case ie.META_COMPARE:{var y=l.operator,b=l.field;return"[["+b+n(e(y))+t(d)+"]]"}case ie.STATE:return d;case ie.ID:return"#"+d;case ie.CLASS:return"."+d;case ie.PARENT:case ie.CHILD:return a(l.parent,s)+n(">")+a(l.child,s);case ie.ANCESTOR:case ie.DESCENDANT:return a(l.ancestor,s)+" "+a(l.descendant,s);case ie.COMPOUND_SPLIT:{var w=a(l.left,s),S=a(l.subject,s),k=a(l.right,s);return w+(w.length>0?" ":"")+S+k}case ie.TRUE:return""}},a=function(l,s){return l.checks.reduce(function(c,d,h){return c+(s===l&&h===0?"$":"")+r(d,s)},"")},o="",i=0;i1&&i=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),s=!0),(a||i||s)&&(u=!a&&!o?"":""+e,l=""+n),s&&(e=u=u.toLowerCase(),n=l=l.toLowerCase()),t){case"*=":r=u.indexOf(l)>=0;break;case"$=":r=u.indexOf(l,u.length-l.length)>=0;break;case"^=":r=u.indexOf(l)===0;break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var c=a.shift();t(c),o.add(c.id()),u&&r(a,o,c)}return e}function js(e,t,n){if(n.isParent())for(var r=n._private.children,a=0;a1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,js)};function qs(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}qn.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,qs)};function sf(e,t,n){qs(e,t,n),js(e,t,n)}qn.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return ki(this,e,t,sf)},qn.ancestors=qn.parents;var Zn,Ys;Zn=Ys={data:_e.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:_e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:_e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:_e.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:_e.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},Zn.attr=Zn.data,Zn.removeAttr=Zn.removeData;var lf=Ys,ca={};function Na(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,a=n[0],o=a._private.edges,i=0;it}),minIndegree:xn("indegree",function(e,t){return et}),minOutdegree:xn("outdegree",function(e,t){return et})}),ge(ca,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,d=c;c&&(s=s[0]);var h=d?s.position():{x:0,y:0};t!==void 0?l.position(e,t+h[e]):a!==void 0&&l.position({x:a.x+h.x,y:a.y+h.y})}else{var p=n.position(),f=i?n.parent():null,v=f&&f.length>0,m=v;v&&(f=f[0]);var g=m?f.position():{x:0,y:0};return a={x:p.x-g.x,y:p.y-g.y},e===void 0?a:a[e]}else if(!o)return;return this}},Ct.modelPosition=Ct.point=Ct.position,Ct.modelPositions=Ct.points=Ct.positions,Ct.renderedPoint=Ct.renderedPosition,Ct.relativePoint=Ct.relativePosition;var uf=Xs,Nn,Jt;Nn=Jt={},Jt.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),a=n.pan(),o=t.x1*r+a.x,i=t.x2*r+a.x,u=t.y1*r+a.y,l=t.y2*r+a.y;return{x1:o,x2:i,y1:u,y2:l,w:i-o,h:l-u}},Jt.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)},Jt.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(i){if(!i.isParent())return;var u=i._private,l=i.children(),s=i.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:i.pstyle("min-width").pfValue,left:i.pstyle("min-width-bias-left"),right:i.pstyle("min-width-bias-right")},height:{val:i.pstyle("min-height").pfValue,top:i.pstyle("min-height-bias-top"),bottom:i.pstyle("min-height-bias-bottom")}},d=l.boundingBox({includeLabels:s,includeOverlays:!1,useCache:!1}),h=u.position;(d.w===0||d.h===0)&&(d={w:i.pstyle("width").pfValue,h:i.pstyle("height").pfValue},d.x1=h.x-d.w/2,d.x2=h.x+d.w/2,d.y1=h.y-d.h/2,d.y2=h.y+d.h/2);function p(T,P,M){var D=0,B=0,_=P+M;return T>0&&_>0&&(D=P/_*T,B=M/_*T),{biasDiff:D,biasComplementDiff:B}}function f(T,P,M,D){if(M.units==="%")switch(D){case"width":return T>0?M.pfValue*T:0;case"height":return P>0?M.pfValue*P:0;case"average":return T>0&&P>0?M.pfValue*(T+P)/2:0;case"min":return T>0&&P>0?T>P?M.pfValue*P:M.pfValue*T:0;case"max":return T>0&&P>0?T>P?M.pfValue*T:M.pfValue*P:0;default:return 0}else return M.units==="px"?M.pfValue:0}var v=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(m=m*100/c.width.val);var g=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(g=g*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var b=p(c.width.val-d.w,v,m),w=b.biasDiff,S=b.biasComplementDiff,k=p(c.height.val-d.h,g,y),x=k.biasDiff,C=k.biasComplementDiff;u.autoPadding=f(d.w,d.h,i.pstyle("padding"),i.pstyle("padding-relative-to").value),u.autoWidth=Math.max(d.w,c.width.val),h.x=(-w+d.x1+d.x2+S)/2,u.autoHeight=Math.max(d.h,c.height.val),h.y=(-x+d.y1+d.y2+C)/2}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},un=function(e,t){return t==null?e:_t(e,t.x1,t.y1,t.x2,t.y2)},Qn=function(e,t,n){return St(e,t,n)},Ar=function(e,t,n){if(!t.cy().headless()){var r=t._private,a=r.rstyle,o=a.arrowWidth/2,i=t.pstyle(n+"-arrow-shape").value,u,l;if(i!=="none"){n==="source"?(u=a.srcX,l=a.srcY):n==="target"?(u=a.tgtX,l=a.tgtY):(u=a.midX,l=a.midY);var s=r.arrowBounds=r.arrowBounds||{},c=s[n]=s[n]||{};c.x1=u-o,c.y1=l-o,c.x2=u+o,c.y2=l+o,c.w=c.x2-c.x1,c.h=c.y2-c.y1,Xr(c,1),_t(e,c.x1,c.y1,c.x2,c.y2)}}},Aa=function(e,t,n){if(!t.cy().headless()){var r;n?r=n+"-":r="";var a=t._private,o=a.rstyle,i=t.pstyle(r+"label").strValue;if(i){var u=t.pstyle("text-halign"),l=t.pstyle("text-valign"),s=Qn(o,"labelWidth",n),c=Qn(o,"labelHeight",n),d=Qn(o,"labelX",n),h=Qn(o,"labelY",n),p=t.pstyle(r+"text-margin-x").pfValue,f=t.pstyle(r+"text-margin-y").pfValue,v=t.isEdge(),m=t.pstyle(r+"text-rotation"),g=t.pstyle("text-outline-width").pfValue,y=t.pstyle("text-border-width").pfValue,b=y/2,w=t.pstyle("text-background-padding").pfValue,S=2,k=c,x=s,C=x/2,T=k/2,P,M,D,B;if(v)P=d-C,M=d+C,D=h-T,B=h+T;else{switch(u.value){case"left":P=d-x,M=d;break;case"center":P=d-C,M=d+C;break;case"right":P=d,M=d+x;break}switch(l.value){case"top":D=h-k,B=h;break;case"center":D=h-T,B=h+T;break;case"bottom":D=h,B=h+k;break}}P+=p-Math.max(g,b)-w-S,M+=p+Math.max(g,b)+w+S,D+=f-Math.max(g,b)-w-S,B+=f+Math.max(g,b)+w+S;var _=n||"main",N=a.labelBounds,A=N[_]=N[_]||{};A.x1=P,A.y1=D,A.x2=M,A.y2=B,A.w=M-P,A.h=B-D;var z=v&&m.strValue==="autorotate",O=m.pfValue!=null&&m.pfValue!==0;if(z||O){var R=z?Qn(a.rstyle,"labelAngle",n):m.pfValue,Y=Math.cos(R),V=Math.sin(R),F=(P+M)/2,W=(D+B)/2;if(!v){switch(u.value){case"left":F=M;break;case"right":F=P;break}switch(l.value){case"top":W=B;break;case"bottom":W=D;break}}var Q=function(te,ce){return te=te-F,ce=ce-W,{x:te*Y-ce*V+F,y:te*V+ce*Y+W}},re=Q(P,D),K=Q(P,B),$=Q(M,D),I=Q(M,B);P=Math.min(re.x,K.x,$.x,I.x),M=Math.max(re.x,K.x,$.x,I.x),D=Math.min(re.y,K.y,$.y,I.y),B=Math.max(re.y,K.y,$.y,I.y)}var H=_+"Rot",U=N[H]=N[H]||{};U.x1=P,U.y1=D,U.x2=M,U.y2=B,U.w=M-P,U.h=B-D,_t(e,P,D,M,B),_t(a.labelBounds.all,P,D,M,B)}return e}},cf=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var a=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,i=r+a,u=(e.w+i*2)/e.w,l=(e.h+i*2)/e.h,s=0,c=0;["diamond","pentagon","round-triangle"].includes(o)?(u=(e.w+i*2.4)/e.w,c=-i/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?u=(e.w+i*2.4)/e.w:o==="star"?(u=(e.w+i*2.8)/e.w,l=(e.h+i*2.6)/e.h,c=-i/3.8):o==="triangle"?(u=(e.w+i*2.8)/e.w,l=(e.h+i*2.4)/e.h,c=-i/1.4):o==="vee"&&(u=(e.w+i*4.4)/e.w,l=(e.h+i*3.8)/e.h,c=-i*.5);var d=e.h*l-e.h,h=e.w*u-e.w;if(Wr(e,[Math.ceil(d/2),Math.ceil(h/2)]),s!=0||c!==0){var p=Oc(e,s,c);ws(e,p)}}}},df=function(e,t){var n=e._private.cy,r=n.styleEnabled(),a=n.headless(),o=ht(),i=e._private,u=e.isNode(),l=e.isEdge(),s,c,d,h,p,f,v=i.rstyle,m=u&&r?e.pstyle("bounds-expansion").pfValue:[0],g=function(Z){return Z.pstyle("display").value!=="none"},y=!r||g(e)&&(!l||g(e.source())&&g(e.target()));if(y){var b=0,w=0;r&&t.includeOverlays&&(b=e.pstyle("overlay-opacity").value,b!==0&&(w=e.pstyle("overlay-padding").value));var S=0,k=0;r&&t.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(k=e.pstyle("underlay-padding").value));var x=Math.max(w,k),C=0,T=0;if(r&&(C=e.pstyle("width").pfValue,T=C/2),u&&t.includeNodes){var P=e.position();p=P.x,f=P.y;var M=e.outerWidth(),D=M/2,B=e.outerHeight(),_=B/2;s=p-D,c=p+D,d=f-_,h=f+_,_t(o,s,d,c,h),r&&t.includeOutlines&&cf(o,e)}else if(l&&t.includeEdges)if(r&&!a){var N=e.pstyle("curve-style").strValue;if(s=Math.min(v.srcX,v.midX,v.tgtX),c=Math.max(v.srcX,v.midX,v.tgtX),d=Math.min(v.srcY,v.midY,v.tgtY),h=Math.max(v.srcY,v.midY,v.tgtY),s-=T,c+=T,d-=T,h+=T,_t(o,s,d,c,h),N==="haystack"){var A=v.haystackPts;if(A&&A.length===2){if(s=A[0].x,d=A[0].y,c=A[1].x,h=A[1].y,s>c){var z=s;s=c,c=z}if(d>h){var O=d;d=h,h=O}_t(o,s-T,d-T,c+T,h+T)}}else if(N==="bezier"||N==="unbundled-bezier"||N.endsWith("segments")||N.endsWith("taxi")){var R;switch(N){case"bezier":case"unbundled-bezier":R=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":R=v.linePts;break}if(R!=null)for(var Y=0;Yc){var K=s;s=c,c=K}if(d>h){var $=d;d=h,h=$}s-=T,c+=T,d-=T,h+=T,_t(o,s,d,c,h)}if(r&&t.includeEdges&&l&&(Ar(o,e,"mid-source"),Ar(o,e,"mid-target"),Ar(o,e,"source"),Ar(o,e,"target")),r){var I=e.pstyle("ghost").value==="yes";if(I){var H=e.pstyle("ghost-offset-x").pfValue,U=e.pstyle("ghost-offset-y").pfValue;_t(o,o.x1+H,o.y1+U,o.x2+H,o.y2+U)}}var te=i.bodyBounds=i.bodyBounds||{};ji(te,o),Wr(te,m),Xr(te,1),r&&(s=o.x1,c=o.x2,d=o.y1,h=o.y2,_t(o,s-x,d-x,c+x,h+x));var ce=i.overlayBounds=i.overlayBounds||{};ji(ce,o),Wr(ce,m),Xr(ce,1);var me=i.labelBounds=i.labelBounds||{};me.all!=null?Bc(me.all):me.all=ht(),r&&t.includeLabels&&(t.includeMainLabels&&Aa(o,e,null),l&&(t.includeSourceLabels&&Aa(o,e,"source"),t.includeTargetLabels&&Aa(o,e,"target")))}return o.x1=yt(o.x1),o.y1=yt(o.y1),o.x2=yt(o.x2),o.y2=yt(o.y2),o.w=yt(o.x2-o.x1),o.h=yt(o.y2-o.y1),o.w>0&&o.h>0&&y&&(Wr(o,m),Xr(o,1)),o},Us=function(e){var t=0,n=function(a){return(a?1:0)<0&&arguments[0]!==void 0?arguments[0]:Sf,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;u--)i(u);return this},Gt.removeAllListeners=function(){return this.removeListener("*")},Gt.emit=Gt.trigger=function(e,t,n){var r=this.listeners,a=r.length;return this.emitting++,Be(t)||(t=[t]),_f(this,function(o,i){n!=null&&(r=[{event:i.event,type:i.type,namespace:i.namespace,callback:n}],a=r.length);for(var u=function(s){var c=r[s];if(c.type===i.type&&(!c.namespace||c.namespace===i.namespace||c.namespace===Df)&&o.eventMatches(o.context,c,i)){var d=[i];t!=null&&ic(d,t),o.beforeEmit(o.context,c,i),c.conf&&c.conf.one&&(o.listeners=o.listeners.filter(function(f){return f!==c}));var h=o.callbackContext(o.context,c,i),p=c.callback.apply(h,d);o.afterEmit(o.context,c,i),p===!1&&(i.stopPropagation(),i.preventDefault())}},l=0;l1&&!o){var i=this.length-1,u=this[i],l=u._private.data.id;this[i]=void 0,this[e]=u,a.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map,a=r.get(n);if(!a)return this;var o=a.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&he(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){var n=this[t];e(n)&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,a=0;an&&(n=u,r=i)}return{value:n,ele:r}},min:function(e,t){for(var n=1/0,r,a=this,o=0;o=0&&a"u"?"undefined":We(Symbol))!=e&&We(Symbol.iterator)!=e;t&&(da[Symbol.iterator]=function(){var n=this,r={value:void 0,done:!1},a=0,o=this.length;return es({next:function(){return a1&&arguments[1]!==void 0?arguments[1]:!0,n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return a??(t?r.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return n.pfValue!==void 0?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,a=n.style();if(ke(e)){var o=e;a.applyBypass(this,o,r),this.emitAndNotify("style")}else if(he(e))if(t===void 0){var i=this[0];return i?a.getStylePropertyValue(i,e):void 0}else a.applyBypass(this,e,t,r),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?a.getRawStyle(u):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),a=this;if(e===void 0)for(var o=0;o0&&t.push(c[0]),t.push(u[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),it.neighbourhood=it.neighborhood,it.closedNeighbourhood=it.closedNeighborhood,it.openNeighbourhood=it.openNeighborhood,ge(it,{source:mt(function(e){var t=this[0],n;return t&&(n=t._private.source||t.cy().collection()),n&&e?n.filter(e):n},"source"),target:mt(function(e){var t=this[0],n;return t&&(n=t._private.target||t.cy().collection()),n&&e?n.filter(e):n},"target"),sources:Co({attr:"source"}),targets:Co({attr:"target"})});function Co(e){return function(t){for(var n=[],r=0;r0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),it.componentsOf=it.components;var Je=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Le("A collection must have a reference to the core");return}var a=new zt,o=!1;if(!t)t=[];else if(t.length>0&&ke(t[0])&&!Cr(t[0])){o=!0;for(var i=[],u=new Xn,l=0,s=t.length;l0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),a=r._private,o=[],i=[],u,l=0,s=n.length;l0){for(var R=u.length===n.length?n:new Je(r,u),Y=0;Y0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],a={},o=n._private.cy;function i(_){for(var N=_._private.edges,A=0;A0&&(e?M.emitAndNotify("remove"):t&&M.emit("remove"));for(var D=0;D0?D=_:M=_;while(Math.abs(B)>i&&++N=o?y(P,N):A===0?N:w(P,M,M+s)}var k=!1;function x(){k=!0,(e!==t||n!==r)&&b()}var C=function(P){return k||x(),e===t&&n===r?P:P===0?0:P===1?1:m(S(P),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var T="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return T},C}var Lf=(function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,a,o){var i={x:r.x+o.dx*a,v:r.v+o.dv*a,tension:r.tension,friction:r.friction};return{dx:i.v,dv:e(i)}}function n(r,a){var o={dx:r.v,dv:e(r)},i=t(r,a*.5,o),u=t(r,a*.5,i),l=t(r,a,u),s=1/6*(o.dx+2*(i.dx+u.dx)+l.dx),c=1/6*(o.dv+2*(i.dv+u.dv)+l.dv);return r.x=r.x+s*a,r.v=r.v+c*a,r}return function r(a,o,i){var u={x:-1,v:0,tension:null,friction:null},l=[0],s=0,c=1/1e4,d=16/1e3,h,p,f;for(a=parseFloat(a)||500,o=parseFloat(o)||20,i=i||null,u.tension=a,u.friction=o,h=i!==null,h?(s=r(a,o),p=s/i*d):p=d;f=n(f||u,p),l.push(1+f.x),s+=16,Math.abs(f.x)>c&&Math.abs(f.v)>c;);return h?function(v){return l[v*(l.length-1)|0]}:s}})(),Ie=function(e,t,n,r){var a=Rf(e,t,n,r);return function(o,i,u){return o+(i-o)*a(u)}},Gr={linear:function(e,t,n){return e+(t-e)*n},ease:Ie(.25,.1,.25,1),"ease-in":Ie(.42,0,1,1),"ease-out":Ie(0,0,.58,1),"ease-in-out":Ie(.42,0,.58,1),"ease-in-sine":Ie(.47,0,.745,.715),"ease-out-sine":Ie(.39,.575,.565,1),"ease-in-out-sine":Ie(.445,.05,.55,.95),"ease-in-quad":Ie(.55,.085,.68,.53),"ease-out-quad":Ie(.25,.46,.45,.94),"ease-in-out-quad":Ie(.455,.03,.515,.955),"ease-in-cubic":Ie(.55,.055,.675,.19),"ease-out-cubic":Ie(.215,.61,.355,1),"ease-in-out-cubic":Ie(.645,.045,.355,1),"ease-in-quart":Ie(.895,.03,.685,.22),"ease-out-quart":Ie(.165,.84,.44,1),"ease-in-out-quart":Ie(.77,0,.175,1),"ease-in-quint":Ie(.755,.05,.855,.06),"ease-out-quint":Ie(.23,1,.32,1),"ease-in-out-quint":Ie(.86,0,.07,1),"ease-in-expo":Ie(.95,.05,.795,.035),"ease-out-expo":Ie(.19,1,.22,1),"ease-in-out-expo":Ie(1,0,0,1),"ease-in-circ":Ie(.6,.04,.98,.335),"ease-out-circ":Ie(.075,.82,.165,1),"ease-in-out-circ":Ie(.785,.135,.15,.86),spring:function(e,t,n){if(n===0)return Gr.linear;var r=Lf(e,t,n);return function(a,o,i){return a+(o-a)*r(i)}},"cubic-bezier":Ie};function _o(e,t,n,r,a){if(r===1||t===n)return n;var o=a(t,n,r);return e==null||((e.roundValue||e.color)&&(o=Math.round(o)),e.min!==void 0&&(o=Math.max(o,e.min)),e.max!==void 0&&(o=Math.min(o,e.max))),o}function Po(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function En(e,t,n,r,a){var o=a!=null?a.type:null;n<0?n=0:n>1&&(n=1);var i=Po(e,a),u=Po(t,a);if(ne(i)&&ne(u))return _o(o,i,u,n,r);if(Be(i)&&Be(u)){for(var l=[],s=0;s0?(p==="spring"&&f.push(i.duration),i.easingImpl=Gr[p].apply(null,f)):i.easingImpl=Gr[p]}var v=i.easingImpl,m;if(i.duration===0?m=1:m=(n-l)/i.duration,i.applying&&(m=i.progress),m<0?m=0:m>1&&(m=1),i.delay==null){var g=i.startPosition,y=i.position;if(y&&a&&!e.locked()){var b={};er(g.x,y.x)&&(b.x=En(g.x,y.x,m,v)),er(g.y,y.y)&&(b.y=En(g.y,y.y,m,v)),e.position(b)}var w=i.startPan,S=i.pan,k=o.pan,x=S!=null&&r;x&&(er(w.x,S.x)&&(k.x=En(w.x,S.x,m,v)),er(w.y,S.y)&&(k.y=En(w.y,S.y,m,v)),e.emit("pan"));var C=i.startZoom,T=i.zoom,P=T!=null&&r;P&&(er(C,T)&&(o.zoom=mr(o.minZoom,En(C,T,m,v),o.maxZoom)),e.emit("zoom")),(x||P)&&e.emit("viewport");var M=i.style;if(M&&M.length>0&&a){for(var D=0;D=0;k--){var x=S[k];x()}S.splice(0,S.length)},y=p.length-1;y>=0;y--){var b=p[y],w=b._private;if(w.stopped){p.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Ff(c,b,e),Vf(c,b,e,d),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(e),b.completed()&&(p.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),v=!0)}return!d&&p.length===0&&f.length===0&&r.push(c),v}for(var o=!1,i=0;i0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var jf={animate:_e.animate(),animation:_e.animation(),animated:_e.animated(),clearQueue:_e.clearQueue(),delay:_e.delay(),delayAnimation:_e.delayAnimation(),stop:_e.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function t(){e._private.animationsRunning&&ia(function(r){Mo(r,e),t()})}var n=e.renderer();n&&n.beforeRender?n.beforeRender(function(r,a){Mo(a,e)},n.beforeRenderPriorities.animations):t()}},qf={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return r!=null?e!==n.target&&Cr(n.target)&&r.matches(n.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return t.qualifier!=null?n.target:e}},Lr=function(e){return he(e)?new nn(e):e},tl={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ka(qf,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Lr(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Lr(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Lr(t),n),this},once:function(e,t,n){return this.emitter().one(e,Lr(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};_e.eventAliasesOn(tl);var Ka={png:function(e){var t=this._private.renderer;return e=e||{},t.png(e)},jpg:function(e){var t=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",t.jpg(e)}};Ka.jpeg=Ka.jpg;var Kr={layout:function(e){var t=this;if(e==null){Le("Layout options must be specified to make a layout");return}if(e.name==null){Le("A `name` must be specified to make a layout");return}var n=e.name,r=t.extension("layout",n);if(r==null){Le("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var a;he(e.eles)?a=t.$(e.eles):a=e.eles!=null?e.eles:t.$();var o=new r(ge({},e,{cy:t,eles:a}));return o}};Kr.createLayout=Kr.makeLayout=Kr.layout;var Yf={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();t!=null&&r.merge(t);return}if(n.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(n){var r=n._private;r.rscratch={},r.rstyle={},r.animation.current=[],r.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};$a.invalidateDimensions=$a.resize;var $r={collection:function(e,t){return he(e)?this.$(e):gt(e)?e.collection():Be(e)?(t||(t={}),new Je(this,e,t.unique,t.removed)):new Je(this)},nodes:function(e){var t=this.$(function(n){return n.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(n){return n.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};$r.elements=$r.filter=$r.$;var rt={},tr="t",Wf="f";rt.apply=function(e){for(var t=this,n=t._private,r=n.cy,a=r.collection(),o=0;o0;if(h||d&&p){var f=void 0;h&&p||h?f=s.properties:p&&(f=s.mappedProperties);for(var v=0;v1&&(w=1),u.color){var k=r.valueMin[0],x=r.valueMax[0],C=r.valueMin[1],T=r.valueMax[1],P=r.valueMin[2],M=r.valueMax[2],D=r.valueMin[3]==null?1:r.valueMin[3],B=r.valueMax[3]==null?1:r.valueMax[3],_=[Math.round(k+(x-k)*w),Math.round(C+(T-C)*w),Math.round(P+(M-P)*w),Math.round(D+(B-D)*w)];o={bypass:r.bypass,name:r.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else if(u.number){var N=r.valueMin+(r.valueMax-r.valueMin)*w;o=this.parse(r.name,N,r.bypass,h)}else return!1;if(!o)return v(),!1;o.mapping=r,r=o;break}case i.data:{for(var A=r.field.split("."),z=d.data,O=0;O0&&o>0){for(var u={},l=!1,s=0;s0?e.delayAnimation(i).play().promise().then(b):b()}).then(function(){return e.animation({style:u,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),r.transitioning=!1)},rt.checkTrigger=function(e,t,n,r,a,o){var i=this.properties[t],u=a(i);u!=null&&u(n,r)&&o(i)},rt.checkZOrderTrigger=function(e,t,n,r){var a=this;this.checkTrigger(e,t,n,r,function(o){return o.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},rt.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(a){return a.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&t==="curve-style"&&(n==="bezier"||r==="bezier")&&e.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&t==="display"&&(n==="none"||r==="none")&&e.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})},rt.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var lr={};lr.applyBypass=function(e,t,n,r){var a=this,o=[],i=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var u=0;ua.length?r=r.substr(a.length):r=""}function l(){o.length>i.length?o=o.substr(i.length):o=""}for(;;){var s=r.match(/^\s*$/);if(s)break;var c=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){Pe("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}a=c[0];var d=c[1];if(d!=="core"){var h=new nn(d);if(h.invalid){Pe("Skipping parsing of block: Invalid selector found in string stylesheet: "+d),u();continue}}var p=c[2],f=!1;o=p;for(var v=[];;){var m=o.match(/^\s*$/);if(m)break;var g=o.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Pe("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+p),f=!0;break}i=g[0];var y=g[1],b=g[2],w=t.properties[y];if(!w){Pe("Skipping property: Invalid property name in: "+i),l();continue}var S=n.parse(y,b);if(!S){Pe("Skipping property: Invalid property definition in: "+i),l();continue}v.push({name:y,val:b}),l()}if(f){u();break}n.selector(d);for(var k=0;k=7&&t[0]==="d"&&(c=new RegExp(u.data.regex).exec(t))){if(n)return!1;var h=u.data;return{name:e,value:c,strValue:""+t,mapped:h,field:c[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(d=new RegExp(u.mapData.regex).exec(t))){if(n||s.multiple)return!1;var p=u.mapData;if(!(s.color||s.number))return!1;var f=this.parse(e,d[4]);if(!f||f.mapped)return!1;var v=this.parse(e,d[5]);if(!v||v.mapped)return!1;if(f.pfValue===v.pfValue||f.strValue===v.strValue)return Pe("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+f.strValue+"`"),this.parse(e,f.strValue);if(s.color){var m=f.value,g=v.value,y=m[0]===g[0]&&m[1]===g[1]&&m[2]===g[2]&&(m[3]===g[3]||(m[3]==null||m[3]===1)&&(g[3]==null||g[3]===1));if(y)return!1}return{name:e,value:d,strValue:""+t,mapped:p,field:d[1],fieldMin:parseFloat(d[2]),fieldMax:parseFloat(d[3]),valueMin:f.value,valueMax:v.value,bypass:n}}}if(s.multiple&&r!=="multiple"){var b;if(l?b=t.split(/\s+/):Be(t)?b=t:b=[t],s.evenMultiple&&b.length%2!==0)return null;for(var w=[],S=[],k=[],x="",C=!1,T=0;T0?" ":"")+P.strValue}return s.validate&&!s.validate(w,S)?null:s.singleEnum&&C?w.length===1&&he(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:k,strValue:x,bypass:n,units:S}}var M=function(){for(var I=0;Is.max||s.strictMax&&t===s.max))return null;var A={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:n};return s.unitless||D!=="px"&&D!=="em"?A.pfValue=t:A.pfValue=D==="px"||!D?t:this.getEmSizeInPixels()*t,(D==="ms"||D==="s")&&(A.pfValue=D==="ms"?t:1e3*t),(D==="deg"||D==="rad")&&(A.pfValue=D==="rad"?t:_c(t)),D==="%"&&(A.pfValue=t/100),A}else if(s.propList){var z=[],O=""+t;if(O!=="none"){for(var R=O.split(/\s*,\s*|\s+/),Y=0;Y0&&i>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){u=Math.min((o-2*t)/n.w,(i-2*t)/n.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t=this._private,n=t.pan,r=t.zoom,a,o,i=!1;if(t.zoomingEnabled||(i=!0),ne(e)?o=e:ke(e)&&(o=e.level,e.position!=null?a=ma(e.position,r,n):e.renderedPosition!=null&&(a=e.renderedPosition),a!=null&&!t.panningEnabled&&(i=!0)),o=o>t.maxZoom?t.maxZoom:o,o=ot.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=u,a.push("zoom"))}if(r&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ne(l.x)&&(t.pan.x=l.x,i=!1),ne(l.y)&&(t.pan.y=l.y,i=!1),i||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(he(e)){var n=e;e=this.mutableElements().filter(n)}else gt(e)||(e=this.mutableElements());if(e.length!==0){var r=e.boundingBox(),a=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var i={x:(a-t*(r.x1+r.x2))/2,y:(o-t*(r.y1+r.y2))/2};return i}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container,n=this;return e.sizeCache=e.sizeCache||(t?(function(){var r=n.window().getComputedStyle(t),a=function(o){return parseFloat(r.getPropertyValue(o))};return{width:t.clientWidth-a("padding-left")-a("padding-right"),height:t.clientHeight-a("padding-top")-a("padding-bottom")}})():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};cn.centre=cn.center,cn.autolockNodes=cn.autolock,cn.autoungrabifyNodes=cn.autoungrabify;var ur={data:_e.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:_e.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:_e.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:_e.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ur.attr=ur.data,ur.removeAttr=ur.removeData;var wr=function(e){var t=this;e=ge({},e);var n=e.container;n&&!aa(n)&&aa(n[0])&&(n=n[0]);var r=n?n._cyreg:null;r=r||{},r&&r.cy&&(r.cy.destroy(),r={});var a=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var o=Ye!==void 0&&n!==void 0&&!e.headless,i=e;i.layout=ge({name:o?"grid":"null"},i.layout),i.renderer=ge({name:o?"canvas":"null"},i.renderer);var u=function(h,p,f){return p!==void 0?p:f!==void 0?f:h},l=this._private={container:n,ready:!1,options:i,elements:new Je(this),listeners:[],aniEles:new Je(this),data:i.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,i.zoomingEnabled),userZoomingEnabled:u(!0,i.userZoomingEnabled),panningEnabled:u(!0,i.panningEnabled),userPanningEnabled:u(!0,i.userPanningEnabled),boxSelectionEnabled:u(!0,i.boxSelectionEnabled),autolock:u(!1,i.autolock,i.autolockNodes),autoungrabify:u(!1,i.autoungrabify,i.autoungrabifyNodes),autounselectify:u(!1,i.autounselectify),styleEnabled:i.styleEnabled===void 0?o:i.styleEnabled,zoom:ne(i.zoom)?i.zoom:1,pan:{x:ke(i.pan)&&ne(i.pan.x)?i.pan.x:0,y:ke(i.pan)&&ne(i.pan.y)?i.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,i.multiClickDebounceTime)};this.createEmitter(),this.selectionType(i.selectionType),this.zoomRange({min:i.minZoom,max:i.maxZoom});var s=function(h,p){var f=h.some(Zl);if(f)return Wn.all(h).then(p);p(h)};l.styleEnabled&&t.setStyle([]);var c=ge({},i,i.renderer);t.initRenderer(c);var d=function(h,p,f){t.notifications(!1);var v=t.mutableElements();v.length>0&&v.remove(),h!=null&&(ke(h)||Be(h))&&t.add(h),t.one("layoutready",function(g){t.notifications(!0),t.emit(g),t.one("load",p),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",f),t.emit("done")});var m=ge({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};s([i.style,i.elements],function(h){var p=h[0],f=h[1];l.styleEnabled&&t.style().append(p),d(f,function(){t.startAnimationLoop(),l.ready=!0,ze(i.ready)&&t.on("ready",i.ready);for(var v=0;v0,l=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s;if(gt(t.roots))s=t.roots;else if(Be(t.roots)){for(var c=[],d=0;d0;){var N=_(),A=P(N,D);if(A)N.outgoers().filter(function(Z){return Z.isNode()&&r.has(Z)}).forEach(B);else if(A===null){Pe("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}T();var z=0;if(t.avoidOverlap)for(var O=0;O0&&g[0].length<=3?Me/2:0),Ce=2*Math.PI/g[ae].length*de;return ae===0&&g[0].length===1&&(we=1),{x:te.x+we*Math.cos(Ce),y:te.y+we*Math.sin(Ce)}}else{var E={x:te.x+(de+1-(ve+1)/2)*be,y:(ae+1)*xe};return E}};return r.nodes().layoutPositions(this,t,me),this};var $f={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function rl(e){this.options=ge({},$f,e)}rl.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,o=r.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var i=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u={x:i.x1+i.w/2,y:i.y1+i.h/2},l=t.sweep===void 0?2*Math.PI-2*Math.PI/o.length:t.sweep,s=l/Math.max(1,o.length-1),c,d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var g=Math.cos(s)-Math.cos(0),y=Math.sin(s)-Math.sin(0),b=Math.sqrt(d*d/(g*g+y*y));c=Math.max(b,c)}var w=function(S,k){var x=t.startAngle+k*s*(a?1:-1),C=c*Math.cos(x),T=c*Math.sin(x),P={x:u.x+C,y:u.y+T};return P};return r.nodes().layoutPositions(this,t,w),this};var Zf={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function al(e){this.options=ge({},Zf,e)}al.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,a=t.eles,o=a.nodes().not(":parent"),i=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u={x:i.x1+i.w/2,y:i.y1+i.h/2},l=[],s=0,c=0;c0){var S=Math.abs(y[0].value-w.value);S>=m&&(y=[],g.push(y))}y.push(w)}var k=s+t.minNodeSpacing;if(!t.avoidOverlap){var x=g.length>0&&g[0].length>1,C=Math.min(i.w,i.h)/2-k,T=C/(g.length+x?1:0);k=Math.min(k,T)}for(var P=0,M=0;M1&&t.avoidOverlap){var N=Math.cos(_)-Math.cos(0),A=Math.sin(_)-Math.sin(0),z=Math.sqrt(k*k/(N*N+A*A));P=Math.max(z,P)}D.r=P,P+=k}if(t.equidistant){for(var O=0,R=0,Y=0;Y=e.numIter||(ig(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature=e.animationThreshold&&o(),ia(d)}};c()}else{for(;s;)s=i(l),l++;Oo(r,e),u()}return this},Jr.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Jr.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Jf=function(e,t,n){for(var r=n.eles.edges(),a=n.eles.nodes(),o=ht(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),i={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},u=n.eles.components(),l={},s=0;s0){i.graphSet.push(x);for(var s=0;sr.count?0:r.graph},tg=function e(t,n,r,a){var o=a.graphSet[r];if(-10)var m=r.nodeOverlap*s,v=Math.sqrt(i*i+u*u),g=m*i/v,y=m*u/v;else var c=pa(e,i,u),d=pa(t,-1*i,-1*u),h=d.x-c.x,p=d.y-c.y,f=h*h+p*p,v=Math.sqrt(f),m=(e.nodeRepulsion+t.nodeRepulsion)/f,g=m*h/v,y=m*p/v;e.isLocked||(e.offsetX-=g,e.offsetY-=y),t.isLocked||(t.offsetX+=g,t.offsetY+=y)}},lg=function(e,t,n,r){if(n>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(r>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return a>=0&&o>=0?Math.sqrt(a*a+o*o):0},pa=function(e,t,n){var r=e.positionX,a=e.positionY,o=e.height||1,i=e.width||1,u=n/t,l=o/i,s={};return t===0&&0n?(s.x=r,s.y=a+o/2,s):0t&&-1*l<=u&&u<=l?(s.x=r-i/2,s.y=a-i*n/2/t,s):0=l)?(s.x=r+o*t/2/n,s.y=a+o/2,s):(0>n&&(u<=-1*l||u>=l)&&(s.x=r-o*t/2/n,s.y=a-o/2),s)},ug=function(e,t){for(var n=0;nn){var v=t.gravity*h/f,m=t.gravity*p/f;d.offsetX+=v,d.offsetY+=m}}}}},dg=function(e,t){var n=[],r=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;r<=a;){var o=n[r++],i=e.idToIndex[o],u=e.layoutNodes[i],l=u.children;if(0n)var a={x:n*e/r,y:n*t/r};else var a={x:e,y:t};return a},fg=function e(t,n){var r=t.parentId;if(r!=null){var a=n.layoutNodes[n.idToIndex[r]],o=!1;if((a.maxX==null||t.maxX+a.padRight>a.maxX)&&(a.maxX=t.maxX+a.padRight,o=!0),(a.minX==null||t.minX-a.padLefta.maxY)&&(a.maxY=t.maxY+a.padBottom,o=!0),(a.minY==null||t.minY-a.padTopm&&(p+=v+t.componentSpacing,h=0,f=0,v=0)}}},gg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ol(e){this.options=ge({},gg,e)}ol.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));var o=ht(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(o.h===0||o.w===0)r.nodes().layoutPositions(this,t,function(W){return{x:o.x1,y:o.y1}});else{var i=a.size(),u=Math.sqrt(i*o.h/o.w),l=Math.round(u),s=Math.round(o.w/o.h*u),c=function(W){if(W==null)return Math.min(l,s);var Q=Math.min(l,s);Q==l?l=W:s=W},d=function(W){if(W==null)return Math.max(l,s);var Q=Math.max(l,s);Q==l?l=W:s=W},h=t.rows,p=t.cols!=null?t.cols:t.columns;if(h!=null&&p!=null)l=h,s=p;else if(h!=null&&p==null)l=h,s=Math.ceil(i/l);else if(h==null&&p!=null)s=p,l=Math.ceil(i/s);else if(s*l>i){var f=c(),v=d();(f-1)*v>=i?c(f-1):(v-1)*f>=i&&d(v-1)}else for(;s*l=i?d(g+1):c(m+1)}var y=o.w/s,b=o.h/l;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var w=0;w=s&&(N=0,_++)},z={},O=0;O(z=Fc(e,t,O[R],O[R+1],O[R+2],O[R+3])))return m(x,z),!0}else if(T.edgeType==="bezier"||T.edgeType==="multibezier"||T.edgeType==="self"||T.edgeType==="compound"){for(var O=T.allpts,R=0;R+5(z=Vc(e,t,O[R],O[R+1],O[R+2],O[R+3],O[R+4],O[R+5])))return m(x,z),!0}for(var N=N||C.source,A=A||C.target,Y=a.getArrowWidth(P,M),V=[{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}],R=0;R0&&(g(N),g(A))}function b(x,C,T){return St(x,C,T)}function w(x,C){var T=x._private,P=h,M;C?M=C+"-":M="",x.boundingBox();var D=T.labelBounds[C||"main"],B=x.pstyle(M+"label").value,_=x.pstyle("text-events").strValue==="yes";if(!(!_||!B)){var N=b(T.rscratch,"labelX",C),A=b(T.rscratch,"labelY",C),z=b(T.rscratch,"labelAngle",C),O=x.pstyle(M+"text-margin-x").pfValue,R=x.pstyle(M+"text-margin-y").pfValue,Y=D.x1-P-O,V=D.x2+P-O,F=D.y1-P-R,W=D.y2+P-R;if(z){var Q=Math.cos(z),re=Math.sin(z),K=function(ce,me){return ce=ce-N,me=me-A,{x:ce*Q-me*re+N,y:ce*re+me*Q+A}},$=K(Y,F),I=K(Y,W),H=K(V,F),U=K(V,W),te=[$.x+O,$.y+R,H.x+O,H.y+R,U.x+O,U.y+R,I.x+O,I.y+R];if(dt(e,t,te))return m(x),!0}else if(jn(D,e,t))return m(x),!0}}for(var S=i.length-1;S>=0;S--){var k=i[S];k.isNode()?g(k)||w(k):y(k)||w(k)||w(k,"source")||w(k,"target")}return u},dn.getAllInBox=function(e,t,n,r){var a=this.getCachedZSortedEles().interactive,o=[],i=Math.min(e,n),u=Math.max(e,n),l=Math.min(t,r),s=Math.max(t,r);e=i,n=u,t=l,r=s;for(var c=ht({x1:e,y1:t,x2:n,y2:r}),d=0;d0?-(Math.PI-e.ang):Math.PI+e.ang},wg=function(e,t,n,r,a){if(e!==Ro?Lo(t,e,Ot):xg(vt,Ot),Lo(t,n,vt),Ao=Ot.nx*vt.ny-Ot.ny*vt.nx,zo=Ot.nx*vt.nx-Ot.ny*-vt.ny,Vt=Math.asin(Math.max(-1,Math.min(1,Ao))),Math.abs(Vt)<1e-6){ti=t.x,ni=t.y,hn=Cn=0;return}pn=1,ta=!1,zo<0?Vt<0?Vt=Math.PI+Vt:(Vt=Math.PI-Vt,pn=-1,ta=!0):Vt>0&&(pn=-1,ta=!0),t.radius!==void 0?Cn=t.radius:Cn=r,on=Vt/2,Fr=Math.min(Ot.len/2,vt.len/2),a?(Tt=Math.abs(Math.cos(on)*Cn/Math.sin(on)),Tt>Fr?(Tt=Fr,hn=Math.abs(Tt*Math.sin(on)/Math.cos(on))):hn=Cn):(Tt=Math.min(Fr,Cn),hn=Math.abs(Tt*Math.sin(on)/Math.cos(on))),ri=t.x+vt.nx*Tt,ai=t.y+vt.ny*Tt,ti=ri-vt.ny*hn*pn,ni=ai+vt.nx*hn*pn,cl=t.x+Ot.nx*Tt,dl=t.y+Ot.ny*Tt,Ro=t};function hl(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function Di(e,t,n,r){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(wg(e,t,n,r,a),{cx:ti,cy:ni,radius:hn,startX:cl,startY:dl,stopX:ri,stopY:ai,startAngle:Ot.ang+Math.PI/2*pn,endAngle:vt.ang-Math.PI/2*pn,counterClockwise:ta})}var at={};at.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,a=t.vectorNormInverse,o,i=e.pstyle("source-endpoint"),u=e.pstyle("target-endpoint"),l=i.units!=null&&u.units!=null,s=function(w,S,k,x){var C=x-S,T=k-w,P=Math.sqrt(T*T+C*C);return{x:-C/P,y:T/P}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":o=n;break;case"intersection":o=r;break;case"endpoints":{if(l){var d=this.manualEndptToPx(e.source()[0],i),h=Dt(d,2),p=h[0],f=h[1],v=this.manualEndptToPx(e.target()[0],u),m=Dt(v,2),g=m[0],y=m[1],b={x1:p,y1:f,x2:g,y2:y};a=s(p,f,g,y),o=b}else Pe("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),o=r;break}}return{midptPts:o,vectorNormInverse:a}},at.findHaystackPoints=function(e){for(var t=0;t0?Math.max(pe-fe,0):Math.min(pe+fe,0)},B=D(P,C),_=D(M,T),N=!1;y===s?g=Math.abs(B)>Math.abs(_)?a:r:y===l||y===u?(g=r,N=!0):(y===o||y===i)&&(g=a,N=!0);var A=g===r,z=A?_:B,O=A?M:P,R=Fi(O),Y=!1;!(N&&(w||k))&&(y===u&&O<0||y===l&&O>0||y===o&&O>0||y===i&&O<0)&&(R*=-1,z=R*Math.abs(z),Y=!0);var V;if(w){var F=S<0?1+S:S;V=F*z}else{var W=S<0?z:0;V=W+S*R}var Q=function(pe){return Math.abs(pe)=Math.abs(z)},re=Q(V),K=Q(Math.abs(z)-Math.abs(V)),$=re||K;if($&&!Y)if(A){var I=Math.abs(O)<=h/2,H=Math.abs(P)<=p/2;if(I){var U=(c.x1+c.x2)/2,te=c.y1,ce=c.y2;n.segpts=[U,te,U,ce]}else if(H){var me=(c.y1+c.y2)/2,Z=c.x1,oe=c.x2;n.segpts=[Z,me,oe,me]}else n.segpts=[c.x1,c.y2]}else{var ae=Math.abs(O)<=d/2,de=Math.abs(M)<=f/2;if(ae){var ve=(c.y1+c.y2)/2,be=c.x1,xe=c.x2;n.segpts=[be,ve,xe,ve]}else if(de){var Me=(c.x1+c.x2)/2,we=c.y1,Ce=c.y2;n.segpts=[Me,we,Me,Ce]}else n.segpts=[c.x2,c.y1]}else if(A){var E=c.y1+V+(m?h/2*R:0),L=c.x1,G=c.x2;n.segpts=[L,E,G,E]}else{var X=c.x1+V+(m?d/2*R:0),j=c.y1,ee=c.y2;n.segpts=[X,j,X,ee]}if(n.isRound){var q=e.pstyle("taxi-radius").value,J=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(q),n.isArcRadius=new Array(n.segpts.length/2).fill(J)}},at.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,a=t.tgtPos,o=t.srcW,i=t.srcH,u=t.tgtW,l=t.tgtH,s=t.srcShape,c=t.tgtShape,d=t.srcCornerRadius,h=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,v=!ne(n.startX)||!ne(n.startY),m=!ne(n.arrowStartX)||!ne(n.arrowStartY),g=!ne(n.endX)||!ne(n.endY),y=!ne(n.arrowEndX)||!ne(n.arrowEndY),b=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=b*w,k=yn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=kB.poolIndex()){var _=D;D=B,B=_}var N=C.srcPos=D.position(),A=C.tgtPos=B.position(),z=C.srcW=D.outerWidth(),O=C.srcH=D.outerHeight(),R=C.tgtW=B.outerWidth(),Y=C.tgtH=B.outerHeight(),V=C.srcShape=n.nodeShapes[t.getNodeShape(D)],F=C.tgtShape=n.nodeShapes[t.getNodeShape(B)],W=C.srcCornerRadius=D.pstyle("corner-radius").value==="auto"?"auto":D.pstyle("corner-radius").pfValue,Q=C.tgtCornerRadius=B.pstyle("corner-radius").value==="auto"?"auto":B.pstyle("corner-radius").pfValue,re=C.tgtRs=B._private.rscratch,K=C.srcRs=D._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var $=0;$0){var ce=o,me=ln(ce,Rn(n)),Z=ln(ce,Rn(te)),oe=me;if(Z2){var ae=ln(ce,{x:te[2],y:te[3]});ae0){var ee=i,q=ln(ee,Rn(n)),J=ln(ee,Rn(j)),pe=q;if(J2){var fe=ln(ee,{x:j[2],y:j[3]});fe=p||k){v={cp:b,segment:S};break}}if(v)break}var x=v.cp,C=v.segment,T=(p-m)/C.length,P=C.t1-C.t0,M=h?C.t0+P*T:C.t1-P*T;M=mr(0,M,1),t=Fn(x.p0,x.p1,x.p2,M),d=kg(x.p0,x.p1,x.p2,M);break}case"straight":case"segments":case"haystack":{for(var D=0,B,_,N,A,z=r.allpts.length,O=0;O+3=p));O+=2);var R=p-_,Y=R/B;Y=mr(0,Y,1),t=Mc(N,A,Y),d=fl(N,A);break}}i("labelX",c,t.x),i("labelY",c,t.y),i("labelAutoAngle",c,d)}};s("source"),s("target"),this.applyLabelDimensions(e)}},It.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},It.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,i=e.pstyle("text-wrap").strValue,u=St(n.rscratch,"labelWrapCachedLines",t)||[],l=i!=="wrap"?1:Math.max(u.length,1),s=a.height/l,c=s*o,d=a.width,h=a.height+(l-1)*(o-1)*s;Wt(n.rstyle,"labelWidth",t,d),Wt(n.rscratch,"labelWidth",t,d),Wt(n.rstyle,"labelHeight",t,h),Wt(n.rscratch,"labelHeight",t,h),Wt(n.rscratch,"labelLineHeight",t,c)},It.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",a=e.pstyle(r+"label").strValue,o=e.pstyle("text-transform").value,i=function(F,W){return W?(Wt(n.rscratch,F,t,W),W):St(n.rscratch,F,t)};if(!a)return"";o=="none"||(o=="uppercase"?a=a.toUpperCase():o=="lowercase"&&(a=a.toLowerCase()));var u=e.pstyle("text-wrap").value;if(u==="wrap"){var l=i("labelKey");if(l!=null&&i("labelWrapKey")===l)return i("labelWrapCachedText");for(var s="​",c=a.split(` `),d=e.pstyle("text-max-width").pfValue,h=e.pstyle("text-overflow-wrap").value,p=h==="anywhere",f=[],v=/[\s\u200b]+|$/g,m=0;md){var S=g.matchAll(v),k="",x=0,C=ns(S),T;try{for(C.s();!(T=C.n()).done;){var P=T.value,M=P[0],D=g.substring(x,P.index);x=P.index+M.length;var B=k.length===0?D:k+D+M,_=this.calculateLabelDimensions(e,B),N=_.width;N<=d?k+=D+M:(k&&f.push(k),k=D+M)}}catch(F){C.e(F)}finally{C.f()}k.match(/^[\s\u200b]+$/)||f.push(k)}else f.push(g)}i("labelWrapCachedLines",f),a=i("labelWrapCachedText",f.join(` `)),i("labelWrapKey",l)}else if(u==="ellipsis"){var A=e.pstyle("text-max-width").pfValue,z="",O="…",R=!1;if(this.calculateLabelDimensions(e,a).widthA)break;z+=a[Y],Y===a.length-1&&(R=!0)}return R||(z+=O),z}return a},It.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},It.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),a=r.document,o=vn(t,e._private.labelDimsKey),i=n.labelDimCache||(n.labelDimCache=[]),u=i[o];if(u!=null)return u;var l=0,s=e.pstyle("font-style").strValue,c=e.pstyle("font-size").pfValue,d=e.pstyle("font-family").strValue,h=e.pstyle("font-weight").strValue,p=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!p){p=this.labelCalcCanvas=a.createElement("canvas"),f=this.labelCalcCanvasContext=p.getContext("2d");var v=p.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}f.font="".concat(s," ").concat(h," ").concat(c,"px ").concat(d);for(var m=0,g=0,y=t.split(` `),b=0;b1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(o),i)for(var u=0;u=e.desktopTapThreshold2}var pt=a(E);Ae&&(e.hoverData.tapholdCancelled=!0);var bt=function(){var Mt=e.hoverData.dragDelta=e.hoverData.dragDelta||[];Mt.length===0?(Mt.push(ue[0]),Mt.push(ue[1])):(Mt[0]+=ue[0],Mt[1]+=ue[1])};G=!0,r(le,["mousemove","vmousemove","tapdrag"],E,{x:q[0],y:q[1]});var ct=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||X.emit({originalEvent:E,type:"boxstart",position:{x:q[0],y:q[1]}}),fe[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Ae){var xt={originalEvent:E,type:"cxtdrag",position:{x:q[0],y:q[1]}};se?se.emit(xt):X.emit(xt),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||le!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:E,type:"cxtdragout",position:{x:q[0],y:q[1]}}),e.hoverData.cxtOver=le,le&&le.emit({originalEvent:E,type:"cxtdragover",position:{x:q[0],y:q[1]}}))}}else if(e.hoverData.dragging){if(G=!0,X.panningEnabled()&&X.userPanningEnabled()){var Pt;if(e.hoverData.justStartedPan){var Rt=e.hoverData.mdownPos;Pt={x:(q[0]-Rt[0])*j,y:(q[1]-Rt[1])*j},e.hoverData.justStartedPan=!1}else Pt={x:ue[0]*j,y:ue[1]*j};X.panBy(Pt),X.emit("dragpan"),e.hoverData.dragged=!0}q=e.projectIntoViewport(E.clientX,E.clientY)}else if(fe[4]==1&&(se==null||se.pannable())){if(Ae){if(!e.hoverData.dragging&&X.boxSelectionEnabled()&&(pt||!X.panningEnabled()||!X.userPanningEnabled()))ct();else if(!e.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var wt=o(se,e.hoverData.downs);wt&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,fe[4]=0,e.data.bgActivePosistion=Rn(J),e.redrawHint("select",!0),e.redraw())}se&&se.pannable()&&se.active()&&se.unactivate()}}else{if(se&&se.pannable()&&se.active()&&se.unactivate(),(!se||!se.grabbed())&&le!=ye&&(ye&&r(ye,["mouseout","tapdragout"],E,{x:q[0],y:q[1]}),le&&r(le,["mouseover","tapdragover"],E,{x:q[0],y:q[1]}),e.hoverData.last=le),se)if(Ae){if(X.boxSelectionEnabled()&&pt)se&&se.grabbed()&&(m(Ve),se.emit("freeon"),Ve.emit("free"),e.dragData.didDrag&&(se.emit("dragfreeon"),Ve.emit("dragfree"))),ct();else if(se&&se.grabbed()&&e.nodeIsDraggable(se)){var je=!e.dragData.didDrag;je&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(Ve,{inDragLayer:!0});var He={x:0,y:0};if(ne(ue[0])&&ne(ue[1])&&(He.x+=ue[0],He.y+=ue[1],je)){var tt=e.hoverData.dragDelta;tt&&ne(tt[0])&&ne(tt[1])&&(He.x+=tt[0],He.y+=tt[1])}e.hoverData.draggingEles=!0,Ve.silentShift(He).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else bt();G=!0}if(fe[2]=q[0],fe[3]=q[1],G)return E.stopPropagation&&E.stopPropagation(),E.preventDefault&&E.preventDefault(),!1}},!1);var P,M,D;e.registerBinding(t,"mouseup",function(E){if(!(e.hoverData.which===1&&E.which!==1&&e.hoverData.capture)){var L=e.hoverData.capture;if(L){e.hoverData.capture=!1;var G=e.cy,X=e.projectIntoViewport(E.clientX,E.clientY),j=e.selection,ee=e.findNearestElement(X[0],X[1],!0,!1),q=e.dragData.possibleDragElements,J=e.hoverData.down,pe=a(E);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,J&&J.unactivate(),e.hoverData.which===3){var fe={originalEvent:E,type:"cxttapend",position:{x:X[0],y:X[1]}};if(J?J.emit(fe):G.emit(fe),!e.hoverData.cxtDragged){var le={originalEvent:E,type:"cxttap",position:{x:X[0],y:X[1]}};J?J.emit(le):G.emit(le)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(r(ee,["mouseup","tapend","vmouseup"],E,{x:X[0],y:X[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(r(J,["click","tap","vclick"],E,{x:X[0],y:X[1]}),M=!1,E.timeStamp-D<=G.multiClickDebounceTime()?(P&&clearTimeout(P),M=!0,D=null,r(J,["dblclick","dbltap","vdblclick"],E,{x:X[0],y:X[1]})):(P=setTimeout(function(){M||r(J,["oneclick","onetap","voneclick"],E,{x:X[0],y:X[1]})},G.multiClickDebounceTime()),D=E.timeStamp)),J==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(E)&&(G.$(n).unselect(["tapunselect"]),q.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=q=G.collection()),ee==J&&!e.dragData.didDrag&&!e.hoverData.selecting&&ee!=null&&ee._private.selectable&&(e.hoverData.dragging||(G.selectionType()==="additive"||pe?ee.selected()?ee.unselect(["tapunselect"]):ee.select(["tapselect"]):pe||(G.$(n).unmerge(ee).unselect(["tapunselect"]),ee.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var ye=G.collection(e.getAllInBox(j[0],j[1],j[2],j[3]));e.redrawHint("select",!0),ye.length>0&&e.redrawHint("eles",!0),G.emit({type:"boxend",originalEvent:E,position:{x:X[0],y:X[1]}});var se=function(Ve){return Ve.selectable()&&!Ve.selected()};G.selectionType()==="additive"||pe||G.$(n).unmerge(ye).unselect(),ye.emit("box").stdFilter(se).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!j[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ue=J&&J.grabbed();m(q),ue&&(J.emit("freeon"),q.emit("free"),e.dragData.didDrag&&(J.emit("dragfreeon"),q.emit("dragfree")))}}j[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var B=function(E){if(!e.scrollingPage){var L=e.cy,G=L.zoom(),X=L.pan(),j=e.projectIntoViewport(E.clientX,E.clientY),ee=[j[0]*G+X.x,j[1]*G+X.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||C()){E.preventDefault();return}if(L.panningEnabled()&&L.userPanningEnabled()&&L.zoomingEnabled()&&L.userZoomingEnabled()){E.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var q;E.deltaY!=null?q=E.deltaY/-250:E.wheelDeltaY!=null?q=E.wheelDeltaY/1e3:q=E.wheelDelta/1e3,q=q*e.wheelSensitivity;var J=E.deltaMode===1;J&&(q*=33);var pe=L.zoom()*Math.pow(10,q);E.type==="gesturechange"&&(pe=e.gestureStartZoom*E.scale),L.zoom({level:pe,renderedPosition:{x:ee[0],y:ee[1]}}),L.emit(E.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",B,!0),e.registerBinding(t,"scroll",function(E){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(E){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||E.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(E){e.hasTouchStarted||B(E)},!0),e.registerBinding(e.container,"mouseout",function(E){var L=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseout",position:{x:L[0],y:L[1]}})},!1),e.registerBinding(e.container,"mouseover",function(E){var L=e.projectIntoViewport(E.clientX,E.clientY);e.cy.emit({originalEvent:E,type:"mouseover",position:{x:L[0],y:L[1]}})},!1);var _,N,A,z,O,R,Y,V,F,W,Q,re,K,$=function(E,L,G,X){return Math.sqrt((G-E)*(G-E)+(X-L)*(X-L))},I=function(E,L,G,X){return(G-E)*(G-E)+(X-L)*(X-L)},H;e.registerBinding(e.container,"touchstart",H=function(E){if(e.hasTouchStarted=!0,!!T(E)){y(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var L=e.cy,G=e.touchData.now,X=e.touchData.earlier;if(E.touches[0]){var j=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);G[0]=j[0],G[1]=j[1]}if(E.touches[1]){var j=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);G[2]=j[0],G[3]=j[1]}if(E.touches[2]){var j=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);G[4]=j[0],G[5]=j[1]}if(E.touches[1]){e.touchData.singleTouchMoved=!0,m(e.dragData.touchDragEles);var ee=e.findContainerClientCoords();F=ee[0],W=ee[1],Q=ee[2],re=ee[3],_=E.touches[0].clientX-F,N=E.touches[0].clientY-W,A=E.touches[1].clientX-F,z=E.touches[1].clientY-W,K=0<=_&&_<=Q&&0<=A&&A<=Q&&0<=N&&N<=re&&0<=z&&z<=re;var q=L.pan(),J=L.zoom();O=$(_,N,A,z),R=I(_,N,A,z),Y=[(_+A)/2,(N+z)/2],V=[(Y[0]-q.x)/J,(Y[1]-q.y)/J];var pe=200,fe=pe*pe;if(R=1){for(var Ke=e.touchData.startPosition=[null,null,null,null,null,null],Fe=0;Fe=e.touchTapThreshold2}if(L&&e.touchData.cxt){E.preventDefault();var Ke=E.touches[0].clientX-F,Fe=E.touches[0].clientY-W,ut=E.touches[1].clientX-F,Ue=E.touches[1].clientY-W,pt=I(Ke,Fe,ut,Ue),bt=pt/R,ct=150,xt=ct*ct,Pt=1.5,Rt=Pt*Pt;if(bt>=Rt||pt>=xt){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var wt={originalEvent:E,type:"cxttapend",position:{x:j[0],y:j[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(wt),e.touchData.start=null):X.emit(wt)}}if(L&&e.touchData.cxt){var wt={originalEvent:E,type:"cxtdrag",position:{x:j[0],y:j[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(wt):X.emit(wt),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var je=e.findNearestElement(j[0],j[1],!0,!0);(!e.touchData.cxtOver||je!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:E,type:"cxtdragout",position:{x:j[0],y:j[1]}}),e.touchData.cxtOver=je,je&&je.emit({originalEvent:E,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}else if(L&&E.touches[2]&&X.boxSelectionEnabled())E.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||X.emit({originalEvent:E,type:"boxstart",position:{x:j[0],y:j[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,G[4]=1,!G||G.length===0||G[0]===void 0?(G[0]=(j[0]+j[2]+j[4])/3,G[1]=(j[1]+j[3]+j[5])/3,G[2]=(j[0]+j[2]+j[4])/3+1,G[3]=(j[1]+j[3]+j[5])/3+1):(G[2]=(j[0]+j[2]+j[4])/3,G[3]=(j[1]+j[3]+j[5])/3),e.redrawHint("select",!0),e.redraw();else if(L&&E.touches[1]&&!e.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){E.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var He=e.dragData.touchDragEles;if(He){e.redrawHint("drag",!0);for(var tt=0;tt0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var te;e.registerBinding(t,"touchcancel",te=function(E){var L=e.touchData.start;e.touchData.capture=!1,L&&L.unactivate()});var ce,me,Z,oe;if(e.registerBinding(t,"touchend",ce=function(E){var L=e.touchData.start,G=e.touchData.capture;if(G)E.touches.length===0&&(e.touchData.capture=!1),E.preventDefault();else return;var X=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var j=e.cy,ee=j.zoom(),q=e.touchData.now,J=e.touchData.earlier;if(E.touches[0]){var pe=e.projectIntoViewport(E.touches[0].clientX,E.touches[0].clientY);q[0]=pe[0],q[1]=pe[1]}if(E.touches[1]){var pe=e.projectIntoViewport(E.touches[1].clientX,E.touches[1].clientY);q[2]=pe[0],q[3]=pe[1]}if(E.touches[2]){var pe=e.projectIntoViewport(E.touches[2].clientX,E.touches[2].clientY);q[4]=pe[0],q[5]=pe[1]}L&&L.unactivate();var fe;if(e.touchData.cxt){if(fe={originalEvent:E,type:"cxttapend",position:{x:q[0],y:q[1]}},L?L.emit(fe):j.emit(fe),!e.touchData.cxtDragged){var le={originalEvent:E,type:"cxttap",position:{x:q[0],y:q[1]}};L?L.emit(le):j.emit(le)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!E.touches[2]&&j.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var ye=j.collection(e.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,e.redrawHint("select",!0),j.emit({type:"boxend",originalEvent:E,position:{x:q[0],y:q[1]}});var se=function(ct){return ct.selectable()&&!ct.selected()};ye.emit("box").stdFilter(se).select().emit("boxselect"),ye.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(L?.unactivate(),E.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!E.touches[1]&&!E.touches[0]&&!E.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ue=e.dragData.touchDragEles;if(L!=null){var Ve=L._private.grabbed;m(ue),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Ve&&(L.emit("freeon"),ue.emit("free"),e.dragData.didDrag&&(L.emit("dragfreeon"),ue.emit("dragfree"))),r(L,["touchend","tapend","vmouseup","tapdragout"],E,{x:q[0],y:q[1]}),L.unactivate(),e.touchData.start=null}else{var Ae=e.findNearestElement(q[0],q[1],!0,!0);r(Ae,["touchend","tapend","vmouseup","tapdragout"],E,{x:q[0],y:q[1]})}var st=e.touchData.startPosition[0]-q[0],Ke=st*st,Fe=e.touchData.startPosition[1]-q[1],ut=Fe*Fe,Ue=Ke+ut,pt=Ue*ee*ee;e.touchData.singleTouchMoved||(L||j.$(":selected").unselect(["tapunselect"]),r(L,["tap","vclick"],E,{x:q[0],y:q[1]}),me=!1,E.timeStamp-oe<=j.multiClickDebounceTime()?(Z&&clearTimeout(Z),me=!0,oe=null,r(L,["dbltap","vdblclick"],E,{x:q[0],y:q[1]})):(Z=setTimeout(function(){me||r(L,["onetap","voneclick"],E,{x:q[0],y:q[1]})},j.multiClickDebounceTime()),oe=E.timeStamp)),L!=null&&!e.dragData.didDrag&&L._private.selectable&&pt"u"){var ae=[],de=function(E){return{clientX:E.clientX,clientY:E.clientY,force:1,identifier:E.pointerId,pageX:E.pageX,pageY:E.pageY,radiusX:E.width/2,radiusY:E.height/2,screenX:E.screenX,screenY:E.screenY,target:E.target}},ve=function(E){return{event:E,touch:de(E)}},be=function(E){ae.push(ve(E))},xe=function(E){for(var L=0;L0)return Y[0]}return null},p=Object.keys(d),f=0;f0?h:qi(a,o,e,t,n,r,i,u)},checkPoint:function(e,t,n,r,a,o,i,u){u=u==="auto"?mn(r,a):u;var l=2*u;if(Lt(e,t,this.points,o,i,r,a-l,[0,-1],n)||Lt(e,t,this.points,o,i,r-l,a,[0,-1],n))return!0;var s=r/2+2*n,c=a/2+2*n,d=[o-s,i-c,o-s,i,o+s,i,o+s,i-c];return!!(dt(e,t,d)||rn(e,t,l,l,o+r/2-u,i+a/2-u,n)||rn(e,t,l,l,o-r/2+u,i+a/2-u,n))}}},Ft.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",lt(3,0)),this.generateRoundPolygon("round-triangle",lt(3,0)),this.generatePolygon("rectangle",lt(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",lt(5,0)),this.generateRoundPolygon("round-pentagon",lt(5,0)),this.generatePolygon("hexagon",lt(6,0)),this.generateRoundPolygon("round-hexagon",lt(6,0)),this.generatePolygon("heptagon",lt(7,0)),this.generateRoundPolygon("round-heptagon",lt(7,0)),this.generatePolygon("octagon",lt(8,0)),this.generateRoundPolygon("round-octagon",lt(8,0));var r=new Array(20);{var a=Ya(5,0),o=Ya(5,Math.PI/5),i=.5*(3-Math.sqrt(5));i*=1.57;for(var u=0;u=e.deqFastCost*g)break}else if(i){if(v>=e.deqCost*c||v>=e.deqAvgCost*s)break}else if(m>=e.deqNoDrawCost*La)break;var y=e.deq(t,p,h);if(y.length>0)for(var b=0;b0&&(e.onDeqd(t,d),!i&&e.shouldRedraw(t,d,p,h)&&r())},o=e.priority||gi;n.beforeRender(a,o(t))}}}},Dg=(function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oa;ci(this,e),this.idsByKey=new zt,this.keyForId=new zt,this.cachesByLvl=new zt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return di(e,[{key:"getIdsFor",value:function(t){t==null&&Le("Can not get id list for null key");var n=this.idsByKey,r=this.idsByKey.get(t);return r||(r=new Xn,n.set(t,r)),r}},{key:"addIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).add(n)}},{key:"deleteIdForKey",value:function(t,n){t!=null&&this.getIdsFor(t).delete(n)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);this.deleteIdForKey(r,n),this.addIdForKey(a,n),this.keyForId.set(n,a)}},{key:"deleteKeyMappingFor",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteIdForKey(r,n),this.keyForId.delete(n)}},{key:"keyHasChangedFor",value:function(t){var n=t.id(),r=this.keyForId.get(n),a=this.getKey(t);return r!==a}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var n=this.cachesByLvl,r=this.lvls,a=n.get(t);return a||(a=new zt,n.set(t,a),r.push(t)),a}},{key:"getCache",value:function(t,n){return this.getCachesAt(n).get(t)}},{key:"get",value:function(t,n){var r=this.getKey(t),a=this.getCache(r,n);return a!=null&&this.updateKeyMappingFor(t),a}},{key:"getForCachedKey",value:function(t,n){var r=this.keyForId.get(t.id()),a=this.getCache(r,n);return a}},{key:"hasCache",value:function(t,n){return this.getCachesAt(n).has(t)}},{key:"has",value:function(t,n){var r=this.getKey(t);return this.hasCache(r,n)}},{key:"setCache",value:function(t,n,r){r.key=t,this.getCachesAt(n).set(t,r)}},{key:"set",value:function(t,n,r){var a=this.getKey(t);this.setCache(a,n,r),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,n){this.getCachesAt(n).delete(t)}},{key:"delete",value:function(t,n){var r=this.getKey(t);this.deleteCache(r,n)}},{key:"invalidateKey",value:function(t){var n=this;this.lvls.forEach(function(r){return n.deleteCache(t,r)})}},{key:"invalidate",value:function(t){var n=t.id(),r=this.keyForId.get(n);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);return a&&this.invalidateKey(r),a||this.getNumberOfIdsForKey(r)===0}}]),e})(),Yo=25,jr=50,qr=-4,Va=3,Sg=7.99,_g=8,Pg=1024,Mg=1024,Tg=1024,Bg=.2,Og=.8,Ig=10,Ng=.15,Ag=.1,zg=.9,Rg=.9,Lg=100,Vg=1,Sn={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Fg=et({getKey:null,doesEleInvalidateKey:oa,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:vs,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),dr=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=Fg(t);ge(n,r),n.lookup=new Dg(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},qe=dr.prototype;qe.reasons=Sn,qe.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},qe.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},qe.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new Sr(function(n,r){return r.reqs-n.reqs});return t},qe.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},qe.getElement=function(e,t,n,r,a){var o=this,i=this.renderer,u=i.cy.zoom(),l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!o.allowEdgeTxrCaching&&e.isEdge()||!o.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(vi(u*n))),r=Sg||r>Va)return null;var s=Math.pow(2,r),c=t.h*s,d=t.w*s,h=i.eleTextBiggerThanMin(e,s);if(!this.isVisible(e,h))return null;var p=l.get(e,r);if(p&&p.invalidated&&(p.invalidated=!1,p.texture.invalidatedWidth-=p.width),p)return p;var f;if(c<=Yo?f=Yo:c<=jr?f=jr:f=Math.ceil(c/jr)*jr,c>Tg||d>Mg)return null;var v=o.getTextureQueue(f),m=v[v.length-2],g=function(){return o.recycleTexture(f,d)||o.addTexture(f,d)};m||(m=v[v.length-1]),m||(m=g()),m.width-m.usedWidthr;M--)T=o.getElement(e,t,n,M,Sn.downscale);P()}else return o.queueElement(e,k.level-1),k;else{var D;if(!b&&!w&&!S)for(var B=r-1;B>=qr;B--){var _=l.get(e,B);if(_){D=_;break}}if(y(D))return o.queueElement(e,r),D;m.context.translate(m.usedWidth,0),m.context.scale(s,s),this.drawElement(m.context,e,t,h,!1),m.context.scale(1/s,1/s),m.context.translate(-m.usedWidth,0)}return p={x:m.usedWidth,texture:m,level:r,scale:s,width:d,height:c,scaledLabelShown:h},m.usedWidth+=Math.ceil(d+_g),m.eleCaches.push(p),l.set(e,r,p),o.checkTextureFullness(m),p},qe.invalidateElements=function(e){for(var t=0;t=Bg*e.width&&this.retireTexture(e)},qe.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>Og&&e.fullnessChecks>=Ig?Zt(n,e):e.fullnessChecks++},qe.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),a=this.lookup;Zt(r,e),e.retired=!0;for(var o=e.eleCaches,i=0;i=t)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,qa(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),Zt(a,i),r.push(i),i}},qe.queueElement=function(e,t){var n=this,r=n.getElementQueue(),a=n.getElementKeyToQueue(),o=this.getKey(e),i=a[o];if(i)i.level=Math.max(i.level,t),i.eles.merge(e),i.reqs++,r.updateItem(i);else{var u={eles:e.spawn().merge(e),level:t,reqs:1,key:o};r.push(u),a[o]=u}},qe.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=[],o=t.lookup,i=0;i0;i++){var u=n.pop(),l=u.key,s=u.eles[0],c=o.hasCache(s,u.level);if(r[l]=null,!c){a.push(u);var d=t.getBoundingBox(s);t.getElement(s,d,e,u.level,Sn.dequeue)}}return a},qe.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),a=this.getKey(e),o=r[a];o!=null&&(o.eles.length===1?(o.reqs=fi,n.updateItem(o),n.pop(),r[a]=null):o.eles.unmerge(e))},qe.onDequeue=function(e){this.onDequeues.push(e)},qe.offDequeue=function(e){Zt(this.onDequeues,e)},qe.setupDequeueing=bl.setupDequeueing({deqRedrawThreshold:Lg,deqCost:Ng,deqAvgCost:Ag,deqNoDrawCost:zg,deqFastCost:Rg,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=qg||n>Yr)return null}r.validateLayersElesOrdering(n,e);var l=r.layersByLevel,s=Math.pow(2,n),c=l[n]=l[n]||[],d,h=r.levelIsComplete(n,e),p,f=function(){var T=function(B){if(r.validateLayersElesOrdering(B,e),r.levelIsComplete(B,e))return p=l[B],!0},P=function(B){if(!p)for(var _=n+B;nr<=_&&_<=Yr&&!T(_);_+=B);};P(1),P(-1);for(var M=c.length-1;M>=0;M--){var D=c[M];D.invalid&&Zt(c,D)}};if(!h)f();else return c;var v=function(){if(!d){d=ht();for(var T=0;T$g)return null;var D=r.makeLayer(d,n);if(P!=null){var B=c.indexOf(P)+1;c.splice(B,0,D)}else(T.insert===void 0||T.insert)&&c.unshift(D);return D};if(r.skipping&&!u)return null;for(var g=null,y=e.length/jg,b=!u,w=0;w=y||!Es(g.bb,S.boundingBox()))&&(g=m({insert:!0,after:g}),!g))return null;p||b?r.queueLayer(g,S):r.drawEleInLayer(g,S,n,t),g.eles.push(S),x[n]=g}return p||(b?null:c)},$e.getEleLevelForLayerLevel=function(e,t){return e},$e.drawEleInLayer=function(e,t,n,r){var a=this,o=this.renderer,i=e.context,u=t.boundingBox();u.w===0||u.h===0||!t.visible()||(n=a.getEleLevelForLayerLevel(n,r),o.setImgSmoothing(i,!1),o.drawCachedElement(i,t,null,null,n,Zg),o.setImgSmoothing(i,!0))},$e.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var a=0,o=0;o0||i.invalid)return!1;a+=i.eles.length}return a===t.length},$e.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},$e.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=Yt(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(n,r,a){t.invalidateLayer(n)}))},$e.invalidateLayer=function(e){if(this.lastInvalidationTime=Yt(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];Zt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var a=0;a3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,u=t._private.rscratch;if(!(o&&!t.visible())&&!(u.badLine||u.allpts==null||isNaN(u.allpts[0]))){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var s=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,v=t.pstyle("line-outline-width").value,m=t.pstyle("line-outline-color").value,g=s*c,y=s*c,b=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;d==="straight-triangle"?(i.eleStrokeStyle(e,t,_),i.drawEdgeTrianglePath(t,e,u.allpts)):(e.lineWidth=p,e.lineCap=f,i.eleStrokeStyle(e,t,_),i.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},w=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(e.lineWidth=p+v,e.lineCap=f,v>0)i.colorStrokeStyle(e,m[0],m[1],m[2],_);else{e.lineCap="butt";return}d==="straight-triangle"?i.drawEdgeTrianglePath(t,e,u.allpts):(i.drawEdgePath(t,e,u.allpts,h),e.lineCap="butt")},S=function(){a&&i.drawEdgeOverlay(e,t)},k=function(){a&&i.drawEdgeUnderlay(e,t)},x=function(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;i.drawArrowheads(e,t,_)},C=function(){i.drawElementText(e,t,null,r)};e.lineJoin="round";var T=t.pstyle("ghost").value==="yes";if(T){var P=t.pstyle("ghost-offset-x").pfValue,M=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,B=g*D;e.translate(P,M),b(B),x(B),e.translate(-P,-M)}else w();k(),b(),x(),S(),C(),n&&e.translate(l.x1,l.y1)}};var Go=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(r!==0){var a=this,o=a.usePaths(),i=n._private.rscratch,u=n.pstyle("".concat(e,"-padding")).pfValue,l=2*u,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=l,i.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",a.colorStrokeStyle(t,s[0],s[1],s[2],r),a.drawEdgePath(n,t,i.allpts,"solid")}}}};jt.drawEdgeOverlay=Go("overlay"),jt.drawEdgeUnderlay=Go("underlay"),jt.drawEdgePath=function(e,t,n,r){var a=e._private.rscratch,o=t,i,u=!1,l=this.usePaths(),s=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$"),h=a.pathCacheKey&&a.pathCacheKey===d;h?(i=t=a.pathCache,u=!0):(i=t=new Path2D,a.pathCacheKey=d,a.pathCache=i)}if(o.setLineDash)switch(r){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(s),o.lineDashOffset=c;break;case"solid":o.setLineDash([]);break}if(!u&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&arguments[5]!==void 0?arguments[5]:!0,i=this;if(r==null){if(o&&!i.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var u=t.pstyle("label");if(!u||!u.value)return;var l=i.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var s=t.element()._private.rscratch.badLine,c=t.pstyle("label"),d=t.pstyle("source-label"),h=t.pstyle("target-label");if(s||(!c||!c.value)&&(!d||!d.value)&&(!h||!h.value))return;e.textAlign="center",e.textBaseline="bottom"}var p=!n,f;n&&(f=n,e.translate(-f.x1,-f.y1)),a==null?(i.drawText(e,t,null,p,o),t.isEdge()&&(i.drawText(e,t,"source",p,o),i.drawText(e,t,"target",p,o))):i.drawText(e,t,a,p,o),n&&e.translate(f.x1,f.y1)},fn.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,i=t.pstyle("font-weight").strValue,u=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*u,s=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+i+" "+a+" "+o,e.lineJoin="round",this.colorFillStyle(e,s[0],s[1],s[2],u),this.colorStrokeStyle(e,c[0],c[1],c[2],l)};function ja(e,t,n,r,a){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,i=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+a-o),e.quadraticCurveTo(t+r,n+a,t+r-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),i?e.stroke():e.fill()}fn.getTextAngle=function(e,t){var n,r=e._private,a=r.rscratch,o=t?t+"-":"",i=e.pstyle(o+"text-rotation"),u=St(a,"labelAngle",t);return i.strValue==="autorotate"?n=e.isEdge()?u:0:i.strValue==="none"?n=0:n=i.pfValue,n},fn.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=t._private,i=o.rscratch,u=a?t.effectiveOpacity():1;if(!(a&&(u===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var l=St(i,"labelX",n),s=St(i,"labelY",n),c,d,h=this.getLabelText(t,n);if(h!=null&&h!==""&&!isNaN(l)&&!isNaN(s)){this.setupTextStyle(e,t,a);var p=n?n+"-":"",f=St(i,"labelWidth",n),v=St(i,"labelHeight",n),m=t.pstyle(p+"text-margin-x").pfValue,g=t.pstyle(p+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;y&&(b="center",w="center"),l+=m,s+=g;var S;switch(r?S=this.getTextAngle(t,n):S=0,S!==0&&(c=l,d=s,e.translate(c,d),e.rotate(S),l=0,s=0),w){case"top":break;case"center":s+=v/2;break;case"bottom":s+=v;break}var k=t.pstyle("text-background-opacity").value,x=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,T=t.pstyle("text-background-padding").pfValue,P=t.pstyle("text-background-shape").strValue,M=P.indexOf("round")===0,D=2;if(k>0||C>0&&x>0){var B=l-T;switch(b){case"left":B-=f;break;case"center":B-=f/2;break}var _=s-v-T,N=f+2*T,A=v+2*T;if(k>0){var z=e.fillStyle,O=t.pstyle("text-background-color").value;e.fillStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*u+")",M?ja(e,B,_,N,A,D):e.fillRect(B,_,N,A),e.fillStyle=z}if(C>0&&x>0){var R=e.strokeStyle,Y=e.lineWidth,V=t.pstyle("text-border-color").value,F=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+V[0]+","+V[1]+","+V[2]+","+x*u+")",e.lineWidth=C,e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(M?ja(e,B,_,N,A,D,"stroke"):e.strokeRect(B,_,N,A),F==="double"){var W=C/2;M?ja(e,B+W,_+W,N-W*2,A-W*2,D,"stroke"):e.strokeRect(B+W,_+W,N-W*2,A-W*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=Y,e.strokeStyle=R}}var Q=2*t.pstyle("text-outline-width").pfValue;if(Q>0&&(e.lineWidth=Q),t.pstyle("text-wrap").value==="wrap"){var re=St(i,"labelWrapCachedLines",n),K=St(i,"labelLineHeight",n),$=f/2,I=this.getLabelJustification(t);switch(I==="auto"||(b==="left"?I==="left"?l+=-f:I==="center"&&(l+=-$):b==="center"?I==="left"?l+=-$:I==="right"&&(l+=$):b==="right"&&(I==="center"?l+=$:I==="right"&&(l+=f))),w){case"top":s-=(re.length-1)*K;break;case"center":case"bottom":s-=(re.length-1)*K;break}for(var H=0;H0&&e.strokeText(re[H],l,s),e.fillText(re[H],l,s),s+=K}else Q>0&&e.strokeText(h,l,s),e.fillText(h,l,s);S!==0&&(e.rotate(-S),e.translate(-c,-d))}}};var Vn={};Vn.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,u,l,s=t._private,c=s.rscratch,d=t.position();if(!(!ne(d.x)||!ne(d.y))&&!(o&&!t.visible())){var h=o?t.effectiveOpacity():1,p=i.usePaths(),f,v=!1,m=t.padding();u=t.width()+2*m,l=t.height()+2*m;var g;n&&(g=n,e.translate(-g.x1,-g.y1));for(var y=t.pstyle("background-image"),b=y.value,w=new Array(b.length),S=new Array(b.length),k=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:B;i.eleFillStyle(e,t,ee)},H=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:V;i.colorStrokeStyle(e,_[0],_[1],_[2],ee)},U=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:re;i.colorStrokeStyle(e,W[0],W[1],W[2],ee)},te=function(ee,q,J,pe){var fe=i.nodePathCache=i.nodePathCache||[],le=gs(J==="polygon"?J+","+pe.join(","):J,""+q,""+ee,""+$),ye=fe[le],se,ue=!1;return ye!=null?(se=ye,ue=!0,c.pathCache=se):(se=new Path2D,fe[le]=c.pathCache=se),{path:se,cacheHit:ue}},ce=t.pstyle("shape").strValue,me=t.pstyle("shape-polygon-points").pfValue;if(p){e.translate(d.x,d.y);var Z=te(u,l,ce,me);f=Z.path,v=Z.cacheHit}var oe=function(){if(!v){var ee=d;p&&(ee={x:0,y:0}),i.nodeShapes[i.getNodeShape(t)].draw(f||e,ee.x,ee.y,u,l,$,c)}p?e.fill(f):e.fill()},ae=function(){for(var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,J=s.backgrounding,pe=0,fe=0;fe0&&arguments[0]!==void 0?arguments[0]:!1,q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h;i.hasPie(t)&&(i.drawPie(e,t,q),ee&&(p||i.nodeShapes[i.getNodeShape(t)].draw(e,d.x,d.y,u,l,$,c)))},ve=function(){var ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:h,q=(M>0?M:-M)*ee,J=M>0?0:255;M!==0&&(i.colorFillStyle(e,J,J,J,q),p?e.fill(f):e.fill())},be=function(){if(D>0){if(e.lineWidth=D,e.lineCap=z,e.lineJoin=A,e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(R),e.lineDashOffset=Y;break;case"solid":case"double":e.setLineDash([]);break}if(O!=="center"){if(e.save(),e.lineWidth*=2,O==="inside")p?e.clip(f):e.clip();else{var ee=new Path2D;ee.rect(-u/2-D,-l/2-D,u+2*D,l+2*D),ee.addPath(f),e.clip(ee,"evenodd")}p?e.stroke(f):e.stroke(),e.restore()}else p?e.stroke(f):e.stroke();if(N==="double"){e.lineWidth=D/3;var q=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",p?e.stroke(f):e.stroke(),e.globalCompositeOperation=q}e.setLineDash&&e.setLineDash([])}},xe=function(){if(F>0){if(e.lineWidth=F,e.lineCap="butt",e.setLineDash)switch(Q){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var ee=d;p&&(ee={x:0,y:0});var q=i.getNodeShape(t),J=D;O==="inside"&&(J=0),O==="outside"&&(J*=2);var pe=(u+J+(F+K))/u,fe=(l+J+(F+K))/l,le=u*pe,ye=l*fe,se=i.nodeShapes[q].points,ue;if(p){var Ve=te(le,ye,q,se);ue=Ve.path}if(q==="ellipse")i.drawEllipsePath(ue||e,ee.x,ee.y,le,ye);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(q)){var Ae=0,st=0,Ke=0;q==="round-diamond"?Ae=(J+K+F)*1.4:q==="round-heptagon"?(Ae=(J+K+F)*1.075,Ke=-(J/2+K+F)/35):q==="round-hexagon"?Ae=(J+K+F)*1.12:q==="round-pentagon"?(Ae=(J+K+F)*1.13,Ke=-(J/2+K+F)/15):q==="round-tag"?(Ae=(J+K+F)*1.12,st=(J/2+F+K)*.07):q==="round-triangle"&&(Ae=(J+K+F)*(Math.PI/2),Ke=-(J+K/2+F)/Math.PI),Ae!==0&&(pe=(u+Ae)/u,le=u*pe,["round-hexagon","round-tag"].includes(q)||(fe=(l+Ae)/l,ye=l*fe)),$=$==="auto"?Cs(le,ye):$;for(var Fe=le/2,ut=ye/2,Ue=$+(J+F+K)/2,pt=new Array(se.length/2),bt=new Array(se.length/2),ct=0;ct0){if(r=r||n.position(),a==null||o==null){var h=n.padding();a=n.width()+2*h,o=n.height()+2*h}i.colorFillStyle(t,s[0],s[1],s[2],l),i.nodeShapes[c].draw(t,r.x,r.y,a+u*2,o+u*2,d),t.fill()}}}};Vn.drawNodeOverlay=Ko("overlay"),Vn.drawNodeUnderlay=Ko("underlay"),Vn.hasPie=function(e){return e=e[0],e._private.hasPie},Vn.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var a=t.cy().style(),o=t.pstyle("pie-size"),i=r.x,u=r.y,l=t.width(),s=t.height(),c=Math.min(l,s)/2,d=0,h=this.usePaths();h&&(i=0,u=0),o.units==="%"?c=c*o.pfValue:o.pfValue!==void 0&&(c=o.pfValue/2);for(var p=1;p<=a.pieBackgroundN;p++){var f=t.pstyle("pie-"+p+"-background-size").value,v=t.pstyle("pie-"+p+"-background-color").value,m=t.pstyle("pie-"+p+"-background-opacity").value*n,g=f/100;g+d>1&&(g=1-d);var y=1.5*Math.PI+2*Math.PI*d,b=2*Math.PI*g,w=y+b;f===0||d>=1||d+g>1||(e.beginPath(),e.moveTo(i,u),e.arc(i,u,c,y,w),e.closePath(),this.colorFillStyle(e,v[0],v[1],v[2],m),e.fill(),d+=g)}};var ft={},lv=100;ft.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},ft.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,a=0;ai.minMbLowQualFrames&&(i.motionBlurPxRatio=i.mbPxRBlurry)),i.clearingMotionBlur&&(i.motionBlurPxRatio=1),i.textureDrawLastFrame&&!d&&(c[i.NODE]=!0,c[i.SELECT_BOX]=!0);var y=l.style(),b=l.zoom(),w=a!==void 0?a:b,S=l.pan(),k={x:S.x,y:S.y},x={zoom:b,pan:{x:S.x,y:S.y}},C=i.prevViewport,T=C===void 0||x.zoom!==C.zoom||x.pan.x!==C.pan.x||x.pan.y!==C.pan.y;!T&&!(v&&!f)&&(i.motionBlurPxRatio=1),o&&(k=o),w*=u,k.x*=u,k.y*=u;var P=i.getCachedZSortedEles();function M(Z,oe,ae,de,ve){var be=Z.globalCompositeOperation;Z.globalCompositeOperation="destination-out",i.colorFillStyle(Z,255,255,255,i.motionBlurTransparency),Z.fillRect(oe,ae,de,ve),Z.globalCompositeOperation=be}function D(Z,oe){var ae,de,ve,be;!i.clearingMotionBlur&&(Z===s.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]||Z===s.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG])?(ae={x:S.x*p,y:S.y*p},de=b*p,ve=i.canvasWidth*p,be=i.canvasHeight*p):(ae=k,de=w,ve=i.canvasWidth,be=i.canvasHeight),Z.setTransform(1,0,0,1,0,0),oe==="motionBlur"?M(Z,0,0,ve,be):!t&&(oe===void 0||oe)&&Z.clearRect(0,0,ve,be),n||(Z.translate(ae.x,ae.y),Z.scale(de,de)),o&&Z.translate(o.x,o.y),a&&Z.scale(a,a)}if(d||(i.textureDrawLastFrame=!1),d){if(i.textureDrawLastFrame=!0,!i.textureCache){i.textureCache={},i.textureCache.bb=l.mutableElements().boundingBox(),i.textureCache.texture=i.data.bufferCanvases[i.TEXTURE_BUFFER];var B=i.data.bufferContexts[i.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,i.canvasWidth*i.textureMult,i.canvasHeight*i.textureMult),i.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:u*i.textureMult});var x=i.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:i.canvasWidth,height:i.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}c[i.DRAG]=!1,c[i.NODE]=!1;var _=s.contexts[i.NODE],N=i.textureCache.texture,x=i.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?M(_,0,0,x.width,x.height):_.clearRect(0,0,x.width,x.height);var A=y.core("outside-texture-bg-color").value,z=y.core("outside-texture-bg-opacity").value;i.colorFillStyle(_,A[0],A[1],A[2],z),_.fillRect(0,0,x.width,x.height);var b=l.zoom();D(_,!1),_.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),_.drawImage(N,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else i.textureOnViewport&&!t&&(i.textureCache=null);var O=l.extent(),R=i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming||i.hoverData.draggingEles||i.cy.animated(),Y=i.hideEdgesOnViewport&&R,V=[];if(V[i.NODE]=!c[i.NODE]&&h&&!i.clearedForMotionBlur[i.NODE]||i.clearingMotionBlur,V[i.NODE]&&(i.clearedForMotionBlur[i.NODE]=!0),V[i.DRAG]=!c[i.DRAG]&&h&&!i.clearedForMotionBlur[i.DRAG]||i.clearingMotionBlur,V[i.DRAG]&&(i.clearedForMotionBlur[i.DRAG]=!0),c[i.NODE]||n||r||V[i.NODE]){var F=h&&!V[i.NODE]&&p!==1,_=t||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]:s.contexts[i.NODE]),W=h&&!F?"motionBlur":void 0;D(_,W),Y?i.drawCachedNodes(_,P.nondrag,u,O):i.drawLayeredElements(_,P.nondrag,u,O),i.debug&&i.drawDebugPoints(_,P.nondrag),!n&&!h&&(c[i.NODE]=!1)}if(!r&&(c[i.DRAG]||n||V[i.DRAG])){var F=h&&!V[i.DRAG]&&p!==1,_=t||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]:s.contexts[i.DRAG]);D(_,h&&!F?"motionBlur":void 0),Y?i.drawCachedNodes(_,P.drag,u,O):i.drawCachedElements(_,P.drag,u,O),i.debug&&i.drawDebugPoints(_,P.drag),!n&&!h&&(c[i.DRAG]=!1)}if(i.showFps||!r&&c[i.SELECT_BOX]&&!n){var _=t||s.contexts[i.SELECT_BOX];if(D(_),i.selection[4]==1&&(i.hoverData.selecting||i.touchData.selecting)){var b=i.cy.zoom(),Q=y.core("selection-box-border-width").value/b;_.lineWidth=Q,_.fillStyle="rgba("+y.core("selection-box-color").value[0]+","+y.core("selection-box-color").value[1]+","+y.core("selection-box-color").value[2]+","+y.core("selection-box-opacity").value+")",_.fillRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]),Q>0&&(_.strokeStyle="rgba("+y.core("selection-box-border-color").value[0]+","+y.core("selection-box-border-color").value[1]+","+y.core("selection-box-border-color").value[2]+","+y.core("selection-box-opacity").value+")",_.strokeRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]))}if(s.bgActivePosistion&&!i.hoverData.selecting){var b=i.cy.zoom(),re=s.bgActivePosistion;_.fillStyle="rgba("+y.core("active-bg-color").value[0]+","+y.core("active-bg-color").value[1]+","+y.core("active-bg-color").value[2]+","+y.core("active-bg-opacity").value+")",_.beginPath(),_.arc(re.x,re.y,y.core("active-bg-size").pfValue/b,0,2*Math.PI),_.fill()}var K=i.lastRedrawTime;if(i.showFps&&K){K=Math.round(K);var $=Math.round(1e3/K);_.setTransform(1,0,0,1,0,0),_.fillStyle="rgba(255, 0, 0, 0.75)",_.strokeStyle="rgba(255, 0, 0, 0.75)",_.lineWidth=1,_.fillText("1 frame = "+K+" ms = "+$+" fps",0,20);var I=60;_.strokeRect(0,30,250,20),_.fillRect(0,30,250*Math.min($/I,1),20)}n||(c[i.SELECT_BOX]=!1)}if(h&&p!==1){var H=s.contexts[i.NODE],U=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE],te=s.contexts[i.DRAG],ce=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG],me=function(Z,oe,ae){Z.setTransform(1,0,0,1,0,0),ae||!g?Z.clearRect(0,0,i.canvasWidth,i.canvasHeight):M(Z,0,0,i.canvasWidth,i.canvasHeight);var de=p;Z.drawImage(oe,0,0,i.canvasWidth*de,i.canvasHeight*de,0,0,i.canvasWidth,i.canvasHeight)};(c[i.NODE]||V[i.NODE])&&(me(H,U,V[i.NODE]),c[i.NODE]=!1),(c[i.DRAG]||V[i.DRAG])&&(me(te,ce,V[i.DRAG]),c[i.DRAG]=!1)}i.prevViewport=x,i.clearingMotionBlur&&(i.clearingMotionBlur=!1,i.motionBlurCleared=!0,i.motionBlur=!0),h&&(i.motionBlurTimeout=setTimeout(function(){i.motionBlurTimeout=null,i.clearedForMotionBlur[i.NODE]=!1,i.clearedForMotionBlur[i.DRAG]=!1,i.motionBlur=!1,i.clearingMotionBlur=!d,i.mbFrames=0,c[i.NODE]=!0,c[i.DRAG]=!0,i.redraw()},lv)),t||l.emit("render")};var $t={};$t.drawPolygonPath=function(e,t,n,r,a,o){var i=r/2,u=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+i*o[0],n+u*o[1]);for(var l=1;l0&&i>0){p.clearRect(0,0,o,i),p.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)p.translate(-r.x1*s,-r.y1*s),p.scale(s,s),this.drawElements(p,f),p.scale(1/s,1/s),p.translate(r.x1*s,r.y1*s);else{var v=t.pan(),m={x:v.x*s,y:v.y*s};s*=t.zoom(),p.translate(m.x,m.y),p.scale(s,s),this.drawElements(p,f),p.scale(1/s,1/s),p.translate(-m.x,-m.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,o,i),p.fill())}return h};function uv(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),a=new Uint8Array(r),o=0;o"u"?"undefined":We(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),a=r.document;n=a.createElement("canvas"),n.width=e,n.height=t}return n},[wl,Nt,jt,oi,fn,Vn,ft,$t,Er,kl].forEach(function(e){ge(Se,e)});var hv=[{name:"null",impl:ul},{name:"base",impl:ml},{name:"canvas",impl:cv}],pv=[{type:"layout",extensions:bg},{type:"renderer",extensions:hv}],Dl={},Sl={};function _l(e,t,n){var r=n,a=function(x){Pe("Can not register `"+t+"` for `"+e+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(wr.prototype[t])return a(t);wr.prototype[t]=n}else if(e==="collection"){if(Je.prototype[t])return a(t);Je.prototype[t]=n}else if(e==="layout"){for(var o=function(x){this.options=x,n.call(this,x),ke(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},i=o.prototype=Object.create(n.prototype),u=[],l=0;l