import{aI as Hi,aJ as hi,aK as lu,_ as de,l as wr,j as uu,U as vu,L as fu,d as ci,E as hu,O as cu,z as en,i as tn,$ as du,a0 as gu,a1 as pu}from"./index-CT47McLc.js";function qe(t){"@babel/helpers - typeof";return qe=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},qe(t)}function di(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yu(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,a=new Array(e);r=t.length?{done:!0}:{done:!1,value:t[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 o=!0,i=!1,s;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){i=!0,s=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(i)throw s}}}}var Ye=typeof window>"u"?null:window,qi=Ye?Ye.navigator:null;Ye&&Ye.document;var wu=qe(""),fs=qe({}),xu=qe(function(){}),Tu=typeof HTMLElement>"u"?"undefined":qe(HTMLElement),Ta=function(e){return e&&e.instanceString&&ze(e.instanceString)?e.instanceString():null},ge=function(e){return e!=null&&qe(e)==wu},ze=function(e){return e!=null&&qe(e)===xu},ke=function(e){return!yt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},De=function(e){return e!=null&&qe(e)===fs&&!ke(e)&&e.constructor===Object},Cu=function(e){return e!=null&&qe(e)===fs},oe=function(e){return e!=null&&qe(e)===qe(1)&&!isNaN(e)},Du=function(e){return oe(e)&&Math.floor(e)===e},rn=function(e){if(Tu!=="undefined")return e!=null&&e instanceof HTMLElement},yt=function(e){return Ca(e)||hs(e)},Ca=function(e){return Ta(e)==="collection"&&e._private.single},hs=function(e){return Ta(e)==="collection"&&!e._private.single},pi=function(e){return Ta(e)==="core"},cs=function(e){return Ta(e)==="stylesheet"},Su=function(e){return Ta(e)==="event"},er=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Lu=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Au=function(e){return De(e)&&oe(e.x1)&&oe(e.x2)&&oe(e.y1)&&oe(e.y2)},Ou=function(e){return Cu(e)&&ze(e.then)},Nu=function(){return qi&&qi.userAgent.match(/msie|trident|edge/i)},ha=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var o=[],i=0;ir?1:0},Fu=function(e,r){return-1*gs(e,r)},Ee=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(g-=1),g<1/6?c+(p-c)*6*g:g<1/2?p:g<2/3?c+(p-c)*(2/3-g)*6:c}var f=new RegExp("^"+Ru+"$").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,o=parseFloat(f[3]),o<0||o>100)||(o=o/100,i=f[4],i!==void 0&&(i=parseFloat(i),i<0||i>1)))return;if(n===0)s=l=u=Math.round(o*255);else{var d=o<.5?o*(1+n):o+n-o*n,h=2*o-d;s=Math.round(255*v(h,d,a+1/3)),l=Math.round(255*v(h,d,a)),u=Math.round(255*v(h,d,a-1/3))}r=[s,l,u,i]}return r},Vu=function(e){var r,a=new RegExp("^"+Iu+"$").exec(e);if(a){r=[];for(var n=[],o=1;o<=3;o++){var i=a[o];if(i[i.length-1]==="%"&&(n[o]=!0),i=parseFloat(i),n[o]&&(i=i/100*255),i<0||i>255)return;r.push(Math.floor(i))}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;r.push(u)}}return r},Uu=function(e){return _u[e.toLowerCase()]},$u=function(e){return(ke(e)?e:null)||Uu(e)||Gu(e)||Vu(e)||zu(e)},_u={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]},ps=function(e){for(var r=e.map,a=e.keys,n=a.length,o=0;o=e||E<0||f&&x>=o}function y(){var S=kn();if(g(S))return b(S);s=setTimeout(y,p(S))}function b(S){return s=void 0,d&&a?h(S):(a=n=void 0,i)}function m(){s!==void 0&&clearTimeout(s),u=0,a=l=n=s=void 0}function T(){return s===void 0?i:b(kn())}function C(){var S=kn(),E=g(S);if(a=arguments,n=this,l=S,E){if(s===void 0)return c(l);if(f)return clearTimeout(s),s=setTimeout(y,e),h(l)}return s===void 0&&(s=setTimeout(y,e)),i}return C.cancel=m,C.flush=T,C}var pn=Lv,Pn=Ye?Ye.performance:null,Es=Pn&&Pn.now?function(){return Pn.now()}:function(){return Date.now()},Av=function(){if(Ye){if(Ye.requestAnimationFrame)return function(t){Ye.requestAnimationFrame(t)};if(Ye.mozRequestAnimationFrame)return function(t){Ye.mozRequestAnimationFrame(t)};if(Ye.webkitRequestAnimationFrame)return function(t){Ye.webkitRequestAnimationFrame(t)};if(Ye.msRequestAnimationFrame)return function(t){Ye.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(Es())},1e3/60)}}(),an=function(e){return Av(e)},_t=Es,Ir=9261,ws=65599,oa=5381,xs=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ir,a=r,n;n=e.next(),!n.done;)a=a*ws+n.value|0;return a},ca=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ir;return r*ws+e|0},da=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oa;return(r<<5)+r+e|0},Ov=function(e,r){return e*2097152+r},Wt=function(e){return e[0]*2097152+e[1]},Ra=function(e,r){return[ca(e[0],r[0]),da(e[1],r[1])]},Nv=function(e,r){var a={value:0,done:!1},n=0,o=e.length,i={next:function(){return n=0;n--)e[n]===r&&e.splice(n,1)},Ei=function(e){e.splice(0,e.length)},Fv=function(e,r){for(var a=0;a"u"?"undefined":qe(Set))!==zv?Set:Vv,yn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!pi(e)){Ve("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){Ve("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var o=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new $r,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(o.position.x==null&&(o.position.x=0),o.position.y==null&&(o.position.y=0),r.renderedPosition){var i=r.renderedPosition,s=e.pan(),l=e.zoom();o.position={x:(i.x-s.x)/l,y:(i.y-s.y)/l}}var u=[];ke(r.classes)?u=r.classes:ge(r.classes)&&(u=r.classes.split(/\s+/));for(var v=0,f=u.length;vb?1:0},v=function(y,b,m,T,C){var S;if(m==null&&(m=0),C==null&&(C=a),m<0)throw new Error("lo must be non-negative");for(T==null&&(T=y.length);mD;0<=D?w++:w--)x.push(w);return x}).apply(this).reverse(),E=[],T=0,C=S.length;TL;0<=L?++x:--x)A.push(i(y,m));return A},p=function(y,b,m,T){var C,S,E;for(T==null&&(T=a),C=y[m];m>b;){if(E=m-1>>1,S=y[E],T(C,S)<0){y[m]=S,m=E;continue}break}return y[m]=C},g=function(y,b,m){var T,C,S,E,x;for(m==null&&(m=a),C=y.length,x=b,S=y[b],T=2*b+1;T0;){var S=b.pop(),E=g(S),x=S.id();if(d[x]=E,E!==1/0)for(var w=S.neighborhood().intersect(c),D=0;D0)for(P.unshift(k);f[z];){var G=f[z];P.unshift(G.edge),P.unshift(G.node),B=G.node,z=B.id()}return s.spawn(P)}}}},Yv={kruskal:function(e){e=e||function(m){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,o=a.length,i=new Array(o),s=a,l=function(T){for(var C=0;C0;){if(C(),E++,T===v){for(var x=[],w=o,D=v,L=y[D];x.unshift(w),L!=null&&x.unshift(L),w=g[D],w!=null;)D=w.id(),L=y[D];return{found:!0,distance:f[T],path:this.spawn(x),steps:E}}h[T]=!0;for(var A=m._private.edges,N=0;NL&&(c[D]=L,b[D]=w,m[D]=C),!o){var A=w*v+x;!o&&c[A]>L&&(c[A]=L,b[A]=x,m[A]=C)}}}for(var N=0;N1&&arguments[1]!==void 0?arguments[1]:i,Oe=m(ve),Te=[],xe=Oe;;){if(xe==null)return r.spawn();var Se=b(xe),ee=Se.edge,I=Se.pred;if(Te.unshift(xe[0]),xe.same(ye)&&Te.length>0)break;ee!=null&&Te.unshift(ee),xe=I}return l.spawn(Te)},S=0;S=0;v--){var f=u[v],d=f[1],h=f[2];(r[d]===s&&r[h]===l||r[d]===l&&r[h]===s)&&u.splice(v,1)}for(var c=0;cn;){var o=Math.floor(Math.random()*r.length);r=Jv(o,e,r),a--}return r},jv={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(P){return P.isLoop()});var o=a.length,i=n.length,s=Math.ceil(Math.pow(Math.log(o)/Math.LN2,2)),l=Math.floor(o/Qv);if(o<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,o=r;o1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,o=r;o1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,o=0,i=r;i1&&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,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a0&&e.splice(0,r));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];i?isFinite(u)||(e[l]=-1/0,s++):e.splice(l,1)}o&&e.sort(function(d,h){return d-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},of=function(e){return Math.PI*e/180},ka=function(e,r){return Math.atan2(r,e)-Math.PI/2},wi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Os=function(e){return e>0?1:e<0?-1:0},pr=function(e,r){return Math.sqrt(ur(e,r))},ur=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},sf=function(e){for(var r=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}}},uf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},vf=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},ff=function(e,r,a){return{x1:e.x1+r,x2:e.x2+r,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},Ns=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},hf=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Ha=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Xa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,o,i;if(r.length===1)a=n=o=i=r[0];else if(r.length===2)a=o=r[0],i=n=r[1];else if(r.length===4){var s=Lt(r,4);a=s[0],n=s[1],o=s[2],i=s[3]}return e.x1-=i,e.x2+=n,e.y1-=a,e.y2+=o,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},to=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},xi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},zr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},cf=function(e,r){return zr(e,r.x,r.y)},Is=function(e,r){return zr(e,r.x1,r.y1)&&zr(e,r.x2,r.y2)},Ms=function(e,r,a,n,o,i,s){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?yr(o,i):l,v=o/2,f=i/2;u=Math.min(u,v,f);var d=u!==v,h=u!==f,c;if(d){var p=a-v+u-s,g=n-f-s,y=a+v-u+s,b=g;if(c=Qt(e,r,a,n,p,g,y,b,!1),c.length>0)return c}if(h){var m=a+v+s,T=n-f+u-s,C=m,S=n+f-u+s;if(c=Qt(e,r,a,n,m,T,C,S,!1),c.length>0)return c}if(d){var E=a-v+u-s,x=n+f+s,w=a+v-u+s,D=x;if(c=Qt(e,r,a,n,E,x,w,D,!1),c.length>0)return c}if(h){var L=a-v-s,A=n-f+u-s,N=L,O=n+f-u+s;if(c=Qt(e,r,a,n,L,A,N,O,!1),c.length>0)return c}var M;{var R=a-v+u,k=n-f+u;if(M=sa(e,r,a,n,R,k,u+s),M.length>0&&M[0]<=R&&M[1]<=k)return[M[0],M[1]]}{var P=a+v-u,B=n-f+u;if(M=sa(e,r,a,n,P,B,u+s),M.length>0&&M[0]>=P&&M[1]<=B)return[M[0],M[1]]}{var z=a+v-u,G=n+f-u;if(M=sa(e,r,a,n,z,G,u+s),M.length>0&&M[0]>=z&&M[1]>=G)return[M[0],M[1]]}{var F=a-v+u,U=n+f-u;if(M=sa(e,r,a,n,F,U,u+s),M.length>0&&M[0]<=F&&M[1]>=U)return[M[0],M[1]]}return[]},df=function(e,r,a,n,o,i,s){var l=s,u=Math.min(a,o),v=Math.max(a,o),f=Math.min(n,i),d=Math.max(n,i);return u-l<=e&&e<=v+l&&f-l<=r&&r<=d+l},gf=function(e,r,a,n,o,i,s,l,u){var v={x1:Math.min(a,s,o)-u,x2:Math.max(a,s,o)+u,y1:Math.min(n,l,i)-u,y2:Math.max(n,l,i)+u};return!(ev.x2||rv.y2)},pf=function(e,r,a,n){a-=n;var o=r*r-4*e*a;if(o<0)return[];var i=Math.sqrt(o),s=2*e,l=(-r+i)/s,u=(-r-i)/s;return[l,u]},yf=function(e,r,a,n,o){var i=1e-5;e===0&&(e=i),r/=e,a/=e,n/=e;var s,l,u,v,f,d,h,c;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,s=l*l*l+u*u,o[1]=0,h=r/3,s>0){f=u+Math.sqrt(s),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=u-Math.sqrt(s),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),o[0]=-h+f+d,h+=(f+d)/2,o[4]=o[2]=-h,h=Math.sqrt(3)*(-d+f)/2,o[3]=h,o[5]=-h;return}if(o[5]=o[3]=0,s===0){c=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),o[0]=-h+2*c,o[4]=o[2]=-(c+h);return}l=-l,v=l*l*l,v=Math.acos(u/Math.sqrt(v)),c=2*Math.sqrt(l),o[0]=-h+c*Math.cos(v/3),o[2]=-h+c*Math.cos((v+2*Math.PI)/3),o[4]=-h+c*Math.cos((v+4*Math.PI)/3)},mf=function(e,r,a,n,o,i,s,l){var u=1*a*a-4*a*o+2*a*s+4*o*o-4*o*s+s*s+n*n-4*n*i+2*n*l+4*i*i-4*i*l+l*l,v=1*9*a*o-3*a*a-3*a*s-6*o*o+3*o*s+9*n*i-3*n*n-3*n*l-6*i*i+3*i*l,f=1*3*a*a-6*a*o+a*s-a*e+2*o*o+2*o*e-s*e+3*n*n-6*n*i+n*l-n*r+2*i*i+2*i*r-l*r,d=1*a*o-a*a+a*e-o*e+n*i-n*n+n*r-i*r,h=[];yf(u,v,f,d,h);for(var c=1e-7,p=[],g=0;g<6;g+=2)Math.abs(h[g+1])=0&&h[g]<=1&&p.push(h[g]);p.push(1),p.push(0);for(var y=-1,b,m,T,C=0;C=0?Tu?(e-o)*(e-o)+(r-i)*(r-i):v-d},gt=function(e,r,a){for(var n,o,i,s,l,u=0,v=0;v=e&&e>=i||n<=e&&e<=i)l=(e-n)/(i-n)*(s-o)+o,l>r&&u++;else continue;return u%2!==0},Yt=function(e,r,a,n,o,i,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 d=Math.cos(-f),h=Math.sin(-f),c=0;c0){var g=sn(v,-u);p=on(g)}else p=v;return gt(e,r,p)},Ef=function(e,r,a,n,o,i,s,l){for(var u=new Array(a.length*2),v=0;v=0&&g<=1&&b.push(g),y>=0&&y<=1&&b.push(y),b.length===0)return[];var m=b[0]*l[0]+e,T=b[0]*l[1]+r;if(b.length>1){if(b[0]==b[1])return[m,T];var C=b[1]*l[0]+e,S=b[1]*l[1]+r;return[m,T,C,S]}else return[m,T]},Fn=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Qt=function(e,r,a,n,o,i,s,l,u){var v=e-o,f=a-e,d=s-o,h=r-i,c=n-r,p=l-i,g=d*h-p*v,y=f*h-c*v,b=p*f-d*c;if(b!==0){var m=g/b,T=y/b,C=.001,S=0-C,E=1+C;return S<=m&&m<=E&&S<=T&&T<=E?[e+m*f,r+m*c]:u?[e+m*f,r+m*c]:[]}else return g===0||y===0?Fn(e,a,s)===s?[s,l]:Fn(e,a,o)===o?[o,i]:Fn(o,s,a)===a?[a,n]:[]:[]},ya=function(e,r,a,n,o,i,s,l){var u=[],v,f=new Array(a.length),d=!0;i==null&&(d=!1);var h;if(d){for(var c=0;c0){var p=sn(f,-l);h=on(p)}else h=f}else h=a;for(var g,y,b,m,T=0;T2){for(var c=[v[0],v[1]],p=Math.pow(c[0]-e,2)+Math.pow(c[1]-r,2),g=1;gv&&(v=T)},get:function(m){return u[m]}},d=0;d0?R=M.edgesTo(O)[0]:R=O.edgesTo(M)[0];var k=n(R);O=O.id(),x[O]>x[A]+k&&(x[O]=x[A]+k,w.nodes.indexOf(O)<0?w.push(O):w.updateItem(O),E[O]=0,S[O]=[]),x[O]==x[A]+k&&(E[O]=E[O]+E[A],S[O].push(A))}else for(var P=0;P0;){for(var F=C.pop(),U=0;U0&&s.push(a[l]);s.length!==0&&o.push(n.collection(s))}return o},Bf=function(e,r){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:zf,s=n,l,u,v=0;v=2?ta(e,r,a,0,oo,Vf):ta(e,r,a,0,io)},squaredEuclidean:function(e,r,a){return ta(e,r,a,0,oo)},manhattan:function(e,r,a){return ta(e,r,a,0,io)},max:function(e,r,a){return ta(e,r,a,-1/0,Uf)}};Vr["squared-euclidean"]=Vr.squaredEuclidean;Vr.squaredeuclidean=Vr.squaredEuclidean;function bn(t,e,r,a,n,o){var i;return ze(t)?i=t:i=Vr[t]||Vr.euclidean,e===0&&ze(t)?i(n,o):i(e,r,a,n,o)}var $f=rt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Ci=function(e){return $f(e)},ln=function(e,r,a,n,o){var i=o!=="kMedoids",s=i?function(f){return a[f]}:function(f){return n[f](a)},l=function(d){return n[d](r)},u=a,v=r;return bn(e,n.length,s,l,u,v)},Gn=function(e,r,a){for(var n=a.length,o=new Array(n),i=new Array(n),s=new Array(r),l=null,u=0;ua)return!1}return!0},Hf=function(e,r,a){for(var n=0;ns&&(s=r[u][v],l=v);o[l].push(e[u])}for(var f=0;f=o.threshold||o.mode==="dendrogram"&&e.length===1)return!1;var c=r[i],p=r[n[i]],g;o.mode==="dendrogram"?g={left:c,right:p,key:c.key}:g={value:c.value.concat(p.value),key:c.key},e[c.index]=g,e.splice(p.index,1),r[c.key]=g;for(var y=0;ya[p.key][b.key]&&(l=a[p.key][b.key])):o.linkage==="max"?(l=a[c.key][b.key],a[c.key][b.key]0&&n.push(o);return n},ho=function(e,r,a){for(var n=[],o=0;os&&(i=u,s=r[o*e+u])}i>0&&n.push(i)}for(var v=0;vu&&(l=v,u=f)}a[o]=i[l]}return n=ho(e,r,a),n},co=function(e){for(var r=this.cy(),a=this.nodes(),n=ih(e),o={},i=0;i=L?(A=L,L=O,N=M):O>A&&(A=O);for(var R=0;R0?1:0;E[w%n.minIterations*s+F]=U,G+=U}if(G>0&&(w>=n.minIterations-1||w==n.maxIterations-1)){for(var H=0,_=0;_1||S>1)&&(s=!0),f[m]=[],b.outgoers().forEach(function(x){x.isEdge()&&f[m].push(x.id())})}else d[m]=[void 0,b.target().id()]}):i.forEach(function(b){var m=b.id();if(b.isNode()){var T=b.degree(!0);T%2&&(l?u?s=!0:u=m:l=m),f[m]=[],b.connectedEdges().forEach(function(C){return f[m].push(C.id())})}else d[m]=[b.source().id(),b.target().id()]});var h={found:!1,trail:void 0};if(s)return h;if(u&&l)if(o){if(v&&u!=v)return h;v=u}else{if(v&&u!=v&&l!=v)return h;v||(v=u)}else v||(v=i[0].id());var c=function(m){for(var T=m,C=[m],S,E,x;f[T].length;)S=f[T].shift(),E=d[S][0],x=d[S][1],T!=x?(f[x]=f[x].filter(function(w){return w!=S}),T=x):!o&&T!=E&&(f[E]=f[E].filter(function(w){return w!=S}),T=E),C.unshift(S),C.unshift(T);return C},p=[],g=[];for(g=c(v);g.length!=1;)f[g[0]].length==0?(p.unshift(i.getElementById(g.shift())),p.unshift(i.getElementById(g.shift()))):g=c(g.shift()).concat(g);p.unshift(i.getElementById(g.shift()));for(var y in f)if(f[y].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},Fa=function(){var e=this,r={},a=0,n=0,o=[],i=[],s={},l=function(d,h){for(var c=i.length-1,p=[],g=e.spawn();i[c].x!=d||i[c].y!=h;)p.push(i.pop().edge),c--;p.push(i.pop().edge),p.forEach(function(y){var b=y.connectedNodes().intersection(e);g.merge(y),b.forEach(function(m){var T=m.id(),C=m.connectedEdges().intersection(e);g.merge(m),r[T].cutVertex?g.merge(C.filter(function(S){return S.isLoop()})):g.merge(C)})}),o.push(g)},u=function f(d,h,c){d===c&&(n+=1),r[h]={id:a,low:a++,cutVertex:!1};var p=e.getElementById(h).connectedEdges().intersection(e);if(p.size()===0)o.push(e.spawn(e.getElementById(h)));else{var g,y,b,m;p.forEach(function(T){g=T.source().id(),y=T.target().id(),b=g===h?y:g,b!==c&&(m=T.id(),s[m]||(s[m]=!0,i.push({x:h,y:b,edge:T})),b in r?r[h].low=Math.min(r[h].low,r[b].id):(f(d,b,h),r[h].low=Math.min(r[h].low,r[b].low),r[h].id<=r[b].low&&(r[h].cutVertex=!0,l(h,b))))})}};e.forEach(function(f){if(f.isNode()){var d=f.id();d in r||(n=0,u(d,d),r[d].cutVertex=n>1)}});var v=Object.keys(r).filter(function(f){return r[f].cutVertex}).map(function(f){return e.getElementById(f)});return{cut:e.spawn(v),components:o}},ch={hopcroftTarjanBiconnected:Fa,htbc:Fa,htb:Fa,hopcroftTarjanBiconnectedComponents:Fa},Ga=function(){var e=this,r={},a=0,n=[],o=[],i=e.spawn(e),s=function l(u){o.push(u),r[u]={index:a,low:a++,explored:!1};var v=e.getElementById(u).connectedEdges().intersection(e);if(v.forEach(function(p){var g=p.target().id();g!==u&&(g in r||l(g),r[g].explored||(r[u].low=Math.min(r[u].low,r[g].low)))}),r[u].index===r[u].low){for(var f=e.spawn();;){var d=o.pop();if(f.merge(e.getElementById(d)),r[d].low=r[u].index,r[d].explored=!0,d===u)break}var h=f.edgesWith(f),c=f.merge(h);n.push(c),i=i.difference(c)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||s(u)}}),{cut:i,components:n}},dh={tarjanStronglyConnected:Ga,tsc:Ga,tscc:Ga,tarjanStronglyConnectedComponents:Ga},zs={};[ga,_v,Yv,Xv,Wv,Zv,jv,Df,Pr,Br,Qn,Gf,Qf,ah,vh,hh,ch,dh].forEach(function(t){Ee(zs,t)});/*! 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 Vs=0,Us=1,$s=2,Ht=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=Vs,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))};Ht.prototype={fulfill:function(e){return go(this,Us,"fulfillValue",e)},reject:function(e){return go(this,$s,"rejectReason",e)},then:function(e,r){var a=this,n=new Ht;return a.onFulfilled.push(yo(e,n,"fulfill")),a.onRejected.push(yo(r,n,"reject")),_s(a),n.proxy}};var go=function(e,r,a,n){return e.state===Vs&&(e.state=r,e[a]=n,_s(e)),e},_s=function(e){e.state===Us?po(e,"onFulfilled",e.fulfillValue):e.state===$s&&po(e,"onRejected",e.rejectReason)},po=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var o=function(){for(var s=0;s0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var i=0;i-1}var wc=Ec;function xc(t,e){var r=this.__data__,a=wn(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Tc=xc;function Hr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e-1&&t%1==0&&t0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){ke(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,o=[],i=0,s=a.length;i0&&this.spawn(o).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};qa.className=qa.classNames=qa.classes;var Ce={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:Xe,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ce.variable="(?:[\\w-.]|(?:\\\\"+Ce.metaChar+"))+";Ce.className="(?:[\\w-]|(?:\\\\"+Ce.metaChar+"))+";Ce.value=Ce.string+"|"+Ce.number;Ce.id=Ce.variable;(function(){var t,e,r;for(t=Ce.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(Ce.comparatorOp+="|\\!"+e)})();var Me=function(){return{checks:[]}},se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},jn=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return Fu(t.selector,e.selector)}),Ld=function(){for(var t={},e,r=0;r0&&v.edgeCount>0)return Ie("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(v.edgeCount>1)return Ie("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;v.edgeCount===1&&Ie("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},Rd=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(v){return v??""},r=function(v){return ge(v)?'"'+v+'"':e(v)},a=function(v){return" "+v+" "},n=function(v,f){var d=v.type,h=v.value;switch(d){case se.GROUP:{var c=e(h);return c.substring(0,c.length-1)}case se.DATA_COMPARE:{var p=v.field,g=v.operator;return"["+p+a(e(g))+r(h)+"]"}case se.DATA_BOOL:{var y=v.operator,b=v.field;return"["+e(y)+b+"]"}case se.DATA_EXIST:{var m=v.field;return"["+m+"]"}case se.META_COMPARE:{var T=v.operator,C=v.field;return"[["+C+a(e(T))+r(h)+"]]"}case se.STATE:return h;case se.ID:return"#"+h;case se.CLASS:return"."+h;case se.PARENT:case se.CHILD:return o(v.parent,f)+a(">")+o(v.child,f);case se.ANCESTOR:case se.DESCENDANT:return o(v.ancestor,f)+" "+o(v.descendant,f);case se.COMPOUND_SPLIT:{var S=o(v.left,f),E=o(v.subject,f),x=o(v.right,f);return S+(S.length>0?" ":"")+E+x}case se.TRUE:return""}},o=function(v,f){return v.checks.reduce(function(d,h,c){return d+(f===v&&c===0?"$":"")+n(h,f)},"")},i="",s=0;s1&&s=0&&(r=r.replace("!",""),f=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),v=!0),(o||s||v)&&(l=!o&&!i?"":""+e,u=""+a),v&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":d=!0,n=e>a;break;case">=":d=!0,n=e>=a;break;case"<":d=!0,n=e0;){var v=n.shift();e(v),o.add(v.id()),s&&a(n,o,v)}return t}function Js(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,Js)};function js(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Ur.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,js)};function Ud(t,e,r){js(t,e,r),Js(t,e,r)}Ur.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,Ud)};Ur.ancestors=Ur.parents;var ba,el;ba=el={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Ne.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Ne.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};ba.attr=ba.data;ba.removeAttr=ba.removeData;var $d=el,Tn={};function Vn(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],o=n._private.edges,i=0;ie}),minIndegree:Sr("indegree",function(t,e){return te}),minOutdegree:Sr("outdegree",function(t,e){return te})});Ee(Tn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n0,d=f;f&&(v=v[0]);var h=d?v.position():{x:0,y:0};r!==void 0?u.position(e,r+h[e]):o!==void 0&&u.position({x:o.x+h.x,y:o.y+h.y})}else{var c=a.position(),p=s?a.parent():null,g=p&&p.length>0,y=g;g&&(p=p[0]);var b=y?p.position():{x:0,y:0};return o={x:c.x-b.x,y:c.y-b.y},e===void 0?o:o[e]}else if(!i)return;return this}};Nt.modelPosition=Nt.point=Nt.position;Nt.modelPositions=Nt.points=Nt.positions;Nt.renderedPoint=Nt.renderedPosition;Nt.relativePoint=Nt.relativePosition;var _d=tl,Fr,or;Fr=or={};or.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),o=e.x1*a+n.x,i=e.x2*a+n.x,s=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:o,x2:i,y1:s,y2:l,w:i-o,h:l-s}};or.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};or.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(i){if(!i.isParent())return;var s=i._private,l=i.children(),u=i.pstyle("compound-sizing-wrt-labels").value==="include",v={width:{val:i.pstyle("min-width").pfValue,left:i.pstyle("min-width-bias-left"),right:i.pstyle("min-width-bias-right")},height:{val:i.pstyle("min-height").pfValue,top:i.pstyle("min-height-bias-top"),bottom:i.pstyle("min-height-bias-bottom")}},f=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),d=s.position;(f.w===0||f.h===0)&&(f={w:i.pstyle("width").pfValue,h:i.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function h(w,D,L){var A=0,N=0,O=D+L;return w>0&&O>0&&(A=D/O*w,N=L/O*w),{biasDiff:A,biasComplementDiff:N}}function c(w,D,L,A){if(L.units==="%")switch(A){case"width":return w>0?L.pfValue*w:0;case"height":return D>0?L.pfValue*D:0;case"average":return w>0&&D>0?L.pfValue*(w+D)/2:0;case"min":return w>0&&D>0?w>D?L.pfValue*D:L.pfValue*w:0;case"max":return w>0&&D>0?w>D?L.pfValue*w:L.pfValue*D:0;default:return 0}else return L.units==="px"?L.pfValue:0}var p=v.width.left.value;v.width.left.units==="px"&&v.width.val>0&&(p=p*100/v.width.val);var g=v.width.right.value;v.width.right.units==="px"&&v.width.val>0&&(g=g*100/v.width.val);var y=v.height.top.value;v.height.top.units==="px"&&v.height.val>0&&(y=y*100/v.height.val);var b=v.height.bottom.value;v.height.bottom.units==="px"&&v.height.val>0&&(b=b*100/v.height.val);var m=h(v.width.val-f.w,p,g),T=m.biasDiff,C=m.biasComplementDiff,S=h(v.height.val-f.h,y,b),E=S.biasDiff,x=S.biasComplementDiff;s.autoPadding=c(f.w,f.h,i.pstyle("padding"),i.pstyle("padding-relative-to").value),s.autoWidth=Math.max(f.w,v.width.val),d.x=(-T+f.x1+f.x2+C)/2,s.autoHeight=Math.max(f.h,v.height.val),d.y=(-E+f.y1+f.y2+x)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?o:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},vr=function(e,r){return r==null?e:At(e,r.x1,r.y1,r.x2,r.y2)},ra=function(e,r,a){return Ot(e,r,a)},za=function(e,r,a){if(!r.cy().headless()){var n=r._private,o=n.rstyle,i=o.arrowWidth/2,s=r.pstyle(a+"-arrow-shape").value,l,u;if(s!=="none"){a==="source"?(l=o.srcX,u=o.srcY):a==="target"?(l=o.tgtX,u=o.tgtY):(l=o.midX,u=o.midY);var v=n.arrowBounds=n.arrowBounds||{},f=v[a]=v[a]||{};f.x1=l-i,f.y1=u-i,f.x2=l+i,f.y2=u+i,f.w=f.x2-f.x1,f.h=f.y2-f.y1,Ha(f,1),At(e,f.x1,f.y1,f.x2,f.y2)}}},Un=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var o=r._private,i=o.rstyle,s=r.pstyle(n+"label").strValue;if(s){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),v=ra(i,"labelWidth",a),f=ra(i,"labelHeight",a),d=ra(i,"labelX",a),h=ra(i,"labelY",a),c=r.pstyle(n+"text-margin-x").pfValue,p=r.pstyle(n+"text-margin-y").pfValue,g=r.isEdge(),y=r.pstyle(n+"text-rotation"),b=r.pstyle("text-outline-width").pfValue,m=r.pstyle("text-border-width").pfValue,T=m/2,C=r.pstyle("text-background-padding").pfValue,S=2,E=f,x=v,w=x/2,D=E/2,L,A,N,O;if(g)L=d-w,A=d+w,N=h-D,O=h+D;else{switch(l.value){case"left":L=d-x,A=d;break;case"center":L=d-w,A=d+w;break;case"right":L=d,A=d+x;break}switch(u.value){case"top":N=h-E,O=h;break;case"center":N=h-D,O=h+D;break;case"bottom":N=h,O=h+E;break}}L+=c-Math.max(b,T)-C-S,A+=c+Math.max(b,T)+C+S,N+=p-Math.max(b,T)-C-S,O+=p+Math.max(b,T)+C+S;var M=a||"main",R=o.labelBounds,k=R[M]=R[M]||{};k.x1=L,k.y1=N,k.x2=A,k.y2=O,k.w=A-L,k.h=O-N;var P=g&&y.strValue==="autorotate",B=y.pfValue!=null&&y.pfValue!==0;if(P||B){var z=P?ra(o.rstyle,"labelAngle",a):y.pfValue,G=Math.cos(z),F=Math.sin(z),U=(L+A)/2,H=(N+O)/2;if(!g){switch(l.value){case"left":U=A;break;case"right":U=L;break}switch(u.value){case"top":H=O;break;case"bottom":H=N;break}}var _=function(he,ae){return he=he-U,ae=ae-H,{x:he*G-ae*F+U,y:he*F+ae*G+H}},Q=_(L,N),J=_(L,O),q=_(A,N),V=_(A,O);L=Math.min(Q.x,J.x,q.x,V.x),A=Math.max(Q.x,J.x,q.x,V.x),N=Math.min(Q.y,J.y,q.y,V.y),O=Math.max(Q.y,J.y,q.y,V.y)}var Z=M+"Rot",K=R[Z]=R[Z]||{};K.x1=L,K.y1=N,K.x2=A,K.y2=O,K.w=A-L,K.h=O-N,At(e,L,N,A,O),At(o.labelBounds.all,L,N,A,O)}return e}},Yd=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value;if(a>0&&n>0){var o=r.pstyle("outline-offset").value,i=r.pstyle("shape").value,s=n+o,l=(e.w+s*2)/e.w,u=(e.h+s*2)/e.h,v=0,f=0;["diamond","pentagon","round-triangle"].includes(i)?(l=(e.w+s*2.4)/e.w,f=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(i)?l=(e.w+s*2.4)/e.w:i==="star"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.6)/e.h,f=-s/3.8):i==="triangle"?(l=(e.w+s*2.8)/e.w,u=(e.h+s*2.4)/e.h,f=-s/1.4):i==="vee"&&(l=(e.w+s*4.4)/e.w,u=(e.h+s*3.8)/e.h,f=-s*.5);var d=e.h*u-e.h,h=e.w*l-e.w;if(Xa(e,[Math.ceil(d/2),Math.ceil(h/2)]),v!=0||f!==0){var c=ff(e,v,f);Ns(e,c)}}}},Hd=function(e,r){var a=e._private.cy,n=a.styleEnabled(),o=a.headless(),i=pt(),s=e._private,l=e.isNode(),u=e.isEdge(),v,f,d,h,c,p,g=s.rstyle,y=l&&n?e.pstyle("bounds-expansion").pfValue:[0],b=function(le){return le.pstyle("display").value!=="none"},m=!n||b(e)&&(!u||b(e.source())&&b(e.target()));if(m){var T=0,C=0;n&&r.includeOverlays&&(T=e.pstyle("overlay-opacity").value,T!==0&&(C=e.pstyle("overlay-padding").value));var S=0,E=0;n&&r.includeUnderlays&&(S=e.pstyle("underlay-opacity").value,S!==0&&(E=e.pstyle("underlay-padding").value));var x=Math.max(C,E),w=0,D=0;if(n&&(w=e.pstyle("width").pfValue,D=w/2),l&&r.includeNodes){var L=e.position();c=L.x,p=L.y;var A=e.outerWidth(),N=A/2,O=e.outerHeight(),M=O/2;v=c-N,f=c+N,d=p-M,h=p+M,At(i,v,d,f,h),n&&r.includeOutlines&&Yd(i,e)}else if(u&&r.includeEdges)if(n&&!o){var R=e.pstyle("curve-style").strValue;if(v=Math.min(g.srcX,g.midX,g.tgtX),f=Math.max(g.srcX,g.midX,g.tgtX),d=Math.min(g.srcY,g.midY,g.tgtY),h=Math.max(g.srcY,g.midY,g.tgtY),v-=D,f+=D,d-=D,h+=D,At(i,v,d,f,h),R==="haystack"){var k=g.haystackPts;if(k&&k.length===2){if(v=k[0].x,d=k[0].y,f=k[1].x,h=k[1].y,v>f){var P=v;v=f,f=P}if(d>h){var B=d;d=h,h=B}At(i,v-D,d-D,f+D,h+D)}}else if(R==="bezier"||R==="unbundled-bezier"||R.endsWith("segments")||R.endsWith("taxi")){var z;switch(R){case"bezier":case"unbundled-bezier":z=g.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":z=g.linePts;break}if(z!=null)for(var G=0;Gf){var J=v;v=f,f=J}if(d>h){var q=d;d=h,h=q}v-=D,f+=D,d-=D,h+=D,At(i,v,d,f,h)}if(n&&r.includeEdges&&u&&(za(i,e,"mid-source"),za(i,e,"mid-target"),za(i,e,"source"),za(i,e,"target")),n){var V=e.pstyle("ghost").value==="yes";if(V){var Z=e.pstyle("ghost-offset-x").pfValue,K=e.pstyle("ghost-offset-y").pfValue;At(i,i.x1+Z,i.y1+K,i.x2+Z,i.y2+K)}}var ie=s.bodyBounds=s.bodyBounds||{};to(ie,i),Xa(ie,y),Ha(ie,1),n&&(v=i.x1,f=i.x2,d=i.y1,h=i.y2,At(i,v-x,d-x,f+x,h+x));var he=s.overlayBounds=s.overlayBounds||{};to(he,i),Xa(he,y),Ha(he,1);var ae=s.labelBounds=s.labelBounds||{};ae.all!=null?vf(ae.all):ae.all=pt(),n&&r.includeLabels&&(r.includeMainLabels&&Un(i,e,null),u&&(r.includeSourceLabels&&Un(i,e,"source"),r.includeTargetLabels&&Un(i,e,"target")))}return i.x1=wt(i.x1),i.y1=wt(i.y1),i.x2=wt(i.x2),i.y2=wt(i.y2),i.w=wt(i.x2-i.x1),i.h=wt(i.y2-i.y1),i.w>0&&i.h>0&&m&&(Xa(i,y),Ha(i,1)),i},al=function(e){var r=0,a=function(i){return(i?1:0)<0&&arguments[0]!==void 0?arguments[0]:og,e=arguments.length>1?arguments[1]:void 0,r=0;r=0;s--)i(s);return this};nr.removeAllListeners=function(){return this.removeListener("*")};nr.emit=nr.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,ke(e)||(e=[e]),sg(this,function(o,i){r!=null&&(a=[{event:i.event,type:i.type,namespace:i.namespace,callback:r}],n=a.length);for(var s=function(v){var f=a[v];if(f.type===i.type&&(!f.namespace||f.namespace===i.namespace||f.namespace===ig)&&o.eventMatches(o.context,f,i)){var d=[i];e!=null&&Fv(d,e),o.beforeEmit(o.context,f,i),f.conf&&f.conf.one&&(o.listeners=o.listeners.filter(function(p){return p!==f}));var h=o.callbackContext(o.context,f,i),c=f.callback.apply(h,d);o.afterEmit(o.context,f,i),c===!1&&(i.stopPropagation(),i.preventDefault())}},l=0;l1&&!i){var s=this.length-1,l=this[s],u=l._private.data.id;this[s]=void 0,this[e]=l,o.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,o=n.get(a);if(!o)return this;var i=o.index;return this.unmergeAt(i),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ge(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,o=0;oa&&(a=l,n=s)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,o=this,i=0;i=0&&o"u"?"undefined":qe(Symbol))!=e&&qe(Symbol.iterator)!=e;r&&(un[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},o=0,i=this.length;return ls({next:function(){return o1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var o=a._private.style[e];return o??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,o=a.style();if(De(e)){var i=e;o.applyBypass(this,i,n),this.emitAndNotify("style")}else if(ge(e))if(r===void 0){var s=this[0];return s?o.getStylePropertyValue(s,e):void 0}else o.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?o.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),o=this;if(e===void 0)for(var i=0;i0&&e.push(v[0]),e.push(s[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});ot.neighbourhood=ot.neighborhood;ot.closedNeighbourhood=ot.closedNeighborhood;ot.openNeighbourhood=ot.openNeighborhood;Ee(ot,{source:xt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:xt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:ko({attr:"source"}),targets:ko({attr:"target"})});function ko(t){return function(r){for(var a=[],n=0;n0);return i},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});ot.componentsOf=ot.components;var tt=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){Ve("A collection must have a reference to the core");return}var o=new Ft,i=!1;if(!r)r=[];else if(r.length>0&&De(r[0])&&!Ca(r[0])){i=!0;for(var s=[],l=new $r,u=0,v=r.length;u0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,o=[],i=[],s,l=0,u=r.length;l0){for(var B=s.length===r.length?r:new tt(a,s),z=0;z0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},o=r._private.cy;function i(O){for(var M=O._private.edges,R=0;R0&&(t?L.emitAndNotify("remove"):e&&L.emit("remove"));for(var A=0;A0?A=O:L=O;while(Math.abs(N)>i&&++M=o?b(D,M):R===0?M:T(D,L,L+u)}var S=!1;function E(){S=!0,(t!==e||r!==a)&&m()}var x=function(L){return S||E(),t===e&&r===a?L:L===0?0:L===1?1:g(C(L),e,a)};x.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var w="generateBezier("+[t,e,r,a]+")";return x.toString=function(){return w},x}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var mg=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,o){var i={x:a.x+o.dx*n,v:a.v+o.dv*n,tension:a.tension,friction:a.friction};return{dx:i.v,dv:t(i)}}function r(a,n){var o={dx:a.v,dv:t(a)},i=e(a,n*.5,o),s=e(a,n*.5,i),l=e(a,n,s),u=1/6*(o.dx+2*(i.dx+s.dx)+l.dx),v=1/6*(o.dv+2*(i.dv+s.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+v*n,a}return function a(n,o,i){var s={x:-1,v:0,tension:null,friction:null},l=[0],u=0,v=1/1e4,f=16/1e3,d,h,c;for(n=parseFloat(n)||500,o=parseFloat(o)||20,i=i||null,s.tension=n,s.friction=o,d=i!==null,d?(u=a(n,o),h=u/i*f):h=f;c=r(c||s,h),l.push(1+c.x),u+=16,Math.abs(c.x)>v&&Math.abs(c.v)>v;);return d?function(p){return l[p*(l.length-1)|0]}:u}}(),Pe=function(e,r,a,n){var o=yg(e,r,a,n);return function(i,s,l){return i+(s-i)*o(l)}},Ka={linear:function(e,r,a){return e+(r-e)*a},ease:Pe(.25,.1,.25,1),"ease-in":Pe(.42,0,1,1),"ease-out":Pe(0,0,.58,1),"ease-in-out":Pe(.42,0,.58,1),"ease-in-sine":Pe(.47,0,.745,.715),"ease-out-sine":Pe(.39,.575,.565,1),"ease-in-out-sine":Pe(.445,.05,.55,.95),"ease-in-quad":Pe(.55,.085,.68,.53),"ease-out-quad":Pe(.25,.46,.45,.94),"ease-in-out-quad":Pe(.455,.03,.515,.955),"ease-in-cubic":Pe(.55,.055,.675,.19),"ease-out-cubic":Pe(.215,.61,.355,1),"ease-in-out-cubic":Pe(.645,.045,.355,1),"ease-in-quart":Pe(.895,.03,.685,.22),"ease-out-quart":Pe(.165,.84,.44,1),"ease-in-out-quart":Pe(.77,0,.175,1),"ease-in-quint":Pe(.755,.05,.855,.06),"ease-out-quint":Pe(.23,1,.32,1),"ease-in-out-quint":Pe(.86,0,.07,1),"ease-in-expo":Pe(.95,.05,.795,.035),"ease-out-expo":Pe(.19,1,.22,1),"ease-in-out-expo":Pe(1,0,0,1),"ease-in-circ":Pe(.6,.04,.98,.335),"ease-out-circ":Pe(.075,.82,.165,1),"ease-in-out-circ":Pe(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Ka.linear;var n=mg(e,r,a);return function(o,i,s){return o+(i-o)*n(s)}},"cubic-bezier":Pe};function Fo(t,e,r,a,n){if(a===1||e===r)return r;var o=n(e,r,a);return t==null||((t.roundValue||t.color)&&(o=Math.round(o)),t.min!==void 0&&(o=Math.max(o,t.min)),t.max!==void 0&&(o=Math.min(o,t.max))),o}function Go(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Lr(t,e,r,a,n){var o=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var i=Go(t,n),s=Go(e,n);if(oe(i)&&oe(s))return Fo(o,i,s,r,a);if(ke(i)&&ke(s)){for(var l=[],u=0;u0?(h==="spring"&&c.push(i.duration),i.easingImpl=Ka[h].apply(null,c)):i.easingImpl=Ka[h]}var p=i.easingImpl,g;if(i.duration===0?g=1:g=(r-l)/i.duration,i.applying&&(g=i.progress),g<0?g=0:g>1&&(g=1),i.delay==null){var y=i.startPosition,b=i.position;if(b&&n&&!t.locked()){var m={};na(y.x,b.x)&&(m.x=Lr(y.x,b.x,g,p)),na(y.y,b.y)&&(m.y=Lr(y.y,b.y,g,p)),t.position(m)}var T=i.startPan,C=i.pan,S=o.pan,E=C!=null&&a;E&&(na(T.x,C.x)&&(S.x=Lr(T.x,C.x,g,p)),na(T.y,C.y)&&(S.y=Lr(T.y,C.y,g,p)),t.emit("pan"));var x=i.startZoom,w=i.zoom,D=w!=null&&a;D&&(na(x,w)&&(o.zoom=pa(o.minZoom,Lr(x,w,g,p),o.maxZoom)),t.emit("zoom")),(E||D)&&t.emit("viewport");var L=i.style;if(L&&L.length>0&&n){for(var A=0;A=0;E--){var x=S[E];x()}S.splice(0,S.length)},b=h.length-1;b>=0;b--){var m=h[b],T=m._private;if(T.stopped){h.splice(b,1),T.hooked=!1,T.playing=!1,T.started=!1,y(T.frames);continue}!T.playing&&!T.applying||(T.playing&&T.applying&&(T.applying=!1),T.started||Eg(v,m,t),bg(v,m,t,f),T.applying&&(T.applying=!1),y(T.frames),T.step!=null&&T.step(t),m.completed()&&(h.splice(b,1),T.hooked=!1,T.playing=!1,T.started=!1,y(T.completes)),p=!0)}return!f&&h.length===0&&c.length===0&&a.push(v),p}for(var o=!1,i=0;i0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var wg={animate:Ne.animate(),animation:Ne.animation(),animated:Ne.animated(),clearQueue:Ne.clearQueue(),delay:Ne.delay(),delayAnimation:Ne.delayAnimation(),stop:Ne.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&an(function(o){zo(o,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(o,i){zo(i,e)},a.beforeRenderPriorities.animations):r()}},xg={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Ca(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},$a=function(e){return ge(e)?new rr(e):e},dl={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Cn(xg,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,$a(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,$a(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,$a(r),a),this},once:function(e,r,a){return this.emitter().one(e,$a(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Ne.eventAliasesOn(dl);var ti={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};ti.jpeg=ti.jpg;var Za={layout:function(e){var r=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=r.extension("layout",a);if(n==null){Ve("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var o;ge(e.eles)?o=r.$(e.eles):o=e.eles!=null?e.eles:r.$();var i=new n(Ee({},e,{cy:r,eles:o}));return i}};Za.createLayout=Za.makeLayout=Za.layout;var Tg={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var o=this.renderer();this.destroyed()||!o||o.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ri.invalidateDimensions=ri.resize;var Qa={collection:function(e,r){return ge(e)?this.$(e):yt(e)?e.collection():ke(e)?(r||(r={}),new tt(this,e,r.unique,r.removed)):new tt(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};Qa.elements=Qa.filter=Qa.$;var lt={},va="t",Dg="f";lt.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),o=0;o0;if(d||f&&h){var c=void 0;d&&h||d?c=u.properties:h&&(c=u.mappedProperties);for(var p=0;p1&&(T=1),s.color){var S=a.valueMin[0],E=a.valueMax[0],x=a.valueMin[1],w=a.valueMax[1],D=a.valueMin[2],L=a.valueMax[2],A=a.valueMin[3]==null?1:a.valueMin[3],N=a.valueMax[3]==null?1:a.valueMax[3],O=[Math.round(S+(E-S)*T),Math.round(x+(w-x)*T),Math.round(D+(L-D)*T),Math.round(A+(N-A)*T)];o={bypass:a.bypass,name:a.name,value:O,strValue:"rgb("+O[0]+", "+O[1]+", "+O[2]+")"}}else if(s.number){var M=a.valueMin+(a.valueMax-a.valueMin)*T;o=this.parse(a.name,M,a.bypass,d)}else return!1;if(!o)return p(),!1;o.mapping=a,a=o;break}case i.data:{for(var R=a.field.split("."),k=f.data,P=0;P0&&o>0){for(var s={},l=!1,u=0;u0?t.delayAnimation(i).play().promise().then(m):m()}).then(function(){return t.animation({style:s,duration:o,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};lt.checkTrigger=function(t,e,r,a,n,o){var i=this.properties[e],s=n(i);s!=null&&s(r,a)&&o(i)};lt.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(o){return o.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};lt.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||a==="bezier")&&t.parallelEdges().forEach(function(o){o.isBundledBezier()&&o.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||a==="none")&&t.connectedEdges().forEach(function(o){o.dirtyBoundingBoxCache()})})};lt.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Aa={};Aa.applyBypass=function(t,e,r,a){var n=this,o=[],i=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var s=0;sn.length?a=a.substr(n.length):a=""}function l(){o.length>i.length?o=o.substr(i.length):o=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var v=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!v){Ie("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 d=new rr(f);if(d.invalid){Ie("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),s();continue}}var h=v[2],c=!1;o=h;for(var p=[];;){var g=o.match(/^\s*$/);if(g)break;var y=o.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){Ie("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),c=!0;break}i=y[0];var b=y[1],m=y[2],T=e.properties[b];if(!T){Ie("Skipping property: Invalid property name in: "+i),l();continue}var C=r.parse(b,m);if(!C){Ie("Skipping property: Invalid property definition in: "+i),l();continue}p.push({name:b,val:m}),l()}if(c){s();break}r.selector(f);for(var S=0;S=7&&e[0]==="d"&&(v=new RegExp(s.data.regex).exec(e))){if(r)return!1;var d=s.data;return{name:t,value:v,strValue:""+e,mapped:d,field:v[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(f=new RegExp(s.mapData.regex).exec(e))){if(r||u.multiple)return!1;var h=s.mapData;if(!(u.color||u.number))return!1;var c=this.parse(t,f[4]);if(!c||c.mapped)return!1;var p=this.parse(t,f[5]);if(!p||p.mapped)return!1;if(c.pfValue===p.pfValue||c.strValue===p.strValue)return Ie("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+c.strValue+"`"),this.parse(t,c.strValue);if(u.color){var g=c.value,y=p.value,b=g[0]===y[0]&&g[1]===y[1]&&g[2]===y[2]&&(g[3]===y[3]||(g[3]==null||g[3]===1)&&(y[3]==null||y[3]===1));if(b)return!1}return{name:t,value:f,strValue:""+e,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:c.value,valueMax:p.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var m;if(l?m=e.split(/\s+/):ke(e)?m=e:m=[e],u.evenMultiple&&m.length%2!==0)return null;for(var T=[],C=[],S=[],E="",x=!1,w=0;w0?" ":"")+D.strValue}return u.validate&&!u.validate(T,C)?null:u.singleEnum&&x?T.length===1&&ge(T[0])?{name:t,value:T[0],strValue:T[0],bypass:r}:null:{name:t,value:T,pfValue:S,strValue:E,bypass:r,units:C}}var L=function(){for(var V=0;Vu.max||u.strictMax&&e===u.max))return null;var R={name:t,value:e,strValue:""+e+(A||""),units:A,bypass:r};return u.unitless||A!=="px"&&A!=="em"?R.pfValue=e:R.pfValue=A==="px"||!A?e:this.getEmSizeInPixels()*e,(A==="ms"||A==="s")&&(R.pfValue=A==="ms"?e:1e3*e),(A==="deg"||A==="rad")&&(R.pfValue=A==="rad"?e:of(e)),A==="%"&&(R.pfValue=e/100),R}else if(u.propList){var k=[],P=""+e;if(P!=="none"){for(var B=P.split(/\s*,\s*|\s+/),z=0;z0&&s>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((i-2*r)/a.w,(s-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,o,i,s=!1;if(r.zoomingEnabled||(s=!0),oe(e)?i=e:De(e)&&(i=e.level,e.position!=null?o=mn(e.position,n,a):e.renderedPosition!=null&&(o=e.renderedPosition),o!=null&&!r.panningEnabled&&(s=!0)),i=i>r.maxZoom?r.maxZoom:i,i=ir.maxZoom||!r.zoomingEnabled?i=!0:(r.zoom=l,o.push("zoom"))}if(n&&(!i||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;oe(u.x)&&(r.pan.x=u.x,s=!1),oe(u.y)&&(r.pan.y=u.y,s=!1),s||o.push("pan")}return o.length>0&&(o.push("viewport"),this.emit(o.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ge(e)){var a=e;e=this.mutableElements().filter(a)}else yt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),o=this.width(),i=this.height();r=r===void 0?this._private.zoom:r;var s={x:(o-r*(n.x1+n.x2))/2,y:(i-r*(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,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),o=function(s){return parseFloat(n.getPropertyValue(s))};return{width:r.clientWidth-o("padding-left")-o("padding-right"),height:r.clientHeight-o("padding-top")-o("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};br.centre=br.center;br.autolockNodes=br.autolock;br.autoungrabifyNodes=br.autoungrabify;var wa={data:Ne.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Ne.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Ne.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Ne.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};wa.attr=wa.data;wa.removeAttr=wa.removeData;var xa=function(e){var r=this;e=Ee({},e);var a=e.container;a&&!rn(a)&&rn(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var o=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var i=Ye!==void 0&&a!==void 0&&!e.headless,s=e;s.layout=Ee({name:i?"grid":"null"},s.layout),s.renderer=Ee({name:i?"canvas":"null"},s.renderer);var l=function(c,p,g){return p!==void 0?p:g!==void 0?g:c},u=this._private={container:a,ready:!1,options:s,elements:new tt(this),listeners:[],aniEles:new tt(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?i:s.styleEnabled,zoom:oe(s.zoom)?s.zoom:1,pan:{x:De(s.pan)&&oe(s.pan.x)?s.pan.x:0,y:De(s.pan)&&oe(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(c,p){var g=c.some(Ou);if(g)return _r.all(c).then(p);p(c)};u.styleEnabled&&r.setStyle([]);var f=Ee({},s,s.renderer);r.initRenderer(f);var d=function(c,p,g){r.notifications(!1);var y=r.mutableElements();y.length>0&&y.remove(),c!=null&&(De(c)||ke(c))&&r.add(c),r.one("layoutready",function(m){r.notifications(!0),r.emit(m),r.one("load",p),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",g),r.emit("done")});var b=Ee({},r._private.options.layout);b.eles=r.elements(),r.layout(b).run()};v([s.style,s.elements],function(h){var c=h[0],p=h[1];u.styleEnabled&&r.style().append(c),d(p,function(){r.startAnimationLoop(),u.ready=!0,ze(s.ready)&&r.on("ready",s.ready);for(var g=0;g0,l=pt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(yt(e.roots))u=e.roots;else if(ke(e.roots)){for(var v=[],f=0;f0;){var M=O(),R=D(M,A);if(R)M.outgoers().filter(function(ae){return ae.isNode()&&a.has(ae)}).forEach(N);else if(R===null){Ie("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}w();var k=0;if(e.avoidOverlap)for(var P=0;P0&&y[0].length<=3?xe/2:0),I=2*Math.PI/y[ce].length*ve;return ce===0&&y[0].length===1&&(ee=1),{x:K.x+ee*Math.cos(I),y:K.y+ee*Math.sin(I)}}else{var Se={x:K.x+(ve+1-(ye+1)/2)*Oe,y:(ce+1)*Te};return Se}};return a.nodes().layoutPositions(this,e,he),this};var Ng={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function pl(t){this.options=Ee({},Ng,t)}pl.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,o=a.nodes().not(":parent");e.sort&&(o=o.sort(e.sort));for(var i=pt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:i.x1+i.w/2,y:i.y1+i.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/o.length:e.sweep,u=l/Math.max(1,o.length-1),v,f=0,d=0;d1&&e.avoidOverlap){f*=1.75;var y=Math.cos(u)-Math.cos(0),b=Math.sin(u)-Math.sin(0),m=Math.sqrt(f*f/(y*y+b*b));v=Math.max(m,v)}var T=function(S,E){var x=e.startAngle+E*u*(n?1:-1),w=v*Math.cos(x),D=v*Math.sin(x),L={x:s.x+w,y:s.y+D};return L};return a.nodes().layoutPositions(this,e,T),this};var Ig={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function yl(t){this.options=Ee({},Ig,t)}yl.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,o=n.nodes().not(":parent"),i=pt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),s={x:i.x1+i.w/2,y:i.y1+i.h/2},l=[],u=0,v=0;v0){var C=Math.abs(b[0].value-T.value);C>=g&&(b=[],y.push(b))}b.push(T)}var S=u+e.minNodeSpacing;if(!e.avoidOverlap){var E=y.length>0&&y[0].length>1,x=Math.min(i.w,i.h)/2-S,w=x/(y.length+E?1:0);S=Math.min(S,w)}for(var D=0,L=0;L1&&e.avoidOverlap){var M=Math.cos(O)-Math.cos(0),R=Math.sin(O)-Math.sin(0),k=Math.sqrt(S*S/(M*M+R*R));D=Math.max(k,D)}A.r=D,D+=S}if(e.equidistant){for(var P=0,B=0,z=0;z=t.numIter||(zg(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature=t.animationThreshold&&o(),an(f)}};v()}else{for(;u;)u=i(l),l++;$o(a,t),s()}return this};On.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};On.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Rg=function(e,r,a){for(var n=a.eles.edges(),o=a.eles.nodes(),i=pt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:o.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:i.w,clientHeight:i.h,boundingBox:i},l=a.eles.components(),u={},v=0;v0){s.graphSet.push(x);for(var v=0;vn.count?0:n.graph},Pg=function t(e,r,a,n){var o=n.graphSet[a];if(-10)var f=n.nodeOverlap*v,d=Math.sqrt(s*s+l*l),h=f*s/d,c=f*l/d;else var p=fn(e,s,l),g=fn(r,-1*s,-1*l),y=g.x-p.x,b=g.y-p.y,m=y*y+b*b,d=Math.sqrt(m),f=(e.nodeRepulsion+r.nodeRepulsion)/m,h=f*y/d,c=f*b/d;e.isLocked||(e.offsetX-=h,e.offsetY-=c),r.isLocked||(r.offsetX+=h,r.offsetY+=c)}},$g=function(e,r,a,n){if(a>0)var o=e.maxX-r.minX;else var o=r.maxX-e.minX;if(n>0)var i=e.maxY-r.minY;else var i=r.maxY-e.minY;return o>=0&&i>=0?Math.sqrt(o*o+i*i):0},fn=function(e,r,a){var n=e.positionX,o=e.positionY,i=e.height||1,s=e.width||1,l=a/r,u=i/s,v={};return r===0&&0a?(v.x=n,v.y=o+i/2,v):0r&&-1*u<=l&&l<=u?(v.x=n-s/2,v.y=o-s*a/2/r,v):0=u)?(v.x=n+i*r/2/a,v.y=o+i/2,v):(0>a&&(l<=-1*u||l>=u)&&(v.x=n-i*r/2/a,v.y=o-i/2),v)},_g=function(e,r){for(var a=0;aa){var g=r.gravity*h/p,y=r.gravity*c/p;d.offsetX+=g,d.offsetY+=y}}}}},Hg=function(e,r){var a=[],n=0,o=-1;for(a.push.apply(a,e.graphSet[0]),o+=e.graphSet[0].length;n<=o;){var i=a[n++],s=e.idToIndex[i],l=e.layoutNodes[s],u=l.children;if(0a)var o={x:a*e/n,y:a*r/n};else var o={x:e,y:r};return o},Wg=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],o=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,o=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,o=!0),(n.minY==null||e.minY-n.padTopy&&(c+=g+r.componentSpacing,h=0,p=0,g=0)}}},Kg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function bl(t){this.options=Ee({},Kg,t)}bl.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var o=pt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(o.h===0||o.w===0)a.nodes().layoutPositions(this,e,function(U){return{x:o.x1,y:o.y1}});else{var i=n.size(),s=Math.sqrt(i*o.h/o.w),l=Math.round(s),u=Math.round(o.w/o.h*s),v=function(H){if(H==null)return Math.min(l,u);var _=Math.min(l,u);_==l?l=H:u=H},f=function(H){if(H==null)return Math.max(l,u);var _=Math.max(l,u);_==l?l=H:u=H},d=e.rows,h=e.cols!=null?e.cols:e.columns;if(d!=null&&h!=null)l=d,u=h;else if(d!=null&&h==null)l=d,u=Math.ceil(i/l);else if(d==null&&h!=null)u=h,l=Math.ceil(i/u);else if(u*l>i){var c=v(),p=f();(c-1)*p>=i?v(c-1):(p-1)*c>=i&&f(p-1)}else for(;u*l=i?f(y+1):v(g+1)}var b=o.w/u,m=o.h/l;if(e.condense&&(b=0,m=0),e.avoidOverlap)for(var T=0;T=u&&(M=0,O++)},k={},P=0;P(M=bf(t,e,R[k],R[k+1],R[k+2],R[k+3])))return g(E,M),!0}else if(w.edgeType==="bezier"||w.edgeType==="multibezier"||w.edgeType==="self"||w.edgeType==="compound"){for(var R=w.allpts,k=0;k+5(M=mf(t,e,R[k],R[k+1],R[k+2],R[k+3],R[k+4],R[k+5])))return g(E,M),!0}for(var P=P||x.source,B=B||x.target,z=n.getArrowWidth(D,L),G=[{name:"source",x:w.arrowStartX,y:w.arrowStartY,angle:w.srcArrowAngle},{name:"target",x:w.arrowEndX,y:w.arrowEndY,angle:w.tgtArrowAngle},{name:"mid-source",x:w.midX,y:w.midY,angle:w.midsrcArrowAngle},{name:"mid-target",x:w.midX,y:w.midY,angle:w.midtgtArrowAngle}],k=0;k0&&(y(P),y(B))}function m(E,x,w){return Ot(E,x,w)}function T(E,x){var w=E._private,D=d,L;x?L=x+"-":L="",E.boundingBox();var A=w.labelBounds[x||"main"],N=E.pstyle(L+"label").value,O=E.pstyle("text-events").strValue==="yes";if(!(!O||!N)){var M=m(w.rscratch,"labelX",x),R=m(w.rscratch,"labelY",x),k=m(w.rscratch,"labelAngle",x),P=E.pstyle(L+"text-margin-x").pfValue,B=E.pstyle(L+"text-margin-y").pfValue,z=A.x1-D-P,G=A.x2+D-P,F=A.y1-D-B,U=A.y2+D-B;if(k){var H=Math.cos(k),_=Math.sin(k),Q=function(he,ae){return he=he-M,ae=ae-R,{x:he*H-ae*_+M,y:he*_+ae*H+R}},J=Q(z,F),q=Q(z,U),V=Q(G,F),Z=Q(G,U),K=[J.x+P,J.y+B,V.x+P,V.y+B,Z.x+P,Z.y+B,q.x+P,q.y+B];if(gt(t,e,K))return g(E),!0}else if(zr(A,t,e))return g(E),!0}}for(var C=i.length-1;C>=0;C--){var S=i[C];S.isNode()?y(S)||T(S):b(S)||T(S)||T(S,"source")||T(S,"target")}return s};xr.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,o=[],i=Math.min(t,r),s=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=i,r=s,e=l,a=u;for(var v=pt({x1:t,y1:e,x2:r,y2:a}),f=0;f0?-(Math.PI-e.ang):Math.PI+e.ang},tp=function(e,r,a,n,o){if(e!==qo?Wo(r,e,Pt):ep(Et,Pt),Wo(r,a,Et),Ho=Pt.nx*Et.ny-Pt.ny*Et.nx,Xo=Pt.nx*Et.nx-Pt.ny*-Et.ny,$t=Math.asin(Math.max(-1,Math.min(1,Ho))),Math.abs($t)<1e-6){ai=r.x,ni=r.y,fr=Or=0;return}hr=1,Ja=!1,Xo<0?$t<0?$t=Math.PI+$t:($t=Math.PI-$t,hr=-1,Ja=!0):$t>0&&(hr=-1,Ja=!0),r.radius!==void 0?Or=r.radius:Or=n,lr=$t/2,_a=Math.min(Pt.len/2,Et.len/2),o?(kt=Math.abs(Math.cos(lr)*Or/Math.sin(lr)),kt>_a?(kt=_a,fr=Math.abs(kt*Math.sin(lr)/Math.cos(lr))):fr=Or):(kt=Math.min(_a,Or),fr=Math.abs(kt*Math.sin(lr)/Math.cos(lr))),ii=r.x+Et.nx*kt,oi=r.y+Et.ny*kt,ai=ii-Et.ny*fr*hr,ni=oi+Et.nx*fr*hr,Tl=r.x+Pt.nx*kt,Cl=r.y+Pt.ny*kt,qo=r};function Dl(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Pi(t,e,r,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}:(tp(t,e,r,a,n),{cx:ai,cy:ni,radius:fr,startX:Tl,startY:Cl,stopX:ii,stopY:oi,startAngle:Pt.ang+Math.PI/2*hr,endAngle:Et.ang-Math.PI/2*hr,counterClockwise:Ja})}var ut={};ut.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,o,i=t.pstyle("source-endpoint"),s=t.pstyle("target-endpoint"),l=i.units!=null&&s.units!=null,u=function(C,S,E,x){var w=x-S,D=E-C,L=Math.sqrt(D*D+w*w);return{x:-w/L,y:D/L}},v=t.pstyle("edge-distances").value;switch(v){case"node-position":o=r;break;case"intersection":o=a;break;case"endpoints":{if(l){var f=this.manualEndptToPx(t.source()[0],i),d=Lt(f,2),h=d[0],c=d[1],p=this.manualEndptToPx(t.target()[0],s),g=Lt(p,2),y=g[0],b=g[1],m={x1:h,y1:c,x2:y,y2:b};n=u(h,c,y,b),o=m}else Ie("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),o=a;break}}return{midptPts:o,vectorNormInverse:n}};ut.findHaystackPoints=function(t){for(var e=0;e0?Math.max(me-be,0):Math.min(me+be,0)},N=A(D,x),O=A(L,w),M=!1;b===u?y=Math.abs(N)>Math.abs(O)?n:a:b===l||b===s?(y=a,M=!0):(b===o||b===i)&&(y=n,M=!0);var R=y===a,k=R?O:N,P=R?L:D,B=Os(P),z=!1;!(M&&(T||S))&&(b===s&&P<0||b===l&&P>0||b===o&&P>0||b===i&&P<0)&&(B*=-1,k=B*Math.abs(k),z=!0);var G;if(T){var F=C<0?1+C:C;G=F*k}else{var U=C<0?k:0;G=U+C*B}var H=function(me){return Math.abs(me)=Math.abs(k)},_=H(G),Q=H(Math.abs(k)-Math.abs(G)),J=_||Q;if(J&&!z)if(R){var q=Math.abs(P)<=d/2,V=Math.abs(D)<=h/2;if(q){var Z=(v.x1+v.x2)/2,K=v.y1,ie=v.y2;r.segpts=[Z,K,Z,ie]}else if(V){var he=(v.y1+v.y2)/2,ae=v.x1,te=v.x2;r.segpts=[ae,he,te,he]}else r.segpts=[v.x1,v.y2]}else{var le=Math.abs(P)<=f/2,ce=Math.abs(L)<=c/2;if(le){var ve=(v.y1+v.y2)/2,ye=v.x1,Oe=v.x2;r.segpts=[ye,ve,Oe,ve]}else if(ce){var Te=(v.x1+v.x2)/2,xe=v.y1,Se=v.y2;r.segpts=[Te,xe,Te,Se]}else r.segpts=[v.x2,v.y1]}else if(R){var ee=v.y1+G+(g?d/2*B:0),I=v.x1,$=v.x2;r.segpts=[I,ee,$,ee]}else{var j=v.x1+G+(g?f/2*B:0),X=v.y1,Y=v.y2;r.segpts=[j,X,j,Y]}if(r.isRound){var ne=t.pstyle("taxi-radius").value,W=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ne),r.isArcRadius=new Array(r.segpts.length/2).fill(W)}};ut.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,o=e.srcW,i=e.srcH,s=e.tgtW,l=e.tgtH,u=e.srcShape,v=e.tgtShape,f=e.srcCornerRadius,d=e.tgtCornerRadius,h=e.srcRs,c=e.tgtRs,p=!oe(r.startX)||!oe(r.startY),g=!oe(r.arrowStartX)||!oe(r.arrowStartY),y=!oe(r.endX)||!oe(r.endY),b=!oe(r.arrowEndX)||!oe(r.arrowEndY),m=3,T=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,C=m*T,S=pr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),E=SO.poolIndex()){var M=N;N=O,O=M}var R=w.srcPos=N.position(),k=w.tgtPos=O.position(),P=w.srcW=N.outerWidth(),B=w.srcH=N.outerHeight(),z=w.tgtW=O.outerWidth(),G=w.tgtH=O.outerHeight(),F=w.srcShape=r.nodeShapes[e.getNodeShape(N)],U=w.tgtShape=r.nodeShapes[e.getNodeShape(O)],H=w.srcCornerRadius=N.pstyle("corner-radius").value==="auto"?"auto":N.pstyle("corner-radius").pfValue,_=w.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,Q=w.tgtRs=O._private.rscratch,J=w.srcRs=N._private.rscratch;w.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var q=0;q0){var ie=o,he=ur(ie,Mr(r)),ae=ur(ie,Mr(K)),te=he;if(ae2){var le=ur(ie,{x:K[2],y:K[3]});le0){var Y=i,ne=ur(Y,Mr(r)),W=ur(Y,Mr(X)),re=ne;if(W2){var me=ur(Y,{x:X[2],y:X[3]});me=c||E){g={cp:T,segment:S};break}}if(g)break}var x=g.cp,w=g.segment,D=(c-y)/w.length,L=w.t1-w.t0,A=h?w.t0+L*D:w.t1-L*D;A=pa(0,A,1),e=kr(x.p0,x.p1,x.p2,A),d=ap(x.p0,x.p1,x.p2,A);break}case"straight":case"segments":case"haystack":{for(var N=0,O,M,R,k,P=a.allpts.length,B=0;B+3=c));B+=2);var z=c-M,G=z/O;G=pa(0,G,1),e=lf(R,k,G),d=Al(R,k);break}}i("labelX",f,e.x),i("labelY",f,e.y),i("labelAutoAngle",f,d)}};u("source"),u("target"),this.applyLabelDimensions(t)}};zt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};zt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),o=t.pstyle("line-height").pfValue,i=t.pstyle("text-wrap").strValue,s=Ot(r.rscratch,"labelWrapCachedLines",e)||[],l=i!=="wrap"?1:Math.max(s.length,1),u=n.height/l,v=u*o,f=n.width,d=n.height+(l-1)*(o-1)*u;Zt(r.rstyle,"labelWidth",e,f),Zt(r.rscratch,"labelWidth",e,f),Zt(r.rstyle,"labelHeight",e,d),Zt(r.rscratch,"labelHeight",e,d),Zt(r.rscratch,"labelLineHeight",e,v)};zt.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,o=t.pstyle("text-transform").value,i=function(U,H){return H?(Zt(r.rscratch,U,e,H),H):Ot(r.rscratch,U,e)};if(!n)return"";o=="none"||(o=="uppercase"?n=n.toUpperCase():o=="lowercase"&&(n=n.toLowerCase()));var s=t.pstyle("text-wrap").value;if(s==="wrap"){var l=i("labelKey");if(l!=null&&i("labelWrapKey")===l)return i("labelWrapCachedText");for(var u="​",v=n.split(` `),f=t.pstyle("text-max-width").pfValue,d=t.pstyle("text-overflow-wrap").value,h=d==="anywhere",c=[],p=/[\s\u200b]+|$/g,g=0;gf){var C=y.matchAll(p),S="",E=0,x=vs(C),w;try{for(x.s();!(w=x.n()).done;){var D=w.value,L=D[0],A=y.substring(E,D.index);E=D.index+L.length;var N=S.length===0?A:S+A+L,O=this.calculateLabelDimensions(t,N),M=O.width;M<=f?S+=A+L:(S&&c.push(S),S=A+L)}}catch(F){x.e(F)}finally{x.f()}S.match(/^[\s\u200b]+$/)||c.push(S)}else c.push(y)}i("labelWrapCachedLines",c),n=i("labelWrapCachedText",c.join(` `)),i("labelWrapKey",l)}else if(s==="ellipsis"){var R=t.pstyle("text-max-width").pfValue,k="",P="…",B=!1;if(this.calculateLabelDimensions(t,n).widthR)break;k+=n[z],z===n.length-1&&(B=!0)}return B||(k+=P),k}return n};zt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};zt.calculateLabelDimensions=function(t,e){var r=this,a=r.cy.window(),n=a.document,o=gr(e,t._private.labelDimsKey),i=r.labelDimCache||(r.labelDimCache=[]),s=i[o];if(s!=null)return s;var l=0,u=t.pstyle("font-style").strValue,v=t.pstyle("font-size").pfValue,f=t.pstyle("font-family").strValue,d=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=n.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var p=h.style;p.position="absolute",p.left="-9999px",p.top="-9999px",p.zIndex="-1",p.visibility="hidden",p.pointerEvents="none"}c.font="".concat(u," ").concat(d," ").concat(v,"px ").concat(f);for(var g=0,y=0,b=e.split(` `),m=0;m1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(i),s)for(var l=0;l=t.desktopTapThreshold2}var ft=n(I);Re&&(t.hoverData.tapholdCancelled=!0);var Tt=function(){var Rt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Rt.length===0?(Rt.push(pe[0]),Rt.push(pe[1])):(Rt[0]+=pe[0],Rt[1]+=pe[1])};j=!0,a(fe,["mousemove","vmousemove","tapdrag"],I,{x:W[0],y:W[1]});var bt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||X.emit({originalEvent:I,type:"boxstart",position:{x:W[0],y:W[1]}}),be[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Re){var dt={originalEvent:I,type:"cxtdrag",position:{x:W[0],y:W[1]}};ue?ue.emit(dt):X.emit(dt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||fe!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:I,type:"cxtdragout",position:{x:W[0],y:W[1]}}),t.hoverData.cxtOver=fe,fe&&fe.emit({originalEvent:I,type:"cxtdragover",position:{x:W[0],y:W[1]}}))}}else if(t.hoverData.dragging){if(j=!0,X.panningEnabled()&&X.userPanningEnabled()){var Mt;if(t.hoverData.justStartedPan){var Ut=t.hoverData.mdownPos;Mt={x:(W[0]-Ut[0])*Y,y:(W[1]-Ut[1])*Y},t.hoverData.justStartedPan=!1}else Mt={x:pe[0]*Y,y:pe[1]*Y};X.panBy(Mt),X.emit("dragpan"),t.hoverData.dragged=!0}W=t.projectIntoViewport(I.clientX,I.clientY)}else if(be[4]==1&&(ue==null||ue.pannable())){if(Re){if(!t.hoverData.dragging&&X.boxSelectionEnabled()&&(ft||!X.panningEnabled()||!X.userPanningEnabled()))bt();else if(!t.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var Ct=o(ue,t.hoverData.downs);Ct&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,be[4]=0,t.data.bgActivePosistion=Mr(re),t.redrawHint("select",!0),t.redraw())}ue&&ue.pannable()&&ue.active()&&ue.unactivate()}}else{if(ue&&ue.pannable()&&ue.active()&&ue.unactivate(),(!ue||!ue.grabbed())&&fe!=we&&(we&&a(we,["mouseout","tapdragout"],I,{x:W[0],y:W[1]}),fe&&a(fe,["mouseover","tapdragover"],I,{x:W[0],y:W[1]}),t.hoverData.last=fe),ue)if(Re){if(X.boxSelectionEnabled()&&ft)ue&&ue.grabbed()&&(g(Ge),ue.emit("freeon"),Ge.emit("free"),t.dragData.didDrag&&(ue.emit("dragfreeon"),Ge.emit("dragfree"))),bt();else if(ue&&ue.grabbed()&&t.nodeIsDraggable(ue)){var _e=!t.dragData.didDrag;_e&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||c(Ge,{inDragLayer:!0});var Ke={x:0,y:0};if(oe(pe[0])&&oe(pe[1])&&(Ke.x+=pe[0],Ke.y+=pe[1],_e)){var nt=t.hoverData.dragDelta;nt&&oe(nt[0])&&oe(nt[1])&&(Ke.x+=nt[0],Ke.y+=nt[1])}t.hoverData.draggingEles=!0,Ge.silentShift(Ke).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Tt();j=!0}if(be[2]=W[0],be[3]=W[1],j)return I.stopPropagation&&I.stopPropagation(),I.preventDefault&&I.preventDefault(),!1}},!1);var D,L,A;t.registerBinding(e,"mouseup",function(I){if(!(t.hoverData.which===1&&I.which!==1&&t.hoverData.capture)){var $=t.hoverData.capture;if($){t.hoverData.capture=!1;var j=t.cy,X=t.projectIntoViewport(I.clientX,I.clientY),Y=t.selection,ne=t.findNearestElement(X[0],X[1],!0,!1),W=t.dragData.possibleDragElements,re=t.hoverData.down,me=n(I);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,re&&re.unactivate(),t.hoverData.which===3){var be={originalEvent:I,type:"cxttapend",position:{x:X[0],y:X[1]}};if(re?re.emit(be):j.emit(be),!t.hoverData.cxtDragged){var fe={originalEvent:I,type:"cxttap",position:{x:X[0],y:X[1]}};re?re.emit(fe):j.emit(fe)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(a(ne,["mouseup","tapend","vmouseup"],I,{x:X[0],y:X[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(a(re,["click","tap","vclick"],I,{x:X[0],y:X[1]}),L=!1,I.timeStamp-A<=j.multiClickDebounceTime()?(D&&clearTimeout(D),L=!0,A=null,a(re,["dblclick","dbltap","vdblclick"],I,{x:X[0],y:X[1]})):(D=setTimeout(function(){L||a(re,["oneclick","onetap","voneclick"],I,{x:X[0],y:X[1]})},j.multiClickDebounceTime()),A=I.timeStamp)),re==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!n(I)&&(j.$(r).unselect(["tapunselect"]),W.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=W=j.collection()),ne==re&&!t.dragData.didDrag&&!t.hoverData.selecting&&ne!=null&&ne._private.selectable&&(t.hoverData.dragging||(j.selectionType()==="additive"||me?ne.selected()?ne.unselect(["tapunselect"]):ne.select(["tapselect"]):me||(j.$(r).unmerge(ne).unselect(["tapunselect"]),ne.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var we=j.collection(t.getAllInBox(Y[0],Y[1],Y[2],Y[3]));t.redrawHint("select",!0),we.length>0&&t.redrawHint("eles",!0),j.emit({type:"boxend",originalEvent:I,position:{x:X[0],y:X[1]}});var ue=function(Re){return Re.selectable()&&!Re.selected()};j.selectionType()==="additive"||me||j.$(r).unmerge(we).unselect(),we.emit("box").stdFilter(ue).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!Y[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var pe=re&&re.grabbed();g(W),pe&&(re.emit("freeon"),W.emit("free"),t.dragData.didDrag&&(re.emit("dragfreeon"),W.emit("dragfree")))}}Y[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null,t.hoverData.which=null}}},!1);var N=function(I){if(!t.scrollingPage){var $=t.cy,j=$.zoom(),X=$.pan(),Y=t.projectIntoViewport(I.clientX,I.clientY),ne=[Y[0]*j+X.x,Y[1]*j+X.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||x()){I.preventDefault();return}if($.panningEnabled()&&$.userPanningEnabled()&&$.zoomingEnabled()&&$.userZoomingEnabled()){I.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var W;I.deltaY!=null?W=I.deltaY/-250:I.wheelDeltaY!=null?W=I.wheelDeltaY/1e3:W=I.wheelDelta/1e3,W=W*t.wheelSensitivity;var re=I.deltaMode===1;re&&(W*=33);var me=$.zoom()*Math.pow(10,W);I.type==="gesturechange"&&(me=t.gestureStartZoom*I.scale),$.zoom({level:me,renderedPosition:{x:ne[0],y:ne[1]}}),$.emit(I.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",N,!0),t.registerBinding(e,"scroll",function(I){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(I){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||I.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(ee){t.hasTouchStarted||N(ee)},!0),t.registerBinding(t.container,"mouseout",function(I){var $=t.projectIntoViewport(I.clientX,I.clientY);t.cy.emit({originalEvent:I,type:"mouseout",position:{x:$[0],y:$[1]}})},!1),t.registerBinding(t.container,"mouseover",function(I){var $=t.projectIntoViewport(I.clientX,I.clientY);t.cy.emit({originalEvent:I,type:"mouseover",position:{x:$[0],y:$[1]}})},!1);var O,M,R,k,P,B,z,G,F,U,H,_,Q,J=function(I,$,j,X){return Math.sqrt((j-I)*(j-I)+(X-$)*(X-$))},q=function(I,$,j,X){return(j-I)*(j-I)+(X-$)*(X-$)},V;t.registerBinding(t.container,"touchstart",V=function(I){if(t.hasTouchStarted=!0,!!w(I)){b(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var $=t.cy,j=t.touchData.now,X=t.touchData.earlier;if(I.touches[0]){var Y=t.projectIntoViewport(I.touches[0].clientX,I.touches[0].clientY);j[0]=Y[0],j[1]=Y[1]}if(I.touches[1]){var Y=t.projectIntoViewport(I.touches[1].clientX,I.touches[1].clientY);j[2]=Y[0],j[3]=Y[1]}if(I.touches[2]){var Y=t.projectIntoViewport(I.touches[2].clientX,I.touches[2].clientY);j[4]=Y[0],j[5]=Y[1]}if(I.touches[1]){t.touchData.singleTouchMoved=!0,g(t.dragData.touchDragEles);var ne=t.findContainerClientCoords();F=ne[0],U=ne[1],H=ne[2],_=ne[3],O=I.touches[0].clientX-F,M=I.touches[0].clientY-U,R=I.touches[1].clientX-F,k=I.touches[1].clientY-U,Q=0<=O&&O<=H&&0<=R&&R<=H&&0<=M&&M<=_&&0<=k&&k<=_;var W=$.pan(),re=$.zoom();P=J(O,M,R,k),B=q(O,M,R,k),z=[(O+R)/2,(M+k)/2],G=[(z[0]-W.x)/re,(z[1]-W.y)/re];var me=200,be=me*me;if(B=1){for(var Qe=t.touchData.startPosition=[null,null,null,null,null,null],$e=0;$e=t.touchTapThreshold2}if($&&t.touchData.cxt){I.preventDefault();var Qe=I.touches[0].clientX-F,$e=I.touches[0].clientY-U,ct=I.touches[1].clientX-F,Je=I.touches[1].clientY-U,ft=q(Qe,$e,ct,Je),Tt=ft/B,bt=150,dt=bt*bt,Mt=1.5,Ut=Mt*Mt;if(Tt>=Ut||ft>=dt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ct={originalEvent:I,type:"cxttapend",position:{x:Y[0],y:Y[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(Ct),t.touchData.start=null):X.emit(Ct)}}if($&&t.touchData.cxt){var Ct={originalEvent:I,type:"cxtdrag",position:{x:Y[0],y:Y[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Ct):X.emit(Ct),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var _e=t.findNearestElement(Y[0],Y[1],!0,!0);(!t.touchData.cxtOver||_e!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:I,type:"cxtdragout",position:{x:Y[0],y:Y[1]}}),t.touchData.cxtOver=_e,_e&&_e.emit({originalEvent:I,type:"cxtdragover",position:{x:Y[0],y:Y[1]}}))}else if($&&I.touches[2]&&X.boxSelectionEnabled())I.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||X.emit({originalEvent:I,type:"boxstart",position:{x:Y[0],y:Y[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,j[4]=1,!j||j.length===0||j[0]===void 0?(j[0]=(Y[0]+Y[2]+Y[4])/3,j[1]=(Y[1]+Y[3]+Y[5])/3,j[2]=(Y[0]+Y[2]+Y[4])/3+1,j[3]=(Y[1]+Y[3]+Y[5])/3+1):(j[2]=(Y[0]+Y[2]+Y[4])/3,j[3]=(Y[1]+Y[3]+Y[5])/3),t.redrawHint("select",!0),t.redraw();else if($&&I.touches[1]&&!t.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){I.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Ke=t.dragData.touchDragEles;if(Ke){t.redrawHint("drag",!0);for(var nt=0;nt0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var K;t.registerBinding(e,"touchcancel",K=function(I){var $=t.touchData.start;t.touchData.capture=!1,$&&$.unactivate()});var ie,he,ae,te;if(t.registerBinding(e,"touchend",ie=function(I){var $=t.touchData.start,j=t.touchData.capture;if(j)I.touches.length===0&&(t.touchData.capture=!1),I.preventDefault();else return;var X=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var Y=t.cy,ne=Y.zoom(),W=t.touchData.now,re=t.touchData.earlier;if(I.touches[0]){var me=t.projectIntoViewport(I.touches[0].clientX,I.touches[0].clientY);W[0]=me[0],W[1]=me[1]}if(I.touches[1]){var me=t.projectIntoViewport(I.touches[1].clientX,I.touches[1].clientY);W[2]=me[0],W[3]=me[1]}if(I.touches[2]){var me=t.projectIntoViewport(I.touches[2].clientX,I.touches[2].clientY);W[4]=me[0],W[5]=me[1]}$&&$.unactivate();var be;if(t.touchData.cxt){if(be={originalEvent:I,type:"cxttapend",position:{x:W[0],y:W[1]}},$?$.emit(be):Y.emit(be),!t.touchData.cxtDragged){var fe={originalEvent:I,type:"cxttap",position:{x:W[0],y:W[1]}};$?$.emit(fe):Y.emit(fe)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!I.touches[2]&&Y.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var we=Y.collection(t.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,t.redrawHint("select",!0),Y.emit({type:"boxend",originalEvent:I,position:{x:W[0],y:W[1]}});var ue=function(dt){return dt.selectable()&&!dt.selected()};we.emit("box").stdFilter(ue).select().emit("boxselect"),we.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if($!=null&&$.unactivate(),I.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!I.touches[1]){if(!I.touches[0]){if(!I.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var pe=t.dragData.touchDragEles;if($!=null){var Ge=$._private.grabbed;g(pe),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Ge&&($.emit("freeon"),pe.emit("free"),t.dragData.didDrag&&($.emit("dragfreeon"),pe.emit("dragfree"))),a($,["touchend","tapend","vmouseup","tapdragout"],I,{x:W[0],y:W[1]}),$.unactivate(),t.touchData.start=null}else{var Re=t.findNearestElement(W[0],W[1],!0,!0);a(Re,["touchend","tapend","vmouseup","tapdragout"],I,{x:W[0],y:W[1]})}var vt=t.touchData.startPosition[0]-W[0],Qe=vt*vt,$e=t.touchData.startPosition[1]-W[1],ct=$e*$e,Je=Qe+ct,ft=Je*ne*ne;t.touchData.singleTouchMoved||($||Y.$(":selected").unselect(["tapunselect"]),a($,["tap","vclick"],I,{x:W[0],y:W[1]}),he=!1,I.timeStamp-te<=Y.multiClickDebounceTime()?(ae&&clearTimeout(ae),he=!0,te=null,a($,["dbltap","vdblclick"],I,{x:W[0],y:W[1]})):(ae=setTimeout(function(){he||a($,["onetap","voneclick"],I,{x:W[0],y:W[1]})},Y.multiClickDebounceTime()),te=I.timeStamp)),$!=null&&!t.dragData.didDrag&&$._private.selectable&&ft"u"){var le=[],ce=function(I){return{clientX:I.clientX,clientY:I.clientY,force:1,identifier:I.pointerId,pageX:I.pageX,pageY:I.pageY,radiusX:I.width/2,radiusY:I.height/2,screenX:I.screenX,screenY:I.screenY,target:I.target}},ve=function(I){return{event:I,touch:ce(I)}},ye=function(I){le.push(ve(I))},Oe=function(I){for(var $=0;$0)return F[0]}return null},c=Object.keys(d),p=0;p0?h:Ms(o,i,e,r,a,n,s,l)},checkPoint:function(e,r,a,n,o,i,s,l){l=l==="auto"?yr(n,o):l;var u=2*l;if(Yt(e,r,this.points,i,s,n,o-u,[0,-1],a)||Yt(e,r,this.points,i,s,n-u,o,[0,-1],a))return!0;var v=n/2+2*a,f=o/2+2*a,d=[i-v,s-f,i-v,s,i+v,s,i+v,s-f];return!!(gt(e,r,d)||cr(e,r,u,u,i+n/2-l,s+o/2-l,a)||cr(e,r,u,u,i-n/2+l,s+o/2-l,a))}}};Xt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ht(3,0)),this.generateRoundPolygon("round-triangle",ht(3,0)),this.generatePolygon("rectangle",ht(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",ht(5,0)),this.generateRoundPolygon("round-pentagon",ht(5,0)),this.generatePolygon("hexagon",ht(6,0)),this.generateRoundPolygon("round-hexagon",ht(6,0)),this.generatePolygon("heptagon",ht(7,0)),this.generateRoundPolygon("round-heptagon",ht(7,0)),this.generatePolygon("octagon",ht(8,0)),this.generateRoundPolygon("round-octagon",ht(8,0));var a=new Array(20);{var n=Kn(5,0),o=Kn(5,Math.PI/5),i=.5*(3-Math.sqrt(5));i*=1.57;for(var s=0;s=e.deqFastCost*T)break}else if(u){if(b>=e.deqCost*h||b>=e.deqAvgCost*d)break}else if(m>=e.deqNoDrawCost*Yn)break;var C=e.deq(a,g,p);if(C.length>0)for(var S=0;S0&&(e.onDeqd(a,c),!u&&e.shouldRedraw(a,c,g,p)&&o())},s=e.priority||bi;n.beforeRender(i,s(a))}}}},ip=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:nn;di(this,t),this.idsByKey=new Ft,this.keyForId=new Ft,this.cachesByLvl=new Ft,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return gi(t,[{key:"getIdsFor",value:function(r){r==null&&Ve("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new $r,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),o=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(o,a),this.keyForId.set(a,o)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),o=this.getKey(r);return n!==o}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,o=a.get(r);return o||(o=new Ft,a.set(r,o),n.push(r)),o}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),o=this.getCache(n,a);return o!=null&&this.updateKeyMappingFor(r),o}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),o=this.getCache(n,a);return o}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var o=this.getKey(r);this.setCache(o,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var o=this.doesEleInvalidateKey(r);return o&&this.invalidateKey(n),o||this.getNumberOfIdsForKey(n)===0}}]),t}(),Jo=25,Ya=50,ja=-4,si=3,op=7.99,sp=8,lp=1024,up=1024,vp=1024,fp=.2,hp=.8,cp=10,dp=.15,gp=.1,pp=.9,yp=.9,mp=100,bp=1,Rr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Ep=rt({getKey:null,doesEleInvalidateKey:nn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Cs,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ua=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Ep(r);Ee(a,n),a.lookup=new ip(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},We=ua.prototype;We.reasons=Rr;We.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};We.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};We.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new Sa(function(r,a){return a.reqs-r.reqs});return e};We.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};We.getElement=function(t,e,r,a,n){var o=this,i=this.renderer,s=i.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!o.allowEdgeTxrCaching&&t.isEdge()||!o.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(wi(s*r))),a=op||a>si)return null;var u=Math.pow(2,a),v=e.h*u,f=e.w*u,d=i.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,d))return null;var h=l.get(t,a);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var c;if(v<=Jo?c=Jo:v<=Ya?c=Ya:c=Math.ceil(v/Ya)*Ya,v>vp||f>up)return null;var p=o.getTextureQueue(c),g=p[p.length-2],y=function(){return o.recycleTexture(c,f)||o.addTexture(c,f)};g||(g=p[p.length-1]),g||(g=y()),g.width-g.usedWidtha;L--)w=o.getElement(t,e,r,L,Rr.downscale);D()}else return o.queueElement(t,S.level-1),S;else{var A;if(!m&&!T&&!C)for(var N=a-1;N>=ja;N--){var O=l.get(t,N);if(O){A=O;break}}if(b(A))return o.queueElement(t,a),A;g.context.translate(g.usedWidth,0),g.context.scale(u,u),this.drawElement(g.context,t,e,d,!1),g.context.scale(1/u,1/u),g.context.translate(-g.usedWidth,0)}return h={x:g.usedWidth,texture:g,level:a,scale:u,width:f,height:v,scaledLabelShown:d},g.usedWidth+=Math.ceil(f+sp),g.eleCaches.push(h),l.set(t,a,h),o.checkTextureFullness(g),h};We.invalidateElements=function(t){for(var e=0;e=fp*t.width&&this.retireTexture(t)};We.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>hp&&t.fullnessChecks>=cp?tr(r,t):t.fullnessChecks++};We.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;tr(a,t),t.retired=!0;for(var o=t.eleCaches,i=0;i=e)return i.retired=!1,i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,Ei(i.eleCaches),i.context.setTransform(1,0,0,1,0,0),i.context.clearRect(0,0,i.width,i.height),tr(n,i),a.push(i),i}};We.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),o=this.getKey(t),i=n[o];if(i)i.level=Math.max(i.level,e),i.eles.merge(t),i.reqs++,a.updateItem(i);else{var s={eles:t.spawn().merge(t),level:e,reqs:1,key:o};a.push(s),n[o]=s}};We.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],o=e.lookup,i=0;i0;i++){var s=r.pop(),l=s.key,u=s.eles[0],v=o.hasCache(u,s.level);if(a[l]=null,v)continue;n.push(s);var f=e.getBoundingBox(u);e.getElement(u,f,t,s.level,Rr.dequeue)}return n};We.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),o=a[n];o!=null&&(o.eles.length===1?(o.reqs=mi,r.updateItem(o),r.pop(),a[n]=null):o.eles.unmerge(t))};We.onDequeue=function(t){this.onDequeues.push(t)};We.offDequeue=function(t){tr(this.onDequeues,t)};We.setupDequeueing=Rl.setupDequeueing({deqRedrawThreshold:mp,deqCost:dp,deqAvgCost:gp,deqNoDrawCost:pp,deqFastCost:yp,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a=xp||r>cn)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),v=l[r]=l[r]||[],f,d=a.levelIsComplete(r,t),h,c=function(){var D=function(M){if(a.validateLayersElesOrdering(M,t),a.levelIsComplete(M,t))return h=l[M],!0},L=function(M){if(!h)for(var R=r+M;fa<=R&&R<=cn&&!D(R);R+=M);};L(1),L(-1);for(var A=v.length-1;A>=0;A--){var N=v[A];N.invalid&&tr(v,N)}};if(!d)c();else return v;var p=function(){if(!f){f=pt();for(var D=0;DNp)return null;var N=a.makeLayer(f,r);if(L!=null){var O=v.indexOf(L)+1;v.splice(O,0,N)}else(D.insert===void 0||D.insert)&&v.unshift(N);return N};if(a.skipping&&!s)return null;for(var y=null,b=t.length/wp,m=!s,T=0;T=b||!Is(y.bb,C.boundingBox()))&&(y=g({insert:!0,after:y}),!y))return null;h||m?a.queueLayer(y,C):a.drawEleInLayer(y,C,r,e),y.eles.push(C),E[r]=y}return h||(m?null:v)};at.getEleLevelForLayerLevel=function(t,e){return t};at.drawEleInLayer=function(t,e,r,a){var n=this,o=this.renderer,i=t.context,s=e.boundingBox();s.w===0||s.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),o.setImgSmoothing(i,!1),o.drawCachedElement(i,e,null,null,r,Ip),o.setImgSmoothing(i,!0))};at.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,o=0;o0||i.invalid)return!1;n+=i.eles.length}return n===e.length};at.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a0){e=!0;break}}return e};at.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=_t(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,o){e.invalidateLayer(a)}))};at.invalidateLayer=function(t){if(this.lastInvalidationTime=_t(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];tr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.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,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,s=e._private.rscratch;if(!(o&&!e.visible())&&!(s.badLine||s.allpts==null||isNaN(s.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=o?e.pstyle("opacity").value:1,v=o?e.pstyle("line-opacity").value:1,f=e.pstyle("curve-style").value,d=e.pstyle("line-style").value,h=e.pstyle("width").pfValue,c=e.pstyle("line-cap").value,p=e.pstyle("line-outline-width").value,g=e.pstyle("line-outline-color").value,y=u*v,b=u*v,m=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;f==="straight-triangle"?(i.eleStrokeStyle(t,e,M),i.drawEdgeTrianglePath(e,t,s.allpts)):(t.lineWidth=h,t.lineCap=c,i.eleStrokeStyle(t,e,M),i.drawEdgePath(e,t,s.allpts,d),t.lineCap="butt")},T=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;if(t.lineWidth=h+p,t.lineCap=c,p>0)i.colorStrokeStyle(t,g[0],g[1],g[2],M);else{t.lineCap="butt";return}f==="straight-triangle"?i.drawEdgeTrianglePath(e,t,s.allpts):(i.drawEdgePath(e,t,s.allpts,d),t.lineCap="butt")},C=function(){n&&i.drawEdgeOverlay(t,e)},S=function(){n&&i.drawEdgeUnderlay(t,e)},E=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:b;i.drawArrowheads(t,e,M)},x=function(){i.drawElementText(t,e,null,a)};t.lineJoin="round";var w=e.pstyle("ghost").value==="yes";if(w){var D=e.pstyle("ghost-offset-x").pfValue,L=e.pstyle("ghost-offset-y").pfValue,A=e.pstyle("ghost-opacity").value,N=y*A;t.translate(D,L),m(N),E(N),t.translate(-D,-L)}else T();S(),m(),E(),C(),x(),r&&t.translate(l.x1,l.y1)}};var Bl=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var o=this,i=o.usePaths(),s=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,v=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,s.edgeType==="self"&&!i?r.lineCap="butt":r.lineCap="round",o.colorStrokeStyle(r,v[0],v[1],v[2],n),o.drawEdgePath(a,r,s.allpts,"solid")}}}};qt.drawEdgeOverlay=Bl("overlay");qt.drawEdgeUnderlay=Bl("underlay");qt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,o=e,i,s=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,v=t.pstyle("line-dash-offset").pfValue;if(l){var f=r.join("$"),d=n.pathCacheKey&&n.pathCacheKey===f;d?(i=e=n.pathCache,s=!0):(i=e=new Path2D,n.pathCacheKey=f,n.pathCache=i)}if(o.setLineDash)switch(a){case"dotted":o.setLineDash([1,1]);break;case"dashed":o.setLineDash(u),o.lineDashOffset=v;break;case"solid":o.setLineDash([]);break}if(!s&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==void 0?arguments[5]:!0,i=this;if(a==null){if(o&&!i.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var s=e.pstyle("label");if(!s||!s.value)return;var l=i.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,v=e.pstyle("label"),f=e.pstyle("source-label"),d=e.pstyle("target-label");if(u||(!v||!v.value)&&(!f||!f.value)&&(!d||!d.value))return;t.textAlign="center",t.textBaseline="bottom"}var h=!r,c;r&&(c=r,t.translate(-c.x1,-c.y1)),n==null?(i.drawText(t,e,null,h,o),e.isEdge()&&(i.drawText(t,e,"source",h,o),i.drawText(t,e,"target",h,o))):i.drawText(t,e,n,h,o),r&&t.translate(c.x1,c.y1)};Tr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",o=e.pstyle("font-family").strValue,i=e.pstyle("font-weight").strValue,s=r?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;t.font=a+" "+i+" "+n+" "+o,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],s),this.colorStrokeStyle(t,v[0],v[1],v[2],l)};function Xn(t,e,r,a,n){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,i=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+o,r),t.lineTo(e+a-o,r),t.quadraticCurveTo(e+a,r,e+a,r+o),t.lineTo(e+a,r+n-o),t.quadraticCurveTo(e+a,r+n,e+a-o,r+n),t.lineTo(e+o,r+n),t.quadraticCurveTo(e,r+n,e,r+n-o),t.lineTo(e,r+o),t.quadraticCurveTo(e,r,e+o,r),t.closePath(),i?t.stroke():t.fill()}Tr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,o=e?e+"-":"",i=t.pstyle(o+"text-rotation"),s=Ot(n,"labelAngle",e);return i.strValue==="autorotate"?r=t.isEdge()?s:0:i.strValue==="none"?r=0:r=i.pfValue,r};Tr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=e._private,i=o.rscratch,s=n?e.effectiveOpacity():1;if(!(n&&(s===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=Ot(i,"labelX",r),u=Ot(i,"labelY",r),v,f,d=this.getLabelText(e,r);if(d!=null&&d!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var h=r?r+"-":"",c=Ot(i,"labelWidth",r),p=Ot(i,"labelHeight",r),g=e.pstyle(h+"text-margin-x").pfValue,y=e.pstyle(h+"text-margin-y").pfValue,b=e.isEdge(),m=e.pstyle("text-halign").value,T=e.pstyle("text-valign").value;b&&(m="center",T="center"),l+=g,u+=y;var C;switch(a?C=this.getTextAngle(e,r):C=0,C!==0&&(v=l,f=u,t.translate(v,f),t.rotate(C),l=0,u=0),T){case"top":break;case"center":u+=p/2;break;case"bottom":u+=p;break}var S=e.pstyle("text-background-opacity").value,E=e.pstyle("text-border-opacity").value,x=e.pstyle("text-border-width").pfValue,w=e.pstyle("text-background-padding").pfValue,D=e.pstyle("text-background-shape").strValue,L=D.indexOf("round")===0,A=2;if(S>0||x>0&&E>0){var N=l-w;switch(m){case"left":N-=c;break;case"center":N-=c/2;break}var O=u-p-w,M=c+2*w,R=p+2*w;if(S>0){var k=t.fillStyle,P=e.pstyle("text-background-color").value;t.fillStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+S*s+")",L?Xn(t,N,O,M,R,A):t.fillRect(N,O,M,R),t.fillStyle=k}if(x>0&&E>0){var B=t.strokeStyle,z=t.lineWidth,G=e.pstyle("text-border-color").value,F=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+G[0]+","+G[1]+","+G[2]+","+E*s+")",t.lineWidth=x,t.setLineDash)switch(F){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=x/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(L?Xn(t,N,O,M,R,A,"stroke"):t.strokeRect(N,O,M,R),F==="double"){var U=x/2;L?Xn(t,N+U,O+U,M-U*2,R-U*2,A,"stroke"):t.strokeRect(N+U,O+U,M-U*2,R-U*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=z,t.strokeStyle=B}}var H=2*e.pstyle("text-outline-width").pfValue;if(H>0&&(t.lineWidth=H),e.pstyle("text-wrap").value==="wrap"){var _=Ot(i,"labelWrapCachedLines",r),Q=Ot(i,"labelLineHeight",r),J=c/2,q=this.getLabelJustification(e);switch(q==="auto"||(m==="left"?q==="left"?l+=-c:q==="center"&&(l+=-J):m==="center"?q==="left"?l+=-J:q==="right"&&(l+=J):m==="right"&&(q==="center"?l+=J:q==="right"&&(l+=c))),T){case"top":u-=(_.length-1)*Q;break;case"center":case"bottom":u-=(_.length-1)*Q;break}for(var V=0;V<_.length;V++)H>0&&t.strokeText(_[V],l,u),t.fillText(_[V],l,u),u+=Q}else H>0&&t.strokeText(d,l,u),t.fillText(d,l,u);C!==0&&(t.rotate(-C),t.translate(-v,-f))}}};var Qr={};Qr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,i=this,s,l,u=e._private,v=u.rscratch,f=e.position();if(!(!oe(f.x)||!oe(f.y))&&!(o&&!e.visible())){var d=o?e.effectiveOpacity():1,h=i.usePaths(),c,p=!1,g=e.padding();s=e.width()+2*g,l=e.height()+2*g;var y;r&&(y=r,t.translate(-y.x1,-y.y1));for(var b=e.pstyle("background-image"),m=b.value,T=new Array(m.length),C=new Array(m.length),S=0,E=0;E0&&arguments[0]!==void 0?arguments[0]:N;i.eleFillStyle(t,e,ne)},V=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;i.colorStrokeStyle(t,O[0],O[1],O[2],ne)},Z=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_;i.colorStrokeStyle(t,U[0],U[1],U[2],ne)},K=function(ne,W,re,me){var be=i.nodePathCache=i.nodePathCache||[],fe=Ts(re==="polygon"?re+","+me.join(","):re,""+W,""+ne,""+J),we=be[fe],ue,pe=!1;return we!=null?(ue=we,pe=!0,v.pathCache=ue):(ue=new Path2D,be[fe]=v.pathCache=ue),{path:ue,cacheHit:pe}},ie=e.pstyle("shape").strValue,he=e.pstyle("shape-polygon-points").pfValue;if(h){t.translate(f.x,f.y);var ae=K(s,l,ie,he);c=ae.path,p=ae.cacheHit}var te=function(){if(!p){var ne=f;h&&(ne={x:0,y:0}),i.nodeShapes[i.getNodeShape(e)].draw(c||t,ne.x,ne.y,s,l,J,v)}h?t.fill(c):t.fill()},le=function(){for(var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,re=u.backgrounding,me=0,be=0;be0&&arguments[0]!==void 0?arguments[0]:!1,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;i.hasPie(e)&&(i.drawPie(t,e,W),ne&&(h||i.nodeShapes[i.getNodeShape(e)].draw(t,f.x,f.y,s,l,J,v)))},ve=function(){var ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,W=(L>0?L:-L)*ne,re=L>0?0:255;L!==0&&(i.colorFillStyle(t,re,re,re,W),h?t.fill(c):t.fill())},ye=function(){if(A>0){if(t.lineWidth=A,t.lineCap=k,t.lineJoin=R,t.setLineDash)switch(M){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(B),t.lineDashOffset=z;break;case"solid":case"double":t.setLineDash([]);break}if(P!=="center"){if(t.save(),t.lineWidth*=2,P==="inside")h?t.clip(c):t.clip();else{var ne=new Path2D;ne.rect(-s/2-A,-l/2-A,s+2*A,l+2*A),ne.addPath(c),t.clip(ne,"evenodd")}h?t.stroke(c):t.stroke(),t.restore()}else h?t.stroke(c):t.stroke();if(M==="double"){t.lineWidth=A/3;var W=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",h?t.stroke(c):t.stroke(),t.globalCompositeOperation=W}t.setLineDash&&t.setLineDash([])}},Oe=function(){if(F>0){if(t.lineWidth=F,t.lineCap="butt",t.setLineDash)switch(H){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ne=f;h&&(ne={x:0,y:0});var W=i.getNodeShape(e),re=A;P==="inside"&&(re=0),P==="outside"&&(re*=2);var me=(s+re+(F+Q))/s,be=(l+re+(F+Q))/l,fe=s*me,we=l*be,ue=i.nodeShapes[W].points,pe;if(h){var Ge=K(fe,we,W,ue);pe=Ge.path}if(W==="ellipse")i.drawEllipsePath(pe||t,ne.x,ne.y,fe,we);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(W)){var Re=0,vt=0,Qe=0;W==="round-diamond"?Re=(re+Q+F)*1.4:W==="round-heptagon"?(Re=(re+Q+F)*1.075,Qe=-(re/2+Q+F)/35):W==="round-hexagon"?Re=(re+Q+F)*1.12:W==="round-pentagon"?(Re=(re+Q+F)*1.13,Qe=-(re/2+Q+F)/15):W==="round-tag"?(Re=(re+Q+F)*1.12,vt=(re/2+F+Q)*.07):W==="round-triangle"&&(Re=(re+Q+F)*(Math.PI/2),Qe=-(re+Q/2+F)/Math.PI),Re!==0&&(me=(s+Re)/s,fe=s*me,["round-hexagon","round-tag"].includes(W)||(be=(l+Re)/l,we=l*be)),J=J==="auto"?ks(fe,we):J;for(var $e=fe/2,ct=we/2,Je=J+(re+F+Q)/2,ft=new Array(ue.length/2),Tt=new Array(ue.length/2),bt=0;bt0){if(n=n||a.position(),o==null||i==null){var h=a.padding();o=a.width()+2*h,i=a.height()+2*h}s.colorFillStyle(r,v[0],v[1],v[2],u),s.nodeShapes[f].draw(r,n.x,n.y,o+l*2,i+l*2,d),r.fill()}}}};Qr.drawNodeOverlay=Fl("overlay");Qr.drawNodeUnderlay=Fl("underlay");Qr.hasPie=function(t){return t=t[0],t._private.hasPie};Qr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),o=e.pstyle("pie-size"),i=a.x,s=a.y,l=e.width(),u=e.height(),v=Math.min(l,u)/2,f=0,d=this.usePaths();d&&(i=0,s=0),o.units==="%"?v=v*o.pfValue:o.pfValue!==void 0&&(v=o.pfValue/2);for(var h=1;h<=n.pieBackgroundN;h++){var c=e.pstyle("pie-"+h+"-background-size").value,p=e.pstyle("pie-"+h+"-background-color").value,g=e.pstyle("pie-"+h+"-background-opacity").value*r,y=c/100;y+f>1&&(y=1-f);var b=1.5*Math.PI+2*Math.PI*f,m=2*Math.PI*y,T=b+m;c===0||f>=1||f+y>1||(t.beginPath(),t.moveTo(i,s),t.arc(i,s,v,b,T),t.closePath(),this.colorFillStyle(t,p[0],p[1],p[2],g),t.fill(),f+=y)}};var mt={},$p=100;mt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=this.cy.window(),r=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(e.devicePixelRatio||1)/r};mt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;ni.minMbLowQualFrames&&(i.motionBlurPxRatio=i.mbPxRBlurry)),i.clearingMotionBlur&&(i.motionBlurPxRatio=1),i.textureDrawLastFrame&&!f&&(v[i.NODE]=!0,v[i.SELECT_BOX]=!0);var b=l.style(),m=l.zoom(),T=n!==void 0?n:m,C=l.pan(),S={x:C.x,y:C.y},E={zoom:m,pan:{x:C.x,y:C.y}},x=i.prevViewport,w=x===void 0||E.zoom!==x.zoom||E.pan.x!==x.pan.x||E.pan.y!==x.pan.y;!w&&!(p&&!c)&&(i.motionBlurPxRatio=1),o&&(S=o),T*=s,S.x*=s,S.y*=s;var D=i.getCachedZSortedEles();function L(ae,te,le,ce,ve){var ye=ae.globalCompositeOperation;ae.globalCompositeOperation="destination-out",i.colorFillStyle(ae,255,255,255,i.motionBlurTransparency),ae.fillRect(te,le,ce,ve),ae.globalCompositeOperation=ye}function A(ae,te){var le,ce,ve,ye;!i.clearingMotionBlur&&(ae===u.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]||ae===u.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG])?(le={x:C.x*h,y:C.y*h},ce=m*h,ve=i.canvasWidth*h,ye=i.canvasHeight*h):(le=S,ce=T,ve=i.canvasWidth,ye=i.canvasHeight),ae.setTransform(1,0,0,1,0,0),te==="motionBlur"?L(ae,0,0,ve,ye):!e&&(te===void 0||te)&&ae.clearRect(0,0,ve,ye),r||(ae.translate(le.x,le.y),ae.scale(ce,ce)),o&&ae.translate(o.x,o.y),n&&ae.scale(n,n)}if(f||(i.textureDrawLastFrame=!1),f){if(i.textureDrawLastFrame=!0,!i.textureCache){i.textureCache={},i.textureCache.bb=l.mutableElements().boundingBox(),i.textureCache.texture=i.data.bufferCanvases[i.TEXTURE_BUFFER];var N=i.data.bufferContexts[i.TEXTURE_BUFFER];N.setTransform(1,0,0,1,0,0),N.clearRect(0,0,i.canvasWidth*i.textureMult,i.canvasHeight*i.textureMult),i.render({forcedContext:N,drawOnlyNodeLayer:!0,forcedPxRatio:s*i.textureMult});var E=i.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:i.canvasWidth,height:i.canvasHeight};E.mpan={x:(0-E.pan.x)/E.zoom,y:(0-E.pan.y)/E.zoom}}v[i.DRAG]=!1,v[i.NODE]=!1;var O=u.contexts[i.NODE],M=i.textureCache.texture,E=i.textureCache.viewport;O.setTransform(1,0,0,1,0,0),d?L(O,0,0,E.width,E.height):O.clearRect(0,0,E.width,E.height);var R=b.core("outside-texture-bg-color").value,k=b.core("outside-texture-bg-opacity").value;i.colorFillStyle(O,R[0],R[1],R[2],k),O.fillRect(0,0,E.width,E.height);var m=l.zoom();A(O,!1),O.clearRect(E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s),O.drawImage(M,E.mpan.x,E.mpan.y,E.width/E.zoom/s,E.height/E.zoom/s)}else i.textureOnViewport&&!e&&(i.textureCache=null);var P=l.extent(),B=i.pinching||i.hoverData.dragging||i.swipePanning||i.data.wheelZooming||i.hoverData.draggingEles||i.cy.animated(),z=i.hideEdgesOnViewport&&B,G=[];if(G[i.NODE]=!v[i.NODE]&&d&&!i.clearedForMotionBlur[i.NODE]||i.clearingMotionBlur,G[i.NODE]&&(i.clearedForMotionBlur[i.NODE]=!0),G[i.DRAG]=!v[i.DRAG]&&d&&!i.clearedForMotionBlur[i.DRAG]||i.clearingMotionBlur,G[i.DRAG]&&(i.clearedForMotionBlur[i.DRAG]=!0),v[i.NODE]||r||a||G[i.NODE]){var F=d&&!G[i.NODE]&&h!==1,O=e||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_NODE]:u.contexts[i.NODE]),U=d&&!F?"motionBlur":void 0;A(O,U),z?i.drawCachedNodes(O,D.nondrag,s,P):i.drawLayeredElements(O,D.nondrag,s,P),i.debug&&i.drawDebugPoints(O,D.nondrag),!r&&!d&&(v[i.NODE]=!1)}if(!a&&(v[i.DRAG]||r||G[i.DRAG])){var F=d&&!G[i.DRAG]&&h!==1,O=e||(F?i.data.bufferContexts[i.MOTIONBLUR_BUFFER_DRAG]:u.contexts[i.DRAG]);A(O,d&&!F?"motionBlur":void 0),z?i.drawCachedNodes(O,D.drag,s,P):i.drawCachedElements(O,D.drag,s,P),i.debug&&i.drawDebugPoints(O,D.drag),!r&&!d&&(v[i.DRAG]=!1)}if(i.showFps||!a&&v[i.SELECT_BOX]&&!r){var O=e||u.contexts[i.SELECT_BOX];if(A(O),i.selection[4]==1&&(i.hoverData.selecting||i.touchData.selecting)){var m=i.cy.zoom(),H=b.core("selection-box-border-width").value/m;O.lineWidth=H,O.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",O.fillRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]),H>0&&(O.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",O.strokeRect(i.selection[0],i.selection[1],i.selection[2]-i.selection[0],i.selection[3]-i.selection[1]))}if(u.bgActivePosistion&&!i.hoverData.selecting){var m=i.cy.zoom(),_=u.bgActivePosistion;O.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",O.beginPath(),O.arc(_.x,_.y,b.core("active-bg-size").pfValue/m,0,2*Math.PI),O.fill()}var Q=i.lastRedrawTime;if(i.showFps&&Q){Q=Math.round(Q);var J=Math.round(1e3/Q);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+Q+" ms = "+J+" fps",0,20);var q=60;O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(J/q,1),20)}r||(v[i.SELECT_BOX]=!1)}if(d&&h!==1){var V=u.contexts[i.NODE],Z=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_NODE],K=u.contexts[i.DRAG],ie=i.data.bufferCanvases[i.MOTIONBLUR_BUFFER_DRAG],he=function(te,le,ce){te.setTransform(1,0,0,1,0,0),ce||!y?te.clearRect(0,0,i.canvasWidth,i.canvasHeight):L(te,0,0,i.canvasWidth,i.canvasHeight);var ve=h;te.drawImage(le,0,0,i.canvasWidth*ve,i.canvasHeight*ve,0,0,i.canvasWidth,i.canvasHeight)};(v[i.NODE]||G[i.NODE])&&(he(V,Z,G[i.NODE]),v[i.NODE]=!1),(v[i.DRAG]||G[i.DRAG])&&(he(K,ie,G[i.DRAG]),v[i.DRAG]=!1)}i.prevViewport=E,i.clearingMotionBlur&&(i.clearingMotionBlur=!1,i.motionBlurCleared=!0,i.motionBlur=!0),d&&(i.motionBlurTimeout=setTimeout(function(){i.motionBlurTimeout=null,i.clearedForMotionBlur[i.NODE]=!1,i.clearedForMotionBlur[i.DRAG]=!1,i.motionBlur=!1,i.clearingMotionBlur=!f,i.mbFrames=0,v[i.NODE]=!0,v[i.DRAG]=!0,i.redraw()},$p)),e||l.emit("render")};var sr={};sr.drawPolygonPath=function(t,e,r,a,n,o){var i=a/2,s=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+i*o[0],r+s*o[1]);for(var l=1;l0&&i>0){h.clearRect(0,0,o,i),h.globalCompositeOperation="source-over";var c=this.getCachedZSortedEles();if(t.full)h.translate(-a.x1*u,-a.y1*u),h.scale(u,u),this.drawElements(h,c),h.scale(1/u,1/u),h.translate(a.x1*u,a.y1*u);else{var p=e.pan(),g={x:p.x*u,y:p.y*u};u*=e.zoom(),h.translate(g.x,g.y),h.scale(u,u),this.drawElements(h,c),h.scale(1/u,1/u),h.translate(-g.x,-g.y)}t.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=t.bg,h.rect(0,0,o,i),h.fill())}return d};function _p(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),o=0;o"u"?"undefined":qe(OffscreenCanvas))!=="undefined")r=new OffscreenCanvas(t,e);else{var a=this.cy.window(),n=a.document;r=n.createElement("canvas"),r.width=t,r.height=e}return r};[Pl,Vt,qt,Fi,Tr,Qr,mt,sr,Ia,Vl].forEach(function(t){Ee(Le,t)});var Xp=[{name:"null",impl:xl},{name:"base",impl:Ml},{name:"canvas",impl:Yp}],qp=[{type:"layout",extensions:jg},{type:"renderer",extensions:Xp}],$l={},_l={};function Yl(t,e,r){var a=r,n=function(x){Ie("Can not register `"+e+"` for `"+t+"` since `"+x+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(xa.prototype[e])return n(e);xa.prototype[e]=r}else if(t==="collection"){if(tt.prototype[e])return n(e);tt.prototype[e]=r}else if(t==="layout"){for(var o=function(x){this.options=x,r.call(this,x),De(this._private)||(this._private={}),this._private.cy=x.cy,this._private.listeners=[],this.createEmitter()},i=o.prototype=Object.create(r.prototype),s=[],l=0;lc&&(this.rect.x-=(this.labelWidth-c)/2,this.setWidth(this.labelWidth)),this.labelHeight>p&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-p)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-p),this.setHeight(this.labelHeight))}}},f.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},f.prototype.transform=function(h){var c=this.rect.x;c>l.WORLD_BOUNDARY?c=l.WORLD_BOUNDARY:c<-l.WORLD_BOUNDARY&&(c=-l.WORLD_BOUNDARY);var p=this.rect.y;p>l.WORLD_BOUNDARY?p=l.WORLD_BOUNDARY:p<-l.WORLD_BOUNDARY&&(p=-l.WORLD_BOUNDARY);var g=new v(c,p),y=h.inverseTransformPoint(g);this.setLocation(y.x,y.y)},f.prototype.getLeft=function(){return this.rect.x},f.prototype.getRight=function(){return this.rect.x+this.rect.width},f.prototype.getTop=function(){return this.rect.y},f.prototype.getBottom=function(){return this.rect.y+this.rect.height},f.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},r.exports=f},function(r,a,n){function o(i,s){i==null&&s==null?(this.x=0,this.y=0):(this.x=i,this.y=s)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(i){this.x=i},o.prototype.setY=function(i){this.y=i},o.prototype.getDifference=function(i){return new DimensionD(this.x-i.x,this.y-i.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(i){return this.x+=i.width,this.y+=i.height,this},r.exports=o},function(r,a,n){var o=n(2),i=n(10),s=n(0),l=n(6),u=n(3),v=n(1),f=n(13),d=n(12),h=n(11);function c(g,y,b){o.call(this,b),this.estimatedSize=i.MIN_VALUE,this.margin=s.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=g,y!=null&&y instanceof l?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}c.prototype=Object.create(o.prototype);for(var p in o)c[p]=o[p];c.prototype.getNodes=function(){return this.nodes},c.prototype.getEdges=function(){return this.edges},c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getParent=function(){return this.parent},c.prototype.getLeft=function(){return this.left},c.prototype.getRight=function(){return this.right},c.prototype.getTop=function(){return this.top},c.prototype.getBottom=function(){return this.bottom},c.prototype.isConnected=function(){return this.isConnected},c.prototype.add=function(g,y,b){if(y==null&&b==null){var m=g;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(m)>-1)throw"Node already in graph!";return m.owner=this,this.getNodes().push(m),m}else{var T=g;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(b)>-1))throw"Source or target not in graph!";if(!(y.owner==b.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=b.owner?null:(T.source=y,T.target=b,T.isInterGraph=!1,this.getEdges().push(T),y.edges.push(T),b!=y&&b.edges.push(T),T)}},c.prototype.remove=function(g){var y=g;if(g instanceof u){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var b=y.edges.slice(),m,T=b.length,C=0;C-1&&x>-1))throw"Source and/or target doesn't know this edge!";m.source.edges.splice(E,1),m.target!=m.source&&m.target.edges.splice(x,1);var S=m.source.owner.getEdges().indexOf(m);if(S==-1)throw"Not in owner's edge list!";m.source.owner.getEdges().splice(S,1)}},c.prototype.updateLeftTop=function(){for(var g=i.MAX_VALUE,y=i.MAX_VALUE,b,m,T,C=this.getNodes(),S=C.length,E=0;Eb&&(g=b),y>m&&(y=m)}return g==i.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?T=C[0].getParent().paddingLeft:T=this.margin,this.left=y-T,this.top=g-T,new d(this.left,this.top))},c.prototype.updateBounds=function(g){for(var y=i.MAX_VALUE,b=-i.MAX_VALUE,m=i.MAX_VALUE,T=-i.MAX_VALUE,C,S,E,x,w,D=this.nodes,L=D.length,A=0;AC&&(y=C),bE&&(m=E),TC&&(y=C),bE&&(m=E),T=this.nodes.length){var L=0;b.forEach(function(A){A.owner==g&&L++}),L==this.nodes.length&&(this.isConnected=!0)}},r.exports=c},function(r,a,n){var o,i=n(1);function s(l){o=n(5),this.layout=l,this.graphs=[],this.edges=[]}s.prototype.addRoot=function(){var l=this.layout.newGraph(),u=this.layout.newNode(null),v=this.add(l,u);return this.setRootGraph(v),this.rootGraph},s.prototype.add=function(l,u,v,f,d){if(v==null&&f==null&&d==null){if(l==null)throw"Graph is null!";if(u==null)throw"Parent node is null!";if(this.graphs.indexOf(l)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(l),l.parent!=null)throw"Already has a parent!";if(u.child!=null)throw"Already has a child!";return l.parent=u,u.child=l,l}else{d=v,f=u,v=l;var h=f.getOwner(),c=d.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(c!=null&&c.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==c)return v.isInterGraph=!1,h.add(v,f,d);if(v.isInterGraph=!0,v.source=f,v.target=d,this.edges.indexOf(v)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(v),!(v.source!=null&&v.target!=null))throw"Edge source and/or target is null!";if(!(v.source.edges.indexOf(v)==-1&&v.target.edges.indexOf(v)==-1))throw"Edge already in source and/or target incidency list!";return v.source.edges.push(v),v.target.edges.push(v),v}},s.prototype.remove=function(l){if(l instanceof o){var u=l;if(u.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(u==this.rootGraph||u.parent!=null&&u.parent.graphManager==this))throw"Invalid parent node!";var v=[];v=v.concat(u.getEdges());for(var f,d=v.length,h=0;h=l.getRight()?u[0]+=Math.min(l.getX()-s.getX(),s.getRight()-l.getRight()):l.getX()<=s.getX()&&l.getRight()>=s.getRight()&&(u[0]+=Math.min(s.getX()-l.getX(),l.getRight()-s.getRight())),s.getY()<=l.getY()&&s.getBottom()>=l.getBottom()?u[1]+=Math.min(l.getY()-s.getY(),s.getBottom()-l.getBottom()):l.getY()<=s.getY()&&l.getBottom()>=s.getBottom()&&(u[1]+=Math.min(s.getY()-l.getY(),l.getBottom()-s.getBottom()));var d=Math.abs((l.getCenterY()-s.getCenterY())/(l.getCenterX()-s.getCenterX()));l.getCenterY()===s.getCenterY()&&l.getCenterX()===s.getCenterX()&&(d=1);var h=d*u[0],c=u[1]/d;u[0]h)return u[0]=v,u[1]=p,u[2]=d,u[3]=D,!1;if(fd)return u[0]=c,u[1]=f,u[2]=x,u[3]=h,!1;if(vd?(u[0]=y,u[1]=b,O=!0):(u[0]=g,u[1]=p,O=!0):R===P&&(v>d?(u[0]=c,u[1]=p,O=!0):(u[0]=m,u[1]=b,O=!0)),-k===P?d>v?(u[2]=w,u[3]=D,M=!0):(u[2]=x,u[3]=E,M=!0):k===P&&(d>v?(u[2]=S,u[3]=E,M=!0):(u[2]=L,u[3]=D,M=!0)),O&&M)return!1;if(v>d?f>h?(B=this.getCardinalDirection(R,P,4),z=this.getCardinalDirection(k,P,2)):(B=this.getCardinalDirection(-R,P,3),z=this.getCardinalDirection(-k,P,1)):f>h?(B=this.getCardinalDirection(-R,P,1),z=this.getCardinalDirection(-k,P,3)):(B=this.getCardinalDirection(R,P,2),z=this.getCardinalDirection(k,P,4)),!O)switch(B){case 1:F=p,G=v+-C/P,u[0]=G,u[1]=F;break;case 2:G=m,F=f+T*P,u[0]=G,u[1]=F;break;case 3:F=b,G=v+C/P,u[0]=G,u[1]=F;break;case 4:G=y,F=f+-T*P,u[0]=G,u[1]=F;break}if(!M)switch(z){case 1:H=E,U=d+-N/P,u[2]=U,u[3]=H;break;case 2:U=L,H=h+A*P,u[2]=U,u[3]=H;break;case 3:H=D,U=d+N/P,u[2]=U,u[3]=H;break;case 4:U=w,H=h+-A*P,u[2]=U,u[3]=H;break}}return!1},i.getCardinalDirection=function(s,l,u){return s>l?u:1+u%4},i.getIntersection=function(s,l,u,v){if(v==null)return this.getIntersection2(s,l,u);var f=s.x,d=s.y,h=l.x,c=l.y,p=u.x,g=u.y,y=v.x,b=v.y,m=void 0,T=void 0,C=void 0,S=void 0,E=void 0,x=void 0,w=void 0,D=void 0,L=void 0;return C=c-d,E=f-h,w=h*d-f*c,S=b-g,x=p-y,D=y*g-p*b,L=C*x-S*E,L===0?null:(m=(E*D-x*w)/L,T=(S*w-C*D)/L,new o(m,T))},i.angleOfVector=function(s,l,u,v){var f=void 0;return s!==u?(f=Math.atan((v-l)/(u-s)),u0?1:i<0?-1:0},o.floor=function(i){return i<0?Math.ceil(i):Math.floor(i)},o.ceil=function(i){return i<0?Math.floor(i):Math.ceil(i)},r.exports=o},function(r,a,n){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,r.exports=o},function(r,a,n){var o=function(){function f(d,h){for(var c=0;c"u"?"undefined":o(s);return s==null||l!="object"&&l!="function"},r.exports=i},function(r,a,n){function o(p){if(Array.isArray(p)){for(var g=0,y=Array(p.length);g0&&g;){for(C.push(E[0]);C.length>0&&g;){var x=C[0];C.splice(0,1),T.add(x);for(var w=x.getEdges(),m=0;m-1&&E.splice(N,1)}T=new Set,S=new Map}}return p},c.prototype.createDummyNodesForBendpoints=function(p){for(var g=[],y=p.source,b=this.graphManager.calcLowestCommonAncestor(p.source,p.target),m=0;m0){for(var b=this.edgeToDummyNodes.get(y),m=0;m=0&&g.splice(D,1);var L=S.getNeighborsList();L.forEach(function(O){if(y.indexOf(O)<0){var M=b.get(O),R=M-1;R==1&&x.push(O),b.set(O,R)}})}y=y.concat(x),(g.length==1||g.length==2)&&(m=!0,T=g[0])}return T},c.prototype.setGraphManager=function(p){this.graphManager=p},r.exports=c},function(r,a,n){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},r.exports=o},function(r,a,n){var o=n(4);function i(s,l){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(s){this.lworldOrgX=s},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(s){this.lworldOrgY=s},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(s){this.lworldExtX=s},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(s){this.lworldExtY=s},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(s){this.ldeviceOrgX=s},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(s){this.ldeviceOrgY=s},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(s){this.ldeviceExtX=s},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(s){this.ldeviceExtY=s},i.prototype.transformX=function(s){var l=0,u=this.lworldExtX;return u!=0&&(l=this.ldeviceOrgX+(s-this.lworldOrgX)*this.ldeviceExtX/u),l},i.prototype.transformY=function(s){var l=0,u=this.lworldExtY;return u!=0&&(l=this.ldeviceOrgY+(s-this.lworldOrgY)*this.ldeviceExtY/u),l},i.prototype.inverseTransformX=function(s){var l=0,u=this.ldeviceExtX;return u!=0&&(l=this.lworldOrgX+(s-this.ldeviceOrgX)*this.lworldExtX/u),l},i.prototype.inverseTransformY=function(s){var l=0,u=this.ldeviceExtY;return u!=0&&(l=this.lworldOrgY+(s-this.ldeviceOrgY)*this.lworldExtY/u),l},i.prototype.inverseTransformPoint=function(s){var l=new o(this.inverseTransformX(s.x),this.inverseTransformY(s.y));return l},r.exports=i},function(r,a,n){function o(h){if(Array.isArray(h)){for(var c=0,p=Array(h.length);cs.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*s.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-s.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT_INCREMENTAL):(h>s.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(s.COOLING_ADAPTATION_FACTOR,1-(h-s.ADAPTATION_LOWER_NODE_LIMIT)/(s.ADAPTATION_UPPER_NODE_LIMIT-s.ADAPTATION_LOWER_NODE_LIMIT)*(1-s.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=s.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},f.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),c,p=0;p0&&arguments[0]!==void 0?arguments[0]:!0,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,p,g,y,b,m=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%s.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),T=new Set,p=0;pC||T>C)&&(h.gravitationForceX=-this.gravityConstant*y,h.gravitationForceY=-this.gravityConstant*b)):(C=c.getEstimatedSize()*this.compoundGravityRangeFactor,(m>C||T>C)&&(h.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*b*this.compoundGravityConstant))},f.prototype.isConverged=function(){var h,c=!1;return this.totalIterations>this.maxIterations/3&&(c=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement=m.length||C>=m[0].length)){for(var S=0;Sf}}]),u}();r.exports=l},function(r,a,n){var o=function(){function l(u,v){for(var f=0;f2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,l),this.sequence1=u,this.sequence2=v,this.match_score=f,this.mismatch_penalty=d,this.gap_penalty=h,this.iMax=u.length+1,this.jMax=v.length+1,this.grid=new Array(this.iMax);for(var c=0;c=0;u--){var v=this.listeners[u];v.event===s&&v.callback===l&&this.listeners.splice(u,1)}},i.emit=function(s,l){for(var u=0;uv.coolingFactor*v.maxNodeDisplacement&&(this.displacementX=v.coolingFactor*v.maxNodeDisplacement*s.sign(this.displacementX)),Math.abs(this.displacementY)>v.coolingFactor*v.maxNodeDisplacement&&(this.displacementY=v.coolingFactor*v.maxNodeDisplacement*s.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),v.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},l.prototype.propogateDisplacementToChildren=function(v,f){for(var d=this.getChild().getNodes(),h,c=0;c0)this.positionNodesRadially(E);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),w=this.nodesWithGravity.filter(function(D){return x.has(D)});this.graphManager.setAllNodesToApplyGravitation(w),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},C.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(L){return E.has(L)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var w=!this.isTreeGrowing&&!this.isGrowthFinished,D=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(w,D),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},C.prototype.getPositionsData=function(){for(var E=this.graphManager.getAllNodes(),x={},w=0;w1){var O;for(O=0;OD&&(D=Math.floor(N.y)),A=Math.floor(N.x+f.DEFAULT_COMPONENT_SEPERATION)}this.transform(new p(h.WORLD_CENTER_X-N.x/2,h.WORLD_CENTER_Y-N.y/2))},C.radialLayout=function(E,x,w){var D=Math.max(this.maxDiagonalInTree(E),f.DEFAULT_RADIAL_SEPARATION);C.branchRadialLayout(x,null,0,359,0,D);var L=m.calculateBounds(E),A=new T;A.setDeviceOrgX(L.getMinX()),A.setDeviceOrgY(L.getMinY()),A.setWorldOrgX(w.x),A.setWorldOrgY(w.y);for(var N=0;N1;){var H=U[0];U.splice(0,1);var _=P.indexOf(H);_>=0&&P.splice(_,1),G--,B--}x!=null?F=(P.indexOf(U[0])+1)%G:F=0;for(var Q=Math.abs(D-w)/B,J=F;z!=B;J=++J%G){var q=P[J].getOtherEnd(E);if(q!=x){var V=(w+z*Q)%360,Z=(V+Q)%360;C.branchRadialLayout(q,E,V,Z,L+A,A),z++}}},C.maxDiagonalInTree=function(E){for(var x=y.MIN_VALUE,w=0;wx&&(x=L)}return x},C.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},C.prototype.groupZeroDegreeMembers=function(){var E=this,x={};this.memberGroups={},this.idToDummyNode={};for(var w=[],D=this.graphManager.getAllNodes(),L=0;L"u"&&(x[O]=[]),x[O]=x[O].concat(A)}Object.keys(x).forEach(function(M){if(x[M].length>1){var R="DummyCompound_"+M;E.memberGroups[R]=x[M];var k=x[M][0].getParent(),P=new u(E.graphManager);P.id=R,P.paddingLeft=k.paddingLeft||0,P.paddingRight=k.paddingRight||0,P.paddingBottom=k.paddingBottom||0,P.paddingTop=k.paddingTop||0,E.idToDummyNode[R]=P;var B=E.getGraphManager().add(E.newGraph(),P),z=k.getChild();z.add(P);for(var G=0;G=0;E--){var x=this.compoundOrder[E],w=x.id,D=x.paddingLeft,L=x.paddingTop;this.adjustLocations(this.tiledMemberPack[w],x.rect.x,x.rect.y,D,L)}},C.prototype.repopulateZeroDegreeMembers=function(){var E=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(w){var D=E.idToDummyNode[w],L=D.paddingLeft,A=D.paddingTop;E.adjustLocations(x[w],D.rect.x,D.rect.y,L,A)})},C.prototype.getToBeTiled=function(E){var x=E.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var w=E.getChild();if(w==null)return this.toBeTiled[x]=!1,!1;for(var D=w.getNodes(),L=0;L0)return this.toBeTiled[x]=!1,!1;if(A.getChild()==null){this.toBeTiled[A.id]=!1;continue}if(!this.getToBeTiled(A))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},C.prototype.getNodeDegree=function(E){E.id;for(var x=E.getEdges(),w=0,D=0;DM&&(M=k.rect.height)}w+=M+E.verticalPadding}},C.prototype.tileCompoundMembers=function(E,x){var w=this;this.tiledMemberPack=[],Object.keys(E).forEach(function(D){var L=x[D];w.tiledMemberPack[D]=w.tileNodes(E[D],L.paddingLeft+L.paddingRight),L.rect.width=w.tiledMemberPack[D].width,L.rect.height=w.tiledMemberPack[D].height})},C.prototype.tileNodes=function(E,x){var w=f.TILING_PADDING_VERTICAL,D=f.TILING_PADDING_HORIZONTAL,L={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:w,horizontalPadding:D};E.sort(function(O,M){return O.rect.width*O.rect.height>M.rect.width*M.rect.height?-1:O.rect.width*O.rect.height0&&(N+=E.horizontalPadding),E.rowWidth[w]=N,E.width0&&(O+=E.verticalPadding);var M=0;O>E.rowHeight[w]&&(M=E.rowHeight[w],E.rowHeight[w]=O,M=E.rowHeight[w]-M),E.height+=M,E.rows[w].push(x)},C.prototype.getShortestRowIndex=function(E){for(var x=-1,w=Number.MAX_VALUE,D=0;Dw&&(x=D,w=E.rowWidth[D]);return x},C.prototype.canAddHorizontal=function(E,x,w){var D=this.getShortestRowIndex(E);if(D<0)return!0;var L=E.rowWidth[D];if(L+E.horizontalPadding+x<=E.width)return!0;var A=0;E.rowHeight[D]0&&(A=w+E.verticalPadding-E.rowHeight[D]);var N;E.width-L>=x+E.horizontalPadding?N=(E.height+A)/(L+x+E.horizontalPadding):N=(E.height+A)/E.width,A=w+E.verticalPadding;var O;return E.widthA&&x!=w){D.splice(-1,1),E.rows[w].push(L),E.rowWidth[x]=E.rowWidth[x]-A,E.rowWidth[w]=E.rowWidth[w]+A,E.width=E.rowWidth[instance.getLongestRowIndex(E)];for(var N=Number.MIN_VALUE,O=0;ON&&(N=D[O].height);x>0&&(N+=E.verticalPadding);var M=E.rowHeight[x]+E.rowHeight[w];E.rowHeight[x]=N,E.rowHeight[w]0)for(var z=L;z<=A;z++)B[0]+=this.grid[z][N-1].length+this.grid[z][N].length-1;if(A0)for(var z=N;z<=O;z++)B[3]+=this.grid[L-1][z].length+this.grid[L][z].length-1;for(var G=y.MAX_VALUE,F,U,H=0;H0){var O;O=T.getGraphManager().add(T.newGraph(),w),this.processChildrenList(O,x,T)}}},p.prototype.stop=function(){return this.stopped=!0,this};var y=function(m){m("layout","cose-bilkent",p)};typeof cytoscape<"u"&&y(cytoscape),a.exports=y}])})})(ql);var jp=ql.exports;const ey=lu(jp);var fi=function(){var t=de(function(T,C,S,E){for(S=S||{},E=T.length;E--;S[T[E]]=C);return S},"o"),e=[1,4],r=[1,13],a=[1,12],n=[1,15],o=[1,16],i=[1,20],s=[1,19],l=[6,7,8],u=[1,26],v=[1,24],f=[1,25],d=[6,7,11],h=[1,6,13,15,16,19,22],c=[1,33],p=[1,34],g=[1,6,7,11,13,15,16,19,22],y={trace:de(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:de(function(C,S,E,x,w,D,L){var A=D.length-1;switch(w){case 6:case 7:return x;case 8:x.getLogger().trace("Stop NL ");break;case 9:x.getLogger().trace("Stop EOF ");break;case 11:x.getLogger().trace("Stop NL2 ");break;case 12:x.getLogger().trace("Stop EOF2 ");break;case 15:x.getLogger().info("Node: ",D[A].id),x.addNode(D[A-1].length,D[A].id,D[A].descr,D[A].type);break;case 16:x.getLogger().trace("Icon: ",D[A]),x.decorateNode({icon:D[A]});break;case 17:case 21:x.decorateNode({class:D[A]});break;case 18:x.getLogger().trace("SPACELIST");break;case 19:x.getLogger().trace("Node: ",D[A].id),x.addNode(0,D[A].id,D[A].descr,D[A].type);break;case 20:x.decorateNode({icon:D[A]});break;case 25:x.getLogger().trace("node found ..",D[A-2]),this.$={id:D[A-1],descr:D[A-1],type:x.getType(D[A-2],D[A])};break;case 26:this.$={id:D[A],descr:D[A],type:x.nodeType.DEFAULT};break;case 27:x.getLogger().trace("node found ..",D[A-3]),this.$={id:D[A-3],descr:D[A-1],type:x.getType(D[A-2],D[A])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:o,17:17,18:18,19:i,22:s},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:a,14:14,15:n,16:o,17:17,18:18,19:i,22:s},{6:r,9:22,12:11,13:a,14:14,15:n,16:o,17:17,18:18,19:i,22:s},{6:u,7:v,10:23,11:f},t(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:i,22:s}),t(d,[2,18]),t(d,[2,19]),t(d,[2,20]),t(d,[2,21]),t(d,[2,23]),t(d,[2,24]),t(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:v,10:32,11:f},{1:[2,7],6:r,12:21,13:a,14:14,15:n,16:o,17:17,18:18,19:i,22:s},t(h,[2,14],{7:c,11:p}),t(g,[2,8]),t(g,[2,9]),t(g,[2,10]),t(d,[2,15]),t(d,[2,16]),t(d,[2,17]),{20:[1,35]},{21:[1,36]},t(h,[2,13],{7:c,11:p}),t(g,[2,11]),t(g,[2,12]),{21:[1,37]},t(d,[2,25]),t(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:de(function(C,S){if(S.recoverable)this.trace(C);else{var E=new Error(C);throw E.hash=S,E}},"parseError"),parse:de(function(C){var S=this,E=[0],x=[],w=[null],D=[],L=this.table,A="",N=0,O=0,M=2,R=1,k=D.slice.call(arguments,1),P=Object.create(this.lexer),B={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(B.yy[z]=this.yy[z]);P.setInput(C,B.yy),B.yy.lexer=P,B.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var G=P.yylloc;D.push(G);var F=P.options&&P.options.ranges;typeof B.yy.parseError=="function"?this.parseError=B.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function U(te){E.length=E.length-2*te,w.length=w.length-te,D.length=D.length-te}de(U,"popStack");function H(){var te;return te=x.pop()||P.lex()||R,typeof te!="number"&&(te instanceof Array&&(x=te,te=x.pop()),te=S.symbols_[te]||te),te}de(H,"lex");for(var _,Q,J,q,V={},Z,K,ie,he;;){if(Q=E[E.length-1],this.defaultActions[Q]?J=this.defaultActions[Q]:((_===null||typeof _>"u")&&(_=H()),J=L[Q]&&L[Q][_]),typeof J>"u"||!J.length||!J[0]){var ae="";he=[];for(Z in L[Q])this.terminals_[Z]&&Z>M&&he.push("'"+this.terminals_[Z]+"'");P.showPosition?ae="Parse error on line "+(N+1)+`: `+P.showPosition()+` Expecting `+he.join(", ")+", got '"+(this.terminals_[_]||_)+"'":ae="Parse error on line "+(N+1)+": Unexpected "+(_==R?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(ae,{text:P.match,token:this.terminals_[_]||_,line:P.yylineno,loc:G,expected:he})}if(J[0]instanceof Array&&J.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+_);switch(J[0]){case 1:E.push(_),w.push(P.yytext),D.push(P.yylloc),E.push(J[1]),_=null,O=P.yyleng,A=P.yytext,N=P.yylineno,G=P.yylloc;break;case 2:if(K=this.productions_[J[1]][1],V.$=w[w.length-K],V._$={first_line:D[D.length-(K||1)].first_line,last_line:D[D.length-1].last_line,first_column:D[D.length-(K||1)].first_column,last_column:D[D.length-1].last_column},F&&(V._$.range=[D[D.length-(K||1)].range[0],D[D.length-1].range[1]]),q=this.performAction.apply(V,[A,O,N,B.yy,J[1],w,D].concat(k)),typeof q<"u")return q;K&&(E=E.slice(0,-1*K*2),w=w.slice(0,-1*K),D=D.slice(0,-1*K)),E.push(this.productions_[J[1]][0]),w.push(V.$),D.push(V._$),ie=L[E[E.length-2]][E[E.length-1]],E.push(ie);break;case 3:return!0}}return!0},"parse")},b=function(){var T={EOF:1,parseError:de(function(S,E){if(this.yy.parser)this.yy.parser.parseError(S,E);else throw new Error(S)},"parseError"),setInput:de(function(C,S){return this.yy=S||this.yy||{},this._input=C,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:de(function(){var C=this._input[0];this.yytext+=C,this.yyleng++,this.offset++,this.match+=C,this.matched+=C;var S=C.match(/(?:\r\n?|\n).*/g);return S?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),C},"input"),unput:de(function(C){var S=C.length,E=C.split(/(?:\r\n?|\n)/g);this._input=C+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-S),this.offset-=S;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===x.length?this.yylloc.first_column:0)+x[x.length-E.length].length-E[0].length:this.yylloc.first_column-S},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-S]),this.yyleng=this.yytext.length,this},"unput"),more:de(function(){return this._more=!0,this},"more"),reject:de(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:de(function(C){this.unput(this.match.slice(C))},"less"),pastInput:de(function(){var C=this.matched.substr(0,this.matched.length-this.match.length);return(C.length>20?"...":"")+C.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:de(function(){var C=this.match;return C.length<20&&(C+=this._input.substr(0,20-C.length)),(C.substr(0,20)+(C.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:de(function(){var C=this.pastInput(),S=new Array(C.length+1).join("-");return C+this.upcomingInput()+` `+S+"^"},"showPosition"),test_match:de(function(C,S){var E,x,w;if(this.options.backtrack_lexer&&(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(w.yylloc.range=this.yylloc.range.slice(0))),x=C[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+C[0].length},this.yytext+=C[0],this.match+=C[0],this.matches=C,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(C[0].length),this.matched+=C[0],E=this.performAction.call(this,this.yy,this,S,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),E)return E;if(this._backtrack){for(var D in w)this[D]=w[D];return!1}return!1},"test_match"),next:de(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var C,S,E,x;this._more||(this.yytext="",this.match="");for(var w=this._currentRules(),D=0;DS[0].length)){if(S=E,x=D,this.options.backtrack_lexer){if(C=this.test_match(E,w[D]),C!==!1)return C;if(this._backtrack){S=!1;continue}else return!1}else if(!this.options.flex)break}return S?(C=this.test_match(S,w[x]),C!==!1?C:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:de(function(){var S=this.next();return S||this.lex()},"lex"),begin:de(function(S){this.conditionStack.push(S)},"begin"),popState:de(function(){var S=this.conditionStack.length-1;return S>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:de(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:de(function(S){return S=this.conditionStack.length-1-Math.abs(S||0),S>=0?this.conditionStack[S]:"INITIAL"},"topState"),pushState:de(function(S){this.begin(S)},"pushState"),stateStackSize:de(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:de(function(S,E,x,w){switch(x){case 0:return S.getLogger().trace("Found comment",E.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:S.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return S.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:S.getLogger().trace("end icon"),this.popState();break;case 10:return S.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return S.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return S.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return S.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:S.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return S.getLogger().trace("description:",E.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),S.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),S.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),S.getLogger().trace("node end ...",E.yytext),"NODE_DEND";case 30:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),S.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),S.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),S.getLogger().trace("node end (("),"NODE_DEND";case 35:return S.getLogger().trace("Long description:",E.yytext),20;case 36:return S.getLogger().trace("Long description:",E.yytext),20}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return T}();y.lexer=b;function m(){this.yy={}}return de(m,"Parser"),m.prototype=y,y.Parser=m,new m}();fi.parser=fi;var ty=fi,It=[],Wl=0,Gi={},ry=de(()=>{It=[],Wl=0,Gi={}},"clear"),ay=de(function(t){for(let e=It.length-1;e>=0;e--)if(It[e].levelIt.length>0?It[0]:null,"getMindmap"),iy=de((t,e,r,a)=>{var l,u;wr.info("addNode",t,e,r,a);const n=ci();let o=((l=n.mindmap)==null?void 0:l.padding)??en.mindmap.padding;switch(a){case He.ROUNDED_RECT:case He.RECT:case He.HEXAGON:o*=2}const i={id:Wl++,nodeId:tn(e,n),level:t,descr:tn(r,n),type:a,children:[],width:((u=n.mindmap)==null?void 0:u.maxNodeWidth)??en.mindmap.maxNodeWidth,padding:o},s=ay(t);if(s)s.children.push(i),It.push(i);else if(It.length===0)It.push(i);else throw new Error('There can be only one root. No parent could be found for ("'+i.descr+'")')},"addNode"),He={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},oy=de((t,e)=>{switch(wr.debug("In get type",t,e),t){case"[":return He.RECT;case"(":return e===")"?He.ROUNDED_RECT:He.CLOUD;case"((":return He.CIRCLE;case")":return He.CLOUD;case"))":return He.BANG;case"{{":return He.HEXAGON;default:return He.DEFAULT}},"getType"),sy=de((t,e)=>{Gi[t]=e},"setElementForId"),ly=de(t=>{if(!t)return;const e=ci(),r=It[It.length-1];t.icon&&(r.icon=tn(t.icon,e)),t.class&&(r.class=tn(t.class,e))},"decorateNode"),uy=de(t=>{switch(t){case He.DEFAULT:return"no-border";case He.RECT:return"rect";case He.ROUNDED_RECT:return"rounded-rect";case He.CIRCLE:return"circle";case He.CLOUD:return"cloud";case He.BANG:return"bang";case He.HEXAGON:return"hexgon";default:return"no-border"}},"type2Str"),vy=de(()=>wr,"getLogger"),fy=de(t=>Gi[t],"getElementById"),hy={clear:ry,addNode:iy,getMindmap:ny,nodeType:He,getType:oy,setElementForId:sy,decorateNode:ly,type2Str:uy,getLogger:vy,getElementById:fy},cy=hy,dy=12,gy=de(function(t,e,r,a){e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+2*5} q0,-5 5,-5 h${r.width-2*5} q5,0 5,5 v${r.height-5} H0 Z`),e.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},"defaultBkg"),py=de(function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},"rectBkg"),yy=de(function(t,e,r){const a=r.width,n=r.height,o=.15*a,i=.25*a,s=.35*a,l=.2*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${o},${o} 0 0,1 ${a*.25},${-1*a*.1} a${s},${s} 1 0,1 ${a*.4},${-1*a*.1} a${i},${i} 1 0,1 ${a*.35},${1*a*.2} a${o},${o} 1 0,1 ${a*.15},${1*n*.35} a${l},${l} 1 0,1 ${-1*a*.15},${1*n*.65} a${i},${o} 1 0,1 ${-1*a*.25},${a*.15} a${s},${s} 1 0,1 ${-1*a*.5},0 a${o},${o} 1 0,1 ${-1*a*.25},${-1*a*.15} a${o},${o} 1 0,1 ${-1*a*.1},${-1*n*.35} a${l},${l} 1 0,1 ${a*.1},${-1*n*.65} H0 V0 Z`)},"cloudBkg"),my=de(function(t,e,r){const a=r.width,n=r.height,o=.15*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${o},${o} 1 0,0 ${a*.25},${-1*n*.1} a${o},${o} 1 0,0 ${a*.25},0 a${o},${o} 1 0,0 ${a*.25},0 a${o},${o} 1 0,0 ${a*.25},${1*n*.1} a${o},${o} 1 0,0 ${a*.15},${1*n*.33} a${o*.8},${o*.8} 1 0,0 0,${1*n*.34} a${o},${o} 1 0,0 ${-1*a*.15},${1*n*.33} a${o},${o} 1 0,0 ${-1*a*.25},${n*.15} a${o},${o} 1 0,0 ${-1*a*.25},0 a${o},${o} 1 0,0 ${-1*a*.25},0 a${o},${o} 1 0,0 ${-1*a*.25},${-1*n*.15} a${o},${o} 1 0,0 ${-1*a*.1},${-1*n*.33} a${o*.8},${o*.8} 1 0,0 0,${-1*n*.34} a${o},${o} 1 0,0 ${a*.1},${-1*n*.33} H0 V0 Z`)},"bangBkg"),by=de(function(t,e,r){e.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("r",r.width/2)},"circleBkg");function Kl(t,e,r,a,n){return t.insert("polygon",":first-child").attr("points",a.map(function(o){return o.x+","+o.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+r+")")}de(Kl,"insertPolygonShape");var Ey=de(function(t,e,r){const a=r.height,o=a/4,i=r.width-r.padding+2*o,s=[{x:o,y:0},{x:i-o,y:0},{x:i,y:-a/2},{x:i-o,y:-a},{x:o,y:-a},{x:0,y:-a/2}];Kl(e,i,a,s,r)},"hexagonBkg"),wy=de(function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},"roundedRectBkg"),xy=de(async function(t,e,r,a,n){const o=n.htmlLabels,i=a%(dy-1),s=e.append("g");r.section=i;let l="section-"+i;i<0&&(l+=" section-root"),s.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+l);const u=s.append("g"),v=s.append("g"),f=r.descr.replace(/()/g,` `);await vu(v,f,{useHtmlLabels:o,width:r.width,classes:"mindmap-node-label"},n),o||v.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const d=v.node().getBBox(),[h]=fu(n.fontSize);if(r.height=d.height+h*1.1*.5+r.padding,r.width=d.width+2*r.padding,r.icon)if(r.type===t.nodeType.CIRCLE)r.height+=50,r.width+=50,s.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+r.icon),v.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;const c=r.height;r.height=Math.max(c,60);const p=Math.abs(r.height-c);s.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+p/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+r.icon),v.attr("transform","translate("+(25+r.width/2)+", "+(p/2+r.padding/2)+")")}else if(o){const c=(r.width-d.width)/2,p=(r.height-d.height)/2;v.attr("transform","translate("+c+", "+p+")")}else{const c=r.width/2,p=r.padding/2;v.attr("transform","translate("+c+", "+p+")")}switch(r.type){case t.nodeType.DEFAULT:gy(t,u,r,i);break;case t.nodeType.ROUNDED_RECT:wy(t,u,r,i);break;case t.nodeType.RECT:py(t,u,r,i);break;case t.nodeType.CIRCLE:u.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),by(t,u,r,i);break;case t.nodeType.CLOUD:yy(t,u,r,i);break;case t.nodeType.BANG:my(t,u,r,i);break;case t.nodeType.HEXAGON:Ey(t,u,r,i);break}return t.setElementForId(r.id,s),r.height},"drawNode"),Ty=de(function(t,e){const r=t.getElementById(e.id),a=e.x||0,n=e.y||0;r.attr("transform","translate("+a+","+n+")")},"positionNode");ir.use(ey);async function zi(t,e,r,a,n){await xy(t,e,r,a,n),r.children&&await Promise.all(r.children.map((o,i)=>zi(t,e,o,a<0?i:a,n)))}de(zi,"drawNodes");function Zl(t,e){e.edges().map((r,a)=>{const n=r.data();if(r[0]._private.bodyBounds){const o=r[0]._private.rscratch;wr.trace("Edge: ",a,n),t.insert("path").attr("d",`M ${o.startX},${o.startY} L ${o.midX},${o.midY} L${o.endX},${o.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}de(Zl,"drawEdges");function Vi(t,e,r,a){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:a,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(n=>{Vi(n,e,r,a+1),e.add({group:"edges",data:{id:`${t.id}_${n.id}`,source:t.id,target:n.id,depth:a,section:n.section}})})}de(Vi,"addNodes");function Ql(t,e){return new Promise(r=>{const a=uu("body").append("div").attr("id","cy").attr("style","display:none"),n=ir({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),Vi(t,n,e,0),n.nodes().forEach(function(o){o.layoutDimensions=()=>{const i=o.data();return{w:i.width,h:i.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(o=>{wr.info("Ready",o),r(n)})})}de(Ql,"layoutMindmap");function Jl(t,e){e.nodes().map((r,a)=>{const n=r.data();n.x=r.position().x,n.y=r.position().y,Ty(t,n);const o=t.getElementById(n.nodeId);wr.info("Id:",a,"Position: (",r.position().x,", ",r.position().y,")",n),o.attr("transform",`translate(${r.position().x-n.width/2}, ${r.position().y-n.height/2})`),o.attr("attr",`apa-${a})`)})}de(Jl,"positionNodes");var Cy=de(async(t,e,r,a)=>{var f,d;wr.debug(`Rendering mindmap diagram `+t);const n=a.db,o=n.getMindmap();if(!o)return;const i=ci();i.htmlLabels=!1;const s=hu(e),l=s.append("g");l.attr("class","mindmap-edges");const u=s.append("g");u.attr("class","mindmap-nodes"),await zi(n,u,o,-1,i);const v=await Ql(o,i);Zl(l,v),Jl(n,v),cu(void 0,s,((f=i.mindmap)==null?void 0:f.padding)??en.mindmap.padding,((d=i.mindmap)==null?void 0:d.useMaxWidth)??en.mindmap.useMaxWidth)},"draw"),Dy={draw:Cy},Sy=de(t=>{let e="";for(let r=0;r` .edge { stroke-width: 3; } ${Sy(t)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${t.git0}; } .section-root text { fill: ${t.gitBranchLabel0}; } .icon-container { height:100%; display: flex; justify-content: center; align-items: center; } .edge { fill: none; } .mindmap-node-label { dy: 1em; alignment-baseline: middle; text-anchor: middle; dominant-baseline: middle; text-align: center; } `,"getStyles"),Ay=Ly,Ny={db:cy,renderer:Dy,parser:ty,styles:Ay};export{Ny as diagram};