diff --git "a/.output/public/assets/mindmap-definition-44684416-B2WUz8vp.js" "b/.output/public/assets/mindmap-definition-44684416-B2WUz8vp.js" new file mode 100644--- /dev/null +++ "b/.output/public/assets/mindmap-definition-44684416-B2WUz8vp.js" @@ -0,0 +1,1014 @@ +import{w as e,x as t,g as n,l as r,f as i,h as a,E as o}from"./CodeBlocks.vue_vue_type_style_index_0_lang-9tJ0id2x.js";import{cq as s,c8 as l}from"./main-B1VD2nmz.js";import{i as u}from"./is_dark-CqRHLrEG.js";import"./fetch-Bo-JsCCZ.js";import"./debounce-WA10vVqG.js";import"./refresh-D9v5zr8e.js";import"./copy-9EUn_k9V.js";import"./index-DUUaDU4G.js";import"./index-BedzsCE5.js";import"./ChatInput.vue_vue_type_style_index_0_lang-DVar0yfR.js";import"./index-B2mXgHAg.js";import"./index-Byyp9n_m.js";import"./dep-ce162557-CrA2Ivhk.js";import"./v4-_R2nDvl_.js";import"./_baseUniq-BzSlISym.js";import"./index-CJnl5QSY.js";var c,h={exports:{}};const d=l((c||(c=1,h.exports=function(){function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}function l(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function c(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a,o,s=[],l=!0,u=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(c){u=!0,i=c}finally{try{if(!l&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw i}}return s}}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function p(e,n){return t(e)||c(e,n)||m(e,n)||h()}function g(e){return n(e)||u(e)||m(e)||d()}function f(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function v(e){var t=f(e,"string");return"symbol"==typeof t?t:t+""}function y(e){return(y="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 m(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}var b="undefined"==typeof window?null:window,x=b?b.navigator:null;b&&b.document;var w,E,T,_,A,C,D,N,S,L,P,k,I,M,R,O,B,F,z,G,V,Y,X,U,j,W,H,q,$=y(""),K=y({}),Z=y((function(){})),Q="undefined"==typeof HTMLElement?"undefined":y(HTMLElement),J=function(e){return e&&e.instanceString&&te(e.instanceString)?e.instanceString():null},ee=function(e){return null!=e&&y(e)==$},te=function(e){return null!=e&&y(e)===Z},ne=function(e){return!le(e)&&(Array.isArray?Array.isArray(e):null!=e&&e instanceof Array)},re=function(e){return null!=e&&y(e)===K&&!ne(e)&&e.constructor===Object},ie=function(e){return null!=e&&y(e)===K},ae=function(e){return null!=e&&y(e)===y(1)&&!isNaN(e)},oe=function(e){return ae(e)&&Math.floor(e)===e},se=function(e){return"undefined"===Q?void 0:null!=e&&e instanceof HTMLElement},le=function(e){return ue(e)||ce(e)},ue=function(e){return"collection"===J(e)&&e._private.single},ce=function(e){return"collection"===J(e)&&!e._private.single},he=function(e){return"core"===J(e)},de=function(e){return"stylesheet"===J(e)},pe=function(e){return"event"===J(e)},ge=function(e){return null==e||!(""!==e&&!e.match(/^\s+$/))},fe=function(e){return"undefined"!=typeof HTMLElement&&e instanceof HTMLElement},ve=function(e){return re(e)&&ae(e.x1)&&ae(e.x2)&&ae(e.y1)&&ae(e.y2)},ye=function(e){return ie(e)&&te(e.then)},me=function(){return x&&x.userAgent.match(/msie|trident|edge/i)},be=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;tt?1:0},ke=function(e,t){return-1*Pe(e,t)},Ie=null!=Object.assign?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var c=new RegExp("^"+De+"$").exec(e);if(c){if((n=parseInt(c[1]))<0?n=(360- -1*n%360)%360:n>360&&(n%=360),n/=360,(r=parseFloat(c[2]))<0||r>100)return;if(r/=100,(i=parseFloat(c[3]))<0||i>100)return;if(i/=100,void 0!==(a=c[4])&&((a=parseFloat(a))<0||a>1))return;if(0===r)o=s=l=Math.round(255*i);else{var h=i<.5?i*(1+r):i+r-i*r,d=2*i-h;o=Math.round(255*u(d,h,n+1/3)),s=Math.round(255*u(d,h,n)),l=Math.round(255*u(d,h,n-1/3))}t=[o,s,l,a]}return t},Oe=function(e){var t,n=new RegExp("^"+Ae+"$").exec(e);if(n){t=[];for(var r=[],i=1;i<=3;i++){var a=n[i];if("%"===a[a.length-1]&&(r[i]=!0),a=parseFloat(a),r[i]&&(a=a/100*255),a<0||a>255)return;t.push(Math.floor(a))}var o=r[1]||r[2]||r[3],s=r[1]&&r[2]&&r[3];if(o&&!s)return;var l=n[4];if(void 0!==l){if((l=parseFloat(l))<0||l>1)return;t.push(l)}}return t},Be=function(e){return ze[e.toLowerCase()]},Fe=function(e){return(ne(e)?e:null)||Be(e)||Me(e)||Oe(e)||Re(e)},ze={ +// special colour names +transparent:[0,0,0,0], +// NB alpha === 0 +// regular colours +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]},Ge=function(e){for(var t=e.map,n=e.keys,r=n.length,i=0;i=s||t<0||y&&e-f>=h}function T(){var e=t();if(E(e))return _(e);p=setTimeout(T,w(e))}function _(e){return p=void 0,m&&u?b(e):(u=c=void 0,d)}function A(){void 0!==p&&clearTimeout(p),f=0,u=g=c=p=void 0}function C(){return void 0===p?d:_(t())}function D(){var e=t(),n=E(e);if(u=arguments,c=this,g=e,n){if(void 0===p)return x(g);if(y)return clearTimeout(p),p=setTimeout(T,s),b(g)}return void 0===p&&(p=setTimeout(T,s)),d}return s=n(s)||0,e(l)&&(v=!!l.leading,h=(y="maxWait"in l)?i(n(l.maxWait)||0,s):h,m="trailing"in l?!!l.trailing:m),D.cancel=A,D.flush=C,D}return H=o}var it=Xe(rt()),at=b?b.performance:null,ot=at&&at.now?function(){return at.now()}:function(){return Date.now()},st=function(){if(b){if(b.requestAnimationFrame)return function(e){b.requestAnimationFrame(e)};if(b.mozRequestAnimationFrame)return function(e){b.mozRequestAnimationFrame(e)};if(b.webkitRequestAnimationFrame)return function(e){b.webkitRequestAnimationFrame(e)};if(b.msRequestAnimationFrame)return function(e){b.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout((function(){e(ot())}),1e3/60)}}(),lt=function(e){return st(e)},ut=ot,ct=9261,ht=65599,dt=5381,pt=function(e){for(var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct;!(t=e.next()).done;)n=n*ht+t.value|0;return n},gt=function(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:ct)*ht+e|0},ft=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dt;return(t<<5)+t+e|0},vt=function(e,t){return 2097152*e+t},yt=function(e){return 2097152*e[0]+e[1]},mt=function(e,t){return[gt(e[0],t[0]),ft(e[1],t[1])]},bt=function(e,t){var n={value:0,done:!1},r=0,i=e.length;return pt({next:function(){return r=0;r--)e[r]===t&&e.splice(r,1)},Gt=function(e){e.splice(0,e.length)},Vt=function(e,t){for(var n=0;n2&&void 0!==arguments[2])||arguments[2];if(void 0!==e&&void 0!==t&&he(e)){var r=t.group;if(null==r&&(r=t.data&&null!=t.data.source&&null!=t.data.target?"edges":"nodes"),"nodes"===r||"edges"===r){this.length=1,this[0]=this;var i=this._private={cy:e,single:!0, +// indicates this is an element +data:t.data||{}, +// data object +position:t.position||{x:0,y:0}, +// (x, y) position pair +autoWidth:void 0, +// width and height of nodes calculated by the renderer when set to special 'auto' value +autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1, +// whether the compound dimensions need to be recalculated the next time dimensions are read +listeners:[], +// array of bound listeners +group:r, +// string; 'nodes' or 'edges' +style:{}, +// properties as set by the style +rstyle:{}, +// properties for style sent from the renderer to the core +styleCxts:[], +// applied style contexts from the styler +styleKeys:{}, +// per-group keys of style property values +removed:!0, +// whether it's inside the vis; true if removed (set true here since we call restore) +selected:!!t.selected, +// whether it's selected +selectable:void 0===t.selectable||!!t.selectable, +// whether it's selectable +locked:!!t.locked, +// whether the element is locked (cannot be moved) +grabbed:!1, +// whether the element is grabbed by the mouse; renderer sets this privately +grabbable:void 0===t.grabbable||!!t.grabbable, +// whether the element can be grabbed +pannable:void 0===t.pannable?"edges"===r:!!t.pannable, +// whether the element has passthrough panning enabled +active:!1, +// whether the element is active from user interaction +classes:new qt, +// map ( className => true ) +animation:{ +// object for currently-running animations +current:[],queue:[]},rscratch:{}, +// object in which the renderer can store information +scratch:t.scratch||{}, +// scratch objects +edges:[], +// array of connected edges +children:[], +// array of children +parent:t.parent&&t.parent.isNode()?t.parent:null, +// parent ref +traversalCache:{}, +// cache of output of traversal functions +backgrounding:!1, +// whether background images are loading +bbCache:null, +// cache of the current bounding box +bbCacheShift:{x:0,y:0}, +// shift applied to cached bb to be applied on next get +bodyBounds:null, +// bounds cache of element body, w/o overlay +overlayBounds:null, +// bounds cache of element body, including overlay +labelBounds:{ +// bounds cache of labels +all:null,source:null,target:null,main:null},arrowBounds:{ +// bounds cache of edge arrows +source:null,target:null,"mid-source":null,"mid-target":null}};if(null==i.position.x&&(i.position.x=0),null==i.position.y&&(i.position.y=0),t.renderedPosition){var a=t.renderedPosition,o=e.pan(),s=e.zoom();i.position={x:(a.x-o.x)/s,y:(a.y-o.y)/s}}var l=[];ne(t.classes)?l=t.classes:ee(t.classes)&&(l=t.classes.split(/\s+/));for(var u=0,c=l.length;ut?1:0},u=function(e,t,i,a,o){var s;if(null==i&&(i=0),null==o&&(o=n),i<0)throw new Error("lo must be non-negative");for(null==a&&(a=e.length);in;0<=n?t++:t--)u.push(t);return u}.apply(this).reverse()).length;af;0<=f?++d:--d)v.push(a(e,r));return v},g=function(e,t,r,i){var a,o,s;for(null==i&&(i=n),a=e[r];r>t&&i(a,o=e[s=r-1>>1])<0;)e[r]=o,r=s;return e[r]=a},f=function(e,t,r){var i,a,o,s,l;for(null==r&&(r=n),a=e.length,l=t,o=e[t],i=2*t+1;i0;){var w=y.pop(),E=f(w),T=w.id();if(h[T]=E,E!==1/0)for(var _=w.neighborhood().intersect(p),A=0;A<_.length;A++){var C=_[A],D=C.id(),N=x(w,C),S=E+N.dist;S0)for(n.unshift(t);c[i];){var a=c[i];n.unshift(a.edge),n.unshift(a.node),i=(r=a.node).id()}return o.spawn(n)}}}},un={ +// kruskal's algorithm (finds min spanning tree, assuming undirected graph) +// implemented from pseudocode from wikipedia +kruskal:function(e){e=e||function(e){return 1};for(var t=this.byGroup(),n=t.nodes,r=t.edges,i=n.length,a=new Array(i),o=n,s=function(e){for(var t=0;t0;){if(x(),E++,u===h){for(var T=[],_=i,A=h,C=m[A];T.unshift(_),null!=C&&T.unshift(C),null!=(_=y[A]);)C=m[A=_.id()];return{found:!0,distance:d[u],path:this.spawn(T),steps:E}}g[u]=!0;for(var D=l._private.edges,N=0;NC&&(p[A]=C,y[A]=_,m[A]=x),!i){var D=_*u+T;!i&&p[D]>C&&(p[D]=C,y[D]=T,m[D]=x)}}}for(var N=0;N1&&void 0!==arguments[1]?arguments[1]:a,r=[],i=m(e);;){if(null==i)return t.spawn();var o=y(i),l=o.edge,u=o.pred;if(r.unshift(i[0]),i.same(n)&&r.length>0)break;null!=l&&r.unshift(l),i=u}return s.spawn(r)},w=0;w=0;u--){var c=l[u],h=c[1],d=c[2];(t[h]===o&&t[d]===s||t[h]===s&&t[d]===o)&&l.splice(u,1)}for(var p=0;pr;){var i=Math.floor(Math.random()*t.length);t=yn(i,e,t),n--}return t},bn={ +// Computes the minimum cut of an undirected graph +// Returns the correct answer with high probability +kargerStein:function(){var e=this,t=this.byGroup(),n=t.nodes,r=t.edges;r.unmergeBy((function(e){return e.isLoop()}));var i=n.length,a=r.length,o=Math.ceil(Math.pow(Math.log(i)/Math.LN2,2)),s=Math.floor(i/vn);if(!(i<2)){for(var l=[],u=0;u1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=-1/0,i=t;i1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=0,i=0,a=t;a1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];arguments.length>3&&void 0!==arguments[3]&&!arguments[3]?(n0&&e.splice(0,t)):e=e.slice(t,n);for(var a=0,o=e.length-1;o>=0;o--){var s=e[o];i?isFinite(s)||(e[o]=-1/0,a++):e.splice(o,1)}r&&e.sort((function(e,t){return e-t}));var l=e.length,u=Math.floor(l/2);return l%2!=0?e[u+1+a]:(e[u-1+a]+e[u+a])/2},Nn=function(e){return Math.PI*e/180},Sn=function(e,t){return Math.atan2(t,e)-Math.PI/2},Ln=Math.log2||function(e){return Math.log(e)/Math.log(2)},Pn=function(e){return e>0?1:e<0?-1:0},kn=function(e,t){return Math.sqrt(In(e,t))},In=function(e,t){var n=t.x-e.x,r=t.y-e.y;return n*n+r*r},Mn=function(e){for(var t=e.length,n=0,r=0;r=e.x1&&e.y2>=e.y1)return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,w:e.x2-e.x1,h:e.y2-e.y1};if(null!=e.w&&null!=e.h&&e.w>=0&&e.h>=0)return{x1:e.x1,y1:e.y1,x2:e.x1+e.w,y2:e.y1+e.h,w:e.w,h:e.h}}},Gn=function(e){return{x1:e.x1,x2:e.x2,w:e.w,y1:e.y1,y2:e.y2,h:e.h}},Vn=function(e){e.x1=1/0,e.y1=1/0,e.x2=-1/0,e.y2=-1/0,e.w=0,e.h=0},Yn=function(e,t,n){return{x1:e.x1+t,x2:e.x2+t,y1:e.y1+n,y2:e.y2+n,w:e.w,h:e.h}},Xn=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},Un=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},jn=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},Wn=function(e){var t,n,r,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0];if(1===a.length)t=n=r=i=a[0];else if(2===a.length)t=r=a[0],i=n=a[1];else if(4===a.length){var o=p(a,4);t=o[0],n=o[1],r=o[2],i=o[3]}return e.x1-=i,e.x2+=n,e.y1-=t,e.y2+=r,e.w=e.x2-e.x1,e.h=e.y2-e.y1,e},Hn=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},qn=function(e,t){return!(e.x1>t.x2||t.x1>e.x2||e.x2t.y2||t.y1>e.y2)},$n=function(e,t,n){return e.x1<=t&&t<=e.x2&&e.y1<=n&&n<=e.y2},Kn=function(e,t){return $n(e,t.x,t.y)},Zn=function(e,t){return $n(e,t.x1,t.y1)&&$n(e,t.x2,t.y2)},Qn=function(e,t,n,r,i,a,o){var s,l,u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"auto",c="auto"===u?wr(i,a):u,h=i/2,d=a/2,p=(c=Math.min(c,h,d))!==h,g=c!==d;if(p){var f=r-d-o;if((s=gr(e,t,n,r,n-h+c-o,f,n+h-c+o,f,!1)).length>0)return s}if(g){var v=n+h+o;if((s=gr(e,t,n,r,v,r-d+c-o,v,r+d-c+o,!1)).length>0)return s}if(p){var y=r+d+o;if((s=gr(e,t,n,r,n-h+c-o,y,n+h-c+o,y,!1)).length>0)return s}if(g){var m=n-h-o;if((s=gr(e,t,n,r,m,r-d+c-o,m,r+d-c+o,!1)).length>0)return s}var b=n-h+c,x=r-d+c;if((l=dr(e,t,n,r,b,x,c+o)).length>0&&l[0]<=b&&l[1]<=x)return[l[0],l[1]];var w=n+h-c,E=r-d+c;if((l=dr(e,t,n,r,w,E,c+o)).length>0&&l[0]>=w&&l[1]<=E)return[l[0],l[1]];var T=n+h-c,_=r+d-c;if((l=dr(e,t,n,r,T,_,c+o)).length>0&&l[0]>=T&&l[1]>=_)return[l[0],l[1]];var A=n-h+c,C=r+d-c;return(l=dr(e,t,n,r,A,C,c+o)).length>0&&l[0]<=A&&l[1]>=C?[l[0],l[1]]:[]},Jn=function(e,t,n,r,i,a,o){var s=o,l=Math.min(n,i),u=Math.max(n,i),c=Math.min(r,a),h=Math.max(r,a);return l-s<=e&&e<=u+s&&c-s<=t&&t<=h+s},er=function(e,t,n,r,i,a,o,s,l){var u={x1:Math.min(n,o,i)-l,x2:Math.max(n,o,i)+l,y1:Math.min(r,s,a)-l,y2:Math.max(r,s,a)+l};return!(eu.x2||tu.y2)},tr=function(e,t,n,r){var i=t*t-4*e*(n-=r);if(i<0)return[];var a=Math.sqrt(i),o=2*e;return[(-t+a)/o,(-t-a)/o]},nr=function(e,t,n,r,i){var a,o,s,l,u,c,h,d;return 0===e&&(e=1e-5),s=-27*(r/=e)+(t/=e)*(9*(n/=e)-t*t*2),a=(o=(3*n-t*t)/9)*o*o+(s/=54)*s,i[1]=0,h=t/3,a>0?(u=(u=s+Math.sqrt(a))<0?-Math.pow(-u,1/3):Math.pow(u,1/3),c=(c=s-Math.sqrt(a))<0?-Math.pow(-c,1/3):Math.pow(c,1/3),i[0]=-h+u+c,h+=(u+c)/2,i[4]=i[2]=-h,h=Math.sqrt(3)*(-c+u)/2,i[3]=h,void(i[5]=-h)):(i[5]=i[3]=0,0===a?(d=s<0?-Math.pow(-s,1/3):Math.pow(s,1/3),i[0]=2*d-h,void(i[4]=i[2]=-(d+h))):(l=(o=-o)*o*o,l=Math.acos(s/Math.sqrt(l)),d=2*Math.sqrt(o),i[0]=-h+d*Math.cos(l/3),i[2]=-h+d*Math.cos((l+2*Math.PI)/3),void(i[4]=-h+d*Math.cos((l+4*Math.PI)/3))))},rr=function(e,t,n,r,i,a,o,s){var l=[];nr(1*n*n-4*n*i+2*n*o+4*i*i-4*i*o+o*o+r*r-4*r*a+2*r*s+4*a*a-4*a*s+s*s,9*n*i-3*n*n-3*n*o-6*i*i+3*i*o+9*r*a-3*r*r-3*r*s-6*a*a+3*a*s,3*n*n-6*n*i+n*o-n*e+2*i*i+2*i*e-o*e+3*r*r-6*r*a+r*s-r*t+2*a*a+2*a*t-s*t,1*n*i-n*n+n*e-i*e+r*a-r*r+r*t-a*t,l);for(var u=1e-7,c=[],h=0;h<6;h+=2)Math.abs(l[h+1])=0&&l[h]<=1&&c.push(l[h]);c.push(1),c.push(0);for(var d,p,g,f=-1,v=0;v=0?gl?(e-i)*(e-i)+(t-a)*(t-a):u-h},ar=function(e,t,n){for(var r,i,a,o,s=0,l=0;l=e&&e>=a||r<=e&&e<=a))continue;(e-r)/(a-r)*(o-i)+i>t&&s++}return s%2!=0},or=function(e,t,n,r,i,a,o,s,l){var u,c=new Array(n.length);null!=s[0]?(u=Math.atan(s[1]/s[0]),s[0]<0?u+=Math.PI/2:u=-u-Math.PI/2):u=s;for(var h,d=Math.cos(-u),p=Math.sin(-u),g=0;g0){var f=ur(c,-l);h=lr(f)}else h=c;return ar(e,t,h)},sr=function(e,t,n,r,i,a,o,s){for(var l=new Array(2*n.length),u=0;u=0&&g<=1&&v.push(g),f>=0&&f<=1&&v.push(f),0===v.length)return[];var y=v[0]*s[0]+e,m=v[0]*s[1]+t;return v.length>1?v[0]==v[1]?[y,m]:[y,m,v[1]*s[0]+e,v[1]*s[1]+t]:[y,m]},pr=function(e,t,n){return t<=e&&e<=n||n<=e&&e<=t?e:e<=t&&t<=n||n<=t&&t<=e?t:n},gr=function(e,t,n,r,i,a,o,s,l){var u=e-i,c=n-e,h=o-i,d=t-a,p=r-t,g=s-a,f=h*d-g*u,v=c*d-p*u,y=g*c-h*p;if(0!==y){var m=f/y,b=v/y,x=.001,w=0-x,E=1+x;return w<=m&&m<=E&&w<=b&&b<=E||l?[e+m*c,t+m*p]:[]}return 0===f||0===v?pr(e,n,o)===o?[o,s]:pr(e,n,i)===i?[i,a]:pr(i,o,n)===n?[n,r]:[]:[]},fr=function(e,t,n,r,i,a,o,s){var l,u,c,h,d,p,g=[],f=new Array(n.length),v=!0;if(null==a&&(v=!1),v){for(var y=0;y0){var m=ur(f,-s);u=lr(m)}else u=f}else u=n;for(var b=0;b2){for(var p=[c[0],c[1]],g=Math.pow(p[0]-e,2)+Math.pow(p[1]-t,2),f=1;fu&&(u=t)},get:function(e){return l[e]}},h=0;h0?m.edgesTo(y)[0]:y.edgesTo(m)[0];var x=r(b);y=y.id(),u[y]>u[g]+x&&(u[y]=u[g]+x,h.nodes.indexOf(y)<0?h.push(y):h.updateItem(y),l[y]=0,n[y]=[]),u[y]==u[g]+x&&(l[y]=l[y]+l[g],n[y].push(g))}else for(var w=0;w0;){for(var A=t.pop(),C=0;C0&&o.push(n[s]);0!==o.length&&i.push(r.collection(o))}return i},Ur=function(e,t){for(var n=0;n5&&void 0!==arguments[5]?arguments[5]:qr,o=r,s=0;s=2?ei(e,t,n,0,Zr,Qr):ei(e,t,n,0,Kr)},squaredEuclidean:function(e,t,n){return ei(e,t,n,0,Zr)},manhattan:function(e,t,n){return ei(e,t,n,0,Kr)},max:function(e,t,n){return ei(e,t,n,-1/0,Jr)}};function ni(e,t,n,r,i,a){var o;return o=te(e)?e:ti[e]||ti.euclidean,0===t&&te(e)?o(i,a):o(t,n,r,i,a)}ti["squared-euclidean"]=ti.squaredEuclidean,ti.squaredeuclidean=ti.squaredEuclidean;var ri=Ft({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),ii=function(e){return ri(e)},ai=function(e,t,n,r,i){var a="kMedoids"!==i?function(e){return n[e]}:function(e){return r[e](n)},o=function(e){return r[e](t)},s=n,l=t;return ni(e,r.length,a,o,s,l)},oi=function(e,t,n){for(var r=n.length,i=new Array(r),a=new Array(r),o=new Array(t),s=null,l=0;ln)return!1;return!0},hi=function(e,t,n){for(var r=0;ri&&(i=t[l][u],a=u);o[a].push(e[l])}for(var c=0;c clusters must be threshold distance apart +threshold:1/0, +// the distance threshold +// mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters +addDendrogram:!1, +// whether to add the dendrogram to the graph for viz +dendrogramDepth:0, +// depth at which dendrogram branches are merged into the returned clusters +attributes:[]}),xi={single:"min",complete:"max"},wi=function(e){var t=bi(e),n=xi[t.linkage];return null!=n&&(t.linkage=n),t},Ei=function(e,t,n,r,i){for(var a,o=0,s=1/0,l=i.attributes,u=function(e,t){return ni(i.distance,l.length,(function(t){return l[t](e)}),(function(e){return l[e](t)}),e,t)},c=0;c=i.threshold||"dendrogram"===i.mode&&1===e.length)return!1;var p,g=t[o],f=t[r[o]];p="dendrogram"===i.mode?{left:g,right:f,key:g.key}:{value:g.value.concat(f.value),key:g.key},e[g.index]=p,e.splice(f.index,1),t[g.key]=p;for(var v=0;vn[f.key][y.key]&&(a=n[f.key][y.key])):"max"===i.linkage?(a=n[g.key][y.key],n[g.key][y.key]0&&r.push(i);return r},Ii=function(e,t,n){for(var r=[],i=0;io&&(a=l,o=t[i*e+l])}a>0&&r.push(a)}for(var u=0;ul&&(s=u,l=c)}n[i]=a[s]}return r=Ii(e,t,n)},Ri=function(e){for(var t,n,r,i,a,o,s=this.cy(),l=this.nodes(),u=Si(e),c={},h=0;h=C?(D=C,C=S,N=L):S>D&&(D=S);for(var P=0;P0?1:0;T[E%u.minIterations*t+B]=F,O+=F}if(O>0&&(E>=u.minIterations-1||E==u.maxIterations-1)){for(var z=0,G=0;G1||o>1)&&(u=!0),c[t]=[],e.outgoers().forEach((function(e){e.isEdge()&&c[t].push(e.id())}))}else h[t]=[void 0,e.target().id()]})):l.forEach((function(e){var t=e.id();e.isNode()?(e.degree(!0)%2&&(n?r?u=!0:r=t:n=t),c[t]=[],e.connectedEdges().forEach((function(e){return c[t].push(e.id())}))):h[t]=[e.source().id(),e.target().id()]}));var d={found:!1,trail:void 0};if(u)return d;if(r&&n)if(s){if(i&&r!=i)return d;i=r}else{if(i&&r!=i&&n!=i)return d;i||(i=r)}else i||(i=l[0].id());var p=function(e){for(var t,n,r,i=e,a=[e];c[i].length;)t=c[i].shift(),n=h[t][0],i!=(r=h[t][1])?(c[r]=c[r].filter((function(e){return e!=t})),i=r):s||i==n||(c[n]=c[n].filter((function(e){return e!=t})),i=n),a.unshift(t),a.unshift(i);return a},g=[],f=[];for(f=p(i);1!=f.length;)0==c[f[0]].length?(g.unshift(l.getElementById(f.shift())),g.unshift(l.getElementById(f.shift()))):f=p(f.shift()).concat(f);for(var v in g.unshift(l.getElementById(f.shift())),c)if(c[v].length)return d;return d.found=!0,d.trail=this.spawn(g,!0),d}},zi=function(){var e=this,t={},n=0,r=0,i=[],a=[],o={},s=function(n,r){for(var o=a.length-1,s=[],l=e.spawn();a[o].x!=n||a[o].y!=r;)s.push(a.pop().edge),o--;s.push(a.pop().edge),s.forEach((function(n){var r=n.connectedNodes().intersection(e);l.merge(n),r.forEach((function(n){var r=n.id(),i=n.connectedEdges().intersection(e);l.merge(n),t[r].cutVertex?l.merge(i.filter((function(e){return e.isLoop()}))):l.merge(i)}))})),i.push(l)},l=function(u,c,h){u===h&&(r+=1),t[c]={id:n,low:n++,cutVertex:!1};var d,p,g,f,v=e.getElementById(c).connectedEdges().intersection(e);0===v.size()?i.push(e.spawn(e.getElementById(c))):v.forEach((function(e){d=e.source().id(),p=e.target().id(),(g=d===c?p:d)!==h&&(f=e.id(),o[f]||(o[f]=!0,a.push({x:c,y:g,edge:e})),g in t?t[c].low=Math.min(t[c].low,t[g].id):(l(u,g,c),t[c].low=Math.min(t[c].low,t[g].low),t[c].id<=t[g].low&&(t[c].cutVertex=!0,s(c,g))))}))};e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||(r=0,l(n,n),t[n].cutVertex=r>1)}}));var u=Object.keys(t).filter((function(e){return t[e].cutVertex})).map((function(t){return e.getElementById(t)}));return{cut:e.spawn(u),components:i}},Gi=function(){var e=this,t={},n=0,r=[],i=[],a=e.spawn(e),o=function(s){if(i.push(s),t[s]={index:n,low:n++,explored:!1},e.getElementById(s).connectedEdges().intersection(e).forEach((function(e){var n=e.target().id();n!==s&&(n in t||o(n),t[n].explored||(t[s].low=Math.min(t[s].low,t[n].low)))})),t[s].index===t[s].low){for(var l=e.spawn();;){var u=i.pop();if(l.merge(e.getElementById(u)),t[u].low=t[s].index,t[u].explored=!0,u===s)break}var c=l.edgesWith(l),h=l.merge(c);r.push(h),a=a.difference(h)}};return e.forEach((function(e){if(e.isNode()){var n=e.id();n in t||o(n)}})),{cut:a,components:r}},Vi={};[Zt,ln,un,hn,pn,fn,bn,Dr,Sr,Pr,Ir,Hr,mi,Di,Oi,Fi,{hopcroftTarjanBiconnected:zi,htbc:zi,htb:zi,hopcroftTarjanBiconnectedComponents:zi},{tarjanStronglyConnected:Gi,tsc:Gi,tscc:Gi,tarjanStronglyConnectedComponents:Gi}].forEach((function(e){Ie(Vi,e)})); +/*! + Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable + Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) + Licensed under The MIT License (http://opensource.org/licenses/MIT) + */ +var Yi=0,Xi=1,Ui=2,ji=function(e){if(!(this instanceof ji))return new ji(e);this.id="Thenable/1.0.7",this.state=Yi,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))};ji.prototype={ +/* promise resolving methods */ +fulfill:function(e){return Wi(this,Xi,"fulfillValue",e)},reject:function(e){return Wi(this,Ui,"rejectReason",e)}, +/* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ +then:function(e,t){var n=this,r=new ji;return n.onFulfilled.push($i(e,r,"fulfill")),n.onRejected.push($i(t,r,"reject")),Hi(n),r.proxy}};var Wi=function(e,t,n,r){return e.state===Yi&&(e.state=t,e[n]=r,Hi(e)),e},Hi=function(e){e.state===Xi?qi(e,"onFulfilled",e.fulfillValue):e.state===Ui&&qi(e,"onRejected",e.rejectReason)},qi=function(e,t,n){if(0!==e[t].length){var r=e[t];e[t]=[];var i=function(){for(var e=0;e0:void 0}}, +// animated +clearQueue:function(){return function(){var e=this,t=void 0!==e.length?e:[e];if(!(this._private.cy||this).styleEnabled())return this;for(var n=0;n-1}return Ya=t}function ns(){if(ja)return Ua;ja=1;var e=Qo();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return Ua=t}function rs(){if(Ha)return Wa;Ha=1;var e=Ko(),t=Jo(),n=es(),r=ts(),i=ns();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&n%1==0&&n true if immutable +updateStyle:!1,beforeGet:function(e){},beforeSet:function(e,t){},onSet:function(e){},canSet:function(e){return!0}},e),function(t,n){var r=e,i=this,a=void 0!==i.length,o=a?i:[i],s=a?i[0]:i;if(ee(t)){var u,c=-1!==t.indexOf(".")&&$s(t);if(r.allowGetting&&void 0===n)return s&&(r.beforeGet(s),u=c&&void 0===s._private[r.field][t]?Rs(s._private[r.field],c):s._private[r.field][t]),u;if(r.allowSetting&&void 0!==n&&!r.immutableKeys[t]){var h=l({},t,n);r.beforeSet(i,h);for(var d=0,p=o.length;d0&&this.spawn(r).updateStyle().emit("class"),t},addClass:function(e){return this.toggleClass(e,!0)},hasClass:function(e){var t=this[0];return null!=t&&t._private.classes.has(e)},toggleClass:function(e,t){ne(e)||(e=e.match(/\S+/g)||[]);for(var n=this,r=void 0===t,i=[],a=0,o=n.length;a0&&this.spawn(i).updateStyle().emit("class"),n},removeClass:function(e){return this.toggleClass(e,!1)},flashClass:function(e,t){var n=this;if(null==t)t=250;else if(0===t)return n;return n.addClass(e),setTimeout((function(){n.removeClass(e)}),t),n}};Js.className=Js.classNames=Js.classes;var el={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]", +// chars we need to escape in let names, etc +comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=", +// binary comparison op (used in data selectors) +boolOp:"\\?|\\!|\\^", +// boolean (unary) operators (used in data selectors) +string:"\"(?:\\\\\"|[^\"])*\"|'(?:\\\\'|[^'])*'", +// string literals (used in data selectors) -- doublequotes | singlequotes +number:_e, +// number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123 +meta:"degree|indegree|outdegree", +// allowed metadata fields (i.e. allowed functions to use from Collection) +separator:"\\s*,\\s*", +// queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass +descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};el.variable="(?:[\\w-.]|(?:\\\\"+el.metaChar+"))+",el.className="(?:[\\w-]|(?:\\\\"+el.metaChar+"))+",el.value=el.string+"|"+el.number,el.id=el.variable,function(){var e,t,n;for(e=el.comparatorOp.split("|"),n=0;n=0||"="!==t&&(el.comparatorOp+="|\\!"+t)}();var tl=function(){return{checks:[]}},nl={ +/** E.g. node */ +GROUP:0, +/** A collection of elements */ +COLLECTION:1, +/** A filter(ele) function */ +FILTER:2, +/** E.g. [foo > 1] */ +DATA_COMPARE:3, +/** E.g. [foo] */ +DATA_EXIST:4, +/** E.g. [?foo] */ +DATA_BOOL:5, +/** E.g. [[degree > 2]] */ +META_COMPARE:6, +/** E.g. :selected */ +STATE:7, +/** E.g. #foo */ +ID:8, +/** E.g. .foo */ +CLASS:9, +/** E.g. #foo <-> #bar */ +UNDIRECTED_EDGE:10, +/** E.g. #foo -> #bar */ +DIRECTED_EDGE:11, +/** E.g. $#foo -> #bar */ +NODE_SOURCE:12, +/** E.g. #foo -> $#bar */ +NODE_TARGET:13, +/** E.g. $#foo <-> #bar */ +NODE_NEIGHBOR:14, +/** E.g. #foo > #bar */ +CHILD:15, +/** E.g. #foo #bar */ +DESCENDANT:16, +/** E.g. $#foo > #bar */ +PARENT:17, +/** E.g. $#foo #bar */ +ANCESTOR:18, +/** E.g. #foo > $bar > #baz */ +COMPOUND_SPLIT:19, +/** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */ +TRUE:20},rl=[{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 ke(e.selector,t.selector)})),il=function(){for(var e,t={},n=0;n0&&u.edgeCount>0)return Pt("The selector `"+e+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(u.edgeCount>1)return Pt("The selector `"+e+"` is invalid because it uses multiple edge selectors"),!1;1===u.edgeCount&&Pt("The selector `"+e+"` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},toString:function(){if(null!=this.toStringCache)return this.toStringCache;for(var e=function(e){return null==e?"":e},t=function(t){return ee(t)?'"'+t+'"':e(t)},n=function(e){return" "+e+" "},r=function(r,a){var o=r.type,s=r.value;switch(o){case nl.GROUP:var l=e(s);return l.substring(0,l.length-1);case nl.DATA_COMPARE:var u=r.field,c=r.operator;return"["+u+n(e(c))+t(s)+"]";case nl.DATA_BOOL:var h=r.operator,d=r.field;return"["+e(h)+d+"]";case nl.DATA_EXIST:return"["+r.field+"]";case nl.META_COMPARE:var p=r.operator;return"[["+r.field+n(e(p))+t(s)+"]]";case nl.STATE:return s;case nl.ID:return"#"+s;case nl.CLASS:return"."+s;case nl.PARENT:case nl.CHILD:return i(r.parent,a)+n(">")+i(r.child,a);case nl.ANCESTOR:case nl.DESCENDANT:return i(r.ancestor,a)+" "+i(r.descendant,a);case nl.COMPOUND_SPLIT:var g=i(r.left,a),f=i(r.subject,a),v=i(r.right,a);return g+(g.length>0?" ":"")+f+v;case nl.TRUE:return""}},i=function(e,t){return e.checks.reduce((function(n,i,a){return n+(t===e&&0===a?"$":"")+r(i,t)}),"")},a="",o=0;o1&&o=0&&(t=t.replace("!",""),c=!0),t.indexOf("@")>=0&&(t=t.replace("@",""),u=!0),(o||l||u)&&(i=o||s?""+e:"",a=""+n),u&&(e=i=i.toLowerCase(),n=a=a.toLowerCase()),t){case"*=":r=i.indexOf(a)>=0;break;case"$=":r=i.indexOf(a,i.length-a.length)>=0;break;case"^=":r=0===i.indexOf(a);break;case"=":r=e===n;break;case">":h=!0,r=e>n;break;case">=":h=!0,r=e>=n;break;case"<":h=!0,r=e0;){var u=i.shift();t(u),a.add(u.id()),o&&r(i,a,u)}return e}function Sl(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i1&&void 0!==arguments[1])||arguments[1],Sl)},Dl.forEachUp=function(e){return Nl(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Ll)},Dl.forEachUpAndDown=function(e){return Nl(this,e,!(arguments.length>1&&void 0!==arguments[1])||arguments[1],Pl)},Dl.ancestors=Dl.parents,(_l=Al={data:Zs.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:Zs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:Zs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Zs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:Zs.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:Zs.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var e=this[0];if(e)return e._private.data.id}}).attr=_l.data,_l.removeAttr=_l.removeData;var kl,Il,Ml=Al,Rl={};function Ol(e){return function(t){var n=this;if(void 0===t&&(t=!0),0!==n.length&&n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,o=0;ot})),minIndegree:Bl("indegree",(function(e,t){return et})),minOutdegree:Bl("outdegree",(function(e,t){return et}))}),Ie(Rl,{totalDegree:function(e){for(var t=0,n=this.nodes(),r=0;r0,c=u;u&&(l=l[0]);var h=c?l.position():{x:0,y:0};return i={x:s.x-h.x,y:s.y-h.y},void 0===e?i:i[e]}for(var d=0;d0,v=f;f&&(g=g[0]);var y=v?g.position():{x:0,y:0};void 0!==t?p.position(e,t+y[e]):void 0!==i&&p.position({x:i.x+y.x,y:i.y+y.y})}}else if(!a)return;return this}}).modelPosition=kl.point=kl.position,kl.modelPositions=kl.points=kl.positions,kl.renderedPoint=kl.renderedPosition,kl.relativePoint=kl.relativePosition;var Gl,Vl,Yl=Il;Gl=Vl={},Vl.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,o=t.x2*r+i.x,s=t.y1*r+i.y,l=t.y2*r+i.y;return{x1:a,x2:o,y1:s,y2:l,w:o-a,h:l-s}},Vl.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();return t.styleEnabled()&&t.hasCompoundNodes()?(this.forEachUp((function(t){if(t.isParent()){var n=t._private;n.compoundBoundsClean=!1,n.bbCache=null,e||t.emitAndNotify("bounds")}})),this):this},Vl.updateCompoundBounds=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(e){if(e.isParent()){var t=e._private,n=e.children(),r="include"===e.pstyle("compound-sizing-wrt-labels").value,i={width:{val:e.pstyle("min-width").pfValue,left:e.pstyle("min-width-bias-left"),right:e.pstyle("min-width-bias-right")},height:{val:e.pstyle("min-height").pfValue,top:e.pstyle("min-height-bias-top"),bottom:e.pstyle("min-height-bias-bottom")}},a=n.boundingBox({includeLabels:r,includeOverlays:!1, +// updating the compound bounds happens outside of the regular +// cache cycle (i.e. before fired events) +useCache:!1}),o=t.position;0!==a.w&&0!==a.h||((a={w:e.pstyle("width").pfValue,h:e.pstyle("height").pfValue}).x1=o.x-a.w/2,a.x2=o.x+a.w/2,a.y1=o.y-a.h/2,a.y2=o.y+a.h/2);var s=i.width.left.value;"px"===i.width.left.units&&i.width.val>0&&(s=100*s/i.width.val);var l=i.width.right.value;"px"===i.width.right.units&&i.width.val>0&&(l=100*l/i.width.val);var u=i.height.top.value;"px"===i.height.top.units&&i.height.val>0&&(u=100*u/i.height.val);var c=i.height.bottom.value;"px"===i.height.bottom.units&&i.height.val>0&&(c=100*c/i.height.val);var h=y(i.width.val-a.w,s,l),d=h.biasDiff,p=h.biasComplementDiff,g=y(i.height.val-a.h,u,c),f=g.biasDiff,v=g.biasComplementDiff;t.autoPadding=m(a.w,a.h,e.pstyle("padding"),e.pstyle("padding-relative-to").value),t.autoWidth=Math.max(a.w,i.width.val),o.x=(-d+a.x1+a.x2+p)/2,t.autoHeight=Math.max(a.h,i.height.val),o.y=(-f+a.y1+a.y2+v)/2}function y(e,t,n){var r=0,i=0,a=t+n;return e>0&&a>0&&(r=t/a*e,i=n/a*e),{biasDiff:r,biasComplementDiff:i}}function m(e,t,n,r){if("%"!==n.units)return"px"===n.units?n.pfValue:0;switch(r){case"width":return e>0?n.pfValue*e:0;case"height":return t>0?n.pfValue*t:0;case"average":return e>0&&t>0?n.pfValue*(e+t)/2:0;case"min":return e>0&&t>0?e>t?n.pfValue*t:n.pfValue*e:0;case"max":return e>0&&t>0?e>t?n.pfValue*e:n.pfValue*t:0;default:return 0}}}for(var r=0;re.x2?r:e.x2,e.y1=ne.y2?i:e.y2,e.w=e.x2-e.x1,e.h=e.y2-e.y1)},jl=function(e,t){return null==t?e:Ul(e,t.x1,t.y1,t.x2,t.y2)},Wl=function(e,t,n){return Yt(e,t,n)},Hl=function(e,t,n){if(!t.cy().headless()){var r,i,a=t._private,o=a.rstyle,s=o.arrowWidth/2;if("none"!==t.pstyle(n+"-arrow-shape").value){"source"===n?(r=o.srcX,i=o.srcY):"target"===n?(r=o.tgtX,i=o.tgtY):(r=o.midX,i=o.midY);var l=a.arrowBounds=a.arrowBounds||{},u=l[n]=l[n]||{};u.x1=r-s,u.y1=i-s,u.x2=r+s,u.y2=i+s,u.w=u.x2-u.x1,u.h=u.y2-u.y1,jn(u,1),Ul(e,u.x1,u.y1,u.x2,u.y2)}}},ql=function(e,t,n){if(!t.cy().headless()){var r;r=n?n+"-":"";var i=t._private,a=i.rstyle;if(t.pstyle(r+"label").strValue){var o,s,l,u,c=t.pstyle("text-halign"),h=t.pstyle("text-valign"),d=Wl(a,"labelWidth",n),p=Wl(a,"labelHeight",n),g=Wl(a,"labelX",n),f=Wl(a,"labelY",n),v=t.pstyle(r+"text-margin-x").pfValue,y=t.pstyle(r+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle(r+"text-rotation"),x=t.pstyle("text-outline-width").pfValue,w=t.pstyle("text-border-width").pfValue/2,E=t.pstyle("text-background-padding").pfValue,T=2,_=p,A=d,C=A/2,D=_/2;if(m)o=g-C,s=g+C,l=f-D,u=f+D;else{switch(c.value){case"left":o=g-A,s=g;break;case"center":o=g-C,s=g+C;break;case"right":o=g,s=g+A}switch(h.value){case"top":l=f-_,u=f;break;case"center":l=f-D,u=f+D;break;case"bottom":l=f,u=f+_}}var N=v-Math.max(x,w)-E-T,S=v+Math.max(x,w)+E+T,L=y-Math.max(x,w)-E-T,P=y+Math.max(x,w)+E+T;o+=N,s+=S,l+=L,u+=P;var k=n||"main",I=i.labelBounds,M=I[k]=I[k]||{};M.x1=o,M.y1=l,M.x2=s,M.y2=u,M.w=s-o,M.h=u-l,M.leftPad=N,M.rightPad=S,M.topPad=L,M.botPad=P;var R=m&&"autorotate"===b.strValue,O=null!=b.pfValue&&0!==b.pfValue;if(R||O){var B=R?Wl(i.rstyle,"labelAngle",n):b.pfValue,F=Math.cos(B),z=Math.sin(B),G=(o+s)/2,V=(l+u)/2;if(!m){switch(c.value){case"left":G=s;break;case"right":G=o}switch(h.value){case"top":V=u;break;case"bottom":V=l}}var Y=function(e,t){return{x:(e-=G)*F-(t-=V)*z+G,y:e*z+t*F+V}},X=Y(o,l),U=Y(o,u),j=Y(s,l),W=Y(s,u);o=Math.min(X.x,U.x,j.x,W.x),s=Math.max(X.x,U.x,j.x,W.x),l=Math.min(X.y,U.y,j.y,W.y),u=Math.max(X.y,U.y,j.y,W.y)}var H=k+"Rot",q=I[H]=I[H]||{};q.x1=o,q.y1=l,q.x2=s,q.y2=u,q.w=s-o,q.h=u-l,Ul(e,o,l,s,u),Ul(i.labelBounds.all,o,l,s,u)}return e}},$l=function(e,t){if(!t.cy().headless()){var n=t.pstyle("outline-opacity").value,r=t.pstyle("outline-width").value;if(n>0&&r>0){var i=t.pstyle("outline-offset").value,a=t.pstyle("shape").value,o=r+i,s=(e.w+2*o)/e.w,l=(e.h+2*o)/e.h,u=0,c=0;["diamond","pentagon","round-triangle"].includes(a)?(s=(e.w+2.4*o)/e.w,c=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(a)?s=(e.w+2.4*o)/e.w:"star"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.6*o)/e.h,c=-o/3.8):"triangle"===a?(s=(e.w+2.8*o)/e.w,l=(e.h+2.4*o)/e.h,c=-o/1.4):"vee"===a&&(s=(e.w+4.4*o)/e.w,l=(e.h+3.8*o)/e.h,c=.5*-o);var h=e.h*l-e.h,d=e.w*s-e.w;if(Wn(e,[Math.ceil(h/2),Math.ceil(d/2)]),0!=u||0!==c){var p=Yn(e,u,c);Xn(e,p)}}}},Kl=function(e,t){var n,r,i,a,o,s,l=e._private.cy,u=l.styleEnabled(),c=l.headless(),h=zn(),d=e._private,p=e.isNode(),g=e.isEdge(),f=d.rstyle,v=p&&u?e.pstyle("bounds-expansion").pfValue:[0],y=function(e){return"none"!==e.pstyle("display").value},m=!u||y(e)&&(!g||y(e.source())&&y(e.target()));if(m){var b=0;u&&t.includeOverlays&&0!==e.pstyle("overlay-opacity").value&&(b=e.pstyle("overlay-padding").value);var x=0;u&&t.includeUnderlays&&0!==e.pstyle("underlay-opacity").value&&(x=e.pstyle("underlay-padding").value);var w=Math.max(b,x),E=0;if(u&&(E=e.pstyle("width").pfValue/2),p&&t.includeNodes){var T=e.position();o=T.x,s=T.y;var _=e.outerWidth()/2,A=e.outerHeight()/2;Ul(h,n=o-_,i=s-A,r=o+_,a=s+A),u&&t.includeOutlines&&$l(h,e)}else if(g&&t.includeEdges)if(u&&!c){var C=e.pstyle("curve-style").strValue;if(n=Math.min(f.srcX,f.midX,f.tgtX),r=Math.max(f.srcX,f.midX,f.tgtX),i=Math.min(f.srcY,f.midY,f.tgtY),a=Math.max(f.srcY,f.midY,f.tgtY),Ul(h,n-=E,i-=E,r+=E,a+=E),"haystack"===C){var D=f.haystackPts;if(D&&2===D.length){if(n=D[0].x,i=D[0].y,n>(r=D[1].x)){var N=n;n=r,r=N}if(i>(a=D[1].y)){var S=i;i=a,a=S}Ul(h,n-E,i-E,r+E,a+E)}}else if("bezier"===C||"unbundled-bezier"===C||C.endsWith("segments")||C.endsWith("taxi")){var L;switch(C){case"bezier":case"unbundled-bezier":L=f.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":L=f.linePts}if(null!=L)for(var P=0;P(r=M.x)){var R=n;n=r,r=R}if((i=I.y)>(a=M.y)){var O=i;i=a,a=O}Ul(h,n-=E,i-=E,r+=E,a+=E)}if(u&&t.includeEdges&&g&&(Hl(h,e,"mid-source"),Hl(h,e,"mid-target"),Hl(h,e,"source"),Hl(h,e,"target")),u&&"yes"===e.pstyle("ghost").value){var B=e.pstyle("ghost-offset-x").pfValue,F=e.pstyle("ghost-offset-y").pfValue;Ul(h,h.x1+B,h.y1+F,h.x2+B,h.y2+F)}var z=d.bodyBounds=d.bodyBounds||{};Hn(z,h),Wn(z,v),jn(z,1),u&&(n=h.x1,r=h.x2,i=h.y1,a=h.y2,Ul(h,n-w,i-w,r+w,a+w));var G=d.overlayBounds=d.overlayBounds||{};Hn(G,h),Wn(G,v),jn(G,1);var V=d.labelBounds=d.labelBounds||{};null!=V.all?Vn(V.all):V.all=zn(),u&&t.includeLabels&&(t.includeMainLabels&&ql(h,e,null),g&&(t.includeSourceLabels&&ql(h,e,"source"),t.includeTargetLabels&&ql(h,e,"target")))}return h.x1=Xl(h.x1),h.y1=Xl(h.y1),h.x2=Xl(h.x2),h.y2=Xl(h.y2),h.w=Xl(h.x2-h.x1),h.h=Xl(h.y2-h.y1),h.w>0&&h.h>0&&m&&(Wn(h,v),jn(h,1)),h},Zl=function(e){var t=0,n=function(e){return(e?1:0)<0&&void 0!==arguments[0]?arguments[0]:Eu,t=arguments.length>1?arguments[1]:void 0,n=0;n=0;s--)o(s);return this},_u.removeAllListeners=function(){return this.removeListener("*")},_u.emit=_u.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,ne(t)||(t=[t]),Du(this,(function(e,a){null!=n&&(r=[{event:a.event,type:a.type,namespace:a.namespace,callback:n}],i=r.length);for(var o=function(){var n=r[s];if(n.type===a.type&&(!n.namespace||n.namespace===a.namespace||n.namespace===bu)&&e.eventMatches(e.context,n,a)){var i=[a];null!=t&&Vt(i,t),e.beforeEmit(e.context,n,a),n.conf&&n.conf.one&&(e.listeners=e.listeners.filter((function(e){return e!==n})));var o=e.callbackContext(e.context,n,a),l=n.callback.apply(o,i);e.afterEmit(e.context,n,a),!1===l&&(a.stopPropagation(),a.preventDefault())}},s=0;s1&&!r){var i=this.length-1,a=this[i],o=a._private.data.id;this[i]=void 0,this[e]=a,n.set(o,{ele:a,index:e})}return this.length--,this}, +// remove single ele in place in calling collection +unmergeOne:function(e){e=e[0];var t=this._private,n=e._private.data.id,r=t.map.get(n);if(!r)return this;var i=r.index;return this.unmergeAt(i),this}, +// remove eles in place on calling collection +unmerge:function(e){var t=this._private.cy;if(!e)return this;if(e&&ee(e)){var n=e;e=t.mutableElements().filter(n)}for(var r=0;r=0;t--)e(this[t])&&this.unmergeAt(t);return this},map:function(e,t){for(var n=[],r=this,i=0;ir&&(r=s,n=o)}return{value:r,ele:n}},min:function(e,t){for(var n,r=1/0,i=this,a=0;a=0&&i1&&void 0!==arguments[1])||arguments[1],n=this[0],r=n.cy();if(r.styleEnabled()&&n){n._private.styleDirty&&(n._private.styleDirty=!1,r.style().apply(n));var i=n._private.style[e];return null!=i?i:t?r.style().getDefaultProperty(e):null}},numericStyle:function(e){var t=this[0];if(t.cy().styleEnabled()&&t){var n=t.pstyle(e);return void 0!==n.pfValue?n.pfValue:n.value}},numericStyleUnits:function(e){var t=this[0];if(t.cy().styleEnabled())return t?t.pstyle(e).units:void 0}, +// get the specified css property as a rendered value (i.e. on-screen value) +// or get the whole rendered style if no property specified (NB doesn't allow setting) +renderedStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=this[0];return n?t.style().getRenderedStyle(n,e):void 0}, +// read the calculated css style of the element or override the style (via a bypass) +style:function(e,t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style();if(re(e)){var a=e;i.applyBypass(this,a,r),this.emitAndNotify("style")}else if(ee(e)){if(void 0===t){var o=this[0];return o?i.getStylePropertyValue(o,e):void 0}i.applyBypass(this,e,t,r),this.emitAndNotify("style")}else if(void 0===e){var s=this[0];return s?i.getRawStyle(s):void 0}return this},removeStyle:function(e){var t=this.cy();if(!t.styleEnabled())return this;var n=!1,r=t.style(),i=this;if(void 0===e)for(var a=0;a outgoing nodes +outgoers:Cl(tc({outgoing:!0}),"outgoers"), +// aka DAG descendants +successors:nc({outgoing:!0}), +// normally called parents in graph theory +// these nodes <=edges= incoming nodes +incomers:Cl(tc({incoming:!0}),"incomers"), +// aka DAG ancestors +predecessors:nc({})}),Ie(Ju,{neighborhood:Cl((function(e){for(var t=[],n=this.nodes(),r=0;r0&&t.push(c[0]),t.push(s[0])}return this.spawn(t,!0).filter(e)}),"neighborhood"),closedNeighborhood:function(e){return this.neighborhood().add(this).filter(e)},openNeighborhood:function(e){return this.neighborhood(e)}}),Ju.neighbourhood=Ju.neighborhood,Ju.closedNeighbourhood=Ju.closedNeighborhood,Ju.openNeighbourhood=Ju.openNeighborhood,Ie(Ju,{source:Cl((function(e){var t,n=this[0];return n&&(t=n._private.source||n.cy().collection()),t&&e?t.filter(e):t}),"source"),target:Cl((function(e){var t,n=this[0];return n&&(t=n._private.target||n.cy().collection()),t&&e?t.filter(e):t}),"target"),sources:rc({attr:"source"}),targets:rc({attr:"target"})}),Ie(Ju,{edgesWith:Cl(ic(),"edgesWith"),edgesTo:Cl(ic({thisIsSrc:!0}),"edgesTo")}),Ie(Ju,{connectedEdges:Cl((function(e){for(var t=[],n=this,r=0;r0);return a},component:function(){var e=this[0];return e.cy().mutableElements().components(e)[0]}}),Ju.componentsOf=Ju.components;var oc=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(void 0!==e){var i=new jt,a=!1;if(t){if(t.length>0&&re(t[0])&&!ue(t[0])){a=!0;for(var o=[],s=new qt,l=0,u=t.length;l0&&void 0!==arguments[0])||arguments[0],r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this,a=i.cy(),o=a._private,s=[],l=[],u=0,c=i.length;u0){for(var M=e.length===i.length?i:new oc(a,e),R=0;R0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this,r=[],i={},a=n._private.cy;function o(e){for(var t=e._private.edges,n=0;n0&&(e?A.emitAndNotify("remove"):t&&A.emit("remove"));for(var C=0;C0?i=l:r=l}while(Math.abs(a)>o&&++u=a?m(t,s):0===c?s:x(t,r,r+u)}var E=!1;function T(){E=!0,e===t&&n===r||b()}var _=function(i){return E||T(),e===t&&n===r?i:0===i?0:1===i?1:v(w(i),t,r)};_.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var A="generateBezier("+[e,t,n,r]+")";return _.toString=function(){return A},_} +/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var cc=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t,n,r){var i={x:t.x+r.dx*n,v:t.v+r.dv*n,tension:t.tension,friction:t.friction};return{dx:i.v,dv:e(i)}}function n(n,r){var i={dx:n.v,dv:e(n)},a=t(n,.5*r,i),o=t(n,.5*r,a),s=t(n,r,o),l=1/6*(i.dx+2*(a.dx+o.dx)+s.dx),u=1/6*(i.dv+2*(a.dv+o.dv)+s.dv);return n.x=n.x+l*r,n.v=n.v+u*r,n}return function e(t,r,i){var a,o,s,l={x:-1,v:0,tension:null,friction:null},u=[0],c=0,h=1e-4,d=.016;for(t=parseFloat(t)||500,r=parseFloat(r)||20,i=i||null,l.tension=t,l.friction=r,o=(a=null!==i)?(c=e(t,r))/i*d:d;s=n(s||l,o),u.push(1+s.x),c+=16,Math.abs(s.x)>h&&Math.abs(s.v)>h;);return a?function(e){return u[e*(u.length-1)|0]}:c}}(),hc=function(e,t,n,r){var i=uc(e,t,n,r);return function(e,t,n){return e+(t-e)*i(n)}},dc={linear:function(e,t,n){return e+(t-e)*n}, +// default easings +ease:hc(.25,.1,.25,1),"ease-in":hc(.42,0,1,1),"ease-out":hc(0,0,.58,1),"ease-in-out":hc(.42,0,.58,1), +// sine +"ease-in-sine":hc(.47,0,.745,.715),"ease-out-sine":hc(.39,.575,.565,1),"ease-in-out-sine":hc(.445,.05,.55,.95), +// quad +"ease-in-quad":hc(.55,.085,.68,.53),"ease-out-quad":hc(.25,.46,.45,.94),"ease-in-out-quad":hc(.455,.03,.515,.955), +// cubic +"ease-in-cubic":hc(.55,.055,.675,.19),"ease-out-cubic":hc(.215,.61,.355,1),"ease-in-out-cubic":hc(.645,.045,.355,1), +// quart +"ease-in-quart":hc(.895,.03,.685,.22),"ease-out-quart":hc(.165,.84,.44,1),"ease-in-out-quart":hc(.77,0,.175,1), +// quint +"ease-in-quint":hc(.755,.05,.855,.06),"ease-out-quint":hc(.23,1,.32,1),"ease-in-out-quint":hc(.86,0,.07,1), +// expo +"ease-in-expo":hc(.95,.05,.795,.035),"ease-out-expo":hc(.19,1,.22,1),"ease-in-out-expo":hc(1,0,0,1), +// circ +"ease-in-circ":hc(.6,.04,.98,.335),"ease-out-circ":hc(.075,.82,.165,1),"ease-in-out-circ":hc(.785,.135,.15,.86), +// user param easings... +spring:function(e,t,n){if(0===n)return dc.linear;var r=cc(e,t,n);return function(e,t,n){return e+(t-e)*r(n)}},"cubic-bezier":hc};function pc(e,t,n,r,i){if(1===r)return n;if(t===n)return n;var a=i(t,n,r);return null==e||((e.roundValue||e.color)&&(a=Math.round(a)),void 0!==e.min&&(a=Math.max(a,e.min)),void 0!==e.max&&(a=Math.min(a,e.max))),a}function gc(e,t){return null!=e.pfValue||null!=e.value?null==e.pfValue||null!=t&&"%"===t.type.units?e.value:e.pfValue:e}function fc(e,t,n,r,i){var a=null!=i?i.type:null;n<0?n=0:n>1&&(n=1);var o=gc(e,i),s=gc(t,i);if(ae(o)&&ae(s))return pc(a,o,s,n,r);if(ne(o)&&ne(s)){for(var l=[],u=0;u0?("spring"===h&&d.push(o.duration),o.easingImpl=dc[h].apply(null,d)):o.easingImpl=dc[h]}var p,g=o.easingImpl;if(p=0===o.duration?1:(n-l)/o.duration,o.applying&&(p=o.progress),p<0?p=0:p>1&&(p=1),null==o.delay){var f=o.startPosition,v=o.position;if(v&&i&&!e.locked()){var y={};yc(f.x,v.x)&&(y.x=fc(f.x,v.x,p,g)),yc(f.y,v.y)&&(y.y=fc(f.y,v.y,p,g)),e.position(y)}var m=o.startPan,b=o.pan,x=a.pan,w=null!=b&&r;w&&(yc(m.x,b.x)&&(x.x=fc(m.x,b.x,p,g)),yc(m.y,b.y)&&(x.y=fc(m.y,b.y,p,g)),e.emit("pan"));var E=o.startZoom,T=o.zoom,_=null!=T&&r;_&&(yc(E,T)&&(a.zoom=Fn(a.minZoom,fc(E,T,p,g),a.maxZoom)),e.emit("zoom")),(w||_)&&e.emit("viewport");var A=o.style;if(A&&A.length>0&&i){for(var C=0;C=0;t--)(0,e[t])();e.splice(0,e.length)},c=a.length-1;c>=0;c--){var h=a[c],d=h._private;d.stopped?(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.frames)):(d.playing||d.applying)&&(d.playing&&d.applying&&(d.applying=!1),d.started||mc(t,h,e),vc(t,h,e,n),d.applying&&(d.applying=!1),u(d.frames),null!=d.step&&d.step(e),h.completed()&&(a.splice(c,1),d.hooked=!1,d.playing=!1,d.started=!1,u(d.completes)),s=!0)}return n||0!==a.length||0!==o.length||r.push(t),s}for(var a=!1,o=0;o0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var xc={ +// pull in animation functions +animate:Zs.animate(),animation:Zs.animation(),animated:Zs.animated(),clearQueue:Zs.clearQueue(),delay:Zs.delay(),delayAnimation:Zs.delayAnimation(),stop:Zs.stop(),addToAnimationPool:function(e){var t=this;t.styleEnabled()&&t._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){bc(n,e)}),t.beforeRenderPriorities.animations):n()}function n(){e._private.animationsRunning&<((function(t){bc(t,e),n()}))}}},wc={qualifierCompare:function(e,t){return null==e||null==t?null==e&&null==t:e.sameText(t)},eventMatches:function(e,t,n){var r=t.qualifier;return null==r||e!==n.target&&ue(n.target)&&r.matches(n.target)},addEventFields:function(e,t){t.cy=e,t.target=e},callbackContext:function(e,t,n){return null!=t.qualifier?n.target:e}},Ec=function(e){return ee(e)?new wl(e):e},Tc={createEmitter:function(){var e=this._private;return e.emitter||(e.emitter=new Tu(wc,this)),this},emitter:function(){return this._private.emitter},on:function(e,t,n){return this.emitter().on(e,Ec(t),n),this},removeListener:function(e,t,n){return this.emitter().removeListener(e,Ec(t),n),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(e,t,n){return this.emitter().one(e,Ec(t),n),this},once:function(e,t,n){return this.emitter().one(e,Ec(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}};Zs.eventAliasesOn(Tc);var _c={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)}};_c.jpeg=_c.jpg;var Ac={layout:function(e){var t=this;if(null!=e)if(null!=e.name){var n,r=e.name,i=t.extension("layout",r);if(null!=i)return n=ee(e.eles)?t.$(e.eles):null!=e.eles?e.eles:t.$(),new i(Ie({},e,{cy:t,eles:n}));St("No such layout `"+r+"` found. Did you forget to import it and `cytoscape.use()` it?")}else St("A `name` must be specified to make a layout");else St("Layout options must be specified to make a layout")}};Ac.createLayout=Ac.makeLayout=Ac.layout;var Cc={notify:function(e,t){var n=this._private;if(this.batching()){n.batchNotifications=n.batchNotifications||{};var r=n.batchNotifications[e]=n.batchNotifications[e]||this.collection();null!=t&&r.merge(t)}else if(n.notificationsEnabled){var i=this.renderer();!this.destroyed()&&i&&i.notify(e,t)}},notifications:function(e){var t=this._private;return void 0===e?t.notificationsEnabled:(t.notificationsEnabled=!!e,this)},noNotifications:function(e){this.notifications(!1),e(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var e=this._private;return null==e.batchCount&&(e.batchCount=0),0===e.batchCount&&(e.batchStyleEles=this.collection(),e.batchNotifications={}),e.batchCount++,this},endBatch:function(){var e=this._private;if(0===e.batchCount)return this;if(e.batchCount--,0===e.batchCount){e.batchStyleEles.updateStyle();var t=this.renderer();Object.keys(e.batchNotifications).forEach((function(n){var r=e.batchNotifications[n];r.empty()?t.notify(n):t.notify(n,r)}))}return this},batch:function(e){return this.startBatch(),e(),this.endBatch(),this}, +// for backwards compatibility +batchData:function(e){var t=this;return this.batch((function(){for(var n=Object.keys(e),r=0;r0;)t.removeChild(t.childNodes[0]);e._private.renderer=null,e.mutableElements().forEach((function(e){var t=e._private;t.rscratch={},t.rstyle={},t.animation.current=[],t.animation.queue=[]}))},onRender:function(e){return this.on("render",e)},offRender:function(e){return this.off("render",e)}};Nc.invalidateDimensions=Nc.resize;var Sc={ +// get a collection +// - empty collection on no args +// - collection of elements in the graph on selector arg +// - guarantee a returned collection when elements or collection specified +collection:function(e,t){return ee(e)?this.$(e):le(e)?e.collection():ne(e)?(t||(t={}),new oc(this,e,t.unique,t.removed)):new oc(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}, +// search the graph like jQuery +$:function(e){var t=this._private.elements;return e?t.filter(e):t.spawnSelf()},mutableElements:function(){return this._private.elements}};Sc.elements=Sc.filter=Sc.$;var Lc={},Pc="t",kc="f";Lc.apply=function(e){for(var t=this,n=t._private.cy.collection(),r=0;r0;if(d||h&&p){var g=void 0;d&&p||d?g=u.properties:p&&(g=u.mappedProperties);for(var f=0;f1&&(v=1),s.color){var w=i.valueMin[0],E=i.valueMax[0],T=i.valueMin[1],_=i.valueMax[1],A=i.valueMin[2],C=i.valueMax[2],D=null==i.valueMin[3]?1:i.valueMin[3],N=null==i.valueMax[3]?1:i.valueMax[3],S=[Math.round(w+(E-w)*v),Math.round(T+(_-T)*v),Math.round(A+(C-A)*v),Math.round(D+(N-D)*v)];n={ +// colours are simple, so just create the flat property instead of expensive string parsing +bypass:i.bypass, +// we're a bypass if the mapping property is a bypass +name:i.name,value:S,strValue:"rgb("+S[0]+", "+S[1]+", "+S[2]+")"}}else{if(!s.number)return!1;var L=i.valueMin+(i.valueMax-i.valueMin)*v;n=this.parse(i.name,L,i.bypass,d)}if(!n)return f(),!1;n.mapping=i,i=n;break; +// direct mapping +case o.data:for(var P=i.field.split("."),k=h.data,I=0;I0&&a>0){for(var s={},l=!1,u=0;u0?e.delayAnimation(o).play().promise().then(t):t()})).then((function(){return e.animation({style:s,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()})).then((function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1}))}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},Lc.checkTrigger=function(e,t,n,r,i,a){var o=this.properties[t],s=i(o);e.removed()||null!=s&&s(n,r,e)&&a(o)},Lc.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,(function(e){return e.triggersZOrder}),(function(){i._private.cy.notify("zorder",e)}))},Lc.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBounds}),(function(t){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()}))},Lc.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBoundsOfConnectedEdges}),(function(t){e.connectedEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Lc.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,(function(e){return e.triggersBoundsOfParallelEdges}),(function(t){e.parallelEdges().forEach((function(e){e.dirtyBoundingBoxCache()}))}))},Lc.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var Ic={applyBypass:function(e,t,n,r){var i=this,a=[],o=!0;if("*"===t||"**"===t){if(void 0!==n)for(var s=0;st.length?o.substr(t.length):""}function l(){n=n.length>r.length?n.substr(r.length):""}for(o=o.replace(/[/][*](\s|.)+?[*][/]/g,"");!o.match(/^\s*$/);){var u=o.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!u){Pt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+o);break}t=u[0];var c=u[1];if("core"!==c&&new wl(c).invalid)Pt("Skipping parsing of block: Invalid selector found in string stylesheet: "+c),s();else{var h=u[2],d=!1;n=h;for(var p=[];!n.match(/^\s*$/);){var g=n.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!g){Pt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),d=!0;break}r=g[0];var f=g[1],v=g[2];i.properties[f]?a.parse(f,v)?(p.push({name:f,val:v}),l()):(Pt("Skipping property: Invalid property definition in: "+r),l()):(Pt("Skipping property: Invalid property name in: "+r),l())}if(d){s();break}a.selector(c);for(var y=0;y=7&&"d"===t[0]&&(u=new RegExp(s.data.regex).exec(t))){if(n)return!1;var d=s.data;return{name:e,value:u,strValue:""+t,mapped:d,field:u[1],bypass:n}}if(t.length>=10&&"m"===t[0]&&(c=new RegExp(s.mapData.regex).exec(t))){if(n)return!1;if(h.multiple)return!1;var p=s.mapData;if(!h.color&&!h.number)return!1;var g=this.parse(e,c[4]);if(!g||g.mapped)return!1;var f=this.parse(e,c[5]);if(!f||f.mapped)return!1;if(g.pfValue===f.pfValue||g.strValue===f.strValue)return Pt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(h.color){var v=g.value,y=f.value;if(!(v[0]!==y[0]||v[1]!==y[1]||v[2]!==y[2]||// optional alpha +v[3]!==y[3]&&(null!=v[3]&&1!==v[3]||null!=y[3]&&1!==y[3])))return!1}return{name:e,value:c,strValue:""+t,mapped:p,field:c[1],fieldMin:parseFloat(c[2]), +// min & max are numeric +fieldMax:parseFloat(c[3]),valueMin:g.value,valueMax:f.value,bypass:n}}}if(h.multiple&&"multiple"!==r){var m;if(m=l?t.split(/\s+/):ne(t)?t:[t],h.evenMultiple&&m.length%2!=0)return null;for(var b=[],x=[],w=[],E="",T=!1,_=0;_0?" ":"")+A.strValue}return h.validate&&!h.validate(b,x)?null:h.singleEnum&&T?1===b.length&&ee(b[0])?{name:e,value:b[0],strValue:b[0],bypass:n}:null:{name:e,value:b,pfValue:w,strValue:E,bypass:n,units:x}}var C=function(){for(var r=0;rh.max||h.strictMax&&t===h.max))return null;var P={name:e,value:t,strValue:""+t+(D||""),units:D,bypass:n};return h.unitless||"px"!==D&&"em"!==D?P.pfValue=t:P.pfValue="px"!==D&&D?this.getEmSizeInPixels()*t:t,"ms"!==D&&"s"!==D||(P.pfValue="ms"===D?t:1e3*t),"deg"!==D&&"rad"!==D||(P.pfValue="rad"===D?t:Nn(t)),"%"===D&&(P.pfValue=t/100),P}if(h.propList){var k=[],I=""+t;if("none"===I);else{for(var M=I.split(/\s*,\s*|\s+/),R=0;R recalc ele mappers +updateStyle:function(){this.mutableElements().updateStyle()}},Xc="single",Uc={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=Xc),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,r,i,a=arguments,o=this._private.pan;switch(a.length){case 0:return o;case 1:if(ee(a[0]))return o[e=a[0]];if(re(a[0])){if(!this._private.panningEnabled)return this;r=(n=a[0]).x,i=n.y,ae(r)&&(o.x=r),ae(i)&&(o.y=i),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;e=a[0],t=a[1],"x"!==e&&"y"!==e||!ae(t)||(o[e]=t),this.emit("pan viewport")}return this.notify("viewport"),this},panBy:function(e,t){var n,r,i,a,o,s=arguments,l=this._private.pan;if(!this._private.panningEnabled)return this;switch(s.length){case 1:re(e)&&(a=(i=s[0]).x,o=i.y,ae(a)&&(l.x+=a),ae(o)&&(l.y+=o),this.emit("pan viewport"));break;case 2:r=t,"x"!==(n=e)&&"y"!==n||!ae(r)||(l[n]+=r),this.emit("pan viewport")}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(e,t){var n=this.getFitViewport(e,t);if(n){var r=this._private;r.zoom=n.zoom,r.pan=n.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(e,t){if(ae(e)&&void 0===t&&(t=e,e=void 0),this._private.panningEnabled&&this._private.zoomingEnabled){var n;if(ee(e)){var r=e;e=this.$(r)}else if(ve(e)){var i=e;(n={x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2}).w=n.x2-n.x1,n.h=n.y2-n.y1}else le(e)||(e=this.mutableElements());if(!le(e)||!e.empty()){n=n||e.boundingBox();var a,o=this.width(),s=this.height();if(t=ae(t)?t:0,!isNaN(o)&&!isNaN(s)&&o>0&&s>0&&!isNaN(n.w)&&!isNaN(n.h)&&n.w>0&&n.h>0)return{zoom:a=(a=(a=Math.min((o-2*t)/n.w,(s-2*t)/n.h))>this._private.maxZoom?this._private.maxZoom:a)=n.minZoom&&(n.maxZoom=t),this},minZoom:function(e){return void 0===e?this._private.minZoom:this.zoomRange({min:e})},maxZoom:function(e){return void 0===e?this._private.maxZoom:this.zoomRange({max:e})},getZoomedViewport:function(e){var t,n,r=this._private,i=r.pan,a=r.zoom,o=!1;if(r.zoomingEnabled||(o=!0),ae(e)?n=e:re(e)&&(n=e.level,null!=e.position?t=wn(e.position,a,i):null!=e.renderedPosition&&(t=e.renderedPosition),null==t||r.panningEnabled||(o=!0)),n=(n=n>r.maxZoom?r.maxZoom:n)t.maxZoom||!t.zoomingEnabled?a=!0:(t.zoom=s,i.push("zoom"))}if(r&&(!a||!e.cancelOnFailedZoom)&&t.panningEnabled){var l=e.pan;ae(l.x)&&(t.pan.x=l.x,o=!1),ae(l.y)&&(t.pan.y=l.y,o=!1),o||i.push("pan")}return i.length>0&&(i.push("viewport"),this.emit(i.join(" ")),this.notify("viewport")),this},center:function(e){var t=this.getCenterPan(e);return t&&(this._private.pan=t,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(e,t){if(this._private.panningEnabled){if(ee(e)){var n=e;e=this.mutableElements().filter(n)}else le(e)||(e=this.mutableElements());if(0!==e.length){var r=e.boundingBox(),i=this.width(),a=this.height();return{ +// middle +x:(i-(t=void 0===t?this._private.zoom:t)*(r.x1+r.x2))/2,y:(a-t*(r.y1+r.y2))/2}}}},reset:function(){return this._private.panningEnabled&&this._private.zoomingEnabled?(this.viewport({pan:{x:0,y:0},zoom:1}),this):this},invalidateSize:function(){this._private.sizeCache=null},size:function(){var e,t,n=this._private,r=n.container,i=this;return n.sizeCache=n.sizeCache||(r?(e=i.window().getComputedStyle(r),t=function(t){return parseFloat(e.getPropertyValue(t))},{width:r.clientWidth-t("padding-left")-t("padding-right"),height:r.clientHeight-t("padding-top")-t("padding-bottom")}):{ +// fallback if no container (not 0 b/c can be used for dividing etc) +width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var e=this._private.pan,t=this._private.zoom,n=this.renderedExtent(),r={x1:(n.x1-e.x)/t,x2:(n.x2-e.x)/t,y1:(n.y1-e.y)/t,y2:(n.y2-e.y)/t};return r.w=r.x2-r.x1,r.h=r.y2-r.y1,r},renderedExtent:function(){var e=this.width(),t=this.height();return{x1:0,y1:0,x2:e,y2:t,w:e,h:t}},multiClickDebounceTime:function(e){return e?(this._private.multiClickDebounceTime=e,this):this._private.multiClickDebounceTime}};Uc.centre=Uc.center,Uc.autolockNodes=Uc.autolock,Uc.autoungrabifyNodes=Uc.autoungrabify;var jc={data:Zs.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:Zs.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:Zs.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:Zs.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};jc.attr=jc.data,jc.removeAttr=jc.removeData;var Wc=function(e){var t=this,n=(e=Ie({},e)).container;n&&!se(n)&&se(n[0])&&(n=n[0]);var r=n?n._cyreg:null;(r=r||{})&&r.cy&&(r.cy.destroy(),r={});var i=r.readies=r.readies||[];n&&(n._cyreg=r),r.cy=t;var a=void 0!==b&&void 0!==n&&!e.headless,o=e;o.layout=Ie({name:a?"grid":"null"},o.layout),o.renderer=Ie({name:a?"canvas":"null"},o.renderer);var s=function(e,t,n){return void 0!==t?t:void 0!==n?n:e},l=this._private={container:n, +// html dom ele container +ready:!1, +// whether ready has been triggered +options:o, +// cached options +elements:new oc(this), +// elements in the graph +listeners:[], +// list of listeners +aniEles:new oc(this), +// elements being animated +data:o.data||{}, +// data for the core +scratch:{}, +// scratch object for core +layout:null,renderer:null,destroyed:!1, +// whether destroy was called +notificationsEnabled:!0, +// whether notifications are sent to the renderer +minZoom:1e-50,maxZoom:1e50,zoomingEnabled:s(!0,o.zoomingEnabled),userZoomingEnabled:s(!0,o.userZoomingEnabled),panningEnabled:s(!0,o.panningEnabled),userPanningEnabled:s(!0,o.userPanningEnabled),boxSelectionEnabled:s(!0,o.boxSelectionEnabled),autolock:s(!1,o.autolock,o.autolockNodes),autoungrabify:s(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:s(!1,o.autounselectify),styleEnabled:void 0===o.styleEnabled?a:o.styleEnabled,zoom:ae(o.zoom)?o.zoom:1,pan:{x:re(o.pan)&&ae(o.pan.x)?o.pan.x:0,y:re(o.pan)&&ae(o.pan.y)?o.pan.y:0},animation:{ +// object for currently-running animations +current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:s(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var u=function(e,t){if(e.some(ye))return Zi.all(e).then(t);t(e)};l.styleEnabled&&t.setStyle([]);var c=Ie({},o,o.renderer);t.initRenderer(c);var h=function(e,n,r){t.notifications(!1);var i=t.mutableElements();i.length>0&&i.remove(),null!=e&&(re(e)||ne(e))&&t.add(e),t.one("layoutready",(function(e){t.notifications(!0),t.emit(e),t.one("load",n),t.emitAndNotify("load")})).one("layoutstop",(function(){t.one("done",r),t.emit("done")}));var a=Ie({},t._private.options.layout);a.eles=t.elements(),t.layout(a).run()};u([o.style,o.elements],(function(e){var n=e[0],a=e[1];l.styleEnabled&&t.style().append(n),h(a,(function(){t.startAnimationLoop(),l.ready=!0,te(o.ready)&&t.on("ready",o.ready);for(var e=0;e more space between nodes (N.B. n/a if causes overlap) +boundingBox:void 0, +// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } +avoidOverlap:!0, +// prevents node overlap, may overflow boundingBox if not enough space +nodeDimensionsIncludeLabels:!1, +// Excludes the label when calculating node bounding boxes for the layout algorithm +roots:void 0, +// the roots of the trees +depthSort:void 0, +// a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } +animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled, +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +},$c={maximal:!1, +// whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also +acyclic:!1},Kc=function(e){return e.scratch("breadthfirst")},Zc=function(e,t){return e.scratch("breadthfirst",t)};function Qc(e){this.options=Ie({},qc,$c,e)}Qc.prototype.run=function(){var e,t=this.options,n=t.cy,r=t.eles,i=r.nodes().filter((function(e){return e.isChildless()})),a=r,o=t.directed,s=t.acyclic||t.maximal||t.maximalAdjustments>0,l=!!t.boundingBox,u=n.extent(),c=zn(l?t.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h});if(le(t.roots))e=t.roots;else if(ne(t.roots)){for(var h=[],d=0;d0;){var P=L(),k=C(P,N);if(k)P.outgoers().filter((function(e){return e.isNode()&&r.has(e)})).forEach(S);else if(null===k){Pt("Detected double maximal shift for node `"+P.id()+"`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs.");break}}}var I=0;if(t.avoidOverlap)for(var M=0;M0&&m[0].length<=3?a/2:0),s=2*Math.PI/m[r].length*i;return 0===r&&1===m[0].length&&(o=1),{x:q.x+o*Math.cos(s),y:q.y+o*Math.sin(s)}}var u=m[r].length,h=Math.max( +// only one depth +1===u?0: +// inside a bounding box, no need for left & right padding +l?(c.w-2*t.padding-$.w)/((t.grid?Z:u)-1):(c.w-2*t.padding-$.w)/((t.grid?Z:u)+1),I);return{x:q.x+(i+1-(u+1)/2)*h,y:q.y+(r+1-(V+1)/2)*K}};return r.nodes().layoutPositions(this,t,Q),this};var Jc={fit:!0, +// whether to fit the viewport to the graph +padding:30, +// the padding on fit +boundingBox:void 0, +// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } +avoidOverlap:!0, +// prevents node overlap, may overflow boundingBox and radius if not enough space +nodeDimensionsIncludeLabels:!1, +// Excludes the label when calculating node bounding boxes for the layout algorithm +spacingFactor:void 0, +// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up +radius:void 0, +// the radius of the circle +startAngle:1.5*Math.PI, +// where nodes start in radians +sweep:void 0, +// how many radians should be between the first and last node (defaults to full circle) +clockwise:!0, +// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) +sort:void 0, +// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } +animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +};function eh(e){this.options=Ie({},Jc,e)}eh.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var o,s=zn(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/a.length:t.sweep)/Math.max(1,a.length-1),c=0,h=0;h1&&t.avoidOverlap){c*=1.75;var f=Math.cos(u)-Math.cos(0),v=Math.sin(u)-Math.sin(0),y=Math.sqrt(c*c/(f*f+v*v));o=Math.max(y,o)}var m=function(e,n){var r=t.startAngle+n*u*(i?1:-1),a=o*Math.cos(r),s=o*Math.sin(r);return{x:l.x+a,y:l.y+s}};return r.nodes().layoutPositions(this,t,m),this};var th,nh={fit:!0, +// whether to fit the viewport to the graph +padding:30, +// the padding on fit +startAngle:1.5*Math.PI, +// where nodes start in radians +sweep:void 0, +// how many radians should be between the first and last node (defaults to full circle) +clockwise:!0, +// whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) +equidistant:!1, +// whether levels have an equal radial distance betwen them, may cause bounding box overflow +minNodeSpacing:10, +// min spacing between outside of nodes (used for radius adjustment) +boundingBox:void 0, +// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } +avoidOverlap:!0, +// prevents node overlap, may overflow boundingBox if not enough space +nodeDimensionsIncludeLabels:!1, +// Excludes the label when calculating node bounding boxes for the layout algorithm +height:void 0, +// height of layout area (overrides container height) +width:void 0, +// width of layout area (overrides container width) +spacingFactor:void 0, +// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up +concentric:function(e){return e.degree()},levelWidth:function(e){return e.maxDegree()/4},animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +};function rh(e){this.options=Ie({},nh,e)}rh.prototype.run=function(){for(var e=this.options,t=e,n=void 0!==t.counterclockwise?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),o=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),s={x:o.x1+o.w/2,y:o.y1+o.h/2},l=[],u=0,c=0;c0&&Math.abs(y[0].value-b.value)>=f&&(y=[],v.push(y)),y.push(b)}var x=u+t.minNodeSpacing;if(!t.avoidOverlap){var w=v.length>0&&v[0].length>1,E=(Math.min(o.w,o.h)/2-x)/(v.length+w?1:0);x=Math.min(x,E)}for(var T=0,_=0;_1&&t.avoidOverlap){var N=Math.cos(D)-Math.cos(0),S=Math.sin(D)-Math.sin(0),L=Math.sqrt(x*x/(N*N+S*S));T=Math.max(L,T)}A.r=T,T+=x}if(t.equidistant){for(var P=0,k=0,I=0;I=e.numIter||(ph(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature=e.animationThreshold&&a(),lt(c)):(Ah(r,e),s())};c()}else{for(;u;)u=o(l),l++;Ah(r,e),s()}return this},ah.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},ah.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var oh,sh=function(e,t,n){for(var r=n.eles.edges(),i=n.eles.nodes(),a=zn(n.boundingBox?n.boundingBox:{x1:0,y1:0,w:e.width(),h:e.height()}),o={isCompound:e.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:i.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:r.size(),temperature:n.initialTemp,clientWidth:a.w,clientHeight:a.h,boundingBox:a},s=n.eles.components(),l={},u=0;u0)for(o.graphSet.push(w),u=0;ur.count?0:r.graph},uh=function(e,t,n,r){var i=r.graphSet[n];if(-10)var l=(c=r.nodeOverlap*s)*i/(v=Math.sqrt(i*i+a*a)),u=c*a/v;else{var c,h=mh(e,i,a),d=mh(t,-1*i,-1*a),p=d.x-h.x,g=d.y-h.y,f=p*p+g*g,v=Math.sqrt(f);l=(c=(e.nodeRepulsion+t.nodeRepulsion)/f)*p/v,u=c*g/v}e.isLocked||(e.offsetX-=l,e.offsetY-=u),t.isLocked||(t.offsetX+=l,t.offsetY+=u)}},yh=function(e,t,n,r){if(n>0)var i=e.maxX-t.minX;else i=t.maxX-e.minX;if(r>0)var a=e.maxY-t.minY;else a=t.maxY-e.minY;return i>=0&&a>=0?Math.sqrt(i*i+a*a):0},mh=function(e,t,n){var r=e.positionX,i=e.positionY,a=e.height||1,o=e.width||1,s=n/t,l=a/o,u={};return 0===t&&0n?(u.x=r,u.y=i+a/2,u):0t&&-1*l<=s&&s<=l?(u.x=r-o/2,u.y=i-o*n/2/t,u):0=l)?(u.x=r+a*t/2/n,u.y=i+a/2,u):0>n&&(s<=-1*l||s>=l)?(u.x=r-a*t/2/n,u.y=i-a/2,u):u},bh=function(e,t){for(var n=0;nn){var f=t.gravity*d/g,v=t.gravity*p/g;h.offsetX+=f,h.offsetY+=v}}}}},wh=function(e,t){var n=[],r=0,i=-1;for(n.push.apply(n,e.graphSet[0]),i+=e.graphSet[0].length;r<=i;){var a=n[r++],o=e.idToIndex[a],s=e.layoutNodes[o],l=s.children;if(0n)var i={x:n*e/r,y:n*t/r};else i={x:e,y:t};return i},_h=function(e,t){var n=e.parentId;if(null!=n){var r=t.layoutNodes[t.idToIndex[n]],i=!1;return(null==r.maxX||e.maxX+r.padRight>r.maxX)&&(r.maxX=e.maxX+r.padRight,i=!0),(null==r.minX||e.minX-r.padLeftr.maxY)&&(r.maxY=e.maxY+r.padBottom,i=!0),(null==r.minY||e.minY-r.padTopg&&(h+=p+t.componentSpacing,c=0,d=0,p=0)}}},Ch={fit:!0, +// whether to fit the viewport to the graph +padding:30, +// padding used on fit +boundingBox:void 0, +// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } +avoidOverlap:!0, +// prevents node overlap, may overflow boundingBox if not enough space +avoidOverlapPadding:10, +// extra spacing around nodes when avoidOverlap: true +nodeDimensionsIncludeLabels:!1, +// Excludes the label when calculating node bounding boxes for the layout algorithm +spacingFactor:void 0, +// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up +condense:!1, +// uses all available space on false, uses minimal space on true +rows:void 0, +// force num of rows in the grid +cols:void 0, +// force num of columns in the grid +position:function(e){}, +// returns { row, col } for element +sort:void 0, +// a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } +animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +};function Dh(e){this.options=Ie({},Ch,e)}Dh.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=zn(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(0===a.h||0===a.w)r.nodes().layoutPositions(this,t,(function(e){return{x:a.x1,y:a.y1}}));else{var o=i.size(),s=Math.sqrt(o*a.h/a.w),l=Math.round(s),u=Math.round(a.w/a.h*s),c=function(e){if(null==e)return Math.min(l,u);Math.min(l,u)==l?l=e:u=e},h=function(e){if(null==e)return Math.max(l,u);Math.max(l,u)==l?l=e:u=e},d=t.rows,p=null!=t.cols?t.cols:t.columns;if(null!=d&&null!=p)l=d,u=p;else if(null!=d&&null==p)l=d,u=Math.ceil(o/l);else if(null==d&&null!=p)u=p,l=Math.ceil(o/u);else if(u*l>o){var g=c(),f=h();(g-1)*f>=o?c(g-1):(f-1)*g>=o&&h(f-1)}else for(;u*l=o?h(y+1):c(v+1)}var m=a.w/u,b=a.h/l;if(t.condense&&(m=0,b=0),t.avoidOverlap)for(var x=0;x=u&&(P=0,L++)},I={},M=0;M (position obj); or function(node){ return somPos; } +zoom:void 0, +// the zoom level to set (prob want fit = false if set) +pan:void 0, +// the pan level to set (prob want fit = false if set) +fit:!0, +// whether to fit to viewport +padding:30, +// padding on fit +spacingFactor:void 0, +// Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up +animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +};function Ph(e){this.options=Ie({},Lh,e)}Ph.prototype.run=function(){var e=this.options,t=e.eles.nodes(),n=te(e.positions);function r(t){if(null==e.positions)return xn(t.position());if(n)return e.positions(t);var r=e.positions[t._private.data.id];return null==r?null:r}return t.layoutPositions(this,e,(function(e,t){var n=r(e);return!e.locked()&&null!=n&&n})),this};var kh={fit:!0, +// whether to fit to viewport +padding:30, +// fit padding +boundingBox:void 0, +// constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } +animate:!1, +// whether to transition the node positions +animationDuration:500, +// duration of animation in ms if enabled +animationEasing:void 0, +// easing of animation if enabled +animateFilter:function(e,t){return!0}, +// a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts +ready:void 0, +// callback on layoutready +stop:void 0, +// callback on layoutstop +transform:function(e,t){return t} +// transform a given node position. Useful for changing flow direction in discrete layouts +};function Ih(e){this.options=Ie({},kh,e)}Ih.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=zn(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(e,t){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,i),this};var Mh=[{name:"breadthfirst",impl:Qc},{name:"circle",impl:eh},{name:"concentric",impl:rh},{name:"cose",impl:ah},{name:"grid",impl:Dh},{name:"null",impl:Sh},{name:"preset",impl:Ph},{name:"random",impl:Ih}];function Rh(e){this.options=e,this.notifications=0}var Oh=function(){},Bh=function(){throw new Error("A headless instance can not render images")};Rh.prototype={recalculateRenderedStyle:Oh,notify:function(){this.notifications++},init:Oh,isHeadless:function(){return!0},png:Bh,jpg:Bh};var Fh={arrowShapeWidth:.3,registerArrowShapes:function(){var e=this.arrowShapes={},t=this,n=function(e,t,n,r,i,a,o){var s=i.x-n/2-o,l=i.x+n/2+o,u=i.y-n/2-o,c=i.y+n/2+o;return s<=e&&e<=l&&u<=t&&t<=c},r=function(e,t,n,r,i){var a=e*Math.cos(r)-t*Math.sin(r),o=(e*Math.sin(r)+t*Math.cos(r))*n;return{x:a*n+i.x,y:o+i.y}},i=function(e,t,n,i){for(var a=[],o=0;o(r=ir(e,t,x[w],x[w+1],x[w+2],x[w+3])))return v(n,r),!0}else if("bezier"===a.edgeType||"multibezier"===a.edgeType||"self"===a.edgeType||"compound"===a.edgeType)for(x=a.allpts,w=0;w+5(r=rr(e,t,x[w],x[w+1],x[w+2],x[w+3],x[w+4],x[w+5])))return v(n,r),!0;m=m||i.source,b=b||i.target;var E=o.getArrowWidth(l,c),T=[{name:"source",x:a.arrowStartX,y:a.arrowStartY,angle:a.srcArrowAngle},{name:"target",x:a.arrowEndX,y:a.arrowEndY,angle:a.tgtArrowAngle},{name:"mid-source",x:a.midX,y:a.midY,angle:a.midsrcArrowAngle},{name:"mid-target",x:a.midX,y:a.midY,angle:a.midtgtArrowAngle}];for(w=0;w0&&(y(m),y(b))}function b(e,t,n){return Yt(e,t,n)}function x(n,r){var i,a=n._private,o=g;i=r?r+"-":"",n.boundingBox();var s=a.labelBounds[r||"main"],l=n.pstyle(i+"label").value;if("yes"===n.pstyle("text-events").strValue&&l){var u=b(a.rscratch,"labelX",r),c=b(a.rscratch,"labelY",r),h=b(a.rscratch,"labelAngle",r),d=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,f=s.x1-o-d,y=s.x2+o-d,m=s.y1-o-p,x=s.y2+o-p;if(h){var w=Math.cos(h),E=Math.sin(h),T=function(e,t){return{x:(e-=u)*w-(t-=c)*E+u,y:e*E+t*w+c}},_=T(f,m),A=T(f,x),C=T(y,m),D=T(y,x),N=[ +// with the margin added after the rotation is applied +_.x+d,_.y+p,C.x+d,C.y+p,D.x+d,D.y+p,A.x+d,A.y+p];if(ar(e,t,N))return v(n),!0}else if($n(s,e,t))return v(n),!0}}n&&(l=l.interactive);for(var w=l.length-1;w>=0;w--){var E=l[w];E.isNode()?y(E)||x(E):m(E)||x(E)||x(E,"source")||x(E,"target")}return u},getAllInBox:function(e,t,n,r){for(var i=this.getCachedZSortedEles().interactive,a=[],o=Math.min(e,n),s=Math.max(e,n),l=Math.min(t,r),u=Math.max(t,r),c=zn({x1:e=o,y1:t=l,x2:n=s,y2:r=u}),h=0;h0?-(Math.PI-e.ang):Math.PI+e.ang},ld=function(e,t,n,r,i){if(e!==rd?od(t,e,id):sd(ad,id),od(t,n,ad),Xh=id.nx*ad.ny-id.ny*ad.nx,Uh=id.nx*ad.nx-id.ny*-ad.ny,Hh=Math.asin(Math.max(-1,Math.min(1,Xh))),Math.abs(Hh)<1e-6)return Vh=t.x,Yh=t.y,void($h=Zh=0);jh=1,Wh=!1,Uh<0?Hh<0?Hh=Math.PI+Hh:(Hh=Math.PI-Hh,jh=-1,Wh=!0):Hh>0&&(jh=-1,Wh=!0),Zh=void 0!==t.radius?t.radius:r,qh=Hh/2,Qh=Math.min(id.len/2,ad.len/2),i?(Kh=Math.abs(Math.cos(qh)*Zh/Math.sin(qh)))>Qh?(Kh=Qh,$h=Math.abs(Kh*Math.sin(qh)/Math.cos(qh))):$h=Zh:(Kh=Math.min(Qh,Zh),$h=Math.abs(Kh*Math.sin(qh)/Math.cos(qh))),td=t.x+ad.nx*Kh,nd=t.y+ad.ny*Kh,Vh=td-ad.ny*$h*jh,Yh=nd+ad.nx*$h*jh,Jh=t.x+id.nx*Kh,ed=t.y+id.ny*Kh,rd=t};function ud(e,t){0===t.radius?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function cd(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];return 0===r||0===t.radius?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(ld(e,t,n,r,i),{cx:Vh,cy:Yh,radius:$h,startX:Jh,startY:ed,stopX:td,stopY:nd,startAngle:id.ang+Math.PI/2*jh,endAngle:ad.ang-Math.PI/2*jh,counterClockwise:Wh})}var hd={};function dd(e){var t=[];if(null!=e){for(var n=0;n0?Math.max(e-t,0):Math.min(e+t,0)},N=D(A,T),S=D(C,_),L=!1;y===u?v=Math.abs(N)>Math.abs(S)?i:r:y===l||y===s?(v=r,L=!0):y!==a&&y!==o||(v=i,L=!0);var P,k=v===r,I=k?S:N,M=k?C:A,R=Pn(M),O=!1;L&&(b||w)||!(y===s&&M<0||y===l&&M>0||y===a&&M>0||y===o&&M<0)||(I=(R*=-1)*Math.abs(I),O=!0);var B=function(e){return Math.abs(e)=Math.abs(I)},F=B(P=b?(x<0?1+x:x)*I:(x<0?I:0)+x*R),z=B(Math.abs(I)-Math.abs(P));if(!F&&!z||O)if(k){var G=c.y1+P+(f?d/2*R:0),V=c.x1,Y=c.x2;n.segpts=[V,G,Y,G]}else{var X=c.x1+P+(f?h/2*R:0),U=c.y1,j=c.y2;n.segpts=[X,U,X,j]}else if(k){var W=Math.abs(M)<=d/2,H=Math.abs(A)<=p/2;if(W){var q=(c.x1+c.x2)/2,$=c.y1,K=c.y2;n.segpts=[q,$,q,K]}else if(H){var Z=(c.y1+c.y2)/2,Q=c.x1,J=c.x2;n.segpts=[Q,Z,J,Z]}else n.segpts=[c.x1,c.y2]}else{var ee=Math.abs(M)<=h/2,te=Math.abs(C)<=g/2;if(ee){var ne=(c.y1+c.y2)/2,re=c.x1,ie=c.x2;n.segpts=[re,ne,ie,ne]}else if(te){var ae=(c.x1+c.x2)/2,oe=c.y1,se=c.y2;n.segpts=[ae,oe,ae,se]}else n.segpts=[c.x2,c.y1]}if(n.isRound){var le=e.pstyle("taxi-radius").value,ue="arc-radius"===e.pstyle("radius-type").value[0];n.radii=new Array(n.segpts.length/2).fill(le),n.isArcRadius=new Array(n.segpts.length/2).fill(ue)}},hd.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if("bezier"===n.edgeType){var r=t.srcPos,i=t.tgtPos,a=t.srcW,o=t.srcH,s=t.tgtW,l=t.tgtH,u=t.srcShape,c=t.tgtShape,h=t.srcCornerRadius,d=t.tgtCornerRadius,p=t.srcRs,g=t.tgtRs,f=!ae(n.startX)||!ae(n.startY),v=!ae(n.arrowStartX)||!ae(n.arrowStartY),y=!ae(n.endX)||!ae(n.endY),m=!ae(n.arrowEndX)||!ae(n.arrowEndY),b=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth*3,x=kn({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),w=xf.poolIndex()){var v=g;g=f,f=v}var y=h.srcPos=g.position(),m=h.tgtPos=f.position(),b=h.srcW=g.outerWidth(),x=h.srcH=g.outerHeight(),E=h.tgtW=f.outerWidth(),T=h.tgtH=f.outerHeight(),_=h.srcShape=n.nodeShapes[t.getNodeShape(g)],A=h.tgtShape=n.nodeShapes[t.getNodeShape(f)],C=h.srcCornerRadius="auto"===g.pstyle("corner-radius").value?"auto":g.pstyle("corner-radius").pfValue,D=h.tgtCornerRadius="auto"===f.pstyle("corner-radius").value?"auto":f.pstyle("corner-radius").pfValue,N=h.tgtRs=f._private.rscratch,S=h.srcRs=g._private.rscratch;h.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var L=0;L0){var j=u,W=In(j,Tn(t)),H=In(j,Tn(U)),q=W;H2&&In(j,{x:U[2],y:U[3]})0){var le=c,ue=In(le,Tn(t)),ce=In(le,Tn(se)),he=ue;ce2&&In(le,{x:se[2],y:se[3]})=u||m){c={cp:f,segment:y};break}}if(c)break}var b=c.cp,x=c.segment,w=(u-d)/x.length,E=x.t1-x.t0,T=s?x.t0+E*w:x.t1-E*w;T=Fn(0,T,1),t=On(b.p0,b.p1,b.p2,T),i=bd(b.p0,b.p1,b.p2,T);break;case"straight":case"segments":case"haystack":for(var _,A,C,D,N=0,S=r.allpts.length,L=0;L+3=u));L+=2);var P=(u-A)/_;P=Fn(0,P,1),t=Bn(C,D,P),i=md(C,D)}o("labelX",n,t.x),o("labelY",n,t.y),o("labelAutoAngle",n,i)}};u("source"),u("target"),this.applyLabelDimensions(e)}},vd.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},vd.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=this.calculateLabelDimensions(e,r),a=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,s=Yt(n.rscratch,"labelWrapCachedLines",t)||[],l="wrap"!==o?1:Math.max(s.length,1),u=i.height/l,c=u*a,h=i.width,d=i.height+(l-1)*(a-1)*u;Xt(n.rstyle,"labelWidth",t,h),Xt(n.rscratch,"labelWidth",t,h),Xt(n.rstyle,"labelHeight",t,d),Xt(n.rscratch,"labelHeight",t,d),Xt(n.rscratch,"labelLineHeight",t,c)},vd.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,s=function(e,r){return r?(Xt(n.rscratch,e,t,r),r):Yt(n.rscratch,e,t)};if(!i)return"";"none"==a||("uppercase"==a?i=i.toUpperCase():"lowercase"==a&&(i=i.toLowerCase()));var l=e.pstyle("text-wrap").value;if("wrap"===l){var u=s("labelKey");if(null!=u&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var c="​",h=i.split("\n"),d=e.pstyle("text-max-width").pfValue,p="anywhere"===e.pstyle("text-overflow-wrap").value,g=[],f=/[\s\u200b]+|$/g,v=0;vd){var x,w="",E=0,T=o(y.matchAll(f));try{for(T.s();!(x=T.n()).done;){var _=x.value,A=_[0],C=y.substring(E,_.index);E=_.index+A.length;var D=0===w.length?C:w+C+A;this.calculateLabelDimensions(e,D).width<=d?w+=C+A:(w&&g.push(w),w=C+A)}}catch(I){T.e(I)}finally{T.f()}w.match(/^[\s\u200b]+$/)||g.push(w)}else g.push(y)}s("labelWrapCachedLines",g),i=s("labelWrapCachedText",g.join("\n")),s("labelWrapKey",u)}else if("ellipsis"===l){var N=e.pstyle("text-max-width").pfValue,S="",L="…",P=!1;if(this.calculateLabelDimensions(e,i).widthN);k++)S+=i[k],k===i.length-1&&(P=!0);return P||(S+=L),S}return i},vd.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"}},vd.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window().document,i=xt(t,e._private.labelDimsKey),a=n.labelDimCache||(n.labelDimCache=[]),o=a[i];if(null!=o)return o;var s=0,l=e.pstyle("font-style").strValue,u=e.pstyle("font-size").pfValue,c=e.pstyle("font-family").strValue,h=e.pstyle("font-weight").strValue,d=this.labelCalcCanvas,p=this.labelCalcCanvasContext;if(!d){d=this.labelCalcCanvas=r.createElement("canvas"),p=this.labelCalcCanvasContext=d.getContext("2d");var g=d.style;g.position="absolute",g.left="-9999px",g.top="-9999px",g.zIndex="-1",g.visibility="hidden",g.pointerEvents="none"}p.font="".concat(l," ").concat(h," ").concat(u,"px ").concat(c);for(var f=0,v=0,y=t.split("\n"),m=0;m1&&void 0!==arguments[1])||arguments[1];if(t.merge(e),n)for(var r=0;r=e.desktopTapThreshold2}var C=a(t);g&&(e.hoverData.tapholdCancelled=!0);var D=function(){var t=e.hoverData.dragDelta=e.hoverData.dragDelta||[];0===t.length?(t.push(b[0]),t.push(b[1])):(t[0]+=b[0],t[1]+=b[1])};n=!0,i(p,["mousemove","vmousemove","tapdrag"],t,{x:u[0],y:u[1]});var N=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||r.emit({originalEvent:t,type:"boxstart",position:{x:u[0],y:u[1]}}),d[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(3===e.hoverData.which){if(g){var S={originalEvent:t,type:"cxtdrag",position:{x:u[0],y:u[1]}};m?m.emit(S):r.emit(S),e.hoverData.cxtDragged=!0,e.hoverData.cxtOver&&p===e.hoverData.cxtOver||(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:u[0],y:u[1]}}),e.hoverData.cxtOver=p,p&&p.emit({originalEvent:t,type:"cxtdragover",position:{x:u[0],y:u[1]}}))}}else if(e.hoverData.dragging){if(n=!0,r.panningEnabled()&&r.userPanningEnabled()){var L;if(e.hoverData.justStartedPan){var P=e.hoverData.mdownPos;L={x:(u[0]-P[0])*s,y:(u[1]-P[1])*s},e.hoverData.justStartedPan=!1}else L={x:b[0]*s,y:b[1]*s};r.panBy(L),r.emit("dragpan"),e.hoverData.dragged=!0}u=e.projectIntoViewport(t.clientX,t.clientY)}else if(1!=d[4]||null!=m&&!m.pannable()){if(m&&m.pannable()&&m.active()&&m.unactivate(),m&&m.grabbed()||p==v||(v&&i(v,["mouseout","tapdragout"],t,{x:u[0],y:u[1]}),p&&i(p,["mouseover","tapdragover"],t,{x:u[0],y:u[1]}),e.hoverData.last=p),m)if(g){if(r.boxSelectionEnabled()&&C)m&&m.grabbed()&&(y(x),m.emit("freeon"),x.emit("free"),e.dragData.didDrag&&(m.emit("dragfreeon"),x.emit("dragfree"))),N();else if(m&&m.grabbed()&&e.nodeIsDraggable(m)){var k=!e.dragData.didDrag;k&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||f(x,{inDragLayer:!0});var I={x:0,y:0};if(ae(b[0])&&ae(b[1])&&(I.x+=b[0],I.y+=b[1],k)){var M=e.hoverData.dragDelta;M&&ae(M[0])&&ae(M[1])&&(I.x+=M[0],I.y+=M[1])}e.hoverData.draggingEles=!0,x.silentShift(I).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else D();n=!0}else g&&(e.hoverData.dragging||!r.boxSelectionEnabled()||!C&&r.panningEnabled()&&r.userPanningEnabled()?!e.hoverData.selecting&&r.panningEnabled()&&r.userPanningEnabled()&&o(m,e.hoverData.downs)&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,d[4]=0,e.data.bgActivePosistion=Tn(c),e.redrawHint("select",!0),e.redraw()):N(),m&&m.pannable()&&m.active()&&m.unactivate());return d[2]=u[0],d[3]=u[1],n?(t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),!1):void 0}}),!1),e.registerBinding(t,"mouseup",(function(t){if((1!==e.hoverData.which||1===t.which||!e.hoverData.capture)&&e.hoverData.capture){e.hoverData.capture=!1;var r=e.cy,o=e.projectIntoViewport(t.clientX,t.clientY),s=e.selection,l=e.findNearestElement(o[0],o[1],!0,!1),u=e.dragData.possibleDragElements,c=e.hoverData.down,h=a(t);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,c&&c.unactivate(),3===e.hoverData.which){var d={originalEvent:t,type:"cxttapend",position:{x:o[0],y:o[1]}};if(c?c.emit(d):r.emit(d),!e.hoverData.cxtDragged){var p={originalEvent:t,type:"cxttap",position:{x:o[0],y:o[1]}};c?c.emit(p):r.emit(p)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(1===e.hoverData.which){if(i(l,["mouseup","tapend","vmouseup"],t,{x:o[0],y:o[1]}),e.dragData.didDrag||e.hoverData.dragged||e.hoverData.selecting||e.hoverData.isOverThresholdDrag||(i(c,["click","tap","vclick"],t,{x:o[0],y:o[1]}),D=!1,t.timeStamp-N<=r.multiClickDebounceTime()?(C&&clearTimeout(C),D=!0,N=null,i(c,["dblclick","dbltap","vdblclick"],t,{x:o[0],y:o[1]})):(C=setTimeout((function(){D||i(c,["oneclick","onetap","voneclick"],t,{x:o[0],y:o[1]})}),r.multiClickDebounceTime()),N=t.timeStamp)),null!=c||e.dragData.didDrag||e.hoverData.selecting||e.hoverData.dragged||a(t)||(r.$(n).unselect(["tapunselect"]),u.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=u=r.collection()),l!=c||e.dragData.didDrag||e.hoverData.selecting||null!=l&&l._private.selectable&&(e.hoverData.dragging||("additive"===r.selectionType()||h?l.selected()?l.unselect(["tapunselect"]):l.select(["tapselect"]):h||(r.$(n).unmerge(l).unselect(["tapunselect"]),l.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var g=r.collection(e.getAllInBox(s[0],s[1],s[2],s[3]));e.redrawHint("select",!0),g.length>0&&e.redrawHint("eles",!0),r.emit({type:"boxend",originalEvent:t,position:{x:o[0],y:o[1]}});var f=function(e){return e.selectable()&&!e.selected()};"additive"===r.selectionType()||h||r.$(n).unmerge(g).unselect(),g.emit("box").stdFilter(f).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!s[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var v=c&&c.grabbed();y(u),v&&(c.emit("freeon"),u.emit("free"),e.dragData.didDrag&&(c.emit("dragfreeon"),u.emit("dragfree")))}}s[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}),!1);var L,P,k,I,M,R,O,B,F,z,G,V,Y,X=function(t){if(!e.scrollingPage){var n=e.cy,r=n.zoom(),i=n.pan(),a=e.projectIntoViewport(t.clientX,t.clientY),o=[a[0]*r+i.x,a[1]*r+i.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||_())t.preventDefault();else if(n.panningEnabled()&&n.userPanningEnabled()&&n.zoomingEnabled()&&n.userZoomingEnabled()){var s;t.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout((function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()}),150),s=null!=t.deltaY?t.deltaY/-250:null!=t.wheelDeltaY?t.wheelDeltaY/1e3:t.wheelDelta/1e3,s*=e.wheelSensitivity,1===t.deltaMode&&(s*=33);var l=n.zoom()*Math.pow(10,s);"gesturechange"===t.type&&(l=e.gestureStartZoom*t.scale),n.zoom({level:l,renderedPosition:{x:o[0],y:o[1]}}),n.emit("gesturechange"===t.type?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",X,!0),e.registerBinding(t,"scroll",(function(t){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout((function(){e.scrollingPage=!1}),250)}),!0),e.registerBinding(e.container,"gesturestart",(function(t){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||t.preventDefault()}),!0),e.registerBinding(e.container,"gesturechange",(function(t){e.hasTouchStarted||X(t)}),!0),e.registerBinding(e.container,"mouseout",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseout",position:{x:n[0],y:n[1]}})}),!1),e.registerBinding(e.container,"mouseover",(function(t){var n=e.projectIntoViewport(t.clientX,t.clientY);e.cy.emit({originalEvent:t,type:"mouseover",position:{x:n[0],y:n[1]}})}),!1);var U,j,W,H,q,$,K,Z=function(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))},Q=function(e,t,n,r){return(n-e)*(n-e)+(r-t)*(r-t)};if(e.registerBinding(e.container,"touchstart",U=function(t){if(e.hasTouchStarted=!0,A(t)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var n=e.cy,r=e.touchData.now,a=e.touchData.earlier;if(t.touches[0]){var o=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);r[0]=o[0],r[1]=o[1]}if(t.touches[1]&&(o=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),r[2]=o[0],r[3]=o[1]),t.touches[2]&&(o=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),r[4]=o[0],r[5]=o[1]),t.touches[1]){e.touchData.singleTouchMoved=!0,y(e.dragData.touchDragEles);var s=e.findContainerClientCoords();F=s[0],z=s[1],G=s[2],V=s[3],L=t.touches[0].clientX-F,P=t.touches[0].clientY-z,k=t.touches[1].clientX-F,I=t.touches[1].clientY-z,Y=0<=L&&L<=G&&0<=k&&k<=G&&0<=P&&P<=V&&0<=I&&I<=V;var l=n.pan(),u=n.zoom();M=Z(L,P,k,I),R=Q(L,P,k,I),B=[((O=[(L+k)/2,(P+I)/2])[0]-l.x)/u,(O[1]-l.y)/u];var c=200;if(R=1){for(var T=e.touchData.startPosition=[null,null,null,null,null,null],_=0;_=e.touchTapThreshold2}if(n&&e.touchData.cxt){t.preventDefault();var x=t.touches[0].clientX-F,w=t.touches[0].clientY-z,E=t.touches[1].clientX-F,T=t.touches[1].clientY-z,_=Q(x,w,E,T),C=150,D=1.5;if(_/R>=D*D||_>=C*C){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var N={originalEvent:t,type:"cxttapend",position:{x:s[0],y:s[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(N),e.touchData.start=null):a.emit(N)}}if(n&&e.touchData.cxt){N={originalEvent:t,type:"cxtdrag",position:{x:s[0],y:s[1]}},e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(N):a.emit(N),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var S=e.findNearestElement(s[0],s[1],!0,!0);e.touchData.cxtOver&&S===e.touchData.cxtOver||(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:t,type:"cxtdragout",position:{x:s[0],y:s[1]}}),e.touchData.cxtOver=S,S&&S.emit({originalEvent:t,type:"cxtdragover",position:{x:s[0],y:s[1]}}))}else if(n&&t.touches[2]&&a.boxSelectionEnabled())t.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||a.emit({originalEvent:t,type:"boxstart",position:{x:s[0],y:s[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,r[4]=1,r&&0!==r.length&&void 0!==r[0]?(r[2]=(s[0]+s[2]+s[4])/3,r[3]=(s[1]+s[3]+s[5])/3):(r[0]=(s[0]+s[2]+s[4])/3,r[1]=(s[1]+s[3]+s[5])/3,r[2]=(s[0]+s[2]+s[4])/3+1,r[3]=(s[1]+s[3]+s[5])/3+1),e.redrawHint("select",!0),e.redraw();else if(n&&t.touches[1]&&!e.touchData.didSelect&&a.zoomingEnabled()&&a.panningEnabled()&&a.userZoomingEnabled()&&a.userPanningEnabled()){if(t.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),te=e.dragData.touchDragEles){e.redrawHint("drag",!0);for(var O=0;O0&&!e.hoverData.draggingEles&&!e.swipePanning&&null!=e.data.bgActivePosistion&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1),e.registerBinding(t,"touchcancel",W=function(t){var n=e.touchData.start;e.touchData.capture=!1,n&&n.unactivate()}),e.registerBinding(t,"touchend",H=function(t){var r=e.touchData.start;if(e.touchData.capture){0===t.touches.length&&(e.touchData.capture=!1),t.preventDefault();var a=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var o,s=e.cy,l=s.zoom(),u=e.touchData.now,c=e.touchData.earlier;if(t.touches[0]){var h=e.projectIntoViewport(t.touches[0].clientX,t.touches[0].clientY);u[0]=h[0],u[1]=h[1]}if(t.touches[1]&&(h=e.projectIntoViewport(t.touches[1].clientX,t.touches[1].clientY),u[2]=h[0],u[3]=h[1]),t.touches[2]&&(h=e.projectIntoViewport(t.touches[2].clientX,t.touches[2].clientY),u[4]=h[0],u[5]=h[1]),r&&r.unactivate(),e.touchData.cxt){if(o={originalEvent:t,type:"cxttapend",position:{x:u[0],y:u[1]}},r?r.emit(o):s.emit(o),!e.touchData.cxtDragged){var d={originalEvent:t,type:"cxttap",position:{x:u[0],y:u[1]}};r?r.emit(d):s.emit(d)}return e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,void e.redraw()}if(!t.touches[2]&&s.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var p=s.collection(e.getAllInBox(a[0],a[1],a[2],a[3]));a[0]=void 0,a[1]=void 0,a[2]=void 0,a[3]=void 0,a[4]=0,e.redrawHint("select",!0),s.emit({type:"boxend",originalEvent:t,position:{x:u[0],y:u[1]}});var g=function(e){return e.selectable()&&!e.selected()};p.emit("box").stdFilter(g).select().emit("boxselect"),p.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(null!=r&&r.unactivate(),t.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(t.touches[1]);else if(t.touches[0]);else if(!t.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var f=e.dragData.touchDragEles;if(null!=r){var v=r._private.grabbed;y(f),e.redrawHint("drag",!0),e.redrawHint("eles",!0),v&&(r.emit("freeon"),f.emit("free"),e.dragData.didDrag&&(r.emit("dragfreeon"),f.emit("dragfree"))),i(r,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]}),r.unactivate(),e.touchData.start=null}else{var m=e.findNearestElement(u[0],u[1],!0,!0);i(m,["touchend","tapend","vmouseup","tapdragout"],t,{x:u[0],y:u[1]})}var b=e.touchData.startPosition[0]-u[0],x=b*b,w=e.touchData.startPosition[1]-u[1],E=(x+w*w)*l*l;e.touchData.singleTouchMoved||(r||s.$(":selected").unselect(["tapunselect"]),i(r,["tap","vclick"],t,{x:u[0],y:u[1]}),q=!1,t.timeStamp-K<=s.multiClickDebounceTime()?($&&clearTimeout($),q=!0,K=null,i(r,["dbltap","vdblclick"],t,{x:u[0],y:u[1]})):($=setTimeout((function(){q||i(r,["onetap","voneclick"],t,{x:u[0],y:u[1]})}),s.multiClickDebounceTime()),K=t.timeStamp)),null!=r&&!e.dragData.didDrag&&r._private.selectable&&E0)return p[0]}return null},p=Object.keys(h),g=0;g0?u:Qn(i,a,e,t,n,r,o,s)},checkPoint:function(e,t,n,r,i,a,o,s){var l=2*(s="auto"===s?wr(r,i):s);if(or(e,t,this.points,a,o,r,i-l,[0,-1],n))return!0;if(or(e,t,this.points,a,o,r-l,i,[0,-1],n))return!0;var u=r/2+2*n,c=i/2+2*n;return!!ar(e,t,[a-u,o-c,a-u,o,a+u,o,a+u,o-c])||!!hr(e,t,l,l,a+r/2-s,o+i/2-s,n)||!!hr(e,t,l,l,a-r/2+s,o+i/2-s,n)}}},registerNodeShapes:function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",mr(3,0)),this.generateRoundPolygon("round-triangle",mr(3,0)),this.generatePolygon("rectangle",mr(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",mr(5,0)),this.generateRoundPolygon("round-pentagon",mr(5,0)),this.generatePolygon("hexagon",mr(6,0)),this.generateRoundPolygon("round-hexagon",mr(6,0)),this.generatePolygon("heptagon",mr(7,0)),this.generateRoundPolygon("round-heptagon",mr(7,0)),this.generatePolygon("octagon",mr(8,0)),this.generateRoundPolygon("round-octagon",mr(8,0));var r=new Array(20),i=xr(5,0),a=xr(5,Math.PI/5),o=.5*(3-Math.sqrt(5));o*=1.57;for(var s=0;s=e.deqFastCost*f)break}else if(i){if(p>=e.deqCost*l||p>=e.deqAvgCost*s)break}else if(g>=e.deqNoDrawCost*Id)break;var v=e.deq(t,h,c);if(!(v.length>0))break;for(var y=0;y0&&(e.onDeqd(t,u),!i&&e.shouldRedraw(t,u,h,c)&&r())},a=e.priority||Nt;n.beforeRender(i,a(t))}}}},Rd=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ct;r(this,e),this.idsByKey=new jt,this.keyForId=new jt,this.cachesByLvl=new jt,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return a(e,[{key:"getIdsFor",value:function(e){null==e&&St("Can not get id list for null key");var t=this.idsByKey,n=this.idsByKey.get(e);return n||(n=new qt,t.set(e,n)),n}},{key:"addIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).add(t)}},{key:"deleteIdForKey",value:function(e,t){null!=e&&this.getIdsFor(e).delete(t)}},{key:"getNumberOfIdsForKey",value:function(e){return null==e?0:this.getIdsFor(e).size}},{key:"updateKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t),r=this.getKey(e);this.deleteIdForKey(n,t),this.addIdForKey(r,t),this.keyForId.set(t,r)}},{key:"deleteKeyMappingFor",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteIdForKey(n,t),this.keyForId.delete(t)}},{key:"keyHasChangedFor",value:function(e){var t=e.id();return this.keyForId.get(t)!==this.getKey(e)}},{key:"isInvalid",value:function(e){return this.keyHasChangedFor(e)||this.doesEleInvalidateKey(e)}},{key:"getCachesAt",value:function(e){var t=this.cachesByLvl,n=this.lvls,r=t.get(e);return r||(r=new jt,t.set(e,r),n.push(e)),r}},{key:"getCache",value:function(e,t){return this.getCachesAt(t).get(e)}},{key:"get",value:function(e,t){var n=this.getKey(e),r=this.getCache(n,t);return null!=r&&this.updateKeyMappingFor(e),r}},{key:"getForCachedKey",value:function(e,t){var n=this.keyForId.get(e.id());return this.getCache(n,t)}},{key:"hasCache",value:function(e,t){return this.getCachesAt(t).has(e)}},{key:"has",value:function(e,t){var n=this.getKey(e);return this.hasCache(n,t)}},{key:"setCache",value:function(e,t,n){n.key=e,this.getCachesAt(t).set(e,n)}},{key:"set",value:function(e,t,n){var r=this.getKey(e);this.setCache(r,t,n),this.updateKeyMappingFor(e)}},{key:"deleteCache",value:function(e,t){this.getCachesAt(t).delete(e)}},{key:"delete",value:function(e,t){var n=this.getKey(e);this.deleteCache(n,t)}},{key:"invalidateKey",value:function(e){var t=this;this.lvls.forEach((function(n){return t.deleteCache(e,n)}))} +// returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key) +},{key:"invalidate",value:function(e){var t=e.id(),n=this.keyForId.get(t);this.deleteKeyMappingFor(e);var r=this.doesEleInvalidateKey(e);return r&&this.invalidateKey(n),r||0===this.getNumberOfIdsForKey(n)}}])}(),Od=25,Bd=50,Fd=-4,zd=3,Gd=7.99,Vd=8,Yd=1024,Xd=1024,Ud=1024,jd=.2,Wd=.8,Hd=10,qd=.15,$d=.1,Kd=.9,Zd=.9,Qd=100,Jd=1,ep={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},tp=Ft({getKey:null,doesEleInvalidateKey:Ct,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:At,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),np=function(e,t){var n=this;n.renderer=e,n.onDequeues=[];var r=tp(t);Ie(n,r),n.lookup=new Rd(r.getKey,r.doesEleInvalidateKey),n.setupDequeueing()},rp=np.prototype;rp.reasons=ep,rp.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},rp.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{};return n[e]=n[e]||[]},rp.getElementQueue=function(){var e=this;return e.eleCacheQueue=e.eleCacheQueue||new on((function(e,t){return t.reqs-e.reqs}))},rp.getElementKeyToQueue=function(){var e=this;return e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{}},rp.getElement=function(e,t,n,r,i){var a=this,o=this.renderer,s=o.cy.zoom(),l=this.lookup;if(!t||0===t.w||0===t.h||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed())return null;if(!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(null==r&&(r=Math.ceil(Ln(s*n))),r=Gd||r>zd)return null;var u=Math.pow(2,r),c=t.h*u,h=t.w*u,d=o.eleTextBiggerThanMin(e,u);if(!this.isVisible(e,d))return null;var p,g=l.get(e,r);if(g&&g.invalidated&&(g.invalidated=!1,g.texture.invalidatedWidth-=g.width),g)return g;if(p=c<=Od?Od:c<=Bd?Bd:Math.ceil(c/Bd)*Bd,c>Ud||h>Xd)return null;var f=a.getTextureQueue(p),v=f[f.length-2],y=function(){return a.recycleTexture(p,h)||a.addTexture(p,h)};v||(v=f[f.length-1]),v||(v=y()),v.width-v.usedWidthr;D--)A=a.getElement(e,t,n,D,ep.downscale);C()}else{var N;if(!x&&!w&&!E)for(var S=r-1;S>=Fd;S--){var L=l.get(e,S);if(L){N=L;break}}if(b(N))return a.queueElement(e,r),N;v.context.translate(v.usedWidth,0),v.context.scale(u,u),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/u,1/u),v.context.translate(-v.usedWidth,0)}return g={x:v.usedWidth,texture:v,level:r,scale:u,width:h,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(h+Vd),v.eleCaches.push(g),l.set(e,r,g),a.checkTextureFullness(v),g},rp.invalidateElements=function(e){for(var t=0;t=jd*e.width&&this.retireTexture(e)},rp.checkTextureFullness=function(e){var t=this.getTextureQueue(e.height);e.usedWidth/e.width>Wd&&e.fullnessChecks>=Hd?zt(t,e):e.fullnessChecks++},rp.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;zt(r,e),e.retired=!0;for(var a=e.eleCaches,o=0;o=t)return o.retired=!1,o.usedWidth=0,o.invalidatedWidth=0,o.fullnessChecks=0,Gt(o.eleCaches),o.context.setTransform(1,0,0,1,0,0),o.context.clearRect(0,0,o.width,o.height),zt(i,o),r.push(o),o}},rp.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),o=i[a];if(o)o.level=Math.max(o.level,t),o.eles.merge(e),o.reqs++,r.updateItem(o);else{var s={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(s),i[a]=s}},rp.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,o=0;o0;o++){var s=n.pop(),l=s.key,u=s.eles[0],c=a.hasCache(u,s.level);if(r[l]=null,!c){i.push(s);var h=t.getBoundingBox(u);t.getElement(u,h,e,s.level,ep.dequeue)}}return i},rp.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];null!=a&&(1===a.eles.length?(a.reqs=_t,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},rp.onDequeue=function(e){this.onDequeues.push(e)},rp.offDequeue=function(e){zt(this.onDequeues,e)},rp.setupDequeueing=Md.setupDequeueing({deqRedrawThreshold:Qd,deqCost:qd,deqAvgCost:$d,deqNoDrawCost:Kd,deqFastCost:Zd,deq:function(e,t,n){return e.dequeue(t,n)},onDeqd:function(e,t){for(var n=0;n=sp||n>op)return null;r.validateLayersElesOrdering(n,e);var o,s,l=r.layersByLevel,u=Math.pow(2,n),c=l[n]=l[n]||[];if(r.levelIsComplete(n,e))return c;!function(){var t=function(t){if(r.validateLayersElesOrdering(t,e),r.levelIsComplete(t,e))return s=l[t],!0},i=function(e){if(!s)for(var r=n+e;ap<=r&&r<=op&&!t(r);r+=e);};i(1),i(-1);for(var a=c.length-1;a>=0;a--){var o=c[a];o.invalid&&zt(c,o)}}();var h=function(){if(!o){o=zn();for(var t=0;typ||a>yp)return null;if(i*a>vp)return null;var s=r.makeLayer(o,n);if(null!=t){var l=c.indexOf(t)+1;c.splice(l,0,s)}else(void 0===e.insert||e.insert)&&c.unshift(s);return s};if(r.skipping&&!a)return null;for(var p=null,g=e.length/ip,f=!a,v=0;v=g||!Zn(p.bb,y.boundingBox()))&&!(p=d({insert:!0,after:p})))return null;s||f?r.queueLayer(p,y):r.drawEleInLayer(p,y,n,t),p.eles.push(y),b[n]=p}}return s||(f?null:c)},xp.getEleLevelForLayerLevel=function(e,t){return e},xp.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,o=e.context,s=t.boundingBox();0!==s.w&&0!==s.h&&t.visible()&&(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(o,!1),a.drawCachedElement(o,t,null,null,n,mp),a.setImgSmoothing(o,!0))},xp.levelIsComplete=function(e,t){var n=this.layersByLevel[e];if(!n||0===n.length)return!1;for(var r=0,i=0;i0)return!1;if(a.invalid)return!1;r+=a.eles.length}return r===t.length},xp.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r0){t=!0;break}}return t},xp.invalidateElements=function(e){var t=this;0!==e.length&&(t.lastInvalidationTime=ut(),0!==e.length&&t.haveLayers()&&t.updateElementsInLayers(e,(function(e,n,r){t.invalidateLayer(e)})))},xp.invalidateLayer=function(e){if(this.lastInvalidationTime=ut(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];zt(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],o=this,s=t._private.rscratch;if((!a||t.visible())&&!s.badLine&&null!=s.allpts&&!isNaN(s.allpts[0])){var l;n&&(l=n,e.translate(-l.x1,-l.y1));var u=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,h=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,p=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,f=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,y=u*c,m=u*c,b=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;"straight-triangle"===h?(o.eleStrokeStyle(e,t,n),o.drawEdgeTrianglePath(t,e,s.allpts)):(e.lineWidth=p,e.lineCap=g,o.eleStrokeStyle(e,t,n),o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")},x=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;e.lineWidth=p+f,e.lineCap=g,f>0?(o.colorStrokeStyle(e,v[0],v[1],v[2],n),"straight-triangle"===h?o.drawEdgeTrianglePath(t,e,s.allpts):(o.drawEdgePath(t,e,s.allpts,d),e.lineCap="butt")):e.lineCap="butt"},w=function(){i&&o.drawEdgeOverlay(e,t)},E=function(){i&&o.drawEdgeUnderlay(e,t)},T=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:m;o.drawArrowheads(e,t,n)},_=function(){o.drawElementText(e,t,null,r)};if(e.lineJoin="round","yes"===t.pstyle("ghost").value){var A=t.pstyle("ghost-offset-x").pfValue,C=t.pstyle("ghost-offset-y").pfValue,D=t.pstyle("ghost-opacity").value,N=y*D;e.translate(A,C),b(N),T(N),e.translate(-A,-C)}else x();E(),b(),T(),w(),_(),n&&e.translate(l.x1,l.y1)}}},Fp=function(e){if(!["overlay","underlay"].includes(e))throw new Error("Invalid state");return function(t,n){if(n.visible()){var r=n.pstyle("".concat(e,"-opacity")).value;if(0!==r){var i=this,a=i.usePaths(),o=n._private.rscratch,s=2*n.pstyle("".concat(e,"-padding")).pfValue,l=n.pstyle("".concat(e,"-color")).value;t.lineWidth=s,"self"!==o.edgeType||a?t.lineCap="round":t.lineCap="butt",i.colorStrokeStyle(t,l[0],l[1],l[2],r),i.drawEdgePath(n,t,o.allpts,"solid")}}}};Bp.drawEdgeOverlay=Fp("overlay"),Bp.drawEdgeUnderlay=Fp("underlay"),Bp.drawEdgePath=function(e,t,n,r){var i,a=e._private.rscratch,s=t,l=!1,u=this.usePaths(),c=e.pstyle("line-dash-pattern").pfValue,h=e.pstyle("line-dash-offset").pfValue;if(u){var d=n.join("$");a.pathCacheKey&&a.pathCacheKey===d?(i=t=a.pathCache,l=!0):(i=t=new Path2D,a.pathCacheKey=d,a.pathCache=i)}if(s.setLineDash)switch(r){case"dotted":s.setLineDash([1,1]);break;case"dashed":s.setLineDash(c),s.lineDashOffset=h;break;case"solid":s.setLineDash([])}if(!l&&!a.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),a.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var p=2;p+35&&void 0!==arguments[5]?arguments[5]:5,o=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),o?e.stroke():e.fill()}Gp.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(Ln(n*r));t=Math.pow(2,i)}return!(e.pstyle("font-size").pfValue*t5&&void 0!==arguments[5])||arguments[5],o=this;if(null==r){if(a&&!o.eleTextBiggerThanMin(t))return}else if(!1===r)return;if(t.isNode()){var s=t.pstyle("label");if(!s||!s.value)return;var l=o.getLabelJustification(t);e.textAlign=l,e.textBaseline="bottom"}else{var u=t.element()._private.rscratch.badLine,c=t.pstyle("label"),h=t.pstyle("source-label"),d=t.pstyle("target-label");if(u||(!c||!c.value)&&(!h||!h.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var p,g=!n;n&&(p=n,e.translate(-p.x1,-p.y1)),null==i?(o.drawText(e,t,null,g,a),t.isEdge()&&(o.drawText(e,t,"source",g,a),o.drawText(e,t,"target",g,a))):o.drawText(e,t,i,g,a),n&&e.translate(p.x1,p.y1)},Gp.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n2&&void 0!==arguments[2])||arguments[2],r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,o=t.pstyle("font-weight").strValue,s=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,l=t.pstyle("text-outline-opacity").value*s,u=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+o+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,u[0],u[1],u[2],s),this.colorStrokeStyle(e,c[0],c[1],c[2],l)},Gp.getTextAngle=function(e,t){var n,r=e._private.rscratch,i=t?t+"-":"",a=e.pstyle(i+"text-rotation");if("autorotate"===a.strValue){var o=Yt(r,"labelAngle",t);n=e.isEdge()?o:0}else n="none"===a.strValue?0:a.pfValue;return n},Gp.drawText=function(e,t,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=t._private.rscratch,o=i?t.effectiveOpacity():1;if(!i||0!==o&&0!==t.pstyle("text-opacity").value){"main"===n&&(n=null);var s,l,u=Yt(a,"labelX",n),c=Yt(a,"labelY",n),h=this.getLabelText(t,n);if(null!=h&&""!==h&&!isNaN(u)&&!isNaN(c)){this.setupTextStyle(e,t,i);var d,p=n?n+"-":"",g=Yt(a,"labelWidth",n),f=Yt(a,"labelHeight",n),v=t.pstyle(p+"text-margin-x").pfValue,y=t.pstyle(p+"text-margin-y").pfValue,m=t.isEdge(),b=t.pstyle("text-halign").value,x=t.pstyle("text-valign").value;switch(m&&(b="center",x="center"),u+=v,c+=y,0!==(d=r?this.getTextAngle(t,n):0)&&(s=u,l=c,e.translate(s,l),e.rotate(d),u=0,c=0),x){case"top":break;case"center":c+=f/2;break;case"bottom":c+=f}var w=t.pstyle("text-background-opacity").value,E=t.pstyle("text-border-opacity").value,T=t.pstyle("text-border-width").pfValue,_=t.pstyle("text-background-padding").pfValue,A=0===t.pstyle("text-background-shape").strValue.indexOf("round"),C=2;if(w>0||T>0&&E>0){var D=u-_;switch(b){case"left":D-=g;break;case"center":D-=g/2}var N=c-f-_,S=g+2*_,L=f+2*_;if(w>0){var P=e.fillStyle,k=t.pstyle("text-background-color").value;e.fillStyle="rgba("+k[0]+","+k[1]+","+k[2]+","+w*o+")",A?Vp(e,D,N,S,L,C):e.fillRect(D,N,S,L),e.fillStyle=P}if(T>0&&E>0){var I=e.strokeStyle,M=e.lineWidth,R=t.pstyle("text-border-color").value,O=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+R[0]+","+R[1]+","+R[2]+","+E*o+")",e.lineWidth=T,e.setLineDash)switch(O){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=T/4,e.setLineDash([]);break;case"solid":e.setLineDash([])}if(A?Vp(e,D,N,S,L,C,"stroke"):e.strokeRect(D,N,S,L),"double"===O){var B=T/2;A?Vp(e,D+B,N+B,S-2*B,L-2*B,C,"stroke"):e.strokeRect(D+B,N+B,S-2*B,L-2*B)}e.setLineDash&&e.setLineDash([]),e.lineWidth=M,e.strokeStyle=I}}var F=2*t.pstyle("text-outline-width").pfValue;if(F>0&&(e.lineWidth=F),"wrap"===t.pstyle("text-wrap").value){var z=Yt(a,"labelWrapCachedLines",n),G=Yt(a,"labelLineHeight",n),V=g/2,Y=this.getLabelJustification(t);switch("auto"===Y||("left"===b?"left"===Y?u+=-g:"center"===Y&&(u+=-V):"center"===b?"left"===Y?u+=-V:"right"===Y&&(u+=V):"right"===b&&("center"===Y?u+=V:"right"===Y&&(u+=g))),x){case"top":case"center":case"bottom":c-=(z.length-1)*G}for(var X=0;X0&&e.strokeText(z[X],u,c),e.fillText(z[X],u,c),c+=G}else F>0&&e.strokeText(h,u,c),e.fillText(h,u,c);0!==d&&(e.rotate(-d),e.translate(-s,-l))}}};var Yp={drawNode:function(e,t,n){var r,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,c=u.rscratch,h=t.position();if(ae(h.x)&&ae(h.y)&&(!s||t.visible())){var d,p,g=s?t.effectiveOpacity():1,f=l.usePaths(),v=!1,y=t.padding();r=t.width()+2*y,i=t.height()+2*y,n&&(p=n,e.translate(-p.x1,-p.y1));for(var m=t.pstyle("background-image").value,b=new Array(m.length),x=new Array(m.length),w=0,E=0;E0&&void 0!==arguments[0]?arguments[0]:D;l.eleFillStyle(e,t,n)},X=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:R;l.colorStrokeStyle(e,N[0],N[1],N[2],t)},U=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:z;l.colorStrokeStyle(e,B[0],B[1],B[2],t)},j=function(e,t,n,r){var i,a=l.nodePathCache=l.nodePathCache||[],o=wt("polygon"===n?n+","+r.join(","):n,""+t,""+e,""+V),s=a[o],u=!1;return null!=s?(i=s,u=!0,c.pathCache=i):(i=new Path2D,a[o]=c.pathCache=i),{path:i,cacheHit:u}},W=t.pstyle("shape").strValue,H=t.pstyle("shape-polygon-points").pfValue;if(f){e.translate(h.x,h.y);var q=j(r,i,W,H);d=q.path,v=q.cacheHit}var $=function(){if(!v){var n=h;f&&(n={x:0,y:0}),l.nodeShapes[l.getNodeShape(t)].draw(d||e,n.x,n.y,r,i,V,c)}f?e.fill(d):e.fill()},K=function(){for(var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:g,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=u.backgrounding,a=0,o=0;o0&&void 0!==arguments[0]&&arguments[0],a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g;l.hasPie(t)&&(l.drawPie(e,t,a),n&&(f||l.nodeShapes[l.getNodeShape(t)].draw(e,h.x,h.y,r,i,V,c)))},Q=function(){var t=(A>0?A:-A)*(arguments.length>0&&void 0!==arguments[0]?arguments[0]:g),n=A>0?0:255;0!==A&&(l.colorFillStyle(e,n,n,n,t),f?e.fill(d):e.fill())},J=function(){if(C>0){if(e.lineWidth=C,e.lineCap=P,e.lineJoin=L,e.setLineDash)switch(S){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(I),e.lineDashOffset=M;break;case"solid":case"double":e.setLineDash([])}if("center"!==k){if(e.save(),e.lineWidth*=2,"inside"===k)f?e.clip(d):e.clip();else{var t=new Path2D;t.rect(-r/2-C,-i/2-C,r+2*C,i+2*C),t.addPath(d),e.clip(t,"evenodd")}f?e.stroke(d):e.stroke(),e.restore()}else f?e.stroke(d):e.stroke();if("double"===S){e.lineWidth=C/3;var n=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",f?e.stroke(d):e.stroke(),e.globalCompositeOperation=n}e.setLineDash&&e.setLineDash([])}},ee=function(){if(O>0){if(e.lineWidth=O,e.lineCap="butt",e.setLineDash)switch(F){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([])}var n=h;f&&(n={x:0,y:0});var a=l.getNodeShape(t),o=C;"inside"===k&&(o=0),"outside"===k&&(o*=2);var s,u=(r+o+(O+G))/r,c=(i+o+(O+G))/i,d=r*u,p=i*c,g=l.nodeShapes[a].points;if(f&&(s=j(d,p,a,g).path),"ellipse"===a)l.drawEllipsePath(s||e,n.x,n.y,d,p);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(a)){var v=0,y=0,m=0;"round-diamond"===a?v=1.4*(o+G+O):"round-heptagon"===a?(v=1.075*(o+G+O),m=-(o/2+G+O)/35):"round-hexagon"===a?v=1.12*(o+G+O):"round-pentagon"===a?(v=1.13*(o+G+O),m=-(o/2+G+O)/15):"round-tag"===a?(v=1.12*(o+G+O),y=.07*(o/2+O+G)):"round-triangle"===a&&(v=(o+G+O)*(Math.PI/2),m=-(o+G/2+O)/Math.PI),0!==v&&(d=r*(u=(r+v)/r),["round-hexagon","round-tag"].includes(a)||(p=i*(c=(i+v)/i)));for(var b=d/2,x=p/2,w=(V="auto"===V?Er(d,p):V)+(o+O+G)/2,E=new Array(g.length/2),T=new Array(g.length/2),_=0;_0){if(r=r||n.position(),null==i||null==a){var d=n.padding();i=n.width()+2*d,a=n.height()+2*d}o.colorFillStyle(t,u[0],u[1],u[2],l),o.nodeShapes[c].draw(t,r.x,r.y,i+2*s,a+2*s,h),t.fill()}}}};Yp.drawNodeOverlay=Xp("overlay"),Yp.drawNodeUnderlay=Xp("underlay"),Yp.hasPie=function(e){return(e=e[0])._private.hasPie},Yp.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),o=r.x,s=r.y,l=t.width(),u=t.height(),c=Math.min(l,u)/2,h=0;this.usePaths()&&(o=0,s=0),"%"===a.units?c*=a.pfValue:void 0!==a.pfValue&&(c=a.pfValue/2);for(var d=1;d<=i.pieBackgroundN;d++){var p=t.pstyle("pie-"+d+"-background-size").value,g=t.pstyle("pie-"+d+"-background-color").value,f=t.pstyle("pie-"+d+"-background-opacity").value*n,v=p/100;v+h>1&&(v=1-h);var y=1.5*Math.PI+2*Math.PI*h,m=y+2*Math.PI*v;0===p||h>=1||h+v>1||(e.beginPath(),e.moveTo(o,s),e.arc(o,s,c,y,m),e.closePath(),this.colorFillStyle(e,g[0],g[1],g[2],f),e.fill(),h+=v)}};var Up,jp={},Wp=100;function Hp(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function qp(e,t,n){var r=Hp(e,e.VERTEX_SHADER,t),i=Hp(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function $p(e,t,n){void 0===n&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function Kp(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function Zp(e,t,n,r,i){var a=r*n+t.x,o=i*n+t.y;return[a,o=Math.round(e.canvasHeight-o)]}function Qp(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,o=t,s=n||new Array(4);return s[0]=r*o,s[1]=i*o,s[2]=a*o,s[3]=o,s}function Jp(e,t){var n=t||new Array(4);return n[0]=(255&e)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function eg(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function tg(e,t){var n=e.createTexture();return n.buffer=function(t){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function ng(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function rg(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function ig(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function ag(e,t,n,r){var i=p(ng(e,t),2),a=i[0],o=i[1],s=rg(e,o,r),l=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,s,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,a,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,a,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),l}function og(e,t,n,r){var i=p(ng(e,n),3),a=i[0],o=i[1],s=i[2],l=rg(e,o,t*a),u=a*s,c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,t*u,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,a,o,!1,u,0):o===e.INT&&e.vertexAttribIPointer(r,a,o,u,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var h=new Array(t),d=0;dt.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!h&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var m=n.style(),b=n.zoom(),x=void 0!==o?o:b,w=n.pan(),E={x:w.x,y:w.y},T={zoom:b,pan:{x:w.x,y:w.y}},_=t.prevViewport;void 0===_||T.zoom!==_.zoom||T.pan.x!==_.pan.x||T.pan.y!==_.pan.y||f&&!g||(t.motionBlurPxRatio=1),s&&(E=s),x*=l,E.x*=l,E.y*=l;var A=t.getCachedZSortedEles();function C(e,n,r,i,a){var o=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",t.colorFillStyle(e,255,255,255,t.motionBlurTransparency),e.fillRect(n,r,i,a),e.globalCompositeOperation=o}function D(e,n){var a,l,c,h;t.clearingMotionBlur||e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]&&e!==u.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]?(a=E,l=x,c=t.canvasWidth,h=t.canvasHeight):(a={x:w.x*p,y:w.y*p},l=b*p,c=t.canvasWidth*p,h=t.canvasHeight*p),e.setTransform(1,0,0,1,0,0),"motionBlur"===n?C(e,0,0,c,h):r||void 0!==n&&!n||e.clearRect(0,0,c,h),i||(e.translate(a.x,a.y),e.scale(l,l)),s&&e.translate(s.x,s.y),o&&e.scale(o,o)}if(h||(t.textureDrawLastFrame=!1),h){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var N=t.data.bufferContexts[t.TEXTURE_BUFFER];N.setTransform(1,0,0,1,0,0),N.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:N,drawOnlyNodeLayer:!0,forcedPxRatio:l*t.textureMult}),(T=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight}).mpan={x:(0-T.pan.x)/T.zoom,y:(0-T.pan.y)/T.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var S=u.contexts[t.NODE],L=t.textureCache.texture;T=t.textureCache.viewport,S.setTransform(1,0,0,1,0,0),d?C(S,0,0,T.width,T.height):S.clearRect(0,0,T.width,T.height);var P=m.core("outside-texture-bg-color").value,k=m.core("outside-texture-bg-opacity").value;t.colorFillStyle(S,P[0],P[1],P[2],k),S.fillRect(0,0,T.width,T.height),b=n.zoom(),D(S,!1),S.clearRect(T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l),S.drawImage(L,T.mpan.x,T.mpan.y,T.width/T.zoom/l,T.height/T.zoom/l)}else t.textureOnViewport&&!r&&(t.textureCache=null);var I=n.extent(),M=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),R=t.hideEdgesOnViewport&&M,O=[];if(O[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,O[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),O[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,O[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||O[t.NODE]){var B=d&&!O[t.NODE]&&1!==p;D(S=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:u.contexts[t.NODE]),d&&!B?"motionBlur":void 0),R?t.drawCachedNodes(S,A.nondrag,l,I):t.drawLayeredElements(S,A.nondrag,l,I),t.debug&&t.drawDebugPoints(S,A.nondrag),i||d||(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||O[t.DRAG])&&(B=d&&!O[t.DRAG]&&1!==p,D(S=r||(B?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:u.contexts[t.DRAG]),d&&!B?"motionBlur":void 0),R?t.drawCachedNodes(S,A.drag,l,I):t.drawCachedElements(S,A.drag,l,I),t.debug&&t.drawDebugPoints(S,A.drag),i||d||(c[t.DRAG]=!1)),this.drawSelectionRectangle(e,D),d&&1!==p){var F=u.contexts[t.NODE],z=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],G=u.contexts[t.DRAG],V=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],Y=function(e,n,r){e.setTransform(1,0,0,1,0,0),r||!y?e.clearRect(0,0,t.canvasWidth,t.canvasHeight):C(e,0,0,t.canvasWidth,t.canvasHeight);var i=p;e.drawImage(n, +// img +0,0, +// sx, sy +t.canvasWidth*i,t.canvasHeight*i, +// sw, sh +0,0, +// x, y +t.canvasWidth,t.canvasHeight)};(c[t.NODE]||O[t.NODE])&&(Y(F,z,O[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||O[t.DRAG])&&(Y(G,V,O[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=T,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout((function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!h,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()}),Wp)),r||n.emit("render")},jp.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),o=e.drawOnlyNodeLayer,s=e.drawAllLayers,l=i.canvasNeedsRedraw,u=e.forcedContext;if(n.showFps||!o&&l[n.SELECT_BOX]&&!s){var c=u||i.contexts[n.SELECT_BOX];if(t(c),1==n.selection[4]&&(n.hoverData.selecting||n.touchData.selecting)){var h=n.cy.zoom(),d=a.core("selection-box-border-width").value/h;c.lineWidth=d,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),d>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){h=n.cy.zoom();var p=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(p.x,p.y,a.core("active-bg-size").pfValue/h,0,2*Math.PI),c.fill()}var g=n.lastRedrawTime;if(n.showFps&&g){g=Math.round(g);var f=Math.round(1e3/g),v="1 frame = "+g+" ms = "+f+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!Up){var y=c.measureText(v);Up=y.actualBoundingBoxAscent}c.fillText(v,0,Up);var m=60;c.strokeRect(0,Up+10,250,20),c.fillRect(0,Up+10,250*Math.min(f/m,1),20)}s||(l[n.SELECT_BOX]=!1)}};var ug="undefined"!=typeof Float32Array?Float32Array:Array;function cg(){var e=new ug(9);return ug!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function hg(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function dg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1],g=n[2],f=n[3],v=n[4],y=n[5],m=n[6],b=n[7],x=n[8];return e[0]=d*r+p*o+g*u,e[1]=d*i+p*s+g*c,e[2]=d*a+p*l+g*h,e[3]=f*r+v*o+y*u,e[4]=f*i+v*s+y*c,e[5]=f*a+v*l+y*h,e[6]=m*r+b*o+x*u,e[7]=m*i+b*s+x*c,e[8]=m*a+b*l+x*h,e}function pg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=n[0],p=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=d*r+p*o+u,e[7]=d*i+p*s+c,e[8]=d*a+p*l+h,e}function gg(e,t,n){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],h=t[8],d=Math.sin(n),p=Math.cos(n);return e[0]=p*r+d*o,e[1]=p*i+d*s,e[2]=p*a+d*l,e[3]=p*o-d*r,e[4]=p*s-d*i,e[5]=p*l-d*a,e[6]=u,e[7]=c,e[8]=h,e}function fg(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function vg(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var yg={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},mg=Ft({texRows:24}),bg=Ft({collection:"default",getKey:null, +// since render types (eg node-body, node-overlay) can share an atlas collection, its importeant their style keys don't collide +drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:function(){return!0}, +// this is an extra check for visibility in addition to ele.visible() +getPadding:0}),xg=function(){function e(t,n,i,a){r(this,e),this.debugID=Math.floor(1e4*Math.random()),this.r=t,this.texSize=n,this.texRows=i,this.texHeight=Math.floor(n/i),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=a(t,n,n),this.scratch=a(t,n,this.texHeight,"scratch")}return a(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(e){var t=e.w,n=e.h,r=this.texHeight,i=this.texSize,a=r/n,o=t*a,s=n*a;return o>i&&(o=t*(a=i/t),s=n*a),{scale:a,texW:o,texH:s}}},{key:"draw",value:function(e,t,n){var r=this;if(this.locked)throw new Error("can't draw, atlas is locked");var i=this.texSize,a=this.texRows,o=this.texHeight,s=this.getScale(t),l=s.scale,u=s.texW,c=s.texH,h=[null,null],d=function(e,r){if(n&&r){var i=r.context,a=e.x,s=e.row,u=a,c=o*s;i.save(),i.translate(u,c),i.scale(l,l),n(i,t),i.restore()}},p=function(){d(r.freePointer,r.canvas),h[0]={x:r.freePointer.x,y:r.freePointer.row*o,w:u,h:c},h[1]={ +// indlude a second location with a width of 0, for convenience +x:r.freePointer.x+u,y:r.freePointer.row*o,w:0,h:c},r.freePointer.x+=u,r.freePointer.x==i&&(r.freePointer.x=0,r.freePointer.row++)},g=function(){var e=r.scratch,t=r.canvas;e.clear(),d({x:0,row:0},e);var n=i-r.freePointer.x,a=u-n,s=o,l=r.freePointer.x,p=r.freePointer.row*o,g=n;t.context.drawImage(e,0,0,g,s,l,p,g,s),h[0]={x:l,y:p,w:g,h:c};var f=n,v=(r.freePointer.row+1)*o,y=a;t&&t.context.drawImage(e,f,0,y,s,0,v,y,s),h[1]={x:0,y:v,w:y,h:c},r.freePointer.x=a,r.freePointer.row++},f=function(){r.freePointer.x=0,r.freePointer.row++};if(this.freePointer.x+u<=i)p();else{if(this.freePointer.row>=a-1)return!1;this.freePointer.x===i?(f(),p()):this.enableWrapping?g():(f(),p())}return this.keyToLocation.set(e,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(e){return this.keyToLocation.get(e)}},{key:"isEmpty",value:function(){return 0===this.freePointer.x&&0===this.freePointer.row}},{key:"canFit",value:function(e){if(this.locked)return!1;var t=this.texSize,n=this.texRows,r=this.getScale(e).texW;return!(this.freePointer.x+r>t)||this.freePointer.row1&&void 0!==arguments[1]?arguments[1]:{},r=n.forceRedraw,i=void 0!==r&&r,a=n.filterEle,s=void 0===a?function(){return!0}:a,l=n.filterType,u=void 0===l?function(){return!0}:l,c=!1,h=!1,d=o(e);try{for(d.s();!(t=d.n()).done;){var p=t.value;if(s(p)){var g,f=o(this.renderTypes.values());try{for(f.s();!(g=f.n()).done;){var v=g.value,y=v.type;if(u(y)){var m=v.getKey(p),b=this.collections.get(v.collection);if(i)b.markKeyForGC(m),h=!0;else{var x=v.getID?v.getID(p):p.id(),w=this._key(y,x),E=this.typeAndIdToKey.get(w);void 0!==E&&E!==m&&(this.typeAndIdToKey.delete(w),b.markKeyForGC(E),c=!0)}}}}catch(T){f.e(T)}finally{f.f()}}}}catch(T){d.e(T)}finally{d.f()}return h&&(this.gc(),c=!1),c} +/** Garbage collect */},{key:"gc",value:function(){var e,t=o(this.collections.values());try{for(t.s();!(e=t.n()).done;)e.value.gc()}catch(n){t.e(n)}finally{t.f()}}},{key:"getOrCreateAtlas",value:function(e,t,n){var r=this.renderTypes.get(t),i=r.getKey(e);n||(n=r.getBoundingBox(e));var a=this.collections.get(r.collection),o=!1,s=a.draw(i,n,(function(t){r.drawElement(t,e,n,!0,!0),o=!0}));if(o){var l=r.getID?r.getID(e):e.id(),u=this._key(t,l);this.typeAndIdToKey.set(u,i)}return s}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(e,t){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var n=this.renderTypes.get(t),r=n.getKey(e),i=this.collections.get(n.collection).getAtlas(r);return Boolean(i)&&this.batchAtlases.includes(i)}return!0}},{key:"getAtlasIndexForBatch",value:function(e){var t=this.batchAtlases.indexOf(e);if(t<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(e),t=this.batchAtlases.length-1}return t}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},(function(e,t){return t}))}},{key:"getAtlasInfo",value:function(e,t){var n=this.renderTypes.get(t),r=n.getBoundingBox(e),i=this.getOrCreateAtlas(e,t,r),a=this.getAtlasIndexForBatch(i);if(void 0!==a){var o=n.getKey(e),s=p(i.getOffsets(o),2);return{index:a,tex1:s[0],tex2:s[1],bb:r}}} +/** + * matrix is expected to be a 9 element array + * this function follows same pattern as CRp.drawCachedElementPortion(...) + */},{key:"setTransformMatrix",value:function(e,t,n,r){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=this.getRenderTypeOpts(n),o=a.getPadding?a.getPadding(e):0;if(r){var s=r.bb,l=r.tex1,u=r.tex2,c=l.w/(l.w+u.w);i||(c=1-c);var h=this.getAdjustedBB(s,o,i,c);this._applyTransformMatrix(t,h,a,e)}else{var d=a.getBoundingBox(e),p=this.getAdjustedBB(d,o,!0,1);this._applyTransformMatrix(t,p,a,e)}}},{key:"_applyTransformMatrix",value:function(e,t,n,r){var i,a;hg(e);var o=n.getRotation?n.getRotation(r):0;if(0!==o){var s=n.getRotationPoint(r);pg(e,e,[s.x,s.y]),gg(e,e,o);var l=n.getRotationOffset(r);i=l.x+t.xOffset,a=l.y}else i=t.x1,a=t.y1;pg(e,e,[i,a]),fg(e,e,[t.w,t.h])} +/** + * Adjusts a node or label BB to accomodate padding and split for wrapped textures. + * @param bb - the original bounding box + * @param padding - the padding to add to the bounding box + * @param first - whether this is the first part of a wrapped texture + * @param ratio - the ratio of the texture width of part of the text to the entire texture + */},{key:"getAdjustedBB",value:function(e,t,n,r){var i=e.x1,a=e.y1,o=e.w,s=e.h;t&&(i-=t,a-=t,o+=2*t,s+=2*t);var l=0,u=o*r;return n&&r<1?o=u:!n&&r<1&&(i+=l=o-u,o=u),{x1:i,y1:a,w:o,h:s,xOffset:l}}},{key:"getDebugInfo",value:function(){var e,t=[],n=o(this.collections);try{for(n.s();!(e=n.n()).done;){var r=p(e.value,2),i=r[0],a=r[1].getCounts(),s=a.keyCount,l=a.atlasCount;t.push({type:i,keyCount:s,atlasCount:l})}}catch(u){n.e(u)}finally{n.f()}return t}}])}(),_g=0,Ag=1,Cg=2,Dg=3,Ng=4,Sg=function(){function e(t,n,i){r(this,e),this.r=t,this.gl=n,this.maxInstances=i.webglBatchSize,this.atlasSize=i.webglTexSize,this.bgColor=i.bgColor,this.debug=i.webglDebug,this.batchDebugInfo=[],i.enableWrapping=!0,i.createTextureCanvas=$p,this.atlasManager=new Tg(t,i),this.program=this.createShaderProgram(yg.SCREEN),this.pickingProgram=this.createShaderProgram(yg.PICKING),this.vao=this.createVAO()}return a(e,[{key:"addAtlasCollection",value:function(e,t){this.atlasManager.addAtlasCollection(e,t)}},{key:"addAtlasRenderType",value:function(e,t){this.atlasManager.addRenderType(e,t)}},{key:"invalidate",value:function(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).type,n=this.atlasManager;return t?n.invalidate(e,{filterType:function(e){return e===t},forceRedraw:!0}):n.invalidate(e)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(e){var t=this.gl,n="#version 300 es\n precision highp float;\n\n uniform mat3 uPanZoomMatrix;\n uniform int uAtlasSize;\n \n // instanced\n in vec2 aPosition; \n\n in mat3 aTransform;\n\n // what are we rendering?\n in int aVertType;\n\n // for picking\n in vec4 aIndex;\n \n // For textures\n in int aAtlasId; // which shader unit/atlas to use\n in vec4 aTex; // x/y/w/h of texture in atlas\n\n // for edges\n in vec4 aPointAPointB;\n in vec4 aPointCPointD;\n in float aLineWidth;\n in vec4 aColor;\n\n out vec2 vTexCoord;\n out vec4 vColor;\n flat out int vAtlasId;\n flat out vec4 vIndex;\n flat out int vVertType;\n\n void main(void) {\n int vid = gl_VertexID;\n vec2 position = aPosition;\n\n if(aVertType == ".concat(_g,") {\n float texX = aTex.x;\n float texY = aTex.y;\n float texW = aTex.z;\n float texH = aTex.w;\n\n int vid = gl_VertexID;\n\n if(vid == 1 || vid == 2 || vid == 4) {\n texX += texW;\n }\n if(vid == 2 || vid == 4 || vid == 5) {\n texY += texH;\n }\n\n float d = float(uAtlasSize);\n vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n }\n else if(aVertType == ").concat(Ng,") {\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else if(aVertType == ").concat(Ag,") {\n vec2 source = aPointAPointB.xy;\n vec2 target = aPointAPointB.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 xBasis = target - source;\n vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));\n vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;\n\n gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);\n vColor = aColor;\n } \n else if(aVertType == ").concat(Cg,") {\n vec2 pointA = aPointAPointB.xy;\n vec2 pointB = aPointAPointB.zw;\n vec2 pointC = aPointCPointD.xy;\n vec2 pointD = aPointCPointD.zw;\n\n // adjust the geometry so that the line is centered on the edge\n position.y = position.y - 0.5;\n\n vec2 p0 = pointA;\n vec2 p1 = pointB;\n vec2 p2 = pointC;\n vec2 pos = position;\n if(position.x == 1.0) {\n p0 = pointD;\n p1 = pointC;\n p2 = pointB;\n pos = vec2(0.0, -position.y);\n }\n\n vec2 p01 = p1 - p0;\n vec2 p12 = p2 - p1;\n vec2 p21 = p1 - p2;\n\n // Find the normal vector.\n vec2 tangent = normalize(normalize(p12) + normalize(p01));\n vec2 normal = vec2(-tangent.y, tangent.x);\n\n // Find the vector perpendicular to p0 -> p1.\n vec2 p01Norm = normalize(vec2(-p01.y, p01.x));\n\n // Determine the bend direction.\n float sigma = sign(dot(p01 + p21, normal));\n float width = aLineWidth;\n\n if(sign(pos.y) == -sigma) {\n // This is an intersecting vertex. Adjust the position so that there's no overlap.\n vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n } else {\n // This is a non-intersecting vertex. Treat it like a mitre join.\n vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);\n gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);\n }\n\n vColor = aColor;\n } \n else if(aVertType == ").concat(Dg," && vid < 3) {\n // massage the first triangle into an edge arrow\n if(vid == 0)\n position = vec2(-0.15, -0.3);\n if(vid == 1)\n position = vec2( 0.0, 0.0);\n if(vid == 2)\n position = vec2( 0.15, -0.3);\n\n gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);\n vColor = aColor;\n }\n else {\n gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space\n }\n\n vAtlasId = aAtlasId;\n vIndex = aIndex;\n vVertType = aVertType;\n }\n "),r=this.atlasManager.getIndexArray(),i=qp(t,n,"#version 300 es\n precision highp float;\n\n // define texture unit for each node in the batch\n ".concat(r.map((function(e){return"uniform sampler2D uTexture".concat(e,";")})).join("\n\t"),"\n\n uniform vec4 uBGColor;\n\n in vec2 vTexCoord;\n in vec4 vColor;\n flat in int vAtlasId;\n flat in vec4 vIndex;\n flat in int vVertType;\n\n out vec4 outColor;\n\n void main(void) {\n if(vVertType == ").concat(_g,") {\n ").concat(r.map((function(e){return"if(vAtlasId == ".concat(e,") outColor = texture(uTexture").concat(e,", vTexCoord);")})).join("\n\telse "),"\n } else if(vVertType == ").concat(Dg,") {\n // blend arrow color with background (using premultiplied alpha)\n outColor.rgb = vColor.rgb + (uBGColor.rgb * (1.0 - vColor.a)); \n outColor.a = 1.0; // make opaque, masks out line under arrow\n } else {\n outColor = vColor;\n }\n\n ").concat(e.picking?"if(outColor.a == 0.0) discard;\n else outColor = vIndex;":"","\n }\n "));i.aPosition=t.getAttribLocation(i,"aPosition"),i.aIndex=t.getAttribLocation(i,"aIndex"),i.aVertType=t.getAttribLocation(i,"aVertType"),i.aTransform=t.getAttribLocation(i,"aTransform"),i.aAtlasId=t.getAttribLocation(i,"aAtlasId"),i.aTex=t.getAttribLocation(i,"aTex"),i.aPointAPointB=t.getAttribLocation(i,"aPointAPointB"),i.aPointCPointD=t.getAttribLocation(i,"aPointCPointD"),i.aLineWidth=t.getAttribLocation(i,"aLineWidth"),i.aColor=t.getAttribLocation(i,"aColor"),i.uPanZoomMatrix=t.getUniformLocation(i,"uPanZoomMatrix"),i.uAtlasSize=t.getUniformLocation(i,"uAtlasSize"),i.uBGColor=t.getUniformLocation(i,"uBGColor"),i.uTextures=[];for(var a=0;a1&&void 0!==arguments[1]?arguments[1]:yg.SCREEN;this.panZoomMatrix=e,this.renderTarget=t,this.batchDebugInfo=[],this.wrappedCount=0,this.rectangleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||cg()}},{key:"drawTexture",value:function(e,t,n){var r=this.atlasManager;if(e.visible()&&r.getRenderTypeOpts(n).isVisible(e)){r.canAddToCurrentBatch(e,n)||this.endBatch(),this.instanceCount+1>=this.maxInstances&&this.endBatch();var i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=_g,Jp(t,this.indexBuffer.getView(i));var a=r.getAtlasInfo(e,n),o=a.index,s=a.tex1,l=a.tex2;l.w>0&&this.wrappedCount++;for(var u=!0,c=0,h=[s,l];c=this.maxInstances&&this.endBatch()}}},{key:"drawSimpleRectangle",value:function(e,t,n){if(e.visible()){var r=this.atlasManager,i=this.instanceCount;this.vertTypeBuffer.getView(i)[0]=Ng,Jp(t,this.indexBuffer.getView(i)),Qp(e.pstyle("background-color").value,e.pstyle("background-opacity").value,this.colorBuffer.getView(i));var a=this.transformBuffer.getMatrixView(i);r.setTransformMatrix(e,a,n),this.rectangleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(e,t,n){if(e.visible()){var r,i,a,o=e._private.rscratch;if("source"===n?(r=o.arrowStartX,i=o.arrowStartY,a=o.srcArrowAngle):(r=o.arrowEndX,i=o.arrowEndY,a=o.tgtArrowAngle),!(isNaN(r)||null==r||isNaN(i)||null==i||isNaN(a)||null==a||"none"===e.pstyle(n+"-arrow-shape").value)){var s=e.pstyle(n+"-arrow-color").value,l=e.pstyle("opacity").value*e.pstyle("line-opacity").value,u=e.pstyle("width").pfValue,c=e.pstyle("arrow-scale").value,h=this.r.getArrowWidth(u,c),d=this.instanceCount,p=this.transformBuffer.getMatrixView(d);hg(p),pg(p,p,[r,i]),fg(p,p,[h,h]),gg(p,p,a),this.vertTypeBuffer.getView(d)[0]=Dg,Jp(t,this.indexBuffer.getView(d)),Qp(s,l,this.colorBuffer.getView(d)),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}},{key:"drawEdgeLine",value:function(e,t){if(e.visible()){var n=this.getEdgePoints(e);if(n){var r=e.pstyle("opacity").value,i=e.pstyle("line-opacity").value,a=e.pstyle("width").pfValue,o=e.pstyle("line-color").value,s=r*i;if(n.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),4==n.length){var l=this.instanceCount;this.vertTypeBuffer.getView(l)[0]=Ag,Jp(t,this.indexBuffer.getView(l)),Qp(o,s,this.colorBuffer.getView(l)),this.lineWidthBuffer.getView(l)[0]=a;var u=this.pointAPointBBuffer.getView(l);u[0]=n[0],u[1]=n[1],u[2]=n[2],u[3]=n[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var c=0;c=this.maxInstances&&this.endBatch()}}}}},{key:"getEdgePoints",value:function(e){var t=e._private.rscratch;if(!t.badLine&&null!=t.allpts&&!isNaN(t.allpts[0])){var n=t.allpts;if(4==n.length)return n;var r=this.getNumSegments(e);return this.getCurveSegmentPoints(n,r)}}},{key:"getNumSegments",value:function(e){var t=15;return Math.min(Math.max(t,5),this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(e,t){if(4==e.length)return e;for(var n=Array(2*(t+1)),r=0;r<=t;r++)if(0==r)n[0]=e[0],n[1]=e[1];else if(r==t)n[2*r]=e[e.length-2],n[2*r+1]=e[e.length-1];else{var i=r/t;this.setCurvePoint(e,i,n,2*r)}return n}},{key:"setCurvePoint",value:function(e,t,n,r){if(!(e.length<=2)){for(var i=Array(e.length-2),a=0;a0}},{key:"getStyle",value:function(e,t){return{opacity:t.pstyle("".concat(e,"-opacity")).value,color:t.pstyle("".concat(e,"-color")).value,shape:t.pstyle("".concat(e,"-shape")).value}}},{key:"getPadding",value:function(e,t){return t.pstyle("".concat(e,"-padding")).pfValue}},{key:"draw",value:function(e,t,n,r){if(this.isVisible(e,n)){var i=this.r,a=r.w,o=r.h,s=a/2,l=o/2,u=this.getStyle(e,n),c=u.shape,h=u.color,d=u.opacity;t.save(),t.fillStyle=Lg(h,d),"round-rectangle"===c||"roundrectangle"===c?i.drawRoundRectanglePath(t,s,l,a,o,"auto"):"ellipse"===c&&i.drawEllipsePath(t,s,l,a,o),t.fill(),t.restore()}}}])}(),kg={};function Ig(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return Fe(n)}function Mg(e){var t=e.render;e.render=function(n){n=n||{};var r=e.cy;e.webgl&&(r.zoom()>Gd?(Rg(e),t.call(e,n)):(Og(e),Wg(e,n,yg.SCREEN)))};var n=e.matchCanvasSize;e.matchCanvasSize=function(t){n.call(e,t),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0},e.findNearestElements=function(t,n,r,i){return Xg(e,t,n)};var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0};var i=e.notify;e.notify=function(t,n){i.call(e,t,n),"viewport"===t||"bounds"===t?e.pickingFrameBuffer.needsDraw=!0:"background"===t&&e.drawing.invalidate(n,{type:"node-body"})}}function Rg(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function Og(e){var t=function(t){t.save(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.canvasWidth,e.canvasHeight),t.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function Bg(e){var t=e.canvasWidth,n=e.canvasHeight,r=Kp(e),i=r.pan,a=r.zoom,o=cg();pg(o,o,[i.x,i.y]),fg(o,o,[a,a]);var s=cg();vg(s,t,n);var l=cg();return dg(l,s,o),l}function Fg(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=Kp(e),a=i.pan,o=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(o,o)}function zg(e,t){e.drawSelectionRectangle(t,(function(t){return Fg(e,t)}))}function Gg(e){var t=e.data.contexts[e.NODE];t.save(),Fg(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function Vg(e){var t=function(t,n,r){for(var i=t.atlasManager.getAtlasCollection(n),a=e.data.contexts[e.NODE],o=.125,s=i.atlases,l=0;l=0&&v.add(m)}return v}function Xg(e,t,n){var r,i,a,s=Yg(e,t,n),l=e.getCachedZSortedEles(),u=o(s);try{for(u.s();!(a=u.n()).done;){var c=l[a.value];if(!r&&c.isNode()&&(r=c),!i&&c.isEdge()&&(i=c),r&&i)break}}catch(h){u.e(h)}finally{u.f()}return[r,i].filter(Boolean)}function Ug(e){return"rectangle"===e.pstyle("shape").value&&"solid"===e.pstyle("background-fill").value&&0===e.pstyle("border-width").pfValue&&"none"===e.pstyle("background-image").strValue}function jg(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawTexture(n,t,"node-underlay"),Ug(n)?r.drawSimpleRectangle(n,t,"node-body"):r.drawTexture(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function Wg(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&zg(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=e.data.contexts[e.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var l=Bg(e),u=e.getCachedZSortedEles();if(a=u.length,i.startFrame(l,n),n.screen){for(var c=0;c0&&(r|=n.drawing.invalidate(t)),r&&s()})),Mg(n)};for(var Hg={drawPolygonPath:function(e,t,n,r,i,a){var o=r/2,s=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+o*a[0],n+s*a[1]);for(var l=1;l0&&a>0){d.clearRect(0,0,i,a),d.globalCompositeOperation="source-over";var p=this.getCachedZSortedEles();if(e.full)d.translate(-n.x1*l,-n.y1*l),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(n.x1*l,n.y1*l);else{var g=t.pan(),f={x:g.x*l,y:g.y*l};l*=t.zoom(),d.translate(f.x,f.y),d.scale(l,l),this.drawElements(d,p),d.scale(1/l,1/l),d.translate(-f.x,-f.y)}e.bg&&(d.globalCompositeOperation="destination-over",d.fillStyle=e.bg,d.rect(0,0,i,a),d.fill())}return h},ef.png=function(e){return rf(e,this.bufferCanvasImage(e),"image/png")},ef.jpg=function(e){return rf(e,this.bufferCanvasImage(e),"image/jpeg")};var af={nodeShapeImpl:function(e,t,n,r,i,a,o,s){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,o);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,o,s);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,s);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,o,s);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,s);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}}},of=lf,sf=lf.prototype;function lf(e){var t=this,n=t.cy.window().document;e.webgl&&(sf.CANVAS_LAYERS=t.CANVAS_LAYERS=4),t.data={canvases:new Array(sf.CANVAS_LAYERS),contexts:new Array(sf.CANVAS_LAYERS),canvasNeedsRedraw:new Array(sf.CANVAS_LAYERS),bufferCanvases:new Array(sf.BUFFER_COUNT),bufferContexts:new Array(sf.CANVAS_LAYERS)};var r="-webkit-tap-highlight-color",i="rgba(0,0,0,0)";t.data.canvasContainer=n.createElement("div");var a=t.data.canvasContainer.style;t.data.canvasContainer.style[r]=i,a.position="relative",a.zIndex="0",a.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[r]=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"};me()&&(s["-ms-touch-action"]="none",s["touch-action"]="none");for(var l=0;lt&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&("center"==this.labelPos?this.rect.y-=(this.labelHeight-n)/2:"top"==this.labelPos&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},u.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},u.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new l(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},u.prototype.getLeft=function(){return this.rect.x},u.prototype.getRight=function(){return this.rect.x+this.rect.width},u.prototype.getTop=function(){return this.rect.y},u.prototype.getBottom=function(){return this.rect.y+this.rect.height},u.prototype.getParent=function(){return null==this.owner?null:this.owner.getParent()},e.exports=u}, +/* 4 */ +/***/ +function(e,t,n){function r(e,t){null==e&&null==t?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r}, +/* 5 */ +/***/ +function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),l=n(1),u=n(13),c=n(12),h=n(11);function d(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,null!=t&&t instanceof o?this.graphManager=t:null!=t&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in d.prototype=Object.create(r.prototype),r)d[p]=r[p];d.prototype.getNodes=function(){return this.nodes},d.prototype.getEdges=function(){return this.edges},d.prototype.getGraphManager=function(){return this.graphManager},d.prototype.getParent=function(){return this.parent},d.prototype.getLeft=function(){return this.left},d.prototype.getRight=function(){return this.right},d.prototype.getTop=function(){return this.top},d.prototype.getBottom=function(){return this.bottom},d.prototype.isConnected=function(){return this.isConnected},d.prototype.add=function(e,t,n){if(null==t&&null==n){var r=e;if(null==this.graphManager)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(r)>-1)throw"Node already in graph!";return r.owner=this,this.getNodes().push(r),r}var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw"Source or target not in graph!";if(t.owner!=n.owner||t.owner!=this)throw"Both owners must be this graph!";return t.owner!=n.owner?null:(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i)},d.prototype.remove=function(e){var t=e;if(e instanceof s){if(null==t)throw"Node is null!";if(null==t.owner||t.owner!=this)throw"Owner graph is invalid!";if(null==this.graphManager)throw"Owner graph manager is invalid!";for(var n=t.edges.slice(),r=n.length,i=0;i-1&&c>-1))throw"Source and/or target doesn't know this edge!";if(a.source.edges.splice(u,1),a.target!=a.source&&a.target.edges.splice(c,1),-1==(o=a.source.owner.getEdges().indexOf(a)))throw"Not in owner's edge list!";a.source.owner.getEdges().splice(o,1)}},d.prototype.updateLeftTop=function(){for(var e,t,n,r=i.MAX_VALUE,a=i.MAX_VALUE,o=this.getNodes(),s=o.length,l=0;l(e=u.getTop())&&(r=e),a>(t=u.getLeft())&&(a=t)}return r==i.MAX_VALUE?null:(n=null!=o[0].getParent().paddingLeft?o[0].getParent().paddingLeft:this.margin,this.left=a-n,this.top=r-n,new c(this.left,this.top))},d.prototype.updateBounds=function(e){for(var t,n,r,a,o,s=i.MAX_VALUE,l=-i.MAX_VALUE,c=i.MAX_VALUE,h=-i.MAX_VALUE,d=this.nodes,p=d.length,g=0;g(t=f.getLeft())&&(s=t),l<(n=f.getRight())&&(l=n),c>(r=f.getTop())&&(c=r),h<(a=f.getBottom())&&(h=a)}var v=new u(s,c,l-s,h-c);s==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),o=null!=d[0].getParent().paddingLeft?d[0].getParent().paddingLeft:this.margin,this.left=v.x-o,this.right=v.x+v.width+o,this.top=v.y-o,this.bottom=v.y+v.height+o},d.calculateBounds=function(e){for(var t,n,r,a,o=i.MAX_VALUE,s=-i.MAX_VALUE,l=i.MAX_VALUE,c=-i.MAX_VALUE,h=e.length,d=0;d(t=p.getLeft())&&(o=t),s<(n=p.getRight())&&(s=n),l>(r=p.getTop())&&(l=r),c<(a=p.getBottom())&&(c=a)}return new u(o,l,s-o,c-l)},d.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},d.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw"assert failed";return this.estimatedSize},d.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r=this.nodes.length){var l=0;i.forEach((function(t){t.owner==e&&l++})),l==this.nodes.length&&(this.isConnected=!0)}}else this.isConnected=!0},e.exports=d}, +/* 6 */ +/***/ +function(e,t,n){var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(null==n&&null==r&&null==i){if(null==e)throw"Graph is null!";if(null==t)throw"Parent node is null!";if(this.graphs.indexOf(e)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(e),null!=e.parent)throw"Already has a parent!";if(null!=t.child)throw"Already has a child!";return e.parent=t,t.child=e,e}i=n,n=e;var a=(r=t).getOwner(),o=i.getOwner();if(null==a||a.getGraphManager()!=this)throw"Source not in this graph mgr!";if(null==o||o.getGraphManager()!=this)throw"Target not in this graph mgr!";if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(n),null==n.source||null==n.target)throw"Edge source and/or target is null!";if(-1!=n.source.edges.indexOf(n)||-1!=n.target.edges.indexOf(n))throw"Edge already in source and/or target incidency list!";return n.source.edges.push(n),n.target.edges.push(n),n},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw"Graph not in this graph mgr";if(t!=this.rootGraph&&(null==t.parent||t.parent.graphManager!=this))throw"Invalid parent node!";for(var n,a=[],o=(a=a.concat(t.getEdges())).length,s=0;s=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]o)return n[0]=r,n[1]=l,n[2]=a,n[3]=b,!1;if(ia)return n[0]=s,n[1]=i,n[2]=y,n[3]=o,!1;if(ra?(n[0]=c,n[1]=h,T=!0):(n[0]=u,n[1]=l,T=!0):A===D&&(r>a?(n[0]=s,n[1]=l,T=!0):(n[0]=d,n[1]=h,T=!0)),-C===D?a>r?(n[2]=m,n[3]=b,_=!0):(n[2]=y,n[3]=v,_=!0):C===D&&(a>r?(n[2]=f,n[3]=v,_=!0):(n[2]=x,n[3]=b,_=!0)),T&&_)return!1;if(r>a?i>o?(N=this.getCardinalDirection(A,D,4),S=this.getCardinalDirection(C,D,2)):(N=this.getCardinalDirection(-A,D,3),S=this.getCardinalDirection(-C,D,1)):i>o?(N=this.getCardinalDirection(-A,D,1),S=this.getCardinalDirection(-C,D,3)):(N=this.getCardinalDirection(A,D,2),S=this.getCardinalDirection(C,D,4)),!T)switch(N){case 1:P=l,L=r+-g/D,n[0]=L,n[1]=P;break;case 2:L=d,P=i+p*D,n[0]=L,n[1]=P;break;case 3:P=h,L=r+g/D,n[0]=L,n[1]=P;break;case 4:L=c,P=i+-p*D,n[0]=L,n[1]=P}if(!_)switch(S){case 1:I=v,k=a+-E/D,n[2]=k,n[3]=I;break;case 2:k=x,I=o+w*D,n[2]=k,n[3]=I;break;case 3:I=b,k=a+E/D,n[2]=k,n[3]=I;break;case 4:k=m,I=o+-w*D,n[2]=k,n[3]=I}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(null==i)return this.getIntersection2(e,t,n);var a,o,s,l,u,c,h,d=e.x,p=e.y,g=t.x,f=t.y,v=n.x,y=n.y,m=i.x,b=i.y;return 0==(h=(a=f-p)*(l=v-m)-(o=b-y)*(s=d-g))?null:new r((s*(c=m*y-v*b)-l*(u=g*p-d*f))/h,(o*u-a*c)/h)},i.angleOfVector=function(e,t,n,r){var i=void 0;return e!==n?(i=Math.atan((r-t)/(n-e)),n0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r}, +/* 10 */ +/***/ +function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r}, +/* 11 */ +/***/ +function(e,t,n){var r=function(){function e(e,t){for(var n=0;n0&&t;){for(s.push(u[0]);s.length>0&&t;){var c=s[0];s.splice(0,1),o.add(c);var h=c.getEdges();for(a=0;a-1&&u.splice(f,1)}o=new Set,l=new Map}else e=[]}return e},d.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i0){for(var i=this.edgeToDummyNodes.get(n),a=0;a=0&&t.splice(h,1),c.getNeighborsList().forEach((function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;1==t&&l.push(e),r.set(e,t)}}))}n=n.concat(l),1!=t.length&&2!=t.length||(i=!0,a=t[0])}return a},d.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=d}, +/* 16 */ +/***/ +function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=1e4*Math.sin(r.seed++),r.x-Math.floor(r.x)},e.exports=r}, +/* 17 */ +/***/ +function(e,t,n){var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return 0!=n&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return 0!=n&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return 0!=n&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return 0!=n&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i}, +/* 18 */ +/***/ +function(e,t,n){var r=n(15),i=n(7),a=n(0),o=n(8),s=n(9);function l(){r.call(this),this.useSmartIdealEdgeLengthCalculation=i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=i.DEFAULT_EDGE_LENGTH,this.springConstant=i.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=i.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=i.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=i.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=i.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=i.MAX_ITERATIONS}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,o,s,l=this.getGraphManager().getAllEdges(),u=0;ui.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(e-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(5*this.getAllNodes().length,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e,t=this.getAllEdges(),n=0;n0&&void 0!==arguments[0])||arguments[0],s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=this.getAllNodes();if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&o&&this.updateGrid(),a=new Set,e=0;e(l=t.getEstimatedSize()*this.gravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a):(o>(l=t.getEstimatedSize()*this.compoundGravityRangeFactor)||s>l)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant)},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement=s.length||u>=s[0].length))for(var c=0;ce}}]),e}();e.exports=a}, +/* 25 */ +/***/ +function(e,t,n){var r=function(){function e(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=i,this.gap_penalty=a,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=new Array(this.iMax);for(var o=0;o=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;ne.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),null==this.child||0==this.child.getNodes().length?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n,r=this.getChild().getNodes(),i=0;i0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter((function(e){return t.has(e)}));this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},m.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}if(this.totalIterations%u.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged()){if(!(this.prunedNodesAll.length>0))return!0;this.isTreeGrowing=!0}this.coolingCycle++,0==this.layoutQuality?this.coolingAdjuster=this.coolingCycle:1==this.layoutQuality&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter((function(t){return e.has(t)}));this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=u.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},m.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n1)for(s=0;sr&&(r=Math.floor(o.y)),a=Math.floor(o.x+l.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(c.WORLD_CENTER_X-o.x/2,c.WORLD_CENTER_Y-o.y/2))},m.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),l.DEFAULT_RADIAL_SEPARATION);m.branchRadialLayout(t,null,0,359,0,r);var i=v.calculateBounds(e),a=new y;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o1;){var y=v[0];v.splice(0,1);var b=c.indexOf(y);b>=0&&c.splice(b,1),g--,h--}d=null!=t?(c.indexOf(v[0])+1)%g:0;for(var x=Math.abs(r-n)/h,w=d;p!=h;w=++w%g){var E=c[w].getOtherEnd(e);if(E!=t){var T=(n+p*x)%360,_=(T+x)%360;m.branchRadialLayout(E,e,T,_,i+a,a),p++}}},m.maxDiagonalInTree=function(e){for(var t=g.MIN_VALUE,n=0;nt&&(t=r)}return t},m.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},m.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i1){var r="DummyCompound_"+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),l=i.getChild();l.add(a);for(var u=0;u=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},m.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach((function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)}))},m.prototype.getToBeTiled=function(e){var t=e.id;if(null!=this.toBeTiled[t])return this.toBeTiled[t];var n=e.getChild();if(null==n)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i0)return this.toBeTiled[t]=!1,!1;if(null!=a.getChild()){if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}else this.toBeTiled[a.id]=!1}return this.toBeTiled[t]=!0,!0},m.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;rl&&(l=c.rect.height)}n+=l+e.verticalPadding}},m.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach((function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height}))},m.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t, +// assume minHeight equals to minWidth +verticalPadding:l.TILING_PADDING_VERTICAL,horizontalPadding:l.TILING_PADDING_HORIZONTAL};e.sort((function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:e.rect.width*e.rect.height0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},m.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;rn&&(t=r,n=e.rowWidth[r]);return t},m.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a,o,s=0;return e.rowHeight[r]0&&(s=n+e.verticalPadding-e.rowHeight[r]),a=e.width-i>=t+e.horizontalPadding?(e.height+s)/(i+t+e.horizontalPadding):(e.height+s)/e.width,s=n+e.verticalPadding,(o=e.widtha&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;so&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]0)for(var c=i;c<=a;c++)l[0]+=this.grid[c][o-1].length+this.grid[c][o].length-1;if(a0)for(c=o;c<=s;c++)l[3]+=this.grid[i-1][c].length+this.grid[i][c].length-1;for(var h,d,p=g.MAX_VALUE,f=0;f0&&(o=n.getGraphManager().add(n.newGraph(),a),this.processChildrenList(o,h,n))}},h.prototype.stop=function(){return this.stopped=!0,this};var p=function(e){e("layout","cose-bilkent",h)};"undefined"!=typeof cytoscape&&p(cytoscape),e.exports=p} +/******/]))),g.exports));var E=function(){var e=function(e,t,n,r){for(n=n||{},r=e.length;r--;n[e[r]]=t);return n},t=[1,4],n=[1,13],r=[1,12],i=[1,15],a=[1,16],o=[1,20],s=[1,19],l=[6,7,8],u=[1,26],c=[1,24],h=[1,25],d=[6,7,11],p=[1,6,13,15,16,19,22],g=[1,33],f=[1,34],v=[1,6,7,11,13,15,16,19,22],y={trace:function(){},yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 6:case 7:return r;case 8:r.getLogger().trace("Stop NL ");break;case 9:r.getLogger().trace("Stop EOF ");break;case 11:r.getLogger().trace("Stop NL2 ");break;case 12:r.getLogger().trace("Stop EOF2 ");break;case 15:r.getLogger().info("Node: ",a[s].id),r.addNode(a[s-1].length,a[s].id,a[s].descr,a[s].type);break;case 16:r.getLogger().trace("Icon: ",a[s]),r.decorateNode({icon:a[s]});break;case 17:case 21:r.decorateNode({class:a[s]});break;case 18:r.getLogger().trace("SPACELIST");break;case 19:r.getLogger().trace("Node: ",a[s].id),r.addNode(0,a[s].id,a[s].descr,a[s].type);break;case 20:r.decorateNode({icon:a[s]});break;case 25:r.getLogger().trace("node found ..",a[s-2]),this.$={id:a[s-1],descr:a[s-1],type:r.getType(a[s-2],a[s])};break;case 26:this.$={id:a[s],descr:a[s],type:r.nodeType.DEFAULT};break;case 27:r.getLogger().trace("node found ..",a[s-3]),this.$={id:a[s-3],descr:a[s-1],type:r.getType(a[s-2],a[s])}}},table:[{3:1,4:2,5:3,6:[1,5],8:t},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:t},{6:n,7:[1,10],9:9,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(l,[2,3]),{1:[2,2]},e(l,[2,4]),e(l,[2,5]),{1:[2,6],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:n,9:22,12:11,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},{6:u,7:c,10:23,11:h},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:o,22:s}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:u,7:c,10:32,11:h},{1:[2,7],6:n,12:21,13:r,14:14,15:i,16:a,17:17,18:18,19:o,22:s},e(p,[2,14],{7:g,11:f}),e(v,[2,8]),e(v,[2,9]),e(v,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(p,[2,13],{7:g,11:f}),e(v,[2,11]),e(v,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:function(e,t){if(!t.recoverable){var n=new Error(e);throw n.hash=t,n}this.trace(e)},parse:function(e){var t=this,n=[0],r=[],i=[null],a=[],o=this.table,s="",l=0,u=0,c=a.slice.call(arguments,1),h=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);h.setInput(e,d.yy),d.yy.lexer=h,d.yy.parser=this,void 0===h.yylloc&&(h.yylloc={});var g=h.yylloc;a.push(g);var f=h.options&&h.options.ranges;"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var v,y,m,b,x,w,E,T,_,A={};;){if(y=n[n.length-1],this.defaultActions[y]?m=this.defaultActions[y]:(null==v&&(_=void 0,"number"!=typeof(_=r.pop()||h.lex()||1)&&(_ instanceof Array&&(_=(r=_).pop()),_=t.symbols_[_]||_),v=_),m=o[y]&&o[y][v]),void 0===m||!m.length||!m[0]){var C="";for(x in T=[],o[y])this.terminals_[x]&&x>2&&T.push("'"+this.terminals_[x]+"'");C=h.showPosition?"Parse error on line "+(l+1)+":\n"+h.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[v]||v)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==v?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(C,{text:h.match,token:this.terminals_[v]||v,line:h.yylineno,loc:g,expected:T})}if(m[0]instanceof Array&&m.length>1)throw new Error("Parse Error: multiple actions possible at state: "+y+", token: "+v);switch(m[0]){case 1:n.push(v),i.push(h.yytext),a.push(h.yylloc),n.push(m[1]),v=null,u=h.yyleng,s=h.yytext,l=h.yylineno,g=h.yylloc;break;case 2:if(w=this.productions_[m[1]][1],A.$=i[i.length-w],A._$={first_line:a[a.length-(w||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(w||1)].first_column,last_column:a[a.length-1].last_column},f&&(A._$.range=[a[a.length-(w||1)].range[0],a[a.length-1].range[1]]),void 0!==(b=this.performAction.apply(A,[s,u,l,d.yy,m[1],i,a].concat(c))))return b;w&&(n=n.slice(0,-1*w*2),i=i.slice(0,-1*w),a=a.slice(0,-1*w)),n.push(this.productions_[m[1]][0]),i.push(A.$),a.push(A._$),E=o[n[n.length-2]][n[n.length-1]],n.push(E);break;case 3:return!0}}return!0}},m=function(){return{EOF:1,parseError:function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)}, +// resets the lexer, sets new input +setInput:function(e,t){return this.yy=t||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this}, +// consumes and returns one char from the input +input:function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e}, +// unshifts one char (or a string) into the input +unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this}, +// When called from action, caches matched text and appends it on next action +more:function(){return this._more=!0,this}, +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}, +// retain first n characters of the match +less:function(e){this.unput(this.match.slice(e))}, +// displays already matched input, i.e. for error messages +pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")}, +// displays upcoming input, i.e. for error messages +upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")}, +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"}, +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function(e,t){var n,r,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(r=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=r.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:r?r[r.length-1].length-r[r.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(e[0].length),this.matched+=e[0],n=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in i)this[a]=i[a];return!1}return!1}, +// return next match in input +next:function(){if(this.done)return this.EOF;var e,t,n,r;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),a=0;at[0].length)){if(t=n,r=a,this.options.backtrack_lexer){if(!1!==(e=this.test_match(n,i[a])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,i[r]))&&e:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}, +// return next match that has a token +lex:function(){var e=this.next();return e||this.lex()}, +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function(e){this.conditionStack.push(e)}, +// pop the previously active lexer condition state off the condition stack +popState:function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]}, +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules}, +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"}, +// alias for begin(condition) +pushState:function(e){this.begin(e)}, +// return the number of states currently on the stack +stateStackSize:function(){return this.conditionStack.length},options:{"case-insensitive":!0},performAction:function(e,t,n,r){switch(n){case 0:e.getLogger().trace("Found comment",t.yytext);break;case 1:return 8;case 2:this.begin("CLASS");break;case 3:return this.popState(),16;case 4:case 23:this.popState();break;case 5:e.getLogger().trace("Begin icon"),this.begin("ICON");break;case 6:return e.getLogger().trace("SPACELINE"),6;case 7:return 7;case 8:return 15;case 9:e.getLogger().trace("end icon"),this.popState();break;case 10:return e.getLogger().trace("Exploding node"),this.begin("NODE"),19;case 11:return e.getLogger().trace("Cloud"),this.begin("NODE"),19;case 12:return e.getLogger().trace("Explosion Bang"),this.begin("NODE"),19;case 13:return e.getLogger().trace("Cloud Bang"),this.begin("NODE"),19;case 14:case 15:case 16:case 17:return this.begin("NODE"),19;case 18:return 13;case 19:return 22;case 20:return 11;case 21:e.getLogger().trace("Starting NSTR"),this.begin("NSTR");break;case 22:return e.getLogger().trace("description:",t.yytext),"NODE_DESCR";case 24:return this.popState(),e.getLogger().trace("node end ))"),"NODE_DEND";case 25:return this.popState(),e.getLogger().trace("node end )"),"NODE_DEND";case 26:return this.popState(),e.getLogger().trace("node end ...",t.yytext),"NODE_DEND";case 27:case 30:case 31:return this.popState(),e.getLogger().trace("node end (("),"NODE_DEND";case 28:case 29:return this.popState(),e.getLogger().trace("node end (-"),"NODE_DEND";case 32:case 33:return e.getLogger().trace("Long description:",t.yytext),20}},rules:[/^(?:\s*%%.*)/i,/^(?:mindmap\b)/i,/^(?::::)/i,/^(?:.+)/i,/^(?:\n)/i,/^(?:::icon\()/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[^\)]+)/i,/^(?:\))/i,/^(?:-\))/i,/^(?:\(-)/i,/^(?:\)\))/i,/^(?:\))/i,/^(?:\(\()/i,/^(?:\{\{)/i,/^(?:\()/i,/^(?:\[)/i,/^(?:[\s]+)/i,/^(?:[^\(\[\n\-\)\{\}]+)/i,/^(?:$)/i,/^(?:["])/i,/^(?:[^"]+)/i,/^(?:["])/i,/^(?:[\)]\))/i,/^(?:[\)])/i,/^(?:[\]])/i,/^(?:\}\})/i,/^(?:\(-)/i,/^(?:-\))/i,/^(?:\(\()/i,/^(?:\()/i,/^(?:[^\)\]\(\}]+)/i,/^(?:.+(?!\(\())/i],conditions:{CLASS:{rules:[3,4],inclusive:!1},ICON:{rules:[8,9],inclusive:!1},NSTR:{rules:[22,23],inclusive:!1},NODE:{rules:[21,24,25,26,27,28,29,30,31,32,33],inclusive:!1},INITIAL:{rules:[0,1,2,5,6,7,10,11,12,13,14,15,16,17,18,19,20],inclusive:!0}}}}();function b(){this.yy={}}return y.lexer=m,b.prototype=y,y.Parser=b,new b}();E.parser=E;const T=E,_=e=>o(e,n());let A=[],C=0,D={};const N={DEFAULT:0,NO_BORDER:0,ROUNDED_RECT:1,RECT:2,CIRCLE:3,CLOUD:4,BANG:5,HEXAGON:6},S=(e,t)=>{D[e]=t},L=e=>{switch(e){case N.DEFAULT:return"no-border";case N.RECT:return"rect";case N.ROUNDED_RECT:return"rounded-rect";case N.CIRCLE:return"circle";case N.CLOUD:return"cloud";case N.BANG:return"bang";case N.HEXAGON:return"hexgon";default:return"no-border"}};let P;const k=e=>D[e],I=Object.freeze(Object.defineProperty({__proto__:null,addNode:(e,t,i,a)=>{r.info("addNode",e,t,i,a);const o=n(),s={id:C++,nodeId:_(t),level:e,descr:_(i),type:a,children:[],width:n().mindmap.maxNodeWidth};switch(s.type){case N.ROUNDED_RECT:case N.RECT:case N.HEXAGON:s.padding=2*o.mindmap.padding;break;default:s.padding=o.mindmap.padding}const l=function(e){for(let t=A.length-1;t>=0;t--)if(A[t].level{A=[],C=0,D={}},decorateNode:e=>{const t=A[A.length-1];e&&e.icon&&(t.icon=_(e.icon)),e&&e.class&&(t.class=_(e.class))},getElementById:k,getLogger:()=>r,getMindmap:()=>A.length>0?A[0]:null,getNodeById:e=>A[e],getType:(e,t)=>{switch(r.debug("In get type",e,t),e){case"[":return N.RECT;case"(":return")"===t?N.ROUNDED_RECT:N.CLOUD;case"((":return N.CIRCLE;case")":return N.CLOUD;case"))":return N.BANG;case"{{":return N.HEXAGON;default:return N.DEFAULT}},nodeType:N,get parseError(){return P},sanitizeText:_,setElementForId:S,setErrorHandler:e=>{P=e},type2Str:L},Symbol.toStringTag,{value:"Module"}));function M(e,t){e.each((function(){var e,n=i(this),r=n.text().split(/(\s+|
)/).reverse(),a=[],o=n.attr("y"),s=parseFloat(n.attr("dy")),l=n.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em");for(let i=0;it||"
"===e)&&(a.pop(),l.text(a.join(" ").trim()),a="
"===e?[""]:[e],l=n.append("tspan").attr("x",0).attr("y",o).attr("dy","1.1em").text(e))}))}const R=function(e,t,n,r){const i=n%11,a=e.append("g");t.section=i;let o="section-"+i;i<0&&(o+=" section-root"),a.attr("class",(t.class?t.class+" ":"")+"mindmap-node "+o);const s=a.append("g"),l=a.append("g"),u=l.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(M,t.width).node().getBBox(),c=r.fontSize.replace?r.fontSize.replace("px",""):r.fontSize;if(t.height=u.height+1.1*c*.5+t.padding,t.width=u.width+2*t.padding,t.icon)if(t.type===N.CIRCLE){t.height+=50,t.width+=50;a.append("foreignObject").attr("height","50px").attr("width",t.width).attr("style","text-align: center;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+t.width/2+", "+(t.height/2-1.5*t.padding)+")")}else{t.width+=50;const e=t.height;t.height=Math.max(e,60);const n=Math.abs(t.height-e);a.append("foreignObject").attr("width","60px").attr("height",t.height).attr("style","text-align: center;margin-top:"+n/2+"px;").append("div").attr("class","icon-container").append("i").attr("class","node-icon-"+i+" "+t.icon),l.attr("transform","translate("+(25+t.width/2)+", "+(n/2+t.padding/2)+")")}else l.attr("transform","translate("+t.width/2+", "+t.padding/2+")");switch(t.type){case N.DEFAULT:!function(e,t,n){e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("d",`M0 ${t.height-5} v${10-t.height} q0,-5 5,-5 h${t.width-10} q5,0 5,5 v${t.height-5} H0 Z`),e.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)}(s,t,i);break;case N.ROUNDED_RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("height",t.height).attr("rx",t.padding).attr("ry",t.padding).attr("width",t.width)}(s,t);break;case N.RECT:!function(e,t){e.append("rect").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("height",t.height).attr("width",t.width)}(s,t);break;case N.CIRCLE:s.attr("transform","translate("+t.width/2+", "+ +t.height/2+")"),function(e,t){e.append("circle").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("r",t.width/2)}(s,t);break;case N.CLOUD:!function(e,t){const n=t.width,r=t.height,i=.15*n,a=.25*n,o=.35*n,s=.2*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("d",`M0 0 a${i},${i} 0 0,1 ${.25*n},${-1*n*.1}\n a${o},${o} 1 0,1 ${.4*n},${-1*n*.1}\n a${a},${a} 1 0,1 ${.35*n},${1*n*.2}\n\n a${i},${i} 1 0,1 ${.15*n},${1*r*.35}\n a${s},${s} 1 0,1 ${-1*n*.15},${1*r*.65}\n\n a${a},${i} 1 0,1 ${-1*n*.25},${.15*n}\n a${o},${o} 1 0,1 ${-1*n*.5},0\n a${i},${i} 1 0,1 ${-1*n*.25},${-1*n*.15}\n\n a${i},${i} 1 0,1 ${-1*n*.1},${-1*r*.35}\n a${s},${s} 1 0,1 ${.1*n},${-1*r*.65}\n\n H0 V0 Z`)}(s,t);break;case N.BANG:!function(e,t){const n=t.width,r=t.height,i=.15*n;e.append("path").attr("id","node-"+t.id).attr("class","node-bkg node-"+L(t.type)).attr("d",`M0 0 a${i},${i} 1 0,0 ${.25*n},${-1*r*.1}\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},0\n a${i},${i} 1 0,0 ${.25*n},${1*r*.1}\n\n a${i},${i} 1 0,0 ${.15*n},${1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${1*r*.34}\n a${i},${i} 1 0,0 ${-1*n*.15},${1*r*.33}\n\n a${i},${i} 1 0,0 ${-1*n*.25},${.15*r}\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},0\n a${i},${i} 1 0,0 ${-1*n*.25},${-1*r*.15}\n\n a${i},${i} 1 0,0 ${-1*n*.1},${-1*r*.33}\n a${.8*i},${.8*i} 1 0,0 0,${-1*r*.34}\n a${i},${i} 1 0,0 ${.1*n},${-1*r*.33}\n\n H0 V0 Z`)}(s,t);break;case N.HEXAGON:!function(e,t){const n=t.height,r=n/4,i=t.width-t.padding+2*r;!function(e,t,n,r,i){e.insert("polygon",":first-child").attr("points",r.map((function(e){return e.x+","+e.y})).join(" ")).attr("transform","translate("+(i.width-t)/2+", "+n+")")}(e,i,n,[{x:r,y:0},{x:i-r,y:0},{x:i,y:-n/2},{x:i-r,y:-n},{x:r,y:-n},{x:0,y:-n/2}],t)}(s,t)}return S(t.id,a),t.height},O=function(e){const t=k(e.id),n=e.x||0,r=e.y||0;t.attr("transform","translate("+n+","+r+")")};function B(e,t,n,r){R(e,t,n,r),t.children&&t.children.forEach(((t,i)=>{B(e,t,n<0?i:n,r)}))}function F(e,t,n,r){t.add({group:"nodes",data:{id:e.id,labelText:e.descr,height:e.height,width:e.width,level:r,nodeId:e.id,padding:e.padding,type:e.type},position:{x:e.x,y:e.y}}),e.children&&e.children.forEach((i=>{F(i,t,n,r+1),t.add({group:"edges",data:{id:`${e.id}_${i.id}`,source:e.id,target:i.id,depth:r,section:i.section}})}))}function z(e,t){return new Promise((n=>{const a=i("body").append("div").attr("id","cy").attr("style","display:none"),o=d({container:document.getElementById("cy"), +// container to render in +style:[{selector:"edge",style:{"curve-style":"bezier"}}]});a.remove(),F(e,o,t,0),o.nodes().forEach((function(e){e.layoutDimensions=()=>{const t=e.data();return{w:t.width,h:t.height}}})),o.layout({name:"cose-bilkent",quality:"proof", +// headless: true, +styleEnabled:!1,animate:!1}).run(),o.ready((e=>{r.info("Ready",e),n(o)}))}))}d.use(w);const G={db:I,renderer:{draw:async(e,t,o,s)=>{const l=n();s.db.clear(),s.parser.parse(e),r.debug("Renering info diagram\n"+e);const u=n().securityLevel;let c;"sandbox"===u&&(c=i("#i"+t));const h=i("sandbox"===u?c.nodes()[0].contentDocument.body:"body").select("#"+t);h.append("g");const d=s.db.getMindmap(),p=h.append("g");p.attr("class","mindmap-edges");const g=h.append("g");g.attr("class","mindmap-nodes"),B(g,d,-1,l);const f=await z(d,l);!function(e,t){t.edges().map(((t,n)=>{const i=t.data();if(t[0]._private.bodyBounds){const a=t[0]._private.rscratch;r.trace("Edge: ",n,i),e.insert("path").attr("d",`M ${a.startX},${a.startY} L ${a.midX},${a.midY} L${a.endX},${a.endY} `).attr("class","edge section-edge-"+i.section+" edge-depth-"+i.depth)}}))}(p,f),function(e){e.nodes().map(((e,t)=>{const n=e.data();n.x=e.position().x,n.y=e.position().y,O(n);const i=k(n.nodeId);r.info("Id:",t,"Position: (",e.position().x,", ",e.position().y,")",n),i.attr("transform",`translate(${e.position().x-n.width/2}, ${e.position().y-n.height/2})`),i.attr("attr",`apa-${t})`)}))}(f),a(void 0,h,l.mindmap.padding,l.mindmap.useMaxWidth)}},parser:T,styles:n=>`\n .edge {\n stroke-width: 3;\n }\n ${(n=>{let r="";for(let i=0;i