livebook/static/assets/mindmap-definition-307c710a-ZJ3HI2GM.js
2024-06-05 12:41:18 +00:00

118 lines
468 KiB
JavaScript

import{b as ji}from"./chunk-IIWIUUYA.js";import"./chunk-BZUL2CAN.js";import{Ga as Wt,Ia as jr,J as ml,M as Zi,N as Qi,O as Ji,Qa as ea,_a as es,b as pl,c as yl,eb as ts,h as Ki,nb as Ga,rb as rs}from"./chunk-VNKGKUEF.js";import{f as Gn,h as Fa}from"./chunk-3NXJ7VWC.js";var zi=Gn((Ra,Gi)=>{(function(e,r){typeof Ra=="object"&&typeof Gi=="object"?Gi.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Ra=="object"?Ra.layoutBase=r():e.layoutBase=r()})(Ra,function(){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.i=function(a){return a},r.d=function(a,n,i){r.o(a,n)||Object.defineProperty(a,n,{configurable:!1,enumerable:!0,get:i})},r.n=function(a){var n=a&&a.__esModule?function(){return a.default}:function(){return a};return r.d(n,"a",n),n},r.o=function(a,n){return Object.prototype.hasOwnProperty.call(a,n)},r.p="",r(r.s=26)}([function(t,e,r){"use strict";function a(){}a.QUALITY=1,a.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,a.DEFAULT_INCREMENTAL=!1,a.DEFAULT_ANIMATION_ON_LAYOUT=!0,a.DEFAULT_ANIMATION_DURING_LAYOUT=!1,a.DEFAULT_ANIMATION_PERIOD=50,a.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,a.DEFAULT_GRAPH_MARGIN=15,a.NODE_DIMENSIONS_INCLUDE_LABELS=!1,a.SIMPLE_NODE_SIZE=40,a.SIMPLE_NODE_HALF_SIZE=a.SIMPLE_NODE_SIZE/2,a.EMPTY_COMPOUND_NODE_SIZE=40,a.MIN_EDGE_LENGTH=1,a.WORLD_BOUNDARY=1e6,a.INITIAL_WORLD_BOUNDARY=a.WORLD_BOUNDARY/1e3,a.WORLD_CENTER_X=1200,a.WORLD_CENTER_Y=900,t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(8),i=r(9);function s(l,u,f){a.call(this,f),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=f,this.bendpoints=[],this.source=l,this.target=u}s.prototype=Object.create(a.prototype);for(var o in a)s[o]=a[o];s.prototype.getSource=function(){return this.source},s.prototype.getTarget=function(){return this.target},s.prototype.isInterGraph=function(){return this.isInterGraph},s.prototype.getLength=function(){return this.length},s.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},s.prototype.getBendpoints=function(){return this.bendpoints},s.prototype.getLca=function(){return this.lca},s.prototype.getSourceInLca=function(){return this.sourceInLca},s.prototype.getTargetInLca=function(){return this.targetInLca},s.prototype.getOtherEnd=function(l){if(this.source===l)return this.target;if(this.target===l)return this.source;throw"Node is not incident with this edge"},s.prototype.getOtherEndInGraph=function(l,u){for(var f=this.getOtherEnd(l),h=u.getGraphManager().getRoot();;){if(f.getOwner()==u)return f;if(f.getOwner()==h)break;f=f.getOwner().getParent()}return null},s.prototype.updateLength=function(){var l=new Array(4);this.isOverlapingSourceAndTarget=n.getIntersection(this.target.getRect(),this.source.getRect(),l),this.isOverlapingSourceAndTarget||(this.lengthX=l[0]-l[2],this.lengthY=l[1]-l[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},s.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},t.exports=s},function(t,e,r){"use strict";function a(n){this.vGraphObject=n}t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(13),s=r(0),o=r(16),l=r(4);function u(h,c,v,d){v==null&&d==null&&(d=c),a.call(this,d),h.graphManager!=null&&(h=h.graphManager),this.estimatedSize=n.MIN_VALUE,this.inclusionTreeDepth=n.MAX_VALUE,this.vGraphObject=d,this.edges=[],this.graphManager=h,v!=null&&c!=null?this.rect=new i(c.x,c.y,v.width,v.height):this.rect=new i}u.prototype=Object.create(a.prototype);for(var f in a)u[f]=a[f];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(h){this.rect.width=h},u.prototype.getHeight=function(){return this.rect.height},u.prototype.setHeight=function(h){this.rect.height=h},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(h,c){this.rect.x=h.x,this.rect.y=h.y,this.rect.width=c.width,this.rect.height=c.height},u.prototype.setCenter=function(h,c){this.rect.x=h-this.rect.width/2,this.rect.y=c-this.rect.height/2},u.prototype.setLocation=function(h,c){this.rect.x=h,this.rect.y=c},u.prototype.moveBy=function(h,c){this.rect.x+=h,this.rect.y+=c},u.prototype.getEdgeListToNode=function(h){var c=[],v,d=this;return d.edges.forEach(function(y){if(y.target==h){if(y.source!=d)throw"Incorrect edge source!";c.push(y)}}),c},u.prototype.getEdgesBetween=function(h){var c=[],v,d=this;return d.edges.forEach(function(y){if(!(y.source==d||y.target==d))throw"Incorrect edge source and/or target";(y.target==h||y.source==h)&&c.push(y)}),c},u.prototype.getNeighborsList=function(){var h=new Set,c=this;return c.edges.forEach(function(v){if(v.source==c)h.add(v.target);else{if(v.target!=c)throw"Incorrect incidency!";h.add(v.source)}}),h},u.prototype.withChildren=function(){var h=new Set,c,v;if(h.add(this),this.child!=null)for(var d=this.child.getNodes(),y=0;y<d.length;y++)c=d[y],v=c.withChildren(),v.forEach(function(p){h.add(p)});return h},u.prototype.getNoOfChildren=function(){var h=0,c;if(this.child==null)h=1;else for(var v=this.child.getNodes(),d=0;d<v.length;d++)c=v[d],h+=c.getNoOfChildren();return h==0&&(h=1),h},u.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},u.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},u.prototype.scatter=function(){var h,c,v=-s.INITIAL_WORLD_BOUNDARY,d=s.INITIAL_WORLD_BOUNDARY;h=s.WORLD_CENTER_X+o.nextDouble()*(d-v)+v;var y=-s.INITIAL_WORLD_BOUNDARY,p=s.INITIAL_WORLD_BOUNDARY;c=s.WORLD_CENTER_Y+o.nextDouble()*(p-y)+y,this.rect.x=h,this.rect.y=c},u.prototype.updateBounds=function(){if(this.getChild()==null)throw"assert failed";if(this.getChild().getNodes().length!=0){var h=this.getChild();if(h.updateBounds(!0),this.rect.x=h.getLeft(),this.rect.y=h.getTop(),this.setWidth(h.getRight()-h.getLeft()),this.setHeight(h.getBottom()-h.getTop()),s.NODE_DIMENSIONS_INCLUDE_LABELS){var c=h.getRight()-h.getLeft(),v=h.getBottom()-h.getTop();this.labelWidth>c&&(this.rect.x-=(this.labelWidth-c)/2,this.setWidth(this.labelWidth)),this.labelHeight>v&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-v)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-v),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==n.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(h){var c=this.rect.x;c>s.WORLD_BOUNDARY?c=s.WORLD_BOUNDARY:c<-s.WORLD_BOUNDARY&&(c=-s.WORLD_BOUNDARY);var v=this.rect.y;v>s.WORLD_BOUNDARY?v=s.WORLD_BOUNDARY:v<-s.WORLD_BOUNDARY&&(v=-s.WORLD_BOUNDARY);var d=new l(c,v),y=h.inverseTransformPoint(d);this.setLocation(y.x,y.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 this.owner==null?null:this.owner.getParent()},t.exports=u},function(t,e,r){"use strict";function a(n,i){n==null&&i==null?(this.x=0,this.y=0):(this.x=n,this.y=i)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.setX=function(n){this.x=n},a.prototype.setY=function(n){this.y=n},a.prototype.getDifference=function(n){return new DimensionD(this.x-n.x,this.y-n.y)},a.prototype.getCopy=function(){return new a(this.x,this.y)},a.prototype.translate=function(n){return this.x+=n.width,this.y+=n.height,this},t.exports=a},function(t,e,r){"use strict";var a=r(2),n=r(10),i=r(0),s=r(6),o=r(3),l=r(1),u=r(13),f=r(12),h=r(11);function c(d,y,p){a.call(this,p),this.estimatedSize=n.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=d,y!=null&&y instanceof s?this.graphManager=y:y!=null&&y instanceof Layout&&(this.graphManager=y.graphManager)}c.prototype=Object.create(a.prototype);for(var v in a)c[v]=a[v];c.prototype.getNodes=function(){return this.nodes},c.prototype.getEdges=function(){return this.edges},c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getParent=function(){return this.parent},c.prototype.getLeft=function(){return this.left},c.prototype.getRight=function(){return this.right},c.prototype.getTop=function(){return this.top},c.prototype.getBottom=function(){return this.bottom},c.prototype.isConnected=function(){return this.isConnected},c.prototype.add=function(d,y,p){if(y==null&&p==null){var g=d;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var m=d;if(!(this.getNodes().indexOf(y)>-1&&this.getNodes().indexOf(p)>-1))throw"Source or target not in graph!";if(!(y.owner==p.owner&&y.owner==this))throw"Both owners must be this graph!";return y.owner!=p.owner?null:(m.source=y,m.target=p,m.isInterGraph=!1,this.getEdges().push(m),y.edges.push(m),p!=y&&p.edges.push(m),m)}},c.prototype.remove=function(d){var y=d;if(d instanceof o){if(y==null)throw"Node is null!";if(!(y.owner!=null&&y.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var p=y.edges.slice(),g,m=p.length,E=0;E<m;E++)g=p[E],g.isInterGraph?this.graphManager.remove(g):g.source.owner.remove(g);var D=this.nodes.indexOf(y);if(D==-1)throw"Node not in owner node list!";this.nodes.splice(D,1)}else if(d instanceof l){var g=d;if(g==null)throw"Edge is null!";if(!(g.source!=null&&g.target!=null))throw"Source and/or target is null!";if(!(g.source.owner!=null&&g.target.owner!=null&&g.source.owner==this&&g.target.owner==this))throw"Source and/or target owner is invalid!";var b=g.source.edges.indexOf(g),x=g.target.edges.indexOf(g);if(!(b>-1&&x>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(b,1),g.target!=g.source&&g.target.edges.splice(x,1);var D=g.source.owner.getEdges().indexOf(g);if(D==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(D,1)}},c.prototype.updateLeftTop=function(){for(var d=n.MAX_VALUE,y=n.MAX_VALUE,p,g,m,E=this.getNodes(),D=E.length,b=0;b<D;b++){var x=E[b];p=x.getTop(),g=x.getLeft(),d>p&&(d=p),y>g&&(y=g)}return d==n.MAX_VALUE?null:(E[0].getParent().paddingLeft!=null?m=E[0].getParent().paddingLeft:m=this.margin,this.left=y-m,this.top=d-m,new f(this.left,this.top))},c.prototype.updateBounds=function(d){for(var y=n.MAX_VALUE,p=-n.MAX_VALUE,g=n.MAX_VALUE,m=-n.MAX_VALUE,E,D,b,x,w,T=this.nodes,C=T.length,S=0;S<C;S++){var A=T[S];d&&A.child!=null&&A.updateBounds(),E=A.getLeft(),D=A.getRight(),b=A.getTop(),x=A.getBottom(),y>E&&(y=E),p<D&&(p=D),g>b&&(g=b),m<x&&(m=x)}var L=new u(y,g,p-y,m-g);y==n.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),T[0].getParent().paddingLeft!=null?w=T[0].getParent().paddingLeft:w=this.margin,this.left=L.x-w,this.right=L.x+L.width+w,this.top=L.y-w,this.bottom=L.y+L.height+w},c.calculateBounds=function(d){for(var y=n.MAX_VALUE,p=-n.MAX_VALUE,g=n.MAX_VALUE,m=-n.MAX_VALUE,E,D,b,x,w=d.length,T=0;T<w;T++){var C=d[T];E=C.getLeft(),D=C.getRight(),b=C.getTop(),x=C.getBottom(),y>E&&(y=E),p<D&&(p=D),g>b&&(g=b),m<x&&(m=x)}var S=new u(y,g,p-y,m-g);return S},c.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},c.prototype.getEstimatedSize=function(){if(this.estimatedSize==n.MIN_VALUE)throw"assert failed";return this.estimatedSize},c.prototype.calcEstimatedSize=function(){for(var d=0,y=this.nodes,p=y.length,g=0;g<p;g++){var m=y[g];d+=m.calcEstimatedSize()}return d==0?this.estimatedSize=i.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=d/Math.sqrt(this.nodes.length),this.estimatedSize},c.prototype.updateConnected=function(){var d=this;if(this.nodes.length==0){this.isConnected=!0;return}var y=new h,p=new Set,g=this.nodes[0],m,E,D=g.withChildren();for(D.forEach(function(S){y.push(S),p.add(S)});y.length!==0;){g=y.shift(),m=g.getEdges();for(var b=m.length,x=0;x<b;x++){var w=m[x];if(E=w.getOtherEndInGraph(g,this),E!=null&&!p.has(E)){var T=E.withChildren();T.forEach(function(S){y.push(S),p.add(S)})}}}if(this.isConnected=!1,p.size>=this.nodes.length){var C=0;p.forEach(function(S){S.owner==d&&C++}),C==this.nodes.length&&(this.isConnected=!0)}},t.exports=c},function(t,e,r){"use strict";var a,n=r(1);function i(s){a=r(5),this.layout=s,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var s=this.layout.newGraph(),o=this.layout.newNode(null),l=this.add(s,o);return this.setRootGraph(l),this.rootGraph},i.prototype.add=function(s,o,l,u,f){if(l==null&&u==null&&f==null){if(s==null)throw"Graph is null!";if(o==null)throw"Parent node is null!";if(this.graphs.indexOf(s)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(s),s.parent!=null)throw"Already has a parent!";if(o.child!=null)throw"Already has a child!";return s.parent=o,o.child=s,s}else{f=l,u=o,l=s;var h=u.getOwner(),c=f.getOwner();if(!(h!=null&&h.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(c!=null&&c.getGraphManager()==this))throw"Target not in this graph mgr!";if(h==c)return l.isInterGraph=!1,h.add(l,u,f);if(l.isInterGraph=!0,l.source=u,l.target=f,this.edges.indexOf(l)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(l),!(l.source!=null&&l.target!=null))throw"Edge source and/or target is null!";if(!(l.source.edges.indexOf(l)==-1&&l.target.edges.indexOf(l)==-1))throw"Edge already in source and/or target incidency list!";return l.source.edges.push(l),l.target.edges.push(l),l}},i.prototype.remove=function(s){if(s instanceof a){var o=s;if(o.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(o==this.rootGraph||o.parent!=null&&o.parent.graphManager==this))throw"Invalid parent node!";var l=[];l=l.concat(o.getEdges());for(var u,f=l.length,h=0;h<f;h++)u=l[h],o.remove(u);var c=[];c=c.concat(o.getNodes());var v;f=c.length;for(var h=0;h<f;h++)v=c[h],o.remove(v);o==this.rootGraph&&this.setRootGraph(null);var d=this.graphs.indexOf(o);this.graphs.splice(d,1),o.parent=null}else if(s instanceof n){if(u=s,u==null)throw"Edge is null!";if(!u.isInterGraph)throw"Not an inter-graph edge!";if(!(u.source!=null&&u.target!=null))throw"Source and/or target is null!";if(!(u.source.edges.indexOf(u)!=-1&&u.target.edges.indexOf(u)!=-1))throw"Source and/or target doesn't know this edge!";var d=u.source.edges.indexOf(u);if(u.source.edges.splice(d,1),d=u.target.edges.indexOf(u),u.target.edges.splice(d,1),!(u.source.owner!=null&&u.source.owner.getGraphManager()!=null))throw"Edge owner graph or owner graph manager is null!";if(u.source.owner.getGraphManager().edges.indexOf(u)==-1)throw"Not in owner graph manager's edge list!";var d=u.source.owner.getGraphManager().edges.indexOf(u);u.source.owner.getGraphManager().edges.splice(d,1)}},i.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},i.prototype.getGraphs=function(){return this.graphs},i.prototype.getAllNodes=function(){if(this.allNodes==null){for(var s=[],o=this.getGraphs(),l=o.length,u=0;u<l;u++)s=s.concat(o[u].getNodes());this.allNodes=s}return this.allNodes},i.prototype.resetAllNodes=function(){this.allNodes=null},i.prototype.resetAllEdges=function(){this.allEdges=null},i.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},i.prototype.getAllEdges=function(){if(this.allEdges==null){for(var s=[],o=this.getGraphs(),l=o.length,u=0;u<o.length;u++)s=s.concat(o[u].getEdges());s=s.concat(this.edges),this.allEdges=s}return this.allEdges},i.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},i.prototype.setAllNodesToApplyGravitation=function(s){if(this.allNodesToApplyGravitation!=null)throw"assert failed";this.allNodesToApplyGravitation=s},i.prototype.getRoot=function(){return this.rootGraph},i.prototype.setRootGraph=function(s){if(s.getGraphManager()!=this)throw"Root not in this graph mgr!";this.rootGraph=s,s.parent==null&&(s.parent=this.layout.newNode("Root node"))},i.prototype.getLayout=function(){return this.layout},i.prototype.isOneAncestorOfOther=function(s,o){if(!(s!=null&&o!=null))throw"assert failed";if(s==o)return!0;var l=s.getOwner(),u;do{if(u=l.getParent(),u==null)break;if(u==o)return!0;if(l=u.getOwner(),l==null)break}while(!0);l=o.getOwner();do{if(u=l.getParent(),u==null)break;if(u==s)return!0;if(l=u.getOwner(),l==null)break}while(!0);return!1},i.prototype.calcLowestCommonAncestors=function(){for(var s,o,l,u,f,h=this.getAllEdges(),c=h.length,v=0;v<c;v++){if(s=h[v],o=s.source,l=s.target,s.lca=null,s.sourceInLca=o,s.targetInLca=l,o==l){s.lca=o.getOwner();continue}for(u=o.getOwner();s.lca==null;){for(s.targetInLca=l,f=l.getOwner();s.lca==null;){if(f==u){s.lca=f;break}if(f==this.rootGraph)break;if(s.lca!=null)throw"assert failed";s.targetInLca=f.getParent(),f=s.targetInLca.getOwner()}if(u==this.rootGraph)break;s.lca==null&&(s.sourceInLca=u.getParent(),u=s.sourceInLca.getOwner())}if(s.lca==null)throw"assert failed"}},i.prototype.calcLowestCommonAncestor=function(s,o){if(s==o)return s.getOwner();var l=s.getOwner();do{if(l==null)break;var u=o.getOwner();do{if(u==null)break;if(u==l)return u;u=u.getParent().getOwner()}while(!0);l=l.getParent().getOwner()}while(!0);return l},i.prototype.calcInclusionTreeDepths=function(s,o){s==null&&o==null&&(s=this.rootGraph,o=1);for(var l,u=s.getNodes(),f=u.length,h=0;h<f;h++)l=u[h],l.inclusionTreeDepth=o,l.child!=null&&this.calcInclusionTreeDepths(l.child,o+1)},i.prototype.includesInvalidEdge=function(){for(var s,o=this.edges.length,l=0;l<o;l++)if(s=this.edges[l],this.isOneAncestorOfOther(s.source,s.target))return!0;return!1},t.exports=i},function(t,e,r){"use strict";var a=r(0);function n(){}for(var i in a)n[i]=a[i];n.MAX_ITERATIONS=2500,n.DEFAULT_EDGE_LENGTH=50,n.DEFAULT_SPRING_STRENGTH=.45,n.DEFAULT_REPULSION_STRENGTH=4500,n.DEFAULT_GRAVITY_STRENGTH=.4,n.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,n.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,n.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,n.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,n.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,n.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,n.COOLING_ADAPTATION_FACTOR=.33,n.ADAPTATION_LOWER_NODE_LIMIT=1e3,n.ADAPTATION_UPPER_NODE_LIMIT=5e3,n.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,n.MAX_NODE_DISPLACEMENT=n.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,n.MIN_REPULSION_DIST=n.DEFAULT_EDGE_LENGTH/10,n.CONVERGENCE_CHECK_PERIOD=100,n.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,n.MIN_EDGE_LENGTH=1,n.GRID_CALCULATION_CHECK_PERIOD=10,t.exports=n},function(t,e,r){"use strict";var a=r(12);function n(){}n.calcSeparationAmount=function(i,s,o,l){if(!i.intersects(s))throw"assert failed";var u=new Array(2);this.decideDirectionsForOverlappingNodes(i,s,u),o[0]=Math.min(i.getRight(),s.getRight())-Math.max(i.x,s.x),o[1]=Math.min(i.getBottom(),s.getBottom())-Math.max(i.y,s.y),i.getX()<=s.getX()&&i.getRight()>=s.getRight()?o[0]+=Math.min(s.getX()-i.getX(),i.getRight()-s.getRight()):s.getX()<=i.getX()&&s.getRight()>=i.getRight()&&(o[0]+=Math.min(i.getX()-s.getX(),s.getRight()-i.getRight())),i.getY()<=s.getY()&&i.getBottom()>=s.getBottom()?o[1]+=Math.min(s.getY()-i.getY(),i.getBottom()-s.getBottom()):s.getY()<=i.getY()&&s.getBottom()>=i.getBottom()&&(o[1]+=Math.min(i.getY()-s.getY(),s.getBottom()-i.getBottom()));var f=Math.abs((s.getCenterY()-i.getCenterY())/(s.getCenterX()-i.getCenterX()));s.getCenterY()===i.getCenterY()&&s.getCenterX()===i.getCenterX()&&(f=1);var h=f*o[0],c=o[1]/f;o[0]<c?c=o[0]:h=o[1],o[0]=-1*u[0]*(c/2+l),o[1]=-1*u[1]*(h/2+l)},n.decideDirectionsForOverlappingNodes=function(i,s,o){i.getCenterX()<s.getCenterX()?o[0]=-1:o[0]=1,i.getCenterY()<s.getCenterY()?o[1]=-1:o[1]=1},n.getIntersection2=function(i,s,o){var l=i.getCenterX(),u=i.getCenterY(),f=s.getCenterX(),h=s.getCenterY();if(i.intersects(s))return o[0]=l,o[1]=u,o[2]=f,o[3]=h,!0;var c=i.getX(),v=i.getY(),d=i.getRight(),y=i.getX(),p=i.getBottom(),g=i.getRight(),m=i.getWidthHalf(),E=i.getHeightHalf(),D=s.getX(),b=s.getY(),x=s.getRight(),w=s.getX(),T=s.getBottom(),C=s.getRight(),S=s.getWidthHalf(),A=s.getHeightHalf(),L=!1,I=!1;if(l===f){if(u>h)return o[0]=l,o[1]=v,o[2]=f,o[3]=T,!1;if(u<h)return o[0]=l,o[1]=p,o[2]=f,o[3]=b,!1}else if(u===h){if(l>f)return o[0]=c,o[1]=u,o[2]=x,o[3]=h,!1;if(l<f)return o[0]=d,o[1]=u,o[2]=D,o[3]=h,!1}else{var O=i.height/i.width,k=s.height/s.width,R=(h-u)/(f-l),M=void 0,P=void 0,F=void 0,V=void 0,G=void 0,B=void 0;if(-O===R?l>f?(o[0]=y,o[1]=p,L=!0):(o[0]=d,o[1]=v,L=!0):O===R&&(l>f?(o[0]=c,o[1]=v,L=!0):(o[0]=g,o[1]=p,L=!0)),-k===R?f>l?(o[2]=w,o[3]=T,I=!0):(o[2]=x,o[3]=b,I=!0):k===R&&(f>l?(o[2]=D,o[3]=b,I=!0):(o[2]=C,o[3]=T,I=!0)),L&&I)return!1;if(l>f?u>h?(M=this.getCardinalDirection(O,R,4),P=this.getCardinalDirection(k,R,2)):(M=this.getCardinalDirection(-O,R,3),P=this.getCardinalDirection(-k,R,1)):u>h?(M=this.getCardinalDirection(-O,R,1),P=this.getCardinalDirection(-k,R,3)):(M=this.getCardinalDirection(O,R,2),P=this.getCardinalDirection(k,R,4)),!L)switch(M){case 1:V=v,F=l+-E/R,o[0]=F,o[1]=V;break;case 2:F=g,V=u+m*R,o[0]=F,o[1]=V;break;case 3:V=p,F=l+E/R,o[0]=F,o[1]=V;break;case 4:F=y,V=u+-m*R,o[0]=F,o[1]=V;break}if(!I)switch(P){case 1:B=b,G=f+-A/R,o[2]=G,o[3]=B;break;case 2:G=C,B=h+S*R,o[2]=G,o[3]=B;break;case 3:B=T,G=f+A/R,o[2]=G,o[3]=B;break;case 4:G=w,B=h+-S*R,o[2]=G,o[3]=B;break}}return!1},n.getCardinalDirection=function(i,s,o){return i>s?o:1+o%4},n.getIntersection=function(i,s,o,l){if(l==null)return this.getIntersection2(i,s,o);var u=i.x,f=i.y,h=s.x,c=s.y,v=o.x,d=o.y,y=l.x,p=l.y,g=void 0,m=void 0,E=void 0,D=void 0,b=void 0,x=void 0,w=void 0,T=void 0,C=void 0;return E=c-f,b=u-h,w=h*f-u*c,D=p-d,x=v-y,T=y*d-v*p,C=E*x-D*b,C===0?null:(g=(b*T-x*w)/C,m=(D*w-E*T)/C,new a(g,m))},n.angleOfVector=function(i,s,o,l){var u=void 0;return i!==o?(u=Math.atan((l-s)/(o-i)),o<i?u+=Math.PI:l<s&&(u+=this.TWO_PI)):l<s?u=this.ONE_AND_HALF_PI:u=this.HALF_PI,u},n.doIntersect=function(i,s,o,l){var u=i.x,f=i.y,h=s.x,c=s.y,v=o.x,d=o.y,y=l.x,p=l.y,g=(h-u)*(p-d)-(y-v)*(c-f);if(g===0)return!1;var m=((p-d)*(y-u)+(v-y)*(p-f))/g,E=((f-c)*(y-u)+(h-u)*(p-f))/g;return 0<m&&m<1&&0<E&&E<1},n.HALF_PI=.5*Math.PI,n.ONE_AND_HALF_PI=1.5*Math.PI,n.TWO_PI=2*Math.PI,n.THREE_PI=3*Math.PI,t.exports=n},function(t,e,r){"use strict";function a(){}a.sign=function(n){return n>0?1:n<0?-1:0},a.floor=function(n){return n<0?Math.ceil(n):Math.floor(n)},a.ceil=function(n){return n<0?Math.floor(n):Math.ceil(n)},t.exports=a},function(t,e,r){"use strict";function a(){}a.MAX_VALUE=2147483647,a.MIN_VALUE=-2147483648,t.exports=a},function(t,e,r){"use strict";var a=function(){function u(f,h){for(var c=0;c<h.length;c++){var v=h[c];v.enumerable=v.enumerable||!1,v.configurable=!0,"value"in v&&(v.writable=!0),Object.defineProperty(f,v.key,v)}}return function(f,h,c){return h&&u(f.prototype,h),c&&u(f,c),f}}();function n(u,f){if(!(u instanceof f))throw new TypeError("Cannot call a class as a function")}var i=function(f){return{value:f,next:null,prev:null}},s=function(f,h,c,v){return f!==null?f.next=h:v.head=h,c!==null?c.prev=h:v.tail=h,h.prev=f,h.next=c,v.length++,h},o=function(f,h){var c=f.prev,v=f.next;return c!==null?c.next=v:h.head=v,v!==null?v.prev=c:h.tail=c,f.prev=f.next=null,h.length--,f},l=function(){function u(f){var h=this;n(this,u),this.length=0,this.head=null,this.tail=null,f!=null&&f.forEach(function(c){return h.push(c)})}return a(u,[{key:"size",value:function(){return this.length}},{key:"insertBefore",value:function(h,c){return s(c.prev,i(h),c,this)}},{key:"insertAfter",value:function(h,c){return s(c,i(h),c.next,this)}},{key:"insertNodeBefore",value:function(h,c){return s(c.prev,h,c,this)}},{key:"insertNodeAfter",value:function(h,c){return s(c,h,c.next,this)}},{key:"push",value:function(h){return s(this.tail,i(h),null,this)}},{key:"unshift",value:function(h){return s(null,i(h),this.head,this)}},{key:"remove",value:function(h){return o(h,this)}},{key:"pop",value:function(){return o(this.tail,this).value}},{key:"popNode",value:function(){return o(this.tail,this)}},{key:"shift",value:function(){return o(this.head,this).value}},{key:"shiftNode",value:function(){return o(this.head,this)}},{key:"get_object_at",value:function(h){if(h<=this.length()){for(var c=1,v=this.head;c<h;)v=v.next,c++;return v.value}}},{key:"set_object_at",value:function(h,c){if(h<=this.length()){for(var v=1,d=this.head;v<h;)d=d.next,v++;d.value=c}}}]),u}();t.exports=l},function(t,e,r){"use strict";function a(n,i,s){this.x=null,this.y=null,n==null&&i==null&&s==null?(this.x=0,this.y=0):typeof n=="number"&&typeof i=="number"&&s==null?(this.x=n,this.y=i):n.constructor.name=="Point"&&i==null&&s==null&&(s=n,this.x=s.x,this.y=s.y)}a.prototype.getX=function(){return this.x},a.prototype.getY=function(){return this.y},a.prototype.getLocation=function(){return new a(this.x,this.y)},a.prototype.setLocation=function(n,i,s){n.constructor.name=="Point"&&i==null&&s==null?(s=n,this.setLocation(s.x,s.y)):typeof n=="number"&&typeof i=="number"&&s==null&&(parseInt(n)==n&&parseInt(i)==i?this.move(n,i):(this.x=Math.floor(n+.5),this.y=Math.floor(i+.5)))},a.prototype.move=function(n,i){this.x=n,this.y=i},a.prototype.translate=function(n,i){this.x+=n,this.y+=i},a.prototype.equals=function(n){if(n.constructor.name=="Point"){var i=n;return this.x==i.x&&this.y==i.y}return this==n},a.prototype.toString=function(){return new a().constructor.name+"[x="+this.x+",y="+this.y+"]"},t.exports=a},function(t,e,r){"use strict";function a(n,i,s,o){this.x=0,this.y=0,this.width=0,this.height=0,n!=null&&i!=null&&s!=null&&o!=null&&(this.x=n,this.y=i,this.width=s,this.height=o)}a.prototype.getX=function(){return this.x},a.prototype.setX=function(n){this.x=n},a.prototype.getY=function(){return this.y},a.prototype.setY=function(n){this.y=n},a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},a.prototype.getRight=function(){return this.x+this.width},a.prototype.getBottom=function(){return this.y+this.height},a.prototype.intersects=function(n){return!(this.getRight()<n.x||this.getBottom()<n.y||n.getRight()<this.x||n.getBottom()<this.y)},a.prototype.getCenterX=function(){return this.x+this.width/2},a.prototype.getMinX=function(){return this.getX()},a.prototype.getMaxX=function(){return this.getX()+this.width},a.prototype.getCenterY=function(){return this.y+this.height/2},a.prototype.getMinY=function(){return this.getY()},a.prototype.getMaxY=function(){return this.getY()+this.height},a.prototype.getWidthHalf=function(){return this.width/2},a.prototype.getHeightHalf=function(){return this.height/2},t.exports=a},function(t,e,r){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(i){return typeof i}:function(i){return i&&typeof Symbol=="function"&&i.constructor===Symbol&&i!==Symbol.prototype?"symbol":typeof i};function n(){}n.lastID=0,n.createID=function(i){return n.isPrimitive(i)?i:(i.uniqueID!=null||(i.uniqueID=n.getString(),n.lastID++),i.uniqueID)},n.getString=function(i){return i==null&&(i=n.lastID),"Object#"+i},n.isPrimitive=function(i){var s=typeof i=="undefined"?"undefined":a(i);return i==null||s!="object"&&s!="function"},t.exports=n},function(t,e,r){"use strict";function a(v){if(Array.isArray(v)){for(var d=0,y=Array(v.length);d<v.length;d++)y[d]=v[d];return y}else return Array.from(v)}var n=r(0),i=r(6),s=r(3),o=r(1),l=r(5),u=r(4),f=r(17),h=r(27);function c(v){h.call(this),this.layoutQuality=n.QUALITY,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=n.DEFAULT_INCREMENTAL,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new i(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,v!=null&&(this.isRemoteUse=v)}c.RANDOM_SEED=1,c.prototype=Object.create(h.prototype),c.prototype.getGraphManager=function(){return this.graphManager},c.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},c.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},c.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},c.prototype.newGraphManager=function(){var v=new i(this);return this.graphManager=v,v},c.prototype.newGraph=function(v){return new l(null,this.graphManager,v)},c.prototype.newNode=function(v){return new s(this.graphManager,v)},c.prototype.newEdge=function(v){return new o(null,null,v)},c.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},c.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var v;return this.checkLayoutSuccess()?v=!1:v=this.layout(),n.ANIMATE==="during"?!1:(v&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,v)},c.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},c.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var v,d=this.graphManager.getAllEdges(),y=0;y<d.length;y++)v=d[y];for(var p,g=this.graphManager.getRoot().getNodes(),y=0;y<g.length;y++)p=g[y];this.update(this.graphManager.getRoot())}},c.prototype.update=function(v){if(v==null)this.update2();else if(v instanceof s){var d=v;if(d.getChild()!=null)for(var y=d.getChild().getNodes(),p=0;p<y.length;p++)update(y[p]);if(d.vGraphObject!=null){var g=d.vGraphObject;g.update(d)}}else if(v instanceof o){var m=v;if(m.vGraphObject!=null){var E=m.vGraphObject;E.update(m)}}else if(v instanceof l){var D=v;if(D.vGraphObject!=null){var b=D.vGraphObject;b.update(D)}}},c.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=n.QUALITY,this.animationDuringLayout=n.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=n.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=n.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=n.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=n.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=n.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},c.prototype.transform=function(v){if(v==null)this.transform(new u(0,0));else{var d=new f,y=this.graphManager.getRoot().updateLeftTop();if(y!=null){d.setWorldOrgX(v.x),d.setWorldOrgY(v.y),d.setDeviceOrgX(y.x),d.setDeviceOrgY(y.y);for(var p=this.getAllNodes(),g,m=0;m<p.length;m++)g=p[m],g.transform(d)}}},c.prototype.positionNodesRandomly=function(v){if(v==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var d,y,p=v.getNodes(),g=0;g<p.length;g++)d=p[g],y=d.getChild(),y==null||y.getNodes().length==0?d.scatter():(this.positionNodesRandomly(y),d.updateBounds())},c.prototype.getFlatForest=function(){for(var v=[],d=!0,y=this.graphManager.getRoot().getNodes(),p=!0,g=0;g<y.length;g++)y[g].getChild()!=null&&(p=!1);if(!p)return v;var m=new Set,E=[],D=new Map,b=[];for(b=b.concat(y);b.length>0&&d;){for(E.push(b[0]);E.length>0&&d;){var x=E[0];E.splice(0,1),m.add(x);for(var w=x.getEdges(),g=0;g<w.length;g++){var T=w[g].getOtherEnd(x);if(D.get(x)!=T)if(!m.has(T))E.push(T),D.set(T,x);else{d=!1;break}}}if(!d)v=[];else{var C=[].concat(a(m));v.push(C);for(var g=0;g<C.length;g++){var S=C[g],A=b.indexOf(S);A>-1&&b.splice(A,1)}m=new Set,D=new Map}}return v},c.prototype.createDummyNodesForBendpoints=function(v){for(var d=[],y=v.source,p=this.graphManager.calcLowestCommonAncestor(v.source,v.target),g=0;g<v.bendpoints.length;g++){var m=this.newNode(null);m.setRect(new Point(0,0),new Dimension(1,1)),p.add(m);var E=this.newEdge(null);this.graphManager.add(E,y,m),d.add(m),y=m}var E=this.newEdge(null);return this.graphManager.add(E,y,v.target),this.edgeToDummyNodes.set(v,d),v.isInterGraph()?this.graphManager.remove(v):p.remove(v),d},c.prototype.createBendpointsFromDummyNodes=function(){var v=[];v=v.concat(this.graphManager.getAllEdges()),v=[].concat(a(this.edgeToDummyNodes.keys())).concat(v);for(var d=0;d<v.length;d++){var y=v[d];if(y.bendpoints.length>0){for(var p=this.edgeToDummyNodes.get(y),g=0;g<p.length;g++){var m=p[g],E=new u(m.getCenterX(),m.getCenterY()),D=y.bendpoints.get(g);D.x=E.x,D.y=E.y,m.getOwner().remove(m)}this.graphManager.add(y,y.source,y.target)}}},c.transform=function(v,d,y,p){if(y!=null&&p!=null){var g=d;if(v<=50){var m=d/y;g-=(d-m)/50*(50-v)}else{var E=d*p;g+=(E-d)/50*(v-50)}return g}else{var D,b;return v<=50?(D=9*d/500,b=d/10):(D=9*d/50,b=-8*d),D*v+b}},c.findCenterOfTree=function(v){var d=[];d=d.concat(v);var y=[],p=new Map,g=!1,m=null;(d.length==1||d.length==2)&&(g=!0,m=d[0]);for(var E=0;E<d.length;E++){var D=d[E],b=D.getNeighborsList().size;p.set(D,D.getNeighborsList().size),b==1&&y.push(D)}var x=[];for(x=x.concat(y);!g;){var w=[];w=w.concat(x),x=[];for(var E=0;E<d.length;E++){var D=d[E],T=d.indexOf(D);T>=0&&d.splice(T,1);var C=D.getNeighborsList();C.forEach(function(L){if(y.indexOf(L)<0){var I=p.get(L),O=I-1;O==1&&x.push(L),p.set(L,O)}})}y=y.concat(x),(d.length==1||d.length==2)&&(g=!0,m=d[0])}return m},c.prototype.setGraphManager=function(v){this.graphManager=v},t.exports=c},function(t,e,r){"use strict";function a(){}a.seed=1,a.x=0,a.nextDouble=function(){return a.x=Math.sin(a.seed++)*1e4,a.x-Math.floor(a.x)},t.exports=a},function(t,e,r){"use strict";var a=r(4);function n(i,s){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}n.prototype.getWorldOrgX=function(){return this.lworldOrgX},n.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},n.prototype.getWorldOrgY=function(){return this.lworldOrgY},n.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},n.prototype.getWorldExtX=function(){return this.lworldExtX},n.prototype.setWorldExtX=function(i){this.lworldExtX=i},n.prototype.getWorldExtY=function(){return this.lworldExtY},n.prototype.setWorldExtY=function(i){this.lworldExtY=i},n.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},n.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},n.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},n.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},n.prototype.getDeviceExtX=function(){return this.ldeviceExtX},n.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},n.prototype.getDeviceExtY=function(){return this.ldeviceExtY},n.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},n.prototype.transformX=function(i){var s=0,o=this.lworldExtX;return o!=0&&(s=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/o),s},n.prototype.transformY=function(i){var s=0,o=this.lworldExtY;return o!=0&&(s=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/o),s},n.prototype.inverseTransformX=function(i){var s=0,o=this.ldeviceExtX;return o!=0&&(s=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/o),s},n.prototype.inverseTransformY=function(i){var s=0,o=this.ldeviceExtY;return o!=0&&(s=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/o),s},n.prototype.inverseTransformPoint=function(i){var s=new a(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return s},t.exports=n},function(t,e,r){"use strict";function a(h){if(Array.isArray(h)){for(var c=0,v=Array(h.length);c<h.length;c++)v[c]=h[c];return v}else return Array.from(h)}var n=r(15),i=r(7),s=r(0),o=r(8),l=r(9);function u(){n.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}u.prototype=Object.create(n.prototype);for(var f in n)u[f]=n[f];u.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},u.prototype.calcIdealEdgeLengths=function(){for(var h,c,v,d,y,p,g=this.getGraphManager().getAllEdges(),m=0;m<g.length;m++)h=g[m],h.idealLength=this.idealEdgeLength,h.isInterGraph&&(v=h.getSource(),d=h.getTarget(),y=h.getSourceInLca().getEstimatedSize(),p=h.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(h.idealLength+=y+p-2*s.SIMPLE_NODE_SIZE),c=h.getLca().getInclusionTreeDepth(),h.idealLength+=i.DEFAULT_EDGE_LENGTH*i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(v.getInclusionTreeDepth()+d.getInclusionTreeDepth()-2*c))},u.prototype.initSpringEmbedder=function(){var h=this.getAllNodes().length;this.incremental?(h>i.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(h-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):(h>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(h-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(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},u.prototype.calcSpringForces=function(){for(var h=this.getAllEdges(),c,v=0;v<h.length;v++)c=h[v],this.calcSpringForce(c,c.idealLength)},u.prototype.calcRepulsionForces=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,v,d,y,p,g=this.getAllNodes(),m;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&h&&this.updateGrid(),m=new Set,v=0;v<g.length;v++)y=g[v],this.calculateRepulsionForceOfANode(y,m,h,c),m.add(y);else for(v=0;v<g.length;v++)for(y=g[v],d=v+1;d<g.length;d++)p=g[d],y.getOwner()==p.getOwner()&&this.calcRepulsionForce(y,p)},u.prototype.calcGravitationalForces=function(){for(var h,c=this.getAllNodesToApplyGravitation(),v=0;v<c.length;v++)h=c[v],this.calcGravitationalForce(h)},u.prototype.moveNodes=function(){for(var h=this.getAllNodes(),c,v=0;v<h.length;v++)c=h[v],c.move()},u.prototype.calcSpringForce=function(h,c){var v=h.getSource(),d=h.getTarget(),y,p,g,m;if(this.uniformLeafNodeSizes&&v.getChild()==null&&d.getChild()==null)h.updateLengthSimple();else if(h.updateLength(),h.isOverlapingSourceAndTarget)return;y=h.getLength(),y!=0&&(p=this.springConstant*(y-c),g=p*(h.lengthX/y),m=p*(h.lengthY/y),v.springForceX+=g,v.springForceY+=m,d.springForceX-=g,d.springForceY-=m)},u.prototype.calcRepulsionForce=function(h,c){var v=h.getRect(),d=c.getRect(),y=new Array(2),p=new Array(4),g,m,E,D,b,x,w;if(v.intersects(d)){o.calcSeparationAmount(v,d,y,i.DEFAULT_EDGE_LENGTH/2),x=2*y[0],w=2*y[1];var T=h.noOfChildren*c.noOfChildren/(h.noOfChildren+c.noOfChildren);h.repulsionForceX-=T*x,h.repulsionForceY-=T*w,c.repulsionForceX+=T*x,c.repulsionForceY+=T*w}else this.uniformLeafNodeSizes&&h.getChild()==null&&c.getChild()==null?(g=d.getCenterX()-v.getCenterX(),m=d.getCenterY()-v.getCenterY()):(o.getIntersection(v,d,p),g=p[2]-p[0],m=p[3]-p[1]),Math.abs(g)<i.MIN_REPULSION_DIST&&(g=l.sign(g)*i.MIN_REPULSION_DIST),Math.abs(m)<i.MIN_REPULSION_DIST&&(m=l.sign(m)*i.MIN_REPULSION_DIST),E=g*g+m*m,D=Math.sqrt(E),b=this.repulsionConstant*h.noOfChildren*c.noOfChildren/E,x=b*g/D,w=b*m/D,h.repulsionForceX-=x,h.repulsionForceY-=w,c.repulsionForceX+=x,c.repulsionForceY+=w},u.prototype.calcGravitationalForce=function(h){var c,v,d,y,p,g,m,E;c=h.getOwner(),v=(c.getRight()+c.getLeft())/2,d=(c.getTop()+c.getBottom())/2,y=h.getCenterX()-v,p=h.getCenterY()-d,g=Math.abs(y)+h.getWidth()/2,m=Math.abs(p)+h.getHeight()/2,h.getOwner()==this.graphManager.getRoot()?(E=c.getEstimatedSize()*this.gravityRangeFactor,(g>E||m>E)&&(h.gravitationForceX=-this.gravityConstant*y,h.gravitationForceY=-this.gravityConstant*p)):(E=c.getEstimatedSize()*this.compoundGravityRangeFactor,(g>E||m>E)&&(h.gravitationForceX=-this.gravityConstant*y*this.compoundGravityConstant,h.gravitationForceY=-this.gravityConstant*p*this.compoundGravityConstant))},u.prototype.isConverged=function(){var h,c=!1;return this.totalIterations>this.maxIterations/3&&(c=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),h=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,h||c},u.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},u.prototype.calcNoOfChildrenForAllNodes=function(){for(var h,c=this.graphManager.getAllNodes(),v=0;v<c.length;v++)h=c[v],h.noOfChildren=h.getNoOfChildren()},u.prototype.calcGrid=function(h){var c=0,v=0;c=parseInt(Math.ceil((h.getRight()-h.getLeft())/this.repulsionRange)),v=parseInt(Math.ceil((h.getBottom()-h.getTop())/this.repulsionRange));for(var d=new Array(c),y=0;y<c;y++)d[y]=new Array(v);for(var y=0;y<c;y++)for(var p=0;p<v;p++)d[y][p]=new Array;return d},u.prototype.addNodeToGrid=function(h,c,v){var d=0,y=0,p=0,g=0;d=parseInt(Math.floor((h.getRect().x-c)/this.repulsionRange)),y=parseInt(Math.floor((h.getRect().width+h.getRect().x-c)/this.repulsionRange)),p=parseInt(Math.floor((h.getRect().y-v)/this.repulsionRange)),g=parseInt(Math.floor((h.getRect().height+h.getRect().y-v)/this.repulsionRange));for(var m=d;m<=y;m++)for(var E=p;E<=g;E++)this.grid[m][E].push(h),h.setGridCoordinates(d,y,p,g)},u.prototype.updateGrid=function(){var h,c,v=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),h=0;h<v.length;h++)c=v[h],this.addNodeToGrid(c,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},u.prototype.calculateRepulsionForceOfANode=function(h,c,v,d){if(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&v||d){var y=new Set;h.surrounding=new Array;for(var p,g=this.grid,m=h.startX-1;m<h.finishX+2;m++)for(var E=h.startY-1;E<h.finishY+2;E++)if(!(m<0||E<0||m>=g.length||E>=g[0].length)){for(var D=0;D<g[m][E].length;D++)if(p=g[m][E][D],!(h.getOwner()!=p.getOwner()||h==p)&&!c.has(p)&&!y.has(p)){var b=Math.abs(h.getCenterX()-p.getCenterX())-(h.getWidth()/2+p.getWidth()/2),x=Math.abs(h.getCenterY()-p.getCenterY())-(h.getHeight()/2+p.getHeight()/2);b<=this.repulsionRange&&x<=this.repulsionRange&&y.add(p)}}h.surrounding=[].concat(a(y))}for(m=0;m<h.surrounding.length;m++)this.calcRepulsionForce(h,h.surrounding[m])},u.prototype.calcRepulsionRange=function(){return 0},t.exports=u},function(t,e,r){"use strict";var a=r(1),n=r(7);function i(o,l,u){a.call(this,o,l,u),this.idealLength=n.DEFAULT_EDGE_LENGTH}i.prototype=Object.create(a.prototype);for(var s in a)i[s]=a[s];t.exports=i},function(t,e,r){"use strict";var a=r(3);function n(s,o,l,u){a.call(this,s,o,l,u),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}n.prototype=Object.create(a.prototype);for(var i in a)n[i]=a[i];n.prototype.setGridCoordinates=function(s,o,l,u){this.startX=s,this.finishX=o,this.startY=l,this.finishY=u},t.exports=n},function(t,e,r){"use strict";function a(n,i){this.width=0,this.height=0,n!==null&&i!==null&&(this.height=i,this.width=n)}a.prototype.getWidth=function(){return this.width},a.prototype.setWidth=function(n){this.width=n},a.prototype.getHeight=function(){return this.height},a.prototype.setHeight=function(n){this.height=n},t.exports=a},function(t,e,r){"use strict";var a=r(14);function n(){this.map={},this.keys=[]}n.prototype.put=function(i,s){var o=a.createID(i);this.contains(o)||(this.map[o]=s,this.keys.push(i))},n.prototype.contains=function(i){var s=a.createID(i);return this.map[i]!=null},n.prototype.get=function(i){var s=a.createID(i);return this.map[s]},n.prototype.keySet=function(){return this.keys},t.exports=n},function(t,e,r){"use strict";var a=r(14);function n(){this.set={}}n.prototype.add=function(i){var s=a.createID(i);this.contains(s)||(this.set[s]=i)},n.prototype.remove=function(i){delete this.set[a.createID(i)]},n.prototype.clear=function(){this.set={}},n.prototype.contains=function(i){return this.set[a.createID(i)]==i},n.prototype.isEmpty=function(){return this.size()===0},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAllTo=function(i){for(var s=Object.keys(this.set),o=s.length,l=0;l<o;l++)i.push(this.set[s[l]])},n.prototype.size=function(){return Object.keys(this.set).length},n.prototype.addAll=function(i){for(var s=i.length,o=0;o<s;o++){var l=i[o];this.add(l)}},t.exports=n},function(t,e,r){"use strict";var a=function(){function o(l,u){for(var f=0;f<u.length;f++){var h=u[f];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(l,h.key,h)}}return function(l,u,f){return u&&o(l.prototype,u),f&&o(l,f),l}}();function n(o,l){if(!(o instanceof l))throw new TypeError("Cannot call a class as a function")}var i=r(11),s=function(){function o(l,u){n(this,o),(u!==null||u!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var f=void 0;l instanceof i?f=l.size():f=l.length,this._quicksort(l,0,f-1)}return a(o,[{key:"_quicksort",value:function(u,f,h){if(f<h){var c=this._partition(u,f,h);this._quicksort(u,f,c),this._quicksort(u,c+1,h)}}},{key:"_partition",value:function(u,f,h){for(var c=this._get(u,f),v=f,d=h;;){for(;this.compareFunction(c,this._get(u,d));)d--;for(;this.compareFunction(this._get(u,v),c);)v++;if(v<d)this._swap(u,v,d),v++,d--;else return d}}},{key:"_get",value:function(u,f){return u instanceof i?u.get_object_at(f):u[f]}},{key:"_set",value:function(u,f,h){u instanceof i?u.set_object_at(f,h):u[f]=h}},{key:"_swap",value:function(u,f,h){var c=this._get(u,f);this._set(u,f,this._get(u,h)),this._set(u,h,c)}},{key:"_defaultCompareFunction",value:function(u,f){return f>u}}]),o}();t.exports=s},function(t,e,r){"use strict";var a=function(){function s(o,l){for(var u=0;u<l.length;u++){var f=l[u];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(o,f.key,f)}}return function(o,l,u){return l&&s(o.prototype,l),u&&s(o,u),o}}();function n(s,o){if(!(s instanceof o))throw new TypeError("Cannot call a class as a function")}var i=function(){function s(o,l){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,h=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;n(this,s),this.sequence1=o,this.sequence2=l,this.match_score=u,this.mismatch_penalty=f,this.gap_penalty=h,this.iMax=o.length+1,this.jMax=l.length+1,this.grid=new Array(this.iMax);for(var c=0;c<this.iMax;c++){this.grid[c]=new Array(this.jMax);for(var v=0;v<this.jMax;v++)this.grid[c][v]=0}this.tracebackGrid=new Array(this.iMax);for(var d=0;d<this.iMax;d++){this.tracebackGrid[d]=new Array(this.jMax);for(var y=0;y<this.jMax;y++)this.tracebackGrid[d][y]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return a(s,[{key:"getScore",value:function(){return this.score}},{key:"getAlignments",value:function(){return this.alignments}},{key:"computeGrids",value:function(){for(var l=1;l<this.jMax;l++)this.grid[0][l]=this.grid[0][l-1]+this.gap_penalty,this.tracebackGrid[0][l]=[!1,!1,!0];for(var u=1;u<this.iMax;u++)this.grid[u][0]=this.grid[u-1][0]+this.gap_penalty,this.tracebackGrid[u][0]=[!1,!0,!1];for(var f=1;f<this.iMax;f++)for(var h=1;h<this.jMax;h++){var c=void 0;this.sequence1[f-1]===this.sequence2[h-1]?c=this.grid[f-1][h-1]+this.match_score:c=this.grid[f-1][h-1]+this.mismatch_penalty;var v=this.grid[f-1][h]+this.gap_penalty,d=this.grid[f][h-1]+this.gap_penalty,y=[c,v,d],p=this.arrayAllMaxIndexes(y);this.grid[f][h]=y[p[0]],this.tracebackGrid[f][h]=[p.includes(0),p.includes(1),p.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:"alignmentTraceback",value:function(){var l=[];for(l.push({pos:[this.sequence1.length,this.sequence2.length],seq1:"",seq2:""});l[0];){var u=l[0],f=this.tracebackGrid[u.pos[0]][u.pos[1]];f[0]&&l.push({pos:[u.pos[0]-1,u.pos[1]-1],seq1:this.sequence1[u.pos[0]-1]+u.seq1,seq2:this.sequence2[u.pos[1]-1]+u.seq2}),f[1]&&l.push({pos:[u.pos[0]-1,u.pos[1]],seq1:this.sequence1[u.pos[0]-1]+u.seq1,seq2:"-"+u.seq2}),f[2]&&l.push({pos:[u.pos[0],u.pos[1]-1],seq1:"-"+u.seq1,seq2:this.sequence2[u.pos[1]-1]+u.seq2}),u.pos[0]===0&&u.pos[1]===0&&this.alignments.push({sequence1:u.seq1,sequence2:u.seq2}),l.shift()}return this.alignments}},{key:"getAllIndexes",value:function(l,u){for(var f=[],h=-1;(h=l.indexOf(u,h+1))!==-1;)f.push(h);return f}},{key:"arrayAllMaxIndexes",value:function(l){return this.getAllIndexes(l,Math.max.apply(null,l))}}]),s}();t.exports=i},function(t,e,r){"use strict";var a=function(){};a.FDLayout=r(18),a.FDLayoutConstants=r(7),a.FDLayoutEdge=r(19),a.FDLayoutNode=r(20),a.DimensionD=r(21),a.HashMap=r(22),a.HashSet=r(23),a.IGeometry=r(8),a.IMath=r(9),a.Integer=r(10),a.Point=r(12),a.PointD=r(4),a.RandomSeed=r(16),a.RectangleD=r(13),a.Transform=r(17),a.UniqueIDGeneretor=r(14),a.Quicksort=r(24),a.LinkedList=r(11),a.LGraphObject=r(2),a.LGraph=r(5),a.LEdge=r(1),a.LGraphManager=r(6),a.LNode=r(3),a.Layout=r(15),a.LayoutConstants=r(0),a.NeedlemanWunsch=r(25),t.exports=a},function(t,e,r){"use strict";function a(){this.listeners=[]}var n=a.prototype;n.addListener=function(i,s){this.listeners.push({event:i,callback:s})},n.removeListener=function(i,s){for(var o=this.listeners.length;o>=0;o--){var l=this.listeners[o];l.event===i&&l.callback===s&&this.listeners.splice(o,1)}},n.emit=function(i,s){for(var o=0;o<this.listeners.length;o++){var l=this.listeners[o];i===l.event&&l.callback(s)}},t.exports=a}])})});var Ui=Gn((ka,Vi)=>{(function(e,r){typeof ka=="object"&&typeof Vi=="object"?Vi.exports=r(zi()):typeof define=="function"&&define.amd?define(["layout-base"],r):typeof ka=="object"?ka.coseBase=r(zi()):e.coseBase=r(e.layoutBase)})(ka,function(t){return function(e){var r={};function a(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=r,a.i=function(n){return n},a.d=function(n,i,s){a.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:s})},a.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(i,"a",i),i},a.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},a.p="",a(a.s=7)}([function(e,r){e.exports=t},function(e,r,a){"use strict";var n=a(0).FDLayoutConstants;function i(){}for(var s in n)i[s]=n[s];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=n.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,r,a){"use strict";var n=a(0).FDLayoutEdge;function i(o,l,u){n.call(this,o,l,u)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).LGraph;function i(o,l,u){n.call(this,o,l,u)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).LGraphManager;function i(o){n.call(this,o)}i.prototype=Object.create(n.prototype);for(var s in n)i[s]=n[s];e.exports=i},function(e,r,a){"use strict";var n=a(0).FDLayoutNode,i=a(0).IMath;function s(l,u,f,h){n.call(this,l,u,f,h)}s.prototype=Object.create(n.prototype);for(var o in n)s[o]=n[o];s.prototype.move=function(){var l=this.graphManager.getLayout();this.displacementX=l.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=l.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementX=l.coolingFactor*l.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>l.coolingFactor*l.maxNodeDisplacement&&(this.displacementY=l.coolingFactor*l.maxNodeDisplacement*i.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),l.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},s.prototype.propogateDisplacementToChildren=function(l,u){for(var f=this.getChild().getNodes(),h,c=0;c<f.length;c++)h=f[c],h.getChild()==null?(h.moveBy(l,u),h.displacementX+=l,h.displacementY+=u):h.propogateDisplacementToChildren(l,u)},s.prototype.setPred1=function(l){this.pred1=l},s.prototype.getPred1=function(){return pred1},s.prototype.getPred2=function(){return pred2},s.prototype.setNext=function(l){this.next=l},s.prototype.getNext=function(){return next},s.prototype.setProcessed=function(l){this.processed=l},s.prototype.isProcessed=function(){return processed},e.exports=s},function(e,r,a){"use strict";var n=a(0).FDLayout,i=a(4),s=a(3),o=a(5),l=a(2),u=a(1),f=a(0).FDLayoutConstants,h=a(0).LayoutConstants,c=a(0).Point,v=a(0).PointD,d=a(0).Layout,y=a(0).Integer,p=a(0).IGeometry,g=a(0).LGraph,m=a(0).Transform;function E(){n.call(this),this.toBeTiled={}}E.prototype=Object.create(n.prototype);for(var D in n)E[D]=n[D];E.prototype.newGraphManager=function(){var b=new i(this);return this.graphManager=b,b},E.prototype.newGraph=function(b){return new s(null,this.graphManager,b)},E.prototype.newNode=function(b){return new o(this.graphManager,b)},E.prototype.newEdge=function(b){return new l(null,null,b)},E.prototype.initParameters=function(){n.prototype.initParameters.call(this,arguments),this.isSubLayout||(u.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=u.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=u.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=f.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=f.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=f.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=f.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=f.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=f.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/f.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=f.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},E.prototype.layout=function(){var b=h.DEFAULT_CREATE_BENDS_AS_NEEDED;return b&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},E.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(u.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),w=this.nodesWithGravity.filter(function(S){return x.has(S)});this.graphManager.setAllNodesToApplyGravitation(w)}}else{var b=this.getFlatForest();if(b.length>0)this.positionNodesRadially(b);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var x=new Set(this.getAllNodes()),w=this.nodesWithGravity.filter(function(T){return x.has(T)});this.graphManager.setAllNodesToApplyGravitation(w),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},E.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%f.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var b=new Set(this.getAllNodes()),x=this.nodesWithGravity.filter(function(C){return b.has(C)});this.graphManager.setAllNodesToApplyGravitation(x),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=f.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=f.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var w=!this.isTreeGrowing&&!this.isGrowthFinished,T=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(w,T),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},E.prototype.getPositionsData=function(){for(var b=this.graphManager.getAllNodes(),x={},w=0;w<b.length;w++){var T=b[w].rect,C=b[w].id;x[C]={id:C,x:T.getCenterX(),y:T.getCenterY(),w:T.width,h:T.height}}return x},E.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var b=!1;if(f.ANIMATE==="during")this.emit("layoutstarted");else{for(;!b;)b=this.tick();this.graphManager.updateBounds()}},E.prototype.calculateNodesToApplyGravitationTo=function(){var b=[],x,w=this.graphManager.getGraphs(),T=w.length,C;for(C=0;C<T;C++)x=w[C],x.updateConnected(),x.isConnected||(b=b.concat(x.getNodes()));return b},E.prototype.createBendpoints=function(){var b=[];b=b.concat(this.graphManager.getAllEdges());var x=new Set,w;for(w=0;w<b.length;w++){var T=b[w];if(!x.has(T)){var C=T.getSource(),S=T.getTarget();if(C==S)T.getBendpoints().push(new v),T.getBendpoints().push(new v),this.createDummyNodesForBendpoints(T),x.add(T);else{var A=[];if(A=A.concat(C.getEdgeListToNode(S)),A=A.concat(S.getEdgeListToNode(C)),!x.has(A[0])){if(A.length>1){var L;for(L=0;L<A.length;L++){var I=A[L];I.getBendpoints().push(new v),this.createDummyNodesForBendpoints(I)}}A.forEach(function(O){x.add(O)})}}}if(x.size==b.length)break}},E.prototype.positionNodesRadially=function(b){for(var x=new c(0,0),w=Math.ceil(Math.sqrt(b.length)),T=0,C=0,S=0,A=new v(0,0),L=0;L<b.length;L++){L%w==0&&(S=0,C=T,L!=0&&(C+=u.DEFAULT_COMPONENT_SEPERATION),T=0);var I=b[L],O=d.findCenterOfTree(I);x.x=S,x.y=C,A=E.radialLayout(I,O,x),A.y>T&&(T=Math.floor(A.y)),S=Math.floor(A.x+u.DEFAULT_COMPONENT_SEPERATION)}this.transform(new v(h.WORLD_CENTER_X-A.x/2,h.WORLD_CENTER_Y-A.y/2))},E.radialLayout=function(b,x,w){var T=Math.max(this.maxDiagonalInTree(b),u.DEFAULT_RADIAL_SEPARATION);E.branchRadialLayout(x,null,0,359,0,T);var C=g.calculateBounds(b),S=new m;S.setDeviceOrgX(C.getMinX()),S.setDeviceOrgY(C.getMinY()),S.setWorldOrgX(w.x),S.setWorldOrgY(w.y);for(var A=0;A<b.length;A++){var L=b[A];L.transform(S)}var I=new v(C.getMaxX(),C.getMaxY());return S.inverseTransformPoint(I)},E.branchRadialLayout=function(b,x,w,T,C,S){var A=(T-w+1)/2;A<0&&(A+=180);var L=(A+w)%360,I=L*p.TWO_PI/360,O=Math.cos(I),k=C*Math.cos(I),R=C*Math.sin(I);b.setCenter(k,R);var M=[];M=M.concat(b.getEdges());var P=M.length;x!=null&&P--;for(var F=0,V=M.length,G,B=b.getEdgesBetween(x);B.length>1;){var Y=B[0];B.splice(0,1);var Z=M.indexOf(Y);Z>=0&&M.splice(Z,1),V--,P--}x!=null?G=(M.indexOf(B[0])+1)%V:G=0;for(var K=Math.abs(T-w)/P,U=G;F!=P;U=++U%V){var z=M[U].getOtherEnd(b);if(z!=x){var _=(w+F*K)%360,q=(_+K)%360;E.branchRadialLayout(z,b,_,q,C+S,S),F++}}},E.maxDiagonalInTree=function(b){for(var x=y.MIN_VALUE,w=0;w<b.length;w++){var T=b[w],C=T.getDiagonal();C>x&&(x=C)}return x},E.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},E.prototype.groupZeroDegreeMembers=function(){var b=this,x={};this.memberGroups={},this.idToDummyNode={};for(var w=[],T=this.graphManager.getAllNodes(),C=0;C<T.length;C++){var S=T[C],A=S.getParent();this.getNodeDegreeWithChildren(S)===0&&(A.id==null||!this.getToBeTiled(A))&&w.push(S)}for(var C=0;C<w.length;C++){var S=w[C],L=S.getParent().id;typeof x[L]=="undefined"&&(x[L]=[]),x[L]=x[L].concat(S)}Object.keys(x).forEach(function(I){if(x[I].length>1){var O="DummyCompound_"+I;b.memberGroups[O]=x[I];var k=x[I][0].getParent(),R=new o(b.graphManager);R.id=O,R.paddingLeft=k.paddingLeft||0,R.paddingRight=k.paddingRight||0,R.paddingBottom=k.paddingBottom||0,R.paddingTop=k.paddingTop||0,b.idToDummyNode[O]=R;var M=b.getGraphManager().add(b.newGraph(),R),P=k.getChild();P.add(R);for(var F=0;F<x[I].length;F++){var V=x[I][F];P.remove(V),M.add(V)}}})},E.prototype.clearCompounds=function(){var b={},x={};this.performDFSOnCompounds();for(var w=0;w<this.compoundOrder.length;w++)x[this.compoundOrder[w].id]=this.compoundOrder[w],b[this.compoundOrder[w].id]=[].concat(this.compoundOrder[w].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[w].getChild()),this.compoundOrder[w].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(b,x)},E.prototype.clearZeroDegreeMembers=function(){var b=this,x=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(w){var T=b.idToDummyNode[w];x[w]=b.tileNodes(b.memberGroups[w],T.paddingLeft+T.paddingRight),T.rect.width=x[w].width,T.rect.height=x[w].height})},E.prototype.repopulateCompounds=function(){for(var b=this.compoundOrder.length-1;b>=0;b--){var x=this.compoundOrder[b],w=x.id,T=x.paddingLeft,C=x.paddingTop;this.adjustLocations(this.tiledMemberPack[w],x.rect.x,x.rect.y,T,C)}},E.prototype.repopulateZeroDegreeMembers=function(){var b=this,x=this.tiledZeroDegreePack;Object.keys(x).forEach(function(w){var T=b.idToDummyNode[w],C=T.paddingLeft,S=T.paddingTop;b.adjustLocations(x[w],T.rect.x,T.rect.y,C,S)})},E.prototype.getToBeTiled=function(b){var x=b.id;if(this.toBeTiled[x]!=null)return this.toBeTiled[x];var w=b.getChild();if(w==null)return this.toBeTiled[x]=!1,!1;for(var T=w.getNodes(),C=0;C<T.length;C++){var S=T[C];if(this.getNodeDegree(S)>0)return this.toBeTiled[x]=!1,!1;if(S.getChild()==null){this.toBeTiled[S.id]=!1;continue}if(!this.getToBeTiled(S))return this.toBeTiled[x]=!1,!1}return this.toBeTiled[x]=!0,!0},E.prototype.getNodeDegree=function(b){for(var x=b.id,w=b.getEdges(),T=0,C=0;C<w.length;C++){var S=w[C];S.getSource().id!==S.getTarget().id&&(T=T+1)}return T},E.prototype.getNodeDegreeWithChildren=function(b){var x=this.getNodeDegree(b);if(b.getChild()==null)return x;for(var w=b.getChild().getNodes(),T=0;T<w.length;T++){var C=w[T];x+=this.getNodeDegreeWithChildren(C)}return x},E.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},E.prototype.fillCompexOrderByDFS=function(b){for(var x=0;x<b.length;x++){var w=b[x];w.getChild()!=null&&this.fillCompexOrderByDFS(w.getChild().getNodes()),this.getToBeTiled(w)&&this.compoundOrder.push(w)}},E.prototype.adjustLocations=function(b,x,w,T,C){x+=T,w+=C;for(var S=x,A=0;A<b.rows.length;A++){var L=b.rows[A];x=S;for(var I=0,O=0;O<L.length;O++){var k=L[O];k.rect.x=x,k.rect.y=w,x+=k.rect.width+b.horizontalPadding,k.rect.height>I&&(I=k.rect.height)}w+=I+b.verticalPadding}},E.prototype.tileCompoundMembers=function(b,x){var w=this;this.tiledMemberPack=[],Object.keys(b).forEach(function(T){var C=x[T];w.tiledMemberPack[T]=w.tileNodes(b[T],C.paddingLeft+C.paddingRight),C.rect.width=w.tiledMemberPack[T].width,C.rect.height=w.tiledMemberPack[T].height})},E.prototype.tileNodes=function(b,x){var w=u.TILING_PADDING_VERTICAL,T=u.TILING_PADDING_HORIZONTAL,C={rows:[],rowWidth:[],rowHeight:[],width:0,height:x,verticalPadding:w,horizontalPadding:T};b.sort(function(L,I){return L.rect.width*L.rect.height>I.rect.width*I.rect.height?-1:L.rect.width*L.rect.height<I.rect.width*I.rect.height?1:0});for(var S=0;S<b.length;S++){var A=b[S];C.rows.length==0?this.insertNodeToRow(C,A,0,x):this.canAddHorizontal(C,A.rect.width,A.rect.height)?this.insertNodeToRow(C,A,this.getShortestRowIndex(C),x):this.insertNodeToRow(C,A,C.rows.length,x),this.shiftToLastRow(C)}return C},E.prototype.insertNodeToRow=function(b,x,w,T){var C=T;if(w==b.rows.length){var S=[];b.rows.push(S),b.rowWidth.push(C),b.rowHeight.push(0)}var A=b.rowWidth[w]+x.rect.width;b.rows[w].length>0&&(A+=b.horizontalPadding),b.rowWidth[w]=A,b.width<A&&(b.width=A);var L=x.rect.height;w>0&&(L+=b.verticalPadding);var I=0;L>b.rowHeight[w]&&(I=b.rowHeight[w],b.rowHeight[w]=L,I=b.rowHeight[w]-I),b.height+=I,b.rows[w].push(x)},E.prototype.getShortestRowIndex=function(b){for(var x=-1,w=Number.MAX_VALUE,T=0;T<b.rows.length;T++)b.rowWidth[T]<w&&(x=T,w=b.rowWidth[T]);return x},E.prototype.getLongestRowIndex=function(b){for(var x=-1,w=Number.MIN_VALUE,T=0;T<b.rows.length;T++)b.rowWidth[T]>w&&(x=T,w=b.rowWidth[T]);return x},E.prototype.canAddHorizontal=function(b,x,w){var T=this.getShortestRowIndex(b);if(T<0)return!0;var C=b.rowWidth[T];if(C+b.horizontalPadding+x<=b.width)return!0;var S=0;b.rowHeight[T]<w&&T>0&&(S=w+b.verticalPadding-b.rowHeight[T]);var A;b.width-C>=x+b.horizontalPadding?A=(b.height+S)/(C+x+b.horizontalPadding):A=(b.height+S)/b.width,S=w+b.verticalPadding;var L;return b.width<x?L=(b.height+S)/x:L=(b.height+S)/b.width,L<1&&(L=1/L),A<1&&(A=1/A),A<L},E.prototype.shiftToLastRow=function(b){var x=this.getLongestRowIndex(b),w=b.rowWidth.length-1,T=b.rows[x],C=T[T.length-1],S=C.width+b.horizontalPadding;if(b.width-b.rowWidth[w]>S&&x!=w){T.splice(-1,1),b.rows[w].push(C),b.rowWidth[x]=b.rowWidth[x]-S,b.rowWidth[w]=b.rowWidth[w]+S,b.width=b.rowWidth[instance.getLongestRowIndex(b)];for(var A=Number.MIN_VALUE,L=0;L<T.length;L++)T[L].height>A&&(A=T[L].height);x>0&&(A+=b.verticalPadding);var I=b.rowHeight[x]+b.rowHeight[w];b.rowHeight[x]=A,b.rowHeight[w]<C.height+b.verticalPadding&&(b.rowHeight[w]=C.height+b.verticalPadding);var O=b.rowHeight[x]+b.rowHeight[w];b.height+=O-I,this.shiftToLastRow(b)}},E.prototype.tilingPreLayout=function(){u.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},E.prototype.tilingPostLayout=function(){u.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},E.prototype.reduceTrees=function(){for(var b=[],x=!0,w;x;){var T=this.graphManager.getAllNodes(),C=[];x=!1;for(var S=0;S<T.length;S++)w=T[S],w.getEdges().length==1&&!w.getEdges()[0].isInterGraph&&w.getChild()==null&&(C.push([w,w.getEdges()[0],w.getOwner()]),x=!0);if(x==!0){for(var A=[],L=0;L<C.length;L++)C[L][0].getEdges().length==1&&(A.push(C[L]),C[L][0].getOwner().remove(C[L][0]));b.push(A),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=b},E.prototype.growTree=function(b){for(var x=b.length,w=b[x-1],T,C=0;C<w.length;C++)T=w[C],this.findPlaceforPrunedNode(T),T[2].add(T[0]),T[2].add(T[1],T[1].source,T[1].target);b.splice(b.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},E.prototype.findPlaceforPrunedNode=function(b){var x,w,T=b[0];T==b[1].source?w=b[1].target:w=b[1].source;var C=w.startX,S=w.finishX,A=w.startY,L=w.finishY,I=0,O=0,k=0,R=0,M=[I,k,O,R];if(A>0)for(var P=C;P<=S;P++)M[0]+=this.grid[P][A-1].length+this.grid[P][A].length-1;if(S<this.grid.length-1)for(var P=A;P<=L;P++)M[1]+=this.grid[S+1][P].length+this.grid[S][P].length-1;if(L<this.grid[0].length-1)for(var P=C;P<=S;P++)M[2]+=this.grid[P][L+1].length+this.grid[P][L].length-1;if(C>0)for(var P=A;P<=L;P++)M[3]+=this.grid[C-1][P].length+this.grid[C][P].length-1;for(var F=y.MAX_VALUE,V,G,B=0;B<M.length;B++)M[B]<F?(F=M[B],V=1,G=B):M[B]==F&&V++;if(V==3&&F==0)M[0]==0&&M[1]==0&&M[2]==0?x=1:M[0]==0&&M[1]==0&&M[3]==0?x=0:M[0]==0&&M[2]==0&&M[3]==0?x=3:M[1]==0&&M[2]==0&&M[3]==0&&(x=2);else if(V==2&&F==0){var Y=Math.floor(Math.random()*2);M[0]==0&&M[1]==0?Y==0?x=0:x=1:M[0]==0&&M[2]==0?Y==0?x=0:x=2:M[0]==0&&M[3]==0?Y==0?x=0:x=3:M[1]==0&&M[2]==0?Y==0?x=1:x=2:M[1]==0&&M[3]==0?Y==0?x=1:x=3:Y==0?x=2:x=3}else if(V==4&&F==0){var Y=Math.floor(Math.random()*4);x=Y}else x=G;x==0?T.setCenter(w.getCenterX(),w.getCenterY()-w.getHeight()/2-f.DEFAULT_EDGE_LENGTH-T.getHeight()/2):x==1?T.setCenter(w.getCenterX()+w.getWidth()/2+f.DEFAULT_EDGE_LENGTH+T.getWidth()/2,w.getCenterY()):x==2?T.setCenter(w.getCenterX(),w.getCenterY()+w.getHeight()/2+f.DEFAULT_EDGE_LENGTH+T.getHeight()/2):T.setCenter(w.getCenterX()-w.getWidth()/2-f.DEFAULT_EDGE_LENGTH-T.getWidth()/2,w.getCenterY())},e.exports=E},function(e,r,a){"use strict";var n={};n.layoutBase=a(0),n.CoSEConstants=a(1),n.CoSEEdge=a(2),n.CoSEGraph=a(3),n.CoSEGraphManager=a(4),n.CoSELayout=a(6),n.CoSENode=a(5),e.exports=n}])})});var rl=Gn((Pa,$i)=>{(function(e,r){typeof Pa=="object"&&typeof $i=="object"?$i.exports=r(Ui()):typeof define=="function"&&define.amd?define(["cose-base"],r):typeof Pa=="object"?Pa.cytoscapeCoseBilkent=r(Ui()):e.cytoscapeCoseBilkent=r(e.coseBase)})(Pa,function(t){return function(e){var r={};function a(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}return a.m=e,a.c=r,a.i=function(n){return n},a.d=function(n,i,s){a.o(n,i)||Object.defineProperty(n,i,{configurable:!1,enumerable:!0,get:s})},a.n=function(n){var i=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(i,"a",i),i},a.o=function(n,i){return Object.prototype.hasOwnProperty.call(n,i)},a.p="",a(a.s=1)}([function(e,r){e.exports=t},function(e,r,a){"use strict";var n=a(0).layoutBase.LayoutConstants,i=a(0).layoutBase.FDLayoutConstants,s=a(0).CoSEConstants,o=a(0).CoSELayout,l=a(0).CoSENode,u=a(0).layoutBase.PointD,f=a(0).layoutBase.DimensionD,h={ready:function(){},stop:function(){},quality:"default",nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:"end",animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function c(p,g){var m={};for(var E in p)m[E]=p[E];for(var E in g)m[E]=g[E];return m}function v(p){this.options=c(h,p),d(this.options)}var d=function(g){g.nodeRepulsion!=null&&(s.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=g.nodeRepulsion),g.idealEdgeLength!=null&&(s.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=g.idealEdgeLength),g.edgeElasticity!=null&&(s.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=g.edgeElasticity),g.nestingFactor!=null&&(s.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=g.nestingFactor),g.gravity!=null&&(s.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=g.gravity),g.numIter!=null&&(s.MAX_ITERATIONS=i.MAX_ITERATIONS=g.numIter),g.gravityRange!=null&&(s.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=g.gravityRange),g.gravityCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=g.gravityCompound),g.gravityRangeCompound!=null&&(s.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=g.gravityRangeCompound),g.initialEnergyOnIncremental!=null&&(s.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=g.initialEnergyOnIncremental),g.quality=="draft"?n.QUALITY=0:g.quality=="proof"?n.QUALITY=2:n.QUALITY=1,s.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=n.NODE_DIMENSIONS_INCLUDE_LABELS=g.nodeDimensionsIncludeLabels,s.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=n.DEFAULT_INCREMENTAL=!g.randomize,s.ANIMATE=i.ANIMATE=n.ANIMATE=g.animate,s.TILE=g.tile,s.TILING_PADDING_VERTICAL=typeof g.tilingPaddingVertical=="function"?g.tilingPaddingVertical.call():g.tilingPaddingVertical,s.TILING_PADDING_HORIZONTAL=typeof g.tilingPaddingHorizontal=="function"?g.tilingPaddingHorizontal.call():g.tilingPaddingHorizontal};v.prototype.run=function(){var p,g,m=this.options,E=this.idToLNode={},D=this.layout=new o,b=this;b.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:"layoutstart",layout:this});var x=D.newGraphManager();this.gm=x;var w=this.options.eles.nodes(),T=this.options.eles.edges();this.root=x.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(w),D);for(var C=0;C<T.length;C++){var S=T[C],A=this.idToLNode[S.data("source")],L=this.idToLNode[S.data("target")];if(A!==L&&A.getEdgesBetween(L).length==0){var I=x.add(D.newEdge(),A,L);I.id=S.id()}}var O=function(M,P){typeof M=="number"&&(M=P);var F=M.data("id"),V=b.idToLNode[F];return{x:V.getRect().getCenterX(),y:V.getRect().getCenterY()}},k=function R(){for(var M=function(){m.fit&&m.cy.fit(m.eles,m.padding),p||(p=!0,b.cy.one("layoutready",m.ready),b.cy.trigger({type:"layoutready",layout:b}))},P=b.options.refresh,F,V=0;V<P&&!F;V++)F=b.stopped||b.layout.tick();if(F){D.checkLayoutSuccess()&&!D.isSubLayout&&D.doPostLayout(),D.tilingPostLayout&&D.tilingPostLayout(),D.isLayoutFinished=!0,b.options.eles.nodes().positions(O),M(),b.cy.one("layoutstop",b.options.stop),b.cy.trigger({type:"layoutstop",layout:b}),g&&cancelAnimationFrame(g),p=!1;return}var G=b.layout.getPositionsData();m.eles.nodes().positions(function(B,Y){if(typeof B=="number"&&(B=Y),!B.isParent()){for(var Z=B.id(),K=G[Z],U=B;K==null&&(K=G[U.data("parent")]||G["DummyCompound_"+U.data("parent")],G[Z]=K,U=U.parent()[0],U!=null););return K!=null?{x:K.x,y:K.y}:{x:B.position("x"),y:B.position("y")}}}),M(),g=requestAnimationFrame(R)};return D.addListener("layoutstarted",function(){b.options.animate==="during"&&(g=requestAnimationFrame(k))}),D.runLayout(),this.options.animate!=="during"&&(b.options.eles.nodes().not(":parent").layoutPositions(b,b.options,O),p=!1),this},v.prototype.getTopMostNodes=function(p){for(var g={},m=0;m<p.length;m++)g[p[m].id()]=!0;var E=p.filter(function(D,b){typeof D=="number"&&(D=b);for(var x=D.parent()[0];x!=null;){if(g[x.id()])return!1;x=x.parent()[0]}return!0});return E},v.prototype.processChildrenList=function(p,g,m){for(var E=g.length,D=0;D<E;D++){var b=g[D],x=b.children(),w,T=b.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(b.outerWidth()!=null&&b.outerHeight()!=null?w=p.add(new l(m.graphManager,new u(b.position("x")-T.w/2,b.position("y")-T.h/2),new f(parseFloat(T.w),parseFloat(T.h)))):w=p.add(new l(this.graphManager)),w.id=b.data("id"),w.paddingLeft=parseInt(b.css("padding")),w.paddingTop=parseInt(b.css("padding")),w.paddingRight=parseInt(b.css("padding")),w.paddingBottom=parseInt(b.css("padding")),this.options.nodeDimensionsIncludeLabels&&b.isParent()){var C=b.boundingBox({includeLabels:!0,includeNodes:!1}).w,S=b.boundingBox({includeLabels:!0,includeNodes:!1}).h,A=b.css("text-halign");w.labelWidth=C,w.labelHeight=S,w.labelPos=A}if(this.idToLNode[b.data("id")]=w,isNaN(w.rect.x)&&(w.rect.x=0),isNaN(w.rect.y)&&(w.rect.y=0),x!=null&&x.length>0){var L;L=m.getGraphManager().add(m.newGraph(),w),this.processChildrenList(L,x,m)}}},v.prototype.stop=function(){return this.stopped=!0,this};var y=function(g){g("layout","cose-bilkent",v)};typeof cytoscape!="undefined"&&y(cytoscape),e.exports=y}])})});function He(t){"@babel/helpers - typeof";return He=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},He(t)}function di(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function as(t,e){for(var r=0;r<e.length;r++){var a=e[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function gi(t,e,r){return e&&as(t.prototype,e),r&&as(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function mo(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function St(t,e){return bl(t)||El(t,e)||bo(t,e)||wl()}function bl(t){if(Array.isArray(t))return t}function El(t,e){var r=t==null?null:typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var a=[],n=!0,i=!1,s,o;try{for(r=r.call(t);!(n=(s=r.next()).done)&&(a.push(s.value),!(e&&a.length===e));n=!0);}catch(l){i=!0,o=l}finally{try{!n&&r.return!=null&&r.return()}finally{if(i)throw o}}return a}}function bo(t,e){if(t){if(typeof t=="string")return ns(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ns(t,e)}}function ns(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,a=new Array(e);r<e;r++)a[r]=t[r];return a}function wl(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xl(t,e){var r=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=bo(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var a=0,n=function(){};return{s:n,n:function(){return a>=t.length?{done:!0}:{done:!1,value:t[a++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,s=!1,o;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return i=l.done,l},e:function(l){s=!0,o=l},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(s)throw o}}}}var Ye=typeof window=="undefined"?null:window,is=Ye?Ye.navigator:null;Ye&&Ye.document;var Tl=He(""),Eo=He({}),Cl=He(function(){}),Dl=typeof HTMLElement=="undefined"?"undefined":He(HTMLElement),Ca=function(e){return e&&e.instanceString&&Ge(e.instanceString)?e.instanceString():null},ve=function(e){return e!=null&&He(e)==Tl},Ge=function(e){return e!=null&&He(e)===Cl},Re=function(e){return!pt(e)&&(Array.isArray?Array.isArray(e):e!=null&&e instanceof Array)},Ce=function(e){return e!=null&&He(e)===Eo&&!Re(e)&&e.constructor===Object},Sl=function(e){return e!=null&&He(e)===Eo},ne=function(e){return e!=null&&He(e)===He(1)&&!isNaN(e)},Ll=function(e){return ne(e)&&Math.floor(e)===e},on=function(e){if(Dl!=="undefined")return e!=null&&e instanceof HTMLElement},pt=function(e){return Da(e)||wo(e)},Da=function(e){return Ca(e)==="collection"&&e._private.single},wo=function(e){return Ca(e)==="collection"&&!e._private.single},pi=function(e){return Ca(e)==="core"},xo=function(e){return Ca(e)==="stylesheet"},Al=function(e){return Ca(e)==="event"},tr=function(e){return e==null?!0:!!(e===""||e.match(/^\s+$/))},Ol=function(e){return typeof HTMLElement=="undefined"?!1:e instanceof HTMLElement},Nl=function(e){return Ce(e)&&ne(e.x1)&&ne(e.x2)&&ne(e.y1)&&ne(e.y2)},Il=function(e){return Sl(e)&&Ge(e.then)},Ml=function(){return is&&is.userAgent.match(/msie|trident|edge/i)},va=function(e,r){r||(r=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var i=[],s=0;s<arguments.length;s++)i.push(arguments[s]);return i.join("$")});var a=function n(){var i=this,s=arguments,o,l=r.apply(i,s),u=n.cache;return(o=u[l])||(o=u[l]=e.apply(i,s)),o};return a.cache={},a},yi=va(function(t){return t.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),mn=va(function(t){return t.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),To=va(function(t,e){return t+e[0].toUpperCase()+e.substring(1)},function(t,e){return t+"$"+e}),ss=function(e){return tr(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},_e="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",Rl="rgb[a]?\\(("+_e+"[%]?)\\s*,\\s*("+_e+"[%]?)\\s*,\\s*("+_e+"[%]?)(?:\\s*,\\s*("+_e+"))?\\)",kl="rgb[a]?\\((?:"+_e+"[%]?)\\s*,\\s*(?:"+_e+"[%]?)\\s*,\\s*(?:"+_e+"[%]?)(?:\\s*,\\s*(?:"+_e+"))?\\)",Pl="hsl[a]?\\(("+_e+")\\s*,\\s*("+_e+"[%])\\s*,\\s*("+_e+"[%])(?:\\s*,\\s*("+_e+"))?\\)",Bl="hsl[a]?\\((?:"+_e+")\\s*,\\s*(?:"+_e+"[%])\\s*,\\s*(?:"+_e+"[%])(?:\\s*,\\s*(?:"+_e+"))?\\)",Fl="\\#[0-9a-fA-F]{3}",Gl="\\#[0-9a-fA-F]{6}",Co=function(e,r){return e<r?-1:e>r?1:0},zl=function(e,r){return-1*Co(e,r)},be=Object.assign!=null?Object.assign.bind(Object):function(t){for(var e=arguments,r=1;r<e.length;r++){var a=e[r];if(a!=null)for(var n=Object.keys(a),i=0;i<n.length;i++){var s=n[i];t[s]=a[s]}}return t},Vl=function(e){if(!(!(e.length===4||e.length===7)||e[0]!=="#")){var r=e.length===4,a,n,i,s=16;return r?(a=parseInt(e[1]+e[1],s),n=parseInt(e[2]+e[2],s),i=parseInt(e[3]+e[3],s)):(a=parseInt(e[1]+e[2],s),n=parseInt(e[3]+e[4],s),i=parseInt(e[5]+e[6],s)),[a,n,i]}},Ul=function(e){var r,a,n,i,s,o,l,u;function f(d,y,p){return p<0&&(p+=1),p>1&&(p-=1),p<1/6?d+(y-d)*6*p:p<1/2?y:p<2/3?d+(y-d)*(2/3-p)*6:d}var h=new RegExp("^"+Pl+"$").exec(e);if(h){if(a=parseInt(h[1]),a<0?a=(360- -1*a%360)%360:a>360&&(a=a%360),a/=360,n=parseFloat(h[2]),n<0||n>100||(n=n/100,i=parseFloat(h[3]),i<0||i>100)||(i=i/100,s=h[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(n===0)o=l=u=Math.round(i*255);else{var c=i<.5?i*(1+n):i+n-i*n,v=2*i-c;o=Math.round(255*f(v,c,a+1/3)),l=Math.round(255*f(v,c,a)),u=Math.round(255*f(v,c,a-1/3))}r=[o,l,u,s]}return r},$l=function(e){var r,a=new RegExp("^"+Rl+"$").exec(e);if(a){r=[];for(var n=[],i=1;i<=3;i++){var s=a[i];if(s[s.length-1]==="%"&&(n[i]=!0),s=parseFloat(s),n[i]&&(s=s/100*255),s<0||s>255)return;r.push(Math.floor(s))}var o=n[1]||n[2]||n[3],l=n[1]&&n[2]&&n[3];if(o&&!l)return;var u=a[4];if(u!==void 0){if(u=parseFloat(u),u<0||u>1)return;r.push(u)}}return r},Yl=function(e){return Hl[e.toLowerCase()]},_l=function(e){return(Re(e)?e:null)||Yl(e)||Vl(e)||$l(e)||Ul(e)},Hl={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]},Do=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Ce(s))throw Error("Tried to set map with object key");i<a.length-1?(r[s]==null&&(r[s]={}),r=r[s]):r[s]=e.value}},So=function(e){for(var r=e.map,a=e.keys,n=a.length,i=0;i<n;i++){var s=a[i];if(Ce(s))throw Error("Tried to get map with object key");if(r=r[s],r==null)return r}return r};function Xl(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var gr=Xl,sa=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ql(t,e){return e={exports:{}},t(e,e.exports),e.exports}var Wl=typeof sa=="object"&&sa&&sa.Object===Object&&sa,Kl=Wl,Zl=typeof self=="object"&&self&&self.Object===Object&&self,Ql=Kl||Zl||Function("return this")(),bn=Ql,Jl=function(){return bn.Date.now()},zn=Jl,jl=/\s/;function ef(t){for(var e=t.length;e--&&jl.test(t.charAt(e)););return e}var tf=ef,rf=/^\s+/;function af(t){return t&&t.slice(0,tf(t)+1).replace(rf,"")}var nf=af,sf=bn.Symbol,Fr=sf,Lo=Object.prototype,of=Lo.hasOwnProperty,uf=Lo.toString,ta=Fr?Fr.toStringTag:void 0;function lf(t){var e=of.call(t,ta),r=t[ta];try{t[ta]=void 0;var a=!0}catch(i){}var n=uf.call(t);return a&&(e?t[ta]=r:delete t[ta]),n}var ff=lf,hf=Object.prototype,cf=hf.toString;function vf(t){return cf.call(t)}var df=vf,gf="[object Null]",pf="[object Undefined]",os=Fr?Fr.toStringTag:void 0;function yf(t){return t==null?t===void 0?pf:gf:os&&os in Object(t)?ff(t):df(t)}var Ao=yf;function mf(t){return t!=null&&typeof t=="object"}var bf=mf,Ef="[object Symbol]";function wf(t){return typeof t=="symbol"||bf(t)&&Ao(t)==Ef}var Sa=wf,us=NaN,xf=/^[-+]0x[0-9a-f]+$/i,Tf=/^0b[01]+$/i,Cf=/^0o[0-7]+$/i,Df=parseInt;function Sf(t){if(typeof t=="number")return t;if(Sa(t))return us;if(gr(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=gr(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=nf(t);var r=Tf.test(t);return r||Cf.test(t)?Df(t.slice(2),r?2:8):xf.test(t)?us:+t}var ls=Sf,Lf="Expected a function",Af=Math.max,Of=Math.min;function Nf(t,e,r){var a,n,i,s,o,l,u=0,f=!1,h=!1,c=!0;if(typeof t!="function")throw new TypeError(Lf);e=ls(e)||0,gr(r)&&(f=!!r.leading,h="maxWait"in r,i=h?Af(ls(r.maxWait)||0,e):i,c="trailing"in r?!!r.trailing:c);function v(x){var w=a,T=n;return a=n=void 0,u=x,s=t.apply(T,w),s}function d(x){return u=x,o=setTimeout(g,e),f?v(x):s}function y(x){var w=x-l,T=x-u,C=e-w;return h?Of(C,i-T):C}function p(x){var w=x-l,T=x-u;return l===void 0||w>=e||w<0||h&&T>=i}function g(){var x=zn();if(p(x))return m(x);o=setTimeout(g,y(x))}function m(x){return o=void 0,c&&a?v(x):(a=n=void 0,s)}function E(){o!==void 0&&clearTimeout(o),u=0,a=l=n=o=void 0}function D(){return o===void 0?s:m(zn())}function b(){var x=zn(),w=p(x);if(a=arguments,n=this,l=x,w){if(o===void 0)return d(l);if(h)return clearTimeout(o),o=setTimeout(g,e),v(l)}return o===void 0&&(o=setTimeout(g,e)),s}return b.cancel=E,b.flush=D,b}var En=Nf,Vn=Ye?Ye.performance:null,Oo=Vn&&Vn.now?function(){return Vn.now()}:function(){return Date.now()},If=function(){if(Ye){if(Ye.requestAnimationFrame)return function(t){Ye.requestAnimationFrame(t)};if(Ye.mozRequestAnimationFrame)return function(t){Ye.mozRequestAnimationFrame(t)};if(Ye.webkitRequestAnimationFrame)return function(t){Ye.webkitRequestAnimationFrame(t)};if(Ye.msRequestAnimationFrame)return function(t){Ye.msRequestAnimationFrame(t)}}return function(t){t&&setTimeout(function(){t(Oo())},1e3/60)}}(),un=function(e){return If(e)},$t=Oo,Nr=9261,No=65599,oa=5381,Io=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nr,a=r,n;n=e.next(),!n.done;)a=a*No+n.value|0;return a},da=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nr;return r*No+e|0},ga=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:oa;return(r<<5)+r+e|0},Mf=function(e,r){return e*2097152+r},Kt=function(e){return e[0]*2097152+e[1]},za=function(e,r){return[da(e[0],r[0]),ga(e[1],r[1])]},Rf=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e[n++]:a.done=!0,a}};return Io(s,r)},pr=function(e,r){var a={value:0,done:!1},n=0,i=e.length,s={next:function(){return n<i?a.value=e.charCodeAt(n++):a.done=!0,a}};return Io(s,r)},Mo=function(){return kf(arguments)},kf=function(e){for(var r,a=0;a<e.length;a++){var n=e[a];a===0?r=pr(n):r=pr(n,r)}return r},fs=!0,Pf=console.warn!=null,Bf=console.trace!=null,mi=Number.MAX_SAFE_INTEGER||9007199254740991,Ro=function(){return!0},ln=function(){return!1},hs=function(){return 0},bi=function(){},ze=function(e){throw new Error(e)},ko=function(e){if(e!==void 0)fs=!!e;else return fs},Ne=function(e){ko()&&(Pf?console.warn(e):(console.log(e),Bf&&console.trace()))},Ff=function(e){return be({},e)},Pt=function(e){return e==null?e:Re(e)?e.slice():Ce(e)?Ff(e):e},Gf=function(e){return e.slice()},Po=function(e,r){for(r=e="";e++<36;r+=e*51&52?(e^15?8^Math.random()*(e^20?16:4):4).toString(16):"-");return r},zf={},Bo=function(){return zf},tt=function(e){var r=Object.keys(e);return function(a){for(var n={},i=0;i<r.length;i++){var s=r[i],o=a==null?void 0:a[s];n[s]=o===void 0?e[s]:o}return n}},rr=function(e,r,a){for(var n=e.length-1;n>=0&&!(e[n]===r&&(e.splice(n,1),a));n--);},Ei=function(e){e.splice(0,e.length)},Vf=function(e,r){for(var a=0;a<r.length;a++){var n=r[a];e.push(n)}},At=function(e,r,a){return a&&(r=To(a,r)),e[r]},Qt=function(e,r,a,n){a&&(r=To(a,r)),e[r]=n},Uf=function(){function t(){di(this,t),this._obj={}}return gi(t,[{key:"set",value:function(r,a){return this._obj[r]=a,this}},{key:"delete",value:function(r){return this._obj[r]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(r){return this._obj[r]!==void 0}},{key:"get",value:function(r){return this._obj[r]}}]),t}(),Bt=typeof Map!="undefined"?Map:Uf,$f="undefined",Yf=function(){function t(e){if(di(this,t),this._obj=Object.create(null),this.size=0,e!=null){var r;e.instanceString!=null&&e.instanceString()===this.instanceString()?r=e.toArray():r=e;for(var a=0;a<r.length;a++)this.add(r[a])}}return gi(t,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(r){var a=this._obj;a[r]!==1&&(a[r]=1,this.size++)}},{key:"delete",value:function(r){var a=this._obj;a[r]===1&&(a[r]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(r){return this._obj[r]===1}},{key:"toArray",value:function(){var r=this;return Object.keys(this._obj).filter(function(a){return r.has(a)})}},{key:"forEach",value:function(r,a){return this.toArray().forEach(r,a)}}]),t}(),Ur=(typeof Set=="undefined"?"undefined":He(Set))!==$f?Set:Yf,wn=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(e===void 0||r===void 0||!pi(e)){ze("An element must have a core reference and parameters set");return}var n=r.group;if(n==null&&(r.data&&r.data.source!=null&&r.data.target!=null?n="edges":n="nodes"),n!=="nodes"&&n!=="edges"){ze("An element must be of type `nodes` or `edges`; you specified `"+n+"`");return}this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:r.data||{},position:r.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:n,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!r.selected,selectable:r.selectable===void 0?!0:!!r.selectable,locked:!!r.locked,grabbed:!1,grabbable:r.grabbable===void 0?!0:!!r.grabbable,pannable:r.pannable===void 0?n==="edges":!!r.pannable,active:!1,classes:new Ur,animation:{current:[],queue:[]},rscratch:{},scratch:r.scratch||{},edges:[],children:[],parent:r.parent&&r.parent.isNode()?r.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(i.position.x==null&&(i.position.x=0),i.position.y==null&&(i.position.y=0),r.renderedPosition){var s=r.renderedPosition,o=e.pan(),l=e.zoom();i.position={x:(s.x-o.x)/l,y:(s.y-o.y)/l}}var u=[];Re(r.classes)?u=r.classes:ve(r.classes)&&(u=r.classes.split(/\s+/));for(var f=0,h=u.length;f<h;f++){var c=u[f];!c||c===""||i.classes.add(c)}this.createEmitter();var v=r.style||r.css;v&&(Ne("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."),this.style(v)),(a===void 0||a)&&this.restore()},cs=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(a,n,i){var s;Ce(a)&&!pt(a)&&(s=a,a=s.roots||s.root,n=s.visit,i=s.directed),i=arguments.length===2&&!Ge(n)?n:i,n=Ge(n)?n:function(){};for(var o=this._private.cy,l=a=ve(a)?this.filter(a):a,u=[],f=[],h={},c={},v={},d=0,y,p=this.byGroup(),g=p.nodes,m=p.edges,E=0;E<l.length;E++){var D=l[E],b=D.id();D.isNode()&&(u.unshift(D),e.bfs&&(v[b]=!0,f.push(D)),c[b]=0)}for(var x=function(){var I=e.bfs?u.shift():u.pop(),O=I.id();if(e.dfs){if(v[O])return"continue";v[O]=!0,f.push(I)}var k=c[O],R=h[O],M=R!=null?R.source():null,P=R!=null?R.target():null,F=R==null?void 0:I.same(M)?P[0]:M[0],V=void 0;if(V=n(I,R,F,d++,k),V===!0)return y=I,"break";if(V===!1)return"break";for(var G=I.connectedEdges().filter(function(U){return(!i||U.source().same(I))&&m.has(U)}),B=0;B<G.length;B++){var Y=G[B],Z=Y.connectedNodes().filter(function(U){return!U.same(I)&&g.has(U)}),K=Z.id();Z.length!==0&&!v[K]&&(Z=Z[0],u.push(Z),e.bfs&&(v[K]=!0,f.push(Z)),h[K]=Y,c[K]=c[O]+1)}};u.length!==0;){var w=x();if(w!=="continue"&&w==="break")break}for(var T=o.collection(),C=0;C<f.length;C++){var S=f[C],A=h[S.id()];A!=null&&T.push(A),T.push(S)}return{path:o.collection(T),found:o.collection(y)}}},pa={breadthFirstSearch:cs({bfs:!0}),depthFirstSearch:cs({dfs:!0})};pa.bfs=pa.breadthFirstSearch;pa.dfs=pa.depthFirstSearch;var _f=ql(function(t,e){(function(){var r,a,n,i,s,o,l,u,f,h,c,v,d,y,p;n=Math.floor,h=Math.min,a=function(g,m){return g<m?-1:g>m?1:0},f=function(g,m,E,D,b){var x;if(E==null&&(E=0),b==null&&(b=a),E<0)throw new Error("lo must be non-negative");for(D==null&&(D=g.length);E<D;)x=n((E+D)/2),b(m,g[x])<0?D=x:E=x+1;return[].splice.apply(g,[E,E-E].concat(m)),m},o=function(g,m,E){return E==null&&(E=a),g.push(m),y(g,0,g.length-1,E)},s=function(g,m){var E,D;return m==null&&(m=a),E=g.pop(),g.length?(D=g[0],g[0]=E,p(g,0,m)):D=E,D},u=function(g,m,E){var D;return E==null&&(E=a),D=g[0],g[0]=m,p(g,0,E),D},l=function(g,m,E){var D;return E==null&&(E=a),g.length&&E(g[0],m)<0&&(D=[g[0],m],m=D[0],g[0]=D[1],p(g,0,E)),m},i=function(g,m){var E,D,b,x,w,T;for(m==null&&(m=a),x=function(){T=[];for(var C=0,S=n(g.length/2);0<=S?C<S:C>S;0<=S?C++:C--)T.push(C);return T}.apply(this).reverse(),w=[],D=0,b=x.length;D<b;D++)E=x[D],w.push(p(g,E,m));return w},d=function(g,m,E){var D;if(E==null&&(E=a),D=g.indexOf(m),D!==-1)return y(g,0,D,E),p(g,D,E)},c=function(g,m,E){var D,b,x,w,T;if(E==null&&(E=a),b=g.slice(0,m),!b.length)return b;for(i(b,E),T=g.slice(m),x=0,w=T.length;x<w;x++)D=T[x],l(b,D,E);return b.sort(E).reverse()},v=function(g,m,E){var D,b,x,w,T,C,S,A,L;if(E==null&&(E=a),m*10<=g.length){if(x=g.slice(0,m).sort(E),!x.length)return x;for(b=x[x.length-1],S=g.slice(m),w=0,C=S.length;w<C;w++)D=S[w],E(D,b)<0&&(f(x,D,0,null,E),x.pop(),b=x[x.length-1]);return x}for(i(g,E),L=[],T=0,A=h(m,g.length);0<=A?T<A:T>A;0<=A?++T:--T)L.push(s(g,E));return L},y=function(g,m,E,D){var b,x,w;for(D==null&&(D=a),b=g[E];E>m;){if(w=E-1>>1,x=g[w],D(b,x)<0){g[E]=x,E=w;continue}break}return g[E]=b},p=function(g,m,E){var D,b,x,w,T;for(E==null&&(E=a),b=g.length,T=m,x=g[m],D=2*m+1;D<b;)w=D+1,w<b&&!(E(g[D],g[w])<0)&&(D=w),g[m]=g[D],m=D,D=2*m+1;return g[m]=x,y(g,T,m,E)},r=function(){g.push=o,g.pop=s,g.replace=u,g.pushpop=l,g.heapify=i,g.updateItem=d,g.nlargest=c,g.nsmallest=v;function g(m){this.cmp=m!=null?m:a,this.nodes=[]}return g.prototype.push=function(m){return o(this.nodes,m,this.cmp)},g.prototype.pop=function(){return s(this.nodes,this.cmp)},g.prototype.peek=function(){return this.nodes[0]},g.prototype.contains=function(m){return this.nodes.indexOf(m)!==-1},g.prototype.replace=function(m){return u(this.nodes,m,this.cmp)},g.prototype.pushpop=function(m){return l(this.nodes,m,this.cmp)},g.prototype.heapify=function(){return i(this.nodes,this.cmp)},g.prototype.updateItem=function(m){return d(this.nodes,m,this.cmp)},g.prototype.clear=function(){return this.nodes=[]},g.prototype.empty=function(){return this.nodes.length===0},g.prototype.size=function(){return this.nodes.length},g.prototype.clone=function(){var m;return m=new g,m.nodes=this.nodes.slice(0),m},g.prototype.toArray=function(){return this.nodes.slice(0)},g.prototype.insert=g.prototype.push,g.prototype.top=g.prototype.peek,g.prototype.front=g.prototype.peek,g.prototype.has=g.prototype.contains,g.prototype.copy=g.prototype.clone,g}(),function(g,m){return t.exports=m()}(this,function(){return r})}).call(sa)}),La=_f,Hf=tt({root:null,weight:function(e){return 1},directed:!1}),Xf={dijkstra:function(e){if(!Ce(e)){var r=arguments;e={root:r[0],weight:r[1],directed:r[2]}}var a=Hf(e),n=a.root,i=a.weight,s=a.directed,o=this,l=i,u=ve(n)?this.filter(n)[0]:n[0],f={},h={},c={},v=this.byGroup(),d=v.nodes,y=v.edges;y.unmergeBy(function(k){return k.isLoop()});for(var p=function(R){return f[R.id()]},g=function(R,M){f[R.id()]=M,m.updateItem(R)},m=new La(function(k,R){return p(k)-p(R)}),E=0;E<d.length;E++){var D=d[E];f[D.id()]=D.same(u)?0:1/0,m.push(D)}for(var b=function(R,M){for(var P=(s?R.edgesTo(M):R.edgesWith(M)).intersect(y),F=1/0,V,G=0;G<P.length;G++){var B=P[G],Y=l(B);(Y<F||!V)&&(F=Y,V=B)}return{edge:V,dist:F}};m.size()>0;){var x=m.pop(),w=p(x),T=x.id();if(c[T]=w,w!==1/0)for(var C=x.neighborhood().intersect(d),S=0;S<C.length;S++){var A=C[S],L=A.id(),I=b(x,A),O=w+I.dist;O<p(A)&&(g(A,O),h[L]={node:x,edge:I.edge})}}return{distanceTo:function(R){var M=ve(R)?d.filter(R)[0]:R[0];return c[M.id()]},pathTo:function(R){var M=ve(R)?d.filter(R)[0]:R[0],P=[],F=M,V=F.id();if(M.length>0)for(P.unshift(M);h[V];){var G=h[V];P.unshift(G.edge),P.unshift(G.node),F=G.node,V=F.id()}return o.spawn(P)}}}},qf={kruskal:function(e){e=e||function(E){return 1};for(var r=this.byGroup(),a=r.nodes,n=r.edges,i=a.length,s=new Array(i),o=a,l=function(D){for(var b=0;b<s.length;b++){var x=s[b];if(x.has(D))return b}},u=0;u<i;u++)s[u]=this.spawn(a[u]);for(var f=n.sort(function(E,D){return e(E)-e(D)}),h=0;h<f.length;h++){var c=f[h],v=c.source()[0],d=c.target()[0],y=l(v),p=l(d),g=s[y],m=s[p];y!==p&&(o.merge(c),g.merge(m),s.splice(p,1))}return o}},Wf=tt({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),Kf={aStar:function(e){var r=this.cy(),a=Wf(e),n=a.root,i=a.goal,s=a.heuristic,o=a.directed,l=a.weight;n=r.collection(n)[0],i=r.collection(i)[0];var u=n.id(),f=i.id(),h={},c={},v={},d=new La(function(V,G){return c[V.id()]-c[G.id()]}),y=new Ur,p={},g={},m=function(G,B){d.push(G),y.add(B)},E,D,b=function(){E=d.pop(),D=E.id(),y.delete(D)},x=function(G){return y.has(G)};m(n,u),h[u]=0,c[u]=s(n);for(var w=0;d.size()>0;){if(b(),w++,D===f){for(var T=[],C=i,S=f,A=g[S];T.unshift(C),A!=null&&T.unshift(A),C=p[S],C!=null;)S=C.id(),A=g[S];return{found:!0,distance:h[D],path:this.spawn(T),steps:w}}v[D]=!0;for(var L=E._private.edges,I=0;I<L.length;I++){var O=L[I];if(this.hasElementWithId(O.id())&&!(o&&O.data("source")!==D)){var k=O.source(),R=O.target(),M=k.id()!==D?k:R,P=M.id();if(this.hasElementWithId(P)&&!v[P]){var F=h[D]+l(O);if(!x(P)){h[P]=F,c[P]=F+s(M),m(M,P),p[P]=E,g[P]=O;continue}F<h[P]&&(h[P]=F,c[P]=F+s(M),p[P]=E,g[P]=O)}}}}return{found:!1,distance:void 0,path:void 0,steps:w}}},Zf=tt({weight:function(e){return 1},directed:!1}),Qf={floydWarshall:function(e){for(var r=this.cy(),a=Zf(e),n=a.weight,i=a.directed,s=n,o=this.byGroup(),l=o.nodes,u=o.edges,f=l.length,h=f*f,c=function(Y){return l.indexOf(Y)},v=function(Y){return l[Y]},d=new Array(h),y=0;y<h;y++){var p=y%f,g=(y-p)/f;g===p?d[y]=0:d[y]=1/0}for(var m=new Array(h),E=new Array(h),D=0;D<u.length;D++){var b=u[D],x=b.source()[0],w=b.target()[0];if(x!==w){var T=c(x),C=c(w),S=T*f+C,A=s(b);if(d[S]>A&&(d[S]=A,m[S]=C,E[S]=b),!i){var L=C*f+T;!i&&d[L]>A&&(d[L]=A,m[L]=T,E[L]=b)}}}for(var I=0;I<f;I++)for(var O=0;O<f;O++)for(var k=O*f+I,R=0;R<f;R++){var M=O*f+R,P=I*f+R;d[k]+d[P]<d[M]&&(d[M]=d[k]+d[P],m[M]=m[k])}var F=function(Y){return(ve(Y)?r.filter(Y):Y)[0]},V=function(Y){return c(F(Y))},G={distance:function(Y,Z){var K=V(Y),U=V(Z);return d[K*f+U]},path:function(Y,Z){var K=V(Y),U=V(Z),z=v(K);if(K===U)return z.collection();if(m[K*f+U]==null)return r.collection();var _=r.collection(),q=K,J;for(_.merge(z);K!==U;)q=K,K=m[K*f+U],J=E[q*f+K],_.merge(J),_.merge(v(K));return _}};return G}},Jf=tt({weight:function(e){return 1},directed:!1,root:null}),jf={bellmanFord:function(e){var r=this,a=Jf(e),n=a.weight,i=a.directed,s=a.root,o=n,l=this,u=this.cy(),f=this.byGroup(),h=f.edges,c=f.nodes,v=c.length,d=new Bt,y=!1,p=[];s=u.collection(s)[0],h.unmergeBy(function(ce){return ce.isLoop()});for(var g=h.length,m=function(fe){var ge=d.get(fe.id());return ge||(ge={},d.set(fe.id(),ge)),ge},E=function(fe){return(ve(fe)?u.$(fe):fe)[0]},D=function(fe){return m(E(fe)).dist},b=function(fe){for(var ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,Ae=E(fe),xe=[],we=Ae;;){if(we==null)return r.spawn();var De=m(we),j=De.edge,N=De.pred;if(xe.unshift(we[0]),we.same(ge)&&xe.length>0)break;j!=null&&xe.unshift(j),we=N}return l.spawn(xe)},x=0;x<v;x++){var w=c[x],T=m(w);w.same(s)?T.dist=0:T.dist=1/0,T.pred=null,T.edge=null}for(var C=!1,S=function(fe,ge,Ae,xe,we,De){var j=xe.dist+De;j<we.dist&&!Ae.same(xe.edge)&&(we.dist=j,we.pred=fe,we.edge=Ae,C=!0)},A=1;A<v;A++){C=!1;for(var L=0;L<g;L++){var I=h[L],O=I.source(),k=I.target(),R=o(I),M=m(O),P=m(k);S(O,k,I,M,P,R),i||S(k,O,I,P,M,R)}if(!C)break}if(C)for(var F=[],V=0;V<g;V++){var G=h[V],B=G.source(),Y=G.target(),Z=o(G),K=m(B).dist,U=m(Y).dist;if(K+Z<U||!i&&U+Z<K)if(y||(Ne("Graph contains a negative weight cycle for Bellman-Ford"),y=!0),e.findNegativeWeightCycles!==!1){var z=[];K+Z<U&&z.push(B),!i&&U+Z<K&&z.push(Y);for(var _=z.length,q=0;q<_;q++){var J=z[q],ee=[J];ee.push(m(J).edge);for(var oe=m(J).pred;ee.indexOf(oe)===-1;)ee.push(oe),ee.push(m(oe).edge),oe=m(oe).pred;ee=ee.slice(ee.indexOf(oe));for(var me=ee[0].id(),te=0,ie=2;ie<ee.length;ie+=2)ee[ie].id()<me&&(me=ee[ie].id(),te=ie);ee=ee.slice(te).concat(ee.slice(0,te)),ee.push(ee[0]);var ue=ee.map(function(ce){return ce.id()}).join(",");F.indexOf(ue)===-1&&(p.push(l.spawn(ee)),F.push(ue))}}else break}return{distanceTo:D,pathTo:b,hasNegativeWeightCycle:y,negativeWeightCycles:p}}},eh=Math.sqrt(2),th=function(e,r,a){a.length===0&&ze("Karger-Stein must be run on a connected (sub)graph");for(var n=a[e],i=n[1],s=n[2],o=r[i],l=r[s],u=a,f=u.length-1;f>=0;f--){var h=u[f],c=h[1],v=h[2];(r[c]===o&&r[v]===l||r[c]===l&&r[v]===o)&&u.splice(f,1)}for(var d=0;d<u.length;d++){var y=u[d];y[1]===l?(u[d]=y.slice(),u[d][1]=o):y[2]===l&&(u[d]=y.slice(),u[d][2]=o)}for(var p=0;p<r.length;p++)r[p]===l&&(r[p]=o);return u},Un=function(e,r,a,n){for(;a>n;){var i=Math.floor(Math.random()*r.length);r=th(i,e,r),a--}return r},rh={kargerStein:function(){var e=this,r=this.byGroup(),a=r.nodes,n=r.edges;n.unmergeBy(function(P){return P.isLoop()});var i=a.length,s=n.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),l=Math.floor(i/eh);if(i<2){ze("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],f=0;f<s;f++){var h=n[f];u.push([f,a.indexOf(h.source()),a.indexOf(h.target())])}for(var c=1/0,v=[],d=new Array(i),y=new Array(i),p=new Array(i),g=function(F,V){for(var G=0;G<i;G++)V[G]=F[G]},m=0;m<=o;m++){for(var E=0;E<i;E++)y[E]=E;var D=Un(y,u.slice(),i,l),b=D.slice();g(y,p);var x=Un(y,D,l,2),w=Un(p,b,l,2);x.length<=w.length&&x.length<c?(c=x.length,v=x,g(y,d)):w.length<=x.length&&w.length<c&&(c=w.length,v=w,g(p,d))}for(var T=this.spawn(v.map(function(P){return n[P[0]]})),C=this.spawn(),S=this.spawn(),A=d[0],L=0;L<d.length;L++){var I=d[L],O=a[L];I===A?C.merge(O):S.merge(O)}var k=function(F){var V=e.spawn();return F.forEach(function(G){V.merge(G),G.connectedEdges().forEach(function(B){e.contains(B)&&!T.contains(B)&&V.merge(B)})}),V},R=[k(C),k(S)],M={cut:T,components:R,partition1:C,partition2:S};return M}},ah=function(e){return{x:e.x,y:e.y}},xn=function(e,r,a){return{x:e.x*r+a.x,y:e.y*r+a.y}},Fo=function(e,r,a){return{x:(e.x-a.x)/r,y:(e.y-a.y)/r}},Ir=function(e){return{x:e[0],y:e[1]}},nh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.min(s,n))}return n},ih=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=-1/0,i=r;i<a;i++){var s=e[i];isFinite(s)&&(n=Math.max(s,n))}return n},sh=function(e){for(var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=0,i=0,s=r;s<a;s++){var o=e[s];isFinite(o)&&(n+=o,i++)}return n/i},oh=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:e.length,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;n?e=e.slice(r,a):(a<e.length&&e.splice(a,e.length-a),r>0&&e.splice(0,r));for(var o=0,l=e.length-1;l>=0;l--){var u=e[l];s?isFinite(u)||(e[l]=-1/0,o++):e.splice(l,1)}i&&e.sort(function(c,v){return c-v});var f=e.length,h=Math.floor(f/2);return f%2!==0?e[h+1+o]:(e[h-1+o]+e[h+o])/2},uh=function(e){return Math.PI*e/180},Va=function(e,r){return Math.atan2(r,e)-Math.PI/2},wi=Math.log2||function(t){return Math.log(t)/Math.log(2)},Go=function(e){return e>0?1:e<0?-1:0},yr=function(e,r){return Math.sqrt(fr(e,r))},fr=function(e,r){var a=r.x-e.x,n=r.y-e.y;return a*a+n*n},lh=function(e){for(var r=e.length,a=0,n=0;n<r;n++)a+=e[n];for(var i=0;i<r;i++)e[i]=e[i]/a;return e},Ke=function(e,r,a,n){return(1-n)*(1-n)*e+2*(1-n)*n*r+n*n*a},Rr=function(e,r,a,n){return{x:Ke(e.x,r.x,a.x,n),y:Ke(e.y,r.y,a.y,n)}},fh=function(e,r,a,n){var i={x:r.x-e.x,y:r.y-e.y},s=yr(e,r),o={x:i.x/s,y:i.y/s};return a=a==null?0:a,n=n!=null?n:a*s,{x:e.x+o.x*n,y:e.y+o.y*n}},ya=function(e,r,a){return Math.max(e,Math.min(a,r))},gt=function(e){if(e==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(e.x1!=null&&e.y1!=null){if(e.x2!=null&&e.y2!=null&&e.x2>=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(e.w!=null&&e.h!=null&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},hh=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},ch=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},vh=function(e,r,a){return{x1:e.x1+r,x2:e.x2+r,y1:e.y1+a,y2:e.y2+a,w:e.w,h:e.h}},zo=function(e,r){e.x1=Math.min(e.x1,r.x1),e.x2=Math.max(e.x2,r.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,r.y1),e.y2=Math.max(e.y2,r.y2),e.h=e.y2-e.y1},dh=function(e,r,a){e.x1=Math.min(e.x1,r),e.x2=Math.max(e.x2,r),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,a),e.y2=Math.max(e.y2,a),e.h=e.y2-e.y1},Qa=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return e.x1-=r,e.x2+=r,e.y1-=r,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Ja=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],a,n,i,s;if(r.length===1)a=n=i=s=r[0];else if(r.length===2)a=i=r[0],s=n=r[1];else if(r.length===4){var o=St(r,4);a=o[0],n=o[1],i=o[2],s=o[3]}return e.x1-=s,e.x2+=n,e.y1-=a,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},vs=function(e,r){e.x1=r.x1,e.y1=r.y1,e.x2=r.x2,e.y2=r.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},xi=function(e,r){return!(e.x1>r.x2||r.x1>e.x2||e.x2<r.x1||r.x2<e.x1||e.y2<r.y1||r.y2<e.y1||e.y1>r.y2||r.y1>e.y2)},Gr=function(e,r,a){return e.x1<=r&&r<=e.x2&&e.y1<=a&&a<=e.y2},gh=function(e,r){return Gr(e,r.x,r.y)},Vo=function(e,r){return Gr(e,r.x1,r.y1)&&Gr(e,r.x2,r.y2)},Uo=function(e,r,a,n,i,s,o){var l=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",u=l==="auto"?mr(i,s):l,f=i/2,h=s/2;u=Math.min(u,f,h);var c=u!==f,v=u!==h,d;if(c){var y=a-f+u-o,p=n-h-o,g=a+f-u+o,m=p;if(d=Jt(e,r,a,n,y,p,g,m,!1),d.length>0)return d}if(v){var E=a+f+o,D=n-h+u-o,b=E,x=n+h-u+o;if(d=Jt(e,r,a,n,E,D,b,x,!1),d.length>0)return d}if(c){var w=a-f+u-o,T=n+h+o,C=a+f-u+o,S=T;if(d=Jt(e,r,a,n,w,T,C,S,!1),d.length>0)return d}if(v){var A=a-f-o,L=n-h+u-o,I=A,O=n+h-u+o;if(d=Jt(e,r,a,n,A,L,I,O,!1),d.length>0)return d}var k;{var R=a-f+u,M=n-h+u;if(k=ua(e,r,a,n,R,M,u+o),k.length>0&&k[0]<=R&&k[1]<=M)return[k[0],k[1]]}{var P=a+f-u,F=n-h+u;if(k=ua(e,r,a,n,P,F,u+o),k.length>0&&k[0]>=P&&k[1]<=F)return[k[0],k[1]]}{var V=a+f-u,G=n+h-u;if(k=ua(e,r,a,n,V,G,u+o),k.length>0&&k[0]>=V&&k[1]>=G)return[k[0],k[1]]}{var B=a-f+u,Y=n+h-u;if(k=ua(e,r,a,n,B,Y,u+o),k.length>0&&k[0]<=B&&k[1]>=Y)return[k[0],k[1]]}return[]},ph=function(e,r,a,n,i,s,o){var l=o,u=Math.min(a,i),f=Math.max(a,i),h=Math.min(n,s),c=Math.max(n,s);return u-l<=e&&e<=f+l&&h-l<=r&&r<=c+l},yh=function(e,r,a,n,i,s,o,l,u){var f={x1:Math.min(a,o,i)-u,x2:Math.max(a,o,i)+u,y1:Math.min(n,l,s)-u,y2:Math.max(n,l,s)+u};return!(e<f.x1||e>f.x2||r<f.y1||r>f.y2)},mh=function(e,r,a,n){a-=n;var i=r*r-4*e*a;if(i<0)return[];var s=Math.sqrt(i),o=2*e,l=(-r+s)/o,u=(-r-s)/o;return[l,u]},bh=function(e,r,a,n,i){var s=1e-5;e===0&&(e=s),r/=e,a/=e,n/=e;var o,l,u,f,h,c,v,d;if(l=(3*a-r*r)/9,u=-(27*n)+r*(9*a-2*(r*r)),u/=54,o=l*l*l+u*u,i[1]=0,v=r/3,o>0){h=u+Math.sqrt(o),h=h<0?-Math.pow(-h,1/3):Math.pow(h,1/3),c=u-Math.sqrt(o),c=c<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-v+h+c,v+=(h+c)/2,i[4]=i[2]=-v,v=Math.sqrt(3)*(-c+h)/2,i[3]=v,i[5]=-v;return}if(i[5]=i[3]=0,o===0){d=u<0?-Math.pow(-u,1/3):Math.pow(u,1/3),i[0]=-v+2*d,i[4]=i[2]=-(d+v);return}l=-l,f=l*l*l,f=Math.acos(u/Math.sqrt(f)),d=2*Math.sqrt(l),i[0]=-v+d*Math.cos(f/3),i[2]=-v+d*Math.cos((f+2*Math.PI)/3),i[4]=-v+d*Math.cos((f+4*Math.PI)/3)},Eh=function(e,r,a,n,i,s,o,l){var u=1*a*a-4*a*i+2*a*o+4*i*i-4*i*o+o*o+n*n-4*n*s+2*n*l+4*s*s-4*s*l+l*l,f=1*9*a*i-3*a*a-3*a*o-6*i*i+3*i*o+9*n*s-3*n*n-3*n*l-6*s*s+3*s*l,h=1*3*a*a-6*a*i+a*o-a*e+2*i*i+2*i*e-o*e+3*n*n-6*n*s+n*l-n*r+2*s*s+2*s*r-l*r,c=1*a*i-a*a+a*e-i*e+n*s-n*n+n*r-s*r,v=[];bh(u,f,h,c,v);for(var d=1e-7,y=[],p=0;p<6;p+=2)Math.abs(v[p+1])<d&&v[p]>=0&&v[p]<=1&&y.push(v[p]);y.push(1),y.push(0);for(var g=-1,m,E,D,b=0;b<y.length;b++)m=Math.pow(1-y[b],2)*a+2*(1-y[b])*y[b]*i+y[b]*y[b]*o,E=Math.pow(1-y[b],2)*n+2*(1-y[b])*y[b]*s+y[b]*y[b]*l,D=Math.pow(m-e,2)+Math.pow(E-r,2),g>=0?D<g&&(g=D):g=D;return g},wh=function(e,r,a,n,i,s){var o=[e-a,r-n],l=[i-a,s-n],u=l[0]*l[0]+l[1]*l[1],f=o[0]*o[0]+o[1]*o[1],h=o[0]*l[0]+o[1]*l[1],c=h*h/u;return h<0?f:c>u?(e-i)*(e-i)+(r-s)*(r-s):f-c},dt=function(e,r,a){for(var n,i,s,o,l,u=0,f=0;f<a.length/2;f++)if(n=a[f*2],i=a[f*2+1],f+1<a.length/2?(s=a[(f+1)*2],o=a[(f+1)*2+1]):(s=a[(f+1-a.length/2)*2],o=a[(f+1-a.length/2)*2+1]),!(n==e&&s==e))if(n>=e&&e>=s||n<=e&&e<=s)l=(e-n)/(s-n)*(o-i)+i,l>r&&u++;else continue;return u%2!==0},Yt=function(e,r,a,n,i,s,o,l,u){var f=new Array(a.length),h;l[0]!=null?(h=Math.atan(l[1]/l[0]),l[0]<0?h=h+Math.PI/2:h=-h-Math.PI/2):h=l;for(var c=Math.cos(-h),v=Math.sin(-h),d=0;d<f.length/2;d++)f[d*2]=s/2*(a[d*2]*c-a[d*2+1]*v),f[d*2+1]=o/2*(a[d*2+1]*c+a[d*2]*v),f[d*2]+=n,f[d*2+1]+=i;var y;if(u>0){var p=hn(f,-u);y=fn(p)}else y=f;return dt(e,r,y)},xh=function(e,r,a,n,i,s,o,l){for(var u=new Array(a.length*2),f=0;f<l.length;f++){var h=l[f];u[f*4+0]=h.startX,u[f*4+1]=h.startY,u[f*4+2]=h.stopX,u[f*4+3]=h.stopY;var c=Math.pow(h.cx-e,2)+Math.pow(h.cy-r,2);if(c<=Math.pow(h.radius,2))return!0}return dt(e,r,u)},fn=function(e){for(var r=new Array(e.length/2),a,n,i,s,o,l,u,f,h=0;h<e.length/4;h++){a=e[h*4],n=e[h*4+1],i=e[h*4+2],s=e[h*4+3],h<e.length/4-1?(o=e[(h+1)*4],l=e[(h+1)*4+1],u=e[(h+1)*4+2],f=e[(h+1)*4+3]):(o=e[0],l=e[1],u=e[2],f=e[3]);var c=Jt(a,n,i,s,o,l,u,f,!0);r[h*2]=c[0],r[h*2+1]=c[1]}return r},hn=function(e,r){for(var a=new Array(e.length*2),n,i,s,o,l=0;l<e.length/2;l++){n=e[l*2],i=e[l*2+1],l<e.length/2-1?(s=e[(l+1)*2],o=e[(l+1)*2+1]):(s=e[0],o=e[1]);var u=o-i,f=-(s-n),h=Math.sqrt(u*u+f*f),c=u/h,v=f/h;a[l*4]=n+c*r,a[l*4+1]=i+v*r,a[l*4+2]=s+c*r,a[l*4+3]=o+v*r}return a},Th=function(e,r,a,n,i,s){var o=a-e,l=n-r;o/=i,l/=s;var u=Math.sqrt(o*o+l*l),f=u-1;if(f<0)return[];var h=f/u;return[(a-e)*h+e,(n-r)*h+r]},dr=function(e,r,a,n,i,s,o){return e-=i,r-=s,e/=a/2+o,r/=n/2+o,e*e+r*r<=1},ua=function(e,r,a,n,i,s,o){var l=[a-e,n-r],u=[e-i,r-s],f=l[0]*l[0]+l[1]*l[1],h=2*(u[0]*l[0]+u[1]*l[1]),c=u[0]*u[0]+u[1]*u[1]-o*o,v=h*h-4*f*c;if(v<0)return[];var d=(-h+Math.sqrt(v))/(2*f),y=(-h-Math.sqrt(v))/(2*f),p=Math.min(d,y),g=Math.max(d,y),m=[];if(p>=0&&p<=1&&m.push(p),g>=0&&g<=1&&m.push(g),m.length===0)return[];var E=m[0]*l[0]+e,D=m[0]*l[1]+r;if(m.length>1){if(m[0]==m[1])return[E,D];var b=m[1]*l[0]+e,x=m[1]*l[1]+r;return[E,D,b,x]}else return[E,D]},$n=function(e,r,a){return r<=e&&e<=a||a<=e&&e<=r?e:e<=r&&r<=a||a<=r&&r<=e?r:a},Jt=function(e,r,a,n,i,s,o,l,u){var f=e-i,h=a-e,c=o-i,v=r-s,d=n-r,y=l-s,p=c*v-y*f,g=h*v-d*f,m=y*h-c*d;if(m!==0){var E=p/m,D=g/m,b=.001,x=0-b,w=1+b;return x<=E&&E<=w&&x<=D&&D<=w?[e+E*h,r+E*d]:u?[e+E*h,r+E*d]:[]}else return p===0||g===0?$n(e,a,o)===o?[o,l]:$n(e,a,i)===i?[i,s]:$n(i,o,a)===a?[a,n]:[]:[]},ma=function(e,r,a,n,i,s,o,l){var u=[],f,h=new Array(a.length),c=!0;s==null&&(c=!1);var v;if(c){for(var d=0;d<h.length/2;d++)h[d*2]=a[d*2]*s+n,h[d*2+1]=a[d*2+1]*o+i;if(l>0){var y=hn(h,-l);v=fn(y)}else v=h}else v=a;for(var p,g,m,E,D=0;D<v.length/2;D++)p=v[D*2],g=v[D*2+1],D<v.length/2-1?(m=v[(D+1)*2],E=v[(D+1)*2+1]):(m=v[0],E=v[1]),f=Jt(e,r,n,i,p,g,m,E),f.length!==0&&u.push(f[0],f[1]);return u},Ch=function(e,r,a,n,i,s,o,l,u){var f=[],h,c=new Array(a.length*2);u.forEach(function(m,E){E===0?(c[c.length-2]=m.startX,c[c.length-1]=m.startY):(c[E*4-2]=m.startX,c[E*4-1]=m.startY),c[E*4]=m.stopX,c[E*4+1]=m.stopY,h=ua(e,r,n,i,m.cx,m.cy,m.radius),h.length!==0&&f.push(h[0],h[1])});for(var v=0;v<c.length/4;v++)h=Jt(e,r,n,i,c[v*4],c[v*4+1],c[v*4+2],c[v*4+3],!1),h.length!==0&&f.push(h[0],h[1]);if(f.length>2){for(var d=[f[0],f[1]],y=Math.pow(d[0]-e,2)+Math.pow(d[1]-r,2),p=1;p<f.length/2;p++){var g=Math.pow(f[p*2]-e,2)+Math.pow(f[p*2+1]-r,2);g<=y&&(d[0]=f[p*2],d[1]=f[p*2+1],y=g)}return d}return f},Ua=function(e,r,a){var n=[e[0]-r[0],e[1]-r[1]],i=Math.sqrt(n[0]*n[0]+n[1]*n[1]),s=(i-a)/i;return s<0&&(s=1e-5),[r[0]+s*n[0],r[1]+s*n[1]]},ht=function(e,r){var a=Jn(e,r);return a=$o(a),a},$o=function(e){for(var r,a,n=e.length/2,i=1/0,s=1/0,o=-1/0,l=-1/0,u=0;u<n;u++)r=e[2*u],a=e[2*u+1],i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);for(var f=2/(o-i),h=2/(l-s),c=0;c<n;c++)r=e[2*c]=e[2*c]*f,a=e[2*c+1]=e[2*c+1]*h,i=Math.min(i,r),o=Math.max(o,r),s=Math.min(s,a),l=Math.max(l,a);if(s<-1)for(var v=0;v<n;v++)a=e[2*v+1]=e[2*v+1]+(-1-s);return e},Jn=function(e,r){var a=1/e*2*Math.PI,n=e%2===0?Math.PI/2+a/2:Math.PI/2;n+=r;for(var i=new Array(e*2),s,o=0;o<e;o++)s=o*a+n,i[2*o]=Math.cos(s),i[2*o+1]=Math.sin(-s);return i},mr=function(e,r){return Math.min(e/4,r/4,8)},Yo=function(e,r){return Math.min(e/10,r/10,8)},Ti=function(){return 8},Dh=function(e,r,a){return[e-2*r+a,2*(r-e),e]},jn=function(e,r){return{heightOffset:Math.min(15,.05*r),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},Sh=tt({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),Lh={pageRank:function(e){for(var r=Sh(e),a=r.dampingFactor,n=r.precision,i=r.iterations,s=r.weight,o=this._private.cy,l=this.byGroup(),u=l.nodes,f=l.edges,h=u.length,c=h*h,v=f.length,d=new Array(c),y=new Array(h),p=(1-a)/h,g=0;g<h;g++){for(var m=0;m<h;m++){var E=g*h+m;d[E]=0}y[g]=0}for(var D=0;D<v;D++){var b=f[D],x=b.data("source"),w=b.data("target");if(x!==w){var T=u.indexOfId(x),C=u.indexOfId(w),S=s(b),A=C*h+T;d[A]+=S,y[T]+=S}}for(var L=1/h+p,I=0;I<h;I++)if(y[I]===0)for(var O=0;O<h;O++){var k=O*h+I;d[k]=L}else for(var R=0;R<h;R++){var M=R*h+I;d[M]=d[M]/y[I]+p}for(var P=new Array(h),F=new Array(h),V,G=0;G<h;G++)P[G]=1;for(var B=0;B<i;B++){for(var Y=0;Y<h;Y++)F[Y]=0;for(var Z=0;Z<h;Z++)for(var K=0;K<h;K++){var U=Z*h+K;F[Z]+=d[U]*P[K]}lh(F),V=P,P=F,F=V;for(var z=0,_=0;_<h;_++){var q=V[_]-P[_];z+=q*q}if(z<n)break}var J={rank:function(oe){return oe=o.collection(oe)[0],P[u.indexOf(oe)]}};return J}},ds=tt({root:null,weight:function(e){return 1},directed:!1,alpha:0}),kr={degreeCentralityNormalized:function(e){e=ds(e);var r=this.cy(),a=this.nodes(),n=a.length;if(e.directed){for(var f={},h={},c=0,v=0,d=0;d<n;d++){var y=a[d],p=y.id();e.root=y;var g=this.degreeCentrality(e);c<g.indegree&&(c=g.indegree),v<g.outdegree&&(v=g.outdegree),f[p]=g.indegree,h[p]=g.outdegree}return{indegree:function(E){return c==0?0:(ve(E)&&(E=r.filter(E)),f[E.id()]/c)},outdegree:function(E){return v===0?0:(ve(E)&&(E=r.filter(E)),h[E.id()]/v)}}}else{for(var i={},s=0,o=0;o<n;o++){var l=a[o];e.root=l;var u=this.degreeCentrality(e);s<u.degree&&(s=u.degree),i[l.id()]=u.degree}return{degree:function(E){return s===0?0:(ve(E)&&(E=r.filter(E)),i[E.id()]/s)}}}},degreeCentrality:function(e){e=ds(e);var r=this.cy(),a=this,n=e,i=n.root,s=n.weight,o=n.directed,l=n.alpha;if(i=r.collection(i)[0],o){for(var v=i.connectedEdges(),d=v.filter(function(x){return x.target().same(i)&&a.has(x)}),y=v.filter(function(x){return x.source().same(i)&&a.has(x)}),p=d.length,g=y.length,m=0,E=0,D=0;D<d.length;D++)m+=s(d[D]);for(var b=0;b<y.length;b++)E+=s(y[b]);return{indegree:Math.pow(p,1-l)*Math.pow(m,l),outdegree:Math.pow(g,1-l)*Math.pow(E,l)}}else{for(var u=i.connectedEdges().intersection(a),f=u.length,h=0,c=0;c<u.length;c++)h+=s(u[c]);return{degree:Math.pow(f,1-l)*Math.pow(h,l)}}}};kr.dc=kr.degreeCentrality;kr.dcn=kr.degreeCentralityNormalised=kr.degreeCentralityNormalized;var gs=tt({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Pr={closenessCentralityNormalized:function(e){for(var r=gs(e),a=r.harmonic,n=r.weight,i=r.directed,s=this.cy(),o={},l=0,u=this.nodes(),f=this.floydWarshall({weight:n,directed:i}),h=0;h<u.length;h++){for(var c=0,v=u[h],d=0;d<u.length;d++)if(h!==d){var y=f.distance(v,u[d]);a?c+=1/y:c+=y}a||(c=1/c),l<c&&(l=c),o[v.id()]=c}return{closeness:function(g){return l==0?0:(ve(g)?g=s.filter(g)[0].id():g=g.id(),o[g]/l)}}},closenessCentrality:function(e){var r=gs(e),a=r.root,n=r.weight,i=r.directed,s=r.harmonic;a=this.filter(a)[0];for(var o=this.dijkstra({root:a,weight:n,directed:i}),l=0,u=this.nodes(),f=0;f<u.length;f++){var h=u[f];if(!h.same(a)){var c=o.distanceTo(h);s?l+=1/c:l+=c}}return s?l:1/l}};Pr.cc=Pr.closenessCentrality;Pr.ccn=Pr.closenessCentralityNormalised=Pr.closenessCentralityNormalized;var Ah=tt({weight:null,directed:!1}),ei={betweennessCentrality:function(e){for(var r=Ah(e),a=r.directed,n=r.weight,i=n!=null,s=this.cy(),o=this.nodes(),l={},u={},f=0,h={set:function(E,D){u[E]=D,D>f&&(f=D)},get:function(E){return u[E]}},c=0;c<o.length;c++){var v=o[c],d=v.id();a?l[d]=v.outgoers().nodes():l[d]=v.openNeighborhood().nodes(),h.set(d,0)}for(var y=function(E){for(var D=o[E].id(),b=[],x={},w={},T={},C=new La(function(K,U){return T[K]-T[U]}),S=0;S<o.length;S++){var A=o[S].id();x[A]=[],w[A]=0,T[A]=1/0}for(w[D]=1,T[D]=0,C.push(D);!C.empty();){var L=C.pop();if(b.push(L),i)for(var I=0;I<l[L].length;I++){var O=l[L][I],k=s.getElementById(L),R=void 0;k.edgesTo(O).length>0?R=k.edgesTo(O)[0]:R=O.edgesTo(k)[0];var M=n(R);O=O.id(),T[O]>T[L]+M&&(T[O]=T[L]+M,C.nodes.indexOf(O)<0?C.push(O):C.updateItem(O),w[O]=0,x[O]=[]),T[O]==T[L]+M&&(w[O]=w[O]+w[L],x[O].push(L))}else for(var P=0;P<l[L].length;P++){var F=l[L][P].id();T[F]==1/0&&(C.push(F),T[F]=T[L]+1),T[F]==T[L]+1&&(w[F]=w[F]+w[L],x[F].push(L))}}for(var V={},G=0;G<o.length;G++)V[o[G].id()]=0;for(;b.length>0;){for(var B=b.pop(),Y=0;Y<x[B].length;Y++){var Z=x[B][Y];V[Z]=V[Z]+w[Z]/w[B]*(1+V[B])}B!=o[E].id()&&h.set(B,h.get(B)+V[B])}},p=0;p<o.length;p++)y(p);var g={betweenness:function(E){var D=s.collection(E).id();return h.get(D)},betweennessNormalized:function(E){if(f==0)return 0;var D=s.collection(E).id();return h.get(D)/f}};return g.betweennessNormalised=g.betweennessNormalized,g}};ei.bc=ei.betweennessCentrality;var Oh=tt({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(t){return 1}]}),Nh=function(e){return Oh(e)},Ih=function(e,r){for(var a=0,n=0;n<r.length;n++)a+=r[n](e);return a},Mh=function(e,r,a){for(var n=0;n<r;n++)e[n*r+n]=a},_o=function(e,r){for(var a,n=0;n<r;n++){a=0;for(var i=0;i<r;i++)a+=e[i*r+n];for(var s=0;s<r;s++)e[s*r+n]=e[s*r+n]/a}},Rh=function(e,r,a){for(var n=new Array(a*a),i=0;i<a;i++){for(var s=0;s<a;s++)n[i*a+s]=0;for(var o=0;o<a;o++)for(var l=0;l<a;l++)n[i*a+l]+=e[i*a+o]*r[o*a+l]}return n},kh=function(e,r,a){for(var n=e.slice(0),i=1;i<a;i++)e=Rh(e,n,r);return e},Ph=function(e,r,a){for(var n=new Array(r*r),i=0;i<r*r;i++)n[i]=Math.pow(e[i],a);return _o(n,r),n},Bh=function(e,r,a,n){for(var i=0;i<a;i++){var s=Math.round(e[i]*Math.pow(10,n))/Math.pow(10,n),o=Math.round(r[i]*Math.pow(10,n))/Math.pow(10,n);if(s!==o)return!1}return!0},Fh=function(e,r,a,n){for(var i=[],s=0;s<r;s++){for(var o=[],l=0;l<r;l++)Math.round(e[s*r+l]*1e3)/1e3>0&&o.push(a[l]);o.length!==0&&i.push(n.collection(o))}return i},Gh=function(e,r){for(var a=0;a<e.length;a++)if(!r[a]||e[a].id()!==r[a].id())return!1;return!0},zh=function(e){for(var r=0;r<e.length;r++)for(var a=0;a<e.length;a++)r!=a&&Gh(e[r],e[a])&&e.splice(a,1);return e},ps=function(e){for(var r=this.nodes(),a=this.edges(),n=this.cy(),i=Nh(e),s={},o=0;o<r.length;o++)s[r[o].id()]=o;for(var l=r.length,u=l*l,f=new Array(u),h,c=0;c<u;c++)f[c]=0;for(var v=0;v<a.length;v++){var d=a[v],y=s[d.source().id()],p=s[d.target().id()],g=Ih(d,i.attributes);f[y*l+p]+=g,f[p*l+y]+=g}Mh(f,l,i.multFactor),_o(f,l);for(var m=!0,E=0;m&&E<i.maxIterations;)m=!1,h=kh(f,l,i.expandFactor),f=Ph(h,l,i.inflateFactor),Bh(f,h,u,4)||(m=!0),E++;var D=Fh(f,l,r,n);return D=zh(D),D},Vh={markovClustering:ps,mcl:ps},Uh=function(e){return e},Ho=function(e,r){return Math.abs(r-e)},ys=function(e,r,a){return e+Ho(r,a)},ms=function(e,r,a){return e+Math.pow(a-r,2)},$h=function(e){return Math.sqrt(e)},Yh=function(e,r,a){return Math.max(e,Ho(r,a))},ra=function(e,r,a,n,i){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Uh,o=n,l,u,f=0;f<e;f++)l=r(f),u=a(f),o=i(o,l,u);return s(o)},zr={euclidean:function(e,r,a){return e>=2?ra(e,r,a,0,ms,$h):ra(e,r,a,0,ys)},squaredEuclidean:function(e,r,a){return ra(e,r,a,0,ms)},manhattan:function(e,r,a){return ra(e,r,a,0,ys)},max:function(e,r,a){return ra(e,r,a,-1/0,Yh)}};zr["squared-euclidean"]=zr.squaredEuclidean;zr.squaredeuclidean=zr.squaredEuclidean;function Tn(t,e,r,a,n,i){var s;return Ge(t)?s=t:s=zr[t]||zr.euclidean,e===0&&Ge(t)?s(n,i):s(e,r,a,n,i)}var _h=tt({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),Ci=function(e){return _h(e)},cn=function(e,r,a,n,i){var s=i!=="kMedoids",o=s?function(h){return a[h]}:function(h){return n[h](a)},l=function(c){return n[c](r)},u=a,f=r;return Tn(e,n.length,o,l,u,f)},Yn=function(e,r,a){for(var n=a.length,i=new Array(n),s=new Array(n),o=new Array(r),l=null,u=0;u<n;u++)i[u]=e.min(a[u]).value,s[u]=e.max(a[u]).value;for(var f=0;f<r;f++){l=[];for(var h=0;h<n;h++)l[h]=Math.random()*(s[h]-i[h])+i[h];o[f]=l}return o},Xo=function(e,r,a,n,i){for(var s=1/0,o=0,l=0;l<r.length;l++){var u=cn(a,e,r[l],n,i);u<s&&(s=u,o=l)}return o},qo=function(e,r,a){for(var n=[],i=null,s=0;s<r.length;s++)i=r[s],a[i.id()]===e&&n.push(i);return n},Hh=function(e,r,a){return Math.abs(r-e)<=a},Xh=function(e,r,a){for(var n=0;n<e.length;n++)for(var i=0;i<e[n].length;i++){var s=Math.abs(e[n][i]-r[n][i]);if(s>a)return!1}return!0},qh=function(e,r,a){for(var n=0;n<a;n++)if(e===r[n])return!0;return!1},bs=function(e,r){var a=new Array(r);if(e.length<50)for(var n=0;n<r;n++){for(var i=e[Math.floor(Math.random()*e.length)];qh(i,a,n);)i=e[Math.floor(Math.random()*e.length)];a[n]=i}else for(var s=0;s<r;s++)a[s]=e[Math.floor(Math.random()*e.length)];return a},Es=function(e,r,a){for(var n=0,i=0;i<r.length;i++)n+=cn("manhattan",r[i],e,a,"kMedoids");return n},Wh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Ci(e),s=new Array(i.k),o={},l;i.testMode?typeof i.testCentroids=="number"?(i.testCentroids,l=Yn(a,i.k,i.attributes)):He(i.testCentroids)==="object"?l=i.testCentroids:l=Yn(a,i.k,i.attributes):l=Yn(a,i.k,i.attributes);for(var u=!0,f=0;u&&f<i.maxIterations;){for(var h=0;h<a.length;h++)n=a[h],o[n.id()]=Xo(n,l,i.distance,i.attributes,"kMeans");u=!1;for(var c=0;c<i.k;c++){var v=qo(c,a,o);if(v.length!==0){for(var d=i.attributes.length,y=l[c],p=new Array(d),g=new Array(d),m=0;m<d;m++){g[m]=0;for(var E=0;E<v.length;E++)n=v[E],g[m]+=i.attributes[m](n);p[m]=g[m]/v.length,Hh(p[m],y[m],i.sensitivityThreshold)||(u=!0)}l[c]=p,s[c]=r.collection(v)}}f++}return s},Kh=function(e){var r=this.cy(),a=this.nodes(),n=null,i=Ci(e),s=new Array(i.k),o,l={},u,f=new Array(i.k);i.testMode?typeof i.testCentroids=="number"||(He(i.testCentroids)==="object"?o=i.testCentroids:o=bs(a,i.k)):o=bs(a,i.k);for(var h=!0,c=0;h&&c<i.maxIterations;){for(var v=0;v<a.length;v++)n=a[v],l[n.id()]=Xo(n,o,i.distance,i.attributes,"kMedoids");h=!1;for(var d=0;d<o.length;d++){var y=qo(d,a,l);if(y.length!==0){f[d]=Es(o[d],y,i.attributes);for(var p=0;p<y.length;p++)u=Es(y[p],y,i.attributes),u<f[d]&&(f[d]=u,o[d]=y[p],h=!0);s[d]=r.collection(y)}}c++}return s},Zh=function(e,r,a,n,i){for(var s,o,l=0;l<r.length;l++)for(var u=0;u<e.length;u++)n[l][u]=Math.pow(a[l][u],i.m);for(var f=0;f<e.length;f++)for(var h=0;h<i.attributes.length;h++){s=0,o=0;for(var c=0;c<r.length;c++)s+=n[c][f]*i.attributes[h](r[c]),o+=n[c][f];e[f][h]=s/o}},Qh=function(e,r,a,n,i){for(var s=0;s<e.length;s++)r[s]=e[s].slice();for(var o,l,u,f=2/(i.m-1),h=0;h<a.length;h++)for(var c=0;c<n.length;c++){o=0;for(var v=0;v<a.length;v++)l=cn(i.distance,n[c],a[h],i.attributes,"cmeans"),u=cn(i.distance,n[c],a[v],i.attributes,"cmeans"),o+=Math.pow(l/u,f);e[c][h]=1/o}},Jh=function(e,r,a,n){for(var i=new Array(a.k),s=0;s<i.length;s++)i[s]=[];for(var o,l,u=0;u<r.length;u++){o=-1/0,l=-1;for(var f=0;f<r[0].length;f++)r[u][f]>o&&(o=r[u][f],l=f);i[l].push(e[u])}for(var h=0;h<i.length;h++)i[h]=n.collection(i[h]);return i},ws=function(e){var r=this.cy(),a=this.nodes(),n=Ci(e),i,s,o,l,u;l=new Array(a.length);for(var f=0;f<a.length;f++)l[f]=new Array(n.k);o=new Array(a.length);for(var h=0;h<a.length;h++)o[h]=new Array(n.k);for(var c=0;c<a.length;c++){for(var v=0,d=0;d<n.k;d++)o[c][d]=Math.random(),v+=o[c][d];for(var y=0;y<n.k;y++)o[c][y]=o[c][y]/v}s=new Array(n.k);for(var p=0;p<n.k;p++)s[p]=new Array(n.attributes.length);u=new Array(a.length);for(var g=0;g<a.length;g++)u[g]=new Array(n.k);for(var m=!0,E=0;m&&E<n.maxIterations;)m=!1,Zh(s,a,o,u,n),Qh(o,l,s,a,n),Xh(o,l,n.sensitivityThreshold)||(m=!0),E++;return i=Jh(a,o,n,r),{clusters:i,degreeOfMembership:o}},jh={kMeans:Wh,kMedoids:Kh,fuzzyCMeans:ws,fcm:ws},ec=tt({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),tc={single:"min",complete:"max"},rc=function(e){var r=ec(e),a=tc[r.linkage];return a!=null&&(r.linkage=a),r},xs=function(e,r,a,n,i){for(var s=0,o=1/0,l,u=i.attributes,f=function(C,S){return Tn(i.distance,u.length,function(A){return u[A](C)},function(A){return u[A](S)},C,S)},h=0;h<e.length;h++){var c=e[h].key,v=a[c][n[c]];v<o&&(s=c,o=v)}if(i.mode==="threshold"&&o>=i.threshold||i.mode==="dendrogram"&&e.length===1)return!1;var d=r[s],y=r[n[s]],p;i.mode==="dendrogram"?p={left:d,right:y,key:d.key}:p={value:d.value.concat(y.value),key:d.key},e[d.index]=p,e.splice(y.index,1),r[d.key]=p;for(var g=0;g<e.length;g++){var m=e[g];d.key===m.key?l=1/0:i.linkage==="min"?(l=a[d.key][m.key],a[d.key][m.key]>a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="max"?(l=a[d.key][m.key],a[d.key][m.key]<a[y.key][m.key]&&(l=a[y.key][m.key])):i.linkage==="mean"?l=(a[d.key][m.key]*d.size+a[y.key][m.key]*y.size)/(d.size+y.size):i.mode==="dendrogram"?l=f(m.value,d.value):l=f(m.value[0],d.value[0]),a[d.key][m.key]=a[m.key][d.key]=l}for(var E=0;E<e.length;E++){var D=e[E].key;if(n[D]===d.key||n[D]===y.key){for(var b=D,x=0;x<e.length;x++){var w=e[x].key;a[D][w]<a[D][b]&&(b=w)}n[D]=b}e[E].index=E}return d.key=y.key=d.index=y.index=null,!0},$a=function t(e,r,a){e&&(e.value?r.push(e.value):(e.left&&t(e.left,r),e.right&&t(e.right,r)))},ac=function t(e,r){if(!e)return"";if(e.left&&e.right){var a=t(e.left,r),n=t(e.right,r),i=r.add({group:"nodes",data:{id:a+","+n}});return r.add({group:"edges",data:{source:a,target:i.id()}}),r.add({group:"edges",data:{source:n,target:i.id()}}),i.id()}else if(e.value)return e.value.id()},nc=function t(e,r,a){if(!e)return[];var n=[],i=[],s=[];return r===0?(e.left&&$a(e.left,n),e.right&&$a(e.right,i),s=n.concat(i),[a.collection(s)]):r===1?e.value?[a.collection(e.value)]:(e.left&&$a(e.left,n),e.right&&$a(e.right,i),[a.collection(n),a.collection(i)]):e.value?[a.collection(e.value)]:(e.left&&(n=t(e.left,r-1,a)),e.right&&(i=t(e.right,r-1,a)),n.concat(i))},Ts=function(e){for(var r=this.cy(),a=this.nodes(),n=rc(e),i=n.attributes,s=function(E,D){return Tn(n.distance,i.length,function(b){return i[b](E)},function(b){return i[b](D)},E,D)},o=[],l=[],u=[],f=[],h=0;h<a.length;h++){var c={value:n.mode==="dendrogram"?a[h]:[a[h]],key:h,index:h};o[h]=c,f[h]=c,l[h]=[],u[h]=0}for(var v=0;v<o.length;v++)for(var d=0;d<=v;d++){var y=void 0;n.mode==="dendrogram"?y=v===d?1/0:s(o[v].value,o[d].value):y=v===d?1/0:s(o[v].value[0],o[d].value[0]),l[v][d]=y,l[d][v]=y,y<l[v][u[v]]&&(u[v]=d)}for(var p=xs(o,f,l,u,n);p;)p=xs(o,f,l,u,n);var g;return n.mode==="dendrogram"?(g=nc(o[0],n.dendrogramDepth,r),n.addDendrogram&&ac(o[0],r)):(g=new Array(o.length),o.forEach(function(m,E){m.key=m.index=null,g[E]=r.collection(m.value)})),g},ic={hierarchicalClustering:Ts,hca:Ts},sc=tt({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),oc=function(e){var r=e.damping,a=e.preference;.5<=r&&r<1||ze("Damping must range on [0.5, 1). Got: ".concat(r));var n=["median","mean","min","max"];return n.some(function(i){return i===a})||ne(a)||ze("Preference must be one of [".concat(n.map(function(i){return"'".concat(i,"'")}).join(", "),"] or a number. Got: ").concat(a)),sc(e)},uc=function(e,r,a,n){var i=function(o,l){return n[l](o)};return-Tn(e,n.length,function(s){return i(r,s)},function(s){return i(a,s)},r,a)},lc=function(e,r){var a=null;return r==="median"?a=oh(e):r==="mean"?a=sh(e):r==="min"?a=nh(e):r==="max"?a=ih(e):a=r,a},fc=function(e,r,a){for(var n=[],i=0;i<e;i++)r[i*e+i]+a[i*e+i]>0&&n.push(i);return n},Cs=function(e,r,a){for(var n=[],i=0;i<e;i++){for(var s=-1,o=-1/0,l=0;l<a.length;l++){var u=a[l];r[i*e+u]>o&&(s=u,o=r[i*e+u])}s>0&&n.push(s)}for(var f=0;f<a.length;f++)n[a[f]]=a[f];return n},hc=function(e,r,a){for(var n=Cs(e,r,a),i=0;i<a.length;i++){for(var s=[],o=0;o<n.length;o++)n[o]===a[i]&&s.push(o);for(var l=-1,u=-1/0,f=0;f<s.length;f++){for(var h=0,c=0;c<s.length;c++)h+=r[s[c]*e+s[f]];h>u&&(l=f,u=h)}a[i]=s[l]}return n=Cs(e,r,a),n},Ds=function(e){for(var r=this.cy(),a=this.nodes(),n=oc(e),i={},s=0;s<a.length;s++)i[a[s].id()]=s;var o,l,u,f,h,c;o=a.length,l=o*o,u=new Array(l);for(var v=0;v<l;v++)u[v]=-1/0;for(var d=0;d<o;d++)for(var y=0;y<o;y++)d!==y&&(u[d*o+y]=uc(n.distance,a[d],a[y],n.attributes));f=lc(u,n.preference);for(var p=0;p<o;p++)u[p*o+p]=f;h=new Array(l);for(var g=0;g<l;g++)h[g]=0;c=new Array(l);for(var m=0;m<l;m++)c[m]=0;for(var E=new Array(o),D=new Array(o),b=new Array(o),x=0;x<o;x++)E[x]=0,D[x]=0,b[x]=0;for(var w=new Array(o*n.minIterations),T=0;T<w.length;T++)w[T]=0;var C;for(C=0;C<n.maxIterations;C++){for(var S=0;S<o;S++){for(var A=-1/0,L=-1/0,I=-1,O=0,k=0;k<o;k++)E[k]=h[S*o+k],O=c[S*o+k]+u[S*o+k],O>=A?(L=A,A=O,I=k):O>L&&(L=O);for(var R=0;R<o;R++)h[S*o+R]=(1-n.damping)*(u[S*o+R]-A)+n.damping*E[R];h[S*o+I]=(1-n.damping)*(u[S*o+I]-L)+n.damping*E[I]}for(var M=0;M<o;M++){for(var P=0,F=0;F<o;F++)E[F]=c[F*o+M],D[F]=Math.max(0,h[F*o+M]),P+=D[F];P-=D[M],D[M]=h[M*o+M],P+=D[M];for(var V=0;V<o;V++)c[V*o+M]=(1-n.damping)*Math.min(0,P-D[V])+n.damping*E[V];c[M*o+M]=(1-n.damping)*(P-D[M])+n.damping*E[M]}for(var G=0,B=0;B<o;B++){var Y=c[B*o+B]+h[B*o+B]>0?1:0;w[C%n.minIterations*o+B]=Y,G+=Y}if(G>0&&(C>=n.minIterations-1||C==n.maxIterations-1)){for(var Z=0,K=0;K<o;K++){b[K]=0;for(var U=0;U<n.minIterations;U++)b[K]+=w[U*o+K];(b[K]===0||b[K]===n.minIterations)&&Z++}if(Z===o)break}}for(var z=fc(o,h,c),_=hc(o,u,z),q={},J=0;J<z.length;J++)q[z[J]]=[];for(var ee=0;ee<a.length;ee++){var oe=i[a[ee].id()],me=_[oe];me!=null&&q[me].push(a[ee])}for(var te=new Array(z.length),ie=0;ie<z.length;ie++)te[ie]=r.collection(q[z[ie]]);return te},cc={affinityPropagation:Ds,ap:Ds},vc=tt({root:void 0,directed:!1}),dc={hierholzer:function(e){if(!Ce(e)){var r=arguments;e={root:r[0],directed:r[1]}}var a=vc(e),n=a.root,i=a.directed,s=this,o=!1,l,u,f;n&&(f=ve(n)?this.filter(n)[0].id():n[0].id());var h={},c={};i?s.forEach(function(m){var E=m.id();if(m.isNode()){var D=m.indegree(!0),b=m.outdegree(!0),x=D-b,w=b-D;x==1?l?o=!0:l=E:w==1?u?o=!0:u=E:(w>1||x>1)&&(o=!0),h[E]=[],m.outgoers().forEach(function(T){T.isEdge()&&h[E].push(T.id())})}else c[E]=[void 0,m.target().id()]}):s.forEach(function(m){var E=m.id();if(m.isNode()){var D=m.degree(!0);D%2&&(l?u?o=!0:u=E:l=E),h[E]=[],m.connectedEdges().forEach(function(b){return h[E].push(b.id())})}else c[E]=[m.source().id(),m.target().id()]});var v={found:!1,trail:void 0};if(o)return v;if(u&&l)if(i){if(f&&u!=f)return v;f=u}else{if(f&&u!=f&&l!=f)return v;f||(f=u)}else f||(f=s[0].id());var d=function(E){for(var D=E,b=[E],x,w,T;h[D].length;)x=h[D].shift(),w=c[x][0],T=c[x][1],D!=T?(h[T]=h[T].filter(function(C){return C!=x}),D=T):!i&&D!=w&&(h[w]=h[w].filter(function(C){return C!=x}),D=w),b.unshift(x),b.unshift(D);return b},y=[],p=[];for(p=d(f);p.length!=1;)h[p[0]].length==0?(y.unshift(s.getElementById(p.shift())),y.unshift(s.getElementById(p.shift()))):p=d(p.shift()).concat(p);y.unshift(s.getElementById(p.shift()));for(var g in h)if(h[g].length)return v;return v.found=!0,v.trail=this.spawn(y,!0),v}},Ya=function(){var e=this,r={},a=0,n=0,i=[],s=[],o={},l=function(c,v){for(var d=s.length-1,y=[],p=e.spawn();s[d].x!=c||s[d].y!=v;)y.push(s.pop().edge),d--;y.push(s.pop().edge),y.forEach(function(g){var m=g.connectedNodes().intersection(e);p.merge(g),m.forEach(function(E){var D=E.id(),b=E.connectedEdges().intersection(e);p.merge(E),r[D].cutVertex?p.merge(b.filter(function(x){return x.isLoop()})):p.merge(b)})}),i.push(p)},u=function h(c,v,d){c===d&&(n+=1),r[v]={id:a,low:a++,cutVertex:!1};var y=e.getElementById(v).connectedEdges().intersection(e);if(y.size()===0)i.push(e.spawn(e.getElementById(v)));else{var p,g,m,E;y.forEach(function(D){p=D.source().id(),g=D.target().id(),m=p===v?g:p,m!==d&&(E=D.id(),o[E]||(o[E]=!0,s.push({x:v,y:m,edge:D})),m in r?r[v].low=Math.min(r[v].low,r[m].id):(h(c,m,v),r[v].low=Math.min(r[v].low,r[m].low),r[v].id<=r[m].low&&(r[v].cutVertex=!0,l(v,m))))})}};e.forEach(function(h){if(h.isNode()){var c=h.id();c in r||(n=0,u(c,c),r[c].cutVertex=n>1)}});var f=Object.keys(r).filter(function(h){return r[h].cutVertex}).map(function(h){return e.getElementById(h)});return{cut:e.spawn(f),components:i}},gc={hopcroftTarjanBiconnected:Ya,htbc:Ya,htb:Ya,hopcroftTarjanBiconnectedComponents:Ya},_a=function(){var e=this,r={},a=0,n=[],i=[],s=e.spawn(e),o=function l(u){i.push(u),r[u]={index:a,low:a++,explored:!1};var f=e.getElementById(u).connectedEdges().intersection(e);if(f.forEach(function(y){var p=y.target().id();p!==u&&(p in r||l(p),r[p].explored||(r[u].low=Math.min(r[u].low,r[p].low)))}),r[u].index===r[u].low){for(var h=e.spawn();;){var c=i.pop();if(h.merge(e.getElementById(c)),r[c].low=r[u].index,r[c].explored=!0,c===u)break}var v=h.edgesWith(h),d=h.merge(v);n.push(d),s=s.difference(d)}};return e.forEach(function(l){if(l.isNode()){var u=l.id();u in r||o(u)}}),{cut:s,components:n}},pc={tarjanStronglyConnected:_a,tsc:_a,tscc:_a,tarjanStronglyConnectedComponents:_a},Wo={};[pa,Xf,qf,Kf,Qf,jf,rh,Lh,kr,Pr,ei,Vh,jh,ic,cc,dc,gc,pc].forEach(function(t){be(Wo,t)});var Ko=0,Zo=1,Qo=2,_t=function t(e){if(!(this instanceof t))return new t(e);this.id="Thenable/1.0.7",this.state=Ko,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof e=="function"&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};_t.prototype={fulfill:function(e){return Ss(this,Zo,"fulfillValue",e)},reject:function(e){return Ss(this,Qo,"rejectReason",e)},then:function(e,r){var a=this,n=new _t;return a.onFulfilled.push(As(e,n,"fulfill")),a.onRejected.push(As(r,n,"reject")),Jo(a),n.proxy}};var Ss=function(e,r,a,n){return e.state===Ko&&(e.state=r,e[a]=n,Jo(e)),e},Jo=function(e){e.state===Zo?Ls(e,"onFulfilled",e.fulfillValue):e.state===Qo&&Ls(e,"onRejected",e.rejectReason)},Ls=function(e,r,a){if(e[r].length!==0){var n=e[r];e[r]=[];var i=function(){for(var o=0;o<n.length;o++)n[o](a)};typeof setImmediate=="function"?setImmediate(i):setTimeout(i,0)}},As=function(e,r,a){return function(n){if(typeof e!="function")r[a].call(r,n);else{var i;try{i=e(n)}catch(s){r.reject(s);return}yc(r,i)}}},yc=function t(e,r){if(e===r||e.proxy===r){e.reject(new TypeError("cannot resolve promise with itself"));return}var a;if(He(r)==="object"&&r!==null||typeof r=="function")try{a=r.then}catch(i){e.reject(i);return}if(typeof a=="function"){var n=!1;try{a.call(r,function(i){n||(n=!0,i===r?e.reject(new TypeError("circular thenable chain")):t(e,i))},function(i){n||(n=!0,e.reject(i))})}catch(i){n||e.reject(i)}return}e.fulfill(r)};_t.all=function(t){return new _t(function(e,r){for(var a=new Array(t.length),n=0,i=function(l,u){a[l]=u,n++,n===t.length&&e(a)},s=0;s<t.length;s++)(function(o){var l=t[o],u=l!=null&&l.then!=null;if(u)l.then(function(h){i(o,h)},function(h){r(h)});else{var f=l;i(o,f)}})(s)})};_t.resolve=function(t){return new _t(function(e,r){e(t)})};_t.reject=function(t){return new _t(function(e,r){r(t)})};var $r=typeof Promise!="undefined"?Promise:_t,ti=function(e,r,a){var n=pi(e),i=!n,s=this._private=be({duration:1e3},r,a);if(s.target=e,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Ge(s.complete)&&s.completes.push(s.complete),i){var o=e.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||e.cy().style().getAnimationStartStyle(e,s.style)}if(n){var l=e.pan();s.startPan={x:l.x,y:l.y},s.startZoom=e.zoom()}this.length=1,this[0]=this},br=ti.prototype;be(br,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var r,a=e.target._private.animation;e.queue?r=a.queue:r=a.current,r.push(this),pt(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return e.progress===1&&(e.progress=0),e.playing=!0,e.started=!1,e.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var e=this._private;return e.applying=!0,e.started=!1,e.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var e=this._private;return e.playing=!1,e.started=!1,this},stop:function(){var e=this._private;return e.playing=!1,e.started=!1,e.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(e){var r=this._private;return e===void 0?r.progress*r.duration:this.progress(e/r.duration)},progress:function(e){var r=this._private,a=r.playing;return e===void 0?r.progress:(a&&this.pause(),r.progress=e,r.started=!1,a&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var e=this._private,r=e.playing;r&&this.pause(),e.progress=1-e.progress,e.started=!1;var a=function(u,f){var h=e[u];h!=null&&(e[u]=e[f],e[f]=h)};if(a("zoom","startZoom"),a("pan","startPan"),a("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],s=i.name,o=e.startStyle[s];e.startStyle[s]=i,e.style[n]=o}return r&&this.play(),this},promise:function(e){var r=this._private,a;switch(e){case"frame":a=r.frames;break;default:case"complete":case"completed":a=r.completes}return new $r(function(n,i){a.push(function(){n()})})}});br.complete=br.completed;br.run=br.play;br.running=br.playing;var mc={animated:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return!1;var s=n[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var r=this,a=r.length!==void 0,n=a?r:[r],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var s=0;s<n.length;s++){var o=n[s];o._private.animation.queue=[]}return this}},delay:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animate({delay:r,duration:r,complete:a}):this}},delayAnimation:function(){return function(r,a){var n=this._private.cy||this;return n.styleEnabled()?this.animation({delay:r,duration:r,complete:a}):this}},animation:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this,l=!i,u=!l;if(!o.styleEnabled())return this;var f=o.style();r=be({},r,a);var h=Object.keys(r).length===0;if(h)return new ti(s[0],r);switch(r.duration===void 0&&(r.duration=400),r.duration){case"slow":r.duration=600;break;case"fast":r.duration=200;break}if(u&&(r.style=f.getPropsList(r.style||r.css),r.css=void 0),u&&r.renderedPosition!=null){var c=r.renderedPosition,v=o.pan(),d=o.zoom();r.position=Fo(c,d,v)}if(l&&r.panBy!=null){var y=r.panBy,p=o.pan();r.pan={x:p.x+y.x,y:p.y+y.y}}var g=r.center||r.centre;if(l&&g!=null){var m=o.getCenterPan(g.eles,r.zoom);m!=null&&(r.pan=m)}if(l&&r.fit!=null){var E=r.fit,D=o.getFitViewport(E.eles||E.boundingBox,E.padding);D!=null&&(r.pan=D.pan,r.zoom=D.zoom)}if(l&&Ce(r.zoom)){var b=o.getZoomedViewport(r.zoom);b!=null?(b.zoomed&&(r.zoom=b.zoom),b.panned&&(r.pan=b.pan)):r.zoom=null}return new ti(s[0],r)}},animate:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;a&&(r=be({},r,a));for(var l=0;l<s.length;l++){var u=s[l],f=u.animated()&&(r.queue===void 0||r.queue),h=u.animation(r,f?{queue:!0}:void 0);h.play()}return this}},stop:function(){return function(r,a){var n=this,i=n.length!==void 0,s=i?n:[n],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var l=0;l<s.length;l++){for(var u=s[l],f=u._private,h=f.animation.current,c=0;c<h.length;c++){var v=h[c],d=v._private;a&&(d.duration=0)}r&&(f.animation.queue=[]),a||(f.animation.current=[])}return o.notify("draw"),this}}},bc=Array.isArray,Cn=bc,Ec=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wc=/^\w*$/;function xc(t,e){if(Cn(t))return!1;var r=typeof t;return r=="number"||r=="symbol"||r=="boolean"||t==null||Sa(t)?!0:wc.test(t)||!Ec.test(t)||e!=null&&t in Object(e)}var Tc=xc,Cc="[object AsyncFunction]",Dc="[object Function]",Sc="[object GeneratorFunction]",Lc="[object Proxy]";function Ac(t){if(!gr(t))return!1;var e=Ao(t);return e==Dc||e==Sc||e==Cc||e==Lc}var Oc=Ac,Nc=bn["__core-js_shared__"],_n=Nc,Os=function(){var t=/[^.]+$/.exec(_n&&_n.keys&&_n.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Ic(t){return!!Os&&Os in t}var Mc=Ic,Rc=Function.prototype,kc=Rc.toString;function Pc(t){if(t!=null){try{return kc.call(t)}catch(e){}try{return t+""}catch(e){}}return""}var Bc=Pc,Fc=/[\\^$.*+?()[\]{}|]/g,Gc=/^\[object .+?Constructor\]$/,zc=Function.prototype,Vc=Object.prototype,Uc=zc.toString,$c=Vc.hasOwnProperty,Yc=RegExp("^"+Uc.call($c).replace(Fc,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _c(t){if(!gr(t)||Mc(t))return!1;var e=Oc(t)?Yc:Gc;return e.test(Bc(t))}var Hc=_c;function Xc(t,e){return t==null?void 0:t[e]}var qc=Xc;function Wc(t,e){var r=qc(t,e);return Hc(r)?r:void 0}var Di=Wc,Kc=Di(Object,"create"),ba=Kc;function Zc(){this.__data__=ba?ba(null):{},this.size=0}var Qc=Zc;function Jc(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var jc=Jc,ev="__lodash_hash_undefined__",tv=Object.prototype,rv=tv.hasOwnProperty;function av(t){var e=this.__data__;if(ba){var r=e[t];return r===ev?void 0:r}return rv.call(e,t)?e[t]:void 0}var nv=av,iv=Object.prototype,sv=iv.hasOwnProperty;function ov(t){var e=this.__data__;return ba?e[t]!==void 0:sv.call(e,t)}var uv=ov,lv="__lodash_hash_undefined__";function fv(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ba&&e===void 0?lv:e,this}var hv=fv;function Yr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}Yr.prototype.clear=Qc;Yr.prototype.delete=jc;Yr.prototype.get=nv;Yr.prototype.has=uv;Yr.prototype.set=hv;var Ns=Yr;function cv(){this.__data__=[],this.size=0}var vv=cv;function dv(t,e){return t===e||t!==t&&e!==e}var jo=dv;function gv(t,e){for(var r=t.length;r--;)if(jo(t[r][0],e))return r;return-1}var Dn=gv,pv=Array.prototype,yv=pv.splice;function mv(t){var e=this.__data__,r=Dn(e,t);if(r<0)return!1;var a=e.length-1;return r==a?e.pop():yv.call(e,r,1),--this.size,!0}var bv=mv;function Ev(t){var e=this.__data__,r=Dn(e,t);return r<0?void 0:e[r][1]}var wv=Ev;function xv(t){return Dn(this.__data__,t)>-1}var Tv=xv;function Cv(t,e){var r=this.__data__,a=Dn(r,t);return a<0?(++this.size,r.push([t,e])):r[a][1]=e,this}var Dv=Cv;function _r(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}_r.prototype.clear=vv;_r.prototype.delete=bv;_r.prototype.get=wv;_r.prototype.has=Tv;_r.prototype.set=Dv;var Sv=_r,Lv=Di(bn,"Map"),Av=Lv;function Ov(){this.size=0,this.__data__={hash:new Ns,map:new(Av||Sv),string:new Ns}}var Nv=Ov;function Iv(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var Mv=Iv;function Rv(t,e){var r=t.__data__;return Mv(e)?r[typeof e=="string"?"string":"hash"]:r.map}var Sn=Rv;function kv(t){var e=Sn(this,t).delete(t);return this.size-=e?1:0,e}var Pv=kv;function Bv(t){return Sn(this,t).get(t)}var Fv=Bv;function Gv(t){return Sn(this,t).has(t)}var zv=Gv;function Vv(t,e){var r=Sn(this,t),a=r.size;return r.set(t,e),this.size+=r.size==a?0:1,this}var Uv=Vv;function Hr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var a=t[e];this.set(a[0],a[1])}}Hr.prototype.clear=Nv;Hr.prototype.delete=Pv;Hr.prototype.get=Fv;Hr.prototype.has=zv;Hr.prototype.set=Uv;var eu=Hr,$v="Expected a function";function Si(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError($v);var r=function(){var a=arguments,n=e?e.apply(this,a):a[0],i=r.cache;if(i.has(n))return i.get(n);var s=t.apply(this,a);return r.cache=i.set(n,s)||i,s};return r.cache=new(Si.Cache||eu),r}Si.Cache=eu;var Yv=Si,_v=500;function Hv(t){var e=Yv(t,function(a){return r.size===_v&&r.clear(),a}),r=e.cache;return e}var Xv=Hv,qv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Wv=/\\(\\)?/g,Kv=Xv(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(qv,function(r,a,n,i){e.push(n?i.replace(Wv,"$1"):a||r)}),e}),tu=Kv;function Zv(t,e){for(var r=-1,a=t==null?0:t.length,n=Array(a);++r<a;)n[r]=e(t[r],r,t);return n}var ru=Zv,Qv=1/0,Is=Fr?Fr.prototype:void 0,Ms=Is?Is.toString:void 0;function au(t){if(typeof t=="string")return t;if(Cn(t))return ru(t,au)+"";if(Sa(t))return Ms?Ms.call(t):"";var e=t+"";return e=="0"&&1/t==-Qv?"-0":e}var Jv=au;function jv(t){return t==null?"":Jv(t)}var nu=jv;function ed(t,e){return Cn(t)?t:Tc(t,e)?[t]:tu(nu(t))}var iu=ed,td=1/0;function rd(t){if(typeof t=="string"||Sa(t))return t;var e=t+"";return e=="0"&&1/t==-td?"-0":e}var Li=rd;function ad(t,e){e=iu(e,t);for(var r=0,a=e.length;t!=null&&r<a;)t=t[Li(e[r++])];return r&&r==a?t:void 0}var nd=ad;function id(t,e,r){var a=t==null?void 0:nd(t,e);return a===void 0?r:a}var sd=id,od=function(){try{var t=Di(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),Rs=od;function ud(t,e,r){e=="__proto__"&&Rs?Rs(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}var ld=ud,fd=Object.prototype,hd=fd.hasOwnProperty;function cd(t,e,r){var a=t[e];(!(hd.call(t,e)&&jo(a,r))||r===void 0&&!(e in t))&&ld(t,e,r)}var vd=cd,dd=9007199254740991,gd=/^(?:0|[1-9]\d*)$/;function pd(t,e){var r=typeof t;return e=e==null?dd:e,!!e&&(r=="number"||r!="symbol"&&gd.test(t))&&t>-1&&t%1==0&&t<e}var yd=pd;function md(t,e,r,a){if(!gr(t))return t;e=iu(e,t);for(var n=-1,i=e.length,s=i-1,o=t;o!=null&&++n<i;){var l=Li(e[n]),u=r;if(l==="__proto__"||l==="constructor"||l==="prototype")return t;if(n!=s){var f=o[l];u=a?a(f,l,o):void 0,u===void 0&&(u=gr(f)?f:yd(e[n+1])?[]:{})}vd(o,l,u),o=o[l]}return t}var bd=md;function Ed(t,e,r){return t==null?t:bd(t,e,r)}var wd=Ed;function xd(t,e){var r=-1,a=t.length;for(e||(e=Array(a));++r<a;)e[r]=t[r];return e}var Td=xd;function Cd(t){return Cn(t)?ru(t,Li):Sa(t)?[t]:Td(tu(nu(t)))}var Dd=Cd,Sd={data:function(e){var r={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(n){},beforeSet:function(n,i){},onSet:function(n){},canSet:function(n){return!0}};return e=be({},r,e),function(n,i){var s=e,o=this,l=o.length!==void 0,u=l?o:[o],f=l?o[0]:o;if(ve(n)){var h=n.indexOf(".")!==-1,c=h&&Dd(n);if(s.allowGetting&&i===void 0){var v;return f&&(s.beforeGet(f),c&&f._private[s.field][n]===void 0?v=sd(f._private[s.field],c):v=f._private[s.field][n]),v}else if(s.allowSetting&&i!==void 0){var d=!s.immutableKeys[n];if(d){var y=mo({},n,i);s.beforeSet(o,y);for(var p=0,g=u.length;p<g;p++){var m=u[p];s.canSet(m)&&(c&&f._private[s.field][n]===void 0?wd(m._private[s.field],c,i):m._private[s.field][n]=i)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&Ce(n)){var E=n,D,b,x=Object.keys(E);s.beforeSet(o,E);for(var w=0;w<x.length;w++){D=x[w],b=E[D];var T=!s.immutableKeys[D];if(T)for(var C=0;C<u.length;C++){var S=u[C];s.canSet(S)&&(S._private[s.field][D]=b)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Ge(n)){var A=n;o.on(s.bindingEvent,A)}else if(s.allowGetting&&n===void 0){var L;return f&&(s.beforeGet(f),L=f._private[s.field]),L}return o}},removeData:function(e){var r={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return e=be({},r,e),function(n){var i=e,s=this,o=s.length!==void 0,l=o?s:[s];if(ve(n)){for(var u=n.split(/\s+/),f=u.length,h=0;h<f;h++){var c=u[h];if(!tr(c)){var v=!i.immutableKeys[c];if(v)for(var d=0,y=l.length;d<y;d++)l[d]._private[i.field][c]=void 0}}i.triggerEvent&&s[i.triggerFnName](i.event)}else if(n===void 0){for(var p=0,g=l.length;p<g;p++)for(var m=l[p]._private[i.field],E=Object.keys(m),D=0;D<E.length;D++){var b=E[D],x=!i.immutableKeys[b];x&&(m[b]=void 0)}i.triggerEvent&&s[i.triggerFnName](i.event)}return s}}},Ld={eventAliasesOn:function(e){var r=e;r.addListener=r.listen=r.bind=r.on,r.unlisten=r.unbind=r.off=r.removeListener,r.trigger=r.emit,r.pon=r.promiseOn=function(a,n){var i=this,s=Array.prototype.slice.call(arguments,0);return new $r(function(o,l){var u=function(v){i.off.apply(i,h),o(v)},f=s.concat([u]),h=f.concat([]);i.on.apply(i,f)})}}},Oe={};[mc,Sd,Ld].forEach(function(t){be(Oe,t)});var Ad={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop()},ja={classes:function(e){var r=this;if(e===void 0){var a=[];return r[0]._private.classes.forEach(function(d){return a.push(d)}),a}else Re(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new Ur(e),s=0;s<r.length;s++){for(var o=r[s],l=o._private,u=l.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c);if(!v){f=!0;break}}f||(f=u.size!==e.length),f&&(l.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),r},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var r=this[0];return r!=null&&r._private.classes.has(e)},toggleClass:function(e,r){Re(e)||(e=e.match(/\S+/g)||[]);for(var a=this,n=r===void 0,i=[],s=0,o=a.length;s<o;s++)for(var l=a[s],u=l._private.classes,f=!1,h=0;h<e.length;h++){var c=e[h],v=u.has(c),d=!1;r||n&&!v?(u.add(c),d=!0):(!r||n&&v)&&(u.delete(c),d=!0),!f&&d&&(i.push(l),f=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),a},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,r){var a=this;if(r==null)r=250;else if(r===0)return a;return a.addClass(e),setTimeout(function(){a.removeClass(e)},r),a}};ja.className=ja.classNames=ja.classes;var Te={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:_e,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Te.variable="(?:[\\w-.]|(?:\\\\"+Te.metaChar+"))+";Te.className="(?:[\\w-]|(?:\\\\"+Te.metaChar+"))+";Te.value=Te.string+"|"+Te.number;Te.id=Te.variable;(function(){var t,e,r;for(t=Te.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],Te.comparatorOp+="|@"+e;for(t=Te.comparatorOp.split("|"),r=0;r<t.length;r++)e=t[r],!(e.indexOf("!")>=0)&&e!=="="&&(Te.comparatorOp+="|\\!"+e)})();var Ie=function(){return{checks:[]}},se={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},ri=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(t,e){return zl(t.selector,e.selector)}),Od=function(){for(var t={},e,r=0;r<ri.length;r++)e=ri[r],t[e.selector]=e.matches;return t}(),Nd=function(e,r){return Od[e](r)},Id="("+ri.map(function(t){return t.selector}).join("|")+")",Dr=function(e){return e.replace(new RegExp("\\\\("+Te.metaChar+")","g"),function(r,a){return a})},Zt=function(e,r,a){e[e.length-1]=a},ai=[{name:"group",query:!0,regex:"("+Te.group+")",populate:function(e,r,a){var n=St(a,1),i=n[0];r.checks.push({type:se.GROUP,value:i==="*"?i:i+"s"})}},{name:"state",query:!0,regex:Id,populate:function(e,r,a){var n=St(a,1),i=n[0];r.checks.push({type:se.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+Te.id+")",populate:function(e,r,a){var n=St(a,1),i=n[0];r.checks.push({type:se.ID,value:Dr(i)})}},{name:"className",query:!0,regex:"\\.("+Te.className+")",populate:function(e,r,a){var n=St(a,1),i=n[0];r.checks.push({type:se.CLASS,value:Dr(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+Te.variable+")\\s*\\]",populate:function(e,r,a){var n=St(a,1),i=n[0];r.checks.push({type:se.DATA_EXIST,field:Dr(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+Te.variable+")\\s*("+Te.comparatorOp+")\\s*("+Te.value+")\\s*\\]",populate:function(e,r,a){var n=St(a,3),i=n[0],s=n[1],o=n[2],l=new RegExp("^"+Te.string+"$").exec(o)!=null;l?o=o.substring(1,o.length-1):o=parseFloat(o),r.checks.push({type:se.DATA_COMPARE,field:Dr(i),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+Te.boolOp+")\\s*("+Te.variable+")\\s*\\]",populate:function(e,r,a){var n=St(a,2),i=n[0],s=n[1];r.checks.push({type:se.DATA_BOOL,field:Dr(s),operator:i})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+Te.meta+")\\s*("+Te.comparatorOp+")\\s*("+Te.number+")\\s*\\]\\]",populate:function(e,r,a){var n=St(a,3),i=n[0],s=n[1],o=n[2];r.checks.push({type:se.META_COMPARE,field:Dr(i),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:Te.separator,populate:function(e,r){var a=e.currentSubject,n=e.edgeCount,i=e.compoundCount,s=e[e.length-1];a!=null&&(s.subject=a,e.currentSubject=null),s.edgeCount=n,s.compoundCount=i,e.edgeCount=0,e.compoundCount=0;var o=e[e.length++]=Ie();return o}},{name:"directedEdge",separator:!0,regex:Te.directedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Ie(),n=r,i=Ie();return a.checks.push({type:se.DIRECTED_EDGE,source:n,target:i}),Zt(e,r,a),e.edgeCount++,i}else{var s=Ie(),o=r,l=Ie();return s.checks.push({type:se.NODE_SOURCE,source:o,target:l}),Zt(e,r,s),e.edgeCount++,l}}},{name:"undirectedEdge",separator:!0,regex:Te.undirectedEdge,populate:function(e,r){if(e.currentSubject==null){var a=Ie(),n=r,i=Ie();return a.checks.push({type:se.UNDIRECTED_EDGE,nodes:[n,i]}),Zt(e,r,a),e.edgeCount++,i}else{var s=Ie(),o=r,l=Ie();return s.checks.push({type:se.NODE_NEIGHBOR,node:o,neighbor:l}),Zt(e,r,s),l}}},{name:"child",separator:!0,regex:Te.child,populate:function(e,r){if(e.currentSubject==null){var a=Ie(),n=Ie(),i=e[e.length-1];return a.checks.push({type:se.CHILD,parent:i,child:n}),Zt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Ie(),o=e[e.length-1],l=Ie(),u=Ie(),f=Ie(),h=Ie();return s.checks.push({type:se.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:se.TRUE}],h.checks.push({type:se.TRUE}),l.checks.push({type:se.PARENT,parent:h,child:f}),Zt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=Ie(),v=Ie(),d=[{type:se.PARENT,parent:c,child:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"descendant",separator:!0,regex:Te.descendant,populate:function(e,r){if(e.currentSubject==null){var a=Ie(),n=Ie(),i=e[e.length-1];return a.checks.push({type:se.DESCENDANT,ancestor:i,descendant:n}),Zt(e,r,a),e.compoundCount++,n}else if(e.currentSubject===r){var s=Ie(),o=e[e.length-1],l=Ie(),u=Ie(),f=Ie(),h=Ie();return s.checks.push({type:se.COMPOUND_SPLIT,left:o,right:l,subject:u}),u.checks=r.checks,r.checks=[{type:se.TRUE}],h.checks.push({type:se.TRUE}),l.checks.push({type:se.ANCESTOR,ancestor:h,descendant:f}),Zt(e,o,s),e.currentSubject=u,e.compoundCount++,f}else{var c=Ie(),v=Ie(),d=[{type:se.ANCESTOR,ancestor:c,descendant:v}];return c.checks=r.checks,r.checks=d,e.compoundCount++,v}}},{name:"subject",modifier:!0,regex:Te.subject,populate:function(e,r){if(e.currentSubject!=null&&e.currentSubject!==r)return Ne("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=r;var a=e[e.length-1],n=a.checks[0],i=n==null?null:n.type;i===se.DIRECTED_EDGE?n.type=se.NODE_TARGET:i===se.UNDIRECTED_EDGE&&(n.type=se.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];ai.forEach(function(t){return t.regexObj=new RegExp("^"+t.regex)});var Md=function(e){for(var r,a,n,i=0;i<ai.length;i++){var s=ai[i],o=s.name,l=e.match(s.regexObj);if(l!=null){a=l,r=s,n=o;var u=l[0];e=e.substring(u.length);break}}return{expr:r,match:a,name:n,remaining:e}},Rd=function(e){var r=e.match(/^\s+/);if(r){var a=r[0];e=e.substring(a.length)}return e},kd=function(e){var r=this,a=r.inputText=e,n=r[0]=Ie();for(r.length=1,a=Rd(a);;){var i=Md(a);if(i.expr==null)return Ne("The selector `"+e+"`is invalid"),!1;var s=i.match.slice(1),o=i.expr.populate(r,n,s);if(o===!1)return!1;if(o!=null&&(n=o),a=i.remaining,a.match(/^\s*$/))break}var l=r[r.length-1];r.currentSubject!=null&&(l.subject=r.currentSubject),l.edgeCount=r.edgeCount,l.compoundCount=r.compoundCount;for(var u=0;u<r.length;u++){var f=r[u];if(f.compoundCount>0&&f.edgeCount>0)return Ne("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(f.edgeCount>1)return Ne("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;f.edgeCount===1&&Ne("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},Pd=function(){if(this.toStringCache!=null)return this.toStringCache;for(var e=function(f){return f==null?"":f},r=function(f){return ve(f)?'"'+f+'"':e(f)},a=function(f){return" "+f+" "},n=function(f,h){var c=f.type,v=f.value;switch(c){case se.GROUP:{var d=e(v);return d.substring(0,d.length-1)}case se.DATA_COMPARE:{var y=f.field,p=f.operator;return"["+y+a(e(p))+r(v)+"]"}case se.DATA_BOOL:{var g=f.operator,m=f.field;return"["+e(g)+m+"]"}case se.DATA_EXIST:{var E=f.field;return"["+E+"]"}case se.META_COMPARE:{var D=f.operator,b=f.field;return"[["+b+a(e(D))+r(v)+"]]"}case se.STATE:return v;case se.ID:return"#"+v;case se.CLASS:return"."+v;case se.PARENT:case se.CHILD:return i(f.parent,h)+a(">")+i(f.child,h);case se.ANCESTOR:case se.DESCENDANT:return i(f.ancestor,h)+" "+i(f.descendant,h);case se.COMPOUND_SPLIT:{var x=i(f.left,h),w=i(f.subject,h),T=i(f.right,h);return x+(x.length>0?" ":"")+w+T}case se.TRUE:return""}},i=function(f,h){return f.checks.reduce(function(c,v,d){return c+(h===f&&d===0?"$":"")+n(v,h)},"")},s="",o=0;o<this.length;o++){var l=this[o];s+=i(l,l.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},Bd={parse:kd,toString:Pd},su=function(e,r,a){var n,i=ve(e),s=ne(e),o=ve(a),l,u,f=!1,h=!1,c=!1;switch(r.indexOf("!")>=0&&(r=r.replace("!",""),h=!0),r.indexOf("@")>=0&&(r=r.replace("@",""),f=!0),(i||o||f)&&(l=!i&&!s?"":""+e,u=""+a),f&&(e=l=l.toLowerCase(),a=u=u.toLowerCase()),r){case"*=":n=l.indexOf(u)>=0;break;case"$=":n=l.indexOf(u,l.length-u.length)>=0;break;case"^=":n=l.indexOf(u)===0;break;case"=":n=e===a;break;case">":c=!0,n=e>a;break;case">=":c=!0,n=e>=a;break;case"<":c=!0,n=e<a;break;case"<=":c=!0,n=e<=a;break;default:n=!1;break}return h&&(e!=null||!c)&&(n=!n),n},Fd=function(e,r){switch(r){case"?":return!!e;case"!":return!e;case"^":return e===void 0}},Gd=function(e){return e!==void 0},Ai=function(e,r){return e.data(r)},zd=function(e,r){return e[r]()},Ve=[],Be=function(e,r){return e.checks.every(function(a){return Ve[a.type](a,r)})};Ve[se.GROUP]=function(t,e){var r=t.value;return r==="*"||r===e.group()};Ve[se.STATE]=function(t,e){var r=t.value;return Nd(r,e)};Ve[se.ID]=function(t,e){var r=t.value;return e.id()===r};Ve[se.CLASS]=function(t,e){var r=t.value;return e.hasClass(r)};Ve[se.META_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return su(zd(e,r),a,n)};Ve[se.DATA_COMPARE]=function(t,e){var r=t.field,a=t.operator,n=t.value;return su(Ai(e,r),a,n)};Ve[se.DATA_BOOL]=function(t,e){var r=t.field,a=t.operator;return Fd(Ai(e,r),a)};Ve[se.DATA_EXIST]=function(t,e){var r=t.field;return t.operator,Gd(Ai(e,r))};Ve[se.UNDIRECTED_EDGE]=function(t,e){var r=t.nodes[0],a=t.nodes[1],n=e.source(),i=e.target();return Be(r,n)&&Be(a,i)||Be(a,n)&&Be(r,i)};Ve[se.NODE_NEIGHBOR]=function(t,e){return Be(t.node,e)&&e.neighborhood().some(function(r){return r.isNode()&&Be(t.neighbor,r)})};Ve[se.DIRECTED_EDGE]=function(t,e){return Be(t.source,e.source())&&Be(t.target,e.target())};Ve[se.NODE_SOURCE]=function(t,e){return Be(t.source,e)&&e.outgoers().some(function(r){return r.isNode()&&Be(t.target,r)})};Ve[se.NODE_TARGET]=function(t,e){return Be(t.target,e)&&e.incomers().some(function(r){return r.isNode()&&Be(t.source,r)})};Ve[se.CHILD]=function(t,e){return Be(t.child,e)&&Be(t.parent,e.parent())};Ve[se.PARENT]=function(t,e){return Be(t.parent,e)&&e.children().some(function(r){return Be(t.child,r)})};Ve[se.DESCENDANT]=function(t,e){return Be(t.descendant,e)&&e.ancestors().some(function(r){return Be(t.ancestor,r)})};Ve[se.ANCESTOR]=function(t,e){return Be(t.ancestor,e)&&e.descendants().some(function(r){return Be(t.descendant,r)})};Ve[se.COMPOUND_SPLIT]=function(t,e){return Be(t.subject,e)&&Be(t.left,e)&&Be(t.right,e)};Ve[se.TRUE]=function(){return!0};Ve[se.COLLECTION]=function(t,e){var r=t.value;return r.has(e)};Ve[se.FILTER]=function(t,e){var r=t.value;return r(e)};var Vd=function(e){var r=this;if(r.length===1&&r[0].checks.length===1&&r[0].checks[0].type===se.ID)return e.getElementById(r[0].checks[0].value).collection();var a=function(i){for(var s=0;s<r.length;s++){var o=r[s];if(Be(o,i))return!0}return!1};return r.text()==null&&(a=function(){return!0}),e.filter(a)},Ud=function(e){for(var r=this,a=0;a<r.length;a++){var n=r[a];if(Be(n,e))return!0}return!1},$d={matches:Ud,filter:Vd},ar=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,e==null||ve(e)&&e.match(/^\s*$/)||(pt(e)?this.addQuery({checks:[{type:se.COLLECTION,value:e.collection()}]}):Ge(e)?this.addQuery({checks:[{type:se.FILTER,value:e}]}):ve(e)?this.parse(e)||(this.invalid=!0):ze("A selector must be created from a string; found "))},nr=ar.prototype;[Bd,$d].forEach(function(t){return be(nr,t)});nr.text=function(){return this.inputText};nr.size=function(){return this.length};nr.eq=function(t){return this[t]};nr.sameText=function(t){return!this.invalid&&!t.invalid&&this.text()===t.text()};nr.addQuery=function(t){this[this.length++]=t};nr.selector=nr.toString;var jt={allAre:function(e){var r=new ar(e);return this.every(function(a){return r.matches(a)})},is:function(e){var r=new ar(e);return this.some(function(a){return r.matches(a)})},some:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(n)return!0}return!1},every:function(e,r){for(var a=0;a<this.length;a++){var n=r?e.apply(r,[this[a],a,this]):e(this[a],a,this);if(!n)return!1}return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var r=this.length,a=e.length;return r!==a?!1:r===1?this[0]===e[0]:this.every(function(n){return e.hasElementWithId(n.id())})},anySame:function(e){return e=this.cy().collection(e),this.some(function(r){return e.hasElementWithId(r.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var r=this.neighborhood();return e.every(function(a){return r.hasElementWithId(a.id())})},contains:function(e){e=this.cy().collection(e);var r=this;return e.every(function(a){return r.hasElementWithId(a.id())})}};jt.allAreNeighbours=jt.allAreNeighbors;jt.has=jt.contains;jt.equal=jt.equals=jt.same;var wt=function(e,r){return function(n,i,s,o){var l=n,u=this,f;if(l==null?f="":pt(l)&&l.length===1&&(f=l.id()),u.length===1&&f){var h=u[0]._private,c=h.traversalCache=h.traversalCache||{},v=c[r]=c[r]||[],d=pr(f),y=v[d];return y||(v[d]=e.call(u,n,i,s,o))}else return e.call(u,n,i,s,o)}},Vr={parent:function(e){var r=[];if(this.length===1){var a=this[0]._private.parent;if(a)return a}for(var n=0;n<this.length;n++){var i=this[n],s=i._private.parent;s&&r.push(s)}return this.spawn(r,!0).filter(e)},parents:function(e){for(var r=[],a=this.parent();a.nonempty();){for(var n=0;n<a.length;n++){var i=a[n];r.push(i)}a=a.parent()}return this.spawn(r,!0).filter(e)},commonAncestors:function(e){for(var r,a=0;a<this.length;a++){var n=this[a],i=n.parents();r=r||i,r=r.intersect(i)}return r.filter(e)},orphans:function(e){return this.stdFilter(function(r){return r.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(r){return r.isChild()}).filter(e)},children:wt(function(t){for(var e=[],r=0;r<this.length;r++)for(var a=this[r],n=a._private.children,i=0;i<n.length;i++)e.push(n[i]);return this.spawn(e,!0).filter(t)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length!==0},isChildless:function(){var e=this[0];if(e)return e.isNode()&&e._private.children.length===0},isChild:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent!=null},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&e._private.parent==null},descendants:function(e){var r=[];function a(n){for(var i=0;i<n.length;i++){var s=n[i];r.push(s),s.children().nonempty()&&a(s.children())}}return a(this.children()),this.spawn(r,!0).filter(e)}};function Oi(t,e,r,a){for(var n=[],i=new Ur,s=t.cy(),o=s.hasCompoundNodes(),l=0;l<t.length;l++){var u=t[l];r?n.push(u):o&&a(n,i,u)}for(;n.length>0;){var f=n.shift();e(f),i.add(f.id()),o&&a(n,i,f)}return t}function ou(t,e,r){if(r.isParent())for(var a=r._private.children,n=0;n<a.length;n++){var i=a[n];e.has(i.id())||t.push(i)}}Vr.forEachDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,ou)};function uu(t,e,r){if(r.isChild()){var a=r._private.parent;e.has(a.id())||t.push(a)}}Vr.forEachUp=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,uu)};function Yd(t,e,r){uu(t,e,r),ou(t,e,r)}Vr.forEachUpAndDown=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return Oi(this,t,e,Yd)};Vr.ancestors=Vr.parents;var Ea,lu;Ea=lu={data:Oe.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:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Oe.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Oe.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}};Ea.attr=Ea.data;Ea.removeAttr=Ea.removeData;var _d=lu,Ln={};function Hn(t){return function(e){var r=this;if(e===void 0&&(e=!0),r.length!==0)if(r.isNode()&&!r.removed()){for(var a=0,n=r[0],i=n._private.edges,s=0;s<i.length;s++){var o=i[s];!e&&o.isLoop()||(a+=t(n,o))}return a}else return}}be(Ln,{degree:Hn(function(t,e){return e.source().same(e.target())?2:1}),indegree:Hn(function(t,e){return e.target().same(t)?1:0}),outdegree:Hn(function(t,e){return e.source().same(t)?1:0})});function Sr(t,e){return function(r){for(var a,n=this.nodes(),i=0;i<n.length;i++){var s=n[i],o=s[t](r);o!==void 0&&(a===void 0||e(o,a))&&(a=o)}return a}}be(Ln,{minDegree:Sr("degree",function(t,e){return t<e}),maxDegree:Sr("degree",function(t,e){return t>e}),minIndegree:Sr("indegree",function(t,e){return t<e}),maxIndegree:Sr("indegree",function(t,e){return t>e}),minOutdegree:Sr("outdegree",function(t,e){return t<e}),maxOutdegree:Sr("outdegree",function(t,e){return t>e})});be(Ln,{totalDegree:function(e){for(var r=0,a=this.nodes(),n=0;n<a.length;n++)r+=a[n].degree(e);return r}});var Ot,fu,hu=function(e,r,a){for(var n=0;n<e.length;n++){var i=e[n];if(!i.locked()){var s=i._private.position,o={x:r.x!=null?r.x-s.x:0,y:r.y!=null?r.y-s.y:0};i.isParent()&&!(o.x===0&&o.y===0)&&i.children().shift(o,a),i.dirtyBoundingBoxCache()}}},ks={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(e){e.updateCompoundBounds()},beforeSet:function(e,r){hu(e,r,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};Ot=fu={position:Oe.data(ks),silentPosition:Oe.data(be({},ks,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,r){hu(e,r,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,r){if(Ce(e))r?this.silentPosition(e):this.position(e);else if(Ge(e)){var a=e,n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var s=this[i],o=void 0;(o=a(s,i))&&(r?s.silentPosition(o):s.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,r,a){var n;if(Ce(e)?(n={x:ne(e.x)?e.x:0,y:ne(e.y)?e.y:0},a=r):ve(e)&&ne(r)&&(n={x:0,y:0},n[e]=r),n!=null){var i=this.cy();i.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(i.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var l=o.position(),u={x:l.x+n.x,y:l.y+n.y};a?o.silentPosition(u):o.position(u)}}i.endBatch()}return this},silentShift:function(e,r){return Ce(e)?this.shift(e,!0):ve(e)&&ne(r)&&this.shift(e,r,!0),this},renderedPosition:function(e,r){var a=this[0],n=this.cy(),i=n.zoom(),s=n.pan(),o=Ce(e)?e:void 0,l=o!==void 0||r!==void 0&&ve(e);if(a&&a.isNode())if(l)for(var u=0;u<this.length;u++){var f=this[u];r!==void 0?f.position(e,(r-s[e])/i):o!==void 0&&f.position(Fo(o,i,s))}else{var h=a.position();return o=xn(h,i,s),e===void 0?o:o[e]}else if(!l)return;return this},relativePosition:function(e,r){var a=this[0],n=this.cy(),i=Ce(e)?e:void 0,s=i!==void 0||r!==void 0&&ve(e),o=n.hasCompoundNodes();if(a&&a.isNode())if(s)for(var l=0;l<this.length;l++){var u=this[l],f=o?u.parent():null,h=f&&f.length>0,c=h;h&&(f=f[0]);var v=c?f.position():{x:0,y:0};r!==void 0?u.position(e,r+v[e]):i!==void 0&&u.position({x:i.x+v.x,y:i.y+v.y})}else{var d=a.position(),y=o?a.parent():null,p=y&&y.length>0,g=p;p&&(y=y[0]);var m=g?y.position():{x:0,y:0};return i={x:d.x-m.x,y:d.y-m.y},e===void 0?i:i[e]}else if(!s)return;return this}};Ot.modelPosition=Ot.point=Ot.position;Ot.modelPositions=Ot.points=Ot.positions;Ot.renderedPoint=Ot.renderedPosition;Ot.relativePoint=Ot.relativePosition;var Hd=fu,Br,sr;Br=sr={};sr.renderedBoundingBox=function(t){var e=this.boundingBox(t),r=this.cy(),a=r.zoom(),n=r.pan(),i=e.x1*a+n.x,s=e.x2*a+n.x,o=e.y1*a+n.y,l=e.y2*a+n.y;return{x1:i,x2:s,y1:o,y2:l,w:s-i,h:l-o}};sr.dirtyCompoundBoundsCache=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();return!e.styleEnabled()||!e.hasCompoundNodes()?this:(this.forEachUp(function(r){if(r.isParent()){var a=r._private;a.compoundBoundsClean=!1,a.bbCache=null,t||r.emitAndNotify("bounds")}}),this)};sr.updateCompoundBounds=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=this.cy();if(!e.styleEnabled()||!e.hasCompoundNodes())return this;if(!t&&e.batching())return this;function r(s){if(!s.isParent())return;var o=s._private,l=s.children(),u=s.pstyle("compound-sizing-wrt-labels").value==="include",f={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},h=l.boundingBox({includeLabels:u,includeOverlays:!1,useCache:!1}),c=o.position;(h.w===0||h.h===0)&&(h={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},h.x1=c.x-h.w/2,h.x2=c.x+h.w/2,h.y1=c.y-h.h/2,h.y2=c.y+h.h/2);function v(C,S,A){var L=0,I=0,O=S+A;return C>0&&O>0&&(L=S/O*C,I=A/O*C),{biasDiff:L,biasComplementDiff:I}}function d(C,S,A,L){if(A.units==="%")switch(L){case"width":return C>0?A.pfValue*C:0;case"height":return S>0?A.pfValue*S:0;case"average":return C>0&&S>0?A.pfValue*(C+S)/2:0;case"min":return C>0&&S>0?C>S?A.pfValue*S:A.pfValue*C:0;case"max":return C>0&&S>0?C>S?A.pfValue*C:A.pfValue*S:0;default:return 0}else return A.units==="px"?A.pfValue:0}var y=f.width.left.value;f.width.left.units==="px"&&f.width.val>0&&(y=y*100/f.width.val);var p=f.width.right.value;f.width.right.units==="px"&&f.width.val>0&&(p=p*100/f.width.val);var g=f.height.top.value;f.height.top.units==="px"&&f.height.val>0&&(g=g*100/f.height.val);var m=f.height.bottom.value;f.height.bottom.units==="px"&&f.height.val>0&&(m=m*100/f.height.val);var E=v(f.width.val-h.w,y,p),D=E.biasDiff,b=E.biasComplementDiff,x=v(f.height.val-h.h,g,m),w=x.biasDiff,T=x.biasComplementDiff;o.autoPadding=d(h.w,h.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(h.w,f.width.val),c.x=(-D+h.x1+h.x2+b)/2,o.autoHeight=Math.max(h.h,f.height.val),c.y=(-w+h.y1+h.y2+T)/2}for(var a=0;a<this.length;a++){var n=this[a],i=n._private;(!i.compoundBoundsClean||t)&&(r(n),e.batching()||(i.compoundBoundsClean=!0))}return this};var Et=function(e){return e===1/0||e===-1/0?0:e},Lt=function(e,r,a,n,i){n-r===0||i-a===0||r==null||a==null||n==null||i==null||(e.x1=r<e.x1?r:e.x1,e.x2=n>e.x2?n:e.x2,e.y1=a<e.y1?a:e.y1,e.y2=i>e.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},hr=function(e,r){return r==null?e:Lt(e,r.x1,r.y1,r.x2,r.y2)},aa=function(e,r,a){return At(e,r,a)},Ha=function(e,r,a){if(!r.cy().headless()){var n=r._private,i=n.rstyle,s=i.arrowWidth/2,o=r.pstyle(a+"-arrow-shape").value,l,u;if(o!=="none"){a==="source"?(l=i.srcX,u=i.srcY):a==="target"?(l=i.tgtX,u=i.tgtY):(l=i.midX,u=i.midY);var f=n.arrowBounds=n.arrowBounds||{},h=f[a]=f[a]||{};h.x1=l-s,h.y1=u-s,h.x2=l+s,h.y2=u+s,h.w=h.x2-h.x1,h.h=h.y2-h.y1,Qa(h,1),Lt(e,h.x1,h.y1,h.x2,h.y2)}}},Xn=function(e,r,a){if(!r.cy().headless()){var n;a?n=a+"-":n="";var i=r._private,s=i.rstyle,o=r.pstyle(n+"label").strValue;if(o){var l=r.pstyle("text-halign"),u=r.pstyle("text-valign"),f=aa(s,"labelWidth",a),h=aa(s,"labelHeight",a),c=aa(s,"labelX",a),v=aa(s,"labelY",a),d=r.pstyle(n+"text-margin-x").pfValue,y=r.pstyle(n+"text-margin-y").pfValue,p=r.isEdge(),g=r.pstyle(n+"text-rotation"),m=r.pstyle("text-outline-width").pfValue,E=r.pstyle("text-border-width").pfValue,D=E/2,b=r.pstyle("text-background-padding").pfValue,x=2,w=h,T=f,C=T/2,S=w/2,A,L,I,O;if(p)A=c-C,L=c+C,I=v-S,O=v+S;else{switch(l.value){case"left":A=c-T,L=c;break;case"center":A=c-C,L=c+C;break;case"right":A=c,L=c+T;break}switch(u.value){case"top":I=v-w,O=v;break;case"center":I=v-S,O=v+S;break;case"bottom":I=v,O=v+w;break}}A+=d-Math.max(m,D)-b-x,L+=d+Math.max(m,D)+b+x,I+=y-Math.max(m,D)-b-x,O+=y+Math.max(m,D)+b+x;var k=a||"main",R=i.labelBounds,M=R[k]=R[k]||{};M.x1=A,M.y1=I,M.x2=L,M.y2=O,M.w=L-A,M.h=O-I;var P=p&&g.strValue==="autorotate",F=g.pfValue!=null&&g.pfValue!==0;if(P||F){var V=P?aa(i.rstyle,"labelAngle",a):g.pfValue,G=Math.cos(V),B=Math.sin(V),Y=(A+L)/2,Z=(I+O)/2;if(!p){switch(l.value){case"left":Y=L;break;case"right":Y=A;break}switch(u.value){case"top":Z=O;break;case"bottom":Z=I;break}}var K=function(me,te){return me=me-Y,te=te-Z,{x:me*G-te*B+Y,y:me*B+te*G+Z}},U=K(A,I),z=K(A,O),_=K(L,I),q=K(L,O);A=Math.min(U.x,z.x,_.x,q.x),L=Math.max(U.x,z.x,_.x,q.x),I=Math.min(U.y,z.y,_.y,q.y),O=Math.max(U.y,z.y,_.y,q.y)}var J=k+"Rot",ee=R[J]=R[J]||{};ee.x1=A,ee.y1=I,ee.x2=L,ee.y2=O,ee.w=L-A,ee.h=O-I,Lt(e,A,I,L,O),Lt(i.labelBounds.all,A,I,L,O)}return e}},Xd=function(e,r){if(!r.cy().headless()){var a=r.pstyle("outline-opacity").value,n=r.pstyle("outline-width").value;if(a>0&&n>0){var i=r.pstyle("outline-offset").value,s=r.pstyle("shape").value,o=n+i,l=(e.w+o*2)/e.w,u=(e.h+o*2)/e.h,f=0,h=0;["diamond","pentagon","round-triangle"].includes(s)?(l=(e.w+o*2.4)/e.w,h=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?l=(e.w+o*2.4)/e.w:s==="star"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.6)/e.h,h=-o/3.8):s==="triangle"?(l=(e.w+o*2.8)/e.w,u=(e.h+o*2.4)/e.h,h=-o/1.4):s==="vee"&&(l=(e.w+o*4.4)/e.w,u=(e.h+o*3.8)/e.h,h=-o*.5);var c=e.h*u-e.h,v=e.w*l-e.w;if(Ja(e,[Math.ceil(c/2),Math.ceil(v/2)]),f!=0||h!==0){var d=vh(e,f,h);zo(e,d)}}}},qd=function(e,r){var a=e._private.cy,n=a.styleEnabled(),i=a.headless(),s=gt(),o=e._private,l=e.isNode(),u=e.isEdge(),f,h,c,v,d,y,p=o.rstyle,g=l&&n?e.pstyle("bounds-expansion").pfValue:[0],m=function(ue){return ue.pstyle("display").value!=="none"},E=!n||m(e)&&(!u||m(e.source())&&m(e.target()));if(E){var D=0,b=0;n&&r.includeOverlays&&(D=e.pstyle("overlay-opacity").value,D!==0&&(b=e.pstyle("overlay-padding").value));var x=0,w=0;n&&r.includeUnderlays&&(x=e.pstyle("underlay-opacity").value,x!==0&&(w=e.pstyle("underlay-padding").value));var T=Math.max(b,w),C=0,S=0;if(n&&(C=e.pstyle("width").pfValue,S=C/2),l&&r.includeNodes){var A=e.position();d=A.x,y=A.y;var L=e.outerWidth(),I=L/2,O=e.outerHeight(),k=O/2;f=d-I,h=d+I,c=y-k,v=y+k,Lt(s,f,c,h,v),n&&r.includeOutlines&&Xd(s,e)}else if(u&&r.includeEdges)if(n&&!i){var R=e.pstyle("curve-style").strValue;if(f=Math.min(p.srcX,p.midX,p.tgtX),h=Math.max(p.srcX,p.midX,p.tgtX),c=Math.min(p.srcY,p.midY,p.tgtY),v=Math.max(p.srcY,p.midY,p.tgtY),f-=S,h+=S,c-=S,v+=S,Lt(s,f,c,h,v),R==="haystack"){var M=p.haystackPts;if(M&&M.length===2){if(f=M[0].x,c=M[0].y,h=M[1].x,v=M[1].y,f>h){var P=f;f=h,h=P}if(c>v){var F=c;c=v,v=F}Lt(s,f-S,c-S,h+S,v+S)}}else if(R==="bezier"||R==="unbundled-bezier"||R.endsWith("segments")||R.endsWith("taxi")){var V;switch(R){case"bezier":case"unbundled-bezier":V=p.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":V=p.linePts;break}if(V!=null)for(var G=0;G<V.length;G++){var B=V[G];f=B.x-S,h=B.x+S,c=B.y-S,v=B.y+S,Lt(s,f,c,h,v)}}}else{var Y=e.source(),Z=Y.position(),K=e.target(),U=K.position();if(f=Z.x,h=U.x,c=Z.y,v=U.y,f>h){var z=f;f=h,h=z}if(c>v){var _=c;c=v,v=_}f-=S,h+=S,c-=S,v+=S,Lt(s,f,c,h,v)}if(n&&r.includeEdges&&u&&(Ha(s,e,"mid-source"),Ha(s,e,"mid-target"),Ha(s,e,"source"),Ha(s,e,"target")),n){var q=e.pstyle("ghost").value==="yes";if(q){var J=e.pstyle("ghost-offset-x").pfValue,ee=e.pstyle("ghost-offset-y").pfValue;Lt(s,s.x1+J,s.y1+ee,s.x2+J,s.y2+ee)}}var oe=o.bodyBounds=o.bodyBounds||{};vs(oe,s),Ja(oe,g),Qa(oe,1),n&&(f=s.x1,h=s.x2,c=s.y1,v=s.y2,Lt(s,f-T,c-T,h+T,v+T));var me=o.overlayBounds=o.overlayBounds||{};vs(me,s),Ja(me,g),Qa(me,1);var te=o.labelBounds=o.labelBounds||{};te.all!=null?ch(te.all):te.all=gt(),n&&r.includeLabels&&(r.includeMainLabels&&Xn(s,e,null),u&&(r.includeSourceLabels&&Xn(s,e,"source"),r.includeTargetLabels&&Xn(s,e,"target")))}return s.x1=Et(s.x1),s.y1=Et(s.y1),s.x2=Et(s.x2),s.y2=Et(s.y2),s.w=Et(s.x2-s.x1),s.h=Et(s.y2-s.y1),s.w>0&&s.h>0&&E&&(Ja(s,g),Qa(s,1)),s},cu=function(e){var r=0,a=function(s){return(s?1:0)<<r++},n=0;return n+=a(e.incudeNodes),n+=a(e.includeEdges),n+=a(e.includeLabels),n+=a(e.includeMainLabels),n+=a(e.includeSourceLabels),n+=a(e.includeTargetLabels),n+=a(e.includeOverlays),n+=a(e.includeOutlines),n},vu=function(e){if(e.isEdge()){var r=e.source().position(),a=e.target().position(),n=function(s){return Math.round(s)};return Rf([n(r.x),n(r.y),n(a.x),n(a.y)])}else return 0},Ps=function(e,r){var a=e._private,n,i=e.isEdge(),s=r==null?Bs:cu(r),o=s===Bs,l=vu(e),u=a.bbCachePosKey===l,f=r.useCache&&u,h=function(y){return y._private.bbCache==null||y._private.styleDirty},c=!f||h(e)||i&&h(e.source())||h(e.target());if(c?(u||e.recalculateRenderedStyle(f),n=qd(e,wa),a.bbCache=n,a.bbCachePosKey=l):n=a.bbCache,!o){var v=e.isNode();n=gt(),(r.includeNodes&&v||r.includeEdges&&!v)&&(r.includeOverlays?hr(n,a.overlayBounds):hr(n,a.bodyBounds)),r.includeLabels&&(r.includeMainLabels&&(!i||r.includeSourceLabels&&r.includeTargetLabels)?hr(n,a.labelBounds.all):(r.includeMainLabels&&hr(n,a.labelBounds.mainRot),r.includeSourceLabels&&hr(n,a.labelBounds.sourceRot),r.includeTargetLabels&&hr(n,a.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},wa={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},Bs=cu(wa),Fs=tt(wa);sr.boundingBox=function(t){var e;if(this.length===1&&this[0]._private.bbCache!=null&&!this[0]._private.styleDirty&&(t===void 0||t.useCache===void 0||t.useCache===!0))t===void 0?t=wa:t=Fs(t),e=Ps(this[0],t);else{e=gt(),t=t||wa;var r=Fs(t),a=this,n=a.cy(),i=n.styleEnabled();if(i)for(var s=0;s<a.length;s++){var o=a[s],l=o._private,u=vu(o),f=l.bbCachePosKey===u,h=r.useCache&&f&&!l.styleDirty;o.recalculateRenderedStyle(h)}this.updateCompoundBounds(!t.useCache);for(var c=0;c<a.length;c++){var v=a[c];hr(e,Ps(v,r))}}return e.x1=Et(e.x1),e.y1=Et(e.y1),e.x2=Et(e.x2),e.y2=Et(e.y2),e.w=Et(e.x2-e.x1),e.h=Et(e.y2-e.y1),e};sr.dirtyBoundingBoxCache=function(){for(var t=0;t<this.length;t++){var e=this[t]._private;e.bbCache=null,e.bbCachePosKey=null,e.bodyBounds=null,e.overlayBounds=null,e.labelBounds.all=null,e.labelBounds.source=null,e.labelBounds.target=null,e.labelBounds.main=null,e.labelBounds.sourceRot=null,e.labelBounds.targetRot=null,e.labelBounds.mainRot=null,e.arrowBounds.source=null,e.arrowBounds.target=null,e.arrowBounds["mid-source"]=null,e.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this};sr.boundingBoxAt=function(t){var e=this.nodes(),r=this.cy(),a=r.hasCompoundNodes(),n=r.collection();if(a&&(n=e.filter(function(u){return u.isParent()}),e=e.not(n)),Ce(t)){var i=t;t=function(){return i}}var s=function(f,h){return f._private.bbAtOldPos=t(f,h)},o=function(f){return f._private.bbAtOldPos};r.startBatch(),e.forEach(s).silentPositions(t),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0));var l=hh(this.boundingBox({useCache:!1}));return e.silentPositions(o),a&&(n.dirtyCompoundBoundsCache(),n.dirtyBoundingBoxCache(),n.updateCompoundBounds(!0)),r.endBatch(),l};Br.boundingbox=Br.bb=Br.boundingBox;Br.renderedBoundingbox=Br.renderedBoundingBox;var Wd=sr,la,Aa;la=Aa={};var du=function(e){e.uppercaseName=ss(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=ss(e.outerName),la[e.name]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){if(a.isParent())return a.updateCompoundBounds(),n[e.autoName]||0;var o=a.pstyle(e.name);switch(o.strValue){case"label":return a.recalculateRenderedStyle(),n.rstyle[e.labelName]||0;default:return o.pfValue}}else return 1},la["outer"+e.uppercaseName]=function(){var a=this[0],n=a._private,i=n.cy,s=i._private.styleEnabled;if(a)if(s){var o=a[e.name](),l=a.pstyle("border-width").pfValue,u=2*a.padding();return o+l+u}else return 1},la["rendered"+e.uppercaseName]=function(){var a=this[0];if(a){var n=a[e.name]();return n*this.cy().zoom()}},la["rendered"+e.uppercaseOuterName]=function(){var a=this[0];if(a){var n=a[e.outerName]();return n*this.cy().zoom()}}};du({name:"width"});du({name:"height"});Aa.padding=function(){var t=this[0],e=t._private;return t.isParent()?(t.updateCompoundBounds(),e.autoPadding!==void 0?e.autoPadding:t.pstyle("padding").pfValue):t.pstyle("padding").pfValue};Aa.paddedHeight=function(){var t=this[0];return t.height()+2*t.padding()};Aa.paddedWidth=function(){var t=this[0];return t.width()+2*t.padding()};var Kd=Aa,Zd=function(e,r){if(e.isEdge())return r(e)},Qd=function(e,r){if(e.isEdge()){var a=e.cy();return xn(r(e),a.zoom(),a.pan())}},Jd=function(e,r){if(e.isEdge()){var a=e.cy(),n=a.pan(),i=a.zoom();return r(e).map(function(s){return xn(s,i,n)})}},jd=function(e){return e.renderer().getControlPoints(e)},eg=function(e){return e.renderer().getSegmentPoints(e)},tg=function(e){return e.renderer().getSourceEndpoint(e)},rg=function(e){return e.renderer().getTargetEndpoint(e)},ag=function(e){return e.renderer().getEdgeMidpoint(e)},Gs={controlPoints:{get:jd,mult:!0},segmentPoints:{get:eg,mult:!0},sourceEndpoint:{get:tg},targetEndpoint:{get:rg},midpoint:{get:ag}},ng=function(e){return"rendered"+e[0].toUpperCase()+e.substr(1)},ig=Object.keys(Gs).reduce(function(t,e){var r=Gs[e],a=ng(e);return t[e]=function(){return Zd(this,r.get)},r.mult?t[a]=function(){return Jd(this,r.get)}:t[a]=function(){return Qd(this,r.get)},t},{}),sg=be({},Hd,Wd,Kd,ig);var gu=function(e,r){this.recycle(e,r)};function na(){return!1}function Xa(){return!0}gu.prototype={instanceString:function(){return"event"},recycle:function(e,r){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=na,e!=null&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?Xa:na):e!=null&&e.type?r=e:this.type=e,r!=null&&(this.originalEvent=r.originalEvent,this.type=r.type!=null?r.type:this.type,this.cy=r.cy,this.target=r.target,this.position=r.position,this.renderedPosition=r.renderedPosition,this.namespace=r.namespace,this.layout=r.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var a=this.position,n=this.cy.zoom(),i=this.cy.pan();this.renderedPosition={x:a.x*n+i.x,y:a.y*n+i.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Xa;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Xa;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Xa,this.stopPropagation()},isDefaultPrevented:na,isPropagationStopped:na,isImmediatePropagationStopped:na};var pu=/^([^.]+)(\.(?:[^.]+))?$/,og=".*",yu={qualifierCompare:function(e,r){return e===r},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},zs=Object.keys(yu),ug={};function An(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ug,e=arguments.length>1?arguments[1]:void 0,r=0;r<zs.length;r++){var a=zs[r];this[a]=t[a]||yu[a]}this.context=e||this.context,this.listeners=[],this.emitting=0}var ir=An.prototype,mu=function(e,r,a,n,i,s,o){Ge(n)&&(i=n,n=null),o&&(s==null?s=o:s=be({},s,o));for(var l=Re(a)?a:a.split(/\s+/),u=0;u<l.length;u++){var f=l[u];if(!tr(f)){var h=f.match(pu);if(h){var c=h[1],v=h[2]?h[2]:null,d=r(e,f,c,v,n,i,s);if(d===!1)break}}}},Vs=function(e,r){return e.addEventFields(e.context,r),new gu(r.type,r)},lg=function(e,r,a){if(Al(a)){r(e,a);return}else if(Ce(a)){r(e,Vs(e,a));return}for(var n=Re(a)?a:a.split(/\s+/),i=0;i<n.length;i++){var s=n[i];if(!tr(s)){var o=s.match(pu);if(o){var l=o[1],u=o[2]?o[2]:null,f=Vs(e,{type:l,namespace:u,target:e.context});r(e,f)}}}};ir.on=ir.addListener=function(t,e,r,a,n){return mu(this,function(i,s,o,l,u,f,h){Ge(f)&&i.listeners.push({event:s,callback:f,type:o,namespace:l,qualifier:u,conf:h})},t,e,r,a,n),this};ir.one=function(t,e,r,a){return this.on(t,e,r,a,{one:!0})};ir.removeListener=ir.off=function(t,e,r,a){var n=this;this.emitting!==0&&(this.listeners=Gf(this.listeners));for(var i=this.listeners,s=function(u){var f=i[u];mu(n,function(h,c,v,d,y,p){if((f.type===v||t==="*")&&(!d&&f.namespace!==".*"||f.namespace===d)&&(!y||h.qualifierCompare(f.qualifier,y))&&(!p||f.callback===p))return i.splice(u,1),!1},t,e,r,a)},o=i.length-1;o>=0;o--)s(o);return this};ir.removeAllListeners=function(){return this.removeListener("*")};ir.emit=ir.trigger=function(t,e,r){var a=this.listeners,n=a.length;return this.emitting++,Re(e)||(e=[e]),lg(this,function(i,s){r!=null&&(a=[{event:s.event,type:s.type,namespace:s.namespace,callback:r}],n=a.length);for(var o=function(f){var h=a[f];if(h.type===s.type&&(!h.namespace||h.namespace===s.namespace||h.namespace===og)&&i.eventMatches(i.context,h,s)){var c=[s];e!=null&&Vf(c,e),i.beforeEmit(i.context,h,s),h.conf&&h.conf.one&&(i.listeners=i.listeners.filter(function(y){return y!==h}));var v=i.callbackContext(i.context,h,s),d=h.callback.apply(v,c);i.afterEmit(i.context,h,s),d===!1&&(s.stopPropagation(),s.preventDefault())}},l=0;l<n;l++)o(l);i.bubble(i.context)&&!s.isPropagationStopped()&&i.parent(i.context).emit(s,e)},t),this.emitting--,this};var fg={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Da(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e.cy(),r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e},beforeEmit:function(e,r){r.conf&&r.conf.once&&r.conf.onceCollection.removeListener(r.event,r.qualifier,r.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},qa=function(e){return ve(e)?new ar(e):e},bu={createEmitter:function(){for(var e=0;e<this.length;e++){var r=this[e],a=r._private;a.emitter||(a.emitter=new An(fg,r))}return this},emitter:function(){return this._private.emitter},on:function(e,r,a){for(var n=qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a)}return this},removeListener:function(e,r,a){for(var n=qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().removeListener(e,n,a)}return this},removeAllListeners:function(){for(var e=0;e<this.length;e++){var r=this[e];r.emitter().removeAllListeners()}return this},one:function(e,r,a){for(var n=qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().one(e,n,a)}return this},once:function(e,r,a){for(var n=qa(r),i=0;i<this.length;i++){var s=this[i];s.emitter().on(e,n,a,{once:!0,onceCollection:this})}},emit:function(e,r){for(var a=0;a<this.length;a++){var n=this[a];n.emitter().emit(e,r)}return this},emitAndNotify:function(e,r){if(this.length!==0)return this.cy().notify(e,this),this.emit(e,r),this}};Oe.eventAliasesOn(bu);var Eu={nodes:function(e){return this.filter(function(r){return r.isNode()}).filter(e)},edges:function(e){return this.filter(function(r){return r.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),r=this.spawn(),a=0;a<this.length;a++){var n=this[a];n.isNode()?e.push(n):r.push(n)}return{nodes:e,edges:r}},filter:function(e,r){if(e===void 0)return this;if(ve(e)||pt(e))return new ar(e).filter(this);if(Ge(e)){for(var a=this.spawn(),n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);o&&a.push(s)}return a}return this.spawn()},not:function(e){if(e){ve(e)&&(e=this.filter(e));for(var r=this.spawn(),a=0;a<this.length;a++){var n=this[a],i=e.has(n);i||r.push(n)}return r}else return this},absoluteComplement:function(){var e=this.cy();return e.mutableElements().not(this)},intersect:function(e){if(ve(e)){var r=e;return this.filter(r)}for(var a=this.spawn(),n=this,i=e,s=this.length<e.length,o=s?n:i,l=s?i:n,u=0;u<o.length;u++){var f=o[u];l.has(f)&&a.push(f)}return a},xor:function(e){var r=this._private.cy;ve(e)&&(e=r.$(e));var a=this.spawn(),n=this,i=e,s=function(l,u){for(var f=0;f<l.length;f++){var h=l[f],c=h._private.data.id,v=u.hasElementWithId(c);v||a.push(h)}};return s(n,i),s(i,n),a},diff:function(e){var r=this._private.cy;ve(e)&&(e=r.$(e));var a=this.spawn(),n=this.spawn(),i=this.spawn(),s=this,o=e,l=function(f,h,c){for(var v=0;v<f.length;v++){var d=f[v],y=d._private.data.id,p=h.hasElementWithId(y);p?i.merge(d):c.push(d)}};return l(s,o,a),l(o,s,n),{left:a,right:n,both:i}},add:function(e){var r=this._private.cy;if(!e)return this;if(ve(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=this.spawnSelf(),i=0;i<e.length;i++){var s=e[i],o=!this.has(s);o&&n.push(s)}return n},merge:function(e){var r=this._private,a=r.cy;if(!e)return this;if(e&&ve(e)){var n=e;e=a.mutableElements().filter(n)}for(var i=r.map,s=0;s<e.length;s++){var o=e[s],l=o._private.data.id,u=!i.has(l);if(u){var f=this.length++;this[f]=o,i.set(l,{ele:o,index:f})}}return this},unmergeAt:function(e){var r=this[e],a=r.id(),n=this._private,i=n.map;this[e]=void 0,i.delete(a);var s=e===this.length-1;if(this.length>1&&!s){var o=this.length-1,l=this[o],u=l._private.data.id;this[o]=void 0,this[e]=l,i.set(u,{ele:l,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var r=this._private,a=e._private.data.id,n=r.map,i=n.get(a);if(!i)return this;var s=i.index;return this.unmergeAt(s),this},unmerge:function(e){var r=this._private.cy;if(!e)return this;if(e&&ve(e)){var a=e;e=r.mutableElements().filter(a)}for(var n=0;n<e.length;n++)this.unmergeOne(e[n]);return this},unmergeBy:function(e){for(var r=this.length-1;r>=0;r--){var a=this[r];e(a)&&this.unmergeAt(r)}return this},map:function(e,r){for(var a=[],n=this,i=0;i<n.length;i++){var s=n[i],o=r?e.apply(r,[s,i,n]):e(s,i,n);a.push(o)}return a},reduce:function(e,r){for(var a=r,n=this,i=0;i<n.length;i++)a=e(a,n[i],i,n);return a},max:function(e,r){for(var a=-1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l>a&&(a=l,n=o)}return{value:a,ele:n}},min:function(e,r){for(var a=1/0,n,i=this,s=0;s<i.length;s++){var o=i[s],l=r?e.apply(r,[o,s,i]):e(o,s,i);l<a&&(a=l,n=o)}return{value:a,ele:n}}},Le=Eu;Le.u=Le["|"]=Le["+"]=Le.union=Le.or=Le.add;Le["\\"]=Le["!"]=Le["-"]=Le.difference=Le.relativeComplement=Le.subtract=Le.not;Le.n=Le["&"]=Le["."]=Le.and=Le.intersection=Le.intersect;Le["^"]=Le["(+)"]=Le["(-)"]=Le.symmetricDifference=Le.symdiff=Le.xor;Le.fnFilter=Le.filterFn=Le.stdFilter=Le.filter;Le.complement=Le.abscomp=Le.absoluteComplement;var hg={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var e=this[0];if(e)return e._private.group}},wu=function(e,r){var a=e.cy(),n=a.hasCompoundNodes();function i(f){var h=f.pstyle("z-compound-depth");return h.value==="auto"?n?f.zDepth():0:h.value==="bottom"?-1:h.value==="top"?mi:0}var s=i(e)-i(r);if(s!==0)return s;function o(f){var h=f.pstyle("z-index-compare");return h.value==="auto"&&f.isNode()?1:0}var l=o(e)-o(r);if(l!==0)return l;var u=e.pstyle("z-index").value-r.pstyle("z-index").value;return u!==0?u:e.poolIndex()-r.poolIndex()},vn={forEach:function(e,r){if(Ge(e))for(var a=this.length,n=0;n<a;n++){var i=this[n],s=r?e.apply(r,[i,n,this]):e(i,n,this);if(s===!1)break}return this},toArray:function(){for(var e=[],r=0;r<this.length;r++)e.push(this[r]);return e},slice:function(e,r){var a=[],n=this.length;r==null&&(r=n),e==null&&(e=0),e<0&&(e=n+e),r<0&&(r=n+r);for(var i=e;i>=0&&i<r&&i<n;i++)a.push(this[i]);return this.spawn(a)},size:function(){return this.length},eq:function(e){return this[e]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(e){if(!Ge(e))return this;var r=this.toArray().sort(e);return this.spawn(r)},sortByZIndex:function(){return this.sort(wu)},zDepth:function(){var e=this[0];if(e){var r=e._private,a=r.group;if(a==="nodes"){var n=r.data.parent?e.parents().size():0;return e.isParent()?n:mi-1}else{var i=r.source,s=r.target,o=i.zDepth(),l=s.zDepth();return Math.max(o,l,0)}}}};vn.each=vn.forEach;var cg=function(){var e="undefined",r=(typeof Symbol=="undefined"?"undefined":He(Symbol))!=e&&He(Symbol.iterator)!=e;r&&(vn[Symbol.iterator]=function(){var a=this,n={value:void 0,done:!1},i=0,s=this.length;return mo({next:function(){return i<s?n.value=a[i++]:(n.value=void 0,n.done=!0),n}},Symbol.iterator,function(){return this})})};cg();var vg=tt({nodeDimensionsIncludeLabels:!1}),en={layoutDimensions:function(e){e=vg(e);var r;if(!this.takesUpSpace())r={w:0,h:0};else if(e.nodeDimensionsIncludeLabels){var a=this.boundingBox();r={w:a.w,h:a.h}}else r={w:this.outerWidth(),h:this.outerHeight()};return(r.w===0||r.h===0)&&(r.w=r.h=1),r},layoutPositions:function(e,r,a){var n=this.nodes().filter(function(b){return!b.isParent()}),i=this.cy(),s=r.eles,o=function(x){return x.id()},l=va(a,o);e.emit({type:"layoutstart",layout:e}),e.animations=[];var u=function(x,w,T){var C={x:w.x1+w.w/2,y:w.y1+w.h/2},S={x:(T.x-C.x)*x,y:(T.y-C.y)*x};return{x:C.x+S.x,y:C.y+S.y}},f=r.spacingFactor&&r.spacingFactor!==1,h=function(){if(!f)return null;for(var x=gt(),w=0;w<n.length;w++){var T=n[w],C=l(T,w);dh(x,C.x,C.y)}return x},c=h(),v=va(function(b,x){var w=l(b,x);if(f){var T=Math.abs(r.spacingFactor);w=u(T,c,w)}return r.transform!=null&&(w=r.transform(b,w)),w},o);if(r.animate){for(var d=0;d<n.length;d++){var y=n[d],p=v(y,d),g=r.animateFilter==null||r.animateFilter(y,d);if(g){var m=y.animation({position:p,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(m)}else y.position(p)}if(r.fit){var E=i.animation({fit:{boundingBox:s.boundingBoxAt(v),padding:r.padding},duration:r.animationDuration,easing:r.animationEasing});e.animations.push(E)}else if(r.zoom!==void 0&&r.pan!==void 0){var D=i.animation({zoom:r.zoom,pan:r.pan,duration:r.animationDuration,easing:r.animationEasing});e.animations.push(D)}e.animations.forEach(function(b){return b.play()}),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),$r.all(e.animations.map(function(b){return b.promise()})).then(function(){e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e})})}else n.positions(v),r.fit&&i.fit(r.eles,r.padding),r.zoom!=null&&i.zoom(r.zoom),r.pan&&i.pan(r.pan),e.one("layoutready",r.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",r.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){var r=this.cy();return r.makeLayout(be({},e,{eles:this}))}};en.createLayout=en.makeLayout=en.layout;function xu(t,e,r){var a=r._private,n=a.styleCache=a.styleCache||[],i;return(i=n[t])!=null||(i=n[t]=e(r)),i}function On(t,e){return t=pr(t),function(a){return xu(t,e,a)}}function Nn(t,e){t=pr(t);var r=function(n){return e.call(n)};return function(){var n=this[0];if(n)return xu(t,r,n)}}var je={recalculateRenderedStyle:function(e){var r=this.cy(),a=r.renderer(),n=r.styleEnabled();return a&&n&&a.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e=this.cy(),r=function(i){return i._private.styleCache=null};if(e.hasCompoundNodes()){var a;a=this.spawnSelf().merge(this.descendants()).merge(this.parents()),a.merge(a.connectedEdges()),a.forEach(r)}else this.forEach(function(n){r(n),n.connectedEdges().forEach(r)});return this},updateStyle:function(e){var r=this._private.cy;if(!r.styleEnabled())return this;if(r.batching()){var a=r._private.batchStyleEles;return a.merge(this),this}var n=r.hasCompoundNodes(),i=this;e=!!(e||e===void 0),n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=i;return e?s.emitAndNotify("style"):s.emit("style"),i.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var r=0;r<this.length;r++){var a=this[r];a._private.styleDirty&&(a._private.styleDirty=!1,e.style().apply(a))}},parsedStyle:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,a=this[0],n=a.cy();if(n.styleEnabled()&&a){this.cleanStyle();var i=a._private.style[e];return i!=null?i:r?n.style().getDefaultProperty(e):null}},numericStyle:function(e){var r=this[0];if(r.cy().styleEnabled()&&r){var a=r.pstyle(e);return a.pfValue!==void 0?a.pfValue:a.value}},numericStyleUnits:function(e){var r=this[0];if(r.cy().styleEnabled()&&r)return r.pstyle(e).units},renderedStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=this[0];if(a)return r.style().getRenderedStyle(a,e)},style:function(e,r){var a=this.cy();if(!a.styleEnabled())return this;var n=!1,i=a.style();if(Ce(e)){var s=e;i.applyBypass(this,s,n),this.emitAndNotify("style")}else if(ve(e))if(r===void 0){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}else i.applyBypass(this,e,r,n),this.emitAndNotify("style");else if(e===void 0){var l=this[0];return l?i.getRawStyle(l):void 0}return this},removeStyle:function(e){var r=this.cy();if(!r.styleEnabled())return this;var a=!1,n=r.style(),i=this;if(e===void 0)for(var s=0;s<i.length;s++){var o=i[s];n.removeAllBypasses(o,a)}else{e=e.split(/\s+/);for(var l=0;l<i.length;l++){var u=i[l];n.removeBypasses(u,e,a)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var e=this.cy();if(!e.styleEnabled())return 1;var r=e.hasCompoundNodes(),a=this[0];if(a){var n=a._private,i=a.pstyle("opacity").value;if(!r)return i;var s=n.data.parent?a.parents():null;if(s)for(var o=0;o<s.length;o++){var l=s[o],u=l.pstyle("opacity").value;i=u*i}return i}},transparent:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0],a=r.cy().hasCompoundNodes();if(r)return a?r.effectiveOpacity()===0:r.pstyle("opacity").value===0},backgrounding:function(){var e=this.cy();if(!e.styleEnabled())return!1;var r=this[0];return!!r._private.backgrounding}};function qn(t,e){var r=t._private,a=r.data.parent?t.parents():null;if(a)for(var n=0;n<a.length;n++){var i=a[n];if(!e(i))return!1}return!0}function Ni(t){var e=t.ok,r=t.edgeOkViaNode||t.ok,a=t.parentOk||t.ok;return function(){var n=this.cy();if(!n.styleEnabled())return!0;var i=this[0],s=n.hasCompoundNodes();if(i){var o=i._private;if(!e(i))return!1;if(i.isNode())return!s||qn(i,a);var l=o.source,u=o.target;return r(l)&&(!s||qn(l,r))&&(l===u||r(u)&&(!s||qn(u,r)))}}}var Xr=On("eleTakesUpSpace",function(t){return t.pstyle("display").value==="element"&&t.width()!==0&&(t.isNode()?t.height()!==0:!0)});je.takesUpSpace=Nn("takesUpSpace",Ni({ok:Xr}));var dg=On("eleInteractive",function(t){return t.pstyle("events").value==="yes"&&t.pstyle("visibility").value==="visible"&&Xr(t)}),gg=On("parentInteractive",function(t){return t.pstyle("visibility").value==="visible"&&Xr(t)});je.interactive=Nn("interactive",Ni({ok:dg,parentOk:gg,edgeOkViaNode:Xr}));je.noninteractive=function(){var t=this[0];if(t)return!t.interactive()};var pg=On("eleVisible",function(t){return t.pstyle("visibility").value==="visible"&&t.pstyle("opacity").pfValue!==0&&Xr(t)}),yg=Xr;je.visible=Nn("visible",Ni({ok:pg,edgeOkViaNode:yg}));je.hidden=function(){var t=this[0];if(t)return!t.visible()};je.isBundledBezier=Nn("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1});je.bypass=je.css=je.style;je.renderedCss=je.renderedStyle;je.removeBypass=je.removeCss=je.removeStyle;je.pstyle=je.parsedStyle;var er={};function Us(t){return function(){var e=arguments,r=[];if(e.length===2){var a=e[0],n=e[1];this.on(t.event,a,n)}else if(e.length===1&&Ge(e[0])){var i=e[0];this.on(t.event,i)}else if(e.length===0||e.length===1&&Re(e[0])){for(var s=e.length===1?e[0]:null,o=0;o<this.length;o++){var l=this[o],u=!t.ableField||l._private[t.ableField],f=l._private[t.field]!=t.value;if(t.overrideAble){var h=t.overrideAble(l);if(h!==void 0&&(u=h,!h))return this}u&&(l._private[t.field]=t.value,f&&r.push(l))}var c=this.spawn(r);c.updateStyle(),c.emit(t.event),s&&c.emit(s)}return this}}function qr(t){er[t.field]=function(){var e=this[0];if(e){if(t.overrideField){var r=t.overrideField(e);if(r!==void 0)return r}return e._private[t.field]}},er[t.on]=Us({event:t.on,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!0}),er[t.off]=Us({event:t.off,field:t.field,ableField:t.ableField,overrideAble:t.overrideAble,value:!1})}qr({field:"locked",overrideField:function(e){return e.cy().autolock()?!0:void 0},on:"lock",off:"unlock"});qr({field:"grabbable",overrideField:function(e){return e.cy().autoungrabify()||e.pannable()?!1:void 0},on:"grabify",off:"ungrabify"});qr({field:"selected",ableField:"selectable",overrideAble:function(e){return e.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"});qr({field:"selectable",overrideField:function(e){return e.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"});er.deselect=er.unselect;er.grabbed=function(){var t=this[0];if(t)return t._private.grabbed};qr({field:"active",on:"activate",off:"unactivate"});qr({field:"pannable",on:"panify",off:"unpanify"});er.inactive=function(){var t=this[0];if(t)return!t._private.active};var it={},$s=function(e){return function(a){for(var n=this,i=[],s=0;s<n.length;s++){var o=n[s];if(o.isNode()){for(var l=!1,u=o.connectedEdges(),f=0;f<u.length;f++){var h=u[f],c=h.source(),v=h.target();if(e.noIncomingEdges&&v===o&&c!==o||e.noOutgoingEdges&&c===o&&v!==o){l=!0;break}}l||i.push(o)}}return this.spawn(i,!0).filter(a)}},Ys=function(e){return function(r){for(var a=this,n=[],i=0;i<a.length;i++){var s=a[i];if(s.isNode())for(var o=s.connectedEdges(),l=0;l<o.length;l++){var u=o[l],f=u.source(),h=u.target();e.outgoing&&f===s?(n.push(u),n.push(h)):e.incoming&&h===s&&(n.push(u),n.push(f))}}return this.spawn(n,!0).filter(r)}},_s=function(e){return function(r){for(var a=this,n=[],i={};;){var s=e.outgoing?a.outgoers():a.incomers();if(s.length===0)break;for(var o=!1,l=0;l<s.length;l++){var u=s[l],f=u.id();i[f]||(i[f]=!0,n.push(u),o=!0)}if(!o)break;a=s}return this.spawn(n,!0).filter(r)}};it.clearTraversalCache=function(){for(var t=0;t<this.length;t++)this[t]._private.traversalCache=null};be(it,{roots:$s({noIncomingEdges:!0}),leaves:$s({noOutgoingEdges:!0}),outgoers:wt(Ys({outgoing:!0}),"outgoers"),successors:_s({outgoing:!0}),incomers:wt(Ys({incoming:!0}),"incomers"),predecessors:_s({incoming:!0})});be(it,{neighborhood:wt(function(t){for(var e=[],r=this.nodes(),a=0;a<r.length;a++)for(var n=r[a],i=n.connectedEdges(),s=0;s<i.length;s++){var o=i[s],l=o.source(),u=o.target(),f=n===l?u:l;f.length>0&&e.push(f[0]),e.push(o[0])}return this.spawn(e,!0).filter(t)},"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}});it.neighbourhood=it.neighborhood;it.closedNeighbourhood=it.closedNeighborhood;it.openNeighbourhood=it.openNeighborhood;be(it,{source:wt(function(e){var r=this[0],a;return r&&(a=r._private.source||r.cy().collection()),a&&e?a.filter(e):a},"source"),target:wt(function(e){var r=this[0],a;return r&&(a=r._private.target||r.cy().collection()),a&&e?a.filter(e):a},"target"),sources:Hs({attr:"source"}),targets:Hs({attr:"target"})});function Hs(t){return function(r){for(var a=[],n=0;n<this.length;n++){var i=this[n],s=i._private[t.attr];s&&a.push(s)}return this.spawn(a,!0).filter(r)}}be(it,{edgesWith:wt(Xs(),"edgesWith"),edgesTo:wt(Xs({thisIsSrc:!0}),"edgesTo")});function Xs(t){return function(r){var a=[],n=this._private.cy,i=t||{};ve(r)&&(r=n.$(r));for(var s=0;s<r.length;s++)for(var o=r[s]._private.edges,l=0;l<o.length;l++){var u=o[l],f=u._private.data,h=this.hasElementWithId(f.source)&&r.hasElementWithId(f.target),c=r.hasElementWithId(f.source)&&this.hasElementWithId(f.target),v=h||c;v&&((i.thisIsSrc||i.thisIsTgt)&&(i.thisIsSrc&&!h||i.thisIsTgt&&!c)||a.push(u))}return this.spawn(a,!0)}}be(it,{connectedEdges:wt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];if(n.isNode())for(var i=n._private.edges,s=0;s<i.length;s++){var o=i[s];e.push(o)}}return this.spawn(e,!0).filter(t)},"connectedEdges"),connectedNodes:wt(function(t){for(var e=[],r=this,a=0;a<r.length;a++){var n=r[a];n.isEdge()&&(e.push(n.source()[0]),e.push(n.target()[0]))}return this.spawn(e,!0).filter(t)},"connectedNodes"),parallelEdges:wt(qs(),"parallelEdges"),codirectedEdges:wt(qs({codirected:!0}),"codirectedEdges")});function qs(t){var e={codirected:!1};return t=be({},e,t),function(a){for(var n=[],i=this.edges(),s=t,o=0;o<i.length;o++)for(var l=i[o],u=l._private,f=u.source,h=f._private.data.id,c=u.data.target,v=f._private.edges,d=0;d<v.length;d++){var y=v[d],p=y._private.data,g=p.target,m=p.source,E=g===c&&m===h,D=h===g&&c===m;(s.codirected&&E||!s.codirected&&(E||D))&&n.push(y)}return this.spawn(n,!0).filter(a)}}be(it,{components:function(e){var r=this,a=r.cy(),n=a.collection(),i=e==null?r.nodes():e.nodes(),s=[];e!=null&&i.empty()&&(i=e.sources());var o=function(f,h){n.merge(f),i.unmerge(f),h.merge(f)};if(i.empty())return r.spawn();var l=function(){var f=a.collection();s.push(f);var h=i[0];o(h,f),r.bfs({directed:!1,roots:h,visit:function(v){return o(v,f)}}),f.forEach(function(c){c.connectedEdges().forEach(function(v){r.has(v)&&f.has(v.source())&&f.has(v.target())&&f.merge(v)})})};do l();while(i.length>0);return s},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}});it.componentsOf=it.components;var et=function(e,r){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e===void 0){ze("A collection must have a reference to the core");return}var i=new Bt,s=!1;if(!r)r=[];else if(r.length>0&&Ce(r[0])&&!Da(r[0])){s=!0;for(var o=[],l=new Ur,u=0,f=r.length;u<f;u++){var h=r[u];h.data==null&&(h.data={});var c=h.data;if(c.id==null)c.id=Po();else if(e.hasElementWithId(c.id)||l.has(c.id))continue;var v=new wn(e,h,!1);o.push(v),l.add(c.id)}r=o}this.length=0;for(var d=0,y=r.length;d<y;d++){var p=r[d][0];if(p!=null){var g=p._private.data.id;(!a||!i.has(g))&&(a&&i.set(g,{index:this.length,ele:p}),this[this.length]=p,this.length++)}}this._private={eles:this,cy:e,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var E=this.lazyMap=new Bt,D=this.eles,b=0;b<D.length;b++){var x=D[b];E.set(x.id(),{index:b,ele:x})}}},a&&(this._private.map=i),s&&!n&&this.restore()},Pe=wn.prototype=et.prototype=Object.create(Array.prototype);Pe.instanceString=function(){return"collection"};Pe.spawn=function(t,e){return new et(this.cy(),t,e)};Pe.spawnSelf=function(){return this.spawn(this)};Pe.cy=function(){return this._private.cy};Pe.renderer=function(){return this._private.cy.renderer()};Pe.element=function(){return this[0]};Pe.collection=function(){return wo(this)?this:new et(this._private.cy,[this])};Pe.unique=function(){return new et(this._private.cy,this,!0)};Pe.hasElementWithId=function(t){return t=""+t,this._private.map.has(t)};Pe.getElementById=function(t){t=""+t;var e=this._private.cy,r=this._private.map.get(t);return r?r.ele:new et(e)};Pe.$id=Pe.getElementById;Pe.poolIndex=function(){var t=this._private.cy,e=t._private.elements,r=this[0]._private.data.id;return e._private.map.get(r).index};Pe.indexOf=function(t){var e=t[0]._private.data.id;return this._private.map.get(e).index};Pe.indexOfId=function(t){return t=""+t,this._private.map.get(t).index};Pe.json=function(t){var e=this.element(),r=this.cy();if(e==null&&t)return this;if(e!=null){var a=e._private;if(Ce(t)){if(r.startBatch(),t.data){e.data(t.data);var n=a.data;if(e.isEdge()){var i=!1,s={},o=t.data.source,l=t.data.target;o!=null&&o!=n.source&&(s.source=""+o,i=!0),l!=null&&l!=n.target&&(s.target=""+l,i=!0),i&&(e=e.move(s))}else{var u="parent"in t.data,f=t.data.parent;u&&(f!=null||n.parent!=null)&&f!=n.parent&&(f===void 0&&(f=null),f!=null&&(f=""+f),e=e.move({parent:f}))}}t.position&&e.position(t.position);var h=function(y,p,g){var m=t[y];m!=null&&m!==a[y]&&(m?e[p]():e[g]())};return h("removed","remove","restore"),h("selected","select","unselect"),h("selectable","selectify","unselectify"),h("locked","lock","unlock"),h("grabbable","grabify","ungrabify"),h("pannable","panify","unpanify"),t.classes!=null&&e.classes(t.classes),r.endBatch(),this}else if(t===void 0){var c={data:Pt(a.data),position:Pt(a.position),group:a.group,removed:a.removed,selected:a.selected,selectable:a.selectable,locked:a.locked,grabbable:a.grabbable,pannable:a.pannable,classes:null};c.classes="";var v=0;return a.classes.forEach(function(d){return c.classes+=v++===0?d:" "+d}),c}}};Pe.jsons=function(){for(var t=[],e=0;e<this.length;e++){var r=this[e],a=r.json();t.push(a)}return t};Pe.clone=function(){for(var t=this.cy(),e=[],r=0;r<this.length;r++){var a=this[r],n=a.json(),i=new wn(t,n,!1);e.push(i)}return new et(t,e)};Pe.copy=Pe.clone;Pe.restore=function(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=r.cy(),n=a._private,i=[],s=[],o,l=0,u=r.length;l<u;l++){var f=r[l];e&&!f.removed()||(f.isNode()?i.push(f):s.push(f))}o=i.concat(s);var h,c=function(){o.splice(h,1),h--};for(h=0;h<o.length;h++){var v=o[h],d=v._private,y=d.data;if(v.clearTraversalCache(),!(!e&&!d.removed)){if(y.id===void 0)y.id=Po();else if(ne(y.id))y.id=""+y.id;else if(tr(y.id)||!ve(y.id)){ze("Can not create element with invalid string ID `"+y.id+"`"),c();continue}else if(a.hasElementWithId(y.id)){ze("Can not create second element with ID `"+y.id+"`"),c();continue}}var p=y.id;if(v.isNode()){var g=d.position;g.x==null&&(g.x=0),g.y==null&&(g.y=0)}if(v.isEdge()){for(var m=v,E=["source","target"],D=E.length,b=!1,x=0;x<D;x++){var w=E[x],T=y[w];ne(T)&&(T=y[w]=""+y[w]),T==null||T===""?(ze("Can not create edge `"+p+"` with unspecified "+w),b=!0):a.hasElementWithId(T)||(ze("Can not create edge `"+p+"` with nonexistant "+w+" `"+T+"`"),b=!0)}if(b){c();continue}var C=a.getElementById(y.source),S=a.getElementById(y.target);C.same(S)?C._private.edges.push(m):(C._private.edges.push(m),S._private.edges.push(m)),m._private.source=C,m._private.target=S}d.map=new Bt,d.map.set(p,{ele:v,index:0}),d.removed=!1,e&&a.addToPool(v)}for(var A=0;A<i.length;A++){var L=i[A],I=L._private.data;ne(I.parent)&&(I.parent=""+I.parent);var O=I.parent,k=O!=null;if(k||L._private.parent){var R=L._private.parent?a.collection().merge(L._private.parent):a.getElementById(O);if(R.empty())I.parent=void 0;else if(R[0].removed())Ne("Node added with missing parent, reference to parent removed"),I.parent=void 0,L._private.parent=null;else{for(var M=!1,P=R;!P.empty();){if(L.same(P)){M=!0,I.parent=void 0;break}P=P.parent()}M||(R[0]._private.children.push(L),L._private.parent=R[0],n.hasCompoundNodes=!0)}}}if(o.length>0){for(var F=o.length===r.length?r:new et(a,o),V=0;V<F.length;V++){var G=F[V];G.isNode()||(G.parallelEdges().clearTraversalCache(),G.source().clearTraversalCache(),G.target().clearTraversalCache())}var B;n.hasCompoundNodes?B=a.collection().merge(F).merge(F.connectedNodes()).merge(F.parent()):B=F,B.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(t),t?F.emitAndNotify("add"):e&&F.emit("add")}return r};Pe.removed=function(){var t=this[0];return t&&t._private.removed};Pe.inside=function(){var t=this[0];return t&&!t._private.removed};Pe.remove=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this,a=[],n={},i=r._private.cy;function s(O){for(var k=O._private.edges,R=0;R<k.length;R++)l(k[R])}function o(O){for(var k=O._private.children,R=0;R<k.length;R++)l(k[R])}function l(O){var k=n[O.id()];e&&O.removed()||k||(n[O.id()]=!0,O.isNode()?(a.push(O),s(O),o(O)):a.unshift(O))}for(var u=0,f=r.length;u<f;u++){var h=r[u];l(h)}function c(O,k){var R=O._private.edges;rr(R,k),O.clearTraversalCache()}function v(O){O.clearTraversalCache()}var d=[];d.ids={};function y(O,k){k=k[0],O=O[0];var R=O._private.children,M=O.id();rr(R,k),k._private.parent=null,d.ids[M]||(d.ids[M]=!0,d.push(O))}r.dirtyCompoundBoundsCache(),e&&i.removeFromPool(a);for(var p=0;p<a.length;p++){var g=a[p];if(g.isEdge()){var m=g.source()[0],E=g.target()[0];c(m,g),c(E,g);for(var D=g.parallelEdges(),b=0;b<D.length;b++){var x=D[b];v(x),x.isBundledBezier()&&x.dirtyBoundingBoxCache()}}else{var w=g.parent();w.length!==0&&y(w,g)}e&&(g._private.removed=!0)}var T=i._private.elements;i._private.hasCompoundNodes=!1;for(var C=0;C<T.length;C++){var S=T[C];if(S.isParent()){i._private.hasCompoundNodes=!0;break}}var A=new et(this.cy(),a);A.size()>0&&(t?A.emitAndNotify("remove"):e&&A.emit("remove"));for(var L=0;L<d.length;L++){var I=d[L];(!e||!I.removed())&&I.updateStyle()}return A};Pe.move=function(t){var e=this._private.cy,r=this,a=!1,n=!1,i=function(d){return d==null?d:""+d};if(t.source!==void 0||t.target!==void 0){var s=i(t.source),o=i(t.target),l=s!=null&&e.hasElementWithId(s),u=o!=null&&e.hasElementWithId(o);(l||u)&&(e.batch(function(){r.remove(a,n),r.emitAndNotify("moveout");for(var v=0;v<r.length;v++){var d=r[v],y=d._private.data;d.isEdge()&&(l&&(y.source=s),u&&(y.target=o))}r.restore(a,n)}),r.emitAndNotify("move"))}else if(t.parent!==void 0){var f=i(t.parent),h=f===null||e.hasElementWithId(f);if(h){var c=f===null?void 0:f;e.batch(function(){var v=r.remove(a,n);v.emitAndNotify("moveout");for(var d=0;d<r.length;d++){var y=r[d],p=y._private.data;y.isNode()&&(p.parent=c)}v.restore(a,n)}),r.emitAndNotify("move")}}return this};[Wo,Ad,ja,jt,Vr,_d,Ln,sg,bu,Eu,hg,vn,en,je,er,it].forEach(function(t){be(Pe,t)});var mg={add:function(e){var r,a=this;if(pt(e)){var n=e;if(n._private.cy===a)r=n.restore();else{for(var i=[],s=0;s<n.length;s++){var o=n[s];i.push(o.json())}r=new et(a,i)}}else if(Re(e)){var l=e;r=new et(a,l)}else if(Ce(e)&&(Re(e.nodes)||Re(e.edges))){for(var u=e,f=[],h=["nodes","edges"],c=0,v=h.length;c<v;c++){var d=h[c],y=u[d];if(Re(y))for(var p=0,g=y.length;p<g;p++){var m=be({group:d},y[p]);f.push(m)}}r=new et(a,f)}else{var E=e;r=new wn(a,E).collection()}return r},remove:function(e){if(!pt(e)){if(ve(e)){var r=e;e=this.$(r)}}return e.remove()}};function bg(t,e,r,a){var n=4,i=.001,s=1e-7,o=10,l=11,u=1/(l-1),f=typeof Float32Array!="undefined";if(arguments.length!==4)return!1;for(var h=0;h<4;++h)if(typeof arguments[h]!="number"||isNaN(arguments[h])||!isFinite(arguments[h]))return!1;t=Math.min(t,1),r=Math.min(r,1),t=Math.max(t,0),r=Math.max(r,0);var c=f?new Float32Array(l):new Array(l);function v(S,A){return 1-3*A+3*S}function d(S,A){return 3*A-6*S}function y(S){return 3*S}function p(S,A,L){return((v(A,L)*S+d(A,L))*S+y(A))*S}function g(S,A,L){return 3*v(A,L)*S*S+2*d(A,L)*S+y(A)}function m(S,A){for(var L=0;L<n;++L){var I=g(A,t,r);if(I===0)return A;var O=p(A,t,r)-S;A-=O/I}return A}function E(){for(var S=0;S<l;++S)c[S]=p(S*u,t,r)}function D(S,A,L){var I,O,k=0;do O=A+(L-A)/2,I=p(O,t,r)-S,I>0?L=O:A=O;while(Math.abs(I)>s&&++k<o);return O}function b(S){for(var A=0,L=1,I=l-1;L!==I&&c[L]<=S;++L)A+=u;--L;var O=(S-c[L])/(c[L+1]-c[L]),k=A+O*u,R=g(k,t,r);return R>=i?m(S,k):R===0?k:D(S,A,A+u)}var x=!1;function w(){x=!0,(t!==e||r!==a)&&E()}var T=function(A){return x||w(),t===e&&r===a?A:A===0?0:A===1?1:p(b(A),e,a)};T.getControlPoints=function(){return[{x:t,y:e},{x:r,y:a}]};var C="generateBezier("+[t,e,r,a]+")";return T.toString=function(){return C},T}var Eg=function(){function t(a){return-a.tension*a.x-a.friction*a.v}function e(a,n,i){var s={x:a.x+i.dx*n,v:a.v+i.dv*n,tension:a.tension,friction:a.friction};return{dx:s.v,dv:t(s)}}function r(a,n){var i={dx:a.v,dv:t(a)},s=e(a,n*.5,i),o=e(a,n*.5,s),l=e(a,n,o),u=1/6*(i.dx+2*(s.dx+o.dx)+l.dx),f=1/6*(i.dv+2*(s.dv+o.dv)+l.dv);return a.x=a.x+u*n,a.v=a.v+f*n,a}return function a(n,i,s){var o={x:-1,v:0,tension:null,friction:null},l=[0],u=0,f=1/1e4,h=16/1e3,c,v,d;for(n=parseFloat(n)||500,i=parseFloat(i)||20,s=s||null,o.tension=n,o.friction=i,c=s!==null,c?(u=a(n,i),v=u/s*h):v=h;d=r(d||o,v),l.push(1+d.x),u+=16,Math.abs(d.x)>f&&Math.abs(d.v)>f;);return c?function(y){return l[y*(l.length-1)|0]}:u}}(),ke=function(e,r,a,n){var i=bg(e,r,a,n);return function(s,o,l){return s+(o-s)*i(l)}},tn={linear:function(e,r,a){return e+(r-e)*a},ease:ke(.25,.1,.25,1),"ease-in":ke(.42,0,1,1),"ease-out":ke(0,0,.58,1),"ease-in-out":ke(.42,0,.58,1),"ease-in-sine":ke(.47,0,.745,.715),"ease-out-sine":ke(.39,.575,.565,1),"ease-in-out-sine":ke(.445,.05,.55,.95),"ease-in-quad":ke(.55,.085,.68,.53),"ease-out-quad":ke(.25,.46,.45,.94),"ease-in-out-quad":ke(.455,.03,.515,.955),"ease-in-cubic":ke(.55,.055,.675,.19),"ease-out-cubic":ke(.215,.61,.355,1),"ease-in-out-cubic":ke(.645,.045,.355,1),"ease-in-quart":ke(.895,.03,.685,.22),"ease-out-quart":ke(.165,.84,.44,1),"ease-in-out-quart":ke(.77,0,.175,1),"ease-in-quint":ke(.755,.05,.855,.06),"ease-out-quint":ke(.23,1,.32,1),"ease-in-out-quint":ke(.86,0,.07,1),"ease-in-expo":ke(.95,.05,.795,.035),"ease-out-expo":ke(.19,1,.22,1),"ease-in-out-expo":ke(1,0,0,1),"ease-in-circ":ke(.6,.04,.98,.335),"ease-out-circ":ke(.075,.82,.165,1),"ease-in-out-circ":ke(.785,.135,.15,.86),spring:function(e,r,a){if(a===0)return tn.linear;var n=Eg(e,r,a);return function(i,s,o){return i+(s-i)*n(o)}},"cubic-bezier":ke};function Ws(t,e,r,a,n){if(a===1||e===r)return r;var i=n(e,r,a);return t==null||((t.roundValue||t.color)&&(i=Math.round(i)),t.min!==void 0&&(i=Math.max(i,t.min)),t.max!==void 0&&(i=Math.min(i,t.max))),i}function Ks(t,e){return t.pfValue!=null||t.value!=null?t.pfValue!=null&&(e==null||e.type.units!=="%")?t.pfValue:t.value:t}function Lr(t,e,r,a,n){var i=n!=null?n.type:null;r<0?r=0:r>1&&(r=1);var s=Ks(t,n),o=Ks(e,n);if(ne(s)&&ne(o))return Ws(i,s,o,r,a);if(Re(s)&&Re(o)){for(var l=[],u=0;u<o.length;u++){var f=s[u],h=o[u];if(f!=null&&h!=null){var c=Ws(i,f,h,r,a);l.push(c)}else l.push(h)}return l}}function wg(t,e,r,a){var n=!a,i=t._private,s=e._private,o=s.easing,l=s.startTime,u=a?t:t.cy(),f=u.style();if(!s.easingImpl)if(o==null)s.easingImpl=tn.linear;else{var h;if(ve(o)){var c=f.parse("transition-timing-function",o);h=c.value}else h=o;var v,d;ve(h)?(v=h,d=[]):(v=h[1],d=h.slice(2).map(function(F){return+F})),d.length>0?(v==="spring"&&d.push(s.duration),s.easingImpl=tn[v].apply(null,d)):s.easingImpl=tn[v]}var y=s.easingImpl,p;if(s.duration===0?p=1:p=(r-l)/s.duration,s.applying&&(p=s.progress),p<0?p=0:p>1&&(p=1),s.delay==null){var g=s.startPosition,m=s.position;if(m&&n&&!t.locked()){var E={};ia(g.x,m.x)&&(E.x=Lr(g.x,m.x,p,y)),ia(g.y,m.y)&&(E.y=Lr(g.y,m.y,p,y)),t.position(E)}var D=s.startPan,b=s.pan,x=i.pan,w=b!=null&&a;w&&(ia(D.x,b.x)&&(x.x=Lr(D.x,b.x,p,y)),ia(D.y,b.y)&&(x.y=Lr(D.y,b.y,p,y)),t.emit("pan"));var T=s.startZoom,C=s.zoom,S=C!=null&&a;S&&(ia(T,C)&&(i.zoom=ya(i.minZoom,Lr(T,C,p,y),i.maxZoom)),t.emit("zoom")),(w||S)&&t.emit("viewport");var A=s.style;if(A&&A.length>0&&n){for(var L=0;L<A.length;L++){var I=A[L],O=I.name,k=I,R=s.startStyle[O],M=f.properties[R.name],P=Lr(R,k,p,y,M);f.overrideBypass(t,O,P)}t.emit("style")}}return s.progress=p,p}function ia(t,e){return t==null||e==null?!1:ne(t)&&ne(e)?!0:!!(t&&e)}function xg(t,e,r,a){var n=e._private;n.started=!0,n.startTime=r-n.progress*n.duration}function Zs(t,e){var r=e._private.aniEles,a=[];function n(f,h){var c=f._private,v=c.animation.current,d=c.animation.queue,y=!1;if(v.length===0){var p=d.shift();p&&v.push(p)}for(var g=function(x){for(var w=x.length-1;w>=0;w--){var T=x[w];T()}x.splice(0,x.length)},m=v.length-1;m>=0;m--){var E=v[m],D=E._private;if(D.stopped){v.splice(m,1),D.hooked=!1,D.playing=!1,D.started=!1,g(D.frames);continue}!D.playing&&!D.applying||(D.playing&&D.applying&&(D.applying=!1),D.started||xg(f,E,t),wg(f,E,t,h),D.applying&&(D.applying=!1),g(D.frames),D.step!=null&&D.step(t),E.completed()&&(v.splice(m,1),D.hooked=!1,D.playing=!1,D.started=!1,g(D.completes)),y=!0)}return!h&&v.length===0&&d.length===0&&a.push(f),y}for(var i=!1,s=0;s<r.length;s++){var o=r[s],l=n(o);i=i||l}var u=n(e,!0);(i||u)&&(r.length>0?e.notify("draw",r):e.notify("draw")),r.unmerge(a),e.emit("step")}var Tg={animate:Oe.animate(),animation:Oe.animation(),animated:Oe.animated(),clearQueue:Oe.clearQueue(),delay:Oe.delay(),delayAnimation:Oe.delayAnimation(),stop:Oe.stop(),addToAnimationPool:function(e){var r=this;r.styleEnabled()&&r._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,!e.styleEnabled())return;function r(){e._private.animationsRunning&&un(function(i){Zs(i,e),r()})}var a=e.renderer();a&&a.beforeRender?a.beforeRender(function(i,s){Zs(s,e)},a.beforeRenderPriorities.animations):r()}},Cg={qualifierCompare:function(e,r){return e==null||r==null?e==null&&r==null:e.sameText(r)},eventMatches:function(e,r,a){var n=r.qualifier;return n!=null?e!==a.target&&Da(a.target)&&n.matches(a.target):!0},addEventFields:function(e,r){r.cy=e,r.target=e},callbackContext:function(e,r,a){return r.qualifier!=null?a.target:e}},Wa=function(e){return ve(e)?new ar(e):e},Tu={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new An(Cg,this)),this},emitter:function(){return this._private.emitter},on:function(e,r,a){return this.emitter().on(e,Wa(r),a),this},removeListener:function(e,r,a){return this.emitter().removeListener(e,Wa(r),a),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,r,a){return this.emitter().one(e,Wa(r),a),this},once:function(e,r,a){return this.emitter().one(e,Wa(r),a),this},emit:function(e,r){return this.emitter().emit(e,r),this},emitAndNotify:function(e,r){return this.emit(e),this.notify(e,r),this}};Oe.eventAliasesOn(Tu);var ni={png:function(e){var r=this._private.renderer;return e=e||{},r.png(e)},jpg:function(e){var r=this._private.renderer;return e=e||{},e.bg=e.bg||"#fff",r.jpg(e)}};ni.jpeg=ni.jpg;var rn={layout:function(e){var r=this;if(e==null){ze("Layout options must be specified to make a layout");return}if(e.name==null){ze("A `name` must be specified to make a layout");return}var a=e.name,n=r.extension("layout",a);if(n==null){ze("No such layout `"+a+"` found. Did you forget to import it and `cytoscape.use()` it?");return}var i;ve(e.eles)?i=r.$(e.eles):i=e.eles!=null?e.eles:r.$();var s=new n(be({},e,{cy:r,eles:i}));return s}};rn.createLayout=rn.makeLayout=rn.layout;var Dg={notify:function(e,r){var a=this._private;if(this.batching()){a.batchNotifications=a.batchNotifications||{};var n=a.batchNotifications[e]=a.batchNotifications[e]||this.collection();r!=null&&n.merge(r);return}if(a.notificationsEnabled){var i=this.renderer();this.destroyed()||!i||i.notify(e,r)}},notifications:function(e){var r=this._private;return e===void 0?r.notificationsEnabled:(r.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return e.batchCount==null&&(e.batchCount=0),e.batchCount===0&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(e.batchCount===0)return this;if(e.batchCount--,e.batchCount===0){e.batchStyleEles.updateStyle();var r=this.renderer();Object.keys(e.batchNotifications).forEach(function(a){var n=e.batchNotifications[a];n.empty()?r.notify(a):r.notify(a,n)})}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var r=this;return this.batch(function(){for(var a=Object.keys(e),n=0;n<a.length;n++){var i=a[n],s=e[i],o=r.getElementById(i);o.data(s)}})}},Sg=tt({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),ii={renderTo:function(e,r,a,n){var i=this._private.renderer;return i.renderTo(e,r,a,n),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 r=this,a=r.extension("renderer",e.name);if(a==null){ze("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}e.wheelSensitivity!==void 0&&Ne("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=Sg(e);n.cy=r,r._private.renderer=new a(n),this.notify("init")},destroyRenderer:function(){var e=this;e.notify("destroy");var r=e.container();if(r)for(r._cyreg=null;r.childNodes.length>0;)r.removeChild(r.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach(function(a){var n=a._private;n.rscratch={},n.rstyle={},n.animation.current=[],n.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};ii.invalidateDimensions=ii.resize;var an={collection:function(e,r){return ve(e)?this.$(e):pt(e)?e.collection():Re(e)?(r||(r={}),new et(this,e,r.unique,r.removed)):new et(this)},nodes:function(e){var r=this.$(function(a){return a.isNode()});return e?r.filter(e):r},edges:function(e){var r=this.$(function(a){return a.isEdge()});return e?r.filter(e):r},$:function(e){var r=this._private.elements;return e?r.filter(e):r.spawnSelf()},mutableElements:function(){return this._private.elements}};an.elements=an.filter=an.$;var ot={},ha="t",Lg="f";ot.apply=function(t){for(var e=this,r=e._private,a=r.cy,n=a.collection(),i=0;i<t.length;i++){var s=t[i],o=e.getContextMeta(s);if(!o.empty){var l=e.getContextStyle(o),u=e.applyContextStyle(o,l,s);s._private.appliedInitStyle?e.updateTransitions(s,u.diffProps):s._private.appliedInitStyle=!0;var f=e.updateStyleHints(s);f&&n.push(s)}}return n};ot.getPropertiesDiff=function(t,e){var r=this,a=r._private.propDiffs=r._private.propDiffs||{},n=t+"-"+e,i=a[n];if(i)return i;for(var s=[],o={},l=0;l<r.length;l++){var u=r[l],f=t[l]===ha,h=e[l]===ha,c=f!==h,v=u.mappedProperties.length>0;if(c||h&&v){var d=void 0;c&&v||c?d=u.properties:v&&(d=u.mappedProperties);for(var y=0;y<d.length;y++){for(var p=d[y],g=p.name,m=!1,E=l+1;E<r.length;E++){var D=r[E],b=e[E]===ha;if(b&&(m=D.properties[p.name]!=null,m))break}!o[g]&&!m&&(o[g]=!0,s.push(g))}}}return a[n]=s,s};ot.getContextMeta=function(t){for(var e=this,r="",a,n=t._private.styleCxtKey||"",i=0;i<e.length;i++){var s=e[i],o=s.selector&&s.selector.matches(t);o?r+=ha:r+=Lg}return a=e.getPropertiesDiff(n,r),t._private.styleCxtKey=r,{key:r,diffPropNames:a,empty:a.length===0}};ot.getContextStyle=function(t){var e=t.key,r=this,a=this._private.contextStyles=this._private.contextStyles||{};if(a[e])return a[e];for(var n={_private:{key:e}},i=0;i<r.length;i++){var s=r[i],o=e[i]===ha;if(o)for(var l=0;l<s.properties.length;l++){var u=s.properties[l];n[u.name]=u}}return a[e]=n,n};ot.applyContextStyle=function(t,e,r){for(var a=this,n=t.diffPropNames,i={},s=a.types,o=0;o<n.length;o++){var l=n[o],u=e[l],f=r.pstyle(l);if(!u)if(f)f.bypass?u={name:l,deleteBypassed:!0}:u={name:l,delete:!0};else continue;if(f!==u){if(u.mapped===s.fn&&f!=null&&f.mapping!=null&&f.mapping.value===u.value){var h=f.mapping,c=h.fnValue=u.value(r);if(c===h.prevFnValue)continue}var v=i[l]={prev:f};a.applyParsedProperty(r,u),v.next=r.pstyle(l),v.next&&v.next.bypass&&(v.next=v.next.bypassed)}}return{diffProps:i}};ot.updateStyleHints=function(t){var e=t._private,r=this,a=r.propertyGroupNames,n=r.propertyGroupKeys,i=function(ee,oe,me){return r.getPropertiesHash(ee,oe,me)},s=e.styleKey;if(t.removed())return!1;var o=e.group==="nodes",l=t._private.style;a=Object.keys(l);for(var u=0;u<n.length;u++){var f=n[u];e.styleKeys[f]=[Nr,oa]}for(var h=function(ee,oe){return e.styleKeys[oe][0]=da(ee,e.styleKeys[oe][0])},c=function(ee,oe){return e.styleKeys[oe][1]=ga(ee,e.styleKeys[oe][1])},v=function(ee,oe){h(ee,oe),c(ee,oe)},d=function(ee,oe){for(var me=0;me<ee.length;me++){var te=ee.charCodeAt(me);h(te,oe),c(te,oe)}},y=2e9,p=function(ee){return-128<ee&&ee<128&&Math.floor(ee)!==ee?y-(ee*1024|0):ee},g=0;g<a.length;g++){var m=a[g],E=l[m];if(E!=null){var D=this.properties[m],b=D.type,x=D.groupKey,w=void 0;D.hashOverride!=null?w=D.hashOverride(t,E):E.pfValue!=null&&(w=E.pfValue);var T=D.enums==null?E.value:null,C=w!=null,S=T!=null,A=C||S,L=E.units;if(b.number&&A&&!b.multiple){var I=C?w:T;v(p(I),x),!C&&L!=null&&d(L,x)}else d(E.strValue,x)}}for(var O=[Nr,oa],k=0;k<n.length;k++){var R=n[k],M=e.styleKeys[R];O[0]=da(M[0],O[0]),O[1]=ga(M[1],O[1])}e.styleKey=Mf(O[0],O[1]);var P=e.styleKeys;e.labelDimsKey=Kt(P.labelDimensions);var F=i(t,["label"],P.labelDimensions);if(e.labelKey=Kt(F),e.labelStyleKey=Kt(za(P.commonLabel,F)),!o){var V=i(t,["source-label"],P.labelDimensions);e.sourceLabelKey=Kt(V),e.sourceLabelStyleKey=Kt(za(P.commonLabel,V));var G=i(t,["target-label"],P.labelDimensions);e.targetLabelKey=Kt(G),e.targetLabelStyleKey=Kt(za(P.commonLabel,G))}if(o){var B=e.styleKeys,Y=B.nodeBody,Z=B.nodeBorder,K=B.nodeOutline,U=B.backgroundImage,z=B.compound,_=B.pie,q=[Y,Z,K,U,z,_].filter(function(J){return J!=null}).reduce(za,[Nr,oa]);e.nodeKey=Kt(q),e.hasPie=_!=null&&_[0]!==Nr&&_[1]!==oa}return s!==e.styleKey};ot.clearStyleHints=function(t){var e=t._private;e.styleCxtKey="",e.styleKeys={},e.styleKey=null,e.labelKey=null,e.labelStyleKey=null,e.sourceLabelKey=null,e.sourceLabelStyleKey=null,e.targetLabelKey=null,e.targetLabelStyleKey=null,e.nodeKey=null,e.hasPie=null};ot.applyParsedProperty=function(t,e){var r=this,a=e,n=t._private.style,i,s=r.types,o=r.properties[a.name].type,l=a.bypass,u=n[a.name],f=u&&u.bypass,h=t._private,c="mapping",v=function(Y){return Y==null?null:Y.pfValue!=null?Y.pfValue:Y.value},d=function(){var Y=v(u),Z=v(a);r.checkTriggers(t,a.name,Y,Z)};if(e.name==="curve-style"&&t.isEdge()&&(e.value!=="bezier"&&t.isLoop()||e.value==="haystack"&&(t.source().isParent()||t.target().isParent()))&&(a=e=this.parse(e.name,"bezier",l)),a.delete)return n[a.name]=void 0,d(),!0;if(a.deleteBypassed)return u?u.bypass?(u.bypassed=void 0,d(),!0):!1:(d(),!0);if(a.deleteBypass)return u?u.bypass?(n[a.name]=u.bypassed,d(),!0):!1:(d(),!0);var y=function(){Ne("Do not assign mappings to elements without corresponding data (i.e. ele `"+t.id()+"` has no mapping for property `"+a.name+"` with data field `"+a.field+"`); try a `["+a.field+"]` selector to limit scope to elements with `"+a.field+"` defined")};switch(a.mapped){case s.mapData:{for(var p=a.field.split("."),g=h.data,m=0;m<p.length&&g;m++){var E=p[m];g=g[E]}if(g==null)return y(),!1;var D;if(ne(g)){var b=a.fieldMax-a.fieldMin;b===0?D=0:D=(g-a.fieldMin)/b}else return Ne("Do not use continuous mappers without specifying numeric data (i.e. `"+a.field+": "+g+"` for `"+t.id()+"` is non-numeric)"),!1;if(D<0?D=0:D>1&&(D=1),o.color){var x=a.valueMin[0],w=a.valueMax[0],T=a.valueMin[1],C=a.valueMax[1],S=a.valueMin[2],A=a.valueMax[2],L=a.valueMin[3]==null?1:a.valueMin[3],I=a.valueMax[3]==null?1:a.valueMax[3],O=[Math.round(x+(w-x)*D),Math.round(T+(C-T)*D),Math.round(S+(A-S)*D),Math.round(L+(I-L)*D)];i={bypass:a.bypass,name:a.name,value:O,strValue:"rgb("+O[0]+", "+O[1]+", "+O[2]+")"}}else if(o.number){var k=a.valueMin+(a.valueMax-a.valueMin)*D;i=this.parse(a.name,k,a.bypass,c)}else return!1;if(!i)return y(),!1;i.mapping=a,a=i;break}case s.data:{for(var R=a.field.split("."),M=h.data,P=0;P<R.length&&M;P++){var F=R[P];M=M[F]}if(M!=null&&(i=this.parse(a.name,M,a.bypass,c)),!i)return y(),!1;i.mapping=a,a=i;break}case s.fn:{var V=a.value,G=a.fnValue!=null?a.fnValue:V(t);if(a.prevFnValue=G,G==null)return Ne("Custom function mappers may not return null (i.e. `"+a.name+"` for ele `"+t.id()+"` is null)"),!1;if(i=this.parse(a.name,G,a.bypass,c),!i)return Ne("Custom function mappers may not return invalid values for the property type (i.e. `"+a.name+"` for ele `"+t.id()+"` is invalid)"),!1;i.mapping=Pt(a),a=i;break}case void 0:break;default:return!1}return l?(f?a.bypassed=u.bypassed:a.bypassed=u,n[a.name]=a):f?u.bypassed=a:n[a.name]=a,d(),!0};ot.cleanElements=function(t,e){for(var r=0;r<t.length;r++){var a=t[r];if(this.clearStyleHints(a),a.dirtyCompoundBoundsCache(),a.dirtyBoundingBoxCache(),!e)a._private.style={};else for(var n=a._private.style,i=Object.keys(n),s=0;s<i.length;s++){var o=i[s],l=n[o];l!=null&&(l.bypass?l.bypassed=null:n[o]=null)}}};ot.update=function(){var t=this._private.cy,e=t.mutableElements();e.updateStyle()};ot.updateTransitions=function(t,e){var r=this,a=t._private,n=t.pstyle("transition-property").value,i=t.pstyle("transition-duration").pfValue,s=t.pstyle("transition-delay").pfValue;if(n.length>0&&i>0){for(var o={},l=!1,u=0;u<n.length;u++){var f=n[u],h=t.pstyle(f),c=e[f];if(c){var v=c.prev,d=v,y=c.next!=null?c.next:h,p=!1,g=void 0,m=1e-6;d&&(ne(d.pfValue)&&ne(y.pfValue)?(p=y.pfValue-d.pfValue,g=d.pfValue+m*p):ne(d.value)&&ne(y.value)?(p=y.value-d.value,g=d.value+m*p):Re(d.value)&&Re(y.value)&&(p=d.value[0]!==y.value[0]||d.value[1]!==y.value[1]||d.value[2]!==y.value[2],g=d.strValue),p&&(o[f]=y.strValue,this.applyBypass(t,f,g),l=!0))}}if(!l)return;a.transitioning=!0,new $r(function(E){s>0?t.delayAnimation(s).play().promise().then(E):E()}).then(function(){return t.animation({style:o,duration:i,easing:t.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){r.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1})}else a.transitioning&&(this.removeBypasses(t,n),t.emitAndNotify("style"),a.transitioning=!1)};ot.checkTrigger=function(t,e,r,a,n,i){var s=this.properties[e],o=n(s);o!=null&&o(r,a)&&i(s)};ot.checkZOrderTrigger=function(t,e,r,a){var n=this;this.checkTrigger(t,e,r,a,function(i){return i.triggersZOrder},function(){n._private.cy.notify("zorder",t)})};ot.checkBoundsTrigger=function(t,e,r,a){this.checkTrigger(t,e,r,a,function(n){return n.triggersBounds},function(n){t.dirtyCompoundBoundsCache(),t.dirtyBoundingBoxCache(),n.triggersBoundsOfParallelBeziers&&e==="curve-style"&&(r==="bezier"||a==="bezier")&&t.parallelEdges().forEach(function(i){i.isBundledBezier()&&i.dirtyBoundingBoxCache()}),n.triggersBoundsOfConnectedEdges&&e==="display"&&(r==="none"||a==="none")&&t.connectedEdges().forEach(function(i){i.dirtyBoundingBoxCache()})})};ot.checkTriggers=function(t,e,r,a){t.dirtyStyleCache(),this.checkZOrderTrigger(t,e,r,a),this.checkBoundsTrigger(t,e,r,a)};var Oa={};Oa.applyBypass=function(t,e,r,a){var n=this,i=[],s=!0;if(e==="*"||e==="**"){if(r!==void 0)for(var o=0;o<n.properties.length;o++){var l=n.properties[o],u=l.name,f=this.parse(u,r,!0);f&&i.push(f)}}else if(ve(e)){var h=this.parse(e,r,!0);h&&i.push(h)}else if(Ce(e)){var c=e;a=r;for(var v=Object.keys(c),d=0;d<v.length;d++){var y=v[d],p=c[y];if(p===void 0&&(p=c[mn(y)]),p!==void 0){var g=this.parse(y,p,!0);g&&i.push(g)}}}else return!1;if(i.length===0)return!1;for(var m=!1,E=0;E<t.length;E++){for(var D=t[E],b={},x=void 0,w=0;w<i.length;w++){var T=i[w];if(a){var C=D.pstyle(T.name);x=b[T.name]={prev:C}}m=this.applyParsedProperty(D,Pt(T))||m,a&&(x.next=D.pstyle(T.name))}m&&this.updateStyleHints(D),a&&this.updateTransitions(D,b,s)}return m};Oa.overrideBypass=function(t,e,r){e=yi(e);for(var a=0;a<t.length;a++){var n=t[a],i=n._private.style[e],s=this.properties[e].type,o=s.color,l=s.mutiple,u=i?i.pfValue!=null?i.pfValue:i.value:null;!i||!i.bypass?this.applyBypass(n,e,r):(i.value=r,i.pfValue!=null&&(i.pfValue=r),o?i.strValue="rgb("+r.join(",")+")":l?i.strValue=r.join(" "):i.strValue=""+r,this.updateStyleHints(n)),this.checkTriggers(n,e,u,r)}};Oa.removeAllBypasses=function(t,e){return this.removeBypasses(t,this.propertyNames,e)};Oa.removeBypasses=function(t,e,r){for(var a=!0,n=0;n<t.length;n++){for(var i=t[n],s={},o=0;o<e.length;o++){var l=e[o],u=this.properties[l],f=i.pstyle(u.name);if(!(!f||!f.bypass)){var h="",c=this.parse(l,h,!0),v=s[u.name]={prev:f};this.applyParsedProperty(i,c),v.next=i.pstyle(u.name)}}this.updateStyleHints(i),r&&this.updateTransitions(i,s,a)}};var Ii={};Ii.getEmSizeInPixels=function(){var t=this.containerCss("font-size");return t!=null?parseFloat(t):1};Ii.containerCss=function(t){var e=this._private.cy,r=e.container(),a=e.window();if(a&&r&&a.getComputedStyle)return a.getComputedStyle(r).getPropertyValue(t)};var Ft={};Ft.getRenderedStyle=function(t,e){return e?this.getStylePropertyValue(t,e,!0):this.getRawStyle(t,!0)};Ft.getRawStyle=function(t,e){var r=this;if(t=t[0],t){for(var a={},n=0;n<r.properties.length;n++){var i=r.properties[n],s=r.getStylePropertyValue(t,i.name,e);s!=null&&(a[i.name]=s,a[mn(i.name)]=s)}return a}};Ft.getIndexedStyle=function(t,e,r,a){var n=t.pstyle(e)[r][a];return n!=null?n:t.cy().style().getDefaultProperty(e)[r][0]};Ft.getStylePropertyValue=function(t,e,r){var a=this;if(t=t[0],t){var n=a.properties[e];n.alias&&(n=n.pointsTo);var i=n.type,s=t.pstyle(n.name);if(s){var o=s.value,l=s.units,u=s.strValue;if(r&&i.number&&o!=null&&ne(o)){var f=t.cy().zoom(),h=function(p){return p*f},c=function(p,g){return h(p)+g},v=Re(o),d=v?l.every(function(y){return y!=null}):l!=null;return d?v?o.map(function(y,p){return c(y,l[p])}).join(" "):c(o,l):v?o.map(function(y){return ve(y)?y:""+h(y)}).join(" "):""+h(o)}else if(u!=null)return u}return null}};Ft.getAnimationStartStyle=function(t,e){for(var r={},a=0;a<e.length;a++){var n=e[a],i=n.name,s=t.pstyle(i);s!==void 0&&(Ce(s)?s=this.parse(i,s.strValue):s=this.parse(i,s)),s&&(r[i]=s)}return r};Ft.getPropsList=function(t){var e=this,r=[],a=t,n=e.properties;if(a)for(var i=Object.keys(a),s=0;s<i.length;s++){var o=i[s],l=a[o],u=n[o]||n[yi(o)],f=this.parse(u.name,l);f&&r.push(f)}return r};Ft.getNonDefaultPropertiesHash=function(t,e,r){var a=r.slice(),n,i,s,o,l,u;for(l=0;l<e.length;l++)if(n=e[l],i=t.pstyle(n,!1),i!=null)if(i.pfValue!=null)a[0]=da(o,a[0]),a[1]=ga(o,a[1]);else for(s=i.strValue,u=0;u<s.length;u++)o=s.charCodeAt(u),a[0]=da(o,a[0]),a[1]=ga(o,a[1]);return a};Ft.getPropertiesHash=Ft.getNonDefaultPropertiesHash;var In={};In.appendFromJson=function(t){for(var e=this,r=0;r<t.length;r++){var a=t[r],n=a.selector,i=a.style||a.css,s=Object.keys(i);e.selector(n);for(var o=0;o<s.length;o++){var l=s[o],u=i[l];e.css(l,u)}}return e};In.fromJson=function(t){var e=this;return e.resetToDefault(),e.appendFromJson(t),e};In.json=function(){for(var t=[],e=this.defaultLength;e<this.length;e++){for(var r=this[e],a=r.selector,n=r.properties,i={},s=0;s<n.length;s++){var o=n[s];i[o.name]=o.strValue}t.push({selector:a?a.toString():"core",style:i})}return t};var Mi={};Mi.appendFromString=function(t){var e=this,r=this,a=""+t,n,i,s;a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){a.length>n.length?a=a.substr(n.length):a=""}function l(){i.length>s.length?i=i.substr(s.length):i=""}for(;;){var u=a.match(/^\s*$/);if(u)break;var f=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!f){Ne("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}n=f[0];var h=f[1];if(h!=="core"){var c=new ar(h);if(c.invalid){Ne("Skipping parsing of block: Invalid selector found in string stylesheet: "+h),o();continue}}var v=f[2],d=!1;i=v;for(var y=[];;){var p=i.match(/^\s*$/);if(p)break;var g=i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Ne("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+v),d=!0;break}s=g[0];var m=g[1],E=g[2],D=e.properties[m];if(!D){Ne("Skipping property: Invalid property name in: "+s),l();continue}var b=r.parse(m,E);if(!b){Ne("Skipping property: Invalid property definition in: "+s),l();continue}y.push({name:m,val:E}),l()}if(d){o();break}r.selector(h);for(var x=0;x<y.length;x++){var w=y[x];r.css(w.name,w.val)}o()}return r};Mi.fromString=function(t){var e=this;return e.resetToDefault(),e.appendFromString(t),e};var Je={};(function(){var t=_e,e=kl,r=Bl,a=Fl,n=Gl,i=function(q){return"^"+q+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(q){var J=t+"|\\w+|"+e+"|"+r+"|"+a+"|"+n;return"^"+q+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+t+")\\s*\\,\\s*("+t+")\\s*,\\s*("+J+")\\s*\\,\\s*("+J+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];Je.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:i("data")},layoutData:{mapping:!0,regex:i("layoutData")},scratch:{mapping:!0,regex:i("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(q,J){switch(q.length){case 2:return J[0]!=="deg"&&J[0]!=="rad"&&J[1]!=="deg"&&J[1]!=="rad";case 1:return ve(q[0])||J[0]==="deg"||J[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*,\\s*("+t+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(q){var J=q.length;return J===1||J===2||J===4}}};var l={zeroNonZero:function(q,J){return(q==null||J==null)&&q!==J||q==0&&J!=0?!0:q!=0&&J==0},any:function(q,J){return q!=J},emptyNonEmpty:function(q,J){var ee=tr(q),oe=tr(J);return ee&&!oe||!ee&&oe}},u=Je.types,f=[{name:"label",type:u.text,triggersBounds:l.any,triggersZOrder:l.emptyNonEmpty},{name:"text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any}],h=[{name:"source-label",type:u.text,triggersBounds:l.any},{name:"source-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"source-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"source-text-offset",type:u.size,triggersBounds:l.any}],c=[{name:"target-label",type:u.text,triggersBounds:l.any},{name:"target-text-rotation",type:u.textRotation,triggersBounds:l.any},{name:"target-text-margin-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-margin-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"target-text-offset",type:u.size,triggersBounds:l.any}],v=[{name:"font-family",type:u.fontFamily,triggersBounds:l.any},{name:"font-style",type:u.fontStyle,triggersBounds:l.any},{name:"font-weight",type:u.fontWeight,triggersBounds:l.any},{name:"font-size",type:u.size,triggersBounds:l.any},{name:"text-transform",type:u.textTransform,triggersBounds:l.any},{name:"text-wrap",type:u.textWrap,triggersBounds:l.any},{name:"text-overflow-wrap",type:u.textOverflowWrap,triggersBounds:l.any},{name:"text-max-width",type:u.size,triggersBounds:l.any},{name:"text-outline-width",type:u.size,triggersBounds:l.any},{name:"line-height",type:u.positiveNumber,triggersBounds:l.any}],d=[{name:"text-valign",type:u.valign,triggersBounds:l.any},{name:"text-halign",type:u.halign,triggersBounds:l.any},{name:"color",type:u.color},{name:"text-outline-color",type:u.color},{name:"text-outline-opacity",type:u.zeroOneNumber},{name:"text-background-color",type:u.color},{name:"text-background-opacity",type:u.zeroOneNumber},{name:"text-background-padding",type:u.size,triggersBounds:l.any},{name:"text-border-opacity",type:u.zeroOneNumber},{name:"text-border-color",type:u.color},{name:"text-border-width",type:u.size,triggersBounds:l.any},{name:"text-border-style",type:u.borderStyle,triggersBounds:l.any},{name:"text-background-shape",type:u.textBackgroundShape,triggersBounds:l.any},{name:"text-justification",type:u.justification}],y=[{name:"events",type:u.bool,triggersZOrder:l.any},{name:"text-events",type:u.bool,triggersZOrder:l.any}],p=[{name:"display",type:u.display,triggersZOrder:l.any,triggersBounds:l.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:u.visibility,triggersZOrder:l.any},{name:"opacity",type:u.zeroOneNumber,triggersZOrder:l.zeroNonZero},{name:"text-opacity",type:u.zeroOneNumber},{name:"min-zoomed-font-size",type:u.size},{name:"z-compound-depth",type:u.zCompoundDepth,triggersZOrder:l.any},{name:"z-index-compare",type:u.zIndexCompare,triggersZOrder:l.any},{name:"z-index",type:u.number,triggersZOrder:l.any}],g=[{name:"overlay-padding",type:u.size,triggersBounds:l.any},{name:"overlay-color",type:u.color},{name:"overlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"overlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"overlay-corner-radius",type:u.cornerRadius}],m=[{name:"underlay-padding",type:u.size,triggersBounds:l.any},{name:"underlay-color",type:u.color},{name:"underlay-opacity",type:u.zeroOneNumber,triggersBounds:l.zeroNonZero},{name:"underlay-shape",type:u.overlayShape,triggersBounds:l.any},{name:"underlay-corner-radius",type:u.cornerRadius}],E=[{name:"transition-property",type:u.propList},{name:"transition-duration",type:u.time},{name:"transition-delay",type:u.time},{name:"transition-timing-function",type:u.easing}],D=function(q,J){return J.value==="label"?-q.poolIndex():J.pfValue},b=[{name:"height",type:u.nodeSize,triggersBounds:l.any,hashOverride:D},{name:"width",type:u.nodeSize,triggersBounds:l.any,hashOverride:D},{name:"shape",type:u.nodeShape,triggersBounds:l.any},{name:"shape-polygon-points",type:u.polygonPointList,triggersBounds:l.any},{name:"corner-radius",type:u.cornerRadius},{name:"background-color",type:u.color},{name:"background-fill",type:u.fill},{name:"background-opacity",type:u.zeroOneNumber},{name:"background-blacken",type:u.nOneOneNumber},{name:"background-gradient-stop-colors",type:u.colors},{name:"background-gradient-stop-positions",type:u.percentages},{name:"background-gradient-direction",type:u.gradientDirection},{name:"padding",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"padding-relative-to",type:u.paddingRelativeTo,triggersBounds:l.any},{name:"bounds-expansion",type:u.boundsExpansion,triggersBounds:l.any}],x=[{name:"border-color",type:u.color},{name:"border-opacity",type:u.zeroOneNumber},{name:"border-width",type:u.size,triggersBounds:l.any},{name:"border-style",type:u.borderStyle},{name:"border-cap",type:u.lineCap},{name:"border-join",type:u.lineJoin},{name:"border-dash-pattern",type:u.numbers},{name:"border-dash-offset",type:u.number},{name:"border-position",type:u.linePosition}],w=[{name:"outline-color",type:u.color},{name:"outline-opacity",type:u.zeroOneNumber},{name:"outline-width",type:u.size,triggersBounds:l.any},{name:"outline-style",type:u.borderStyle},{name:"outline-offset",type:u.size,triggersBounds:l.any}],T=[{name:"background-image",type:u.urls},{name:"background-image-crossorigin",type:u.bgCrossOrigin},{name:"background-image-opacity",type:u.zeroOneNumbers},{name:"background-image-containment",type:u.bgContainment},{name:"background-image-smoothing",type:u.bools},{name:"background-position-x",type:u.bgPos},{name:"background-position-y",type:u.bgPos},{name:"background-width-relative-to",type:u.bgRelativeTo},{name:"background-height-relative-to",type:u.bgRelativeTo},{name:"background-repeat",type:u.bgRepeat},{name:"background-fit",type:u.bgFit},{name:"background-clip",type:u.bgClip},{name:"background-width",type:u.bgWH},{name:"background-height",type:u.bgWH},{name:"background-offset-x",type:u.bgPos},{name:"background-offset-y",type:u.bgPos}],C=[{name:"position",type:u.position,triggersBounds:l.any},{name:"compound-sizing-wrt-labels",type:u.compoundIncludeLabels,triggersBounds:l.any},{name:"min-width",type:u.size,triggersBounds:l.any},{name:"min-width-bias-left",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-width-bias-right",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height",type:u.size,triggersBounds:l.any},{name:"min-height-bias-top",type:u.sizeMaybePercent,triggersBounds:l.any},{name:"min-height-bias-bottom",type:u.sizeMaybePercent,triggersBounds:l.any}],S=[{name:"line-style",type:u.lineStyle},{name:"line-color",type:u.color},{name:"line-fill",type:u.fill},{name:"line-cap",type:u.lineCap},{name:"line-opacity",type:u.zeroOneNumber},{name:"line-dash-pattern",type:u.numbers},{name:"line-dash-offset",type:u.number},{name:"line-gradient-stop-colors",type:u.colors},{name:"line-gradient-stop-positions",type:u.percentages},{name:"curve-style",type:u.curveStyle,triggersBounds:l.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:u.zeroOneNumber,triggersBounds:l.any},{name:"source-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"target-endpoint",type:u.edgeEndpoint,triggersBounds:l.any},{name:"control-point-step-size",type:u.size,triggersBounds:l.any},{name:"control-point-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"control-point-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-distances",type:u.bidirectionalSizes,triggersBounds:l.any},{name:"segment-weights",type:u.numbers,triggersBounds:l.any},{name:"segment-radii",type:u.numbers,triggersBounds:l.any},{name:"radius-type",type:u.radiusType,triggersBounds:l.any},{name:"taxi-turn",type:u.bidirectionalSizeMaybePercent,triggersBounds:l.any},{name:"taxi-turn-min-distance",type:u.size,triggersBounds:l.any},{name:"taxi-direction",type:u.axisDirection,triggersBounds:l.any},{name:"taxi-radius",type:u.number,triggersBounds:l.any},{name:"edge-distances",type:u.edgeDistances,triggersBounds:l.any},{name:"arrow-scale",type:u.positiveNumber,triggersBounds:l.any},{name:"loop-direction",type:u.angle,triggersBounds:l.any},{name:"loop-sweep",type:u.angle,triggersBounds:l.any},{name:"source-distance-from-node",type:u.size,triggersBounds:l.any},{name:"target-distance-from-node",type:u.size,triggersBounds:l.any}],A=[{name:"ghost",type:u.bool,triggersBounds:l.any},{name:"ghost-offset-x",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-offset-y",type:u.bidirectionalSize,triggersBounds:l.any},{name:"ghost-opacity",type:u.zeroOneNumber}],L=[{name:"selection-box-color",type:u.color},{name:"selection-box-opacity",type:u.zeroOneNumber},{name:"selection-box-border-color",type:u.color},{name:"selection-box-border-width",type:u.size},{name:"active-bg-color",type:u.color},{name:"active-bg-opacity",type:u.zeroOneNumber},{name:"active-bg-size",type:u.size},{name:"outside-texture-bg-color",type:u.color},{name:"outside-texture-bg-opacity",type:u.zeroOneNumber}],I=[];Je.pieBackgroundN=16,I.push({name:"pie-size",type:u.sizeMaybePercent});for(var O=1;O<=Je.pieBackgroundN;O++)I.push({name:"pie-"+O+"-background-color",type:u.color}),I.push({name:"pie-"+O+"-background-size",type:u.percent}),I.push({name:"pie-"+O+"-background-opacity",type:u.zeroOneNumber});var k=[],R=Je.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:u.arrowShape,triggersBounds:l.any},{name:"arrow-color",type:u.color},{name:"arrow-fill",type:u.arrowFill},{name:"arrow-width",type:u.arrowWidth}].forEach(function(_){R.forEach(function(q){var J=q+"-"+_.name,ee=_.type,oe=_.triggersBounds;k.push({name:J,type:ee,triggersBounds:oe})})},{});var M=Je.properties=[].concat(y,E,p,g,m,A,d,v,f,h,c,b,x,w,T,I,C,S,k,L),P=Je.propertyGroups={behavior:y,transition:E,visibility:p,overlay:g,underlay:m,ghost:A,commonLabel:d,labelDimensions:v,mainLabel:f,sourceLabel:h,targetLabel:c,nodeBody:b,nodeBorder:x,nodeOutline:w,backgroundImage:T,pie:I,compound:C,edgeLine:S,edgeArrow:k,core:L},F=Je.propertyGroupNames={},V=Je.propertyGroupKeys=Object.keys(P);V.forEach(function(_){F[_]=P[_].map(function(q){return q.name}),P[_].forEach(function(q){return q.groupKey=_})});var G=Je.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];Je.propertyNames=M.map(function(_){return _.name});for(var B=0;B<M.length;B++){var Y=M[B];M[Y.name]=Y}for(var Z=0;Z<G.length;Z++){var K=G[Z],U=M[K.pointsTo],z={name:K.name,alias:!0,pointsTo:U};M.push(z),M[K.name]=z}})();Je.getDefaultProperty=function(t){return this.getDefaultProperties()[t]};Je.getDefaultProperties=function(){var t=this._private;if(t.defaultProperties!=null)return t.defaultProperties;for(var e=be({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1, 1, -1, 1, 1, -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(l,u){for(var f=1;f<=Je.pieBackgroundN;f++){var h=u.name.replace("{{i}}",f),c=u.value;l[h]=c}return l},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(l,u){return Je.arrowPrefixes.forEach(function(f){var h=f+"-"+u.name,c=u.value;l[h]=c}),l},{})),r={},a=0;a<this.properties.length;a++){var n=this.properties[a];if(!n.pointsTo){var i=n.name,s=e[i],o=this.parse(i,s);r[i]=o}}return t.defaultProperties=r,t.defaultProperties};Je.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Mn={};Mn.parse=function(t,e,r,a){var n=this;if(Ge(e))return n.parseImplWarn(t,e,r,a);var i=a==="mapping"||a===!0||a===!1||a==null?"dontcare":a,s=r?"t":"f",o=""+e,l=Mo(t,o,s,i),u=n.propCache=n.propCache||[],f;return(f=u[l])||(f=u[l]=n.parseImplWarn(t,e,r,a)),(r||a==="mapping")&&(f=Pt(f),f&&(f.value=Pt(f.value))),f};Mn.parseImplWarn=function(t,e,r,a){var n=this.parseImpl(t,e,r,a);return!n&&e!=null&&Ne("The style property `".concat(t,": ").concat(e,"` is invalid")),n&&(n.name==="width"||n.name==="height")&&e==="label"&&Ne("The style value of `label` is deprecated for `"+n.name+"`"),n};Mn.parseImpl=function(t,e,r,a){var n=this;t=yi(t);var i=n.properties[t],s=e,o=n.types;if(!i||e===void 0)return null;i.alias&&(i=i.pointsTo,t=i.name);var l=ve(e);l&&(e=e.trim());var u=i.type;if(!u)return null;if(r&&(e===""||e===null))return{name:t,value:e,bypass:!0,deleteBypass:!0};if(Ge(e))return{name:t,value:e,strValue:"fn",mapped:o.fn,bypass:r};var f,h;if(!(!l||a||e.length<7||e[1]!=="a")){if(e.length>=7&&e[0]==="d"&&(f=new RegExp(o.data.regex).exec(e))){if(r)return!1;var c=o.data;return{name:t,value:f,strValue:""+e,mapped:c,field:f[1],bypass:r}}else if(e.length>=10&&e[0]==="m"&&(h=new RegExp(o.mapData.regex).exec(e))){if(r||u.multiple)return!1;var v=o.mapData;if(!(u.color||u.number))return!1;var d=this.parse(t,h[4]);if(!d||d.mapped)return!1;var y=this.parse(t,h[5]);if(!y||y.mapped)return!1;if(d.pfValue===y.pfValue||d.strValue===y.strValue)return Ne("`"+t+": "+e+"` is not a valid mapper because the output range is zero; converting to `"+t+": "+d.strValue+"`"),this.parse(t,d.strValue);if(u.color){var p=d.value,g=y.value,m=p[0]===g[0]&&p[1]===g[1]&&p[2]===g[2]&&(p[3]===g[3]||(p[3]==null||p[3]===1)&&(g[3]==null||g[3]===1));if(m)return!1}return{name:t,value:h,strValue:""+e,mapped:v,field:h[1],fieldMin:parseFloat(h[2]),fieldMax:parseFloat(h[3]),valueMin:d.value,valueMax:y.value,bypass:r}}}if(u.multiple&&a!=="multiple"){var E;if(l?E=e.split(/\s+/):Re(e)?E=e:E=[e],u.evenMultiple&&E.length%2!==0)return null;for(var D=[],b=[],x=[],w="",T=!1,C=0;C<E.length;C++){var S=n.parse(t,E[C],r,"multiple");T=T||ve(S.value),D.push(S.value),x.push(S.pfValue!=null?S.pfValue:S.value),b.push(S.units),w+=(C>0?" ":"")+S.strValue}return u.validate&&!u.validate(D,b)?null:u.singleEnum&&T?D.length===1&&ve(D[0])?{name:t,value:D[0],strValue:D[0],bypass:r}:null:{name:t,value:D,pfValue:x,strValue:w,bypass:r,units:b}}var A=function(){for(var q=0;q<u.enums.length;q++){var J=u.enums[q];if(J===e)return{name:t,value:e,strValue:""+e,bypass:r}}return null};if(u.number){var L,I="px";if(u.units&&(L=u.units),u.implicitUnits&&(I=u.implicitUnits),!u.unitless)if(l){var O="px|em"+(u.allowPercent?"|\\%":"");L&&(O=L);var k=e.match("^("+_e+")("+O+")?$");k&&(e=k[1],L=k[2]||I)}else(!L||u.implicitUnits)&&(L=I);if(e=parseFloat(e),isNaN(e)&&u.enums===void 0)return null;if(isNaN(e)&&u.enums!==void 0)return e=s,A();if(u.integer&&!Ll(e)||u.min!==void 0&&(e<u.min||u.strictMin&&e===u.min)||u.max!==void 0&&(e>u.max||u.strictMax&&e===u.max))return null;var R={name:t,value:e,strValue:""+e+(L||""),units:L,bypass:r};return u.unitless||L!=="px"&&L!=="em"?R.pfValue=e:R.pfValue=L==="px"||!L?e:this.getEmSizeInPixels()*e,(L==="ms"||L==="s")&&(R.pfValue=L==="ms"?e:1e3*e),(L==="deg"||L==="rad")&&(R.pfValue=L==="rad"?e:uh(e)),L==="%"&&(R.pfValue=e/100),R}else if(u.propList){var M=[],P=""+e;if(P!=="none"){for(var F=P.split(/\s*,\s*|\s+/),V=0;V<F.length;V++){var G=F[V].trim();n.properties[G]?M.push(G):Ne("`"+G+"` is not a valid property name")}if(M.length===0)return null}return{name:t,value:M,strValue:M.length===0?"none":M.join(" "),bypass:r}}else if(u.color){var B=_l(e);return B?{name:t,value:B,pfValue:B,strValue:"rgb("+B[0]+","+B[1]+","+B[2]+")",bypass:r}:null}else if(u.regex||u.regexes){if(u.enums){var Y=A();if(Y)return Y}for(var Z=u.regexes?u.regexes:[u.regex],K=0;K<Z.length;K++){var U=new RegExp(Z[K]),z=U.exec(e);if(z)return{name:t,value:u.singleRegexMatchValue?z[1]:z,strValue:""+e,bypass:r}}return null}else return u.string?{name:t,value:""+e,strValue:""+e,bypass:r}:u.enums?A():null};var nt=function t(e){if(!(this instanceof t))return new t(e);if(!pi(e)){ze("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},st=nt.prototype;st.instanceString=function(){return"style"};st.clear=function(){for(var t=this._private,e=t.cy,r=e.elements(),a=0;a<this.length;a++)this[a]=void 0;return this.length=0,t.contextStyles={},t.propDiffs={},this.cleanElements(r,!0),r.forEach(function(n){var i=n[0]._private;i.styleDirty=!0,i.appliedInitStyle=!1}),this};st.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this};st.core=function(t){return this._private.coreStyle[t]||this.getDefaultProperty(t)};st.selector=function(t){var e=t==="core"?null:new ar(t),r=this.length++;return this[r]={selector:e,properties:[],mappedProperties:[],index:r},this};st.css=function(){var t=this,e=arguments;if(e.length===1)for(var r=e[0],a=0;a<t.properties.length;a++){var n=t.properties[a],i=r[n.name];i===void 0&&(i=r[mn(n.name)]),i!==void 0&&this.cssRule(n.name,i)}else e.length===2&&this.cssRule(e[0],e[1]);return this};st.style=st.css;st.cssRule=function(t,e){var r=this.parse(t,e);if(r){var a=this.length-1;this[a].properties.push(r),this[a].properties[r.name]=r,r.name.match(/pie-(\d+)-background-size/)&&r.value&&(this._private.hasPie=!0),r.mapped&&this[a].mappedProperties.push(r);var n=!this[a].selector;n&&(this._private.coreStyle[r.name]=r)}return this};st.append=function(t){return xo(t)?t.appendToStyle(this):Re(t)?this.appendFromJson(t):ve(t)&&this.appendFromString(t),this};nt.fromJson=function(t,e){var r=new nt(t);return r.fromJson(e),r};nt.fromString=function(t,e){return new nt(t).fromString(e)};[ot,Oa,Ii,Ft,In,Mi,Je,Mn].forEach(function(t){be(st,t)});nt.types=st.types;nt.properties=st.properties;nt.propertyGroups=st.propertyGroups;nt.propertyGroupNames=st.propertyGroupNames;nt.propertyGroupKeys=st.propertyGroupKeys;var Ag={style:function(e){if(e){var r=this.setStyle(e);r.update()}return this._private.style},setStyle:function(e){var r=this._private;return xo(e)?r.style=e.generateStyle(this):Re(e)?r.style=nt.fromJson(this,e):ve(e)?r.style=nt.fromString(this,e):r.style=nt(this),r.style},updateStyle:function(){this.mutableElements().updateStyle()}},Og="single",Er={autolock:function(e){if(e!==void 0)this._private.autolock=!!e;else return this._private.autolock;return this},autoungrabify:function(e){if(e!==void 0)this._private.autoungrabify=!!e;else return this._private.autoungrabify;return this},autounselectify:function(e){if(e!==void 0)this._private.autounselectify=!!e;else return this._private.autounselectify;return this},selectionType:function(e){var r=this._private;if(r.selectionType==null&&(r.selectionType=Og),e!==void 0)(e==="additive"||e==="single")&&(r.selectionType=e);else return r.selectionType;return this},panningEnabled:function(e){if(e!==void 0)this._private.panningEnabled=!!e;else return this._private.panningEnabled;return this},userPanningEnabled:function(e){if(e!==void 0)this._private.userPanningEnabled=!!e;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(e){if(e!==void 0)this._private.zoomingEnabled=!!e;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(e){if(e!==void 0)this._private.userZoomingEnabled=!!e;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(e){if(e!==void 0)this._private.boxSelectionEnabled=!!e;else return this._private.boxSelectionEnabled;return this},pan:function(){var e=arguments,r=this._private.pan,a,n,i,s,o;switch(e.length){case 0:return r;case 1:if(ve(e[0]))return a=e[0],r[a];if(Ce(e[0])){if(!this._private.panningEnabled)return this;i=e[0],s=i.x,o=i.y,ne(s)&&(r.x=s),ne(o)&&(r.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;a=e[0],n=e[1],(a==="x"||a==="y")&&ne(n)&&(r[a]=n),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(e,r){var a=arguments,n=this._private.pan,i,s,o,l,u;if(!this._private.panningEnabled)return this;switch(a.length){case 1:Ce(e)&&(o=a[0],l=o.x,u=o.y,ne(l)&&(n.x+=l),ne(u)&&(n.y+=u),this.emit("pan viewport"));break;case 2:i=e,s=r,(i==="x"||i==="y")&&ne(s)&&(n[i]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},fit:function(e,r){var a=this.getFitViewport(e,r);if(a){var n=this._private;n.zoom=a.zoom,n.pan=a.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,r){if(ne(e)&&r===void 0&&(r=e,e=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var a;if(ve(e)){var n=e;e=this.$(n)}else if(Nl(e)){var i=e;a={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2},a.w=a.x2-a.x1,a.h=a.y2-a.y1}else pt(e)||(e=this.mutableElements());if(!(pt(e)&&e.empty())){a=a||e.boundingBox();var s=this.width(),o=this.height(),l;if(r=ne(r)?r:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(a.w)&&!isNaN(a.h)&&a.w>0&&a.h>0){l=Math.min((s-2*r)/a.w,(o-2*r)/a.h),l=l>this._private.maxZoom?this._private.maxZoom:l,l=l<this._private.minZoom?this._private.minZoom:l;var u={x:(s-l*(a.x1+a.x2))/2,y:(o-l*(a.y1+a.y2))/2};return{zoom:l,pan:u}}}}},zoomRange:function(e,r){var a=this._private;if(r==null){var n=e;e=n.min,r=n.max}return ne(e)&&ne(r)&&e<=r?(a.minZoom=e,a.maxZoom=r):ne(e)&&r===void 0&&e<=a.maxZoom?a.minZoom=e:ne(r)&&e===void 0&&r>=a.minZoom&&(a.maxZoom=r),this},minZoom:function(e){return e===void 0?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return e===void 0?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var r=this._private,a=r.pan,n=r.zoom,i,s,o=!1;if(r.zoomingEnabled||(o=!0),ne(e)?s=e:Ce(e)&&(s=e.level,e.position!=null?i=xn(e.position,n,a):e.renderedPosition!=null&&(i=e.renderedPosition),i!=null&&!r.panningEnabled&&(o=!0)),s=s>r.maxZoom?r.maxZoom:s,s=s<r.minZoom?r.minZoom:s,o||!ne(s)||s===n||i!=null&&(!ne(i.x)||!ne(i.y)))return null;if(i!=null){var l=a,u=n,f=s,h={x:-f/u*(i.x-l.x)+i.x,y:-f/u*(i.y-l.y)+i.y};return{zoomed:!0,panned:!0,zoom:f,pan:h}}else return{zoomed:!0,panned:!1,zoom:s,pan:a}},zoom:function(e){if(e===void 0)return this._private.zoom;var r=this.getZoomedViewport(e),a=this._private;return r==null||!r.zoomed?this:(a.zoom=r.zoom,r.panned&&(a.pan.x=r.pan.x,a.pan.y=r.pan.y),this.emit("zoom"+(r.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(e){var r=this._private,a=!0,n=!0,i=[],s=!1,o=!1;if(!e)return this;if(ne(e.zoom)||(a=!1),Ce(e.pan)||(n=!1),!a&&!n)return this;if(a){var l=e.zoom;l<r.minZoom||l>r.maxZoom||!r.zoomingEnabled?s=!0:(r.zoom=l,i.push("zoom"))}if(n&&(!s||!e.cancelOnFailedZoom)&&r.panningEnabled){var u=e.pan;ne(u.x)&&(r.pan.x=u.x,o=!1),ne(u.y)&&(r.pan.y=u.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var r=this.getCenterPan(e);return r&&(this._private.pan=r,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,r){if(this._private.panningEnabled){if(ve(e)){var a=e;e=this.mutableElements().filter(a)}else pt(e)||(e=this.mutableElements());if(e.length!==0){var n=e.boundingBox(),i=this.width(),s=this.height();r=r===void 0?this._private.zoom:r;var o={x:(i-r*(n.x1+n.x2))/2,y:(s-r*(n.y1+n.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,r=e.container,a=this;return e.sizeCache=e.sizeCache||(r?function(){var n=a.window().getComputedStyle(r),i=function(o){return parseFloat(n.getPropertyValue(o))};return{width:r.clientWidth-i("padding-left")-i("padding-right"),height:r.clientHeight-i("padding-top")-i("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,r=this._private.zoom,a=this.renderedExtent(),n={x1:(a.x1-e.x)/r,x2:(a.x2-e.x)/r,y1:(a.y1-e.y)/r,y2:(a.y2-e.y)/r};return n.w=n.x2-n.x1,n.h=n.y2-n.y1,n},renderedExtent:function(){var e=this.width(),r=this.height();return{x1:0,y1:0,x2:e,y2:r,w:e,h:r}},multiClickDebounceTime:function(e){if(e)this._private.multiClickDebounceTime=e;else return this._private.multiClickDebounceTime;return this}};Er.centre=Er.center;Er.autolockNodes=Er.autolock;Er.autoungrabifyNodes=Er.autoungrabify;var xa={data:Oe.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Oe.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Oe.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Oe.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};xa.attr=xa.data;xa.removeAttr=xa.removeData;var Ta=function(e){var r=this;e=be({},e);var a=e.container;a&&!on(a)&&on(a[0])&&(a=a[0]);var n=a?a._cyreg:null;n=n||{},n&&n.cy&&(n.cy.destroy(),n={});var i=n.readies=n.readies||[];a&&(a._cyreg=n),n.cy=r;var s=Ye!==void 0&&a!==void 0&&!e.headless,o=e;o.layout=be({name:s?"grid":"null"},o.layout),o.renderer=be({name:s?"canvas":"null"},o.renderer);var l=function(d,y,p){return y!==void 0?y:p!==void 0?p:d},u=this._private={container:a,ready:!1,options:o,elements:new et(this),listeners:[],aniEles:new et(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:l(!0,o.zoomingEnabled),userZoomingEnabled:l(!0,o.userZoomingEnabled),panningEnabled:l(!0,o.panningEnabled),userPanningEnabled:l(!0,o.userPanningEnabled),boxSelectionEnabled:l(!0,o.boxSelectionEnabled),autolock:l(!1,o.autolock,o.autolockNodes),autoungrabify:l(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:l(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ne(o.zoom)?o.zoom:1,pan:{x:Ce(o.pan)&&ne(o.pan.x)?o.pan.x:0,y:Ce(o.pan)&&ne(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:l(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var f=function(d,y){var p=d.some(Il);if(p)return $r.all(d).then(y);y(d)};u.styleEnabled&&r.setStyle([]);var h=be({},o,o.renderer);r.initRenderer(h);var c=function(d,y,p){r.notifications(!1);var g=r.mutableElements();g.length>0&&g.remove(),d!=null&&(Ce(d)||Re(d))&&r.add(d),r.one("layoutready",function(E){r.notifications(!0),r.emit(E),r.one("load",y),r.emitAndNotify("load")}).one("layoutstop",function(){r.one("done",p),r.emit("done")});var m=be({},r._private.options.layout);m.eles=r.elements(),r.layout(m).run()};f([o.style,o.elements],function(v){var d=v[0],y=v[1];u.styleEnabled&&r.style().append(d),c(y,function(){r.startAnimationLoop(),u.ready=!0,Ge(o.ready)&&r.on("ready",o.ready);for(var p=0;p<i.length;p++){var g=i[p];r.on("ready",g)}n&&(n.readies=[]),r.emit("ready")},o.done)})},dn=Ta.prototype;be(dn,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(e){return this.isReady()?this.emitter().emit("ready",[],e):this.on("ready",e),this},destroy:function(){var e=this;if(!e.destroyed())return e.stopAnimationLoop(),e.destroyRenderer(),this.emit("destroy"),e._private.destroyed=!0,e},hasElementWithId:function(e){return this._private.elements.hasElementWithId(e)},getElementById:function(e){return this._private.elements.getElementById(e)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(e){return this._private.elements.merge(e),this},removeFromPool:function(e){return this._private.elements.unmerge(e),this},container:function(){return this._private.container||null},window:function(){var e=this._private.container;if(e==null)return Ye;var r=this._private.container.ownerDocument;return r===void 0||r==null?Ye:r.defaultView||Ye},mount:function(e){if(e!=null){var r=this,a=r._private,n=a.options;return!on(e)&&on(e[0])&&(e=e[0]),r.stopAnimationLoop(),r.destroyRenderer(),a.container=e,a.styleEnabled=!0,r.invalidateSize(),r.initRenderer(be({},n,n.renderer,{name:n.renderer.name==="null"?"canvas":n.renderer.name})),r.startAnimationLoop(),r.style(n.style),r.emit("mount"),r}},unmount:function(){var e=this;return e.stopAnimationLoop(),e.destroyRenderer(),e.initRenderer({name:"null"}),e.emit("unmount"),e},options:function(){return Pt(this._private.options)},json:function(e){var r=this,a=r._private,n=r.mutableElements(),i=function(D){return r.getElementById(D.id())};if(Ce(e)){if(r.startBatch(),e.elements){var s={},o=function(D,b){for(var x=[],w=[],T=0;T<D.length;T++){var C=D[T];if(!C.data.id){Ne("cy.json() cannot handle elements without an ID attribute");continue}var S=""+C.data.id,A=r.getElementById(S);s[S]=!0,A.length!==0?w.push({ele:A,json:C}):(b&&(C.group=b),x.push(C))}r.add(x);for(var L=0;L<w.length;L++){var I=w[L],O=I.ele,k=I.json;O.json(k)}};if(Re(e.elements))o(e.elements);else for(var l=["nodes","edges"],u=0;u<l.length;u++){var f=l[u],h=e.elements[f];Re(h)&&o(h,f)}var c=r.collection();n.filter(function(E){return!s[E.id()]}).forEach(function(E){E.isParent()?c.merge(E):E.remove()}),c.forEach(function(E){return E.children().move({parent:null})}),c.forEach(function(E){return i(E).remove()})}e.style&&r.style(e.style),e.zoom!=null&&e.zoom!==a.zoom&&r.zoom(e.zoom),e.pan&&(e.pan.x!==a.pan.x||e.pan.y!==a.pan.y)&&r.pan(e.pan),e.data&&r.data(e.data);for(var v=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],d=0;d<v.length;d++){var y=v[d];e[y]!=null&&r[y](e[y])}return r.endBatch(),this}else{var p=!!e,g={};p?g.elements=this.elements().map(function(E){return E.json()}):(g.elements={},n.forEach(function(E){var D=E.group();g.elements[D]||(g.elements[D]=[]),g.elements[D].push(E.json())})),this._private.styleEnabled&&(g.style=r.style().json()),g.data=Pt(r.data());var m=a.options;return g.zoomingEnabled=a.zoomingEnabled,g.userZoomingEnabled=a.userZoomingEnabled,g.zoom=a.zoom,g.minZoom=a.minZoom,g.maxZoom=a.maxZoom,g.panningEnabled=a.panningEnabled,g.userPanningEnabled=a.userPanningEnabled,g.pan=Pt(a.pan),g.boxSelectionEnabled=a.boxSelectionEnabled,g.renderer=Pt(m.renderer),g.hideEdgesOnViewport=m.hideEdgesOnViewport,g.textureOnViewport=m.textureOnViewport,g.wheelSensitivity=m.wheelSensitivity,g.motionBlur=m.motionBlur,g.multiClickDebounceTime=m.multiClickDebounceTime,g}}});dn.$id=dn.getElementById;[mg,Tg,Tu,ni,rn,Dg,ii,an,Ag,Er,xa].forEach(function(t){be(dn,t)});var Ng={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}},Ig={maximal:!1,acyclic:!1},Ar=function(e){return e.scratch("breadthfirst")},Qs=function(e,r){return e.scratch("breadthfirst",r)};function Cu(t){this.options=be({},Ng,Ig,t)}Cu.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().filter(function(te){return!te.isParent()}),i=a,s=e.directed,o=e.acyclic||e.maximal||e.maximalAdjustments>0,l=gt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),u;if(pt(e.roots))u=e.roots;else if(Re(e.roots)){for(var f=[],h=0;h<e.roots.length;h++){var c=e.roots[h],v=r.getElementById(c);f.push(v)}u=r.collection(f)}else if(ve(e.roots))u=r.$(e.roots);else if(s)u=n.roots();else{var d=a.components();u=r.collection();for(var y=function(ie){var ue=d[ie],ce=ue.maxDegree(!1),fe=ue.filter(function(ge){return ge.degree(!1)===ce});u=u.add(fe)},p=0;p<d.length;p++)y(p)}var g=[],m={},E=function(ie,ue){g[ue]==null&&(g[ue]=[]);var ce=g[ue].length;g[ue].push(ie),Qs(ie,{index:ce,depth:ue})},D=function(ie,ue){var ce=Ar(ie),fe=ce.depth,ge=ce.index;g[fe][ge]=null,E(ie,ue)};i.bfs({roots:u,directed:e.directed,visit:function(ie,ue,ce,fe,ge){var Ae=ie[0],xe=Ae.id();E(Ae,ge),m[xe]=!0}});for(var b=[],x=0;x<n.length;x++){var w=n[x];m[w.id()]||b.push(w)}var T=function(ie){for(var ue=g[ie],ce=0;ce<ue.length;ce++){var fe=ue[ce];if(fe==null){ue.splice(ce,1),ce--;continue}Qs(fe,{depth:ie,index:ce})}},C=function(){for(var ie=0;ie<g.length;ie++)T(ie)},S=function(ie,ue){for(var ce=Ar(ie),fe=ie.incomers().filter(function(N){return N.isNode()&&a.has(N)}),ge=-1,Ae=ie.id(),xe=0;xe<fe.length;xe++){var we=fe[xe],De=Ar(we);ge=Math.max(ge,De.depth)}if(ce.depth<=ge){if(!e.acyclic&&ue[Ae])return null;var j=ge+1;return D(ie,j),ue[Ae]=j,!0}return!1};if(s&&o){var A=[],L={},I=function(ie){return A.push(ie)},O=function(){return A.shift()};for(n.forEach(function(te){return A.push(te)});A.length>0;){var k=O(),R=S(k,L);if(R)k.outgoers().filter(function(te){return te.isNode()&&a.has(te)}).forEach(I);else if(R===null){Ne("Detected double maximal shift for node `"+k.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}C();var M=0;if(e.avoidOverlap)for(var P=0;P<n.length;P++){var F=n[P],V=F.layoutDimensions(e),G=V.w,B=V.h;M=Math.max(M,G,B)}var Y={},Z=function(ie){if(Y[ie.id()])return Y[ie.id()];for(var ue=Ar(ie).depth,ce=ie.neighborhood(),fe=0,ge=0,Ae=0;Ae<ce.length;Ae++){var xe=ce[Ae];if(!(xe.isEdge()||xe.isParent()||!n.has(xe))){var we=Ar(xe);if(we!=null){var De=we.index,j=we.depth;if(!(De==null||j==null)){var N=g[j].length;j<ue&&(fe+=De/N,ge++)}}}}return ge=Math.max(1,ge),fe=fe/ge,ge===0&&(fe=0),Y[ie.id()]=fe,fe},K=function(ie,ue){var ce=Z(ie),fe=Z(ue),ge=ce-fe;return ge===0?Co(ie.id(),ue.id()):ge};e.depthSort!==void 0&&(K=e.depthSort);for(var U=0;U<g.length;U++)g[U].sort(K),T(U);for(var z=[],_=0;_<b.length;_++)z.push(b[_]);g.unshift(z),C();for(var q=0,J=0;J<g.length;J++)q=Math.max(g[J].length,q);var ee={x:l.x1+l.w/2,y:l.x1+l.h/2},oe=g.reduce(function(te,ie){return Math.max(te,ie.length)},0),me=function(ie){var ue=Ar(ie),ce=ue.depth,fe=ue.index,ge=g[ce].length,Ae=Math.max(l.w/((e.grid?oe:ge)+1),M),xe=Math.max(l.h/(g.length+1),M),we=Math.min(l.w/2/g.length,l.h/2/g.length);if(we=Math.max(we,M),e.circle){var j=we*ce+we-(g.length>0&&g[0].length<=3?we/2:0),N=2*Math.PI/g[ce].length*fe;return ce===0&&g[0].length===1&&(j=1),{x:ee.x+j*Math.cos(N),y:ee.y+j*Math.sin(N)}}else{var De={x:ee.x+(fe+1-(ge+1)/2)*Ae,y:(ce+1)*xe};return De}};return a.nodes().layoutPositions(this,e,me),this};var Mg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Du(t){this.options=be({},Mg,t)}Du.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,i=a.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));for(var s=gt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=e.sweep===void 0?2*Math.PI-2*Math.PI/i.length:e.sweep,u=l/Math.max(1,i.length-1),f,h=0,c=0;c<i.length;c++){var v=i[c],d=v.layoutDimensions(e),y=d.w,p=d.h;h=Math.max(h,y,p)}if(ne(e.radius)?f=e.radius:i.length<=1?f=0:f=Math.min(s.h,s.w)/2-h,i.length>1&&e.avoidOverlap){h*=1.75;var g=Math.cos(u)-Math.cos(0),m=Math.sin(u)-Math.sin(0),E=Math.sqrt(h*h/(g*g+m*m));f=Math.max(E,f)}var D=function(x,w){var T=e.startAngle+w*u*(n?1:-1),C=f*Math.cos(T),S=f*Math.sin(T),A={x:o.x+C,y:o.y+S};return A};return a.nodes().layoutPositions(this,e,D),this};var Rg={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Su(t){this.options=be({},Rg,t)}Su.prototype.run=function(){for(var t=this.options,e=t,r=e.counterclockwise!==void 0?!e.counterclockwise:e.clockwise,a=t.cy,n=e.eles,i=n.nodes().not(":parent"),s=gt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:a.width(),h:a.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},l=[],u=0,f=0;f<i.length;f++){var h=i[f],c=void 0;c=e.concentric(h),l.push({value:c,node:h}),h._private.scratch.concentric=c}i.updateStyle();for(var v=0;v<i.length;v++){var d=i[v],y=d.layoutDimensions(e);u=Math.max(u,y.w,y.h)}l.sort(function(te,ie){return ie.value-te.value});for(var p=e.levelWidth(i),g=[[]],m=g[0],E=0;E<l.length;E++){var D=l[E];if(m.length>0){var b=Math.abs(m[0].value-D.value);b>=p&&(m=[],g.push(m))}m.push(D)}var x=u+e.minNodeSpacing;if(!e.avoidOverlap){var w=g.length>0&&g[0].length>1,T=Math.min(s.w,s.h)/2-x,C=T/(g.length+w?1:0);x=Math.min(x,C)}for(var S=0,A=0;A<g.length;A++){var L=g[A],I=e.sweep===void 0?2*Math.PI-2*Math.PI/L.length:e.sweep,O=L.dTheta=I/Math.max(1,L.length-1);if(L.length>1&&e.avoidOverlap){var k=Math.cos(O)-Math.cos(0),R=Math.sin(O)-Math.sin(0),M=Math.sqrt(x*x/(k*k+R*R));S=Math.max(M,S)}L.r=S,S+=x}if(e.equidistant){for(var P=0,F=0,V=0;V<g.length;V++){var G=g[V],B=G.r-F;P=Math.max(P,B)}F=0;for(var Y=0;Y<g.length;Y++){var Z=g[Y];Y===0&&(F=Z.r),Z.r=F,F+=P}}for(var K={},U=0;U<g.length;U++)for(var z=g[U],_=z.dTheta,q=z.r,J=0;J<z.length;J++){var ee=z[J],oe=e.startAngle+(r?1:-1)*_*J,me={x:o.x+q*Math.cos(oe),y:o.y+q*Math.sin(oe)};K[ee.node.id()]=me}return n.nodes().layoutPositions(this,e,function(te){var ie=te.id();return K[ie]}),this};var Wn,kg={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,r){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(e){return 2048},nodeOverlap:4,idealEdgeLength:function(e){return 32},edgeElasticity:function(e){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Rn(t){this.options=be({},kg,t),this.options.layout=this;var e=this.options.eles.nodes(),r=this.options.eles.edges(),a=r.filter(function(n){var i=n.source().data("id"),s=n.target().data("id"),o=e.some(function(u){return u.data("id")===i}),l=e.some(function(u){return u.data("id")===s});return!o||!l});this.options.eles=this.options.eles.not(a)}Rn.prototype.run=function(){var t=this.options,e=t.cy,r=this;r.stopped=!1,(t.animate===!0||t.animate===!1)&&r.emit({type:"layoutstart",layout:r}),t.debug===!0?Wn=!0:Wn=!1;var a=Pg(e,r,t);Wn&&Gg(a),t.randomize&&zg(a);var n=$t(),i=function(){Vg(a,e,t),t.fit===!0&&e.fit(t.padding)},s=function(c){return!(r.stopped||c>=t.numIter||(Ug(a,t),a.temperature=a.temperature*t.coolingFactor,a.temperature<t.minTemp))},o=function(){if(t.animate===!0||t.animate===!1)i(),r.one("layoutstop",t.stop),r.emit({type:"layoutstop",layout:r});else{var c=t.eles.nodes(),v=Lu(a,t,c);c.layoutPositions(r,t,v)}},l=0,u=!0;if(t.animate===!0){var f=function h(){for(var c=0;u&&c<t.refresh;)u=s(l),l++,c++;if(!u)js(a,t),o();else{var v=$t();v-n>=t.animationThreshold&&i(),un(h)}};f()}else{for(;u;)u=s(l),l++;js(a,t),o()}return this};Rn.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this};Rn.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Pg=function(e,r,a){for(var n=a.eles.edges(),i=a.eles.nodes(),s=gt(a.boundingBox?a.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:n.size(),temperature:a.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},l=a.eles.components(),u={},f=0;f<l.length;f++)for(var h=l[f],c=0;c<h.length;c++){var v=h[c];u[v.id()]=f}for(var f=0;f<o.nodeSize;f++){var d=i[f],y=d.layoutDimensions(a),p={};p.isLocked=d.locked(),p.id=d.data("id"),p.parentId=d.data("parent"),p.cmptId=u[d.id()],p.children=[],p.positionX=d.position("x"),p.positionY=d.position("y"),p.offsetX=0,p.offsetY=0,p.height=y.w,p.width=y.h,p.maxX=p.positionX+p.width/2,p.minX=p.positionX-p.width/2,p.maxY=p.positionY+p.height/2,p.minY=p.positionY-p.height/2,p.padLeft=parseFloat(d.style("padding")),p.padRight=parseFloat(d.style("padding")),p.padTop=parseFloat(d.style("padding")),p.padBottom=parseFloat(d.style("padding")),p.nodeRepulsion=Ge(a.nodeRepulsion)?a.nodeRepulsion(d):a.nodeRepulsion,o.layoutNodes.push(p),o.idToIndex[p.id]=f}for(var g=[],m=0,E=-1,D=[],f=0;f<o.nodeSize;f++){var d=o.layoutNodes[f],b=d.parentId;b!=null?o.layoutNodes[o.idToIndex[b]].children.push(d.id):(g[++E]=d.id,D.push(d.id))}for(o.graphSet.push(D);m<=E;){var x=g[m++],w=o.idToIndex[x],v=o.layoutNodes[w],T=v.children;if(T.length>0){o.graphSet.push(T);for(var f=0;f<T.length;f++)g[++E]=T[f]}}for(var f=0;f<o.graphSet.length;f++)for(var C=o.graphSet[f],c=0;c<C.length;c++){var S=o.idToIndex[C[c]];o.indexToGraph[S]=f}for(var f=0;f<o.edgeSize;f++){var A=n[f],L={};L.id=A.data("id"),L.sourceId=A.data("source"),L.targetId=A.data("target");var I=Ge(a.idealEdgeLength)?a.idealEdgeLength(A):a.idealEdgeLength,O=Ge(a.edgeElasticity)?a.edgeElasticity(A):a.edgeElasticity,k=o.idToIndex[L.sourceId],R=o.idToIndex[L.targetId],M=o.indexToGraph[k],P=o.indexToGraph[R];if(M!=P){for(var F=Bg(L.sourceId,L.targetId,o),V=o.graphSet[F],G=0,p=o.layoutNodes[k];V.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],G++;for(p=o.layoutNodes[R];V.indexOf(p.id)===-1;)p=o.layoutNodes[o.idToIndex[p.parentId]],G++;I*=G*a.nestingFactor}L.idealLength=I,L.elasticity=O,o.layoutEdges.push(L)}return o},Bg=function(e,r,a){var n=Fg(e,r,0,a);return 2>n.count?0:n.graph},Fg=function t(e,r,a,n){var i=n.graphSet[a];if(-1<i.indexOf(e)&&-1<i.indexOf(r))return{count:2,graph:a};for(var s=0,o=0;o<i.length;o++){var l=i[o],u=n.idToIndex[l],f=n.layoutNodes[u].children;if(f.length!==0){var h=n.indexToGraph[n.idToIndex[f[0]]],c=t(e,r,h,n);if(c.count!==0)if(c.count===1){if(s++,s===2)break}else return c}}return{count:s,graph:a}},Gg,zg=function(e,r){for(var a=e.clientWidth,n=e.clientHeight,i=0;i<e.nodeSize;i++){var s=e.layoutNodes[i];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*a,s.positionY=Math.random()*n)}},Lu=function(e,r,a){var n=e.boundingBox,i={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return r.boundingBox&&(a.forEach(function(s){var o=e.layoutNodes[e.idToIndex[s.data("id")]];i.x1=Math.min(i.x1,o.positionX),i.x2=Math.max(i.x2,o.positionX),i.y1=Math.min(i.y1,o.positionY),i.y2=Math.max(i.y2,o.positionY)}),i.w=i.x2-i.x1,i.h=i.y2-i.y1),function(s,o){var l=e.layoutNodes[e.idToIndex[s.data("id")]];if(r.boundingBox){var u=(l.positionX-i.x1)/i.w,f=(l.positionY-i.y1)/i.h;return{x:n.x1+u*n.w,y:n.y1+f*n.h}}else return{x:l.positionX,y:l.positionY}}},Vg=function(e,r,a){var n=a.layout,i=a.eles.nodes(),s=Lu(e,a,i);i.positions(s),e.ready!==!0&&(e.ready=!0,n.one("layoutready",a.ready),n.emit({type:"layoutready",layout:this}))},Ug=function(e,r,a){$g(e,r),Hg(e),Xg(e,r),qg(e),Wg(e)},$g=function(e,r){for(var a=0;a<e.graphSet.length;a++)for(var n=e.graphSet[a],i=n.length,s=0;s<i;s++)for(var o=e.layoutNodes[e.idToIndex[n[s]]],l=s+1;l<i;l++){var u=e.layoutNodes[e.idToIndex[n[l]]];Yg(o,u,e,r)}},Js=function(e){return-e+2*e*Math.random()},Yg=function(e,r,a,n){var i=e.cmptId,s=r.cmptId;if(!(i!==s&&!a.isCompound)){var o=r.positionX-e.positionX,l=r.positionY-e.positionY,u=1;o===0&&l===0&&(o=Js(u),l=Js(u));var f=_g(e,r,o,l);if(f>0)var h=n.nodeOverlap*f,c=Math.sqrt(o*o+l*l),v=h*o/c,d=h*l/c;else var y=gn(e,o,l),p=gn(r,-1*o,-1*l),g=p.x-y.x,m=p.y-y.y,E=g*g+m*m,c=Math.sqrt(E),h=(e.nodeRepulsion+r.nodeRepulsion)/E,v=h*g/c,d=h*m/c;e.isLocked||(e.offsetX-=v,e.offsetY-=d),r.isLocked||(r.offsetX+=v,r.offsetY+=d)}},_g=function(e,r,a,n){if(a>0)var i=e.maxX-r.minX;else var i=r.maxX-e.minX;if(n>0)var s=e.maxY-r.minY;else var s=r.maxY-e.minY;return i>=0&&s>=0?Math.sqrt(i*i+s*s):0},gn=function(e,r,a){var n=e.positionX,i=e.positionY,s=e.height||1,o=e.width||1,l=a/r,u=s/o,f={};return r===0&&0<a||r===0&&0>a?(f.x=n,f.y=i+s/2,f):0<r&&-1*u<=l&&l<=u?(f.x=n+o/2,f.y=i+o*a/2/r,f):0>r&&-1*u<=l&&l<=u?(f.x=n-o/2,f.y=i-o*a/2/r,f):0<a&&(l<=-1*u||l>=u)?(f.x=n+s*r/2/a,f.y=i+s/2,f):(0>a&&(l<=-1*u||l>=u)&&(f.x=n-s*r/2/a,f.y=i-s/2),f)},Hg=function(e,r){for(var a=0;a<e.edgeSize;a++){var n=e.layoutEdges[a],i=e.idToIndex[n.sourceId],s=e.layoutNodes[i],o=e.idToIndex[n.targetId],l=e.layoutNodes[o],u=l.positionX-s.positionX,f=l.positionY-s.positionY;if(!(u===0&&f===0)){var h=gn(s,u,f),c=gn(l,-1*u,-1*f),v=c.x-h.x,d=c.y-h.y,y=Math.sqrt(v*v+d*d),p=Math.pow(n.idealLength-y,2)/n.elasticity;if(y!==0)var g=p*v/y,m=p*d/y;else var g=0,m=0;s.isLocked||(s.offsetX+=g,s.offsetY+=m),l.isLocked||(l.offsetX-=g,l.offsetY-=m)}}},Xg=function(e,r){if(r.gravity!==0)for(var a=1,n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],s=i.length;if(n===0)var o=e.clientHeight/2,l=e.clientWidth/2;else var u=e.layoutNodes[e.idToIndex[i[0]]],f=e.layoutNodes[e.idToIndex[u.parentId]],o=f.positionX,l=f.positionY;for(var h=0;h<s;h++){var c=e.layoutNodes[e.idToIndex[i[h]]];if(!c.isLocked){var v=o-c.positionX,d=l-c.positionY,y=Math.sqrt(v*v+d*d);if(y>a){var p=r.gravity*v/y,g=r.gravity*d/y;c.offsetX+=p,c.offsetY+=g}}}}},qg=function(e,r){var a=[],n=0,i=-1;for(a.push.apply(a,e.graphSet[0]),i+=e.graphSet[0].length;n<=i;){var s=a[n++],o=e.idToIndex[s],l=e.layoutNodes[o],u=l.children;if(0<u.length&&!l.isLocked){for(var f=l.offsetX,h=l.offsetY,c=0;c<u.length;c++){var v=e.layoutNodes[e.idToIndex[u[c]]];v.offsetX+=f,v.offsetY+=h,a[++i]=u[c]}l.offsetX=0,l.offsetY=0}}},Wg=function(e,r){for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&(n.maxX=void 0,n.minX=void 0,n.maxY=void 0,n.minY=void 0)}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];if(!(0<n.children.length||n.isLocked)){var i=Kg(n.offsetX,n.offsetY,e.temperature);n.positionX+=i.x,n.positionY+=i.y,n.offsetX=0,n.offsetY=0,n.minX=n.positionX-n.width,n.maxX=n.positionX+n.width,n.minY=n.positionY-n.height,n.maxY=n.positionY+n.height,Zg(n,e)}}for(var a=0;a<e.nodeSize;a++){var n=e.layoutNodes[a];0<n.children.length&&!n.isLocked&&(n.positionX=(n.maxX+n.minX)/2,n.positionY=(n.maxY+n.minY)/2,n.width=n.maxX-n.minX,n.height=n.maxY-n.minY)}},Kg=function(e,r,a){var n=Math.sqrt(e*e+r*r);if(n>a)var i={x:a*e/n,y:a*r/n};else var i={x:e,y:r};return i},Zg=function t(e,r){var a=e.parentId;if(a!=null){var n=r.layoutNodes[r.idToIndex[a]],i=!1;if((n.maxX==null||e.maxX+n.padRight>n.maxX)&&(n.maxX=e.maxX+n.padRight,i=!0),(n.minX==null||e.minX-n.padLeft<n.minX)&&(n.minX=e.minX-n.padLeft,i=!0),(n.maxY==null||e.maxY+n.padBottom>n.maxY)&&(n.maxY=e.maxY+n.padBottom,i=!0),(n.minY==null||e.minY-n.padTop<n.minY)&&(n.minY=e.minY-n.padTop,i=!0),i)return t(n,r)}},js=function(e,r){for(var a=e.layoutNodes,n=[],i=0;i<a.length;i++){var s=a[i],o=s.cmptId,l=n[o]=n[o]||[];l.push(s)}for(var u=0,i=0;i<n.length;i++){var f=n[i];if(f){f.x1=1/0,f.x2=-1/0,f.y1=1/0,f.y2=-1/0;for(var h=0;h<f.length;h++){var c=f[h];f.x1=Math.min(f.x1,c.positionX-c.width/2),f.x2=Math.max(f.x2,c.positionX+c.width/2),f.y1=Math.min(f.y1,c.positionY-c.height/2),f.y2=Math.max(f.y2,c.positionY+c.height/2)}f.w=f.x2-f.x1,f.h=f.y2-f.y1,u+=f.w*f.h}}n.sort(function(m,E){return E.w*E.h-m.w*m.h});for(var v=0,d=0,y=0,p=0,g=Math.sqrt(u)*e.clientWidth/e.clientHeight,i=0;i<n.length;i++){var f=n[i];if(f){for(var h=0;h<f.length;h++){var c=f[h];c.isLocked||(c.positionX+=v-f.x1,c.positionY+=d-f.y1)}v+=f.w+r.componentSpacing,y+=f.w+r.componentSpacing,p=Math.max(p,f.h),y>g&&(d+=p+r.componentSpacing,v=0,y=0,p=0)}}},Qg={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Au(t){this.options=be({},Qg,t)}Au.prototype.run=function(){var t=this.options,e=t,r=t.cy,a=e.eles,n=a.nodes().not(":parent");e.sort&&(n=n.sort(e.sort));var i=gt(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(i.h===0||i.w===0)a.nodes().layoutPositions(this,e,function(Y){return{x:i.x1,y:i.y1}});else{var s=n.size(),o=Math.sqrt(s*i.h/i.w),l=Math.round(o),u=Math.round(i.w/i.h*o),f=function(Z){if(Z==null)return Math.min(l,u);var K=Math.min(l,u);K==l?l=Z:u=Z},h=function(Z){if(Z==null)return Math.max(l,u);var K=Math.max(l,u);K==l?l=Z:u=Z},c=e.rows,v=e.cols!=null?e.cols:e.columns;if(c!=null&&v!=null)l=c,u=v;else if(c!=null&&v==null)l=c,u=Math.ceil(s/l);else if(c==null&&v!=null)u=v,l=Math.ceil(s/u);else if(u*l>s){var d=f(),y=h();(d-1)*y>=s?f(d-1):(y-1)*d>=s&&h(y-1)}else for(;u*l<s;){var p=f(),g=h();(g+1)*p>=s?h(g+1):f(p+1)}var m=i.w/u,E=i.h/l;if(e.condense&&(m=0,E=0),e.avoidOverlap)for(var D=0;D<n.length;D++){var b=n[D],x=b._private.position;(x.x==null||x.y==null)&&(x.x=0,x.y=0);var w=b.layoutDimensions(e),T=e.avoidOverlapPadding,C=w.w+T,S=w.h+T;m=Math.max(m,C),E=Math.max(E,S)}for(var A={},L=function(Z,K){return!!A["c-"+Z+"-"+K]},I=function(Z,K){A["c-"+Z+"-"+K]=!0},O=0,k=0,R=function(){k++,k>=u&&(k=0,O++)},M={},P=0;P<n.length;P++){var F=n[P],V=e.position(F);if(V&&(V.row!==void 0||V.col!==void 0)){var G={row:V.row,col:V.col};if(G.col===void 0)for(G.col=0;L(G.row,G.col);)G.col++;else if(G.row===void 0)for(G.row=0;L(G.row,G.col);)G.row++;M[F.id()]=G,I(G.row,G.col)}}var B=function(Z,K){var U,z;if(Z.locked()||Z.isParent())return!1;var _=M[Z.id()];if(_)U=_.col*m+m/2+i.x1,z=_.row*E+E/2+i.y1;else{for(;L(O,k);)R();U=k*m+m/2+i.x1,z=O*E+E/2+i.y1,I(O,k),R()}return{x:U,y:z}};n.layoutPositions(this,e,B)}return this};var Jg={ready:function(){},stop:function(){}};function Ri(t){this.options=be({},Jg,t)}Ri.prototype.run=function(){var t=this.options,e=t.eles,r=this;return t.cy,r.emit("layoutstart"),e.nodes().positions(function(){return{x:0,y:0}}),r.one("layoutready",t.ready),r.emit("layoutready"),r.one("layoutstop",t.stop),r.emit("layoutstop"),this};Ri.prototype.stop=function(){return this};var jg={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Ou(t){this.options=be({},jg,t)}Ou.prototype.run=function(){var t=this.options,e=t.eles,r=e.nodes(),a=Ge(t.positions);function n(i){if(t.positions==null)return ah(i.position());if(a)return t.positions(i);var s=t.positions[i._private.data.id];return s==null?null:s}return r.layoutPositions(this,t,function(i,s){var o=n(i);return i.locked()||o==null?!1:o}),this};var ep={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,r){return!0},ready:void 0,stop:void 0,transform:function(e,r){return r}};function Nu(t){this.options=be({},ep,t)}Nu.prototype.run=function(){var t=this.options,e=t.cy,r=t.eles,a=gt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),n=function(s,o){return{x:a.x1+Math.round(Math.random()*a.w),y:a.y1+Math.round(Math.random()*a.h)}};return r.nodes().layoutPositions(this,t,n),this};var tp=[{name:"breadthfirst",impl:Cu},{name:"circle",impl:Du},{name:"concentric",impl:Su},{name:"cose",impl:Rn},{name:"grid",impl:Au},{name:"null",impl:Ri},{name:"preset",impl:Ou},{name:"random",impl:Nu}];function Iu(t){this.options=t,this.notifications=0}var eo=function(){},to=function(){throw new Error("A headless instance can not render images")};Iu.prototype={recalculateRenderedStyle:eo,notify:function(){this.notifications++},init:eo,isHeadless:function(){return!0},png:to,jpg:to};var ki={};ki.arrowShapeWidth=.3;ki.registerArrowShapes=function(){var t=this.arrowShapes={},e=this,r=function(u,f,h,c,v,d,y){var p=v.x-h/2-y,g=v.x+h/2+y,m=v.y-h/2-y,E=v.y+h/2+y,D=p<=u&&u<=g&&m<=f&&f<=E;return D},a=function(u,f,h,c,v){var d=u*Math.cos(c)-f*Math.sin(c),y=u*Math.sin(c)+f*Math.cos(c),p=d*h,g=y*h,m=p+v.x,E=g+v.y;return{x:m,y:E}},n=function(u,f,h,c){for(var v=[],d=0;d<u.length;d+=2){var y=u[d],p=u[d+1];v.push(a(y,p,f,h,c))}return v},i=function(u){for(var f=[],h=0;h<u.length;h++){var c=u[h];f.push(c.x,c.y)}return f},s=function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").pfValue*2},o=function(u,f){ve(f)&&(f=t[f]),t[u]=be({name:u,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(c,v,d,y,p,g){var m=i(n(this.points,d+2*g,y,p)),E=dt(c,v,m);return E},roughCollide:r,draw:function(c,v,d,y){var p=n(this.points,v,d,y);e.arrowShapeImpl("polygon")(c,p)},spacing:function(c){return 0},gap:s},f)};o("none",{collide:ln,roughCollide:ln,draw:bi,spacing:hs,gap:hs}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:t.triangle.points,controlPoint:[0,-.15],roughCollide:r,draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),y=this.controlPoint,p=a(y[0],y[1],f,h,c);e.arrowShapeImpl(this.name)(u,d,p)},gap:function(u){return s(u)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(u,f,h,c,v,d,y){var p=i(n(this.points,h+2*y,c,v)),g=i(n(this.pointsTee,h+2*y,c,v)),m=dt(u,f,p)||dt(u,f,g);return m},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),y=n(this.pointsTee,f,h,c);e.arrowShapeImpl(this.name)(u,d,y)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(u,f,h,c,v,d,y){var p=v,g=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((h+2*y)*this.radius,2),m=i(n(this.points,h+2*y,c,v));return dt(u,f,m)||g},draw:function(u,f,h,c,v){var d=n(this.pointsTr,f,h,c);e.arrowShapeImpl(this.name)(u,d,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(u,f){var h=this.baseCrossLinePts.slice(),c=f/u,v=3,d=5;return h[v]=h[v]-c,h[d]=h[d]-c,h},collide:function(u,f,h,c,v,d,y){var p=i(n(this.points,h+2*y,c,v)),g=i(n(this.crossLinePts(h,d),h+2*y,c,v)),m=dt(u,f,p)||dt(u,f,g);return m},draw:function(u,f,h,c,v){var d=n(this.points,f,h,c),y=n(this.crossLinePts(f,v),f,h,c);e.arrowShapeImpl(this.name)(u,d,y)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(u){return s(u)*.525}}),o("circle",{radius:.15,collide:function(u,f,h,c,v,d,y){var p=v,g=Math.pow(p.x-u,2)+Math.pow(p.y-f,2)<=Math.pow((h+2*y)*this.radius,2);return g},draw:function(u,f,h,c,v){e.arrowShapeImpl(this.name)(u,c.x,c.y,this.radius*f)},spacing:function(u){return e.getArrowWidth(u.pstyle("width").pfValue,u.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(u){return 1},gap:function(u){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(u){return u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(u){return .95*u.pstyle("width").pfValue*u.pstyle("arrow-scale").value}})};var xr={};xr.projectIntoViewport=function(t,e){var r=this.cy,a=this.findContainerClientCoords(),n=a[0],i=a[1],s=a[4],o=r.pan(),l=r.zoom(),u=((t-n)/s-o.x)/l,f=((e-i)/s-o.y)/l;return[u,f]};xr.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var t=this.container,e=t.getBoundingClientRect(),r=this.cy.window().getComputedStyle(t),a=function(g){return parseFloat(r.getPropertyValue(g))},n={left:a("padding-left"),right:a("padding-right"),top:a("padding-top"),bottom:a("padding-bottom")},i={left:a("border-left-width"),right:a("border-right-width"),top:a("border-top-width"),bottom:a("border-bottom-width")},s=t.clientWidth,o=t.clientHeight,l=n.left+n.right,u=n.top+n.bottom,f=i.left+i.right,h=e.width/(s+f),c=s-l,v=o-u,d=e.left+n.left+i.left,y=e.top+n.top+i.top;return this.containerBB=[d,y,c,v,h]};xr.invalidateContainerClientCoordsCache=function(){this.containerBB=null};xr.findNearestElement=function(t,e,r,a){return this.findNearestElements(t,e,r,a)[0]};xr.findNearestElements=function(t,e,r,a){var n=this,i=this,s=i.getCachedZSortedEles(),o=[],l=i.cy.zoom(),u=i.cy.hasCompoundNodes(),f=(a?24:8)/l,h=(a?8:2)/l,c=(a?8:2)/l,v=1/0,d,y;r&&(s=s.interactive);function p(w,T){if(w.isNode()){if(y)return;y=w,o.push(w)}if(w.isEdge()&&(T==null||T<v))if(d){if(d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value&&d.pstyle("z-compound-depth").value===w.pstyle("z-compound-depth").value){for(var C=0;C<o.length;C++)if(o[C].isEdge()){o[C]=w,d=w,v=T!=null?T:v;break}}}else o.push(w),d=w,v=T!=null?T:v}function g(w){var T=w.outerWidth()+2*h,C=w.outerHeight()+2*h,S=T/2,A=C/2,L=w.position(),I=w.pstyle("corner-radius").value==="auto"?"auto":w.pstyle("corner-radius").pfValue,O=w._private.rscratch;if(L.x-S<=t&&t<=L.x+S&&L.y-A<=e&&e<=L.y+A){var k=i.nodeShapes[n.getNodeShape(w)];if(k.checkPoint(t,e,0,T,C,L.x,L.y,I,O))return p(w,0),!0}}function m(w){var T=w._private,C=T.rscratch,S=w.pstyle("width").pfValue,A=w.pstyle("arrow-scale").value,L=S/2+f,I=L*L,O=L*2,P=T.source,F=T.target,k;if(C.edgeType==="segments"||C.edgeType==="straight"||C.edgeType==="haystack"){for(var R=C.allpts,M=0;M+3<R.length;M+=2)if(ph(t,e,R[M],R[M+1],R[M+2],R[M+3],O)&&I>(k=wh(t,e,R[M],R[M+1],R[M+2],R[M+3])))return p(w,k),!0}else if(C.edgeType==="bezier"||C.edgeType==="multibezier"||C.edgeType==="self"||C.edgeType==="compound"){for(var R=C.allpts,M=0;M+5<C.allpts.length;M+=4)if(yh(t,e,R[M],R[M+1],R[M+2],R[M+3],R[M+4],R[M+5],O)&&I>(k=Eh(t,e,R[M],R[M+1],R[M+2],R[M+3],R[M+4],R[M+5])))return p(w,k),!0}for(var P=P||T.source,F=F||T.target,V=n.getArrowWidth(S,A),G=[{name:"source",x:C.arrowStartX,y:C.arrowStartY,angle:C.srcArrowAngle},{name:"target",x:C.arrowEndX,y:C.arrowEndY,angle:C.tgtArrowAngle},{name:"mid-source",x:C.midX,y:C.midY,angle:C.midsrcArrowAngle},{name:"mid-target",x:C.midX,y:C.midY,angle:C.midtgtArrowAngle}],M=0;M<G.length;M++){var B=G[M],Y=i.arrowShapes[w.pstyle(B.name+"-arrow-shape").value],Z=w.pstyle("width").pfValue;if(Y.roughCollide(t,e,V,B.angle,{x:B.x,y:B.y},Z,f)&&Y.collide(t,e,V,B.angle,{x:B.x,y:B.y},Z,f))return p(w),!0}u&&o.length>0&&(g(P),g(F))}function E(w,T,C){return At(w,T,C)}function D(w,T){var C=w._private,S=c,A;T?A=T+"-":A="",w.boundingBox();var L=C.labelBounds[T||"main"],I=w.pstyle(A+"label").value,O=w.pstyle("text-events").strValue==="yes";if(!(!O||!I)){var k=E(C.rscratch,"labelX",T),R=E(C.rscratch,"labelY",T),M=E(C.rscratch,"labelAngle",T),P=w.pstyle(A+"text-margin-x").pfValue,F=w.pstyle(A+"text-margin-y").pfValue,V=L.x1-S-P,G=L.x2+S-P,B=L.y1-S-F,Y=L.y2+S-F;if(M){var Z=Math.cos(M),K=Math.sin(M),U=function(me,te){return me=me-k,te=te-R,{x:me*Z-te*K+k,y:me*K+te*Z+R}},z=U(V,B),_=U(V,Y),q=U(G,B),J=U(G,Y),ee=[z.x+P,z.y+F,q.x+P,q.y+F,J.x+P,J.y+F,_.x+P,_.y+F];if(dt(t,e,ee))return p(w),!0}else if(Gr(L,t,e))return p(w),!0}}for(var b=s.length-1;b>=0;b--){var x=s[b];x.isNode()?g(x)||D(x):m(x)||D(x)||D(x,"source")||D(x,"target")}return o};xr.getAllInBox=function(t,e,r,a){var n=this.getCachedZSortedEles().interactive,i=[],s=Math.min(t,r),o=Math.max(t,r),l=Math.min(e,a),u=Math.max(e,a);t=s,r=o,e=l,a=u;for(var f=gt({x1:t,y1:e,x2:r,y2:a}),h=0;h<n.length;h++){var c=n[h];if(c.isNode()){var v=c,d=v.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});xi(f,d)&&!Vo(d,f)&&i.push(v)}else{var y=c,p=y._private,g=p.rscratch;if(g.startX!=null&&g.startY!=null&&!Gr(f,g.startX,g.startY)||g.endX!=null&&g.endY!=null&&!Gr(f,g.endX,g.endY))continue;if(g.edgeType==="bezier"||g.edgeType==="multibezier"||g.edgeType==="self"||g.edgeType==="compound"||g.edgeType==="segments"||g.edgeType==="haystack"){for(var m=p.rstyle.bezierPts||p.rstyle.linePts||p.rstyle.haystackPts,E=!0,D=0;D<m.length;D++)if(!gh(f,m[D])){E=!1;break}E&&i.push(y)}else(g.edgeType==="haystack"||g.edgeType==="straight")&&i.push(y)}}return i};var pn={};pn.calculateArrowAngles=function(t){var e=t._private.rscratch,r=e.edgeType==="haystack",a=e.edgeType==="bezier",n=e.edgeType==="multibezier",i=e.edgeType==="segments",s=e.edgeType==="compound",o=e.edgeType==="self",l,u,f,h,c,v,g,m;if(r?(f=e.haystackPts[0],h=e.haystackPts[1],c=e.haystackPts[2],v=e.haystackPts[3]):(f=e.arrowStartX,h=e.arrowStartY,c=e.arrowEndX,v=e.arrowEndY),g=e.midX,m=e.midY,i)l=f-e.segpts[0],u=h-e.segpts[1];else if(n||s||o||a){var d=e.allpts,y=Ke(d[0],d[2],d[4],.1),p=Ke(d[1],d[3],d[5],.1);l=f-y,u=h-p}else l=f-g,u=h-m;e.srcArrowAngle=Va(l,u);var g=e.midX,m=e.midY;if(r&&(g=(f+c)/2,m=(h+v)/2),l=c-f,u=v-h,i){var d=e.allpts;if(d.length/2%2===0){var E=d.length/2,D=E-2;l=d[E]-d[D],u=d[E+1]-d[D+1]}else if(e.isRound)l=e.midVector[1],u=-e.midVector[0];else{var E=d.length/2-1,D=E-2;l=d[E]-d[D],u=d[E+1]-d[D+1]}}else if(n||s||o){var d=e.allpts,b=e.ctrlpts,x,w,T,C;if(b.length/2%2===0){var S=d.length/2-1,A=S+2,L=A+2;x=Ke(d[S],d[A],d[L],0),w=Ke(d[S+1],d[A+1],d[L+1],0),T=Ke(d[S],d[A],d[L],1e-4),C=Ke(d[S+1],d[A+1],d[L+1],1e-4)}else{var A=d.length/2-1,S=A-2,L=A+2;x=Ke(d[S],d[A],d[L],.4999),w=Ke(d[S+1],d[A+1],d[L+1],.4999),T=Ke(d[S],d[A],d[L],.5),C=Ke(d[S+1],d[A+1],d[L+1],.5)}l=T-x,u=C-w}if(e.midtgtArrowAngle=Va(l,u),e.midDispX=l,e.midDispY=u,l*=-1,u*=-1,i){var d=e.allpts;if(d.length/2%2!==0){if(!e.isRound){var E=d.length/2-1,I=E+2;l=-(d[I]-d[E]),u=-(d[I+1]-d[E+1])}}}if(e.midsrcArrowAngle=Va(l,u),i)l=c-e.segpts[e.segpts.length-2],u=v-e.segpts[e.segpts.length-1];else if(n||s||o||a){var d=e.allpts,O=d.length,y=Ke(d[O-6],d[O-4],d[O-2],.9),p=Ke(d[O-5],d[O-3],d[O-1],.9);l=c-y,u=v-p}else l=c-g,u=v-m;e.tgtArrowAngle=Va(l,u)};pn.getArrowWidth=pn.getArrowHeight=function(t,e){var r=this.arrowWidthCache=this.arrowWidthCache||{},a=r[t+", "+e];return a||(a=Math.max(Math.pow(t*13.37,.9),29)*e,r[t+", "+e]=a,a)};var si,oi,kt={},bt={},ro,ao,vr,nn,Ut,ur,cr,Rt,Or,Ka,Mu,Ru,ui,li,no,io=function(e,r,a){a.x=r.x-e.x,a.y=r.y-e.y,a.len=Math.sqrt(a.x*a.x+a.y*a.y),a.nx=a.x/a.len,a.ny=a.y/a.len,a.ang=Math.atan2(a.ny,a.nx)},rp=function(e,r){r.x=e.x*-1,r.y=e.y*-1,r.nx=e.nx*-1,r.ny=e.ny*-1,r.ang=e.ang>0?-(Math.PI-e.ang):Math.PI+e.ang},ap=function(e,r,a,n,i){if(e!==no?io(r,e,kt):rp(bt,kt),io(r,a,bt),ro=kt.nx*bt.ny-kt.ny*bt.nx,ao=kt.nx*bt.nx-kt.ny*-bt.ny,Ut=Math.asin(Math.max(-1,Math.min(1,ro))),Math.abs(Ut)<1e-6){si=r.x,oi=r.y,cr=Or=0;return}vr=1,nn=!1,ao<0?Ut<0?Ut=Math.PI+Ut:(Ut=Math.PI-Ut,vr=-1,nn=!0):Ut>0&&(vr=-1,nn=!0),r.radius!==void 0?Or=r.radius:Or=n,ur=Ut/2,Ka=Math.min(kt.len/2,bt.len/2),i?(Rt=Math.abs(Math.cos(ur)*Or/Math.sin(ur)),Rt>Ka?(Rt=Ka,cr=Math.abs(Rt*Math.sin(ur)/Math.cos(ur))):cr=Or):(Rt=Math.min(Ka,Or),cr=Math.abs(Rt*Math.sin(ur)/Math.cos(ur))),ui=r.x+bt.nx*Rt,li=r.y+bt.ny*Rt,si=ui-bt.ny*cr*vr,oi=li+bt.nx*cr*vr,Mu=r.x+kt.nx*Rt,Ru=r.y+kt.ny*Rt,no=r};function ku(t,e){e.radius===0?t.lineTo(e.cx,e.cy):t.arc(e.cx,e.cy,e.radius,e.startAngle,e.endAngle,e.counterClockwise)}function Pi(t,e,r,a){var n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return a===0||e.radius===0?{cx:e.x,cy:e.y,radius:0,startX:e.x,startY:e.y,stopX:e.x,stopY:e.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(ap(t,e,r,a,n),{cx:si,cy:oi,radius:cr,startX:Mu,startY:Ru,stopX:ui,stopY:li,startAngle:kt.ang+Math.PI/2*vr,endAngle:bt.ang-Math.PI/2*vr,counterClockwise:nn})}var ut={};ut.findMidptPtsEtc=function(t,e){var r=e.posPts,a=e.intersectionPts,n=e.vectorNormInverse,i,s=t.pstyle("source-endpoint"),o=t.pstyle("target-endpoint"),l=s.units!=null&&o.units!=null,u=function(b,x,w,T){var C=T-x,S=w-b,A=Math.sqrt(S*S+C*C);return{x:-C/A,y:S/A}},f=t.pstyle("edge-distances").value;switch(f){case"node-position":i=r;break;case"intersection":i=a;break;case"endpoints":{if(l){var h=this.manualEndptToPx(t.source()[0],s),c=St(h,2),v=c[0],d=c[1],y=this.manualEndptToPx(t.target()[0],o),p=St(y,2),g=p[0],m=p[1],E={x1:v,y1:d,x2:g,y2:m};n=u(v,d,g,m),i=E}else Ne("Edge ".concat(t.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")),i=a;break}}return{midptPts:i,vectorNormInverse:n}};ut.findHaystackPoints=function(t){for(var e=0;e<t.length;e++){var r=t[e],a=r._private,n=a.rscratch;if(!n.haystack){var i=Math.random()*2*Math.PI;n.source={x:Math.cos(i),y:Math.sin(i)},i=Math.random()*2*Math.PI,n.target={x:Math.cos(i),y:Math.sin(i)}}var s=a.source,o=a.target,l=s.position(),u=o.position(),f=s.width(),h=o.width(),c=s.height(),v=o.height(),d=r.pstyle("haystack-radius").value,y=d/2;n.haystackPts=n.allpts=[n.source.x*f*y+l.x,n.source.y*c*y+l.y,n.target.x*h*y+u.x,n.target.y*v*y+u.y],n.midX=(n.allpts[0]+n.allpts[2])/2,n.midY=(n.allpts[1]+n.allpts[3])/2,n.edgeType="haystack",n.haystack=!0,this.storeEdgeProjections(r),this.calculateArrowAngles(r),this.recalculateEdgeLabelProjections(r),this.calculateLabelAngles(r)}};ut.findSegmentsPoints=function(t,e){var r=t._private.rscratch,a=t.pstyle("segment-weights"),n=t.pstyle("segment-distances"),i=t.pstyle("segment-radii"),s=t.pstyle("radius-type"),o=Math.min(a.pfValue.length,n.pfValue.length),l=i.pfValue[i.pfValue.length-1],u=s.pfValue[s.pfValue.length-1];r.edgeType="segments",r.segpts=[],r.radii=[],r.isArcRadius=[];for(var f=0;f<o;f++){var h=a.pfValue[f],c=n.pfValue[f],v=1-h,d=h,y=this.findMidptPtsEtc(t,e),p=y.midptPts,g=y.vectorNormInverse,m={x:p.x1*v+p.x2*d,y:p.y1*v+p.y2*d};r.segpts.push(m.x+g.x*c,m.y+g.y*c),r.radii.push(i.pfValue[f]!==void 0?i.pfValue[f]:l),r.isArcRadius.push((s.pfValue[f]!==void 0?s.pfValue[f]:u)==="arc-radius")}};ut.findLoopPoints=function(t,e,r,a){var n=t._private.rscratch,i=e.dirCounts,s=e.srcPos,o=t.pstyle("control-point-distances"),l=o?o.pfValue[0]:void 0,u=t.pstyle("loop-direction").pfValue,f=t.pstyle("loop-sweep").pfValue,h=t.pstyle("control-point-step-size").pfValue;n.edgeType="self";var c=r,v=h;a&&(c=0,v=l);var d=u-Math.PI/2,y=d-f/2,p=d+f/2,g=u+"_"+f;c=i[g]===void 0?i[g]=0:++i[g],n.ctrlpts=[s.x+Math.cos(y)*1.4*v*(c/3+1),s.y+Math.sin(y)*1.4*v*(c/3+1),s.x+Math.cos(p)*1.4*v*(c/3+1),s.y+Math.sin(p)*1.4*v*(c/3+1)]};ut.findCompoundLoopPoints=function(t,e,r,a){var n=t._private.rscratch;n.edgeType="compound";var i=e.srcPos,s=e.tgtPos,o=e.srcW,l=e.srcH,u=e.tgtW,f=e.tgtH,h=t.pstyle("control-point-step-size").pfValue,c=t.pstyle("control-point-distances"),v=c?c.pfValue[0]:void 0,d=r,y=h;a&&(d=0,y=v);var p=50,g={x:i.x-o/2,y:i.y-l/2},m={x:s.x-u/2,y:s.y-f/2},E={x:Math.min(g.x,m.x),y:Math.min(g.y,m.y)},D=.5,b=Math.max(D,Math.log(o*.01)),x=Math.max(D,Math.log(u*.01));n.ctrlpts=[E.x,E.y-(1+Math.pow(p,1.12)/100)*y*(d/3+1)*b,E.x-(1+Math.pow(p,1.12)/100)*y*(d/3+1)*x,E.y]};ut.findStraightEdgePoints=function(t){t._private.rscratch.edgeType="straight"};ut.findBezierPoints=function(t,e,r,a,n){var i=t._private.rscratch,s=t.pstyle("control-point-step-size").pfValue,o=t.pstyle("control-point-distances"),l=t.pstyle("control-point-weights"),u=o&&l?Math.min(o.value.length,l.value.length):1,f=o?o.pfValue[0]:void 0,h=l.value[0],c=a;i.edgeType=c?"multibezier":"bezier",i.ctrlpts=[];for(var v=0;v<u;v++){var d=(.5-e.eles.length/2+r)*s*(n?-1:1),y=void 0,p=Go(d);c&&(f=o?o.pfValue[v]:s,h=l.value[v]),a?y=f:y=f!==void 0?p*f:void 0;var g=y!==void 0?y:d,m=1-h,E=h,D=this.findMidptPtsEtc(t,e),b=D.midptPts,x=D.vectorNormInverse,w={x:b.x1*m+b.x2*E,y:b.y1*m+b.y2*E};i.ctrlpts.push(w.x+x.x*g,w.y+x.y*g)}};ut.findTaxiPoints=function(t,e){var r=t._private.rscratch;r.edgeType="segments";var a="vertical",n="horizontal",i="leftward",s="rightward",o="downward",l="upward",u="auto",f=e.posPts,h=e.srcW,c=e.srcH,v=e.tgtW,d=e.tgtH,y=t.pstyle("edge-distances").value,p=y!=="node-position",g=t.pstyle("taxi-direction").value,m=g,E=t.pstyle("taxi-turn"),D=E.units==="%",b=E.pfValue,x=b<0,w=t.pstyle("taxi-turn-min-distance").pfValue,T=p?(h+v)/2:0,C=p?(c+d)/2:0,S=f.x2-f.x1,A=f.y2-f.y1,L=function(pe,ye){return pe>0?Math.max(pe-ye,0):Math.min(pe+ye,0)},I=L(S,T),O=L(A,C),k=!1;m===u?g=Math.abs(I)>Math.abs(O)?n:a:m===l||m===o?(g=a,k=!0):(m===i||m===s)&&(g=n,k=!0);var R=g===a,M=R?O:I,P=R?A:S,F=Go(P),V=!1;!(k&&(D||x))&&(m===o&&P<0||m===l&&P>0||m===i&&P>0||m===s&&P<0)&&(F*=-1,M=F*Math.abs(M),V=!0);var G;if(D){var B=b<0?1+b:b;G=B*M}else{var Y=b<0?M:0;G=Y+b*F}var Z=function(pe){return Math.abs(pe)<w||Math.abs(pe)>=Math.abs(M)},K=Z(G),U=Z(Math.abs(M)-Math.abs(G)),z=K||U;if(z&&!V)if(R){var _=Math.abs(P)<=c/2,q=Math.abs(S)<=v/2;if(_){var J=(f.x1+f.x2)/2,ee=f.y1,oe=f.y2;r.segpts=[J,ee,J,oe]}else if(q){var me=(f.y1+f.y2)/2,te=f.x1,ie=f.x2;r.segpts=[te,me,ie,me]}else r.segpts=[f.x1,f.y2]}else{var ue=Math.abs(P)<=h/2,ce=Math.abs(A)<=d/2;if(ue){var fe=(f.y1+f.y2)/2,ge=f.x1,Ae=f.x2;r.segpts=[ge,fe,Ae,fe]}else if(ce){var xe=(f.x1+f.x2)/2,we=f.y1,De=f.y2;r.segpts=[xe,we,xe,De]}else r.segpts=[f.x2,f.y1]}else if(R){var j=f.y1+G+(p?c/2*F:0),N=f.x1,$=f.x2;r.segpts=[N,j,$,j]}else{var Q=f.x1+G+(p?h/2*F:0),X=f.y1,H=f.y2;r.segpts=[Q,X,Q,H]}if(r.isRound){var ae=t.pstyle("taxi-radius").value,W=t.pstyle("radius-type").value[0]==="arc-radius";r.radii=new Array(r.segpts.length/2).fill(ae),r.isArcRadius=new Array(r.segpts.length/2).fill(W)}};ut.tryToCorrectInvalidPoints=function(t,e){var r=t._private.rscratch;if(r.edgeType==="bezier"){var a=e.srcPos,n=e.tgtPos,i=e.srcW,s=e.srcH,o=e.tgtW,l=e.tgtH,u=e.srcShape,f=e.tgtShape,h=e.srcCornerRadius,c=e.tgtCornerRadius,v=e.srcRs,d=e.tgtRs,y=!ne(r.startX)||!ne(r.startY),p=!ne(r.arrowStartX)||!ne(r.arrowStartY),g=!ne(r.endX)||!ne(r.endY),m=!ne(r.arrowEndX)||!ne(r.arrowEndY),E=3,D=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth,b=E*D,x=yr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.startX,y:r.startY}),w=x<b,T=yr({x:r.ctrlpts[0],y:r.ctrlpts[1]},{x:r.endX,y:r.endY}),C=T<b,S=!1;if(y||p||w){S=!0;var A={x:r.ctrlpts[0]-a.x,y:r.ctrlpts[1]-a.y},L=Math.sqrt(A.x*A.x+A.y*A.y),I={x:A.x/L,y:A.y/L},O=Math.max(i,s),k={x:r.ctrlpts[0]+I.x*2*O,y:r.ctrlpts[1]+I.y*2*O},R=u.intersectLine(a.x,a.y,i,s,k.x,k.y,0,h,v);w?(r.ctrlpts[0]=r.ctrlpts[0]+I.x*(b-x),r.ctrlpts[1]=r.ctrlpts[1]+I.y*(b-x)):(r.ctrlpts[0]=R[0]+I.x*b,r.ctrlpts[1]=R[1]+I.y*b)}if(g||m||C){S=!0;var M={x:r.ctrlpts[0]-n.x,y:r.ctrlpts[1]-n.y},P=Math.sqrt(M.x*M.x+M.y*M.y),F={x:M.x/P,y:M.y/P},V=Math.max(i,s),G={x:r.ctrlpts[0]+F.x*2*V,y:r.ctrlpts[1]+F.y*2*V},B=f.intersectLine(n.x,n.y,o,l,G.x,G.y,0,c,d);C?(r.ctrlpts[0]=r.ctrlpts[0]+F.x*(b-T),r.ctrlpts[1]=r.ctrlpts[1]+F.y*(b-T)):(r.ctrlpts[0]=B[0]+F.x*b,r.ctrlpts[1]=B[1]+F.y*b)}S&&this.findEndpoints(t)}};ut.storeAllpts=function(t){var e=t._private.rscratch;if(e.edgeType==="multibezier"||e.edgeType==="bezier"||e.edgeType==="self"||e.edgeType==="compound"){e.allpts=[],e.allpts.push(e.startX,e.startY);for(var r=0;r+1<e.ctrlpts.length;r+=2)e.allpts.push(e.ctrlpts[r],e.ctrlpts[r+1]),r+3<e.ctrlpts.length&&e.allpts.push((e.ctrlpts[r]+e.ctrlpts[r+2])/2,(e.ctrlpts[r+1]+e.ctrlpts[r+3])/2);e.allpts.push(e.endX,e.endY);var a,n;e.ctrlpts.length/2%2===0?(a=e.allpts.length/2-1,e.midX=e.allpts[a],e.midY=e.allpts[a+1]):(a=e.allpts.length/2-3,n=.5,e.midX=Ke(e.allpts[a],e.allpts[a+2],e.allpts[a+4],n),e.midY=Ke(e.allpts[a+1],e.allpts[a+3],e.allpts[a+5],n))}else if(e.edgeType==="straight")e.allpts=[e.startX,e.startY,e.endX,e.endY],e.midX=(e.startX+e.endX+e.arrowStartX+e.arrowEndX)/4,e.midY=(e.startY+e.endY+e.arrowStartY+e.arrowEndY)/4;else if(e.edgeType==="segments"){if(e.allpts=[],e.allpts.push(e.startX,e.startY),e.allpts.push.apply(e.allpts,e.segpts),e.allpts.push(e.endX,e.endY),e.isRound){e.roundCorners=[];for(var i=2;i+3<e.allpts.length;i+=2){var s=e.radii[i/2-1],o=e.isArcRadius[i/2-1];e.roundCorners.push(Pi({x:e.allpts[i-2],y:e.allpts[i-1]},{x:e.allpts[i],y:e.allpts[i+1],radius:s},{x:e.allpts[i+2],y:e.allpts[i+3]},s,o))}}if(e.segpts.length%4===0){var l=e.segpts.length/2,u=l-2;e.midX=(e.segpts[u]+e.segpts[l])/2,e.midY=(e.segpts[u+1]+e.segpts[l+1])/2}else{var f=e.segpts.length/2-1;if(!e.isRound)e.midX=e.segpts[f],e.midY=e.segpts[f+1];else{var h={x:e.segpts[f],y:e.segpts[f+1]},c=e.roundCorners[f/2],v=[h.x-c.cx,h.y-c.cy],d=c.radius/Math.sqrt(Math.pow(v[0],2)+Math.pow(v[1],2));v=v.map(function(y){return y*d}),e.midX=c.cx+v[0],e.midY=c.cy+v[1],e.midVector=v}}}};ut.checkForInvalidEdgeWarning=function(t){var e=t[0]._private.rscratch;e.nodesOverlap||ne(e.startX)&&ne(e.startY)&&ne(e.endX)&&ne(e.endY)?e.loggedErr=!1:e.loggedErr||(e.loggedErr=!0,Ne("Edge `"+t.id()+"` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap."))};ut.findEdgeControlPoints=function(t){var e=this;if(!(!t||t.length===0)){for(var r=this,a=r.cy,n=a.hasCompoundNodes(),i={map:new Bt,get:function(w){var T=this.map.get(w[0]);return T!=null?T.get(w[1]):null},set:function(w,T){var C=this.map.get(w[0]);C==null&&(C=new Bt,this.map.set(w[0],C)),C.set(w[1],T)}},s=[],o=[],l=0;l<t.length;l++){var u=t[l],f=u._private,h=u.pstyle("curve-style").value;if(!(u.removed()||!u.takesUpSpace())){if(h==="haystack"){o.push(u);continue}var c=h==="unbundled-bezier"||h.endsWith("segments")||h==="straight"||h==="straight-triangle"||h.endsWith("taxi"),v=h==="unbundled-bezier"||h==="bezier",d=f.source,y=f.target,p=d.poolIndex(),g=y.poolIndex(),m=[p,g].sort(),E=i.get(m);E==null&&(E={eles:[]},i.set(m,E),s.push(m)),E.eles.push(u),c&&(E.hasUnbundled=!0),v&&(E.hasBezier=!0)}}for(var D=function(w){var T=s[w],C=i.get(T),S=void 0;if(!C.hasUnbundled){var A=C.eles[0].parallelEdges().filter(function(Q){return Q.isBundledBezier()});Ei(C.eles),A.forEach(function(Q){return C.eles.push(Q)}),C.eles.sort(function(Q,X){return Q.poolIndex()-X.poolIndex()})}var L=C.eles[0],I=L.source(),O=L.target();if(I.poolIndex()>O.poolIndex()){var k=I;I=O,O=k}var R=C.srcPos=I.position(),M=C.tgtPos=O.position(),P=C.srcW=I.outerWidth(),F=C.srcH=I.outerHeight(),V=C.tgtW=O.outerWidth(),G=C.tgtH=O.outerHeight(),B=C.srcShape=r.nodeShapes[e.getNodeShape(I)],Y=C.tgtShape=r.nodeShapes[e.getNodeShape(O)],Z=C.srcCornerRadius=I.pstyle("corner-radius").value==="auto"?"auto":I.pstyle("corner-radius").pfValue,K=C.tgtCornerRadius=O.pstyle("corner-radius").value==="auto"?"auto":O.pstyle("corner-radius").pfValue,U=C.tgtRs=O._private.rscratch,z=C.srcRs=I._private.rscratch;C.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var _=0;_<C.eles.length;_++){var q=C.eles[_],J=q[0]._private.rscratch,ee=q.pstyle("curve-style").value,oe=ee==="unbundled-bezier"||ee.endsWith("segments")||ee.endsWith("taxi"),me=!I.same(q.source());if(!C.calculatedIntersection&&I!==O&&(C.hasBezier||C.hasUnbundled)){C.calculatedIntersection=!0;var te=B.intersectLine(R.x,R.y,P,F,M.x,M.y,0,Z,z),ie=C.srcIntn=te,ue=Y.intersectLine(M.x,M.y,V,G,R.x,R.y,0,K,U),ce=C.tgtIntn=ue,fe=C.intersectionPts={x1:te[0],x2:ue[0],y1:te[1],y2:ue[1]},ge=C.posPts={x1:R.x,x2:M.x,y1:R.y,y2:M.y},Ae=ue[1]-te[1],xe=ue[0]-te[0],we=Math.sqrt(xe*xe+Ae*Ae),De=C.vector={x:xe,y:Ae},j=C.vectorNorm={x:De.x/we,y:De.y/we},N={x:-j.y,y:j.x};C.nodesOverlap=!ne(we)||Y.checkPoint(te[0],te[1],0,V,G,M.x,M.y,K,U)||B.checkPoint(ue[0],ue[1],0,P,F,R.x,R.y,Z,z),C.vectorNormInverse=N,S={nodesOverlap:C.nodesOverlap,dirCounts:C.dirCounts,calculatedIntersection:!0,hasBezier:C.hasBezier,hasUnbundled:C.hasUnbundled,eles:C.eles,srcPos:M,tgtPos:R,srcW:V,srcH:G,tgtW:P,tgtH:F,srcIntn:ce,tgtIntn:ie,srcShape:Y,tgtShape:B,posPts:{x1:ge.x2,y1:ge.y2,x2:ge.x1,y2:ge.y1},intersectionPts:{x1:fe.x2,y1:fe.y2,x2:fe.x1,y2:fe.y1},vector:{x:-De.x,y:-De.y},vectorNorm:{x:-j.x,y:-j.y},vectorNormInverse:{x:-N.x,y:-N.y}}}var $=me?S:C;J.nodesOverlap=$.nodesOverlap,J.srcIntn=$.srcIntn,J.tgtIntn=$.tgtIntn,J.isRound=ee.startsWith("round"),n&&(I.isParent()||I.isChild()||O.isParent()||O.isChild())&&(I.parents().anySame(O)||O.parents().anySame(I)||I.same(O)&&I.isParent())?e.findCompoundLoopPoints(q,$,_,oe):I===O?e.findLoopPoints(q,$,_,oe):ee.endsWith("segments")?e.findSegmentsPoints(q,$):ee.endsWith("taxi")?e.findTaxiPoints(q,$):ee==="straight"||!oe&&C.eles.length%2===1&&_===Math.floor(C.eles.length/2)?e.findStraightEdgePoints(q):e.findBezierPoints(q,$,_,oe,me),e.findEndpoints(q),e.tryToCorrectInvalidPoints(q,$),e.checkForInvalidEdgeWarning(q),e.storeAllpts(q),e.storeEdgeProjections(q),e.calculateArrowAngles(q),e.recalculateEdgeLabelProjections(q),e.calculateLabelAngles(q)}},b=0;b<s.length;b++)D(b);this.findHaystackPoints(o)}};function Pu(t){var e=[];if(t!=null){for(var r=0;r<t.length;r+=2){var a=t[r],n=t[r+1];e.push({x:a,y:n})}return e}}ut.getSegmentPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="segments")return this.recalculateRenderedStyle(t),Pu(e.segpts)};ut.getControlPoints=function(t){var e=t[0]._private.rscratch,r=e.edgeType;if(r==="bezier"||r==="multibezier"||r==="self"||r==="compound")return this.recalculateRenderedStyle(t),Pu(e.ctrlpts)};ut.getEdgeMidpoint=function(t){var e=t[0]._private.rscratch;return this.recalculateRenderedStyle(t),{x:e.midX,y:e.midY}};var Na={};Na.manualEndptToPx=function(t,e){var r=this,a=t.position(),n=t.outerWidth(),i=t.outerHeight(),s=t._private.rscratch;if(e.value.length===2){var o=[e.pfValue[0],e.pfValue[1]];return e.units[0]==="%"&&(o[0]=o[0]*n),e.units[1]==="%"&&(o[1]=o[1]*i),o[0]+=a.x,o[1]+=a.y,o}else{var l=e.pfValue[0];l=-Math.PI/2+l;var u=2*Math.max(n,i),f=[a.x+Math.cos(l)*u,a.y+Math.sin(l)*u];return r.nodeShapes[this.getNodeShape(t)].intersectLine(a.x,a.y,n,i,f[0],f[1],0,t.pstyle("corner-radius").value==="auto"?"auto":t.pstyle("corner-radius").pfValue,s)}};Na.findEndpoints=function(t){var e=this,r,a=t.source()[0],n=t.target()[0],i=a.position(),s=n.position(),o=t.pstyle("target-arrow-shape").value,l=t.pstyle("source-arrow-shape").value,u=t.pstyle("target-distance-from-node").pfValue,f=t.pstyle("source-distance-from-node").pfValue,h=a._private.rscratch,c=n._private.rscratch,v=t.pstyle("curve-style").value,d=t._private.rscratch,y=d.edgeType,p=v==="taxi",g=y==="self"||y==="compound",m=y==="bezier"||y==="multibezier"||g,E=y!=="bezier",D=y==="straight"||y==="segments",b=y==="segments",x=m||E||D,w=g||p,T=t.pstyle("source-endpoint"),C=w?"outside-to-node":T.value,S=a.pstyle("corner-radius").value==="auto"?"auto":a.pstyle("corner-radius").pfValue,A=t.pstyle("target-endpoint"),L=w?"outside-to-node":A.value,I=n.pstyle("corner-radius").value==="auto"?"auto":n.pstyle("corner-radius").pfValue;d.srcManEndpt=T,d.tgtManEndpt=A;var O,k,R,M;if(m){var P=[d.ctrlpts[0],d.ctrlpts[1]],F=E?[d.ctrlpts[d.ctrlpts.length-2],d.ctrlpts[d.ctrlpts.length-1]]:P;O=F,k=P}else if(D){var V=b?d.segpts.slice(0,2):[s.x,s.y],G=b?d.segpts.slice(d.segpts.length-2):[i.x,i.y];O=G,k=V}if(L==="inside-to-node")r=[s.x,s.y];else if(A.units)r=this.manualEndptToPx(n,A);else if(L==="outside-to-line")r=d.tgtIntn;else if(L==="outside-to-node"||L==="outside-to-node-or-label"?R=O:(L==="outside-to-line"||L==="outside-to-line-or-label")&&(R=[i.x,i.y]),r=e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x,s.y,n.outerWidth(),n.outerHeight(),R[0],R[1],0,I,c),L==="outside-to-node-or-label"||L==="outside-to-line-or-label"){var B=n._private.rscratch,Y=B.labelWidth,Z=B.labelHeight,K=B.labelX,U=B.labelY,z=Y/2,_=Z/2,q=n.pstyle("text-valign").value;q==="top"?U-=_:q==="bottom"&&(U+=_);var J=n.pstyle("text-halign").value;J==="left"?K-=z:J==="right"&&(K+=z);var ee=ma(R[0],R[1],[K-z,U-_,K+z,U-_,K+z,U+_,K-z,U+_],s.x,s.y);if(ee.length>0){var oe=i,me=fr(oe,Ir(r)),te=fr(oe,Ir(ee)),ie=me;if(te<me&&(r=ee,ie=te),ee.length>2){var ue=fr(oe,{x:ee[2],y:ee[3]});ue<ie&&(r=[ee[2],ee[3]])}}}var ce=Ua(r,O,e.arrowShapes[o].spacing(t)+u),fe=Ua(r,O,e.arrowShapes[o].gap(t)+u);if(d.endX=fe[0],d.endY=fe[1],d.arrowEndX=ce[0],d.arrowEndY=ce[1],C==="inside-to-node")r=[i.x,i.y];else if(T.units)r=this.manualEndptToPx(a,T);else if(C==="outside-to-line")r=d.srcIntn;else if(C==="outside-to-node"||C==="outside-to-node-or-label"?M=k:(C==="outside-to-line"||C==="outside-to-line-or-label")&&(M=[s.x,s.y]),r=e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x,i.y,a.outerWidth(),a.outerHeight(),M[0],M[1],0,S,h),C==="outside-to-node-or-label"||C==="outside-to-line-or-label"){var ge=a._private.rscratch,Ae=ge.labelWidth,xe=ge.labelHeight,we=ge.labelX,De=ge.labelY,j=Ae/2,N=xe/2,$=a.pstyle("text-valign").value;$==="top"?De-=N:$==="bottom"&&(De+=N);var Q=a.pstyle("text-halign").value;Q==="left"?we-=j:Q==="right"&&(we+=j);var X=ma(M[0],M[1],[we-j,De-N,we+j,De-N,we+j,De+N,we-j,De+N],i.x,i.y);if(X.length>0){var H=s,ae=fr(H,Ir(r)),W=fr(H,Ir(X)),re=ae;if(W<ae&&(r=[X[0],X[1]],re=W),X.length>2){var pe=fr(H,{x:X[2],y:X[3]});pe<re&&(r=[X[2],X[3]])}}}var ye=Ua(r,k,e.arrowShapes[l].spacing(t)+f),he=Ua(r,k,e.arrowShapes[l].gap(t)+f);d.startX=he[0],d.startY=he[1],d.arrowStartX=ye[0],d.arrowStartY=ye[1],x&&(!ne(d.startX)||!ne(d.startY)||!ne(d.endX)||!ne(d.endY)?d.badLine=!0:d.badLine=!1)};Na.getSourceEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[0],y:e.haystackPts[1]};default:return{x:e.arrowStartX,y:e.arrowStartY}}};Na.getTargetEndpoint=function(t){var e=t[0]._private.rscratch;switch(this.recalculateRenderedStyle(t),e.edgeType){case"haystack":return{x:e.haystackPts[2],y:e.haystackPts[3]};default:return{x:e.arrowEndX,y:e.arrowEndY}}};var Bi={};function np(t,e,r){for(var a=function(u,f,h,c){return Ke(u,f,h,c)},n=e._private,i=n.rstyle.bezierPts,s=0;s<t.bezierProjPcts.length;s++){var o=t.bezierProjPcts[s];i.push({x:a(r[0],r[2],r[4],o),y:a(r[1],r[3],r[5],o)})}}Bi.storeEdgeProjections=function(t){var e=t._private,r=e.rscratch,a=r.edgeType;if(e.rstyle.bezierPts=null,e.rstyle.linePts=null,e.rstyle.haystackPts=null,a==="multibezier"||a==="bezier"||a==="self"||a==="compound"){e.rstyle.bezierPts=[];for(var n=0;n+5<r.allpts.length;n+=4)np(this,t,r.allpts.slice(n,n+6))}else if(a==="segments")for(var i=e.rstyle.linePts=[],n=0;n+1<r.allpts.length;n+=2)i.push({x:r.allpts[n],y:r.allpts[n+1]});else if(a==="haystack"){var s=r.haystackPts;e.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}e.rstyle.arrowWidth=this.getArrowWidth(t.pstyle("width").pfValue,t.pstyle("arrow-scale").value)*this.arrowShapeWidth};Bi.recalculateEdgeProjections=function(t){this.findEdgeControlPoints(t)};var Gt={};Gt.recalculateNodeLabelProjection=function(t){var e=t.pstyle("label").strValue;if(!tr(e)){var r,a,n=t._private,i=t.width(),s=t.height(),o=t.padding(),l=t.position(),u=t.pstyle("text-halign").strValue,f=t.pstyle("text-valign").strValue,h=n.rscratch,c=n.rstyle;switch(u){case"left":r=l.x-i/2-o;break;case"right":r=l.x+i/2+o;break;default:r=l.x}switch(f){case"top":a=l.y-s/2-o;break;case"bottom":a=l.y+s/2+o;break;default:a=l.y}h.labelX=r,h.labelY=a,c.labelX=r,c.labelY=a,this.calculateLabelAngles(t),this.applyLabelDimensions(t)}};var Bu=function(e,r){var a=Math.atan(r/e);return e===0&&a<0&&(a=a*-1),a},Fu=function(e,r){var a=r.x-e.x,n=r.y-e.y;return Bu(a,n)},ip=function(e,r,a,n){var i=ya(0,n-.001,1),s=ya(0,n+.001,1),o=Rr(e,r,a,i),l=Rr(e,r,a,s);return Fu(o,l)};Gt.recalculateEdgeLabelProjections=function(t){var e,r=t._private,a=r.rscratch,n=this,i={mid:t.pstyle("label").strValue,source:t.pstyle("source-label").strValue,target:t.pstyle("target-label").strValue};if(i.mid||i.source||i.target){e={x:a.midX,y:a.midY};var s=function(h,c,v){Qt(r.rscratch,h,c,v),Qt(r.rstyle,h,c,v)};s("labelX",null,e.x),s("labelY",null,e.y);var o=Bu(a.midDispX,a.midDispY);s("labelAutoAngle",null,o);var l=function f(){if(f.cache)return f.cache;for(var h=[],c=0;c+5<a.allpts.length;c+=4){var v={x:a.allpts[c],y:a.allpts[c+1]},d={x:a.allpts[c+2],y:a.allpts[c+3]},y={x:a.allpts[c+4],y:a.allpts[c+5]};h.push({p0:v,p1:d,p2:y,startDist:0,length:0,segments:[]})}var p=r.rstyle.bezierPts,g=n.bezierProjPcts.length;function m(w,T,C,S,A){var L=yr(T,C),I=w.segments[w.segments.length-1],O={p0:T,p1:C,t0:S,t1:A,startDist:I?I.startDist+I.length:0,length:L};w.segments.push(O),w.length+=L}for(var E=0;E<h.length;E++){var D=h[E],b=h[E-1];b&&(D.startDist=b.startDist+b.length),m(D,D.p0,p[E*g],0,n.bezierProjPcts[0]);for(var x=0;x<g-1;x++)m(D,p[E*g+x],p[E*g+x+1],n.bezierProjPcts[x],n.bezierProjPcts[x+1]);m(D,p[E*g+g-1],D.p2,n.bezierProjPcts[g-1],1)}return f.cache=h},u=function(h){var c,v=h==="source";if(i[h]){var d=t.pstyle(h+"-text-offset").pfValue;switch(a.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var y=l(),p,g=0,m=0,E=0;E<y.length;E++){for(var D=y[v?E:y.length-1-E],b=0;b<D.segments.length;b++){var x=D.segments[v?b:D.segments.length-1-b],w=E===y.length-1&&b===D.segments.length-1;if(g=m,m+=x.length,m>=d||w){p={cp:D,segment:x};break}}if(p)break}var T=p.cp,C=p.segment,S=(d-g)/C.length,A=C.t1-C.t0,L=v?C.t0+A*S:C.t1-A*S;L=ya(0,L,1),e=Rr(T.p0,T.p1,T.p2,L),c=ip(T.p0,T.p1,T.p2,L);break}case"straight":case"segments":case"haystack":{for(var I=0,O,k,R,M,P=a.allpts.length,F=0;F+3<P&&(v?(R={x:a.allpts[F],y:a.allpts[F+1]},M={x:a.allpts[F+2],y:a.allpts[F+3]}):(R={x:a.allpts[P-2-F],y:a.allpts[P-1-F]},M={x:a.allpts[P-4-F],y:a.allpts[P-3-F]}),O=yr(R,M),k=I,I+=O,!(I>=d));F+=2);var V=d-k,G=V/O;G=ya(0,G,1),e=fh(R,M,G),c=Fu(R,M);break}}s("labelX",h,e.x),s("labelY",h,e.y),s("labelAutoAngle",h,c)}};u("source"),u("target"),this.applyLabelDimensions(t)}};Gt.applyLabelDimensions=function(t){this.applyPrefixedLabelDimensions(t),t.isEdge()&&(this.applyPrefixedLabelDimensions(t,"source"),this.applyPrefixedLabelDimensions(t,"target"))};Gt.applyPrefixedLabelDimensions=function(t,e){var r=t._private,a=this.getLabelText(t,e),n=this.calculateLabelDimensions(t,a),i=t.pstyle("line-height").pfValue,s=t.pstyle("text-wrap").strValue,o=At(r.rscratch,"labelWrapCachedLines",e)||[],l=s!=="wrap"?1:Math.max(o.length,1),u=n.height/l,f=u*i,h=n.width,c=n.height+(l-1)*(i-1)*u;Qt(r.rstyle,"labelWidth",e,h),Qt(r.rscratch,"labelWidth",e,h),Qt(r.rstyle,"labelHeight",e,c),Qt(r.rscratch,"labelHeight",e,c),Qt(r.rscratch,"labelLineHeight",e,f)};Gt.getLabelText=function(t,e){var r=t._private,a=e?e+"-":"",n=t.pstyle(a+"label").strValue,i=t.pstyle("text-transform").value,s=function(V,G){return G?(Qt(r.rscratch,V,e,G),G):At(r.rscratch,V,e)};if(!n)return"";i=="none"||(i=="uppercase"?n=n.toUpperCase():i=="lowercase"&&(n=n.toLowerCase()));var o=t.pstyle("text-wrap").value;if(o==="wrap"){var l=s("labelKey");if(l!=null&&s("labelWrapKey")===l)return s("labelWrapCachedText");for(var u="\u200B",f=n.split(`
`),h=t.pstyle("text-max-width").pfValue,c=t.pstyle("text-overflow-wrap").value,v=c==="anywhere",d=[],y=/[\s\u200b]+/,p=v?"":" ",g=0;g<f.length;g++){var m=f[g],E=this.calculateLabelDimensions(t,m),D=E.width;if(v){var b=m.split("").join(u);m=b}if(D>h){for(var x=m.split(y),w="",T=0;T<x.length;T++){var C=x[T],S=w.length===0?C:w+p+C,A=this.calculateLabelDimensions(t,S),L=A.width;L<=h?w+=C+p:(w&&d.push(w),w=C+p)}w.match(/^[\s\u200b]+$/)||d.push(w)}else d.push(m)}s("labelWrapCachedLines",d),n=s("labelWrapCachedText",d.join(`
`)),s("labelWrapKey",l)}else if(o==="ellipsis"){var I=t.pstyle("text-max-width").pfValue,O="",k="\u2026",R=!1;if(this.calculateLabelDimensions(t,n).width<I)return n;for(var M=0;M<n.length;M++){var P=this.calculateLabelDimensions(t,O+n[M]+k).width;if(P>I)break;O+=n[M],M===n.length-1&&(R=!0)}return R||(O+=k),O}return n};Gt.getLabelJustification=function(t){var e=t.pstyle("text-justification").strValue,r=t.pstyle("text-halign").strValue;if(e==="auto")if(t.isNode())switch(r){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return e};Gt.calculateLabelDimensions=function(t,e){var r=this,a=pr(e,t._private.labelDimsKey),n=r.labelDimCache||(r.labelDimCache=[]),i=n[a];if(i!=null)return i;var s=0,o=t.pstyle("font-style").strValue,l=t.pstyle("font-size").pfValue,u=t.pstyle("font-family").strValue,f=t.pstyle("font-weight").strValue,h=this.labelCalcCanvas,c=this.labelCalcCanvasContext;if(!h){h=this.labelCalcCanvas=document.createElement("canvas"),c=this.labelCalcCanvasContext=h.getContext("2d");var v=h.style;v.position="absolute",v.left="-9999px",v.top="-9999px",v.zIndex="-1",v.visibility="hidden",v.pointerEvents="none"}c.font="".concat(o," ").concat(f," ").concat(l,"px ").concat(u);for(var d=0,y=0,p=e.split(`
`),g=0;g<p.length;g++){var m=p[g],E=c.measureText(m),D=Math.ceil(E.width),b=l;d=Math.max(D,d),y+=b}return d+=s,y+=s,n[a]={width:d,height:y}};Gt.calculateLabelAngle=function(t,e){var r=t._private,a=r.rscratch,n=t.isEdge(),i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=s.strValue;return o==="none"?0:n&&o==="autorotate"?a.labelAutoAngle:o==="autorotate"?0:s.pfValue};Gt.calculateLabelAngles=function(t){var e=this,r=t.isEdge(),a=t._private,n=a.rscratch;n.labelAngle=e.calculateLabelAngle(t),r&&(n.sourceLabelAngle=e.calculateLabelAngle(t,"source"),n.targetLabelAngle=e.calculateLabelAngle(t,"target"))};var Gu={},so=28,oo=!1;Gu.getNodeShape=function(t){var e=this,r=t.pstyle("shape").value;if(r==="cutrectangle"&&(t.width()<so||t.height()<so))return oo||(Ne("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),oo=!0),"rectangle";if(t.isParent())return r==="rectangle"||r==="roundrectangle"||r==="round-rectangle"||r==="cutrectangle"||r==="cut-rectangle"||r==="barrel"?r:"rectangle";if(r==="polygon"){var a=t.pstyle("shape-polygon-points").value;return e.nodeShapes.makePolygon(a).name}return r};var kn={};kn.registerCalculationListeners=function(){var t=this.cy,e=t.collection(),r=this,a=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(e.merge(s),o)for(var l=0;l<s.length;l++){var u=s[l],f=u._private,h=f.rstyle;h.clean=!1,h.cleanConnected=!1}};r.binder(t).on("bounds.* dirty.*",function(s){var o=s.target;a(o)}).on("style.* background.*",function(s){var o=s.target;a(o,!1)});var n=function(s){if(s){var o=r.onUpdateEleCalcsFns;e.cleanStyle();for(var l=0;l<e.length;l++){var u=e[l],f=u._private.rstyle;u.isNode()&&!f.cleanConnected&&(a(u.connectedEdges()),f.cleanConnected=!0)}if(o)for(var h=0;h<o.length;h++){var c=o[h];c(s,e)}r.recalculateRenderedStyle(e),e=t.collection()}};r.flushRenderedStyleQueue=function(){n(!0)},r.beforeRender(n,r.beforeRenderPriorities.eleCalcs)};kn.onUpdateEleCalcs=function(t){var e=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];e.push(t)};kn.recalculateRenderedStyle=function(t,e){var r=function(D){return D._private.rstyle.cleanConnected},a=[],n=[];if(!this.destroyed){e===void 0&&(e=!0);for(var i=0;i<t.length;i++){var s=t[i],o=s._private,l=o.rstyle;s.isEdge()&&(!r(s.source())||!r(s.target()))&&(l.clean=!1),!(e&&l.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?n.push(s):a.push(s),l.clean=!0)}for(var u=0;u<n.length;u++){var f=n[u],h=f._private,c=h.rstyle,v=f.position();this.recalculateNodeLabelProjection(f),c.nodeX=v.x,c.nodeY=v.y,c.nodeW=f.pstyle("width").pfValue,c.nodeH=f.pstyle("height").pfValue}this.recalculateEdgeProjections(a);for(var d=0;d<a.length;d++){var y=a[d],p=y._private,g=p.rstyle,m=p.rscratch;g.srcX=m.arrowStartX,g.srcY=m.arrowStartY,g.tgtX=m.arrowEndX,g.tgtY=m.arrowEndY,g.midX=m.midX,g.midY=m.midY,g.labelAngle=m.labelAngle,g.sourceLabelAngle=m.sourceLabelAngle,g.targetLabelAngle=m.targetLabelAngle}}};var Pn={};Pn.updateCachedGrabbedEles=function(){var t=this.cachedZSortedEles;if(t){t.drag=[],t.nondrag=[];for(var e=[],r=0;r<t.length;r++){var a=t[r],n=a._private.rscratch;a.grabbed()&&!a.isParent()?e.push(a):n.inDragLayer?t.drag.push(a):t.nondrag.push(a)}for(var r=0;r<e.length;r++){var a=e[r];t.drag.push(a)}}};Pn.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null};Pn.getCachedZSortedEles=function(t){if(t||!this.cachedZSortedEles){var e=this.cy.mutableElements().toArray();e.sort(wu),e.interactive=e.filter(function(r){return r.interactive()}),this.cachedZSortedEles=e,this.updateCachedGrabbedEles()}else e=this.cachedZSortedEles;return e};var zu={};[xr,pn,ut,Na,Bi,Gt,Gu,kn,Pn].forEach(function(t){be(zu,t)});var Vu={};Vu.getCachedImage=function(t,e,r){var a=this,n=a.imageCache=a.imageCache||{},i=n[t];if(i)return i.image.complete||i.image.addEventListener("load",r),i.image;i=n[t]=n[t]||{};var s=i.image=new Image;s.addEventListener("load",r),s.addEventListener("error",function(){s.error=!0});var o="data:",l=t.substring(0,o.length).toLowerCase()===o;return l||(e=e==="null"?null:e,s.crossOrigin=e),s.src=t,s};var Wr={};Wr.registerBinding=function(t,e,r,a){var n=Array.prototype.slice.apply(arguments,[1]),i=this.binder(t);return i.on.apply(i,n)};Wr.binder=function(t){var e=this,r=e.cy.window(),a=t===r||t===r.document||t===r.document.body||Ol(t);if(e.supportsPassiveEvents==null){var n=!1;try{var i=Object.defineProperty({},"passive",{get:function(){return n=!0,!0}});r.addEventListener("test",null,i)}catch(o){}e.supportsPassiveEvents=n}var s=function(l,u,f){var h=Array.prototype.slice.call(arguments);return a&&e.supportsPassiveEvents&&(h[2]={capture:f!=null?f:!1,passive:!1,once:!1}),e.bindings.push({target:t,args:h}),(t.addEventListener||t.on).apply(t,h),this};return{on:s,addEventListener:s,addListener:s,bind:s}};Wr.nodeIsDraggable=function(t){return t&&t.isNode()&&!t.locked()&&t.grabbable()};Wr.nodeIsGrabbable=function(t){return this.nodeIsDraggable(t)&&t.interactive()};Wr.load=function(){var t=this,e=t.cy.window(),r=function(N){return N.selected()},a=function(N,$,Q,X){N==null&&(N=t.cy);for(var H=0;H<$.length;H++){var ae=$[H];N.emit({originalEvent:Q,type:ae,position:X})}},n=function(N){return N.shiftKey||N.metaKey||N.ctrlKey},i=function(N,$){var Q=!0;if(t.cy.hasCompoundNodes()&&N&&N.pannable())for(var X=0;$&&X<$.length;X++){var N=$[X];if(N.isNode()&&N.isParent()&&!N.pannable()){Q=!1;break}}else Q=!0;return Q},s=function(N){N[0]._private.grabbed=!0},o=function(N){N[0]._private.grabbed=!1},l=function(N){N[0]._private.rscratch.inDragLayer=!0},u=function(N){N[0]._private.rscratch.inDragLayer=!1},f=function(N){N[0]._private.rscratch.isGrabTarget=!0},h=function(N){N[0]._private.rscratch.isGrabTarget=!1},c=function(N,$){var Q=$.addToList,X=Q.has(N);!X&&N.grabbable()&&!N.locked()&&(Q.merge(N),s(N))},v=function(N,$){if(N.cy().hasCompoundNodes()&&!($.inDragLayer==null&&$.addToList==null)){var Q=N.descendants();$.inDragLayer&&(Q.forEach(l),Q.connectedEdges().forEach(l)),$.addToList&&c(Q,$)}},d=function(N,$){$=$||{};var Q=N.cy().hasCompoundNodes();$.inDragLayer&&(N.forEach(l),N.neighborhood().stdFilter(function(X){return!Q||X.isEdge()}).forEach(l)),$.addToList&&N.forEach(function(X){c(X,$)}),v(N,$),g(N,{inDragLayer:$.inDragLayer}),t.updateCachedGrabbedEles()},y=d,p=function(N){N&&(t.getCachedZSortedEles().forEach(function($){o($),u($),h($)}),t.updateCachedGrabbedEles())},g=function(N,$){if(!($.inDragLayer==null&&$.addToList==null)&&N.cy().hasCompoundNodes()){var Q=N.ancestors().orphans();if(!Q.same(N)){var X=Q.descendants().spawnSelf().merge(Q).unmerge(N).unmerge(N.descendants()),H=X.connectedEdges();$.inDragLayer&&(H.forEach(l),X.forEach(l)),$.addToList&&X.forEach(function(ae){c(ae,$)})}}},m=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},E=typeof MutationObserver!="undefined",D=typeof ResizeObserver!="undefined";E?(t.removeObserver=new MutationObserver(function(j){for(var N=0;N<j.length;N++){var $=j[N],Q=$.removedNodes;if(Q)for(var X=0;X<Q.length;X++){var H=Q[X];if(H===t.container){t.destroy();break}}}}),t.container.parentNode&&t.removeObserver.observe(t.container.parentNode,{childList:!0})):t.registerBinding(t.container,"DOMNodeRemoved",function(j){t.destroy()});var b=En(function(){t.cy.resize()},100);E&&(t.styleObserver=new MutationObserver(b),t.styleObserver.observe(t.container,{attributes:!0})),t.registerBinding(e,"resize",b),D&&(t.resizeObserver=new ResizeObserver(b),t.resizeObserver.observe(t.container));var x=function(N,$){for(;N!=null;)$(N),N=N.parentNode},w=function(){t.invalidateContainerClientCoordsCache()};x(t.container,function(j){t.registerBinding(j,"transitionend",w),t.registerBinding(j,"animationend",w),t.registerBinding(j,"scroll",w)}),t.registerBinding(t.container,"contextmenu",function(j){j.preventDefault()});var T=function(){return t.selection[4]!==0},C=function(N){for(var $=t.findContainerClientCoords(),Q=$[0],X=$[1],H=$[2],ae=$[3],W=N.touches?N.touches:[N],re=!1,pe=0;pe<W.length;pe++){var ye=W[pe];if(Q<=ye.clientX&&ye.clientX<=Q+H&&X<=ye.clientY&&ye.clientY<=X+ae){re=!0;break}}if(!re)return!1;for(var he=t.container,Ee=N.target,le=Ee.parentNode,de=!1;le;){if(le===he){de=!0;break}le=le.parentNode}return!!de};t.registerBinding(t.container,"mousedown",function(N){if(C(N)){N.preventDefault(),m(),t.hoverData.capture=!0,t.hoverData.which=N.which;var $=t.cy,Q=[N.clientX,N.clientY],X=t.projectIntoViewport(Q[0],Q[1]),H=t.selection,ae=t.findNearestElements(X[0],X[1],!0,!1),W=ae[0],re=t.dragData.possibleDragElements;t.hoverData.mdownPos=X,t.hoverData.mdownGPos=Q;var pe=function(){t.hoverData.tapholdCancelled=!1,clearTimeout(t.hoverData.tapholdTimeout),t.hoverData.tapholdTimeout=setTimeout(function(){if(!t.hoverData.tapholdCancelled){var Fe=t.hoverData.down;Fe?Fe.emit({originalEvent:N,type:"taphold",position:{x:X[0],y:X[1]}}):$.emit({originalEvent:N,type:"taphold",position:{x:X[0],y:X[1]}})}},t.tapholdDuration)};if(N.which==3){t.hoverData.cxtStarted=!0;var ye={originalEvent:N,type:"cxttapstart",position:{x:X[0],y:X[1]}};W?(W.activate(),W.emit(ye),t.hoverData.down=W):$.emit(ye),t.hoverData.downTime=new Date().getTime(),t.hoverData.cxtDragged=!1}else if(N.which==1){W&&W.activate();{if(W!=null&&t.nodeIsGrabbable(W)){var he=function(Fe){return{originalEvent:N,type:Fe,position:{x:X[0],y:X[1]}}},Ee=function(Fe){Fe.emit(he("grab"))};if(f(W),!W.selected())re=t.dragData.possibleDragElements=$.collection(),y(W,{addToList:re}),W.emit(he("grabon")).emit(he("grab"));else{re=t.dragData.possibleDragElements=$.collection();var le=$.$(function(de){return de.isNode()&&de.selected()&&t.nodeIsGrabbable(de)});d(le,{addToList:re}),W.emit(he("grabon")),le.forEach(Ee)}t.redrawHint("eles",!0),t.redrawHint("drag",!0)}t.hoverData.down=W,t.hoverData.downs=ae,t.hoverData.downTime=new Date().getTime()}a(W,["mousedown","tapstart","vmousedown"],N,{x:X[0],y:X[1]}),W==null?(H[4]=1,t.data.bgActivePosistion={x:X[0],y:X[1]},t.redrawHint("select",!0),t.redraw()):W.pannable()&&(H[4]=1),pe()}H[0]=H[2]=X[0],H[1]=H[3]=X[1]}},!1),t.registerBinding(e,"mousemove",function(N){var $=t.hoverData.capture;if(!(!$&&!C(N))){var Q=!1,X=t.cy,H=X.zoom(),ae=[N.clientX,N.clientY],W=t.projectIntoViewport(ae[0],ae[1]),re=t.hoverData.mdownPos,pe=t.hoverData.mdownGPos,ye=t.selection,he=null;!t.hoverData.draggingEles&&!t.hoverData.dragging&&!t.hoverData.selecting&&(he=t.findNearestElement(W[0],W[1],!0,!1));var Ee=t.hoverData.last,le=t.hoverData.down,de=[W[0]-ye[2],W[1]-ye[3]],Fe=t.dragData.possibleDragElements,Me;if(pe){var lt=ae[0]-pe[0],Ze=lt*lt,Ue=ae[1]-pe[1],ct=Ue*Ue,Qe=Ze+ct;t.hoverData.isOverThresholdDrag=Me=Qe>=t.desktopTapThreshold2}var ft=n(N);Me&&(t.hoverData.tapholdCancelled=!0);var xt=function(){var Mt=t.hoverData.dragDelta=t.hoverData.dragDelta||[];Mt.length===0?(Mt.push(de[0]),Mt.push(de[1])):(Mt[0]+=de[0],Mt[1]+=de[1])};Q=!0,a(he,["mousemove","vmousemove","tapdrag"],N,{x:W[0],y:W[1]});var mt=function(){t.data.bgActivePosistion=void 0,t.hoverData.selecting||X.emit({originalEvent:N,type:"boxstart",position:{x:W[0],y:W[1]}}),ye[4]=1,t.hoverData.selecting=!0,t.redrawHint("select",!0),t.redraw()};if(t.hoverData.which===3){if(Me){var vt={originalEvent:N,type:"cxtdrag",position:{x:W[0],y:W[1]}};le?le.emit(vt):X.emit(vt),t.hoverData.cxtDragged=!0,(!t.hoverData.cxtOver||he!==t.hoverData.cxtOver)&&(t.hoverData.cxtOver&&t.hoverData.cxtOver.emit({originalEvent:N,type:"cxtdragout",position:{x:W[0],y:W[1]}}),t.hoverData.cxtOver=he,he&&he.emit({originalEvent:N,type:"cxtdragover",position:{x:W[0],y:W[1]}}))}}else if(t.hoverData.dragging){if(Q=!0,X.panningEnabled()&&X.userPanningEnabled()){var It;if(t.hoverData.justStartedPan){var Vt=t.hoverData.mdownPos;It={x:(W[0]-Vt[0])*H,y:(W[1]-Vt[1])*H},t.hoverData.justStartedPan=!1}else It={x:de[0]*H,y:de[1]*H};X.panBy(It),X.emit("dragpan"),t.hoverData.dragged=!0}W=t.projectIntoViewport(N.clientX,N.clientY)}else if(ye[4]==1&&(le==null||le.pannable())){if(Me){if(!t.hoverData.dragging&&X.boxSelectionEnabled()&&(ft||!X.panningEnabled()||!X.userPanningEnabled()))mt();else if(!t.hoverData.selecting&&X.panningEnabled()&&X.userPanningEnabled()){var Tt=i(le,t.hoverData.downs);Tt&&(t.hoverData.dragging=!0,t.hoverData.justStartedPan=!0,ye[4]=0,t.data.bgActivePosistion=Ir(re),t.redrawHint("select",!0),t.redraw())}le&&le.pannable()&&le.active()&&le.unactivate()}}else{if(le&&le.pannable()&&le.active()&&le.unactivate(),(!le||!le.grabbed())&&he!=Ee&&(Ee&&a(Ee,["mouseout","tapdragout"],N,{x:W[0],y:W[1]}),he&&a(he,["mouseover","tapdragover"],N,{x:W[0],y:W[1]}),t.hoverData.last=he),le)if(Me){if(X.boxSelectionEnabled()&&ft)le&&le.grabbed()&&(p(Fe),le.emit("freeon"),Fe.emit("free"),t.dragData.didDrag&&(le.emit("dragfreeon"),Fe.emit("dragfree"))),mt();else if(le&&le.grabbed()&&t.nodeIsDraggable(le)){var $e=!t.dragData.didDrag;$e&&t.redrawHint("eles",!0),t.dragData.didDrag=!0,t.hoverData.draggingEles||d(Fe,{inDragLayer:!0});var We={x:0,y:0};if(ne(de[0])&&ne(de[1])&&(We.x+=de[0],We.y+=de[1],$e)){var at=t.hoverData.dragDelta;at&&ne(at[0])&&ne(at[1])&&(We.x+=at[0],We.y+=at[1])}t.hoverData.draggingEles=!0,Fe.silentShift(We).emit("position drag"),t.redrawHint("drag",!0),t.redraw()}}else xt();Q=!0}if(ye[2]=W[0],ye[3]=W[1],Q)return N.stopPropagation&&N.stopPropagation(),N.preventDefault&&N.preventDefault(),!1}},!1);var S,A,L;t.registerBinding(e,"mouseup",function(N){var $=t.hoverData.capture;if($){t.hoverData.capture=!1;var Q=t.cy,X=t.projectIntoViewport(N.clientX,N.clientY),H=t.selection,ae=t.findNearestElement(X[0],X[1],!0,!1),W=t.dragData.possibleDragElements,re=t.hoverData.down,pe=n(N);if(t.data.bgActivePosistion&&(t.redrawHint("select",!0),t.redraw()),t.hoverData.tapholdCancelled=!0,t.data.bgActivePosistion=void 0,re&&re.unactivate(),t.hoverData.which===3){var ye={originalEvent:N,type:"cxttapend",position:{x:X[0],y:X[1]}};if(re?re.emit(ye):Q.emit(ye),!t.hoverData.cxtDragged){var he={originalEvent:N,type:"cxttap",position:{x:X[0],y:X[1]}};re?re.emit(he):Q.emit(he)}t.hoverData.cxtDragged=!1,t.hoverData.which=null}else if(t.hoverData.which===1){if(a(ae,["mouseup","tapend","vmouseup"],N,{x:X[0],y:X[1]}),!t.dragData.didDrag&&!t.hoverData.dragged&&!t.hoverData.selecting&&!t.hoverData.isOverThresholdDrag&&(a(re,["click","tap","vclick"],N,{x:X[0],y:X[1]}),A=!1,N.timeStamp-L<=Q.multiClickDebounceTime()?(S&&clearTimeout(S),A=!0,L=null,a(re,["dblclick","dbltap","vdblclick"],N,{x:X[0],y:X[1]})):(S=setTimeout(function(){A||a(re,["oneclick","onetap","voneclick"],N,{x:X[0],y:X[1]})},Q.multiClickDebounceTime()),L=N.timeStamp)),re==null&&!t.dragData.didDrag&&!t.hoverData.selecting&&!t.hoverData.dragged&&!n(N)&&(Q.$(r).unselect(["tapunselect"]),W.length>0&&t.redrawHint("eles",!0),t.dragData.possibleDragElements=W=Q.collection()),ae==re&&!t.dragData.didDrag&&!t.hoverData.selecting&&ae!=null&&ae._private.selectable&&(t.hoverData.dragging||(Q.selectionType()==="additive"||pe?ae.selected()?ae.unselect(["tapunselect"]):ae.select(["tapselect"]):pe||(Q.$(r).unmerge(ae).unselect(["tapunselect"]),ae.select(["tapselect"]))),t.redrawHint("eles",!0)),t.hoverData.selecting){var Ee=Q.collection(t.getAllInBox(H[0],H[1],H[2],H[3]));t.redrawHint("select",!0),Ee.length>0&&t.redrawHint("eles",!0),Q.emit({type:"boxend",originalEvent:N,position:{x:X[0],y:X[1]}});var le=function(Me){return Me.selectable()&&!Me.selected()};Q.selectionType()==="additive"||pe||Q.$(r).unmerge(Ee).unselect(),Ee.emit("box").stdFilter(le).select().emit("boxselect"),t.redraw()}if(t.hoverData.dragging&&(t.hoverData.dragging=!1,t.redrawHint("select",!0),t.redrawHint("eles",!0),t.redraw()),!H[4]){t.redrawHint("drag",!0),t.redrawHint("eles",!0);var de=re&&re.grabbed();p(W),de&&(re.emit("freeon"),W.emit("free"),t.dragData.didDrag&&(re.emit("dragfreeon"),W.emit("dragfree")))}}H[4]=0,t.hoverData.down=null,t.hoverData.cxtStarted=!1,t.hoverData.draggingEles=!1,t.hoverData.selecting=!1,t.hoverData.isOverThresholdDrag=!1,t.dragData.didDrag=!1,t.hoverData.dragged=!1,t.hoverData.dragDelta=[],t.hoverData.mdownPos=null,t.hoverData.mdownGPos=null}},!1);var I=function(N){if(!t.scrollingPage){var $=t.cy,Q=$.zoom(),X=$.pan(),H=t.projectIntoViewport(N.clientX,N.clientY),ae=[H[0]*Q+X.x,H[1]*Q+X.y];if(t.hoverData.draggingEles||t.hoverData.dragging||t.hoverData.cxtStarted||T()){N.preventDefault();return}if($.panningEnabled()&&$.userPanningEnabled()&&$.zoomingEnabled()&&$.userZoomingEnabled()){N.preventDefault(),t.data.wheelZooming=!0,clearTimeout(t.data.wheelTimeout),t.data.wheelTimeout=setTimeout(function(){t.data.wheelZooming=!1,t.redrawHint("eles",!0),t.redraw()},150);var W;N.deltaY!=null?W=N.deltaY/-250:N.wheelDeltaY!=null?W=N.wheelDeltaY/1e3:W=N.wheelDelta/1e3,W=W*t.wheelSensitivity;var re=N.deltaMode===1;re&&(W*=33);var pe=$.zoom()*Math.pow(10,W);N.type==="gesturechange"&&(pe=t.gestureStartZoom*N.scale),$.zoom({level:pe,renderedPosition:{x:ae[0],y:ae[1]}}),$.emit(N.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};t.registerBinding(t.container,"wheel",I,!0),t.registerBinding(e,"scroll",function(N){t.scrollingPage=!0,clearTimeout(t.scrollingPageTimeout),t.scrollingPageTimeout=setTimeout(function(){t.scrollingPage=!1},250)},!0),t.registerBinding(t.container,"gesturestart",function(N){t.gestureStartZoom=t.cy.zoom(),t.hasTouchStarted||N.preventDefault()},!0),t.registerBinding(t.container,"gesturechange",function(j){t.hasTouchStarted||I(j)},!0),t.registerBinding(t.container,"mouseout",function(N){var $=t.projectIntoViewport(N.clientX,N.clientY);t.cy.emit({originalEvent:N,type:"mouseout",position:{x:$[0],y:$[1]}})},!1),t.registerBinding(t.container,"mouseover",function(N){var $=t.projectIntoViewport(N.clientX,N.clientY);t.cy.emit({originalEvent:N,type:"mouseover",position:{x:$[0],y:$[1]}})},!1);var O,k,R,M,P,F,V,G,B,Y,Z,K,U,z=function(N,$,Q,X){return Math.sqrt((Q-N)*(Q-N)+(X-$)*(X-$))},_=function(N,$,Q,X){return(Q-N)*(Q-N)+(X-$)*(X-$)},q;t.registerBinding(t.container,"touchstart",q=function(N){if(t.hasTouchStarted=!0,!!C(N)){m(),t.touchData.capture=!0,t.data.bgActivePosistion=void 0;var $=t.cy,Q=t.touchData.now,X=t.touchData.earlier;if(N.touches[0]){var H=t.projectIntoViewport(N.touches[0].clientX,N.touches[0].clientY);Q[0]=H[0],Q[1]=H[1]}if(N.touches[1]){var H=t.projectIntoViewport(N.touches[1].clientX,N.touches[1].clientY);Q[2]=H[0],Q[3]=H[1]}if(N.touches[2]){var H=t.projectIntoViewport(N.touches[2].clientX,N.touches[2].clientY);Q[4]=H[0],Q[5]=H[1]}if(N.touches[1]){t.touchData.singleTouchMoved=!0,p(t.dragData.touchDragEles);var ae=t.findContainerClientCoords();B=ae[0],Y=ae[1],Z=ae[2],K=ae[3],O=N.touches[0].clientX-B,k=N.touches[0].clientY-Y,R=N.touches[1].clientX-B,M=N.touches[1].clientY-Y,U=0<=O&&O<=Z&&0<=R&&R<=Z&&0<=k&&k<=K&&0<=M&&M<=K;var W=$.pan(),re=$.zoom();P=z(O,k,R,M),F=_(O,k,R,M),V=[(O+R)/2,(k+M)/2],G=[(V[0]-W.x)/re,(V[1]-W.y)/re];var pe=200,ye=pe*pe;if(F<ye&&!N.touches[2]){var he=t.findNearestElement(Q[0],Q[1],!0,!0),Ee=t.findNearestElement(Q[2],Q[3],!0,!0);he&&he.isNode()?(he.activate().emit({originalEvent:N,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=he):Ee&&Ee.isNode()?(Ee.activate().emit({originalEvent:N,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start=Ee):$.emit({originalEvent:N,type:"cxttapstart",position:{x:Q[0],y:Q[1]}}),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!0,t.touchData.cxtDragged=!1,t.data.bgActivePosistion=void 0,t.redraw();return}}if(N.touches[2])$.boxSelectionEnabled()&&N.preventDefault();else if(!N.touches[1]){if(N.touches[0]){var le=t.findNearestElements(Q[0],Q[1],!0,!0),de=le[0];if(de!=null&&(de.activate(),t.touchData.start=de,t.touchData.starts=le,t.nodeIsGrabbable(de))){var Fe=t.dragData.touchDragEles=$.collection(),Me=null;t.redrawHint("eles",!0),t.redrawHint("drag",!0),de.selected()?(Me=$.$(function(Qe){return Qe.selected()&&t.nodeIsGrabbable(Qe)}),d(Me,{addToList:Fe})):y(de,{addToList:Fe}),f(de);var lt=function(ft){return{originalEvent:N,type:ft,position:{x:Q[0],y:Q[1]}}};de.emit(lt("grabon")),Me?Me.forEach(function(Qe){Qe.emit(lt("grab"))}):de.emit(lt("grab"))}a(de,["touchstart","tapstart","vmousedown"],N,{x:Q[0],y:Q[1]}),de==null&&(t.data.bgActivePosistion={x:H[0],y:H[1]},t.redrawHint("select",!0),t.redraw()),t.touchData.singleTouchMoved=!1,t.touchData.singleTouchStartTime=+new Date,clearTimeout(t.touchData.tapholdTimeout),t.touchData.tapholdTimeout=setTimeout(function(){t.touchData.singleTouchMoved===!1&&!t.pinching&&!t.touchData.selecting&&a(t.touchData.start,["taphold"],N,{x:Q[0],y:Q[1]})},t.tapholdDuration)}}if(N.touches.length>=1){for(var Ze=t.touchData.startPosition=[null,null,null,null,null,null],Ue=0;Ue<Q.length;Ue++)Ze[Ue]=X[Ue]=Q[Ue];var ct=N.touches[0];t.touchData.startGPosition=[ct.clientX,ct.clientY]}}},!1);var J;t.registerBinding(window,"touchmove",J=function(N){var $=t.touchData.capture;if(!(!$&&!C(N))){var Q=t.selection,X=t.cy,H=t.touchData.now,ae=t.touchData.earlier,W=X.zoom();if(N.touches[0]){var re=t.projectIntoViewport(N.touches[0].clientX,N.touches[0].clientY);H[0]=re[0],H[1]=re[1]}if(N.touches[1]){var re=t.projectIntoViewport(N.touches[1].clientX,N.touches[1].clientY);H[2]=re[0],H[3]=re[1]}if(N.touches[2]){var re=t.projectIntoViewport(N.touches[2].clientX,N.touches[2].clientY);H[4]=re[0],H[5]=re[1]}var pe=t.touchData.startGPosition,ye;if($&&N.touches[0]&&pe){for(var he=[],Ee=0;Ee<H.length;Ee++)he[Ee]=H[Ee]-ae[Ee];var le=N.touches[0].clientX-pe[0],de=le*le,Fe=N.touches[0].clientY-pe[1],Me=Fe*Fe,lt=de+Me;ye=lt>=t.touchTapThreshold2}if($&&t.touchData.cxt){N.preventDefault();var Ze=N.touches[0].clientX-B,Ue=N.touches[0].clientY-Y,ct=N.touches[1].clientX-B,Qe=N.touches[1].clientY-Y,ft=_(Ze,Ue,ct,Qe),xt=ft/F,mt=150,vt=mt*mt,It=1.5,Vt=It*It;if(xt>=Vt||ft>=vt){t.touchData.cxt=!1,t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var Tt={originalEvent:N,type:"cxttapend",position:{x:H[0],y:H[1]}};t.touchData.start?(t.touchData.start.unactivate().emit(Tt),t.touchData.start=null):X.emit(Tt)}}if($&&t.touchData.cxt){var Tt={originalEvent:N,type:"cxtdrag",position:{x:H[0],y:H[1]}};t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.touchData.start?t.touchData.start.emit(Tt):X.emit(Tt),t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxtDragged=!0;var $e=t.findNearestElement(H[0],H[1],!0,!0);(!t.touchData.cxtOver||$e!==t.touchData.cxtOver)&&(t.touchData.cxtOver&&t.touchData.cxtOver.emit({originalEvent:N,type:"cxtdragout",position:{x:H[0],y:H[1]}}),t.touchData.cxtOver=$e,$e&&$e.emit({originalEvent:N,type:"cxtdragover",position:{x:H[0],y:H[1]}}))}else if($&&N.touches[2]&&X.boxSelectionEnabled())N.preventDefault(),t.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,t.touchData.selecting||X.emit({originalEvent:N,type:"boxstart",position:{x:H[0],y:H[1]}}),t.touchData.selecting=!0,t.touchData.didSelect=!0,Q[4]=1,!Q||Q.length===0||Q[0]===void 0?(Q[0]=(H[0]+H[2]+H[4])/3,Q[1]=(H[1]+H[3]+H[5])/3,Q[2]=(H[0]+H[2]+H[4])/3+1,Q[3]=(H[1]+H[3]+H[5])/3+1):(Q[2]=(H[0]+H[2]+H[4])/3,Q[3]=(H[1]+H[3]+H[5])/3),t.redrawHint("select",!0),t.redraw();else if($&&N.touches[1]&&!t.touchData.didSelect&&X.zoomingEnabled()&&X.panningEnabled()&&X.userZoomingEnabled()&&X.userPanningEnabled()){N.preventDefault(),t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var We=t.dragData.touchDragEles;if(We){t.redrawHint("drag",!0);for(var at=0;at<We.length;at++){var Cr=We[at]._private;Cr.grabbed=!1,Cr.rscratch.inDragLayer=!1}}var Mt=t.touchData.start,Ze=N.touches[0].clientX-B,Ue=N.touches[0].clientY-Y,ct=N.touches[1].clientX-B,Qe=N.touches[1].clientY-Y,Hi=z(Ze,Ue,ct,Qe),ol=Hi/P;if(U){var ul=Ze-O,ll=Ue-k,fl=ct-R,hl=Qe-M,cl=(ul+fl)/2,vl=(ll+hl)/2,Qr=X.zoom(),Bn=Qr*ol,Ba=X.pan(),Xi=G[0]*Qr+Ba.x,qi=G[1]*Qr+Ba.y,dl={x:-Bn/Qr*(Xi-Ba.x-cl)+Xi,y:-Bn/Qr*(qi-Ba.y-vl)+qi};if(Mt&&Mt.active()){var We=t.dragData.touchDragEles;p(We),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Mt.unactivate().emit("freeon"),We.emit("free"),t.dragData.didDrag&&(Mt.emit("dragfreeon"),We.emit("dragfree"))}X.viewport({zoom:Bn,pan:dl,cancelOnFailedZoom:!0}),X.emit("pinchzoom"),P=Hi,O=Ze,k=Ue,R=ct,M=Qe,t.pinching=!0}if(N.touches[0]){var re=t.projectIntoViewport(N.touches[0].clientX,N.touches[0].clientY);H[0]=re[0],H[1]=re[1]}if(N.touches[1]){var re=t.projectIntoViewport(N.touches[1].clientX,N.touches[1].clientY);H[2]=re[0],H[3]=re[1]}if(N.touches[2]){var re=t.projectIntoViewport(N.touches[2].clientX,N.touches[2].clientY);H[4]=re[0],H[5]=re[1]}}else if(N.touches[0]&&!t.touchData.didSelect){var Ct=t.touchData.start,Fn=t.touchData.last,$e;if(!t.hoverData.draggingEles&&!t.swipePanning&&($e=t.findNearestElement(H[0],H[1],!0,!0)),$&&Ct!=null&&N.preventDefault(),$&&Ct!=null&&t.nodeIsDraggable(Ct))if(ye){var We=t.dragData.touchDragEles,Wi=!t.dragData.didDrag;Wi&&d(We,{inDragLayer:!0}),t.dragData.didDrag=!0;var Jr={x:0,y:0};if(ne(he[0])&&ne(he[1])&&(Jr.x+=he[0],Jr.y+=he[1],Wi)){t.redrawHint("eles",!0);var Dt=t.touchData.dragDelta;Dt&&ne(Dt[0])&&ne(Dt[1])&&(Jr.x+=Dt[0],Jr.y+=Dt[1])}t.hoverData.draggingEles=!0,We.silentShift(Jr).emit("position drag"),t.redrawHint("drag",!0),t.touchData.startPosition[0]==ae[0]&&t.touchData.startPosition[1]==ae[1]&&t.redrawHint("eles",!0),t.redraw()}else{var Dt=t.touchData.dragDelta=t.touchData.dragDelta||[];Dt.length===0?(Dt.push(he[0]),Dt.push(he[1])):(Dt[0]+=he[0],Dt[1]+=he[1])}if(a(Ct||$e,["touchmove","tapdrag","vmousemove"],N,{x:H[0],y:H[1]}),(!Ct||!Ct.grabbed())&&$e!=Fn&&(Fn&&Fn.emit({originalEvent:N,type:"tapdragout",position:{x:H[0],y:H[1]}}),$e&&$e.emit({originalEvent:N,type:"tapdragover",position:{x:H[0],y:H[1]}})),t.touchData.last=$e,$)for(var at=0;at<H.length;at++)H[at]&&t.touchData.startPosition[at]&&ye&&(t.touchData.singleTouchMoved=!0);if($&&(Ct==null||Ct.pannable())&&X.panningEnabled()&&X.userPanningEnabled()){var gl=i(Ct,t.touchData.starts);gl&&(N.preventDefault(),t.data.bgActivePosistion||(t.data.bgActivePosistion=Ir(t.touchData.startPosition)),t.swipePanning?(X.panBy({x:he[0]*W,y:he[1]*W}),X.emit("dragpan")):ye&&(t.swipePanning=!0,X.panBy({x:le*W,y:Fe*W}),X.emit("dragpan"),Ct&&(Ct.unactivate(),t.redrawHint("select",!0),t.touchData.start=null)));var re=t.projectIntoViewport(N.touches[0].clientX,N.touches[0].clientY);H[0]=re[0],H[1]=re[1]}}for(var Ee=0;Ee<H.length;Ee++)ae[Ee]=H[Ee];$&&N.touches.length>0&&!t.hoverData.draggingEles&&!t.swipePanning&&t.data.bgActivePosistion!=null&&(t.data.bgActivePosistion=void 0,t.redrawHint("select",!0),t.redraw())}},!1);var ee;t.registerBinding(e,"touchcancel",ee=function(N){var $=t.touchData.start;t.touchData.capture=!1,$&&$.unactivate()});var oe,me,te,ie;if(t.registerBinding(e,"touchend",oe=function(N){var $=t.touchData.start,Q=t.touchData.capture;if(Q)N.touches.length===0&&(t.touchData.capture=!1),N.preventDefault();else return;var X=t.selection;t.swipePanning=!1,t.hoverData.draggingEles=!1;var H=t.cy,ae=H.zoom(),W=t.touchData.now,re=t.touchData.earlier;if(N.touches[0]){var pe=t.projectIntoViewport(N.touches[0].clientX,N.touches[0].clientY);W[0]=pe[0],W[1]=pe[1]}if(N.touches[1]){var pe=t.projectIntoViewport(N.touches[1].clientX,N.touches[1].clientY);W[2]=pe[0],W[3]=pe[1]}if(N.touches[2]){var pe=t.projectIntoViewport(N.touches[2].clientX,N.touches[2].clientY);W[4]=pe[0],W[5]=pe[1]}$&&$.unactivate();var ye;if(t.touchData.cxt){if(ye={originalEvent:N,type:"cxttapend",position:{x:W[0],y:W[1]}},$?$.emit(ye):H.emit(ye),!t.touchData.cxtDragged){var he={originalEvent:N,type:"cxttap",position:{x:W[0],y:W[1]}};$?$.emit(he):H.emit(he)}t.touchData.start&&(t.touchData.start._private.grabbed=!1),t.touchData.cxt=!1,t.touchData.start=null,t.redraw();return}if(!N.touches[2]&&H.boxSelectionEnabled()&&t.touchData.selecting){t.touchData.selecting=!1;var Ee=H.collection(t.getAllInBox(X[0],X[1],X[2],X[3]));X[0]=void 0,X[1]=void 0,X[2]=void 0,X[3]=void 0,X[4]=0,t.redrawHint("select",!0),H.emit({type:"boxend",originalEvent:N,position:{x:W[0],y:W[1]}});var le=function(vt){return vt.selectable()&&!vt.selected()};Ee.emit("box").stdFilter(le).select().emit("boxselect"),Ee.nonempty()&&t.redrawHint("eles",!0),t.redraw()}if($!=null&&$.unactivate(),N.touches[2])t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);else if(!N.touches[1]){if(!N.touches[0]){if(!N.touches[0]){t.data.bgActivePosistion=void 0,t.redrawHint("select",!0);var de=t.dragData.touchDragEles;if($!=null){var Fe=$._private.grabbed;p(de),t.redrawHint("drag",!0),t.redrawHint("eles",!0),Fe&&($.emit("freeon"),de.emit("free"),t.dragData.didDrag&&($.emit("dragfreeon"),de.emit("dragfree"))),a($,["touchend","tapend","vmouseup","tapdragout"],N,{x:W[0],y:W[1]}),$.unactivate(),t.touchData.start=null}else{var Me=t.findNearestElement(W[0],W[1],!0,!0);a(Me,["touchend","tapend","vmouseup","tapdragout"],N,{x:W[0],y:W[1]})}var lt=t.touchData.startPosition[0]-W[0],Ze=lt*lt,Ue=t.touchData.startPosition[1]-W[1],ct=Ue*Ue,Qe=Ze+ct,ft=Qe*ae*ae;t.touchData.singleTouchMoved||($||H.$(":selected").unselect(["tapunselect"]),a($,["tap","vclick"],N,{x:W[0],y:W[1]}),me=!1,N.timeStamp-ie<=H.multiClickDebounceTime()?(te&&clearTimeout(te),me=!0,ie=null,a($,["dbltap","vdblclick"],N,{x:W[0],y:W[1]})):(te=setTimeout(function(){me||a($,["onetap","voneclick"],N,{x:W[0],y:W[1]})},H.multiClickDebounceTime()),ie=N.timeStamp)),$!=null&&!t.dragData.didDrag&&$._private.selectable&&ft<t.touchTapThreshold2&&!t.pinching&&(H.selectionType()==="single"?(H.$(r).unmerge($).unselect(["tapunselect"]),$.select(["tapselect"])):$.selected()?$.unselect(["tapunselect"]):$.select(["tapselect"]),t.redrawHint("eles",!0)),t.touchData.singleTouchMoved=!0}}}for(var xt=0;xt<W.length;xt++)re[xt]=W[xt];t.dragData.didDrag=!1,N.touches.length===0&&(t.touchData.dragDelta=[],t.touchData.startPosition=[null,null,null,null,null,null],t.touchData.startGPosition=null,t.touchData.didSelect=!1),N.touches.length<2&&(N.touches.length===1&&(t.touchData.startGPosition=[N.touches[0].clientX,N.touches[0].clientY]),t.pinching=!1,t.redrawHint("eles",!0),t.redraw())},!1),typeof TouchEvent=="undefined"){var ue=[],ce=function(N){return{clientX:N.clientX,clientY:N.clientY,force:1,identifier:N.pointerId,pageX:N.pageX,pageY:N.pageY,radiusX:N.width/2,radiusY:N.height/2,screenX:N.screenX,screenY:N.screenY,target:N.target}},fe=function(N){return{event:N,touch:ce(N)}},ge=function(N){ue.push(fe(N))},Ae=function(N){for(var $=0;$<ue.length;$++){var Q=ue[$];if(Q.event.pointerId===N.pointerId){ue.splice($,1);return}}},xe=function(N){var $=ue.filter(function(Q){return Q.event.pointerId===N.pointerId})[0];$.event=N,$.touch=ce(N)},we=function(N){N.touches=ue.map(function($){return $.touch})},De=function(N){return N.pointerType==="mouse"||N.pointerType===4};t.registerBinding(t.container,"pointerdown",function(j){De(j)||(j.preventDefault(),ge(j),we(j),q(j))}),t.registerBinding(t.container,"pointerup",function(j){De(j)||(Ae(j),we(j),oe(j))}),t.registerBinding(t.container,"pointercancel",function(j){De(j)||(Ae(j),we(j),ee(j))}),t.registerBinding(t.container,"pointermove",function(j){De(j)||(j.preventDefault(),xe(j),we(j),J(j))})}};var Xt={};Xt.generatePolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,draw:function(a,n,i,s,o,l){this.renderer.nodeShapeImpl("polygon",a,n,i,s,o,this.points)},intersectLine:function(a,n,i,s,o,l,u,f){return ma(o,l,this.points,a,n,i/2,s/2,u)},checkPoint:function(a,n,i,s,o,l,u,f){return Yt(a,n,this.points,l,u,s,o,[0,-1],i)}}};Xt.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o,l){return Th(i,s,e,r,a/2+o,n/2+o)},checkPoint:function(e,r,a,n,i,s,o,l){return dr(e,r,n,i,s,o,a)}}};Xt.generateRoundPolygon=function(t,e){return this.nodeShapes[t]={renderer:this,name:t,points:e,getOrCreateCorners:function(a,n,i,s,o,l,u){if(l[u]!==void 0&&l[u+"-cx"]===a&&l[u+"-cy"]===n)return l[u];l[u]=new Array(e.length/2),l[u+"-cx"]=a,l[u+"-cy"]=n;var f=i/2,h=s/2;o=o==="auto"?Yo(i,s):o;for(var c=new Array(e.length/2),v=0;v<e.length/2;v++)c[v]={x:a+f*e[v*2],y:n+h*e[v*2+1]};var d,y,p,g,m=c.length;for(y=c[m-1],d=0;d<m;d++)p=c[d%m],g=c[(d+1)%m],l[u][d]=Pi(y,p,g,o),y=p,p=g;return l[u]},draw:function(a,n,i,s,o,l,u){this.renderer.nodeShapeImpl("round-polygon",a,n,i,s,o,this.points,this.getOrCreateCorners(n,i,s,o,l,u,"drawCorners"))},intersectLine:function(a,n,i,s,o,l,u,f,h){return Ch(o,l,this.points,a,n,i,s,u,this.getOrCreateCorners(a,n,i,s,f,h,"corners"))},checkPoint:function(a,n,i,s,o,l,u,f,h){return xh(a,n,this.points,l,u,s,o,this.getOrCreateCorners(l,u,s,o,f,h,"corners"))}}};Xt.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,s)},intersectLine:function(e,r,a,n,i,s,o,l){return Uo(i,s,e,r,a,n,o,l)},checkPoint:function(e,r,a,n,i,s,o,l){var u=n/2,f=i/2;l=l==="auto"?mr(n,i):l,l=Math.min(u,f,l);var h=l*2;return!!(Yt(e,r,this.points,s,o,n,i-h,[0,-1],a)||Yt(e,r,this.points,s,o,n-h,i,[0,-1],a)||dr(e,r,h,h,s-u+l,o-f+l,a)||dr(e,r,h,h,s+u-l,o-f+l,a)||dr(e,r,h,h,s+u-l,o+f-l,a)||dr(e,r,h,h,s-u+l,o+f-l,a))}}};Xt.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:Ti(),points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,null,s)},generateCutTrianglePts:function(e,r,a,n,i){var s=i==="auto"?this.cornerLength:i,o=r/2,l=e/2,u=a-l,f=a+l,h=n-o,c=n+o;return{topLeft:[u,h+s,u+s,h,u+s,h+s],topRight:[f-s,h,f,h+s,f-s,h+s],bottomRight:[f,c-s,f-s,c,f-s,c-s],bottomLeft:[u+s,c,u,c-s,u+s,c-s]}},intersectLine:function(e,r,a,n,i,s,o,l){var u=this.generateCutTrianglePts(a+2*o,n+2*o,e,r,l),f=[].concat.apply([],[u.topLeft.splice(0,4),u.topRight.splice(0,4),u.bottomRight.splice(0,4),u.bottomLeft.splice(0,4)]);return ma(i,s,f,e,r)},checkPoint:function(e,r,a,n,i,s,o,l){var u=l==="auto"?this.cornerLength:l;if(Yt(e,r,this.points,s,o,n,i-2*u,[0,-1],a)||Yt(e,r,this.points,s,o,n-2*u,i,[0,-1],a))return!0;var f=this.generateCutTrianglePts(n,i,s,o);return dt(e,r,f.topLeft)||dt(e,r,f.topRight)||dt(e,r,f.bottomRight)||dt(e,r,f.bottomLeft)}}};Xt.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i)},intersectLine:function(e,r,a,n,i,s,o,l){var u=.15,f=.5,h=.85,c=this.generateBarrelBezierPts(a+2*o,n+2*o,e,r),v=function(p){var g=Rr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},u),m=Rr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},f),E=Rr({x:p[0],y:p[1]},{x:p[2],y:p[3]},{x:p[4],y:p[5]},h);return[p[0],p[1],g.x,g.y,m.x,m.y,E.x,E.y,p[4],p[5]]},d=[].concat(v(c.topLeft),v(c.topRight),v(c.bottomRight),v(c.bottomLeft));return ma(i,s,d,e,r)},generateBarrelBezierPts:function(e,r,a,n){var i=r/2,s=e/2,o=a-s,l=a+s,u=n-i,f=n+i,h=jn(e,r),c=h.heightOffset,v=h.widthOffset,d=h.ctrlPtOffsetPct*e,y={topLeft:[o,u+c,o+d,u,o+v,u],topRight:[l-v,u,l-d,u,l,u+c],bottomRight:[l,f-c,l-d,f,l-v,f],bottomLeft:[o+v,f,o+d,f,o,f-c]};return y.topLeft.isTop=!0,y.topRight.isTop=!0,y.bottomLeft.isBottom=!0,y.bottomRight.isBottom=!0,y},checkPoint:function(e,r,a,n,i,s,o,l){var u=jn(n,i),f=u.heightOffset,h=u.widthOffset;if(Yt(e,r,this.points,s,o,n,i-2*f,[0,-1],a)||Yt(e,r,this.points,s,o,n-2*h,i,[0,-1],a))return!0;for(var c=this.generateBarrelBezierPts(n,i,s,o),v=function(T,C,S){var A=S[4],L=S[2],I=S[0],O=S[5],k=S[1],R=Math.min(A,I),M=Math.max(A,I),P=Math.min(O,k),F=Math.max(O,k);if(R<=T&&T<=M&&P<=C&&C<=F){var V=Dh(A,L,I),G=mh(V[0],V[1],V[2],T),B=G.filter(function(Y){return 0<=Y&&Y<=1});if(B.length>0)return B[0]}return null},d=Object.keys(c),y=0;y<d.length;y++){var p=d[y],g=c[p],m=v(e,r,g);if(m!=null){var E=g[5],D=g[3],b=g[1],x=Ke(E,D,b,m);if(g.isTop&&x<=r||g.isBottom&&r<=x)return!0}}return!1}}};Xt.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:ht(4,0),draw:function(e,r,a,n,i,s){this.renderer.nodeShapeImpl(this.name,e,r,a,n,i,this.points,s)},intersectLine:function(e,r,a,n,i,s,o,l){var u=e-(a/2+o),f=r-(n/2+o),h=f,c=e+(a/2+o),v=Jt(i,s,e,r,u,f,c,h,!1);return v.length>0?v:Uo(i,s,e,r,a,n,o,l)},checkPoint:function(e,r,a,n,i,s,o,l){l=l==="auto"?mr(n,i):l;var u=2*l;if(Yt(e,r,this.points,s,o,n,i-u,[0,-1],a)||Yt(e,r,this.points,s,o,n-u,i,[0,-1],a))return!0;var f=n/2+2*a,h=i/2+2*a,c=[s-f,o-h,s-f,o,s+f,o,s+f,o-h];return!!(dt(e,r,c)||dr(e,r,u,u,s+n/2-l,o+i/2-l,a)||dr(e,r,u,u,s-n/2+l,o+i/2-l,a))}}};Xt.registerNodeShapes=function(){var t=this.nodeShapes={},e=this;this.generateEllipse(),this.generatePolygon("triangle",ht(3,0)),this.generateRoundPolygon("round-triangle",ht(3,0)),this.generatePolygon("rectangle",ht(4,0)),t.square=t.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var r=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",r),this.generateRoundPolygon("round-diamond",r)}this.generatePolygon("pentagon",ht(5,0)),this.generateRoundPolygon("round-pentagon",ht(5,0)),this.generatePolygon("hexagon",ht(6,0)),this.generateRoundPolygon("round-hexagon",ht(6,0)),this.generatePolygon("heptagon",ht(7,0)),this.generateRoundPolygon("round-heptagon",ht(7,0)),this.generatePolygon("octagon",ht(8,0)),this.generateRoundPolygon("round-octagon",ht(8,0));var a=new Array(20);{var n=Jn(5,0),i=Jn(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<i.length/2;o++)i[o*2]*=s,i[o*2+1]*=s;for(var o=0;o<20/4;o++)a[o*4]=n[o*2],a[o*4+1]=n[o*2+1],a[o*4+2]=i[o*2],a[o*4+3]=i[o*2+1]}a=$o(a),this.generatePolygon("star",a),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var l=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",l),this.generateRoundPolygon("round-tag",l)}t.makePolygon=function(u){var f=u.join("$"),h="polygon-"+f,c;return(c=this[h])?c:e.generatePolygon(h,u)}};var Ia={};Ia.timeToRender=function(){return this.redrawTotalTime/this.redrawCount};Ia.redraw=function(t){t=t||Bo();var e=this;e.averageRedrawTime===void 0&&(e.averageRedrawTime=0),e.lastRedrawTime===void 0&&(e.lastRedrawTime=0),e.lastDrawTime===void 0&&(e.lastDrawTime=0),e.requestedFrame=!0,e.renderOptions=t};Ia.beforeRender=function(t,e){if(!this.destroyed){e==null&&ze("Priority is not optional for beforeRender");var r=this.beforeRenderCallbacks;r.push({fn:t,priority:e}),r.sort(function(a,n){return n.priority-a.priority})}};var uo=function(e,r,a){for(var n=e.beforeRenderCallbacks,i=0;i<n.length;i++)n[i].fn(r,a)};Ia.startRenderLoop=function(){var t=this,e=t.cy;if(!t.renderLoopStarted){t.renderLoopStarted=!0;var r=function a(n){if(!t.destroyed){if(!e.batching())if(t.requestedFrame&&!t.skipFrame){uo(t,!0,n);var i=$t();t.render(t.renderOptions);var s=t.lastDrawTime=$t();t.averageRedrawTime===void 0&&(t.averageRedrawTime=s-i),t.redrawCount===void 0&&(t.redrawCount=0),t.redrawCount++,t.redrawTotalTime===void 0&&(t.redrawTotalTime=0);var o=s-i;t.redrawTotalTime+=o,t.lastRedrawTime=o,t.averageRedrawTime=t.averageRedrawTime/2+o/2,t.requestedFrame=!1}else uo(t,!1,n);t.skipFrame=!1,un(a)}};un(r)}};var sp=function(e){this.init(e)},Uu=sp,Kr=Uu.prototype;Kr.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"];Kr.init=function(t){var e=this;e.options=t,e.cy=t.cy;var r=e.container=t.cy.container(),a=e.cy.window();if(a){var n=a.document,i=n.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",l=n.getElementById(s)!=null;if(r.className.indexOf(o)<0&&(r.className=(r.className||"")+" "+o),!l){var u=n.createElement("style");u.id=s,u.textContent="."+o+" { position: relative; }",i.insertBefore(u,i.children[0])}var f=a.getComputedStyle(r),h=f.getPropertyValue("position");h==="static"&&Ne("A Cytoscape container has style position:static and so can not use UI extensions properly")}e.selection=[void 0,void 0,void 0,void 0,0],e.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],e.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},e.dragData={possibleDragElements:[]},e.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]},e.redraws=0,e.showFps=t.showFps,e.debug=t.debug,e.hideEdgesOnViewport=t.hideEdgesOnViewport,e.textureOnViewport=t.textureOnViewport,e.wheelSensitivity=t.wheelSensitivity,e.motionBlurEnabled=t.motionBlur,e.forcedPixelRatio=ne(t.pixelRatio)?t.pixelRatio:null,e.motionBlur=t.motionBlur,e.motionBlurOpacity=t.motionBlurOpacity,e.motionBlurTransparency=1-e.motionBlurOpacity,e.motionBlurPxRatio=1,e.mbPxRBlurry=1,e.minMbLowQualFrames=4,e.fullQualityMb=!1,e.clearedForMotionBlur=[],e.desktopTapThreshold=t.desktopTapThreshold,e.desktopTapThreshold2=t.desktopTapThreshold*t.desktopTapThreshold,e.touchTapThreshold=t.touchTapThreshold,e.touchTapThreshold2=t.touchTapThreshold*t.touchTapThreshold,e.tapholdDuration=500,e.bindings=[],e.beforeRenderCallbacks=[],e.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},e.registerNodeShapes(),e.registerArrowShapes(),e.registerCalculationListeners()};Kr.notify=function(t,e){var r=this,a=r.cy;if(!this.destroyed){if(t==="init"){r.load();return}if(t==="destroy"){r.destroy();return}(t==="add"||t==="remove"||t==="move"&&a.hasCompoundNodes()||t==="load"||t==="zorder"||t==="mount")&&r.invalidateCachedZSortedEles(),t==="viewport"&&r.redrawHint("select",!0),(t==="load"||t==="resize"||t==="mount")&&(r.invalidateContainerClientCoordsCache(),r.matchCanvasSize(r.container)),r.redrawHint("eles",!0),r.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}};Kr.destroy=function(){var t=this;t.destroyed=!0,t.cy.stopAnimationLoop();for(var e=0;e<t.bindings.length;e++){var r=t.bindings[e],a=r,n=a.target;(n.off||n.removeEventListener).apply(n,a.args)}if(t.bindings=[],t.beforeRenderCallbacks=[],t.onUpdateEleCalcsFns=[],t.removeObserver&&t.removeObserver.disconnect(),t.styleObserver&&t.styleObserver.disconnect(),t.resizeObserver&&t.resizeObserver.disconnect(),t.labelCalcDiv)try{document.body.removeChild(t.labelCalcDiv)}catch(i){}};Kr.isHeadless=function(){return!1};[ki,zu,Vu,Wr,Xt,Ia].forEach(function(t){be(Kr,t)});var Kn=1e3/60,$u={setupDequeueing:function(e){return function(){var a=this,n=this.renderer;if(!a.dequeueingSetup){a.dequeueingSetup=!0;var i=En(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),s=function(u,f){var h=$t(),c=n.averageRedrawTime,v=n.lastRedrawTime,d=[],y=n.cy.extent(),p=n.getPixelRatio();for(u||n.flushRenderedStyleQueue();;){var g=$t(),m=g-h,E=g-f;if(v<Kn){var D=Kn-(u?c:0);if(E>=e.deqFastCost*D)break}else if(u){if(m>=e.deqCost*v||m>=e.deqAvgCost*c)break}else if(E>=e.deqNoDrawCost*Kn)break;var b=e.deq(a,p,y);if(b.length>0)for(var x=0;x<b.length;x++)d.push(b[x]);else break}d.length>0&&(e.onDeqd(a,d),!u&&e.shouldRedraw(a,d,p,y)&&i())},o=e.priority||bi;n.beforeRender(s,o(a))}}}},op=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;di(this,t),this.idsByKey=new Bt,this.keyForId=new Bt,this.cachesByLvl=new Bt,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=r}return gi(t,[{key:"getIdsFor",value:function(r){r==null&&ze("Can not get id list for null key");var a=this.idsByKey,n=this.idsByKey.get(r);return n||(n=new Ur,a.set(r,n)),n}},{key:"addIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).add(a)}},{key:"deleteIdForKey",value:function(r,a){r!=null&&this.getIdsFor(r).delete(a)}},{key:"getNumberOfIdsForKey",value:function(r){return r==null?0:this.getIdsFor(r).size}},{key:"updateKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);this.deleteIdForKey(n,a),this.addIdForKey(i,a),this.keyForId.set(a,i)}},{key:"deleteKeyMappingFor",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteIdForKey(n,a),this.keyForId.delete(a)}},{key:"keyHasChangedFor",value:function(r){var a=r.id(),n=this.keyForId.get(a),i=this.getKey(r);return n!==i}},{key:"isInvalid",value:function(r){return this.keyHasChangedFor(r)||this.doesEleInvalidateKey(r)}},{key:"getCachesAt",value:function(r){var a=this.cachesByLvl,n=this.lvls,i=a.get(r);return i||(i=new Bt,a.set(r,i),n.push(r)),i}},{key:"getCache",value:function(r,a){return this.getCachesAt(a).get(r)}},{key:"get",value:function(r,a){var n=this.getKey(r),i=this.getCache(n,a);return i!=null&&this.updateKeyMappingFor(r),i}},{key:"getForCachedKey",value:function(r,a){var n=this.keyForId.get(r.id()),i=this.getCache(n,a);return i}},{key:"hasCache",value:function(r,a){return this.getCachesAt(a).has(r)}},{key:"has",value:function(r,a){var n=this.getKey(r);return this.hasCache(n,a)}},{key:"setCache",value:function(r,a,n){n.key=r,this.getCachesAt(a).set(r,n)}},{key:"set",value:function(r,a,n){var i=this.getKey(r);this.setCache(i,a,n),this.updateKeyMappingFor(r)}},{key:"deleteCache",value:function(r,a){this.getCachesAt(a).delete(r)}},{key:"delete",value:function(r,a){var n=this.getKey(r);this.deleteCache(n,a)}},{key:"invalidateKey",value:function(r){var a=this;this.lvls.forEach(function(n){return a.deleteCache(r,n)})}},{key:"invalidate",value:function(r){var a=r.id(),n=this.keyForId.get(a);this.deleteKeyMappingFor(r);var i=this.doesEleInvalidateKey(r);return i&&this.invalidateKey(n),i||this.getNumberOfIdsForKey(n)===0}}]),t}(),lo=25,Za=50,sn=-4,fi=3,up=7.99,lp=8,fp=1024,hp=1024,cp=1024,vp=.2,dp=.8,gp=10,pp=.15,yp=.1,mp=.9,bp=.9,Ep=100,wp=1,Mr={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},xp=tt({getKey:null,doesEleInvalidateKey:ln,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:Ro,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),fa=function(e,r){var a=this;a.renderer=e,a.onDequeues=[];var n=xp(r);be(a,n),a.lookup=new op(n.getKey,n.doesEleInvalidateKey),a.setupDequeueing()},Xe=fa.prototype;Xe.reasons=Mr;Xe.getTextureQueue=function(t){var e=this;return e.eleImgCaches=e.eleImgCaches||{},e.eleImgCaches[t]=e.eleImgCaches[t]||[]};Xe.getRetiredTextureQueue=function(t){var e=this,r=e.eleImgCaches.retired=e.eleImgCaches.retired||{},a=r[t]=r[t]||[];return a};Xe.getElementQueue=function(){var t=this,e=t.eleCacheQueue=t.eleCacheQueue||new La(function(r,a){return a.reqs-r.reqs});return e};Xe.getElementKeyToQueue=function(){var t=this,e=t.eleKeyToCacheQueue=t.eleKeyToCacheQueue||{};return e};Xe.getElement=function(t,e,r,a,n){var i=this,s=this.renderer,o=s.cy.zoom(),l=this.lookup;if(!e||e.w===0||e.h===0||isNaN(e.w)||isNaN(e.h)||!t.visible()||t.removed()||!i.allowEdgeTxrCaching&&t.isEdge()||!i.allowParentTxrCaching&&t.isParent())return null;if(a==null&&(a=Math.ceil(wi(o*r))),a<sn)a=sn;else if(o>=up||a>fi)return null;var u=Math.pow(2,a),f=e.h*u,h=e.w*u,c=s.eleTextBiggerThanMin(t,u);if(!this.isVisible(t,c))return null;var v=l.get(t,a);if(v&&v.invalidated&&(v.invalidated=!1,v.texture.invalidatedWidth-=v.width),v)return v;var d;if(f<=lo?d=lo:f<=Za?d=Za:d=Math.ceil(f/Za)*Za,f>cp||h>hp)return null;var y=i.getTextureQueue(d),p=y[y.length-2],g=function(){return i.recycleTexture(d,h)||i.addTexture(d,h)};p||(p=y[y.length-1]),p||(p=g()),p.width-p.usedWidth<h&&(p=g());for(var m=function(R){return R&&R.scaledLabelShown===c},E=n&&n===Mr.dequeue,D=n&&n===Mr.highQuality,b=n&&n===Mr.downscale,x,w=a+1;w<=fi;w++){var T=l.get(t,w);if(T){x=T;break}}var C=x&&x.level===a+1?x:null,S=function(){p.context.drawImage(C.texture.canvas,C.x,0,C.width,C.height,p.usedWidth,0,h,f)};if(p.context.setTransform(1,0,0,1,0,0),p.context.clearRect(p.usedWidth,0,h,d),m(C))S();else if(m(x))if(D){for(var A=x.level;A>a;A--)C=i.getElement(t,e,r,A,Mr.downscale);S()}else return i.queueElement(t,x.level-1),x;else{var L;if(!E&&!D&&!b)for(var I=a-1;I>=sn;I--){var O=l.get(t,I);if(O){L=O;break}}if(m(L))return i.queueElement(t,a),L;p.context.translate(p.usedWidth,0),p.context.scale(u,u),this.drawElement(p.context,t,e,c,!1),p.context.scale(1/u,1/u),p.context.translate(-p.usedWidth,0)}return v={x:p.usedWidth,texture:p,level:a,scale:u,width:h,height:f,scaledLabelShown:c},p.usedWidth+=Math.ceil(h+lp),p.eleCaches.push(v),l.set(t,a,v),i.checkTextureFullness(p),v};Xe.invalidateElements=function(t){for(var e=0;e<t.length;e++)this.invalidateElement(t[e])};Xe.invalidateElement=function(t){var e=this,r=e.lookup,a=[],n=r.isInvalid(t);if(n){for(var i=sn;i<=fi;i++){var s=r.getForCachedKey(t,i);s&&a.push(s)}var o=r.invalidate(t);if(o)for(var l=0;l<a.length;l++){var u=a[l],f=u.texture;f.invalidatedWidth+=u.width,u.invalidated=!0,e.checkTextureUtility(f)}e.removeFromQueue(t)}};Xe.checkTextureUtility=function(t){t.invalidatedWidth>=vp*t.width&&this.retireTexture(t)};Xe.checkTextureFullness=function(t){var e=this,r=e.getTextureQueue(t.height);t.usedWidth/t.width>dp&&t.fullnessChecks>=gp?rr(r,t):t.fullnessChecks++};Xe.retireTexture=function(t){var e=this,r=t.height,a=e.getTextureQueue(r),n=this.lookup;rr(a,t),t.retired=!0;for(var i=t.eleCaches,s=0;s<i.length;s++){var o=i[s];n.deleteCache(o.key,o.level)}Ei(i);var l=e.getRetiredTextureQueue(r);l.push(t)};Xe.addTexture=function(t,e){var r=this,a=r.getTextureQueue(t),n={};return a.push(n),n.eleCaches=[],n.height=t,n.width=Math.max(fp,e),n.usedWidth=0,n.invalidatedWidth=0,n.fullnessChecks=0,n.canvas=r.renderer.makeOffscreenCanvas(n.width,n.height),n.context=n.canvas.getContext("2d"),n};Xe.recycleTexture=function(t,e){for(var r=this,a=r.getTextureQueue(t),n=r.getRetiredTextureQueue(t),i=0;i<n.length;i++){var s=n[i];if(s.width>=e)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,Ei(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),rr(n,s),a.push(s),s}};Xe.queueElement=function(t,e){var r=this,a=r.getElementQueue(),n=r.getElementKeyToQueue(),i=this.getKey(t),s=n[i];if(s)s.level=Math.max(s.level,e),s.eles.merge(t),s.reqs++,a.updateItem(s);else{var o={eles:t.spawn().merge(t),level:e,reqs:1,key:i};a.push(o),n[i]=o}};Xe.dequeue=function(t){for(var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=[],i=e.lookup,s=0;s<wp&&r.size()>0;s++){var o=r.pop(),l=o.key,u=o.eles[0],f=i.hasCache(u,o.level);if(a[l]=null,f)continue;n.push(o);var h=e.getBoundingBox(u);e.getElement(u,h,t,o.level,Mr.dequeue)}return n};Xe.removeFromQueue=function(t){var e=this,r=e.getElementQueue(),a=e.getElementKeyToQueue(),n=this.getKey(t),i=a[n];i!=null&&(i.eles.length===1?(i.reqs=mi,r.updateItem(i),r.pop(),a[n]=null):i.eles.unmerge(t))};Xe.onDequeue=function(t){this.onDequeues.push(t)};Xe.offDequeue=function(t){rr(this.onDequeues,t)};Xe.setupDequeueing=$u.setupDequeueing({deqRedrawThreshold:Ep,deqCost:pp,deqAvgCost:yp,deqNoDrawCost:mp,deqFastCost:bp,deq:function(e,r,a){return e.dequeue(r,a)},onDeqd:function(e,r){for(var a=0;a<e.onDequeues.length;a++){var n=e.onDequeues[a];n(r)}},shouldRedraw:function(e,r,a,n){for(var i=0;i<r.length;i++)for(var s=r[i].eles,o=0;o<s.length;o++){var l=s[o].boundingBox();if(xi(l,n))return!0}return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var Tp=1,ca=-4,yn=2,Cp=3.99,Dp=50,Sp=50,Lp=.15,Ap=.1,Op=.9,Np=.9,Ip=1,fo=250,Mp=4e3*4e3,Rp=!0,Yu=function(e){var r=this,a=r.renderer=e,n=a.cy;r.layersByLevel={},r.firstGet=!0,r.lastInvalidationTime=$t()-2*fo,r.skipping=!1,r.eleTxrDeqs=n.collection(),r.scheduleElementRefinement=En(function(){r.refineElementTextures(r.eleTxrDeqs),r.eleTxrDeqs.unmerge(r.eleTxrDeqs)},Sp),a.beforeRender(function(s,o){o-r.lastInvalidationTime<=fo?r.skipping=!0:r.skipping=!1},a.beforeRenderPriorities.lyrTxrSkip);var i=function(o,l){return l.reqs-o.reqs};r.layersQueue=new La(i),r.setupDequeueing()},rt=Yu.prototype,ho=0,kp=Math.pow(2,53)-1;rt.makeLayer=function(t,e){var r=Math.pow(2,e),a=Math.ceil(t.w*r),n=Math.ceil(t.h*r),i=this.renderer.makeOffscreenCanvas(a,n),s={id:ho=++ho%kp,bb:t,level:e,width:a,height:n,canvas:i,context:i.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,l=-s.bb.x1,u=-s.bb.y1;return o.scale(r,r),o.translate(l,u),s};rt.getLayers=function(t,e,r){var a=this,n=a.renderer,i=n.cy,s=i.zoom(),o=a.firstGet;if(a.firstGet=!1,r==null){if(r=Math.ceil(wi(s*e)),r<ca)r=ca;else if(s>=Cp||r>yn)return null}a.validateLayersElesOrdering(r,t);var l=a.layersByLevel,u=Math.pow(2,r),f=l[r]=l[r]||[],h,c=a.levelIsComplete(r,t),v,d=function(){var S=function(k){if(a.validateLayersElesOrdering(k,t),a.levelIsComplete(k,t))return v=l[k],!0},A=function(k){if(!v)for(var R=r+k;ca<=R&&R<=yn&&!S(R);R+=k);};A(1),A(-1);for(var L=f.length-1;L>=0;L--){var I=f[L];I.invalid&&rr(f,I)}};if(!c)d();else return f;var y=function(){if(!h){h=gt();for(var S=0;S<t.length;S++)zo(h,t[S].boundingBox())}return h},p=function(S){S=S||{};var A=S.after;y();var L=h.w*u*(h.h*u);if(L>Mp)return null;var I=a.makeLayer(h,r);if(A!=null){var O=f.indexOf(A)+1;f.splice(O,0,I)}else(S.insert===void 0||S.insert)&&f.unshift(I);return I};if(a.skipping&&!o)return null;for(var g=null,m=t.length/Tp,E=!o,D=0;D<t.length;D++){var b=t[D],x=b._private.rscratch,w=x.imgLayerCaches=x.imgLayerCaches||{},T=w[r];if(T){g=T;continue}if((!g||g.eles.length>=m||!Vo(g.bb,b.boundingBox()))&&(g=p({insert:!0,after:g}),!g))return null;v||E?a.queueLayer(g,b):a.drawEleInLayer(g,b,r,e),g.eles.push(b),w[r]=g}return v||(E?null:f)};rt.getEleLevelForLayerLevel=function(t,e){return t};rt.drawEleInLayer=function(t,e,r,a){var n=this,i=this.renderer,s=t.context,o=e.boundingBox();o.w===0||o.h===0||!e.visible()||(r=n.getEleLevelForLayerLevel(r,a),i.setImgSmoothing(s,!1),i.drawCachedElement(s,e,null,null,r,Rp),i.setImgSmoothing(s,!0))};rt.levelIsComplete=function(t,e){var r=this,a=r.layersByLevel[t];if(!a||a.length===0)return!1;for(var n=0,i=0;i<a.length;i++){var s=a[i];if(s.reqs>0||s.invalid)return!1;n+=s.eles.length}return n===e.length};rt.validateLayersElesOrdering=function(t,e){var r=this.layersByLevel[t];if(r)for(var a=0;a<r.length;a++){for(var n=r[a],i=-1,s=0;s<e.length;s++)if(n.eles[0]===e[s]){i=s;break}if(i<0){this.invalidateLayer(n);continue}for(var o=i,s=0;s<n.eles.length;s++)if(n.eles[s]!==e[o+s]){this.invalidateLayer(n);break}}};rt.updateElementsInLayers=function(t,e){for(var r=this,a=Da(t[0]),n=0;n<t.length;n++)for(var i=a?null:t[n],s=a?t[n]:t[n].ele,o=s._private.rscratch,l=o.imgLayerCaches=o.imgLayerCaches||{},u=ca;u<=yn;u++){var f=l[u];f&&(i&&r.getEleLevelForLayerLevel(f.level)!==i.level||e(f,s,i))}};rt.haveLayers=function(){for(var t=this,e=!1,r=ca;r<=yn;r++){var a=t.layersByLevel[r];if(a&&a.length>0){e=!0;break}}return e};rt.invalidateElements=function(t){var e=this;t.length!==0&&(e.lastInvalidationTime=$t(),!(t.length===0||!e.haveLayers())&&e.updateElementsInLayers(t,function(a,n,i){e.invalidateLayer(a)}))};rt.invalidateLayer=function(t){if(this.lastInvalidationTime=$t(),!t.invalid){var e=t.level,r=t.eles,a=this.layersByLevel[e];rr(a,t),t.elesQueue=[],t.invalid=!0,t.replacement&&(t.replacement.invalid=!0);for(var n=0;n<r.length;n++){var i=r[n]._private.rscratch.imgLayerCaches;i&&(i[e]=null)}}};rt.refineElementTextures=function(t){var e=this;e.updateElementsInLayers(t,function(a,n,i){var s=a.replacement;if(s||(s=a.replacement=e.makeLayer(a.bb,a.level),s.replaces=a,s.eles=a.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)e.queueLayer(s,s.eles[o])})};rt.enqueueElementRefinement=function(t){this.eleTxrDeqs.merge(t),this.scheduleElementRefinement()};rt.queueLayer=function(t,e){var r=this,a=r.layersQueue,n=t.elesQueue,i=n.hasId=n.hasId||{};if(!t.replacement){if(e){if(i[e.id()])return;n.push(e),i[e.id()]=!0}t.reqs?(t.reqs++,a.updateItem(t)):(t.reqs=1,a.push(t))}};rt.dequeue=function(t){for(var e=this,r=e.layersQueue,a=[],n=0;n<Ip&&r.size()!==0;){var i=r.peek();if(i.replacement){r.pop();continue}if(i.replaces&&i!==i.replaces.replacement){r.pop();continue}if(i.invalid){r.pop();continue}var s=i.elesQueue.shift();s&&(e.drawEleInLayer(i,s,i.level,t),n++),a.length===0&&a.push(!0),i.elesQueue.length===0&&(r.pop(),i.reqs=0,i.replaces&&e.applyLayerReplacement(i),e.requestRedraw())}return a};rt.applyLayerReplacement=function(t){var e=this,r=e.layersByLevel[t.level],a=t.replaces,n=r.indexOf(a);if(!(n<0||a.invalid)){r[n]=t;for(var i=0;i<t.eles.length;i++){var s=t.eles[i]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[t.level]=t)}e.requestRedraw()}};rt.requestRedraw=En(function(){var t=this.renderer;t.redrawHint("eles",!0),t.redrawHint("drag",!0),t.redraw()},100);rt.setupDequeueing=$u.setupDequeueing({deqRedrawThreshold:Dp,deqCost:Lp,deqAvgCost:Ap,deqNoDrawCost:Op,deqFastCost:Np,deq:function(e,r){return e.dequeue(r)},onDeqd:bi,shouldRedraw:Ro,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var _u={},co;function Pp(t,e){for(var r=0;r<e.length;r++){var a=e[r];t.lineTo(a.x,a.y)}}function Bp(t,e,r){for(var a,n=0;n<e.length;n++){var i=e[n];n===0&&(a=i),t.lineTo(i.x,i.y)}t.quadraticCurveTo(r.x,r.y,a.x,a.y)}function vo(t,e,r){t.beginPath&&t.beginPath();for(var a=e,n=0;n<a.length;n++){var i=a[n];t.lineTo(i.x,i.y)}var s=r,o=r[0];t.moveTo(o.x,o.y);for(var n=1;n<s.length;n++){var i=s[n];t.lineTo(i.x,i.y)}t.closePath&&t.closePath()}function Fp(t,e,r,a,n){t.beginPath&&t.beginPath(),t.arc(r,a,n,0,Math.PI*2,!1);var i=e,s=i[0];t.moveTo(s.x,s.y);for(var o=0;o<i.length;o++){var l=i[o];t.lineTo(l.x,l.y)}t.closePath&&t.closePath()}function Gp(t,e,r,a){t.arc(e,r,a,0,Math.PI*2,!1)}_u.arrowShapeImpl=function(t){return(co||(co={polygon:Pp,"triangle-backcurve":Bp,"triangle-tee":vo,"circle-triangle":Fp,"triangle-cross":vo,circle:Gp}))[t]};var zt={};zt.drawElement=function(t,e,r,a,n,i){var s=this;e.isNode()?s.drawNode(t,e,r,a,n,i):s.drawEdge(t,e,r,a,n,i)};zt.drawElementOverlay=function(t,e){var r=this;e.isNode()?r.drawNodeOverlay(t,e):r.drawEdgeOverlay(t,e)};zt.drawElementUnderlay=function(t,e){var r=this;e.isNode()?r.drawNodeUnderlay(t,e):r.drawEdgeUnderlay(t,e)};zt.drawCachedElementPortion=function(t,e,r,a,n,i,s,o){var l=this,u=r.getBoundingBox(e);if(!(u.w===0||u.h===0)){var f=r.getElement(e,u,a,n,i);if(f!=null){var h=o(l,e);if(h===0)return;var c=s(l,e),v=u.x1,d=u.y1,y=u.w,p=u.h,g,m,E,D,b;if(c!==0){var x=r.getRotationPoint(e);E=x.x,D=x.y,t.translate(E,D),t.rotate(c),b=l.getImgSmoothing(t),b||l.setImgSmoothing(t,!0);var w=r.getRotationOffset(e);g=w.x,m=w.y}else g=v,m=d;var T;h!==1&&(T=t.globalAlpha,t.globalAlpha=T*h),t.drawImage(f.texture.canvas,f.x,0,f.width,f.height,g,m,y,p),h!==1&&(t.globalAlpha=T),c!==0&&(t.rotate(-c),t.translate(-E,-D),b||l.setImgSmoothing(t,!1))}else r.drawElement(t,e)}};var zp=function(){return 0},Vp=function(e,r){return e.getTextAngle(r,null)},Up=function(e,r){return e.getTextAngle(r,"source")},$p=function(e,r){return e.getTextAngle(r,"target")},Yp=function(e,r){return r.effectiveOpacity()},Zn=function(e,r){return r.pstyle("text-opacity").pfValue*r.effectiveOpacity()};zt.drawCachedElement=function(t,e,r,a,n,i){var s=this,o=s.data,l=o.eleTxrCache,u=o.lblTxrCache,f=o.slbTxrCache,h=o.tlbTxrCache,c=e.boundingBox(),v=i===!0?l.reasons.highQuality:null;if(!(c.w===0||c.h===0||!e.visible())&&(!a||xi(c,a))){var d=e.isEdge(),y=e.element()._private.rscratch.badLine;s.drawElementUnderlay(t,e),s.drawCachedElementPortion(t,e,l,r,n,v,zp,Yp),(!d||!y)&&s.drawCachedElementPortion(t,e,u,r,n,v,Vp,Zn),d&&!y&&(s.drawCachedElementPortion(t,e,f,r,n,v,Up,Zn),s.drawCachedElementPortion(t,e,h,r,n,v,$p,Zn)),s.drawElementOverlay(t,e)}};zt.drawElements=function(t,e){for(var r=this,a=0;a<e.length;a++){var n=e[a];r.drawElement(t,n)}};zt.drawCachedElements=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];n.drawCachedElement(t,s,r,a)}};zt.drawCachedNodes=function(t,e,r,a){for(var n=this,i=0;i<e.length;i++){var s=e[i];s.isNode()&&n.drawCachedElement(t,s,r,a)}};zt.drawLayeredElements=function(t,e,r,a){var n=this,i=n.data.lyrTxrCache.getLayers(e,r);if(i)for(var s=0;s<i.length;s++){var o=i[s],l=o.bb;l.w===0||l.h===0||t.drawImage(o.canvas,l.x1,l.y1,l.w,l.h)}else n.drawCachedElements(t,e,r,a)};var qt={};qt.drawEdge=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=e._private.rscratch;if(!(i&&!e.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var l;r&&(l=r,t.translate(-l.x1,-l.y1));var u=i?e.pstyle("opacity").value:1,f=i?e.pstyle("line-opacity").value:1,h=e.pstyle("curve-style").value,c=e.pstyle("line-style").value,v=e.pstyle("width").pfValue,d=e.pstyle("line-cap").value,y=u*f,p=u*f,g=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;h==="straight-triangle"?(s.eleStrokeStyle(t,e,L),s.drawEdgeTrianglePath(e,t,o.allpts)):(t.lineWidth=v,t.lineCap=d,s.eleStrokeStyle(t,e,L),s.drawEdgePath(e,t,o.allpts,c),t.lineCap="butt")},m=function(){n&&s.drawEdgeOverlay(t,e)},E=function(){n&&s.drawEdgeUnderlay(t,e)},D=function(){var L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:p;s.drawArrowheads(t,e,L)},b=function(){s.drawElementText(t,e,null,a)};t.lineJoin="round";var x=e.pstyle("ghost").value==="yes";if(x){var w=e.pstyle("ghost-offset-x").pfValue,T=e.pstyle("ghost-offset-y").pfValue,C=e.pstyle("ghost-opacity").value,S=y*C;t.translate(w,T),g(S),D(S),t.translate(-w,-T)}E(),g(),D(),m(),b(),r&&t.translate(l.x1,l.y1)}};var Hu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a){if(a.visible()){var n=a.pstyle("".concat(e,"-opacity")).value;if(n!==0){var i=this,s=i.usePaths(),o=a._private.rscratch,l=a.pstyle("".concat(e,"-padding")).pfValue,u=2*l,f=a.pstyle("".concat(e,"-color")).value;r.lineWidth=u,o.edgeType==="self"&&!s?r.lineCap="butt":r.lineCap="round",i.colorStrokeStyle(r,f[0],f[1],f[2],n),i.drawEdgePath(a,r,o.allpts,"solid")}}}};qt.drawEdgeOverlay=Hu("overlay");qt.drawEdgeUnderlay=Hu("underlay");qt.drawEdgePath=function(t,e,r,a){var n=t._private.rscratch,i=e,s,o=!1,l=this.usePaths(),u=t.pstyle("line-dash-pattern").pfValue,f=t.pstyle("line-dash-offset").pfValue;if(l){var h=r.join("$"),c=n.pathCacheKey&&n.pathCacheKey===h;c?(s=e=n.pathCache,o=!0):(s=e=new Path2D,n.pathCacheKey=h,n.pathCache=s)}if(i.setLineDash)switch(a){case"dotted":i.setLineDash([1,1]);break;case"dashed":i.setLineDash(u),i.lineDashOffset=f;break;case"solid":i.setLineDash([]);break}if(!o&&!n.badLine)switch(e.beginPath&&e.beginPath(),e.moveTo(r[0],r[1]),n.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var v=2;v+3<r.length;v+=4)e.quadraticCurveTo(r[v],r[v+1],r[v+2],r[v+3]);break;case"straight":case"haystack":for(var d=2;d+1<r.length;d+=2)e.lineTo(r[d],r[d+1]);break;case"segments":if(n.isRound){var y=xl(n.roundCorners),p;try{for(y.s();!(p=y.n()).done;){var g=p.value;ku(e,g)}}catch(E){y.e(E)}finally{y.f()}e.lineTo(r[r.length-2],r[r.length-1])}else for(var m=2;m+1<r.length;m+=2)e.lineTo(r[m],r[m+1]);break}e=i,l?e.stroke(s):e.stroke(),e.setLineDash&&e.setLineDash([])};qt.drawEdgeTrianglePath=function(t,e,r){e.fillStyle=e.strokeStyle;for(var a=t.pstyle("width").pfValue,n=0;n+1<r.length;n+=2){var i=[r[n+2]-r[n],r[n+3]-r[n+1]],s=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=[i[1]/s,-i[0]/s],l=[o[0]*a/2,o[1]*a/2];e.beginPath(),e.moveTo(r[n]-l[0],r[n+1]-l[1]),e.lineTo(r[n]+l[0],r[n+1]+l[1]),e.lineTo(r[n+2],r[n+3]),e.closePath(),e.fill()}};qt.drawArrowheads=function(t,e,r){var a=e._private.rscratch,n=a.edgeType==="haystack";n||this.drawArrowhead(t,e,"source",a.arrowStartX,a.arrowStartY,a.srcArrowAngle,r),this.drawArrowhead(t,e,"mid-target",a.midX,a.midY,a.midtgtArrowAngle,r),this.drawArrowhead(t,e,"mid-source",a.midX,a.midY,a.midsrcArrowAngle,r),n||this.drawArrowhead(t,e,"target",a.arrowEndX,a.arrowEndY,a.tgtArrowAngle,r)};qt.drawArrowhead=function(t,e,r,a,n,i,s){if(!(isNaN(a)||a==null||isNaN(n)||n==null||isNaN(i)||i==null)){var o=this,l=e.pstyle(r+"-arrow-shape").value;if(l!=="none"){var u=e.pstyle(r+"-arrow-fill").value==="hollow"?"both":"filled",f=e.pstyle(r+"-arrow-fill").value,h=e.pstyle("width").pfValue,c=e.pstyle(r+"-arrow-width"),v=c.value==="match-line"?h:c.pfValue;c.units==="%"&&(v*=h);var d=e.pstyle("opacity").value;s===void 0&&(s=d);var y=t.globalCompositeOperation;(s!==1||f==="hollow")&&(t.globalCompositeOperation="destination-out",o.colorFillStyle(t,255,255,255,1),o.colorStrokeStyle(t,255,255,255,1),o.drawArrowShape(e,t,u,h,l,v,a,n,i),t.globalCompositeOperation=y);var p=e.pstyle(r+"-arrow-color").value;o.colorFillStyle(t,p[0],p[1],p[2],s),o.colorStrokeStyle(t,p[0],p[1],p[2],s),o.drawArrowShape(e,t,f,h,l,v,a,n,i)}}};qt.drawArrowShape=function(t,e,r,a,n,i,s,o,l){var u=this,f=this.usePaths()&&n!=="triangle-cross",h=!1,c,v=e,d={x:s,y:o},y=t.pstyle("arrow-scale").value,p=this.getArrowWidth(a,y),g=u.arrowShapes[n];if(f){var m=u.arrowPathCache=u.arrowPathCache||[],E=pr(n),D=m[E];D!=null?(c=e=D,h=!0):(c=e=new Path2D,m[E]=c)}h||(e.beginPath&&e.beginPath(),f?g.draw(e,1,0,{x:0,y:0},1):g.draw(e,p,l,d,a),e.closePath&&e.closePath()),e=v,f&&(e.translate(s,o),e.rotate(l),e.scale(p,p)),(r==="filled"||r==="both")&&(f?e.fill(c):e.fill()),(r==="hollow"||r==="both")&&(e.lineWidth=i/(f?p:1),e.lineJoin="miter",f?e.stroke(c):e.stroke()),f&&(e.scale(1/p,1/p),e.rotate(-l),e.translate(-s,-o))};var Fi={};Fi.safeDrawImage=function(t,e,r,a,n,i,s,o,l,u){if(!(n<=0||i<=0||l<=0||u<=0))try{t.drawImage(e,r,a,n,i,s,o,l,u)}catch(f){Ne(f)}};Fi.drawInscribedImage=function(t,e,r,a,n){var i=this,s=r.position(),o=s.x,l=s.y,u=r.cy().style(),f=u.getIndexedStyle.bind(u),h=f(r,"background-fit","value",a),c=f(r,"background-repeat","value",a),v=r.width(),d=r.height(),y=r.padding()*2,p=v+(f(r,"background-width-relative-to","value",a)==="inner"?0:y),g=d+(f(r,"background-height-relative-to","value",a)==="inner"?0:y),m=r._private.rscratch,E=f(r,"background-clip","value",a),D=E==="node",b=f(r,"background-image-opacity","value",a)*n,x=f(r,"background-image-smoothing","value",a),w=r.pstyle("corner-radius").value;w!=="auto"&&(w=r.pstyle("corner-radius").pfValue);var T=e.width||e.cachedW,C=e.height||e.cachedH;(T==null||C==null)&&(document.body.appendChild(e),T=e.cachedW=e.width||e.offsetWidth,C=e.cachedH=e.height||e.offsetHeight,document.body.removeChild(e));var S=T,A=C;if(f(r,"background-width","value",a)!=="auto"&&(f(r,"background-width","units",a)==="%"?S=f(r,"background-width","pfValue",a)*p:S=f(r,"background-width","pfValue",a)),f(r,"background-height","value",a)!=="auto"&&(f(r,"background-height","units",a)==="%"?A=f(r,"background-height","pfValue",a)*g:A=f(r,"background-height","pfValue",a)),!(S===0||A===0)){if(h==="contain"){var L=Math.min(p/S,g/A);S*=L,A*=L}else if(h==="cover"){var L=Math.max(p/S,g/A);S*=L,A*=L}var I=o-p/2,O=f(r,"background-position-x","units",a),k=f(r,"background-position-x","pfValue",a);O==="%"?I+=(p-S)*k:I+=k;var R=f(r,"background-offset-x","units",a),M=f(r,"background-offset-x","pfValue",a);R==="%"?I+=(p-S)*M:I+=M;var P=l-g/2,F=f(r,"background-position-y","units",a),V=f(r,"background-position-y","pfValue",a);F==="%"?P+=(g-A)*V:P+=V;var G=f(r,"background-offset-y","units",a),B=f(r,"background-offset-y","pfValue",a);G==="%"?P+=(g-A)*B:P+=B,m.pathCache&&(I-=o,P-=l,o=0,l=0);var Y=t.globalAlpha;t.globalAlpha=b;var Z=i.getImgSmoothing(t),K=!1;if(x==="no"&&Z?(i.setImgSmoothing(t,!1),K=!0):x==="yes"&&!Z&&(i.setImgSmoothing(t,!0),K=!0),c==="no-repeat")D&&(t.save(),m.pathCache?t.clip(m.pathCache):(i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,g,w,m),t.clip())),i.safeDrawImage(t,e,0,0,T,C,I,P,S,A),D&&t.restore();else{var U=t.createPattern(e,c);t.fillStyle=U,i.nodeShapes[i.getNodeShape(r)].draw(t,o,l,p,g,w,m),t.translate(I,P),t.fill(),t.translate(-I,-P)}t.globalAlpha=Y,K&&i.setImgSmoothing(t,Z)}};var Tr={};Tr.eleTextBiggerThanMin=function(t,e){if(!e){var r=t.cy().zoom(),a=this.getPixelRatio(),n=Math.ceil(wi(r*a));e=Math.pow(2,n)}var i=t.pstyle("font-size").pfValue*e,s=t.pstyle("min-zoomed-font-size").pfValue;return!(i<s)};Tr.drawElementText=function(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(a==null){if(i&&!s.eleTextBiggerThanMin(e))return}else if(a===!1)return;if(e.isNode()){var o=e.pstyle("label");if(!o||!o.value)return;var l=s.getLabelJustification(e);t.textAlign=l,t.textBaseline="bottom"}else{var u=e.element()._private.rscratch.badLine,f=e.pstyle("label"),h=e.pstyle("source-label"),c=e.pstyle("target-label");if(u||(!f||!f.value)&&(!h||!h.value)&&(!c||!c.value))return;t.textAlign="center",t.textBaseline="bottom"}var v=!r,d;r&&(d=r,t.translate(-d.x1,-d.y1)),n==null?(s.drawText(t,e,null,v,i),e.isEdge()&&(s.drawText(t,e,"source",v,i),s.drawText(t,e,"target",v,i))):s.drawText(t,e,n,v,i),r&&t.translate(d.x1,d.y1)};Tr.getFontCache=function(t){var e;this.fontCaches=this.fontCaches||[];for(var r=0;r<this.fontCaches.length;r++)if(e=this.fontCaches[r],e.context===t)return e;return e={context:t},this.fontCaches.push(e),e};Tr.setupTextStyle=function(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=e.pstyle("font-style").strValue,n=e.pstyle("font-size").pfValue+"px",i=e.pstyle("font-family").strValue,s=e.pstyle("font-weight").strValue,o=r?e.effectiveOpacity()*e.pstyle("text-opacity").value:1,l=e.pstyle("text-outline-opacity").value*o,u=e.pstyle("color").value,f=e.pstyle("text-outline-color").value;t.font=a+" "+s+" "+n+" "+i,t.lineJoin="round",this.colorFillStyle(t,u[0],u[1],u[2],o),this.colorStrokeStyle(t,f[0],f[1],f[2],l)};function Qn(t,e,r,a,n){var i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;t.beginPath(),t.moveTo(e+i,r),t.lineTo(e+a-i,r),t.quadraticCurveTo(e+a,r,e+a,r+i),t.lineTo(e+a,r+n-i),t.quadraticCurveTo(e+a,r+n,e+a-i,r+n),t.lineTo(e+i,r+n),t.quadraticCurveTo(e,r+n,e,r+n-i),t.lineTo(e,r+i),t.quadraticCurveTo(e,r,e+i,r),t.closePath(),s?t.stroke():t.fill()}Tr.getTextAngle=function(t,e){var r,a=t._private,n=a.rscratch,i=e?e+"-":"",s=t.pstyle(i+"text-rotation"),o=At(n,"labelAngle",e);return s.strValue==="autorotate"?r=t.isEdge()?o:0:s.strValue==="none"?r=0:r=s.pfValue,r};Tr.drawText=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=e._private,s=i.rscratch,o=n?e.effectiveOpacity():1;if(!(n&&(o===0||e.pstyle("text-opacity").value===0))){r==="main"&&(r=null);var l=At(s,"labelX",r),u=At(s,"labelY",r),f,h,c=this.getLabelText(e,r);if(c!=null&&c!==""&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(t,e,n);var v=r?r+"-":"",d=At(s,"labelWidth",r),y=At(s,"labelHeight",r),p=e.pstyle(v+"text-margin-x").pfValue,g=e.pstyle(v+"text-margin-y").pfValue,m=e.isEdge(),E=e.pstyle("text-halign").value,D=e.pstyle("text-valign").value;m&&(E="center",D="center"),l+=p,u+=g;var b;switch(a?b=this.getTextAngle(e,r):b=0,b!==0&&(f=l,h=u,t.translate(f,h),t.rotate(b),l=0,u=0),D){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y;break}var x=e.pstyle("text-background-opacity").value,w=e.pstyle("text-border-opacity").value,T=e.pstyle("text-border-width").pfValue,C=e.pstyle("text-background-padding").pfValue,S=e.pstyle("text-background-shape").strValue,A=S.indexOf("round")===0,L=2;if(x>0||T>0&&w>0){var I=l-C;switch(E){case"left":I-=d;break;case"center":I-=d/2;break}var O=u-y-C,k=d+2*C,R=y+2*C;if(x>0){var M=t.fillStyle,P=e.pstyle("text-background-color").value;t.fillStyle="rgba("+P[0]+","+P[1]+","+P[2]+","+x*o+")",A?Qn(t,I,O,k,R,L):t.fillRect(I,O,k,R),t.fillStyle=M}if(T>0&&w>0){var F=t.strokeStyle,V=t.lineWidth,G=e.pstyle("text-border-color").value,B=e.pstyle("text-border-style").value;if(t.strokeStyle="rgba("+G[0]+","+G[1]+","+G[2]+","+w*o+")",t.lineWidth=T,t.setLineDash)switch(B){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"double":t.lineWidth=T/4,t.setLineDash([]);break;case"solid":t.setLineDash([]);break}if(A?Qn(t,I,O,k,R,L,"stroke"):t.strokeRect(I,O,k,R),B==="double"){var Y=T/2;A?Qn(t,I+Y,O+Y,k-Y*2,R-Y*2,L,"stroke"):t.strokeRect(I+Y,O+Y,k-Y*2,R-Y*2)}t.setLineDash&&t.setLineDash([]),t.lineWidth=V,t.strokeStyle=F}}var Z=2*e.pstyle("text-outline-width").pfValue;if(Z>0&&(t.lineWidth=Z),e.pstyle("text-wrap").value==="wrap"){var K=At(s,"labelWrapCachedLines",r),U=At(s,"labelLineHeight",r),z=d/2,_=this.getLabelJustification(e);switch(_==="auto"||(E==="left"?_==="left"?l+=-d:_==="center"&&(l+=-z):E==="center"?_==="left"?l+=-z:_==="right"&&(l+=z):E==="right"&&(_==="center"?l+=z:_==="right"&&(l+=d))),D){case"top":u-=(K.length-1)*U;break;case"center":case"bottom":u-=(K.length-1)*U;break}for(var q=0;q<K.length;q++)Z>0&&t.strokeText(K[q],l,u),t.fillText(K[q],l,u),u+=U}else Z>0&&t.strokeText(c,l,u),t.fillText(c,l,u);b!==0&&(t.rotate(-b),t.translate(-f,-h))}}};var Zr={};Zr.drawNode=function(t,e,r){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,n=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,l,u=e._private,f=u.rscratch,h=e.position();if(!(!ne(h.x)||!ne(h.y))&&!(i&&!e.visible())){var c=i?e.effectiveOpacity():1,v=s.usePaths(),d,y=!1,p=e.padding();o=e.width()+2*p,l=e.height()+2*p;var g;r&&(g=r,t.translate(-g.x1,-g.y1));for(var m=e.pstyle("background-image"),E=m.value,D=new Array(E.length),b=new Array(E.length),x=0,w=0;w<E.length;w++){var T=E[w],C=D[w]=T!=null&&T!=="none";if(C){var S=e.cy().style().getIndexedStyle(e,"background-image-crossorigin","value",w);x++,b[w]=s.getCachedImage(T,S,function(){u.backgroundTimestamp=Date.now(),e.emitAndNotify("background")})}}var A=e.pstyle("background-blacken").value,L=e.pstyle("border-width").pfValue,I=e.pstyle("background-opacity").value*c,O=e.pstyle("border-color").value,k=e.pstyle("border-style").value,R=e.pstyle("border-join").value,M=e.pstyle("border-cap").value,P=e.pstyle("border-position").value,F=e.pstyle("border-dash-pattern").pfValue,V=e.pstyle("border-dash-offset").pfValue,G=e.pstyle("border-opacity").value*c,B=e.pstyle("outline-width").pfValue,Y=e.pstyle("outline-color").value,Z=e.pstyle("outline-style").value,K=e.pstyle("outline-opacity").value*c,U=e.pstyle("outline-offset").value,z=e.pstyle("corner-radius").value;z!=="auto"&&(z=e.pstyle("corner-radius").pfValue);var _=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:I;s.eleFillStyle(t,e,ae)},q=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:G;s.colorStrokeStyle(t,O[0],O[1],O[2],ae)},J=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:K;s.colorStrokeStyle(t,Y[0],Y[1],Y[2],ae)},ee=function(ae,W,re,pe){var ye=s.nodePathCache=s.nodePathCache||[],he=Mo(re==="polygon"?re+","+pe.join(","):re,""+W,""+ae,""+z),Ee=ye[he],le,de=!1;return Ee!=null?(le=Ee,de=!0,f.pathCache=le):(le=new Path2D,ye[he]=f.pathCache=le),{path:le,cacheHit:de}},oe=e.pstyle("shape").strValue,me=e.pstyle("shape-polygon-points").pfValue;if(v){t.translate(h.x,h.y);var te=ee(o,l,oe,me);d=te.path,y=te.cacheHit}var ie=function(){if(!y){var ae=h;v&&(ae={x:0,y:0}),s.nodeShapes[s.getNodeShape(e)].draw(d||t,ae.x,ae.y,o,l,z,f)}v?t.fill(d):t.fill()},ue=function(){for(var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,re=u.backgrounding,pe=0,ye=0;ye<b.length;ye++){var he=e.cy().style().getIndexedStyle(e,"background-image-containment","value",ye);if(W&&he==="over"||!W&&he==="inside"){pe++;continue}D[ye]&&b[ye].complete&&!b[ye].error&&(pe++,s.drawInscribedImage(t,b[ye],e,ye,ae))}u.backgrounding=pe!==x,re!==u.backgrounding&&e.updateStyle(!1)},ce=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:c;s.hasPie(e)&&(s.drawPie(t,e,W),ae&&(v||s.nodeShapes[s.getNodeShape(e)].draw(t,h.x,h.y,o,l,z,f)))},fe=function(){var ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:c,W=(A>0?A:-A)*ae,re=A>0?0:255;A!==0&&(s.colorFillStyle(t,re,re,re,W),v?t.fill(d):t.fill())},ge=function(){if(L>0){if(t.lineWidth=L,t.lineCap=M,t.lineJoin=R,t.setLineDash)switch(k){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash(F),t.lineDashOffset=V;break;case"solid":case"double":t.setLineDash([]);break}if(P!=="center"){if(t.save(),t.lineWidth*=2,P==="inside")v?t.clip(d):t.clip();else{var ae=new Path2D;ae.rect(-o/2-L,-l/2-L,o+2*L,l+2*L),ae.addPath(d),t.clip(ae,"evenodd")}v?t.stroke(d):t.stroke(),t.restore()}else v?t.stroke(d):t.stroke();if(k==="double"){t.lineWidth=L/3;var W=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(d):t.stroke(),t.globalCompositeOperation=W}t.setLineDash&&t.setLineDash([])}},Ae=function(){if(B>0){if(t.lineWidth=B,t.lineCap="butt",t.setLineDash)switch(Z){case"dotted":t.setLineDash([1,1]);break;case"dashed":t.setLineDash([4,2]);break;case"solid":case"double":t.setLineDash([]);break}var ae=h;v&&(ae={x:0,y:0});var W=s.getNodeShape(e),re=L;P==="inside"&&(re=0),P==="outside"&&(re*=2);var pe=(o+re+(B+U))/o,ye=(l+re+(B+U))/l,he=o*pe,Ee=l*ye,le=s.nodeShapes[W].points,de;if(v){var Fe=ee(he,Ee,W,le);de=Fe.path}if(W==="ellipse")s.drawEllipsePath(de||t,ae.x,ae.y,he,Ee);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(W)){var Me=0,lt=0,Ze=0;W==="round-diamond"?Me=(re+U+B)*1.4:W==="round-heptagon"?(Me=(re+U+B)*1.075,Ze=-(re/2+U+B)/35):W==="round-hexagon"?Me=(re+U+B)*1.12:W==="round-pentagon"?(Me=(re+U+B)*1.13,Ze=-(re/2+U+B)/15):W==="round-tag"?(Me=(re+U+B)*1.12,lt=(re/2+B+U)*.07):W==="round-triangle"&&(Me=(re+U+B)*(Math.PI/2),Ze=-(re+U/2+B)/Math.PI),Me!==0&&(pe=(o+Me)/o,he=o*pe,["round-hexagon","round-tag"].includes(W)||(ye=(l+Me)/l,Ee=l*ye)),z=z==="auto"?Yo(he,Ee):z;for(var Ue=he/2,ct=Ee/2,Qe=z+(re+B+U)/2,ft=new Array(le.length/2),xt=new Array(le.length/2),mt=0;mt<le.length/2;mt++)ft[mt]={x:ae.x+lt+Ue*le[mt*2],y:ae.y+Ze+ct*le[mt*2+1]};var vt,It,Vt,Tt,$e=ft.length;for(It=ft[$e-1],vt=0;vt<$e;vt++)Vt=ft[vt%$e],Tt=ft[(vt+1)%$e],xt[vt]=Pi(It,Vt,Tt,Qe),It=Vt,Vt=Tt;s.drawRoundPolygonPath(de||t,ae.x+lt,ae.y+Ze,o*pe,l*ye,le,xt)}else if(["roundrectangle","round-rectangle"].includes(W))z=z==="auto"?mr(he,Ee):z,s.drawRoundRectanglePath(de||t,ae.x,ae.y,he,Ee,z+(re+B+U)/2);else if(["cutrectangle","cut-rectangle"].includes(W))z=z==="auto"?Ti():z,s.drawCutRectanglePath(de||t,ae.x,ae.y,he,Ee,null,z+(re+B+U)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(W))z=z==="auto"?mr(he,Ee):z,s.drawBottomRoundRectanglePath(de||t,ae.x,ae.y,he,Ee,z+(re+B+U)/2);else if(W==="barrel")s.drawBarrelPath(de||t,ae.x,ae.y,he,Ee);else if(W.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(W)){var We=(re+B+U)/o;le=fn(hn(le,We)),s.drawPolygonPath(de||t,ae.x,ae.y,o,l,le)}else{var at=(re+B+U)/o;le=fn(hn(le,-at)),s.drawPolygonPath(de||t,ae.x,ae.y,o,l,le)}if(v?t.stroke(de):t.stroke(),Z==="double"){t.lineWidth=re/3;var Cr=t.globalCompositeOperation;t.globalCompositeOperation="destination-out",v?t.stroke(de):t.stroke(),t.globalCompositeOperation=Cr}t.setLineDash&&t.setLineDash([])}},xe=function(){n&&s.drawNodeOverlay(t,e,h,o,l)},we=function(){n&&s.drawNodeUnderlay(t,e,h,o,l)},De=function(){s.drawElementText(t,e,null,a)},j=e.pstyle("ghost").value==="yes";if(j){var N=e.pstyle("ghost-offset-x").pfValue,$=e.pstyle("ghost-offset-y").pfValue,Q=e.pstyle("ghost-opacity").value,X=Q*c;t.translate(N,$),J(),Ae(),_(Q*I),ie(),ue(X,!0),q(Q*G),ge(),ce(A!==0||L!==0),ue(X,!1),fe(X),t.translate(-N,-$)}v&&t.translate(-h.x,-h.y),we(),v&&t.translate(h.x,h.y),J(),Ae(),_(),ie(),ue(c,!0),q(),ge(),ce(A!==0||L!==0),ue(c,!1),fe(),v&&t.translate(-h.x,-h.y),De(),xe(),r&&t.translate(g.x1,g.y1)}};var Xu=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(r,a,n,i,s){var o=this;if(a.visible()){var l=a.pstyle("".concat(e,"-padding")).pfValue,u=a.pstyle("".concat(e,"-opacity")).value,f=a.pstyle("".concat(e,"-color")).value,h=a.pstyle("".concat(e,"-shape")).value,c=a.pstyle("".concat(e,"-corner-radius")).value;if(u>0){if(n=n||a.position(),i==null||s==null){var v=a.padding();i=a.width()+2*v,s=a.height()+2*v}o.colorFillStyle(r,f[0],f[1],f[2],u),o.nodeShapes[h].draw(r,n.x,n.y,i+l*2,s+l*2,c),r.fill()}}}};Zr.drawNodeOverlay=Xu("overlay");Zr.drawNodeUnderlay=Xu("underlay");Zr.hasPie=function(t){return t=t[0],t._private.hasPie};Zr.drawPie=function(t,e,r,a){e=e[0],a=a||e.position();var n=e.cy().style(),i=e.pstyle("pie-size"),s=a.x,o=a.y,l=e.width(),u=e.height(),f=Math.min(l,u)/2,h=0,c=this.usePaths();c&&(s=0,o=0),i.units==="%"?f=f*i.pfValue:i.pfValue!==void 0&&(f=i.pfValue/2);for(var v=1;v<=n.pieBackgroundN;v++){var d=e.pstyle("pie-"+v+"-background-size").value,y=e.pstyle("pie-"+v+"-background-color").value,p=e.pstyle("pie-"+v+"-background-opacity").value*r,g=d/100;g+h>1&&(g=1-h);var m=1.5*Math.PI+2*Math.PI*h,E=2*Math.PI*g,D=m+E;d===0||h>=1||h+g>1||(t.beginPath(),t.moveTo(s,o),t.arc(s,o,f,m,D),t.closePath(),this.colorFillStyle(t,y[0],y[1],y[2],p),t.fill(),h+=g)}};var yt={},_p=100;yt.getPixelRatio=function(){var t=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var e=t.backingStorePixelRatio||t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/e};yt.paintCache=function(t){for(var e=this.paintCaches=this.paintCaches||[],r=!0,a,n=0;n<e.length;n++)if(a=e[n],a.context===t){r=!1;break}return r&&(a={context:t},e.push(a)),a};yt.createGradientStyleFor=function(t,e,r,a,n){var i,s=this.usePaths(),o=r.pstyle(e+"-gradient-stop-colors").value,l=r.pstyle(e+"-gradient-stop-positions").pfValue;if(a==="radial-gradient")if(r.isEdge()){var u=r.sourceEndpoint(),f=r.targetEndpoint(),h=r.midpoint(),c=yr(u,h),v=yr(f,h);i=t.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(c,v))}else{var d=s?{x:0,y:0}:r.position(),y=r.paddedWidth(),p=r.paddedHeight();i=t.createRadialGradient(d.x,d.y,0,d.x,d.y,Math.max(y,p))}else if(r.isEdge()){var g=r.sourceEndpoint(),m=r.targetEndpoint();i=t.createLinearGradient(g.x,g.y,m.x,m.y)}else{var E=s?{x:0,y:0}:r.position(),D=r.paddedWidth(),b=r.paddedHeight(),x=D/2,w=b/2,T=r.pstyle("background-gradient-direction").value;switch(T){case"to-bottom":i=t.createLinearGradient(E.x,E.y-w,E.x,E.y+w);break;case"to-top":i=t.createLinearGradient(E.x,E.y+w,E.x,E.y-w);break;case"to-left":i=t.createLinearGradient(E.x+x,E.y,E.x-x,E.y);break;case"to-right":i=t.createLinearGradient(E.x-x,E.y,E.x+x,E.y);break;case"to-bottom-right":case"to-right-bottom":i=t.createLinearGradient(E.x-x,E.y-w,E.x+x,E.y+w);break;case"to-top-right":case"to-right-top":i=t.createLinearGradient(E.x-x,E.y+w,E.x+x,E.y-w);break;case"to-bottom-left":case"to-left-bottom":i=t.createLinearGradient(E.x+x,E.y-w,E.x-x,E.y+w);break;case"to-top-left":case"to-left-top":i=t.createLinearGradient(E.x+x,E.y+w,E.x-x,E.y-w);break}}if(!i)return null;for(var C=l.length===o.length,S=o.length,A=0;A<S;A++)i.addColorStop(C?l[A]:A/(S-1),"rgba("+o[A][0]+","+o[A][1]+","+o[A][2]+","+n+")");return i};yt.gradientFillStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"background",e,r,a);if(!n)return null;t.fillStyle=n};yt.colorFillStyle=function(t,e,r,a,n){t.fillStyle="rgba("+e+","+r+","+a+","+n+")"};yt.eleFillStyle=function(t,e,r){var a=e.pstyle("background-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientFillStyle(t,e,a,r);else{var n=e.pstyle("background-color").value;this.colorFillStyle(t,n[0],n[1],n[2],r)}};yt.gradientStrokeStyle=function(t,e,r,a){var n=this.createGradientStyleFor(t,"line",e,r,a);if(!n)return null;t.strokeStyle=n};yt.colorStrokeStyle=function(t,e,r,a,n){t.strokeStyle="rgba("+e+","+r+","+a+","+n+")"};yt.eleStrokeStyle=function(t,e,r){var a=e.pstyle("line-fill").value;if(a==="linear-gradient"||a==="radial-gradient")this.gradientStrokeStyle(t,e,a,r);else{var n=e.pstyle("line-color").value;this.colorStrokeStyle(t,n[0],n[1],n[2],r)}};yt.matchCanvasSize=function(t){var e=this,r=e.data,a=e.findContainerClientCoords(),n=a[2],i=a[3],s=e.getPixelRatio(),o=e.motionBlurPxRatio;(t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE]||t===e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var l=n*s,u=i*s,f;if(!(l===e.canvasWidth&&u===e.canvasHeight)){e.fontCaches=null;var h=r.canvasContainer;h.style.width=n+"px",h.style.height=i+"px";for(var c=0;c<e.CANVAS_LAYERS;c++)f=r.canvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";for(var c=0;c<e.BUFFER_COUNT;c++)f=r.bufferCanvases[c],f.width=l,f.height=u,f.style.width=n+"px",f.style.height=i+"px";e.textureMult=1,s<=1&&(f=r.bufferCanvases[e.TEXTURE_BUFFER],e.textureMult=2,f.width=l*e.textureMult,f.height=u*e.textureMult),e.canvasWidth=l,e.canvasHeight=u}};yt.renderTo=function(t,e,r,a){this.render({forcedContext:t,forcedZoom:e,forcedPan:r,drawAllLayers:!0,forcedPxRatio:a})};yt.render=function(t){t=t||Bo();var e=t.forcedContext,r=t.drawAllLayers,a=t.drawOnlyNodeLayer,n=t.forcedZoom,i=t.forcedPan,s=this,o=t.forcedPxRatio===void 0?this.getPixelRatio():t.forcedPxRatio,l=s.cy,u=s.data,f=u.canvasNeedsRedraw,h=s.textureOnViewport&&!e&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),c=t.motionBlur!==void 0?t.motionBlur:s.motionBlur,v=s.motionBlurPxRatio,d=l.hasCompoundNodes(),y=s.hoverData.draggingEles,p=!!(s.hoverData.selecting||s.touchData.selecting);c=c&&!e&&s.motionBlurEnabled&&!p;var g=c;e||(s.prevPxRatio!==o&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=o),!e&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),c&&(s.mbFrames==null&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(g=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(f[s.NODE]=!0,f[s.SELECT_BOX]=!0);var m=l.style(),E=l.zoom(),D=n!==void 0?n:E,b=l.pan(),x={x:b.x,y:b.y},w={zoom:E,pan:{x:b.x,y:b.y}},T=s.prevViewport,C=T===void 0||w.zoom!==T.zoom||w.pan.x!==T.pan.x||w.pan.y!==T.pan.y;!C&&!(y&&!d)&&(s.motionBlurPxRatio=1),i&&(x=i),D*=o,x.x*=o,x.y*=o;var S=s.getCachedZSortedEles();function A(te,ie,ue,ce,fe){var ge=te.globalCompositeOperation;te.globalCompositeOperation="destination-out",s.colorFillStyle(te,255,255,255,s.motionBlurTransparency),te.fillRect(ie,ue,ce,fe),te.globalCompositeOperation=ge}function L(te,ie){var ue,ce,fe,ge;!s.clearingMotionBlur&&(te===u.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]||te===u.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG])?(ue={x:b.x*v,y:b.y*v},ce=E*v,fe=s.canvasWidth*v,ge=s.canvasHeight*v):(ue=x,ce=D,fe=s.canvasWidth,ge=s.canvasHeight),te.setTransform(1,0,0,1,0,0),ie==="motionBlur"?A(te,0,0,fe,ge):!e&&(ie===void 0||ie)&&te.clearRect(0,0,fe,ge),r||(te.translate(ue.x,ue.y),te.scale(ce,ce)),i&&te.translate(i.x,i.y),n&&te.scale(n,n)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=l.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var I=s.data.bufferContexts[s.TEXTURE_BUFFER];I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:I,drawOnlyNodeLayer:!0,forcedPxRatio:o*s.textureMult});var w=s.textureCache.viewport={zoom:l.zoom(),pan:l.pan(),width:s.canvasWidth,height:s.canvasHeight};w.mpan={x:(0-w.pan.x)/w.zoom,y:(0-w.pan.y)/w.zoom}}f[s.DRAG]=!1,f[s.NODE]=!1;var O=u.contexts[s.NODE],k=s.textureCache.texture,w=s.textureCache.viewport;O.setTransform(1,0,0,1,0,0),c?A(O,0,0,w.width,w.height):O.clearRect(0,0,w.width,w.height);var R=m.core("outside-texture-bg-color").value,M=m.core("outside-texture-bg-opacity").value;s.colorFillStyle(O,R[0],R[1],R[2],M),O.fillRect(0,0,w.width,w.height);var E=l.zoom();L(O,!1),O.clearRect(w.mpan.x,w.mpan.y,w.width/w.zoom/o,w.height/w.zoom/o),O.drawImage(k,w.mpan.x,w.mpan.y,w.width/w.zoom/o,w.height/w.zoom/o)}else s.textureOnViewport&&!e&&(s.textureCache=null);var P=l.extent(),F=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),V=s.hideEdgesOnViewport&&F,G=[];if(G[s.NODE]=!f[s.NODE]&&c&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,G[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),G[s.DRAG]=!f[s.DRAG]&&c&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,G[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),f[s.NODE]||r||a||G[s.NODE]){var B=c&&!G[s.NODE]&&v!==1,O=e||(B?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:u.contexts[s.NODE]),Y=c&&!B?"motionBlur":void 0;L(O,Y),V?s.drawCachedNodes(O,S.nondrag,o,P):s.drawLayeredElements(O,S.nondrag,o,P),s.debug&&s.drawDebugPoints(O,S.nondrag),!r&&!c&&(f[s.NODE]=!1)}if(!a&&(f[s.DRAG]||r||G[s.DRAG])){var B=c&&!G[s.DRAG]&&v!==1,O=e||(B?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:u.contexts[s.DRAG]);L(O,c&&!B?"motionBlur":void 0),V?s.drawCachedNodes(O,S.drag,o,P):s.drawCachedElements(O,S.drag,o,P),s.debug&&s.drawDebugPoints(O,S.drag),!r&&!c&&(f[s.DRAG]=!1)}if(s.showFps||!a&&f[s.SELECT_BOX]&&!r){var O=e||u.contexts[s.SELECT_BOX];if(L(O),s.selection[4]==1&&(s.hoverData.selecting||s.touchData.selecting)){var E=s.cy.zoom(),Z=m.core("selection-box-border-width").value/E;O.lineWidth=Z,O.fillStyle="rgba("+m.core("selection-box-color").value[0]+","+m.core("selection-box-color").value[1]+","+m.core("selection-box-color").value[2]+","+m.core("selection-box-opacity").value+")",O.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),Z>0&&(O.strokeStyle="rgba("+m.core("selection-box-border-color").value[0]+","+m.core("selection-box-border-color").value[1]+","+m.core("selection-box-border-color").value[2]+","+m.core("selection-box-opacity").value+")",O.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(u.bgActivePosistion&&!s.hoverData.selecting){var E=s.cy.zoom(),K=u.bgActivePosistion;O.fillStyle="rgba("+m.core("active-bg-color").value[0]+","+m.core("active-bg-color").value[1]+","+m.core("active-bg-color").value[2]+","+m.core("active-bg-opacity").value+")",O.beginPath(),O.arc(K.x,K.y,m.core("active-bg-size").pfValue/E,0,2*Math.PI),O.fill()}var U=s.lastRedrawTime;if(s.showFps&&U){U=Math.round(U);var z=Math.round(1e3/U);O.setTransform(1,0,0,1,0,0),O.fillStyle="rgba(255, 0, 0, 0.75)",O.strokeStyle="rgba(255, 0, 0, 0.75)",O.lineWidth=1,O.fillText("1 frame = "+U+" ms = "+z+" fps",0,20);var _=60;O.strokeRect(0,30,250,20),O.fillRect(0,30,250*Math.min(z/_,1),20)}r||(f[s.SELECT_BOX]=!1)}if(c&&v!==1){var q=u.contexts[s.NODE],J=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],ee=u.contexts[s.DRAG],oe=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],me=function(ie,ue,ce){ie.setTransform(1,0,0,1,0,0),ce||!g?ie.clearRect(0,0,s.canvasWidth,s.canvasHeight):A(ie,0,0,s.canvasWidth,s.canvasHeight);var fe=v;ie.drawImage(ue,0,0,s.canvasWidth*fe,s.canvasHeight*fe,0,0,s.canvasWidth,s.canvasHeight)};(f[s.NODE]||G[s.NODE])&&(me(q,J,G[s.NODE]),f[s.NODE]=!1),(f[s.DRAG]||G[s.DRAG])&&(me(ee,oe,G[s.DRAG]),f[s.DRAG]=!1)}s.prevViewport=w,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),c&&(s.motionBlurTimeout=setTimeout(function(){s.motionBlurTimeout=null,s.clearedForMotionBlur[s.NODE]=!1,s.clearedForMotionBlur[s.DRAG]=!1,s.motionBlur=!1,s.clearingMotionBlur=!h,s.mbFrames=0,f[s.NODE]=!0,f[s.DRAG]=!0,s.redraw()},_p)),e||l.emit("render")};var or={};or.drawPolygonPath=function(t,e,r,a,n,i){var s=a/2,o=n/2;t.beginPath&&t.beginPath(),t.moveTo(e+s*i[0],r+o*i[1]);for(var l=1;l<i.length/2;l++)t.lineTo(e+s*i[l*2],r+o*i[l*2+1]);t.closePath()};or.drawRoundPolygonPath=function(t,e,r,a,n,i,s){s.forEach(function(o){return ku(t,o)}),t.closePath()};or.drawRoundRectanglePath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=i==="auto"?mr(a,n):Math.min(i,o,s);t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.arcTo(e+s,r-o,e+s,r,l),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.arcTo(e-s,r-o,e,r-o,l),t.lineTo(e,r-o),t.closePath()};or.drawBottomRoundRectanglePath=function(t,e,r,a,n,i){var s=a/2,o=n/2,l=i==="auto"?mr(a,n):i;t.beginPath&&t.beginPath(),t.moveTo(e,r-o),t.lineTo(e+s,r-o),t.lineTo(e+s,r),t.arcTo(e+s,r+o,e,r+o,l),t.arcTo(e-s,r+o,e-s,r,l),t.lineTo(e-s,r-o),t.lineTo(e,r-o),t.closePath()};or.drawCutRectanglePath=function(t,e,r,a,n,i,s){var o=a/2,l=n/2,u=s==="auto"?Ti():s;t.beginPath&&t.beginPath(),t.moveTo(e-o+u,r-l),t.lineTo(e+o-u,r-l),t.lineTo(e+o,r-l+u),t.lineTo(e+o,r+l-u),t.lineTo(e+o-u,r+l),t.lineTo(e-o+u,r+l),t.lineTo(e-o,r+l-u),t.lineTo(e-o,r-l+u),t.closePath()};or.drawBarrelPath=function(t,e,r,a,n){var i=a/2,s=n/2,o=e-i,l=e+i,u=r-s,f=r+s,h=jn(a,n),c=h.widthOffset,v=h.heightOffset,d=h.ctrlPtOffsetPct*c;t.beginPath&&t.beginPath(),t.moveTo(o,u+v),t.lineTo(o,f-v),t.quadraticCurveTo(o+d,f,o+c,f),t.lineTo(l-c,f),t.quadraticCurveTo(l-d,f,l,f-v),t.lineTo(l,u+v),t.quadraticCurveTo(l-d,u,l-c,u),t.lineTo(o+c,u),t.quadraticCurveTo(o+d,u,o,u+v),t.closePath()};var go=Math.sin(0),po=Math.cos(0),hi={},ci={},qu=Math.PI/40;for(lr=0*Math.PI;lr<2*Math.PI;lr+=qu)hi[lr]=Math.sin(lr),ci[lr]=Math.cos(lr);var lr;or.drawEllipsePath=function(t,e,r,a,n){if(t.beginPath&&t.beginPath(),t.ellipse)t.ellipse(e,r,a/2,n/2,0,0,2*Math.PI);else for(var i,s,o=a/2,l=n/2,u=0*Math.PI;u<2*Math.PI;u+=qu)i=e-o*hi[u]*go+o*ci[u]*po,s=r+l*ci[u]*go+l*hi[u]*po,u===0?t.moveTo(i,s):t.lineTo(i,s);t.closePath()};var Ma={};Ma.createBuffer=function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,[r,r.getContext("2d")]};Ma.bufferCanvasImage=function(t){var e=this.cy,r=e.mutableElements(),a=r.boundingBox(),n=this.findContainerClientCoords(),i=t.full?Math.ceil(a.w):n[2],s=t.full?Math.ceil(a.h):n[3],o=ne(t.maxWidth)||ne(t.maxHeight),l=this.getPixelRatio(),u=1;if(t.scale!==void 0)i*=t.scale,s*=t.scale,u=t.scale;else if(o){var f=1/0,h=1/0;ne(t.maxWidth)&&(f=u*t.maxWidth/i),ne(t.maxHeight)&&(h=u*t.maxHeight/s),u=Math.min(f,h),i*=u,s*=u}o||(i*=l,s*=l,u*=l);var c=document.createElement("canvas");c.width=i,c.height=s,c.style.width=i+"px",c.style.height=s+"px";var v=c.getContext("2d");if(i>0&&s>0){v.clearRect(0,0,i,s),v.globalCompositeOperation="source-over";var d=this.getCachedZSortedEles();if(t.full)v.translate(-a.x1*u,-a.y1*u),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(a.x1*u,a.y1*u);else{var y=e.pan(),p={x:y.x*u,y:y.y*u};u*=e.zoom(),v.translate(p.x,p.y),v.scale(u,u),this.drawElements(v,d),v.scale(1/u,1/u),v.translate(-p.x,-p.y)}t.bg&&(v.globalCompositeOperation="destination-over",v.fillStyle=t.bg,v.rect(0,0,i,s),v.fill())}return c};function Hp(t,e){for(var r=atob(t),a=new ArrayBuffer(r.length),n=new Uint8Array(a),i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new Blob([a],{type:e})}function yo(t){var e=t.indexOf(",");return t.substr(e+1)}function Wu(t,e,r){var a=function(){return e.toDataURL(r,t.quality)};switch(t.output){case"blob-promise":return new $r(function(n,i){try{e.toBlob(function(s){s!=null?n(s):i(new Error("`canvas.toBlob()` sent a null value in its callback"))},r,t.quality)}catch(s){i(s)}});case"blob":return Hp(yo(a()),r);case"base64":return yo(a());case"base64uri":default:return a()}}Ma.png=function(t){return Wu(t,this.bufferCanvasImage(t),"image/png")};Ma.jpg=function(t){return Wu(t,this.bufferCanvasImage(t),"image/jpeg")};var Ku={};Ku.nodeShapeImpl=function(t,e,r,a,n,i,s,o){switch(t){case"ellipse":return this.drawEllipsePath(e,r,a,n,i);case"polygon":return this.drawPolygonPath(e,r,a,n,i,s);case"round-polygon":return this.drawRoundPolygonPath(e,r,a,n,i,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(e,r,a,n,i,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(e,r,a,n,i,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(e,r,a,n,i,o);case"barrel":return this.drawBarrelPath(e,r,a,n,i)}};var Xp=Zu,Se=Zu.prototype;Se.CANVAS_LAYERS=3;Se.SELECT_BOX=0;Se.DRAG=1;Se.NODE=2;Se.BUFFER_COUNT=3;Se.TEXTURE_BUFFER=0;Se.MOTIONBLUR_BUFFER_NODE=1;Se.MOTIONBLUR_BUFFER_DRAG=2;function Zu(t){var e=this;e.data={canvases:new Array(Se.CANVAS_LAYERS),contexts:new Array(Se.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Se.CANVAS_LAYERS),bufferCanvases:new Array(Se.BUFFER_COUNT),bufferContexts:new Array(Se.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";e.data.canvasContainer=document.createElement("div");var n=e.data.canvasContainer.style;e.data.canvasContainer.style[r]=a,n.position="relative",n.zIndex="0",n.overflow="hidden";var i=t.cy.container();i.appendChild(e.data.canvasContainer),i.style[r]=a;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};Ml()&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var o=0;o<Se.CANVAS_LAYERS;o++){var l=e.data.canvases[o]=document.createElement("canvas");e.data.contexts[o]=l.getContext("2d"),Object.keys(s).forEach(function(U){l.style[U]=s[U]}),l.style.position="absolute",l.setAttribute("data-id","layer"+o),l.style.zIndex=String(Se.CANVAS_LAYERS-o),e.data.canvasContainer.appendChild(l),e.data.canvasNeedsRedraw[o]=!1}e.data.topCanvas=e.data.canvases[0],e.data.canvases[Se.NODE].setAttribute("data-id","layer"+Se.NODE+"-node"),e.data.canvases[Se.SELECT_BOX].setAttribute("data-id","layer"+Se.SELECT_BOX+"-selectbox"),e.data.canvases[Se.DRAG].setAttribute("data-id","layer"+Se.DRAG+"-drag");for(var o=0;o<Se.BUFFER_COUNT;o++)e.data.bufferCanvases[o]=document.createElement("canvas"),e.data.bufferContexts[o]=e.data.bufferCanvases[o].getContext("2d"),e.data.bufferCanvases[o].style.position="absolute",e.data.bufferCanvases[o].setAttribute("data-id","buffer"+o),e.data.bufferCanvases[o].style.zIndex=String(-o-1),e.data.bufferCanvases[o].style.visibility="hidden";e.pathsEnabled=!0;var u=gt(),f=function(z){return{x:(z.x1+z.x2)/2,y:(z.y1+z.y2)/2}},h=function(z){return{x:-z.w/2,y:-z.h/2}},c=function(z){var _=z[0]._private,q=_.oldBackgroundTimestamp===_.backgroundTimestamp;return!q},v=function(z){return z[0]._private.nodeKey},d=function(z){return z[0]._private.labelStyleKey},y=function(z){return z[0]._private.sourceLabelStyleKey},p=function(z){return z[0]._private.targetLabelStyleKey},g=function(z,_,q,J,ee){return e.drawElement(z,_,q,!1,!1,ee)},m=function(z,_,q,J,ee){return e.drawElementText(z,_,q,J,"main",ee)},E=function(z,_,q,J,ee){return e.drawElementText(z,_,q,J,"source",ee)},D=function(z,_,q,J,ee){return e.drawElementText(z,_,q,J,"target",ee)},b=function(z){return z.boundingBox(),z[0]._private.bodyBounds},x=function(z){return z.boundingBox(),z[0]._private.labelBounds.main||u},w=function(z){return z.boundingBox(),z[0]._private.labelBounds.source||u},T=function(z){return z.boundingBox(),z[0]._private.labelBounds.target||u},C=function(z,_){return _},S=function(z){return f(b(z))},A=function(z,_,q){var J=z?z+"-":"";return{x:_.x+q.pstyle(J+"text-margin-x").pfValue,y:_.y+q.pstyle(J+"text-margin-y").pfValue}},L=function(z,_,q){var J=z[0]._private.rscratch;return{x:J[_],y:J[q]}},I=function(z){return A("",L(z,"labelX","labelY"),z)},O=function(z){return A("source",L(z,"sourceLabelX","sourceLabelY"),z)},k=function(z){return A("target",L(z,"targetLabelX","targetLabelY"),z)},R=function(z){return h(b(z))},M=function(z){return h(w(z))},P=function(z){return h(T(z))},F=function(z){var _=x(z),q=h(x(z));if(z.isNode()){switch(z.pstyle("text-halign").value){case"left":q.x=-_.w;break;case"right":q.x=0;break}switch(z.pstyle("text-valign").value){case"top":q.y=-_.h;break;case"bottom":q.y=0;break}}return q},V=e.data.eleTxrCache=new fa(e,{getKey:v,doesEleInvalidateKey:c,drawElement:g,getBoundingBox:b,getRotationPoint:S,getRotationOffset:R,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),G=e.data.lblTxrCache=new fa(e,{getKey:d,drawElement:m,getBoundingBox:x,getRotationPoint:I,getRotationOffset:F,isVisible:C}),B=e.data.slbTxrCache=new fa(e,{getKey:y,drawElement:E,getBoundingBox:w,getRotationPoint:O,getRotationOffset:M,isVisible:C}),Y=e.data.tlbTxrCache=new fa(e,{getKey:p,drawElement:D,getBoundingBox:T,getRotationPoint:k,getRotationOffset:P,isVisible:C}),Z=e.data.lyrTxrCache=new Yu(e);e.onUpdateEleCalcs(function(z,_){V.invalidateElements(_),G.invalidateElements(_),B.invalidateElements(_),Y.invalidateElements(_),Z.invalidateElements(_);for(var q=0;q<_.length;q++){var J=_[q]._private;J.oldBackgroundTimestamp=J.backgroundTimestamp}});var K=function(z){for(var _=0;_<z.length;_++)Z.enqueueElementRefinement(z[_].ele)};V.onDequeue(K),G.onDequeue(K),B.onDequeue(K),Y.onDequeue(K)}Se.redrawHint=function(t,e){var r=this;switch(t){case"eles":r.data.canvasNeedsRedraw[Se.NODE]=e;break;case"drag":r.data.canvasNeedsRedraw[Se.DRAG]=e;break;case"select":r.data.canvasNeedsRedraw[Se.SELECT_BOX]=e;break}};var qp=typeof Path2D!="undefined";Se.path2dEnabled=function(t){if(t===void 0)return this.pathsEnabled;this.pathsEnabled=!!t};Se.usePaths=function(){return qp&&this.pathsEnabled};Se.setImgSmoothing=function(t,e){t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled=e:(t.webkitImageSmoothingEnabled=e,t.mozImageSmoothingEnabled=e,t.msImageSmoothingEnabled=e)};Se.getImgSmoothing=function(t){return t.imageSmoothingEnabled!=null?t.imageSmoothingEnabled:t.webkitImageSmoothingEnabled||t.mozImageSmoothingEnabled||t.msImageSmoothingEnabled};Se.makeOffscreenCanvas=function(t,e){var r;return(typeof OffscreenCanvas=="undefined"?"undefined":He(OffscreenCanvas))!=="undefined"?r=new OffscreenCanvas(t,e):(r=document.createElement("canvas"),r.width=t,r.height=e),r};[_u,zt,qt,Fi,Tr,Zr,yt,or,Ma,Ku].forEach(function(t){be(Se,t)});var Wp=[{name:"null",impl:Iu},{name:"base",impl:Uu},{name:"canvas",impl:Xp}],Kp=[{type:"layout",extensions:tp},{type:"renderer",extensions:Wp}],Qu={},Ju={};function ju(t,e,r){var a=r,n=function(T){Ne("Can not register `"+e+"` for `"+t+"` since `"+T+"` already exists in the prototype and can not be overridden")};if(t==="core"){if(Ta.prototype[e])return n(e);Ta.prototype[e]=r}else if(t==="collection"){if(et.prototype[e])return n(e);et.prototype[e]=r}else if(t==="layout"){for(var i=function(T){this.options=T,r.call(this,T),Ce(this._private)||(this._private={}),this._private.cy=T.cy,this._private.listeners=[],this.createEmitter()},s=i.prototype=Object.create(r.prototype),o=[],l=0;l<o.length;l++){var u=o[l];s[u]=s[u]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var f=r.prototype.stop;s.stop=function(){var w=this.options;if(w&&w.animate){var T=this.animations;if(T)for(var C=0;C<T.length;C++)T[C].stop()}return f?f.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var h=function(T){return T._private.cy},c={addEventFields:function(T,C){C.layout=T,C.cy=h(T),C.target=T},bubble:function(){return!0},parent:function(T){return h(T)}};be(s,{createEmitter:function(){return this._private.emitter=new An(c,this),this},emitter:function(){return this._private.emitter},on:function(T,C){return this.emitter().on(T,C),this},one:function(T,C){return this.emitter().one(T,C),this},once:function(T,C){return this.emitter().one(T,C),this},removeListener:function(T,C){return this.emitter().removeListener(T,C),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(T,C){return this.emitter().emit(T,C),this}}),Oe.eventAliasesOn(s),a=i}else if(t==="renderer"&&e!=="null"&&e!=="base"){var v=el("renderer","base"),d=v.prototype,y=r,p=r.prototype,g=function(){v.apply(this,arguments),y.apply(this,arguments)},m=g.prototype;for(var E in d){var D=d[E],b=p[E]!=null;if(b)return n(E);m[E]=D}for(var x in p)m[x]=p[x];d.clientFunctions.forEach(function(w){m[w]=m[w]||function(){ze("Renderer does not implement `renderer."+w+"()` on its prototype")}}),a=g}else if(t==="__proto__"||t==="constructor"||t==="prototype")return ze(t+" is an illegal type to be registered, possibly lead to prototype pollutions");return Do({map:Qu,keys:[t,e],value:a})}function el(t,e){return So({map:Qu,keys:[t,e]})}function Zp(t,e,r,a,n){return Do({map:Ju,keys:[t,e,r,a],value:n})}function Qp(t,e,r,a){return So({map:Ju,keys:[t,e,r,a]})}var vi=function(){if(arguments.length===2)return el.apply(null,arguments);if(arguments.length===3)return ju.apply(null,arguments);if(arguments.length===4)return Qp.apply(null,arguments);if(arguments.length===5)return Zp.apply(null,arguments);ze("Invalid extension access syntax")};Ta.prototype.extension=vi;Kp.forEach(function(t){t.extensions.forEach(function(e){ju(t.type,e.name,e.impl)})});var tl=function t(){if(!(this instanceof t))return new t;this.length=0},wr=tl.prototype;wr.instanceString=function(){return"stylesheet"};wr.selector=function(t){var e=this.length++;return this[e]={selector:t,properties:[]},this};wr.css=function(t,e){var r=this.length-1;if(ve(t))this[r].properties.push({name:t,value:e});else if(Ce(t))for(var a=t,n=Object.keys(a),i=0;i<n.length;i++){var s=n[i],o=a[s];if(o!=null){var l=nt.properties[s]||nt.properties[mn(s)];if(l!=null){var u=l.name,f=o;this[r].properties.push({name:u,value:f})}}}return this};wr.style=wr.css;wr.generateStyle=function(t){var e=new nt(t);return this.appendToStyle(e)};wr.appendToStyle=function(t){for(var e=0;e<this.length;e++){var r=this[e],a=r.selector,n=r.properties;t.selector(a);for(var i=0;i<n.length;i++){var s=n[i];t.css(s.name,s.value)}}return t};var Jp="3.29.2",Ht=function(e){if(e===void 0&&(e={}),Ce(e))return new Ta(e);if(ve(e))return vi.apply(vi,arguments)};Ht.use=function(t){var e=Array.prototype.slice.call(arguments,1);return e.unshift(Ht),t.apply(null,e),this};Ht.warnings=function(t){return ko(t)};Ht.version=Jp;Ht.stylesheet=Ht.Stylesheet=tl;var al=Fa(rl(),1);var Gy=Fa(pl(),1),zy=Fa(yl(),1),Vy=Fa(ml(),1);var Yi=function(){var t=function(D,b,x,w){for(x=x||{},w=D.length;w--;x[D[w]]=b);return x},e=[1,4],r=[1,13],a=[1,12],n=[1,15],i=[1,16],s=[1,20],o=[1,19],l=[6,7,8],u=[1,26],f=[1,24],h=[1,25],c=[6,7,11],v=[1,6,13,15,16,19,22],d=[1,33],y=[1,34],p=[1,6,7,11,13,15,16,19,22],g={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(b,x,w,T,C,S,A){var L=S.length-1;switch(C){case 6:case 7:return T;case 8:T.getLogger().trace("Stop NL ");break;case 9:T.getLogger().trace("Stop EOF ");break;case 11:T.getLogger().trace("Stop NL2 ");break;case 12:T.getLogger().trace("Stop EOF2 ");break;case 15:T.getLogger().info("Node: ",S[L].id),T.addNode(S[L-1].length,S[L].id,S[L].descr,S[L].type);break;case 16:T.getLogger().trace("Icon: ",S[L]),T.decorateNode({icon:S[L]});break;case 17:case 21:T.decorateNode({class:S[L]});break;case 18:T.getLogger().trace("SPACELIST");break;case 19:T.getLogger().trace("Node: ",S[L].id),T.addNode(0,S[L].id,S[L].descr,S[L].type);break;case 20:T.decorateNode({icon:S[L]});break;case 25:T.getLogger().trace("node found ..",S[L-2]),this.$={id:S[L-1],descr:S[L-1],type:T.getType(S[L-2],S[L])};break;case 26:this.$={id:S[L],descr:S[L],type:T.nodeType.DEFAULT};break;case 27:T.getLogger().trace("node found ..",S[L-3]),this.$={id:S[L-3],descr:S[L-1],type:T.getType(S[L-2],S[L])};break}},table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:r,7:[1,10],9:9,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(l,[2,3]),{1:[2,2]},t(l,[2,4]),t(l,[2,5]),{1:[2,6],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:r,9:22,12:11,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},{6:u,7:f,10:23,11:h},t(c,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:s,22:o}),t(c,[2,18]),t(c,[2,19]),t(c,[2,20]),t(c,[2,21]),t(c,[2,23]),t(c,[2,24]),t(c,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:f,10:32,11:h},{1:[2,7],6:r,12:21,13:a,14:14,15:n,16:i,17:17,18:18,19:s,22:o},t(v,[2,14],{7:d,11:y}),t(p,[2,8]),t(p,[2,9]),t(p,[2,10]),t(c,[2,15]),t(c,[2,16]),t(c,[2,17]),{20:[1,35]},{21:[1,36]},t(v,[2,13],{7:d,11:y}),t(p,[2,11]),t(p,[2,12]),{21:[1,37]},t(c,[2,25]),t(c,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(b,x){if(x.recoverable)this.trace(b);else{var w=new Error(b);throw w.hash=x,w}},parse:function(b){var x=this,w=[0],T=[],C=[null],S=[],A=this.table,L="",I=0,O=0,k=2,R=1,M=S.slice.call(arguments,1),P=Object.create(this.lexer),F={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(F.yy[V]=this.yy[V]);P.setInput(b,F.yy),F.yy.lexer=P,F.yy.parser=this,typeof P.yylloc=="undefined"&&(P.yylloc={});var G=P.yylloc;S.push(G);var B=P.options&&P.options.ranges;typeof F.yy.parseError=="function"?this.parseError=F.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Y(){var te;return te=T.pop()||P.lex()||R,typeof te!="number"&&(te instanceof Array&&(T=te,te=T.pop()),te=x.symbols_[te]||te),te}for(var Z,K,U,z,_={},q,J,ee,oe;;){if(K=w[w.length-1],this.defaultActions[K]?U=this.defaultActions[K]:((Z===null||typeof Z=="undefined")&&(Z=Y()),U=A[K]&&A[K][Z]),typeof U=="undefined"||!U.length||!U[0]){var me="";oe=[];for(q in A[K])this.terminals_[q]&&q>k&&oe.push("'"+this.terminals_[q]+"'");P.showPosition?me="Parse error on line "+(I+1)+`:
`+P.showPosition()+`
Expecting `+oe.join(", ")+", got '"+(this.terminals_[Z]||Z)+"'":me="Parse error on line "+(I+1)+": Unexpected "+(Z==R?"end of input":"'"+(this.terminals_[Z]||Z)+"'"),this.parseError(me,{text:P.match,token:this.terminals_[Z]||Z,line:P.yylineno,loc:G,expected:oe})}if(U[0]instanceof Array&&U.length>1)throw new Error("Parse Error: multiple actions possible at state: "+K+", token: "+Z);switch(U[0]){case 1:w.push(Z),C.push(P.yytext),S.push(P.yylloc),w.push(U[1]),Z=null,O=P.yyleng,L=P.yytext,I=P.yylineno,G=P.yylloc;break;case 2:if(J=this.productions_[U[1]][1],_.$=C[C.length-J],_._$={first_line:S[S.length-(J||1)].first_line,last_line:S[S.length-1].last_line,first_column:S[S.length-(J||1)].first_column,last_column:S[S.length-1].last_column},B&&(_._$.range=[S[S.length-(J||1)].range[0],S[S.length-1].range[1]]),z=this.performAction.apply(_,[L,O,I,F.yy,U[1],C,S].concat(M)),typeof z!="undefined")return z;J&&(w=w.slice(0,-1*J*2),C=C.slice(0,-1*J),S=S.slice(0,-1*J)),w.push(this.productions_[U[1]][0]),C.push(_.$),S.push(_._$),ee=A[w[w.length-2]][w[w.length-1]],w.push(ee);break;case 3:return!0}}return!0}},m=function(){var D={EOF:1,parseError:function(x,w){if(this.yy.parser)this.yy.parser.parseError(x,w);else throw new Error(x)},setInput:function(b,x){return this.yy=x||this.yy||{},this._input=b,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 b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var x=b.match(/(?:\r\n?|\n).*/g);return x?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),b},unput:function(b){var x=b.length,w=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-x),this.offset-=x;var T=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),w.length-1&&(this.yylineno-=w.length-1);var C=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:w?(w.length===T.length?this.yylloc.first_column:0)+T[T.length-w.length].length-w[0].length:this.yylloc.first_column-x},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-x]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(b){this.unput(this.match.slice(b))},pastInput:function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var b=this.match;return b.length<20&&(b+=this._input.substr(0,20-b.length)),(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var b=this.pastInput(),x=new Array(b.length+1).join("-");return b+this.upcomingInput()+`
`+x+"^"},test_match:function(b,x){var w,T,C;if(this.options.backtrack_lexer&&(C={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&&(C.yylloc.range=this.yylloc.range.slice(0))),T=b[0].match(/(?:\r\n?|\n).*/g),T&&(this.yylineno+=T.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:T?T[T.length-1].length-T[T.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,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(b[0].length),this.matched+=b[0],w=this.performAction.call(this,this.yy,this,x,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),w)return w;if(this._backtrack){for(var S in C)this[S]=C[S];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var b,x,w,T;this._more||(this.yytext="",this.match="");for(var C=this._currentRules(),S=0;S<C.length;S++)if(w=this._input.match(this.rules[C[S]]),w&&(!x||w[0].length>x[0].length)){if(x=w,T=S,this.options.backtrack_lexer){if(b=this.test_match(w,C[S]),b!==!1)return b;if(this._backtrack){x=!1;continue}else return!1}else if(!this.options.flex)break}return x?(b=this.test_match(x,C[T]),b!==!1?b:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var x=this.next();return x||this.lex()},begin:function(x){this.conditionStack.push(x)},popState:function(){var x=this.conditionStack.length-1;return x>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(x){return x=this.conditionStack.length-1-Math.abs(x||0),x>=0?this.conditionStack[x]:"INITIAL"},pushState:function(x){this.begin(x)},stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(x,w,T,C){switch(T){case 0:return x.getLogger().trace("Found comment",w.yytext),6;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:this.popState();break;case 5:x.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return x.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:x.getLogger().trace("end icon"),this.popState();break;case 10:return x.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return x.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return x.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return x.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:return this.begin("NODE"),19;case 15:return this.begin("NODE"),19;case 16:return this.begin("NODE"),19;case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:this.begin("NSTR2");break;case 22:return"NODE_DESCR";case 23:this.popState();break;case 24:x.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 25:return x.getLogger().trace("description:",w.yytext),"NODE_DESCR";case 26:this.popState();break;case 27:return this.popState(),x.getLogger().trace("node end ))"),"NODE_DEND";case 28:return this.popState(),x.getLogger().trace("node end )"),"NODE_DEND";case 29:return this.popState(),x.getLogger().trace("node end ...",w.yytext),"NODE_DEND";case 30:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 31:return this.popState(),x.getLogger().trace("node end (-"),"NODE_DEND";case 32:return this.popState(),x.getLogger().trace("node end (-"),"NODE_DEND";case 33:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 34:return this.popState(),x.getLogger().trace("node end (("),"NODE_DEND";case 35:return x.getLogger().trace("Long description:",w.yytext),20;case 36:return x.getLogger().trace("Long description:",w.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\)\{\}]+)/i,/^(?:$)/i,/^(?:["][`])/i,/^(?:[^`"]+)/i,/^(?:[`]["])/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR2:{rules:[22,23],inclusive:!1},NSTR:{rules:[25,26],inclusive:!1},NODE:{rules:[21,24,27,28,29,30,31,32,33,34,35,36],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}};return D}();g.lexer=m;function E(){this.yy={}}return E.prototype=g,g.Parser=E,new E}();Yi.parser=Yi;var jp=Yi,Nt=[],nl=0,_i={},ey=()=>{Nt=[],nl=0,_i={}},ty=function(t){for(let e=Nt.length-1;e>=0;e--)if(Nt[e].level<t)return Nt[e];return null},ry=()=>Nt.length>0?Nt[0]:null,ay=(t,e,r,a)=>{var f,h;var n,i;Wt.info("addNode",t,e,r,a);let s=Ga(),o=(f=(n=s.mindmap)==null?void 0:n.padding)!=null?f:ea.mindmap.padding;switch(a){case qe.ROUNDED_RECT:case qe.RECT:case qe.HEXAGON:o*=2}let l={id:nl++,nodeId:jr(e,s),level:t,descr:jr(r,s),type:a,children:[],width:(h=(i=s.mindmap)==null?void 0:i.maxNodeWidth)!=null?h:ea.mindmap.maxNodeWidth,padding:o},u=ty(t);if(u)u.children.push(l),Nt.push(l);else if(Nt.length===0)Nt.push(l);else throw new Error('There can be only one root. No parent could be found for ("'+l.descr+'")')},qe={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},ny=(t,e)=>{switch(Wt.debug("In get type",t,e),t){case"[":return qe.RECT;case"(":return e===")"?qe.ROUNDED_RECT:qe.CLOUD;case"((":return qe.CIRCLE;case")":return qe.CLOUD;case"))":return qe.BANG;case"{{":return qe.HEXAGON;default:return qe.DEFAULT}},iy=(t,e)=>{_i[t]=e},sy=t=>{if(!t)return;let e=Ga(),r=Nt[Nt.length-1];t.icon&&(r.icon=jr(t.icon,e)),t.class&&(r.class=jr(t.class,e))},oy=t=>{switch(t){case qe.DEFAULT:return"no-border";case qe.RECT:return"rect";case qe.ROUNDED_RECT:return"rounded-rect";case qe.CIRCLE:return"circle";case qe.CLOUD:return"cloud";case qe.BANG:return"bang";case qe.HEXAGON:return"hexgon";default:return"no-border"}},uy=()=>Wt,ly=t=>_i[t],fy={clear:ey,addNode:ay,getMindmap:ry,nodeType:qe,getType:ny,setElementForId:iy,decorateNode:sy,type2Str:oy,getLogger:uy,getElementById:ly},hy=fy,cy=12,vy=function(t,e,r,a){e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 ${r.height-5} v${-r.height+2*5} q0,-5 5,-5 h${r.width-2*5} q5,0 5,5 v${r.height-5} H0 Z`),e.append("line").attr("class","node-line-"+a).attr("x1",0).attr("y1",r.height).attr("x2",r.width).attr("y2",r.height)},dy=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("width",r.width)},gy=function(t,e,r){let a=r.width,n=r.height,i=.15*a,s=.25*a,o=.35*a,l=.2*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${a*.25},${-1*a*.1}
a${o},${o} 1 0,1 ${a*.4},${-1*a*.1}
a${s},${s} 1 0,1 ${a*.35},${1*a*.2}
a${i},${i} 1 0,1 ${a*.15},${1*n*.35}
a${l},${l} 1 0,1 ${-1*a*.15},${1*n*.65}
a${s},${i} 1 0,1 ${-1*a*.25},${a*.15}
a${o},${o} 1 0,1 ${-1*a*.5},0
a${i},${i} 1 0,1 ${-1*a*.25},${-1*a*.15}
a${i},${i} 1 0,1 ${-1*a*.1},${-1*n*.35}
a${l},${l} 1 0,1 ${a*.1},${-1*n*.65}
H0 V0 Z`)},py=function(t,e,r){let a=r.width,n=r.height,i=.15*a;e.append("path").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${a*.25},${-1*n*.1}
a${i},${i} 1 0,0 ${a*.25},0
a${i},${i} 1 0,0 ${a*.25},0
a${i},${i} 1 0,0 ${a*.25},${1*n*.1}
a${i},${i} 1 0,0 ${a*.15},${1*n*.33}
a${i*.8},${i*.8} 1 0,0 0,${1*n*.34}
a${i},${i} 1 0,0 ${-1*a*.15},${1*n*.33}
a${i},${i} 1 0,0 ${-1*a*.25},${n*.15}
a${i},${i} 1 0,0 ${-1*a*.25},0
a${i},${i} 1 0,0 ${-1*a*.25},0
a${i},${i} 1 0,0 ${-1*a*.25},${-1*n*.15}
a${i},${i} 1 0,0 ${-1*a*.1},${-1*n*.33}
a${i*.8},${i*.8} 1 0,0 0,${-1*n*.34}
a${i},${i} 1 0,0 ${a*.1},${-1*n*.33}
H0 V0 Z`)},yy=function(t,e,r){e.append("circle").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("r",r.width/2)};function my(t,e,r,a,n){return t.insert("polygon",":first-child").attr("points",a.map(function(i){return i.x+","+i.y}).join(" ")).attr("transform","translate("+(n.width-e)/2+", "+r+")")}var by=function(t,e,r){let a=r.height,i=a/4,s=r.width-r.padding+2*i,o=[{x:i,y:0},{x:s-i,y:0},{x:s,y:-a/2},{x:s-i,y:-a},{x:i,y:-a},{x:0,y:-a/2}];my(e,s,a,o,r)},Ey=function(t,e,r){e.append("rect").attr("id","node-"+r.id).attr("class","node-bkg node-"+t.type2Str(r.type)).attr("height",r.height).attr("rx",r.padding).attr("ry",r.padding).attr("width",r.width)},wy=function(t,e,r,a,n){let i=n.htmlLabels,s=a%(cy-1),o=e.append("g");r.section=s;let l="section-"+s;s<0&&(l+=" section-root"),o.attr("class",(r.class?r.class+" ":"")+"mindmap-node "+l);let u=o.append("g"),f=o.append("g"),h=r.descr.replace(/(<br\/*>)/g,`
`);ji(f,h,{useHtmlLabels:i,width:r.width,classes:"mindmap-node-label"}),i||f.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle");let c=f.node().getBBox(),[v]=es(n.fontSize);if(r.height=c.height+v*1.1*.5+r.padding,r.width=c.width+2*r.padding,r.icon)if(r.type===t.nodeType.CIRCLE)r.height+=50,r.width+=50,o.append("foreignObject").attr("height","50px").attr("width",r.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+r.width/2+", "+(r.height/2-1.5*r.padding)+")");else{r.width+=50;let d=r.height;r.height=Math.max(d,60);let y=Math.abs(r.height-d);o.append("foreignObject").attr("width","60px").attr("height",r.height).attr("style","text-align: center;margin-top:"+y/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+s+" "+r.icon),f.attr("transform","translate("+(25+r.width/2)+", "+(y/2+r.padding/2)+")")}else if(i){let d=(r.width-c.width)/2,y=(r.height-c.height)/2;f.attr("transform","translate("+d+", "+y+")")}else{let d=r.width/2,y=r.padding/2;f.attr("transform","translate("+d+", "+y+")")}switch(r.type){case t.nodeType.DEFAULT:vy(t,u,r,s);break;case t.nodeType.ROUNDED_RECT:Ey(t,u,r);break;case t.nodeType.RECT:dy(t,u,r);break;case t.nodeType.CIRCLE:u.attr("transform","translate("+r.width/2+", "+ +r.height/2+")"),yy(t,u,r);break;case t.nodeType.CLOUD:gy(t,u,r);break;case t.nodeType.BANG:py(t,u,r);break;case t.nodeType.HEXAGON:by(t,u,r);break}return t.setElementForId(r.id,o),r.height},xy=function(t,e){let r=t.getElementById(e.id),a=e.x||0,n=e.y||0;r.attr("transform","translate("+a+","+n+")")};Ht.use(al.default);function il(t,e,r,a,n){wy(t,e,r,a,n),r.children&&r.children.forEach((i,s)=>{il(t,e,i,a<0?s:a,n)})}function Ty(t,e){e.edges().map((r,a)=>{let n=r.data();if(r[0]._private.bodyBounds){let i=r[0]._private.rscratch;Wt.trace("Edge: ",a,n),t.insert("path").attr("d",`M ${i.startX},${i.startY} L ${i.midX},${i.midY} L${i.endX},${i.endY} `).attr("class","edge section-edge-"+n.section+" edge-depth-"+n.depth)}})}function sl(t,e,r,a){e.add({group:"nodes",data:{id:t.id.toString(),labelText:t.descr,height:t.height,width:t.width,level:a,nodeId:t.id,padding:t.padding,type:t.type},position:{x:t.x,y:t.y}}),t.children&&t.children.forEach(n=>{sl(n,e,r,a+1),e.add({group:"edges",data:{id:`${t.id}_${n.id}`,source:t.id,target:n.id,depth:a,section:n.section}})})}function Cy(t,e){return new Promise(r=>{let a=Ki("body").append("div").attr("id","cy").attr("style","display:none"),n=Ht({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),sl(t,n,e,0),n.nodes().forEach(function(i){i.layoutDimensions=()=>{let s=i.data();return{w:s.width,h:s.height}}}),n.layout({name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1}).run(),n.ready(i=>{Wt.info("Ready",i),r(n)})})}function Dy(t,e){e.nodes().map((r,a)=>{let n=r.data();n.x=r.position().x,n.y=r.position().y,xy(t,n);let i=t.getElementById(n.nodeId);Wt.info("Id:",a,"Position: (",r.position().x,", ",r.position().y,")",n),i.attr("transform",`translate(${r.position().x-n.width/2}, ${r.position().y-n.height/2})`),i.attr("attr",`apa-${a})`)})}var Sy=async(t,e,r,a)=>{var v,d;var n,i;Wt.debug(`Rendering mindmap diagram
`+t);let s=a.db,o=s.getMindmap();if(!o)return;let l=Ga();l.htmlLabels=!1;let u=rs(e),f=u.append("g");f.attr("class","mindmap-edges");let h=u.append("g");h.attr("class","mindmap-nodes"),il(s,h,o,-1,l);let c=await Cy(o,l);Ty(f,c),Dy(s,c),ts(void 0,u,(v=(n=l.mindmap)==null?void 0:n.padding)!=null?v:ea.mindmap.padding,(d=(i=l.mindmap)==null?void 0:i.useMaxWidth)!=null?d:ea.mindmap.useMaxWidth)},Ly={draw:Sy},Ay=t=>{let e="";for(let r=0;r<t.THEME_COLOR_LIMIT;r++)t["lineColor"+r]=t["lineColor"+r]||t["cScaleInv"+r],Zi(t["lineColor"+r])?t["lineColor"+r]=Qi(t["lineColor"+r],20):t["lineColor"+r]=Ji(t["lineColor"+r],20);for(let r=0;r<t.THEME_COLOR_LIMIT;r++){let a=""+(17-3*r);e+=`
.section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} polygon, .section-${r-1} path {
fill: ${t["cScale"+r]};
}
.section-${r-1} text {
fill: ${t["cScaleLabel"+r]};
}
.node-icon-${r-1} {
font-size: 40px;
color: ${t["cScaleLabel"+r]};
}
.section-edge-${r-1}{
stroke: ${t["cScale"+r]};
}
.edge-depth-${r-1}{
stroke-width: ${a};
}
.section-${r-1} line {
stroke: ${t["cScaleInv"+r]} ;
stroke-width: 3;
}
.disabled, .disabled circle, .disabled text {
fill: lightgray;
}
.disabled text {
fill: #efefef;
}
`}return e},Oy=t=>`
.edge {
stroke-width: 3;
}
${Ay(t)}
.section-root rect, .section-root path, .section-root circle, .section-root polygon {
fill: ${t.git0};
}
.section-root text {
fill: ${t.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;
}
`,Ny=Oy,Uy={db:hy,renderer:Ly,parser:jp,styles:Ny};export{Uy as diagram};
/*! Bundled license information:
cytoscape/dist/cytoscape.esm.mjs:
(*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*)
(*!
Event object based on jQuery events, MIT license
https://jquery.org/license/
https://tldrlegal.com/license/mit-license
https://github.com/jquery/jquery/blob/master/src/event.js
*)
(*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
(*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License *)
*/