import{an as Li}from"./index-BPLBgC-p.js";function We(r){"@babel/helpers - typeof";return We=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},We(r)}function ai(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qu(r,e){for(var t=0;tr.length)&&(e=r.length);for(var t=0,a=new Array(e);t=r.length?{done:!0}:{done:!1,value:r[a++]}},e:function(l){throw l},f:n}}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 i=!0,o=!1,s;return{s:function(){t=t.call(r)},n:function(){var l=t.next();return i=l.done,l},e:function(l){o=!0,s=l},f:function(){try{!i&&t.return!=null&&t.return()}finally{if(o)throw s}}}}var Ge=typeof window>"u"?null:window,Ri=Ge?Ge.navigator:null;Ge&&Ge.document;var Ku=We(""),Zo=We({}),Wu=We(function(){}),Uu=typeof HTMLElement>"u"?"undefined":We(HTMLElement),ba=function(e){return e&&e.instanceString&&Fe(e.instanceString)?e.instanceString():null},de=function(e){return e!=null&&We(e)==Ku},Fe=function(e){return e!=null&&We(e)===Wu},Re=function(e){return!gr(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Se=function(e){return e!=null&&We(e)===Zo&&!Re(e)&&e.constructor===Object},Yu=function(e){return e!=null&&We(e)===Zo},ne=function(e){return e!=null&&We(e)===We(1)&&!isNaN(e)},Xu=function(e){return ne(e)&&Math.floor(e)===e},Qa=function(e){if(Uu!=="undefined")return e!=null&&e instanceof HTMLElement},gr=function(e){return wa(e)||Qo(e)},wa=function(e){return ba(e)==="collection"&&e._private.single},Qo=function(e){return ba(e)==="collection"&&!e._private.single},ii=function(e){return ba(e)==="core"},Jo=function(e){return ba(e)==="stylesheet"},Zu=function(e){return ba(e)==="event"},Jr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Qu=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Ju=function(e){return Se(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},_u=function(e){return Yu(e)&&Fe(e.then)},ju=function(){return Ri&&Ri.userAgent.match(/msie|trident|edge/i)},ua=function(e,t){t||(t=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],o=0;ot?1:0},ol=function(e,t){return-1*jo(e,t)},be=Object.assign!=null?Object.assign.bind(Object):function(r){for(var e=arguments,t=1;t1&&(p-=1),p<1/6?d+(y-d)*6*p:p<1/2?y:p<2/3?d+(y-d)*(2/3-p)*6:d}var f=new RegExp("^"+tl+"$").exec(e);if(f){if(a=parseInt(f[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(f[2]),n<0||n>100||(n=n/100,i=parseFloat(f[3]),i<0||i>100)||(i=i/100,o=f[4],o!==void 0&&(o=parseFloat(o),o<0||o>1)))return;if(n===0)s=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,h=2*i-c;s=Math.round(255*v(h,c,a+1/3)),l=Math.round(255*v(h,c,a)),u=Math.round(255*v(h,c,a-1/3))}t=[s,l,u,o]}return t},ll=function(e){var t,a=new RegExp("^"+el+"$").exec(e);if(a){t=[];for(var n=[],i=1;i<=3;i++){var o=a[i];if(o[o.length-1]==="%"&&(n[i]=!0),o=parseFloat(o),n[i]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(s&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;t.push(u)}}return t},vl=function(e){return cl[e.toLowerCase()]},fl=function(e){return(Re(e)?e:null)||vl(e)||sl(e)||ll(e)||ul(e)},cl={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]},es=function(e){for(var t=e.map,a=e.keys,n=a.length,i=0;i=e||x<0||f&&D>=i}function g(){var E=Pn();if(p(E))return m(E);s=setTimeout(g,y(E))}function m(E){return s=void 0,c&&a?h(E):(a=n=void 0,o)}function b(){s!==void 0&&clearTimeout(s),u=0,a=l=n=s=void 0}function w(){return s===void 0?o:m(Pn())}function S(){var E=Pn(),x=p(E);if(a=arguments,n=this,l=E,x){if(s===void 0)return d(l);if(f)return clearTimeout(s),s=setTimeout(g,e),h(l)}return s===void 0&&(s=setTimeout(g,e)),o}return S.cancel=b,S.flush=w,S}var vn=Ql,Bn=Ge?Ge.performance:null,ns=Bn&&Bn.now?function(){return Bn.now()}:function(){return Date.now()},Jl=function(){if(Ge){if(Ge.requestAnimationFrame)return function(r){Ge.requestAnimationFrame(r)};if(Ge.mozRequestAnimationFrame)return function(r){Ge.mozRequestAnimationFrame(r)};if(Ge.webkitRequestAnimationFrame)return function(r){Ge.webkitRequestAnimationFrame(r)};if(Ge.msRequestAnimationFrame)return function(r){Ge.msRequestAnimationFrame(r)}}return function(r){r&&setTimeout(function(){r(ns())},1e3/60)}}(),Ja=function(e){return Jl(e)},qr=ns,Dt=9261,is=65599,ta=5381,os=function(e){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dt,a=t,n;n=e.next(),!n.done;)a=a*is+n.value|0;return a},la=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Dt;return t*is+e|0},va=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ta;return(t<<5)+t+e|0},_l=function(e,t){return e*2097152+t},Wr=function(e){return e[0]*2097152+e[1]},Ba=function(e,t){return[la(e[0],t[0]),va(e[1],t[1])]},jl=function(e,t){var a={value:0,done:!1},n=0,i=e.length,o={next:function(){return n=0;n--)e[n]===t&&e.splice(n,1)},li=function(e){e.splice(0,e.length)},ov=function(e,t){for(var a=0;a"u"?"undefined":We(Set))!==uv?Set:lv,fn=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||t===void 0||!ii(e)){Ve("An element must have a core reference and parameters set");return}var n=t.group;if(n==null&&(t.data&&t.data.source!=null&&t.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ve("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!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?n==="edges":!!t.pannable,active:!1,classes:new Ft,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),l=e.zoom();i.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];Re(t.classes)?u=t.classes:de(t.classes)&&(u=t.classes.split(/\s+/));for(var v=0,f=u.length;vm?1:0},v=function(g,m,b,w,S){var E;if(b==null&&(b=0),S==null&&(S=a),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=g.length);bM;0<=M?C++:C--)D.push(C);return D}).apply(this).reverse(),x=[],w=0,S=E.length;wP;0<=P?++D:--D)B.push(o(g,b));return B},y=function(g,m,b,w){var S,E,x;for(w==null&&(w=a),S=g[b];b>m;){if(x=b-1>>1,E=g[x],w(S,E)<0){g[b]=E,b=x;continue}break}return g[b]=S},p=function(g,m,b){var w,S,E,x,D;for(b==null&&(b=a),S=g.length,D=m,E=g[m],w=2*m+1;w0;){var E=m.pop(),x=p(E),D=E.id();if(c[D]=x,x!==1/0)for(var C=E.neighborhood().intersect(d),M=0;M0)for(I.unshift(R);f[$];){var F=f[$];I.unshift(F.edge),I.unshift(F.node),q=F.node,$=q.id()}return s.spawn(I)}}}},dv={kruskal:function(e){e=e||function(b){return 1};for(var t=this.byGroup(),a=t.nodes,n=t.edges,i=a.length,o=new Array(i),s=a,l=function(w){for(var S=0;S0;){if(S(),x++,w===v){for(var D=[],C=i,M=v,P=g[M];D.unshift(C),P!=null&&D.unshift(P),C=p[M],C!=null;)M=C.id(),P=g[M];return{found:!0,distance:f[w],path:this.spawn(D),steps:x}}h[w]=!0;for(var B=b._private.edges,L=0;LP&&(d[M]=P,m[M]=C,b[M]=S),!i){var B=C*v+D;!i&&d[B]>P&&(d[B]=P,m[B]=D,b[B]=S)}}}for(var L=0;L1&&arguments[1]!==void 0?arguments[1]:o,Pe=b(ve),Ee=[],xe=Pe;;){if(xe==null)return t.spawn();var Te=m(xe),J=Te.edge,T=Te.pred;if(Ee.unshift(xe[0]),xe.same(pe)&&Ee.length>0)break;J!=null&&Ee.unshift(J),xe=T}return l.spawn(Ee)},E=0;E=0;v--){var f=u[v],c=f[1],h=f[2];(t[c]===s&&t[h]===l||t[c]===l&&t[h]===s)&&u.splice(v,1)}for(var d=0;dn;){var i=Math.floor(Math.random()*t.length);t=xv(i,e,t),a--}return t},Ev={kargerStein:function(){var e=this,t=this.byGroup(),a=t.nodes,n=t.edges;n.unmergeBy(function(I){return I.isLoop()});var i=a.length,o=n.length,s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/wv);if(i<2){Ve("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],v=0;v1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=t;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,o=t;o1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(t,a):(a0&&e.splice(0,t));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];o?isFinite(u)||(e[l]=-1/0,s++):e.splice(l,1)}i&&e.sort(function(c,h){return c-h});var v=e.length,f=Math.floor(v/2);return v%2!==0?e[f+1+s]:(e[f-1+s]+e[f+s])/2},Pv=function(e){return Math.PI*e/180},Ma=function(e,t){return Math.atan2(t,e)-Math.PI/2},vi=Math.log2||function(r){return Math.log(r)/Math.log(2)},ds=function(e){return e>0?1:e<0?-1:0},ct=function(e,t){return Math.sqrt(it(e,t))},it=function(e,t){var a=t.x-e.x,n=t.y-e.y;return a*a+n*n},Bv=function(e){for(var t=e.length,a=0,n=0;n=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}}},Lv=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Av=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Rv=function(e,t,a){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},hs=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},Ov=function(e,t,a){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,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},$a=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},Ha=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,o;if(t.length===1)a=n=i=o=t[0];else if(t.length===2)a=i=t[0],o=n=t[1];else if(t.length===4){var s=Tr(t,4);a=s[0],n=s[1],i=s[2],o=s[3]}return e.x1-=o,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},$i=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},fi=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},Ot=function(e,t,a){return e.x1<=t&&t<=e.x2&&e.y1<=a&&a<=e.y2},Iv=function(e,t){return Ot(e,t.x,t.y)},gs=function(e,t){return Ot(e,t.x1,t.y1)&&Ot(e,t.x2,t.y2)},ps=function(e,t,a,n,i,o,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?dt(i,o):l,v=i/2,f=o/2;u=Math.min(u,v,f);var c=u!==v,h=u!==f,d;if(c){var y=a-v+u-s,p=n-f-s,g=a+v-u+s,m=p;if(d=Xr(e,t,a,n,y,p,g,m,!1),d.length>0)return d}if(h){var b=a+v+s,w=n-f+u-s,S=b,E=n+f-u+s;if(d=Xr(e,t,a,n,b,w,S,E,!1),d.length>0)return d}if(c){var x=a-v+u-s,D=n+f+s,C=a+v-u+s,M=D;if(d=Xr(e,t,a,n,x,D,C,M,!1),d.length>0)return d}if(h){var P=a-v-s,B=n-f+u-s,L=P,k=n+f-u+s;if(d=Xr(e,t,a,n,P,B,L,k,!1),d.length>0)return d}var O;{var A=a-v+u,R=n-f+u;if(O=aa(e,t,a,n,A,R,u+s),O.length>0&&O[0]<=A&&O[1]<=R)return[O[0],O[1]]}{var I=a+v-u,q=n-f+u;if(O=aa(e,t,a,n,I,q,u+s),O.length>0&&O[0]>=I&&O[1]<=q)return[O[0],O[1]]}{var $=a+v-u,F=n+f-u;if(O=aa(e,t,a,n,$,F,u+s),O.length>0&&O[0]>=$&&O[1]>=F)return[O[0],O[1]]}{var N=a-v+u,W=n+f-u;if(O=aa(e,t,a,n,N,W,u+s),O.length>0&&O[0]<=N&&O[1]>=W)return[O[0],O[1]]}return[]},zv=function(e,t,a,n,i,o,s){var l=s,u=Math.min(a,i),v=Math.max(a,i),f=Math.min(n,o),c=Math.max(n,o);return u-l<=e&&e<=v+l&&f-l<=t&&t<=c+l},Nv=function(e,t,a,n,i,o,s,l,u){var v={x1:Math.min(a,s,i)-u,x2:Math.max(a,s,i)+u,y1:Math.min(n,l,o)-u,y2:Math.max(n,l,o)+u};return!(ev.x2||tv.y2)},Fv=function(e,t,a,n){a-=n;var i=t*t-4*e*a;if(i<0)return[];var o=Math.sqrt(i),s=2*e,l=(-t+o)/s,u=(-t-o)/s;return[l,u]},Vv=function(e,t,a,n,i){var o=1e-5;e===0&&(e=o),t/=e,a/=e,n/=e;var s,l,u,v,f,c,h,d;if(l=(3*a-t*t)/9,u=-(27*n)+t*(9*a-2*(t*t)),u/=54,s=l*l*l+u*u,i[1]=0,h=t/3,s>0){f=u+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),c=u-Math.sqrt(s),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+f+c,h+=(f+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+f)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,s===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),d=2*Math.sqrt(l),i[0]=-h+d*Math.cos(v/3),i[2]=-h+d*Math.cos((v+2*Math.PI)/3),i[4]=-h+d*Math.cos((v+4*Math.PI)/3)},qv=function(e,t,a,n,i,o,s,l){var u=1*a*a-4*a*i+2*a*s+4*i*i-4*i*s+s*s+n*n-4*n*o+2*n*l+4*o*o-4*o*l+l*l,v=1*9*a*i-3*a*a-3*a*s-6*i*i+3*i*s+9*n*o-3*n*n-3*n*l-6*o*o+3*o*l,f=1*3*a*a-6*a*i+a*s-a*e+2*i*i+2*i*e-s*e+3*n*n-6*n*o+n*l-n*t+2*o*o+2*o*t-l*t,c=1*a*i-a*a+a*e-i*e+n*o-n*n+n*t-o*t,h=[];Vv(u,v,f,c,h);for(var d=1e-7,y=[],p=0;p<6;p+=2)Math.abs(h[p+1])=0&&h[p]<=1&&y.push(h[p]);y.push(1),y.push(0);for(var g=-1,m,b,w,S=0;S=0?wu?(e-i)*(e-i)+(t-o)*(t-o):v-c},dr=function(e,t,a){for(var n,i,o,s,l,u=0,v=0;v=e&&e>=o||n<=e&&e<=o)l=(e-n)/(o-n)*(s-i)+i,l>t&&u++;else continue;return u%2!==0},$r=function(e,t,a,n,i,o,s,l,u){var v=new Array(a.length),f;l[0]!=null?(f=Math.atan(l[1]/l[0]),l[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=l;for(var c=Math.cos(-f),h=Math.sin(-f),d=0;d0){var p=en(v,-u);y=ja(p)}else y=v;return dr(e,t,y)},Hv=function(e,t,a,n,i,o,s,l){for(var u=new Array(a.length*2),v=0;v=0&&p<=1&&m.push(p),g>=0&&g<=1&&m.push(g),m.length===0)return[];var b=m[0]*l[0]+e,w=m[0]*l[1]+t;if(m.length>1){if(m[0]==m[1])return[b,w];var S=m[1]*l[0]+e,E=m[1]*l[1]+t;return[b,w,S,E]}else return[b,w]},Ln=function(e,t,a){return t<=e&&e<=a||a<=e&&e<=t?e:e<=t&&t<=a||a<=t&&t<=e?t:a},Xr=function(e,t,a,n,i,o,s,l,u){var v=e-i,f=a-e,c=s-i,h=t-o,d=n-t,y=l-o,p=c*h-y*v,g=f*h-d*v,m=y*f-c*d;if(m!==0){var b=p/m,w=g/m,S=.001,E=0-S,x=1+S;return E<=b&&b<=x&&E<=w&&w<=x?[e+b*f,t+b*d]:u?[e+b*f,t+b*d]:[]}else return p===0||g===0?Ln(e,a,s)===s?[s,l]:Ln(e,a,i)===i?[i,o]:Ln(i,s,a)===a?[a,n]:[]:[]},da=function(e,t,a,n,i,o,s,l){var u=[],v,f=new Array(a.length),c=!0;o==null&&(c=!1);var h;if(c){for(var d=0;d0){var y=en(f,-l);h=ja(y)}else h=f}else h=a;for(var p,g,m,b,w=0;w2){for(var d=[v[0],v[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-t,2),p=1;pv&&(v=w)},get:function(b){return u[b]}},c=0;c0?A=O.edgesTo(k)[0]:A=k.edgesTo(O)[0];var R=n(A);k=k.id(),D[k]>D[B]+R&&(D[k]=D[B]+R,C.nodes.indexOf(k)<0?C.push(k):C.updateItem(k),x[k]=0,E[k]=[]),D[k]==D[B]+R&&(x[k]=x[k]+x[B],E[k].push(B))}else for(var I=0;I0;){for(var N=S.pop(),W=0;W0&&s.push(a[l]);s.length!==0&&i.push(n.collection(s))}return i},nf=function(e,t){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:uf,s=n,l,u,v=0;v=2?Jt(e,t,a,0,Ui,lf):Jt(e,t,a,0,Wi)},squaredEuclidean:function(e,t,a){return Jt(e,t,a,0,Ui)},manhattan:function(e,t,a){return Jt(e,t,a,0,Wi)},max:function(e,t,a){return Jt(e,t,a,-1/0,vf)}};It["squared-euclidean"]=It.squaredEuclidean;It.squaredeuclidean=It.squaredEuclidean;function dn(r,e,t,a,n,i){var o;return Fe(r)?o=r:o=It[r]||It.euclidean,e===0&&Fe(r)?o(n,i):o(e,t,a,n,i)}var ff=er({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),di=function(e){return ff(e)},rn=function(e,t,a,n,i){var o=i!=="kMedoids",s=o?function(f){return a[f]}:function(f){return n[f](a)},l=function(c){return n[c](t)},u=a,v=t;return dn(e,n.length,s,l,u,v)},An=function(e,t,a){for(var n=a.length,i=new Array(n),o=new Array(n),s=new Array(t),l=null,u=0;ua)return!1}return!0},hf=function(e,t,a){for(var n=0;ns&&(s=t[u][v],l=v);i[l].push(e[u])}for(var f=0;f=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=t[o],y=t[n[o]],p;i.mode==="dendrogram"?p={left:d,right:y,key:d.key}:p={value:d.value.concat(y.value),key:d.key},e[d.index]=p,e.splice(y.index,1),t[d.key]=p;for(var g=0;ga[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]0&&n.push(i);return n},_i=function(e,t,a){for(var n=[],i=0;is&&(o=u,s=t[i*e+u])}o>0&&n.push(o)}for(var v=0;vu&&(l=v,u=f)}a[i]=o[l]}return n=_i(e,t,a),n},ji=function(e){for(var t=this.cy(),a=this.nodes(),n=Pf(e),i={},o=0;o=P?(B=P,P=k,L=O):k>B&&(B=k);for(var A=0;A0?1:0;x[C%n.minIterations*s+N]=W,F+=W}if(F>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var Q=0,_=0;_1||E>1)&&(s=!0),f[b]=[],m.outgoers().forEach(function(D){D.isEdge()&&f[b].push(D.id())})}else c[b]=[void 0,m.target().id()]}):o.forEach(function(m){var b=m.id();if(m.isNode()){var w=m.degree(!0);w%2&&(l?u?s=!0:u=b:l=b),f[b]=[],m.connectedEdges().forEach(function(S){return f[b].push(S.id())})}else c[b]=[m.source().id(),m.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(u&&l)if(i){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=o[0].id());var d=function(b){for(var w=b,S=[b],E,x,D;f[w].length;)E=f[w].shift(),x=c[E][0],D=c[E][1],w!=D?(f[D]=f[D].filter(function(C){return C!=E}),w=D):!i&&w!=x&&(f[x]=f[x].filter(function(C){return C!=E}),w=x),S.unshift(E),S.unshift(w);return S},y=[],p=[];for(p=d(v);p.length!=1;)f[p[0]].length==0?(y.unshift(o.getElementById(p.shift())),y.unshift(o.getElementById(p.shift()))):p=d(p.shift()).concat(p);y.unshift(o.getElementById(p.shift()));for(var g in f)if(f[g].length)return h;return h.found=!0,h.trail=this.spawn(y,!0),h}},Ra=function(){var e=this,t={},a=0,n=0,i=[],o=[],s={},l=function(c,h){for(var d=o.length-1,y=[],p=e.spawn();o[d].x!=c||o[d].y!=h;)y.push(o.pop().edge),d--;y.push(o.pop().edge),y.forEach(function(g){var m=g.connectedNodes().intersection(e);p.merge(g),m.forEach(function(b){var w=b.id(),S=b.connectedEdges().intersection(e);p.merge(b),t[w].cutVertex?p.merge(S.filter(function(E){return E.isLoop()})):p.merge(S)})}),i.push(p)},u=function f(c,h,d){c===d&&(n+=1),t[h]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(h).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(h)));else{var p,g,m,b;y.forEach(function(w){p=w.source().id(),g=w.target().id(),m=p===h?g:p,m!==d&&(b=w.id(),s[b]||(s[b]=!0,o.push({x:h,y:m,edge:w})),m in t?t[h].low=Math.min(t[h].low,t[m].id):(f(c,m,h),t[h].low=Math.min(t[h].low,t[m].low),t[h].id<=t[m].low&&(t[h].cutVertex=!0,l(h,m))))})}};e.forEach(function(f){if(f.isNode()){var c=f.id();c in t||(n=0,u(c,c),t[c].cutVertex=n>1)}});var v=Object.keys(t).filter(function(f){return t[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:i}},zf={hopcroftTarjanBiconnected:Ra,htbc:Ra,htb:Ra,hopcroftTarjanBiconnectedComponents:Ra},Oa=function(){var e=this,t={},a=0,n=[],i=[],o=e.spawn(e),s=function l(u){i.push(u),t[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(y){var p=y.target().id();p!==u&&(p in t||l(p),t[p].explored||(t[u].low=Math.min(t[u].low,t[p].low)))}),t[u].index===t[u].low){for(var f=e.spawn();;){var c=i.pop();if(f.merge(e.getElementById(c)),t[c].low=t[u].index,t[c].explored=!0,c===u)break}var h=f.edgesWith(f),d=f.merge(h);n.push(d),o=o.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in t||s(u)}}),{cut:o,components:n}},Nf={tarjanStronglyConnected:Oa,tsc:Oa,tscc:Oa,tarjanStronglyConnectedComponents:Oa},Cs={};[fa,cv,dv,gv,yv,bv,Ev,Yv,Mt,Lt,Gn,sf,wf,Df,Rf,If,zf,Nf].forEach(function(r){be(Cs,r)});/*! Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) Licensed under The MIT License (http://opensource.org/licenses/MIT) */var Ss=0,Ts=1,Ds=2,Hr=function r(e){if(!(this instanceof r))return new r(e);this.id="Thenable/1.0.7",this.state=Ss,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};Hr.prototype={fulfill:function(e){return eo(this,Ts,"fulfillValue",e)},reject:function(e){return eo(this,Ds,"rejectReason",e)},then:function(e,t){var a=this,n=new Hr;return a.onFulfilled.push(to(e,n,"fulfill")),a.onRejected.push(to(t,n,"reject")),ks(a),n.proxy}};var eo=function(e,t,a,n){return e.state===Ss&&(e.state=t,e[a]=n,ks(e)),e},ks=function(e){e.state===Ts?ro(e,"onFulfilled",e.fulfillValue):e.state===Ds&&ro(e,"onRejected",e.rejectReason)},ro=function(e,t,a){if(e[t].length!==0){var n=e[t];e[t]=[];var i=function(){for(var s=0;s0}},clearQueue:function(){return function(){var t=this,a=t.length!==void 0,n=a?t:[t],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var o=0;o-1}var Kc=Gc;function Wc(r,e){var t=this.__data__,a=gn(t,r);return a<0?(++this.size,t.push([r,e])):t[a][1]=e,this}var Uc=Wc;function $t(r){var e=-1,t=r==null?0:r.length;for(this.clear();++e-1&&r%1==0&&r0&&this.spawn(n).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){Re(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=t===void 0,i=[],o=0,s=a.length;o0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var a=this;if(t==null)t=250;else if(t===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},t),a}};Ga.className=Ga.classNames=Ga.classes;var Ce={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Ke,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ce.variable="(?:[\\w-.]|(?:\\\\"+Ce.metaChar+"))+";Ce.className="(?:[\\w-]|(?:\\\\"+Ce.metaChar+"))+";Ce.value=Ce.string+"|"+Ce.number;Ce.id=Ce.variable;(function(){var r,e,t;for(r=Ce.comparatorOp.split("|"),t=0;t=0)&&e!=="="&&(Ce.comparatorOp+="|\\!"+e)})();var Le=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},Wn=[{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(r,e){return ol(r.selector,e.selector)}),Qd=function(){for(var r={},e,t=0;t0&&v.edgeCount>0)return Me("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Me("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Me("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},th=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},t=function(v){return de(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var c=v.type,h=v.value;switch(c){case se.GROUP:{var d=e(h);return d.substring(0,d.length-1)}case se.DATA_COMPARE:{var y=v.field,p=v.operator;return"["+y+a(e(p))+t(h)+"]"}case se.DATA_BOOL:{var g=v.operator,m=v.field;return"["+e(g)+m+"]"}case se.DATA_EXIST:{var b=v.field;return"["+b+"]"}case se.META_COMPARE:{var w=v.operator,S=v.field;return"[["+S+a(e(w))+t(h)+"]]"}case se.STATE:return h;case se.ID:return"#"+h;case se.CLASS:return"."+h;case se.PARENT:case se.CHILD:return i(v.parent,f)+a(">")+i(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return i(v.ancestor,f)+" "+i(v.descendant,f);case se.COMPOUND_SPLIT:{var E=i(v.left,f),x=i(v.subject,f),D=i(v.right,f);return E+(E.length>0?" ":"")+x+D}case se.TRUE:return""}},i=function(v,f){return v.checks.reduce(function(c,h,d){return c+(f===v&&d===0?"$":"")+n(h,f)},"")},o="",s=0;s1&&s=0&&(t=t.replace("!",""),f=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),v=!0),(i||s||v)&&(l=!i&&!o?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),t){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var v=n.shift();e(v),i.add(v.id()),s&&a(n,i,v)}return r}function zs(r,e,t){if(t.isParent())for(var a=t._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,zs)};function Ns(r,e,t){if(t.isChild()){var a=t._private.parent;e.has(a.id())||r.push(a)}}zt.forEachUp=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,Ns)};function vh(r,e,t){Ns(r,e,t),zs(r,e,t)}zt.forEachUpAndDown=function(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return mi(this,r,e,vh)};zt.ancestors=zt.parents;var ga,Fs;ga=Fs={data:Be.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:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Be.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Be.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ga.attr=ga.data;ga.removeAttr=ga.removeData;var fh=Fs,yn={};function On(r){return function(e){var t=this;if(e===void 0&&(e=!0),t.length!==0)if(t.isNode()&&!t.removed()){for(var a=0,n=t[0],i=n._private.edges,o=0;oe}),minIndegree:xt("indegree",function(r,e){return re}),minOutdegree:xt("outdegree",function(r,e){return re})});be(yn,{totalDegree:function(e){for(var t=0,a=this.nodes(),n=0;n0,c=f;f&&(v=v[0]);var h=c?v.position():{x:0,y:0};t!==void 0?u.position(e,t+h[e]):i!==void 0&&u.position({x:i.x+h.x,y:i.y+h.y})}else{var d=a.position(),y=s?a.parent():null,p=y&&y.length>0,g=p;p&&(y=y[0]);var m=g?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!o)return;return this}};Pr.modelPosition=Pr.point=Pr.position;Pr.modelPositions=Pr.points=Pr.positions;Pr.renderedPoint=Pr.renderedPosition;Pr.relativePoint=Pr.relativePosition;var ch=Vs,At,tt;At=tt={};tt.renderedBoundingBox=function(r){var e=this.boundingBox(r),t=this.cy(),a=t.zoom(),n=t.pan(),i=e.x1*a+n.x,o=e.x2*a+n.x,s=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}};tt.dirtyCompoundBoundsCache=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(t){if(t.isParent()){var a=t._private;a.compoundBoundsClean=!1,a.bbCache=null,r||t.emitAndNotify("bounds")}}),this)};tt.updateCompoundBounds=function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!r&&e.batching())return this;function t(o){if(!o.isParent())return;var s=o._private,l=o.children(),u=o.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:o.pstyle("min-width").pfValue,left:o.pstyle("min-width-bias-left"),right:o.pstyle("min-width-bias-right")},height:{val:o.pstyle("min-height").pfValue,top:o.pstyle("min-height-bias-top"),bottom:o.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=s.position;(f.w===0||f.h===0)&&(f={w:o.pstyle("width").pfValue,h:o.pstyle("height").pfValue},f.x1=c.x-f.w/2,f.x2=c.x+f.w/2,f.y1=c.y-f.h/2,f.y2=c.y+f.h/2);function h(C,M,P){var B=0,L=0,k=M+P;return C>0&&k>0&&(B=M/k*C,L=P/k*C),{biasDiff:B,biasComplementDiff:L}}function d(C,M,P,B){if(P.units==="%")switch(B){case"width":return C>0?P.pfValue*C:0;case"height":return M>0?P.pfValue*M:0;case"average":return C>0&&M>0?P.pfValue*(C+M)/2:0;case"min":return C>0&&M>0?C>M?P.pfValue*M:P.pfValue*C:0;case"max":return C>0&&M>0?C>M?P.pfValue*C:P.pfValue*M:0;default:return 0}else return P.units==="px"?P.pfValue:0}var y=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(y=y*100/v.width.val);var p=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(p=p*100/v.width.val);var g=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(g=g*100/v.height.val);var m=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(m=m*100/v.height.val);var b=h(v.width.val-f.w,y,p),w=b.biasDiff,S=b.biasComplementDiff,E=h(v.height.val-f.h,g,m),x=E.biasDiff,D=E.biasComplementDiff;s.autoPadding=d(f.w,f.h,o.pstyle("padding"),o.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),c.x=(-w+f.x1+f.x2+S)/2,s.autoHeight=Math.max(f.h,v.height.val),c.y=(-x+f.y1+f.y2+D)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ot=function(e,t){return t==null?e:Dr(e,t.x1,t.y1,t.x2,t.y2)},_t=function(e,t,a){return kr(e,t,a)},Ia=function(e,t,a){if(!t.cy().headless()){var n=t._private,i=n.rstyle,o=i.arrowWidth/2,s=t.pstyle(a+"-arrow-shape").value,l,u;if(s!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-o,f.y1=u-o,f.x2=l+o,f.y2=u+o,f.w=f.x2-f.x1,f.h=f.y2-f.y1,$a(f,1),Dr(e,f.x1,f.y1,f.x2,f.y2)}}},In=function(e,t,a){if(!t.cy().headless()){var n;a?n=a+"-":n="";var i=t._private,o=i.rstyle,s=t.pstyle(n+"label").strValue;if(s){var l=t.pstyle("text-halign"),u=t.pstyle("text-valign"),v=_t(o,"labelWidth",a),f=_t(o,"labelHeight",a),c=_t(o,"labelX",a),h=_t(o,"labelY",a),d=t.pstyle(n+"text-margin-x").pfValue,y=t.pstyle(n+"text-margin-y").pfValue,p=t.isEdge(),g=t.pstyle(n+"text-rotation"),m=t.pstyle("text-outline-width").pfValue,b=t.pstyle("text-border-width").pfValue,w=b/2,S=t.pstyle("text-background-padding").pfValue,E=2,x=f,D=v,C=D/2,M=x/2,P,B,L,k;if(p)P=c-C,B=c+C,L=h-M,k=h+M;else{switch(l.value){case"left":P=c-D,B=c;break;case"center":P=c-C,B=c+C;break;case"right":P=c,B=c+D;break}switch(u.value){case"top":L=h-x,k=h;break;case"center":L=h-M,k=h+M;break;case"bottom":L=h,k=h+x;break}}P+=d-Math.max(m,w)-S-E,B+=d+Math.max(m,w)+S+E,L+=y-Math.max(m,w)-S-E,k+=y+Math.max(m,w)+S+E;var O=a||"main",A=i.labelBounds,R=A[O]=A[O]||{};R.x1=P,R.y1=L,R.x2=B,R.y2=k,R.w=B-P,R.h=k-L;var I=p&&g.strValue==="autorotate",q=g.pfValue!=null&&g.pfValue!==0;if(I||q){var $=I?_t(i.rstyle,"labelAngle",a):g.pfValue,F=Math.cos($),N=Math.sin($),W=(P+B)/2,Q=(L+k)/2;if(!p){switch(l.value){case"left":W=B;break;case"right":W=P;break}switch(u.value){case"top":Q=k;break;case"bottom":Q=L;break}}var _=function(he,ae){return he=he-W,ae=ae-Q,{x:he*F-ae*N+W,y:he*N+ae*F+Q}},j=_(P,L),ee=_(P,k),U=_(B,L),z=_(B,k);P=Math.min(j.x,ee.x,U.x,z.x),B=Math.max(j.x,ee.x,U.x,z.x),L=Math.min(j.y,ee.y,U.y,z.y),k=Math.max(j.y,ee.y,U.y,z.y)}var Y=O+"Rot",X=A[Y]=A[Y]||{};X.x1=P,X.y1=L,X.x2=B,X.y2=k,X.w=B-P,X.h=k-L,Dr(e,P,L,B,k),Dr(i.labelBounds.all,P,L,B,k)}return e}},dh=function(e,t){if(!t.cy().headless()){var a=t.pstyle("outline-opacity").value,n=t.pstyle("outline-width").value;if(a>0&&n>0){var i=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,s=n+i,l=(e.w+s*2)/e.w,u=(e.h+s*2)/e.h,v=0,f=0;["diamond","pentagon","round-triangle"].includes(o)?(l=(e.w+s*2.4)/e.w,f=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?l=(e.w+s*2.4)/e.w:o==="star"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.6)/e.h,f=-s/3.8):o==="triangle"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.4)/e.h,f=-s/1.4):o==="vee"&&(l=(e.w+s*4.4)/e.w,u=(e.h+s*3.8)/e.h,f=-s*.5);var c=e.h*u-e.h,h=e.w*l-e.w;if(Ha(e,[Math.ceil(c/2),Math.ceil(h/2)]),v!=0||f!==0){var d=Rv(e,v,f);hs(e,d)}}}},hh=function(e,t){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),o=hr(),s=e._private,l=e.isNode(),u=e.isEdge(),v,f,c,h,d,y,p=s.rstyle,g=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(ue){return ue.pstyle("display").value!=="none"},b=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(b){var w=0,S=0;n&&t.includeOverlays&&(w=e.pstyle("overlay-opacity").value,w!==0&&(S=e.pstyle("overlay-padding").value));var E=0,x=0;n&&t.includeUnderlays&&(E=e.pstyle("underlay-opacity").value,E!==0&&(x=e.pstyle("underlay-padding").value));var D=Math.max(S,x),C=0,M=0;if(n&&(C=e.pstyle("width").pfValue,M=C/2),l&&t.includeNodes){var P=e.position();d=P.x,y=P.y;var B=e.outerWidth(),L=B/2,k=e.outerHeight(),O=k/2;v=d-L,f=d+L,c=y-O,h=y+O,Dr(o,v,c,f,h),n&&t.includeOutlines&&dh(o,e)}else if(u&&t.includeEdges)if(n&&!i){var A=e.pstyle("curve-style").strValue;if(v=Math.min(p.srcX,p.midX,p.tgtX),f=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),h=Math.max(p.srcY,p.midY,p.tgtY),v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h),A==="haystack"){var R=p.haystackPts;if(R&&R.length===2){if(v=R[0].x,c=R[0].y,f=R[1].x,h=R[1].y,v>f){var I=v;v=f,f=I}if(c>h){var q=c;c=h,h=q}Dr(o,v-M,c-M,f+M,h+M)}}else if(A==="bezier"||A==="unbundled-bezier"||A.endsWith("segments")||A.endsWith("taxi")){var $;switch(A){case"bezier":case"unbundled-bezier":$=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":$=p.linePts;break}if($!=null)for(var F=0;F<$.length;F++){var N=$[F];v=N.x-M,f=N.x+M,c=N.y-M,h=N.y+M,Dr(o,v,c,f,h)}}}else{var W=e.source(),Q=W.position(),_=e.target(),j=_.position();if(v=Q.x,f=j.x,c=Q.y,h=j.y,v>f){var ee=v;v=f,f=ee}if(c>h){var U=c;c=h,h=U}v-=M,f+=M,c-=M,h+=M,Dr(o,v,c,f,h)}if(n&&t.includeEdges&&u&&(Ia(o,e,"mid-source"),Ia(o,e,"mid-target"),Ia(o,e,"source"),Ia(o,e,"target")),n){var z=e.pstyle("ghost").value==="yes";if(z){var Y=e.pstyle("ghost-offset-x").pfValue,X=e.pstyle("ghost-offset-y").pfValue;Dr(o,o.x1+Y,o.y1+X,o.x2+Y,o.y2+X)}}var oe=s.bodyBounds=s.bodyBounds||{};$i(oe,o),Ha(oe,g),$a(oe,1),n&&(v=o.x1,f=o.x2,c=o.y1,h=o.y2,Dr(o,v-D,c-D,f+D,h+D));var he=s.overlayBounds=s.overlayBounds||{};$i(he,o),Ha(he,g),$a(he,1);var ae=s.labelBounds=s.labelBounds||{};ae.all!=null?Av(ae.all):ae.all=hr(),n&&t.includeLabels&&(t.includeMainLabels&&In(o,e,null),u&&(t.includeSourceLabels&&In(o,e,"source"),t.includeTargetLabels&&In(o,e,"target")))}return o.x1=br(o.x1),o.y1=br(o.y1),o.x2=br(o.x2),o.y2=br(o.y2),o.w=br(o.x2-o.x1),o.h=br(o.y2-o.y1),o.w>0&&o.h>0&&b&&(Ha(o,g),$a(o,1)),o},$s=function(e){var t=0,a=function(o){return(o?1:0)<0&&arguments[0]!==void 0?arguments[0]:Bh,e=arguments.length>1?arguments[1]:void 0,t=0;t=0;s--)o(s);return this};rt.removeAllListeners=function(){return this.removeListener("*")};rt.emit=rt.trigger=function(r,e,t){var a=this.listeners,n=a.length;return this.emitting++,Re(e)||(e=[e]),Mh(this,function(i,o){t!=null&&(a=[{event:o.event,type:o.type,namespace:o.namespace,callback:t}],n=a.length);for(var s=function(v){var f=a[v];if(f.type===o.type&&(!f.namespace||f.namespace===o.namespace||f.namespace===Ph)&&i.eventMatches(i.context,f,o)){var c=[o];e!=null&&ov(c,e),i.beforeEmit(i.context,f,o),f.conf&&f.conf.one&&(i.listeners=i.listeners.filter(function(y){return y!==f}));var h=i.callbackContext(i.context,f,o),d=f.callback.apply(h,c);i.afterEmit(i.context,f,o),d===!1&&(o.stopPropagation(),o.preventDefault())}},l=0;l1&&!o){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,a=e._private.data.id,n=t.map,i=n.get(a);if(!i)return this;var o=i.index;return this.unmergeAt(o),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&de(e)){var a=e;e=t.mutableElements().filter(a)}for(var n=0;n=0;t--){var a=this[t];e(a)&&this.unmergeAt(t)}return this},map:function(e,t){for(var a=[],n=this,i=0;ia&&(a=l,n=s)}return{value:a,ele:n}},min:function(e,t){for(var a=1/0,n,i=this,o=0;o=0&&i"u"?"undefined":We(Symbol))!=e&&We(Symbol.iterator)!=e;t&&(tn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,o=this.length;return Uo({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(t?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var a=t.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.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 a=this[0];if(a)return t.style().getRenderedStyle(a,e)},style:function(e,t){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Se(e)){var o=e;i.applyBypass(this,o,n),this.emitAndNotify("style")}else if(de(e))if(t===void 0){var s=this[0];return s?i.getStylePropertyValue(s,e):void 0}else i.applyBypass(this,e,t,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var a=!1,n=t.style(),i=this;if(e===void 0)for(var o=0;o0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(r)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});nr.neighbourhood=nr.neighborhood;nr.closedNeighbourhood=nr.closedNeighborhood;nr.openNeighbourhood=nr.openNeighborhood;be(nr,{source:wr(function(e){var t=this[0],a;return t&&(a=t._private.source||t.cy().collection()),a&&e?a.filter(e):a},"source"),target:wr(function(e){var t=this[0],a;return t&&(a=t._private.target||t.cy().collection()),a&&e?a.filter(e):a},"target"),sources:wo({attr:"source"}),targets:wo({attr:"target"})});function wo(r){return function(t){for(var a=[],n=0;n0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});nr.componentsOf=nr.components;var je=function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ve("A collection must have a reference to the core");return}var i=new Or,o=!1;if(!t)t=[];else if(t.length>0&&Se(t[0])&&!wa(t[0])){o=!0;for(var s=[],l=new Ft,u=0,v=t.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=t.cy(),n=a._private,i=[],o=[],s,l=0,u=t.length;l0){for(var q=s.length===t.length?t:new je(a,s),$=0;$0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,t=this,a=[],n={},i=t._private.cy;function o(k){for(var O=k._private.edges,A=0;A0&&(r?P.emitAndNotify("remove"):e&&P.emit("remove"));for(var B=0;B0?B=k:P=k;while(Math.abs(L)>o&&++O=i?m(M,O):A===0?O:w(M,P,P+u)}var E=!1;function x(){E=!0,(r!==e||t!==a)&&b()}var D=function(P){return E||x(),r===e&&t===a?P:P===0?0:P===1?1:p(S(P),e,a)};D.getControlPoints=function(){return[{x:r,y:e},{x:t,y:a}]};var C="generateBezier("+[r,e,t,a]+")";return D.toString=function(){return C},D}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var $h=function(){function r(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var o={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:o.v,dv:r(o)}}function t(a,n){var i={dx:a.v,dv:r(a)},o=e(a,n*.5,i),s=e(a,n*.5,o),l=e(a,n,s),u=1/6*(i.dx+2*(o.dx+s.dx)+l.dx),v=1/6*(i.dv+2*(o.dv+s.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,i,o){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=16/1e3,c,h,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,o=o||null,s.tension=n,s.friction=i,c=o!==null,c?(u=a(n,i),h=u/o*f):h=f;d=t(d||s,h),l.push(1+d.x),u+=16,Math.abs(d.x)>v&&Math.abs(d.v)>v;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),Oe=function(e,t,a,n){var i=qh(e,t,a,n);return function(o,s,l){return o+(s-o)*i(l)}},Wa={linear:function(e,t,a){return e+(t-e)*a},ease:Oe(.25,.1,.25,1),"ease-in":Oe(.42,0,1,1),"ease-out":Oe(0,0,.58,1),"ease-in-out":Oe(.42,0,.58,1),"ease-in-sine":Oe(.47,0,.745,.715),"ease-out-sine":Oe(.39,.575,.565,1),"ease-in-out-sine":Oe(.445,.05,.55,.95),"ease-in-quad":Oe(.55,.085,.68,.53),"ease-out-quad":Oe(.25,.46,.45,.94),"ease-in-out-quad":Oe(.455,.03,.515,.955),"ease-in-cubic":Oe(.55,.055,.675,.19),"ease-out-cubic":Oe(.215,.61,.355,1),"ease-in-out-cubic":Oe(.645,.045,.355,1),"ease-in-quart":Oe(.895,.03,.685,.22),"ease-out-quart":Oe(.165,.84,.44,1),"ease-in-out-quart":Oe(.77,0,.175,1),"ease-in-quint":Oe(.755,.05,.855,.06),"ease-out-quint":Oe(.23,1,.32,1),"ease-in-out-quint":Oe(.86,0,.07,1),"ease-in-expo":Oe(.95,.05,.795,.035),"ease-out-expo":Oe(.19,1,.22,1),"ease-in-out-expo":Oe(1,0,0,1),"ease-in-circ":Oe(.6,.04,.98,.335),"ease-out-circ":Oe(.075,.82,.165,1),"ease-in-out-circ":Oe(.785,.135,.15,.86),spring:function(e,t,a){if(a===0)return Wa.linear;var n=$h(e,t,a);return function(i,o,s){return i+(o-i)*n(s)}},"cubic-bezier":Oe};function Co(r,e,t,a,n){if(a===1||e===t)return t;var i=n(e,t,a);return r==null||((r.roundValue||r.color)&&(i=Math.round(i)),r.min!==void 0&&(i=Math.max(i,r.min)),r.max!==void 0&&(i=Math.min(i,r.max))),i}function So(r,e){return r.pfValue!=null||r.value!=null?r.pfValue!=null&&(e==null||e.type.units!=="%")?r.pfValue:r.value:r}function Et(r,e,t,a,n){var i=n!=null?n.type:null;t<0?t=0:t>1&&(t=1);var o=So(r,n),s=So(e,n);if(ne(o)&&ne(s))return Co(i,o,s,t,a);if(Re(o)&&Re(s)){for(var l=[],u=0;u0?(h==="spring"&&d.push(o.duration),o.easingImpl=Wa[h].apply(null,d)):o.easingImpl=Wa[h]}var y=o.easingImpl,p;if(o.duration===0?p=1:p=(t-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),o.delay==null){var g=o.startPosition,m=o.position;if(m&&n&&!r.locked()){var b={};ea(g.x,m.x)&&(b.x=Et(g.x,m.x,p,y)),ea(g.y,m.y)&&(b.y=Et(g.y,m.y,p,y)),r.position(b)}var w=o.startPan,S=o.pan,E=i.pan,x=S!=null&&a;x&&(ea(w.x,S.x)&&(E.x=Et(w.x,S.x,p,y)),ea(w.y,S.y)&&(E.y=Et(w.y,S.y,p,y)),r.emit("pan"));var D=o.startZoom,C=o.zoom,M=C!=null&&a;M&&(ea(D,C)&&(i.zoom=ca(i.minZoom,Et(D,C,p,y),i.maxZoom)),r.emit("zoom")),(x||M)&&r.emit("viewport");var P=o.style;if(P&&P.length>0&&n){for(var B=0;B=0;x--){var D=E[x];D()}E.splice(0,E.length)},m=h.length-1;m>=0;m--){var b=h[m],w=b._private;if(w.stopped){h.splice(m,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||Gh(v,b,r),Hh(v,b,r,f),w.applying&&(w.applying=!1),g(w.frames),w.step!=null&&w.step(r),b.completed()&&(h.splice(m,1),w.hooked=!1,w.playing=!1,w.started=!1,g(w.completes)),y=!0)}return!f&&h.length===0&&d.length===0&&a.push(v),y}for(var i=!1,o=0;o0?e.notify("draw",t):e.notify("draw")),t.unmerge(a),e.emit("step")}var Kh={animate:Be.animate(),animation:Be.animation(),animated:Be.animated(),clearQueue:Be.clearQueue(),delay:Be.delay(),delayAnimation:Be.delayAnimation(),stop:Be.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&&Ja(function(i){To(i,e),t()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,o){To(o,e)},a.beforeRenderPriorities.animations):t()}},Wh={qualifierCompare:function(e,t){return e==null||t==null?e==null&&t==null:e.sameText(t)},eventMatches:function(e,t,a){var n=t.qualifier;return n!=null?e!==a.target&&wa(a.target)&&n.matches(a.target):!0},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,a){return t.qualifier!=null?a.target:e}},Fa=function(e){return de(e)?new jr(e):e},_s={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new mn(Wh,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,a){return this.emitter().on(e,Fa(t),a),this},removeListener:function(e,t,a){return this.emitter().removeListener(e,Fa(t),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,a){return this.emitter().one(e,Fa(t),a),this},once:function(e,t,a){return this.emitter().one(e,Fa(t),a),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}};Be.eventAliasesOn(_s);var Yn={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)}};Yn.jpeg=Yn.jpg;var Ua={layout:function(e){var t=this;if(e==null){Ve("Layout options must be specified to make a layout");return}if(e.name==null){Ve("A `name` must be specified to make a layout");return}var a=e.name,n=t.extension("layout",a);if(n==null){Ve("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;de(e.eles)?i=t.$(e.eles):i=e.eles!=null?e.eles:t.$();var o=new n(be({},e,{cy:t,eles:i}));return o}};Ua.createLayout=Ua.makeLayout=Ua.layout;var Uh={notify:function(e,t){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();t!=null&&n.merge(t);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,t)}},notifications:function(e){var t=this._private;return e===void 0?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?t.notify(a):t.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Xn.invalidateDimensions=Xn.resize;var Ya={collection:function(e,t){return de(e)?this.$(e):gr(e)?e.collection():Re(e)?(t||(t={}),new je(this,e,t.unique,t.removed)):new je(this)},nodes:function(e){var t=this.$(function(a){return a.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(a){return a.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}};Ya.elements=Ya.filter=Ya.$;var or={},oa="t",Xh="f";or.apply=function(r){for(var e=this,t=e._private,a=t.cy,n=a.collection(),i=0;i0;if(c||f&&h){var d=void 0;c&&h||c?d=u.properties:h&&(d=u.mappedProperties);for(var y=0;y1&&(w=1),s.color){var E=a.valueMin[0],x=a.valueMax[0],D=a.valueMin[1],C=a.valueMax[1],M=a.valueMin[2],P=a.valueMax[2],B=a.valueMin[3]==null?1:a.valueMin[3],L=a.valueMax[3]==null?1:a.valueMax[3],k=[Math.round(E+(x-E)*w),Math.round(D+(C-D)*w),Math.round(M+(P-M)*w),Math.round(B+(L-B)*w)];i={bypass:a.bypass,name:a.name,value:k,strValue:"rgb("+k[0]+", "+k[1]+", "+k[2]+")"}}else if(s.number){var O=a.valueMin+(a.valueMax-a.valueMin)*w;i=this.parse(a.name,O,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case o.data:{for(var A=a.field.split("."),R=f.data,I=0;I0&&i>0){for(var s={},l=!1,u=0;u0?r.delayAnimation(o).play().promise().then(b):b()}).then(function(){return r.animation({style:s,duration:i,easing:r.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){t.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(r,n),r.emitAndNotify("style"),a.transitioning=!1)};or.checkTrigger=function(r,e,t,a,n,i){var o=this.properties[e],s=n(o);s!=null&&s(t,a)&&i(o)};or.checkZOrderTrigger=function(r,e,t,a){var n=this;this.checkTrigger(r,e,t,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",r)})};or.checkBoundsTrigger=function(r,e,t,a){this.checkTrigger(r,e,t,a,function(n){return n.triggersBounds},function(n){r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(t==="bezier"||a==="bezier")&&r.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(t==="none"||a==="none")&&r.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};or.checkTriggers=function(r,e,t,a){r.dirtyStyleCache(),this.checkZOrderTrigger(r,e,t,a),this.checkBoundsTrigger(r,e,t,a)};var Sa={};Sa.applyBypass=function(r,e,t,a){var n=this,i=[],o=!0;if(e==="*"||e==="**"){if(t!==void 0)for(var s=0;sn.length?a=a.substr(n.length):a=""}function l(){i.length>o.length?i=i.substr(o.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Me("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=v[0];var f=v[1];if(f!=="core"){var c=new jr(f);if(c.invalid){Me("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var h=v[2],d=!1;i=h;for(var y=[];;){var p=i.match(/^\s*$/);if(p)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Me("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}o=g[0];var m=g[1],b=g[2],w=e.properties[m];if(!w){Me("Skipping property: Invalid property name in: "+o),l();continue}var S=t.parse(m,b);if(!S){Me("Skipping property: Invalid property definition in: "+o),l();continue}y.push({name:m,val:b}),l()}if(d){s();break}t.selector(f);for(var E=0;E=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(t)return!1;var c=s.data;return{name:r,value:v,strValue:""+e,mapped:c,field:v[1],bypass:t}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(t||u.multiple)return!1;var h=s.mapData;if(!(u.color||u.number))return!1;var d=this.parse(r,f[4]);if(!d||d.mapped)return!1;var y=this.parse(r,f[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Me("`"+r+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+r+": "+d.strValue+"`"),this.parse(r,d.strValue);if(u.color){var p=d.value,g=y.value,m=p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(p[3]==null||p[3]===1)&&(g[3]==null||g[3]===1));if(m)return!1}return{name:r,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:d.value,valueMax:y.value,bypass:t}}}if(u.multiple&&a!=="multiple"){var b;if(l?b=e.split(/\s+/):Re(e)?b=e:b=[e],u.evenMultiple&&b.length%2!==0)return null;for(var w=[],S=[],E=[],x="",D=!1,C=0;C0?" ":"")+M.strValue}return u.validate&&!u.validate(w,S)?null:u.singleEnum&&D?w.length===1&&de(w[0])?{name:r,value:w[0],strValue:w[0],bypass:t}:null:{name:r,value:w,pfValue:E,strValue:x,bypass:t,units:S}}var P=function(){for(var z=0;zu.max||u.strictMax&&e===u.max))return null;var A={name:r,value:e,strValue:""+e+(B||""),units:B,bypass:t};return u.unitless||B!=="px"&&B!=="em"?A.pfValue=e:A.pfValue=B==="px"||!B?e:this.getEmSizeInPixels()*e,(B==="ms"||B==="s")&&(A.pfValue=B==="ms"?e:1e3*e),(B==="deg"||B==="rad")&&(A.pfValue=B==="rad"?e:Pv(e)),B==="%"&&(A.pfValue=e/100),A}else if(u.propList){var R=[],I=""+e;if(I!=="none"){for(var q=I.split(/\s*,\s*|\s+/),$=0;$0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((o-2*t)/a.w,(s-2*t)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.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,a=t.pan,n=t.zoom,i,o,s=!1;if(t.zoomingEnabled||(s=!0),ne(e)?o=e:Se(e)&&(o=e.level,e.position!=null?i=cn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!t.panningEnabled&&(s=!0)),o=o>t.maxZoom?t.maxZoom:o,o=ot.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,i.push("zoom"))}if(n&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;ne(u.x)&&(t.pan.x=u.x,s=!1),ne(u.y)&&(t.pan.y=u.y,s=!1),s||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(de(e)){var a=e;e=this.mutableElements().filter(a)}else gr(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),o=this.height();t=t===void 0?this._private.zoom:t;var s={x:(i-t*(n.x1+n.x2))/2,y:(o-t*(n.y1+n.y2))/2};return s}}},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,a=this;return e.sizeCache=e.sizeCache||(t?function(){var n=a.window().getComputedStyle(t),i=function(s){return parseFloat(n.getPropertyValue(s))};return{width:t.clientWidth-i("padding-left")-i("padding-right"),height:t.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/t,x2:(a.x2-e.x)/t,y1:(a.y1-e.y)/t,y2:(a.y2-e.y)/t};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},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}};gt.centre=gt.center;gt.autolockNodes=gt.autolock;gt.autoungrabifyNodes=gt.autoungrabify;var ya={data:Be.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Be.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Be.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Be.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ya.attr=ya.data;ya.removeAttr=ya.removeData;var ma=function(e){var t=this;e=be({},e);var a=e.container;a&&!Qa(a)&&Qa(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=t;var o=Ge!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=be({name:o?"grid":"null"},s.layout),s.renderer=be({name:o?"canvas":"null"},s.renderer);var l=function(d,y,p){return y!==void 0?y:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:s,elements:new je(this),listeners:[],aniEles:new je(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,s.zoomingEnabled),userZoomingEnabled:l(!0,s.userZoomingEnabled),panningEnabled:l(!0,s.panningEnabled),userPanningEnabled:l(!0,s.userPanningEnabled),boxSelectionEnabled:l(!0,s.boxSelectionEnabled),autolock:l(!1,s.autolock,s.autolockNodes),autoungrabify:l(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(!1,s.autounselectify),styleEnabled:s.styleEnabled===void 0?o:s.styleEnabled,zoom:ne(s.zoom)?s.zoom:1,pan:{x:Se(s.pan)&&ne(s.pan.x)?s.pan.x:0,y:Se(s.pan)&&ne(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom});var v=function(d,y){var p=d.some(_u);if(p)return Vt.all(d).then(y);y(d)};u.styleEnabled&&t.setStyle([]);var f=be({},s,s.renderer);t.initRenderer(f);var c=function(d,y,p){t.notifications(!1);var g=t.mutableElements();g.length>0&&g.remove(),d!=null&&(Se(d)||Re(d))&&t.add(d),t.one("layoutready",function(b){t.notifications(!0),t.emit(b),t.one("load",y),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",p),t.emit("done")});var m=be({},t._private.options.layout);m.eles=t.elements(),t.layout(m).run()};v([s.style,s.elements],function(h){var d=h[0],y=h[1];u.styleEnabled&&t.style().append(d),c(y,function(){t.startAnimationLoop(),u.ready=!0,Fe(s.ready)&&t.on("ready",s.ready);for(var p=0;p0,l=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),u;if(gr(e.roots))u=e.roots;else if(Re(e.roots)){for(var v=[],f=0;f0;){var O=k(),A=M(O,B);if(A)O.outgoers().filter(function(ae){return ae.isNode()&&a.has(ae)}).forEach(L);else if(A===null){Me("Detected double maximal shift for node `"+O.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var R=0;if(e.avoidOverlap)for(var I=0;I0&&g[0].length<=3?xe/2:0),T=2*Math.PI/g[ce].length*ve;return ce===0&&g[0].length===1&&(J=1),{x:X.x+J*Math.cos(T),y:X.y+J*Math.sin(T)}}else{var Te={x:X.x+(ve+1-(pe+1)/2)*Pe,y:(ce+1)*Ee};return Te}};return a.nodes().layoutPositions(this,e,he),this};var jh={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 eu(r){this.options=be({},jh,r)}eu.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var o=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),v,f=0,c=0;c1&&e.avoidOverlap){f*=1.75;var g=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),b=Math.sqrt(f*f/(g*g+m*m));v=Math.max(b,v)}var w=function(E,x){var D=e.startAngle+x*u*(n?1:-1),C=v*Math.cos(D),M=v*Math.sin(D),P={x:s.x+C,y:s.y+M};return P};return a.nodes().layoutPositions(this,e,w),this};var eg={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 ru(r){this.options=be({},eg,r)}ru.prototype.run=function(){for(var r=this.options,e=r,t=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=r.cy,n=e.eles,i=n.nodes().not(":parent"),o=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,v=0;v0){var S=Math.abs(m[0].value-w.value);S>=p&&(m=[],g.push(m))}m.push(w)}var E=u+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,D=Math.min(o.w,o.h)/2-E,C=D/(g.length+x?1:0);E=Math.min(E,C)}for(var M=0,P=0;P1&&e.avoidOverlap){var O=Math.cos(k)-Math.cos(0),A=Math.sin(k)-Math.sin(0),R=Math.sqrt(E*E/(O*O+A*A));M=Math.max(R,M)}B.r=M,M+=E}if(e.equidistant){for(var I=0,q=0,$=0;$=r.numIter||(ug(a,r),a.temperature=a.temperature*r.coolingFactor,a.temperature=r.animationThreshold&&i(),Ja(f)}};v()}else{for(;u;)u=o(l),l++;Po(a,r),s()}return this};Cn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Cn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var tg=function(e,t,a){for(var n=a.eles.edges(),i=a.eles.nodes(),o=hr(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=a.eles.components(),u={},v=0;v0){s.graphSet.push(D);for(var v=0;vn.count?0:n.graph},ng=function r(e,t,a,n){var i=n.graphSet[a];if(-10)var f=n.nodeOverlap*v,c=Math.sqrt(s*s+l*l),h=f*s/c,d=f*l/c;else var y=nn(e,s,l),p=nn(t,-1*s,-1*l),g=p.x-y.x,m=p.y-y.y,b=g*g+m*m,c=Math.sqrt(b),f=(e.nodeRepulsion+t.nodeRepulsion)/b,h=f*g/c,d=f*m/c;e.isLocked||(e.offsetX-=h,e.offsetY-=d),t.isLocked||(t.offsetX+=h,t.offsetY+=d)}},fg=function(e,t,a,n){if(a>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(n>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return i>=0&&o>=0?Math.sqrt(i*i+o*o):0},nn=function(e,t,a){var n=e.positionX,i=e.positionY,o=e.height||1,s=e.width||1,l=a/t,u=o/s,v={};return t===0&&0a?(v.x=n,v.y=i+o/2,v):0t&&-1*u<=l&&l<=u?(v.x=n-s/2,v.y=i-s*a/2/t,v):0=u)?(v.x=n+o*t/2/a,v.y=i+o/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-o*t/2/a,v.y=i-o/2),v)},cg=function(e,t){for(var a=0;aa){var p=t.gravity*h/y,g=t.gravity*d/y;c.offsetX+=p,c.offsetY+=g}}}}},hg=function(e,t){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var o=a[n++],s=e.idToIndex[o],l=e.layoutNodes[s],u=l.children;if(0a)var i={x:a*e/n,y:a*t/n};else var i={x:e,y:t};return i},yg=function r(e,t){var a=e.parentId;if(a!=null){var n=t.layoutNodes[t.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTopg&&(d+=p+t.componentSpacing,h=0,y=0,p=0)}}},mg={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 au(r){this.options=be({},mg,r)}au.prototype.run=function(){var r=this.options,e=r,t=r.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=hr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(W){return{x:i.x1,y:i.y1}});else{var o=n.size(),s=Math.sqrt(o*i.h/i.w),l=Math.round(s),u=Math.round(i.w/i.h*s),v=function(Q){if(Q==null)return Math.min(l,u);var _=Math.min(l,u);_==l?l=Q:u=Q},f=function(Q){if(Q==null)return Math.max(l,u);var _=Math.max(l,u);_==l?l=Q:u=Q},c=e.rows,h=e.cols!=null?e.cols:e.columns;if(c!=null&&h!=null)l=c,u=h;else if(c!=null&&h==null)l=c,u=Math.ceil(o/l);else if(c==null&&h!=null)u=h,l=Math.ceil(o/u);else if(u*l>o){var d=v(),y=f();(d-1)*y>=o?v(d-1):(y-1)*d>=o&&f(y-1)}else for(;u*l=o?f(g+1):v(p+1)}var m=i.w/u,b=i.h/l;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var w=0;w=u&&(O=0,k++)},R={},I=0;I(O=$v(r,e,A[R],A[R+1],A[R+2],A[R+3])))return p(x,O),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var A=C.allpts,R=0;R+5(O=qv(r,e,A[R],A[R+1],A[R+2],A[R+3],A[R+4],A[R+5])))return p(x,O),!0}for(var I=I||D.source,q=q||D.target,$=n.getArrowWidth(M,P),F=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],R=0;R0&&(g(I),g(q))}function b(x,D,C){return kr(x,D,C)}function w(x,D){var C=x._private,M=c,P;D?P=D+"-":P="",x.boundingBox();var B=C.labelBounds[D||"main"],L=x.pstyle(P+"label").value,k=x.pstyle("text-events").strValue==="yes";if(!(!k||!L)){var O=b(C.rscratch,"labelX",D),A=b(C.rscratch,"labelY",D),R=b(C.rscratch,"labelAngle",D),I=x.pstyle(P+"text-margin-x").pfValue,q=x.pstyle(P+"text-margin-y").pfValue,$=B.x1-M-I,F=B.x2+M-I,N=B.y1-M-q,W=B.y2+M-q;if(R){var Q=Math.cos(R),_=Math.sin(R),j=function(he,ae){return he=he-O,ae=ae-A,{x:he*Q-ae*_+O,y:he*_+ae*Q+A}},ee=j($,N),U=j($,W),z=j(F,N),Y=j(F,W),X=[ee.x+I,ee.y+q,z.x+I,z.y+q,Y.x+I,Y.y+q,U.x+I,U.y+q];if(dr(r,e,X))return p(x),!0}else if(Ot(B,r,e))return p(x),!0}}for(var S=o.length-1;S>=0;S--){var E=o[S];E.isNode()?g(E)||w(E):m(E)||w(E)||w(E,"source")||w(E,"target")}return s};yt.getAllInBox=function(r,e,t,a){var n=this.getCachedZSortedEles().interactive,i=[],o=Math.min(r,t),s=Math.max(r,t),l=Math.min(e,a),u=Math.max(e,a);r=o,t=s,e=l,a=u;for(var v=hr({x1:r,y1:e,x2:t,y2:a}),f=0;f0?-(Math.PI-e.ang):Math.PI+e.ang},Sg=function(e,t,a,n,i){if(e!==Ro?Oo(t,e,Ar):Cg(mr,Ar),Oo(t,a,mr),Lo=Ar.nx*mr.ny-Ar.ny*mr.nx,Ao=Ar.nx*mr.nx-Ar.ny*-mr.ny,Vr=Math.asin(Math.max(-1,Math.min(1,Lo))),Math.abs(Vr)<1e-6){Zn=t.x,Qn=t.y,st=St=0;return}ut=1,Xa=!1,Ao<0?Vr<0?Vr=Math.PI+Vr:(Vr=Math.PI-Vr,ut=-1,Xa=!0):Vr>0&&(ut=-1,Xa=!0),t.radius!==void 0?St=t.radius:St=n,nt=Vr/2,Va=Math.min(Ar.len/2,mr.len/2),i?(Lr=Math.abs(Math.cos(nt)*St/Math.sin(nt)),Lr>Va?(Lr=Va,st=Math.abs(Lr*Math.sin(nt)/Math.cos(nt))):st=St):(Lr=Math.min(Va,St),st=Math.abs(Lr*Math.sin(nt)/Math.cos(nt))),Jn=t.x+mr.nx*Lr,_n=t.y+mr.ny*Lr,Zn=Jn-mr.ny*st*ut,Qn=_n+mr.nx*st*ut,su=t.x+Ar.nx*Lr,uu=t.y+Ar.ny*Lr,Ro=t};function lu(r,e){e.radius===0?r.lineTo(e.cx,e.cy):r.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Si(r,e,t,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(Sg(r,e,t,a,n),{cx:Zn,cy:Qn,radius:st,startX:su,startY:uu,stopX:Jn,stopY:_n,startAngle:Ar.ang+Math.PI/2*ut,endAngle:mr.ang-Math.PI/2*ut,counterClockwise:Xa})}var sr={};sr.findMidptPtsEtc=function(r,e){var t=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,o=r.pstyle("source-endpoint"),s=r.pstyle("target-endpoint"),l=o.units!=null&&s.units!=null,u=function(S,E,x,D){var C=D-E,M=x-S,P=Math.sqrt(M*M+C*C);return{x:-C/P,y:M/P}},v=r.pstyle("edge-distances").value;switch(v){case"node-position":i=t;break;case"intersection":i=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(r.source()[0],o),c=Tr(f,2),h=c[0],d=c[1],y=this.manualEndptToPx(r.target()[0],s),p=Tr(y,2),g=p[0],m=p[1],b={x1:h,y1:d,x2:g,y2:m};n=u(h,d,g,m),i=b}else Me("Edge ".concat(r.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};sr.findHaystackPoints=function(r){for(var e=0;e0?Math.max(ye-me,0):Math.min(ye+me,0)},L=B(M,D),k=B(P,C),O=!1;m===u?g=Math.abs(L)>Math.abs(k)?n:a:m===l||m===s?(g=a,O=!0):(m===i||m===o)&&(g=n,O=!0);var A=g===a,R=A?k:L,I=A?P:M,q=ds(I),$=!1;!(O&&(w||E))&&(m===s&&I<0||m===l&&I>0||m===i&&I>0||m===o&&I<0)&&(q*=-1,R=q*Math.abs(R),$=!0);var F;if(w){var N=S<0?1+S:S;F=N*R}else{var W=S<0?R:0;F=W+S*q}var Q=function(ye){return Math.abs(ye)=Math.abs(R)},_=Q(F),j=Q(Math.abs(R)-Math.abs(F)),ee=_||j;if(ee&&!$)if(A){var U=Math.abs(I)<=c/2,z=Math.abs(M)<=h/2;if(U){var Y=(v.x1+v.x2)/2,X=v.y1,oe=v.y2;t.segpts=[Y,X,Y,oe]}else if(z){var he=(v.y1+v.y2)/2,ae=v.x1,ie=v.x2;t.segpts=[ae,he,ie,he]}else t.segpts=[v.x1,v.y2]}else{var ue=Math.abs(I)<=f/2,ce=Math.abs(P)<=d/2;if(ue){var ve=(v.y1+v.y2)/2,pe=v.x1,Pe=v.x2;t.segpts=[pe,ve,Pe,ve]}else if(ce){var Ee=(v.x1+v.x2)/2,xe=v.y1,Te=v.y2;t.segpts=[Ee,xe,Ee,Te]}else t.segpts=[v.x2,v.y1]}else if(A){var J=v.y1+F+(p?c/2*q:0),T=v.x1,V=v.x2;t.segpts=[T,J,V,J]}else{var Z=v.x1+F+(p?f/2*q:0),G=v.y1,H=v.y2;t.segpts=[Z,G,Z,H]}if(t.isRound){var te=r.pstyle("taxi-radius").value,K=r.pstyle("radius-type").value[0]==="arc-radius";t.radii=new Array(t.segpts.length/2).fill(te),t.isArcRadius=new Array(t.segpts.length/2).fill(K)}};sr.tryToCorrectInvalidPoints=function(r,e){var t=r._private.rscratch;if(t.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,o=e.srcH,s=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,c=e.tgtCornerRadius,h=e.srcRs,d=e.tgtRs,y=!ne(t.startX)||!ne(t.startY),p=!ne(t.arrowStartX)||!ne(t.arrowStartY),g=!ne(t.endX)||!ne(t.endY),m=!ne(t.arrowEndX)||!ne(t.arrowEndY),b=3,w=this.getArrowWidth(r.pstyle("width").pfValue,r.pstyle("arrow-scale").value)*this.arrowShapeWidth,S=b*w,E=ct({x:t.ctrlpts[0],y:t.ctrlpts[1]},{x:t.startX,y:t.startY}),x=Ek.poolIndex()){var O=L;L=k,k=O}var A=C.srcPos=L.position(),R=C.tgtPos=k.position(),I=C.srcW=L.outerWidth(),q=C.srcH=L.outerHeight(),$=C.tgtW=k.outerWidth(),F=C.tgtH=k.outerHeight(),N=C.srcShape=t.nodeShapes[e.getNodeShape(L)],W=C.tgtShape=t.nodeShapes[e.getNodeShape(k)],Q=C.srcCornerRadius=L.pstyle("corner-radius").value==="auto"?"auto":L.pstyle("corner-radius").pfValue,_=C.tgtCornerRadius=k.pstyle("corner-radius").value==="auto"?"auto":k.pstyle("corner-radius").pfValue,j=C.tgtRs=k._private.rscratch,ee=C.srcRs=L._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var U=0;U0){var oe=i,he=it(oe,kt(t)),ae=it(oe,kt(X)),ie=he;if(ae2){var ue=it(oe,{x:X[2],y:X[3]});ue0){var H=o,te=it(H,kt(t)),K=it(H,kt(G)),re=te;if(K2){var ye=it(H,{x:G[2],y:G[3]});ye=d||x){p={cp:w,segment:E};break}}if(p)break}var D=p.cp,C=p.segment,M=(d-g)/C.length,P=C.t1-C.t0,B=h?C.t0+P*M:C.t1-P*M;B=ca(0,B,1),e=Bt(D.p0,D.p1,D.p2,B),c=Dg(D.p0,D.p1,D.p2,B);break}case"straight":case"segments":case"haystack":{for(var L=0,k,O,A,R,I=a.allpts.length,q=0;q+3=d));q+=2);var $=d-O,F=$/k;F=ca(0,F,1),e=Mv(A,R,F),c=cu(A,R);break}}o("labelX",f,e.x),o("labelY",f,e.y),o("labelAutoAngle",f,c)}};u("source"),u("target"),this.applyLabelDimensions(r)}};zr.applyLabelDimensions=function(r){this.applyPrefixedLabelDimensions(r),r.isEdge()&&(this.applyPrefixedLabelDimensions(r,"source"),this.applyPrefixedLabelDimensions(r,"target"))};zr.applyPrefixedLabelDimensions=function(r,e){var t=r._private,a=this.getLabelText(r,e),n=this.calculateLabelDimensions(r,a),i=r.pstyle("line-height").pfValue,o=r.pstyle("text-wrap").strValue,s=kr(t.rscratch,"labelWrapCachedLines",e)||[],l=o!=="wrap"?1:Math.max(s.length,1),u=n.height/l,v=u*i,f=n.width,c=n.height+(l-1)*(i-1)*u;Yr(t.rstyle,"labelWidth",e,f),Yr(t.rscratch,"labelWidth",e,f),Yr(t.rstyle,"labelHeight",e,c),Yr(t.rscratch,"labelHeight",e,c),Yr(t.rscratch,"labelLineHeight",e,v)};zr.getLabelText=function(r,e){var t=r._private,a=e?e+"-":"",n=r.pstyle(a+"label").strValue,i=r.pstyle("text-transform").value,o=function(W,Q){return Q?(Yr(t.rscratch,W,e,Q),Q):kr(t.rscratch,W,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var s=r.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u="​",v=n.split(` `),f=r.pstyle("text-max-width").pfValue,c=r.pstyle("text-overflow-wrap").value,h=c==="anywhere",d=[],y=/[\s\u200b]+|$/g,p=0;pf){var S=g.matchAll(y),E="",x=0,D=Xo(S),C;try{for(D.s();!(C=D.n()).done;){var M=C.value,P=M[0],B=g.substring(x,M.index);x=M.index+P.length;var L=E.length===0?B:E+B+P,k=this.calculateLabelDimensions(r,L),O=k.width;O<=f?E+=B+P:(E&&d.push(E),E=B+P)}}catch(N){D.e(N)}finally{D.f()}E.match(/^[\s\u200b]+$/)||d.push(E)}else d.push(g)}o("labelWrapCachedLines",d),n=o("labelWrapCachedText",d.join(` `)),o("labelWrapKey",l)}else if(s==="ellipsis"){var A=r.pstyle("text-max-width").pfValue,R="",I="…",q=!1;if(this.calculateLabelDimensions(r,n).widthA)break;R+=n[$],$===n.length-1&&(q=!0)}return q||(R+=I),R}return n};zr.getLabelJustification=function(r){var e=r.pstyle("text-justification").strValue,t=r.pstyle("text-halign").strValue;if(e==="auto")if(r.isNode())switch(t){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};zr.calculateLabelDimensions=function(r,e){var t=this,a=t.cy.window(),n=a.document,i=ft(e,r._private.labelDimsKey),o=t.labelDimCache||(t.labelDimCache=[]),s=o[i];if(s!=null)return s;var l=0,u=r.pstyle("font-style").strValue,v=r.pstyle("font-size").pfValue,f=r.pstyle("font-family").strValue,c=r.pstyle("font-weight").strValue,h=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=n.createElement("canvas"),d=this.labelCalcCanvasContext=h.getContext("2d");var y=h.style;y.position="absolute",y.left="-9999px",y.top="-9999px",y.zIndex="-1",y.visibility="hidden",y.pointerEvents="none"}d.font="".concat(u," ").concat(c," ").concat(v,"px ").concat(f);for(var p=0,g=0,m=e.split(` `),b=0;b1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(o),s)for(var l=0;l=r.desktopTapThreshold2}var lr=n(T);Ae&&(r.hoverData.tapholdCancelled=!0);var xr=function(){var Mr=r.hoverData.dragDelta=r.hoverData.dragDelta||[];Mr.length===0?(Mr.push(ge[0]),Mr.push(ge[1])):(Mr[0]+=ge[0],Mr[1]+=ge[1])};Z=!0,a(fe,["mousemove","vmousemove","tapdrag"],T,{x:K[0],y:K[1]});var yr=function(){r.data.bgActivePosistion=void 0,r.hoverData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:K[0],y:K[1]}}),me[4]=1,r.hoverData.selecting=!0,r.redrawHint("select",!0),r.redraw()};if(r.hoverData.which===3){if(Ae){var cr={originalEvent:T,type:"cxtdrag",position:{x:K[0],y:K[1]}};le?le.emit(cr):G.emit(cr),r.hoverData.cxtDragged=!0,(!r.hoverData.cxtOver||fe!==r.hoverData.cxtOver)&&(r.hoverData.cxtOver&&r.hoverData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:K[0],y:K[1]}}),r.hoverData.cxtOver=fe,fe&&fe.emit({originalEvent:T,type:"cxtdragover",position:{x:K[0],y:K[1]}}))}}else if(r.hoverData.dragging){if(Z=!0,G.panningEnabled()&&G.userPanningEnabled()){var Br;if(r.hoverData.justStartedPan){var Fr=r.hoverData.mdownPos;Br={x:(K[0]-Fr[0])*H,y:(K[1]-Fr[1])*H},r.hoverData.justStartedPan=!1}else Br={x:ge[0]*H,y:ge[1]*H};G.panBy(Br),G.emit("dragpan"),r.hoverData.dragged=!0}K=r.projectIntoViewport(T.clientX,T.clientY)}else if(me[4]==1&&(le==null||le.pannable())){if(Ae){if(!r.hoverData.dragging&&G.boxSelectionEnabled()&&(lr||!G.panningEnabled()||!G.userPanningEnabled()))yr();else if(!r.hoverData.selecting&&G.panningEnabled()&&G.userPanningEnabled()){var Er=i(le,r.hoverData.downs);Er&&(r.hoverData.dragging=!0,r.hoverData.justStartedPan=!0,me[4]=0,r.data.bgActivePosistion=kt(re),r.redrawHint("select",!0),r.redraw())}le&&le.pannable()&&le.active()&&le.unactivate()}}else{if(le&&le.pannable()&&le.active()&&le.unactivate(),(!le||!le.grabbed())&&fe!=we&&(we&&a(we,["mouseout","tapdragout"],T,{x:K[0],y:K[1]}),fe&&a(fe,["mouseover","tapdragover"],T,{x:K[0],y:K[1]}),r.hoverData.last=fe),le)if(Ae){if(G.boxSelectionEnabled()&&lr)le&&le.grabbed()&&(p(Ne),le.emit("freeon"),Ne.emit("free"),r.dragData.didDrag&&(le.emit("dragfreeon"),Ne.emit("dragfree"))),yr();else if(le&&le.grabbed()&&r.nodeIsDraggable(le)){var He=!r.dragData.didDrag;He&&r.redrawHint("eles",!0),r.dragData.didDrag=!0,r.hoverData.draggingEles||d(Ne,{inDragLayer:!0});var Ye={x:0,y:0};if(ne(ge[0])&&ne(ge[1])&&(Ye.x+=ge[0],Ye.y+=ge[1],He)){var tr=r.hoverData.dragDelta;tr&&ne(tr[0])&&ne(tr[1])&&(Ye.x+=tr[0],Ye.y+=tr[1])}r.hoverData.draggingEles=!0,Ne.silentShift(Ye).emit("position drag"),r.redrawHint("drag",!0),r.redraw()}}else xr();Z=!0}if(me[2]=K[0],me[3]=K[1],Z)return T.stopPropagation&&T.stopPropagation(),T.preventDefault&&T.preventDefault(),!1}},!1);var M,P,B;r.registerBinding(e,"mouseup",function(T){if(!(r.hoverData.which===1&&T.which!==1&&r.hoverData.capture)){var V=r.hoverData.capture;if(V){r.hoverData.capture=!1;var Z=r.cy,G=r.projectIntoViewport(T.clientX,T.clientY),H=r.selection,te=r.findNearestElement(G[0],G[1],!0,!1),K=r.dragData.possibleDragElements,re=r.hoverData.down,ye=n(T);if(r.data.bgActivePosistion&&(r.redrawHint("select",!0),r.redraw()),r.hoverData.tapholdCancelled=!0,r.data.bgActivePosistion=void 0,re&&re.unactivate(),r.hoverData.which===3){var me={originalEvent:T,type:"cxttapend",position:{x:G[0],y:G[1]}};if(re?re.emit(me):Z.emit(me),!r.hoverData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:G[0],y:G[1]}};re?re.emit(fe):Z.emit(fe)}r.hoverData.cxtDragged=!1,r.hoverData.which=null}else if(r.hoverData.which===1){if(a(te,["mouseup","tapend","vmouseup"],T,{x:G[0],y:G[1]}),!r.dragData.didDrag&&!r.hoverData.dragged&&!r.hoverData.selecting&&!r.hoverData.isOverThresholdDrag&&(a(re,["click","tap","vclick"],T,{x:G[0],y:G[1]}),P=!1,T.timeStamp-B<=Z.multiClickDebounceTime()?(M&&clearTimeout(M),P=!0,B=null,a(re,["dblclick","dbltap","vdblclick"],T,{x:G[0],y:G[1]})):(M=setTimeout(function(){P||a(re,["oneclick","onetap","voneclick"],T,{x:G[0],y:G[1]})},Z.multiClickDebounceTime()),B=T.timeStamp)),re==null&&!r.dragData.didDrag&&!r.hoverData.selecting&&!r.hoverData.dragged&&!n(T)&&(Z.$(t).unselect(["tapunselect"]),K.length>0&&r.redrawHint("eles",!0),r.dragData.possibleDragElements=K=Z.collection()),te==re&&!r.dragData.didDrag&&!r.hoverData.selecting&&te!=null&&te._private.selectable&&(r.hoverData.dragging||(Z.selectionType()==="additive"||ye?te.selected()?te.unselect(["tapunselect"]):te.select(["tapselect"]):ye||(Z.$(t).unmerge(te).unselect(["tapunselect"]),te.select(["tapselect"]))),r.redrawHint("eles",!0)),r.hoverData.selecting){var we=Z.collection(r.getAllInBox(H[0],H[1],H[2],H[3]));r.redrawHint("select",!0),we.length>0&&r.redrawHint("eles",!0),Z.emit({type:"boxend",originalEvent:T,position:{x:G[0],y:G[1]}});var le=function(Ae){return Ae.selectable()&&!Ae.selected()};Z.selectionType()==="additive"||ye||Z.$(t).unmerge(we).unselect(),we.emit("box").stdFilter(le).select().emit("boxselect"),r.redraw()}if(r.hoverData.dragging&&(r.hoverData.dragging=!1,r.redrawHint("select",!0),r.redrawHint("eles",!0),r.redraw()),!H[4]){r.redrawHint("drag",!0),r.redrawHint("eles",!0);var ge=re&&re.grabbed();p(K),ge&&(re.emit("freeon"),K.emit("free"),r.dragData.didDrag&&(re.emit("dragfreeon"),K.emit("dragfree")))}}H[4]=0,r.hoverData.down=null,r.hoverData.cxtStarted=!1,r.hoverData.draggingEles=!1,r.hoverData.selecting=!1,r.hoverData.isOverThresholdDrag=!1,r.dragData.didDrag=!1,r.hoverData.dragged=!1,r.hoverData.dragDelta=[],r.hoverData.mdownPos=null,r.hoverData.mdownGPos=null,r.hoverData.which=null}}},!1);var L=function(T){if(!r.scrollingPage){var V=r.cy,Z=V.zoom(),G=V.pan(),H=r.projectIntoViewport(T.clientX,T.clientY),te=[H[0]*Z+G.x,H[1]*Z+G.y];if(r.hoverData.draggingEles||r.hoverData.dragging||r.hoverData.cxtStarted||D()){T.preventDefault();return}if(V.panningEnabled()&&V.userPanningEnabled()&&V.zoomingEnabled()&&V.userZoomingEnabled()){T.preventDefault(),r.data.wheelZooming=!0,clearTimeout(r.data.wheelTimeout),r.data.wheelTimeout=setTimeout(function(){r.data.wheelZooming=!1,r.redrawHint("eles",!0),r.redraw()},150);var K;T.deltaY!=null?K=T.deltaY/-250:T.wheelDeltaY!=null?K=T.wheelDeltaY/1e3:K=T.wheelDelta/1e3,K=K*r.wheelSensitivity;var re=T.deltaMode===1;re&&(K*=33);var ye=V.zoom()*Math.pow(10,K);T.type==="gesturechange"&&(ye=r.gestureStartZoom*T.scale),V.zoom({level:ye,renderedPosition:{x:te[0],y:te[1]}}),V.emit(T.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};r.registerBinding(r.container,"wheel",L,!0),r.registerBinding(e,"scroll",function(T){r.scrollingPage=!0,clearTimeout(r.scrollingPageTimeout),r.scrollingPageTimeout=setTimeout(function(){r.scrollingPage=!1},250)},!0),r.registerBinding(r.container,"gesturestart",function(T){r.gestureStartZoom=r.cy.zoom(),r.hasTouchStarted||T.preventDefault()},!0),r.registerBinding(r.container,"gesturechange",function(J){r.hasTouchStarted||L(J)},!0),r.registerBinding(r.container,"mouseout",function(T){var V=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseout",position:{x:V[0],y:V[1]}})},!1),r.registerBinding(r.container,"mouseover",function(T){var V=r.projectIntoViewport(T.clientX,T.clientY);r.cy.emit({originalEvent:T,type:"mouseover",position:{x:V[0],y:V[1]}})},!1);var k,O,A,R,I,q,$,F,N,W,Q,_,j,ee=function(T,V,Z,G){return Math.sqrt((Z-T)*(Z-T)+(G-V)*(G-V))},U=function(T,V,Z,G){return(Z-T)*(Z-T)+(G-V)*(G-V)},z;r.registerBinding(r.container,"touchstart",z=function(T){if(r.hasTouchStarted=!0,!!C(T)){m(),r.touchData.capture=!0,r.data.bgActivePosistion=void 0;var V=r.cy,Z=r.touchData.now,G=r.touchData.earlier;if(T.touches[0]){var H=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);Z[0]=H[0],Z[1]=H[1]}if(T.touches[1]){var H=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);Z[2]=H[0],Z[3]=H[1]}if(T.touches[2]){var H=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);Z[4]=H[0],Z[5]=H[1]}if(T.touches[1]){r.touchData.singleTouchMoved=!0,p(r.dragData.touchDragEles);var te=r.findContainerClientCoords();N=te[0],W=te[1],Q=te[2],_=te[3],k=T.touches[0].clientX-N,O=T.touches[0].clientY-W,A=T.touches[1].clientX-N,R=T.touches[1].clientY-W,j=0<=k&&k<=Q&&0<=A&&A<=Q&&0<=O&&O<=_&&0<=R&&R<=_;var K=V.pan(),re=V.zoom();I=ee(k,O,A,R),q=U(k,O,A,R),$=[(k+A)/2,(O+R)/2],F=[($[0]-K.x)/re,($[1]-K.y)/re];var ye=200,me=ye*ye;if(q=1){for(var Ze=r.touchData.startPosition=[null,null,null,null,null,null],$e=0;$e=r.touchTapThreshold2}if(V&&r.touchData.cxt){T.preventDefault();var Ze=T.touches[0].clientX-N,$e=T.touches[0].clientY-W,fr=T.touches[1].clientX-N,Qe=T.touches[1].clientY-W,lr=U(Ze,$e,fr,Qe),xr=lr/q,yr=150,cr=yr*yr,Br=1.5,Fr=Br*Br;if(xr>=Fr||lr>=cr){r.touchData.cxt=!1,r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Er={originalEvent:T,type:"cxttapend",position:{x:H[0],y:H[1]}};r.touchData.start?(r.touchData.start.unactivate().emit(Er),r.touchData.start=null):G.emit(Er)}}if(V&&r.touchData.cxt){var Er={originalEvent:T,type:"cxtdrag",position:{x:H[0],y:H[1]}};r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.touchData.start?r.touchData.start.emit(Er):G.emit(Er),r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxtDragged=!0;var He=r.findNearestElement(H[0],H[1],!0,!0);(!r.touchData.cxtOver||He!==r.touchData.cxtOver)&&(r.touchData.cxtOver&&r.touchData.cxtOver.emit({originalEvent:T,type:"cxtdragout",position:{x:H[0],y:H[1]}}),r.touchData.cxtOver=He,He&&He.emit({originalEvent:T,type:"cxtdragover",position:{x:H[0],y:H[1]}}))}else if(V&&T.touches[2]&&G.boxSelectionEnabled())T.preventDefault(),r.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,r.touchData.selecting||G.emit({originalEvent:T,type:"boxstart",position:{x:H[0],y:H[1]}}),r.touchData.selecting=!0,r.touchData.didSelect=!0,Z[4]=1,!Z||Z.length===0||Z[0]===void 0?(Z[0]=(H[0]+H[2]+H[4])/3,Z[1]=(H[1]+H[3]+H[5])/3,Z[2]=(H[0]+H[2]+H[4])/3+1,Z[3]=(H[1]+H[3]+H[5])/3+1):(Z[2]=(H[0]+H[2]+H[4])/3,Z[3]=(H[1]+H[3]+H[5])/3),r.redrawHint("select",!0),r.redraw();else if(V&&T.touches[1]&&!r.touchData.didSelect&&G.zoomingEnabled()&&G.panningEnabled()&&G.userZoomingEnabled()&&G.userPanningEnabled()){T.preventDefault(),r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var Ye=r.dragData.touchDragEles;if(Ye){r.redrawHint("drag",!0);for(var tr=0;tr0&&!r.hoverData.draggingEles&&!r.swipePanning&&r.data.bgActivePosistion!=null&&(r.data.bgActivePosistion=void 0,r.redrawHint("select",!0),r.redraw())}},!1);var X;r.registerBinding(e,"touchcancel",X=function(T){var V=r.touchData.start;r.touchData.capture=!1,V&&V.unactivate()});var oe,he,ae,ie;if(r.registerBinding(e,"touchend",oe=function(T){var V=r.touchData.start,Z=r.touchData.capture;if(Z)T.touches.length===0&&(r.touchData.capture=!1),T.preventDefault();else return;var G=r.selection;r.swipePanning=!1,r.hoverData.draggingEles=!1;var H=r.cy,te=H.zoom(),K=r.touchData.now,re=r.touchData.earlier;if(T.touches[0]){var ye=r.projectIntoViewport(T.touches[0].clientX,T.touches[0].clientY);K[0]=ye[0],K[1]=ye[1]}if(T.touches[1]){var ye=r.projectIntoViewport(T.touches[1].clientX,T.touches[1].clientY);K[2]=ye[0],K[3]=ye[1]}if(T.touches[2]){var ye=r.projectIntoViewport(T.touches[2].clientX,T.touches[2].clientY);K[4]=ye[0],K[5]=ye[1]}V&&V.unactivate();var me;if(r.touchData.cxt){if(me={originalEvent:T,type:"cxttapend",position:{x:K[0],y:K[1]}},V?V.emit(me):H.emit(me),!r.touchData.cxtDragged){var fe={originalEvent:T,type:"cxttap",position:{x:K[0],y:K[1]}};V?V.emit(fe):H.emit(fe)}r.touchData.start&&(r.touchData.start._private.grabbed=!1),r.touchData.cxt=!1,r.touchData.start=null,r.redraw();return}if(!T.touches[2]&&H.boxSelectionEnabled()&&r.touchData.selecting){r.touchData.selecting=!1;var we=H.collection(r.getAllInBox(G[0],G[1],G[2],G[3]));G[0]=void 0,G[1]=void 0,G[2]=void 0,G[3]=void 0,G[4]=0,r.redrawHint("select",!0),H.emit({type:"boxend",originalEvent:T,position:{x:K[0],y:K[1]}});var le=function(cr){return cr.selectable()&&!cr.selected()};we.emit("box").stdFilter(le).select().emit("boxselect"),we.nonempty()&&r.redrawHint("eles",!0),r.redraw()}if(V!=null&&V.unactivate(),T.touches[2])r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);else if(!T.touches[1]){if(!T.touches[0]){if(!T.touches[0]){r.data.bgActivePosistion=void 0,r.redrawHint("select",!0);var ge=r.dragData.touchDragEles;if(V!=null){var Ne=V._private.grabbed;p(ge),r.redrawHint("drag",!0),r.redrawHint("eles",!0),Ne&&(V.emit("freeon"),ge.emit("free"),r.dragData.didDrag&&(V.emit("dragfreeon"),ge.emit("dragfree"))),a(V,["touchend","tapend","vmouseup","tapdragout"],T,{x:K[0],y:K[1]}),V.unactivate(),r.touchData.start=null}else{var Ae=r.findNearestElement(K[0],K[1],!0,!0);a(Ae,["touchend","tapend","vmouseup","tapdragout"],T,{x:K[0],y:K[1]})}var ur=r.touchData.startPosition[0]-K[0],Ze=ur*ur,$e=r.touchData.startPosition[1]-K[1],fr=$e*$e,Qe=Ze+fr,lr=Qe*te*te;r.touchData.singleTouchMoved||(V||H.$(":selected").unselect(["tapunselect"]),a(V,["tap","vclick"],T,{x:K[0],y:K[1]}),he=!1,T.timeStamp-ie<=H.multiClickDebounceTime()?(ae&&clearTimeout(ae),he=!0,ie=null,a(V,["dbltap","vdblclick"],T,{x:K[0],y:K[1]})):(ae=setTimeout(function(){he||a(V,["onetap","voneclick"],T,{x:K[0],y:K[1]})},H.multiClickDebounceTime()),ie=T.timeStamp)),V!=null&&!r.dragData.didDrag&&V._private.selectable&&lr"u"){var ue=[],ce=function(T){return{clientX:T.clientX,clientY:T.clientY,force:1,identifier:T.pointerId,pageX:T.pageX,pageY:T.pageY,radiusX:T.width/2,radiusY:T.height/2,screenX:T.screenX,screenY:T.screenY,target:T.target}},ve=function(T){return{event:T,touch:ce(T)}},pe=function(T){ue.push(ve(T))},Pe=function(T){for(var V=0;V0)return N[0]}return null},d=Object.keys(c),y=0;y0?h:ps(i,o,e,t,a,n,s,l)},checkPoint:function(e,t,a,n,i,o,s,l){l=l==="auto"?dt(n,i):l;var u=2*l;if($r(e,t,this.points,o,s,n,i-u,[0,-1],a)||$r(e,t,this.points,o,s,n-u,i,[0,-1],a))return!0;var v=n/2+2*a,f=i/2+2*a,c=[o-v,s-f,o-v,s,o+v,s,o+v,s-f];return!!(dr(e,t,c)||lt(e,t,u,u,o+n/2-l,s+i/2-l,a)||lt(e,t,u,u,o-n/2+l,s+i/2-l,a))}}};Gr.registerNodeShapes=function(){var r=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",vr(3,0)),this.generateRoundPolygon("round-triangle",vr(3,0)),this.generatePolygon("rectangle",vr(4,0)),r.square=r.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var t=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",t),this.generateRoundPolygon("round-diamond",t)}this.generatePolygon("pentagon",vr(5,0)),this.generateRoundPolygon("round-pentagon",vr(5,0)),this.generatePolygon("hexagon",vr(6,0)),this.generateRoundPolygon("round-hexagon",vr(6,0)),this.generatePolygon("heptagon",vr(7,0)),this.generateRoundPolygon("round-heptagon",vr(7,0)),this.generatePolygon("octagon",vr(8,0)),this.generateRoundPolygon("round-octagon",vr(8,0));var a=new Array(20);{var n=$n(5,0),i=$n(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*w)break}else if(u){if(m>=e.deqCost*h||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*Fn)break;var S=e.deq(a,p,y);if(S.length>0)for(var E=0;E0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,y)&&i())},s=e.priority||ui;n.beforeRender(o,s(a))}}}},Pg=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:_a;ai(this,r),this.idsByKey=new Or,this.keyForId=new Or,this.cachesByLvl=new Or,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return ni(r,[{key:"getIdsFor",value:function(t){t==null&&Ve("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(t);return n||(n=new Ft,a.set(t,n)),n}},{key:"addIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).add(a)}},{key:"deleteIdForKey",value:function(t,a){t!=null&&this.getIdsFor(t).delete(a)}},{key:"getNumberOfIdsForKey",value:function(t){return t==null?0:this.getIdsFor(t).size}},{key:"updateKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(t){var a=t.id(),n=this.keyForId.get(a),i=this.getKey(t);return n!==i}},{key:"isInvalid",value:function(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function(t){var a=this.cachesByLvl,n=this.lvls,i=a.get(t);return i||(i=new Or,a.set(t,i),n.push(t)),i}},{key:"getCache",value:function(t,a){return this.getCachesAt(a).get(t)}},{key:"get",value:function(t,a){var n=this.getKey(t),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(t),i}},{key:"getForCachedKey",value:function(t,a){var n=this.keyForId.get(t.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(t,a){return this.getCachesAt(a).has(t)}},{key:"has",value:function(t,a){var n=this.getKey(t);return this.hasCache(n,a)}},{key:"setCache",value:function(t,a,n){n.key=t,this.getCachesAt(a).set(t,n)}},{key:"set",value:function(t,a,n){var i=this.getKey(t);this.setCache(i,a,n),this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function(t,a){this.getCachesAt(a).delete(t)}},{key:"delete",value:function(t,a){var n=this.getKey(t);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(t){var a=this;this.lvls.forEach(function(n){return a.deleteCache(t,n)})}},{key:"invalidate",value:function(t){var a=t.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(t);var i=this.doesEleInvalidateKey(t);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),r}(),Fo=25,qa=50,Za=-4,jn=3,Bg=7.99,Mg=8,Lg=1024,Ag=1024,Rg=1024,Og=.2,Ig=.8,zg=10,Ng=.15,Fg=.1,Vg=.9,qg=.9,$g=100,Hg=1,Pt={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Gg=er({getKey:null,doesEleInvalidateKey:_a,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:us,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ia=function(e,t){var a=this;a.renderer=e,a.onDequeues=[];var n=Gg(t);be(a,n),a.lookup=new Pg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Ue=ia.prototype;Ue.reasons=Pt;Ue.getTextureQueue=function(r){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[r]=e.eleImgCaches[r]||[]};Ue.getRetiredTextureQueue=function(r){var e=this,t=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=t[r]=t[r]||[];return a};Ue.getElementQueue=function(){var r=this,e=r.eleCacheQueue=r.eleCacheQueue||new Ea(function(t,a){return a.reqs-t.reqs});return e};Ue.getElementKeyToQueue=function(){var r=this,e=r.eleKeyToCacheQueue=r.eleKeyToCacheQueue||{};return e};Ue.getElement=function(r,e,t,a,n){var i=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!r.visible()||r.removed()||!i.allowEdgeTxrCaching&&r.isEdge()||!i.allowParentTxrCaching&&r.isParent())return null;if(a==null&&(a=Math.ceil(vi(s*t))),a=Bg||a>jn)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,c=o.eleTextBiggerThanMin(r,u);if(!this.isVisible(r,c))return null;var h=l.get(r,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var d;if(v<=Fo?d=Fo:v<=qa?d=qa:d=Math.ceil(v/qa)*qa,v>Rg||f>Ag)return null;var y=i.getTextureQueue(d),p=y[y.length-2],g=function(){return i.recycleTexture(d,f)||i.addTexture(d,f)};p||(p=y[y.length-1]),p||(p=g()),p.width-p.usedWidtha;P--)C=i.getElement(r,e,t,P,Pt.downscale);M()}else return i.queueElement(r,E.level-1),E;else{var B;if(!b&&!w&&!S)for(var L=a-1;L>=Za;L--){var k=l.get(r,L);if(k){B=k;break}}if(m(B))return i.queueElement(r,a),B;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,r,e,c,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return h={x:p.usedWidth,texture:p,level:a,scale:u,width:f,height:v,scaledLabelShown:c},p.usedWidth+=Math.ceil(f+Mg),p.eleCaches.push(h),l.set(r,a,h),i.checkTextureFullness(p),h};Ue.invalidateElements=function(r){for(var e=0;e=Og*r.width&&this.retireTexture(r)};Ue.checkTextureFullness=function(r){var e=this,t=e.getTextureQueue(r.height);r.usedWidth/r.width>Ig&&r.fullnessChecks>=zg?_r(t,r):r.fullnessChecks++};Ue.retireTexture=function(r){var e=this,t=r.height,a=e.getTextureQueue(t),n=this.lookup;_r(a,r),r.retired=!0;for(var i=r.eleCaches,o=0;o=e)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,li(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),_r(n,o),a.push(o),o}};Ue.queueElement=function(r,e){var t=this,a=t.getElementQueue(),n=t.getElementKeyToQueue(),i=this.getKey(r),o=n[i];if(o)o.level=Math.max(o.level,e),o.eles.merge(r),o.reqs++,a.updateItem(o);else{var s={eles:r.spawn().merge(r),level:e,reqs:1,key:i};a.push(s),n[i]=s}};Ue.dequeue=function(r){for(var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,o=0;o0;o++){var s=t.pop(),l=s.key,u=s.eles[0],v=i.hasCache(u,s.level);if(a[l]=null,v)continue;n.push(s);var f=e.getBoundingBox(u);e.getElement(u,f,r,s.level,Pt.dequeue)}return n};Ue.removeFromQueue=function(r){var e=this,t=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(r),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=si,t.updateItem(i),t.pop(),a[n]=null):i.eles.unmerge(r))};Ue.onDequeue=function(r){this.onDequeues.push(r)};Ue.offDequeue=function(r){_r(this.onDequeues,r)};Ue.setupDequeueing=yu.setupDequeueing({deqRedrawThreshold:$g,deqCost:Ng,deqAvgCost:Fg,deqNoDrawCost:Vg,deqFastCost:qg,deq:function(e,t,a){return e.dequeue(t,a)},onDeqd:function(e,t){for(var a=0;a=Wg||t>sn)return null}a.validateLayersElesOrdering(t,r);var l=a.layersByLevel,u=Math.pow(2,t),v=l[t]=l[t]||[],f,c=a.levelIsComplete(t,r),h,d=function(){var M=function(O){if(a.validateLayersElesOrdering(O,r),a.levelIsComplete(O,r))return h=l[O],!0},P=function(O){if(!h)for(var A=t+O;sa<=A&&A<=sn&&!M(A);A+=O);};P(1),P(-1);for(var B=v.length-1;B>=0;B--){var L=v[B];L.invalid&&_r(v,L)}};if(!c)d();else return v;var y=function(){if(!f){f=hr();for(var M=0;Mjg)return null;var L=a.makeLayer(f,t);if(P!=null){var k=v.indexOf(P)+1;v.splice(k,0,L)}else(M.insert===void 0||M.insert)&&v.unshift(L);return L};if(a.skipping&&!s)return null;for(var g=null,m=r.length/Kg,b=!s,w=0;w=m||!gs(g.bb,S.boundingBox()))&&(g=p({insert:!0,after:g}),!g))return null;h||b?a.queueLayer(g,S):a.drawEleInLayer(g,S,t,e),g.eles.push(S),x[t]=g}return h||(b?null:v)};rr.getEleLevelForLayerLevel=function(r,e){return r};rr.drawEleInLayer=function(r,e,t,a){var n=this,i=this.renderer,o=r.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(t=n.getEleLevelForLayerLevel(t,a),i.setImgSmoothing(o,!1),i.drawCachedElement(o,e,null,null,t,ep),i.setImgSmoothing(o,!0))};rr.levelIsComplete=function(r,e){var t=this,a=t.layersByLevel[r];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||o.invalid)return!1;n+=o.eles.length}return n===e.length};rr.validateLayersElesOrdering=function(r,e){var t=this.layersByLevel[r];if(t)for(var a=0;a0){e=!0;break}}return e};rr.invalidateElements=function(r){var e=this;r.length!==0&&(e.lastInvalidationTime=qr(),!(r.length===0||!e.haveLayers())&&e.updateElementsInLayers(r,function(a,n,i){e.invalidateLayer(a)}))};rr.invalidateLayer=function(r){if(this.lastInvalidationTime=qr(),!r.invalid){var e=r.level,t=r.eles,a=this.layersByLevel[e];_r(a,r),r.elesQueue=[],r.invalid=!0,r.replacement&&(r.replacement.invalid=!0);for(var n=0;n3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s=e._private.rscratch;if(!(i&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var l;t&&(l=t,r.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,v=i?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=e.pstyle("line-outline-width").value,p=e.pstyle("line-outline-color").value,g=u*v,m=u*v,b=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;f==="straight-triangle"?(o.eleStrokeStyle(r,e,O),o.drawEdgeTrianglePath(e,r,s.allpts)):(r.lineWidth=h,r.lineCap=d,o.eleStrokeStyle(r,e,O),o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},w=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:g;if(r.lineWidth=h+y,r.lineCap=d,y>0)o.colorStrokeStyle(r,p[0],p[1],p[2],O);else{r.lineCap="butt";return}f==="straight-triangle"?o.drawEdgeTrianglePath(e,r,s.allpts):(o.drawEdgePath(e,r,s.allpts,c),r.lineCap="butt")},S=function(){n&&o.drawEdgeOverlay(r,e)},E=function(){n&&o.drawEdgeUnderlay(r,e)},x=function(){var O=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;o.drawArrowheads(r,e,O)},D=function(){o.drawElementText(r,e,null,a)};r.lineJoin="round";var C=e.pstyle("ghost").value==="yes";if(C){var M=e.pstyle("ghost-offset-x").pfValue,P=e.pstyle("ghost-offset-y").pfValue,B=e.pstyle("ghost-opacity").value,L=g*B;r.translate(M,P),b(L),x(L),r.translate(-M,-P)}else w();E(),b(),x(),S(),D(),t&&r.translate(l.x1,l.y1)}};var wu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,o=i.usePaths(),s=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;t.lineWidth=u,s.edgeType==="self"&&!o?t.lineCap="butt":t.lineCap="round",i.colorStrokeStyle(t,v[0],v[1],v[2],n),i.drawEdgePath(a,t,s.allpts,"solid")}}}};Kr.drawEdgeOverlay=wu("overlay");Kr.drawEdgeUnderlay=wu("underlay");Kr.drawEdgePath=function(r,e,t,a){var n=r._private.rscratch,i=e,o,s=!1,l=this.usePaths(),u=r.pstyle("line-dash-pattern").pfValue,v=r.pstyle("line-dash-offset").pfValue;if(l){var f=t.join("$"),c=n.pathCacheKey&&n.pathCacheKey===f;c?(o=e=n.pathCache,s=!0):(o=e=new Path2D,n.pathCacheKey=f,n.pathCache=o)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=v;break;case"solid":i.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(t[0],t[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:!0,o=this;if(a==null){if(i&&!o.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(e);r.textAlign=l,r.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!c||!c.value))return;r.textAlign="center",r.textBaseline="bottom"}var h=!t,d;t&&(d=t,r.translate(-d.x1,-d.y1)),n==null?(o.drawText(r,e,null,h,i),e.isEdge()&&(o.drawText(r,e,"source",h,i),o.drawText(r,e,"target",h,i))):o.drawText(r,e,n,h,i),t&&r.translate(d.x1,d.y1)};mt.getFontCache=function(r){var e;this.fontCaches=this.fontCaches||[];for(var t=0;t2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=t?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*s,u=e.pstyle("color").value,v=e.pstyle("text-outline-color").value;r.font=a+" "+o+" "+n+" "+i,r.lineJoin="round",this.colorFillStyle(r,u[0],u[1],u[2],s),this.colorStrokeStyle(r,v[0],v[1],v[2],l)};function qn(r,e,t,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;r.beginPath(),r.moveTo(e+i,t),r.lineTo(e+a-i,t),r.quadraticCurveTo(e+a,t,e+a,t+i),r.lineTo(e+a,t+n-i),r.quadraticCurveTo(e+a,t+n,e+a-i,t+n),r.lineTo(e+i,t+n),r.quadraticCurveTo(e,t+n,e,t+n-i),r.lineTo(e,t+i),r.quadraticCurveTo(e,t,e+i,t),r.closePath(),o?r.stroke():r.fill()}mt.getTextAngle=function(r,e){var t,a=r._private,n=a.rscratch,i=e?e+"-":"",o=r.pstyle(i+"text-rotation"),s=kr(n,"labelAngle",e);return o.strValue==="autorotate"?t=r.isEdge()?s:0:o.strValue==="none"?t=0:t=o.pfValue,t};mt.drawText=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,o=i.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){t==="main"&&(t=null);var l=kr(o,"labelX",t),u=kr(o,"labelY",t),v,f,c=this.getLabelText(e,t);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(r,e,n);var h=t?t+"-":"",d=kr(o,"labelWidth",t),y=kr(o,"labelHeight",t),p=e.pstyle(h+"text-margin-x").pfValue,g=e.pstyle(h+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,w=e.pstyle("text-valign").value;m&&(b="center",w="center"),l+=p,u+=g;var S;switch(a?S=this.getTextAngle(e,t):S=0,S!==0&&(v=l,f=u,r.translate(v,f),r.rotate(S),l=0,u=0),w){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var E=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,D=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,M=e.pstyle("text-background-shape").strValue,P=M.indexOf("round")===0,B=2;if(E>0||D>0&&x>0){var L=l-C;switch(b){case"left":L-=d;break;case"center":L-=d/2;break}var k=u-y-C,O=d+2*C,A=y+2*C;if(E>0){var R=r.fillStyle,I=e.pstyle("text-background-color").value;r.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*s+")",P?qn(r,L,k,O,A,B):r.fillRect(L,k,O,A),r.fillStyle=R}if(D>0&&x>0){var q=r.strokeStyle,$=r.lineWidth,F=e.pstyle("text-border-color").value,N=e.pstyle("text-border-style").value;if(r.strokeStyle="rgba("+F[0]+","+F[1]+","+F[2]+","+x*s+")",r.lineWidth=D,r.setLineDash)switch(N){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"double":r.lineWidth=D/4,r.setLineDash([]);break;case"solid":r.setLineDash([]);break}if(P?qn(r,L,k,O,A,B,"stroke"):r.strokeRect(L,k,O,A),N==="double"){var W=D/2;P?qn(r,L+W,k+W,O-W*2,A-W*2,B,"stroke"):r.strokeRect(L+W,k+W,O-W*2,A-W*2)}r.setLineDash&&r.setLineDash([]),r.lineWidth=$,r.strokeStyle=q}}var Q=2*e.pstyle("text-outline-width").pfValue;if(Q>0&&(r.lineWidth=Q),e.pstyle("text-wrap").value==="wrap"){var _=kr(o,"labelWrapCachedLines",t),j=kr(o,"labelLineHeight",t),ee=d/2,U=this.getLabelJustification(e);switch(U==="auto"||(b==="left"?U==="left"?l+=-d:U==="center"&&(l+=-ee):b==="center"?U==="left"?l+=-ee:U==="right"&&(l+=ee):b==="right"&&(U==="center"?l+=ee:U==="right"&&(l+=d))),w){case"top":u-=(_.length-1)*j;break;case"center":case"bottom":u-=(_.length-1)*j;break}for(var z=0;z<_.length;z++)Q>0&&r.strokeText(_[z],l,u),r.fillText(_[z],l,u),u+=j}else Q>0&&r.strokeText(c,l,u),r.fillText(c,l,u);S!==0&&(r.rotate(-S),r.translate(-v,-f))}}};var Yt={};Yt.drawNode=function(r,e,t){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,o=this,s,l,u=e._private,v=u.rscratch,f=e.position();if(!(!ne(f.x)||!ne(f.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,h=o.usePaths(),d,y=!1,p=e.padding();s=e.width()+2*p,l=e.height()+2*p;var g;t&&(g=t,r.translate(-g.x1,-g.y1));for(var m=e.pstyle("background-image"),b=m.value,w=new Array(b.length),S=new Array(b.length),E=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:L;o.eleFillStyle(r,e,te)},z=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:F;o.colorStrokeStyle(r,k[0],k[1],k[2],te)},Y=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;o.colorStrokeStyle(r,W[0],W[1],W[2],te)},X=function(te,K,re,ye){var me=o.nodePathCache=o.nodePathCache||[],fe=ss(re==="polygon"?re+","+ye.join(","):re,""+K,""+te,""+ee),we=me[fe],le,ge=!1;return we!=null?(le=we,ge=!0,v.pathCache=le):(le=new Path2D,me[fe]=v.pathCache=le),{path:le,cacheHit:ge}},oe=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(h){r.translate(f.x,f.y);var ae=X(s,l,oe,he);d=ae.path,y=ae.cacheHit}var ie=function(){if(!y){var te=f;h&&(te={x:0,y:0}),o.nodeShapes[o.getNodeShape(e)].draw(d||r,te.x,te.y,s,l,ee,v)}h?r.fill(d):r.fill()},ue=function(){for(var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,re=u.backgrounding,ye=0,me=0;me0&&arguments[0]!==void 0?arguments[0]:!1,K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;o.hasPie(e)&&(o.drawPie(r,e,K),te&&(h||o.nodeShapes[o.getNodeShape(e)].draw(r,f.x,f.y,s,l,ee,v)))},ve=function(){var te=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,K=(P>0?P:-P)*te,re=P>0?0:255;P!==0&&(o.colorFillStyle(r,re,re,re,K),h?r.fill(d):r.fill())},pe=function(){if(B>0){if(r.lineWidth=B,r.lineCap=R,r.lineJoin=A,r.setLineDash)switch(O){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash(q),r.lineDashOffset=$;break;case"solid":case"double":r.setLineDash([]);break}if(I!=="center"){if(r.save(),r.lineWidth*=2,I==="inside")h?r.clip(d):r.clip();else{var te=new Path2D;te.rect(-s/2-B,-l/2-B,s+2*B,l+2*B),te.addPath(d),r.clip(te,"evenodd")}h?r.stroke(d):r.stroke(),r.restore()}else h?r.stroke(d):r.stroke();if(O==="double"){r.lineWidth=B/3;var K=r.globalCompositeOperation;r.globalCompositeOperation="destination-out",h?r.stroke(d):r.stroke(),r.globalCompositeOperation=K}r.setLineDash&&r.setLineDash([])}},Pe=function(){if(N>0){if(r.lineWidth=N,r.lineCap="butt",r.setLineDash)switch(Q){case"dotted":r.setLineDash([1,1]);break;case"dashed":r.setLineDash([4,2]);break;case"solid":case"double":r.setLineDash([]);break}var te=f;h&&(te={x:0,y:0});var K=o.getNodeShape(e),re=B;I==="inside"&&(re=0),I==="outside"&&(re*=2);var ye=(s+re+(N+j))/s,me=(l+re+(N+j))/l,fe=s*ye,we=l*me,le=o.nodeShapes[K].points,ge;if(h){var Ne=X(fe,we,K,le);ge=Ne.path}if(K==="ellipse")o.drawEllipsePath(ge||r,te.x,te.y,fe,we);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(K)){var Ae=0,ur=0,Ze=0;K==="round-diamond"?Ae=(re+j+N)*1.4:K==="round-heptagon"?(Ae=(re+j+N)*1.075,Ze=-(re/2+j+N)/35):K==="round-hexagon"?Ae=(re+j+N)*1.12:K==="round-pentagon"?(Ae=(re+j+N)*1.13,Ze=-(re/2+j+N)/15):K==="round-tag"?(Ae=(re+j+N)*1.12,ur=(re/2+N+j)*.07):K==="round-triangle"&&(Ae=(re+j+N)*(Math.PI/2),Ze=-(re+j/2+N)/Math.PI),Ae!==0&&(ye=(s+Ae)/s,fe=s*ye,["round-hexagon","round-tag"].includes(K)||(me=(l+Ae)/l,we=l*me)),ee=ee==="auto"?ms(fe,we):ee;for(var $e=fe/2,fr=we/2,Qe=ee+(re+N+j)/2,lr=new Array(le.length/2),xr=new Array(le.length/2),yr=0;yr0){if(n=n||a.position(),i==null||o==null){var h=a.padding();i=a.width()+2*h,o=a.height()+2*h}s.colorFillStyle(t,v[0],v[1],v[2],u),s.nodeShapes[f].draw(t,n.x,n.y,i+l*2,o+l*2,c),t.fill()}}}};Yt.drawNodeOverlay=xu("overlay");Yt.drawNodeUnderlay=xu("underlay");Yt.hasPie=function(r){return r=r[0],r._private.hasPie};Yt.drawPie=function(r,e,t,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),o=a.x,s=a.y,l=e.width(),u=e.height(),v=Math.min(l,u)/2,f=0,c=this.usePaths();c&&(o=0,s=0),i.units==="%"?v=v*i.pfValue:i.pfValue!==void 0&&(v=i.pfValue/2);for(var h=1;h<=n.pieBackgroundN;h++){var d=e.pstyle("pie-"+h+"-background-size").value,y=e.pstyle("pie-"+h+"-background-color").value,p=e.pstyle("pie-"+h+"-background-opacity").value*t,g=d/100;g+f>1&&(g=1-f);var m=1.5*Math.PI+2*Math.PI*f,b=2*Math.PI*g,w=m+b;d===0||f>=1||f+g>1||(r.beginPath(),r.moveTo(o,s),r.arc(o,s,v,m,w),r.closePath(),this.colorFillStyle(r,y[0],y[1],y[2],p),r.fill(),f+=g)}};var pr={},fp=100;pr.getPixelRatio=function(){var r=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),t=r.backingStorePixelRatio||r.webkitBackingStorePixelRatio||r.mozBackingStorePixelRatio||r.msBackingStorePixelRatio||r.oBackingStorePixelRatio||r.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/t};pr.paintCache=function(r){for(var e=this.paintCaches=this.paintCaches||[],t=!0,a,n=0;no.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!f&&(v[o.NODE]=!0,v[o.SELECT_BOX]=!0);var m=l.style(),b=l.zoom(),w=n!==void 0?n:b,S=l.pan(),E={x:S.x,y:S.y},x={zoom:b,pan:{x:S.x,y:S.y}},D=o.prevViewport,C=D===void 0||x.zoom!==D.zoom||x.pan.x!==D.pan.x||x.pan.y!==D.pan.y;!C&&!(y&&!d)&&(o.motionBlurPxRatio=1),i&&(E=i),w*=s,E.x*=s,E.y*=s;var M=o.getCachedZSortedEles();function P(ae,ie,ue,ce,ve){var pe=ae.globalCompositeOperation;ae.globalCompositeOperation="destination-out",o.colorFillStyle(ae,255,255,255,o.motionBlurTransparency),ae.fillRect(ie,ue,ce,ve),ae.globalCompositeOperation=pe}function B(ae,ie){var ue,ce,ve,pe;!o.clearingMotionBlur&&(ae===u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||ae===u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])?(ue={x:S.x*h,y:S.y*h},ce=b*h,ve=o.canvasWidth*h,pe=o.canvasHeight*h):(ue=E,ce=w,ve=o.canvasWidth,pe=o.canvasHeight),ae.setTransform(1,0,0,1,0,0),ie==="motionBlur"?P(ae,0,0,ve,pe):!e&&(ie===void 0||ie)&&ae.clearRect(0,0,ve,pe),t||(ae.translate(ue.x,ue.y),ae.scale(ce,ce)),i&&ae.translate(i.x,i.y),n&&ae.scale(n,n)}if(f||(o.textureDrawLastFrame=!1),f){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0),L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:L,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var x=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}v[o.DRAG]=!1,v[o.NODE]=!1;var k=u.contexts[o.NODE],O=o.textureCache.texture,x=o.textureCache.viewport;k.setTransform(1,0,0,1,0,0),c?P(k,0,0,x.width,x.height):k.clearRect(0,0,x.width,x.height);var A=m.core("outside-texture-bg-color").value,R=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(k,A[0],A[1],A[2],R),k.fillRect(0,0,x.width,x.height);var b=l.zoom();B(k,!1),k.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s),k.drawImage(O,x.mpan.x,x.mpan.y,x.width/x.zoom/s,x.height/x.zoom/s)}else o.textureOnViewport&&!e&&(o.textureCache=null);var I=l.extent(),q=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),$=o.hideEdgesOnViewport&&q,F=[];if(F[o.NODE]=!v[o.NODE]&&c&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,F[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),F[o.DRAG]=!v[o.DRAG]&&c&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,F[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),v[o.NODE]||t||a||F[o.NODE]){var N=c&&!F[o.NODE]&&h!==1,k=e||(N?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]),W=c&&!N?"motionBlur":void 0;B(k,W),$?o.drawCachedNodes(k,M.nondrag,s,I):o.drawLayeredElements(k,M.nondrag,s,I),o.debug&&o.drawDebugPoints(k,M.nondrag),!t&&!c&&(v[o.NODE]=!1)}if(!a&&(v[o.DRAG]||t||F[o.DRAG])){var N=c&&!F[o.DRAG]&&h!==1,k=e||(N?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);B(k,c&&!N?"motionBlur":void 0),$?o.drawCachedNodes(k,M.drag,s,I):o.drawCachedElements(k,M.drag,s,I),o.debug&&o.drawDebugPoints(k,M.drag),!t&&!c&&(v[o.DRAG]=!1)}if(o.showFps||!a&&v[o.SELECT_BOX]&&!t){var k=e||u.contexts[o.SELECT_BOX];if(B(k),o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var b=o.cy.zoom(),Q=m.core("selection-box-border-width").value/b;k.lineWidth=Q,k.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",k.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),Q>0&&(k.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",k.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var b=o.cy.zoom(),_=u.bgActivePosistion;k.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",k.beginPath(),k.arc(_.x,_.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),k.fill()}var j=o.lastRedrawTime;if(o.showFps&&j){j=Math.round(j);var ee=Math.round(1e3/j);k.setTransform(1,0,0,1,0,0),k.fillStyle="rgba(255, 0, 0, 0.75)",k.strokeStyle="rgba(255, 0, 0, 0.75)",k.lineWidth=1,k.fillText("1 frame = "+j+" ms = "+ee+" fps",0,20);var U=60;k.strokeRect(0,30,250,20),k.fillRect(0,30,250*Math.min(ee/U,1),20)}t||(v[o.SELECT_BOX]=!1)}if(c&&h!==1){var z=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],X=u.contexts[o.DRAG],oe=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],he=function(ie,ue,ce){ie.setTransform(1,0,0,1,0,0),ce||!g?ie.clearRect(0,0,o.canvasWidth,o.canvasHeight):P(ie,0,0,o.canvasWidth,o.canvasHeight);var ve=h;ie.drawImage(ue,0,0,o.canvasWidth*ve,o.canvasHeight*ve,0,0,o.canvasWidth,o.canvasHeight)};(v[o.NODE]||F[o.NODE])&&(he(z,Y,F[o.NODE]),v[o.NODE]=!1),(v[o.DRAG]||F[o.DRAG])&&(he(X,oe,F[o.DRAG]),v[o.DRAG]=!1)}o.prevViewport=x,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),c&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!f,o.mbFrames=0,v[o.NODE]=!0,v[o.DRAG]=!0,o.redraw()},fp)),e||l.emit("render")};var at={};at.drawPolygonPath=function(r,e,t,a,n,i){var o=a/2,s=n/2;r.beginPath&&r.beginPath(),r.moveTo(e+o*i[0],t+s*i[1]);for(var l=1;l0&&o>0){h.clearRect(0,0,i,o),h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(r.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var y=e.pan(),p={x:y.x*u,y:y.y*u};u*=e.zoom(),h.translate(p.x,p.y),h.scale(u,u),this.drawElements(h,d),h.scale(1/u,1/u),h.translate(-p.x,-p.y)}r.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=r.bg,h.rect(0,0,i,o),h.fill())}return c};function cp(r,e){for(var t=atob(r),a=new ArrayBuffer(t.length),n=new Uint8Array(a),i=0;i"u"?"undefined":We(OffscreenCanvas))!=="undefined")t=new OffscreenCanvas(r,e);else{var a=this.cy.window(),n=a.document;t=n.createElement("canvas"),t.width=r,t.height=e}return t};[bu,Nr,Kr,Di,mt,Yt,pr,at,ka,Su].forEach(function(r){be(De,r)});var gp=[{name:"null",impl:ou},{name:"base",impl:pu},{name:"canvas",impl:dp}],pp=[{type:"layout",extensions:Eg},{type:"renderer",extensions:gp}],Du={},ku={};function Pu(r,e,t){var a=t,n=function(D){Me("Can not register `"+e+"` for `"+r+"` since `"+D+"` already exists in the prototype and can not be overridden")};if(r==="core"){if(ma.prototype[e])return n(e);ma.prototype[e]=t}else if(r==="collection"){if(je.prototype[e])return n(e);je.prototype[e]=t}else if(r==="layout"){for(var i=function(D){this.options=D,t.call(this,D),Se(this._private)||(this._private={}),this._private.cy=D.cy,this._private.listeners=[],this.createEmitter()},o=i.prototype=Object.create(t.prototype),s=[],l=0;l