/*! For license information please see 7426.c83966ccc62601d391bd.js.LICENSE.txt */ (self["webpackChunk_jupyterlab_application_top"]=self["webpackChunk_jupyterlab_application_top"]||[]).push([[7426],{84182:function(e,t,r){(function t(n,a){if(true)e.exports=a(r(82241));else{}})(this,(function(e){return function(e){var t={};function r(n){if(t[n]){return t[n].exports}var a=t[n]={i:n,l:false,exports:{}};e[n].call(a.exports,a,a.exports,r);a.l=true;return a.exports}r.m=e;r.c=t;r.i=function(e){return e};r.d=function(e,t,n){if(!r.o(e,t)){Object.defineProperty(e,t,{configurable:false,enumerable:true,get:n})}};r.n=function(e){var t=e&&e.__esModule?function t(){return e["default"]}:function t(){return e};r.d(t,"a",t);return t};r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};r.p="";return r(r.s=7)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(0).FDLayoutConstants;function a(){}for(var i in n){a[i]=n[i]}a.DEFAULT_USE_MULTI_LEVEL_SCALING=false;a.DEFAULT_RADIAL_SEPARATION=n.DEFAULT_EDGE_LENGTH;a.DEFAULT_COMPONENT_SEPERATION=60;a.TILE=true;a.TILING_PADDING_VERTICAL=10;a.TILING_PADDING_HORIZONTAL=10;a.TREE_REDUCTION_ON_INCREMENTAL=false;e.exports=a},function(e,t,r){"use strict";var n=r(0).FDLayoutEdge;function a(e,t,r){n.call(this,e,t,r)}a.prototype=Object.create(n.prototype);for(var i in n){a[i]=n[i]}e.exports=a},function(e,t,r){"use strict";var n=r(0).LGraph;function a(e,t,r){n.call(this,e,t,r)}a.prototype=Object.create(n.prototype);for(var i in n){a[i]=n[i]}e.exports=a},function(e,t,r){"use strict";var n=r(0).LGraphManager;function a(e){n.call(this,e)}a.prototype=Object.create(n.prototype);for(var i in n){a[i]=n[i]}e.exports=a},function(e,t,r){"use strict";var n=r(0).FDLayoutNode;var a=r(0).IMath;function i(e,t,r,a){n.call(this,e,t,r,a)}i.prototype=Object.create(n.prototype);for(var o in n){i[o]=n[o]}i.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren;this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren;if(Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement){this.displacementX=e.coolingFactor*e.maxNodeDisplacement*a.sign(this.displacementX)}if(Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement){this.displacementY=e.coolingFactor*e.maxNodeDisplacement*a.sign(this.displacementY)}if(this.child==null){this.moveBy(this.displacementX,this.displacementY)}else if(this.child.getNodes().length==0){this.moveBy(this.displacementX,this.displacementY)}else{this.propogateDisplacementToChildren(this.displacementX,this.displacementY)}e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY);this.springForceX=0;this.springForceY=0;this.repulsionForceX=0;this.repulsionForceY=0;this.gravitationForceX=0;this.gravitationForceY=0;this.displacementX=0;this.displacementY=0};i.prototype.propogateDisplacementToChildren=function(e,t){var r=this.getChild().getNodes();var n;for(var a=0;a0){this.positionNodesRadially(e)}else{this.reduceTrees();this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes());var r=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(r);this.positionNodesRandomly()}}else{if(l.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees();this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes());var r=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(r)}}this.initSpringEmbedder();this.runSpringEmbedder();return true};m.prototype.tick=function(){this.totalIterations++;if(this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.prunedNodesAll.length>0){this.isTreeGrowing=true}else{return true}}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(this.prunedNodesAll.length>0){this.isTreeGrowing=true}else{return true}}this.coolingCycle++;if(this.layoutQuality==0){this.coolingAdjuster=this.coolingCycle}else if(this.layoutQuality==1){this.coolingAdjuster=this.coolingCycle/3}this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature);this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0){if(this.prunedNodesAll.length>0){this.graphManager.updateBounds();this.updateGrid();this.growTree(this.prunedNodesAll);this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes());var t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t);this.graphManager.updateBounds();this.updateGrid();this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else{this.isTreeGrowing=false;this.isGrowthFinished=true}}this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged()){return true}if(this.afterGrowthIterations%10==0){this.graphManager.updateBounds();this.updateGrid()}this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100);this.afterGrowthIterations++}var r=!this.isTreeGrowing&&!this.isGrowthFinished;var n=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;this.totalDisplacement=0;this.graphManager.updateBounds();this.calcSpringForces();this.calcRepulsionForces(r,n);this.calcGravitationalForces();this.moveNodes();this.animate();return false};m.prototype.getPositionsData=function(){var e=this.graphManager.getAllNodes();var t={};for(var r=0;r1){var s;for(s=0;sn){n=Math.floor(o.y)}i=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))};m.radialLayout=function(e,t,r){var n=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,n);var a=g.calculateBounds(e);var i=new y;i.setDeviceOrgX(a.getMinX());i.setDeviceOrgY(a.getMinY());i.setWorldOrgX(r.x);i.setWorldOrgY(r.y);for(var o=0;o1){var x=b[0];b.splice(0,1);var w=f.indexOf(x);if(w>=0){f.splice(w,1)}g--;h--}if(t!=null){y=(f.indexOf(b[0])+1)%g}else{y=0}var E=Math.abs(n-r)/h;for(var T=y;d!=h;T=++T%g){var _=f[T].getOtherEnd(e);if(_==t){continue}var D=(r+d*E)%360;var C=(D+E)%360;m.branchRadialLayout(_,e,D,C,a+i,i);d++}};m.maxDiagonalInTree=function(e){var t=d.MIN_VALUE;for(var r=0;rt){t=a}}return t};m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength};m.prototype.groupZeroDegreeMembers=function(){var e=this;var t={};this.memberGroups={};this.idToDummyNode={};var r=[];var n=this.graphManager.getAllNodes();for(var a=0;a1){var n="DummyCompound_"+r;e.memberGroups[n]=t[r];var a=t[r][0].getParent();var i=new o(e.graphManager);i.id=n;i.paddingLeft=a.paddingLeft||0;i.paddingRight=a.paddingRight||0;i.paddingBottom=a.paddingBottom||0;i.paddingTop=a.paddingTop||0;e.idToDummyNode[n]=i;var s=e.getGraphManager().add(e.newGraph(),i);var l=a.getChild();l.add(i);for(var u=0;u=0;e--){var t=this.compoundOrder[e];var r=t.id;var n=t.paddingLeft;var a=t.paddingTop;this.adjustLocations(this.tiledMemberPack[r],t.rect.x,t.rect.y,n,a)}};m.prototype.repopulateZeroDegreeMembers=function(){var e=this;var t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(r){var n=e.idToDummyNode[r];var a=n.paddingLeft;var i=n.paddingTop;e.adjustLocations(t[r],n.rect.x,n.rect.y,a,i)}))};m.prototype.getToBeTiled=function(e){var t=e.id;if(this.toBeTiled[t]!=null){return this.toBeTiled[t]}var r=e.getChild();if(r==null){this.toBeTiled[t]=false;return false}var n=r.getNodes();for(var a=0;a0){this.toBeTiled[t]=false;return false}if(i.getChild()==null){this.toBeTiled[i.id]=false;continue}if(!this.getToBeTiled(i)){this.toBeTiled[t]=false;return false}}this.toBeTiled[t]=true;return true};m.prototype.getNodeDegree=function(e){var t=e.id;var r=e.getEdges();var n=0;for(var a=0;al)l=c.rect.height}r+=l+e.verticalPadding}};m.prototype.tileCompoundMembers=function(e,t){var r=this;this.tiledMemberPack=[];Object.keys(e).forEach((function(n){var a=t[n];r.tiledMemberPack[n]=r.tileNodes(e[n],a.paddingLeft+a.paddingRight);a.rect.width=r.tiledMemberPack[n].width;a.rect.height=r.tiledMemberPack[n].height}))};m.prototype.tileNodes=function(e,t){var r=l.TILING_PADDING_VERTICAL;var n=l.TILING_PADDING_HORIZONTAL;var a={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:r,horizontalPadding:n};e.sort((function(e,t){if(e.rect.width*e.rect.height>t.rect.width*t.rect.height)return-1;if(e.rect.width*e.rect.height0){o+=e.horizontalPadding}e.rowWidth[r]=o;if(e.width0)s+=e.verticalPadding;var l=0;if(s>e.rowHeight[r]){l=e.rowHeight[r];e.rowHeight[r]=s;l=e.rowHeight[r]-l}e.height+=l;e.rows[r].push(t)};m.prototype.getShortestRowIndex=function(e){var t=-1;var r=Number.MAX_VALUE;for(var n=0;nr){t=n;r=e.rowWidth[n]}}return t};m.prototype.canAddHorizontal=function(e,t,r){var n=this.getShortestRowIndex(e);if(n<0){return true}var a=e.rowWidth[n];if(a+e.horizontalPadding+t<=e.width)return true;var i=0;if(e.rowHeight[n]0)i=r+e.verticalPadding-e.rowHeight[n]}var o;if(e.width-a>=t+e.horizontalPadding){o=(e.height+i)/(a+t+e.horizontalPadding)}else{o=(e.height+i)/e.width}i=r+e.verticalPadding;var s;if(e.widthi&&t!=r){n.splice(-1,1);e.rows[r].push(a);e.rowWidth[t]=e.rowWidth[t]-i;e.rowWidth[r]=e.rowWidth[r]+i;e.width=e.rowWidth[instance.getLongestRowIndex(e)];var o=Number.MIN_VALUE;for(var s=0;so)o=n[s].height}if(t>0)o+=e.verticalPadding;var l=e.rowHeight[t]+e.rowHeight[r];e.rowHeight[t]=o;if(e.rowHeight[r]0){for(var p=a;p<=i;p++){h[0]+=this.grid[p][o-1].length+this.grid[p][o].length-1}}if(i0){for(var p=o;p<=s;p++){h[3]+=this.grid[a-1][p].length+this.grid[a][p].length-1}}var g=d.MAX_VALUE;var y;var m;for(var b=0;b0){var p;p=r.getGraphManager().add(r.newGraph(),c);this.processChildrenList(p,o,r)}}};f.prototype.stop=function(){this.stopped=true;return this};var d=function e(t){t("layout","cose-bilkent",f)};if(typeof cytoscape!=="undefined"){d(cytoscape)}e.exports=d}])}))},71377:function(e,t,r){(function(t,r){true?e.exports=r():0})(this,(function(){"use strict";function e(t){"@babel/helpers - typeof";return e="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(t)}function t(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}}function n(e,t){for(var r=0;re.length)t=e.length;for(var r=0,n=new Array(t);rr){return 1}else{return 0}};var Z=function e(t,r){return-1*K(t,r)};var Q=Object.assign!=null?Object.assign.bind(Object):function(e){var t=arguments;for(var r=1;r1)r-=1;if(r<1/6)return e+(t-e)*6*r;if(r<1/2)return t;if(r<2/3)return e+(t-e)*(2/3-r)*6;return e}var v=new RegExp("^"+H+"$").exec(t);if(v){n=parseInt(v[1]);if(n<0){n=(360- -1*n%360)%360}else if(n>360){n=n%360}n/=360;a=parseFloat(v[2]);if(a<0||a>100){return}a=a/100;i=parseFloat(v[3]);if(i<0||i>100){return}i=i/100;o=v[4];if(o!==undefined){o=parseFloat(o);if(o<0||o>1){return}}if(a===0){s=l=u=Math.round(i*255)}else{var f=i<.5?i*(1+a):i+a-i*a;var h=2*i-f;s=Math.round(255*c(h,f,n+1/3));l=Math.round(255*c(h,f,n));u=Math.round(255*c(h,f,n-1/3))}r=[s,l,u,o]}return r};var te=function e(t){var r;var n=new RegExp("^"+U+"$").exec(t);if(n){r=[];var a=[];for(var i=1;i<=3;i++){var o=n[i];if(o[o.length-1]==="%"){a[i]=true}o=parseFloat(o);if(a[i]){o=o/100*255}if(o<0||o>255){return}r.push(Math.floor(o))}var s=a[1]||a[2]||a[3];var l=a[1]&&a[2]&&a[3];if(s&&!l){return}var u=n[4];if(u!==undefined){u=parseFloat(u);if(u<0||u>1){return}r.push(u)}}return r};var re=function e(t){return ae[t.toLowerCase()]};var ne=function e(t){return(w(t)?t:null)||re(t)||J(t)||te(t)||ee(t)};var ae={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]};var ie=function e(t){var r=t.map;var n=t.keys;var a=n.length;for(var i=0;i=t||r<0||v&&n>=i}function y(){var e=ye();if(g(e)){return m(e)}s=setTimeout(y,p(e))}function m(e){s=undefined;if(f&&n){return h(e)}n=a=undefined;return o}function b(){if(s!==undefined){clearTimeout(s)}u=0;n=l=a=s=undefined}function x(){return s===undefined?o:m(ye())}function w(){var e=ye(),r=g(e);n=arguments;a=this;l=e;if(r){if(s===undefined){return d(l)}if(v){clearTimeout(s);s=setTimeout(y,t);return h(l)}}if(s===undefined){s=setTimeout(y,t)}return o}w.cancel=b;w.flush=x;return w}var nt=rt;var at=f?f.performance:null;var it=at&&at.now?function(){return at.now()}:function(){return Date.now()};var ot=function(){if(f){if(f.requestAnimationFrame){return function(e){f.requestAnimationFrame(e)}}else if(f.mozRequestAnimationFrame){return function(e){f.mozRequestAnimationFrame(e)}}else if(f.webkitRequestAnimationFrame){return function(e){f.webkitRequestAnimationFrame(e)}}else if(f.msRequestAnimationFrame){return function(e){f.msRequestAnimationFrame(e)}}}return function(e){if(e){setTimeout((function(){e(it())}),1e3/60)}}}();var st=function e(t){return ot(t)};var lt=it;var ut=9261;var ct=65599;var vt=5381;var ft=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:ut;var n=r;var a;for(;;){a=t.next();if(a.done){break}n=n*ct+a.value|0}return n};var ht=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:ut;return r*ct+t|0};var dt=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:vt;return(r<<5)+r+t|0};var pt=function e(t,r){return t*2097152+r};var gt=function e(t){return t[0]*2097152+t[1]};var yt=function e(t,r){return[ht(t[0],r[0]),dt(t[1],r[1])]};var mt=function e(t,r){var n={value:0,done:false};var a=0;var i=t.length;var o={next:function e(){if(a=0;a--){if(t[a]===r){t.splice(a,1);if(n){break}}}};var Yt=function e(t){t.splice(0,t.length)};var Xt=function e(t,r){for(var n=0;n2&&arguments[2]!==undefined?arguments[2]:true;if(t===undefined||r===undefined||!I(t)){It("An element must have a core reference and parameters set");return}var a=r.group;if(a==null){if(r.data&&r.data.source!=null&&r.data.target!=null){a="edges"}else{a="nodes"}}if(a!=="nodes"&&a!=="edges"){It("An element must be of type `nodes` or `edges`; you specified `"+a+"`");return}this.length=1;this[0]=this;var i=this._private={cy:t,single:true,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:undefined,autoHeight:undefined,autoPadding:undefined,compoundBoundsClean:false,listeners:[],group:a,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:true,selected:r.selected?true:false,selectable:r.selectable===undefined?true:r.selectable?true:false,locked:r.locked?true:false,grabbed:false,grabbable:r.grabbable===undefined?true:r.grabbable?true:false,pannable:r.pannable===undefined?a==="edges"?true:false:r.pannable?true:false,active:false,classes:new $t,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:false,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null){i.position.x=0}if(i.position.y==null){i.position.y=0}if(r.renderedPosition){var o=r.renderedPosition;var s=t.pan();var l=t.zoom();i.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];if(w(r.classes)){u=r.classes}else if(b(r.classes)){u=r.classes.split(/\s+/)}for(var c=0,v=u.length;ct){return 1}return 0};u=function(e,t,a,i,o){var s;if(a==null){a=0}if(o==null){o=r}if(a<0){throw new Error("lo must be non-negative")}if(i==null){i=e.length}while(ar;0<=r?t++:t--){u.push(t)}return u}.apply(this).reverse();l=[];for(i=0,o=s.length;ip;0<=p?++f:--f){g.push(i(e,n))}return g};d=function(e,t,n,a){var i,o,s;if(a==null){a=r}i=e[n];while(n>t){s=n-1>>1;o=e[s];if(a(i,o)<0){e[n]=o;n=s;continue}break}return e[n]=i};p=function(e,t,n){var a,i,o,s,l;if(n==null){n=r}i=e.length;l=t;o=e[t];a=2*t+1;while(a0){var _=m.pop();var D=g(_);var C=_.id();f[C]=D;if(D===Infinity){continue}var N=_.neighborhood().intersect(d);for(var A=0;A0){n.unshift(r);while(v[i]){var o=v[i];n.unshift(o.edge);n.unshift(o.node);a=o.node;i=a.id()}}return s.spawn(n)}}}};var nr={kruskal:function e(t){t=t||function(e){return 1};var r=this.byGroup(),n=r.nodes,a=r.edges;var i=n.length;var o=new Array(i);var s=n;var l=function e(t){for(var r=0;r0){w();T++;if(x===c){var _=[];var D=i;var C=c;var N=y[C];for(;;){_.unshift(D);if(N!=null){_.unshift(N)}D=g[C];if(D==null){break}C=D.id();N=y[C]}return{found:true,distance:v[x],path:this.spawn(_),steps:T}}h[x]=true;var A=b._private.edges;for(var L=0;LA){d[N]=A;m[N]=C;x[N]=E}if(!i){var L=C*c+D;if(!i&&d[L]>A){d[L]=A;m[L]=D;x[L]=E}}}for(var I=0;I1&&arguments[1]!==undefined?arguments[1]:o;var a=x(t);var i=[];var s=a;for(;;){if(s==null){return r.spawn()}var u=m(s),c=u.edge,v=u.pred;i.unshift(s[0]);if(s.same(n)&&i.length>0){break}if(c!=null){i.unshift(c)}s=v}return l.spawn(i)};for(var T=0;T=0;c--){var v=u[c];var f=v[1];var h=v[2];if(r[f]===s&&r[h]===l||r[f]===l&&r[h]===s){u.splice(c,1)}}for(var d=0;da){var i=Math.floor(Math.random()*r.length);r=vr(i,t,r);n--}return r};var hr={kargerStein:function e(){var t=this;var r=this.byGroup(),n=r.nodes,a=r.edges;a.unmergeBy((function(e){return e.isLoop()}));var i=n.length;var o=a.length;var s=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2));var l=Math.floor(i/cr);if(i<2){It("At least 2 nodes are required for Karger-Stein algorithm");return undefined}var u=[];for(var c=0;c1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var e=Infinity;for(var a=r;a1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var e=-Infinity;for(var a=r;a1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var a=0;var i=0;for(var o=r;o1&&arguments[1]!==undefined?arguments[1]:0;var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:t.length;var a=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var i=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var o=arguments.length>5&&arguments[5]!==undefined?arguments[5]:true;if(a){t=t.slice(r,n)}else{if(n0){t.splice(0,r)}}var s=0;for(var l=t.length-1;l>=0;l--){var u=t[l];if(o){if(!isFinite(u)){t[l]=-Infinity;s++}}else{t.splice(l,1)}}if(i){t.sort((function(e,t){return e-t}))}var c=t.length;var v=Math.floor(c/2);if(c%2!==0){return t[v+1+s]}else{return(t[v-1+s]+t[v+s])/2}};var Er=function e(t){return Math.PI*t/180};var Tr=function e(t,r){return Math.atan2(r,t)-Math.PI/2};var _r=Math.log2||function(e){return Math.log(e)/Math.log(2)};var Dr=function e(t){if(t>0){return 1}else if(t<0){return-1}else{return 0}};var Cr=function e(t,r){return Math.sqrt(Nr(t,r))};var Nr=function e(t,r){var n=r.x-t.x;var a=r.y-t.y;return n*n+a*a};var Ar=function e(t){var r=t.length;var n=0;for(var a=0;a=t.x1&&t.y2>=t.y1){return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1}}else if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0){return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}}};var Mr=function e(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}};var Pr=function e(t){t.x1=Infinity;t.y1=Infinity;t.x2=-Infinity;t.y2=-Infinity;t.w=0;t.h=0};var Rr=function e(t,r){t.x1=Math.min(t.x1,r.x1);t.x2=Math.max(t.x2,r.x2);t.w=t.x2-t.x1;t.y1=Math.min(t.y1,r.y1);t.y2=Math.max(t.y2,r.y2);t.h=t.y2-t.y1};var Br=function e(t,r,n){t.x1=Math.min(t.x1,r);t.x2=Math.max(t.x2,r);t.w=t.x2-t.x1;t.y1=Math.min(t.y1,n);t.y2=Math.max(t.y2,n);t.h=t.y2-t.y1};var Fr=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;t.x1-=r;t.x2+=r;t.y1-=r;t.y2+=r;t.w=t.x2-t.x1;t.h=t.y2-t.y1;return t};var zr=function e(t){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[0];var n,a,i,s;if(r.length===1){n=a=i=s=r[0]}else if(r.length===2){n=i=r[0];s=a=r[1]}else if(r.length===4){var l=o(r,4);n=l[0];a=l[1];i=l[2];s=l[3]}t.x1-=s;t.x2+=a;t.y1-=n;t.y2+=i;t.w=t.x2-t.x1;t.h=t.y2-t.y1;return t};var Gr=function e(t,r){t.x1=r.x1;t.y1=r.y1;t.x2=r.x2;t.y2=r.y2;t.w=t.x2-t.x1;t.h=t.y2-t.y1};var Yr=function e(t,r){if(t.x1>r.x2){return false}if(r.x1>t.x2){return false}if(t.x2r.y2){return false}if(r.y1>t.y2){return false}return true};var Xr=function e(t,r,n){return t.x1<=r&&r<=t.x2&&t.y1<=n&&n<=t.y2};var Vr=function e(t,r){return Xr(t,r.x,r.y)};var Ur=function e(t,r){return Xr(t,r.x1,r.y1)&&Xr(t,r.x2,r.y2)};var jr=function e(t,r,n,a,i,o,s){var l=pn(i,o);var u=i/2;var c=o/2;var v;{var f=n-u+l-s;var h=a-c-s;var d=n+u-l+s;var p=h;v=ln(t,r,n,a,f,h,d,p,false);if(v.length>0){return v}}{var g=n+u+s;var y=a-c+l-s;var m=g;var b=a+c-l+s;v=ln(t,r,n,a,g,y,m,b,false);if(v.length>0){return v}}{var x=n-u+l-s;var w=a+c+s;var E=n+u-l+s;var T=w;v=ln(t,r,n,a,x,w,E,T,false);if(v.length>0){return v}}{var _=n-u-s;var D=a-c+l-s;var C=_;var N=a+c-l+s;v=ln(t,r,n,a,_,D,C,N,false);if(v.length>0){return v}}var A;{var L=n-u+l;var I=a-c+l;A=on(t,r,n,a,L,I,l+s);if(A.length>0&&A[0]<=L&&A[1]<=I){return[A[0],A[1]]}}{var S=n+u-l;var k=a-c+l;A=on(t,r,n,a,S,k,l+s);if(A.length>0&&A[0]>=S&&A[1]<=k){return[A[0],A[1]]}}{var O=n+u-l;var M=a+c-l;A=on(t,r,n,a,O,M,l+s);if(A.length>0&&A[0]>=O&&A[1]>=M){return[A[0],A[1]]}}{var P=n-u+l;var R=a+c-l;A=on(t,r,n,a,P,R,l+s);if(A.length>0&&A[0]<=P&&A[1]>=R){return[A[0],A[1]]}}return[]};var Hr=function e(t,r,n,a,i,o,s){var l=s;var u=Math.min(n,i);var c=Math.max(n,i);var v=Math.min(a,o);var f=Math.max(a,o);return u-l<=t&&t<=c+l&&v-l<=r&&r<=f+l};var qr=function e(t,r,n,a,i,o,s,l,u){var c={x1:Math.min(n,s,i)-u,x2:Math.max(n,s,i)+u,y1:Math.min(a,l,o)-u,y2:Math.max(a,l,o)+u};if(tc.x2||rc.y2){return false}else{return true}};var Wr=function e(t,r,n,a){n-=a;var i=r*r-4*t*n;if(i<0){return[]}var o=Math.sqrt(i);var s=2*t;var l=(-r+o)/s;var u=(-r-o)/s;return[l,u]};var $r=function e(t,r,n,a,i){var o=1e-5;if(t===0){t=o}r/=t;n/=t;a/=t;var s,l,u,c,v,f,h,d;l=(3*n-r*r)/9;u=-(27*a)+r*(9*n-2*(r*r));u/=54;s=l*l*l+u*u;i[1]=0;h=r/3;if(s>0){v=u+Math.sqrt(s);v=v<0?-Math.pow(-v,1/3):Math.pow(v,1/3);f=u-Math.sqrt(s);f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3);i[0]=-h+v+f;h+=(v+f)/2;i[4]=i[2]=-h;h=Math.sqrt(3)*(-f+v)/2;i[3]=h;i[5]=-h;return}i[5]=i[3]=0;if(s===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3);i[0]=-h+2*d;i[4]=i[2]=-(d+h);return}l=-l;c=l*l*l;c=Math.acos(u/Math.sqrt(c));d=2*Math.sqrt(l);i[0]=-h+d*Math.cos(c/3);i[2]=-h+d*Math.cos((c+2*Math.PI)/3);i[4]=-h+d*Math.cos((c+4*Math.PI)/3);return};var Kr=function e(t,r,n,a,i,o,s,l){var u=1*n*n-4*n*i+2*n*s+4*i*i-4*i*s+s*s+a*a-4*a*o+2*a*l+4*o*o-4*o*l+l*l;var c=1*9*n*i-3*n*n-3*n*s-6*i*i+3*i*s+9*a*o-3*a*a-3*a*l-6*o*o+3*o*l;var v=1*3*n*n-6*n*i+n*s-n*t+2*i*i+2*i*t-s*t+3*a*a-6*a*o+a*l-a*r+2*o*o+2*o*r-l*r;var f=1*n*i-n*n+n*t-i*t+a*o-a*a+a*r-o*r;var h=[];$r(u,c,v,f,h);var d=1e-7;var p=[];for(var g=0;g<6;g+=2){if(Math.abs(h[g+1])=0&&h[g]<=1){p.push(h[g])}}p.push(1);p.push(0);var y=-1;var m,b,x;for(var w=0;w=0){if(xu){return(t-i)*(t-i)+(r-o)*(r-o)}return c-f};var Qr=function e(t,r,n){var a,i,o,s;var l;var u=0;for(var c=0;c=t&&t>=o||a<=t&&t<=o){l=(t-a)/(o-a)*(s-i)+i;if(l>r){u++}}else{continue}}if(u%2===0){return false}else{return true}};var Jr=function e(t,r,n,a,i,o,s,l,u){var c=new Array(n.length);var v;if(l[0]!=null){v=Math.atan(l[1]/l[0]);if(l[0]<0){v=v+Math.PI/2}else{v=-v-Math.PI/2}}else{v=l}var f=Math.cos(-v);var h=Math.sin(-v);for(var d=0;d0){var g=rn(c,-u);p=tn(g)}else{p=c}return Qr(t,r,p)};var en=function e(t,r,n,a,i,o,s){var l=new Array(n.length);var u=o/2;var c=s/2;var v=gn(o,s);var f=v*v;for(var h=0;h=0&&g<=1){m.push(g)}if(y>=0&&y<=1){m.push(y)}if(m.length===0){return[]}var b=m[0]*l[0]+t;var x=m[0]*l[1]+r;if(m.length>1){if(m[0]==m[1]){return[b,x]}else{var w=m[1]*l[0]+t;var E=m[1]*l[1]+r;return[b,x,w,E]}}else{return[b,x]}};var sn=function e(t,r,n){if(r<=t&&t<=n||n<=t&&t<=r){return t}else if(t<=r&&r<=n||n<=r&&r<=t){return r}else{return n}};var ln=function e(t,r,n,a,i,o,s,l,u){var c=t-i;var v=n-t;var f=s-i;var h=r-o;var d=a-r;var p=l-o;var g=f*h-p*c;var y=v*h-d*c;var m=p*v-f*d;if(m!==0){var b=g/m;var x=y/m;var w=.001;var E=0-w;var T=1+w;if(E<=b&&b<=T&&E<=x&&x<=T){return[t+b*v,r+b*d]}else{if(!u){return[]}else{return[t+b*v,r+b*d]}}}else{if(g===0||y===0){if(sn(t,n,s)===s){return[s,l]}if(sn(t,n,i)===i){return[i,o]}if(sn(i,s,n)===n){return[n,a]}return[]}else{return[]}}};var un=function e(t,r,n,a,i,o,s,l){var u=[];var c;var v=new Array(n.length);var f=true;if(o==null){f=false}var h;if(f){for(var d=0;d0){var p=rn(v,-l);h=tn(p)}else{h=v}}else{h=n}var g,y,m,b;for(var x=0;x2){var k=[u[0],u[1]];var O=Math.pow(k[0]-t,2)+Math.pow(k[1]-r,2);for(var M=1;Mc){c=r}},get:function e(t){return u[t]}};for(var f=0;f0){x=b.edgesTo(m)[0]}else{x=m.edgesTo(b)[0]}var w=a(x);m=m.id();if(f[m]>f[g]+w){f[m]=f[g]+w;if(h.nodes.indexOf(m)<0){h.push(m)}else{h.updateItem(m)}c[m]=0;u[m]=[]}if(f[m]==f[g]+w){c[m]=c[m]+c[g];u[m].push(g)}}}else{for(var E=0;E0){var C=n.pop();for(var N=0;N0){s.push(n[l])}}if(s.length!==0){i.push(a.collection(s))}}return i};var Fn=function e(t,r){for(var n=0;n5&&arguments[5]!==undefined?arguments[5]:Xn;var s=a;var l,u;for(var c=0;c=2){return Wn(t,r,n,0,jn,Hn)}else{return Wn(t,r,n,0,Un)}},squaredEuclidean:function e(t,r,n){return Wn(t,r,n,0,jn)},manhattan:function e(t,r,n){return Wn(t,r,n,0,Un)},max:function e(t,r,n){return Wn(t,r,n,-Infinity,qn)}};$n["squared-euclidean"]=$n["squaredEuclidean"];$n["squaredeuclidean"]=$n["squaredEuclidean"];function Kn(e,t,r,n,a,i){var o;if(x(e)){o=e}else{o=$n[e]||$n.euclidean}if(t===0&&x(e)){return o(a,i)}else{return o(t,r,n,a,i)}}var Zn=zt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:false,testCentroids:null});var Qn=function e(t){return Zn(t)};var Jn=function e(t,r,n,a,i){var o=i!=="kMedoids";var s=o?function(e){return n[e]}:function(e){return a[e](n)};var l=function e(t){return a[t](r)};var u=n;var c=r;return Kn(t,a.length,s,l,u,c)};var ea=function e(t,r,n){var a=n.length;var i=new Array(a);var o=new Array(a);var s=new Array(r);var l=null;for(var u=0;un){return false}}}return true};var ia=function e(t,r,n){for(var a=0;as){s=r[u][c];l=c}}i[l].push(t[u])}for(var v=0;v=i.threshold||i.mode==="dendrogram"&&t.length===1){return false}var d=r[o];var p=r[a[o]];var g;if(i.mode==="dendrogram"){g={left:d,right:p,key:d.key}}else{g={value:d.value.concat(p.value),key:d.key}}t[d.index]=g;t.splice(p.index,1);r[d.key]=g;for(var y=0;yn[p.key][m.key]){l=n[p.key][m.key]}}else if(i.linkage==="max"){l=n[d.key][m.key];if(n[d.key][m.key]0){a.push(i)}}return a};var La=function e(t,r,n){var a=[];for(var i=0;is){o=u;s=r[i*t+u]}}if(o>0){a.push(o)}}for(var c=0;cu){l=c;u=v}}n[i]=o[l]}a=La(t,r,n);return a};var Sa=function e(t){var r=this.cy();var n=this.nodes();var a=Da(t);var i={};for(var o=0;o=N){A=N;N=I;L=S}else if(I>A){A=I}}for(var k=0;k0?1:0;T[D%a.minIterations*s+F]=z;B+=z}if(B>0&&(D>=a.minIterations-1||D==a.maxIterations-1)){var G=0;for(var Y=0;Y1||a>1){s=true}v[t]=[];e.outgoers().forEach((function(e){if(e.isEdge())v[t].push(e.id())}))}else{f[t]=[undefined,e.target().id()]}}))}else{o.forEach((function(e){var t=e.id();if(e.isNode()){var r=e.degree(true);if(r%2){if(!l)l=t;else if(!u)u=t;else s=true}v[t]=[];e.connectedEdges().forEach((function(e){return v[t].push(e.id())}))}else{f[t]=[e.source().id(),e.target().id()]}}))}var h={found:false,trail:undefined};if(s)return h;else if(u&&l){if(i){if(c&&u!=c){return h}c=u}else{if(c&&u!=c&&l!=c){return h}else if(!c){c=u}}}else{if(!c)c=o[0].id()}var d=function e(t){var r=t;var n=[t];var a,o,s;while(v[r].length){a=v[r].shift();o=f[a][0];s=f[a][1];if(r!=s){v[s]=v[s].filter((function(e){return e!=a}));r=s}else if(!i&&r!=o){v[o]=v[o].filter((function(e){return e!=a}));r=o}n.unshift(a);n.unshift(r)}return n};var p=[];var g=[];g=d(c);while(g.length!=1){if(v[g[0]].length==0){p.unshift(o.getElementById(g.shift()));p.unshift(o.getElementById(g.shift()))}else{g=d(g.shift()).concat(g)}}p.unshift(o.getElementById(g.shift()));for(var y in v){if(v[y].length){return h}}h.found=true;h.trail=this.spawn(p,true);return h}};var Pa=function e(){var t=this;var r={};var n=0;var a=0;var i=[];var o=[];var s={};var l=function e(n,a){var s=o.length-1;var l=[];var u=t.spawn();while(o[s].x!=n||o[s].y!=a){l.push(o.pop().edge);s--}l.push(o.pop().edge);l.forEach((function(e){var n=e.connectedNodes().intersection(t);u.merge(e);n.forEach((function(e){var n=e.id();var a=e.connectedEdges().intersection(t);u.merge(e);if(!r[n].cutVertex){u.merge(a)}else{u.merge(a.filter((function(e){return e.isLoop()})))}}))}));i.push(u)};var u=function e(u,c,v){if(u===v)a+=1;r[c]={id:n,low:n++,cutVertex:false};var f=t.getElementById(c).connectedEdges().intersection(t);if(f.size()===0){i.push(t.spawn(t.getElementById(c)))}else{var h,d,p,g;f.forEach((function(t){h=t.source().id();d=t.target().id();p=h===c?d:h;if(p!==v){g=t.id();if(!s[g]){s[g]=true;o.push({x:c,y:p,edge:t})}if(!(p in r)){e(u,p,c);r[c].low=Math.min(r[c].low,r[p].low);if(r[c].id<=r[p].low){r[c].cutVertex=true;l(c,p)}}else{r[c].low=Math.min(r[c].low,r[p].id)}}}))}};t.forEach((function(e){if(e.isNode()){var t=e.id();if(!(t in r)){a=0;u(t,t);r[t].cutVertex=a>1}}}));var c=Object.keys(r).filter((function(e){return r[e].cutVertex})).map((function(e){return t.getElementById(e)}));return{cut:t.spawn(c),components:i}};var Ra={hopcroftTarjanBiconnected:Pa,htbc:Pa,htb:Pa,hopcroftTarjanBiconnectedComponents:Pa};var Ba=function e(){var t=this;var r={};var n=0;var a=[];var i=[];var o=t.spawn(t);var s=function e(s){i.push(s);r[s]={index:n,low:n++,explored:false};var l=t.getElementById(s).connectedEdges().intersection(t);l.forEach((function(t){var n=t.target().id();if(n!==s){if(!(n in r)){e(n)}if(!r[n].explored){r[s].low=Math.min(r[s].low,r[n].low)}}}));if(r[s].index===r[s].low){var u=t.spawn();for(;;){var c=i.pop();u.merge(t.getElementById(c));r[c].low=r[s].index;r[c].explored=true;if(c===s){break}}var v=u.edgesWith(u);var f=u.merge(v);a.push(f);o=o.difference(f)}};t.forEach((function(e){if(e.isNode()){var t=e.id();if(!(t in r)){s(t)}}}));return{cut:o,components:a}};var Fa={tarjanStronglyConnected:Ba,tsc:Ba,tscc:Ba,tarjanStronglyConnectedComponents:Ba};var za={};[Qt,rr,nr,ir,sr,ur,hr,wn,Tn,Dn,Nn,Yn,da,Ta,ka,Ma,Ra,Fa].forEach((function(e){Q(za,e)}));var Ga=0;var Ya=1;var Xa=2;var Va=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7";this.state=Ga;this.fulfillValue=undefined;this.rejectReason=undefined;this.onFulfilled=[];this.onRejected=[];this.proxy={then:this.then.bind(this)};if(typeof t==="function")t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Va.prototype={fulfill:function e(t){return Ua(this,Ya,"fulfillValue",t)},reject:function e(t){return Ua(this,Xa,"rejectReason",t)},then:function e(t,r){var n=this;var a=new Va;n.onFulfilled.push(qa(t,a,"fulfill"));n.onRejected.push(qa(r,a,"reject"));ja(n);return a.proxy}};var Ua=function e(t,r,n,a){if(t.state===Ga){t.state=r;t[n]=a;ja(t)}return t};var ja=function e(t){if(t.state===Ya)Ha(t,"onFulfilled",t.fulfillValue);else if(t.state===Xa)Ha(t,"onRejected",t.rejectReason)};var Ha=function e(t,r,n){if(t[r].length===0)return;var a=t[r];t[r]=[];var i=function e(){for(var t=0;t0}}},clearQueue:function e(){return function e(){var t=this;var r=t.length!==undefined;var n=r?t:[t];var a=this._private.cy||this;if(!a.styleEnabled()){return this}for(var i=0;i-1}var fo=vo;function ho(e,t){var r=this.__data__,n=ao(r,e);if(n<0){++this.size;r.push([e,t])}else{r[n][1]=t}return this}var po=ho;function go(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t-1&&e%1==0&&e0){this.spawn(a).updateStyle().emit("class")}return r},addClass:function e(t){return this.toggleClass(t,true)},hasClass:function e(t){var r=this[0];return r!=null&&r._private.classes.has(t)},toggleClass:function e(t,r){if(!w(t)){t=t.match(/\S+/g)||[]}var n=this;var a=r===undefined;var i=[];for(var o=0,s=n.length;o0){this.spawn(i).updateStyle().emit("class")}return n},removeClass:function e(t){return this.toggleClass(t,false)},flashClass:function e(t,r){var n=this;if(r==null){r=250}else if(r===0){return n}n.addClass(t);setTimeout((function(){n.removeClass(t)}),r);return n}};Ms.className=Ms.classNames=Ms.classes;var Ps={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:'"(?:\\\\"|[^"])*"'+"|"+"'(?:\\\\'|[^'])*'",number:V,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Ps.variable="(?:[\\w-.]|(?:\\\\"+Ps.metaChar+"))+";Ps.className="(?:[\\w-]|(?:\\\\"+Ps.metaChar+"))+";Ps.value=Ps.string+"|"+Ps.number;Ps.id=Ps.variable;(function(){var e,t,r;e=Ps.comparatorOp.split("|");for(r=0;r=0){continue}if(t==="="){continue}Ps.comparatorOp+="|\\!"+t}})();var Rs=function e(){return{checks:[]}};var Bs={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20};var Fs=[{selector:":selected",matches:function e(t){return t.selected()}},{selector:":unselected",matches:function e(t){return!t.selected()}},{selector:":selectable",matches:function e(t){return t.selectable()}},{selector:":unselectable",matches:function e(t){return!t.selectable()}},{selector:":locked",matches:function e(t){return t.locked()}},{selector:":unlocked",matches:function e(t){return!t.locked()}},{selector:":visible",matches:function e(t){return t.visible()}},{selector:":hidden",matches:function e(t){return!t.visible()}},{selector:":transparent",matches:function e(t){return t.transparent()}},{selector:":grabbed",matches:function e(t){return t.grabbed()}},{selector:":free",matches:function e(t){return!t.grabbed()}},{selector:":removed",matches:function e(t){return t.removed()}},{selector:":inside",matches:function e(t){return!t.removed()}},{selector:":grabbable",matches:function e(t){return t.grabbable()}},{selector:":ungrabbable",matches:function e(t){return!t.grabbable()}},{selector:":animated",matches:function e(t){return t.animated()}},{selector:":unanimated",matches:function e(t){return!t.animated()}},{selector:":parent",matches:function e(t){return t.isParent()}},{selector:":childless",matches:function e(t){return t.isChildless()}},{selector:":child",matches:function e(t){return t.isChild()}},{selector:":orphan",matches:function e(t){return t.isOrphan()}},{selector:":nonorphan",matches:function e(t){return t.isChild()}},{selector:":compound",matches:function e(t){if(t.isNode()){return t.isParent()}else{return t.source().isParent()||t.target().isParent()}}},{selector:":loop",matches:function e(t){return t.isLoop()}},{selector:":simple",matches:function e(t){return t.isSimple()}},{selector:":active",matches:function e(t){return t.active()}},{selector:":inactive",matches:function e(t){return!t.active()}},{selector:":backgrounding",matches:function e(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function e(t){return!t.backgrounding()}}].sort((function(e,t){return Z(e.selector,t.selector)}));var zs=function(){var e={};var t;for(var r=0;r0&&c.edgeCount>0){kt("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector");return false}if(c.edgeCount>1){kt("The selector `"+t+"` is invalid because it uses multiple edge selectors");return false}else if(c.edgeCount===1){kt("The selector `"+t+"` 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 true};var Ws=function e(){if(this.toStringCache!=null){return this.toStringCache}var t=function e(t){if(t==null){return""}else{return t}};var r=function e(r){if(b(r)){return'"'+r+'"'}else{return t(r)}};var n=function e(t){return" "+t+" "};var a=function e(a,o){var s=a.type,l=a.value;switch(s){case Bs.GROUP:{var u=t(l);return u.substring(0,u.length-1)}case Bs.DATA_COMPARE:{var c=a.field,v=a.operator;return"["+c+n(t(v))+r(l)+"]"}case Bs.DATA_BOOL:{var f=a.operator,h=a.field;return"["+t(f)+h+"]"}case Bs.DATA_EXIST:{var d=a.field;return"["+d+"]"}case Bs.META_COMPARE:{var p=a.operator,g=a.field;return"[["+g+n(t(p))+r(l)+"]]"}case Bs.STATE:{return l}case Bs.ID:{return"#"+l}case Bs.CLASS:{return"."+l}case Bs.PARENT:case Bs.CHILD:{return i(a.parent,o)+n(">")+i(a.child,o)}case Bs.ANCESTOR:case Bs.DESCENDANT:{return i(a.ancestor,o)+" "+i(a.descendant,o)}case Bs.COMPOUND_SPLIT:{var y=i(a.left,o);var m=i(a.subject,o);var b=i(a.right,o);return y+(y.length>0?" ":"")+m+b}case Bs.TRUE:{return""}}};var i=function e(t,r){return t.checks.reduce((function(e,n,i){return e+(r===t&&i===0?"$":"")+a(n,r)}),"")};var o="";for(var s=0;s1&&s=0){r=r.replace("!","");v=true}if(r.indexOf("@")>=0){r=r.replace("@","");c=true}if(i||s||c){l=!i&&!o?"":""+t;u=""+n}if(c){t=l=l.toLowerCase();n=u=u.toLowerCase()}switch(r){case"*=":a=l.indexOf(u)>=0;break;case"$=":a=l.indexOf(u,l.length-u.length)>=0;break;case"^=":a=l.indexOf(u)===0;break;case"=":a=t===n;break;case">":f=true;a=t>n;break;case">=":f=true;a=t>=n;break;case"<":f=true;a=t0){var c=a.shift();t(c);i.add(c.id());if(s){n(a,i,c)}}return e}function fl(e,t,r){if(r.isParent()){var n=r._private.children;for(var a=0;a1&&arguments[1]!==undefined?arguments[1]:true;return vl(this,e,t,fl)};function hl(e,t,r){if(r.isChild()){var n=r._private.parent;if(!t.has(n.id())){e.push(n)}}}cl.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;return vl(this,e,t,hl)};function dl(e,t,r){hl(e,t,r);fl(e,t,r)}cl.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;return vl(this,e,t,dl)};cl.ancestors=cl.parents;var pl,gl;pl=gl={data:ks.data({field:"data",bindingEvent:"data",allowBinding:true,allowSetting:true,settingEvent:"data",settingTriggersEvent:true,triggerFnName:"trigger",allowGetting:true,immutableKeys:{id:true,source:true,target:true,parent:true},updateStyle:true}),removeData:ks.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:true,immutableKeys:{id:true,source:true,target:true,parent:true},updateStyle:true}),scratch:ks.data({field:"scratch",bindingEvent:"scratch",allowBinding:true,allowSetting:true,settingEvent:"scratch",settingTriggersEvent:true,triggerFnName:"trigger",allowGetting:true,updateStyle:true}),removeScratch:ks.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:true,updateStyle:true}),rscratch:ks.data({field:"rscratch",allowBinding:false,allowSetting:true,settingTriggersEvent:false,allowGetting:true}),removeRscratch:ks.removeData({field:"rscratch",triggerEvent:false}),id:function e(){var t=this[0];if(t){return t._private.data.id}}};pl.attr=pl.data;pl.removeAttr=pl.removeData;var yl=gl;var ml={};function bl(e){return function(t){var r=this;if(t===undefined){t=true}if(r.length===0){return}if(r.isNode()&&!r.removed()){var n=0;var a=r[0];var i=a._private.edges;for(var o=0;ot})),minIndegree:xl("indegree",(function(e,t){return et})),minOutdegree:xl("outdegree",(function(e,t){return et}))});Q(ml,{totalDegree:function e(t){var r=0;var n=this.nodes();for(var a=0;a0;var f=v;if(v){c=c[0]}var h=f?c.position():{x:0,y:0};if(r!==undefined){u.position(t,r+h[t])}else if(i!==undefined){u.position({x:i.x+h.x,y:i.y+h.y})}}}else{var d=n.position();var p=s?n.parent():null;var g=p&&p.length>0;var y=g;if(g){p=p[0]}var m=y?p.position():{x:0,y:0};i={x:d.x-m.x,y:d.y-m.y};if(t===undefined){return i}else{return i[t]}}}else if(!o){return undefined}return this}};wl.modelPosition=wl.point=wl.position;wl.modelPositions=wl.points=wl.positions;wl.renderedPoint=wl.renderedPosition;wl.relativePoint=wl.relativePosition;var Dl=El;var Cl,Nl;Cl=Nl={};Nl.renderedBoundingBox=function(e){var t=this.boundingBox(e);var r=this.cy();var n=r.zoom();var a=r.pan();var i=t.x1*n+a.x;var o=t.x2*n+a.x;var s=t.y1*n+a.y;var l=t.y2*n+a.y;return{x1:i,x2:o,y1:s,y2:l,w:o-i,h:l-s}};Nl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()){return this}this.forEachUp((function(t){if(t.isParent()){var r=t._private;r.compoundBoundsClean=false;r.bbCache=null;if(!e){t.emitAndNotify("bounds")}}}));return this};Nl.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()){return this}if(!e&&t.batching()){return this}function r(e){if(!e.isParent()){return}var t=e._private;var r=e.children();var n=e.pstyle("compound-sizing-wrt-labels").value==="include";var a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}};var i=r.boundingBox({includeLabels:n,includeOverlays:false,useCache:false});var o=t.position;if(i.w===0||i.h===0){i={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue};i.x1=o.x-i.w/2;i.x2=o.x+i.w/2;i.y1=o.y-i.h/2;i.y2=o.y+i.h/2}function s(e,t,r){var n=0;var a=0;var i=t+r;if(e>0&&i>0){n=t/i*e;a=r/i*e}return{biasDiff:n,biasComplementDiff:a}}function l(e,t,r,n){if(r.units==="%"){switch(n){case"width":return e>0?r.pfValue*e:0;case"height":return t>0?r.pfValue*t:0;case"average":return e>0&&t>0?r.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?r.pfValue*t:r.pfValue*e:0;case"max":return e>0&&t>0?e>t?r.pfValue*e:r.pfValue*t:0;default:return 0}}else if(r.units==="px"){return r.pfValue}else{return 0}}var u=a.width.left.value;if(a.width.left.units==="px"&&a.width.val>0){u=u*100/a.width.val}var c=a.width.right.value;if(a.width.right.units==="px"&&a.width.val>0){c=c*100/a.width.val}var v=a.height.top.value;if(a.height.top.units==="px"&&a.height.val>0){v=v*100/a.height.val}var f=a.height.bottom.value;if(a.height.bottom.units==="px"&&a.height.val>0){f=f*100/a.height.val}var h=s(a.width.val-i.w,u,c);var d=h.biasDiff;var p=h.biasComplementDiff;var g=s(a.height.val-i.h,v,f);var y=g.biasDiff;var m=g.biasComplementDiff;t.autoPadding=l(i.w,i.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value);t.autoWidth=Math.max(i.w,a.width.val);o.x=(-d+i.x1+i.x2+p)/2;t.autoHeight=Math.max(i.h,a.height.val);o.y=(-y+i.y1+i.y2+m)/2}for(var n=0;nt.x2?a:t.x2;t.y1=nt.y2?i:t.y2;t.w=t.x2-t.x1;t.h=t.y2-t.y1};var Il=function e(t,r){if(r==null){return t}return Ll(t,r.x1,r.y1,r.x2,r.y2)};var Sl=function e(t,r,n){return Vt(t,r,n)};var kl=function e(t,r,n){if(r.cy().headless()){return}var a=r._private;var i=a.rstyle;var o=i.arrowWidth/2;var s=r.pstyle(n+"-arrow-shape").value;var l;var u;if(s!=="none"){if(n==="source"){l=i.srcX;u=i.srcY}else if(n==="target"){l=i.tgtX;u=i.tgtY}else{l=i.midX;u=i.midY}var c=a.arrowBounds=a.arrowBounds||{};var v=c[n]=c[n]||{};v.x1=l-o;v.y1=u-o;v.x2=l+o;v.y2=u+o;v.w=v.x2-v.x1;v.h=v.y2-v.y1;Fr(v,1);Ll(t,v.x1,v.y1,v.x2,v.y2)}};var Ol=function e(t,r,n){if(r.cy().headless()){return}var a;if(n){a=n+"-"}else{a=""}var i=r._private;var o=i.rstyle;var s=r.pstyle(a+"label").strValue;if(s){var l=r.pstyle("text-halign");var u=r.pstyle("text-valign");var c=Sl(o,"labelWidth",n);var v=Sl(o,"labelHeight",n);var f=Sl(o,"labelX",n);var h=Sl(o,"labelY",n);var d=r.pstyle(a+"text-margin-x").pfValue;var p=r.pstyle(a+"text-margin-y").pfValue;var g=r.isEdge();var y=r.pstyle(a+"text-rotation");var m=r.pstyle("text-outline-width").pfValue;var b=r.pstyle("text-border-width").pfValue;var x=b/2;var w=r.pstyle("text-background-padding").pfValue;var E=2;var T=v;var _=c;var D=_/2;var C=T/2;var N,A,L,I;if(g){N=f-D;A=f+D;L=h-C;I=h+C}else{switch(l.value){case"left":N=f-_;A=f;break;case"center":N=f-D;A=f+D;break;case"right":N=f;A=f+_;break}switch(u.value){case"top":L=h-T;I=h;break;case"center":L=h-C;I=h+C;break;case"bottom":L=h;I=h+T;break}}N+=d-Math.max(m,x)-w-E;A+=d+Math.max(m,x)+w+E;L+=p-Math.max(m,x)-w-E;I+=p+Math.max(m,x)+w+E;var S=n||"main";var k=i.labelBounds;var O=k[S]=k[S]||{};O.x1=N;O.y1=L;O.x2=A;O.y2=I;O.w=A-N;O.h=I-L;var M=g&&y.strValue==="autorotate";var P=y.pfValue!=null&&y.pfValue!==0;if(M||P){var R=M?Sl(i.rstyle,"labelAngle",n):y.pfValue;var B=Math.cos(R);var F=Math.sin(R);var z=(N+A)/2;var G=(L+I)/2;if(!g){switch(l.value){case"left":z=A;break;case"right":z=N;break}switch(u.value){case"top":G=I;break;case"bottom":G=L;break}}var Y=function e(t,r){t=t-z;r=r-G;return{x:t*B-r*F+z,y:t*F+r*B+G}};var X=Y(N,L);var V=Y(N,I);var U=Y(A,L);var j=Y(A,I);N=Math.min(X.x,V.x,U.x,j.x);A=Math.max(X.x,V.x,U.x,j.x);L=Math.min(X.y,V.y,U.y,j.y);I=Math.max(X.y,V.y,U.y,j.y)}var H=S+"Rot";var q=k[H]=k[H]||{};q.x1=N;q.y1=L;q.x2=A;q.y2=I;q.w=A-N;q.h=I-L;Ll(t,N,L,A,I);Ll(i.labelBounds.all,N,L,A,I)}return t};var Ml=function e(t,r){var n=t._private.cy;var a=n.styleEnabled();var i=n.headless();var o=Or();var s=t._private;var l=t.isNode();var u=t.isEdge();var c,v,f,h;var d,p;var g=s.rstyle;var y=l&&a?t.pstyle("bounds-expansion").pfValue:[0];var m=function e(t){return t.pstyle("display").value!=="none"};var b=!a||m(t)&&(!u||m(t.source())&&m(t.target()));if(b){var x=0;var w=0;if(a&&r.includeOverlays){x=t.pstyle("overlay-opacity").value;if(x!==0){w=t.pstyle("overlay-padding").value}}var E=0;var T=0;if(a&&r.includeUnderlays){E=t.pstyle("underlay-opacity").value;if(E!==0){T=t.pstyle("underlay-padding").value}}var _=Math.max(w,T);var D=0;var C=0;if(a){D=t.pstyle("width").pfValue;C=D/2}if(l&&r.includeNodes){var N=t.position();d=N.x;p=N.y;var A=t.outerWidth();var L=A/2;var I=t.outerHeight();var S=I/2;c=d-L;v=d+L;f=p-S;h=p+S;Ll(o,c,f,v,h)}else if(u&&r.includeEdges){if(a&&!i){var k=t.pstyle("curve-style").strValue;c=Math.min(g.srcX,g.midX,g.tgtX);v=Math.max(g.srcX,g.midX,g.tgtX);f=Math.min(g.srcY,g.midY,g.tgtY);h=Math.max(g.srcY,g.midY,g.tgtY);c-=C;v+=C;f-=C;h+=C;Ll(o,c,f,v,h);if(k==="haystack"){var O=g.haystackPts;if(O&&O.length===2){c=O[0].x;f=O[0].y;v=O[1].x;h=O[1].y;if(c>v){var M=c;c=v;v=M}if(f>h){var P=f;f=h;h=P}Ll(o,c-C,f-C,v+C,h+C)}}else if(k==="bezier"||k==="unbundled-bezier"||k==="segments"||k==="taxi"){var R;switch(k){case"bezier":case"unbundled-bezier":R=g.bezierPts;break;case"segments":case"taxi":R=g.linePts;break}if(R!=null){for(var B=0;Bv){var V=c;c=v;v=V}if(f>h){var U=f;f=h;h=U}c-=C;v+=C;f-=C;h+=C;Ll(o,c,f,v,h)}}if(a&&r.includeEdges&&u){kl(o,t,"mid-source");kl(o,t,"mid-target");kl(o,t,"source");kl(o,t,"target")}if(a){var j=t.pstyle("ghost").value==="yes";if(j){var H=t.pstyle("ghost-offset-x").pfValue;var q=t.pstyle("ghost-offset-y").pfValue;Ll(o,o.x1+H,o.y1+q,o.x2+H,o.y2+q)}}var W=s.bodyBounds=s.bodyBounds||{};Gr(W,o);zr(W,y);Fr(W,1);if(a){c=o.x1;v=o.x2;f=o.y1;h=o.y2;Ll(o,c-_,f-_,v+_,h+_)}var $=s.overlayBounds=s.overlayBounds||{};Gr($,o);zr($,y);Fr($,1);var K=s.labelBounds=s.labelBounds||{};if(K.all!=null){Pr(K.all)}else{K.all=Or()}if(a&&r.includeLabels){if(r.includeMainLabels){Ol(o,t,null)}if(u){if(r.includeSourceLabels){Ol(o,t,"source")}if(r.includeTargetLabels){Ol(o,t,"target")}}}}o.x1=Al(o.x1);o.y1=Al(o.y1);o.x2=Al(o.x2);o.y2=Al(o.y2);o.w=Al(o.x2-o.x1);o.h=Al(o.y2-o.y1);if(o.w>0&&o.h>0&&b){zr(o,y);Fr(o,1)}return o};var Pl=function e(t){var r=0;var n=function e(t){return(t?1:0)<0&&arguments[0]!==undefined?arguments[0]:vu;var t=arguments.length>1?arguments[1]:undefined;for(var r=0;r=0;s--){o(s)}return this};hu.removeAllListeners=function(){return this.removeListener("*")};hu.emit=hu.trigger=function(e,t,r){var n=this.listeners;var a=n.length;this.emitting++;if(!w(t)){t=[t]}gu(this,(function(e,i){if(r!=null){n=[{event:i.event,type:i.type,namespace:i.namespace,callback:r}];a=n.length}var o=function r(a){var o=n[a];if(o.type===i.type&&(!o.namespace||o.namespace===i.namespace||o.namespace===lu)&&e.eventMatches(e.context,o,i)){var s=[i];if(t!=null){Xt(s,t)}e.beforeEmit(e.context,o,i);if(o.conf&&o.conf.one){e.listeners=e.listeners.filter((function(e){return e!==o}))}var l=e.callbackContext(e.context,o,i);var u=o.callback.apply(l,s);e.afterEmit(e.context,o,i);if(u===false){i.stopPropagation();i.preventDefault()}}};for(var s=0;s1&&!o){var s=this.length-1;var l=this[s];var u=l._private.data.id;this[s]=undefined;this[t]=l;i.set(u,{ele:l,index:t})}this.length--;return this},unmergeOne:function e(t){t=t[0];var r=this._private;var n=t._private.data.id;var a=r.map;var i=a.get(n);if(!i){return this}var o=i.index;this.unmergeAt(o);return this},unmerge:function e(t){var r=this._private.cy;if(!t){return this}if(t&&b(t)){var n=t;t=r.mutableElements().filter(n)}for(var a=0;a=0;r--){var n=this[r];if(t(n)){this.unmergeAt(r)}}return this},map:function e(t,r){var n=[];var a=this;for(var i=0;ie){e=s;n=o}}return{value:e,ele:n}},min:function e(t,r){var e=Infinity;var n;var a=this;for(var i=0;i=0&&i1&&arguments[1]!==undefined?arguments[1]:true;var n=this[0];var a=n.cy();if(!a.styleEnabled()){return}if(n){this.cleanStyle();var i=n._private.style[t];if(i!=null){return i}else if(r){return a.style().getDefaultProperty(t)}else{return null}}},numericStyle:function e(t){var r=this[0];if(!r.cy().styleEnabled()){return}if(r){var n=r.pstyle(t);return n.pfValue!==undefined?n.pfValue:n.value}},numericStyleUnits:function e(t){var r=this[0];if(!r.cy().styleEnabled()){return}if(r){return r.pstyle(t).units}},renderedStyle:function e(t){var r=this.cy();if(!r.styleEnabled()){return this}var n=this[0];if(n){return r.style().getRenderedStyle(n,t)}},style:function e(t,r){var n=this.cy();if(!n.styleEnabled()){return this}var a=false;var e=n.style();if(E(t)){var i=t;e.applyBypass(this,i,a);this.emitAndNotify("style")}else if(b(t)){if(r===undefined){var o=this[0];if(o){return e.getStylePropertyValue(o,t)}else{return}}else{e.applyBypass(this,t,r,a);this.emitAndNotify("style")}}else if(t===undefined){var s=this[0];if(s){return e.getRawStyle(s)}else{return}}return this},removeStyle:function e(t){var r=this.cy();if(!r.styleEnabled()){return this}var n=false;var a=r.style();var i=this;if(t===undefined){for(var o=0;o0){t.push(c[0])}t.push(s[0])}}return this.spawn(t,true).filter(e)}),"neighborhood"),closedNeighborhood:function e(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function e(t){return this.neighborhood(t)}});Xu.neighbourhood=Xu.neighborhood;Xu.closedNeighbourhood=Xu.closedNeighborhood;Xu.openNeighbourhood=Xu.openNeighborhood;Q(Xu,{source:ul((function e(t){var r=this[0];var n;if(r){n=r._private.source||r.cy().collection()}return n&&t?n.filter(t):n}),"source"),target:ul((function e(t){var r=this[0];var n;if(r){n=r._private.target||r.cy().collection()}return n&&t?n.filter(t):n}),"target"),sources:Hu({attr:"source"}),targets:Hu({attr:"target"})});function Hu(e){return function t(r){var n=[];for(var a=0;a0);return e},component:function e(){var t=this[0];return t.cy().mutableElements().components(t)[0]}});Xu.componentsOf=Xu.components;var $u=function e(t,r){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var a=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(t===undefined){It("A collection must have a reference to the core");return}var i=new Ht;var o=false;if(!r){r=[]}else if(r.length>0&&E(r[0])&&!A(r[0])){o=true;var s=[];var l=new $t;for(var u=0,c=r.length;u0&&arguments[0]!==undefined?arguments[0]:true;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=this;var n=r.cy();var a=n._private;var i=[];var o=[];var s;for(var l=0,u=r.length;l0){var F=s.length===r.length?r:new $u(n,s);for(var z=0;z0&&arguments[0]!==undefined?arguments[0]:true;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var r=this;var n=[];var a={};var i=r._private.cy;function o(e){var t=e._private.edges;for(var r=0;r0){if(e){N.emitAndNotify("remove")}else if(t){N.emit("remove")}}for(var A=0;A0){a=l}else{n=l}}while(Math.abs(i)>o&&++u=i){return m(t,c)}else if(v===0){return c}else{return x(t,n,n+u)}}var E=false;function T(){E=true;if(e!==t||r!==n){b()}}var _=function a(i){if(!E){T()}if(e===t&&r===n){return i}if(i===0){return 0}if(i===1){return 1}return g(w(i),t,n)};_.getControlPoints=function(){return[{x:e,y:t},{x:r,y:n}]};var D="generateBezier("+[e,t,r,n]+")";_.toString=function(){return D};return _}var Ju=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,r,n){var a={x:t.x+n.dx*r,v:t.v+n.dv*r,tension:t.tension,friction:t.friction};return{dx:a.v,dv:e(a)}}function r(r,n){var a={dx:r.v,dv:e(r)},i=t(r,n*.5,a),o=t(r,n*.5,i),s=t(r,n,o),l=1/6*(a.dx+2*(i.dx+o.dx)+s.dx),u=1/6*(a.dv+2*(i.dv+o.dv)+s.dv);r.x=r.x+l*n;r.v=r.v+u*n;return r}return function e(t,n,a){var i={x:-1,v:0,tension:null,friction:null},o=[0],s=0,l=1/1e4,u=16/1e3,c,v,f;t=parseFloat(t)||500;n=parseFloat(n)||20;a=a||null;i.tension=t;i.friction=n;c=a!==null;if(c){s=e(t,n);v=s/a*u}else{v=u}for(;;){f=r(f||i,v);o.push(1+f.x);s+=16;if(!(Math.abs(f.x)>l&&Math.abs(f.v)>l)){break}}return!c?s:function(e){return o[e*(o.length-1)|0]}}}();var ec=function e(t,r,n,a){var i=Qu(t,r,n,a);return function(e,t,r){return e+(t-e)*i(r)}};var tc={linear:function e(t,r,n){return t+(r-t)*n},ease:ec(.25,.1,.25,1),"ease-in":ec(.42,0,1,1),"ease-out":ec(0,0,.58,1),"ease-in-out":ec(.42,0,.58,1),"ease-in-sine":ec(.47,0,.745,.715),"ease-out-sine":ec(.39,.575,.565,1),"ease-in-out-sine":ec(.445,.05,.55,.95),"ease-in-quad":ec(.55,.085,.68,.53),"ease-out-quad":ec(.25,.46,.45,.94),"ease-in-out-quad":ec(.455,.03,.515,.955),"ease-in-cubic":ec(.55,.055,.675,.19),"ease-out-cubic":ec(.215,.61,.355,1),"ease-in-out-cubic":ec(.645,.045,.355,1),"ease-in-quart":ec(.895,.03,.685,.22),"ease-out-quart":ec(.165,.84,.44,1),"ease-in-out-quart":ec(.77,0,.175,1),"ease-in-quint":ec(.755,.05,.855,.06),"ease-out-quint":ec(.23,1,.32,1),"ease-in-out-quint":ec(.86,0,.07,1),"ease-in-expo":ec(.95,.05,.795,.035),"ease-out-expo":ec(.19,1,.22,1),"ease-in-out-expo":ec(1,0,0,1),"ease-in-circ":ec(.6,.04,.98,.335),"ease-out-circ":ec(.075,.82,.165,1),"ease-in-out-circ":ec(.785,.135,.15,.86),spring:function e(t,r,n){if(n===0){return tc.linear}var e=Ju(t,r,n);return function(t,r,n){return t+(r-t)*e(n)}},"cubic-bezier":ec};function rc(e,t,r,n,a){if(n===1){return r}if(t===r){return r}var i=a(t,r,n);if(e==null){return i}if(e.roundValue||e.color){i=Math.round(i)}if(e.min!==undefined){i=Math.max(i,e.min)}if(e.max!==undefined){i=Math.min(i,e.max)}return i}function nc(e,t){if(e.pfValue!=null||e.value!=null){if(e.pfValue!=null&&(t==null||t.type.units!=="%")){return e.pfValue}else{return e.value}}else{return e}}function ac(e,t,r,n,a){var i=a!=null?a.type:null;if(r<0){r=0}else if(r>1){r=1}var o=nc(e,a);var s=nc(t,a);if(_(o)&&_(s)){return rc(i,o,s,r,n)}else if(w(o)&&w(s)){var l=[];for(var u=0;u0){if(h==="spring"){d.push(o.duration)}o.easingImpl=tc[h].apply(null,d)}else{o.easingImpl=tc[h]}}}var p=o.easingImpl;var g;if(o.duration===0){g=1}else{g=(r-l)/o.duration}if(o.applying){g=o.progress}if(g<0){g=0}else if(g>1){g=1}if(o.delay==null){var y=o.startPosition;var m=o.position;if(m&&a&&!e.locked()){var x={};if(oc(y.x,m.x)){x.x=ac(y.x,m.x,g,p)}if(oc(y.y,m.y)){x.y=ac(y.y,m.y,g,p)}e.position(x)}var w=o.startPan;var E=o.pan;var T=i.pan;var _=E!=null&&n;if(_){if(oc(w.x,E.x)){T.x=ac(w.x,E.x,g,p)}if(oc(w.y,E.y)){T.y=ac(w.y,E.y,g,p)}e.emit("pan")}var D=o.startZoom;var C=o.zoom;var N=C!=null&&n;if(N){if(oc(D,C)){i.zoom=kr(i.minZoom,ac(D,C,g,p),i.maxZoom)}e.emit("zoom")}if(_||N){e.emit("viewport")}var A=o.style;if(A&&A.length>0&&a){for(var L=0;L=0;r--){var n=t[r];n()}t.splice(0,t.length)};for(var c=i.length-1;c>=0;c--){var v=i[c];var f=v._private;if(f.stopped){i.splice(c,1);f.hooked=false;f.playing=false;f.started=false;u(f.frames);continue}if(!f.playing&&!f.applying){continue}if(f.playing&&f.applying){f.applying=false}if(!f.started){sc(t,v,e)}ic(t,v,e,r);if(f.applying){f.applying=false}u(f.frames);if(f.step!=null){f.step(e)}if(v.completed()){i.splice(c,1);f.hooked=false;f.playing=false;f.started=false;u(f.completes)}s=true}if(!r&&i.length===0&&o.length===0){n.push(t)}return s}var i=false;for(var o=0;o0){t.notify("draw",r)}else{t.notify("draw")}}r.unmerge(n);t.emit("step")}var uc={animate:ks.animate(),animation:ks.animation(),animated:ks.animated(),clearQueue:ks.clearQueue(),delay:ks.delay(),delayAnimation:ks.delayAnimation(),stop:ks.stop(),addToAnimationPool:function e(t){var r=this;if(!r.styleEnabled()){return}r._private.aniEles.merge(t)},stopAnimationLoop:function e(){this._private.animationsRunning=false},startAnimationLoop:function e(){var t=this;t._private.animationsRunning=true;if(!t.styleEnabled()){return}function r(){if(!t._private.animationsRunning){return}st((function e(n){lc(n,t);r()}))}var n=t.renderer();if(n&&n.beforeRender){n.beforeRender((function e(r,n){lc(n,t)}),n.beforeRenderPriorities.animations)}else{r()}}};var cc={qualifierCompare:function e(t,r){if(t==null||r==null){return t==null&&r==null}else{return t.sameText(r)}},eventMatches:function e(t,r,n){var a=r.qualifier;if(a!=null){return t!==n.target&&A(n.target)&&a.matches(n.target)}return true},addEventFields:function e(t,r){r.cy=t;r.target=t},callbackContext:function e(t,r,n){return r.qualifier!=null?n.target:t}};var vc=function e(t){if(b(t)){return new ol(t)}else{return t}};var fc={createEmitter:function e(){var t=this._private;if(!t.emitter){t.emitter=new fu(cc,this)}return this},emitter:function e(){return this._private.emitter},on:function e(t,r,n){this.emitter().on(t,vc(r),n);return this},removeListener:function e(t,r,n){this.emitter().removeListener(t,vc(r),n);return this},removeAllListeners:function e(){this.emitter().removeAllListeners();return this},one:function e(t,r,n){this.emitter().one(t,vc(r),n);return this},once:function e(t,r,n){this.emitter().one(t,vc(r),n);return this},emit:function e(t,r){this.emitter().emit(t,r);return this},emitAndNotify:function e(t,r){this.emit(t);this.notify(t,r);return this}};ks.eventAliasesOn(fc);var hc={png:function e(t){var r=this._private.renderer;t=t||{};return r.png(t)},jpg:function e(t){var r=this._private.renderer;t=t||{};t.bg=t.bg||"#fff";return r.jpg(t)}};hc.jpeg=hc.jpg;var dc={layout:function e(t){var r=this;if(t==null){It("Layout options must be specified to make a layout");return}if(t.name==null){It("A `name` must be specified to make a layout");return}var n=t.name;var a=r.extension("layout",n);if(a==null){It("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;if(b(t.eles)){i=r.$(t.eles)}else{i=t.eles!=null?t.eles:r.$()}var e=new a(Q({},t,{cy:r,eles:i}));return e}};dc.createLayout=dc.makeLayout=dc.layout;var pc={notify:function e(t,r){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var a=n.batchNotifications[t]=n.batchNotifications[t]||this.collection();if(r!=null){a.merge(r)}return}if(!n.notificationsEnabled){return}var i=this.renderer();if(this.destroyed()||!i){return}i.notify(t,r)},notifications:function e(t){var r=this._private;if(t===undefined){return r.notificationsEnabled}else{r.notificationsEnabled=t?true:false}return this},noNotifications:function e(t){this.notifications(false);t();this.notifications(true)},batching:function e(){return this._private.batchCount>0},startBatch:function e(){var t=this._private;if(t.batchCount==null){t.batchCount=0}if(t.batchCount===0){t.batchStyleEles=this.collection();t.batchNotifications={}}t.batchCount++;return this},endBatch:function e(){var t=this._private;if(t.batchCount===0){return this}t.batchCount--;if(t.batchCount===0){t.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(t.batchNotifications).forEach((function(e){var n=t.batchNotifications[e];if(n.empty()){r.notify(e)}else{r.notify(e,n)}}))}return this},batch:function e(t){this.startBatch();t();this.endBatch();return this},batchData:function e(t){var r=this;return this.batch((function(){var e=Object.keys(t);for(var n=0;n0){r.removeChild(r.childNodes[0])}}t._private.renderer=null;t.mutableElements().forEach((function(e){var t=e._private;t.rscratch={};t.rstyle={};t.animation.current=[];t.animation.queue=[]}))},onRender:function e(t){return this.on("render",t)},offRender:function e(t){return this.off("render",t)}};yc.invalidateDimensions=yc.resize;var mc={collection:function e(t,r){if(b(t)){return this.$(t)}else if(N(t)){return t.collection()}else if(w(t)){if(!r){r={}}return new $u(this,t,r.unique,r.removed)}return new $u(this)},nodes:function e(t){var e=this.$((function(e){return e.isNode()}));if(t){return e.filter(t)}return e},edges:function e(t){var e=this.$((function(e){return e.isEdge()}));if(t){return e.filter(t)}return e},$:function e(t){var r=this._private.elements;if(t){return r.filter(t)}else{return r.spawnSelf()}},mutableElements:function e(){return this._private.elements}};mc.elements=mc.filter=mc.$;var bc={};var xc="t";var wc="f";bc.apply=function(e){var t=this;var r=t._private;var n=r.cy;var a=n.collection();for(var i=0;i0;if(f||v&&h){var d=void 0;if(f&&h){d=u.properties}else if(f){d=u.properties}else if(h){d=u.mappedProperties}for(var p=0;p1){x=1}if(s.color){var E=n.valueMin[0];var T=n.valueMax[0];var D=n.valueMin[1];var C=n.valueMax[1];var N=n.valueMin[2];var A=n.valueMax[2];var L=n.valueMin[3]==null?1:n.valueMin[3];var I=n.valueMax[3]==null?1:n.valueMax[3];var S=[Math.round(E+(T-E)*x),Math.round(D+(C-D)*x),Math.round(N+(A-N)*x),Math.round(L+(I-L)*x)];i={bypass:n.bypass,name:n.name,value:S,strValue:"rgb("+S[0]+", "+S[1]+", "+S[2]+")"}}else if(s.number){var k=n.valueMin+(n.valueMax-n.valueMin)*x;i=this.parse(n.name,k,n.bypass,f)}else{return false}if(!i){p();return false}i.mapping=n;n=i;break}case o.data:{var O=n.field.split(".");var M=v.data;for(var P=0;P0&&i>0){var s={};var l=false;for(var u=0;u0){e.delayAnimation(o).play().promise().then(t)}else{t()}})).then((function(){return e.animation({style:s,duration:i,easing:e.pstyle("transition-timing-function").value,queue:false}).play().promise()})).then((function(){r.removeBypasses(e,a);e.emitAndNotify("style");n.transitioning=false}))}else if(n.transitioning){this.removeBypasses(e,a);e.emitAndNotify("style");n.transitioning=false}};bc.checkTrigger=function(e,t,r,n,a,i){var o=this.properties[t];var s=a(o);if(s!=null&&s(r,n)){i(o)}};bc.checkZOrderTrigger=function(e,t,r,n){var a=this;this.checkTrigger(e,t,r,n,(function(e){return e.triggersZOrder}),(function(){a._private.cy.notify("zorder",e)}))};bc.checkBoundsTrigger=function(e,t,r,n){this.checkTrigger(e,t,r,n,(function(e){return e.triggersBounds}),(function(a){e.dirtyCompoundBoundsCache();e.dirtyBoundingBoxCache();if(a.triggersBoundsOfParallelBeziers&&(t==="curve-style"&&(r==="bezier"||n==="bezier")||t==="display"&&(r==="none"||n==="none"))){e.parallelEdges().forEach((function(e){if(e.isBundledBezier()){e.dirtyBoundingBoxCache()}}))}}))};bc.checkTriggers=function(e,t,r,n){e.dirtyStyleCache();this.checkZOrderTrigger(e,t,r,n);this.checkBoundsTrigger(e,t,r,n)};var Ec={};Ec.applyBypass=function(e,t,r,n){var a=this;var i=[];var o=true;if(t==="*"||t==="**"){if(r!==undefined){for(var s=0;sa.length){n=n.substr(a.length)}else{n=""}}function l(){if(i.length>o.length){i=i.substr(o.length)}else{i=""}}for(;;){var u=n.match(/^\s*$/);if(u){break}var c=n.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){kt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+n);break}a=c[0];var v=c[1];if(v!=="core"){var f=new ol(v);if(f.invalid){kt("Skipping parsing of block: Invalid selector found in string stylesheet: "+v);s();continue}}var h=c[2];var d=false;i=h;var p=[];for(;;){var g=i.match(/^\s*$/);if(g){break}var y=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!y){kt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h);d=true;break}o=y[0];var m=y[1];var b=y[2];var x=t.properties[m];if(!x){kt("Skipping property: Invalid property name in: "+o);l();continue}var w=r.parse(m,b);if(!w){kt("Skipping property: Invalid property definition in: "+o);l();continue}p.push({name:m,val:b});l()}if(d){s();break}r.selector(v);for(var E=0;E=7&&t[0]==="d"&&(c=new RegExp(s.data.regex).exec(t))){if(r){return false}var f=s.data;return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],bypass:r}}else if(t.length>=10&&t[0]==="m"&&(v=new RegExp(s.mapData.regex).exec(t))){if(r){return false}if(u.multiple){return false}var h=s.mapData;if(!(u.color||u.number)){return false}var d=this.parse(e,v[4]);if(!d||d.mapped){return false}var p=this.parse(e,v[5]);if(!p||p.mapped){return false}if(d.pfValue===p.pfValue||d.strValue===p.strValue){kt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+d.strValue+"`");return this.parse(e,d.strValue)}else if(u.color){var g=d.value;var y=p.value;var m=g[0]===y[0]&&g[1]===y[1]&&g[2]===y[2]&&(g[3]===y[3]||(g[3]==null||g[3]===1)&&(y[3]==null||y[3]===1));if(m){return false}}return{name:e,value:v,strValue:""+t,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:d.value,valueMax:p.value,bypass:r}}if(u.multiple&&n!=="multiple"){var E;if(l){E=t.split(/\s+/)}else if(w(t)){E=t}else{E=[t]}if(u.evenMultiple&&E.length%2!==0){return null}var T=[];var _=[];var C=[];var N="";var A=false;for(var L=0;L0?" ":"")+I.strValue}if(u.validate&&!u.validate(T,_)){return null}if(u.singleEnum&&A){if(T.length===1&&b(T[0])){return{name:e,value:T[0],strValue:T[0],bypass:r}}else{return null}}return{name:e,value:T,pfValue:C,strValue:N,bypass:r,units:_}}var S=function n(){for(var a=0;au.max||u.strictMax&&t===u.max)){return null}var R={name:e,value:t,strValue:""+t+(k?k:""),units:k,bypass:r};if(u.unitless||k!=="px"&&k!=="em"){R.pfValue=t}else{R.pfValue=k==="px"||!k?t:this.getEmSizeInPixels()*t}if(k==="ms"||k==="s"){R.pfValue=k==="ms"?t:1e3*t}if(k==="deg"||k==="rad"){R.pfValue=k==="rad"?t:Er(t)}if(k==="%"){R.pfValue=t/100}return R}else if(u.propList){var B=[];var F=""+t;if(F==="none");else{var G=F.split(/\s*,\s*|\s+/);for(var Y=0;Y0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0){l=Math.min((o-2*r)/n.w,(s-2*r)/n.h);l=l>this._private.maxZoom?this._private.maxZoom:l;l=l=n.minZoom){n.maxZoom=r}return this},minZoom:function e(t){if(t===undefined){return this._private.minZoom}else{return this.zoomRange({min:t})}},maxZoom:function e(t){if(t===undefined){return this._private.maxZoom}else{return this.zoomRange({max:t})}},getZoomedViewport:function e(t){var r=this._private;var n=r.pan;var a=r.zoom;var i;var o;var s=false;if(!r.zoomingEnabled){s=true}if(_(t)){o=t}else if(E(t)){o=t.level;if(t.position!=null){i=pr(t.position,a,n)}else if(t.renderedPosition!=null){i=t.renderedPosition}if(i!=null&&!r.panningEnabled){s=true}}o=o>r.maxZoom?r.maxZoom:o;o=or.maxZoom||!r.zoomingEnabled){o=true}else{r.zoom=l;i.push("zoom")}}if(a&&(!o||!t.cancelOnFailedZoom)&&r.panningEnabled){var u=t.pan;if(_(u.x)){r.pan.x=u.x;s=false}if(_(u.y)){r.pan.y=u.y;s=false}if(!s){i.push("pan")}}if(i.length>0){i.push("viewport");this.emit(i.join(" "));this.notify("viewport")}return this},center:function e(t){var r=this.getCenterPan(t);if(r){this._private.pan=r;this.emit("pan viewport");this.notify("viewport")}return this},getCenterPan:function e(t,r){if(!this._private.panningEnabled){return}if(b(t)){var n=t;t=this.mutableElements().filter(n)}else if(!N(t)){t=this.mutableElements()}if(t.length===0){return}var a=t.boundingBox();var i=this.width();var o=this.height();r=r===undefined?this._private.zoom:r;var s={x:(i-r*(a.x1+a.x2))/2,y:(o-r*(a.y1+a.y2))/2};return s},reset:function e(){if(!this._private.panningEnabled||!this._private.zoomingEnabled){return this}this.viewport({pan:{x:0,y:0},zoom:1});return this},invalidateSize:function e(){this._private.sizeCache=null},size:function e(){var t=this._private;var r=t.container;var n=this;return t.sizeCache=t.sizeCache||(r?function(){var e=n.window().getComputedStyle(r);var t=function t(r){return parseFloat(e.getPropertyValue(r))};return{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}}():{width:1,height:1})},width:function e(){return this.size().width},height:function e(){return this.size().height},extent:function e(){var t=this._private.pan;var r=this._private.zoom;var n=this.renderedExtent();var a={x1:(n.x1-t.x)/r,x2:(n.x2-t.x)/r,y1:(n.y1-t.y)/r,y2:(n.y2-t.y)/r};a.w=a.x2-a.x1;a.h=a.y2-a.y1;return a},renderedExtent:function e(){var t=this.width();var r=this.height();return{x1:0,y1:0,x2:t,y2:r,w:t,h:r}},multiClickDebounceTime:function e(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};Oc.centre=Oc.center;Oc.autolockNodes=Oc.autolock;Oc.autoungrabifyNodes=Oc.autoungrabify;var Mc={data:ks.data({field:"data",bindingEvent:"data",allowBinding:true,allowSetting:true,settingEvent:"data",settingTriggersEvent:true,triggerFnName:"trigger",allowGetting:true,updateStyle:true}),removeData:ks.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:true,updateStyle:true}),scratch:ks.data({field:"scratch",bindingEvent:"scratch",allowBinding:true,allowSetting:true,settingEvent:"scratch",settingTriggersEvent:true,triggerFnName:"trigger",allowGetting:true,updateStyle:true}),removeScratch:ks.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:true,updateStyle:true})};Mc.attr=Mc.data;Mc.removeAttr=Mc.removeData;var Pc=function e(t){var r=this;t=Q({},t);var n=t.container;if(n&&!C(n)&&C(n[0])){n=n[0]}var a=n?n._cyreg:null;a=a||{};if(a&&a.cy){a.cy.destroy();a={}}var i=a.readies=a.readies||[];if(n){n._cyreg=a}a.cy=r;var o=f!==undefined&&n!==undefined&&!t.headless;var s=t;s.layout=Q({name:o?"grid":"null"},s.layout);s.renderer=Q({name:o?"canvas":"null"},s.renderer);var l=function e(t,r,n){if(r!==undefined){return r}else if(n!==undefined){return n}else{return t}};var u=this._private={container:n,ready:false,options:s,elements:new $u(this),listeners:[],aniEles:new $u(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:false,notificationsEnabled:true,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(true,s.zoomingEnabled),userZoomingEnabled:l(true,s.userZoomingEnabled),panningEnabled:l(true,s.panningEnabled),userPanningEnabled:l(true,s.userPanningEnabled),boxSelectionEnabled:l(true,s.boxSelectionEnabled),autolock:l(false,s.autolock,s.autolockNodes),autoungrabify:l(false,s.autoungrabify,s.autoungrabifyNodes),autounselectify:l(false,s.autounselectify),styleEnabled:s.styleEnabled===undefined?o:s.styleEnabled,zoom:_(s.zoom)?s.zoom:1,pan:{x:E(s.pan)&&_(s.pan.x)?s.pan.x:0,y:E(s.pan)&&_(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:false,multiClickDebounceTime:l(250,s.multiClickDebounceTime)};this.createEmitter();this.selectionType(s.selectionType);this.zoomRange({min:s.minZoom,max:s.maxZoom});var c=function e(t,r){var n=t.some(R);if(n){return $a.all(t).then(r)}else{r(t)}};if(u.styleEnabled){r.setStyle([])}var v=Q({},s,s.renderer);r.initRenderer(v);var h=function e(t,n,a){r.notifications(false);var i=r.mutableElements();if(i.length>0){i.remove()}if(t!=null){if(E(t)||w(t)){r.add(t)}}r.one("layoutready",(function(e){r.notifications(true);r.emit(e);r.one("load",n);r.emitAndNotify("load")})).one("layoutstop",(function(){r.one("done",a);r.emit("done")}));var o=Q({},r._private.options.layout);o.eles=r.elements();r.layout(o).run()};c([s.style,s.elements],(function(e){var t=e[0];var n=e[1];if(u.styleEnabled){r.style().append(t)}h(n,(function(){r.startAnimationLoop();u.ready=true;if(x(s.ready)){r.on("ready",s.ready)}for(var e=0;e0;var l=Or(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});var u;if(N(t.roots)){u=t.roots}else if(w(t.roots)){var c=[];for(var v=0;v0){var M=O();var P=L(M,S);if(P){M.outgoers().filter((function(e){return e.isNode()&&n.has(e)})).forEach(k)}else if(P===null){kt("Detected double maximal shift for node `"+M.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}A();var R=0;if(t.avoidOverlap){for(var B=0;B0&&y[0].length<=3?c/2:0);var h=2*Math.PI/y[a].length*i;if(a===0&&y[0].length===1){f=1}return{x:Z.x+f*Math.cos(h),y:Z.y+f*Math.sin(h)}}};n.nodes().layoutPositions(this,t,J);return this};var Xc={fit:true,padding:30,boundingBox:undefined,avoidOverlap:true,nodeDimensionsIncludeLabels:false,spacingFactor:undefined,radius:undefined,startAngle:3/2*Math.PI,sweep:undefined,clockwise:true,sort:undefined,animate:false,animationDuration:500,animationEasing:undefined,animateFilter:function e(t,r){return true},ready:undefined,stop:undefined,transform:function e(t,r){return r}};function Vc(e){this.options=Q({},Xc,e)}Vc.prototype.run=function(){var e=this.options;var t=e;var r=e.cy;var n=t.eles;var a=t.counterclockwise!==undefined?!t.counterclockwise:t.clockwise;var i=n.nodes().not(":parent");if(t.sort){i=i.sort(t.sort)}var o=Or(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});var s={x:o.x1+o.w/2,y:o.y1+o.h/2};var l=t.sweep===undefined?2*Math.PI-2*Math.PI/i.length:t.sweep;var u=l/Math.max(1,i.length-1);var c;var v=0;for(var f=0;f1&&t.avoidOverlap){v*=1.75;var y=Math.cos(u)-Math.cos(0);var m=Math.sin(u)-Math.sin(0);var b=Math.sqrt(v*v/(y*y+m*m));c=Math.max(b,c)}var x=function e(r,n){var i=t.startAngle+n*u*(a?1:-1);var o=c*Math.cos(i);var l=c*Math.sin(i);var v={x:s.x+o,y:s.y+l};return v};n.nodes().layoutPositions(this,t,x);return this};var Uc={fit:true,padding:30,startAngle:3/2*Math.PI,sweep:undefined,clockwise:true,equidistant:false,minNodeSpacing:10,boundingBox:undefined,avoidOverlap:true,nodeDimensionsIncludeLabels:false,height:undefined,width:undefined,spacingFactor:undefined,concentric:function e(t){return t.degree()},levelWidth:function e(t){return t.maxDegree()/4},animate:false,animationDuration:500,animationEasing:undefined,animateFilter:function e(t,r){return true},ready:undefined,stop:undefined,transform:function e(t,r){return r}};function jc(e){this.options=Q({},Uc,e)}jc.prototype.run=function(){var e=this.options;var t=e;var r=t.counterclockwise!==undefined?!t.counterclockwise:t.clockwise;var n=e.cy;var a=t.eles;var i=a.nodes().not(":parent");var o=Or(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});var s={x:o.x1+o.w/2,y:o.y1+o.h/2};var l=[];var u=0;for(var c=0;c0){var w=Math.abs(m[0].value-x.value);if(w>=g){m=[];y.push(m)}}m.push(x)}var E=u+t.minNodeSpacing;if(!t.avoidOverlap){var T=y.length>0&&y[0].length>1;var _=Math.min(o.w,o.h)/2-E;var D=_/(y.length+T?1:0);E=Math.min(E,D)}var C=0;for(var N=0;N1&&t.avoidOverlap){var S=Math.cos(I)-Math.cos(0);var k=Math.sin(I)-Math.sin(0);var O=Math.sqrt(E*E/(S*S+k*k));C=Math.max(O,C)}A.r=C;C+=E}if(t.equidistant){var M=0;var P=0;for(var R=0;R=e.numIter){return false}rv(n,e);n.temperature=n.temperature*e.coolingFactor;if(n.temperature=e.animationThreshold){i()}st(t)}};c()}else{while(u){u=o(l);l++}dv(n,e);s()}return this};Wc.prototype.stop=function(){this.stopped=true;if(this.thread){this.thread.stop()}this.emit("layoutstop");return this};Wc.prototype.destroy=function(){if(this.thread){this.thread.stop()}return this};var $c=function e(t,r,n){var a=n.eles.edges();var i=n.eles.nodes();var o=Or(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});var s={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:a.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o};var l=n.eles.components();var u={};for(var c=0;c0){s.graphSet.push(D);for(var c=0;ca.count){return 0}else{return a.graph}};var Zc=function e(t,r,n,a){var i=a.graphSet[n];if(-10){var v=a.nodeOverlap*c;var f=Math.sqrt(s*s+l*l);var h=v*s/f;var d=v*l/f}else{var p=sv(t,s,l);var g=sv(r,-1*s,-1*l);var y=g.x-p.x;var m=g.y-p.y;var b=y*y+m*m;var f=Math.sqrt(b);var v=(t.nodeRepulsion+r.nodeRepulsion)/b;var h=v*y/f;var d=v*m/f}if(!t.isLocked){t.offsetX-=h;t.offsetY-=d}if(!r.isLocked){r.offsetX+=h;r.offsetY+=d}return};var ov=function e(t,r,n,a){if(n>0){var i=t.maxX-r.minX}else{var i=r.maxX-t.minX}if(a>0){var o=t.maxY-r.minY}else{var o=r.maxY-t.minY}if(i>=0&&o>=0){return Math.sqrt(i*i+o*o)}else{return 0}};var sv=function e(t,r,n){var a=t.positionX;var i=t.positionY;var o=t.height||1;var s=t.width||1;var l=n/r;var u=o/s;var c={};if(0===r&&0n){c.x=a;c.y=i+o/2;return c}if(0r&&-1*u<=l&&l<=u){c.x=a-s/2;c.y=i-s*n/2/r;return c}if(0=u)){c.x=a+o*r/2/n;c.y=i+o/2;return c}if(0>n&&(l<=-1*u||l>=u)){c.x=a-o*r/2/n;c.y=i-o/2;return c}return c};var lv=function e(t,r){for(var n=0;nn){var g=r.gravity*h/p;var y=r.gravity*d/p;f.offsetX+=g;f.offsetY+=y}}}};var cv=function e(t,r){var n=[];var a=0;var i=-1;n.push.apply(n,t.graphSet[0]);i+=t.graphSet[0].length;while(a<=i){var o=n[a++];var s=t.idToIndex[o];var l=t.layoutNodes[s];var u=l.children;if(0n){var i={x:n*t/a,y:n*r/a}}else{var i={x:t,y:r}}return i};var hv=function e(t,r){var n=t.parentId;if(null==n){return}var a=r.layoutNodes[r.idToIndex[n]];var i=false;if(null==a.maxX||t.maxX+a.padRight>a.maxX){a.maxX=t.maxX+a.padRight;i=true}if(null==a.minX||t.minX-a.padLefta.maxY){a.maxY=t.maxY+a.padBottom;i=true}if(null==a.minY||t.minY-a.padTopy){d+=g+r.componentSpacing;h=0;p=0;g=0}}};var pv={fit:true,padding:30,boundingBox:undefined,avoidOverlap:true,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:false,spacingFactor:undefined,condense:false,rows:undefined,cols:undefined,position:function e(t){},sort:undefined,animate:false,animationDuration:500,animationEasing:undefined,animateFilter:function e(t,r){return true},ready:undefined,stop:undefined,transform:function e(t,r){return r}};function gv(e){this.options=Q({},pv,e)}gv.prototype.run=function(){var e=this.options;var t=e;var r=e.cy;var n=t.eles;var a=n.nodes().not(":parent");if(t.sort){a=a.sort(t.sort)}var i=Or(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0){n.nodes().layoutPositions(this,t,(function(e){return{x:i.x1,y:i.y1}}))}else{var o=a.size();var s=Math.sqrt(o*i.h/i.w);var l=Math.round(s);var u=Math.round(i.w/i.h*s);var c=function e(t){if(t==null){return Math.min(l,u)}else{var r=Math.min(l,u);if(r==l){l=t}else{u=t}}};var v=function e(t){if(t==null){return Math.max(l,u)}else{var r=Math.max(l,u);if(r==l){l=t}else{u=t}}};var f=t.rows;var h=t.cols!=null?t.cols:t.columns;if(f!=null&&h!=null){l=f;u=h}else if(f!=null&&h==null){l=f;u=Math.ceil(o/l)}else if(f==null&&h!=null){u=h;l=Math.ceil(o/u)}else if(u*l>o){var d=c();var p=v();if((d-1)*p>=o){c(d-1)}else if((p-1)*d>=o){v(p-1)}}else{while(u*l=o){v(y+1)}else{c(g+1)}}}var m=i.w/u;var b=i.h/l;if(t.condense){m=0;b=0}if(t.avoidOverlap){for(var x=0;x=u){S=0;I++}};var O={};for(var M=0;M(b=Zr(e,t,x[w],x[w+1],x[w+2],x[w+3]))){g(r,b);return true}}}else if(o.edgeType==="bezier"||o.edgeType==="multibezier"||o.edgeType==="self"||o.edgeType==="compound"){var x=o.allpts;for(var w=0;w+5(b=Kr(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5]))){g(r,b);return true}}}var p=p||n.source;var m=m||n.target;var E=a.getArrowWidth(l,v);var T=[{name:"source",x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:"target",x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:"mid-source",x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:"mid-target",x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}];for(var w=0;w0){y(p);y(m)}}function b(e,t,r){return Vt(e,t,r)}function x(r,n){var a=r._private;var i=f;var o;if(n){o=n+"-"}else{o=""}r.boundingBox();var s=a.labelBounds[n||"main"];var l=r.pstyle(o+"label").value;var u=r.pstyle("text-events").strValue==="yes";if(!u||!l){return}var c=b(a.rscratch,"labelX",n);var v=b(a.rscratch,"labelY",n);var h=b(a.rscratch,"labelAngle",n);var d=r.pstyle(o+"text-margin-x").pfValue;var p=r.pstyle(o+"text-margin-y").pfValue;var y=s.x1-i-d;var m=s.x2+i-d;var x=s.y1-i-p;var w=s.y2+i-p;if(h){var E=Math.cos(h);var T=Math.sin(h);var _=function e(t,r){t=t-c;r=r-v;return{x:t*E-r*T+c,y:t*T+r*E+v}};var D=_(y,x);var C=_(y,w);var N=_(m,x);var A=_(m,w);var L=[D.x+d,D.y+p,N.x+d,N.y+p,A.x+d,A.y+p,C.x+d,C.y+p];if(Qr(e,t,L)){g(r);return true}}else{if(Xr(s,e,t)){g(r);return true}}}for(var w=o.length-1;w>=0;w--){var E=o[w];if(E.isNode()){y(E)||x(E)}else{m(E)||x(E)||x(E,"source")||x(E,"target")}}return s};Av.getAllInBox=function(e,t,r,n){var a=this.getCachedZSortedEles().interactive;var i=[];var o=Math.min(e,r);var s=Math.max(e,r);var l=Math.min(t,n);var u=Math.max(t,n);e=o;r=s;t=l;n=u;var c=Or({x1:e,y1:t,x2:r,y2:n});for(var v=0;v0){return Math.max(t-r,0)}else{return Math.min(t+r,0)}};var L=A(C,_);var I=A(N,D);var S=false;if(m===u){y=Math.abs(L)>Math.abs(I)?a:n}else if(m===l||m===s){y=n;S=true}else if(m===i||m===o){y=a;S=true}var k=y===n;var O=k?I:L;var M=k?N:C;var P=Dr(M);var R=false;if(!(S&&(x||E))&&(m===s&&M<0||m===l&&M>0||m===i&&M>0||m===o&&M<0)){P*=-1;O=P*Math.abs(O);R=true}var B;if(x){var F=w<0?1+w:w;B=F*O}else{var z=w<0?O:0;B=z+w*P}var G=function e(t){return Math.abs(t)=Math.abs(O)};var Y=G(B);var X=G(Math.abs(O)-Math.abs(B));var V=Y||X;if(V&&!R){if(k){var U=Math.abs(M)<=f/2;var j=Math.abs(C)<=h/2;if(U){var H=(c.x1+c.x2)/2;var q=c.y1,W=c.y2;r.segpts=[H,q,H,W]}else if(j){var $=(c.y1+c.y2)/2;var K=c.x1,Z=c.x2;r.segpts=[K,$,Z,$]}else{r.segpts=[c.x1,c.y2]}}else{var Q=Math.abs(M)<=v/2;var J=Math.abs(N)<=d/2;if(Q){var ee=(c.y1+c.y2)/2;var te=c.x1,re=c.x2;r.segpts=[te,ee,re,ee]}else if(J){var ne=(c.x1+c.x2)/2;var ae=c.y1,ie=c.y2;r.segpts=[ne,ae,ne,ie]}else{r.segpts=[c.x2,c.y1]}}}else{if(k){var oe=c.y1+B+(g?f/2*P:0);var se=c.x1,le=c.x2;r.segpts=[se,oe,le,oe]}else{var ue=c.x1+B+(g?v/2*P:0);var ce=c.y1,ve=c.y2;r.segpts=[ue,ce,ue,ve]}}};Iv.tryToCorrectInvalidPoints=function(e,t){var r=e._private.rscratch;if(r.edgeType==="bezier"){var n=t.srcPos,a=t.tgtPos,i=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape;var v=!_(r.startX)||!_(r.startY);var f=!_(r.arrowStartX)||!_(r.arrowStartY);var h=!_(r.endX)||!_(r.endY);var d=!_(r.arrowEndX)||!_(r.arrowEndY);var p=3;var g=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth;var y=p*g;var m=Cr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY});var b=mh.poolIndex()){var d=f;f=h;h=d}var p=l.srcPos=f.position();var g=l.tgtPos=h.position();var y=l.srcW=f.outerWidth();var m=l.srcH=f.outerHeight();var b=l.tgtW=h.outerWidth();var x=l.tgtH=h.outerHeight();var w=l.srcShape=r.nodeShapes[t.getNodeShape(f)];var E=l.tgtShape=r.nodeShapes[t.getNodeShape(h)];l.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var T=0;T0){var j=i;var H=Nr(j,yr(r));var q=Nr(j,yr(U));var W=H;if(q2){var $=Nr(j,{x:U[2],y:U[3]});if($0){var le=o;var ue=Nr(le,yr(r));var ce=Nr(le,yr(se));var ve=ue;if(ce2){var fe=Nr(le,{x:se[2],y:se[3]});if(fe=c||b){f={cp:g,segment:m};break}}if(f){break}}var x=f.cp;var w=f.segment;var E=(c-h)/w.length;var T=w.t1-w.t0;var _=u?w.t0+T*E:w.t1-T*E;_=kr(0,_,1);t=Ir(x.p0,x.p1,x.p2,_);s=Fv(x.p0,x.p1,x.p2,_);break}case"straight":case"segments":case"haystack":{var D=0,C,N;var A,L;var I=n.allpts.length;for(var S=0;S+3=c){break}}var k=c-N;var O=k/C;O=kr(0,O,1);t=Sr(A,L,O);s=Bv(A,L);break}}o("labelX",a,t.x);o("labelY",a,t.y);o("labelAutoAngle",a,s)};u("source");u("target");this.applyLabelDimensions(e)};Pv.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e);if(e.isEdge()){this.applyPrefixedLabelDimensions(e,"source");this.applyPrefixedLabelDimensions(e,"target")}};Pv.applyPrefixedLabelDimensions=function(e,t){var r=e._private;var n=this.getLabelText(e,t);var a=this.calculateLabelDimensions(e,n);var i=e.pstyle("line-height").pfValue;var o=e.pstyle("text-wrap").strValue;var s=Vt(r.rscratch,"labelWrapCachedLines",t)||[];var l=o!=="wrap"?1:Math.max(s.length,1);var u=a.height/l;var c=u*i;var v=a.width;var f=a.height+(l-1)*(i-1)*u;Ut(r.rstyle,"labelWidth",t,v);Ut(r.rscratch,"labelWidth",t,v);Ut(r.rstyle,"labelHeight",t,f);Ut(r.rscratch,"labelHeight",t,f);Ut(r.rscratch,"labelLineHeight",t,c)};Pv.getLabelText=function(e,t){var r=e._private;var n=t?t+"-":"";var a=e.pstyle(n+"label").strValue;var i=e.pstyle("text-transform").value;var o=function e(n,a){if(a){Ut(r.rscratch,n,t,a);return a}else{return Vt(r.rscratch,n,t)}};if(!a){return""}if(i=="none");else if(i=="uppercase"){a=a.toUpperCase()}else if(i=="lowercase"){a=a.toLowerCase()}var s=e.pstyle("text-wrap").value;if(s==="wrap"){var l=o("labelKey");if(l!=null&&o("labelWrapKey")===l){return o("labelWrapCachedText")}var u="​";var c=a.split("\n");var v=e.pstyle("text-max-width").pfValue;var f=e.pstyle("text-overflow-wrap").value;var h=f==="anywhere";var d=[];var p=/[\s\u200b]+/;var g=h?"":" ";for(var y=0;yv){var E=m.split(p);var T="";for(var _=0;_L){break}I+=a[O];if(O===a.length-1){k=true}}if(!k){I+=S}return I}return a};Pv.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue;var r=e.pstyle("text-halign").strValue;if(t==="auto"){if(e.isNode()){switch(r){case"left":return"right";case"right":return"left";default:return"center"}}else{return"center"}}else{return t}};Pv.calculateLabelDimensions=function(e,t){var r=this;var n=bt(t,e._private.labelDimsKey);var a=r.labelDimCache||(r.labelDimCache=[]);var i=a[n];if(i!=null){return i}var o=0;var s=e.pstyle("font-style").strValue;var l=e.pstyle("font-size").pfValue;var u=e.pstyle("font-family").strValue;var c=e.pstyle("font-weight").strValue;var v=this.labelCalcCanvas;var f=this.labelCalcCanvasContext;if(!v){v=this.labelCalcCanvas=document.createElement("canvas");f=this.labelCalcCanvasContext=v.getContext("2d");var h=v.style;h.position="absolute";h.left="-9999px";h.top="-9999px";h.zIndex="-1";h.visibility="hidden";h.pointerEvents="none"}f.font="".concat(s," ").concat(c," ").concat(l,"px ").concat(u);var d=0;var p=0;var g=t.split("\n");for(var y=0;y1&&arguments[1]!==undefined?arguments[1]:true;t.merge(r);if(n){for(var a=0;a=e.desktopTapThreshold2}var I=a(r);if(E){e.hoverData.tapholdCancelled=true}var S=function t(){var r=e.hoverData.dragDelta=e.hoverData.dragDelta||[];if(r.length===0){r.push(x[0]);r.push(x[1])}else{r[0]+=x[0];r[1]+=x[1]}};s=true;n(y,["mousemove","vmousemove","tapdrag"],r,{x:v[0],y:v[1]});var k=function t(){e.data.bgActivePosistion=undefined;if(!e.hoverData.selecting){l.emit({originalEvent:r,type:"boxstart",position:{x:v[0],y:v[1]}})}p[4]=1;e.hoverData.selecting=true;e.redrawHint("select",true);e.redraw()};if(e.hoverData.which===3){if(E){var O={originalEvent:r,type:"cxtdrag",position:{x:v[0],y:v[1]}};if(b){b.emit(O)}else{l.emit(O)}e.hoverData.cxtDragged=true;if(!e.hoverData.cxtOver||y!==e.hoverData.cxtOver){if(e.hoverData.cxtOver){e.hoverData.cxtOver.emit({originalEvent:r,type:"cxtdragout",position:{x:v[0],y:v[1]}})}e.hoverData.cxtOver=y;if(y){y.emit({originalEvent:r,type:"cxtdragover",position:{x:v[0],y:v[1]}})}}}}else if(e.hoverData.dragging){s=true;if(l.panningEnabled()&&l.userPanningEnabled()){var M;if(e.hoverData.justStartedPan){var P=e.hoverData.mdownPos;M={x:(v[0]-P[0])*u,y:(v[1]-P[1])*u};e.hoverData.justStartedPan=false}else{M={x:x[0]*u,y:x[1]*u}}l.panBy(M);l.emit("dragpan");e.hoverData.dragged=true}v=e.projectIntoViewport(r.clientX,r.clientY)}else if(p[4]==1&&(b==null||b.pannable())){if(E){if(!e.hoverData.dragging&&l.boxSelectionEnabled()&&(I||!l.panningEnabled()||!l.userPanningEnabled())){k()}else if(!e.hoverData.selecting&&l.panningEnabled()&&l.userPanningEnabled()){var R=i(b,e.hoverData.downs);if(R){e.hoverData.dragging=true;e.hoverData.justStartedPan=true;p[4]=0;e.data.bgActivePosistion=yr(f);e.redrawHint("select",true);e.redraw()}}if(b&&b.pannable()&&b.active()){b.unactivate()}}}else{if(b&&b.pannable()&&b.active()){b.unactivate()}if((!b||!b.grabbed())&&y!=m){if(m){n(m,["mouseout","tapdragout"],r,{x:v[0],y:v[1]})}if(y){n(y,["mouseover","tapdragover"],r,{x:v[0],y:v[1]})}e.hoverData.last=y}if(b){if(E){if(l.boxSelectionEnabled()&&I){if(b&&b.grabbed()){g(w);b.emit("freeon");w.emit("free");if(e.dragData.didDrag){b.emit("dragfreeon");w.emit("dragfree")}}k()}else if(b&&b.grabbed()&&e.nodeIsDraggable(b)){var B=!e.dragData.didDrag;if(B){e.redrawHint("eles",true)}e.dragData.didDrag=true;if(!e.hoverData.draggingEles){d(w,{inDragLayer:true})}var F={x:0,y:0};if(_(x[0])&&_(x[1])){F.x+=x[0];F.y+=x[1];if(B){var z=e.hoverData.dragDelta;if(z&&_(z[0])&&_(z[1])){F.x+=z[0];F.y+=z[1]}}}e.hoverData.draggingEles=true;w.silentShift(F).emit("position drag");e.redrawHint("drag",true);e.redraw()}}else{S()}}s=true}p[2]=v[0];p[3]=v[1];if(s){if(r.stopPropagation)r.stopPropagation();if(r.preventDefault)r.preventDefault();return false}}),false);var N,A,L;e.registerBinding(t,"mouseup",(function t(i){var o=e.hoverData.capture;if(!o){return}e.hoverData.capture=false;var s=e.cy;var l=e.projectIntoViewport(i.clientX,i.clientY);var u=e.selection;var c=e.findNearestElement(l[0],l[1],true,false);var v=e.dragData.possibleDragElements;var f=e.hoverData.down;var h=a(i);if(e.data.bgActivePosistion){e.redrawHint("select",true);e.redraw()}e.hoverData.tapholdCancelled=true;e.data.bgActivePosistion=undefined;if(f){f.unactivate()}if(e.hoverData.which===3){var d={originalEvent:i,type:"cxttapend",position:{x:l[0],y:l[1]}};if(f){f.emit(d)}else{s.emit(d)}if(!e.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:l[0],y:l[1]}};if(f){f.emit(p)}else{s.emit(p)}}e.hoverData.cxtDragged=false;e.hoverData.which=null}else if(e.hoverData.which===1){n(c,["mouseup","tapend","vmouseup"],i,{x:l[0],y:l[1]});if(!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag){n(f,["click","tap","vclick"],i,{x:l[0],y:l[1]});A=false;if(i.timeStamp-L<=s.multiClickDebounceTime()){N&&clearTimeout(N);A=true;L=null;n(f,["dblclick","dbltap","vdblclick"],i,{x:l[0],y:l[1]})}else{N=setTimeout((function(){if(A)return;n(f,["oneclick","onetap","voneclick"],i,{x:l[0],y:l[1]})}),s.multiClickDebounceTime());L=i.timeStamp}}if(f==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(i)){s.$(r).unselect(["tapunselect"]);if(v.length>0){e.redrawHint("eles",true)}e.dragData.possibleDragElements=v=s.collection()}if(c==f&&!e.dragData.didDrag&&!e.hoverData.selecting){if(c!=null&&c._private.selectable){if(e.hoverData.dragging);else if(s.selectionType()==="additive"||h){if(c.selected()){c.unselect(["tapunselect"])}else{c.select(["tapselect"])}}else{if(!h){s.$(r).unmerge(c).unselect(["tapunselect"]);c.select(["tapselect"])}}e.redrawHint("eles",true)}}if(e.hoverData.selecting){var y=s.collection(e.getAllInBox(u[0],u[1],u[2],u[3]));e.redrawHint("select",true);if(y.length>0){e.redrawHint("eles",true)}s.emit({type:"boxend",originalEvent:i,position:{x:l[0],y:l[1]}});var m=function e(t){return t.selectable()&&!t.selected()};if(s.selectionType()==="additive"){y.emit("box").stdFilter(m).select().emit("boxselect")}else{if(!h){s.$(r).unmerge(y).unselect()}y.emit("box").stdFilter(m).select().emit("boxselect")}e.redraw()}if(e.hoverData.dragging){e.hoverData.dragging=false;e.redrawHint("select",true);e.redrawHint("eles",true);e.redraw()}if(!u[4]){e.redrawHint("drag",true);e.redrawHint("eles",true);var b=f&&f.grabbed();g(v);if(b){f.emit("freeon");v.emit("free");if(e.dragData.didDrag){f.emit("dragfreeon");v.emit("dragfree")}}}}u[4]=0;e.hoverData.down=null;e.hoverData.cxtStarted=false;e.hoverData.draggingEles=false;e.hoverData.selecting=false;e.hoverData.isOverThresholdDrag=false;e.dragData.didDrag=false;e.hoverData.dragged=false;e.hoverData.dragDelta=[];e.hoverData.mdownPos=null;e.hoverData.mdownGPos=null}),false);var I=function t(r){if(e.scrollingPage){return}var n=e.cy;var a=n.zoom();var i=n.pan();var o=e.projectIntoViewport(r.clientX,r.clientY);var s=[o[0]*a+i.x,o[1]*a+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||D()){r.preventDefault();return}if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){r.preventDefault();e.data.wheelZooming=true;clearTimeout(e.data.wheelTimeout);e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=false;e.redrawHint("eles",true);e.redraw()}),150);var l;if(r.deltaY!=null){l=r.deltaY/-250}else if(r.wheelDeltaY!=null){l=r.wheelDeltaY/1e3}else{l=r.wheelDelta/1e3}l=l*e.wheelSensitivity;var u=r.deltaMode===1;if(u){l*=33}var c=n.zoom()*Math.pow(10,l);if(r.type==="gesturechange"){c=e.gestureStartZoom*r.scale}n.zoom({level:c,renderedPosition:{x:s[0],y:s[1]}});n.emit(r.type==="gesturechange"?"pinchzoom":"scrollzoom")}};e.registerBinding(e.container,"wheel",I,true);e.registerBinding(t,"scroll",(function t(r){e.scrollingPage=true;clearTimeout(e.scrollingPageTimeout);e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=false}),250)}),true);e.registerBinding(e.container,"gesturestart",(function t(r){e.gestureStartZoom=e.cy.zoom();if(!e.hasTouchStarted){r.preventDefault()}}),true);e.registerBinding(e.container,"gesturechange",(function(t){if(!e.hasTouchStarted){I(t)}}),true);e.registerBinding(e.container,"mouseout",(function t(r){var n=e.projectIntoViewport(r.clientX,r.clientY);e.cy.emit({originalEvent:r,type:"mouseout",position:{x:n[0],y:n[1]}})}),false);e.registerBinding(e.container,"mouseover",(function t(r){var n=e.projectIntoViewport(r.clientX,r.clientY);e.cy.emit({originalEvent:r,type:"mouseover",position:{x:n[0],y:n[1]}})}),false);var S,k,O,M;var P,R;var B,F;var z,G;var Y,X;var V;var U=function e(t,r,n,a){return Math.sqrt((n-t)*(n-t)+(a-r)*(a-r))};var j=function e(t,r,n,a){return(n-t)*(n-t)+(a-r)*(a-r)};var H;e.registerBinding(e.container,"touchstart",H=function t(r){e.hasTouchStarted=true;if(!C(r)){return}m();e.touchData.capture=true;e.data.bgActivePosistion=undefined;var a=e.cy;var i=e.touchData.now;var o=e.touchData.earlier;if(r.touches[0]){var s=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);i[0]=s[0];i[1]=s[1]}if(r.touches[1]){var s=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);i[2]=s[0];i[3]=s[1]}if(r.touches[2]){var s=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);i[4]=s[0];i[5]=s[1]}if(r.touches[1]){e.touchData.singleTouchMoved=true;g(e.dragData.touchDragEles);var l=e.findContainerClientCoords();z=l[0];G=l[1];Y=l[2];X=l[3];S=r.touches[0].clientX-z;k=r.touches[0].clientY-G;O=r.touches[1].clientX-z;M=r.touches[1].clientY-G;V=0<=S&&S<=Y&&0<=O&&O<=Y&&0<=k&&k<=X&&0<=M&&M<=X;var u=a.pan();var v=a.zoom();P=U(S,k,O,M);R=j(S,k,O,M);B=[(S+O)/2,(k+M)/2];F=[(B[0]-u.x)/v,(B[1]-u.y)/v];var f=200;var h=f*f;if(R=1){var D=e.touchData.startPosition=[null,null,null,null,null,null];for(var N=0;N=e.touchTapThreshold2}if(a&&e.touchData.cxt){r.preventDefault();var T=r.touches[0].clientX-z,D=r.touches[0].clientY-G;var N=r.touches[1].clientX-z,A=r.touches[1].clientY-G;var L=j(T,D,N,A);var I=L/R;var B=150;var Y=B*B;var X=1.5;var H=X*X;if(I>=H||L>=Y){e.touchData.cxt=false;e.data.bgActivePosistion=undefined;e.redrawHint("select",true);var q={originalEvent:r,type:"cxttapend",position:{x:l[0],y:l[1]}};if(e.touchData.start){e.touchData.start.unactivate().emit(q);e.touchData.start=null}else{s.emit(q)}}}if(a&&e.touchData.cxt){var q={originalEvent:r,type:"cxtdrag",position:{x:l[0],y:l[1]}};e.data.bgActivePosistion=undefined;e.redrawHint("select",true);if(e.touchData.start){e.touchData.start.emit(q)}else{s.emit(q)}if(e.touchData.start){e.touchData.start._private.grabbed=false}e.touchData.cxtDragged=true;var W=e.findNearestElement(l[0],l[1],true,true);if(!e.touchData.cxtOver||W!==e.touchData.cxtOver){if(e.touchData.cxtOver){e.touchData.cxtOver.emit({originalEvent:r,type:"cxtdragout",position:{x:l[0],y:l[1]}})}e.touchData.cxtOver=W;if(W){W.emit({originalEvent:r,type:"cxtdragover",position:{x:l[0],y:l[1]}})}}}else if(a&&r.touches[2]&&s.boxSelectionEnabled()){r.preventDefault();e.data.bgActivePosistion=undefined;this.lastThreeTouch=+new Date;if(!e.touchData.selecting){s.emit({originalEvent:r,type:"boxstart",position:{x:l[0],y:l[1]}})}e.touchData.selecting=true;e.touchData.didSelect=true;o[4]=1;if(!o||o.length===0||o[0]===undefined){o[0]=(l[0]+l[2]+l[4])/3;o[1]=(l[1]+l[3]+l[5])/3;o[2]=(l[0]+l[2]+l[4])/3+1;o[3]=(l[1]+l[3]+l[5])/3+1}else{o[2]=(l[0]+l[2]+l[4])/3;o[3]=(l[1]+l[3]+l[5])/3}e.redrawHint("select",true);e.redraw()}else if(a&&r.touches[1]&&!e.touchData.didSelect&&s.zoomingEnabled()&&s.panningEnabled()&&s.userZoomingEnabled()&&s.userPanningEnabled()){r.preventDefault();e.data.bgActivePosistion=undefined;e.redrawHint("select",true);var $=e.dragData.touchDragEles;if($){e.redrawHint("drag",true);for(var K=0;K<$.length;K++){var Z=$[K]._private;Z.grabbed=false;Z.rscratch.inDragLayer=false}}var Q=e.touchData.start;var T=r.touches[0].clientX-z,D=r.touches[0].clientY-G;var N=r.touches[1].clientX-z,A=r.touches[1].clientY-G;var J=U(T,D,N,A);var ee=J/P;if(V){var te=T-S;var re=D-k;var ne=N-O;var ae=A-M;var ie=(te+ne)/2;var oe=(re+ae)/2;var se=s.zoom();var le=se*ee;var ue=s.pan();var ce=F[0]*se+ue.x;var ve=F[1]*se+ue.y;var fe={x:-le/se*(ce-ue.x-ie)+ce,y:-le/se*(ve-ue.y-oe)+ve};if(Q&&Q.active()){var $=e.dragData.touchDragEles;g($);e.redrawHint("drag",true);e.redrawHint("eles",true);Q.unactivate().emit("freeon");$.emit("free");if(e.dragData.didDrag){Q.emit("dragfreeon");$.emit("dragfree")}}s.viewport({zoom:le,pan:fe,cancelOnFailedZoom:true});s.emit("pinchzoom");P=J;S=T;k=D;O=N;M=A;e.pinching=true}if(r.touches[0]){var v=e.projectIntoViewport(r.touches[0].clientX,r.touches[0].clientY);l[0]=v[0];l[1]=v[1]}if(r.touches[1]){var v=e.projectIntoViewport(r.touches[1].clientX,r.touches[1].clientY);l[2]=v[0];l[3]=v[1]}if(r.touches[2]){var v=e.projectIntoViewport(r.touches[2].clientX,r.touches[2].clientY);l[4]=v[0];l[5]=v[1]}}else if(r.touches[0]&&!e.touchData.didSelect){var he=e.touchData.start;var de=e.touchData.last;var W;if(!e.hoverData.draggingEles&&!e.swipePanning){W=e.findNearestElement(l[0],l[1],true,true)}if(a&&he!=null){r.preventDefault()}if(a&&he!=null&&e.nodeIsDraggable(he)){if(h){var $=e.dragData.touchDragEles;var pe=!e.dragData.didDrag;if(pe){d($,{inDragLayer:true})}e.dragData.didDrag=true;var ge={x:0,y:0};if(_(p[0])&&_(p[1])){ge.x+=p[0];ge.y+=p[1];if(pe){e.redrawHint("eles",true);var ye=e.touchData.dragDelta;if(ye&&_(ye[0])&&_(ye[1])){ge.x+=ye[0];ge.y+=ye[1]}}}e.hoverData.draggingEles=true;$.silentShift(ge).emit("position drag");e.redrawHint("drag",true);if(e.touchData.startPosition[0]==u[0]&&e.touchData.startPosition[1]==u[1]){e.redrawHint("eles",true)}e.redraw()}else{var ye=e.touchData.dragDelta=e.touchData.dragDelta||[];if(ye.length===0){ye.push(p[0]);ye.push(p[1])}else{ye[0]+=p[0];ye[1]+=p[1]}}}{n(he||W,["touchmove","tapdrag","vmousemove"],r,{x:l[0],y:l[1]});if((!he||!he.grabbed())&&W!=de){if(de){de.emit({originalEvent:r,type:"tapdragout",position:{x:l[0],y:l[1]}})}if(W){W.emit({originalEvent:r,type:"tapdragover",position:{x:l[0],y:l[1]}})}}e.touchData.last=W}if(a){for(var K=0;K0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null){e.data.bgActivePosistion=undefined;e.redrawHint("select",true);e.redraw()}},false);var W;e.registerBinding(t,"touchcancel",W=function t(r){var n=e.touchData.start;e.touchData.capture=false;if(n){n.unactivate()}});var $,K,Z,Q;e.registerBinding(t,"touchend",$=function t(a){var i=e.touchData.start;var o=e.touchData.capture;if(o){if(a.touches.length===0){e.touchData.capture=false}a.preventDefault()}else{return}var s=e.selection;e.swipePanning=false;e.hoverData.draggingEles=false;var l=e.cy;var u=l.zoom();var c=e.touchData.now;var v=e.touchData.earlier;if(a.touches[0]){var f=e.projectIntoViewport(a.touches[0].clientX,a.touches[0].clientY);c[0]=f[0];c[1]=f[1]}if(a.touches[1]){var f=e.projectIntoViewport(a.touches[1].clientX,a.touches[1].clientY);c[2]=f[0];c[3]=f[1]}if(a.touches[2]){var f=e.projectIntoViewport(a.touches[2].clientX,a.touches[2].clientY);c[4]=f[0];c[5]=f[1]}if(i){i.unactivate()}var h;if(e.touchData.cxt){h={originalEvent:a,type:"cxttapend",position:{x:c[0],y:c[1]}};if(i){i.emit(h)}else{l.emit(h)}if(!e.touchData.cxtDragged){var d={originalEvent:a,type:"cxttap",position:{x:c[0],y:c[1]}};if(i){i.emit(d)}else{l.emit(d)}}if(e.touchData.start){e.touchData.start._private.grabbed=false}e.touchData.cxt=false;e.touchData.start=null;e.redraw();return}if(!a.touches[2]&&l.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=false;var p=l.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));s[0]=undefined;s[1]=undefined;s[2]=undefined;s[3]=undefined;s[4]=0;e.redrawHint("select",true);l.emit({type:"boxend",originalEvent:a,position:{x:c[0],y:c[1]}});var y=function e(t){return t.selectable()&&!t.selected()};p.emit("box").stdFilter(y).select().emit("boxselect");if(p.nonempty()){e.redrawHint("eles",true)}e.redraw()}if(i!=null){i.unactivate()}if(a.touches[2]){e.data.bgActivePosistion=undefined;e.redrawHint("select",true)}else if(a.touches[1]);else if(a.touches[0]);else if(!a.touches[0]){e.data.bgActivePosistion=undefined;e.redrawHint("select",true);var m=e.dragData.touchDragEles;if(i!=null){var b=i._private.grabbed;g(m);e.redrawHint("drag",true);e.redrawHint("eles",true);if(b){i.emit("freeon");m.emit("free");if(e.dragData.didDrag){i.emit("dragfreeon");m.emit("dragfree")}}n(i,["touchend","tapend","vmouseup","tapdragout"],a,{x:c[0],y:c[1]});i.unactivate();e.touchData.start=null}else{var x=e.findNearestElement(c[0],c[1],true,true);n(x,["touchend","tapend","vmouseup","tapdragout"],a,{x:c[0],y:c[1]})}var w=e.touchData.startPosition[0]-c[0];var E=w*w;var T=e.touchData.startPosition[1]-c[1];var _=T*T;var D=E+_;var C=D*u*u;if(!e.touchData.singleTouchMoved){if(!i){l.$(":selected").unselect(["tapunselect"])}n(i,["tap","vclick"],a,{x:c[0],y:c[1]});K=false;if(a.timeStamp-Q<=l.multiClickDebounceTime()){Z&&clearTimeout(Z);K=true;Q=null;n(i,["dbltap","vdblclick"],a,{x:c[0],y:c[1]})}else{Z=setTimeout((function(){if(K)return;n(i,["onetap","voneclick"],a,{x:c[0],y:c[1]})}),l.multiClickDebounceTime());Q=a.timeStamp}}if(i!=null&&!e.dragData.didDrag&&i._private.selectable&&C0){return p[0]}}return null};var h=Object.keys(v);for(var d=0;d0){return f}return jr(i,o,t,r,n,a,s)},checkPoint:function e(t,r,n,a,i,o,s){var l=pn(a,i);var u=2*l;if(Jr(t,r,this.points,o,s,a,i-u,[0,-1],n)){return true}if(Jr(t,r,this.points,o,s,a-u,i,[0,-1],n)){return true}var c=a/2+2*n;var v=i/2+2*n;var f=[o-c,s-v,o-c,s,o+c,s,o+c,s-v];if(Qr(t,r,f)){return true}if(an(t,r,u,u,o+a/2-l,s+i/2-l,n)){return true}if(an(t,r,u,u,o-a/2+l,s+i/2-l,n)){return true}return false}}};qv.registerNodeShapes=function(){var e=this.nodeShapes={};var t=this;this.generateEllipse();this.generatePolygon("triangle",fn(3,0));this.generateRoundPolygon("round-triangle",fn(3,0));this.generatePolygon("rectangle",fn(4,0));e["square"]=e["rectangle"];this.generateRoundRectangle();this.generateCutRectangle();this.generateBarrel();this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r);this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",fn(5,0));this.generateRoundPolygon("round-pentagon",fn(5,0));this.generatePolygon("hexagon",fn(6,0));this.generateRoundPolygon("round-hexagon",fn(6,0));this.generatePolygon("heptagon",fn(7,0));this.generateRoundPolygon("round-heptagon",fn(7,0));this.generatePolygon("octagon",fn(8,0));this.generateRoundPolygon("round-octagon",fn(8,0));var n=new Array(20);{var a=dn(5,0);var i=dn(5,Math.PI/5);var o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=t.deqFastCost*g){break}}else{if(i){if(d>=t.deqCost*u||d>=t.deqAvgCost*l){break}}else if(p>=t.deqNoDrawCost*Jv){break}}var y=t.deq(r,f,v);if(y.length>0){for(var m=0;m0){t.onDeqd(r,c);if(!i&&t.shouldRedraw(r,c,f,v)){a()}}};var o=t.priority||Lt;n.beforeRender(i,o(r))}}};var tf=function(){function e(r){var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Nt;t(this,e);this.idsByKey=new Ht;this.keyForId=new Ht;this.cachesByLvl=new Ht;this.lvls=[];this.getKey=r;this.doesEleInvalidateKey=n}a(e,[{key:"getIdsFor",value:function e(t){if(t==null){It("Can not get id list for null key")}var r=this.idsByKey;var n=this.idsByKey.get(t);if(!n){n=new $t;r.set(t,n)}return n}},{key:"addIdForKey",value:function e(t,r){if(t!=null){this.getIdsFor(t).add(r)}}},{key:"deleteIdForKey",value:function e(t,r){if(t!=null){this.getIdsFor(t)["delete"](r)}}},{key:"getNumberOfIdsForKey",value:function e(t){if(t==null){return 0}else{return this.getIdsFor(t).size}}},{key:"updateKeyMappingFor",value:function e(t){var r=t.id();var n=this.keyForId.get(r);var a=this.getKey(t);this.deleteIdForKey(n,r);this.addIdForKey(a,r);this.keyForId.set(r,a)}},{key:"deleteKeyMappingFor",value:function e(t){var r=t.id();var n=this.keyForId.get(r);this.deleteIdForKey(n,r);this.keyForId["delete"](r)}},{key:"keyHasChangedFor",value:function e(t){var r=t.id();var n=this.keyForId.get(r);var a=this.getKey(t);return n!==a}},{key:"isInvalid",value:function e(t){return this.keyHasChangedFor(t)||this.doesEleInvalidateKey(t)}},{key:"getCachesAt",value:function e(t){var r=this.cachesByLvl,n=this.lvls;var a=r.get(t);if(!a){a=new Ht;r.set(t,a);n.push(t)}return a}},{key:"getCache",value:function e(t,r){return this.getCachesAt(r).get(t)}},{key:"get",value:function e(t,r){var n=this.getKey(t);var a=this.getCache(n,r);if(a!=null){this.updateKeyMappingFor(t)}return a}},{key:"getForCachedKey",value:function e(t,r){var n=this.keyForId.get(t.id());var a=this.getCache(n,r);return a}},{key:"hasCache",value:function e(t,r){return this.getCachesAt(r).has(t)}},{key:"has",value:function e(t,r){var n=this.getKey(t);return this.hasCache(n,r)}},{key:"setCache",value:function e(t,r,n){n.key=t;this.getCachesAt(r).set(t,n)}},{key:"set",value:function e(t,r,n){var a=this.getKey(t);this.setCache(a,r,n);this.updateKeyMappingFor(t)}},{key:"deleteCache",value:function e(t,r){this.getCachesAt(r)["delete"](t)}},{key:"delete",value:function e(t,r){var n=this.getKey(t);this.deleteCache(n,r)}},{key:"invalidateKey",value:function e(t){var r=this;this.lvls.forEach((function(e){return r.deleteCache(t,e)}))}},{key:"invalidate",value:function e(t){var r=t.id();var n=this.keyForId.get(r);this.deleteKeyMappingFor(t);var a=this.doesEleInvalidateKey(t);if(a){this.invalidateKey(n)}return a||this.getNumberOfIdsForKey(n)===0}}]);return e}();var rf=25;var nf=50;var af=-4;var of=3;var sf=7.99;var lf=8;var uf=1024;var cf=1024;var vf=1024;var ff=.2;var hf=.8;var df=10;var pf=.15;var gf=.1;var yf=.9;var mf=.9;var bf=100;var xf=1;var wf={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"};var Ef=zt({getKey:null,doesEleInvalidateKey:Nt,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ct,allowEdgeTxrCaching:true,allowParentTxrCaching:true});var Tf=function e(t,r){var n=this;n.renderer=t;n.onDequeues=[];var a=Ef(r);Q(n,a);n.lookup=new tf(a.getKey,a.doesEleInvalidateKey);n.setupDequeueing()};var _f=Tf.prototype;_f.reasons=wf;_f.getTextureQueue=function(e){var t=this;t.eleImgCaches=t.eleImgCaches||{};return t.eleImgCaches[e]=t.eleImgCaches[e]||[]};_f.getRetiredTextureQueue=function(e){var t=this;var r=t.eleImgCaches.retired=t.eleImgCaches.retired||{};var n=r[e]=r[e]||[];return n};_f.getElementQueue=function(){var e=this;var t=e.eleCacheQueue=e.eleCacheQueue||new er((function(e,t){return t.reqs-e.reqs}));return t};_f.getElementKeyToQueue=function(){var e=this;var t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t};_f.getElement=function(e,t,r,n,a){var i=this;var o=this.renderer;var s=o.cy.zoom();var l=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()){return null}if(!i.allowEdgeTxrCaching&&e.isEdge()||!i.allowParentTxrCaching&&e.isParent()){return null}if(n==null){n=Math.ceil(_r(s*r))}if(n=sf||n>of){return null}var u=Math.pow(2,n);var c=t.h*u;var v=t.w*u;var f=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,f)){return null}var h=l.get(e,n);if(h&&h.invalidated){h.invalidated=false;h.texture.invalidatedWidth-=h.width}if(h){return h}var d;if(c<=rf){d=rf}else if(c<=nf){d=nf}else{d=Math.ceil(c/nf)*nf}if(c>vf||v>cf){return null}var p=i.getTextureQueue(d);var g=p[p.length-2];var y=function e(){return i.recycleTexture(d,v)||i.addTexture(d,v)};if(!g){g=p[p.length-1]}if(!g){g=y()}if(g.width-g.usedWidthn;N--){D=i.getElement(e,t,r,N,wf.downscale)}C()}else{i.queueElement(e,E.level-1);return E}}else{var A;if(!b&&!x&&!w){for(var L=n-1;L>=af;L--){var I=l.get(e,L);if(I){A=I;break}}}if(m(A)){i.queueElement(e,n);return A}g.context.translate(g.usedWidth,0);g.context.scale(u,u);this.drawElement(g.context,e,t,f,false);g.context.scale(1/u,1/u);g.context.translate(-g.usedWidth,0)}h={x:g.usedWidth,texture:g,level:n,scale:u,width:v,height:c,scaledLabelShown:f};g.usedWidth+=Math.ceil(v+lf);g.eleCaches.push(h);l.set(e,n,h);i.checkTextureFullness(g);return h};_f.invalidateElements=function(e){for(var t=0;t=ff*e.width){this.retireTexture(e)}};_f.checkTextureFullness=function(e){var t=this;var r=t.getTextureQueue(e.height);if(e.usedWidth/e.width>hf&&e.fullnessChecks>=df){Gt(r,e)}else{e.fullnessChecks++}};_f.retireTexture=function(e){var t=this;var r=e.height;var n=t.getTextureQueue(r);var a=this.lookup;Gt(n,e);e.retired=true;var i=e.eleCaches;for(var o=0;o=t){o.retired=false;o.usedWidth=0;o.invalidatedWidth=0;o.fullnessChecks=0;Yt(o.eleCaches);o.context.setTransform(1,0,0,1,0,0);o.context.clearRect(0,0,o.width,o.height);Gt(a,o);n.push(o);return o}}};_f.queueElement=function(e,t){var r=this;var n=r.getElementQueue();var a=r.getElementKeyToQueue();var i=this.getKey(e);var o=a[i];if(o){o.level=Math.max(o.level,t);o.eles.merge(e);o.reqs++;n.updateItem(o)}else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(s);a[i]=s}};_f.dequeue=function(e){var t=this;var r=t.getElementQueue();var n=t.getElementKeyToQueue();var a=[];var i=t.lookup;for(var o=0;o0){var s=r.pop();var l=s.key;var u=s.eles[0];var c=i.hasCache(u,s.level);n[l]=null;if(c){continue}a.push(s);var v=t.getBoundingBox(u);t.getElement(u,v,e,s.level,wf.dequeue)}else{break}}return a};_f.removeFromQueue=function(e){var t=this;var r=t.getElementQueue();var n=t.getElementKeyToQueue();var a=this.getKey(e);var i=n[a];if(i!=null){if(i.eles.length===1){i.reqs=Dt;r.updateItem(i);r.pop();n[a]=null}else{i.eles.unmerge(e)}}};_f.onDequeue=function(e){this.onDequeues.push(e)};_f.offDequeue=function(e){Gt(this.onDequeues,e)};_f.setupDequeueing=ef.setupDequeueing({deqRedrawThreshold:bf,deqCost:pf,deqAvgCost:gf,deqNoDrawCost:yf,deqFastCost:mf,deq:function e(t,r,n){return t.dequeue(r,n)},onDeqd:function e(t,r){for(var n=0;n=Af||r>Nf){return null}}n.validateLayersElesOrdering(r,e);var l=n.layersByLevel;var u=Math.pow(2,r);var c=l[r]=l[r]||[];var v;var f=n.levelIsComplete(r,e);var h;var d=function t(){var a=function t(r){n.validateLayersElesOrdering(r,e);if(n.levelIsComplete(r,e)){h=l[r];return true}};var i=function e(t){if(h){return}for(var n=r+t;Cf<=n&&n<=Nf;n+=t){if(a(n)){break}}};i(+1);i(-1);for(var o=c.length-1;o>=0;o--){var s=c[o];if(s.invalid){Gt(c,s)}}};if(!f){d()}else{return c}var p=function t(){if(!v){v=Or();for(var r=0;rBf){return null}var o=n.makeLayer(v,r);if(a!=null){var s=c.indexOf(a)+1;c.splice(s,0,o)}else if(t.insert===undefined||t.insert){c.unshift(o)}return o};if(n.skipping&&!s){return null}var y=null;var m=e.length/Df;var b=!s;for(var x=0;x=m||!Ur(y.bb,w.boundingBox())){y=g({insert:true,after:y});if(!y){return null}}if(h||b){n.queueLayer(y,w)}else{n.drawEleInLayer(y,w,r,t)}y.eles.push(w);T[r]=y}if(h){return h}if(b){return null}return c};Gf.getEleLevelForLayerLevel=function(e,t){return e};Gf.drawEleInLayer=function(e,t,r,n){var a=this;var i=this.renderer;var o=e.context;var s=t.boundingBox();if(s.w===0||s.h===0||!t.visible()){return}r=a.getEleLevelForLayerLevel(r,n);{i.setImgSmoothing(o,false)}{i.drawCachedElement(o,t,null,null,r,Ff)}{i.setImgSmoothing(o,true)}};Gf.levelIsComplete=function(e,t){var r=this;var n=r.layersByLevel[e];if(!n||n.length===0){return false}var a=0;for(var i=0;i0){return false}if(o.invalid){return false}a+=o.eles.length}if(a!==t.length){return false}return true};Gf.validateLayersElesOrdering=function(e,t){var r=this.layersByLevel[e];if(!r){return}for(var n=0;n0){t=true;break}}return t};Gf.invalidateElements=function(e){var t=this;if(e.length===0){return}t.lastInvalidationTime=lt();if(e.length===0||!t.haveLayers()){return}t.updateElementsInLayers(e,(function e(r,n,a){t.invalidateLayer(r)}))};Gf.invalidateLayer=function(e){this.lastInvalidationTime=lt();if(e.invalid){return}var t=e.level;var r=e.eles;var n=this.layersByLevel[t];Gt(n,e);e.elesQueue=[];e.invalid=true;if(e.replacement){e.replacement.invalid=true}for(var a=0;a3&&arguments[3]!==undefined?arguments[3]:true;var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var i=arguments.length>5&&arguments[5]!==undefined?arguments[5]:true;var o=this;var s=t._private.rscratch;if(i&&!t.visible()){return}if(s.badLine||s.allpts==null||isNaN(s.allpts[0])){return}var l;if(r){l=r;e.translate(-l.x1,-l.y1)}var u=i?t.pstyle("opacity").value:1;var c=i?t.pstyle("line-opacity").value:1;var v=t.pstyle("curve-style").value;var f=t.pstyle("line-style").value;var h=t.pstyle("width").pfValue;var d=t.pstyle("line-cap").value;var p=u*c;var g=u*c;var y=function r(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:p;if(v==="straight-triangle"){o.eleStrokeStyle(e,t,n);o.drawEdgeTrianglePath(t,e,s.allpts)}else{e.lineWidth=h;e.lineCap=d;o.eleStrokeStyle(e,t,n);o.drawEdgePath(t,e,s.allpts,f);e.lineCap="butt"}};var m=function r(){if(!a){return}o.drawEdgeOverlay(e,t)};var b=function r(){if(!a){return}o.drawEdgeUnderlay(e,t)};var x=function r(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:g;o.drawArrowheads(e,t,n)};var w=function r(){o.drawElementText(e,t,null,n)};e.lineJoin="round";var E=t.pstyle("ghost").value==="yes";if(E){var T=t.pstyle("ghost-offset-x").pfValue;var _=t.pstyle("ghost-offset-y").pfValue;var D=t.pstyle("ghost-opacity").value;var C=p*D;e.translate(T,_);y(C);x(C);e.translate(-T,-_)}b();y();x();m();w();if(r){e.translate(l.x1,l.y1)}};var ah=function e(t){if(!["overlay","underlay"].includes(t)){throw new Error("Invalid state")}return function(e,r){if(!r.visible()){return}var n=r.pstyle("".concat(t,"-opacity")).value;if(n===0){return}var a=this;var i=a.usePaths();var o=r._private.rscratch;var s=r.pstyle("".concat(t,"-padding")).pfValue;var l=2*s;var u=r.pstyle("".concat(t,"-color")).value;e.lineWidth=l;if(o.edgeType==="self"&&!i){e.lineCap="butt"}else{e.lineCap="round"}a.colorStrokeStyle(e,u[0],u[1],u[2],n);a.drawEdgePath(r,e,o.allpts,"solid")}};nh.drawEdgeOverlay=ah("overlay");nh.drawEdgeUnderlay=ah("underlay");nh.drawEdgePath=function(e,t,r,n){var a=e._private.rscratch;var i=t;var o;var s=false;var l=this.usePaths();var u=e.pstyle("line-dash-pattern").pfValue;var c=e.pstyle("line-dash-offset").pfValue;if(l){var v=r.join("$");var f=a.pathCacheKey&&a.pathCacheKey===v;if(f){o=t=a.pathCache;s=true}else{o=t=new Path2D;a.pathCacheKey=v;a.pathCache=o}}if(i.setLineDash){switch(n){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u);i.lineDashOffset=c;break;case"solid":i.setLineDash([]);break}}if(!s&&!a.badLine){if(t.beginPath){t.beginPath()}t.moveTo(r[0],r[1]);switch(a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+35&&arguments[5]!==undefined?arguments[5]:true;var o=this;if(n==null){if(i&&!o.eleTextBiggerThanMin(t)){return}}else if(n===false){return}if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value){return}var l=o.getLabelJustification(t);e.textAlign=l;e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine;var c=t.pstyle("label");var v=t.pstyle("source-label");var f=t.pstyle("target-label");if(u||(!c||!c.value)&&(!v||!v.value)&&(!f||!f.value)){return}e.textAlign="center";e.textBaseline="bottom"}var h=!r;var d;if(r){d=r;e.translate(-d.x1,-d.y1)}if(a==null){o.drawText(e,t,null,h,i);if(t.isEdge()){o.drawText(e,t,"source",h,i);o.drawText(e,t,"target",h,i)}}else{o.drawText(e,t,a,h,i)}if(r){e.translate(d.x1,d.y1)}};oh.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var r=0;r2&&arguments[2]!==undefined?arguments[2]:true;var n=t.pstyle("font-style").strValue;var a=t.pstyle("font-size").pfValue+"px";var i=t.pstyle("font-family").strValue;var o=t.pstyle("font-weight").strValue;var s=r?t.effectiveOpacity()*t.pstyle("text-opacity").value:1;var l=t.pstyle("text-outline-opacity").value*s;var u=t.pstyle("color").value;var c=t.pstyle("text-outline-color").value;e.font=n+" "+o+" "+a+" "+i;e.lineJoin="round";this.colorFillStyle(e,u[0],u[1],u[2],s);this.colorStrokeStyle(e,c[0],c[1],c[2],l)};function sh(e,t,r,n,a){var i=arguments.length>5&&arguments[5]!==undefined?arguments[5]:5;e.beginPath();e.moveTo(t+i,r);e.lineTo(t+n-i,r);e.quadraticCurveTo(t+n,r,t+n,r+i);e.lineTo(t+n,r+a-i);e.quadraticCurveTo(t+n,r+a,t+n-i,r+a);e.lineTo(t+i,r+a);e.quadraticCurveTo(t,r+a,t,r+a-i);e.lineTo(t,r+i);e.quadraticCurveTo(t,r,t+i,r);e.closePath();e.fill()}oh.getTextAngle=function(e,t){var r;var n=e._private;var a=n.rscratch;var i=t?t+"-":"";var o=e.pstyle(i+"text-rotation");var s=Vt(a,"labelAngle",t);if(o.strValue==="autorotate"){r=e.isEdge()?s:0}else if(o.strValue==="none"){r=0}else{r=o.pfValue}return r};oh.drawText=function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var i=t._private;var o=i.rscratch;var s=a?t.effectiveOpacity():1;if(a&&(s===0||t.pstyle("text-opacity").value===0)){return}if(r==="main"){r=null}var l=Vt(o,"labelX",r);var u=Vt(o,"labelY",r);var c,v;var f=this.getLabelText(t,r);if(f!=null&&f!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(e,t,a);var h=r?r+"-":"";var d=Vt(o,"labelWidth",r);var p=Vt(o,"labelHeight",r);var g=t.pstyle(h+"text-margin-x").pfValue;var y=t.pstyle(h+"text-margin-y").pfValue;var m=t.isEdge();var b=t.pstyle("text-halign").value;var x=t.pstyle("text-valign").value;if(m){b="center";x="center"}l+=g;u+=y;var w;if(!n){w=0}else{w=this.getTextAngle(t,r)}if(w!==0){c=l;v=u;e.translate(c,v);e.rotate(w);l=0;u=0}switch(x){case"top":break;case"center":u+=p/2;break;case"bottom":u+=p;break}var E=t.pstyle("text-background-opacity").value;var T=t.pstyle("text-border-opacity").value;var _=t.pstyle("text-border-width").pfValue;var D=t.pstyle("text-background-padding").pfValue;if(E>0||_>0&&T>0){var C=l-D;switch(b){case"left":C-=d;break;case"center":C-=d/2;break}var N=u-p-D;var A=d+2*D;var L=p+2*D;if(E>0){var I=e.fillStyle;var S=t.pstyle("text-background-color").value;e.fillStyle="rgba("+S[0]+","+S[1]+","+S[2]+","+E*s+")";var k=t.pstyle("text-background-shape").strValue;if(k.indexOf("round")===0){sh(e,C,N,A,L,2)}else{e.fillRect(C,N,A,L)}e.fillStyle=I}if(_>0&&T>0){var O=e.strokeStyle;var M=e.lineWidth;var P=t.pstyle("text-border-color").value;var R=t.pstyle("text-border-style").value;e.strokeStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+T*s+")";e.lineWidth=_;if(e.setLineDash){switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=_/4;e.setLineDash([]);break;case"solid":e.setLineDash([]);break}}e.strokeRect(C,N,A,L);if(R==="double"){var B=_/2;e.strokeRect(C+B,N+B,A-B*2,L-B*2)}if(e.setLineDash){e.setLineDash([])}e.lineWidth=M;e.strokeStyle=O}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0){e.lineWidth=F}if(t.pstyle("text-wrap").value==="wrap"){var z=Vt(o,"labelWrapCachedLines",r);var G=Vt(o,"labelLineHeight",r);var Y=d/2;var X=this.getLabelJustification(t);if(X==="auto");else if(b==="left"){if(X==="left"){l+=-d}else if(X==="center"){l+=-Y}}else if(b==="center"){if(X==="left"){l+=-Y}else if(X==="right"){l+=Y}}else if(b==="right"){if(X==="center"){l+=Y}else if(X==="right"){l+=d}}switch(x){case"top":u-=(z.length-1)*G;break;case"center":case"bottom":u-=(z.length-1)*G;break}for(var V=0;V0){e.strokeText(z[V],l,u)}e.fillText(z[V],l,u);u+=G}}else{if(F>0){e.strokeText(f,l,u)}e.fillText(f,l,u)}if(w!==0){e.rotate(-w);e.translate(-c,-v)}}};var lh={};lh.drawNode=function(e,t,r){var n=arguments.length>3&&arguments[3]!==undefined?arguments[3]:true;var a=arguments.length>4&&arguments[4]!==undefined?arguments[4]:true;var i=arguments.length>5&&arguments[5]!==undefined?arguments[5]:true;var o=this;var s,l;var u=t._private;var c=u.rscratch;var v=t.position();if(!_(v.x)||!_(v.y)){return}if(i&&!t.visible()){return}var f=i?t.effectiveOpacity():1;var h=o.usePaths();var d;var p=false;var g=t.padding();s=t.width()+2*g;l=t.height()+2*g;var y;if(r){y=r;e.translate(-y.x1,-y.y1)}var m=t.pstyle("background-image");var b=m.value;var x=new Array(b.length);var w=new Array(b.length);var E=0;for(var T=0;T0&&arguments[0]!==undefined?arguments[0]:I;o.eleFillStyle(e,t,n)};var P=function t(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:O;o.colorStrokeStyle(e,S[0],S[1],S[2],r)};var R=t.pstyle("shape").strValue;var B=t.pstyle("shape-polygon-points").pfValue;if(h){e.translate(v.x,v.y);var F=o.nodePathCache=o.nodePathCache||[];var z=xt(R==="polygon"?R+","+B.join(","):R,""+l,""+s);var G=F[z];if(G!=null){d=G;p=true;c.pathCache=d}else{d=new Path2D;F[z]=c.pathCache=d}}var Y=function r(){if(!p){var n=v;if(h){n={x:0,y:0}}o.nodeShapes[o.getNodeShape(t)].draw(d||e,n.x,n.y,s,l)}if(h){e.fill(d)}else{e.fill()}};var X=function r(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:f;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var i=u.backgrounding;var s=0;for(var l=0;l0&&arguments[0]!==undefined?arguments[0]:false;var a=arguments.length>1&&arguments[1]!==undefined?arguments[1]:f;if(o.hasPie(t)){o.drawPie(e,t,a);if(n){if(!h){o.nodeShapes[o.getNodeShape(t)].draw(e,v.x,v.y,s,l)}}}};var U=function t(){var r=arguments.length>0&&arguments[0]!==undefined?arguments[0]:f;var n=(A>0?A:-A)*r;var a=A>0?0:255;if(A!==0){o.colorFillStyle(e,a,a,a,n);if(h){e.fill(d)}else{e.fill()}}};var j=function t(){if(L>0){e.lineWidth=L;e.lineCap="butt";if(e.setLineDash){switch(k){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}}if(h){e.stroke(d)}else{e.stroke()}if(k==="double"){e.lineWidth=L/3;var r=e.globalCompositeOperation;e.globalCompositeOperation="destination-out";if(h){e.stroke(d)}else{e.stroke()}e.globalCompositeOperation=r}if(e.setLineDash){e.setLineDash([])}}};var H=function r(){if(a){o.drawNodeOverlay(e,t,v,s,l)}};var q=function r(){if(a){o.drawNodeUnderlay(e,t,v,s,l)}};var W=function r(){o.drawElementText(e,t,null,n)};var $=t.pstyle("ghost").value==="yes";if($){var K=t.pstyle("ghost-offset-x").pfValue;var Z=t.pstyle("ghost-offset-y").pfValue;var Q=t.pstyle("ghost-opacity").value;var J=Q*f;e.translate(K,Z);M(Q*I);Y();X(J,true);P(Q*O);j();V(A!==0||L!==0);X(J,false);U(J);e.translate(-K,-Z)}if(h){e.translate(-v.x,-v.y)}q();if(h){e.translate(v.x,v.y)}M();Y();X(f,true);P();j();V(A!==0||L!==0);X(f,false);U();if(h){e.translate(-v.x,-v.y)}W();H();if(r){e.translate(y.x1,y.y1)}};var uh=function e(t){if(!["overlay","underlay"].includes(t)){throw new Error("Invalid state")}return function(e,r,n,a,i){var o=this;if(!r.visible()){return}var s=r.pstyle("".concat(t,"-padding")).pfValue;var l=r.pstyle("".concat(t,"-opacity")).value;var u=r.pstyle("".concat(t,"-color")).value;var c=r.pstyle("".concat(t,"-shape")).value;if(l>0){n=n||r.position();if(a==null||i==null){var v=r.padding();a=r.width()+2*v;i=r.height()+2*v}o.colorFillStyle(e,u[0],u[1],u[2],l);o.nodeShapes[c].draw(e,n.x,n.y,a+s*2,i+s*2);e.fill()}}};lh.drawNodeOverlay=uh("overlay");lh.drawNodeUnderlay=uh("underlay");lh.hasPie=function(e){e=e[0];return e._private.hasPie};lh.drawPie=function(e,t,r,n){t=t[0];n=n||t.position();var a=t.cy().style();var i=t.pstyle("pie-size");var o=n.x;var s=n.y;var l=t.width();var u=t.height();var c=Math.min(l,u)/2;var v=0;var f=this.usePaths();if(f){o=0;s=0}if(i.units==="%"){c=c*i.pfValue}else if(i.pfValue!==undefined){c=i.pfValue/2}for(var h=1;h<=a.pieBackgroundN;h++){var d=t.pstyle("pie-"+h+"-background-size").value;var p=t.pstyle("pie-"+h+"-background-color").value;var g=t.pstyle("pie-"+h+"-background-opacity").value*r;var y=d/100;if(y+v>1){y=1-v}var m=1.5*Math.PI+2*Math.PI*v;var b=2*Math.PI*y;var x=m+b;if(d===0||v>=1||v+y>1){continue}e.beginPath();e.moveTo(o,s);e.arc(o,s,c,m,x);e.closePath();this.colorFillStyle(e,p[0],p[1],p[2],g);e.fill();v+=y}};var ch={};var vh=100;ch.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null){return this.forcedPixelRatio}var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t};ch.paintCache=function(e){var t=this.paintCaches=this.paintCaches||[];var r=true;var n;for(var a=0;ao.minMbLowQualFrames){o.motionBlurPxRatio=o.mbPxRBlurry}}if(o.clearingMotionBlur){o.motionBlurPxRatio=1}if(o.textureDrawLastFrame&&!v){c[o.NODE]=true;c[o.SELECT_BOX]=true}var m=l.style();var b=l.zoom();var x=a!==undefined?a:b;var w=l.pan();var E={x:w.x,y:w.y};var T={zoom:b,pan:{x:w.x,y:w.y}};var _=o.prevViewport;var D=_===undefined||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y;if(!D&&!(p&&!d)){o.motionBlurPxRatio=1}if(i){E=i}x*=s;E.x*=s;E.y*=s;var C=o.getCachedZSortedEles();function N(e,t,r,n,a){var i=e.globalCompositeOperation;e.globalCompositeOperation="destination-out";o.colorFillStyle(e,255,255,255,o.motionBlurTransparency);e.fillRect(t,r,n,a);e.globalCompositeOperation=i}function A(e,n){var s,l,c,v;if(!o.clearingMotionBlur&&(e===u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]||e===u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG])){s={x:w.x*h,y:w.y*h};l=b*h;c=o.canvasWidth*h;v=o.canvasHeight*h}else{s=E;l=x;c=o.canvasWidth;v=o.canvasHeight}e.setTransform(1,0,0,1,0,0);if(n==="motionBlur"){N(e,0,0,c,v)}else if(!t&&(n===undefined||n)){e.clearRect(0,0,c,v)}if(!r){e.translate(s.x,s.y);e.scale(l,l)}if(i){e.translate(i.x,i.y)}if(a){e.scale(a,a)}}if(!v){o.textureDrawLastFrame=false}if(v){o.textureDrawLastFrame=true;if(!o.textureCache){o.textureCache={};o.textureCache.bb=l.mutableElements().boundingBox();o.textureCache.texture=o.data.bufferCanvases[o.TEXTURE_BUFFER];var L=o.data.bufferContexts[o.TEXTURE_BUFFER];L.setTransform(1,0,0,1,0,0);L.clearRect(0,0,o.canvasWidth*o.textureMult,o.canvasHeight*o.textureMult);o.render({forcedContext:L,drawOnlyNodeLayer:true,forcedPxRatio:s*o.textureMult});var T=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};T.mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[o.DRAG]=false;c[o.NODE]=false;var I=u.contexts[o.NODE];var S=o.textureCache.texture;var T=o.textureCache.viewport;I.setTransform(1,0,0,1,0,0);if(f){N(I,0,0,T.width,T.height)}else{I.clearRect(0,0,T.width,T.height)}var k=m.core("outside-texture-bg-color").value;var O=m.core("outside-texture-bg-opacity").value;o.colorFillStyle(I,k[0],k[1],k[2],O);I.fillRect(0,0,T.width,T.height);var b=l.zoom();A(I,false);I.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/s,T.height/T.zoom/s);I.drawImage(S,T.mpan.x,T.mpan.y,T.width/T.zoom/s,T.height/T.zoom/s)}else if(o.textureOnViewport&&!t){o.textureCache=null}var M=l.extent();var P=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated();var R=o.hideEdgesOnViewport&&P;var B=[];B[o.NODE]=!c[o.NODE]&&f&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur;if(B[o.NODE]){o.clearedForMotionBlur[o.NODE]=true}B[o.DRAG]=!c[o.DRAG]&&f&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur;if(B[o.DRAG]){o.clearedForMotionBlur[o.DRAG]=true}if(c[o.NODE]||r||n||B[o.NODE]){var F=f&&!B[o.NODE]&&h!==1;var I=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]);var z=f&&!F?"motionBlur":undefined;A(I,z);if(R){o.drawCachedNodes(I,C.nondrag,s,M)}else{o.drawLayeredElements(I,C.nondrag,s,M)}if(o.debug){o.drawDebugPoints(I,C.nondrag)}if(!r&&!f){c[o.NODE]=false}}if(!n&&(c[o.DRAG]||r||B[o.DRAG])){var F=f&&!B[o.DRAG]&&h!==1;var I=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);A(I,f&&!F?"motionBlur":undefined);if(R){o.drawCachedNodes(I,C.drag,s,M)}else{o.drawCachedElements(I,C.drag,s,M)}if(o.debug){o.drawDebugPoints(I,C.drag)}if(!r&&!f){c[o.DRAG]=false}}if(o.showFps||!n&&c[o.SELECT_BOX]&&!r){var I=t||u.contexts[o.SELECT_BOX];A(I);if(o.selection[4]==1&&(o.hoverData.selecting||o.touchData.selecting)){var b=o.cy.zoom();var G=m.core("selection-box-border-width").value/b;I.lineWidth=G;I.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")";I.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]);if(G>0){I.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")";I.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1])}}if(u.bgActivePosistion&&!o.hoverData.selecting){var b=o.cy.zoom();var Y=u.bgActivePosistion;I.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")";I.beginPath();I.arc(Y.x,Y.y,m.core("active-bg-size").pfValue/b,0,2*Math.PI);I.fill()}var X=o.lastRedrawTime;if(o.showFps&&X){X=Math.round(X);var V=Math.round(1e3/X);I.setTransform(1,0,0,1,0,0);I.fillStyle="rgba(255, 0, 0, 0.75)";I.strokeStyle="rgba(255, 0, 0, 0.75)";I.lineWidth=1;I.fillText("1 frame = "+X+" ms = "+V+" fps",0,20);var U=60;I.strokeRect(0,30,250,20);I.fillRect(0,30,250*Math.min(V/U,1),20)}if(!r){c[o.SELECT_BOX]=false}}if(f&&h!==1){var j=u.contexts[o.NODE];var H=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE];var q=u.contexts[o.DRAG];var W=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG];var $=function e(t,r,n){t.setTransform(1,0,0,1,0,0);if(n||!y){t.clearRect(0,0,o.canvasWidth,o.canvasHeight)}else{N(t,0,0,o.canvasWidth,o.canvasHeight)}var a=h;t.drawImage(r,0,0,o.canvasWidth*a,o.canvasHeight*a,0,0,o.canvasWidth,o.canvasHeight)};if(c[o.NODE]||B[o.NODE]){$(j,H,B[o.NODE]);c[o.NODE]=false}if(c[o.DRAG]||B[o.DRAG]){$(q,W,B[o.DRAG]);c[o.DRAG]=false}}o.prevViewport=T;if(o.clearingMotionBlur){o.clearingMotionBlur=false;o.motionBlurCleared=true;o.motionBlur=true}if(f){o.motionBlurTimeout=setTimeout((function(){o.motionBlurTimeout=null;o.clearedForMotionBlur[o.NODE]=false;o.clearedForMotionBlur[o.DRAG]=false;o.motionBlur=false;o.clearingMotionBlur=!v;o.mbFrames=0;c[o.NODE]=true;c[o.DRAG]=true;o.redraw()}),vh)}if(!t){l.emit("render")}};var fh={};fh.drawPolygonPath=function(e,t,r,n,a,i){var o=n/2;var s=a/2;if(e.beginPath){e.beginPath()}e.moveTo(t+o*i[0],r+s*i[1]);for(var l=1;l0&&o>0){h.clearRect(0,0,i,o);h.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(e.full){h.translate(-n.x1*u,-n.y1*u);h.scale(u,u);this.drawElements(h,d);h.scale(1/u,1/u);h.translate(n.x1*u,n.y1*u)}else{var p=t.pan();var g={x:p.x*u,y:p.y*u};u*=t.zoom();h.translate(g.x,g.y);h.scale(u,u);this.drawElements(h,d);h.scale(1/u,1/u);h.translate(-g.x,-g.y)}if(e.bg){h.globalCompositeOperation="destination-over";h.fillStyle=e.bg;h.rect(0,0,i,o);h.fill()}}return f};function xh(e,t){var r=atob(e);var n=new ArrayBuffer(r.length);var a=new Uint8Array(n);for(var i=0;it){this.rect.x-=(this.labelWidth-t)/2;this.setWidth(this.labelWidth)}if(this.labelHeight>r){if(this.labelPos=="center"){this.rect.y-=(this.labelHeight-r)/2}else if(this.labelPos=="top"){this.rect.y-=this.labelHeight-r}this.setHeight(this.labelHeight)}}}};u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==a.MAX_VALUE){throw"assert failed"}return this.inclusionTreeDepth};u.prototype.transform=function(e){var t=this.rect.x;if(t>o.WORLD_BOUNDARY){t=o.WORLD_BOUNDARY}else if(t<-o.WORLD_BOUNDARY){t=-o.WORLD_BOUNDARY}var r=this.rect.y;if(r>o.WORLD_BOUNDARY){r=o.WORLD_BOUNDARY}else if(r<-o.WORLD_BOUNDARY){r=-o.WORLD_BOUNDARY}var n=new l(t,r);var a=e.inverseTransformPoint(n);this.setLocation(a.x,a.y)};u.prototype.getLeft=function(){return this.rect.x};u.prototype.getRight=function(){return this.rect.x+this.rect.width};u.prototype.getTop=function(){return this.rect.y};u.prototype.getBottom=function(){return this.rect.y+this.rect.height};u.prototype.getParent=function(){if(this.owner==null){return null}return this.owner.getParent()};e.exports=u},function(e,t,r){"use strict";function n(e,t){if(e==null&&t==null){this.x=0;this.y=0}else{this.x=e;this.y=t}}n.prototype.getX=function(){return this.x};n.prototype.getY=function(){return this.y};n.prototype.setX=function(e){this.x=e};n.prototype.setY=function(e){this.y=e};n.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)};n.prototype.getCopy=function(){return new n(this.x,this.y)};n.prototype.translate=function(e){this.x+=e.width;this.y+=e.height;return this};e.exports=n},function(e,t,r){"use strict";var n=r(2);var a=r(10);var i=r(0);var o=r(6);var s=r(3);var l=r(1);var u=r(13);var c=r(12);var v=r(11);function f(e,t,r){n.call(this,r);this.estimatedSize=a.MIN_VALUE;this.margin=i.DEFAULT_GRAPH_MARGIN;this.edges=[];this.nodes=[];this.isConnected=false;this.parent=e;if(t!=null&&t instanceof o){this.graphManager=t}else if(t!=null&&t instanceof Layout){this.graphManager=t.graphManager}}f.prototype=Object.create(n.prototype);for(var h in n){f[h]=n[h]}f.prototype.getNodes=function(){return this.nodes};f.prototype.getEdges=function(){return this.edges};f.prototype.getGraphManager=function(){return this.graphManager};f.prototype.getParent=function(){return this.parent};f.prototype.getLeft=function(){return this.left};f.prototype.getRight=function(){return this.right};f.prototype.getTop=function(){return this.top};f.prototype.getBottom=function(){return this.bottom};f.prototype.isConnected=function(){return this.isConnected};f.prototype.add=function(e,t,r){if(t==null&&r==null){var n=e;if(this.graphManager==null){throw"Graph has no graph mgr!"}if(this.getNodes().indexOf(n)>-1){throw"Node already in graph!"}n.owner=this;this.getNodes().push(n);return n}else{var a=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(r)>-1)){throw"Source or target not in graph!"}if(!(t.owner==r.owner&&t.owner==this)){throw"Both owners must be this graph!"}if(t.owner!=r.owner){return null}a.source=t;a.target=r;a.isInterGraph=false;this.getEdges().push(a);t.edges.push(a);if(r!=t){r.edges.push(a)}return a}};f.prototype.remove=function(e){var t=e;if(e instanceof s){if(t==null){throw"Node is null!"}if(!(t.owner!=null&&t.owner==this)){throw"Owner graph is invalid!"}if(this.graphManager==null){throw"Owner graph manager is invalid!"}var r=t.edges.slice();var n;var a=r.length;for(var i=0;i-1&&c>-1)){throw"Source and/or target doesn't know this edge!"}n.source.edges.splice(u,1);if(n.target!=n.source){n.target.edges.splice(c,1)}var o=n.source.owner.getEdges().indexOf(n);if(o==-1){throw"Not in owner's edge list!"}n.source.owner.getEdges().splice(o,1)}};f.prototype.updateLeftTop=function(){var e=a.MAX_VALUE;var t=a.MAX_VALUE;var r;var n;var i;var o=this.getNodes();var s=o.length;for(var l=0;lr){e=r}if(t>n){t=n}}if(e==a.MAX_VALUE){return null}if(o[0].getParent().paddingLeft!=undefined){i=o[0].getParent().paddingLeft}else{i=this.margin}this.left=t-i;this.top=e-i;return new c(this.left,this.top)};f.prototype.updateBounds=function(e){var t=a.MAX_VALUE;var r=-a.MAX_VALUE;var n=a.MAX_VALUE;var i=-a.MAX_VALUE;var o;var s;var l;var c;var v;var f=this.nodes;var h=f.length;for(var d=0;do){t=o}if(rl){n=l}if(io){t=o}if(rl){n=l}if(i=this.nodes.length){var f=0;r.forEach((function(t){if(t.owner==e){f++}}));if(f==this.nodes.length){this.isConnected=true}}};e.exports=f},function(e,t,r){"use strict";var n;var a=r(1);function i(e){n=r(5);this.layout=e;this.graphs=[];this.edges=[]}i.prototype.addRoot=function(){var e=this.layout.newGraph();var t=this.layout.newNode(null);var r=this.add(e,t);this.setRootGraph(r);return this.rootGraph};i.prototype.add=function(e,t,r,n,a){if(r==null&&n==null&&a==null){if(e==null){throw"Graph is null!"}if(t==null){throw"Parent node is null!"}if(this.graphs.indexOf(e)>-1){throw"Graph already in this graph mgr!"}this.graphs.push(e);if(e.parent!=null){throw"Already has a parent!"}if(t.child!=null){throw"Already has a child!"}e.parent=t;t.child=e;return e}else{a=r;n=t;r=e;var i=n.getOwner();var o=a.getOwner();if(!(i!=null&&i.getGraphManager()==this)){throw"Source not in this graph mgr!"}if(!(o!=null&&o.getGraphManager()==this)){throw"Target not in this graph mgr!"}if(i==o){r.isInterGraph=false;return i.add(r,n,a)}else{r.isInterGraph=true;r.source=n;r.target=a;if(this.edges.indexOf(r)>-1){throw"Edge already in inter-graph edge list!"}this.edges.push(r);if(!(r.source!=null&&r.target!=null)){throw"Edge source and/or target is null!"}if(!(r.source.edges.indexOf(r)==-1&&r.target.edges.indexOf(r)==-1)){throw"Edge already in source and/or target incidency list!"}r.source.edges.push(r);r.target.edges.push(r);return r}}};i.prototype.remove=function(e){if(e instanceof n){var t=e;if(t.getGraphManager()!=this){throw"Graph not in this graph mgr"}if(!(t==this.rootGraph||t.parent!=null&&t.parent.graphManager==this)){throw"Invalid parent node!"}var r=[];r=r.concat(t.getEdges());var i;var o=r.length;for(var s=0;s=t.getRight()){r[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight())}else if(t.getX()<=e.getX()&&t.getRight()>=e.getRight()){r[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())}if(e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()){r[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom())}else if(t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()){r[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom())}var i=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));if(t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()){i=1}var o=i*r[0];var s=r[1]/i;if(r[0]o){r[0]=n;r[1]=l;r[2]=i;r[3]=b;return false}else if(ai){r[0]=s;r[1]=a;r[2]=y;r[3]=o;return false}else if(ni){r[0]=c;r[1]=v;T=true}else{r[0]=u;r[1]=l;T=true}}else if(D===N){if(n>i){r[0]=s;r[1]=l;T=true}else{r[0]=f;r[1]=v;T=true}}if(-C===N){if(i>n){r[2]=m;r[3]=b;_=true}else{r[2]=y;r[3]=g;_=true}}else if(C===N){if(i>n){r[2]=p;r[3]=g;_=true}else{r[2]=x;r[3]=b;_=true}}if(T&&_){return false}if(n>i){if(a>o){A=this.getCardinalDirection(D,N,4);L=this.getCardinalDirection(C,N,2)}else{A=this.getCardinalDirection(-D,N,3);L=this.getCardinalDirection(-C,N,1)}}else{if(a>o){A=this.getCardinalDirection(-D,N,1);L=this.getCardinalDirection(-C,N,3)}else{A=this.getCardinalDirection(D,N,2);L=this.getCardinalDirection(C,N,4)}}if(!T){switch(A){case 1:S=l;I=n+-d/N;r[0]=I;r[1]=S;break;case 2:I=f;S=a+h*N;r[0]=I;r[1]=S;break;case 3:S=v;I=n+d/N;r[0]=I;r[1]=S;break;case 4:I=c;S=a+-h*N;r[0]=I;r[1]=S;break}}if(!_){switch(L){case 1:O=g;k=i+-E/N;r[2]=k;r[3]=O;break;case 2:k=x;O=o+w*N;r[2]=k;r[3]=O;break;case 3:O=b;k=i+E/N;r[2]=k;r[3]=O;break;case 4:k=m;O=o+-w*N;r[2]=k;r[3]=O;break}}}return false};a.getCardinalDirection=function(e,t,r){if(e>t){return r}else{return 1+r%4}};a.getIntersection=function(e,t,r,a){if(a==null){return this.getIntersection2(e,t,r)}var i=e.x;var o=e.y;var s=t.x;var l=t.y;var u=r.x;var c=r.y;var v=a.x;var f=a.y;var h=void 0,d=void 0;var p=void 0,g=void 0,y=void 0,m=void 0,b=void 0,x=void 0;var w=void 0;p=l-o;y=i-s;b=s*o-i*l;g=f-c;m=u-v;x=v*c-u*f;w=p*m-g*y;if(w===0){return null}h=(y*x-m*b)/w;d=(g*b-p*x)/w;return new n(h,d)};a.angleOfVector=function(e,t,r,n){var a=void 0;if(e!==r){a=Math.atan((n-t)/(r-e));if(r0){return 1}else if(e<0){return-1}else{return 0}};n.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)};n.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)};e.exports=n},function(e,t,r){"use strict";function n(){}n.MAX_VALUE=2147483647;n.MIN_VALUE=-2147483648;e.exports=n},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r0&&t){s.push(u[0]);while(s.length>0&&t){var c=s[0];s.splice(0,1);o.add(c);var v=c.getEdges();for(var i=0;i-1){u.splice(p,1)}}o=new Set;l=new Map}}return e};f.prototype.createDummyNodesForBendpoints=function(e){var t=[];var r=e.source;var n=this.graphManager.calcLowestCommonAncestor(e.source,e.target);for(var a=0;a0){var a=this.edgeToDummyNodes.get(r);for(var i=0;i=0){t.splice(v,1)}var f=s.getNeighborsList();f.forEach((function(e){if(r.indexOf(e)<0){var t=n.get(e);var a=t-1;if(a==1){u.push(e)}n.set(e,a)}}))}r=r.concat(u);if(t.length==1||t.length==2){a=true;i=t[0]}}return i};f.prototype.setGraphManager=function(e){this.graphManager=e};e.exports=f},function(e,t,r){"use strict";function n(){}n.seed=1;n.x=0;n.nextDouble=function(){n.x=Math.sin(n.seed++)*1e4;return n.x-Math.floor(n.x)};e.exports=n},function(e,t,r){"use strict";var n=r(4);function a(e,t){this.lworldOrgX=0;this.lworldOrgY=0;this.ldeviceOrgX=0;this.ldeviceOrgY=0;this.lworldExtX=1;this.lworldExtY=1;this.ldeviceExtX=1;this.ldeviceExtY=1}a.prototype.getWorldOrgX=function(){return this.lworldOrgX};a.prototype.setWorldOrgX=function(e){this.lworldOrgX=e};a.prototype.getWorldOrgY=function(){return this.lworldOrgY};a.prototype.setWorldOrgY=function(e){this.lworldOrgY=e};a.prototype.getWorldExtX=function(){return this.lworldExtX};a.prototype.setWorldExtX=function(e){this.lworldExtX=e};a.prototype.getWorldExtY=function(){return this.lworldExtY};a.prototype.setWorldExtY=function(e){this.lworldExtY=e};a.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX};a.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e};a.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY};a.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e};a.prototype.getDeviceExtX=function(){return this.ldeviceExtX};a.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e};a.prototype.getDeviceExtY=function(){return this.ldeviceExtY};a.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e};a.prototype.transformX=function(e){var t=0;var r=this.lworldExtX;if(r!=0){t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/r}return t};a.prototype.transformY=function(e){var t=0;var r=this.lworldExtY;if(r!=0){t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/r}return t};a.prototype.inverseTransformX=function(e){var t=0;var r=this.ldeviceExtX;if(r!=0){t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/r}return t};a.prototype.inverseTransformY=function(e){var t=0;var r=this.ldeviceExtY;if(r!=0){t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/r}return t};a.prototype.inverseTransformPoint=function(e){var t=new n(this.inverseTransformX(e.x),this.inverseTransformY(e.y));return t};e.exports=a},function(e,t,r){"use strict";function n(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);ti.ADAPTATION_LOWER_NODE_LIMIT){this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))}this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL}else{if(e>i.ADAPTATION_LOWER_NODE_LIMIT){this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR))}else{this.coolingFactor=1}this.initialCoolingFactor=this.coolingFactor;this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT}this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations);this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length;this.repulsionRange=this.calcRepulsionRange()};u.prototype.calcSpringForces=function(){var e=this.getAllEdges();var t;for(var r=0;r0&&arguments[0]!==undefined?arguments[0]:true;var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;var r,n;var a,o;var s=this.getAllNodes();var l;if(this.useFRGridVariant){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&e){this.updateGrid()}l=new Set;for(r=0;rl||s>l){e.gravitationForceX=-this.gravityConstant*a;e.gravitationForceY=-this.gravityConstant*i}}else{l=t.getEstimatedSize()*this.compoundGravityRangeFactor;if(o>l||s>l){e.gravitationForceX=-this.gravityConstant*a*this.compoundGravityConstant;e.gravitationForceY=-this.gravityConstant*i*this.compoundGravityConstant}}};u.prototype.isConverged=function(){var e;var t=false;if(this.totalIterations>this.maxIterations/3){t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2}e=this.totalDisplacement=l.length||c>=l[0].length)){for(var v=0;vt}}]);return e}();e.exports=o},function(e,t,r){"use strict";var n=function(){function e(e,t){for(var r=0;r2&&arguments[2]!==undefined?arguments[2]:1;var i=arguments.length>3&&arguments[3]!==undefined?arguments[3]:-1;var o=arguments.length>4&&arguments[4]!==undefined?arguments[4]:-1;a(this,e);this.sequence1=t;this.sequence2=r;this.match_score=n;this.mismatch_penalty=i;this.gap_penalty=o;this.iMax=t.length+1;this.jMax=r.length+1;this.grid=new Array(this.iMax);for(var s=0;s=0;r--){var n=this.listeners[r];if(n.event===e&&n.callback===t){this.listeners.splice(r,1)}}};a.emit=function(e,t){for(var r=0;r{"use strict";r.r(t);r.d(t,{diagram:()=>le});var n=r(23787);var a=r(34596);var i=r(73711);var o=r(71377);var s=r.n(o);var l=r(14607);var u=r.n(l);var c=r(80561);var v=r(23235);var f=r(61364);var h=r(27484);var d=r.n(h);var p=r(17967);var g=r(27856);var y=r.n(g);var m=function(){var e=function(e,t,r,n){for(r=r||{},n=e.length;n--;r[e[n]]=t);return r},t=[1,4],r=[1,13],n=[1,12],a=[1,15],i=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],v=[1,25],f=[6,7,11],h=[1,6,13,15,16,19,22],d=[1,33],p=[1,34],g=[1,6,7,11,13,15,16,19,22];var y={trace:function e(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function e(t,r,n,a,i,o,s){var l=o.length-1;switch(i){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",o[l].id);a.addNode(o[l-1].length,o[l].id,o[l].descr,o[l].type);break;case 16:a.getLogger().trace("Icon: ",o[l]);a.decorateNode({icon:o[l]});break;case 17:case 21:a.decorateNode({class:o[l]});break;case 18:a.getLogger().trace("SPACELIST");break;case 19:a.getLogger().trace("Node: ",o[l].id);a.addNode(0,o[l].id,o[l].descr,o[l].type);break;case 20:a.decorateNode({icon:o[l]});break;case 25:a.getLogger().trace("node found ..",o[l-2]);this.$={id:o[l-1],descr:o[l-1],type:a.getType(o[l-2],o[l])};break;case 26:this.$={id:o[l],descr:o[l],type:a.nodeType.DEFAULT};break;case 27:a.getLogger().trace("node found ..",o[l-3]);this.$={id:o[l-3],descr:o[l-1],type:a.getType(o[l-2],o[l])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:r,7:[1,10],9:9,12:11,13:n,14:14,15:a,16:i,17:17,18:18,19:o,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:r,12:21,13:n,14:14,15:a,16:i,17:17,18:18,19:o,22:s},{6:r,9:22,12:11,13:n,14:14,15:a,16:i,17:17,18:18,19:o,22:s},{6:u,7:c,10:23,11:v},e(f,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(f,[2,18]),e(f,[2,19]),e(f,[2,20]),e(f,[2,21]),e(f,[2,23]),e(f,[2,24]),e(f,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:v},{1:[2,7],6:r,12:21,13:n,14:14,15:a,16:i,17:17,18:18,19:o,22:s},e(h,[2,14],{7:d,11:p}),e(g,[2,8]),e(g,[2,9]),e(g,[2,10]),e(f,[2,15]),e(f,[2,16]),e(f,[2,17]),{20:[1,35]},{21:[1,36]},e(h,[2,13],{7:d,11:p}),e(g,[2,11]),e(g,[2,12]),{21:[1,37]},e(f,[2,25]),e(f,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function e(t,r){if(r.recoverable){this.trace(t)}else{var n=new Error(t);n.hash=r;throw n}},parse:function e(t){var r=this,n=[0],a=[],i=[null],o=[],s=this.table,l="",u=0,c=0,v=2,f=1;var h=o.slice.call(arguments,1);var d=Object.create(this.lexer);var p={yy:{}};for(var g in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,g)){p.yy[g]=this.yy[g]}}d.setInput(t,p.yy);p.yy.lexer=d;p.yy.parser=this;if(typeof d.yylloc=="undefined"){d.yylloc={}}var y=d.yylloc;o.push(y);var m=d.options&&d.options.ranges;if(typeof p.yy.parseError==="function"){this.parseError=p.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function b(){var e;e=a.pop()||d.lex()||f;if(typeof e!=="number"){if(e instanceof Array){a=e;e=a.pop()}e=r.symbols_[e]||e}return e}var x,w,E,T,_={},D,C,N,A;while(true){w=n[n.length-1];if(this.defaultActions[w]){E=this.defaultActions[w]}else{if(x===null||typeof x=="undefined"){x=b()}E=s[w]&&s[w][x]}if(typeof E==="undefined"||!E.length||!E[0]){var L="";A=[];for(D in s[w]){if(this.terminals_[D]&&D>v){A.push("'"+this.terminals_[D]+"'")}}if(d.showPosition){L="Parse error on line "+(u+1)+":\n"+d.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[x]||x)+"'"}else{L="Parse error on line "+(u+1)+": Unexpected "+(x==f?"end of input":"'"+(this.terminals_[x]||x)+"'")}this.parseError(L,{text:d.match,token:this.terminals_[x]||x,line:d.yylineno,loc:y,expected:A})}if(E[0]instanceof Array&&E.length>1){throw new Error("Parse Error: multiple actions possible at state: "+w+", token: "+x)}switch(E[0]){case 1:n.push(x);i.push(d.yytext);o.push(d.yylloc);n.push(E[1]);x=null;{c=d.yyleng;l=d.yytext;u=d.yylineno;y=d.yylloc}break;case 2:C=this.productions_[E[1]][1];_.$=i[i.length-C];_._$={first_line:o[o.length-(C||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(C||1)].first_column,last_column:o[o.length-1].last_column};if(m){_._$.range=[o[o.length-(C||1)].range[0],o[o.length-1].range[1]]}T=this.performAction.apply(_,[l,c,u,p.yy,E[1],i,o].concat(h));if(typeof T!=="undefined"){return T}if(C){n=n.slice(0,-1*C*2);i=i.slice(0,-1*C);o=o.slice(0,-1*C)}n.push(this.productions_[E[1]][0]);i.push(_.$);o.push(_._$);N=s[n[n.length-2]][n[n.length-1]];n.push(N);break;case 3:return true}}return true}};var m=function(){var e={EOF:1,parseError:function e(t,r){if(this.yy.parser){this.yy.parser.parseError(t,r)}else{throw new Error(t)}},setInput:function(e,t){this.yy=t||this.yy||{};this._input=e;this._more=this._backtrack=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var e=this._input[0];this.yytext+=e;this.yyleng++;this.offset++;this.match+=e;this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);if(t){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return e},unput:function(e){var t=e.length;var r=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-t);this.offset-=t;var n=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(r.length-1){this.yylineno-=r.length-1}var a=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===n.length?this.yylloc.first_column:0)+n[n.length-r.length].length-r[0].length:this.yylloc.first_column-t};if(this.options.ranges){this.yylloc.range=[a[0],a[0]+this.yyleng-t]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}return this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;if(e.length<20){e+=this._input.substr(0,20-e.length)}return(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput();var t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var r,n,a;if(this.options.backtrack_lexer){a={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done};if(this.options.ranges){a.yylloc.range=this.yylloc.range.slice(0)}}n=e[0].match(/(?:\r\n?|\n).*/g);if(n){this.yylineno+=n.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length};this.yytext+=e[0];this.match+=e[0];this.matches=e;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(e[0].length);this.matched+=e[0];r=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(r){return r}else if(this._backtrack){for(var i in a){this[i]=a[i]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var e,t,r,n;if(!this._more){this.yytext="";this.match=""}var a=this._currentRules();for(var i=0;it[0].length)){t=r;n=i;if(this.options.backtrack_lexer){e=this.test_match(r,a[i]);if(e!==false){return e}else if(this._backtrack){t=false;continue}else{return false}}else if(!this.options.flex){break}}}if(t){e=this.test_match(t,a[n]);if(e!==false){return e}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function e(){var t=this.next();if(t){return t}else{return this.lex()}},begin:function e(t){this.conditionStack.push(t)},popState:function e(){var t=this.conditionStack.length-1;if(t>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function e(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function e(t){t=this.conditionStack.length-1-Math.abs(t||0);if(t>=0){return this.conditionStack[t]}else{return"INITIAL"}},pushState:function e(t){this.begin(t)},stateStackSize:function e(){return this.conditionStack.length},options:{"case-insensitive":true},performAction:function e(t,r,n,a){switch(n){case 0:t.getLogger().trace("Found comment",r.yytext);return 6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:this.popState();return 16;case 4:this.popState();break;case 5:t.getLogger().trace("Begin icon");this.begin("ICON");break;case 6:t.getLogger().trace("SPACELINE");return 6;case 7:return 7;case 8:return 15;case 9:t.getLogger().trace("end icon");this.popState();break;case 10:t.getLogger().trace("Exploding node");this.begin("NODE");return 19;case 11:t.getLogger().trace("Cloud");this.begin("NODE");return 19;case 12:t.getLogger().trace("Explosion Bang");this.begin("NODE");return 19;case 13:t.getLogger().trace("Cloud Bang");this.begin("NODE");return 19;case 14:this.begin("NODE");return 19;case 15:this.begin("NODE");return 19;case 16:this.begin("NODE");return 19;case 17:this.begin("NODE");return 19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:t.getLogger().trace("Starting NSTR");this.begin("NSTR");break;case 25:t.getLogger().trace("description:",r.yytext);return"NODE_DESCR";case 26:this.popState();break;case 27:this.popState();t.getLogger().trace("node end ))");return"NODE_DEND";case 28:this.popState();t.getLogger().trace("node end )");return"NODE_DEND";case 29:this.popState();t.getLogger().trace("node end ...",r.yytext);return"NODE_DEND";case 30:this.popState();t.getLogger().trace("node end ((");return"NODE_DEND";case 31:this.popState();t.getLogger().trace("node end (-");return"NODE_DEND";case 32:this.popState();t.getLogger().trace("node end (-");return"NODE_DEND";case 33:this.popState();t.getLogger().trace("node end ((");return"NODE_DEND";case 34:this.popState();t.getLogger().trace("node end ((");return"NODE_DEND";case 35:t.getLogger().trace("Long description:",r.yytext);return 20;case 36:t.getLogger().trace("Long description:",r.yytext);return 20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:false},ICON:{rules:[8,9],inclusive:false},NSTR2:{rules:[22,23],inclusive:false},NSTR:{rules:[25,26],inclusive:false},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:false},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:true}}};return e}();y.lexer=m;function b(){this.yy={}}b.prototype=y;y.Parser=b;return new b}();m.parser=m;const b=m;const x=e=>(0,n.d)(e,(0,n.c)());let w=[];let E=0;let T={};const _=()=>{w=[];E=0;T={}};const D=function(e){for(let t=w.length-1;t>=0;t--){if(w[t].levelw.length>0?w[0]:null;const N=(e,t,r,a)=>{n.l.info("addNode",e,t,r,a);const i=(0,n.c)();const o={id:E++,nodeId:x(t),level:e,descr:x(r),type:a,children:[],width:(0,n.c)().mindmap.maxNodeWidth};switch(o.type){case A.ROUNDED_RECT:o.padding=2*i.mindmap.padding;break;case A.RECT:o.padding=2*i.mindmap.padding;break;case A.HEXAGON:o.padding=2*i.mindmap.padding;break;default:o.padding=i.mindmap.padding}const s=D(e);if(s){s.children.push(o);w.push(o)}else{if(w.length===0){w.push(o)}else{let e=new Error('There can be only one root. No parent could be found for ("'+o.descr+'")');e.hash={text:"branch "+name,token:"branch "+name,line:"1",loc:{first_line:1,last_line:1,first_column:1,last_column:1},expected:['"checkout '+name+'"']};throw e}}};const A={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6};const L=(e,t)=>{n.l.debug("In get type",e,t);switch(e){case"[":return A.RECT;case"(":return t===")"?A.ROUNDED_RECT:A.CLOUD;case"((":return A.CIRCLE;case")":return A.CLOUD;case"))":return A.BANG;case"{{":return A.HEXAGON;default:return A.DEFAULT}};const I=(e,t)=>{T[e]=t};const S=e=>{const t=w[w.length-1];if(e&&e.icon){t.icon=x(e.icon)}if(e&&e.class){t.class=x(e.class)}};const k=e=>{switch(e){case A.DEFAULT:return"no-border";case A.RECT:return"rect";case A.ROUNDED_RECT:return"rounded-rect";case A.CIRCLE:return"circle";case A.CLOUD:return"cloud";case A.BANG:return"bang";case A.HEXAGON:return"hexgon";default:return"no-border"}};let O;const M=e=>{O=e};const P=()=>n.l;const R=e=>w[e];const B=e=>T[e];const F=Object.freeze(Object.defineProperty({__proto__:null,addNode:N,clear:_,decorateNode:S,getElementById:B,getLogger:P,getMindmap:C,getNodeById:R,getType:L,nodeType:A,get parseError(){return O},sanitizeText:x,setElementForId:I,setErrorHandler:M,type2Str:k},Symbol.toStringTag,{value:"Module"}));const z=12;const G=function(e,t,r){const n=5;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("d",`M0 ${t.height-n} v${-t.height+2*n} q0,-5 5,-5 h${t.width-2*n} q5,0 5,5 v${t.height-n} H0 Z`);e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)};const Y=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("height",t.height).attr("width",t.width)};const X=function(e,t){const r=t.width;const n=t.height;const a=.15*r;const i=.25*r;const o=.35*r;const s=.2*r;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("d",`M0 0 a${a},${a} 0 0,1 ${r*.25},${-1*r*.1}\n a${o},${o} 1 0,1 ${r*.4},${-1*r*.1}\n a${i},${i} 1 0,1 ${r*.35},${1*r*.2}\n\n a${a},${a} 1 0,1 ${r*.15},${1*n*.35}\n a${s},${s} 1 0,1 ${-1*r*.15},${1*n*.65}\n\n a${i},${a} 1 0,1 ${-1*r*.25},${r*.15}\n a${o},${o} 1 0,1 ${-1*r*.5},${0}\n a${a},${a} 1 0,1 ${-1*r*.25},${-1*r*.15}\n\n a${a},${a} 1 0,1 ${-1*r*.1},${-1*n*.35}\n a${s},${s} 1 0,1 ${r*.1},${-1*n*.65}\n\n H0 V0 Z`)};const V=function(e,t){const r=t.width;const n=t.height;const a=.15*r;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("d",`M0 0 a${a},${a} 1 0,0 ${r*.25},${-1*n*.1}\n a${a},${a} 1 0,0 ${r*.25},${0}\n a${a},${a} 1 0,0 ${r*.25},${0}\n a${a},${a} 1 0,0 ${r*.25},${1*n*.1}\n\n a${a},${a} 1 0,0 ${r*.15},${1*n*.33}\n a${a*.8},${a*.8} 1 0,0 ${0},${1*n*.34}\n a${a},${a} 1 0,0 ${-1*r*.15},${1*n*.33}\n\n a${a},${a} 1 0,0 ${-1*r*.25},${n*.15}\n a${a},${a} 1 0,0 ${-1*r*.25},${0}\n a${a},${a} 1 0,0 ${-1*r*.25},${0}\n a${a},${a} 1 0,0 ${-1*r*.25},${-1*n*.15}\n\n a${a},${a} 1 0,0 ${-1*r*.1},${-1*n*.33}\n a${a*.8},${a*.8} 1 0,0 ${0},${-1*n*.34}\n a${a},${a} 1 0,0 ${r*.1},${-1*n*.33}\n\n H0 V0 Z`)};const U=function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("r",t.width/2)};function j(e,t,r,n,a){return e.insert("polygon",":first-child").attr("points",n.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(a.width-t)/2+", "+r+")")}const H=function(e,t){const r=t.height;const n=4;const a=r/n;const i=t.width-t.padding+2*a;const o=[{x:a,y:0},{x:i-a,y:0},{x:i,y:-r/2},{x:i-a,y:-r},{x:a,y:-r},{x:0,y:-r/2}];j(e,i,r,o,t)};const q=function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+k(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)};const W=function(e,t,r,n){const a=n.htmlLabels;const o=r%(z-1);const s=e.append("g");t.section=o;let l="section-"+o;if(o<0){l+=" section-root"}s.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+l);const u=s.append("g");const c=s.append("g");const v=t.descr.replace(/()/g,"\n");(0,i.a)(c,v,{useHtmlLabels:a,width:t.width,classes:"mindmap-node-label"});if(!a){c.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle")}const f=c.node().getBBox();const h=n.fontSize.replace?n.fontSize.replace("px",""):n.fontSize;t.height=f.height+h*1.1*.5+t.padding;t.width=f.width+2*t.padding;if(t.icon){if(t.type===A.CIRCLE){t.height+=50;t.width+=50;const e=s.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;");e.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+o+" "+t.icon);c.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const r=Math.abs(t.height-e);const n=s.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+r/2+"px;");n.append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+o+" "+t.icon);c.attr("transform","translate("+(25+t.width/2)+", "+(r/2+t.padding/2)+")")}}else{if(!a){const e=t.width/2;const r=t.padding/2;c.attr("transform","translate("+e+", "+r+")")}else{const e=(t.width-f.width)/2;const r=(t.height-f.height)/2;c.attr("transform","translate("+e+", "+r+")")}}switch(t.type){case A.DEFAULT:G(u,t,o);break;case A.ROUNDED_RECT:q(u,t);break;case A.RECT:Y(u,t);break;case A.CIRCLE:u.attr("transform","translate("+t.width/2+", "+ +t.height/2+")");U(u,t);break;case A.CLOUD:X(u,t);break;case A.BANG:V(u,t);break;case A.HEXAGON:H(u,t);break}I(t.id,s);return t.height};const $=function e(t,r,n,a,i){const o=i%(z-1);const s=n.x+n.width/2;const l=n.y+n.height/2;const u=r.x+r.width/2;const c=r.y+r.height/2;const v=u>s?s+Math.abs(s-u)/2:s-Math.abs(s-u)/2;const f=c>l?l+Math.abs(l-c)/2:l-Math.abs(l-c)/2;const h=u>s?Math.abs(s-v)/2+s:-Math.abs(s-v)/2+s;const d=c>l?Math.abs(l-f)/2+l:-Math.abs(l-f)/2+l;t.append("path").attr("d",n.direction==="TB"||n.direction==="BT"?`M${s},${l} Q${s},${d} ${v},${f} T${u},${c}`:`M${s},${l} Q${h},${l} ${v},${f} T${u},${c}`).attr("class","edge section-edge-"+o+" edge-depth-"+a)};const K=function(e){const t=B(e.id);const r=e.x||0;const n=e.y||0;t.attr("transform","translate("+r+","+n+")")};const Z={drawNode:W,positionNode:K,drawEdge:$};s().use(u());function Q(e,t,r,n){Z.drawNode(e,t,r,n);if(t.children){t.children.forEach(((t,a)=>{Q(e,t,r<0?a:r,n)}))}}function J(e,t){t.edges().map(((t,r)=>{const a=t.data();if(t[0]._private.bodyBounds){const i=t[0]._private.rscratch;n.l.trace("Edge: ",r,a);e.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+a.section+" edge-depth-"+a.depth)}}))}function ee(e,t,r,n){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:n,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}});if(e.children){e.children.forEach((a=>{ee(a,t,r,n+1);t.add({group:"edges",data:{id:`${e.id}_${a.id}`,source:e.id,target:a.id,depth:n,section:a.section}})}))}}function te(e,t){return new Promise((r=>{const i=(0,a.Ys)("body").append("div").attr("id","cy").attr("style","display:none");const o=s()({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});i.remove();ee(e,o,t,0);o.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}}));o.layout({name:"cose-bilkent",quality:"proof",styleEnabled:false,animate:false}).run();o.ready((e=>{n.l.info("Ready",e);r(o)}))}))}function re(e){e.nodes().map(((e,t)=>{const r=e.data();r.x=e.position().x;r.y=e.position().y;Z.positionNode(r);const a=B(r.nodeId);n.l.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",r);a.attr("transform",`translate(${e.position().x-r.width/2}, ${e.position().y-r.height/2})`);a.attr("attr",`apa-${t})`)}))}const ne=async(e,t,r,i)=>{const o=(0,n.c)();o.htmlLabels=false;n.l.debug("Rendering mindmap diagram\n"+e,i.parser);const s=(0,n.c)().securityLevel;let l;if(s==="sandbox"){l=(0,a.Ys)("#i"+t)}const u=s==="sandbox"?(0,a.Ys)(l.nodes()[0].contentDocument.body):(0,a.Ys)("body");const c=u.select("#"+t);c.append("g");const v=i.db.getMindmap();const f=c.append("g");f.attr("class","mindmap-edges");const h=c.append("g");h.attr("class","mindmap-nodes");Q(h,v,-1,o);const d=await te(v,o);J(f,d);re(d);(0,n.o)(void 0,c,o.mindmap.padding,o.mindmap.useMaxWidth)};const ae={draw:ne};const ie=e=>{let t="";for(let r=0;r`\n .edge {\n stroke-width: 3;\n }\n ${ie(e)}\n .section-root rect, .section-root path, .section-root circle, .section-root polygon {\n fill: ${e.git0};\n }\n .section-root text {\n fill: ${e.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .mindmap-node-label {\n dy: 1em;\n alignment-baseline: middle;\n text-anchor: middle;\n dominant-baseline: middle;\n text-align: center;\n }\n`;const se=oe;const le={db:F,renderer:ae,parser:b,styles:se}}}]);