import{D as Da,E as Yl,a7 as xp,a6 as sn,ab as Wr,aa as ni,am as Tp,bO as Cp,bP as Dp,bQ as Sp}from"./doc-9439ea18.js";import{a as Lp}from"./createText-a48a4c90-b31e51e0.js";var Hl={exports:{}};(function(me,he){(function(ee,de){me.exports=de()})(Da,function(){function ee(t){"@babel/helpers - typeof";return ee=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},ee(t)}function de(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function H(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,a=new Array(e);r"u"?null:window,$=D?D.navigator:null;D&&D.document;var _=ee(""),Q=ee({}),ne=ee(function(){}),le=typeof HTMLElement>"u"?"undefined":ee(HTMLElement),J=function(e){return e&&e.instanceString&&Y(e.instanceString)?e.instanceString():null},j=function(e){return e!=null&&ee(e)==_},Y=function(e){return e!=null&&ee(e)===ne},te=function(e){return!pe(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},L=function(e){return e!=null&&ee(e)===Q&&!te(e)&&e.constructor===Object},V=function(e){return e!=null&&ee(e)===Q},R=function(e){return e!=null&&ee(e)===ee(1)&&!isNaN(e)},W=function(e){return R(e)&&Math.floor(e)===e},ce=function(e){if(le!=="undefined")return e!=null&&e instanceof HTMLElement},pe=function(e){return Oe(e)||Me(e)},Oe=function(e){return J(e)==="collection"&&e._private.single},Me=function(e){return J(e)==="collection"&&!e._private.single},Ye=function(e){return J(e)==="core"},at=function(e){return J(e)==="stylesheet"},dt=function(e){return J(e)==="event"},ke=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Ve=function(e){return typeof HTMLElement>"u"?!1:e instanceof HTMLElement},Ze=function(e){return L(e)&&R(e.x1)&&R(e.x2)&&R(e.y1)&&R(e.y2)},nt=function(e){return V(e)&&Y(e.then)},ht=function(){return $&&$.userAgent.match(/msie|trident|edge/i)},it=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;sr?1:0},tu=function(e,r){return-1*rs(e,r)},He=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r1&&(p-=1),p<1/6?v+(y-v)*6*p:p<1/2?y:p<2/3?v+(y-v)*(2/3-p)*6:v}var h=new RegExp("^"+ln+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=u=l=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,d=2*i-c;o=Math.round(255*f(d,c,a+1/3)),u=Math.round(255*f(d,c,a)),l=Math.round(255*f(d,c,a-1/3))}r=[o,u,l,s]}return r},nu=function(e){var r,a=new RegExp("^"+dr+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],u=n[1]&&n[2]&&n[3];if(o&&!u)return;var l=a[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;r.push(l)}}return r},iu=function(e){return ou[e.toLowerCase()]},su=function(e){return(te(e)?e:null)||iu(e)||ru(e)||nu(e)||au(e)},ou={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]},as=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i=e||x<0||h&&k>=i}function g(){var A=ii();if(p(A))return m(A);o=setTimeout(g,y(A))}function m(A){return o=void 0,c&&a?d(A):(a=n=void 0,s)}function b(){o!==void 0&&clearTimeout(o),l=0,a=u=n=o=void 0}function E(){return o===void 0?s:m(ii())}function I(){var A=ii(),x=p(A);if(a=arguments,n=this,u=A,x){if(o===void 0)return v(u);if(h)return clearTimeout(o),o=setTimeout(g,e),d(u)}return o===void 0&&(o=setTimeout(g,e)),s}return I.cancel=b,I.flush=E,I}var fn=Hu,si=D?D.performance:null,fs=si&&si.now?function(){return si.now()}:function(){return Date.now()},Xu=function(){if(D){if(D.requestAnimationFrame)return function(t){D.requestAnimationFrame(t)};if(D.mozRequestAnimationFrame)return function(t){D.mozRequestAnimationFrame(t)};if(D.webkitRequestAnimationFrame)return function(t){D.webkitRequestAnimationFrame(t)};if(D.msRequestAnimationFrame)return function(t){D.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(fs())},1e3/60)}}(),hn=function(e){return Xu(e)},gr=fs,Jr=9261,hs=65599,Na=5381,cs=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr,a=r,n;n=e.next(),!n.done;)a=a*hs+n.value|0;return a},Ma=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Jr;return r*hs+e|0},Ia=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Na;return(r<<5)+r+e|0},qu=function(e,r){return e*2097152+r},wr=function(e){return e[0]*2097152+e[1]},cn=function(e,r){return[Ma(e[0],r[0]),Ia(e[1],r[1])]},Wu=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},ui=function(e){e.splice(0,e.length)},tf=function(e,r){for(var a=0;a"u"?"undefined":ee(Set))!==af?Set:nf,dn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!Ye(e)){Tt("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"){Tt("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new jr,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),u=e.zoom();i.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];te(r.classes)?l=r.classes:j(r.classes)&&(l=r.classes.split(/\s+/));for(var f=0,h=l.length;fm?1:0},f=function(g,m,b,E,I){var A;if(b==null&&(b=0),I==null&&(I=a),b<0)throw new Error("lo must be non-negative");for(E==null&&(E=g.length);bF;0<=F?C++:C--)k.push(C);return k}).apply(this).reverse(),x=[],E=0,I=A.length;EG;0<=G?++k:--k)M.push(s(g,b));return M},y=function(g,m,b,E){var I,A,x;for(E==null&&(E=a),I=g[b];b>m;){if(x=b-1>>1,A=g[x],E(I,A)<0){g[b]=A,b=x;continue}break}return g[b]=I},p=function(g,m,b){var E,I,A,x,k;for(b==null&&(b=a),I=g.length,k=m,A=g[m],E=2*m+1;E0;){var A=m.pop(),x=p(A),k=A.id();if(c[k]=x,x!==1/0)for(var C=A.neighborhood().intersect(v),F=0;F0)for(ae.unshift(q);h[be];){var ie=h[be];ae.unshift(ie.edge),ae.unshift(ie.node),ue=ie.node,be=ue.id()}return o.spawn(ae)}}}},uf={kruskal:function(e){e=e||function(b){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,u=function(E){for(var I=0;I0;){if(I(),x++,E===f){for(var k=[],C=i,F=f,G=g[F];k.unshift(C),G!=null&&k.unshift(G),C=p[F],C!=null;)F=C.id(),G=g[F];return{found:!0,distance:h[E],path:this.spawn(k),steps:x}}d[E]=!0;for(var M=b._private.edges,X=0;XG&&(v[F]=G,m[F]=C,b[F]=I),!i){var M=C*f+k;!i&&v[M]>G&&(v[M]=G,m[M]=k,b[M]=I)}}}for(var X=0;X1&&arguments[1]!==void 0?arguments[1]:s,rt=b(Be),je=[],qe=rt;;){if(qe==null)return r.spawn();var et=m(qe),fe=et.edge,O=et.pred;if(je.unshift(qe[0]),qe.same(_e)&&je.length>0)break;fe!=null&&je.unshift(fe),qe=O}return u.spawn(je)},A=0;A=0;f--){var h=l[f],c=h[1],d=h[2];(r[c]===o&&r[d]===u||r[c]===u&&r[d]===o)&&l.splice(f,1)}for(var v=0;vn;){var i=Math.floor(Math.random()*r.length);r=yf(i,e,r),a--}return r},mf={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(ae){return ae.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),u=Math.floor(i/pf);if(i<2){Tt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],f=0;f1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=r;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a0&&e.splice(0,r));for(var o=0,u=e.length-1;u>=0;u--){var l=e[u];s?isFinite(l)||(e[u]=-1/0,o++):e.splice(u,1)}i&&e.sort(function(c,d){return c-d});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},Cf=function(e){return Math.PI*e/180},pn=function(e,r){return Math.atan2(r,e)-Math.PI/2},hi=Math.log2||function(t){return Math.log(t)/Math.log(2)},xs=function(e){return e>0?1:e<0?-1:0},Br=function(e,r){return Math.sqrt(Fr(e,r))},Fr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},Df=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}}},Lf=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Af=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Of=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}},Ts=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},Nf=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},yn=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},mn=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=w(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Cs=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},ci=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2r.y2||r.y1>e.y2)},ra=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},Mf=function(e,r){return ra(e,r.x,r.y)},Ds=function(e,r){return ra(e,r.x1,r.y1)&&ra(e,r.x2,r.y2)},Ss=function(e,r,a,n,i,s,o){var u=Ga(i,s),l=i/2,f=s/2,h;{var c=a-l+u-o,d=n-f-o,v=a+l-u+o,y=d;if(h=Cr(e,r,a,n,c,d,v,y,!1),h.length>0)return h}{var p=a+l+o,g=n-f+u-o,m=p,b=n+f-u+o;if(h=Cr(e,r,a,n,p,g,m,b,!1),h.length>0)return h}{var E=a-l+u-o,I=n+f+o,A=a+l-u+o,x=I;if(h=Cr(e,r,a,n,E,I,A,x,!1),h.length>0)return h}{var k=a-l-o,C=n-f+u-o,F=k,G=n+f-u+o;if(h=Cr(e,r,a,n,k,C,F,G,!1),h.length>0)return h}var M;{var X=a-l+u,B=n-f+u;if(M=Ba(e,r,a,n,X,B,u+o),M.length>0&&M[0]<=X&&M[1]<=B)return[M[0],M[1]]}{var re=a+l-u,K=n-f+u;if(M=Ba(e,r,a,n,re,K,u+o),M.length>0&&M[0]>=re&&M[1]<=K)return[M[0],M[1]]}{var q=a+l-u,ae=n+f-u;if(M=Ba(e,r,a,n,q,ae,u+o),M.length>0&&M[0]>=q&&M[1]>=ae)return[M[0],M[1]]}{var ue=a-l+u,be=n+f-u;if(M=Ba(e,r,a,n,ue,be,u+o),M.length>0&&M[0]<=ue&&M[1]>=be)return[M[0],M[1]]}return[]},If=function(e,r,a,n,i,s,o){var u=o,l=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return l-u<=e&&e<=f+u&&h-u<=r&&r<=c+u},Rf=function(e,r,a,n,i,s,o,u,l){var f={x1:Math.min(a,o,i)-l,x2:Math.max(a,o,i)+l,y1:Math.min(n,u,s)-l,y2:Math.max(n,u,s)+l};return!(ef.x2||rf.y2)},kf=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,u=(-r+s)/o,l=(-r-s)/o;return[u,l]},Pf=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,u,l,f,h,c,d,v;if(u=(3*a-r*r)/9,l=-(27*n)+r*(9*a-2*(r*r)),l/=54,o=u*u*u+l*l,i[1]=0,d=r/3,o>0){h=l+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=l-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+h+c,d+=(h+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+h)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,o===0){v=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),i[0]=-d+2*v,i[4]=i[2]=-(v+d);return}u=-u,f=u*u*u,f=Math.acos(l/Math.sqrt(f)),v=2*Math.sqrt(u),i[0]=-d+v*Math.cos(f/3),i[2]=-d+v*Math.cos((f+2*Math.PI)/3),i[4]=-d+v*Math.cos((f+4*Math.PI)/3)},Bf=function(e,r,a,n,i,s,o,u){var l=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*u+4*s*s-4*s*u+u*u,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*u-6*s*s+3*s*u,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*u-n*r+2*s*s+2*s*r-u*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,d=[];Pf(l,f,h,c,d);for(var v=1e-7,y=[],p=0;p<6;p+=2)Math.abs(d[p+1])=0&&d[p]<=1&&y.push(d[p]);y.push(1),y.push(0);for(var g=-1,m,b,E,I=0;I=0?El?(e-i)*(e-i)+(r-s)*(r-s):f-c},Ht=function(e,r,a){for(var n,i,s,o,u,l=0,f=0;f=e&&e>=s||n<=e&&e<=s)u=(e-n)/(s-n)*(o-i)+i,u>r&&l++;else continue;return l%2!==0},pr=function(e,r,a,n,i,s,o,u,l){var f=new Array(a.length),h;u[0]!=null?(h=Math.atan(u[1]/u[0]),u[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=u;for(var c=Math.cos(-h),d=Math.sin(-h),v=0;v0){var p=En(f,-l);y=bn(p)}else y=f;return Ht(e,r,y)},Gf=function(e,r,a,n,i,s,o){for(var u=new Array(a.length),l=s/2,f=o/2,h=gi(s,o),c=h*h,d=0;d=0&&p<=1&&m.push(p),g>=0&&g<=1&&m.push(g),m.length===0)return[];var b=m[0]*u[0]+e,E=m[0]*u[1]+r;if(m.length>1){if(m[0]==m[1])return[b,E];var I=m[1]*u[0]+e,A=m[1]*u[1]+r;return[b,E,I,A]}else return[b,E]},vi=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Cr=function(e,r,a,n,i,s,o,u,l){var f=e-i,h=a-e,c=o-i,d=r-s,v=n-r,y=u-s,p=c*d-y*f,g=h*d-v*f,m=y*h-c*v;if(m!==0){var b=p/m,E=g/m,I=.001,A=0-I,x=1+I;return A<=b&&b<=x&&A<=E&&E<=x?[e+b*h,r+b*v]:l?[e+b*h,r+b*v]:[]}else return p===0||g===0?vi(e,a,o)===o?[o,u]:vi(e,a,i)===i?[i,s]:vi(i,o,a)===a?[a,n]:[]:[]},Fa=function(e,r,a,n,i,s,o,u){var l=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var d;if(c){for(var v=0;v0){var y=En(h,-u);d=bn(y)}else d=h}else d=a;for(var p,g,m,b,E=0;E2){for(var K=[l[0],l[1]],q=Math.pow(K[0]-e,2)+Math.pow(K[1]-r,2),ae=1;aef&&(f=E)},get:function(b){return l[b]}},c=0;c0?K=re.edgesTo(B)[0]:K=B.edgesTo(re)[0];var q=n(K);B=B.id(),k[B]>k[M]+q&&(k[B]=k[M]+q,C.nodes.indexOf(B)<0?C.push(B):C.updateItem(B),x[B]=0,A[B]=[]),k[B]==k[M]+q&&(x[B]=x[B]+x[M],A[B].push(M))}else for(var ae=0;ae0;){for(var ge=I.pop(),we=0;we0&&o.push(a[u]);o.length!==0&&i.push(n.collection(o))}return i},eh=function(e,r){for(var a=0;a5&&arguments[5]!==void 0?arguments[5]:ah,o=n,u,l,f=0;f=2?za(e,r,a,0,Ps,nh):za(e,r,a,0,ks)},squaredEuclidean:function(e,r,a){return za(e,r,a,0,Ps)},manhattan:function(e,r,a){return za(e,r,a,0,ks)},max:function(e,r,a){return za(e,r,a,-1/0,ih)}};ia["squared-euclidean"]=ia.squaredEuclidean,ia.squaredeuclidean=ia.squaredEuclidean;function xn(t,e,r,a,n,i){var s;return Y(t)?s=t:s=ia[t]||ia.euclidean,e===0&&Y(t)?s(n,i):s(e,r,a,n,i)}var sh=At({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),mi=function(e){return sh(e)},Tn=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},u=function(c){return n[c](r)},l=a,f=r;return xn(e,n.length,o,u,l,f)},bi=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),u=null,l=0;la)return!1}return!0},uh=function(e,r,a){for(var n=0;no&&(o=r[l][f],u=f);i[u].push(e[l])}for(var h=0;h=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var v=r[s],y=r[n[s]],p;i.mode==="dendrogram"?p={left:v,right:y,key:v.key}:p={value:v.value.concat(y.value),key:v.key},e[v.index]=p,e.splice(y.index,1),r[v.key]=p;for(var g=0;ga[y.key][m.key]&&(u=a[y.key][m.key])):i.linkage==="max"?(u=a[v.key][m.key],a[v.key][m.key]0&&n.push(i);return n},Us=function(e,r,a){for(var n=[],i=0;io&&(s=l,o=r[i*e+l])}s>0&&n.push(s)}for(var f=0;fl&&(u=f,l=h)}a[i]=s[u]}return n=Us(e,r,a),n},Ys=function(e){for(var r=this.cy(),a=this.nodes(),n=Th(e),i={},s=0;s=G?(M=G,G=B,X=re):B>M&&(M=B);for(var K=0;K0?1:0;x[C%n.minIterations*o+ge]=we,ie+=we}if(ie>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var De=0,xe=0;xe1||A>1)&&(o=!0),h[b]=[],m.outgoers().forEach(function(k){k.isEdge()&&h[b].push(k.id())})}else c[b]=[void 0,m.target().id()]}):s.forEach(function(m){var b=m.id();if(m.isNode()){var E=m.degree(!0);E%2&&(u?l?o=!0:l=b:u=b),h[b]=[],m.connectedEdges().forEach(function(I){return h[b].push(I.id())})}else c[b]=[m.source().id(),m.target().id()]});var d={found:!1,trail:void 0};if(o)return d;if(l&&u)if(i){if(f&&l!=f)return d;f=l}else{if(f&&l!=f&&u!=f)return d;f||(f=l)}else f||(f=s[0].id());var v=function(b){for(var E=b,I=[b],A,x,k;h[E].length;)A=h[E].shift(),x=c[A][0],k=c[A][1],E!=k?(h[k]=h[k].filter(function(C){return C!=A}),E=k):!i&&E!=x&&(h[x]=h[x].filter(function(C){return C!=A}),E=x),I.unshift(A),I.unshift(E);return I},y=[],p=[];for(p=v(f);p.length!=1;)h[p[0]].length==0?(y.unshift(s.getElementById(p.shift())),y.unshift(s.getElementById(p.shift()))):p=v(p.shift()).concat(p);y.unshift(s.getElementById(p.shift()));for(var g in h)if(h[g].length)return d;return d.found=!0,d.trail=this.spawn(y,!0),d}},Dn=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},u=function(c,d){for(var v=s.length-1,y=[],p=e.spawn();s[v].x!=c||s[v].y!=d;)y.push(s.pop().edge),v--;y.push(s.pop().edge),y.forEach(function(g){var m=g.connectedNodes().intersection(e);p.merge(g),m.forEach(function(b){var E=b.id(),I=b.connectedEdges().intersection(e);p.merge(b),r[E].cutVertex?p.merge(I.filter(function(A){return A.isLoop()})):p.merge(I)})}),i.push(p)},l=function h(c,d,v){c===v&&(n+=1),r[d]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(d).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(d)));else{var p,g,m,b;y.forEach(function(E){p=E.source().id(),g=E.target().id(),m=p===d?g:p,m!==v&&(b=E.id(),o[b]||(o[b]=!0,s.push({x:d,y:m,edge:E})),m in r?r[d].low=Math.min(r[d].low,r[m].id):(h(c,m,d),r[d].low=Math.min(r[d].low,r[m].low),r[d].id<=r[m].low&&(r[d].cutVertex=!0,u(d,m))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,l(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},Mh={hopcroftTarjanBiconnected:Dn,htbc:Dn,htb:Dn,hopcroftTarjanBiconnectedComponents:Dn},Sn=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function u(l){i.push(l),r[l]={index:a,low:a++,explored:!1};var f=e.getElementById(l).connectedEdges().intersection(e);if(f.forEach(function(y){var p=y.target().id();p!==l&&(p in r||u(p),r[p].explored||(r[l].low=Math.min(r[l].low,r[p].low)))}),r[l].index===r[l].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[l].index,r[c].explored=!0,c===l)break}var d=h.edgesWith(h),v=h.merge(d);n.push(v),s=s.difference(v)}};return e.forEach(function(u){if(u.isNode()){var l=u.id();l in r||o(l)}}),{cut:s,components:n}},Ih={tarjanStronglyConnected:Sn,tsc:Sn,tscc:Sn,tarjanStronglyConnectedComponents:Sn},Hs={};[Ra,lf,uf,hf,vf,gf,mf,Uf,aa,na,yi,rh,gh,wh,Ah,Nh,Mh,Ih].forEach(function(t){He(Hs,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 Xs=0,qs=1,Ws=2,yr=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=Xs,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))};yr.prototype={fulfill:function(e){return Ks(this,qs,"fulfillValue",e)},reject:function(e){return Ks(this,Ws,"rejectReason",e)},then:function(e,r){var a=this,n=new yr;return a.onFulfilled.push(Js(e,n,"fulfill")),a.onRejected.push(Js(r,n,"reject")),Zs(a),n.proxy}};var Ks=function(e,r,a,n){return e.state===Xs&&(e.state=r,e[a]=n,Zs(e)),e},Zs=function(e){e.state===qs?Qs(e,"onFulfilled",e.fulfillValue):e.state===Ws&&Qs(e,"onRejected",e.rejectReason)},Qs=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s-1}var zc=Gc;function Vc(t,e){var r=this.__data__,a=An(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var $c=Vc;function la(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){te(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};Nn.className=Nn.classNames=Nn.classes;var st={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:gt,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};st.variable="(?:[\\w-.]|(?:\\\\"+st.metaChar+"))+",st.className="(?:[\\w-]|(?:\\\\"+st.metaChar+"))+",st.value=st.string+"|"+st.number,st.id=st.variable,function(){var t,e,r;for(t=st.comparatorOp.split("|"),r=0;r=0)&&e!=="="&&(st.comparatorOp+="|\\!"+e)}();var pt=function(){return{checks:[]}},Pe={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},Di=[{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 tu(t.selector,e.selector)}),Hv=function(){for(var t={},e,r=0;r0&&f.edgeCount>0)return ct("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return ct("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&ct("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},Qv=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f??""},r=function(f){return j(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,d=f.value;switch(c){case Pe.GROUP:{var v=e(d);return v.substring(0,v.length-1)}case Pe.DATA_COMPARE:{var y=f.field,p=f.operator;return"["+y+a(e(p))+r(d)+"]"}case Pe.DATA_BOOL:{var g=f.operator,m=f.field;return"["+e(g)+m+"]"}case Pe.DATA_EXIST:{var b=f.field;return"["+b+"]"}case Pe.META_COMPARE:{var E=f.operator,I=f.field;return"[["+I+a(e(E))+r(d)+"]]"}case Pe.STATE:return d;case Pe.ID:return"#"+d;case Pe.CLASS:return"."+d;case Pe.PARENT:case Pe.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case Pe.ANCESTOR:case Pe.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case Pe.COMPOUND_SPLIT:{var A=i(f.left,h),x=i(f.subject,h),k=i(f.right,h);return A+(A.length>0?" ":"")+x+k}case Pe.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,d,v){return c+(h===f&&v===0?"$":"")+n(d,h)},"")},s="",o=0;o1&&o=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(u=!i&&!s?"":""+e,l=""+a),f&&(e=u=u.toLowerCase(),a=l=l.toLowerCase()),r){case"*=":n=u.indexOf(l)>=0;break;case"$=":n=u.indexOf(l,u.length-l.length)>=0;break;case"^=":n=u.indexOf(l)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function co(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n1&&arguments[1]!==void 0?arguments[1]:!0;return Ai(this,t,e,co)};function vo(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}ha.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ai(this,t,e,vo)};function id(t,e,r){vo(t,e,r),co(t,e,r)}ha.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Ai(this,t,e,id)},ha.ancestors=ha.parents;var $a,go;$a=go={data:vt.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:vt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:vt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:vt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:vt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:vt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}},$a.attr=$a.data,$a.removeAttr=$a.removeData;var sd=go,Mn={};function Oi(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,s=0;se}),minIndegree:ca("indegree",function(t,e){return te}),minOutdegree:ca("outdegree",function(t,e){return te})}),He(Mn,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n0,c=h;h&&(f=f[0]);var d=c?f.position():{x:0,y:0};r!==void 0?l.position(e,r+d[e]):i!==void 0&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var v=a.position(),y=o?a.parent():null,p=y&&y.length>0,g=p;p&&(y=y[0]);var m=g?y.position():{x:0,y:0};return i={x:v.x-m.x,y:v.y-m.y},e===void 0?i:i[e]}else if(!s)return;return this}},rr.modelPosition=rr.point=rr.position,rr.modelPositions=rr.points=rr.positions,rr.renderedPoint=rr.renderedPosition,rr.relativePoint=rr.relativePosition;var od=po,va,Or;va=Or={},Or.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,u=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:u,w:s-i,h:u-o}},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(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function d(C,F,G){var M=0,X=0,B=F+G;return C>0&&B>0&&(M=F/B*C,X=G/B*C),{biasDiff:M,biasComplementDiff:X}}function v(C,F,G,M){if(G.units==="%")switch(M){case"width":return C>0?G.pfValue*C:0;case"height":return F>0?G.pfValue*F:0;case"average":return C>0&&F>0?G.pfValue*(C+F)/2:0;case"min":return C>0&&F>0?C>F?G.pfValue*F:G.pfValue*C:0;case"max":return C>0&&F>0?C>F?G.pfValue*C:G.pfValue*F:0;default:return 0}else return G.units==="px"?G.pfValue:0}var y=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var p=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var g=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(g=g*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var b=d(f.width.val-h.w,y,p),E=b.biasDiff,I=b.biasComplementDiff,A=d(f.height.val-h.h,g,m),x=A.biasDiff,k=A.biasComplementDiff;o.autoPadding=v(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-E+h.x1+h.x2+I)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-x+h.y1+h.y2+k)/2}for(var a=0;ae.x2?n:e.x2,e.y1=ae.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},Vr=function(e,r){return r==null?e:ar(e,r.x1,r.y1,r.x2,r.y2)},_a=function(e,r,a){return tr(e,r,a)},In=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,u,l;if(o!=="none"){a==="source"?(u=i.srcX,l=i.srcY):a==="target"?(u=i.tgtX,l=i.tgtY):(u=i.midX,l=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=u-s,h.y1=l-s,h.x2=u+s,h.y2=l+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,yn(h,1),ar(e,h.x1,h.y1,h.x2,h.y2)}}},Ni=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var u=r.pstyle("text-halign"),l=r.pstyle("text-valign"),f=_a(s,"labelWidth",a),h=_a(s,"labelHeight",a),c=_a(s,"labelX",a),d=_a(s,"labelY",a),v=r.pstyle(n+"text-margin-x").pfValue,y=r.pstyle(n+"text-margin-y").pfValue,p=r.isEdge(),g=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,b=r.pstyle("text-border-width").pfValue,E=b/2,I=r.pstyle("text-background-padding").pfValue,A=2,x=h,k=f,C=k/2,F=x/2,G,M,X,B;if(p)G=c-C,M=c+C,X=d-F,B=d+F;else{switch(u.value){case"left":G=c-k,M=c;break;case"center":G=c-C,M=c+C;break;case"right":G=c,M=c+k;break}switch(l.value){case"top":X=d-x,B=d;break;case"center":X=d-F,B=d+F;break;case"bottom":X=d,B=d+x;break}}G+=v-Math.max(m,E)-I-A,M+=v+Math.max(m,E)+I+A,X+=y-Math.max(m,E)-I-A,B+=y+Math.max(m,E)+I+A;var re=a||"main",K=i.labelBounds,q=K[re]=K[re]||{};q.x1=G,q.y1=X,q.x2=M,q.y2=B,q.w=M-G,q.h=B-X;var ae=p&&g.strValue==="autorotate",ue=g.pfValue!=null&&g.pfValue!==0;if(ae||ue){var be=ae?_a(i.rstyle,"labelAngle",a):g.pfValue,ie=Math.cos(be),ge=Math.sin(be),we=(G+M)/2,De=(X+B)/2;if(!p){switch(u.value){case"left":we=M;break;case"right":we=G;break}switch(l.value){case"top":De=B;break;case"bottom":De=X;break}}var xe=function(Xe,Ie){return Xe=Xe-we,Ie=Ie-De,{x:Xe*ie-Ie*ge+we,y:Xe*ge+Ie*ie+De}},Se=xe(G,X),se=xe(G,B),Te=xe(M,X),Ae=xe(M,B);G=Math.min(Se.x,se.x,Te.x,Ae.x),M=Math.max(Se.x,se.x,Te.x,Ae.x),X=Math.min(Se.y,se.y,Te.y,Ae.y),B=Math.max(Se.y,se.y,Te.y,Ae.y)}var Le=re+"Rot",Ne=K[Le]=K[Le]||{};Ne.x1=G,Ne.y1=X,Ne.x2=M,Ne.y2=B,Ne.w=M-G,Ne.h=B-X,ar(e,G,X,M,B),ar(i.labelBounds.all,G,X,M,B)}return e}},ld=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value;if(a>0&&n>0){var i=r.pstyle("outline-offset").value,s=r.pstyle("shape").value,o=n+i,u=(e.w+o*2)/e.w,l=(e.h+o*2)/e.h,f=0,h=0;["diamond","pentagon","round-triangle"].includes(s)?(u=(e.w+o*2.4)/e.w,h=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?u=(e.w+o*2.4)/e.w:s==="star"?(u=(e.w+o*2.8)/e.w,l=(e.h+o*2.6)/e.h,h=-o/3.8):s==="triangle"?(u=(e.w+o*2.8)/e.w,l=(e.h+o*2.4)/e.h,h=-o/1.4):s==="vee"&&(u=(e.w+o*4.4)/e.w,l=(e.h+o*3.8)/e.h,h=-o*.5);var c=e.h*l-e.h,d=e.w*u-e.w;if(mn(e,[Math.ceil(c/2),Math.ceil(d/2)]),f!=0||h!==0){var v=Of(e,f,h);Ts(e,v)}}}},ud=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=Yt(),o=e._private,u=e.isNode(),l=e.isEdge(),f,h,c,d,v,y,p=o.rstyle,g=u&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function($e){return $e.pstyle("display").value!=="none"},b=!n||m(e)&&(!l||m(e.source())&&m(e.target()));if(b){var E=0,I=0;n&&r.includeOverlays&&(E=e.pstyle("overlay-opacity").value,E!==0&&(I=e.pstyle("overlay-padding").value));var A=0,x=0;n&&r.includeUnderlays&&(A=e.pstyle("underlay-opacity").value,A!==0&&(x=e.pstyle("underlay-padding").value));var k=Math.max(I,x),C=0,F=0;if(n&&(C=e.pstyle("width").pfValue,F=C/2),u&&r.includeNodes){var G=e.position();v=G.x,y=G.y;var M=e.outerWidth(),X=M/2,B=e.outerHeight(),re=B/2;f=v-X,h=v+X,c=y-re,d=y+re,ar(s,f,c,h,d),n&&r.includeOutlines&&ld(s,e)}else if(l&&r.includeEdges)if(n&&!i){var K=e.pstyle("curve-style").strValue;if(f=Math.min(p.srcX,p.midX,p.tgtX),h=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),d=Math.max(p.srcY,p.midY,p.tgtY),f-=F,h+=F,c-=F,d+=F,ar(s,f,c,h,d),K==="haystack"){var q=p.haystackPts;if(q&&q.length===2){if(f=q[0].x,c=q[0].y,h=q[1].x,d=q[1].y,f>h){var ae=f;f=h,h=ae}if(c>d){var ue=c;c=d,d=ue}ar(s,f-F,c-F,h+F,d+F)}}else if(K==="bezier"||K==="unbundled-bezier"||K==="segments"||K==="taxi"){var be;switch(K){case"bezier":case"unbundled-bezier":be=p.bezierPts;break;case"segments":case"taxi":be=p.linePts;break}if(be!=null)for(var ie=0;ieh){var se=f;f=h,h=se}if(c>d){var Te=c;c=d,d=Te}f-=F,h+=F,c-=F,d+=F,ar(s,f,c,h,d)}if(n&&r.includeEdges&&l&&(In(s,e,"mid-source"),In(s,e,"mid-target"),In(s,e,"source"),In(s,e,"target")),n){var Ae=e.pstyle("ghost").value==="yes";if(Ae){var Le=e.pstyle("ghost-offset-x").pfValue,Ne=e.pstyle("ghost-offset-y").pfValue;ar(s,s.x1+Le,s.y1+Ne,s.x2+Le,s.y2+Ne)}}var Fe=o.bodyBounds=o.bodyBounds||{};Cs(Fe,s),mn(Fe,g),yn(Fe,1),n&&(f=s.x1,h=s.x2,c=s.y1,d=s.y2,ar(s,f-k,c-k,h+k,d+k));var Xe=o.overlayBounds=o.overlayBounds||{};Cs(Xe,s),mn(Xe,g),yn(Xe,1);var Ie=o.labelBounds=o.labelBounds||{};Ie.all!=null?Af(Ie.all):Ie.all=Yt(),n&&r.includeLabels&&(r.includeMainLabels&&Ni(s,e,null),l&&(r.includeSourceLabels&&Ni(s,e,"source"),r.includeTargetLabels&&Ni(s,e,"target")))}return s.x1=Qt(s.x1),s.y1=Qt(s.y1),s.x2=Qt(s.x2),s.y2=Qt(s.y2),s.w=Qt(s.x2-s.x1),s.h=Qt(s.y2-s.y1),s.w>0&&s.h>0&&b&&(mn(s,g),yn(s,1)),s},bo=function(e){var r=0,a=function(s){return(s?1:0)<0&&arguments[0]!==void 0?arguments[0]:Cd,e=arguments.length>1?arguments[1]:void 0,r=0;r=0;o--)s(o);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++,te(e)||(e=[e]),Dd(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===Td)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&tf(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(y){return y!==h}));var d=i.callbackContext(i.context,h,s),v=h.callback.apply(d,c);i.afterEmit(i.context,h,s),v===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[e]=u,i.set(l,{ele:u,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&j(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,i=0;ia&&(a=u,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s=0&&i"u"?"undefined":ee(Symbol))!=e&&ee(Symbol.iterator)!=e;r&&(Bn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return T({next:function(){return i1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i??(r?n.style().getDefaultProperty(e):null)}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(L(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(j(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var u=this[0];return u?i.getRawStyle(u):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var s=0;s0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Bt.neighbourhood=Bt.neighborhood,Bt.closedNeighbourhood=Bt.closedNeighborhood,Bt.openNeighbourhood=Bt.openNeighborhood,He(Bt,{source:Zt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:Zt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Vo({attr:"source"}),targets:Vo({attr:"target"})});function Vo(t){return function(r){for(var a=[],n=0;n0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Bt.componentsOf=Bt.components;var Nt=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){Tt("A collection must have a reference to the core");return}var i=new ur,s=!1;if(!r)r=[];else if(r.length>0&&L(r[0])&&!Oe(r[0])){s=!0;for(var o=[],u=new jr,l=0,f=r.length;l0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],s=[],o,u=0,l=r.length;u0){for(var ue=o.length===r.length?r:new Nt(a,o),be=0;be0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function s(B){for(var re=B._private.edges,K=0;K0&&(t?G.emitAndNotify("remove"):e&&G.emit("remove"));for(var M=0;M0?M=B:G=B;while(Math.abs(X)>s&&++re=i?m(F,re):K===0?re:E(F,G,G+l)}var A=!1;function x(){A=!0,(t!==e||r!==a)&&b()}var k=function(G){return A||x(),t===e&&r===a?G:G===0?0:G===1?1:p(I(G),e,a)};k.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var C="generateBezier("+[t,e,r,a]+")";return k.toString=function(){return C},k}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Bd=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),u=e(a,n,o),l=1/6*(i.dx+2*(s.dx+o.dx)+u.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+u.dv);return a.x=a.x+l*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,f=1/1e4,h=16/1e3,c,d,v;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(l=a(n,i),d=l/s*h):d=h;v=r(v||o,d),u.push(1+v.x),l+=16,Math.abs(v.x)>f&&Math.abs(v.v)>f;);return c?function(y){return u[y*(u.length-1)|0]}:l}}(),Et=function(e,r,a,n){var i=Pd(e,r,a,n);return function(s,o,u){return s+(o-s)*i(u)}},Vn={linear:function(e,r,a){return e+(r-e)*a},ease:Et(.25,.1,.25,1),"ease-in":Et(.42,0,1,1),"ease-out":Et(0,0,.58,1),"ease-in-out":Et(.42,0,.58,1),"ease-in-sine":Et(.47,0,.745,.715),"ease-out-sine":Et(.39,.575,.565,1),"ease-in-out-sine":Et(.445,.05,.55,.95),"ease-in-quad":Et(.55,.085,.68,.53),"ease-out-quad":Et(.25,.46,.45,.94),"ease-in-out-quad":Et(.455,.03,.515,.955),"ease-in-cubic":Et(.55,.055,.675,.19),"ease-out-cubic":Et(.215,.61,.355,1),"ease-in-out-cubic":Et(.645,.045,.355,1),"ease-in-quart":Et(.895,.03,.685,.22),"ease-out-quart":Et(.165,.84,.44,1),"ease-in-out-quart":Et(.77,0,.175,1),"ease-in-quint":Et(.755,.05,.855,.06),"ease-out-quint":Et(.23,1,.32,1),"ease-in-out-quint":Et(.86,0,.07,1),"ease-in-expo":Et(.95,.05,.795,.035),"ease-out-expo":Et(.19,1,.22,1),"ease-in-out-expo":Et(1,0,0,1),"ease-in-circ":Et(.6,.04,.98,.335),"ease-out-circ":Et(.075,.82,.165,1),"ease-in-out-circ":Et(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return Vn.linear;var n=Bd(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":Et};function Uo(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Yo(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function pa(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=Yo(t,n),o=Yo(e,n);if(R(s)&&R(o))return Uo(i,s,o,r,a);if(te(s)&&te(o)){for(var u=[],l=0;l0?(d==="spring"&&v.push(s.duration),s.easingImpl=Vn[d].apply(null,v)):s.easingImpl=Vn[d]}var y=s.easingImpl,p;if(s.duration===0?p=1:p=(r-u)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),s.delay==null){var g=s.startPosition,m=s.position;if(m&&n&&!t.locked()){var b={};qa(g.x,m.x)&&(b.x=pa(g.x,m.x,p,y)),qa(g.y,m.y)&&(b.y=pa(g.y,m.y,p,y)),t.position(b)}var E=s.startPan,I=s.pan,A=i.pan,x=I!=null&&a;x&&(qa(E.x,I.x)&&(A.x=pa(E.x,I.x,p,y)),qa(E.y,I.y)&&(A.y=pa(E.y,I.y,p,y)),t.emit("pan"));var k=s.startZoom,C=s.zoom,F=C!=null&&a;F&&(qa(k,C)&&(i.zoom=Pa(i.minZoom,pa(k,C,p,y),i.maxZoom)),t.emit("zoom")),(x||F)&&t.emit("viewport");var G=s.style;if(G&&G.length>0&&n){for(var M=0;M=0;x--){var k=A[x];k()}A.splice(0,A.length)},m=d.length-1;m>=0;m--){var b=d[m],E=b._private;if(E.stopped){d.splice(m,1),E.hooked=!1,E.playing=!1,E.started=!1,g(E.frames);continue}!E.playing&&!E.applying||(E.playing&&E.applying&&(E.applying=!1),E.started||Gd(f,b,t),Fd(f,b,t,h),E.applying&&(E.applying=!1),g(E.frames),E.step!=null&&E.step(t),b.completed()&&(d.splice(m,1),E.hooked=!1,E.playing=!1,E.started=!1,g(E.completes)),y=!0)}return!h&&d.length===0&&v.length===0&&a.push(f),y}for(var i=!1,s=0;s0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var zd={animate:vt.animate(),animation:vt.animation(),animated:vt.animated(),clearQueue:vt.clearQueue(),delay:vt.delay(),delayAnimation:vt.delayAnimation(),stop:vt.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&&hn(function(i){Ho(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Ho(s,e)},a.beforeRenderPriorities.animations):r()}},Vd={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&&Oe(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}},$n=function(e){return j(e)?new Sr(e):e},Xo={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new kn(Vd,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,$n(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,$n(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,$n(r),a),this},once:function(e,r,a){return this.emitter().one(e,$n(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}};vt.eventAliasesOn(Xo);var Ri={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)}};Ri.jpeg=Ri.jpg;var _n={layout:function(e){var r=this;if(e==null){Tt("Layout options must be specified to make a layout");return}if(e.name==null){Tt("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){Tt("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;j(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n(He({},e,{cy:r,eles:i}));return s}};_n.createLayout=_n.makeLayout=_n.layout;var $d={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;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)}};ki.invalidateDimensions=ki.resize;var Un={collection:function(e,r){return j(e)?this.$(e):pe(e)?e.collection():te(e)?(r||(r={}),new Nt(this,e,r.unique,r.removed)):new Nt(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}};Un.elements=Un.filter=Un.$;var Ft={},Wa="t",Ud="f";Ft.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i0;if(c||h&&d){var v=void 0;c&&d||c?v=l.properties:d&&(v=l.mappedProperties);for(var y=0;y1&&(E=1),o.color){var A=a.valueMin[0],x=a.valueMax[0],k=a.valueMin[1],C=a.valueMax[1],F=a.valueMin[2],G=a.valueMax[2],M=a.valueMin[3]==null?1:a.valueMin[3],X=a.valueMax[3]==null?1:a.valueMax[3],B=[Math.round(A+(x-A)*E),Math.round(k+(C-k)*E),Math.round(F+(G-F)*E),Math.round(M+(X-M)*E)];i={bypass:a.bypass,name:a.name,value:B,strValue:"rgb("+B[0]+", "+B[1]+", "+B[2]+")"}}else if(o.number){var re=a.valueMin+(a.valueMax-a.valueMin)*E;i=this.parse(a.name,re,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case s.data:{for(var K=a.field.split("."),q=h.data,ae=0;ae0&&i>0){for(var o={},u=!1,l=0;l0?t.delayAnimation(s).play().promise().then(b):b()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)},Ft.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)},Ft.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})},Ft.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||a==="bezier")&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||a==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})},Ft.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Ka={};Ka.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;on.length?a=a.substr(n.length):a=""}function u(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var l=a.match(/^\s*$/);if(l)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){ct("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new Sr(h);if(c.invalid){ct("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var d=f[2],v=!1;i=d;for(var y=[];;){var p=i.match(/^\s*$/);if(p)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){ct("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+d),v=!0;break}s=g[0];var m=g[1],b=g[2],E=e.properties[m];if(!E){ct("Skipping property: Invalid property name in: "+s),u();continue}var I=r.parse(m,b);if(!I){ct("Skipping property: Invalid property definition in: "+s),u();continue}y.push({name:m,val:b}),u()}if(v){o();break}r.selector(h);for(var A=0;A=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var c=o.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(r||l.multiple)return!1;var d=o.mapData;if(!(l.color||l.number))return!1;var v=this.parse(t,h[4]);if(!v||v.mapped)return!1;var y=this.parse(t,h[5]);if(!y||y.mapped)return!1;if(v.pfValue===y.pfValue||v.strValue===y.strValue)return ct("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+v.strValue+"`"),this.parse(t,v.strValue);if(l.color){var p=v.value,g=y.value,m=p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(p[3]==null||p[3]===1)&&(g[3]==null||g[3]===1));if(m)return!1}return{name:t,value:h,strValue:""+e,mapped:d,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:v.value,valueMax:y.value,bypass:r}}}if(l.multiple&&a!=="multiple"){var b;if(u?b=e.split(/\s+/):te(e)?b=e:b=[e],l.evenMultiple&&b.length%2!==0)return null;for(var E=[],I=[],A=[],x="",k=!1,C=0;C0?" ":"")+F.strValue}return l.validate&&!l.validate(E,I)?null:l.singleEnum&&k?E.length===1&&j(E[0])?{name:t,value:E[0],strValue:E[0],bypass:r}:null:{name:t,value:E,pfValue:A,strValue:x,bypass:r,units:I}}var G=function(){for(var Ae=0;Ael.max||l.strictMax&&e===l.max))return null;var K={name:t,value:e,strValue:""+e+(M||""),units:M,bypass:r};return l.unitless||M!=="px"&&M!=="em"?K.pfValue=e:K.pfValue=M==="px"||!M?e:this.getEmSizeInPixels()*e,(M==="ms"||M==="s")&&(K.pfValue=M==="ms"?e:1e3*e),(M==="deg"||M==="rad")&&(K.pfValue=M==="rad"?e:Cf(e)),M==="%"&&(K.pfValue=e/100),K}else if(l.propList){var q=[],ae=""+e;if(ae!=="none"){for(var ue=ae.split(/\s*,\s*|\s+/),be=0;be0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){u=Math.min((s-2*r)/a.w,(o-2*r)/a.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,s,o=!1;if(r.zoomingEnabled||(o=!0),R(e)?s=e:L(e)&&(s=e.level,e.position!=null?i=gn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=sr.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=u,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var l=e.pan;R(l.x)&&(r.pan.x=l.x,o=!1),R(l.y)&&(r.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(j(e)){var a=e;e=this.mutableElements().filter(a)}else pe(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};$r.centre=$r.center,$r.autolockNodes=$r.autolock,$r.autoungrabifyNodes=$r.autoungrabify;var Za={data:vt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:vt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:vt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:vt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};Za.attr=Za.data,Za.removeAttr=Za.removeData;var Qa=function(e){var r=this;e=He({},e);var a=e.container;a&&!ce(a)&&ce(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var s=D!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=He({name:s?"grid":"null"},o.layout),o.renderer=He({name:s?"canvas":"null"},o.renderer);var u=function(v,y,p){return y!==void 0?y:p!==void 0?p:v},l=this._private={container:a,ready:!1,options:o,elements:new Nt(this),listeners:[],aniEles:new Nt(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:R(o.zoom)?o.zoom:1,pan:{x:L(o.pan)&&R(o.pan.x)?o.pan.x:0,y:L(o.pan)&&R(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(v,y){var p=v.some(nt);if(p)return sa.all(v).then(y);y(v)};l.styleEnabled&&r.setStyle([]);var h=He({},o,o.renderer);r.initRenderer(h);var c=function(v,y,p){r.notifications(!1);var g=r.mutableElements();g.length>0&&g.remove(),v!=null&&(L(v)||te(v))&&r.add(v),r.one("layoutready",function(b){r.notifications(!0),r.emit(b),r.one("load",y),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",p),r.emit("done")});var m=He({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([o.style,o.elements],function(d){var v=d[0],y=d[1];l.styleEnabled&&r.style().append(v),c(y,function(){r.startAnimationLoop(),l.ready=!0,Y(o.ready)&&r.on("ready",o.ready);for(var p=0;p0,u=Yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),l;if(pe(e.roots))l=e.roots;else if(te(e.roots)){for(var f=[],h=0;h0;){var re=B(),K=F(re,M);if(K)re.outgoers().filter(function(Ie){return Ie.isNode()&&a.has(Ie)}).forEach(X);else if(K===null){ct("Detected double maximal shift for node `"+re.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var q=0;if(e.avoidOverlap)for(var ae=0;ae0&&g[0].length<=3?qe/2:0),O=2*Math.PI/g[ze].length*Be;return ze===0&&g[0].length===1&&(fe=1),{x:Ne.x+fe*Math.cos(O),y:Ne.y+fe*Math.sin(O)}}else{var et={x:Ne.x+(Be+1-(_e+1)/2)*rt,y:(ze+1)*je};return et}};return a.nodes().layoutPositions(this,e,Xe),this};var Wd={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 Ko(t){this.options=He({},Wd,t)}Ko.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=Yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,l=u/Math.max(1,i.length-1),f,h=0,c=0;c1&&e.avoidOverlap){h*=1.75;var g=Math.cos(l)-Math.cos(0),m=Math.sin(l)-Math.sin(0),b=Math.sqrt(h*h/(g*g+m*m));f=Math.max(b,f)}var E=function(A,x){var k=e.startAngle+x*l*(n?1:-1),C=f*Math.cos(k),F=f*Math.sin(k),G={x:o.x+C,y:o.y+F};return G};return a.nodes().layoutPositions(this,e,E),this};var Kd={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 Zo(t){this.options=He({},Kd,t)}Zo.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),s=Yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,f=0;f0){var I=Math.abs(m[0].value-E.value);I>=p&&(m=[],g.push(m))}m.push(E)}var A=l+e.minNodeSpacing;if(!e.avoidOverlap){var x=g.length>0&&g[0].length>1,k=Math.min(s.w,s.h)/2-A,C=k/(g.length+x?1:0);A=Math.min(A,C)}for(var F=0,G=0;G1&&e.avoidOverlap){var re=Math.cos(B)-Math.cos(0),K=Math.sin(B)-Math.sin(0),q=Math.sqrt(A*A/(re*re+K*K));F=Math.max(q,F)}M.r=F,F+=A}if(e.equidistant){for(var ae=0,ue=0,be=0;be=t.numIter||(ag(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature=t.animationThreshold&&i(),hn(h)}};f()}else{for(;l;)l=s(u),u++;jo(a,t),o()}return this},qn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},qn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Qd=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=Yt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=a.eles.components(),l={},f=0;f0){o.graphSet.push(k);for(var f=0;fn.count?0:n.graph},jd=function t(e,r,a,n){var i=n.graphSet[a];if(-10)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+u*u),d=h*o/c,v=h*u/c;else var y=Wn(e,o,u),p=Wn(r,-1*o,-1*u),g=p.x-y.x,m=p.y-y.y,b=g*g+m*m,c=Math.sqrt(b),h=(e.nodeRepulsion+r.nodeRepulsion)/b,d=h*g/c,v=h*m/c;e.isLocked||(e.offsetX-=d,e.offsetY-=v),r.isLocked||(r.offsetX+=d,r.offsetY+=v)}},sg=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},Wn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,u=a/r,l=s/o,f={};return r===0&&0a?(f.x=n,f.y=i+s/2,f):0r&&-1*l<=u&&u<=l?(f.x=n-o/2,f.y=i-o*a/2/r,f):0=l)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(u<=-1*l||u>=l)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},og=function(e,r){for(var a=0;aa){var p=r.gravity*d/y,g=r.gravity*v/y;c.offsetX+=p,c.offsetY+=g}}}}},ug=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],u=e.layoutNodes[o],l=u.children;if(0a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},cg=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeftn.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTopg&&(v+=p+r.componentSpacing,d=0,y=0,p=0)}}},vg={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 el(t){this.options=He({},vg,t)}el.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=Yt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(we){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),u=Math.round(o),l=Math.round(i.w/i.h*o),f=function(De){if(De==null)return Math.min(u,l);var xe=Math.min(u,l);xe==u?u=De:l=De},h=function(De){if(De==null)return Math.max(u,l);var xe=Math.max(u,l);xe==u?u=De:l=De},c=e.rows,d=e.cols!=null?e.cols:e.columns;if(c!=null&&d!=null)u=c,l=d;else if(c!=null&&d==null)u=c,l=Math.ceil(s/u);else if(c==null&&d!=null)l=d,u=Math.ceil(s/l);else if(l*u>s){var v=f(),y=h();(v-1)*y>=s?f(v-1):(y-1)*v>=s&&h(y-1)}else for(;l*u=s?h(g+1):f(p+1)}var m=i.w/l,b=i.h/u;if(e.condense&&(m=0,b=0),e.avoidOverlap)for(var E=0;E=l&&(re=0,B++)},q={},ae=0;ae(re=Ff(t,e,K[q],K[q+1],K[q+2],K[q+3])))return p(x,re),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var K=C.allpts,q=0;q+5(re=Bf(t,e,K[q],K[q+1],K[q+2],K[q+3],K[q+4],K[q+5])))return p(x,re),!0}for(var ae=ae||k.source,ue=ue||k.target,be=n.getArrowWidth(F,G),ie=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],q=0;q0&&(g(ae),g(ue))}function b(x,k,C){return tr(x,k,C)}function E(x,k){var C=x._private,F=c,G;k?G=k+"-":G="",x.boundingBox();var M=C.labelBounds[k||"main"],X=x.pstyle(G+"label").value,B=x.pstyle("text-events").strValue==="yes";if(!(!B||!X)){var re=b(C.rscratch,"labelX",k),K=b(C.rscratch,"labelY",k),q=b(C.rscratch,"labelAngle",k),ae=x.pstyle(G+"text-margin-x").pfValue,ue=x.pstyle(G+"text-margin-y").pfValue,be=M.x1-F-ae,ie=M.x2+F-ae,ge=M.y1-F-ue,we=M.y2+F-ue;if(q){var De=Math.cos(q),xe=Math.sin(q),Se=function(Xe,Ie){return Xe=Xe-re,Ie=Ie-K,{x:Xe*De-Ie*xe+re,y:Xe*xe+Ie*De+K}},se=Se(be,ge),Te=Se(be,we),Ae=Se(ie,ge),Le=Se(ie,we),Ne=[se.x+ae,se.y+ue,Ae.x+ae,Ae.y+ue,Le.x+ae,Le.y+ue,Te.x+ae,Te.y+ue];if(Ht(t,e,Ne))return p(x),!0}else if(ra(M,t,e))return p(x),!0}}for(var I=s.length-1;I>=0;I--){var A=s[I];A.isNode()?g(A)||E(A):m(A)||E(A)||E(A,"source")||E(A,"target")}return o},_r.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),u=Math.min(e,a),l=Math.max(e,a);t=s,r=o,e=u,a=l;for(var f=Yt({x1:t,y1:e,x2:r,y2:a}),h=0;h0?Math.max(Ee-Ge,0):Math.min(Ee+Ge,0)},X=M(F,k),B=M(G,C),re=!1;m===l?g=Math.abs(X)>Math.abs(B)?n:a:m===u||m===o?(g=a,re=!0):(m===i||m===s)&&(g=n,re=!0);var K=g===a,q=K?B:X,ae=K?G:F,ue=xs(ae),be=!1;!(re&&(E||A))&&(m===o&&ae<0||m===u&&ae>0||m===i&&ae>0||m===s&&ae<0)&&(ue*=-1,q=ue*Math.abs(q),be=!0);var ie;if(E){var ge=I<0?1+I:I;ie=ge*q}else{var we=I<0?q:0;ie=we+I*ue}var De=function(Ee){return Math.abs(Ee)=Math.abs(q)},xe=De(ie),Se=De(Math.abs(q)-Math.abs(ie)),se=xe||Se;if(se&&!be)if(K){var Te=Math.abs(ae)<=c/2,Ae=Math.abs(F)<=d/2;if(Te){var Le=(f.x1+f.x2)/2,Ne=f.y1,Fe=f.y2;r.segpts=[Le,Ne,Le,Fe]}else if(Ae){var Xe=(f.y1+f.y2)/2,Ie=f.x1,Re=f.x2;r.segpts=[Ie,Xe,Re,Xe]}else r.segpts=[f.x1,f.y2]}else{var $e=Math.abs(ae)<=h/2,ze=Math.abs(G)<=v/2;if($e){var Be=(f.y1+f.y2)/2,_e=f.x1,rt=f.x2;r.segpts=[_e,Be,rt,Be]}else if(ze){var je=(f.x1+f.x2)/2,qe=f.y1,et=f.y2;r.segpts=[je,qe,je,et]}else r.segpts=[f.x2,f.y1]}else if(K){var fe=f.y1+ie+(p?c/2*ue:0),O=f.x1,oe=f.x2;r.segpts=[O,fe,oe,fe]}else{var Ce=f.x1+ie+(p?h/2*ue:0),ve=f.y1,ye=f.y2;r.segpts=[Ce,ve,Ce,ye]}},Vt.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,u=e.tgtH,l=e.srcShape,f=e.tgtShape,h=!R(r.startX)||!R(r.startY),c=!R(r.arrowStartX)||!R(r.arrowStartY),d=!R(r.endX)||!R(r.endY),v=!R(r.arrowEndX)||!R(r.arrowEndY),y=3,p=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,g=y*p,m=Br({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),b=mB.poolIndex()){var re=X;X=B,B=re}var K=C.srcPos=X.position(),q=C.tgtPos=B.position(),ae=C.srcW=X.outerWidth(),ue=C.srcH=X.outerHeight(),be=C.tgtW=B.outerWidth(),ie=C.tgtH=B.outerHeight(),ge=C.srcShape=r.nodeShapes[e.getNodeShape(X)],we=C.tgtShape=r.nodeShapes[e.getNodeShape(B)];C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var De=0;De0){var Te=i,Ae=Fr(Te,ea(r)),Le=Fr(Te,ea(se)),Ne=Ae;if(Le2){var Fe=Fr(Te,{x:se[2],y:se[3]});Fe0){var O=s,oe=Fr(O,ea(r)),Ce=Fr(O,ea(fe)),ve=oe;if(Ce2){var ye=Fr(O,{x:fe[2],y:fe[3]});ye=v||x){p={cp:E,segment:A};break}}if(p)break}var k=p.cp,C=p.segment,F=(v-g)/C.length,G=C.t1-C.t0,M=d?C.t0+G*F:C.t1-G*F;M=Pa(0,M,1),e=ta(k.p0,k.p1,k.p2,M),c=bg(k.p0,k.p1,k.p2,M);break}case"straight":case"segments":case"haystack":{for(var X=0,B,re,K,q,ae=a.allpts.length,ue=0;ue+3=v));ue+=2);var be=v-re,ie=be/B;ie=Pa(0,ie,1),e=Sf(K,q,ie),c=ll(K,q);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};l("source"),l("target"),this.applyLabelDimensions(t)}},hr.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))},hr.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=tr(r.rscratch,"labelWrapCachedLines",e)||[],u=s!=="wrap"?1:Math.max(o.length,1),l=n.height/u,f=l*i,h=n.width,c=n.height+(u-1)*(i-1)*l;Tr(r.rstyle,"labelWidth",e,h),Tr(r.rscratch,"labelWidth",e,h),Tr(r.rstyle,"labelHeight",e,c),Tr(r.rscratch,"labelHeight",e,c),Tr(r.rscratch,"labelLineHeight",e,f)},hr.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(be,ie){return ie?(Tr(r.rscratch,be,e,ie),ie):tr(r.rscratch,be,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="​",f=n.split(` `),h=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,d=c==="anywhere",v=[],y=/[\s\u200b]+/,p=d?"":" ",g=0;gh){for(var A=m.split(y),x="",k=0;kX)break;B+=n[q],q===n.length-1&&(K=!0)}return K||(B+=re),B}return n},hr.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},hr.calculateLabelDimensions=function(t,e){var r=this,a=Pr(e,t._private.labelDimsKey),n=r.labelDimCache||(r.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=t.pstyle("font-style").strValue,u=t.pstyle("font-size").pfValue,l=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var d=h.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(u,"px ").concat(l);for(var v=0,y=0,p=e.split(` `),g=0;g1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var u=0;u=t.desktopTapThreshold2}var Er=n(O);Rt&&(t.hoverData.tapholdCancelled=!0);var Rr=function(){var vr=t.hoverData.dragDelta=t.hoverData.dragDelta||[];vr.length===0?(vr.push(Je[0]),vr.push(Je[1])):(vr[0]+=Je[0],vr[1]+=Je[1])};Ce=!0,a(We,["mousemove","vmousemove","tapdrag"],O,{x:Ee[0],y:Ee[1]});var Ta=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||ve.emit({originalEvent:O,type:"boxstart",position:{x:Ee[0],y:Ee[1]}}),ft[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Rt){var Xr={originalEvent:O,type:"cxtdrag",position:{x:Ee[0],y:Ee[1]}};Ke?Ke.emit(Xr):ve.emit(Xr),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||We!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:Ee[0],y:Ee[1]}}),t.hoverData.cxtOver=We,We&&We.emit({originalEvent:O,type:"cxtdragover",position:{x:Ee[0],y:Ee[1]}}))}}else if(t.hoverData.dragging){if(Ce=!0,ve.panningEnabled()&&ve.userPanningEnabled()){var Ca;if(t.hoverData.justStartedPan){var ti=t.hoverData.mdownPos;Ca={x:(Ee[0]-ti[0])*ye,y:(Ee[1]-ti[1])*ye},t.hoverData.justStartedPan=!1}else Ca={x:Je[0]*ye,y:Je[1]*ye};ve.panBy(Ca),ve.emit("dragpan"),t.hoverData.dragged=!0}Ee=t.projectIntoViewport(O.clientX,O.clientY)}else if(ft[4]==1&&(Ke==null||Ke.pannable())){if(Rt){if(!t.hoverData.dragging&&ve.boxSelectionEnabled()&&(Er||!ve.panningEnabled()||!ve.userPanningEnabled()))Ta();else if(!t.hoverData.selecting&&ve.panningEnabled()&&ve.userPanningEnabled()){var qr=i(Ke,t.hoverData.downs);qr&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ft[4]=0,t.data.bgActivePosistion=ea(Ge),t.redrawHint("select",!0),t.redraw())}Ke&&Ke.pannable()&&Ke.active()&&Ke.unactivate()}}else{if(Ke&&Ke.pannable()&&Ke.active()&&Ke.unactivate(),(!Ke||!Ke.grabbed())&&We!=ot&&(ot&&a(ot,["mouseout","tapdragout"],O,{x:Ee[0],y:Ee[1]}),We&&a(We,["mouseover","tapdragover"],O,{x:Ee[0],y:Ee[1]}),t.hoverData.last=We),Ke)if(Rt){if(ve.boxSelectionEnabled()&&Er)Ke&&Ke.grabbed()&&(p(Dt),Ke.emit("freeon"),Dt.emit("free"),t.dragData.didDrag&&(Ke.emit("dragfreeon"),Dt.emit("dragfree"))),Ta();else if(Ke&&Ke.grabbed()&&t.nodeIsDraggable(Ke)){var Xt=!t.dragData.didDrag;Xt&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||v(Dt,{inDragLayer:!0});var $t={x:0,y:0};if(R(Je[0])&&R(Je[1])&&($t.x+=Je[0],$t.y+=Je[1],Xt)){var qt=t.hoverData.dragDelta;qt&&R(qt[0])&&R(qt[1])&&($t.x+=qt[0],$t.y+=qt[1])}t.hoverData.draggingEles=!0,Dt.silentShift($t).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else Rr();Ce=!0}if(ft[2]=Ee[0],ft[3]=Ee[1],Ce)return O.stopPropagation&&O.stopPropagation(),O.preventDefault&&O.preventDefault(),!1}},!1);var F,G,M;t.registerBinding(e,"mouseup",function(O){var oe=t.hoverData.capture;if(oe){t.hoverData.capture=!1;var Ce=t.cy,ve=t.projectIntoViewport(O.clientX,O.clientY),ye=t.selection,Ue=t.findNearestElement(ve[0],ve[1],!0,!1),Ee=t.dragData.possibleDragElements,Ge=t.hoverData.down,Qe=n(O);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,Ge&&Ge.unactivate(),t.hoverData.which===3){var ft={originalEvent:O,type:"cxttapend",position:{x:ve[0],y:ve[1]}};if(Ge?Ge.emit(ft):Ce.emit(ft),!t.hoverData.cxtDragged){var We={originalEvent:O,type:"cxttap",position:{x:ve[0],y:ve[1]}};Ge?Ge.emit(We):Ce.emit(We)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(a(Ue,["mouseup","tapend","vmouseup"],O,{x:ve[0],y:ve[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(a(Ge,["click","tap","vclick"],O,{x:ve[0],y:ve[1]}),G=!1,O.timeStamp-M<=Ce.multiClickDebounceTime()?(F&&clearTimeout(F),G=!0,M=null,a(Ge,["dblclick","dbltap","vdblclick"],O,{x:ve[0],y:ve[1]})):(F=setTimeout(function(){G||a(Ge,["oneclick","onetap","voneclick"],O,{x:ve[0],y:ve[1]})},Ce.multiClickDebounceTime()),M=O.timeStamp)),Ge==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!n(O)&&(Ce.$(r).unselect(["tapunselect"]),Ee.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=Ee=Ce.collection()),Ue==Ge&&!t.dragData.didDrag&&!t.hoverData.selecting&&Ue!=null&&Ue._private.selectable&&(t.hoverData.dragging||(Ce.selectionType()==="additive"||Qe?Ue.selected()?Ue.unselect(["tapunselect"]):Ue.select(["tapselect"]):Qe||(Ce.$(r).unmerge(Ue).unselect(["tapunselect"]),Ue.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var ot=Ce.collection(t.getAllInBox(ye[0],ye[1],ye[2],ye[3]));t.redrawHint("select",!0),ot.length>0&&t.redrawHint("eles",!0),Ce.emit({type:"boxend",originalEvent:O,position:{x:ve[0],y:ve[1]}});var Ke=function(Rt){return Rt.selectable()&&!Rt.selected()};Ce.selectionType()==="additive"||Qe||Ce.$(r).unmerge(ot).unselect(),ot.emit("box").stdFilter(Ke).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!ye[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var Je=Ge&&Ge.grabbed();p(Ee),Je&&(Ge.emit("freeon"),Ee.emit("free"),t.dragData.didDrag&&(Ge.emit("dragfreeon"),Ee.emit("dragfree")))}}ye[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var X=function(O){if(!t.scrollingPage){var oe=t.cy,Ce=oe.zoom(),ve=oe.pan(),ye=t.projectIntoViewport(O.clientX,O.clientY),Ue=[ye[0]*Ce+ve.x,ye[1]*Ce+ve.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||k()){O.preventDefault();return}if(oe.panningEnabled()&&oe.userPanningEnabled()&&oe.zoomingEnabled()&&oe.userZoomingEnabled()){O.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var Ee;O.deltaY!=null?Ee=O.deltaY/-250:O.wheelDeltaY!=null?Ee=O.wheelDeltaY/1e3:Ee=O.wheelDelta/1e3,Ee=Ee*t.wheelSensitivity;var Ge=O.deltaMode===1;Ge&&(Ee*=33);var Qe=oe.zoom()*Math.pow(10,Ee);O.type==="gesturechange"&&(Qe=t.gestureStartZoom*O.scale),oe.zoom({level:Qe,renderedPosition:{x:Ue[0],y:Ue[1]}}),oe.emit(O.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",X,!0),t.registerBinding(e,"scroll",function(O){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(O){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||O.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(fe){t.hasTouchStarted||X(fe)},!0),t.registerBinding(t.container,"mouseout",function(O){var oe=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseout",position:{x:oe[0],y:oe[1]}})},!1),t.registerBinding(t.container,"mouseover",function(O){var oe=t.projectIntoViewport(O.clientX,O.clientY);t.cy.emit({originalEvent:O,type:"mouseover",position:{x:oe[0],y:oe[1]}})},!1);var B,re,K,q,ae,ue,be,ie,ge,we,De,xe,Se,se=function(O,oe,Ce,ve){return Math.sqrt((Ce-O)*(Ce-O)+(ve-oe)*(ve-oe))},Te=function(O,oe,Ce,ve){return(Ce-O)*(Ce-O)+(ve-oe)*(ve-oe)},Ae;t.registerBinding(t.container,"touchstart",Ae=function(O){if(t.hasTouchStarted=!0,!!C(O)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var oe=t.cy,Ce=t.touchData.now,ve=t.touchData.earlier;if(O.touches[0]){var ye=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Ce[0]=ye[0],Ce[1]=ye[1]}if(O.touches[1]){var ye=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Ce[2]=ye[0],Ce[3]=ye[1]}if(O.touches[2]){var ye=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Ce[4]=ye[0],Ce[5]=ye[1]}if(O.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var Ue=t.findContainerClientCoords();ge=Ue[0],we=Ue[1],De=Ue[2],xe=Ue[3],B=O.touches[0].clientX-ge,re=O.touches[0].clientY-we,K=O.touches[1].clientX-ge,q=O.touches[1].clientY-we,Se=0<=B&&B<=De&&0<=K&&K<=De&&0<=re&&re<=xe&&0<=q&&q<=xe;var Ee=oe.pan(),Ge=oe.zoom();ae=se(B,re,K,q),ue=Te(B,re,K,q),be=[(B+K)/2,(re+q)/2],ie=[(be[0]-Ee.x)/Ge,(be[1]-Ee.y)/Ge];var Qe=200,ft=Qe*Qe;if(ue=1){for(var ir=t.touchData.startPosition=[null,null,null,null,null,null],kt=0;kt=t.touchTapThreshold2}if(oe&&t.touchData.cxt){O.preventDefault();var ir=O.touches[0].clientX-ge,kt=O.touches[0].clientY-we,Jt=O.touches[1].clientX-ge,Ut=O.touches[1].clientY-we,Er=Te(ir,kt,Jt,Ut),Rr=Er/ue,Ta=150,Xr=Ta*Ta,Ca=1.5,ti=Ca*Ca;if(Rr>=ti||Er>=Xr){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var qr={originalEvent:O,type:"cxttapend",position:{x:ye[0],y:ye[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(qr),t.touchData.start=null):ve.emit(qr)}}if(oe&&t.touchData.cxt){var qr={originalEvent:O,type:"cxtdrag",position:{x:ye[0],y:ye[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(qr):ve.emit(qr),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var Xt=t.findNearestElement(ye[0],ye[1],!0,!0);(!t.touchData.cxtOver||Xt!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:O,type:"cxtdragout",position:{x:ye[0],y:ye[1]}}),t.touchData.cxtOver=Xt,Xt&&Xt.emit({originalEvent:O,type:"cxtdragover",position:{x:ye[0],y:ye[1]}}))}else if(oe&&O.touches[2]&&ve.boxSelectionEnabled())O.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||ve.emit({originalEvent:O,type:"boxstart",position:{x:ye[0],y:ye[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Ce[4]=1,!Ce||Ce.length===0||Ce[0]===void 0?(Ce[0]=(ye[0]+ye[2]+ye[4])/3,Ce[1]=(ye[1]+ye[3]+ye[5])/3,Ce[2]=(ye[0]+ye[2]+ye[4])/3+1,Ce[3]=(ye[1]+ye[3]+ye[5])/3+1):(Ce[2]=(ye[0]+ye[2]+ye[4])/3,Ce[3]=(ye[1]+ye[3]+ye[5])/3),t.redrawHint("select",!0),t.redraw();else if(oe&&O.touches[1]&&!t.touchData.didSelect&&ve.zoomingEnabled()&&ve.panningEnabled()&&ve.userZoomingEnabled()&&ve.userPanningEnabled()){O.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var $t=t.dragData.touchDragEles;if($t){t.redrawHint("drag",!0);for(var qt=0;qt<$t.length;qt++){var ri=$t[qt]._private;ri.grabbed=!1,ri.rscratch.inDragLayer=!1}}var vr=t.touchData.start,ir=O.touches[0].clientX-ge,kt=O.touches[0].clientY-we,Jt=O.touches[1].clientX-ge,Ut=O.touches[1].clientY-we,Gl=se(ir,kt,Jt,Ut),vp=Gl/ae;if(Se){var dp=ir-B,gp=kt-re,pp=Jt-K,yp=Ut-q,mp=(dp+pp)/2,bp=(gp+yp)/2,an=ve.zoom(),Ki=an*vp,ai=ve.pan(),zl=ie[0]*an+ai.x,Vl=ie[1]*an+ai.y,Ep={x:-Ki/an*(zl-ai.x-mp)+zl,y:-Ki/an*(Vl-ai.y-bp)+Vl};if(vr&&vr.active()){var $t=t.dragData.touchDragEles;p($t),t.redrawHint("drag",!0),t.redrawHint("eles",!0),vr.unactivate().emit("freeon"),$t.emit("free"),t.dragData.didDrag&&(vr.emit("dragfreeon"),$t.emit("dragfree"))}ve.viewport({zoom:Ki,pan:Ep,cancelOnFailedZoom:!0}),ve.emit("pinchzoom"),ae=Gl,B=ir,re=kt,K=Jt,q=Ut,t.pinching=!0}if(O.touches[0]){var Ge=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);ye[0]=Ge[0],ye[1]=Ge[1]}if(O.touches[1]){var Ge=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);ye[2]=Ge[0],ye[3]=Ge[1]}if(O.touches[2]){var Ge=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);ye[4]=Ge[0],ye[5]=Ge[1]}}else if(O.touches[0]&&!t.touchData.didSelect){var sr=t.touchData.start,Zi=t.touchData.last,Xt;if(!t.hoverData.draggingEles&&!t.swipePanning&&(Xt=t.findNearestElement(ye[0],ye[1],!0,!0)),oe&&sr!=null&&O.preventDefault(),oe&&sr!=null&&t.nodeIsDraggable(sr))if(ft){var $t=t.dragData.touchDragEles,$l=!t.dragData.didDrag;$l&&v($t,{inDragLayer:!0}),t.dragData.didDrag=!0;var nn={x:0,y:0};if(R(We[0])&&R(We[1])&&(nn.x+=We[0],nn.y+=We[1],$l)){t.redrawHint("eles",!0);var or=t.touchData.dragDelta;or&&R(or[0])&&R(or[1])&&(nn.x+=or[0],nn.y+=or[1])}t.hoverData.draggingEles=!0,$t.silentShift(nn).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==Ue[0]&&t.touchData.startPosition[1]==Ue[1]&&t.redrawHint("eles",!0),t.redraw()}else{var or=t.touchData.dragDelta=t.touchData.dragDelta||[];or.length===0?(or.push(We[0]),or.push(We[1])):(or[0]+=We[0],or[1]+=We[1])}if(a(sr||Xt,["touchmove","tapdrag","vmousemove"],O,{x:ye[0],y:ye[1]}),(!sr||!sr.grabbed())&&Xt!=Zi&&(Zi&&Zi.emit({originalEvent:O,type:"tapdragout",position:{x:ye[0],y:ye[1]}}),Xt&&Xt.emit({originalEvent:O,type:"tapdragover",position:{x:ye[0],y:ye[1]}})),t.touchData.last=Xt,oe)for(var qt=0;qt0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var Ne;t.registerBinding(e,"touchcancel",Ne=function(O){var oe=t.touchData.start;t.touchData.capture=!1,oe&&oe.unactivate()});var Fe,Xe,Ie,Re;if(t.registerBinding(e,"touchend",Fe=function(O){var oe=t.touchData.start,Ce=t.touchData.capture;if(Ce)O.touches.length===0&&(t.touchData.capture=!1),O.preventDefault();else return;var ve=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var ye=t.cy,Ue=ye.zoom(),Ee=t.touchData.now,Ge=t.touchData.earlier;if(O.touches[0]){var Qe=t.projectIntoViewport(O.touches[0].clientX,O.touches[0].clientY);Ee[0]=Qe[0],Ee[1]=Qe[1]}if(O.touches[1]){var Qe=t.projectIntoViewport(O.touches[1].clientX,O.touches[1].clientY);Ee[2]=Qe[0],Ee[3]=Qe[1]}if(O.touches[2]){var Qe=t.projectIntoViewport(O.touches[2].clientX,O.touches[2].clientY);Ee[4]=Qe[0],Ee[5]=Qe[1]}oe&&oe.unactivate();var ft;if(t.touchData.cxt){if(ft={originalEvent:O,type:"cxttapend",position:{x:Ee[0],y:Ee[1]}},oe?oe.emit(ft):ye.emit(ft),!t.touchData.cxtDragged){var We={originalEvent:O,type:"cxttap",position:{x:Ee[0],y:Ee[1]}};oe?oe.emit(We):ye.emit(We)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!O.touches[2]&&ye.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var ot=ye.collection(t.getAllInBox(ve[0],ve[1],ve[2],ve[3]));ve[0]=void 0,ve[1]=void 0,ve[2]=void 0,ve[3]=void 0,ve[4]=0,t.redrawHint("select",!0),ye.emit({type:"boxend",originalEvent:O,position:{x:Ee[0],y:Ee[1]}});var Ke=function(Xr){return Xr.selectable()&&!Xr.selected()};ot.emit("box").stdFilter(Ke).select().emit("boxselect"),ot.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if(oe!=null&&oe.unactivate(),O.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!O.touches[1]){if(!O.touches[0]){if(!O.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Je=t.dragData.touchDragEles;if(oe!=null){var Dt=oe._private.grabbed;p(Je),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Dt&&(oe.emit("freeon"),Je.emit("free"),t.dragData.didDrag&&(oe.emit("dragfreeon"),Je.emit("dragfree"))),a(oe,["touchend","tapend","vmouseup","tapdragout"],O,{x:Ee[0],y:Ee[1]}),oe.unactivate(),t.touchData.start=null}else{var Rt=t.findNearestElement(Ee[0],Ee[1],!0,!0);a(Rt,["touchend","tapend","vmouseup","tapdragout"],O,{x:Ee[0],y:Ee[1]})}var nr=t.touchData.startPosition[0]-Ee[0],ir=nr*nr,kt=t.touchData.startPosition[1]-Ee[1],Jt=kt*kt,Ut=ir+Jt,Er=Ut*Ue*Ue;t.touchData.singleTouchMoved||(oe||ye.$(":selected").unselect(["tapunselect"]),a(oe,["tap","vclick"],O,{x:Ee[0],y:Ee[1]}),Xe=!1,O.timeStamp-Re<=ye.multiClickDebounceTime()?(Ie&&clearTimeout(Ie),Xe=!0,Re=null,a(oe,["dbltap","vdblclick"],O,{x:Ee[0],y:Ee[1]})):(Ie=setTimeout(function(){Xe||a(oe,["onetap","voneclick"],O,{x:Ee[0],y:Ee[1]})},ye.multiClickDebounceTime()),Re=O.timeStamp)),oe!=null&&!t.dragData.didDrag&&oe._private.selectable&&Er"u"){var $e=[],ze=function(O){return{clientX:O.clientX,clientY:O.clientY,force:1,identifier:O.pointerId,pageX:O.pageX,pageY:O.pageY,radiusX:O.width/2,radiusY:O.height/2,screenX:O.screenX,screenY:O.screenY,target:O.target}},Be=function(O){return{event:O,touch:ze(O)}},_e=function(O){$e.push(Be(O))},rt=function(O){for(var oe=0;oe<$e.length;oe++){var Ce=$e[oe];if(Ce.event.pointerId===O.pointerId){$e.splice(oe,1);return}}},je=function(O){var oe=$e.filter(function(Ce){return Ce.event.pointerId===O.pointerId})[0];oe.event=O,oe.touch=ze(O)},qe=function(O){O.touches=$e.map(function(oe){return oe.touch})},et=function(O){return O.pointerType==="mouse"||O.pointerType===4};t.registerBinding(t.container,"pointerdown",function(fe){et(fe)||(fe.preventDefault(),_e(fe),qe(fe),Ae(fe))}),t.registerBinding(t.container,"pointerup",function(fe){et(fe)||(rt(fe),qe(fe),Fe(fe))}),t.registerBinding(t.container,"pointercancel",function(fe){et(fe)||(rt(fe),qe(fe),Ne(fe))}),t.registerBinding(t.container,"pointermove",function(fe){et(fe)||(fe.preventDefault(),je(fe),qe(fe),Le(fe))})}};var mr={};mr.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,s,o){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,u,l){return Fa(o,u,this.points,a,n,i/2,s/2,l)},checkPoint:function(a,n,i,s,o,u,l){return pr(a,n,this.points,u,l,s,o,[0,-1],i)}}},mr.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o){return zf(i,s,e,r,a/2+o,n/2+o)},checkPoint:function(e,r,a,n,i,s,o){return Gr(e,r,n,i,s,o,a)}}},mr.generateRoundPolygon=function(t,e){for(var r=new Array(e.length*2),a=0;a0)return ie[0]}return null},d=Object.keys(h),v=0;v0?c:Ss(i,s,e,r,a,n,o)},checkPoint:function(e,r,a,n,i,s,o){var u=Ga(n,i),l=2*u;if(pr(e,r,this.points,s,o,n,i-l,[0,-1],a)||pr(e,r,this.points,s,o,n-l,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(Ht(e,r,c)||Gr(e,r,l,l,s+n/2-u,o+i/2-u,a)||Gr(e,r,l,l,s-n/2+u,o+i/2-u,a))}}},mr.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",_t(3,0)),this.generateRoundPolygon("round-triangle",_t(3,0)),this.generatePolygon("rectangle",_t(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",_t(5,0)),this.generateRoundPolygon("round-pentagon",_t(5,0)),this.generatePolygon("hexagon",_t(6,0)),this.generateRoundPolygon("round-hexagon",_t(6,0)),this.generatePolygon("heptagon",_t(7,0)),this.generateRoundPolygon("round-heptagon",_t(7,0)),this.generatePolygon("octagon",_t(8,0)),this.generateRoundPolygon("round-octagon",_t(8,0));var a=new Array(20);{var n=di(5,0),i=di(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o=e.deqFastCost*E)break}else if(l){if(m>=e.deqCost*d||m>=e.deqAvgCost*c)break}else if(b>=e.deqNoDrawCost*$i)break;var I=e.deq(a,p,y);if(I.length>0)for(var A=0;A0&&(e.onDeqd(a,v),!l&&e.shouldRedraw(a,v,p,y)&&i())},o=e.priority||li;n.beforeRender(s,o(a))}}}},wg=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:vn;de(this,t),this.idsByKey=new ur,this.keyForId=new ur,this.cachesByLvl=new ur,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return N(t,[{key:"getIdsFor",value:function(r){r==null&&Tt("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new jr,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new ur,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),t}(),yl=25,Jn=50,jn=-4,_i=3,xg=7.99,Tg=8,Cg=1024,Dg=1024,Sg=1024,Lg=.2,Ag=.8,Og=10,Ng=.15,Mg=.1,Ig=.9,Rg=.9,kg=100,Pg=1,Ea={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},Bg=At({getKey:null,doesEleInvalidateKey:vn,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:gs,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),en=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=Bg(r);He(a,n),a.lookup=new wg(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},St=en.prototype;St.reasons=Ea,St.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]},St.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a},St.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new ka(function(r,a){return a.reqs-r.reqs});return e},St.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e},St.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(hi(o*r))),a=xg||a>_i)return null;var l=Math.pow(2,a),f=e.h*l,h=e.w*l,c=s.eleTextBiggerThanMin(t,l);if(!this.isVisible(t,c))return null;var d=u.get(t,a);if(d&&d.invalidated&&(d.invalidated=!1,d.texture.invalidatedWidth-=d.width),d)return d;var v;if(f<=yl?v=yl:f<=Jn?v=Jn:v=Math.ceil(f/Jn)*Jn,f>Sg||h>Dg)return null;var y=i.getTextureQueue(v),p=y[y.length-2],g=function(){return i.recycleTexture(v,h)||i.addTexture(v,h)};p||(p=y[y.length-1]),p||(p=g()),p.width-p.usedWidtha;G--)C=i.getElement(t,e,r,G,Ea.downscale);F()}else return i.queueElement(t,A.level-1),A;else{var M;if(!b&&!E&&!I)for(var X=a-1;X>=jn;X--){var B=u.get(t,X);if(B){M=B;break}}if(m(M))return i.queueElement(t,a),M;p.context.translate(p.usedWidth,0),p.context.scale(l,l),this.drawElement(p.context,t,e,c,!1),p.context.scale(1/l,1/l),p.context.translate(-p.usedWidth,0)}return d={x:p.usedWidth,texture:p,level:a,scale:l,width:h,height:f,scaledLabelShown:c},p.usedWidth+=Math.ceil(h+Tg),p.eleCaches.push(d),u.set(t,a,d),i.checkTextureFullness(p),d},St.invalidateElements=function(t){for(var e=0;e=Lg*t.width&&this.retireTexture(t)},St.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>Ag&&t.fullnessChecks>=Og?xr(r,t):t.fullnessChecks++},St.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;xr(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,ui(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),xr(n,s),a.push(s),s}},St.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}},St.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s0;s++){var o=r.pop(),u=o.key,l=o.eles[0],f=i.hasCache(l,o.level);if(a[u]=null,f)continue;n.push(o);var h=e.getBoundingBox(l);e.getElement(l,h,t,o.level,Ea.dequeue)}return n},St.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=oi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))},St.onDequeue=function(t){this.onDequeues.push(t)},St.offDequeue=function(t){xr(this.onDequeues,t)},St.setupDequeueing=pl.setupDequeueing({deqRedrawThreshold:kg,deqCost:Ng,deqAvgCost:Mg,deqNoDrawCost:Ig,deqFastCost:Rg,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a=Gg||r>ei)return null}a.validateLayersElesOrdering(r,t);var u=a.layersByLevel,l=Math.pow(2,r),f=u[r]=u[r]||[],h,c=a.levelIsComplete(r,t),d,v=function(){var F=function(re){if(a.validateLayersElesOrdering(re,t),a.levelIsComplete(re,t))return d=u[re],!0},G=function(re){if(!d)for(var K=r+re;tn<=K&&K<=ei&&!F(K);K+=re);};G(1),G(-1);for(var M=f.length-1;M>=0;M--){var X=f[M];X.invalid&&xr(f,X)}};if(!c)v();else return f;var y=function(){if(!h){h=Yt();for(var F=0;FXg)return null;var X=a.makeLayer(h,r);if(G!=null){var B=f.indexOf(G)+1;f.splice(B,0,X)}else(F.insert===void 0||F.insert)&&f.unshift(X);return X};if(a.skipping&&!o)return null;for(var g=null,m=t.length/Fg,b=!o,E=0;E=m||!Ds(g.bb,I.boundingBox()))&&(g=p({insert:!0,after:g}),!g))return null;d||b?a.queueLayer(g,I):a.drawEleInLayer(g,I,r,e),g.eles.push(I),x[r]=g}return d||(b?null:f)},It.getEleLevelForLayerLevel=function(t,e){return t},It.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,qg),i.setImgSmoothing(s,!0))},It.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i0||s.invalid)return!1;n+=s.eles.length}return n===e.length},It.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a0){e=!0;break}}return e},It.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=gr(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))},It.invalidateLayer=function(t){if(this.lastInvalidationTime=gr(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];xr(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,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;r&&(u=r,t.translate(-u.x1,-u.y1));var l=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,d=e.pstyle("width").pfValue,v=e.pstyle("line-cap").value,y=l*f,p=l*f,g=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;h==="straight-triangle"?(s.eleStrokeStyle(t,e,M),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=d,t.lineCap=v,s.eleStrokeStyle(t,e,M),s.drawEdgePath(e,t,o.allpts,c),t.lineCap="butt")},m=function(){n&&s.drawEdgeOverlay(t,e)},b=function(){n&&s.drawEdgeUnderlay(t,e)},E=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;s.drawArrowheads(t,e,M)},I=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var A=e.pstyle("ghost").value==="yes";if(A){var x=e.pstyle("ghost-offset-x").pfValue,k=e.pstyle("ghost-offset-y").pfValue,C=e.pstyle("ghost-opacity").value,F=y*C;t.translate(x,k),g(F),E(F),t.translate(-x,-k)}b(),g(),E(),m(),I(),r&&t.translate(u.x1,u.y1)}};var Cl=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,u=a.pstyle("".concat(e,"-padding")).pfValue,l=2*u,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=l,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};br.drawEdgeOverlay=Cl("overlay"),br.drawEdgeUnderlay=Cl("underlay"),br.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,u=this.usePaths(),l=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(u){var h=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(l),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+35&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(e);t.textAlign=u,t.textBaseline="bottom"}else{var l=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(l||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var d=!r,v;r&&(v=r,t.translate(-v.x1,-v.y1)),n==null?(s.drawText(t,e,null,d,i),e.isEdge()&&(s.drawText(t,e,"source",d,i),s.drawText(t,e,"target",d,i))):s.drawText(t,e,n,d,i),r&&t.translate(v.x1,v.y1)},Ur.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",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,u=e.pstyle("text-outline-opacity").value*o,l=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,l[0],l[1],l[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],u)};function Hi(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),s?t.stroke():t.fill()}Ur.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=tr(n,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r},Ur.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var u=tr(s,"labelX",r),l=tr(s,"labelY",r),f,h,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(t,e,n);var d=r?r+"-":"",v=tr(s,"labelWidth",r),y=tr(s,"labelHeight",r),p=e.pstyle(d+"text-margin-x").pfValue,g=e.pstyle(d+"text-margin-y").pfValue,m=e.isEdge(),b=e.pstyle("text-halign").value,E=e.pstyle("text-valign").value;m&&(b="center",E="center"),u+=p,l+=g;var I;switch(a?I=this.getTextAngle(e,r):I=0,I!==0&&(f=u,h=l,t.translate(f,h),t.rotate(I),u=0,l=0),E){case"top":break;case"center":l+=y/2;break;case"bottom":l+=y;break}var A=e.pstyle("text-background-opacity").value,x=e.pstyle("text-border-opacity").value,k=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,F=e.pstyle("text-background-shape").strValue,G=F.indexOf("round")===0,M=2;if(A>0||k>0&&x>0){var X=u-C;switch(b){case"left":X-=v;break;case"center":X-=v/2;break}var B=l-y-C,re=v+2*C,K=y+2*C;if(A>0){var q=t.fillStyle,ae=e.pstyle("text-background-color").value;t.fillStyle="rgba("+ae[0]+","+ae[1]+","+ae[2]+","+A*o+")",G?Hi(t,X,B,re,K,M):t.fillRect(X,B,re,K),t.fillStyle=q}if(k>0&&x>0){var ue=t.strokeStyle,be=t.lineWidth,ie=e.pstyle("text-border-color").value,ge=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+ie[0]+","+ie[1]+","+ie[2]+","+x*o+")",t.lineWidth=k,t.setLineDash)switch(ge){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=k/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(G?Hi(t,X,B,re,K,M,"stroke"):t.strokeRect(X,B,re,K),ge==="double"){var we=k/2;G?Hi(t,X+we,B+we,re-we*2,K-we*2,M,"stroke"):t.strokeRect(X+we,B+we,re-we*2,K-we*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=be,t.strokeStyle=ue}}var De=2*e.pstyle("text-outline-width").pfValue;if(De>0&&(t.lineWidth=De),e.pstyle("text-wrap").value==="wrap"){var xe=tr(s,"labelWrapCachedLines",r),Se=tr(s,"labelLineHeight",r),se=v/2,Te=this.getLabelJustification(e);switch(Te==="auto"||(b==="left"?Te==="left"?u+=-v:Te==="center"&&(u+=-se):b==="center"?Te==="left"?u+=-se:Te==="right"&&(u+=se):b==="right"&&(Te==="center"?u+=se:Te==="right"&&(u+=v))),E){case"top":l-=(xe.length-1)*Se;break;case"center":case"bottom":l-=(xe.length-1)*Se;break}for(var Ae=0;Ae0&&t.strokeText(xe[Ae],u,l),t.fillText(xe[Ae],u,l),l+=Se}else De>0&&t.strokeText(c,u,l),t.fillText(c,u,l);I!==0&&(t.rotate(-I),t.translate(-f,-h))}}};var wa={};wa.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,l=e._private,f=l.rscratch,h=e.position();if(!(!R(h.x)||!R(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,d=s.usePaths(),v,y=!1,p=e.padding();o=e.width()+2*p,u=e.height()+2*p;var g;r&&(g=r,t.translate(-g.x1,-g.y1));for(var m=e.pstyle("background-image"),b=m.value,E=new Array(b.length),I=new Array(b.length),A=0,x=0;x0&&arguments[0]!==void 0?arguments[0]:X;s.eleFillStyle(t,e,fe)},we=function(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;s.colorStrokeStyle(t,B[0],B[1],B[2],fe)},De=function(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:be;s.colorStrokeStyle(t,ae[0],ae[1],ae[2],fe)},xe=function(fe,O,oe,Ce){var ve=s.nodePathCache=s.nodePathCache||[],ye=vs(oe==="polygon"?oe+","+Ce.join(","):oe,""+O,""+fe),Ue=ve[ye],Ee,Ge=!1;return Ue!=null?(Ee=Ue,Ge=!0,f.pathCache=Ee):(Ee=new Path2D,ve[ye]=f.pathCache=Ee),{path:Ee,cacheHit:Ge}},Se=e.pstyle("shape").strValue,se=e.pstyle("shape-polygon-points").pfValue;if(d){t.translate(h.x,h.y);var Te=xe(o,u,Se,se);v=Te.path,y=Te.cacheHit}var Ae=function(){if(!y){var fe=h;d&&(fe={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(v||t,fe.x,fe.y,o,u)}d?t.fill(v):t.fill()},Le=function(){for(var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,oe=l.backgrounding,Ce=0,ve=0;ve0&&arguments[0]!==void 0?arguments[0]:!1,O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(t,e,O),fe&&(d||s.nodeShapes[s.getNodeShape(e)].draw(t,h.x,h.y,o,u)))},Fe=function(){var fe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,O=(G>0?G:-G)*fe,oe=G>0?0:255;G!==0&&(s.colorFillStyle(t,oe,oe,oe,O),d?t.fill(v):t.fill())},Xe=function(){if(M>0){if(t.lineWidth=M,t.lineCap="butt",t.setLineDash)switch(re){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}if(d?t.stroke(v):t.stroke(),re==="double"){t.lineWidth=M/3;var fe=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(v):t.stroke(),t.globalCompositeOperation=fe}t.setLineDash&&t.setLineDash([])}},Ie=function(){if(q>0){if(t.lineWidth=q,t.lineCap="butt",t.setLineDash)switch(ue){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var fe=h;d&&(fe={x:0,y:0});var O=s.getNodeShape(e),oe=(o+M+(q+ie))/o,Ce=(u+M+(q+ie))/u,ve=o*oe,ye=u*Ce,Ue=s.nodeShapes[O].points,Ee;if(d){var Ge=xe(ve,ye,O,Ue);Ee=Ge.path}if(O==="ellipse")s.drawEllipsePath(Ee||t,fe.x,fe.y,ve,ye);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(O)){var Qe=0,ft=0,We=0;O==="round-diamond"?Qe=(M+ie+q)*1.4:O==="round-heptagon"?(Qe=(M+ie+q)*1.075,We=-(M/2+ie+q)/35):O==="round-hexagon"?Qe=(M+ie+q)*1.12:O==="round-pentagon"?(Qe=(M+ie+q)*1.13,We=-(M/2+ie+q)/15):O==="round-tag"?(Qe=(M+ie+q)*1.12,ft=(M/2+q+ie)*.07):O==="round-triangle"&&(Qe=(M+ie+q)*(Math.PI/2),We=-(M+ie/2+q)/Math.PI),Qe!==0&&(oe=(o+Qe)/o,Ce=(u+Qe)/u),s.drawRoundPolygonPath(Ee||t,fe.x+ft,fe.y+We,o*oe,u*Ce,Ue)}else if(["roundrectangle","round-rectangle"].includes(O))s.drawRoundRectanglePath(Ee||t,fe.x,fe.y,ve,ye);else if(["cutrectangle","cut-rectangle"].includes(O))s.drawCutRectanglePath(Ee||t,fe.x,fe.y,ve,ye);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(O))s.drawBottomRoundRectanglePath(Ee||t,fe.x,fe.y,ve,ye);else if(O==="barrel")s.drawBarrelPath(Ee||t,fe.x,fe.y,ve,ye);else if(O.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(O)){var ot=(M+q+ie)/o;Ue=bn(En(Ue,ot)),s.drawPolygonPath(Ee||t,fe.x,fe.y,o,u,Ue)}else{var Ke=(M+q+ie)/o;Ue=bn(En(Ue,-Ke)),s.drawPolygonPath(Ee||t,fe.x,fe.y,o,u,Ue)}if(d?t.stroke(Ee):t.stroke(),ue==="double"){t.lineWidth=M/3;var Je=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",d?t.stroke(Ee):t.stroke(),t.globalCompositeOperation=Je}t.setLineDash&&t.setLineDash([])}},Re=function(){n&&s.drawNodeOverlay(t,e,h,o,u)},$e=function(){n&&s.drawNodeUnderlay(t,e,h,o,u)},ze=function(){s.drawElementText(t,e,null,a)},Be=e.pstyle("ghost").value==="yes";if(Be){var _e=e.pstyle("ghost-offset-x").pfValue,rt=e.pstyle("ghost-offset-y").pfValue,je=e.pstyle("ghost-opacity").value,qe=je*c;t.translate(_e,rt),De(),Ie(),ge(je*X),Ae(),Le(qe,!0),we(je*K),Xe(),Ne(G!==0||M!==0),Le(qe,!1),Fe(qe),t.translate(-_e,-rt)}d&&t.translate(-h.x,-h.y),$e(),d&&t.translate(h.x,h.y),De(),Ie(),ge(),Ae(),Le(c,!0),we(),Xe(),Ne(G!==0||M!==0),Le(c,!1),Fe(),d&&t.translate(-h.x,-h.y),ze(),Re(),r&&t.translate(g.x1,g.y1)}};var Dl=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var u=a.pstyle("".concat(e,"-padding")).pfValue,l=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value;if(l>0){if(n=n||a.position(),i==null||s==null){var c=a.padding();i=a.width()+2*c,s=a.height()+2*c}o.colorFillStyle(r,f[0],f[1],f[2],l),o.nodeShapes[h].draw(r,n.x,n.y,i+u*2,s+u*2),r.fill()}}}};wa.drawNodeOverlay=Dl("overlay"),wa.drawNodeUnderlay=Dl("underlay"),wa.hasPie=function(t){return t=t[0],t._private.hasPie},wa.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,u=e.width(),l=e.height(),f=Math.min(u,l)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var d=1;d<=n.pieBackgroundN;d++){var v=e.pstyle("pie-"+d+"-background-size").value,y=e.pstyle("pie-"+d+"-background-color").value,p=e.pstyle("pie-"+d+"-background-opacity").value*r,g=v/100;g+h>1&&(g=1-h);var m=1.5*Math.PI+2*Math.PI*h,b=2*Math.PI*g,E=m+b;v===0||h>=1||h+g>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,m,E),t.closePath(),this.colorFillStyle(t,y[0],y[1],y[2],p),t.fill(),h+=g)}};var Kt={},np=100;Kt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e},Kt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;ns.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var m=u.style(),b=u.zoom(),E=n!==void 0?n:b,I=u.pan(),A={x:I.x,y:I.y},x={zoom:b,pan:{x:I.x,y:I.y}},k=s.prevViewport,C=k===void 0||x.zoom!==k.zoom||x.pan.x!==k.pan.x||x.pan.y!==k.pan.y;!C&&!(y&&!v)&&(s.motionBlurPxRatio=1),i&&(A=i),E*=o,A.x*=o,A.y*=o;var F=s.getCachedZSortedEles();function G(Ie,Re,$e,ze,Be){var _e=Ie.globalCompositeOperation;Ie.globalCompositeOperation="destination-out",s.colorFillStyle(Ie,255,255,255,s.motionBlurTransparency),Ie.fillRect(Re,$e,ze,Be),Ie.globalCompositeOperation=_e}function M(Ie,Re){var $e,ze,Be,_e;!s.clearingMotionBlur&&(Ie===l.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||Ie===l.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?($e={x:I.x*d,y:I.y*d},ze=b*d,Be=s.canvasWidth*d,_e=s.canvasHeight*d):($e=A,ze=E,Be=s.canvasWidth,_e=s.canvasHeight),Ie.setTransform(1,0,0,1,0,0),Re==="motionBlur"?G(Ie,0,0,Be,_e):!e&&(Re===void 0||Re)&&Ie.clearRect(0,0,Be,_e),r||(Ie.translate($e.x,$e.y),Ie.scale(ze,ze)),i&&Ie.translate(i.x,i.y),n&&Ie.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var X=s.data.bufferContexts[s.TEXTURE_BUFFER];X.setTransform(1,0,0,1,0,0),X.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:X,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var x=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var B=l.contexts[s.NODE],re=s.textureCache.texture,x=s.textureCache.viewport;B.setTransform(1,0,0,1,0,0),c?G(B,0,0,x.width,x.height):B.clearRect(0,0,x.width,x.height);var K=m.core("outside-texture-bg-color").value,q=m.core("outside-texture-bg-opacity").value;s.colorFillStyle(B,K[0],K[1],K[2],q),B.fillRect(0,0,x.width,x.height);var b=u.zoom();M(B,!1),B.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/o,x.height/x.zoom/o),B.drawImage(re,x.mpan.x,x.mpan.y,x.width/x.zoom/o,x.height/x.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var ae=u.extent(),ue=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),be=s.hideEdgesOnViewport&&ue,ie=[];if(ie[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,ie[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),ie[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,ie[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||a||ie[s.NODE]){var ge=c&&!ie[s.NODE]&&d!==1,B=e||(ge?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:l.contexts[s.NODE]),we=c&&!ge?"motionBlur":void 0;M(B,we),be?s.drawCachedNodes(B,F.nondrag,o,ae):s.drawLayeredElements(B,F.nondrag,o,ae),s.debug&&s.drawDebugPoints(B,F.nondrag),!r&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||r||ie[s.DRAG])){var ge=c&&!ie[s.DRAG]&&d!==1,B=e||(ge?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:l.contexts[s.DRAG]);M(B,c&&!ge?"motionBlur":void 0),be?s.drawCachedNodes(B,F.drag,o,ae):s.drawCachedElements(B,F.drag,o,ae),s.debug&&s.drawDebugPoints(B,F.drag),!r&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!r){var B=e||l.contexts[s.SELECT_BOX];if(M(B),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var b=s.cy.zoom(),De=m.core("selection-box-border-width").value/b;B.lineWidth=De,B.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",B.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),De>0&&(B.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",B.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(l.bgActivePosistion&&!s.hoverData.selecting){var b=s.cy.zoom(),xe=l.bgActivePosistion;B.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",B.beginPath(),B.arc(xe.x,xe.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI),B.fill()}var Se=s.lastRedrawTime;if(s.showFps&&Se){Se=Math.round(Se);var se=Math.round(1e3/Se);B.setTransform(1,0,0,1,0,0),B.fillStyle="rgba(255, 0, 0, 0.75)",B.strokeStyle="rgba(255, 0, 0, 0.75)",B.lineWidth=1,B.fillText("1 frame = "+Se+" ms = "+se+" fps",0,20);var Te=60;B.strokeRect(0,30,250,20),B.fillRect(0,30,250*Math.min(se/Te,1),20)}r||(f[s.SELECT_BOX]=!1)}if(c&&d!==1){var Ae=l.contexts[s.NODE],Le=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Ne=l.contexts[s.DRAG],Fe=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],Xe=function(Re,$e,ze){Re.setTransform(1,0,0,1,0,0),ze||!g?Re.clearRect(0,0,s.canvasWidth,s.canvasHeight):G(Re,0,0,s.canvasWidth,s.canvasHeight);var Be=d;Re.drawImage($e,0,0,s.canvasWidth*Be,s.canvasHeight*Be,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||ie[s.NODE])&&(Xe(Ae,Le,ie[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||ie[s.DRAG])&&(Xe(Ne,Fe,ie[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=x,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},np)),e||u.emit("render")};var Ir={};Ir.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var u=1;u0&&s>0){d.clearRect(0,0,i,s),d.globalCompositeOperation="source-over";var v=this.getCachedZSortedEles();if(t.full)d.translate(-a.x1*l,-a.y1*l),d.scale(l,l),this.drawElements(d,v),d.scale(1/l,1/l),d.translate(a.x1*l,a.y1*l);else{var y=e.pan(),p={x:y.x*l,y:y.y*l};l*=e.zoom(),d.translate(p.x,p.y),d.scale(l,l),this.drawElements(d,v),d.scale(1/l,1/l),d.translate(-p.x,-p.y)}t.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=t.bg,d.rect(0,0,i,s),d.fill())}return c};function ip(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i"u"?"undefined":ee(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=document.createElement("canvas"),r.width=t,r.height=e),r},[wl,cr,br,Yi,Ur,wa,Kt,Ir,rn,Ml].forEach(function(t){He(ut,t)});var lp=[{name:"null",impl:al},{name:"base",impl:gl},{name:"canvas",impl:sp}],up=[{type:"layout",extensions:yg},{type:"renderer",extensions:lp}],Rl={},kl={};function Pl(t,e,r){var a=r,n=function(k){ct("Can not register `"+e+"` for `"+t+"` since `"+k+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Qa.prototype[e])return n(e);Qa.prototype[e]=r}else if(t==="collection"){if(Nt.prototype[e])return n(e);Nt.prototype[e]=r}else if(t==="layout"){for(var i=function(k){this.options=k,r.call(this,k),L(this._private)||(this._private={}),this._private.cy=k.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(r.prototype),o=[],u=0;u$&&(this.rect.x-=(this.labelWidth-$)/2,this.setWidth(this.labelWidth)),this.labelHeight>_&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-_)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-_),this.setHeight(this.labelHeight))}}},P.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==T.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},P.prototype.transform=function(D){var $=this.rect.x;$>S.WORLD_BOUNDARY?$=S.WORLD_BOUNDARY:$<-S.WORLD_BOUNDARY&&($=-S.WORLD_BOUNDARY);var _=this.rect.y;_>S.WORLD_BOUNDARY?_=S.WORLD_BOUNDARY:_<-S.WORLD_BOUNDARY&&(_=-S.WORLD_BOUNDARY);var Q=new U($,_),ne=D.inverseTransformPoint(Q);this.setLocation(ne.x,ne.y)},P.prototype.getLeft=function(){return this.rect.x},P.prototype.getRight=function(){return this.rect.x+this.rect.width},P.prototype.getTop=function(){return this.rect.y},P.prototype.getBottom=function(){return this.rect.y+this.rect.height},P.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},ee.exports=P},function(ee,de,H){function N(T,w){T==null&&w==null?(this.x=0,this.y=0):(this.x=T,this.y=w)}N.prototype.getX=function(){return this.x},N.prototype.getY=function(){return this.y},N.prototype.setX=function(T){this.x=T},N.prototype.setY=function(T){this.y=T},N.prototype.getDifference=function(T){return new DimensionD(this.x-T.x,this.y-T.y)},N.prototype.getCopy=function(){return new N(this.x,this.y)},N.prototype.translate=function(T){return this.x+=T.width,this.y+=T.height,this},ee.exports=N},function(ee,de,H){var N=H(2),T=H(10),w=H(0),S=H(6),z=H(3),U=H(1),P=H(13),Z=H(12),D=H(11);function $(Q,ne,le){N.call(this,le),this.estimatedSize=T.MIN_VALUE,this.margin=w.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=Q,ne!=null&&ne instanceof S?this.graphManager=ne:ne!=null&&ne instanceof Layout&&(this.graphManager=ne.graphManager)}$.prototype=Object.create(N.prototype);for(var _ in N)$[_]=N[_];$.prototype.getNodes=function(){return this.nodes},$.prototype.getEdges=function(){return this.edges},$.prototype.getGraphManager=function(){return this.graphManager},$.prototype.getParent=function(){return this.parent},$.prototype.getLeft=function(){return this.left},$.prototype.getRight=function(){return this.right},$.prototype.getTop=function(){return this.top},$.prototype.getBottom=function(){return this.bottom},$.prototype.isConnected=function(){return this.isConnected},$.prototype.add=function(Q,ne,le){if(ne==null&&le==null){var J=Q;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(J)>-1)throw"Node already in graph!";return J.owner=this,this.getNodes().push(J),J}else{var j=Q;if(!(this.getNodes().indexOf(ne)>-1&&this.getNodes().indexOf(le)>-1))throw"Source or target not in graph!";if(!(ne.owner==le.owner&&ne.owner==this))throw"Both owners must be this graph!";return ne.owner!=le.owner?null:(j.source=ne,j.target=le,j.isInterGraph=!1,this.getEdges().push(j),ne.edges.push(j),le!=ne&&le.edges.push(j),j)}},$.prototype.remove=function(Q){var ne=Q;if(Q instanceof z){if(ne==null)throw"Node is null!";if(!(ne.owner!=null&&ne.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var le=ne.edges.slice(),J,j=le.length,Y=0;Y-1&&V>-1))throw"Source and/or target doesn't know this edge!";J.source.edges.splice(L,1),J.target!=J.source&&J.target.edges.splice(V,1);var te=J.source.owner.getEdges().indexOf(J);if(te==-1)throw"Not in owner's edge list!";J.source.owner.getEdges().splice(te,1)}},$.prototype.updateLeftTop=function(){for(var Q=T.MAX_VALUE,ne=T.MAX_VALUE,le,J,j,Y=this.getNodes(),te=Y.length,L=0;Lle&&(Q=le),ne>J&&(ne=J)}return Q==T.MAX_VALUE?null:(Y[0].getParent().paddingLeft!=null?j=Y[0].getParent().paddingLeft:j=this.margin,this.left=ne-j,this.top=Q-j,new Z(this.left,this.top))},$.prototype.updateBounds=function(Q){for(var ne=T.MAX_VALUE,le=-T.MAX_VALUE,J=T.MAX_VALUE,j=-T.MAX_VALUE,Y,te,L,V,R,W=this.nodes,ce=W.length,pe=0;peY&&(ne=Y),leL&&(J=L),jY&&(ne=Y),leL&&(J=L),j=this.nodes.length){var ce=0;le.forEach(function(pe){pe.owner==Q&&ce++}),ce==this.nodes.length&&(this.isConnected=!0)}},ee.exports=$},function(ee,de,H){var N,T=H(1);function w(S){N=H(5),this.layout=S,this.graphs=[],this.edges=[]}w.prototype.addRoot=function(){var S=this.layout.newGraph(),z=this.layout.newNode(null),U=this.add(S,z);return this.setRootGraph(U),this.rootGraph},w.prototype.add=function(S,z,U,P,Z){if(U==null&&P==null&&Z==null){if(S==null)throw"Graph is null!";if(z==null)throw"Parent node is null!";if(this.graphs.indexOf(S)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(S),S.parent!=null)throw"Already has a parent!";if(z.child!=null)throw"Already has a child!";return S.parent=z,z.child=S,S}else{Z=U,P=z,U=S;var D=P.getOwner(),$=Z.getOwner();if(!(D!=null&&D.getGraphManager()==this))throw"Source not in this graph mgr!";if(!($!=null&&$.getGraphManager()==this))throw"Target not in this graph mgr!";if(D==$)return U.isInterGraph=!1,D.add(U,P,Z);if(U.isInterGraph=!0,U.source=P,U.target=Z,this.edges.indexOf(U)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(U),!(U.source!=null&&U.target!=null))throw"Edge source and/or target is null!";if(!(U.source.edges.indexOf(U)==-1&&U.target.edges.indexOf(U)==-1))throw"Edge already in source and/or target incidency list!";return U.source.edges.push(U),U.target.edges.push(U),U}},w.prototype.remove=function(S){if(S instanceof N){var z=S;if(z.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(z==this.rootGraph||z.parent!=null&&z.parent.graphManager==this))throw"Invalid parent node!";var U=[];U=U.concat(z.getEdges());for(var P,Z=U.length,D=0;D=S.getRight()?z[0]+=Math.min(S.getX()-w.getX(),w.getRight()-S.getRight()):S.getX()<=w.getX()&&S.getRight()>=w.getRight()&&(z[0]+=Math.min(w.getX()-S.getX(),S.getRight()-w.getRight())),w.getY()<=S.getY()&&w.getBottom()>=S.getBottom()?z[1]+=Math.min(S.getY()-w.getY(),w.getBottom()-S.getBottom()):S.getY()<=w.getY()&&S.getBottom()>=w.getBottom()&&(z[1]+=Math.min(w.getY()-S.getY(),S.getBottom()-w.getBottom()));var Z=Math.abs((S.getCenterY()-w.getCenterY())/(S.getCenterX()-w.getCenterX()));S.getCenterY()===w.getCenterY()&&S.getCenterX()===w.getCenterX()&&(Z=1);var D=Z*z[0],$=z[1]/Z;z[0]<$?$=z[0]:D=z[1],z[0]=-1*P[0]*($/2+U),z[1]=-1*P[1]*(D/2+U)},T.decideDirectionsForOverlappingNodes=function(w,S,z){w.getCenterX()D)return z[0]=U,z[1]=_,z[2]=Z,z[3]=W,!1;if(PZ)return z[0]=$,z[1]=P,z[2]=V,z[3]=D,!1;if(UZ?(z[0]=ne,z[1]=le,Me=!0):(z[0]=Q,z[1]=_,Me=!0):at===ke&&(U>Z?(z[0]=$,z[1]=_,Me=!0):(z[0]=J,z[1]=le,Me=!0)),-dt===ke?Z>U?(z[2]=R,z[3]=W,Ye=!0):(z[2]=V,z[3]=L,Ye=!0):dt===ke&&(Z>U?(z[2]=te,z[3]=L,Ye=!0):(z[2]=ce,z[3]=W,Ye=!0)),Me&&Ye)return!1;if(U>Z?P>D?(Ve=this.getCardinalDirection(at,ke,4),Ze=this.getCardinalDirection(dt,ke,2)):(Ve=this.getCardinalDirection(-at,ke,3),Ze=this.getCardinalDirection(-dt,ke,1)):P>D?(Ve=this.getCardinalDirection(-at,ke,1),Ze=this.getCardinalDirection(-dt,ke,3)):(Ve=this.getCardinalDirection(at,ke,2),Ze=this.getCardinalDirection(dt,ke,4)),!Me)switch(Ve){case 1:ht=_,nt=U+-Y/ke,z[0]=nt,z[1]=ht;break;case 2:nt=J,ht=P+j*ke,z[0]=nt,z[1]=ht;break;case 3:ht=le,nt=U+Y/ke,z[0]=nt,z[1]=ht;break;case 4:nt=ne,ht=P+-j*ke,z[0]=nt,z[1]=ht;break}if(!Ye)switch(Ze){case 1:tt=L,it=Z+-Oe/ke,z[2]=it,z[3]=tt;break;case 2:it=ce,tt=D+pe*ke,z[2]=it,z[3]=tt;break;case 3:tt=W,it=Z+Oe/ke,z[2]=it,z[3]=tt;break;case 4:it=R,tt=D+-pe*ke,z[2]=it,z[3]=tt;break}}return!1},T.getCardinalDirection=function(w,S,z){return w>S?z:1+z%4},T.getIntersection=function(w,S,z,U){if(U==null)return this.getIntersection2(w,S,z);var P=w.x,Z=w.y,D=S.x,$=S.y,_=z.x,Q=z.y,ne=U.x,le=U.y,J=void 0,j=void 0,Y=void 0,te=void 0,L=void 0,V=void 0,R=void 0,W=void 0,ce=void 0;return Y=$-Z,L=P-D,R=D*Z-P*$,te=le-Q,V=_-ne,W=ne*Q-_*le,ce=Y*V-te*L,ce===0?null:(J=(L*W-V*R)/ce,j=(te*R-Y*W)/ce,new N(J,j))},T.angleOfVector=function(w,S,z,U){var P=void 0;return w!==z?(P=Math.atan((U-S)/(z-w)),z0?1:T<0?-1:0},N.floor=function(T){return T<0?Math.ceil(T):Math.floor(T)},N.ceil=function(T){return T<0?Math.floor(T):Math.ceil(T)},ee.exports=N},function(ee,de,H){function N(){}N.MAX_VALUE=2147483647,N.MIN_VALUE=-2147483648,ee.exports=N},function(ee,de,H){var N=function(){function P(Z,D){for(var $=0;$"u"?"undefined":N(w);return w==null||S!="object"&&S!="function"},ee.exports=T},function(ee,de,H){function N(_){if(Array.isArray(_)){for(var Q=0,ne=Array(_.length);Q<_.length;Q++)ne[Q]=_[Q];return ne}else return Array.from(_)}var T=H(0),w=H(6),S=H(3),z=H(1),U=H(5),P=H(4),Z=H(17),D=H(27);function $(_){D.call(this),this.layoutQuality=T.QUALITY,this.createBendsAsNeeded=T.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=T.DEFAULT_INCREMENTAL,this.animationOnLayout=T.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=T.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=T.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=T.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new w(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,_!=null&&(this.isRemoteUse=_)}$.RANDOM_SEED=1,$.prototype=Object.create(D.prototype),$.prototype.getGraphManager=function(){return this.graphManager},$.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},$.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},$.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},$.prototype.newGraphManager=function(){var _=new w(this);return this.graphManager=_,_},$.prototype.newGraph=function(_){return new U(null,this.graphManager,_)},$.prototype.newNode=function(_){return new S(this.graphManager,_)},$.prototype.newEdge=function(_){return new z(null,null,_)},$.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},$.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var _;return this.checkLayoutSuccess()?_=!1:_=this.layout(),T.ANIMATE==="during"?!1:(_&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,_)},$.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},$.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var _=this.graphManager.getAllEdges(),Q=0;Q<_.length;Q++)_[Q];for(var ne=this.graphManager.getRoot().getNodes(),Q=0;Q0&&Q;){for(Y.push(L[0]);Y.length>0&&Q;){var V=Y[0];Y.splice(0,1),j.add(V);for(var R=V.getEdges(),J=0;J-1&&L.splice(Oe,1)}j=new Set,te=new Map}}return _},$.prototype.createDummyNodesForBendpoints=function(_){for(var Q=[],ne=_.source,le=this.graphManager.calcLowestCommonAncestor(_.source,_.target),J=0;J<_.bendpoints.length;J++){var j=this.newNode(null);j.setRect(new Point(0,0),new Dimension(1,1)),le.add(j);var Y=this.newEdge(null);this.graphManager.add(Y,ne,j),Q.add(j),ne=j}var Y=this.newEdge(null);return this.graphManager.add(Y,ne,_.target),this.edgeToDummyNodes.set(_,Q),_.isInterGraph()?this.graphManager.remove(_):le.remove(_),Q},$.prototype.createBendpointsFromDummyNodes=function(){var _=[];_=_.concat(this.graphManager.getAllEdges()),_=[].concat(N(this.edgeToDummyNodes.keys())).concat(_);for(var Q=0;Q<_.length;Q++){var ne=_[Q];if(ne.bendpoints.length>0){for(var le=this.edgeToDummyNodes.get(ne),J=0;J=0&&Q.splice(W,1);var ce=te.getNeighborsList();ce.forEach(function(Me){if(ne.indexOf(Me)<0){var Ye=le.get(Me),at=Ye-1;at==1&&V.push(Me),le.set(Me,at)}})}ne=ne.concat(V),(Q.length==1||Q.length==2)&&(J=!0,j=Q[0])}return j},$.prototype.setGraphManager=function(_){this.graphManager=_},ee.exports=$},function(ee,de,H){function N(){}N.seed=1,N.x=0,N.nextDouble=function(){return N.x=Math.sin(N.seed++)*1e4,N.x-Math.floor(N.x)},ee.exports=N},function(ee,de,H){var N=H(4);function T(w,S){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}T.prototype.getWorldOrgX=function(){return this.lworldOrgX},T.prototype.setWorldOrgX=function(w){this.lworldOrgX=w},T.prototype.getWorldOrgY=function(){return this.lworldOrgY},T.prototype.setWorldOrgY=function(w){this.lworldOrgY=w},T.prototype.getWorldExtX=function(){return this.lworldExtX},T.prototype.setWorldExtX=function(w){this.lworldExtX=w},T.prototype.getWorldExtY=function(){return this.lworldExtY},T.prototype.setWorldExtY=function(w){this.lworldExtY=w},T.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},T.prototype.setDeviceOrgX=function(w){this.ldeviceOrgX=w},T.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},T.prototype.setDeviceOrgY=function(w){this.ldeviceOrgY=w},T.prototype.getDeviceExtX=function(){return this.ldeviceExtX},T.prototype.setDeviceExtX=function(w){this.ldeviceExtX=w},T.prototype.getDeviceExtY=function(){return this.ldeviceExtY},T.prototype.setDeviceExtY=function(w){this.ldeviceExtY=w},T.prototype.transformX=function(w){var S=0,z=this.lworldExtX;return z!=0&&(S=this.ldeviceOrgX+(w-this.lworldOrgX)*this.ldeviceExtX/z),S},T.prototype.transformY=function(w){var S=0,z=this.lworldExtY;return z!=0&&(S=this.ldeviceOrgY+(w-this.lworldOrgY)*this.ldeviceExtY/z),S},T.prototype.inverseTransformX=function(w){var S=0,z=this.ldeviceExtX;return z!=0&&(S=this.lworldOrgX+(w-this.ldeviceOrgX)*this.lworldExtX/z),S},T.prototype.inverseTransformY=function(w){var S=0,z=this.ldeviceExtY;return z!=0&&(S=this.lworldOrgY+(w-this.ldeviceOrgY)*this.lworldExtY/z),S},T.prototype.inverseTransformPoint=function(w){var S=new N(this.inverseTransformX(w.x),this.inverseTransformY(w.y));return S},ee.exports=T},function(ee,de,H){function N(D){if(Array.isArray(D)){for(var $=0,_=Array(D.length);$w.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*w.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-w.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT_INCREMENTAL):(D>w.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(w.COOLING_ADAPTATION_FACTOR,1-(D-w.ADAPTATION_LOWER_NODE_LIMIT)/(w.ADAPTATION_UPPER_NODE_LIMIT-w.ADAPTATION_LOWER_NODE_LIMIT)*(1-w.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=w.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},P.prototype.calcSpringForces=function(){for(var D=this.getAllEdges(),$,_=0;_0&&arguments[0]!==void 0?arguments[0]:!0,$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,_,Q,ne,le,J=this.getAllNodes(),j;if(this.useFRGridVariant)for(this.totalIterations%w.GRID_CALCULATION_CHECK_PERIOD==1&&D&&this.updateGrid(),j=new Set,_=0;_Y||j>Y)&&(D.gravitationForceX=-this.gravityConstant*ne,D.gravitationForceY=-this.gravityConstant*le)):(Y=$.getEstimatedSize()*this.compoundGravityRangeFactor,(J>Y||j>Y)&&(D.gravitationForceX=-this.gravityConstant*ne*this.compoundGravityConstant,D.gravitationForceY=-this.gravityConstant*le*this.compoundGravityConstant))},P.prototype.isConverged=function(){var D,$=!1;return this.totalIterations>this.maxIterations/3&&($=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),D=this.totalDisplacement=J.length||Y>=J[0].length)){for(var te=0;teP}}]),z}();ee.exports=S},function(ee,de,H){var N=function(){function S(z,U){for(var P=0;P2&&arguments[2]!==void 0?arguments[2]:1,Z=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,D=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;T(this,S),this.sequence1=z,this.sequence2=U,this.match_score=P,this.mismatch_penalty=Z,this.gap_penalty=D,this.iMax=z.length+1,this.jMax=U.length+1,this.grid=new Array(this.iMax);for(var $=0;$=0;z--){var U=this.listeners[z];U.event===w&&U.callback===S&&this.listeners.splice(z,1)}},T.emit=function(w,S){for(var z=0;zU.coolingFactor*U.maxNodeDisplacement&&(this.displacementX=U.coolingFactor*U.maxNodeDisplacement*w.sign(this.displacementX)),Math.abs(this.displacementY)>U.coolingFactor*U.maxNodeDisplacement&&(this.displacementY=U.coolingFactor*U.maxNodeDisplacement*w.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),U.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},S.prototype.propogateDisplacementToChildren=function(U,P){for(var Z=this.getChild().getNodes(),D,$=0;$0)this.positionNodesRadially(L);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var V=new Set(this.getAllNodes()),R=this.nodesWithGravity.filter(function(W){return V.has(W)});this.graphManager.setAllNodesToApplyGravitation(R),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},Y.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%Z.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 L=new Set(this.getAllNodes()),V=this.nodesWithGravity.filter(function(ce){return L.has(ce)});this.graphManager.setAllNodesToApplyGravitation(V),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=Z.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=Z.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var R=!this.isTreeGrowing&&!this.isGrowthFinished,W=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(R,W),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},Y.prototype.getPositionsData=function(){for(var L=this.graphManager.getAllNodes(),V={},R=0;R1){var Me;for(Me=0;MeW&&(W=Math.floor(Oe.y)),pe=Math.floor(Oe.x+P.DEFAULT_COMPONENT_SEPERATION)}this.transform(new _(D.WORLD_CENTER_X-Oe.x/2,D.WORLD_CENTER_Y-Oe.y/2))},Y.radialLayout=function(L,V,R){var W=Math.max(this.maxDiagonalInTree(L),P.DEFAULT_RADIAL_SEPARATION);Y.branchRadialLayout(V,null,0,359,0,W);var ce=J.calculateBounds(L),pe=new j;pe.setDeviceOrgX(ce.getMinX()),pe.setDeviceOrgY(ce.getMinY()),pe.setWorldOrgX(R.x),pe.setWorldOrgY(R.y);for(var Oe=0;Oe1;){var tt=it[0];it.splice(0,1);var yt=ke.indexOf(tt);yt>=0&&ke.splice(yt,1),nt--,Ve--}V!=null?ht=(ke.indexOf(it[0])+1)%nt:ht=0;for(var wt=Math.abs(W-R)/Ve,Pt=ht;Ze!=Ve;Pt=++Pt%nt){var gt=ke[Pt].getOtherEnd(L);if(gt!=V){var dr=(R+Ze*wt)%360,Wt=(dr+wt)%360;Y.branchRadialLayout(gt,L,dr,Wt,ce+pe,pe),Ze++}}},Y.maxDiagonalInTree=function(L){for(var V=ne.MIN_VALUE,R=0;RV&&(V=ce)}return V},Y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},Y.prototype.groupZeroDegreeMembers=function(){var L=this,V={};this.memberGroups={},this.idToDummyNode={};for(var R=[],W=this.graphManager.getAllNodes(),ce=0;ce"u"&&(V[Me]=[]),V[Me]=V[Me].concat(pe)}Object.keys(V).forEach(function(Ye){if(V[Ye].length>1){var at="DummyCompound_"+Ye;L.memberGroups[at]=V[Ye];var dt=V[Ye][0].getParent(),ke=new z(L.graphManager);ke.id=at,ke.paddingLeft=dt.paddingLeft||0,ke.paddingRight=dt.paddingRight||0,ke.paddingBottom=dt.paddingBottom||0,ke.paddingTop=dt.paddingTop||0,L.idToDummyNode[at]=ke;var Ve=L.getGraphManager().add(L.newGraph(),ke),Ze=dt.getChild();Ze.add(ke);for(var nt=0;nt=0;L--){var V=this.compoundOrder[L],R=V.id,W=V.paddingLeft,ce=V.paddingTop;this.adjustLocations(this.tiledMemberPack[R],V.rect.x,V.rect.y,W,ce)}},Y.prototype.repopulateZeroDegreeMembers=function(){var L=this,V=this.tiledZeroDegreePack;Object.keys(V).forEach(function(R){var W=L.idToDummyNode[R],ce=W.paddingLeft,pe=W.paddingTop;L.adjustLocations(V[R],W.rect.x,W.rect.y,ce,pe)})},Y.prototype.getToBeTiled=function(L){var V=L.id;if(this.toBeTiled[V]!=null)return this.toBeTiled[V];var R=L.getChild();if(R==null)return this.toBeTiled[V]=!1,!1;for(var W=R.getNodes(),ce=0;ce0)return this.toBeTiled[V]=!1,!1;if(pe.getChild()==null){this.toBeTiled[pe.id]=!1;continue}if(!this.getToBeTiled(pe))return this.toBeTiled[V]=!1,!1}return this.toBeTiled[V]=!0,!0},Y.prototype.getNodeDegree=function(L){L.id;for(var V=L.getEdges(),R=0,W=0;WYe&&(Ye=dt.rect.height)}R+=Ye+L.verticalPadding}},Y.prototype.tileCompoundMembers=function(L,V){var R=this;this.tiledMemberPack=[],Object.keys(L).forEach(function(W){var ce=V[W];R.tiledMemberPack[W]=R.tileNodes(L[W],ce.paddingLeft+ce.paddingRight),ce.rect.width=R.tiledMemberPack[W].width,ce.rect.height=R.tiledMemberPack[W].height})},Y.prototype.tileNodes=function(L,V){var R=P.TILING_PADDING_VERTICAL,W=P.TILING_PADDING_HORIZONTAL,ce={rows:[],rowWidth:[],rowHeight:[],width:0,height:V,verticalPadding:R,horizontalPadding:W};L.sort(function(Me,Ye){return Me.rect.width*Me.rect.height>Ye.rect.width*Ye.rect.height?-1:Me.rect.width*Me.rect.height0&&(Oe+=L.horizontalPadding),L.rowWidth[R]=Oe,L.width0&&(Me+=L.verticalPadding);var Ye=0;Me>L.rowHeight[R]&&(Ye=L.rowHeight[R],L.rowHeight[R]=Me,Ye=L.rowHeight[R]-Ye),L.height+=Ye,L.rows[R].push(V)},Y.prototype.getShortestRowIndex=function(L){for(var V=-1,R=Number.MAX_VALUE,W=0;WR&&(V=W,R=L.rowWidth[W]);return V},Y.prototype.canAddHorizontal=function(L,V,R){var W=this.getShortestRowIndex(L);if(W<0)return!0;var ce=L.rowWidth[W];if(ce+L.horizontalPadding+V<=L.width)return!0;var pe=0;L.rowHeight[W]0&&(pe=R+L.verticalPadding-L.rowHeight[W]);var Oe;L.width-ce>=V+L.horizontalPadding?Oe=(L.height+pe)/(ce+V+L.horizontalPadding):Oe=(L.height+pe)/L.width,pe=R+L.verticalPadding;var Me;return L.widthpe&&V!=R){W.splice(-1,1),L.rows[R].push(ce),L.rowWidth[V]=L.rowWidth[V]-pe,L.rowWidth[R]=L.rowWidth[R]+pe,L.width=L.rowWidth[instance.getLongestRowIndex(L)];for(var Oe=Number.MIN_VALUE,Me=0;MeOe&&(Oe=W[Me].height);V>0&&(Oe+=L.verticalPadding);var Ye=L.rowHeight[V]+L.rowHeight[R];L.rowHeight[V]=Oe,L.rowHeight[R]0)for(var Ze=ce;Ze<=pe;Ze++)Ve[0]+=this.grid[Ze][Oe-1].length+this.grid[Ze][Oe].length-1;if(pe0)for(var Ze=Oe;Ze<=Me;Ze++)Ve[3]+=this.grid[ce-1][Ze].length+this.grid[ce][Ze].length-1;for(var nt=ne.MAX_VALUE,ht,it,tt=0;tt0){var Me;Me=j.getGraphManager().add(j.newGraph(),R),this.processChildrenList(Me,V,j)}}},_.prototype.stop=function(){return this.stopped=!0,this};var ne=function(J){J("layout","cose-bilkent",_)};typeof cytoscape<"u"&&ne(cytoscape),de.exports=ne}])})})(ql);var Mp=ql.exports;const Ip=Yl(Mp);var ji=function(){var me=function(j,Y,te,L){for(te=te||{},L=j.length;L--;te[j[L]]=Y);return te},he=[1,4],ee=[1,13],de=[1,12],H=[1,15],N=[1,16],T=[1,20],w=[1,19],S=[6,7,8],z=[1,26],U=[1,24],P=[1,25],Z=[6,7,11],D=[1,6,13,15,16,19,22],$=[1,33],_=[1,34],Q=[1,6,7,11,13,15,16,19,22],ne={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(Y,te,L,V,R,W,ce){var pe=W.length-1;switch(R){case 6:case 7:return V;case 8:V.getLogger().trace("Stop NL ");break;case 9:V.getLogger().trace("Stop EOF ");break;case 11:V.getLogger().trace("Stop NL2 ");break;case 12:V.getLogger().trace("Stop EOF2 ");break;case 15:V.getLogger().info("Node: ",W[pe].id),V.addNode(W[pe-1].length,W[pe].id,W[pe].descr,W[pe].type);break;case 16:V.getLogger().trace("Icon: ",W[pe]),V.decorateNode({icon:W[pe]});break;case 17:case 21:V.decorateNode({class:W[pe]});break;case 18:V.getLogger().trace("SPACELIST");break;case 19:V.getLogger().trace("Node: ",W[pe].id),V.addNode(0,W[pe].id,W[pe].descr,W[pe].type);break;case 20:V.decorateNode({icon:W[pe]});break;case 25:V.getLogger().trace("node found ..",W[pe-2]),this.$={id:W[pe-1],descr:W[pe-1],type:V.getType(W[pe-2],W[pe])};break;case 26:this.$={id:W[pe],descr:W[pe],type:V.nodeType.DEFAULT};break;case 27:V.getLogger().trace("node found ..",W[pe-3]),this.$={id:W[pe-3],descr:W[pe-1],type:V.getType(W[pe-2],W[pe])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:he},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:he},{6:ee,7:[1,10],9:9,12:11,13:de,14:14,15:H,16:N,17:17,18:18,19:T,22:w},me(S,[2,3]),{1:[2,2]},me(S,[2,4]),me(S,[2,5]),{1:[2,6],6:ee,12:21,13:de,14:14,15:H,16:N,17:17,18:18,19:T,22:w},{6:ee,9:22,12:11,13:de,14:14,15:H,16:N,17:17,18:18,19:T,22:w},{6:z,7:U,10:23,11:P},me(Z,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:T,22:w}),me(Z,[2,18]),me(Z,[2,19]),me(Z,[2,20]),me(Z,[2,21]),me(Z,[2,23]),me(Z,[2,24]),me(Z,[2,26],{19:[1,30]}),{20:[1,31]},{6:z,7:U,10:32,11:P},{1:[2,7],6:ee,12:21,13:de,14:14,15:H,16:N,17:17,18:18,19:T,22:w},me(D,[2,14],{7:$,11:_}),me(Q,[2,8]),me(Q,[2,9]),me(Q,[2,10]),me(Z,[2,15]),me(Z,[2,16]),me(Z,[2,17]),{20:[1,35]},{21:[1,36]},me(D,[2,13],{7:$,11:_}),me(Q,[2,11]),me(Q,[2,12]),{21:[1,37]},me(Z,[2,25]),me(Z,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(Y,te){if(te.recoverable)this.trace(Y);else{var L=new Error(Y);throw L.hash=te,L}},parse:function(Y){var te=this,L=[0],V=[],R=[null],W=[],ce=this.table,pe="",Oe=0,Me=0,Ye=2,at=1,dt=W.slice.call(arguments,1),ke=Object.create(this.lexer),Ve={yy:{}};for(var Ze in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ze)&&(Ve.yy[Ze]=this.yy[Ze]);ke.setInput(Y,Ve.yy),Ve.yy.lexer=ke,Ve.yy.parser=this,typeof ke.yylloc>"u"&&(ke.yylloc={});var nt=ke.yylloc;W.push(nt);var ht=ke.options&&ke.options.ranges;typeof Ve.yy.parseError=="function"?this.parseError=Ve.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function it(){var er;return er=V.pop()||ke.lex()||at,typeof er!="number"&&(er instanceof Array&&(V=er,er=V.pop()),er=te.symbols_[er]||er),er}for(var tt,yt,wt,Pt,gt={},dr,Wt,ln,Zr;;){if(yt=L[L.length-1],this.defaultActions[yt]?wt=this.defaultActions[yt]:((tt===null||typeof tt>"u")&&(tt=it()),wt=ce[yt]&&ce[yt][tt]),typeof wt>"u"||!wt.length||!wt[0]){var Sa="";Zr=[];for(dr in ce[yt])this.terminals_[dr]&&dr>Ye&&Zr.push("'"+this.terminals_[dr]+"'");ke.showPosition?Sa="Parse error on line "+(Oe+1)+`: `+ke.showPosition()+` Expecting `+Zr.join(", ")+", got '"+(this.terminals_[tt]||tt)+"'":Sa="Parse error on line "+(Oe+1)+": Unexpected "+(tt==at?"end of input":"'"+(this.terminals_[tt]||tt)+"'"),this.parseError(Sa,{text:ke.match,token:this.terminals_[tt]||tt,line:ke.yylineno,loc:nt,expected:Zr})}if(wt[0]instanceof Array&&wt.length>1)throw new Error("Parse Error: multiple actions possible at state: "+yt+", token: "+tt);switch(wt[0]){case 1:L.push(tt),R.push(ke.yytext),W.push(ke.yylloc),L.push(wt[1]),tt=null,Me=ke.yyleng,pe=ke.yytext,Oe=ke.yylineno,nt=ke.yylloc;break;case 2:if(Wt=this.productions_[wt[1]][1],gt.$=R[R.length-Wt],gt._$={first_line:W[W.length-(Wt||1)].first_line,last_line:W[W.length-1].last_line,first_column:W[W.length-(Wt||1)].first_column,last_column:W[W.length-1].last_column},ht&&(gt._$.range=[W[W.length-(Wt||1)].range[0],W[W.length-1].range[1]]),Pt=this.performAction.apply(gt,[pe,Me,Oe,Ve.yy,wt[1],R,W].concat(dt)),typeof Pt<"u")return Pt;Wt&&(L=L.slice(0,-1*Wt*2),R=R.slice(0,-1*Wt),W=W.slice(0,-1*Wt)),L.push(this.productions_[wt[1]][0]),R.push(gt.$),W.push(gt._$),ln=ce[L[L.length-2]][L[L.length-1]],L.push(ln);break;case 3:return!0}}return!0}},le=function(){var j={EOF:1,parseError:function(te,L){if(this.yy.parser)this.yy.parser.parseError(te,L);else throw new Error(te)},setInput:function(Y,te){return this.yy=te||this.yy||{},this._input=Y,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var Y=this._input[0];this.yytext+=Y,this.yyleng++,this.offset++,this.match+=Y,this.matched+=Y;var te=Y.match(/(?:\r\n?|\n).*/g);return te?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),Y},unput:function(Y){var te=Y.length,L=Y.split(/(?:\r\n?|\n)/g);this._input=Y+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-te),this.offset-=te;var V=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),L.length-1&&(this.yylineno-=L.length-1);var R=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:L?(L.length===V.length?this.yylloc.first_column:0)+V[V.length-L.length].length-L[0].length:this.yylloc.first_column-te},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-te]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(Y){this.unput(this.match.slice(Y))},pastInput:function(){var Y=this.matched.substr(0,this.matched.length-this.match.length);return(Y.length>20?"...":"")+Y.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var Y=this.match;return Y.length<20&&(Y+=this._input.substr(0,20-Y.length)),(Y.substr(0,20)+(Y.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var Y=this.pastInput(),te=new Array(Y.length+1).join("-");return Y+this.upcomingInput()+` `+te+"^"},test_match:function(Y,te){var L,V,R;if(this.options.backtrack_lexer&&(R={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&&(R.yylloc.range=this.yylloc.range.slice(0))),V=Y[0].match(/(?:\r\n?|\n).*/g),V&&(this.yylineno+=V.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:V?V[V.length-1].length-V[V.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+Y[0].length},this.yytext+=Y[0],this.match+=Y[0],this.matches=Y,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(Y[0].length),this.matched+=Y[0],L=this.performAction.call(this,this.yy,this,te,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),L)return L;if(this._backtrack){for(var W in R)this[W]=R[W];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var Y,te,L,V;this._more||(this.yytext="",this.match="");for(var R=this._currentRules(),W=0;Wte[0].length)){if(te=L,V=W,this.options.backtrack_lexer){if(Y=this.test_match(L,R[W]),Y!==!1)return Y;if(this._backtrack){te=!1;continue}else return!1}else if(!this.options.flex)break}return te?(Y=this.test_match(te,R[V]),Y!==!1?Y:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var te=this.next();return te||this.lex()},begin:function(te){this.conditionStack.push(te)},popState:function(){var te=this.conditionStack.length-1;return te>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(te){return te=this.conditionStack.length-1-Math.abs(te||0),te>=0?this.conditionStack[te]:"INITIAL"},pushState:function(te){this.begin(te)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(te,L,V,R){switch(V){case 0:return te.getLogger().trace("Found comment",L.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:te.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return te.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:te.getLogger().trace("end icon"),this.popState();break;case 10:return te.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return te.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return te.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return te.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:te.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return te.getLogger().trace("description:",L.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),te.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),te.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),te.getLogger().trace("node end ...",L.yytext),"NODE_DEND";case 30:return this.popState(),te.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),te.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),te.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),te.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),te.getLogger().trace("node end (("),"NODE_DEND";case 35:return te.getLogger().trace("Long description:",L.yytext),20;case 36:return te.getLogger().trace("Long description:",L.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return j}();ne.lexer=le;function J(){this.yy={}}return J.prototype=ne,ne.Parser=J,new J}();ji.parser=ji;const Rp=ji,on=me=>xp(me,sn());let jt=[],Wl=0,es={};const kp=()=>{jt=[],Wl=0,es={}},Pp=function(me){for(let he=jt.length-1;he>=0;he--)if(jt[he].leveljt.length>0?jt[0]:null,Fp=(me,he,ee,de)=>{Wr.info("addNode",me,he,ee,de);const H=sn(),N={id:Wl++,nodeId:on(he),level:me,descr:on(ee),type:de,children:[],width:sn().mindmap.maxNodeWidth};switch(N.type){case mt.ROUNDED_RECT:N.padding=2*H.mindmap.padding;break;case mt.RECT:N.padding=2*H.mindmap.padding;break;case mt.HEXAGON:N.padding=2*H.mindmap.padding;break;default:N.padding=H.mindmap.padding}const T=Pp(me);if(T)T.children.push(N),jt.push(N);else if(jt.length===0)jt.push(N);else{let w=new Error('There can be only one root. No parent could be found for ("'+N.descr+'")');throw w.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']},w}},mt={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},Gp=(me,he)=>{switch(Wr.debug("In get type",me,he),me){case"[":return mt.RECT;case"(":return he===")"?mt.ROUNDED_RECT:mt.CLOUD;case"((":return mt.CIRCLE;case")":return mt.CLOUD;case"))":return mt.BANG;case"{{":return mt.HEXAGON;default:return mt.DEFAULT}},Kl=(me,he)=>{es[me]=he},zp=me=>{const he=jt[jt.length-1];me&&me.icon&&(he.icon=on(me.icon)),me&&me.class&&(he.class=on(me.class))},Kr=me=>{switch(me){case mt.DEFAULT:return"no-border";case mt.RECT:return"rect";case mt.ROUNDED_RECT:return"rounded-rect";case mt.CIRCLE:return"circle";case mt.CLOUD:return"cloud";case mt.BANG:return"bang";case mt.HEXAGON:return"hexgon";default:return"no-border"}};let Zl;const Vp=me=>{Zl=me},$p=()=>Wr,_p=me=>jt[me],ts=me=>es[me],Up=Object.freeze(Object.defineProperty({__proto__:null,addNode:Fp,clear:kp,decorateNode:zp,getElementById:ts,getLogger:$p,getMindmap:Bp,getNodeById:_p,getType:Gp,nodeType:mt,get parseError(){return Zl},sanitizeText:on,setElementForId:Kl,setErrorHandler:Vp,type2Str:Kr},Symbol.toStringTag,{value:"Module"})),Ql=12,Yp=function(me,he,ee){me.append("path").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("d",`M0 ${he.height-5} v${-he.height+2*5} q0,-5 5,-5 h${he.width-2*5} q5,0 5,5 v${he.height-5} H0 Z`),me.append("line").attr("class","node-line-"+ee).attr("x1",0).attr("y1",he.height).attr("x2",he.width).attr("y2",he.height)},Hp=function(me,he){me.append("rect").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("height",he.height).attr("width",he.width)},Xp=function(me,he){const ee=he.width,de=he.height,H=.15*ee,N=.25*ee,T=.35*ee,w=.2*ee;me.append("path").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("d",`M0 0 a${H},${H} 0 0,1 ${ee*.25},${-1*ee*.1} a${T},${T} 1 0,1 ${ee*.4},${-1*ee*.1} a${N},${N} 1 0,1 ${ee*.35},${1*ee*.2} a${H},${H} 1 0,1 ${ee*.15},${1*de*.35} a${w},${w} 1 0,1 ${-1*ee*.15},${1*de*.65} a${N},${H} 1 0,1 ${-1*ee*.25},${ee*.15} a${T},${T} 1 0,1 ${-1*ee*.5},0 a${H},${H} 1 0,1 ${-1*ee*.25},${-1*ee*.15} a${H},${H} 1 0,1 ${-1*ee*.1},${-1*de*.35} a${w},${w} 1 0,1 ${ee*.1},${-1*de*.65} H0 V0 Z`)},qp=function(me,he){const ee=he.width,de=he.height,H=.15*ee;me.append("path").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("d",`M0 0 a${H},${H} 1 0,0 ${ee*.25},${-1*de*.1} a${H},${H} 1 0,0 ${ee*.25},0 a${H},${H} 1 0,0 ${ee*.25},0 a${H},${H} 1 0,0 ${ee*.25},${1*de*.1} a${H},${H} 1 0,0 ${ee*.15},${1*de*.33} a${H*.8},${H*.8} 1 0,0 0,${1*de*.34} a${H},${H} 1 0,0 ${-1*ee*.15},${1*de*.33} a${H},${H} 1 0,0 ${-1*ee*.25},${de*.15} a${H},${H} 1 0,0 ${-1*ee*.25},0 a${H},${H} 1 0,0 ${-1*ee*.25},0 a${H},${H} 1 0,0 ${-1*ee*.25},${-1*de*.15} a${H},${H} 1 0,0 ${-1*ee*.1},${-1*de*.33} a${H*.8},${H*.8} 1 0,0 0,${-1*de*.34} a${H},${H} 1 0,0 ${ee*.1},${-1*de*.33} H0 V0 Z`)},Wp=function(me,he){me.append("circle").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("r",he.width/2)};function Kp(me,he,ee,de,H){return me.insert("polygon",":first-child").attr("points",de.map(function(N){return N.x+","+N.y}).join(" ")).attr("transform","translate("+(H.width-he)/2+", "+ee+")")}const Zp=function(me,he){const ee=he.height,H=ee/4,N=he.width-he.padding+2*H,T=[{x:H,y:0},{x:N-H,y:0},{x:N,y:-ee/2},{x:N-H,y:-ee},{x:H,y:-ee},{x:0,y:-ee/2}];Kp(me,N,ee,T,he)},Qp=function(me,he){me.append("rect").attr("id","node-"+he.id).attr("class","node-bkg node-"+Kr(he.type)).attr("height",he.height).attr("rx",he.padding).attr("ry",he.padding).attr("width",he.width)},Jp=function(me,he,ee,de){const H=de.htmlLabels,N=ee%(Ql-1),T=me.append("g");he.section=N;let w="section-"+N;N<0&&(w+=" section-root"),T.attr("class",(he.class?he.class+" ":"")+"mindmap-node "+w);const S=T.append("g"),z=T.append("g"),U=he.descr.replace(/()/g,` `);Lp(z,U,{useHtmlLabels:H,width:he.width,classes:"mindmap-node-label"}),H||z.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");const P=z.node().getBBox(),Z=de.fontSize.replace?de.fontSize.replace("px",""):de.fontSize;if(he.height=P.height+Z*1.1*.5+he.padding,he.width=P.width+2*he.padding,he.icon)if(he.type===mt.CIRCLE)he.height+=50,he.width+=50,T.append("foreignObject").attr("height","50px").attr("width",he.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+N+" "+he.icon),z.attr("transform","translate("+he.width/2+", "+(he.height/2-1.5*he.padding)+")");else{he.width+=50;const D=he.height;he.height=Math.max(D,60);const $=Math.abs(he.height-D);T.append("foreignObject").attr("width","60px").attr("height",he.height).attr("style","text-align: center;margin-top:"+$/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+N+" "+he.icon),z.attr("transform","translate("+(25+he.width/2)+", "+($/2+he.padding/2)+")")}else if(H){const D=(he.width-P.width)/2,$=(he.height-P.height)/2;z.attr("transform","translate("+D+", "+$+")")}else{const D=he.width/2,$=he.padding/2;z.attr("transform","translate("+D+", "+$+")")}switch(he.type){case mt.DEFAULT:Yp(S,he,N);break;case mt.ROUNDED_RECT:Qp(S,he);break;case mt.RECT:Hp(S,he);break;case mt.CIRCLE:S.attr("transform","translate("+he.width/2+", "+ +he.height/2+")"),Wp(S,he);break;case mt.CLOUD:Xp(S,he);break;case mt.BANG:qp(S,he);break;case mt.HEXAGON:Zp(S,he);break}return Kl(he.id,T),he.height},jp=function(he,ee,de,H,N){const T=N%(Ql-1),w=de.x+de.width/2,S=de.y+de.height/2,z=ee.x+ee.width/2,U=ee.y+ee.height/2,P=z>w?w+Math.abs(w-z)/2:w-Math.abs(w-z)/2,Z=U>S?S+Math.abs(S-U)/2:S-Math.abs(S-U)/2,D=z>w?Math.abs(w-P)/2+w:-Math.abs(w-P)/2+w,$=U>S?Math.abs(S-Z)/2+S:-Math.abs(S-Z)/2+S;he.append("path").attr("d",de.direction==="TB"||de.direction==="BT"?`M${w},${S} Q${w},${$} ${P},${Z} T${z},${U}`:`M${w},${S} Q${D},${S} ${P},${Z} T${z},${U}`).attr("class","edge section-edge-"+T+" edge-depth-"+H)},ey=function(me){const he=ts(me.id),ee=me.x||0,de=me.y||0;he.attr("transform","translate("+ee+","+de+")")},Jl={drawNode:Jp,positionNode:ey,drawEdge:jp};Xl.use(Ip);function jl(me,he,ee,de){Jl.drawNode(me,he,ee,de),he.children&&he.children.forEach((H,N)=>{jl(me,H,ee<0?N:ee,de)})}function ty(me,he){he.edges().map((ee,de)=>{const H=ee.data();if(ee[0]._private.bodyBounds){const N=ee[0]._private.rscratch;Wr.trace("Edge: ",de,H),me.insert("path").attr("d",`M ${N.startX},${N.startY} L ${N.midX},${N.midY} L${N.endX},${N.endY} `).attr("class","edge section-edge-"+H.section+" edge-depth-"+H.depth)}})}function eu(me,he,ee,de){he.add({group:"nodes",data:{id:me.id,labelText:me.descr,height:me.height,width:me.width,level:de,nodeId:me.id,padding:me.padding,type:me.type},position:{x:me.x,y:me.y}}),me.children&&me.children.forEach(H=>{eu(H,he,ee,de+1),he.add({group:"edges",data:{id:`${me.id}_${H.id}`,source:me.id,target:H.id,depth:de,section:H.section}})})}function ry(me,he){return new Promise(ee=>{const de=ni("body").append("div").attr("id","cy").attr("style","display:none"),H=Xl({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});de.remove(),eu(me,H,he,0),H.nodes().forEach(function(N){N.layoutDimensions=()=>{const T=N.data();return{w:T.width,h:T.height}}}),H.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),H.ready(N=>{Wr.info("Ready",N),ee(H)})})}function ay(me){me.nodes().map((he,ee)=>{const de=he.data();de.x=he.position().x,de.y=he.position().y,Jl.positionNode(de);const H=ts(de.nodeId);Wr.info("Id:",ee,"Position: (",he.position().x,", ",he.position().y,")",de),H.attr("transform",`translate(${he.position().x-de.width/2}, ${he.position().y-de.height/2})`),H.attr("attr",`apa-${ee})`)})}const ny=async(me,he,ee,de)=>{const H=sn();H.htmlLabels=!1,Wr.debug(`Rendering mindmap diagram `+me,de.parser);const N=sn().securityLevel;let T;N==="sandbox"&&(T=ni("#i"+he));const S=(N==="sandbox"?ni(T.nodes()[0].contentDocument.body):ni("body")).select("#"+he);S.append("g");const z=de.db.getMindmap(),U=S.append("g");U.attr("class","mindmap-edges");const P=S.append("g");P.attr("class","mindmap-nodes"),jl(P,z,-1,H);const Z=await ry(z,H);ty(U,Z),ay(Z),Tp(void 0,S,H.mindmap.padding,H.mindmap.useMaxWidth)},iy={draw:ny},sy=me=>{let he="";for(let ee=0;ee` .edge { stroke-width: 3; } ${sy(me)} .section-root rect, .section-root path, .section-root circle, .section-root polygon { fill: ${me.git0}; } .section-root text { fill: ${me.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; } `,ly=oy,hy={db:Up,renderer:iy,parser:Rp,styles:ly};export{hy as diagram};