"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6849],{88618:(e,t,n)=>{function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ntypeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=h(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=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}}}}function s(e,t,n){return(t=c(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(e){u=!0,i=e}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}(e,t)||h(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function d(e){return(d="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 h(e,t){if(e){if("string"==typeof e)return r(e,t);var n=({}).toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}n.d(t,{A:()=>cg});var f,p,g,v,y,b,x,w="u"t)},J=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("^"+Z+"$").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 d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*t(h,d,r+1/3)),l=Math.round(255*t(h,d,r)),u=Math.round(255*t(h,d,r-1/3))}n=[s,l,u,o]}return n},en=function(e){var t,n=RegExp("^"+K+"$").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},er=function(e){return(_(e)?e:null)||ei[e.toLowerCase()]||ee(e)||en(e)||et(e)},ei={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]},ea=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;itypeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{};function el(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function eu(){return or?on:(or=1,on=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)})}function ec(){if(os)return oo;os=1;var e=oa?oi:(oa=1,oi="object"==typeof es&&es&&es.Object===Object&&es),t="object"==typeof self&&self&&self.Object===Object&&self;return oo=e||t||Function("return this")()}function ed(){return og?op:(og=1,op=ec().Symbol)}function eh(){if(ow)return ox;ow=1;var e=ed(),t=function(){if(oy)return ov;oy=1;var e=ed(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return ov=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(e){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(ob)return om;ob=1;var e=Object.prototype.toString;return om=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return ox=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function ef(){if(oC)return oT;oC=1;var e=eh(),t=ok?oE:(ok=1,oE=function(e){return null!=e&&"object"==typeof e});return oT=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}var ep=el(function(){if(oD)return oB;oD=1;var e=eu(),t=function(){if(ou)return ol;ou=1;var e=ec();return ol=function(){return e.Date.now()}}(),n=function(){if(oS)return oP;oS=1;var e=function(){if(of)return oh;of=1;var e=function(){if(od)return oc;od=1;var e=/\s/;return oc=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}}(),t=/^\s+/;return oh=function(n){return n?n.slice(0,e(n)+1).replace(t,""):n}}(),t=eu(),n=ef(),r=0/0,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;return oP=function(l){if("number"==typeof l)return l;if(n(l))return r;if(t(l)){var u="function"==typeof l.valueOf?l.valueOf():l;l=t(u)?u+"":u}if("string"!=typeof l)return 0===l?l:+l;l=e(l);var c=a.test(l);return c||o.test(l)?s(l.slice(2),c?2:8):i.test(l)?r:+l}}(),r=Math.max,i=Math.min;return oB=function(a,o,s){var l,u,c,d,h,f,p=0,g=!1,v=!1,y=!0;if("function"!=typeof a)throw TypeError("Expected a function");function b(e){var t=l,n=u;return l=u=void 0,p=e,d=a.apply(n,t)}function x(e){var t=e-f,n=e-p;return void 0===f||t>=o||t<0||v&&n>=c}function w(){var e,n,r,a=t();if(x(a))return E(a);h=setTimeout(w,(e=a-f,n=a-p,r=o-e,v?i(r,c-n):r))}function E(e){return(h=void 0,y&&l)?b(e):(l=u=void 0,d)}function k(){var e,n=t(),r=x(n);if(l=arguments,u=this,f=n,r){if(void 0===h)return p=e=f,h=setTimeout(w,o),g?b(e):d;if(v)return clearTimeout(h),h=setTimeout(w,o),b(f)}return void 0===h&&(h=setTimeout(w,o)),d}return o=n(o)||0,e(s)&&(g=!!s.leading,c=(v="maxWait"in s)?r(n(s.maxWait)||0,o):c,y="trailing"in s?!!s.trailing:y),k.cancel=function(){void 0!==h&&clearTimeout(h),p=0,l=f=u=h=void 0},k.flush=function(){return void 0===h?d:E(t())},k}}()),eg=w?w.performance:null,ev=eg&&eg.now?function(){return eg.now()}:function(){return Date.now()},ey=function(){if(w){if(w.requestAnimationFrame)return function(e){w.requestAnimationFrame(e)};else if(w.mozRequestAnimationFrame)return function(e){w.mozRequestAnimationFrame(e)};else if(w.webkitRequestAnimationFrame)return function(e){w.webkitRequestAnimationFrame(e)};else if(w.msRequestAnimationFrame)return function(e){w.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(ev())},1e3/60)}}(),em=function(e){return ey(e)},eb=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},ex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},ew=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},eE=function(e){return 2097152*e[0]+e[1]},ek=function(e,t){return[ex(e[0],t[0]),ew(e[1],t[1])]},eT=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return eb({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},eW=function(e){e.splice(0,e.length)},eU=function(e,t){for(var n=0;ntypeof Map?Map:eG,e$=a(function e(t){if(i(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!z(e))return void eN("An element must have a core reference and parameters set");var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r)return void eN("An element must be of type `nodes` or `edges`; you specified `"+r+"`");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 eQ,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=[];_(t.classes)?l=t.classes:B(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut)},s=function(n,r,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=e),i<0)throw Error("lo must be non-negative");for(null==a&&(a=n.length);io(r,n[s=t((i+a)/2)])?a=s:i=s+1;return[].splice.apply(n,[i,i-i].concat(r)),r},i=function(t,n,r){return null==r&&(r=e),t.push(n),h(t,0,t.length-1,r)},r=function(t,n){var r,i;return null==n&&(n=e),r=t.pop(),t.length?(i=t[0],t[0]=r,f(t,0,n)):i=r,i},o=function(t,n,r){var i;return null==r&&(r=e),i=t[0],t[0]=n,f(t,0,r),i},a=function(t,n,r){var i;return null==r&&(r=e),t.length&&0>r(t[0],n)&&(n=(i=[t[0],n])[0],t[0]=i[1],f(t,0,r)),n},n=function(n,r){var i,a,o,s,l,u;for(null==r&&(r=e),s=(function(){u=[];for(var e=0,r=t(n.length/2);0<=r?er;0<=r?e++:e--)u.push(e);return u}).apply(this).reverse(),l=[],a=0,o=s.length;aa(o=p[d],u)&&(s(c,o,0,null,a),c.pop(),u=c[c.length-1]);return c}for(n(t,a),v=[],h=0,g=l(i,t.length);0<=g?hg;0<=g?++h:--h)v.push(r(t,a));return v},h=function(t,n,r,i){var a,o,s;for(null==i&&(i=e),a=t[r];r>n;){if(0>i(a,o=t[s=r-1>>1])){t[r]=o,r=s;continue}break}return t[r]=a},f=function(t,n,r){var i,a,o,s,l;for(null==r&&(r=e),a=t.length,l=n,o=t[n],i=2*n+1;ir(t[i],t[s]))&&(i=s),t[n]=t[i],i=2*(n=i)+1;return t[n]=o,h(t,l,n,r)},e2.exports=function(){function t(t){this.cmp=null!=t?t:e,this.nodes=[]}return t.push=i,t.pop=r,t.replace=o,t.pushpop=a,t.heapify=n,t.updateItem=d,t.nlargest=u,t.nsmallest=c,t.prototype.push=function(e){return i(this.nodes,e,this.cmp)},t.prototype.pop=function(){return r(this.nodes,this.cmp)},t.prototype.peek=function(){return this.nodes[0]},t.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},t.prototype.replace=function(e){return o(this.nodes,e,this.cmp)},t.prototype.pushpop=function(e){return a(this.nodes,e,this.cmp)},t.prototype.heapify=function(){return n(this.nodes,this.cmp)},t.prototype.updateItem=function(e){return d(this.nodes,e,this.cmp)},t.prototype.clear=function(){return this.nodes=[]},t.prototype.empty=function(){return 0===this.nodes.length},t.prototype.size=function(){return this.nodes.length},t.prototype.clone=function(){var e;return(e=new t).nodes=this.nodes.slice(0),e},t.prototype.toArray=function(){return this.nodes.slice(0)},t.prototype.insert=t.prototype.push,t.prototype.top=t.prototype.peek,t.prototype.front=t.prototype.peek,t.prototype.has=t.prototype.contains,t.prototype.copy=t.prototype.clone,t}()}).call(e5),e2.exports)}())),e4=eY({root:null,weight:function(e){return 1},directed:!1}),e9=eY({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),e6=eY({weight:function(e){return 1},directed:!1}),e8=eY({weight:function(e){return 1},directed:!1,root:null}),e7=Math.sqrt(2),te=function(e,t,n){0===n.length&&eN("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],d=u[2];(t[c]===o&&t[d]===s||t[c]===s&&t[d]===o)&&n.splice(l,1)}for(var h=0;hr;)t=te(Math.floor(Math.random()*t.length),e,t),n--;return t},tn=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},tr=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},ti=function(e){return{x:e[0],y:e[1]}},ta=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},tu=function(e,t){return Math.atan2(t,e)-Math.PI/2},tc=Math.log2||function(e){return Math.log(e)/Math.log(2)},td=function(e){return e>0?1:e<0?-1:0},th=function(e,t){return Math.sqrt(tf(e,t))},tf=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};else 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}}},tx=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tw=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},tE=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},tk=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},tT=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},tC=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},tP=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2t.y2)&&!(t.y1>e.y2)&&!0},tS=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},tB=function(e,t){return tS(e,t.x,t.y)},tD=function(e,t){return tS(e,t.x1,t.y1)&&tS(e,t.x2,t.y2)},t_=null!=(oR=Math.hypot)?oR:function(e,t){return Math.sqrt(e*e+t*t)},tA=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?t1(i,a):u,d=i/2,h=a/2,f=(c=Math.min(c,d,h))!==d,p=c!==h;if(f){var g=n-d+c-o,v=r-h-o,y=n+d-c+o;if((s=tH(e,t,n,r,g,v,y,v,!1)).length>0)return s}if(p){var b=n+d+o,x=r-h+c-o,w=r+h-c+o;if((s=tH(e,t,n,r,b,x,b,w,!1)).length>0)return s}if(f){var E=n-d+c-o,k=r+h+o,T=n+d-c+o;if((s=tH(e,t,n,r,E,k,T,k,!1)).length>0)return s}if(p){var C=n-d-o,P=r-h+c-o,S=r+h-c+o;if((s=tH(e,t,n,r,C,P,C,S,!1)).length>0)return s}var B=n-d+c,D=r-h+c;if((l=tW(e,t,n,r,B,D,c+o)).length>0&&l[0]<=B&&l[1]<=D)return[l[0],l[1]];var _=n+d-c,A=r-h+c;if((l=tW(e,t,n,r,_,A,c+o)).length>0&&l[0]>=_&&l[1]<=A)return[l[0],l[1]];var M=n+d-c,R=r+h-c;if((l=tW(e,t,n,r,M,R,c+o)).length>0&&l[0]>=M&&l[1]>=R)return[l[0],l[1]];var I=n-d+c,L=r+h-c;return(l=tW(e,t,n,r,I,L,c+o)).length>0&&l[0]<=I&&l[1]>=L?[l[0],l[1]]:[]},tM=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},tR=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)},tI=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]},tL=function(e,t,n,r,i){var a,o,s,l,u,c,d,h;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,d=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]=-d+u+c,d+=(u+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+u)/2,i[3]=d,i[5]=-d;return}if(i[5]=i[3]=0,0===a){h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-d+2*h,i[4]=i[2]=-(h+d);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(l/3),i[2]=-d+h*Math.cos((l+2*Math.PI)/3),i[4]=-d+h*Math.cos((l+4*Math.PI)/3)},tN=function(e,t,n,r,i,a,o,s){var l,u=[];tL(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,n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var c=[],d=0;d<6;d+=2)1e-7>Math.abs(u[d+1])&&u[d]>=0&&u[d]<=1&&c.push(u[d]);c.push(1),c.push(0);for(var h=-1,f=0;f=0?ll?(e-i)*(e-i)+(t-a)*(t-a):u-d},tO=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},tV=function(e,t,n,r,i,a,o,s,l){var u,c=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),h=Math.sin(-u),f=0;f0?tX(tj(c,-l)):c)},tF=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),u=0;u=0&&p<=1&&v.push(p),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]},tU=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},tH=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,d=o-i,h=t-a,f=r-t,p=s-a,g=d*h-p*u,v=c*h-f*u,y=p*c-d*f;if(0!==y){var b=g/y,x=v/y;return -.001<=b&&b<=1.001&&-.001<=x&&x<=1.001||l?[e+b*c,t+b*f]:[]}return 0!==g&&0!==v?[]:tU(e,n,o)===o?[o,s]:tU(e,n,i)===i?[i,a]:tU(i,o,n)===n?[n,r]:[]},tK=function(e,t,n,r,i){var a=[],o=r/2,s=i/2;a.push({x:t+o*e[0],y:n+s*e[1]});for(var l=1;l0?tX(tj(g,-s)):g}else u=n;for(var b=0;b2){for(var f=[c[0],c[1]],p=Math.pow(f[0]-e,2)+Math.pow(f[1]-t,2),g=1;gu&&(u=t)},d=function(e){return l[e]},h=0;h0?x.edgesTo(b)[0]:b.edgesTo(x)[0]);u[b=b.id()]>u[v]+w&&(u[b]=u[v]+w,0>h.nodes.indexOf(b)?h.push(b):h.updateItem(b),l[b]=0,n[b]=[]),u[b]==u[v]+w&&(l[b]=l[b]+l[v],n[b].push(v))}else for(var E=0;E0;){for(var P=t.pop(),S=0;S0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},nh=function(e,t){for(var n=0;n5&&void 0!==arguments[5]?arguments[5]:ng,o=r,s=0;s=2?nw(e,t,n,0,nm,nb):nw(e,t,n,0,ny)},squaredEuclidean:function(e,t,n){return nw(e,t,n,0,nm)},manhattan:function(e,t,n){return nw(e,t,n,0,ny)},max:function(e,t,n){return nw(e,t,n,-1/0,nx)}};function nk(e,t,n,r,i,a){var o;return(o=D(e)?e:nE[e]||nE.euclidean,0===t&&D(e))?o(i,a):o(t,n,r,i,a)}nE["squared-euclidean"]=nE.squaredEuclidean,nE.squaredeuclidean=nE.squaredEuclidean;var nT=eY({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),nC=function(e){return nT(e)},nP=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return nk(e,r.length,a,function(e){return r[e](t)},n,t)},nS=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},nA=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 p=t[s],g=t[r[s]];o="dendrogram"===i.mode?{left:p,right:g,key:p.key}:{value:p.value.concat(g.value),key:p.key},e[p.index]=o,e.splice(g.index,1),t[p.key]=o;for(var v=0;vn[g.key][y.key]&&(a=n[g.key][y.key])):"max"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]0&&r.push(i);return r},n$=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 n$(e,t,n)},nJ=function(e){for(var t,n,r,i,a,o,s,l=this.cy(),u=this.nodes(),c=nH(e),d={},h=0;h=S?(B=S,S=_,D=A):_>B&&(B=_);for(var M=0;M0);T[s%c.minIterations*t+O]=V,z+=V}if(z>0&&(s>=c.minIterations-1||s==c.maxIterations-1)){for(var F=0,X=0;X1)}});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}},n2=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(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),d=l.merge(c);r.push(d),a=a.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},n5={};[e1,{dijkstra:function(e){if(!A(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=e4(e),r=n.root,i=n.weight,a=n.directed,o=this,s=B(r)?this.filter(r)[0]:r[0],l={},u={},c={},d=this.byGroup(),h=d.nodes,f=d.edges;f.unmergeBy(function(e){return e.isLoop()});for(var p=function(e){return l[e.id()]},g=new e3(function(e,t){return p(e)-p(t)}),v=0;v0;){var b=g.pop(),x=p(b);if(c[b.id()]=x,x!==1/0)for(var w=b.neighborhood().intersect(h),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===d){for(var E=[],k=o,T=d,C=b[T];E.unshift(k),null!=C&&E.unshift(C),null!=(k=y[T]);)C=b[T=k.id()];return{found:!0,distance:h[n],path:this.spawn(E),steps:w}}p[n]=!0;for(var P=t._private.edges,S=0;SC&&(h[T]=C,g[T]=k,v[T]=b),!i){var P=k*l+E;!i&&h[P]>C&&(h[P]=C,g[P]=E,v[P]=b)}}}for(var S=0;S1&&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:f,negativeWeightCycles:p}}},{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/e7);if(i<2)return void eN("At least 2 nodes are required for Karger-Stein algorithm");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 d={found:!1,trail:void 0};if(l)return d;if(n&&t)if(s){if(r&&n!=r)return d;r=n}else{if(r&&n!=r&&t!=r)return d;r||(r=n)}else r||(r=this[0].id());var h=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},f=[],p=[];for(p=h(r);1!=p.length;)0==u[p[0]].length?(f.unshift(this.getElementById(p.shift())),f.unshift(this.getElementById(p.shift()))):p=h(p.shift()).concat(p);for(var g in f.unshift(this.getElementById(p.shift())),u)if(u[g].length)return d;return d.found=!0,d.trail=this.spawn(f,!0),d}},{hopcroftTarjanBiconnected:n1,htbc:n1,htb:n1,hopcroftTarjanBiconnectedComponents:n1},{tarjanStronglyConnected:n2,tsc:n2,tscc:n2,tarjanStronglyConnectedComponents:n2}].forEach(function(e){J(n5,e)});var n3=function(e){if(!(this instanceof n3))return new n3(e);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 e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};n3.prototype={fulfill:function(e){return n4(this,1,"fulfillValue",e)},reject:function(e){return n4(this,2,"rejectReason",e)},then:function(e,t){var n=new n3;return this.onFulfilled.push(n8(e,n,"fulfill")),this.onRejected.push(n8(t,n,"reject")),n9(this),n.proxy}};var n4=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,n9(e)),e},n9=function(e){1===e.state?n6(e,"onFulfilled",e.fulfillValue):2===e.state&&n6(e,"onRejected",e.rejectReason)},n6=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;etypeof Promise?Promise:n3,rt=function(e,t,n){var r=z(e),i=this._private=J({duration:1e3},t,n);if(i.target=e,i.style=i.style||i.css,i.started=!1,i.playing=!1,i.hooked=!1,i.applying=!1,i.progress=0,i.completes=[],i.frames=[],i.complete&&D(i.complete)&&i.completes.push(i.complete),!r){var a=e.position();i.startPosition=i.startPosition||{x:a.x,y:a.y},i.startStyle=i.startStyle||e.cy().style().getAnimationStartStyle(e,i.style)}if(r){var o=e.pan();i.startPan={x:o.x,y:o.y},i.startZoom=e.zoom()}this.length=1,this[0]=this},rn=rt.prototype;function rr(){return oL?oI:(oL=1,oI=Array.isArray)}function ri(){if(o$)return oZ;o$=1;var e=function(){if(oH)return oU;oH=1;var e=function(){if(oV)return oO;oV=1;var e=eh(),t=eu();return oO=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}(),t=function(){if(oY)return oj;oY=1;var e,t=oX?oF:(oX=1,oF=ec()["__core-js_shared__"]),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return oj=function(e){return!!n&&n in e}}(),n=eu(),r=function(){if(oW)return oq;oW=1;var e=Function.prototype.toString;return oq=function(t){if(null!=t){try{return e.call(t)}catch(e){}try{return t+""}catch(e){}}return""}}(),i=/^\[object .+?Constructor\]$/,a=Object.prototype,o=Function.prototype.toString,s=a.hasOwnProperty,l=RegExp("^"+o.call(s).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return oU=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=oG?oK:(oG=1,oK=function(e,t){return null==e?void 0:e[t]});return oZ=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function ra(){return oJ?oQ:(oJ=1,oQ=ri()(Object,"create"))}function ro(){return sa?si:(sa=1,si=function(e,t){return e===t||e!=e&&t!=t})}function rs(){if(ss)return so;ss=1;var e=ro();return so=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return -1}}function rl(){if(sC)return sT;sC=1;var e=sk?sE:(sk=1,sE=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return sT=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function ru(){if(sX)return sF;sX=1;var e=function(){if(sV)return sO;sV=1;var e=function(){if(sz)return sN;sz=1;var e=function(){if(sL)return sI;sL=1;var e=function(){if(sw)return sx;sw=1;var e=function(){if(st)return se;st=1;var e=function(){if(o1)return o0;o1=1;var e=ra();return o0=function(){this.__data__=e?e(null):{},this.size=0}}(),t=o5?o2:(o5=1,o2=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=!!t,t}),n=function(){if(o4)return o3;o4=1;var e=ra(),t=Object.prototype.hasOwnProperty;return o3=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(o6)return o9;o6=1;var e=ra(),t=Object.prototype.hasOwnProperty;return o9=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(o7)return o8;o7=1;var e=ra();return o8=function(t,n){var r=this.__data__;return this.size+=+!this.has(t),r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1}}(),i=function(){if(sg)return sp;sg=1;var e=rs();return sp=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&t%1==0&&t0}},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){_(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}};rb.className=rb.classNames=rb.classes;var rx={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:H,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};for(ot=0,rx.variable="(?:[\\w-.]|(?:\\\\"+rx.metaChar+"))+",rx.className="(?:[\\w-]|(?:\\\\"+rx.metaChar+"))+",rx.value=rx.string+"|"+rx.number,rx.id=rx.variable,a7=rx.comparatorOp.split("|");ot=0||"="!==oe&&(rx.comparatorOp+="|\\!"+oe);var rw=function(){return{checks:[]}},rE=[{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*Q(e.selector,t.selector)}),rk=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">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0&&l.edgeCount>0)return eO("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return eO("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&eO("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 B(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case 0:var l=e(s);return l.substring(0,l.length-1);case 3:return"["+r.field+n(e(r.operator))+t(s)+"]";case 5:var u=r.operator,c=r.field;return"["+e(u)+c+"]";case 4:return"["+r.field+"]";case 6:var d=r.operator;return"[["+r.field+n(e(d))+t(s)+"]]";case 7:return s;case 8:return"#"+s;case 9:return"."+s;case 17:case 15:return i(r.parent,a)+n(">")+i(r.child,a);case 18:case 16:return i(r.ancestor,a)+" "+i(r.descendant,a);case 19:var h=i(r.left,a),f=i(r.subject,a),p=i(r.right,a);return h+(h.length>0?" ":"")+f+p;case 20: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 rX(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1)||void 0===arguments[1]||arguments[1];return rF(this,e,t,rX)},rV.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return rF(this,e,t,rj)},rV.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return rF(this,e,t,rY)},rV.ancestors=rV.parents,(ll=lu={data:ry.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:ry.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ry.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ry.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ry.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ry.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=ll.data,ll.removeAttr=ll.removeData;var rq={};function rW(e){return function(t){if(void 0===t&&(t=!0),0!==this.length)if(!this.isNode()||this.removed())return;else{for(var n=0,r=this[0],i=r._private.edges,a=0;at}),minIndegree:rU("indegree",function(e,t){return et}),minOutdegree:rU("outdegree",function(e,t){return et})}),J(rq,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0;c&&(u=u[0]);var d=c?u.position():{x:0,y:0};void 0!==t?l.position(e,t+d[e]):void 0!==i&&l.position({x:i.x+d.x,y:i.y+d.y})}else{var h=n.position(),f=o?n.parent():null,p=f&&f.length>0;p&&(f=f[0]);var g=p?f.position():{x:0,y:0};return(i={x:h.x-g.x,y:h.y-g.y},void 0===e)?i:i[e]}else if(!a)return;return this}}).modelPosition=lc.point=lc.position,lc.modelPositions=lc.points=lc.positions,lc.renderedPoint=lc.renderedPosition,lc.relativePoint=lc.relativePosition;var rG=function(e){switch(e){case"left":case"right-inside":return"left";case"right":case"left-inside":return"right";default:return"center"}},rZ=function(e){switch(e){case"top":case"bottom-inside":return"top";case"bottom":case"top-inside":return"bottom";default:return"center"}},r$=function(e){switch(e){case"left":case"right-inside":return"right";case"right":case"left-inside":return"left";default:return"center"}};lh=lf={},lf.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}},lf.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},lf.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 d=y(i.width.val-a.w,s,l),h=d.biasDiff,f=d.biasComplementDiff,p=y(i.height.val-a.h,u,c),g=p.biasDiff,v=p.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}return"px"===n.units?n.pfValue: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=(-h+a.x1+a.x2+f)/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 rQ=function(e){return e===1/0||e===-1/0?0:e},rJ=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)},r0=function(e,t){return null==t?e:rJ(e,t.x1,t.y1,t.x2,t.y2)},r1=function(e,t,n){return eH(e,t,n)},r2=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,tk(u,1),rJ(e,u.x1,u.y1,u.x2,u.y2)}}},r5=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"),d=t.pstyle("text-valign"),h=r1(i,"labelWidth",n),f=r1(i,"labelHeight",n),p=r1(i,"labelX",n),g=r1(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,T=h/2,C=f/2;if(b)o=p-T,s=p+T,l=g-C,u=g+C;else{switch(rG(c.value)){case"left":o=p-h,s=p;break;case"center":o=p-T,s=p+T;break;case"right":o=p,s=p+h}switch(rZ(d.value)){case"top":l=g-f,u=g;break;case"center":l=g-C,u=g+C;break;case"bottom":l=g,u=g+f}}var P=v-Math.max(w,E)-k-2,S=v+Math.max(w,E)+k+2,B=y-Math.max(w,E)-k-2,D=y+Math.max(w,E)+k+2;o+=P,s+=S,l+=B,u+=D;var _=n||"main",A=r.labelBounds,M=A[_]=A[_]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=u,M.w=s-o,M.h=u-l,M.leftPad=P,M.rightPad=S,M.topPad=B,M.botPad=D;var R=b&&"autorotate"===x.strValue,I=null!=x.pfValue&&0!==x.pfValue;if(R||I){var L=R?r1(r.rstyle,"labelAngle",n):x.pfValue,N=Math.cos(L),z=Math.sin(L),O=(o+s)/2,V=(l+u)/2;if(!b){switch(rG(c.value)){case"left":O=s;break;case"right":O=o}switch(rZ(d.value)){case"top":V=u;break;case"bottom":V=l}}var F=function(e,t){return{x:(e-=O)*N-(t-=V)*z+O,y:e*z+t*N+V}},X=F(o,l),j=F(o,u),Y=F(s,l),q=F(s,u);o=Math.min(X.x,j.x,Y.x,q.x),s=Math.max(X.x,j.x,Y.x,q.x),l=Math.min(X.y,j.y,Y.y,q.y),u=Math.max(X.y,j.y,Y.y,q.y)}var W=_+"Rot",U=A[W]=A[W]||{};U.x1=o,U.y1=l,U.x2=s,U.y2=u,U.w=s-o,U.h=u-l,rJ(e,o,l,s,u),rJ(r.labelBounds.all,o,l,s,u)}return e}},r3=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value+t.pstyle("outline-offset").value;r4(e,t,n,r,"outside",r/2)}},r4=function(e,t,n,r,i,a){if(0!==n&&!(r<=0)&&"inside"!==i){var o=t.cy().renderer(),s=o.nodeShapes[o.getNodeShape(t)];if(s){var l=t.position(),u=l.x,c=l.y,d=t.width(),h=t.height();s.hasMiterBounds?("center"===i&&(r/=2),r0(e,s.miterBounds(u,c,d,h,r))):null!=a&&a>0&&tT(e,[a,a,a,a])}}},r9=function(e,t){if(!t.cy().headless()){var n=t.pstyle("border-opacity").value,r=t.pstyle("border-width").pfValue,i=t.pstyle("border-position").value;r4(e,t,n,r,i)}},r6=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=tb(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,c=s&&r?e.pstyle("bounds-expansion").pfValue:[0],d=function(e){return"none"!==e.pstyle("display").value},h=!r||d(e)&&(!l||d(e.source())&&d(e.target()));if(h){var f=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(f=e.pstyle("overlay-padding").value);var p=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(p=e.pstyle("underlay-padding").value);var g=Math.max(f,p),v=0;if(r&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();C=y.x,P=y.y;var b=e.outerWidth()/2,x=e.outerHeight()/2;w=C-b,E=C+b,rJ(a,w,k=P-x,E,T=P+x),r&&r3(a,e),r&&t.includeOutlines&&!i&&r3(a,e),r&&r9(a,e)}else if(l&&t.includeEdges)if(r&&!i){var w,E,k,T,C,P,S,B=e.pstyle("curve-style").strValue;if(w=Math.min(u.srcX,u.midX,u.tgtX),E=Math.max(u.srcX,u.midX,u.tgtX),k=Math.min(u.srcY,u.midY,u.tgtY),T=Math.max(u.srcY,u.midY,u.tgtY),w-=v,E+=v,rJ(a,w,k-=v,E,T+=v),"haystack"===B){var D=u.haystackPts;if(D&&2===D.length){if(w=D[0].x,k=D[0].y,E=D[1].x,T=D[1].y,w>E){var _=w;w=E,E=_}if(k>T){var A=k;k=T,T=A}rJ(a,w-v,k-v,E+v,T+v)}}else if("bezier"===B||"unbundled-bezier"===B||U(B,"segments")||U(B,"taxi")){switch(B){case"bezier":case"unbundled-bezier":S=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":S=u.linePts}if(null!=S)for(var M=0;ME){var N=w;w=E,E=N}if(k>T){var z=k;k=T,T=z}w-=v,E+=v,rJ(a,w,k-=v,E,T+=v)}if(r&&t.includeEdges&&l&&(r2(a,e,"mid-source"),r2(a,e,"mid-target"),r2(a,e,"source"),r2(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var O=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;rJ(a,a.x1+O,a.y1+V,a.x2+O,a.y2+V)}var F=o.bodyBounds=o.bodyBounds||{};tC(F,a),tT(F,c),tk(F,1),r&&(w=a.x1,E=a.x2,k=a.y1,T=a.y2,rJ(a,w-g,k-g,E+g,T+g));var X=o.overlayBounds=o.overlayBounds||{};tC(X,a),tT(X,c),tk(X,1);var j=o.labelBounds=o.labelBounds||{};null!=j.all?tx(j.all):j.all=tb(),r&&t.includeLabels&&(t.includeMainLabels&&r5(a,e,null),l&&(t.includeSourceLabels&&r5(a,e,"source"),t.includeTargetLabels&&r5(a,e,"target")))}return a.x1=rQ(a.x1),a.y1=rQ(a.y1),a.x2=rQ(a.x2),a.y2=rQ(a.y2),a.w=rQ(a.x2-a.x1),a.h=rQ(a.y2-a.y1),a.w>0&&a.h>0&&h&&(tT(a,c),tk(a,1)),a},r8=function(e){var t=0,n=function(e){return!!e<0&&void 0!==arguments[0]?arguments[0]:im,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},ix.removeAllListeners=function(){return this.removeListener("*")},ix.emit=ix.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,_(t)||(t=[t]),ik(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&&B(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){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));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(A(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(B(e))if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}else 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)}}),ij.neighbourhood=ij.neighborhood,ij.closedNeighbourhood=ij.closedNeighborhood,ij.openNeighbourhood=ij.openNeighborhood,J(ij,{source:rO(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:rO(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:iU({attr:"source"}),targets:iU({attr:"target"})}),J(ij,{edgesWith:rO(iH(),"edgesWith"),edgesTo:rO(iH({thisIsSrc:!0}),"edgesTo")}),J(ij,{connectedEdges:rO(function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),ij.componentsOf=ij.components;var iG=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)return void eN("A collection must have a reference to the core");var i=new eZ,a=!1;if(t){if(t.length>0&&A(t[0])&&!L(t[0])){a=!0;for(var o=[],s=new eQ,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 R,I,L,N=R.length===this.length?this:new iG(n,R),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 p?function(e){return b[e*(b.length-1)|0]}:x}}(),iQ=function(e,t,n,r){var i=function(e,t,n,r){var i="u">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);if(u>=.001){for(var c=a,d=0;d<4;++d){var h=l(c,e,n);if(0===h)break;var f=s(c,e,n)-t;c-=f/h}return c}return 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 d="generateBezier("+[e,t,n,r]+")";return c.toString=function(){return d},c}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},iJ={linear:function(e,t,n){return e+(t-e)*n},ease:iQ(.25,.1,.25,1),"ease-in":iQ(.42,0,1,1),"ease-out":iQ(0,0,.58,1),"ease-in-out":iQ(.42,0,.58,1),"ease-in-sine":iQ(.47,0,.745,.715),"ease-out-sine":iQ(.39,.575,.565,1),"ease-in-out-sine":iQ(.445,.05,.55,.95),"ease-in-quad":iQ(.55,.085,.68,.53),"ease-out-quad":iQ(.25,.46,.45,.94),"ease-in-out-quad":iQ(.455,.03,.515,.955),"ease-in-cubic":iQ(.55,.055,.675,.19),"ease-out-cubic":iQ(.215,.61,.355,1),"ease-in-out-cubic":iQ(.645,.045,.355,1),"ease-in-quart":iQ(.895,.03,.685,.22),"ease-out-quart":iQ(.165,.84,.44,1),"ease-in-out-quart":iQ(.77,0,.175,1),"ease-in-quint":iQ(.755,.05,.855,.06),"ease-out-quint":iQ(.23,1,.32,1),"ease-in-out-quint":iQ(.86,0,.07,1),"ease-in-expo":iQ(.95,.05,.795,.035),"ease-out-expo":iQ(.19,1,.22,1),"ease-in-out-expo":iQ(1,0,0,1),"ease-in-circ":iQ(.6,.04,.98,.335),"ease-out-circ":iQ(.075,.82,.165,1),"ease-in-out-circ":iQ(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return iJ.linear;var r=i$(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":iQ};function i0(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 i1(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function i2(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=i1(e,i),s=i1(t,i);if(M(o)&&M(s))return i0(a,o,s,n,r);if(_(o)&&_(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 d=a[c],h=d._private;if(h.stopped){a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,u(h.frames);continue}(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||function(e,t){var n=e._private;n.started=!0,n.startTime=t-n.progress*n.duration}(d,e),function(e,t,n,r){var i,a,o,s,l=!r,u=e._private,c=t._private,d=c.easing,h=c.startTime,f=(r?e:e.cy()).style();c.easingImpl||(null==d?c.easingImpl=iJ.linear:(i=B(d)?f.parse("transition-timing-function",d).value:d,B(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=iJ[a].apply(null,o)):c.easingImpl=iJ[a]));var p=c.easingImpl;if(s=0===c.duration?1:(n-h)/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={};i5(g.x,v.x)&&(y.x=i2(g.x,v.x,s,p)),i5(g.y,v.y)&&(y.y=i2(g.y,v.y,s,p)),e.position(y)}var b=c.startPan,x=c.pan,w=u.pan,E=null!=x&&r;E&&(i5(b.x,x.x)&&(w.x=i2(b.x,x.x,s,p)),i5(b.y,x.y)&&(w.y=i2(b.y,x.y,s,p)),e.emit("pan"));var k=c.startZoom,T=c.zoom,C=null!=T&&r;C&&(i5(k,T)&&(u.zoom=tm(u.minZoom,i2(k,T,s,p),u.maxZoom)),e.emit("zoom")),(E||C)&&e.emit("viewport");var P=c.style;if(P&&P.length>0&&l){for(var S=0;S0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var i4={animate:ry.animate(),animation:ry.animation(),animated:ry.animated(),clearQueue:ry.clearQueue(),delay:ry.delay(),delayAnimation:ry.delayAnimation(),stop:ry.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){i3(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&em(function(n){i3(n,e),t()})}()}}},i9={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&&L(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}},i6=function(e){return B(e)?new rL(e):e},i8={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new ib(i9,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,i6(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,i6(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,i6(t),n),this},once:function(e,t,n){return this.emitter().one(e,i6(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}};ry.eventAliasesOn(i8);var i7={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)}};i7.jpeg=i7.jpg;var ae={layout:function(e){if(null==e)return void eN("Layout options must be specified to make a layout");if(null==e.name)return void eN("A `name` must be specified to make a layout");var t,n=e.name,r=this.extension("layout",n);return null==r?void eN("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?"):(t=B(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(J({},e,{cy:this,eles:t})))}};ae.createLayout=ae.makeLayout=ae.layout;var at=eY({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),an={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)return void eN("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));void 0!==e.wheelSensitivity&&eO("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=at(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)}};an.invalidateDimensions=an.resize;var ar={collection:function(e,t){return B(e)?this.$(e):I(e)?e.collection():_(e)?(t||(t={}),new iG(this,e,t.unique,t.removed)):new iG(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}};ar.elements=ar.filter=ar.$;var ai={};ai.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(d||c&&h){var f=void 0;d&&h||d?f=l.properties:h&&(f=l.mappedProperties);for(var p=0;p1&&(v=1),o.color){var E=r.valueMin[0],k=r.valueMax[0],T=r.valueMin[1],C=r.valueMax[1],P=r.valueMin[2],S=r.valueMax[2],B=null==r.valueMin[3]?1:r.valueMin[3],D=[Math.round(E+(k-E)*v),Math.round(T+(C-T)*v),Math.round(P+(S-P)*v),Math.round(B+((null==r.valueMax[3]?1:r.valueMax[3])-B)*v)];g={bypass:r.bypass,name:r.name,value:D,strValue:"rgb("+D[0]+", "+D[1]+", "+D[2]+")"}}else{if(!o.number)return!1;var _=r.valueMin+(r.valueMax-r.valueMin)*v;g=this.parse(r.name,_,r.bypass,d)}if(!g)return p(),!1;g.mapping=r,r=g;break;case a.data:for(var A=r.field.split("."),R=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)},ai.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);!e.removed()&&null!=s&&s(n,r,e)&&a(o)},ai.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)})},ai.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},ai.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfConnectedEdges},function(t){e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},ai.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBoundsOfParallelEdges},function(t){e.parallelEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},ai.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var aa={};aa.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){eO("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 rL(l).invalid){eO("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],c=!1;n=u;for(var d=[];!n.match(/^\s*$/);){var h=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!h){eO("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),c=!0;break}r=h[0];var f=h[1],p=h[2];if(!this.properties[f]){eO("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(f,p)){eO("Skipping property: Invalid property definition in: "+r),o();continue}d.push({name:f,val:p}),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 d=this.parse(e,v[4]);if(!d||d.mapped)return!1;var h=this.parse(e,v[5]);if(!h||h.mapped)return!1;if(d.pfValue===h.pfValue||d.strValue===h.strValue)return eO("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+d.strValue+"`"),this.parse(e,d.strValue);if(l.color){var f=d.value,p=h.value;if(f[0]===p[0]&&f[1]===p[1]&&f[2]===p[2]&&(f[3]===p[3]||(null==f[3]||1===f[3])&&(null==p[3]||1===p[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:c,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:h.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(y=s?t.split(/\s+/):_(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var g,v,y,b=[],x=[],w=[],E="",k=!1,T=0;T0?" ":"")+C.strValue}if(l.validate&&!l.validate(b,x))return null;if(l.singleEnum&&k)if(1===b.length&&B(b[0]))return{name:e,value:b[0],strValue:b[0],bypass:n};else return null;return{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var P=function(){for(var r=0;rl.max||l.strictMax&&t===l.max))return null;var N={name:e,value:t,strValue:""+t+(A||""),units:A,bypass:n};return l.unitless||"px"!==A&&"em"!==A?N.pfValue=t:N.pfValue="px"!==A&&A?this.getEmSizeInPixels()*t:t,("ms"===A||"s"===A)&&(N.pfValue="ms"===A?t:1e3*t),("deg"===A||"rad"===A)&&(N.pfValue="rad"===A?t:Math.PI*t/180),"%"===A&&(N.pfValue=t/100),N}if(l.propList){var z=[],O=""+t;if("none"===O);else{for(var V=O.split(/\s*,\s*|\s+/),F=0;F0&&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:A(e)&&(n=e.level,null!=e.position?t=tn(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(B(e)){var n=e;e=this.mutableElements().filter(n)}else I(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}};ap.centre=ap.center,ap.autolockNodes=ap.autolock,ap.autoungrabifyNodes=ap.autoungrabify;var ag={data:ry.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ry.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ry.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ry.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};ag.attr=ag.data,ag.removeAttr=ag.removeData;var av=function(e){var t=this,n=(e=J({},e)).container;n&&!R(n)&&R(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!==w&&void 0!==n&&!e.headless,o=e;o.layout=J({name:a?"grid":"null"},o.layout),o.renderer=J({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 iG(this),listeners:[],aniEles:new iG(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:A(o.pan)&&M(o.pan.x)?o.pan.x:0,y:A(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=J({},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&&(A(e)||_(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=J({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(F))return re.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,D(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=!!t.boundingBox,l=tb(s?t.boundingBox:structuredClone(n.extent()));if(I(t.roots))e=t.roots;else if(_(t.roots)){for(var u=[],c=0;c0;){var S=T.shift(),D=function(e,n){for(var i=ax(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l0&&g[0].length<=3?a/2:0),u=2*Math.PI/g[r].length*i;return 0===r&&1===g[0].length&&(o=1),{x:H.x+o*Math.cos(u),y:H.y+o*Math.sin(u)}}var c=g[r].length,d=Math.max(1===c?0:s?(l.w-2*t.padding-K.w)/((t.grid?Z:c)-1):(l.w-2*t.padding-K.w)/((t.grid?Z:c)+1),A);return{x:H.x+(i+1-(c+1)/2)*d,y:H.y+(r+1-(F+1)/2)*G}},J={downward:0,leftward:90,upward:180,rightward:-90};return -1===Object.keys(J).indexOf(t.direction)&&eN("Invalid direction '".concat(t.direction,"' specified for breadthfirst layout. Valid values are: ").concat(Object.keys(J).join(", "))),r.nodes().layoutPositions(this,t,function(e){return function(e,t,n){if(0===n)return e;var r,i,a,o,s=(t.x1+t.x2)/2,l=(t.y1+t.y2)/2,u=t.w/t.h,c=(r=e.x,i=e.y,{x:Math.cos(a=n*Math.PI/180)*(r-s)-Math.sin(a)*(i-l)+s,y:Math.sin(a)*(r-s)+Math.cos(a)*(i-l)+l}),d=(o=c.x,{x:(o-s)*u+s,y:(c.y-l)*(1/u)+l});return{x:d.x,y:d.y}}($(e),l,J[t.direction])}),this};var ak={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 aT(e){this.options=J({},ak,e)}aT.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=tb(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 h=Math.cos(l)-1,f=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(h*h+f*f)),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 aC={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 aP(e){this.options=J({},aC,e)}aP.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=tb(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)>=p&&(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,T=0;T1&&e.avoidOverlap){var B=Math.cos(S)-1,D=Math.sin(S)-0;k=Math.max(Math.sqrt(x*x/(B*B+D*D)),k)}C.r=k,k+=x}if(e.equidistant){for(var _=0,A=0,M=0;M=e.numIter)&&(aL(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),em(c)):(aH(r,e),s())};c()}else{for(;u;)u=o(l),l++;aH(r,e),s()}return this},aB.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},aB.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var aD=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=tb(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(T);for(var u=0;ur.count?0:r.graph},aA=function(e,t,n,r){var i=r.graphSet[n];if(-10)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,c=s*a/l;else var d=aF(e,i,a),h=aF(t,-1*i,-1*a),f=h.x-d.x,p=h.y-d.y,g=f*f+p*p,l=Math.sqrt(g),s=(e.nodeRepulsion+t.nodeRepulsion)/g,u=s*f/l,c=s*p/l;e.isLocked||(e.offsetX-=u,e.offsetY-=c),t.isLocked||(t.offsetX+=u,t.offsetY+=c)}},aV=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},aF=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},aX=function(e,t){for(var n=0;n1){var p=t.gravity*d/f,g=t.gravity*h/f;c.offsetX+=p,c.offsetY+=g}}}}},aY=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},aU=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;if((null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeftr.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTopg&&(h+=p+t.componentSpacing,d=0,f=0,p=0)}}},aK={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 aG(e){this.options=J({},aK,e)}aG.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=tb(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},d=e.rows,h=null!=e.cols?e.cols:e.columns;if(null!=d&&null!=h)s=d,l=h;else if(null!=d&&null==h)l=Math.ceil(a/(s=d));else if(null==d&&null!=h)s=Math.ceil(a/(l=h));else if(l*s>a){var f=u(),p=c();(f-1)*p>=a?u(f-1):(p-1)*f>=a&&c(p-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&&(A=0,_++)},R={},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,f=l/2+h,p=f*f,g=2*f,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=tz(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=tN(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),T=[{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},a6.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=2/this.cy.zoom(),o=[],s=Math.min(e,n),u=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r);e=s,n=u;var h=tb({x1:e,y1:t=c,x2:n,y2:r=d}),f=[{x:h.x1,y:h.y1},{x:h.x2,y:h.y1},{x:h.x2,y:h.y2},{x:h.x1,y:h.y2}],p=[[f[0],f[1]],[f[1],f[2]],[f[2],f[3]],[f[3],f[0]]];function g(e,t){var n=e._private;e.boundingBox();var r=n.labelBounds.main;if(!r)return null;var i=eH(n.rscratch,"labelX",t),o=eH(n.rscratch,"labelY",t),s=eH(n.rscratch,"labelAngle",t),l=e.pstyle("text-margin-x").pfValue,u=e.pstyle("text-margin-y").pfValue,c=r.x1-a-l,d=r.x2+a-l,h=r.y1-a-u,f=r.y2+a-u;if(!s)return[{x:c,y:h},{x:d,y:h},{x:d,y:f},{x:c,y:f}];var p=Math.cos(s),g=Math.sin(s),v=function(e,t){return{x:(e-=i)*p-(t-=o)*g+i,y:e*g+t*p+o}};return[v(c,h),v(d,h),v(d,f),v(c,f)]}for(var v=0;v(t.y-e.y)*(n.x-e.x)}return i(e,n,r)!==i(t,n,r)&&i(e,t,n)!==i(e,t,r)}(V,F,j[0],j[1])){o.push(y),I=!0;break}}if(I)break}}}}}return o};var a8={};a8.calculateArrowAngles=function(e){var t=e._private.rscratch,n="haystack"===t.edgeType,r="bezier"===t.edgeType,i="multibezier"===t.edgeType,a="segments"===t.edgeType,o="compound"===t.edgeType,s="self"===t.edgeType;if(n?(y=t.haystackPts[0],b=t.haystackPts[1],x=t.haystackPts[2],w=t.haystackPts[3]):(y=t.arrowStartX,b=t.arrowStartY,x=t.arrowEndX,w=t.arrowEndY),d=t.midX,h=t.midY,a)g=y-t.segpts[0],v=b-t.segpts[1];else if(i||o||s||r){var l=t.allpts,u=tg(l[0],l[2],l[4],.1),c=tg(l[1],l[3],l[5],.1);g=y-u,v=b-c}else g=y-d,v=b-h;t.srcArrowAngle=tu(g,v);var d=t.midX,h=t.midY;if(n&&(d=(y+x)/2,h=(b+w)/2),g=x-y,v=w-b,a){var l=t.allpts;if(l.length/2%2==0){var f=l.length/2,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}else if(t.isRound)g=t.midVector[1],v=-t.midVector[0];else{var f=l.length/2-1,p=f-2;g=l[f]-l[p],v=l[f+1]-l[p+1]}}else if(i||o||s){var g,v,y,b,x,w,d,h,E,k,T,C,l=t.allpts;if(t.ctrlpts.length/2%2==0){var P=l.length/2-1,S=P+2,B=S+2;E=tg(l[P],l[S],l[B],0),k=tg(l[P+1],l[S+1],l[B+1],0),T=tg(l[P],l[S],l[B],1e-4),C=tg(l[P+1],l[S+1],l[B+1],1e-4)}else{var S=l.length/2-1,P=S-2,B=S+2;E=tg(l[P],l[S],l[B],.4999),k=tg(l[P+1],l[S+1],l[B+1],.4999),T=tg(l[P],l[S],l[B],.5),C=tg(l[P+1],l[S+1],l[B+1],.5)}g=T-E,v=C-k}if(t.midtgtArrowAngle=tu(g,v),t.midDispX=g,t.midDispY=v,g*=-1,v*=-1,a){var l=t.allpts;if(l.length/2%2==0);else if(!t.isRound){var f=l.length/2-1,D=f+2;g=-(l[D]-l[f]),v=-(l[D+1]-l[f+1])}}if(t.midsrcArrowAngle=tu(g,v),a)g=x-t.segpts[t.segpts.length-2],v=w-t.segpts[t.segpts.length-1];else if(i||o||s||r){var l=t.allpts,_=l.length,u=tg(l[_-6],l[_-4],l[_-2],.9),c=tg(l[_-5],l[_-3],l[_-1],.9);g=x-u,v=w-c}else g=x-d,v=w-h;t.tgtArrowAngle=tu(g,v)},a8.getArrowWidth=a8.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=r),r};var a7,oe,ot,on,or,oi,oa,oo,os,ol,ou,oc,od,oh,of,op,og,ov,oy,om,ob,ox,ow,oE,ok,oT,oC,oP,oS,oB,oD,o_,oA,oM,oR,oI,oL,oN,oz,oO,oV,oF,oX,oj,oY,oq,oW,oU,oH,oK,oG,oZ,o$,oQ,oJ,o0,o1,o2,o5,o3,o4,o9,o6,o8,o7,se,st,sn,sr,si,sa,so,ss,sl,su,sc,sd,sh,sf,sp,sg,sv,sy,sm,sb,sx,sw,sE,sk,sT,sC,sP,sS,sB,sD,s_,sA,sM,sR,sI,sL,sN,sz,sO,sV,sF,sX,sj,sY,sq,sW,sU,sH,sK,sG,sZ,s$,sQ,sJ,s0,s1,s2,s5,s3,s4,s9,s6,s8,s7,le,lt,ln,lr,li,la,lo,ls,ll,lu,lc,ld,lh,lf,lp,lg,lv,ly,lm,lb,lx,lw,lE,lk,lT,lC,lP,lS,lB,lD,l_={},lA={},lM=function(e,t,n){n.x=t.x-e.x,n.y=t.y-e.y,n.len=Math.sqrt(n.x*n.x+n.y*n.y),n.nx=n.x/n.len,n.ny=n.y/n.len,n.ang=Math.atan2(n.ny,n.nx)},lR=function(e,t){t.x=-1*e.x,t.y=-1*e.y,t.nx=-1*e.nx,t.ny=-1*e.ny,t.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},lI=function(e,t,n,r,i){if(e!==y?lM(t,e,l_):lR(lA,l_),lM(t,n,lA),lx=l_.nx*lA.ny-l_.ny*lA.nx,lw=l_.nx*lA.nx- -(l_.ny*lA.ny),1e-6>Math.abs(lT=Math.asin(Math.max(-1,Math.min(1,lx))))){lm=t.x,lb=t.y,lP=lB=0;return}lE=1,lk=!1,lw<0?lT<0?lT=Math.PI+lT:(lT=Math.PI-lT,lE=-1,lk=!0):lT>0&&(lE=-1,lk=!0),lB=void 0!==t.radius?t.radius:r,lC=lT/2,lD=Math.min(l_.len/2,lA.len/2),lP=i?(lS=Math.abs(Math.cos(lC)*lB/Math.sin(lC)))>lD?Math.abs((lS=lD)*Math.sin(lC)/Math.cos(lC)):lB:Math.abs((lS=Math.min(lD,lB))*Math.sin(lC)/Math.cos(lC)),g=t.x+lA.nx*lS,v=t.y+lA.ny*lS,lm=g-lA.ny*lP*lE,lb=v+lA.nx*lP*lE,f=t.x+l_.nx*lS,p=t.y+l_.ny*lS,y=t};function lL(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 lN(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}:(lI(e,t,n,r,i),{cx:lm,cy:lb,radius:lP,startX:f,startY:p,stopX:g,stopY:v,startAngle:l_.ang+Math.PI/2*lE,endAngle:lA.ang-Math.PI/2*lE,counterClockwise:lk})}var lz=Math.sqrt(.02),lO={};function lV(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},P=C(k,g?(d+f)/2:0),S=C(T,g?(h+p)/2:0),B=!1;"auto"===y?v=Math.abs(P)>Math.abs(S)?a:i:y===u||y===l?(v=i,B=!0):(y===o||y===s)&&(v=a,B=!0);var D=v===i,_=D?S:P,A=D?T:k,M=td(A),R=!1;!(B&&(x||w<0))&&(y===l&&A<0||y===u&&A>0||y===o&&A>0||y===s&&A<0)&&(M*=-1,_=M*Math.abs(_),R=!0);var I=function(e){return Math.abs(e)=Math.abs(_)},L=I(n=x?(w<0?1+w:w)*_:(w<0?_:0)+w*M),N=I(Math.abs(_)-Math.abs(n));if((L||N)&&!R)if(D){var z=Math.abs(k)<=f/2;if(Math.abs(A)<=h/2){var O=(c.x1+c.x2)/2;r.segpts=[O,c.y1,O,c.y2]}else if(z){var V=(c.y1+c.y2)/2;r.segpts=[c.x1,V,c.x2,V]}else r.segpts=[c.x1,c.y2]}else{var F=Math.abs(T)<=p/2;if(Math.abs(A)<=d/2){var X=(c.y1+c.y2)/2;r.segpts=[c.x1,X,c.x2,X]}else if(F){var j=(c.x1+c.x2)/2;r.segpts=[j,c.y1,j,c.y2]}else r.segpts=[c.x2,c.y1]}else if(D){var Y=c.y1+n+(g?h/2*M:0);r.segpts=[c.x1,Y,c.x2,Y]}else{var q=c.x1+n+(g?d/2*M:0);r.segpts=[q,c.y1,q,c.y2]}if(r.isRound){var W=e.pstyle("taxi-radius").value,U="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(W),r.isArcRadius=Array(r.segpts.length/2).fill(U)}},lO.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,d=t.srcCornerRadius,h=t.tgtCornerRadius,f=t.srcRs,p=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=th({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wf.poolIndex()){var p=h;h=f,f=p}var g=u.srcPos=h.position(),v=u.tgtPos=f.position(),y=u.srcW=h.outerWidth(),b=u.srcH=h.outerHeight(),x=u.tgtW=f.outerWidth(),E=u.tgtH=f.outerHeight(),k=u.srcShape=n.nodeShapes[t.getNodeShape(h)],T=u.tgtShape=n.nodeShapes[t.getNodeShape(f)],C=u.srcCornerRadius="auto"===h.pstyle("corner-radius").value?"auto":h.pstyle("corner-radius").pfValue,P=u.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,S=u.tgtRs=f._private.rscratch,B=u.srcRs=h._private.rscratch;u.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var D=0;D=lz||(q=Math.sqrt(Math.max(Y*Y,.01)+Math.max(j*j,.01)));var W=u.vector={x:Y,y:j},H=u.vectorNorm={x:W.x/q,y:W.y/q},K={x:-H.y,y:H.x};u.nodesOverlap=!M(q)||T.checkPoint(N[0],N[1],0,x,E,v.x,v.y,P,S)||k.checkPoint(O[0],O[1],0,y,b,g.x,g.y,C,B),u.vectorNormInverse=K,e={nodesOverlap:u.nodesOverlap,dirCounts:u.dirCounts,calculatedIntersection:!0,hasBezier:u.hasBezier,hasUnbundled:u.hasUnbundled,eles:u.eles,srcPos:v,srcRs:S,tgtPos:g,tgtRs:B,srcW:x,srcH:E,tgtW:y,tgtH:b,srcIntn:V,tgtIntn:z,srcShape:T,tgtShape:k,posPts:{x1:X.x2,y1:X.y2,x2:X.x1,y2:X.y1},intersectionPts:{x1:F.x2,y1:F.y2,x2:F.x1,y2:F.y1},vector:{x:-W.x,y:-W.y},vectorNorm:{x:-H.x,y:-H.y},vectorNormInverse:{x:-K.x,y:-K.y}}}var G=L?e:u;A.nodesOverlap=G.nodesOverlap,A.srcIntn=G.srcIntn,A.tgtIntn=G.tgtIntn,A.isRound=R.startsWith("round"),r&&(h.isParent()||h.isChild()||f.isParent()||f.isChild())&&(h.parents().anySame(f)||f.parents().anySame(h)||h.same(f)&&h.isParent())?t.findCompoundLoopPoints(_,G,D,I):h===f?t.findLoopPoints(_,G,D,I):R.endsWith("segments")?t.findSegmentsPoints(_,G):R.endsWith("taxi")?t.findTaxiPoints(_,G):"straight"!==R&&(I||u.eles.length%2!=1||D!==Math.floor(u.eles.length/2))?t.findBezierPoints(_,G,D,I,L):t.findStraightEdgePoints(_),t.findEndpoints(_),t.tryToCorrectInvalidPoints(_,G),t.checkForInvalidEdgeWarning(_),t.storeAllpts(_),t.storeEdgeProjections(_),t.calculateArrowAngles(_),t.recalculateEdgeLabelProjections(_),t.calculateLabelAngles(_)}}();this.findHaystackPoints(s)}},lO.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if(this.recalculateRenderedStyle(e),"segments"===t.edgeType)return lV(t.segpts)},lO.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return lV(t.ctrlpts)},lO.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var lF={};lF.manualEndptToPx=function(e,t){var n=e.position(),r=e.outerWidth(),i=e.outerHeight(),a=e._private.rscratch;if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*r),"%"===t.units[1]&&(o[1]=o[1]*i),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(r,i),u=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,r,i,u[0],u[1],0,"auto"===e.pstyle("corner-radius").value?"auto":e.pstyle("corner-radius").pfValue,a)},lF.findEndpoints=function(e){var t,n,r,i,a,o,s,l,u,c=e.source()[0],d=e.target()[0],h=c.position(),f=d.position(),p=e.pstyle("target-arrow-shape").value,g=e.pstyle("source-arrow-shape").value,v=e.pstyle("target-distance-from-node").pfValue,y=e.pstyle("source-distance-from-node").pfValue,b=c._private.rscratch,x=d._private.rscratch,w=e.pstyle("curve-style").value,E=e._private.rscratch,k=E.edgeType,T=U(w,"taxi"),C="self"===k||"compound"===k,P="bezier"===k||"multibezier"===k||C,S="bezier"!==k,B="straight"===k||"segments"===k,D="segments"===k,_=C||T,A=e.pstyle("source-endpoint"),R=_?"outside-to-node":A.value,I="auto"===c.pstyle("corner-radius").value?"auto":c.pstyle("corner-radius").pfValue,L=e.pstyle("target-endpoint"),N=_?"outside-to-node":L.value,z="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue;E.srcManEndpt=A,E.tgtManEndpt=L;var O=null!=(t=(null==L||null==(n=L.pfValue)?void 0:n.length)===2?L.pfValue:null)?t:[0,0],V=null!=(r=(null==A||null==(i=A.pfValue)?void 0:i.length)===2?A.pfValue:null)?r:[0,0];if(P){var F=[E.ctrlpts[0],E.ctrlpts[1]];o=S?[E.ctrlpts[E.ctrlpts.length-2],E.ctrlpts[E.ctrlpts.length-1]]:F,s=F}else if(B){var X=D?E.segpts.slice(0,2):[f.x+O[0],f.y+O[1]];o=D?E.segpts.slice(E.segpts.length-2):[h.x+V[0],h.y+V[1]],s=X}if("inside-to-node"===N)a=[f.x,f.y];else if(L.units)a=this.manualEndptToPx(d,L);else if("outside-to-line"===N)a=E.tgtIntn;else if("outside-to-node"===N||"outside-to-node-or-label"===N?l=o:("outside-to-line"===N||"outside-to-line-or-label"===N)&&(l=[h.x,h.y]),a=this.nodeShapes[this.getNodeShape(d)].intersectLine(f.x,f.y,d.outerWidth(),d.outerHeight(),l[0],l[1],0,z,x),"outside-to-node-or-label"===N||"outside-to-line-or-label"===N){var j=d._private.rscratch,Y=j.labelWidth,q=j.labelHeight,W=j.labelX,H=j.labelY,K=Y/2,G=q/2,Z=d.pstyle("text-valign").value;"top"===(Z=rZ(Z))?H-=G:"bottom"===Z&&(H+=G);var $=d.pstyle("text-halign").value;"left"===($=rG($))?W-=K:"right"===$&&(W+=K);var Q=tG(l[0],l[1],[W-K,H-G,W+K,H-G,W+K,H+G,W-K,H+G],f.x,f.y);if(Q.length>0){var J=tf(h,ti(a)),ee=tf(h,ti(Q)),et=J;ee2&&tf(h,{x:Q[2],y:Q[3]})0){var ep=tf(f,ti(a)),eg=tf(f,ti(ef)),ev=ep;eg2&&tf(f,{x:ef[2],y:ef[3]})=l||b){c={cp:g,segment:y};break}}if(c)break}var x=c.cp,w=c.segment,E=(l-h)/w.length,k=w.t1-w.t0,T=i?w.t0+k*E:w.t1-k*E;T=tm(0,T,1),t=tv(x.p0,x.p1,x.p2,T),u=lW(x.p0,x.p1,x.p2,T);break;case"straight":case"segments":case"haystack":for(var C,P,S,B,D=0,_=r.allpts.length,A=0;A+3<_&&(i?(C={x:r.allpts[A],y:r.allpts[A+1]},P={x:r.allpts[A+2],y:r.allpts[A+3]}):(C={x:r.allpts[_-2-A],y:r.allpts[_-1-A]},P={x:r.allpts[_-4-A],y:r.allpts[_-3-A]}),S=th(C,P),B=D,!((D+=S)>=l));A+=2);var M=(l-B)/S;t=ty(C,P,M=tm(0,M,1)),u=lq(C,P)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},lj.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},lj.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=eC(r,e._private.labelDimsKey);if(eH(n.rscratch,"prefixedLabelDimsKey",t)!==i){eK(n.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,r),o=e.pstyle("line-height").pfValue,s=e.pstyle("font-size").pfValue,l=e.pstyle("text-wrap").strValue,u=eH(n.rscratch,"labelWrapCachedLines",t)||[],c="wrap"!==l?1:Math.max(u.length,1),d=a.width,h=a.height+(c-1)*(o-1)*s;eK(n.rstyle,"labelWidth",t,d),eK(n.rscratch,"labelWidth",t,d),eK(n.rstyle,"labelHeight",t,h),eK(n.rscratch,"labelHeight",t,h),eK(n.rscratch,"labelLineHeight",t,s*o),eK(n.rscratch,"labelActualDescent",t,a.labelActualDescent)}},lj.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,s=function(e,r){return r?(eK(n.rscratch,e,t,r),r):eH(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(null!=u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c=i.split("\n"),d=e.pstyle("text-max-width").pfValue,h="anywhere"===e.pstyle("text-overflow-wrap").value,f=[],p=/[\s\u200b]+|$/g,g=0;gd){var b,x=v.matchAll(p),w="",E=0,k=o(x);try{for(k.s();!(b=k.n()).done;){var T=b.value,C=T[0],P=v.substring(E,T.index);E=T.index+C.length;var S=0===w.length?P:w+P+C;this.calculateLabelDimensions(e,S).width<=d?w+=P+C:(w&&f.push(w),w=P+C)}}catch(e){k.e(e)}finally{k.f()}w.match(/^[\s\u200b]+$/)||f.push(w)}else f.push(v)}s("labelWrapCachedLines",f),i=s("labelWrapCachedText",f.join("\n")),s("labelWrapKey",u)}else if("ellipsis"===l){var B=e.pstyle("text-max-width").pfValue,D="",_=!1;if(this.calculateLabelDimensions(e,i).widthB);A++)D+=i[A],A===i.length-1&&(_=!0);return _||(D+="…"),D}return i},lj.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;return"auto"!==t?t:e.isNode()?r$(n):"center"},lj.calculateLabelDimensions=function(e,t){var n=this.cy.window().document,r=e.pstyle("font-style").strValue,i=e.pstyle("font-size").pfValue,a=e.pstyle("font-family").strValue,o=e.pstyle("font-weight").strValue,s=e.pstyle("text-metrics").strValue||"font",l=this.labelCalcCanvas,u=this.labelCalcCanvasContext;if(!l){l=this.labelCalcCanvas=n.createElement("canvas"),u=this.labelCalcCanvasContext=l.getContext("2d");var c=l.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}u.font="".concat(r," ").concat(o," ").concat(i,"px ").concat(a);for(var d=0,h=0,f=t.split("\n"),p=f.length,g=0,v=0,y=0;ye.width()||28>e.height()))return lH||(eO("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),lH=!0),"rectangle";if(e.isParent())if("rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t)return t;else return"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var lK={};lK.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;rtypeof MutationObserver,q="u">typeof ResizeObserver;Y?(P.removeObserver=new MutationObserver(function(e){for(var t=0;t=P.desktopTapThreshold2}var b=_(e);t&&(P.hoverData.tapholdCancelled=!0),r=!0,D(d,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var x=function(t){return{originalEvent:e,type:t,position:{x:s[0],y:s[1]}}},w=function(){P.data.bgActivePosistion=void 0,P.hoverData.selecting||i.emit(x("boxstart")),c[4]=1,P.hoverData.selecting=!0,P.redrawHint("select",!0),P.redraw()};if(3===P.hoverData.which){if(t){var E=x("cxtdrag");f?f.emit(E):i.emit(E),P.hoverData.cxtDragged=!0,(!P.hoverData.cxtOver||d!==P.hoverData.cxtOver)&&(P.hoverData.cxtOver&&P.hoverData.cxtOver.emit(x("cxtdragout")),P.hoverData.cxtOver=d,d&&d.emit(x("cxtdragover")))}}else if(P.hoverData.dragging){if(r=!0,i.panningEnabled()&&i.userPanningEnabled()){if(P.hoverData.justStartedPan){var k=P.hoverData.mdownPos;n={x:(s[0]-k[0])*a,y:(s[1]-k[1])*a},P.hoverData.justStartedPan=!1}else n={x:p[0]*a,y:p[1]*a};i.panBy(n),i.emit(x("dragpan")),P.hoverData.dragged=!0}s=P.projectIntoViewport(e.clientX,e.clientY)}else if(1==c[4]&&(null==f||f.pannable()))t&&(!P.hoverData.dragging&&i.boxSelectionEnabled()&&(b||!i.panningEnabled()||!i.userPanningEnabled())?w():!P.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&A(f,P.hoverData.downs)&&(P.hoverData.dragging=!0,P.hoverData.justStartedPan=!0,c[4]=0,P.data.bgActivePosistion=ti(l),P.redrawHint("select",!0),P.redraw()),f&&f.pannable()&&f.active()&&f.unactivate());else{if(f&&f.pannable()&&f.active()&&f.unactivate(),f&&f.grabbed()||d==h||(h&&D(h,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),d&&D(d,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),P.hoverData.last=d),f)if(t){if(i.boxSelectionEnabled()&&b)f&&f.grabbed()&&(F(g),f.emit(x("freeon")),g.emit(x("free")),P.dragData.didDrag&&(f.emit(x("dragfreeon")),g.emit(x("dragfree")))),w();else if(f&&f.grabbed()&&P.nodeIsDraggable(f)){var T,C=!P.dragData.didDrag;C&&P.redrawHint("eles",!0),P.dragData.didDrag=!0,P.hoverData.draggingEles||V(g,{inDragLayer:!0});var S={x:0,y:0};if(M(p[0])&&M(p[1])&&(S.x+=p[0],S.y+=p[1],C)){var B=P.hoverData.dragDelta;B&&M(B[0])&&M(B[1])&&(S.x+=B[0],S.y+=B[1])}P.hoverData.draggingEles=!0,g.silentShift(S).emit(x("position")).emit(x("drag")),P.redrawHint("drag",!0),P.redraw()}}else 0===(T=P.hoverData.dragDelta=P.hoverData.dragDelta||[]).length?(T.push(p[0]),T.push(p[1])):(T[0]+=p[0],T[1]+=p[1]);r=!0}if(c[2]=s[0],c[3]=s[1],r)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),P.registerBinding(S,"mouseup",function(e){if((1!==P.hoverData.which||1===e.which||!P.hoverData.capture)&&P.hoverData.capture){P.hoverData.capture=!1;var i=P.cy,a=P.projectIntoViewport(e.clientX,e.clientY),o=P.selection,s=P.findNearestElement(a[0],a[1],!0,!1),l=P.dragData.possibleDragElements,u=P.hoverData.down,c=_(e);P.data.bgActivePosistion&&(P.redrawHint("select",!0),P.redraw()),P.hoverData.tapholdCancelled=!0,P.data.bgActivePosistion=void 0,u&&u.unactivate();var d=function(t){return{originalEvent:e,type:t,position:{x:a[0],y:a[1]}}};if(3===P.hoverData.which){var h=d("cxttapend");if(u?u.emit(h):i.emit(h),!P.hoverData.cxtDragged){var f=d("cxttap");u?u.emit(f):i.emit(f)}P.hoverData.cxtDragged=!1,P.hoverData.which=null}else if(1===P.hoverData.which){if(D(s,["mouseup","tapend","vmouseup"],e,{x:a[0],y:a[1]}),P.dragData.didDrag||P.hoverData.dragged||P.hoverData.selecting||P.hoverData.isOverThresholdDrag||(D(u,["click","tap","vclick"],e,{x:a[0],y:a[1]}),n=!1,e.timeStamp-r<=i.multiClickDebounceTime()?(t&&clearTimeout(t),n=!0,r=null,D(u,["dblclick","dbltap","vdblclick"],e,{x:a[0],y:a[1]})):(t=setTimeout(function(){n||D(u,["oneclick","onetap","voneclick"],e,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),r=e.timeStamp)),null!=u||P.dragData.didDrag||P.hoverData.selecting||P.hoverData.dragged||_(e)||(i.$(B).unselect(["tapunselect"]),l.length>0&&P.redrawHint("eles",!0),P.dragData.possibleDragElements=l=i.collection()),s!=u||P.dragData.didDrag||P.hoverData.selecting||null==s||!s._private.selectable||(P.hoverData.dragging||("additive"===i.selectionType()||c?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):c||(i.$(B).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),P.redrawHint("eles",!0)),P.hoverData.selecting){var p=i.collection(P.getAllInBox(o[0],o[1],o[2],o[3]));P.redrawHint("select",!0),p.length>0&&P.redrawHint("eles",!0),i.emit(d("boxend"));"additive"===i.selectionType()||c||i.$(B).unmerge(p).unselect(),p.emit(d("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(d("boxselect")),P.redraw()}if(P.hoverData.dragging&&(P.hoverData.dragging=!1,P.redrawHint("select",!0),P.redrawHint("eles",!0),P.redraw()),!o[4]){P.redrawHint("drag",!0),P.redrawHint("eles",!0);var g=u&&u.grabbed();F(l),g&&(u.emit(d("freeon")),l.emit(d("free")),P.dragData.didDrag&&(u.emit(d("dragfreeon")),l.emit(d("dragfree"))))}}o[4]=0,P.hoverData.down=null,P.hoverData.cxtStarted=!1,P.hoverData.draggingEles=!1,P.hoverData.selecting=!1,P.hoverData.isOverThresholdDrag=!1,P.dragData.didDrag=!1,P.hoverData.dragged=!1,P.hoverData.dragDelta=[],P.hoverData.mdownPos=null,P.hoverData.mdownGPos=null,P.hoverData.which=null}},!1);var Z=[],$=1e5,Q=function(e,t){for(var n=0;n=4){if(!(i=Q(Z,5))){var r=Math.abs(Z[0]);i=J(Z)&&r>5}if(i)for(var a=0;a5&&(n=5*td(n)),d=-(n/250),i&&(d/=$,d*=3),d*=P.wheelSensitivity,1===e.deltaMode&&(d*=33);var d,h=o.zoom()*Math.pow(10,d);"gesturechange"===e.type&&(h=P.gestureStartZoom*e.scale),o.zoom({level:h,renderedPosition:{x:c[0],y:c[1]}}),o.emit({type:"gesturechange"===e.type?"pinchzoom":"scrollzoom",originalEvent:e,position:{x:u[0],y:u[1]}})}}}};P.registerBinding(P.container,"wheel",ee,!0),P.registerBinding(S,"scroll",function(e){P.scrollingPage=!0,clearTimeout(P.scrollingPageTimeout),P.scrollingPageTimeout=setTimeout(function(){P.scrollingPage=!1},250)},!0),P.registerBinding(P.container,"gesturestart",function(e){P.gestureStartZoom=P.cy.zoom(),P.hasTouchStarted||e.preventDefault()},!0),P.registerBinding(P.container,"gesturechange",function(e){P.hasTouchStarted||ee(e)},!0),P.registerBinding(P.container,"mouseout",function(e){var t=P.projectIntoViewport(e.clientX,e.clientY);P.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),P.registerBinding(P.container,"mouseover",function(e){var t=P.projectIntoViewport(e.clientX,e.clientY);P.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var et=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},en=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(P.registerBinding(P.container,"touchstart",b=function(e){if(P.hasTouchStarted=!0,K(e)){j(),P.touchData.capture=!0,P.data.bgActivePosistion=void 0;var t=P.cy,n=P.touchData.now,r=P.touchData.earlier;if(e.touches[0]){var i=P.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=i[0],n[1]=i[1]}if(e.touches[1]){var i=P.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=i[0],n[3]=i[1]}if(e.touches[2]){var i=P.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=i[0],n[5]=i[1]}var b=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};if(e.touches[1]){P.touchData.singleTouchMoved=!0,F(P.dragData.touchDragEles);var x=P.findContainerClientCoords();f=x[0],p=x[1],g=x[2],v=x[3],a=e.touches[0].clientX-f,o=e.touches[0].clientY-p,s=e.touches[1].clientX-f,l=e.touches[1].clientY-p,y=0<=a&&a<=g&&0<=s&&s<=g&&0<=o&&o<=v&&0<=l&&l<=v;var w=t.pan(),E=t.zoom();if(u=et(a,o,s,l),c=en(a,o,s,l),h=[((d=[(a+s)/2,(o+l)/2])[0]-w.x)/E,(d[1]-w.y)/E],c<4e4&&!e.touches[2]){var k=P.findNearestElement(n[0],n[1],!0,!0),T=P.findNearestElement(n[2],n[3],!0,!0);k&&k.isNode()?(k.activate().emit(b("cxttapstart")),P.touchData.start=k):T&&T.isNode()?(T.activate().emit(b("cxttapstart")),P.touchData.start=T):t.emit(b("cxttapstart")),P.touchData.start&&(P.touchData.start._private.grabbed=!1),P.touchData.cxt=!0,P.touchData.cxtDragged=!1,P.data.bgActivePosistion=void 0,P.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var C=P.findNearestElements(n[0],n[1],!0,!0),S=C[0];if(null!=S&&(S.activate(),P.touchData.start=S,P.touchData.starts=C,P.nodeIsGrabbable(S))){var B=P.dragData.touchDragEles=t.collection(),_=null;P.redrawHint("eles",!0),P.redrawHint("drag",!0),S.selected()?V(_=t.$(function(e){return e.selected()&&P.nodeIsGrabbable(e)}),{addToList:B}):V(S,{addToList:B}),L(S),S.emit(b("grabon")),_?_.forEach(function(e){e.emit(b("grab"))}):S.emit(b("grab"))}D(S,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==S&&(P.data.bgActivePosistion={x:i[0],y:i[1]},P.redrawHint("select",!0),P.redraw()),P.touchData.singleTouchMoved=!1,P.touchData.singleTouchStartTime=+new Date,clearTimeout(P.touchData.tapholdTimeout),P.touchData.tapholdTimeout=setTimeout(function(){!1!==P.touchData.singleTouchMoved||P.pinching||P.touchData.selecting||D(P.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},P.tapholdDuration)}if(e.touches.length>=1){for(var A=P.touchData.startPosition=[null,null,null,null,null,null],M=0;M=P.touchTapThreshold2}if(t&&P.touchData.cxt){e.preventDefault();var S=e.touches[0].clientX-f,B=e.touches[0].clientY-p,_=e.touches[1].clientX-f,R=e.touches[1].clientY-p,I=en(S,B,_,R);if(I/c>=2.25||I>=22500){P.touchData.cxt=!1,P.data.bgActivePosistion=void 0,P.redrawHint("select",!0);var L=b("cxttapend");P.touchData.start?(P.touchData.start.unactivate().emit(L),P.touchData.start=null):r.emit(L)}}if(t&&P.touchData.cxt){var L=b("cxtdrag");P.data.bgActivePosistion=void 0,P.redrawHint("select",!0),P.touchData.start?P.touchData.start.emit(L):r.emit(L),P.touchData.start&&(P.touchData.start._private.grabbed=!1),P.touchData.cxtDragged=!0;var N=P.findNearestElement(i[0],i[1],!0,!0);(!P.touchData.cxtOver||N!==P.touchData.cxtOver)&&(P.touchData.cxtOver&&P.touchData.cxtOver.emit(b("cxtdragout")),P.touchData.cxtOver=N,N&&N.emit(b("cxtdragover")))}else if(t&&e.touches[2]&&r.boxSelectionEnabled())e.preventDefault(),P.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,P.touchData.selecting||r.emit(b("boxstart")),P.touchData.selecting=!0,P.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(i[0]+i[2]+i[4])/3,n[3]=(i[1]+i[3]+i[5])/3):(n[0]=(i[0]+i[2]+i[4])/3,n[1]=(i[1]+i[3]+i[5])/3,n[2]=(i[0]+i[2]+i[4])/3+1,n[3]=(i[1]+i[3]+i[5])/3+1),P.redrawHint("select",!0),P.redraw();else if(t&&e.touches[1]&&!P.touchData.didSelect&&r.zoomingEnabled()&&r.panningEnabled()&&r.userZoomingEnabled()&&r.userPanningEnabled()){e.preventDefault(),P.data.bgActivePosistion=void 0,P.redrawHint("select",!0);var z=P.dragData.touchDragEles;if(z){P.redrawHint("drag",!0);for(var O=0;O0&&!P.hoverData.draggingEles&&!P.swipePanning&&null!=P.data.bgActivePosistion&&(P.data.bgActivePosistion=void 0,P.redrawHint("select",!0),P.redraw())}},!1),P.registerBinding(S,"touchcancel",w=function(e){var t=P.touchData.start;P.touchData.capture=!1,t&&t.unactivate()}),P.registerBinding(S,"touchend",E=function(e){var t,n=P.touchData.start;if(P.touchData.capture){0===e.touches.length&&(P.touchData.capture=!1),e.preventDefault();var r=P.selection;P.swipePanning=!1,P.hoverData.draggingEles=!1;var i=P.cy,a=i.zoom(),o=P.touchData.now,s=P.touchData.earlier;if(e.touches[0]){var l=P.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=P.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=P.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}var u=function(t){return{originalEvent:e,type:t,position:{x:o[0],y:o[1]}}};if(n&&n.unactivate(),P.touchData.cxt){if(t=u("cxttapend"),n?n.emit(t):i.emit(t),!P.touchData.cxtDragged){var c=u("cxttap");n?n.emit(c):i.emit(c)}P.touchData.start&&(P.touchData.start._private.grabbed=!1),P.touchData.cxt=!1,P.touchData.start=null,P.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&P.touchData.selecting){P.touchData.selecting=!1;var d=i.collection(P.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,P.redrawHint("select",!0),i.emit(u("boxend")),d.emit(u("box")).stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit(u("boxselect")),d.nonempty()&&P.redrawHint("eles",!0),P.redraw()}if(null!=n&&n.unactivate(),e.touches[2])P.data.bgActivePosistion=void 0,P.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){P.data.bgActivePosistion=void 0,P.redrawHint("select",!0);var h=P.dragData.touchDragEles;if(null!=n){var f=n._private.grabbed;F(h),P.redrawHint("drag",!0),P.redrawHint("eles",!0),f&&(n.emit(u("freeon")),h.emit(u("free")),P.dragData.didDrag&&(n.emit(u("dragfreeon")),h.emit(u("dragfree")))),D(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),P.touchData.start=null}else D(P.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var p=P.touchData.startPosition[0]-o[0],g=P.touchData.startPosition[1]-o[1];P.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),D(n,["tap","vclick"],e,{x:o[0],y:o[1]}),k=!1,e.timeStamp-C<=i.multiClickDebounceTime()?(T&&clearTimeout(T),k=!0,C=null,D(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(T=setTimeout(function(){k||D(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),C=e.timeStamp)),null!=n&&!P.dragData.didDrag&&n._private.selectable&&(p*p+g*g)*a*afunction(e){for(var t=0,n=0;nMath.abs(c))return n(e,i(l,.5));var d=a(r(o,e),u)/c;return n(e,i(l,d))}(v.p1,v.p2,y.p1,y.p2);p.push(b)}return p}(tK(o,e,t,n,r),i),l=tb(),s.forEach(function(e){return tE(l,e.x,e.y)}),l}}},l2.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i)},intersectLine:function(e,t,n,r,i,a,o,s){return tY(i,a,e,t,n/2+o,r/2+o)},checkPoint:function(e,t,n,r,i,a,o,s){return tq(e,t,r,i,a,o,n)}}},l2.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(e,n,r,i,a,o,s){if(void 0!==o[s]&&o[s+"-cx"]===e&&o[s+"-cy"]===n)return o[s];o[s]=Array(t.length/2),o[s+"-cx"]=e,o[s+"-cy"]=n;var l=r/2,u=i/2;a="auto"===a?t2(r,i):a;for(var c=Array(t.length/2),d=0;d0)return f[0]}return null}(e,t,p);if(null!=g){var v=tg(p[5],p[3],p[1],g);if(p.isTop&&v<=t||p.isBottom&&t<=v)return!0}}return!1}}},l2.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:tQ(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),d=tH(i,a,e,t,l,u,c,u,!1);return d.length>0?d:tA(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?t1(r,i):s);if(tV(e,t,this.points,a,o,r,i-l,[0,-1],n)||tV(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!!(tO(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||tq(e,t,l,l,a+r/2-s,o+i/2-s,n)||tq(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},l2.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",tQ(3,0)),this.generateRoundPolygon("round-triangle",tQ(3,0)),this.generatePolygon("rectangle",tQ(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",tQ(5,0)),this.generateRoundPolygon("round-pentagon",tQ(5,0)),this.generatePolygon("hexagon",tQ(6,0)),this.generateRoundPolygon("round-hexagon",tQ(6,0)),this.generatePolygon("heptagon",tQ(7,0)),this.generateRoundPolygon("round-heptagon",tQ(7,0)),this.generatePolygon("octagon",tQ(8,0)),this.generateRoundPolygon("round-octagon",tQ(8,0));var r=Array(20),i=t0(5,0),a=t0(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")&&eO("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.webgl=e.webgl,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()},l9.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e)return void this.load();if("destroy"===e)return void this.destroy();("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),"gc"===e&&this.redrawHint("gc",!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()}},l9.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e=e.deqFastCost*g)break}else if(i){if(f>=e.deqCost*l||f>=e.deqAvgCost*s)break}else if(p>=e.deqNoDrawCost*l6)break;var v=e.deq(t,d,c);if(v.length>0)for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,d,c)&&r())},i(t))}}},l7=a(function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:eR;i(this,e),this.idsByKey=new eZ,this.keyForId=new eZ,this.cachesByLvl=new eZ,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n},[{key:"getIdsFor",value:function(e){null==e&&eN("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new eQ,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 eZ,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)}}]),ue={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},ut=eY({getKey:null,doesEleInvalidateKey:eR,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:eM,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),un=function(e,t){this.renderer=e,this.onDequeues=[];var n=ut(t);J(this,n),this.lookup=new l7(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},ur=un.prototype;ur.reasons=ue,ur.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},ur.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},ur.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new e3(function(e,t){return t.reqs-e.reqs})},ur.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},ur.getElement=function(e,t,n,r,i){var a,o,s,l=this,u=this.renderer,c=u.cy.zoom(),d=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 h=Math.pow(2,r),f=t.h*h,p=t.w*h,g=u.eleTextBiggerThanMin(e,h);if(!this.isVisible(e,g))return null;var v=d.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=f<=25?25:f<=50?50:50*Math.ceil(f/50),f>1024||p>1024)return null;var y=l.getTextureQueue(a),b=y[y.length-2],x=function(){return l.recycleTexture(a,p)||l.addTexture(a,p)};b||(b=y[y.length-1]),b||(b=x()),b.width-b.usedWidthr;D--)S=l.getElement(e,t,n,D,ue.downscale);B()}else{if(!E&&!k&&!T)for(var _=r-1;_>=-4;_--){var A=d.get(e,_);if(A){s=A;break}}if(w(s))return l.queueElement(e,r),s;b.context.translate(b.usedWidth,0),b.context.scale(h,h),this.drawElement(b.context,e,t,g,!1),b.context.scale(1/h,1/h),b.context.translate(-b.usedWidth,0)}return v={x:b.usedWidth,texture:b,level:r,scale:h,width:p,height:f,scaledLabelShown:g},b.usedWidth+=Math.ceil(p+8),b.eleCaches.push(v),d.set(e,r,v),l.checkTextureFullness(b),v},ur.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},ur.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?eq(t,e):e.fullnessChecks++},ur.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;eq(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,eW(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),eq(r,a),n.push(a),a}},ur.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}},ur.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,ue.dequeue)}else break;return r},ur.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=eA,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},ur.onDequeue=function(e){this.onDequeues.push(e)},ur.offDequeue=function(e){eq(this.onDequeues,e)},ur.setupDequeueing=l8({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;var d=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},h=function(e){if(!i)for(var t=n+e;-4<=t&&t<=2&&!d(t);t+=e);};h(1),h(-1);for(var f=c.length-1;f>=0;f--){var p=c[f];p.invalid&&eq(c,p)}var g=function(){if(!r){r=tb();for(var t=0;t=y||!tD(v.bb,w.boundingBox()))&&!(v=function(e){var t=(e=e||{}).after;g();var i=Math.ceil(r.w*u),o=Math.ceil(r.h*u);if(i>32767||o>32767||i*o>16e6)return null;var s=a.makeLayer(r,n);if(null!=t){var l=c.indexOf(t)+1;c.splice(l,0,s)}else(void 0===e.insert||e.insert)&&c.unshift(s);return s}({insert:!0,after:v})))return null;i||b?a.queueLayer(v,w):a.drawEleInLayer(v,w,n,t),v.eles.push(w),k[n]=v}return i||(b?null:c)},ua.getEleLevelForLayerLevel=function(e,t){return e},ua.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))},ua.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},ua.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},ua.invalidateElements=function(e){var t=this;0===e.length||(t.lastInvalidationTime=ev(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},ua.invalidateLayer=function(e){if(this.lastInvalidationTime=ev(),!e.invalid){var t=e.level,n=e.eles;eq(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,d=t.pstyle("curve-style").value,h=t.pstyle("line-style").value,f=t.pstyle("width").pfValue,p=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"===d?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=f,e.lineCap=p,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,h),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,T=y*t.pstyle("ghost-opacity").value;e.translate(E,k),x(T),w(T),e.translate(-E,-k)}else!function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;if(e.lineWidth=f+g,e.lineCap=p,g>0)s.colorStrokeStyle(e,v[0],v[1],v[2],n);else{e.lineCap="butt";return}"straight-triangle"===d?s.drawEdgeTrianglePath(t,e,l.allpts):(s.drawEdgePath(t,e,l.allpts,h),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 uw=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")}}}};ux.drawEdgeOverlay=uw("overlay"),ux.drawEdgeUnderlay=uw("underlay"),ux.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,s=!1,l=this.usePaths(),u=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(l){var d=n.join("$");i.pathCacheKey&&i.pathCacheKey===d?(p=t=i.pathCache,s=!0):(p=t=new Path2D,i.pathCacheKey=d,i.pathCache=p)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(u),a.lineDashOffset=c;break;case"solid":a.setLineDash([])}if(!s&&!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 h=2;h+35&&void 0!==arguments[5]?arguments[5]:5,o=Math.min(a,r/2,i/2);e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+r-o,n),e.quadraticCurveTo(t+r,n,t+r,n+o),e.lineTo(t+r,n+i-o),e.quadraticCurveTo(t+r,n+i,t+r-o,n+i),e.lineTo(t+o,n+i),e.quadraticCurveTo(t,n+i,t,n+i-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath()}uk.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),u="glyph"===t.pstyle("text-metrics").strValue;e.textAlign=l,e.textBaseline=u?"alphabetic":"bottom"}else{var c=t.element()._private.rscratch.badLine,d=t.pstyle("label"),h=t.pstyle("source-label"),f=t.pstyle("target-label");if(c||(!d||!d.value)&&(!h||!h.value)&&(!f||!f.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)},uk.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)},uk.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=eH(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},uk.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=eH(a,"labelX",n),l=eH(a,"labelY",n),u=this.getLabelText(t,n);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var c,d,h,f=n?n+"-":"",p=eH(a,"labelWidth",n),g=eH(a,"labelHeight",n),v=eH(a,"labelActualDescent",n),y=t.pstyle(f+"text-margin-x").pfValue,b=t.pstyle(f+"text-margin-y").pfValue,x=t.isEdge(),w=t.pstyle("text-halign").value,E=t.pstyle("text-valign").value;x&&(w="center",E="center"),s+=y,l+=b,0!==(h=r?this.getTextAngle(t,n):0)&&(c=s,d=l,e.translate(c,d),e.rotate(h),s=0,l=0);var k=rG(w),T=rZ(E);switch(T){case"top":break;case"center":l+=g/2;break;case"bottom":l+=g}var C=t.pstyle("text-background-opacity").value,P=t.pstyle("text-border-opacity").value,S=t.pstyle("text-border-width").pfValue,B=t.pstyle("text-background-padding").pfValue,D=t.pstyle("text-background-shape").strValue,_="round-rectangle"===D||"roundrectangle"===D;if(C>0||S>0&&P>0){var A,M,R=e.fillStyle,I=e.strokeStyle,L=e.lineWidth,N=t.pstyle("text-background-color").value,z=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value,V=C>0,F=S>0&&P>0,X=s-B;switch(k){case"left":X-=p;break;case"center":X-=p/2}var j=l-g-B,Y=p+2*B,q=g+2*B;if(V&&(e.fillStyle="rgba(".concat(N[0],",").concat(N[1],",").concat(N[2],",").concat(C*o,")")),F&&(e.strokeStyle="rgba(".concat(z[0],",").concat(z[1],",").concat(z[2],",").concat(P*o,")"),e.lineWidth=S,e.setLineDash))switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=S/4,e.setLineDash([]);break;default:e.setLineDash([])}if(_?(e.beginPath(),uT(e,X,j,Y,q,2)):"circle"===D?(e.beginPath(),A=X,M=Math.min(Y,q),e.beginPath(),e.arc(A+Y/2,j+q/2,M/2,0,2*Math.PI),e.closePath()):(e.beginPath(),e.rect(X,j,Y,q)),V&&e.fill(),F&&e.stroke(),F&&"double"===O){var W=S/2;e.beginPath(),_?uT(e,X+W,j+W,Y-2*W,q-2*W,2):e.rect(X+W,j+W,Y-2*W,q-2*W),e.stroke()}e.fillStyle=R,e.strokeStyle=I,e.lineWidth=L,e.setLineDash&&e.setLineDash([])}var U=2*t.pstyle("text-outline-width").pfValue;if(U>0&&(e.lineWidth=U),l-=v,"wrap"===t.pstyle("text-wrap").value){var H=eH(a,"labelWrapCachedLines",n),K=eH(a,"labelLineHeight",n),G=p/2,Z=this.getLabelJustification(t);switch("auto"===Z||("left"===k?"left"===Z?s+=-p:"center"===Z&&(s+=-G):"center"===k?"left"===Z?s+=-G:"right"===Z&&(s+=G):"right"===k&&("center"===Z?s+=G:"right"===Z&&(s+=p))),T){case"top":case"center":case"bottom":l-=(H.length-1)*K}for(var $=0;$0&&e.strokeText(H[$],s,l),e.fillText(H[$],s,l),l+=K}else U>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==h&&(e.rotate(-h),e.translate(-c,-d))}}};var uC={};uC.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,d=t._private,h=d.rscratch,f=t.position();if(M(f.x)&&M(f.y)&&(!u||t.visible())){var p=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]:B;c.eleFillStyle(e,t,n)},W=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;c.colorStrokeStyle(e,D[0],D[1],D[2],t)},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:X;c.colorStrokeStyle(e,V[0],V[1],V[2],t)},H=function(e,t,n,r){var i,a=c.nodePathCache=c.nodePathCache||[],o=eP("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+Y),s=a[o],l=!1;return null!=s?(l=!0,h.pathCache=i=s):(i=new Path2D,a[o]=h.pathCache=i),{path:i,cacheHit:l}},K=t.pstyle("shape").strValue,G=t.pstyle("shape-polygon-points").pfValue;if(g){e.translate(f.x,f.y);var Z=H(r,i,K,G);a=Z.path,v=Z.cacheHit}var $=function(){if(!v){var n=f;g&&(n={x:0,y:0}),c.nodeShapes[c.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,Y,h)}g?e.fill(a):e.fill()},Q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=d.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;c.hasPie(t)&&(c.drawPie(e,t,a),n&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,r,i,Y,h))},ee=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;c.hasStripe(t)&&(e.save(),g?e.clip(h.pathCache):(c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,r,i,Y,h),e.clip()),c.drawStripe(e,t,a),e.restore(),n&&!g&&c.nodeShapes[c.getNodeShape(t)].draw(e,f.x,f.y,r,i,Y,h))},et=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:p,n=P>0?0:255;0!==P&&(c.colorFillStyle(e,n,n,n,(P>0?P:-P)*t),g?e.fill(a):e.fill())},en=function(){if(S>0){if(e.lineWidth=S,e.lineCap=R,e.lineJoin=A,e.setLineDash)switch(_){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(L),e.lineDashOffset=N;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-S,-i/2-S,r+2*S,i+2*S),t.addPath(a),e.clip(t,"evenodd")}g?e.stroke(a):e.stroke(),e.restore()}else g?e.stroke(a):e.stroke();if("double"===_){e.lineWidth=S/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",g?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},er=function(){if(O>0){if(e.lineWidth=O,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=f;g&&(n={x:0,y:0});var a=c.getNodeShape(t),o=S;"inside"===I&&(o=0),"outside"===I&&(o*=2);var s=(r+o+(O+j))/r,l=(i+o+(O+j))/i,u=r*s,d=i*l,h=c.nodeShapes[a].points;if(g&&(C=H(u,d,a,h).path),"ellipse"===a)c.drawEllipsePath(C||e,n.x,n.y,u,d);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var p=0,v=0,y=0;"round-diamond"===a?p=(o+j+O)*1.4:"round-heptagon"===a?(p=(o+j+O)*1.075,y=-(o/2+j+O)/35):"round-hexagon"===a?p=(o+j+O)*1.12:"round-pentagon"===a?(p=(o+j+O)*1.13,y=-(o/2+j+O)/15):"round-tag"===a?(p=(o+j+O)*1.12,v=(o/2+O+j)*.07):"round-triangle"===a&&(p=Math.PI/2*(o+j+O),y=-(o+j/2+O)/Math.PI),0!==p&&(s=(r+p)/r,u=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+p)/i,d=i*l)),Y="auto"===Y?t2(u,d):Y;for(var b=u/2,x=d/2,w=Y+(o+O+j)/2,E=Array(h.length/2),k=Array(h.length/2),T=0;T0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}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()}}}};uC.drawNodeOverlay=uP("overlay"),uC.drawNodeUnderlay=uP("underlay"),uC.hasPie=function(e){return(e=e[0])._private.hasPie},uC.hasStripe=function(e){return(e=e[0])._private.hasStripe},uC.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i,a=t.cy().style(),o=t.pstyle("pie-size"),s=t.pstyle("pie-hole"),l=t.pstyle("pie-start-angle").pfValue,u=r.x,c=r.y,d=Math.min(t.width(),t.height())/2,h=0;if(this.usePaths()&&(u=0,c=0),"%"===o.units?d*=o.pfValue:void 0!==o.pfValue&&(d=o.pfValue/2),"%"===s.units?i=d*s.pfValue:void 0!==s.pfValue&&(i=s.pfValue/2),!(i>=d))for(var f=1;f<=a.pieBackgroundN;f++){var p=t.pstyle("pie-"+f+"-background-size").value,g=t.pstyle("pie-"+f+"-background-color").value,v=t.pstyle("pie-"+f+"-background-opacity").value*n,y=p/100;y+h>1&&(y=1-h);var b=1.5*Math.PI+2*Math.PI*h,x=2*Math.PI*y,w=(b+=l)+x;0===p||h>=1||h+y>1||(0===i?(e.beginPath(),e.moveTo(u,c),e.arc(u,c,d,b,w)):(e.beginPath(),e.arc(u,c,d,b,w),e.arc(u,c,i,w,b,!0)),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],v),e.fill(),h+=y)}},uC.drawStripe=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=r.x,o=r.y,s=t.width(),l=t.height(),u=0,c=this.usePaths();e.save();var d=t.pstyle("stripe-direction").value,h=t.pstyle("stripe-size");switch(d){case"vertical":break;case"righward":e.rotate(-Math.PI/2)}var f=s,p=l;"%"===h.units?(f*=h.pfValue,p*=h.pfValue):void 0!==h.pfValue&&(f=h.pfValue,p=h.pfValue),c&&(a=0,o=0),o-=f/2,a-=p/2;for(var g=1;g<=i.stripeBackgroundN;g++){var v=t.pstyle("stripe-"+g+"-background-size").value,y=t.pstyle("stripe-"+g+"-background-color").value,b=t.pstyle("stripe-"+g+"-background-opacity").value*n,x=v/100;x+u>1&&(x=1-u),0===v||u>=1||u+x>1||(e.beginPath(),e.rect(a,o+p*u,f,p*x),e.closePath(),this.colorFillStyle(e,y[0],y[1],y[2],b),e.fill(),u+=x)}e.restore()};var uS={};function uB(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw Error(e.getShaderInfoLog(r));return r}function uD(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function u_(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function uA(e,t){return!!t.picking||"solid"===e.pstyle("background-fill").value&&"none"===e.pstyle("background-image").strValue&&(0===e.pstyle("border-width").value||0===e.pstyle("border-opacity").value||"solid"===e.pstyle("border-style").value)}function uM(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=n||[,,,,];return o[0]=r*t,o[1]=i*t,o[2]=a*t,o[3]=t,o}function uR(e,t){var n=t||[,,,,];return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function uI(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function uL(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function uN(e,t,n,r){var i=l(uI(e,n),3),a=i[0],o=i[1],s=i[2],u=uL(e,o,t*a),c=a*s,d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=Array(t),f=0;ft.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!d&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var b=n.style(),x=n.zoom(),w=void 0!==o?o:x,E=n.pan(),k={x:E.x,y:E.y},T={zoom:x,pan:{x:E.x,y:E.y}},C=t.prevViewport;void 0===C||T.zoom!==C.zoom||T.pan.x!==C.pan.x||T.pan.y!==C.pan.y||g&&!p||(t.motionBlurPxRatio=1),s&&(k=s),w*=l,k.x*=l,k.y*=l;var P=t.getCachedZSortedEles();function S(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function B(e,n){var a,l,c,d;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=k,l=w,c=t.canvasWidth,d=t.canvasHeight):(a={x:E.x*f,y:E.y*f},l=x*f,c=t.canvasWidth*f,d=t.canvasHeight*f),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?S(e,0,0,c,d):!r&&(void 0===n||n)&&e.clearRect(0,0,c,d),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(d||(t.textureDrawLastFrame=!1),d){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var D=t.data.bufferContexts[t.TEXTURE_BUFFER];D.setTransform(1,0,0,1,0,0),D.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:D,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult});var T=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var _=u.contexts[t.NODE],A=t.textureCache.texture,T=t.textureCache.viewport;_.setTransform(1,0,0,1,0,0),h?S(_,0,0,T.width,T.height):_.clearRect(0,0,T.width,T.height);var M=b.core("outside-texture-bg-color").value,R=b.core("outside-texture-bg-opacity").value;t.colorFillStyle(_,M[0],M[1],M[2],R),_.fillRect(0,0,T.width,T.height);var x=n.zoom();B(_,!1),_.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),_.drawImage(A,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var I=n.extent(),L=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),N=t.hideEdgesOnViewport&&L,z=[];if(z[t.NODE]=!c[t.NODE]&&h&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,z[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),z[t.DRAG]=!c[t.DRAG]&&h&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,z[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||z[t.NODE]){var O=h&&!z[t.NODE]&&1!==f,_=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]);B(_,h&&!O?"motionBlur":void 0),N?t.drawCachedNodes(_,P.nondrag,l,I):t.drawLayeredElements(_,P.nondrag,l,I),t.debug&&t.drawDebugPoints(_,P.nondrag),i||h||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||z[t.DRAG])){var O=h&&!z[t.DRAG]&&1!==f,_=r||(O?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]);B(_,h&&!O?"motionBlur":void 0),N?t.drawCachedNodes(_,P.drag,l,I):t.drawCachedElements(_,P.drag,l,I),t.debug&&t.drawDebugPoints(_,P.drag),i||h||(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,B),h&&1!==f){var V=u.contexts[t.NODE],F=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],X=u.contexts[t.DRAG],j=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):S(e,0,0,t.canvasWidth,t.canvasHeight),e.drawImage(n,0,0,t.canvasWidth*f,t.canvasHeight*f,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||z[t.NODE])&&(Y(V,F,z[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||z[t.DRAG])&&(Y(X,j,z[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=T,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),h&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!d,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},100)),r||n.emit("render")},uS.drawSelectionRectangle=function(e,t){var n=this.cy,r=this.data,i=n.style(),a=e.drawOnlyNodeLayer,o=e.drawAllLayers,s=r.canvasNeedsRedraw,l=e.forcedContext;if(this.showFps||!a&&s[this.SELECT_BOX]&&!o){var u=l||r.contexts[this.SELECT_BOX];if(t(u),1==this.selection[4]&&(this.hoverData.selecting||this.touchData.selecting)){var c=this.cy.zoom(),d=i.core("selection-box-border-width").value/c;u.lineWidth=d,u.fillStyle="rgba("+i.core("selection-box-color").value[0]+","+i.core("selection-box-color").value[1]+","+i.core("selection-box-color").value[2]+","+i.core("selection-box-opacity").value+")",u.fillRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]),d>0&&(u.strokeStyle="rgba("+i.core("selection-box-border-color").value[0]+","+i.core("selection-box-border-color").value[1]+","+i.core("selection-box-border-color").value[2]+","+i.core("selection-box-opacity").value+")",u.strokeRect(this.selection[0],this.selection[1],this.selection[2]-this.selection[0],this.selection[3]-this.selection[1]))}if(r.bgActivePosistion&&!this.hoverData.selecting){var c=this.cy.zoom(),h=r.bgActivePosistion;u.fillStyle="rgba("+i.core("active-bg-color").value[0]+","+i.core("active-bg-color").value[1]+","+i.core("active-bg-color").value[2]+","+i.core("active-bg-opacity").value+")",u.beginPath(),u.arc(h.x,h.y,i.core("active-bg-size").pfValue/c,0,2*Math.PI),u.fill()}var f=this.lastRedrawTime;if(this.showFps&&f){var p=Math.round(1e3/(f=Math.round(f))),g="1 frame = "+f+" ms = "+p+" fps";u.setTransform(1,0,0,1,0,0),u.fillStyle="rgba(255, 0, 0, 0.75)",u.strokeStyle="rgba(255, 0, 0, 0.75)",u.font="30px Arial",x||(x=u.measureText(g).actualBoundingBoxAscent),u.fillText(g,0,x),u.strokeRect(0,x+10,250,20),u.fillRect(0,x+10,250*Math.min(p/60,1),20)}o||(s[this.SELECT_BOX]=!1)}};var uz="u">typeof Float32Array?Float32Array:Array;function uO(){var e=new uz(9);return uz!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function uV(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function uF(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=n[0],f=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=h*r+f*o+u,e[7]=h*i+f*s+c,e[8]=h*a+f*l+d,e}function uX(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],d=t[8],h=Math.sin(n),f=Math.cos(n);return e[0]=f*r+h*o,e[1]=f*i+h*s,e[2]=f*a+h*l,e[3]=f*o-h*r,e[4]=f*s-h*i,e[5]=f*l-h*a,e[6]=u,e[7]=c,e[8]=d,e}function uj(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var uY=a(function e(t,n,r,a){i(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")},[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(a=i/t,o=t*a,s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r,i,a,o,s,l,u,c=this;if(this.locked)throw Error("can't draw, atlas is locked");var d=this.texSize,h=this.texRows,f=this.texHeight,p=this.getScale(t),g=p.scale,v=p.texW,y=p.texH,b=function(e,r){if(n&&r){var i=r.context,a=e.x,o=f*e.row;i.save(),i.translate(a,o),i.scale(g,g),n(i,t),i.restore()}},x=[null,null],w=function(){b(c.freePointer,c.canvas),x[0]={x:c.freePointer.x,y:c.freePointer.row*f,w:v,h:y},x[1]={x:c.freePointer.x+v,y:c.freePointer.row*f,w:0,h:y},c.freePointer.x+=v,c.freePointer.x==d&&(c.freePointer.x=0,c.freePointer.row++)},E=function(){c.freePointer.x=0,c.freePointer.row++};if(this.freePointer.x+v<=d)w();else{if(this.freePointer.row>=h-1)return!1;this.freePointer.x===d?(E(),w()):this.enableWrapping?(r=c.scratch,i=c.canvas,r.clear(),b({x:0,row:0},r),o=v-(a=d-c.freePointer.x),s=c.freePointer.x,l=c.freePointer.row*f,i.context.drawImage(r,0,0,a,f,s,l,a,f),x[0]={x:s,y:l,w:a,h:y},u=(c.freePointer.row+1)*f,i&&i.context.drawImage(r,a,0,o,f,0,u,o,f),x[1]={x:0,y:u,w:o,h:y},c.freePointer.x=o,c.freePointer.row++):(E(),w())}return this.keyToLocation.set(e,x),this.needsBuffer=!0,x}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},i=r.forceRedraw,a=void 0!==i&&i,s=r.filterEle,l=void 0===s?function(){return!0}:s,u=r.filterType,c=void 0===u?function(){return!0}:u,d=!1,h=!1,f=o(e);try{for(f.s();!(t=f.n()).done;){var p=t.value;if(l(p)){var g,v=o(this.renderTypes.values());try{for(v.s();!(g=v.n()).done;)!function(){var e=g.value,t=e.type;if(c(t)){var r=n.collections.get(e.collection),i=e.getKey(p),o=Array.isArray(i)?i:[i];if(a)o.forEach(function(e){return r.markKeyForGC(e)}),h=!0;else{var s=e.getID?e.getID(p):p.id(),l=n._key(t,s),u=n.typeAndIdToKey.get(l);void 0!==u&&!function(e,t){if(e.length!==t.length)return!1;for(var n=0;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.type,r=this.atlasManager;return n?r.invalidate(e,{filterType:function(e){return e===n},forceRedraw:!0}):r.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"_createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; // a vertex from the unit square\n \n in mat3 aTransform; // used to transform verticies, eg into a bounding box\n in int aVertType; // the type of thing we are rendering\n\n // the z-index that is output when using picking mode\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in vec2 aLineWidth; // also used for node border width\n\n // simple shapes\n in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left]\n in vec4 aColor; // also used for edges\n in vec4 aBorderColor; // aLineWidth is used for border width\n\n // output values passed to the fragment shader\n out vec2 vTexCoord;\n out vec4 vColor;\n out vec2 vPosition;\n // flat values are not interpolated\n flat out int vAtlasId; \n flat out int vVertType;\n flat out vec2 vTopRight;\n flat out vec2 vBotLeft;\n flat out vec4 vCornerRadius;\n flat out vec4 vBorderColor;\n flat out vec2 vBorderWidth;\n flat out vec4 vIndex;\n \n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition; // TODO make this a vec3, simplifies some code below\n\n if(aVertType == ".concat(0,") {\n float texX = aTex.x; // texture coordinates\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(4," || aVertType == ").concat(7," \n || aVertType == ").concat(5," || aVertType == ").concat(6,") { // simple shapes\n\n // the bounding box is needed by the fragment shader\n vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat\n vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat\n vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated\n\n // calculations are done in the fragment shader, just pass these along\n vColor = aColor;\n vCornerRadius = aCornerRadius;\n vBorderColor = aBorderColor;\n vBorderWidth = aLineWidth;\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(1,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n // stretch the unit square into a long skinny rectangle\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(2,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0, p1, p2, pos;\n if(position.x == 0.0) { // The left side of the unit square\n p0 = pointA;\n p1 = pointB;\n p2 = pointC;\n pos = position;\n } else { // The right side of the unit square, use same approach but flip the geometry upside down\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth[0];\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(3," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vVertType = aVertType;\n vIndex = aIndex;\n }\n "),r=this.batchManager.getIndexArray(),i=function(e,t,n){var r=uB(e,e.VERTEX_SHADER,t),i=uB(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw Error("Could not initialize shaders");return a}(t,n,"#version 300 es\n precision highp float;\n\n // declare texture unit for each texture atlas in the batch\n ".concat(r.map(function(e){return"uniform sampler2D uTexture".concat(e,";")}).join("\n "),"\n\n uniform vec4 uBGColor;\n uniform float uZoom;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n in vec2 vPosition; // model coordinates\n\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n flat in vec2 vTopRight;\n flat in vec2 vBotLeft;\n flat in vec4 vCornerRadius;\n flat in vec4 vBorderColor;\n flat in vec2 vBorderWidth;\n\n out vec4 outColor;\n\n ").concat("\n float circleSD(vec2 p, float r) {\n return distance(vec2(0), p) - r; // signed distance\n }\n","\n ").concat("\n float rectangleSD(vec2 p, vec2 b) {\n vec2 d = abs(p)-b;\n return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0);\n }\n","\n ").concat("\n float roundRectangleSD(vec2 p, vec2 b, vec4 cr) {\n cr.xy = (p.x > 0.0) ? cr.xy : cr.zw;\n cr.x = (p.y > 0.0) ? cr.x : cr.y;\n vec2 q = abs(p) - b + cr.x;\n return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x;\n }\n","\n ").concat("\n float ellipseSD(vec2 p, vec2 ab) {\n p = abs( p ); // symmetry\n\n // find root with Newton solver\n vec2 q = ab*(p-ab);\n float w = (q.x1.0) ? d : -d;\n }\n","\n\n vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha\n return vec4( \n top.rgb + (bot.rgb * (1.0 - top.a)),\n top.a + (bot.a * (1.0 - top.a)) \n );\n }\n\n vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance\n // scale to the zoom level so that borders don't look blurry when zoomed in\n // note 1.5 is an aribitrary value chosen because it looks good\n return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); \n }\n\n void main(void) {\n if(vVertType == ").concat(0,") {\n // look up the texel from the texture unit\n ").concat(r.map(function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")}).join("\n else "),"\n } \n else if(vVertType == ").concat(3,") {\n // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out';\n outColor = blend(vColor, uBGColor);\n outColor.a = 1.0; // make opaque, masks out line under arrow\n }\n else if(vVertType == ").concat(4," && vBorderWidth == vec2(0.0)) { // simple rectangle with no border\n outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done\n }\n else if(vVertType == ").concat(4," || vVertType == ").concat(7," \n || vVertType == ").concat(5," || vVertType == ").concat(6,") { // use SDF\n\n float outerBorder = vBorderWidth[0];\n float innerBorder = vBorderWidth[1];\n float borderPadding = outerBorder * 2.0;\n float w = vTopRight.x - vBotLeft.x - borderPadding;\n float h = vTopRight.y - vBotLeft.y - borderPadding;\n vec2 b = vec2(w/2.0, h/2.0); // half width, half height\n vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center\n\n float d; // signed distance\n if(vVertType == ").concat(4,") {\n d = rectangleSD(p, b);\n } else if(vVertType == ").concat(7," && w == h) {\n d = circleSD(p, b.x); // faster than ellipse\n } else if(vVertType == ").concat(7,") {\n d = ellipseSD(p, b);\n } else {\n d = roundRectangleSD(p, b, vCornerRadius.wzyx);\n }\n\n // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling\n // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box\n if(d > 0.0) {\n if(d > outerBorder) {\n discard;\n } else {\n outColor = distInterp(vBorderColor, vec4(0), d - outerBorder);\n }\n } else {\n if(d > innerBorder) {\n vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor;\n vec4 innerBorderColor = blend(vBorderColor, vColor);\n outColor = distInterp(innerBorderColor, outerColor, d);\n } \n else {\n vec4 outerColor;\n if(innerBorder == 0.0 && outerBorder == 0.0) {\n outerColor = vec4(0);\n } else if(innerBorder == 0.0) {\n outerColor = vBorderColor;\n } else {\n outerColor = blend(vBorderColor, vColor);\n }\n outColor = distInterp(vColor, outerColor, d - innerBorder);\n }\n }\n }\n else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.aCornerRadius=t.getAttribLocation(i,"aCornerRadius"),i.aBorderColor=t.getAttribLocation(i,"aBorderColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uZoom=t.getUniformLocation(i,"uZoom"),i.uTextures=[];for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:uH;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.simpleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.batchManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"_isVisible",value:function(e,t){return!!e.visible()&&(!t||!t.isVisible||t.isVisible(e))}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager,i=this.batchManager,a=r.getRenderTypeOpts(n);if(this._isVisible(e,a)&&(!e.isEdge()||this._isValidEdge(e))){if(this.renderTarget.picking&&a.getTexPickingMode){var s=a.getTexPickingMode(e);if(1===s)return;if(2==s)return void this.drawPickingRectangle(e,t,n)}var u,c=o(r.getAtlasInfo(e,n));try{for(c.s();!(u=c.n()).done;){var d=u.value,h=d.atlas,f=d.tex1,p=d.tex2;i.canAddToCurrentBatch(h)||this.endBatch();for(var g=i.getAtlasIndexForBatch(h),v=0,y=[[f,!0],[p,!1]];v=this.maxInstances&&this.endBatch()}}}}catch(e){c.e(e)}finally{c.f()}}}},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=0;if(n.shapeProps&&n.shapeProps.padding&&(a=e.pstyle(n.shapeProps.padding).pfValue),r){var o=r.bb,s=r.tex1,l=r.tex2,u=s.w/(s.w+l.w);i||(u=1-u);var c=this._getAdjustedBB(o,a,i,u);this._applyTransformMatrix(t,c,n,e)}else{var d=n.getBoundingBox(e),h=this._getAdjustedBB(d,a,!0,1);this._applyTransformMatrix(t,h,n,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){uV(e);var i,a,o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);uF(e,e,[s.x,s.y]),uX(e,e,o);var l=n.getRotationOffset(r);i=l.x+(t.xOffset||0),a=l.y+(t.yOffset||0)}else i=t.x1,a=t.y1;uF(e,e,[i,a]),uj(e,e,[t.w,t.h])}},{key:"_getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h,l=e.yOffset;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var u=0,c=o*r;return n&&r<1?o=c:!n&&r<1&&(i+=u=o-c,o=c),{x1:i,y1:a,w:o,h:s,xOffset:u,yOffset:l}}},{key:"drawPickingRectangle",value:function(e,t,n){var r=this.atlasManager.getRenderTypeOpts(n),i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=4,uR(t,this.indexBuffer.getView(i)),uM([0,0,0],1,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);this.setTransformMatrix(e,a,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}},{key:"drawNode",value:function(e,t,n){var r=this.simpleShapeOptions.get(n);if(this._isVisible(e,r)){var i=r.shapeProps,a=this._getVertTypeForShape(e,i.shape);if(void 0===a||r.isSimple&&!r.isSimple(e,this.renderTarget))return void this.drawTexture(e,t,n);var o=this.instanceCount;if(this.vertTypeBuffer.getView(o)[0]=a,5===a||6===a){var s=r.getBoundingBox(e),l=this._getCornerRadius(e,i.radius,s),u=this.cornerRadiusBuffer.getView(o);u[0]=l,u[1]=l,u[2]=l,u[3]=l,6===a&&(u[0]=0,u[2]=0)}uR(t,this.indexBuffer.getView(o));var c=this.renderTarget.picking?1:"node-body"===n?e.effectiveOpacity():1,d=this.renderTarget.picking?1:e.pstyle(i.opacity).value*c;uM(e.pstyle(i.color).value,d,this.colorBuffer.getView(o));var h=this.lineWidthBuffer.getView(o);if(h[0]=0,h[1]=0,i.border){var f=e.pstyle("border-width").value;if(f>0){uM(e.pstyle("border-color").value,c*e.pstyle("border-opacity").value,this.borderColorBuffer.getView(o));var p=e.pstyle("border-position").value;if("inside"===p)h[0]=0,h[1]=-f;else if("outside"===p)h[0]=f,h[1]=0;else{var g=f/2;h[0]=g,h[1]=-g}}}var v=this.transformBuffer.getMatrixView(o);this.setTransformMatrix(e,v,r),this.simpleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"_getVertTypeForShape",value:function(e,t){switch(e.pstyle(t).value){case"rectangle":return 4;case"ellipse":return 7;case"roundrectangle":case"round-rectangle":return 5;case"bottom-round-rectangle":return 6;default:return}}},{key:"_getCornerRadius",value:function(e,t,n){var r=n.w,i=n.h;return"auto"===e.pstyle(t).value?t1(r,i):Math.min(e.pstyle(t).pfValue,i/2,r/2)}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if(("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a))&&null!=a)&&"none"!==e.pstyle(n+"-arrow-shape").value){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value,u=e.pstyle("line-opacity").value,c=e.pstyle("width").pfValue,d=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(c,d),f=this.instanceCount,p=this.transformBuffer.getMatrixView(f);uV(p),uF(p,p,[r,i]),uj(p,p,[h,h]),uX(p,p,a),this.vertTypeBuffer.getView(f)[0]=3,uR(t,this.indexBuffer.getView(f)),uM(s,l*u,this.colorBuffer.getView(f)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this._getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=1,uR(t,this.indexBuffer.getView(l)),uM(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c=this.maxInstances&&this.endBatch()}}}}},{key:"_isValidEdge",value:function(e){var t=e._private.rscratch;return!(t.badLine||null==t.allpts||isNaN(t.allpts[0]))}},{key:"_getEdgePoints",value:function(e){var t=e._private.rscratch;if(this._isValidEdge(e)){var n=t.allpts;if(4==n.length)return n;var r=this._getNumSegments(e);return this._getCurveSegmentPoints(n,r)}}},{key:"_getNumSegments",value:function(e){return Math.min(15,this.maxInstances)}},{key:"_getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array((t+1)*2),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this._setCurvePoint(e,i,n,2*r)}return n}},{key:"_setCurvePoint",value:function(e,t,n,r){if(e.length<=2)n[r]=e[0],n[r+1]=e[1];else{for(var i=Array(e.length-2),a=0;a0}},y=function(e){return"yes"===e.pstyle("text-events").strValue?2:1},b=function(e){var t=e.position(),n=t.x,r=t.y,i=e.outerWidth(),a=e.outerHeight();return{w:i,h:a,x1:n-i/2,y1:r-a/2}};h.drawing.addAtlasCollection("node",{texRows:e.webglTexRowsNodes}),h.drawing.addAtlasCollection("label",{texRows:e.webglTexRows}),h.drawing.addTextureAtlasRenderType("node-body",{collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement}),h.drawing.addSimpleShapeRenderType("node-body",{getBoundingBox:b,isSimple:uA,shapeProps:{shape:"shape",color:"background-color",opacity:"background-opacity",radius:"corner-radius",border:!0}}),h.drawing.addSimpleShapeRenderType("node-overlay",{getBoundingBox:b,isVisible:v("overlay"),shapeProps:{shape:"overlay-shape",color:"overlay-color",opacity:"overlay-opacity",padding:"overlay-padding",radius:"overlay-corner-radius"}}),h.drawing.addSimpleShapeRenderType("node-underlay",{getBoundingBox:b,isVisible:v("underlay"),shapeProps:{shape:"underlay-shape",color:"underlay-color",opacity:"underlay-opacity",padding:"underlay-padding",radius:"underlay-corner-radius"}}),h.drawing.addTextureAtlasRenderType("label",{collection:"label",getTexPickingMode:y,getKey:uQ(t.getLabelKey,null),getBoundingBox:uJ(t.getLabelBox,null),drawClipped:!0,drawElement:t.drawLabel,getRotation:p(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:g("label")}),h.drawing.addTextureAtlasRenderType("edge-source-label",{collection:"label",getTexPickingMode:y,getKey:uQ(t.getSourceLabelKey,"source"),getBoundingBox:uJ(t.getSourceLabelBox,"source"),drawClipped:!0,drawElement:t.drawSourceLabel,getRotation:p("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:g("source-label")}),h.drawing.addTextureAtlasRenderType("edge-target-label",{collection:"label",getTexPickingMode:y,getKey:uQ(t.getTargetLabelKey,"target"),getBoundingBox:uJ(t.getTargetLabelBox,"target"),drawClipped:!0,drawElement:t.drawTargetLabel,getRotation:p("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:g("target-label")});var x=ep(function(){console.log("garbage collect flag set"),h.data.gc=!0},1e4);h.onUpdateEleCalcs(function(e,t){var n=!1;t&&t.length>0&&(n|=h.drawing.invalidate(t)),n&&x()}),i=(r=h).render,r.render=function(e){e=e||{};var t,n,a,o,s=r.cy;r.webgl&&(s.zoom()>7.99?((n=(t=r).data.contexts[t.WEBGL]).clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT),i.call(r,e)):(a=r,(o=function(e){e.save(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,a.canvasWidth,a.canvasHeight),e.restore()})(a.data.contexts[a.NODE]),o(a.data.contexts[a.DRAG]),u2(r,e,uH)))},a=r.matchCanvasSize,r.matchCanvasSize=function(e){a.call(r,e),r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth,r.canvasHeight),r.pickingFrameBuffer.needsDraw=!0},r.findNearestElements=function(e,t,n,i){return function(e,t,n){var r,i,a,s=function(e,t,n){var r=u_(e),i=r.pan,a=r.zoom,o=l((p=t*a+i.x,g=n*a+i.y,[p,g=Math.round(e.canvasHeight-g)]),2),s=o[0],u=o[1],c=e.data.contexts[e.WEBGL];c.bindFramebuffer(c.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(c.viewport(0,0,c.canvas.width,c.canvas.height),u2(e,null,uK),e.pickingFrameBuffer.needsDraw=!1);var d=new Uint8Array(144);c.readPixels(s-3,u-3,6,6,c.RGBA,c.UNSIGNED_BYTE,d),c.bindFramebuffer(c.FRAMEBUFFER,null);for(var h=new Set,f=0;f<36;f++){var p,g,v,y=(v=d.slice(4*f,4*f+4))[0]+(v[1]<<8)+(v[2]<<16)+(v[3]<<24)-1;y>=0&&h.add(y)}return h}(e,t,n),u=e.getCachedZSortedEles(),c=o(s);try{for(c.s();!(a=c.n()).done;){var d=u[a.value];if(!r&&d.isNode()&&(r=d),!i&&d.isEdge()&&(i=d),r&&i)break}}catch(e){c.e(e)}finally{c.f()}return[r,i].filter(Boolean)}(r,e,t)},s=r.invalidateCachedZSortedEles,r.invalidateCachedZSortedEles=function(){s.call(r),r.pickingFrameBuffer.needsDraw=!0},u=r.notify,r.notify=function(e,t){u.call(r,e,t),"viewport"===e||"bounds"===e?r.pickingFrameBuffer.needsDraw=!0:"background"===e&&r.drawing.invalidate(t,{type:"node-body"})}};var uQ=function(e,t){return function(n){var r=e(n),i=u$(n,t);return i.length>1?i.map(function(e,t){return"".concat(r,"_").concat(t)}):r}},uJ=function(e,t){return function(n,r){var i=e(n);if("string"==typeof r){var a=r.indexOf("_");if(a>0){var o=Number(r.substring(a+1)),s=u$(n,t),l=i.h/s.length,u=l*o,c=i.y1+u;return{x1:i.x1,w:i.w,y1:c,h:l,yOffset:u}}}return i}};function u0(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=u_(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function u1(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawNode(n,t,"node-underlay"),r.drawNode(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawNode(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function u2(e,t,n){e.webglDebug&&(H=performance.now());var r=e.drawing,i=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&e.drawSelectionRectangle(t,function(t){return u0(e,t)}),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var a,s,l,u,c,d,h,f,p,g,v,y,b,x,w,E,k,T,C,P,S,B,D,_,A,M,R,I,L,N,z,O=e.data.contexts[e.WEBGL];n.screen?(O.clearColor(0,0,0,0),O.enable(O.BLEND),O.blendFunc(O.ONE,O.ONE_MINUS_SRC_ALPHA)):O.disable(O.BLEND),O.clear(O.COLOR_BUFFER_BIT|O.DEPTH_BUFFER_BIT),O.viewport(0,0,O.canvas.width,O.canvas.height);var V=(a=e.canvasWidth,s=e.canvasHeight,u=(l=u_(e)).pan,c=l.zoom,uF(d=uO(),d,[u.x,u.y]),uj(d,d,[c,c]),f=h=uO(),f[0]=2/a,f[1]=0,f[2]=0,f[3]=0,f[4]=-2/s,f[5]=0,f[6]=-1,f[7]=1,f[8]=1,g=p=uO(),v=h[0],y=h[1],b=h[2],x=h[3],w=h[4],E=h[5],k=h[6],T=h[7],C=h[8],P=d[0],S=d[1],B=d[2],D=d[3],_=d[4],A=d[5],M=d[6],R=d[7],I=d[8],g[0]=P*v+S*x+B*k,g[1]=P*y+S*w+B*T,g[2]=P*b+S*E+B*C,g[3]=D*v+_*x+A*k,g[4]=D*y+_*w+A*T,g[5]=D*b+_*E+A*C,g[6]=M*v+R*x+I*k,g[7]=M*y+R*w+I*T,g[8]=M*b+R*E+I*C,p),F=e.getCachedZSortedEles();if(i=F.length,r.startFrame(V,n),n.screen){for(var X=0;X0&&a>0){h.clearRect(0,0,i,a),h.globalCompositeOperation="source-over";var f=this.getCachedZSortedEles();if(e.full)h.translate(-n.x1*l,-n.y1*l),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(n.x1*l,n.y1*l);else{var p=t.pan(),g={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(g.x,g.y),h.scale(l,l),this.drawElements(h,f),h.scale(1/l,1/l),h.translate(-g.x,-g.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,i,a),h.fill())}return d},u8.png=function(e){return ce(e,this.bufferCanvasImage(e),"image/png")},u8.jpg=function(e){return ce(e,this.bufferCanvasImage(e),"image/jpeg")};var ct={};ct.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 cn=cr.prototype;function cr(e){var t=this,n=t.cy.window().document;e.webgl&&(cn.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:Array(cn.CANVAS_LAYERS),contexts:Array(cn.CANVAS_LAYERS),canvasNeedsRedraw:Array(cn.CANVAS_LAYERS),bufferCanvases:Array(cn.BUFFER_COUNT),bufferContexts:Array(cn.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"};E&&E.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;ltypeof Path2D;cn.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},cn.usePaths=function(){return ci&&this.pathsEnabled},cn.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},cn.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},cn.makeOffscreenCanvas=function(e,t){var n;return("u"