PageSourceSearch

https://builderbot.vercel.app/_next/static/chunks/5d0d0575.7a49f117bdeebf5a.js

js builderbot.vercel.app collected 2026-10-03 06:21:53 UTC 374,634 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9856],{59058:function(e,t,n){var i,a,o,s,l,u,c,d,h,p,g,v,y=n(23279),b=n(54485),x=n(27361),w=n(36968),E=n(30084);function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var C=_interopDefaultLegacy(y),S=_interopDefaultLegacy(b),P=_interopDefaultLegacy(x),k=_interopDefaultLegacy(w),D=_interopDefaultLegacy(E);function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _slicedToArray(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,i,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],s=!0,l=!1;try{for(a=a.call(e);!(s=(n=a.next()).done)&&(o.push(n.value),!t||o.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{s||null==a.return||a.return()}finally{if(l)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n<t;n++)i[n]=e[n];return i}var T="undefined"==typeof window?null:window,B=T?T.navigator:null;T&&T.document;var A=_typeof(""),I=_typeof({}),M=_typeof(function(){}),_="undefined"==typeof HTMLElement?"undefined":_typeof(HTMLElement),instanceStr=function(e){return e&&e.instanceString&&fn$6(e.instanceString)?e.instanceString():null},string=function(e){return null!=e&&_typeof(e)==A},fn$6=function(e){return null!=e&&_typeof(e)===M},array=function(e){return!elementOrCollection(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},plainObject=function(e){return null!=e&&_typeof(e)===I&&!array(e)&&e.constructor===Object},number$1=function(e){return null!=e&&_typeof(e)===_typeof(1)&&!isNaN(e)},htmlElement=function(e){if("undefined"!==_)return null!=e&&e instanceof HTMLElement},elementOrCollection=function(e){return element(e)||collection(e)},element=function(e){return"collection"===instanceStr(e)&&e._private.single},collection=function(e){return"collection"===instanceStr(e)&&!e._private.single},core=function(e){return"core"===instanceStr(e)},stylesheet=function(e){return"stylesheet"===instanceStr(e)},emptyString=function(e){return null==e||!!(""===e||e.match(/^\s+$/))},promise=function(e){return null!=e&&_typeof(e)===I&&fn$6(e.then)},memoize=function(e,t){t||(t=function(){if(1==arguments.length)return arguments[0];if(0==arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var memoizedFn=function memoizedFn(){var n,i=arguments,a=t.apply(this,i),o=memoizedFn.cache;return(n=o[a])||(n=o[a]=e.apply(this,i)),n};return memoizedFn.cache={},memoizedFn},L=memoize(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),O=memoize(function(e){return e.replace(/(-\w)/g,function(e){return e[1].toUpperCase()})}),N=memoize(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),capitalize=function(e){return emptyString(e)?e:e.charAt(0).toUpperCase()+e.substring(1)},z="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",R="rgb[a]?\\(("+z+"[%]?)\\s*,\\s*("+z+"[%]?)\\s*,\\s*("+z+"[%]?)(?:\\s*,\\s*("+z+"))?\\)",F="rgb[a]?\\((?:"+z+"[%]?)\\s*,\\s*(?:"+z+"[%]?)\\s*,\\s*(?:"+z+"[%]?)(?:\\s*,\\s*(?:"+z+"))?\\)",V="hsl[a]?\\(("+z+")\\s*,\\s*("+z+"[%])\\s*,\\s*("+z+"[%])(?:\\s*,\\s*("+z+"))?\\)",q="hsl[a]?\\((?:"+z+")\\s*,\\s*(?:"+z+"[%])\\s*,\\s*(?:"+z+"[%])(?:\\s*,\\s*(?:"+z+"))?\\)",ascending=function(e,t){return e<t?-1:e>t?1:0},j=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var i=t[n];if(null!=i)for(var a=Object.keys(i),o=0;o<a.length;o++){var s=a[o];e[s]=i[s]}}return e},hex2tuple=function(e){if((4===e.length||7===e.length)&&"#"===e[0]){var t,n,i;return 4===e.length?(t=parseInt(e[1]+e[1],16),n=parseInt(e[2]+e[2],16),i=parseInt(e[3]+e[3],16)):(t=parseInt(e[1]+e[2],16),n=parseInt(e[3]+e[4],
116),i=parseInt(e[5]+e[6],16)),[t,n,i]}},hsl2tuple=function(e){function hue2rgb(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var t,n,i,a,o,s,l,u,c=RegExp("^"+V+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(i=parseFloat(c[2]))<0||i>100||(i/=100,(a=parseFloat(c[3]))<0||a>100)||(a/=100,void 0!==(o=c[4])&&((o=parseFloat(o))<0||o>1)))return;if(0===i)s=l=u=Math.round(255*a);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;s=Math.round(255*hue2rgb(h,d,n+1/3)),l=Math.round(255*hue2rgb(h,d,n)),u=Math.round(255*hue2rgb(h,d,n-1/3))}t=[s,l,u,o]}return t},rgb2tuple=function(e){var t,n=RegExp("^"+R+"$").exec(e);if(n){t=[];for(var i=[],a=1;a<=3;a++){var o=n[a];if("%"===o[o.length-1]&&(i[a]=!0),o=parseFloat(o),i[a]&&(o=o/100*255),o<0||o>255)return;t.push(Math.floor(o))}var s=i[1]||i[2]||i[3],l=i[1]&&i[2]&&i[3];if(s&&!l)return;var u=n[4];if(void 0!==u){if((u=parseFloat(u))<0||u>1)return;t.push(u)}}return t},$={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]},setMap=function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var o=n[a];if(plainObject(o))throw Error("Tried to set map with object key");a<n.length-1?(null==t[o]&&(t[o]={}),t=t[o]):t[o]=e.value}},getMap=function(e){for(var t=e.map,n=e.keys,i=n.length,a=0;a<i;a++){var o=n[a];if(plainObject(o))throw Error("Tried to get map with object key");if(null==(t=t[o]))break}return t},X=T?T.performance:null,Y=X&&X.now?function(){return X.now()}:function(){return Date.now()},H=function(){if(T){if(T.requestAnimationFrame)return function(e){T.requestAnimationFrame(e)};if(T.mozRequestAnimationFrame)return function(e){T.mozRequestAnimationFrame(e)};if(T.webkitRequestAnimationFrame)return function(e){T.webkitRequestAnimationFrame(e)};if(T.msRequestAnimationFrame)return function(e){T.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(Y())},1e3/60)}}(),requestAnimationFrame=function(e){return H(e)},hashIterableInts=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261,i=n;!(t=e.next()).done;)i=65599*i+t.value|0;return i},hashInt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9261;return 65599*t+e|0},hashIntAlt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5381;return(t<<5)+t+e|0},combineHashesArray=function(e){return 2097152*e[0]+e[1]},hashArrays=function(e,t){return[hashInt(e[0],t[0]),hashIntAlt(e[1],t[1])]},hashIntsArray=function(e,t){var n={value:0,done:!1},i=0,a=e.length;return hashIterableInts({next:function(){return i<a?n.value=e[i++]:n.done=!0,n}},t)},hashString=function(e,t){var n={value:0,done:!1},i=0,a=e.length;return hashIterableInts({next:function(){return i<a?n.value=e.charCodeAt(i++):n.done=!0,n}},t)},hashStrings=function(){return hashStringsArray(arguments)},hashStringsArray=function(e){for(var t,n=0;n<e.length;n++){var i=e[n];t=0===n?hashString(i):hashString(i,t)}return t},W=!0,U=null!=console.warn,G=null!=console.trace,K=Number.MAX_SAFE_INTEGER||9007199254740991,trueify=function(){return!0},falsify=function(){return!1},zeroify=function(){return 0},noop$1=function(){},error=function(e){throw Error(e)},warnings=function(e){if(void 0===e)return W;W=!!e},warn=function(e){warnings()&&(U?console.warn(e):(console.log(e),G&&console.trace()))},copy=function(e){return null==e?e:array(e)?e.slice():plainObject(e)?j({},e):e},uuid=function(e,t){for(t=e="";e++<36;t+=51*e&52?(15^e?8^Math.random()*(20^e?16:4):4).toString(16):"-");return t},Q={},staticEmptyObject=function(){return Q},defaults$g=function(e){var t=Object.keys(e);return function(n){for(var i={},a=0;a<t.length;a++){var o=t[a],s=null==n?void 0:n[o];i[o]=void 0===s?e[o]:s}return i}},removeFromArray=function(e,t,n){for(var i=e.length-1;i>=0&&(e[i]!==t||(e.splice(i,1),!n));i--);},clearArray=function(e){e.splice(0,e.length)},push=function(e,t){for(var n=0;n<t.length;n++){var i=t[n];e.push(i)}},getPrefixedProperty=function(e,t,n){return n&&(t=N(n,t)),e[t]},setPrefixedProperty=function(e,t,n,i){n&&(t=N(n,t)),e[t]=i},Z=function(){function ObjectMap(){_classCallCheck(this,ObjectMap),this._obj={}}return _createClass(ObjectMap,[{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]}}]),ObjectMap}(),J="undefined"!=typeof Map?Map:Z,ee=function(){function ObjectSet(e){if(_classCallCheck(this,ObjectSet),this._obj=Object.create(null),this.size=0,null!=e){var t;t=null!=e.instanceString&&e.instanceString()===this.instanceString()?e.toArray():e;for(var n=0;n<t.length;n++)this.add(t[n])}}return _createClass(ObjectSet,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(e){var t=this._obj;1!==t[e]&&(t[e]=1,this.size++)}},{key:"delete",value:function(e){var t=this._obj;1===t[e]&&(t[e]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(e){return 1===this._obj[e]}},{key:"toArray",value:function(){var e=this;return Object.keys(this._obj).filter(function(t){return e.has(t)})}}
1,{key:"forEach",value:function(e,t){return this.toArray().forEach(e,t)}}]),ObjectSet}(),et=("undefined"==typeof Set?"undefined":_typeof(Set))!=="undefined"?Set:ee,Element=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(void 0===e||void 0===t||!core(e)){error("An element must have a core reference and parameters set");return}var i=t.group;if(null==i&&(i=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"!==i&&"edges"!==i){error("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=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:i,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"===i:!!t.pannable,active:!1,classes:new et,animation:{current:[],queue:[]},rscratch:{},scratch:t.scratch||{},edges:[],children:[],parent:t.parent&&t.parent.isNode()?t.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(null==a.position.x&&(a.position.x=0),null==a.position.y&&(a.position.y=0),t.renderedPosition){var o=t.renderedPosition,s=e.pan(),l=e.zoom();a.position={x:(o.x-s.x)/l,y:(o.y-s.y)/l}}var u=[];array(t.classes)?u=t.classes:string(t.classes)&&(u=t.classes.split(/\s+/));for(var c=0,d=u.length;c<d;c++){var h=u[c];h&&""!==h&&a.classes.add(h)}this.createEmitter();var p=t.style||t.css;p&&(warn("Setting a `style` bypass at element creation should be done only when absolutely necessary.  Try to use the stylesheet instead."),this.style(p)),(void 0===n||n)&&this.restore()},defineSearch=function(e){return e={bfs:e.bfs||!e.dfs,dfs:e.dfs||!e.bfs},function(t,n,i){plainObject(t)&&!elementOrCollection(t)&&(t=(a=t).roots||a.root,n=a.visit,i=a.directed),i=2!=arguments.length||fn$6(n)?i:n,n=fn$6(n)?n:function(){};for(var a,o,s=this._private.cy,l=t=string(t)?this.filter(t):t,u=[],c=[],d={},h={},p={},g=0,v=this.byGroup(),y=v.nodes,b=v.edges,x=0;x<l.length;x++){var w=l[x],E=w.id();w.isNode()&&(u.unshift(w),e.bfs&&(p[E]=!0,c.push(w)),h[E]=0)}for(;0!==u.length;){var C=function(){var t=e.bfs?u.shift():u.pop(),a=t.id();if(e.dfs){if(p[a])return"continue";p[a]=!0,c.push(t)}var s=h[a],l=d[a],v=null!=l?l.source():null,x=null!=l?l.target():null,w=null==l?void 0:t.same(v)?x[0]:v[0],E=void 0;if(!0===(E=n(t,l,w,g++,s)))return o=t,"break";if(!1===E)return"break";for(var C=t.connectedEdges().filter(function(e){return(!i||e.source().same(t))&&b.has(e)}),S=0;S<C.length;S++){var P=C[S],k=P.connectedNodes().filter(function(e){return!e.same(t)&&y.has(e)}),D=k.id();0===k.length||p[D]||(k=k[0],u.push(k),e.bfs&&(p[D]=!0,c.push(k)),d[D]=P,h[D]=h[a]+1)}}();if("continue"!==C&&"break"===C)break}for(var S=s.collection(),P=0;P<c.length;P++){var k=c[P],D=d[k.id()];null!=D&&S.push(D),S.push(k)}return{path:s.collection(S),found:s.collection(o)}}},en={breadthFirstSearch:defineSearch({bfs:!0}),depthFirstSearch:defineSearch({dfs:!0})};en.bfs=en.breadthFirstSearch,en.dfs=en.depthFirstSearch;var er=defaults$g({root:null,weight:function(e){return 1},directed:!1}),ei=defaults$g({root:null,goal:null,weight:function(e){return 1},heuristic:function(e){return 0},directed:!1}),ea=defaults$g({weight:function(e){return 1},directed:!1}),eo=defaults$g({weight:function(e){return 1},directed:!1,root:null}),es=Math.sqrt(2),collapse=function(e,t,n){0===n.length&&error("Karger-Stein must be run on a connected (sub)graph");for(var i=n[e],a=i[1],o=i[2],s=t[a],l=t[o],u=n.length-1;u>=0;u--){var c=n[u],d=c[1],h=c[2];(t[d]===s&&t[h]===l||t[d]===l&&t[h]===s)&&n.splice(u,1)}for(var p=0;p<n.length;p++){var g=n[p];g[1]===l?(n[p]=g.slice(),n[p][1]=s):g[2]===l&&(n[p]=g.slice(),n[p][2]=s)}for(var v=0;v<t.length;v++)t[v]===l&&(t[v]=s);return n},contractUntil=function(e,t,n,i){for(;n>i;)t=collapse(Math.floor(Math.random()*t.length),e,t),n--;return t},modelToRenderedPosition=function(e,t,n){return{x:e.x*t+n.x,y:e.y*t+n.y}},renderedToModelPosition=function(e,t,n){return{x:(e.x-n.x)/t,y:(e.y-n.y)/t}},array2point=function(e){return{x:e[0],y:e[1]}},min=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,i=1/0,a=t;a<n;a++){var o=e[a];
1isFinite(o)&&(i=Math.min(o,i))}return i},max=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,i=-1/0,a=t;a<n;a++){var o=e[a];isFinite(o)&&(i=Math.max(o,i))}return i},mean=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,i=0,a=0,o=t;o<n;o++){var s=e[o];isFinite(s)&&(i+=s,a++)}return i/a},median=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=!(arguments.length>5)||void 0===arguments[5]||arguments[5];i?e=e.slice(t,n):(n<e.length&&e.splice(n,e.length-n),t>0&&e.splice(0,t));for(var s=0,l=e.length-1;l>=0;l--){var u=e[l];o?!isFinite(u)&&(e[l]=-1/0,s++):e.splice(l,1)}a&&e.sort(function(e,t){return e-t});var c=e.length,d=Math.floor(c/2);return c%2!=0?e[d+1+s]:(e[d-1+s]+e[d+s])/2},getAngleFromDisp=function(e,t){return Math.atan2(t,e)-Math.PI/2},el=Math.log2||function(e){return Math.log(e)/Math.log(2)},signum=function(e){return e>0?1:e<0?-1:0},dist=function(e,t){return Math.sqrt(sqdist(e,t))},sqdist=function(e,t){var n=t.x-e.x,i=t.y-e.y;return n*n+i*i},inPlaceSumNormalize=function(e){for(var t=e.length,n=0,i=0;i<t;i++)n+=e[i];for(var a=0;a<t;a++)e[a]=e[a]/n;return e},qbezierAt=function(e,t,n,i){return(1-i)*(1-i)*e+2*(1-i)*i*t+i*i*n},qbezierPtAt=function(e,t,n,i){return{x:qbezierAt(e.x,t.x,n.x,i),y:qbezierAt(e.y,t.y,n.y,i)}},lineAt=function(e,t,n,i){var a={x:t.x-e.x,y:t.y-e.y},o=dist(e,t),s={x:a.x/o,y:a.y/o};return n=null==n?0:n,i=null!=i?i:n*o,{x:e.x+s.x*i,y:e.y+s.y*i}},bound=function(e,t,n){return Math.max(e,Math.min(n,t))},makeBoundingBox=function(e){if(null==e)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(null!=e.x1&&null!=e.y1){if(null!=e.x2&&null!=e.y2&&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(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}}},clearBoundingBox=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},updateBoundingBox=function(e,t){e.x1=Math.min(e.x1,t.x1),e.x2=Math.max(e.x2,t.x2),e.w=e.x2-e.x1,e.y1=Math.min(e.y1,t.y1),e.y2=Math.max(e.y2,t.y2),e.h=e.y2-e.y1},expandBoundingBoxByPoint=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},expandBoundingBox=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},expandBoundingBoxSides=function(e){var t,n,i,a,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===o.length)t=n=i=a=o[0];else if(2===o.length)t=i=o[0],a=n=o[1];else if(4===o.length){var s=_slicedToArray(o,4);t=s[0],n=s[1],i=s[2],a=s[3]}return e.x1-=a,e.x2+=n,e.y1-=t,e.y2+=i,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},assignBoundingBox=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},boundingBoxesIntersect=function(e,t){return!(e.x1>t.x2)&&!(t.x1>e.x2)&&!(e.x2<t.x1)&&!(t.x2<e.x1)&&!(e.y2<t.y1)&&!(t.y2<e.y1)&&!(e.y1>t.y2)&&!(t.y1>e.y2)},inBoundingBox=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},boundingBoxInBoundingBox=function(e,t){return inBoundingBox(e,t.x1,t.y1)&&inBoundingBox(e,t.x2,t.y2)},roundRectangleIntersectLine=function(e,t,n,i,a,o,s){var l,u,c=getRoundRectangleRadius(a,o),d=a/2,h=o/2,p=n-d+c-s,g=i-h-s,v=n+d-c+s;if((l=finiteLinesIntersect(e,t,n,i,p,g,v,g,!1)).length>0)return l;var y=n+d+s,b=i-h+c-s,x=i+h-c+s;if((l=finiteLinesIntersect(e,t,n,i,y,b,y,x,!1)).length>0)return l;var w=n-d+c-s,E=i+h+s,C=n+d-c+s;if((l=finiteLinesIntersect(e,t,n,i,w,E,C,E,!1)).length>0)return l;var S=n-d-s,P=i-h+c-s,k=i+h-c+s;if((l=finiteLinesIntersect(e,t,n,i,S,P,S,k,!1)).length>0)return l;var D=n-d+c,T=i-h+c;if((u=intersectLineCircle(e,t,n,i,D,T,c+s)).length>0&&u[0]<=D&&u[1]<=T)return[u[0],u[1]];var B=n+d-c,A=i-h+c;
1if((u=intersectLineCircle(e,t,n,i,B,A,c+s)).length>0&&u[0]>=B&&u[1]<=A)return[u[0],u[1]];var I=n+d-c,M=i+h-c;if((u=intersectLineCircle(e,t,n,i,I,M,c+s)).length>0&&u[0]>=I&&u[1]>=M)return[u[0],u[1]];var _=n-d+c,L=i+h-c;return(u=intersectLineCircle(e,t,n,i,_,L,c+s)).length>0&&u[0]<=_&&u[1]>=L?[u[0],u[1]]:[]},inBezierVicinity=function(e,t,n,i,a,o,s,l,u){var c={x1:Math.min(n,s,a)-u,x2:Math.max(n,s,a)+u,y1:Math.min(i,l,o)-u,y2:Math.max(i,l,o)+u};return!(e<c.x1)&&!(e>c.x2)&&!(t<c.y1)&&!(t>c.y2)},solveQuadratic=function(e,t,n,i){var a=t*t-4*e*(n-=i);if(a<0)return[];var o=Math.sqrt(a),s=2*e;return[(-t+o)/s,(-t-o)/s]},solveCubic=function(e,t,n,i,a){var o,s,l,u,c,d,h,p;if(0===e&&(e=1e-5),t/=e,n/=e,i/=e,o=(s=(3*n-t*t)/9)*s*s+(l=(-(27*i)+t*(9*n-2*(t*t)))/54)*l,a[1]=0,h=t/3,o>0){c=(c=l+Math.sqrt(o))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),d=(d=l-Math.sqrt(o))<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+c+d,h+=(c+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+c)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,0===o){p=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*p,a[4]=a[2]=-(p+h);return}u=Math.acos(l/Math.sqrt(u=(s=-s)*s*s)),p=2*Math.sqrt(s),a[0]=-h+p*Math.cos(u/3),a[2]=-h+p*Math.cos((u+2*Math.PI)/3),a[4]=-h+p*Math.cos((u+4*Math.PI)/3)},sqdistToQuadraticBezier=function(e,t,n,i,a,o,s,l){var u,c=[];solveCubic(1*n*n-4*n*a+2*n*s+4*a*a-4*a*s+s*s+i*i-4*i*o+2*i*l+4*o*o-4*o*l+l*l,9*n*a-3*n*n-3*n*s-6*a*a+3*a*s+9*i*o-3*i*i-3*i*l-6*o*o+3*o*l,3*n*n-6*n*a+n*s-n*e+2*a*a+2*a*e-s*e+3*i*i-6*i*o+i*l-i*t+2*o*o+2*o*t-l*t,1*n*a-n*n+n*e-a*e+i*o-i*i+i*t-o*t,c);for(var d=[],h=0;h<6;h+=2)1e-7>Math.abs(c[h+1])&&c[h]>=0&&c[h]<=1&&d.push(c[h]);d.push(1),d.push(0);for(var p=-1,g=0;g<d.length;g++)u=Math.pow(Math.pow(1-d[g],2)*n+2*(1-d[g])*d[g]*a+d[g]*d[g]*s-e,2)+Math.pow(Math.pow(1-d[g],2)*i+2*(1-d[g])*d[g]*o+d[g]*d[g]*l-t,2),p>=0?u<p&&(p=u):p=u;return p},sqdistToFiniteLine=function(e,t,n,i,a,o){var s=[e-n,t-i],l=[a-n,o-i],u=l[0]*l[0]+l[1]*l[1],c=s[0]*s[0]+s[1]*s[1],d=s[0]*l[0]+s[1]*l[1],h=d*d/u;return d<0?c:h>u?(e-a)*(e-a)+(t-o)*(t-o):c-h},pointInsidePolygonPoints=function(e,t,n){for(var i,a,o,s,l=0,u=0;u<n.length/2;u++)if(i=n[2*u],a=n[2*u+1],u+1<n.length/2?(o=n[(u+1)*2],s=n[(u+1)*2+1]):(o=n[(u+1-n.length/2)*2],s=n[(u+1-n.length/2)*2+1]),i==e&&o==e);else{if((!(i>=e)||!(e>=o))&&(!(i<=e)||!(e<=o)))continue;(e-i)/(o-i)*(s-a)+a>t&&l++}return l%2!=0},pointInsidePolygon=function(e,t,n,i,a,o,s,l,u){var c,d=Array(n.length);null!=l[0]?(c=Math.atan(l[1]/l[0]),l[0]<0?c+=Math.PI/2:c=-c-Math.PI/2):c=l;for(var h=Math.cos(-c),p=Math.sin(-c),g=0;g<d.length/2;g++)d[2*g]=o/2*(n[2*g]*h-n[2*g+1]*p),d[2*g+1]=s/2*(n[2*g+1]*h+n[2*g]*p),d[2*g]+=i,d[2*g+1]+=a;return pointInsidePolygonPoints(e,t,u>0?joinLines(expandPolygon(d,-u)):d)},pointInsideRoundPolygon=function(e,t,n,i,a,o,s){for(var l=Array(n.length),u=o/2,c=s/2,d=getRoundPolygonRadius(o,s),h=d*d,p=0;p<n.length/4;p++){var g=void 0,v=void 0;g=0===p?n.length-2:4*p-2,v=4*p+2;var y=i+u*n[4*p],b=a+c*n[4*p+1],x=d/Math.tan(Math.acos(-n[g]*n[v]-n[g+1]*n[v
1+1])/2),w=y-x*n[g],E=b-x*n[g+1],C=y+x*n[v],S=b+x*n[v+1];l[4*p]=w,l[4*p+1]=E,l[4*p+2]=C,l[4*p+3]=S;var P=n[g+1],k=-n[g];if(P*n[v]+k*n[v+1]<0&&(P*=-1,k*=-1),Math.pow(w+P*d-e,2)+Math.pow(E+k*d-t,2)<=h)return!0}return pointInsidePolygonPoints(e,t,l)},joinLines=function(e){for(var t,n,i,a,o,s,l,u,c=Array(e.length/2),d=0;d<e.length/4;d++){t=e[4*d],n=e[4*d+1],i=e[4*d+2],a=e[4*d+3],d<e.length/4-1?(o=e[(d+1)*4],s=e[(d+1)*4+1],l=e[(d+1)*4+2],u=e[(d+1)*4+3]):(o=e[0],s=e[1],l=e[2],u=e[3]);var h=finiteLinesIntersect(t,n,i,a,o,s,l,u,!0);c[2*d]=h[0],c[2*d+1]=h[1]}return c},expandPolygon=function(e,t){for(var n,i,a,o,s=Array(2*e.length),l=0;l<e.length/2;l++){n=e[2*l],i=e[2*l+1],l<e.length/2-1?(a=e[(l+1)*2],o=e[(l+1)*2+1]):(a=e[0],o=e[1]);var u=o-i,c=-(a-n),d=Math.sqrt(u*u+c*c),h=u/d,p=c/d;s[4*l]=n+h*t,s[4*l+1]=i+p*t,s[4*l+2]=a+h*t,s[4*l+3]=o+p*t}return s},intersectLineEllipse=function(e,t,n,i,a,o){var s=n-e,l=i-t,u=Math.sqrt((s/=a)*s+(l/=o)*l),c=u-1;if(c<0)return[];var d=c/u;return[(n-e)*d+e,(i-t)*d+t]},checkInEllipse=function(e,t,n,i,a,o,s){return e-=a,t-=o,(e/=n/2+s)*e+(t/=i/2+s)*t<=1},intersectLineCircle=function(e,t,n,i,a,o,s){var l=[n-e,i-t],u=[e-a,t-o],c=l[0]*l[0]+l[1]*l[1],d=2*(u[0]*l[0]+u[1]*l[1]),h=d*d-4*c*(u[0]*u[0]+u[1]*u[1]-s*s);if(h<0)return[];var p=(-d+Math.sqrt(h))/(2*c),g=(-d-Math.sqrt(h))/(2*c),v=Math.min(p,g),y=Math.max(p,g),b=[];if(v>=0&&v<=1&&b.push(v),y>=0&&y<=1&&b.push(y),0===b.length)return[];var x=b[0]*l[0]+e,w=b[0]*l[1]+t;return b.length>1?b[0]==b[1]?[x,w]:[x,w,b[1]*l[0]+e,b[1]*l[1]+t]:[x,w]},midOfThree=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},finiteLinesIntersect=function(e,t,n,i,a,o,s,l,u){var c=e-a,d=n-e,h=s-a,p=t-o,g=i-t,v=l-o,y=h*p-v*c,b=d*p-g*c,x=v*d-h*g;if(0!==x){var w=y/x,E=b/x;return -.001<=w&&w<=1.001&&-.001<=E&&E<=1.001?[e+w*d,t+w*g]:u?[e+w*d,t+w*g]:[]}return 0!==y&&0!==b?[]:midOfThree(e,n,s)===s?[s,l]:midOfThree(e,n,a)===a?[a,o]:midOfThree(a,s,n)===n?[n,i]:[]},polygonIntersectLine=function(e,t,n,i,a,o,s,l){var u,c,d,h,p,g,v=[],y=Array(n.length),b=!0;if(null==o&&(b=!1),b){for(var x=0;x<y.length/2;x++)y[2*x]=n[2*x]*o+i,y[2*x+1]=n[2*x+1]*s+a;c=l>0?joinLines(expandPolygon(y,-l)):y}else c=n;for(var w=0;w<c.length/2;w++)d=c[2*w],h=c[2*w+1],w<c.length/2-1?(p=c[(w+1)*2],g=c[(w+1)*2+1]):(p=c[0],g=c[1]),0!==(u=finiteLinesIntersect(e,t,i,a,d,h,p,g)).length&&v.push(u[0],u[1]);return v},roundPolygonIntersectLine=function(e,t,n,i,a,o,s,l){for(var u,c=[],d=Array(n.length),h=o/2,p=s/2,g=getRoundPolygonRadius(o,s),v=0;v<n.length/4;v++){var y=void 0,b=void 0;y=0===v?n.length-2:4*v-2,b=4*v+2;var x=i+h*n[4*v],w=a+p*n[4*v+1],E=g/Math.tan(Math.acos(-n[y]*n[b]-n[y+1]*n[b+1])/2),C=x-E*n[y],S=w-E*n[y+1],P=x+E*n[b],k=w+E*n[b+1];0===v?(d[n.length-2]=C,d[n.length-1]=S):(d[4*v-2]=C,d[4*v-1]=S),d[4*v]=P,d[4*v+1]=k;var D=n[y+1],T=-n[y];D*n[b]+T*n[b+1]<0&&(D*=-1,T*=-1),0!==(u=intersectLineCircle(e,t,i,a,C+D*g,S+T*g,g)).length&&c.push(u[0],u[1])}for(var B=0;B<d.length/4;B++)0!==(u=finiteLinesIntersect(e,t,i,a,d[4*B],d[4*B+1],d[4*B+2],d[4*B+3],!1)).length&&c.push(u[0],u[1]);if(c.length>2){for(var A=[c[0],c[1]],I=Math.pow(A[0]-e,2)+Math.pow(A[1]-t,2),M=1;M<c.length/2;M++){var _=Math.pow(c[2*M]-e,2)+Math.pow(c[2*M+1]-t,2);_<=I&&(A[0]=c[2*M],A[1]=c[2*M+1],I=_)}return A}return c},shortenIntersection=function(e,t,n){var i=[e[0]-t[0],e[1]-t[1]],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=(a-n)/a;return o<0&&(o=1e-5),[t[0]+o*i[0],t[1]+o*i[1]]},generateUnitNgonPointsFitToSquare=function(e,t){return fitPolygonToSquare(generateUnitNgonPoints(e,t))},fitPolygonToSquare=function(e){for(var t,n,i=e.length/2,a=1/0,o=1/0,s=-1/0,l=-1/0,u=0;u<i;u++)t=e[2*u],n=e[2*u+1],a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,n),l=Math.max(l,n);for(var c=2/(s-a),d=2/(l-o),h=0;h<i;h++)t=e[2*h]=e[2*h]*c,n=e[2*h+1]=e[2*h+1]*d,a=Math.min(a,t),s=Math.max(s,t),o=Math.min(o,n),l=Math.max(l,n);if(o<-1)for(var p=0;p<i;p++)n=e[2*p+1]=e[2*p+1]+(-1-o);return e},generateUnitNgonPoints=function(e,t){var n,i=1/e*2*Math.PI,a=e%2==0?Math.PI/2+i/2:Math.PI/2;a+=t;for(var o=Array(2*e),s=0;s<e;s++)n=s*i+a,o[2*s]=Math.cos(n),o[2*s+1]=Math.sin(-n);return o},getRoundRectangleRadius=function(e,t){return Math.min(e/4,t/4,8)},getRoundPolygonRadius=function(e,t){return Math.min(e/10,t/10,8)},getCutRectangleCornerLength=function(){return 8},getBarrelCurveConstants=function(e,t){return{heightOffset:Math.min(15,.05*t),widthOffset:Math.min(100,.25*e),ctrlPtOffsetPct:.05}},eu=defaults$g({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(e){return 1}}),ec=defaults$g({root:null,weight:function(e){return 1},directed:!1,alpha:0}),ed={degreeCentralityNormalized:function(e){e=ec(e);var t=this.cy(),n=this.nodes(),i=n.length;if(e.directed){for(var a={},o={},s=0,l=0,u=0;u<i;u++){var c=n[u],d=c.id();e.root=c;var h=this.degreeCentrality(e);s<h.indegree&&(s=h.indegree),l<h.outdegree&&(l=h.outdegree),a[d]=h.indegree,o[d]=h.outdegree}return{indegree:function(e){return 0==s?0:(string(e)&&(e=t.filter(e)),a[e.id()]/s)},outdegree:function(e){return 0===l?0:(string(e)&&(e=t.filter(e)),o[e.id()]/l)}}}for(var p={},g=0,v=0;v<i;v++){var y=n[v];e.root=y;var b=this.degreeCentrality(e);g<b.degree&&(g=b.degree),p[y.id()]=b.degree}return{degree:function(e){return 0===g?0:(string(e)&&(e=t.filter(e)),p[e.id()]/g)}}},degreeCentrality:function(e){e=ec(e);var t=this.cy(),n=this,i=e,a=i.root,o=i.weight,s=i.directed,l=i.alpha;if(a=t.collection(a)[0],s){for(var u=a.connectedEdges(),c=u.filter(function(e){return e.target().same(a)&&n.has(e)}),d=u.filter(function(e){return e.source().same(a)&&n.has(e)}),h=c.length,p=d.length,g=0,v=0,y=0;y<c.length;y++)g+=o(c[y]);for(var b=0;b<d.length;b++)v+=o(d[b]);return{indegree:Math.pow(h,1-l)*Math.pow(g,l),outdegree:Math.pow(p,1-l)*Math.pow(v,l)}}for(var x=a.connectedEdges().intersection(n),w=x.length,E=0,C=0;C<x.length;C++)E+=o(x[C]);return{degree:Math.pow(w,1-l)*Math.pow(E,l)}}};ed.dc=ed.degreeCentrality,ed.dcn=ed.degreeCentralityNormalised=ed.degreeCentralityNormalized;var eh=defaults$g({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),ep={closenessCentralityNormalized:function(e){for(var t=eh(e),n=t.harmonic,i=t.weight,a=t.directed,o=this.cy(),s={},l=0,u=this.nodes(),c=this.floydWarshall({weight:i,directed:a}),d=0;d<u.length;d++){for(var h=0,p=u[d],g=0;g<u.length;g++)if(d!==g){var v=c.distance(p,u[g]);n?h+=1/v:h+=v}n||(h=1/h),l<h&&(l=h),s[p.id()]=h}return{closeness:function(e){return 0==l?0:s[e=string(e)?o.filter(e)[0].id():e.id()]/l}}},closenessCentrality:function(e){var t=eh(e),n=t.root,i=t.weight,a=t.directed,o=t.harmonic;n=this.filter(n)[0];for(var s=this.dijkstra({root:n,weight:i,directed:a}),l=0,u=this.nodes(),c=0;c<u.length;c++){var d=u[c];if(!d.same(n)){var h=s.distanceTo(d);o?l+=1/h:l+=h}}return o?l:1/l}};ep.cc=ep.closenessCentrality,ep.ccn=ep.closenessCentralityNormalised=ep.closenessCentralityNormalized;var eg=defaults$g({weight:null,directed:!1}),ef={betweennessCentrality:function(e){for(var t=eg(e),n=t.directed,i=t.weight,a=null!=i,o=this.cy(),s=this.nodes(),l={},u={},c=0,d={set:function(e,t){u[e]=t,t>c&&(c=t)},get:function(e){return u[e]}},h=0;h<s.length;h++){var p=s[h],g=p.id();n?l[g]=p.outgoers().nodes():l[g]=p.openNeighborhood().nodes(),d.set(g,0)}for(var v=0;v<s.length;v++)!function(e){for(var t=s[e].id(),n=[],u={},c={},h={},p=new S.default(function(e,t){return h[e]-h[t]}),g=0;g<s.length;g++){var v=s[g].id();u[v]=[],c[v]=0,h[v]=1/0}for(c[t]=1,h[t]=0,p.push(t);!p.empty();){var y=p.pop();if(n.push(y),a)for(var b=0;b<l[y].length;b++){var x=l[y][b],w=o.getElementById(y),E=i(w.edgesTo(x).length>0?w.edgesTo(x)[0]:x.edgesTo(w)[0]);h[x=x.id()]>h[y]+E&&(h[x]=h[y]+E,0>p.nodes.indexOf(x)?p.push(x):p.updateItem(x),c[x]=0,u[x]=[]),h[x]==h[y]+E&&(c[x]=c[x]+c[y],u[x].push(y))}else for(var C=0;C<l[y].length;C++){var P=l[y][C].id();h[P]==1/0&&(p.push(P),h[P]=h[y]+1),h[P]==h[y]+1&&(c[P]=c[P]+c[y],u[P].push(y))}}for(var k={},D=0;D<s.length;D++)k[s[D].id()]=0;for(;n.length>0;){for(var T=n.pop(),B=0;B<u[T].length;B++){var A=u[T][B];k[A]=k[A]+c[A]/c[T]*(1+k[T])}T!=s[e].id()&&d.set(T,d.get(T)+k[T])}}(v);var y={betweenness:function(e){var t=o.collection(e).id();return d.get(t)},betweennessNormalized:function(e){if(0==c)return 0;var t=o.collection(e).id();return d.get(t)/c}};return y.betweennessNormalised=y.betweennessNormalized,y}};ef.bc=ef.betweennessCentrality;var ev=defaults$g({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),getSimilarity$1=function(e,t){for(var n=0,i=0;i<t.length;i++)n+=t[i](e);return n},addLoops=function(e,t,n){for(var i=0;i<t;i++)e[i*t+i]=n},normalize=function(e,t){for(var n,i=0;i<t;i++){n=0;for(var a=0;a<t;a++)n+=e[a*t+i];for(var o=0;o<t;o++)e[o*t+i]=e[o*t+i]/n}
1},mmult=function(e,t,n){for(var i=Array(n*n),a=0;a<n;a++){for(var o=0;o<n;o++)i[a*n+o]=0;for(var s=0;s<n;s++)for(var l=0;l<n;l++)i[a*n+l]+=e[a*n+s]*t[s*n+l]}return i},expand=function(e,t,n){for(var i=e.slice(0),a=1;a<n;a++)e=mmult(e,i,t);return e},inflate=function(e,t,n){for(var i=Array(t*t),a=0;a<t*t;a++)i[a]=Math.pow(e[a],n);return normalize(i,t),i},hasConverged=function(e,t,n,i){for(var a=0;a<n;a++)if(Math.round(e[a]*Math.pow(10,i))/Math.pow(10,i)!=Math.round(t[a]*Math.pow(10,i))/Math.pow(10,i))return!1;return!0},assign$2=function(e,t,n,i){for(var a=[],o=0;o<t;o++){for(var s=[],l=0;l<t;l++)Math.round(1e3*e[o*t+l])/1e3>0&&s.push(n[l]);0!==s.length&&a.push(i.collection(s))}return a},isDuplicate=function(e,t){for(var n=0;n<e.length;n++)if(!t[n]||e[n].id()!==t[n].id())return!1;return!0},removeDuplicates=function(e){for(var t=0;t<e.length;t++)for(var n=0;n<e.length;n++)t!=n&&isDuplicate(e[t],e[n])&&e.splice(n,1);return e},markovClustering=function(e){for(var t=this.nodes(),n=this.edges(),i=this.cy(),a=ev(e),o={},s=0;s<t.length;s++)o[t[s].id()]=s;for(var l,u=t.length,c=u*u,d=Array(c),h=0;h<c;h++)d[h]=0;for(var p=0;p<n.length;p++){var g=n[p],v=o[g.source().id()],y=o[g.target().id()],b=getSimilarity$1(g,a.attributes);d[v*u+y]+=b,d[y*u+v]+=b}addLoops(d,u,a.multFactor),normalize(d,u);for(var x=!0,w=0;x&&w<a.maxIterations;)x=!1,hasConverged(d=inflate(l=expand(d,u,a.expandFactor),u,a.inflateFactor),l,c,4)||(x=!0),w++;return removeDuplicates(assign$2(d,u,t,i))},identity=function(e){return e},absDiff=function(e,t){return Math.abs(t-e)},addAbsDiff=function(e,t,n){return e+absDiff(t,n)},addSquaredDiff=function(e,t,n){return e+Math.pow(n-t,2)},sqrt=function(e){return Math.sqrt(e)},maxAbsDiff=function(e,t,n){return Math.max(e,absDiff(t,n))},getDistance=function(e,t,n,i,a){for(var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:identity,s=i,l=0;l<e;l++)s=a(s,t(l),n(l));return o(s)},ey={euclidean:function(e,t,n){return e>=2?getDistance(e,t,n,0,addSquaredDiff,sqrt):getDistance(e,t,n,0,addAbsDiff)},squaredEuclidean:function(e,t,n){return getDistance(e,t,n,0,addSquaredDiff)},manhattan:function(e,t,n){return getDistance(e,t,n,0,addAbsDiff)},max:function(e,t,n){return getDistance(e,t,n,-1/0,maxAbsDiff)}};function clusteringDistance(e,t,n,i,a,o){var s;return(s=fn$6(e)?e:ey[e]||ey.euclidean,0===t&&fn$6(e))?s(a,o):s(t,n,i,a,o)}ey["squared-euclidean"]=ey.squaredEuclidean,ey.squaredeuclidean=ey.squaredEuclidean;var em=defaults$g({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),setOptions$2=function(e){return em(e)},getDist=function(e,t,n,i,a){var o="kMedoids"!==a?function(e){return n[e]}:function(e){return i[e](n)};return clusteringDistance(e,i.length,o,function(e){return i[e](t)},n,t)},randomCentroids=function(e,t,n){for(var i=n.length,a=Array(i),o=Array(i),s=Array(t),l=null,u=0;u<i;u++)a[u]=e.min(n[u]).value,o[u]=e.max(n[u]).value;for(var c=0;c<t;c++){l=[];for(var d=0;d<i;d++)l[d]=Math.random()*(o[d]-a[d])+a[d];s[c]=l}return s},classify=function(e,t,n,i,a){for(var o=1/0,s=0,l=0;l<t.length;l++){var u=getDist(n,e,t[l],i,a);u<o&&(o=u,s=l)}return s},buildCluster=function(e,t,n){for(var i=[],a=null,o=0;o<t.length;o++)n[(a=t[o]).id()]===e&&i.push(a);return i},haveMatricesConverged=function(e,t,n){for(var i=0;i<e.length;i++)for(var a=0;a<e[i].length;a++)if(Math.abs(e[i][a]-t[i][a])>n)return!1;return!0},seenBefore=function(e,t,n){for(var i=0;i<n;i++)if(e===t[i])return!0;return!1},randomMedoids=function(e,t){var n=Array(t);if(e.length<50)for(var i=0;i<t;i++){for(var a=e[Math.floor(Math.random()*e.length)];seenBefore(a,n,i);)a=e[Math.floor(Math.random()*e.length)];n[i]=a}else for(var o=0;o<t;o++)n[o]=e[Math.floor(Math.random()*e.length)];return n},findCost=function(e,t,n){for(var i=0,a=0;a<t.length;a++)i+=getDist("manhattan",t[a],e,n,"kMedoids");return i},updateCentroids=function(e,t,n,i,a){for(var o,s,l=0;l<t.length;l++)for(var u=0;u<e.length;u++)i[l][u]=Math.pow(n[l][u],a.m);for(var c=0;c<e.length;c++)for(var d=0;d<a.attributes.length;d++){o=0,s=0;for(var h=0;h<t.length;h++)o+=i[h][c]*a.attributes[d](t[h]),s+=i[h][c];e[c][d]=o/s}},updateMembership=function(e,t,n,i,a){for(var o,s=0;s<e.length;s++)t[s]=e[s].slice();for(var l=2/(a.m-1),u=0;u<n.length;u++)for(var c=0;c<i.length;c++){o=0;for(var d=0;d<n.length;d++)o+=Math.pow(getDist(a.distance,i[c],n[u],a.attributes,"cmeans")/getDist(a.distance,i[c],n[d],a.attributes,"cmeans"),l);e[c][u]=1/o}},assign$1=function(e,t,n,i){for(var a,o,s=Array(n.k),l=0;l<s.length;l++)s[l]=[];for(var u=0;u<t.length;u++){a=-1/0,o=-1;for(var c=0;c<t[0].length;c++)t[u][c]>a&&(a=t[u][c],o=c);s[o].push(e[u])}for(var d=0;d<s.length;d++)s[d]=i.collection(s[d]);return s},fuzzyCMeans=function(e){var t,n,i,a,o=this.cy(),s=this.nodes(),l=setOptions$2(e);i=Array(s.length);for(var u=0;u<s.length;u++)i[u]=Array(l.k);n=Array(s.length);for(var c=0;c<s.length;c++)n[c]=Array(l.k);for(var d=0;d<s.length;d++){for(var h=0,p=0;p<l.k;p++)n[d][p]=Math.random(),h+=n[d][p];for(var g=0;g<l.k;g++)n[d][g]=n[d][g]/h}t=Array(l.k);for(var v=0;v<l.k;v++)t[v]=Array(l.attributes.length);a=Array(s.length);for(var y=0;y<s.length;y++)a[y]=Array(l.k);for(var b=!0,x=0;b&&x<l.maxIterations;)b=!1,updateCentroids(t,s,n,a,l),updateMembership(n,i,t,s,l),haveMatricesConverged(n,i,l.sensitivityThreshold)||(b=!0),x++;return{clusters:assign$1(s,n,l,o),degreeOfMembership:n}},eb=defaults$g({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),ex={single:"min",complete:"max"},setOptions$1=function(e){var t=eb(e),n=ex[t.linkage];return null!=n&&(t.linkage=n),t},mergeClosest=function(e,t,n,i,a){for(var o,s,l=0,u=1/0,c=a.attributes,getDist=function(e,t){return clusteringDistance(a.distance,c.length,function(t){return c[t](e)},function(e){return c[e](t)},e,t)},d=0;d<e.length;d++){var h=e[d].key,p=n[h][i[h]];p<u&&(l=h,u=p)}if("threshold"===a.mode&&u>=a.threshold||"dendrogram"===a.mode&&1===e.length)return!1;var g=t[l],v=t[i[l]];s="dendrogram"===a.mode?{left:g,right:v,key:g.key}:{value:g.value.concat(v.value),key:g.key}
1,e[g.index]=s,e.splice(v.index,1),t[g.key]=s;for(var y=0;y<e.length;y++){var b=e[y];g.key===b.key?o=1/0:"min"===a.linkage?(o=n[g.key][b.key],n[g.key][b.key]>n[v.key][b.key]&&(o=n[v.key][b.key])):"max"===a.linkage?(o=n[g.key][b.key],n[g.key][b.key]<n[v.key][b.key]&&(o=n[v.key][b.key])):o="mean"===a.linkage?(n[g.key][b.key]*g.size+n[v.key][b.key]*v.size)/(g.size+v.size):"dendrogram"===a.mode?getDist(b.value,g.value):getDist(b.value[0],g.value[0]),n[g.key][b.key]=n[b.key][g.key]=o}for(var x=0;x<e.length;x++){var w=e[x].key;if(i[w]===g.key||i[w]===v.key){for(var E=w,C=0;C<e.length;C++){var S=e[C].key;n[w][S]<n[w][E]&&(E=S)}i[w]=E}e[x].index=x}return g.key=v.key=g.index=v.index=null,!0},getAllChildren=function getAllChildren(e,t,n){e&&(e.value?t.push(e.value):(e.left&&getAllChildren(e.left,t),e.right&&getAllChildren(e.right,t)))},buildDendrogram=function buildDendrogram(e,t){if(!e)return"";if(e.left&&e.right){var n=buildDendrogram(e.left,t),i=buildDendrogram(e.right,t),a=t.add({group:"nodes",data:{id:n+","+i}});return t.add({group:"edges",data:{source:n,target:a.id()}}),t.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}if(e.value)return e.value.id()},buildClustersFromTree=function buildClustersFromTree(e,t,n){if(!e)return[];var i=[],a=[],o=[];return 0===t?(e.left&&getAllChildren(e.left,i),e.right&&getAllChildren(e.right,a),o=i.concat(a),[n.collection(o)]):1===t?e.value?[n.collection(e.value)]:(e.left&&getAllChildren(e.left,i),e.right&&getAllChildren(e.right,a),[n.collection(i),n.collection(a)]):e.value?[n.collection(e.value)]:(e.left&&(i=buildClustersFromTree(e.left,t-1,n)),e.right&&(a=buildClustersFromTree(e.right,t-1,n)),i.concat(a))},hierarchicalClustering=function(e){for(var t,n=this.cy(),i=this.nodes(),a=setOptions$1(e),o=a.attributes,getDist=function(e,t){return clusteringDistance(a.distance,o.length,function(t){return o[t](e)},function(e){return o[e](t)},e,t)},s=[],l=[],u=[],c=[],d=0;d<i.length;d++){var h={value:"dendrogram"===a.mode?i[d]:[i[d]],key:d,index:d};s[d]=h,c[d]=h,l[d]=[],u[d]=0}for(var p=0;p<s.length;p++)for(var g=0;g<=p;g++){var v=void 0;v="dendrogram"===a.mode?p===g?1/0:getDist(s[p].value,s[g].value):p===g?1/0:getDist(s[p].value[0],s[g].value[0]),l[p][g]=v,l[g][p]=v,v<l[p][u[p]]&&(u[p]=g)}for(var y=mergeClosest(s,c,l,u,a);y;)y=mergeClosest(s,c,l,u,a);return"dendrogram"===a.mode?(t=buildClustersFromTree(s[0],a.dendrogramDepth,n),a.addDendrogram&&buildDendrogram(s[0],n)):(t=Array(s.length),s.forEach(function(e,i){e.key=e.index=null,t[i]=n.collection(e.value)})),t},ew=defaults$g({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),setOptions=function(e){var t=e.damping,n=e.preference;.5<=t&&t<1||error("Damping must range on [0.5, 1).  Got: ".concat(t));var i=["median","mean","min","max"];return i.some(function(e){return e===n})||number$1(n)||error("Preference must be one of [".concat(i.map(function(e){return"'".concat(e,"'")}).join(", "),"] or a number.  Got: ").concat(n)),ew(e)},getSimilarity=function(e,t,n,i){var attr=function(e,t){return i[t](e)};return-clusteringDistance(e,i.length,function(e){return attr(t,e)},function(e){return attr(n,e)},t,n)},findExemplars=function(e,t,n){for(var i=[],a=0;a<e;a++)t[a*e+a]+n[a*e+a]>0&&i.push(a);return i},assignClusters=function(e,t,n){for(var i=[],a=0;a<e;a++){for(var o=-1,s=-1/0,l=0;l<n.length;l++){var u=n[l];t[a*e+u]>s&&(o=u,s=t[a*e+u])}o>0&&i.push(o)}for(var c=0;c<n.length;c++)i[n[c]]=n[c];return i},assign=function(e,t,n){for(var i=assignClusters(e,t,n),a=0;a<n.length;a++){for(var o=[],s=0;s<i.length;s++)i[s]===n[a]&&o.push(s);for(var l=-1,u=-1/0,c=0;c<o.length;c++){for(var d=0,h=0;h<o.length;h++)d+=t[o[h]*e+o[c]];d>u&&(l=c,u=d)}n[a]=o[l]}return assignClusters(e,t,n)},affinityPropagation=function(e){for(var t,n,i,a,o,s,l,u,c,d=this.cy(),h=this.nodes(),p=setOptions(e),g={},v=0;v<h.length;v++)g[h[v].id()]=v;o=Array(a=(i=h.length)*i);for(var y=0;y<a;y++)o[y]=-1/0;for(var b=0;b<i;b++)for(var x=0;x<i;x++)b!==x&&(o[b*i+x]=getSimilarity(p.distance,h[b],h[x],p.attributes));t=o,s="median"===(n=p.preference)?median(t):"mean"===n?mean(t):"min"===n?min(t):"max"===n?max(t):n;for(var w=0;w<i;w++)o[w*i+w]=s;l=Array(a);for(var E=0;E<a;E++)l[E]=0;u=Array(a);for(var C=0;C<a;C++)u[C]=0;for(var S=Array(i),P=Array(i),k=Array(i),D=0;D<i;D++)S[D]=0,P[D]=0,k[D]=0;for(var T=Array(i*p.minIterations),B=0;B<T.length;B++)T[B]=0;for(c=0;c<p.maxIterations;c++){for(var A=0;A<i;A++){for(var I=-1/0,M=-1/0,_=-1,L=0,O=0;O<i;O++)S[O]=l[A*i+O],(L=u[A*i+O]+o[A*i+O])>=I?(M=I,I=L,_=O):L>M&&(M=L);for(var N=0;N<i;
1N++)l[A*i+N]=(1-p.damping)*(o[A*i+N]-I)+p.damping*S[N];l[A*i+_]=(1-p.damping)*(o[A*i+_]-M)+p.damping*S[_]}for(var z=0;z<i;z++){for(var R=0,F=0;F<i;F++)S[F]=u[F*i+z],P[F]=Math.max(0,l[F*i+z]),R+=P[F];R-=P[z],P[z]=l[z*i+z],R+=P[z];for(var V=0;V<i;V++)u[V*i+z]=(1-p.damping)*Math.min(0,R-P[V])+p.damping*S[V];u[z*i+z]=(1-p.damping)*(R-P[z])+p.damping*S[z]}for(var q=0,j=0;j<i;j++){var $=u[j*i+j]+l[j*i+j]>0?1:0;T[c%p.minIterations*i+j]=$,q+=$}if(q>0&&(c>=p.minIterations-1||c==p.maxIterations-1)){for(var X=0,Y=0;Y<i;Y++){k[Y]=0;for(var H=0;H<p.minIterations;H++)k[Y]+=T[H*i+Y];(0===k[Y]||k[Y]===p.minIterations)&&X++}if(X===i)break}}for(var W=findExemplars(i,l,u),U=assign(i,o,W),G={},K=0;K<W.length;K++)G[W[K]]=[];for(var Q=0;Q<h.length;Q++){var Z=U[g[h[Q].id()]];null!=Z&&G[Z].push(h[Q])}for(var J=Array(W.length),ee=0;ee<W.length;ee++)J[ee]=d.collection(G[W[ee]]);return J},eE=defaults$g({root:void 0,directed:!1}),hopcroftTarjanBiconnected=function(){var e=this,t={},n=0,i=0,a=[],o=[],s={},buildComponent=function(n,i){for(var s=o.length-1,l=[],u=e.spawn();o[s].x!=n||o[s].y!=i;)l.push(o.pop().edge),s--;l.push(o.pop().edge),l.forEach(function(n){var i=n.connectedNodes().intersection(e);u.merge(n),i.forEach(function(n){var i=n.id(),a=n.connectedEdges().intersection(e);u.merge(n),t[i].cutVertex?u.merge(a.filter(function(e){return e.isLoop()})):u.merge(a)})}),a.push(u)},biconnectedSearch=function biconnectedSearch(l,u,c){l===c&&(i+=1),t[u]={id:n,low:n++,cutVertex:!1};var d,h,p,g,v=e.getElementById(u).connectedEdges().intersection(e);0===v.size()?a.push(e.spawn(e.getElementById(u))):v.forEach(function(e){d=e.source().id(),h=e.target().id(),(p=d===u?h:d)!==c&&(s[g=e.id()]||(s[g]=!0,o.push({x:u,y:p,edge:e})),p in t?t[u].low=Math.min(t[u].low,t[p].id):(biconnectedSearch(l,p,u),t[u].low=Math.min(t[u].low,t[p].low),t[u].id<=t[p].low&&(t[u].cutVertex=!0,buildComponent(u,p))))})};e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||(i=0,biconnectedSearch(n,n),t[n].cutVertex=i>1)}});var l=Object.keys(t).filter(function(e){return t[e].cutVertex}).map(function(t){return e.getElementById(t)});return{cut:e.spawn(l),components:a}},tarjanStronglyConnected=function(){var e=this,t={},n=0,i=[],a=[],o=e.spawn(e),stronglyConnectedSearch=function stronglyConnectedSearch(s){if(a.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||stronglyConnectedSearch(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))}),t[s].index===t[s].low){for(var l=e.spawn();;){var u=a.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),d=l.merge(c);i.push(d),o=o.difference(d)}};return e.forEach(function(e){if(e.isNode()){var n=e.id();n in t||stronglyConnectedSearch(n)}}),{cut:o,components:i}},eC={};[en,{dijkstra:function(e){if(!plainObject(e)){var t=arguments;e={root:t[0],weight:t[1],directed:t[2]}}var n=er(e),i=n.root,a=n.weight,o=n.directed,s=this,l=string(i)?this.filter(i)[0]:i[0],u={},c={},d={},h=this.byGroup(),p=h.nodes,g=h.edges;g.unmergeBy(function(e){return e.isLoop()});for(var getDist=function(e){return u[e.id()]},v=new S.default(function(e,t){return getDist(e)-getDist(t)}),y=0;y<p.length;y++){var b=p[y];u[b.id()]=b.same(l)?0:1/0,v.push(b)}for(;v.size()>0;){var x=v.pop(),w=getDist(x);if(d[x.id()]=w,w!==1/0)for(var E=x.neighborhood().intersect(p),C=0;C<E.length;C++){var P=E[C],k=P.id(),D=function(e,t){for(var n,i=(o?e.edgesTo(t):e.edgesWith(t)).intersect(g),s=1/0,l=0;l<i.length;l++){var u=i[l],c=a(u);(c<s||!n)&&(s=c,n=u)}return{edge:n,dist:s}}(x,P),T=w+D.dist;T<getDist(P)&&(u[P.id()]=T,v.updateItem(P),c[k]={node:x,edge:D.edge})}}return{distanceTo:function(e){return d[(string(e)?p.filter(e)[0]:e[0]).id()]},pathTo:function(e){var t=string(e)?p.filter(e)[0]:e[0],n=[],i=t,a=i.id();if(t.length>0)for(n.unshift(t);c[a];){var o=c[a];n.unshift(o.edge),n.unshift(o.node),a=(i=o.node).id()}return s.spawn(n)}}}},{kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,i=t.edges,a=n.length,o=Array(a),findSetIndex=function(e){for(var t=0;t<o.length;t++)if(o[t].has(e))return t},s=0;s<a;s++)o[s]=this.spawn(n[s]);for(var l=i.sort(function(t,n){return e(t)-e(n)}),u=0;u<l.length;u++){var c=l[u],d=c.source()[0],h=c.target()[0],p=findSetIndex(d),g=findSetIndex(h),v=o[p],y=o[g];p!==g&&(n.merge(c),v.merge(y),o.splice(g,1))}return n}},{aStar:function(e){var t,n,i=this.cy(),a=ei(e),o=a.root,s=a.goal,l=a.heuristic,u=a.directed,c=a.weight;o=i.collection(o)[0],s=i.collection(s)[0];var d=o.id(),h=s.id(),p={},g={},v={},y=new S.default(function(e,t){return g[e.id()]-g[t.id()]}),b=new et,x={},w={},addToOpenSet=function(e,t){y.push(e),b.add(t)};addToOpenSet(o,d),p[d]=0,g[d]=l(o);for(var E=0;y.size()>0;){if(n=(t=y.pop()).id(),b.delete(n),E++,n===h){for(var C=[],P=s,k=h,D=w[k];C.unshift(P),null!=D&&C.unshift(D),null!=(P=x[k]);)D=w[k=P.id()];return{found:!0,distance:p[n],path:this.spawn(C),steps:E}}v[n]=!0;for(var T=t._private.edges,B=0;B<T.length;B++){var A=T[B];if(this.hasElementWithId(A.id())&&(!u||A.data("source")===n)){var I=A.source(),M=A.target(),_=I.id()!==n?I:M,L=_.id();if(this.hasElementWithId(L)&&!v[L]){var O=p[n]+c(A);if(!b.has(L)){p[L]=O,g[L]=O+l(_),addToOpenSet(_,L),x[L]=t,w[L]=A;continue}O<p[L]&&(p[L]=O,g[L]=O+l(_),x[L]=t,w[L]=A)}}}}return{found:!1,distance:void 0,path:void 0,steps:E}}},{floydWarshall:function(e){for(var t=this.cy(),n=ea(e),i=n.weight,a=n.directed,o=this.byGroup(),s=o.nodes,l=o.edges,u=s.length,c=u*u,indexOf=function(e){return s.indexOf(e)},atIndex=function(e){return s[e]},d=Array(c),h=0;h<c;h++){var p=h%u;
1(h-p)/u===p?d[h]=0:d[h]=1/0}for(var g=Array(c),v=Array(c),y=0;y<l.length;y++){var b=l[y],x=b.source()[0],w=b.target()[0];if(x!==w){var E=indexOf(x),C=indexOf(w),S=E*u+C,P=i(b);if(d[S]>P&&(d[S]=P,g[S]=C,v[S]=b),!a){var k=C*u+E;!a&&d[k]>P&&(d[k]=P,g[k]=E,v[k]=b)}}}for(var D=0;D<u;D++)for(var T=0;T<u;T++)for(var B=T*u+D,A=0;A<u;A++){var I=T*u+A,M=D*u+A;d[B]+d[M]<d[I]&&(d[I]=d[B]+d[M],g[I]=g[B])}var indexOfArgEle=function(e){return indexOf((string(e)?t.filter(e):e)[0])};return{distance:function(e,t){return d[indexOfArgEle(e)*u+indexOfArgEle(t)]},path:function(e,n){var i,a=indexOfArgEle(e),o=indexOfArgEle(n),s=atIndex(a);if(a===o)return s.collection();if(null==g[a*u+o])return t.collection();var l=t.collection(),c=a;for(l.merge(s);a!==o;)c=a,a=g[a*u+o],i=v[c*u+a],l.merge(i),l.merge(atIndex(a));return l}}}},{bellmanFord:function(e){var t=this,n=eo(e),i=n.weight,a=n.directed,o=n.root,s=this,l=this.cy(),u=this.byGroup(),c=u.edges,d=u.nodes,h=d.length,p=new J,g=!1,v=[];o=l.collection(o)[0],c.unmergeBy(function(e){return e.isLoop()});for(var y=c.length,getInfo=function(e){var t=p.get(e.id());return t||(t={},p.set(e.id(),t)),t},getNodeFromTo=function(e){return(string(e)?l.$(e):e)[0]},b=0;b<h;b++){var x=d[b],w=getInfo(x);x.same(o)?w.dist=0:w.dist=1/0,w.pred=null,w.edge=null}for(var E=!1,checkForEdgeReplacement=function(e,t,n,i,a,o){var s=i.dist+o;s<a.dist&&!n.same(i.edge)&&(a.dist=s,a.pred=e,a.edge=n,E=!0)},C=1;C<h;C++){E=!1;for(var S=0;S<y;S++){var P=c[S],k=P.source(),D=P.target(),T=i(P),B=getInfo(k),A=getInfo(D);checkForEdgeReplacement(k,D,P,B,A,T),a||checkForEdgeReplacement(D,k,P,A,B,T)}if(!E)break}if(E)for(var I=[],M=0;M<y;M++){var _=c[M],L=_.source(),O=_.target(),N=i(_),z=getInfo(L).dist,R=getInfo(O).dist;if(z+N<R||!a&&R+N<z){if(g||(warn("Graph contains a negative weight cycle for Bellman-Ford"),g=!0),!1!==e.findNegativeWeightCycles){var F=[];z+N<R&&F.push(L),!a&&R+N<z&&F.push(O);for(var V=F.length,q=0;q<V;q++){var j=F[q],$=[j];$.push(getInfo(j).edge);for(var X=getInfo(j).pred;-1===$.indexOf(X);)$.push(X),$.push(getInfo(X).edge),X=getInfo(X).pred;for(var Y=($=$.slice($.indexOf(X)))[0].id(),H=0,W=2;W<$.length;W+=2)$[W].id()<Y&&(Y=$[W].id(),H=W);($=$.slice(H).concat($.slice(0,H))).push($[0]);var U=$.map(function(e){return e.id()}).join(",");-1===I.indexOf(U)&&(v.push(s.spawn($)),I.push(U))}}else break}}return{distanceTo:function(e){return getInfo(getNodeFromTo(e)).dist},pathTo:function(e){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o,i=getNodeFromTo(e),a=[],l=i;;){if(null==l)return t.spawn();var u=getInfo(l),c=u.edge,d=u.pred;if(a.unshift(l[0]),l.same(n)&&a.length>0)break;null!=c&&a.unshift(c),l=d}return s.spawn(a)},hasNegativeWeightCycle:g,negativeWeightCycles:v}}},{kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,i=t.edges;i.unmergeBy(function(e){return e.isLoop()});var a=n.length,o=i.length,s=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),l=Math.floor(a/es);if(a<2){error("At least 2 nodes are required for Karger-Stein algorithm");return}for(var u=[],c=0;c<o;c++){var d=i[c];u.push([c,n.indexOf(d.source()),n.indexOf(d.target())])}for(var h=1/0,p=[],g=Array(a),v=Array(a),y=Array(a),copyNodesMap=function(e,t){for(var n=0;n<a;n++)t[n]=e[n]},b=0;b<=s;b++){for(var x=0;x<a;x++)v[x]=x;var w=contractUntil(v,u.slice(),a,l),E=w.slice();copyNodesMap(v,y);var C=contractUntil(v,w,l,2),S=contractUntil(y,E,l,2);C.length<=S.length&&C.length<h?(h=C.length,p=C,copyNodesMap(v,g)):S.length<=C.length&&S.length<h&&(h=S.length,p=S,copyNodesMap(y,g))}for(var P=this.spawn(p.map(function(e){return i[e[0]]})),k=this.spawn(),D=this.spawn(),T=g[0],B=0;B<g.length;B++){var A=g[B],I=n[B];A===T?k.merge(I):D.merge(I)}var constructComponent=function(t){var n=e.spawn();return t.forEach(function(t){n.merge(t),t.connectedEdges().forEac
1h(function(t){e.contains(t)&&!P.contains(t)&&n.merge(t)})}),n};return{cut:P,components:[constructComponent(k),constructComponent(D)],partition1:k,partition2:D}}},{pageRank:function(e){for(var t,n=eu(e),i=n.dampingFactor,a=n.precision,o=n.iterations,s=n.weight,l=this._private.cy,u=this.byGroup(),c=u.nodes,d=u.edges,h=c.length,p=h*h,g=d.length,v=Array(p),y=Array(h),b=(1-i)/h,x=0;x<h;x++){for(var w=0;w<h;w++)v[x*h+w]=0;y[x]=0}for(var E=0;E<g;E++){var C=d[E],S=C.data("source"),P=C.data("target");if(S!==P){var k=c.indexOfId(S),D=c.indexOfId(P),T=s(C),B=D*h+k;v[B]+=T,y[k]+=T}}for(var A=1/h+b,I=0;I<h;I++)if(0===y[I])for(var M=0;M<h;M++)v[M*h+I]=A;else for(var _=0;_<h;_++){var L=_*h+I;v[L]=v[L]/y[I]+b}for(var O=Array(h),N=Array(h),z=0;z<h;z++)O[z]=1;for(var R=0;R<o;R++){for(var F=0;F<h;F++)N[F]=0;for(var V=0;V<h;V++)for(var q=0;q<h;q++){var j=V*h+q;N[V]+=v[j]*O[q]}inPlaceSumNormalize(N),t=O,O=N,N=t;for(var $=0,X=0;X<h;X++){var Y=t[X]-O[X];$+=Y*Y}if($<a)break}return{rank:function(e){return e=l.collection(e)[0],O[c.indexOf(e)]}}}},ed,ep,ef,{markovClustering:markovClustering,mcl:markovClustering},{kMeans:function(e){var t,n=this.cy(),i=this.nodes(),a=null,o=setOptions$2(e),s=Array(o.k),l={};o.testMode?"number"==typeof o.testCentroids?(o.testCentroids,t=randomCentroids(i,o.k,o.attributes)):t="object"===_typeof(o.testCentroids)?o.testCentroids:randomCentroids(i,o.k,o.attributes):t=randomCentroids(i,o.k,o.attributes);for(var u=!0,c=0;u&&c<o.maxIterations;){for(var d=0;d<i.length;
1d++)l[(a=i[d]).id()]=classify(a,t,o.distance,o.attributes,"kMeans");u=!1;for(var h=0;h<o.k;h++){var p=buildCluster(h,i,l);if(0!==p.length){for(var g=o.attributes.length,v=t[h],y=Array(g),b=Array(g),x=0;x<g;x++){b[x]=0;for(var w,E=0;E<p.length;E++)a=p[E],b[x]+=o.attributes[x](a);y[x]=b[x]/p.length,w=y[x],Math.abs(v[x]-w)<=o.sensitivityThreshold||(u=!0)}t[h]=y,s[h]=n.collection(p)}}c++}return s},kMedoids:function(e){var t,n,i=this.cy(),a=this.nodes(),o=null,s=setOptions$2(e),l=Array(s.k),u={},c=Array(s.k);s.testMode?"number"==typeof s.testCentroids||(t="object"===_typeof(s.testCentroids)?s.testCentroids:randomMedoids(a,s.k)):t=randomMedoids(a,s.k);for(var d=!0,h=0;d&&h<s.maxIterations;){for(var p=0;p<a.length;p++)u[(o=a[p]).id()]=classify(o,t,s.distance,s.attributes,"kMedoids");d=!1;for(var g=0;g<t.length;g++){var v=buildCluster(g,a,u);if(0!==v.length){c[g]=findCost(t[g],v,s.attributes);for(var y=0;y<v.length;y++)(n=findCost(v[y],v,s.attributes))<c[g]&&(c[g]=n,t[g]=v[y],d=!0);l[g]=i.collection(v)}}h++}return l},fuzzyCMeans:fuzzyCMeans,fcm:fuzzyCMeans},{hierarchicalClustering:hierarchicalClustering,hca:hierarchicalClustering},{affinityPropagation:affinityPropagation,ap:affinityPropagation},{hierholzer:function(e){if(!plainObject(e)){var t,n,i,a=arguments;e={root:a[0],directed:a[1]}}var o=eE(e),s=o.root,l=o.directed,u=!1;s&&(i=string(s)?this.filter(s)[0].id():s[0].id());var c={},d={};l?this.forEach(function(e){var i=e.id();if(e.isNode()){var a=e.indegree(!0),o=e.outdegree(!0),s=a-o,l=o-a;1==s?t?u=!0:t=i:1==l?n?u=!0:n=i:(l>1||s>1)&&(u=!0),c[i]=[],e.outgoers().forEach(function(e){e.isEdge()&&c[i].push(e.id())})}else d[i]=[void 0,e.target().id()]}):this.forEach(function(e){var i=e.id();e.isNode()?(e.degree(!0)%2&&(t?n?u=!0:n=i:t=i),c[i]=[],e.connectedEdges().forEac
1h(function(e){return c[i].push(e.id())})):d[i]=[e.source().id(),e.target().id()]});var h={found:!1,trail:void 0};if(u)return h;if(n&&t){if(l){if(i&&n!=i)return h;i=n}else{if(i&&n!=i&&t!=i)return h;i||(i=n)}}else i||(i=this[0].id());var walk=function(e){for(var t,n,i,a=e,o=[e];c[a].length;)n=d[t=c[a].shift()][0],a!=(i=d[t][1])?(c[i]=c[i].filter(function(e){return e!=t}),a=i):l||a==n||(c[n]=c[n].filter(function(e){return e!=t}),a=n),o.unshift(t),o.unshift(a);return o},p=[],g=[];for(g=walk(i);1!=g.length;)0==c[g[0]].length?(p.unshift(this.getElementById(g.shift())),p.unshift(this.getElementById(g.shift()))):g=walk(g.shift()).concat(g);for(var v in p.unshift(this.getElementById(g.shift())),c)if(c[v].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},{hopcroftTarjanBiconnected:hopcroftTarjanBiconnected,htbc:hopcroftTarjanBiconnected,htb:hopcroftTarjanBiconnected,hopcroftTarjanBiconnectedComponents:hopcroftTarjanBiconnected},{tarjanStronglyConnected:tarjanStronglyConnected,tsc:tarjanStronglyConnected,tscc:tarjanStronglyConnected,tarjanStronglyConnectedComponents:tarjanStronglyConnected}].forEach(function(e){j(eC,e)});var api=function api(e){if(!(this instanceof api))return new api(e);this.id="Thenable/1.0.7",this.state=0,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},"function"==typeof e&&e.call(this,this.fulfill.bind(this),this.reject.bind(this))};api.prototype={fulfill:function(e){return deliver(this,1,"fulfillValue",e)},reject:function(e){return deliver(this,2,"rejectReason",e)},then:function(e,t){var n=new api;return this.onFulfilled.push(resolver(e,n,"fulfill")),this.onRejected.push(resolver(t,n,"reject")),execute(this),n.proxy}};var deliver=function(e,t,n,i){return 0===e.state&&(e.state=t,e[n]=i,execute(e)),e},execute=function(e){1===e.state?execute_handlers(e,"onFulfilled",e.fulfillValue):2===e.state&&execute_handlers(e,"onRejected",e.rejectReason)},execute_handlers=function(e,t,n){if(0!==e[t].length){var i=e[t];e[t]=[];var func=function(){for(var e=0;e<i.length;e++)i[e](n)};"function"==typeof setImmediate?setImmediate(func):setTimeout(func,0)}},resolver=function(e,t,n){return function(i){if("function"!=typeof e)t[n].call(t,i);else{var a;try{a=e(i)}catch(e){t.reject(e);return}resolve(t,a)}}},resolve=function resolve(e,t){if(e===t||e.proxy===t){e.reject(TypeError("cannot resolve promise with itself"));return}if("object"===_typeof(t)&&null!==t||"function"==typeof t)try{n=t.then}catch(t){e.reject(t);return}if("function"==typeof n){var n,i=!1;try{n.call(t,function(n){i||(i=!0,n===t?e.reject(TypeError("circular thenable chain")):resolve(e,n))},function(t){i||(i=!0,e.reject(t))})}catch(t){i||e.reject(t)}return}e.fulfill(t)};api.all=function(e){return new api(function(t,n){for(var i=Array(e.length),a=0,fulfill=function(n,o){i[n]=o,++a===e.length&&t(i)},o=0;o<e.length;o++)!function(t){var i=e[t];null!=i&&null!=i.then?i.then(function(e){fulfill(t,e)},function(e){n(e)}):fulfill(t,i)}(o)})},api.resolve=function(e){return new api(function(t,n){t(e)})},api.reject=function(e){return new api(function(t,n){n(e)})};var eS="undefined"!=typeof Promise?Promise:api,Animation=function(e,t,n){var i=core(e),a=this._private=j({duration:1e3},t,n);if(a.target=e,a.style=a.style||a.css,a.started=!1,a.playing=!1,a.hooked=!1,a.applying=!1,a.progress=0,a.completes=[],a.frames=[],a.complete&&fn$6(a.complete)&&a.completes.push(a.complete),!i){var o=e.position();a.startPosition=a.startPosition||{x:o.x,y:o.y},a.startStyle=a.startStyle||e.cy().style().getAnimationStartStyle(e,a.style)}if(i){var s=e.pan();a.startPan={x:s.x,y:s.y},a.startZoom=e.zoom()}this.length=1,this[0]=this},eP=Animation.prototype;j(eP,{instanceString:function(){return"animation"},hook:function(){var e=this._private;if(!e.hooked){var t=e.target._private.animation;(e.queue?t.queue:t.current).push(this),elementOrCollection(e.target)&&e.target.cy().addToAnimationPool(e.target),e.hooked=!0}return this},play:function(){var e=this._private;return 1===e.progress&&(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 t=this._private;return void 0===e?t.progress*t.duration:this.progress(e/t.duration)},progress:function(e){var t=this._private,n=t.playing;return void 0===e?t.progress:(n&&this.pause(),t.progress=e,t.started=!1,n&&this.play(),this)},completed:function(){return 1===this._private.progress},reverse:function(){var e=this._private,t=e.playing;t&&this.pause(),e.progress=1-e.progress,e.started=!1;var swap=function(t,n){var i=e[t];null!=i&&(e[t]=e[n],e[n]=i)};if(swap("zoom","startZoom"),swap("pan","startPan"),swap("position","startPosition"),e.style)for(var n=0;n<e.style.length;n++){var i=e.style[n],a=i.name,o=e.startStyle[a];e.startStyle[a]=i,e.style[n]=o}return t&&this.play(),this},promise:function(e){var t,n=this._private;return t="frame"===e?n.frames:n.completes,new eS(function(e,n){t.push(function(){e()})})}}),eP.complete=eP.completed,eP.run=eP.play,eP.running=eP.playing;var ek={};[{animated:function(){return function(){var e=void 0!==this.length;if(!(this._private.cy||this).styleEnabled())return!1;
1var t=(e?this:[this])[0];if(t)return t._private.animation.current.length>0}},clearQueue:function(){return function(){var e=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;for(var t=0;t<e.length;t++)e[t]._private.animation.queue=[];return this}},delay:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animate({delay:e,duration:e,complete:t}):this}},delayAnimation:function(){return function(e,t){return(this._private.cy||this).styleEnabled()?this.animation({delay:e,duration:e,complete:t}):this}},animation:function(){return function(e,t){var n=void 0!==this.length,i=n?this:[this],a=this._private.cy||this,o=!n,s=!o;if(!a.styleEnabled())return this;var l=a.style();if(0===Object.keys(e=j({},e,t)).length)return new Animation(i[0],e);switch(void 0===e.duration&&(e.duration=400),e.duration){case"slow":e.duration=600;break;case"fast":e.duration=200}if(s&&(e.style=l.getPropsList(e.style||e.css),e.css=void 0),s&&null!=e.renderedPosition){var u=e.renderedPosition,c=a.pan(),d=a.zoom();e.position=renderedToModelPosition(u,d,c)}if(o&&null!=e.panBy){var h=e.panBy,p=a.pan();e.pan={x:p.x+h.x,y:p.y+h.y}}var g=e.center||e.centre;if(o&&null!=g){var v=a.getCenterPan(g.eles,e.zoom);null!=v&&(e.pan=v)}if(o&&null!=e.fit){var y=e.fit,b=a.getFitViewport(y.eles||y.boundingBox,y.padding);null!=b&&(e.pan=b.pan,e.zoom=b.zoom)}if(o&&plainObject(e.zoom)){var x=a.getZoomedViewport(e.zoom);null!=x?(x.zoomed&&(e.zoom=x.zoom),x.panned&&(e.pan=x.pan)):e.zoom=null}return new Animation(i[0],e)}},animate:function(){return function(e,t){var n=void 0!==this.length?this:[this];if(!(this._private.cy||this).styleEnabled())return this;t&&(e=j({},e,t));for(var i=0;i<n.length;i++){var a=n[i],o=a.animated()&&(void 0===e.queue||e.queue);a.animation(e,o?{queue:!0}:void 0).play()}return this}},stop:function(){return function(e,t){var n=void 0!==this.length?this:[this],i=this._private.cy||this;if(!i.styleEnabled())return this;for(var a=0;a<n.length;a++){for(var o=n[a]._private,s=o.animation.current,l=0;l<s.length;l++){var u=s[l]._private;t&&(u.duration=0)}e&&(o.animation.queue=[]),t||(o.animation.current=[])}return i.notify("draw"),this}}},{data:function(e){return e=j({},{field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var i,a=e,o=void 0!==this.length,s=o?this:[this],l=o?this[0]:this;if(string(t)){var u,c=-1!==t.indexOf(".")&&D.default(t);if(a.allowGetting&&void 0===n)return l&&(a.beforeGet(l),u=c&&void 0===l._private[a.field][t]?P.default(l._private[a.field],c):l._private[a.field][t]),u;if(a.allowSetting&&void 0!==n&&!a.immutableKeys[t]){var d=_defineProperty({},t,n);a.beforeSet(this,d);for(var h=0,p=s.length;h<p;h++){var g=s[h];a.canSet(g)&&(c&&void 0===l._private[a.field][t]?k.default(g._private[a.field],c,n):g._private[a.field][t]=n)}a.updateStyle&&this.updateStyle(),a.onSet(this),a.settingTriggersEvent&&this[a.triggerFnName](a.settingEvent)}}else if(a.allowSetting&&plainObject(t)){var v,y,b=Object.keys(t);a.beforeSet(this,t);for(var x=0;x<b.length;x++)if(y=t[v=b[x]],!a.immutableKeys[v])for(var w=0;w<s.length;w++){var E=s[w];a.canSet(E)&&(E._private[a.field][v]=y)}a.updateStyle&&this.updateStyle(),a.onSet(this),a.settingTriggersEvent&&this[a.triggerFnName](a.settingEvent)}else if(a.allowBinding&&fn$6(t))this.on(a.bindingEvent,t);else if(a.allowGetting&&void 0===t)return l&&(a.beforeGet(l),i=l._private[a.field]),i;return this}},removeData:function(e){return e=j({},{field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}},e),function(t){var n=e,i=void 0!==this.length?this:[this];if(string(t)){for(var a=t.split(/\s+/),o=a.length,s=0;s<o;s++){var l=a[s];if(!emptyString(l)&&!n.immutableKeys[l])for(var u=0,c=i.length;u<c;u++)i[u]._private[n.field][l]=void 0}n.triggerEvent&&this[n.triggerFnName](n.event)}else if(void 0===t){for(var d=0,h=i.length;d<h;d++)for(var p=i[d]._private[n.field],g=Object.keys(p),v=0;v<g.length;v++){var y=g[v];n.immutableKeys[y]||(p[y]=void 0)}n.triggerEvent&&this[n.triggerFnName](n.event)}return this}}},{eventAliasesOn:function(e){e.addListener=e.listen=e.bind=e.on,e.unlisten=e.unbind=e.off=e.removeListener,e.trigger=e.emit,e.pon=e.promiseOn=function(e,t){var n=this,i=Array.prototype.slice.call(arguments,0);return new eS(function(e,t){var a=i.concat([function(t){n.off.apply(n,o),e(t)}]),o=a.concat([]);n.on.apply(n,a)})}}}
1].forEach(function(e){j(ek,e)});var eD={animate:ek.animate(),animation:ek.animation(),animated:ek.animated(),clearQueue:ek.clearQueue(),delay:ek.delay(),delayAnimation:ek.delayAnimation(),stop:ek.stop()},eT={classes:function(e){if(void 0===e){var t=[];return this[0]._private.classes.forEach(function(e){return t.push(e)}),t}array(e)||(e=(e||"").match(/\S+/g)||[]);for(var n=[],i=new et(e),a=0;a<this.length;a++){for(var o=this[a],s=o._private,l=s.classes,u=!1,c=0;c<e.length;c++){var d=e[c];if(!l.has(d)){u=!0;break}}u||(u=l.size!==e.length),u&&(s.classes=i,n.push(o))}return n.length>0&&this.spawn(n).updateStyle().emit("class"),this},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){array(e)||(e=e.match(/\S+/g)||[]);for(var n=void 0===t,i=[],a=0,o=this.length;a<o;a++)for(var s=this[a],l=s._private.classes,u=!1,c=0;c<e.length;c++){var d=e[c],h=l.has(d),p=!1;t||n&&!h?(l.add(d),p=!0):(!t||n&&h)&&(l.delete(d),p=!0),!u&&p&&(i.push(s),u=!0)}return i.length>0&&this.spawn(i).updateStyle().emit("class"),this},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout(function(){n.removeClass(e)},t),n}};eT.className=eT.classNames=eT.classes;var eB={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'",number:z,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};eB.variable="(?:[\\w-.]|(?:\\\\"+eB.metaChar+"))+",eB.className="(?:[\\w-]|(?:\\\\"+eB.metaChar+"))+",eB.value=eB.string+"|"+eB.number,eB.id=eB.variable,function(){var e,t,n;for(n=0,e=eB.comparatorOp.split("|");n<e.length;n++)t=e[n],eB.comparatorOp+="|@"+t;for(n=0,e=eB.comparatorOp.split("|");n<e.length;n++)(t=e[n]).indexOf("!")>=0||"="===t||(eB.comparatorOp+="|\\!"+t)}();var newQuery=function(){return{checks:[]}},eA={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},eI=[{selector:":selected",matches:function(e){return e.selected()}},{selector:":unselected",matches:function(e){return!e.selected()}},{selector:":selectable",matches:function(e){return e.selectable()}},{selector:":unselectable",matches:function(e){return!e.selectable()}},{selector:":locked",matches:function(e){return e.locked()}},{selector:":unlocked",matches:function(e){return!e.locked()}},{selector:":visible",matches:function(e){return e.visible()}},{selector:":hidden",matches:function(e){return!e.visible()}},{selector:":transparent",matches:function(e){return e.transparent()}},{selector:":grabbed",matches:function(e){return e.grabbed()}},{selector:":free",matches:function(e){return!e.grabbed()}},{selector:":removed",matches:function(e){return e.removed()}},{selector:":inside",matches:function(e){return!e.removed()}},{selector:":grabbable",matches:function(e){return e.grabbable()}},{selector:":ungrabbable",matches:function(e){return!e.grabbable()}},{selector:":animated",matches:function(e){return e.animated()}},{selector:":unanimated",matches:function(e){return!e.animated()}},{selector:":parent",matches:function(e){return e.isParent()}},{selector:":childless",matches:function(e){return e.isChildless()}},{selector:":child",matches:function(e){return e.isChild()}},{selector:":orphan",matches:function(e){return e.isOrphan()}},{selector:":nonorphan",matches:function(e){return e.isChild()}},{selector:":compound",matches:function(e){return e.isNode()?e.isParent():e.source().isParent()||e.target().isParent()}},{selector:":loop",matches:function(e){return e.isLoop()}},{selector:":simple",matches:function(e){return e.isSimple()}},{selector:":active",matches:function(e){return e.active()}},{selector:":inactive",matches:function(e){return!e.active()}},{selector:":backgrounding",matches:function(e){return e.backgrounding()}},{selector:":nonbackgrounding",matches:function(e){return!e.backgrounding()}}].sort(function(e,t){return -1*ascending(e.selector,t.selector)}),eM=function(){for(var e,t={},n=0;n<eI.length;n++)t[(e=eI[n]).selector]=e.matches;return t}(),e_="("+eI.map(function(e){return e.selector}).join("|")+")",cleanMetaChars=function(e){return e.replace(RegExp("\\\\("+eB.metaChar+")","g"),function(e,t){return t})},replaceLastQuery=function(e,t,n){e[e.length-1]=n},eL=[{name:"group",query:!0,regex:"("+eB.group+")",populate:function(e,t,n){var i=_slicedToArray(n,1)[
10];t.checks.push({type:eA.GROUP,value:"*"===i?i:i+"s"})}},{name:"state",query:!0,regex:e_,populate:function(e,t,n){var i=_slicedToArray(n,1)[0];t.checks.push({type:eA.STATE,value:i})}},{name:"id",query:!0,regex:"\\#("+eB.id+")",populate:function(e,t,n){var i=_slicedToArray(n,1)[0];t.checks.push({type:eA.ID,value:cleanMetaChars(i)})}},{name:"className",query:!0,regex:"\\.("+eB.className+")",populate:function(e,t,n){var i=_slicedToArray(n,1)[0];t.checks.push({type:eA.CLASS,value:cleanMetaChars(i)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+eB.variable+")\\s*\\]",populate:function(e,t,n){var i=_slicedToArray(n,1)[0];t.checks.push({type:eA.DATA_EXIST,field:cleanMetaChars(i)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+eB.variable+")\\s*("+eB.comparatorOp+")\\s*("+eB.value+")\\s*\\]",populate:function(e,t,n){var i=_slicedToArray(n,3),a=i[0],o=i[1],s=i[2];s=null!=RegExp("^"+eB.string+"$").exec(s)?s.substring(1,s.length-1):parseFloat(s),t.checks.push({type:eA.DATA_COMPARE,field:cleanMetaChars(a),operator:o,value:s})}}
1,{name:"dataBool",query:!0,regex:"\\[\\s*("+eB.boolOp+")\\s*("+eB.variable+")\\s*\\]",populate:function(e,t,n){var i=_slicedToArray(n,2),a=i[0],o=i[1];t.checks.push({type:eA.DATA_BOOL,field:cleanMetaChars(o),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+eB.meta+")\\s*("+eB.comparatorOp+")\\s*("+eB.number+")\\s*\\]\\]",populate:function(e,t,n){var i=_slicedToArray(n,3),a=i[0],o=i[1],s=i[2];t.checks.push({type:eA.META_COMPARE,field:cleanMetaChars(a),operator:o,value:parseFloat(s)})}},{name:"nextQuery",separator:!0,regex:eB.separator,populate:function(e,t){var n=e.currentSubject,i=e.edgeCount,a=e.compoundCount,o=e[e.length-1];return null!=n&&(o.subject=n,e.currentSubject=null),o.edgeCount=i,o.compoundCount=a,e.edgeCount=0,e.compoundCount=0,e[e.length++]=newQuery()}},{name:"directedEdge",separator:!0,regex:eB.directedEdge,populate:function(e,t){if(null==e.currentSubject){var n=newQuery(),i=newQuery();return n.checks.push({type:eA.DIRECTED_EDGE,source:t,target:i}),replaceLastQuery(e,t,n),e.edgeCount++,i}var a=newQuery(),o=newQuery();return a.checks.push({type:eA.NODE_SOURCE,source:t,target:o}),replaceLastQuery(e,t,a),e.edgeCount++,o}},{name:"undirectedEdge",separator:!0,regex:eB.undirectedEdge,populate:function(e,t){if(null==e.currentSubject){var n=newQuery(),i=newQuery();return n.checks.push({type:eA.UNDIRECTED_EDGE,nodes:[t,i]}),replaceLastQuery(e,t,n),e.edgeCount++,i}var a=newQuery(),o=newQuery();return a.checks.push({type:eA.NODE_NEIGHBOR,node:t,neighbor:o}),replaceLastQuery(e,t,a),o}},{name:"child",separator:!0,regex:eB.child,populate:function(e,t){if(null==e.currentSubject){var n=newQuery(),i=newQuery(),a=e[e.length-1];return n.checks.push({type:eA.CHILD,parent:a,child:i}),replaceLastQuery(e,t,n),e.compoundCount++,i}if(e.currentSubject===t){var o=newQuery(),s=e[e.length-1],l=newQuery(),u=newQuery(),c=newQuery(),d=newQuery();return o.checks.push({type:eA.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:eA.TRUE}],d.checks.push({type:eA.TRUE}),l.checks.push({type:eA.PARENT,parent:d,child:c}),replaceLastQuery(e,s,o),e.currentSubject=u,e.compoundCount++,c}var h=newQuery(),p=newQuery(),g=[{type:eA.PARENT,parent:h,child:p}];return h.checks=t.checks,t.checks=g,e.compoundCount++,p}},{name:"descendant",separator:!0,regex:eB.descendant,populate:function(e,t){if(null==e.currentSubject){var n=newQuery(),i=newQuery(),a=e[e.length-1];return n.checks.push({type:eA.DESCENDANT,ancestor:a,descendant:i}),replaceLastQuery(e,t,n),e.compoundCount++,i}if(e.currentSubject===t){var o=newQuery(),s=e[e.length-1],l=newQuery(),u=newQuery(),c=newQuery(),d=newQuery();return o.checks.push({type:eA.COMPOUND_SPLIT,left:s,right:l,subject:u}),u.checks=t.checks,t.checks=[{type:eA.TRUE}],d.checks.push({type:eA.TRUE}),l.checks.push({type:eA.ANCESTOR,ancestor:d,descendant:c}),replaceLastQuery(e,s,o),e.currentSubject=u,e.compoundCount++,c}var h=newQuery(),p=newQuery(),g=[{type:eA.ANCESTOR,ancestor:h,descendant:p}];return h.checks=t.checks,t.checks=g,e.compoundCount++,p}},{name:"subject",modifier:!0,regex:eB.subject,populate:function(e,t){if(null!=e.currentSubject&&e.currentSubject!==t)return warn("Redefinition of subject in selector `"+e.toString()+"`"),!1;e.currentSubject=t;var n=e[e.length-1].checks[0],i=null==n?null:n.type;i===eA.DIRECTED_EDGE?n.type=eA.NODE_TARGET:i===eA.UNDIRECTED_EDGE&&(n.type=eA.NODE_NEIGHBOR,n.node=n.nodes[1],n.neighbor=n.nodes[0],n.nodes=null)}}];eL.forEach(function(e){return e.regexObj=RegExp("^"+e.regex)});var consumeExpr=function(e){for(var t,n,i,a=0;a<eL.length;a++){var o=eL[a],s=o.name,l=e.match(o.regexObj);if(null!=l){n=l,t=o,i=s;var u=l[0];e=e.substring(u.length);break}}return{expr:t,match:n,name:i,remaining:e}},consumeWhitespace=function(e){var t=e.match(/^\s+/);if(t){var n=t[0];e=e.substring(n.length)}return e},valCmp=function(e,t,n){var i,a,o,s=string(e),l=number$1(e),u=string(n),c=!1,d=!1,h=!1;switch(t.indexOf("!")>=0&&(t=t.replace("!",""),d=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),c=!0),(s||u||c)&&(a=s||l?""+e:"",o=""+n),c&&(e=a=a.toLowerCase(),n=o=o.toLowerCase()),t){case"*=":i=a.indexOf(o)>=0;break;case"$=":i=a.indexOf(o,a.length-o.length)>=0;break;case"^=":i=0===a.indexOf(o);break;case"=":i=e===n;break;case">":h=!0,i=e>n;break;case">=":h=!0,i=e>=n;break;case"<":h=!0,i=e<n;break;case"<=":h=!0,i=e<=n;break;default:i=!1}return d&&(null!=e||!h)&&(i=!i),i},boolCmp=function(e,t){switch(t){case"?":return!!e;case"!":return!e;case"^":return void 0===e}},data$1=function(e,t){return e.data(t)},eO=[],matches$1=function(e,t){return e.checks.every(function(e){return eO[e.type](e,t)})};eO[eA.GROUP]=function(e,t){var n=e.value;return"*"===n||n===t.group()},eO[eA.STATE]=function(e,t){return eM[e.value](t)},eO[eA.ID]=function(e,t){var n=e.value;return t.id()===n},eO[eA.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},eO[eA.META_COMPARE]=function(e,t){var n=e.field,i=e.operator,a=e.value;return valCmp(t[n](),i,a)},eO[eA.DATA_COMPARE]=function(e,t){var n=e.field,i=e.operator,a=e.value;return valCmp(data$1(t,n),i,a)},eO[eA.DATA_BOOL]=function(e,t){var n=e.field,i=e.operator;return boolCmp(data$1(t,n),i)},eO[eA.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,void 0!==data$1(t,n)},eO[eA.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],i=e.nodes[1],a=t.source(),o=t.target();return matches$1(n,a)&&matches$1(i,o)||matches$1(i,a)&&matches$1(n,o)},eO[eA.NODE_NEIGHBOR]=function(e,t){return matches$1(e.node,t)&&t.neighborhood().some(function(t){return t.isNode()&&matches$1(e.neighbor,t)})}
1,eO[eA.DIRECTED_EDGE]=function(e,t){return matches$1(e.source,t.source())&&matches$1(e.target,t.target())},eO[eA.NODE_SOURCE]=function(e,t){return matches$1(e.source,t)&&t.outgoers().some(function(t){return t.isNode()&&matches$1(e.target,t)})},eO[eA.NODE_TARGET]=function(e,t){return matches$1(e.target,t)&&t.incomers().some(function(t){return t.isNode()&&matches$1(e.source,t)})},eO[eA.CHILD]=function(e,t){return matches$1(e.child,t)&&matches$1(e.parent,t.parent())},eO[eA.PARENT]=function(e,t){return matches$1(e.parent,t)&&t.children().some(function(t){return matches$1(e.child,t)})},eO[eA.DESCENDANT]=function(e,t){return matches$1(e.descendant,t)&&t.ancestors().some(function(t){return matches$1(e.ancestor,t)})},eO[eA.ANCESTOR]=function(e,t){return matches$1(e.ancestor,t)&&t.descendants().some(function(t){return matches$1(e.descendant,t)})},eO[eA.COMPOUND_SPLIT]=function(e,t){return matches$1(e.subject,t)&&matches$1(e.left,t)&&matches$1(e.right,t)},eO[eA.TRUE]=function(){return!0},eO[eA.COLLECTION]=function(e,t){return e.value.has(t)},eO[eA.FILTER]=function(e,t){return(0,e.value)(t)};var Selector=function(e){this.inputText=e,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,null==e||string(e)&&e.match(/^\s*$/)||(elementOrCollection(e)?this.addQuery({checks:[{type:eA.COLLECTION,value:e.collection()}]}):fn$6(e)?this.addQuery({checks:[{type:eA.FILTER,value:e}]}):string(e)?this.parse(e)||(this.invalid=!0):error("A selector must be created from a string; found "))},eN=Selector.prototype;[{parse:function(e){var t=this.inputText=e,n=this[0]=newQuery();for(this.length=1,t=consumeWhitespace(t);;){var i=consumeExpr(t);if(null==i.expr)return warn("The selector `"+e+"`is invalid"),!1;var a=i.match.slice(1),o=i.expr.populate(this,n,a);if(!1===o)return!1;if(null!=o&&(n=o),(t=i.remaining).match(/^\s*$/))break}var s=this[this.length-1];null!=this.currentSubject&&(s.subject=this.currentSubject),s.edgeCount=this.edgeCount,s.compoundCount=this.compoundCount;for(var l=0;l<this.length;l++){var u=this[l];if(u.compoundCount>0&&u.edgeCount>0)return warn("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return warn("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&warn("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 clean=function(e){return null==e?"":e},cleanVal=function(e){return string(e)?'"'+e+'"':clean(e)},space=function(e){return" "+e+" "},checkToString=function(e,t){var n=e.type,i=e.value;switch(n){case eA.GROUP:var a=clean(i);return a.substring(0,a.length-1);case eA.DATA_COMPARE:return"["+e.field+space(clean(e.operator))+cleanVal(i)+"]";case eA.DATA_BOOL:var o=e.operator,s=e.field;return"["+clean(o)+s+"]";case eA.DATA_EXIST:return"["+e.field+"]";case eA.META_COMPARE:var l=e.operator;return"[["+e.field+space(clean(l))+cleanVal(i)+"]]";case eA.STATE:return i;case eA.ID:return"#"+i;case eA.CLASS:return"."+i;case eA.PARENT:case eA.CHILD:return queryToString(e.parent,t)+space(">")+queryToString(e.child,t);case eA.ANCESTOR:case eA.DESCENDANT:return queryToString(e.ancestor,t)+" "+queryToString(e.descendant,t);case eA.COMPOUND_SPLIT:var u=queryToString(e.left,t),c=queryToString(e.subject,t),d=queryToString(e.right,t);return u+(u.length>0?" ":"")+c+d;case eA.TRUE:return""}},queryToString=function(e,t){return e.checks.reduce(function(n,i,a){return n+(t===e&&0===a?"$":"")+checkToString(i,t)},"")},e="",t=0;t<this.length;t++){var n=this[t];e+=queryToString(n,n.subject),this.length>1&&t<this.length-1&&(e+=", ")}return this.toStringCache=e,e}},{matches:function(e){for(var t=0;t<this.length;t++)if(matches$1(this[t],e))return!0;return!1},filter:function(e){var t=this;if(1===t.length&&1===t[0].checks.length&&t[0].checks[0].type===eA.ID)return e.getElementById(t[0].checks[0].value).collection();var selectorFunction=function(e){for(var n=0;n<t.length;n++)if(matches$1(t[n],e))return!0;return!1};return null==t.text()&&(selectorFunction=function(){return!0}),e.filter(selectorFunction)}}
1].forEach(function(e){return j(eN,e)}),eN.text=function(){return this.inputText},eN.size=function(){return this.length},eN.eq=function(e){return this[e]},eN.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},eN.addQuery=function(e){this[this.length++]=e},eN.selector=eN.toString;var ez={allAre:function(e){var t=new Selector(e);return this.every(function(e){return t.matches(e)})},is:function(e){var t=new Selector(e);return this.some(function(e){return t.matches(e)})},some:function(e,t){for(var n=0;n<this.length;n++)if(t?e.apply(t,[this[n],n,this]):e(this[n],n,this))return!0;return!1},every:function(e,t){for(var n=0;n<this.length;n++)if(!(t?e.apply(t,[this[n],n,this]):e(this[n],n,this)))return!1;return!0},same:function(e){if(this===e)return!0;e=this.cy().collection(e);var t=this.length;return t===e.length&&(1===t?this[0]===e[0]:this.every(function(t){return e.hasElementWithId(t.id())}))},anySame:function(e){return e=this.cy().collection(e),this.some(function(t){return e.hasElementWithId(t.id())})},allAreNeighbors:function(e){e=this.cy().collection(e);var t=this.neighborhood();return e.every(function(e){return t.hasElementWithId(e.id())})},contains:function(e){e=this.cy().collection(e);var t=this;return e.every(function(e){return t.hasElementWithId(e.id())})}};ez.allAreNeighbours=ez.allAreNeighbors,ez.has=ez.contains,ez.equal=ez.equals=ez.same;var cache=function(e,t){return function(n,i,a,o){if(null==n?s="":elementOrCollection(n)&&1===n.length&&(s=n.id()),1!==this.length||!s)return e.call(this,n,i,a,o);var s,l=this[0]._private,u=l.traversalCache=l.traversalCache||{},c=u[t]=u[t]||[],d=hashString(s);return c[d]||(c[d]=e.call(this,n,i,a,o))}},eR={parent:function(e){var t=[];if(1===this.length){var n=this[0]._private.parent;if(n)return n}for(var i=0;i<this.length;i++){var a=this[i]._private.parent;a&&t.push(a)}return this.spawn(t,!0).filter(e)},parents:function(e){for(var t=[],n=this.parent();n.nonempty();){for(var i=0;i<n.length;i++){var a=n[i];t.push(a)}n=n.parent()}return this.spawn(t,!0).filter(e)},commonAncestors:function(e){for(var t,n=0;n<this.length;n++){var i=this[n].parents();t=(t=t||i).intersect(i)}return t.filter(e)},orphans:function(e){return this.stdFilter(function(e){return e.isOrphan()}).filter(e)},nonorphans:function(e){return this.stdFilter(function(e){return e.isChild()}).filter(e)},children:cache(function(e){for(var t=[],n=0;n<this.length;n++)for(var i=this[n]._private.children,a=0;a<i.length;a++)t.push(i[a]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(e){return this.parent().children().not(this).filter(e)},isParent:function(){var e=this[0];if(e)return e.isNode()&&0!==e._private.children.length},isChildless:function(){var e=this[0];if(e)return e.isNode()&&0===e._private.children.length},isChild:function(){var e=this[0];if(e)return e.isNode()&&null!=e._private.parent},isOrphan:function(){var e=this[0];if(e)return e.isNode()&&null==e._private.parent},descendants:function(e){var t=[];return!function add(e){for(var n=0;n<e.length;n++){var i=e[n];t.push(i),i.children().nonempty()&&add(i.children())}}(this.children()),this.spawn(t,!0).filter(e)}};function forEachCompound(e,t,n,i){for(var a=[],o=new et,s=e.cy().hasCompoundNodes(),l=0;l<e.length;l++){var u=e[l];n?a.push(u):s&&i(a,o,u)}for(;a.length>0;){var c=a.shift();t(c),o.add(c.id()),s&&i(a,o,c)}return e}function addChildren(e,t,n){if(n.isParent())for(var i=n._private.children,a=0;a<i.length;a++){var o=i[a];t.has(o.id())||e.push(o)}}function addParent(e,t,n){if(n.isChild()){var i=n._private.parent;t.has(i.id())||e.push(i)}}function addParentAndChildren(e,t,n){addParent(e,t,n),addChildren(e,t,n)}eR.forEachDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return forEachCompound(this,e,t,addChildren)},eR.forEachUp=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return forEachCompound(this,e,t,addParent)},eR.forEachUpAndDown=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return forEachCompound(this,e,t,addParentAndChildren)},eR.ancestors=eR.parents,(a=o={data:ek.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:ek.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:ek.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ek.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:ek.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:ek.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=a.data,a.removeAttr=a.removeData;var eF={};function defineDegreeFunction(e){return function(t){if(void 0===t&&(t=!0),0!==this.length&&!(!this.isNode()||this.removed())){for(var n=0,i=this[0],a=i._private.edges,o=0;o<a.length;o++){var s=a[o];!t&&s.isLoop()||(n+=e(i,s))}return n}}}function defineDegreeBoundsFunction(e,t){return function(n){for(var i,a=this.nodes(),o=0;o<a.length;o++){var s=a[o][e](n);void 0!==s&&(void 0===i||t(s,i))&&(i=s)}return i}}j(eF,{degree:defineDegreeFunction(function(e,t){return t.source().same(t.target())?2:1}),indegree:defineDegreeFunction(function(e,t){return t.target().same(e)?1:0}),outdegree:defineDegreeFunction(function(e,t){return t.source().same(e)?1:0})}),j(eF,{minDegree:defineDegreeBoundsFunction("degree",function(e,t){return e<t}),maxDegree:defineDegreeBoundsFunction("degree",function(e,t){return e>t}),minIndegree:defineDegreeBoundsFunction("indegree",function(e,t){return e<t}),maxIndegree:defineDegreeBoundsFunction("indegree",function(e,t){return e>t}),minOutdegree:defineDegreeBoundsFunction("outdegree",function(e,t){return e<t}),maxOutdegree:defineDegreeBoundsFunction("outdegree",function(e,t){return e>t})}),j(eF,{totalDegree:function(e){for(var t=0,n=this.nodes(),i=0;i<n.length;i++)t+=n[i].degree(e);return t}});var beforePositionSet=function(e,t,n){for(var i=0;i<e.length;i++){var a=e[i];if(!a.locked()){var o=a._private.position,s={x:null!=t.x?t.x-o.x:0,y:null!=t.y?t.y-o.y:0}
1;a.isParent()&&!(0===s.x&&0===s.y)&&a.children().shift(s,n),a.dirtyBoundingBoxCache()}}},eV={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,t){beforePositionSet(e,t,!1)},onSet:function(e){e.dirtyCompoundBoundsCache()},canSet:function(e){return!e.locked()}};(s=l={position:ek.data(eV),silentPosition:ek.data(j({},eV,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(e,t){beforePositionSet(e,t,!0)},onSet:function(e){e.dirtyCompoundBoundsCache()}})),positions:function(e,t){if(plainObject(e))t?this.silentPosition(e):this.position(e);else if(fn$6(e)){var n=this.cy();n.startBatch();for(var i=0;i<this.length;i++){var a=this[i],o=void 0;(o=e(a,i))&&(t?a.silentPosition(o):a.position(o))}n.endBatch()}return this},silentPositions:function(e){return this.positions(e,!0)},shift:function(e,t,n){var i;if(plainObject(e)?(i={x:number$1(e.x)?e.x:0,y:number$1(e.y)?e.y:0},n=t):string(e)&&number$1(t)&&((i={x:0,y:0})[e]=t),null!=i){var a=this.cy();a.startBatch();for(var o=0;o<this.length;o++){var s=this[o];if(!(a.hasCompoundNodes()&&s.isChild()&&s.ancestors().anySame(this))){var l=s.position(),u={x:l.x+i.x,y:l.y+i.y};n?s.silentPosition(u):s.position(u)}}a.endBatch()}return this},silentShift:function(e,t){return plainObject(e)?this.shift(e,!0):string(e)&&number$1(t)&&this.shift(e,t,!0),this},renderedPosition:function(e,t){var n=this[0],i=this.cy(),a=i.zoom(),o=i.pan(),s=plainObject(e)?e:void 0,l=void 0!==s||void 0!==t&&string(e);if(n&&n.isNode()){if(!l)return(s=modelToRenderedPosition(n.position(),a,o),void 0===e)?s:s[e];for(var u=0;u<this.length;u++){var c=this[u];void 0!==t?c.position(e,(t-o[e])/a):void 0!==s&&c.position(renderedToModelPosition(s,a,o))}}else if(!l)return;return this},relativePosition:function(e,t){var n=this[0],i=this.cy(),a=plainObject(e)?e:void 0,o=void 0!==a||void 0!==t&&string(e),s=i.hasCompoundNodes();if(n&&n.isNode()){if(o)for(var l=0;l<this.length;l++){var u=this[l],c=s?u.parent():null,d=c&&c.length>0;d&&(c=c[0]);var h=d?c.position():{x:0,y:0};void 0!==t?u.position(e,t+h[e]):void 0!==a&&u.position({x:a.x+h.x,y:a.y+h.y})}else{var p=n.position(),g=s?n.parent():null,v=g&&g.length>0;v&&(g=g[0]);var y=v?g.position():{x:0,y:0};return(a={x:p.x-y.x,y:p.y-y.y},void 0===e)?a:a[e]}}else if(!o)return;return this}}).modelPosition=s.point=s.position,s.modelPositions=s.points=s.positions,s.renderedPoint=s.renderedPosition,s.relativePoint=s.relativePosition,u=c={},c.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),i=n.zoom(),a=n.pan(),o=t.x1*i+a.x,s=t.x2*i+a.x,l=t.y1*i+a.y,u=t.y2*i+a.y;return{x1:o,x2:s,y1:l,y2:u,w:s-o,h:u-l}},c.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},c.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes()||!e&&t.batching())return this;for(var n=0;n<this.length;n++){var i=this[n],a=i._private;a.compoundBoundsClean&&!e||(function(e){if(e.isParent()){var t=e._private,n=e.children(),i="include"===e.pstyle("compound-sizing-wrt-labels").value,a={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},o=n.boundingBox({includeLabels:i,includeOverlays:!1,useCache:!1}),s=t.position;(0===o.w||0===o.h)&&((o={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=s.x-o.w/2,o.x2=s.x+o.w/2,o.y1=s.y-o.h/2,o.y2=s.y+o.h/2);var l=a.width.left.value;"px"===a.width.left.units&&a.width.val>0&&(l=100*l/a.width.val);var u=a.width.right.value;"px"===a.width.right.units&&a.width.val>0&&(u=100*u/a.width.val);
1var c=a.height.top.value;"px"===a.height.top.units&&a.height.val>0&&(c=100*c/a.height.val);var d=a.height.bottom.value;"px"===a.height.bottom.units&&a.height.val>0&&(d=100*d/a.height.val);var h=computeBiasValues(a.width.val-o.w,l,u),p=h.biasDiff,g=h.biasComplementDiff,v=computeBiasValues(a.height.val-o.h,c,d),y=v.biasDiff,b=v.biasComplementDiff;t.autoPadding=function(e,t,n,i){if("%"===n.units)switch(i){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}else if("px"===n.units)return n.pfValue;else return 0}(o.w,o.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(o.w,a.width.val),s.x=(-p+o.x1+o.x2+g)/2,t.autoHeight=Math.max(o.h,a.height.val),s.y=(-y+o.y1+o.y2+b)/2}function computeBiasValues(e,t,n){var i=0,a=0,o=t+n;return e>0&&o>0&&(i=t/o*e,a=n/o*e),{biasDiff:i,biasComplementDiff:a}}}(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var noninf=function(e){return e===1/0||e===-1/0?0:e},updateBounds=function(e,t,n,i,a){i-t!=0&&a-n!=0&&null!=t&&null!=n&&null!=i&&null!=a&&(e.x1=t<e.x1?t:e.x1,e.x2=i>e.x2?i:e.x2,e.y1=n<e.y1?n:e.y1,e.y2=a>e.y2?a:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},updateBoundsFromBox=function(e,t){return null==t?e:updateBounds(e,t.x1,t.y1,t.x2,t.y2)},prefixedProperty=function(e,t,n){return getPrefixedProperty(e,t,n)},updateBoundsFromArrow=function(e,t,n){if(!t.cy().headless()){var i,a,o=t._private,s=o.rstyle,l=s.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(i=s.srcX,a=s.srcY):"target"===n?(i=s.tgtX,a=s.tgtY):(i=s.midX,a=s.midY);var u=o.arrowBounds=o.arrowBounds||{},c=u[n]=u[n]||{};c.x1=i-l,c.y1=a-l,c.x2=i+l,c.y2=a+l,c.w=c.x2-c.x1,c.h=c.y2-c.y1,expandBoundingBox(c,1),updateBounds(e,c.x1,c.y1,c.x2,c.y2)}}},updateBoundsFromLabel=function(e,t,n){if(!t.cy().headless()){o=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(o+"label").strValue){var o,s,l,u,c,d=t.pstyle("text-halign"),h=t.pstyle("text-valign"),p=prefixedProperty(a,"labelWidth",n),g=prefixedProperty(a,"labelHeight",n),v=prefixedProperty(a,"labelX",n),y=prefixedProperty(a,"labelY",n),b=t.pstyle(o+"text-margin-x").pfValue,x=t.pstyle(o+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle(o+"text-rotation"),C=t.pstyle("text-outline-width").pfValue,S=t.pstyle("text-border-width").pfValue/2,P=t.pstyle("text-background-padding").pfValue,k=p/2,D=g/2;if(w)s=v-k,l=v+k,u=y-D,c=y+D;else{switch(d.value){case"left":s=v-p,l=v;break;case"center":s=v-k,l=v+k;break;case"right":s=v,l=v+p}switch(h.value){case"top":u=y-g,c=y;break;case"center":u=y-D,c=y+D;break;case"bottom":u=y,c=y+g}}s+=b-Math.max(C,S)-P-2,l+=b+Math.max(C,S)+P+2,u+=x-Math.max(C,S)-P-2,c+=x+Math.max(C,S)+P+2;var T=n||"main",B=i.labelBounds,A=B[T]=B[T]||{};A.x1=s,A.y1=u,A.x2=l,A.y2=c,A.w=l-s,A.h=c-u;var I=w&&"autorotate"===E.strValue,M=null!=E.pfValue&&0!==E.pfValue;if(I||M){var _=I?prefixedProperty(i.rstyle,"labelAngle",n):E.pfValue,L=Math.cos(_),O=Math.sin(_),N=(s+l)/2,z=(u+c)/2;if(!w){switch(d.value){case"left":N=l;break;case"right":N=s}switch(h.value){case"top":z=c;break;case"bottom":z=u}}var rotate=function(e,t){return{x:(e-=N)*L-(t-=z)*O+N,y:e*O+t*L+z}},R=rotate(s,u),F=rotate(s,c),V=rotate(l,u),q=rotate(l,c);s=Math.min(R.x,F.x,V.x,q.x),l=Math.max(R.x,F.x,V.x,q.x),u=Math.min(R.y,F.y,V.y,q.y),c=Math.max(R.y,F.y,V.y,q.y)}var j=T+"Rot",$=B[j]=B[j]||{};$.x1=s,$.y1=u,$.x2=l,$.y2=c,$.w=l-s,$.h=c-u,updateBounds(e,s,u,l,c),updateBounds(i.labelBounds.all,s,u,l,c)}return e}},updateBoundsFromOutline=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,i=t.pstyle("outline-width").value;if(n>0&&i>0){var a=t.pstyle("outline-offset").value,o=t.pstyle("shape").value,s=i+a,l=(e.w+2*s)/e.w,u=(e.h+2*s)/e.h,c=0;["diamond","pentagon","round-triangle"].includes(o)?(l=(e.w+2.4*s)/e.w,c=-s/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(o)?l=(e.w+2.4*s)/e.w:"star"===o?(l=(e.w+2.8*s)/e.w,u=(e.h+2.6*s)/e.h,c=-s/3.8):"triangle"===o?(l=(e.w+2.8*s)/e.w,u=(e.h+2.4*s)/e.h,c=-s/1.4):"vee"===o&&(l=(e.w+4.4*s)/e.w,u=(e.h+3.8*s)/e.h,c=-(.5*s));var d=e.h*u-e.h,h=e.w*l-e.w;if(expandBoundingBoxSides(e,[Math.ceil(d/2),Math.ceil(h/2)]),0!==c){var p,g=(p=c,{x1:e.x1+0,x2:e.x2+0,y1:e.y1+p,y2:e.y2+p,w:e.w,h:e.h});updateBoundingBox(e,g)}}}},boundingBoxImpl=function(e,t){var n=e._private.cy,i=n.styleEnabled(),a=n.headless(),o=makeBoundingBox(),s=e._private,l=e.isNode(),u=e.isEdge(),c=s.rstyle,d=l&&i?e.pstyle("bounds-expansion").pfValue:[0],isDisplayed=function(e){return"none"!==e.pstyle("display").value},h=!i||isDisplayed(e)&&(!u||isDisplayed(e.source())&&isDisplayed(e.target()));if(h){var p=0;i&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(p=e.pstyle("overlay-padding").value);var g=0;i&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(g=e.pstyle("underlay-padding").value);var v=Math.max(p,g),y=0;if(i&&(y=e.pstyle("width").pfValue/2),l&&t.includeNodes){var b=e.position();k=b.x,D=b.y;var x=e.outerWidth()/2,w=e.outerHeight()/2;E=k-x,C=k+x,updateBounds(o,E,S=D-w,C,P=D+w),i&&t.includeOutlines&&updateBoundsFromOutline(o,e)}else if(u&&t.includeEdges){if(i&&!a){var E,C,S,P,k,D,T,B=e.pstyle("curve-style").strValue;if(E=Math.min(c.srcX,c.midX,c.tgtX),C=Math.max(c.srcX,c.midX,c.tgtX),S=Math.min(c.srcY,c.midY,c.tgtY),P=Math.max(c.srcY,c.midY,c.tgtY),E-=y,C+=y,updateBounds(o,E,S-=y,C,P+=y),"haystack"===B){var A=c.haystackPts;if(A&&2===A.length){if(E=A[0].x,S=A[0].y,C=A[1].x,P=A[1].y,E>C){var I=E;E=C,C=I}if(S>P){var M=S;S=P,P=M}updateBounds(o,E-y,S-y,C+y,P+y)}}else if("bezier"===B||"unbundled-bezier"===B||"segments"===B||"taxi"===B){switch(B){case"bezier":case"unbundled-bezier":T=c.bezierPts;break;case"segments":case"taxi":T=c.linePts}if(null!=T)for(var _=0;_<T.length;_++){var L=T[_];E=L.x-y,C=L.x+y,updateBounds(o,E,S=L.y-y,C,P=L.y+y)}}}else{var O=e.source().position(),N=e.target().position();if(E=O.x,C=N.x,S=O.y,P=N.y,E>C){var z=E;E=C,C=z}if(S>P){var R=S;S=P,P=R}E-=y,C+=y,updateBounds(o,E,S-=y,C,P+=y)}}if(i&&t.includeEdges&&u&&(updateBoundsFromArrow(o,e,"mid-source"),updateBoundsFromArrow(o,e,"mid-target"),updateBoundsFromArrow(o,e,"source"),updateBoundsFromArrow(o,e,"target")),i&&"yes"===e.pstyle("ghost").value){var F=e.pstyle("ghost-offset-x").pfValue,V=e.pstyle("ghost-offset-y").pfValue;updateBounds(o,o.x1+F,o.y1+V,o.x2+F,o.y2+V)}var q=s.bodyBounds=s.bodyBounds||{};assignBoundingBox(q,o),expandBoundingBoxSides(q,d),expandBoundingBox(q,1),i&&(E=o.x1,C=o.x2,S=o.y1,P=o.y2,updateBounds(o,E-v,S-v,C+v,P+v));var j=s.overlayBounds=s.overlayBounds||{};assignBoundingBox(j,o),expandBoundingBoxSides(j,d),expandBoundingBox(j,1);var $=s.labelBounds=s.labelBounds||{};null!=$.all?clearBoundingBox($.all):$.all=makeBoundingBox(),i&&t.includeLabels&&(t.includeMainLabels&&updateBoundsFromLabel(o,e,null),u&&(t.includeSourceLabels&&updateBoundsFromLabel(o,e,"source"),t.includeTargetLabels&&updateBoundsFromLabel(o,e,"target")))}return o.x1=noninf(o.x1),o.y1=noninf(o.y1),o.x2=noninf(o.x2),o.y2=noninf(o.y2),o.w=noninf(o.x2-o.x1),o.h=noninf(o.y2-o.y1),o.w>0&&o.h>0&&h&&(expandBoundingBoxSides(o,d),expandBoundingBox(o,1)),o},getKey=function(e){var t=0,tf=function(e){return(e?1:0)<<t++};return 0+tf(e.incudeNodes)+tf(e.includeEdges)+tf(e.includeLabels)+tf(e.includeMainLabels)+tf(e.includeSourceLabels)+tf(e.includeTargetLabels)+tf(e.includeOverlays)+tf(e.includeOutlines)},getBoundingBoxPosKey=function(e){if(!e.isEdge())return 0;var t=e.source().position(),n=e.target().position(),r=function(e){return Math.round(e)};return hashIntsArray([r(t.x),r(t.y),r(n.x),r(n.y)])},cachedBoundingBoxImpl=function(e,t){var n,i=e._private,a=e.isEdge(),o=null==t?ej:getKey(t),s=getBoundingBoxPosKey(e),l=i.bbCachePosKey===s,u=t.useCache&&l,isDirty=function(e){return null==e._private.bbCache||e._private.styleDirty};
1if(!u||isDirty(e)||a&&isDirty(e.source())||isDirty(e.target())?(l||e.recalculateRenderedStyle(u),n=boundingBoxImpl(e,eq),i.bbCache=n,i.bbCachePosKey=s):n=i.bbCache,o!==ej){var c=e.isNode();n=makeBoundingBox(),(t.includeNodes&&c||t.includeEdges&&!c)&&(t.includeOverlays?updateBoundsFromBox(n,i.overlayBounds):updateBoundsFromBox(n,i.bodyBounds)),t.includeLabels&&(t.includeMainLabels&&(!a||t.includeSourceLabels&&t.includeTargetLabels)?updateBoundsFromBox(n,i.labelBounds.all):(t.includeMainLabels&&updateBoundsFromBox(n,i.labelBounds.mainRot),t.includeSourceLabels&&updateBoundsFromBox(n,i.labelBounds.sourceRot),t.includeTargetLabels&&updateBoundsFromBox(n,i.labelBounds.targetRot))),n.w=n.x2-n.x1,n.h=n.y2-n.y1}return n},eq={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},ej=getKey(eq),e$=defaults$g(eq);c.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=makeBoundingBox();var n=e$(e=e||eq);if(this.cy().styleEnabled())for(var i=0;i<this.length;i++){var a=this[i],o=a._private,s=getBoundingBoxPosKey(a),l=o.bbCachePosKey===s,u=n.useCache&&l&&!o.styleDirty;a.recalculateRenderedStyle(u)}this.updateCompoundBounds(!e.useCache);for(var c=0;c<this.length;c++)updateBoundsFromBox(t,cachedBoundingBoxImpl(this[c],n))}else e=void 0===e?eq:e$(e),t=cachedBoundingBoxImpl(this[0],e);return t.x1=noninf(t.x1),t.y1=noninf(t.y1),t.x2=noninf(t.x2),t.y2=noninf(t.y2),t.w=noninf(t.x2-t.x1),t.h=noninf(t.y2-t.y1),t},c.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},c.boundingBoxAt=function(e){var t,n=this.nodes(),i=this.cy(),a=i.hasCompoundNodes(),o=i.collection();if(a&&(o=n.filter(function(e){return e.isParent()}),n=n.not(o)),plainObject(e)){var s=e;e=function(){return s}}
1i.startBatch(),n.forEach(function(t,n){return t._private.bbAtOldPos=e(t,n)}).silentPositions(e),a&&(o.dirtyCompoundBoundsCache(),o.dirtyBoundingBoxCache(),o.updateCompoundBounds(!0));var l={x1:(t=this.boundingBox({useCache:!1})).x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h};return n.silentPositions(function(e){return e._private.bbAtOldPos}),a&&(o.dirtyCompoundBoundsCache(),o.dirtyBoundingBoxCache(),o.updateCompoundBounds(!0)),i.endBatch(),l},u.boundingbox=u.bb=u.boundingBox,u.renderedBoundingbox=u.renderedBoundingBox,d=h={};var defineDimFns=function(e){e.uppercaseName=capitalize(e.name),e.autoName="auto"+e.uppercaseName,e.labelName="label"+e.uppercaseName,e.outerName="outer"+e.uppercaseName,e.uppercaseOuterName=capitalize(e.outerName),d[e.name]=function(){var t=this[0],n=t._private,i=n.cy._private.styleEnabled;if(t){if(!i)return 1;if(t.isParent())return t.updateCompoundBounds(),n[e.autoName]||0;var a=t.pstyle(e.name);return"label"===a.strValue?(t.recalculateRenderedStyle(),n.rstyle[e.labelName]||0):a.pfValue}},d["outer"+e.uppercaseName]=function(){var t=this[0],n=t._private.cy._private.styleEnabled;if(t)return n?t[e.name]()+t.pstyle("border-width").pfValue+2*t.padding():1},d["rendered"+e.uppercaseName]=function(){var t=this[0];if(t)return t[e.name]()*this.cy().zoom()},d["rendered"+e.uppercaseOuterName]=function(){var t=this[0];if(t)return t[e.outerName]()*this.cy().zoom()}};defineDimFns({name:"width"}),defineDimFns({name:"height"}),h.padding=function(){var e=this[0],t=e._private;return e.isParent()&&(e.updateCompoundBounds(),void 0!==t.autoPadding)?t.autoPadding:e.pstyle("padding").pfValue},h.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},h.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var ifEdge=function(e,t){if(e.isEdge())return t(e)},ifEdgeRenderedPosition=function(e,t){if(e.isEdge()){var n=e.cy();return modelToRenderedPosition(t(e),n.zoom(),n.pan())}},ifEdgeRenderedPositions=function(e,t){if(e.isEdge()){var n=e.cy(),i=n.pan(),a=n.zoom();return t(e).map(function(e){return modelToRenderedPosition(e,a,i)})}},eX={controlPoints:{get:function(e){return e.renderer().getControlPoints(e)},mult:!0},segmentPoints:{get:function(e){return e.renderer().getSegmentPoints(e)},mult:!0},sourceEndpoint:{get:function(e){return e.renderer().getSourceEndpoint(e)}},targetEndpoint:{get:function(e){return e.renderer().getTargetEndpoint(e)}},midpoint:{get:function(e){return e.renderer().getEdgeMidpoint(e)}}},eY=j({},l,c,h,Object.keys(eX).reduce(function(e,t){var n=eX[t],i="rendered"+t[0].toUpperCase()+t.substr(1);return e[t]=function(){return ifEdge(this,n.get)},n.mult?e[i]=function(){return ifEdgeRenderedPositions(this,n.get)}:e[i]=function(){return ifEdgeRenderedPosition(this,n.get)},e},{})),Event=function(e,t){this.recycle(e,t)};function returnFalse(){return!1}function returnTrue(){return!0}Event.prototype={instanceString:function(){return"event"},recycle:function(e,t){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=returnFalse,null!=e&&e.preventDefault?(this.type=e.type,this.isDefaultPrevented=e.defaultPrevented?returnTrue:returnFalse):null!=e&&e.type?t=e:this.type=e,null!=t&&(this.originalEvent=t.originalEvent,this.type=null!=t.type?t.type:this.type,this.cy=t.cy,this.target=t.target,this.position=t.position,this.renderedPosition=t.renderedPosition,this.namespace=t.namespace,this.layout=t.layout),null!=this.cy&&null!=this.position&&null==this.renderedPosition){var n=this.position,i=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:n.x*i+a.x,y:n.y*i+a.y}}this.timeStamp=e&&e.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=returnTrue;var e=this.originalEvent;e&&e.preventDefault&&e.preventDefault()},stopPropagation:function(){this.isPropagationStopped=returnTrue;var e=this.originalEvent;e&&e.stopPropagation&&e.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=returnTrue,this.stopPropagation()},isDefaultPrevented:returnFalse,isPropagationStopped:returnFalse,isImmediatePropagationStopped:returnFalse};var eH=/^([^.]+)(\.(?:[^.]+))?$/,eW={qualifierCompare:function(e,t){return e===t},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(e){return e},beforeEmit:function(){}
1,afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},eU=Object.keys(eW),eG={};function Emitter(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:eG,t=arguments.length>1?arguments[1]:void 0,n=0;n<eU.length;n++){var i=eU[n];this[i]=e[i]||eW[i]}this.context=t||this.context,this.listeners=[],this.emitting=0}var eK=Emitter.prototype,forEachEvent=function(e,t,n,i,a,o,s){fn$6(i)&&(a=i,i=null),s&&(o=null==o?s:j({},o,s));for(var l=array(n)?n:n.split(/\s+/),u=0;u<l.length;u++){var c=l[u];if(!emptyString(c)){var d=c.match(eH);if(d&&!1===t(e,c,d[1],d[2]?d[2]:null,i,a,o))break}}},makeEventObj=function(e,t){return e.addEventFields(e.context,t),new Event(t.type,t)},forEachEventObj=function(e,t,n){if("event"===instanceStr(n)){t(e,n);return}if(plainObject(n)){t(e,makeEventObj(e,n));return}for(var i=array(n)?n:n.split(/\s+/),a=0;a<i.length;a++){var o=i[a];if(!emptyString(o)){var s=o.match(eH);if(s){var l=makeEventObj(e,{type:s[1],namespace:s[2]?s[2]:null,target:e.context});t(e,l)}}}};eK.on=eK.addListener=function(e,t,n,i,a){return forEachEvent(this,function(e,t,n,i,a,o,s){fn$6(o)&&e.listeners.push({event:t,callback:o,type:n,namespace:i,qual
1ifier:a,conf:s})},e,t,n,i,a),this},eK.one=function(e,t,n,i){return this.on(e,t,n,i,{one:!0})},eK.removeListener=eK.off=function(e,t,n,i){var a=this;0!==this.emitting&&(this.listeners=this.listeners.slice());for(var o=this.listeners,_loop=function(s){var l=o[s];forEachEvent(a,function(t,n,i,a,u,c){if((l.type===i||"*"===e)&&(!a&&".*"!==l.namespace||l.namespace===a)&&(!u||t.qualifierCompare(l.qualifier,u))&&(!c||l.callback===c))return o.splice(s,1),!1},e,t,n,i)},s=o.length-1;s>=0;s--)_loop(s);return this},eK.removeAllListeners=function(){return this.removeListener("*")},eK.emit=eK.trigger=function(e,t,n){var i=this.listeners,a=i.length;return this.emitting++,array(t)||(t=[t]),forEachEventObj(this,function(e,o){null!=n&&(a=(i=[{event:o.event,type:o.type,namespace:o.namespace,callback:n}]).length);for(var s=0;s<a;s++)!function(n){var a=i[n];if(a.type===o.type&&(!a.namespace||a.namespace===o.namespace||".*"===a.namespace)&&e.eventMatches(e.context,a,o)){var s=[o];null!=t&&push(s,t),e.beforeEmit(e.context,a,o),a.conf&&a.conf.one&&(e.listeners=e.listeners.filter(function(e){return e!==a}));var l=e.callbackContext(e.context,a,o),u=a.callback.apply(l,s);e.afterEmit(e.context,a,o),!1===u&&(o.stopPropagation(),o.preventDefault())}}(s);e.bubble(e.context)&&!o.isPropagationStopped()&&e.parent(e.context).emit(o,t)},e),this.emitting--,this};var eQ={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var i=t.qualifier;
1return null==i||e!==n.target&&element(n.target)&&i.matches(n.target)},addEventFields:function(e,t){t.cy=e.cy(),t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e},beforeEmit:function(e,t){t.conf&&t.conf.once&&t.conf.onceCollection.removeListener(t.event,t.qualifier,t.callback)},bubble:function(){return!0},parent:function(e){return e.isChild()?e.parent():e.cy()}},argSelector$1=function(e){return string(e)?new Selector(e):e},eZ={createEmitter:function(){for(var e=0;e<this.length;e++){var t=this[e],n=t._private;n.emitter||(n.emitter=new Emitter(eQ,t))}return this},emitter:function(){return this._private.emitter},on:function(e,t,n){for(var i=argSelector$1(t),a=0;a<this.length;a++)this[a].emitter().on(e,i,n);return this},removeListener:function(e,t,n){for(var i=argSelector$1(t),a=0;a<this.length;a++)this[a].emitter().removeListener(e,i,n);return this},removeAllListeners:function(){for(var e=0;e<this.length;e++)this[e].emitter().removeAllListeners();return this},one:function(e,t,n){for(var i=argSelector$1(t),a=0;a<this.length;a++)this[a].emitter().one(e,i,n);return this},once:function(e,t,n){for(var i=argSelector$1(t),a=0;a<this.length;a++)this[a].emitter().on(e,i,n,{once:!0,onceCollection:this})},emit:function(e,t){for(var n=0;n<this.length;n++)this[n].emitter().emit(e,t);return this},emitAndNotify:function(e,t){if(0!==this.length)return this.cy().notify(e,this),this.emit(e,t),this}};ek.eventAliasesOn(eZ);var eJ={nodes:function(e){return this.filter(function(e){return e.isNode()}).filter(e)},edges:function(e){return this.filter(function(e){return e.isEdge()}).filter(e)},byGroup:function(){for(var e=this.spawn(),t=this.spawn(),n=0;n<this.length;n++){var i=this[n];i.isNode()?e.push(i):t.push(i)}return{nodes:e,edges:t}},filter:function(e,t){if(void 0===e)return this;if(string(e)||elementOrCollection(e))return new Selector(e).filter(this);if(fn$6(e)){for(var n=this.spawn(),i=0;i<this.length;i++){var a=this[i];(t?e.apply(t,[a,i,this]):e(a,i,this))&&n.push(a)}return n}return this.spawn()},not:function(e){if(!e)return this;string(e)&&(e=this.filter(e));for(var t=this.spawn(),n=0;n<this.length;n++){var i=this[n];e.has(i)||t.push(i)}return t},absoluteComplement:function(){return this.cy().mutableElements().not(this)},intersect:function(e){if(string(e))return this.filter(e);for(var t=this.spawn(),n=this.length<e.length,i=n?this:e,a=n?e:this,o=0;o<i.length;o++){var s=i[o];a.has(s)&&t.push(s)}return t},xor:function(e){var t=this._private.cy;string(e)&&(e=t.$(e));var n=this.spawn(),i=e,add=function(e,t){for(var i=0;i<e.length;i++){var a=e[i],o=a._private.data.id;t.hasElementWithId(o)||n.push(a)}};return add(this,i),add(i,this),n},diff:function(e){var t=this._private.cy;string(e)&&(e=t.$(e));var n=this.spawn(),i=this.spawn(),a=this.spawn(),o=e,add=function(e,t,n){for(var i=0;i<e.length;i++){var o=e[i],s=o._private.data.id;t.hasElementWithId(s)?a.merge(o):n.push(o)}};return add(this,o,n),add(o,this,i),{left:n,right:i,both:a}},add:function(e){var t=this._private.cy;if(!e)return this;if(string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=this.spawnSelf(),a=0;a<e.length;a++){var o=e[a];this.has(o)||i.push(o)}return i},merge:function(e){var t=this._private,n=t.cy;if(!e)return this;if(e&&string(e)){var i=e;e=n.mutableElements().filter(i)}for(var a=t.map,o=0;o<e.length;o++){var s=e[o],l=s._private.data.id;if(!a.has(l)){var u=this.length++;this[u]=s,a.set(l,{ele:s,index:u})}}return this},unmergeAt:function(e){var t=this[e].id(),n=this._private.map;this[e]=void 0,n.delete(t);var i=e===this.length-1;if(this.length>1&&!i){var a=this.length-1,o=this[a],s=o._private.data.id;this[a]=void 0,this[e]=o,n.set(s,{ele:o,index:e})}return this.length--,this},unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,i=t.map.get(n);if(!i)return this;var a=i.index;return this.unmergeAt(a),this},unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&string(e)){var n=e;e=t.mutableElements().filter(n)}for(var i=0;i<e.length;i++)this.unmergeOne(e[i]);return this},unmergeBy:function(e){for(var t=this.length-1;t>=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],i=0;i<this.length;i++){var a=this[i],o=t?e.apply(t,[a,i,this]):e(a,i,this);n.push(o)}return n},reduce:function(e,t){for(var n=t,i=0;i<this.length;i++)n=e(n,this[i],i,this);return n},max:function(e,t){for(var n,i=-1/0,a=0;a<this.length;a++){var o=this[a],s=t?e.apply(t,[o,a,this]):e(o,a,this);s>i&&(i=s,n=o)}return{value:i,ele:n}},min:function(e,t){for(var n,i=1/0,a=0;a<this.length;a++){var o=this[a],s=t?e.apply(t,[o,a,this]):e(o,a,this);s<i&&(i=s,n=o)}return{value:i,ele:n}}};eJ.u=eJ["|"]=eJ["+"]=eJ.union=eJ.or=eJ.add,eJ["\\"]=eJ["!"]=eJ["-"]=eJ.difference=eJ.relativeComplement=eJ.subtract=eJ.not,eJ.n=eJ["&"]=eJ["."]=eJ.and=eJ.intersection=eJ.intersect,eJ["^"]=eJ["(+)"]=eJ["(-)"]=eJ.symmetricDifference=eJ.symdiff=eJ.xor,eJ.fnFilter=eJ.filterFn=eJ.stdFilter=eJ.filter,eJ.complement=eJ.abscomp=eJ.absoluteComplement;var zIndexSort=function(e,t){var n=e.cy().hasCompoundNodes();function getDepth(e){var t=e.pstyle("z-compound-depth");return"auto"===t.value?n?e.zDepth():0:"bottom"===t.value?-1:"top"===t.value?K:0}var i=getDepth(e)-getDepth(t);if(0!==i)return i;function getEleDepth(e){return"auto"===e.pstyle("z-index-compare").value&&e.isNode()?1:0}
vendor: 1,183 bytes, line 1
1var a=getEleDepth(e)-getEleDepth(t);if(0!==a)return a;var o=e.pstyle("z-index").value-t.pstyle("z-index").value;return 0!==o?o:e.poolIndex()-t.poolIndex()},e0={forEach:function(e,t){if(fn$6(e))for(var n=this.length,i=0;i<n;i++){var a=this[i];if(!1===(t?e.apply(t,[a,i,this]):e(a,i,this)))break}return this},toArray:function(){for(var e=[],t=0;t<this.length;t++)e.push(this[t]);return e},slice:function(e,t){var n=[],i=this.length;null==t&&(t=i),null==e&&(e=0),e<0&&(e=i+e),t<0&&(t=i+t);for(var a=e;a>=0&&a<t&&a<i;a++)n.push(this[a]);return this.spawn(n)},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 0===this.length},nonempty:function(){return!this.empty()},sort:function(e){if(!fn$6(e))return this;var t=this.toArray().sort(e);return this.spawn(t)},sortByZIndex:function(){return this.sort(zIndexSort)},zDepth:function(){var e=this[0];if(e){var t=e._private;if("nodes"===t.group){var n=t.data.parent?e.parents().size():0;return e.isParent()?n:K-1}var i=t.source,a=t.target;return Math.max(i.zDepth(),a.zDepth(),0)}}};
1e0.each=e0.forEach,i="undefined",("undefined"==typeof Symbol?"undefined":_typeof(Symbol))!=i&&_typeof(Symbol.iterator)!=i&&(e0[Symbol.iterator]=function(){var e=this,t={value:void 0,done:!1},n=0,i=this.length;return _defineProperty({next:function(){return n<i?t.value=e[n++]:(t.value=void 0,t.done=!0),t}},Symbol.iterator,function(){return this})});var e1=defaults$g({nodeDimensionsIncludeLabels:!1}),e2={layoutDimensions:function(e){if(e=e1(e),this.takesUpSpace()){if(e.nodeDimensionsIncludeLabels){var t,n=this.boundingBox();t={w:n.w,h:n.h}}else t={w:this.outerWidth(),h:this.outerHeight()}}else t={w:0,h:0};return(0===t.w||0===t.h)&&(t.w=t.h=1),t},layoutPositions:function(e,t,n){var i=this.nodes().filter(function(e){return!e.isParent()}),a=this.cy(),o=t.eles,getMemoizeKey=function(e){return e.id()},s=memoize(n,getMemoizeKey);e.emit({type:"layoutstart",layout:e}),e.animations=[];var calculateSpacing=function(e,t,n){var i={x:t.x1+t.w/2,y:t.y1+t.h/2},a={x:(n.x-i.x)*e,y:(n.y-i.y)*e};return{x:i.x+a.x,y:i.y+a.y}},l=t.spacingFactor&&1!==t.spacingFactor,u=function(){if(!l)return null;for(var e=makeBoundingBox(),t=0;t<i.length;t++){var n=s(i[t],t);expandBoundingBoxByPoint(e,n.x,n.y)}return e}(),c=memoize(function(e,n){var i=s(e,n);return l&&(i=calculateSpacing(Math.abs(t.spacingFactor),u,i)),null!=t.transform&&(i=t.transform(e,i)),i},getMemoizeKey);if(t.animate){for(var d=0;d<i.length;d++){var h=i[d],p=c(h,d);if(null==t.animateFilter||t.animateFilter(h,d)){var g=h.animation({position:p,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(g)}else h.position(p)}if(t.fit){var v=a.animation({fit:{boundingBox:o.boundingBoxAt(c),padding:t.padding},duration:t.animationDuration,easing:t.animationEasing});e.animations.push(v)}else if(void 0!==t.zoom&&void 0!==t.pan){var y=a.animation({zoom:t.zoom,pan:t.pan,duration:t.animationDuration,easing:t.animationEasing});e.animations.push(y)}e.animations.forEach(function(e){return e.play()}),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),eS.all(e.animations.map(function(e){return e.promise()})).then(function(){e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e})})}else i.positions(c),t.fit&&a.fit(t.eles,t.padding),null!=t.zoom&&a.zoom(t.zoom),t.pan&&a.pan(t.pan),e.one("layoutready",t.ready),e.emit({type:"layoutready",layout:e}),e.one("layoutstop",t.stop),e.emit({type:"layoutstop",layout:e});return this},layout:function(e){return this.cy().makeLayout(j({},e,{eles:this}))}};function styleCache(e,t,n){var i,a=n._private,o=a.styleCache=a.styleCache||[];return null!=(i=o[e])?i:i=o[e]=t(n)}function cacheStyleFunction(e,t){return e=hashString(e),function(n){return styleCache(e,t,n)}}function cachePrototypeStyleFunction(e,t){e=hashString(e);var selfFn=function(e){return t.call(e)};return function(){var t=this[0];if(t)return styleCache(e,selfFn,t)}}e2.createLayout=e2.makeLayout=e2.layout;var e5={recalculateRenderedStyle:function(e){var t=this.cy(),n=t.renderer(),i=t.styleEnabled();return n&&i&&n.recalculateRenderedStyle(this,e),this},dirtyStyleCache:function(){var e,t=this.cy(),dirty=function(e){return e._private.styleCache=null};return t.hasCompoundNodes()?((e=this.spawnSelf().merge(this.descendants()).merge(this.parents())).merge(e.connectedEdges()),e.forEach(dirty)):this.forEach(function(e){dirty(e),e.connectedEdges().forEac
1h(dirty)}),this},updateStyle:function(e){var t=this._private.cy;if(!t.styleEnabled())return this;if(t.batching())return t._private.batchStyleEles.merge(this),this;var n=t.hasCompoundNodes(),i=this;e=!!e||void 0===e,n&&(i=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var a=i;return e?a.emitAndNotify("style"):a.emit("style"),i.forEach(function(e){return e._private.styleDirty=!0}),this},cleanStyle:function(){var e=this.cy();if(e.styleEnabled())for(var t=0;t<this.length;t++){var n=this[t];n._private.styleDirty&&(n._private.styleDirty=!1,e.style().apply(n))}},parsedStyle:function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this[0],i=n.cy();if(i.styleEnabled()&&n){this.cleanStyle();var a=n._private.style[e];return null!=a?a:t?i.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled()&&t)return t.pstyle(e).units},renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];if(n)return t.style().getRenderedStyle(n,e)},style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var i=n.style();if(plainObject(e))i.applyBypass(this,e,!1),this.emitAndNotify("style");else if(string(e)){if(void 0===t){var a=this[0];return a?i.getStylePropertyValue(a,e):void 0}i.applyBypass(this,e,t,!1),this.emitAndNotify("style")}else if(void 0===e){var o=this[0];return o?i.getRawStyle(o):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=t.style();if(void 0===e)for(var i=0;i<this.length;i++){var a=this[i];n.removeAllBypasses(a,!1)}else{e=e.split(/\s+/);for(var o=0;o<this.length;o++){var s=this[o];n.removeBypasses(s,e,!1)}}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 t=e.hasCompoundNodes(),n=this[0];if(n){var i=n._private,a=n.pstyle("opacity").value;if(!t)return a;var o=i.data.parent?n.parents():null;if(o)for(var s=0;s<o.length;s++)a*=o[s].pstyle("opacity").value;return a}},transparent:function(){if(!this.cy().styleEnabled())return!1;var e=this[0],t=e.cy().hasCompoundNodes();if(e)return t?0===e.effectiveOpacity():0===e.pstyle("opacity").value},backgrounding:function(){return!!this.cy().styleEnabled()&&!!this[0]._private.backgrounding}};function checkCompound(e,t){var n=e._private.data.parent?e.parents():null;if(n){for(var i=0;i<n.length;i++)if(!t(n[i]))return!1}return!0}function defineDerivedStateFunction(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,i=e.parentOk||e.ok;return function(){var e=this.cy();if(!e.styleEnabled())return!0;var a=this[0],o=e.hasCompoundNodes();if(a){var s=a._private;if(!t(a))return!1;if(a.isNode())return!o||checkCompound(a,i);var l=s.source,u=s.target;return n(l)&&(!o||checkCompound(l,n))&&(l===u||n(u)&&(!o||checkCompound(u,n)))}}}var e3=cacheStyleFunction("eleTakesUpSpace",function(e){return"element"===e.pstyle("display").value&&0!==e.width()&&(!e.isNode()||0!==e.height())});e5.takesUpSpace=cachePrototypeStyleFunction("takesUpSpace",defineDerivedStateFunction({ok:e3}));var e4=cacheStyleFunction("eleInteractive",function(e){return"yes"===e.pstyle("events").value&&"visible"===e.pstyle("visibility").value&&e3(e)}),e9=cacheStyleFunction("parentInteractive",function(e){return"visible"===e.pstyle("visibility").value&&e3(e)});e5.interactive=cachePrototypeStyleFunction("interactive",defineDerivedStateFunction({ok:e4,parentOk:e9,edgeOkViaNode:e3})),e5.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var e6=cacheStyleFunction("eleVisible",function(e){return"visible"===e.pstyle("visibility").value&&0!==e.pstyle("opacity").pfValue&&e3(e)});e5.visible=cachePrototypeStyleFunction("visible",defineDerivedStateFunction({ok:e6,edgeOkViaNode:e3})),e5.hidden=function(){var e=this[0];if(e)return!e.visible()},e5.isBundledBezier=cachePrototypeStyleFunction("isBundledBezier",function(){return!!this.cy().styleEnabled()&&!this.removed()&&"bezier"===this.pstyle("curve-style").value&&this.takesUpSpace()}),e5.bypass=e5.css=e5.style,e5.renderedCss=e5.renderedStyle,e5.removeBypass=e5.removeCss=e5.removeStyle,e5.pstyle=e5.parsedStyle;var e8={};function defineSwitchFunction(e){return function(){var t=arguments,n=[];if(2===t.length){var i=t[0],a=t[1];this.on(e.event,i,a)}else if(1===t.length&&fn$6(t[0])){var o=t[0];this.on(e.event,o)}else if(0===t.length||1===t.length&&array(t[0])){for(var s=1===t.length?t[0]:null,l=0;l<this.length;l++){var u=this[l],c=!e.ableField||u._private[e.ableField],d=u._private[e.field]!=e.value;if(e.overrideAble){var h=e.overrideAble(u);if(void 0!==h&&(c=h,!h))return this}c&&(u._private[e.field]=e.value,d&&n.push(u))}var p=this.spawn(n);
1p.updateStyle(),p.emit(e.event),s&&p.emit(s)}return this}}function defineSwitchSet(e){e8[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(void 0!==n)return n}return t._private[e.field]}},e8[e.on]=defineSwitchFunction({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),e8[e.off]=defineSwitchFunction({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}defineSwitchSet({field:"locked",overrideField:function(e){return!!e.cy().autolock()||void 0},on:"lock",off:"unlock"}),defineSwitchSet({field:"grabbable",overrideField:function(e){return!(e.cy().autoungrabify()||e.pannable())&&void 0},on:"grabify",off:"ungrabify"}),defineSwitchSet({field:"selected",ableField:"selectable",overrideAble:function(e){return!e.cy().autounselectify()&&void 0},on:"select",off:"unselect"}),defineSwitchSet({field:"selectable",overrideField:function(e){return!e.cy().autounselectify()&&void 0},on:"selectify",off:"unselectify"}),e8.deselect=e8.unselect,e8.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},defineSwitchSet({field:"active",on:"activate",off:"unactivate"}),defineSwitchSet({field:"pannable",on:"panify",off:"unpanify"}),e8.inactive=function(){var e=this[0];if(e)return!e._private.active};var e7={},defineDagExtremity=function(e){return function(t){for(var n=[],i=0;i<this.length;i++){var a=this[i];if(a.isNode()){for(var o=!1,s=a.connectedEdges(),l=0;l<s.length;l++){var u=s[l],c=u.source(),d=u.target();if(e.noIncomingEdges&&d===a&&c!==a||e.noOutgoingEdges&&c===a&&d!==a){o=!0;break}}o||n.push(a)}}return this.spawn(n,!0).filter(t)}},defineDagOneHop=function(e){return function(t){for(var n=[],i=0;i<this.length;i++){var a=this[i];if(a.isNode())for(var o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target();e.outgoing&&u===a?(n.push(l),n.push(c)):e.incoming&&c===a&&(n.push(l),n.push(u))}}return this.spawn(n,!0).filter(t)}},defineDagAllHops=function(e){return function(t){for(var n=this,i=[],a={};;){var o=e.outgoing?n.outgoers():n.incomers();if(0===o.length)break;for(var s=!1,l=0;l<o.length;l++){var u=o[l],c=u.id();a[c]||(a[c]=!0,i.push(u),s=!0)}if(!s)break;n=o}return this.spawn(i,!0).filter(t)}};function defineSourceFunction(e){return function(t){for(var n=[],i=0;i<this.length;i++){var a=this[i]._private[e.attr];a&&n.push(a)}return this.spawn(n,!0).filter(t)}}function defineEdgesWithFunction(e){return function(t){var n=[],i=this._private.cy,a=e||{};string(t)&&(t=i.$(t));for(var o=0;o<t.length;o++)for(var s=t[o]._private.edges,l=0;l<s.length;l++){var u=s[l],c=u._private.data,d=this.hasElementWithId(c.source)&&t.hasElementWithId(c.target),h=t.hasElementWithId(c.source)&&this.hasElementWithId(c.target);(d||h)&&(!a.thisIsSrc&&!a.thisIsTgt||(!a.thisIsSrc||d)&&(!a.thisIsTgt||h))&&n.push(u)}return this.spawn(n,!0)}}function defineParallelEdgesFunction(e){return e=j({},{codirected:!1},e),function(t){for(var n=[],i=this.edges(),a=e,o=0;o<i.length;o++)for(var s=i[o]._private,l=s.source,u=l._private.data.id,c=s.data.target,d=l._private.edges,h=0;h<d.length;h++){var p=d[h],g=p._private.data,v=g.target,y=g.source,b=v===c&&y===u,x=u===v&&c===y;(a.codirected&&b||!a.codirected&&(b||x))&&n.push(p)}return this.spawn(n,!0).filter(t)}}e7.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},j(e7,{roots:defineDagExtremity({noIncomingEdges:!0}),leaves:defineDagExtremity({noOutgoingEdges:!0}),outgoers:cache(defineDagOneHop({outgoing:!0}),"outgoers"),successors:defineDagAllHops({outgoing:!0}),incomers:cache(defineDagOneHop({incoming:!0}),"incomers"),predecessors:defineDagAllHops({incoming:!0})}),j(e7,{neighborhood:cache(function(e){for(var t=[],n=this.nodes(),i=0;i<n.length;i++)for(var a=n[i],o=a.connectedEdges(),s=0;s<o.length;s++){var l=o[s],u=l.source(),c=l.target(),d=a===u?c:u;d.length>0&&t.push(d[0]),t.push(l[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)}}),e7.neighbourhood=e7.neighborhood,e7.closedNeighbourhood=e7.closedNeighborhood,e7.openNeighbourhood=e7.openNeighborhood,j(e7,{source:cache(function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t},"source"),target:cache(function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t},"target"),sources:defineSourceFunction({attr:"source"}),targets:defineSourceFunction({attr:"target"})}),j(e7,{edgesWith:cache(defineEdgesWithFunction(),"edgesWith"),edgesTo:cache(defineEdgesWithFunction({thisIsSrc:!0}),"edgesTo")}),j(e7,{connectedEdges:cache(function(e){for(var t=[],n=0;n<this.length;n++){var i=this[n];if(i.isNode())for(var a=i._private.edges,o=0;o<a.length;o++){var s=a[o];t.push(s)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:cache(function(e){for(var t=[],n=0;n<this.length;n++){var i=this[n];
vendor: 4,186 bytes, line 1
1i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:cache(defineParallelEdgesFunction(),"parallelEdges"),codirectedEdges:cache(defineParallelEdgesFunction({codirected:!0}),"codirectedEdges")}),j(e7,{components:function(e){var t=this,n=t.cy(),i=n.collection(),a=null==e?t.nodes():e.nodes(),o=[];null!=e&&a.empty()&&(a=e.sources());var visitInComponent=function(e,t){i.merge(e),a.unmerge(e),t.merge(e)};if(a.empty())return t.spawn();do!function(){var e=n.collection();o.push(e);var i=a[0];visitInComponent(i,e),t.bfs({directed:!1,roots:i,visit:function(t){return visitInComponent(t,e)}}),e.forEach(function(n){n.connectedEdges().forEach(function(n){t.has(n)&&e.has(n.source())&&e.has(n.target())&&e.merge(n)})})}();while(a.length>0);return o},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),e7.componentsOf=e7.components;var Collection=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0===e){error("A collection must have a reference to the core");return}var a=new J,o=!1;if(t){if(t.length>0&&plainObject(t[0])&&!element(t[0])){o=!0;for(var s=[],l=new et,u=0,c=t.length;u<c;u++){var d=t[u];null==d.data&&(d.data={});var h=d.data;if(null==h.id)h.id=uuid();else if(e.hasElementWithId(h.id)||l.has(h.id))continue;var p=new Element(e,d,!1);s.push(p),l.add(h.id)}t=s}}else t=[];this.length=0;for(var g=0,v=t.length;g<v;g++){var y=t[g][0];if(null!=y){var b=y._private.data.id;(!n||!a.has(b))&&(n&&a.set(b,{index:this.length,ele:y}),this[this.length]=y,this.length++)}}this._private={eles:this,cy:e,get map(){return null==this.lazyMap&&this.rebuildMap(),this.lazyMap},set map(m){this.lazyMap=m},rebuildMap:function(){for(var e=this.lazyMap=new J,t=this.eles,n=0;n<t.length;n++){var i=t[n];e.set(i.id(),{index:n,ele:i})}}},n&&(this._private.map=a),o&&!i&&this.restore()},te=Element.prototype=Collection.prototype=Object.create(Array.prototype);te.instanceString=function(){return"collection"},te.spawn=function(e,t){return new Collection(this.cy(),e,t)},te.spawnSelf=function(){return this.spawn(this)},te.cy=function(){return this._private.cy},te.renderer=function(){return this._private.cy.renderer()},te.element=function(){return this[0]},te.collection=function(){return collection(this)?this:new Collection(this._private.cy,[this])},te.unique=function(){return new Collection(this._private.cy,this,!0)},te.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},te.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new Collection(t)},te.$id=te.getElementById,te.poolIndex=function(){var e=this._private.cy._private.elements,t=this[0]._private.data.id;return e._private.map.get(t).index},te.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},te.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},te.json=function(e){var t=this.element(),n=this.cy();if(null==t&&e)return this;if(null!=t){var i=t._private;if(plainObject(e)){if(n.startBatch(),e.data){t.data(e.data);var a=i.data;if(t.isEdge()){var o=!1,s={},l=e.data.source,u=e.data.target;null!=l&&l!=a.source&&(s.source=""+l,o=!0),null!=u&&u!=a.target&&(s.target=""+u,o=!0),o&&(t=t.move(s))}else{var c="parent"in e.data,d=e.data.parent;c&&(null!=d||null!=a.parent)&&d!=a.parent&&(void 0===d&&(d=null),null!=d&&(d=""+d),t=t.move({parent:d}))}}e.position&&t.position(e.position);var checkSwitch=function(n,a,o){var s=e[n];null!=s&&s!==i[n]&&(s?t[a]():t[o]())};return checkSwitch("removed","remove","restore"),checkSwitch("selected","select","unselect"),checkSwitch("selectable","selectify","unselectify"),checkSwitch("locked","lock","unlock"),checkSwitch("grabbable","grabify","ungrabify"),checkSwitch("pannable","panify","unpanify"),null!=e.classes&&t.classes(e.classes),n.endBatch(),this}if(void 0===e){var h={data:copy(i.data),position:copy(i.position),group:i.group,removed:i.removed,selected:i.selected,selectable:i.selectable,locked:i.locked,grabbable:i.grabbable,pannable:i.pannable,classes:null};h.classes="";var p=0;
1return i.classes.forEach(function(e){return h.classes+=0==p++?e:" "+e}),h}}},te.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t].json();e.push(n)}return e},te.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var i=this[n].json(),a=new Element(e,i,!1);t.push(a)}return new Collection(e,t)},te.copy=te.clone,te.restore=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.cy(),i=n._private,a=[],o=[],s=0,l=this.length;s<l;s++){var u=this[s];(!t||u.removed())&&(u.isNode()?a.push(u):o.push(u))}M=a.concat(o);var removeFromElements=function(){M.splice(_,1),_--};for(_=0;_<M.length;_++){var c=M[_],d=c._private,h=d.data;if(c.clearTraversalCache(),t||d.removed){if(void 0===h.id)h.id=uuid();else if(number$1(h.id))h.id=""+h.id;else if(emptyString(h.id)||!string(h.id)){error("Can not create element with invalid string ID `"+h.id+"`"),removeFromElements();continue}else if(n.hasElementWithId(h.id)){error("Can not create second element with ID `"+h.id+"`"),removeFromElements();continue}}var p=h.id;if(c.isNode()){var g=d.position;null==g.x&&(g.x=0),null==g.y&&(g.y=0)}if(c.isEdge()){for(var v=["source","target"],y=v.length,b=!1,x=0;x<y;x++){var w=v[x],E=h[w];number$1(E)&&(E=h[w]=""+h[w]),null==E||""===E?(error("Can not create edge `"+p+"` with unspecified "+w),b=!0):n.hasElementWithId(E)||(error("Can not create edge `"+p+"` with nonexistant "+w+" `"+E+"`"),b=!0)}if(b){removeFromElements();continue}var C=n.getElementById(h.source),S=n.getElementById(h.target);C.same(S)?C._private.edges.push(c):(C._private.edges.push(c),S._private.edges.push(c)),c._private.source=C,c._private.target=S}d.map=new J,d.map.set(p,{ele:c,index:0}),d.removed=!1,t&&n.addToPool(c)}for(var P=0;P<a.length;P++){var k=a[P],D=k._private.data;number$1(D.parent)&&(D.parent=""+D.parent);var T=D.parent;if(null!=T||k._private.parent){var B=k._private.parent?n.collection().merge(k._private.parent):n.getElementById(T);if(B.empty())D.parent=void 0;else if(B[0].removed())warn("Node added with missing parent, reference to parent removed"),D.parent=void 0,k._private.parent=null;else{for(var A=!1,I=B;!I.empty();){if(k.same(I)){A=!0,D.parent=void 0;break}I=I.parent()}A||(B[0]._private.children.push(k),k._private.parent=B[0],i.hasCompoundNodes=!0)}}}if(M.length>0){for(var M,_,L=M.length===this.length?this:new Collection(n,M),O=0;O<L.length;O++){var N=L[O];N.isNode()||(N.parallelEdges().clearTraversalCache(),N.source().clearTraversalCache(),N.target().clearTraversalCache())}(i.hasCompoundNodes?n.collection().merge(L).merge(L.connectedNodes()).merge(L.parent()):L).dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?L.emitAndNotify("add"):t&&L.emit("add")}return this},te.removed=function(){var e=this[0];return e&&e._private.removed},te.inside=function(){var e=this[0];return e&&!e._private.removed},te.remove=function(){for(var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=[],i={},a=this._private.cy,o=0,s=this.length;o<s;o++)(function add(e){var a=i[e.id()];t&&e.removed()||a||(i[e.id()]=!0,e.isNode()?(n.push(e),function(e){for(var t=e._private.edges,n=0;n<t.length;n++)add(t[n])}(e),function(e){for(var t=e._private.children,n=0;n<t.length;n++)add(t[n])}(e)):n.unshift(e))})(this[o]);function removeEdgeRef(e,t){removeFromArray(e._private.edges,t),e.clearTraversalCache()}var l=[];l.ids={},this.dirtyCompoundBoundsCache(),t&&a.removeFromPool(n);for(var u=0;u<n.length;u++){var c=n[u];if(c.isEdge()){var d=c.source()[0],h=c.target()[0];removeEdgeRef(d,c),removeEdgeRef(h,c);for(var p=c.parallelEdges(),g=0;g<p.length;g++){var v=p[g];(function(e){e.clearTraversalCache()})(v),v.isBundledBezier()&&v.dirtyBoundingBoxCache()}}else{var y=c.parent();0!==y.length&&function(e,t){t=t[0];var n=(e=e[0])._private.children,i=e.id();removeFromArray(n,t),t._private.parent=null,l.ids[i]||(l.ids[i]=!0,l.push(e))}(y,c)}t&&(c._private.removed=!0)}var b=a._private.elements;a._private.hasCompoundNodes=!1;for(var x=0;x<b.length;x++)if(b[x].isParent()){a._private.hasCompoundNodes=!0;break}var w=new Collection(this.cy(),n);w.size()>0&&(e?w.emitAndNotify("remove"):t&&w.emit("remove"));for(var E=0;E<l.length;
1E++){var C=l[E];t&&C.removed()||C.updateStyle()}return w},te.move=function(e){var t=this._private.cy,n=this,toString=function(e){return null==e?e:""+e};if(void 0!==e.source||void 0!==e.target){var i=toString(e.source),a=toString(e.target),o=null!=i&&t.hasElementWithId(i),s=null!=a&&t.hasElementWithId(a);(o||s)&&(t.batch(function(){n.remove(!1,!1),n.emitAndNotify("moveout");for(var e=0;e<n.length;e++){var t=n[e],l=t._private.data;t.isEdge()&&(o&&(l.source=i),s&&(l.target=a))}n.restore(!1,!1)}),n.emitAndNotify("move"))}else if(void 0!==e.parent){var l=toString(e.parent);if(null===l||t.hasElementWithId(l)){var u=null===l?void 0:l;t.batch(function(){var e=n.remove(!1,!1);e.emitAndNotify("moveout");for(var t=0;t<n.length;t++){var i=n[t],a=i._private.data;i.isNode()&&(a.parent=u)}e.restore(!1,!1)}),n.emitAndNotify("move")}}return this},[eC,eD,eT,ez,eR,o,eF,eY,eZ,eJ,{isNode:function(){return"nodes"===this.group()},isEdge:function(){return"edges"===this.group()},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}},e0,e2,e5,e8,e7].forEach(function(e){j(te,e)});/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var tt=function(){function springAccelerationForState(e){return-e.tension*e.x-e.friction*e.v}function springEvaluateStateWithDerivative(e,t,n){var i={x:e.x+n.dx*t,v:e.v+n.dv*t,tension:e.tension,friction:e.friction};return{dx:i.v,dv:springAccelerationForState(i)}}return function springRK4Factory(e,t,n){var i,a,o,s,l,u,c,d,h,p={x:-1,v:0,tension:null,friction:null},g=[0],v=0;for(e=parseFloat(e)||500,t=parseFloat(t)||20,n=n||null,p.tension=e,p.friction=t,h=(d=null!==n)?(v=springRK4Factory(e,t))/n*.016:.016;a={dx:(i=last_state||p).v,dv:springAccelerationForState(i)},o=springEvaluateStateWithDerivative(i,.5*h,a),s=springEvaluateStateWithDerivative(i,.5*h,o),l=springEvaluateStateWithDerivative(i,h,s),u=1/6*(a.dx+2*(o.dx+s.dx)+l.dx),c=1/6*(a.dv+2*(o.dv+s.dv)+l.dv),i.x=i.x+u*h,i.v=i.v+c*h,g.push(1+i.x),v+=16,Math.abs(i.x)>1e-4&&Math.abs(i.v)>1e-4;);return d?function(e){return g[e*(g.length-1)|0]}:v}}(),cubicBezier=function(e,t,n,i){var a=/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function(e,t,n,i){var a="undefined"!=typeof Float32Array;if(4!=arguments.length)return!1;for(var o=0;o<4;++o)if("number"!=typeof arguments[o]||isNaN(arguments[o])||!isFinite(arguments[o]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var s=a?new Float32Array(11):Array(11);function calcBezier(e,t,n){return(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e}function getSlope(e,t,n){return 3*(1-3*n+3*t)*e*e+2*(3*n-6*t)*e+3*t}var l=!1,f=function(a){return(l||(l=!0,(e!==t||n!==i)&&function(){for(var t=0;t<11;++t)s[t]=calcBezier(.1*t,e,n)}()),e===t&&n===i)?a:0===a?0:1===a?1:calcBezier(function(t){for(var i=0,a=1;10!==a&&s[a]<=t;++a)i+=.1;var o=i+(t-s[--a])/(s[a+1]-s[a])*.1,l=getSlope(o,e,n);return l>=.001?function(t,i){for(var a=0;a<4;++a){var o=getSlope(i,e,n);if(0===o)break;var s=calcBezier(i,e,n)-t;i-=s/o}return i}(t,o):0===l?o:function(t,i,a){var o,s,l=0;do(o=calcBezier(s=i+(a-i)/2,e,n)-t)>0?a=s:i=s;while(Math.abs(o)>1e-7&&++l<10);return s}(t,i,i+.1)}(a),t,i)};f.getControlPoints=function(){return[{x:e,y:t},{x:n,y:i}]};var u="generateBezier("+[e,t,n,i]+")";return f.toString=function(){return u},f}(e,t,n,i);return function(e,t,n){return e+(t-e)*a(n)}},tn={linear:function(e,t,n){return e+(t-e)*n},ease:cubicBezier(.25,.1,.25,1),"ease-in":cubicBezier(.42,0,1,1),"ease-out":cubicBezier(0,0,.58,1),"ease-in-out":cubicBezier(.42,0,.58,1),"ease-in-sine":cubicBezier(.47,0,.745,.715),"ease-out-sine":cubicBezier(.39,.575,.565,1),"ease-in-out-sine":cubicBezier(.445,.05,.55,.95),"ease-in-quad":cubicBezier(.55,.085,.68,.53),"ease-out-quad":cubicBezier(.25,.46,.45,.94),"ease-in-out-quad":cubicBezier(.455,.03,.515,.955),"ease-in-cubic":cubicBezier(.55,.055,.675,.19),"ease-out-cubic":cubicBezier(.215,.61,.355,1),"ease-in-out-cubic":cubicBezier(.645,.045,.355,1),"ease-in-quart":cubicBezier(.895,.03,.685,.22),"ease-out-quart":cubicBezier(.165,.84,.44,1),"ease-in-out-quart":cubicBezier(.77,0,.175,1
1),"ease-in-quint":cubicBezier(.755,.05,.855,.06),"ease-out-quint":cubicBezier(.23,1,.32,1),"ease-in-out-quint":cubicBezier(.86,0,.07,1),"ease-in-expo":cubicBezier(.95,.05,.795,.035),"ease-out-expo":cubicBezier(.19,1,.22,1),"ease-in-out-expo":cubicBezier(1,0,0,1),"ease-in-circ":cubicBezier(.6,.04,.98,.335),"ease-out-circ":cubicBezier(.075,.82,.165,1),"ease-in-out-circ":cubicBezier(.785,.135,.15,.86),spring:function(e,t,n){if(0===n)return tn.linear;var i=tt(e,t,n);return function(e,t,n){return e+(t-e)*i(n)}},"cubic-bezier":cubicBezier};function getEasedValue(e,t,n,i,a){if(1===i||t===n)return n;var o=a(t,n,i);return null==e||((e.roundValue||e.color)&&(o=Math.round(o)),void 0!==e.min&&(o=Math.max(o,e.min)),void 0!==e.max&&(o=Math.min(o,e.max))),o}function getValue(e,t){return null==e.pfValue&&null==e.value?e:null!=e.pfValue&&(null==t||"%"!==t.type.units)?e.pfValue:e.value}function ease(e,t,n,i,a){var o=null!=a?a.type:null;n<0?n=0:n>1&&(n=1);var s=getValue(e,a),l=getValue(t,a);if(number$1(s)&&number$1(l))return getEasedValue(o,s,l,n,i);if(array(s)&&array(l)){for(var u=[],c=0;c<l.length;c++){var d=s[c],h=l[c];if(null!=d&&null!=h){var p=getEasedValue(o,d,h,n,i);u.push(p)}else u.push(h)}return u}}function valid(e,t){return null!=e&&null!=t&&(!!(number$1(e)&&number$1(t))||!!e&&!!t)}function stepAll(e,t){var n=t._private.aniEles,i=[];function stepOne(t,n){var a=t._private,o=a.animation.current,s=a.animation.queue,l=!1;if(0===o.length){var u=s.shift();u&&o.push(u)}for(var callbacks=function(e){for(var t=e.length-1;t>=0;t--)(0,e[t])();e.splice(0,e.length)},c=o.length-1;c>=0;c--){var d=o[c],h=d._private;if(h.stopped){o.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,callbacks(h.frames);continue}(h.playing||h.applying)&&(h.playing&&h.applying&&(h.applying=!1),h.started||function(e,t,n,i){var a=t._private;a.started=!0,a.startTime=n-a.progress*a.duration}(0,d,e),function(e,t,n,i){var a,o,s,l,u=!i,c=e._private,d=t._private,h=d.easing,p=d.startTime,g=(i?e:e.cy()).style();d.easingImpl||(null==h?d.easingImpl=tn.linear:(a=string(h)?g.parse("transition-timing-function",h).value:h,string(a)?(o=a,s=[]):(o=a[1],s=a.slice(2).map(function(e){return+e})),s.length>0?("spring"===o&&s.push(d.duration),d.easingImpl=tn[o].apply(null,s)):d.easingImpl=tn[o]));var v=d.easingImpl;if(l=0===d.duration?1:(n-p)/d.duration,d.applying&&(l=d.progress),l<0?l=0:l>1&&(l=1),null==d.delay){var y=d.startPosition,b=d.position;if(b&&u&&!e.locked()){var x={};valid(y.x,b.x)&&(x.x=ease(y.x,b.x,l,v)),valid(y.y,b.y)&&(x.y=ease(y.y,b.y,l,v)),e.position(x)}var w=d.startPan,E=d.pan,C=c.pan,S=null!=E&&i;S&&(valid(w.x,E.x)&&(C.x=ease(w.x,E.x,l,v)),valid(w.y,E.y)&&(C.y=ease(w.y,E.y,l,v)),e.emit("pan"));var P=d.startZoom,k=d.zoom,D=null!=k&&i;D&&(valid(P,k)&&(c.zoom=bound(c.minZoom,ease(P,k,l,v),c.maxZoom)),e.emit("zoom")),(S||D)&&e.emit("viewport");var T=d.style;if(T&&T.length>0&&u){for(var B=0;B<T.length;B++){var A=T[B],I=A.name,M=d.startStyle[I],_=g.properties[M.name],L=ease(M,A,l,v,_);g.overrideBypass(e,I,L)}e.emit("style")}}d.progress=l}(t,d,e,n),h.applying&&(h.applying=!1),callbacks(h.frames),null!=h.step&&h.step(e),d.completed()&&(o.splice(c,1),h.hooked=!1,h.playing=!1,h.started=!1,callbacks(h.completes)),l=!0)}return n||0!==o.length||0!==s.length||i.push(t),l}for(var a=!1,o=0;o<n.length;o++){var s=stepOne(n[o]);a=a||s}var l=stepOne(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(i),t.emit("step")}var tr={animate:ek.animate(),animation:ek.animation(),animated:ek.animated(),clearQueue:ek.clearQueue(),delay:ek.delay(),delayAnimation:ek.delayAnimation(),stop:ek.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){stepAll(n,e)},t.beforeRenderPriorities.animations):function headlessStep(){e._private.animationsRunning&&requestAnimationFrame(function(t){stepAll(t,e),headlessStep()})}()}}},ti={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)}
1,eventMatches:function(e,t,n){var i=t.qualifier;return null==i||e!==n.target&&element(n.target)&&i.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}},argSelector=function(e){return string(e)?new Selector(e):e},ta={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Emitter(ti,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,argSelector(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,argSelector(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,argSelector(t),n),this},once:function(e,t,n){return this.emitter().one(e,argSelector(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}};ek.eventAliasesOn(ta);var to={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)}};to.jpeg=to.jpg;var ts={layout:function(e){if(null==e){error("Layout options must be specified to make a layout");return}if(null==e.name){error("A `name` must be specified to make a layout");return}var t,n=e.name,i=this.extension("layout",n);if(null==i){error("No such layout `"+n+"` found.  Did you forget to import it and `cytoscape.use()` it?");return}return t=string(e.eles)?this.$(e.eles):null!=e.eles?e.eles:this.$(),new i(j({},e,{cy:this,eles:t}))}};ts.createLayout=ts.makeLayout=ts.layout;var tl=defaults$g({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1}),tu={renderTo:function(e,t,n,i){return this._private.renderer.renderTo(e,t,n,i),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(e){var t=this.extension("renderer",e.name);if(null==t){error("Can not initialise: No such renderer `".concat(e.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}void 0!==e.wheelSensitivity&&warn("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=tl(e);n.cy=this,this._private.renderer=new t(n),this.notify("init")},destroyRenderer:function(){this.notify("destroy");var e=this.container();if(e)for(e._cyreg=null;e.childNodes.length>0;)e.removeChild(e.childNodes[0]);this._private.renderer=null,this.mutableElements().forEach(function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]})},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};tu.invalidateDimensions=tu.resize;var tc={collection:function(e,t){return string(e)?this.$(e):elementOrCollection(e)?e.collection():array(e)?(t||(t={}),new Collection(this,e,t.unique,t.removed)):new Collection(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}};tc.elements=tc.filter=tc.$;var td={};td.apply=function(e){for(var t=this._private.cy.collection(),n=0;n<e.length;n++){var i=e[n],a=this.getContextMeta(i);if(!a.empty){var o=this.getContextStyle(a),s=this.applyContextStyle(a,o,i);i._private.appliedInitStyle?this.updateTransitions(i,s.diffProps):i._private.appliedInitStyle=!0,this.updateStyleHints(i)&&t.push(i)}}return t},td.getPropertiesDiff=function(e,t){var n=this._private.propDiffs=this._private.propDiffs||{},i=e+"-"+t,a=n[i];if(a)return a;for(var o=[],s={},l=0;l<this.length;l++){var u=this[l],c="t"===e[l],d="t"===t[l],h=c!==d,p=u.mappedProperties.length>0;if(h||d&&p){var g=void 0;h&&p?g=u.properties:h?g=u.properties:p&&(g=u.mappedProperties);for(var v=0;v<g.length;v++){for(var y=g[v],b=y.name,x=!1,w=l+1;w<this.length;w++){var E=this[w];if("t"===t[w]&&(x=null!=E.properties[y.name]))break}s[b]||x||(s[b]=!0,o.push(b))}}}return n[i]=o,o},td.getContextMeta=function(e){for(var t,n="",i=e._private.styleCxtKey||"",a=0;a<this.length;a++){var o=this[a];o.selector&&o.selector.matches(e)?n+="t":n+="f"}return t=this.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:t,empty:0===t.length}},td.getContextStyle=function(e){var t=e.key,n=this._private.contextStyles=this._private.contextStyles||{};if(n[t])return n[t];for(var i={_private:{key:t}},a=0;a<this.length;a++){var o=this[a];if("t"===t[a])for(var s=0;s<o.properties.length;s++){var l=o.properties[s];i[l.name]=l}}return n[t]=i,i},td.applyContextStyle=function(e,t,n){for(var i=e.diffPropNames,a={},o=this.types,s=0;s<i.length;s++){var l=i[s],u=t[l],c=n.pstyle(l);
1if(!u){if(!c)continue;u=c.bypass?{name:l,deleteBypassed:!0}:{name:l,delete:!0}}if(c!==u){if(u.mapped===o.fn&&null!=c&&null!=c.mapping&&c.mapping.value===u.value){var d=c.mapping;if((d.fnValue=u.value(n))===d.prevFnValue)continue}var h=a[l]={prev:c};this.applyParsedProperty(n,u),h.next=n.pstyle(l),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:a}},td.updateStyleHints=function(e){var t=e._private,n=this,i=n.propertyGroupNames,a=n.propertyGroupKeys,propHash=function(e,t,i){return n.getPropertiesHash(e,t,i)},o=t.styleKey;if(e.removed())return!1;var s="nodes"===t.group,l=e._private.style;i=Object.keys(l);for(var u=0;u<a.length;u++){var c=a[u];t.styleKeys[c]=[9261,5381]}for(var updateGrKey1=function(e,n){return t.styleKeys[n][0]=hashInt(e,t.styleKeys[n][0])},updateGrKey2=function(e,n){return t.styleKeys[n][1]=hashIntAlt(e,t.styleKeys[n][1])},updateGrKeyWStr=function(e,t){for(var n=0;n<e.length;n++){var i=e.charCodeAt(n);updateGrKey1(i,t),updateGrKey2(i,t)}},d=0;d<i.length;d++){var h,p,g=i[d],v=l[g];if(null!=v){var y=this.properties[g],b=y.type,x=y.groupKey,w=void 0;null!=y.hashOverride?w=y.hashOverride(e,v):null!=v.pfValue&&(w=v.pfValue);var E=null==y.enums?v.value:null,C=null!=w,S=null!=E,P=C||S,k=v.units;b.number&&P&&!b.multiple?(updateGrKey1(p=-128<(h=C?w:E)&&h<128&&Math.floor(h)!==h?2e9-(1024*h|0):h,x),updateGrKey2(p,x),C||null==k||updateGrKeyWStr(k,x)):updateGrKeyWStr(v.strValue,x)}}for(var D=[9261,5381],T=0;T<a.length;T++){var B=a[T],A=t.styleKeys[B];D[0]=hashInt(A[0],D[0]),D[1]=hashIntAlt(A[1],D[1])}t.styleKey=2097152*D[0]+D[1];var I=t.styleKeys;t.labelDimsKey=combineHashesArray(I.labelDimensions);var M=propHash(e,["label"],I.labelDimensions);if(t.labelKey=combineHashesArray(M),t.labelStyleKey=combineHashesArray(hashArrays(I.commonLabel,M)),!s){var _=propHash(e,["source-label"],I.labelDimensions);t.sourceLabelKey=combineHashesArray(_),t.sourceLabelStyleKey=combineHashesArray(hashArrays(I.commonLabel,_));var L=propHash(e,["target-label"],I.labelDimensions);t.targetLabelKey=combineHashesArray(L),t.targetLabelStyleKey=combineHashesArray(hashArrays(I.commonLabel,L))}if(s){var O=t.styleKeys,N=O.nodeBody,z=O.nodeBorder,R=O.nodeOutline,F=O.backgroundImage,V=O.compound,q=O.pie,j=[N,z,R,F,V,q].filter(function(e){return null!=e}).reduce(hashArrays,[9261,5381]);t.nodeKey=combineHashesArray(j),t.hasPie=null!=q&&9261!==q[0]&&5381!==q[1]}return o!==t.styleKey},td.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},td.applyParsedProperty=function(e,t){var n=this,i=t,a=e._private.style,o=n.types,s=n.properties[i.name].type,l=i.bypass,u=a[i.name],c=u&&u.bypass,d=e._private,h="mapping",getVal=function(e){return null==e?null:null!=e.pfValue?e.pfValue:e.value},checkTriggers=function(){var t=getVal(u),a=getVal(i);n.checkTriggers(e,i.name,t,a)};if("curve-style"===t.name&&e.isEdge()&&("bezier"!==t.value&&e.isLoop()||"haystack"===t.value&&(e.source().isParent()||e.target().isParent()))&&(i=t=this.parse(t.name,"bezier",l)),i.delete)return a[i.name]=void 0,checkTriggers(),!0;if(i.deleteBypassed)return u?!!u.bypass&&(u.bypassed=void 0,checkTriggers(),!0):(checkTriggers(),!0);if(i.deleteBypass)return u?!!u.bypass&&(a[i.name]=u.bypassed,checkTriggers(),!0):(checkTriggers(),!0);var printMappingErr=function(){warn("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+i.name+"` with data field `"+i.field+"`); try a `["+i.field+"]` selector to limit scope to elements with `"+i.field+"` defined")};switch(i.mapped){case o.mapData:for(var p,g,v=i.field.split("."),y=d.data,b=0;b<v.length&&y;b++)y=y[v[b]];if(null==y)return printMappingErr(),!1;if(!number$1(y))return warn("Do not use continuous mappers without specifying numeric data (i.e. `"+i.field+": "+y+"` for `"+e.id()+"` is non-numeric)"),!1;var x=i.fieldMax-i.fieldMin;if((g=0===x?0:(y-i.fieldMin)/x)<0?g=0:g>1&&(g=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],C=i.valueMin[1],S=i.valueMax[1],P=i.valueMin[2],k=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],T=[Math.round(w+(E-w)*g),Math.round(C+(S-C)*g),Math.round(P+(k-P)*g),Math.round(D+((null==i.valueMax[3]?1:i.valueMax[3])-D)*g)];p={bypass:i.bypass,name:i.name,value:T,strValue:"rgb("+T[0]+", "+T[1]+", "+T[2]+")"}}else{if(!s.number)return!1;var B=i.valueMin+(i.valueMax-i.valueMin)*g;p=this.parse(i.name,B,i.bypass,h)}if(!p)return printMappingErr(),!1;p.mapping=i,i=p;break;case o.data:for(var A=i.field.split("."),I=d.data,M=0;M<A.length&&I;M++)I=I[A[M]];if(null!=I&&(p=this.parse(i.name,I,i.bypass,h)),!p)return printMappingErr(),!1;p.mapping=i,i=p;break;case o.fn:var _=i.value,L=null!=i.fnValue?i.fnValue:_(e);if(i.prevFnValue=L,null==L)return warn("Custom function mappers may not return null (i.e. `"+i.name+"` for ele `"+e.id()+"` is null)"),!1;if(!(p=this.parse(i.name,L,i.bypass,h)))return warn("Custom function mappers may not return invalid values for the property type (i.e. `"+i.name+"` for ele `"+e.id()+"` is invali
1d)"),!1;p.mapping=copy(i),i=p;break;case void 0:break;default:return!1}return l?(c?i.bypassed=u.bypassed:i.bypassed=u,a[i.name]=i):c?u.bypassed=i:a[i.name]=i,checkTriggers(),!0},td.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var i=e[n];if(this.clearStyleHints(i),i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),t)for(var a=i._private.style,o=Object.keys(a),s=0;s<o.length;s++){var l=o[s],u=a[l];null!=u&&(u.bypass?u.bypassed=null:a[l]=null)}else i._private.style={}}},td.update=function(){this._private.cy.mutableElements().updateStyle()},td.updateTransitions=function(e,t){var n=this,i=e._private,a=e.pstyle("transition-property").value,o=e.pstyle("transition-duration").pfValue,s=e.pstyle("transition-delay").pfValue;if(a.length>0&&o>0){for(var l={},u=!1,c=0;c<a.length;c++){var d=a[c],h=e.pstyle(d),p=t[d];if(p){var g=p.prev,v=null!=p.next?p.next:h,y=!1,b=void 0;g&&(number$1(g.pfValue)&&number$1(v.pfValue)?(y=v.pfValue-g.pfValue,b=g.pfValue+1e-6*y):number$1(g.value)&&number$1(v.value)?(y=v.value-g.value,b=g.value+1e-6*y):array(g.value)&&array(v.value)&&(y=g.value[0]!==v.value[0]||g.value[1]!==v.value[1]||g.value[2]!==v.value[2],b=g.strValue),y&&(l[d]=v.strValue,this.applyBypass(e,d,b),u=!0))}}if(!u)return;i.transitioning=!0,new eS(function(t){s>0?e.delayAnimation(s).play().promise().then(t):t()}).then(function(){return e.animation({style:l,duration:o,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,a),e.emitAndNotify("style"),i.transitioning=!1})}else i.transitioning&&(this.removeBypasses(e,a),e.emitAndNotify("style"),i.transitioning=!1)},td.checkTrigger=function(e,t,n,i,a,o){var s=this.properties[t],l=a(s);null!=l&&l(n,i)&&o(s)},td.checkZOrderTrigger=function(e,t,n,i){var a=this;this.checkTrigger(e,t,n,i,function(e){return e.triggersZOrder},function(){a._private.cy.notify("zorder",e)})},td.checkBoundsTrigger=function(e,t,n,i){this.checkTrigger(e,t,n,i,function(e){return e.triggersBounds},function(a){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache(),a.triggersBoundsOfParallelBeziers&&"curve-style"===t&&("bezier"===n||"bezier"===i)&&e.parallelEdges().forEac
1h(function(e){e.isBundledBezier()&&e.dirtyBoundingBoxCache()}),a.triggersBoundsOfConnectedEdges&&"display"===t&&("none"===n||"none"===i)&&e.connectedEdges().forEach(function(e){e.dirtyBoundingBoxCache()})})},td.checkTriggers=function(e,t,n,i){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,i),this.checkBoundsTrigger(e,t,n,i)};var th={};th.applyBypass=function(e,t,n,i){var a=[];if("*"===t||"**"===t){if(void 0!==n)for(var o=0;o<this.properties.length;o++){var s=this.properties[o].name,l=this.parse(s,n,!0);l&&a.push(l)}}else if(string(t)){var u=this.parse(t,n,!0);u&&a.push(u)}else{if(!plainObject(t))return!1;i=n;for(var c=Object.keys(t),d=0;d<c.length;d++){var h=c[d],p=t[h];if(void 0===p&&(p=t[O(h)]),void 0!==p){var g=this.parse(h,p,!0);g&&a.push(g)}}}if(0===a.length)return!1;for(var v=!1,y=0;y<e.length;y++){for(var b=e[y],x={},w=void 0,E=0;E<a.length;E++){var C=a[E];if(i){var S=b.pstyle(C.name);w=x[C.name]={prev:S}}v=this.applyParsedProperty(b,copy(C))||v,i&&(w.next=b.pstyle(C.name))}v&&this.updateStyleHints(b),i&&this.updateTransitions(b,x,!0)}return v},th.overrideBypass=function(e,t,n){t=L(t);for(var i=0;i<e.length;i++){var a=e[i],o=a._private.style[t],s=this.properties[t].type,l=s.color,u=s.mutiple,c=o?null!=o.pfValue?o.pfValue:o.value:null;o&&o.bypass?(o.value=n,null!=o.pfValue&&(o.pfValue=n),l?o.strValue="rgb("+n.join(",")+")":u?o.strValue=n.join(" "):o.strValue=""+n,this.updateStyleHints(a)):this.applyBypass(a,t,n),this.checkTriggers(a,t,c,n)}},th.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},th.removeBypasses=function(e,t,n){for(var i=0;i<e.length;i++){for(var a=e[i],o={},s=0;s<t.length;s++){var l=t[s],u=this.properties[l],c=a.pstyle(u.name);if(c&&c.bypass){var d=this.parse(l,"",!0),h=o[u.name]={prev:c};this.applyParsedProperty(a,d),h.next=a.pstyle(u.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,o,!0)}};var tp={};tp.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return null!=e?parseFloat(e):1},tp.containerCss=function(e){var t=this._private.cy,n=t.container(),i=t.window();if(i&&n&&i.getComputedStyle)return i.getComputedStyle(n).getPropertyValue(e)};var tg={};tg.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},tg.getRawStyle=function(e,t){if(e=e[0]){for(var n={},i=0;i<this.properties.length;i++){var a=this.properties[i],o=this.getStylePropertyValue(e,a.name,t);null!=o&&(n[a.name]=o,n[O(a.name)]=o)}return n}},tg.getIndexedStyle=function(e,t,n,i){var a=e.pstyle(t)[n][i];return null!=a?a:e.cy().style().getDefaultProperty(t)[n][0]},tg.getStylePropertyValue=function(e,t,n){if(e=e[0]){var i=this.properties[t];i.alias&&(i=i.pointsTo);
1var a=i.type,o=e.pstyle(i.name);if(o){var s=o.value,l=o.units,u=o.strValue;if(n&&a.number&&null!=s&&number$1(s)){var c=e.cy().zoom(),getRenderedValue=function(e){return e*c},getValueStringWithUnits=function(e,t){return getRenderedValue(e)+t},d=array(s);return(d?l.every(function(e){return null!=e}):null!=l)?d?s.map(function(e,t){return getValueStringWithUnits(e,l[t])}).join(" "):getValueStringWithUnits(s,l):d?s.map(function(e){return string(e)?e:""+getRenderedValue(e)}).join(" "):""+getRenderedValue(s)}if(null!=u)return u}return null}},tg.getAnimationStartStyle=function(e,t){for(var n={},i=0;i<t.length;i++){var a=t[i].name,o=e.pstyle(a);void 0!==o&&(o=plainObject(o)?this.parse(a,o.strValue):this.parse(a,o)),o&&(n[a]=o)}return n},tg.getPropsList=function(e){var t=[],n=this.properties;if(e)for(var i=Object.keys(e),a=0;a<i.length;a++){var o=i[a],s=e[o],l=n[o]||n[L(o)],u=this.parse(l.name,s);u&&t.push(u)}return t},tg.getNonDefaultPropertiesHash=function(e,t,n){var i,a,o,s,l,u,c=n.slice();for(l=0;l<t.length;l++)if(i=t[l],null!=(a=e.pstyle(i,!1))){if(null!=a.pfValue)c[0]=hashInt(s,c[0]),c[1]=hashIntAlt(s,c[1]);else for(u=0,o=a.strValue;u<o.length;u++)s=o.charCodeAt(u),c[0]=hashInt(s,c[0]),c[1]=hashIntAlt(s,c[1])}return c},tg.getPropertiesHash=tg.getNonDefaultPropertiesHash;var tv={};tv.appendFromJson=function(e){for(var t=0;t<e.length;t++){var n=e[t],i=n.selector,a=n.style||n.css,o=Object.keys(a);this.selector(i);for(var s=0;s<o.length;s++){var l=o[s],u=a[l];this.css(l,u)}}return this},tv.fromJson=function(e){return this.resetToDefault(),this.appendFromJson(e),this},tv.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],i=n.selector,a=n.properties,o={},s=0;s<a.length;s++){var l=a[s];o[l.name]=l.strValue}e.push({selector:i?i.toString():"core",style:o})}return e};var ty={};ty.appendFromString=function(e){var t,n,i,a=""+e;function removeSelAndBlockFromRemaining(){a=a.length>t.length?a.substr(t.length):""}function removePropAndValFromRem(){n=n.length>i.length?n.substr(i.length):""}for(a=a.replace(/[/][*](\s|.)+?[*][/]/g,"");!a.match(/^\s*$/);){var o=a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!o){warn("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+a);break}t=o[0];var s=o[1];if("core"!==s&&new Selector(s).invalid){warn("Skipping parsing of block: Invalid selector found in string stylesheet: "+s),removeSelAndBlockFromRemaining();continue}var l=o[2],u=!1;n=l;for(var c=[];!n.match(/^\s*$/);){var d=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!d){warn("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+l),u=!0;break}i=d[0];var h=d[1],p=d[2];if(!this.properties[h]){warn("Skipping property: Invalid property name in: "+i),removePropAndValFromRem();continue}if(!this.parse(h,p)){warn("Skipping property: Invalid property definition in: "+i),removePropAndValFromRem();continue}c.push({name:h,val:p}),removePropAndValFromRem()}if(u){removeSelAndBlockFromRemaining();break}this.selector(s);for(var g=0;g<c.length;g++){var v=c[g];this.css(v.name,v.val)}removeSelAndBlockFromRemaining()}return this},ty.fromString=function(e){return this.resetToDefault(),this.appendFromString(e),this};var tm={};!function(){var data=function(e){return"^"+e+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},mapData=function(e){var t=z+"|\\w+|"+F+"|"+q+"|\\#[0-9a-fA-F]{3}|\\#[0-9a-fA-F]{6}";return"^"+e+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+z+")\\s*\\,\\s*("+z+")\\s*,\\s*("+t+")\\s*\\,\\s*("+t+")\\)$"},e=["^url\\s*\\(\\s*['\"]?(.+?)['\"]?\\s*\\)$","^(none)$","^(.+)$"];tm.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}
vendor: 6,505 bytes, line 1
1,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"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi"]},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"]},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:data("data")},layoutData:{mapping:!0,regex:data("layoutData")},scratch:{mapping:!0,regex:data("scratch")},mapData:{mapping:!0,regex:mapData("mapData")},mapLayoutData:{mapping:!0,regex:mapData("mapLayoutData")},mapScratch:{mapping:!0,regex:mapData("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:e,singleRegexMatchValue:!0},urls:{regexes:e,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(e,t){switch(e.length){case 2:return"deg"!==t[0]&&"rad"!==t[0]&&"deg"!==t[1]&&"rad"!==t[1];case 1:return string(e[0])||"deg"===t[0]||"rad"===t[0];default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+z+")\\s*,\\s*("+z+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+z+")\\s*,\\s*("+z+")\\s*,\\s*("+z+")\\s*,\\s*("+z+")\\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(e){var t=e.length;return 1===t||2===t||4===t}}};var t={zeroNonZero:function(e,t){return(null==e||null==t)&&e!==t||0==e&&0!=t||0!=e&&0==t},any:function(e,t){return e!=t},emptyNonEmpty:function(e,t){var n=emptyString(e),i=emptyString(t);return n&&!i||!n&&i}},n=tm.types,i=[{name:"label",type:n.text,triggersBounds:t.any,triggersZOrder:t.emptyNonEmpty},{name:"text-rotation",type:n.textRotation,triggersBounds:t.any},{name:"text-margin-x",type:n.bidirectionalSize,triggersBounds:t.any},{name:"text-margin-y",type:n.bidirectionalSize,triggersBounds:t.any}],a=[{name:"source-label",type:n.text,triggersBounds:t.any},{name:"source-text-rotation",type:n.textRotation,triggersBounds:t.any},{name:"source-text-margin-x",type:n.bidirectionalSize,triggersBounds:t.any},{name:"source-text-margin-y",type:n.bidirectionalSize,triggersBounds:t.any},{name:"source-text-offset",type:n.size,triggersBounds:t.any}],o=[{name:"target-label",type:n.text,triggersBounds:t.any},{name:"target-text-rotation",type:n.textRotation,triggersBounds:t.any},{name:"target-text-margin-x",type:n.bidirectionalSize,triggersBounds:t.any},{name:"target-text-margin-y",type:n.bidirectionalSize,triggersBounds:t.any},{name:"target-text-offset",type:n.size,triggersBounds:t.any}],s=[{name:"font-family",type:n.fontFamily,triggersBounds:t.any},{name:"font-style",type:n.fontStyle,triggersBounds:t.any},{name:"font-weight",type:n.fontWeight,triggersBounds:t.any},{name:"font-size",type:n.size,triggersBounds:t.any},{name:"text-transform",type:n.textTransform,triggersBounds:t.any},{name:"text-wrap",type:n.textWrap,triggersBounds:t.any},{name:"text-overflow-wrap",type:n.textOverflowWrap,triggersBounds:t.any},{name:"text-max-width",type:n.size,triggersBounds:t.any},{name:"text-outline-width",type:n.size,triggersBounds:t.any},{name:"line-height",type:n.positiveNumber,triggersBounds:t.any}],l=[{name:"text-valign",type:n.valign,triggersBounds:t.any},{name:"text-halign",type:n.halign,triggersBounds:t.any},{name:"color",type:n.color},{name:"text-outline-color",type:n.color},{name:"text-outline-opacity",type:n.zeroOneNumber},{name:"text-background-color",type:n.color},{name:"text-background-opacity",type:n.zeroOneNumber},{name:"text-background-padding",type:n.size,triggersBounds:t.any},{name:"text-border-opacity",type:n.zeroOneNumber},{name:"text-border-color",type:n.color},{name:"text-border-width",type:n.size,triggersBounds:t.any},{name:"text-border-style",type:n.borderStyle,triggersBounds:t.any}
1,{name:"text-background-shape",type:n.textBackgroundShape,triggersBounds:t.any},{name:"text-justification",type:n.justification}],u=[{name:"events",type:n.bool,triggersZOrder:t.any},{name:"text-events",type:n.bool,triggersZOrder:t.any}],c=[{name:"display",type:n.display,triggersZOrder:t.any,triggersBounds:t.any,triggersBoundsOfConnectedEdges:!0},{name:"visibility",type:n.visibility,triggersZOrder:t.any},{name:"opacity",type:n.zeroOneNumber,triggersZOrder:t.zeroNonZero},{name:"text-opacity",type:n.zeroOneNumber},{name:"min-zoomed-font-size",type:n.size},{name:"z-compound-depth",type:n.zCompoundDepth,triggersZOrder:t.any},{name:"z-index-compare",type:n.zIndexCompare,triggersZOrder:t.any},{name:"z-index",type:n.number,triggersZOrder:t.any}],d=[{name:"overlay-padding",type:n.size,triggersBounds:t.any},{name:"overlay-color",type:n.color},{name:"overlay-opacity",type:n.zeroOneNumber,triggersBounds:t.zeroNonZero},{name:"overlay-shape",type:n.overlayShape,triggersBounds:t.any}],h=[{name:"underlay-padding",type:n.size,triggersBounds:t.any},{name:"underlay-color",type:n.color},{name:"underlay-opacity",type:n.zeroOneNumber,triggersBounds:t.zeroNonZero},{name:"underlay-shape",type:n.overlayShape,triggersBounds:t.any}],p=[{name:"transition-property",type:n.propList},{name:"transition-duration",type:n.time},{name:"transition-delay",type:n.time},{name:"transition-timing-function",type:n.easing}],nodeSizeHashOverride=function(e,t){return"label"===t.value?-e.poolIndex():t.pfValue},g=[{name:"height",type:n.nodeSize,triggersBounds:t.any,hashOverride:nodeSizeHashOverride},{name:"width",type:n.nodeSize,triggersBounds:t.any,hashOverride:nodeSizeHashOverride},{name:"shape",type:n.nodeShape,triggersBounds:t.any},{name:"shape-polygon-points",type:n.polygonPointList,triggersBounds:t.any},{name:"background-color",type:n.color},{name:"background-fill",type:n.fill},{name:"background-opacity",type:n.zeroOneNumber},{name:"background-blacken",type:n.nOneOneNumber},{name:"background-gradient-stop-colors",type:n.colors},{name:"background-gradient-stop-positions",type:n.percentages},{name:"background-gradient-direction",type:n.gradientDirection},{name:"padding",type:n.sizeMaybePercent,triggersBounds:t.any},{name:"padding-relative-to",type:n.paddingRelativeTo,triggersBounds:t.any},{name:"bounds-expansion",type:n.boundsExpansion,triggersBounds:t.any}],v=[{name:"border-color",type:n.color},{name:"border-opacity",type:n.zeroOneNumber},{name:"border-width",type:n.size,triggersBounds:t.any},{name:"border-style",type:n.borderStyle}],y=[{name:"outline-color",type:n.color},{name:"outline-opacity",type:n.zeroOneNumber},{name:"outline-width",type:n.size,triggersBounds:t.any},{name:"outline-style",type:n.borderStyle},{name:"outline-offset",type:n.size,triggersBounds:t.any}],b=[{name:"background-image",type:n.urls},{name:"background-image-crossorigin",type:n.bgCrossOrigin},{name:"background-image-opacity",type:n.zeroOneNumbers},{name:"background-image-containment",type:n.bgContainment},{name:"background-image-smoothing",type:n.bools},{name:"background-position-x",type:n.bgPos},{name:"background-position-y",type:n.bgPos},{name:"background-width-relative-to",type:n.bgRelativeTo},{name:"background-height-relative-to",type:n.bgRelativeTo},{name:"background-repeat",type:n.bgRepeat},{name:"background-fit",type:n.bgFit},{name:"background-clip",type:n.bgClip},{name:"background-width",type:n.bgWH},{name:"background-height",type:n.bgWH},{name:"background-offset-x",type:n.bgPos},{name:"background-offset-y",type:n.bgPos}],x=[{name:"position",type:n.position,triggersBounds:t.any},{name:"compound-sizing-wrt-labels",type:n.compoundIncludeLabels,triggersBounds:t.any},{name:"min-width",type:n.size,triggersBounds:t.any},{name:"min-width-bias-left",type:n.sizeMaybePercent,triggersBounds:t.any},{name:"min-width-bias-right",type:n.sizeMaybePercent,triggersBounds:t.any},{name:"min-height",type:n.size,triggersBounds:t.any},{name:"min-height-bias-top",type:n.sizeMaybePercent,triggersBounds:t.any},{name:"min-height-bias-bottom",type:n.sizeMaybePercent,triggersBounds:t.any}],w=[{name:"line-style",type:n.lineStyle},{name:"line-color",type:n.color},{name:"line-fill",type:n.fill},{name:"line-cap",type:n.lineCap},{name:"line-opacity",type:n.zeroOneNumber},{name:"line-dash-pattern",type:n.numbers},{name:"line-dash-offset",type:n.number},{name:"line-gradient-stop-colors",type:n.colors},{name:"line-gradient-stop-positions",type:n.percentages},{name:"curve-style",type:n.curveStyle,triggersBounds:t.any,triggersBoundsOfParallelBeziers:!0},{name:"haystack-radius",type:n.zeroOneNumber,triggersBounds:t.any},{name:"source-endpoint",type:n.edgeEndpoint,triggersBounds:t.any},{name:"target-endpoint",type:n.edgeEndpoint,triggersBounds:t.any},{name:"control-point-step-size",type:n.size,triggersBounds:t.any},{name:"control-point-distances",type:n.bidirectionalSizes,triggersBounds:t.any}
vendor: 6,056 bytes, line 1
1,{name:"control-point-weights",type:n.numbers,triggersBounds:t.any},{name:"segment-distances",type:n.bidirectionalSizes,triggersBounds:t.any},{name:"segment-weights",type:n.numbers,triggersBounds:t.any},{name:"taxi-turn",type:n.bidirectionalSizeMaybePercent,triggersBounds:t.any},{name:"taxi-turn-min-distance",type:n.size,triggersBounds:t.any},{name:"taxi-direction",type:n.axisDirection,triggersBounds:t.any},{name:"edge-distances",type:n.edgeDistances,triggersBounds:t.any},{name:"arrow-scale",type:n.positiveNumber,triggersBounds:t.any},{name:"loop-direction",type:n.angle,triggersBounds:t.any},{name:"loop-sweep",type:n.angle,triggersBounds:t.any},{name:"source-distance-from-node",type:n.size,triggersBounds:t.any},{name:"target-distance-from-node",type:n.size,triggersBounds:t.any}],E=[{name:"ghost",type:n.bool,triggersBounds:t.any},{name:"ghost-offset-x",type:n.bidirectionalSize,triggersBounds:t.any},{name:"ghost-offset-y",type:n.bidirectionalSize,triggersBounds:t.any},{name:"ghost-opacity",type:n.zeroOneNumber}],C=[{name:"selection-box-color",type:n.color},{name:"selection-box-opacity",type:n.zeroOneNumber},{name:"selection-box-border-color",type:n.color},{name:"selection-box-border-width",type:n.size},{name:"active-bg-color",type:n.color},{name:"active-bg-opacity",type:n.zeroOneNumber},{name:"active-bg-size",type:n.size},{name:"outside-texture-bg-color",type:n.color},{name:"outside-texture-bg-opacity",type:n.zeroOneNumber}],S=[];tm.pieBackgroundN=16,S.push({name:"pie-size",type:n.sizeMaybePercent});for(var P=1;P<=tm.pieBackgroundN;P++)S.push({name:"pie-"+P+"-background-color",type:n.color}),S.push({name:"pie-"+P+"-background-size",type:n.percent}),S.push({name:"pie-"+P+"-background-opacity",type:n.zeroOneNumber});var k=[],D=tm.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:n.arrowShape,triggersBounds:t.any},{name:"arrow-color",type:n.color},{name:"arrow-fill",type:n.arrowFill},{name:"arrow-width",type:n.arrowWidth}].forEach(function(e){D.forEach(function(t){var n=t+"-"+e.name,i=e.type,a=e.triggersBounds;k.push({name:n,type:i,triggersBounds:a})})},{});var T=tm.properties=[].concat(u,p,c,d,h,E,l,s,i,a,o,g,v,y,b,S,x,w,k,C),B=tm.propertyGroups={behavior:u,transition:p,visibility:c,overlay:d,underlay:h,ghost:E,commonLabel:l,labelDimensions:s,mainLabel:i,sourceLabel:a,targetLabel:o,nodeBody:g,nodeBorder:v,nodeOutline:y,backgroundImage:b,pie:S,compound:x,edgeLine:w,edgeArrow:k,core:C},A=tm.propertyGroupNames={};(tm.propertyGroupKeys=Object.keys(B)).forEach(function(e){A[e]=B[e].map(function(e){return e.name}),B[e].forEach(function(t){return t.groupKey=e})});var I=tm.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{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"}];tm.propertyNames=T.map(function(e){return e.name});for(var M=0;M<T.length;M++){var _=T[M];T[_.name]=_}for(var L=0;L<I.length;L++){var O=I[L],N=T[O.pointsTo],R={name:O.name,alias:!0,pointsTo:N};T.push(R),T[O.name]=R}}(),tm.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},tm.getDefaultProperties=function(){var e=this._private;if(null!=e.defaultProperties)return e.defaultProperties;for(var t=j({"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","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","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","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","boun
1ds-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(e,t){for(var n=1;n<=tm.pieBackgroundN;n++){var i=t.name.replace("{{i}}",n),a=t.value;e[i]=a}return e},{}),{"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,"taxi-turn":"50%","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(e,t){return tm.arrowPrefixes.forEach(function(n){var i=n+"-"+t.name,a=t.value;e[i]=a}),e},{})),n={},i=0;i<this.properties.length;i++){var a=this.properties[i];if(!a.pointsTo){var o=a.name,s=t[o],l=this.parse(o,s);n[o]=l}}return e.defaultProperties=n,e.defaultProperties},tm.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 tb={};tb.parse=function(e,t,n,i){if(fn$6(t))return this.parseImplWarn(e,t,n,i);var a,o=hashStrings(e,""+t,n?"t":"f","mapping"===i||!0===i||!1===i||null==i?"dontcare":i),s=this.propCache=this.propCache||[];return(a=s[o])||(a=s[o]=this.parseImplWarn(e,t,n,i)),(n||"mapping"===i)&&(a=copy(a))&&(a.value=copy(a.value)),a},tb.parseImplWarn=function(e,t,n,i){var a=this.parseImpl(e,t,n,i);return a||null==t||warn("The style property `".concat(e,": ").concat(t,"` is invalid")),a&&("width"===a.name||"height"===a.name)&&"label"===t&&warn("The style value of `label` is deprecated for `"+a.name+"`"),a},tb.parseImpl=function(e,t,n,i){e=L(e);var a=this.properties[e],o=t,s=this.types;if(!a||void 0===t)return null;a.alias&&(e=(a=a.pointsTo).name);var l=string(t);l&&(t=t.trim());var u=a.type;if(!u)return null;if(n&&(""===t||null===t))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(fn$6(t))return{name:e,value:t,strValue:"fn",mapped:s.fn,bypass:n};if(!l||i||t.length<7||"a"!==t[1]);else if(t.length>=7&&"d"===t[0]&&(y=new RegExp(s.data.regex).exec(t))){if(n)return!1;var c=s.data;return{name:e,value:y,strValue:""+t,mapped:c,field:y[1],bypass:n}}else if(t.length>=10&&"m"===t[0]&&(b=new RegExp(s.mapData.regex).exec(t))){if(n||u.multiple)return!1;var d=s.mapData;if(!(u.color||u.number))return!1;var h=this.parse(e,b[4]);if(!h||h.mapped)return!1;var p=this.parse(e,b[5]);if(!p||p.mapped)return!1;if(h.pfValue===p.pfValue||h.strValue===p.strValue)return warn("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+h.strValue+"`"),this.parse(e,h.strValue);if(u.color){var g=h.value,v=p.value;if(g[0]===v[0]&&g[1]===v[1]&&g[2]===v[2]&&(g[3]===v[3]||(null==g[3]||1===g[3])&&(null==v[3]||1===v[3])))return!1}return{name:e,value:b,strValue:""+t,mapped:d,field:b[1],fieldMin:parseFloat(b[2]),fieldMax:parseFloat(b[3]),valueMin:h.value,valueMax:p.value,bypass:n}}if(u.multiple&&"multiple"!==i){if(x=l?t.split(/\s+/):array(t)?t:[t],u.evenMultiple&&x.length%2!=0)return null;for(var y,b,x,w=[],E=[],C=[],S="",P=!1,k=0;k<x.length;k++){var D=this.parse(e,x[k],n,"multiple");P=P||string(D.value),w.push(D.value),C.push(null!=D.pfValue?D.pfValue:D.value),E.push(D.units),S+=(k>0?" ":"")+D.strValue}return u.validate&&!u.validate(w,E)?null:u.singleEnum&&P?1===w.length&&string(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:C,strValue:S,bypass:n,units:E}}var checkEnums=function(){for(var i=0;i<u.enums.length;i++)if(u.enums[i]===t)return{name:e,value:t,strValue:""+t,bypass:n};return null};if(u.number){var T,B,A="px";if(u.units&&(B=u.units),u.implicitUnits&&(A=u.implicitUnits),!u.unitless){if(l){var I="px|em"+(u.allowPercent?"|\\%":"");B&&(I=B);var M=t.match("^("+z+")("+I+")?$");M&&(t=M[1],B=M[2]||A)}
1else(!B||u.implicitUnits)&&(B=A)}if(isNaN(t=parseFloat(t))&&void 0===u.enums)return null;if(isNaN(t)&&void 0!==u.enums)return t=o,checkEnums();if(u.integer&&!(number$1(T=t)&&Math.floor(T)===T)||void 0!==u.min&&(t<u.min||u.strictMin&&t===u.min)||void 0!==u.max&&(t>u.max||u.strictMax&&t===u.max))return null;var _={name:e,value:t,strValue:""+t+(B||""),units:B,bypass:n};return u.unitless||"px"!==B&&"em"!==B?_.pfValue=t:_.pfValue="px"!==B&&B?this.getEmSizeInPixels()*t:t,("ms"===B||"s"===B)&&(_.pfValue="ms"===B?t:1e3*t),("deg"===B||"rad"===B)&&(_.pfValue="rad"===B?t:Math.PI*t/180),"%"===B&&(_.pfValue=t/100),_}if(u.propList){var O=[],N=""+t;if("none"===N);else{for(var R=N.split(/\s*,\s*|\s+/),F=0;F<R.length;F++){var V=R[F].trim();this.properties[V]?O.push(V):warn("`"+V+"` is not a valid property name")}if(0===O.length)return null}return{name:e,value:O,strValue:0===O.length?"none":O.join(" "),bypass:n}}if(u.color){var q,j=(array(q=t)?q:null)||$[q.toLowerCase()]||hex2tuple(q)||rgb2tuple(q)||hsl2tuple(q);return j?{name:e,value:j,pfValue:j,strValue:"rgb("+j[0]+","+j[1]+","+j[2]+")",bypass:n}:null}if(u.regex||u.regexes){if(u.enums){var X=checkEnums();if(X)return X}for(var Y=u.regexes?u.regexes:[u.regex],H=0;H<Y.length;H++){var W=new RegExp(Y[H]).exec(t);if(W)return{name:e,value:u.singleRegexMatchValue?W[1]:W,strValue:""+t,bypass:n}}return null}return u.string?{name:e,value:""+t,strValue:""+t,bypass:n}:u.enums?checkEnums():null};var Style=function Style(e){if(!(this instanceof Style))return new Style(e);if(!core(e)){error("A style must have a core reference");return}this._private={cy:e,coreStyle:{}},this.length=0,this.resetToDefault()},tx=Style.prototype;tx.instanceString=function(){return"style"},tx.clear=function(){for(var e=this._private,t=e.cy.elements(),n=0;n<this.length;n++)this[n]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(t,!0),t.forEach(function(e){var t=e[0]._private;t.styleDirty=!0,t.appliedInitStyle=!1}),this},tx.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},tx.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},tx.selector=function(e){var t="core"===e?null:new Selector(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},tx.css=function(){var e=arguments;if(1===e.length)for(var t=e[0],n=0;n<this.properties.length;n++){var i=this.properties[n],a=t[i.name];void 0===a&&(a=t[O(i.name)]),void 0!==a&&this.cssRule(i.name,a)}else 2===e.length&&this.cssRule(e[0],e[1]);return this},tx.style=tx.css,tx.cssRule=function(e,t){var n=this.parse(e,t);if(n){var i=this.length-1;this[i].properties.push(n),this[i].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[i].mappedProperties.push(n),this[i].selector||(this._private.coreStyle[n.name]=n)}return this},tx.append=function(e){return stylesheet(e)?e.appendToStyle(this):array(e)?this.appendFromJson(e):string(e)&&this.appendFromString(e),this},Style.fromJson=function(e,t){var n=new Style(e);return n.fromJson(t),n},Style.fromString=function(e,t){return new Style(e).fromString(t)},[td,th,tp,tg,tv,ty,tm,tb].forEach(function(e){j(tx,e)}),Style.types=tx.types,Style.properties=tx.properties,Style.propertyGroups=tx.propertyGroups,Style.propertyGroupNames=tx.propertyGroupNames,Style.propertyGroupKeys=tx.propertyGroupKeys;var tw={autolock:function(e){return void 0===e?this._private.autolock:(this._private.autolock=!!e,this)},autoungrabify:function(e){return void 0===e?this._private.autoungrabify:(this._private.autoungrabify=!!e,this)},autounselectify:function(e){return void 0===e?this._private.autounselectify:(this._private.autounselectify=!!e,this)},selectionType:function(e){var t=this._private;return(null==t.selectionType&&(t.selectionType="single"),void 0===e)?t.selectionType:(("additive"===e||"single"===e)&&(t.selectionType=e),this)},panningEnabled:function(e){return void 0===e?this._private.panningEnabled:(this._private.panningEnabled=!!e,this)},userPanningEnabled:function(e){return void 0===e?this._private.userPanningEnabled:(this._private.userPanningEnabled=!!e,this)},zoomingEnabled:function(e){return void 0===e?this._private.zoomingEnabled:(this._private.zoomingEnabled=!!e,this)},userZoomingEnabled:function(e){return void 0===e?this._private.userZoomingEnabled:(this._private.userZoomingEnabled=!!e,this)},boxSelectionEnabled:function(e){return void 0===e?this._private.boxSelectionEnabled:(this._private.boxSelectionEnabled=!!e,this)},pan:function(){var e,t,n,i,a,o=arguments,s=this._private.pan;switch(o.length){case 0:return s;case 1:if(string(o[0]))return s[e=o[0]];if(plainObject(o[0])){if(!this._private.panningEnabled)return this;i=(n=o[0]).x,a=n.y,number$1(i)&&(s.x=i),number$1(a)&&(s.y=a),this.emit
1("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=o[0],t=o[1],("x"===e||"y"===e)&&number$1(t)&&(s[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,i,a,o=arguments,s=this._private.pan;if(!this._private.panningEnabled)return this;switch(o.length){case 1:plainObject(e)&&(i=(n=o[0]).x,a=n.y,number$1(i)&&(s.x+=i),number$1(a)&&(s.y+=a),this.emit("pan viewport"));break;case 2:("x"===e||"y"===e)&&number$1(t)&&(s[e]+=t),this.emit("pan viewport")}return this.notify("viewport"),this},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var i=this._private;i.zoom=n.zoom,i.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(number$1(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){if(string(e)){var n,i,a,o=e;e=this.$(o)}else if(plainObject(n=e)&&number$1(n.x1)&&number$1(n.x2)&&number$1(n.y1)&&number$1(n.y2)){var s=e;(i={x1:s.x1,y1:s.y1,x2:s.x2,y2:s.y2}).w=i.x2-i.x1,i.h=i.y2-i.y1}else elementOrCollection(e)||(e=this.mutableElements());if(!(elementOrCollection(e)&&e.empty())){i=i||e.boundingBox();var l=this.width(),u=this.height();if(t=number$1(t)?t:0,!isNaN(l)&&!isNaN(u)&&l>0&&u>0&&!isNaN(i.w)&&!isNaN(i.h)&&i.w>0&&i.h>0){a=(a=(a=Math.min((l-2*t)/i.w,(u-2*t)/i.h))>this._private.maxZoom?this._private.maxZoom:a)<this._private.minZoom?this._private.minZoom:a;var c={x:(l-a*(i.x1+i.x2))/2,y:(u-a*(i.y1+i.y2))/2};return{zoom:a,pan:c}}}}},zoomRange:function(e,t){var n=this._private;if(null==t){var i=e;e=i.min,t=i.max}return number$1(e)&&number$1(t)&&e<=t?(n.minZoom=e,n.maxZoom=t):number$1(e)&&void 0===t&&e<=n.maxZoom?n.minZoom=e:number$1(t)&&void 0===e&&t>=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,i=this._private,a=i.pan,o=i.zoom,s=!1;if(i.zoomingEnabled||(s=!0),number$1(e)?n=e:plainObject(e)&&(n=e.level,null!=e.position?t=modelToRenderedPosition(e.position,o,a):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||i.panningEnabled||(s=!0)),n=(n=n>i.maxZoom?i.maxZoom:n)<i.minZoom?i.minZoom:n,s||!number$1(n)||n===o||null!=t&&(!number$1(t.x)||!number$1(t.y)))return null;if(null==t)return{zoomed:!0,panned:!1,zoom:n,pan:a};var l=n,u={x:-l/o*(t.x-a.x)+t.x,y:-l/o*(t.y-a.y)+t.y};return{zoomed:!0,panned:!0,zoom:l,pan:u}},zoom:function(e){if(void 0===e)return this._private.zoom;var t=this.getZoomedViewport(e),n=this._private;return null!=t&&t.zoomed&&(n.zoom=t.zoom,t.panned&&(n.pan.x=t.pan.x,n.pan.y=t.pan.y),this.emit("zoom"+(t.panned?" pan":"")+" viewport"),this.notify("viewport")),this},viewport:function(e){var t=this._private,n=!0,i=!0,a=[],o=!1,s=!1;if(!e||(number$1(e.zoom)||(n=!1),plainObject(e.pan)||(i=!1),!n&&!i))return this;if(n){var l=e.zoom;l<t.minZoom||l>t.maxZoom||!t.zoomingEnabled?o=!0:(t.zoom=l,a.push("zoom"))}if(i&&(!o||!e.cancelOnFailedZoom)&&t.panningEnabled){var u=e.pan;number$1(u.x)&&(t.pan.x=u.x,s=!1),number$1(u.y)&&(t.pan.y=u.y,s=!1),s||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.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(string(e)){var n=e;e=this.mutableElements().filter(n)}else elementOrCollection(e)||(e=this.mutableElements());if(0!==e.length){var i=e.boundingBox(),a=this.width(),o=this.height();return{x:(a-(t=void 0===t?this._private.zoom:t)*(i.x1+i.x2))/2,y:(o-t*(i.y1+i.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled&&this.viewport({pan:{x:0,y:0},zoom:1}),this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,i=n.container;return n.sizeCache=n.sizeCache||(i?(e=this.window().getComputedStyle(i),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:i.clientWidth-t("padding-left")-t("padding-right"),height:i.clientHeight-t("padding-top")-t("padding-bottom")}):{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),i={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.
vendor: 1,219 bytes, line 1
1y)/t,y2:(n.y2-e.y)/t};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};tw.centre=tw.center,tw.autolockNodes=tw.autolock,tw.autoungrabifyNodes=tw.autoungrabify;var tE={data:ek.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:ek.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:ek.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:ek.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};tE.attr=tE.data,tE.removeAttr=tE.removeData;var Core=function(e){var t=this,n=(e=j({},e)).container;n&&!htmlElement(n)&&htmlElement(n[0])&&(n=n[0]);var i=n?n._cyreg:null;(i=i||{}).cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];
1n&&(n._cyreg=i),i.cy=t;var o=void 0!==T&&void 0!==n&&!e.headless,s=e;s.layout=j({name:o?"grid":"null"},s.layout),s.renderer=j({name:o?"canvas":"null"},s.renderer);var defVal=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n,ready:!1,options:s,elements:new Collection(this),listeners:[],aniEles:new Collection(this),data:s.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:defVal(!0,s.zoomingEnabled),userZoomingEnabled:defVal(!0,s.userZoomingEnabled),panningEnabled:defVal(!0,s.panningEnabled),userPanningEnabled:defVal(!0,s.userPanningEnabled),boxSelectionEnabled:defVal(!0,s.boxSelectionEnabled),autolock:defVal(!1,s.autolock,s.autolockNodes),autoungrabify:defVal(!1,s.autoungrabify,s.autoungrabifyNodes),autounselectify:defVal(!1,s.autounselectify),styleEnabled:void 0===s.styleEnabled?o:s.styleEnabled,zoom:number$1(s.zoom)?s.zoom:1,pan:{x:plainObject(s.pan)&&number$1(s.pan.x)?s.pan.x:0,y:plainObject(s.pan)&&number$1(s.pan.y)?s.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:defVal(250,s.multiClickDebounceTime)};this.createEmitter(),this.selectionType(s.selectionType),this.zoomRange({min:s.minZoom,max:s.maxZoom}),l.styleEnabled&&t.setStyle([]);var u=j({},s,s.renderer);t.initRenderer(u);var setElesAndLayout=function(e,n,i){t.notifications(!1);var a=t.mutableElements();a.length>0&&a.remove(),null!=e&&(plainObject(e)||array(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",i),t.emit("done")});var o=j({},t._private.options.layout);o.eles=t.elements(),t.layout(o).run()};!function(e,t){if(e.some(promise))return eS.all(e).then(t);t(e)}([s.style,s.elements],function(e){var n=e[0],o=e[1];l.styleEnabled&&t.style().append(n),setElesAndLayout(o,function(){t.startAnimationLoop(),l.ready=!0,fn$6(s.ready)&&t.on("ready",s.ready);for(var e=0;e<a.length;e++){var n=a[e];t.on("ready",n)}i&&(i.readies=[]),t.emit("ready")},s.done)})},tC=Core.prototype;j(tC,{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(){if(!this.destroyed())return this.stopAnimationLoop(),this.destroyRenderer(),this.emit("destroy"),this._private.destroyed=!0,this},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(){if(null==this._private.container)return T;var e=this._private.container.ownerDocument;return void 0===e||null==e?T:e.defaultView||T},mount:function(e){if(null!=e){var t=this._private,n=t.options;return!htmlElement(e)&&htmlElement(e[0])&&(e=e[0]),this.stopAnimationLoop(),this.destroyRenderer(),t.container=e,t.styleEnabled=!0,this.invalidateSize(),this.initRenderer(j({},n,n.renderer,{name:"null"===n.renderer.name?"canvas":n.renderer.name})),this.startAnimationLoop(),this.style(n.style),this.emit("mount"),this}},unmount:function(){return this.stopAnimationLoop(),this.destroyRenderer(),this.initRenderer({name:"null"}),this.emit("unmount"),this},options:function(){return copy(this._private.options)},json:function(e){var t=this,n=t._private,i=t.mutableElements();if(plainObject(e)){if(t.startBatch(),e.elements){var a={},updateEles=function(e,n){for(var i=[],o=[],s=0;s<e.length;s++){var l=e[s];if(!l.data.id){warn("cy.json() cannot handle elements without an ID attribute");continue}var u=""+l.data.id,c=t.getElementById(u);a[u]=!0,0!==c.length?o.push({ele:c,json:l}):(n&&(l.group=n),i.push(l))}t.add(i);for(var d=0;d<o.length;d++){var h=o[d],p=h.ele,g=h.json;p.json(g)}};if(array(e.elements))updateEles(e.elements);else for(var o=["nodes","edges"],s=0;s<o.length;s++){var l=o[s],u=e.elements[l];array(u)&&updateEles(u,l)}var c=t.collection();i.filter(function(e){return!a[e.id()]}
1).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 t.getElementById(e.id()).remove()})}e.style&&t.style(e.style),null!=e.zoom&&e.zoom!==n.zoom&&t.zoom(e.zoom),e.pan&&(e.pan.x!==n.pan.x||e.pan.y!==n.pan.y)&&t.pan(e.pan),e.data&&t.data(e.data);for(var d=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],h=0;h<d.length;h++){var p=d[h];null!=e[p]&&t[p](e[p])}return t.endBatch(),this}var g={};e?g.elements=this.elements().map(function(e){return e.json()}):(g.elements={},i.forEach(function(e){var t=e.group();g.elements[t]||(g.elements[t]=[]),g.elements[t].push(e.json())})),this._private.styleEnabled&&(g.style=t.style().json()),g.data=copy(t.data());var v=n.options;return g.zoomingEnabled=n.zoomingEnabled,g.userZoomingEnabled=n.userZoomingEnabled,g.zoom=n.zoom,g.minZoom=n.minZoom,g.maxZoom=n.maxZoom,g.panningEnabled=n.panningEnabled,g.userPanningEnabled=n.userPanningEnabled,g.pan=copy(n.pan),g.boxSelectionEnabled=n.boxSelectionEnabled,g.renderer=copy(v.renderer),g.hideEdgesOnViewport=v.hideEdgesOnViewport,g.textureOnViewport=v.textureOnViewport,g.wheelSensitivity=v.wheelSensitivity,g.motionBlur=v.motionBlur,g.multiClickDebounceTime=v.multiClickDebounceTime,g}}),tC.$id=tC.getElementById,[{add:function(e){var t;if(elementOrCollection(e)){if(e._private.cy===this)t=e.restore();else{for(var n=[],i=0;i<e.length;i++){var a=e[i];n.push(a.json())}t=new Collection(this,n)}}else if(array(e))t=new Collection(this,e);else if(plainObject(e)&&(array(e.nodes)||array(e.edges))){for(var o=[],s=["nodes","edges"],l=0,u=s.length;l<u;l++){var c=s[l],d=e[c];if(array(d))for(var h=0,p=d.length;h<p;h++){var g=j({group:c},d[h]);o.push(g)}}t=new Collection(this,o)}else t=new Element(this,e).collection();return t},remove:function(e){if(elementOrCollection(e));else if(string(e)){var t=e;e=this.$(t)}return e.remove()}},tr,ta,to,ts,{notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var i=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&i.merge(t);return}if(n.notificationsEnabled){var a=this.renderer();!this.destroyed()&&a&&a.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 i=e.batchNotifications[n];i.empty()?t.notify(n):t.notify(n,i)})}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),i=0;i<n.length;i++){var a=n[i],o=e[a];t.getElementById(a).data(o)}})}},tu,tc,{style:function(e){return e&&this.setStyle(e).update(),this._private.style},setStyle:function(e){var t=this._private;return stylesheet(e)?t.style=e.generateStyle(this):array(e)?t.style=Style.fromJson(this,e):string(e)?t.style=Style.fromString(this,e):t.style=Style(this),t.style},updateStyle:function(){this.mutableElements().updateStyle()}},tw,tE].forEach(function(e){j(tC,e)});var tS={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}},tP={maximal:!1,acyclic:!1},getInfo=function(e){return e.scratch("breadthfirst")},setInfo=function(e,t){return e.scratch("breadthfirst",t)};function BreadthFirstLayout(e){this.options=j({},tS,tP,e)}BreadthFirstLayout.prototype.run=function(){var e,t=this.options,n=t.cy,i=t.eles,a=i.nodes().filter(function(e){return!e.isParent()}),o=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(elementOrCollection(t.roots))e=t.roots;else if(array(t.roots)){for(var u=[],c=0;c<t.roots.length;c++){var d=t.roots[c],h=n.getElementById(d);u.push(h)}e=n.collection(u)}else if(string(t.roots))e=n.$(t.roots);else if(o)e=a.roots();else{var p=i.components();e=n.collection();for(var g=0;g<p.length;g++)!function(t){var n=p[t],i=n.maxDegree(!1),a=n.filter(function(e){return e.degree(!1)===i});e=e.add(a)}(g)}var v=[],y={},addToDepth=function(e,t){null==v[t]&&(v[t]=[]);var n=v[t].length;v[t].push(e),setInfo(e,{index:n,depth:t})},changeDepth=function(e,t){var n=getInfo(e),i=n.depth,a=n.index;v[i][a]=null,addToDepth(e,t)};i.bfs({roots:e,directed:t.directed,visit:function(e,t,n,i,a){var o=e[0],s=o.id();addToDepth(o,a),y[s]=!0}});for(var b=[],x=0;x<a.length;x++){var w=a[x];y[w.id()]||b.push(w)}var assignDepthsAt=function(e){for(var t=v[e],n=0;n<t.length;n++){var i=t[n];if(null==i){t.splice(n,1),n--;continue}setInfo(i,{depth:e,index:n})}},assignDepths=function(){for(var e=0;e<v.length;e++)assignDepthsAt(e)};if(o&&s){var E=[],C={},enqueue=function(e){return E.push(e)};
1for(a.forEach(function(e){return E.push(e)});E.length>0;){var S=E.shift(),P=function(e,n){for(var a=getInfo(e),o=e.incomers().filter(function(e){return e.isNode()&&i.has(e)}),s=-1,l=e.id(),u=0;u<o.length;u++)s=Math.max(s,getInfo(o[u]).depth);if(a.depth<=s){if(!t.acyclic&&n[l])return null;var c=s+1;return changeDepth(e,c),n[l]=c,!0}return!1}(S,C);if(P)S.outgoers().filter(function(e){return e.isNode()&&i.has(e)}).forEach(enqueue);else if(null===P){warn("Detected double maximal shift for node `"+S.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}assignDepths();var k=0;if(t.avoidOverlap)for(var D=0;D<a.length;D++){var T=a[D].layoutDimensions(t),B=T.w,A=T.h;k=Math.max(k,B,A)}var I={},getWeightedPercent=function(e){if(I[e.id()])return I[e.id()];for(var t=getInfo(e).depth,n=e.neighborhood(),i=0,o=0,s=0;s<n.length;s++){var l=n[s];if(!(l.isEdge()||l.isParent())&&a.has(l)){var u=getInfo(l);if(null!=u){var c=u.index,d=u.depth;if(null!=c&&null!=d){var h=v[d].length;d<t&&(i+=c/h,o++)}}}}return i/=o=Math.max(1,o),0===o&&(i=0),I[e.id()]=i,i},sortFn=function(e,t){var n=getWeightedPercent(e)-getWeightedPercent(t);return 0===n?ascending(e.id(),t.id()):n};void 0!==t.depthSort&&(sortFn=t.depthSort);for(var M=0;M<v.length;M++)v[M].sort(sortFn),assignDepthsAt(M);for(var _=[],L=0;L<b.length;L++)_.push(b[L]);v.unshift(_),assignDepths();for(var O=0,N=0;N<v.length;N++)O=Math.max(v[N].length,O);var z={x:l.x1+l.w/2,y:l.x1+l.h/2},R=v.reduce(function(e,t){return Math.max(e,t.length)},0);return i.nodes().layoutPositions(this,t,function(e){var n=getInfo(e),i=n.depth,a=n.index,o=v[i].length,s=Math.max(l.w/((t.grid?R:o)+1),k),u=Math.max(l.h/(v.length+1),k),c=Math.min(l.w/2/v.length,l.h/2/v.length);if(c=Math.max(c,k),!t.circle)return{x:z.x+(a+1-(o+1)/2)*s,y:(i+1)*u};var d=c*i+c-(v.length>0&&v[0].length<=3?c/2:0),h=2*Math.PI/v[i].length*a;return 0===i&&1===v[0].length&&(d=1),{x:z.x+d*Math.cos(h),y:z.y+d*Math.sin(h)}}),this};var tk={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 CircleLayout(e){this.options=j({},tk,e)}CircleLayout.prototype.run=function(){var e,t=this.options,n=t.cy,i=t.eles,a=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,o=i.nodes().not(":parent");t.sort&&(o=o.sort(t.sort));for(var s=makeBoundingBox(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),l={x:s.x1+s.w/2,y:s.y1+s.h/2},u=(void 0===t.sweep?2*Math.PI-2*Math.PI/o.length:t.sweep)/Math.max(1,o.length-1),c=0,d=0;d<o.length;d++){var h=o[d].layoutDimensions(t);c=Math.max(c,h.w,h.h)}if(e=number$1(t.radius)?t.radius:o.length<=1?0:Math.min(s.h,s.w)/2-c,o.length>1&&t.avoidOverlap){var p=Math.cos(u)-1,g=Math.sin(u)-0;e=Math.max(Math.sqrt((c*=1.75)*c/(p*p+g*g)),e)}return i.nodes().layoutPositions(this,t,function(n,i){var o=t.startAngle+i*u*(a?1:-1),s=e*Math.cos(o),c=e*Math.sin(o);return{x:l.x+s,y:l.y+c}}),this};var tD={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 ConcentricLayout(e){this.options=j({},tD,e)}ConcentricLayout.prototype.run=function(){for(var e=this.options,t=void 0!==e.counterclockwise?!e.counterclockwise:e.clockwise,n=e.cy,i=e.eles,a=i.nodes().not(":parent"),o=makeBoundingBox(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c<a.length;c++){var d=a[c],h=void 0;h=e.concentric(d),l.push({value:h,node:d}),d._private.scratch.concentric=h}a.updateStyle();for(var p=0;p<a.length;p++){var g=a[p].layoutDimensions(e);u=Math.max(u,g.w,g.h)}l.sort(function(e,t){return t.value-e.value});for(var v=e.levelWidth(a),y=[[]],b=y[0],x=0;x<l.length;x++){var w=l[x];b.length>0&&Math.abs(b[0].value-w.value)>=v&&(b=[],y.push(b)),b.push(w)}var E=u+e.minNodeSpacing;
1if(!e.avoidOverlap){var C=y.length>0&&y[0].length>1,S=(Math.min(o.w,o.h)/2-E)/(y.length+C?1:0);E=Math.min(E,S)}for(var P=0,k=0;k<y.length;k++){var D=y[k],T=void 0===e.sweep?2*Math.PI-2*Math.PI/D.length:e.sweep,B=D.dTheta=T/Math.max(1,D.length-1);if(D.length>1&&e.avoidOverlap){var A=Math.cos(B)-1,I=Math.sin(B)-0;P=Math.max(Math.sqrt(E*E/(A*A+I*I)),P)}D.r=P,P+=E}if(e.equidistant){for(var M=0,_=0,L=0;L<y.length;L++)M=Math.max(M,y[L].r-_);_=0;for(var O=0;O<y.length;O++){var N=y[O];0===O&&(_=N.r),N.r=_,_+=M}}for(var z={},R=0;R<y.length;R++)for(var F=y[R],V=F.dTheta,q=F.r,j=0;j<F.length;j++){var $=F[j],X=e.startAngle+(t?1:-1)*V*j,Y={x:s.x+q*Math.cos(X),y:s.y+q*Math.sin(X)};z[$.node.id()]=Y}return i.nodes().layoutPositions(this,e,function(e){return z[e.id()]}),this};var tT={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(e,t){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 CoseLayout(e){this.options=j({},tT,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges().filter(function(e){var n=e.source().data("id"),i=e.target().data("id"),a=t.some(function(e){return e.data("id")===n}),o=t.some(function(e){return e.data("id")===i});return!a||!o});this.options.eles=this.options.eles.not(n)}CoseLayout.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(!0===e.animate||!1===e.animate)&&n.emit({type:"layoutstart",layout:n}),p=!0===e.debug;var i=createLayoutInfo(t,n,e);p&&g(i),e.randomize&&randomizePositions(i);var a=Y(),refresh=function(){refreshPositions(i,t,e),!0===e.fit&&t.fit(e.padding)},mainLoop=function(t){return!n.stopped&&!(t>=e.numIter)&&(step(i,e),i.temperature=i.temperature*e.coolingFactor,!(i.temperature<e.minTemp))},done=function(){if(!0===e.animate||!1===e.animate)refresh(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var t=e.eles.nodes(),a=getScaleInBoundsFn(i,e,t);t.layoutPositions(n,e,a)}},o=0,s=!0;if(!0===e.animate)!function frame(){for(var t=0;s&&t<e.refresh;)s=mainLoop(o),o++,t++;s?(Y()-a>=e.animationThreshold&&refresh(),requestAnimationFrame(frame)):(separateComponents(i,e),done())}();else{for(;s;)s=mainLoop(o),o++;separateComponents(i,e),done()}return this},CoseLayout.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},CoseLayout.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var createLayoutInfo=function(e,t,n){for(var i=n.eles.edges(),a=n.eles.nodes(),o=makeBoundingBox(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),s={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:n.initialTemp,clientWidth:o.w,clientHeight:o.h,boundingBox:o},l=n.eles.components(),u={},c=0;c<l.length;c++)for(var d=l[c],h=0;h<d.length;h++){var p=d[h];u[p.id()]=c}for(var c=0;c<s.nodeSize;c++){var g=a[c],v=g.layoutDimensions(n),y={};y.isLocked=g.locked(),y.id=g.data("id"),y.parentId=g.data("parent"),y.cmptId=u[g.id()],y.children=[],y.positionX=g.position("x"),y.positionY=g.position("y"),y.offsetX=0,y.offsetY=0,y.height=v.w,y.width=v.h,y.maxX=y.positionX+y.width/2,y.minX=y.positionX-y.width/2,y.maxY=y.positionY+y.height/2,y.minY=y.positionY-y.height/2,y.padLeft=parseFloat(g.style("padding")),y.padRight=parseFloat(g.style("padding")),y.padTop=parseFloat(g.style("padding")),y.padBottom=parseFloat(g.style("padding")),y.nodeRepulsion=fn$6(n.nodeRepulsion)?n.nodeRepulsion(g):n.nodeRepulsion,s.layoutNodes.push(y),s.idToIndex[y.id]=c}for(var b=[],x=0,w=-1,E=[],c=0;c<s.nodeSize;c++){var g=s.layoutNodes[c],C=g.parentId;null!=C?s.layoutNodes[s.idToIndex[C]].children.push(g.id):(b[++w]=g.id,E.push(g.id))}for(s.graphSet.push(E);x<=w;){var S=b[x++],P=s.idToIndex[S],p=s.layoutNodes[P],k=p.children;if(k.length>0){s.graphSet.push(k);for(var c=0;c<k.length;c++)b[++w]=k[c]}}for(var c=0;c<s.graphSet.length;c++)for(var D=s.graphSet[c],h=0;h<D.length;h++){var T=s.idToIndex[D[h]];s.indexToGraph[T]=c}for(var c=0;c<s.edgeSize;c++){var B=i[c],A={};A.id=B.data("id"),A.sourceId=B.data("source"),A.targetId=B.data("target");var I=fn$6(n.idealEdgeLength)?n.idealEdgeLength(B):n.idealEdgeLength,M=fn$6(n.edgeElasticity)?n.edgeElasticity(B):n.edgeElasticity,_=s.idToIndex[A.sourceId],L=s.idToIndex[A.targetId];if(s.indexToGraph[_]!=s.indexToGraph[L]){for(var O=findLCA(A.sourceId,A.targetId,s),N=s.graphSet[O],z=0,y=s.layoutNodes[_];-1===N.indexOf(y.id);)y=s.layoutNodes[s.idToIndex[y.parentId]],z++;for(y=s.layoutNodes[L];-1===N.indexOf(y.id);)y=s.layoutNodes[s.idToIndex[y.parentId]],z++;I*=z*n.nestingFactor}A.idealLength=I,A.elasticity=M,s.layoutEdges.push(A)}return s},findLCA=function(e,t,n){var i=findLCA_aux(e,t,0,n);return 2>i.count?0:i.graph},findLCA_aux=function findLCA_aux(e,t,n,i){var a=i.graphSet[n];if(-1<a.indexOf(e)&&-1<a.indexOf(t))return{count:2,graph:n};for(var o=0,s=0;s<a.length;s++){var l=a[s],u=i.idToIndex[l],c=i.layoutNodes[u].children;if(0!==c.length){var d=findLCA_aux(e,t,i.indexToGraph[i.idToIndex[c[0]]],i);if(0!==d.count){if(1!==d.count)return d;if(2==++o)break}}}return{count:o,graph:n}},randomizePositions=function(e,t){for(var n=e.clientWidth,i=e.clientHeight,a=0;a<e.nodeSize;a++){var o=e.layoutNodes[a];0!==o.children.length||o.isLocked||(o.positionX=Math.random()*n,o.positionY=Math.random()*i)}},getScaleInBoundsFn=function(e,t,n){var i=e.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};
1return t.boundingBox&&(n.forEach(function(t){var n=e.layoutNodes[e.idToIndex[t.data("id")]];a.x1=Math.min(a.x1,n.positionX),a.x2=Math.max(a.x2,n.positionX),a.y1=Math.min(a.y1,n.positionY),a.y2=Math.max(a.y2,n.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(n,o){var s=e.layoutNodes[e.idToIndex[n.data("id")]];if(!t.boundingBox)return{x:s.positionX,y:s.positionY};var l=(s.positionX-a.x1)/a.w,u=(s.positionY-a.y1)/a.h;return{x:i.x1+l*i.w,y:i.y1+u*i.h}}},refreshPositions=function(e,t,n){var i=n.layout,a=n.eles.nodes(),o=getScaleInBoundsFn(e,n,a);a.positions(o),!0!==e.ready&&(e.ready=!0,i.one("layoutready",n.ready),i.emit({type:"layoutready",layout:this}))},step=function(e,t,n){calculateNodeForces(e,t),calculateEdgeForces(e),calculateGravityForces(e,t),propagateForces(e),updatePositions(e)},calculateNodeForces=function(e,t){for(var n=0;n<e.graphSet.length;n++)for(var i=e.graphSet[n],a=i.length,o=0;o<a;o++)for(var s=e.layoutNodes[e.idToIndex[i[o]]],l=o+1;l<a;l++)nodeRepulsion(s,e.layoutNodes[e.idToIndex[i[l]]],e,t)},randomDistance=function(e){return-e+2*e*Math.random()},nodeRepulsion=function(e,t,n,i){if(e.cmptId===t.cmptId||n.isCompound){var a=t.positionX-e.positionX,o=t.positionY-e.positionY;0===a&&0===o&&(a=randomDistance(1),o=randomDistance(1));var s=nodesOverlap(e,t,a,o);if(s>0)var l=i.nodeOverlap*s,u=Math.sqrt(a*a+o*o),c=l*a/u,d=l*o/u;else var h=findClippingPoint(e,a,o),p=findClippingPoint(t,-1*a,-1*o),g=p.x-h.x,v=p.y-h.y,y=g*g+v*v,u=Math.sqrt(y),l=(e.nodeRepulsion+t.nodeRepulsion)/y,c=l*g/u,d=l*v/u;e.isLocked||(e.offsetX-=c,e.offsetY-=d),t.isLocked||(t.offsetX+=c,t.offsetY+=d)}},nodesOverlap=function(e,t,n,i){if(n>0)var a=e.maxX-t.minX;else var a=t.maxX-e.minX;if(i>0)var o=e.maxY-t.minY;else var o=t.maxY-e.minY;return a>=0&&o>=0?Math.sqrt(a*a+o*o):0},findClippingPoint=function(e,t,n){var i=e.positionX,a=e.positionY,o=e.height||1,s=e.width||1,l=n/t,u=o/s,c={};return 0===t&&0<n||0===t&&0>n?(c.x=i,c.y=a+o/2):0<t&&-1*u<=l&&l<=u?(c.x=i+s/2,c.y=a+s*n/2/t):0>t&&-1*u<=l&&l<=u?(c.x=i-s/2,c.y=a-s*n/2/t):0<n&&(l<=-1*u||l>=u)?(c.x=i+o*t/2/n,c.y=a+o/2):0>n&&(l<=-1*u||l>=u)&&(c.x=i-o*t/2/n,c.y=a-o/2),c},calculateEdgeForces=function(e,t){for(var n=0;n<e.edgeSize;n++){var i=e.layoutEdges[n],a=e.idToIndex[i.sourceId],o=e.layoutNodes[a],s=e.idToIndex[i.targetId],l=e.layoutNodes[s],u=l.positionX-o.positionX,c=l.positionY-o.positionY;if(0!==u||0!==c){var d=findClippingPoint(o,u,c),h=findClippingPoint(l,-1*u,-1*c),p=h.x-d.x,g=h.y-d.y,v=Math.sqrt(p*p+g*g),y=Math.pow(i.idealLength-v,2)/i.elasticity;if(0!==v)var b=y*p/v,x=y*g/v;else var b=0,x=0;o.isLocked||(o.offsetX+=b,o.offsetY+=x),l.isLocked||(l.offsetX-=b,l.offsetY-=x)}}},calculateGravityForces=function(e,t){if(0!==t.gravity)for(var n=0;n<e.graphSet.length;n++){var i=e.graphSet[n],a=i.length;if(0===n)var o=e.clientHeight/2,s=e.clientWidth/2;else var l=e.layoutNodes[e.idToIndex[i[0]]],u=e.layoutNodes[e.idToIndex[l.parentId]],o=u.positionX,s=u.positionY;for(var c=0;c<a;c++){var d=e.layoutNodes[e.idToIndex[i[c]]];if(!d.isLocked){var h=o-d.positionX,p=s-d.positionY,g=Math.sqrt(h*h+p*p);if(g>1){var v=t.gravity*h/g,y=t.gravity*p/g;d.offsetX+=v,d.offsetY+=y}}}}},propagateForces=function(e,t){var n=[],i=0,a=-1;for(n.push.apply(n,e.graphSet[0]),a+=e.graphSet[0].length;i<=a;){var o=n[i++],s=e.idToIndex[o],l=e.layoutNodes[s],u=l.children;if(0<u.length&&!l.isLocked){for(var c=l.offsetX,d=l.offsetY,h=0;h<u.length;h++){var p=e.layoutNodes[e.idToIndex[u[h]]];p.offsetX+=c,p.offsetY+=d,n[++a]=u[h]}l.offsetX=0,l.offsetY=0}}},updatePositions=function(e,t){for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];if(!(0<i.children.length)&&!i.isLocked){var a=limitForce(i.offsetX,i.offsetY,e.temperature);i.positionX+=a.x,i.positionY+=a.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,updateAncestryBoundaries(i,e)}}for(var n=0;n<e.nodeSize;n++){var i=e.layoutNodes[n];0<i.children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},limitForce=function(e,t,n){var i=Math.sqrt(e*e+t*t);if(i>n)var a={x:n*e/i,y:n*t/i};else var a={x:e,y:t};return a},updateAncestryBoundaries=function updateAncestryBoundaries(e,t){var n=e.parentId;if(null!=n){var i=t.layoutNodes[t.idToIndex[n]],a=!1;if((null==i.maxX||e.maxX+i.padRight>i.maxX)&&(i.maxX=e.maxX+i.padRight,a=!0),(null==i.minX||e.minX-i.padLeft<i.minX)&&(i.minX=e.minX-i.padLeft,a=!0),(null==i.maxY||e.maxY+i.padBottom>i.maxY)&&(i.maxY=e.maxY+i.padBottom,a=!0),(null==i.minY||e.minY-i.padTop<i.minY)&&(i.minY=e.minY-i.padTop,a=!0),a)return updateAncestryBoundaries(i,t)}},separateComponents=function(e,t){for(var n=e.layoutNodes,i=[],a=0;a<n.length;a++){var o=n[a],s=o.cmptId;(i[s]=i[s]||[]).push(o)}for(var l=0,a=0;a<i.length;a++){var u=i[a];if(u){u.x1=1/0,u.x2=-1/0,u.y1=1/0,u.y2=-1/0;for(var c=0;c<u.length;c++){var d=u[c];u.x1=Math.min(u.x1,d.positionX-d.width/2),u.x2=Math.max(u.x2,d.positionX+d.width/2),u.y1=Math.min(u.y1,d.positionY-d.height/2),u.y2=Math.max(u.y2,d.positionY+d.height/2)}u.w=u.x2-u.x1,u.h=u.y2-u.y1,l+=u.w*u.h}}i.sort(function(e,t){return t.w*t.h-e.w*e.h});for(var h=0,p=0,g=0,v=0,y=Math.sqrt(l)*e.clientWidth/e.clientHeight,a=0;a<i.length;a++){var u=i[a];if(u){for(var c=0;c<u.length;c++){var d=u[c];d.isLocked||(d.positionX+=h-u.x1,d.positionY+=p-u.y1)}h+=u.w+t.componentSpacing,g+=u.w+t.componentSpacing,v=Math.max(v,u.h),g>y&&(p+=v+t.componentSpacing,h=0,g=0,v=0)}}},tB={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 GridLayout(e){this.options=j({},tB,e)}GridLayout.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,i=n.nodes().not(":parent");e.sort&&(i=i.sort(e.sort));
1var a=makeBoundingBox(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});if(0===a.h||0===a.w)n.nodes().layoutPositions(this,e,function(e){return{x:a.x1,y:a.y1}});else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),small=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},large=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},c=e.rows,d=null!=e.cols?e.cols:e.columns;if(null!=c&&null!=d)l=c,u=d;else if(null!=c&&null==d)u=Math.ceil(o/(l=c));else if(null==c&&null!=d)l=Math.ceil(o/(u=d));else if(u*l>o){var h=small(),p=large();(h-1)*p>=o?small(h-1):(p-1)*h>=o&&large(p-1)}else for(;u*l<o;){var g=small(),v=large();(v+1)*g>=o?large(v+1):small(g+1)}var y=a.w/u,b=a.h/l;if(e.condense&&(y=0,b=0),e.avoidOverlap)for(var x=0;x<i.length;x++){var w=i[x],E=w._private.position;(null==E.x||null==E.y)&&(E.x=0,E.y=0);var C=w.layoutDimensions(e),S=e.avoidOverlapPadding,P=C.w+S,k=C.h+S;y=Math.max(y,P),b=Math.max(b,k)}for(var D={},used=function(e,t){return!!D["c-"+e+"-"+t]},use=function(e,t){D["c-"+e+"-"+t]=!0},T=0,B=0,moveToNextCell=function(){++B>=u&&(B=0,T++)},A={},I=0;I<i.length;I++){var M=i[I],_=e.position(M);if(_&&(void 0!==_.row||void 0!==_.col)){var L={row:_.row,col:_.col};if(void 0===L.col)for(L.col=0;used(L.row,L.col);)L.col++;else if(void 0===L.row)for(L.row=0;used(L.row,L.col);)L.row++;A[M.id()]=L,use(L.row,L.col)}}i.layoutPositions(this,e,function(e,t){if(e.locked()||e.isParent())return!1;var n,i,o=A[e.id()];if(o)n=o.col*y+y/2+a.x1,i=o.row*b+b/2+a.y1;else{for(;used(T,B);)moveToNextCell();
1n=B*y+y/2+a.x1,i=T*b+b/2+a.y1,use(T,B),moveToNextCell()}return{x:n,y:i}})}return this};var tA={ready:function(){},stop:function(){}};function NullLayout(e){this.options=j({},tA,e)}NullLayout.prototype.run=function(){var e=this.options,t=e.eles;return e.cy,this.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),this.one("layoutready",e.ready),this.emit("layoutready"),this.one("layoutstop",e.stop),this.emit("layoutstop"),this},NullLayout.prototype.stop=function(){return this};var tI={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,t){return!0},ready:void 0,stop:void 0,transform:function(e,t){return t}};function PresetLayout(e){this.options=j({},tI,e)}PresetLayout.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=fn$6(e.positions);return t.layoutPositions(this,e,function(t,i){var a=function(t){if(null==e.positions){var i;return{x:(i=t.position()).x,y:i.y}}if(n)return e.positions(t);var a=e.positions[t._private.data.id];return null==a?null:a}(t);return!t.locked()&&null!=a&&a}),this};var tM={fit:!0,padding:30,boundingBox: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 RandomLayout(e){this.options=j({},tM,e)}RandomLayout.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,i=makeBoundingBox(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()});return n.nodes().layoutPositions(this,e,function(e,t){return{x:i.x1+Math.round(Math.random()*i.w),y:i.y1+Math.round(Math.random()*i.h)}}),this};var t_=[{name:"breadthfirst",impl:BreadthFirstLayout},{name:"circle",impl:CircleLayout},{name:"concentric",impl:ConcentricLayout},{name:"cose",impl:CoseLayout},{name:"grid",impl:GridLayout},{name:"null",impl:NullLayout},{name:"preset",impl:PresetLayout},{name:"random",impl:RandomLayout}];function NullRenderer(e){this.options=e,this.notifications=0}var noop=function(){},throwImgErr=function(){throw Error("A headless instance can not render images")};NullRenderer.prototype={recalculateRenderedStyle:noop,notify:function(){this.notifications++},init:noop,isHeadless:function(){return!0},png:throwImgErr,jpg:throwImgErr};var tL={};tL.arrowShapeWidth=.3,tL.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,bbCollide=function(e,t,n,i,a,o,s){var l=a.x-n/2-s,u=a.x+n/2+s,c=a.y-n/2-s,d=a.y+n/2+s;return l<=e&&e<=u&&c<=t&&t<=d},transform=function(e,t,n,i,a){return{x:(e*Math.cos(i)-t*Math.sin(i))*n+a.x,y:(e*Math.sin(i)+t*Math.cos(i))*n+a.y}},transformPoints=function(e,t,n,i){for(var a=[],o=0;o<e.length;o+=2){var s=e[o],l=e[o+1];a.push(transform(s,l,t,n,i))}return a},pointsToArr=function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n];t.push(i.x,i.y)}return t},standardGap=function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").pfValue*2},defineArrowShape=function(n,i){string(i)&&(i=e[i]),e[n]=j({name:n,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(e,t,n,i,a,o){return pointInsidePolygonPoints(e,t,pointsToArr(transformPoints(this.points,n+2*o,i,a)))},roughCollide:bbCollide,draw:function(e,n,i,a){var o=transformPoints(this.points,n,i,a);t.arrowShapeImpl("polygon")(e,o)},spacing:function(e){return 0},gap:standardGap},i)};defineArrowShape("none",{collide:falsify,roughCollide:falsify,draw:noop$1,spacing:zeroify,gap:zeroify}),defineArrowShape("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),defineArrowShape("arrow","triangle"),defineArrowShape("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:bbCollide,draw:function(e,n,i,a,o){var s=transformPoints(this.points,n,i,a),l=this.controlPoint,u=transform(l[0],l[1],n,i,a);t.arrowShapeImpl(this.name)(e,s,u)},gap:function(e){return .8*standardGap(e)}}),defineArrowShape("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(e,t,n,i,a,o,s){var l=pointsToArr(transformPoints(this.points,n+2*s,i,a)),u=pointsToArr(transformPoints(this.pointsTee,n+2*s,i,a));return pointInsidePolygonPoints(e,t,l)||pointInsidePolygonPoints(e,t,u)},draw:function(e,n,i,a,o){var s=transformPoints(this.points,n,i,a),l=transformPoints(this.pointsTee,n,i,a);t.arrowShapeImpl(this.name)(e,s,l)}}),defineArrowShape("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(e,t,n,i,a,o,s){var l=Math.pow(a.x-e,2)+Math.pow(a.y-t,2)<=Math.pow((n+2*s)*this.radius,2);return pointInsidePolygonPoints(e,t,pointsToArr(transformPoints(this.points,n+2*s,i,a)))||l},draw:function(e,n,i,a,o){var s=transformPoints(this.pointsTr,n,i,a);t.arrowShapeImpl(this.name)(e,s,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),defineArrowShape("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(e,t){var n=this.baseCrossLinePts.slice(),i=t/e;return n[3]=n[3]-i,n[5]=n[5]-i,n},collide:function(e,t,n,i,a,o,s){var l=pointsToArr(transformPoints(this.points,n+2*s,i,a)),u=pointsToArr(transformPoints(this.crossLinePts(n,o),n+2*s,i,a));return pointInsidePolygonPoints(e,t,l)||pointInsidePolygonPoints(e,t,u)},draw:function(e,n,i,a,o){var s=transformPoints(this.points,n,i,a),l=transformPoints(this.crossLinePts(n,o),n,i,a);t.arrowShapeImpl(this.name)(e,s,l)}}),defineArrowShape("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(e){return .525*standardGap(e)}}),defineArrowShape("circle",{radius:.15,collide:function(e,t,n,i,a,o,s){return Math.pow(a.x-e,2)+Math.pow(a.y-t,2)<=Math.pow((n+2*s)*this.radius,2)},draw:function(e,n,i,a,o){t.arrowShapeImpl(this.name)(e,a.x,a.y,this.radius*n)},spacing:function(e){return t.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.radius}}),defineArrowShape("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(e){return 1},gap:function(e){return 1}}),defineArrowShape("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),defineArrowShape("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(e){return e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}}),defineArrowShape("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(e){return .95*e.pstyle("width").pfValue*e.pstyle("arrow-scale").value}})};var tO={};tO.projectIntoViewport=function(e,t){var n=this.cy,i=this.findContainerClientCoords(),a=i[0],o=i[1],s=i[4],l=n.pan(),u=n.zoom();return[((e-a)/s-l.x)/u,((t-o)/s-l.y)/u]},tO.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),styleValue=function(e){return parseFloat(n.getPropertyValue(e))},i={left:styleValue("padding-left"),right:styleValue("padding-right"),top:styleValue("padding-top"),bottom:styleValue("padding-bottom")},a={left:styleValue("border-left-width"),right:styleValue("border-right-width"),top:styleValue("border-top-width"),bottom:styleValue("border-bottom-width")},o=e.clientWidth,s=e.clientHeight,l=i.left+i.right,u=i.top+i.bottom,c=a.left+a.right,d=t.width/(o+c),h=t.left+i.left+a.left,p=t.top+i.top+a.top;return this.containerBB=[h,p,o-l,s-u,d]},tO.invalidateContainerClientCoordsCache=function(){this.containerBB=null},tO.findNearestElement=function(e,t,n,i){return this.findNearestElements(e,t,n,i)[0]},tO.findNearestElements=function(e,t,n,i){var a,o,s=this,l=this,u=l.getCachedZSortedEles(),c=[],d=l.cy.zoom(),h=l.cy.hasCompoundNodes(),p=(i?24:8)/d,g=(i?8:2)/d,v=(i?8:2)/d,y=1/0;function addEle(e,t){if(e.isNode()){if(o)return;o=e,c.push(e)}
1if(e.isEdge()&&(null==t||t<y)){if(a){if(a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value&&a.pstyle("z-compound-depth").value===e.pstyle("z-compound-depth").value){for(var n=0;n<c.length;n++)if(c[n].isEdge()){c[n]=e,a=e,y=null!=t?t:y;break}}}else c.push(e),a=e,y=null!=t?t:y}}function checkNode(n){var i=n.outerWidth()+2*g,a=n.outerHeight()+2*g,o=i/2,u=a/2,c=n.position();if(c.x-o<=e&&e<=c.x+o&&c.y-u<=t&&t<=c.y+u&&l.nodeShapes[s.getNodeShape(n)].checkPoint(e,t,0,i,a,c.x,c.y))return addEle(n,0),!0}function checkLabel(n,i){var a,o=n._private;a=i?i+"-":"",n.boundingBox();var s=o.labelBounds[i||"main"],l=n.pstyle(a+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=getPrefixedProperty(o.rscratch,"labelX",i),c=getPrefixedProperty(o.rscratch,"labelY",i),d=getPrefixedProperty(o.rscratch,"labelAngle",i),h=n.pstyle(a+"text-margin-x").pfValue,p=n.pstyle(a+"text-margin-y").pfValue,g=s.x1-v-h,y=s.x2+v-h,b=s.y1-v-p,x=s.y2+v-p;if(d){var w=Math.cos(d),E=Math.sin(d),rotate=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},C=rotate(g,b),S=rotate(g,x),P=rotate(y,b),k=rotate(y,x);if(pointInsidePolygonPoints(e,t,[C.x+h,C.y+p,P.x+h,P.y+p,k.x+h,k.y+p,S.x+h,S.y+p]))return addEle(n),!0}else if(inBoundingBox(s,e,t))return addEle(n),!0}}n&&(u=u.interactive);for(var b=u.length-1;b>=0;b--){var x=u[b];x.isNode()?checkNode(x)||checkLabel(x):function(n){var i,a=n._private,o=a.rscratch,u=n.pstyle("width").pfValue,d=n.pstyle("arrow-scale").value,g=u/2+p,v=g*g,y=2*g,b=a.source,x=a.target;if("segments"===o.edgeType||"straight"===o.edgeType||"haystack"===o.edgeType){for(var w,E,C,S,P=o.allpts,k=0;k+3<P.length;k+=2)if(w=P[k],E=P[k+1],C=P[k+2],S=P[k+3],Math.min(w,C)-y<=e&&e<=Math.max(w,C)+y&&Math.min(E,S)-y<=t&&t<=Math.max(E,S)+y&&v>(i=sqdistToFiniteLine(e,t,P[k],P[k+1],P[k+2],P[k+3])))return addEle(n,i),!0}else if("bezier"===o.edgeType||"multibezier"===o.edgeType||"self"===o.edgeType||"compound"===o.edgeType){for(var P=o.allpts,k=0;k+5<o.allpts.length;k+=4)if(inBezierVicinity(e,t,P[k],P[k+1],P[k+2],P[k+3],P[k+4],P[k+5],y)&&v>(i=sqdistToQuadraticBezier(e,t,P[k],P[k+1],P[k+2],P[k+3],P[k+4],P[k+5])))return addEle(n,i),!0}for(var b=b||a.source,x=x||a.target,D=s.getArrowWidth(u,d),T=[{name:"source",x:o.arrowStartX,y:o.arrowStartY,angle:o.srcArrowAngle},{name:"target",x:o.arrowEndX,y:o.arrowEndY,angle:o.tgtArrowAngle},{name:"mid-source",x:o.midX,y:o.midY,angle:o.midsrcArrowAngle},{name:"mid-target",x:o.midX,y:o.midY,angle:o.midtgtArrowAngle}],k=0;k<T.length;k++){var B=T[k],A=l.arrowShapes[n.pstyle(B.name+"-arrow-shape").value],I=n.pstyle("width").pfValue;if(A.roughCollide(e,t,D,B.angle,{x:B.x,y:B.y},I,p)&&A.collide(e,t,D,B.angle,{x:B.x,y:B.y},I,p))return addEle(n),!0}h&&c.length>0&&(checkNode(b),checkNode(x))}(x)||checkLabel(x)||checkLabel(x,"source")||checkLabel(x,"target")}return c},tO.getAllInBox=function(e,t,n,i){var a=this.getCachedZSortedEles().interactive,o=[],s=Math.min(e,n),l=Math.max(e,n),u=Math.min(t,i),c=Math.max(t,i);e=s,n=l;for(var d=makeBoundingBox({x1:e,y1:t=u,x2:n,y2:i=c}),h=0;h<a.length;h++){var p=a[h];if(p.isNode()){var g=p.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});boundingBoxesIntersect(d,g)&&!boundingBoxInBoundingBox(g,d)&&o.push(p)}else{var v=p._private,y=v.rscratch;if(null!=y.startX&&null!=y.startY&&!inBoundingBox(d,y.startX,y.startY)||null!=y.endX&&null!=y.endY&&!inBoundingBox(d,y.endX,y.endY))continue;if("bezier"===y.edgeType||"multibezier"===y.edgeType||"self"===y.edgeType||"compound"===y.edgeType||"segments"===y.edgeType||"haystack"===y.edgeType){for(var b,x=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,w=!0,E=0;E<x.length;E++)if(!inBoundingBox(d,(b=x[E]).x,b.y)){w=!1;break}w&&o.push(p)}else("haystack"===y.edgeType||"straight"===y.edgeType)&&o.push(p)}}return o};var tN={};tN.calculateArrowAngles=function(e){var t=e._private.rscratch,n="haystack"===t.edgeType,i="bezier"===t.edgeType,a="multibezier"===t.edgeType,o="segments"===t.edgeType,s="compound"===t.edgeType,l="self"===t.edgeType;if(n?(w=t.haystackPts[0],E=t.haystackPts[1],C=t.haystackPts[2],S=t.haystackPts[3]):(w=t.arrowStartX,E=t.arrowStartY,C=t.arrowEndX,S=t.arrowEndY),h=t.midX,p=t.midY,o)b=w-t.segpts[0],x=E-t.segpts[1];else if(a||s||l||i){var u=t.allpts,c=qbezierAt(u[0],u[2],u[4],.1),d=qbezierAt(u[1],u[3],u[5],.1);b=w-c,x=E-d}else b=w-h,x=E-p;t.srcArrowAngle=getAngleFromDisp(b,x);var h=t.midX,p=t.midY;if(n&&(h=(w+C)/2,p=(E+S)/2),b=C-w,x=S-E,o){var u=t.allpts;if(u.length/2%2==0){var g=u.length/2,v=g-2;
1b=u[g]-u[v],x=u[g+1]-u[v+1]}else{var g=u.length/2-1,v=g-2,y=g+2;b=u[g]-u[v],x=u[g+1]-u[v+1]}}else if(a||s||l){var b,x,w,E,C,S,h,p,P,k,D,T,u=t.allpts;if(t.ctrlpts.length/2%2==0){var B=u.length/2-1,A=B+2,I=A+2;P=qbezierAt(u[B],u[A],u[I],0),k=qbezierAt(u[B+1],u[A+1],u[I+1],0),D=qbezierAt(u[B],u[A],u[I],1e-4),T=qbezierAt(u[B+1],u[A+1],u[I+1],1e-4)}else{var A=u.length/2-1,B=A-2,I=A+2;P=qbezierAt(u[B],u[A],u[I],.4999),k=qbezierAt(u[B+1],u[A+1],u[I+1],.4999),D=qbezierAt(u[B],u[A],u[I],.5),T=qbezierAt(u[B+1],u[A+1],u[I+1],.5)}b=D-P,x=T-k}if(t.midtgtArrowAngle=getAngleFromDisp(b,x),t.midDispX=b,t.midDispY=x,b*=-1,x*=-1,o){var u=t.allpts;if(u.length/2%2==0);else{var g=u.length/2-1,y=g+2;b=-(u[y]-u[g]),x=-(u[y+1]-u[g+1])}}if(t.midsrcArrowAngle=getAngleFromDisp(b,x),o)b=C-t.segpts[t.segpts.length-2],x=S-t.segpts[t.segpts.length-1];else if(a||s||l||i){var u=t.allpts,M=u.length,c=qbezierAt(u[M-6],u[M-4],u[M-2],.9),d=qbezierAt(u[M-5],u[M-3],u[M-1],.9);b=C-c,x=S-d}else b=C-h,x=S-p;t.tgtArrowAngle=getAngleFromDisp(b,x)},tN.getArrowWidth=tN.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},i=n[e+", "+t];return i||(i=Math.max(Math.pow(13.37*e,.9),29)*t,n[e+", "+t]=i),i};var tz={};function getPts(e){var t=[];if(null!=e){for(var n=0;n<e.length;n+=2){var i=e[n],a=e[n+1];t.push({x:i,y:a})}return t}}tz.findMidptPtsEtc=function(e,t){var n,i=t.posPts,a=t.intersectionPts,o=t.vectorNormInverse,s=e.pstyle("source-endpoint"),l=e.pstyle("target-endpoint"),u=null!=s.units&&null!=l.units;switch(e.pstyle("edge-distances").value){case"node-position":n=i;break;case"intersection":n=a;break;case"endpoints":if(u){var c,d,h,p=_slicedToArray(this.manualEndptToPx(e.source()[0],s),2),g=p[0],v=p[1],y=_slicedToArray(this.manualEndptToPx(e.target()[0],l),2),b=y[0],x=y[1];c=x-v,h=Math.sqrt((d=b-g)*d+c*c),o={x:-c/h,y:d/h},n={x1:g,y1:v,x2:b,y2:x}}else warn("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default).")),n=a}return{midptPts:n,vectorNormInverse:o}},tz.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],i=n._private,a=i.rscratch;if(!a.haystack){var o=2*Math.random()*Math.PI;a.source={x:Math.cos(o),y:Math.sin(o)},o=2*Math.random()*Math.PI,a.target={x:Math.cos(o),y:Math.sin(o)}}var s=i.source,l=i.target,u=s.position(),c=l.position(),d=s.width(),h=l.width(),p=s.height(),g=l.height(),v=n.pstyle("haystack-radius").value/2;a.haystackPts=a.allpts=[a.source.x*d*v+u.x,a.source.y*p*v+u.y,a.target.x*h*v+c.x,a.target.y*g*v+c.y],a.midX=(a.allpts[0]+a.allpts[2])/2,a.midY=(a.allpts[1]+a.allpts[3])/2,a.edgeType="haystack",a.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},tz.findSegmentsPoints=function(e,t){var n=e._private.rscratch,i=e.pstyle("segment-weights"),a=e.pstyle("segment-distances"),o=Math.min(i.pfValue.length,a.pfValue.length);n.edgeType="segments",n.segpts=[];for(var s=0;s<o;s++){var l=i.pfValue[s],u=a.pfValue[s],c=1-l,d=this.findMidptPtsEtc(e,t),h=d.midptPts,p=d.vectorNormInverse,g={x:h.x1*c+h.x2*l,y:h.y1*c+h.y2*l};n.segpts.push(g.x+p.x*u,g.y+p.y*u)}},tz.findLoopPoints=function(e,t,n,i){var a=e._private.rscratch,o=t.dirCounts,s=t.srcPos,l=e.pstyle("control-point-distances"),u=l?l.pfValue[0]:void 0,c=e.pstyle("loop-direction").pfValue,d=e.pstyle("loop-sweep").pfValue,h=e.pstyle("control-point-step-size").pfValue;a.edgeType="self";var p=n,g=h;i&&(p=0,g=u);var v=c-Math.PI/2,y=v-d/2,b=v+d/2,x=String(c+"_"+d);p=void 0===o[x]?o[x]=0:++o[x],a.ctrlpts=[s.x+1.4*Math.cos(y)*g*(p/3+1),s.y+1.4*Math.sin(y)*g*(p/3+1),s.x+1.4*Math.cos(b)*g*(p/3+1),s.y+1.4*Math.sin(b)*g*(p/3+1)]},tz.findCompoundLoopPoints=function(e,t,n,i){var a=e._private.rscratch;a.edgeType="compound";var o=t.srcPos,s=t.tgtPos,l=t.srcW,u=t.srcH,c=t.tgtW,d=t.tgtH,h=e.pstyle("control-point-step-size").pfValue,p=e.pstyle("control-point-distances"),g=p?p.pfValue[0]:void 0,v=n,y=h;i&&(v=0,y=g);var b={x:o.x-l/2,y:o.y-u/2},x={x:s.x-c/2,y:s.y-d/2},w={x:Math.min(b.x,x.x),y:Math.min(b.y,x.y)};a.ctrlpts=[w.x,w.y-1.7995514309304248*y*(v/3+1)*Math.max(.5,Math.log(.01*l)),w.x-1.7995514309304248*y*(v/3+1)*Math.max(.5,Math.log(.01*c)),w.y]},tz.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},tz.findBezierPoints=function(e,t,n,i,a){var o=e._private.rscratch,s=e.pstyle("control-point-step-size").pfValue,l=e.pstyle("control-point-distances"),u=e.pstyle("control-point-we
1ights"),c=l&&u?Math.min(l.value.length,u.value.length):1,d=l?l.pfValue[0]:void 0,h=u.value[0];o.edgeType=i?"multibezier":"bezier",o.ctrlpts=[];for(var p=0;p<c;p++){var g=(.5-t.eles.length/2+n)*s*(a?-1:1),v=void 0,y=signum(g);i&&(d=l?l.pfValue[p]:s,h=u.value[p]);var b=void 0!==(v=i?d:void 0!==d?y*d:void 0)?v:g,x=1-h,w=h,E=this.findMidptPtsEtc(e,t),C=E.midptPts,S=E.vectorNormInverse,P={x:C.x1*x+C.x2*w,y:C.y1*x+C.y2*w};o.ctrlpts.push(P.x+S.x*b,P.y+S.y*b)}},tz.findTaxiPoints=function(e,t){var n,i=e._private.rscratch;i.edgeType="segments";var a="vertical",o="horizontal",s="leftward",l="rightward",u="downward",c="upward",d=t.posPts,h=t.srcW,p=t.srcH,g=t.tgtW,v=t.tgtH,y="node-position"!==e.pstyle("edge-distances").value,b=e.pstyle("taxi-direction").value,x=b,w=e.pstyle("taxi-turn"),E="%"===w.units,C=w.pfValue,S=e.pstyle("taxi-turn-min-distance").pfValue,P=d.x2-d.x1,k=d.y2-d.y1,subDWH=function(e,t){return e>0?Math.max(e-t,0):Math.min(e+t,0)},D=subDWH(P,y?(h+g)/2:0),T=subDWH(k,y?(p+v)/2:0),B=!1;"auto"===x?b=Math.abs(D)>Math.abs(T)?o:a:x===c||x===u?(b=a,B=!0):(x===s||x===l)&&(b=o,B=!0);var A=b===a,I=A?T:D,M=A?k:P,_=signum(M),L=!1;!(B&&(E||C<0))&&(x===u&&M<0||x===c&&M>0||x===s&&M>0||x===l&&M<0)&&(_*=-1,I=_*Math.abs(I),L=!0);var getIsTooClose=function(e){return Math.abs(e)<S||Math.abs(e)>=Math.abs(I)},O=getIsTooClose(n=E?(C<0?1+C:C)*I:(C<0?I:0)+C*_),N=getIsTooClose(Math.abs(I)-Math.abs(n));if((O||N)&&!L){if(A){var z=Math.abs(P)<=g/2;if(Math.abs(M)<=p/2){var R=(d.x1+d.x2)/2,F=d.y1,V=d.y2;i.segpts=[R,F,R,V]}else if(z){var q=(d.y1+d.y2)/2,j=d.x1,$=d.x2;i.segpts=[j,q,$,q]}else i.segpts=[d.x1,d.y2]}else{var X=Math.abs(k)<=v/2;if(Math.abs(M)<=h/2){var Y=(d.y1+d.y2)/2,H=d.x1,W=d.x2;i.segpts=[H,Y,W,Y]}else if(X){var U=(d.x1+d.x2)/2,G=d.y1,K=d.y2;i.segpts=[U,G,U,K]}else i.segpts=[d.x2,d.y1]}}else if(A){var Q=d.y1+n+(y?p/2*_:0),Z=d.x1,J=d.x2;i.segpts=[Z,Q,J,Q]}else{var ee=d.x1+n+(y?h/2*_:0),et=d.y1,en=d.y2;i.segpts=[ee,et,ee,en]}},tz.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var i=t.srcPos,a=t.tgtPos,o=t.srcW,s=t.srcH,l=t.tgtW,u=t.tgtH,c=t.srcShape,d=t.tgtShape,h=!number$1(n.startX)||!number$1(n.startY),p=!number$1(n.arrowStartX)||!number$1(n.arrowStartY),g=!number$1(n.endX)||!number$1(n.endY),v=!number$1(n.arrowEndX)||!number$1(n.arrowEndY),y=3*(this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth),b=dist({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=b<y,w=dist({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),E=w<y,C=!1;if(h||p||x){C=!0;var S={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},P=Math.sqrt(S.x*S.x+S.y*S.y),k={x:S.x/P,y:S.y/P},D=Math.max(o,s),T={x:n.ctrlpts[0]+2*k.x*D,y:n.ctrlpts[1]+2*k.y*D},B=c.intersectLine(i.x,i.y,o,s,T.x,T.y,0);x?(n.ctrlpts[0]=n.ctrlpts[0]+k.x*(y-b),n.ctrlpts[1]=n.ctrlpts[1]+k.y*(y-b)):(n.ctrlpts[0]=B[0]+k.x*y,n.ctrlpts[1]=B[1]+k.y*y)}if(g||v||E){C=!0;var A={x:n.ctrlpts[0]-a.x,y:n.ctrlpts[1]-a.y},I=Math.sqrt(A.x*A.x+A.y*A.y),M={x:A.x/I,y:A.y/I},_=Math.max(o,s),L={x:n.ctrlpts[0]+2*M.x*_,y:n.ctrlpts[1]+2*M.y*_},O=d.intersectLine(a.x,a.y,l,u,L.x,L.y,0);E?(n.ctrlpts[0]=n.ctrlpts[0]+M.x*(y-w),n.ctrlpts[1]=n.ctrlpts[1]+M.y*(y-w)):(n.ctrlpts[0]=O[0]+M.x*y,n.ctrlpts[1]=O[1]+M.y*y)}C&&this.findEndpoints(e)}},tz.storeAllpts=function(e){var t=e._private.rscratch;if("multibezier"===t.edgeType||"bezier"===t.edgeType||"self"===t.edgeType||"compound"===t.edgeType){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n,i=0;i+1<t.ctrlpts.length;i+=2)t.allpts.push(t.ctrlpts[i],t.ctrlpts[i+1]),i+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[i]+t.ctrlpts[i+2])/2,(t.ctrlpts[i+1]+t.ctrlpts[i+3])/2);(t.allpts.push(t.endX,t.endY),t.ctrlpts.length/2%2==0)?(n=t.allpts.length/2-1,t.midX=t.allpts[n],t.midY=t.allpts[n+1]):(n=t.allpts.length/2-3,t.midX=qbezierAt(t.allpts[n],t.allpts[n+2],t.allpts[n+4],.5),t.midY=qbezierAt(t.allpts[n+1],t.allpts[n+3],t.allpts[n+5],.5))}else if("straight"===t.edgeType)t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if("segments"===t.edgeType){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.segpts.length%4==0){var a=t.segpts.length/2,o=a-2;t.midX=(t.segpts[o]+t.segpts[a])/2,t.midY=(t.segpts[o+1]+t.segpts[a+1])/2}else{var s=t.segpts.length/2-1;t.midX=t.segpts[s],t.midY=t.segpts[s+1]}}},tz.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||number$1(t.startX)&&number$1(t.startY)&&number$1(t.endX)&&number$1(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,warn("Edge `"+e.id()+"` has invali
1d 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."))},tz.findEdgeControlPoints=function(e){var t=this;if(e&&0!==e.length){for(var n=this,i=n.cy.hasCompoundNodes(),a={map:new J,get:function(e){var t=this.map.get(e[0]);return null!=t?t.get(e[1]):null},set:function(e,t){var n=this.map.get(e[0]);null==n&&(n=new J,this.map.set(e[0],n)),n.set(e[1],t)}},o=[],s=[],l=0;l<e.length;l++){var u=e[l],c=u._private,d=u.pstyle("curve-style").value;if(!u.removed()&&u.takesUpSpace()){if("haystack"===d){s.push(u);continue}var h="unbundled-bezier"===d||"segments"===d||"straight"===d||"straight-triangle"===d||"taxi"===d,p="unbundled-bezier"===d||"bezier"===d,g=c.source,v=c.target,y=[g.poolIndex(),v.poolIndex()].sort(),b=a.get(y);null==b&&(b={eles:[]},a.set(y,b),o.push(y)),b.eles.push(u),h&&(b.hasUnbundled=!0),p&&(b.hasBezier=!0)}}for(var x=0;x<o.length;x++)!function(e){var s=o[e],l=a.get(s),u=void 0;if(!l.hasUnbundled){var c=l.eles[0].parallelEdges().filter(function(e){return e.isBundledBezier()});clearArray(l.eles),c.forEach(function(e){return l.eles.push(e)}),l.eles.sort(function(e,t){return e.poolIndex()-t.poolIndex()})}var d=l.eles[0],h=d.source(),p=d.target();if(h.poolIndex()>p.poolIndex()){var g=h;h=p,p=g}var v=l.srcPos=h.position(),y=l.tgtPos=p.position(),b=l.srcW=h.outerWidth(),x=l.srcH=h.outerHeight(),w=l.tgtW=p.outerWidth(),E=l.tgtH=p.outerHeight(),C=l.srcShape=n.nodeShapes[t.getNodeShape(h)],S=l.tgtShape=n.nodeShapes[t.getNodeShape(p)];l.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var P=0;P<l.eles.length;P++){var k=l.eles[P],D=k[0]._private.rscratch,T=k.pstyle("curve-style").value,B="unbundled-bezier"===T||"segments"===T||"taxi"===T,A=!h.same(k.source());if(!l.calculatedIntersection&&h!==p&&(l.hasBezier||l.hasUnbundled)){l.calculatedIntersection=!0;var I=C.intersectLine(v.x,v.y,b,x,y.x,y.y,0),M=l.srcIntn=I,_=S.intersectLine(y.x,y.y,w,E,v.x,v.y,0),L=l.tgtIntn=_,O=l.intersectionPts={x1:I[0],x2:_[0],y1:I[1],y2:_[1]},N=l.posPts={x1:v.x,x2:y.x,y1:v.y,y2:y.y},z=_[1]-I[1],R=_[0]-I[0],F=Math.sqrt(R*R+z*z),V=l.vector={x:R,y:z},q=l.vectorNorm={x:V.x/F,y:V.y/F},j={x:-q.y,y:q.x};l.nodesOverlap=!number$1(F)||S.checkPoint(I[0],I[1],0,w,E,y.x,y.y)||C.checkPoint(_[0],_[1],0,b,x,v.x,v.y),l.vectorNormInverse=j,u={nodesOverlap:l.nodesOverlap,dirCounts:l.dirCounts,calculatedIntersection:!0,hasBezier:l.hasBezier,hasUnbundled:l.hasUnbundled,eles:l.eles,srcPos:y,tgtPos:v,srcW:w,srcH:E,tgtW:b,tgtH:x,srcIntn:L,tgtIntn:M,srcShape:S,tgtShape:C,posPts:{x1:N.x2,y1:N.y2,x2:N.x1,y2:N.y1},intersectionPts:{x1:O.x2,y1:O.y2,x2:O.x1,y2:O.y1},vector:{x:-V.x,y:-V.y},vectorNorm:{x:-q.x,y:-q.y},vectorNormInverse:{x:-j.x,y:-j.y}}}var $=A?u:l;D.nodesOverlap=$.nodesOverlap,D.srcIntn=$.srcIntn,D.tgtIntn=$.tgtIntn,i&&(h.isParent()||h.isChild()||p.isParent()||p.isChild())&&(h.parents().anySame(p)||p.parents().anySame(h)||h.same(p)&&h.isParent())?t.findCompoundLoopPoints(k,$,P,B):h===p?t.findLoopPoints(k,$,P,B):"segments"===T?t.findSegmentsPoints(k,$):"taxi"===T?t.findTaxiPoints(k,$):"straight"!==T&&(B||l.eles.length%2!=1||P!==Math.floor(l.eles.length/2))?t.findBezierPoints(k,$,P,B,A):t.findStraightEdgePoints(k),t.findEndpoints(k),t.tryToCorrectInvalidPoints(k,$),t.checkForInvalidEdgeWarning(k),t.storeAllpts(k),t.storeEdgeProjections(k),t.calculateArrowAngles(k),t.recalculateEdgeLabelProjections(k),t.calculateLabelAngles(k)}}(x);this.findHaystackPoints(s)}},tz.getSegmentPoints=function(e){var t=e[0]._private.rscratch;if("segments"===t.edgeType)return this.recalculateRenderedStyle(e),getPts(t.segpts)},tz.getControlPoints=function(e){var t=e[0]._private.rscratch,n=t.edgeType;if("bezier"===n||"multibezier"===n||"self"===n||"compound"===n)return this.recalculateRenderedStyle(e),getPts(t.ctrlpts)},tz.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var tR={};tR.manualEndptToPx=function(e,t){var n=e.position(),i=e.outerWidth(),a=e.outerHeight();if(2===t.value.length){var o=[t.pfValue[0],t.pfValue[1]];return"%"===t.units[0]&&(o[0]=o[0]*i),"%"===t.units[1]&&(o[1]=o[1]*a),o[0]+=n.x,o[1]+=n.y,o}var s=t.pfValue[0];s=-Math.PI/2+s;var l=2*Math.max(i,a),u=[n.x+Math.cos(s)*l,n.y+Math.sin(s)*l];return this.nodeShapes[this.getNodeShape(e)].intersectLine(n.x,n.y,i,a,u[0],u[1],0)},tR.findEndpoints=function(e){var t,n,i,a,o,s=e.source()[0],l=e.target()[0],u=s.position(),c=l.position(),d=e.pstyle("target-arrow-shape").value,h=e.pstyle("source-arrow-shape").value,p=e.pstyle("target-distance-from-node").pfValue,g=e.pstyle("source-distance-from-node").pfValue,v=e.pstyle("curve-style").value,y=e._private.rscratch,b=y.edgeType,x="self"===b||"compound"===b,w="bezier"===b||"multibezier"===b||x,E="bezier"!==b,C="straight"===b||"segments"===b,S="segments"===b,P=x||"taxi"===v,k=e.pstyle("source-endpoint"),D=P?"outside-to-node":k.value,T=e.pstyle("target-endpoint"),B=P?"outside-to-node":T.value;if(y.srcManEndpt=k,y.tgtManEndpt=T,w){var A=[y.ctrlpts[0],y.ctrlpts[1]];n=E?[y.ctrlpts[y.ctrlpts.length-2],y.ctrlpts[y.ctrlpts.length-1]]:A,i=A}else if(C){var I=S?y.segpts.slice(0,2):[c.x,c.y];n=S?y.segpts.slice(y.segpts.length-2):[u.x,u.y],i=I}if("inside-to-node"===B)t=[c.x,c.y];else if(T.units)t=this.manualEndptToPx(l,T);else if("outside-to-line"===B)t=y.tgtIntn;else if("outside-to-node"===B||"outside-to-node-or-label"===B?a=n:("outside-to-line"===B||"outside-to-line-or-label"===B)&&(a=[u.x,u.y]),t=this.nodeShapes[this.getNodeShape(l)].intersectLine(c.x,c.y,l.outerWidth(),l.outerHeight(),a[0],a[1],0),"outside-to-node-or-label"===B||"outside-to-line-or-label"===B){var M=l._private.rscratch,_=M.labelWidth,L=M.labelHeight,O=M.labelX,N=M.labelY,z=_/2,R=L/2,F=l.pstyle("text-valign").value;
1"top"===F?N-=R:"bottom"===F&&(N+=R);var V=l.pstyle("text-halign").value;"left"===V?O-=z:"right"===V&&(O+=z);var q=polygonIntersectLine(a[0],a[1],[O-z,N-R,O+z,N-R,O+z,N+R,O-z,N+R],c.x,c.y);if(q.length>0){var j=sqdist(u,array2point(t)),$=sqdist(u,array2point(q)),X=j;$<j&&(t=q,X=$),q.length>2&&sqdist(u,{x:q[2],y:q[3]})<X&&(t=[q[2],q[3]])}}var Y=shortenIntersection(t,n,this.arrowShapes[d].spacing(e)+p),H=shortenIntersection(t,n,this.arrowShapes[d].gap(e)+p);if(y.endX=H[0],y.endY=H[1],y.arrowEndX=Y[0],y.arrowEndY=Y[1],"inside-to-node"===D)t=[u.x,u.y];else if(k.units)t=this.manualEndptToPx(s,k);else if("outside-to-line"===D)t=y.srcIntn;else if("outside-to-node"===D||"outside-to-node-or-label"===D?o=i:("outside-to-line"===D||"outside-to-line-or-label"===D)&&(o=[c.x,c.y]),t=this.nodeShapes[this.getNodeShape(s)].intersectLine(u.x,u.y,s.outerWidth(),s.outerHeight(),o[0],o[1],0),"outside-to-node-or-label"===D||"outside-to-line-or-label"===D){var W=s._private.rscratch,U=W.labelWidth,G=W.labelHeight,K=W.labelX,Q=W.labelY,Z=U/2,J=G/2,ee=s.pstyle("text-valign").value;"top"===ee?Q-=J:"bottom"===ee&&(Q+=J);var et=s.pstyle("text-halign").value;"left"===et?K-=Z:"right"===et&&(K+=Z);var en=polygonIntersectLine(o[0],o[1],[K-Z,Q-J,K+Z,Q-J,K+Z,Q+J,K-Z,Q+J],u.x,u.y);if(en.length>0){var er=sqdist(c,array2point(t)),ei=sqdist(c,array2point(en)),ea=er;ei<er&&(t=[en[0],en[1]],ea=ei),en.length>2&&sqdist(c,{x:en[2],y:en[3]})<ea&&(t=[en[2],en[3]])}}var eo=shortenIntersection(t,i,this.arrowShapes[h].spacing(e)+g),es=shortenIntersection(t,i,this.arrowShapes[h].gap(e)+g);y.startX=es[0],y.startY=es[1],y.arrowStartX=eo[0],y.arrowStartY=eo[1],(w||E||C)&&(number$1(y.startX)&&number$1(y.startY)&&number$1(y.endX)&&number$1(y.endY)?y.badLine=!1:y.badLine=!0)},tR.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[0],y:t.haystackPts[1]}:{x:t.arrowStartX,y:t.arrowStartY}},tR.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;return(this.recalculateRenderedStyle(e),"haystack"===t.edgeType)?{x:t.haystackPts[2],y:t.haystackPts[3]}:{x:t.arrowEndX,y:t.arrowEndY}};var tF={};tF.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,i=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,"multibezier"===i||"bezier"===i||"self"===i||"compound"===i){t.rstyle.bezierPts=[];for(var a=0;a+5<n.allpts.length;a+=4)!function(e,t,n){for(var qbezierAt$1=function(e,t,n,i){return qbezierAt(e,t,n,i)},i=t._private.rstyle.bezierPts,a=0;a<e.bezierProjPcts.length;a++){var o=e.bezierProjPcts[a];i.push({x:qbezierAt$1(n[0],n[2],n[4],o),y:qbezierAt$1(n[1],n[3],n[5],o)})}}(this,e,n.allpts.slice(a,a+6))}else if("segments"===i)for(var o=t.rstyle.linePts=[],a=0;a+1<n.allpts.length;a+=2)o.push({x:n.allpts[a],y:n.allpts[a+1]});else if("haystack"===i){var s=n.haystackPts;t.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},tF.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var tV={};tV.recalculateNodeLabelProjection=function(e){if(!emptyString(e.pstyle("label").strValue)){var t,n,i=e._private,a=e.width(),o=e.height(),s=e.padding(),l=e.position(),u=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,d=i.rscratch,h=i.rstyle;switch(u){case"left":t=l.x-a/2-s;break;case"right":t=l.x+a/2+s;break;default:t=l.x}
1switch(c){case"top":n=l.y-o/2-s;break;case"bottom":n=l.y+o/2+s;break;default:n=l.y}d.labelX=t,d.labelY=n,h.labelX=t,h.labelY=n,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var lineAngleFromDelta=function(e,t){var n=Math.atan(t/e);return 0===e&&n<0&&(n*=-1),n},lineAngle=function(e,t){return lineAngleFromDelta(t.x-e.x,t.y-e.y)},bezierAngle=function(e,t,n,i){var a=bound(0,i-.001,1),o=bound(0,i+.001,1);return lineAngle(qbezierPtAt(e,t,n,a),qbezierPtAt(e,t,n,o))};tV.recalculateEdgeLabelProjections=function(e){var t,n=e._private,i=n.rscratch,a=this,o={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(o.mid||o.source||o.target){t={x:i.midX,y:i.midY};var setRs=function(e,t,i){setPrefixedProperty(n.rscratch,e,t,i),setPrefixedProperty(n.rstyle,e,t,i)};setRs("labelX",null,t.x),setRs("labelY",null,t.y),setRs("labelAutoAngle",null,lineAngleFromDelta(i.midDispX,i.midDispY));var createControlPointInfo=function createControlPointInfo(){if(createControlPointInfo.cache)return createControlPointInfo.cache;for(var e=[],t=0;t+5<i.allpts.length;t+=4){var o={x:i.allpts[t],y:i.allpts[t+1]},s={x:i.allpts[t+2],y:i.allpts[t+3]},l={x:i.allpts[t+4],y:i.allpts[t+5]};e.push({p0:o,p1:s,p2:l,startDist:0,length:0,segments:[]})}var u=n.rstyle.bezierPts,c=a.bezierProjPcts.length;function addSegment(e,t,n,i,a){var o=dist(t,n),s=e.segments[e.segments.length-1],l={p0:t,p1:n,t0:i,t1:a,startDist:s?s.startDist+s.length:0,length:o};e.segments.push(l),e.length+=o}for(var d=0;d<e.length;d++){var h=e[d],p=e[d-1];p&&(h.startDist=p.startDist+p.length),addSegment(h,h.p0,u[d*c],0,a.bezierProjPcts[0]);for(var g=0;g<c-1;g++)addSegment(h,u[d*c+g],u[d*c+g+1],a.bezierProjPcts[g],a.bezierProjPcts[g+1]);addSegment(h,u[d*c+c-1],h.p2,a.bezierProjPcts[c-1],1)}return createControlPointInfo.cache=e},calculateEndProjection=function(n){var a="source"===n;if(o[n]){var s=e.pstyle(n+"-text-offset").pfValue;switch(i.edgeType){case"self":case"compound":case"bezier":case"multibezier":for(var l,u,c=createControlPointInfo(),d=0,h=0,p=0;p<c.length;p++){for(var g=c[a?p:c.length-1-p],v=0;v<g.segments.length;v++){var y=g.segments[a?v:g.segments.length-1-v],b=p===c.length-1&&v===g.segments.length-1;if(d=h,(h+=y.length)>=s||b){u={cp:g,segment:y};break}}if(u)break}var x=u.cp,w=u.segment,E=(s-d)/w.length,C=w.t1-w.t0,S=a?w.t0+C*E:w.t1-C*E;S=bound(0,S,1),t=qbezierPtAt(x.p0,x.p1,x.p2,S),l=bezierAngle(x.p0,x.p1,x.p2,S);break;case"straight":case"segments":case"haystack":for(var P,k,D,T,B=0,A=i.allpts.length,I=0;I+3<A&&(a?(P={x:i.allpts[I],y:i.allpts[I+1]},k={x:i.allpts[I+2],y:i.allpts[I+3]}):(P={x:i.allpts[A-2-I],y:i.allpts[A-1-I]},k={x:i.allpts[A-4-I],y:i.allpts[A-3-I]}),D=dist(P,k),T=B,!((B+=D)>=s));I+=2);var M=(s-T)/D;t=lineAt(P,k,M=bound(0,M,1)),l=lineAngle(P,k)}setRs("labelX",n,t.x),setRs("labelY",n,t.y),setRs("labelAutoAngle",n,l)}};calculateEndProjection("source"),calculateEndProjection("target"),this.applyLabelDimensions(e)}},tV.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},tV.applyPrefixedLabelDimensions=function(e,t){var n=e._private,i=this.getLabelText(e,t),a=this.calculateLabelDimensions(e,i),o=e.pstyle("line-height").pfValue,s=e.pstyle("text-wrap").strValue,l=getPrefixedProperty(n.rscratch,"labelWrapCachedLines",t)||[],u="wrap"!==s?1:Math.max(l.length,1),c=a.height/u,d=a.width,h=a.height+(u-1)*(o-1)*c;setPrefixedProperty(n.rstyle,"labelWidth",t,d),setPrefixedProperty(n.rscratch,"labelWidth",t,d),setPrefixedProperty(n.rstyle,"labelHeight",t,h),setPrefixedProperty(n.rscratch,"labelHeight",t,h),setPrefixedProperty(n.rscratch,"labelLineHeight",t,c*o)},tV.getLabelText=function(e,t){var n=e._private,i=t?t+"-":"",a=e.pstyle(i+"label").strValue,o=e.pstyle("text-transform").value,rscratch=function(e,i){return i?(setPrefixedProperty(n.rscratch,e,t,i),i):getPrefixedProperty(n.rscratch,e,t)};if(!a)return"";"none"==o||("uppercase"==o?a=a.toUpperCase():"lowercase"==o&&(a=a.toLowerCase()));var s=e.pstyle("text-wrap").value;if("wrap"===s){var l=rscratch("labelKey");if(null!=l&&rscratch("labelWrapKey")===l)return rscratch("labelWrapCachedText");for(var u=a.split("\n"),c=e.pstyle("text-max-width").pfValue,d="anywhere"===e.pstyle("text-overflow-wrap").value,h=[],p=/[\s\u200b]+/,g=d?"":" ",v=0;v<u.length;v++){var y=u[v],b=this.calculateLabelDimensions(e,y).width;if(d&&(y=y.split("").join("​")),b>c){for(var x=y.split(p),w="",E=0;E<x.length;E++){var C=x[E],S=0===w.length?C:w+g+C;this.calculateLabelDimensions(e,S).width<=c?w+=C+g:(w&&h.push(w),w=C+g)}w.match(/^[\s\u200b]+$/)||h.push(w)}else h.push(y)}rscratch("labelWrapCachedLines",h),a=rscratch("labelWrapCachedText",h.join("\n")),rscratch("labelWrapKey",l)}else if("ellipsis"===s){var P=e.pstyle("text-max-width").pfValue,k="",D=!1;if(this.calculateLabelDimensions(e,a).width<P)return a;for(var T=0;T<a.length&&!(this.calculateLabelDimensions(e,k+a[T]+"…").width>P);T++)k+=a[T],T===a.length-1&&(D=!0);return D||(k+="…"),k}return a}
1,tV.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if("auto"!==t)return t;if(!e.isNode())return"center";switch(n){case"left":return"right";case"right":return"left";default:return"center"}},tV.calculateLabelDimensions=function(e,t){var n=hashString(t,e._private.labelDimsKey),i=this.labelDimCache||(this.labelDimCache=[]),a=i[n];if(null!=a)return a;var o=e.pstyle("font-style").strValue,s=e.pstyle("font-size").pfValue,l=e.pstyle("font-family").strValue,u=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,d=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=document.createElement("canvas"),d=this.labelCalcCanvasContext=c.getContext("2d");var h=c.style;h.position="absolute",h.left="-9999px",h.top="-9999px",h.zIndex="-1",h.visibility="hidden",h.pointerEvents="none"}d.font="".concat(o," ").concat(u," ").concat(s,"px ").concat(l);for(var p=0,g=0,v=t.split("\n"),y=0;y<v.length;y++){var b=v[y];p=Math.max(Math.ceil(d.measureText(b).width),p),g+=s}return p+=0,g+=0,i[n]={width:p,height:g}},tV.calculateLabelAngle=function(e,t){var n=e._private.rscratch,i=e.isEdge(),a=e.pstyle((t?t+"-":"")+"text-rotation"),o=a.strValue;return"none"===o?0:i&&"autorotate"===o?n.labelAutoAngle:"autorotate"===o?0:a.pfValue},tV.calculateLabelAngles=function(e){var t=e.isEdge(),n=e._private.rscratch;n.labelAngle=this.calculateLabelAngle(e),t&&(n.sourceLabelAngle=this.calculateLabelAngle(e,"source"),n.targetLabelAngle=this.calculateLabelAngle(e,"target"))};var tq={},tj=!1;tq.getNodeShape=function(e){var t=e.pstyle("shape").value;if("cutrectangle"===t&&(28>e.width()||28>e.height()))return tj||(warn("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),tj=!0),"rectangle";if(e.isParent())return"rectangle"===t||"roundrectangle"===t||"round-rectangle"===t||"cutrectangle"===t||"cut-rectangle"===t||"barrel"===t?t:"rectangle";if("polygon"===t){var n=e.pstyle("shape-polygon-points").value;return this.nodeShapes.makePolygon(n).name}return t};var t$={};t$.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,enqueue=function(e){var n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(t.merge(e),n)for(var i=0;i<e.length;i++){var a=e[i]._private.rstyle;a.clean=!1,a.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(e){enqueue(e.target)}).on("style.* background.*",function(e){enqueue(e.target,!1)});var updateEleCalcs=function(i){if(i){var a=n.onUpdateEleCalcsFns;t.cleanStyle();for(var o=0;o<t.length;o++){var s=t[o],l=s._private.rstyle;s.isNode()&&!l.cleanConnected&&(enqueue(s.connectedEdges()),l.cleanConnected=!0)}if(a)for(var u=0;u<a.length;u++)(0,a[u])(i,t);n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){updateEleCalcs(!0)},n.beforeRender(updateEleCalcs,n.beforeRenderPriorities.eleCalcs)},t$.onUpdateEleCalcs=function(e){(this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[]).push(e)},t$.recalculateRenderedStyle=function(e,t){var isCleanConnected=function(e){return e._private.rstyle.cleanConnected},n=[],i=[];if(!this.destroyed){void 0===t&&(t=!0);for(var a=0;a<e.length;a++){var o=e[a],s=o._private,l=s.rstyle;!o.isEdge()||isCleanConnected(o.source())&&isCleanConnected(o.target())||(l.clean=!1),t&&l.clean||o.removed()||"none"===o.pstyle("display").value||("nodes"===s.group?i.push(o):n.push(o),l.clean=!0)}for(var u=0;u<i.length;u++){var c=i[u],d=c._private.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(n);for(var p=0;p<n.length;p++){var g=n[p]._private,v=g.rstyle,y=g.rscratch;v.srcX=y.arrowStartX,v.srcY=y.arrowStartY,v.tgtX=y.arrowEndX,v.tgtY=y.arrowEndY,v.midX=y.midX,v.midY=y.midY,v.labelAngle=y.labelAngle,v.sourceLabelAngle=y.sourceLabelAngle,v.targetLabelAngle=y.targetLabelAngle}}};var tX={};tX.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var i=e[n],a=i._private.rscratch;
1i.grabbed()&&!i.isParent()?t.push(i):a.inDragLayer?e.drag.push(i):e.nondrag.push(i)}for(var n=0;n<t.length;n++){var i=t[n];e.drag.push(i)}}},tX.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},tX.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(zIndexSort),t.interactive=t.filter(function(e){return e.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var tY={};[tO,tN,tz,tR,tF,tV,tq,t$,tX].forEach(function(e){j(tY,e)});var tH={};tH.getCachedImage=function(e,t,n){var i=this.imageCache=this.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;var o=(a=i[e]=i[e]||{}).image=new Image;o.addEventListener("load",n),o.addEventListener("error",function(){o.error=!0});var s="data:";return e.substring(0,s.length).toLowerCase()!==s&&(t="null"===t?null:t,o.crossOrigin=t),o.src=e,o};var tW={};tW.registerBinding=function(e,t,n,i){var a=Array.prototype.slice.apply(arguments,[1]),o=this.binder(e);return o.on.apply(o,a)},tW.binder=function(e){var t=this,n=t.cy.window(),i=e===n||e===n.document||e===n.document.body||"undefined"!=typeof HTMLElement&&e instanceof HTMLElement;if(null==t.supportsPassiveEvents){var a=!1;try{var o=Object.defineProperty({},"passive",{get:function(){return a=!0,!0}});n.addEventListener("test",null,o)}catch(e){}t.supportsPassiveEvents=a}var on=function(n,a,o){var s=Array.prototype.slice.call(arguments);return i&&t.supportsPassiveEvents&&(s[2]={capture:null!=o&&o,passive:!1,once:!1}),t.bindings.push({target:e,args:s}),(e.addEventListener||e.on).apply(e,s),this};return{on:on,addEventListener:on,addListener:on,bind:on}},tW.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},tW.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},tW.load=function(){var e,t,n,i,a,o,s,l,u,c,d,h,p,g,v,y,b,x,w,E,S,P,k,D=this,T=D.cy.window(),isSelected=function(e){return e.selected()},triggerEvents=function(e,t,n,i){null==e&&(e=D.cy);for(var a=0;a<t.length;a++){var o=t[a];e.emit({originalEvent:n,type:o,position:i})}},isMultSelKeyDown=function(e){return e.shiftKey||e.metaKey||e.ctrlKey},allowPanningPassthrough=function(e,t){var n=!0;if(D.cy.hasCompoundNodes()&&e&&e.pannable())for(var i=0;t&&i<t.length;i++){var e=t[i];if(e.isNode()&&e.isParent()&&!e.pannable()){n=!1;break}}else n=!0;return n},setGrabbed=function(e){e[0]._private.grabbed=!0},setFreed=function(e){e[0]._private.grabbed=!1},setInDragLayer=function(e){e[0]._private.rscratch.inDragLayer=!0},setOutDragLayer=function(e){e[0]._private.rscratch.inDragLayer=!1},setGrabTarget=function(e){e[0]._private.rscratch.isGrabTarget=!0},removeGrabTarget=function(e){e[0]._private.rscratch.isGrabTarget=!1},addToDragList=function(e,t){var n=t.addToList;!n.has(e)&&e.grabbable()&&!e.locked()&&(n.merge(e),setGrabbed(e))},addDescendantsToDrag=function(e,t){if(e.cy().hasCompoundNodes()&&(null!=t.inDragLayer||null!=t.addToList)){var n=e.descendants();t.inDragLayer&&(n.forEach(setInDragLayer),n.connectedEdges().forEac
1h(setInDragLayer)),t.addToList&&addToDragList(n,t)}},addNodesToDrag=function(e,t){t=t||{};var n=e.cy().hasCompoundNodes();t.inDragLayer&&(e.forEach(setInDragLayer),e.neighborhood().stdFilter(function(e){return!n||e.isEdge()}).forEach(setInDragLayer)),t.addToList&&e.forEach(function(e){addToDragList(e,t)}),addDescendantsToDrag(e,t),updateAncestorsInDragLayer(e,{inDragLayer:t.inDragLayer}),D.updateCachedGrabbedEles()},freeDraggedElements=function(e){e&&(D.getCachedZSortedEles().forEach(function(e){setFreed(e),setOutDragLayer(e),removeGrabTarget(e)}),D.updateCachedGrabbedEles())},updateAncestorsInDragLayer=function(e,t){if((null!=t.inDragLayer||null!=t.addToList)&&e.cy().hasCompoundNodes()){var n=e.ancestors().orphans();if(!n.same(e)){var i=n.descendants().spawnSelf().merge(n).unmerge(e).unmerge(e.descendants()),a=i.connectedEdges();t.inDragLayer&&(a.forEach(setInDragLayer),i.forEach(setInDragLayer)),t.addToList&&i.forEach(function(e){addToDragList(e,t)})}}},blurActiveDomElement=function(){null!=document.activeElement&&null!=document.activeElement.blur&&document.activeElement.blur()},B="undefined"!=typeof MutationObserver,A="undefined"!=typeof ResizeObserver;B?(D.removeObserver=new MutationObserver(function(e){for(var t=0;t<e.length;t++){var n=e[t].removedNodes;if(n){for(var i=0;i<n.length;i++)if(n[i]===D.container){D.destroy();break}}}}),D.container.parentNode&&D.removeObserver.observe(D.container.parentNode,{childList:!0})):D.registerBinding(D.container,"DOMNodeRemoved",function(e){D.destroy()});var I=C.default(function(){D.cy.resize()},100);B&&(D.styleObserver=new MutationObserver(I),D.styleObserver.observe(D.container,{attributes:!0})),D.registerBinding(T,"resize",I),A&&(D.resizeObserver=new ResizeObserver(I),D.resizeObserver.observe(D.container));var invalidateCoords=function(){D.invalidateContainerClientCoordsCache()};(function(e,t){for(;null!=e;)t(e),e=e.parentNode})(D.container,function(e){D.registerBinding(e,"transitionend",invalidateCoords),D.registerBinding(e,"animationend",invalidateCoords),D.registerBinding(e,"scroll",invalidateCoords)}),D.registerBinding(D.container,"contextmenu",function(e){e.preventDefault()});var eventInContainer=function(e){for(var t=D.findContainerClientCoords(),n=t[0],i=t[1],a=t[2],o=t[3],s=e.touches?e.touches:[e],l=!1,u=0;u<s.length;u++){var c=s[u];if(n<=c.clientX&&c.clientX<=n+a&&i<=c.clientY&&c.clientY<=i+o){l=!0;break}}if(!l)return!1;for(var d=D.container,h=e.target.parentNode,p=!1;h;){if(h===d){p=!0;break}h=h.parentNode}return!!p};D.registerBinding(D.container,"mousedown",function(e){if(eventInContainer(e)){e.preventDefault(),blurActiveDomElement(),D.hoverData.capture=!0,D.hoverData.which=e.which;var t=D.cy,n=[e.clientX,e.clientY],i=D.projectIntoViewport(n[0],n[1]),a=D.selection,o=D.findNearestElements(i[0],i[1],!0,!1),s=o[0],l=D.dragData.possibleDragElements;if(D.hoverData.mdownPos=i,D.hoverData.mdownGPos=n,3==e.which){D.hoverData.cxtStarted=!0;var u={originalEvent:e,type:"cxttapstart",position:{x:i[0],y:i[1]}};s?(s.activate(),s.emit(u),D.hoverData.down=s):t.emit(u),D.hoverData.downTime=new Date().getTime(),D.hoverData.cxtDragged=!1}else if(1==e.which){if(s&&s.activate(),null!=s&&D.nodeIsGrabbable(s)){var makeEvent=function(t){return{originalEvent:e,type:t,position:{x:i[0],y:i[1]}}};if(setGrabTarget(s),s.selected()){l=D.dragData.possibleDragElements=t.collection();var c=t.$(function(e){return e.isNode()&&e.selected()&&D.nodeIsGrabbable(e)});addNodesToDrag(c,{addToList:l}),s.emit(makeEvent("grabon")),c.forEach(function(e){e.emit(makeEvent("grab"))})}else addNodesToDrag(s,{addToList:l=D.dragData.possibleDragElements=t.collection()}),s.emit(makeEvent("grabon")).emit(makeEvent("grab"));D.redrawHint("eles",!0),D.redrawHint("drag",!0)}D.hoverData.down=s,D.hoverData.downs=o,D.hoverData.downTime=new Date().getTime(),triggerEvents(s,["mousedown","tapstart","vmousedown"],e,{x:i[0],y:i[1]}),null==s?(a[4]=1,D.data.bgActivePosistion={x:i[0],y:i[1]},D.redrawHint("select",!0),D.redraw()):s.pannable()&&(a[4]=1),D.hoverData.tapholdCancelled=!1,clearTimeout(D.hoverData.tapholdTimeout),D.hoverData.tapholdT
1imeout=setTimeout(function(){if(!D.hoverData.tapholdCancelled){var n=D.hoverData.down;n?n.emit({originalEvent:e,type:"taphold",position:{x:i[0],y:i[1]}}):t.emit({originalEvent:e,type:"taphold",position:{x:i[0],y:i[1]}})}},D.tapholdDuration)}a[0]=a[2]=i[0],a[1]=a[3]=i[1]}},!1),D.registerBinding(T,"mousemove",function(e){if(D.hoverData.capture||eventInContainer(e)){var t=!1,n=D.cy,i=n.zoom(),a=[e.clientX,e.clientY],o=D.projectIntoViewport(a[0],a[1]),s=D.hoverData.mdownPos,l=D.hoverData.mdownGPos,u=D.selection,c=null;D.hoverData.draggingEles||D.hoverData.dragging||D.hoverData.selecting||(c=D.findNearestElement(o[0],o[1],!0,!1));var d=D.hoverData.last,h=D.hoverData.down,p=[o[0]-u[2],o[1]-u[3]],g=D.dragData.possibleDragElements;if(l){var v=a[0]-l[0],y=a[1]-l[1];D.hoverData.isOverThresholdDrag=E=v*v+y*y>=D.desktopTapThreshold2}var b=isMultSelKeyDown(e);E&&(D.hoverData.tapholdCancelled=!0),t=!0,triggerEvents(c,["mousemove","vmousemove","tapdrag"],e,{x:o[0],y:o[1]});var goIntoBoxMode=function(){D.data.bgActivePosistion=void 0,D.hoverData.selecting||n.emit({originalEvent:e,type:"boxstart",position:{x:o[0],y:o[1]}}),u[4]=1,D.hoverData.selecting=!0,D.redrawHint("select",!0),D.redraw()};if(3===D.hoverData.which){if(E){var x={originalEvent:e,type:"cxtdrag",position:{x:o[0],y:o[1]}};h?h.emit(x):n.emit(x),D.hoverData.cxtDragged=!0,(!D.hoverData.cxtOver||c!==D.hoverData.cxtOver)&&(D.hoverData.cxtOver&&D.hoverData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:o[0],y:o[1]}}),D.hoverData.cxtOver=c,c&&c.emit({originalEvent:e,type:"cxtdragover",position:{x:o[0],y:o[1]}}))}}else if(D.hoverData.dragging){if(t=!0,n.panningEnabled()&&n.userPanningEnabled()){if(D.hoverData.justStartedPan){var w=D.hoverData.mdownPos;C={x:(o[0]-w[0])*i,y:(o[1]-w[1])*i},D.hoverData.justStartedPan=!1}else C={x:p[0]*i,y:p[1]*i};n.panBy(C),n.emit("dragpan"),D.hoverData.dragged=!0}o=D.projectIntoViewport(e.clientX,e.clientY)}else if(1==u[4]&&(null==h||h.pannable()))E&&(!D.hoverData.dragging&&n.boxSelectionEnabled()&&(b||!n.panningEnabled()||!n.userPanningEnabled())?goIntoBoxMode():!D.hoverData.selecting&&n.panningEnabled()&&n.userPanningEnabled()&&allowPanningPassthrough(h,D.hoverData.downs)&&(D.hoverData.dragging=!0,D.hoverData.justStartedPan=!0,u[4]=0,D.data.bgActivePosistion=array2point(s),D.redrawHint("select",!0),D.redraw()),h&&h.pannable()&&h.active()&&h.unactivate());else{if(h&&h.pannable()&&h.active()&&h.unactivate(),h&&h.grabbed()||c==d||(d&&triggerEvents(d,["mouseout","tapdragout"],e,{x:o[0],y:o[1]}),c&&triggerEvents(c,["mouseover","tapdragover"],e,{x:o[0],y:o[1]}),D.hoverData.last=c),h){if(E){if(n.boxSelectionEnabled()&&b)h&&h.grabbed()&&(freeDraggedElements(g),h.emit("freeon"),g.emit("free"),D.dragData.didDrag&&(h.emit("dragfreeon"),g.emit("dragfree"))),goIntoBoxMode();else if(h&&h.grabbed()&&D.nodeIsDraggable(h)){var E,C,S,P=!D.dragData.didDrag;P&&D.redrawHint("eles",!0),D.dragData.didDrag=!0,D.hoverData.draggingEles||addNodesToDrag(g,{inDragLayer:!0});var k={x:0,y:0};if(number$1(p[0])&&number$1(p[1])&&(k.x+=p[0],k.y+=p[1],P)){var T=D.hoverData.dragDelta;T&&number$1(T[0])&&number$1(T[1])&&(k.x+=T[0],k.y+=T[1])}D.hoverData.draggingEles=!0,g.silentShift(k).emit("position drag"),D.redrawHint("drag",!0),D.redraw()}}else 0===(S=D.hoverData.dragDelta=D.hoverData.dragDelta||[]).length?(S.push(p[0]),S.push(p[1])):(S[0]+=p[0],S[1]+=p[1])}t=!0}if(u[2]=o[0],u[3]=o[1],t)return e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault(),!1}},!1),D.registerBinding(T,"mouseup",function(i){if(D.hoverData.capture){D.hoverData.capture=!1;var a=D.cy,o=D.projectIntoViewport(i.clientX,i.clientY),s=D.selection,l=D.findNearestElement(o[0],o[1],!0,!1),u=D.dragData.possibleDragElements,c=D.hoverData.down,d=isMultSelKeyDown(i);if(D.data.bgActivePosistion&&(D.redrawHint("select",!0),D.redraw()),D.hoverData.tapholdCancelled=!0,D.data.bgActivePosistion=void 0,c&&c.unactivate(),3===D.hoverData.which){var h={originalEvent:i,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(h):a.emit(h),!D.hoverData.cxtDragged){var p={originalEvent:i,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):a.emit(p)}D.hoverData.cxtDragged=!1,D.hoverData.which=null}else if(1===D.hoverData.which){if(triggerEvents(l,["mouseup","tapend","vmouseup"],i,{x:o[0],y:o[1]}),D.dragData.didDrag||D.hoverData.dragged||D.hoverData.selecting||D.hoverData.isOverThresholdDrag||(triggerEvents(c,["click","tap","vclick"],i,{x:o[0],y:o[1]}),t=!1,i.timeStamp-n<=a.multiClickDebounceTime()?(e&&clearTimeout(e),t=!0,n=null,triggerEvents(c,["dblclick","dbltap","vdblclick"],i,{x:o[0],y:o[1]})):(e=setTimeout(function(){t||triggerEvents(c,["oneclick","oneta
1p","voneclick"],i,{x:o[0],y:o[1]})},a.multiClickDebounceTime()),n=i.timeStamp)),null!=c||D.dragData.didDrag||D.hoverData.selecting||D.hoverData.dragged||isMultSelKeyDown(i)||(a.$(isSelected).unselect(["tapunselect"]),u.length>0&&D.redrawHint("eles",!0),D.dragData.possibleDragElements=u=a.collection()),l!=c||D.dragData.didDrag||D.hoverData.selecting||null==l||!l._private.selectable||(D.hoverData.dragging||("additive"===a.selectionType()||d?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):d||(a.$(isSelected).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),D.redrawHint("eles",!0)),D.hoverData.selecting){var g=a.collection(D.getAllInBox(s[0],s[1],s[2],s[3]));D.redrawHint("select",!0),g.length>0&&D.redrawHint("eles",!0),a.emit({type:"boxend",originalEvent:i,position:{x:o[0],y:o[1]}}),"additive"!==a.selectionType()&&(d||a.$(isSelected).unmerge(g).unselect()),g.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),D.redraw()}if(D.hoverData.dragging&&(D.hoverData.dragging=!1,D.redrawHint("select",!0),D.redrawHint("eles",!0),D.redraw()),!s[4]){D.redrawHint("drag",!0),D.redrawHint("eles",!0);var v=c&&c.grabbed();
1freeDraggedElements(u),v&&(c.emit("freeon"),u.emit("free"),D.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,D.hoverData.down=null,D.hoverData.cxtStarted=!1,D.hoverData.draggingEles=!1,D.hoverData.selecting=!1,D.hoverData.isOverThresholdDrag=!1,D.dragData.didDrag=!1,D.hoverData.dragged=!1,D.hoverData.dragDelta=[],D.hoverData.mdownPos=null,D.hoverData.mdownGPos=null}},!1);var wheelHandler=function(e){if(!D.scrollingPage){var t=D.cy,n=t.zoom(),i=t.pan(),a=D.projectIntoViewport(e.clientX,e.clientY),o=[a[0]*n+i.x,a[1]*n+i.y];if(D.hoverData.draggingEles||D.hoverData.dragging||D.hoverData.cxtStarted||0!==D.selection[4]){e.preventDefault();return}if(t.panningEnabled()&&t.userPanningEnabled()&&t.zoomingEnabled()&&t.userZoomingEnabled()){e.preventDefault(),D.data.wheelZooming=!0,clearTimeout(D.data.wheelTimeout),D.data.wheelTimeout=setTimeout(function(){D.data.wheelZooming=!1,D.redrawHint("eles",!0),D.redraw()},150),s=(null!=e.deltaY?-(e.deltaY/250):null!=e.wheelDeltaY?e.wheelDeltaY/1e3:e.wheelDelta/1e3)*D.wheelSensitivity,1===e.deltaMode&&(s*=33);var s,l=t.zoom()*Math.pow(10,s);"gesturechange"===e.type&&(l=D.gestureStartZoom*e.scale),t.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),t.emit("gesturechange"===e.type?"pinchzoom":"scrollzoom")}}};D.registerBinding(D.container,"wheel",wheelHandler,!0),D.registerBinding(T,"scroll",function(e){D.scrollingPage=!0,clearTimeout(D.scrollingPageTimeout),D.scrollingPageTimeout=setTimeout(function(){D.scrollingPage=!1},250)},!0),D.registerBinding(D.container,"gesturestart",function(e){D.gestureStartZoom=D.cy.zoom(),D.hasTouchStarted||e.preventDefault()},!0),D.registerBinding(D.container,"gesturechange",function(e){D.hasTouchStarted||wheelHandler(e)},!0),D.registerBinding(D.container,"mouseout",function(e){var t=D.projectIntoViewport(e.clientX,e.clientY);D.cy.emit({originalEvent:e,type:"mouseout",position:{x:t[0],y:t[1]}})},!1),D.registerBinding(D.container,"mouseover",function(e){var t=D.projectIntoViewport(e.clientX,e.clientY);D.cy.emit({originalEvent:e,type:"mouseover",position:{x:t[0],y:t[1]}})},!1);var distance=function(e,t,n,i){return Math.sqrt((n-e)*(n-e)+(i-t)*(i-t))},distanceSq=function(e,t,n,i){return(n-e)*(n-e)+(i-t)*(i-t)};if(D.registerBinding(D.container,"touchstart",b=function(e){if(D.hasTouchStarted=!0,eventInContainer(e)){blurActiveDomElement(),D.touchData.capture=!0,D.data.bgActivePosistion=void 0;var t=D.cy,n=D.touchData.now,b=D.touchData.earlier;if(e.touches[0]){var x=D.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);n[0]=x[0],n[1]=x[1]}if(e.touches[1]){var x=D.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);n[2]=x[0],n[3]=x[1]}if(e.touches[2]){var x=D.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);n[4]=x[0],n[5]=x[1]}if(e.touches[1]){D.touchData.singleTouchMoved=!0,freeDraggedElements(D.dragData.touchDragEles);var w=D.findContainerClientCoords();h=w[0],p=w[1],g=w[2],v=w[3],i=e.touches[0].clientX-h,a=e.touches[0].clientY-p,o=e.touches[1].clientX-h,s=e.touches[1].clientY-p,y=0<=i&&i<=g&&0<=o&&o<=g&&0<=a&&a<=v&&0<=s&&s<=v;var E=t.pan(),C=t.zoom();if(l=distance(i,a,o,s),u=distanceSq(i,a,o,s),d=[((c=[(i+o)/2,(a+s)/2])[0]-E.x)/C,(c[1]-E.y)/C],u<4e4&&!e.touches[2]){var S=D.findNearestElement(n[0],n[1],!0,!0),P=D.findNearestElement(n[2],n[3],!0,!0);S&&S.isNode()?(S.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),D.touchData.start=S):P&&P.isNode()?(P.activate().emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),D.touchData.start=P):t.emit({originalEvent:e,type:"cxttapstart",position:{x:n[0],y:n[1]}}),D.touchData.start&&(D.touchData.start._private.grabbed=!1),D.touchData.cxt=!0,D.touchData.cxtDragged=!1,D.data.bgActivePosistion=void 0,D.redraw();return}}if(e.touches[2])t.boxSelectionEnabled()&&e.preventDefault();else if(e.touches[1]);else if(e.touches[0]){var k=D.findNearestElements(n[0],n[1],!0,!0),T=k[0];if(null!=T&&(T.activate(),D.touchData.start=T,D.touchData.starts=k,D.nodeIsGrabbable(T))){var B=D.dragData.touchDragEles=t.collection(),A=null;D.redrawHint("eles",!0),D.redrawHint("drag",!0),T.selected()?addNodesToDrag(A=t.$(function(e){return e.selected()&&D.nodeIsGrabbable(e)}),{addToList:B}):addNodesToDrag(T,{addToList:B}),setGrabTarget(T);var makeEvent=function(t){return{originalEvent:e,type:t,position:{x:n[0],y:n[1]}}};T.emit(makeEvent("grabon")),A?A.forEach(function(e){e.emit(makeEvent("grab"))}):T.emit(makeEvent("grab"))}triggerEvents(T,["touchstart","tapstart","vmousedown"],e,{x:n[0],y:n[1]}),null==T&&(D.data.bgActivePosistion={x:x[0],y:x[1]},D.redrawHint("select",!0),D.redraw()),D.touchData.singleTouchMoved=!1,D.touchData.singleTouchStartTime=+new Date,clearTimeout(D.touchData.tapholdT
1imeout),D.touchData.tapholdTimeout=setTimeout(function(){!1!==D.touchData.singleTouchMoved||D.pinching||D.touchData.selecting||triggerEvents(D.touchData.start,["taphold"],e,{x:n[0],y:n[1]})},D.tapholdDuration)}if(e.touches.length>=1){for(var I=D.touchData.startPosition=[null,null,null,null,null,null],M=0;M<n.length;M++)I[M]=b[M]=n[M];var _=e.touches[0];D.touchData.startGPosition=[_.clientX,_.clientY]}}},!1),D.registerBinding(window,"touchmove",x=function(e){var t=D.touchData.capture;if(t||eventInContainer(e)){var n=D.selection,c=D.cy,g=D.touchData.now,v=D.touchData.earlier,b=c.zoom();if(e.touches[0]){var x=D.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);g[0]=x[0],g[1]=x[1]}if(e.touches[1]){var x=D.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);g[2]=x[0],g[3]=x[1]}if(e.touches[2]){var x=D.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);g[4]=x[0],g[5]=x[1]}var w=D.touchData.startGPosition;if(t&&e.touches[0]&&w){for(var E=[],C=0;C<g.length;C++)E[C]=g[C]-v[C];var S=e.touches[0].clientX-w[0],P=S*S,k=e.touches[0].clientY-w[1];Q=P+k*k>=D.touchTapThreshold2}if(t&&D.touchData.cxt){e.preventDefault();var T=e.touches[0].clientX-h,B=e.touches[0].clientY-p,A=e.touches[1].clientX-h,I=e.touches[1].clientY-p,M=distanceSq(T,B,A,I);if(M/u>=2.25||M>=22500){D.touchData.cxt=!1,D.data.bgActivePosistion=void 0,D.redrawHint("select",!0);var _={originalEvent:e,type:"cxttapend",position:{x:g[0],y:g[1]}};D.touchData.start?(D.touchData.start.unactivate().emit(_),D.touchData.start=null):c.emit(_)}}if(t&&D.touchData.cxt){var _={originalEvent:e,type:"cxtdrag",position:{x:g[0],y:g[1]}};D.data.bgActivePosistion=void 0,D.redrawHint("select",!0),D.touchData.start?D.touchData.start.emit(_):c.emit(_),D.touchData.start&&(D.touchData.start._private.grabbed=!1),D.touchData.cxtDragged=!0;var L=D.findNearestElement(g[0],g[1],!0,!0);(!D.touchData.cxtOver||L!==D.touchData.cxtOver)&&(D.touchData.cxtOver&&D.touchData.cxtOver.emit({originalEvent:e,type:"cxtdragout",position:{x:g[0],y:g[1]}}),D.touchData.cxtOver=L,L&&L.emit({originalEvent:e,type:"cxtdragover",position:{x:g[0],y:g[1]}}))}else if(t&&e.touches[2]&&c.boxSelectionEnabled())e.preventDefault(),D.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,D.touchData.selecting||c.emit({originalEvent:e,type:"boxstart",position:{x:g[0],y:g[1]}}),D.touchData.selecting=!0,D.touchData.didSelect=!0,n[4]=1,n&&0!==n.length&&void 0!==n[0]?(n[2]=(g[0]+g[2]+g[4])/3,n[3]=(g[1]+g[3]+g[5])/3):(n[0]=(g[0]+g[2]+g[4])/3,n[1]=(g[1]+g[3]+g[5])/3,n[2]=(g[0]+g[2]+g[4])/3+1,n[3]=(g[1]+g[3]+g[5])/3+1),D.redrawHint("select",!0),D.redraw();else if(t&&e.touches[1]&&!D.touchData.didSelect&&c.zoomingEnabled()&&c.panningEnabled()&&c.userZoomingEnabled()&&c.userPanningEnabled()){e.preventDefault(),D.data.bgActivePosistion=void 0,D.redrawHint("select",!0);var O=D.dragData.touchDragEles;if(O){D.redrawHint("drag",!0);for(var N=0;N<O.length;N++){var z=O[N]._private;z.grabbed=!1,z.rscratch.inDragLayer=!1}}var R=D.touchData.start,T=e.touches[0].clientX-h,B=e.touches[0].clientY-p,A=e.touches[1].clientX-h,I=e.touches[1].clientY-p,F=distance(T,B,A,I),V=F/l;if(y){var q=T-i,j=B-a,$=A-o,X=I-s,Y=c.zoom(),H=Y*V,W=c.pan(),U=d[0]*Y+W.x,G=d[1]*Y+W.y,K={x:-H/Y*(U-W.x-(q+$)/2)+U,y:-H/Y*(G-W.y-(j+X)/2)+G};if(R&&R.active()){var O=D.dragData.touchDragEles;freeDraggedElements(O),D.redrawHint("drag",!0),D.redrawHint("eles",!0),R.unactivate().emit("freeon"),O.emit("free"),D.dragData.didDrag&&(R.emit("dragfreeon"),O.emit("dragfree"))}c.viewport({zoom:H,pan:K,cancelOnFailedZoom:!0}),c.emit("pinchzoom"),l=F,i=T,a=B,o=A,s=I,D.pinching=!0}if(e.touches[0]){var x=D.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);g[0]=x[0],g[1]=x[1]}if(e.touches[1]){var x=D.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);g[2]=x[0],g[3]=x[1]}if(e.touches[2]){var x=D.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);g[4]=x[0],g[5]=x[1]}}else if(e.touches[0]&&!D.touchData.didSelect){var Q,L,Z=D.touchData.start,J=D.touchData.last;if(D.hoverData.draggingEles||D.swipePanning||(L=D.findNearestElement(g[0],g[1],!0,!0)),t&&null!=Z&&e.preventDefault(),t&&null!=Z&&D.nodeIsDraggable(Z)){if(Q){var O=D.dragData.touchDragEles,ee=!D.dragData.didDrag;ee&&addNodesToDrag(O,{inDragLayer:!0}),D.dragData.didDrag=!0;var et={x:0,y:0};if(number$1(E[0])&&number$1(E[1])&&(et.x+=E[0],et.y+=E[1],ee)){D.redrawHint("eles",!0);var en=D.touchData.dragDelta;en&&number$1(en[0])&&number$1(en[1])&&(et.x+=en[0],et.y+=en[1])}
1D.hoverData.draggingEles=!0,O.silentShift(et).emit("position drag"),D.redrawHint("drag",!0),D.touchData.startPosition[0]==v[0]&&D.touchData.startPosition[1]==v[1]&&D.redrawHint("eles",!0),D.redraw()}else{var en=D.touchData.dragDelta=D.touchData.dragDelta||[];0===en.length?(en.push(E[0]),en.push(E[1])):(en[0]+=E[0],en[1]+=E[1])}}if(triggerEvents(Z||L,["touchmove","tapdrag","vmousemove"],e,{x:g[0],y:g[1]}),Z&&Z.grabbed()||L==J||(J&&J.emit({originalEvent:e,type:"tapdragout",position:{x:g[0],y:g[1]}}),L&&L.emit({originalEvent:e,type:"tapdragover",position:{x:g[0],y:g[1]}})),D.touchData.last=L,t)for(var N=0;N<g.length;N++)g[N]&&D.touchData.startPosition[N]&&Q&&(D.touchData.singleTouchMoved=!0);if(t&&(null==Z||Z.pannable())&&c.panningEnabled()&&c.userPanningEnabled()){allowPanningPassthrough(Z,D.touchData.starts)&&(e.preventDefault(),D.data.bgActivePosistion||(D.data.bgActivePosistion=array2point(D.touchData.startPosition)),D.swipePanning?(c.panBy({x:E[0]*b,y:E[1]*b}),c.emit("dragpan")):Q&&(D.swipePanning=!0,c.panBy({x:S*b,y:k*b}),c.emit("dragpan"),Z&&(Z.unactivate(),D.redrawHint("select",!0),D.touchData.start=null)));var x=D.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);g[0]=x[0],g[1]=x[1]}}for(var C=0;C<g.length;C++)v[C]=g[C];t&&e.touches.length>0&&!D.hoverData.draggingEles&&!D.swipePanning&&null!=D.data.bgActivePosistion&&(D.data.bgActivePosistion=void 0,D.redrawHint("select",!0),D.redraw())}},!1),D.registerBinding(T,"touchcancel",w=function(e){var t=D.touchData.start;D.touchData.capture=!1,t&&t.unactivate()}),D.registerBinding(T,"touchend",E=function(e){var t,n=D.touchData.start;if(D.touchData.capture){0===e.touches.length&&(D.touchData.capture=!1),e.preventDefault();var i=D.selection;D.swipePanning=!1,D.hoverData.draggingEles=!1;var a=D.cy,o=a.zoom(),s=D.touchData.now,l=D.touchData.earlier;if(e.touches[0]){var u=D.projectIntoViewport(e.touches[0].clientX,e.touches[0].clientY);s[0]=u[0],s[1]=u[1]}if(e.touches[1]){var u=D.projectIntoViewport(e.touches[1].clientX,e.touches[1].clientY);s[2]=u[0],s[3]=u[1]}if(e.touches[2]){var u=D.projectIntoViewport(e.touches[2].clientX,e.touches[2].clientY);s[4]=u[0],s[5]=u[1]}if(n&&n.unactivate(),D.touchData.cxt){if(t={originalEvent:e,type:"cxttapend",position:{x:s[0],y:s[1]}},n?n.emit(t):a.emit(t),!D.touchData.cxtDragged){var c={originalEvent:e,type:"cxttap",position:{x:s[0],y:s[1]}};n?n.emit(c):a.emit(c)}D.touchData.start&&(D.touchData.start._private.grabbed=!1),D.touchData.cxt=!1,D.touchData.start=null,D.redraw();return}if(!e.touches[2]&&a.boxSelectionEnabled()&&D.touchData.selecting){D.touchData.selecting=!1;var d=a.collection(D.getAllInBox(i[0],i[1],i[2],i[3]));i[0]=void 0,i[1]=void 0,i[2]=void 0,i[3]=void 0,i[4]=0,D.redrawHint("select",!0),a.emit({type:"boxend",originalEvent:e,position:{x:s[0],y:s[1]}}),d.emit("box").stdFilter(function(e){return e.selectable()&&!e.selected()}).select().emit("boxselect"),d.nonempty()&&D.redrawHint("eles",!0),D.redraw()}if(null!=n&&n.unactivate(),e.touches[2])D.data.bgActivePosistion=void 0,D.redrawHint("select",!0);else if(e.touches[1]);else if(e.touches[0]);else if(!e.touches[0]){D.data.bgActivePosistion=void 0,D.redrawHint("select",!0);var h=D.dragData.touchDragEles;if(null!=n){var p=n._private.grabbed;freeDraggedElements(h),D.redrawHint("drag",!0),D.redrawHint("eles",!0),p&&(n.emit("freeon"),h.emit("free"),D.dragData.didDrag&&(n.emit("dragfreeon"),h.emit("dragfree"))),triggerEvents(n,["touchend","tapend","vmouseup","tapdragout"],e,{x:s[0],y:s[1]}),n.unactivate(),D.touchData.start=null}else triggerEvents(D.findNearestElement(s[0],s[1],!0,!0),["touchend","tapend","vmouseup","tapdragout"],e,{x:s[0],y:s[1]});var g=D.touchData.startPosition[0]-s[0],v=D.touchData.startPosition[1]-s[1];D.touchData.singleTouchMoved||(n||a.$(":selected").unselect(["tapunselect"]),triggerEvents(n,["tap","vclick"],e,{x:s[0],y:s[1]}),S=!1,e.timeStamp-k<=a.multiClickDebounceTime()?(P&&clearTimeout(P),S=!0,k=null,triggerEvents(n,["dbltap","vdblclick"],e,{x:s[0],y:s[1]})):(P=setTimeout(function(){S||triggerEvents(n,["onetap","voneclick"],e,{x:s[0],y:s[1]})},a.multiClickDebounceTime()),k=e.timeStamp)),null!=n&&!D.dragData.didDrag&&n._private.selectable&&(g*g+v*v)*o*o<D.touchTapThreshold2&&!D.pinching&&("single"===a.selectionType()?(a.$(isSelected).unmerge(n).unselect(["tapunselect"]),n.select(["tapselect"])):n.selected()?n.unselect(["tapunselect"]):n.select(["tapselect"]),D.redrawHint("eles",!0)),D.touchData.singleTouchMoved=!0}
1for(var y=0;y<s.length;y++)l[y]=s[y];D.dragData.didDrag=!1,0===e.touches.length&&(D.touchData.dragDelta=[],D.touchData.startPosition=[null,null,null,null,null,null],D.touchData.startGPosition=null,D.touchData.didSelect=!1),e.touches.length<2&&(1===e.touches.length&&(D.touchData.startGPosition=[e.touches[0].clientX,e.touches[0].clientY]),D.pinching=!1,D.redrawHint("eles",!0),D.redraw())}},!1),"undefined"==typeof TouchEvent){var M=[],makeTouch=function(e){return{clientX:e.clientX,clientY:e.clientY,force:1,identifier:e.pointerId,pageX:e.pageX,pageY:e.pageY,radiusX:e.width/2,radiusY:e.height/2,screenX:e.screenX,screenY:e.screenY,target:e.target}},addPointer=function(e){M.push({event:e,touch:makeTouch(e)})},removePointer=function(e){for(var t=0;t<M.length;t++)if(M[t].event.pointerId===e.pointerId){M.splice(t,1);return}},updatePointer=function(e){var t=M.filter(function(t){return t.event.pointerId===e.pointerId})[0];t.event=e,t.touch=makeTouch(e)},addTouchesToEvent=function(e){e.touches=M.map(function(e){return e.touch})},pointerIsMouse=function(e){return"mouse"===e.pointerType||4===e.pointerType};D.registerBinding(D.container,"pointerdown",function(e){pointerIsMouse(e)||(e.preventDefault(),addPointer(e),addTouchesToEvent(e),b(e))}),D.registerBinding(D.container,"pointerup",function(e){pointerIsMouse(e)||(removePointer(e),addTouchesToEvent(e),E(e))}),D.registerBinding(D.container,"pointercancel",function(e){pointerIsMouse(e)||(removePointer(e),addTouchesToEvent(e),w(e))}),D.registerBinding(D.container,"pointermove",function(e){pointerIsMouse(e)||(e.preventDefault(),updatePointer(e),addTouchesToEvent(e),x(e))})}};var tU={};tU.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl("polygon",e,t,n,i,a,this.points)},intersectLine:function(e,t,n,i,a,o,s){return polygonIntersectLine(a,o,this.points,e,t,n/2,i/2,s)},checkPoint:function(e,t,n,i,a,o,s){return pointInsidePolygon(e,t,this.points,o,s,i,a,[0,-1],n)}}},tU.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,i,a)},intersectLine:function(e,t,n,i,a,o,s){return intersectLineEllipse(a,o,e,t,n/2+s,i/2+s)},checkPoint:function(e,t,n,i,a,o,s){return checkInEllipse(e,t,i,a,o,s,n)}}},tU.generateRoundPolygon=function(e,t){for(var n=Array(2*t.length),i=0;i<t.length/2;i++){var a=2*i,o=void 0;o=i<t.length/2-1?(i+1)*2:0,n[4*i]=t[a],n[4*i+1]=t[a+1];var s=t[o]-t[a],l=t[o+1]-t[a+1],u=Math.sqrt(s*s+l*l);n[4*i+2]=s/u,n[4*i+3]=l/u}return this.nodeShapes[e]={renderer:this,name:e,points:n,draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl("round-polygon",e,t,n,i,a,this.points)},intersectLine:function(e,t,n,i,a,o,s){return roundPolygonIntersectLine(a,o,this.points,e,t,n,i)},checkPoint:function(e,t,n,i,a,o,s){return pointInsideRoundPolygon(e,t,this.points,o,s,i,a)}}},tU.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,i,a)},intersectLine:function(e,t,n,i,a,o,s){return roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=getRoundRectangleRadius(i,a),u=2*l;return!!(pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n)||pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n)||checkInEllipse(e,t,u,u,o-i/2+l,s-a/2+l,n)||checkInEllipse(e,t,u,u,o+i/2-l,s-a/2+l,n)||checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},tU.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:getCutRectangleCornerLength(),points:generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,i,a)},generateCutTrianglePts:function(e,t,n,i){var a=this.cornerLength,o=t/2,s=e/2,l=n-s,u=n+s,c=i-o,d=i+o;return{topLeft:[l,c+a,l+a,c,l+a,c+a],topRight:[u-a,c,u,c+a,u-a,c+a],bottomRight:[u,d-a,u-a,d,u-a,d-a],bottomLeft:[l+a,d,l,d-a,l+a,d-a]}},intersectLine:function(e,t,n,i,a,o,s){var l=this.generateCutTrianglePts(n+2*s,i+2*s,e,t);return polygonIntersectLine(a,o,[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]),e,t)}
1,checkPoint:function(e,t,n,i,a,o,s){if(pointInsidePolygon(e,t,this.points,o,s,i,a-2*this.cornerLength,[0,-1],n)||pointInsidePolygon(e,t,this.points,o,s,i-2*this.cornerLength,a,[0,-1],n))return!0;var l=this.generateCutTrianglePts(i,a,o,s);return pointInsidePolygonPoints(e,t,l.topLeft)||pointInsidePolygonPoints(e,t,l.topRight)||pointInsidePolygonPoints(e,t,l.bottomRight)||pointInsidePolygonPoints(e,t,l.bottomLeft)}}},tU.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,i,a)},intersectLine:function(e,t,n,i,a,o,s){var l=this.generateBarrelBezierPts(n+2*s,i+2*s,e,t),approximateBarrelCurvePts=function(e){var t=qbezierPtAt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.15),n=qbezierPtAt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.5),i=qbezierPtAt({x:e[0],y:e[1]},{x:e[2],y:e[3]},{x:e[4],y:e[5]},.85);return[e[0],e[1],t.x,t.y,n.x,n.y,i.x,i.y,e[4],e[5]]};return polygonIntersectLine(a,o,[].concat(approximateBarrelCurvePts(l.topLeft),approximateBarrelCurvePts(l.topRight),approximateBarrelCurvePts(l.bottomRight),approximateBarrelCurvePts(l.bottomLeft)),e,t)},generateBarrelBezierPts:function(e,t,n,i){var a=t/2,o=e/2,s=n-o,l=n+o,u=i-a,c=i+a,d=getBarrelCurveConstants(e,t),h=d.heightOffset,p=d.widthOffset,g=d.ctrlPtOffsetPct*e,v={topLeft:[s,u+h,s+g,u,s+p,u],topRight:[l-p,u,l-g,u,l,u+h],bottomRight:[l,c-h,l-g,c,l-p,c],bottomLeft:[s+p,c,s+g,c,s,c-h]};return v.topLeft.isTop=!0,v.topRight.isTop=!0,v.bottomLeft.isBottom=!0,v.bottomRight.isBottom=!0,v},checkPoint:function(e,t,n,i,a,o,s){var l=getBarrelCurveConstants(i,a),u=l.heightOffset,c=l.widthOffset;if(pointInsidePolygon(e,t,this.points,o,s,i,a-2*u,[0,-1],n)||pointInsidePolygon(e,t,this.points,o,s,i-2*c,a,[0,-1],n))return!0;for(var d=this.generateBarrelBezierPts(i,a,o,s),h=Object.keys(d),p=0;p<h.length;p++){var g=d[h[p]],v=function(e,t,n){var i=n[4],a=n[2],o=n[0],s=n[5],l=n[1],u=Math.min(i,o),c=Math.max(i,o);if(u<=e&&e<=c&&Math.min(s,l)<=t&&t<=Math.max(s,l)){var d=[i-2*a+o,2*(a-i),i],h=solveQuadratic(d[0],d[1],d[2],e).filter(function(e){return 0<=e&&e<=1});if(h.length>0)return h[0]}return null}(e,t,g);if(null!=v){var y=qbezierAt(g[5],g[3],g[1],v);if(g.isTop&&y<=t||g.isBottom&&t<=y)return!0}}return!1}}},tU.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:generateUnitNgonPointsFitToSquare(4,0),draw:function(e,t,n,i,a){this.renderer.nodeShapeImpl(this.name,e,t,n,i,a)},intersectLine:function(e,t,n,i,a,o,s){var l=e-(n/2+s),u=t-(i/2+s),c=e+(n/2+s),d=finiteLinesIntersect(a,o,e,t,l,u,c,u,!1);return d.length>0?d:roundRectangleIntersectLine(a,o,e,t,n,i,s)},checkPoint:function(e,t,n,i,a,o,s){var l=getRoundRectangleRadius(i,a),u=2*l;if(pointInsidePolygon(e,t,this.points,o,s,i,a-u,[0,-1],n)||pointInsidePolygon(e,t,this.points,o,s,i-u,a,[0,-1],n))return!0;var c=i/2+2*n,d=a/2+2*n;return!!(pointInsidePolygonPoints(e,t,[o-c,s-d,o-c,s,o+c,s,o+c,s-d])||checkInEllipse(e,t,u,u,o+i/2-l,s+a/2-l,n)||checkInEllipse(e,t,u,u,o-i/2+l,s+a/2-l,n))}}},tU.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",generateUnitNgonPointsFitToSquare(3,0)),this.generateRoundPolygon("round-triangle",generateUnitNgonPointsFitToSquare(3,0)),this.generatePolygon("rectangle",generateUnitNgonPointsFitToSquare(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n),this.generatePolygon("pentagon",generateUnitNgonPointsFitToSquare(5,0)),this.generateRoundPolygon("round-pentagon",generateUnitNgonPointsFitToSquare(5,0)),this.generatePolygon("hexagon",generateUnitNgonPointsFitToSquare(6,0)),this.generateRoundPolygon("round-hexagon",generateUnitNgonPointsFitToSquare(6,0)),this.generatePolygon("heptagon",generateUnitNgonPointsFitToSquare(7,0)),this.generateRoundPolygon("round-heptagon",generateUnitNgonPointsFitToSquare(7,0)),this.generatePolygon("octagon",generateUnitNgonPointsFitToSquare(8,0)),this.generateRoundPolygon("round-octagon",generateUnitNgonPointsFitToSquare(8,0));var i=Array(20),a=generateUnitNgonPoints(5,0),o=generateUnitNgonPoints(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var l=0;l<o.length/2;l++)o[2*l]*=s,o[2*l+1]*=s;for(var l=0;l<5;
1l++)i[4*l]=a[2*l],i[4*l+1]=a[2*l+1],i[4*l+2]=o[2*l],i[4*l+3]=o[2*l+1];i=fitPolygonToSquare(i),this.generatePolygon("star",i),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 u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u),e.makePolygon=function(e){var n,i="polygon-"+e.join("$");return(n=this[i])?n:t.generatePolygon(i,e)}};var tG={};tG.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},tG.redraw=function(e){e=e||staticEmptyObject(),void 0===this.averageRedrawTime&&(this.averageRedrawTime=0),void 0===this.lastRedrawTime&&(this.lastRedrawTime=0),void 0===this.lastDrawTime&&(this.lastDrawTime=0),this.requestedFrame=!0,this.renderOptions=e},tG.beforeRender=function(e,t){if(!this.destroyed){null==t&&error("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(e,t){return t.priority-e.priority})}};var beforeRenderCallbacks=function(e,t,n){for(var i=e.beforeRenderCallbacks,a=0;a<i.length;a++)i[a].fn(t,n)};tG.startRenderLoop=function(){var e=this,t=e.cy;e.renderLoopStarted||(e.renderLoopStarted=!0,requestAnimationFrame(function renderFn(n){if(!e.destroyed){if(t.batching());else if(e.requestedFrame&&!e.skipFrame){beforeRenderCallbacks(e,!0,n);var i=Y();e.render(e.renderOptions);var a=e.lastDrawTime=Y();void 0===e.averageRedrawTime&&(e.averageRedrawTime=a-i),void 0===e.redrawCount&&(e.redrawCount=0),e.redrawCount++,void 0===e.redrawTotalTime&&(e.redrawTotalTime=0);var o=a-i;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else beforeRenderCallbacks(e,!1,n);e.skipFrame=!1,requestAnimationFrame(renderFn)}}))};var BR=function(e){this.init(e)},tK=BR.prototype;tK.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],tK.init=function(e){this.options=e,this.cy=e.cy;var t=this.container=e.cy.container(),n=this.cy.window();if(n){var i=n.document,a=i.head,o="__________cytoscape_stylesheet",s="__________cytoscape_container",l=null!=i.getElementById(o);if(0>t.className.indexOf(s)&&(t.className=(t.className||"")+" "+s),!l){var u=i.createElement("style");u.id=o,u.textContent="."+s+" { position: relative; }",a.insertBefore(u,a.children[0])}"static"===n.getComputedStyle(t).getPropertyValue("position")&&warn("A Cytoscape container has style position:static and so can not use UI extensions properly")}this.selection=[void 0,void 0,void 0,void 0,0],this.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],this.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},this.dragData={possibleDragElements:[]},this.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},this.redraws=0,this.showFps=e.showFps,this.debug=e.debug,this.hideEdgesOnViewport=e.hideEdgesOnViewport,this.textureOnViewport=e.textureOnViewport,this.wheelSensitivity=e.wheelSensitivity,this.motionBlurEnabled=e.motionBlur,this.forcedPixelRatio=number$1(e.pixelRatio)?e.pixelRatio:null,this.motionBlur=e.motionBlur,this.motionBlurOpacity=e.motionBlurOpacity,this.motionBlurTransparency=1-this.motionBlurOpacity,this.motionBlurPxRatio=1,this.mbPxRBlurry=1,this.minMbLowQualFrames=4,this.fullQualityMb=!1,this.clearedForMotionBlur=[],this.desktopTapThreshold=e.desktopTapThreshold,this.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,this.touchTapThreshold=e.touchTapThreshold,this.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,this.tapholdDuration=500,this.bindings=[],this.beforeRenderCallbacks=[],this.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},this.registerNodeShapes(),this.registerArrowShapes(),this.registerCalculationListeners()},tK.notify=function(e,t){var n=this.cy;
1if(!this.destroyed){if("init"===e){this.load();return}if("destroy"===e){this.destroy();return}("add"===e||"remove"===e||"move"===e&&n.hasCompoundNodes()||"load"===e||"zorder"===e||"mount"===e)&&this.invalidateCachedZSortedEles(),"viewport"===e&&this.redrawHint("select",!0),("load"===e||"resize"===e||"mount"===e)&&(this.invalidateContainerClientCoordsCache(),this.matchCanvasSize(this.container)),this.redrawHint("eles",!0),this.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},tK.destroy=function(){this.destroyed=!0,this.cy.stopAnimationLoop();for(var e=0;e<this.bindings.length;e++){var t=this.bindings[e],n=t.target;(n.off||n.removeEventListener).apply(n,t.args)}if(this.bindings=[],this.beforeRenderCallbacks=[],this.onUpdateEleCalcsFns=[],this.removeObserver&&this.removeObserver.disconnect(),this.styleObserver&&this.styleObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect(),this.labelCalcDiv)try{document.body.removeChild(this.labelCalcDiv)}catch(e){}},tK.isHeadless=function(){return!1},[tL,tY,tH,tW,tU,tG].forEach(function(e){j(tK,e)});var tQ=1e3/60,tZ={setupDequeueing:function(e){return function(){var t=this,n=this.renderer;if(!t.dequeueingSetup){t.dequeueingSetup=!0;var i=C.default(function(){n.redrawHint("eles",!0),n.redrawHint("drag",!0),n.redraw()},e.deqRedrawThreshold),a=e.priority||noop$1;n.beforeRender(function(a,o){var s=Y(),l=n.averageRedrawTime,u=n.lastRedrawTime,c=[],d=n.cy.extent(),h=n.getPixelRatio();for(a||n.flushRenderedStyleQueue();;){var p=Y(),g=p-s,v=p-o;if(u<tQ){var y=tQ-(a?l:0);if(v>=e.deqFastCost*y)break}else if(a){if(g>=e.deqCost*u||g>=e.deqAvgCost*l)break}else if(v>=e.deqNoDrawCost*tQ)break;var b=e.deq(t,h,d);if(b.length>0)for(var x=0;x<b.length;x++)c.push(b[x]);else break}c.length>0&&(e.onDeqd(t,c),!a&&e.shouldRedraw(t,c,h,d)&&i())},a(t))}}}},tJ=function(){function ElementTextureCacheLookup(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:falsify;_classCallCheck(this,ElementTextureCacheLookup),this.idsByKey=new J,this.keyForId=new J,this.cachesByLvl=new J,this.lvls=[],this.getKey=e,this.doesEleInvalidateKey=t}return _createClass(ElementTextureCacheLookup,[{key:"getIdsFor",value:function(e){null==e&&error("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new et,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),i=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(i,t),this.keyForId.set(t,i)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,i=t.get(e);return i||(i=new J,t.set(e,i),n.push(e)),i}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),i=this.getCache(n,t);return null!=i&&this.updateKeyMappingFor(e),i}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var i=this.getKey(e);this.setCache(i,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach(function(n){return t.deleteCache(e,n)})}},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var i=this.doesEleInvalidateKey(e);return i&&this.invalidateKey(n),i||0===this.getNumberOfIdsForKey(n)}}]),ElementTextureCacheLookup}(),t0={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},t1=defaults$g({getKey:null,doesEleInvalidateKey:falsify,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:trueify,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),ElementTextureCache=function(e,t){this.renderer=e,this.onDequeues=[];var n=t1(t);j(this,n),this.lookup=new tJ(n.getKey,n.doesEleInvalidateKey),this.setupDequeueing()},t2=ElementTextureCache.prototype;t2.reasons=t0,t2.getTextureQueue=function(e){return this.eleImgCaches=this.eleImgCaches||{},this.eleImgCaches[e]=this.eleImgCaches[e]||[]},t2.getRetiredTextureQueue=function(e){var t=this.eleImgCaches.retired=this.eleImgCaches.retired||{};return t[e]=t[e]||[]},t2.getElementQueue=function(){return this.eleCacheQueue=this.eleCacheQueue||new S.default(function(e,t){return t.reqs-e.reqs})},t2.getElementKeyToQueue=function(){return this.eleKeyToCacheQueue=this.eleKeyToCacheQueue||{}},t2.getElement=function(e,t,n,i,a){var o,s,l,u=this,c=this.renderer,d=c.cy.zoom(),h=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!u.allowEdgeTxrCaching&&e.isEdge()||!u.allowParentTxrCaching&&e.isParent())return null;if(null==i&&(i=Math.ceil(el(d*n))),i<-4)i=-4;else if(d>=7.99||i>3)return null;var p=Math.pow(2,i),g=t.h*p,v=t.w*p,y=c.eleTextBiggerThanMin(e,p);if(!this.isVisible(e,y))return null;var b=h.get(e,i);
1if(b&&b.invalidated&&(b.invalidated=!1,b.texture.invalidatedWidth-=b.width),b)return b;if(o=g<=25?25:g<=50?50:50*Math.ceil(g/50),g>1024||v>1024)return null;var x=u.getTextureQueue(o),w=x[x.length-2],addNewTxr=function(){return u.recycleTexture(o,v)||u.addTexture(o,v)};w||(w=x[x.length-1]),w||(w=addNewTxr()),w.width-w.usedWidth<v&&(w=addNewTxr());for(var scalableFrom=function(e){return e&&e.scaledLabelShown===y},E=a&&a===t0.dequeue,C=a&&a===t0.highQuality,S=a&&a===t0.downscale,P=i+1;P<=3;P++){var k=h.get(e,P);if(k){s=k;break}}var D=s&&s.level===i+1?s:null,downscale=function(){w.context.drawImage(D.texture.canvas,D.x,0,D.width,D.height,w.usedWidth,0,v,g)};if(w.context.setTransform(1,0,0,1,0,0),w.context.clearRect(w.usedWidth,0,v,o),scalableFrom(D))downscale();else if(scalableFrom(s)){if(!C)return u.queueElement(e,s.level-1),s;for(var T=s.level;T>i;T--)D=u.getElement(e,t,n,T,t0.downscale);downscale()}else{if(!E&&!C&&!S)for(var B=i-1;B>=-4;B--){var A=h.get(e,B);if(A){l=A;break}}if(scalableFrom(l))return u.queueElement(e,i),l;w.context.translate(w.usedWidth,0),w.context.scale(p,p),this.drawElement(w.context,e,t,y,!1),w.context.scale(1/p,1/p),w.context.translate(-w.usedWidth,0)}return b={x:w.usedWidth,texture:w,level:i,scale:p,width:v,height:g,scaledLabelShown:y},w.usedWidth+=Math.ceil(v+8),w.eleCaches.push(b),h.set(e,i,b),u.checkTextureFullness(w),b},t2.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},t2.invalidateElement=function(e){var t=this.lookup,n=[];if(t.isInvalid(e)){for(var i=-4;i<=3;i++){var a=t.getForCachedKey(e,i);a&&n.push(a)}if(t.invalidate(e))for(var o=0;o<n.length;o++){var s=n[o],l=s.texture;l.invalidatedWidth+=s.width,s.invalidated=!0,this.checkTextureUtility(l)}this.removeFromQueue(e)}},t2.checkTextureUtility=function(e){e.invalidatedWidth>=.2*e.width&&this.retireTexture(e)},t2.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>.8&&e.fullnessChecks>=10?removeFromArray(t,e):e.fullnessChecks++},t2.retireTexture=function(e){var t=e.height,n=this.getTextureQueue(t),i=this.lookup;removeFromArray(n,e),e.retired=!0;for(var a=e.eleCaches,o=0;o<a.length;o++){var s=a[o];i.deleteCache(s.key,s.level)}clearArray(a),this.getRetiredTextureQueue(t).push(e)},t2.addTexture=function(e,t){var n=this.getTextureQueue(e),i={};return n.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(1024,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=this.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i},t2.recycleTexture=function(e,t){for(var n=this.getTextureQueue(e),i=this.getRetiredTextureQueue(e),a=0;a<i.length;a++){var o=i[a];if(o.width>=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,clearArray(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),removeFromArray(i,o),n.push(o),o}},t2.queueElement=function(e,t){var n=this.getElementQueue(),i=this.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,n.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};n.push(s),i[a]=s}},t2.dequeue=function(e){for(var t=this.getElementQueue(),n=this.getElementKeyToQueue(),i=[],a=this.lookup,o=0;o<1;o++)if(t.size()>0){var s=t.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(n[l]=null,c)continue;i.push(s);var d=this.getBoundingBox(u);this.getElement(u,d,e,s.level,t0.dequeue)}else break;return i},t2.removeFromQueue=function(e){var t=this.getElementQueue(),n=this.getElementKeyToQueue(),i=this.getKey(e),a=n[i];null!=a&&(1===a.eles.length?(a.reqs=K,t.updateItem(a),t.pop(),n[i]=null):a.eles.unmerge(e))},t2.onDequeue=function(e){this.onDequeues.push(e)},t2.offDequeue=function(e){removeFromArray(this.onDequeues,e)},t2.setupDequeueing=tZ.setupDequeueing({deqRedrawThreshold:100,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n<e.onDequeues.length;n++)(0,e.onDequeues[n])(t)},shouldRedraw:function(e,t,n,i){for(var a=0;a<t.length;a++)for(var o=t[a].eles,s=0;s<o.length;s++)if(boundingBoxesIntersect(o[s].boundingBox(),i))return!0;return!1},priority:function(e){return e.renderer.beforeRenderPriorities.eleTxrDeq}});var LayeredTextureCache=function(e){var t=this,n=t.renderer=e,i=n.cy;t.layersByLevel={},t.firstGet=!0,t.lastInvalidationTime=Y()-500,t.skipping=!1,t.eleTxrDeqs=i.
1collection(),t.scheduleElementRefinement=C.default(function(){t.refineElementTextures(t.eleTxrDeqs),t.eleTxrDeqs.unmerge(t.eleTxrDeqs)},50),n.beforeRender(function(e,n){n-t.lastInvalidationTime<=250?t.skipping=!0:t.skipping=!1},n.beforeRenderPriorities.lyrTxrSkip),t.layersQueue=new S.default(function(e,t){return t.reqs-e.reqs}),t.setupDequeueing()},t5=LayeredTextureCache.prototype,t3=0;t5.makeLayer=function(e,t){var n=Math.pow(2,t),i=Math.ceil(e.w*n),a=Math.ceil(e.h*n),o=this.renderer.makeOffscreenCanvas(i,a),s={id:t3=++t3%9007199254740991,bb:e,level:t,width:i,height:a,canvas:o,context:o.getContext("2d"),eles:[],elesQueue:[],reqs:0},l=s.context,u=-s.bb.x1,c=-s.bb.y1;return l.scale(n,n),l.translate(u,c),s},t5.getLayers=function(e,t,n){var i,a,o=this,s=o.renderer.cy.zoom(),l=o.firstGet;if(o.firstGet=!1,null==n){if((n=Math.ceil(el(s*t)))<-4)n=-4;else if(s>=3.99||n>2)return null}o.validateLayersElesOrdering(n,e);var u=o.layersByLevel,c=Math.pow(2,n),d=u[n]=u[n]||[];if(o.levelIsComplete(n,e))return d;!function(){var canUseAsTmpLvl=function(t){if(o.validateLayersElesOrdering(t,e),o.levelIsComplete(t,e))return a=u[t],!0},checkLvls=function(e){if(!a)for(var t=n+e;-4<=t&&t<=2&&!canUseAsTmpLvl(t);t+=e);};checkLvls(1),checkLvls(-1);for(var t=d.length-1;t>=0;t--){var i=d[t];i.invalid&&removeFromArray(d,i)}}();var getBb=function(){if(!i){i=makeBoundingBox();for(var t=0;t<e.length;t++)updateBoundingBox(i,e[t].boundingBox())}return i};if(o.skipping&&!l)return null;for(var h=null,p=e.length/1,g=!l,v=0;v<e.length;v++){var y=e[v],b=y._private.rscratch,x=b.imgLayerCaches=b.imgLayerCaches||{},w=x[n];if(w){h=w;continue}if((!h||h.eles.length>=p||!boundingBoxInBoundingBox(h.bb,y.boundingBox()))&&!(h=function(e){var t=(e=e||{}).after;if(getBb(),i.w*c*(i.h*c)>16e6)return null;var a=o.makeLayer(i,n);if(null!=t){var s=d.indexOf(t)+1;d.splice(s,0,a)}else(void 0===e.insert||e.insert)&&d.unshift(a);return a}({insert:!0,after:h})))return null;a||g?o.queueLayer(h,y):o.drawEleInLayer(h,y,n,t),h.eles.push(y),x[n]=h}return a||(g?null:d)},t5.getEleLevelForLayerLevel=function(e,t){return e},t5.drawEleInLayer=function(e,t,n,i){var a=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=this.getEleLevelForLayerLevel(n,i),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,!0),a.setImgSmoothing(o,!0))},t5.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var i=0,a=0;a<n.length;a++){var o=n[a];if(o.reqs>0||o.invalid)return!1;i+=o.eles.length}return i===t.length},t5.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var i=0;i<n.length;i++){for(var a=n[i],o=-1,s=0;s<t.length;s++)if(a.eles[0]===t[s]){o=s;break}if(o<0){this.invalidateLayer(a);continue}for(var l=o,s=0;s<a.eles.length;s++)if(a.eles[s]!==t[l+s]){this.invalidateLayer(a);break}}},t5.updateElementsInLayers=function(e,t){for(var n=element(e[0]),i=0;i<e.length;i++)for(var a=n?null:e[i],o=n?e[i]:e[i].ele,s=o._private.rscratch,l=s.imgLayerCaches=s.imgLayerCaches||{},u=-4;u<=2;u++){var c=l[u];c&&(!a||this.getEleLevelForLayerLevel(c.level)===a.level)&&t(c,o,a)}},t5.haveLayers=function(){for(var e=!1,t=-4;t<=2;t++){var n=this.layersByLevel[t];if(n&&n.length>0){e=!0;break}}return e},t5.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=Y(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,function(e,n,i){t.invalidateLayer(e)}))},t5.invalidateLayer=function(e){if(this.lastInvalidationTime=Y(),!e.invalid){var t=e.level,n=e.eles;removeFromArray(this.layersByLevel[t],e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},t5.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(e,n,i){var a=e.replacement;if(a||((a=e.replacement=t.makeLayer(e.bb,e.level)).replaces=e,a.eles=e.eles),!a.reqs)for(var o=0;o<a.eles.length;o++)t.queueLayer(a,a.eles[o])})},t5.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},t5.queueLayer=function(e,t){var n=this.layersQueue,i=e.elesQueue,a=i.hasId=i.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;i.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,n.updateItem(e)):(e.reqs=1,n.push(e))}},t5.dequeue=function(e){for(var t=this.layersQueue,n=[],i=0;i<1&&0!==t.size();){var a=t.peek();if(a.replacement||a.replaces&&a!==a.replaces.replacement||a.invalid){t.pop();continue}var o=a.elesQueue.shift();o&&(this.drawEleInLayer(a,o,a.level,e),i++),0===n.length&&n.push(!0),0===a.elesQueue.length&&(t.pop(),a.reqs=0,a.replaces&&this.applyLayerReplacement(a),this.requestRedraw())}return n},t5.applyLayerReplacement=function(e){var t=this.layersByLevel[e.level],n=e.replaces,i=t.indexOf(n);if(!(i<0)&&!n.invalid){t[i]=e;for(var a=0;a<e.eles.length;a++){var o=e.eles[a]._private,s=o.imgLayerCaches=o.imgLayerCaches||{};s&&(s[e.level]=e)}this.requestRedraw()}},t5.requestRedraw=C.default(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),t5.setupDequeueing=tZ.setupDequeueing({deqRedrawThreshold:50,deqCost:.15,deqAvgCost:.1,deqNoDrawCost:.9,deqFastCost:.9,deq:function(e,t){return e.dequeue(t)}
1,onDeqd:noop$1,shouldRedraw:trueify,priority:function(e){return e.renderer.beforeRenderPriorities.lyrTxrDeq}});var t4={};function polygon(e,t){for(var n=0;n<t.length;n++){var i=t[n];e.lineTo(i.x,i.y)}}function triangleBackcurve(e,t,n){for(var i,a=0;a<t.length;a++){var o=t[a];0===a&&(i=o),e.lineTo(o.x,o.y)}e.quadraticCurveTo(n.x,n.y,i.x,i.y)}function triangleTee(e,t,n){e.beginPath&&e.beginPath();for(var i=0;i<t.length;i++){var a=t[i];e.lineTo(a.x,a.y)}var o=n[0];e.moveTo(o.x,o.y);for(var i=1;i<n.length;i++){var a=n[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function circleTriangle(e,t,n,i,a){e.beginPath&&e.beginPath(),e.arc(n,i,a,0,2*Math.PI,!1);var o=t[0];e.moveTo(o.x,o.y);for(var s=0;s<t.length;s++){var l=t[s];e.lineTo(l.x,l.y)}e.closePath&&e.closePath()}function circle(e,t,n,i){e.arc(t,n,i,0,2*Math.PI,!1)}t4.arrowShapeImpl=function(e){return(v||(v={polygon:polygon,"triangle-backcurve":triangleBackcurve,"triangle-tee":triangleTee,"circle-triangle":circleTriangle,"triangle-cross":triangleTee,circle:circle}))[e]};var t9={};t9.drawElement=function(e,t,n,i,a,o){t.isNode()?this.drawNode(e,t,n,i,a,o):this.drawEdge(e,t,n,i,a,o)},t9.drawElementOverlay=function(e,t){t.isNode()?this.drawNodeOverlay(e,t):this.drawEdgeOverlay(e,t)},t9.drawElementUnderlay=function(e,t){t.isNode()?this.drawNodeUnderlay(e,t):this.drawEdgeUnderlay(e,t)},t9.drawCachedElementPortion=function(e,t,n,i,a,o,s,l){var u=n.getBoundingBox(t);if(0!==u.w&&0!==u.h){var c=n.getElement(t,u,i,a,o);if(null!=c){var d,h,p,g,v,y,b=l(this,t);if(0===b)return;var x=s(this,t),w=u.x1,E=u.y1,C=u.w,S=u.h;if(0!==x){var P=n.getRotationPoint(t);p=P.x,g=P.y,e.translate(p,g),e.rotate(x),(v=this.getImgSmoothing(e))||this.setImgSmoothing(e,!0);var k=n.getRotationOffset(t);d=k.x,h=k.y}else d=w,h=E;1!==b&&(y=e.globalAlpha,e.globalAlpha=y*b),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,d,h,C,S),1!==b&&(e.globalAlpha=y),0===x||(e.rotate(-x),e.translate(-p,-g),v||this.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var getZeroRotation=function(){return 0},getLabelRotation=function(e,t){return e.getTextAngle(t,null)},getSourceLabelRotation=function(e,t){return e.getTextAngle(t,"source")},getTargetLabelRotation=function(e,t){return e.getTextAngle(t,"target")},getOpacity=function(e,t){return t.effectiveOpacity()},getTextOpacity=function(e,t){return t.pstyle("text-opacity").pfValue*t.effectiveOpacity()};t9.drawCachedElement=function(e,t,n,i,a,o){var s=this.data,l=s.eleTxrCache,u=s.lblTxrCache,c=s.slbTxrCache,d=s.tlbTxrCache,h=t.boundingBox(),p=!0===o?l.reasons.highQuality:null;if(0!==h.w&&0!==h.h&&t.visible()&&(!i||boundingBoxesIntersect(h,i))){var g=t.isEdge(),v=t.element()._private.rscratch.badLine;this.drawElementUnderlay(e,t),this.drawCachedElementPortion(e,t,l,n,a,p,getZeroRotation,getOpacity),g&&v||this.drawCachedElementPortion(e,t,u,n,a,p,getLabelRotation,getTextOpacity),g&&!v&&(this.drawCachedElementPortion(e,t,c,n,a,p,getSourceLabelRotation,getTextOpacity),this.drawCachedElementPortion(e,t,d,n,a,p,getTargetLabelRotation,getTextOpacity)),this.drawElementOverlay(e,t)}},t9.drawElements=function(e,t){for(var n=0;n<t.length;n++){var i=t[n];this.drawElement(e,i)}},t9.drawCachedElements=function(e,t,n,i){for(var a=0;a<t.length;a++){var o=t[a];this.drawCachedElement(e,o,n,i)}},t9.drawCachedNodes=function(e,t,n,i){for(var a=0;a<t.length;a++){var o=t[a];o.isNode()&&this.drawCachedElement(e,o,n,i)}},t9.drawLayeredElements=function(e,t,n,i){var a=this.data.lyrTxrCache.getLayers(t,n);if(a)for(var o=0;o<a.length;o++){var s=a[o],l=s.bb;0!==l.w&&0!==l.h&&e.drawImage(s.canvas,l.x1,l.y1,l.w,l.h)}else this.drawCachedElements(e,t,n,i)};var t6={};t6.drawEdge=function(e,t,n){var i,a=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=!(arguments.length>4)||void 0===arguments[4]||arguments[4],s=!(arguments.length>5)||void 0===arguments[5]||arguments[5],l=this,u=t._private.rscratch;if(!(s&&!t.visible()||u.badLine||null==u.allpts||isNaN(u.allpts[0]))){n&&(i=n,e.translate(-i.x1,-i.y1));var c=s?t.pstyle("opacity").value:1,d=s?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,p=t.pstyle("line-style").value,g=t.pstyle("width").pfValue,v=t.pstyle("line-cap").value,y=c*d,b=c*d,drawLine=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(l.eleStrokeStyle(e,t,n),l.drawEdgeTrianglePath(t,e,u.allpts)):(e.lineWidth=g,e.lineCap=v,l.eleStrokeStyle(e,t,n),l.drawEdgePath(t,e,u.allpts,p),e.lineCap="butt")},drawArrows=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b;l.drawArrowheads(e,t,n)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var x=t.pstyle("ghost-offset-x").pfValue,w=t.pstyle("ghost-offset-y").pfValue,E=y*t.pstyle("ghost-opacity").value;e.translate(x,w),drawLine(E),drawArrows(E),e.translate(-x,-w)}o&&l.drawEdgeUnderlay(e,t),drawLine(),drawArrows(),o&&l.drawEdgeOverlay(e,t),l.drawElementText(e,t,null,a),n&&e.translate(i.x1,i.y1)}};var drawEdgeOverlayUnderlay=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n){if(n.visible()){var i=n.pstyle("".concat(e,"-opacity")).value;if(0!==i){var a=this.usePaths(),o=n._private.rscratch,s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=2*s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",this.colorStrokeStyle(t,l[0],l[1],l[2],i),this.drawEdgePath(n,t,o.allpts,"s
1olid")}}}};t6.drawEdgeOverlay=drawEdgeOverlayUnderlay("overlay"),t6.drawEdgeUnderlay=drawEdgeOverlayUnderlay("underlay"),t6.drawEdgePath=function(e,t,n,i){var a,o=e._private.rscratch,s=t,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,d=e.pstyle("line-dash-offset").pfValue;if(u){var h=n.join("$");o.pathCacheKey&&o.pathCacheKey===h?(a=t=o.pathCache,l=!0):(a=t=new Path2D,o.pathCacheKey=h,o.pathCache=a)}if(s.setLineDash)switch(i){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=d;break;case"solid":s.setLineDash([])}if(!l&&!o.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),o.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+3<n.length;p+=4)t.quadraticCurveTo(n[p],n[p+1],n[p+2],n[p+3]);break;case"straight":case"segments":case"haystack":for(var g=2;g+1<n.length;g+=2)t.lineTo(n[g],n[g+1])}t=s,u?t.stroke(a):t.stroke(),t.setLineDash&&t.setLineDash([])},t6.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var i=e.pstyle("width").pfValue,a=0;a+1<n.length;a+=2){var o=[n[a+2]-n[a],n[a+3]-n[a+1]],s=Math.sqrt(o[0]*o[0]+o[1]*o[1]),l=[o[1]/s,-o[0]/s],u=[l[0]*i/2,l[1]*i/2];t.beginPath(),t.moveTo(n[a]-u[0],n[a+1]-u[1]),t.lineTo(n[a]+u[0],n[a+1]+u[1]),t.lineTo(n[a+2],n[a+3]),t.closePath(),t.fill()}},t6.drawArrowheads=function(e,t,n){var i=t._private.rscratch,a="haystack"===i.edgeType;a||this.drawArrowhead(e,t,"source",i.arrowStartX,i.arrowStartY,i.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",i.midX,i.midY,i.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",i.midX,i.midY,i.midsrcArrowAngle,n),a||this.drawArrowhead(e,t,"target",i.arrowEndX,i.arrowEndY,i.tgtArrowAngle,n)},t6.drawArrowhead=function(e,t,n,i,a,o,s){if(!(isNaN(i)||null==i||isNaN(a)||null==a||isNaN(o))&&null!=o){var l=t.pstyle(n+"-arrow-shape").value;if("none"!==l){var u="hollow"===t.pstyle(n+"-arrow-fill").value?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,d=t.pstyle("width").pfValue,h=t.pstyle(n+"-arrow-width"),p="match-line"===h.value?d:h.pfValue;"%"===h.units&&(p*=d);var g=t.pstyle("opacity").value;void 0===s&&(s=g);var v=e.globalCompositeOperation;(1!==s||"hollow"===c)&&(e.globalCompositeOperation="destination-out",this.colorFillStyle(e,255,255,255,1),this.colorStrokeStyle(e,255,255,255,1),this.drawArrowShape(t,e,u,d,l,p,i,a,o),e.globalCompositeOperation=v);var y=t.pstyle(n+"-arrow-color").value;this.colorFillStyle(e,y[0],y[1],y[2],s),this.colorStrokeStyle(e,y[0],y[1],y[2],s),this.drawArrowShape(t,e,c,d,l,p,i,a,o)}}},t6.drawArrowShape=function(e,t,n,i,a,o,s,l,u){var c,d=this.usePaths()&&"triangle-cross"!==a,h=!1,p=t,g=e.pstyle("arrow-scale").value,v=this.getArrowWidth(i,g),y=this.arrowShapes[a];if(d){var b=this.arrowPathCache=this.arrowPathCache||[],x=hashString(a),w=b[x];null!=w?(c=t=w,h=!0):(c=t=new Path2D,b[x]=c)}!h&&(t.beginPath&&t.beginPath(),d?y.draw(t,1,0,{x:0,y:0},1):y.draw(t,v,u,{x:s,y:l},i),t.closePath&&t.closePath()),t=p,d&&(t.translate(s,l),t.rotate(u),t.scale(v,v)),("filled"===n||"both"===n)&&(d?t.fill(c):t.fill()),("hollow"===n||"both"===n)&&(t.lineWidth=o/(d?v:1),t.lineJoin="miter",d?t.stroke(c):t.stroke()),d&&(t.scale(1/v,1/v),t.rotate(-u),t.translate(-s,-l))};var t8={};t8.safeDrawImage=function(e,t,n,i,a,o,s,l,u,c){if(!(a<=0)&&!(o<=0)&&!(u<=0)&&!(c<=0))try{e.drawImage(t,n,i,a,o,s,l,u,c)}catch(e){warn(e)}},t8.drawInscribedImage=function(e,t,n,i,a){var o=n.position(),s=o.x,l=o.y,u=n.cy().style(),c=u.getIndexedStyle.bind(u),d=c(n,"background-fit","value",i),h=c(n,"background-repeat","value",i),p=n.width(),g=n.height(),v=2*n.padding(),y=p+("inner"===c(n,"background-width-relative-to","value",i)?0:v),b=g+("inner"===c(n,"background-height-relative-to","value",i)?0:v),x=n._private.rscratch,w="node"===c(n,"background-clip","value",i),E=c(n,"background-image-opacity","value",i)*a,C=c(n,"background-image-smoothing","value",i),S=t.width||t.cachedW,P=t.height||t.cachedH;
1(null==S||null==P)&&(document.body.appendChild(t),S=t.cachedW=t.width||t.offsetWidth,P=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var k=S,D=P;if("auto"!==c(n,"background-width","value",i)&&(k="%"===c(n,"background-width","units",i)?c(n,"background-width","pfValue",i)*y:c(n,"background-width","pfValue",i)),"auto"!==c(n,"background-height","value",i)&&(D="%"===c(n,"background-height","units",i)?c(n,"background-height","pfValue",i)*b:c(n,"background-height","pfValue",i)),0!==k&&0!==D){if("contain"===d){var T=Math.min(y/k,b/D);k*=T,D*=T}else if("cover"===d){var T=Math.max(y/k,b/D);k*=T,D*=T}var B=s-y/2,A=c(n,"background-position-x","units",i),I=c(n,"background-position-x","pfValue",i);"%"===A?B+=(y-k)*I:B+=I;var M=c(n,"background-offset-x","units",i),_=c(n,"background-offset-x","pfValue",i);"%"===M?B+=(y-k)*_:B+=_;var L=l-b/2,O=c(n,"background-position-y","units",i),N=c(n,"background-position-y","pfValue",i);"%"===O?L+=(b-D)*N:L+=N;var z=c(n,"background-offset-y","units",i),R=c(n,"background-offset-y","pfValue",i);"%"===z?L+=(b-D)*R:L+=R,x.pathCache&&(B-=s,L-=l,s=0,l=0);var F=e.globalAlpha;e.globalAlpha=E;var V=this.getImgSmoothing(e),q=!1;if("no"===C&&V?(this.setImgSmoothing(e,!1),q=!0):"yes"!==C||V||(this.setImgSmoothing(e,!0),q=!0),"no-repeat"===h)w&&(e.save(),x.pathCache?e.clip(x.pathCache):(this.nodeShapes[this.getNodeShape(n)].draw(e,s,l,y,b),e.clip())),this.safeDrawImage(e,t,0,0,S,P,B,L,k,D),w&&e.restore();else{var j=e.createPattern(t,h);e.fillStyle=j,this.nodeShapes[this.getNodeShape(n)].draw(e,s,l,y,b),e.translate(B,L),e.fill(),e.translate(-B,-L)}e.globalAlpha=F,q&&this.setImgSmoothing(e,V)}};var t7={};function roundRect(e,t,n,i,a){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+o,n),e.lineTo(t+i-o,n),e.quadraticCurveTo(t+i,n,t+i,n+o),e.lineTo(t+i,n+a-o),e.quadraticCurveTo(t+i,n+a,t+i-o,n+a),e.lineTo(t+o,n+a),e.quadraticCurveTo(t,n+a,t,n+a-o),e.lineTo(t,n+o),e.quadraticCurveTo(t,n,t+o,n),e.closePath(),s?e.stroke():e.fill()}t7.eleTextBiggerThanMin=function(e,t){return t||(t=Math.pow(2,Math.ceil(el(e.cy().zoom()*this.getPixelRatio())))),!(e.pstyle("font-size").pfValue*t<e.pstyle("min-zoomed-font-size").pfValue)},t7.drawElementText=function(e,t,n,i,a){var o,s=!(arguments.length>5)||void 0===arguments[5]||arguments[5];if(null==i){if(s&&!this.eleTextBiggerThanMin(t))return}else if(!1===i)return;if(t.isNode()){var l=t.pstyle("label");if(!l||!l.value)return;var u=this.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var c=t.element()._private.rscratch.badLine,d=t.pstyle("label"),h=t.pstyle("source-label"),p=t.pstyle("target-label");if(c||(!d||!d.value)&&(!h||!h.value)&&(!p||!p.value))return;e.textAlign="center",e.textBaseline="bottom"}var g=!n;n&&(o=n,e.translate(-o.x1,-o.y1)),null==a?(this.drawText(e,t,null,g,s),t.isEdge()&&(this.drawText(e,t,"source",g,s),this.drawText(e,t,"target",g,s))):this.drawText(e,t,a,g,s),n&&e.translate(o.x1,o.y1)},t7.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if((t=this.fontCaches[n]).context===e)return t;return t={context:e},this.fontCaches.push(t),t},t7.setupTextStyle=function(e,t){var n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=t.pstyle("font-style").strValue,a=t.pstyle("font-size").pfValue+"px",o=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,l=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*l,c=t.pstyle("color").value,d=t.pstyle("text-outline-color").value;e.font=i+" "+s+" "+a+" "+o,e.lineJoin="round",this.colorFillStyle(e,c[0],c[1],c[2],l),this.colorStrokeStyle(e,d[0],d[1],d[2],u)},t7.getTextAngle=function(e,t){var n=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation"),o=getPrefixedProperty(n,"labelAngle",t);return"autorotate"===a.strValue?e.isEdge()?o:0:"none"===a.strValue?0:a.pfValue},t7.drawText=function(e,t,n){var i=!(arguments.length>3)||void 0===arguments[3]||arguments[3],a=!(arguments.length>4)||void 0===arguments[4]||arguments[4],o=t._private.rscratch,s=a?t.effectiveOpacity():1;if(!a||0!==s&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var l=getPrefixedProperty(o,"labelX",n),u=getPrefixedProperty(o,"labelY",n),c=this.getLabelText(t,n);if(null!=c&&""!==c&&!isNaN(l)&&!isNaN(u)){this.setupTextStyle(e,t,a);var d,h,p,g=n?n+"-":"",v=getPrefixedProperty(o,"labelWidth",n),y=getPrefixedProperty(o,"labelHeight",n),b=t.pstyle(g+"text-margin-x").pfValue,x=t.pstyle(g+"text-margin-y").pfValue,w=t.isEdge(),E=t.pstyle("text-halign").value,C=t.pstyle("text-valign").value;switch(w&&(E="center",C="center"),l+=b,u+=x,0!==(p=i?this.getTextAngle(t,n):0)&&(d=l,h=u,e.translate(d,h),e.rotate(p),l=0,u=0),C){case"top":break;case"center":u+=y/2;break;case"bottom":u+=y}var S=t.pstyle("text-background-opacity").value,P=t.pstyle("text-border-opacity").value,k=t.pstyle("text-border-width").pfValue,D=t.pstyle("text-background-padding").pfValue,T=0===t.pstyle("text-background-shape").strValue.indexOf("round");if(S>0||k>0&&P>0){var B=l-D;switch(E){case"left":B-=v;break;case"center":B-=v/2}var A=u-y-D,I=v+2*D,M=y+2*D;if(S>0){var _=e.fillStyle,L=t.pstyle("text-background-color").value;e.fillStyle="rgba("+L[0]+","+L[1]+","+L[2]+","+S*s+")",T?roundRect(e,B,A,I,M,2):e.fillRect(B,A,I,M),e.fillStyle=_}if(k>0&&P>0){var O=e.strokeStyle,N=e.lineWidth,z=t.pstyle("text-border-color").value,R=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+P*s+")",e.lineWidth=k,e.setLineDash)switch(R){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=k/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(T?roundRect(e,B,A,I,M,2,"stroke"):e.strokeRect(B,A,I,M),"double"===R){var F=k/2;T?roundRect(e,B+F,A+F,I-2*F,M-2*F,2,"stroke"):e.strokeRect(B+F,A+F,I-2*F,M-2*F)}e.setLineDash&&e.setLineDash([]),e.lineWidth=N,e.strokeStyle=O}}var V=2*t.pstyle("text-outline-width").pfValue;if(V>0&&(e.lineWidth=V),"wrap"===t.pstyle("text-wrap").value){var q=getPrefixedProperty(o,"labelWrapCachedLines",n),j=getPrefixedProperty(o,"labelLineHeight",n),$=v/2,X=this.getLabelJustification(t);switch("auto"===X||("left"===E?"left"===X?l+=-v:"center"===X&&(l+=-$):"center"===E?"left"===X?l+=-$:"right"===X&&(l+=$):"right"===E&&("center"===X?l+=$:"right"===X&&(l+=v))),C){case"top":case"center":case"bottom":u-=(q.length-1)*j}for(var Y=0;Y<q.length;Y++)V>0&&e.strokeText(q[Y],l,u),e.fillText(q[Y],l,u),u+=j}else V>0&&e.strokeText(c,l,u),e.fillText(c,l,u);0!==p&&(e.rotate(-p),e.translate(-d,-h))}}};var ne={};ne.drawNode=function(e,t,n){var i,a,o,s,l=!(arguments.length>3)||void 0===arguments[3]||arguments[3],u=!(arguments.length>4)||void 0===arguments[4]||arguments[4],c=!(arguments.length>5)||void 0===arguments[5]||arguments[5],d=this,h=t._private,p=h.rscratch,g=t.position();if(number$1(g.x)&&number$1(g.y)&&(!c||t.visible())){var v=c?t.effectiveOpacity():1,y=d.usePaths(),b=!1,x=t.padding();i=t.width()+2*x,a=t.height()+2*x,n&&(s=n,e.translate(-s.x1,-s.y1));for(var w=t.pstyle("background-image").value,E=Array(w.length),C=Array(w.length),S=0,P=0;P<w.length;P++){var k=w[P];if(E[P]=null!=k&&"none"!==k){var D=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",P);S++,C[P]=d.getCachedImage(k,D,function(){h.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var T=t.pstyle("background-blacken").value,B=t.pstyle("border-width").pfValue,A=t.pstyle("background-opacity").value*v,I=t.pstyle("border-color").value,M=t.pstyle("border-style").value,_=t.pstyle("border-opacity").value*v,L=t.pstyle("outline-width").pfValue,O=t.pstyle("outline-color").value,N=t.pstyle("outline-style").value,z=t.pstyle("outline-opacity").value*v,R=t.pstyle("outline-offset").value;e.lineJoin="miter";var setupShapeColor=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:A;d.eleFillStyle(e,t,n)},setupBorderColor=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_;d.colorStrokeStyle(e,I[0],I[1],I[2],t)},setupOutlineColor=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;d.colorStrokeStyle(e,O[0],O[1],O[2],t)},getPath=function(e,t,n,i){var a,o=d.nodePathCache=d.nodePathCache||[],s=hashStrings("polygon"===n?n+","+i.join(","):n,""+t,""+e),l=o[s],u=!1;return null!=l?(a=l,u=!0,p.pathCache=a):(a=new Path2D,o[s]=p.pathCache=a),{path:a,cacheHit:u}},F=t.pstyle("shape").strValue,V=t.pstyle("shape-polygon-points").pfValue;if(y){e.translate(g.x,g.y);var q=getPath(i,a,F,V);o=q.path,b=q.cacheHit}var drawShape=function(){if(!b){var n=g;y&&(n={x:0,y:0}),d.nodeShapes[d.getNodeShape(t)].draw(o||e,n.x,n.y,i,a)}y?e.fill(o):e.fill()},drawImages=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,i=!(arguments.length>1)||void 0===arguments[1]||arguments[1],a=h.backgrounding,o=0,s=0;s<C.length;s++){var l=t.cy().style().getIndexedStyle(t,"background-image-containment","value",s);if(i&&"over"===l||!i&&"inside"===l){o++;continue}E[s]&&C[s].complete&&!C[s].error&&(o++,d.drawInscribedImage(e,C[s],t,s,n))}h.backgrounding=o!==S,a!==h.backgrounding&&t.updateStyle(!1)},drawPie=function(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v;d.hasPie(t)&&(d.drawPie(e,t,o),n&&!y&&d.nodeShapes[d.getNodeShape(t)].draw(e,g.x,g.y,i,a))},darken=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,n=(T>0?T:-T)*t,i=T>0?0:255;0!==T&&(d.colorFillStyle(e,i,i,i,n),y?e.fill(o):e.fill())},drawBorder=function(){if(B>0){if(e.lineWidth=B,e.lineCap="butt",e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}if(y?e.stroke(o):e.stroke(),"double"===M){e.lineWidth=B/3;var t=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(o):e.stroke(),e.globalCompositeOperation=t}e.setLineDash&&e.setLineDash([])}},drawOutline=function(){if(L>0){if(e.lineWidth=L,e.lineCap="butt",e.setLineDash)switch(N){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n,o=g;y&&(o={x:0,y:0});var s=d.getNodeShape(t),l=(i+B+(L+R))/i,u=(a+B+(L+R))/a,c=i*l,h=a*u,p=d.nodeShapes[s].points;if(y&&(n=getPath(c,h,s,p).path),"ellipse"===s)d.drawEllipsePath(n||e,o.x,o.y,c,h);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-p
1olygon","round-triangle","round-tag"].includes(s)){var v=0,b=0,x=0;"round-diamond"===s?v=(B+R+L)*1.4:"round-heptagon"===s?(v=(B+R+L)*1.075,x=-(B/2+R+L)/35):"round-hexagon"===s?v=(B+R+L)*1.12:"round-pentagon"===s?(v=(B+R+L)*1.13,x=-(B/2+R+L)/15):"round-tag"===s?(v=(B+R+L)*1.12,b=(B/2+L+R)*.07):"round-triangle"===s&&(v=(B+R+L)*(Math.PI/2),x=-(B+R/2+L)/Math.PI),0!==v&&(l=(i+v)/i,u=(a+v)/a),d.drawRoundPolygonPath(n||e,o.x+b,o.y+x,i*l,a*u,p)}else["roundrectangle","round-rectangle"].includes(s)?d.drawRoundRectanglePath(n||e,o.x,o.y,c,h):["cutrectangle","cut-rectangle"].includes(s)?d.drawCutRectanglePath(n||e,o.x,o.y,c,h):["bottomroundrectangle","bottom-round-rectangle"].includes(s)?d.drawBottomRoundRectanglePath(n||e,o.x,o.y,c,h):"barrel"===s?d.drawBarrelPath(n||e,o.x,o.y,c,h):(p=s.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(s)?joinLines(expandPolygon(p,(B+L+R)/i)):joinLines(expandPolygon(p,-((B+L+R)/i))),d.drawPolygonPath(n||e,o.x,o.y,i,a,p));if(y?e.stroke(n):e.stroke(),"double"===N){e.lineWidth=B/3;var w=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",y?e.stroke(n):e.stroke(),e.globalCompositeOperation=w}e.setLineDash&&e.setLineDash([])}};if("yes"===t.pstyle("ghost").value){var j=t.pstyle("ghost-offset-x").pfValue,$=t.pstyle("ghost-offset-y").pfValue,X=t.pstyle("ghost-opacity").value,Y=X*v;e.translate(j,$),setupOutlineColor(),drawOutline(),setupShapeColor(X*A),drawShape(),drawImages(Y,!0),setupBorderColor(X*_),drawBorder(),drawPie(0!==T||0!==B),drawImages(Y,!1),darken(Y),e.translate(-j,-$)}y&&e.translate(-g.x,-g.y),u&&d.drawNodeUnderlay(e,t,g,i,a),y&&e.translate(g.x,g.y),setupOutlineColor(),drawOutline(),setupShapeColor(),drawShape(),drawImages(v,!0),setupBorderColor(),drawBorder(),drawPie(0!==T||0!==B),drawImages(v,!1),darken(),y&&e.translate(-g.x,-g.y),d.drawElementText(e,t,null,l),u&&d.drawNodeOverlay(e,t,g,i,a),n&&e.translate(s.x1,s.y1)}};var drawNodeOverlayUnderlay=function(e){if(!["overlay","underlay"].includes(e))throw Error("Invalid state");return function(t,n,i,a,o){if(n.visible()){var s=n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-opacity")).value,u=n.pstyle("".concat(e,"-color")).value,c=n.pstyle("".concat(e,"-shape")).value;if(l>0){if(i=i||n.position(),null==a||null==o){var d=n.padding();a=n.width()+2*d,o=n.height()+2*d}this.colorFillStyle(t,u[0],u[1],u[2],l),this.nodeShapes[c].draw(t,i.x,i.y,a+2*s,o+2*s),t.fill()}}}};ne.drawNodeOverlay=drawNodeOverlayUnderlay("overlay"),ne.drawNodeUnderlay=drawNodeOverlayUnderlay("underlay"),ne.hasPie=function(e){return(e=e[0])._private.hasPie},ne.drawPie=function(e,t,n,i){t=t[0],i=i||t.position();var a=t.cy().style(),o=t.pstyle("pie-size"),s=i.x,l=i.y,u=Math.min(t.width(),t.height())/2,c=0;this.usePaths()&&(s=0,l=0),"%"===o.units?u*=o.pfValue:void 0!==o.pfValue&&(u=o.pfValue/2);for(var d=1;d<=a.pieBackgroundN;d++){var h=t.pstyle("pie-"+d+"-background-size").value,p=t.pstyle("pie-"+d+"-background-color").value,g=t.pstyle("pie-"+d+"-background-opacity").value*n,v=h/100;v+c>1&&(v=1-c);var y=1.5*Math.PI+2*Math.PI*c,b=y+2*Math.PI*v;0===h||c>=1||c+v>1||(e.beginPath(),e.moveTo(s,l),e.arc(s,l,u,y,b),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],g),e.fill(),c+=v)}};var nt={};nt.getPixelRatio=function(){var e=this.data.contexts[0];if(null!=this.forcedPixelRatio)return this.forcedPixelRatio;var t=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(window.devicePixelRatio||1)/t},nt.paintCache=function(e){for(var t,n=this.paintCaches=this.paintCaches||[],i=!0,a=0;a<n.length;a++)if((t=n[a]).context===e){i=!1;break}return i&&(t={context:e},n.push(t)),t},nt.createGradientStyleFor=function(e,t,n,i,a){var o,s=this.usePaths(),l=n.pstyle(t+"-gradient-stop-colors").value,u=n.pstyle(t+"-gradient-stop-positions").pfValue;if("radial-gradient"===i){if(n.isEdge()){var c=n.sourceEndpoint(),d=n.targetEndpoint(),h=n.midpoint(),p=dist(c,h),g=dist(d,h);o=e.createRadialGradient(h.x,h.y,0,h.x,h.y,Math.max(p,g))}else{var v=s?{x:0,y:0}:n.position(),y=n.paddedWidth(),b=n.paddedHeight();o=e.createRadialGradient(v.x,v.y,0,v.x,v.y,Math.max(y,b))}}
1else if(n.isEdge()){var x=n.sourceEndpoint(),w=n.targetEndpoint();o=e.createLinearGradient(x.x,x.y,w.x,w.y)}else{var E=s?{x:0,y:0}:n.position(),C=n.paddedWidth(),S=n.paddedHeight(),P=C/2,k=S/2;switch(n.pstyle("background-gradient-direction").value){case"to-bottom":o=e.createLinearGradient(E.x,E.y-k,E.x,E.y+k);break;case"to-top":o=e.createLinearGradient(E.x,E.y+k,E.x,E.y-k);break;case"to-left":o=e.createLinearGradient(E.x+P,E.y,E.x-P,E.y);break;case"to-right":o=e.createLinearGradient(E.x-P,E.y,E.x+P,E.y);break;case"to-bottom-right":case"to-right-bottom":o=e.createLinearGradient(E.x-P,E.y-k,E.x+P,E.y+k);break;case"to-top-right":case"to-right-top":o=e.createLinearGradient(E.x-P,E.y+k,E.x+P,E.y-k);break;case"to-bottom-left":case"to-left-bottom":o=e.createLinearGradient(E.x+P,E.y-k,E.x-P,E.y+k);break;case"to-top-left":case"to-left-top":o=e.createLinearGradient(E.x+P,E.y+k,E.x-P,E.y-k)}}if(!o)return null;for(var D=u.length===l.length,T=l.length,B=0;B<T;B++)o.addColorStop(D?u[B]:B/(T-1),"rgba("+l[B][0]+","+l[B][1]+","+l[B][2]+","+a+")");return o},nt.gradientFillStyle=function(e,t,n,i){var a=this.createGradientStyleFor(e,"background",t,n,i);if(!a)return null;e.fillStyle=a},nt.colorFillStyle=function(e,t,n,i,a){e.fillStyle="rgba("+t+","+n+","+i+","+a+")"},nt.eleFillStyle=function(e,t,n){var i=t.pstyle("background-fill").value;if("linear-gradient"===i||"radial-gradient"===i)this.gradientFillStyle(e,t,i,n);else{var a=t.pstyle("background-color").value;this.colorFillStyle(e,a[0],a[1],a[2],n)}},nt.gradientStrokeStyle=function(e,t,n,i){var a=this.createGradientStyleFor(e,"line",t,n,i);if(!a)return null;e.strokeStyle=a},nt.colorStrokeStyle=function(e,t,n,i,a){e.strokeStyle="rgba("+t+","+n+","+i+","+a+")"},nt.eleStrokeStyle=function(e,t,n){var i=t.pstyle("line-fill").value;if("linear-gradient"===i||"radial-gradient"===i)this.gradientStrokeStyle(e,t,i,n);else{var a=t.pstyle("line-color").value;this.colorStrokeStyle(e,a[0],a[1],a[2],n)}},nt.matchCanvasSize=function(e){var t,n=this.data,i=this.findContainerClientCoords(),a=i[2],o=i[3],s=this.getPixelRatio(),l=this.motionBlurPxRatio;(e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_NODE]||e===this.data.bufferCanvases[this.MOTIONBLUR_BUFFER_DRAG])&&(s=l);var u=a*s,c=o*s;if(u!==this.canvasWidth||c!==this.canvasHeight){this.fontCaches=null;var d=n.canvasContainer;d.style.width=a+"px",d.style.height=o+"px";for(var h=0;h<this.CANVAS_LAYERS;h++)(t=n.canvases[h]).width=u,t.height=c,t.style.width=a+"px",t.style.height=o+"px";for(var h=0;h<this.BUFFER_COUNT;h++)(t=n.bufferCanvases[h]).width=u,t.height=c,t.style.width=a+"px",t.style.height=o+"px";this.textureMult=1,s<=1&&(t=n.bufferCanvases[this.TEXTURE_BUFFER],this.textureMult=2,t.width=u*this.textureMult,t.height=c*this.textureMult),this.canvasWidth=u,this.canvasHeight=c}},nt.renderTo=function(e,t,n,i){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:i})},nt.render=function(e){var t=(e=e||staticEmptyObject()).forcedContext,n=e.drawAllLayers,i=e.drawOnlyNodeLayer,a=e.forcedZoom,o=e.forcedPan,s=this,l=void 0===e.forcedPxRatio?this.getPixelRatio():e.forcedPxRatio,u=s.cy,c=s.data,d=c.canvasNeedsRedraw,h=s.textureOnViewport&&!t&&(s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming),p=void 0!==e.motionBlur?e.motionBlur:s.motionBlur,g=s.motionBlurPxRatio,v=u.hasCompoundNodes(),y=s.hoverData.draggingEles,b=!!s.hoverData.selecting||!!s.touchData.selecting,x=p=p&&!t&&s.motionBlurEnabled&&!b;t||(s.prevPxRatio!==l&&(s.invalidateContainerClientCoordsCache(),s.matchCanvasSize(s.container),s.redrawHint("eles",!0),s.redrawHint("drag",!0)),s.prevPxRatio=l),!t&&s.motionBlurTimeout&&clearTimeout(s.motionBlurTimeout),p&&(null==s.mbFrames&&(s.mbFrames=0),s.mbFrames++,s.mbFrames<3&&(x=!1),s.mbFrames>s.minMbLowQualFrames&&(s.motionBlurPxRatio=s.mbPxRBlurry)),s.clearingMotionBlur&&(s.motionBlurPxRatio=1),s.textureDrawLastFrame&&!h&&(d[s.NODE]=!0,d[s.SELECT_BOX]=!0);var w=u.style(),E=u.zoom(),C=void 0!==a?a:E,S=u.pan(),P={x:S.x,y:S.y},k={zoom:E,pan:{x:S.x,y:S.y}},D=s.prevViewport;void 0===D||k.zoom!==D.zoom||k.pan.x!==D.pan.x||k.pan.y!==D.pan.y||y&&!v||(s.motionBlurPxRatio=1),o&&(P=o),C*=l,P.x*=l,P.y*=l;var T=s.getCachedZSortedEles();function mbclear(e,t,n,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",s.colorFillStyle(e,255,255,255,s.motionBlurTransparency),e.fillRect(t,n,i,a),e.globalCompositeOperation=o}function setContextTransform(e,i){var l,u,d,h;s.clearingMotionBlur||e!==c.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]&&e!==c.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]?(l=P,u=C,d=s.canvasWidth,h=s.canvasHeight):(l={x:S.x*g,y:S.y*g},u=E*g,d=s.canvasWidth*g,h=s.canvasHeight*g),e.setTransform(1,0,0,1,0,0),"motionBlur"===i?mbclear(e,0,0,d,h):!t&&(void 0===i||i)&&e.clearRect(0,0,d,h),n||(e.translate(l.x,l.y),e.scale(u,u)),o&&e.translate(o.x,o.y),a&&e.scale(a,a)}if(h||(s.textureDrawLastFrame=!1),h){if(s.textureDrawLastFrame=!0,!s.textureCache){s.textureCache={},s.textureCache.bb=u.mutableElements().boundingBox(),s.textureCache.texture=s.data.bufferCanvases[s.TEXTURE_BUFFER];var B=s.data.bufferContexts[s.TEXTURE_BUFFER];B.setTransform(1,0,0,1,0,0),B.clearRect(0,0,s.canvasWidth*s.textureMult,s.canvasHeight*s.textureMult),s.render({forcedContext:B,drawOnlyNodeLayer:!0,forcedPxRatio:l*s.textureMult});var k=s.textureCache.viewport={zoom:u.zoom(),pan:u.pan(),width:s.canvasWidth,height:s.canvasHeight};k.mpan={x:(0-k.pan.x)/k.zoom,y:(0-k.pan.y)/k.zoom}}d[s.DRAG]=!1,d[s.NODE]=!1;
1var A=c.contexts[s.NODE],I=s.textureCache.texture,k=s.textureCache.viewport;A.setTransform(1,0,0,1,0,0),p?mbclear(A,0,0,k.width,k.height):A.clearRect(0,0,k.width,k.height);var M=w.core("outside-texture-bg-color").value,_=w.core("outside-texture-bg-opacity").value;s.colorFillStyle(A,M[0],M[1],M[2],_),A.fillRect(0,0,k.width,k.height);var E=u.zoom();setContextTransform(A,!1),A.clearRect(k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l),A.drawImage(I,k.mpan.x,k.mpan.y,k.width/k.zoom/l,k.height/k.zoom/l)}else s.textureOnViewport&&!t&&(s.textureCache=null);var L=u.extent(),O=s.pinching||s.hoverData.dragging||s.swipePanning||s.data.wheelZooming||s.hoverData.draggingEles||s.cy.animated(),N=s.hideEdgesOnViewport&&O,z=[];if(z[s.NODE]=!d[s.NODE]&&p&&!s.clearedForMotionBlur[s.NODE]||s.clearingMotionBlur,z[s.NODE]&&(s.clearedForMotionBlur[s.NODE]=!0),z[s.DRAG]=!d[s.DRAG]&&p&&!s.clearedForMotionBlur[s.DRAG]||s.clearingMotionBlur,z[s.DRAG]&&(s.clearedForMotionBlur[s.DRAG]=!0),d[s.NODE]||n||i||z[s.NODE]){var R=p&&!z[s.NODE]&&1!==g,A=t||(R?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_NODE]:c.contexts[s.NODE]);setContextTransform(A,p&&!R?"motionBlur":void 0),N?s.drawCachedNodes(A,T.nondrag,l,L):s.drawLayeredElements(A,T.nondrag,l,L),s.debug&&s.drawDebugPoints(A,T.nondrag),n||p||(d[s.NODE]=!1)}if(!i&&(d[s.DRAG]||n||z[s.DRAG])){var R=p&&!z[s.DRAG]&&1!==g,A=t||(R?s.data.bufferContexts[s.MOTIONBLUR_BUFFER_DRAG]:c.contexts[s.DRAG]);setContextTransform(A,p&&!R?"motionBlur":void 0),N?s.drawCachedNodes(A,T.drag,l,L):s.drawCachedElements(A,T.drag,l,L),s.debug&&s.drawDebugPoints(A,T.drag),n||p||(d[s.DRAG]=!1)}if(s.showFps||!i&&d[s.SELECT_BOX]&&!n){var A=t||c.contexts[s.SELECT_BOX];if(setContextTransform(A),1==s.selection[4]&&(s.hoverData.selecting||s.touchData.selecting)){var E=s.cy.zoom(),F=w.core("selection-box-border-width").value/E;A.lineWidth=F,A.fillStyle="rgba("+w.core("selection-box-color").value[0]+","+w.core("selection-box-color").value[1]+","+w.core("selection-box-color").value[2]+","+w.core("selection-box-opacity").value+")",A.fillRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]),F>0&&(A.strokeStyle="rgba("+w.core("selection-box-border-color").value[0]+","+w.core("selection-box-border-color").value[1]+","+w.core("selection-box-border-color").value[2]+","+w.core("selection-box-opacity").value+")",A.strokeRect(s.selection[0],s.selection[1],s.selection[2]-s.selection[0],s.selection[3]-s.selection[1]))}if(c.bgActivePosistion&&!s.hoverData.selecting){var E=s.cy.zoom(),V=c.bgActivePosistion;A.fillStyle="rgba("+w.core("active-bg-color").value[0]+","+w.core("active-bg-color").value[1]+","+w.core("active-bg-color").value[2]+","+w.core("active-bg-opacity").value+")",A.beginPath(),A.arc(V.x,V.y,w.core("active-bg-size").pfValue/E,0,2*Math.PI),A.fill()}var q=s.lastRedrawTime;if(s.showFps&&q){var j=Math.round(1e3/(q=Math.round(q)));A.setTransform(1,0,0,1,0,0),A.fillStyle="rgba(255, 0, 0, 0.75)",A.strokeStyle="rgba(255, 0, 0, 0.75)",A.lineWidth=1,A.fillText("1 frame = "+q+" ms = "+j+" fps",0,20),A.strokeRect(0,30,250,20),A.fillRect(0,30,250*Math.min(j/60,1),20)}n||(d[s.SELECT_BOX]=!1)}if(p&&1!==g){var $=c.contexts[s.NODE],X=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_NODE],Y=c.contexts[s.DRAG],H=s.data.bufferCanvases[s.MOTIONBLUR_BUFFER_DRAG],drawMotionBlur=function(e,t,n){e.setTransform(1,0,0,1,0,0),n||!x?e.clearRect(0,0,s.canvasWidth,s.canvasHeight):mbclear(e,0,0,s.canvasWidth,s.canvasHeight),e.drawImage(t,0,0,s.canvasWidth*g,s.canvasHeight*g,0,0,s.canvasWidth,s.canvasHeight)};(d[s.NODE]||z[s.NODE])&&(drawMotionBlur($,X,z[s.NODE]),d[s.NODE]=!1),(d[s.DRAG]||z[s.DRAG])&&(drawMotionBlur(Y,H,z[s.DRAG]),d[s.DRAG]=!1)}s.prevViewport=k,s.clearingMotionBlur&&(s.clearingMotionBlur=!1,s.motionBlurCleared=!0,s.motionBlur=!0),p&&(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,d[s.NODE]=!0,d[s.DRAG]=!0,s.redraw()},100)),t||u.emit("render")};var nn={};nn.drawPolygonPath=function(e,t,n,i,a,o){var s=i/2,l=a/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*o[0],n+l*o[1]);for(var u=1;u<o.length/2;u++)e.lineTo(t+s*o[2*u],n+l*o[2*u+1]);e.closePath()},nn.drawRoundPolygonPath=function(e,t,n,i,a,o){var s=i/2,l=a/2,u=getRoundPolygonRadius(i,a);e.beginPath&&e.beginPath();for(var c=0;c<o.length/4;c++){var d=void 0,h=void 0;d=0===c?o.length-2:4*c-2,h=4*c+2;var p=t+s*o[4*c],g=n+l*o[4*c+1],v=u/Math.tan(Math.acos(-o[d]*o[h]-o[d+1]*o[h+1])/2),y=p-v*o[d],b=g-v*o[d+1],x=p+v*o[h],w=g+v*o[h+1];0===c?e.moveTo(y,b):e.lineTo(y,b),e.arcTo(p,g,x,w,u)}e.closePath()},nn.drawRoundRectanglePath=function(e,t,n,i,a){var o=i/2,s=a/2,l=getRoundRectangleRadius(i,a);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.arcTo(t+o,n-s,t+o,n,l),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.arcTo(t-o,n-s,t,n-s,l),e.lineTo(t,n-s),e.closePath()},nn.drawBottomRoundRectanglePath=function(e,t,n,i,a){var o=i/2,s=a/2,l=getRoundRectangleRadius(i,a);e.beginPath&&e.beginPath(),e.moveTo(t,n-s),e.lineTo(t+o,n-s),e.lineTo(t+o,n),e.arcTo(t+o,n+s,t,n+s,l),e.arcTo(t-o,n+s,t-o,n,l),e.lineTo(t-o,n-s),e.lineTo(t,n-s),e.closePath()},nn.drawCutRectanglePath=function(e,t,n,i,a){var o=i/2,s=a/2,l=getCutRectangleCornerLength();e.beginPath&&e.beginPath(),e.moveTo(t-o+l,n-s),e.lineTo(t+o-l,n-s),e.lineTo(t+o,n-s+l),e.lineTo(t+o,n+s-l),e.lineTo(t+o-l,n+s),e.lineTo(t-o+l,n+s),e.lineTo(t-o,n+s-l),e.lineTo(t-o,n-s+l),e.closePath()},nn.drawBarrelPath=function(e,t,n,i,a){var o=i/2,s=a/2,l=t-o,u=t+o,c=n-s,d=n+s,h=getBarrelCurveConstants(i,a),p=h.widthOffset,g=h.heightOffset,v=h.ctrlPtOffsetPct*p;e.beginPath&&e.beginPath(),e.moveTo(l,c+g),e.lineTo(l,d-g),e.quadraticCurveTo(l+v,d,l+p,d),e.lineTo(u-p,d),e.quadraticCurveTo(u-v,d,u,d-g),e.lineTo(u,c+g),e.quadraticCurveTo(u-v,c,u-p,c),e.lineTo(l+p,c),e.quadraticCurveTo(l+v,c,l,c+g),e.closePath()};for(var nr={},ni={},na=Math.PI/40,no=0*Math.PI;no<2*Math.PI;no+=na)nr[no]=Math.sin(no),ni[no]=Math.cos(no);nn.drawEllipsePath=function(e,t,n,i,a){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,i/2,a/2,0,0,2*Math.PI);else for(var o,s,l=i/2,u=a/2,c=0*Math.PI;c<2*Math.PI;c+=na)o=t-l*nr[c]*0+l*ni[c]*1,s=n+u*ni[c]*0+u*nr[c]*1,0===c?e.moveTo(o,s):e.lineTo(o,s);e.closePath()};var ns={};function b64UriToB64(e){var t=e.indexOf(",");return e.substr(t+1)}function output(e,t,n){var getB64Uri=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new eS(function(i,a){try{t.toBlob(function(e){null!=e?i(e):a(Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(e){a(e)}});case"blob":return function(e,t){for(var n=atob(e),i=new ArrayBuffer(n.length),a=new Uint8Array(i),o=0;o<n.length;o++)a[o]=n.charCodeAt(o);return new Blob([i],{type:t})}(b64UriToB64(getB64Uri()),n);case"base64":return b64UriToB64(getB64Uri());default:return getB64Uri()}}ns.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},ns.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements().boundingBox(),i=this.findContainerClientCoords(),a=e.full?Math.ceil(n.w):i[2],o=e.full?Math.ceil(n.h):i[3],s=number$1(e.maxWidth)||number$1(e.maxHeight),l=this.getPixelRatio(),u=1;
vendor: 4,213 bytes, line 1
1if(void 0!==e.scale)a*=e.scale,o*=e.scale,u=e.scale;else if(s){var c=1/0,d=1/0;number$1(e.maxWidth)&&(c=u*e.maxWidth/a),number$1(e.maxHeight)&&(d=u*e.maxHeight/o),a*=u=Math.min(c,d),o*=u}s||(a*=l,o*=l,u*=l);var h=document.createElement("canvas");h.width=a,h.height=o,h.style.width=a+"px",h.style.height=o+"px";var p=h.getContext("2d");if(a>0&&o>0){p.clearRect(0,0,a,o),p.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)p.translate(-n.x1*u,-n.y1*u),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(n.x1*u,n.y1*u);else{var v=t.pan(),y={x:v.x*u,y:v.y*u};u*=t.zoom(),p.translate(y.x,y.y),p.scale(u,u),this.drawElements(p,g),p.scale(1/u,1/u),p.translate(-y.x,-y.y)}e.bg&&(p.globalCompositeOperation="destination-over",p.fillStyle=e.bg,p.rect(0,0,a,o),p.fill())}return h},ns.png=function(e){return output(e,this.bufferCanvasImage(e),"image/png")},ns.jpg=function(e){return output(e,this.bufferCanvasImage(e),"image/jpeg")};var nl={};nl.nodeShapeImpl=function(e,t,n,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,i,a,o);case"polygon":return this.drawPolygonPath(t,n,i,a,o,s);case"round-polygon":return this.drawRoundPolygonPath(t,n,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,i,a,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,i,a,o);case"barrel":return this.drawBarrelPath(t,n,i,a,o)}};var nu=CanvasRenderer.prototype;function CanvasRenderer(e){var t=this;t.data={canvases:Array(nu.CANVAS_LAYERS),contexts:Array(nu.CANVAS_LAYERS),canvasNeedsRedraw:Array(nu.CANVAS_LAYERS),bufferCanvases:Array(nu.BUFFER_COUNT),bufferContexts:Array(nu.CANVAS_LAYERS)};var n="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=document.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[n]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[n]=i;var s={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};B&&B.userAgent.match(/msie|trident|edge/i)&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;l<nu.CANVAS_LAYERS;l++){var u=t.data.canvases[l]=document.createElement("canvas");t.data.contexts[l]=u.getContext("2d"),Object.keys(s).forEach(function(e){u.style[e]=s[e]}),u.style.position="absolute",u.setAttribute("data-id","layer"+l),u.style.zIndex=String(nu.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(u),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[nu.NODE].setAttribute("data-id","layer"+nu.NODE+"-node"),t.data.canvases[nu.SELECT_BOX].setAttribute("data-id","layer"+nu.SELECT_BOX+"-selectbox"),t.data.canvases[nu.DRAG].setAttribute("data-id","layer"+nu.DRAG+"-drag");for(var l=0;l<nu.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=document.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var c=makeBoundingBox(),getCenterOffset=function(e){return{x:-e.w/2,y:-e.h/2}},getElementBox=function(e){return e.boundingBox(),e[0]._private.bodyBounds},getLabelBox=function(e){return e.boundingBox(),e[0]._private.labelBounds.main||c},getSourceLabelBox=function(e){return e.boundingBox(),e[0]._private.labelBounds.source||c},getTargetLabelBox=function(e){return e.boundingBox(),e[0]._private.labelBounds.target||c},isLabelVisibleAtScale=function(e,t){return t},addTextMargin=function(e,t,n){var i=e?e+"-":"";return{x:t.x+n.pstyle(i+"text-margin-x").pfValue,y:t.y+n.pstyle(i+"text-margin-y").pfValue}},getRsPt=function(e,t,n){var i=e[0]._private.rscratch;return{x:i[t],y:i[n]}},d=t.data.eleTxrCache=new ElementTextureCache(t,{getKey:function(e){return e[0]._private.nodeKey},doesEleInvalidateKey:function(e){var t=e[0]._private;
1return t.oldBackgroundTimestamp!==t.backgroundTimestamp},drawElement:function(e,n,i,a,o){return t.drawElement(e,n,i,!1,!1,o)},getBoundingBox:getElementBox,getRotationPoint:function(e){var t;return{x:((t=getElementBox(e)).x1+t.x2)/2,y:(t.y1+t.y2)/2}},getRotationOffset:function(e){return getCenterOffset(getElementBox(e))},allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),h=t.data.lblTxrCache=new ElementTextureCache(t,{getKey:function(e){return e[0]._private.labelStyleKey},drawElement:function(e,n,i,a,o){return t.drawElementText(e,n,i,a,"main",o)},getBoundingBox:getLabelBox,getRotationPoint:function(e){return addTextMargin("",getRsPt(e,"labelX","labelY"),e)},getRotationOffset:function(e){var t=getLabelBox(e),n=getCenterOffset(getLabelBox(e));if(e.isNode()){switch(e.pstyle("text-halign").value){case"left":n.x=-t.w;break;case"right":n.x=0}switch(e.pstyle("text-valign").value){case"top":n.y=-t.h;break;case"bottom":n.y=0}}return n},isVisible:isLabelVisibleAtScale}),p=t.data.slbTxrCache=new ElementTextureCache(t,{getKey:function(e){return e[0]._private.sourceLabelStyleKey},drawElement:function(e,n,i,a,o){return t.drawElementText(e,n,i,a,"source",o)},getBoundingBox:getSourceLabelBox,getRotationPoint:function(e){return addTextMargin("source",getRsPt(e,"sourceLabelX","sourceLabelY"),e)},getRotationOffset:function(e){return getCenterOffset(getSourceLabelBox(e))},isVisible:isLabelVisibleAtScale}),g=t.data.tlbTxrCache=new ElementTextureCache(t,{getKey:function(e){return e[0]._private.targetLabelStyleKey},drawElement:function(e,n,i,a,o){return t.drawElementText(e,n,i,a,"target",o)},getBoundingBox:getTargetLabelBox,getRotationPoint:function(e){return addTextMargin("target",getRsPt(e,"targetLabelX","targetLabelY"),e)},getRotationOffset:function(e){return getCenterOffset(getTargetLabelBox(e))},isVisible:isLabelVisibleAtScale}),v=t.data.lyrTxrCache=new LayeredTextureCache(t);t.onUpdateEleCalcs(function(e,t){d.invalidateElements(t),h.invalidateElements(t),p.invalidateElements(t),g.invalidateElements(t),v.invalidateElements(t);for(var n=0;n<t.length;n++){var i=t[n]._private;i.oldBackgroundTimestamp=i.backgroundTimestamp}});var refineInLayers=function(e){for(var t=0;t<e.length;t++)v.enqueueElementRefinement(e[t].ele)};d.onDequeue(refineInLayers),h.onDequeue(refineInLayers),p.onDequeue(refineInLayers),g.onDequeue(refineInLayers)}nu.CANVAS_LAYERS=3,nu.SELECT_BOX=0,nu.DRAG=1,nu.NODE=2,nu.BUFFER_COUNT=3,nu.TEXTURE_BUFFER=0,nu.MOTIONBLUR_BUFFER_NODE=1,nu.MOTIONBLUR_BUFFER_DRAG=2,nu.redrawHint=function(e,t){switch(e){case"eles":this.data.canvasNeedsRedraw[nu.NODE]=t;break;case"drag":this.data.canvasNeedsRedraw[nu.DRAG]=t;break;case"select":this.data.canvasNeedsRedraw[nu.SELECT_BOX]=t}};var nc="undefined"!=typeof Path2D;nu.path2dEnabled=function(e){if(void 0===e)return this.pathsEnabled;this.pathsEnabled=!!e},nu.usePaths=function(){return nc&&this.pathsEnabled},nu.setImgSmoothing=function(e,t){null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},nu.getImgSmoothing=function(e){return null!=e.imageSmoothingEnabled?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},nu.makeOffscreenCanvas=function(e,t){var n;return("undefined"==typeof OffscreenCanvas?"undefined":_typeof(OffscreenCanvas))!=="undefined"?n=new OffscreenCanvas(e,t):((n=document.createElement("canvas")).width=e,n.height=t),n},[t4,t9,t6,t8,t7,ne,nt,nn,ns,nl].forEach(function(e){j(nu,e)});var nd=[{name:"null",impl:NullRenderer},{name:"base",impl:BR},{name:"canvas",impl:CanvasRenderer}],nh={},np={};function setExtension(e,t,n){var i=n,overrideErr=function(n){warn("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(Core.prototype[t])return overrideErr(t);Core.prototype[t]=n}else if("collection"===e){if(Collection.prototype[t])return overrideErr(t);Collection.prototype[t]=n}else if("layout"===e){for(var Layout=function(e){this.options=e,n.call(this,e),plainObject(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},a=Layout.prototype=Object.create(n.prototype),o=[],s=0;s<o.length;s++){var l=o[s];a[l]=a[l]||function(){return this}}a.start&&!a.run?a.run=function(){return this.start(),this}:!a.start&&a.run&&(a.start=function(){return this.run(),this});var u=n.prototype.stop;a.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}
1return u?u.call(this):this.emit("layoutstop"),this},a.destroy||(a.destroy=function(){return this}),a.cy=function(){return this._private.cy};var getCy=function(e){return e._private.cy},c={addEventFields:function(e,t){t.layout=e,t.cy=getCy(e),t.target=e},bubble:function(){return!0},parent:function(e){return getCy(e)}};j(a,{createEmitter:function(){return this._private.emitter=new Emitter(c,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),ek.eventAliasesOn(a),i=Layout}else if("renderer"===e&&"null"!==t&&"base"!==t){var d=getExtension("renderer","base"),h=d.prototype,p=n.prototype,Renderer=function(){d.apply(this,arguments),n.apply(this,arguments)},g=Renderer.prototype;for(var v in h){var y=h[v];if(null!=p[v])return overrideErr(v);g[v]=y}for(var b in p)g[b]=p[b];h.clientFunctions.forEach(function(e){g[e]=g[e]||function(){error("Renderer does not implement `renderer."+e+"()` on its prototype")}}),i=Renderer}else if("__proto__"===e||"constructor"===e||"prototype"===e)return error(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return setMap({map:nh,keys:[e,t],value:i})}function getExtension(e,t){return getMap({map:nh,keys:[e,t]})}function setModule(e,t,n,i,a){return setMap({map:np,keys:[e,t,n,i],value:a})}function getModule(e,t,n,i){return getMap({map:np,keys:[e,t,n,i]})}var extension=function(){return 2==arguments.length?getExtension.apply(null,arguments):3==arguments.length?setExtension.apply(null,arguments):4==arguments.length?getModule.apply(null,arguments):5==arguments.length?setModule.apply(null,arguments):void error("Invalid extension access syntax")};Core.prototype.extension=extension,[{type:"layout",extensions:t_},{type:"renderer",extensions:nd}].forEach(function(e){e.extensions.forEach(function(t){setExtension(e.type,t.name,t.impl)})});var Stylesheet=function Stylesheet(){if(!(this instanceof Stylesheet))return new Stylesheet;this.length=0},ng=Stylesheet.prototype;ng.instanceString=function(){return"stylesheet"},ng.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},ng.css=function(e,t){var n=this.length-1;if(string(e))this[n].properties.push({name:e,value:t});else if(plainObject(e))for(var i=Object.keys(e),a=0;a<i.length;a++){var o=i[a],s=e[o];if(null!=s){var l=Style.properties[o]||Style.properties[O(o)];if(null!=l){var u=l.name;this[n].properties.push({name:u,value:s})}}}return this},ng.style=ng.css,ng.generateStyle=function(e){var t=new Style(e);return this.appendToStyle(t)},ng.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],i=n.selector,a=n.properties;e.selector(i);for(var o=0;o<a.length;o++){var s=a[o];e.css(s.name,s.value)}}return e};var cytoscape=function(e){return(void 0===e&&(e={}),plainObject(e))?new Core(e):string(e)?extension.apply(extension,arguments):void 0};cytoscape.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(cytoscape),e.apply(null,t),this},cytoscape.warnings=function(e){return warnings(e)},cytoscape.version="3.28.1",cytoscape.stylesheet=cytoscape.Stylesheet=Stylesheet,e.exports=cytoscape}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.