All Downloads are FREE. Search and download functionalities are using the official Maven repository.

webapp.mindmap-definition-307c710a.3579b90f.js Maven / Gradle / Ivy

function e(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var t=globalThis,n=t.parcelRequire3bab,r=n.register;r("8B8TC",function(t,r){e(t.exports,"diagram",()=>L);var i=n("4jcZX"),a=n("lsJox"),o=n("idWB7"),s=n("2YFJl"),l=n("fmBVZ"),u=n("c94qS"),h=n("75Ue8"),c=n("1Ez1E");n("eJNXH"),n("gngdn"),n("2ujND"),n("i8Fxz");var d=function(){var e=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],h=[1,24],c=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],f=[1,34],v=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace("Stop NL ");break;case 9:r.getLogger().trace("Stop EOF ");break;case 11:r.getLogger().trace("Stop NL2 ");break;case 12:r.getLogger().trace("Stop EOF2 ");break;case 15:r.getLogger().info("Node: ",a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace("Icon: ",a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace("SPACELIST");break;case 19:r.getLogger().trace("Node: ",a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace("node found ..",a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace("node found ..",a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])}}},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:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,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:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:u,7:h,10:23,11:c},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:h,10:32,11:c},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:g,11:f}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:g,11:f}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",l=0,u=0,h=a.slice.call(arguments,1),c=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);c.setInput(e,d.yy),d.yy.lexer=c,d.yy.parser=this,void 0===c.yylloc&&(c.yylloc={});var g=c.yylloc;a.push(g);var f=c.options&&c.options.ranges;"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var v,y,b,x,w,E,T,_,D={};;){if(y=n[n.length-1],this.defaultActions[y]?b=this.defaultActions[y]:(null==v&&(v=function(){var e;return"number"!=typeof(e=r.pop()||c.lex()||1)&&(e instanceof Array&&(e=(r=e).pop()),e=t.symbols_[e]||e),e}()),b=o[y]&&o[y][v]),void 0===b||!b.length||!b[0]){var C="";for(w in _=[],o[y])this.terminals_[w]&&w>2&&_.push("'"+this.terminals_[w]+"'");C=c.showPosition?"Parse error on line "+(l+1)+":\n"+c.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(C,{text:c.match,token:this.terminals_[v]||v,line:c.yylineno,loc:g,expected:_})}if(b[0]instanceof Array&&b.length>1)throw Error("Parse Error: multiple actions possible at state: "+y+", token: "+v);switch(b[0]){case 1:n.push(v),i.push(c.yytext),a.push(c.yylloc),n.push(b[1]),v=null,u=c.yyleng,s=c.yytext,l=c.yylineno,g=c.yylloc;break;case 2:if(E=this.productions_[b[1]][1],D.$=i[i.length-E],D._$={first_line:a[a.length-(E||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(E||1)].first_column,last_column:a[a.length-1].last_column},f&&(D._$.range=[a[a.length-(E||1)].range[0],a[a.length-1].range[1]]),void 0!==(x=this.performAction.apply(D,[s,u,l,d.yy,b[1],i,a].concat(h))))return x;E&&(n=n.slice(0,-1*E*2),i=i.slice(0,-1*E),a=a.slice(0,-1*E)),n.push(this.productions_[b[1]][0]),i.push(D.$),a.push(D._$),T=o[n[n.length-2]][n[n.length-1]],n.push(T);break;case 3:return!0}}return!0}};function b(){this.yy={}}return y.lexer={EOF:1,parseError:function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=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 r=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),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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})},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;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.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,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack)for(var a in i)this[a]=i[a];return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var e,t,n,r,i=this._currentRules(),a=0;at[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,i[a])))return e;if(!this._backtrack)return!1;t=!1;continue}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[r]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){return this.next()||this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},pushState:function(e){this.begin(e)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:return e.getLogger().trace("Found comment",t.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:case 26:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 24:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 27:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 30:case 33:case 34:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 31:case 32:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 35:case 36:return e.getLogger().trace("Long description:",t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}},b.prototype=y,y.Parser=b,new b}();d.parser=d;let p=[],g=0,f={},v=function(e){for(let t=p.length-1;t>=0;t--)if(p[t].level)/g,"\n");(0,l.a)(d,p,{useHtmlLabels:o,width:n.width,classes:"mindmap-node-label"}),o||d.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let g=d.node().getBBox(),[f]=(0,i.D)(a.fontSize);if(n.height=g.height+.55*f+n.padding,n.width=g.width+2*n.padding,n.icon){if(n.type===e.nodeType.CIRCLE)n.height+=50,n.width+=50,u.append("foreignObject").attr("height","50px").attr("width",n.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+n.icon),d.attr("transform","translate("+n.width/2+", "+(n.height/2-1.5*n.padding)+")");else{n.width+=50;let e=n.height;n.height=Math.max(e,60);let t=Math.abs(n.height-e);u.append("foreignObject").attr("width","60px").attr("height",n.height).attr("style","text-align: center;margin-top:"+t/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+n.icon),d.attr("transform","translate("+(25+n.width/2)+", "+(t/2+n.padding/2)+")")}}else if(o){let e=(n.width-g.width)/2,t=(n.height-g.height)/2;d.attr("transform","translate("+e+", "+t+")")}else{let e=n.width/2,t=n.padding/2;d.attr("transform","translate("+e+", "+t+")")}switch(n.type){case e.nodeType.DEFAULT:b(e,c,n,s);break;case e.nodeType.ROUNDED_RECT:D(e,c,n);break;case e.nodeType.RECT:x(e,c,n);break;case e.nodeType.CIRCLE:c.attr("transform","translate("+n.width/2+", "+ +n.height/2+")"),T(e,c,n);break;case e.nodeType.CLOUD:w(e,c,n);break;case e.nodeType.BANG:E(e,c,n);break;case e.nodeType.HEXAGON:_(e,c,n)}return e.setElementForId(n.id,u),n.height},N=function(e,t){let n=e.getElementById(t.id),r=t.x||0,i=t.y||0;n.attr("transform","translate("+r+","+i+")")};(0,a.default).use(o&&o.__esModule?o.default:o);let A=e=>{let t="";for(let t=0;t{p=[],g=0,f={}},addNode:(e,t,n,r)=>{var a,o;(0,i.l).info("addNode",e,t,n,r);let s=(0,i.c)(),l=(null==(a=s.mindmap)?void 0:a.padding)??i.B.mindmap.padding;switch(r){case y.ROUNDED_RECT:case y.RECT:case y.HEXAGON:l*=2}let u={id:g++,nodeId:(0,i.d)(t,s),level:e,descr:(0,i.d)(n,s),type:r,children:[],width:(null==(o=s.mindmap)?void 0:o.maxNodeWidth)??i.B.mindmap.maxNodeWidth,padding:l},h=v(e);if(h)h.children.push(u),p.push(u);else if(0===p.length)p.push(u);else throw Error('There can be only one root. No parent could be found for ("'+u.descr+'")')},getMindmap:()=>p.length>0?p[0]:null,nodeType:y,getType:(e,t)=>{switch((0,i.l).debug("In get type",e,t),e){case"[":return y.RECT;case"(":return")"===t?y.ROUNDED_RECT:y.CLOUD;case"((":return y.CIRCLE;case")":return y.CLOUD;case"))":return y.BANG;case"{{":return y.HEXAGON;default:return y.DEFAULT}},setElementForId:(e,t)=>{f[e]=t},decorateNode:e=>{if(!e)return;let t=(0,i.c)(),n=p[p.length-1];e.icon&&(n.icon=(0,i.d)(e.icon,t)),e.class&&(n.class=(0,i.d)(e.class,t))},type2Str:e=>{switch(e){case y.DEFAULT:return"no-border";case y.RECT:return"rect";case y.ROUNDED_RECT:return"rounded-rect";case y.CIRCLE:return"circle";case y.CLOUD:return"cloud";case y.BANG:return"bang";case y.HEXAGON:return"hexgon";default:return"no-border"}},getLogger:()=>i.l,getElementById:e=>f[e]},renderer:{draw:async(e,t,n,r)=>{var o,l;(0,i.l).debug("Rendering mindmap diagram\n"+e);let u=r.db,h=u.getMindmap();if(!h)return;let c=(0,i.c)();c.htmlLabels=!1;let d=(0,i.A)(t),p=d.append("g");p.attr("class","mindmap-edges");let g=d.append("g");g.attr("class","mindmap-nodes"),function e(t,n,r,i,a){C(t,n,r,i,a),r.children&&r.children.forEach((r,o)=>{e(t,n,r,i<0?o:i,a)})}(u,g,h,-1,c);let f=await new Promise(e=>{let t=(0,s.select)("body").append("div").attr("id","cy").attr("style","display:none"),n=(0,a.default)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});t.remove(),function e(t,n,r,i){n.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:i,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(a=>{e(a,n,r,i+1),n.add({group:"edges",data:{id:`${t.id}_${a.id}`,source:t.id,target:a.id,depth:i,section:a.section}})})}(h,n,c,0),n.nodes().forEach(function(e){e.layoutDimensions=()=>{let t=e.data();return{w:t.width,h:t.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(t=>{(0,i.l).info("Ready",t),e(n)})});(function(e,t){t.edges().map((t,n)=>{let r=t.data();if(t[0]._private.bodyBounds){let a=t[0]._private.rscratch;(0,i.l).trace("Edge: ",n,r),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+r.section+" edge-depth-"+r.depth)}})})(p,f),function(e,t){t.nodes().map((t,n)=>{let r=t.data();r.x=t.position().x,r.y=t.position().y,N(e,r);let a=e.getElementById(r.nodeId);(0,i.l).info("Id:",n,"Position: (",t.position().x,", ",t.position().y,")",r),a.attr("transform",`translate(${t.position().x-r.width/2}, ${t.position().y-r.height/2})`),a.attr("attr",`apa-${n})`)})}(u,f),(0,i.o)(void 0,d,(null==(o=c.mindmap)?void 0:o.padding)??i.B.mindmap.padding,(null==(l=c.mindmap)?void 0:l.useMaxWidth)??i.B.mindmap.useMaxWidth)}},parser:d,styles:e=>`
  .edge {
    stroke-width: 3;
  }
  ${A(e)}
  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {
    fill: ${e.git0};
  }
  .section-root text {
    fill: ${e.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .mindmap-node-label {
    dy: 1em;
    alignment-baseline: middle;
    text-anchor: middle;
    dominant-baseline: middle;
    text-align: center;
  }
`}}),r("lsJox",function(n,r){function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);nlE);var d,p,g,f,v,y,b="undefined"==typeof window?null:window,x=b?b.navigator:null;b&&b.document;var w=i(""),E=i({}),T=i(function(){}),_="undefined"==typeof HTMLElement?"undefined":i(HTMLElement),D=function(e){return e&&e.instanceString&&N(e.instanceString)?e.instanceString():null},C=function(e){return null!=e&&i(e)==w},N=function(e){return null!=e&&i(e)===T},A=function(e){return!I(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},L=function(e){return null!=e&&i(e)===E&&!A(e)&&e.constructor===Object},S=function(e){return null!=e&&i(e)===i(1)&&!isNaN(e)},O=function(e){if("undefined"!==_)return null!=e&&e instanceof HTMLElement},I=function(e){return k(e)||M(e)},k=function(e){return"collection"===D(e)&&e._private.single},M=function(e){return"collection"===D(e)&&!e._private.single},P=function(e){return"core"===D(e)},R=function(e){return"stylesheet"===D(e)},B=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},F=function(e){return null!=e&&i(e)===E&&N(e.then)},z=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},K=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var n,r,i,a,o,s,l,u,h=RegExp("^"+q+"$").exec(e);if(h){if((r=parseInt(h[1]))<0?r=(360- -1*r%360)%360:r>360&&(r%=360),r/=360,(i=parseFloat(h[2]))<0||i>100||(i/=100,(a=parseFloat(h[3]))<0||a>100)||(a/=100,void 0!==(o=h[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var c=a<.5?a*(1+i):a+i-a*i,d=2*a-c;s=Math.round(255*t(d,c,r+1/3)),l=Math.round(255*t(d,c,r)),u=Math.round(255*t(d,c,r-1/3))}n=[s,l,u,o]}return n},J=function(e){var t,n=RegExp("^"+j+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},ee={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},et=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=t||n<0||c&&r>=a}function f(){var e,n,r,i=el();if(g(i))return v(i);s=setTimeout(f,(e=i-l,n=i-u,r=t-e,c?eL(r,a-n):r))}function v(e){return(s=void 0,d&&r)?p(e):(r=i=void 0,o)}function y(){var e,n=el(),a=g(n);if(r=arguments,i=this,l=n,a){if(void 0===s)return u=e=l,s=setTimeout(f,t),h?p(e):o;if(c)return clearTimeout(s),s=setTimeout(f,t),p(l)}return void 0===s&&(s=setTimeout(f,t)),o}return t=eN(t)||0,er(n)&&(h=!!n.leading,a=(c="maxWait"in n)?eA(eN(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),y.cancel=function(){void 0!==s&&clearTimeout(s),u=0,r=l=i=s=void 0},y.flush=function(){return void 0===s?o:v(el())},y},eO=b?b.performance:null,eI=eO&&eO.now?function(){return eO.now()}:function(){return Date.now()},ek=function(){if(b){if(b.requestAnimationFrame)return function(e){b.requestAnimationFrame(e)};if(b.mozRequestAnimationFrame)return function(e){b.mozRequestAnimationFrame(e)};if(b.webkitRequestAnimationFrame)return function(e){b.webkitRequestAnimationFrame(e)};if(b.msRequestAnimationFrame)return function(e){b.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(eI())},1e3/60)}}(),eM=function(e){return ek(e)},eP=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,r=n;!(t=e.next()).done;)r=65599*r+t.value|0;return r},eR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},eB=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},eF=function(e){return 2097152*e[0]+e[1]},ez=function(e,t){return[eR(e[0],t[0]),eB(e[1],t[1])]},eG=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return eP({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},e6=function(e){e.splice(0,e.length)},e8=function(e,t){for(var n=0;n2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!P(e)){eQ("An element must have a core reference and parameters set");return}var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==r&&"edges"!==r){eQ("An element must be of type `nodes` or `edges`; you specified `"+r+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new ti,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];A(t.classes)?l=t.classes:C(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,h=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw Error("lo must be non-negative");for(null==a&&(a=e.length);io(t,e[s=r((i+a)/2)])?a=s:i=s+1;return[].splice.apply(e,[i,i-i].concat(t)),t},o=function(e,t,r){return null==r&&(r=n),e.push(t),g(e,0,e.length-1,r)},a=function(e,t){var r,i;return null==t&&(t=n),r=e.pop(),e.length?(i=e[0],e[0]=r,f(e,0,t)):i=r,i},l=function(e,t,r){var i;return null==r&&(r=n),i=e[0],e[0]=t,f(e,0,r),i},s=function(e,t,r){var i;return null==r&&(r=n),e.length&&0>r(e[0],t)&&(t=(i=[e[0],t])[0],e[0]=i[1],f(e,0,r)),t},i=function(e,t){var i,a,o,s,l,u;for(null==t&&(t=n),s=(function(){u=[];for(var t=0,n=r(e.length/2);0<=n?tn;0<=n?t++:t--)u.push(t);return u}).apply(this).reverse(),l=[],a=0,o=s.length;ar(o=g[c],s)&&(u(l,o,0,null,r),l.pop(),s=l[l.length-1]);return l}for(i(e,r),v=[],d=0,f=h(t,e.length);0<=f?df;0<=f?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t;){if(0>i(a,o=e[s=r-1>>1])){e[r]=o,r=s;continue}break}return e[r]=a},f=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;ir(e[i],e[s]))&&(i=s),e[t]=e[i],i=2*(t=i)+1;return e[t]=o,g(e,l,t,r)},t=function(){function e(e){this.cmp=null!=e?e:n,this.nodes=[]}return e.push=o,e.pop=a,e.replace=l,e.pushpop=s,e.heapify=i,e.updateItem=p,e.nlargest=c,e.nsmallest=d,e.prototype.push=function(e){return o(this.nodes,e,this.cmp)},e.prototype.pop=function(){return a(this.nodes,this.cmp)},e.prototype.peek=function(){return this.nodes[0]},e.prototype.contains=function(e){return -1!==this.nodes.indexOf(e)},e.prototype.replace=function(e){return l(this.nodes,e,this.cmp)},e.prototype.pushpop=function(e){return s(this.nodes,e,this.cmp)},e.prototype.heapify=function(){return i(this.nodes,this.cmp)},e.prototype.updateItem=function(e){return p(this.nodes,e,this.cmp)},e.prototype.clear=function(){return this.nodes=[]},e.prototype.empty=function(){return 0===this.nodes.length},e.prototype.size=function(){return this.nodes.length},e.prototype.clone=function(){var t;return(t=new e).nodes=this.nodes.slice(0),t},e.prototype.toArray=function(){return this.nodes.slice(0)},e.prototype.insert=e.prototype.push,e.prototype.top=e.prototype.peek,e.prototype.front=e.prototype.peek,e.prototype.has=e.prototype.contains,e.prototype.copy=e.prototype.clone,e}(),v=function(){return t},e.exports=v()}).call(ei)}(oV={exports:{}},oV.exports),oV.exports),tu=e4({root:null,weight:function(e){return 1},directed:!1}),th=e4({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),tc=e4({weight:function(e){return 1},directed:!1}),td=e4({weight:function(e){return 1},directed:!1,root:null}),tp=Math.sqrt(2),tg=function(e,t,n){0===n.length&&eQ("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],l=n.length-1;l>=0;l--){var u=n[l],h=u[1],c=u[2];(t[h]===o&&t[c]===s||t[h]===s&&t[c]===o)&&n.splice(l,1)}for(var d=0;dr;)t=tg(Math.floor(Math.random()*t.length),e,t),n--;return t},tv=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},ty=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},tm=function(e){return{x:e[0],y:e[1]}},tb=function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=!(arguments.length>5)||void 0===arguments[5]||arguments[5];r?e=e.slice(t,n):(n0&&e.splice(0,t));for(var o=0,s=e.length-1;s>=0;s--){var l=e[s];a?!isFinite(l)&&(e[s]=-1/0,o++):e.splice(s,1)}i&&e.sort(function(e,t){return e-t});var u=e.length,h=Math.floor(u/2);return u%2!=0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},tT=function(e,t){return Math.atan2(t,e)-Math.PI/2},t_=Math.log2||function(e){return Math.log(e)/Math.log(2)},tD=function(e){return e>0?1:e<0?-1:0},tC=function(e,t){return Math.sqrt(tN(e,t))},tN=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},tA=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},tM=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},tP=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},tR=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},tB=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tF=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=u(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},tz=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},tG=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2t.y2)&&!(t.y1>e.y2)},tY=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},tX=function(e,t){return tY(e,t.x1,t.y1)&&tY(e,t.x2,t.y2)},tV=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",h="auto"===u?nn(i,a):u,c=i/2,d=a/2,p=(h=Math.min(h,c,d))!==c,g=h!==d;if(p){var f=n-c+h-o,v=r-d-o,y=n+c-h+o;if((s=t4(e,t,n,r,f,v,y,v,!1)).length>0)return s}if(g){var b=n+c+o,x=r-d+h-o,w=r+d-h+o;if((s=t4(e,t,n,r,b,x,b,w,!1)).length>0)return s}if(p){var E=n-c+h-o,T=r+d+o,_=n+c-h+o;if((s=t4(e,t,n,r,E,T,_,T,!1)).length>0)return s}if(g){var D=n-c-o,C=r-d+h-o,N=r+d-h+o;if((s=t4(e,t,n,r,D,C,D,N,!1)).length>0)return s}var A=n-c+h,L=r-d+h;if((l=t5(e,t,n,r,A,L,h+o)).length>0&&l[0]<=A&&l[1]<=L)return[l[0],l[1]];var S=n+c-h,O=r-d+h;if((l=t5(e,t,n,r,S,O,h+o)).length>0&&l[0]>=S&&l[1]<=O)return[l[0],l[1]];var I=n+c-h,k=r+d-h;if((l=t5(e,t,n,r,I,k,h+o)).length>0&&l[0]>=I&&l[1]>=k)return[l[0],l[1]];var M=n-c+h,P=r+d-h;return(l=t5(e,t,n,r,M,P,h+o)).length>0&&l[0]<=M&&l[1]>=P?[l[0],l[1]]:[]},tU=function(e,t,n,r,i,a,o){var s=Math.min(n,i),l=Math.max(n,i),u=Math.min(r,a),h=Math.max(r,a);return s-o<=e&&e<=l+o&&u-o<=t&&t<=h+o},tj=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(eu.x2)&&!(tu.y2)},tH=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},tq=function(e,t,n,r,i){var a,o,s,l,u,h,c,d;if(0===e&&(e=1e-5),t/=e,n/=e,r/=e,a=(o=(3*n-t*t)/9)*o*o+(s=(-(27*r)+t*(9*n-t*t*2))/54)*s,i[1]=0,c=t/3,a>0){u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),h=(h=s-Math.sqrt(a))<0?-Math.pow(-h,1/3):Math.pow(h,1/3),i[0]=-c+u+h,c+=(u+h)/2,i[4]=i[2]=-c,c=Math.sqrt(3)*(-h+u)/2,i[3]=c,i[5]=-c;return}if(i[5]=i[3]=0,0===a){d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=-c+2*d,i[4]=i[2]=-(d+c);return}l=Math.acos(s/Math.sqrt(l=(o=-o)*o*o)),d=2*Math.sqrt(o),i[0]=-c+d*Math.cos(l/3),i[2]=-c+d*Math.cos((l+2*Math.PI)/3),i[4]=-c+d*Math.cos((l+4*Math.PI)/3)},tW=function(e,t,n,r,i,a,o,s){var l,u=[];tq(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var h=[],c=0;c<6;c+=2)1e-7>Math.abs(u[c+1])&&u[c]>=0&&u[c]<=1&&h.push(u[c]);h.push(1),h.push(0);for(var d=-1,p=0;p=0?ll?(e-i)*(e-i)+(t-a)*(t-a):u-c},tK=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e)||!(e>=a))&&(!(r<=e)||!(e<=a)))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},tZ=function(e,t,n,r,i,a,o,s,l){var u,h=Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var c=Math.cos(-u),d=Math.sin(-u),p=0;p0?tJ(t0(h,-l)):h)},tQ=function(e,t,n,r,i,a,o,s){for(var l=Array(2*n.length),u=0;u=0&&g<=1&&v.push(g),f>=0&&f<=1&&v.push(f),0===v.length)return[];var y=v[0]*s[0]+e,b=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,b]:[y,b,v[1]*s[0]+e,v[1]*s[1]+t]:[y,b]},t3=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},t4=function(e,t,n,r,i,a,o,s,l){var u=e-i,h=n-e,c=o-i,d=t-a,p=r-t,g=s-a,f=c*d-g*u,v=h*d-p*u,y=g*h-c*p;if(0!==y){var b=f/y,x=v/y;return -.001<=b&&b<=1.001&&-.001<=x&&x<=1.001?[e+b*h,t+b*p]:l?[e+b*h,t+b*p]:[]}return 0!==f&&0!==v?[]:t3(e,n,o)===o?[o,s]:t3(e,n,i)===i?[i,a]:t3(i,o,n)===n?[n,r]:[]},t9=function(e,t,n,r,i,a,o,s){var l,u,h,c,d,p,g=[],f=Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0?tJ(t0(f,-s)):f}else u=n;for(var b=0;b2){for(var p=[h[0],h[1]],g=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),f=1;fu&&(u=t)},get:function(e){return l[e]}},c=0;c0?b.edgesTo(y)[0]:y.edgesTo(b)[0]);c[y=y.id()]>c[f]+x&&(c[y]=c[f]+x,0>d.nodes.indexOf(y)?d.push(y):d.updateItem(y),u[y]=0,l[y]=[]),c[y]==c[f]+x&&(u[y]=u[y]+u[f],l[y].push(f))}else for(var w=0;w0;){for(var D=n.pop(),C=0;C0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},nE=function(e,t){for(var n=0;n5&&void 0!==arguments[5]?arguments[5]:nD,o=r,s=0;s=2?nO(e,t,n,0,nA,nL):nO(e,t,n,0,nN)},squaredEuclidean:function(e,t,n){return nO(e,t,n,0,nA)},manhattan:function(e,t,n){return nO(e,t,n,0,nN)},max:function(e,t,n){return nO(e,t,n,-1/0,nS)}};function nk(e,t,n,r,i,a){var o;return(o=N(e)?e:nI[e]||nI.euclidean,0===t&&N(e))?o(i,a):o(t,n,r,i,a)}nI["squared-euclidean"]=nI.squaredEuclidean,nI.squaredeuclidean=nI.squaredEuclidean;var nM=e4({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),nP=function(e){return nM(e)},nR=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)};return nk(e,r.length,a,function(e){return r[e](t)},n,t)},nB=function(e,t,n){for(var r=n.length,i=Array(r),a=Array(r),o=Array(t),s=null,l=0;ln)return!1;return!0},nY=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var h=0;h=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var g=t[s],f=t[r[s]];o="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=o,e.splice(f.index,1),t[g.key]=o;for(var v=0;vn[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]0&&r.push(i);return r},n9=function(e,t,n){for(var r=[],i=0;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;ul&&(s=u,l=h)}n[i]=a[s]}return n9(e,t,n)},n8=function(e){for(var t,n,r,i,a,o,s,l,u,h=this.cy(),c=this.nodes(),d=n5(e),p={},g=0;g=L?(S=L,L=I,O=k):I>S&&(S=I);for(var M=0;M0?1:0;C[u%d.minIterations*r+G]=Y,z+=Y}if(z>0&&(u>=d.minIterations-1||u==d.maxIterations-1)){for(var X=0,V=0;V1)}});var u=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(u),components:i}},rt=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach(function(e){var n=e.target().id();n===s||(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var h=l.edgesWith(l),c=l.merge(h);r.push(c),a=a.difference(c)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||o(n)}}),{cut:a,components:r}},rn={};[ts,{dijkstra:function(e){if(!L(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=tu(e),r=n.root,i=n.weight,a=n.directed,o=this,s=C(r)?this.filter(r)[0]:r[0],l={},u={},h={},c=this.byGroup(),d=c.nodes,p=c.edges;p.unmergeBy(function(e){return e.isLoop()});for(var g=function(e){return l[e.id()]},f=new tl(function(e,t){return g(e)-g(t)}),v=0;v0;){var b=f.pop(),x=g(b);if(h[b.id()]=x,x!==1/0)for(var w=b.neighborhood().intersect(d),E=0;E0)for(n.unshift(t);u[i];){var a=u[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=Array(i),o=function(e){for(var t=0;t0;){if(n=(t=f.pop()).id(),v.delete(n),w++,n===c){for(var E=[],T=o,_=c,D=b[_];E.unshift(T),null!=D&&E.unshift(D),null!=(T=y[_]);)D=b[_=T.id()];return{found:!0,distance:d[n],path:this.spawn(E),steps:w}}g[n]=!0;for(var C=t._private.edges,N=0;ND&&(d[_]=D,f[_]=T,v[_]=b),!i){var N=T*l+E;!i&&d[N]>D&&(d[N]=D,f[N]=E,v[N]=b)}}}for(var A=0;A1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],s=r;;){if(null==s)return t.spawn();var l=v(s),u=l.edge,h=l.pred;if(i.unshift(s[0]),s.same(n)&&i.length>0)break;null!=u&&i.unshift(u),s=h}return o.spawn(i)},hasNegativeWeightCycle:p,negativeWeightCycles:g}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy(function(e){return e.isLoop()});var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/tp);if(i<2){eQ("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],u=0;u1||o>1)&&(l=!0),u[r]=[],e.outgoers().forEach(function(e){e.isEdge()&&u[r].push(e.id())})}else h[r]=[void 0,e.target().id()]}):this.forEach(function(e){var r=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?l=!0:n=r:t=r),u[r]=[],e.connectedEdges().forEach(function(e){return u[r].push(e.id())})):h[r]=[e.source().id(),e.target().id()]});var c={found:!1,trail:void 0};if(l)return c;if(n&&t){if(s){if(r&&n!=r)return c;r=n}else{if(r&&n!=r&&t!=r)return c;r||(r=n)}}else r||(r=this[0].id());var d=function(e){for(var t,n,r,i=e,a=[e];u[i].length;)n=h[t=u[i].shift()][0],i!=(r=h[t][1])?(u[r]=u[r].filter(function(e){return e!=t}),i=r):s||i==n||(u[n]=u[n].filter(function(e){return e!=t}),i=n),a.unshift(t),a.unshift(i);return a},p=[],g=[];for(g=d(r);1!=g.length;)0==u[g[0]].length?(p.unshift(this.getElementById(g.shift())),p.unshift(this.getElementById(g.shift()))):g=d(g.shift()).concat(g);for(var f in p.unshift(this.getElementById(g.shift())),u)if(u[f].length)return c;return c.found=!0,c.trail=this.spawn(p,!0),c}},{hopcroftTarjanBiconnected:re,htbc:re,htb:re,hopcroftTarjanBiconnectedComponents:re},{tarjanStronglyConnected:rt,tsc:rt,tscc:rt,tarjanStronglyConnectedComponents:rt}].forEach(function(e){K(rn,e)});var rr=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};rr.prototype={fulfill:function(e){return ri(this,1,"fulfillValue",e)},reject:function(e){return ri(this,2,"rejectReason",e)},then:function(e,t){var n=new rr;return this.onFulfilled.push(rs(e,n,"fulfill")),this.onRejected.push(rs(t,n,"reject")),ra(this),n.proxy}};var ri=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,ra(e)),e},ra=function(e){1===e.state?ro(e,"onFulfilled",e.fulfillValue):2===e.state&&ro(e,"onRejected",e.rejectReason)},ro=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e-1},rM.prototype.set=function(e,t){var n=this.__data__,r=rI(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};var rP=rC(es,"Map"),rR=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e},rB=function(e,t){var n=e.__data__;return rR(t)?n["string"==typeof t?"string":"hash"]:n.map};function rF(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){A(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,r=[],i=0,a=this.length;i0&&this.spawn(r).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};ie.className=ie.classNames=ie.classes;var it={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:U,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};it.variable="(?:[\\w-.]|(?:\\\\"+it.metaChar+"))+",it.className="(?:[\\w-]|(?:\\\\"+it.metaChar+"))+",it.value=it.string+"|"+it.number,it.id=it.variable,function(){var e,t,n;for(n=0,e=it.comparatorOp.split("|");n=0||"="===t||(it.comparatorOp+="|\\!"+t)}();var ir=function(){return{checks:[]}},ii={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},ia=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*$(e.selector,t.selector)}),io=function(){for(var e,t={},n=0;n=0&&(t=t.replace("!",""),h=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":c=!0,r=e>n;break;case">=":c=!0,r=e>=n;break;case"<":c=!0,r=e0&&l.edgeCount>0)return e0("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return e0("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&e0("The selector `"+e+"` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return C(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case ii.GROUP:var l=e(s);return l.substring(0,l.length-1);case ii.DATA_COMPARE:return"["+r.field+n(e(r.operator))+t(s)+"]";case ii.DATA_BOOL:var u=r.operator,h=r.field;return"["+e(u)+h+"]";case ii.DATA_EXIST:return"["+r.field+"]";case ii.META_COMPARE:var c=r.operator;return"[["+r.field+n(e(c))+t(s)+"]]";case ii.STATE:return s;case ii.ID:return"#"+s;case ii.CLASS:return"."+s;case ii.PARENT:case ii.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case ii.ANCESTOR:case ii.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case ii.COMPOUND_SPLIT:var d=i(r.left,a),p=i(r.subject,a),g=i(r.right,a);return d+(d.length>0?" ":"")+p+g;case ii.TRUE:return""}},i=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)},"")},a="",o=0;o1&&o0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function iD(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1)||void 0===arguments[1]||arguments[1];return i_(this,e,t,iD)},iT.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return i_(this,e,t,iC)},iT.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return i_(this,e,t,iN)},iT.ancestors=iT.parents,(oW=o$={data:r8.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:r8.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:r8.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r8.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:r8.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:r8.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=oW.data,oW.removeAttr=oW.removeData;var iA={};function iL(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&!(!this.isNode()||this.removed())){for(var n=0,r=this[0],i=r._private.edges,a=0;at}),minIndegree:iS("indegree",function(e,t){return et}),minOutdegree:iS("outdegree",function(e,t){return et})}),K(iA,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0;h&&(u=u[0]);var c=h?u.position():{x:0,y:0};void 0!==t?l.position(e,t+c[e]):void 0!==i&&l.position({x:i.x+c.x,y:i.y+c.y})}else{var d=n.position(),p=o?n.parent():null,g=p&&p.length>0;g&&(p=p[0]);var f=g?p.position():{x:0,y:0};return(i={x:d.x-f.x,y:d.y-f.y},void 0===e)?i:i[e]}}else if(!a)return;return this}}).modelPosition=oK.point=oK.position,oK.modelPositions=oK.points=oK.positions,oK.renderedPoint=oK.renderedPosition,oK.relativePoint=oK.relativePosition,oQ=oJ={},oJ.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},oJ.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()&&this.forEachUp(function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}}),this},oJ.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var h=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(h=100*h/i.height.val);var c=y(i.width.val-a.w,s,l),d=c.biasDiff,p=c.biasComplementDiff,g=y(i.height.val-a.h,u,h),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"===n.units)switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if("px"===n.units)return n.pfValue;else return 0}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}(r),t.batching()||(i.compoundBoundsClean=!0))}return this};var ik=function(e){return e===1/0||e===-1/0?0:e},iM=function(e,t,n,r,i){r-t!=0&&i-n!=0&&null!=t&&null!=n&&null!=r&&null!=i&&(e.x1=te.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},iP=function(e,t){return null==t?e:iM(e,t.x1,t.y1,t.x2,t.y2)},iR=function(e,t,n){return e7(e,t,n)},iB=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,tB(u,1),iM(e,u.x1,u.y1,u.x2,u.y2)}}},iF=function(e,t,n){if(!t.cy().headless()){a=n?n+"-":"";var r=t._private,i=r.rstyle;if(t.pstyle(a+"label").strValue){var a,o,s,l,u,h=t.pstyle("text-halign"),c=t.pstyle("text-valign"),d=iR(i,"labelWidth",n),p=iR(i,"labelHeight",n),g=iR(i,"labelX",n),f=iR(i,"labelY",n),v=t.pstyle(a+"text-margin-x").pfValue,y=t.pstyle(a+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle(a+"text-rotation"),w=t.pstyle("text-outline-width").pfValue,E=t.pstyle("text-border-width").pfValue/2,T=t.pstyle("text-background-padding").pfValue,_=d/2,D=p/2;if(b)o=g-_,s=g+_,l=f-D,u=f+D;else{switch(h.value){case"left":o=g-d,s=g;break;case"center":o=g-_,s=g+_;break;case"right":o=g,s=g+d}switch(c.value){case"top":l=f-p,u=f;break;case"center":l=f-D,u=f+D;break;case"bottom":l=f,u=f+p}}o+=v-Math.max(w,E)-T-2,s+=v+Math.max(w,E)+T+2,l+=y-Math.max(w,E)-T-2,u+=y+Math.max(w,E)+T+2;var C=n||"main",N=r.labelBounds,A=N[C]=N[C]||{};A.x1=o,A.y1=l,A.x2=s,A.y2=u,A.w=s-o,A.h=u-l;var L=b&&"autorotate"===x.strValue,S=null!=x.pfValue&&0!==x.pfValue;if(L||S){var O=L?iR(r.rstyle,"labelAngle",n):x.pfValue,I=Math.cos(O),k=Math.sin(O),M=(o+s)/2,P=(l+u)/2;if(!b){switch(h.value){case"left":M=s;break;case"right":M=o}switch(c.value){case"top":P=u;break;case"bottom":P=l}}var R=function(e,t){return{x:(e-=M)*I-(t-=P)*k+M,y:e*k+t*I+P}},B=R(o,l),F=R(o,u),z=R(s,l),G=R(s,u);o=Math.min(B.x,F.x,z.x,G.x),s=Math.max(B.x,F.x,z.x,G.x),l=Math.min(B.y,F.y,z.y,G.y),u=Math.max(B.y,F.y,z.y,G.y)}var Y=C+"Rot",X=N[Y]=N[Y]||{};X.x1=o,X.y1=l,X.x2=s,X.y2=u,X.w=s-o,X.h=u-l,iM(e,o,l,s,u),iM(r.labelBounds.all,o,l,s,u)}return e}},iz=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,u=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,u=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,u=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,u=-(.5*o));var h=e.h*l-e.h,c=e.w*s-e.w;if(tF(e,[Math.ceil(h/2),Math.ceil(c/2)]),0!==u){var d,p=(d=u,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+d,y2:e.y2+d,w:e.w,h:e.h});tP(e,p)}}}},iG=function(e,t){var n=e._private.cy,r=n.styleEnabled(),i=n.headless(),a=tk(),o=e._private,s=e.isNode(),l=e.isEdge(),u=o.rstyle,h=s&&r?e.pstyle("bounds-expansion").pfValue:[0],c=function(e){return"none"!==e.pstyle("display").value},d=!r||c(e)&&(!l||c(e.source())&&c(e.target()));if(d){var p=0;r&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(p=e.pstyle("overlay-padding").value);var g=0;r&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(g=e.pstyle("underlay-padding").value);var f=Math.max(p,g),v=0;if(r&&(v=e.pstyle("width").pfValue/2),s&&t.includeNodes){var y=e.position();D=y.x,C=y.y;var b=e.outerWidth()/2,x=e.outerHeight()/2;w=D-b,E=D+b,iM(a,w,T=C-x,E,_=C+x),r&&t.includeOutlines&&iz(a,e)}else if(l&&t.includeEdges){if(r&&!i){var w,E,T,_,D,C,N,A=e.pstyle("curve-style").strValue;if(w=Math.min(u.srcX,u.midX,u.tgtX),E=Math.max(u.srcX,u.midX,u.tgtX),T=Math.min(u.srcY,u.midY,u.tgtY),_=Math.max(u.srcY,u.midY,u.tgtY),w-=v,E+=v,iM(a,w,T-=v,E,_+=v),"haystack"===A){var L=u.haystackPts;if(L&&2===L.length){if(w=L[0].x,T=L[0].y,E=L[1].x,_=L[1].y,w>E){var S=w;w=E,E=S}if(T>_){var O=T;T=_,_=O}iM(a,w-v,T-v,E+v,_+v)}}else if("bezier"===A||"unbundled-bezier"===A||A.endsWith("segments")||A.endsWith("taxi")){switch(A){case"bezier":case"unbundled-bezier":N=u.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":N=u.linePts}if(null!=N)for(var I=0;IE){var R=w;w=E,E=R}if(T>_){var B=T;T=_,_=B}w-=v,E+=v,iM(a,w,T-=v,E,_+=v)}}if(r&&t.includeEdges&&l&&(iB(a,e,"mid-source"),iB(a,e,"mid-target"),iB(a,e,"source"),iB(a,e,"target")),r&&"yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,z=e.pstyle("ghost-offset-y").pfValue;iM(a,a.x1+F,a.y1+z,a.x2+F,a.y2+z)}var G=o.bodyBounds=o.bodyBounds||{};tz(G,a),tF(G,h),tB(G,1),r&&(w=a.x1,E=a.x2,T=a.y1,_=a.y2,iM(a,w-f,T-f,E+f,_+f));var Y=o.overlayBounds=o.overlayBounds||{};tz(Y,a),tF(Y,h),tB(Y,1);var X=o.labelBounds=o.labelBounds||{};null!=X.all?tM(X.all):X.all=tk(),r&&t.includeLabels&&(t.includeMainLabels&&iF(a,e,null),l&&(t.includeSourceLabels&&iF(a,e,"source"),t.includeTargetLabels&&iF(a,e,"target")))}return a.x1=ik(a.x1),a.y1=ik(a.y1),a.x2=ik(a.x2),a.y2=ik(a.y2),a.w=ik(a.x2-a.x1),a.h=ik(a.y2-a.y1),a.w>0&&a.h>0&&d&&(tF(a,h),tB(a,1)),a},iY=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:i4,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},i6.removeAllListeners=function(){return this.removeListener("*")},i6.emit=i6.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,A(t)||(t=[t]),ae(this,function(e,a){null!=n&&(i=(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}]).length);for(var o=0;o1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&C(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=0;rr&&(r=o,n=a)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=0;i=0&&i1)||void 0===arguments[1]||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(L(e))r.applyBypass(this,e,!1),this.emitAndNotify("style");else if(C(e)){if(void 0===t){var i=this[0];return i?r.getStylePropertyValue(i,e):void 0}r.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var a=this[0];return a?r.getRawStyle(a):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var r=0;r0&&t.push(h[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),aE.neighbourhood=aE.neighborhood,aE.closedNeighbourhood=aE.closedNeighborhood,aE.openNeighbourhood=aE.openNeighborhood,K(aE,{source:iE(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:iE(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:aC({attr:"source"}),targets:aC({attr:"target"})}),K(aE,{edgesWith:iE(aN(),"edgesWith"),edgesTo:iE(aN({thisIsSrc:!0}),"edgesTo")}),K(aE,{connectedEdges:iE(function(e){for(var t=[],n=0;n0)return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),aE.componentsOf=aE.components;var aL=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e){eQ("A collection must have a reference to the core");return}var i=new tn,a=!1;if(t){if(t.length>0&&L(t[0])&&!k(t[0])){a=!0;for(var o=[],s=new ti,l=0,u=t.length;l0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),r=n._private,i=[],a=[],o=0,s=this.length;o0){for(var k,M,P=k.length===this.length?this:new aL(n,k),R=0;R0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],r={},i=this._private.cy,a=0,o=this.length;a0&&(e?x.emitAndNotify("remove"):t&&x.emit("remove"));for(var w=0;w1e-4&&Math.abs(f.v)>1e-4;);return p?function(e){return y[e*(y.length-1)|0]}:b}}(),aI=function(e,t,n,r){var i=/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function(e,t,n,r){var i="undefined"!=typeof Float32Array;if(4!=arguments.length)return!1;for(var a=0;a<4;++a)if("number"!=typeof arguments[a]||isNaN(arguments[a])||!isFinite(arguments[a]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var o=i?new Float32Array(11):Array(11);function s(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function l(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var u=!1,h=function(i){return(u||(u=!0,(e!==t||n!==r)&&function(){for(var t=0;t<11;++t)o[t]=s(.1*t,e,n)}()),e===t&&n===r)?i:0===i?0:1===i?1:s(function(t){for(var r=0,i=1;10!==i&&o[i]<=t;++i)r+=.1;var a=r+(t-o[--i])/(o[i+1]-o[i])*.1,u=l(a,e,n);return u>=.001?function(t,r){for(var i=0;i<4;++i){var a=l(r,e,n);if(0===a)break;var o=s(r,e,n)-t;r-=o/a}return r}(t,a):0===u?a:function(t,r,i){var a,o,l=0;do(a=s(o=r+(i-r)/2,e,n)-t)>0?i=o:r=o;while(Math.abs(a)>1e-7&&++l<10)return o}(t,r,r+.1)}(i),t,r)};h.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var c="generateBezier("+[e,t,n,r]+")";return h.toString=function(){return c},h}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},ak={linear:function(e,t,n){return e+(t-e)*n},ease:aI(.25,.1,.25,1),"ease-in":aI(.42,0,1,1),"ease-out":aI(0,0,.58,1),"ease-in-out":aI(.42,0,.58,1),"ease-in-sine":aI(.47,0,.745,.715),"ease-out-sine":aI(.39,.575,.565,1),"ease-in-out-sine":aI(.445,.05,.55,.95),"ease-in-quad":aI(.55,.085,.68,.53),"ease-out-quad":aI(.25,.46,.45,.94),"ease-in-out-quad":aI(.455,.03,.515,.955),"ease-in-cubic":aI(.55,.055,.675,.19),"ease-out-cubic":aI(.215,.61,.355,1),"ease-in-out-cubic":aI(.645,.045,.355,1),"ease-in-quart":aI(.895,.03,.685,.22),"ease-out-quart":aI(.165,.84,.44,1),"ease-in-out-quart":aI(.77,0,.175,1),"ease-in-quint":aI(.755,.05,.855,.06),"ease-out-quint":aI(.23,1,.32,1),"ease-in-out-quint":aI(.86,0,.07,1),"ease-in-expo":aI(.95,.05,.795,.035),"ease-out-expo":aI(.19,1,.22,1),"ease-in-out-expo":aI(1,0,0,1),"ease-in-circ":aI(.6,.04,.98,.335),"ease-out-circ":aI(.075,.82,.165,1),"ease-in-out-circ":aI(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return ak.linear;var r=aO(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":aI};function aM(e,t,n,r,i){if(1===r||t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function aP(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function aR(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=aP(e,i),s=aP(t,i);if(S(o)&&S(s))return aM(a,o,s,n,r);if(A(o)&&A(s)){for(var l=[],u=0;u=0;t--)(0,e[t])();e.splice(0,e.length)},h=a.length-1;h>=0;h--){var c=a[h],d=c._private;if(d.stopped){a.splice(h,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames);continue}(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||function(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}(0,c,e),function(e,t,n,r){var i,a,o,s,l=!r,u=e._private,h=t._private,c=h.easing,d=h.startTime,p=(r?e:e.cy()).style();h.easingImpl||(null==c?h.easingImpl=ak.linear:(i=C(c)?p.parse("transition-timing-function",c).value:c,C(i)?(a=i,o=[]):(a=i[1],o=i.slice(2).map(function(e){return+e})),o.length>0?("spring"===a&&o.push(h.duration),h.easingImpl=ak[a].apply(null,o)):h.easingImpl=ak[a]));var g=h.easingImpl;if(s=0===h.duration?1:(n-d)/h.duration,h.applying&&(s=h.progress),s<0?s=0:s>1&&(s=1),null==h.delay){var f=h.startPosition,v=h.position;if(v&&l&&!e.locked()){var y={};aB(f.x,v.x)&&(y.x=aR(f.x,v.x,s,g)),aB(f.y,v.y)&&(y.y=aR(f.y,v.y,s,g)),e.position(y)}var b=h.startPan,x=h.pan,w=u.pan,E=null!=x&&r;E&&(aB(b.x,x.x)&&(w.x=aR(b.x,x.x,s,g)),aB(b.y,x.y)&&(w.y=aR(b.y,x.y,s,g)),e.emit("pan"));var T=h.startZoom,_=h.zoom,D=null!=_&&r;D&&(aB(T,_)&&(u.zoom=tI(u.minZoom,aR(T,_,s,g),u.maxZoom)),e.emit("zoom")),(E||D)&&e.emit("viewport");var N=h.style;if(N&&N.length>0&&l){for(var A=0;A0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var az={animate:r8.animate(),animation:r8.animation(),animated:r8.animated(),clearQueue:r8.clearQueue(),delay:r8.delay(),delayAnimation:r8.delayAnimation(),stop:r8.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender(function(t,n){aF(n,e)},t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&eM(function(n){aF(n,e),t()})}()}}},aG={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&k(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},aY=function(e){return C(e)?new ib(e):e},aX={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new i9(aG,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,aY(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,aY(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,aY(t),n),this},once:function(e,t,n){return this.emitter().one(e,aY(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};r8.eventAliasesOn(aX);var aV={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};aV.jpeg=aV.jpg;var aU={layout:function(e){if(null==e){eQ("Layout options must be specified to make a layout");return}if(null==e.name){eQ("A `name` must be specified to make a layout");return}var t,n=e.name,r=this.extension("layout",n);if(null==r){eQ("No such layout `"+n+"` found.  Did you forget to import it and `cytoscape.use()` it?");return}return t=C(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new r(K({},e,{cy:this,eles:t}))}};aU.createLayout=aU.makeLayout=aU.layout;var aj=e4({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),aH={renderTo:function(e,t,n,r){return this._private.renderer.renderTo(e,t,n,r),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t){eQ("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}void 0!==e.wheelSensitivity&&e0("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var n=aj(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};aH.invalidateDimensions=aH.resize;var aq={collection:function(e,t){return C(e)?this.$(e):I(e)?e.collection():A(e)?(t||(t={}),new aL(this,e,t.unique,t.removed)):new aL(this)},nodes:function(e){var t=this.$(function(e){return e.isNode()});return e?t.filter(e):t},edges:function(e){var t=this.$(function(e){return e.isEdge()});return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};aq.elements=aq.filter=aq.$;var aW={};aW.apply=function(e){for(var t=this._private.cy.collection(),n=0;n0;if(c||h&&d){var p=void 0;c&&d?p=l.properties:c?p=l.properties:d&&(p=l.mappedProperties);for(var g=0;g1&&(v=1),o.color){var E=r.valueMin[0],T=r.valueMax[0],_=r.valueMin[1],D=r.valueMax[1],C=r.valueMin[2],N=r.valueMax[2],A=null==r.valueMin[3]?1:r.valueMin[3],L=[Math.round(E+(T-E)*v),Math.round(_+(D-_)*v),Math.round(C+(N-C)*v),Math.round(A+((null==r.valueMax[3]?1:r.valueMax[3])-A)*v)];f={bypass:r.bypass,name:r.name,value:L,strValue:"rgb("+L[0]+", "+L[1]+", "+L[2]+")"}}else{if(!o.number)return!1;var O=r.valueMin+(r.valueMax-r.valueMin)*v;f=this.parse(r.name,O,r.bypass,c)}if(!f)return g(),!1;f.mapping=r,r=f;break;case a.data:for(var I=r.field.split("."),k=h.data,M=0;M0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()}).then(function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},aW.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},aW.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(e){return e.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},aW.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(e){return e.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),i.triggersBoundsOfParallelBeziers&&"curve-style"===t&&("bezier"===n||"bezier"===r)&&e.parallelEdges().forEach(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}),i.triggersBoundsOfConnectedEdges&&"display"===t&&("none"===n||"none"===r)&&e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},aW.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var a$={};a$.applyBypass=function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?i.substr(t.length):""}function o(){n=n.length>r.length?n.substr(r.length):""}for(i=i.replace(/[/][*](\s|.)+?[*][/]/g,"");!i.match(/^\s*$/);){var s=i.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!s){e0("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+i);break}t=s[0];var l=s[1];if("core"!==l&&new ib(l).invalid){e0("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),a();continue}var u=s[2],h=!1;n=u;for(var c=[];!n.match(/^\s*$/);){var d=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){e0("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+u),h=!0;break}r=d[0];var p=d[1],g=d[2];if(!this.properties[p]){e0("Skipping property: Invalid property name in: "+r),o();continue}if(!this.parse(p,g)){e0("Skipping property: Invalid property definition in: "+r),o();continue}c.push({name:p,val:g}),o()}if(h){a();break}this.selector(l);for(var f=0;f=7&&"d"===t[0]&&(f=new RegExp(o.data.regex).exec(t))){if(n)return!1;var u=o.data;return{name:e,value:f,strValue:""+t,mapped:u,field:f[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(v=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var h=o.mapData;if(!(l.color||l.number))return!1;var c=this.parse(e,v[4]);if(!c||c.mapped)return!1;var d=this.parse(e,v[5]);if(!d||d.mapped)return!1;if(c.pfValue===d.pfValue||c.strValue===d.strValue)return e0("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+c.strValue+"`"),this.parse(e,c.strValue);if(l.color){var p=c.value,g=d.value;if(p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(null==p[3]||1===p[3])&&(null==g[3]||1===g[3])))return!1}return{name:e,value:v,strValue:""+t,mapped:h,field:v[1],fieldMin:parseFloat(v[2]),fieldMax:parseFloat(v[3]),valueMin:c.value,valueMax:d.value,bypass:n}}if(l.multiple&&"multiple"!==r){if(y=s?t.split(/\s+/):A(t)?t:[t],l.evenMultiple&&y.length%2!=0)return null;for(var f,v,y,b=[],x=[],w=[],E="",T=!1,_=0;_0?" ":"")+D.strValue}return l.validate&&!l.validate(b,x)?null:l.singleEnum&&T?1===b.length&&C(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var L=function(){for(var r=0;rl.max||l.strictMax&&t===l.max))return null;var R={name:e,value:t,strValue:""+t+(I||""),units:I,bypass:n};return l.unitless||"px"!==I&&"em"!==I?R.pfValue=t:R.pfValue="px"!==I&&I?this.getEmSizeInPixels()*t:t,("ms"===I||"s"===I)&&(R.pfValue="ms"===I?t:1e3*t),("deg"===I||"rad"===I)&&(R.pfValue="rad"===I?t:Math.PI*t/180),"%"===I&&(R.pfValue=t/100),R}if(l.propList){var B=[],F=""+t;if("none"===F);else{for(var z=F.split(/\s*,\s*|\s+/),Y=0;Y0&&l>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){i=(i=(i=Math.min((s-2*t)/r.w,(l-2*t)/r.h))>this._private.maxZoom?this._private.maxZoom:i)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),S(e)?n=e:L(e)&&(n=e.level,null!=e.position?t=tv(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;S(l.x)&&(t.pan.x=l.x,o=!1),S(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(C(e)){var n=e;e=this.mutableElements().filter(n)}else I(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container;return n.sizeCache=n.sizeCache||(r?(e=this.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};a3.centre=a3.center,a3.autolockNodes=a3.autolock,a3.autoungrabifyNodes=a3.autoungrabify;var a4={data:r8.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:r8.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:r8.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:r8.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};a4.attr=a4.data,a4.removeAttr=a4.removeData;var a9=function(e){var t=this,n=(e=K({},e)).container;n&&!O(n)&&O(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{}).cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==b&&void 0!==n&&!e.headless,o=e;o.layout=K({name:a?"grid":"null"},o.layout),o.renderer=K({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:o,elements:new aL(this),listeners:[],aniEles:new aL(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:S(o.zoom)?o.zoom:1,pan:{x:L(o.pan)&&S(o.pan.x)?o.pan.x:0,y:L(o.pan)&&S(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=K({},o,o.renderer);t.initRenderer(u);var h=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(L(e)||A(e))&&t.add(e),t.one("layoutready",function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")}).one("layoutstop",function(){t.one("done",r),t.emit("done")});var a=K({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};!function(e,t){if(e.some(F))return ru.all(e).then(t);t(e)}([o.style,o.elements],function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),h(a,function(){t.startAnimationLoop(),l.ready=!0,N(o.ready)&&t.on("ready",o.ready);for(var e=0;e0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach(function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch(function(){for(var n=Object.keys(e),r=0;r0,s=tk(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(I(t.roots))e=t.roots;else if(A(t.roots)){for(var l=[],u=0;u0;){var L=_.shift(),S=function(e,n){for(var i=oe(e),a=e.incomers().filter(function(e){return e.isNode()&&r.has(e)}),o=-1,s=e.id(),l=0;l0&&g[0].length<=3?u/2:0),c=2*Math.PI/g[r].length*i;return 0===r&&1===g[0].length&&(h=1),{x:j.x+h*Math.cos(c),y:j.y+h*Math.sin(c)}}),this};var or={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oi(e){this.options=K({},or,e)}oi.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o=tk(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),u=0,h=0;h1&&t.avoidOverlap){var d=Math.cos(l)-1,p=Math.sin(l)-0;e=Math.max(Math.sqrt((u*=1.75)*u/(d*d+p*p)),e)}return r.nodes().layoutPositions(this,t,function(n,r){var a=t.startAngle+r*l*(i?1:-1),o=e*Math.cos(a),u=e*Math.sin(a);return{x:s.x+o,y:s.y+u}}),this};var oa={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oo(e){this.options=K({},oa,e)}oo.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,r=e.eles,i=r.nodes().not(":parent"),a=tk(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:a.x1+a.w/2,y:a.y1+a.h/2},s=[],l=0,u=0;u0&&Math.abs(v[0].value-b.value)>=g&&(v=[],f.push(v)),v.push(b)}var x=l+e.minNodeSpacing;if(!e.avoidOverlap){var w=f.length>0&&f[0].length>1,E=(Math.min(a.w,a.h)/2-x)/(f.length+w?1:0);x=Math.min(x,E)}for(var T=0,_=0;_1&&e.avoidOverlap){var A=Math.cos(N)-1,L=Math.sin(N)-0;T=Math.max(Math.sqrt(x*x/(A*A+L*L)),T)}D.r=T,T+=x}if(e.equidistant){for(var S=0,O=0,I=0;I=e.numIter)&&(of(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),eM(t)):(oN(r,e),s())}();else{for(;u;)u=o(l),l++;oN(r,e),s()}return this},ol.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},ol.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var ou=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=tk(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0){o.graphSet.push(_);for(var u=0;u<_.length;u++)v[++b]=_[u]}}for(var u=0;ur.count?0:r.graph},oc=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=r.nodeOverlap*o,l=Math.sqrt(i*i+a*a),u=s*i/l,h=s*a/l;else var c=ox(e,i,a),d=ox(t,-1*i,-1*a),p=d.x-c.x,g=d.y-c.y,f=p*p+g*g,l=Math.sqrt(f),s=(e.nodeRepulsion+t.nodeRepulsion)/f,u=s*p/l,h=s*g/l;e.isLocked||(e.offsetX-=u,e.offsetY-=h),t.isLocked||(t.offsetX+=u,t.offsetY+=h)}},ob=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else var i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else var a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},ox=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2):0>n&&(s<=-1*l||s>=l)&&(u.x=r-a*t/2/n,u.y=i-a/2),u},ow=function(e,t){for(var n=0;n1){var g=t.gravity*c/p,f=t.gravity*d/p;h.offsetX+=g,h.offsetY+=f}}}}},oT=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else var i={x:e,y:t};return i},oC=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;if((null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopf&&(d+=g+t.componentSpacing,c=0,p=0,g=0)}}},oA={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function oL(e){this.options=K({},oA,e)}oL.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().not(":parent");e.sort&&(r=r.sort(e.sort));var i=tk(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===i.h||0===i.w)n.nodes().layoutPositions(this,e,function(e){return{x:i.x1,y:i.y1}});else{var a=r.size(),o=Math.sqrt(a*i.h/i.w),s=Math.round(o),l=Math.round(i.w/i.h*o),u=function(e){if(null==e)return Math.min(s,l);Math.min(s,l)==s?s=e:l=e},h=function(e){if(null==e)return Math.max(s,l);Math.max(s,l)==s?s=e:l=e},c=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=c&&null!=d)s=c,l=d;else if(null!=c&&null==d)l=Math.ceil(a/(s=c));else if(null==c&&null!=d)s=Math.ceil(a/(l=d));else if(l*s>a){var p=u(),g=h();(p-1)*g>=a?u(p-1):(g-1)*p>=a&&h(g-1)}else for(;l*s=a?h(v+1):u(f+1)}var y=i.w/l,b=i.h/s;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var x=0;x=l&&(O=0,S++)},k={},M=0;M=0;x--){var w=l[x];w.isNode()?y(w)||b(w):function(n){var r,i=n._private,a=i.rscratch,l=n.pstyle("width").pfValue,h=n.pstyle("arrow-scale").value,p=l/2+d,g=p*p,f=2*p,b=i.source,x=i.target;if("segments"===a.edgeType||"straight"===a.edgeType||"haystack"===a.edgeType){for(var w=a.allpts,E=0;E+3(r=t$(e,t,w[E],w[E+1],w[E+2],w[E+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType){for(var w=a.allpts,E=0;E+5(r=tW(e,t,w[E],w[E+1],w[E+2],w[E+3],w[E+4],w[E+5])))return v(n,r),!0}for(var b=b||i.source,x=x||i.target,T=o.getArrowWidth(l,h),_=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}],E=0;E<_.length;E++){var D=_[E],C=s.arrowShapes[n.pstyle(D.name+"-arrow-shape").value],N=n.pstyle("width").pfValue;if(C.roughCollide(e,t,T,D.angle,{x:D.x,y:D.y},N,d)&&C.collide(e,t,T,D.angle,{x:D.x,y:D.y},N,d))return v(n),!0}c&&u.length>0&&(y(b),y(x))}(w)||b(w)||b(w,"source")||b(w,"target")}return u},oY.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r);e=o,n=s;for(var h=tk({x1:e,y1:t=l,x2:n,y2:r=u}),c=0;c0?-(Math.PI-e.ang):Math.PI+e.ang},sh=function(e,t,n,r,i){if(e!==v?sl(t,e,so):su(ss,so),sl(t,n,ss),o9=so.nx*ss.ny-so.ny*ss.nx,o6=so.nx*ss.nx- -(so.ny*ss.ny),1e-6>Math.abs(se=Math.asin(Math.max(-1,Math.min(1,o9))))){o3=t.x,o4=t.y,sn=si=0;return}o8=1,o7=!1,o6<0?se<0?se=Math.PI+se:(se=Math.PI-se,o8=-1,o7=!0):se>0&&(o8=-1,o7=!0),si=void 0!==t.radius?t.radius:r,st=se/2,sa=Math.min(so.len/2,ss.len/2),sn=i?(sr=Math.abs(Math.cos(st)*si/Math.sin(st)))>sa?Math.abs((sr=sa)*Math.sin(st)/Math.cos(st)):si:Math.abs((sr=Math.min(sa,si))*Math.sin(st)/Math.cos(st)),g=t.x+ss.nx*sr,f=t.y+ss.ny*sr,o3=g-ss.ny*sn*o8,o4=f+ss.nx*sn*o8,d=t.x+so.nx*sr,p=t.y+so.ny*sr,v=t};function sc(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function sd(e,t,n,r){var i=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(sh(e,t,n,r,i),{cx:o3,cy:o4,radius:sn,startX:d,startY:p,stopX:g,stopY:f,startAngle:so.ang+Math.PI/2*o8,endAngle:ss.ang-Math.PI/2*o8,counterClockwise:o7})}var sp={};function sg(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},C=D(T,f?(c+p)/2:0),N=D(_,f?(d+g)/2:0),A=!1;"auto"===y?v=Math.abs(C)>Math.abs(N)?a:i:y===u||y===l?(v=i,A=!0):(y===o||y===s)&&(v=a,A=!0);var L=v===i,S=L?N:C,O=L?_:T,I=tD(O),k=!1;!(A&&(x||w<0))&&(y===l&&O<0||y===u&&O>0||y===o&&O>0||y===s&&O<0)&&(I*=-1,S=I*Math.abs(S),k=!0);var M=function(e){return Math.abs(e)=Math.abs(S)},P=M(n=x?(w<0?1+w:w)*S:(w<0?S:0)+w*I),R=M(Math.abs(S)-Math.abs(n));if((P||R)&&!k){if(L){var B=Math.abs(T)<=p/2;if(Math.abs(O)<=d/2){var F=(h.x1+h.x2)/2,z=h.y1,G=h.y2;r.segpts=[F,z,F,G]}else if(B){var Y=(h.y1+h.y2)/2,X=h.x1,V=h.x2;r.segpts=[X,Y,V,Y]}else r.segpts=[h.x1,h.y2]}else{var U=Math.abs(_)<=g/2;if(Math.abs(O)<=c/2){var j=(h.y1+h.y2)/2,H=h.x1,q=h.x2;r.segpts=[H,j,q,j]}else if(U){var W=(h.x1+h.x2)/2,$=h.y1,K=h.y2;r.segpts=[W,$,W,K]}else r.segpts=[h.x2,h.y1]}}else if(L){var Z=h.y1+n+(f?d/2*I:0),Q=h.x1,J=h.x2;r.segpts=[Q,Z,J,Z]}else{var ee=h.x1+n+(f?c/2*I:0),et=h.y1,en=h.y2;r.segpts=[ee,et,ee,en]}if(r.isRound){var er=e.pstyle("taxi-radius").value,ei="arc-radius"===e.pstyle("radius-type").value[0];r.radii=Array(r.segpts.length/2).fill(er),r.isArcRadius=Array(r.segpts.length/2).fill(ei)}},sp.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,h=t.tgtShape,c=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,g=t.tgtRs,f=!S(n.startX)||!S(n.startY),v=!S(n.arrowStartX)||!S(n.arrowStartY),y=!S(n.endX)||!S(n.endY),b=!S(n.arrowEndX)||!S(n.arrowEndY),x=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),w=tC({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),E=wd.poolIndex()){var p=c;c=d,d=p}var g=s.srcPos=c.position(),f=s.tgtPos=d.position(),v=s.srcW=c.outerWidth(),y=s.srcH=c.outerHeight(),b=s.tgtW=d.outerWidth(),x=s.tgtH=d.outerHeight(),w=s.srcShape=n.nodeShapes[t.getNodeShape(c)],E=s.tgtShape=n.nodeShapes[t.getNodeShape(d)],T=s.srcCornerRadius="auto"===c.pstyle("corner-radius").value?"auto":c.pstyle("corner-radius").pfValue,_=s.tgtCornerRadius="auto"===d.pstyle("corner-radius").value?"auto":d.pstyle("corner-radius").pfValue,D=s.tgtRs=d._private.rscratch,C=s.srcRs=c._private.rscratch;s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var N=0;N0){var j=tN(l,tm(t)),H=tN(l,tm(U)),q=j;H2&&tN(l,{x:U[2],y:U[3]})0){var eo=tN(u,tm(t)),es=tN(u,tm(ea)),el=eo;es2&&tN(u,{x:ea[2],y:ea[3]})=l||b){h={cp:f,segment:y};break}}if(h)break}var x=h.cp,w=h.segment,E=(l-d)/w.length,T=w.t1-w.t0,_=i?w.t0+T*E:w.t1-T*E;_=tI(0,_,1),t=tS(x.p0,x.p1,x.p2,_),u=sx(x.p0,x.p1,x.p2,_);break;case"straight":case"segments":case"haystack":for(var D,C,N,A,L=0,S=r.allpts.length,O=0;O+3=l));O+=2);var I=(l-A)/N;t=tO(D,C,I=tI(0,I,1)),u=sb(D,C)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,u)}};l("source"),l("target"),this.applyLabelDimensions(e)}},sy.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},sy.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=e7(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,h=i.width,c=i.height+(l-1)*(a-1)*u;te(n.rstyle,"labelWidth",t,h),te(n.rscratch,"labelWidth",t,h),te(n.rstyle,"labelHeight",t,c),te(n.rscratch,"labelHeight",t,c),te(n.rscratch,"labelLineHeight",t,u*a)},sy.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(te(n.rscratch,e,t,r),r):e7(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=o("labelKey");if(null!=l&&o("labelWrapKey")===l)return o("labelWrapCachedText");for(var u=i.split("\n"),h=e.pstyle("text-max-width").pfValue,c="anywhere"===e.pstyle("text-overflow-wrap").value,d=[],p=/[\s\u200b]+/,g=c?"":" ",f=0;fh){for(var b=v.split(p),x="",w=0;w_);N++)D+=i[N],N===i.length-1&&(C=!0);return C||(D+="…"),D}return i},sy.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},sy.calculateLabelDimensions=function(e,t){var n=eY(t,e._private.labelDimsKey),r=this.labelDimCache||(this.labelDimCache=[]),i=r[n];if(null!=i)return i;var a=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,s=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,u=this.labelCalcCanvas,h=this.labelCalcCanvasContext;if(!u){u=this.labelCalcCanvas=document.createElement("canvas"),h=this.labelCalcCanvasContext=u.getContext("2d");var c=u.style;c.position="absolute",c.left="-9999px",c.top="-9999px",c.zIndex="-1",c.visibility="hidden",c.pointerEvents="none"}h.font="".concat(a," ").concat(l," ").concat(o,"px ").concat(s);for(var d=0,p=0,g=t.split("\n"),f=0;fe.width()||28>e.height()))return sE||(e0("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),sE=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var sT={};sT.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var r=0;r=_.desktopTapThreshold2}var b=A(e);t&&(_.hoverData.tapholdCancelled=!0),r=!0,N(c,["mousemove","vmousemove","tapdrag"],e,{x:s[0],y:s[1]});var x=function(){_.data.bgActivePosistion=void 0,_.hoverData.selecting||i.emit({originalEvent:e,type:"boxstart",position:{x:s[0],y:s[1]}}),h[4]=1,_.hoverData.selecting=!0,_.redrawHint("select",!0),_.redraw()};if(3===_.hoverData.which){if(t){var w={originalEvent:e,type:"cxtdrag",position:{x:s[0],y:s[1]}};p?p.emit(w):i.emit(w),_.hoverData.cxtDragged=!0,(!_.hoverData.cxtOver||c!==_.hoverData.cxtOver)&&(_.hoverData.cxtOver&&_.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:s[0],y:s[1]}}),_.hoverData.cxtOver=c,c&&c.emit({originalEvent:e,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}}else if(_.hoverData.dragging){if(r=!0,i.panningEnabled()&&i.userPanningEnabled()){if(_.hoverData.justStartedPan){var E=_.hoverData.mdownPos;n={x:(s[0]-E[0])*a,y:(s[1]-E[1])*a},_.hoverData.justStartedPan=!1}else n={x:g[0]*a,y:g[1]*a};i.panBy(n),i.emit("dragpan"),_.hoverData.dragged=!0}s=_.projectIntoViewport(e.clientX,e.clientY)}else if(1==h[4]&&(null==p||p.pannable()))t&&(!_.hoverData.dragging&&i.boxSelectionEnabled()&&(b||!i.panningEnabled()||!i.userPanningEnabled())?x():!_.hoverData.selecting&&i.panningEnabled()&&i.userPanningEnabled()&&L(p,_.hoverData.downs)&&(_.hoverData.dragging=!0,_.hoverData.justStartedPan=!0,h[4]=0,_.data.bgActivePosistion=tm(l),_.redrawHint("select",!0),_.redraw()),p&&p.pannable()&&p.active()&&p.unactivate());else{if(p&&p.pannable()&&p.active()&&p.unactivate(),p&&p.grabbed()||c==d||(d&&N(d,["mouseout","tapdragout"],e,{x:s[0],y:s[1]}),c&&N(c,["mouseover","tapdragover"],e,{x:s[0],y:s[1]}),_.hoverData.last=c),p){if(t){if(i.boxSelectionEnabled()&&b)p&&p.grabbed()&&(G(f),p.emit("freeon"),f.emit("free"),_.dragData.didDrag&&(p.emit("dragfreeon"),f.emit("dragfree"))),x();else if(p&&p.grabbed()&&_.nodeIsDraggable(p)){var T,D=!_.dragData.didDrag;D&&_.redrawHint("eles",!0),_.dragData.didDrag=!0,_.hoverData.draggingEles||z(f,{inDragLayer:!0});var C={x:0,y:0};if(S(g[0])&&S(g[1])&&(C.x+=g[0],C.y+=g[1],D)){var O=_.hoverData.dragDelta;O&&S(O[0])&&S(O[1])&&(C.x+=O[0],C.y+=O[1])}_.hoverData.draggingEles=!0,f.silentShift(C).emit("position drag"),_.redrawHint("drag",!0),_.redraw()}}else 0===(T=_.hoverData.dragDelta=_.hoverData.dragDelta||[]).length?(T.push(g[0]),T.push(g[1])):(T[0]+=g[0],T[1]+=g[1])}r=!0}if(h[2]=s[0],h[3]=s[1],r)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),_.registerBinding(D,"mouseup",function(r){if(_.hoverData.capture){_.hoverData.capture=!1;var i=_.cy,a=_.projectIntoViewport(r.clientX,r.clientY),o=_.selection,s=_.findNearestElement(a[0],a[1],!0,!1),l=_.dragData.possibleDragElements,u=_.hoverData.down,h=A(r);if(_.data.bgActivePosistion&&(_.redrawHint("select",!0),_.redraw()),_.hoverData.tapholdCancelled=!0,_.data.bgActivePosistion=void 0,u&&u.unactivate(),3===_.hoverData.which){var c={originalEvent:r,type:"cxttapend",position:{x:a[0],y:a[1]}};if(u?u.emit(c):i.emit(c),!_.hoverData.cxtDragged){var d={originalEvent:r,type:"cxttap",position:{x:a[0],y:a[1]}};u?u.emit(d):i.emit(d)}_.hoverData.cxtDragged=!1,_.hoverData.which=null}else if(1===_.hoverData.which){if(N(s,["mouseup","tapend","vmouseup"],r,{x:a[0],y:a[1]}),_.dragData.didDrag||_.hoverData.dragged||_.hoverData.selecting||_.hoverData.isOverThresholdDrag||(N(u,["click","tap","vclick"],r,{x:a[0],y:a[1]}),t=!1,r.timeStamp-n<=i.multiClickDebounceTime()?(e&&clearTimeout(e),t=!0,n=null,N(u,["dblclick","dbltap","vdblclick"],r,{x:a[0],y:a[1]})):(e=setTimeout(function(){t||N(u,["oneclick","onetap","voneclick"],r,{x:a[0],y:a[1]})},i.multiClickDebounceTime()),n=r.timeStamp)),null!=u||_.dragData.didDrag||_.hoverData.selecting||_.hoverData.dragged||A(r)||(i.$(C).unselect(["tapunselect"]),l.length>0&&_.redrawHint("eles",!0),_.dragData.possibleDragElements=l=i.collection()),s!=u||_.dragData.didDrag||_.hoverData.selecting||null==s||!s._private.selectable||(_.hoverData.dragging||("additive"===i.selectionType()||h?s.selected()?s.unselect(["tapunselect"]):s.select(["tapselect"]):h||(i.$(C).unmerge(s).unselect(["tapunselect"]),s.select(["tapselect"]))),_.redrawHint("eles",!0)),_.hoverData.selecting){var p=i.collection(_.getAllInBox(o[0],o[1],o[2],o[3]));_.redrawHint("select",!0),p.length>0&&_.redrawHint("eles",!0),i.emit({type:"boxend",originalEvent:r,position:{x:a[0],y:a[1]}}),"additive"!==i.selectionType()&&(h||i.$(C).unmerge(p).unselect()),p.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),_.redraw()}if(_.hoverData.dragging&&(_.hoverData.dragging=!1,_.redrawHint("select",!0),_.redrawHint("eles",!0),_.redraw()),!o[4]){_.redrawHint("drag",!0),_.redrawHint("eles",!0);var g=u&&u.grabbed();G(l),g&&(u.emit("freeon"),l.emit("free"),_.dragData.didDrag&&(u.emit("dragfreeon"),l.emit("dragfree")))}}o[4]=0,_.hoverData.down=null,_.hoverData.cxtStarted=!1,_.hoverData.draggingEles=!1,_.hoverData.selecting=!1,_.hoverData.isOverThresholdDrag=!1,_.dragData.didDrag=!1,_.hoverData.dragged=!1,_.hoverData.dragDelta=[],_.hoverData.mdownPos=null,_.hoverData.mdownGPos=null}},!1);var W=function(e){if(!_.scrollingPage){var t=_.cy,n=t.zoom(),r=t.pan(),i=_.projectIntoViewport(e.clientX,e.clientY),a=[i[0]*n+r.x,i[1]*n+r.y];if(_.hoverData.draggingEles||_.hoverData.dragging||_.hoverData.cxtStarted||0!==_.selection[4]){e.preventDefault();return}if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),_.data.wheelZooming=!0,clearTimeout(_.data.wheelTimeout),_.data.wheelTimeout=setTimeout(function(){_.data.wheelZooming=!1,_.redrawHint("eles",!0),_.redraw()},150),o=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*_.wheelSensitivity,1===e.deltaMode&&(o*=33);var o,s=t.zoom()*Math.pow(10,o);"gesturechange"===e.type&&(s=_.gestureStartZoom*e.scale),t.zoom({level:s,renderedPosition:{x:a[0],y:a[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};_.registerBinding(_.container,"wheel",W,!0),_.registerBinding(D,"scroll",function(e){_.scrollingPage=!0,clearTimeout(_.scrollingPageTimeout),_.scrollingPageTimeout=setTimeout(function(){_.scrollingPage=!1},250)},!0),_.registerBinding(_.container,"gesturestart",function(e){_.gestureStartZoom=_.cy.zoom(),_.hasTouchStarted||e.preventDefault()},!0),_.registerBinding(_.container,"gesturechange",function(e){_.hasTouchStarted||W(e)},!0),_.registerBinding(_.container,"mouseout",function(e){var t=_.projectIntoViewport(e.clientX,e.clientY);_.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),_.registerBinding(_.container,"mouseover",function(e){var t=_.projectIntoViewport(e.clientX,e.clientY);_.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var $=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},K=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(_.registerBinding(_.container,"touchstart",v=function(e){if(_.hasTouchStarted=!0,q(e)){X(),_.touchData.capture=!0,_.data.bgActivePosistion=void 0;var t=_.cy,n=_.touchData.now,v=_.touchData.earlier;if(e.touches[0]){var y=_.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=y[0],n[1]=y[1]}if(e.touches[1]){var y=_.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=y[0],n[3]=y[1]}if(e.touches[2]){var y=_.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=y[0],n[5]=y[1]}if(e.touches[1]){_.touchData.singleTouchMoved=!0,G(_.dragData.touchDragEles);var b=_.findContainerClientCoords();c=b[0],d=b[1],p=b[2],g=b[3],r=e.touches[0].clientX-c,i=e.touches[0].clientY-d,a=e.touches[1].clientX-c,o=e.touches[1].clientY-d,f=0<=r&&r<=p&&0<=a&&a<=p&&0<=i&&i<=g&&0<=o&&o<=g;var x=t.pan(),w=t.zoom();if(s=$(r,i,a,o),l=K(r,i,a,o),h=[((u=[(r+a)/2,(i+o)/2])[0]-x.x)/w,(u[1]-x.y)/w],l<4e4&&!e.touches[2]){var E=_.findNearestElement(n[0],n[1],!0,!0),T=_.findNearestElement(n[2],n[3],!0,!0);E&&E.isNode()?(E.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),_.touchData.start=E):T&&T.isNode()?(T.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),_.touchData.start=T):t.emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),_.touchData.start&&(_.touchData.start._private.grabbed=!1),_.touchData.cxt=!0,_.touchData.cxtDragged=!1,_.data.bgActivePosistion=void 0,_.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var D=_.findNearestElements(n[0],n[1],!0,!0),C=D[0];if(null!=C&&(C.activate(),_.touchData.start=C,_.touchData.starts=D,_.nodeIsGrabbable(C))){var A=_.dragData.touchDragEles=t.collection(),L=null;_.redrawHint("eles",!0),_.redrawHint("drag",!0),C.selected()?z(L=t.$(function(e){return e.selected()&&_.nodeIsGrabbable(e)}),{addToList:A}):z(C,{addToList:A}),P(C);var S=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};C.emit(S("grabon")),L?L.forEach(function(e){e.emit(S("grab"))}):C.emit(S("grab"))}N(C,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==C&&(_.data.bgActivePosistion={x:y[0],y:y[1]},_.redrawHint("select",!0),_.redraw()),_.touchData.singleTouchMoved=!1,_.touchData.singleTouchStartTime=+new Date,clearTimeout(_.touchData.tapholdTimeout),_.touchData.tapholdTimeout=setTimeout(function(){!1!==_.touchData.singleTouchMoved||_.pinching||_.touchData.selecting||N(_.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},_.tapholdDuration)}if(e.touches.length>=1){for(var O=_.touchData.startPosition=[null,null,null,null,null,null],I=0;I=_.touchTapThreshold2}if(t&&_.touchData.cxt){e.preventDefault();var C=e.touches[0].clientX-c,A=e.touches[0].clientY-d,O=e.touches[1].clientX-c,I=e.touches[1].clientY-d,k=K(C,A,O,I);if(k/l>=2.25||k>=22500){_.touchData.cxt=!1,_.data.bgActivePosistion=void 0,_.redrawHint("select",!0);var M={originalEvent:e,type:"cxttapend",position:{x:p[0],y:p[1]}};_.touchData.start?(_.touchData.start.unactivate().emit(M),_.touchData.start=null):u.emit(M)}}if(t&&_.touchData.cxt){var M={originalEvent:e,type:"cxtdrag",position:{x:p[0],y:p[1]}};_.data.bgActivePosistion=void 0,_.redrawHint("select",!0),_.touchData.start?_.touchData.start.emit(M):u.emit(M),_.touchData.start&&(_.touchData.start._private.grabbed=!1),_.touchData.cxtDragged=!0;var P=_.findNearestElement(p[0],p[1],!0,!0);(!_.touchData.cxtOver||P!==_.touchData.cxtOver)&&(_.touchData.cxtOver&&_.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:p[0],y:p[1]}}),_.touchData.cxtOver=P,P&&P.emit({originalEvent:e,type:"cxtdragover",position:{x:p[0],y:p[1]}}))}else if(t&&e.touches[2]&&u.boxSelectionEnabled())e.preventDefault(),_.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,_.touchData.selecting||u.emit({originalEvent:e,type:"boxstart",position:{x:p[0],y:p[1]}}),_.touchData.selecting=!0,_.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(p[0]+p[2]+p[4])/3,n[3]=(p[1]+p[3]+p[5])/3):(n[0]=(p[0]+p[2]+p[4])/3,n[1]=(p[1]+p[3]+p[5])/3,n[2]=(p[0]+p[2]+p[4])/3+1,n[3]=(p[1]+p[3]+p[5])/3+1),_.redrawHint("select",!0),_.redraw();else if(t&&e.touches[1]&&!_.touchData.didSelect&&u.zoomingEnabled()&&u.panningEnabled()&&u.userZoomingEnabled()&&u.userPanningEnabled()){e.preventDefault(),_.data.bgActivePosistion=void 0,_.redrawHint("select",!0);var R=_.dragData.touchDragEles;if(R){_.redrawHint("drag",!0);for(var B=0;B0&&!_.hoverData.draggingEles&&!_.swipePanning&&null!=_.data.bgActivePosistion&&(_.data.bgActivePosistion=void 0,_.redrawHint("select",!0),_.redraw())}},!1),_.registerBinding(D,"touchcancel",b=function(e){var t=_.touchData.start;_.touchData.capture=!1,t&&t.unactivate()}),_.registerBinding(D,"touchend",x=function(e){var t,n=_.touchData.start;if(_.touchData.capture){0===e.touches.length&&(_.touchData.capture=!1),e.preventDefault();var r=_.selection;_.swipePanning=!1,_.hoverData.draggingEles=!1;var i=_.cy,a=i.zoom(),o=_.touchData.now,s=_.touchData.earlier;if(e.touches[0]){var l=_.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);o[0]=l[0],o[1]=l[1]}if(e.touches[1]){var l=_.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);o[2]=l[0],o[3]=l[1]}if(e.touches[2]){var l=_.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);o[4]=l[0],o[5]=l[1]}if(n&&n.unactivate(),_.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:o[0],y:o[1]}},n?n.emit(t):i.emit(t),!_.touchData.cxtDragged){var u={originalEvent:e,type:"cxttap",position:{x:o[0],y:o[1]}};n?n.emit(u):i.emit(u)}_.touchData.start&&(_.touchData.start._private.grabbed=!1),_.touchData.cxt=!1,_.touchData.start=null,_.redraw();return}if(!e.touches[2]&&i.boxSelectionEnabled()&&_.touchData.selecting){_.touchData.selecting=!1;var h=i.collection(_.getAllInBox(r[0],r[1],r[2],r[3]));r[0]=void 0,r[1]=void 0,r[2]=void 0,r[3]=void 0,r[4]=0,_.redrawHint("select",!0),i.emit({type:"boxend",originalEvent:e,position:{x:o[0],y:o[1]}}),h.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),h.nonempty()&&_.redrawHint("eles",!0),_.redraw()}if(null!=n&&n.unactivate(),e.touches[2])_.data.bgActivePosistion=void 0,_.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){_.data.bgActivePosistion=void 0,_.redrawHint("select",!0);var c=_.dragData.touchDragEles;if(null!=n){var d=n._private.grabbed;G(c),_.redrawHint("drag",!0),_.redrawHint("eles",!0),d&&(n.emit("freeon"),c.emit("free"),_.dragData.didDrag&&(n.emit("dragfreeon"),c.emit("dragfree"))),N(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]}),n.unactivate(),_.touchData.start=null}else N(_.findNearestElement(o[0],o[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:o[0],y:o[1]});var p=_.touchData.startPosition[0]-o[0],g=_.touchData.startPosition[1]-o[1];_.touchData.singleTouchMoved||(n||i.$(":selected").unselect(["tapunselect"]),N(n,["tap","vclick"],e,{x:o[0],y:o[1]}),w=!1,e.timeStamp-T<=i.multiClickDebounceTime()?(E&&clearTimeout(E),w=!0,T=null,N(n,["dbltap","vdblclick"],e,{x:o[0],y:o[1]})):(E=setTimeout(function(){w||N(n,["onetap","voneclick"],e,{x:o[0],y:o[1]})},i.multiClickDebounceTime()),T=e.timeStamp)),null!=n&&!_.dragData.didDrag&&n._private.selectable&&(p*p+g*g)*a*a<_.touchTapThreshold2&&!_.pinching&&("single"===i.selectionType()?(i.$(C).unmerge(n).unselect(["tapunselect"]),n.select(["tapselect"])):n.selected()?n.unselect(["tapunselect"]):n.select(["tapselect"]),_.redrawHint("eles",!0)),_.touchData.singleTouchMoved=!0}for(var f=0;f0)return p[0]}return null}(e,t,g);if(null!=f){var v=tL(g[5],g[3],g[1],f);if(g.isTop&&v<=t||g.isBottom&&t<=v)return!0}}return!1}}},sA.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:t7(4,0),draw:function(e,t,n,r,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,r,i,this.points,a)},intersectLine:function(e,t,n,r,i,a,o,s){var l=e-(n/2+o),u=t-(r/2+o),h=e+(n/2+o),c=t4(i,a,e,t,l,u,h,u,!1);return c.length>0?c:tV(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?nn(r,i):s);if(tZ(e,t,this.points,a,o,r,i-l,[0,-1],n)||tZ(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,h=i/2+2*n;return!!(tK(e,t,[a-u,o-h,a-u,o,a+u,o,a+u,o-h])||t2(e,t,l,l,a+r/2-s,o+i/2-s,n)||t2(e,t,l,l,a-r/2+s,o+i/2-s,n))}}},sA.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",t7(3,0)),this.generateRoundPolygon("round-triangle",t7(3,0)),this.generatePolygon("rectangle",t7(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",t7(5,0)),this.generateRoundPolygon("round-pentagon",t7(5,0)),this.generatePolygon("hexagon",t7(6,0)),this.generateRoundPolygon("round-hexagon",t7(6,0)),this.generatePolygon("heptagon",t7(7,0)),this.generateRoundPolygon("round-heptagon",t7(7,0)),this.generatePolygon("octagon",t7(8,0)),this.generateRoundPolygon("round-octagon",t7(8,0));var r=Array(20),i=nt(5,0),a=nt(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;st.className.indexOf(o)&&(t.className=(t.className||"")+" "+o),!s){var l=r.createElement("style");l.id=a,l.textContent="."+o+" { position: relative; }",i.insertBefore(l,i.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&e0("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=S(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},sI.notify=function(e,t){var n=this.cy;if(!this.destroyed){if("init"===e){this.load();return}if("destroy"===e){this.destroy();return}("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},sI.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*sk)break;var v=e.deq(t,c,h);if(v.length>0)for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,c,h)&&r())},i(t))}}},sP=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e$;a(this,e),this.idsByKey=new tn,this.keyForId=new tn,this.cachesByLvl=new tn,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return s(e,[{key:"getIdsFor",value:function(e){null==e&&eQ("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new ti,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new tn,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}]),e}(),sR={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},sB=e4({getKey:null,doesEleInvalidateKey:e$,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:eW,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),sF=function(e,t){this.renderer=e,this.onDequeues=[];var n=sB(t);K(this,n),this.lookup=new sP(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},sz=sF.prototype;sz.reasons=sR,sz.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},sz.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},sz.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new tl(function(e,t){return t.reqs-e.reqs})},sz.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},sz.getElement=function(e,t,n,r,i){var a,o,s,l=this,u=this.renderer,h=u.cy.zoom(),c=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!l.allowEdgeTxrCaching&&e.isEdge()||!l.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(t_(h*n))),r<-4)r=-4;else if(h>=7.99||r>3)return null;var d=Math.pow(2,r),p=t.h*d,g=t.w*d,f=u.eleTextBiggerThanMin(e,d);if(!this.isVisible(e,f))return null;var v=c.get(e,r);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;if(a=p<=25?25:p<=50?50:50*Math.ceil(p/50),p>1024||g>1024)return null;var y=l.getTextureQueue(a),b=y[y.length-2],x=function(){return l.recycleTexture(a,g)||l.addTexture(a,g)};b||(b=y[y.length-1]),b||(b=x()),b.width-b.usedWidthr;L--)N=l.getElement(e,t,n,L,sR.downscale);A()}else{if(!E&&!T&&!_)for(var S=r-1;S>=-4;S--){var O=c.get(e,S);if(O){s=O;break}}if(w(s))return l.queueElement(e,r),s;b.context.translate(b.usedWidth,0),b.context.scale(d,d),this.drawElement(b.context,e,t,f,!1),b.context.scale(1/d,1/d),b.context.translate(-b.usedWidth,0)}return v={x:b.usedWidth,texture:b,level:r,scale:d,width:g,height:p,scaledLabelShown:f},b.usedWidth+=Math.ceil(g+8),b.eleCaches.push(v),c.set(e,r,v),l.checkTextureFullness(b),v},sz.invalidateElements=function(e){for(var t=0;t=.2*e.width&&this.retireTexture(e)},sz.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?e9(t,e):e.fullnessChecks++},sz.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),r=this.lookup;e9(n,e),e.retired=!0;for(var i=e.eleCaches,a=0;a=t)return a.retired=!1,a.usedWidth=0,a.invalidatedWidth=0,a.fullnessChecks=0,e6(a.eleCaches),a.context.setTransform(1,0,0,1,0,0),a.context.clearRect(0,0,a.width,a.height),e9(r,a),n.push(a),a}},sz.queueElement=function(e,t){var n=this.getElementQueue(),r=this.getElementKeyToQueue(),i=this.getKey(e),a=r[i];if(a)a.level=Math.max(a.level,t),a.eles.merge(e),a.reqs++,n.updateItem(a);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:i};n.push(o),r[i]=o}},sz.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=[],i=this.lookup,a=0;a<1&&t.size()>0;a++){var o=t.pop(),s=o.key,l=o.eles[0],u=i.hasCache(l,o.level);if(n[s]=null,!u){r.push(o);var h=this.getBoundingBox(l);this.getElement(l,h,e,o.level,sR.dequeue)}}return r},sz.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),r=this.getKey(e),i=n[r];null!=i&&(1===i.eles.length?(i.reqs=eq,t.updateItem(i),t.pop(),n[r]=null):i.eles.unmerge(e))},sz.onDequeue=function(e){this.onDequeues.push(e)},sz.offDequeue=function(e){e9(this.onDequeues,e)},sz.setupDequeueing=sM({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=3.99||n>2)return null}a.validateLayersElesOrdering(n,e);var l=a.layersByLevel,u=Math.pow(2,n),h=l[n]=l[n]||[];if(a.levelIsComplete(n,e))return h;!function(){var t=function(t){if(a.validateLayersElesOrdering(t,e),a.levelIsComplete(t,e))return i=l[t],!0},r=function(e){if(!i)for(var r=n+e;-4<=r&&r<=2&&!t(r);r+=e);};r(1),r(-1);for(var o=h.length-1;o>=0;o--){var s=h[o];s.invalid&&e9(h,s)}}();var c=function(){if(!r){r=tk();for(var t=0;t=p||!tX(d.bb,v.boundingBox()))&&!(d=function(e){var t=(e=e||{}).after;if(c(),r.w*u*(r.h*u)>16e6)return null;var i=a.makeLayer(r,n);if(null!=t){var o=h.indexOf(t)+1;h.splice(o,0,i)}else(void 0===e.insert||e.insert)&&h.unshift(i);return i}({insert:!0,after:d})))return null;i||g?a.queueLayer(d,v):a.drawEleInLayer(d,v,n,t),d.eles.push(v),b[n]=d}return i||(g?null:h)},sY.getEleLevelForLayerLevel=function(e,t){return e},sY.drawEleInLayer=function(e,t,n,r){var i=this.renderer,a=e.context,o=t.boundingBox();0!==o.w&&0!==o.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,r),i.setImgSmoothing(a,!1),i.drawCachedElement(a,t,null,null,n,!0),i.setImgSmoothing(a,!0))},sY.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0||a.invalid)return!1;r+=a.eles.length}return r===t.length},sY.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){e=!0;break}}return e},sY.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=eI(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,r){t.invalidateLayer(e)}))},sY.invalidateLayer=function(e){if(this.lastInvalidationTime=eI(),!e.invalid){var t=e.level,n=e.eles;e9(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var r=0;r3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5],s=this,l=t._private.rscratch;if((!o||t.visible())&&!(l.badLine||null==l.allpts||isNaN(l.allpts[0]))){n&&(r=n,e.translate(-r.x1,-r.y1));var u=o?t.pstyle("opacity").value:1,h=o?t.pstyle("line-opacity").value:1,c=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=u*h,v=u*h,y=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:f;"straight-triangle"===c?(s.eleStrokeStyle(e,t,n),s.drawEdgeTrianglePath(t,e,l.allpts)):(e.lineWidth=p,e.lineCap=g,s.eleStrokeStyle(e,t,n),s.drawEdgePath(t,e,l.allpts,d),e.lineCap="butt")},b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;s.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var x=t.pstyle("ghost-offset-x").pfValue,w=t.pstyle("ghost-offset-y").pfValue,E=f*t.pstyle("ghost-opacity").value;e.translate(x,w),y(E),b(E),e.translate(-x,-w)}a&&s.drawEdgeUnderlay(e,t),y(),b(),a&&s.drawEdgeOverlay(e,t),s.drawElementText(e,t,null,i),n&&e.translate(r.x1,r.y1)}};var s5=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this.usePaths(),a=n._private.rscratch,o=n.pstyle("".concat(e,"-padding")).pfValue,s=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*o,"self"!==a.edgeType||i?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,s[0],s[1],s[2],r),this.drawEdgePath(n,t,a.allpts,"solid")}}}};s2.drawEdgeOverlay=s5("overlay"),s2.drawEdgeUnderlay=s5("underlay"),s2.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,o=!1,s=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,u=e.pstyle("line-dash-offset").pfValue;if(s){var c=n.join("$");i.pathCacheKey&&i.pathCacheKey===c?(g=t=i.pathCache,o=!0):(g=t=new Path2D,i.pathCacheKey=c,i.pathCache=g)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=u;break;case"solid":a.setLineDash([])}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var d=2;d+3=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}(i.roundCorners);try{for(v.s();!(f=v.n()).done;){var y=f.value;sc(t,y)}}catch(e){v.e(e)}finally{v.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var b=2;b+15&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}s4.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(t_(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t5)||void 0===arguments[5]||arguments[5];if(null==r){if(o&&!this.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=this.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,h=t.pstyle("label"),c=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!h||!h.value)&&(!c||!c.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p=!n;n&&(a=n,e.translate(-a.x1,-a.y1)),null==i?(this.drawText(e,t,null,p,o),t.isEdge()&&(this.drawText(e,t,"source",p,o),this.drawText(e,t,"target",p,o))):this.drawText(e,t,i,p,o),n&&e.translate(a.x1,a.y1)},s4.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2)||void 0===arguments[2]||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,h=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,h[0],h[1],h[2],l)},s4.getTextAngle=function(e,t){var n=e._private.rscratch,r=t?t+"-":"",i=e.pstyle(r+"text-rotation"),a=e7(n,"labelAngle",t);return"autorotate"===i.strValue?e.isEdge()?a:0:"none"===i.strValue?0:i.pfValue},s4.drawText=function(e,t,n){var r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],i=!(arguments.length>4)||void 0===arguments[4]||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s=e7(a,"labelX",n),l=e7(a,"labelY",n),u=this.getLabelText(t,n);if(null!=u&&""!==u&&!isNaN(s)&&!isNaN(l)){this.setupTextStyle(e,t,i);var h,c,d,p=n?n+"-":"",g=e7(a,"labelWidth",n),f=e7(a,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,b=t.isEdge(),x=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;switch(b&&(x="center",w="center"),s+=v,l+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(h=s,c=l,e.translate(h,c),e.rotate(d),s=0,l=0),w){case"top":break;case"center":l+=f/2;break;case"bottom":l+=f}var E=t.pstyle("text-background-opacity").value,T=t.pstyle("text-border-opacity").value,_=t.pstyle("text-border-width").pfValue,D=t.pstyle("text-background-padding").pfValue,C=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(E>0||_>0&&T>0){var N=s-D;switch(x){case"left":N-=g;break;case"center":N-=g/2}var A=l-f-D,L=g+2*D,S=f+2*D;if(E>0){var O=e.fillStyle,I=t.pstyle("text-background-color").value;e.fillStyle="rgba("+I[0]+","+I[1]+","+I[2]+","+E*o+")",C?s9(e,N,A,L,S,2):e.fillRect(N,A,L,S),e.fillStyle=O}if(_>0&&T>0){var k=e.strokeStyle,M=e.lineWidth,P=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+T*o+")",e.lineWidth=_,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([])}if(C?s9(e,N,A,L,S,2,"stroke"):e.strokeRect(N,A,L,S),"double"===R){var B=_/2;C?s9(e,N+B,A+B,L-2*B,S-2*B,2,"stroke"):e.strokeRect(N+B,A+B,L-2*B,S-2*B)}e.setLineDash&&e.setLineDash([]),e.lineWidth=M,e.strokeStyle=k}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var z=e7(a,"labelWrapCachedLines",n),G=e7(a,"labelLineHeight",n),Y=g/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===x?"left"===X?s+=-g:"center"===X&&(s+=-Y):"center"===x?"left"===X?s+=-Y:"right"===X&&(s+=Y):"right"===x&&("center"===X?s+=Y:"right"===X&&(s+=g))),w){case"top":case"center":case"bottom":l-=(z.length-1)*G}for(var V=0;V0&&e.strokeText(z[V],s,l),e.fillText(z[V],s,l),l+=G}else F>0&&e.strokeText(u,s,l),e.fillText(u,s,l);0!==d&&(e.rotate(-d),e.translate(-h,-c))}}};var s6={};s6.drawNode=function(e,t,n){var r,i,a,o,s=!(arguments.length>3)||void 0===arguments[3]||arguments[3],l=!(arguments.length>4)||void 0===arguments[4]||arguments[4],u=!(arguments.length>5)||void 0===arguments[5]||arguments[5],h=this,c=t._private,d=c.rscratch,p=t.position();if(S(p.x)&&S(p.y)&&(!u||t.visible())){var g=u?t.effectiveOpacity():1,f=h.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(o=n,e.translate(-o.x1,-o.y1));for(var b=t.pstyle("background-image").value,x=Array(b.length),w=Array(b.length),E=0,T=0;T0&&void 0!==arguments[0]?arguments[0]:A;h.eleFillStyle(e,t,n)},j=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:B;h.colorStrokeStyle(e,L[0],L[1],L[2],t)},H=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Y;h.colorStrokeStyle(e,z[0],z[1],z[2],t)},q=function(e,t,n,r){var i,a=h.nodePathCache=h.nodePathCache||[],o=eX("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+V),s=a[o],l=!1;return null!=s?(i=s,l=!0,d.pathCache=i):(i=new Path2D,a[o]=d.pathCache=i),{path:i,cacheHit:l}},W=t.pstyle("shape").strValue,$=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(p.x,p.y);var K=q(r,i,W,$);a=K.path,v=K.cacheHit}var Z=function(){if(!v){var n=p;f&&(n={x:0,y:0}),h.nodeShapes[h.getNodeShape(t)].draw(a||e,n.x,n.y,r,i,V,d)}f?e.fill(a):e.fill()},Q=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=c.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;h.hasPie(t)&&(h.drawPie(e,t,a),n&&!f&&h.nodeShapes[h.getNodeShape(t)].draw(e,p.x,p.y,r,i,V,d))},ee=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,n=C>0?0:255;0!==C&&(h.colorFillStyle(e,n,n,n,(C>0?C:-C)*t),f?e.fill(a):e.fill())},et=function(){if(N>0){if(e.lineWidth=N,e.lineCap=k,e.lineJoin=I,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(P),e.lineDashOffset=R;break;case"solid":case"double":e.setLineDash([])}if("center"!==M){if(e.save(),e.lineWidth*=2,"inside"===M)f?e.clip(a):e.clip();else{var t=new Path2D;t.rect(-r/2-N,-i/2-N,r+2*N,i+2*N),t.addPath(a),e.clip(t,"evenodd")}f?e.stroke(a):e.stroke(),e.restore()}else f?e.stroke(a):e.stroke();if("double"===O){e.lineWidth=N/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(a):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},en=function(){if(F>0){if(e.lineWidth=F,e.lineCap="butt",e.setLineDash)switch(G){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=p;f&&(n={x:0,y:0});var a=h.getNodeShape(t),o=N;"inside"===M&&(o=0),"outside"===M&&(o*=2);var s=(r+o+(F+X))/r,l=(i+o+(F+X))/i,u=r*s,c=i*l,d=h.nodeShapes[a].points;if(f&&(D=q(u,c,a,d).path),"ellipse"===a)h.drawEllipsePath(D||e,n.x,n.y,u,c);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var g=0,v=0,y=0;"round-diamond"===a?g=(o+X+F)*1.4:"round-heptagon"===a?(g=(o+X+F)*1.075,y=-(o/2+X+F)/35):"round-hexagon"===a?g=(o+X+F)*1.12:"round-pentagon"===a?(g=(o+X+F)*1.13,y=-(o/2+X+F)/15):"round-tag"===a?(g=(o+X+F)*1.12,v=(o/2+F+X)*.07):"round-triangle"===a&&(g=Math.PI/2*(o+X+F),y=-(o+X/2+F)/Math.PI),0===g||(s=(r+g)/r,u=r*s,["round-hexagon","round-tag"].includes(a)||(l=(i+g)/i,c=i*l)),V="auto"===V?nr(u,c):V;for(var b=u/2,x=c/2,w=V+(o+F+X)/2,E=Array(d.length/2),T=Array(d.length/2),_=0;_0){if(r=r||n.position(),null==i||null==a){var c=n.padding();i=n.width()+2*c,a=n.height()+2*c}this.colorFillStyle(t,l[0],l[1],l[2],s),this.nodeShapes[u].draw(t,r.x,r.y,i+2*o,a+2*o,h),t.fill()}}}};s6.drawNodeOverlay=s8("overlay"),s6.drawNodeUnderlay=s8("underlay"),s6.hasPie=function(e){return(e=e[0])._private.hasPie},s6.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=Math.min(t.width(),t.height())/2,u=0;this.usePaths()&&(o=0,s=0),"%"===a.units?l*=a.pfValue:void 0!==a.pfValue&&(l=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var c=t.pstyle("pie-"+h+"-background-size").value,d=t.pstyle("pie-"+h+"-background-color").value,p=t.pstyle("pie-"+h+"-background-opacity").value*n,g=c/100;g+u>1&&(g=1-u);var f=1.5*Math.PI+2*Math.PI*u,v=f+2*Math.PI*g;0===c||u>=1||u+g>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,l,f,v),e.closePath(),this.colorFillStyle(e,d[0],d[1],d[2],p),e.fill(),u+=g)}};var s7={};s7.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},s7.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],r=!0,i=0;io.minMbLowQualFrames&&(o.motionBlurPxRatio=o.mbPxRBlurry)),o.clearingMotionBlur&&(o.motionBlurPxRatio=1),o.textureDrawLastFrame&&!c&&(h[o.NODE]=!0,h[o.SELECT_BOX]=!0);var b=l.style(),x=l.zoom(),w=void 0!==i?i:x,E=l.pan(),T={x:E.x,y:E.y},_={zoom:x,pan:{x:E.x,y:E.y}},D=o.prevViewport;void 0===D||_.zoom!==D.zoom||_.pan.x!==D.pan.x||_.pan.y!==D.pan.y||f&&!g||(o.motionBlurPxRatio=1),a&&(T=a),w*=s,T.x*=s,T.y*=s;var C=o.getCachedZSortedEles();function N(e,t,n,r,i){var a=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,o.motionBlurTransparency),e.fillRect(t,n,r,i),e.globalCompositeOperation=a}function A(e,r){var s,l,h,c;o.clearingMotionBlur||e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]?(s=T,l=w,h=o.canvasWidth,c=o.canvasHeight):(s={x:E.x*p,y:E.y*p},l=x*p,h=o.canvasWidth*p,c=o.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===r?N(e,0,0,h,c):!t&&(void 0===r||r)&&e.clearRect(0,0,h,c),n||(e.translate(s.x,s.y),e.scale(l,l)),a&&e.translate(a.x,a.y),i&&e.scale(i,i)}if(c||(o.textureDrawLastFrame=!1),c){if(o.textureDrawLastFrame=!0,!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:!0,forcedPxRatio:s*o.textureMult});var _=o.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:o.canvasWidth,height:o.canvasHeight};_.mpan={x:(0-_.pan.x)/_.zoom,y:(0-_.pan.y)/_.zoom}}h[o.DRAG]=!1,h[o.NODE]=!1;var S=u.contexts[o.NODE],O=o.textureCache.texture,_=o.textureCache.viewport;S.setTransform(1,0,0,1,0,0),d?N(S,0,0,_.width,_.height):S.clearRect(0,0,_.width,_.height);var I=b.core("outside-texture-bg-color").value,k=b.core("outside-texture-bg-opacity").value;o.colorFillStyle(S,I[0],I[1],I[2],k),S.fillRect(0,0,_.width,_.height);var x=l.zoom();A(S,!1),S.clearRect(_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s),S.drawImage(O,_.mpan.x,_.mpan.y,_.width/_.zoom/s,_.height/_.zoom/s)}else o.textureOnViewport&&!t&&(o.textureCache=null);var M=l.extent(),P=o.pinching||o.hoverData.dragging||o.swipePanning||o.data.wheelZooming||o.hoverData.draggingEles||o.cy.animated(),R=o.hideEdgesOnViewport&&P,B=[];if(B[o.NODE]=!h[o.NODE]&&d&&!o.clearedForMotionBlur[o.NODE]||o.clearingMotionBlur,B[o.NODE]&&(o.clearedForMotionBlur[o.NODE]=!0),B[o.DRAG]=!h[o.DRAG]&&d&&!o.clearedForMotionBlur[o.DRAG]||o.clearingMotionBlur,B[o.DRAG]&&(o.clearedForMotionBlur[o.DRAG]=!0),h[o.NODE]||n||r||B[o.NODE]){var F=d&&!B[o.NODE]&&1!==p,S=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_NODE]:u.contexts[o.NODE]);A(S,d&&!F?"motionBlur":void 0),R?o.drawCachedNodes(S,C.nondrag,s,M):o.drawLayeredElements(S,C.nondrag,s,M),o.debug&&o.drawDebugPoints(S,C.nondrag),n||d||(h[o.NODE]=!1)}if(!r&&(h[o.DRAG]||n||B[o.DRAG])){var F=d&&!B[o.DRAG]&&1!==p,S=t||(F?o.data.bufferContexts[o.MOTIONBLUR_BUFFER_DRAG]:u.contexts[o.DRAG]);A(S,d&&!F?"motionBlur":void 0),R?o.drawCachedNodes(S,C.drag,s,M):o.drawCachedElements(S,C.drag,s,M),o.debug&&o.drawDebugPoints(S,C.drag),n||d||(h[o.DRAG]=!1)}if(o.showFps||!r&&h[o.SELECT_BOX]&&!n){var S=t||u.contexts[o.SELECT_BOX];if(A(S),1==o.selection[4]&&(o.hoverData.selecting||o.touchData.selecting)){var x=o.cy.zoom(),z=b.core("selection-box-border-width").value/x;S.lineWidth=z,S.fillStyle="rgba("+b.core("selection-box-color").value[0]+","+b.core("selection-box-color").value[1]+","+b.core("selection-box-color").value[2]+","+b.core("selection-box-opacity").value+")",S.fillRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]),z>0&&(S.strokeStyle="rgba("+b.core("selection-box-border-color").value[0]+","+b.core("selection-box-border-color").value[1]+","+b.core("selection-box-border-color").value[2]+","+b.core("selection-box-opacity").value+")",S.strokeRect(o.selection[0],o.selection[1],o.selection[2]-o.selection[0],o.selection[3]-o.selection[1]))}if(u.bgActivePosistion&&!o.hoverData.selecting){var x=o.cy.zoom(),G=u.bgActivePosistion;S.fillStyle="rgba("+b.core("active-bg-color").value[0]+","+b.core("active-bg-color").value[1]+","+b.core("active-bg-color").value[2]+","+b.core("active-bg-opacity").value+")",S.beginPath(),S.arc(G.x,G.y,b.core("active-bg-size").pfValue/x,0,2*Math.PI),S.fill()}var Y=o.lastRedrawTime;if(o.showFps&&Y){var X=Math.round(1e3/(Y=Math.round(Y)));S.setTransform(1,0,0,1,0,0),S.fillStyle="rgba(255, 0, 0, 0.75)",S.strokeStyle="rgba(255, 0, 0, 0.75)",S.lineWidth=1,S.fillText("1 frame = "+Y+" ms = "+X+" fps",0,20),S.strokeRect(0,30,250,20),S.fillRect(0,30,250*Math.min(X/60,1),20)}n||(h[o.SELECT_BOX]=!1)}if(d&&1!==p){var V=u.contexts[o.NODE],U=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_NODE],j=u.contexts[o.DRAG],H=o.data.bufferCanvases[o.MOTIONBLUR_BUFFER_DRAG],q=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!y?e.clearRect(0,0,o.canvasWidth,o.canvasHeight):N(e,0,0,o.canvasWidth,o.canvasHeight),e.drawImage(t,0,0,o.canvasWidth*p,o.canvasHeight*p,0,0,o.canvasWidth,o.canvasHeight)};(h[o.NODE]||B[o.NODE])&&(q(V,U,B[o.NODE]),h[o.NODE]=!1),(h[o.DRAG]||B[o.DRAG])&&(q(j,H,B[o.DRAG]),h[o.DRAG]=!1)}o.prevViewport=_,o.clearingMotionBlur&&(o.clearingMotionBlur=!1,o.motionBlurCleared=!0,o.motionBlur=!0),d&&(o.motionBlurTimeout=setTimeout(function(){o.motionBlurTimeout=null,o.clearedForMotionBlur[o.NODE]=!1,o.clearedForMotionBlur[o.DRAG]=!1,o.motionBlur=!1,o.clearingMotionBlur=!c,o.mbFrames=0,h[o.NODE]=!0,h[o.DRAG]=!0,o.redraw()},100)),t||l.emit("render")};var le={};le.drawPolygonPath=function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var g=t.pan(),f={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(f.x,f.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-f.x,-f.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return c},la.png=function(e){return ls(e,this.bufferCanvasImage(e),"image/png")},la.jpg=function(e){return ls(e,this.bufferCanvasImage(e),"image/jpeg")};var ll={};ll.nodeShapeImpl=function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var lu=lh.prototype;function lh(e){var t=this;t.data={canvases:Array(lu.CANVAS_LAYERS),contexts:Array(lu.CANVAS_LAYERS),canvasNeedsRedraw:Array(lu.CANVAS_LAYERS),bufferCanvases:Array(lu.BUFFER_COUNT),bufferContexts:Array(lu.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",r="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var i=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=r,i.position="relative",i.zIndex="0",i.overflow="hidden";var a=e.cy.container();a.appendChild(t.data.canvasContainer),a.style[n]=r;var o={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};x&&x.userAgent.match(/msie|trident|edge/i)&&(o["-ms-touch-action"]="none",o["touch-action"]="none");for(var s=0;s0&&(o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,c,n))}},c.prototype.stop=function(){return this.stopped=!0,this};var p=function(e){e("layout","cose-bilkent",c)};"undefined"!=typeof cytoscape&&p(cytoscape),e.exports=p}])},e.exports=r(n("54IE7"))}),r("54IE7",function(e,t){var r;e.exports,r=function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i},function(e,t,n){var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i},function(e,t,n){var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.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,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child?this.moveBy(this.displacementX,this.displacementY):0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):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},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},b.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(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()),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=!1,this.isGrowthFinished=!0}this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},b.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n1)for(o=0;or&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(h.WORLD_CENTER_X-o.x/2,h.WORLD_CENTER_Y-o.y/2))},b.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);b.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o1;){var y=v[0];v.splice(0,1);var x=c.indexOf(y);x>=0&&c.splice(x,1),g--,d--}o=null!=t?(c.indexOf(v[0])+1)%g:0;for(var w=Math.abs(r-n)/d,E=o;p!=d;E=++E%g){var T=c[E].getOtherEnd(e);if(T!=t){var _=(n+p*w)%360,D=(_+w)%360;b.branchRadialLayout(T,e,_,D,i+a,a),p++}}},b.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;nt&&(t=r)}return t},b.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},b.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},b.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)})},b.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i0)return this.toBeTiled[t]=!1,!1;if(null==a.getChild()){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},b.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;rl&&(l=h.rect.height)}n+=l+e.verticalPadding}},b.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height})},b.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:l.TILING_PADDING_VERTICAL,horizontalPadding:l.TILING_PADDING_HORIZONTAL};e.sort(function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height0&&(i+=e.horizontalPadding),e.rowWidth[n]=i,e.width0&&(a+=e.verticalPadding);var o=0;a>e.rowHeight[n]&&(o=e.rowHeight[n],e.rowHeight[n]=a,o=e.rowHeight[n]-o),e.height+=o,e.rows[n].push(t)},b.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;rn&&(t=r,n=e.rowWidth[r]);return t},b.prototype.canAddHorizontal=function(e,t,n){var r,i,a=this.getShortestRowIndex(e);if(a<0)return!0;var o=e.rowWidth[a];if(o+e.horizontalPadding+t<=e.width)return!0;var s=0;return e.rowHeight[a]0&&(s=n+e.verticalPadding-e.rowHeight[a]),r=e.width-o>=t+e.horizontalPadding?(e.height+s)/(o+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,(i=e.widtha&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;so&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]0)for(var d=o;d<=s;d++)c[0]+=this.grid[d][l-1].length+this.grid[d][l].length-1;if(s0)for(var d=l;d<=h;d++)c[3]+=this.grid[o-1][d].length+this.grid[o][d].length-1;for(var p=g.MAX_VALUE,f=0;fMath.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),1>Math.abs(this.lengthX)&&(this.lengthX=a.sign(this.lengthX)),1>Math.abs(this.lengthY)&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o},function(e,t,n){e.exports=function(e){this.vGraphObject=e}},function(e,t,n){var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),l=n(4);function u(e,t,n,o){null==n&&null==o&&(o=t),r.call(this,o),null!=e.graphManager&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,null!=n&&null!=t?this.rect=new a(t.x,t.y,n.width,n.height):this.rect=new a}for(var h in u.prototype=Object.create(r.prototype),r)u[h]=r[h];u.prototype.getEdges=function(){return this.edges},u.prototype.getChild=function(){return this.child},u.prototype.getOwner=function(){return this.owner},u.prototype.getWidth=function(){return this.rect.width},u.prototype.setWidth=function(e){this.rect.width=e},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(e){this.rect.height=e},u.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},u.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},u.prototype.getCenter=function(){return new l(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},u.prototype.getLocation=function(){return new l(this.rect.x,this.rect.y)},u.prototype.getRect=function(){return this.rect},u.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},u.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},u.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},u.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},u.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},u.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},u.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw"Incorrect edge source!";t.push(r)}}),t},u.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(!(r.source==n||r.target==n))throw"Incorrect edge source and/or target";(r.target==e||r.source==e)&&t.push(r)}),t},u.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw"Incorrect incidency!";e.add(n.source)}}),e},u.prototype.withChildren=function(){var e=new Set;if(e.add(this),null!=this.child)for(var t=this.child.getNodes(),n=0;nt&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.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(){return null==this.owner?null:this.owner.getParent()},e.exports=u},function(e,t,n){function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r},function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),h=n(12),c=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(e)>-1)throw"Node already in graph!";return e.owner=this,this.getNodes().push(e),e}if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(!(t.owner==n.owner&&t.owner==this))throw"Both owners must be this graph!";return t.owner!=n.owner?null:(e.source=t,e.target=n,e.isInterGraph=!1,this.getEdges().push(e),t.edges.push(e),n!=t&&n.edges.push(e),e)},d.prototype.remove=function(e){if(e instanceof s){if(null==e)throw"Node is null!";if(!(null!=e.owner&&e.owner==this))throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var t,n=e.edges.slice(),r=n.length,i=0;i-1&&u>-1))throw"Source and/or target doesn't know this edge!";t.source.edges.splice(o,1),t.target!=t.source&&t.target.edges.splice(u,1);var a=t.source.owner.getEdges().indexOf(t);if(-1==a)throw"Not in owner's edge list!";t.source.owner.getEdges().splice(a,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;le&&(r=e),a>t&&(a=t)}return r==i.MAX_VALUE?null:(n=void 0!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new h(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,h=i.MAX_VALUE,c=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;gt&&(s=t),lr&&(h=r),ct&&(o=t),sr&&(l=r),h=this.nodes.length){var l=0;i.forEach(function(e){e.owner==n&&l++}),l==this.nodes.length&&(this.isConnected=!0)}},e.exports=d},function(e,t,n){var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(!(null!=a&&a.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(null!=o&&o.getGraphManager()==this))throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),!(null!=n.source&&null!=n.target))throw"Edge source and/or target is null!";if(!(-1==n.source.edges.indexOf(n)&&-1==n.target.edges.indexOf(n)))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){if(e.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(e==this.rootGraph||null!=e.parent&&e.parent.graphManager==this))throw"Invalid parent node!";for(var t,n,a=[],o=(a=a.concat(e.getEdges())).length,s=0;s=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]o?(n[0]=r,n[1]=l,n[2]=a,n[3]=x):ia?(n[0]=s,n[1]=i,n[2]=y,n[3]=o):ra?(n[0]=h,n[1]=c):(n[0]=u,n[1]=l),_=!0):C===A&&(r>a?(n[0]=s,n[1]=l):(n[0]=d,n[1]=c),_=!0),-N===A?(a>r?(n[2]=b,n[3]=x):(n[2]=y,n[3]=v),D=!0):N===A&&(a>r?(n[2]=f,n[3]=v):(n[2]=w,n[3]=x),D=!0),_&&D)return!1;if(r>a?i>o?(L=this.getCardinalDirection(C,A,4),S=this.getCardinalDirection(N,A,2)):(L=this.getCardinalDirection(-C,A,3),S=this.getCardinalDirection(-N,A,1)):i>o?(L=this.getCardinalDirection(-C,A,1),S=this.getCardinalDirection(-N,A,3)):(L=this.getCardinalDirection(C,A,2),S=this.getCardinalDirection(N,A,4)),!_)switch(L){case 1:I=l,O=r+-g/A,n[0]=O,n[1]=I;break;case 2:O=d,I=i+p*A,n[0]=O,n[1]=I;break;case 3:I=c,O=r+g/A,n[0]=O,n[1]=I;break;case 4:O=h,I=i+-p*A,n[0]=O,n[1]=I}if(!D)switch(S){case 1:M=v,k=a+-T/A,n[2]=k,n[3]=M;break;case 2:k=w,M=o+E*A,n[2]=k,n[3]=M;break;case 3:M=x,k=a+T/A,n[2]=k,n[3]=M;break;case 4:k=b,M=o+-E*A,n[2]=k,n[3]=M}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,l=t.y,u=n.x,h=n.y,c=i.x,d=i.y,p=void 0,g=void 0,f=void 0,v=void 0,y=void 0,b=void 0,x=void 0;return(p=l-o,f=a-s,y=s*o-a*l,g=d-h,v=u-c,b=c*h-u*d,0==(x=p*v-g*f))?null:new r((f*b-v*y)/x,(g*y-p*b)/x)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r},function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r},function(e,t,n){var r=function(){function e(e,t){for(var n=0;n0&&t;){for(s.push(u[0]);s.length>0&&t;){var h=s[0];s.splice(0,1),o.add(h);for(var c=h.getEdges(),a=0;a-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i0){for(var i=this.edgeToDummyNodes.get(n),a=0;a=0&&t.splice(c,1),s.getNeighborsList().forEach(function(e){if(0>n.indexOf(e)){var t=r.get(e)-1;1==t&&u.push(e),r.set(e,t)}})}n=n.concat(u),(1==t.length||2==t.length)&&(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d},function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r},function(e,t,n){var r=n(4);function i(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}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i},function(e,t,n){var r=n(15),i=n(7),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=i.DEFAULT_EDGE_LENGTH,this.springConstant=i.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=i.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l=this.getGraphManager().getAllEdges(),u=0;ui.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):(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)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n0)||void 0===arguments[0]||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=2>Math.abs(this.totalDisplacement-this.oldTotalDisplacement)),e=this.totalDisplacement=s.length||u>=s[0].length)){for(var h=0;he}}]),e}();e.exports=a},function(e,t,n){var r=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;(function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")})(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var o=0;o=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n




© 2015 - 2024 Weber Informatics LLC | Privacy Policy