"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([["93853"],{3399:function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}n.d(t,{Z:()=>lC});var d,p,f,g,v,y,b="undefined"==typeof window?null:window,x=b?b.navigator:null;b&&b.document;var w=r(""),E=r({}),k=r(function(){}),C="undefined"==typeof HTMLElement?"undefined":r(HTMLElement),S=function(e){return e&&e.instanceString&&T(e.instanceString)?e.instanceString():null},D=function(e){return null!=e&&r(e)==w},T=function(e){return null!=e&&r(e)===k},P=function(e){return!A(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},_=function(e){return null!=e&&r(e)===E&&!P(e)&&e.constructor===Object},M=function(e){return null!=e&&r(e)===r(1)&&!isNaN(e)},B=function(e){if("undefined"!==C)return null!=e&&e instanceof HTMLElement},A=function(e){return N(e)||I(e)},N=function(e){return"collection"===S(e)&&e._private.single},I=function(e){return"collection"===S(e)&&!e._private.single},O=function(e){return"core"===S(e)},L=function(e){return"stylesheet"===S(e)},R=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},z=function(e){return null!=e&&r(e)===E&&T(e.then)},V=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},Z=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,i,a,o,s,l,u,c=RegExp("^"+G+"$").exec(e);if(c){if((r=parseInt(c[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(c[2]))<0||i>100||(i/=100,(a=parseFloat(c[3]))<0||a>100)||(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var h=a<.5?a*(1+i):a+i-a*i,d=2*a-h;s=Math.round(255*t(d,h,r+1/3)),l=Math.round(255*t(d,h,r)),u=Math.round(255*t(d,h,r-1/3))}n=[s,l,u,o]}return n},J=function(e){var t,n=RegExp("^"+W+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ee={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]},et=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||h&&r>=a}function g(){var e,n,r,i=el();if(f(i))return v(i);s=setTimeout(g,(e=i-l,n=i-u,r=t-e,h?e_(r,a-n):r))}function v(e){return(s=void 0,d&&r)?p(e):(r=i=void 0,o)}function y(){var e,n=el(),a=f(n);if(r=arguments,i=this,l=n,a){if(void 0===s)return u=e=l,s=setTimeout(g,t),c?p(e):o;if(h)return clearTimeout(s),s=setTimeout(g,t),p(l)}return void 0===s&&(s=setTimeout(g,t)),o}return t=eT(t)||0,er(n)&&(c=!!n.leading,a=(h="maxWait"in n)?eP(eT(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},y.flush=function(){return void 0===s?o:v(el())},y},eB=b?b.performance:null,eA=eB&&eB.now?function(){return eB.now()}:function(){return Date.now()},eN=function(){if(b){if(b.requestAnimationFrame)return function(e){b.requestAnimationFrame(e)};if(b.mozRequestAnimationFrame)return function(e){b.mozRequestAnimationFrame(e)};if(b.webkitRequestAnimationFrame)return function(e){b.webkitRequestAnimationFrame(e)};else if(b.msRequestAnimationFrame)return function(e){b.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(eA())},1e3/60)}}(),eI=function(e){return eN(e)},eO=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=65599*r+t.value|0;return r},eL=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},eR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},ez=function(e){return 2097152*e[0]+e[1]},eV=function(e,t){return[eL(e[0],t[0]),eR(e[1],t[1])]},eF=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return eO({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},e6=function(e){e.splice(0,e.length)},e8=function(e,t){for(var n=0;n2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!O(e)){eQ("An element must have a core reference and parameters set");return}var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r){eQ("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new ti,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];P(t.classes)?l=t.classes:D(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw Error("lo must be non-negative");for(null==a&&(a=e.length);io(t,e[s=r((i+a)/2)])?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),f(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,g(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,g(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&0>r(e[0],t)&&(t=(i=[e[0],t])[0],e[0]=i[1],g(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),s=(function(){u=[];for(var t=0,n=r(e.length/2);0<=n?tn;0<=n?t++:t--)u.push(t);return u}).apply(this).reverse(),l=[],a=0,o=s.length;ar(o=f[h],s)&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,g=c(t,e.length);0<=g?dg;0<=g?++d:--d)v.push(a(e,r));return v},f=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t;){if(0>i(a,o=e[s=r-1>>1])){e[r]=o,r=s;continue}break}return e[r]=a},g=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;ir(e[i],e[s]))&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,f(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=h,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),v=function(){return t},e.exports=v()}).call(ei)}(oW={exports:{}},oW.exports),oW.exports),tu=e4({root:null,weight:function(e){return 1},directed:!1}),tc=e4({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),th=e4({weight:function(e){return 1},directed:!1}),td=e4({weight:function(e){return 1},directed:!1,root:null}),tp=Math.sqrt(2),tf=function(e,t,n){0===n.length&&eQ("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n.length-1;l>=0;l--){var u=n[l],c=u[1],h=u[2];(t[c]===o&&t[h]===s||t[c]===s&&t[h]===o)&&n.splice(l,1)}for(var d=0;dr;)t=tf(Math.floor(Math.random()*t.length),e,t),n--;return t},tv=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},ty=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},tm=function(e){return{x:e[0],y:e[1]}},tb=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,c=Math.floor(u/2);return u%2!=0?e[c+1+o]:(e[c-1+o]+e[c+o])/2},tk=function(e,t){return Math.atan2(t,e)-Math.PI/2},tC=Math.log2||function(e){return Math.log(e)/Math.log(2)},tS=function(e){return e>0?1:e<0?-1:0},tD=function(e,t){return Math.sqrt(tT(e,t))},tT=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},tP=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&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}}},tI=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tO=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},tL=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},tR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tz=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=l(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tV=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},tF=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2t.y2)&&!(t.y1>e.y2)},tj=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},tq=function(e,t){return tj(e,t.x1,t.y1)&&tj(e,t.x2,t.y2)},tX=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?nn(i,a):u,h=i/2,d=a/2,p=(c=Math.min(c,h,d))!==h,f=c!==d;if(p){var g=n-h+c-o,v=r-d-o,y=n+h-c+o;if((s=t4(e,t,n,r,g,v,y,v,!1)).length>0)return s}if(f){var b=n+h+o,x=r-d+c-o,w=r+d-c+o;if((s=t4(e,t,n,r,b,x,b,w,!1)).length>0)return s}if(p){var E=n-h+c-o,k=r+d+o,C=n+h-c+o;if((s=t4(e,t,n,r,E,k,C,k,!1)).length>0)return s}if(f){var S=n-h-o,D=r-d+c-o,T=r+d-c+o;if((s=t4(e,t,n,r,S,D,S,T,!1)).length>0)return s}var P=n-h+c,_=r-d+c;if((l=t5(e,t,n,r,P,_,c+o)).length>0&&l[0]<=P&&l[1]<=_)return[l[0],l[1]];var M=n+h-c,B=r-d+c;if((l=t5(e,t,n,r,M,B,c+o)).length>0&&l[0]>=M&&l[1]<=B)return[l[0],l[1]];var A=n+h-c,N=r+d-c;if((l=t5(e,t,n,r,A,N,c+o)).length>0&&l[0]>=A&&l[1]>=N)return[l[0],l[1]];var I=n-h+c,O=r+d-c;return(l=t5(e,t,n,r,I,O,c+o)).length>0&&l[0]<=I&&l[1]>=O?[l[0],l[1]]:[]},tY=function(e,t,n,r,i,a,o){var s=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),c=Math.max(r,a);return s-o<=e&&e<=l+o&&u-o<=t&&t<=c+o},tW=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(eu.x2)&&!(tu.y2)},tH=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},tG=function(e,t,n,r,i){var a,o,s,l,u,c,h,d;if(0===e&&(e=1e-5),t/=e,n/=e,r/=e,a=(o=(3*n-t*t)/9)*o*o+(s=(-(27*r)+t*(9*n-t*t*2))/54)*s,i[1]=0,h=t/3,a>0){u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,i[5]=-h;return}if(i[5]=i[3]=0,0===a){d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-h+2*d,i[4]=i[2]=-(d+h);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),i[4]=-h+d*Math.cos((l+4*Math.PI)/3)},tU=function(e,t,n,r,i,a,o,s){var l,u=[];tG(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var c=[],h=0;h<6;h+=2)1e-7>Math.abs(u[h+1])&&u[h]>=0&&u[h]<=1&&c.push(u[h]);c.push(1),c.push(0);for(var d=-1,p=0;p=0?ll?(e-i)*(e-i)+(t-a)*(t-a):u-h},tZ=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e)||!(e>=a))&&(!(r<=e)||!(e<=a)))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},t$=function(e,t,n,r,i,a,o,s,l){var u,c,h=Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var d=Math.cos(-u),p=Math.sin(-u),f=0;f0?tJ(t0(h,-l)):h)},tQ=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),u=0;u=0&&f<=1&&v.push(f),g>=0&&g<=1&&v.push(g),0===v.length)return[];var y=v[0]*s[0]+e,b=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,b]:[y,b,v[1]*s[0]+e,v[1]*s[1]+t]:[y,b]},t3=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},t4=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,f=s-a,g=h*d-f*u,v=c*d-p*u,y=f*c-h*p;if(0!==y){var b=g/y,x=v/y;return -.001<=b&&b<=1.001&&-.001<=x&&x<=1.001?[e+b*c,t+b*p]:l?[e+b*c,t+b*p]:[]}return 0!==g&&0!==v?[]:t3(e,n,o)===o?[o,s]:t3(e,n,i)===i?[i,a]:t3(i,o,n)===n?[n,r]:[]},t9=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,f=[],g=Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0?tJ(t0(g,-s)):g}else u=n;for(var b=0;b2){for(var p=[c[0],c[1]],f=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),g=1;gu&&(u=t)},get:function(e){return l[e]}},h=0;h0?b.edgesTo(y)[0]:y.edgesTo(b)[0]);h[y=y.id()]>h[g]+w&&(h[y]=h[g]+w,0>d.nodes.indexOf(y)?d.push(y):d.updateItem(y),u[y]=0,l[y]=[]),h[y]==h[g]+w&&(u[y]=u[y]+u[g],l[y].push(g))}else for(var E=0;E0;){for(var D=n.pop(),T=0;T0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},nE=function(e,t){for(var n=0;n5&&void 0!==arguments[5]?arguments[5]:nS,o=r,s=0;s=2?nB(e,t,n,0,nP,n_):nB(e,t,n,0,nT)},squaredEuclidean:function(e,t,n){return nB(e,t,n,0,nP)},manhattan:function(e,t,n){return nB(e,t,n,0,nT)},max:function(e,t,n){return nB(e,t,n,-1/0,nM)}};function nN(e,t,n,r,i,a){var o;return(o=T(e)?e:nA[e]||nA.euclidean,0===t&&T(e))?o(i,a):o(t,n,r,i,a)}nA["squared-euclidean"]=nA.squaredEuclidean,nA.squaredeuclidean=nA.squaredEuclidean;var nI=e4({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),nO=function(e){return nI(e)},nL=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return nN(e,r.length,a,function(e){return r[e](t)},n,t)},nR=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,l=0;ln)return!1;return!0},nj=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var f=t[s],g=t[r[s]];o="dendrogram"===i.mode?{left:f,right:g,key:f.key}:{value:f.value.concat(g.value),key:f.key},e[f.index]=o,e.splice(g.index,1),t[f.key]=o;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[f.key][y.key],n[f.key][y.key]0&&r.push(i);return r},n6=function(e,t,n){for(var r=[],i=0;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;ul&&(s=u,l=c)}n[i]=a[s]}return n6(e,t,n)},n7=function(e){for(var t,n,r,i,a,o,s,l=this.cy(),u=this.nodes(),c=n5(e),h={},d=0;d=T?(P=T,T=M,_=B):M>P&&(P=M);for(var A=0;A0?1:0;C[s%c.minIterations*t+z]=V,R+=V}if(R>0&&(s>=c.minIterations-1||s==c.maxIterations-1)){for(var F=0,j=0;j1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:i}},rn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n===s||(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},rr={};[ts,{dijkstra:function(e){if(!_(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=tu(e),r=n.root,i=n.weight,a=n.directed,o=this,s=D(r)?this.filter(r)[0]:r[0],l={},u={},c={},h=this.byGroup(),d=h.nodes,p=h.edges;p.unmergeBy(function(e){return e.isLoop()});for(var f=function(e){return l[e.id()]},g=new tl(function(e,t){return f(e)-f(t)}),v=0;v0;){var b=g.pop(),x=f(b);if(c[b.id()]=x,x!==1/0)for(var w=b.neighborhood().intersect(d),E=0;E0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=function(e){for(var t=0;t0;){if(n=(t=g.pop()).id(),v.delete(n),w++,n===h){for(var E=[],k=o,C=h,S=b[C];E.unshift(k),null!=S&&E.unshift(S),null!=(k=y[C]);)S=b[C=k.id()];return{found:!0,distance:d[n],path:this.spawn(E),steps:w}}f[n]=!0;for(var D=t._private.edges,T=0;TS&&(d[C]=S,g[C]=k,v[C]=b),!i){var T=k*l+E;!i&&d[T]>S&&(d[T]=S,g[T]=E,v[T]=b)}}}for(var P=0;P1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],s=r;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,c=l.pred;if(i.unshift(s[0]),s.same(n)&&i.length>0)break;null!=u&&i.unshift(u),s=c}return o.spawn(i)},hasNegativeWeightCycle:p,negativeWeightCycles:f}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/tp);if(i<2){eQ("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],u=0;u1||o>1)&&(l=!0),u[r]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[r].push(e.id())})}else c[r]=[void 0,e.target().id()]}):this.forEach(function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),u[r]=[],e.connectedEdges().forEach(function(e){return u[r].push(e.id())})):c[r]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(l)return h;if(n&&t){if(s){if(r&&n!=r)return h;r=n}else{if(r&&n!=r&&t!=r)return h;r||(r=n)}}else r||(r=this[0].id());var d=function(e){for(var t,n,r,i=e,a=[e];u[i].length;)n=c[t=u[i].shift()][0],i!=(r=c[t][1])?(u[r]=u[r].filter(function(e){return e!=t}),i=r):s||i==n||(u[n]=u[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},p=[],f=[];for(f=d(r);1!=f.length;)0==u[f[0]].length?(p.unshift(this.getElementById(f.shift())),p.unshift(this.getElementById(f.shift()))):f=d(f.shift()).concat(f);for(var g in p.unshift(this.getElementById(f.shift())),u)if(u[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},{hopcroftTarjanBiconnected:rt,htbc:rt,htb:rt,hopcroftTarjanBiconnectedComponents:rt},{tarjanStronglyConnected:rn,tsc:rn,tscc:rn,tarjanStronglyConnectedComponents:rn}].forEach(function(e){Z(rr,e)});var ri=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};ri.prototype={fulfill:function(e){return ra(this,1,"fulfillValue",e)},reject:function(e){return ra(this,2,"rejectReason",e)},then:function(e,t){var n=new ri;return this.onFulfilled.push(rl(e,n,"fulfill")),this.onRejected.push(rl(t,n,"reject")),ro(this),n.proxy}};var ra=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,ro(e)),e},ro=function(e){1===e.state?rs(e,"onFulfilled",e.fulfillValue):2===e.state&&rs(e,"onRejected",e.rejectReason)},rs=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e-1},rL.prototype.set=function(e,t){var n=this.__data__,r=rI(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var rR=rP(es,"Map"),rz=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},rV=function(e,t){var n=e.__data__;return rz(t)?n["string"==typeof t?"string":"hash"]:n.map};function rF(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){P(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};ir.className=ir.classNames=ir.classes;var ii={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:Y,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};ii.variable="(?:[\\w-.]|(?:\\\\"+ii.metaChar+"))+",ii.className="(?:[\\w-]|(?:\\\\"+ii.metaChar+"))+",ii.value=ii.string+"|"+ii.number,ii.id=ii.variable,function(){var e,t,n;for(n=0,e=ii.comparatorOp.split("|");n=0)&&"="!==t&&(ii.comparatorOp+="|\\!"+t)}();var ia=function(){return{checks:[]}},io={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},is=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*K(e.selector,t.selector)}),il=function(){for(var e,t={},n=0;n=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e0&&l.edgeCount>0)return e0("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return e0("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&e0("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},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return D(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case io.GROUP:var l=e(s);return l.substring(0,l.length-1);case io.DATA_COMPARE:return"["+r.field+n(e(r.operator))+t(s)+"]";case io.DATA_BOOL:var u=r.operator,c=r.field;return"["+e(u)+c+"]";case io.DATA_EXIST:return"["+r.field+"]";case io.META_COMPARE:var h=r.operator;return"[["+r.field+n(e(h))+t(s)+"]]";case io.STATE:return s;case io.ID:return"#"+s;case io.CLASS:return"."+s;case io.PARENT:case io.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case io.ANCESTOR:case io.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case io.COMPOUND_SPLIT:var d=i(r.left,a),p=i(r.subject,a),f=i(r.right,a);return d+(d.length>0?" ":"")+p+f;case io.TRUE:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o1&&o0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function iT(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1)||void 0===arguments[1]||arguments[1];return iD(this,e,t,iT)},iS.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iD(this,e,t,iP)},iS.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return iD(this,e,t,i_)},iS.ancestors=iS.parents,(oZ=o$={data:ie.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:ie.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ie.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ie.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ie.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ie.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=oZ.data,oZ.removeAttr=oZ.removeData;var iM={};function iB(e){return function(t){if(void 0===t&&(t=!0),0!==this.length){if(!(!this.isNode()||this.removed())){for(var n=0,r=this[0],i=r._private.edges,a=0;at}),minIndegree:iA("indegree",function(e,t){return et}),minOutdegree:iA("outdegree",function(e,t){return et})}),Z(iM,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0;c&&(u=u[0]);var h=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+h[e]):void 0!==i&&l.position({x:i.x+h.x,y:i.y+h.y})}else{var d=n.position(),p=o?n.parent():null,f=p&&p.length>0;f&&(p=p[0]);var g=f?p.position():{x:0,y:0};return(i={x:d.x-g.x,y:d.y-g.y},void 0===e)?i:i[e]}}else if(!a)return;return this}}).modelPosition=oQ.point=oQ.position,oQ.modelPositions=oQ.points=oQ.positions,oQ.renderedPoint=oQ.renderedPosition,oQ.relativePoint=oQ.relativePosition,o0=o1={},o1.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},o1.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this},o1.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,f=y(i.height.val-a.h,u,c),g=f.biasDiff,v=f.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"===n.units)switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if("px"===n.units)return n.pfValue;else return 0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-g+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}(r),t.batching()||(i.compoundBoundsClean=!0))}return this};var iO=function(e){return e===1/0||e===-1/0?0:e},iL=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},iR=function(e,t){return null==t?e:iL(e,t.x1,t.y1,t.x2,t.y2)},iz=function(e,t,n){return e7(e,t,n)},iV=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tR(u,1),iL(e,u.x1,u.y1,u.x2,u.y2)}}},iF=function(e,t,n){if(!t.cy().headless()){a=n?n+"-":"";var r=t._private,i=r.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=iz(i,"labelWidth",n),p=iz(i,"labelHeight",n),f=iz(i,"labelX",n),g=iz(i,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue/2,k=t.pstyle("text-background-padding").pfValue,C=d/2,S=p/2;if(b)o=f-C,s=f+C,l=g-S,u=g+S;else{switch(c.value){case"left":o=f-d,s=f;break;case"center":o=f-C,s=f+C;break;case"right":o=f,s=f+d}switch(h.value){case"top":l=g-p,u=g;break;case"center":l=g-S,u=g+S;break;case"bottom":l=g,u=g+p}}o+=v-Math.max(w,E)-k-2,s+=v+Math.max(w,E)+k+2,l+=y-Math.max(w,E)-k-2,u+=y+Math.max(w,E)+k+2;var D=n||"main",T=r.labelBounds,P=T[D]=T[D]||{};P.x1=o,P.y1=l,P.x2=s,P.y2=u,P.w=s-o,P.h=u-l;var _=b&&"autorotate"===x.strValue,M=null!=x.pfValue&&0!==x.pfValue;if(_||M){var B=_?iz(r.rstyle,"labelAngle",n):x.pfValue,A=Math.cos(B),N=Math.sin(B),I=(o+s)/2,O=(l+u)/2;if(!b){switch(c.value){case"left":I=s;break;case"right":I=o}switch(h.value){case"top":O=u;break;case"bottom":O=l}}var L=function(e,t){return{x:(e-=I)*A-(t-=O)*N+I,y:e*N+t*A+O}},R=L(o,l),z=L(o,u),V=L(s,l),F=L(s,u);o=Math.min(R.x,z.x,V.x,F.x),s=Math.max(R.x,z.x,V.x,F.x),l=Math.min(R.y,z.y,V.y,F.y),u=Math.max(R.y,z.y,V.y,F.y)}var j=D+"Rot",q=T[j]=T[j]||{};q.x1=o,q.y1=l,q.x2=s,q.y2=u,q.w=s-o,q.h=u-l,iL(e,o,l,s,u),iL(r.labelBounds.all,o,l,s,u)}return e}},ij=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,u=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,u=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,u=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,u=-(.5*o));var c=e.h*l-e.h,h=e.w*s-e.w;if(tz(e,[Math.ceil(c/2),Math.ceil(h/2)]),0!==u){var d,p=(d=u,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+d,y2:e.y2+d,w:e.w,h:e.h});tO(e,p)}}}},iq=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=tN(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&r?e.pstyle("bounds-expansion").pfValue:[0],h=function(e){return"none"!==e.pstyle("display").value},d=!r||h(e)&&(!l||h(e.source())&&h(e.target()));if(d){var p=0,f=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var g=0,v=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(v=e.pstyle("underlay-padding").value);var y=Math.max(f,v),b=0,x=0;if(r&&(x=e.pstyle("width").pfValue/2),s&&t.includeNodes){var w=e.position();P=w.x,_=w.y;var E=e.outerWidth()/2,k=e.outerHeight()/2;C=P-E,S=P+E,iL(a,C,D=_-k,S,T=_+k),r&&t.includeOutlines&&ij(a,e)}else if(l&&t.includeEdges){if(r&&!i){var C,S,D,T,P,_,M,B=e.pstyle("curve-style").strValue;if(C=Math.min(u.srcX,u.midX,u.tgtX),S=Math.max(u.srcX,u.midX,u.tgtX),D=Math.min(u.srcY,u.midY,u.tgtY),T=Math.max(u.srcY,u.midY,u.tgtY),C-=x,S+=x,iL(a,C,D-=x,S,T+=x),"haystack"===B){var A=u.haystackPts;if(A&&2===A.length){if(C=A[0].x,D=A[0].y,S=A[1].x,T=A[1].y,C>S){var N=C;C=S,S=N}if(D>T){var I=D;D=T,T=I}iL(a,C-x,D-x,S+x,T+x)}}else if("bezier"===B||"unbundled-bezier"===B||B.endsWith("segments")||B.endsWith("taxi")){switch(B){case"bezier":case"unbundled-bezier":M=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":M=u.linePts}if(null!=M)for(var O=0;OS){var V=C;C=S,S=V}if(D>T){var F=D;D=T,T=F}C-=x,S+=x,iL(a,C,D-=x,S,T+=x)}}if(r&&t.includeEdges&&l&&(iV(a,e,"mid-source"),iV(a,e,"mid-target"),iV(a,e,"source"),iV(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var j=e.pstyle("ghost-offset-x").pfValue,q=e.pstyle("ghost-offset-y").pfValue;iL(a,a.x1+j,a.y1+q,a.x2+j,a.y2+q)}var X=o.bodyBounds=o.bodyBounds||{};tV(X,a),tz(X,c),tR(X,1),r&&(C=a.x1,S=a.x2,D=a.y1,T=a.y2,iL(a,C-y,D-y,S+y,T+y));var Y=o.overlayBounds=o.overlayBounds||{};tV(Y,a),tz(Y,c),tR(Y,1);var W=o.labelBounds=o.labelBounds||{};null!=W.all?tI(W.all):W.all=tN(),r&&t.includeLabels&&(t.includeMainLabels&&iF(a,e,null),l&&(t.includeSourceLabels&&iF(a,e,"source"),t.includeTargetLabels&&iF(a,e,"target")))}return a.x1=iO(a.x1),a.y1=iO(a.y1),a.x2=iO(a.x2),a.y2=iO(a.y2),a.w=iO(a.x2-a.x1),a.h=iO(a.y2-a.y1),a.w>0&&a.h>0&&d&&(tz(a,c),tR(a,1)),a},iX=function(e){var t,n=0,r=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:i6,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},i7.removeAllListeners=function(){return this.removeListener("*")},i7.emit=i7.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,P(t)||(t=[t]),an(this,function(e,a){null!=n&&(i=(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}]).length);for(var o=0;o1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&D(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1)||void 0===arguments[1]||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(_(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(D(e)){if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),aC.neighbourhood=aC.neighborhood,aC.closedNeighbourhood=aC.closedNeighborhood,aC.openNeighbourhood=aC.openNeighborhood,Z(aC,{source:iC(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:iC(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:aP({attr:"source"}),targets:aP({attr:"target"})}),Z(aC,{edgesWith:iC(a_(),"edgesWith"),edgesTo:iC(a_({thisIsSrc:!0}),"edgesTo")}),Z(aC,{connectedEdges:iC(function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),aC.componentsOf=aC.components;var aB=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e){eQ("A collection must have a reference to the core");return}var i=new tn,a=!1;if(t){if(t.length>0&&_(t[0])&&!N(t[0])){a=!0;for(var o=[],s=new ti,l=0,u=t.length;l0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o0){for(var N,I,O,L=N.length===this.length?this:new aB(n,N),z=0;z0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],r={},i=this._private.cy,a=0,o=this.length;a0&&(e?x.emitAndNotify("remove"):t&&x.emit("remove"));for(var w=0;w1e-4&&Math.abs(v.v)>1e-4;);return f?function(e){return b[e*(b.length-1)|0]}:x}}(),aI=function(e,t,n,r){var i=function(e,t,n,r){var i="undefined"!=typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var o=i?new Float32Array(11):Array(11);function s(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function l(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var u=!1,c=function(i){return(u||(u=!0,(e!==t||n!==r)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,n)}()),e===t&&n===r)?i:0===i?0:1===i?1:s(function(t){for(var r=0,i=1;10!==i&&o[i]<=t;++i)r+=.1;var a=r+(t-o[--i])/(o[i+1]-o[i])*.1,u=l(a,e,n);return u>=.001?function(t,r){for(var i=0;i<4;++i){var a=l(r,e,n);if(0===a)break;var o=s(r,e,n)-t;r-=o/a}return r}(t,a):0===u?a:function(t,r,i){var a,o,l=0;do(a=s(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o;while(Math.abs(a)>1e-7&&++l<10);return o}(t,r,r+.1)}(i),t,r)};c.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var h="generateBezier("+[e,t,n,r]+")";return c.toString=function(){return h},c}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},aO={linear:function(e,t,n){return e+(t-e)*n},ease:aI(.25,.1,.25,1),"ease-in":aI(.42,0,1,1),"ease-out":aI(0,0,.58,1),"ease-in-out":aI(.42,0,.58,1),"ease-in-sine":aI(.47,0,.745,.715),"ease-out-sine":aI(.39,.575,.565,1),"ease-in-out-sine":aI(.445,.05,.55,.95),"ease-in-quad":aI(.55,.085,.68,.53),"ease-out-quad":aI(.25,.46,.45,.94),"ease-in-out-quad":aI(.455,.03,.515,.955),"ease-in-cubic":aI(.55,.055,.675,.19),"ease-out-cubic":aI(.215,.61,.355,1),"ease-in-out-cubic":aI(.645,.045,.355,1),"ease-in-quart":aI(.895,.03,.685,.22),"ease-out-quart":aI(.165,.84,.44,1),"ease-in-out-quart":aI(.77,0,.175,1),"ease-in-quint":aI(.755,.05,.855,.06),"ease-out-quint":aI(.23,1,.32,1),"ease-in-out-quint":aI(.86,0,.07,1),"ease-in-expo":aI(.95,.05,.795,.035),"ease-out-expo":aI(.19,1,.22,1),"ease-in-out-expo":aI(1,0,0,1),"ease-in-circ":aI(.6,.04,.98,.335),"ease-out-circ":aI(.075,.82,.165,1),"ease-in-out-circ":aI(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return aO.linear;var r=aN(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":aI};function aL(e,t,n,r,i){if(1===r||t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function aR(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function az(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=aR(e,i),s=aR(t,i);if(M(o)&&M(s))return aL(a,o,s,n,r);if(P(o)&&P(s)){for(var l=[],u=0;u=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;if(d.stopped){a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames);continue}(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||function(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}(0,h,e),function(e,t,n,r){var i,a,o,s,l=!r,u=e._private,c=t._private,h=c.easing,d=c.startTime,p=(r?e:e.cy()).style();!c.easingImpl&&(null==h?c.easingImpl=aO.linear:(i=D(h)?p.parse("transition-timing-function",h).value:h,D(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(c.duration),c.easingImpl=aO[a].apply(null,o)):c.easingImpl=aO[a]));var f=c.easingImpl;if(s=0===c.duration?1:(n-d)/c.duration,c.applying&&(s=c.progress),s<0?s=0:s>1&&(s=1),null==c.delay){var g=c.startPosition,v=c.position;if(v&&l&&!e.locked()){var y={};aV(g.x,v.x)&&(y.x=az(g.x,v.x,s,f)),aV(g.y,v.y)&&(y.y=az(g.y,v.y,s,f)),e.position(y)}var b=c.startPan,x=c.pan,w=u.pan,E=null!=x&&r;E&&(aV(b.x,x.x)&&(w.x=az(b.x,x.x,s,f)),aV(b.y,x.y)&&(w.y=az(b.y,x.y,s,f)),e.emit("pan"));var k=c.startZoom,C=c.zoom,S=null!=C&&r;S&&(aV(k,C)&&(u.zoom=tA(u.minZoom,az(k,C,s,f),u.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var T=c.style;if(T&&T.length>0&&l){for(var P=0;P0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var aj={animate:ie.animate(),animation:ie.animation(),animated:ie.animated(),clearQueue:ie.clearQueue(),delay:ie.delay(),delayAnimation:ie.delayAnimation(),stop:ie.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){aF(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&eI(function(n){aF(n,e),t()})}()}}},aq={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&N(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},aX=function(e){return D(e)?new iw(e):e},aY={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new i8(aq,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,aX(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,aX(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,aX(t),n),this},once:function(e,t,n){return this.emitter().one(e,aX(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};ie.eventAliasesOn(aY);var aW={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};aW.jpeg=aW.jpg;var aH={layout:function(e){if(null==e){eQ("Layout options must be specified to make a layout");return}if(null==e.name){eQ("A `name` must be specified to make a layout");return}var t,n=e.name,r=this.extension("layout",n);if(null==r){eQ("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}return t=D(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(Z({},e,{cy:this,eles:t}))}};aH.createLayout=aH.makeLayout=aH.layout;var aG=e4({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),aU={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t){eQ("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}void 0!==e.wheelSensitivity&&e0("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=aG(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};aU.invalidateDimensions=aU.resize;var aK={collection:function(e,t){return D(e)?this.$(e):A(e)?e.collection():P(e)?(t||(t={}),new aB(this,e,t.unique,t.removed)):new aB(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};aK.elements=aK.filter=aK.$;var aZ={};aZ.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(h||c&&d){var p=void 0;h&&d?p=l.properties:h?p=l.properties:d&&(p=l.mappedProperties);for(var f=0;f1&&(v=1),o.color){var E=r.valueMin[0],k=r.valueMax[0],C=r.valueMin[1],S=r.valueMax[1],D=r.valueMin[2],T=r.valueMax[2],P=null==r.valueMin[3]?1:r.valueMin[3],_=[Math.round(E+(k-E)*v),Math.round(C+(S-C)*v),Math.round(D+(T-D)*v),Math.round(P+((null==r.valueMax[3]?1:r.valueMax[3])-P)*v)];g={bypass:r.bypass,name:r.name,value:_,strValue:"rgb("+_[0]+", "+_[1]+", "+_[2]+")"}}else{if(!o.number)return!1;var B=r.valueMin+(r.valueMax-r.valueMin)*v;g=this.parse(r.name,B,r.bypass,h)}if(!g)return f(),!1;g.mapping=r,r=g;break;case a.data:for(var A=r.field.split("."),N=c.data,I=0;I0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},aZ.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},aZ.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},aZ.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&"curve-style"===t&&("bezier"===n||"bezier"===r)&&e.parallelEdges().forEach(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&"display"===t&&("none"===n||"none"===r)&&e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},aZ.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var a$={};a$.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){e0("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new iw(l).invalid){e0("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var h=[];!n.match(/^\s*$/);){var d=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){e0("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=d[0];var p=d[1],f=d[2];if(!this.properties[p]){e0("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(p,f)){e0("Skipping property: Invalid property definition in: "+r),o();continue}h.push({name:p,val:f}),o()}if(c){a();break}this.selector(l);for(var g=0;g=7&&"d"===t[0]&&(g=new RegExp(o.data.regex).exec(t))){if(n)return!1;var u=o.data;return{name:e,value:g,strValue:""+t,mapped:u,field:g[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var c=o.mapData;if(!(l.color||l.number))return!1;var h=this.parse(e,v[4]);if(!h||h.mapped)return!1;var d=this.parse(e,v[5]);if(!d||d.mapped)return!1;if(h.pfValue===d.pfValue||h.strValue===d.strValue)return e0("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+h.strValue+"`"),this.parse(e,h.strValue);if(l.color){var p=h.value,f=d.value;if(p[0]===f[0]&&p[1]===f[1]&&p[2]===f[2]&&(p[3]===f[3]||(null==p[3]||1===p[3])&&(null==f[3]||1===f[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:h.value,valueMax:d.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(y=s?t.split(/\s+/):P(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var g,v,y,b=[],x=[],w=[],E="",k=!1,C=0;C0?" ":"")+S.strValue}return l.validate&&!l.validate(b,x)?null:l.singleEnum&&k?1===b.length&&D(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var _=function(){for(var r=0;rl.max||l.strictMax&&t===l.max))return null;var L={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return l.unitless||"px"!==A&&"em"!==A?L.pfValue=t:L.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,("ms"===A||"s"===A)&&(L.pfValue="ms"===A?t:1e3*t),("deg"===A||"rad"===A)&&(L.pfValue="rad"===A?t:Math.PI*t/180),"%"===A&&(L.pfValue=t/100),L}if(l.propList){var R=[],z=""+t;if("none"===z);else{for(var V=z.split(/\s*,\s*|\s+/),j=0;j0&&l>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){i=(i=(i=Math.min((s-2*t)/r.w,(l-2*t)/r.h))>this._private.maxZoom?this._private.maxZoom:i)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),M(e)?n=e:_(e)&&(n=e.level,null!=e.position?t=tv(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;M(l.x)&&(t.pan.x=l.x,o=!1),M(l.y)&&(t.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 t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(D(e)){var n=e;e=this.mutableElements().filter(n)}else A(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};a9.centre=a9.center,a9.autolockNodes=a9.autolock,a9.autoungrabifyNodes=a9.autoungrabify;var a6={data:ie.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ie.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ie.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ie.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};a6.attr=a6.data,a6.removeAttr=a6.removeData;var a8=function(e){var t=this,n=(e=Z({},e)).container;n&&!B(n)&&B(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{}).cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==b&&void 0!==n&&!e.headless,o=e;o.layout=Z({name:a?"grid":"null"},o.layout),o.renderer=Z({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new aB(this),listeners:[],aniEles:new aB(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:M(o.zoom)?o.zoom:1,pan:{x:_(o.pan)&&M(o.pan.x)?o.pan.x:0,y:_(o.pan)&&M(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=Z({},o,o.renderer);t.initRenderer(u);var c=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(_(e)||P(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=Z({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(z))return rc.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),c(a,function(){t.startAnimationLoop(),l.ready=!0,T(o.ready)&&t.on("ready",o.ready);for(var e=0;e0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0,s=tN(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(A(t.roots))e=t.roots;else if(P(t.roots)){for(var l=[],u=0;u0;){var _=C.shift(),M=function(e,n){for(var i=on(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l0&&f[0].length<=3?u/2:0),h=2*Math.PI/f[r].length*i;return 0===r&&1===f[0].length&&(c=1),{x:W.x+c*Math.cos(h),y:W.y+c*Math.sin(h)}}),this};var oa={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oo(e){this.options=Z({},oa,e)}oo.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=tN(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),u=0,c=0;c1&&t.avoidOverlap){var d=Math.cos(l)-1,p=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(d*d+p*p)),e)}return r.nodes().layoutPositions(this,t,function(n,r){var a=t.startAngle+r*l*(i?1:-1),o=e*Math.cos(a),u=e*Math.sin(a);return{x:s.x+o,y:s.y+u}}),this};var os={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ol(e){this.options=Z({},os,e)}ol.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,r=e.eles,i=r.nodes().not(":parent"),a=tN(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,u=0;u0&&Math.abs(v[0].value-b.value)>=f&&(v=[],g.push(v)),v.push(b)}var x=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,E=(Math.min(a.w,a.h)/2-x)/(g.length+w?1:0);x=Math.min(x,E)}for(var k=0,C=0;C1&&e.avoidOverlap){var P=Math.cos(T)-1,_=Math.sin(T)-0;k=Math.max(Math.sqrt(x*x/(P*P+_*_)),k)}S.r=k,k+=x}if(e.equidistant){for(var M=0,B=0,A=0;A=e.numIter)&&(oy(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),eI(t)):(o_(r,e),s())}();else{for(;u;)u=o(l),l++;o_(r,e),s()}return this},oc.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},oc.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var oh=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=tN(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(C);for(var u=0;ur.count?0:r.graph},op=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,c=s*a/l;else var h=oE(e,i,a),d=oE(t,-1*i,-1*a),p=d.x-h.x,f=d.y-h.y,g=p*p+f*f,l=Math.sqrt(g),s=(e.nodeRepulsion+t.nodeRepulsion)/g,u=s*p/l,c=s*f/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},ow=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},oE=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2):0>n&&(s<=-1*l||s>=l)&&(u.x=r-a*t/2/n,u.y=i-a/2),u},ok=function(e,t){for(var n=0;n1){var f=t.gravity*h/p,g=t.gravity*d/p;c.offsetX+=f,c.offsetY+=g}}}}},oS=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},oP=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;if((null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopg&&(d+=f+t.componentSpacing,h=0,p=0,f=0)}}},oM={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oB(e){this.options=Z({},oM,e)}oB.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().not(":parent");e.sort&&(r=r.sort(e.sort));var i=tN(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},c=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},h=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=h&&null!=d)s=h,l=d;else if(null!=h&&null==d)l=Math.ceil(a/(s=h));else if(null==h&&null!=d)s=Math.ceil(a/(l=d));else if(l*s>a){var p=u(),f=c();(p-1)*f>=a?u(p-1):(f-1)*p>=a&&c(f-1)}else for(;l*s=a?c(v+1):u(g+1)}var y=i.w/l,b=i.h/s;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var x=0;x=l&&(B=0,M++)},N={},I=0;I=0;x--){var w=l[x];w.isNode()?y(w)||b(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,c=n.pstyle("arrow-scale").value,p=l/2+d,f=p*p,g=2*p,b=i.source,x=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var w=a.allpts,E=0;E+3(r=tK(e,t,w[E],w[E+1],w[E+2],w[E+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var w=a.allpts,E=0;E+5(r=tU(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return v(n,r),!0}for(var b=b||i.source,x=x||i.target,k=o.getArrowWidth(l,c),C=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],E=0;E0&&(y(b),y(x))}(w)||b(w)||b(w,"source")||b(w,"target")}return u},oX.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=o,n=s;for(var c=tN({x1:e,y1:t=l,x2:n,y2:r=u}),h=0;h0?-(Math.PI-e.ang):Math.PI+e.ang},sd=function(e,t,n,r,i){if(e!==v?sc(t,e,sl):sh(su,sl),sc(t,n,su),o8=sl.nx*su.ny-sl.ny*su.nx,o7=sl.nx*su.nx- -(sl.ny*su.ny),1e-6>Math.abs(sn=Math.asin(Math.max(-1,Math.min(1,o8))))){o9=t.x,o6=t.y,si=so=0;return}se=1,st=!1,o7<0?sn<0?sn=Math.PI+sn:(sn=Math.PI-sn,se=-1,st=!0):sn>0&&(se=-1,st=!0),so=void 0!==t.radius?t.radius:r,sr=sn/2,ss=Math.min(sl.len/2,su.len/2),si=i?(sa=Math.abs(Math.cos(sr)*so/Math.sin(sr)))>ss?Math.abs((sa=ss)*Math.sin(sr)/Math.cos(sr)):so:Math.abs((sa=Math.min(ss,so))*Math.sin(sr)/Math.cos(sr)),f=t.x+su.nx*sa,g=t.y+su.ny*sa,o9=f-su.ny*si*se,o6=g+su.nx*si*se,d=t.x+sl.nx*sa,p=t.y+sl.ny*sa,v=t};function sp(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function sf(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(sd(e,t,n,r,i),{cx:o9,cy:o6,radius:si,startX:d,startY:p,stopX:f,stopY:g,startAngle:sl.ang+Math.PI/2*se,endAngle:su.ang-Math.PI/2*se,counterClockwise:st})}var sg={};function sv(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},D=S(k,g?(h+p)/2:0),T=S(C,g?(d+f)/2:0),P=!1;"auto"===y?v=Math.abs(D)>Math.abs(T)?a:i:y===u||y===l?(v=i,P=!0):(y===o||y===s)&&(v=a,P=!0);var _=v===i,M=_?T:D,B=_?C:k,A=tS(B),N=!1;!(P&&(x||w<0))&&(y===l&&B<0||y===u&&B>0||y===o&&B>0||y===s&&B<0)&&(A*=-1,M=A*Math.abs(M),N=!0);var I=function(e){return Math.abs(e)=Math.abs(M)},O=I(n=x?(w<0?1+w:w)*M:(w<0?M:0)+w*A),L=I(Math.abs(M)-Math.abs(n));if((O||L)&&!N){if(_){var R=Math.abs(k)<=p/2;if(Math.abs(B)<=d/2){var z=(c.x1+c.x2)/2,V=c.y1,F=c.y2;r.segpts=[z,V,z,F]}else if(R){var j=(c.y1+c.y2)/2,q=c.x1,X=c.x2;r.segpts=[q,j,X,j]}else r.segpts=[c.x1,c.y2]}else{var Y=Math.abs(C)<=f/2;if(Math.abs(B)<=h/2){var W=(c.y1+c.y2)/2,H=c.x1,G=c.x2;r.segpts=[H,W,G,W]}else if(Y){var U=(c.x1+c.x2)/2,K=c.y1,Z=c.y2;r.segpts=[U,K,U,Z]}else r.segpts=[c.x2,c.y1]}}else if(_){var $=c.y1+n+(g?d/2*A:0),Q=c.x1,J=c.x2;r.segpts=[Q,$,J,$]}else{var ee=c.x1+n+(g?h/2*A:0),et=c.y1,en=c.y2;r.segpts=[ee,et,ee,en]}if(r.isRound){var er=e.pstyle("taxi-radius").value,ei="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(er),r.isArcRadius=Array(r.segpts.length/2).fill(ei)}},sg.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,f=t.tgtRs,g=!M(n.startX)||!M(n.startY),v=!M(n.arrowStartX)||!M(n.arrowStartY),y=!M(n.endX)||!M(n.endY),b=!M(n.arrowEndX)||!M(n.arrowEndY),x=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=tD({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wd.poolIndex()){var p=h;h=d,d=p}var f=s.srcPos=h.position(),g=s.tgtPos=d.position(),v=s.srcW=h.outerWidth(),y=s.srcH=h.outerHeight(),b=s.tgtW=d.outerWidth(),x=s.tgtH=d.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(h)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(d)],k=s.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,C=s.tgtCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,S=s.tgtRs=d._private.rscratch,D=s.srcRs=h._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var T=0;T0){var W=tT(l,tm(t)),H=tT(l,tm(Y)),G=W;H2&&tT(l,{x:Y[2],y:Y[3]})0){var eo=tT(u,tm(t)),es=tT(u,tm(ea)),el=eo;es2&&tT(u,{x:ea[2],y:ea[3]})=l||b){c={cp:g,segment:y};break}}if(c)break}var x=c.cp,w=c.segment,E=(l-d)/w.length,k=w.t1-w.t0,C=i?w.t0+k*E:w.t1-k*E;C=tA(0,C,1),t=tM(x.p0,x.p1,x.p2,C),u=sE(x.p0,x.p1,x.p2,C);break;case"straight":case"segments":case"haystack":for(var S,D,T,P,_=0,M=r.allpts.length,B=0;B+3=l));B+=2);var A=(l-P)/T;t=tB(S,D,A=tA(0,A,1)),u=sw(S,D)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},sb.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},sb.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=e7(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=i.width,h=i.height+(l-1)*(a-1)*u;te(n.rstyle,"labelWidth",t,c),te(n.rscratch,"labelWidth",t,c),te(n.rstyle,"labelHeight",t,h),te(n.rscratch,"labelHeight",t,h),te(n.rscratch,"labelLineHeight",t,u*a)},sb.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(te(n.rscratch,e,t,r),r):e7(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,p=[],f=/[\s\u200b]+|$/g,g=0;gc){var b,x=v.matchAll(f),w="",E=0,k=h(x);try{for(k.s();!(b=k.n()).done;){var C=b.value,S=C[0],D=v.substring(E,C.index);E=C.index+S.length;var T=0===w.length?D:w+D+S;this.calculateLabelDimensions(e,T).width<=c?w+=D+S:(w&&p.push(w),w=D+S)}}catch(e){k.e(e)}finally{k.f()}w.match(/^[\s\u200b]+$/)||p.push(w)}else p.push(v)}o("labelWrapCachedLines",p),i=o("labelWrapCachedText",p.join("\n")),o("labelWrapKey",l)}else if("ellipsis"===s){var P=e.pstyle("text-max-width").pfValue,_="",M=!1;if(this.calculateLabelDimensions(e,i).widthP);B++)_+=i[B],B===i.length-1&&(M=!0);return M||(_+="\u2026"),_}return i},sb.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},sb.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=ej(t,e._private.labelDimsKey),i=this.labelDimCache||(this.labelDimCache=[]),a=i[r];if(null!=a)return a;var o=e.pstyle("font-style").strValue,s=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=n.createElement("canvas"),h=this.labelCalcCanvasContext=c.getContext("2d");var d=c.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}h.font="".concat(o," ").concat(u," ").concat(s,"px ").concat(l);for(var p=0,f=0,g=t.split("\n"),v=0;ve.width()||28>e.height()))return sC||(e0("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),sC=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var sS={};sS.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var r=0;r=C.desktopTapThreshold2}var v=P(e);w&&(C.hoverData.tapholdCancelled=!0),t=!0,T(u,["mousemove","vmousemove","tapdrag"],e,{x:a[0],y:a[1]});var y=function(){C.data.bgActivePosistion=void 0,C.hoverData.selecting||n.emit({originalEvent:e,type:"boxstart",position:{x:a[0],y:a[1]}}),l[4]=1,C.hoverData.selecting=!0,C.redrawHint("select",!0),C.redraw()};if(3===C.hoverData.which){if(w){var b={originalEvent:e,type:"cxtdrag",position:{x:a[0],y:a[1]}};h?h.emit(b):n.emit(b),C.hoverData.cxtDragged=!0,(!C.hoverData.cxtOver||u!==C.hoverData.cxtOver)&&(C.hoverData.cxtOver&&C.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:a[0],y:a[1]}}),C.hoverData.cxtOver=u,u&&u.emit({originalEvent:e,type:"cxtdragover",position:{x:a[0],y:a[1]}}))}}else if(C.hoverData.dragging){if(t=!0,n.panningEnabled()&&n.userPanningEnabled()){if(C.hoverData.justStartedPan){var x=C.hoverData.mdownPos;E={x:(a[0]-x[0])*r,y:(a[1]-x[1])*r},C.hoverData.justStartedPan=!1}else E={x:d[0]*r,y:d[1]*r};n.panBy(E),n.emit("dragpan"),C.hoverData.dragged=!0}a=C.projectIntoViewport(e.clientX,e.clientY)}else if(1==l[4]&&(null==h||h.pannable()))w&&(!C.hoverData.dragging&&n.boxSelectionEnabled()&&(v||!n.panningEnabled()||!n.userPanningEnabled())?y():!C.hoverData.selecting&&n.panningEnabled()&&n.userPanningEnabled()&&_(h,C.hoverData.downs)&&(C.hoverData.dragging=!0,C.hoverData.justStartedPan=!0,l[4]=0,C.data.bgActivePosistion=tm(o),C.redrawHint("select",!0),C.redraw()),h&&h.pannable()&&h.active()&&h.unactivate());else{if(h&&h.pannable()&&h.active()&&h.unactivate(),h&&h.grabbed()||u==c||(c&&T(c,["mouseout","tapdragout"],e,{x:a[0],y:a[1]}),u&&T(u,["mouseover","tapdragover"],e,{x:a[0],y:a[1]}),C.hoverData.last=u),h){if(w){if(n.boxSelectionEnabled()&&v)h&&h.grabbed()&&(F(p),h.emit("freeon"),p.emit("free"),C.dragData.didDrag&&(h.emit("dragfreeon"),p.emit("dragfree"))),y();else if(h&&h.grabbed()&&C.nodeIsDraggable(h)){var w,E,k,S=!C.dragData.didDrag;S&&C.redrawHint("eles",!0),C.dragData.didDrag=!0,C.hoverData.draggingEles||V(p,{inDragLayer:!0});var D={x:0,y:0};if(M(d[0])&&M(d[1])&&(D.x+=d[0],D.y+=d[1],S)){var B=C.hoverData.dragDelta;B&&M(B[0])&&M(B[1])&&(D.x+=B[0],D.y+=B[1])}C.hoverData.draggingEles=!0,p.silentShift(D).emit("position drag"),C.redrawHint("drag",!0),C.redraw()}}else 0===(k=C.hoverData.dragDelta=C.hoverData.dragDelta||[]).length?(k.push(d[0]),k.push(d[1])):(k[0]+=d[0],k[1]+=d[1])}t=!0}if(l[2]=a[0],l[3]=a[1],t)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),C.registerBinding(S,"mouseup",function(r){if((1!==C.hoverData.which||1===r.which||!C.hoverData.capture)&&C.hoverData.capture){C.hoverData.capture=!1;var i=C.cy,a=C.projectIntoViewport(r.clientX,r.clientY),o=C.selection,s=C.findNearestElement(a[0],a[1],!0,!1),l=C.dragData.possibleDragElements,u=C.hoverData.down,c=P(r);if(C.data.bgActivePosistion&&(C.redrawHint("select",!0),C.redraw()),C.hoverData.tapholdCancelled=!0,C.data.bgActivePosistion=void 0,u&&u.unactivate(),3===C.hoverData.which){var h={originalEvent:r,type:"cxttapend",position:{x:a[0],y:a[1]}};if(u?u.emit(h):i.emit(h),!C.hoverData.cxtDragged){var d={originalEvent:r,type:"cxttap",position:{x:a[0],y:a[1]}};u?u.emit(d):i.emit(d)}C.hoverData.cxtDragged=!1,C.hoverData.which=null}else if(1===C.hoverData.which){if(T(s,["mouseup","tapend","vmouseup"],r,{x:a[0],y:a[1]}),C.dragData.didDrag||C.hoverData.dragged||C.hoverData.selecting||C.hoverData.isOverThresholdDrag||(T(u,["click","tap","vclick"],r,{x:a[0],y:a[1]}),t=!1,r.timeStamp-n<=i.multiClickDebounceTime()?(e&&clearTimeout(e),t=!0,n=null,T(u,["dblclick","dbltap","vdblclick"],r,{x:a[0],y:a[1]})):(e=setTimeout(function(){t||T(u,["oneclick","onetap","voneclick"],r,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),n=r.timeStamp)),null!=u||C.dragData.didDrag||C.hoverData.selecting||C.hoverData.dragged||P(r)||(i.$(D).unselect(["tapunselect"]),l.length>0&&C.redrawHint("eles",!0),C.dragData.possibleDragElements=l=i.collection()),s!=u||C.dragData.didDrag||C.hoverData.selecting||null==s||!s._private.selectable||(C.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(i.$(D).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),C.redrawHint("eles",!0)),C.hoverData.selecting){var p=i.collection(C.getAllInBox(o[0],o[1],o[2],o[3]));C.redrawHint("select",!0),p.length>0&&C.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:r,position:{x:a[0],y:a[1]}});"additive"!==i.selectionType()&&(c||i.$(D).unmerge(p).unselect()),p.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),C.redraw()}if(C.hoverData.dragging&&(C.hoverData.dragging=!1,C.redrawHint("select",!0),C.redrawHint("eles",!0),C.redraw()),!o[4]){C.redrawHint("drag",!0),C.redrawHint("eles",!0);var f=u&&u.grabbed();F(l),f&&(u.emit("freeon"),l.emit("free"),C.dragData.didDrag&&(u.emit("dragfreeon"),l.emit("dragfree")))}}o[4]=0,C.hoverData.down=null,C.hoverData.cxtStarted=!1,C.hoverData.draggingEles=!1,C.hoverData.selecting=!1,C.hoverData.isOverThresholdDrag=!1,C.dragData.didDrag=!1,C.hoverData.dragged=!1,C.hoverData.dragDelta=[],C.hoverData.mdownPos=null,C.hoverData.mdownGPos=null,C.hoverData.which=null}},!1);var U=function(e){if(!C.scrollingPage){var t=C.cy,n=t.zoom(),r=t.pan(),i=C.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*n+r.x,i[1]*n+r.y];if(C.hoverData.draggingEles||C.hoverData.dragging||C.hoverData.cxtStarted||0!==C.selection[4]){e.preventDefault();return}if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),C.data.wheelZooming=!0,clearTimeout(C.data.wheelTimeout),C.data.wheelTimeout=setTimeout(function(){C.data.wheelZooming=!1,C.redrawHint("eles",!0),C.redraw()},150),o=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*C.wheelSensitivity,1===e.deltaMode&&(o*=33);var o,s=t.zoom()*Math.pow(10,o);"gesturechange"===e.type&&(s=C.gestureStartZoom*e.scale),t.zoom({level:s,renderedPosition:{x:a[0],y:a[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};C.registerBinding(C.container,"wheel",U,!0),C.registerBinding(S,"scroll",function(e){C.scrollingPage=!0,clearTimeout(C.scrollingPageTimeout),C.scrollingPageTimeout=setTimeout(function(){C.scrollingPage=!1},250)},!0),C.registerBinding(C.container,"gesturestart",function(e){C.gestureStartZoom=C.cy.zoom(),C.hasTouchStarted||e.preventDefault()},!0),C.registerBinding(C.container,"gesturechange",function(e){C.hasTouchStarted||U(e)},!0),C.registerBinding(C.container,"mouseout",function(e){var t=C.projectIntoViewport(e.clientX,e.clientY);C.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),C.registerBinding(C.container,"mouseover",function(e){var t=C.projectIntoViewport(e.clientX,e.clientY);C.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var K=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},Z=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(C.registerBinding(C.container,"touchstart",v=function(e){if(C.hasTouchStarted=!0,G(e)){q(),C.touchData.capture=!0,C.data.bgActivePosistion=void 0;var t=C.cy,n=C.touchData.now,v=C.touchData.earlier;if(e.touches[0]){var y=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=y[0],n[1]=y[1]}if(e.touches[1]){var y=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=y[0],n[3]=y[1]}if(e.touches[2]){var y=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=y[0],n[5]=y[1]}if(e.touches[1]){C.touchData.singleTouchMoved=!0,F(C.dragData.touchDragEles);var b=C.findContainerClientCoords();h=b[0],d=b[1],p=b[2],f=b[3],r=e.touches[0].clientX-h,i=e.touches[0].clientY-d,a=e.touches[1].clientX-h,o=e.touches[1].clientY-d,g=0<=r&&r<=p&&0<=a&&a<=p&&0<=i&&i<=f&&0<=o&&o<=f;var x=t.pan(),w=t.zoom();if(s=K(r,i,a,o),l=Z(r,i,a,o),c=[((u=[(r+a)/2,(i+o)/2])[0]-x.x)/w,(u[1]-x.y)/w],l<4e4&&!e.touches[2]){var E=C.findNearestElement(n[0],n[1],!0,!0),k=C.findNearestElement(n[2],n[3],!0,!0);E&&E.isNode()?(E.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),C.touchData.start=E):k&&k.isNode()?(k.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),C.touchData.start=k):t.emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxt=!0,C.touchData.cxtDragged=!1,C.data.bgActivePosistion=void 0,C.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var S=C.findNearestElements(n[0],n[1],!0,!0),D=S[0];if(null!=D&&(D.activate(),C.touchData.start=D,C.touchData.starts=S,C.nodeIsGrabbable(D))){var P=C.dragData.touchDragEles=t.collection(),_=null;C.redrawHint("eles",!0),C.redrawHint("drag",!0),D.selected()?V(_=t.$(function(e){return e.selected()&&C.nodeIsGrabbable(e)}),{addToList:P}):V(D,{addToList:P}),O(D);var M=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};D.emit(M("grabon")),_?_.forEach(function(e){e.emit(M("grab"))}):D.emit(M("grab"))}T(D,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==D&&(C.data.bgActivePosistion={x:y[0],y:y[1]},C.redrawHint("select",!0),C.redraw()),C.touchData.singleTouchMoved=!1,C.touchData.singleTouchStartTime=+new Date,clearTimeout(C.touchData.tapholdTimeout),C.touchData.tapholdTimeout=setTimeout(function(){!1!==C.touchData.singleTouchMoved||C.pinching||C.touchData.selecting||T(C.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},C.tapholdDuration)}if(e.touches.length>=1){for(var B=C.touchData.startPosition=[null,null,null,null,null,null],A=0;A=C.touchTapThreshold2}if(t&&C.touchData.cxt){e.preventDefault();var D=e.touches[0].clientX-h,P=e.touches[0].clientY-d,B=e.touches[1].clientX-h,A=e.touches[1].clientY-d,N=Z(D,P,B,A);if(N/l>=2.25||N>=22500){C.touchData.cxt=!1,C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var I={originalEvent:e,type:"cxttapend",position:{x:p[0],y:p[1]}};C.touchData.start?(C.touchData.start.unactivate().emit(I),C.touchData.start=null):u.emit(I)}}if(t&&C.touchData.cxt){var I={originalEvent:e,type:"cxtdrag",position:{x:p[0],y:p[1]}};C.data.bgActivePosistion=void 0,C.redrawHint("select",!0),C.touchData.start?C.touchData.start.emit(I):u.emit(I),C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxtDragged=!0;var O=C.findNearestElement(p[0],p[1],!0,!0);(!C.touchData.cxtOver||O!==C.touchData.cxtOver)&&(C.touchData.cxtOver&&C.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:p[0],y:p[1]}}),C.touchData.cxtOver=O,O&&O.emit({originalEvent:e,type:"cxtdragover",position:{x:p[0],y:p[1]}}))}else if(t&&e.touches[2]&&u.boxSelectionEnabled())e.preventDefault(),C.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,C.touchData.selecting||u.emit({originalEvent:e,type:"boxstart",position:{x:p[0],y:p[1]}}),C.touchData.selecting=!0,C.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(p[0]+p[2]+p[4])/3,n[3]=(p[1]+p[3]+p[5])/3):(n[0]=(p[0]+p[2]+p[4])/3,n[1]=(p[1]+p[3]+p[5])/3,n[2]=(p[0]+p[2]+p[4])/3+1,n[3]=(p[1]+p[3]+p[5])/3+1),C.redrawHint("select",!0),C.redraw();else if(t&&e.touches[1]&&!C.touchData.didSelect&&u.zoomingEnabled()&&u.panningEnabled()&&u.userZoomingEnabled()&&u.userPanningEnabled()){e.preventDefault(),C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var L=C.dragData.touchDragEles;if(L){C.redrawHint("drag",!0);for(var R=0;R0&&!C.hoverData.draggingEles&&!C.swipePanning&&null!=C.data.bgActivePosistion&&(C.data.bgActivePosistion=void 0,C.redrawHint("select",!0),C.redraw())}},!1),C.registerBinding(S,"touchcancel",b=function(e){var t=C.touchData.start;C.touchData.capture=!1,t&&t.unactivate()}),C.registerBinding(S,"touchend",x=function(e){var t,n=C.touchData.start;if(C.touchData.capture){0===e.touches.length&&(C.touchData.capture=!1),e.preventDefault();var r=C.selection;C.swipePanning=!1,C.hoverData.draggingEles=!1;var i=C.cy,a=i.zoom(),o=C.touchData.now,s=C.touchData.earlier;if(e.touches[0]){var l=C.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=C.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=C.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}if(n&&n.unactivate(),C.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:o[0],y:o[1]}},n?n.emit(t):i.emit(t),!C.touchData.cxtDragged){var u={originalEvent:e,type:"cxttap",position:{x:o[0],y:o[1]}};n?n.emit(u):i.emit(u)}C.touchData.start&&(C.touchData.start._private.grabbed=!1),C.touchData.cxt=!1,C.touchData.start=null,C.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&C.touchData.selecting){C.touchData.selecting=!1;var c=i.collection(C.getAllInBox(r[0],r[1],r[2],r[3]));r[0]=void 0,r[1]=void 0,r[2]=void 0,r[3]=void 0,r[4]=0,C.redrawHint("select",!0),i.emit({type:"boxend",originalEvent:e,position:{x:o[0],y:o[1]}}),c.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),c.nonempty()&&C.redrawHint("eles",!0),C.redraw()}if(null!=n&&n.unactivate(),e.touches[2])C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){C.data.bgActivePosistion=void 0,C.redrawHint("select",!0);var h=C.dragData.touchDragEles;if(null!=n){var d=n._private.grabbed;F(h),C.redrawHint("drag",!0),C.redrawHint("eles",!0),d&&(n.emit("freeon"),h.emit("free"),C.dragData.didDrag&&(n.emit("dragfreeon"),h.emit("dragfree"))),T(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),C.touchData.start=null}else T(C.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var p=C.touchData.startPosition[0]-o[0],f=C.touchData.startPosition[1]-o[1];C.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),T(n,["tap","vclick"],e,{x:o[0],y:o[1]}),w=!1,e.timeStamp-k<=i.multiClickDebounceTime()?(E&&clearTimeout(E),w=!0,k=null,T(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(E=setTimeout(function(){w||T(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),k=e.timeStamp)),null!=n&&!C.dragData.didDrag&&n._private.selectable&&(p*p+f*f)*a*a0)return p[0]}return null}(e,t,f);if(null!=g){var v=t_(f[5],f[3],f[1],g);if(f.isTop&&v<=t||f.isBottom&&t<=v)return!0}}return!1}}},sM.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:t7(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),u=t-(r/2+o),c=e+(n/2+o),h=t4(i,a,e,t,l,u,c,u,!1);return h.length>0?h:tX(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(t$(e,t,this.points,a,o,r,i-l,[0,-1],n)||t$(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!(tZ(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||t2(e,t,l,l,a+r/2-s,o+i/2-s,n)||t2(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},sM.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",t7(3,0)),this.generateRoundPolygon("round-triangle",t7(3,0)),this.generatePolygon("rectangle",t7(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",t7(5,0)),this.generateRoundPolygon("round-pentagon",t7(5,0)),this.generatePolygon("hexagon",t7(6,0)),this.generateRoundPolygon("round-hexagon",t7(6,0)),this.generatePolygon("heptagon",t7(7,0)),this.generateRoundPolygon("round-heptagon",t7(7,0)),this.generatePolygon("octagon",t7(8,0)),this.generateRoundPolygon("round-octagon",t7(8,0));var r=Array(20),i=nt(5,0),a=nt(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;st.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&e0("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=M(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},sI.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e){this.load();return}if("destroy"===e){this.destroy();return}("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},sI.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e=e.deqFastCost*g)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(f>=e.deqNoDrawCost*sO)break;var v=e.deq(t,h,c);if(v.length>0)for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},i(t))}}},sR=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eK;i(this,e),this.idsByKey=new tn,this.keyForId=new tn,this.cachesByLvl=new tn,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return o(e,[{key:"getIdsFor",value:function(e){null==e&&eQ("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new ti,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new tn,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),sz={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},sV=e4({getKey:null,doesEleInvalidateKey:eK,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:eU,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sF=function(e,t){this.renderer=e,this.onDequeues=[];var n=sV(t);Z(this,n),this.lookup=new sR(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},sj=sF.prototype;sj.reasons=sz,sj.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},sj.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},sj.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new tl(function(e,t){return t.reqs-e.reqs})},sj.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},sj.getElement=function(e,t,n,r,i){var a,o,s,l=this,u=this.renderer,c=u.cy.zoom(),h=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(tC(c*n))),r<-4)r=-4;else if(c>=7.99||r>3)return null;var d=Math.pow(2,r),p=t.h*d,f=t.w*d,g=u.eleTextBiggerThanMin(e,d);if(!this.isVisible(e,g))return null;var v=h.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=p<=25?25:p<=50?50:50*Math.ceil(p/50),p>1024||f>1024)return null;var y=l.getTextureQueue(a),b=y[y.length-2],x=function(){return l.recycleTexture(a,f)||l.addTexture(a,f)};b||(b=y[y.length-1]),b||(b=x()),b.width-b.usedWidthr;_--)T=l.getElement(e,t,n,_,sz.downscale);P()}else{if(!E&&!k&&!C)for(var M=r-1;M>=-4;M--){var B=h.get(e,M);if(B){s=B;break}}if(w(s))return l.queueElement(e,r),s;b.context.translate(b.usedWidth,0),b.context.scale(d,d),this.drawElement(b.context,e,t,g,!1),b.context.scale(1/d,1/d),b.context.translate(-b.usedWidth,0)}return v={x:b.usedWidth,texture:b,level:r,scale:d,width:f,height:p,scaledLabelShown:g},b.usedWidth+=Math.ceil(f+8),b.eleCaches.push(v),h.set(e,r,v),l.checkTextureFullness(b),v},sj.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},sj.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?e9(t,e):e.fullnessChecks++},sj.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;e9(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,e6(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),e9(r,a),n.push(a),a}},sj.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},sj.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1;a++)if(t.size()>0){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,u)continue;r.push(o);var c=this.getBoundingBox(l);this.getElement(l,c,e,o.level,sz.dequeue)}else break;return r},sj.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=eG,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},sj.onDequeue=function(e){this.onDequeues.push(e)},sj.offDequeue=function(e){e9(this.onDequeues,e)},sj.setupDequeueing=sL({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null}a.validateLayersElesOrdering(n,e);var l=a.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(a.levelIsComplete(n,e))return c;!function(){var t=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},r=function(e){if(!i)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};r(1),r(-1);for(var o=c.length-1;o>=0;o--){var s=c[o];s.invalid&&e9(c,s)}}();var h=function(){if(!r){r=tN();for(var t=0;t=p||!tq(d.bb,v.boundingBox()))&&!(d=function(e){var t=(e=e||{}).after;if(h(),r.w*u*(r.h*u)>16e6)return null;var i=a.makeLayer(r,n);if(null!=t){var o=c.indexOf(t)+1;c.splice(o,0,i)}else(void 0===e.insert||e.insert)&&c.unshift(i);return i}({insert:!0,after:d})))return null;i||f?a.queueLayer(d,v):a.drawEleInLayer(d,v,n,t),d.eles.push(v),b[n]=d}return i||(f?null:c)},sX.getEleLevelForLayerLevel=function(e,t){return e},sX.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},sX.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0||a.invalid)return!1;r+=a.eles.length}return r===t.length},sX.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},sX.invalidateElements=function(e){var t=this;if(0!==e.length)t.lastInvalidationTime=eA(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)})},sX.invalidateLayer=function(e){if(this.lastInvalidationTime=eA(),!e.invalid){var t=e.level,n=e.eles;e9(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var r=0;r3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if(!(o&&!t.visible()||l.badLine||null==l.allpts||isNaN(l.allpts[0]))){n&&(r=n,e.translate(-r.x1,-r.y1));var u=o?t.pstyle("opacity").value:1,c=o?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,f=t.pstyle("line-cap").value,g=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,b=u*c,x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=p,e.lineCap=f,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")},w=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;s.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var E=t.pstyle("ghost-offset-x").pfValue,k=t.pstyle("ghost-offset-y").pfValue,C=y*t.pstyle("ghost-opacity").value;e.translate(E,k),x(C),w(C),e.translate(-E,-k)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(e.lineWidth=p+g,e.lineCap=f,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],n);else{e.lineCap="butt";return}"straight-triangle"===h?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")}();a&&s.drawEdgeUnderlay(e,t),x(),w(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),n&&e.translate(r.x1,r.y1)}};var s4=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this.usePaths(),a=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid")}}}};s3.drawEdgeOverlay=s4("overlay"),s3.drawEdgeUnderlay=s4("underlay"),s3.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=!1,s=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,u=e.pstyle("line-dash-offset").pfValue;if(s){var c=n.join("$");i.pathCacheKey&&i.pathCacheKey===c?(f=t=i.pathCache,o=!0):(f=t=new Path2D,i.pathCacheKey=c,i.pathCache=f)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=u;break;case"solid":a.setLineDash([])}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}s6.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(tC(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t5)||void 0===arguments[5]||arguments[5];if(null==r){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=this.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p=!n;n&&(a=n,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,p,o),t.isEdge()&&(this.drawText(e,t,"source",p,o),this.drawText(e,t,"target",p,o))):this.drawText(e,t,i,p,o),n&&e.translate(a.x1,a.y1)},s6.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2)||void 0===arguments[2]||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},s6.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=e7(r,"labelAngle",t);return"autorotate"===a.strValue?e.isEdge()?o:0:"none"===a.strValue?0:a.pfValue},s6.drawText=function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s=e7(a,"labelX",n),l=e7(a,"labelY",n),u=this.getLabelText(t,n);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var c,h,d,p=n?n+"-":"",f=e7(a,"labelWidth",n),g=e7(a,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),s+=v,l+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(c=s,h=l,e.translate(c,h),e.rotate(d),s=0,l=0),w){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g}var E=t.pstyle("text-background-opacity").value,k=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,D=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(E>0||C>0&&k>0){var T=s-S;switch(x){case"left":T-=f;break;case"center":T-=f/2}var P=l-g-S,_=f+2*S,M=g+2*S;if(E>0){var B=e.fillStyle,A=t.pstyle("text-background-color").value;e.fillStyle="rgba("+A[0]+","+A[1]+","+A[2]+","+E*o+")",D?s8(e,T,P,_,M,2):e.fillRect(T,P,_,M),e.fillStyle=B}if(C>0&&k>0){var N=e.strokeStyle,I=e.lineWidth,O=t.pstyle("text-border-color").value,L=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+O[0]+","+O[1]+","+O[2]+","+k*o+")",e.lineWidth=C,e.setLineDash)switch(L){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(D?s8(e,T,P,_,M,2,"stroke"):e.strokeRect(T,P,_,M),"double"===L){var R=C/2;D?s8(e,T+R,P+R,_-2*R,M-2*R,2,"stroke"):e.strokeRect(T+R,P+R,_-2*R,M-2*R)}e.setLineDash&&e.setLineDash([]),e.lineWidth=I,e.strokeStyle=N}}var z=2*t.pstyle("text-outline-width").pfValue;if(z>0&&(e.lineWidth=z),"wrap"===t.pstyle("text-wrap").value){var V=e7(a,"labelWrapCachedLines",n),F=e7(a,"labelLineHeight",n),j=f/2,q=this.getLabelJustification(t);switch("auto"===q||("left"===x?"left"===q?s+=-f:"center"===q&&(s+=-j):"center"===x?"left"===q?s+=-j:"right"===q&&(s+=j):"right"===x&&("center"===q?s+=j:"right"===q&&(s+=f))),w){case"top":case"center":case"bottom":l-=(V.length-1)*F}for(var X=0;X0&&e.strokeText(V[X],s,l),e.fillText(V[X],s,l),l+=F}else z>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==d&&(e.rotate(-d),e.translate(-c,-h))}}};var s7={};s7.drawNode=function(e,t,n){var r,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],c=this,h=t._private,d=h.rscratch,p=t.position();if(M(p.x)&&M(p.y)&&(!u||t.visible())){var f=u?t.effectiveOpacity():1,g=c.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(o=n,e.translate(-o.x1,-o.y1));for(var b=t.pstyle("background-image").value,x=Array(b.length),w=Array(b.length),E=0,k=0;k0&&void 0!==arguments[0]?arguments[0]:P;c.eleFillStyle(e,t,n)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;c.colorStrokeStyle(e,_[0],_[1],_[2],t)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:j;c.colorStrokeStyle(e,V[0],V[1],V[2],t)},G=function(e,t,n,r){var i,a=c.nodePathCache=c.nodePathCache||[],o=eq("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+X),s=a[o],l=!1;return null!=s?(i=s,l=!0,d.pathCache=i):(i=new Path2D,a[o]=d.pathCache=i),{path:i,cacheHit:l}},U=t.pstyle("shape").strValue,K=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(p.x,p.y);var Z=G(r,i,U,K);a=Z.path,v=Z.cacheHit}var $=function(){if(!v){var n=p;g&&(n={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,X,d)}g?e.fill(a):e.fill()},Q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=h.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;c.hasPie(t)&&(c.drawPie(e,t,a),n&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,p.x,p.y,r,i,X,d))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f,n=D>0?0:255;0!==D&&(c.colorFillStyle(e,n,n,n,(D>0?D:-D)*t),g?e.fill(a):e.fill())},et=function(){if(T>0){if(e.lineWidth=T,e.lineCap=N,e.lineJoin=A,e.setLineDash)switch(B){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(O),e.lineDashOffset=L;break;case"solid":case"double":e.setLineDash([])}if("center"!==I){if(e.save(),e.lineWidth*=2,"inside"===I)g?e.clip(a):e.clip();else{var t=new Path2D;t.rect(-r/2-T,-i/2-T,r+2*T,i+2*T),t.addPath(a),e.clip(t,"evenodd")}g?e.stroke(a):e.stroke(),e.restore()}else g?e.stroke(a):e.stroke();if("double"===B){e.lineWidth=T/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},en=function(){if(z>0){if(e.lineWidth=z,e.lineCap="butt",e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=p;g&&(n={x:0,y:0});var a=c.getNodeShape(t),o=T;"inside"===I&&(o=0),"outside"===I&&(o*=2);var s=(r+o+(z+q))/r,l=(i+o+(z+q))/i,u=r*s,h=i*l,d=c.nodeShapes[a].points;if(g&&(S=G(u,h,a,d).path),"ellipse"===a)c.drawEllipsePath(S||e,n.x,n.y,u,h);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var f=0,v=0,y=0;"round-diamond"===a?f=(o+q+z)*1.4:"round-heptagon"===a?(f=(o+q+z)*1.075,y=-(o/2+q+z)/35):"round-hexagon"===a?f=(o+q+z)*1.12:"round-pentagon"===a?(f=(o+q+z)*1.13,y=-(o/2+q+z)/15):"round-tag"===a?(f=(o+q+z)*1.12,v=(o/2+z+q)*.07):"round-triangle"===a&&(f=Math.PI/2*(o+q+z),y=-(o+q/2+z)/Math.PI),0===f||(s=(r+f)/r,u=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+f)/i,h=i*l)),X="auto"===X?nr(u,h):X;for(var b=u/2,x=h/2,w=X+(o+z+q)/2,E=Array(d.length/2),k=Array(d.length/2),C=0;C0){if(r=r||n.position(),null==i||null==a){var h=n.padding();i=n.width()+2*h,a=n.height()+2*h}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,c),t.fill()}}}};s7.drawNodeOverlay=le("overlay"),s7.drawNodeUnderlay=le("underlay"),s7.hasPie=function(e){return(e=e[0])._private.hasPie},s7.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=Math.min(t.width(),t.height())/2,u=0;this.usePaths()&&(o=0,s=0),"%"===a.units?l*=a.pfValue:void 0!==a.pfValue&&(l=a.pfValue/2);for(var c=1;c<=i.pieBackgroundN;c++){var h=t.pstyle("pie-"+c+"-background-size").value,d=t.pstyle("pie-"+c+"-background-color").value,p=t.pstyle("pie-"+c+"-background-opacity").value*n,f=h/100;f+u>1&&(f=1-u);var g=1.5*Math.PI+2*Math.PI*u,v=g+2*Math.PI*f;0!==h&&!(u>=1)&&!(u+f>1)&&(e.beginPath(),e.moveTo(o,s),e.arc(o,s,l,g,v),e.closePath(),this.colorFillStyle(e,d[0],d[1],d[2],p),e.fill(),u+=f)}};var lt={};lt.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},lt.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!h&&(c[o.NODE]=!0,c[o.SELECT_BOX]=!0);var b=l.style(),x=l.zoom(),w=void 0!==i?i:x,E=l.pan(),k={x:E.x,y:E.y},C={zoom:x,pan:{x:E.x,y:E.y}},S=o.prevViewport;void 0===S||C.zoom!==S.zoom||C.pan.x!==S.pan.x||C.pan.y!==S.pan.y||g&&!f||(o.motionBlurPxRatio=1),a&&(k=a),w*=s,k.x*=s,k.y*=s;var D=o.getCachedZSortedEles();function T(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function P(e,r){var s,l,c,h;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=k,l=w,c=o.canvasWidth,h=o.canvasHeight):(s={x:E.x*p,y:E.y*p},l=x*p,c=o.canvasWidth*p,h=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?T(e,0,0,c,h):!t&&(void 0===r||r)&&e.clearRect(0,0,c,h),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(h||(o.textureDrawLastFrame=!1),h){if(o.textureDrawLastFrame=!0,!o.textureCache){o.textureCache={},o.textureCache.bb=l.mutableElements().boundingBox(),o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var _=o.data.bufferContexts[o.TEXTURE_BUFFER];_.setTransform(1,0,0,1,0,0),_.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult),o.render({forcedContext:_,drawOnlyNodeLayer:!0,forcedPxRatio:s*o.textureMult});var C=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};C.mpan={x:(0-C.pan.x)/C.zoom,y:(0-C.pan.y)/C.zoom}}c[o.DRAG]=!1,c[o.NODE]=!1;var M=u.contexts[o.NODE],B=o.textureCache.texture,C=o.textureCache.viewport;M.setTransform(1,0,0,1,0,0),d?T(M,0,0,C.width,C.height):M.clearRect(0,0,C.width,C.height);var A=b.core("outside-texture-bg-color").value,N=b.core("outside-texture-bg-opacity").value;o.colorFillStyle(M,A[0],A[1],A[2],N),M.fillRect(0,0,C.width,C.height);var x=l.zoom();P(M,!1),M.clearRect(C.mpan.x,C.mpan.y,C.width/C.zoom/s,C.height/C.zoom/s),M.drawImage(B,C.mpan.x,C.mpan.y,C.width/C.zoom/s,C.height/C.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var I=l.extent(),O=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),L=o.hideEdgesOnViewport&&O,R=[];if(R[o.NODE]=!c[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,R[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),R[o.DRAG]=!c[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,R[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),c[o.NODE]||n||r||R[o.NODE]){var z=d&&!R[o.NODE]&&1!==p,M=t||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]);P(M,d&&!z?"motionBlur":void 0),L?o.drawCachedNodes(M,D.nondrag,s,I):o.drawLayeredElements(M,D.nondrag,s,I),o.debug&&o.drawDebugPoints(M,D.nondrag),n||d||(c[o.NODE]=!1)}if(!r&&(c[o.DRAG]||n||R[o.DRAG])){var z=d&&!R[o.DRAG]&&1!==p,M=t||(z?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);P(M,d&&!z?"motionBlur":void 0),L?o.drawCachedNodes(M,D.drag,s,I):o.drawCachedElements(M,D.drag,s,I),o.debug&&o.drawDebugPoints(M,D.drag),n||d||(c[o.DRAG]=!1)}if(o.showFps||!r&&c[o.SELECT_BOX]&&!n){var M=t||u.contexts[o.SELECT_BOX];if(P(M),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){var x=o.cy.zoom(),V=b.core("selection-box-border-width").value/x;M.lineWidth=V,M.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",M.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),V>0&&(M.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",M.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var x=o.cy.zoom(),F=u.bgActivePosistion;M.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",M.beginPath(),M.arc(F.x,F.y,b.core("active-bg-size").pfValue/x,0,2*Math.PI),M.fill()}var j=o.lastRedrawTime;if(o.showFps&&j){var q=Math.round(1e3/(j=Math.round(j)));M.setTransform(1,0,0,1,0,0),M.fillStyle="rgba(255, 0, 0, 0.75)",M.strokeStyle="rgba(255, 0, 0, 0.75)",M.lineWidth=1,M.fillText("1 frame = "+j+" ms = "+q+" fps",0,20),M.strokeRect(0,30,250,20),M.fillRect(0,30,250*Math.min(q/60,1),20)}n||(c[o.SELECT_BOX]=!1)}if(d&&1!==p){var X=u.contexts[o.NODE],Y=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],W=u.contexts[o.DRAG],H=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],G=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):T(e,0,0,o.canvasWidth,o.canvasHeight),e.drawImage(t,0,0,o.canvasWidth*p,o.canvasHeight*p,0,0,o.canvasWidth,o.canvasHeight)};(c[o.NODE]||R[o.NODE])&&(G(X,Y,R[o.NODE]),c[o.NODE]=!1),(c[o.DRAG]||R[o.DRAG])&&(G(W,H,R[o.DRAG]),c[o.DRAG]=!1)}o.prevViewport=C,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!h,o.mbFrames=0,c[o.NODE]=!0,c[o.DRAG]=!0,o.redraw()},100)),t||l.emit("render")};var ln={};ln.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var f=t.pan(),g={x:f.x*l,y:f.y*l};l*=t.zoom(),d.translate(g.x,g.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-g.x,-g.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},ls.png=function(e){return lu(e,this.bufferCanvasImage(e),"image/png")},ls.jpg=function(e){return lu(e,this.bufferCanvasImage(e),"image/jpeg")};var lc={};lc.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var lh=ld.prototype;function ld(e){var t=this,n=t.cy.window().document;t.data={canvases:Array(lh.CANVAS_LAYERS),contexts:Array(lh.CANVAS_LAYERS),canvasNeedsRedraw:Array(lh.CANVAS_LAYERS),bufferCanvases:Array(lh.BUFFER_COUNT),bufferContexts:Array(lh.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=i;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};x&&x.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l