/*! For license information please see 7.1da9d72a.chunk.js.LICENSE.txt */ (this["webpackJsonpipfs-webui"]=this["webpackJsonpipfs-webui"]||[]).push([[7],{1004:function(e,t,n){var r=n(1027),i=n(1003);e.exports=function(e,t,n,a){var o=!n;n||(n={});for(var s=-1,u=t.length;++s=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(1051),t.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(38))},1051:function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,a={},o=!1,s=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){c(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"===typeof n.data&&0===n.data.indexOf(t)&&c(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){c(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){c(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(c,0,e)},u.setImmediate=function(e){"function"!==typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;no){var s=a;a=o,o=s}return a+"\x01"+o+"\x01"+(r.isUndefined(i)?"\0":i)}function l(e,t,n,r){var i=""+t,a=""+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return u(e,t.v,t.w,t.name)}a.prototype._nodeCount=0,a.prototype._edgeCount=0,a.prototype.isDirected=function(){return this._isDirected},a.prototype.isMultigraph=function(){return this._isMultigraph},a.prototype.isCompound=function(){return this._isCompound},a.prototype.setGraph=function(e){return this._label=e,this},a.prototype.graph=function(){return this._label},a.prototype.setDefaultNodeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultNodeLabelFn=e,this},a.prototype.nodeCount=function(){return this._nodeCount},a.prototype.nodes=function(){return r.keys(this._nodes)},a.prototype.sources=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._in[t])}))},a.prototype.sinks=function(){var e=this;return r.filter(this.nodes(),(function(t){return r.isEmpty(e._out[t])}))},a.prototype.setNodes=function(e,t){var n=arguments,i=this;return r.each(e,(function(e){n.length>1?i.setNode(e,t):i.setNode(e)})),this},a.prototype.setNode=function(e,t){return r.has(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=i,this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)},a.prototype.node=function(e){return this._nodes[e]},a.prototype.hasNode=function(e){return r.has(this._nodes,e)},a.prototype.removeNode=function(e){var t=this;if(r.has(this._nodes,e)){var n=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],r.each(this.children(e),(function(e){t.setParent(e)})),delete this._children[e]),r.each(r.keys(this._in[e]),n),delete this._in[e],delete this._preds[e],r.each(r.keys(this._out[e]),n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},a.prototype.setParent=function(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(r.isUndefined(t))t=i;else{for(var n=t+="";!r.isUndefined(n);n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this},a.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},a.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==i)return t}},a.prototype.children=function(e){if(r.isUndefined(e)&&(e=i),this._isCompound){var t=this._children[e];if(t)return r.keys(t)}else{if(e===i)return this.nodes();if(this.hasNode(e))return[]}},a.prototype.predecessors=function(e){var t=this._preds[e];if(t)return r.keys(t)},a.prototype.successors=function(e){var t=this._sucs[e];if(t)return r.keys(t)},a.prototype.neighbors=function(e){var t=this.predecessors(e);if(t)return r.union(t,this.successors(e))},a.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},a.prototype.filterNodes=function(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;r.each(this._nodes,(function(n,r){e(r)&&t.setNode(r,n)})),r.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))}));var i={};function a(e){var r=n.parent(e);return void 0===r||t.hasNode(r)?(i[e]=r,r):r in i?i[r]:a(r)}return this._isCompound&&r.each(t.nodes(),(function(e){t.setParent(e,a(e))})),t},a.prototype.setDefaultEdgeLabel=function(e){return r.isFunction(e)||(e=r.constant(e)),this._defaultEdgeLabelFn=e,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return r.values(this._edgeObjs)},a.prototype.setPath=function(e,t){var n=this,i=arguments;return r.reduce(e,(function(e,r){return i.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r})),this},a.prototype.setEdge=function(){var e,t,n,i,a=!1,s=arguments[0];"object"===typeof s&&null!==s&&"v"in s?(e=s.v,t=s.w,n=s.name,2===arguments.length&&(i=arguments[1],a=!0)):(e=s,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,t=""+t,r.isUndefined(n)||(n=""+n);var c=u(this._isDirected,e,t,n);if(r.has(this._edgeLabels,c))return a&&(this._edgeLabels[c]=i),this;if(!r.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(t),this._edgeLabels[c]=a?i:this._defaultEdgeLabelFn(e,t,n);var d=l(this._isDirected,e,t,n);return e=d.v,t=d.w,Object.freeze(d),this._edgeObjs[c]=d,o(this._preds[t],e),o(this._sucs[e],t),this._in[t][c]=d,this._out[e][c]=d,this._edgeCount++,this},a.prototype.edge=function(e,t,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return this._edgeLabels[r]},a.prototype.hasEdge=function(e,t,n){var i=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,t,n);return r.has(this._edgeLabels,i)},a.prototype.removeEdge=function(e,t,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],s(this._preds[t],e),s(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},a.prototype.inEdges=function(e,t){var n=this._in[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.v===t})):i}},a.prototype.outEdges=function(e,t){var n=this._out[e];if(n){var i=r.values(n);return t?r.filter(i,(function(e){return e.w===t})):i}},a.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},1055:function(e,t){e.exports=function(e,t){for(var n=-1,r=null==e?0:e.length;++n0&&a(c)?n>1?e(c,n-1,a,o,s):r(s,c):o||(s[s.length]=c)}return s}},1069:function(e,t,n){var r=n(994);e.exports=function(e,t,n){for(var i=-1,a=e.length;++i0&&(a=u.removeMin(),(o=s[a]).distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return s}(e,String(t),n||a,r||function(t){return e.outEdges(t)})};var a=r.constant(1)},1164:function(e,t,n){var r=n(966);function i(){this._arr=[],this._keyIndices={}}e.exports=i,i.prototype.size=function(){return this._arr.length},i.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},i.prototype.has=function(e){return r.has(this._keyIndices,e)},i.prototype.priority=function(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority},i.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},i.prototype.add=function(e,t){var n=this._keyIndices;if(e=String(e),!r.has(n,e)){var i=this._arr,a=i.length;return n[e]=a,i.push({key:e,priority:t}),this._decrease(a),!0}return!1},i.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},i.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)},i.prototype._heapify=function(e){var t=this._arr,n=2*e,r=n+1,i=e;n>1].priorityt?1:0},j=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t}(e)||function(e){var t,n,r,i,a,o,s,u;function l(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^hsl[a]?\\(((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?)))\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))[%])(?:\\s*,\\s*((?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))))?\\)$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=u=Math.round(255*i);else{var d=i<.5?i*(1+r):i+r-i*r,h=2*i-d;o=Math.round(255*l(h,d,n+1/3)),s=Math.round(255*l(h,d,n)),u=Math.round(255*l(h,d,n-1/3))}t=[o,s,u,a]}return t}(e)},V={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]},q=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i1&&void 0!==arguments[1]?arguments[1]:U,r=n;!(t=e.next()).done;)r=r*Z+t.value|0;return r},J=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:U;return t*Z+e|0},ee=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;return(t<<5)+t+e|0},te=function(e){return 2097152*e[0]+e[1]},ne=function(e,t){return[J(e[0],t[0]),ee(e[1],t[1])]},re=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return Q({next:function(){return r=0&&(e[r]!==t||(e.splice(r,1),!n));r--);},ke=function(e){e.splice(0,e.length)},Ce=function(e,t,n){return n&&(t=L(n,t)),e[t]},Se=function(e,t,n,r){n&&(t=L(n,t)),e[t]=r},_e="undefined"!==typeof Map?Map:function(){function e(){s(this,e),this._obj={}}return l(e,[{key:"set",value:function(e,t){return this._obj[e]=t,this}},{key:"delete",value:function(e){return this._obj[e]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(e){return void 0!==this._obj[e]}},{key:"get",value:function(e){return this._obj[e]}}]),e}(),Pe=function(){function e(t){if(s(this,e),this._obj=Object.create(null),this.size=0,null!=t){var n;n=null!=t.instanceString&&t.instanceString()===this.instanceString()?t.toArray():t;for(var r=0;r2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&T(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0,data:t.data||{},position:t.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:r,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!t.selected,selectable:void 0===t.selectable||!!t.selectable,locked:!!t.locked,grabbed:!1,grabbable:void 0===t.grabbable||!!t.grabbable,pannable:void 0===t.pannable?"edges"===r:!!t.pannable,active:!1,classes:new Te,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var u=[];w(t.classes)?u=t.classes:b(t.classes)&&(u=t.classes.split(/\s+/));for(var l=0,c=u.length;l0;){var C=m.pop(),S=g(C),_=C.id();if(h[_]=S,S!==1/0)for(var P=C.neighborhood().intersect(p),T=0;T0)for(n.unshift(t);d[i];){var a=d[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return s.spawn(n)}}}},Oe={kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(l=g.pop(),c=l.id(),y.delete(c),E++,c===h){for(var k=[],C=i,S=h,_=b[S];k.unshift(C),null!=_&&k.unshift(_),null!=(C=m[S]);)_=b[S=C.id()];return{found:!0,distance:f[c],path:this.spawn(k),steps:E}}v[c]=!0;for(var P=l._private.edges,T=0;TP&&(f[_]=P,y[_]=S,m[_]=w),!i){var T=S*l+C;!i&&f[T]>P&&(f[T]=P,y[T]=C,m[T]=w)}}}for(var D=0;D1&&void 0!==arguments[1]?arguments[1]:a,r=y(e),i=[],o=r;;){if(null==o)return t.spawn();var u=g(o),l=u.edge,c=u.pred;if(i.unshift(o[0]),o.same(n)&&i.length>0)break;null!=l&&i.unshift(l),o=c}return s.spawn(i)},hasNegativeWeightCycle:p,negativeWeightCycles:[]}}},Ve=Math.sqrt(2),qe=function(e,t,n){0===n.length&&pe("Karger-Stein must be run on a connected (sub)graph");for(var r=n[e],i=r[1],a=r[2],o=t[i],s=t[a],u=n,l=u.length-1;l>=0;l--){var c=u[l],d=c[1],h=c[2];(t[d]===o&&t[h]===s||t[d]===s&&t[h]===o)&&u.splice(l,1)}for(var f=0;fr;){var i=Math.floor(Math.random()*t.length);t=qe(i,e,t),n--}return t},Xe={kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/Ve);if(!(i<2)){for(var u=[],l=0;l0?1:e<0?-1:0},$e=function(e,t){return Math.sqrt(Qe(e,t))},Qe=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Je=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},it=function(e,t,n){e.x1=Math.min(e.x1,t),e.x2=Math.max(e.x2,t),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,n),e.y2=Math.max(e.y2,n),e.h=e.y2-e.y1},at=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.x1-=t,e.x2+=t,e.y1-=t,e.y2+=t,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},ot=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=d(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},st=function(e,t){e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1},ut=function(e,t){return!(e.x1>t.x2)&&(!(t.x1>e.x2)&&(!(e.x2t.y2)&&!(t.y1>e.y2)))))))},lt=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},ct=function(e,t){return lt(e,t.x1,t.y1)&<(e,t.x2,t.y2)},dt=function(e,t,n,r,i,a,o){var s,u=Dt(i,a),l=i/2,c=a/2,d=r-c-o;if((s=kt(e,t,n,r,n-l+u-o,d,n+l-u+o,d,!1)).length>0)return s;var h=n+l+o;if((s=kt(e,t,n,r,h,r-c+u-o,h,r+c-u+o,!1)).length>0)return s;var f=r+c+o;if((s=kt(e,t,n,r,n-l+u-o,f,n+l-u+o,f,!1)).length>0)return s;var p,v=n-l-o;if((s=kt(e,t,n,r,v,r-c+u-o,v,r+c-u+o,!1)).length>0)return s;var g=n-l+u,y=r-c+u;if((p=wt(e,t,n,r,g,y,u+o)).length>0&&p[0]<=g&&p[1]<=y)return[p[0],p[1]];var m=n+l-u,b=r-c+u;if((p=wt(e,t,n,r,m,b,u+o)).length>0&&p[0]>=m&&p[1]<=b)return[p[0],p[1]];var x=n+l-u,w=r+c-u;if((p=wt(e,t,n,r,x,w,u+o)).length>0&&p[0]>=x&&p[1]>=w)return[p[0],p[1]];var E=n-l+u,k=r+c-u;return(p=wt(e,t,n,r,E,k,u+o)).length>0&&p[0]<=E&&p[1]>=k?[p[0],p[1]]:[]},ht=function(e,t,n,r,i,a,o){var s=o,u=Math.min(n,i),l=Math.max(n,i),c=Math.min(r,a),d=Math.max(r,a);return u-s<=e&&e<=l+s&&c-s<=t&&t<=d+s},ft=function(e,t,n,r,i,a,o,s,u){var l=Math.min(n,o,i)-u,c=Math.max(n,o,i)+u,d=Math.min(r,s,a)-u,h=Math.max(r,s,a)+u;return!(ec||th)},pt=function(e,t,n,r,i,a,o,s){var u=[];!function(e,t,n,r,i){var a,o,s,u,l,c,d,h;0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,d=t/3,a>0?(l=(l=s+Math.sqrt(a))<0?-Math.pow(-l,1/3):Math.pow(l,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-d+l+c,d+=(l+c)/2,i[4]=i[2]=-d,d=Math.sqrt(3)*(-c+l)/2,i[3]=d,i[5]=-d):(i[5]=i[3]=0,0===a?(h=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*h-d,i[4]=i[2]=-(h+d)):(u=(o=-o)*o*o,u=Math.acos(s/Math.sqrt(u)),h=2*Math.sqrt(o),i[0]=-d+h*Math.cos(u/3),i[2]=-d+h*Math.cos((u+2*Math.PI)/3),i[4]=-d+h*Math.cos((u+4*Math.PI)/3)))}(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,u);for(var l=[],c=0;c<6;c+=2)Math.abs(u[c+1])<1e-7&&u[c]>=0&&u[c]<=1&&l.push(u[c]);l.push(1),l.push(0);for(var d,h,f,p=-1,v=0;v=0?fu?(e-i)*(e-i)+(t-a)*(t-a):l-d},gt=function(e,t,n){for(var r,i,a,o,s=0,u=0;u=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!==0},yt=function(e,t,n,r,i,a,o,s,u){var l,c=new Array(n.length);null!=s[0]?(l=Math.atan(s[1]/s[0]),s[0]<0?l+=Math.PI/2:l=-l-Math.PI/2):l=s;for(var d,h=Math.cos(-l),f=Math.sin(-l),p=0;p0){var v=bt(c,-u);d=mt(v)}else d=c;return gt(e,t,d)},mt=function(e){for(var t,n,r,i,a,o,s,u,l=new Array(e.length/2),c=0;c=0&&p<=1&&g.push(p),v>=0&&v<=1&&g.push(v),0===g.length)return[];var y=g[0]*s[0]+e,m=g[0]*s[1]+t;return g.length>1?g[0]==g[1]?[y,m]:[y,m,g[1]*s[0]+e,g[1]*s[1]+t]:[y,m]},Et=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},kt=function(e,t,n,r,i,a,o,s,u){var l=e-i,c=n-e,d=o-i,h=t-a,f=r-t,p=s-a,v=d*h-p*l,g=c*h-f*l,y=p*c-d*f;if(0!==y){var m=v/y,b=g/y,x=-.001;return x<=m&&m<=1.001&&x<=b&&b<=1.001||u?[e+m*c,t+m*f]:[]}return 0===v||0===g?Et(e,n,o)===o?[o,s]:Et(e,n,i)===i?[i,a]:Et(i,o,n)===n?[n,r]:[]:[]},Ct=function(e,t,n,r,i,a,o,s){var u,l,c,d,h,f,p=[],v=new Array(n.length),g=!0;if(null==a&&(g=!1),g){for(var y=0;y0){var m=bt(v,-s);l=mt(m)}else l=v}else l=n;for(var b=0;bc&&(c=t)},h=function(e){return l[e]},f=0;f0?x.edgesTo(b)[0]:b.edgesTo(x)[0];var E=r(w);b=b.id(),f[b]>f[y]+E&&(f[b]=f[y]+E,p.nodes.indexOf(b)<0?p.push(b):p.updateItem(b),c[b]=0,l[b]=[]),f[b]==f[y]+E&&(c[b]=c[b]+c[y],l[b].push(y))}else for(var k=0;k0;){for(var P=n.pop(),T=0;T0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i}(c,u,t,r);return b=function(e){for(var t=0;t5&&void 0!==arguments[5]?arguments[5]:Zt,o=r,s=0;s=2?nn(e,t,n,0,Jt,en):nn(e,t,n,0,Qt)},squaredEuclidean:function(e,t,n){return nn(e,t,n,0,Jt)},manhattan:function(e,t,n){return nn(e,t,n,0,Qt)},max:function(e,t,n){return nn(e,t,n,-1/0,tn)}};function an(e,t,n,r,i,a){var o;return o=x(e)?e:rn[e]||rn.euclidean,0===t&&x(e)?o(i,a):o(t,n,r,i,a)}rn["squared-euclidean"]=rn.squaredEuclidean,rn.squaredeuclidean=rn.squaredEuclidean;var on=we({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),sn=function(e){return on(e)},un=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=n,s=t;return an(e,r.length,a,(function(e){return r[e](t)}),o,s)},ln=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,u=0;un)return!1}return!0},fn=function(e,t,n){for(var r=0;ri&&(i=t[u][l],a=l);o[a].push(e[u])}for(var c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var f,p=t[o],v=t[r[o]];f="dendrogram"===i.mode?{left:p,right:v,key:p.key}:{value:p.value.concat(v.value),key:p.key},e[p.index]=f,e.splice(v.index,1),t[p.key]=f;for(var g=0;gn[v.key][y.key]&&(a=n[v.key][y.key])):"max"===i.linkage?(a=n[p.key][y.key],n[p.key][y.key]1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var a=0,o=e.length-1;o>=0;o--){var s=e[o];i?isFinite(s)||(e[o]=-1/0,a++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var u=e.length,l=Math.floor(u/2);return u%2!==0?e[l+1+a]:(e[l-1+a]+e[l+a])/2}(e):"mean"===t?function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;io&&(a=u,o=t[i*e+u])}a>0&&r.push(a)}for(var l=0;l=P?(T=P,P=M,D=B):M>T&&(T=M);for(var N=0;N0?1:0;C[E%l.minIterations*t+R]=j,A+=j}if(A>0&&(E>=l.minIterations-1||E==l.maxIterations-1)){for(var F=0,V=0;V0&&r.push(i);return r}(t,a,o),X=function(e,t,n){for(var r=Bn(e,t,n),i=0;iu&&(s=l,u=c)}n[i]=a[s]}return Bn(e,t,n)}(t,r,Y),W={},G=0;G1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},zn=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function o(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var u=e.spawn();;){var l=i.pop();if(u.merge(e.getElementById(l)),t[l].low=t[s].index,t[l].explored=!0,l===s)break}var c=u.edgesWith(u),d=u.merge(c);r.push(d),a=a.difference(d)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},An={};[Be,Ie,Oe,ze,Re,Fe,Xe,It,Lt,At,jt,Ut,bn,Pn,In,{hierholzer:function(e){if(!E(e)){var t=arguments;e={root:t[0],directed:t[1]}}var n,r,i,a=On(e),o=a.root,s=a.directed,u=this,l=!1;o&&(i=b(o)?this.filter(o)[0].id():o[0].id());var c={},d={};s?u.forEach((function(e){var t=e.id();if(e.isNode()){var i=e.indegree(!0),a=e.outdegree(!0),o=i-a,s=a-i;1==o?n?l=!0:n=t:1==s?r?l=!0:r=t:(s>1||o>1)&&(l=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else d[t]=[void 0,e.target().id()]})):u.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?l=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):d[t]=[e.source().id(),e.target().id()]}));var h={found:!1,trail:void 0};if(l)return h;if(r&&n)if(s){if(i&&r!=i)return h;i=r}else{if(i&&r!=i&&n!=i)return h;i||(i=r)}else i||(i=u[0].id());var f=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=d[t][0],i!=(r=d[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},p=[],v=[];for(v=f(i);1!=v.length;)0==c[v[0]].length?(p.unshift(u.getElementById(v.shift())),p.unshift(u.getElementById(v.shift()))):v=f(v.shift()).concat(v);for(var g in p.unshift(u.getElementById(v.shift())),c)if(c[g].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},{hopcroftTarjanBiconnected:Ln,htbc:Ln,htb:Ln,hopcroftTarjanBiconnectedComponents:Ln},{tarjanStronglyConnected:zn,tsc:zn,tscc:zn,tarjanStronglyConnectedComponents:zn}].forEach((function(e){j(An,e)}));var Rn=function e(t){if(!(this instanceof e))return new e(t);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"===typeof t&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Rn.prototype={fulfill:function(e){return jn(this,1,"fulfillValue",e)},reject:function(e){return jn(this,2,"rejectReason",e)},then:function(e,t){var n=this,r=new Rn;return n.onFulfilled.push(qn(e,r,"fulfill")),n.onRejected.push(qn(t,r,"reject")),Fn(n),r.proxy}};var jn=function(e,t,n,r){return 0===e.state&&(e.state=t,e[n]=r,Fn(e)),e},Fn=function(e){1===e.state?Vn(e,"onFulfilled",e.fulfillValue):2===e.state&&Vn(e,"onRejected",e.rejectReason)},Vn=function(e,n,r){if(0!==e[n].length){var i=e[n];e[n]=[];var a=function(){for(var e=0;e0:void 0}},clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){w(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Un.className=Un.classNames=Un.classes;var Zn={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:A,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};Zn.variable="(?:[\\w-]|(?:\\\\"+Zn.metaChar+"))+",Zn.value=Zn.string+"|"+Zn.number,Zn.className=Zn.variable,Zn.id=Zn.variable,function(){var e,t,n;for(e=Zn.comparatorOp.split("|"),n=0;n=0||"="!==t&&(Zn.comparatorOp+="|\\!"+t)}();var $n=0,Qn=1,Jn=2,er=3,tr=4,nr=5,rr=6,ir=7,ar=8,or=9,sr=10,ur=11,lr=12,cr=13,dr=14,hr=15,fr=16,pr=17,vr=18,gr=19,yr=20,mr=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort((function(e,t){return function(e,t){return-1*R(e,t)}(e.selector,t.selector)})),br=function(){for(var e,t={},n=0;n0&&l.edgeCount>0)return ge("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(l.edgeCount>1)return ge("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===l.edgeCount&&ge("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return b(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case $n:var u=e(s);return u.substring(0,u.length-1);case er:var l=r.field,c=r.operator;return"["+l+n(e(c))+t(s)+"]";case nr:var d=r.operator,h=r.field;return"["+e(d)+h+"]";case tr:return"["+r.field+"]";case rr:var f=r.operator;return"[["+r.field+n(e(f))+t(s)+"]]";case ir:return s;case ar:return"#"+s;case or:return"."+s;case pr:case hr:return i(r.parent,a)+n(">")+i(r.child,a);case vr:case fr:return i(r.ancestor,a)+" "+i(r.descendant,a);case gr:var p=i(r.left,a),v=i(r.subject,a),g=i(r.right,a);return p+(p.length>0?" ":"")+v+g;case yr:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),l=!0),(o||u||l)&&(i=o||s?""+e:"",a=""+n),l&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":d=!0,r=e>n;break;case">=":d=!0,r=e>=n;break;case"<":d=!0,r=e0;){var l=i.shift();t(l),a.add(l.id()),o&&r(i,a,l)}return e}function Rr(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1];return Ar(this,e,t,Rr)},zr.forEachUp=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ar(this,e,t,jr)},zr.forEachUpAndDown=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Ar(this,e,t,Fr)},zr.ancestors=zr.parents,(Ir=Or={data:Hn.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:Hn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Hn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Hn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Hn.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Hn.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=Ir.data,Ir.removeAttr=Ir.removeData;var Vr,qr,Yr=Or,Xr={};function Wr(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;ot})),minIndegree:Gr("indegree",(function(e,t){return et})),minOutdegree:Gr("outdegree",(function(e,t){return et}))}),j(Xr,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=l;l&&(u=u[0]);var d=c?u.position():{x:0,y:0};return i={x:s.x-d.x,y:s.y-d.y},void 0===e?i:i[e]}for(var h=0;h0,g=v;v&&(p=p[0]);var y=g?p.position():{x:0,y:0};void 0!==t?f.position(e,t+y[e]):void 0!==i&&f.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}}).modelPosition=Vr.point=Vr.position,Vr.modelPositions=Vr.points=Vr.positions,Vr.renderedPoint=Vr.renderedPosition,Vr.relativePoint=Vr.relativePosition;var Ur,Zr,$r=qr;Ur=Zr={},Zr.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,u=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:u,w:o-a,h:u-s}},Zr.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Zr.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1,useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var u=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(u=100*u/i.width.val);var l=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(l=100*l/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var d=y(i.width.val-a.w,s,u),h=d.biasDiff,f=d.biasComplementDiff,p=y(i.height.val-a.h,l,c),v=p.biasDiff,g=p.biasComplementDiff;t.autoPadding=function(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-h+a.x1+a.x2+f)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-v+a.y1+a.y2+g)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},ei=function(e,t){return null==t?e:Jr(e,t.x1,t.y1,t.x2,t.y2)},ti=function(e,t,n){return Ce(e,t,n)},ni=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var u=a.arrowBounds=a.arrowBounds||{},l=u[n]=u[n]||{};l.x1=r-s,l.y1=i-s,l.x2=r+s,l.y2=i+s,l.w=l.x2-l.x1,l.h=l.y2-l.y1,at(l,1),Jr(e,l.x1,l.y1,l.x2,l.y2)}}},ri=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,u,l,c=t.pstyle("text-halign"),d=t.pstyle("text-valign"),h=ti(a,"labelWidth",n),f=ti(a,"labelHeight",n),p=ti(a,"labelX",n),v=ti(a,"labelY",n),g=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,k=f,C=h,S=C/2,_=k/2;if(m)o=p-S,s=p+S,u=v-_,l=v+_;else{switch(c.value){case"left":o=p-C,s=p;break;case"center":o=p-S,s=p+S;break;case"right":o=p,s=p+C}switch(d.value){case"top":u=v-k,l=v;break;case"center":u=v-_,l=v+_;break;case"bottom":u=v,l=v+k}}o+=g-Math.max(x,w)-E-2,s+=g+Math.max(x,w)+E+2,u+=y-Math.max(x,w)-E-2,l+=y+Math.max(x,w)+E+2;var P=n||"main",T=i.labelBounds,D=T[P]=T[P]||{};D.x1=o,D.y1=u,D.x2=s,D.y2=l,D.w=s-o,D.h=l-u;var M=m&&"autorotate"===b.strValue,B=null!=b.pfValue&&0!==b.pfValue;if(M||B){var N=M?ti(i.rstyle,"labelAngle",n):b.pfValue,I=Math.cos(N),O=Math.sin(N),L=(o+s)/2,z=(u+l)/2;if(!m){switch(c.value){case"left":L=s;break;case"right":L=o}switch(d.value){case"top":z=l;break;case"bottom":z=u}}var A=function(e,t){return{x:(e-=L)*I-(t-=z)*O+L,y:e*O+t*I+z}},R=A(o,u),j=A(o,l),F=A(s,u),V=A(s,l);o=Math.min(R.x,j.x,F.x,V.x),s=Math.max(R.x,j.x,F.x,V.x),u=Math.min(R.y,j.y,F.y,V.y),l=Math.max(R.y,j.y,F.y,V.y)}var q=P+"Rot",Y=T[q]=T[q]||{};Y.x1=o,Y.y1=u,Y.x2=s,Y.y2=l,Y.w=s-o,Y.h=l-u,Jr(e,o,u,s,l),Jr(i.labelBounds.all,o,u,s,l)}return e}},ii=function(e){var t=0,n=function(e){return(e?1:0)<(r=_[1].x)){var P=n;n=r,r=P}if(i>(a=_[1].y)){var T=i;i=a,a=T}Jr(h,n-w,i-w,r+w,a+w)}}else if("bezier"===S||"unbundled-bezier"===S||"segments"===S||"taxi"===S){var D;switch(S){case"bezier":case"unbundled-bezier":D=g.bezierPts;break;case"segments":case"taxi":D=g.linePts}if(null!=D)for(var M=0;M(r=I.x)){var O=n;n=r,r=O}if((i=N.y)>(a=I.y)){var L=i;i=a,a=L}Jr(h,n-=w,i-=w,r+=w,a+=w)}if(c&&t.includeEdges&&v&&(ni(h,e,"mid-source"),ni(h,e,"mid-target"),ni(h,e,"source"),ni(h,e,"target")),c&&"yes"===e.pstyle("ghost").value){var z=e.pstyle("ghost-offset-x").pfValue,A=e.pstyle("ghost-offset-y").pfValue;Jr(h,h.x1+z,h.y1+A,h.x2+z,h.y2+A)}var R=f.bodyBounds=f.bodyBounds||{};st(R,h),ot(R,y),at(R,1),c&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Jr(h,n-x,i-x,r+x,a+x));var j=f.overlayBounds=f.overlayBounds||{};st(j,h),ot(j,y),at(j,1);var F=f.labelBounds=f.labelBounds||{};null!=F.all?((u=F.all).x1=1/0,u.y1=1/0,u.x2=-1/0,u.y2=-1/0,u.w=0,u.h=0):F.all=rt(),c&&t.includeLabels&&(t.includeMainLabels&&ri(h,e,null),v&&(t.includeSourceLabels&&ri(h,e,"source"),t.includeTargetLabels&&ri(h,e,"target")))}return h.x1=Qr(h.x1),h.y1=Qr(h.y1),h.x2=Qr(h.x2),h.y2=Qr(h.y2),h.w=Qr(h.x2-h.x1),h.h=Qr(h.y2-h.y1),h.w>0&&h.h>0&&b&&(ot(h,y),at(h,1)),h}(e,si),r.bbCache=n,r.bbCachePosKey=o):n=r.bbCache,!a){var c=e.isNode();n=rt(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?ei(n,r.overlayBounds):ei(n,r.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!i||t.includeSourceLabels&&t.includeTargetLabels)?ei(n,r.labelBounds.all):(t.includeMainLabels&&ei(n,r.labelBounds.mainRot),t.includeSourceLabels&&ei(n,r.labelBounds.sourceRot),t.includeTargetLabels&&ei(n,r.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},si={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,useCache:!0},ui=ii(si),li=we(si);Zr.boundingBox=function(e){var t;if(1!==this.length||null==this[0]._private.bbCache||this[0]._private.styleDirty||void 0!==e&&void 0!==e.useCache&&!0!==e.useCache){t=rt();var n=li(e=e||si),r=this;if(r.cy().styleEnabled())for(var i=0;i0&&void 0!==arguments[0]?arguments[0]:Ci,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},_i.removeAllListeners=function(){return this.removeListener("*")},_i.emit=_i.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,w(t)||(t=[t]),Di(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(n){var i=r[n];if(i.type===a.type&&(!i.namespace||i.namespace===a.namespace||".*"===i.namespace)&&e.eventMatches(e.context,i,a)){var o=[a];null!=t&&function(e,t){for(var n=0;n1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&b(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--){e(this[t])&&this.unmergeAt(t)}return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){this.cleanStyle();var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=n.style();if(E(e)){var i=e;r.applyBypass(this,i,false),this.emitAndNotify("style")}else if(b(e)){if(void 0===t){var a=this[0];return a?r.getStylePropertyValue(a,e):void 0}r.applyBypass(this,e,t,false),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?r.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style(),r=this;if(void 0===e)for(var i=0;i0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Ji.neighbourhood=Ji.neighborhood,Ji.closedNeighbourhood=Ji.closedNeighborhood,Ji.openNeighbourhood=Ji.openNeighborhood,j(Ji,{source:Lr((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Lr((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:ra({attr:"source"}),targets:ra({attr:"target"})}),j(Ji,{edgesWith:Lr(ia(),"edgesWith"),edgesTo:Lr(ia({thisIsSrc:!0}),"edgesTo")}),j(Ji,{connectedEdges:Lr((function(e){for(var t=[],n=0;n0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Ji.componentsOf=Ji.components;var oa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(void 0!==e){var r=new _e,i=!1;if(t){if(t.length>0&&E(t[0])&&!_(t[0])){i=!0;for(var a=[],o=new Te,s=0,u=t.length;s0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],u=[],l=0,c=i.length;l0){for(var R=e.length===i.length?i:new oa(a,e),j=0;j0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?P.emitAndNotify("remove"):t&&P.emit("remove"));for(var T=0;Td&&Math.abs(s.v)>d;);return a?function(e){return l[e*(l.length-1)|0]}:c}}(),ca=function(e,t,n,r){var i=function(e,t,n,r){var i=4,a=.001,o=1e-7,s=10,u=11,l=1/(u-1),c="undefined"!==typeof Float32Array;if(4!==arguments.length)return!1;for(var d=0;d<4;++d)if("number"!==typeof arguments[d]||isNaN(arguments[d])||!isFinite(arguments[d]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var h=c?new Float32Array(u):new Array(u);function f(e,t){return 1-3*t+3*e}function p(e,t){return 3*t-6*e}function v(e){return 3*e}function g(e,t,n){return((f(t,n)*e+p(t,n))*e+v(t))*e}function y(e,t,n){return 3*f(t,n)*e*e+2*p(t,n)*e+v(t)}function m(t,r){for(var a=0;a0?i=u:r=u}while(Math.abs(a)>o&&++l=a?m(t,s):0===c?s:x(t,r,r+l)}var E=!1;function k(){E=!0,e===t&&n===r||b()}var C=function(i){return E||k(),e===t&&n===r?i:0===i?0:1===i?1:g(w(i),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},da={linear:function(e,t,n){return e+(t-e)*n},ease:ca(.25,.1,.25,1),"ease-in":ca(.42,0,1,1),"ease-out":ca(0,0,.58,1),"ease-in-out":ca(.42,0,.58,1),"ease-in-sine":ca(.47,0,.745,.715),"ease-out-sine":ca(.39,.575,.565,1),"ease-in-out-sine":ca(.445,.05,.55,.95),"ease-in-quad":ca(.55,.085,.68,.53),"ease-out-quad":ca(.25,.46,.45,.94),"ease-in-out-quad":ca(.455,.03,.515,.955),"ease-in-cubic":ca(.55,.055,.675,.19),"ease-out-cubic":ca(.215,.61,.355,1),"ease-in-out-cubic":ca(.645,.045,.355,1),"ease-in-quart":ca(.895,.03,.685,.22),"ease-out-quart":ca(.165,.84,.44,1),"ease-in-out-quart":ca(.77,0,.175,1),"ease-in-quint":ca(.755,.05,.855,.06),"ease-out-quint":ca(.23,1,.32,1),"ease-in-out-quint":ca(.86,0,.07,1),"ease-in-expo":ca(.95,.05,.795,.035),"ease-out-expo":ca(.19,1,.22,1),"ease-in-out-expo":ca(1,0,0,1),"ease-in-circ":ca(.6,.04,.98,.335),"ease-out-circ":ca(.075,.82,.165,1),"ease-in-out-circ":ca(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return da.linear;var r=la(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":ca};function ha(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function fa(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function pa(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=fa(e,i),s=fa(t,i);if(k(o)&&k(s))return ha(a,o,s,n,r);if(w(o)&&w(s)){for(var u=[],l=0;l0?("spring"===d&&h.push(o.duration),o.easingImpl=da[d].apply(null,h)):o.easingImpl=da[d]}var f,p=o.easingImpl;if(f=0===o.duration?1:(n-u)/o.duration,o.applying&&(f=o.progress),f<0?f=0:f>1&&(f=1),null==o.delay){var v=o.startPosition,g=o.position;if(g&&i&&!e.locked()){var y={};ga(v.x,g.x)&&(y.x=pa(v.x,g.x,f,p)),ga(v.y,g.y)&&(y.y=pa(v.y,g.y,f,p)),e.position(y)}var m=o.startPan,x=o.pan,w=a.pan,E=null!=x&&r;E&&(ga(m.x,x.x)&&(w.x=pa(m.x,x.x,f,p)),ga(m.y,x.y)&&(w.y=pa(m.y,x.y,f,p)),e.emit("pan"));var k=o.startZoom,C=o.zoom,S=null!=C&&r;S&&(ga(k,C)&&(a.zoom=nt(a.minZoom,pa(k,C,f,p),a.maxZoom)),e.emit("zoom")),(E||S)&&e.emit("viewport");var _=o.style;if(_&&_.length>0&&i){for(var P=0;P<_.length;P++){var T=_[P],D=T.name,M=T,B=o.startStyle[D],N=pa(B,M,f,p,l.properties[B.name]);l.overrideBypass(e,D,N)}e.emit("style")}}return o.progress=f,f}function ga(e,t){return null!=e&&null!=t&&(!(!k(e)||!k(t))||!(!e||!t))}function ya(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function ma(e,t){var n=t._private.aniEles,r=[];function i(t,n){var i=t._private,a=i.animation.current,o=i.animation.queue,s=!1;if(0===a.length){var u=o.shift();u&&a.push(u)}for(var l=function(e){for(var t=e.length-1;t>=0;t--){(0,e[t])()}e.splice(0,e.length)},c=a.length-1;c>=0;c--){var d=a[c],h=d._private;h.stopped?(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.frames)):(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||ya(0,d,e),va(t,d,e,n),h.applying&&(h.applying=!1),l(h.frames),null!=h.step&&h.step(e),d.completed()&&(a.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,l(h.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var ba={animate:Hn.animate(),animation:Hn.animation(),animated:Hn.animated(),clearQueue:Hn.clearQueue(),delay:Hn.delay(),delayAnimation:Hn.delayAnimation(),stop:Hn.stop(),addToAnimationPool:function(e){this.styleEnabled()&&this._private.aniEles.merge(e)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var e=this;if(e._private.animationsRunning=!0,e.styleEnabled()){var t=e.renderer();t&&t.beforeRender?t.beforeRender((function(t,n){ma(n,e)}),t.beforeRenderPriorities.animations):function t(){e._private.animationsRunning&&H((function(n){ma(n,e),t()}))}()}}},xa={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&_(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},wa=function(e){return b(e)?new Mr(e):e},Ea={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Si(xa,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,wa(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,wa(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,wa(t),n),this},once:function(e,t,n){return this.emitter().one(e,wa(t),n),this},emit:function(e,t){return this.emitter().emit(e,t),this},emitAndNotify:function(e,t){return this.emit(e),this.notify(e,t),this}};Hn.eventAliasesOn(Ea);var ka={png:function(e){return e=e||{},this._private.renderer.png(e)},jpg:function(e){var t=this._private.renderer;return(e=e||{}).bg=e.bg||"#fff",t.jpg(e)}};ka.jpeg=ka.jpg;var Ca={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n=e.name,r=t.extension("layout",n);if(null!=r){var i;i=b(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$();var a=new r(j({},e,{cy:t,eles:i}));return a}pe("No such layout `"+n+"` found. Did you forget to import it and `cytoscape.use()` it?")}else pe("A `name` must be specified to make a layout");else pe("Layout options must be specified to make a layout")}};Ca.createLayout=Ca.makeLayout=Ca.layout;var Sa={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.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 null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this},batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Pa.invalidateDimensions=Pa.resize;var Ta={collection:function(e,t){return b(e)?this.$(e):S(e)?e.collection():w(e)?new oa(this,e,t):new oa(this)},nodes:function(e){var t=this.$((function(e){return e.isNode()}));return e?t.filter(e):t},edges:function(e){var t=this.$((function(e){return e.isEdge()}));return e?t.filter(e):t},$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Ta.elements=Ta.filter=Ta.$;var Da={},Ma="t";Da.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(h||d&&f){var p=void 0;h&&f||h?p=l.properties:f&&(p=l.mappedProperties);for(var v=0;v1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],C=i.valueMin[1],S=i.valueMax[1],_=i.valueMin[2],P=i.valueMax[2],T=null==i.valueMin[3]?1:i.valueMin[3],D=null==i.valueMax[3]?1:i.valueMax[3],M=[Math.round(w+(E-w)*g),Math.round(C+(S-C)*g),Math.round(_+(P-_)*g),Math.round(T+(D-T)*g)];n={bypass:i.bypass,name:i.name,value:M,strValue:"rgb("+M[0]+", "+M[1]+", "+M[2]+")"}}else{if(!s.number)return!1;var B=i.valueMin+(i.valueMax-i.valueMin)*g;n=this.parse(i.name,B,i.bypass,h)}if(!n)return v(),!1;n.mapping=i,i=n;break;case o.data:for(var N=i.field.split("."),I=d.data,O=0;O0&&a>0){for(var s={},u=!1,l=0;l0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Da.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);null!=s&&s(n,r)&&a(o)},Da.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Da.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),"curve-style"!==t||"bezier"!==n&&"bezier"!==r||!i.triggersBoundsOfParallelBeziers||e.parallelEdges().forEach((function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}))}))},Da.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r)};var Ba={applyBypass:function(e,t,n,r){var i=[];if("*"===t||"**"===t){if(void 0!==n)for(var a=0;at.length?a.substr(t.length):""}function s(){n=n.length>r.length?n.substr(r.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");;){if(a.match(/^\s*$/))break;var u=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){ge("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=u[0];var l=u[1];if("core"!==l)if(new Mr(l).invalid){ge("Skipping parsing of block: Invalid selector found in string stylesheet: "+l),o();continue}var c=u[2],d=!1;n=c;for(var h=[];;){if(n.match(/^\s*$/))break;var f=n.match(/^\s*(.+?)\s*:\s*(.+?)\s*;/);if(!f){ge("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+c),d=!0;break}r=f[0];var p=f[1],v=f[2];if(this.properties[p])i.parse(p,v)?(h.push({name:p,val:v}),s()):(ge("Skipping property: Invalid property definition in: "+r),s());else ge("Skipping property: Invalid property name in: "+r),s()}if(d){o();break}i.selector(l);for(var g=0;g=7&&"d"===t[0]&&(l=new RegExp(s.data.regex).exec(t))){if(n)return!1;var h=s.data;return{name:e,value:l,strValue:""+t,mapped:h,field:l[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(d.multiple)return!1;var f=s.mapData;if(!d.color&&!d.number)return!1;var p=this.parse(e,c[4]);if(!p||p.mapped)return!1;var v=this.parse(e,c[5]);if(!v||v.mapped)return!1;if(p.pfValue===v.pfValue||p.strValue===v.strValue)return ge("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+p.strValue+"`"),this.parse(e,p.strValue);if(d.color){var g=p.value,y=v.value;if(g[0]===y[0]&&g[1]===y[1]&&g[2]===y[2]&&(g[3]===y[3]||(null==g[3]||1===g[3])&&(null==y[3]||1===y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:f,field:c[1],fieldMin:parseFloat(c[2]),fieldMax:parseFloat(c[3]),valueMin:p.value,valueMax:v.value,bypass:n}}}if(d.multiple&&"multiple"!==r){var m;if(m=u?t.split(/\s+/):w(t)?t:[t],d.evenMultiple&&m.length%2!==0)return null;for(var E=[],C=[],S=[],_="",P=!1,T=0;T0?" ":"")+D.strValue}return d.validate&&!d.validate(E,C)?null:d.singleEnum&&P?1===E.length&&b(E[0])?{name:e,value:E[0],strValue:E[0],bypass:n}:null:{name:e,value:E,pfValue:S,strValue:_,bypass:n,units:C}}var M,B,N=function(){for(var r=0;rd.max||d.strictMax&&t===d.max))return null;var j={name:e,value:t,strValue:""+t+(O||""),units:O,bypass:n};return d.unitless||"px"!==O&&"em"!==O?j.pfValue=t:j.pfValue="px"!==O&&O?this.getEmSizeInPixels()*t:t,"ms"!==O&&"s"!==O||(j.pfValue="ms"===O?t:1e3*t),"deg"!==O&&"rad"!==O||(j.pfValue="rad"===O?t:(M=t,Math.PI*M/180)),"%"===O&&(j.pfValue=t/100),j}if(d.propList){var V=[],q=""+t;if("none"===q);else{for(var Y=q.split(/\s*,\s*|\s+/),X=0;X0&&u>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:o=(o=(o=Math.min((s-2*t)/n.w,(u-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:o)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),k(e)?n=e:E(e)&&(n=e.level,null!=e.position?t=We(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;k(u.x)&&(t.pan.x=u.x,o=!1),k(u.y)&&(t.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 t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(b(e)){var n=e;e=this.mutableElements().filter(n)}else S(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e=this._private,t=e.container;return e.sizeCache=e.sizeCache||(t?function(){var e=h.getComputedStyle(t),n=function(t){return parseFloat(e.getPropertyValue(t))};return{width:t.clientWidth-n("padding-left")-n("padding-right"),height:t.clientHeight-n("padding-top")-n("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}}};Va.centre=Va.center,Va.autolockNodes=Va.autolock,Va.autoungrabifyNodes=Va.autoungrabify;var qa={data:Hn.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Hn.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Hn.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Hn.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};qa.attr=qa.data,qa.removeAttr=qa.removeData;var Ya=function(e){var t=this,n=(e=j({},e)).container;n&&!C(n)&&C(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==h&&void 0!==n&&!e.headless,o=e;o.layout=j({name:a?"grid":"null"},o.layout),o.renderer=j({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},u=this._private={container:n,ready:!1,options:o,elements:new oa(this),listeners:[],aniEles:new oa(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:k(o.zoom)?o.zoom:1,pan:{x:E(o.pan)&&k(o.pan.x)?o.pan.x:0,y:E(o.pan)&&k(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});u.styleEnabled&&t.setStyle([]);var l=j({},o,o.renderer);t.initRenderer(l);!function(e,t){if(e.some(B))return Xn.all(e).then(t);t(e)}([o.style,o.elements],(function(e){var n=e[0],a=e[1];u.styleEnabled&&t.style().append(n),function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(E(e)||w(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=j({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()}(a,(function(){t.startAnimationLoop(),u.ready=!0,x(o.ready)&&t.on("ready",o.ready);for(var e=0;e0,l=rt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()});if(S(n.roots))e=n.roots;else if(w(n.roots)){for(var c=[],d=0;d0;){var N=D.shift(),I=T(N,M);if(I)N.outgoers().filter((function(e){return e.isNode()&&i.has(e)})).forEach(B);else if(null===I){ge("Detected double maximal shift for node `"+N.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}P();var O=0;if(n.avoidOverlap)for(var L=0;L0&&y[0].length<=3?u/2:0),d=2*Math.PI/y[r].length*i;return 0===r&&1===y[0].length&&(c=1),{x:K+c*Math.cos(d),y:U+c*Math.sin(d)}}return{x:K+(i+1-(a+1)/2)*o,y:(r+1)*s}})),this};var Ua={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Za(e){this.options=j({},Ua,e)}Za.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=rt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),u=s.x1+s.w/2,l=s.y1+s.h/2,c=(void 0===t.sweep?2*Math.PI-2*Math.PI/a.length:t.sweep)/Math.max(1,a.length-1),d=0,h=0;h1&&t.avoidOverlap){d*=1.75;var g=Math.cos(c)-Math.cos(0),y=Math.sin(c)-Math.sin(0),m=Math.sqrt(d*d/(g*g+y*y));o=Math.max(m,o)}return r.nodes().layoutPositions(this,t,(function(e,n){var r=t.startAngle+n*c*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:u+a,y:l+s}})),this};var $a,Qa={fit:!0,padding:30,startAngle:1.5*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function Ja(e){this.options=j({},Qa,e)}Ja.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=rt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s=o.x1+o.w/2,u=o.y1+o.h/2,l=[],c=0,d=0;d0)Math.abs(m[0].value-x.value)>=g&&(m=[],y.push(m));m.push(x)}var w=c+t.minNodeSpacing;if(!t.avoidOverlap){var E=y.length>0&&y[0].length>1,k=(Math.min(o.w,o.h)/2-w)/(y.length+E?1:0);w=Math.min(w,k)}for(var C=0,S=0;S1&&t.avoidOverlap){var D=Math.cos(T)-Math.cos(0),M=Math.sin(T)-Math.sin(0),B=Math.sqrt(w*w/(D*D+M*M));C=Math.max(B,C)}_.r=C,C+=w}if(t.equidistant){for(var N=0,I=0,O=0;O=e.numIter)&&(uo(r,e),r.temperature=r.temperature*e.coolingFactor,!(r.temperature=e.animationThreshold&&a(),H(t)):(wo(r,e),s())}()}else{for(;l;)l=o(u),u++;wo(r,e),s()}return this},to.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},to.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var no=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:e.width(),clientHeight:e.width(),boundingBox:rt(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()})},o=n.eles.components(),s={},u=0;u0){a.graphSet.push(w);for(u=0;ur.count?0:r.graph},io=function e(t,n,r,i){var a=i.graphSet[r];if(-10)var s=(l=r.nodeOverlap*o)*i/(v=Math.sqrt(i*i+a*a)),u=l*a/v;else{var l,c=po(e,i,a),d=po(t,-1*i,-1*a),h=d.x-c.x,f=d.y-c.y,p=h*h+f*f,v=Math.sqrt(p);s=(l=(e.nodeRepulsion+t.nodeRepulsion)/p)*h/v,u=l*f/v}e.isLocked||(e.offsetX-=s,e.offsetY-=u),t.isLocked||(t.offsetX+=s,t.offsetY+=u)}},fo=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},po=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,u=a/o,l={};return 0===t&&0n?(l.x=r,l.y=i+a/2,l):0t&&-1*u<=s&&s<=u?(l.x=r-o/2,l.y=i-o*n/2/t,l):0=u)?(l.x=r+a*t/2/n,l.y=i+a/2,l):0>n&&(s<=-1*u||s>=u)?(l.x=r-a*t/2/n,l.y=i-a/2,l):l},vo=function(e,t){for(var n=0;n1){var p=t.gravity*d/f,v=t.gravity*h/f;c.offsetX+=p,c.offsetY+=v}}}}},yo=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],u=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},xo=function e(t,n){var r=t.parentId;if(null!=r){var i=n.layoutNodes[n.idToIndex[r]],a=!1;return(null==i.maxX||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(null==i.minX||t.minX-i.padLefti.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(null==i.minY||t.minY-i.padTopp&&(d+=f+t.componentSpacing,c=0,h=0,f=0)}}},Eo={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(e){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(e,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function ko(e){this.options=j({},Eo,e)}ko.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=rt(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),u=Math.round(s),l=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(u,l);Math.min(u,l)==u?u=e:l=e},d=function(e){if(null==e)return Math.max(u,l);Math.max(u,l)==u?u=e:l=e},h=t.rows,f=null!=t.cols?t.cols:t.columns;if(null!=h&&null!=f)u=h,l=f;else if(null!=h&&null==f)u=h,l=Math.ceil(o/u);else if(null==h&&null!=f)l=f,u=Math.ceil(o/l);else if(l*u>o){var p=c(),v=d();(p-1)*v>=o?c(p-1):(v-1)*p>=o&&d(v-1)}else for(;l*u=o?d(y+1):c(g+1)}var m=a.w/l,b=a.h/u;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=l&&(B=0,M++)},I={},O=0;O(r=vt(e,t,x[w],x[w+1],x[w+2],x[w+3])))return g(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=pt(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return g(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(u,c),k=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Ce(e,t,n)}function x(n,r){var i,a=n._private,o=p;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],u=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&u){var l=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),d=b(a.rscratch,"labelAngle",r),h=n.pstyle(i+"text-margin-x").pfValue,f=n.pstyle(i+"text-margin-y").pfValue,v=s.x1-o-h,y=s.x2+o-h,m=s.y1-o-f,x=s.y2+o-f;if(d){var w=Math.cos(d),E=Math.sin(d),k=function(e,t){return{x:(e-=l)*w-(t-=c)*E+l,y:e*E+t*w+c}},C=k(v,m),S=k(v,x),_=k(y,m),P=k(y,x),T=[C.x+h,C.y+f,_.x+h,_.y+f,P.x+h,P.y+f,S.x+h,S.y+f];if(gt(e,t,T))return g(n),!0}else if(lt(s,e,t))return g(n),!0}}n&&(u=u.interactive);for(var w=u.length-1;w>=0;w--){var E=u[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return l},getAllInBox:function(e,t,n,r){for(var i,a,o=this.getCachedZSortedEles().interactive,s=[],u=Math.min(e,n),l=Math.max(e,n),c=Math.min(t,r),d=Math.max(t,r),h=rt({x1:e=u,y1:t=c,x2:n=l,y2:r=d}),f=0;f0?Math.max(e-t,0):Math.min(e+t,0)},P=_(C,E),T=_(S,k),D=!1;"auto"===g?v=Math.abs(P)>Math.abs(T)?i:r:g===u||g===s?(v=r,D=!0):g!==a&&g!==o||(v=i,D=!0);var M,B=v===r,N=B?T:P,I=B?S:C,O=Ze(I),L=!1;(D&&(m||x)||!(g===s&&I<0||g===u&&I>0||g===a&&I>0||g===o&&I<0)||(N=(O*=-1)*Math.abs(N),L=!0),m)?M=(b<0?1+b:b)*N:M=(b<0?N:0)+b*O;var z=function(e){return Math.abs(e)=Math.abs(N)},A=z(M),R=z(Math.abs(N)-Math.abs(M));if((A||R)&&!L)if(B){var j=Math.abs(I)<=d/2,F=Math.abs(C)<=h/2;if(j){var V=(l.x1+l.x2)/2,q=l.y1,Y=l.y2;n.segpts=[V,q,V,Y]}else if(F){var X=(l.y1+l.y2)/2,W=l.x1,G=l.x2;n.segpts=[W,X,G,X]}else n.segpts=[l.x1,l.y2]}else{var H=Math.abs(I)<=c/2,K=Math.abs(S)<=f/2;if(H){var U=(l.y1+l.y2)/2,Z=l.x1,$=l.x2;n.segpts=[Z,U,$,U]}else if(K){var Q=(l.x1+l.x2)/2,J=l.y1,ee=l.y2;n.segpts=[Q,J,Q,ee]}else n.segpts=[l.x2,l.y1]}else if(B){var te=l.y1+M+(p?d/2*O:0),ne=l.x1,re=l.x2;n.segpts=[ne,te,re,te]}else{var ie=l.x1+M+(p?c/2*O:0),ae=l.y1,oe=l.y2;n.segpts=[ie,ae,ie,oe]}},Ao.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,d=!k(n.startX)||!k(n.startY),h=!k(n.arrowStartX)||!k(n.arrowStartY),f=!k(n.endX)||!k(n.endY),p=!k(n.arrowEndX)||!k(n.arrowEndY),v=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),g=$e({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),y=gh.poolIndex()){var f=d;d=h,h=f}var p=s.srcPos=d.position(),v=s.tgtPos=h.position(),g=s.srcW=d.outerWidth(),y=s.srcH=d.outerHeight(),m=s.tgtW=h.outerWidth(),b=s.tgtH=h.outerHeight(),x=s.srcShape=n.nodeShapes[t.getNodeShape(d)],w=s.tgtShape=n.nodeShapes[t.getNodeShape(h)];s.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var E=0;E0){var q=l,Y=Qe(q,He(t)),X=Qe(q,He(V)),W=Y;if(X2)Qe(q,{x:V[2],y:V[3]})0){var ie=c,ae=Qe(ie,He(t)),oe=Qe(ie,He(re)),se=ae;if(oe2)Qe(ie,{x:re[2],y:re[3]})=l||m){c={cp:v,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(l-h)/x.length,E=x.t1-x.t0,k=s?x.t0+E*w:x.t1-E*w;k=nt(0,k,1),t=tt(b.p0,b.p1,b.p2,k),i=function(e,t,n,r){var i=nt(0,r-.001,1),a=nt(0,r+.001,1),o=tt(e,t,n,i),s=tt(e,t,n,a);return Xo(o,s)}(b.p0,b.p1,b.p2,k);break;case"straight":case"segments":case"haystack":for(var C,S,_,P,T=0,D=r.allpts.length,M=0;M+3=l));M+=2);var B=(l-S)/C;B=nt(0,B,1),t=function(e,t,n,r){var i=t.x-e.x,a=t.y-e.y,o=$e(e,t),s=i/o,u=a/o;return n=null==n?0:n,r=null!=r?r:n*o,{x:e.x+s*r,y:e.y+u*r}}(_,P,B),i=Xo(_,P)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};l("source"),l("target"),this.applyLabelDimensions(e)}},qo.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},qo.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Ce(n.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==o?1:Math.max(s.length,1),l=i.height/u,c=l*a,d=i.width,h=i.height+(u-1)*(a-1)*l;Se(n.rstyle,"labelWidth",t,d),Se(n.rscratch,"labelWidth",t,d),Se(n.rstyle,"labelHeight",t,h),Se(n.rscratch,"labelHeight",t,h),Se(n.rscratch,"labelLineHeight",t,c)},qo.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,o=function(e,r){return r?(Se(n.rscratch,e,t,r),r):Ce(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var u=o("labelKey");if(null!=u&&o("labelWrapKey")===u)return o("labelWrapCachedText");for(var l=i.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("tex